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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/.cvsignore1
-rw-r--r--mcs/class/Accessibility/.cvsignore3
-rw-r--r--mcs/class/Accessibility/Accessibility.build38
-rw-r--r--mcs/class/Accessibility/Accessibility/.cvsignore3
-rw-r--r--mcs/class/Accessibility/Accessibility/IAccessible.cs35
-rw-r--r--mcs/class/Accessibility/Accessibility/IAccessibleHandler.cs3
-rw-r--r--mcs/class/Accessibility/ChangeLog3
-rw-r--r--mcs/class/Accessibility/list.unix2
-rw-r--r--mcs/class/Accessibility/makefile.gnu16
-rw-r--r--mcs/class/ChangeLog56
-rw-r--r--mcs/class/Cscompmgd/.cvsignore3
-rw-r--r--mcs/class/Cscompmgd/ChangeLog3
-rw-r--r--mcs/class/Cscompmgd/Cscompmgd.build27
-rw-r--r--mcs/class/Cscompmgd/Microsoft.CSharp/ChangeLog56
-rw-r--r--mcs/class/Cscompmgd/Microsoft.CSharp/Compiler.cs266
-rw-r--r--mcs/class/Cscompmgd/Microsoft.CSharp/CompilerError.cs108
-rw-r--r--mcs/class/Cscompmgd/Microsoft.CSharp/ErrorLevel.cs17
-rw-r--r--mcs/class/Cscompmgd/Microsoft.CSharp/TODOAttribute.cs33
-rw-r--r--mcs/class/Cscompmgd/list.unix4
-rw-r--r--mcs/class/Cscompmgd/makefile.gnu15
-rw-r--r--mcs/class/I18N/.cvsignore5
-rw-r--r--mcs/class/I18N/CJK/.cvsignore4
-rw-r--r--mcs/class/I18N/CJK/CP932.cs849
-rw-r--r--mcs/class/I18N/CJK/CodeTable.cs143
-rw-r--r--mcs/class/I18N/CJK/JISConvert.cs97
-rw-r--r--mcs/class/I18N/CJK/jis.tablebin0 -> 101572 bytes
-rwxr-xr-xmcs/class/I18N/CJK/list.unix3
-rwxr-xr-xmcs/class/I18N/CJK/makefile.gnu13
-rw-r--r--mcs/class/I18N/Common/.cvsignore4
-rw-r--r--mcs/class/I18N/Common/ByteEncoding.cs401
-rw-r--r--mcs/class/I18N/Common/Handlers.cs198
-rw-r--r--mcs/class/I18N/Common/Manager.cs342
-rw-r--r--mcs/class/I18N/Common/Strings.cs56
-rwxr-xr-xmcs/class/I18N/Common/list.unix4
-rwxr-xr-xmcs/class/I18N/Common/makefile.gnu13
-rw-r--r--mcs/class/I18N/I18N.build116
-rw-r--r--mcs/class/I18N/MidEast/.cvsignore4
-rw-r--r--mcs/class/I18N/MidEast/CP1254.cs399
-rw-r--r--mcs/class/I18N/MidEast/CP1255.cs393
-rw-r--r--mcs/class/I18N/MidEast/CP1256.cs771
-rw-r--r--mcs/class/I18N/MidEast/CP28596.cs545
-rw-r--r--mcs/class/I18N/MidEast/CP28598.cs261
-rw-r--r--mcs/class/I18N/MidEast/CP28599.cs241
-rw-r--r--mcs/class/I18N/MidEast/CP38598.cs261
-rw-r--r--mcs/class/I18N/MidEast/ibm-1089.ucm477
-rw-r--r--mcs/class/I18N/MidEast/ibm-5350.ucm377
-rw-r--r--mcs/class/I18N/MidEast/ibm-5351.ucm368
-rw-r--r--mcs/class/I18N/MidEast/ibm-5352.ucm551
-rw-r--r--mcs/class/I18N/MidEast/ibm-916.ucm339
-rw-r--r--mcs/class/I18N/MidEast/ibm-920.ucm378
-rwxr-xr-xmcs/class/I18N/MidEast/list.unix7
-rwxr-xr-xmcs/class/I18N/MidEast/makefile.gnu13
-rw-r--r--mcs/class/I18N/Other/.cvsignore4
-rw-r--r--mcs/class/I18N/Other/CP1251.cs403
-rw-r--r--mcs/class/I18N/Other/CP1257.cs395
-rw-r--r--mcs/class/I18N/Other/CP1258.cs399
-rw-r--r--mcs/class/I18N/Other/CP20866.cs429
-rw-r--r--mcs/class/I18N/Other/CP21866.cs429
-rw-r--r--mcs/class/I18N/Other/CP28594.cs333
-rw-r--r--mcs/class/I18N/Other/CP28595.cs345
-rw-r--r--mcs/class/I18N/Other/CP57002.cs496
-rw-r--r--mcs/class/I18N/Other/CP874.cs537
-rw-r--r--mcs/class/I18N/Other/ibm-5347.ucm377
-rw-r--r--mcs/class/I18N/Other/ibm-5353.ucm377
-rw-r--r--mcs/class/I18N/Other/ibm-5354.ucm377
-rw-r--r--mcs/class/I18N/Other/ibm-874.ucm345
-rw-r--r--mcs/class/I18N/Other/ibm-878.ucm379
-rw-r--r--mcs/class/I18N/Other/ibm-914.ucm377
-rw-r--r--mcs/class/I18N/Other/ibm-915.ucm377
-rw-r--r--mcs/class/I18N/Other/koi8-u.ucm363
-rwxr-xr-xmcs/class/I18N/Other/list.unix9
-rwxr-xr-xmcs/class/I18N/Other/makefile.gnu13
-rw-r--r--mcs/class/I18N/README158
-rwxr-xr-xmcs/class/I18N/README.mono13
-rw-r--r--mcs/class/I18N/Rare/.cvsignore4
-rw-r--r--mcs/class/I18N/Rare/CP1026.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1047.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1140.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1141.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1142.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1143.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1144.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1145.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1146.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1147.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1148.cs895
-rw-r--r--mcs/class/I18N/Rare/CP1149.cs895
-rw-r--r--mcs/class/I18N/Rare/CP20273.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20277.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20278.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20280.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20284.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20285.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20290.cs865
-rw-r--r--mcs/class/I18N/Rare/CP20297.cs897
-rw-r--r--mcs/class/I18N/Rare/CP20420.cs1073
-rw-r--r--mcs/class/I18N/Rare/CP20424.cs829
-rw-r--r--mcs/class/I18N/Rare/CP20871.cs897
-rw-r--r--mcs/class/I18N/Rare/CP21025.cs917
-rw-r--r--mcs/class/I18N/Rare/CP37.cs897
-rw-r--r--mcs/class/I18N/Rare/CP500.cs897
-rw-r--r--mcs/class/I18N/Rare/CP708.cs545
-rw-r--r--mcs/class/I18N/Rare/CP852.cs679
-rw-r--r--mcs/class/I18N/Rare/CP855.cs679
-rw-r--r--mcs/class/I18N/Rare/CP857.cs673
-rw-r--r--mcs/class/I18N/Rare/CP858.cs679
-rw-r--r--mcs/class/I18N/Rare/CP862.cs685
-rw-r--r--mcs/class/I18N/Rare/CP864.cs861
-rw-r--r--mcs/class/I18N/Rare/CP866.cs689
-rw-r--r--mcs/class/I18N/Rare/CP869.cs681
-rw-r--r--mcs/class/I18N/Rare/CP870.cs895
-rw-r--r--mcs/class/I18N/Rare/CP875.cs913
-rw-r--r--mcs/class/I18N/Rare/ibm-1025.ucm371
-rw-r--r--mcs/class/I18N/Rare/ibm-1026.ucm372
-rw-r--r--mcs/class/I18N/Rare/ibm-1047.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1089.ucm477
-rw-r--r--mcs/class/I18N/Rare/ibm-1140.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1141.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1142.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1143.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1144.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1145.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1146.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1147.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1148.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-1149.ucm378
-rw-r--r--mcs/class/I18N/Rare/ibm-273.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-277.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-278.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-280.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-284.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-285.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-290.ucm349
-rw-r--r--mcs/class/I18N/Rare/ibm-297.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-37.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-420.ucm453
-rw-r--r--mcs/class/I18N/Rare/ibm-424.ucm339
-rw-r--r--mcs/class/I18N/Rare/ibm-500.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-852.ucm415
-rw-r--r--mcs/class/I18N/Rare/ibm-855.ucm415
-rw-r--r--mcs/class/I18N/Rare/ibm-857.ucm412
-rw-r--r--mcs/class/I18N/Rare/ibm-858.ucm415
-rw-r--r--mcs/class/I18N/Rare/ibm-862.ucm416
-rw-r--r--mcs/class/I18N/Rare/ibm-864.ucm498
-rw-r--r--mcs/class/I18N/Rare/ibm-866.ucm416
-rw-r--r--mcs/class/I18N/Rare/ibm-869.ucm408
-rw-r--r--mcs/class/I18N/Rare/ibm-870.ucm372
-rw-r--r--mcs/class/I18N/Rare/ibm-871.ucm379
-rw-r--r--mcs/class/I18N/Rare/ibm-875.ucm367
-rwxr-xr-xmcs/class/I18N/Rare/list.unix37
-rwxr-xr-xmcs/class/I18N/Rare/makefile.gnu13
-rw-r--r--mcs/class/I18N/West/.cvsignore4
-rw-r--r--mcs/class/I18N/West/CP10000.cs405
-rw-r--r--mcs/class/I18N/West/CP10079.cs381
-rw-r--r--mcs/class/I18N/West/CP1250.cs399
-rw-r--r--mcs/class/I18N/West/CP1252.cs399
-rw-r--r--mcs/class/I18N/West/CP1253.cs405
-rw-r--r--mcs/class/I18N/West/CP28592.cs471
-rw-r--r--mcs/class/I18N/West/CP28593.cs319
-rw-r--r--mcs/class/I18N/West/CP28597.cs339
-rw-r--r--mcs/class/I18N/West/CP28605.cs327
-rw-r--r--mcs/class/I18N/West/CP437.cs681
-rw-r--r--mcs/class/I18N/West/CP850.cs681
-rw-r--r--mcs/class/I18N/West/CP860.cs681
-rw-r--r--mcs/class/I18N/West/CP861.cs681
-rw-r--r--mcs/class/I18N/West/CP863.cs679
-rw-r--r--mcs/class/I18N/West/CP865.cs681
-rw-r--r--mcs/class/I18N/West/ibm-1275.ucm380
-rw-r--r--mcs/class/I18N/West/ibm-437.ucm416
-rw-r--r--mcs/class/I18N/West/ibm-4909.ucm374
-rw-r--r--mcs/class/I18N/West/ibm-5346.ucm377
-rw-r--r--mcs/class/I18N/West/ibm-5348.ucm377
-rw-r--r--mcs/class/I18N/West/ibm-5349.ucm376
-rw-r--r--mcs/class/I18N/West/ibm-850.ucm416
-rw-r--r--mcs/class/I18N/West/ibm-860.ucm416
-rw-r--r--mcs/class/I18N/West/ibm-861.ucm416
-rw-r--r--mcs/class/I18N/West/ibm-863.ucm415
-rw-r--r--mcs/class/I18N/West/ibm-865.ucm416
-rw-r--r--mcs/class/I18N/West/ibm-912.ucm446
-rw-r--r--mcs/class/I18N/West/ibm-913.ucm370
-rw-r--r--mcs/class/I18N/West/ibm-923.ucm377
-rwxr-xr-xmcs/class/I18N/West/list.unix15
-rw-r--r--mcs/class/I18N/West/mac-is.ucm290
-rwxr-xr-xmcs/class/I18N/West/makefile.gnu13
-rwxr-xr-xmcs/class/I18N/makefile.gnu14
-rwxr-xr-xmcs/class/I18N/mklist.sh40
-rw-r--r--mcs/class/I18N/tools/.cvsignore2
-rwxr-xr-xmcs/class/I18N/tools/cvt.sh547
-rw-r--r--mcs/class/I18N/tools/ucm2cp.c599
-rw-r--r--mcs/class/I18N/tools/uni2tab.c411
-rw-r--r--mcs/class/Microsoft.VisualBasic/.cvsignore4
-rw-r--r--mcs/class/Microsoft.VisualBasic/Changelog21
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.build40
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/AppWinStyle.cs18
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CallType.cs16
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog6
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Collection.cs314
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ComClassAttribute.cs35
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CompareMethod.cs26
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs136
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ControlChars.cs27
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Conversion.cs616
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateAndTime.cs478
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateFormat.cs37
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateInterval.cs22
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DueDate.cs14
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ErrObject.cs121
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileAttribute.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs422
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Financial.cs48
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstDayOfWeek.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstWeekOfYear.cs16
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Globals.cs30
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs61
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs39
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/BooleanType.cs32
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ByteType.cs33
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharArrayType.cs27
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharType.cs27
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DateType.cs36
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DecimalType.cs34
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DoubleType.cs33
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ExceptionUtils.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/FlowControl.cs41
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/HostServices.cs24
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IVbHost.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IncompleteInitialization.cs19
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IntegerType.cs33
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs51
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LongType.cs26
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs60
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionCompareAttribute.cs32
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionTextAttribute.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ProjectData.cs98
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ShortType.cs26
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/SingleType.cs30
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StandardModuleAttribute.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StaticLocalInitFlag.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StringType.cs94
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/TODOAttribute.cs39
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs31
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxResult.cs19
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxStyle.cs32
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenAccess.cs16
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenMode.cs17
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenShare.cs17
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/SpcInfo.cs20
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs1124
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TODOAttribute.cs39
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TabInfo.cs23
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TriState.cs19
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedArrayAttribute.cs30
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedStringAttribute.cs26
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBMath.cs53
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VariantType.cs32
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VbStrConv.cs73
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/.cvsignore1
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/AllTests.cs33
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/ChangeLog8
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs535
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs674
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs388
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic_test.build63
-rw-r--r--mcs/class/Microsoft.VisualBasic/list62
-rw-r--r--mcs/class/Microsoft.VisualBasic/makefile.gnu13
-rw-r--r--mcs/class/Mono.CSharp.Debugger/.cvsignore4
-rw-r--r--mcs/class/Mono.CSharp.Debugger/ChangeLog377
-rw-r--r--mcs/class/Mono.CSharp.Debugger/IMonoBinaryReader.cs26
-rw-r--r--mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs47
-rw-r--r--mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build24
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs60
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs419
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs213
-rwxr-xr-xmcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs643
-rw-r--r--mcs/class/Mono.CSharp.Debugger/list.unix6
-rw-r--r--mcs/class/Mono.CSharp.Debugger/makefile.gnu13
-rw-r--r--mcs/class/Mono.Data.DB2Client/ChangeLog27
-rwxr-xr-xmcs/class/Mono.Data.DB2Client/Mono.Data.DB2Client.build44
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/AssemblyInfo.cs58
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientCommand.cs279
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConnection.cs229
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConstants.cs75
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientDataReader.cs458
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientException.cs57
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientPrototypes.cs53
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientTransaction.cs100
-rw-r--r--mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientUtils.cs48
-rw-r--r--mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/App.icobin0 -> 1078 bytes
-rw-r--r--mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/AssemblyInfo.cs58
-rwxr-xr-xmcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/ChangeLog6
-rw-r--r--mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/TestDB2Conn.cs93
-rw-r--r--mcs/class/Mono.Data.DB2Client/licence.txt18
-rw-r--r--mcs/class/Mono.Data.DB2Client/list9
-rw-r--r--mcs/class/Mono.Data.DB2Client/makefile.gnu12
-rw-r--r--mcs/class/Mono.Data.MySql/.cvsignore4
-rw-r--r--mcs/class/Mono.Data.MySql/ChangeLog269
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql.build53
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/.cvsignore1
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/Field.cs117
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySql.cs242
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlCommand.cs554
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlConnection.cs537
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataAdapter.cs174
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataReader.cs539
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlError.cs74
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlErrorCollection.cs87
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlException.cs64
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameter.cs225
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameterCollection.cs293
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventArgs.cs38
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventHandler.cs12
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventArgs.cs36
-rwxr-xr-xmcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventHandler.cs15
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTransaction.cs192
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTypes.cs533
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.MySql/Mono.Data.MySql/Test.cs238
-rw-r--r--mcs/class/Mono.Data.MySql/Test/.cvsignore1
-rw-r--r--mcs/class/Mono.Data.MySql/Test/MySqlTest.cs517
-rwxr-xr-xmcs/class/Mono.Data.MySql/Test/TestDataAdapter.cs53
-rw-r--r--mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteReader.cs75
-rw-r--r--mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteScalar.cs68
-rw-r--r--mcs/class/Mono.Data.MySql/Test/TestMySqlInsert.cs125
-rwxr-xr-xmcs/class/Mono.Data.MySql/Test/TestParameters.cs122
-rw-r--r--mcs/class/Mono.Data.MySql/list19
-rw-r--r--mcs/class/Mono.Data.MySql/makefile.gnu14
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/.cvsignore3
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/ChangeLog89
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient.build46
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/Locale.cs22
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/ParmUtil.cs176
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs78
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs46
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs922
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs103
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs711
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs191
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs447
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs155
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs114
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs204
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs51
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs19
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs237
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs267
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs37
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs18
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs43
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs18
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs191
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs475
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresTypes.cs511
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/list24
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/makefile.gnu12
-rw-r--r--mcs/class/Mono.Data.SqliteClient/.cvsignore4
-rw-r--r--mcs/class/Mono.Data.SqliteClient/ChangeLog44
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient.build47
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/.cvsignore1
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs280
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteConnection.cs197
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs364
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameter.cs147
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameterCollection.cs223
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Test/.cvsignore1
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Test/SqliteTest.cs90
-rw-r--r--mcs/class/Mono.Data.SqliteClient/makefile.gnu13
-rw-r--r--mcs/class/Mono.Data.SqliteClient/sources.list5
-rw-r--r--mcs/class/Mono.Data.SybaseClient/.cvsignore3
-rw-r--r--mcs/class/Mono.Data.SybaseClient/ChangeLog142
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.build44
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/Locale.cs22
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs379
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs94
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs518
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionPool.cs167
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs166
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs748
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs139
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs88
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs105
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs58
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs15
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs557
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs211
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs79
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs34
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs38
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs15
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs38
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs15
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs106
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs41
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs230
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs384
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs393
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs30
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs254
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs653
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs349
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs222
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs397
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs417
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs400
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs390
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs32
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs335
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs457
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs32
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs32
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.SybaseClient/list41
-rw-r--r--mcs/class/Mono.Data.SybaseClient/makefile.gnu16
-rw-r--r--mcs/class/Mono.Data.Tds/.cvsignore3
-rw-r--r--mcs/class/Mono.Data.Tds/ChangeLog140
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog250
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ITds.cs86
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs1191
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds42.cs270
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds50.cs505
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs408
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds80.cs50
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsBigDecimal.cs54
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnStatus.cs17
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnType.cs46
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs476
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsConnectionParameters.cs24
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumn.cs38
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumnCollection.cs61
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataRow.cs125
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsEnvPacketSubType.cs16
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalError.cs89
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorCollection.cs64
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventArgs.cs24
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventHandler.cs14
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalException.cs97
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventArgs.cs85
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventHandler.cs14
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketSubType.cs40
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketType.cs23
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsServerType.cs17
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsTimeoutException.cs20
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsVersion.cs18
-rwxr-xr-xmcs/class/Mono.Data.Tds/Mono.Data.Tds.build39
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameter.cs221
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameterCollection.cs113
-rw-r--r--mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsParameterDirection.cs21
-rw-r--r--mcs/class/Mono.Data.Tds/list30
-rw-r--r--mcs/class/Mono.Data.Tds/makefile.gnu14
-rw-r--r--mcs/class/Mono.Data.TdsClient/.cvsignore4
-rw-r--r--mcs/class/Mono.Data.TdsClient/ChangeLog249
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient.build45
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/ChangeLog126
-rwxr-xr-xmcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/Locale.cs22
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsCommand.cs362
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnection.cs518
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnectionPool.cs167
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataAdapter.cs172
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataReader.cs748
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsError.cs91
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsErrorCollection.cs83
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsException.cs105
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs61
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventHandler.cs15
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameter.cs557
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameterCollection.cs211
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventArgs.cs36
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventHandler.cs12
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventArgs.cs36
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventHandler.cs15
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsTransaction.cs106
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsType.cs41
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/ChangeLog21
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TODOAttribute.cs33
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBinary.cs230
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBoolean.cs384
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsByte.cs393
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsCompareOptions.cs30
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDateTime.cs254
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDecimal.cs653
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDouble.cs349
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsGuid.cs222
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt16.cs397
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt32.cs417
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt64.cs400
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsMoney.cs390
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsNullValueException.cs32
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsSingle.cs335
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsString.cs457
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTruncateException.cs32
-rw-r--r--mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTypeException.cs32
-rw-r--r--mcs/class/Mono.Data.TdsClient/list38
-rw-r--r--mcs/class/Mono.Data.TdsClient/makefile.gnu15
-rwxr-xr-xmcs/class/Mono.Data/DataTools.cs85
-rw-r--r--mcs/class/Mono.Data/Mono.Data.build35
-rwxr-xr-xmcs/class/Mono.Data/Provider.cs115
-rwxr-xr-xmcs/class/Mono.Data/ProviderCollection.cs271
-rwxr-xr-xmcs/class/Mono.Data/ProviderFactory.cs112
-rwxr-xr-xmcs/class/Mono.Data/ProviderSectionHandler.cs49
-rwxr-xr-xmcs/class/Mono.Data/app.config70
-rw-r--r--mcs/class/Mono.Data/library-deps.stamp0
-rw-r--r--mcs/class/Mono.Data/list5
-rwxr-xr-xmcs/class/Mono.Data/makefile.gnu14
-rwxr-xr-xmcs/class/Mono.Data/test/Mono.Data.dllbin0 -> 10752 bytes
-rw-r--r--mcs/class/Mono.Data/test/test.build36
-rwxr-xr-xmcs/class/Mono.Data/test/test.cs43
-rwxr-xr-xmcs/class/Mono.Data/test/test.exebin0 -> 5120 bytes
-rwxr-xr-xmcs/class/Mono.Data/test/test.exe.config70
-rw-r--r--mcs/class/Mono.Directory.LDAP/ChangeLog7
-rw-r--r--mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP.build32
-rw-r--r--mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAP.cs141
-rw-r--r--mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAPMessage.cs134
-rw-r--r--mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/AllTests.cs30
-rw-r--r--mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/BindSimpleTest.cs43
-rw-r--r--mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/QueryRootDSE.cs70
-rw-r--r--mcs/class/Mono.Directory.LDAP/Test/NUnit.Prefs0
-rw-r--r--mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args10
-rw-r--r--mcs/class/Mono.Directory.LDAP/Test/makefile.gnu23
-rw-r--r--mcs/class/Mono.Directory.LDAP/list2
-rw-r--r--mcs/class/Mono.Directory.LDAP/makefile.gnu14
-rw-r--r--mcs/class/Mono.GetOptions/.cvsignore4
-rw-r--r--mcs/class/Mono.GetOptions/AboutAttribute.cs29
-rw-r--r--mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs12
-rw-r--r--mcs/class/Mono.GetOptions/AssemblyInfo.cs59
-rw-r--r--mcs/class/Mono.GetOptions/AuthorAttribute.cs38
-rw-r--r--mcs/class/Mono.GetOptions/ChangeLog15
-rw-r--r--mcs/class/Mono.GetOptions/GetOptTest/AssemblyInfo.cs36
-rw-r--r--mcs/class/Mono.GetOptions/GetOptTest/GetOptTester.cs85
-rwxr-xr-xmcs/class/Mono.GetOptions/Mono.GetOptions.build39
-rw-r--r--mcs/class/Mono.GetOptions/Mono.GetOptions.csproj131
-rw-r--r--mcs/class/Mono.GetOptions/OptionAttribute.cs66
-rw-r--r--mcs/class/Mono.GetOptions/OptionDetails.cs200
-rw-r--r--mcs/class/Mono.GetOptions/OptionList.cs407
-rw-r--r--mcs/class/Mono.GetOptions/Options.cs47
-rw-r--r--mcs/class/Mono.GetOptions/UsageComplementAttribute.cs29
-rw-r--r--mcs/class/Mono.GetOptions/list.unix9
-rw-r--r--mcs/class/Mono.GetOptions/makefile.gnu13
-rw-r--r--mcs/class/Mono.PEToolkit/.cvsignore4
-rw-r--r--mcs/class/Mono.PEToolkit/BadImageException.cs20
-rw-r--r--mcs/class/Mono.PEToolkit/COFFHeader.cs159
-rw-r--r--mcs/class/Mono.PEToolkit/Characteristics.cs165
-rw-r--r--mcs/class/Mono.PEToolkit/CheckSum.cs96
-rw-r--r--mcs/class/Mono.PEToolkit/CorHeader.cs335
-rw-r--r--mcs/class/Mono.PEToolkit/DOSHeader.cs114
-rw-r--r--mcs/class/Mono.PEToolkit/DataDir.cs90
-rw-r--r--mcs/class/Mono.PEToolkit/ExeSignature.cs58
-rw-r--r--mcs/class/Mono.PEToolkit/Image.cs239
-rw-r--r--mcs/class/Mono.PEToolkit/LEBitConverter.cs251
-rw-r--r--mcs/class/Mono.PEToolkit/MachineId.cs257
-rw-r--r--mcs/class/Mono.PEToolkit/PEHeader.cs558
-rwxr-xr-xmcs/class/Mono.PEToolkit/PEToolkit.build24
-rw-r--r--mcs/class/Mono.PEToolkit/PEUtils.cs161
-rw-r--r--mcs/class/Mono.PEToolkit/README1
-rw-r--r--mcs/class/Mono.PEToolkit/RVA.cs117
-rw-r--r--mcs/class/Mono.PEToolkit/Section.cs175
-rw-r--r--mcs/class/Mono.PEToolkit/SectionCharacteristics.cs192
-rw-r--r--mcs/class/Mono.PEToolkit/Subsystem.cs111
-rw-r--r--mcs/class/Mono.PEToolkit/build/mddump.cs60
-rw-r--r--mcs/class/Mono.PEToolkit/build/pet.build33
-rwxr-xr-xmcs/class/Mono.PEToolkit/build/srcgen/a.bat14
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/bitconv-types.xml10
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/bitconverter.xsl149
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/coded-id.xsl34
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/data/ilasm.xml549
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/data/md-schema.xml589
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/elem-type.xsl36
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/gen-utils.xsl72
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/rows.xsl225
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/table-id.xsl41
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/tabs-base.xsl69
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/tabs-decoder.xsl255
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/tabs.xsl53
-rw-r--r--mcs/class/Mono.PEToolkit/build/srcgen/xslt.wsf231
-rw-r--r--mcs/class/Mono.PEToolkit/list.unix42
-rw-r--r--mcs/class/Mono.PEToolkit/makefile.gnu13
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/AssemblyFlags.cs56
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/BadMetaDataException.cs20
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/CodedTokenId.cs31
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/ElementType.cs53
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/GUIDHeap.cs40
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MDHeap.cs60
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MDStream.cs190
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MDTable.cs105
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MDToken.cs158
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MDUtils.cs89
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/ManifestResourceAttributes.cs29
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MetaDataRoot.cs200
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MethodIL.cs149
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/MethodSemanticsAttributes.cs26
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/PInvokeAttributes.cs54
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/Row.cs74
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/Rows.cs4887
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/StringsHeap.cs105
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/TableId.cs66
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/Tables.cs1375
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/TablesHeap.cs217
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/TablesHeapBase.cs787
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/TabsDecoder.cs1933
-rw-r--r--mcs/class/Mono.PEToolkit/metadata/TokenType.cs46
-rw-r--r--mcs/class/README277
-rw-r--r--mcs/class/System.Configuration.Install/.cvsignore4
-rw-r--r--mcs/class/System.Configuration.Install/ChangeLog19
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install.build34
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog19
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs28
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/IManagedInstaller.cs19
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs55
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventArgs.cs34
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventHandler.cs15
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/InstallException.cs37
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs154
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/InstallerCollection.cs81
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/TODOAttribute.cs39
-rw-r--r--mcs/class/System.Configuration.Install/System.Configuration.Install/UninstallAction.cs20
-rw-r--r--mcs/class/System.Configuration.Install/Test/.cvsignore2
-rw-r--r--mcs/class/System.Configuration.Install/Test/AllTests.cs29
-rw-r--r--mcs/class/System.Configuration.Install/Test/ChangeLog12
-rw-r--r--mcs/class/System.Configuration.Install/Test/System.Configuration.Install/AllTests.cs27
-rw-r--r--mcs/class/System.Configuration.Install/Test/System.Configuration.Install/ChangeLog5
-rw-r--r--mcs/class/System.Configuration.Install/Test/System.Configuration.Install_test.build36
-rw-r--r--mcs/class/System.Configuration.Install/Test/makefile.gnu29
-rw-r--r--mcs/class/System.Configuration.Install/Test/system_configuration_install_linux_test.args2
-rw-r--r--mcs/class/System.Configuration.Install/list.unix9
-rw-r--r--mcs/class/System.Configuration.Install/makefile.gnu14
-rwxr-xr-xmcs/class/System.Data.OracleClient/ChangeLog53
-rwxr-xr-xmcs/class/System.Data.OracleClient/README.TXT87
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient.build44
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj98
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user48
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln27
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suobin0 -> 12800 bytes
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs203
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make22
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make66
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs77
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs198
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c389
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h55
-rwxr-xr-xmcs/class/System.Data.OracleClient/Test/Test.csproj93
-rwxr-xr-xmcs/class/System.Data.OracleClient/Test/Test.csproj.user48
-rwxr-xr-xmcs/class/System.Data.OracleClient/Test/TestOracleClient.cs146
-rwxr-xr-xmcs/class/System.Data.OracleClient/list3
-rwxr-xr-xmcs/class/System.Data.OracleClient/makefile.gnu14
-rw-r--r--mcs/class/System.Data/.cvsignore6
-rw-r--r--mcs/class/System.Data/ChangeLog2578
-rwxr-xr-xmcs/class/System.Data/System.Data.Common/ChangeLog18
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataAdapter.cs127
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs85
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs220
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataTableMapping.cs110
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs222
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs468
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataPermission.cs112
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs47
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataRecord.cs270
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbEnumerator.cs110
-rw-r--r--mcs/class/System.Data/System.Data.Common/FieldNameLookup.cs116
-rw-r--r--mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs86
-rw-r--r--mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs71
-rw-r--r--mcs/class/System.Data/System.Data.Common/SchemaInfo.cs94
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/ChangeLog19
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs111
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs324
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs245
-rwxr-xr-xmcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs187
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs534
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcError.cs118
-rwxr-xr-xmcs/class/System.Data/System.Data.Odbc/OdbcErrorCollection.cs87
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcException.cs66
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs209
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcParameterCollection.cs205
-rwxr-xr-xmcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs37
-rwxr-xr-xmcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs15
-rwxr-xr-xmcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs38
-rwxr-xr-xmcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs15
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs83
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/OdbcType.cs58
-rw-r--r--mcs/class/System.Data/System.Data.Odbc/libodbc.cs192
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/ChangeLog5
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs335
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbCommandBuilder.cs118
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs272
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs208
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs682
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbError.cs74
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbErrorCollection.cs80
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbException.cs123
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventArgs.cs53
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventHandler.cs17
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbLiteral.cs48
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbParameter.cs364
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbParameterCollection.cs208
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs95
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbPermissionAttribute.cs62
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventArgs.cs46
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventHandler.cs19
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventArgs.cs48
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventHandler.cs19
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbSchemaGuid.cs67
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs149
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbType.cs56
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/TestGDA.cs32
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs109
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/libgda.cs311
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs57
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs43
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs420
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs493
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs566
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs167
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs187
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs767
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlError.cs99
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs87
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlException.cs110
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs61
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs16
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs598
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs217
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs43
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs37
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs15
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs38
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs15
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs106
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs159
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/INullable.cs22
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs307
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs427
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlByte.cs425
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs29
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlDateTime.cs282
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlDecimal.cs1326
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs362
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlGuid.cs250
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlInt16.cs433
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs451
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs430
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs412
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlNullValueException.cs27
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs362
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs548
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlTruncateException.cs27
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlTypeException.cs27
-rw-r--r--mcs/class/System.Data/System.Data.build44
-rw-r--r--mcs/class/System.Data/System.Data/AcceptRejectRule.cs25
-rw-r--r--mcs/class/System.Data/System.Data/ChangeLog193
-rw-r--r--mcs/class/System.Data/System.Data/CommandBehavior.cs30
-rw-r--r--mcs/class/System.Data/System.Data/CommandType.cs25
-rw-r--r--mcs/class/System.Data/System.Data/ConnectionState.cs30
-rw-r--r--mcs/class/System.Data/System.Data/Constraint.cs133
-rw-r--r--mcs/class/System.Data/System.Data/ConstraintCollection.cs342
-rw-r--r--mcs/class/System.Data/System.Data/ConstraintException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/DBConcurrencyException.cs39
-rw-r--r--mcs/class/System.Data/System.Data/DataCategoryAttribute.cs42
-rw-r--r--mcs/class/System.Data/System.Data/DataColumn.cs533
-rw-r--r--mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs80
-rw-r--r--mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/DataColumnCollection.cs452
-rwxr-xr-xmcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs149
-rw-r--r--mcs/class/System.Data/System.Data/DataException.cs37
-rw-r--r--mcs/class/System.Data/System.Data/DataRelation.cs188
-rw-r--r--mcs/class/System.Data/System.Data/DataRelationCollection.cs343
-rw-r--r--mcs/class/System.Data/System.Data/DataRow.cs750
-rw-r--r--mcs/class/System.Data/System.Data/DataRowAction.cs28
-rw-r--r--mcs/class/System.Data/System.Data/DataRowBuilder.cs52
-rw-r--r--mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs41
-rw-r--r--mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/DataRowCollection.cs171
-rw-r--r--mcs/class/System.Data/System.Data/DataRowState.cs26
-rw-r--r--mcs/class/System.Data/System.Data/DataRowVersion.cs23
-rw-r--r--mcs/class/System.Data/System.Data/DataRowView.cs265
-rw-r--r--mcs/class/System.Data/System.Data/DataSet.cs930
-rw-r--r--mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs41
-rw-r--r--mcs/class/System.Data/System.Data/DataTable.cs902
-rw-r--r--mcs/class/System.Data/System.Data/DataTableCollection.cs184
-rw-r--r--mcs/class/System.Data/System.Data/DataTablePropertyDescriptor.cs80
-rw-r--r--mcs/class/System.Data/System.Data/DataTableRelationCollection.cs122
-rw-r--r--mcs/class/System.Data/System.Data/DataView.cs578
-rw-r--r--mcs/class/System.Data/System.Data/DataViewManager.cs286
-rw-r--r--mcs/class/System.Data/System.Data/DataViewManagerListItemTypeDescriptor.cs110
-rw-r--r--mcs/class/System.Data/System.Data/DataViewRowState.cs29
-rw-r--r--mcs/class/System.Data/System.Data/DataViewSetting.cs75
-rwxr-xr-xmcs/class/System.Data/System.Data/DataViewSettingCollection.cs106
-rw-r--r--mcs/class/System.Data/System.Data/DbType.cs44
-rw-r--r--mcs/class/System.Data/System.Data/DeletedRowInaccessibleException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/DuplicateNameException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/EvaluateException.cs31
-rwxr-xr-xmcs/class/System.Data/System.Data/FillErrorEventArgs.cs58
-rw-r--r--mcs/class/System.Data/System.Data/FillErrorEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs377
-rw-r--r--mcs/class/System.Data/System.Data/IColumnMapping.cs35
-rw-r--r--mcs/class/System.Data/System.Data/IColumnMappingCollection.cs35
-rw-r--r--mcs/class/System.Data/System.Data/IDataAdapter.cs33
-rw-r--r--mcs/class/System.Data/System.Data/IDataParameter.cs36
-rw-r--r--mcs/class/System.Data/System.Data/IDataParameterCollection.cs28
-rw-r--r--mcs/class/System.Data/System.Data/IDataReader.cs33
-rw-r--r--mcs/class/System.Data/System.Data/IDataRecord.cs71
-rw-r--r--mcs/class/System.Data/System.Data/IDbCommand.cs47
-rw-r--r--mcs/class/System.Data/System.Data/IDbConnection.cs41
-rw-r--r--mcs/class/System.Data/System.Data/IDbDataAdapter.cs25
-rw-r--r--mcs/class/System.Data/System.Data/IDbDataParameter.cs25
-rw-r--r--mcs/class/System.Data/System.Data/IDbTransaction.cs27
-rw-r--r--mcs/class/System.Data/System.Data/ITableMapping.cs23
-rw-r--r--mcs/class/System.Data/System.Data/ITableMappingCollection.cs31
-rw-r--r--mcs/class/System.Data/System.Data/InRowChangingEventException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs122
-rw-r--r--mcs/class/System.Data/System.Data/InvalidConstraintException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/InvalidExpressionException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/IsolationLevel.cs27
-rwxr-xr-xmcs/class/System.Data/System.Data/Locale.cs22
-rw-r--r--mcs/class/System.Data/System.Data/MappingType.cs26
-rw-r--r--mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs46
-rw-r--r--mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/MissingMappingAction.cs24
-rw-r--r--mcs/class/System.Data/System.Data/MissingPrimaryKeyException.cs33
-rw-r--r--mcs/class/System.Data/System.Data/MissingSchemaAction.cs25
-rw-r--r--mcs/class/System.Data/System.Data/NoNullAllowedException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/ParameterDirection.cs25
-rw-r--r--mcs/class/System.Data/System.Data/PropertyAttributes.cs28
-rw-r--r--mcs/class/System.Data/System.Data/PropertyCollection.cs31
-rw-r--r--mcs/class/System.Data/System.Data/ReadOnlyException.cs33
-rw-r--r--mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs41
-rw-r--r--mcs/class/System.Data/System.Data/RowNotInTableException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/Rule.cs25
-rw-r--r--mcs/class/System.Data/System.Data/SchemaType.cs23
-rw-r--r--mcs/class/System.Data/System.Data/SqlDbType.cs45
-rw-r--r--mcs/class/System.Data/System.Data/StateChangeEventArgs.cs47
-rw-r--r--mcs/class/System.Data/System.Data/StateChangeEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/StatementType.cs25
-rw-r--r--mcs/class/System.Data/System.Data/StrongTypingException.cs31
-rw-r--r--mcs/class/System.Data/System.Data/SyntaxErrorException.cs32
-rw-r--r--mcs/class/System.Data/System.Data/TODOAttribute.cs33
-rw-r--r--mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs34
-rw-r--r--mcs/class/System.Data/System.Data/UniqueConstraint.cs427
-rw-r--r--mcs/class/System.Data/System.Data/UpdateRowSource.cs25
-rw-r--r--mcs/class/System.Data/System.Data/UpdateStatus.cs25
-rw-r--r--mcs/class/System.Data/System.Data/VersionNotFoundException.cs32
-rwxr-xr-xmcs/class/System.Data/System.Data/XmlConstants.cs63
-rw-r--r--mcs/class/System.Data/System.Data/XmlDataLoader.cs187
-rw-r--r--mcs/class/System.Data/System.Data/XmlDiffLoader.cs246
-rw-r--r--mcs/class/System.Data/System.Data/XmlReadMode.cs27
-rw-r--r--mcs/class/System.Data/System.Data/XmlSchemaMapper.cs390
-rw-r--r--mcs/class/System.Data/System.Data/XmlWriteMode.cs24
-rw-r--r--mcs/class/System.Data/System.Xml/XmlDataDocument.cs726
-rw-r--r--mcs/class/System.Data/TODO134
-rw-r--r--mcs/class/System.Data/Test/.cvsignore2
-rw-r--r--mcs/class/System.Data/Test/AllTests.cs22
-rw-r--r--mcs/class/System.Data/Test/ChangeLog340
-rw-r--r--mcs/class/System.Data/Test/OdbcTest.cs60
-rw-r--r--mcs/class/System.Data/Test/PostgresTest.cs526
-rw-r--r--mcs/class/System.Data/Test/SqlTest.cs716
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/AllTests.cs39
-rwxr-xr-xmcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog3
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBinaryTest.cs275
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBooleanTest.cs913
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlByteTest.cs908
-rwxr-xr-xmcs/class/System.Data/Test/System.Data.SqlTypes/SqlDateTimeTest.cs521
-rwxr-xr-xmcs/class/System.Data/Test/System.Data.SqlTypes/SqlDecimalTest.cs592
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDoubleTest.cs534
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlGuidTest.cs316
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt16Test.cs645
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt32Test.cs413
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt64Test.cs609
-rwxr-xr-xmcs/class/System.Data/Test/System.Data.SqlTypes/SqlMoneyTest.cs517
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlSingleTest.cs540
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs640
-rw-r--r--mcs/class/System.Data/Test/System.Data/AllTests.cs39
-rw-r--r--mcs/class/System.Data/Test/System.Data/ChangeLog32
-rw-r--r--mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest.cs328
-rw-r--r--mcs/class/System.Data/Test/System.Data/ConstraintTest.cs138
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs46
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataColumnTest.cs210
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataRelationTest.cs378
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataRowCollectionTest.cs56
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataRowTest.cs42
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataSetTest.cs832
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataTableTest.cs71
-rw-r--r--mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs228
-rw-r--r--mcs/class/System.Data/Test/System.Data/UniqueConstraintTest.cs188
-rwxr-xr-xmcs/class/System.Data/Test/System.Data/own_schema.xsd44
-rw-r--r--mcs/class/System.Data/Test/System.Data/region.xml13
-rwxr-xr-xmcs/class/System.Data/Test/System.Data/store.xsd27
-rw-r--r--mcs/class/System.Data/Test/System.Data_test.build77
-rwxr-xr-xmcs/class/System.Data/Test/System.Xml/2books.xml11
-rw-r--r--mcs/class/System.Data/Test/System.Xml/AllTests.cs23
-rw-r--r--mcs/class/System.Data/Test/System.Xml/ChangeLog3
-rwxr-xr-xmcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest.cs807
-rwxr-xr-xmcs/class/System.Data/Test/System.Xml/region.xml31
-rwxr-xr-xmcs/class/System.Data/Test/System.Xml/region.xsd21
-rwxr-xr-xmcs/class/System.Data/Test/System.Xml/store.xsd27
-rw-r--r--mcs/class/System.Data/Test/TestExecuteScalar.cs149
-rw-r--r--mcs/class/System.Data/Test/TestSqlDataAdapter.cs66
-rw-r--r--mcs/class/System.Data/Test/TestSqlDataReader.cs181
-rw-r--r--mcs/class/System.Data/Test/TestSqlParameters.cs127
-rw-r--r--mcs/class/System.Data/Test/TheTests.cs78
-rw-r--r--mcs/class/System.Data/Test/data_linux_test.args35
-rw-r--r--mcs/class/System.Data/Test/makefile.gnu29
-rwxr-xr-xmcs/class/System.Data/list192
-rw-r--r--mcs/class/System.Data/makefile.gnu17
-rwxr-xr-xmcs/class/System.Design/.cvsignore4
-rwxr-xr-xmcs/class/System.Design/ChangeLog26
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/Changelog20
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/CodeDomSerializer.cs86
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/ContextStack.cs45
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/ICodeDomDesignerReload.cs18
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderHost.cs20
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderService.cs22
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationManager.cs42
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationProvider.cs17
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationService.cs20
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/INameCreationService.cs22
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventArgs.cs37
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventHandler.cs15
-rw-r--r--mcs/class/System.Design/System.ComponentModel.Design.Serialization/RootDesignerSerializerAttribute.cs75
-rwxr-xr-xmcs/class/System.Design/System.Design.build37
-rw-r--r--mcs/class/System.Design/System.Design/ChangeLog3
-rw-r--r--mcs/class/System.Design/System.Design/TODOAttribute.cs33
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/AdRotatorDesigner.cs54
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListComponentEditor.cs57
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListDesigner.cs231
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListPageInternal.cs79
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/BaseValidatorDesigner.cs49
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/BordersPageInternal.cs90
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/ButtonDesigner.cs39
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarAutoFormatDialog.cs43
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarDesigner.cs57
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/ChangeLog132
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/CheckBoxDesigner.cs39
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/DataListComponentEditor.cs50
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/FormatPageInternal.cs46
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/GeneralPageDataListInternal.cs46
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/HyperLinkDesigner.cs55
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/LabelDesigner.cs24
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/LinkButtonDesigner.cs24
-rw-r--r--mcs/class/System.Design/System.Web.UI.Design.WebControls/ListControlDataBindingHandler.cs39
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/PanelDesigner.cs69
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/RegexEditorDialog.cs131
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/RegexTypeEditor.cs59
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/RepeaterDesigner.cs140
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/TODO44
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/TODOAttribute.cs33
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/TableCellsCollectionEditor.cs38
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/TableDesigner.cs41
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/TableRowsCollectionEditor.cs37
-rwxr-xr-xmcs/class/System.Design/System.Web.UI.Design.WebControls/XmlDesigner.cs53
-rw-r--r--mcs/class/System.Design/System.Web.UI.Design/ChangeLog4
-rw-r--r--mcs/class/System.Design/System.Web.UI.Design/DataBindingHandler.cs26
-rw-r--r--mcs/class/System.Drawing/.cvsignore3
-rw-r--r--mcs/class/System.Drawing/ChangeLog11
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs57
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ChangeLog26
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/IDesignerHost.cs47
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs31
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs64
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs56
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs69
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs28
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs14
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs28
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs13
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs187
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/AdjustableArrowCap.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/Blend.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog59
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/ColorBlend.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs24
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CustomLineCap.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs24
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs36
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs75
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs27
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs29
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs454
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs26
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs23
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/RegionData.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs24
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs37
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs23
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs79
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog66
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs37
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs14
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs305
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs14
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs44
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs262
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs36
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs60
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs34
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs109
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs26
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs95
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs66
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs112
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs109
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs39
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs42
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs84
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterExecption.cs30
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs93
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/MarginsConverter.cs50
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs122
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs125
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs65
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs33
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceCollection.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs26
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperUnitConvert.cs43
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs34
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PreviewPrintController.cs54
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintController.cs42
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintDocument.cs105
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintEventArgs.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventArgs.cs75
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs40
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs46
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs44
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs42
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs34
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/StandardPrintController.cs37
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/changelog53
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs32
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs36
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/changelog18
-rw-r--r--mcs/class/System.Drawing/System.Drawing.build25
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Bitmap.cs276
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Brush.cs39
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Brushes.cs865
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ChangeLog164
-rw-r--r--mcs/class/System.Drawing/System.Drawing/CharacterRange.cs40
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Color.cs1453
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ColorConverter.cs111
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs135
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing/FontConverter.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing/FontFamily.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing/FontStyle.cs20
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Graphics.cs23
-rw-r--r--mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Icon.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/IconConverter.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Image.cs198
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ImageAnimator.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ImageConverter.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ImageFormatConverter.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/KnownColor.cs182
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Pen.cs112
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Point.cs339
-rw-r--r--mcs/class/System.Drawing/System.Drawing/PointConverter.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/PointF.cs204
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Rectangle.cs584
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RectangleF.cs531
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Region.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs29
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Size.cs309
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SizeConverter.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SizeF.cs249
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SolidBrush.cs36
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringAligment.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringFormat.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs24
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringTrimming.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringUnit.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SystemColors.cs200
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SystemIcons.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SystemPens.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/TextureBrush.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs25
-rw-r--r--mcs/class/System.Drawing/System.Drawing/pens.cs865
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/ChangeLog4
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs159
-rwxr-xr-xmcs/class/System.Drawing/list.unix160
-rw-r--r--mcs/class/System.Drawing/makefile.gnu13
-rw-r--r--mcs/class/System.EnterpriseServices/.cvsignore4
-rw-r--r--mcs/class/System.EnterpriseServices/ChangeLog28
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ApplicationCrmEnabledAttribute.cs39
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ChangeLog23
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Clerk.cs84
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Compensator.cs93
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/CompensatorOptions.cs22
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecord.cs69
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecordFlags.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/TransactionState.cs20
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/Changelog5
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IClrObjectFactory.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComManagedImportUtil.cs21
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComSoapPublisher.cs46
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.build30
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/AccessChecksLevelOption.cs16
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ActivationOption.cs16
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationAccessControlAttribute.cs63
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationActivationAttribute.cs51
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationIDAttribute.cs39
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationNameAttribute.cs39
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationQueuingAttribute.cs54
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/AuthenticationOption.cs21
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/AutoCompleteAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/BOID.cs21
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/BYOT.cs31
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/COMTIIntrinsicsAttribute.cs45
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ChangeLog99
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ComponentAccessControlAttribute.cs45
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ConstructionEnabledAttribute.cs53
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ContextUtil.cs130
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/DescriptionAttribute.cs31
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventClassAttribute.cs54
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventTrackingEnabledAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ExceptionClassAttribute.cs39
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/IISIntrinsicsAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRegistrationHelper.cs26
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRemoteDispatch.cs27
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallContext.cs34
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallersColl.cs31
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityIdentityColl.cs31
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/IServicedComponentInfo.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedProperty.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedPropertyGroup.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ITransaction.cs26
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ImpersonationLevelOption.cs19
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/InstallationFlags.cs25
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/InterfaceQueuingAttribute.cs52
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/JustInTimeActivationAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/LoadBalancingSupportedAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/MustRunInClientContextAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ObjectPoolingAttribute.cs98
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/PrivateComponentAttribute.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyLockMode.cs20
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyReleaseMode.cs20
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationErrorInfo.cs63
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationException.cs51
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelper.cs54
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelperTx.cs69
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ResourcePool.cs54
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecureMethodAttribute.cs24
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallContext.cs86
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallers.cs52
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityIdentity.cs54
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityRoleAttribute.cs59
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponent.cs88
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponentException.cs35
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedProperty.cs41
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroup.cs56
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroupManager.cs48
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationAttribute.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationOption.cs21
-rwxr-xr-xmcs/class/System.EnterpriseServices/System.EnterpriseServices/TODOAttribute.cs37
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionAttribute.cs58
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionIsolationLevel.cs19
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionOption.cs19
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionVote.cs20
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices/XACTTRANSINFO.cs27
-rw-r--r--mcs/class/System.EnterpriseServices/list69
-rw-r--r--mcs/class/System.EnterpriseServices/makefile.gnu13
-rw-r--r--mcs/class/System.Runtime.Remoting/.cvsignore4
-rw-r--r--mcs/class/System.Runtime.Remoting/ChangeLog35
-rwxr-xr-xmcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CDRFormatter.cs299
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs111
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientChannel.cs102
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSink.cs126
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSinkProvider.cs61
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSink.cs104
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSinkProvider.cs41
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerChannel.cs168
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSink.cs79
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSinkProvider.cs60
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerTransportSink.cs114
-rwxr-xr-xmcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/IIOPMessage.cs149
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/README5
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/README38
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs111
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientChannel.cs102
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSink.cs127
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSinkProvider.cs61
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSink.cs106
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSinkProvider.cs41
-rwxr-xr-xmcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleMessageFormat.cs149
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs169
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSink.cs79
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSinkProvider.cs60
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerTransportSink.cs114
-rwxr-xr-xmcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs298
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs130
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs102
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs152
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSinkProvider.cs41
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs246
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs205
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs224
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerTransportSink.cs102
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSink.cs124
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSinkProvider.cs61
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSink.cs71
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSinkProvider.cs61
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog0
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/CommonTransportKeys.cs22
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs96
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs70
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSinkProvider.cs54
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build26
-rw-r--r--mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs37
-rw-r--r--mcs/class/System.Runtime.Remoting/Test/corba-example.cs50
-rw-r--r--mcs/class/System.Runtime.Remoting/Test/simple-example.cs51
-rw-r--r--mcs/class/System.Runtime.Remoting/makefile.gnu13
-rw-r--r--mcs/class/System.Runtime.Remoting/unix.args30
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore4
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog6
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/README4
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/Sample.txt179
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap.build36
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ChangeLog10
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectDeserializer.cs453
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectSerializer.cs388
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs91
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs586
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs213
-rwxr-xr-xmcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/TODOAttribute.cs37
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/SoapSerializerTest.cs38
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/list6
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.gnu13
-rw-r--r--mcs/class/System.Security/ChangeLog7
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog48
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/DSAKeyValue.cs60
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs162
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfo.cs136
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoClause.cs23
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoName.cs50
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoNode.cs43
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs60
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs214
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/RSAKeyValue.cs58
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/Reference.cs209
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs171
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs182
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs354
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/TODOAttribute.cs37
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs57
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/TransformChain.cs42
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs107
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs110
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs21
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs90
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs108
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs121
-rw-r--r--mcs/class/System.Security/System.Security.build27
-rw-r--r--mcs/class/System.Security/Test/AllTests.cs28
-rw-r--r--mcs/class/System.Security/Test/ChangeLog10
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/AllTests.cs66
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog24
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DSAKeyValueTest.cs95
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DataObjectTest.cs139
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNameTest.cs82
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNodeTest.cs77
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoRetrievalMethodTest.cs92
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoTest.cs205
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoX509DataTest.cs234
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/RSAKeyValueTest.cs95
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ReferenceTest.cs199
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignatureTest.cs76
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedInfoTest.cs156
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs233
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/TransformChainTest.cs80
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigBase64TransformTest.cs159
-rw-r--r--mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs156
-rw-r--r--mcs/class/System.Security/Test/System.Security_test.build39
-rw-r--r--mcs/class/System.ServiceProcess/ChangeLog4
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess.build39
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess/PowerBroadcastStatus.cs22
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceAccount.cs17
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAccess.cs19
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerStatus.cs22
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceStartMode.cs17
-rw-r--r--mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceType.cs22
-rw-r--r--mcs/class/System.Web.Mobile/.cvsignore2
-rw-r--r--mcs/class/System.Web.Mobile/ChangeLog16
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.Mobile.build37
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.Mobile/ChangeLog5
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.Mobile/TODOAttribute.cs33
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Alignment.cs20
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ArrayListCollectionBase.cs83
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/BooleanOption.cs19
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog87
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs53
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/CommandFormat.cs18
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Constants.cs44
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ControlPager.cs22
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/DeviceSpecific.cs21
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontInfo.cs91
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontSize.cs20
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Form.cs40
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FormMethod.cs18
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IControlAdapter.cs38
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IObjectListFieldCollection.cs23
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IPageAdapter.cs36
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ITemplateable.cs16
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Label.cs21
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListDecoration.cs19
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListSelectType.cs21
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileControl.cs282
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs66
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItemType.cs20
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobilePage.cs27
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs31
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs55
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs15
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListField.cs21
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs119
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListViewMode.cs19
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Panel.cs22
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Style.cs74
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs22
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs40
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/WmlListFieldType.cs22
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Wrapping.cs19
-rwxr-xr-xmcs/class/System.Web.Services/.cvsignore8
-rw-r--r--mcs/class/System.Web.Services/ChangeLog53
-rwxr-xr-xmcs/class/System.Web.Services/Mono.System.Web.Services.csproj869
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog6
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionAttribute.cs77
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs44
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs50
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Binding.cs80
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/BindingCollection.cs92
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog289
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/DocumentableItem.cs42
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/FaultBinding.cs52
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/FaultBindingCollection.cs87
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpAddressBinding.cs42
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpBinding.cs44
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpOperationBinding.cs42
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlEncodedBinding.cs24
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlReplacementBinding.cs24
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Import.cs63
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ImportCollection.cs75
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/InputBinding.cs41
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Message.cs86
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs51
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MessageCollection.cs88
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MessagePart.cs73
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MessagePartCollection.cs86
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimeContentBinding.cs52
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimeMultipartRelatedBinding.cs41
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimePart.cs41
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimePartCollection.cs64
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextBinding.cs43
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatch.cs126
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatchCollection.cs70
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/MimeXmlBinding.cs42
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Operation.cs96
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationBinding.cs86
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationBindingCollection.cs75
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationCollection.cs75
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationFault.cs15
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationFaultCollection.cs87
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationFlow.cs19
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationInput.cs16
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs65
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessageCollection.cs130
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OperationOutput.cs13
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/OutputBinding.cs41
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Port.cs73
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/PortCollection.cs88
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/PortType.cs62
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/PortTypeCollection.cs87
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs201
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs170
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Service.cs69
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceCollection.cs90
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs260
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionBaseCollection.cs80
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionCollection.cs121
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtension.cs65
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtensionCollection.cs154
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportStyle.cs15
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportWarnings.cs20
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs76
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs56
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs42
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs61
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingStyle.cs21
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingUse.cs21
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs76
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionImporter.cs44
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionReflector.cs42
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs60
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs89
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs82
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs56
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs111
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs70
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapTransportImporter.cs44
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/Types.cs49
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog61
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs107
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/ContractSearchPattern.cs47
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientDocumentCollection.cs66
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs138
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientReferenceCollection.cs67
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResult.cs62
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResultCollection.cs62
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocument.cs93
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentLinksPattern.cs47
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs99
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentSearchPattern.cs47
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryExceptionDictionary.cs69
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReference.cs77
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReferenceCollection.cs62
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryRequestHandler.cs49
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoverySearchPattern.cs33
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DynamicDiscoveryDocument.cs62
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/ExcludePathInfo.cs46
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/SchemaReference.cs105
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/SoapBinding.cs54
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/XmlSchemaSearchPattern.cs47
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/AnyReturnReader.cs49
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog202
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterReader.cs36
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterWriter.cs52
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpGetClientProtocol.cs37
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpMethodAttribute.cs50
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpPostClientProtocol.cs37
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpServerProtocol.cs76
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs53
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs104
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodInfo.cs176
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodTypes.cs16
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/MatchAttribute.cs64
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeFormatter.cs57
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterReader.cs29
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterWriter.cs66
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnReader.cs30
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnWriter.cs22
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/NopReturnReader.cs49
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/PatternMatcher.cs35
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerProtocol.cs110
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMessage.cs78
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMethod.cs27
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs102
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentServiceAttribute.cs67
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs91
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs46
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtensionAttribute.cs34
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeader.cs78
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderAttribute.cs52
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderCollection.cs69
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs18
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderException.cs39
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs58
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs106
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessageStage.cs18
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapParameterStyle.cs17
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs86
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcServiceAttribute.cs38
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerMessage.cs80
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerProtocol.cs69
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServiceRoutingStyle.cs16
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapUnknownHeader.cs41
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/TextReturnReader.cs46
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlEncodedParameterWriter.cs66
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterReader.cs36
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterWriter.cs35
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs61
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs71
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientProtocol.cs140
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs69
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs41
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs53
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs45
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.build38
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/ChangeLog67
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/TODOAttribute.cs32
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/WebMethodAttribute.cs96
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/WebService.cs72
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/WebServiceAttribute.cs54
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/WebServiceBindingAttribute.cs67
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/WebServicesDescriptionAttribute.cs33
-rw-r--r--mcs/class/System.Web.Services/Test/.cvsignore1
-rw-r--r--mcs/class/System.Web.Services/Test/AllTests.cs24
-rw-r--r--mcs/class/System.Web.Services/Test/ChangeLog10
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/AllTests.cs22
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/ChangeLog5
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs80
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/AllTests.cs22
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ChangeLog5
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ContractReferenceTest.cs55
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services/AllTests.cs23
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services/ChangeLog6
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services/WebMethodAttributeTest.cs54
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services/WebServiceAttributeTest.cs50
-rw-r--r--mcs/class/System.Web.Services/Test/System.Web.Services_test.build35
-rw-r--r--mcs/class/System.Web.Services/list153
-rw-r--r--mcs/class/System.Web.Services/makefile.gnu13
-rw-r--r--mcs/class/System.Web/.cvsignore7
-rw-r--r--mcs/class/System.Web/ChangeLog193
-rw-r--r--mcs/class/System.Web/System.Web.Caching/Cache.cs533
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs53
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDependency.cs95
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheEntry.cs445
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheExpires.cs147
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ChangeLog45
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs787
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs216
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspElements.cs863
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs2021
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspParser.cs277
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs215
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs114
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs156
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ChangeLog231
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/CompilationException.cs40
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/CompilationResult.cs71
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs101
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs104
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs118
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs85
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthConfig.cs175
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs112
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs19
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ChangeLog78
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs44
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs18
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs19
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs29
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs75
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs15
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs120
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs46
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs29
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs131
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs81
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs65
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs116
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs53
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs75
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/ChangeLog6
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs32
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs122
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs87
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ChangeLog45
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs24
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs21
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs48
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs273
-rw-r--r--mcs/class/System.Web/System.Web.Mail/ChangeLog12
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailAttachment.cs44
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailEncoding.cs26
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailFormat.cs26
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailMessage.cs106
-rw-r--r--mcs/class/System.Web/System.Web.Mail/MailPriority.cs30
-rw-r--r--mcs/class/System.Web/System.Web.Mail/SmtpMail.cs77
-rw-r--r--mcs/class/System.Web/System.Web.Security/ChangeLog59
-rw-r--r--mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs32
-rw-r--r--mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs15
-rw-r--r--mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs27
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs300
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs45
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs14
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs91
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs147
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsIdentity.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs15
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs29
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportIdentity.cs438
-rw-r--r--mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs33
-rw-r--r--mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs15
-rw-r--r--mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs34
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/ChangeLog39
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs199
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs15
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs15
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs93
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs20
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog254
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs118
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs92
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs122
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs133
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs176
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs46
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs121
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs99
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs85
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs70
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs88
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs62
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs145
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs134
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs113
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs463
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs199
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs158
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs84
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs156
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs137
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore2
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs92
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs17
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs364
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs311
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs277
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs414
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs29
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs179
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Button.cs172
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs186
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs21
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs1161
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs100
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog977
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs215
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs252
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs92
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs113
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs1445
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs408
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs186
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs86
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs17
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs54
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs257
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs16
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs83
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataList.cs876
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs112
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs16
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs108
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs160
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs109
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs253
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs63
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs30
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs215
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs92
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs23
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs27
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs51
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs176
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs213
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs29
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Image.cs118
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs29
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs181
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Label.cs86
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs27
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs174
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs177
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs343
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs241
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs362
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs36
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs62
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs16
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs475
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs21
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs97
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs28
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs125
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs244
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs125
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs88
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs372
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs377
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs72
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs125
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs42
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Style.cs539
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TODO156
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Table.cs159
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs147
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs181
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs26
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs176
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs99
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs179
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs229
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs109
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs236
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs36
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs257
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs65
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs28
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs76
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs26
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs24
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs142
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs26
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs51
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs74
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs451
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs224
-rw-r--r--mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs46
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/AttributeCollection.cs82
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/BaseParser.cs84
-rw-r--r--mcs/class/System.Web/System.Web.UI/BuildMethod.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI/ChangeLog673
-rw-r--r--mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs29
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI/Control.cs867
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ControlBuilder.cs167
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs47
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ControlCollection.cs124
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/CssStyleCollection.cs106
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBinder.cs158
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBinding.cs60
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBindingCollection.cs92
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs49
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs80
-rw-r--r--mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs29
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs30
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs1027
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs54
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs28
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs111
-rw-r--r--mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs20
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs20
-rw-r--r--mcs/class/System.Web/System.Web.UI/INamingContainer.cs18
-rw-r--r--mcs/class/System.Web/System.Web.UI/IParserAccessor.cs19
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs19
-rw-r--r--mcs/class/System.Web/System.Web.UI/IStateManager.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs20
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITemplate.cs19
-rw-r--r--mcs/class/System.Web/System.Web.UI/IValidator.cs21
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs25
-rw-r--r--mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI/LiteralControl.cs44
-rw-r--r--mcs/class/System.Web/System.Web.UI/LosFormatter.cs487
-rw-r--r--mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs23
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/Page.cs706
-rw-r--r--mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs27
-rw-r--r--mcs/class/System.Web/System.Web.UI/PageParser.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI/Pair.cs36
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs80
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs51
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs50
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PersistenceMode.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs52
-rw-r--r--mcs/class/System.Web/System.Web.UI/PropertyConverter.cs124
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/RenderMethod.cs13
-rw-r--r--mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs186
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateBag.cs249
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateItem.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI/TODO42
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs37
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateControl.cs217
-rw-r--r--mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs47
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateParser.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs58
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/Triplet.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControl.cs189
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControlParser.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI/Utils.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/ValidatorCollection.cs69
-rw-r--r--mcs/class/System.Web/System.Web.UI/WebServiceParser.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Util/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web.Util/ApacheVersionInfo.cs31
-rw-r--r--mcs/class/System.Web/System.Web.Util/ChangeLog84
-rw-r--r--mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs67
-rw-r--r--mcs/class/System.Web/System.Web.Util/FileAction.cs26
-rw-r--r--mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.Util/FileChangedEventArgs.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Util/FileChangesMonitor.cs62
-rw-r--r--mcs/class/System.Web/System.Web.Util/FilePathParser.cs82
-rw-r--r--mcs/class/System.Web/System.Web.Util/IISVersionInfo.cs109
-rw-r--r--mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.Util/UrlUtils.cs290
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebEncoding.cs24
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs107
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebTrace.cs98
-rw-r--r--mcs/class/System.Web/System.Web.build58
-rw-r--r--mcs/class/System.Web/System.Web/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web/BeginEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web/ChangeLog536
-rw-r--r--mcs/class/System.Web/System.Web/EndEventHandler.cs13
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplication.cs1037
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationFactory.cs321
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationState.cs232
-rw-r--r--mcs/class/System.Web/System.Web/HttpAsyncResult.cs73
-rwxr-xr-xmcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs143
-rw-r--r--mcs/class/System.Web/System.Web/HttpCachePolicy.cs148
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs17
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs110
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs81
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheability.cs18
-rw-r--r--mcs/class/System.Web/System.Web/HttpClientCertificate.cs147
-rw-r--r--mcs/class/System.Web/System.Web/HttpCompileException.cs45
-rw-r--r--mcs/class/System.Web/System.Web/HttpContext.cs299
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookie.cs183
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookieCollection.cs147
-rw-r--r--mcs/class/System.Web/System.Web/HttpException.cs86
-rw-r--r--mcs/class/System.Web/System.Web/HttpFileCollection.cs73
-rw-r--r--mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs27
-rw-r--r--mcs/class/System.Web/System.Web/HttpHelper.cs48
-rw-r--r--mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs28
-rw-r--r--mcs/class/System.Web/System.Web/HttpModuleCollection.cs73
-rw-r--r--mcs/class/System.Web/System.Web/HttpParseException.cs44
-rw-r--r--mcs/class/System.Web/System.Web/HttpPostedFile.cs56
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequest.cs1010
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequestStream.cs142
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponse.cs901
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseHeader.cs49
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseStream.cs87
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs48
-rw-r--r--mcs/class/System.Web/System.Web/HttpRuntime.cs463
-rw-r--r--mcs/class/System.Web/System.Web/HttpServerUtility.cs283
-rw-r--r--mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs59
-rw-r--r--mcs/class/System.Web/System.Web/HttpUnhandledException.cs28
-rw-r--r--mcs/class/System.Web/System.Web/HttpUtility.cs777
-rw-r--r--mcs/class/System.Web/System.Web/HttpValidationStatus.cs17
-rw-r--r--mcs/class/System.Web/System.Web/HttpValueCollection.cs192
-rw-r--r--mcs/class/System.Web/System.Web/HttpWorkerRequest.cs529
-rw-r--r--mcs/class/System.Web/System.Web/HttpWriter.cs209
-rw-r--r--mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs18
-rw-r--r--mcs/class/System.Web/System.Web/IHttpHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs19
-rw-r--r--mcs/class/System.Web/System.Web/IHttpMapPath.cs19
-rw-r--r--mcs/class/System.Web/System.Web/IHttpModule.cs14
-rw-r--r--mcs/class/System.Web/System.Web/MimeTypes.cs471
-rw-r--r--mcs/class/System.Web/System.Web/NOTES21
-rw-r--r--mcs/class/System.Web/System.Web/ProcessInfo.cs90
-rw-r--r--mcs/class/System.Web/System.Web/ProcessModelInfo.cs52
-rw-r--r--mcs/class/System.Web/System.Web/ProcessShutdownReason.cs23
-rw-r--r--mcs/class/System.Web/System.Web/ProcessStatus.cs17
-rw-r--r--mcs/class/System.Web/System.Web/StaticFileHandler.cs48
-rw-r--r--mcs/class/System.Web/System.Web/TODO19
-rw-r--r--mcs/class/System.Web/System.Web/TODOAttribute.cs33
-rw-r--r--mcs/class/System.Web/System.Web/TraceContext.cs69
-rw-r--r--mcs/class/System.Web/System.Web/TraceMode.cs16
-rw-r--r--mcs/class/System.Web/System.Web/WebCategoryAttribute.cs38
-rw-r--r--mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs44
-rw-r--r--mcs/class/System.Web/Test/DataBinderTests.cs181
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs103
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs36
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs42
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/README5
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs16
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs37
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/Test1.cs46
-rw-r--r--mcs/class/System.Web/Test/TestMonoWeb/TestMonoWeb.build26
-rw-r--r--mcs/class/System.Web/Test/test.aspx29
-rw-r--r--mcs/class/System.Web/Test/test2.aspx101
-rw-r--r--mcs/class/System.Web/Test/test3.aspx23
-rw-r--r--mcs/class/System.Web/Test/test4.aspx119
-rw-r--r--mcs/class/System.Web/Test/test5.aspx121
-rw-r--r--mcs/class/System.Web/Test/test6.aspx83
-rwxr-xr-xmcs/class/System.Web/list369
-rw-r--r--mcs/class/System.Web/makefile.gnu13
-rw-r--r--mcs/class/System.Web/makefile.trace12
-rw-r--r--mcs/class/System.Windows.Forms/.cvsignore3
-rw-r--r--mcs/class/System.Windows.Forms/ChangeLog9
-rw-r--r--mcs/class/System.Windows.Forms/CheckOutList208
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/AnchorStyles.cs22
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Application.cs37
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Button.cs107
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs204
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ContainerControl.cs114
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Control.cs263
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ControlEventArgs.cs36
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ControlEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/DialogResult.cs31
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Form.cs820
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/HorizontalAlignment.cs20
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/IButtonControl.cs17
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/IContainerControl.cs18
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Label.cs276
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs206
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ScrollBars.cs21
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs305
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TextBox.cs218
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs442
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/changelog13
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/demo.cs58
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/makefile26
-rw-r--r--mcs/class/System.Windows.Forms/README102
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/App.icobin0 -> 1078 bytes
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/AssemblyInfo.cs58
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/Form1.cs364
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/Form1.resx499
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj129
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj.user48
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/changelog14
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/makefile2
-rw-r--r--mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs89
-rw-r--r--mcs/class/System.Windows.Forms/System.Resources/ResXResourceWriter.cs64
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AnchorEditor.cs35
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AssemblyInfo.cs58
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AxImporter.cs87
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentDocumentDesigner.cs59
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs51
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentTray.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ControlDesigner.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/DocumentDesigner.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/FileNameEditor.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IMenuEditorService.cs11
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs11
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IWindowsformsEditorService.cs11
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/MenusCommands.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ParentControlDesigner.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ScrollableControlDesigner.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/SelectionRules.cs11
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj193
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj.user48
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/TODOAttribute.cs32
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/UITypeEditor.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog40
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Test/MenuTest.cs222
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Test/changelog4
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.build46
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.sln34
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs59
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs31
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs301
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleRole.cs80
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleStates.cs59
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AmbientProperties.cs96
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AnchorStyles.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Appearance.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs270
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ApplicationContext.cs81
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AssemblyInfo.cs58
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs518
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BaseCollection.cs73
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Binding.cs99
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BindingContext.cs87
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs112
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs138
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BindingsCollection.cs111
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BootMode.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DSide.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DStyle.cs27
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BorderStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs115
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs199
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonState.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog2064
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs194
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs538
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Clipboard.cs39
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDepth.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs140
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs32
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs15
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeader.cs84
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ComVisible.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs672
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CommonDialog.cs71
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs138
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs41
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ContextMenu.cs64
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs2615
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs78
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs40
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs437
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ControlStyles.cs32
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs53
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CreateParams.cs109
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CurrencyManager.cs175
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs178
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CursorConverter.cs76
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Cursors.cs234
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataFormats.cs93
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs1057
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs175
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs132
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs254
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs59
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs485
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs78
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs202
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataObject.cs115
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs47
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs53
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs459
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs31
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DomainUpDown.cs187
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs27
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventArgs.cs95
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs128
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs35
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs163
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs50
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs188
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs121
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Font.cs8
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs197
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs978
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs30
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs50
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs178
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs63
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs67
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemType.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs162
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs135
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs64
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs40
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs52
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HelpNavigator.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs98
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs32
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IMessageFilter.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs83
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs338
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ImeMode.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs83
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs66
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs64
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs49
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs41
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemActivation.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs36
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs61
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs53
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs111
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs55
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Keys.cs202
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/KeysConverter.cs107
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs395
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs62
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs50
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkArea.cs68
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkBehavior.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs45
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs478
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs45
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkState.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs61
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs858
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs141
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs1476
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs554
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs42
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs79
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MdiLayout.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs96
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs473
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MenuGlyph.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs388
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MenuMerge.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Message.cs172
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBox.cs129
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs1616
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MouseButtons.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs80
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs202
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs48
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs69
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NotifyIcon.cs96
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NumericUpDown.cs181
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/OSFeature.cs54
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/OpacityConverter.cs47
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs84
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Orientation.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs145
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs66
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Panel.cs102
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs157
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs62
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PrintDialog.cs127
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs173
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs372
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ProgressBar.cs240
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs462
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyManager.cs127
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertySort.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs58
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs51
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs80
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs66
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs205
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs589
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RightToLeft.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs65
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs120
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs236
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBars.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollButton.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs59
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventType.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs346
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SecurityIDType.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs46
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionMode.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRange.cs69
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs95
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SendKeys.cs38
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Shortcut.cs170
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SortOrder.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Splitter.cs221
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs75
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs564
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs43
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs131
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs46
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelCollection.cs194
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StructFormat.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj1713
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj.user48
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.sln27
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SystemInformation.cs323
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TODOAttribute.cs32
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TabAlignment.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TabAppearance.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TabControl.cs532
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TabDrawMode.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TabPage.cs115
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TabSizeMode.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TextBox.cs170
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs430
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs27
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TickStyle.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs86
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs473
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs163
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs40
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TrackBar.cs280
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNode.cs316
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs186
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs42
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs506
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewAction.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs61
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs44
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs38
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UICues.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs73
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs356
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UserControl.cs73
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/VScrollBar.cs71
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/View.cs21
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj1013
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj.user48
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/day.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/makefile56
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/monostub.c113
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog193
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/tooltip.cs122
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs2127
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/win32Handles.cs213
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/win32Interfaces.cs165
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/win32RegistryUtil.cs110
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/win32Structs.cs732
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs840
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AccessibleEvents.cs59
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AccessibleNavigation.cs32
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AccessibleObject.cs370
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AccessibleRole.cs80
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AccessibleSelection.cs30
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AccessibleStates.cs59
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AnchorStyles.cs22
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Application.cs236
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ApplicationContext.cs83
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/AssemblyInfo.cs58
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BaseCollection.cs79
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Binding.cs101
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BindingContext.cs88
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BindingManagerBase.cs112
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BindingMemberInfo.cs149
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BindingsCollection.cs113
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BorderStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/BoundsSpecified.cs25
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Button.cs115
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs198
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/CheckState.cs27
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ColorDepth.cs22
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ColumnClickEventArgs.cs103
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ColumnClickEventHandler.cs15
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ComVisible.cs25
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ContainerControl.cs127
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventArgs.cs122
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ContextMenu.cs82
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Control.cs2954
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ControlBindingsCollection.cs85
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ControlEventArgs.cs121
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ControlEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ControlStyles.cs32
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ConvertEventArgs.cs134
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ConvertEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/CreateParams.cs108
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Cursor.cs180
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DateBoldEventArgs.cs39
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DateRangeEventArgs.cs133
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DateRangeEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DialogResult.cs32
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DockStyle.cs29
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DragAction.cs27
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DragDropEffects.cs30
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DragEventArgs.cs177
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DragEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DrawItemEventArgs.cs9
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DrawItemEventHandler.cs8
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/DrawItemState.cs36
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ErrorIconAlignment.cs30
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/FlatStyle.cs27
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Font.cs6
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Form.cs1029
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/FormBorderStyle.cs31
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/FormStartPosition.cs29
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/FormTest.cs85
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/FormWindowState.cs27
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventArgs.cs131
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/GridItem.cs100
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/HelpEventArgs.cs134
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/HelpEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/HorizontalAlignment.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IAccessible.cs7
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IButtonControl.cs17
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IContainerControl.cs8
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IDataObject.cs33
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IMessageFilter.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IWin32Window.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/IWindowTarget.cs25
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ImageList.cs381
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ImageListStreamer.cs41
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ImeMode.cs29
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InputLanguage.cs86
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventArgs.cs140
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventArgs.cs146
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InputLanguageCollection.cs70
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InvalidateEventArgs.cs122
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/InvalidateEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ItemChangedEventArgs.cs113
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ItemChangedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ItemCheckEventArgs.cs143
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ItemCheckEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ItemDragEventArgs.cs137
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ItemDragEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/KeyEventArgs.cs208
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/KeyEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/KeyPressEventArgs.cs135
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/KeyPressEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Keys.cs202
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Label.cs410
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LabelEditEventArgs.cs144
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LabelEditEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LayoutEventArgs.cs130
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LayoutEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LeftRightAlignment.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkArea.cs146
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkBehavior.cs21
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkClickedEventArgs.cs123
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkClickedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkLabel.cs601
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventArgs.cs124
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ListViewAlignment.cs21
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MainMenu.cs243
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MdiLayout.cs21
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MeasureItemEventArgs.cs180
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MeasureItemEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Menu.cs394
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MenuItem.cs7
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Message.cs172
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MessageBox.cs179
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MessageBoxButtons.cs23
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MessageBoxDefaultButton.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MessageBoxIcon.cs26
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MessageBoxOptions.cs21
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MouseButtons.cs23
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MouseEventArgs.cs168
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/MouseEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/NativeWindow.cs231
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/NativeWindowTest.cs59
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/NavigateEventArgs.cs128
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/NavigateEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventArgs.cs144
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/PaintEventArgs.cs146
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/PaintEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventArgs.cs139
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventArgs.cs131
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventArgs.cs156
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventArgs.cs142
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/README51
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/RightToLeft.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ScrollEventArgs.cs140
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ScrollEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ScrollEventType.cs29
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ScrollableControl.cs363
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventArgs.cs121
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/SizeGripStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/SplitterEventArgs.cs148
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/SplitterEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBar.cs487
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventArgs.cs119
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarPanel.cs141
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarPanelAutoSize.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarPanelBorderStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventArgs.cs121
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/StatusBarPanelStyle.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TODOAttribute.cs32
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TabAlignment.cs21
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Test.cs14
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBar.cs458
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBarAppearance.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBarButton.cs157
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventArgs.cs118
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBarButtonStyle.cs21
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/ToolBarTextAlign.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeNode.cs316
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeNodeCollection.cs187
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeView.cs485
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeViewAction.cs24
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventArgs.cs138
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeViewEventArgs.cs44
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/TreeViewEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/UICues.cs26
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/UICuesEventArgs.cs149
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/UICuesEventHandler.cs17
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/UpDownEventArgs.cs19
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/UpDownEventHandler.cs20
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/WINELib.csproj1013
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/WINELib.csproj.user48
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/Win32.cs678
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/changelog193
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/makefile156
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/monostub.c113
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/tooltip.cs120
-rw-r--r--mcs/class/System.Windows.Forms/WINELib/winelib.sln3
-rw-r--r--mcs/class/System.Windows.Forms/list.unix343
-rw-r--r--mcs/class/System.Windows.Forms/makefile.gnu16
-rw-r--r--mcs/class/System.XML/.cvsignore9
-rw-r--r--mcs/class/System.XML/ChangeLog56
-rw-r--r--mcs/class/System.XML/Mono.System.XML.csproj1265
-rw-r--r--mcs/class/System.XML/Mono.System.XML.sln27
-rwxr-xr-xmcs/class/System.XML/README8
-rw-r--r--mcs/class/System.XML/System.XML.build38
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt20
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/BUGS.txt5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ChangeLog69
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs38
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs48
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchema.cs711
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs165
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs56
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs145
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs192
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs169
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs91
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs435
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs208
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs126
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs203
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs130
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs47
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs162
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs254
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs256
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs463
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs15
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs22
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs17
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs30
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs31
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs104
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs625
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs87
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs94
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs62
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs37
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs98
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs195
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs20
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs156
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs91
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs109
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs97
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaInfo.cs25
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs127
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs151
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs96
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs96
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs96
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs97
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs96
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs95
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs96
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs158
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs75
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs88
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs49
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs51
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs98
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs87
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs358
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs151
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs202
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs146
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs190
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs337
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs237
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs17
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs152
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs267
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs175
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs96
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs81
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs126
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs22
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs299
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs97
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs104
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs15
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs58
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/ChangeLog143
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs50
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs110
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs19
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SchemaTypes.cs23
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs61
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs72
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs88
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs75
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs60
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs40
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs25
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs38
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs90
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs42
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs71
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapSchemaMember.cs44
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs59
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/TypeData.cs82
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/TypeMember.cs54
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs53
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs35
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventHandler.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs28
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs66
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs66
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs90
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs85
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs61
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs95
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs49
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventHandler.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs60
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs439
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs51
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs81
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs133
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs104
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs59
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs53
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/XmlElementEventHandler.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs41
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs26
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs37
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs23
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs56
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs53
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs26
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs82
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/XmlNodeEventHandler.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs128
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlReflectionMember.cs66
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs73
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs58
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs91
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs148
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs634
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs571
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs1012
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs76
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs61
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs60
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs50
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/ChangeLog183
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs618
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Expression.cs1009
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Iterator.cs607
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Parser.cs1107
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Parser.jay412
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs334
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathDocument.cs68
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathException.cs27
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs50
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs18
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs261
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs63
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs25
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs22
-rwxr-xr-xmcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs33
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/ChangeLog25
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs28
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs27
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs314
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs131
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs56
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs45
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/XsltException.cs72
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog1293
-rw-r--r--mcs/class/System.XML/System.Xml/Driver.cs56
-rwxr-xr-xmcs/class/System.XML/System.Xml/EntityHandling.cs29
-rwxr-xr-xmcs/class/System.XML/System.Xml/Formatting.cs29
-rwxr-xr-xmcs/class/System.XML/System.Xml/IHasXmlNode.cs15
-rw-r--r--mcs/class/System.XML/System.Xml/IXmlLineInfo.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml/NameTable.cs74
-rw-r--r--mcs/class/System.XML/System.Xml/Profile.cs47
-rw-r--r--mcs/class/System.XML/System.Xml/ReadState.cs41
-rw-r--r--mcs/class/System.XML/System.Xml/TODOAttribute.cs32
-rwxr-xr-xmcs/class/System.XML/System.Xml/ValidationType.cs20
-rw-r--r--mcs/class/System.XML/System.Xml/WhitespaceHandling.cs33
-rwxr-xr-xmcs/class/System.XML/System.Xml/WriteState.cs53
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttribute.cs244
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs207
-rw-r--r--mcs/class/System.XML/System.Xml/XmlCDataSection.cs54
-rw-r--r--mcs/class/System.XML/System.Xml/XmlChar.cs205
-rw-r--r--mcs/class/System.XML/System.Xml/XmlCharacterData.cs134
-rw-r--r--mcs/class/System.XML/System.Xml/XmlComment.cs65
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlConstructs.cs545
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlConvert.cs329
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDeclaration.cs136
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocument.cs891
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs125
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs304
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocumentType.cs98
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs383
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlEntity.cs123
-rw-r--r--mcs/class/System.XML/System.Xml/XmlEntityReference.cs75
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlException.cs93
-rw-r--r--mcs/class/System.XML/System.Xml/XmlImplementation.cs43
-rw-r--r--mcs/class/System.XML/System.Xml/XmlLinkedNode.cs77
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNameTable.cs20
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs114
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs182
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNode.cs532
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeArrayList.cs36
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs27
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs67
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs14
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeList.cs42
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs146
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeOrder.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeReader.cs420
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeType.cs93
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNotation.cs100
-rw-r--r--mcs/class/System.XML/System.Xml/XmlParserContext.cs186
-rw-r--r--mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs103
-rw-r--r--mcs/class/System.XML/System.Xml/XmlQualifiedName.cs116
-rw-r--r--mcs/class/System.XML/System.Xml/XmlReader.cs374
-rw-r--r--mcs/class/System.XML/System.Xml/XmlResolver.cs32
-rw-r--r--mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs72
-rw-r--r--mcs/class/System.XML/System.Xml/XmlSpace.cs37
-rw-r--r--mcs/class/System.XML/System.Xml/XmlText.cs76
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextReader.cs1741
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriter.cs700
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs72
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlTokenizedType.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlUrlResolver.cs41
-rw-r--r--mcs/class/System.XML/System.Xml/XmlValidatingReader.cs341
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWhitespace.cs72
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWriter.cs258
-rw-r--r--mcs/class/System.XML/Test/.cvsignore4
-rw-r--r--mcs/class/System.XML/Test/AllTests.cs52
-rw-r--r--mcs/class/System.XML/Test/ChangeLog598
-rw-r--r--mcs/class/System.XML/Test/Microsoft.Test.csproj162
-rw-r--r--mcs/class/System.XML/Test/Mono.Test.csproj167
-rw-r--r--mcs/class/System.XML/Test/MonoMicro.Test.csproj212
-rwxr-xr-xmcs/class/System.XML/Test/NameTableTests.cs91
-rw-r--r--mcs/class/System.XML/Test/SelectNodesTests.cs227
-rw-r--r--mcs/class/System.XML/Test/System.XML_linux_test.args32
-rw-r--r--mcs/class/System.XML/Test/System.XML_test.build37
-rw-r--r--mcs/class/System.XML/Test/TheTests.cs93
-rw-r--r--mcs/class/System.XML/Test/XPathNavigatorEvaluateTests.cs212
-rw-r--r--mcs/class/System.XML/Test/XPathNavigatorMatchesTests.cs116
-rw-r--r--mcs/class/System.XML/Test/XPathNavigatorTests.cs172
-rw-r--r--mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs149
-rw-r--r--mcs/class/System.XML/Test/XmlAttributeTests.cs124
-rwxr-xr-xmcs/class/System.XML/Test/XmlCDataSectionTests.cs99
-rw-r--r--mcs/class/System.XML/Test/XmlCharacterDataTests.cs175
-rwxr-xr-xmcs/class/System.XML/Test/XmlCommentTests.cs107
-rwxr-xr-xmcs/class/System.XML/Test/XmlDeclarationTests.cs153
-rwxr-xr-xmcs/class/System.XML/Test/XmlDocumentFragmentTests.cs93
-rw-r--r--mcs/class/System.XML/Test/XmlDocumentTests.cs875
-rwxr-xr-xmcs/class/System.XML/Test/XmlDocumentTypeTests.cs104
-rw-r--r--mcs/class/System.XML/Test/XmlElementTests.cs337
-rwxr-xr-xmcs/class/System.XML/Test/XmlEntityReferenceTests.cs35
-rw-r--r--mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs138
-rw-r--r--mcs/class/System.XML/Test/XmlNodeListTests.cs215
-rw-r--r--mcs/class/System.XML/Test/XmlNodeTests.cs182
-rw-r--r--mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs36
-rwxr-xr-xmcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs127
-rw-r--r--mcs/class/System.XML/Test/XmlTextReaderTests.cs1776
-rw-r--r--mcs/class/System.XML/Test/XmlTextTests.cs36
-rw-r--r--mcs/class/System.XML/Test/XmlTextWriterTests.cs943
-rwxr-xr-xmcs/class/System.XML/Test/XmlWhiteSpaceTests.cs118
-rw-r--r--mcs/class/System.XML/Test/XmlWriterTests.cs206
-rw-r--r--mcs/class/System.XML/Test/makefile.gnu22
-rwxr-xr-xmcs/class/System.XML/list192
-rwxr-xr-xmcs/class/System.XML/list.unix226
-rw-r--r--mcs/class/System.XML/makefile.gnu16
-rw-r--r--mcs/class/System/.cvsignore5
-rw-r--r--mcs/class/System/ChangeLog153
-rw-r--r--mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs171
-rw-r--r--mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs798
-rw-r--r--mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs54
-rw-r--r--mcs/class/System/Microsoft.CSharp/ChangeLog65
-rw-r--r--mcs/class/System/Microsoft.Win32/ChangeLog21
-rw-r--r--mcs/class/System/Microsoft.Win32/PowerModeChangedEventArgs.cs32
-rw-r--r--mcs/class/System/Microsoft.Win32/PowerModeChangedEventHandler.cs14
-rw-r--r--mcs/class/System/Microsoft.Win32/PowerModes.cs18
-rw-r--r--mcs/class/System/Microsoft.Win32/SessionEndReasons.cs17
-rw-r--r--mcs/class/System/Microsoft.Win32/SessionEndedEventArgs.cs32
-rw-r--r--mcs/class/System/Microsoft.Win32/SessionEndedEventHandler.cs15
-rw-r--r--mcs/class/System/Microsoft.Win32/SessionEndingEventArgs.cs46
-rw-r--r--mcs/class/System/Microsoft.Win32/SessionEndingEventHandler.cs14
-rw-r--r--mcs/class/System/Microsoft.Win32/SystemEvents.cs110
-rw-r--r--mcs/class/System/Microsoft.Win32/TODOAttribute.cs34
-rw-r--r--mcs/class/System/Microsoft.Win32/TimerElapsedEventArgs.cs33
-rw-r--r--mcs/class/System/Microsoft.Win32/TimerElapsedEventHandler.cs14
-rw-r--r--mcs/class/System/Microsoft.Win32/UserPreferenceCategory.cs28
-rw-r--r--mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventArgs.cs33
-rw-r--r--mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventHandler.cs14
-rw-r--r--mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventArgs.cs33
-rw-r--r--mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventHandler.cs14
-rwxr-xr-xmcs/class/System/README8
-rwxr-xr-xmcs/class/System/System.CodeDom.Compiler/ChangeLog61
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CodeCompiler.cs138
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs69
-rwxr-xr-xmcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs936
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CodeGeneratorOptions.cs99
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CompilerError.cs81
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CompilerErrorCollection.cs96
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CompilerOptions.cs16
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CompilerParameters.cs169
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/CompilerResults.cs87
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/GeneratorSupport.cs38
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/ICodeCompiler.cs32
-rwxr-xr-xmcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs53
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/ICodeParser.cs20
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/IndentedTextWriter.cs294
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/LanguageOptions.cs18
-rw-r--r--mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs16
-rw-r--r--mcs/class/System/System.CodeDom/ChangeLog243
-rw-r--r--mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs46
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs145
-rw-r--r--mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs56
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAssignStatement.cs55
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttachEventStatement.cs68
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeArgument.cs61
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs100
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs63
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs100
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs21
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs69
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs35
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCastExpression.cs71
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCatchClause.cs81
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs98
-rw-r--r--mcs/class/System/System.CodeDom/CodeComment.cs62
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCommentStatement.cs57
-rw-r--r--mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs100
-rw-r--r--mcs/class/System/System.CodeDom/CodeCompileUnit.cs60
-rw-r--r--mcs/class/System/System.CodeDom/CodeConditionStatement.cs77
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeConstructor.cs52
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs72
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs64
-rw-r--r--mcs/class/System/System.CodeDom/CodeDirectionExpression.cs59
-rw-r--r--mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs21
-rw-r--r--mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs57
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeExpression.cs21
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeExpressionCollection.cs100
-rw-r--r--mcs/class/System/System.CodeDom/CodeExpressionStatement.cs46
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs59
-rw-r--r--mcs/class/System/System.CodeDom/CodeGotoStatement.cs42
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeIndexerExpression.cs58
-rw-r--r--mcs/class/System/System.CodeDom/CodeIterationStatement.cs81
-rw-r--r--mcs/class/System/System.CodeDom/CodeLabeledStatement.cs62
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeLinePragma.cs56
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberEvent.cs68
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberField.cs67
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberMethod.cs109
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberProperty.cs108
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs65
-rw-r--r--mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs59
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs47
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeNamespace.cs92
-rw-r--r--mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs99
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeNamespaceImport.cs57
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs150
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeObject.cs35
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs72
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs91
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs100
-rwxr-xr-xmcs/class/System/System.CodeDom/CodePrimitiveExpression.cs46
-rwxr-xr-xmcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs59
-rw-r--r--mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs21
-rw-r--r--mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs68
-rw-r--r--mcs/class/System/System.CodeDom/CodeSnippetCompileUnit.cs52
-rw-r--r--mcs/class/System/System.CodeDom/CodeSnippetExpression.cs46
-rw-r--r--mcs/class/System/System.CodeDom/CodeSnippetStatement.cs46
-rw-r--r--mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs46
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeStatement.cs42
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeStatementCollection.cs105
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs28
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs46
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs73
-rw-r--r--mcs/class/System/System.CodeDom/CodeTypeConstructor.cs21
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeDeclaration.cs149
-rw-r--r--mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs99
-rw-r--r--mcs/class/System/System.CodeDom/CodeTypeDelegate.cs55
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeMember.cs84
-rw-r--r--mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs99
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeOfExpression.cs57
-rw-r--r--mcs/class/System/System.CodeDom/CodeTypeReference.cs85
-rw-r--r--mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs109
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs57
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs108
-rw-r--r--mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs46
-rwxr-xr-xmcs/class/System/System.CodeDom/FieldDirection.cs21
-rwxr-xr-xmcs/class/System/System.CodeDom/MemberAttributes.cs38
-rw-r--r--mcs/class/System/System.Collections.Specialized/BitVector32.cs199
-rwxr-xr-xmcs/class/System/System.Collections.Specialized/ChangeLog84
-rw-r--r--mcs/class/System/System.Collections.Specialized/CollectionsUtil.cs38
-rw-r--r--mcs/class/System/System.Collections.Specialized/HybridDictionary.cs184
-rw-r--r--mcs/class/System/System.Collections.Specialized/ListDictionary.cs429
-rw-r--r--mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs518
-rw-r--r--mcs/class/System/System.Collections.Specialized/NameValueCollection.cs364
-rwxr-xr-xmcs/class/System/System.Collections.Specialized/StringCollection.cs291
-rw-r--r--mcs/class/System/System.Collections.Specialized/StringDictionary.cs97
-rw-r--r--mcs/class/System/System.Collections.Specialized/StringEnumerator.cs36
-rw-r--r--mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventArgs.cs43
-rw-r--r--mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventHandler.cs15
-rw-r--r--mcs/class/System/System.ComponentModel.Design/Changelog23
-rw-r--r--mcs/class/System/System.ComponentModel.Design/CommandID.cs61
-rw-r--r--mcs/class/System/System.ComponentModel.Design/DesignerTransaction.cs53
-rw-r--r--mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs28
-rw-r--r--mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventHandler.cs16
-rw-r--r--mcs/class/System/System.ComponentModel.Design/DesignerVerb.cs41
-rw-r--r--mcs/class/System/System.ComponentModel.Design/DesignerVerbCollection.cs111
-rw-r--r--mcs/class/System/System.ComponentModel.Design/IDesigner.cs24
-rw-r--r--mcs/class/System/System.ComponentModel.Design/IDesignerHost.cs56
-rw-r--r--mcs/class/System/System.ComponentModel.Design/IResourceService.cs20
-rw-r--r--mcs/class/System/System.ComponentModel.Design/ISelectionService.cs18
-rw-r--r--mcs/class/System/System.ComponentModel.Design/IServiceContainer.cs47
-rw-r--r--mcs/class/System/System.ComponentModel.Design/MenuCommand.cs109
-rw-r--r--mcs/class/System/System.ComponentModel.Design/ServiceCreatorCallback.cs15
-rw-r--r--mcs/class/System/System.ComponentModel/AttributeCollection.cs130
-rw-r--r--mcs/class/System/System.ComponentModel/BaseNumberConverter.cs9
-rwxr-xr-xmcs/class/System/System.ComponentModel/BindableAttribute.cs71
-rw-r--r--mcs/class/System/System.ComponentModel/BindableSupport.cs18
-rwxr-xr-xmcs/class/System/System.ComponentModel/BrowsableAttribute.cs38
-rw-r--r--mcs/class/System/System.ComponentModel/CancelEventArgs.cs38
-rw-r--r--mcs/class/System/System.ComponentModel/CancelEventHandler.cs17
-rwxr-xr-xmcs/class/System/System.ComponentModel/CategoryAttribute.cs227
-rw-r--r--mcs/class/System/System.ComponentModel/ChangeLog340
-rw-r--r--mcs/class/System/System.ComponentModel/CollectionChangeAction.cs20
-rw-r--r--mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs38
-rw-r--r--mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs14
-rw-r--r--mcs/class/System/System.ComponentModel/Component.cs141
-rw-r--r--mcs/class/System/System.ComponentModel/ComponentCollection.cs55
-rw-r--r--mcs/class/System/System.ComponentModel/Container.cs164
-rw-r--r--mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs43
-rw-r--r--mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs43
-rwxr-xr-xmcs/class/System/System.ComponentModel/DefaultValueAttribute.cs133
-rw-r--r--mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs106
-rwxr-xr-xmcs/class/System/System.ComponentModel/DescriptionAttribute.cs46
-rwxr-xr-xmcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs37
-rw-r--r--mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs68
-rw-r--r--mcs/class/System/System.ComponentModel/DesignerAttribute.cs88
-rwxr-xr-xmcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs16
-rwxr-xr-xmcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs42
-rw-r--r--mcs/class/System/System.ComponentModel/EditorAttribute.cs85
-rwxr-xr-xmcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs53
-rwxr-xr-xmcs/class/System/System.ComponentModel/EditorBrowsableState.cs34
-rw-r--r--mcs/class/System/System.ComponentModel/EnumConverter.cs92
-rw-r--r--mcs/class/System/System.ComponentModel/EventDescriptor.cs26
-rw-r--r--mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs167
-rw-r--r--mcs/class/System/System.ComponentModel/EventHandlerList.cs69
-rw-r--r--mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs41
-rw-r--r--mcs/class/System/System.ComponentModel/IBindingList.cs69
-rw-r--r--mcs/class/System/System.ComponentModel/IComponent.cs22
-rw-r--r--mcs/class/System/System.ComponentModel/IContainer.cs24
-rw-r--r--mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs38
-rw-r--r--mcs/class/System/System.ComponentModel/IDataErrorInfo.cs18
-rw-r--r--mcs/class/System/System.ComponentModel/IEditableObject.cs20
-rw-r--r--mcs/class/System/System.ComponentModel/IExtenderProvider.cs18
-rw-r--r--mcs/class/System/System.ComponentModel/IListSource.cs23
-rw-r--r--mcs/class/System/System.ComponentModel/ISite.cs23
-rw-r--r--mcs/class/System/System.ComponentModel/ISupportInitialize.cs23
-rwxr-xr-xmcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs26
-rw-r--r--mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs29
-rw-r--r--mcs/class/System/System.ComponentModel/ITypedList.cs24
-rw-r--r--mcs/class/System/System.ComponentModel/Int32Converter.cs10
-rw-r--r--mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs42
-rw-r--r--mcs/class/System/System.ComponentModel/ListBindableAttribute.cs69
-rwxr-xr-xmcs/class/System/System.ComponentModel/ListChangedEventArgs.cs53
-rwxr-xr-xmcs/class/System/System.ComponentModel/ListChangedEventHandler.cs15
-rwxr-xr-xmcs/class/System/System.ComponentModel/ListChangedType.cs23
-rw-r--r--mcs/class/System/System.ComponentModel/ListSortDirection.cs20
-rwxr-xr-xmcs/class/System/System.ComponentModel/LocalizableAttribute.cs40
-rw-r--r--mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs90
-rwxr-xr-xmcs/class/System/System.ComponentModel/MemberDescriptor.cs120
-rwxr-xr-xmcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs64
-rw-r--r--mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs29
-rw-r--r--mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs17
-rwxr-xr-xmcs/class/System/System.ComponentModel/PropertyDescriptor.cs121
-rw-r--r--mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs283
-rw-r--r--mcs/class/System/System.ComponentModel/PropertyTabScope.cs9
-rwxr-xr-xmcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs54
-rw-r--r--mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs65
-rw-r--r--mcs/class/System/System.ComponentModel/RefreshEventArgs.cs44
-rw-r--r--mcs/class/System/System.ComponentModel/RefreshEventHandler.cs14
-rw-r--r--mcs/class/System/System.ComponentModel/RefreshProperties.cs18
-rw-r--r--mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs63
-rw-r--r--mcs/class/System/System.ComponentModel/StringConverter.cs41
-rw-r--r--mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs82
-rwxr-xr-xmcs/class/System/System.ComponentModel/TypeConverter.cs318
-rw-r--r--mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs53
-rw-r--r--mcs/class/System/System.ComponentModel/TypeDescriptor.cs350
-rw-r--r--mcs/class/System/System.ComponentModel/WarningException.cs49
-rwxr-xr-xmcs/class/System/System.ComponentModel/Win32Exception.cs126
-rw-r--r--mcs/class/System/System.Configuration/AppSettingsReader.cs54
-rw-r--r--mcs/class/System/System.Configuration/ChangeLog136
-rw-r--r--mcs/class/System/System.Configuration/ConfigHelper.cs184
-rw-r--r--mcs/class/System/System.Configuration/ConfigXmlDocument.cs234
-rw-r--r--mcs/class/System/System.Configuration/ConfigurationException.cs141
-rw-r--r--mcs/class/System/System.Configuration/ConfigurationSettings.cs456
-rw-r--r--mcs/class/System/System.Configuration/DictionarySectionHandler.cs57
-rw-r--r--mcs/class/System/System.Configuration/IConfigXmlNode.cs18
-rw-r--r--mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs27
-rw-r--r--mcs/class/System/System.Configuration/IConfigurationSystem.cs18
-rw-r--r--mcs/class/System/System.Configuration/IgnoreSectionHandler.cs32
-rw-r--r--mcs/class/System/System.Configuration/NameValueFileSectionHandler.cs53
-rw-r--r--mcs/class/System/System.Configuration/NameValueSectionHandler.cs56
-rw-r--r--mcs/class/System/System.Configuration/SingleTagSectionHandler.cs56
-rwxr-xr-xmcs/class/System/System.Diagnostics/BooleanSwitch.cs39
-rw-r--r--mcs/class/System/System.Diagnostics/ChangeLog248
-rw-r--r--mcs/class/System/System.Diagnostics/CounterCreationData.cs52
-rw-r--r--mcs/class/System/System.Diagnostics/CounterCreationDataCollection.cs97
-rw-r--r--mcs/class/System/System.Diagnostics/CounterSample.cs110
-rw-r--r--mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs32
-rw-r--r--mcs/class/System/System.Diagnostics/Debug.cs197
-rw-r--r--mcs/class/System/System.Diagnostics/DefaultTraceListener.cs229
-rw-r--r--mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs350
-rw-r--r--mcs/class/System/System.Diagnostics/EntryWrittenEventArgs.cs34
-rw-r--r--mcs/class/System/System.Diagnostics/EntryWrittenEventHandler.cs21
-rw-r--r--mcs/class/System/System.Diagnostics/EventLog.cs271
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogEntry.cs105
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogEntryCollection.cs57
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogEntryType.cs24
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogInstaller.cs75
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogPermission.cs50
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogPermissionAccess.cs23
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs48
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs37
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs104
-rw-r--r--mcs/class/System/System.Diagnostics/EventLogTraceListener.cs75
-rwxr-xr-xmcs/class/System/System.Diagnostics/FileVersionInfo.cs274
-rw-r--r--mcs/class/System/System.Diagnostics/ICollectData.cs26
-rw-r--r--mcs/class/System/System.Diagnostics/InstanceData.cs39
-rw-r--r--mcs/class/System/System.Diagnostics/InstanceDataCollection.cs66
-rw-r--r--mcs/class/System/System.Diagnostics/InstanceDataCollectionCollection.cs58
-rw-r--r--mcs/class/System/System.Diagnostics/MonitoringDescriptionAttribute.cs29
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounter.cs216
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs182
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs82
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs44
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs45
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs22
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs61
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs44
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs107
-rw-r--r--mcs/class/System/System.Diagnostics/PerformanceCounterType.cs47
-rwxr-xr-xmcs/class/System/System.Diagnostics/Process.cs712
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessModule.cs74
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessModuleCollection.cs57
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessPriorityClass.cs20
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessStartInfo.cs171
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessThread.cs118
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessThreadCollection.cs56
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessWindowStyle.cs18
-rwxr-xr-xmcs/class/System/System.Diagnostics/Switch.cs94
-rw-r--r--mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs109
-rwxr-xr-xmcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs21
-rwxr-xr-xmcs/class/System/System.Diagnostics/ThreadState.cs22
-rwxr-xr-xmcs/class/System/System.Diagnostics/ThreadWaitReason.cs28
-rw-r--r--mcs/class/System/System.Diagnostics/Trace.cs197
-rw-r--r--mcs/class/System/System.Diagnostics/TraceImpl.cs337
-rwxr-xr-xmcs/class/System/System.Diagnostics/TraceLevel.cs24
-rw-r--r--mcs/class/System/System.Diagnostics/TraceListener.cs136
-rw-r--r--mcs/class/System/System.Diagnostics/TraceListenerCollection.cs210
-rwxr-xr-xmcs/class/System/System.Diagnostics/TraceSwitch.cs60
-rwxr-xr-xmcs/class/System/System.Globalization/Locale.cs22
-rwxr-xr-xmcs/class/System/System.IO/ChangeLog42
-rw-r--r--mcs/class/System/System.IO/ErrorEventArgs.cs39
-rw-r--r--mcs/class/System/System.IO/ErrorEventHandler.cs15
-rw-r--r--mcs/class/System/System.IO/FileSystemEventArgs.cs51
-rw-r--r--mcs/class/System/System.IO/FileSystemEventHandler.cs15
-rw-r--r--mcs/class/System/System.IO/FileSystemWatcher.cs193
-rw-r--r--mcs/class/System/System.IO/IODescriptionAttribute.cs40
-rw-r--r--mcs/class/System/System.IO/InternalBufferOverflowException.cs41
-rwxr-xr-xmcs/class/System/System.IO/MonoIO.cs52
-rwxr-xr-xmcs/class/System/System.IO/MonoIOError.cs1798
-rw-r--r--mcs/class/System/System.IO/NotifyFilters.cs25
-rw-r--r--mcs/class/System/System.IO/RenamedEventArgs.cs44
-rw-r--r--mcs/class/System/System.IO/RenamedEventHandler.cs15
-rw-r--r--mcs/class/System/System.IO/WaitForChangedResult.cs48
-rw-r--r--mcs/class/System/System.IO/WatcherChangeTypes.cs22
-rw-r--r--mcs/class/System/System.Net.Sockets/AddressFamily.cs50
-rw-r--r--mcs/class/System/System.Net.Sockets/ChangeLog107
-rw-r--r--mcs/class/System/System.Net.Sockets/LingerOption.cs42
-rw-r--r--mcs/class/System/System.Net.Sockets/MulticastOption.cs48
-rw-r--r--mcs/class/System/System.Net.Sockets/NetworkStream.cs324
-rw-r--r--mcs/class/System/System.Net.Sockets/ProtocolFamily.cs47
-rw-r--r--mcs/class/System/System.Net.Sockets/ProtocolType.cs81
-rw-r--r--mcs/class/System/System.Net.Sockets/SelectMode.cs33
-rw-r--r--mcs/class/System/System.Net.Sockets/Socket.cs983
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketException.cs41
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketFlags.cs46
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs37
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketOptionName.cs181
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketShutdown.cs33
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketType.cs45
-rwxr-xr-xmcs/class/System/System.Net.Sockets/TcpClient.cs346
-rwxr-xr-xmcs/class/System/System.Net.Sockets/TcpListener.cs171
-rw-r--r--mcs/class/System/System.Net.Sockets/UdpClient.cs269
-rwxr-xr-xmcs/class/System/System.Net/AuthenticationManager.cs24
-rwxr-xr-xmcs/class/System/System.Net/Authorization.cs32
-rw-r--r--mcs/class/System/System.Net/ChangeLog258
-rwxr-xr-xmcs/class/System/System.Net/ConnectionModes.cs37
-rw-r--r--mcs/class/System/System.Net/Cookie.cs276
-rw-r--r--mcs/class/System/System.Net/CookieCollection.cs110
-rw-r--r--mcs/class/System/System.Net/CookieContainer.cs130
-rw-r--r--mcs/class/System/System.Net/CookieException.cs42
-rw-r--r--mcs/class/System/System.Net/CredentialCache.cs170
-rw-r--r--mcs/class/System/System.Net/Dns.cs155
-rw-r--r--mcs/class/System/System.Net/DnsPermission.cs139
-rw-r--r--mcs/class/System/System.Net/DnsPermissionAttribute.cs38
-rwxr-xr-xmcs/class/System/System.Net/EndPoint.cs25
-rw-r--r--mcs/class/System/System.Net/EndpointPermission.cs326
-rw-r--r--mcs/class/System/System.Net/FileWebRequest.cs295
-rw-r--r--mcs/class/System/System.Net/FileWebResponse.cs139
-rw-r--r--mcs/class/System/System.Net/GlobalProxySelection.cs74
-rw-r--r--mcs/class/System/System.Net/HttpContinueDelegate.cs13
-rwxr-xr-xmcs/class/System/System.Net/HttpStatusCode.cs205
-rw-r--r--mcs/class/System/System.Net/HttpVersion.cs22
-rw-r--r--mcs/class/System/System.Net/HttpWebRequest.cs606
-rw-r--r--mcs/class/System/System.Net/HttpWebResponse.cs401
-rwxr-xr-xmcs/class/System/System.Net/IAuthenticationModule.cs4
-rw-r--r--mcs/class/System/System.Net/ICertificatePolicy.cs22
-rwxr-xr-xmcs/class/System/System.Net/ICredentialLookup.cs7
-rwxr-xr-xmcs/class/System/System.Net/IPAddress.cs231
-rwxr-xr-xmcs/class/System/System.Net/IPAdress.cs87
-rwxr-xr-xmcs/class/System/System.Net/IPEndPoint.cs110
-rw-r--r--mcs/class/System/System.Net/IPHostEntry.cs75
-rw-r--r--mcs/class/System/System.Net/IPv6Address.cs278
-rw-r--r--mcs/class/System/System.Net/IWebProxy.cs24
-rw-r--r--mcs/class/System/System.Net/IWebRequestCreate.cs15
-rw-r--r--mcs/class/System/System.Net/MonoHttpDate.cs33
-rwxr-xr-xmcs/class/System/System.Net/NetworkAccess.cs29
-rwxr-xr-xmcs/class/System/System.Net/NetworkCredential.cs63
-rw-r--r--mcs/class/System/System.Net/ProtocolViolationException.cs38
-rwxr-xr-xmcs/class/System/System.Net/ProxyUseType.cs37
-rw-r--r--mcs/class/System/System.Net/ServicePoint.cs105
-rw-r--r--mcs/class/System/System.Net/ServicePointManager.cs169
-rwxr-xr-xmcs/class/System/System.Net/SocketAddress.cs77
-rw-r--r--mcs/class/System/System.Net/SocketPermission.cs339
-rw-r--r--mcs/class/System/System.Net/SocketPermissionAttribute.cs127
-rwxr-xr-xmcs/class/System/System.Net/TransportType.cs41
-rw-r--r--mcs/class/System/System.Net/WebClient.cs123
-rw-r--r--mcs/class/System/System.Net/WebException.cs74
-rwxr-xr-xmcs/class/System/System.Net/WebExceptionStatus.cs85
-rw-r--r--mcs/class/System/System.Net/WebHeaderCollection.cs310
-rw-r--r--mcs/class/System/System.Net/WebProxy.cs194
-rw-r--r--mcs/class/System/System.Net/WebRequest.cs216
-rw-r--r--mcs/class/System/System.Net/WebResponse.cs69
-rwxr-xr-xmcs/class/System/System.Net/WebStatus.cs77
-rw-r--r--mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog8
-rw-r--r--mcs/class/System/System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs154
-rwxr-xr-xmcs/class/System/System.Security.Permissions/ResourcePermissionBase.cs118
-rwxr-xr-xmcs/class/System/System.Security.Permissions/ResourcePermissionBaseEntry.cs42
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/.cvsignore4
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/ChangeLog77
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs92
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs20
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/arch.cs336
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/cache.cs143
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/category.cs637
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/collections.cs138
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/compiler.cs378
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/debug.cs208
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/interpreter.cs953
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/interval.cs305
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/match.cs157
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/notes.txt45
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/parser.cs1120
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/quicksearch.cs108
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/regex.cs414
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/replace.cs181
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/syntax.cs976
-rwxr-xr-xmcs/class/System/System.Threading/ChangeLog9
-rwxr-xr-xmcs/class/System/System.Threading/ThreadExceptionEventArgs.cs27
-rwxr-xr-xmcs/class/System/System.Threading/ThreadExceptionEventHandler.cs14
-rw-r--r--mcs/class/System/System.Timers/ChangeLog10
-rw-r--r--mcs/class/System/System.Timers/ElapsedEventArgs.cs29
-rw-r--r--mcs/class/System/System.Timers/ElapsedEventHandler.cs17
-rw-r--r--mcs/class/System/System.Timers/Timer.cs172
-rw-r--r--mcs/class/System/System.Timers/TimersDescriptionAttribute.cs31
-rw-r--r--mcs/class/System/System.build40
-rw-r--r--mcs/class/System/System/ChangeLog53
-rw-r--r--mcs/class/System/System/TODOAttribute.cs32
-rwxr-xr-xmcs/class/System/System/Uri.cs850
-rw-r--r--mcs/class/System/System/UriBuilder.cs247
-rwxr-xr-xmcs/class/System/System/UriFormatException.cs43
-rwxr-xr-xmcs/class/System/System/UriHostNameType.cs41
-rwxr-xr-xmcs/class/System/System/UriPartial.cs33
-rw-r--r--mcs/class/System/Test/.cvsignore1
-rw-r--r--mcs/class/System/Test/AllTests.cs35
-rwxr-xr-xmcs/class/System/Test/BasicOperationsTest.cs165
-rw-r--r--mcs/class/System/Test/ChangeLog118
-rw-r--r--mcs/class/System/Test/Microsoft.CSharp/AllTests.cs30
-rw-r--r--mcs/class/System/Test/Microsoft.CSharp/ChangeLog19
-rw-r--r--mcs/class/System/Test/System.Collections.Specialized/AllTests.cs31
-rw-r--r--mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs140
-rw-r--r--mcs/class/System/Test/System.Collections.Specialized/ChangeLog11
-rw-r--r--mcs/class/System/Test/System.Collections.Specialized/HybridDictionaryTest.cs57
-rw-r--r--mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs35
-rw-r--r--mcs/class/System/Test/System.Collections.Specialized/StringCollectionTest.cs157
-rw-r--r--mcs/class/System/Test/System.ComponentModel/AllTests.cs33
-rw-r--r--mcs/class/System/Test/System.ComponentModel/ChangeLog6
-rw-r--r--mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs168
-rw-r--r--mcs/class/System/Test/System.Diagnostics/AllTests.cs31
-rw-r--r--mcs/class/System/Test/System.Diagnostics/ChangeLog35
-rw-r--r--mcs/class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs231
-rw-r--r--mcs/class/System/Test/System.Diagnostics/SwitchesTest.cs161
-rw-r--r--mcs/class/System/Test/System.Diagnostics/TraceTest.cs157
-rw-r--r--mcs/class/System/Test/System.Net.Sockets/AllTests.cs33
-rw-r--r--mcs/class/System/Test/System.Net.Sockets/ChangeLog10
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs82
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs85
-rw-r--r--mcs/class/System/Test/System.Net/AllTests.cs47
-rw-r--r--mcs/class/System/Test/System.Net/ChangeLog82
-rw-r--r--mcs/class/System/Test/System.Net/CookieCollectionTest.cs123
-rw-r--r--mcs/class/System/Test/System.Net/CookieTest.cs165
-rw-r--r--mcs/class/System/Test/System.Net/CredentialCacheTest.cs120
-rw-r--r--mcs/class/System/Test/System.Net/DnsTest.cs172
-rw-r--r--mcs/class/System/Test/System.Net/FileWebRequestTest.cs306
-rw-r--r--mcs/class/System/Test/System.Net/HttpWebRequestTest.cs101
-rw-r--r--mcs/class/System/Test/System.Net/IPAddressTest.cs234
-rw-r--r--mcs/class/System/Test/System.Net/IPEndPointTest.cs134
-rw-r--r--mcs/class/System/Test/System.Net/ServicePointManagerTest.cs113
-rw-r--r--mcs/class/System/Test/System.Net/ServicePointTest.cs171
-rw-r--r--mcs/class/System/Test/System.Net/SocketPermissionTest.cs113
-rw-r--r--mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs213
-rw-r--r--mcs/class/System/Test/System.Net/WebProxyTest.cs180
-rw-r--r--mcs/class/System/Test/System.Net/WebRequestTest.cs122
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs26
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs40
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs746
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs98
-rw-r--r--mcs/class/System/Test/System/AllTests.cs29
-rw-r--r--mcs/class/System/Test/System/ChangeLog22
-rw-r--r--mcs/class/System/Test/System/UriBuilderTest.cs147
-rw-r--r--mcs/class/System/Test/System/UriTest.cs544
-rw-r--r--mcs/class/System/Test/System_test.build54
-rw-r--r--mcs/class/System/Test/makefile.gnu30
-rw-r--r--mcs/class/System/Test/system_linux_test.args46
-rw-r--r--mcs/class/System/Test/test-config-file30
-rwxr-xr-xmcs/class/System/list150
-rwxr-xr-xmcs/class/System/list.unix353
-rw-r--r--mcs/class/System/makefile.gnu22
-rw-r--r--mcs/class/corlib/.cvsignore5
-rw-r--r--mcs/class/corlib/ChangeLog233
-rw-r--r--mcs/class/corlib/Linux/ChangeLog27
-rw-r--r--mcs/class/corlib/Linux/Linux.cs484
-rwxr-xr-xmcs/class/corlib/Microsoft.Win32/ChangeLog24
-rw-r--r--mcs/class/corlib/Microsoft.Win32/Registry.cs21
-rw-r--r--mcs/class/corlib/Microsoft.Win32/RegistryHive.cs25
-rw-r--r--mcs/class/corlib/Microsoft.Win32/RegistryKey.cs133
-rw-r--r--mcs/class/corlib/Mono.Math/BigInteger.cs2643
-rw-r--r--mcs/class/corlib/Mono.Security.Cryptography/CryptoTools.cs107
-rw-r--r--mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs384
-rw-r--r--mcs/class/corlib/Mono.Security/ASN1.cs234
-rw-r--r--mcs/class/corlib/Mono.Xml/MiniParser.cs624
-rw-r--r--mcs/class/corlib/Mono/ChangeLog4
-rw-r--r--mcs/class/corlib/Mono/Runtime.cs23
-rw-r--r--mcs/class/corlib/System.Collections/ArrayList.cs1205
-rw-r--r--mcs/class/corlib/System.Collections/BitArray.cs500
-rw-r--r--mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs83
-rw-r--r--mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs94
-rw-r--r--mcs/class/corlib/System.Collections/ChangeLog348
-rw-r--r--mcs/class/corlib/System.Collections/CollectionBase.cs137
-rw-r--r--mcs/class/corlib/System.Collections/Comparer.cs56
-rwxr-xr-xmcs/class/corlib/System.Collections/DictionaryBase.cs372
-rw-r--r--mcs/class/corlib/System.Collections/DictionaryEntry.cs24
-rw-r--r--mcs/class/corlib/System.Collections/Hashtable.cs1047
-rw-r--r--mcs/class/corlib/System.Collections/ICollection.cs24
-rw-r--r--mcs/class/corlib/System.Collections/IComparer.cs19
-rw-r--r--mcs/class/corlib/System.Collections/IDictionary.cs40
-rw-r--r--mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs20
-rw-r--r--mcs/class/corlib/System.Collections/IEnumerable.cs20
-rw-r--r--mcs/class/corlib/System.Collections/IEnumerator.cs22
-rw-r--r--mcs/class/corlib/System.Collections/IHashCodeProvider.cs18
-rw-r--r--mcs/class/corlib/System.Collections/IList.cs40
-rw-r--r--mcs/class/corlib/System.Collections/Queue.cs350
-rw-r--r--mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs45
-rw-r--r--mcs/class/corlib/System.Collections/SortedList.cs1134
-rw-r--r--mcs/class/corlib/System.Collections/Stack.cs321
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs71
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs33
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs33
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/ChangeLog6
-rwxr-xr-xmcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs101
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog29
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs19
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs30
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs13
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs38
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs21
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs38
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs26
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs28
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs88
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs25
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs21
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs31
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs21
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs29
-rw-r--r--mcs/class/corlib/System.Diagnostics/ChangeLog71
-rw-r--r--mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Diagnostics/Debugger.cs94
-rw-r--r--mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs25
-rw-r--r--mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs23
-rw-r--r--mcs/class/corlib/System.Diagnostics/StackFrame.cs321
-rw-r--r--mcs/class/corlib/System.Diagnostics/StackTrace.cs281
-rw-r--r--mcs/class/corlib/System.Globalization/Calendar.cs917
-rw-r--r--mcs/class/corlib/System.Globalization/CalendarWeekRule.cs28
-rw-r--r--mcs/class/corlib/System.Globalization/CalendricalCalculations.cs2120
-rw-r--r--mcs/class/corlib/System.Globalization/ChangeLog147
-rw-r--r--mcs/class/corlib/System.Globalization/CompareInfo.cs437
-rwxr-xr-xmcs/class/corlib/System.Globalization/CompareOptions.cs54
-rw-r--r--mcs/class/corlib/System.Globalization/CultureInfo.cs1411
-rwxr-xr-xmcs/class/corlib/System.Globalization/CultureTypes.cs39
-rw-r--r--mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs609
-rw-r--r--mcs/class/corlib/System.Globalization/DateTimeStyles.cs50
-rwxr-xr-xmcs/class/corlib/System.Globalization/DaylightTime.cs51
-rw-r--r--mcs/class/corlib/System.Globalization/GregorianCalendar.cs471
-rwxr-xr-xmcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs45
-rw-r--r--mcs/class/corlib/System.Globalization/HebrewCalendar.cs879
-rw-r--r--mcs/class/corlib/System.Globalization/HijriCalendar.cs888
-rw-r--r--mcs/class/corlib/System.Globalization/JapaneseCalendar.cs794
-rw-r--r--mcs/class/corlib/System.Globalization/JulianCalendar.cs461
-rw-r--r--mcs/class/corlib/System.Globalization/KoreanCalendar.cs462
-rwxr-xr-xmcs/class/corlib/System.Globalization/Locale.cs22
-rw-r--r--mcs/class/corlib/System.Globalization/NumberFormatInfo.cs676
-rw-r--r--mcs/class/corlib/System.Globalization/NumberStyles.cs46
-rw-r--r--mcs/class/corlib/System.Globalization/RegionInfo.cs1728
-rwxr-xr-xmcs/class/corlib/System.Globalization/SortKey.cs57
-rwxr-xr-xmcs/class/corlib/System.Globalization/StringInfo.cs65
-rw-r--r--mcs/class/corlib/System.Globalization/TaiwanCalendar.cs756
-rwxr-xr-xmcs/class/corlib/System.Globalization/TextElementEnumerator.cs53
-rwxr-xr-xmcs/class/corlib/System.Globalization/TextInfo.cs140
-rw-r--r--mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs463
-rw-r--r--mcs/class/corlib/System.Globalization/UnicodeCategory.cs44
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog46
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs18
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs71
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs37
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs173
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs165
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs51
-rwxr-xr-xmcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs28
-rw-r--r--mcs/class/corlib/System.IO/BinaryReader.cs388
-rwxr-xr-xmcs/class/corlib/System.IO/BinaryWriter.cs207
-rw-r--r--mcs/class/corlib/System.IO/BufferedStream.cs163
-rw-r--r--mcs/class/corlib/System.IO/ChangeLog685
-rw-r--r--mcs/class/corlib/System.IO/CheckArgument.cs166
-rw-r--r--mcs/class/corlib/System.IO/CheckPermission.cs87
-rw-r--r--mcs/class/corlib/System.IO/Directory.cs416
-rw-r--r--mcs/class/corlib/System.IO/DirectoryInfo.cs135
-rwxr-xr-xmcs/class/corlib/System.IO/DirectoryNotFoundException.cs38
-rw-r--r--mcs/class/corlib/System.IO/EndOfStreamException.cs43
-rw-r--r--mcs/class/corlib/System.IO/File.cs297
-rw-r--r--mcs/class/corlib/System.IO/FileAccess.cs34
-rw-r--r--mcs/class/corlib/System.IO/FileAttributes.cs35
-rw-r--r--mcs/class/corlib/System.IO/FileInfo.cs147
-rwxr-xr-xmcs/class/corlib/System.IO/FileLoadException.cs106
-rw-r--r--mcs/class/corlib/System.IO/FileMode.cs45
-rwxr-xr-xmcs/class/corlib/System.IO/FileNotFoundException.cs97
-rw-r--r--mcs/class/corlib/System.IO/FileShare.cs28
-rw-r--r--mcs/class/corlib/System.IO/FileStream.cs487
-rw-r--r--mcs/class/corlib/System.IO/FileSystemInfo.cs149
-rw-r--r--mcs/class/corlib/System.IO/IOException.cs43
-rw-r--r--mcs/class/corlib/System.IO/MemoryStream.cs398
-rwxr-xr-xmcs/class/corlib/System.IO/MonoFileType.cs20
-rw-r--r--mcs/class/corlib/System.IO/MonoIO.cs267
-rw-r--r--mcs/class/corlib/System.IO/MonoIOError.cs1798
-rw-r--r--mcs/class/corlib/System.IO/MonoIOStat.cs22
-rw-r--r--mcs/class/corlib/System.IO/Path.cs277
-rw-r--r--mcs/class/corlib/System.IO/PathTooLongException.cs43
-rw-r--r--mcs/class/corlib/System.IO/SearchPattern.cs169
-rw-r--r--mcs/class/corlib/System.IO/SeekOrigin.cs34
-rwxr-xr-xmcs/class/corlib/System.IO/Stream.cs323
-rw-r--r--mcs/class/corlib/System.IO/StreamReader.cs388
-rw-r--r--mcs/class/corlib/System.IO/StreamWriter.cs219
-rw-r--r--mcs/class/corlib/System.IO/StringReader.cs133
-rw-r--r--mcs/class/corlib/System.IO/StringWriter.cs83
-rw-r--r--mcs/class/corlib/System.IO/TextReader.cs87
-rw-r--r--mcs/class/corlib/System.IO/TextWriter.cs289
-rw-r--r--mcs/class/corlib/System.PAL/IOperatingSystem.cs194
-rw-r--r--mcs/class/corlib/System.PAL/Platform.cs23
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs351
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs16
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ChangeLog560
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs161
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs123
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs188
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/EventBuilder.cs85
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/EventToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs129
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/FieldToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/FlowControl.cs63
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs645
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/Label.cs29
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs178
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/MethodToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs363
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs111
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OpCode.cs129
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs49
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OpCodes.cs486
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OperandType.cs87
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs8
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/PackingSize.cs41
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs102
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs124
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs121
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs126
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/StringToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs748
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs75
-rwxr-xr-xmcs/class/corlib/System.Reflection/AmbiguousMatchException.cs32
-rw-r--r--mcs/class/corlib/System.Reflection/Assembly.cs343
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs39
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs32
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs29
-rwxr-xr-xmcs/class/corlib/System.Reflection/AssemblyName.cs216
-rwxr-xr-xmcs/class/corlib/System.Reflection/AssemblyNameFlags.cs33
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs27
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/Binder.cs254
-rw-r--r--mcs/class/corlib/System.Reflection/BindingFlags.cs92
-rwxr-xr-xmcs/class/corlib/System.Reflection/CallingConventions.cs42
-rw-r--r--mcs/class/corlib/System.Reflection/ChangeLog439
-rw-r--r--mcs/class/corlib/System.Reflection/ConstructorInfo.cs39
-rw-r--r--mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs38
-rw-r--r--mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs29
-rwxr-xr-xmcs/class/corlib/System.Reflection/EventAttributes.cs37
-rwxr-xr-xmcs/class/corlib/System.Reflection/EventInfo.cs101
-rwxr-xr-xmcs/class/corlib/System.Reflection/FieldAttributes.cs102
-rwxr-xr-xmcs/class/corlib/System.Reflection/FieldInfo.cs118
-rwxr-xr-xmcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs25
-rwxr-xr-xmcs/class/corlib/System.Reflection/IReflect.cs44
-rwxr-xr-xmcs/class/corlib/System.Reflection/InterfaceMapping.cs10
-rw-r--r--mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs37
-rw-r--r--mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs37
-rw-r--r--mcs/class/corlib/System.Reflection/MemberFilter.cs7
-rwxr-xr-xmcs/class/corlib/System.Reflection/MemberInfo.cs39
-rwxr-xr-xmcs/class/corlib/System.Reflection/MemberTypes.cs57
-rwxr-xr-xmcs/class/corlib/System.Reflection/MethodAttributes.cs113
-rw-r--r--mcs/class/corlib/System.Reflection/MethodBase.cs126
-rwxr-xr-xmcs/class/corlib/System.Reflection/MethodImplAttributes.cs77
-rw-r--r--mcs/class/corlib/System.Reflection/MethodInfo.cs26
-rw-r--r--mcs/class/corlib/System.Reflection/Missing.cs17
-rw-r--r--mcs/class/corlib/System.Reflection/Module.cs103
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoEvent.cs85
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoField.cs112
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoMethod.cs233
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoProperty.cs198
-rwxr-xr-xmcs/class/corlib/System.Reflection/ParameterAttributes.cs66
-rw-r--r--mcs/class/corlib/System.Reflection/ParameterInfo.cs103
-rwxr-xr-xmcs/class/corlib/System.Reflection/ParameterModifier.cs26
-rwxr-xr-xmcs/class/corlib/System.Reflection/PropertyAttributes.cs54
-rwxr-xr-xmcs/class/corlib/System.Reflection/PropertyInfo.cs69
-rw-r--r--mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs62
-rwxr-xr-xmcs/class/corlib/System.Reflection/ResourceAttributes.cs30
-rwxr-xr-xmcs/class/corlib/System.Reflection/ResourceLocation.cs34
-rwxr-xr-xmcs/class/corlib/System.Reflection/StrongNameKeyPair.cs114
-rw-r--r--mcs/class/corlib/System.Reflection/TargetException.cs37
-rw-r--r--mcs/class/corlib/System.Reflection/TargetInvocationException.cs23
-rw-r--r--mcs/class/corlib/System.Reflection/TargetParameterCountException.cs38
-rwxr-xr-xmcs/class/corlib/System.Reflection/TypeAttributes.cs138
-rwxr-xr-xmcs/class/corlib/System.Reflection/TypeDelegator.cs204
-rw-r--r--mcs/class/corlib/System.Reflection/TypeFilter.cs13
-rw-r--r--mcs/class/corlib/System.Resources/ChangeLog146
-rw-r--r--mcs/class/corlib/System.Resources/IResourceReader.cs20
-rw-r--r--mcs/class/corlib/System.Resources/IResourceWriter.cs25
-rw-r--r--mcs/class/corlib/System.Resources/MissingManifestResourceException.cs42
-rwxr-xr-xmcs/class/corlib/System.Resources/NeutralResourcesLanguageAttribute.cs32
-rw-r--r--mcs/class/corlib/System.Resources/ResourceManager.cs359
-rw-r--r--mcs/class/corlib/System.Resources/ResourceReader.cs401
-rw-r--r--mcs/class/corlib/System.Resources/ResourceSet.cs148
-rw-r--r--mcs/class/corlib/System.Resources/ResourceWriter.cs335
-rw-r--r--mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs27
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CallConvCdecl.cs14
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CallConvFastcall.cs14
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CallConvStdcall.cs14
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CallConvThiscall.cs14
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog66
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CompilationRelaxationsAttribute.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CompilerGlobalScopeAttribute.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/CustomConstantAttribute.cs21
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/DateTimeConstantAttribute.cs27
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/DecimalConstantAttribute.cs35
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/DiscardableAttribute.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/IDispatchConstantAttribute.cs24
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/IUnknownConstantAttribute.cs24
-rwxr-xr-xmcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/IsVolatile.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs23
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs40
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs46
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/RequiredAttributeAttribute.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs39
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices.Expando/Changelog3
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices.Expando/IExpando.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs28
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/BINDPTR.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/COMException.cs39
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs41
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ChangeLog172
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs35
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs24
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs27
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs21
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs34
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs21
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs17
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComMemberType.cs19
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/DESCKIND.cs24
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs21
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs33
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs50
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs17
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs108
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs38
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs15
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs15
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs19
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs22
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs22
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs20
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs20
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs17
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs27
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs556
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs27
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs10
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs19
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs19
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs28
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs23
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TYPEKIND.cs27
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs16
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/UCOMTypeComp.cs20
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/UCOMTypeInfo.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/UCOMTypeLib.cs27
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs170
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs50
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog10
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs24
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs37
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/UrlAttribute.cs53
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.cs113
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelWithProperties.cs30
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog106
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelDataStore.cs51
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs178
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelSinkStackEntry.cs29
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs71
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IChannel.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelDataStore.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiver.cs21
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiverHook.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSender.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSinkBase.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSink.cs29
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkProvider.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkStack.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSink.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.cs15
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.cs23
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSink.cs28
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkProvider.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkStack.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.cs15
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ITransportHeaders.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ServerChannelSinkStack.cs80
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSink.cs61
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSinkProvider.cs48
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/ServerProcessing.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/SinkProviderData.cs45
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Channels/TransportHeaders.cs39
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/.cvsignore1
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/ChangeLog30
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs111
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs105
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextProperty.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/CrossContextDelegate.cs13
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs23
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextPropertyActivator.cs21
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeClientContextSink.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeDynamicSink.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeEnvoySink.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeObjectSink.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeServerContextSink.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog28
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs73
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/ILease.cs27
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/ISponsor.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseSink.cs43
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseState.cs41
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Lifetime/LifetimeServices.cs66
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs105
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs53
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog84
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs50
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/HeaderHandler.cs13
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs21
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs28
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs55
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IRemotingFormatter.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/InternalMessageWrapper.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs43
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MessageSurrogateFilter.cs13
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs145
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.cs109
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs139
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs142
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs251
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/OneWayAttribute.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.cs66
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs150
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerContextTerminatorSink.cs36
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerObjectTerminatorSink.cs43
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs36
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/ChangeLog16
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapAttribute.cs55
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapFieldAttribute.cs48
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapMethodAttribute.cs87
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapOption.cs47
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapParameterAttribute.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapTypeAttribute.cs99
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Metadata/XmlFieldOrderOption.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog16
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/ProxyAttribute.cs48
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs78
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs36
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Services/ChangeLog7
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Services/ITrackingHandler.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Services/TrackingServices.cs32
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ActivatedClientTypeEntry.cs54
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ActivatedServiceTypeEntry.cs50
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/ChangeLog85
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/IChannelInfo.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/IEnvoyInfo.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/IObjectHandle.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/IRemotingTypeInfo.cs64
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/Identity.cs102
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs142
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs52
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs128
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/RemotingException.cs37
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs246
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/RemotingTimeoutException.cs32
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ServerException.cs32
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/SoapServices.cs243
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/TypeEntry.cs32
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/WellKnownClientTypeEntry.cs57
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs29
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/WellKnownServiceTypeEntry.cs64
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs68
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs153
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog21
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs601
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs662
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog20
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs30
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs60
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs41
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs33
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs41
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs61
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs33
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs73
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs89
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs29
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs45
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs73
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs59
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ChangeLog137
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization/Formatter.cs104
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs153
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs142
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs14
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs66
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs16
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs15
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs43
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs40
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs100
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs515
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs40
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization/SerializationException.cs39
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs314
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs62
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs58
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs56
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs96
-rw-r--r--mcs/class/corlib/System.Security.Cryptography.X509Certificates/ASN1.cs234
-rw-r--r--mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog40
-rw-r--r--mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs615
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs134
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs45
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs50
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs54
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs56
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/BigInteger.cs2643
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ChangeLog483
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CipherMode.cs25
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs85
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs352
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptoStream.cs185
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs18
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CryptoTools.cs107
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptographicException.cs48
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs42
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CspParameters.cs57
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs20
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/DES.cs120
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs464
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSA.cs201
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs463
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSAParameters.cs38
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs62
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs62
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs27
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs286
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs205
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs195
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs50
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/KeySizes.cs61
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/KeyedHashAlgorithm.cs73
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MACTripleDES.cs163
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MD5.cs47
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs495
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MaskGenerationMethod.cs23
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MiniParser.cs624
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/PKCS1.cs384
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/PKCS1MaskGenerationMethod.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs23
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/PasswordDeriveBytes.cs170
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RC2.cs62
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RC2CryptoServiceProvider.cs262
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs62
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSA.cs185
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs377
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.cs53
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.cs71
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.cs57
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.cs73
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs58
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureFormatter.cs58
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs32
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs35
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/Rijndael.cs39
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs522
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA1.cs47
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs512
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA1Managed.cs57
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA256.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs302
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA384.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs281
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA512.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs280
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs135
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs568
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs242
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/TripleDES.cs110
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/TripleDESCryptoServiceProvider.cs107
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/bouncycastle.txt8
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ChangeLog98
-rw-r--r--mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs33
-rw-r--r--mcs/class/corlib/System.Security.Permissions/EnvironmentPermission.cs103
-rw-r--r--mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs38
-rw-r--r--mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs53
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs21
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs47
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs411
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs46
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs68
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs15
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs27
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs34
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs84
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs44
-rw-r--r--mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs69
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/PermissionState.cs29
-rw-r--r--mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs60
-rw-r--r--mcs/class/corlib/System.Security.Permissions/PublisherIdentityPermission.cs72
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ReflectionPermission.cs94
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs61
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs42
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs42
-rw-r--r--mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs60
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/SecurityAction.cs57
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs59
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs66
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs216
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs68
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs43
-rw-r--r--mcs/class/corlib/System.Security.Permissions/StrongNameIdentityPermission.cs101
-rw-r--r--mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs56
-rw-r--r--mcs/class/corlib/System.Security.Permissions/StrongNamePublicKeyBlob.cs67
-rw-r--r--mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs48
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs33
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs37
-rw-r--r--mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs40
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermission.cs119
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs40
-rwxr-xr-xmcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs86
-rw-r--r--mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs79
-rw-r--r--mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs80
-rw-r--r--mcs/class/corlib/System.Security.Policy/ChangeLog136
-rw-r--r--mcs/class/corlib/System.Security.Policy/CodeGroup.cs252
-rw-r--r--mcs/class/corlib/System.Security.Policy/Evidence.cs163
-rw-r--r--mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs135
-rw-r--r--mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs106
-rw-r--r--mcs/class/corlib/System.Security.Policy/Hash.cs109
-rw-r--r--mcs/class/corlib/System.Security.Policy/HashMembershipCondition.cs176
-rw-r--r--mcs/class/corlib/System.Security.Policy/IBuiltInEvidence.cs20
-rw-r--r--mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs13
-rw-r--r--mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs17
-rw-r--r--mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs88
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyException.cs42
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyLevel.cs62
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyStatement.cs61
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs17
-rw-r--r--mcs/class/corlib/System.Security.Policy/Publisher.cs85
-rw-r--r--mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs90
-rw-r--r--mcs/class/corlib/System.Security.Policy/StrongName.cs91
-rw-r--r--mcs/class/corlib/System.Security.Policy/Zone.cs90
-rw-r--r--mcs/class/corlib/System.Security.Principal/ChangeLog18
-rw-r--r--mcs/class/corlib/System.Security.Principal/GenericIdentity.cs51
-rw-r--r--mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs38
-rw-r--r--mcs/class/corlib/System.Security.Principal/IIdentity.cs26
-rw-r--r--mcs/class/corlib/System.Security.Principal/IPrincipal.cs20
-rw-r--r--mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs17
-rw-r--r--mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs18
-rw-r--r--mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs23
-rw-r--r--mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs132
-rw-r--r--mcs/class/corlib/System.Security.Principal/WindowsImpersonationContext.cs31
-rwxr-xr-xmcs/class/corlib/System.Security/ChangeLog67
-rwxr-xr-xmcs/class/corlib/System.Security/CodeAccessPermission.cs86
-rw-r--r--mcs/class/corlib/System.Security/IEvidenceFactory.cs15
-rwxr-xr-xmcs/class/corlib/System.Security/IPermission.cs24
-rwxr-xr-xmcs/class/corlib/System.Security/ISecurityEncodable.cs18
-rw-r--r--mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs20
-rwxr-xr-xmcs/class/corlib/System.Security/IStackWalk.cs22
-rw-r--r--mcs/class/corlib/System.Security/NamedPermissionSet.cs66
-rw-r--r--mcs/class/corlib/System.Security/PermissionSet.cs202
-rw-r--r--mcs/class/corlib/System.Security/PolicyLevelType.cs18
-rwxr-xr-xmcs/class/corlib/System.Security/SecurityElement.cs340
-rw-r--r--mcs/class/corlib/System.Security/SecurityException.cs79
-rw-r--r--mcs/class/corlib/System.Security/SecurityManager.cs88
-rw-r--r--mcs/class/corlib/System.Security/SecurityZone.cs20
-rw-r--r--mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs15
-rw-r--r--mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs14
-rw-r--r--mcs/class/corlib/System.Security/VerificationException.cs26
-rw-r--r--mcs/class/corlib/System.Security/XmlSyntaxException.cs27
-rwxr-xr-xmcs/class/corlib/System.Text/ASCIIEncoding.cs282
-rwxr-xr-xmcs/class/corlib/System.Text/ChangeLog221
-rw-r--r--mcs/class/corlib/System.Text/Decoder.cs46
-rw-r--r--mcs/class/corlib/System.Text/Encoder.cs47
-rwxr-xr-xmcs/class/corlib/System.Text/Encoding.cs767
-rw-r--r--mcs/class/corlib/System.Text/Latin1Encoding.cs305
-rw-r--r--mcs/class/corlib/System.Text/StringBuilder.cs619
-rwxr-xr-xmcs/class/corlib/System.Text/UTF7Encoding.cs647
-rwxr-xr-xmcs/class/corlib/System.Text/UTF8Encoding.cs797
-rwxr-xr-xmcs/class/corlib/System.Text/UnicodeEncoding.cs489
-rwxr-xr-xmcs/class/corlib/System.Threading/ApartmentState.cs18
-rwxr-xr-xmcs/class/corlib/System.Threading/AutoResetEvent.cs35
-rw-r--r--mcs/class/corlib/System.Threading/ChangeLog218
-rwxr-xr-xmcs/class/corlib/System.Threading/IOCompletionCallback.cs18
-rwxr-xr-xmcs/class/corlib/System.Threading/Interlocked.cs51
-rwxr-xr-xmcs/class/corlib/System.Threading/LockCookie.cs17
-rwxr-xr-xmcs/class/corlib/System.Threading/ManualResetEvent.cs38
-rwxr-xr-xmcs/class/corlib/System.Threading/Monitor.cs224
-rwxr-xr-xmcs/class/corlib/System.Threading/Mutex.cs49
-rwxr-xr-xmcs/class/corlib/System.Threading/NativeEventCalls.cs28
-rwxr-xr-xmcs/class/corlib/System.Threading/NativeOverlapped.cs27
-rwxr-xr-xmcs/class/corlib/System.Threading/Overlapped.cs92
-rwxr-xr-xmcs/class/corlib/System.Threading/ReaderWriterLock.cs109
-rwxr-xr-xmcs/class/corlib/System.Threading/RegisteredWaitHandle.cs28
-rwxr-xr-xmcs/class/corlib/System.Threading/SynchronizationLockException.cs33
-rwxr-xr-xmcs/class/corlib/System.Threading/Thread.cs436
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadAbortException.cs25
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadInterruptedException.cs33
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadPool.cs259
-rw-r--r--mcs/class/corlib/System.Threading/ThreadPriority.cs41
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadStart.cs14
-rw-r--r--mcs/class/corlib/System.Threading/ThreadState.cs55
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadStateException.cs33
-rwxr-xr-xmcs/class/corlib/System.Threading/Timeout.cs18
-rwxr-xr-xmcs/class/corlib/System.Threading/Timer.cs239
-rwxr-xr-xmcs/class/corlib/System.Threading/TimerCallback.cs14
-rwxr-xr-xmcs/class/corlib/System.Threading/WaitCallback.cs14
-rwxr-xr-xmcs/class/corlib/System.Threading/WaitHandle.cs203
-rwxr-xr-xmcs/class/corlib/System.Threading/WaitOrTimerCallback.cs14
-rw-r--r--mcs/class/corlib/System/Activator.cs240
-rwxr-xr-xmcs/class/corlib/System/AppDomain.cs636
-rwxr-xr-xmcs/class/corlib/System/AppDomainSetup.cs174
-rw-r--r--mcs/class/corlib/System/AppDomainUnloadedException.cs42
-rw-r--r--mcs/class/corlib/System/ApplicationException.cs42
-rwxr-xr-xmcs/class/corlib/System/ArgIterator.cs71
-rw-r--r--mcs/class/corlib/System/ArgumentException.cs78
-rw-r--r--mcs/class/corlib/System/ArgumentNullException.cs38
-rw-r--r--mcs/class/corlib/System/ArgumentOutOfRangeException.cs72
-rw-r--r--mcs/class/corlib/System/ArithmeticException.cs38
-rw-r--r--mcs/class/corlib/System/Array.cs844
-rw-r--r--mcs/class/corlib/System/ArrayTypeMismatchException.cs38
-rwxr-xr-xmcs/class/corlib/System/AssemblyLoadEventArgs.cs34
-rwxr-xr-xmcs/class/corlib/System/AssemblyLoadEventHandler.cs10
-rw-r--r--mcs/class/corlib/System/AsyncCallback.cs13
-rw-r--r--mcs/class/corlib/System/Attribute.cs386
-rw-r--r--mcs/class/corlib/System/AttributeTargets.cs82
-rw-r--r--mcs/class/corlib/System/AttributeUsageAttribute.cs50
-rw-r--r--mcs/class/corlib/System/BadImageFormatException.cs93
-rwxr-xr-xmcs/class/corlib/System/BitConverter.cs270
-rw-r--r--mcs/class/corlib/System/Boolean.cs265
-rwxr-xr-xmcs/class/corlib/System/Buffer.cs70
-rw-r--r--mcs/class/corlib/System/Byte.cs249
-rwxr-xr-xmcs/class/corlib/System/CLSCompliantAttribute.cs35
-rw-r--r--mcs/class/corlib/System/CannotUnloadAppDomainException.cs41
-rw-r--r--mcs/class/corlib/System/ChangeLog2729
-rw-r--r--mcs/class/corlib/System/Char.cs415
-rw-r--r--mcs/class/corlib/System/CharEnumerator.cs90
-rw-r--r--mcs/class/corlib/System/Console.cs320
-rw-r--r--mcs/class/corlib/System/ContextBoundObject.cs25
-rw-r--r--mcs/class/corlib/System/ContextMarshalException.cs42
-rwxr-xr-xmcs/class/corlib/System/ContextStaticAttribute.cs28
-rw-r--r--mcs/class/corlib/System/Convert.cs2463
-rwxr-xr-xmcs/class/corlib/System/CrossAppDomainDelegate.cs10
-rw-r--r--mcs/class/corlib/System/DBNull.cs133
-rw-r--r--mcs/class/corlib/System/DateTime.cs1473
-rw-r--r--mcs/class/corlib/System/Decimal.cs1225
-rw-r--r--mcs/class/corlib/System/DecimalFormatter.cs382
-rw-r--r--mcs/class/corlib/System/Delegate.cs303
-rw-r--r--mcs/class/corlib/System/DelegateSerializationHolder.cs136
-rw-r--r--mcs/class/corlib/System/DivideByZeroException.cs38
-rw-r--r--mcs/class/corlib/System/DllNotFoundException.cs42
-rw-r--r--mcs/class/corlib/System/Double.cs449
-rw-r--r--mcs/class/corlib/System/DuplicateWaitObjectException.cs39
-rw-r--r--mcs/class/corlib/System/EntryPointNotFoundException.cs42
-rw-r--r--mcs/class/corlib/System/Enum.cs600
-rw-r--r--mcs/class/corlib/System/Environment.cs316
-rw-r--r--mcs/class/corlib/System/EventArgs.cs26
-rw-r--r--mcs/class/corlib/System/EventHandler.cs16
-rw-r--r--mcs/class/corlib/System/Exception.cs166
-rw-r--r--mcs/class/corlib/System/ExecutionEngineException.cs31
-rw-r--r--mcs/class/corlib/System/FieldAccessException.cs41
-rwxr-xr-xmcs/class/corlib/System/FlagsAttribute.cs29
-rw-r--r--mcs/class/corlib/System/FormatException.cs39
-rwxr-xr-xmcs/class/corlib/System/GC.cs65
-rwxr-xr-xmcs/class/corlib/System/Guid.cs654
-rw-r--r--mcs/class/corlib/System/IAppDomainSetup.cs37
-rw-r--r--mcs/class/corlib/System/IAsyncResult.cs43
-rw-r--r--mcs/class/corlib/System/ICloneable.cs15
-rw-r--r--mcs/class/corlib/System/IComparable.cs15
-rw-r--r--mcs/class/corlib/System/IConvertible.cs55
-rw-r--r--mcs/class/corlib/System/ICustomFormatter.cs15
-rw-r--r--mcs/class/corlib/System/IDisposable.cs17
-rw-r--r--mcs/class/corlib/System/IFormatProvider.cs15
-rw-r--r--mcs/class/corlib/System/IFormattable.cs15
-rw-r--r--mcs/class/corlib/System/IServiceProvider.cs20
-rw-r--r--mcs/class/corlib/System/IndexOutOfRangeException.cs31
-rw-r--r--mcs/class/corlib/System/Int16.cs235
-rw-r--r--mcs/class/corlib/System/Int32.cs490
-rw-r--r--mcs/class/corlib/System/Int64.cs432
-rw-r--r--mcs/class/corlib/System/IntPtr.cs165
-rw-r--r--mcs/class/corlib/System/IntegerFormatter.cs4041
-rw-r--r--mcs/class/corlib/System/InvalidCastException.cs39
-rw-r--r--mcs/class/corlib/System/InvalidOperationException.cs38
-rw-r--r--mcs/class/corlib/System/InvalidProgramException.cs31
-rw-r--r--mcs/class/corlib/System/LoaderOptimization.cs18
-rw-r--r--mcs/class/corlib/System/LoaderOptimizationAttribute.cs34
-rwxr-xr-xmcs/class/corlib/System/LocalDataStoreSlot.cs26
-rw-r--r--mcs/class/corlib/System/MTAThreadAttribute.cs19
-rw-r--r--mcs/class/corlib/System/MarshalByRefObject.cs47
-rw-r--r--mcs/class/corlib/System/Math.cs375
-rw-r--r--mcs/class/corlib/System/MemberAccessException.cs29
-rw-r--r--mcs/class/corlib/System/MethodAccessException.cs42
-rw-r--r--mcs/class/corlib/System/MissingFieldException.cs56
-rw-r--r--mcs/class/corlib/System/MissingMemberException.cs70
-rw-r--r--mcs/class/corlib/System/MissingMethodException.cs47
-rwxr-xr-xmcs/class/corlib/System/MonoCustomAttrs.cs84
-rw-r--r--mcs/class/corlib/System/MonoDummy.cs20
-rw-r--r--mcs/class/corlib/System/MonoType.cs549
-rw-r--r--mcs/class/corlib/System/MulticastDelegate.cs255
-rw-r--r--mcs/class/corlib/System/MulticastNotSupportedException.cs31
-rwxr-xr-xmcs/class/corlib/System/NonSerializedAttribute.cs18
-rw-r--r--mcs/class/corlib/System/NotFiniteNumberException.cs67
-rwxr-xr-xmcs/class/corlib/System/NotImplementedException.cs39
-rw-r--r--mcs/class/corlib/System/NotSupportedException.cs39
-rw-r--r--mcs/class/corlib/System/NullReferenceException.cs39
-rw-r--r--mcs/class/corlib/System/Object.cs108
-rwxr-xr-xmcs/class/corlib/System/ObjectDisposedException.cs60
-rw-r--r--mcs/class/corlib/System/ObsoleteAttribute.cs48
-rw-r--r--mcs/class/corlib/System/OperatingSystem.cs106
-rw-r--r--mcs/class/corlib/System/OutOfMemoryException.cs39
-rw-r--r--mcs/class/corlib/System/OverflowException.cs39
-rw-r--r--mcs/class/corlib/System/ParamArrayAttribute.cs23
-rw-r--r--mcs/class/corlib/System/PlatformID.cs37
-rw-r--r--mcs/class/corlib/System/PlatformNotSupportedException.cs41
-rw-r--r--mcs/class/corlib/System/Random.cs83
-rw-r--r--mcs/class/corlib/System/RankException.cs40
-rw-r--r--mcs/class/corlib/System/ResolveEventArgs.cs29
-rw-r--r--mcs/class/corlib/System/ResolveEventHandler.cs10
-rw-r--r--mcs/class/corlib/System/RuntimeArgumentHandle.cs16
-rwxr-xr-xmcs/class/corlib/System/RuntimeFieldHandle.cs45
-rwxr-xr-xmcs/class/corlib/System/RuntimeMethodHandle.cs46
-rw-r--r--mcs/class/corlib/System/RuntimeTypeHandle.cs31
-rw-r--r--mcs/class/corlib/System/SByte.cs230
-rw-r--r--mcs/class/corlib/System/STAThreadAttribute.cs19
-rwxr-xr-xmcs/class/corlib/System/SerializableAttribute.cs38
-rw-r--r--mcs/class/corlib/System/Single.cs223
-rw-r--r--mcs/class/corlib/System/StackOverflowException.cs39
-rw-r--r--mcs/class/corlib/System/String.cs1145
-rw-r--r--mcs/class/corlib/System/SystemException.cs39
-rw-r--r--mcs/class/corlib/System/TODO22
-rw-r--r--mcs/class/corlib/System/TODOAttribute.cs37
-rw-r--r--mcs/class/corlib/System/ThreadStaticAttribute.cs20
-rw-r--r--mcs/class/corlib/System/TimeSpan.cs551
-rw-r--r--mcs/class/corlib/System/TimeZone.cs198
-rw-r--r--mcs/class/corlib/System/Type.cs929
-rw-r--r--mcs/class/corlib/System/TypeCode.cs93
-rw-r--r--mcs/class/corlib/System/TypeInitializationException.cs40
-rw-r--r--mcs/class/corlib/System/TypeLoadException.cs73
-rw-r--r--mcs/class/corlib/System/TypeUnloadedException.cs43
-rwxr-xr-xmcs/class/corlib/System/TypedReference.cs71
-rw-r--r--mcs/class/corlib/System/UInt16.cs241
-rw-r--r--mcs/class/corlib/System/UInt32.cs429
-rw-r--r--mcs/class/corlib/System/UInt64.cs359
-rw-r--r--mcs/class/corlib/System/UIntPtr.cs177
-rwxr-xr-xmcs/class/corlib/System/UnauthorizedAccessException.cs39
-rwxr-xr-xmcs/class/corlib/System/UnhandledExceptionEventArgs.cs43
-rwxr-xr-xmcs/class/corlib/System/UnhandledExceptionEventHandler.cs10
-rw-r--r--mcs/class/corlib/System/UnitySerializationHolder.cs82
-rw-r--r--mcs/class/corlib/System/ValueType.cs48
-rw-r--r--mcs/class/corlib/System/Version.cs277
-rw-r--r--mcs/class/corlib/System/Void.cs15
-rwxr-xr-xmcs/class/corlib/System/WeakReference.cs114
-rwxr-xr-xmcs/class/corlib/System/_AppDomain.cs161
-rw-r--r--mcs/class/corlib/Test/.cvsignore6
-rw-r--r--mcs/class/corlib/Test/AllTests.cs42
-rw-r--r--mcs/class/corlib/Test/ChangeLog333
-rw-r--r--mcs/class/corlib/Test/System.Collections/AllTests.cs39
-rw-r--r--mcs/class/corlib/Test/System.Collections/ArrayListTest.cs1557
-rw-r--r--mcs/class/corlib/Test/System.Collections/BitArrayTest.cs290
-rw-r--r--mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs38
-rw-r--r--mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs44
-rw-r--r--mcs/class/corlib/Test/System.Collections/ChangeLog124
-rw-r--r--mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs227
-rw-r--r--mcs/class/corlib/Test/System.Collections/ComparerTest.cs48
-rw-r--r--mcs/class/corlib/Test/System.Collections/HashtableTest.cs741
-rw-r--r--mcs/class/corlib/Test/System.Collections/QueueTest.cs188
-rw-r--r--mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs39
-rwxr-xr-xmcs/class/corlib/Test/System.Collections/SortedListTest.cs612
-rw-r--r--mcs/class/corlib/Test/System.Collections/StackTest.cs233
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/AllTests.cs32
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/ChangeLog12
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs61
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs304
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs76
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs53
-rw-r--r--mcs/class/corlib/Test/System.Globalization/AllTests.cs28
-rw-r--r--mcs/class/corlib/Test/System.Globalization/CalendarTest.cs593
-rw-r--r--mcs/class/corlib/Test/System.Globalization/ChangeLog3
-rw-r--r--mcs/class/corlib/Test/System.IO/AllTests.cs36
-rw-r--r--mcs/class/corlib/Test/System.IO/BinaryReaderTest.cs342
-rw-r--r--mcs/class/corlib/Test/System.IO/ChangeLog145
-rw-r--r--mcs/class/corlib/Test/System.IO/FileTest.cs427
-rw-r--r--mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs145
-rw-r--r--mcs/class/corlib/Test/System.IO/PathTest.cs428
-rw-r--r--mcs/class/corlib/Test/System.IO/StreamReaderTest.cs551
-rw-r--r--mcs/class/corlib/Test/System.IO/StreamWriterTest.cs343
-rw-r--r--mcs/class/corlib/Test/System.IO/StringReaderTest.cs123
-rw-r--r--mcs/class/corlib/Test/System.IO/StringWriterTest.cs46
-rw-r--r--mcs/class/corlib/Test/System.Reflection/AllTests.cs53
-rw-r--r--mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs130
-rw-r--r--mcs/class/corlib/Test/System.Reflection/ChangeLog19
-rw-r--r--mcs/class/corlib/Test/System.Reflection/StrongNameKeyPairTest.cs158
-rw-r--r--mcs/class/corlib/Test/System.Resources/AllTests.cs28
-rw-r--r--mcs/class/corlib/Test/System.Resources/ChangeLog30
-rw-r--r--mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs134
-rw-r--r--mcs/class/corlib/Test/System.Runtime.CompilerServices/AllTests.cs29
-rw-r--r--mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog10
-rw-r--r--mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs71
-rw-r--r--mcs/class/corlib/Test/System.Runtime.Serialization/AllTests.cs29
-rw-r--r--mcs/class/corlib/Test/System.Runtime.Serialization/ChangeLog14
-rw-r--r--mcs/class/corlib/Test/System.Runtime.Serialization/FormatterServicesTests.cs127
-rwxr-xr-xmcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs82
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/AllTests.cs54
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog21
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs786
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs198
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Cryptography/AllTests2.cs152
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs40
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog170
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs291
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/DSACryptoServiceProviderTest.cs389
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureDeformatterTest.cs173
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureFormatterTest.cs171
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/DSATest.cs152
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Cryptography/FromBase64Transform.cs61
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs274
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTest.cs139
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/KeyedHashAlgorithmTest.cs98
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/MACTripleDESTest.cs243
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/MD5Test.cs60
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/PKCS1MaskGenerationMethodTest.cs126
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/PasswordDeriveBytesTest.cs228
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RC2Test.cs115
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs42
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs503
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatterTest.cs185
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeFormatterTest.cs134
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatterTest.cs163
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatterTest.cs117
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs291
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs331
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RSATest.cs223
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RandomNumberGeneratorTest.cs171
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RijndaelManagedTest.cs175
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RijndaelTest.cs126
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs82
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA1Test.cs201
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA256ManagedTest.cs59
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA256Test.cs198
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA384ManagedTest.cs60
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA384Test.cs204
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA512ManagedTest.cs59
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SHA512Test.cs210
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs296
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs5782
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs28
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/ChangeLog28
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs287
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/StrongNamePublicKeyBlobTest.cs69
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/AllTests.cs31
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/ChangeLog36
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs232
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs265
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs115
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs98
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs105
-rw-r--r--mcs/class/corlib/Test/System.Security/AllTests.cs27
-rw-r--r--mcs/class/corlib/Test/System.Security/ChangeLog14
-rw-r--r--mcs/class/corlib/Test/System.Security/SecurityElementTest.cs216
-rwxr-xr-xmcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs169
-rw-r--r--mcs/class/corlib/Test/System.Text/AllTests.cs31
-rw-r--r--mcs/class/corlib/Test/System.Text/ChangeLog21
-rw-r--r--mcs/class/corlib/Test/System.Text/StringBuilderTest.cs229
-rw-r--r--mcs/class/corlib/Test/System.Threading/AllTests.cs30
-rw-r--r--mcs/class/corlib/Test/System.Threading/ChangeLog17
-rw-r--r--mcs/class/corlib/Test/System.Threading/MutexTest.cs164
-rw-r--r--mcs/class/corlib/Test/System.Threading/ThreadTest.cs369
-rw-r--r--mcs/class/corlib/Test/System/AllTests.cs62
-rw-r--r--mcs/class/corlib/Test/System/ArrayTest.cs1988
-rwxr-xr-xmcs/class/corlib/Test/System/AttributeTest.cs157
-rwxr-xr-xmcs/class/corlib/Test/System/BitConverterTest.cs536
-rw-r--r--mcs/class/corlib/Test/System/BooleanTest.cs106
-rw-r--r--mcs/class/corlib/Test/System/BufferTest.cs162
-rw-r--r--mcs/class/corlib/Test/System/ByteTest.cs182
-rw-r--r--mcs/class/corlib/Test/System/ChangeLog596
-rwxr-xr-xmcs/class/corlib/Test/System/CharEnumeratorTest.cs116
-rw-r--r--mcs/class/corlib/Test/System/CharTest.cs493
-rw-r--r--mcs/class/corlib/Test/System/ConsoleTest.cs287
-rwxr-xr-xmcs/class/corlib/Test/System/ConvertTest.cs2747
-rwxr-xr-xmcs/class/corlib/Test/System/DateTimeTest.cs400
-rw-r--r--mcs/class/corlib/Test/System/DecimalTest.cs883
-rw-r--r--mcs/class/corlib/Test/System/DecimalTest2.cs3125
-rw-r--r--mcs/class/corlib/Test/System/DoubleTest.cs194
-rw-r--r--mcs/class/corlib/Test/System/EnumTest.cs760
-rw-r--r--mcs/class/corlib/Test/System/ExceptionTest.cs197
-rwxr-xr-xmcs/class/corlib/Test/System/GuidTest.cs240
-rw-r--r--mcs/class/corlib/Test/System/Int16Test.cs186
-rw-r--r--mcs/class/corlib/Test/System/Int32Test.cs229
-rw-r--r--mcs/class/corlib/Test/System/Int64Test.cs352
-rw-r--r--mcs/class/corlib/Test/System/IntegerFormatterTest.cs2007
-rwxr-xr-xmcs/class/corlib/Test/System/MathTest.cs607
-rw-r--r--mcs/class/corlib/Test/System/MulticastDelegate.cs110
-rw-r--r--mcs/class/corlib/Test/System/ObjectTest.cs114
-rw-r--r--mcs/class/corlib/Test/System/RandomTest.cs83
-rw-r--r--mcs/class/corlib/Test/System/ResolveEventArgsTest.cs23
-rw-r--r--mcs/class/corlib/Test/System/SByteTest.cs173
-rw-r--r--mcs/class/corlib/Test/System/StringTest.cs1079
-rwxr-xr-xmcs/class/corlib/Test/System/TimeSpanTest.cs258
-rw-r--r--mcs/class/corlib/Test/System/TimeZoneTest.cs66
-rw-r--r--mcs/class/corlib/Test/System/UInt16Test.cs187
-rw-r--r--mcs/class/corlib/Test/System/UInt32Test.cs229
-rw-r--r--mcs/class/corlib/Test/System/UInt64Test.cs197
-rw-r--r--mcs/class/corlib/Test/System/VersionTest.cs236
-rw-r--r--mcs/class/corlib/Test/corlib_linux_test.args135
-rwxr-xr-xmcs/class/corlib/Test/corlib_test.args119
-rw-r--r--mcs/class/corlib/Test/corlib_test.build53
-rw-r--r--mcs/class/corlib/Test/makefile.gnu26
-rw-r--r--mcs/class/corlib/Test/resources/AFile.txt39
-rw-r--r--mcs/class/corlib/Test/resources/Empty.resources0
-rw-r--r--mcs/class/corlib/Test/resources/MyResources.resourcesbin0 -> 412 bytes
-rwxr-xr-xmcs/class/corlib/Test/run_test.sh19
-rwxr-xr-xmcs/class/corlib/Unix/Errno.cs139
-rw-r--r--mcs/class/corlib/Unix/Wrapper.cs237
-rw-r--r--mcs/class/corlib/Unix/common.src1
-rw-r--r--mcs/class/corlib/Unix/mono.src0
-rw-r--r--mcs/class/corlib/Unix/windows.src0
-rw-r--r--mcs/class/corlib/Windows/Windows.cs694
-rw-r--r--mcs/class/corlib/corlib.build156
-rw-r--r--mcs/class/corlib/makefile.gnu18
-rwxr-xr-xmcs/class/corlib/unix.args786
-rw-r--r--mcs/class/executable.make28
-rw-r--r--mcs/class/lib/.cvsignore2
-rw-r--r--mcs/class/library.build87
-rw-r--r--mcs/class/library.make61
-rw-r--r--mcs/class/makefile15
-rw-r--r--mcs/class/makefile.gnu50
-rw-r--r--mcs/class/notes/BitVecto32.txt6
4324 files changed, 625465 insertions, 145 deletions
diff --git a/mcs/class/.cvsignore b/mcs/class/.cvsignore
new file mode 100644
index 00000000000..a65b41774ad
--- /dev/null
+++ b/mcs/class/.cvsignore
@@ -0,0 +1 @@
+lib
diff --git a/mcs/class/Accessibility/.cvsignore b/mcs/class/Accessibility/.cvsignore
new file mode 100644
index 00000000000..8744e149aac
--- /dev/null
+++ b/mcs/class/Accessibility/.cvsignore
@@ -0,0 +1,3 @@
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Accessibility/Accessibility.build b/mcs/class/Accessibility/Accessibility.build
new file mode 100644
index 00000000000..4feba5e7a9d
--- /dev/null
+++ b/mcs/class/Accessibility/Accessibility.build
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Accessibility.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/Accessibility.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+
+ <!-- cor compare dies with these currently -->
+ <!--arg value="/nostdlib"/--> <!-- don't reference mscorlib -->
+ <!--arg value="/r:corlib.dll"/-->
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ <copy file="../lib/Accessibility.dll" tofile="Test/Accessibility.dll"/>
+<!-- TODO: missing tests & buildfile
+ <nant basedir="Test" target="build"/>
+-->
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/Accessibility.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Accessibility/Accessibility/.cvsignore b/mcs/class/Accessibility/Accessibility/.cvsignore
new file mode 100644
index 00000000000..8744e149aac
--- /dev/null
+++ b/mcs/class/Accessibility/Accessibility/.cvsignore
@@ -0,0 +1,3 @@
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Accessibility/Accessibility/IAccessible.cs b/mcs/class/Accessibility/Accessibility/IAccessible.cs
new file mode 100644
index 00000000000..955a985339a
--- /dev/null
+++ b/mcs/class/Accessibility/Accessibility/IAccessible.cs
@@ -0,0 +1,35 @@
+//
+// IAccessible.cs: Interface for accessible elements
+//
+// What a horrible interface.
+//
+
+namespace Accessibility {
+
+ public interface IAccessible {
+
+ void accDoDefaultAction (object childID);
+ object accHitTest (int xLeft, int yTop);
+ void accLocation (out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID);
+ object accNavigate(int navDir, object childID);
+ void accSelect(int flagsSelect, object childID);
+ object get_accChild(object childID);
+ string get_accDefaultAction(object childID);
+ string get_accDescription(object childID);
+ string get_accHelp(object childID);
+ int get_accHelpTopic(out string pszHelpFile,object childID);
+ string get_accKeyboardShortcut(object childID);
+ string get_accName(object childID);
+ object get_accRole(object childID);
+ object get_accState(object childID);
+ string get_accValue(object childID);
+ void set_accName(object childID, string newName);
+ void set_accValue(object childID, string newValue);
+
+
+ int accChildCount { get; }
+ object accFocus { get; }
+ object accParent { get;}
+ object accSelection { get; }
+ }
+}
diff --git a/mcs/class/Accessibility/Accessibility/IAccessibleHandler.cs b/mcs/class/Accessibility/Accessibility/IAccessibleHandler.cs
new file mode 100644
index 00000000000..b99b024bbee
--- /dev/null
+++ b/mcs/class/Accessibility/Accessibility/IAccessibleHandler.cs
@@ -0,0 +1,3 @@
+interface IAccessibleHandler {
+ // Opaque for now.
+}
diff --git a/mcs/class/Accessibility/ChangeLog b/mcs/class/Accessibility/ChangeLog
new file mode 100644
index 00000000000..195cb348b2b
--- /dev/null
+++ b/mcs/class/Accessibility/ChangeLog
@@ -0,0 +1,3 @@
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * updated .build file to correctly build with Nant
diff --git a/mcs/class/Accessibility/list.unix b/mcs/class/Accessibility/list.unix
new file mode 100644
index 00000000000..e2cdb79daa0
--- /dev/null
+++ b/mcs/class/Accessibility/list.unix
@@ -0,0 +1,2 @@
+Accessibility/IAccessible.cs
+Accessibility/IAccessibleHandler.cs
diff --git a/mcs/class/Accessibility/makefile.gnu b/mcs/class/Accessibility/makefile.gnu
new file mode 100644
index 00000000000..5c854c37523
--- /dev/null
+++ b/mcs/class/Accessibility/makefile.gnu
@@ -0,0 +1,16 @@
+topdir = ../..
+
+TEST_DIR= Test
+LIBRARY = $(topdir)/class/lib/Accessibility.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test*
+
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/ChangeLog b/mcs/class/ChangeLog
new file mode 100644
index 00000000000..3d28c411800
--- /dev/null
+++ b/mcs/class/ChangeLog
@@ -0,0 +1,56 @@
+2003-01-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * library.build: added System.Security to build, test and clean.
+ There's no makefile.gnu yet for this assembly.
+
+2003-01-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * makefile.gnu: added Mono.Data.DB2Client directory.
+
+2003-01-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * System.Web.Mobile : Added new directory
+
+2002-12-11 Jeroen Janssen <japj@darius.demon.nl>
+
+ * enabled building Mono.Directory.LDAP and
+ System.Design in .build file
+
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * updated .build file(s) to correctly contain required buildfile
+ attribute for nant
+
+2002-12-09 Daniel Morgan <danmorg@sc.rr.com>
+
+ * library.build: add Mono.GetOptions to windows build
+
+ * Mono.GetOptions/Mono.GetOptions.build: add file
+ for windows build
+
+2002-12-08 Radek Doulik <rodo@ximian.com>
+
+ * makefile.gnu (DIRS): place System.Data before Mono.GetOptions,
+ Mono.GetOptions references System.Data
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * library.build: Added Cscompmgd to the build
+
+2002-12-02 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * mcs/class: Added assembly directory System.ServiceProcess
+
+2002-11-26 Daniel morgan <danmorg@sc.rr.com>
+
+ * makefile.gnu: add Mono.Data.PostgreSqlClient
+ to Linux build
+
+ * library.build: add Mono.Data.PostgreSqlClient
+ to Windows build
+
+2002-11-20 Nick Drochak <ndrochak@gol.com>
+
+ * library.make: for .response allow white space at the end of
+ the line
+
diff --git a/mcs/class/Cscompmgd/.cvsignore b/mcs/class/Cscompmgd/.cvsignore
new file mode 100644
index 00000000000..d40f328c675
--- /dev/null
+++ b/mcs/class/Cscompmgd/.cvsignore
@@ -0,0 +1,3 @@
+.response
+.makefrag
+library-deps.stamp
diff --git a/mcs/class/Cscompmgd/ChangeLog b/mcs/class/Cscompmgd/ChangeLog
new file mode 100644
index 00000000000..87593f57f69
--- /dev/null
+++ b/mcs/class/Cscompmgd/ChangeLog
@@ -0,0 +1,3 @@
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * Cscompmgd.build: Added file \ No newline at end of file
diff --git a/mcs/class/Cscompmgd/Cscompmgd.build b/mcs/class/Cscompmgd/Cscompmgd.build
new file mode 100644
index 00000000000..c148dc31d07
--- /dev/null
+++ b/mcs/class/Cscompmgd/Cscompmgd.build
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Cscompmgd.dll -->
+
+<project name="Cscompmgd" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Cscompmgd.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ </references>
+
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Cscompmgd.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Cscompmgd/Microsoft.CSharp/ChangeLog b/mcs/class/Cscompmgd/Microsoft.CSharp/ChangeLog
new file mode 100644
index 00000000000..74e72e61c18
--- /dev/null
+++ b/mcs/class/Cscompmgd/Microsoft.CSharp/ChangeLog
@@ -0,0 +1,56 @@
+2002-12-15 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs ErrorLevel.cs: Moved ErrorLevel enum into its own file
+
+2002-12-12 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: Partially implemented bugreport option, also only allow valid options now
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: Moved StreamWriter creation into a try block
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: Source text is now implemented so you can pass strings of C# code to be compiled
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * TODOAttribute.cs: Added file
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs CompilerError.cs: Moved file
+
+2002-11-11 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Reordered ErrorLevel enumeration to match MS values
+
+2002-11-11 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Error levels are now lower case to match MS spec
+
+2002-11-9 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: ToString() Do not show source file info if there was no source file in the error message
+
+2002-11-6 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: No longers waits untill mcs is finished running to read output, this should prevent
+ crashes from buffers filling up.
+
+2002-11-4 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs CompilerError.cs: Fixed (C) in header
+
+2002-11-4 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: Added file
+
+2002-11-4 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Changed FileName property to the correct name 'SourceFile'
+
+2002-10-30 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Added class
diff --git a/mcs/class/Cscompmgd/Microsoft.CSharp/Compiler.cs b/mcs/class/Cscompmgd/Microsoft.CSharp/Compiler.cs
new file mode 100644
index 00000000000..70ed55888bd
--- /dev/null
+++ b/mcs/class/Cscompmgd/Microsoft.CSharp/Compiler.cs
@@ -0,0 +1,266 @@
+// Microsoft.CSharp.Compiler
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+
+namespace Microsoft.CSharp {
+
+ public class Compiler {
+
+ public Compiler()
+ {
+ }
+
+ [MonoTODO("Have not implemented bugreports")]
+ public static CompilerError[] Compile(string[] sourceTexts,
+ string[] sourceTextNames, string target, string[] imports,
+ IDictionary options)
+ {
+ VerifyArgs (sourceTexts, sourceTextNames, target);
+
+ string[] temp_cs_files;
+ CompilerError[] errors;
+ string bugreport_path = null;
+ StreamWriter bug_report = null;
+
+ temp_cs_files = CreateCsFiles (sourceTexts, sourceTextNames);
+
+ if (options != null)
+ bugreport_path = (string)options["bugreport"];
+
+ if (bugreport_path != null) {
+ bug_report = CreateBugReport (sourceTexts, sourceTextNames, bugreport_path);
+ }
+
+ try {
+ errors = CompileFiles (temp_cs_files, target, imports, options, bug_report);
+ } catch {
+ throw;
+ } finally {
+ foreach (string temp_file in temp_cs_files) {
+ FileInfo file = new FileInfo (temp_file);
+ file.Delete ();
+ }
+ if (bug_report != null)
+ bug_report.Close ();
+ }
+
+ return errors;
+ }
+
+ //
+ // Private Methods
+ //
+
+ private static CompilerError[] CompileFiles (string[] cs_files,
+ string target, string[] imports, IDictionary options, StreamWriter bug_report)
+ {
+ ArrayList error_list = new ArrayList ();
+ Process mcs = new Process ();
+ string mcs_output;
+ string[] mcs_output_lines;
+
+ mcs.StartInfo.FileName = "mcs";
+ mcs.StartInfo.Arguments = BuildArgs (cs_files,
+ target, imports, options);
+ mcs.StartInfo.CreateNoWindow = true;
+ mcs.StartInfo.UseShellExecute = false;
+ mcs.StartInfo.RedirectStandardOutput = true;
+
+ try {
+ mcs.Start ();
+ mcs_output = mcs.StandardOutput.ReadToEnd();
+ mcs.WaitForExit ();
+ } finally {
+ mcs.Close ();
+ }
+
+ mcs_output_lines = mcs_output.Split (
+ System.Environment.NewLine.ToCharArray ());
+ foreach (string error_line in mcs_output_lines) {
+ CompilerError error = CreateErrorFromString (error_line);
+ if (null != error)
+ error_list.Add (error);
+ }
+
+ if (bug_report != null) {
+ bug_report.WriteLine ("### Compiler Output");
+ bug_report.Write (mcs_output);
+ }
+
+ return (CompilerError[])error_list.ToArray (typeof(CompilerError));
+ }
+
+ /// <summary>
+ /// Converts an error string into a CompilerError object
+ /// Return null if the line was not an error string
+ /// </summary>
+ private static CompilerError CreateErrorFromString(string error_string)
+ {
+ CompilerError error = new CompilerError();
+ Regex reg = new Regex (@"^((?<file>.*)\((?<line>\d*)(,(?<column>\d*))?\)\s){0,}(?<level>\w+)\sCS(?<number>\d*):\s(?<message>.*)",
+ RegexOptions.Compiled | RegexOptions.ExplicitCapture);
+
+ Match match = reg.Match (error_string);
+
+ if (!match.Success)
+ return null;
+
+ if (String.Empty != match.Result ("${file}"))
+ error.SourceFile = match.Result ("${file}");
+ if (String.Empty != match.Result ("${line}"))
+ error.SourceLine = Int32.Parse (match.Result ("${line}"));
+ if (String.Empty != match.Result ("${column}"))
+ error.SourceColumn = Int32.Parse (match.Result ("${column}"));
+ error.ErrorLevel = (ErrorLevel)Enum.Parse (typeof(ErrorLevel),
+ match.Result ("${level}"), true);
+ error.ErrorNumber = Int32.Parse (match.Result ("${number}"));
+ error.ErrorMessage = match.Result ("${message}");
+
+ return error;
+ }
+
+ private static string[] CreateCsFiles (string[] source_text, string[] source_name)
+ {
+ ArrayList temp_file_list = new ArrayList ();
+
+ for (int i=0; i<source_text.Length; i++) {
+ string temp_path = Path.GetTempFileName ();
+ StreamWriter writer = null;
+ try {
+ writer = new StreamWriter (temp_path);
+ writer.WriteLine (String.Format ("#line 1 \"{0}\"",
+ source_name[i]));
+ writer.Write (source_text[i]);
+ } catch {
+ } finally {
+ if (writer != null)
+ writer.Close ();
+ }
+ temp_file_list.Add (temp_path);
+ }
+
+ return (string[])temp_file_list.ToArray (typeof(string));
+ }
+
+ private static string BuildArgs(string[] source_files,
+ string target, string[] imports, IDictionary options)
+ {
+ StringBuilder args = new StringBuilder ();
+
+ args.AppendFormat ("/out:{0} ", target);
+
+ if (null != imports) {
+ foreach (string import in imports)
+ args.AppendFormat ("/r:{0} ", import);
+ }
+
+ if (null != options) {
+ foreach (object option in options.Keys) {
+ object value = options[option];
+ if (!ValidOption ((string)option))
+ continue;
+ args.AppendFormat ("{0} ", OptionString (option,value));
+ }
+ }
+
+ foreach (string source in source_files)
+ args.AppendFormat ("{0} ", source);
+
+ return args.ToString ();
+ }
+
+ private static string OptionString(object option, object value)
+ {
+ if (null != value)
+ return String.Format ("/{0}:{1}", option, value);
+
+ return String.Format("/{0}", option);
+ }
+
+ private static void VerifyArgs (string[] sourceTexts,
+ string[] sourceTextNames, string target)
+ {
+ if (null == sourceTexts)
+ throw new ArgumentNullException ("sourceTexts");
+ if (null == sourceTextNames)
+ throw new ArgumentNullException ("sourceTextNames");
+ if (null == target)
+ throw new ArgumentNullException ("target");
+
+ if (sourceTexts.Length <= 0 || sourceTextNames.Length <= 0)
+ throw new IndexOutOfRangeException ();
+ }
+
+ private static StreamWriter CreateBugReport (string[] source_texts,
+ string[] source_names, string path)
+ {
+ StreamWriter bug_report = null;
+
+ try {
+ bug_report = new StreamWriter (path);
+ bug_report.WriteLine ("### C# Compiler Defect Report," +
+ " created {0}", DateTime.Now);
+ // Compiler Version
+ // Runtime
+ // Operating System
+ // Username
+ for (int i=0; i<source_texts.Length; i++) {
+ bug_report.WriteLine ("### Source file: '{0}'",
+ source_names[i]);
+ bug_report.Write (source_texts[i]);
+ }
+ } catch {
+ if (bug_report != null)
+ bug_report.Close ();
+ throw;
+ }
+
+ return bug_report;
+ }
+
+
+ private static bool ValidOption (string option)
+ {
+ switch (option) {
+ case "addmodule":
+ case "baseaddress":
+ case "checked":
+ case "d":
+ case "debug":
+ case "doc":
+ case "filealign":
+ case "incr":
+ case "lib":
+ case "linkres":
+ case "m":
+ case "nostdlib":
+ case "nowarn":
+ case "o":
+ case "r":
+ case "res":
+ case "target":
+ case "unsafe":
+ case "w":
+ case "warnaserror":
+ case "win32icon":
+ case "win32res":
+ return true;
+ }
+ return false;
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Cscompmgd/Microsoft.CSharp/CompilerError.cs b/mcs/class/Cscompmgd/Microsoft.CSharp/CompilerError.cs
new file mode 100644
index 00000000000..bafbf47b0ad
--- /dev/null
+++ b/mcs/class/Cscompmgd/Microsoft.CSharp/CompilerError.cs
@@ -0,0 +1,108 @@
+// Microsoft.CSharp.CompilerError
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+//
+
+using System;
+using System.Text;
+
+namespace Microsoft.CSharp {
+
+ public class CompilerError {
+
+ private ErrorLevel level = ErrorLevel.None;
+ private string message = null;
+ private string file = null;
+ private int number = 0;
+ private int column = 0;
+ private int line = 0;
+
+ public CompilerError()
+ {
+ }
+
+ ~CompilerError()
+ {
+ message = null;
+ file = null;
+ }
+
+
+ //
+ // Public Properties
+ //
+
+ public ErrorLevel ErrorLevel {
+ get { return level; }
+ set { level = value; }
+ }
+
+ public string ErrorMessage {
+ get {
+ return (null == message ? String.Empty : message);
+ }
+ set {
+ message = value;
+ }
+ }
+
+ public int ErrorNumber {
+ get { return number; }
+ set { number = value; }
+ }
+
+ public int SourceColumn {
+ get { return column; }
+ set { column = value; }
+ }
+
+ public string SourceFile {
+ get {
+ return (null == file ? String.Empty : file);
+ }
+ set { file = value; }
+ }
+
+ public int SourceLine {
+ get { return line; }
+ set { line = value; }
+ }
+
+ //
+ // Public Methods
+ //
+
+ /// <summary>
+ /// Error message in form:
+ /// filename(line,column): AAAAA CSXXX: message
+ /// </summary>
+ public override string ToString()
+ {
+ StringBuilder builder = new StringBuilder ();
+
+ if (String.Empty != SourceFile)
+ builder.AppendFormat ("{0}({1},{2}) ",
+ SourceFile, SourceLine, SourceColumn);
+ builder.AppendFormat ("{0} CS{1}: {2}",
+ ErrorLevelString, ErrorNumber, ErrorMessage);
+
+ return builder.ToString ();
+ }
+
+ //
+ // Private Properties
+ //
+
+ private string ErrorLevelString {
+ get {
+ if (ErrorLevel.FatalError == ErrorLevel)
+ return "Error Fatal";
+ return ErrorLevel.ToString ().ToLower ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/Cscompmgd/Microsoft.CSharp/ErrorLevel.cs b/mcs/class/Cscompmgd/Microsoft.CSharp/ErrorLevel.cs
new file mode 100644
index 00000000000..39b622a09ce
--- /dev/null
+++ b/mcs/class/Cscompmgd/Microsoft.CSharp/ErrorLevel.cs
@@ -0,0 +1,17 @@
+// Microsoft.CSharp.ErrorLevel
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+//
+
+namespace Microsoft.CSharp {
+
+ public enum ErrorLevel {
+ None,
+ Warning,
+ Error,
+ FatalError,
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Cscompmgd/Microsoft.CSharp/TODOAttribute.cs b/mcs/class/Cscompmgd/Microsoft.CSharp/TODOAttribute.cs
new file mode 100644
index 00000000000..c35f15f75e3
--- /dev/null
+++ b/mcs/class/Cscompmgd/Microsoft.CSharp/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Microsoft.CSharp {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Cscompmgd/list.unix b/mcs/class/Cscompmgd/list.unix
new file mode 100644
index 00000000000..33ef0c07183
--- /dev/null
+++ b/mcs/class/Cscompmgd/list.unix
@@ -0,0 +1,4 @@
+Microsoft.CSharp/Compiler.cs
+Microsoft.CSharp/CompilerError.cs
+Microsoft.CSharp/ErrorLevel.cs
+Microsoft.CSharp/TODOAttribute.cs
diff --git a/mcs/class/Cscompmgd/makefile.gnu b/mcs/class/Cscompmgd/makefile.gnu
new file mode 100644
index 00000000000..ba44c9593ce
--- /dev/null
+++ b/mcs/class/Cscompmgd/makefile.gnu
@@ -0,0 +1,15 @@
+topdir = ../..
+
+TEST_DIR= Test
+LIBRARY = $(topdir)/class/lib/Cscompmgd.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/.cvsignore b/mcs/class/I18N/.cvsignore
new file mode 100644
index 00000000000..1d613ca39bc
--- /dev/null
+++ b/mcs/class/I18N/.cvsignore
@@ -0,0 +1,5 @@
+Makefile
+Makefile.in
+.deps
+*.dll
+I18N-handlers.def
diff --git a/mcs/class/I18N/CJK/.cvsignore b/mcs/class/I18N/CJK/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/I18N/CJK/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/I18N/CJK/CP932.cs b/mcs/class/I18N/CJK/CP932.cs
new file mode 100644
index 00000000000..1a3044a412e
--- /dev/null
+++ b/mcs/class/I18N/CJK/CP932.cs
@@ -0,0 +1,849 @@
+/*
+ * CP932.cs - Japanese (Shift-JIS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.CJK
+{
+
+using System;
+using System.Text;
+using I18N.Common;
+
+public unsafe class CP932 : Encoding
+{
+ // Magic number used by Windows for the Shift-JIS code page.
+ private const int SHIFTJIS_CODE_PAGE = 932;
+
+ // Internal state.
+ private JISConvert convert;
+
+ // Constructor.
+ public CP932() : base(SHIFTJIS_CODE_PAGE)
+ {
+ // Load the JIS conversion tables.
+ convert = JISConvert.Convert;
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount(char[] chars, int index, int count)
+ {
+ // Validate the parameters.
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(index < 0 || index > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (chars.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+
+ // Determine the length of the final output.
+ int length = 0;
+ int ch, value;
+#if __PNET__
+ byte *cjkToJis = convert.cjkToJis;
+ byte *extraToJis = convert.extraToJis;
+#else
+ byte[] cjkToJis = convert.cjkToJis;
+ byte[] extraToJis = convert.extraToJis;
+#endif
+ while(count > 0)
+ {
+ ch = chars[index++];
+ --count;
+ ++length;
+ if(ch < 0x0080)
+ {
+ // Character maps to itself.
+ continue;
+ }
+ else if(ch < 0x0100)
+ {
+ // Check for special Latin 1 characters that
+ // can be mapped to double-byte code points.
+ if(ch == 0x00A2 || ch == 0x00A3 || ch == 0x00A7 ||
+ ch == 0x00A8 || ch == 0x00AC || ch == 0x00B0 ||
+ ch == 0x00B1 || ch == 0x00B4 || ch == 0x00B6 ||
+ ch == 0x00D7 || ch == 0x00F7)
+ {
+ ++length;
+ }
+ }
+ else if(ch >= 0x0391 && ch <= 0x0451)
+ {
+ // Greek subset characters.
+ ++length;
+ }
+ else if(ch >= 0x2010 && ch <= 0x9FA5)
+ {
+ // This range contains the bulk of the CJK set.
+ value = (ch - 0x2010) * 2;
+ value = ((int)(cjkToJis[value])) |
+ (((int)(cjkToJis[value + 1])) << 8);
+ if(value >= 0x0100)
+ {
+ ++length;
+ }
+ }
+ else if(ch >= 0xFF01 && ch <= 0xFFEF)
+ {
+ // This range contains extra characters,
+ // including half-width katakana.
+ value = (ch - 0xFF01) * 2;
+ value = ((int)(extraToJis[value])) |
+ (((int)(extraToJis[value + 1])) << 8);
+ if(value >= 0x0100)
+ {
+ ++length;
+ }
+ }
+ }
+
+ // Return the length to the caller.
+ return length;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ // Validate the parameters.
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(charCount < 0 || charCount > (chars.Length - charIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+
+ // Convert the characters into their byte form.
+ int posn = byteIndex;
+ int byteLength = bytes.Length;
+ int ch, value;
+#if __PNET__
+ byte *cjkToJis = convert.cjkToJis;
+ byte *greekToJis = convert.greekToJis;
+ byte *extraToJis = convert.extraToJis;
+#else
+ byte[] cjkToJis = convert.cjkToJis;
+ byte[] greekToJis = convert.greekToJis;
+ byte[] extraToJis = convert.extraToJis;
+#endif
+ while(charCount > 0)
+ {
+ ch = chars[charIndex++];
+ --charCount;
+ if(posn >= byteLength)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"),
+ "bytes");
+ }
+ if(ch < 0x0080)
+ {
+ // Character maps to itself.
+ bytes[posn++] = (byte)ch;
+ continue;
+ }
+ else if(ch < 0x0100)
+ {
+ // Check for special Latin 1 characters that
+ // can be mapped to double-byte code points.
+ if(ch == 0x00A2 || ch == 0x00A3 || ch == 0x00A7 ||
+ ch == 0x00A8 || ch == 0x00AC || ch == 0x00B0 ||
+ ch == 0x00B1 || ch == 0x00B4 || ch == 0x00B6 ||
+ ch == 0x00D7 || ch == 0x00F7)
+ {
+ if((posn + 1) >= byteLength)
+ {
+ throw new ArgumentException
+ (Strings.GetString
+ ("Arg_InsufficientSpace"), "bytes");
+ }
+ switch(ch)
+ {
+ case 0x00A2:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x91;
+ break;
+
+ case 0x00A3:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x92;
+ break;
+
+ case 0x00A7:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x98;
+ break;
+
+ case 0x00A8:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x4E;
+ break;
+
+ case 0x00AC:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0xCA;
+ break;
+
+ case 0x00B0:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x8B;
+ break;
+
+ case 0x00B1:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x7D;
+ break;
+
+ case 0x00B4:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x4C;
+ break;
+
+ case 0x00B6:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0xF7;
+ break;
+
+ case 0x00D7:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x7E;
+ break;
+
+ case 0x00F7:
+ bytes[posn++] = (byte)0x81;
+ bytes[posn++] = (byte)0x80;
+ break;
+ }
+ }
+ else if(ch == 0x00A5)
+ {
+ // Yen sign.
+ bytes[posn++] = (byte)0x5C;
+ }
+ else
+ {
+ // Invalid character.
+ bytes[posn++] = (byte)'?';
+ }
+ continue;
+ }
+ else if(ch >= 0x0391 && ch <= 0x0451)
+ {
+ // Greek subset characters.
+ value = (ch - 0x0391) * 2;
+ value = ((int)(greekToJis[value])) |
+ (((int)(greekToJis[value + 1])) << 8);
+ }
+ else if(ch >= 0x2010 && ch <= 0x9FA5)
+ {
+ // This range contains the bulk of the CJK set.
+ value = (ch - 0x2010) * 2;
+ value = ((int)(cjkToJis[value])) |
+ (((int)(cjkToJis[value + 1])) << 8);
+ }
+ else if(ch >= 0xFF01 && ch <= 0xFFEF)
+ {
+ // This range contains extra characters,
+ // including half-width katakana.
+ value = (ch - 0xFF01) * 2;
+ value = ((int)(extraToJis[value])) |
+ (((int)(extraToJis[value + 1])) << 8);
+ }
+ else
+ {
+ // Invalid character.
+ value = 0;
+ }
+ if(value == 0)
+ {
+ bytes[posn++] = (byte)'?';
+ }
+ else if(value < 0x0100)
+ {
+ bytes[posn++] = (byte)value;
+ }
+ else if((posn + 1) >= byteLength)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"),
+ "bytes");
+ }
+ else if(value < 0x8000)
+ {
+ // JIS X 0208 character.
+ value -= 0x0100;
+ ch = (value / 0xBC);
+ value = (value % 0xBC) + 0x40;
+ if(value >= 0x7F)
+ {
+ ++value;
+ }
+ if(ch < (0x9F - 0x80))
+ {
+ bytes[posn++] = (byte)(ch + 0x81);
+ }
+ else
+ {
+ bytes[posn++] = (byte)(ch - (0x9F - 0x80) + 0xE0);
+ }
+ bytes[posn++] = (byte)value;
+ }
+ else
+ {
+ // JIS X 0212 character, which Shift-JIS doesn't
+ // support, but we've already allocated two slots.
+ bytes[posn++] = (byte)'?';
+ bytes[posn++] = (byte)'?';
+ }
+ }
+
+ // Return the final length to the caller.
+ return posn - byteIndex;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount(byte[] bytes, int index, int count)
+ {
+ // Validate the parameters.
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(index < 0 || index > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (bytes.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+
+ // Determine the total length of the converted string.
+ int length = 0;
+ int byteval;
+ while(count > 0)
+ {
+ byteval = bytes[index++];
+ --count;
+ ++length;
+ if(byteval < 0x80)
+ {
+ // Ordinary ASCII/Latin1 character, or the
+ // single-byte Yen or overline signs.
+ continue;
+ }
+ else if(byteval >= 0xA1 && byteval <= 0xDF)
+ {
+ // Half-width katakana.
+ continue;
+ }
+ else if(byteval < 0x81 ||
+ (byteval > 0x9F && byteval < 0xE0) ||
+ byteval > 0xEF)
+ {
+ // Invalid first byte.
+ continue;
+ }
+ if(count == 0)
+ {
+ // Missing second byte.
+ continue;
+ }
+ ++index;
+ --count;
+ }
+
+ // Return the total length.
+ return length;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ // Validate the parameters.
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteCount < 0 || byteCount > (bytes.Length - byteIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+
+ // Determine the total length of the converted string.
+ int charLength = chars.Length;
+ int posn = charIndex;
+ int length = 0;
+ int byteval, value;
+#if __PNET__
+ byte *table = convert.jisx0208ToUnicode;
+#else
+ byte[] table = convert.jisx0208ToUnicode;
+#endif
+ while(byteCount > 0)
+ {
+ byteval = bytes[byteIndex++];
+ --byteCount;
+ ++length;
+ if(posn >= charLength)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"),
+ "chars");
+ }
+ if(byteval == 0x5C)
+ {
+ // Yen sign.
+ chars[posn++] = '\u00A5';
+ continue;
+ }
+ else if(byteval == 0x7E)
+ {
+ // Overline symbol.
+ chars[posn++] = '\u203E';
+ continue;
+ }
+ else if(byteval < 0x80)
+ {
+ // Ordinary ASCII/Latin1 character.
+ chars[posn++] = (char)byteval;
+ continue;
+ }
+ else if(byteval >= 0xA1 && byteval <= 0xDF)
+ {
+ // Half-width katakana.
+ chars[posn++] = (char)(byteval - 0xA1 + 0xFF61);
+ continue;
+ }
+ else if(byteval >= 0x81 && byteval <= 0x9F)
+ {
+ value = (byteval - 0x81) * 0xBC;
+ }
+ else if(byteval >= 0xE0 && byteval <= 0xEF)
+ {
+ value = (byteval - 0xE0 + (0xA0 - 0x81)) * 0xBC;
+ }
+ else
+ {
+ // Invalid first byte.
+ chars[posn++] = '?';
+ continue;
+ }
+ if(byteCount == 0)
+ {
+ // Missing second byte.
+ chars[posn++] = '?';
+ continue;
+ }
+ byteval = bytes[byteIndex++];
+ --byteCount;
+ if(byteval >= 0x40 && byteval <= 0x7E)
+ {
+ value += (byteval - 0x40);
+ }
+ else if(byteval >= 0x80 && byteval <= 0xFC)
+ {
+ value += (byteval - 0x80 + 0x3F);
+ }
+ else
+ {
+ // Invalid second byte.
+ chars[posn++] = '?';
+ continue;
+ }
+ value *= 2;
+ value = ((int)(table[value])) |
+ (((int)(table[value + 1])) << 8);
+ if(value != 0)
+ {
+ chars[posn++] = (char)value;
+ }
+ else
+ {
+ chars[posn++] = '?';
+ }
+ }
+
+ // Return the total length.
+ return posn - charIndex;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount(int charCount)
+ {
+ if(charCount < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount",
+ Strings.GetString("ArgRange_NonNegative"));
+ }
+ return charCount * 2;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount(int byteCount)
+ {
+ if(byteCount < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount",
+ Strings.GetString("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+ // Get a decoder that handles a rolling Shift-JIS state.
+ public override Decoder GetDecoder()
+ {
+ return new CP932Decoder(convert);
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get
+ {
+ return "iso-2022-jp";
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get
+ {
+ return "Japanese (Shift-JIS)";
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get
+ {
+ return "iso-2022-jp";
+ }
+ }
+
+ // Determine if this encoding can be displayed in a Web browser.
+ public override bool IsBrowserDisplay
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a Web browser.
+ public override bool IsBrowserSave
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public override bool IsMailNewsDisplay
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public override bool IsMailNewsSave
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get
+ {
+ return "shift_jis";
+ }
+ }
+
+ // Get the Windows code page represented by this object.
+ public override int WindowsCodePage
+ {
+ get
+ {
+ return SHIFTJIS_CODE_PAGE;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+ // Decoder that handles a rolling Shift-JIS state.
+ private sealed class CP932Decoder : Decoder
+ {
+ private JISConvert convert;
+ private int lastByte;
+
+ // Constructor.
+ public CP932Decoder(JISConvert convert)
+ {
+ this.convert = convert;
+ this.lastByte = 0;
+ }
+
+ // Override inherited methods.
+ public override int GetCharCount(byte[] bytes, int index, int count)
+ {
+ // Validate the parameters.
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(index < 0 || index > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (bytes.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+
+ // Determine the total length of the converted string.
+ int length = 0;
+ int byteval;
+ int last = lastByte;
+ while(count > 0)
+ {
+ byteval = bytes[index++];
+ --count;
+ if(last == 0)
+ {
+ if((byteval >= 0x81 && byteval <= 0x9F) ||
+ (byteval >= 0xE0 && byteval <= 0xEF))
+ {
+ // First byte in a double-byte sequence.
+ last = byteval;
+ }
+ ++length;
+ }
+ else
+ {
+ // Second byte in a double-byte sequence.
+ last = 0;
+ }
+ }
+
+ // Return the total length.
+ return length;
+ }
+ public override int GetChars(byte[] bytes, int byteIndex,
+ int byteCount, char[] chars,
+ int charIndex)
+ {
+ // Validate the parameters.
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteCount < 0 || byteCount > (bytes.Length - byteIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+
+ // Decode the bytes in the buffer.
+ int posn = charIndex;
+ int charLength = chars.Length;
+ int byteval, value;
+ int last = lastByte;
+#if __PNET__
+ byte *table = convert.jisx0208ToUnicode;
+#else
+ byte[] table = convert.jisx0208ToUnicode;
+#endif
+ while(byteCount > 0)
+ {
+ byteval = bytes[byteIndex++];
+ --byteCount;
+ if(last == 0)
+ {
+ if(posn >= charLength)
+ {
+ throw new ArgumentException
+ (Strings.GetString
+ ("Arg_InsufficientSpace"), "chars");
+ }
+ if((byteval >= 0x81 && byteval <= 0x9F) ||
+ (byteval >= 0xE0 && byteval <= 0xEF))
+ {
+ // First byte in a double-byte sequence.
+ last = byteval;
+ }
+ else if(byteval == 0x5C)
+ {
+ // Yen sign.
+ chars[posn++] ='\u00A5';
+ }
+ else if(byteval == 0x7E)
+ {
+ // Overline symbol.
+ chars[posn++] ='\u203E';
+ }
+ else if(byteval < 0x80)
+ {
+ // Ordinary ASCII/Latin1 character.
+ chars[posn++] = (char)byteval;
+ }
+ else if(byteval >= 0xA1 && byteval <= 0xDF)
+ {
+ // Half-width katakana character.
+ chars[posn++] = (char)(byteval - 0xA1 + 0xFF61);
+ }
+ else
+ {
+ // Invalid first byte.
+ chars[posn++] = '?';
+ }
+ }
+ else
+ {
+ // Second byte in a double-byte sequence.
+ if(last >= 0x81 && last <= 0x9F)
+ {
+ value = (last - 0x81) * 0xBC;
+ }
+ else
+ {
+ value = (last - 0xE0 + (0xA0 - 0x81)) * 0xBC;
+ }
+ last = 0;
+ if(byteval >= 0x40 && byteval <= 0x7E)
+ {
+ value += (byteval - 0x40);
+ }
+ else if(byteval >= 0x80 && byteval <= 0xFC)
+ {
+ value += (byteval - 0x80 + 0x3F);
+ }
+ else
+ {
+ // Invalid second byte.
+ chars[posn++] = '?';
+ continue;
+ }
+ value *= 2;
+ value = ((int)(table[value])) |
+ (((int)(table[value + 1])) << 8);
+ if(value != 0)
+ {
+ chars[posn++] = (char)value;
+ }
+ else
+ {
+ chars[posn++] = '?';
+ }
+ }
+ }
+ lastByte = last;
+
+ // Return the final length to the caller.
+ return posn - charIndex;
+ }
+
+ } // class CP932Decoder
+
+}; // class CP932
+
+public class ENCshift_jis : CP932
+{
+ public ENCshift_jis() : base() {}
+
+}; // class ENCshift_jis
+
+}; // namespace I18N.CJK
diff --git a/mcs/class/I18N/CJK/CodeTable.cs b/mcs/class/I18N/CJK/CodeTable.cs
new file mode 100644
index 00000000000..2f766f59cbe
--- /dev/null
+++ b/mcs/class/I18N/CJK/CodeTable.cs
@@ -0,0 +1,143 @@
+/*
+ * CodeTable.cs - Implementation of the "System.Text.CodeTable" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.CJK
+{
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using I18N.Common;
+
+// This class assists encoding classes for the large CJK character
+// sets by providing pointer access to table data in the resource
+// section of the current assembly.
+//
+// Code tables are named by their resource (e.g. "jis.table") and
+// contain one or more sections. Each section has an 8-byte header,
+// consisting of a 32-bit section number and a 32-bit section length.
+// The alignment of the data in the table is not guaranteed.
+
+internal unsafe sealed class CodeTable : IDisposable
+{
+ // Internal state.
+ private Stream stream;
+
+ // Load a code table from the resource section of this assembly.
+ public CodeTable(String name)
+ {
+ stream = (Assembly.GetExecutingAssembly()
+ .GetManifestResourceStream(name));
+ if(stream == null)
+ {
+ throw new NotSupportedException
+ (String.Format
+ (Strings.GetString("NotSupp_MissingCodeTable"),
+ name));
+ }
+ }
+
+ // Implement the IDisposable interface.
+ public void Dispose()
+ {
+ if(stream != null)
+ {
+ stream.Close();
+ stream = null;
+ }
+ }
+
+ // Get the starting address for a particular section within
+ // the code table. This address is guaranteed to persist
+ // after "Dispose" is called.
+#if __PNET__
+ public byte *GetSection(int num)
+#else
+ public byte[] GetSection(int num)
+#endif
+ {
+ // If the table has been disposed, then bail out.
+ if(stream == null)
+ {
+ return null;
+ }
+
+ // Scan through the stream looking for the section.
+ long posn = 0;
+ long length = stream.Length;
+ byte[] header = new byte [8];
+ int sectNum, sectLen;
+ while((posn + 8) <= length)
+ {
+ // Read the next header block.
+ stream.Position = posn;
+ if(stream.Read(header, 0, 8) != 8)
+ {
+ break;
+ }
+
+ // Decode the fields in the header block.
+ sectNum = ((int)(header[0])) |
+ (((int)(header[1])) << 8) |
+ (((int)(header[2])) << 16) |
+ (((int)(header[3])) << 24);
+ sectLen = ((int)(header[4])) |
+ (((int)(header[5])) << 8) |
+ (((int)(header[6])) << 16) |
+ (((int)(header[7])) << 24);
+
+ // Is this the section we are looking for?
+ if(sectNum == num)
+ {
+#if __PNET__
+ return GetAddress(stream, posn + 8);
+#else
+ byte[] buf = new byte [sectLen];
+ if(stream.Read(buf, 0, sectLen) != sectLen)
+ {
+ break;
+ }
+ return buf;
+#endif
+ }
+
+ // Advance to the next section.
+ posn += 8 + sectLen;
+ }
+
+ // We were unable to find the requested section.
+ return null;
+ }
+
+#if __PNET__
+ // Back door access into the engine to get the address of
+ // an offset within a manifest resource stream.
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ extern private static byte *GetAddress(Stream stream, long position);
+#endif
+
+}; // class CodeTable
+
+}; // namespace I18N.CJK
diff --git a/mcs/class/I18N/CJK/JISConvert.cs b/mcs/class/I18N/CJK/JISConvert.cs
new file mode 100644
index 00000000000..17191f8a15e
--- /dev/null
+++ b/mcs/class/I18N/CJK/JISConvert.cs
@@ -0,0 +1,97 @@
+/*
+ * JISConvert.cs - Implementation of the "System.Text.JISConvert" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.CJK
+{
+
+using System;
+
+// This class assists other encoding classes in converting back
+// and forth between JIS character sets and Unicode. It uses
+// several large tables to do this, some of which are stored in
+// the resource section of the assembly for efficient access.
+
+internal unsafe sealed class JISConvert
+{
+ // Table identifiers.
+ private const int JISX0208_To_Unicode = 1;
+ private const int JISX0212_To_Unicode = 2;
+ private const int CJK_To_JIS = 3;
+ private const int Greek_To_JIS = 4;
+ private const int Extra_To_JIS = 5;
+
+ // Public access to the conversion tables.
+#if __PNET__
+ public byte *jisx0208ToUnicode;
+ public byte *jisx0212ToUnicode;
+ public byte *cjkToJis;
+ public byte *greekToJis;
+ public byte *extraToJis;
+#else
+ public byte[] jisx0208ToUnicode;
+ public byte[] jisx0212ToUnicode;
+ public byte[] cjkToJis;
+ public byte[] greekToJis;
+ public byte[] extraToJis;
+#endif
+
+ // Constructor.
+ private JISConvert()
+ {
+ // Load the conversion tables.
+ CodeTable table = new CodeTable("jis.table");
+ jisx0208ToUnicode = table.GetSection(JISX0208_To_Unicode);
+ jisx0212ToUnicode = table.GetSection(JISX0212_To_Unicode);
+ cjkToJis = table.GetSection(CJK_To_JIS);
+ greekToJis = table.GetSection(Greek_To_JIS);
+ extraToJis = table.GetSection(Extra_To_JIS);
+ table.Dispose();
+ }
+
+ // The one and only JIS conversion object in the system.
+ private static JISConvert convert;
+
+ // Get the primary JIS conversion object.
+ public static JISConvert Convert
+ {
+ get
+ {
+ lock(typeof(JISConvert))
+ {
+ if(convert != null)
+ {
+ return convert;
+ }
+ else
+ {
+ convert = new JISConvert();
+ return convert;
+ }
+ }
+ }
+ }
+
+}; // class JISConvert
+
+}; // namespace I18N.CJK
diff --git a/mcs/class/I18N/CJK/jis.table b/mcs/class/I18N/CJK/jis.table
new file mode 100644
index 00000000000..80a6f78f46d
--- /dev/null
+++ b/mcs/class/I18N/CJK/jis.table
Binary files differ
diff --git a/mcs/class/I18N/CJK/list.unix b/mcs/class/I18N/CJK/list.unix
new file mode 100755
index 00000000000..8713b3ebdf1
--- /dev/null
+++ b/mcs/class/I18N/CJK/list.unix
@@ -0,0 +1,3 @@
+CP932.cs
+CodeTable.cs
+JISConvert.cs
diff --git a/mcs/class/I18N/CJK/makefile.gnu b/mcs/class/I18N/CJK/makefile.gnu
new file mode 100755
index 00000000000..917db24bcac
--- /dev/null
+++ b/mcs/class/I18N/CJK/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../../..
+
+LIBRARY = $(topdir)/class/lib/I18N.CJK.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = --unsafe --resource jis.table -r corlib -r mscorlib -r I18N
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/Common/.cvsignore b/mcs/class/I18N/Common/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/I18N/Common/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/I18N/Common/ByteEncoding.cs b/mcs/class/I18N/Common/ByteEncoding.cs
new file mode 100644
index 00000000000..9ea1ef2b01d
--- /dev/null
+++ b/mcs/class/I18N/Common/ByteEncoding.cs
@@ -0,0 +1,401 @@
+/*
+ * ByteEncoding.cs - Implementation of the "I18N.Common.ByteEncoding" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.Common
+{
+
+using System;
+using System.Text;
+
+// This class provides an abstract base for encodings that use a single
+// byte per character. The bulk of the work is done in this class, with
+// subclasses providing implementations of the "ToBytes" methods to perform
+// the char->byte conversion.
+
+public abstract class ByteEncoding : Encoding
+{
+ // Internal state.
+ protected char[] toChars;
+ protected String encodingName;
+ protected String bodyName;
+ protected String headerName;
+ protected String webName;
+ protected bool isBrowserDisplay;
+ protected bool isBrowserSave;
+ protected bool isMailNewsDisplay;
+ protected bool isMailNewsSave;
+ protected int windowsCodePage;
+
+ // Constructor.
+ protected ByteEncoding(int codePage, char[] toChars,
+ String encodingName, String bodyName,
+ String headerName, String webName,
+ bool isBrowserDisplay, bool isBrowserSave,
+ bool isMailNewsDisplay, bool isMailNewsSave,
+ int windowsCodePage)
+ : base(codePage)
+ {
+ this.toChars = toChars;
+ this.encodingName = encodingName;
+ this.bodyName = bodyName;
+ this.headerName = headerName;
+ this.webName = webName;
+ this.isBrowserDisplay = isBrowserDisplay;
+ this.isBrowserSave = isBrowserSave;
+ this.isMailNewsDisplay = isMailNewsDisplay;
+ this.isMailNewsSave = isMailNewsSave;
+ this.windowsCodePage = windowsCodePage;
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount(char[] chars, int index, int count)
+ {
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(index < 0 || index > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (chars.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Convenience wrappers for "GetByteCount".
+ public override int GetByteCount(String s)
+ {
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ return s.Length;
+ }
+
+ // Convert an array of characters into a byte buffer,
+ // once the parameters have been validated.
+ protected abstract void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex);
+
+ // Convert a string into a byte buffer, once the parameters
+ // have been validated.
+ protected abstract void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex);
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(charCount < 0 || charCount > (chars.Length - charIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if((bytes.Length - byteIndex) < charCount)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"));
+ }
+ ToBytes(chars, charIndex, charCount, bytes, byteIndex);
+ return charCount;
+ }
+
+ // Convenience wrappers for "GetBytes".
+ public override int GetBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(charIndex < 0 || charIndex > s.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex",
+ Strings.GetString("ArgRange_StringIndex"));
+ }
+ if(charCount < 0 || charCount > (s.Length - charIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount",
+ Strings.GetString("ArgRange_StringRange"));
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if((bytes.Length - byteIndex) < charCount)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"));
+ }
+ ToBytes(s, charIndex, charCount, bytes, byteIndex);
+ return charCount;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount(byte[] bytes, int index, int count)
+ {
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(index < 0 || index > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (bytes.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteCount < 0 || byteCount > (bytes.Length - byteIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if((chars.Length - charIndex) < byteCount)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"));
+ }
+ int count = byteCount;
+ char[] cvt = toChars;
+ while(count-- > 0)
+ {
+ chars[charIndex++] = cvt[(int)(bytes[byteIndex++])];
+ }
+ return byteCount;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount(int charCount)
+ {
+ if(charCount < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount",
+ Strings.GetString("ArgRange_NonNegative"));
+ }
+ return charCount;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount(int byteCount)
+ {
+ if(byteCount < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount",
+ Strings.GetString("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+ // Decode a buffer of bytes into a string.
+ public override String GetString(byte[] bytes, int index, int count)
+ {
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(index < 0 || index > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (bytes.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+ StringBuilder s = new StringBuilder();
+ char[] cvt = toChars;
+ while(count-- > 0)
+ {
+ s.Append(cvt[(int)(bytes[index++])]);
+ }
+ return s.ToString();
+ }
+ public override String GetString(byte[] bytes)
+ {
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ int count = bytes.Length;
+ int posn = 0;
+ StringBuilder s = new StringBuilder();
+ char[] cvt = toChars;
+ while(count-- > 0)
+ {
+ s.Append(cvt[(int)(bytes[posn++])]);
+ }
+ return s.ToString();
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get
+ {
+ return bodyName;
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get
+ {
+ return encodingName;
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get
+ {
+ return headerName;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a Web browser.
+ public override bool IsBrowserDisplay
+ {
+ get
+ {
+ return isBrowserDisplay;
+ }
+ }
+
+ // Determine if this encoding can be saved from a Web browser.
+ public override bool IsBrowserSave
+ {
+ get
+ {
+ return isBrowserSave;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public override bool IsMailNewsDisplay
+ {
+ get
+ {
+ return isMailNewsDisplay;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public override bool IsMailNewsSave
+ {
+ get
+ {
+ return isMailNewsSave;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get
+ {
+ return webName;
+ }
+ }
+
+ // Get the Windows code page represented by this object.
+ public override int WindowsCodePage
+ {
+ get
+ {
+ return windowsCodePage;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+}; // class ByteEncoding
+
+}; // namespace I18N.Encoding
diff --git a/mcs/class/I18N/Common/Handlers.cs b/mcs/class/I18N/Common/Handlers.cs
new file mode 100644
index 00000000000..89ede0c69c0
--- /dev/null
+++ b/mcs/class/I18N/Common/Handlers.cs
@@ -0,0 +1,198 @@
+/*
+ * Handlers.cs - Implementation of the "I18N.Common.Handlers" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.Common
+{
+
+using System;
+
+// This class provides an internal list of handlers, for runtime
+// engines that do not implement the altered "GetFile" semantics.
+// The list must be kept up to date manually.
+
+public sealed class Handlers
+{
+ public static readonly String[] List = {
+ "I18N.CJK.CP932",
+ "I18N.CJK.ENCshift_jis",
+ "I18N.MidEast.CP1254",
+ "I18N.MidEast.ENCwindows_1254",
+ "I18N.MidEast.CP1255",
+ "I18N.MidEast.ENCwindows_1255",
+ "I18N.MidEast.CP1256",
+ "I18N.MidEast.ENCwindows_1256",
+ "I18N.MidEast.CP28596",
+ "I18N.MidEast.ENCiso_8859_6",
+ "I18N.MidEast.CP28598",
+ "I18N.MidEast.ENCiso_8859_8",
+ "I18N.MidEast.CP28599",
+ "I18N.MidEast.ENCiso_8859_9",
+ "I18N.MidEast.CP38598",
+ "I18N.MidEast.ENCwindows_38598",
+ "I18N.Other.CP1251",
+ "I18N.Other.ENCwindows_1251",
+ "I18N.Other.CP1257",
+ "I18N.Other.ENCwindows_1257",
+ "I18N.Other.CP1258",
+ "I18N.Other.ENCwindows_1258",
+ "I18N.Other.CP20866",
+ "I18N.Other.ENCkoi8_r",
+ "I18N.Other.CP21866",
+ "I18N.Other.ENCkoi8_u",
+ "I18N.Other.CP28594",
+ "I18N.Other.ENCiso_8859_4",
+ "I18N.Other.CP28595",
+ "I18N.Other.ENCiso_8859_5",
+ "I18N.Other.ISCIIEncoding",
+ "I18N.Other.CP57002",
+ "I18N.Other.CP57003",
+ "I18N.Other.CP57004",
+ "I18N.Other.CP57005",
+ "I18N.Other.CP57006",
+ "I18N.Other.CP57007",
+ "I18N.Other.CP57008",
+ "I18N.Other.CP57009",
+ "I18N.Other.CP57010",
+ "I18N.Other.CP57011",
+ "I18N.Other.ENCx_iscii_de",
+ "I18N.Other.ENCx_iscii_be",
+ "I18N.Other.ENCx_iscii_ta",
+ "I18N.Other.ENCx_iscii_te",
+ "I18N.Other.ENCx_iscii_as",
+ "I18N.Other.ENCx_iscii_or",
+ "I18N.Other.ENCx_iscii_ka",
+ "I18N.Other.ENCx_iscii_ma",
+ "I18N.Other.ENCx_iscii_gu",
+ "I18N.Other.ENCx_iscii_pa",
+ "I18N.Other.CP874",
+ "I18N.Other.ENCwindows_874",
+ "I18N.Rare.CP1026",
+ "I18N.Rare.ENCibm1026",
+ "I18N.Rare.CP1047",
+ "I18N.Rare.ENCibm1047",
+ "I18N.Rare.CP1140",
+ "I18N.Rare.ENCibm01140",
+ "I18N.Rare.CP1141",
+ "I18N.Rare.ENCibm01141",
+ "I18N.Rare.CP1142",
+ "I18N.Rare.ENCibm01142",
+ "I18N.Rare.CP1143",
+ "I18N.Rare.ENCibm01143",
+ "I18N.Rare.CP1144",
+ "I18N.Rare.ENCibm1144",
+ "I18N.Rare.CP1145",
+ "I18N.Rare.ENCibm1145",
+ "I18N.Rare.CP1146",
+ "I18N.Rare.ENCibm1146",
+ "I18N.Rare.CP1147",
+ "I18N.Rare.ENCibm1147",
+ "I18N.Rare.CP1148",
+ "I18N.Rare.ENCibm1148",
+ "I18N.Rare.CP1149",
+ "I18N.Rare.ENCibm1149",
+ "I18N.Rare.CP20273",
+ "I18N.Rare.ENCibm273",
+ "I18N.Rare.CP20277",
+ "I18N.Rare.ENCibm277",
+ "I18N.Rare.CP20278",
+ "I18N.Rare.ENCibm278",
+ "I18N.Rare.CP20280",
+ "I18N.Rare.ENCibm280",
+ "I18N.Rare.CP20284",
+ "I18N.Rare.ENCibm284",
+ "I18N.Rare.CP20285",
+ "I18N.Rare.ENCibm285",
+ "I18N.Rare.CP20290",
+ "I18N.Rare.ENCibm290",
+ "I18N.Rare.CP20297",
+ "I18N.Rare.ENCibm297",
+ "I18N.Rare.CP20420",
+ "I18N.Rare.ENCibm420",
+ "I18N.Rare.CP20424",
+ "I18N.Rare.ENCibm424",
+ "I18N.Rare.CP20871",
+ "I18N.Rare.ENCibm871",
+ "I18N.Rare.CP21025",
+ "I18N.Rare.ENCibm1025",
+ "I18N.Rare.CP37",
+ "I18N.Rare.ENCibm037",
+ "I18N.Rare.CP500",
+ "I18N.Rare.ENCibm500",
+ "I18N.Rare.CP708",
+ "I18N.Rare.ENCasmo_708",
+ "I18N.Rare.CP852",
+ "I18N.Rare.ENCibm852",
+ "I18N.Rare.CP855",
+ "I18N.Rare.ENCibm855",
+ "I18N.Rare.CP857",
+ "I18N.Rare.ENCibm857",
+ "I18N.Rare.CP858",
+ "I18N.Rare.ENCibm00858",
+ "I18N.Rare.CP862",
+ "I18N.Rare.ENCibm862",
+ "I18N.Rare.CP864",
+ "I18N.Rare.ENCibm864",
+ "I18N.Rare.CP866",
+ "I18N.Rare.ENCibm866",
+ "I18N.Rare.CP869",
+ "I18N.Rare.ENCibm869",
+ "I18N.Rare.CP870",
+ "I18N.Rare.ENCibm870",
+ "I18N.Rare.CP875",
+ "I18N.Rare.ENCibm875",
+ "I18N.West.CP10000",
+ "I18N.West.ENCmacintosh",
+ "I18N.West.CP10079",
+ "I18N.West.ENCx_mac_icelandic",
+ "I18N.West.CP1250",
+ "I18N.West.ENCwindows_1250",
+ "I18N.West.CP1252",
+ "I18N.West.ENCwindows_1252",
+ "I18N.West.CP1253",
+ "I18N.West.ENCwindows_1253",
+ "I18N.West.CP28592",
+ "I18N.West.ENCiso_8859_2",
+ "I18N.West.CP28593",
+ "I18N.West.ENCiso_8859_3",
+ "I18N.West.CP28597",
+ "I18N.West.ENCiso_8859_7",
+ "I18N.West.CP28605",
+ "I18N.West.ENCiso_8859_15",
+ "I18N.West.CP437",
+ "I18N.West.ENCibm437",
+ "I18N.West.CP850",
+ "I18N.West.ENCibm850",
+ "I18N.West.CP860",
+ "I18N.West.ENCibm860",
+ "I18N.West.CP861",
+ "I18N.West.ENCibm861",
+ "I18N.West.CP863",
+ "I18N.West.ENCibm863",
+ "I18N.West.CP865",
+ "I18N.West.ENCibm865"
+ };
+
+}; // class Handlers
+
+}; // namespace I18N.Common
diff --git a/mcs/class/I18N/Common/Manager.cs b/mcs/class/I18N/Common/Manager.cs
new file mode 100644
index 00000000000..6cf4fde14d8
--- /dev/null
+++ b/mcs/class/I18N/Common/Manager.cs
@@ -0,0 +1,342 @@
+/*
+ * Manager.cs - Implementation of the "I18N.Common.Manager" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.Common
+{
+
+using System;
+using System.IO;
+using System.Text;
+using System.Globalization;
+using System.Collections;
+using System.Reflection;
+using System.Security;
+
+// This class provides the primary entry point into the I18N
+// library. Users of the library start by getting the value
+// of the "PrimaryManager" property. They then invoke methods
+// on the manager to obtain further I18N information.
+
+public class Manager
+{
+ // The primary I18N manager.
+ private static Manager manager;
+
+ // Internal state.
+ private Hashtable handlers; // List of all handler classes.
+ private Hashtable active; // Currently active handlers.
+ private Hashtable assemblies; // Currently loaded region assemblies.
+
+ // Constructor.
+ private Manager()
+ {
+ handlers = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ active = new Hashtable(16);
+ assemblies = new Hashtable(8);
+ LoadClassList();
+ }
+
+ // Get the primary I18N manager instance.
+ public static Manager PrimaryManager
+ {
+ get
+ {
+ lock(typeof(Manager))
+ {
+ if(manager == null)
+ {
+ manager = new Manager();
+ }
+ return manager;
+ }
+ }
+ }
+
+ // Normalize a name.
+ private static String Normalize(String name)
+ {
+ #if ECMA_COMPAT
+ return (name.ToLower()).Replace('-', '_');
+ #else
+ return (name.ToLower(CultureInfo.InvariantCulture))
+ .Replace('-', '_');
+ #endif
+ }
+
+ // Get an encoding object for a specific code page.
+ // Returns NULL if the code page is not available.
+ public Encoding GetEncoding(int codePage)
+ {
+ return (Instantiate("CP" + codePage.ToString()) as Encoding);
+ }
+
+ // Get an encoding object for a specific Web encoding.
+ // Returns NULL if the encoding is not available.
+ public Encoding GetEncoding(String name)
+ {
+ // Validate the parameter.
+ if(name == null)
+ {
+ return null;
+ }
+
+ // Normalize the encoding name.
+ name = Normalize(name);
+
+ // Try to find a class called "ENCname".
+ Encoding e = Instantiate ("ENC" + name) as Encoding;
+ if (e == null)
+ e = Instantiate (name) as Encoding;
+
+ return e;
+ }
+
+ // List of hex digits for use by "GetCulture".
+ private const String hex = "0123456789abcdef";
+
+ // Get a specific culture by identifier. Returns NULL
+ // if the culture information is not available.
+ public CultureInfo GetCulture(int culture, bool useUserOverride)
+ {
+ // Create the hex version of the culture identifier.
+ StringBuilder builder = new StringBuilder();
+ builder.Append(hex[(culture >> 12) & 0x0F]);
+ builder.Append(hex[(culture >> 8) & 0x0F]);
+ builder.Append(hex[(culture >> 4) & 0x0F]);
+ builder.Append(hex[culture & 0x0F]);
+ String name = builder.ToString();
+
+ // Try looking for an override culture handler.
+ if(useUserOverride)
+ {
+ Object obj = Instantiate("CIDO" + name);
+ if(obj != null)
+ {
+ return (obj as CultureInfo);
+ }
+ }
+
+ // Look for the generic non-override culture.
+ return (Instantiate("CID" + name) as CultureInfo);
+ }
+
+ // Get a specific culture by name. Returns NULL if the
+ // culture informaion is not available.
+ public CultureInfo GetCulture(String name, bool useUserOverride)
+ {
+ // Validate the parameter.
+ if(name == null)
+ {
+ return null;
+ }
+
+ // Normalize the culture name.
+ name = Normalize(name);
+
+ // Try looking for an override culture handler.
+ if(useUserOverride)
+ {
+ Object obj = Instantiate("CNO" + name.ToString());
+ if(obj != null)
+ {
+ return (obj as CultureInfo);
+ }
+ }
+
+ // Look for the generic non-override culture.
+ return (Instantiate("CN" + name.ToString()) as CultureInfo);
+ }
+
+ // Instantiate a handler class. Returns null if it is not
+ // possible to instantiate the class.
+ internal Object Instantiate(String name)
+ {
+ Object handler;
+ String region;
+ Assembly assembly;
+ Type type;
+
+ lock(this)
+ {
+ // See if we already have an active handler by this name.
+ handler = active[name];
+ if(handler != null)
+ {
+ return handler;
+ }
+
+ // Determine which region assembly handles the class.
+ region = (String)(handlers[name]);
+ if(region == null)
+ {
+ // The class does not exist in any region assembly.
+ return null;
+ }
+
+ // Find the region-specific assembly and load it.
+ assembly = (Assembly)(assemblies[region]);
+ if(assembly == null)
+ {
+ try
+ {
+ assembly = Assembly.Load(region);
+ }
+ catch(SystemException)
+ {
+ assembly = null;
+ }
+ if(assembly == null)
+ {
+ return null;
+ }
+ assemblies[region] = assembly;
+ }
+
+ // Look for the class within the region-specific assembly.
+ type = assembly.GetType(region + "." + name, false, true);
+ if(type == null)
+ {
+ return null;
+ }
+
+ // Invoke the constructor, which we assume is public
+ // and has zero arguments.
+ try
+ {
+ handler = type.InvokeMember
+ (String.Empty,
+ BindingFlags.CreateInstance |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance,
+ null, null, null, null, null, null);
+ }
+ catch(MissingMethodException)
+ {
+ // The constructor was not present.
+ return null;
+ }
+ catch(SecurityException)
+ {
+ // The constructor was inaccessible.
+ return null;
+ }
+
+ // Add the handler to the active handlers cache.
+ active.Add(name, handler);
+
+ // Return the handler to the caller.
+ return handler;
+ }
+ }
+
+ // Load the list of classes that are present in all region assemblies.
+ private void LoadClassList()
+ {
+ FileStream stream;
+
+ // Look for "I18N-handlers.def" in the same directory
+ // as this assembly. Note: this assumes that the
+ // "Assembly.GetFile" method can access files that
+ // aren't explicitly part of the assembly manifest.
+ //
+ // This is necessary because the "I18N-handlers.def"
+ // file is generated after the "i18n" assembly is
+ // compiled and linked. So it cannot be embedded
+ // directly into the assembly manifest.
+ try
+ {
+ stream = Assembly.GetExecutingAssembly()
+ .GetFile("I18N-handlers.def");
+ if(stream == null)
+ {
+ LoadInternalClasses();
+ return;
+ }
+ }
+ catch(FileLoadException)
+ {
+ // The file does not exist, or the runtime engine
+ // refuses to implement the necessary semantics.
+ // Fall back to an internal list, which must be
+ // kept up to date manually.
+ LoadInternalClasses();
+ return;
+ }
+
+ // Load the class list from the stream.
+ StreamReader reader = new StreamReader(stream);
+ String line;
+ int posn;
+ while((line = reader.ReadLine()) != null)
+ {
+ // Skip comment lines in the input.
+ if(line.Length == 0 || line[0] == '#')
+ {
+ continue;
+ }
+
+ // Split the line into namespace and name. We assume
+ // that the line has the form "I18N.<Region>.<Name>".
+ posn = line.LastIndexOf('.');
+ if(posn != -1)
+ {
+ // Add the namespace to the "handlers" hash,
+ // attached to the name of the handler class.
+ String name = line.Substring(posn + 1);
+ if(!handlers.Contains(name))
+ {
+ handlers.Add(name, line.Substring(0, posn));
+ }
+ }
+ }
+ reader.Close();
+ }
+
+ // Load the list of classes from the internal list.
+ private void LoadInternalClasses()
+ {
+ int posn;
+ foreach(String line in Handlers.List)
+ {
+ // Split the line into namespace and name. We assume
+ // that the line has the form "I18N.<Region>.<Name>".
+ posn = line.LastIndexOf('.');
+ if(posn != -1)
+ {
+ // Add the namespace to the "handlers" hash,
+ // attached to the name of the handler class.
+ String name = line.Substring(posn + 1);
+ if(!handlers.Contains(name))
+ {
+ handlers.Add(name, line.Substring(0, posn));
+ }
+ }
+ }
+ }
+
+}; // class Manager
+
+}; // namespace I18N.Common
diff --git a/mcs/class/I18N/Common/Strings.cs b/mcs/class/I18N/Common/Strings.cs
new file mode 100644
index 00000000000..97be16676f7
--- /dev/null
+++ b/mcs/class/I18N/Common/Strings.cs
@@ -0,0 +1,56 @@
+/*
+ * Strings.cs - Implementation of the "I18N.Common.Strings" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.Common
+{
+
+using System;
+using System.Reflection;
+using System.Resources;
+
+// This class provides string resource support to the rest
+// of the I18N library assemblies.
+
+public sealed class Strings
+{
+ // Cached copy of the resources for this assembly.
+ private static ResourceManager resources = null;
+
+ // Helper for obtaining string resources for this assembly.
+ public static String GetString(String tag)
+ {
+ lock(typeof(Strings))
+ {
+ if(resources == null)
+ {
+ resources = new ResourceManager
+ ("I18N", Assembly.GetExecutingAssembly());
+ }
+ return resources.GetString(tag, null);
+ }
+ }
+
+}; // class Strings
+
+}; // namespace I18N.Common
diff --git a/mcs/class/I18N/Common/list.unix b/mcs/class/I18N/Common/list.unix
new file mode 100755
index 00000000000..e7e03344343
--- /dev/null
+++ b/mcs/class/I18N/Common/list.unix
@@ -0,0 +1,4 @@
+ByteEncoding.cs
+Handlers.cs
+Manager.cs
+Strings.cs
diff --git a/mcs/class/I18N/Common/makefile.gnu b/mcs/class/I18N/Common/makefile.gnu
new file mode 100755
index 00000000000..7ad76a2ed74
--- /dev/null
+++ b/mcs/class/I18N/Common/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../../..
+
+LIBRARY = $(topdir)/class/lib/I18N.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r mscorlib
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/I18N.build b/mcs/class/I18N/I18N.build
new file mode 100644
index 00000000000..5a9e8a56347
--- /dev/null
+++ b/mcs/class/I18N/I18N.build
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<project name="pnetlib I18N" default="build">
+ <property name="debug" value="false"/>
+ <target name="build">
+
+ <!-- Build the primary I18N.dll library -->
+ <csc output="../lib/I18N.dll" target="library" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:corlib.dll"/>
+
+ <sources>
+ <includes name="Common/*.cs"/>
+ </sources>
+
+ <!--<resources>
+ <file name="../resources/en_US/I18N/I18N.resources"/>
+ </resources>-->
+
+ </csc>
+
+ <!-- Build the I18N.CJK.dll library -->
+ <csc output="../lib/I18N.CJK.dll" target="library" debug="${debug}">
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:I18N.dll"/>
+ <arg value="/resource:CJK/jis.table"/>
+
+ <sources>
+ <includes name="CJK/*.cs"/>
+ </sources>
+
+ <!--<resources>
+ <file name="CJK/jis.table"/>
+ </resources>-->
+
+
+ </csc>
+
+ <!-- Build the I18N.MidEast.dll library -->
+ <csc output="../lib/I18N.MidEast.dll" target="library" debug="${debug}">
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:I18N.dll"/>
+
+ <sources>
+ <includes name="MidEast/*.cs"/>
+ </sources>
+
+ </csc>
+
+ <!-- Build the I18N.Other.dll library -->
+ <csc output="../lib/I18N.Other.dll" target="library" debug="${debug}">
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:I18N.dll"/>
+
+ <sources>
+ <includes name="Other/*.cs"/>
+ </sources>
+
+ </csc>
+
+ <!-- Build the I18N.Rare.dll library -->
+ <csc output="../lib/I18N.Rare.dll" target="library" debug="${debug}">
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:I18N.dll"/>
+
+ <sources>
+ <includes name="Rare/*.cs"/>
+ </sources>
+
+ </csc>
+
+ <!-- Build the I18N.West.dll library -->
+ <csc output="../lib/I18N.West.dll" target="library" debug="${debug}">
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:I18N.dll"/>
+
+ <sources>
+ <includes name="West/*.cs"/>
+ </sources>
+
+ </csc>
+
+ </target>
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset basedir="../lib">
+ <includes name="I18N.dll"/>
+ <includes name="I18N.CJK.dll"/>
+ <includes name="I18N.MidEast.dll"/>
+ <includes name="I18N.Other.dll"/>
+ <includes name="I18N.Rare.dll"/>
+ <includes name="I18N.West.dll"/>
+ </fileset>
+ </delete>
+ <!-- Uncomment this if build file added for those.
+ <nant basedir="Common" target="clean"/>
+ <nant basedir="CJK" target="clean"/>
+ <nant basedir="MidEast" target="clean"/>
+ <nant basedir="Other" target="clean"/>
+ <nant basedir="Rare" target="clean"/>
+ <nant basedir="West" target="clean"/>
+ -->
+ </target>
+</project>
diff --git a/mcs/class/I18N/MidEast/.cvsignore b/mcs/class/I18N/MidEast/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/I18N/MidEast/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/I18N/MidEast/CP1254.cs b/mcs/class/I18N/MidEast/CP1254.cs
new file mode 100644
index 00000000000..06700748fc5
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP1254.cs
@@ -0,0 +1,399 @@
+/*
+ * CP1254.cs - Turkish (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5350.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP1254 : ByteEncoding
+{
+ public CP1254()
+ : base(1254, ToChars, "Turkish (Windows)",
+ "iso-8859-9", "windows-1254", "windows-1254",
+ true, true, true, true, 1254)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0192',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u02C6', '\u2030',
+ '\u0160', '\u2039', '\u0152', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u02DC', '\u2122', '\u0161', '\u203A',
+ '\u0153', '\u009D', '\u009E', '\u0178', '\u00A0', '\u00A1',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9',
+ '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
+ '\u00C0', '\u00C1', '\u00C2', '\u00C3', '\u00C4', '\u00C5',
+ '\u00C6', '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB',
+ '\u00CC', '\u00CD', '\u00CE', '\u00CF', '\u011E', '\u00D1',
+ '\u00D2', '\u00D3', '\u00D4', '\u00D5', '\u00D6', '\u00D7',
+ '\u00D8', '\u00D9', '\u00DA', '\u00DB', '\u00DC', '\u0130',
+ '\u015E', '\u00DF', '\u00E0', '\u00E1', '\u00E2', '\u00E3',
+ '\u00E4', '\u00E5', '\u00E6', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u00EC', '\u00ED', '\u00EE', '\u00EF',
+ '\u011F', '\u00F1', '\u00F2', '\u00F3', '\u00F4', '\u00F5',
+ '\u00F6', '\u00F7', '\u00F8', '\u00F9', '\u00FA', '\u00FB',
+ '\u00FC', '\u0131', '\u015F', '\u00FF',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x009D:
+ case 0x009E:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FF:
+ break;
+ case 0x011E: ch = 0xD0; break;
+ case 0x011F: ch = 0xF0; break;
+ case 0x0130: ch = 0xDD; break;
+ case 0x0131: ch = 0xFD; break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x015E: ch = 0xDE; break;
+ case 0x015F: ch = 0xFE; break;
+ case 0x0160: ch = 0x8A; break;
+ case 0x0161: ch = 0x9A; break;
+ case 0x0178: ch = 0x9F; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x009D:
+ case 0x009E:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FF:
+ break;
+ case 0x011E: ch = 0xD0; break;
+ case 0x011F: ch = 0xF0; break;
+ case 0x0130: ch = 0xDD; break;
+ case 0x0131: ch = 0xFD; break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x015E: ch = 0xDE; break;
+ case 0x015F: ch = 0xFE; break;
+ case 0x0160: ch = 0x8A; break;
+ case 0x0161: ch = 0x9A; break;
+ case 0x0178: ch = 0x9F; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1254
+
+public class ENCwindows_1254 : CP1254
+{
+ public ENCwindows_1254() : base() {}
+
+}; // class ENCwindows_1254
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/CP1255.cs b/mcs/class/I18N/MidEast/CP1255.cs
new file mode 100644
index 00000000000..c732d08dc76
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP1255.cs
@@ -0,0 +1,393 @@
+/*
+ * CP1255.cs - Hebrew (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5351.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP1255 : ByteEncoding
+{
+ public CP1255()
+ : base(1255, ToChars, "Hebrew (Windows)",
+ "windows-1255", "windows-1255", "windows-1255",
+ true, true, true, true, 1255)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0192',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u02C6', '\u2030',
+ '\u008A', '\u2039', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u02DC', '\u2122', '\u009A', '\u203A',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u00A1',
+ '\u00A2', '\u00A3', '\u20AA', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00D7', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9',
+ '\u00F7', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
+ '\u05B0', '\u05B1', '\u05B2', '\u05B3', '\u05B4', '\u05B5',
+ '\u05B6', '\u05B7', '\u05B8', '\u05B9', '\u003F', '\u05BB',
+ '\u05BC', '\u05BD', '\u05BE', '\u05BF', '\u05C0', '\u05C1',
+ '\u05C2', '\u05C3', '\u05F0', '\u05F1', '\u05F2', '\u05F3',
+ '\u05F4', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u05D0', '\u05D1', '\u05D2', '\u05D3',
+ '\u05D4', '\u05D5', '\u05D6', '\u05D7', '\u05D8', '\u05D9',
+ '\u05DA', '\u05DB', '\u05DC', '\u05DD', '\u05DE', '\u05DF',
+ '\u05E0', '\u05E1', '\u05E2', '\u05E3', '\u05E4', '\u05E5',
+ '\u05E6', '\u05E7', '\u05E8', '\u05E9', '\u05EA', '\u003F',
+ '\u003F', '\u200E', '\u200F', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008A:
+ case 0x008C:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x009A:
+ case 0x009C:
+ case 0x009D:
+ case 0x009E:
+ case 0x009F:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ break;
+ case 0x00D7: ch = 0xAA; break;
+ case 0x00F7: ch = 0xBA; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x05B0:
+ case 0x05B1:
+ case 0x05B2:
+ case 0x05B3:
+ case 0x05B4:
+ case 0x05B5:
+ case 0x05B6:
+ case 0x05B7:
+ case 0x05B8:
+ case 0x05B9:
+ ch -= 0x04F0;
+ break;
+ case 0x05BB:
+ case 0x05BC:
+ case 0x05BD:
+ case 0x05BE:
+ case 0x05BF:
+ case 0x05C0:
+ case 0x05C1:
+ case 0x05C2:
+ case 0x05C3:
+ ch -= 0x04F0;
+ break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x04F0;
+ break;
+ case 0x05F0:
+ case 0x05F1:
+ case 0x05F2:
+ case 0x05F3:
+ case 0x05F4:
+ ch -= 0x051C;
+ break;
+ case 0x200E: ch = 0xFD; break;
+ case 0x200F: ch = 0xFE; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AA: ch = 0xA4; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008A:
+ case 0x008C:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x009A:
+ case 0x009C:
+ case 0x009D:
+ case 0x009E:
+ case 0x009F:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ break;
+ case 0x00D7: ch = 0xAA; break;
+ case 0x00F7: ch = 0xBA; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x05B0:
+ case 0x05B1:
+ case 0x05B2:
+ case 0x05B3:
+ case 0x05B4:
+ case 0x05B5:
+ case 0x05B6:
+ case 0x05B7:
+ case 0x05B8:
+ case 0x05B9:
+ ch -= 0x04F0;
+ break;
+ case 0x05BB:
+ case 0x05BC:
+ case 0x05BD:
+ case 0x05BE:
+ case 0x05BF:
+ case 0x05C0:
+ case 0x05C1:
+ case 0x05C2:
+ case 0x05C3:
+ ch -= 0x04F0;
+ break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x04F0;
+ break;
+ case 0x05F0:
+ case 0x05F1:
+ case 0x05F2:
+ case 0x05F3:
+ case 0x05F4:
+ ch -= 0x051C;
+ break;
+ case 0x200E: ch = 0xFD; break;
+ case 0x200F: ch = 0xFE; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AA: ch = 0xA4; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1255
+
+public class ENCwindows_1255 : CP1255
+{
+ public ENCwindows_1255() : base() {}
+
+}; // class ENCwindows_1255
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/CP1256.cs b/mcs/class/I18N/MidEast/CP1256.cs
new file mode 100644
index 00000000000..71e5c3288f9
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP1256.cs
@@ -0,0 +1,771 @@
+/*
+ * CP1256.cs - Arabic (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5352.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP1256 : ByteEncoding
+{
+ public CP1256()
+ : base(1256, ToChars, "Arabic (Windows)",
+ "windows-1256", "windows-1256", "windows-1256",
+ true, true, true, true, 1256)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u067E', '\u201A', '\u0192',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u02C6', '\u2030',
+ '\u0679', '\u2039', '\u0152', '\u0686', '\u0698', '\u0688',
+ '\u06AF', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u06A9', '\u2122', '\u0691', '\u203A',
+ '\u0153', '\u200C', '\u200D', '\u06BA', '\u00A0', '\u060C',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u06BE', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9',
+ '\u061B', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u061F',
+ '\u06C1', '\u0621', '\u0622', '\u0623', '\u0624', '\u0625',
+ '\u0626', '\u0627', '\u0628', '\u0629', '\u062A', '\u062B',
+ '\u062C', '\u062D', '\u062E', '\u062F', '\u0630', '\u0631',
+ '\u0632', '\u0633', '\u0634', '\u0635', '\u0636', '\u00D7',
+ '\u0637', '\u0638', '\u0639', '\u063A', '\u0640', '\u0641',
+ '\u0642', '\u0643', '\u00E0', '\u0644', '\u00E2', '\u0645',
+ '\u0646', '\u0647', '\u0648', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u0649', '\u064A', '\u00EE', '\u00EF',
+ '\u064B', '\u064C', '\u064D', '\u064E', '\u00F4', '\u064F',
+ '\u0650', '\u00F7', '\u0651', '\u00F9', '\u0652', '\u00FB',
+ '\u00FC', '\u200E', '\u200F', '\u06D2',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A0:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00D7:
+ case 0x00E0:
+ case 0x00E2:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F4:
+ case 0x00F7:
+ case 0x00F9:
+ case 0x00FB:
+ case 0x00FC:
+ break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x060C: ch = 0xA1; break;
+ case 0x061B: ch = 0xBA; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ case 0x0625:
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ ch -= 0x0560;
+ break;
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x055F;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ ch -= 0x0564;
+ break;
+ case 0x0644: ch = 0xE1; break;
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ ch -= 0x0562;
+ break;
+ case 0x0649: ch = 0xEC; break;
+ case 0x064A: ch = 0xED; break;
+ case 0x064B:
+ case 0x064C:
+ case 0x064D:
+ case 0x064E:
+ ch -= 0x055B;
+ break;
+ case 0x064F: ch = 0xF5; break;
+ case 0x0650: ch = 0xF6; break;
+ case 0x0651: ch = 0xF8; break;
+ case 0x0652: ch = 0xFA; break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x0630;
+ break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x0679: ch = 0x8A; break;
+ case 0x067E: ch = 0x81; break;
+ case 0x0686: ch = 0x8D; break;
+ case 0x0688: ch = 0x8F; break;
+ case 0x0691: ch = 0x9A; break;
+ case 0x0698: ch = 0x8E; break;
+ case 0x06A9: ch = 0x98; break;
+ case 0x06AF: ch = 0x90; break;
+ case 0x06BA: ch = 0x9F; break;
+ case 0x06BE: ch = 0xAA; break;
+ case 0x06C1: ch = 0xC0; break;
+ case 0x06D2: ch = 0xFF; break;
+ case 0x06F0:
+ case 0x06F1:
+ case 0x06F2:
+ case 0x06F3:
+ case 0x06F4:
+ case 0x06F5:
+ case 0x06F6:
+ case 0x06F7:
+ case 0x06F8:
+ case 0x06F9:
+ ch -= 0x06C0;
+ break;
+ case 0x200C: ch = 0x9D; break;
+ case 0x200D: ch = 0x9E; break;
+ case 0x200E: ch = 0xFD; break;
+ case 0x200F: ch = 0xFE; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ case 0xFB56: ch = 0x81; break;
+ case 0xFB58: ch = 0x81; break;
+ case 0xFB66: ch = 0x8A; break;
+ case 0xFB68: ch = 0x8A; break;
+ case 0xFB7A: ch = 0x8D; break;
+ case 0xFB7C: ch = 0x8D; break;
+ case 0xFB88: ch = 0x8F; break;
+ case 0xFB8A: ch = 0x8E; break;
+ case 0xFB8C: ch = 0x9A; break;
+ case 0xFB8E: ch = 0x98; break;
+ case 0xFB90: ch = 0x98; break;
+ case 0xFB92: ch = 0x90; break;
+ case 0xFB94: ch = 0x90; break;
+ case 0xFB9E: ch = 0x9F; break;
+ case 0xFBA6: ch = 0xC0; break;
+ case 0xFBA8: ch = 0xC0; break;
+ case 0xFBAA: ch = 0xAA; break;
+ case 0xFBAC: ch = 0xAA; break;
+ case 0xFBAE: ch = 0xFF; break;
+ case 0xFE70: ch = 0xF0; break;
+ case 0xFE71: ch = 0xF0; break;
+ case 0xFE72: ch = 0xF1; break;
+ case 0xFE74: ch = 0xF2; break;
+ case 0xFE76: ch = 0xF3; break;
+ case 0xFE77: ch = 0xF3; break;
+ case 0xFE78: ch = 0xF5; break;
+ case 0xFE79: ch = 0xF5; break;
+ case 0xFE7A: ch = 0xF6; break;
+ case 0xFE7B: ch = 0xF6; break;
+ case 0xFE7C: ch = 0xF8; break;
+ case 0xFE7D: ch = 0xF8; break;
+ case 0xFE7E: ch = 0xFA; break;
+ case 0xFE7F: ch = 0xFA; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xC2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xC3; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE87: ch = 0xC5; break;
+ case 0xFE88: ch = 0xC5; break;
+ case 0xFE89: ch = 0xC6; break;
+ case 0xFE8A: ch = 0xC6; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xC7; break;
+ case 0xFE8F: ch = 0xC8; break;
+ case 0xFE90: ch = 0xC8; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xCA; break;
+ case 0xFE96: ch = 0xCA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xCB; break;
+ case 0xFE9A: ch = 0xCB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xCC; break;
+ case 0xFE9E: ch = 0xCC; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xCD; break;
+ case 0xFEA2: ch = 0xCD; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xCE; break;
+ case 0xFEA6: ch = 0xCE; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xD3; break;
+ case 0xFEB2: ch = 0xD3; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xD4; break;
+ case 0xFEB6: ch = 0xD4; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xD5; break;
+ case 0xFEBA: ch = 0xD5; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xD6; break;
+ case 0xFEBE: ch = 0xD6; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD8; break;
+ case 0xFEC2: ch = 0xD8; break;
+ case 0xFEC3: ch = 0xD8; break;
+ case 0xFEC4: ch = 0xD8; break;
+ case 0xFEC5: ch = 0xD9; break;
+ case 0xFEC6: ch = 0xD9; break;
+ case 0xFEC7: ch = 0xD9; break;
+ case 0xFEC8: ch = 0xD9; break;
+ case 0xFEC9: ch = 0xDA; break;
+ case 0xFECA: ch = 0xDA; break;
+ case 0xFECB: ch = 0xDA; break;
+ case 0xFECC: ch = 0xDA; break;
+ case 0xFECD: ch = 0xDB; break;
+ case 0xFECE: ch = 0xDB; break;
+ case 0xFECF: ch = 0xDB; break;
+ case 0xFED0: ch = 0xDB; break;
+ case 0xFED1: ch = 0xDD; break;
+ case 0xFED2: ch = 0xDD; break;
+ case 0xFED3: ch = 0xDD; break;
+ case 0xFED4: ch = 0xDD; break;
+ case 0xFED5: ch = 0xDE; break;
+ case 0xFED6: ch = 0xDE; break;
+ case 0xFED7: ch = 0xDE; break;
+ case 0xFED8: ch = 0xDE; break;
+ case 0xFED9: ch = 0xDF; break;
+ case 0xFEDA: ch = 0xDF; break;
+ case 0xFEDB: ch = 0xDF; break;
+ case 0xFEDC: ch = 0xDF; break;
+ case 0xFEDD: ch = 0xE1; break;
+ case 0xFEDE: ch = 0xE1; break;
+ case 0xFEDF: ch = 0xE1; break;
+ case 0xFEE0: ch = 0xE1; break;
+ case 0xFEE1: ch = 0xE3; break;
+ case 0xFEE2: ch = 0xE3; break;
+ case 0xFEE3: ch = 0xE3; break;
+ case 0xFEE4: ch = 0xE3; break;
+ case 0xFEE5: ch = 0xE4; break;
+ case 0xFEE6: ch = 0xE4; break;
+ case 0xFEE7: ch = 0xE4; break;
+ case 0xFEE8: ch = 0xE4; break;
+ case 0xFEE9: ch = 0xE5; break;
+ case 0xFEEA: ch = 0xE5; break;
+ case 0xFEEB: ch = 0xE5; break;
+ case 0xFEEC: ch = 0xE5; break;
+ case 0xFEED: ch = 0xE6; break;
+ case 0xFEEE: ch = 0xE6; break;
+ case 0xFEEF: ch = 0xEC; break;
+ case 0xFEF0: ch = 0xEC; break;
+ case 0xFEF1: ch = 0xED; break;
+ case 0xFEF2: ch = 0xED; break;
+ case 0xFEF3: ch = 0xED; break;
+ case 0xFEF4: ch = 0xED; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A0:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00D7:
+ case 0x00E0:
+ case 0x00E2:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F4:
+ case 0x00F7:
+ case 0x00F9:
+ case 0x00FB:
+ case 0x00FC:
+ break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x060C: ch = 0xA1; break;
+ case 0x061B: ch = 0xBA; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ case 0x0625:
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ ch -= 0x0560;
+ break;
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x055F;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ ch -= 0x0564;
+ break;
+ case 0x0644: ch = 0xE1; break;
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ ch -= 0x0562;
+ break;
+ case 0x0649: ch = 0xEC; break;
+ case 0x064A: ch = 0xED; break;
+ case 0x064B:
+ case 0x064C:
+ case 0x064D:
+ case 0x064E:
+ ch -= 0x055B;
+ break;
+ case 0x064F: ch = 0xF5; break;
+ case 0x0650: ch = 0xF6; break;
+ case 0x0651: ch = 0xF8; break;
+ case 0x0652: ch = 0xFA; break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x0630;
+ break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x0679: ch = 0x8A; break;
+ case 0x067E: ch = 0x81; break;
+ case 0x0686: ch = 0x8D; break;
+ case 0x0688: ch = 0x8F; break;
+ case 0x0691: ch = 0x9A; break;
+ case 0x0698: ch = 0x8E; break;
+ case 0x06A9: ch = 0x98; break;
+ case 0x06AF: ch = 0x90; break;
+ case 0x06BA: ch = 0x9F; break;
+ case 0x06BE: ch = 0xAA; break;
+ case 0x06C1: ch = 0xC0; break;
+ case 0x06D2: ch = 0xFF; break;
+ case 0x06F0:
+ case 0x06F1:
+ case 0x06F2:
+ case 0x06F3:
+ case 0x06F4:
+ case 0x06F5:
+ case 0x06F6:
+ case 0x06F7:
+ case 0x06F8:
+ case 0x06F9:
+ ch -= 0x06C0;
+ break;
+ case 0x200C: ch = 0x9D; break;
+ case 0x200D: ch = 0x9E; break;
+ case 0x200E: ch = 0xFD; break;
+ case 0x200F: ch = 0xFE; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ case 0xFB56: ch = 0x81; break;
+ case 0xFB58: ch = 0x81; break;
+ case 0xFB66: ch = 0x8A; break;
+ case 0xFB68: ch = 0x8A; break;
+ case 0xFB7A: ch = 0x8D; break;
+ case 0xFB7C: ch = 0x8D; break;
+ case 0xFB88: ch = 0x8F; break;
+ case 0xFB8A: ch = 0x8E; break;
+ case 0xFB8C: ch = 0x9A; break;
+ case 0xFB8E: ch = 0x98; break;
+ case 0xFB90: ch = 0x98; break;
+ case 0xFB92: ch = 0x90; break;
+ case 0xFB94: ch = 0x90; break;
+ case 0xFB9E: ch = 0x9F; break;
+ case 0xFBA6: ch = 0xC0; break;
+ case 0xFBA8: ch = 0xC0; break;
+ case 0xFBAA: ch = 0xAA; break;
+ case 0xFBAC: ch = 0xAA; break;
+ case 0xFBAE: ch = 0xFF; break;
+ case 0xFE70: ch = 0xF0; break;
+ case 0xFE71: ch = 0xF0; break;
+ case 0xFE72: ch = 0xF1; break;
+ case 0xFE74: ch = 0xF2; break;
+ case 0xFE76: ch = 0xF3; break;
+ case 0xFE77: ch = 0xF3; break;
+ case 0xFE78: ch = 0xF5; break;
+ case 0xFE79: ch = 0xF5; break;
+ case 0xFE7A: ch = 0xF6; break;
+ case 0xFE7B: ch = 0xF6; break;
+ case 0xFE7C: ch = 0xF8; break;
+ case 0xFE7D: ch = 0xF8; break;
+ case 0xFE7E: ch = 0xFA; break;
+ case 0xFE7F: ch = 0xFA; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xC2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xC3; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE87: ch = 0xC5; break;
+ case 0xFE88: ch = 0xC5; break;
+ case 0xFE89: ch = 0xC6; break;
+ case 0xFE8A: ch = 0xC6; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xC7; break;
+ case 0xFE8F: ch = 0xC8; break;
+ case 0xFE90: ch = 0xC8; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xCA; break;
+ case 0xFE96: ch = 0xCA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xCB; break;
+ case 0xFE9A: ch = 0xCB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xCC; break;
+ case 0xFE9E: ch = 0xCC; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xCD; break;
+ case 0xFEA2: ch = 0xCD; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xCE; break;
+ case 0xFEA6: ch = 0xCE; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xD3; break;
+ case 0xFEB2: ch = 0xD3; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xD4; break;
+ case 0xFEB6: ch = 0xD4; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xD5; break;
+ case 0xFEBA: ch = 0xD5; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xD6; break;
+ case 0xFEBE: ch = 0xD6; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD8; break;
+ case 0xFEC2: ch = 0xD8; break;
+ case 0xFEC3: ch = 0xD8; break;
+ case 0xFEC4: ch = 0xD8; break;
+ case 0xFEC5: ch = 0xD9; break;
+ case 0xFEC6: ch = 0xD9; break;
+ case 0xFEC7: ch = 0xD9; break;
+ case 0xFEC8: ch = 0xD9; break;
+ case 0xFEC9: ch = 0xDA; break;
+ case 0xFECA: ch = 0xDA; break;
+ case 0xFECB: ch = 0xDA; break;
+ case 0xFECC: ch = 0xDA; break;
+ case 0xFECD: ch = 0xDB; break;
+ case 0xFECE: ch = 0xDB; break;
+ case 0xFECF: ch = 0xDB; break;
+ case 0xFED0: ch = 0xDB; break;
+ case 0xFED1: ch = 0xDD; break;
+ case 0xFED2: ch = 0xDD; break;
+ case 0xFED3: ch = 0xDD; break;
+ case 0xFED4: ch = 0xDD; break;
+ case 0xFED5: ch = 0xDE; break;
+ case 0xFED6: ch = 0xDE; break;
+ case 0xFED7: ch = 0xDE; break;
+ case 0xFED8: ch = 0xDE; break;
+ case 0xFED9: ch = 0xDF; break;
+ case 0xFEDA: ch = 0xDF; break;
+ case 0xFEDB: ch = 0xDF; break;
+ case 0xFEDC: ch = 0xDF; break;
+ case 0xFEDD: ch = 0xE1; break;
+ case 0xFEDE: ch = 0xE1; break;
+ case 0xFEDF: ch = 0xE1; break;
+ case 0xFEE0: ch = 0xE1; break;
+ case 0xFEE1: ch = 0xE3; break;
+ case 0xFEE2: ch = 0xE3; break;
+ case 0xFEE3: ch = 0xE3; break;
+ case 0xFEE4: ch = 0xE3; break;
+ case 0xFEE5: ch = 0xE4; break;
+ case 0xFEE6: ch = 0xE4; break;
+ case 0xFEE7: ch = 0xE4; break;
+ case 0xFEE8: ch = 0xE4; break;
+ case 0xFEE9: ch = 0xE5; break;
+ case 0xFEEA: ch = 0xE5; break;
+ case 0xFEEB: ch = 0xE5; break;
+ case 0xFEEC: ch = 0xE5; break;
+ case 0xFEED: ch = 0xE6; break;
+ case 0xFEEE: ch = 0xE6; break;
+ case 0xFEEF: ch = 0xEC; break;
+ case 0xFEF0: ch = 0xEC; break;
+ case 0xFEF1: ch = 0xED; break;
+ case 0xFEF2: ch = 0xED; break;
+ case 0xFEF3: ch = 0xED; break;
+ case 0xFEF4: ch = 0xED; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1256
+
+public class ENCwindows_1256 : CP1256
+{
+ public ENCwindows_1256() : base() {}
+
+}; // class ENCwindows_1256
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/CP28596.cs b/mcs/class/I18N/MidEast/CP28596.cs
new file mode 100644
index 00000000000..1ee3db0eb1b
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP28596.cs
@@ -0,0 +1,545 @@
+/*
+ * CP28596.cs - Arabic (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1089.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP28596 : ByteEncoding
+{
+ public CP28596()
+ : base(28596, ToChars, "Arabic (ISO)",
+ "iso-8859-6", "iso-8859-6", "iso-8859-6",
+ true, true, true, true, 1256)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u003F',
+ '\u003F', '\u003F', '\u00A4', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u060C', '\u00AD',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u061B', '\u003F', '\u003F', '\u003F', '\u061F',
+ '\u003F', '\u0621', '\u0622', '\u0623', '\u0624', '\u0625',
+ '\u0626', '\u0627', '\u0628', '\u0629', '\u062A', '\u062B',
+ '\u062C', '\u062D', '\u062E', '\u062F', '\u0630', '\u0631',
+ '\u0632', '\u0633', '\u0634', '\u0635', '\u0636', '\u0637',
+ '\u0638', '\u0639', '\u063A', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u0640', '\u0641', '\u0642', '\u0643',
+ '\u0644', '\u0645', '\u0646', '\u0647', '\u0648', '\u0649',
+ '\u064A', '\u064B', '\u064C', '\u064D', '\u064E', '\u064F',
+ '\u0650', '\u0651', '\u0652', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00AD:
+ break;
+ case 0x060C: ch = 0xAC; break;
+ case 0x061B: ch = 0xBB; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ case 0x0625:
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x0560;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ case 0x0644:
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ case 0x0649:
+ case 0x064A:
+ case 0x064B:
+ case 0x064C:
+ case 0x064D:
+ case 0x064E:
+ case 0x064F:
+ case 0x0650:
+ case 0x0651:
+ case 0x0652:
+ ch -= 0x0560;
+ break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x0630;
+ break;
+ case 0x066A: ch = 0x25; break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x066D: ch = 0x2A; break;
+ case 0xFE70: ch = 0xEB; break;
+ case 0xFE71: ch = 0xEB; break;
+ case 0xFE72: ch = 0xEC; break;
+ case 0xFE74: ch = 0xED; break;
+ case 0xFE76: ch = 0xEE; break;
+ case 0xFE77: ch = 0xEE; break;
+ case 0xFE78: ch = 0xEF; break;
+ case 0xFE79: ch = 0xEF; break;
+ case 0xFE7A: ch = 0xF0; break;
+ case 0xFE7B: ch = 0xF0; break;
+ case 0xFE7C: ch = 0xF1; break;
+ case 0xFE7D: ch = 0xF1; break;
+ case 0xFE7E: ch = 0xF2; break;
+ case 0xFE7F: ch = 0xF2; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xC2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xC3; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE87: ch = 0xC5; break;
+ case 0xFE88: ch = 0xC5; break;
+ case 0xFE89: ch = 0xC6; break;
+ case 0xFE8A: ch = 0xC6; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xC7; break;
+ case 0xFE8F: ch = 0xC8; break;
+ case 0xFE90: ch = 0xC8; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xCA; break;
+ case 0xFE96: ch = 0xCA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xCB; break;
+ case 0xFE9A: ch = 0xCB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xCC; break;
+ case 0xFE9E: ch = 0xCC; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xCD; break;
+ case 0xFEA2: ch = 0xCD; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xCE; break;
+ case 0xFEA6: ch = 0xCE; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xD3; break;
+ case 0xFEB2: ch = 0xD3; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xD4; break;
+ case 0xFEB6: ch = 0xD4; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xD5; break;
+ case 0xFEBA: ch = 0xD5; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xD6; break;
+ case 0xFEBE: ch = 0xD6; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD7; break;
+ case 0xFEC2: ch = 0xD7; break;
+ case 0xFEC3: ch = 0xD7; break;
+ case 0xFEC4: ch = 0xD7; break;
+ case 0xFEC5: ch = 0xD8; break;
+ case 0xFEC6: ch = 0xD8; break;
+ case 0xFEC7: ch = 0xD8; break;
+ case 0xFEC8: ch = 0xD8; break;
+ case 0xFEC9: ch = 0xD9; break;
+ case 0xFECA: ch = 0xD9; break;
+ case 0xFECB: ch = 0xD9; break;
+ case 0xFECC: ch = 0xD9; break;
+ case 0xFECD: ch = 0xDA; break;
+ case 0xFECE: ch = 0xDA; break;
+ case 0xFECF: ch = 0xDA; break;
+ case 0xFED0: ch = 0xDA; break;
+ case 0xFED1: ch = 0xE1; break;
+ case 0xFED2: ch = 0xE1; break;
+ case 0xFED3: ch = 0xE1; break;
+ case 0xFED4: ch = 0xE1; break;
+ case 0xFED5: ch = 0xE2; break;
+ case 0xFED6: ch = 0xE2; break;
+ case 0xFED7: ch = 0xE2; break;
+ case 0xFED8: ch = 0xE2; break;
+ case 0xFED9: ch = 0xE3; break;
+ case 0xFEDA: ch = 0xE3; break;
+ case 0xFEDB: ch = 0xE3; break;
+ case 0xFEDC: ch = 0xE3; break;
+ case 0xFEDD: ch = 0xE4; break;
+ case 0xFEDE: ch = 0xE4; break;
+ case 0xFEDF: ch = 0xE4; break;
+ case 0xFEE0: ch = 0xE4; break;
+ case 0xFEE1: ch = 0xE5; break;
+ case 0xFEE2: ch = 0xE5; break;
+ case 0xFEE3: ch = 0xE5; break;
+ case 0xFEE4: ch = 0xE5; break;
+ case 0xFEE5: ch = 0xE6; break;
+ case 0xFEE6: ch = 0xE6; break;
+ case 0xFEE7: ch = 0xE6; break;
+ case 0xFEE8: ch = 0xE6; break;
+ case 0xFEE9: ch = 0xE7; break;
+ case 0xFEEA: ch = 0xE7; break;
+ case 0xFEEB: ch = 0xE7; break;
+ case 0xFEEC: ch = 0xE7; break;
+ case 0xFEED: ch = 0xE8; break;
+ case 0xFEEE: ch = 0xE8; break;
+ case 0xFEEF: ch = 0xE9; break;
+ case 0xFEF0: ch = 0xE9; break;
+ case 0xFEF1: ch = 0xEA; break;
+ case 0xFEF2: ch = 0xEA; break;
+ case 0xFEF3: ch = 0xEA; break;
+ case 0xFEF4: ch = 0xEA; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00AD:
+ break;
+ case 0x060C: ch = 0xAC; break;
+ case 0x061B: ch = 0xBB; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ case 0x0625:
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x0560;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ case 0x0644:
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ case 0x0649:
+ case 0x064A:
+ case 0x064B:
+ case 0x064C:
+ case 0x064D:
+ case 0x064E:
+ case 0x064F:
+ case 0x0650:
+ case 0x0651:
+ case 0x0652:
+ ch -= 0x0560;
+ break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x0630;
+ break;
+ case 0x066A: ch = 0x25; break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x066D: ch = 0x2A; break;
+ case 0xFE70: ch = 0xEB; break;
+ case 0xFE71: ch = 0xEB; break;
+ case 0xFE72: ch = 0xEC; break;
+ case 0xFE74: ch = 0xED; break;
+ case 0xFE76: ch = 0xEE; break;
+ case 0xFE77: ch = 0xEE; break;
+ case 0xFE78: ch = 0xEF; break;
+ case 0xFE79: ch = 0xEF; break;
+ case 0xFE7A: ch = 0xF0; break;
+ case 0xFE7B: ch = 0xF0; break;
+ case 0xFE7C: ch = 0xF1; break;
+ case 0xFE7D: ch = 0xF1; break;
+ case 0xFE7E: ch = 0xF2; break;
+ case 0xFE7F: ch = 0xF2; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xC2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xC3; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE87: ch = 0xC5; break;
+ case 0xFE88: ch = 0xC5; break;
+ case 0xFE89: ch = 0xC6; break;
+ case 0xFE8A: ch = 0xC6; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xC7; break;
+ case 0xFE8F: ch = 0xC8; break;
+ case 0xFE90: ch = 0xC8; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xCA; break;
+ case 0xFE96: ch = 0xCA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xCB; break;
+ case 0xFE9A: ch = 0xCB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xCC; break;
+ case 0xFE9E: ch = 0xCC; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xCD; break;
+ case 0xFEA2: ch = 0xCD; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xCE; break;
+ case 0xFEA6: ch = 0xCE; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xD3; break;
+ case 0xFEB2: ch = 0xD3; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xD4; break;
+ case 0xFEB6: ch = 0xD4; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xD5; break;
+ case 0xFEBA: ch = 0xD5; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xD6; break;
+ case 0xFEBE: ch = 0xD6; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD7; break;
+ case 0xFEC2: ch = 0xD7; break;
+ case 0xFEC3: ch = 0xD7; break;
+ case 0xFEC4: ch = 0xD7; break;
+ case 0xFEC5: ch = 0xD8; break;
+ case 0xFEC6: ch = 0xD8; break;
+ case 0xFEC7: ch = 0xD8; break;
+ case 0xFEC8: ch = 0xD8; break;
+ case 0xFEC9: ch = 0xD9; break;
+ case 0xFECA: ch = 0xD9; break;
+ case 0xFECB: ch = 0xD9; break;
+ case 0xFECC: ch = 0xD9; break;
+ case 0xFECD: ch = 0xDA; break;
+ case 0xFECE: ch = 0xDA; break;
+ case 0xFECF: ch = 0xDA; break;
+ case 0xFED0: ch = 0xDA; break;
+ case 0xFED1: ch = 0xE1; break;
+ case 0xFED2: ch = 0xE1; break;
+ case 0xFED3: ch = 0xE1; break;
+ case 0xFED4: ch = 0xE1; break;
+ case 0xFED5: ch = 0xE2; break;
+ case 0xFED6: ch = 0xE2; break;
+ case 0xFED7: ch = 0xE2; break;
+ case 0xFED8: ch = 0xE2; break;
+ case 0xFED9: ch = 0xE3; break;
+ case 0xFEDA: ch = 0xE3; break;
+ case 0xFEDB: ch = 0xE3; break;
+ case 0xFEDC: ch = 0xE3; break;
+ case 0xFEDD: ch = 0xE4; break;
+ case 0xFEDE: ch = 0xE4; break;
+ case 0xFEDF: ch = 0xE4; break;
+ case 0xFEE0: ch = 0xE4; break;
+ case 0xFEE1: ch = 0xE5; break;
+ case 0xFEE2: ch = 0xE5; break;
+ case 0xFEE3: ch = 0xE5; break;
+ case 0xFEE4: ch = 0xE5; break;
+ case 0xFEE5: ch = 0xE6; break;
+ case 0xFEE6: ch = 0xE6; break;
+ case 0xFEE7: ch = 0xE6; break;
+ case 0xFEE8: ch = 0xE6; break;
+ case 0xFEE9: ch = 0xE7; break;
+ case 0xFEEA: ch = 0xE7; break;
+ case 0xFEEB: ch = 0xE7; break;
+ case 0xFEEC: ch = 0xE7; break;
+ case 0xFEED: ch = 0xE8; break;
+ case 0xFEEE: ch = 0xE8; break;
+ case 0xFEEF: ch = 0xE9; break;
+ case 0xFEF0: ch = 0xE9; break;
+ case 0xFEF1: ch = 0xEA; break;
+ case 0xFEF2: ch = 0xEA; break;
+ case 0xFEF3: ch = 0xEA; break;
+ case 0xFEF4: ch = 0xEA; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28596
+
+public class ENCiso_8859_6 : CP28596
+{
+ public ENCiso_8859_6() : base() {}
+
+}; // class ENCiso_8859_6
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/CP28598.cs b/mcs/class/I18N/MidEast/CP28598.cs
new file mode 100644
index 00000000000..a2b11fffe89
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP28598.cs
@@ -0,0 +1,261 @@
+/*
+ * CP28598.cs - Hebrew (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-916.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP28598 : ByteEncoding
+{
+ public CP28598()
+ : base(28598, ToChars, "Hebrew (ISO)",
+ "iso-8859-8", "iso-8859-8", "iso-8859-8",
+ true, true, true, true, 1255)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u003F',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00D7', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u203E', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u2022', '\u00B8', '\u00B9',
+ '\u00F7', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u2017', '\u05D0', '\u05D1', '\u05D2', '\u05D3',
+ '\u05D4', '\u05D5', '\u05D6', '\u05D7', '\u05D8', '\u05D9',
+ '\u05DA', '\u05DB', '\u05DC', '\u05DD', '\u05DE', '\u05DF',
+ '\u05E0', '\u05E1', '\u05E2', '\u05E3', '\u05E4', '\u05E5',
+ '\u05E6', '\u05E7', '\u05E8', '\u05E9', '\u05EA', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ break;
+ case 0x00D7: ch = 0xAA; break;
+ case 0x00F7: ch = 0xBA; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x04F0;
+ break;
+ case 0x2017: ch = 0xDF; break;
+ case 0x2022: ch = 0xB7; break;
+ case 0x203E: ch = 0xAF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ break;
+ case 0x00D7: ch = 0xAA; break;
+ case 0x00F7: ch = 0xBA; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x04F0;
+ break;
+ case 0x2017: ch = 0xDF; break;
+ case 0x2022: ch = 0xB7; break;
+ case 0x203E: ch = 0xAF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28598
+
+public class ENCiso_8859_8 : CP28598
+{
+ public ENCiso_8859_8() : base() {}
+
+}; // class ENCiso_8859_8
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/CP28599.cs b/mcs/class/I18N/MidEast/CP28599.cs
new file mode 100644
index 00000000000..ab6b96166d7
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP28599.cs
@@ -0,0 +1,241 @@
+/*
+ * CP28599.cs - Latin 5 (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-920.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP28599 : ByteEncoding
+{
+ public CP28599()
+ : base(28599, ToChars, "Latin 5 (ISO)",
+ "iso-8859-9", "iso-8859-9", "iso-8859-9",
+ true, true, true, true, 1254)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u00A1',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9',
+ '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
+ '\u00C0', '\u00C1', '\u00C2', '\u00C3', '\u00C4', '\u00C5',
+ '\u00C6', '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB',
+ '\u00CC', '\u00CD', '\u00CE', '\u00CF', '\u011E', '\u00D1',
+ '\u00D2', '\u00D3', '\u00D4', '\u00D5', '\u00D6', '\u00D7',
+ '\u00D8', '\u00D9', '\u00DA', '\u00DB', '\u00DC', '\u0130',
+ '\u015E', '\u00DF', '\u00E0', '\u00E1', '\u00E2', '\u00E3',
+ '\u00E4', '\u00E5', '\u00E6', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u00EC', '\u00ED', '\u00EE', '\u00EF',
+ '\u011F', '\u00F1', '\u00F2', '\u00F3', '\u00F4', '\u00F5',
+ '\u00F6', '\u00F7', '\u00F8', '\u00F9', '\u00FA', '\u00FB',
+ '\u00FC', '\u0131', '\u015F', '\u00FF',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 208) switch(ch)
+ {
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FF:
+ break;
+ case 0x011E: ch = 0xD0; break;
+ case 0x011F: ch = 0xF0; break;
+ case 0x0130: ch = 0xDD; break;
+ case 0x0131: ch = 0xFD; break;
+ case 0x015E: ch = 0xDE; break;
+ case 0x015F: ch = 0xFE; break;
+ case 0x203E: ch = 0xAF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 208) switch(ch)
+ {
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FF:
+ break;
+ case 0x011E: ch = 0xD0; break;
+ case 0x011F: ch = 0xF0; break;
+ case 0x0130: ch = 0xDD; break;
+ case 0x0131: ch = 0xFD; break;
+ case 0x015E: ch = 0xDE; break;
+ case 0x015F: ch = 0xFE; break;
+ case 0x203E: ch = 0xAF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28599
+
+public class ENCiso_8859_9 : CP28599
+{
+ public ENCiso_8859_9() : base() {}
+
+}; // class ENCiso_8859_9
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/CP38598.cs b/mcs/class/I18N/MidEast/CP38598.cs
new file mode 100644
index 00000000000..c0b8e4de9d7
--- /dev/null
+++ b/mcs/class/I18N/MidEast/CP38598.cs
@@ -0,0 +1,261 @@
+/*
+ * CP38598.cs - Hebrew (ISO Alternative) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-916.ucm".
+
+namespace I18N.MidEast
+{
+
+using System;
+using I18N.Common;
+
+public class CP38598 : ByteEncoding
+{
+ public CP38598()
+ : base(38598, ToChars, "Hebrew (ISO Alternative)",
+ "iso-8859-8", "windows-38598", "windows-38598",
+ true, true, true, true, 1255)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u003F',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00D7', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u203E', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u2022', '\u00B8', '\u00B9',
+ '\u00F7', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u2017', '\u05D0', '\u05D1', '\u05D2', '\u05D3',
+ '\u05D4', '\u05D5', '\u05D6', '\u05D7', '\u05D8', '\u05D9',
+ '\u05DA', '\u05DB', '\u05DC', '\u05DD', '\u05DE', '\u05DF',
+ '\u05E0', '\u05E1', '\u05E2', '\u05E3', '\u05E4', '\u05E5',
+ '\u05E6', '\u05E7', '\u05E8', '\u05E9', '\u05EA', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ break;
+ case 0x00D7: ch = 0xAA; break;
+ case 0x00F7: ch = 0xBA; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x04F0;
+ break;
+ case 0x2017: ch = 0xDF; break;
+ case 0x2022: ch = 0xB7; break;
+ case 0x203E: ch = 0xAF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ break;
+ case 0x00D7: ch = 0xAA; break;
+ case 0x00F7: ch = 0xBA; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x04F0;
+ break;
+ case 0x2017: ch = 0xDF; break;
+ case 0x2022: ch = 0xB7; break;
+ case 0x203E: ch = 0xAF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP38598
+
+public class ENCwindows_38598 : CP38598
+{
+ public ENCwindows_38598() : base() {}
+
+}; // class ENCwindows_38598
+
+}; // namespace I18N.MidEast
diff --git a/mcs/class/I18N/MidEast/ibm-1089.ucm b/mcs/class/I18N/MidEast/ibm-1089.ucm
new file mode 100644
index 00000000000..3356cdfa543
--- /dev/null
+++ b/mcs/class/I18N/MidEast/ibm-1089.ucm
@@ -0,0 +1,477 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:47 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00441.RPMAP100 and 044134B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1089"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1089
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A4> \xA4 |0
+<U00AD> \xAD |0
+<U060C> \xAC |0
+<U061B> \xBB |0
+<U061F> \xBF |0
+<U0621> \xC1 |0
+<U0622> \xC2 |0
+<U0623> \xC3 |0
+<U0624> \xC4 |0
+<U0625> \xC5 |0
+<U0626> \xC6 |0
+<U0627> \xC7 |0
+<U0628> \xC8 |0
+<U0629> \xC9 |0
+<U062A> \xCA |0
+<U062B> \xCB |0
+<U062C> \xCC |0
+<U062D> \xCD |0
+<U062E> \xCE |0
+<U062F> \xCF |0
+<U0630> \xD0 |0
+<U0631> \xD1 |0
+<U0632> \xD2 |0
+<U0633> \xD3 |0
+<U0634> \xD4 |0
+<U0635> \xD5 |0
+<U0636> \xD6 |0
+<U0637> \xD7 |0
+<U0638> \xD8 |0
+<U0639> \xD9 |0
+<U063A> \xDA |0
+<U0640> \xE0 |0
+<U0641> \xE1 |0
+<U0642> \xE2 |0
+<U0643> \xE3 |0
+<U0644> \xE4 |0
+<U0645> \xE5 |0
+<U0646> \xE6 |0
+<U0647> \xE7 |0
+<U0648> \xE8 |0
+<U0649> \xE9 |0
+<U064A> \xEA |0
+<U064B> \xEB |0
+<U064C> \xEC |0
+<U064D> \xED |0
+<U064E> \xEE |0
+<U064F> \xEF |0
+<U0650> \xF0 |0
+<U0651> \xF1 |0
+<U0652> \xF2 |0
+<U0660> \x30 |1
+<U0661> \x31 |1
+<U0662> \x32 |1
+<U0663> \x33 |1
+<U0664> \x34 |1
+<U0665> \x35 |1
+<U0666> \x36 |1
+<U0667> \x37 |1
+<U0668> \x38 |1
+<U0669> \x39 |1
+<U066A> \x25 |1
+<U066B> \x2C |1
+<U066C> \x2E |1
+<U066D> \x2A |1
+<UFE70> \xEB |1
+<UFE71> \xEB |1
+<UFE72> \xEC |1
+<UFE74> \xED |1
+<UFE76> \xEE |1
+<UFE77> \xEE |1
+<UFE78> \xEF |1
+<UFE79> \xEF |1
+<UFE7A> \xF0 |1
+<UFE7B> \xF0 |1
+<UFE7C> \xF1 |1
+<UFE7D> \xF1 |1
+<UFE7E> \xF2 |1
+<UFE7F> \xF2 |1
+<UFE80> \xC1 |1
+<UFE81> \xC2 |1
+<UFE82> \xC2 |1
+<UFE83> \xC3 |1
+<UFE84> \xC3 |1
+<UFE85> \xC4 |1
+<UFE86> \xC4 |1
+<UFE87> \xC5 |1
+<UFE88> \xC5 |1
+<UFE89> \xC6 |1
+<UFE8A> \xC6 |1
+<UFE8B> \xC6 |1
+<UFE8C> \xC6 |1
+<UFE8D> \xC7 |1
+<UFE8E> \xC7 |1
+<UFE8F> \xC8 |1
+<UFE90> \xC8 |1
+<UFE91> \xC8 |1
+<UFE92> \xC8 |1
+<UFE93> \xC9 |1
+<UFE94> \xC9 |1
+<UFE95> \xCA |1
+<UFE96> \xCA |1
+<UFE97> \xCA |1
+<UFE98> \xCA |1
+<UFE99> \xCB |1
+<UFE9A> \xCB |1
+<UFE9B> \xCB |1
+<UFE9C> \xCB |1
+<UFE9D> \xCC |1
+<UFE9E> \xCC |1
+<UFE9F> \xCC |1
+<UFEA0> \xCC |1
+<UFEA1> \xCD |1
+<UFEA2> \xCD |1
+<UFEA3> \xCD |1
+<UFEA4> \xCD |1
+<UFEA5> \xCE |1
+<UFEA6> \xCE |1
+<UFEA7> \xCE |1
+<UFEA8> \xCE |1
+<UFEA9> \xCF |1
+<UFEAA> \xCF |1
+<UFEAB> \xD0 |1
+<UFEAC> \xD0 |1
+<UFEAD> \xD1 |1
+<UFEAE> \xD1 |1
+<UFEAF> \xD2 |1
+<UFEB0> \xD2 |1
+<UFEB1> \xD3 |1
+<UFEB2> \xD3 |1
+<UFEB3> \xD3 |1
+<UFEB4> \xD3 |1
+<UFEB5> \xD4 |1
+<UFEB6> \xD4 |1
+<UFEB7> \xD4 |1
+<UFEB8> \xD4 |1
+<UFEB9> \xD5 |1
+<UFEBA> \xD5 |1
+<UFEBB> \xD5 |1
+<UFEBC> \xD5 |1
+<UFEBD> \xD6 |1
+<UFEBE> \xD6 |1
+<UFEBF> \xD6 |1
+<UFEC0> \xD6 |1
+<UFEC1> \xD7 |1
+<UFEC2> \xD7 |1
+<UFEC3> \xD7 |1
+<UFEC4> \xD7 |1
+<UFEC5> \xD8 |1
+<UFEC6> \xD8 |1
+<UFEC7> \xD8 |1
+<UFEC8> \xD8 |1
+<UFEC9> \xD9 |1
+<UFECA> \xD9 |1
+<UFECB> \xD9 |1
+<UFECC> \xD9 |1
+<UFECD> \xDA |1
+<UFECE> \xDA |1
+<UFECF> \xDA |1
+<UFED0> \xDA |1
+<UFED1> \xE1 |1
+<UFED2> \xE1 |1
+<UFED3> \xE1 |1
+<UFED4> \xE1 |1
+<UFED5> \xE2 |1
+<UFED6> \xE2 |1
+<UFED7> \xE2 |1
+<UFED8> \xE2 |1
+<UFED9> \xE3 |1
+<UFEDA> \xE3 |1
+<UFEDB> \xE3 |1
+<UFEDC> \xE3 |1
+<UFEDD> \xE4 |1
+<UFEDE> \xE4 |1
+<UFEDF> \xE4 |1
+<UFEE0> \xE4 |1
+<UFEE1> \xE5 |1
+<UFEE2> \xE5 |1
+<UFEE3> \xE5 |1
+<UFEE4> \xE5 |1
+<UFEE5> \xE6 |1
+<UFEE6> \xE6 |1
+<UFEE7> \xE6 |1
+<UFEE8> \xE6 |1
+<UFEE9> \xE7 |1
+<UFEEA> \xE7 |1
+<UFEEB> \xE7 |1
+<UFEEC> \xE7 |1
+<UFEED> \xE8 |1
+<UFEEE> \xE8 |1
+<UFEEF> \xE9 |1
+<UFEF0> \xE9 |1
+<UFEF1> \xEA |1
+<UFEF2> \xEA |1
+<UFEF3> \xEA |1
+<UFEF4> \xEA |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/MidEast/ibm-5350.ucm b/mcs/class/I18N/MidEast/ibm-5350.ucm
new file mode 100644
index 00000000000..7ee3c6fc82d
--- /dev/null
+++ b/mcs/class/I18N/MidEast/ibm-5350.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:45 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E6.RPMAP100 and 14E644B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5350"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5350
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U00A0> \xA0 |0
+<U00A1> \xA1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AA> \xAA |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BA> \xBA |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00BF> \xBF |0
+<U00C0> \xC0 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C3> \xC3 |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xC6 |0
+<U00C7> \xC7 |0
+<U00C8> \xC8 |0
+<U00C9> \xC9 |0
+<U00CA> \xCA |0
+<U00CB> \xCB |0
+<U00CC> \xCC |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00CF> \xCF |0
+<U00D1> \xD1 |0
+<U00D2> \xD2 |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D5> \xD5 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xD8 |0
+<U00D9> \xD9 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DF> \xDF |0
+<U00E0> \xE0 |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E3> \xE3 |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xE6 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00EC> \xEC |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F1> \xF1 |0
+<U00F2> \xF2 |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F5> \xF5 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xF8 |0
+<U00F9> \xF9 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U00FF> \xFF |0
+<U011E> \xD0 |0
+<U011F> \xF0 |0
+<U0130> \xDD |0
+<U0131> \xFD |0
+<U0152> \x8C |0
+<U0153> \x9C |0
+<U015E> \xDE |0
+<U015F> \xFE |0
+<U0160> \x8A |0
+<U0161> \x9A |0
+<U0178> \x9F |0
+<U0192> \x83 |0
+<U02C6> \x88 |0
+<U02DC> \x98 |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/MidEast/ibm-5351.ucm b/mcs/class/I18N/MidEast/ibm-5351.ucm
new file mode 100644
index 00000000000..c341195d357
--- /dev/null
+++ b/mcs/class/I18N/MidEast/ibm-5351.ucm
@@ -0,0 +1,368 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:45 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E7.RPMAP100 and 14E744B0.TPMAP100
+#
+# Patched for jitterbug 792
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5351"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5351
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U008A> \x8A |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U009A> \x9A |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A1> \xA1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00BF> \xBF |0
+<U00D7> \xAA |0
+<U00F7> \xBA |0
+<U0192> \x83 |0
+<U02C6> \x88 |0
+<U02DC> \x98 |0
+<U05B0> \xC0 |0
+<U05B1> \xC1 |0
+<U05B2> \xC2 |0
+<U05B3> \xC3 |0
+<U05B4> \xC4 |0
+<U05B5> \xC5 |0
+<U05B6> \xC6 |0
+<U05B7> \xC7 |0
+<U05B8> \xC8 |0
+<U05B9> \xC9 |0
+<U05BB> \xCB |0
+<U05BC> \xCC |0
+<U05BD> \xCD |0
+<U05BE> \xCE |0
+<U05BF> \xCF |0
+<U05C0> \xD0 |0
+<U05C1> \xD1 |0
+<U05C2> \xD2 |0
+<U05C3> \xD3 |0
+<U05D0> \xE0 |0
+<U05D1> \xE1 |0
+<U05D2> \xE2 |0
+<U05D3> \xE3 |0
+<U05D4> \xE4 |0
+<U05D5> \xE5 |0
+<U05D6> \xE6 |0
+<U05D7> \xE7 |0
+<U05D8> \xE8 |0
+<U05D9> \xE9 |0
+<U05DA> \xEA |0
+<U05DB> \xEB |0
+<U05DC> \xEC |0
+<U05DD> \xED |0
+<U05DE> \xEE |0
+<U05DF> \xEF |0
+<U05E0> \xF0 |0
+<U05E1> \xF1 |0
+<U05E2> \xF2 |0
+<U05E3> \xF3 |0
+<U05E4> \xF4 |0
+<U05E5> \xF5 |0
+<U05E6> \xF6 |0
+<U05E7> \xF7 |0
+<U05E8> \xF8 |0
+<U05E9> \xF9 |0
+<U05EA> \xFA |0
+<U05F0> \xD4 |0
+<U05F1> \xD5 |0
+<U05F2> \xD6 |0
+<U05F3> \xD7 |0
+<U05F4> \xD8 |0
+<U200E> \xFD |0
+<U200F> \xFE |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AA> \xA4 |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/MidEast/ibm-5352.ucm b/mcs/class/I18N/MidEast/ibm-5352.ucm
new file mode 100644
index 00000000000..63fa0ab7975
--- /dev/null
+++ b/mcs/class/I18N/MidEast/ibm-5352.ucm
@@ -0,0 +1,551 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:45 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E8.RPMAP100 and 14E844B0.TPMAP100
+#
+# Patched for jitterbug 792
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5352"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5352
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U00A0> \xA0 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00D7> \xD7 |0
+<U00E0> \xE0 |0
+<U00E2> \xE2 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F4> \xF4 |0
+<U00F7> \xF7 |0
+<U00F9> \xF9 |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U0152> \x8C |0
+<U0153> \x9C |0
+<U0192> \x83 |0
+<U02C6> \x88 |0
+<U060C> \xA1 |0
+<U061B> \xBA |0
+<U061F> \xBF |0
+<U0621> \xC1 |0
+<U0622> \xC2 |0
+<U0623> \xC3 |0
+<U0624> \xC4 |0
+<U0625> \xC5 |0
+<U0626> \xC6 |0
+<U0627> \xC7 |0
+<U0628> \xC8 |0
+<U0629> \xC9 |0
+<U062A> \xCA |0
+<U062B> \xCB |0
+<U062C> \xCC |0
+<U062D> \xCD |0
+<U062E> \xCE |0
+<U062F> \xCF |0
+<U0630> \xD0 |0
+<U0631> \xD1 |0
+<U0632> \xD2 |0
+<U0633> \xD3 |0
+<U0634> \xD4 |0
+<U0635> \xD5 |0
+<U0636> \xD6 |0
+<U0637> \xD8 |0
+<U0638> \xD9 |0
+<U0639> \xDA |0
+<U063A> \xDB |0
+<U0640> \xDC |0
+<U0641> \xDD |0
+<U0642> \xDE |0
+<U0643> \xDF |0
+<U0644> \xE1 |0
+<U0645> \xE3 |0
+<U0646> \xE4 |0
+<U0647> \xE5 |0
+<U0648> \xE6 |0
+<U0649> \xEC |0
+<U064A> \xED |0
+<U064B> \xF0 |0
+<U064C> \xF1 |0
+<U064D> \xF2 |0
+<U064E> \xF3 |0
+<U064F> \xF5 |0
+<U0650> \xF6 |0
+<U0651> \xF8 |0
+<U0652> \xFA |0
+<U0660> \x30 |1
+<U0661> \x31 |1
+<U0662> \x32 |1
+<U0663> \x33 |1
+<U0664> \x34 |1
+<U0665> \x35 |1
+<U0666> \x36 |1
+<U0667> \x37 |1
+<U0668> \x38 |1
+<U0669> \x39 |1
+<U066B> \x2C |1
+<U066C> \x2E |1
+<U0679> \x8A |0
+<U067E> \x81 |0
+<U0686> \x8D |0
+<U0688> \x8F |0
+<U0691> \x9A |0
+<U0698> \x8E |0
+<U06A9> \x98 |0
+<U06AF> \x90 |0
+<U06BA> \x9F |0
+<U06BE> \xAA |0
+<U06C1> \xC0 |0
+<U06D2> \xFF |0
+<U06F0> \x30 |1
+<U06F1> \x31 |1
+<U06F2> \x32 |1
+<U06F3> \x33 |1
+<U06F4> \x34 |1
+<U06F5> \x35 |1
+<U06F6> \x36 |1
+<U06F7> \x37 |1
+<U06F8> \x38 |1
+<U06F9> \x39 |1
+<U200C> \x9D |0
+<U200D> \x9E |0
+<U200E> \xFD |0
+<U200F> \xFE |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFB56> \x81 |1
+<UFB58> \x81 |1
+<UFB66> \x8A |1
+<UFB68> \x8A |1
+<UFB7A> \x8D |1
+<UFB7C> \x8D |1
+<UFB88> \x8F |1
+<UFB8A> \x8E |1
+<UFB8C> \x9A |1
+<UFB8E> \x98 |1
+<UFB90> \x98 |1
+<UFB92> \x90 |1
+<UFB94> \x90 |1
+<UFB9E> \x9F |1
+<UFBA6> \xC0 |1
+<UFBA8> \xC0 |1
+<UFBAA> \xAA |1
+<UFBAC> \xAA |1
+<UFBAE> \xFF |1
+<UFE70> \xF0 |1
+<UFE71> \xF0 |1
+<UFE72> \xF1 |1
+<UFE74> \xF2 |1
+<UFE76> \xF3 |1
+<UFE77> \xF3 |1
+<UFE78> \xF5 |1
+<UFE79> \xF5 |1
+<UFE7A> \xF6 |1
+<UFE7B> \xF6 |1
+<UFE7C> \xF8 |1
+<UFE7D> \xF8 |1
+<UFE7E> \xFA |1
+<UFE7F> \xFA |1
+<UFE80> \xC1 |1
+<UFE81> \xC2 |1
+<UFE82> \xC2 |1
+<UFE83> \xC3 |1
+<UFE84> \xC3 |1
+<UFE85> \xC4 |1
+<UFE86> \xC4 |1
+<UFE87> \xC5 |1
+<UFE88> \xC5 |1
+<UFE89> \xC6 |1
+<UFE8A> \xC6 |1
+<UFE8B> \xC6 |1
+<UFE8C> \xC6 |1
+<UFE8D> \xC7 |1
+<UFE8E> \xC7 |1
+<UFE8F> \xC8 |1
+<UFE90> \xC8 |1
+<UFE91> \xC8 |1
+<UFE92> \xC8 |1
+<UFE93> \xC9 |1
+<UFE94> \xC9 |1
+<UFE95> \xCA |1
+<UFE96> \xCA |1
+<UFE97> \xCA |1
+<UFE98> \xCA |1
+<UFE99> \xCB |1
+<UFE9A> \xCB |1
+<UFE9B> \xCB |1
+<UFE9C> \xCB |1
+<UFE9D> \xCC |1
+<UFE9E> \xCC |1
+<UFE9F> \xCC |1
+<UFEA0> \xCC |1
+<UFEA1> \xCD |1
+<UFEA2> \xCD |1
+<UFEA3> \xCD |1
+<UFEA4> \xCD |1
+<UFEA5> \xCE |1
+<UFEA6> \xCE |1
+<UFEA7> \xCE |1
+<UFEA8> \xCE |1
+<UFEA9> \xCF |1
+<UFEAA> \xCF |1
+<UFEAB> \xD0 |1
+<UFEAC> \xD0 |1
+<UFEAD> \xD1 |1
+<UFEAE> \xD1 |1
+<UFEAF> \xD2 |1
+<UFEB0> \xD2 |1
+<UFEB1> \xD3 |1
+<UFEB2> \xD3 |1
+<UFEB3> \xD3 |1
+<UFEB4> \xD3 |1
+<UFEB5> \xD4 |1
+<UFEB6> \xD4 |1
+<UFEB7> \xD4 |1
+<UFEB8> \xD4 |1
+<UFEB9> \xD5 |1
+<UFEBA> \xD5 |1
+<UFEBB> \xD5 |1
+<UFEBC> \xD5 |1
+<UFEBD> \xD6 |1
+<UFEBE> \xD6 |1
+<UFEBF> \xD6 |1
+<UFEC0> \xD6 |1
+<UFEC1> \xD8 |1
+<UFEC2> \xD8 |1
+<UFEC3> \xD8 |1
+<UFEC4> \xD8 |1
+<UFEC5> \xD9 |1
+<UFEC6> \xD9 |1
+<UFEC7> \xD9 |1
+<UFEC8> \xD9 |1
+<UFEC9> \xDA |1
+<UFECA> \xDA |1
+<UFECB> \xDA |1
+<UFECC> \xDA |1
+<UFECD> \xDB |1
+<UFECE> \xDB |1
+<UFECF> \xDB |1
+<UFED0> \xDB |1
+<UFED1> \xDD |1
+<UFED2> \xDD |1
+<UFED3> \xDD |1
+<UFED4> \xDD |1
+<UFED5> \xDE |1
+<UFED6> \xDE |1
+<UFED7> \xDE |1
+<UFED8> \xDE |1
+<UFED9> \xDF |1
+<UFEDA> \xDF |1
+<UFEDB> \xDF |1
+<UFEDC> \xDF |1
+<UFEDD> \xE1 |1
+<UFEDE> \xE1 |1
+<UFEDF> \xE1 |1
+<UFEE0> \xE1 |1
+<UFEE1> \xE3 |1
+<UFEE2> \xE3 |1
+<UFEE3> \xE3 |1
+<UFEE4> \xE3 |1
+<UFEE5> \xE4 |1
+<UFEE6> \xE4 |1
+<UFEE7> \xE4 |1
+<UFEE8> \xE4 |1
+<UFEE9> \xE5 |1
+<UFEEA> \xE5 |1
+<UFEEB> \xE5 |1
+<UFEEC> \xE5 |1
+<UFEED> \xE6 |1
+<UFEEE> \xE6 |1
+<UFEEF> \xEC |1
+<UFEF0> \xEC |1
+<UFEF1> \xED |1
+<UFEF2> \xED |1
+<UFEF3> \xED |1
+<UFEF4> \xED |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/MidEast/ibm-916.ucm b/mcs/class/I18N/MidEast/ibm-916.ucm
new file mode 100644
index 00000000000..26408070225
--- /dev/null
+++ b/mcs/class/I18N/MidEast/ibm-916.ucm
@@ -0,0 +1,339 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00394.RPMAP100 and 039434B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-916"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-916
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00D7> \xAA |0
+<U00F7> \xBA |0
+<U05D0> \xE0 |0
+<U05D1> \xE1 |0
+<U05D2> \xE2 |0
+<U05D3> \xE3 |0
+<U05D4> \xE4 |0
+<U05D5> \xE5 |0
+<U05D6> \xE6 |0
+<U05D7> \xE7 |0
+<U05D8> \xE8 |0
+<U05D9> \xE9 |0
+<U05DA> \xEA |0
+<U05DB> \xEB |0
+<U05DC> \xEC |0
+<U05DD> \xED |0
+<U05DE> \xEE |0
+<U05DF> \xEF |0
+<U05E0> \xF0 |0
+<U05E1> \xF1 |0
+<U05E2> \xF2 |0
+<U05E3> \xF3 |0
+<U05E4> \xF4 |0
+<U05E5> \xF5 |0
+<U05E6> \xF6 |0
+<U05E7> \xF7 |0
+<U05E8> \xF8 |0
+<U05E9> \xF9 |0
+<U05EA> \xFA |0
+<U2017> \xDF |0
+<U2022> \xB7 |0
+<U203E> \xAF |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/MidEast/ibm-920.ucm b/mcs/class/I18N/MidEast/ibm-920.ucm
new file mode 100644
index 00000000000..c1c01aad48c
--- /dev/null
+++ b/mcs/class/I18N/MidEast/ibm-920.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00398.RPMAP100 and 039834B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-920"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-920
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A1> \xA1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AA> \xAA |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BA> \xBA |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00BF> \xBF |0
+<U00C0> \xC0 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C3> \xC3 |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xC6 |0
+<U00C7> \xC7 |0
+<U00C8> \xC8 |0
+<U00C9> \xC9 |0
+<U00CA> \xCA |0
+<U00CB> \xCB |0
+<U00CC> \xCC |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00CF> \xCF |0
+<U00D1> \xD1 |0
+<U00D2> \xD2 |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D5> \xD5 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xD8 |0
+<U00D9> \xD9 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DF> \xDF |0
+<U00E0> \xE0 |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E3> \xE3 |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xE6 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00EC> \xEC |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F1> \xF1 |0
+<U00F2> \xF2 |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F5> \xF5 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xF8 |0
+<U00F9> \xF9 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U00FF> \xFF |0
+<U011E> \xD0 |0
+<U011F> \xF0 |0
+<U0130> \xDD |0
+<U0131> \xFD |0
+<U015E> \xDE |0
+<U015F> \xFE |0
+<U203E> \xAF |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/MidEast/list.unix b/mcs/class/I18N/MidEast/list.unix
new file mode 100755
index 00000000000..c50c67355cb
--- /dev/null
+++ b/mcs/class/I18N/MidEast/list.unix
@@ -0,0 +1,7 @@
+CP1254.cs
+CP1255.cs
+CP1256.cs
+CP28596.cs
+CP28598.cs
+CP28599.cs
+CP38598.cs
diff --git a/mcs/class/I18N/MidEast/makefile.gnu b/mcs/class/I18N/MidEast/makefile.gnu
new file mode 100755
index 00000000000..534ab9ab2f4
--- /dev/null
+++ b/mcs/class/I18N/MidEast/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../../..
+
+LIBRARY = $(topdir)/class/lib/I18N.MidEast.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r mscorlib -r I18N
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/Other/.cvsignore b/mcs/class/I18N/Other/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/I18N/Other/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/I18N/Other/CP1251.cs b/mcs/class/I18N/Other/CP1251.cs
new file mode 100644
index 00000000000..a160145c4bd
--- /dev/null
+++ b/mcs/class/I18N/Other/CP1251.cs
@@ -0,0 +1,403 @@
+/*
+ * CP1251.cs - Cyrillic (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5347.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP1251 : ByteEncoding
+{
+ public CP1251()
+ : base(1251, ToChars, "Cyrillic (Windows)",
+ "koi8-r", "windows-1251", "windows-1251",
+ true, true, true, true, 1251)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0402', '\u0403', '\u201A', '\u0453',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u20AC', '\u2030',
+ '\u0409', '\u2039', '\u040A', '\u040C', '\u040B', '\u040F',
+ '\u0452', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u0098', '\u2122', '\u0459', '\u203A',
+ '\u045A', '\u045C', '\u045B', '\u045F', '\u00A0', '\u040E',
+ '\u045E', '\u0408', '\u00A4', '\u0490', '\u00A6', '\u00A7',
+ '\u0401', '\u00A9', '\u0404', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u0407', '\u00B0', '\u00B1', '\u0406', '\u0456',
+ '\u0491', '\u00B5', '\u00B6', '\u00B7', '\u0451', '\u2116',
+ '\u0454', '\u00BB', '\u0458', '\u0405', '\u0455', '\u0457',
+ '\u0410', '\u0411', '\u0412', '\u0413', '\u0414', '\u0415',
+ '\u0416', '\u0417', '\u0418', '\u0419', '\u041A', '\u041B',
+ '\u041C', '\u041D', '\u041E', '\u041F', '\u0420', '\u0421',
+ '\u0422', '\u0423', '\u0424', '\u0425', '\u0426', '\u0427',
+ '\u0428', '\u0429', '\u042A', '\u042B', '\u042C', '\u042D',
+ '\u042E', '\u042F', '\u0430', '\u0431', '\u0432', '\u0433',
+ '\u0434', '\u0435', '\u0436', '\u0437', '\u0438', '\u0439',
+ '\u043A', '\u043B', '\u043C', '\u043D', '\u043E', '\u043F',
+ '\u0440', '\u0441', '\u0442', '\u0443', '\u0444', '\u0445',
+ '\u0446', '\u0447', '\u0448', '\u0449', '\u044A', '\u044B',
+ '\u044C', '\u044D', '\u044E', '\u044F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0098:
+ case 0x00A0:
+ case 0x00A4:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00BB:
+ break;
+ case 0x0401: ch = 0xA8; break;
+ case 0x0402: ch = 0x80; break;
+ case 0x0403: ch = 0x81; break;
+ case 0x0404: ch = 0xAA; break;
+ case 0x0405: ch = 0xBD; break;
+ case 0x0406: ch = 0xB2; break;
+ case 0x0407: ch = 0xAF; break;
+ case 0x0408: ch = 0xA3; break;
+ case 0x0409: ch = 0x8A; break;
+ case 0x040A: ch = 0x8C; break;
+ case 0x040B: ch = 0x8E; break;
+ case 0x040C: ch = 0x8D; break;
+ case 0x040E: ch = 0xA1; break;
+ case 0x040F: ch = 0x8F; break;
+ case 0x0410:
+ case 0x0411:
+ case 0x0412:
+ case 0x0413:
+ case 0x0414:
+ case 0x0415:
+ case 0x0416:
+ case 0x0417:
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ case 0x0424:
+ case 0x0425:
+ case 0x0426:
+ case 0x0427:
+ case 0x0428:
+ case 0x0429:
+ case 0x042A:
+ case 0x042B:
+ case 0x042C:
+ case 0x042D:
+ case 0x042E:
+ case 0x042F:
+ case 0x0430:
+ case 0x0431:
+ case 0x0432:
+ case 0x0433:
+ case 0x0434:
+ case 0x0435:
+ case 0x0436:
+ case 0x0437:
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ case 0x0444:
+ case 0x0445:
+ case 0x0446:
+ case 0x0447:
+ case 0x0448:
+ case 0x0449:
+ case 0x044A:
+ case 0x044B:
+ case 0x044C:
+ case 0x044D:
+ case 0x044E:
+ case 0x044F:
+ ch -= 0x0350;
+ break;
+ case 0x0451: ch = 0xB8; break;
+ case 0x0452: ch = 0x90; break;
+ case 0x0453: ch = 0x83; break;
+ case 0x0454: ch = 0xBA; break;
+ case 0x0455: ch = 0xBE; break;
+ case 0x0456: ch = 0xB3; break;
+ case 0x0457: ch = 0xBF; break;
+ case 0x0458: ch = 0xBC; break;
+ case 0x0459: ch = 0x9A; break;
+ case 0x045A: ch = 0x9C; break;
+ case 0x045B: ch = 0x9E; break;
+ case 0x045C: ch = 0x9D; break;
+ case 0x045E: ch = 0xA2; break;
+ case 0x045F: ch = 0x9F; break;
+ case 0x0490: ch = 0xA5; break;
+ case 0x0491: ch = 0xB4; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x88; break;
+ case 0x2116: ch = 0xB9; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0098:
+ case 0x00A0:
+ case 0x00A4:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00BB:
+ break;
+ case 0x0401: ch = 0xA8; break;
+ case 0x0402: ch = 0x80; break;
+ case 0x0403: ch = 0x81; break;
+ case 0x0404: ch = 0xAA; break;
+ case 0x0405: ch = 0xBD; break;
+ case 0x0406: ch = 0xB2; break;
+ case 0x0407: ch = 0xAF; break;
+ case 0x0408: ch = 0xA3; break;
+ case 0x0409: ch = 0x8A; break;
+ case 0x040A: ch = 0x8C; break;
+ case 0x040B: ch = 0x8E; break;
+ case 0x040C: ch = 0x8D; break;
+ case 0x040E: ch = 0xA1; break;
+ case 0x040F: ch = 0x8F; break;
+ case 0x0410:
+ case 0x0411:
+ case 0x0412:
+ case 0x0413:
+ case 0x0414:
+ case 0x0415:
+ case 0x0416:
+ case 0x0417:
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ case 0x0424:
+ case 0x0425:
+ case 0x0426:
+ case 0x0427:
+ case 0x0428:
+ case 0x0429:
+ case 0x042A:
+ case 0x042B:
+ case 0x042C:
+ case 0x042D:
+ case 0x042E:
+ case 0x042F:
+ case 0x0430:
+ case 0x0431:
+ case 0x0432:
+ case 0x0433:
+ case 0x0434:
+ case 0x0435:
+ case 0x0436:
+ case 0x0437:
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ case 0x0444:
+ case 0x0445:
+ case 0x0446:
+ case 0x0447:
+ case 0x0448:
+ case 0x0449:
+ case 0x044A:
+ case 0x044B:
+ case 0x044C:
+ case 0x044D:
+ case 0x044E:
+ case 0x044F:
+ ch -= 0x0350;
+ break;
+ case 0x0451: ch = 0xB8; break;
+ case 0x0452: ch = 0x90; break;
+ case 0x0453: ch = 0x83; break;
+ case 0x0454: ch = 0xBA; break;
+ case 0x0455: ch = 0xBE; break;
+ case 0x0456: ch = 0xB3; break;
+ case 0x0457: ch = 0xBF; break;
+ case 0x0458: ch = 0xBC; break;
+ case 0x0459: ch = 0x9A; break;
+ case 0x045A: ch = 0x9C; break;
+ case 0x045B: ch = 0x9E; break;
+ case 0x045C: ch = 0x9D; break;
+ case 0x045E: ch = 0xA2; break;
+ case 0x045F: ch = 0x9F; break;
+ case 0x0490: ch = 0xA5; break;
+ case 0x0491: ch = 0xB4; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x88; break;
+ case 0x2116: ch = 0xB9; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1251
+
+public class ENCwindows_1251 : CP1251
+{
+ public ENCwindows_1251() : base() {}
+
+}; // class ENCwindows_1251
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP1257.cs b/mcs/class/I18N/Other/CP1257.cs
new file mode 100644
index 00000000000..cac55af6055
--- /dev/null
+++ b/mcs/class/I18N/Other/CP1257.cs
@@ -0,0 +1,395 @@
+/*
+ * CP1257.cs - Baltic (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5353.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP1257 : ByteEncoding
+{
+ public CP1257()
+ : base(1257, ToChars, "Baltic (Windows)",
+ "iso-8859-4", "windows-1257", "windows-1257",
+ true, true, true, true, 1257)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0083',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u0088', '\u2030',
+ '\u008A', '\u2039', '\u008C', '\u00A8', '\u02C7', '\u00B8',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u0098', '\u2122', '\u009A', '\u203A',
+ '\u009C', '\u00AF', '\u02DB', '\u009F', '\u00A0', '\u003F',
+ '\u00A2', '\u00A3', '\u00A4', '\u003F', '\u00A6', '\u00A7',
+ '\u00D8', '\u00A9', '\u0156', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00C6', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00F8', '\u00B9',
+ '\u0157', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00E6',
+ '\u0104', '\u012E', '\u0100', '\u0106', '\u00C4', '\u00C5',
+ '\u0118', '\u0112', '\u010C', '\u00C9', '\u0179', '\u0116',
+ '\u0122', '\u0136', '\u012A', '\u013B', '\u0160', '\u0143',
+ '\u0145', '\u00D3', '\u014C', '\u00D5', '\u00D6', '\u00D7',
+ '\u0172', '\u0141', '\u015A', '\u016A', '\u00DC', '\u017B',
+ '\u017D', '\u00DF', '\u0105', '\u012F', '\u0101', '\u0107',
+ '\u00E4', '\u00E5', '\u0119', '\u0113', '\u010D', '\u00E9',
+ '\u017A', '\u0117', '\u0123', '\u0137', '\u012B', '\u013C',
+ '\u0161', '\u0144', '\u0146', '\u00F3', '\u014D', '\u00F5',
+ '\u00F6', '\u00F7', '\u0173', '\u0142', '\u015B', '\u016B',
+ '\u00FC', '\u017C', '\u017E', '\u02D9',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x0083:
+ case 0x0088:
+ case 0x008A:
+ case 0x008C:
+ case 0x0090:
+ case 0x0098:
+ case 0x009A:
+ case 0x009C:
+ case 0x009F:
+ case 0x00A0:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C9:
+ case 0x00D3:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E9:
+ case 0x00F3:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00FC:
+ break;
+ case 0x00A8: ch = 0x8D; break;
+ case 0x00AF: ch = 0x9D; break;
+ case 0x00B8: ch = 0x8F; break;
+ case 0x00C6: ch = 0xAF; break;
+ case 0x00D8: ch = 0xA8; break;
+ case 0x00E6: ch = 0xBF; break;
+ case 0x00F8: ch = 0xB8; break;
+ case 0x0100: ch = 0xC2; break;
+ case 0x0101: ch = 0xE2; break;
+ case 0x0104: ch = 0xC0; break;
+ case 0x0105: ch = 0xE0; break;
+ case 0x0106: ch = 0xC3; break;
+ case 0x0107: ch = 0xE3; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x0112: ch = 0xC7; break;
+ case 0x0113: ch = 0xE7; break;
+ case 0x0116: ch = 0xCB; break;
+ case 0x0117: ch = 0xEB; break;
+ case 0x0118: ch = 0xC6; break;
+ case 0x0119: ch = 0xE6; break;
+ case 0x0122: ch = 0xCC; break;
+ case 0x0123: ch = 0xEC; break;
+ case 0x012A: ch = 0xCE; break;
+ case 0x012B: ch = 0xEE; break;
+ case 0x012E: ch = 0xC1; break;
+ case 0x012F: ch = 0xE1; break;
+ case 0x0136: ch = 0xCD; break;
+ case 0x0137: ch = 0xED; break;
+ case 0x013B: ch = 0xCF; break;
+ case 0x013C: ch = 0xEF; break;
+ case 0x0141: ch = 0xD9; break;
+ case 0x0142: ch = 0xF9; break;
+ case 0x0143: ch = 0xD1; break;
+ case 0x0144: ch = 0xF1; break;
+ case 0x0145: ch = 0xD2; break;
+ case 0x0146: ch = 0xF2; break;
+ case 0x014C: ch = 0xD4; break;
+ case 0x014D: ch = 0xF4; break;
+ case 0x0156: ch = 0xAA; break;
+ case 0x0157: ch = 0xBA; break;
+ case 0x015A: ch = 0xDA; break;
+ case 0x015B: ch = 0xFA; break;
+ case 0x0160: ch = 0xD0; break;
+ case 0x0161: ch = 0xF0; break;
+ case 0x016A: ch = 0xDB; break;
+ case 0x016B: ch = 0xFB; break;
+ case 0x0172: ch = 0xD8; break;
+ case 0x0173: ch = 0xF8; break;
+ case 0x0179: ch = 0xCA; break;
+ case 0x017A: ch = 0xEA; break;
+ case 0x017B: ch = 0xDD; break;
+ case 0x017C: ch = 0xFD; break;
+ case 0x017D: ch = 0xDE; break;
+ case 0x017E: ch = 0xFE; break;
+ case 0x02C7: ch = 0x8E; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0x9E; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x0083:
+ case 0x0088:
+ case 0x008A:
+ case 0x008C:
+ case 0x0090:
+ case 0x0098:
+ case 0x009A:
+ case 0x009C:
+ case 0x009F:
+ case 0x00A0:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B9:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C9:
+ case 0x00D3:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E9:
+ case 0x00F3:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00FC:
+ break;
+ case 0x00A8: ch = 0x8D; break;
+ case 0x00AF: ch = 0x9D; break;
+ case 0x00B8: ch = 0x8F; break;
+ case 0x00C6: ch = 0xAF; break;
+ case 0x00D8: ch = 0xA8; break;
+ case 0x00E6: ch = 0xBF; break;
+ case 0x00F8: ch = 0xB8; break;
+ case 0x0100: ch = 0xC2; break;
+ case 0x0101: ch = 0xE2; break;
+ case 0x0104: ch = 0xC0; break;
+ case 0x0105: ch = 0xE0; break;
+ case 0x0106: ch = 0xC3; break;
+ case 0x0107: ch = 0xE3; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x0112: ch = 0xC7; break;
+ case 0x0113: ch = 0xE7; break;
+ case 0x0116: ch = 0xCB; break;
+ case 0x0117: ch = 0xEB; break;
+ case 0x0118: ch = 0xC6; break;
+ case 0x0119: ch = 0xE6; break;
+ case 0x0122: ch = 0xCC; break;
+ case 0x0123: ch = 0xEC; break;
+ case 0x012A: ch = 0xCE; break;
+ case 0x012B: ch = 0xEE; break;
+ case 0x012E: ch = 0xC1; break;
+ case 0x012F: ch = 0xE1; break;
+ case 0x0136: ch = 0xCD; break;
+ case 0x0137: ch = 0xED; break;
+ case 0x013B: ch = 0xCF; break;
+ case 0x013C: ch = 0xEF; break;
+ case 0x0141: ch = 0xD9; break;
+ case 0x0142: ch = 0xF9; break;
+ case 0x0143: ch = 0xD1; break;
+ case 0x0144: ch = 0xF1; break;
+ case 0x0145: ch = 0xD2; break;
+ case 0x0146: ch = 0xF2; break;
+ case 0x014C: ch = 0xD4; break;
+ case 0x014D: ch = 0xF4; break;
+ case 0x0156: ch = 0xAA; break;
+ case 0x0157: ch = 0xBA; break;
+ case 0x015A: ch = 0xDA; break;
+ case 0x015B: ch = 0xFA; break;
+ case 0x0160: ch = 0xD0; break;
+ case 0x0161: ch = 0xF0; break;
+ case 0x016A: ch = 0xDB; break;
+ case 0x016B: ch = 0xFB; break;
+ case 0x0172: ch = 0xD8; break;
+ case 0x0173: ch = 0xF8; break;
+ case 0x0179: ch = 0xCA; break;
+ case 0x017A: ch = 0xEA; break;
+ case 0x017B: ch = 0xDD; break;
+ case 0x017C: ch = 0xFD; break;
+ case 0x017D: ch = 0xDE; break;
+ case 0x017E: ch = 0xFE; break;
+ case 0x02C7: ch = 0x8E; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0x9E; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1257
+
+public class ENCwindows_1257 : CP1257
+{
+ public ENCwindows_1257() : base() {}
+
+}; // class ENCwindows_1257
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP1258.cs b/mcs/class/I18N/Other/CP1258.cs
new file mode 100644
index 00000000000..afd266e44ca
--- /dev/null
+++ b/mcs/class/I18N/Other/CP1258.cs
@@ -0,0 +1,399 @@
+/*
+ * CP1258.cs - Vietnamese (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5354.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP1258 : ByteEncoding
+{
+ public CP1258()
+ : base(1258, ToChars, "Vietnamese (Windows)",
+ "windows-1258", "windows-1258", "windows-1258",
+ true, true, true, true, 1258)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0192',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u02C6', '\u2030',
+ '\u008A', '\u2039', '\u0152', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u02DC', '\u2122', '\u009A', '\u203A',
+ '\u0153', '\u009D', '\u009E', '\u0178', '\u00A0', '\u00A1',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9',
+ '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
+ '\u00C0', '\u00C1', '\u00C2', '\u0102', '\u00C4', '\u00C5',
+ '\u00C6', '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB',
+ '\u0300', '\u00CD', '\u00CE', '\u00CF', '\u0110', '\u00D1',
+ '\u0309', '\u00D3', '\u00D4', '\u01A0', '\u00D6', '\u00D7',
+ '\u00D8', '\u00D9', '\u00DA', '\u00DB', '\u00DC', '\u01AF',
+ '\u0303', '\u00DF', '\u00E0', '\u00E1', '\u00E2', '\u0103',
+ '\u00E4', '\u00E5', '\u00E6', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u0301', '\u00ED', '\u00EE', '\u00EF',
+ '\u0111', '\u00F1', '\u0323', '\u00F3', '\u00F4', '\u01A1',
+ '\u00F6', '\u00F7', '\u00F8', '\u00F9', '\u00FA', '\u00FB',
+ '\u00FC', '\u01B0', '\u20AB', '\u00FF',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008A:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x009A:
+ case 0x009D:
+ case 0x009E:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D1:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FF:
+ break;
+ case 0x0102: ch = 0xC3; break;
+ case 0x0103: ch = 0xE3; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x0178: ch = 0x9F; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x01A0: ch = 0xD5; break;
+ case 0x01A1: ch = 0xF5; break;
+ case 0x01AF: ch = 0xDD; break;
+ case 0x01B0: ch = 0xFD; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x0300: ch = 0xCC; break;
+ case 0x0301: ch = 0xEC; break;
+ case 0x0303: ch = 0xDE; break;
+ case 0x0309: ch = 0xD2; break;
+ case 0x0323: ch = 0xF2; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AB: ch = 0xFE; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008A:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x009A:
+ case 0x009D:
+ case 0x009E:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D1:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FF:
+ break;
+ case 0x0102: ch = 0xC3; break;
+ case 0x0103: ch = 0xE3; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x0178: ch = 0x9F; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x01A0: ch = 0xD5; break;
+ case 0x01A1: ch = 0xF5; break;
+ case 0x01AF: ch = 0xDD; break;
+ case 0x01B0: ch = 0xFD; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x0300: ch = 0xCC; break;
+ case 0x0301: ch = 0xEC; break;
+ case 0x0303: ch = 0xDE; break;
+ case 0x0309: ch = 0xD2; break;
+ case 0x0323: ch = 0xF2; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AB: ch = 0xFE; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1258
+
+public class ENCwindows_1258 : CP1258
+{
+ public ENCwindows_1258() : base() {}
+
+}; // class ENCwindows_1258
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP20866.cs b/mcs/class/I18N/Other/CP20866.cs
new file mode 100644
index 00000000000..f6fe27016dc
--- /dev/null
+++ b/mcs/class/I18N/Other/CP20866.cs
@@ -0,0 +1,429 @@
+/*
+ * CP20866.cs - Cyrillic (KOI8-R) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-878.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP20866 : ByteEncoding
+{
+ public CP20866()
+ : base(20866, ToChars, "Cyrillic (KOI8-R)",
+ "koi8-r", "koi8-r", "koi8-r",
+ true, true, true, true, 1251)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u2500', '\u2502', '\u250C', '\u2510',
+ '\u2514', '\u2518', '\u251C', '\u2524', '\u252C', '\u2534',
+ '\u253C', '\u2580', '\u2584', '\u2588', '\u258C', '\u2590',
+ '\u2591', '\u2592', '\u2593', '\u2320', '\u25A0', '\u2219',
+ '\u221A', '\u2248', '\u2264', '\u2265', '\u00A0', '\u2321',
+ '\u00B0', '\u00B2', '\u00B7', '\u00F7', '\u2550', '\u2551',
+ '\u2552', '\u0451', '\u2553', '\u2554', '\u2555', '\u2556',
+ '\u2557', '\u2558', '\u2559', '\u255A', '\u255B', '\u255C',
+ '\u255D', '\u255E', '\u255F', '\u2560', '\u2561', '\u0401',
+ '\u2562', '\u2563', '\u2564', '\u2565', '\u2566', '\u2567',
+ '\u2568', '\u2569', '\u256A', '\u256B', '\u256C', '\u00A9',
+ '\u044E', '\u0430', '\u0431', '\u0446', '\u0434', '\u0435',
+ '\u0444', '\u0433', '\u0445', '\u0438', '\u0439', '\u043A',
+ '\u043B', '\u043C', '\u043D', '\u043E', '\u043F', '\u044F',
+ '\u0440', '\u0441', '\u0442', '\u0443', '\u0436', '\u0432',
+ '\u044C', '\u044B', '\u0437', '\u0448', '\u044D', '\u0449',
+ '\u0447', '\u044A', '\u042E', '\u0410', '\u0411', '\u0426',
+ '\u0414', '\u0415', '\u0424', '\u0413', '\u0425', '\u0418',
+ '\u0419', '\u041A', '\u041B', '\u041C', '\u041D', '\u041E',
+ '\u041F', '\u042F', '\u0420', '\u0421', '\u0422', '\u0423',
+ '\u0416', '\u0412', '\u042C', '\u042B', '\u0417', '\u0428',
+ '\u042D', '\u0429', '\u0427', '\u042A',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A0: ch = 0x9A; break;
+ case 0x00A9: ch = 0xBF; break;
+ case 0x00B0: ch = 0x9C; break;
+ case 0x00B2: ch = 0x9D; break;
+ case 0x00B7: ch = 0x9E; break;
+ case 0x00F7: ch = 0x9F; break;
+ case 0x0401: ch = 0xB3; break;
+ case 0x0410: ch = 0xE1; break;
+ case 0x0411: ch = 0xE2; break;
+ case 0x0412: ch = 0xF7; break;
+ case 0x0413: ch = 0xE7; break;
+ case 0x0414: ch = 0xE4; break;
+ case 0x0415: ch = 0xE5; break;
+ case 0x0416: ch = 0xF6; break;
+ case 0x0417: ch = 0xFA; break;
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ ch -= 0x032F;
+ break;
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ ch -= 0x032E;
+ break;
+ case 0x0424: ch = 0xE6; break;
+ case 0x0425: ch = 0xE8; break;
+ case 0x0426: ch = 0xE3; break;
+ case 0x0427: ch = 0xFE; break;
+ case 0x0428: ch = 0xFB; break;
+ case 0x0429: ch = 0xFD; break;
+ case 0x042A: ch = 0xFF; break;
+ case 0x042B: ch = 0xF9; break;
+ case 0x042C: ch = 0xF8; break;
+ case 0x042D: ch = 0xFC; break;
+ case 0x042E: ch = 0xE0; break;
+ case 0x042F: ch = 0xF1; break;
+ case 0x0430: ch = 0xC1; break;
+ case 0x0431: ch = 0xC2; break;
+ case 0x0432: ch = 0xD7; break;
+ case 0x0433: ch = 0xC7; break;
+ case 0x0434: ch = 0xC4; break;
+ case 0x0435: ch = 0xC5; break;
+ case 0x0436: ch = 0xD6; break;
+ case 0x0437: ch = 0xDA; break;
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x036F;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ ch -= 0x036E;
+ break;
+ case 0x0444: ch = 0xC6; break;
+ case 0x0445: ch = 0xC8; break;
+ case 0x0446: ch = 0xC3; break;
+ case 0x0447: ch = 0xDE; break;
+ case 0x0448: ch = 0xDB; break;
+ case 0x0449: ch = 0xDD; break;
+ case 0x044A: ch = 0xDF; break;
+ case 0x044B: ch = 0xD9; break;
+ case 0x044C: ch = 0xD8; break;
+ case 0x044D: ch = 0xDC; break;
+ case 0x044E: ch = 0xC0; break;
+ case 0x044F: ch = 0xD1; break;
+ case 0x0451: ch = 0xA3; break;
+ case 0x2219: ch = 0x95; break;
+ case 0x221A: ch = 0x96; break;
+ case 0x2248: ch = 0x97; break;
+ case 0x2264: ch = 0x98; break;
+ case 0x2265: ch = 0x99; break;
+ case 0x2320: ch = 0x93; break;
+ case 0x2321: ch = 0x9B; break;
+ case 0x2500: ch = 0x80; break;
+ case 0x2502: ch = 0x81; break;
+ case 0x250C: ch = 0x82; break;
+ case 0x2510: ch = 0x83; break;
+ case 0x2514: ch = 0x84; break;
+ case 0x2518: ch = 0x85; break;
+ case 0x251C: ch = 0x86; break;
+ case 0x2524: ch = 0x87; break;
+ case 0x252C: ch = 0x88; break;
+ case 0x2534: ch = 0x89; break;
+ case 0x253C: ch = 0x8A; break;
+ case 0x2550: ch = 0xA0; break;
+ case 0x2551: ch = 0xA1; break;
+ case 0x2552: ch = 0xA2; break;
+ case 0x2553:
+ case 0x2554:
+ case 0x2555:
+ case 0x2556:
+ case 0x2557:
+ case 0x2558:
+ case 0x2559:
+ case 0x255A:
+ case 0x255B:
+ case 0x255C:
+ case 0x255D:
+ case 0x255E:
+ case 0x255F:
+ case 0x2560:
+ case 0x2561:
+ ch -= 0x24AF;
+ break;
+ case 0x2562:
+ case 0x2563:
+ case 0x2564:
+ case 0x2565:
+ case 0x2566:
+ case 0x2567:
+ case 0x2568:
+ case 0x2569:
+ case 0x256A:
+ case 0x256B:
+ case 0x256C:
+ ch -= 0x24AE;
+ break;
+ case 0x2580: ch = 0x8B; break;
+ case 0x2584: ch = 0x8C; break;
+ case 0x2588: ch = 0x8D; break;
+ case 0x258C: ch = 0x8E; break;
+ case 0x2590:
+ case 0x2591:
+ case 0x2592:
+ case 0x2593:
+ ch -= 0x2501;
+ break;
+ case 0x25A0: ch = 0x94; break;
+ case 0xFFE8: ch = 0x81; break;
+ case 0xFFED: ch = 0x94; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A0: ch = 0x9A; break;
+ case 0x00A9: ch = 0xBF; break;
+ case 0x00B0: ch = 0x9C; break;
+ case 0x00B2: ch = 0x9D; break;
+ case 0x00B7: ch = 0x9E; break;
+ case 0x00F7: ch = 0x9F; break;
+ case 0x0401: ch = 0xB3; break;
+ case 0x0410: ch = 0xE1; break;
+ case 0x0411: ch = 0xE2; break;
+ case 0x0412: ch = 0xF7; break;
+ case 0x0413: ch = 0xE7; break;
+ case 0x0414: ch = 0xE4; break;
+ case 0x0415: ch = 0xE5; break;
+ case 0x0416: ch = 0xF6; break;
+ case 0x0417: ch = 0xFA; break;
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ ch -= 0x032F;
+ break;
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ ch -= 0x032E;
+ break;
+ case 0x0424: ch = 0xE6; break;
+ case 0x0425: ch = 0xE8; break;
+ case 0x0426: ch = 0xE3; break;
+ case 0x0427: ch = 0xFE; break;
+ case 0x0428: ch = 0xFB; break;
+ case 0x0429: ch = 0xFD; break;
+ case 0x042A: ch = 0xFF; break;
+ case 0x042B: ch = 0xF9; break;
+ case 0x042C: ch = 0xF8; break;
+ case 0x042D: ch = 0xFC; break;
+ case 0x042E: ch = 0xE0; break;
+ case 0x042F: ch = 0xF1; break;
+ case 0x0430: ch = 0xC1; break;
+ case 0x0431: ch = 0xC2; break;
+ case 0x0432: ch = 0xD7; break;
+ case 0x0433: ch = 0xC7; break;
+ case 0x0434: ch = 0xC4; break;
+ case 0x0435: ch = 0xC5; break;
+ case 0x0436: ch = 0xD6; break;
+ case 0x0437: ch = 0xDA; break;
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x036F;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ ch -= 0x036E;
+ break;
+ case 0x0444: ch = 0xC6; break;
+ case 0x0445: ch = 0xC8; break;
+ case 0x0446: ch = 0xC3; break;
+ case 0x0447: ch = 0xDE; break;
+ case 0x0448: ch = 0xDB; break;
+ case 0x0449: ch = 0xDD; break;
+ case 0x044A: ch = 0xDF; break;
+ case 0x044B: ch = 0xD9; break;
+ case 0x044C: ch = 0xD8; break;
+ case 0x044D: ch = 0xDC; break;
+ case 0x044E: ch = 0xC0; break;
+ case 0x044F: ch = 0xD1; break;
+ case 0x0451: ch = 0xA3; break;
+ case 0x2219: ch = 0x95; break;
+ case 0x221A: ch = 0x96; break;
+ case 0x2248: ch = 0x97; break;
+ case 0x2264: ch = 0x98; break;
+ case 0x2265: ch = 0x99; break;
+ case 0x2320: ch = 0x93; break;
+ case 0x2321: ch = 0x9B; break;
+ case 0x2500: ch = 0x80; break;
+ case 0x2502: ch = 0x81; break;
+ case 0x250C: ch = 0x82; break;
+ case 0x2510: ch = 0x83; break;
+ case 0x2514: ch = 0x84; break;
+ case 0x2518: ch = 0x85; break;
+ case 0x251C: ch = 0x86; break;
+ case 0x2524: ch = 0x87; break;
+ case 0x252C: ch = 0x88; break;
+ case 0x2534: ch = 0x89; break;
+ case 0x253C: ch = 0x8A; break;
+ case 0x2550: ch = 0xA0; break;
+ case 0x2551: ch = 0xA1; break;
+ case 0x2552: ch = 0xA2; break;
+ case 0x2553:
+ case 0x2554:
+ case 0x2555:
+ case 0x2556:
+ case 0x2557:
+ case 0x2558:
+ case 0x2559:
+ case 0x255A:
+ case 0x255B:
+ case 0x255C:
+ case 0x255D:
+ case 0x255E:
+ case 0x255F:
+ case 0x2560:
+ case 0x2561:
+ ch -= 0x24AF;
+ break;
+ case 0x2562:
+ case 0x2563:
+ case 0x2564:
+ case 0x2565:
+ case 0x2566:
+ case 0x2567:
+ case 0x2568:
+ case 0x2569:
+ case 0x256A:
+ case 0x256B:
+ case 0x256C:
+ ch -= 0x24AE;
+ break;
+ case 0x2580: ch = 0x8B; break;
+ case 0x2584: ch = 0x8C; break;
+ case 0x2588: ch = 0x8D; break;
+ case 0x258C: ch = 0x8E; break;
+ case 0x2590:
+ case 0x2591:
+ case 0x2592:
+ case 0x2593:
+ ch -= 0x2501;
+ break;
+ case 0x25A0: ch = 0x94; break;
+ case 0xFFE8: ch = 0x81; break;
+ case 0xFFED: ch = 0x94; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20866
+
+public class ENCkoi8_r : CP20866
+{
+ public ENCkoi8_r() : base() {}
+
+}; // class ENCkoi8_r
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP21866.cs b/mcs/class/I18N/Other/CP21866.cs
new file mode 100644
index 00000000000..a8caecea347
--- /dev/null
+++ b/mcs/class/I18N/Other/CP21866.cs
@@ -0,0 +1,429 @@
+/*
+ * CP21866.cs - Ukrainian (KOI8-U) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "koi8-u.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP21866 : ByteEncoding
+{
+ public CP21866()
+ : base(21866, ToChars, "Ukrainian (KOI8-U)",
+ "koi8-u", "koi8-u", "koi8-u",
+ true, true, true, true, 1251)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u2500', '\u2502', '\u250C', '\u2510',
+ '\u2514', '\u2518', '\u251C', '\u2524', '\u252C', '\u2534',
+ '\u253C', '\u2580', '\u2584', '\u2588', '\u258C', '\u2590',
+ '\u2591', '\u2592', '\u2593', '\u2320', '\u25A0', '\u2219',
+ '\u221A', '\u2248', '\u2264', '\u2265', '\u00A0', '\u2321',
+ '\u00B0', '\u00B2', '\u00B7', '\u00F7', '\u2550', '\u2551',
+ '\u2552', '\u0451', '\u0454', '\u2554', '\u0456', '\u0457',
+ '\u2557', '\u2558', '\u2559', '\u255A', '\u255B', '\u0491',
+ '\u255D', '\u255E', '\u255F', '\u2560', '\u2561', '\u0401',
+ '\u0404', '\u2563', '\u0406', '\u0407', '\u2566', '\u2567',
+ '\u2568', '\u2569', '\u256A', '\u0490', '\u256C', '\u00A9',
+ '\u044E', '\u0430', '\u0431', '\u0446', '\u0434', '\u0435',
+ '\u0444', '\u0433', '\u0445', '\u0438', '\u0439', '\u043A',
+ '\u043B', '\u043C', '\u043D', '\u043E', '\u043F', '\u044F',
+ '\u0440', '\u0441', '\u0442', '\u0443', '\u0436', '\u0432',
+ '\u044C', '\u044B', '\u0437', '\u0448', '\u044D', '\u0449',
+ '\u0447', '\u044A', '\u042E', '\u0410', '\u0411', '\u0426',
+ '\u0414', '\u0415', '\u0424', '\u0413', '\u0425', '\u0418',
+ '\u0419', '\u041A', '\u041B', '\u041C', '\u041D', '\u041E',
+ '\u041F', '\u042F', '\u0420', '\u0421', '\u0422', '\u0423',
+ '\u0416', '\u0412', '\u042C', '\u042B', '\u0417', '\u0428',
+ '\u042D', '\u0429', '\u0427', '\u042A',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A0: ch = 0x9A; break;
+ case 0x00A9: ch = 0xBF; break;
+ case 0x00B0: ch = 0x9C; break;
+ case 0x00B2: ch = 0x9D; break;
+ case 0x00B7: ch = 0x9E; break;
+ case 0x00F7: ch = 0x9F; break;
+ case 0x0401: ch = 0xB3; break;
+ case 0x0404: ch = 0xB4; break;
+ case 0x0406: ch = 0xB6; break;
+ case 0x0407: ch = 0xB7; break;
+ case 0x0410: ch = 0xE1; break;
+ case 0x0411: ch = 0xE2; break;
+ case 0x0412: ch = 0xF7; break;
+ case 0x0413: ch = 0xE7; break;
+ case 0x0414: ch = 0xE4; break;
+ case 0x0415: ch = 0xE5; break;
+ case 0x0416: ch = 0xF6; break;
+ case 0x0417: ch = 0xFA; break;
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ ch -= 0x032F;
+ break;
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ ch -= 0x032E;
+ break;
+ case 0x0424: ch = 0xE6; break;
+ case 0x0425: ch = 0xE8; break;
+ case 0x0426: ch = 0xE3; break;
+ case 0x0427: ch = 0xFE; break;
+ case 0x0428: ch = 0xFB; break;
+ case 0x0429: ch = 0xFD; break;
+ case 0x042A: ch = 0xFF; break;
+ case 0x042B: ch = 0xF9; break;
+ case 0x042C: ch = 0xF8; break;
+ case 0x042D: ch = 0xFC; break;
+ case 0x042E: ch = 0xE0; break;
+ case 0x042F: ch = 0xF1; break;
+ case 0x0430: ch = 0xC1; break;
+ case 0x0431: ch = 0xC2; break;
+ case 0x0432: ch = 0xD7; break;
+ case 0x0433: ch = 0xC7; break;
+ case 0x0434: ch = 0xC4; break;
+ case 0x0435: ch = 0xC5; break;
+ case 0x0436: ch = 0xD6; break;
+ case 0x0437: ch = 0xDA; break;
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x036F;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ ch -= 0x036E;
+ break;
+ case 0x0444: ch = 0xC6; break;
+ case 0x0445: ch = 0xC8; break;
+ case 0x0446: ch = 0xC3; break;
+ case 0x0447: ch = 0xDE; break;
+ case 0x0448: ch = 0xDB; break;
+ case 0x0449: ch = 0xDD; break;
+ case 0x044A: ch = 0xDF; break;
+ case 0x044B: ch = 0xD9; break;
+ case 0x044C: ch = 0xD8; break;
+ case 0x044D: ch = 0xDC; break;
+ case 0x044E: ch = 0xC0; break;
+ case 0x044F: ch = 0xD1; break;
+ case 0x0451: ch = 0xA3; break;
+ case 0x0454: ch = 0xA4; break;
+ case 0x0456: ch = 0xA6; break;
+ case 0x0457: ch = 0xA7; break;
+ case 0x0490: ch = 0xBD; break;
+ case 0x0491: ch = 0xAD; break;
+ case 0x2219: ch = 0x95; break;
+ case 0x221A: ch = 0x96; break;
+ case 0x2248: ch = 0x97; break;
+ case 0x2264: ch = 0x98; break;
+ case 0x2265: ch = 0x99; break;
+ case 0x2320: ch = 0x93; break;
+ case 0x2321: ch = 0x9B; break;
+ case 0x2500: ch = 0x80; break;
+ case 0x2502: ch = 0x81; break;
+ case 0x250C: ch = 0x82; break;
+ case 0x2510: ch = 0x83; break;
+ case 0x2514: ch = 0x84; break;
+ case 0x2518: ch = 0x85; break;
+ case 0x251C: ch = 0x86; break;
+ case 0x2524: ch = 0x87; break;
+ case 0x252C: ch = 0x88; break;
+ case 0x2534: ch = 0x89; break;
+ case 0x253C: ch = 0x8A; break;
+ case 0x2550: ch = 0xA0; break;
+ case 0x2551: ch = 0xA1; break;
+ case 0x2552: ch = 0xA2; break;
+ case 0x2554: ch = 0xA5; break;
+ case 0x2557:
+ case 0x2558:
+ case 0x2559:
+ case 0x255A:
+ case 0x255B:
+ ch -= 0x24AF;
+ break;
+ case 0x255D:
+ case 0x255E:
+ case 0x255F:
+ case 0x2560:
+ case 0x2561:
+ ch -= 0x24AF;
+ break;
+ case 0x2563: ch = 0xB5; break;
+ case 0x2566:
+ case 0x2567:
+ case 0x2568:
+ case 0x2569:
+ case 0x256A:
+ ch -= 0x24AE;
+ break;
+ case 0x256C: ch = 0xBE; break;
+ case 0x2580: ch = 0x8B; break;
+ case 0x2584: ch = 0x8C; break;
+ case 0x2588: ch = 0x8D; break;
+ case 0x258C: ch = 0x8E; break;
+ case 0x2590:
+ case 0x2591:
+ case 0x2592:
+ case 0x2593:
+ ch -= 0x2501;
+ break;
+ case 0x25A0: ch = 0x94; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A0: ch = 0x9A; break;
+ case 0x00A9: ch = 0xBF; break;
+ case 0x00B0: ch = 0x9C; break;
+ case 0x00B2: ch = 0x9D; break;
+ case 0x00B7: ch = 0x9E; break;
+ case 0x00F7: ch = 0x9F; break;
+ case 0x0401: ch = 0xB3; break;
+ case 0x0404: ch = 0xB4; break;
+ case 0x0406: ch = 0xB6; break;
+ case 0x0407: ch = 0xB7; break;
+ case 0x0410: ch = 0xE1; break;
+ case 0x0411: ch = 0xE2; break;
+ case 0x0412: ch = 0xF7; break;
+ case 0x0413: ch = 0xE7; break;
+ case 0x0414: ch = 0xE4; break;
+ case 0x0415: ch = 0xE5; break;
+ case 0x0416: ch = 0xF6; break;
+ case 0x0417: ch = 0xFA; break;
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ ch -= 0x032F;
+ break;
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ ch -= 0x032E;
+ break;
+ case 0x0424: ch = 0xE6; break;
+ case 0x0425: ch = 0xE8; break;
+ case 0x0426: ch = 0xE3; break;
+ case 0x0427: ch = 0xFE; break;
+ case 0x0428: ch = 0xFB; break;
+ case 0x0429: ch = 0xFD; break;
+ case 0x042A: ch = 0xFF; break;
+ case 0x042B: ch = 0xF9; break;
+ case 0x042C: ch = 0xF8; break;
+ case 0x042D: ch = 0xFC; break;
+ case 0x042E: ch = 0xE0; break;
+ case 0x042F: ch = 0xF1; break;
+ case 0x0430: ch = 0xC1; break;
+ case 0x0431: ch = 0xC2; break;
+ case 0x0432: ch = 0xD7; break;
+ case 0x0433: ch = 0xC7; break;
+ case 0x0434: ch = 0xC4; break;
+ case 0x0435: ch = 0xC5; break;
+ case 0x0436: ch = 0xD6; break;
+ case 0x0437: ch = 0xDA; break;
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x036F;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ ch -= 0x036E;
+ break;
+ case 0x0444: ch = 0xC6; break;
+ case 0x0445: ch = 0xC8; break;
+ case 0x0446: ch = 0xC3; break;
+ case 0x0447: ch = 0xDE; break;
+ case 0x0448: ch = 0xDB; break;
+ case 0x0449: ch = 0xDD; break;
+ case 0x044A: ch = 0xDF; break;
+ case 0x044B: ch = 0xD9; break;
+ case 0x044C: ch = 0xD8; break;
+ case 0x044D: ch = 0xDC; break;
+ case 0x044E: ch = 0xC0; break;
+ case 0x044F: ch = 0xD1; break;
+ case 0x0451: ch = 0xA3; break;
+ case 0x0454: ch = 0xA4; break;
+ case 0x0456: ch = 0xA6; break;
+ case 0x0457: ch = 0xA7; break;
+ case 0x0490: ch = 0xBD; break;
+ case 0x0491: ch = 0xAD; break;
+ case 0x2219: ch = 0x95; break;
+ case 0x221A: ch = 0x96; break;
+ case 0x2248: ch = 0x97; break;
+ case 0x2264: ch = 0x98; break;
+ case 0x2265: ch = 0x99; break;
+ case 0x2320: ch = 0x93; break;
+ case 0x2321: ch = 0x9B; break;
+ case 0x2500: ch = 0x80; break;
+ case 0x2502: ch = 0x81; break;
+ case 0x250C: ch = 0x82; break;
+ case 0x2510: ch = 0x83; break;
+ case 0x2514: ch = 0x84; break;
+ case 0x2518: ch = 0x85; break;
+ case 0x251C: ch = 0x86; break;
+ case 0x2524: ch = 0x87; break;
+ case 0x252C: ch = 0x88; break;
+ case 0x2534: ch = 0x89; break;
+ case 0x253C: ch = 0x8A; break;
+ case 0x2550: ch = 0xA0; break;
+ case 0x2551: ch = 0xA1; break;
+ case 0x2552: ch = 0xA2; break;
+ case 0x2554: ch = 0xA5; break;
+ case 0x2557:
+ case 0x2558:
+ case 0x2559:
+ case 0x255A:
+ case 0x255B:
+ ch -= 0x24AF;
+ break;
+ case 0x255D:
+ case 0x255E:
+ case 0x255F:
+ case 0x2560:
+ case 0x2561:
+ ch -= 0x24AF;
+ break;
+ case 0x2563: ch = 0xB5; break;
+ case 0x2566:
+ case 0x2567:
+ case 0x2568:
+ case 0x2569:
+ case 0x256A:
+ ch -= 0x24AE;
+ break;
+ case 0x256C: ch = 0xBE; break;
+ case 0x2580: ch = 0x8B; break;
+ case 0x2584: ch = 0x8C; break;
+ case 0x2588: ch = 0x8D; break;
+ case 0x258C: ch = 0x8E; break;
+ case 0x2590:
+ case 0x2591:
+ case 0x2592:
+ case 0x2593:
+ ch -= 0x2501;
+ break;
+ case 0x25A0: ch = 0x94; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP21866
+
+public class ENCkoi8_u : CP21866
+{
+ public ENCkoi8_u() : base() {}
+
+}; // class ENCkoi8_u
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP28594.cs b/mcs/class/I18N/Other/CP28594.cs
new file mode 100644
index 00000000000..c8ca59fdfad
--- /dev/null
+++ b/mcs/class/I18N/Other/CP28594.cs
@@ -0,0 +1,333 @@
+/*
+ * CP28594.cs - Baltic (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-914.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP28594 : ByteEncoding
+{
+ public CP28594()
+ : base(28594, ToChars, "Baltic (ISO)",
+ "iso-8859-4", "iso-8859-4", "iso-8859-4",
+ true, true, true, true, 1257)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u0104',
+ '\u0138', '\u0156', '\u00A4', '\u0128', '\u013B', '\u00A7',
+ '\u00A8', '\u0160', '\u0112', '\u0122', '\u0166', '\u00AD',
+ '\u017D', '\u00AF', '\u00B0', '\u0105', '\u02DB', '\u0157',
+ '\u00B4', '\u0129', '\u013C', '\u02C7', '\u00B8', '\u0161',
+ '\u0113', '\u0123', '\u0167', '\u014A', '\u017E', '\u014B',
+ '\u0100', '\u00C1', '\u00C2', '\u00C3', '\u00C4', '\u00C5',
+ '\u00C6', '\u012E', '\u010C', '\u00C9', '\u0118', '\u00CB',
+ '\u0116', '\u00CD', '\u00CE', '\u012A', '\u0110', '\u0145',
+ '\u014C', '\u0136', '\u00D4', '\u00D5', '\u00D6', '\u00D7',
+ '\u00D8', '\u0172', '\u00DA', '\u00DB', '\u00DC', '\u0168',
+ '\u016A', '\u00DF', '\u0101', '\u00E1', '\u00E2', '\u00E3',
+ '\u00E4', '\u00E5', '\u00E6', '\u012F', '\u010D', '\u00E9',
+ '\u0119', '\u00EB', '\u0117', '\u00ED', '\u00EE', '\u012B',
+ '\u0111', '\u0146', '\u014D', '\u0137', '\u00F4', '\u00F5',
+ '\u00F6', '\u00F7', '\u00F8', '\u0173', '\u00FA', '\u00FB',
+ '\u00FC', '\u0169', '\u016B', '\u02D9',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00AD:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B4:
+ case 0x00B8:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C9:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E9:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ break;
+ case 0x0100: ch = 0xC0; break;
+ case 0x0101: ch = 0xE0; break;
+ case 0x0104: ch = 0xA1; break;
+ case 0x0105: ch = 0xB1; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0112: ch = 0xAA; break;
+ case 0x0113: ch = 0xBA; break;
+ case 0x0116: ch = 0xCC; break;
+ case 0x0117: ch = 0xEC; break;
+ case 0x0118: ch = 0xCA; break;
+ case 0x0119: ch = 0xEA; break;
+ case 0x0122: ch = 0xAB; break;
+ case 0x0123: ch = 0xBB; break;
+ case 0x0128: ch = 0xA5; break;
+ case 0x0129: ch = 0xB5; break;
+ case 0x012A: ch = 0xCF; break;
+ case 0x012B: ch = 0xEF; break;
+ case 0x012E: ch = 0xC7; break;
+ case 0x012F: ch = 0xE7; break;
+ case 0x0136: ch = 0xD3; break;
+ case 0x0137: ch = 0xF3; break;
+ case 0x0138: ch = 0xA2; break;
+ case 0x013B: ch = 0xA6; break;
+ case 0x013C: ch = 0xB6; break;
+ case 0x0145: ch = 0xD1; break;
+ case 0x0146: ch = 0xF1; break;
+ case 0x014A: ch = 0xBD; break;
+ case 0x014B: ch = 0xBF; break;
+ case 0x014C: ch = 0xD2; break;
+ case 0x014D: ch = 0xF2; break;
+ case 0x0156: ch = 0xA3; break;
+ case 0x0157: ch = 0xB3; break;
+ case 0x0160: ch = 0xA9; break;
+ case 0x0161: ch = 0xB9; break;
+ case 0x0166: ch = 0xAC; break;
+ case 0x0167: ch = 0xBC; break;
+ case 0x0168: ch = 0xDD; break;
+ case 0x0169: ch = 0xFD; break;
+ case 0x016A: ch = 0xDE; break;
+ case 0x016B: ch = 0xFE; break;
+ case 0x0172: ch = 0xD9; break;
+ case 0x0173: ch = 0xF9; break;
+ case 0x017D: ch = 0xAE; break;
+ case 0x017E: ch = 0xBE; break;
+ case 0x02C7: ch = 0xB7; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0xB2; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00AD:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B4:
+ case 0x00B8:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C9:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E9:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ break;
+ case 0x0100: ch = 0xC0; break;
+ case 0x0101: ch = 0xE0; break;
+ case 0x0104: ch = 0xA1; break;
+ case 0x0105: ch = 0xB1; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0112: ch = 0xAA; break;
+ case 0x0113: ch = 0xBA; break;
+ case 0x0116: ch = 0xCC; break;
+ case 0x0117: ch = 0xEC; break;
+ case 0x0118: ch = 0xCA; break;
+ case 0x0119: ch = 0xEA; break;
+ case 0x0122: ch = 0xAB; break;
+ case 0x0123: ch = 0xBB; break;
+ case 0x0128: ch = 0xA5; break;
+ case 0x0129: ch = 0xB5; break;
+ case 0x012A: ch = 0xCF; break;
+ case 0x012B: ch = 0xEF; break;
+ case 0x012E: ch = 0xC7; break;
+ case 0x012F: ch = 0xE7; break;
+ case 0x0136: ch = 0xD3; break;
+ case 0x0137: ch = 0xF3; break;
+ case 0x0138: ch = 0xA2; break;
+ case 0x013B: ch = 0xA6; break;
+ case 0x013C: ch = 0xB6; break;
+ case 0x0145: ch = 0xD1; break;
+ case 0x0146: ch = 0xF1; break;
+ case 0x014A: ch = 0xBD; break;
+ case 0x014B: ch = 0xBF; break;
+ case 0x014C: ch = 0xD2; break;
+ case 0x014D: ch = 0xF2; break;
+ case 0x0156: ch = 0xA3; break;
+ case 0x0157: ch = 0xB3; break;
+ case 0x0160: ch = 0xA9; break;
+ case 0x0161: ch = 0xB9; break;
+ case 0x0166: ch = 0xAC; break;
+ case 0x0167: ch = 0xBC; break;
+ case 0x0168: ch = 0xDD; break;
+ case 0x0169: ch = 0xFD; break;
+ case 0x016A: ch = 0xDE; break;
+ case 0x016B: ch = 0xFE; break;
+ case 0x0172: ch = 0xD9; break;
+ case 0x0173: ch = 0xF9; break;
+ case 0x017D: ch = 0xAE; break;
+ case 0x017E: ch = 0xBE; break;
+ case 0x02C7: ch = 0xB7; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0xB2; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28594
+
+public class ENCiso_8859_4 : CP28594
+{
+ public ENCiso_8859_4() : base() {}
+
+}; // class ENCiso_8859_4
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP28595.cs b/mcs/class/I18N/Other/CP28595.cs
new file mode 100644
index 00000000000..6c8abbc37a7
--- /dev/null
+++ b/mcs/class/I18N/Other/CP28595.cs
@@ -0,0 +1,345 @@
+/*
+ * CP28595.cs - Cyrillic (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-915.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP28595 : ByteEncoding
+{
+ public CP28595()
+ : base(28595, ToChars, "Cyrillic (ISO)",
+ "iso-8859-5", "iso-8859-5", "iso-8859-5",
+ true, true, true, true, 1251)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u0401',
+ '\u0402', '\u0403', '\u0404', '\u0405', '\u0406', '\u0407',
+ '\u0408', '\u0409', '\u040A', '\u040B', '\u040C', '\u00AD',
+ '\u040E', '\u040F', '\u0410', '\u0411', '\u0412', '\u0413',
+ '\u0414', '\u0415', '\u0416', '\u0417', '\u0418', '\u0419',
+ '\u041A', '\u041B', '\u041C', '\u041D', '\u041E', '\u041F',
+ '\u0420', '\u0421', '\u0422', '\u0423', '\u0424', '\u0425',
+ '\u0426', '\u0427', '\u0428', '\u0429', '\u042A', '\u042B',
+ '\u042C', '\u042D', '\u042E', '\u042F', '\u0430', '\u0431',
+ '\u0432', '\u0433', '\u0434', '\u0435', '\u0436', '\u0437',
+ '\u0438', '\u0439', '\u043A', '\u043B', '\u043C', '\u043D',
+ '\u043E', '\u043F', '\u0440', '\u0441', '\u0442', '\u0443',
+ '\u0444', '\u0445', '\u0446', '\u0447', '\u0448', '\u0449',
+ '\u044A', '\u044B', '\u044C', '\u044D', '\u044E', '\u044F',
+ '\u2116', '\u0451', '\u0452', '\u0453', '\u0454', '\u0455',
+ '\u0456', '\u0457', '\u0458', '\u0459', '\u045A', '\u045B',
+ '\u045C', '\u00A7', '\u045E', '\u045F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00AD:
+ break;
+ case 0x00A7: ch = 0xFD; break;
+ case 0x0401:
+ case 0x0402:
+ case 0x0403:
+ case 0x0404:
+ case 0x0405:
+ case 0x0406:
+ case 0x0407:
+ case 0x0408:
+ case 0x0409:
+ case 0x040A:
+ case 0x040B:
+ case 0x040C:
+ ch -= 0x0360;
+ break;
+ case 0x040E:
+ case 0x040F:
+ case 0x0410:
+ case 0x0411:
+ case 0x0412:
+ case 0x0413:
+ case 0x0414:
+ case 0x0415:
+ case 0x0416:
+ case 0x0417:
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ case 0x0424:
+ case 0x0425:
+ case 0x0426:
+ case 0x0427:
+ case 0x0428:
+ case 0x0429:
+ case 0x042A:
+ case 0x042B:
+ case 0x042C:
+ case 0x042D:
+ case 0x042E:
+ case 0x042F:
+ case 0x0430:
+ case 0x0431:
+ case 0x0432:
+ case 0x0433:
+ case 0x0434:
+ case 0x0435:
+ case 0x0436:
+ case 0x0437:
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ case 0x0444:
+ case 0x0445:
+ case 0x0446:
+ case 0x0447:
+ case 0x0448:
+ case 0x0449:
+ case 0x044A:
+ case 0x044B:
+ case 0x044C:
+ case 0x044D:
+ case 0x044E:
+ case 0x044F:
+ ch -= 0x0360;
+ break;
+ case 0x0451:
+ case 0x0452:
+ case 0x0453:
+ case 0x0454:
+ case 0x0455:
+ case 0x0456:
+ case 0x0457:
+ case 0x0458:
+ case 0x0459:
+ case 0x045A:
+ case 0x045B:
+ case 0x045C:
+ ch -= 0x0360;
+ break;
+ case 0x045E: ch = 0xFE; break;
+ case 0x045F: ch = 0xFF; break;
+ case 0x2116: ch = 0xF0; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00AD:
+ break;
+ case 0x00A7: ch = 0xFD; break;
+ case 0x0401:
+ case 0x0402:
+ case 0x0403:
+ case 0x0404:
+ case 0x0405:
+ case 0x0406:
+ case 0x0407:
+ case 0x0408:
+ case 0x0409:
+ case 0x040A:
+ case 0x040B:
+ case 0x040C:
+ ch -= 0x0360;
+ break;
+ case 0x040E:
+ case 0x040F:
+ case 0x0410:
+ case 0x0411:
+ case 0x0412:
+ case 0x0413:
+ case 0x0414:
+ case 0x0415:
+ case 0x0416:
+ case 0x0417:
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ case 0x0424:
+ case 0x0425:
+ case 0x0426:
+ case 0x0427:
+ case 0x0428:
+ case 0x0429:
+ case 0x042A:
+ case 0x042B:
+ case 0x042C:
+ case 0x042D:
+ case 0x042E:
+ case 0x042F:
+ case 0x0430:
+ case 0x0431:
+ case 0x0432:
+ case 0x0433:
+ case 0x0434:
+ case 0x0435:
+ case 0x0436:
+ case 0x0437:
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ case 0x0444:
+ case 0x0445:
+ case 0x0446:
+ case 0x0447:
+ case 0x0448:
+ case 0x0449:
+ case 0x044A:
+ case 0x044B:
+ case 0x044C:
+ case 0x044D:
+ case 0x044E:
+ case 0x044F:
+ ch -= 0x0360;
+ break;
+ case 0x0451:
+ case 0x0452:
+ case 0x0453:
+ case 0x0454:
+ case 0x0455:
+ case 0x0456:
+ case 0x0457:
+ case 0x0458:
+ case 0x0459:
+ case 0x045A:
+ case 0x045B:
+ case 0x045C:
+ ch -= 0x0360;
+ break;
+ case 0x045E: ch = 0xFE; break;
+ case 0x045F: ch = 0xFF; break;
+ case 0x2116: ch = 0xF0; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28595
+
+public class ENCiso_8859_5 : CP28595
+{
+ public ENCiso_8859_5() : base() {}
+
+}; // class ENCiso_8859_5
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP57002.cs b/mcs/class/I18N/Other/CP57002.cs
new file mode 100644
index 00000000000..740f392b5c8
--- /dev/null
+++ b/mcs/class/I18N/Other/CP57002.cs
@@ -0,0 +1,496 @@
+/*
+ * CP57002.cs - ISCII code pages 57002-57011.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace I18N.Other
+{
+
+using System;
+using System.Text;
+using I18N.Common;
+
+// This class provides an abstract base for the ISCII encodings,
+// which all have a similar pattern. Code points 0x00-0x7F are
+// the standard ASCII character set, and code points 0x80-0xFF
+// are a shifted version of the Unicode character set, starting
+// at a fixed offset.
+
+public abstract class ISCIIEncoding : Encoding
+{
+ // Internal state.
+ protected int shift;
+ protected String encodingName;
+ protected String webName;
+
+ // Constructor.
+ protected ISCIIEncoding(int codePage, int shift,
+ String encodingName, String webName)
+ : base(codePage)
+ {
+ this.shift = shift;
+ this.encodingName = encodingName;
+ this.webName = webName;
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount(char[] chars, int index, int count)
+ {
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(index < 0 || index > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (chars.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Convenience wrappers for "GetByteCount".
+ public override int GetByteCount(String s)
+ {
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ return s.Length;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(charCount < 0 || charCount > (chars.Length - charIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if((bytes.Length - byteIndex) < charCount)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"), "bytes");
+ }
+
+ // Convert the characters into bytes.
+ char ch;
+ int posn = byteIndex;
+ char first = (char)shift;
+ char last = (char)(shift + 0x7F);
+ while(charCount-- > 0)
+ {
+ ch = chars[charIndex++];
+ if(ch < (char)0x0080)
+ {
+ // Regular ASCII subset.
+ bytes[posn++] = (byte)ch;
+ }
+ else if(ch >= first && ch <= last)
+ {
+ // ISCII range that we need to shift.
+ bytes[posn++] = (byte)(ch - first + 0x80);
+ }
+ else if(ch >= '\uFF01' && ch <= '\uFF5E')
+ {
+ // ASCII full-width characters.
+ bytes[posn++] = (byte)(ch - 0xFEE0);
+ }
+ else
+ {
+ bytes[posn++] = (byte)'?';
+ }
+ }
+
+ // Return the final length of the output.
+ return posn - byteIndex;
+ }
+
+ // Convenience wrappers for "GetBytes".
+ public override int GetBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ // Validate the parameters.
+ if(s == null)
+ {
+ throw new ArgumentNullException("s");
+ }
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(charIndex < 0 || charIndex > s.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex",
+ Strings.GetString("ArgRange_StringIndex"));
+ }
+ if(charCount < 0 || charCount > (s.Length - charIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount",
+ Strings.GetString("ArgRange_StringRange"));
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex",
+ Strings.GetString("ArgRange_Array"));
+ }
+ if((bytes.Length - byteIndex) < charCount)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"), "bytes");
+ }
+
+ // Convert the characters into bytes.
+ char ch;
+ int posn = byteIndex;
+ char first = (char)shift;
+ char last = (char)(shift + 0x7F);
+ while(charCount-- > 0)
+ {
+ ch = s[charIndex++];
+ if(ch < (char)0x0080)
+ {
+ // Regular ASCII subset.
+ bytes[posn++] = (byte)ch;
+ }
+ else if(ch >= first && ch <= last)
+ {
+ // ISCII range that we need to shift.
+ bytes[posn++] = (byte)(ch - first + 0x80);
+ }
+ else if(ch >= '\uFF01' && ch <= '\uFF5E')
+ {
+ // ASCII full-width characters.
+ bytes[posn++] = (byte)(ch - 0xFEE0);
+ }
+ else
+ {
+ bytes[posn++] = (byte)'?';
+ }
+ }
+
+ // Return the final length of the output.
+ return posn - byteIndex;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount(byte[] bytes, int index, int count)
+ {
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(index < 0 || index > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("index", Strings.GetString("ArgRange_Array"));
+ }
+ if(count < 0 || count > (bytes.Length - index))
+ {
+ throw new ArgumentOutOfRangeException
+ ("count", Strings.GetString("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ // Validate the parameters.
+ if(bytes == null)
+ {
+ throw new ArgumentNullException("bytes");
+ }
+ if(chars == null)
+ {
+ throw new ArgumentNullException("chars");
+ }
+ if(byteIndex < 0 || byteIndex > bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if(byteCount < 0 || byteCount > (bytes.Length - byteIndex))
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount", Strings.GetString("ArgRange_Array"));
+ }
+ if(charIndex < 0 || charIndex > chars.Length)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charIndex", Strings.GetString("ArgRange_Array"));
+ }
+ if((chars.Length - charIndex) < byteCount)
+ {
+ throw new ArgumentException
+ (Strings.GetString("Arg_InsufficientSpace"), "chars");
+ }
+
+ // Convert the bytes into characters.
+ int count = byteCount;
+ int byteval;
+ int shift = this.shift - 0x80;
+ while(count-- > 0)
+ {
+ byteval = (int)(bytes[byteIndex++]);
+ if(byteval < 0x80)
+ {
+ // Ordinary ASCII character.
+ chars[charIndex++] = (char)byteval;
+ }
+ else
+ {
+ // Shift the ISCII character into the Unicode page.
+ chars[charIndex++] = (char)(byteval + shift);
+ }
+ }
+ return byteCount;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount(int charCount)
+ {
+ if(charCount < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("charCount",
+ Strings.GetString("ArgRange_NonNegative"));
+ }
+ return charCount;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount(int byteCount)
+ {
+ if(byteCount < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("byteCount",
+ Strings.GetString("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get
+ {
+ return webName;
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get
+ {
+ return encodingName;
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get
+ {
+ return webName;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get
+ {
+ return webName;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+}; // class ISCIIEncoding
+
+// Define the ISCII code pages as subclasses of "ISCIIEncoding".
+
+public class CP57002 : ISCIIEncoding
+{
+ public CP57002() : base(57002, 0x0900, "ISCII Devanagari", "x-iscii-de") {}
+
+}; // class CP57002
+
+public class CP57003 : ISCIIEncoding
+{
+ public CP57003() : base(57003, 0x0980, "ISCII Bengali", "x-iscii-be") {}
+
+}; // class CP57003
+
+public class CP57004 : ISCIIEncoding
+{
+ public CP57004() : base(57004, 0x0B80, "ISCII Tamil", "x-iscii-ta") {}
+
+}; // class CP57004
+
+public class CP57005 : ISCIIEncoding
+{
+ public CP57005() : base(57005, 0x0B80, "ISCII Telugu", "x-iscii-te") {}
+
+}; // class CP57005
+
+public class CP57006 : ISCIIEncoding
+{
+ // Note: Unicode has a "Sinhala" page, but no "Assamese" page.
+ // Until I hear otherwise, I will assume that they are the same
+ // thing with different names - Rhys Weatherley, 16 April 2002.
+ public CP57006() : base(57006, 0x0D80, "ISCII Assamese", "x-iscii-as") {}
+
+}; // class CP57006
+
+public class CP57007 : ISCIIEncoding
+{
+ public CP57007() : base(57007, 0x0B00, "ISCII Oriya", "x-iscii-or") {}
+
+}; // class CP57007
+
+public class CP57008 : ISCIIEncoding
+{
+ public CP57008() : base(57008, 0x0C80, "ISCII Kannada", "x-iscii-ka") {}
+
+}; // class CP57008
+
+public class CP57009 : ISCIIEncoding
+{
+ public CP57009() : base(57009, 0x0D00, "ISCII Malayalam", "x-iscii-ma") {}
+
+}; // class CP57009
+
+public class CP57010 : ISCIIEncoding
+{
+ public CP57010() : base(57010, 0x0A80, "ISCII Gujarati", "x-iscii-gu") {}
+
+}; // class CP57010
+
+public class CP57011 : ISCIIEncoding
+{
+ // Note: Unicode has a "Gurmukhi" page, but no "Punjabi" page.
+ // Other ISCII-related information on the Internet seems to
+ // indicate that they are the same. Until I hear otherwise,
+ // I will assume that they are the same thing with different
+ // names - Rhys Weatherley, 16 April 2002.
+ public CP57011() : base(57011, 0x0A00, "ISCII Punjabi", "x-iscii-pa") {}
+
+}; // class CP57011
+
+// Define the web encoding name aliases for the above code pages.
+
+public class ENCx_iscii_de : CP57002
+{
+ public ENCx_iscii_de() : base() {}
+
+}; // class ENCx_iscii_de
+
+public class ENCx_iscii_be : CP57003
+{
+ public ENCx_iscii_be() : base() {}
+
+}; // class ENCx_iscii_be
+
+public class ENCx_iscii_ta : CP57004
+{
+ public ENCx_iscii_ta() : base() {}
+
+}; // class ENCx_iscii_ta
+
+public class ENCx_iscii_te : CP57005
+{
+ public ENCx_iscii_te() : base() {}
+
+}; // class ENCx_iscii_te
+
+public class ENCx_iscii_as : CP57006
+{
+ public ENCx_iscii_as() : base() {}
+
+}; // class ENCx_iscii_as
+
+public class ENCx_iscii_or : CP57007
+{
+ public ENCx_iscii_or() : base() {}
+
+}; // class ENCx_iscii_or
+
+public class ENCx_iscii_ka : CP57008
+{
+ public ENCx_iscii_ka() : base() {}
+
+}; // class ENCx_iscii_ka
+
+public class ENCx_iscii_ma : CP57009
+{
+ public ENCx_iscii_ma() : base() {}
+
+}; // class ENCx_iscii_ma
+
+public class ENCx_iscii_gu : CP57010
+{
+ public ENCx_iscii_gu() : base() {}
+
+}; // class ENCx_iscii_gu
+
+public class ENCx_iscii_pa : CP57011
+{
+ public ENCx_iscii_pa() : base() {}
+
+}; // class ENCx_iscii_pa
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/CP874.cs b/mcs/class/I18N/Other/CP874.cs
new file mode 100644
index 00000000000..97b41aa29d8
--- /dev/null
+++ b/mcs/class/I18N/Other/CP874.cs
@@ -0,0 +1,537 @@
+/*
+ * CP874.cs - Thai (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-874.ucm".
+
+namespace I18N.Other
+{
+
+using System;
+using I18N.Common;
+
+public class CP874 : ByteEncoding
+{
+ public CP874()
+ : base(874, ToChars, "Thai (Windows)",
+ "windows-874", "windows-874", "windows-874",
+ true, true, true, true, 874)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u0E48', '\u0E01',
+ '\u0E02', '\u0E03', '\u0E04', '\u0E05', '\u0E06', '\u0E07',
+ '\u0E08', '\u0E09', '\u0E0A', '\u0E0B', '\u0E0C', '\u0E0D',
+ '\u0E0E', '\u0E0F', '\u0E10', '\u0E11', '\u0E12', '\u0E13',
+ '\u0E14', '\u0E15', '\u0E16', '\u0E17', '\u0E18', '\u0E19',
+ '\u0E1A', '\u0E1B', '\u0E1C', '\u0E1D', '\u0E1E', '\u0E1F',
+ '\u0E20', '\u0E21', '\u0E22', '\u0E23', '\u0E24', '\u0E25',
+ '\u0E26', '\u0E27', '\u0E28', '\u0E29', '\u0E2A', '\u0E2B',
+ '\u0E2C', '\u0E2D', '\u0E2E', '\u0E2F', '\u0E30', '\u0E31',
+ '\u0E32', '\u0E33', '\u0E34', '\u0E35', '\u0E36', '\u0E37',
+ '\u0E38', '\u0E39', '\u0E3A', '\u0E49', '\u0E4A', '\u0E4B',
+ '\u0E4C', '\u0E3F', '\u0E40', '\u0E41', '\u0E42', '\u0E43',
+ '\u0E44', '\u0E45', '\u0E46', '\u0E47', '\u0E48', '\u0E49',
+ '\u0E4A', '\u0E4B', '\u0E4C', '\u0E4D', '\u0E4E', '\u0E4F',
+ '\u0E50', '\u0E51', '\u0E52', '\u0E53', '\u0E54', '\u0E55',
+ '\u0E56', '\u0E57', '\u0E58', '\u0E59', '\u0E5A', '\u0E5B',
+ '\u00A2', '\u00AC', '\u00A6', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A2: ch = 0xFC; break;
+ case 0x00A6: ch = 0xFE; break;
+ case 0x00AC: ch = 0xFD; break;
+ case 0x0E01:
+ case 0x0E02:
+ case 0x0E03:
+ case 0x0E04:
+ case 0x0E05:
+ case 0x0E06:
+ case 0x0E07:
+ case 0x0E08:
+ case 0x0E09:
+ case 0x0E0A:
+ case 0x0E0B:
+ case 0x0E0C:
+ case 0x0E0D:
+ case 0x0E0E:
+ case 0x0E0F:
+ case 0x0E10:
+ case 0x0E11:
+ case 0x0E12:
+ case 0x0E13:
+ case 0x0E14:
+ case 0x0E15:
+ case 0x0E16:
+ case 0x0E17:
+ case 0x0E18:
+ case 0x0E19:
+ case 0x0E1A:
+ case 0x0E1B:
+ case 0x0E1C:
+ case 0x0E1D:
+ case 0x0E1E:
+ case 0x0E1F:
+ case 0x0E20:
+ case 0x0E21:
+ case 0x0E22:
+ case 0x0E23:
+ case 0x0E24:
+ case 0x0E25:
+ case 0x0E26:
+ case 0x0E27:
+ case 0x0E28:
+ case 0x0E29:
+ case 0x0E2A:
+ case 0x0E2B:
+ case 0x0E2C:
+ case 0x0E2D:
+ case 0x0E2E:
+ case 0x0E2F:
+ case 0x0E30:
+ case 0x0E31:
+ case 0x0E32:
+ case 0x0E33:
+ case 0x0E34:
+ case 0x0E35:
+ case 0x0E36:
+ case 0x0E37:
+ case 0x0E38:
+ case 0x0E39:
+ case 0x0E3A:
+ ch -= 0x0D60;
+ break;
+ case 0x0E3F:
+ case 0x0E40:
+ case 0x0E41:
+ case 0x0E42:
+ case 0x0E43:
+ case 0x0E44:
+ case 0x0E45:
+ case 0x0E46:
+ case 0x0E47:
+ case 0x0E48:
+ case 0x0E49:
+ case 0x0E4A:
+ case 0x0E4B:
+ case 0x0E4C:
+ case 0x0E4D:
+ case 0x0E4E:
+ case 0x0E4F:
+ case 0x0E50:
+ case 0x0E51:
+ case 0x0E52:
+ case 0x0E53:
+ case 0x0E54:
+ case 0x0E55:
+ case 0x0E56:
+ case 0x0E57:
+ case 0x0E58:
+ case 0x0E59:
+ case 0x0E5A:
+ case 0x0E5B:
+ ch -= 0x0D60;
+ break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A2: ch = 0xFC; break;
+ case 0x00A6: ch = 0xFE; break;
+ case 0x00AC: ch = 0xFD; break;
+ case 0x0E01:
+ case 0x0E02:
+ case 0x0E03:
+ case 0x0E04:
+ case 0x0E05:
+ case 0x0E06:
+ case 0x0E07:
+ case 0x0E08:
+ case 0x0E09:
+ case 0x0E0A:
+ case 0x0E0B:
+ case 0x0E0C:
+ case 0x0E0D:
+ case 0x0E0E:
+ case 0x0E0F:
+ case 0x0E10:
+ case 0x0E11:
+ case 0x0E12:
+ case 0x0E13:
+ case 0x0E14:
+ case 0x0E15:
+ case 0x0E16:
+ case 0x0E17:
+ case 0x0E18:
+ case 0x0E19:
+ case 0x0E1A:
+ case 0x0E1B:
+ case 0x0E1C:
+ case 0x0E1D:
+ case 0x0E1E:
+ case 0x0E1F:
+ case 0x0E20:
+ case 0x0E21:
+ case 0x0E22:
+ case 0x0E23:
+ case 0x0E24:
+ case 0x0E25:
+ case 0x0E26:
+ case 0x0E27:
+ case 0x0E28:
+ case 0x0E29:
+ case 0x0E2A:
+ case 0x0E2B:
+ case 0x0E2C:
+ case 0x0E2D:
+ case 0x0E2E:
+ case 0x0E2F:
+ case 0x0E30:
+ case 0x0E31:
+ case 0x0E32:
+ case 0x0E33:
+ case 0x0E34:
+ case 0x0E35:
+ case 0x0E36:
+ case 0x0E37:
+ case 0x0E38:
+ case 0x0E39:
+ case 0x0E3A:
+ ch -= 0x0D60;
+ break;
+ case 0x0E3F:
+ case 0x0E40:
+ case 0x0E41:
+ case 0x0E42:
+ case 0x0E43:
+ case 0x0E44:
+ case 0x0E45:
+ case 0x0E46:
+ case 0x0E47:
+ case 0x0E48:
+ case 0x0E49:
+ case 0x0E4A:
+ case 0x0E4B:
+ case 0x0E4C:
+ case 0x0E4D:
+ case 0x0E4E:
+ case 0x0E4F:
+ case 0x0E50:
+ case 0x0E51:
+ case 0x0E52:
+ case 0x0E53:
+ case 0x0E54:
+ case 0x0E55:
+ case 0x0E56:
+ case 0x0E57:
+ case 0x0E58:
+ case 0x0E59:
+ case 0x0E5A:
+ case 0x0E5B:
+ ch -= 0x0D60;
+ break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP874
+
+public class ENCwindows_874 : CP874
+{
+ public ENCwindows_874() : base() {}
+
+}; // class ENCwindows_874
+
+}; // namespace I18N.Other
diff --git a/mcs/class/I18N/Other/ibm-5347.ucm b/mcs/class/I18N/Other/ibm-5347.ucm
new file mode 100644
index 00000000000..fc262e6c0bc
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-5347.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:44 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E3.RPMAP100 and 14E344B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5347"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5347
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0098> \x98 |0
+<U00A0> \xA0 |0
+<U00A4> \xA4 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00BB> \xBB |0
+<U0401> \xA8 |0
+<U0402> \x80 |0
+<U0403> \x81 |0
+<U0404> \xAA |0
+<U0405> \xBD |0
+<U0406> \xB2 |0
+<U0407> \xAF |0
+<U0408> \xA3 |0
+<U0409> \x8A |0
+<U040A> \x8C |0
+<U040B> \x8E |0
+<U040C> \x8D |0
+<U040E> \xA1 |0
+<U040F> \x8F |0
+<U0410> \xC0 |0
+<U0411> \xC1 |0
+<U0412> \xC2 |0
+<U0413> \xC3 |0
+<U0414> \xC4 |0
+<U0415> \xC5 |0
+<U0416> \xC6 |0
+<U0417> \xC7 |0
+<U0418> \xC8 |0
+<U0419> \xC9 |0
+<U041A> \xCA |0
+<U041B> \xCB |0
+<U041C> \xCC |0
+<U041D> \xCD |0
+<U041E> \xCE |0
+<U041F> \xCF |0
+<U0420> \xD0 |0
+<U0421> \xD1 |0
+<U0422> \xD2 |0
+<U0423> \xD3 |0
+<U0424> \xD4 |0
+<U0425> \xD5 |0
+<U0426> \xD6 |0
+<U0427> \xD7 |0
+<U0428> \xD8 |0
+<U0429> \xD9 |0
+<U042A> \xDA |0
+<U042B> \xDB |0
+<U042C> \xDC |0
+<U042D> \xDD |0
+<U042E> \xDE |0
+<U042F> \xDF |0
+<U0430> \xE0 |0
+<U0431> \xE1 |0
+<U0432> \xE2 |0
+<U0433> \xE3 |0
+<U0434> \xE4 |0
+<U0435> \xE5 |0
+<U0436> \xE6 |0
+<U0437> \xE7 |0
+<U0438> \xE8 |0
+<U0439> \xE9 |0
+<U043A> \xEA |0
+<U043B> \xEB |0
+<U043C> \xEC |0
+<U043D> \xED |0
+<U043E> \xEE |0
+<U043F> \xEF |0
+<U0440> \xF0 |0
+<U0441> \xF1 |0
+<U0442> \xF2 |0
+<U0443> \xF3 |0
+<U0444> \xF4 |0
+<U0445> \xF5 |0
+<U0446> \xF6 |0
+<U0447> \xF7 |0
+<U0448> \xF8 |0
+<U0449> \xF9 |0
+<U044A> \xFA |0
+<U044B> \xFB |0
+<U044C> \xFC |0
+<U044D> \xFD |0
+<U044E> \xFE |0
+<U044F> \xFF |0
+<U0451> \xB8 |0
+<U0452> \x90 |0
+<U0453> \x83 |0
+<U0454> \xBA |0
+<U0455> \xBE |0
+<U0456> \xB3 |0
+<U0457> \xBF |0
+<U0458> \xBC |0
+<U0459> \x9A |0
+<U045A> \x9C |0
+<U045B> \x9E |0
+<U045C> \x9D |0
+<U045E> \xA2 |0
+<U045F> \x9F |0
+<U0490> \xA5 |0
+<U0491> \xB4 |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x88 |0
+<U2116> \xB9 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/ibm-5353.ucm b/mcs/class/I18N/Other/ibm-5353.ucm
new file mode 100644
index 00000000000..3afd0182fea
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-5353.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:45 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E9.RPMAP100 and 14E944B0.TPMAP100
+#
+# Patched for jitterbug 792
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5353"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5353
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U0083> \x83 |0
+<U0088> \x88 |0
+<U008A> \x8A |0
+<U008C> \x8C |0
+<U0090> \x90 |0
+<U0098> \x98 |0
+<U009A> \x9A |0
+<U009C> \x9C |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \x8D |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \x9D |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \x8F |0
+<U00B9> \xB9 |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xAF |0
+<U00C9> \xC9 |0
+<U00D3> \xD3 |0
+<U00D5> \xD5 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xA8 |0
+<U00DC> \xDC |0
+<U00DF> \xDF |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xBF |0
+<U00E9> \xE9 |0
+<U00F3> \xF3 |0
+<U00F5> \xF5 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xB8 |0
+<U00FC> \xFC |0
+<U0100> \xC2 |0
+<U0101> \xE2 |0
+<U0104> \xC0 |0
+<U0105> \xE0 |0
+<U0106> \xC3 |0
+<U0107> \xE3 |0
+<U010C> \xC8 |0
+<U010D> \xE8 |0
+<U0112> \xC7 |0
+<U0113> \xE7 |0
+<U0116> \xCB |0
+<U0117> \xEB |0
+<U0118> \xC6 |0
+<U0119> \xE6 |0
+<U0122> \xCC |0
+<U0123> \xEC |0
+<U012A> \xCE |0
+<U012B> \xEE |0
+<U012E> \xC1 |0
+<U012F> \xE1 |0
+<U0136> \xCD |0
+<U0137> \xED |0
+<U013B> \xCF |0
+<U013C> \xEF |0
+<U0141> \xD9 |0
+<U0142> \xF9 |0
+<U0143> \xD1 |0
+<U0144> \xF1 |0
+<U0145> \xD2 |0
+<U0146> \xF2 |0
+<U014C> \xD4 |0
+<U014D> \xF4 |0
+<U0156> \xAA |0
+<U0157> \xBA |0
+<U015A> \xDA |0
+<U015B> \xFA |0
+<U0160> \xD0 |0
+<U0161> \xF0 |0
+<U016A> \xDB |0
+<U016B> \xFB |0
+<U0172> \xD8 |0
+<U0173> \xF8 |0
+<U0179> \xCA |0
+<U017A> \xEA |0
+<U017B> \xDD |0
+<U017C> \xFD |0
+<U017D> \xDE |0
+<U017E> \xFE |0
+<U02C7> \x8E |0
+<U02D9> \xFF |0
+<U02DB> \x9E |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/ibm-5354.ucm b/mcs/class/I18N/Other/ibm-5354.ucm
new file mode 100644
index 00000000000..3d4bcaa7750
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-5354.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:45 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014EA.RPMAP100 and 14EA44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5354"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5354
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U008A> \x8A |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U009A> \x9A |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U00A0> \xA0 |0
+<U00A1> \xA1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AA> \xAA |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BA> \xBA |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00BF> \xBF |0
+<U00C0> \xC0 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xC6 |0
+<U00C7> \xC7 |0
+<U00C8> \xC8 |0
+<U00C9> \xC9 |0
+<U00CA> \xCA |0
+<U00CB> \xCB |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00CF> \xCF |0
+<U00D1> \xD1 |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xD8 |0
+<U00D9> \xD9 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DF> \xDF |0
+<U00E0> \xE0 |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xE6 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F1> \xF1 |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xF8 |0
+<U00F9> \xF9 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U00FF> \xFF |0
+<U0102> \xC3 |0
+<U0103> \xE3 |0
+<U0110> \xD0 |0
+<U0111> \xF0 |0
+<U0152> \x8C |0
+<U0153> \x9C |0
+<U0178> \x9F |0
+<U0192> \x83 |0
+<U01A0> \xD5 |0
+<U01A1> \xF5 |0
+<U01AF> \xDD |0
+<U01B0> \xFD |0
+<U02C6> \x88 |0
+<U02DC> \x98 |0
+<U0300> \xCC |0
+<U0301> \xEC |0
+<U0303> \xDE |0
+<U0309> \xD2 |0
+<U0323> \xF2 |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AB> \xFE |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/ibm-874.ucm b/mcs/class/I18N/Other/ibm-874.ucm
new file mode 100644
index 00000000000..ecf2d88890f
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-874.ucm
@@ -0,0 +1,345 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:03 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0036A.RPMAP100 and 036A34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-874"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-874
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A2> \xFC |0
+<U00A6> \xFE |0
+<U00AC> \xFD |0
+<U0E01> \xA1 |0
+<U0E02> \xA2 |0
+<U0E03> \xA3 |0
+<U0E04> \xA4 |0
+<U0E05> \xA5 |0
+<U0E06> \xA6 |0
+<U0E07> \xA7 |0
+<U0E08> \xA8 |0
+<U0E09> \xA9 |0
+<U0E0A> \xAA |0
+<U0E0B> \xAB |0
+<U0E0C> \xAC |0
+<U0E0D> \xAD |0
+<U0E0E> \xAE |0
+<U0E0F> \xAF |0
+<U0E10> \xB0 |0
+<U0E11> \xB1 |0
+<U0E12> \xB2 |0
+<U0E13> \xB3 |0
+<U0E14> \xB4 |0
+<U0E15> \xB5 |0
+<U0E16> \xB6 |0
+<U0E17> \xB7 |0
+<U0E18> \xB8 |0
+<U0E19> \xB9 |0
+<U0E1A> \xBA |0
+<U0E1B> \xBB |0
+<U0E1C> \xBC |0
+<U0E1D> \xBD |0
+<U0E1E> \xBE |0
+<U0E1F> \xBF |0
+<U0E20> \xC0 |0
+<U0E21> \xC1 |0
+<U0E22> \xC2 |0
+<U0E23> \xC3 |0
+<U0E24> \xC4 |0
+<U0E25> \xC5 |0
+<U0E26> \xC6 |0
+<U0E27> \xC7 |0
+<U0E28> \xC8 |0
+<U0E29> \xC9 |0
+<U0E2A> \xCA |0
+<U0E2B> \xCB |0
+<U0E2C> \xCC |0
+<U0E2D> \xCD |0
+<U0E2E> \xCE |0
+<U0E2F> \xCF |0
+<U0E30> \xD0 |0
+<U0E31> \xD1 |0
+<U0E32> \xD2 |0
+<U0E33> \xD3 |0
+<U0E34> \xD4 |0
+<U0E35> \xD5 |0
+<U0E36> \xD6 |0
+<U0E37> \xD7 |0
+<U0E38> \xD8 |0
+<U0E39> \xD9 |0
+<U0E3A> \xDA |0
+<U0E3F> \xDF |0
+<U0E40> \xE0 |0
+<U0E41> \xE1 |0
+<U0E42> \xE2 |0
+<U0E43> \xE3 |0
+<U0E44> \xE4 |0
+<U0E45> \xE5 |0
+<U0E46> \xE6 |0
+<U0E47> \xE7 |0
+<U0E48> \xA0 |3
+<U0E48> \xE8 |0
+<U0E49> \xDB |3
+<U0E49> \xE9 |0
+<U0E4A> \xDC |3
+<U0E4A> \xEA |0
+<U0E4B> \xDD |3
+<U0E4B> \xEB |0
+<U0E4C> \xDE |3
+<U0E4C> \xEC |0
+<U0E4D> \xED |0
+<U0E4E> \xEE |0
+<U0E4F> \xEF |0
+<U0E50> \xF0 |0
+<U0E51> \xF1 |0
+<U0E52> \xF2 |0
+<U0E53> \xF3 |0
+<U0E54> \xF4 |0
+<U0E55> \xF5 |0
+<U0E56> \xF6 |0
+<U0E57> \xF7 |0
+<U0E58> \xF8 |0
+<U0E59> \xF9 |0
+<U0E5A> \xFA |0
+<U0E5B> \xFB |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/ibm-878.ucm b/mcs/class/I18N/Other/ibm-878.ucm
new file mode 100644
index 00000000000..e564740a787
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-878.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:03 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0036E.RPMAP100 and 036E34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-878"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-878
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U00A0> \x9A |0
+<U00A9> \xBF |0
+<U00B0> \x9C |0
+<U00B2> \x9D |0
+<U00B7> \x9E |0
+<U00F7> \x9F |0
+<U0401> \xB3 |0
+<U0410> \xE1 |0
+<U0411> \xE2 |0
+<U0412> \xF7 |0
+<U0413> \xE7 |0
+<U0414> \xE4 |0
+<U0415> \xE5 |0
+<U0416> \xF6 |0
+<U0417> \xFA |0
+<U0418> \xE9 |0
+<U0419> \xEA |0
+<U041A> \xEB |0
+<U041B> \xEC |0
+<U041C> \xED |0
+<U041D> \xEE |0
+<U041E> \xEF |0
+<U041F> \xF0 |0
+<U0420> \xF2 |0
+<U0421> \xF3 |0
+<U0422> \xF4 |0
+<U0423> \xF5 |0
+<U0424> \xE6 |0
+<U0425> \xE8 |0
+<U0426> \xE3 |0
+<U0427> \xFE |0
+<U0428> \xFB |0
+<U0429> \xFD |0
+<U042A> \xFF |0
+<U042B> \xF9 |0
+<U042C> \xF8 |0
+<U042D> \xFC |0
+<U042E> \xE0 |0
+<U042F> \xF1 |0
+<U0430> \xC1 |0
+<U0431> \xC2 |0
+<U0432> \xD7 |0
+<U0433> \xC7 |0
+<U0434> \xC4 |0
+<U0435> \xC5 |0
+<U0436> \xD6 |0
+<U0437> \xDA |0
+<U0438> \xC9 |0
+<U0439> \xCA |0
+<U043A> \xCB |0
+<U043B> \xCC |0
+<U043C> \xCD |0
+<U043D> \xCE |0
+<U043E> \xCF |0
+<U043F> \xD0 |0
+<U0440> \xD2 |0
+<U0441> \xD3 |0
+<U0442> \xD4 |0
+<U0443> \xD5 |0
+<U0444> \xC6 |0
+<U0445> \xC8 |0
+<U0446> \xC3 |0
+<U0447> \xDE |0
+<U0448> \xDB |0
+<U0449> \xDD |0
+<U044A> \xDF |0
+<U044B> \xD9 |0
+<U044C> \xD8 |0
+<U044D> \xDC |0
+<U044E> \xC0 |0
+<U044F> \xD1 |0
+<U0451> \xA3 |0
+<U2219> \x95 |0
+<U221A> \x96 |0
+<U2248> \x97 |0
+<U2264> \x98 |0
+<U2265> \x99 |0
+<U2320> \x93 |0
+<U2321> \x9B |0
+<U2500> \x80 |0
+<U2502> \x81 |0
+<U250C> \x82 |0
+<U2510> \x83 |0
+<U2514> \x84 |0
+<U2518> \x85 |0
+<U251C> \x86 |0
+<U2524> \x87 |0
+<U252C> \x88 |0
+<U2534> \x89 |0
+<U253C> \x8A |0
+<U2550> \xA0 |0
+<U2551> \xA1 |0
+<U2552> \xA2 |0
+<U2553> \xA4 |0
+<U2554> \xA5 |0
+<U2555> \xA6 |0
+<U2556> \xA7 |0
+<U2557> \xA8 |0
+<U2558> \xA9 |0
+<U2559> \xAA |0
+<U255A> \xAB |0
+<U255B> \xAC |0
+<U255C> \xAD |0
+<U255D> \xAE |0
+<U255E> \xAF |0
+<U255F> \xB0 |0
+<U2560> \xB1 |0
+<U2561> \xB2 |0
+<U2562> \xB4 |0
+<U2563> \xB5 |0
+<U2564> \xB6 |0
+<U2565> \xB7 |0
+<U2566> \xB8 |0
+<U2567> \xB9 |0
+<U2568> \xBA |0
+<U2569> \xBB |0
+<U256A> \xBC |0
+<U256B> \xBD |0
+<U256C> \xBE |0
+<U2580> \x8B |0
+<U2584> \x8C |0
+<U2588> \x8D |0
+<U258C> \x8E |0
+<U2590> \x8F |0
+<U2591> \x90 |0
+<U2592> \x91 |0
+<U2593> \x92 |0
+<U25A0> \x94 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \x81 |1
+<UFFED> \x94 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/ibm-914.ucm b/mcs/class/I18N/Other/ibm-914.ucm
new file mode 100644
index 00000000000..afafc4f22e3
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-914.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00392.RPMAP100 and 039234B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-914"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-914
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A4> \xA4 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00AD> \xAD |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B4> \xB4 |0
+<U00B8> \xB8 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C3> \xC3 |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xC6 |0
+<U00C9> \xC9 |0
+<U00CB> \xCB |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00D4> \xD4 |0
+<U00D5> \xD5 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xD8 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DF> \xDF |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E3> \xE3 |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xE6 |0
+<U00E9> \xE9 |0
+<U00EB> \xEB |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00F4> \xF4 |0
+<U00F5> \xF5 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xF8 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U0100> \xC0 |0
+<U0101> \xE0 |0
+<U0104> \xA1 |0
+<U0105> \xB1 |0
+<U010C> \xC8 |0
+<U010D> \xE8 |0
+<U0110> \xD0 |0
+<U0111> \xF0 |0
+<U0112> \xAA |0
+<U0113> \xBA |0
+<U0116> \xCC |0
+<U0117> \xEC |0
+<U0118> \xCA |0
+<U0119> \xEA |0
+<U0122> \xAB |0
+<U0123> \xBB |0
+<U0128> \xA5 |0
+<U0129> \xB5 |0
+<U012A> \xCF |0
+<U012B> \xEF |0
+<U012E> \xC7 |0
+<U012F> \xE7 |0
+<U0136> \xD3 |0
+<U0137> \xF3 |0
+<U0138> \xA2 |0
+<U013B> \xA6 |0
+<U013C> \xB6 |0
+<U0145> \xD1 |0
+<U0146> \xF1 |0
+<U014A> \xBD |0
+<U014B> \xBF |0
+<U014C> \xD2 |0
+<U014D> \xF2 |0
+<U0156> \xA3 |0
+<U0157> \xB3 |0
+<U0160> \xA9 |0
+<U0161> \xB9 |0
+<U0166> \xAC |0
+<U0167> \xBC |0
+<U0168> \xDD |0
+<U0169> \xFD |0
+<U016A> \xDE |0
+<U016B> \xFE |0
+<U0172> \xD9 |0
+<U0173> \xF9 |0
+<U017D> \xAE |0
+<U017E> \xBE |0
+<U02C7> \xB7 |0
+<U02D9> \xFF |0
+<U02DB> \xB2 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/ibm-915.ucm b/mcs/class/I18N/Other/ibm-915.ucm
new file mode 100644
index 00000000000..94e83ddceb4
--- /dev/null
+++ b/mcs/class/I18N/Other/ibm-915.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00393.RPMAP100 and 039334B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-915"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-915
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A7> \xFD |0
+<U00AD> \xAD |0
+<U0401> \xA1 |0
+<U0402> \xA2 |0
+<U0403> \xA3 |0
+<U0404> \xA4 |0
+<U0405> \xA5 |0
+<U0406> \xA6 |0
+<U0407> \xA7 |0
+<U0408> \xA8 |0
+<U0409> \xA9 |0
+<U040A> \xAA |0
+<U040B> \xAB |0
+<U040C> \xAC |0
+<U040E> \xAE |0
+<U040F> \xAF |0
+<U0410> \xB0 |0
+<U0411> \xB1 |0
+<U0412> \xB2 |0
+<U0413> \xB3 |0
+<U0414> \xB4 |0
+<U0415> \xB5 |0
+<U0416> \xB6 |0
+<U0417> \xB7 |0
+<U0418> \xB8 |0
+<U0419> \xB9 |0
+<U041A> \xBA |0
+<U041B> \xBB |0
+<U041C> \xBC |0
+<U041D> \xBD |0
+<U041E> \xBE |0
+<U041F> \xBF |0
+<U0420> \xC0 |0
+<U0421> \xC1 |0
+<U0422> \xC2 |0
+<U0423> \xC3 |0
+<U0424> \xC4 |0
+<U0425> \xC5 |0
+<U0426> \xC6 |0
+<U0427> \xC7 |0
+<U0428> \xC8 |0
+<U0429> \xC9 |0
+<U042A> \xCA |0
+<U042B> \xCB |0
+<U042C> \xCC |0
+<U042D> \xCD |0
+<U042E> \xCE |0
+<U042F> \xCF |0
+<U0430> \xD0 |0
+<U0431> \xD1 |0
+<U0432> \xD2 |0
+<U0433> \xD3 |0
+<U0434> \xD4 |0
+<U0435> \xD5 |0
+<U0436> \xD6 |0
+<U0437> \xD7 |0
+<U0438> \xD8 |0
+<U0439> \xD9 |0
+<U043A> \xDA |0
+<U043B> \xDB |0
+<U043C> \xDC |0
+<U043D> \xDD |0
+<U043E> \xDE |0
+<U043F> \xDF |0
+<U0440> \xE0 |0
+<U0441> \xE1 |0
+<U0442> \xE2 |0
+<U0443> \xE3 |0
+<U0444> \xE4 |0
+<U0445> \xE5 |0
+<U0446> \xE6 |0
+<U0447> \xE7 |0
+<U0448> \xE8 |0
+<U0449> \xE9 |0
+<U044A> \xEA |0
+<U044B> \xEB |0
+<U044C> \xEC |0
+<U044D> \xED |0
+<U044E> \xEE |0
+<U044F> \xEF |0
+<U0451> \xF1 |0
+<U0452> \xF2 |0
+<U0453> \xF3 |0
+<U0454> \xF4 |0
+<U0455> \xF5 |0
+<U0456> \xF6 |0
+<U0457> \xF7 |0
+<U0458> \xF8 |0
+<U0459> \xF9 |0
+<U045A> \xFA |0
+<U045B> \xFB |0
+<U045C> \xFC |0
+<U045E> \xFE |0
+<U045F> \xFF |0
+<U2116> \xF0 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/koi8-u.ucm b/mcs/class/I18N/Other/koi8-u.ucm
new file mode 100644
index 00000000000..8ed9c3df14c
--- /dev/null
+++ b/mcs/class/I18N/Other/koi8-u.ucm
@@ -0,0 +1,363 @@
+% This file is a combination of the glibc-2.2.5 charmap for
+% koi8-u, adjusted to IBM's UCM syntax, with extra characters
+% added for full-width Latin 1 -- Rhys Weatherley, 17 April 2002.
+
+<code_set_name> KOI8-U
+<comment_char> %
+<escape_char> /
+% version: 1.1
+% source: RFC 2319
+% source: http://www.net.ua/KOI8-U/
+
+CHARMAP
+<U0000> \x00 |0 NULL (NUL)
+<U0001> \x01 |0 START OF HEADING (SOH)
+<U0002> \x02 |0 START OF TEXT (STX)
+<U0003> \x03 |0 END OF TEXT (ETX)
+<U0004> \x04 |0 END OF TRANSMISSION (EOT)
+<U0005> \x05 |0 ENQUIRY (ENQ)
+<U0006> \x06 |0 ACKNOWLEDGE (ACK)
+<U0007> \x07 |0 BELL (BEL)
+<U0008> \x08 |0 BACKSPACE (BS)
+<U0009> \x09 |0 CHARACTER TABULATION (HT)
+<U000A> \x0a |0 LINE FEED (LF)
+<U000B> \x0b |0 LINE TABULATION (VT)
+<U000C> \x0c |0 FORM FEED (FF)
+<U000D> \x0d |0 CARRIAGE RETURN (CR)
+<U000E> \x0e |0 SHIFT OUT (SO)
+<U000F> \x0f |0 SHIFT IN (SI)
+<U0010> \x10 |0 DATALINK ESCAPE (DLE)
+<U0011> \x11 |0 DEVICE CONTROL ONE (DC1)
+<U0012> \x12 |0 DEVICE CONTROL TWO (DC2)
+<U0013> \x13 |0 DEVICE CONTROL THREE (DC3)
+<U0014> \x14 |0 DEVICE CONTROL FOUR (DC4)
+<U0015> \x15 |0 NEGATIVE ACKNOWLEDGE (NAK)
+<U0016> \x16 |0 SYNCHRONOUS IDLE (SYN)
+<U0017> \x17 |0 END OF TRANSMISSION BLOCK (ETB)
+<U0018> \x18 |0 CANCEL (CAN)
+<U0019> \x19 |0 END OF MEDIUM (EM)
+<U001A> \x1a |0 SUBSTITUTE (SUB)
+<U001B> \x1b |0 ESCAPE (ESC)
+<U001C> \x1c |0 FILE SEPARATOR (IS4)
+<U001D> \x1d |0 GROUP SEPARATOR (IS3)
+<U001E> \x1e |0 RECORD SEPARATOR (IS2)
+<U001F> \x1f |0 UNIT SEPARATOR (IS1)
+<U0020> \x20 |0 SPACE
+<U0021> \x21 |0 EXCLAMATION MARK
+<U0022> \x22 |0 QUOTATION MARK
+<U0023> \x23 |0 NUMBER SIGN
+<U0024> \x24 |0 DOLLAR SIGN
+<U0025> \x25 |0 PERCENT SIGN
+<U0026> \x26 |0 AMPERSAND
+<U0027> \x27 |0 APOSTROPHE
+<U0028> \x28 |0 LEFT PARENTHESIS
+<U0029> \x29 |0 RIGHT PARENTHESIS
+<U002A> \x2a |0 ASTERISK
+<U002B> \x2b |0 PLUS SIGN
+<U002C> \x2c |0 COMMA
+<U002D> \x2d |0 HYPHEN-MINUS
+<U002E> \x2e |0 FULL STOP
+<U002F> \x2f |0 SOLIDUS
+<U0030> \x30 |0 DIGIT ZERO
+<U0031> \x31 |0 DIGIT ONE
+<U0032> \x32 |0 DIGIT TWO
+<U0033> \x33 |0 DIGIT THREE
+<U0034> \x34 |0 DIGIT FOUR
+<U0035> \x35 |0 DIGIT FIVE
+<U0036> \x36 |0 DIGIT SIX
+<U0037> \x37 |0 DIGIT SEVEN
+<U0038> \x38 |0 DIGIT EIGHT
+<U0039> \x39 |0 DIGIT NINE
+<U003A> \x3a |0 COLON
+<U003B> \x3b |0 SEMICOLON
+<U003C> \x3c |0 LESS-THAN SIGN
+<U003D> \x3d |0 EQUALS SIGN
+<U003E> \x3e |0 GREATER-THAN SIGN
+<U003F> \x3f |0 QUESTION MARK
+<U0040> \x40 |0 COMMERCIAL AT
+<U0041> \x41 |0 LATIN CAPITAL LETTER A
+<U0042> \x42 |0 LATIN CAPITAL LETTER B
+<U0043> \x43 |0 LATIN CAPITAL LETTER C
+<U0044> \x44 |0 LATIN CAPITAL LETTER D
+<U0045> \x45 |0 LATIN CAPITAL LETTER E
+<U0046> \x46 |0 LATIN CAPITAL LETTER F
+<U0047> \x47 |0 LATIN CAPITAL LETTER G
+<U0048> \x48 |0 LATIN CAPITAL LETTER H
+<U0049> \x49 |0 LATIN CAPITAL LETTER I
+<U004A> \x4a |0 LATIN CAPITAL LETTER J
+<U004B> \x4b |0 LATIN CAPITAL LETTER K
+<U004C> \x4c |0 LATIN CAPITAL LETTER L
+<U004D> \x4d |0 LATIN CAPITAL LETTER M
+<U004E> \x4e |0 LATIN CAPITAL LETTER N
+<U004F> \x4f |0 LATIN CAPITAL LETTER O
+<U0050> \x50 |0 LATIN CAPITAL LETTER P
+<U0051> \x51 |0 LATIN CAPITAL LETTER Q
+<U0052> \x52 |0 LATIN CAPITAL LETTER R
+<U0053> \x53 |0 LATIN CAPITAL LETTER S
+<U0054> \x54 |0 LATIN CAPITAL LETTER T
+<U0055> \x55 |0 LATIN CAPITAL LETTER U
+<U0056> \x56 |0 LATIN CAPITAL LETTER V
+<U0057> \x57 |0 LATIN CAPITAL LETTER W
+<U0058> \x58 |0 LATIN CAPITAL LETTER X
+<U0059> \x59 |0 LATIN CAPITAL LETTER Y
+<U005A> \x5a |0 LATIN CAPITAL LETTER Z
+<U005B> \x5b |0 LEFT SQUARE BRACKET
+<U005C> \x5c |0 REVERSE SOLIDUS
+<U005D> \x5d |0 RIGHT SQUARE BRACKET
+<U005E> \x5e |0 CIRCUMFLEX ACCENT
+<U005F> \x5f |0 LOW LINE
+<U0060> \x60 |0 GRAVE ACCENT
+<U0061> \x61 |0 LATIN SMALL LETTER A
+<U0062> \x62 |0 LATIN SMALL LETTER B
+<U0063> \x63 |0 LATIN SMALL LETTER C
+<U0064> \x64 |0 LATIN SMALL LETTER D
+<U0065> \x65 |0 LATIN SMALL LETTER E
+<U0066> \x66 |0 LATIN SMALL LETTER F
+<U0067> \x67 |0 LATIN SMALL LETTER G
+<U0068> \x68 |0 LATIN SMALL LETTER H
+<U0069> \x69 |0 LATIN SMALL LETTER I
+<U006A> \x6a |0 LATIN SMALL LETTER J
+<U006B> \x6b |0 LATIN SMALL LETTER K
+<U006C> \x6c |0 LATIN SMALL LETTER L
+<U006D> \x6d |0 LATIN SMALL LETTER M
+<U006E> \x6e |0 LATIN SMALL LETTER N
+<U006F> \x6f |0 LATIN SMALL LETTER O
+<U0070> \x70 |0 LATIN SMALL LETTER P
+<U0071> \x71 |0 LATIN SMALL LETTER Q
+<U0072> \x72 |0 LATIN SMALL LETTER R
+<U0073> \x73 |0 LATIN SMALL LETTER S
+<U0074> \x74 |0 LATIN SMALL LETTER T
+<U0075> \x75 |0 LATIN SMALL LETTER U
+<U0076> \x76 |0 LATIN SMALL LETTER V
+<U0077> \x77 |0 LATIN SMALL LETTER W
+<U0078> \x78 |0 LATIN SMALL LETTER X
+<U0079> \x79 |0 LATIN SMALL LETTER Y
+<U007A> \x7a |0 LATIN SMALL LETTER Z
+<U007B> \x7b |0 LEFT CURLY BRACKET
+<U007C> \x7c |0 VERTICAL LINE
+<U007D> \x7d |0 RIGHT CURLY BRACKET
+<U007E> \x7e |0 TILDE
+<U007F> \x7f |0 DELETE (DEL)
+<U2500> \x80 |0 BOX DRAWINGS LIGHT HORIZONTAL
+<U2502> \x81 |0 BOX DRAWINGS LIGHT VERTICAL
+<U250C> \x82 |0 BOX DRAWINGS LIGHT DOWN AND RIGHT
+<U2510> \x83 |0 BOX DRAWINGS LIGHT DOWN AND LEFT
+<U2514> \x84 |0 BOX DRAWINGS LIGHT UP AND RIGHT
+<U2518> \x85 |0 BOX DRAWINGS LIGHT UP AND LEFT
+<U251C> \x86 |0 BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+<U2524> \x87 |0 BOX DRAWINGS LIGHT VERTICAL AND LEFT
+<U252C> \x88 |0 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+<U2534> \x89 |0 BOX DRAWINGS LIGHT UP AND HORIZONTAL
+<U253C> \x8a |0 BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+<U2580> \x8b |0 UPPER HALF BLOCK
+<U2584> \x8c |0 LOWER HALF BLOCK
+<U2588> \x8d |0 FULL BLOCK
+<U258C> \x8e |0 LEFT HALF BLOCK
+<U2590> \x8f |0 RIGHT HALF BLOCK
+<U2591> \x90 |0 LIGHT SHADE
+<U2592> \x91 |0 MEDIUM SHADE
+<U2593> \x92 |0 DARK SHADE
+<U2320> \x93 |0 TOP HALF INTEGRAL
+<U25A0> \x94 |0 BLACK SQUARE
+<U2219> \x95 |0 BULLET OPERATOR
+<U221A> \x96 |0 SQUARE ROOT
+<U2248> \x97 |0 ALMOST EQUAL TO
+<U2264> \x98 |0 LESS THAN OR EQUAL TO
+<U2265> \x99 |0 GREATER THAN OR EQUAL TO
+<U00A0> \x9a |0 NO-BREAK SPACE
+<U2321> \x9b |0 BOTTOM HALF INTEGRAL
+<U00B0> \x9c |0 DEGREE SIGN
+<U00B2> \x9d |0 SUPERSCRIPT DIGIT TWO
+<U00B7> \x9e |0 MIDDLE DOT
+<U00F7> \x9f |0 DIVISION SIGN
+<U2550> \xa0 |0 BOX DRAWINGS DOUBLE HORIZONTAL
+<U2551> \xa1 |0 BOX DRAWINGS DOUBLE VERTICAL
+<U2552> \xa2 |0 BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+<U0451> \xa3 |0 CYRILLIC SMALL LETTER IO
+<U0454> \xa4 |0 CYRILLIC SMALL LETTER UKRAINIAN IE
+<U2554> \xa5 |0 BOX DRAWINGS DOUBLE DOWN AND RIGHT
+<U0456> \xa6 |0 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+<U0457> \xa7 |0 CYRILLIC SMALL LETTER YI (Ukrainian)
+<U2557> \xa8 |0 BOX DRAWINGS DOUBLE DOWN AND LEFT
+<U2558> \xa9 |0 BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+<U2559> \xaa |0 BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+<U255A> \xab |0 BOX DRAWINGS DOUBLE UP AND RIGHT
+<U255B> \xac |0 BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+<U0491> \xad |0 CYRILLIC SMALL LETTER GHE WITH UPTURN
+<U255D> \xae |0 BOX DRAWINGS DOUBLE UP AND LEFT
+<U255E> \xaf |0 BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+<U255F> \xb0 |0 BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+<U2560> \xb1 |0 BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+<U2561> \xb2 |0 BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+<U0401> \xb3 |0 CYRILLIC CAPITAL LETTER IO
+<U0404> \xb4 |0 CYRILLIC CAPITAL LETTER UKRAINIAN IE
+<U2563> \xb5 |0 DOUBLE VERTICAL AND LEFT
+<U0406> \xb6 |0 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+<U0407> \xb7 |0 CYRILLIC CAPITAL LETTER YI (Ukrainian)
+<U2566> \xb8 |0 BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+<U2567> \xb9 |0 BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+<U2568> \xba |0 BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+<U2569> \xbb |0 BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+<U256A> \xbc |0 BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+<U0490> \xbd |0 CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+<U256C> \xbe |0 BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+<U00A9> \xbf |0 COPYRIGHT SIGN
+<U044E> \xc0 |0 CYRILLIC SMALL LETTER YU
+<U0430> \xc1 |0 CYRILLIC SMALL LETTER A
+<U0431> \xc2 |0 CYRILLIC SMALL LETTER BE
+<U0446> \xc3 |0 CYRILLIC SMALL LETTER TSE
+<U0434> \xc4 |0 CYRILLIC SMALL LETTER DE
+<U0435> \xc5 |0 CYRILLIC SMALL LETTER IE
+<U0444> \xc6 |0 CYRILLIC SMALL LETTER EF
+<U0433> \xc7 |0 CYRILLIC SMALL LETTER GHE
+<U0445> \xc8 |0 CYRILLIC SMALL LETTER HA
+<U0438> \xc9 |0 CYRILLIC SMALL LETTER I
+<U0439> \xca |0 CYRILLIC SMALL LETTER SHORT I
+<U043A> \xcb |0 CYRILLIC SMALL LETTER KA
+<U043B> \xcc |0 CYRILLIC SMALL LETTER EL
+<U043C> \xcd |0 CYRILLIC SMALL LETTER EM
+<U043D> \xce |0 CYRILLIC SMALL LETTER EN
+<U043E> \xcf |0 CYRILLIC SMALL LETTER O
+<U043F> \xd0 |0 CYRILLIC SMALL LETTER PE
+<U044F> \xd1 |0 CYRILLIC SMALL LETTER YA
+<U0440> \xd2 |0 CYRILLIC SMALL LETTER ER
+<U0441> \xd3 |0 CYRILLIC SMALL LETTER ES
+<U0442> \xd4 |0 CYRILLIC SMALL LETTER TE
+<U0443> \xd5 |0 CYRILLIC SMALL LETTER U
+<U0436> \xd6 |0 CYRILLIC SMALL LETTER ZHE
+<U0432> \xd7 |0 CYRILLIC SMALL LETTER VE
+<U044C> \xd8 |0 CYRILLIC SMALL LETTER SOFT SIGN
+<U044B> \xd9 |0 CYRILLIC SMALL LETTER YERU
+<U0437> \xda |0 CYRILLIC SMALL LETTER ZE
+<U0448> \xdb |0 CYRILLIC SMALL LETTER SHA
+<U044D> \xdc |0 CYRILLIC SMALL LETTER E
+<U0449> \xdd |0 CYRILLIC SMALL LETTER SHCHA
+<U0447> \xde |0 CYRILLIC SMALL LETTER CHE
+<U044A> \xdf |0 CYRILLIC SMALL LETTER HARD SIGN
+<U042E> \xe0 |0 CYRILLIC CAPITAL LETTER YU
+<U0410> \xe1 |0 CYRILLIC CAPITAL LETTER A
+<U0411> \xe2 |0 CYRILLIC CAPITAL LETTER BE
+<U0426> \xe3 |0 CYRILLIC CAPITAL LETTER TSE
+<U0414> \xe4 |0 CYRILLIC CAPITAL LETTER DE
+<U0415> \xe5 |0 CYRILLIC CAPITAL LETTER IE
+<U0424> \xe6 |0 CYRILLIC CAPITAL LETTER EF
+<U0413> \xe7 |0 CYRILLIC CAPITAL LETTER GHE
+<U0425> \xe8 |0 CYRILLIC CAPITAL LETTER HA
+<U0418> \xe9 |0 CYRILLIC CAPITAL LETTER I
+<U0419> \xea |0 CYRILLIC CAPITAL LETTER SHORT I
+<U041A> \xeb |0 CYRILLIC CAPITAL LETTER KA
+<U041B> \xec |0 CYRILLIC CAPITAL LETTER EL
+<U041C> \xed |0 CYRILLIC CAPITAL LETTER EM
+<U041D> \xee |0 CYRILLIC CAPITAL LETTER EN
+<U041E> \xef |0 CYRILLIC CAPITAL LETTER O
+<U041F> \xf0 |0 CYRILLIC CAPITAL LETTER PE
+<U042F> \xf1 |0 CYRILLIC CAPITAL LETTER YA
+<U0420> \xf2 |0 CYRILLIC CAPITAL LETTER ER
+<U0421> \xf3 |0 CYRILLIC CAPITAL LETTER ES
+<U0422> \xf4 |0 CYRILLIC CAPITAL LETTER TE
+<U0423> \xf5 |0 CYRILLIC CAPITAL LETTER U
+<U0416> \xf6 |0 CYRILLIC CAPITAL LETTER ZHE
+<U0412> \xf7 |0 CYRILLIC CAPITAL LETTER VE
+<U042C> \xf8 |0 CYRILLIC CAPITAL LETTER SOFT SIGN
+<U042B> \xf9 |0 CYRILLIC CAPITAL LETTER YERU
+<U0417> \xfa |0 CYRILLIC CAPITAL LETTER ZE
+<U0428> \xfb |0 CYRILLIC CAPITAL LETTER SHA
+<U042D> \xfc |0 CYRILLIC CAPITAL LETTER E
+<U0429> \xfd |0 CYRILLIC CAPITAL LETTER SHCHA
+<U0427> \xfe |0 CYRILLIC CAPITAL LETTER CHE
+<U042A> \xff |0 CYRILLIC CAPITAL LETTER HARD SIGN
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Other/list.unix b/mcs/class/I18N/Other/list.unix
new file mode 100755
index 00000000000..ba7d74a68db
--- /dev/null
+++ b/mcs/class/I18N/Other/list.unix
@@ -0,0 +1,9 @@
+CP1251.cs
+CP1257.cs
+CP1258.cs
+CP20866.cs
+CP21866.cs
+CP28594.cs
+CP28595.cs
+CP57002.cs
+CP874.cs
diff --git a/mcs/class/I18N/Other/makefile.gnu b/mcs/class/I18N/Other/makefile.gnu
new file mode 100755
index 00000000000..c13fbb95068
--- /dev/null
+++ b/mcs/class/I18N/Other/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../../..
+
+LIBRARY = $(topdir)/class/lib/I18N.Other.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r mscorlib -r I18N
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/README b/mcs/class/I18N/README
new file mode 100644
index 00000000000..29852983254
--- /dev/null
+++ b/mcs/class/I18N/README
@@ -0,0 +1,158 @@
+
+I18N: Pnetlib Internationalization Framework Libary
+===================================================
+
+Using the library
+-----------------
+
+This library provides plug-in i18n module support for C# base class
+libraries such as pnetlib's "runtime". The base class library uses
+it as follows:
+
+ - Load the "I18N.dll" assembly using "System.Reflection.Assembly.Load".
+
+ - Obtain the value of the static "PrimaryManager" property within the
+ "I18N.Common.Manager" class using "System.Reflection" facilities.
+
+ - Invoke methods on the manager class to obtain i18n-sensitive
+ objects such as "CultureInfo" and "Encoding" instances.
+
+ - The "I18N.Common.Manager" class loads the requested i18n object
+ and returns it to the base class library, which can then use it
+ in the usual fashion.
+
+A more detailed example is given in a later section.
+
+I18N handlers
+-------------
+
+Because there are so many i18n-sensitive cases to be handled, the culture
+information has been split across several region-specific assemblies:
+
+ I18N.CJK.dll
+ I18N.MidEast.dll
+ I18N.Other.dll
+ I18N.Rare.dll
+ I18N.West.dll
+
+The "I18N.dll" assembly only loads those region-specific assemblies that
+it needs, based on the user's requests.
+
+I18N handlers within these assemblies use the naming convention
+"I18N.<Region>.<Prefix><Value>" where:
+
+ <Region>
+ The region handler. e.g. "West", "CJK", "India", etc.
+
+ <Prefix>
+ The prefix for the handler type.
+
+ <Value>
+ The identifier value which is supplied by the caller.
+ e.g. a culture identifier, an encoding name, etc.
+
+The following prefixes are supported:
+
+ CP
+ Code page handler. e.g. "CP1252".
+
+ ENC
+ Web encoding handler. e.g. "ENCiso_8869_8".
+
+ CID
+ Culture, based on identifier. e.g. "CID2c01".
+
+ CIDO
+
+ Culture, based on identifier, with user overrides. e.g. "CIDO2c01".
+ Falls back to the "CID" handler if no override handler.
+
+ CN
+ Culture, based on name. e.g. "CNar_jo".
+
+ CNO
+ Culture, based on name, with user overrides. e.g. "CNOar_jo".
+ Falls back to the "CN" handler if no override handler.
+
+Handlers that are based on name will normalize the name to be in all
+lower case, with all instances of '-' replaced with '_'.
+
+The "I18N.dll" assembly knows which region assembly to load from the
+"I18N-handlers.def" file. This file is automatically generated during
+the build process and contains a list of all I18N handler classes.
+It must reside in the same directory as "I18N.dll".
+
+Example
+-------
+
+As an example of the I18N loading process, we will describe what happens
+when code page 932 is requested:
+
+ - The user's code calls "System.Text.Encoding.GetEncoding(932)".
+
+ - The "Encoding" class loads "I18N.dll" using reflection.
+
+ - The "Encoding" class accesses the "PrimaryManager" property via
+ reflection to get an instance of "I18N.Common.Manager".
+
+ - The "Encoding" class calls the "GetEncoding(int)" method on
+ the "I18N.Common.Manager" instance using reflection.
+
+ - "I18N.Common.Manager" constructs the name of the handler class - "CP932".
+
+ - The file "I18N-handlers.def" is consulted to determine the full
+ namespace and name of the "CP932" class - "I18N.CJK.CP932".
+
+ - The region assembly "I18N.CJK.dll" is loaded using reflection.
+
+ - An instance of the class "I18N.CJK.CP923" in the loaded assembly
+ is constructed and returned to the caller.
+
+The results of previous requests are cached to smooth overall performance
+of the system.
+
+Dependencies
+------------
+
+This section describes the facilities that must be available from the
+base class library to make the I18N framework function.
+
+The framework makes heavy use of facilities from "System.Reflection"
+to load assemblies and to access their contents.
+
+String resources are assumed to be embedded as manifest string resources,
+based on tag names. The "I18N.Common.Strings" class takes care of the
+resource needs of all of the I18N assemblies. It relies upon a working
+implementation of "ResourceManager", that can load and process manifest
+string resources.
+
+It is assumed that the base class library contains its own implementation
+of the invariant culture. i.e. the invariant culture cannot be loaded
+dynamically.
+
+The "I18N.CJK.dll" assembly contains a single "InternalCall" method in
+the "I18N.CJK.CodeTable" class if the "__PNET__" symbol is defined when
+the assembly is compiled. This gives more efficient access to conversion
+CJK tables when running on the Portable.NET runtime engine. If the
+"__PNET__" symbol is not defined, then the implementation will fall back
+to a less efficient way of loading the tables.
+
+The method "System.Reflection.Assembly.GetFile(String)" is assumed to
+have slightly different semantics to the .NET Framework SDK. Normally,
+this method accesses a file that is listed in the assembly manifest.
+We have extended it so that it can also access files in the same directory
+as the assembly, even if not mentioned in the manifest.
+
+The altered semantics is necessary to access the "I18N-handlers.def" file,
+which defines which assembly contains which I18N handler. This file can
+be altered by third parties to install new handler assemblies.
+
+If the runtime engine does not implement the altered "GetFile" semantics,
+the library will fall back to an internal list that must be maintained
+internally and which cannot be dynamically extended by third parties.
+
+Security considerations
+-----------------------
+
+The "GetAddress" and "GetFile" methods need to be implemented carefully
+to prevent arbitrary applications using them to circumvent system security.
diff --git a/mcs/class/I18N/README.mono b/mcs/class/I18N/README.mono
new file mode 100755
index 00000000000..dcedd9c2264
--- /dev/null
+++ b/mcs/class/I18N/README.mono
@@ -0,0 +1,13 @@
+Note: the I18N assemblies code is imported from the pnetlib sources.
+The code was donated by Rhys Weatherley <rweather@southern-storm.com.au>
+for use in mono.
+_Any_ change and bugfix to these assemblies that is not mono-specific
+should be also sent to the pnetlib maintainers to keep the sources in
+sync as much as possible.
+
+The code was initially imported with the command:
+ cvs -d login@mono-cvs.ximian.com:/cvs/public import -m "First import" \
+ mcs/class/I18N SAVANNAH_CVS RHYS_20020821
+
+Please follow the same convention for future imports. Thanks.
+
diff --git a/mcs/class/I18N/Rare/.cvsignore b/mcs/class/I18N/Rare/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/I18N/Rare/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/I18N/Rare/CP1026.cs b/mcs/class/I18N/Rare/CP1026.cs
new file mode 100644
index 00000000000..82dffbbd0ca
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1026.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1026.cs - IBM EBCDIC (Turkish) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1026.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1026 : ByteEncoding
+{
+ public CP1026()
+ : base(1026, ToChars, "IBM EBCDIC (Turkish)",
+ "ibm1026", "ibm1026", "ibm1026",
+ false, false, false, false, 1254)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u007B', '\u00F1', '\u00C7', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u011E', '\u0130', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u005B', '\u00D1', '\u015F', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0131', '\u003A', '\u00D6', '\u015E', '\u0027',
+ '\u003D', '\u00DC', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u007D', '\u0060', '\u00A6', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u00F6',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u005D', '\u0024',
+ '\u0040', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E7', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u007E', '\u00F2', '\u00F3', '\u00F5', '\u011F', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u005C', '\u00F9',
+ '\u00FA', '\u00FF', '\u00FC', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u0023', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u0022', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0xFC; break;
+ case 0x0023: ch = 0xEC; break;
+ case 0x0024: ch = 0xAD; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xAE; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x68; break;
+ case 0x005C: ch = 0xDC; break;
+ case 0x005D: ch = 0xAC; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x8D; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x48; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x8C; break;
+ case 0x007E: ch = 0xCC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x8E; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x4A; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x7B; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0x7F; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xC0; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xA1; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xE0; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x011E: ch = 0x5A; break;
+ case 0x011F: ch = 0xD0; break;
+ case 0x0130: ch = 0x5B; break;
+ case 0x0131: ch = 0x79; break;
+ case 0x015E: ch = 0x7C; break;
+ case 0x015F: ch = 0x6A; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0xFC; break;
+ case 0xFF03: ch = 0xEC; break;
+ case 0xFF04: ch = 0xAD; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xAE; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x68; break;
+ case 0xFF3C: ch = 0xDC; break;
+ case 0xFF3D: ch = 0xAC; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x8D; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x48; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x8C; break;
+ case 0xFF5E: ch = 0xCC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0xFC; break;
+ case 0x0023: ch = 0xEC; break;
+ case 0x0024: ch = 0xAD; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xAE; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x68; break;
+ case 0x005C: ch = 0xDC; break;
+ case 0x005D: ch = 0xAC; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x8D; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x48; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x8C; break;
+ case 0x007E: ch = 0xCC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x8E; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x4A; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x7B; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0x7F; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xC0; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xA1; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xE0; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x011E: ch = 0x5A; break;
+ case 0x011F: ch = 0xD0; break;
+ case 0x0130: ch = 0x5B; break;
+ case 0x0131: ch = 0x79; break;
+ case 0x015E: ch = 0x7C; break;
+ case 0x015F: ch = 0x6A; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0xFC; break;
+ case 0xFF03: ch = 0xEC; break;
+ case 0xFF04: ch = 0xAD; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xAE; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x68; break;
+ case 0xFF3C: ch = 0xDC; break;
+ case 0xFF3D: ch = 0xAC; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x8D; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x48; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x8C; break;
+ case 0xFF5E: ch = 0xCC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1026
+
+public class ENCibm1026 : CP1026
+{
+ public ENCibm1026() : base() {}
+
+}; // class ENCibm1026
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1047.cs b/mcs/class/I18N/Rare/CP1047.cs
new file mode 100644
index 00000000000..9c6da572a3f
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1047.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1047.cs - IBM EBCDIC (Open Systems Latin 1) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1047.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1047 : ByteEncoding
+{
+ public CP1047()
+ : base(1047, ToChars, "IBM EBCDIC (Open Systems Latin 1)",
+ "ibm1047", "ibm1047", "ibm1047",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00A2', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u0021', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u005B',
+ '\u00DE', '\u00AE', '\u00AC', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00DD', '\u00A8', '\u00AF', '\u005D', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xAD; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBD; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBB; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xB0; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xBA; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xAD; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBD; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xAD; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBD; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBB; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xB0; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xBA; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xAD; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBD; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1047
+
+public class ENCibm1047 : CP1047
+{
+ public ENCibm1047() : base() {}
+
+}; // class ENCibm1047
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1140.cs b/mcs/class/I18N/Rare/CP1140.cs
new file mode 100644
index 00000000000..479c3c39875
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1140.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1140.cs - IBM EBCDIC (US-Canada with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1140.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1140 : ByteEncoding
+{
+ public CP1140()
+ : base(1140, ToChars, "IBM EBCDIC (US-Canada with Euro)",
+ "IBM01140", "IBM01140", "IBM01140",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00A2', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u0021', '\u0024', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u00B5', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u005E', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005B', '\u005D', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xBA; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xBA; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xBA; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xBA; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1140
+
+public class ENCibm01140 : CP1140
+{
+ public ENCibm01140() : base() {}
+
+}; // class ENCibm01140
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1141.cs b/mcs/class/I18N/Rare/CP1141.cs
new file mode 100644
index 00000000000..345b13d5cf9
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1141.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1141.cs - IBM EBCDIC (Germany with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1141.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1141 : ByteEncoding
+{
+ public CP1141()
+ : base(1141, ToChars, "IBM EBCDIC (Germany with Euro)",
+ "IBM01141", "IBM01141", "IBM01141",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u007B', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00C4', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u007E',
+ '\u00DC', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u005B', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u00A7', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u00B5', '\u00DF',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u0040', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E4', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00A6', '\u00F2', '\u00F3', '\u00F5', '\u00FC', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u007D', '\u00F9',
+ '\u00FA', '\u00FF', '\u00D6', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u005C', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u005D', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x63; break;
+ case 0x005C: ch = 0xEC; break;
+ case 0x005D: ch = 0xFC; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xDC; break;
+ case 0x007E: ch = 0x59; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x4A; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xE0; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0x5A; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0xA1; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xD0; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x63; break;
+ case 0xFF3C: ch = 0xEC; break;
+ case 0xFF3D: ch = 0xFC; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xDC; break;
+ case 0xFF5E: ch = 0x59; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x63; break;
+ case 0x005C: ch = 0xEC; break;
+ case 0x005D: ch = 0xFC; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xDC; break;
+ case 0x007E: ch = 0x59; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x4A; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xE0; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0x5A; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0xA1; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xD0; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x63; break;
+ case 0xFF3C: ch = 0xEC; break;
+ case 0xFF3D: ch = 0xFC; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xDC; break;
+ case 0xFF5E: ch = 0x59; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1141
+
+public class ENCibm01141 : CP1141
+{
+ public ENCibm01141() : base() {}
+
+}; // class ENCibm01141
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1142.cs b/mcs/class/I18N/Rare/CP1142.cs
new file mode 100644
index 00000000000..a6d618e23db
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1142.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1142.cs - IBM EBCDIC (Denmark/Norway with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1142.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1142 : ByteEncoding
+{
+ public CP1142()
+ : base(1142, ToChars, "IBM EBCDIC (Denmark/Norway with Euro)",
+ "IBM01142", "IBM01142", "IBM01142",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u007D',
+ '\u00E7', '\u00F1', '\u0023', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u20AC', '\u00C5', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u0024', '\u00C7', '\u00D1', '\u00F8', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00A6', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u00C6', '\u00D8', '\u0027',
+ '\u003D', '\u0022', '\u0040', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u007B', '\u00B8', '\u005B', '\u005D', '\u00B5', '\u00FC',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E6', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u00E5', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u007E', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x4A; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x80; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x9E; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x9C; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x70; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x7B; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x7C; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0xC0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x6A; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x5A; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x4A; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x80; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x9E; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x9C; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x4A; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x80; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x9E; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x9C; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x70; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x7B; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x7C; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0xC0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x6A; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x5A; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x4A; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x80; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x9E; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x9C; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1142
+
+public class ENCibm01142 : CP1142
+{
+ public ENCibm01142() : base() {}
+
+}; // class ENCibm01142
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1143.cs b/mcs/class/I18N/Rare/CP1143.cs
new file mode 100644
index 00000000000..26566973b89
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1143.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1143.cs - IBM EBCDIC (Finland/Sweden with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1143.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1143 : ByteEncoding
+{
+ public CP1143()
+ : base(1143, ToChars, "IBM EBCDIC (Finland/Sweden with Euro)",
+ "IBM01143", "IBM01143", "IBM01143",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u007B', '\u00E0', '\u00E1', '\u00E3', '\u007D',
+ '\u00E7', '\u00F1', '\u00A7', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u0060', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u20AC', '\u00C5', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u0023', '\u00C0', '\u00C1',
+ '\u00C3', '\u0024', '\u00C7', '\u00D1', '\u00F6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u005C',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00E9', '\u003A', '\u00C4', '\u00D6', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u005D', '\u00B5', '\u00FC',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u005B', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E4', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00A6', '\u00F2', '\u00F3', '\u00F5', '\u00E5', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u007E', '\u00F9',
+ '\u00FA', '\u00FF', '\u00C9', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u0040', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x63; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xEC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB5; break;
+ case 0x005C: ch = 0x71; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x51; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x4A; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x7B; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0xE0; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x7C; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x79; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x5A; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x63; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xEC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB5; break;
+ case 0xFF3C: ch = 0x71; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x51; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x63; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xEC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB5; break;
+ case 0x005C: ch = 0x71; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x51; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x4A; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x7B; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0xE0; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x7C; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x79; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x5A; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x63; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xEC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB5; break;
+ case 0xFF3C: ch = 0x71; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x51; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1143
+
+public class ENCibm01143 : CP1143
+{
+ public ENCibm01143() : base() {}
+
+}; // class ENCibm01143
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1144.cs b/mcs/class/I18N/Rare/CP1144.cs
new file mode 100644
index 00000000000..4debbd934eb
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1144.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1144.cs - IBM EBCDIC (Italy with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1144.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1144 : ByteEncoding
+{
+ public CP1144()
+ : base(1144, ToChars, "IBM EBCDIC (Italy with Euro)",
+ "ibm1144", "ibm1144", "ibm1144",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u007B', '\u00E1', '\u00E3', '\u00E5',
+ '\u005C', '\u00F1', '\u00B0', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u005D', '\u00EA', '\u00EB',
+ '\u007D', '\u00ED', '\u00EE', '\u00EF', '\u007E', '\u00DF',
+ '\u00E9', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F2', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00F9', '\u003A', '\u00A3', '\u00A7', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u005B', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u00B5', '\u00EC',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u0023', '\u00A5', '\u00B7',
+ '\u00A9', '\u0040', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E0', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00A6', '\u00F3', '\u00F5', '\u00E8', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u0060',
+ '\u00FA', '\u00FF', '\u00E7', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0x51; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xDD; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x44; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0x58; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCD; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0xC0; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0x5A; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0xA1; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0x6A; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x79; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0x51; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xDD; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x44; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0x58; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0x51; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xDD; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x44; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0x58; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCD; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0xC0; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0x5A; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0xA1; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0x6A; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x79; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0x51; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xDD; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x44; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0x58; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1144
+
+public class ENCibm1144 : CP1144
+{
+ public ENCibm1144() : base() {}
+
+}; // class ENCibm1144
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1145.cs b/mcs/class/I18N/Rare/CP1145.cs
new file mode 100644
index 00000000000..d2e01263499
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1145.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1145.cs - IBM EBCDIC (Latin America/Spain with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1145.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1145 : ByteEncoding
+{
+ public CP1145()
+ : base(1145, ToChars, "IBM EBCDIC (Latin America/Spain with Euro)",
+ "ibm1145", "ibm1145", "ibm1145",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00A6', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u0023', '\u00F1', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u00D1', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u00B5', '\u00A8',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005E', '\u0021', '\u00AF', '\u007E', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0xBB; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x69; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x49; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x7B; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x6A; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0xBB; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x69; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0xBB; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x69; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x49; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x7B; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x6A; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0xBB; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x69; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1145
+
+public class ENCibm1145 : CP1145
+{
+ public ENCibm1145() : base() {}
+
+}; // class ENCibm1145
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1146.cs b/mcs/class/I18N/Rare/CP1146.cs
new file mode 100644
index 00000000000..a68de00de82
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1146.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1146.cs - IBM EBCDIC (United Kingdom with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1146.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1146 : ByteEncoding
+{
+ public CP1146()
+ : base(1146, ToChars, "IBM EBCDIC (United Kingdom with Euro)",
+ "ibm1146", "ibm1146", "ibm1146",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u0024', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u0021', '\u00A3', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u00B5', '\u00AF',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u005B', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005E', '\u005D', '\u007E', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x4A; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB1; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x5B; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xA1; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xA1; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x4A; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB1; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x4A; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB1; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x5B; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xA1; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xA1; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x4A; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB1; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1146
+
+public class ENCibm1146 : CP1146
+{
+ public ENCibm1146() : base() {}
+
+}; // class ENCibm1146
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1147.cs b/mcs/class/I18N/Rare/CP1147.cs
new file mode 100644
index 00000000000..700d07bbc94
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1147.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1147.cs - IBM EBCDIC (France with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1147.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1147 : ByteEncoding
+{
+ public CP1147()
+ : base(1147, ToChars, "IBM EBCDIC (France with Euro)",
+ "ibm1147", "ibm1147", "ibm1147",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u0040', '\u00E1', '\u00E3', '\u00E5',
+ '\u005C', '\u00F1', '\u00B0', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u007B', '\u00EA', '\u00EB',
+ '\u007D', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u00A7', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F9', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00B5', '\u003A', '\u00A3', '\u00E0', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u005B', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u0060', '\u00A8',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u0023', '\u00A5', '\u00B7',
+ '\u00A9', '\u005D', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u007E', '\u00B4', '\u00D7',
+ '\u00E9', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u00E8', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00A6',
+ '\u00FA', '\u00FF', '\u00E7', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x44; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0xB5; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xA0; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x51; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0x5A; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0x79; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x7C; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0xC0; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x6A; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x44; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0xB5; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xA0; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x51; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x44; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0xB5; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xA0; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x51; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0x5A; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0x79; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x7C; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0xC0; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x6A; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x44; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0xB5; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xA0; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x51; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1147
+
+public class ENCibm1147 : CP1147
+{
+ public ENCibm1147() : base() {}
+
+}; // class ENCibm1147
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1148.cs b/mcs/class/I18N/Rare/CP1148.cs
new file mode 100644
index 00000000000..6d911aa295c
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1148.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1148.cs - IBM EBCDIC (International with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1148.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1148 : ByteEncoding
+{
+ public CP1148()
+ : base(1148, ToChars, "IBM EBCDIC (International with Euro)",
+ "ibm1148", "ibm1148", "ibm1148",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u20AC', '\u00B5', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1148
+
+public class ENCibm1148 : CP1148
+{
+ public ENCibm1148() : base() {}
+
+}; // class ENCibm1148
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP1149.cs b/mcs/class/I18N/Rare/CP1149.cs
new file mode 100644
index 00000000000..97864e9b9c0
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP1149.cs
@@ -0,0 +1,895 @@
+/*
+ * CP1149.cs - IBM EBCDIC (Icelandic with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1149.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP1149 : ByteEncoding
+{
+ public CP1149()
+ : base(1149, ToChars, "IBM EBCDIC (Icelandic with Euro)",
+ "ibm1149", "ibm1149", "ibm1149",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00DE', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u00C6', '\u0024', '\u002A', '\u0029', '\u003B', '\u00D6',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00F0', '\u003A', '\u0023', '\u00D0', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u0060', '\u00FD', '\u007B', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u007D', '\u00B8', '\u005D', '\u20AC', '\u00B5', '\u00F6',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u0040', '\u00DD',
+ '\u005B', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u005C', '\u00D7',
+ '\u00FE', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u007E', '\u00F2', '\u00F3', '\u00F5', '\u00E6', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u00B4', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u005E', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xAC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xAE; break;
+ case 0x005C: ch = 0xBE; break;
+ case 0x005D: ch = 0x9E; break;
+ case 0x005E: ch = 0xEC; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x8C; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x8E; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x9C; break;
+ case 0x007E: ch = 0xCC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xE0; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x5A; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0x7C; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x5F; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0x4A; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0xD0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x79; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xA1; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0xC0; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xAC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xAE; break;
+ case 0xFF3C: ch = 0xBE; break;
+ case 0xFF3D: ch = 0x9E; break;
+ case 0xFF3E: ch = 0xEC; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x8C; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x8E; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x9C; break;
+ case 0xFF5E: ch = 0xCC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xAC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xAE; break;
+ case 0x005C: ch = 0xBE; break;
+ case 0x005D: ch = 0x9E; break;
+ case 0x005E: ch = 0xEC; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x8C; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x8E; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x9C; break;
+ case 0x007E: ch = 0xCC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xE0; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x5A; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0x7C; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x5F; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0x4A; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0xD0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x79; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xA1; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0xC0; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0x20AC: ch = 0x9F; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xAC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xAE; break;
+ case 0xFF3C: ch = 0xBE; break;
+ case 0xFF3D: ch = 0x9E; break;
+ case 0xFF3E: ch = 0xEC; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x8C; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x8E; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x9C; break;
+ case 0xFF5E: ch = 0xCC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1149
+
+public class ENCibm1149 : CP1149
+{
+ public ENCibm1149() : base() {}
+
+}; // class ENCibm1149
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20273.cs b/mcs/class/I18N/Rare/CP20273.cs
new file mode 100644
index 00000000000..2590ba7e18d
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20273.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20273.cs - IBM EBCDIC (Germany) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-273.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20273 : ByteEncoding
+{
+ public CP20273()
+ : base(20273, ToChars, "IBM EBCDIC (Germany)",
+ "IBM273", "IBM273", "IBM273",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u007B', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00C4', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u007E',
+ '\u00DC', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u005B', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u00A7', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u00DF',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u0040', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E4', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00A6', '\u00F2', '\u00F3', '\u00F5', '\u00FC', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u007D', '\u00F9',
+ '\u00FA', '\u00FF', '\u00D6', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u005C', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u005D', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x63; break;
+ case 0x005C: ch = 0xEC; break;
+ case 0x005D: ch = 0xFC; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xDC; break;
+ case 0x007E: ch = 0x59; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x4A; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xE0; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0x5A; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0xA1; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xD0; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x63; break;
+ case 0xFF3C: ch = 0xEC; break;
+ case 0xFF3D: ch = 0xFC; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xDC; break;
+ case 0xFF5E: ch = 0x59; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x63; break;
+ case 0x005C: ch = 0xEC; break;
+ case 0x005D: ch = 0xFC; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xDC; break;
+ case 0x007E: ch = 0x59; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x4A; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xE0; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0x5A; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0xA1; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xD0; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x63; break;
+ case 0xFF3C: ch = 0xEC; break;
+ case 0xFF3D: ch = 0xFC; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xDC; break;
+ case 0xFF5E: ch = 0x59; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20273
+
+public class ENCibm273 : CP20273
+{
+ public ENCibm273() : base() {}
+
+}; // class ENCibm273
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20277.cs b/mcs/class/I18N/Rare/CP20277.cs
new file mode 100644
index 00000000000..8b0c5e56926
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20277.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20277.cs - IBM EBCDIC (Denmark/Norway) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-277.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20277 : ByteEncoding
+{
+ public CP20277()
+ : base(20277, ToChars, "IBM EBCDIC (Denmark/Norway)",
+ "IBM277", "IBM277", "IBM277",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u007D',
+ '\u00E7', '\u00F1', '\u0023', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u00A4', '\u00C5', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u0024', '\u00C7', '\u00D1', '\u00F8', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00A6', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u00C6', '\u00D8', '\u0027',
+ '\u003D', '\u0022', '\u0040', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u007B', '\u00B8', '\u005B', '\u005D', '\u00B5', '\u00FC',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E6', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u00E5', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u007E', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x4A; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x80; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x9E; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x9C; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x5A; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x70; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x7B; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x7C; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0xC0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x6A; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x4A; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x80; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x9E; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x9C; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x4A; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x80; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x9E; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x9C; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x5A; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x70; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x7B; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x7C; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0xC0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x6A; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x4A; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x80; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x9E; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x9C; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20277
+
+public class ENCibm277 : CP20277
+{
+ public ENCibm277() : base() {}
+
+}; // class ENCibm277
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20278.cs b/mcs/class/I18N/Rare/CP20278.cs
new file mode 100644
index 00000000000..56f03e2f5aa
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20278.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20278.cs - IBM EBCDIC (Finland/Sweden) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-278.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20278 : ByteEncoding
+{
+ public CP20278()
+ : base(20278, ToChars, "IBM EBCDIC (Finland/Sweden)",
+ "IBM278", "IBM278", "IBM278",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u007B', '\u00E0', '\u00E1', '\u00E3', '\u007D',
+ '\u00E7', '\u00F1', '\u00A7', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u0060', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u00A4', '\u00C5', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u0023', '\u00C0', '\u00C1',
+ '\u00C3', '\u0024', '\u00C7', '\u00D1', '\u00F6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u005C',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00E9', '\u003A', '\u00C4', '\u00D6', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u005D', '\u00B5', '\u00FC',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u005B', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E4', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00A6', '\u00F2', '\u00F3', '\u00F5', '\u00E5', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u007E', '\u00F9',
+ '\u00FA', '\u00FF', '\u00C9', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u0040', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x63; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xEC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB5; break;
+ case 0x005C: ch = 0x71; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x51; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x5A; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x4A; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x7B; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0xE0; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x7C; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x79; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x63; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xEC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB5; break;
+ case 0xFF3C: ch = 0x71; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x51; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x63; break;
+ case 0x0024: ch = 0x67; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xEC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB5; break;
+ case 0x005C: ch = 0x71; break;
+ case 0x005D: ch = 0x9F; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x51; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x43; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x47; break;
+ case 0x007E: ch = 0xDC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x5A; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCC; break;
+ case 0x00A7: ch = 0x4A; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x7B; break;
+ case 0x00C5: ch = 0x5B; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0xE0; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x7C; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0xC0; break;
+ case 0x00E5: ch = 0xD0; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x79; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0x6A; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xA1; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x63; break;
+ case 0xFF04: ch = 0x67; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xEC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB5; break;
+ case 0xFF3C: ch = 0x71; break;
+ case 0xFF3D: ch = 0x9F; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x51; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x43; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x47; break;
+ case 0xFF5E: ch = 0xDC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20278
+
+public class ENCibm278 : CP20278
+{
+ public ENCibm278() : base() {}
+
+}; // class ENCibm278
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20280.cs b/mcs/class/I18N/Rare/CP20280.cs
new file mode 100644
index 00000000000..d675956d980
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20280.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20280.cs - IBM EBCDIC (Italy) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-280.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20280 : ByteEncoding
+{
+ public CP20280()
+ : base(20280, ToChars, "IBM EBCDIC (Italy)",
+ "IBM280", "IBM280", "IBM280",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u007B', '\u00E1', '\u00E3', '\u00E5',
+ '\u005C', '\u00F1', '\u00B0', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u005D', '\u00EA', '\u00EB',
+ '\u007D', '\u00ED', '\u00EE', '\u00EF', '\u007E', '\u00DF',
+ '\u00E9', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F2', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00F9', '\u003A', '\u00A3', '\u00A7', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u005B', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u00EC',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u0023', '\u00A5', '\u00B7',
+ '\u00A9', '\u0040', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u00E0', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00A6', '\u00F3', '\u00F5', '\u00E8', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u0060',
+ '\u00FA', '\u00FF', '\u00E7', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0x51; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xDD; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x44; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0x58; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCD; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0xC0; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0x5A; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0xA1; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0x6A; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x79; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0x51; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xDD; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x44; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0x58; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xB5; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0x51; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xDD; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x44; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0x58; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xCD; break;
+ case 0x00A7: ch = 0x7C; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0xC0; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0x5A; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0xA1; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0x6A; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x79; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xB5; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0x51; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xDD; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x44; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0x58; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20280
+
+public class ENCibm280 : CP20280
+{
+ public ENCibm280() : base() {}
+
+}; // class ENCibm280
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20284.cs b/mcs/class/I18N/Rare/CP20284.cs
new file mode 100644
index 00000000000..df03a5271ea
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20284.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20284.cs - IBM EBCDIC (Latin America/Spain) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-284.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20284 : ByteEncoding
+{
+ public CP20284()
+ : base(20284, ToChars, "IBM EBCDIC (Latin America/Spain)",
+ "IBM284", "IBM284", "IBM284",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00A6', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u0023', '\u00F1', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u00D1', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u00A8',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005E', '\u0021', '\u00AF', '\u007E', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0xBB; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x69; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x49; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x7B; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x6A; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0xBB; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x69; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0xBB; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x69; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x49; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x7B; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x6A; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0xBB; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x69; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20284
+
+public class ENCibm284 : CP20284
+{
+ public ENCibm284() : base() {}
+
+}; // class ENCibm284
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20285.cs b/mcs/class/I18N/Rare/CP20285.cs
new file mode 100644
index 00000000000..20efc688ffb
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20285.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20285.cs - IBM EBCDIC (United Kingdom) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-285.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20285 : ByteEncoding
+{
+ public CP20285()
+ : base(20285, ToChars, "IBM EBCDIC (United Kingdom)",
+ "IBM285", "IBM285", "IBM285",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u0024', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u0021', '\u00A3', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u00AF',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u005B', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005E', '\u005D', '\u007E', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x4A; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB1; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x5B; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xA1; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xA1; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x4A; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB1; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x4A; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xB1; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xBA; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xBC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x5B; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xA1; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xA1; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x4A; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xB1; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xBA; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xBC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20285
+
+public class ENCibm285 : CP20285
+{
+ public ENCibm285() : base() {}
+
+}; // class ENCibm285
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20290.cs b/mcs/class/I18N/Rare/CP20290.cs
new file mode 100644
index 00000000000..4df3d74ce2b
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20290.cs
@@ -0,0 +1,865 @@
+/*
+ * CP20290.cs - IBM EBCDIC (Japanese Katakana Extended) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-290.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20290 : ByteEncoding
+{
+ public CP20290()
+ : base(20290, ToChars, "IBM EBCDIC (Japanese Katakana Extended)",
+ "IBM290", "IBM290", "IBM290",
+ false, false, false, false, 932)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\uFF61',
+ '\uFF62', '\uFF63', '\uFF64', '\uFF65', '\uFF66', '\uFF67',
+ '\uFF68', '\uFF69', '\u00A3', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\uFF6A', '\uFF6B', '\uFF6C',
+ '\uFF6D', '\uFF6E', '\uFF6F', '\u003F', '\uFF70', '\u003F',
+ '\u0021', '\u00A5', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u0061', '\u0062', '\u0063', '\u0064',
+ '\u0065', '\u0066', '\u0067', '\u0068', '\u003F', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u005B', '\u0069',
+ '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F',
+ '\u0070', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u005D', '\uFF71', '\uFF72', '\uFF73',
+ '\uFF74', '\uFF75', '\uFF76', '\uFF77', '\uFF78', '\uFF79',
+ '\uFF7A', '\u0071', '\uFF7B', '\uFF7C', '\uFF7D', '\uFF7E',
+ '\uFF7F', '\uFF80', '\uFF81', '\uFF82', '\uFF83', '\uFF84',
+ '\uFF85', '\uFF86', '\uFF87', '\uFF88', '\uFF89', '\u0072',
+ '\u003F', '\uFF8A', '\uFF8B', '\uFF8C', '\u007E', '\u203E',
+ '\uFF8D', '\uFF8E', '\uFF8F', '\uFF90', '\uFF91', '\uFF92',
+ '\uFF93', '\uFF94', '\uFF95', '\u0073', '\uFF96', '\uFF97',
+ '\uFF98', '\uFF99', '\u005E', '\u00A2', '\u005C', '\u0074',
+ '\u0075', '\u0076', '\u0077', '\u0078', '\u0079', '\u007A',
+ '\uFF9A', '\uFF9B', '\uFF9C', '\uFF9D', '\uFF9E', '\uFF9F',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u0024', '\u003F', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0xE0; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x70; break;
+ case 0x005C: ch = 0xB2; break;
+ case 0x005D: ch = 0x80; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ ch += 0x0001;
+ break;
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ ch += 0x0008;
+ break;
+ case 0x0071: ch = 0x8B; break;
+ case 0x0072: ch = 0x9B; break;
+ case 0x0073: ch = 0xAB; break;
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x003F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA0; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A2: ch = 0xB1; break;
+ case 0x00A3: ch = 0x4A; break;
+ case 0x00A5: ch = 0x5B; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x203E: ch = 0xA1; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0xE0; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x70; break;
+ case 0xFF3C: ch = 0xB2; break;
+ case 0xFF3D: ch = 0x80; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ ch -= 0xFEDF;
+ break;
+ case 0xFF49:
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ ch -= 0xFED8;
+ break;
+ case 0xFF51: ch = 0x8B; break;
+ case 0xFF52: ch = 0x9B; break;
+ case 0xFF53: ch = 0xAB; break;
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEA1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA0; break;
+ case 0xFF61:
+ case 0xFF62:
+ case 0xFF63:
+ case 0xFF64:
+ case 0xFF65:
+ case 0xFF66:
+ case 0xFF67:
+ case 0xFF68:
+ case 0xFF69:
+ ch -= 0xFF20;
+ break;
+ case 0xFF6A:
+ case 0xFF6B:
+ case 0xFF6C:
+ case 0xFF6D:
+ case 0xFF6E:
+ case 0xFF6F:
+ ch -= 0xFF19;
+ break;
+ case 0xFF70: ch = 0x58; break;
+ case 0xFF71:
+ case 0xFF72:
+ case 0xFF73:
+ case 0xFF74:
+ case 0xFF75:
+ case 0xFF76:
+ case 0xFF77:
+ case 0xFF78:
+ case 0xFF79:
+ case 0xFF7A:
+ ch -= 0xFEF0;
+ break;
+ case 0xFF7B:
+ case 0xFF7C:
+ case 0xFF7D:
+ case 0xFF7E:
+ case 0xFF7F:
+ case 0xFF80:
+ case 0xFF81:
+ case 0xFF82:
+ case 0xFF83:
+ case 0xFF84:
+ case 0xFF85:
+ case 0xFF86:
+ case 0xFF87:
+ case 0xFF88:
+ case 0xFF89:
+ ch -= 0xFEEF;
+ break;
+ case 0xFF8A: ch = 0x9D; break;
+ case 0xFF8B: ch = 0x9E; break;
+ case 0xFF8C: ch = 0x9F; break;
+ case 0xFF8D:
+ case 0xFF8E:
+ case 0xFF8F:
+ case 0xFF90:
+ case 0xFF91:
+ case 0xFF92:
+ case 0xFF93:
+ case 0xFF94:
+ case 0xFF95:
+ ch -= 0xFEEB;
+ break;
+ case 0xFF96:
+ case 0xFF97:
+ case 0xFF98:
+ case 0xFF99:
+ ch -= 0xFEEA;
+ break;
+ case 0xFF9A:
+ case 0xFF9B:
+ case 0xFF9C:
+ case 0xFF9D:
+ case 0xFF9E:
+ case 0xFF9F:
+ ch -= 0xFEE0;
+ break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0xE0; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x70; break;
+ case 0x005C: ch = 0xB2; break;
+ case 0x005D: ch = 0x80; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ ch += 0x0001;
+ break;
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ ch += 0x0008;
+ break;
+ case 0x0071: ch = 0x8B; break;
+ case 0x0072: ch = 0x9B; break;
+ case 0x0073: ch = 0xAB; break;
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x003F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA0; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A2: ch = 0xB1; break;
+ case 0x00A3: ch = 0x4A; break;
+ case 0x00A5: ch = 0x5B; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x203E: ch = 0xA1; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0xE0; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x70; break;
+ case 0xFF3C: ch = 0xB2; break;
+ case 0xFF3D: ch = 0x80; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ ch -= 0xFEDF;
+ break;
+ case 0xFF49:
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ ch -= 0xFED8;
+ break;
+ case 0xFF51: ch = 0x8B; break;
+ case 0xFF52: ch = 0x9B; break;
+ case 0xFF53: ch = 0xAB; break;
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEA1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA0; break;
+ case 0xFF61:
+ case 0xFF62:
+ case 0xFF63:
+ case 0xFF64:
+ case 0xFF65:
+ case 0xFF66:
+ case 0xFF67:
+ case 0xFF68:
+ case 0xFF69:
+ ch -= 0xFF20;
+ break;
+ case 0xFF6A:
+ case 0xFF6B:
+ case 0xFF6C:
+ case 0xFF6D:
+ case 0xFF6E:
+ case 0xFF6F:
+ ch -= 0xFF19;
+ break;
+ case 0xFF70: ch = 0x58; break;
+ case 0xFF71:
+ case 0xFF72:
+ case 0xFF73:
+ case 0xFF74:
+ case 0xFF75:
+ case 0xFF76:
+ case 0xFF77:
+ case 0xFF78:
+ case 0xFF79:
+ case 0xFF7A:
+ ch -= 0xFEF0;
+ break;
+ case 0xFF7B:
+ case 0xFF7C:
+ case 0xFF7D:
+ case 0xFF7E:
+ case 0xFF7F:
+ case 0xFF80:
+ case 0xFF81:
+ case 0xFF82:
+ case 0xFF83:
+ case 0xFF84:
+ case 0xFF85:
+ case 0xFF86:
+ case 0xFF87:
+ case 0xFF88:
+ case 0xFF89:
+ ch -= 0xFEEF;
+ break;
+ case 0xFF8A: ch = 0x9D; break;
+ case 0xFF8B: ch = 0x9E; break;
+ case 0xFF8C: ch = 0x9F; break;
+ case 0xFF8D:
+ case 0xFF8E:
+ case 0xFF8F:
+ case 0xFF90:
+ case 0xFF91:
+ case 0xFF92:
+ case 0xFF93:
+ case 0xFF94:
+ case 0xFF95:
+ ch -= 0xFEEB;
+ break;
+ case 0xFF96:
+ case 0xFF97:
+ case 0xFF98:
+ case 0xFF99:
+ ch -= 0xFEEA;
+ break;
+ case 0xFF9A:
+ case 0xFF9B:
+ case 0xFF9C:
+ case 0xFF9D:
+ case 0xFF9E:
+ case 0xFF9F:
+ ch -= 0xFEE0;
+ break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20290
+
+public class ENCibm290 : CP20290
+{
+ public ENCibm290() : base() {}
+
+}; // class ENCibm290
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20297.cs b/mcs/class/I18N/Rare/CP20297.cs
new file mode 100644
index 00000000000..439aeefbd4a
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20297.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20297.cs - IBM EBCDIC (France) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-297.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20297 : ByteEncoding
+{
+ public CP20297()
+ : base(20297, ToChars, "IBM EBCDIC (France)",
+ "IBM297", "IBM297", "IBM297",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u0040', '\u00E1', '\u00E3', '\u00E5',
+ '\u005C', '\u00F1', '\u00B0', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u007B', '\u00EA', '\u00EB',
+ '\u007D', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u00A7', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F9', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00B5', '\u003A', '\u00A3', '\u00E0', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u005B', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u0060', '\u00A8',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u0023', '\u00A5', '\u00B7',
+ '\u00A9', '\u005D', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u007E', '\u00B4', '\u00D7',
+ '\u00E9', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u00E8', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00A6',
+ '\u00FA', '\u00FF', '\u00E7', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x44; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0xB5; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xA0; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x51; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0x5A; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0x79; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x7C; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0xC0; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x6A; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x44; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0xB5; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xA0; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x51; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0xB1; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x44; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x90; break;
+ case 0x005C: ch = 0x48; break;
+ case 0x005D: ch = 0xB5; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0xA0; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x51; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x54; break;
+ case 0x007E: ch = 0xBD; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0x7B; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0x5A; break;
+ case 0x00A8: ch = 0xA1; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x4A; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0x79; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x7C; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0xE0; break;
+ case 0x00E8: ch = 0xD0; break;
+ case 0x00E9: ch = 0xC0; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0x6A; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0xB1; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x44; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x90; break;
+ case 0xFF3C: ch = 0x48; break;
+ case 0xFF3D: ch = 0xB5; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0xA0; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x51; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x54; break;
+ case 0xFF5E: ch = 0xBD; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20297
+
+public class ENCibm297 : CP20297
+{
+ public ENCibm297() : base() {}
+
+}; // class ENCibm297
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20420.cs b/mcs/class/I18N/Rare/CP20420.cs
new file mode 100644
index 00000000000..ee601514f32
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20420.cs
@@ -0,0 +1,1073 @@
+/*
+ * CP20420.cs - IBM EBCDIC (Arabic) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-420.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20420 : ByteEncoding
+{
+ public CP20420()
+ : base(20420, ToChars, "IBM EBCDIC (Arabic)",
+ "IBM420", "IBM420", "IBM420",
+ false, false, false, false, 1256)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u0651', '\uFE7D', '\u0640', '\u200B', '\u0621', '\u0622',
+ '\uFE82', '\u0623', '\u00A2', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\uFE84', '\u0624', '\u003F',
+ '\u003F', '\u0626', '\u0627', '\uFE8E', '\u0628', '\uFE91',
+ '\u0021', '\u0024', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u0629', '\u062A', '\uFE97', '\u062B',
+ '\uFE9B', '\u062C', '\uFE9F', '\u062D', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\uFEA3', '\u062E',
+ '\uFEA7', '\u062F', '\u0630', '\u0631', '\u0632', '\u0633',
+ '\uFEB3', '\u060C', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u0634', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\uFEB7', '\u0635', '\uFEBB', '\u0636', '\uFEBF', '\u0637',
+ '\u0638', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u0639', '\uFECA',
+ '\uFECB', '\uFECC', '\u063A', '\uFECE', '\uFECF', '\u00F7',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\uFED0', '\u0641', '\uFED3', '\u0642',
+ '\uFED7', '\u0643', '\uFEDB', '\u0644', '\uFEF5', '\uFEF6',
+ '\uFEF7', '\uFEF8', '\u003F', '\u003F', '\uFEFB', '\uFEFC',
+ '\uFEDF', '\u0645', '\uFEE3', '\u0646', '\uFEE7', '\u0647',
+ '\u061B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\uFEEB',
+ '\u003F', '\uFEEC', '\u003F', '\u0648', '\u061F', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u0649', '\uFEF0', '\u064A', '\uFEF2',
+ '\uFEF3', '\u0660', '\u00D7', '\u003F', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u0661', '\u0662', '\u003F', '\u0663', '\u0664', '\u0665',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003F', '\u0666',
+ '\u0667', '\u0668', '\u0669', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00D7: ch = 0xE0; break;
+ case 0x00F7: ch = 0xA1; break;
+ case 0x060C: ch = 0x79; break;
+ case 0x061B: ch = 0xC0; break;
+ case 0x061F: ch = 0xD0; break;
+ case 0x0621: ch = 0x46; break;
+ case 0x0622: ch = 0x47; break;
+ case 0x0623: ch = 0x49; break;
+ case 0x0624: ch = 0x52; break;
+ case 0x0625: ch = 0x56; break;
+ case 0x0626: ch = 0x55; break;
+ case 0x0627: ch = 0x56; break;
+ case 0x0628: ch = 0x58; break;
+ case 0x0629: ch = 0x62; break;
+ case 0x062A: ch = 0x63; break;
+ case 0x062B: ch = 0x65; break;
+ case 0x062C: ch = 0x67; break;
+ case 0x062D: ch = 0x69; break;
+ case 0x062E: ch = 0x71; break;
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ ch -= 0x05BC;
+ break;
+ case 0x0634: ch = 0x80; break;
+ case 0x0635: ch = 0x8B; break;
+ case 0x0636: ch = 0x8D; break;
+ case 0x0637: ch = 0x8F; break;
+ case 0x0638: ch = 0x90; break;
+ case 0x0639: ch = 0x9A; break;
+ case 0x063A: ch = 0x9E; break;
+ case 0x0640: ch = 0x44; break;
+ case 0x0641: ch = 0xAB; break;
+ case 0x0642: ch = 0xAD; break;
+ case 0x0643: ch = 0xAF; break;
+ case 0x0644: ch = 0xB1; break;
+ case 0x0645: ch = 0xBB; break;
+ case 0x0646: ch = 0xBD; break;
+ case 0x0647: ch = 0xBF; break;
+ case 0x0648: ch = 0xCF; break;
+ case 0x0649: ch = 0xDA; break;
+ case 0x064A: ch = 0xDC; break;
+ case 0x0651: ch = 0x42; break;
+ case 0x0660: ch = 0xDF; break;
+ case 0x0661: ch = 0xEA; break;
+ case 0x0662: ch = 0xEB; break;
+ case 0x0663: ch = 0xED; break;
+ case 0x0664: ch = 0xEE; break;
+ case 0x0665: ch = 0xEF; break;
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x056B;
+ break;
+ case 0x066A: ch = 0x6C; break;
+ case 0x066B: ch = 0x6B; break;
+ case 0x066C: ch = 0x4B; break;
+ case 0x066D: ch = 0x5C; break;
+ case 0x200B: ch = 0x45; break;
+ case 0xFE7C: ch = 0x42; break;
+ case 0xFE7D: ch = 0x43; break;
+ case 0xFE80:
+ case 0xFE81:
+ case 0xFE82:
+ case 0xFE83:
+ ch -= 0xFE3A;
+ break;
+ case 0xFE84: ch = 0x51; break;
+ case 0xFE85: ch = 0x52; break;
+ case 0xFE86: ch = 0x52; break;
+ case 0xFE87: ch = 0x56; break;
+ case 0xFE88: ch = 0x57; break;
+ case 0xFE8B: ch = 0x55; break;
+ case 0xFE8C:
+ case 0xFE8D:
+ case 0xFE8E:
+ case 0xFE8F:
+ ch -= 0xFE37;
+ break;
+ case 0xFE90: ch = 0x58; break;
+ case 0xFE91: ch = 0x59; break;
+ case 0xFE92: ch = 0x59; break;
+ case 0xFE93: ch = 0x62; break;
+ case 0xFE94: ch = 0x62; break;
+ case 0xFE95: ch = 0x63; break;
+ case 0xFE96: ch = 0x63; break;
+ case 0xFE97: ch = 0x64; break;
+ case 0xFE98: ch = 0x64; break;
+ case 0xFE99: ch = 0x65; break;
+ case 0xFE9A: ch = 0x65; break;
+ case 0xFE9B: ch = 0x66; break;
+ case 0xFE9C: ch = 0x66; break;
+ case 0xFE9D: ch = 0x67; break;
+ case 0xFE9E: ch = 0x67; break;
+ case 0xFE9F: ch = 0x68; break;
+ case 0xFEA0: ch = 0x68; break;
+ case 0xFEA1: ch = 0x69; break;
+ case 0xFEA2: ch = 0x69; break;
+ case 0xFEA3: ch = 0x70; break;
+ case 0xFEA4: ch = 0x70; break;
+ case 0xFEA5: ch = 0x71; break;
+ case 0xFEA6: ch = 0x71; break;
+ case 0xFEA7: ch = 0x72; break;
+ case 0xFEA8: ch = 0x72; break;
+ case 0xFEA9: ch = 0x73; break;
+ case 0xFEAA: ch = 0x73; break;
+ case 0xFEAB: ch = 0x74; break;
+ case 0xFEAC: ch = 0x74; break;
+ case 0xFEAD: ch = 0x75; break;
+ case 0xFEAE: ch = 0x75; break;
+ case 0xFEAF: ch = 0x76; break;
+ case 0xFEB0: ch = 0x76; break;
+ case 0xFEB1: ch = 0x77; break;
+ case 0xFEB2: ch = 0x77; break;
+ case 0xFEB3: ch = 0x78; break;
+ case 0xFEB4: ch = 0x78; break;
+ case 0xFEB5: ch = 0x80; break;
+ case 0xFEB6: ch = 0x80; break;
+ case 0xFEB7: ch = 0x8A; break;
+ case 0xFEB8: ch = 0x8A; break;
+ case 0xFEB9: ch = 0x8B; break;
+ case 0xFEBA: ch = 0x8B; break;
+ case 0xFEBB: ch = 0x8C; break;
+ case 0xFEBC: ch = 0x8C; break;
+ case 0xFEBD: ch = 0x8D; break;
+ case 0xFEBE: ch = 0x8D; break;
+ case 0xFEBF: ch = 0x8E; break;
+ case 0xFEC0: ch = 0x8E; break;
+ case 0xFEC1: ch = 0x8F; break;
+ case 0xFEC2: ch = 0x8F; break;
+ case 0xFEC3: ch = 0x8F; break;
+ case 0xFEC4: ch = 0x8F; break;
+ case 0xFEC5: ch = 0x90; break;
+ case 0xFEC6: ch = 0x90; break;
+ case 0xFEC7: ch = 0x90; break;
+ case 0xFEC8: ch = 0x90; break;
+ case 0xFEC9:
+ case 0xFECA:
+ case 0xFECB:
+ case 0xFECC:
+ case 0xFECD:
+ case 0xFECE:
+ case 0xFECF:
+ ch -= 0xFE2F;
+ break;
+ case 0xFED0: ch = 0xAA; break;
+ case 0xFED1: ch = 0xAB; break;
+ case 0xFED2: ch = 0xAB; break;
+ case 0xFED3: ch = 0xAC; break;
+ case 0xFED4: ch = 0xAC; break;
+ case 0xFED5: ch = 0xAD; break;
+ case 0xFED6: ch = 0xAD; break;
+ case 0xFED7: ch = 0xAE; break;
+ case 0xFED8: ch = 0xAE; break;
+ case 0xFED9: ch = 0xAF; break;
+ case 0xFEDA: ch = 0xAF; break;
+ case 0xFEDB: ch = 0xB0; break;
+ case 0xFEDC: ch = 0xB0; break;
+ case 0xFEDD: ch = 0xB1; break;
+ case 0xFEDE: ch = 0xB1; break;
+ case 0xFEDF: ch = 0xBA; break;
+ case 0xFEE0: ch = 0xBA; break;
+ case 0xFEE1: ch = 0xBB; break;
+ case 0xFEE2: ch = 0xBB; break;
+ case 0xFEE3: ch = 0xBC; break;
+ case 0xFEE4: ch = 0xBC; break;
+ case 0xFEE5: ch = 0xBD; break;
+ case 0xFEE6: ch = 0xBD; break;
+ case 0xFEE7: ch = 0xBE; break;
+ case 0xFEE8: ch = 0xBE; break;
+ case 0xFEE9: ch = 0xBF; break;
+ case 0xFEEA: ch = 0xBF; break;
+ case 0xFEEB: ch = 0xCB; break;
+ case 0xFEEC: ch = 0xCD; break;
+ case 0xFEED: ch = 0xCF; break;
+ case 0xFEEE: ch = 0xCF; break;
+ case 0xFEEF:
+ case 0xFEF0:
+ case 0xFEF1:
+ case 0xFEF2:
+ case 0xFEF3:
+ ch -= 0xFE15;
+ break;
+ case 0xFEF4: ch = 0xDE; break;
+ case 0xFEF5:
+ case 0xFEF6:
+ case 0xFEF7:
+ case 0xFEF8:
+ ch -= 0xFE43;
+ break;
+ case 0xFEF9: ch = 0xB8; break;
+ case 0xFEFA: ch = 0xB9; break;
+ case 0xFEFB: ch = 0xB8; break;
+ case 0xFEFC: ch = 0xB9; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5C: ch = 0x4F; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00D7: ch = 0xE0; break;
+ case 0x00F7: ch = 0xA1; break;
+ case 0x060C: ch = 0x79; break;
+ case 0x061B: ch = 0xC0; break;
+ case 0x061F: ch = 0xD0; break;
+ case 0x0621: ch = 0x46; break;
+ case 0x0622: ch = 0x47; break;
+ case 0x0623: ch = 0x49; break;
+ case 0x0624: ch = 0x52; break;
+ case 0x0625: ch = 0x56; break;
+ case 0x0626: ch = 0x55; break;
+ case 0x0627: ch = 0x56; break;
+ case 0x0628: ch = 0x58; break;
+ case 0x0629: ch = 0x62; break;
+ case 0x062A: ch = 0x63; break;
+ case 0x062B: ch = 0x65; break;
+ case 0x062C: ch = 0x67; break;
+ case 0x062D: ch = 0x69; break;
+ case 0x062E: ch = 0x71; break;
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ ch -= 0x05BC;
+ break;
+ case 0x0634: ch = 0x80; break;
+ case 0x0635: ch = 0x8B; break;
+ case 0x0636: ch = 0x8D; break;
+ case 0x0637: ch = 0x8F; break;
+ case 0x0638: ch = 0x90; break;
+ case 0x0639: ch = 0x9A; break;
+ case 0x063A: ch = 0x9E; break;
+ case 0x0640: ch = 0x44; break;
+ case 0x0641: ch = 0xAB; break;
+ case 0x0642: ch = 0xAD; break;
+ case 0x0643: ch = 0xAF; break;
+ case 0x0644: ch = 0xB1; break;
+ case 0x0645: ch = 0xBB; break;
+ case 0x0646: ch = 0xBD; break;
+ case 0x0647: ch = 0xBF; break;
+ case 0x0648: ch = 0xCF; break;
+ case 0x0649: ch = 0xDA; break;
+ case 0x064A: ch = 0xDC; break;
+ case 0x0651: ch = 0x42; break;
+ case 0x0660: ch = 0xDF; break;
+ case 0x0661: ch = 0xEA; break;
+ case 0x0662: ch = 0xEB; break;
+ case 0x0663: ch = 0xED; break;
+ case 0x0664: ch = 0xEE; break;
+ case 0x0665: ch = 0xEF; break;
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x056B;
+ break;
+ case 0x066A: ch = 0x6C; break;
+ case 0x066B: ch = 0x6B; break;
+ case 0x066C: ch = 0x4B; break;
+ case 0x066D: ch = 0x5C; break;
+ case 0x200B: ch = 0x45; break;
+ case 0xFE7C: ch = 0x42; break;
+ case 0xFE7D: ch = 0x43; break;
+ case 0xFE80:
+ case 0xFE81:
+ case 0xFE82:
+ case 0xFE83:
+ ch -= 0xFE3A;
+ break;
+ case 0xFE84: ch = 0x51; break;
+ case 0xFE85: ch = 0x52; break;
+ case 0xFE86: ch = 0x52; break;
+ case 0xFE87: ch = 0x56; break;
+ case 0xFE88: ch = 0x57; break;
+ case 0xFE8B: ch = 0x55; break;
+ case 0xFE8C:
+ case 0xFE8D:
+ case 0xFE8E:
+ case 0xFE8F:
+ ch -= 0xFE37;
+ break;
+ case 0xFE90: ch = 0x58; break;
+ case 0xFE91: ch = 0x59; break;
+ case 0xFE92: ch = 0x59; break;
+ case 0xFE93: ch = 0x62; break;
+ case 0xFE94: ch = 0x62; break;
+ case 0xFE95: ch = 0x63; break;
+ case 0xFE96: ch = 0x63; break;
+ case 0xFE97: ch = 0x64; break;
+ case 0xFE98: ch = 0x64; break;
+ case 0xFE99: ch = 0x65; break;
+ case 0xFE9A: ch = 0x65; break;
+ case 0xFE9B: ch = 0x66; break;
+ case 0xFE9C: ch = 0x66; break;
+ case 0xFE9D: ch = 0x67; break;
+ case 0xFE9E: ch = 0x67; break;
+ case 0xFE9F: ch = 0x68; break;
+ case 0xFEA0: ch = 0x68; break;
+ case 0xFEA1: ch = 0x69; break;
+ case 0xFEA2: ch = 0x69; break;
+ case 0xFEA3: ch = 0x70; break;
+ case 0xFEA4: ch = 0x70; break;
+ case 0xFEA5: ch = 0x71; break;
+ case 0xFEA6: ch = 0x71; break;
+ case 0xFEA7: ch = 0x72; break;
+ case 0xFEA8: ch = 0x72; break;
+ case 0xFEA9: ch = 0x73; break;
+ case 0xFEAA: ch = 0x73; break;
+ case 0xFEAB: ch = 0x74; break;
+ case 0xFEAC: ch = 0x74; break;
+ case 0xFEAD: ch = 0x75; break;
+ case 0xFEAE: ch = 0x75; break;
+ case 0xFEAF: ch = 0x76; break;
+ case 0xFEB0: ch = 0x76; break;
+ case 0xFEB1: ch = 0x77; break;
+ case 0xFEB2: ch = 0x77; break;
+ case 0xFEB3: ch = 0x78; break;
+ case 0xFEB4: ch = 0x78; break;
+ case 0xFEB5: ch = 0x80; break;
+ case 0xFEB6: ch = 0x80; break;
+ case 0xFEB7: ch = 0x8A; break;
+ case 0xFEB8: ch = 0x8A; break;
+ case 0xFEB9: ch = 0x8B; break;
+ case 0xFEBA: ch = 0x8B; break;
+ case 0xFEBB: ch = 0x8C; break;
+ case 0xFEBC: ch = 0x8C; break;
+ case 0xFEBD: ch = 0x8D; break;
+ case 0xFEBE: ch = 0x8D; break;
+ case 0xFEBF: ch = 0x8E; break;
+ case 0xFEC0: ch = 0x8E; break;
+ case 0xFEC1: ch = 0x8F; break;
+ case 0xFEC2: ch = 0x8F; break;
+ case 0xFEC3: ch = 0x8F; break;
+ case 0xFEC4: ch = 0x8F; break;
+ case 0xFEC5: ch = 0x90; break;
+ case 0xFEC6: ch = 0x90; break;
+ case 0xFEC7: ch = 0x90; break;
+ case 0xFEC8: ch = 0x90; break;
+ case 0xFEC9:
+ case 0xFECA:
+ case 0xFECB:
+ case 0xFECC:
+ case 0xFECD:
+ case 0xFECE:
+ case 0xFECF:
+ ch -= 0xFE2F;
+ break;
+ case 0xFED0: ch = 0xAA; break;
+ case 0xFED1: ch = 0xAB; break;
+ case 0xFED2: ch = 0xAB; break;
+ case 0xFED3: ch = 0xAC; break;
+ case 0xFED4: ch = 0xAC; break;
+ case 0xFED5: ch = 0xAD; break;
+ case 0xFED6: ch = 0xAD; break;
+ case 0xFED7: ch = 0xAE; break;
+ case 0xFED8: ch = 0xAE; break;
+ case 0xFED9: ch = 0xAF; break;
+ case 0xFEDA: ch = 0xAF; break;
+ case 0xFEDB: ch = 0xB0; break;
+ case 0xFEDC: ch = 0xB0; break;
+ case 0xFEDD: ch = 0xB1; break;
+ case 0xFEDE: ch = 0xB1; break;
+ case 0xFEDF: ch = 0xBA; break;
+ case 0xFEE0: ch = 0xBA; break;
+ case 0xFEE1: ch = 0xBB; break;
+ case 0xFEE2: ch = 0xBB; break;
+ case 0xFEE3: ch = 0xBC; break;
+ case 0xFEE4: ch = 0xBC; break;
+ case 0xFEE5: ch = 0xBD; break;
+ case 0xFEE6: ch = 0xBD; break;
+ case 0xFEE7: ch = 0xBE; break;
+ case 0xFEE8: ch = 0xBE; break;
+ case 0xFEE9: ch = 0xBF; break;
+ case 0xFEEA: ch = 0xBF; break;
+ case 0xFEEB: ch = 0xCB; break;
+ case 0xFEEC: ch = 0xCD; break;
+ case 0xFEED: ch = 0xCF; break;
+ case 0xFEEE: ch = 0xCF; break;
+ case 0xFEEF:
+ case 0xFEF0:
+ case 0xFEF1:
+ case 0xFEF2:
+ case 0xFEF3:
+ ch -= 0xFE15;
+ break;
+ case 0xFEF4: ch = 0xDE; break;
+ case 0xFEF5:
+ case 0xFEF6:
+ case 0xFEF7:
+ case 0xFEF8:
+ ch -= 0xFE43;
+ break;
+ case 0xFEF9: ch = 0xB8; break;
+ case 0xFEFA: ch = 0xB9; break;
+ case 0xFEFB: ch = 0xB8; break;
+ case 0xFEFC: ch = 0xB9; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5C: ch = 0x4F; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20420
+
+public class ENCibm420 : CP20420
+{
+ public ENCibm420() : base() {}
+
+}; // class ENCibm420
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20424.cs b/mcs/class/I18N/Rare/CP20424.cs
new file mode 100644
index 00000000000..224cd0da02a
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20424.cs
@@ -0,0 +1,829 @@
+/*
+ * CP20424.cs - IBM EBCDIC (Hebrew) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-424.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20424 : ByteEncoding
+{
+ public CP20424()
+ : base(20424, ToChars, "IBM EBCDIC (Hebrew)",
+ "IBM424", "IBM424", "IBM424",
+ false, false, false, false, 1255)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u05D0',
+ '\u05D1', '\u05D2', '\u05D3', '\u05D4', '\u05D5', '\u05D6',
+ '\u05D7', '\u05D8', '\u00A2', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u05D9', '\u05DA', '\u05DB',
+ '\u05DC', '\u05DD', '\u05DE', '\u05DF', '\u05E0', '\u05E1',
+ '\u0021', '\u0024', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u05E2', '\u05E3', '\u05E4', '\u05E5',
+ '\u05E6', '\u05E7', '\u05E8', '\u05E9', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u003F', '\u05EA',
+ '\u003F', '\u003F', '\u00A0', '\u003F', '\u003F', '\u003F',
+ '\u2017', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u003F', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u003F', '\u003F', '\u003F', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u003F', '\u003F',
+ '\u003F', '\u00B8', '\u003F', '\u00A4', '\u00B5', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u00AE', '\u005E', '\u00A3', '\u00A5', '\u2022',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005B', '\u005D', '\u203E', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xBA; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x74; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ ch -= 0x058F;
+ break;
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ ch -= 0x0588;
+ break;
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ ch -= 0x0580;
+ break;
+ case 0x05EA: ch = 0x71; break;
+ case 0x2017: ch = 0x78; break;
+ case 0x2022: ch = 0xB3; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xBA; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xBA; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x74; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ ch -= 0x058F;
+ break;
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ ch -= 0x0588;
+ break;
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ ch -= 0x0580;
+ break;
+ case 0x05EA: ch = 0x71; break;
+ case 0x2017: ch = 0x78; break;
+ case 0x2022: ch = 0xB3; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xBA; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20424
+
+public class ENCibm424 : CP20424
+{
+ public ENCibm424() : base() {}
+
+}; // class ENCibm424
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP20871.cs b/mcs/class/I18N/Rare/CP20871.cs
new file mode 100644
index 00000000000..fdb11807505
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP20871.cs
@@ -0,0 +1,897 @@
+/*
+ * CP20871.cs - IBM EBCDIC (Icelandic) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-871.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP20871 : ByteEncoding
+{
+ public CP20871()
+ : base(20871, ToChars, "IBM EBCDIC (Icelandic)",
+ "IBM871", "IBM871", "IBM871",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00DE', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u00C6', '\u0024', '\u002A', '\u0029', '\u003B', '\u00D6',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u00F0', '\u003A', '\u0023', '\u00D0', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u0060', '\u00FD', '\u007B', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u007D', '\u00B8', '\u005D', '\u00A4', '\u00B5', '\u00F6',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u0040', '\u00DD',
+ '\u005B', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u005C', '\u00D7',
+ '\u00FE', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u007E', '\u00F2', '\u00F3', '\u00F5', '\u00E6', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u00B4', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u005E', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xAC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xAE; break;
+ case 0x005C: ch = 0xBE; break;
+ case 0x005D: ch = 0x9E; break;
+ case 0x005E: ch = 0xEC; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x8C; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x8E; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x9C; break;
+ case 0x007E: ch = 0xCC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xE0; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x5A; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0x7C; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x5F; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0x4A; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0xD0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x79; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xA1; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0xC0; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0x7C; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xAC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xAE; break;
+ case 0xFF3C: ch = 0xBE; break;
+ case 0xFF3D: ch = 0x9E; break;
+ case 0xFF3E: ch = 0xEC; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x8C; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x8E; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x9C; break;
+ case 0xFF5E: ch = 0xCC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0xAC; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xAE; break;
+ case 0x005C: ch = 0xBE; break;
+ case 0x005D: ch = 0x9E; break;
+ case 0x005E: ch = 0xEC; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x8C; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0x8E; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0x9C; break;
+ case 0x007E: ch = 0xCC; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xE0; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x5A; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0x7C; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0x5F; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0x4A; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0xD0; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x79; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xA1; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0xC0; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0x7C; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0xAC; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xAE; break;
+ case 0xFF3C: ch = 0xBE; break;
+ case 0xFF3D: ch = 0x9E; break;
+ case 0xFF3E: ch = 0xEC; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x8C; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0x8E; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0x9C; break;
+ case 0xFF5E: ch = 0xCC; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP20871
+
+public class ENCibm871 : CP20871
+{
+ public ENCibm871() : base() {}
+
+}; // class ENCibm871
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP21025.cs b/mcs/class/I18N/Rare/CP21025.cs
new file mode 100644
index 00000000000..8285d1ba3a4
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP21025.cs
@@ -0,0 +1,917 @@
+/*
+ * CP21025.cs - IBM EBCDIC (Cyrillic - Serbian, Bulgarian) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1025.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP21025 : ByteEncoding
+{
+ public CP21025()
+ : base(21025, ToChars, "IBM EBCDIC (Cyrillic - Serbian, Bulgarian)",
+ "IBM1025", "IBM1025", "IBM1025",
+ false, false, false, false, 1257)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u0452', '\u0453', '\u0451', '\u0454', '\u0455', '\u0456',
+ '\u0457', '\u0458', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u0459', '\u045A', '\u045B',
+ '\u045C', '\u045E', '\u045F', '\u042A', '\u2116', '\u0402',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u0403', '\u0401', '\u0404', '\u0405',
+ '\u0406', '\u0407', '\u0408', '\u0409', '\u007C', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u040A', '\u040B',
+ '\u040C', '\u00AD', '\u040E', '\u040F', '\u044E', '\u0430',
+ '\u0431', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u0446', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u0434', '\u0435', '\u0444', '\u0433', '\u0445', '\u0438',
+ '\u0439', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u043A', '\u043B',
+ '\u043C', '\u043D', '\u043E', '\u043F', '\u044F', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u0440', '\u0441', '\u0442', '\u0443',
+ '\u0436', '\u0432', '\u044C', '\u044B', '\u0437', '\u0448',
+ '\u044D', '\u0449', '\u0447', '\u044A', '\u042E', '\u0410',
+ '\u0411', '\u0426', '\u0414', '\u0415', '\u0424', '\u0413',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u0425', '\u0418',
+ '\u0419', '\u041A', '\u041B', '\u041C', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u041D', '\u041E', '\u041F', '\u042F',
+ '\u0420', '\u0421', '\u005C', '\u00A7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u0422', '\u0423', '\u0416', '\u0412', '\u042C', '\u042B',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u0417', '\u0428',
+ '\u042D', '\u0429', '\u0427', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x6A; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A7: ch = 0xE1; break;
+ case 0x00AD: ch = 0x73; break;
+ case 0x0401: ch = 0x63; break;
+ case 0x0402: ch = 0x59; break;
+ case 0x0403: ch = 0x62; break;
+ case 0x0404:
+ case 0x0405:
+ case 0x0406:
+ case 0x0407:
+ case 0x0408:
+ case 0x0409:
+ ch -= 0x03A0;
+ break;
+ case 0x040A: ch = 0x70; break;
+ case 0x040B: ch = 0x71; break;
+ case 0x040C: ch = 0x72; break;
+ case 0x040E: ch = 0x74; break;
+ case 0x040F: ch = 0x75; break;
+ case 0x0410: ch = 0xB9; break;
+ case 0x0411: ch = 0xBA; break;
+ case 0x0412: ch = 0xED; break;
+ case 0x0413: ch = 0xBF; break;
+ case 0x0414: ch = 0xBC; break;
+ case 0x0415: ch = 0xBD; break;
+ case 0x0416: ch = 0xEC; break;
+ case 0x0417: ch = 0xFA; break;
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ ch -= 0x034D;
+ break;
+ case 0x041D: ch = 0xDA; break;
+ case 0x041E: ch = 0xDB; break;
+ case 0x041F: ch = 0xDC; break;
+ case 0x0420: ch = 0xDE; break;
+ case 0x0421: ch = 0xDF; break;
+ case 0x0422: ch = 0xEA; break;
+ case 0x0423: ch = 0xEB; break;
+ case 0x0424: ch = 0xBE; break;
+ case 0x0425: ch = 0xCA; break;
+ case 0x0426: ch = 0xBB; break;
+ case 0x0427: ch = 0xFE; break;
+ case 0x0428: ch = 0xFB; break;
+ case 0x0429: ch = 0xFD; break;
+ case 0x042A: ch = 0x57; break;
+ case 0x042B: ch = 0xEF; break;
+ case 0x042C: ch = 0xEE; break;
+ case 0x042D: ch = 0xFC; break;
+ case 0x042E: ch = 0xB8; break;
+ case 0x042F: ch = 0xDD; break;
+ case 0x0430: ch = 0x77; break;
+ case 0x0431: ch = 0x78; break;
+ case 0x0432: ch = 0xAF; break;
+ case 0x0433: ch = 0x8D; break;
+ case 0x0434: ch = 0x8A; break;
+ case 0x0435: ch = 0x8B; break;
+ case 0x0436: ch = 0xAE; break;
+ case 0x0437: ch = 0xB2; break;
+ case 0x0438: ch = 0x8F; break;
+ case 0x0439: ch = 0x90; break;
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x03A0;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ ch -= 0x0396;
+ break;
+ case 0x0444: ch = 0x8C; break;
+ case 0x0445: ch = 0x8E; break;
+ case 0x0446: ch = 0x80; break;
+ case 0x0447: ch = 0xB6; break;
+ case 0x0448: ch = 0xB3; break;
+ case 0x0449: ch = 0xB5; break;
+ case 0x044A: ch = 0xB7; break;
+ case 0x044B: ch = 0xB1; break;
+ case 0x044C: ch = 0xB0; break;
+ case 0x044D: ch = 0xB4; break;
+ case 0x044E: ch = 0x76; break;
+ case 0x044F: ch = 0xA0; break;
+ case 0x0451: ch = 0x44; break;
+ case 0x0452: ch = 0x42; break;
+ case 0x0453: ch = 0x43; break;
+ case 0x0454:
+ case 0x0455:
+ case 0x0456:
+ case 0x0457:
+ case 0x0458:
+ ch -= 0x040F;
+ break;
+ case 0x0459:
+ case 0x045A:
+ case 0x045B:
+ case 0x045C:
+ ch -= 0x0408;
+ break;
+ case 0x045E: ch = 0x55; break;
+ case 0x045F: ch = 0x56; break;
+ case 0x2116: ch = 0x58; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x6A; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x6A; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A7: ch = 0xE1; break;
+ case 0x00AD: ch = 0x73; break;
+ case 0x0401: ch = 0x63; break;
+ case 0x0402: ch = 0x59; break;
+ case 0x0403: ch = 0x62; break;
+ case 0x0404:
+ case 0x0405:
+ case 0x0406:
+ case 0x0407:
+ case 0x0408:
+ case 0x0409:
+ ch -= 0x03A0;
+ break;
+ case 0x040A: ch = 0x70; break;
+ case 0x040B: ch = 0x71; break;
+ case 0x040C: ch = 0x72; break;
+ case 0x040E: ch = 0x74; break;
+ case 0x040F: ch = 0x75; break;
+ case 0x0410: ch = 0xB9; break;
+ case 0x0411: ch = 0xBA; break;
+ case 0x0412: ch = 0xED; break;
+ case 0x0413: ch = 0xBF; break;
+ case 0x0414: ch = 0xBC; break;
+ case 0x0415: ch = 0xBD; break;
+ case 0x0416: ch = 0xEC; break;
+ case 0x0417: ch = 0xFA; break;
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ ch -= 0x034D;
+ break;
+ case 0x041D: ch = 0xDA; break;
+ case 0x041E: ch = 0xDB; break;
+ case 0x041F: ch = 0xDC; break;
+ case 0x0420: ch = 0xDE; break;
+ case 0x0421: ch = 0xDF; break;
+ case 0x0422: ch = 0xEA; break;
+ case 0x0423: ch = 0xEB; break;
+ case 0x0424: ch = 0xBE; break;
+ case 0x0425: ch = 0xCA; break;
+ case 0x0426: ch = 0xBB; break;
+ case 0x0427: ch = 0xFE; break;
+ case 0x0428: ch = 0xFB; break;
+ case 0x0429: ch = 0xFD; break;
+ case 0x042A: ch = 0x57; break;
+ case 0x042B: ch = 0xEF; break;
+ case 0x042C: ch = 0xEE; break;
+ case 0x042D: ch = 0xFC; break;
+ case 0x042E: ch = 0xB8; break;
+ case 0x042F: ch = 0xDD; break;
+ case 0x0430: ch = 0x77; break;
+ case 0x0431: ch = 0x78; break;
+ case 0x0432: ch = 0xAF; break;
+ case 0x0433: ch = 0x8D; break;
+ case 0x0434: ch = 0x8A; break;
+ case 0x0435: ch = 0x8B; break;
+ case 0x0436: ch = 0xAE; break;
+ case 0x0437: ch = 0xB2; break;
+ case 0x0438: ch = 0x8F; break;
+ case 0x0439: ch = 0x90; break;
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x03A0;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ ch -= 0x0396;
+ break;
+ case 0x0444: ch = 0x8C; break;
+ case 0x0445: ch = 0x8E; break;
+ case 0x0446: ch = 0x80; break;
+ case 0x0447: ch = 0xB6; break;
+ case 0x0448: ch = 0xB3; break;
+ case 0x0449: ch = 0xB5; break;
+ case 0x044A: ch = 0xB7; break;
+ case 0x044B: ch = 0xB1; break;
+ case 0x044C: ch = 0xB0; break;
+ case 0x044D: ch = 0xB4; break;
+ case 0x044E: ch = 0x76; break;
+ case 0x044F: ch = 0xA0; break;
+ case 0x0451: ch = 0x44; break;
+ case 0x0452: ch = 0x42; break;
+ case 0x0453: ch = 0x43; break;
+ case 0x0454:
+ case 0x0455:
+ case 0x0456:
+ case 0x0457:
+ case 0x0458:
+ ch -= 0x040F;
+ break;
+ case 0x0459:
+ case 0x045A:
+ case 0x045B:
+ case 0x045C:
+ ch -= 0x0408;
+ break;
+ case 0x045E: ch = 0x55; break;
+ case 0x045F: ch = 0x56; break;
+ case 0x2116: ch = 0x58; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x6A; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP21025
+
+public class ENCibm1025 : CP21025
+{
+ public ENCibm1025() : base() {}
+
+}; // class ENCibm1025
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP37.cs b/mcs/class/I18N/Rare/CP37.cs
new file mode 100644
index 00000000000..e7c7da24d5b
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP37.cs
@@ -0,0 +1,897 @@
+/*
+ * CP37.cs - IBM EBCDIC (US-Canada) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-37.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP37 : ByteEncoding
+{
+ public CP37()
+ : base(37, ToChars, "IBM EBCDIC (US-Canada)",
+ "IBM037", "IBM037", "IBM037",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u00A2', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u007C', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u0021', '\u0024', '\u002A', '\u0029', '\u003B', '\u00AC',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u005E', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u005B', '\u005D', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xBA; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xBA; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x5A; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0xBA; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0xBB; break;
+ case 0x005E: ch = 0xB0; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x4F; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0x4A; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0x5F; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x5A; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0xBA; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0xBB; break;
+ case 0xFF3E: ch = 0xB0; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x4F; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP37
+
+public class ENCibm037 : CP37
+{
+ public ENCibm037() : base() {}
+
+}; // class ENCibm037
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP500.cs b/mcs/class/I18N/Rare/CP500.cs
new file mode 100644
index 00000000000..631ba6c71f8
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP500.cs
@@ -0,0 +1,897 @@
+/*
+ * CP500.cs - IBM EBCDIC (International) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-500.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP500 : ByteEncoding
+{
+ public CP500()
+ : base(500, ToChars, "IBM EBCDIC (International)",
+ "IBM500", "IBM500", "IBM500",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u00E0', '\u00E1', '\u00E3', '\u00E5',
+ '\u00E7', '\u00F1', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u00EA', '\u00EB',
+ '\u00E8', '\u00ED', '\u00EE', '\u00EF', '\u00EC', '\u00DF',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
+ '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00A6', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
+ '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
+ '\u00CC', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
+ '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
+ '\u00DE', '\u00AE', '\u00A2', '\u00A3', '\u00A5', '\u00B7',
+ '\u00A9', '\u00A7', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
+ '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u00F2', '\u00F3', '\u00F5', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u00F9',
+ '\u00FA', '\u00FF', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
+ '\u00DC', '\u00D9', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x00B6:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0xBB; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A1: ch = 0xAA; break;
+ case 0x00A2: ch = 0xB0; break;
+ case 0x00A3: ch = 0xB1; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A5: ch = 0xB2; break;
+ case 0x00A6: ch = 0x6A; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00A9: ch = 0xB4; break;
+ case 0x00AA: ch = 0x9A; break;
+ case 0x00AB: ch = 0x8A; break;
+ case 0x00AC: ch = 0xBA; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00AE: ch = 0xAF; break;
+ case 0x00AF: ch = 0xBC; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0x8F; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B5: ch = 0xA0; break;
+ case 0x00B7: ch = 0xB3; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00B9: ch = 0xDA; break;
+ case 0x00BA: ch = 0x9B; break;
+ case 0x00BB: ch = 0x8B; break;
+ case 0x00BC: ch = 0xB7; break;
+ case 0x00BD: ch = 0xB8; break;
+ case 0x00BE: ch = 0xB9; break;
+ case 0x00BF: ch = 0xAB; break;
+ case 0x00C0: ch = 0x64; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C3: ch = 0x66; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C5: ch = 0x67; break;
+ case 0x00C6: ch = 0x9E; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C8: ch = 0x74; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CA: ch = 0x72; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CC: ch = 0x78; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00CF: ch = 0x77; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D1: ch = 0x69; break;
+ case 0x00D2: ch = 0xED; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D5: ch = 0xEF; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00D8: ch = 0x80; break;
+ case 0x00D9: ch = 0xFD; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DB: ch = 0xFB; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DE: ch = 0xAE; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E0: ch = 0x44; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E3: ch = 0x46; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E5: ch = 0x47; break;
+ case 0x00E6: ch = 0x9C; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E8: ch = 0x54; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EA: ch = 0x52; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00EC: ch = 0x58; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00EF: ch = 0x57; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F1: ch = 0x49; break;
+ case 0x00F2: ch = 0xCD; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F5: ch = 0xCF; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00F8: ch = 0x70; break;
+ case 0x00F9: ch = 0xDD; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FB: ch = 0xDB; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x00FE: ch = 0x8E; break;
+ case 0x00FF: ch = 0xDF; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x203E: ch = 0xBC; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0xBB; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP500
+
+public class ENCibm500 : CP500
+{
+ public ENCibm500() : base() {}
+
+}; // class ENCibm500
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP708.cs b/mcs/class/I18N/Rare/CP708.cs
new file mode 100644
index 00000000000..8bd621acc24
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP708.cs
@@ -0,0 +1,545 @@
+/*
+ * CP708.cs - Arabic (ASMO 708) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1089.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP708 : ByteEncoding
+{
+ public CP708()
+ : base(708, ToChars, "Arabic (ASMO 708)",
+ "iso-8859-6", "asmo-708", "asmo-708",
+ false, false, false, false, 1256)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u003F',
+ '\u003F', '\u003F', '\u00A4', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u060C', '\u00AD',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u061B', '\u003F', '\u003F', '\u003F', '\u061F',
+ '\u003F', '\u0621', '\u0622', '\u0623', '\u0624', '\u0625',
+ '\u0626', '\u0627', '\u0628', '\u0629', '\u062A', '\u062B',
+ '\u062C', '\u062D', '\u062E', '\u062F', '\u0630', '\u0631',
+ '\u0632', '\u0633', '\u0634', '\u0635', '\u0636', '\u0637',
+ '\u0638', '\u0639', '\u063A', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u0640', '\u0641', '\u0642', '\u0643',
+ '\u0644', '\u0645', '\u0646', '\u0647', '\u0648', '\u0649',
+ '\u064A', '\u064B', '\u064C', '\u064D', '\u064E', '\u064F',
+ '\u0650', '\u0651', '\u0652', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u003F', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00AD:
+ break;
+ case 0x060C: ch = 0xAC; break;
+ case 0x061B: ch = 0xBB; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ case 0x0625:
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x0560;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ case 0x0644:
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ case 0x0649:
+ case 0x064A:
+ case 0x064B:
+ case 0x064C:
+ case 0x064D:
+ case 0x064E:
+ case 0x064F:
+ case 0x0650:
+ case 0x0651:
+ case 0x0652:
+ ch -= 0x0560;
+ break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x0630;
+ break;
+ case 0x066A: ch = 0x25; break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x066D: ch = 0x2A; break;
+ case 0xFE70: ch = 0xEB; break;
+ case 0xFE71: ch = 0xEB; break;
+ case 0xFE72: ch = 0xEC; break;
+ case 0xFE74: ch = 0xED; break;
+ case 0xFE76: ch = 0xEE; break;
+ case 0xFE77: ch = 0xEE; break;
+ case 0xFE78: ch = 0xEF; break;
+ case 0xFE79: ch = 0xEF; break;
+ case 0xFE7A: ch = 0xF0; break;
+ case 0xFE7B: ch = 0xF0; break;
+ case 0xFE7C: ch = 0xF1; break;
+ case 0xFE7D: ch = 0xF1; break;
+ case 0xFE7E: ch = 0xF2; break;
+ case 0xFE7F: ch = 0xF2; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xC2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xC3; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE87: ch = 0xC5; break;
+ case 0xFE88: ch = 0xC5; break;
+ case 0xFE89: ch = 0xC6; break;
+ case 0xFE8A: ch = 0xC6; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xC7; break;
+ case 0xFE8F: ch = 0xC8; break;
+ case 0xFE90: ch = 0xC8; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xCA; break;
+ case 0xFE96: ch = 0xCA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xCB; break;
+ case 0xFE9A: ch = 0xCB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xCC; break;
+ case 0xFE9E: ch = 0xCC; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xCD; break;
+ case 0xFEA2: ch = 0xCD; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xCE; break;
+ case 0xFEA6: ch = 0xCE; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xD3; break;
+ case 0xFEB2: ch = 0xD3; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xD4; break;
+ case 0xFEB6: ch = 0xD4; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xD5; break;
+ case 0xFEBA: ch = 0xD5; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xD6; break;
+ case 0xFEBE: ch = 0xD6; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD7; break;
+ case 0xFEC2: ch = 0xD7; break;
+ case 0xFEC3: ch = 0xD7; break;
+ case 0xFEC4: ch = 0xD7; break;
+ case 0xFEC5: ch = 0xD8; break;
+ case 0xFEC6: ch = 0xD8; break;
+ case 0xFEC7: ch = 0xD8; break;
+ case 0xFEC8: ch = 0xD8; break;
+ case 0xFEC9: ch = 0xD9; break;
+ case 0xFECA: ch = 0xD9; break;
+ case 0xFECB: ch = 0xD9; break;
+ case 0xFECC: ch = 0xD9; break;
+ case 0xFECD: ch = 0xDA; break;
+ case 0xFECE: ch = 0xDA; break;
+ case 0xFECF: ch = 0xDA; break;
+ case 0xFED0: ch = 0xDA; break;
+ case 0xFED1: ch = 0xE1; break;
+ case 0xFED2: ch = 0xE1; break;
+ case 0xFED3: ch = 0xE1; break;
+ case 0xFED4: ch = 0xE1; break;
+ case 0xFED5: ch = 0xE2; break;
+ case 0xFED6: ch = 0xE2; break;
+ case 0xFED7: ch = 0xE2; break;
+ case 0xFED8: ch = 0xE2; break;
+ case 0xFED9: ch = 0xE3; break;
+ case 0xFEDA: ch = 0xE3; break;
+ case 0xFEDB: ch = 0xE3; break;
+ case 0xFEDC: ch = 0xE3; break;
+ case 0xFEDD: ch = 0xE4; break;
+ case 0xFEDE: ch = 0xE4; break;
+ case 0xFEDF: ch = 0xE4; break;
+ case 0xFEE0: ch = 0xE4; break;
+ case 0xFEE1: ch = 0xE5; break;
+ case 0xFEE2: ch = 0xE5; break;
+ case 0xFEE3: ch = 0xE5; break;
+ case 0xFEE4: ch = 0xE5; break;
+ case 0xFEE5: ch = 0xE6; break;
+ case 0xFEE6: ch = 0xE6; break;
+ case 0xFEE7: ch = 0xE6; break;
+ case 0xFEE8: ch = 0xE6; break;
+ case 0xFEE9: ch = 0xE7; break;
+ case 0xFEEA: ch = 0xE7; break;
+ case 0xFEEB: ch = 0xE7; break;
+ case 0xFEEC: ch = 0xE7; break;
+ case 0xFEED: ch = 0xE8; break;
+ case 0xFEEE: ch = 0xE8; break;
+ case 0xFEEF: ch = 0xE9; break;
+ case 0xFEF0: ch = 0xE9; break;
+ case 0xFEF1: ch = 0xEA; break;
+ case 0xFEF2: ch = 0xEA; break;
+ case 0xFEF3: ch = 0xEA; break;
+ case 0xFEF4: ch = 0xEA; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00AD:
+ break;
+ case 0x060C: ch = 0xAC; break;
+ case 0x061B: ch = 0xBB; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ case 0x0625:
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x0560;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ case 0x0644:
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ case 0x0649:
+ case 0x064A:
+ case 0x064B:
+ case 0x064C:
+ case 0x064D:
+ case 0x064E:
+ case 0x064F:
+ case 0x0650:
+ case 0x0651:
+ case 0x0652:
+ ch -= 0x0560;
+ break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x0630;
+ break;
+ case 0x066A: ch = 0x25; break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x066D: ch = 0x2A; break;
+ case 0xFE70: ch = 0xEB; break;
+ case 0xFE71: ch = 0xEB; break;
+ case 0xFE72: ch = 0xEC; break;
+ case 0xFE74: ch = 0xED; break;
+ case 0xFE76: ch = 0xEE; break;
+ case 0xFE77: ch = 0xEE; break;
+ case 0xFE78: ch = 0xEF; break;
+ case 0xFE79: ch = 0xEF; break;
+ case 0xFE7A: ch = 0xF0; break;
+ case 0xFE7B: ch = 0xF0; break;
+ case 0xFE7C: ch = 0xF1; break;
+ case 0xFE7D: ch = 0xF1; break;
+ case 0xFE7E: ch = 0xF2; break;
+ case 0xFE7F: ch = 0xF2; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xC2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xC3; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE87: ch = 0xC5; break;
+ case 0xFE88: ch = 0xC5; break;
+ case 0xFE89: ch = 0xC6; break;
+ case 0xFE8A: ch = 0xC6; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xC7; break;
+ case 0xFE8F: ch = 0xC8; break;
+ case 0xFE90: ch = 0xC8; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xCA; break;
+ case 0xFE96: ch = 0xCA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xCB; break;
+ case 0xFE9A: ch = 0xCB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xCC; break;
+ case 0xFE9E: ch = 0xCC; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xCD; break;
+ case 0xFEA2: ch = 0xCD; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xCE; break;
+ case 0xFEA6: ch = 0xCE; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xD3; break;
+ case 0xFEB2: ch = 0xD3; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xD4; break;
+ case 0xFEB6: ch = 0xD4; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xD5; break;
+ case 0xFEBA: ch = 0xD5; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xD6; break;
+ case 0xFEBE: ch = 0xD6; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD7; break;
+ case 0xFEC2: ch = 0xD7; break;
+ case 0xFEC3: ch = 0xD7; break;
+ case 0xFEC4: ch = 0xD7; break;
+ case 0xFEC5: ch = 0xD8; break;
+ case 0xFEC6: ch = 0xD8; break;
+ case 0xFEC7: ch = 0xD8; break;
+ case 0xFEC8: ch = 0xD8; break;
+ case 0xFEC9: ch = 0xD9; break;
+ case 0xFECA: ch = 0xD9; break;
+ case 0xFECB: ch = 0xD9; break;
+ case 0xFECC: ch = 0xD9; break;
+ case 0xFECD: ch = 0xDA; break;
+ case 0xFECE: ch = 0xDA; break;
+ case 0xFECF: ch = 0xDA; break;
+ case 0xFED0: ch = 0xDA; break;
+ case 0xFED1: ch = 0xE1; break;
+ case 0xFED2: ch = 0xE1; break;
+ case 0xFED3: ch = 0xE1; break;
+ case 0xFED4: ch = 0xE1; break;
+ case 0xFED5: ch = 0xE2; break;
+ case 0xFED6: ch = 0xE2; break;
+ case 0xFED7: ch = 0xE2; break;
+ case 0xFED8: ch = 0xE2; break;
+ case 0xFED9: ch = 0xE3; break;
+ case 0xFEDA: ch = 0xE3; break;
+ case 0xFEDB: ch = 0xE3; break;
+ case 0xFEDC: ch = 0xE3; break;
+ case 0xFEDD: ch = 0xE4; break;
+ case 0xFEDE: ch = 0xE4; break;
+ case 0xFEDF: ch = 0xE4; break;
+ case 0xFEE0: ch = 0xE4; break;
+ case 0xFEE1: ch = 0xE5; break;
+ case 0xFEE2: ch = 0xE5; break;
+ case 0xFEE3: ch = 0xE5; break;
+ case 0xFEE4: ch = 0xE5; break;
+ case 0xFEE5: ch = 0xE6; break;
+ case 0xFEE6: ch = 0xE6; break;
+ case 0xFEE7: ch = 0xE6; break;
+ case 0xFEE8: ch = 0xE6; break;
+ case 0xFEE9: ch = 0xE7; break;
+ case 0xFEEA: ch = 0xE7; break;
+ case 0xFEEB: ch = 0xE7; break;
+ case 0xFEEC: ch = 0xE7; break;
+ case 0xFEED: ch = 0xE8; break;
+ case 0xFEEE: ch = 0xE8; break;
+ case 0xFEEF: ch = 0xE9; break;
+ case 0xFEF0: ch = 0xE9; break;
+ case 0xFEF1: ch = 0xEA; break;
+ case 0xFEF2: ch = 0xEA; break;
+ case 0xFEF3: ch = 0xEA; break;
+ case 0xFEF4: ch = 0xEA; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP708
+
+public class ENCasmo_708 : CP708
+{
+ public ENCasmo_708() : base() {}
+
+}; // class ENCasmo_708
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP852.cs b/mcs/class/I18N/Rare/CP852.cs
new file mode 100644
index 00000000000..7f768b3a6f1
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP852.cs
@@ -0,0 +1,679 @@
+/*
+ * CP852.cs - Central European (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-852.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP852 : ByteEncoding
+{
+ public CP852()
+ : base(852, ToChars, "Central European (DOS)",
+ "ibm852", "ibm852", "ibm852",
+ false, false, false, false, 1250)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u016F', '\u0107', '\u00E7', '\u0142', '\u00EB',
+ '\u0150', '\u0151', '\u00EE', '\u0179', '\u00C4', '\u0106',
+ '\u00C9', '\u0139', '\u013A', '\u00F4', '\u00F6', '\u013D',
+ '\u013E', '\u015A', '\u015B', '\u00D6', '\u00DC', '\u0164',
+ '\u0165', '\u0141', '\u00D7', '\u010D', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u0104', '\u0105', '\u017D', '\u017E',
+ '\u0118', '\u0119', '\u003F', '\u017A', '\u010C', '\u015F',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u00C1', '\u00C2', '\u011A', '\u015E', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u017B', '\u017C', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u0102', '\u0103', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u00A4', '\u0111', '\u0110',
+ '\u010E', '\u00CB', '\u010F', '\u0147', '\u00CD', '\u00CE',
+ '\u011B', '\u2518', '\u250C', '\u2588', '\u2584', '\u0162',
+ '\u016E', '\u2580', '\u00D3', '\u00DF', '\u00D4', '\u0143',
+ '\u0144', '\u0148', '\u0160', '\u0161', '\u0154', '\u00DA',
+ '\u0155', '\u0170', '\u00FD', '\u00DD', '\u0163', '\u00B4',
+ '\u00AD', '\u02DD', '\u02DB', '\u02C7', '\u02D8', '\u00A7',
+ '\u00F7', '\u00B8', '\u00B0', '\u00A8', '\u02D9', '\u0171',
+ '\u0158', '\u0159', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00D0: ch = 0xD1; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0x9E; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0xED; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0xEC; break;
+ case 0x0102: ch = 0xC6; break;
+ case 0x0103: ch = 0xC7; break;
+ case 0x0104: ch = 0xA4; break;
+ case 0x0105: ch = 0xA5; break;
+ case 0x0106: ch = 0x8F; break;
+ case 0x0107: ch = 0x86; break;
+ case 0x010C: ch = 0xAC; break;
+ case 0x010D: ch = 0x9F; break;
+ case 0x010E: ch = 0xD2; break;
+ case 0x010F: ch = 0xD4; break;
+ case 0x0110: ch = 0xD1; break;
+ case 0x0111: ch = 0xD0; break;
+ case 0x0118: ch = 0xA8; break;
+ case 0x0119: ch = 0xA9; break;
+ case 0x011A: ch = 0xB7; break;
+ case 0x011B: ch = 0xD8; break;
+ case 0x0139: ch = 0x91; break;
+ case 0x013A: ch = 0x92; break;
+ case 0x013D: ch = 0x95; break;
+ case 0x013E: ch = 0x96; break;
+ case 0x0141: ch = 0x9D; break;
+ case 0x0142: ch = 0x88; break;
+ case 0x0143: ch = 0xE3; break;
+ case 0x0144: ch = 0xE4; break;
+ case 0x0147: ch = 0xD5; break;
+ case 0x0148: ch = 0xE5; break;
+ case 0x0150: ch = 0x8A; break;
+ case 0x0151: ch = 0x8B; break;
+ case 0x0154: ch = 0xE8; break;
+ case 0x0155: ch = 0xEA; break;
+ case 0x0158: ch = 0xFC; break;
+ case 0x0159: ch = 0xFD; break;
+ case 0x015A: ch = 0x97; break;
+ case 0x015B: ch = 0x98; break;
+ case 0x015E: ch = 0xB8; break;
+ case 0x015F: ch = 0xAD; break;
+ case 0x0160: ch = 0xE6; break;
+ case 0x0161: ch = 0xE7; break;
+ case 0x0162: ch = 0xDD; break;
+ case 0x0163: ch = 0xEE; break;
+ case 0x0164: ch = 0x9B; break;
+ case 0x0165: ch = 0x9C; break;
+ case 0x016E: ch = 0xDE; break;
+ case 0x016F: ch = 0x85; break;
+ case 0x0170: ch = 0xEB; break;
+ case 0x0171: ch = 0xFB; break;
+ case 0x0179: ch = 0x8D; break;
+ case 0x017A: ch = 0xAB; break;
+ case 0x017B: ch = 0xBD; break;
+ case 0x017C: ch = 0xBE; break;
+ case 0x017D: ch = 0xA6; break;
+ case 0x017E: ch = 0xA7; break;
+ case 0x02C7: ch = 0xF3; break;
+ case 0x02D8: ch = 0xF4; break;
+ case 0x02D9: ch = 0xFA; break;
+ case 0x02DB: ch = 0xF2; break;
+ case 0x02DD: ch = 0xF1; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00D0: ch = 0xD1; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0x9E; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0xED; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0xEC; break;
+ case 0x0102: ch = 0xC6; break;
+ case 0x0103: ch = 0xC7; break;
+ case 0x0104: ch = 0xA4; break;
+ case 0x0105: ch = 0xA5; break;
+ case 0x0106: ch = 0x8F; break;
+ case 0x0107: ch = 0x86; break;
+ case 0x010C: ch = 0xAC; break;
+ case 0x010D: ch = 0x9F; break;
+ case 0x010E: ch = 0xD2; break;
+ case 0x010F: ch = 0xD4; break;
+ case 0x0110: ch = 0xD1; break;
+ case 0x0111: ch = 0xD0; break;
+ case 0x0118: ch = 0xA8; break;
+ case 0x0119: ch = 0xA9; break;
+ case 0x011A: ch = 0xB7; break;
+ case 0x011B: ch = 0xD8; break;
+ case 0x0139: ch = 0x91; break;
+ case 0x013A: ch = 0x92; break;
+ case 0x013D: ch = 0x95; break;
+ case 0x013E: ch = 0x96; break;
+ case 0x0141: ch = 0x9D; break;
+ case 0x0142: ch = 0x88; break;
+ case 0x0143: ch = 0xE3; break;
+ case 0x0144: ch = 0xE4; break;
+ case 0x0147: ch = 0xD5; break;
+ case 0x0148: ch = 0xE5; break;
+ case 0x0150: ch = 0x8A; break;
+ case 0x0151: ch = 0x8B; break;
+ case 0x0154: ch = 0xE8; break;
+ case 0x0155: ch = 0xEA; break;
+ case 0x0158: ch = 0xFC; break;
+ case 0x0159: ch = 0xFD; break;
+ case 0x015A: ch = 0x97; break;
+ case 0x015B: ch = 0x98; break;
+ case 0x015E: ch = 0xB8; break;
+ case 0x015F: ch = 0xAD; break;
+ case 0x0160: ch = 0xE6; break;
+ case 0x0161: ch = 0xE7; break;
+ case 0x0162: ch = 0xDD; break;
+ case 0x0163: ch = 0xEE; break;
+ case 0x0164: ch = 0x9B; break;
+ case 0x0165: ch = 0x9C; break;
+ case 0x016E: ch = 0xDE; break;
+ case 0x016F: ch = 0x85; break;
+ case 0x0170: ch = 0xEB; break;
+ case 0x0171: ch = 0xFB; break;
+ case 0x0179: ch = 0x8D; break;
+ case 0x017A: ch = 0xAB; break;
+ case 0x017B: ch = 0xBD; break;
+ case 0x017C: ch = 0xBE; break;
+ case 0x017D: ch = 0xA6; break;
+ case 0x017E: ch = 0xA7; break;
+ case 0x02C7: ch = 0xF3; break;
+ case 0x02D8: ch = 0xF4; break;
+ case 0x02D9: ch = 0xFA; break;
+ case 0x02DB: ch = 0xF2; break;
+ case 0x02DD: ch = 0xF1; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP852
+
+public class ENCibm852 : CP852
+{
+ public ENCibm852() : base() {}
+
+}; // class ENCibm852
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP855.cs b/mcs/class/I18N/Rare/CP855.cs
new file mode 100644
index 00000000000..665ece07051
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP855.cs
@@ -0,0 +1,679 @@
+/*
+ * CP855.cs - Cyrillic (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-855.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP855 : ByteEncoding
+{
+ public CP855()
+ : base(855, ToChars, "Cyrillic (DOS)",
+ "ibm855", "ibm855", "ibm855",
+ false, false, false, false, 1251)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u0452', '\u0402', '\u0453', '\u0403',
+ '\u0451', '\u0401', '\u0454', '\u0404', '\u0455', '\u0405',
+ '\u0456', '\u0406', '\u0457', '\u0407', '\u0458', '\u0408',
+ '\u0459', '\u0409', '\u045A', '\u040A', '\u045B', '\u040B',
+ '\u045C', '\u040C', '\u045E', '\u040E', '\u045F', '\u040F',
+ '\u044E', '\u042E', '\u044A', '\u042A', '\u0430', '\u0410',
+ '\u0431', '\u0411', '\u0446', '\u0426', '\u0434', '\u0414',
+ '\u0435', '\u0415', '\u0444', '\u0424', '\u0433', '\u0413',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u0445', '\u0425', '\u0438', '\u0418', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u0439', '\u0419', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u043A', '\u041A', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u00A4', '\u043B', '\u041B',
+ '\u043C', '\u041C', '\u043D', '\u041D', '\u043E', '\u041E',
+ '\u043F', '\u2518', '\u250C', '\u2588', '\u2584', '\u041F',
+ '\u044F', '\u2580', '\u042F', '\u0440', '\u0420', '\u0441',
+ '\u0421', '\u0442', '\u0422', '\u0443', '\u0423', '\u0436',
+ '\u0416', '\u0432', '\u0412', '\u044C', '\u042C', '\u2116',
+ '\u00AD', '\u044B', '\u042B', '\u0437', '\u0417', '\u0448',
+ '\u0428', '\u044D', '\u042D', '\u0449', '\u0429', '\u0447',
+ '\u0427', '\u00A7', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A7: ch = 0xFD; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x0401: ch = 0x85; break;
+ case 0x0402: ch = 0x81; break;
+ case 0x0403: ch = 0x83; break;
+ case 0x0404: ch = 0x87; break;
+ case 0x0405: ch = 0x89; break;
+ case 0x0406: ch = 0x8B; break;
+ case 0x0407: ch = 0x8D; break;
+ case 0x0408: ch = 0x8F; break;
+ case 0x0409: ch = 0x91; break;
+ case 0x040A: ch = 0x93; break;
+ case 0x040B: ch = 0x95; break;
+ case 0x040C: ch = 0x97; break;
+ case 0x040E: ch = 0x99; break;
+ case 0x040F: ch = 0x9B; break;
+ case 0x0410: ch = 0xA1; break;
+ case 0x0411: ch = 0xA3; break;
+ case 0x0412: ch = 0xEC; break;
+ case 0x0413: ch = 0xAD; break;
+ case 0x0414: ch = 0xA7; break;
+ case 0x0415: ch = 0xA9; break;
+ case 0x0416: ch = 0xEA; break;
+ case 0x0417: ch = 0xF4; break;
+ case 0x0418: ch = 0xB8; break;
+ case 0x0419: ch = 0xBE; break;
+ case 0x041A: ch = 0xC7; break;
+ case 0x041B: ch = 0xD1; break;
+ case 0x041C: ch = 0xD3; break;
+ case 0x041D: ch = 0xD5; break;
+ case 0x041E: ch = 0xD7; break;
+ case 0x041F: ch = 0xDD; break;
+ case 0x0420: ch = 0xE2; break;
+ case 0x0421: ch = 0xE4; break;
+ case 0x0422: ch = 0xE6; break;
+ case 0x0423: ch = 0xE8; break;
+ case 0x0424: ch = 0xAB; break;
+ case 0x0425: ch = 0xB6; break;
+ case 0x0426: ch = 0xA5; break;
+ case 0x0427: ch = 0xFC; break;
+ case 0x0428: ch = 0xF6; break;
+ case 0x0429: ch = 0xFA; break;
+ case 0x042A: ch = 0x9F; break;
+ case 0x042B: ch = 0xF2; break;
+ case 0x042C: ch = 0xEE; break;
+ case 0x042D: ch = 0xF8; break;
+ case 0x042E: ch = 0x9D; break;
+ case 0x042F: ch = 0xE0; break;
+ case 0x0430: ch = 0xA0; break;
+ case 0x0431: ch = 0xA2; break;
+ case 0x0432: ch = 0xEB; break;
+ case 0x0433: ch = 0xAC; break;
+ case 0x0434: ch = 0xA6; break;
+ case 0x0435: ch = 0xA8; break;
+ case 0x0436: ch = 0xE9; break;
+ case 0x0437: ch = 0xF3; break;
+ case 0x0438: ch = 0xB7; break;
+ case 0x0439: ch = 0xBD; break;
+ case 0x043A: ch = 0xC6; break;
+ case 0x043B: ch = 0xD0; break;
+ case 0x043C: ch = 0xD2; break;
+ case 0x043D: ch = 0xD4; break;
+ case 0x043E: ch = 0xD6; break;
+ case 0x043F: ch = 0xD8; break;
+ case 0x0440: ch = 0xE1; break;
+ case 0x0441: ch = 0xE3; break;
+ case 0x0442: ch = 0xE5; break;
+ case 0x0443: ch = 0xE7; break;
+ case 0x0444: ch = 0xAA; break;
+ case 0x0445: ch = 0xB5; break;
+ case 0x0446: ch = 0xA4; break;
+ case 0x0447: ch = 0xFB; break;
+ case 0x0448: ch = 0xF5; break;
+ case 0x0449: ch = 0xF9; break;
+ case 0x044A: ch = 0x9E; break;
+ case 0x044B: ch = 0xF1; break;
+ case 0x044C: ch = 0xED; break;
+ case 0x044D: ch = 0xF7; break;
+ case 0x044E: ch = 0x9C; break;
+ case 0x044F: ch = 0xDE; break;
+ case 0x0451: ch = 0x84; break;
+ case 0x0452: ch = 0x80; break;
+ case 0x0453: ch = 0x82; break;
+ case 0x0454: ch = 0x86; break;
+ case 0x0455: ch = 0x88; break;
+ case 0x0456: ch = 0x8A; break;
+ case 0x0457: ch = 0x8C; break;
+ case 0x0458: ch = 0x8E; break;
+ case 0x0459: ch = 0x90; break;
+ case 0x045A: ch = 0x92; break;
+ case 0x045B: ch = 0x94; break;
+ case 0x045C: ch = 0x96; break;
+ case 0x045E: ch = 0x98; break;
+ case 0x045F: ch = 0x9A; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2116: ch = 0xEF; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A7: ch = 0xFD; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x0401: ch = 0x85; break;
+ case 0x0402: ch = 0x81; break;
+ case 0x0403: ch = 0x83; break;
+ case 0x0404: ch = 0x87; break;
+ case 0x0405: ch = 0x89; break;
+ case 0x0406: ch = 0x8B; break;
+ case 0x0407: ch = 0x8D; break;
+ case 0x0408: ch = 0x8F; break;
+ case 0x0409: ch = 0x91; break;
+ case 0x040A: ch = 0x93; break;
+ case 0x040B: ch = 0x95; break;
+ case 0x040C: ch = 0x97; break;
+ case 0x040E: ch = 0x99; break;
+ case 0x040F: ch = 0x9B; break;
+ case 0x0410: ch = 0xA1; break;
+ case 0x0411: ch = 0xA3; break;
+ case 0x0412: ch = 0xEC; break;
+ case 0x0413: ch = 0xAD; break;
+ case 0x0414: ch = 0xA7; break;
+ case 0x0415: ch = 0xA9; break;
+ case 0x0416: ch = 0xEA; break;
+ case 0x0417: ch = 0xF4; break;
+ case 0x0418: ch = 0xB8; break;
+ case 0x0419: ch = 0xBE; break;
+ case 0x041A: ch = 0xC7; break;
+ case 0x041B: ch = 0xD1; break;
+ case 0x041C: ch = 0xD3; break;
+ case 0x041D: ch = 0xD5; break;
+ case 0x041E: ch = 0xD7; break;
+ case 0x041F: ch = 0xDD; break;
+ case 0x0420: ch = 0xE2; break;
+ case 0x0421: ch = 0xE4; break;
+ case 0x0422: ch = 0xE6; break;
+ case 0x0423: ch = 0xE8; break;
+ case 0x0424: ch = 0xAB; break;
+ case 0x0425: ch = 0xB6; break;
+ case 0x0426: ch = 0xA5; break;
+ case 0x0427: ch = 0xFC; break;
+ case 0x0428: ch = 0xF6; break;
+ case 0x0429: ch = 0xFA; break;
+ case 0x042A: ch = 0x9F; break;
+ case 0x042B: ch = 0xF2; break;
+ case 0x042C: ch = 0xEE; break;
+ case 0x042D: ch = 0xF8; break;
+ case 0x042E: ch = 0x9D; break;
+ case 0x042F: ch = 0xE0; break;
+ case 0x0430: ch = 0xA0; break;
+ case 0x0431: ch = 0xA2; break;
+ case 0x0432: ch = 0xEB; break;
+ case 0x0433: ch = 0xAC; break;
+ case 0x0434: ch = 0xA6; break;
+ case 0x0435: ch = 0xA8; break;
+ case 0x0436: ch = 0xE9; break;
+ case 0x0437: ch = 0xF3; break;
+ case 0x0438: ch = 0xB7; break;
+ case 0x0439: ch = 0xBD; break;
+ case 0x043A: ch = 0xC6; break;
+ case 0x043B: ch = 0xD0; break;
+ case 0x043C: ch = 0xD2; break;
+ case 0x043D: ch = 0xD4; break;
+ case 0x043E: ch = 0xD6; break;
+ case 0x043F: ch = 0xD8; break;
+ case 0x0440: ch = 0xE1; break;
+ case 0x0441: ch = 0xE3; break;
+ case 0x0442: ch = 0xE5; break;
+ case 0x0443: ch = 0xE7; break;
+ case 0x0444: ch = 0xAA; break;
+ case 0x0445: ch = 0xB5; break;
+ case 0x0446: ch = 0xA4; break;
+ case 0x0447: ch = 0xFB; break;
+ case 0x0448: ch = 0xF5; break;
+ case 0x0449: ch = 0xF9; break;
+ case 0x044A: ch = 0x9E; break;
+ case 0x044B: ch = 0xF1; break;
+ case 0x044C: ch = 0xED; break;
+ case 0x044D: ch = 0xF7; break;
+ case 0x044E: ch = 0x9C; break;
+ case 0x044F: ch = 0xDE; break;
+ case 0x0451: ch = 0x84; break;
+ case 0x0452: ch = 0x80; break;
+ case 0x0453: ch = 0x82; break;
+ case 0x0454: ch = 0x86; break;
+ case 0x0455: ch = 0x88; break;
+ case 0x0456: ch = 0x8A; break;
+ case 0x0457: ch = 0x8C; break;
+ case 0x0458: ch = 0x8E; break;
+ case 0x0459: ch = 0x90; break;
+ case 0x045A: ch = 0x92; break;
+ case 0x045B: ch = 0x94; break;
+ case 0x045C: ch = 0x96; break;
+ case 0x045E: ch = 0x98; break;
+ case 0x045F: ch = 0x9A; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2116: ch = 0xEF; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP855
+
+public class ENCibm855 : CP855
+{
+ public ENCibm855() : base() {}
+
+}; // class ENCibm855
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP857.cs b/mcs/class/I18N/Rare/CP857.cs
new file mode 100644
index 00000000000..9d2b85e0708
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP857.cs
@@ -0,0 +1,673 @@
+/*
+ * CP857.cs - Turkish (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-857.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP857 : ByteEncoding
+{
+ public CP857()
+ : base(857, ToChars, "Turkish (DOS)",
+ "ibm857", "ibm857", "ibm857",
+ false, false, false, false, 1254)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00EF', '\u00EE', '\u0131', '\u00C4', '\u00C5',
+ '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2',
+ '\u00FB', '\u00F9', '\u0130', '\u00D6', '\u00DC', '\u00F8',
+ '\u00A3', '\u00D8', '\u015E', '\u015F', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u011E', '\u011F',
+ '\u00BF', '\u00AE', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u00C1', '\u00C2', '\u00C0', '\u00A9', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u00A2', '\u00A5', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u00E3', '\u00C3', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u00A4', '\u00BA', '\u00AA',
+ '\u00CA', '\u00CB', '\u00C8', '\u003F', '\u00CD', '\u00CE',
+ '\u00CF', '\u2518', '\u250C', '\u2588', '\u2584', '\u00A6',
+ '\u00CC', '\u2580', '\u00D3', '\u00DF', '\u00D4', '\u00D2',
+ '\u00F5', '\u00D5', '\u00B5', '\u003F', '\u00D7', '\u00DA',
+ '\u00DB', '\u00D9', '\u00EC', '\u00FF', '\u00AF', '\u00B4',
+ '\u00AD', '\u00B1', '\u003F', '\u00BE', '\u00B6', '\u00A7',
+ '\u00F7', '\u00B8', '\u00B0', '\u00A8', '\u00B7', '\u00B9',
+ '\u00B3', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ case 0x00EC:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0xBD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A5: ch = 0xBE; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0xB8; break;
+ case 0x00AA: ch = 0xD1; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00AE: ch = 0xA9; break;
+ case 0x00AF: ch = 0xEE; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xFC; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B5: ch = 0xE6; break;
+ case 0x00B6: ch = 0xF4; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00B9: ch = 0xFB; break;
+ case 0x00BA: ch = 0xD0; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xF3; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0xB7; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C3: ch = 0xC7; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0xD4; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0xD2; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CC: ch = 0xDE; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00CF: ch = 0xD8; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xE3; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D5: ch = 0xE5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0xE8; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00D9: ch = 0xEB; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DB: ch = 0xEA; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0xC6; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0xE4; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FF: ch = 0xED; break;
+ case 0x011E: ch = 0xA6; break;
+ case 0x011F: ch = 0xA7; break;
+ case 0x0130: ch = 0x98; break;
+ case 0x0131: ch = 0x8D; break;
+ case 0x015E: ch = 0x9E; break;
+ case 0x015F: ch = 0x9F; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xEE; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ case 0x00EC:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0xBD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A5: ch = 0xBE; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0xB8; break;
+ case 0x00AA: ch = 0xD1; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00AE: ch = 0xA9; break;
+ case 0x00AF: ch = 0xEE; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xFC; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B5: ch = 0xE6; break;
+ case 0x00B6: ch = 0xF4; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00B9: ch = 0xFB; break;
+ case 0x00BA: ch = 0xD0; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xF3; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0xB7; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C3: ch = 0xC7; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0xD4; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0xD2; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CC: ch = 0xDE; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00CF: ch = 0xD8; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xE3; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D5: ch = 0xE5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0xE8; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00D9: ch = 0xEB; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DB: ch = 0xEA; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0xC6; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0xE4; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FF: ch = 0xED; break;
+ case 0x011E: ch = 0xA6; break;
+ case 0x011F: ch = 0xA7; break;
+ case 0x0130: ch = 0x98; break;
+ case 0x0131: ch = 0x8D; break;
+ case 0x015E: ch = 0x9E; break;
+ case 0x015F: ch = 0x9F; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xEE; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP857
+
+public class ENCibm857 : CP857
+{
+ public ENCibm857() : base() {}
+
+}; // class ENCibm857
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP858.cs b/mcs/class/I18N/Rare/CP858.cs
new file mode 100644
index 00000000000..3ad8fc85a42
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP858.cs
@@ -0,0 +1,679 @@
+/*
+ * CP858.cs - Western European (DOS with Euro) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-858.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP858 : ByteEncoding
+{
+ public CP858()
+ : base(858, ToChars, "Western European (DOS with Euro)",
+ "IBM00858", "IBM00858", "IBM00858",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5',
+ '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2',
+ '\u00FB', '\u00F9', '\u00FF', '\u00D6', '\u00DC', '\u00F8',
+ '\u00A3', '\u00D8', '\u00D7', '\u0192', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA',
+ '\u00BF', '\u00AE', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u00C1', '\u00C2', '\u00C0', '\u00A9', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u00A2', '\u00A5', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u00E3', '\u00C3', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u00A4', '\u00F0', '\u00D0',
+ '\u00CA', '\u00CB', '\u00C8', '\u20AC', '\u00CD', '\u00CE',
+ '\u00CF', '\u2518', '\u250C', '\u2588', '\u2584', '\u00A6',
+ '\u00CC', '\u2580', '\u00D3', '\u00DF', '\u00D4', '\u00D2',
+ '\u00F5', '\u00D5', '\u00B5', '\u00FE', '\u00DE', '\u00DA',
+ '\u00DB', '\u00D9', '\u00FD', '\u00DD', '\u00AF', '\u00B4',
+ '\u00AD', '\u00B1', '\u2017', '\u00BE', '\u00B6', '\u00A7',
+ '\u00F7', '\u00B8', '\u00B0', '\u00A8', '\u00B7', '\u00B9',
+ '\u00B3', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0xBD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A5: ch = 0xBE; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0xB8; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00AE: ch = 0xA9; break;
+ case 0x00AF: ch = 0xEE; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xFC; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B5: ch = 0xE6; break;
+ case 0x00B6: ch = 0xF4; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00B9: ch = 0xFB; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xF3; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0xB7; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C3: ch = 0xC7; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0xD4; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0xD2; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CC: ch = 0xDE; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00CF: ch = 0xD8; break;
+ case 0x00D0: ch = 0xD1; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xE3; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D5: ch = 0xE5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0x9E; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00D9: ch = 0xEB; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DB: ch = 0xEA; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0xED; break;
+ case 0x00DE: ch = 0xE8; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0xC6; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F0: ch = 0xD0; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0xE4; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0xEC; break;
+ case 0x00FE: ch = 0xE7; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x2017: ch = 0xF2; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xEE; break;
+ case 0x20AC: ch = 0xD5; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0xBD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A5: ch = 0xBE; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0xB8; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00AE: ch = 0xA9; break;
+ case 0x00AF: ch = 0xEE; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xFC; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B5: ch = 0xE6; break;
+ case 0x00B6: ch = 0xF4; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00B9: ch = 0xFB; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xF3; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0xB7; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C3: ch = 0xC7; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0xD4; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0xD2; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CC: ch = 0xDE; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00CF: ch = 0xD8; break;
+ case 0x00D0: ch = 0xD1; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xE3; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D5: ch = 0xE5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0x9E; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00D9: ch = 0xEB; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DB: ch = 0xEA; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0xED; break;
+ case 0x00DE: ch = 0xE8; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0xC6; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F0: ch = 0xD0; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0xE4; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0xEC; break;
+ case 0x00FE: ch = 0xE7; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x2017: ch = 0xF2; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xEE; break;
+ case 0x20AC: ch = 0xD5; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP858
+
+public class ENCibm00858 : CP858
+{
+ public ENCibm00858() : base() {}
+
+}; // class ENCibm00858
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP862.cs b/mcs/class/I18N/Rare/CP862.cs
new file mode 100644
index 00000000000..182fcb33e45
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP862.cs
@@ -0,0 +1,685 @@
+/*
+ * CP862.cs - Hebrew (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-862.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP862 : ByteEncoding
+{
+ public CP862()
+ : base(862, ToChars, "Hebrew (DOS)",
+ "ibm862", "ibm861", "ibm862",
+ false, false, false, false, 1255)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u05D0', '\u05D1', '\u05D2', '\u05D3',
+ '\u05D4', '\u05D5', '\u05D6', '\u05D7', '\u05D8', '\u05D9',
+ '\u05DA', '\u05DB', '\u05DC', '\u05DD', '\u05DE', '\u05DF',
+ '\u05E0', '\u05E1', '\u05E2', '\u05E3', '\u05E4', '\u05E5',
+ '\u05E6', '\u05E7', '\u05E8', '\u05E9', '\u05EA', '\u00A2',
+ '\u00A3', '\u00A5', '\u20A7', '\u0192', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA',
+ '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393', '\u03C0',
+ '\u03A3', '\u03C3', '\u03BC', '\u03C4', '\u03A6', '\u0398',
+ '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
+ '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321',
+ '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u207F', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A5: ch = 0x9D; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x0550;
+ break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A5: ch = 0x9D; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x05D0:
+ case 0x05D1:
+ case 0x05D2:
+ case 0x05D3:
+ case 0x05D4:
+ case 0x05D5:
+ case 0x05D6:
+ case 0x05D7:
+ case 0x05D8:
+ case 0x05D9:
+ case 0x05DA:
+ case 0x05DB:
+ case 0x05DC:
+ case 0x05DD:
+ case 0x05DE:
+ case 0x05DF:
+ case 0x05E0:
+ case 0x05E1:
+ case 0x05E2:
+ case 0x05E3:
+ case 0x05E4:
+ case 0x05E5:
+ case 0x05E6:
+ case 0x05E7:
+ case 0x05E8:
+ case 0x05E9:
+ case 0x05EA:
+ ch -= 0x0550;
+ break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP862
+
+public class ENCibm862 : CP862
+{
+ public ENCibm862() : base() {}
+
+}; // class ENCibm862
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP864.cs b/mcs/class/I18N/Rare/CP864.cs
new file mode 100644
index 00000000000..0ad86426477
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP864.cs
@@ -0,0 +1,861 @@
+/*
+ * CP864.cs - Arabic (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-864.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP864 : ByteEncoding
+{
+ public CP864()
+ : base(864, ToChars, "Arabic (DOS)",
+ "ibm864", "ibm864", "ibm864",
+ false, false, false, false, 1256)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00B0', '\u00B7', '\u2219', '\u221A',
+ '\u2592', '\u2500', '\u2502', '\u253C', '\u2524', '\u252C',
+ '\u251C', '\u2534', '\u2510', '\u250C', '\u2514', '\u2518',
+ '\u03B2', '\u221E', '\u03C6', '\u00B1', '\u00BD', '\u00BC',
+ '\u2248', '\u00AB', '\u00BB', '\uFEF7', '\uFEF8', '\u003F',
+ '\u003F', '\uFEFB', '\uFEFC', '\u200B', '\u00A0', '\u00AD',
+ '\uFE82', '\u00A3', '\u00A4', '\uFE84', '\u003F', '\u003F',
+ '\uFE8E', '\uFE8F', '\uFE95', '\uFE99', '\u060C', '\uFE9D',
+ '\uFEA1', '\uFEA5', '\u0660', '\u0661', '\u0662', '\u0663',
+ '\u0664', '\u0665', '\u0666', '\u0667', '\u0668', '\u0669',
+ '\uFED1', '\u061B', '\uFEB1', '\uFEB5', '\uFEB9', '\u061F',
+ '\u00A2', '\uFE80', '\uFE81', '\uFE83', '\uFE85', '\uFECA',
+ '\uFE8B', '\uFE8D', '\uFE91', '\uFE93', '\uFE97', '\uFE9B',
+ '\uFE9F', '\uFEA3', '\uFEA7', '\uFEA9', '\uFEAB', '\uFEAD',
+ '\uFEAF', '\uFEB3', '\uFEB7', '\uFEBB', '\uFEBF', '\uFEC3',
+ '\uFEC7', '\uFECB', '\uFECF', '\u00A6', '\u00AC', '\u00F7',
+ '\u00D7', '\uFEC9', '\u0640', '\uFED3', '\uFED7', '\uFEDB',
+ '\uFEDF', '\uFEE3', '\uFEE7', '\uFEEB', '\uFEED', '\uFEEF',
+ '\uFEF3', '\uFEBD', '\uFECC', '\uFECE', '\uFECD', '\uFEE1',
+ '\uFE7D', '\uFE7C', '\uFEE5', '\uFEE9', '\uFEEC', '\uFEF0',
+ '\uFEF2', '\uFED0', '\uFED5', '\uFEF5', '\uFEF6', '\uFEDD',
+ '\uFED9', '\uFEF1', '\u25A0', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ case 0x00A0:
+ case 0x00A3:
+ case 0x00A4:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A2: ch = 0xC0; break;
+ case 0x00A6: ch = 0xDB; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AB: ch = 0x97; break;
+ case 0x00AC: ch = 0xDC; break;
+ case 0x00AD: ch = 0xA1; break;
+ case 0x00B0: ch = 0x80; break;
+ case 0x00B1: ch = 0x93; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0x81; break;
+ case 0x00BB: ch = 0x98; break;
+ case 0x00BC: ch = 0x95; break;
+ case 0x00BD: ch = 0x94; break;
+ case 0x00D7: ch = 0xDE; break;
+ case 0x00F7: ch = 0xDD; break;
+ case 0x03B2: ch = 0x90; break;
+ case 0x03C6: ch = 0x92; break;
+ case 0x060C: ch = 0xAC; break;
+ case 0x061B: ch = 0xBB; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ ch -= 0x0560;
+ break;
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x0560;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ case 0x0644:
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ case 0x0649:
+ ch -= 0x0560;
+ break;
+ case 0x064A: ch = 0xFD; break;
+ case 0x0651: ch = 0xF1; break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x05B0;
+ break;
+ case 0x066A: ch = 0x25; break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x066D: ch = 0x2A; break;
+ case 0x200B: ch = 0x9F; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0x82; break;
+ case 0x221A: ch = 0x83; break;
+ case 0x221E: ch = 0x91; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2248: ch = 0x96; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0x85; break;
+ case 0x2502: ch = 0x86; break;
+ case 0x250C: ch = 0x8D; break;
+ case 0x2510: ch = 0x8C; break;
+ case 0x2514: ch = 0x8E; break;
+ case 0x2518: ch = 0x8F; break;
+ case 0x251C: ch = 0x8A; break;
+ case 0x2524: ch = 0x88; break;
+ case 0x252C: ch = 0x89; break;
+ case 0x2534: ch = 0x8B; break;
+ case 0x253C: ch = 0x87; break;
+ case 0x2550: ch = 0x05; break;
+ case 0x2551: ch = 0x06; break;
+ case 0x2554: ch = 0x0D; break;
+ case 0x2557: ch = 0x0C; break;
+ case 0x255A: ch = 0x0E; break;
+ case 0x255D: ch = 0x0F; break;
+ case 0x2560: ch = 0x0A; break;
+ case 0x2563: ch = 0x08; break;
+ case 0x2566: ch = 0x09; break;
+ case 0x2569: ch = 0x0B; break;
+ case 0x256C: ch = 0x07; break;
+ case 0x2592: ch = 0x84; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263C: ch = 0x04; break;
+ case 0x266A: ch = 0x02; break;
+ case 0x266C: ch = 0x03; break;
+ case 0xFE7C: ch = 0xF1; break;
+ case 0xFE7D: ch = 0xF0; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xA2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xA5; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xA8; break;
+ case 0xFE8F: ch = 0xA9; break;
+ case 0xFE90: ch = 0xA9; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xAA; break;
+ case 0xFE96: ch = 0xAA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xAB; break;
+ case 0xFE9A: ch = 0xAB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xAD; break;
+ case 0xFE9E: ch = 0xAD; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xAE; break;
+ case 0xFEA2: ch = 0xAE; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xAF; break;
+ case 0xFEA6: ch = 0xAF; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xBC; break;
+ case 0xFEB2: ch = 0xBC; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xBD; break;
+ case 0xFEB6: ch = 0xBD; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xBE; break;
+ case 0xFEBA: ch = 0xBE; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xEB; break;
+ case 0xFEBE: ch = 0xEB; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD7; break;
+ case 0xFEC2: ch = 0xD7; break;
+ case 0xFEC3: ch = 0xD7; break;
+ case 0xFEC4: ch = 0xD7; break;
+ case 0xFEC5: ch = 0xD8; break;
+ case 0xFEC6: ch = 0xD8; break;
+ case 0xFEC7: ch = 0xD8; break;
+ case 0xFEC8: ch = 0xD8; break;
+ case 0xFEC9: ch = 0xDF; break;
+ case 0xFECA: ch = 0xC5; break;
+ case 0xFECB: ch = 0xD9; break;
+ case 0xFECC: ch = 0xEC; break;
+ case 0xFECD: ch = 0xEE; break;
+ case 0xFECE: ch = 0xED; break;
+ case 0xFECF: ch = 0xDA; break;
+ case 0xFED0: ch = 0xF7; break;
+ case 0xFED1: ch = 0xBA; break;
+ case 0xFED2: ch = 0xBA; break;
+ case 0xFED3: ch = 0xE1; break;
+ case 0xFED4: ch = 0xE1; break;
+ case 0xFED5: ch = 0xF8; break;
+ case 0xFED6: ch = 0xF8; break;
+ case 0xFED7: ch = 0xE2; break;
+ case 0xFED8: ch = 0xE2; break;
+ case 0xFED9: ch = 0xFC; break;
+ case 0xFEDA: ch = 0xFC; break;
+ case 0xFEDB: ch = 0xE3; break;
+ case 0xFEDC: ch = 0xE3; break;
+ case 0xFEDD: ch = 0xFB; break;
+ case 0xFEDE: ch = 0xFB; break;
+ case 0xFEDF: ch = 0xE4; break;
+ case 0xFEE0: ch = 0xE4; break;
+ case 0xFEE1: ch = 0xEF; break;
+ case 0xFEE2: ch = 0xEF; break;
+ case 0xFEE3: ch = 0xE5; break;
+ case 0xFEE4: ch = 0xE5; break;
+ case 0xFEE5: ch = 0xF2; break;
+ case 0xFEE6: ch = 0xF2; break;
+ case 0xFEE7: ch = 0xE6; break;
+ case 0xFEE8: ch = 0xE6; break;
+ case 0xFEE9: ch = 0xF3; break;
+ case 0xFEEA: ch = 0xF3; break;
+ case 0xFEEB: ch = 0xE7; break;
+ case 0xFEEC: ch = 0xF4; break;
+ case 0xFEED: ch = 0xE8; break;
+ case 0xFEEE: ch = 0xE8; break;
+ case 0xFEEF: ch = 0xE9; break;
+ case 0xFEF0: ch = 0xF5; break;
+ case 0xFEF1: ch = 0xFD; break;
+ case 0xFEF2: ch = 0xF6; break;
+ case 0xFEF3: ch = 0xEA; break;
+ case 0xFEF4: ch = 0xEA; break;
+ case 0xFEF5: ch = 0xF9; break;
+ case 0xFEF6: ch = 0xFA; break;
+ case 0xFEF7: ch = 0x99; break;
+ case 0xFEF8: ch = 0x9A; break;
+ case 0xFEFB: ch = 0x9D; break;
+ case 0xFEFC: ch = 0x9E; break;
+ case 0xFFE8: ch = 0x86; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ case 0x00A0:
+ case 0x00A3:
+ case 0x00A4:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A2: ch = 0xC0; break;
+ case 0x00A6: ch = 0xDB; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AB: ch = 0x97; break;
+ case 0x00AC: ch = 0xDC; break;
+ case 0x00AD: ch = 0xA1; break;
+ case 0x00B0: ch = 0x80; break;
+ case 0x00B1: ch = 0x93; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0x81; break;
+ case 0x00BB: ch = 0x98; break;
+ case 0x00BC: ch = 0x95; break;
+ case 0x00BD: ch = 0x94; break;
+ case 0x00D7: ch = 0xDE; break;
+ case 0x00F7: ch = 0xDD; break;
+ case 0x03B2: ch = 0x90; break;
+ case 0x03C6: ch = 0x92; break;
+ case 0x060C: ch = 0xAC; break;
+ case 0x061B: ch = 0xBB; break;
+ case 0x061F: ch = 0xBF; break;
+ case 0x0621:
+ case 0x0622:
+ case 0x0623:
+ case 0x0624:
+ ch -= 0x0560;
+ break;
+ case 0x0626:
+ case 0x0627:
+ case 0x0628:
+ case 0x0629:
+ case 0x062A:
+ case 0x062B:
+ case 0x062C:
+ case 0x062D:
+ case 0x062E:
+ case 0x062F:
+ case 0x0630:
+ case 0x0631:
+ case 0x0632:
+ case 0x0633:
+ case 0x0634:
+ case 0x0635:
+ case 0x0636:
+ case 0x0637:
+ case 0x0638:
+ case 0x0639:
+ case 0x063A:
+ ch -= 0x0560;
+ break;
+ case 0x0640:
+ case 0x0641:
+ case 0x0642:
+ case 0x0643:
+ case 0x0644:
+ case 0x0645:
+ case 0x0646:
+ case 0x0647:
+ case 0x0648:
+ case 0x0649:
+ ch -= 0x0560;
+ break;
+ case 0x064A: ch = 0xFD; break;
+ case 0x0651: ch = 0xF1; break;
+ case 0x0660:
+ case 0x0661:
+ case 0x0662:
+ case 0x0663:
+ case 0x0664:
+ case 0x0665:
+ case 0x0666:
+ case 0x0667:
+ case 0x0668:
+ case 0x0669:
+ ch -= 0x05B0;
+ break;
+ case 0x066A: ch = 0x25; break;
+ case 0x066B: ch = 0x2C; break;
+ case 0x066C: ch = 0x2E; break;
+ case 0x066D: ch = 0x2A; break;
+ case 0x200B: ch = 0x9F; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0x82; break;
+ case 0x221A: ch = 0x83; break;
+ case 0x221E: ch = 0x91; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2248: ch = 0x96; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0x85; break;
+ case 0x2502: ch = 0x86; break;
+ case 0x250C: ch = 0x8D; break;
+ case 0x2510: ch = 0x8C; break;
+ case 0x2514: ch = 0x8E; break;
+ case 0x2518: ch = 0x8F; break;
+ case 0x251C: ch = 0x8A; break;
+ case 0x2524: ch = 0x88; break;
+ case 0x252C: ch = 0x89; break;
+ case 0x2534: ch = 0x8B; break;
+ case 0x253C: ch = 0x87; break;
+ case 0x2550: ch = 0x05; break;
+ case 0x2551: ch = 0x06; break;
+ case 0x2554: ch = 0x0D; break;
+ case 0x2557: ch = 0x0C; break;
+ case 0x255A: ch = 0x0E; break;
+ case 0x255D: ch = 0x0F; break;
+ case 0x2560: ch = 0x0A; break;
+ case 0x2563: ch = 0x08; break;
+ case 0x2566: ch = 0x09; break;
+ case 0x2569: ch = 0x0B; break;
+ case 0x256C: ch = 0x07; break;
+ case 0x2592: ch = 0x84; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263C: ch = 0x04; break;
+ case 0x266A: ch = 0x02; break;
+ case 0x266C: ch = 0x03; break;
+ case 0xFE7C: ch = 0xF1; break;
+ case 0xFE7D: ch = 0xF0; break;
+ case 0xFE80: ch = 0xC1; break;
+ case 0xFE81: ch = 0xC2; break;
+ case 0xFE82: ch = 0xA2; break;
+ case 0xFE83: ch = 0xC3; break;
+ case 0xFE84: ch = 0xA5; break;
+ case 0xFE85: ch = 0xC4; break;
+ case 0xFE86: ch = 0xC4; break;
+ case 0xFE8B: ch = 0xC6; break;
+ case 0xFE8C: ch = 0xC6; break;
+ case 0xFE8D: ch = 0xC7; break;
+ case 0xFE8E: ch = 0xA8; break;
+ case 0xFE8F: ch = 0xA9; break;
+ case 0xFE90: ch = 0xA9; break;
+ case 0xFE91: ch = 0xC8; break;
+ case 0xFE92: ch = 0xC8; break;
+ case 0xFE93: ch = 0xC9; break;
+ case 0xFE94: ch = 0xC9; break;
+ case 0xFE95: ch = 0xAA; break;
+ case 0xFE96: ch = 0xAA; break;
+ case 0xFE97: ch = 0xCA; break;
+ case 0xFE98: ch = 0xCA; break;
+ case 0xFE99: ch = 0xAB; break;
+ case 0xFE9A: ch = 0xAB; break;
+ case 0xFE9B: ch = 0xCB; break;
+ case 0xFE9C: ch = 0xCB; break;
+ case 0xFE9D: ch = 0xAD; break;
+ case 0xFE9E: ch = 0xAD; break;
+ case 0xFE9F: ch = 0xCC; break;
+ case 0xFEA0: ch = 0xCC; break;
+ case 0xFEA1: ch = 0xAE; break;
+ case 0xFEA2: ch = 0xAE; break;
+ case 0xFEA3: ch = 0xCD; break;
+ case 0xFEA4: ch = 0xCD; break;
+ case 0xFEA5: ch = 0xAF; break;
+ case 0xFEA6: ch = 0xAF; break;
+ case 0xFEA7: ch = 0xCE; break;
+ case 0xFEA8: ch = 0xCE; break;
+ case 0xFEA9: ch = 0xCF; break;
+ case 0xFEAA: ch = 0xCF; break;
+ case 0xFEAB: ch = 0xD0; break;
+ case 0xFEAC: ch = 0xD0; break;
+ case 0xFEAD: ch = 0xD1; break;
+ case 0xFEAE: ch = 0xD1; break;
+ case 0xFEAF: ch = 0xD2; break;
+ case 0xFEB0: ch = 0xD2; break;
+ case 0xFEB1: ch = 0xBC; break;
+ case 0xFEB2: ch = 0xBC; break;
+ case 0xFEB3: ch = 0xD3; break;
+ case 0xFEB4: ch = 0xD3; break;
+ case 0xFEB5: ch = 0xBD; break;
+ case 0xFEB6: ch = 0xBD; break;
+ case 0xFEB7: ch = 0xD4; break;
+ case 0xFEB8: ch = 0xD4; break;
+ case 0xFEB9: ch = 0xBE; break;
+ case 0xFEBA: ch = 0xBE; break;
+ case 0xFEBB: ch = 0xD5; break;
+ case 0xFEBC: ch = 0xD5; break;
+ case 0xFEBD: ch = 0xEB; break;
+ case 0xFEBE: ch = 0xEB; break;
+ case 0xFEBF: ch = 0xD6; break;
+ case 0xFEC0: ch = 0xD6; break;
+ case 0xFEC1: ch = 0xD7; break;
+ case 0xFEC2: ch = 0xD7; break;
+ case 0xFEC3: ch = 0xD7; break;
+ case 0xFEC4: ch = 0xD7; break;
+ case 0xFEC5: ch = 0xD8; break;
+ case 0xFEC6: ch = 0xD8; break;
+ case 0xFEC7: ch = 0xD8; break;
+ case 0xFEC8: ch = 0xD8; break;
+ case 0xFEC9: ch = 0xDF; break;
+ case 0xFECA: ch = 0xC5; break;
+ case 0xFECB: ch = 0xD9; break;
+ case 0xFECC: ch = 0xEC; break;
+ case 0xFECD: ch = 0xEE; break;
+ case 0xFECE: ch = 0xED; break;
+ case 0xFECF: ch = 0xDA; break;
+ case 0xFED0: ch = 0xF7; break;
+ case 0xFED1: ch = 0xBA; break;
+ case 0xFED2: ch = 0xBA; break;
+ case 0xFED3: ch = 0xE1; break;
+ case 0xFED4: ch = 0xE1; break;
+ case 0xFED5: ch = 0xF8; break;
+ case 0xFED6: ch = 0xF8; break;
+ case 0xFED7: ch = 0xE2; break;
+ case 0xFED8: ch = 0xE2; break;
+ case 0xFED9: ch = 0xFC; break;
+ case 0xFEDA: ch = 0xFC; break;
+ case 0xFEDB: ch = 0xE3; break;
+ case 0xFEDC: ch = 0xE3; break;
+ case 0xFEDD: ch = 0xFB; break;
+ case 0xFEDE: ch = 0xFB; break;
+ case 0xFEDF: ch = 0xE4; break;
+ case 0xFEE0: ch = 0xE4; break;
+ case 0xFEE1: ch = 0xEF; break;
+ case 0xFEE2: ch = 0xEF; break;
+ case 0xFEE3: ch = 0xE5; break;
+ case 0xFEE4: ch = 0xE5; break;
+ case 0xFEE5: ch = 0xF2; break;
+ case 0xFEE6: ch = 0xF2; break;
+ case 0xFEE7: ch = 0xE6; break;
+ case 0xFEE8: ch = 0xE6; break;
+ case 0xFEE9: ch = 0xF3; break;
+ case 0xFEEA: ch = 0xF3; break;
+ case 0xFEEB: ch = 0xE7; break;
+ case 0xFEEC: ch = 0xF4; break;
+ case 0xFEED: ch = 0xE8; break;
+ case 0xFEEE: ch = 0xE8; break;
+ case 0xFEEF: ch = 0xE9; break;
+ case 0xFEF0: ch = 0xF5; break;
+ case 0xFEF1: ch = 0xFD; break;
+ case 0xFEF2: ch = 0xF6; break;
+ case 0xFEF3: ch = 0xEA; break;
+ case 0xFEF4: ch = 0xEA; break;
+ case 0xFEF5: ch = 0xF9; break;
+ case 0xFEF6: ch = 0xFA; break;
+ case 0xFEF7: ch = 0x99; break;
+ case 0xFEF8: ch = 0x9A; break;
+ case 0xFEFB: ch = 0x9D; break;
+ case 0xFEFC: ch = 0x9E; break;
+ case 0xFFE8: ch = 0x86; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP864
+
+public class ENCibm864 : CP864
+{
+ public ENCibm864() : base() {}
+
+}; // class ENCibm864
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP866.cs b/mcs/class/I18N/Rare/CP866.cs
new file mode 100644
index 00000000000..a379477bc23
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP866.cs
@@ -0,0 +1,689 @@
+/*
+ * CP866.cs - Russian (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-866.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP866 : ByteEncoding
+{
+ public CP866()
+ : base(866, ToChars, "Russian (DOS)",
+ "ibm866", "ibm866", "ibm866",
+ false, false, false, false, 1251)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u0410', '\u0411', '\u0412', '\u0413',
+ '\u0414', '\u0415', '\u0416', '\u0417', '\u0418', '\u0419',
+ '\u041A', '\u041B', '\u041C', '\u041D', '\u041E', '\u041F',
+ '\u0420', '\u0421', '\u0422', '\u0423', '\u0424', '\u0425',
+ '\u0426', '\u0427', '\u0428', '\u0429', '\u042A', '\u042B',
+ '\u042C', '\u042D', '\u042E', '\u042F', '\u0430', '\u0431',
+ '\u0432', '\u0433', '\u0434', '\u0435', '\u0436', '\u0437',
+ '\u0438', '\u0439', '\u043A', '\u043B', '\u043C', '\u043D',
+ '\u043E', '\u043F', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u0440', '\u0441', '\u0442', '\u0443',
+ '\u0444', '\u0445', '\u0446', '\u0447', '\u0448', '\u0449',
+ '\u044A', '\u044B', '\u044C', '\u044D', '\u044E', '\u044F',
+ '\u0401', '\u0451', '\u0404', '\u0454', '\u0407', '\u0457',
+ '\u040E', '\u045E', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u2116', '\u00A4', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A4: ch = 0xFD; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x0401: ch = 0xF0; break;
+ case 0x0404: ch = 0xF2; break;
+ case 0x0407: ch = 0xF4; break;
+ case 0x040E: ch = 0xF6; break;
+ case 0x0410:
+ case 0x0411:
+ case 0x0412:
+ case 0x0413:
+ case 0x0414:
+ case 0x0415:
+ case 0x0416:
+ case 0x0417:
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ case 0x0424:
+ case 0x0425:
+ case 0x0426:
+ case 0x0427:
+ case 0x0428:
+ case 0x0429:
+ case 0x042A:
+ case 0x042B:
+ case 0x042C:
+ case 0x042D:
+ case 0x042E:
+ case 0x042F:
+ case 0x0430:
+ case 0x0431:
+ case 0x0432:
+ case 0x0433:
+ case 0x0434:
+ case 0x0435:
+ case 0x0436:
+ case 0x0437:
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x0390;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ case 0x0444:
+ case 0x0445:
+ case 0x0446:
+ case 0x0447:
+ case 0x0448:
+ case 0x0449:
+ case 0x044A:
+ case 0x044B:
+ case 0x044C:
+ case 0x044D:
+ case 0x044E:
+ case 0x044F:
+ ch -= 0x0360;
+ break;
+ case 0x0451: ch = 0xF1; break;
+ case 0x0454: ch = 0xF3; break;
+ case 0x0457: ch = 0xF5; break;
+ case 0x045E: ch = 0xF7; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2116: ch = 0xFC; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A4: ch = 0xFD; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x0401: ch = 0xF0; break;
+ case 0x0404: ch = 0xF2; break;
+ case 0x0407: ch = 0xF4; break;
+ case 0x040E: ch = 0xF6; break;
+ case 0x0410:
+ case 0x0411:
+ case 0x0412:
+ case 0x0413:
+ case 0x0414:
+ case 0x0415:
+ case 0x0416:
+ case 0x0417:
+ case 0x0418:
+ case 0x0419:
+ case 0x041A:
+ case 0x041B:
+ case 0x041C:
+ case 0x041D:
+ case 0x041E:
+ case 0x041F:
+ case 0x0420:
+ case 0x0421:
+ case 0x0422:
+ case 0x0423:
+ case 0x0424:
+ case 0x0425:
+ case 0x0426:
+ case 0x0427:
+ case 0x0428:
+ case 0x0429:
+ case 0x042A:
+ case 0x042B:
+ case 0x042C:
+ case 0x042D:
+ case 0x042E:
+ case 0x042F:
+ case 0x0430:
+ case 0x0431:
+ case 0x0432:
+ case 0x0433:
+ case 0x0434:
+ case 0x0435:
+ case 0x0436:
+ case 0x0437:
+ case 0x0438:
+ case 0x0439:
+ case 0x043A:
+ case 0x043B:
+ case 0x043C:
+ case 0x043D:
+ case 0x043E:
+ case 0x043F:
+ ch -= 0x0390;
+ break;
+ case 0x0440:
+ case 0x0441:
+ case 0x0442:
+ case 0x0443:
+ case 0x0444:
+ case 0x0445:
+ case 0x0446:
+ case 0x0447:
+ case 0x0448:
+ case 0x0449:
+ case 0x044A:
+ case 0x044B:
+ case 0x044C:
+ case 0x044D:
+ case 0x044E:
+ case 0x044F:
+ ch -= 0x0360;
+ break;
+ case 0x0451: ch = 0xF1; break;
+ case 0x0454: ch = 0xF3; break;
+ case 0x0457: ch = 0xF5; break;
+ case 0x045E: ch = 0xF7; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2116: ch = 0xFC; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP866
+
+public class ENCibm866 : CP866
+{
+ public ENCibm866() : base() {}
+
+}; // class ENCibm866
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP869.cs b/mcs/class/I18N/Rare/CP869.cs
new file mode 100644
index 00000000000..443da7c1250
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP869.cs
@@ -0,0 +1,681 @@
+/*
+ * CP869.cs - Greek (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-869.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP869 : ByteEncoding
+{
+ public CP869()
+ : base(869, ToChars, "Greek (DOS)",
+ "ibm869", "ibm869", "ibm869",
+ false, false, false, false, 1253)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u003F', '\u003F', '\u003F', '\u003F',
+ '\u003F', '\u003F', '\u0386', '\u003F', '\u0387', '\u00AC',
+ '\u00A6', '\u2018', '\u2019', '\u0388', '\u2015', '\u0389',
+ '\u038A', '\u03AA', '\u038C', '\u003F', '\u003F', '\u038E',
+ '\u03AB', '\u00A9', '\u038F', '\u00B2', '\u00B3', '\u03AC',
+ '\u00A3', '\u03AD', '\u03AE', '\u03AF', '\u03CA', '\u0390',
+ '\u03CC', '\u03CD', '\u0391', '\u0392', '\u0393', '\u0394',
+ '\u0395', '\u0396', '\u0397', '\u00BD', '\u0398', '\u0399',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u039A', '\u039B', '\u039C', '\u039D', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u039E', '\u039F', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u03A0', '\u03A1', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u03A3', '\u03A4', '\u03A5',
+ '\u03A6', '\u03A7', '\u03A8', '\u03A9', '\u03B1', '\u03B2',
+ '\u03B3', '\u2518', '\u250C', '\u2588', '\u2584', '\u03B4',
+ '\u03B5', '\u2580', '\u03B6', '\u03B7', '\u03B8', '\u03B9',
+ '\u03BA', '\u03BB', '\u03BC', '\u03BD', '\u03BE', '\u03BF',
+ '\u03C0', '\u03C1', '\u03C3', '\u03C2', '\u03C4', '\u00B4',
+ '\u00AD', '\u00B1', '\u03C5', '\u03C6', '\u03C7', '\u00A7',
+ '\u03C8', '\u0385', '\u00B0', '\u00A8', '\u03C9', '\u03CB',
+ '\u03B0', '\u03CE', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A6: ch = 0x8A; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0x97; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0x89; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0x99; break;
+ case 0x00B3: ch = 0x9A; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0x88; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x0385: ch = 0xF7; break;
+ case 0x0386: ch = 0x86; break;
+ case 0x0387: ch = 0x88; break;
+ case 0x0388: ch = 0x8D; break;
+ case 0x0389: ch = 0x8F; break;
+ case 0x038A: ch = 0x90; break;
+ case 0x038C: ch = 0x92; break;
+ case 0x038E: ch = 0x95; break;
+ case 0x038F: ch = 0x98; break;
+ case 0x0390: ch = 0xA1; break;
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ ch -= 0x02ED;
+ break;
+ case 0x0398: ch = 0xAC; break;
+ case 0x0399: ch = 0xAD; break;
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ ch -= 0x02E5;
+ break;
+ case 0x039E: ch = 0xBD; break;
+ case 0x039F: ch = 0xBE; break;
+ case 0x03A0: ch = 0xC6; break;
+ case 0x03A1: ch = 0xC7; break;
+ case 0x03A3:
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ ch -= 0x02D4;
+ break;
+ case 0x03AA: ch = 0x91; break;
+ case 0x03AB: ch = 0x96; break;
+ case 0x03AC: ch = 0x9B; break;
+ case 0x03AD: ch = 0x9D; break;
+ case 0x03AE: ch = 0x9E; break;
+ case 0x03AF: ch = 0x9F; break;
+ case 0x03B0: ch = 0xFC; break;
+ case 0x03B1: ch = 0xD6; break;
+ case 0x03B2: ch = 0xD7; break;
+ case 0x03B3: ch = 0xD8; break;
+ case 0x03B4: ch = 0xDD; break;
+ case 0x03B5: ch = 0xDE; break;
+ case 0x03B6:
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ ch -= 0x02D6;
+ break;
+ case 0x03C2: ch = 0xED; break;
+ case 0x03C3: ch = 0xEC; break;
+ case 0x03C4: ch = 0xEE; break;
+ case 0x03C5: ch = 0xF2; break;
+ case 0x03C6: ch = 0xF3; break;
+ case 0x03C7: ch = 0xF4; break;
+ case 0x03C8: ch = 0xF6; break;
+ case 0x03C9: ch = 0xFA; break;
+ case 0x03CA: ch = 0xA0; break;
+ case 0x03CB: ch = 0xFB; break;
+ case 0x03CC: ch = 0xA2; break;
+ case 0x03CD: ch = 0xA3; break;
+ case 0x03CE: ch = 0xFD; break;
+ case 0x03D5: ch = 0xF3; break;
+ case 0x2015: ch = 0x8E; break;
+ case 0x2018: ch = 0x8B; break;
+ case 0x2019: ch = 0x8C; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A6: ch = 0x8A; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0x97; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0x89; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0x99; break;
+ case 0x00B3: ch = 0x9A; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0x88; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x0385: ch = 0xF7; break;
+ case 0x0386: ch = 0x86; break;
+ case 0x0387: ch = 0x88; break;
+ case 0x0388: ch = 0x8D; break;
+ case 0x0389: ch = 0x8F; break;
+ case 0x038A: ch = 0x90; break;
+ case 0x038C: ch = 0x92; break;
+ case 0x038E: ch = 0x95; break;
+ case 0x038F: ch = 0x98; break;
+ case 0x0390: ch = 0xA1; break;
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ ch -= 0x02ED;
+ break;
+ case 0x0398: ch = 0xAC; break;
+ case 0x0399: ch = 0xAD; break;
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ ch -= 0x02E5;
+ break;
+ case 0x039E: ch = 0xBD; break;
+ case 0x039F: ch = 0xBE; break;
+ case 0x03A0: ch = 0xC6; break;
+ case 0x03A1: ch = 0xC7; break;
+ case 0x03A3:
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ ch -= 0x02D4;
+ break;
+ case 0x03AA: ch = 0x91; break;
+ case 0x03AB: ch = 0x96; break;
+ case 0x03AC: ch = 0x9B; break;
+ case 0x03AD: ch = 0x9D; break;
+ case 0x03AE: ch = 0x9E; break;
+ case 0x03AF: ch = 0x9F; break;
+ case 0x03B0: ch = 0xFC; break;
+ case 0x03B1: ch = 0xD6; break;
+ case 0x03B2: ch = 0xD7; break;
+ case 0x03B3: ch = 0xD8; break;
+ case 0x03B4: ch = 0xDD; break;
+ case 0x03B5: ch = 0xDE; break;
+ case 0x03B6:
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ ch -= 0x02D6;
+ break;
+ case 0x03C2: ch = 0xED; break;
+ case 0x03C3: ch = 0xEC; break;
+ case 0x03C4: ch = 0xEE; break;
+ case 0x03C5: ch = 0xF2; break;
+ case 0x03C6: ch = 0xF3; break;
+ case 0x03C7: ch = 0xF4; break;
+ case 0x03C8: ch = 0xF6; break;
+ case 0x03C9: ch = 0xFA; break;
+ case 0x03CA: ch = 0xA0; break;
+ case 0x03CB: ch = 0xFB; break;
+ case 0x03CC: ch = 0xA2; break;
+ case 0x03CD: ch = 0xA3; break;
+ case 0x03CE: ch = 0xFD; break;
+ case 0x03D5: ch = 0xF3; break;
+ case 0x2015: ch = 0x8E; break;
+ case 0x2018: ch = 0x8B; break;
+ case 0x2019: ch = 0x8C; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP869
+
+public class ENCibm869 : CP869
+{
+ public ENCibm869() : base() {}
+
+}; // class ENCibm869
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP870.cs b/mcs/class/I18N/Rare/CP870.cs
new file mode 100644
index 00000000000..2bd8a401db4
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP870.cs
@@ -0,0 +1,895 @@
+/*
+ * CP870.cs - IBM EBCDIC (Latin 2) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-870.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP870 : ByteEncoding
+{
+ public CP870()
+ : base(870, ToChars, "IBM EBCDIC (Latin 2)",
+ "ibm870", "ibm870", "ibm870",
+ false, false, false, false, 1250)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
+ '\u00E2', '\u00E4', '\u0163', '\u00E1', '\u0103', '\u010D',
+ '\u00E7', '\u0107', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u00E9', '\u0119', '\u00EB',
+ '\u016F', '\u00ED', '\u00EE', '\u013E', '\u013A', '\u00DF',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u00C2', '\u00C4', '\u02DD', '\u00C1',
+ '\u0102', '\u010C', '\u00C7', '\u0106', '\u007C', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u02C7', '\u00C9',
+ '\u0118', '\u00CB', '\u016E', '\u00CD', '\u00CE', '\u013D',
+ '\u0139', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u02D8', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u015B', '\u0148', '\u0111', '\u00FD', '\u0159', '\u015F',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u0142', '\u0144',
+ '\u0161', '\u00B8', '\u02DB', '\u00A4', '\u0105', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u015A', '\u0147', '\u0110', '\u00DD',
+ '\u0158', '\u015E', '\u02D9', '\u0104', '\u017C', '\u0162',
+ '\u017B', '\u00A7', '\u017E', '\u017A', '\u017D', '\u0179',
+ '\u0141', '\u0143', '\u0160', '\u00A8', '\u00B4', '\u00D7',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
+ '\u00F6', '\u0155', '\u00F3', '\u0151', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u011A', '\u0171', '\u00FC', '\u0165',
+ '\u00FA', '\u011B', '\u005C', '\u00F7', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u010F', '\u00D4', '\u00D6', '\u0154', '\u00D3', '\u0150',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u010E', '\u0170',
+ '\u00DC', '\u0164', '\u00DA', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x6A; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x0102: ch = 0x66; break;
+ case 0x0103: ch = 0x46; break;
+ case 0x0104: ch = 0xB1; break;
+ case 0x0105: ch = 0xA0; break;
+ case 0x0106: ch = 0x69; break;
+ case 0x0107: ch = 0x49; break;
+ case 0x010C: ch = 0x67; break;
+ case 0x010D: ch = 0x47; break;
+ case 0x010E: ch = 0xFA; break;
+ case 0x010F: ch = 0xEA; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x0111: ch = 0x8C; break;
+ case 0x0118: ch = 0x72; break;
+ case 0x0119: ch = 0x52; break;
+ case 0x011A: ch = 0xDA; break;
+ case 0x011B: ch = 0xDF; break;
+ case 0x0139: ch = 0x78; break;
+ case 0x013A: ch = 0x58; break;
+ case 0x013D: ch = 0x77; break;
+ case 0x013E: ch = 0x57; break;
+ case 0x0141: ch = 0xBA; break;
+ case 0x0142: ch = 0x9A; break;
+ case 0x0143: ch = 0xBB; break;
+ case 0x0144: ch = 0x9B; break;
+ case 0x0147: ch = 0xAB; break;
+ case 0x0148: ch = 0x8B; break;
+ case 0x0150: ch = 0xEF; break;
+ case 0x0151: ch = 0xCF; break;
+ case 0x0154: ch = 0xED; break;
+ case 0x0155: ch = 0xCD; break;
+ case 0x0158: ch = 0xAE; break;
+ case 0x0159: ch = 0x8E; break;
+ case 0x015A: ch = 0xAA; break;
+ case 0x015B: ch = 0x8A; break;
+ case 0x015E: ch = 0xAF; break;
+ case 0x015F: ch = 0x8F; break;
+ case 0x0160: ch = 0xBC; break;
+ case 0x0161: ch = 0x9C; break;
+ case 0x0162: ch = 0xB3; break;
+ case 0x0163: ch = 0x44; break;
+ case 0x0164: ch = 0xFD; break;
+ case 0x0165: ch = 0xDD; break;
+ case 0x016E: ch = 0x74; break;
+ case 0x016F: ch = 0x54; break;
+ case 0x0170: ch = 0xFB; break;
+ case 0x0171: ch = 0xDB; break;
+ case 0x0179: ch = 0xB9; break;
+ case 0x017A: ch = 0xB7; break;
+ case 0x017B: ch = 0xB4; break;
+ case 0x017C: ch = 0xB2; break;
+ case 0x017D: ch = 0xB8; break;
+ case 0x017E: ch = 0xB6; break;
+ case 0x02C7: ch = 0x70; break;
+ case 0x02D8: ch = 0x80; break;
+ case 0x02D9: ch = 0xB0; break;
+ case 0x02DB: ch = 0x9E; break;
+ case 0x02DD: ch = 0x64; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x6A; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x6A; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x41; break;
+ case 0x00A4: ch = 0x9F; break;
+ case 0x00A7: ch = 0xB5; break;
+ case 0x00A8: ch = 0xBD; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B4: ch = 0xBE; break;
+ case 0x00B8: ch = 0x9D; break;
+ case 0x00C1: ch = 0x65; break;
+ case 0x00C2: ch = 0x62; break;
+ case 0x00C4: ch = 0x63; break;
+ case 0x00C7: ch = 0x68; break;
+ case 0x00C9: ch = 0x71; break;
+ case 0x00CB: ch = 0x73; break;
+ case 0x00CD: ch = 0x75; break;
+ case 0x00CE: ch = 0x76; break;
+ case 0x00D0: ch = 0xAC; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEB; break;
+ case 0x00D6: ch = 0xEC; break;
+ case 0x00D7: ch = 0xBF; break;
+ case 0x00DA: ch = 0xFE; break;
+ case 0x00DC: ch = 0xFC; break;
+ case 0x00DD: ch = 0xAD; break;
+ case 0x00DF: ch = 0x59; break;
+ case 0x00E1: ch = 0x45; break;
+ case 0x00E2: ch = 0x42; break;
+ case 0x00E4: ch = 0x43; break;
+ case 0x00E7: ch = 0x48; break;
+ case 0x00E9: ch = 0x51; break;
+ case 0x00EB: ch = 0x53; break;
+ case 0x00ED: ch = 0x55; break;
+ case 0x00EE: ch = 0x56; break;
+ case 0x00F3: ch = 0xCE; break;
+ case 0x00F4: ch = 0xCB; break;
+ case 0x00F6: ch = 0xCC; break;
+ case 0x00F7: ch = 0xE1; break;
+ case 0x00FA: ch = 0xDE; break;
+ case 0x00FC: ch = 0xDC; break;
+ case 0x00FD: ch = 0x8D; break;
+ case 0x0102: ch = 0x66; break;
+ case 0x0103: ch = 0x46; break;
+ case 0x0104: ch = 0xB1; break;
+ case 0x0105: ch = 0xA0; break;
+ case 0x0106: ch = 0x69; break;
+ case 0x0107: ch = 0x49; break;
+ case 0x010C: ch = 0x67; break;
+ case 0x010D: ch = 0x47; break;
+ case 0x010E: ch = 0xFA; break;
+ case 0x010F: ch = 0xEA; break;
+ case 0x0110: ch = 0xAC; break;
+ case 0x0111: ch = 0x8C; break;
+ case 0x0118: ch = 0x72; break;
+ case 0x0119: ch = 0x52; break;
+ case 0x011A: ch = 0xDA; break;
+ case 0x011B: ch = 0xDF; break;
+ case 0x0139: ch = 0x78; break;
+ case 0x013A: ch = 0x58; break;
+ case 0x013D: ch = 0x77; break;
+ case 0x013E: ch = 0x57; break;
+ case 0x0141: ch = 0xBA; break;
+ case 0x0142: ch = 0x9A; break;
+ case 0x0143: ch = 0xBB; break;
+ case 0x0144: ch = 0x9B; break;
+ case 0x0147: ch = 0xAB; break;
+ case 0x0148: ch = 0x8B; break;
+ case 0x0150: ch = 0xEF; break;
+ case 0x0151: ch = 0xCF; break;
+ case 0x0154: ch = 0xED; break;
+ case 0x0155: ch = 0xCD; break;
+ case 0x0158: ch = 0xAE; break;
+ case 0x0159: ch = 0x8E; break;
+ case 0x015A: ch = 0xAA; break;
+ case 0x015B: ch = 0x8A; break;
+ case 0x015E: ch = 0xAF; break;
+ case 0x015F: ch = 0x8F; break;
+ case 0x0160: ch = 0xBC; break;
+ case 0x0161: ch = 0x9C; break;
+ case 0x0162: ch = 0xB3; break;
+ case 0x0163: ch = 0x44; break;
+ case 0x0164: ch = 0xFD; break;
+ case 0x0165: ch = 0xDD; break;
+ case 0x016E: ch = 0x74; break;
+ case 0x016F: ch = 0x54; break;
+ case 0x0170: ch = 0xFB; break;
+ case 0x0171: ch = 0xDB; break;
+ case 0x0179: ch = 0xB9; break;
+ case 0x017A: ch = 0xB7; break;
+ case 0x017B: ch = 0xB4; break;
+ case 0x017C: ch = 0xB2; break;
+ case 0x017D: ch = 0xB8; break;
+ case 0x017E: ch = 0xB6; break;
+ case 0x02C7: ch = 0x70; break;
+ case 0x02D8: ch = 0x80; break;
+ case 0x02D9: ch = 0xB0; break;
+ case 0x02DB: ch = 0x9E; break;
+ case 0x02DD: ch = 0x64; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x6A; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP870
+
+public class ENCibm870 : CP870
+{
+ public ENCibm870() : base() {}
+
+}; // class ENCibm870
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/CP875.cs b/mcs/class/I18N/Rare/CP875.cs
new file mode 100644
index 00000000000..7b3d7b64045
--- /dev/null
+++ b/mcs/class/I18N/Rare/CP875.cs
@@ -0,0 +1,913 @@
+/*
+ * CP875.cs - IBM EBCDIC (Greek) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-875.ucm".
+
+namespace I18N.Rare
+{
+
+using System;
+using I18N.Common;
+
+public class CP875 : ByteEncoding
+{
+ public CP875()
+ : base(875, ToChars, "IBM EBCDIC (Greek)",
+ "ibm875", "ibm875", "ibm875",
+ false, false, false, false, 1253)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
+ '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
+ '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
+ '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u0391',
+ '\u0392', '\u0393', '\u0394', '\u0395', '\u0396', '\u0397',
+ '\u0398', '\u0399', '\u005B', '\u002E', '\u003C', '\u0028',
+ '\u002B', '\u0021', '\u0026', '\u039A', '\u039B', '\u039C',
+ '\u039D', '\u039E', '\u039F', '\u03A0', '\u03A1', '\u03A3',
+ '\u005D', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
+ '\u002D', '\u002F', '\u03A4', '\u03A5', '\u03A6', '\u03A7',
+ '\u03A8', '\u03A9', '\u03AA', '\u03AB', '\u007C', '\u002C',
+ '\u0025', '\u005F', '\u003E', '\u003F', '\u00A8', '\u0386',
+ '\u0388', '\u0389', '\u00A0', '\u038A', '\u038C', '\u038E',
+ '\u038F', '\u0060', '\u003A', '\u0023', '\u0040', '\u0027',
+ '\u003D', '\u0022', '\u0385', '\u0061', '\u0062', '\u0063',
+ '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
+ '\u03B1', '\u03B2', '\u03B3', '\u03B4', '\u03B5', '\u03B6',
+ '\u00B0', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
+ '\u006F', '\u0070', '\u0071', '\u0072', '\u03B7', '\u03B8',
+ '\u03B9', '\u03BA', '\u03BB', '\u03BC', '\u00B4', '\u007E',
+ '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
+ '\u0079', '\u007A', '\u03BD', '\u03BE', '\u03BF', '\u03C0',
+ '\u03C1', '\u03C3', '\u00A3', '\u03AC', '\u03AD', '\u03AE',
+ '\u03CA', '\u03AF', '\u03CC', '\u03CD', '\u03CB', '\u03CE',
+ '\u03C2', '\u03C4', '\u03C5', '\u03C6', '\u03C7', '\u03C8',
+ '\u007B', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
+ '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u03C9',
+ '\u0390', '\u03B0', '\u2018', '\u2015', '\u007D', '\u004A',
+ '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
+ '\u0051', '\u0052', '\u00B1', '\u00BD', '\u003F', '\u0387',
+ '\u2019', '\u00A6', '\u005C', '\u003F', '\u0053', '\u0054',
+ '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
+ '\u00B2', '\u00A7', '\u003F', '\u003F', '\u00AB', '\u00AC',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00A9',
+ '\u003F', '\u003F', '\u00BB', '\u009F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x6A; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x74; break;
+ case 0x00A3: ch = 0xB0; break;
+ case 0x00A6: ch = 0xDF; break;
+ case 0x00A7: ch = 0xEB; break;
+ case 0x00A8: ch = 0x70; break;
+ case 0x00A9: ch = 0xFB; break;
+ case 0x00AB: ch = 0xEE; break;
+ case 0x00AC: ch = 0xEF; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0xDA; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xA0; break;
+ case 0x00B7: ch = 0xDD; break;
+ case 0x00BB: ch = 0xFE; break;
+ case 0x00BD: ch = 0xDB; break;
+ case 0x0385: ch = 0x80; break;
+ case 0x0386: ch = 0x71; break;
+ case 0x0387: ch = 0xDD; break;
+ case 0x0388: ch = 0x72; break;
+ case 0x0389: ch = 0x73; break;
+ case 0x038A: ch = 0x75; break;
+ case 0x038C: ch = 0x76; break;
+ case 0x038E: ch = 0x77; break;
+ case 0x038F: ch = 0x78; break;
+ case 0x0390: ch = 0xCC; break;
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ case 0x0398:
+ case 0x0399:
+ ch -= 0x0350;
+ break;
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ case 0x039E:
+ case 0x039F:
+ case 0x03A0:
+ case 0x03A1:
+ ch -= 0x0349;
+ break;
+ case 0x03A3: ch = 0x59; break;
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ case 0x03AA:
+ case 0x03AB:
+ ch -= 0x0342;
+ break;
+ case 0x03AC: ch = 0xB1; break;
+ case 0x03AD: ch = 0xB2; break;
+ case 0x03AE: ch = 0xB3; break;
+ case 0x03AF: ch = 0xB5; break;
+ case 0x03B0: ch = 0xCD; break;
+ case 0x03B1:
+ case 0x03B2:
+ case 0x03B3:
+ case 0x03B4:
+ case 0x03B5:
+ case 0x03B6:
+ ch -= 0x0327;
+ break;
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ ch -= 0x031D;
+ break;
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ ch -= 0x0313;
+ break;
+ case 0x03C2: ch = 0xBA; break;
+ case 0x03C3: ch = 0xAF; break;
+ case 0x03C4:
+ case 0x03C5:
+ case 0x03C6:
+ case 0x03C7:
+ case 0x03C8:
+ ch -= 0x0309;
+ break;
+ case 0x03C9: ch = 0xCB; break;
+ case 0x03CA: ch = 0xB4; break;
+ case 0x03CB: ch = 0xB8; break;
+ case 0x03CC: ch = 0xB6; break;
+ case 0x03CD: ch = 0xB7; break;
+ case 0x03CE: ch = 0xB9; break;
+ case 0x03D5: ch = 0xBD; break;
+ case 0x2015: ch = 0xCF; break;
+ case 0x2018: ch = 0xCE; break;
+ case 0x2019: ch = 0xDE; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x6A; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 4) switch(ch)
+ {
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x000E:
+ case 0x000F:
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0018:
+ case 0x0019:
+ case 0x001C:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ break;
+ case 0x0004: ch = 0x37; break;
+ case 0x0005: ch = 0x2D; break;
+ case 0x0006: ch = 0x2E; break;
+ case 0x0007: ch = 0x2F; break;
+ case 0x0008: ch = 0x16; break;
+ case 0x0009: ch = 0x05; break;
+ case 0x000A: ch = 0x25; break;
+ case 0x0014: ch = 0x3C; break;
+ case 0x0015: ch = 0x3D; break;
+ case 0x0016: ch = 0x32; break;
+ case 0x0017: ch = 0x26; break;
+ case 0x001A: ch = 0x3F; break;
+ case 0x001B: ch = 0x27; break;
+ case 0x0020: ch = 0x40; break;
+ case 0x0021: ch = 0x4F; break;
+ case 0x0022: ch = 0x7F; break;
+ case 0x0023: ch = 0x7B; break;
+ case 0x0024: ch = 0x5B; break;
+ case 0x0025: ch = 0x6C; break;
+ case 0x0026: ch = 0x50; break;
+ case 0x0027: ch = 0x7D; break;
+ case 0x0028: ch = 0x4D; break;
+ case 0x0029: ch = 0x5D; break;
+ case 0x002A: ch = 0x5C; break;
+ case 0x002B: ch = 0x4E; break;
+ case 0x002C: ch = 0x6B; break;
+ case 0x002D: ch = 0x60; break;
+ case 0x002E: ch = 0x4B; break;
+ case 0x002F: ch = 0x61; break;
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ ch += 0x00C0;
+ break;
+ case 0x003A: ch = 0x7A; break;
+ case 0x003B: ch = 0x5E; break;
+ case 0x003C: ch = 0x4C; break;
+ case 0x003D: ch = 0x7E; break;
+ case 0x003E: ch = 0x6E; break;
+ case 0x003F: ch = 0x6F; break;
+ case 0x0040: ch = 0x7C; break;
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ ch += 0x0080;
+ break;
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ ch += 0x0087;
+ break;
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ ch += 0x008F;
+ break;
+ case 0x005B: ch = 0x4A; break;
+ case 0x005C: ch = 0xE0; break;
+ case 0x005D: ch = 0x5A; break;
+ case 0x005E: ch = 0x5F; break;
+ case 0x005F: ch = 0x6D; break;
+ case 0x0060: ch = 0x79; break;
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ ch += 0x0020;
+ break;
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ ch += 0x0027;
+ break;
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ ch += 0x002F;
+ break;
+ case 0x007B: ch = 0xC0; break;
+ case 0x007C: ch = 0x6A; break;
+ case 0x007D: ch = 0xD0; break;
+ case 0x007E: ch = 0xA1; break;
+ case 0x007F: ch = 0x07; break;
+ case 0x0080:
+ case 0x0081:
+ case 0x0082:
+ case 0x0083:
+ case 0x0084:
+ ch -= 0x0060;
+ break;
+ case 0x0085: ch = 0x15; break;
+ case 0x0086: ch = 0x06; break;
+ case 0x0087: ch = 0x17; break;
+ case 0x0088:
+ case 0x0089:
+ case 0x008A:
+ case 0x008B:
+ case 0x008C:
+ ch -= 0x0060;
+ break;
+ case 0x008D: ch = 0x09; break;
+ case 0x008E: ch = 0x0A; break;
+ case 0x008F: ch = 0x1B; break;
+ case 0x0090: ch = 0x30; break;
+ case 0x0091: ch = 0x31; break;
+ case 0x0092: ch = 0x1A; break;
+ case 0x0093:
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ ch -= 0x0060;
+ break;
+ case 0x0097: ch = 0x08; break;
+ case 0x0098:
+ case 0x0099:
+ case 0x009A:
+ case 0x009B:
+ ch -= 0x0060;
+ break;
+ case 0x009C: ch = 0x04; break;
+ case 0x009D: ch = 0x14; break;
+ case 0x009E: ch = 0x3E; break;
+ case 0x009F: ch = 0xFF; break;
+ case 0x00A0: ch = 0x74; break;
+ case 0x00A3: ch = 0xB0; break;
+ case 0x00A6: ch = 0xDF; break;
+ case 0x00A7: ch = 0xEB; break;
+ case 0x00A8: ch = 0x70; break;
+ case 0x00A9: ch = 0xFB; break;
+ case 0x00AB: ch = 0xEE; break;
+ case 0x00AC: ch = 0xEF; break;
+ case 0x00AD: ch = 0xCA; break;
+ case 0x00B0: ch = 0x90; break;
+ case 0x00B1: ch = 0xDA; break;
+ case 0x00B2: ch = 0xEA; break;
+ case 0x00B3: ch = 0xFA; break;
+ case 0x00B4: ch = 0xA0; break;
+ case 0x00B7: ch = 0xDD; break;
+ case 0x00BB: ch = 0xFE; break;
+ case 0x00BD: ch = 0xDB; break;
+ case 0x0385: ch = 0x80; break;
+ case 0x0386: ch = 0x71; break;
+ case 0x0387: ch = 0xDD; break;
+ case 0x0388: ch = 0x72; break;
+ case 0x0389: ch = 0x73; break;
+ case 0x038A: ch = 0x75; break;
+ case 0x038C: ch = 0x76; break;
+ case 0x038E: ch = 0x77; break;
+ case 0x038F: ch = 0x78; break;
+ case 0x0390: ch = 0xCC; break;
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ case 0x0398:
+ case 0x0399:
+ ch -= 0x0350;
+ break;
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ case 0x039E:
+ case 0x039F:
+ case 0x03A0:
+ case 0x03A1:
+ ch -= 0x0349;
+ break;
+ case 0x03A3: ch = 0x59; break;
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ case 0x03AA:
+ case 0x03AB:
+ ch -= 0x0342;
+ break;
+ case 0x03AC: ch = 0xB1; break;
+ case 0x03AD: ch = 0xB2; break;
+ case 0x03AE: ch = 0xB3; break;
+ case 0x03AF: ch = 0xB5; break;
+ case 0x03B0: ch = 0xCD; break;
+ case 0x03B1:
+ case 0x03B2:
+ case 0x03B3:
+ case 0x03B4:
+ case 0x03B5:
+ case 0x03B6:
+ ch -= 0x0327;
+ break;
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ ch -= 0x031D;
+ break;
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ ch -= 0x0313;
+ break;
+ case 0x03C2: ch = 0xBA; break;
+ case 0x03C3: ch = 0xAF; break;
+ case 0x03C4:
+ case 0x03C5:
+ case 0x03C6:
+ case 0x03C7:
+ case 0x03C8:
+ ch -= 0x0309;
+ break;
+ case 0x03C9: ch = 0xCB; break;
+ case 0x03CA: ch = 0xB4; break;
+ case 0x03CB: ch = 0xB8; break;
+ case 0x03CC: ch = 0xB6; break;
+ case 0x03CD: ch = 0xB7; break;
+ case 0x03CE: ch = 0xB9; break;
+ case 0x03D5: ch = 0xBD; break;
+ case 0x2015: ch = 0xCF; break;
+ case 0x2018: ch = 0xCE; break;
+ case 0x2019: ch = 0xDE; break;
+ case 0xFF01: ch = 0x4F; break;
+ case 0xFF02: ch = 0x7F; break;
+ case 0xFF03: ch = 0x7B; break;
+ case 0xFF04: ch = 0x5B; break;
+ case 0xFF05: ch = 0x6C; break;
+ case 0xFF06: ch = 0x50; break;
+ case 0xFF07: ch = 0x7D; break;
+ case 0xFF08: ch = 0x4D; break;
+ case 0xFF09: ch = 0x5D; break;
+ case 0xFF0A: ch = 0x5C; break;
+ case 0xFF0B: ch = 0x4E; break;
+ case 0xFF0C: ch = 0x6B; break;
+ case 0xFF0D: ch = 0x60; break;
+ case 0xFF0E: ch = 0x4B; break;
+ case 0xFF0F: ch = 0x61; break;
+ case 0xFF10:
+ case 0xFF11:
+ case 0xFF12:
+ case 0xFF13:
+ case 0xFF14:
+ case 0xFF15:
+ case 0xFF16:
+ case 0xFF17:
+ case 0xFF18:
+ case 0xFF19:
+ ch -= 0xFE20;
+ break;
+ case 0xFF1A: ch = 0x7A; break;
+ case 0xFF1B: ch = 0x5E; break;
+ case 0xFF1C: ch = 0x4C; break;
+ case 0xFF1D: ch = 0x7E; break;
+ case 0xFF1E: ch = 0x6E; break;
+ case 0xFF1F: ch = 0x6F; break;
+ case 0xFF20: ch = 0x7C; break;
+ case 0xFF21:
+ case 0xFF22:
+ case 0xFF23:
+ case 0xFF24:
+ case 0xFF25:
+ case 0xFF26:
+ case 0xFF27:
+ case 0xFF28:
+ case 0xFF29:
+ ch -= 0xFE60;
+ break;
+ case 0xFF2A:
+ case 0xFF2B:
+ case 0xFF2C:
+ case 0xFF2D:
+ case 0xFF2E:
+ case 0xFF2F:
+ case 0xFF30:
+ case 0xFF31:
+ case 0xFF32:
+ ch -= 0xFE59;
+ break;
+ case 0xFF33:
+ case 0xFF34:
+ case 0xFF35:
+ case 0xFF36:
+ case 0xFF37:
+ case 0xFF38:
+ case 0xFF39:
+ case 0xFF3A:
+ ch -= 0xFE51;
+ break;
+ case 0xFF3B: ch = 0x4A; break;
+ case 0xFF3C: ch = 0xE0; break;
+ case 0xFF3D: ch = 0x5A; break;
+ case 0xFF3E: ch = 0x5F; break;
+ case 0xFF3F: ch = 0x6D; break;
+ case 0xFF40: ch = 0x79; break;
+ case 0xFF41:
+ case 0xFF42:
+ case 0xFF43:
+ case 0xFF44:
+ case 0xFF45:
+ case 0xFF46:
+ case 0xFF47:
+ case 0xFF48:
+ case 0xFF49:
+ ch -= 0xFEC0;
+ break;
+ case 0xFF4A:
+ case 0xFF4B:
+ case 0xFF4C:
+ case 0xFF4D:
+ case 0xFF4E:
+ case 0xFF4F:
+ case 0xFF50:
+ case 0xFF51:
+ case 0xFF52:
+ ch -= 0xFEB9;
+ break;
+ case 0xFF53:
+ case 0xFF54:
+ case 0xFF55:
+ case 0xFF56:
+ case 0xFF57:
+ case 0xFF58:
+ case 0xFF59:
+ case 0xFF5A:
+ ch -= 0xFEB1;
+ break;
+ case 0xFF5B: ch = 0xC0; break;
+ case 0xFF5C: ch = 0x6A; break;
+ case 0xFF5D: ch = 0xD0; break;
+ case 0xFF5E: ch = 0xA1; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP875
+
+public class ENCibm875 : CP875
+{
+ public ENCibm875() : base() {}
+
+}; // class ENCibm875
+
+}; // namespace I18N.Rare
diff --git a/mcs/class/I18N/Rare/ibm-1025.ucm b/mcs/class/I18N/Rare/ibm-1025.ucm
new file mode 100644
index 00000000000..8119517f647
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1025.ucm
@@ -0,0 +1,371 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created by rptp2ucm (compiled on Feb 23 2001)
+# from source files 34B00401.RPMAP100 and 040134B0.TPMAP100
+#
+<code_set_name> "ibm-1025_P100-2000"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+<icu:charsetFamily> "EBCDIC"
+<icu:alias> "ibm-1025_STD"
+
+CHARMAP
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x6A |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A7> \xE1 |0
+<U00AD> \x73 |0
+<U0401> \x63 |0
+<U0402> \x59 |0
+<U0403> \x62 |0
+<U0404> \x64 |0
+<U0405> \x65 |0
+<U0406> \x66 |0
+<U0407> \x67 |0
+<U0408> \x68 |0
+<U0409> \x69 |0
+<U040A> \x70 |0
+<U040B> \x71 |0
+<U040C> \x72 |0
+<U040E> \x74 |0
+<U040F> \x75 |0
+<U0410> \xB9 |0
+<U0411> \xBA |0
+<U0412> \xED |0
+<U0413> \xBF |0
+<U0414> \xBC |0
+<U0415> \xBD |0
+<U0416> \xEC |0
+<U0417> \xFA |0
+<U0418> \xCB |0
+<U0419> \xCC |0
+<U041A> \xCD |0
+<U041B> \xCE |0
+<U041C> \xCF |0
+<U041D> \xDA |0
+<U041E> \xDB |0
+<U041F> \xDC |0
+<U0420> \xDE |0
+<U0421> \xDF |0
+<U0422> \xEA |0
+<U0423> \xEB |0
+<U0424> \xBE |0
+<U0425> \xCA |0
+<U0426> \xBB |0
+<U0427> \xFE |0
+<U0428> \xFB |0
+<U0429> \xFD |0
+<U042A> \x57 |0
+<U042B> \xEF |0
+<U042C> \xEE |0
+<U042D> \xFC |0
+<U042E> \xB8 |0
+<U042F> \xDD |0
+<U0430> \x77 |0
+<U0431> \x78 |0
+<U0432> \xAF |0
+<U0433> \x8D |0
+<U0434> \x8A |0
+<U0435> \x8B |0
+<U0436> \xAE |0
+<U0437> \xB2 |0
+<U0438> \x8F |0
+<U0439> \x90 |0
+<U043A> \x9A |0
+<U043B> \x9B |0
+<U043C> \x9C |0
+<U043D> \x9D |0
+<U043E> \x9E |0
+<U043F> \x9F |0
+<U0440> \xAA |0
+<U0441> \xAB |0
+<U0442> \xAC |0
+<U0443> \xAD |0
+<U0444> \x8C |0
+<U0445> \x8E |0
+<U0446> \x80 |0
+<U0447> \xB6 |0
+<U0448> \xB3 |0
+<U0449> \xB5 |0
+<U044A> \xB7 |0
+<U044B> \xB1 |0
+<U044C> \xB0 |0
+<U044D> \xB4 |0
+<U044E> \x76 |0
+<U044F> \xA0 |0
+<U0451> \x44 |0
+<U0452> \x42 |0
+<U0453> \x43 |0
+<U0454> \x45 |0
+<U0455> \x46 |0
+<U0456> \x47 |0
+<U0457> \x48 |0
+<U0458> \x49 |0
+<U0459> \x51 |0
+<U045A> \x52 |0
+<U045B> \x53 |0
+<U045C> \x54 |0
+<U045E> \x55 |0
+<U045F> \x56 |0
+<U2116> \x58 |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x6A |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1026.ucm b/mcs/class/I18N/Rare/ibm-1026.ucm
new file mode 100644
index 00000000000..d496f0b09c7
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1026.ucm
@@ -0,0 +1,372 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created by rptp2ucm (compiled on Feb 23 2001)
+# from source files 34B00402.RPMAP100 and 040234B0.TPMAP100
+#
+<code_set_name> "ibm-1026_P100-2000"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+<icu:charsetFamily> "EBCDIC"
+<icu:alias> "ibm-1026_STD"
+
+CHARMAP
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \xFC |0
+<U0023> \xEC |0
+<U0024> \xAD |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xAE |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x68 |0
+<U005C> \xDC |0
+<U005D> \xAC |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x8D |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x48 |0
+<U007C> \xBB |0
+<U007D> \x8C |0
+<U007E> \xCC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x8E |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x4A |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \x7B |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \x7F |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \xC0 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xA1 |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xE0 |0
+<U00FF> \xDF |0
+<U011E> \x5A |0
+<U011F> \xD0 |0
+<U0130> \x5B |0
+<U0131> \x79 |0
+<U015E> \x7C |0
+<U015F> \x6A |0
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \xFC |1
+<UFF03> \xEC |1
+<UFF04> \xAD |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xAE |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x68 |1
+<UFF3C> \xDC |1
+<UFF3D> \xAC |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x8D |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x48 |1
+<UFF5C> \xBB |1
+<UFF5D> \x8C |1
+<UFF5E> \xCC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1047.ucm b/mcs/class/I18N/Rare/ibm-1047.ucm
new file mode 100644
index 00000000000..6a71dff1f8d
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1047.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:47 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00417.RPMAP100 and 041734B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1047"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1047
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xAD |0
+<U005C> \xE0 |0
+<U005D> \xBD |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \x4A |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBB |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xB0 |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xBA |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xAD |1
+<UFF3C> \xE0 |1
+<UFF3D> \xBD |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1089.ucm b/mcs/class/I18N/Rare/ibm-1089.ucm
new file mode 100644
index 00000000000..3356cdfa543
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1089.ucm
@@ -0,0 +1,477 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:47 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00441.RPMAP100 and 044134B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1089"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1089
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A4> \xA4 |0
+<U00AD> \xAD |0
+<U060C> \xAC |0
+<U061B> \xBB |0
+<U061F> \xBF |0
+<U0621> \xC1 |0
+<U0622> \xC2 |0
+<U0623> \xC3 |0
+<U0624> \xC4 |0
+<U0625> \xC5 |0
+<U0626> \xC6 |0
+<U0627> \xC7 |0
+<U0628> \xC8 |0
+<U0629> \xC9 |0
+<U062A> \xCA |0
+<U062B> \xCB |0
+<U062C> \xCC |0
+<U062D> \xCD |0
+<U062E> \xCE |0
+<U062F> \xCF |0
+<U0630> \xD0 |0
+<U0631> \xD1 |0
+<U0632> \xD2 |0
+<U0633> \xD3 |0
+<U0634> \xD4 |0
+<U0635> \xD5 |0
+<U0636> \xD6 |0
+<U0637> \xD7 |0
+<U0638> \xD8 |0
+<U0639> \xD9 |0
+<U063A> \xDA |0
+<U0640> \xE0 |0
+<U0641> \xE1 |0
+<U0642> \xE2 |0
+<U0643> \xE3 |0
+<U0644> \xE4 |0
+<U0645> \xE5 |0
+<U0646> \xE6 |0
+<U0647> \xE7 |0
+<U0648> \xE8 |0
+<U0649> \xE9 |0
+<U064A> \xEA |0
+<U064B> \xEB |0
+<U064C> \xEC |0
+<U064D> \xED |0
+<U064E> \xEE |0
+<U064F> \xEF |0
+<U0650> \xF0 |0
+<U0651> \xF1 |0
+<U0652> \xF2 |0
+<U0660> \x30 |1
+<U0661> \x31 |1
+<U0662> \x32 |1
+<U0663> \x33 |1
+<U0664> \x34 |1
+<U0665> \x35 |1
+<U0666> \x36 |1
+<U0667> \x37 |1
+<U0668> \x38 |1
+<U0669> \x39 |1
+<U066A> \x25 |1
+<U066B> \x2C |1
+<U066C> \x2E |1
+<U066D> \x2A |1
+<UFE70> \xEB |1
+<UFE71> \xEB |1
+<UFE72> \xEC |1
+<UFE74> \xED |1
+<UFE76> \xEE |1
+<UFE77> \xEE |1
+<UFE78> \xEF |1
+<UFE79> \xEF |1
+<UFE7A> \xF0 |1
+<UFE7B> \xF0 |1
+<UFE7C> \xF1 |1
+<UFE7D> \xF1 |1
+<UFE7E> \xF2 |1
+<UFE7F> \xF2 |1
+<UFE80> \xC1 |1
+<UFE81> \xC2 |1
+<UFE82> \xC2 |1
+<UFE83> \xC3 |1
+<UFE84> \xC3 |1
+<UFE85> \xC4 |1
+<UFE86> \xC4 |1
+<UFE87> \xC5 |1
+<UFE88> \xC5 |1
+<UFE89> \xC6 |1
+<UFE8A> \xC6 |1
+<UFE8B> \xC6 |1
+<UFE8C> \xC6 |1
+<UFE8D> \xC7 |1
+<UFE8E> \xC7 |1
+<UFE8F> \xC8 |1
+<UFE90> \xC8 |1
+<UFE91> \xC8 |1
+<UFE92> \xC8 |1
+<UFE93> \xC9 |1
+<UFE94> \xC9 |1
+<UFE95> \xCA |1
+<UFE96> \xCA |1
+<UFE97> \xCA |1
+<UFE98> \xCA |1
+<UFE99> \xCB |1
+<UFE9A> \xCB |1
+<UFE9B> \xCB |1
+<UFE9C> \xCB |1
+<UFE9D> \xCC |1
+<UFE9E> \xCC |1
+<UFE9F> \xCC |1
+<UFEA0> \xCC |1
+<UFEA1> \xCD |1
+<UFEA2> \xCD |1
+<UFEA3> \xCD |1
+<UFEA4> \xCD |1
+<UFEA5> \xCE |1
+<UFEA6> \xCE |1
+<UFEA7> \xCE |1
+<UFEA8> \xCE |1
+<UFEA9> \xCF |1
+<UFEAA> \xCF |1
+<UFEAB> \xD0 |1
+<UFEAC> \xD0 |1
+<UFEAD> \xD1 |1
+<UFEAE> \xD1 |1
+<UFEAF> \xD2 |1
+<UFEB0> \xD2 |1
+<UFEB1> \xD3 |1
+<UFEB2> \xD3 |1
+<UFEB3> \xD3 |1
+<UFEB4> \xD3 |1
+<UFEB5> \xD4 |1
+<UFEB6> \xD4 |1
+<UFEB7> \xD4 |1
+<UFEB8> \xD4 |1
+<UFEB9> \xD5 |1
+<UFEBA> \xD5 |1
+<UFEBB> \xD5 |1
+<UFEBC> \xD5 |1
+<UFEBD> \xD6 |1
+<UFEBE> \xD6 |1
+<UFEBF> \xD6 |1
+<UFEC0> \xD6 |1
+<UFEC1> \xD7 |1
+<UFEC2> \xD7 |1
+<UFEC3> \xD7 |1
+<UFEC4> \xD7 |1
+<UFEC5> \xD8 |1
+<UFEC6> \xD8 |1
+<UFEC7> \xD8 |1
+<UFEC8> \xD8 |1
+<UFEC9> \xD9 |1
+<UFECA> \xD9 |1
+<UFECB> \xD9 |1
+<UFECC> \xD9 |1
+<UFECD> \xDA |1
+<UFECE> \xDA |1
+<UFECF> \xDA |1
+<UFED0> \xDA |1
+<UFED1> \xE1 |1
+<UFED2> \xE1 |1
+<UFED3> \xE1 |1
+<UFED4> \xE1 |1
+<UFED5> \xE2 |1
+<UFED6> \xE2 |1
+<UFED7> \xE2 |1
+<UFED8> \xE2 |1
+<UFED9> \xE3 |1
+<UFEDA> \xE3 |1
+<UFEDB> \xE3 |1
+<UFEDC> \xE3 |1
+<UFEDD> \xE4 |1
+<UFEDE> \xE4 |1
+<UFEDF> \xE4 |1
+<UFEE0> \xE4 |1
+<UFEE1> \xE5 |1
+<UFEE2> \xE5 |1
+<UFEE3> \xE5 |1
+<UFEE4> \xE5 |1
+<UFEE5> \xE6 |1
+<UFEE6> \xE6 |1
+<UFEE7> \xE6 |1
+<UFEE8> \xE6 |1
+<UFEE9> \xE7 |1
+<UFEEA> \xE7 |1
+<UFEEB> \xE7 |1
+<UFEEC> \xE7 |1
+<UFEED> \xE8 |1
+<UFEEE> \xE8 |1
+<UFEEF> \xE9 |1
+<UFEF0> \xE9 |1
+<UFEF1> \xEA |1
+<UFEF2> \xEA |1
+<UFEF3> \xEA |1
+<UFEF4> \xEA |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1140.ucm b/mcs/class/I18N/Rare/ibm-1140.ucm
new file mode 100644
index 00000000000..973f69dced4
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1140.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:47 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B00474.RPMAP100 and 047444B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1140"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1140
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xBA |0
+<U005C> \xE0 |0
+<U005D> \xBB |0
+<U005E> \xB0 |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \x4A |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xBA |1
+<UFF3C> \xE0 |1
+<UFF3D> \xBB |1
+<UFF3E> \xB0 |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1141.ucm b/mcs/class/I18N/Rare/ibm-1141.ucm
new file mode 100644
index 00000000000..9672405a6cc
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1141.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:47 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B00475.RPMAP100 and 047544B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1141"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1141
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xB5 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x63 |0
+<U005C> \xEC |0
+<U005D> \xFC |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x43 |0
+<U007C> \xBB |0
+<U007D> \xDC |0
+<U007E> \x59 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \xCC |0
+<U00A7> \x7C |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x4A |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xE0 |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \x5A |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \xA1 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \xC0 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \x6A |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xD0 |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xB5 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x63 |1
+<UFF3C> \xEC |1
+<UFF3D> \xFC |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x43 |1
+<UFF5C> \xBB |1
+<UFF5D> \xDC |1
+<UFF5E> \x59 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1142.ucm b/mcs/class/I18N/Rare/ibm-1142.ucm
new file mode 100644
index 00000000000..577090426d8
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1142.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B00476.RPMAP100 and 047644B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1142"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1142
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x4A |0
+<U0024> \x67 |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x80 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x9E |0
+<U005C> \xE0 |0
+<U005D> \x9F |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x9C |0
+<U007C> \xBB |0
+<U007D> \x47 |0
+<U007E> \xDC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \x70 |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x5B |0
+<U00C6> \x7B |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x7C |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \xD0 |0
+<U00E6> \xC0 |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x6A |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xA1 |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x5A |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x4A |1
+<UFF04> \x67 |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x80 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x9E |1
+<UFF3C> \xE0 |1
+<UFF3D> \x9F |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x9C |1
+<UFF5C> \xBB |1
+<UFF5D> \x47 |1
+<UFF5E> \xDC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1143.ucm b/mcs/class/I18N/Rare/ibm-1143.ucm
new file mode 100644
index 00000000000..8df99644ba2
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1143.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B00477.RPMAP100 and 047744B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1143"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1143
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x63 |0
+<U0024> \x67 |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xEC |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xB5 |0
+<U005C> \x71 |0
+<U005D> \x9F |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x51 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x43 |0
+<U007C> \xBB |0
+<U007D> \x47 |0
+<U007E> \xDC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \xCC |0
+<U00A7> \x4A |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x7B |0
+<U00C5> \x5B |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \xE0 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \x7C |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \xC0 |0
+<U00E5> \xD0 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x79 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \x6A |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xA1 |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x5A |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x63 |1
+<UFF04> \x67 |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xEC |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xB5 |1
+<UFF3C> \x71 |1
+<UFF3D> \x9F |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x51 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x43 |1
+<UFF5C> \xBB |1
+<UFF5D> \x47 |1
+<UFF5E> \xDC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1144.ucm b/mcs/class/I18N/Rare/ibm-1144.ucm
new file mode 100644
index 00000000000..4660f61c8c4
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1144.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B00478.RPMAP100 and 047844B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1144"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1144
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \xB1 |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xB5 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x90 |0
+<U005C> \x48 |0
+<U005D> \x51 |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \xDD |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x44 |0
+<U007C> \xBB |0
+<U007D> \x54 |0
+<U007E> \x58 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \x7B |0
+<U00A5> \xB2 |0
+<U00A6> \xCD |0
+<U00A7> \x7C |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x4A |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \xC0 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \xE0 |0
+<U00E8> \xD0 |0
+<U00E9> \x5A |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \xA1 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \x6A |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \x79 |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \xB1 |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xB5 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x90 |1
+<UFF3C> \x48 |1
+<UFF3D> \x51 |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \xDD |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x44 |1
+<UFF5C> \xBB |1
+<UFF5D> \x54 |1
+<UFF5E> \x58 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1145.ucm b/mcs/class/I18N/Rare/ibm-1145.ucm
new file mode 100644
index 00000000000..7f60efe219b
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1145.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B00479.RPMAP100 and 047944B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1145"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1145
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \xBB |0
+<U0022> \x7F |0
+<U0023> \x69 |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \xBA |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xBD |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \x49 |0
+<U00A7> \xB5 |0
+<U00A8> \xA1 |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x7B |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x6A |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \xBB |1
+<UFF02> \x7F |1
+<UFF03> \x69 |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \xBA |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xBD |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1146.ucm b/mcs/class/I18N/Rare/ibm-1146.ucm
new file mode 100644
index 00000000000..5129f581810
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1146.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0047A.RPMAP100 and 047A44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1146"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1146
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x4A |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xB1 |0
+<U005C> \xE0 |0
+<U005D> \xBB |0
+<U005E> \xBA |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xBC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \x5B |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xA1 |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xA1 |1
+<U20AC> \x9F |0
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x4A |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xB1 |1
+<UFF3C> \xE0 |1
+<UFF3D> \xBB |1
+<UFF3E> \xBA |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xBC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1147.ucm b/mcs/class/I18N/Rare/ibm-1147.ucm
new file mode 100644
index 00000000000..f4d62bcb64d
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1147.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0047B.RPMAP100 and 047B44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1147"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1147
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \xB1 |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x44 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x90 |0
+<U005C> \x48 |0
+<U005D> \xB5 |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \xA0 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x51 |0
+<U007C> \xBB |0
+<U007D> \x54 |0
+<U007E> \xBD |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \x7B |0
+<U00A5> \xB2 |0
+<U00A6> \xDD |0
+<U00A7> \x5A |0
+<U00A8> \xA1 |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x4A |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \x79 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x7C |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \xE0 |0
+<U00E8> \xD0 |0
+<U00E9> \xC0 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \x6A |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \xB1 |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x44 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x90 |1
+<UFF3C> \x48 |1
+<UFF3D> \xB5 |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \xA0 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x51 |1
+<UFF5C> \xBB |1
+<UFF5D> \x54 |1
+<UFF5E> \xBD |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1148.ucm b/mcs/class/I18N/Rare/ibm-1148.ucm
new file mode 100644
index 00000000000..1fe5a681571
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1148.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0047C.RPMAP100 and 047C44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1148"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1148
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \xBB |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \xBB |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-1149.ucm b/mcs/class/I18N/Rare/ibm-1149.ucm
new file mode 100644
index 00000000000..e97050d2bcb
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-1149.ucm
@@ -0,0 +1,378 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Fri Nov 10 13:07:48 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0047D.RPMAP100 and 047D44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1149"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1149
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xAC |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xAE |0
+<U005C> \xBE |0
+<U005D> \x9E |0
+<U005E> \xEC |0
+<U005F> \x6D |0
+<U0060> \x8C |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x8E |0
+<U007C> \xBB |0
+<U007D> \x9C |0
+<U007E> \xCC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xE0 |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x5A |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \x7C |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \x5F |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \x4A |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \xD0 |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x79 |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xA1 |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \xC0 |0
+<U00FF> \xDF |0
+<U203E> \xBC |1
+<U20AC> \x9F |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xAC |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xAE |1
+<UFF3C> \xBE |1
+<UFF3D> \x9E |1
+<UFF3E> \xEC |1
+<UFF3F> \x6D |1
+<UFF40> \x8C |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x8E |1
+<UFF5C> \xBB |1
+<UFF5D> \x9C |1
+<UFF5E> \xCC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-273.ucm b/mcs/class/I18N/Rare/ibm-273.ucm
new file mode 100644
index 00000000000..b986677d373
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-273.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00111.RPMAP100 and 011134B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-273"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-273
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xB5 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x63 |0
+<U005C> \xEC |0
+<U005D> \xFC |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x43 |0
+<U007C> \xBB |0
+<U007D> \xDC |0
+<U007E> \x59 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \xCC |0
+<U00A7> \x7C |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x4A |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xE0 |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \x5A |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \xA1 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \xC0 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \x6A |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xD0 |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xB5 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x63 |1
+<UFF3C> \xEC |1
+<UFF3D> \xFC |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x43 |1
+<UFF5C> \xBB |1
+<UFF5D> \xDC |1
+<UFF5E> \x59 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-277.ucm b/mcs/class/I18N/Rare/ibm-277.ucm
new file mode 100644
index 00000000000..7ed1d844af2
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-277.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00115.RPMAP100 and 011534B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-277"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-277
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x4A |0
+<U0024> \x67 |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x80 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x9E |0
+<U005C> \xE0 |0
+<U005D> \x9F |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x9C |0
+<U007C> \xBB |0
+<U007D> \x47 |0
+<U007E> \xDC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x5A |0
+<U00A5> \xB2 |0
+<U00A6> \x70 |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x5B |0
+<U00C6> \x7B |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x7C |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \xD0 |0
+<U00E6> \xC0 |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x6A |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xA1 |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x4A |1
+<UFF04> \x67 |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x80 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x9E |1
+<UFF3C> \xE0 |1
+<UFF3D> \x9F |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x9C |1
+<UFF5C> \xBB |1
+<UFF5D> \x47 |1
+<UFF5E> \xDC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-278.ucm b/mcs/class/I18N/Rare/ibm-278.ucm
new file mode 100644
index 00000000000..068f0a3f2f0
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-278.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00116.RPMAP100 and 011634B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-278"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-278
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x63 |0
+<U0024> \x67 |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xEC |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xB5 |0
+<U005C> \x71 |0
+<U005D> \x9F |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x51 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x43 |0
+<U007C> \xBB |0
+<U007D> \x47 |0
+<U007E> \xDC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x5A |0
+<U00A5> \xB2 |0
+<U00A6> \xCC |0
+<U00A7> \x4A |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x7B |0
+<U00C5> \x5B |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \xE0 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \x7C |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \xC0 |0
+<U00E5> \xD0 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x79 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \x6A |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xA1 |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x63 |1
+<UFF04> \x67 |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xEC |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xB5 |1
+<UFF3C> \x71 |1
+<UFF3D> \x9F |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x51 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x43 |1
+<UFF5C> \xBB |1
+<UFF5D> \x47 |1
+<UFF5E> \xDC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-280.ucm b/mcs/class/I18N/Rare/ibm-280.ucm
new file mode 100644
index 00000000000..e050f2a558c
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-280.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00118.RPMAP100 and 011834B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-280"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-280
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \xB1 |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xB5 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x90 |0
+<U005C> \x48 |0
+<U005D> \x51 |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \xDD |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x44 |0
+<U007C> \xBB |0
+<U007D> \x54 |0
+<U007E> \x58 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \x7B |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \xCD |0
+<U00A7> \x7C |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x4A |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \xC0 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \xE0 |0
+<U00E8> \xD0 |0
+<U00E9> \x5A |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \xA1 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \x6A |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \x79 |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \xB1 |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xB5 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x90 |1
+<UFF3C> \x48 |1
+<UFF3D> \x51 |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \xDD |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x44 |1
+<UFF5C> \xBB |1
+<UFF5D> \x54 |1
+<UFF5E> \x58 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-284.ucm b/mcs/class/I18N/Rare/ibm-284.ucm
new file mode 100644
index 00000000000..8dcc9642409
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-284.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0011C.RPMAP100 and 011C34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-284"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-284
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \xBB |0
+<U0022> \x7F |0
+<U0023> \x69 |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \xBA |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xBD |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x49 |0
+<U00A7> \xB5 |0
+<U00A8> \xA1 |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x7B |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x6A |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \xBB |1
+<UFF02> \x7F |1
+<UFF03> \x69 |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \xBA |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xBD |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-285.ucm b/mcs/class/I18N/Rare/ibm-285.ucm
new file mode 100644
index 00000000000..bb74537766e
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-285.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0011D.RPMAP100 and 011D34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-285"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-285
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x4A |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xB1 |0
+<U005C> \xE0 |0
+<U005D> \xBB |0
+<U005E> \xBA |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xBC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \x5B |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xA1 |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xA1 |1
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x4A |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xB1 |1
+<UFF3C> \xE0 |1
+<UFF3D> \xBB |1
+<UFF3E> \xBA |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xBC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-290.ucm b/mcs/class/I18N/Rare/ibm-290.ucm
new file mode 100644
index 00000000000..eb661591191
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-290.ucm
@@ -0,0 +1,349 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00122.RPMAP100 and 012234B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-290"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-290
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \xE0 |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x70 |0
+<U005C> \xB2 |0
+<U005D> \x80 |0
+<U005E> \xB0 |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x62 |0
+<U0062> \x63 |0
+<U0063> \x64 |0
+<U0064> \x65 |0
+<U0065> \x66 |0
+<U0066> \x67 |0
+<U0067> \x68 |0
+<U0068> \x69 |0
+<U0069> \x71 |0
+<U006A> \x72 |0
+<U006B> \x73 |0
+<U006C> \x74 |0
+<U006D> \x75 |0
+<U006E> \x76 |0
+<U006F> \x77 |0
+<U0070> \x78 |0
+<U0071> \x8B |0
+<U0072> \x9B |0
+<U0073> \xAB |0
+<U0074> \xB3 |0
+<U0075> \xB4 |0
+<U0076> \xB5 |0
+<U0077> \xB6 |0
+<U0078> \xB7 |0
+<U0079> \xB8 |0
+<U007A> \xB9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xA0 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A2> \xB1 |0
+<U00A3> \x4A |0
+<U00A5> \x5B |0
+<U00AC> \x5F |0
+<U203E> \xA1 |0
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \xE0 |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x70 |1
+<UFF3C> \xB2 |1
+<UFF3D> \x80 |1
+<UFF3E> \xB0 |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x62 |1
+<UFF42> \x63 |1
+<UFF43> \x64 |1
+<UFF44> \x65 |1
+<UFF45> \x66 |1
+<UFF46> \x67 |1
+<UFF47> \x68 |1
+<UFF48> \x69 |1
+<UFF49> \x71 |1
+<UFF4A> \x72 |1
+<UFF4B> \x73 |1
+<UFF4C> \x74 |1
+<UFF4D> \x75 |1
+<UFF4E> \x76 |1
+<UFF4F> \x77 |1
+<UFF50> \x78 |1
+<UFF51> \x8B |1
+<UFF52> \x9B |1
+<UFF53> \xAB |1
+<UFF54> \xB3 |1
+<UFF55> \xB4 |1
+<UFF56> \xB5 |1
+<UFF57> \xB6 |1
+<UFF58> \xB7 |1
+<UFF59> \xB8 |1
+<UFF5A> \xB9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA0 |1
+<UFF61> \x41 |0
+<UFF62> \x42 |0
+<UFF63> \x43 |0
+<UFF64> \x44 |0
+<UFF65> \x45 |0
+<UFF66> \x46 |0
+<UFF67> \x47 |0
+<UFF68> \x48 |0
+<UFF69> \x49 |0
+<UFF6A> \x51 |0
+<UFF6B> \x52 |0
+<UFF6C> \x53 |0
+<UFF6D> \x54 |0
+<UFF6E> \x55 |0
+<UFF6F> \x56 |0
+<UFF70> \x58 |0
+<UFF71> \x81 |0
+<UFF72> \x82 |0
+<UFF73> \x83 |0
+<UFF74> \x84 |0
+<UFF75> \x85 |0
+<UFF76> \x86 |0
+<UFF77> \x87 |0
+<UFF78> \x88 |0
+<UFF79> \x89 |0
+<UFF7A> \x8A |0
+<UFF7B> \x8C |0
+<UFF7C> \x8D |0
+<UFF7D> \x8E |0
+<UFF7E> \x8F |0
+<UFF7F> \x90 |0
+<UFF80> \x91 |0
+<UFF81> \x92 |0
+<UFF82> \x93 |0
+<UFF83> \x94 |0
+<UFF84> \x95 |0
+<UFF85> \x96 |0
+<UFF86> \x97 |0
+<UFF87> \x98 |0
+<UFF88> \x99 |0
+<UFF89> \x9A |0
+<UFF8A> \x9D |0
+<UFF8B> \x9E |0
+<UFF8C> \x9F |0
+<UFF8D> \xA2 |0
+<UFF8E> \xA3 |0
+<UFF8F> \xA4 |0
+<UFF90> \xA5 |0
+<UFF91> \xA6 |0
+<UFF92> \xA7 |0
+<UFF93> \xA8 |0
+<UFF94> \xA9 |0
+<UFF95> \xAA |0
+<UFF96> \xAC |0
+<UFF97> \xAD |0
+<UFF98> \xAE |0
+<UFF99> \xAF |0
+<UFF9A> \xBA |0
+<UFF9B> \xBB |0
+<UFF9C> \xBC |0
+<UFF9D> \xBD |0
+<UFF9E> \xBE |0
+<UFF9F> \xBF |0
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-297.ucm b/mcs/class/I18N/Rare/ibm-297.ucm
new file mode 100644
index 00000000000..f627d5ce517
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-297.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00129.RPMAP100 and 012934B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-297"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-297
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \xB1 |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x44 |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x90 |0
+<U005C> \x48 |0
+<U005D> \xB5 |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \xA0 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x51 |0
+<U007C> \xBB |0
+<U007D> \x54 |0
+<U007E> \xBD |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \x7B |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \xDD |0
+<U00A7> \x5A |0
+<U00A8> \xA1 |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x4A |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \x79 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x7C |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \xE0 |0
+<U00E8> \xD0 |0
+<U00E9> \xC0 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \x6A |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \xB1 |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x44 |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x90 |1
+<UFF3C> \x48 |1
+<UFF3D> \xB5 |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \xA0 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x51 |1
+<UFF5C> \xBB |1
+<UFF5D> \x54 |1
+<UFF5E> \xBD |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-37.ucm b/mcs/class/I18N/Rare/ibm-37.ucm
new file mode 100644
index 00000000000..070f03e81f3
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-37.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:41 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00025.RPMAP100 and 002534B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-37"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-37
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xBA |0
+<U005C> \xE0 |0
+<U005D> \xBB |0
+<U005E> \xB0 |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \x4A |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xBA |1
+<UFF3C> \xE0 |1
+<UFF3D> \xBB |1
+<UFF3E> \xB0 |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-420.ucm b/mcs/class/I18N/Rare/ibm-420.ucm
new file mode 100644
index 00000000000..33b947902ba
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-420.ucm
@@ -0,0 +1,453 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Thu Nov 9 17:44:49 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B001A4.RXMAP110 and 01A434B0.TXMAP110
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-420"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-420
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005F> \x6D |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007C> \x4F |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A2> \x4A |0
+<U00A6> \x6A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00D7> \xE0 |0
+<U00F7> \xA1 |0
+<U060C> \x79 |0
+<U061B> \xC0 |0
+<U061F> \xD0 |0
+<U0621> \x46 |0
+<U0622> \x47 |0
+<U0623> \x49 |0
+<U0624> \x52 |0
+<U0625> \x56 |1
+<U0626> \x55 |0
+<U0627> \x56 |0
+<U0628> \x58 |0
+<U0629> \x62 |0
+<U062A> \x63 |0
+<U062B> \x65 |0
+<U062C> \x67 |0
+<U062D> \x69 |0
+<U062E> \x71 |0
+<U062F> \x73 |0
+<U0630> \x74 |0
+<U0631> \x75 |0
+<U0632> \x76 |0
+<U0633> \x77 |0
+<U0634> \x80 |0
+<U0635> \x8B |0
+<U0636> \x8D |0
+<U0637> \x8F |0
+<U0638> \x90 |0
+<U0639> \x9A |0
+<U063A> \x9E |0
+<U0640> \x44 |0
+<U0641> \xAB |0
+<U0642> \xAD |0
+<U0643> \xAF |0
+<U0644> \xB1 |0
+<U0645> \xBB |0
+<U0646> \xBD |0
+<U0647> \xBF |0
+<U0648> \xCF |0
+<U0649> \xDA |0
+<U064A> \xDC |0
+<U0651> \x42 |0
+<U0660> \xDF |0
+<U0661> \xEA |0
+<U0662> \xEB |0
+<U0663> \xED |0
+<U0664> \xEE |0
+<U0665> \xEF |0
+<U0666> \xFB |0
+<U0667> \xFC |0
+<U0668> \xFD |0
+<U0669> \xFE |0
+<U066A> \x6C |1
+<U066B> \x6B |1
+<U066C> \x4B |1
+<U066D> \x5C |1
+<U200B> \x45 |0
+<UFE7C> \x42 |1
+<UFE7D> \x43 |0
+<UFE80> \x46 |1
+<UFE81> \x47 |1
+<UFE82> \x48 |0
+<UFE83> \x49 |1
+<UFE84> \x51 |0
+<UFE85> \x52 |1
+<UFE86> \x52 |1
+<UFE87> \x56 |1
+<UFE88> \x57 |1
+<UFE8B> \x55 |1
+<UFE8C> \x55 |1
+<UFE8D> \x56 |1
+<UFE8E> \x57 |0
+<UFE8F> \x58 |1
+<UFE90> \x58 |1
+<UFE91> \x59 |0
+<UFE92> \x59 |1
+<UFE93> \x62 |1
+<UFE94> \x62 |1
+<UFE95> \x63 |1
+<UFE96> \x63 |1
+<UFE97> \x64 |0
+<UFE98> \x64 |1
+<UFE99> \x65 |1
+<UFE9A> \x65 |1
+<UFE9B> \x66 |0
+<UFE9C> \x66 |1
+<UFE9D> \x67 |1
+<UFE9E> \x67 |1
+<UFE9F> \x68 |0
+<UFEA0> \x68 |1
+<UFEA1> \x69 |1
+<UFEA2> \x69 |1
+<UFEA3> \x70 |0
+<UFEA4> \x70 |1
+<UFEA5> \x71 |1
+<UFEA6> \x71 |1
+<UFEA7> \x72 |0
+<UFEA8> \x72 |1
+<UFEA9> \x73 |1
+<UFEAA> \x73 |1
+<UFEAB> \x74 |1
+<UFEAC> \x74 |1
+<UFEAD> \x75 |1
+<UFEAE> \x75 |1
+<UFEAF> \x76 |1
+<UFEB0> \x76 |1
+<UFEB1> \x77 |1
+<UFEB2> \x77 |1
+<UFEB3> \x78 |0
+<UFEB4> \x78 |1
+<UFEB5> \x80 |1
+<UFEB6> \x80 |1
+<UFEB7> \x8A |0
+<UFEB8> \x8A |1
+<UFEB9> \x8B |1
+<UFEBA> \x8B |1
+<UFEBB> \x8C |0
+<UFEBC> \x8C |1
+<UFEBD> \x8D |1
+<UFEBE> \x8D |1
+<UFEBF> \x8E |0
+<UFEC0> \x8E |1
+<UFEC1> \x8F |1
+<UFEC2> \x8F |1
+<UFEC3> \x8F |1
+<UFEC4> \x8F |1
+<UFEC5> \x90 |1
+<UFEC6> \x90 |1
+<UFEC7> \x90 |1
+<UFEC8> \x90 |1
+<UFEC9> \x9A |1
+<UFECA> \x9B |0
+<UFECB> \x9C |0
+<UFECC> \x9D |0
+<UFECD> \x9E |1
+<UFECE> \x9F |0
+<UFECF> \xA0 |0
+<UFED0> \xAA |0
+<UFED1> \xAB |1
+<UFED2> \xAB |1
+<UFED3> \xAC |0
+<UFED4> \xAC |1
+<UFED5> \xAD |1
+<UFED6> \xAD |1
+<UFED7> \xAE |0
+<UFED8> \xAE |1
+<UFED9> \xAF |1
+<UFEDA> \xAF |1
+<UFEDB> \xB0 |0
+<UFEDC> \xB0 |1
+<UFEDD> \xB1 |1
+<UFEDE> \xB1 |1
+<UFEDF> \xBA |0
+<UFEE0> \xBA |1
+<UFEE1> \xBB |1
+<UFEE2> \xBB |1
+<UFEE3> \xBC |0
+<UFEE4> \xBC |1
+<UFEE5> \xBD |1
+<UFEE6> \xBD |1
+<UFEE7> \xBE |0
+<UFEE8> \xBE |1
+<UFEE9> \xBF |1
+<UFEEA> \xBF |1
+<UFEEB> \xCB |0
+<UFEEC> \xCD |0
+<UFEED> \xCF |1
+<UFEEE> \xCF |1
+<UFEEF> \xDA |1
+<UFEF0> \xDB |0
+<UFEF1> \xDC |1
+<UFEF2> \xDD |0
+<UFEF3> \xDE |0
+<UFEF4> \xDE |1
+<UFEF5> \xB2 |0
+<UFEF6> \xB3 |0
+<UFEF7> \xB4 |0
+<UFEF8> \xB5 |0
+<UFEF9> \xB8 |1
+<UFEFA> \xB9 |1
+<UFEFB> \xB8 |0
+<UFEFC> \xB9 |0
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3F> \x6D |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5C> \x4F |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-424.ucm b/mcs/class/I18N/Rare/ibm-424.ucm
new file mode 100644
index 00000000000..a024e217070
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-424.ucm
@@ -0,0 +1,339 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:42 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B001A8.RPMAP100 and 01A834B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-424"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-424
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x5A |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xBA |0
+<U005C> \xE0 |0
+<U005D> \xBB |0
+<U005E> \xB0 |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x4F |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x74 |0
+<U00A2> \x4A |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AB> \x8A |0
+<U00AC> \x5F |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00D7> \xBF |0
+<U00F7> \xE1 |0
+<U05D0> \x41 |0
+<U05D1> \x42 |0
+<U05D2> \x43 |0
+<U05D3> \x44 |0
+<U05D4> \x45 |0
+<U05D5> \x46 |0
+<U05D6> \x47 |0
+<U05D7> \x48 |0
+<U05D8> \x49 |0
+<U05D9> \x51 |0
+<U05DA> \x52 |0
+<U05DB> \x53 |0
+<U05DC> \x54 |0
+<U05DD> \x55 |0
+<U05DE> \x56 |0
+<U05DF> \x57 |0
+<U05E0> \x58 |0
+<U05E1> \x59 |0
+<U05E2> \x62 |0
+<U05E3> \x63 |0
+<U05E4> \x64 |0
+<U05E5> \x65 |0
+<U05E6> \x66 |0
+<U05E7> \x67 |0
+<U05E8> \x68 |0
+<U05E9> \x69 |0
+<U05EA> \x71 |0
+<U2017> \x78 |0
+<U2022> \xB3 |0
+<U203E> \xBC |0
+<UFF01> \x5A |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xBA |1
+<UFF3C> \xE0 |1
+<UFF3D> \xBB |1
+<UFF3E> \xB0 |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x4F |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-500.ucm b/mcs/class/I18N/Rare/ibm-500.ucm
new file mode 100644
index 00000000000..ef11ec7c2d9
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-500.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:42 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B001F4.RPMAP100 and 01F434B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-500"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-500
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \xBB |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xBE |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x9E |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \xAC |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \xAE |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \x9C |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x8C |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \x8E |0
+<U00FF> \xDF |0
+<U0110> \xAC |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \xBB |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-852.ucm b/mcs/class/I18N/Rare/ibm-852.ucm
new file mode 100644
index 00000000000..5e45addb083
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-852.ucm
@@ -0,0 +1,415 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:42 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00354.RPMAP100 and 035434B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-852"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-852
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A4> \xCF |0
+<U00A7> \xF5 |0
+<U00A8> \xF9 |0
+<U00AB> \xAE |0
+<U00AD> \xF0 |0
+<U00B0> \xF8 |0
+<U00B4> \xEF |0
+<U00B6> \x14 |1
+<U00B8> \xF7 |0
+<U00BB> \xAF |0
+<U00C1> \xB5 |0
+<U00C2> \xB6 |0
+<U00C4> \x8E |0
+<U00C7> \x80 |0
+<U00C9> \x90 |0
+<U00CB> \xD3 |0
+<U00CD> \xD6 |0
+<U00CE> \xD7 |0
+<U00D0> \xD1 |1
+<U00D3> \xE0 |0
+<U00D4> \xE2 |0
+<U00D6> \x99 |0
+<U00D7> \x9E |0
+<U00DA> \xE9 |0
+<U00DC> \x9A |0
+<U00DD> \xED |0
+<U00DF> \xE1 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E4> \x84 |0
+<U00E7> \x87 |0
+<U00E9> \x82 |0
+<U00EB> \x89 |0
+<U00ED> \xA1 |0
+<U00EE> \x8C |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00FA> \xA3 |0
+<U00FC> \x81 |0
+<U00FD> \xEC |0
+<U0102> \xC6 |0
+<U0103> \xC7 |0
+<U0104> \xA4 |0
+<U0105> \xA5 |0
+<U0106> \x8F |0
+<U0107> \x86 |0
+<U010C> \xAC |0
+<U010D> \x9F |0
+<U010E> \xD2 |0
+<U010F> \xD4 |0
+<U0110> \xD1 |0
+<U0111> \xD0 |0
+<U0118> \xA8 |0
+<U0119> \xA9 |0
+<U011A> \xB7 |0
+<U011B> \xD8 |0
+<U0139> \x91 |0
+<U013A> \x92 |0
+<U013D> \x95 |0
+<U013E> \x96 |0
+<U0141> \x9D |0
+<U0142> \x88 |0
+<U0143> \xE3 |0
+<U0144> \xE4 |0
+<U0147> \xD5 |0
+<U0148> \xE5 |0
+<U0150> \x8A |0
+<U0151> \x8B |0
+<U0154> \xE8 |0
+<U0155> \xEA |0
+<U0158> \xFC |0
+<U0159> \xFD |0
+<U015A> \x97 |0
+<U015B> \x98 |0
+<U015E> \xB8 |0
+<U015F> \xAD |0
+<U0160> \xE6 |0
+<U0161> \xE7 |0
+<U0162> \xDD |0
+<U0163> \xEE |0
+<U0164> \x9B |0
+<U0165> \x9C |0
+<U016E> \xDE |0
+<U016F> \x85 |0
+<U0170> \xEB |0
+<U0171> \xFB |0
+<U0179> \x8D |0
+<U017A> \xAB |0
+<U017B> \xBD |0
+<U017C> \xBE |0
+<U017D> \xA6 |0
+<U017E> \xA7 |0
+<U02C7> \xF3 |0
+<U02D8> \xF4 |0
+<U02D9> \xFA |0
+<U02DB> \xF2 |0
+<U02DD> \xF1 |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2554> \xC9 |0
+<U2557> \xBB |0
+<U255A> \xC8 |0
+<U255D> \xBC |0
+<U2560> \xCC |0
+<U2563> \xB9 |0
+<U2566> \xCB |0
+<U2569> \xCA |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266C> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-855.ucm b/mcs/class/I18N/Rare/ibm-855.ucm
new file mode 100644
index 00000000000..bc80b19fb31
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-855.ucm
@@ -0,0 +1,415 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:42 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00357.RPMAP100 and 035734B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-855"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-855
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A4> \xCF |0
+<U00A7> \xFD |0
+<U00AB> \xAE |0
+<U00AD> \xF0 |0
+<U00B6> \x14 |1
+<U00BB> \xAF |0
+<U0401> \x85 |0
+<U0402> \x81 |0
+<U0403> \x83 |0
+<U0404> \x87 |0
+<U0405> \x89 |0
+<U0406> \x8B |0
+<U0407> \x8D |0
+<U0408> \x8F |0
+<U0409> \x91 |0
+<U040A> \x93 |0
+<U040B> \x95 |0
+<U040C> \x97 |0
+<U040E> \x99 |0
+<U040F> \x9B |0
+<U0410> \xA1 |0
+<U0411> \xA3 |0
+<U0412> \xEC |0
+<U0413> \xAD |0
+<U0414> \xA7 |0
+<U0415> \xA9 |0
+<U0416> \xEA |0
+<U0417> \xF4 |0
+<U0418> \xB8 |0
+<U0419> \xBE |0
+<U041A> \xC7 |0
+<U041B> \xD1 |0
+<U041C> \xD3 |0
+<U041D> \xD5 |0
+<U041E> \xD7 |0
+<U041F> \xDD |0
+<U0420> \xE2 |0
+<U0421> \xE4 |0
+<U0422> \xE6 |0
+<U0423> \xE8 |0
+<U0424> \xAB |0
+<U0425> \xB6 |0
+<U0426> \xA5 |0
+<U0427> \xFC |0
+<U0428> \xF6 |0
+<U0429> \xFA |0
+<U042A> \x9F |0
+<U042B> \xF2 |0
+<U042C> \xEE |0
+<U042D> \xF8 |0
+<U042E> \x9D |0
+<U042F> \xE0 |0
+<U0430> \xA0 |0
+<U0431> \xA2 |0
+<U0432> \xEB |0
+<U0433> \xAC |0
+<U0434> \xA6 |0
+<U0435> \xA8 |0
+<U0436> \xE9 |0
+<U0437> \xF3 |0
+<U0438> \xB7 |0
+<U0439> \xBD |0
+<U043A> \xC6 |0
+<U043B> \xD0 |0
+<U043C> \xD2 |0
+<U043D> \xD4 |0
+<U043E> \xD6 |0
+<U043F> \xD8 |0
+<U0440> \xE1 |0
+<U0441> \xE3 |0
+<U0442> \xE5 |0
+<U0443> \xE7 |0
+<U0444> \xAA |0
+<U0445> \xB5 |0
+<U0446> \xA4 |0
+<U0447> \xFB |0
+<U0448> \xF5 |0
+<U0449> \xF9 |0
+<U044A> \x9E |0
+<U044B> \xF1 |0
+<U044C> \xED |0
+<U044D> \xF7 |0
+<U044E> \x9C |0
+<U044F> \xDE |0
+<U0451> \x84 |0
+<U0452> \x80 |0
+<U0453> \x82 |0
+<U0454> \x86 |0
+<U0455> \x88 |0
+<U0456> \x8A |0
+<U0457> \x8C |0
+<U0458> \x8E |0
+<U0459> \x90 |0
+<U045A> \x92 |0
+<U045B> \x94 |0
+<U045C> \x96 |0
+<U045E> \x98 |0
+<U045F> \x9A |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U2116> \xEF |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2554> \xC9 |0
+<U2557> \xBB |0
+<U255A> \xC8 |0
+<U255D> \xBC |0
+<U2560> \xCC |0
+<U2563> \xB9 |0
+<U2566> \xCB |0
+<U2569> \xCA |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-857.ucm b/mcs/class/I18N/Rare/ibm-857.ucm
new file mode 100644
index 00000000000..9d07db99bc8
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-857.ucm
@@ -0,0 +1,412 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00359.RPMAP100 and 035934B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-857"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-857
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A2> \xBD |0
+<U00A3> \x9C |0
+<U00A4> \xCF |0
+<U00A5> \xBE |0
+<U00A6> \xDD |0
+<U00A7> \xF5 |0
+<U00A8> \xF9 |0
+<U00A9> \xB8 |0
+<U00AA> \xD1 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00AD> \xF0 |0
+<U00AE> \xA9 |0
+<U00AF> \xEE |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B3> \xFC |0
+<U00B4> \xEF |0
+<U00B5> \xE6 |0
+<U00B6> \xF4 |0
+<U00B7> \xFA |0
+<U00B8> \xF7 |0
+<U00B9> \xFB |0
+<U00BA> \xD0 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BE> \xF3 |0
+<U00BF> \xA8 |0
+<U00C0> \xB7 |0
+<U00C1> \xB5 |0
+<U00C2> \xB6 |0
+<U00C3> \xC7 |0
+<U00C4> \x8E |0
+<U00C5> \x8F |0
+<U00C6> \x92 |0
+<U00C7> \x80 |0
+<U00C8> \xD4 |0
+<U00C9> \x90 |0
+<U00CA> \xD2 |0
+<U00CB> \xD3 |0
+<U00CC> \xDE |0
+<U00CD> \xD6 |0
+<U00CE> \xD7 |0
+<U00CF> \xD8 |0
+<U00D1> \xA5 |0
+<U00D2> \xE3 |0
+<U00D3> \xE0 |0
+<U00D4> \xE2 |0
+<U00D5> \xE5 |0
+<U00D6> \x99 |0
+<U00D7> \xE8 |0
+<U00D8> \x9D |0
+<U00D9> \xEB |0
+<U00DA> \xE9 |0
+<U00DB> \xEA |0
+<U00DC> \x9A |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E3> \xC6 |0
+<U00E4> \x84 |0
+<U00E5> \x86 |0
+<U00E6> \x91 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00EC> \xEC |0
+<U00ED> \xA1 |0
+<U00EE> \x8C |0
+<U00EF> \x8B |0
+<U00F1> \xA4 |0
+<U00F2> \x95 |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F5> \xE4 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00F8> \x9B |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U00FF> \xED |0
+<U011E> \xA6 |0
+<U011F> \xA7 |0
+<U0130> \x98 |0
+<U0131> \x8D |0
+<U015E> \x9E |0
+<U015F> \x9F |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U203E> \xEE |1
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2554> \xC9 |0
+<U2557> \xBB |0
+<U255A> \xC8 |0
+<U255D> \xBC |0
+<U2560> \xCC |0
+<U2563> \xB9 |0
+<U2566> \xCB |0
+<U2569> \xCA |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-858.ucm b/mcs/class/I18N/Rare/ibm-858.ucm
new file mode 100644
index 00000000000..29da17cfb98
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-858.ucm
@@ -0,0 +1,415 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1997-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0035A.RPMAP100 and 035A44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-858"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-858
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A2> \xBD |0
+<U00A3> \x9C |0
+<U00A4> \xCF |0
+<U00A5> \xBE |0
+<U00A6> \xDD |0
+<U00A7> \xF5 |0
+<U00A8> \xF9 |0
+<U00A9> \xB8 |0
+<U00AA> \xA6 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00AD> \xF0 |0
+<U00AE> \xA9 |0
+<U00AF> \xEE |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B3> \xFC |0
+<U00B4> \xEF |0
+<U00B5> \xE6 |0
+<U00B6> \xF4 |0
+<U00B7> \xFA |0
+<U00B8> \xF7 |0
+<U00B9> \xFB |0
+<U00BA> \xA7 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BE> \xF3 |0
+<U00BF> \xA8 |0
+<U00C0> \xB7 |0
+<U00C1> \xB5 |0
+<U00C2> \xB6 |0
+<U00C3> \xC7 |0
+<U00C4> \x8E |0
+<U00C5> \x8F |0
+<U00C6> \x92 |0
+<U00C7> \x80 |0
+<U00C8> \xD4 |0
+<U00C9> \x90 |0
+<U00CA> \xD2 |0
+<U00CB> \xD3 |0
+<U00CC> \xDE |0
+<U00CD> \xD6 |0
+<U00CE> \xD7 |0
+<U00CF> \xD8 |0
+<U00D0> \xD1 |0
+<U00D1> \xA5 |0
+<U00D2> \xE3 |0
+<U00D3> \xE0 |0
+<U00D4> \xE2 |0
+<U00D5> \xE5 |0
+<U00D6> \x99 |0
+<U00D7> \x9E |0
+<U00D8> \x9D |0
+<U00D9> \xEB |0
+<U00DA> \xE9 |0
+<U00DB> \xEA |0
+<U00DC> \x9A |0
+<U00DD> \xED |0
+<U00DE> \xE8 |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E3> \xC6 |0
+<U00E4> \x84 |0
+<U00E5> \x86 |0
+<U00E6> \x91 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00EC> \x8D |0
+<U00ED> \xA1 |0
+<U00EE> \x8C |0
+<U00EF> \x8B |0
+<U00F0> \xD0 |0
+<U00F1> \xA4 |0
+<U00F2> \x95 |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F5> \xE4 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00F8> \x9B |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U00FD> \xEC |0
+<U00FE> \xE7 |0
+<U00FF> \x98 |0
+<U0192> \x9F |0
+<U2017> \xF2 |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U203E> \xEE |1
+<U20AC> \xD5 |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2554> \xC9 |0
+<U2557> \xBB |0
+<U255A> \xC8 |0
+<U255D> \xBC |0
+<U2560> \xCC |0
+<U2563> \xB9 |0
+<U2566> \xCB |0
+<U2569> \xCA |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266C> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-862.ucm b/mcs/class/I18N/Rare/ibm-862.ucm
new file mode 100644
index 00000000000..33592b0ff47
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-862.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0035E.RPMAP100 and 035E34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-862"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-862
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A2> \x9B |0
+<U00A3> \x9C |0
+<U00A5> \x9D |0
+<U00A7> \x15 |1
+<U00AA> \xA6 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B6> \x14 |1
+<U00B7> \xFA |0
+<U00BA> \xA7 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BF> \xA8 |0
+<U00D1> \xA5 |0
+<U00DF> \xE1 |0
+<U00E1> \xA0 |0
+<U00ED> \xA1 |0
+<U00F1> \xA4 |0
+<U00F3> \xA2 |0
+<U00F7> \xF6 |0
+<U00FA> \xA3 |0
+<U0192> \x9F |0
+<U0393> \xE2 |0
+<U0398> \xE9 |0
+<U03A3> \xE4 |0
+<U03A6> \xE8 |0
+<U03A9> \xEA |0
+<U03B1> \xE0 |0
+<U03B4> \xEB |0
+<U03B5> \xEE |0
+<U03BC> \xE6 |0
+<U03C0> \xE3 |0
+<U03C3> \xE5 |0
+<U03C4> \xE7 |0
+<U03C6> \xED |0
+<U05D0> \x80 |0
+<U05D1> \x81 |0
+<U05D2> \x82 |0
+<U05D3> \x83 |0
+<U05D4> \x84 |0
+<U05D5> \x85 |0
+<U05D6> \x86 |0
+<U05D7> \x87 |0
+<U05D8> \x88 |0
+<U05D9> \x89 |0
+<U05DA> \x8A |0
+<U05DB> \x8B |0
+<U05DC> \x8C |0
+<U05DD> \x8D |0
+<U05DE> \x8E |0
+<U05DF> \x8F |0
+<U05E0> \x90 |0
+<U05E1> \x91 |0
+<U05E2> \x92 |0
+<U05E3> \x93 |0
+<U05E4> \x94 |0
+<U05E5> \x95 |0
+<U05E6> \x96 |0
+<U05E7> \x97 |0
+<U05E8> \x98 |0
+<U05E9> \x99 |0
+<U05EA> \x9A |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U207F> \xFC |0
+<U20A7> \x9E |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221E> \xEC |0
+<U221F> \x1C |1
+<U2229> \xEF |0
+<U2248> \xF7 |0
+<U2261> \xF0 |0
+<U2264> \xF3 |0
+<U2265> \xF2 |0
+<U2302> \x7F |2
+<U2310> \xA9 |0
+<U2320> \xF4 |0
+<U2321> \xF5 |0
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-864.ucm b/mcs/class/I18N/Rare/ibm-864.ucm
new file mode 100644
index 00000000000..3128d1c227d
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-864.ucm
@@ -0,0 +1,498 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Thu Nov 9 17:44:50 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00360.RXMAP110 and 036034B0.TXMAP110
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-864"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-864
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xA0 |0
+<U00A2> \xC0 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A6> \xDB |0
+<U00A7> \x15 |1
+<U00AB> \x97 |0
+<U00AC> \xDC |0
+<U00AD> \xA1 |0
+<U00B0> \x80 |0
+<U00B1> \x93 |0
+<U00B6> \x14 |1
+<U00B7> \x81 |0
+<U00BB> \x98 |0
+<U00BC> \x95 |0
+<U00BD> \x94 |0
+<U00D7> \xDE |0
+<U00F7> \xDD |0
+<U03B2> \x90 |0
+<U03C6> \x92 |0
+<U060C> \xAC |0
+<U061B> \xBB |0
+<U061F> \xBF |0
+<U0621> \xC1 |1
+<U0622> \xC2 |1
+<U0623> \xC3 |1
+<U0624> \xC4 |1
+<U0626> \xC6 |1
+<U0627> \xC7 |1
+<U0628> \xC8 |1
+<U0629> \xC9 |1
+<U062A> \xCA |1
+<U062B> \xCB |1
+<U062C> \xCC |1
+<U062D> \xCD |1
+<U062E> \xCE |1
+<U062F> \xCF |1
+<U0630> \xD0 |1
+<U0631> \xD1 |1
+<U0632> \xD2 |1
+<U0633> \xD3 |1
+<U0634> \xD4 |1
+<U0635> \xD5 |1
+<U0636> \xD6 |1
+<U0637> \xD7 |1
+<U0638> \xD8 |1
+<U0639> \xD9 |1
+<U063A> \xDA |1
+<U0640> \xE0 |0
+<U0641> \xE1 |1
+<U0642> \xE2 |1
+<U0643> \xE3 |1
+<U0644> \xE4 |1
+<U0645> \xE5 |1
+<U0646> \xE6 |1
+<U0647> \xE7 |1
+<U0648> \xE8 |1
+<U0649> \xE9 |1
+<U064A> \xFD |1
+<U0651> \xF1 |1
+<U0660> \xB0 |0
+<U0661> \xB1 |0
+<U0662> \xB2 |0
+<U0663> \xB3 |0
+<U0664> \xB4 |0
+<U0665> \xB5 |0
+<U0666> \xB6 |0
+<U0667> \xB7 |0
+<U0668> \xB8 |0
+<U0669> \xB9 |0
+<U066A> \x25 |1
+<U066B> \x2C |1
+<U066C> \x2E |1
+<U066D> \x2A |1
+<U200B> \x9F |0
+<U203C> \x13 |1
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \x82 |0
+<U221A> \x83 |0
+<U221E> \x91 |0
+<U221F> \x1C |1
+<U2248> \x96 |0
+<U2302> \x7F |2
+<U2500> \x85 |0
+<U2502> \x86 |0
+<U250C> \x8D |0
+<U2510> \x8C |0
+<U2514> \x8E |0
+<U2518> \x8F |0
+<U251C> \x8A |0
+<U2524> \x88 |0
+<U252C> \x89 |0
+<U2534> \x8B |0
+<U253C> \x87 |0
+<U2550> \x05 |1
+<U2551> \x06 |1
+<U2554> \x0D |1
+<U2557> \x0C |1
+<U255A> \x0E |1
+<U255D> \x0F |1
+<U2560> \x0A |1
+<U2563> \x08 |1
+<U2566> \x09 |1
+<U2569> \x0B |1
+<U256C> \x07 |1
+<U2592> \x84 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U263A> \x01 |1
+<U263C> \x04 |1
+<U266A> \x02 |1
+<U266C> \x03 |1
+<UFE7C> \xF1 |0
+<UFE7D> \xF0 |0
+<UFE80> \xC1 |0
+<UFE81> \xC2 |0
+<UFE82> \xA2 |0
+<UFE83> \xC3 |0
+<UFE84> \xA5 |0
+<UFE85> \xC4 |0
+<UFE86> \xC4 |1
+<UFE8B> \xC6 |0
+<UFE8C> \xC6 |1
+<UFE8D> \xC7 |0
+<UFE8E> \xA8 |0
+<UFE8F> \xA9 |0
+<UFE90> \xA9 |1
+<UFE91> \xC8 |0
+<UFE92> \xC8 |1
+<UFE93> \xC9 |0
+<UFE94> \xC9 |1
+<UFE95> \xAA |0
+<UFE96> \xAA |1
+<UFE97> \xCA |0
+<UFE98> \xCA |1
+<UFE99> \xAB |0
+<UFE9A> \xAB |1
+<UFE9B> \xCB |0
+<UFE9C> \xCB |1
+<UFE9D> \xAD |0
+<UFE9E> \xAD |1
+<UFE9F> \xCC |0
+<UFEA0> \xCC |1
+<UFEA1> \xAE |0
+<UFEA2> \xAE |1
+<UFEA3> \xCD |0
+<UFEA4> \xCD |1
+<UFEA5> \xAF |0
+<UFEA6> \xAF |1
+<UFEA7> \xCE |0
+<UFEA8> \xCE |1
+<UFEA9> \xCF |0
+<UFEAA> \xCF |1
+<UFEAB> \xD0 |0
+<UFEAC> \xD0 |1
+<UFEAD> \xD1 |0
+<UFEAE> \xD1 |1
+<UFEAF> \xD2 |0
+<UFEB0> \xD2 |1
+<UFEB1> \xBC |0
+<UFEB2> \xBC |1
+<UFEB3> \xD3 |0
+<UFEB4> \xD3 |1
+<UFEB5> \xBD |0
+<UFEB6> \xBD |1
+<UFEB7> \xD4 |0
+<UFEB8> \xD4 |1
+<UFEB9> \xBE |0
+<UFEBA> \xBE |1
+<UFEBB> \xD5 |0
+<UFEBC> \xD5 |1
+<UFEBD> \xEB |0
+<UFEBE> \xEB |1
+<UFEBF> \xD6 |0
+<UFEC0> \xD6 |1
+<UFEC1> \xD7 |1
+<UFEC2> \xD7 |1
+<UFEC3> \xD7 |0
+<UFEC4> \xD7 |1
+<UFEC5> \xD8 |1
+<UFEC6> \xD8 |1
+<UFEC7> \xD8 |0
+<UFEC8> \xD8 |1
+<UFEC9> \xDF |0
+<UFECA> \xC5 |0
+<UFECB> \xD9 |0
+<UFECC> \xEC |0
+<UFECD> \xEE |0
+<UFECE> \xED |0
+<UFECF> \xDA |0
+<UFED0> \xF7 |0
+<UFED1> \xBA |0
+<UFED2> \xBA |1
+<UFED3> \xE1 |0
+<UFED4> \xE1 |1
+<UFED5> \xF8 |0
+<UFED6> \xF8 |1
+<UFED7> \xE2 |0
+<UFED8> \xE2 |1
+<UFED9> \xFC |0
+<UFEDA> \xFC |1
+<UFEDB> \xE3 |0
+<UFEDC> \xE3 |1
+<UFEDD> \xFB |0
+<UFEDE> \xFB |1
+<UFEDF> \xE4 |0
+<UFEE0> \xE4 |1
+<UFEE1> \xEF |0
+<UFEE2> \xEF |1
+<UFEE3> \xE5 |0
+<UFEE4> \xE5 |1
+<UFEE5> \xF2 |0
+<UFEE6> \xF2 |1
+<UFEE7> \xE6 |0
+<UFEE8> \xE6 |1
+<UFEE9> \xF3 |0
+<UFEEA> \xF3 |1
+<UFEEB> \xE7 |0
+<UFEEC> \xF4 |0
+<UFEED> \xE8 |0
+<UFEEE> \xE8 |1
+<UFEEF> \xE9 |0
+<UFEF0> \xF5 |0
+<UFEF1> \xFD |0
+<UFEF2> \xF6 |0
+<UFEF3> \xEA |0
+<UFEF4> \xEA |1
+<UFEF5> \xF9 |0
+<UFEF6> \xFA |0
+<UFEF7> \x99 |0
+<UFEF8> \x9A |0
+<UFEFB> \x9D |0
+<UFEFC> \x9E |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \x86 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-866.ucm b/mcs/class/I18N/Rare/ibm-866.ucm
new file mode 100644
index 00000000000..f8c434d4b84
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-866.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:03 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00362.RPMAP100 and 036234B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-866"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-866
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A4> \xFD |0
+<U00A7> \x15 |1
+<U00B0> \xF8 |0
+<U00B6> \x14 |1
+<U00B7> \xFA |0
+<U0401> \xF0 |0
+<U0404> \xF2 |0
+<U0407> \xF4 |0
+<U040E> \xF6 |0
+<U0410> \x80 |0
+<U0411> \x81 |0
+<U0412> \x82 |0
+<U0413> \x83 |0
+<U0414> \x84 |0
+<U0415> \x85 |0
+<U0416> \x86 |0
+<U0417> \x87 |0
+<U0418> \x88 |0
+<U0419> \x89 |0
+<U041A> \x8A |0
+<U041B> \x8B |0
+<U041C> \x8C |0
+<U041D> \x8D |0
+<U041E> \x8E |0
+<U041F> \x8F |0
+<U0420> \x90 |0
+<U0421> \x91 |0
+<U0422> \x92 |0
+<U0423> \x93 |0
+<U0424> \x94 |0
+<U0425> \x95 |0
+<U0426> \x96 |0
+<U0427> \x97 |0
+<U0428> \x98 |0
+<U0429> \x99 |0
+<U042A> \x9A |0
+<U042B> \x9B |0
+<U042C> \x9C |0
+<U042D> \x9D |0
+<U042E> \x9E |0
+<U042F> \x9F |0
+<U0430> \xA0 |0
+<U0431> \xA1 |0
+<U0432> \xA2 |0
+<U0433> \xA3 |0
+<U0434> \xA4 |0
+<U0435> \xA5 |0
+<U0436> \xA6 |0
+<U0437> \xA7 |0
+<U0438> \xA8 |0
+<U0439> \xA9 |0
+<U043A> \xAA |0
+<U043B> \xAB |0
+<U043C> \xAC |0
+<U043D> \xAD |0
+<U043E> \xAE |0
+<U043F> \xAF |0
+<U0440> \xE0 |0
+<U0441> \xE1 |0
+<U0442> \xE2 |0
+<U0443> \xE3 |0
+<U0444> \xE4 |0
+<U0445> \xE5 |0
+<U0446> \xE6 |0
+<U0447> \xE7 |0
+<U0448> \xE8 |0
+<U0449> \xE9 |0
+<U044A> \xEA |0
+<U044B> \xEB |0
+<U044C> \xEC |0
+<U044D> \xED |0
+<U044E> \xEE |0
+<U044F> \xEF |0
+<U0451> \xF1 |0
+<U0454> \xF3 |0
+<U0457> \xF5 |0
+<U045E> \xF7 |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U2116> \xFC |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-869.ucm b/mcs/class/I18N/Rare/ibm-869.ucm
new file mode 100644
index 00000000000..33eb1d8555f
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-869.ucm
@@ -0,0 +1,408 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:03 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00365.RPMAP100 and 036534B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-869"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-869
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A3> \x9C |0
+<U00A6> \x8A |0
+<U00A7> \xF5 |0
+<U00A8> \xF9 |0
+<U00A9> \x97 |0
+<U00AB> \xAE |0
+<U00AC> \x89 |0
+<U00AD> \xF0 |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \x99 |0
+<U00B3> \x9A |0
+<U00B4> \xEF |0
+<U00B6> \x14 |1
+<U00B7> \x88 |1
+<U00BB> \xAF |0
+<U00BD> \xAB |0
+<U0385> \xF7 |0
+<U0386> \x86 |0
+<U0387> \x88 |0
+<U0388> \x8D |0
+<U0389> \x8F |0
+<U038A> \x90 |0
+<U038C> \x92 |0
+<U038E> \x95 |0
+<U038F> \x98 |0
+<U0390> \xA1 |0
+<U0391> \xA4 |0
+<U0392> \xA5 |0
+<U0393> \xA6 |0
+<U0394> \xA7 |0
+<U0395> \xA8 |0
+<U0396> \xA9 |0
+<U0397> \xAA |0
+<U0398> \xAC |0
+<U0399> \xAD |0
+<U039A> \xB5 |0
+<U039B> \xB6 |0
+<U039C> \xB7 |0
+<U039D> \xB8 |0
+<U039E> \xBD |0
+<U039F> \xBE |0
+<U03A0> \xC6 |0
+<U03A1> \xC7 |0
+<U03A3> \xCF |0
+<U03A4> \xD0 |0
+<U03A5> \xD1 |0
+<U03A6> \xD2 |0
+<U03A7> \xD3 |0
+<U03A8> \xD4 |0
+<U03A9> \xD5 |0
+<U03AA> \x91 |0
+<U03AB> \x96 |0
+<U03AC> \x9B |0
+<U03AD> \x9D |0
+<U03AE> \x9E |0
+<U03AF> \x9F |0
+<U03B0> \xFC |0
+<U03B1> \xD6 |0
+<U03B2> \xD7 |0
+<U03B3> \xD8 |0
+<U03B4> \xDD |0
+<U03B5> \xDE |0
+<U03B6> \xE0 |0
+<U03B7> \xE1 |0
+<U03B8> \xE2 |0
+<U03B9> \xE3 |0
+<U03BA> \xE4 |0
+<U03BB> \xE5 |0
+<U03BC> \xE6 |0
+<U03BD> \xE7 |0
+<U03BE> \xE8 |0
+<U03BF> \xE9 |0
+<U03C0> \xEA |0
+<U03C1> \xEB |0
+<U03C2> \xED |0
+<U03C3> \xEC |0
+<U03C4> \xEE |0
+<U03C5> \xF2 |0
+<U03C6> \xF3 |0
+<U03C7> \xF4 |0
+<U03C8> \xF6 |0
+<U03C9> \xFA |0
+<U03CA> \xA0 |0
+<U03CB> \xFB |0
+<U03CC> \xA2 |0
+<U03CD> \xA3 |0
+<U03CE> \xFD |0
+<U03D5> \xF3 |1
+<U2015> \x8E |0
+<U2018> \x8B |0
+<U2019> \x8C |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2554> \xC9 |0
+<U2557> \xBB |0
+<U255A> \xC8 |0
+<U255D> \xBC |0
+<U2560> \xCC |0
+<U2563> \xB9 |0
+<U2566> \xCB |0
+<U2569> \xCA |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-870.ucm b/mcs/class/I18N/Rare/ibm-870.ucm
new file mode 100644
index 00000000000..53d0fce869e
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-870.ucm
@@ -0,0 +1,372 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created by rptp2ucm (compiled on Feb 23 2001)
+# from source files 34B00366.RPMAP100 and 036634B0.TPMAP100
+#
+<code_set_name> "ibm-870_P100-2000"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+<icu:charsetFamily> "EBCDIC"
+<icu:alias> "ibm-870_STD"
+
+CHARMAP
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x6A |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A4> \x9F |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00AD> \xCA |0
+<U00B0> \x90 |0
+<U00B4> \xBE |0
+<U00B8> \x9D |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C4> \x63 |0
+<U00C7> \x68 |0
+<U00C9> \x71 |0
+<U00CB> \x73 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00D0> \xAC |1
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D6> \xEC |0
+<U00D7> \xBF |0
+<U00DA> \xFE |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DF> \x59 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E4> \x43 |0
+<U00E7> \x48 |0
+<U00E9> \x51 |0
+<U00EB> \x53 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F6> \xCC |0
+<U00F7> \xE1 |0
+<U00FA> \xDE |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U0102> \x66 |0
+<U0103> \x46 |0
+<U0104> \xB1 |0
+<U0105> \xA0 |0
+<U0106> \x69 |0
+<U0107> \x49 |0
+<U010C> \x67 |0
+<U010D> \x47 |0
+<U010E> \xFA |0
+<U010F> \xEA |0
+<U0110> \xAC |0
+<U0111> \x8C |0
+<U0118> \x72 |0
+<U0119> \x52 |0
+<U011A> \xDA |0
+<U011B> \xDF |0
+<U0139> \x78 |0
+<U013A> \x58 |0
+<U013D> \x77 |0
+<U013E> \x57 |0
+<U0141> \xBA |0
+<U0142> \x9A |0
+<U0143> \xBB |0
+<U0144> \x9B |0
+<U0147> \xAB |0
+<U0148> \x8B |0
+<U0150> \xEF |0
+<U0151> \xCF |0
+<U0154> \xED |0
+<U0155> \xCD |0
+<U0158> \xAE |0
+<U0159> \x8E |0
+<U015A> \xAA |0
+<U015B> \x8A |0
+<U015E> \xAF |0
+<U015F> \x8F |0
+<U0160> \xBC |0
+<U0161> \x9C |0
+<U0162> \xB3 |0
+<U0163> \x44 |0
+<U0164> \xFD |0
+<U0165> \xDD |0
+<U016E> \x74 |0
+<U016F> \x54 |0
+<U0170> \xFB |0
+<U0171> \xDB |0
+<U0179> \xB9 |0
+<U017A> \xB7 |0
+<U017B> \xB4 |0
+<U017C> \xB2 |0
+<U017D> \xB8 |0
+<U017E> \xB6 |0
+<U02C7> \x70 |0
+<U02D8> \x80 |0
+<U02D9> \xB0 |0
+<U02DB> \x9E |0
+<U02DD> \x64 |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x6A |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-871.ucm b/mcs/class/I18N/Rare/ibm-871.ucm
new file mode 100644
index 00000000000..728990ee788
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-871.ucm
@@ -0,0 +1,379 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:03 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00367.RPMAP100 and 036734B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-871"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-871
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \xAC |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \xAE |0
+<U005C> \xBE |0
+<U005D> \x9E |0
+<U005E> \xEC |0
+<U005F> \x6D |0
+<U0060> \x8C |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \x8E |0
+<U007C> \xBB |0
+<U007D> \x9C |0
+<U007E> \xCC |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x41 |0
+<U00A1> \xAA |0
+<U00A2> \xB0 |0
+<U00A3> \xB1 |0
+<U00A4> \x9F |0
+<U00A5> \xB2 |0
+<U00A6> \x6A |0
+<U00A7> \xB5 |0
+<U00A8> \xBD |0
+<U00A9> \xB4 |0
+<U00AA> \x9A |0
+<U00AB> \x8A |0
+<U00AC> \xBA |0
+<U00AD> \xCA |0
+<U00AE> \xAF |0
+<U00AF> \xBC |0
+<U00B0> \x90 |0
+<U00B1> \x8F |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xE0 |0
+<U00B5> \xA0 |0
+<U00B6> \xB6 |0
+<U00B7> \xB3 |0
+<U00B8> \x9D |0
+<U00B9> \xDA |0
+<U00BA> \x9B |0
+<U00BB> \x8B |0
+<U00BC> \xB7 |0
+<U00BD> \xB8 |0
+<U00BE> \xB9 |0
+<U00BF> \xAB |0
+<U00C0> \x64 |0
+<U00C1> \x65 |0
+<U00C2> \x62 |0
+<U00C3> \x66 |0
+<U00C4> \x63 |0
+<U00C5> \x67 |0
+<U00C6> \x5A |0
+<U00C7> \x68 |0
+<U00C8> \x74 |0
+<U00C9> \x71 |0
+<U00CA> \x72 |0
+<U00CB> \x73 |0
+<U00CC> \x78 |0
+<U00CD> \x75 |0
+<U00CE> \x76 |0
+<U00CF> \x77 |0
+<U00D0> \x7C |0
+<U00D1> \x69 |0
+<U00D2> \xED |0
+<U00D3> \xEE |0
+<U00D4> \xEB |0
+<U00D5> \xEF |0
+<U00D6> \x5F |0
+<U00D7> \xBF |0
+<U00D8> \x80 |0
+<U00D9> \xFD |0
+<U00DA> \xFE |0
+<U00DB> \xFB |0
+<U00DC> \xFC |0
+<U00DD> \xAD |0
+<U00DE> \x4A |0
+<U00DF> \x59 |0
+<U00E0> \x44 |0
+<U00E1> \x45 |0
+<U00E2> \x42 |0
+<U00E3> \x46 |0
+<U00E4> \x43 |0
+<U00E5> \x47 |0
+<U00E6> \xD0 |0
+<U00E7> \x48 |0
+<U00E8> \x54 |0
+<U00E9> \x51 |0
+<U00EA> \x52 |0
+<U00EB> \x53 |0
+<U00EC> \x58 |0
+<U00ED> \x55 |0
+<U00EE> \x56 |0
+<U00EF> \x57 |0
+<U00F0> \x79 |0
+<U00F1> \x49 |0
+<U00F2> \xCD |0
+<U00F3> \xCE |0
+<U00F4> \xCB |0
+<U00F5> \xCF |0
+<U00F6> \xA1 |0
+<U00F7> \xE1 |0
+<U00F8> \x70 |0
+<U00F9> \xDD |0
+<U00FA> \xDE |0
+<U00FB> \xDB |0
+<U00FC> \xDC |0
+<U00FD> \x8D |0
+<U00FE> \xC0 |0
+<U00FF> \xDF |0
+<U0110> \x7C |1
+<U203E> \xBC |1
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \xAC |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \xAE |1
+<UFF3C> \xBE |1
+<UFF3D> \x9E |1
+<UFF3E> \xEC |1
+<UFF3F> \x6D |1
+<UFF40> \x8C |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \x8E |1
+<UFF5C> \xBB |1
+<UFF5D> \x9C |1
+<UFF5E> \xCC |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/ibm-875.ucm b/mcs/class/I18N/Rare/ibm-875.ucm
new file mode 100644
index 00000000000..b9ec20a5a59
--- /dev/null
+++ b/mcs/class/I18N/Rare/ibm-875.ucm
@@ -0,0 +1,367 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2001, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created by rptp2ucm (compiled on Feb 23 2001)
+# from source files 34B0036B.RPMAP100 and 036B34B0.TPMAP100
+#
+<code_set_name> "ibm-875_P100-2000"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x3F
+<icu:charsetFamily> "EBCDIC"
+<icu:alias> "ibm-875_STD"
+
+CHARMAP
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x37 |0
+<U0005> \x2D |0
+<U0006> \x2E |0
+<U0007> \x2F |0
+<U0008> \x16 |0
+<U0009> \x05 |0
+<U000A> \x25 |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x3C |0
+<U0015> \x3D |0
+<U0016> \x32 |0
+<U0017> \x26 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x3F |0
+<U001B> \x27 |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x40 |0
+<U0021> \x4F |0
+<U0022> \x7F |0
+<U0023> \x7B |0
+<U0024> \x5B |0
+<U0025> \x6C |0
+<U0026> \x50 |0
+<U0027> \x7D |0
+<U0028> \x4D |0
+<U0029> \x5D |0
+<U002A> \x5C |0
+<U002B> \x4E |0
+<U002C> \x6B |0
+<U002D> \x60 |0
+<U002E> \x4B |0
+<U002F> \x61 |0
+<U0030> \xF0 |0
+<U0031> \xF1 |0
+<U0032> \xF2 |0
+<U0033> \xF3 |0
+<U0034> \xF4 |0
+<U0035> \xF5 |0
+<U0036> \xF6 |0
+<U0037> \xF7 |0
+<U0038> \xF8 |0
+<U0039> \xF9 |0
+<U003A> \x7A |0
+<U003B> \x5E |0
+<U003C> \x4C |0
+<U003D> \x7E |0
+<U003E> \x6E |0
+<U003F> \x6F |0
+<U0040> \x7C |0
+<U0041> \xC1 |0
+<U0042> \xC2 |0
+<U0043> \xC3 |0
+<U0044> \xC4 |0
+<U0045> \xC5 |0
+<U0046> \xC6 |0
+<U0047> \xC7 |0
+<U0048> \xC8 |0
+<U0049> \xC9 |0
+<U004A> \xD1 |0
+<U004B> \xD2 |0
+<U004C> \xD3 |0
+<U004D> \xD4 |0
+<U004E> \xD5 |0
+<U004F> \xD6 |0
+<U0050> \xD7 |0
+<U0051> \xD8 |0
+<U0052> \xD9 |0
+<U0053> \xE2 |0
+<U0054> \xE3 |0
+<U0055> \xE4 |0
+<U0056> \xE5 |0
+<U0057> \xE6 |0
+<U0058> \xE7 |0
+<U0059> \xE8 |0
+<U005A> \xE9 |0
+<U005B> \x4A |0
+<U005C> \xE0 |0
+<U005D> \x5A |0
+<U005E> \x5F |0
+<U005F> \x6D |0
+<U0060> \x79 |0
+<U0061> \x81 |0
+<U0062> \x82 |0
+<U0063> \x83 |0
+<U0064> \x84 |0
+<U0065> \x85 |0
+<U0066> \x86 |0
+<U0067> \x87 |0
+<U0068> \x88 |0
+<U0069> \x89 |0
+<U006A> \x91 |0
+<U006B> \x92 |0
+<U006C> \x93 |0
+<U006D> \x94 |0
+<U006E> \x95 |0
+<U006F> \x96 |0
+<U0070> \x97 |0
+<U0071> \x98 |0
+<U0072> \x99 |0
+<U0073> \xA2 |0
+<U0074> \xA3 |0
+<U0075> \xA4 |0
+<U0076> \xA5 |0
+<U0077> \xA6 |0
+<U0078> \xA7 |0
+<U0079> \xA8 |0
+<U007A> \xA9 |0
+<U007B> \xC0 |0
+<U007C> \x6A |0
+<U007D> \xD0 |0
+<U007E> \xA1 |0
+<U007F> \x07 |0
+<U0080> \x20 |0
+<U0081> \x21 |0
+<U0082> \x22 |0
+<U0083> \x23 |0
+<U0084> \x24 |0
+<U0085> \x15 |0
+<U0086> \x06 |0
+<U0087> \x17 |0
+<U0088> \x28 |0
+<U0089> \x29 |0
+<U008A> \x2A |0
+<U008B> \x2B |0
+<U008C> \x2C |0
+<U008D> \x09 |0
+<U008E> \x0A |0
+<U008F> \x1B |0
+<U0090> \x30 |0
+<U0091> \x31 |0
+<U0092> \x1A |0
+<U0093> \x33 |0
+<U0094> \x34 |0
+<U0095> \x35 |0
+<U0096> \x36 |0
+<U0097> \x08 |0
+<U0098> \x38 |0
+<U0099> \x39 |0
+<U009A> \x3A |0
+<U009B> \x3B |0
+<U009C> \x04 |0
+<U009D> \x14 |0
+<U009E> \x3E |0
+<U009F> \xFF |0
+<U00A0> \x74 |0
+<U00A3> \xB0 |0
+<U00A6> \xDF |0
+<U00A7> \xEB |0
+<U00A8> \x70 |0
+<U00A9> \xFB |0
+<U00AB> \xEE |0
+<U00AC> \xEF |0
+<U00AD> \xCA |0
+<U00B0> \x90 |0
+<U00B1> \xDA |0
+<U00B2> \xEA |0
+<U00B3> \xFA |0
+<U00B4> \xA0 |0
+<U00B7> \xDD |1
+<U00BB> \xFE |0
+<U00BD> \xDB |0
+<U0385> \x80 |0
+<U0386> \x71 |0
+<U0387> \xDD |0
+<U0388> \x72 |0
+<U0389> \x73 |0
+<U038A> \x75 |0
+<U038C> \x76 |0
+<U038E> \x77 |0
+<U038F> \x78 |0
+<U0390> \xCC |0
+<U0391> \x41 |0
+<U0392> \x42 |0
+<U0393> \x43 |0
+<U0394> \x44 |0
+<U0395> \x45 |0
+<U0396> \x46 |0
+<U0397> \x47 |0
+<U0398> \x48 |0
+<U0399> \x49 |0
+<U039A> \x51 |0
+<U039B> \x52 |0
+<U039C> \x53 |0
+<U039D> \x54 |0
+<U039E> \x55 |0
+<U039F> \x56 |0
+<U03A0> \x57 |0
+<U03A1> \x58 |0
+<U03A3> \x59 |0
+<U03A4> \x62 |0
+<U03A5> \x63 |0
+<U03A6> \x64 |0
+<U03A7> \x65 |0
+<U03A8> \x66 |0
+<U03A9> \x67 |0
+<U03AA> \x68 |0
+<U03AB> \x69 |0
+<U03AC> \xB1 |0
+<U03AD> \xB2 |0
+<U03AE> \xB3 |0
+<U03AF> \xB5 |0
+<U03B0> \xCD |0
+<U03B1> \x8A |0
+<U03B2> \x8B |0
+<U03B3> \x8C |0
+<U03B4> \x8D |0
+<U03B5> \x8E |0
+<U03B6> \x8F |0
+<U03B7> \x9A |0
+<U03B8> \x9B |0
+<U03B9> \x9C |0
+<U03BA> \x9D |0
+<U03BB> \x9E |0
+<U03BC> \x9F |0
+<U03BD> \xAA |0
+<U03BE> \xAB |0
+<U03BF> \xAC |0
+<U03C0> \xAD |0
+<U03C1> \xAE |0
+<U03C2> \xBA |0
+<U03C3> \xAF |0
+<U03C4> \xBB |0
+<U03C5> \xBC |0
+<U03C6> \xBD |0
+<U03C7> \xBE |0
+<U03C8> \xBF |0
+<U03C9> \xCB |0
+<U03CA> \xB4 |0
+<U03CB> \xB8 |0
+<U03CC> \xB6 |0
+<U03CD> \xB7 |0
+<U03CE> \xB9 |0
+<U03D5> \xBD |1
+<U2015> \xCF |0
+<U2018> \xCE |0
+<U2019> \xDE |0
+<UFF01> \x4F |1
+<UFF02> \x7F |1
+<UFF03> \x7B |1
+<UFF04> \x5B |1
+<UFF05> \x6C |1
+<UFF06> \x50 |1
+<UFF07> \x7D |1
+<UFF08> \x4D |1
+<UFF09> \x5D |1
+<UFF0A> \x5C |1
+<UFF0B> \x4E |1
+<UFF0C> \x6B |1
+<UFF0D> \x60 |1
+<UFF0E> \x4B |1
+<UFF0F> \x61 |1
+<UFF10> \xF0 |1
+<UFF11> \xF1 |1
+<UFF12> \xF2 |1
+<UFF13> \xF3 |1
+<UFF14> \xF4 |1
+<UFF15> \xF5 |1
+<UFF16> \xF6 |1
+<UFF17> \xF7 |1
+<UFF18> \xF8 |1
+<UFF19> \xF9 |1
+<UFF1A> \x7A |1
+<UFF1B> \x5E |1
+<UFF1C> \x4C |1
+<UFF1D> \x7E |1
+<UFF1E> \x6E |1
+<UFF1F> \x6F |1
+<UFF20> \x7C |1
+<UFF21> \xC1 |1
+<UFF22> \xC2 |1
+<UFF23> \xC3 |1
+<UFF24> \xC4 |1
+<UFF25> \xC5 |1
+<UFF26> \xC6 |1
+<UFF27> \xC7 |1
+<UFF28> \xC8 |1
+<UFF29> \xC9 |1
+<UFF2A> \xD1 |1
+<UFF2B> \xD2 |1
+<UFF2C> \xD3 |1
+<UFF2D> \xD4 |1
+<UFF2E> \xD5 |1
+<UFF2F> \xD6 |1
+<UFF30> \xD7 |1
+<UFF31> \xD8 |1
+<UFF32> \xD9 |1
+<UFF33> \xE2 |1
+<UFF34> \xE3 |1
+<UFF35> \xE4 |1
+<UFF36> \xE5 |1
+<UFF37> \xE6 |1
+<UFF38> \xE7 |1
+<UFF39> \xE8 |1
+<UFF3A> \xE9 |1
+<UFF3B> \x4A |1
+<UFF3C> \xE0 |1
+<UFF3D> \x5A |1
+<UFF3E> \x5F |1
+<UFF3F> \x6D |1
+<UFF40> \x79 |1
+<UFF41> \x81 |1
+<UFF42> \x82 |1
+<UFF43> \x83 |1
+<UFF44> \x84 |1
+<UFF45> \x85 |1
+<UFF46> \x86 |1
+<UFF47> \x87 |1
+<UFF48> \x88 |1
+<UFF49> \x89 |1
+<UFF4A> \x91 |1
+<UFF4B> \x92 |1
+<UFF4C> \x93 |1
+<UFF4D> \x94 |1
+<UFF4E> \x95 |1
+<UFF4F> \x96 |1
+<UFF50> \x97 |1
+<UFF51> \x98 |1
+<UFF52> \x99 |1
+<UFF53> \xA2 |1
+<UFF54> \xA3 |1
+<UFF55> \xA4 |1
+<UFF56> \xA5 |1
+<UFF57> \xA6 |1
+<UFF58> \xA7 |1
+<UFF59> \xA8 |1
+<UFF5A> \xA9 |1
+<UFF5B> \xC0 |1
+<UFF5C> \x6A |1
+<UFF5D> \xD0 |1
+<UFF5E> \xA1 |1
+END CHARMAP
diff --git a/mcs/class/I18N/Rare/list.unix b/mcs/class/I18N/Rare/list.unix
new file mode 100755
index 00000000000..90b9ffa89ca
--- /dev/null
+++ b/mcs/class/I18N/Rare/list.unix
@@ -0,0 +1,37 @@
+CP866.cs
+CP1026.cs
+CP869.cs
+CP870.cs
+CP875.cs
+CP1047.cs
+CP1140.cs
+CP1141.cs
+CP1142.cs
+CP1143.cs
+CP1144.cs
+CP1145.cs
+CP1146.cs
+CP1147.cs
+CP1148.cs
+CP1149.cs
+CP20273.cs
+CP20277.cs
+CP20278.cs
+CP20280.cs
+CP20284.cs
+CP20285.cs
+CP20290.cs
+CP20297.cs
+CP20420.cs
+CP20424.cs
+CP20871.cs
+CP21025.cs
+CP37.cs
+CP500.cs
+CP708.cs
+CP852.cs
+CP855.cs
+CP857.cs
+CP858.cs
+CP862.cs
+CP864.cs
diff --git a/mcs/class/I18N/Rare/makefile.gnu b/mcs/class/I18N/Rare/makefile.gnu
new file mode 100755
index 00000000000..15aa6124dd3
--- /dev/null
+++ b/mcs/class/I18N/Rare/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../../..
+
+LIBRARY = $(topdir)/class/lib/I18N.Rare.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r mscorlib -r I18N
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/West/.cvsignore b/mcs/class/I18N/West/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/I18N/West/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/I18N/West/CP10000.cs b/mcs/class/I18N/West/CP10000.cs
new file mode 100644
index 00000000000..3cd1c00b203
--- /dev/null
+++ b/mcs/class/I18N/West/CP10000.cs
@@ -0,0 +1,405 @@
+/*
+ * CP10000.cs - Western European (Mac) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-1275.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP10000 : ByteEncoding
+{
+ public CP10000()
+ : base(10000, ToChars, "Western European (Mac)",
+ "macintosh", "macintosh", "macintosh",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u00C4', '\u00C5', '\u00C7', '\u00C9',
+ '\u00D1', '\u00D6', '\u00DC', '\u00E1', '\u00E0', '\u00E2',
+ '\u00E4', '\u00E3', '\u00E5', '\u00E7', '\u00E9', '\u00E8',
+ '\u00EA', '\u00EB', '\u00ED', '\u00EC', '\u00EE', '\u00EF',
+ '\u00F1', '\u00F3', '\u00F2', '\u00F4', '\u00F6', '\u00F5',
+ '\u00FA', '\u00F9', '\u00FB', '\u00FC', '\u2020', '\u00B0',
+ '\u00A2', '\u00A3', '\u00A7', '\u2022', '\u00B6', '\u00DF',
+ '\u00AE', '\u00A9', '\u2122', '\u00B4', '\u00A8', '\u2260',
+ '\u00C6', '\u00D8', '\u221E', '\u00B1', '\u2264', '\u2265',
+ '\u00A5', '\u00B5', '\u2202', '\u2211', '\u220F', '\u03C0',
+ '\u222B', '\u00AA', '\u00BA', '\u2126', '\u00E6', '\u00F8',
+ '\u00BF', '\u00A1', '\u00AC', '\u221A', '\u0192', '\u2248',
+ '\u2206', '\u00AB', '\u00BB', '\u2026', '\u00A0', '\u00C0',
+ '\u00C3', '\u00D5', '\u0152', '\u0153', '\u2013', '\u2014',
+ '\u201C', '\u201D', '\u2018', '\u2019', '\u00F7', '\u25CA',
+ '\u00FF', '\u0178', '\u2044', '\u00A4', '\u2039', '\u203A',
+ '\uFB01', '\uFB02', '\u2021', '\u00B7', '\u201A', '\u201E',
+ '\u2030', '\u00C2', '\u00CA', '\u00C1', '\u00CB', '\u00C8',
+ '\u00CD', '\u00CE', '\u00CF', '\u00CC', '\u00D3', '\u00D4',
+ '\uF8FF', '\u00D2', '\u00DA', '\u00DB', '\u00D9', '\u0131',
+ '\u02C6', '\u02DC', '\u00AF', '\u02D8', '\u02D9', '\u02DA',
+ '\u00B8', '\u02DD', '\u02DB', '\u02C7',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A9:
+ case 0x00B1:
+ case 0x00B5:
+ break;
+ case 0x00A0: ch = 0xCA; break;
+ case 0x00A1: ch = 0xC1; break;
+ case 0x00A4: ch = 0xDB; break;
+ case 0x00A5: ch = 0xB4; break;
+ case 0x00A7: ch = 0xA4; break;
+ case 0x00A8: ch = 0xAC; break;
+ case 0x00AA: ch = 0xBB; break;
+ case 0x00AB: ch = 0xC7; break;
+ case 0x00AC: ch = 0xC2; break;
+ case 0x00AE: ch = 0xA8; break;
+ case 0x00AF: ch = 0xF8; break;
+ case 0x00B0: ch = 0xA1; break;
+ case 0x00B4: ch = 0xAB; break;
+ case 0x00B6: ch = 0xA6; break;
+ case 0x00B7: ch = 0xE1; break;
+ case 0x00B8: ch = 0xFC; break;
+ case 0x00BA: ch = 0xBC; break;
+ case 0x00BB: ch = 0xC8; break;
+ case 0x00BF: ch = 0xC0; break;
+ case 0x00C0: ch = 0xCB; break;
+ case 0x00C1: ch = 0xE7; break;
+ case 0x00C2: ch = 0xE5; break;
+ case 0x00C3: ch = 0xCC; break;
+ case 0x00C4: ch = 0x80; break;
+ case 0x00C5: ch = 0x81; break;
+ case 0x00C6: ch = 0xAE; break;
+ case 0x00C7: ch = 0x82; break;
+ case 0x00C8: ch = 0xE9; break;
+ case 0x00C9: ch = 0x83; break;
+ case 0x00CA: ch = 0xE6; break;
+ case 0x00CB: ch = 0xE8; break;
+ case 0x00CC: ch = 0xED; break;
+ case 0x00CD: ch = 0xEA; break;
+ case 0x00CE: ch = 0xEB; break;
+ case 0x00CF: ch = 0xEC; break;
+ case 0x00D1: ch = 0x84; break;
+ case 0x00D2: ch = 0xF1; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEF; break;
+ case 0x00D5: ch = 0xCD; break;
+ case 0x00D6: ch = 0x85; break;
+ case 0x00D8: ch = 0xAF; break;
+ case 0x00D9: ch = 0xF4; break;
+ case 0x00DA: ch = 0xF2; break;
+ case 0x00DB: ch = 0xF3; break;
+ case 0x00DC: ch = 0x86; break;
+ case 0x00DF: ch = 0xA7; break;
+ case 0x00E0: ch = 0x88; break;
+ case 0x00E1: ch = 0x87; break;
+ case 0x00E2: ch = 0x89; break;
+ case 0x00E3: ch = 0x8B; break;
+ case 0x00E4: ch = 0x8A; break;
+ case 0x00E5: ch = 0x8C; break;
+ case 0x00E6: ch = 0xBE; break;
+ case 0x00E7: ch = 0x8D; break;
+ case 0x00E8: ch = 0x8F; break;
+ case 0x00E9: ch = 0x8E; break;
+ case 0x00EA: ch = 0x90; break;
+ case 0x00EB: ch = 0x91; break;
+ case 0x00EC: ch = 0x93; break;
+ case 0x00ED: ch = 0x92; break;
+ case 0x00EE: ch = 0x94; break;
+ case 0x00EF: ch = 0x95; break;
+ case 0x00F1: ch = 0x96; break;
+ case 0x00F2: ch = 0x98; break;
+ case 0x00F3: ch = 0x97; break;
+ case 0x00F4: ch = 0x99; break;
+ case 0x00F5: ch = 0x9B; break;
+ case 0x00F6: ch = 0x9A; break;
+ case 0x00F7: ch = 0xD6; break;
+ case 0x00F8: ch = 0xBF; break;
+ case 0x00F9: ch = 0x9D; break;
+ case 0x00FA: ch = 0x9C; break;
+ case 0x00FB: ch = 0x9E; break;
+ case 0x00FC: ch = 0x9F; break;
+ case 0x00FF: ch = 0xD8; break;
+ case 0x0131: ch = 0xF5; break;
+ case 0x0152: ch = 0xCE; break;
+ case 0x0153: ch = 0xCF; break;
+ case 0x0178: ch = 0xD9; break;
+ case 0x0192: ch = 0xC4; break;
+ case 0x02C6: ch = 0xF6; break;
+ case 0x02C7: ch = 0xFF; break;
+ case 0x02D8: ch = 0xF9; break;
+ case 0x02D9: ch = 0xFA; break;
+ case 0x02DA: ch = 0xFB; break;
+ case 0x02DB: ch = 0xFE; break;
+ case 0x02DC: ch = 0xF7; break;
+ case 0x02DD: ch = 0xFD; break;
+ case 0x03C0: ch = 0xB9; break;
+ case 0x2013: ch = 0xD0; break;
+ case 0x2014: ch = 0xD1; break;
+ case 0x2018: ch = 0xD4; break;
+ case 0x2019: ch = 0xD5; break;
+ case 0x201A: ch = 0xE2; break;
+ case 0x201C: ch = 0xD2; break;
+ case 0x201D: ch = 0xD3; break;
+ case 0x201E: ch = 0xE3; break;
+ case 0x2020: ch = 0xA0; break;
+ case 0x2021: ch = 0xE0; break;
+ case 0x2022: ch = 0xA5; break;
+ case 0x2026: ch = 0xC9; break;
+ case 0x2030: ch = 0xE4; break;
+ case 0x2039: ch = 0xDC; break;
+ case 0x203A: ch = 0xDD; break;
+ case 0x2044: ch = 0xDA; break;
+ case 0x2122: ch = 0xAA; break;
+ case 0x2126: ch = 0xBD; break;
+ case 0x2202: ch = 0xB6; break;
+ case 0x2206: ch = 0xC6; break;
+ case 0x220F: ch = 0xB8; break;
+ case 0x2211: ch = 0xB7; break;
+ case 0x221A: ch = 0xC3; break;
+ case 0x221E: ch = 0xB0; break;
+ case 0x222B: ch = 0xBA; break;
+ case 0x2248: ch = 0xC5; break;
+ case 0x2260: ch = 0xAD; break;
+ case 0x2264: ch = 0xB2; break;
+ case 0x2265: ch = 0xB3; break;
+ case 0x2318: ch = 0x11; break;
+ case 0x25CA: ch = 0xD7; break;
+ case 0x2666: ch = 0x13; break;
+ case 0x2713: ch = 0x12; break;
+ case 0xF8FF: ch = 0xF0; break;
+ case 0xFB01: ch = 0xDE; break;
+ case 0xFB02: ch = 0xDF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A9:
+ case 0x00B1:
+ case 0x00B5:
+ break;
+ case 0x00A0: ch = 0xCA; break;
+ case 0x00A1: ch = 0xC1; break;
+ case 0x00A4: ch = 0xDB; break;
+ case 0x00A5: ch = 0xB4; break;
+ case 0x00A7: ch = 0xA4; break;
+ case 0x00A8: ch = 0xAC; break;
+ case 0x00AA: ch = 0xBB; break;
+ case 0x00AB: ch = 0xC7; break;
+ case 0x00AC: ch = 0xC2; break;
+ case 0x00AE: ch = 0xA8; break;
+ case 0x00AF: ch = 0xF8; break;
+ case 0x00B0: ch = 0xA1; break;
+ case 0x00B4: ch = 0xAB; break;
+ case 0x00B6: ch = 0xA6; break;
+ case 0x00B7: ch = 0xE1; break;
+ case 0x00B8: ch = 0xFC; break;
+ case 0x00BA: ch = 0xBC; break;
+ case 0x00BB: ch = 0xC8; break;
+ case 0x00BF: ch = 0xC0; break;
+ case 0x00C0: ch = 0xCB; break;
+ case 0x00C1: ch = 0xE7; break;
+ case 0x00C2: ch = 0xE5; break;
+ case 0x00C3: ch = 0xCC; break;
+ case 0x00C4: ch = 0x80; break;
+ case 0x00C5: ch = 0x81; break;
+ case 0x00C6: ch = 0xAE; break;
+ case 0x00C7: ch = 0x82; break;
+ case 0x00C8: ch = 0xE9; break;
+ case 0x00C9: ch = 0x83; break;
+ case 0x00CA: ch = 0xE6; break;
+ case 0x00CB: ch = 0xE8; break;
+ case 0x00CC: ch = 0xED; break;
+ case 0x00CD: ch = 0xEA; break;
+ case 0x00CE: ch = 0xEB; break;
+ case 0x00CF: ch = 0xEC; break;
+ case 0x00D1: ch = 0x84; break;
+ case 0x00D2: ch = 0xF1; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEF; break;
+ case 0x00D5: ch = 0xCD; break;
+ case 0x00D6: ch = 0x85; break;
+ case 0x00D8: ch = 0xAF; break;
+ case 0x00D9: ch = 0xF4; break;
+ case 0x00DA: ch = 0xF2; break;
+ case 0x00DB: ch = 0xF3; break;
+ case 0x00DC: ch = 0x86; break;
+ case 0x00DF: ch = 0xA7; break;
+ case 0x00E0: ch = 0x88; break;
+ case 0x00E1: ch = 0x87; break;
+ case 0x00E2: ch = 0x89; break;
+ case 0x00E3: ch = 0x8B; break;
+ case 0x00E4: ch = 0x8A; break;
+ case 0x00E5: ch = 0x8C; break;
+ case 0x00E6: ch = 0xBE; break;
+ case 0x00E7: ch = 0x8D; break;
+ case 0x00E8: ch = 0x8F; break;
+ case 0x00E9: ch = 0x8E; break;
+ case 0x00EA: ch = 0x90; break;
+ case 0x00EB: ch = 0x91; break;
+ case 0x00EC: ch = 0x93; break;
+ case 0x00ED: ch = 0x92; break;
+ case 0x00EE: ch = 0x94; break;
+ case 0x00EF: ch = 0x95; break;
+ case 0x00F1: ch = 0x96; break;
+ case 0x00F2: ch = 0x98; break;
+ case 0x00F3: ch = 0x97; break;
+ case 0x00F4: ch = 0x99; break;
+ case 0x00F5: ch = 0x9B; break;
+ case 0x00F6: ch = 0x9A; break;
+ case 0x00F7: ch = 0xD6; break;
+ case 0x00F8: ch = 0xBF; break;
+ case 0x00F9: ch = 0x9D; break;
+ case 0x00FA: ch = 0x9C; break;
+ case 0x00FB: ch = 0x9E; break;
+ case 0x00FC: ch = 0x9F; break;
+ case 0x00FF: ch = 0xD8; break;
+ case 0x0131: ch = 0xF5; break;
+ case 0x0152: ch = 0xCE; break;
+ case 0x0153: ch = 0xCF; break;
+ case 0x0178: ch = 0xD9; break;
+ case 0x0192: ch = 0xC4; break;
+ case 0x02C6: ch = 0xF6; break;
+ case 0x02C7: ch = 0xFF; break;
+ case 0x02D8: ch = 0xF9; break;
+ case 0x02D9: ch = 0xFA; break;
+ case 0x02DA: ch = 0xFB; break;
+ case 0x02DB: ch = 0xFE; break;
+ case 0x02DC: ch = 0xF7; break;
+ case 0x02DD: ch = 0xFD; break;
+ case 0x03C0: ch = 0xB9; break;
+ case 0x2013: ch = 0xD0; break;
+ case 0x2014: ch = 0xD1; break;
+ case 0x2018: ch = 0xD4; break;
+ case 0x2019: ch = 0xD5; break;
+ case 0x201A: ch = 0xE2; break;
+ case 0x201C: ch = 0xD2; break;
+ case 0x201D: ch = 0xD3; break;
+ case 0x201E: ch = 0xE3; break;
+ case 0x2020: ch = 0xA0; break;
+ case 0x2021: ch = 0xE0; break;
+ case 0x2022: ch = 0xA5; break;
+ case 0x2026: ch = 0xC9; break;
+ case 0x2030: ch = 0xE4; break;
+ case 0x2039: ch = 0xDC; break;
+ case 0x203A: ch = 0xDD; break;
+ case 0x2044: ch = 0xDA; break;
+ case 0x2122: ch = 0xAA; break;
+ case 0x2126: ch = 0xBD; break;
+ case 0x2202: ch = 0xB6; break;
+ case 0x2206: ch = 0xC6; break;
+ case 0x220F: ch = 0xB8; break;
+ case 0x2211: ch = 0xB7; break;
+ case 0x221A: ch = 0xC3; break;
+ case 0x221E: ch = 0xB0; break;
+ case 0x222B: ch = 0xBA; break;
+ case 0x2248: ch = 0xC5; break;
+ case 0x2260: ch = 0xAD; break;
+ case 0x2264: ch = 0xB2; break;
+ case 0x2265: ch = 0xB3; break;
+ case 0x2318: ch = 0x11; break;
+ case 0x25CA: ch = 0xD7; break;
+ case 0x2666: ch = 0x13; break;
+ case 0x2713: ch = 0x12; break;
+ case 0xF8FF: ch = 0xF0; break;
+ case 0xFB01: ch = 0xDE; break;
+ case 0xFB02: ch = 0xDF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP10000
+
+public class ENCmacintosh : CP10000
+{
+ public ENCmacintosh() : base() {}
+
+}; // class ENCmacintosh
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP10079.cs b/mcs/class/I18N/West/CP10079.cs
new file mode 100644
index 00000000000..3c2d04e67d5
--- /dev/null
+++ b/mcs/class/I18N/West/CP10079.cs
@@ -0,0 +1,381 @@
+/*
+ * CP10079.cs - Icelandic (Mac) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "mac-is.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP10079 : ByteEncoding
+{
+ public CP10079()
+ : base(10079, ToChars, "Icelandic (Mac)",
+ "x-mac-icelandic", "x-mac-icelandic", "x-mac-icelandic",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u00C4', '\u00C5', '\u00C7', '\u00C9',
+ '\u00D1', '\u00D6', '\u00DC', '\u00E1', '\u00E0', '\u00E2',
+ '\u00E4', '\u00E3', '\u00E5', '\u00E7', '\u00E9', '\u00E8',
+ '\u00EA', '\u00EB', '\u00ED', '\u00EC', '\u00EE', '\u00EF',
+ '\u00F1', '\u00F3', '\u00F2', '\u00F4', '\u00F6', '\u00F5',
+ '\u00FA', '\u00F9', '\u00FB', '\u00FC', '\u2020', '\u00B0',
+ '\u00A2', '\u00A3', '\u00A7', '\u2022', '\u00B6', '\u00DF',
+ '\u00AE', '\u00A9', '\u2122', '\u00B4', '\u00A8', '\u2260',
+ '\u00C6', '\u00D8', '\u221E', '\u00B1', '\u2264', '\u2265',
+ '\u00A5', '\u00B5', '\u2202', '\u2211', '\u220F', '\u03C0',
+ '\u222B', '\u00AA', '\u00BA', '\u03A9', '\u00E6', '\u00F8',
+ '\u00BF', '\u00A1', '\u00AC', '\u221A', '\u0192', '\u2248',
+ '\u0394', '\u00AB', '\u00BB', '\u2026', '\u00A0', '\u00C0',
+ '\u00C3', '\u00D5', '\u0152', '\u0153', '\u2014', '\u2013',
+ '\u201C', '\u201D', '\u2018', '\u2019', '\u00F7', '\u25C6',
+ '\u00FF', '\u0178', '\u2044', '\u00A4', '\u0110', '\u0111',
+ '\u00DE', '\u00FE', '\u2021', '\u00B7', '\u201A', '\u201E',
+ '\u2030', '\u00C2', '\u00CA', '\u00C1', '\u00CB', '\u00C8',
+ '\u00CD', '\u00CE', '\u00CF', '\u00CC', '\u00D3', '\u00D4',
+ '\uE01E', '\u00D2', '\u00DA', '\u00DB', '\u00D9', '\u0131',
+ '\u003F', '\u003F', '\u00AF', '\u02D8', '\u02D9', '\u02DA',
+ '\u00B8', '\u02DD', '\u02DB', '\u02C7',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A9:
+ case 0x00B1:
+ case 0x00B5:
+ case 0x00DE:
+ break;
+ case 0x00A0: ch = 0xCA; break;
+ case 0x00A1: ch = 0xC1; break;
+ case 0x00A4: ch = 0xDB; break;
+ case 0x00A5: ch = 0xB4; break;
+ case 0x00A7: ch = 0xA4; break;
+ case 0x00A8: ch = 0xAC; break;
+ case 0x00AA: ch = 0xBB; break;
+ case 0x00AB: ch = 0xC7; break;
+ case 0x00AC: ch = 0xC2; break;
+ case 0x00AE: ch = 0xA8; break;
+ case 0x00AF: ch = 0xF8; break;
+ case 0x00B0: ch = 0xA1; break;
+ case 0x00B4: ch = 0xAB; break;
+ case 0x00B6: ch = 0xA6; break;
+ case 0x00B7: ch = 0xE1; break;
+ case 0x00B8: ch = 0xFC; break;
+ case 0x00BA: ch = 0xBC; break;
+ case 0x00BB: ch = 0xC8; break;
+ case 0x00BF: ch = 0xC0; break;
+ case 0x00C0: ch = 0xCB; break;
+ case 0x00C1: ch = 0xE7; break;
+ case 0x00C2: ch = 0xE5; break;
+ case 0x00C3: ch = 0xCC; break;
+ case 0x00C4: ch = 0x80; break;
+ case 0x00C5: ch = 0x81; break;
+ case 0x00C6: ch = 0xAE; break;
+ case 0x00C7: ch = 0x82; break;
+ case 0x00C8: ch = 0xE9; break;
+ case 0x00C9: ch = 0x83; break;
+ case 0x00CA: ch = 0xE6; break;
+ case 0x00CB: ch = 0xE8; break;
+ case 0x00CC: ch = 0xED; break;
+ case 0x00CD: ch = 0xEA; break;
+ case 0x00CE: ch = 0xEB; break;
+ case 0x00CF: ch = 0xEC; break;
+ case 0x00D1: ch = 0x84; break;
+ case 0x00D2: ch = 0xF1; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEF; break;
+ case 0x00D5: ch = 0xCD; break;
+ case 0x00D6: ch = 0x85; break;
+ case 0x00D8: ch = 0xAF; break;
+ case 0x00D9: ch = 0xF4; break;
+ case 0x00DA: ch = 0xF2; break;
+ case 0x00DB: ch = 0xF3; break;
+ case 0x00DC: ch = 0x86; break;
+ case 0x00DF: ch = 0xA7; break;
+ case 0x00E0: ch = 0x88; break;
+ case 0x00E1: ch = 0x87; break;
+ case 0x00E2: ch = 0x89; break;
+ case 0x00E3: ch = 0x8B; break;
+ case 0x00E4: ch = 0x8A; break;
+ case 0x00E5: ch = 0x8C; break;
+ case 0x00E6: ch = 0xBE; break;
+ case 0x00E7: ch = 0x8D; break;
+ case 0x00E8: ch = 0x8F; break;
+ case 0x00E9: ch = 0x8E; break;
+ case 0x00EA: ch = 0x90; break;
+ case 0x00EB: ch = 0x91; break;
+ case 0x00EC: ch = 0x93; break;
+ case 0x00ED: ch = 0x92; break;
+ case 0x00EE: ch = 0x94; break;
+ case 0x00EF: ch = 0x95; break;
+ case 0x00F1: ch = 0x96; break;
+ case 0x00F2: ch = 0x98; break;
+ case 0x00F3: ch = 0x97; break;
+ case 0x00F4: ch = 0x99; break;
+ case 0x00F5: ch = 0x9B; break;
+ case 0x00F6: ch = 0x9A; break;
+ case 0x00F7: ch = 0xD6; break;
+ case 0x00F8: ch = 0xBF; break;
+ case 0x00F9: ch = 0x9D; break;
+ case 0x00FA: ch = 0x9C; break;
+ case 0x00FB: ch = 0x9E; break;
+ case 0x00FC: ch = 0x9F; break;
+ case 0x00FE: ch = 0xDF; break;
+ case 0x00FF: ch = 0xD8; break;
+ case 0x0110: ch = 0xDC; break;
+ case 0x0111: ch = 0xDD; break;
+ case 0x0131: ch = 0xF5; break;
+ case 0x0152: ch = 0xCE; break;
+ case 0x0153: ch = 0xCF; break;
+ case 0x0178: ch = 0xD9; break;
+ case 0x0192: ch = 0xC4; break;
+ case 0x02C7: ch = 0xFF; break;
+ case 0x02D8: ch = 0xF9; break;
+ case 0x02D9: ch = 0xFA; break;
+ case 0x02DA: ch = 0xFB; break;
+ case 0x02DB: ch = 0xFE; break;
+ case 0x02DD: ch = 0xFD; break;
+ case 0x0394: ch = 0xC6; break;
+ case 0x03A9: ch = 0xBD; break;
+ case 0x03C0: ch = 0xB9; break;
+ case 0x2013: ch = 0xD1; break;
+ case 0x2014: ch = 0xD0; break;
+ case 0x2018: ch = 0xD4; break;
+ case 0x2019: ch = 0xD5; break;
+ case 0x201A: ch = 0xE2; break;
+ case 0x201C: ch = 0xD2; break;
+ case 0x201D: ch = 0xD3; break;
+ case 0x201E: ch = 0xE3; break;
+ case 0x2020: ch = 0xA0; break;
+ case 0x2021: ch = 0xE0; break;
+ case 0x2022: ch = 0xA5; break;
+ case 0x2026: ch = 0xC9; break;
+ case 0x2030: ch = 0xE4; break;
+ case 0x2044: ch = 0xDA; break;
+ case 0x2122: ch = 0xAA; break;
+ case 0x2202: ch = 0xB6; break;
+ case 0x220F: ch = 0xB8; break;
+ case 0x2211: ch = 0xB7; break;
+ case 0x221A: ch = 0xC3; break;
+ case 0x221E: ch = 0xB0; break;
+ case 0x222B: ch = 0xBA; break;
+ case 0x2248: ch = 0xC5; break;
+ case 0x2260: ch = 0xAD; break;
+ case 0x2264: ch = 0xB2; break;
+ case 0x2265: ch = 0xB3; break;
+ case 0x25C6: ch = 0xD7; break;
+ case 0xE01E: ch = 0xF0; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A9:
+ case 0x00B1:
+ case 0x00B5:
+ case 0x00DE:
+ break;
+ case 0x00A0: ch = 0xCA; break;
+ case 0x00A1: ch = 0xC1; break;
+ case 0x00A4: ch = 0xDB; break;
+ case 0x00A5: ch = 0xB4; break;
+ case 0x00A7: ch = 0xA4; break;
+ case 0x00A8: ch = 0xAC; break;
+ case 0x00AA: ch = 0xBB; break;
+ case 0x00AB: ch = 0xC7; break;
+ case 0x00AC: ch = 0xC2; break;
+ case 0x00AE: ch = 0xA8; break;
+ case 0x00AF: ch = 0xF8; break;
+ case 0x00B0: ch = 0xA1; break;
+ case 0x00B4: ch = 0xAB; break;
+ case 0x00B6: ch = 0xA6; break;
+ case 0x00B7: ch = 0xE1; break;
+ case 0x00B8: ch = 0xFC; break;
+ case 0x00BA: ch = 0xBC; break;
+ case 0x00BB: ch = 0xC8; break;
+ case 0x00BF: ch = 0xC0; break;
+ case 0x00C0: ch = 0xCB; break;
+ case 0x00C1: ch = 0xE7; break;
+ case 0x00C2: ch = 0xE5; break;
+ case 0x00C3: ch = 0xCC; break;
+ case 0x00C4: ch = 0x80; break;
+ case 0x00C5: ch = 0x81; break;
+ case 0x00C6: ch = 0xAE; break;
+ case 0x00C7: ch = 0x82; break;
+ case 0x00C8: ch = 0xE9; break;
+ case 0x00C9: ch = 0x83; break;
+ case 0x00CA: ch = 0xE6; break;
+ case 0x00CB: ch = 0xE8; break;
+ case 0x00CC: ch = 0xED; break;
+ case 0x00CD: ch = 0xEA; break;
+ case 0x00CE: ch = 0xEB; break;
+ case 0x00CF: ch = 0xEC; break;
+ case 0x00D1: ch = 0x84; break;
+ case 0x00D2: ch = 0xF1; break;
+ case 0x00D3: ch = 0xEE; break;
+ case 0x00D4: ch = 0xEF; break;
+ case 0x00D5: ch = 0xCD; break;
+ case 0x00D6: ch = 0x85; break;
+ case 0x00D8: ch = 0xAF; break;
+ case 0x00D9: ch = 0xF4; break;
+ case 0x00DA: ch = 0xF2; break;
+ case 0x00DB: ch = 0xF3; break;
+ case 0x00DC: ch = 0x86; break;
+ case 0x00DF: ch = 0xA7; break;
+ case 0x00E0: ch = 0x88; break;
+ case 0x00E1: ch = 0x87; break;
+ case 0x00E2: ch = 0x89; break;
+ case 0x00E3: ch = 0x8B; break;
+ case 0x00E4: ch = 0x8A; break;
+ case 0x00E5: ch = 0x8C; break;
+ case 0x00E6: ch = 0xBE; break;
+ case 0x00E7: ch = 0x8D; break;
+ case 0x00E8: ch = 0x8F; break;
+ case 0x00E9: ch = 0x8E; break;
+ case 0x00EA: ch = 0x90; break;
+ case 0x00EB: ch = 0x91; break;
+ case 0x00EC: ch = 0x93; break;
+ case 0x00ED: ch = 0x92; break;
+ case 0x00EE: ch = 0x94; break;
+ case 0x00EF: ch = 0x95; break;
+ case 0x00F1: ch = 0x96; break;
+ case 0x00F2: ch = 0x98; break;
+ case 0x00F3: ch = 0x97; break;
+ case 0x00F4: ch = 0x99; break;
+ case 0x00F5: ch = 0x9B; break;
+ case 0x00F6: ch = 0x9A; break;
+ case 0x00F7: ch = 0xD6; break;
+ case 0x00F8: ch = 0xBF; break;
+ case 0x00F9: ch = 0x9D; break;
+ case 0x00FA: ch = 0x9C; break;
+ case 0x00FB: ch = 0x9E; break;
+ case 0x00FC: ch = 0x9F; break;
+ case 0x00FE: ch = 0xDF; break;
+ case 0x00FF: ch = 0xD8; break;
+ case 0x0110: ch = 0xDC; break;
+ case 0x0111: ch = 0xDD; break;
+ case 0x0131: ch = 0xF5; break;
+ case 0x0152: ch = 0xCE; break;
+ case 0x0153: ch = 0xCF; break;
+ case 0x0178: ch = 0xD9; break;
+ case 0x0192: ch = 0xC4; break;
+ case 0x02C7: ch = 0xFF; break;
+ case 0x02D8: ch = 0xF9; break;
+ case 0x02D9: ch = 0xFA; break;
+ case 0x02DA: ch = 0xFB; break;
+ case 0x02DB: ch = 0xFE; break;
+ case 0x02DD: ch = 0xFD; break;
+ case 0x0394: ch = 0xC6; break;
+ case 0x03A9: ch = 0xBD; break;
+ case 0x03C0: ch = 0xB9; break;
+ case 0x2013: ch = 0xD1; break;
+ case 0x2014: ch = 0xD0; break;
+ case 0x2018: ch = 0xD4; break;
+ case 0x2019: ch = 0xD5; break;
+ case 0x201A: ch = 0xE2; break;
+ case 0x201C: ch = 0xD2; break;
+ case 0x201D: ch = 0xD3; break;
+ case 0x201E: ch = 0xE3; break;
+ case 0x2020: ch = 0xA0; break;
+ case 0x2021: ch = 0xE0; break;
+ case 0x2022: ch = 0xA5; break;
+ case 0x2026: ch = 0xC9; break;
+ case 0x2030: ch = 0xE4; break;
+ case 0x2044: ch = 0xDA; break;
+ case 0x2122: ch = 0xAA; break;
+ case 0x2202: ch = 0xB6; break;
+ case 0x220F: ch = 0xB8; break;
+ case 0x2211: ch = 0xB7; break;
+ case 0x221A: ch = 0xC3; break;
+ case 0x221E: ch = 0xB0; break;
+ case 0x222B: ch = 0xBA; break;
+ case 0x2248: ch = 0xC5; break;
+ case 0x2260: ch = 0xAD; break;
+ case 0x2264: ch = 0xB2; break;
+ case 0x2265: ch = 0xB3; break;
+ case 0x25C6: ch = 0xD7; break;
+ case 0xE01E: ch = 0xF0; break;
+ default: ch = 0x3F; break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP10079
+
+public class ENCx_mac_icelandic : CP10079
+{
+ public ENCx_mac_icelandic() : base() {}
+
+}; // class ENCx_mac_icelandic
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP1250.cs b/mcs/class/I18N/West/CP1250.cs
new file mode 100644
index 00000000000..1cdd1d56f4b
--- /dev/null
+++ b/mcs/class/I18N/West/CP1250.cs
@@ -0,0 +1,399 @@
+/*
+ * CP1250.cs - Central European (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5346.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP1250 : ByteEncoding
+{
+ public CP1250()
+ : base(1250, ToChars, "Central European (Windows)",
+ "iso-8859-2", "windows-1250", "windows-1250",
+ true, true, true, true, 1250)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0083',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u0088', '\u2030',
+ '\u0160', '\u2039', '\u015A', '\u0164', '\u017D', '\u0179',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u0098', '\u2122', '\u0161', '\u203A',
+ '\u015B', '\u0165', '\u017E', '\u017A', '\u00A0', '\u02C7',
+ '\u02D8', '\u0141', '\u00A4', '\u0104', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u015E', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u017B', '\u00B0', '\u00B1', '\u02DB', '\u0142',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u0105',
+ '\u015F', '\u00BB', '\u013D', '\u02DD', '\u013E', '\u017C',
+ '\u0154', '\u00C1', '\u00C2', '\u0102', '\u00C4', '\u0139',
+ '\u0106', '\u00C7', '\u010C', '\u00C9', '\u0118', '\u00CB',
+ '\u011A', '\u00CD', '\u00CE', '\u010E', '\u0110', '\u0143',
+ '\u0147', '\u00D3', '\u00D4', '\u0150', '\u00D6', '\u00D7',
+ '\u0158', '\u016E', '\u00DA', '\u0170', '\u00DC', '\u00DD',
+ '\u0162', '\u00DF', '\u0155', '\u00E1', '\u00E2', '\u0103',
+ '\u00E4', '\u013A', '\u0107', '\u00E7', '\u010D', '\u00E9',
+ '\u0119', '\u00EB', '\u011B', '\u00ED', '\u00EE', '\u010F',
+ '\u0111', '\u0144', '\u0148', '\u00F3', '\u00F4', '\u0151',
+ '\u00F6', '\u00F7', '\u0159', '\u016F', '\u00FA', '\u0171',
+ '\u00FC', '\u00FD', '\u0163', '\u02D9',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x0083:
+ case 0x0088:
+ case 0x0090:
+ case 0x0098:
+ case 0x00A0:
+ case 0x00A4:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00BB:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C7:
+ case 0x00C9:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00DA:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DF:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E7:
+ case 0x00E9:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00FA:
+ case 0x00FC:
+ case 0x00FD:
+ break;
+ case 0x0102: ch = 0xC3; break;
+ case 0x0103: ch = 0xE3; break;
+ case 0x0104: ch = 0xA5; break;
+ case 0x0105: ch = 0xB9; break;
+ case 0x0106: ch = 0xC6; break;
+ case 0x0107: ch = 0xE6; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x010E: ch = 0xCF; break;
+ case 0x010F: ch = 0xEF; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0118: ch = 0xCA; break;
+ case 0x0119: ch = 0xEA; break;
+ case 0x011A: ch = 0xCC; break;
+ case 0x011B: ch = 0xEC; break;
+ case 0x0139: ch = 0xC5; break;
+ case 0x013A: ch = 0xE5; break;
+ case 0x013D: ch = 0xBC; break;
+ case 0x013E: ch = 0xBE; break;
+ case 0x0141: ch = 0xA3; break;
+ case 0x0142: ch = 0xB3; break;
+ case 0x0143: ch = 0xD1; break;
+ case 0x0144: ch = 0xF1; break;
+ case 0x0147: ch = 0xD2; break;
+ case 0x0148: ch = 0xF2; break;
+ case 0x0150: ch = 0xD5; break;
+ case 0x0151: ch = 0xF5; break;
+ case 0x0154: ch = 0xC0; break;
+ case 0x0155: ch = 0xE0; break;
+ case 0x0158: ch = 0xD8; break;
+ case 0x0159: ch = 0xF8; break;
+ case 0x015A: ch = 0x8C; break;
+ case 0x015B: ch = 0x9C; break;
+ case 0x015E: ch = 0xAA; break;
+ case 0x015F: ch = 0xBA; break;
+ case 0x0160: ch = 0x8A; break;
+ case 0x0161: ch = 0x9A; break;
+ case 0x0162: ch = 0xDE; break;
+ case 0x0163: ch = 0xFE; break;
+ case 0x0164: ch = 0x8D; break;
+ case 0x0165: ch = 0x9D; break;
+ case 0x016E: ch = 0xD9; break;
+ case 0x016F: ch = 0xF9; break;
+ case 0x0170: ch = 0xDB; break;
+ case 0x0171: ch = 0xFB; break;
+ case 0x0179: ch = 0x8F; break;
+ case 0x017A: ch = 0x9F; break;
+ case 0x017B: ch = 0xAF; break;
+ case 0x017C: ch = 0xBF; break;
+ case 0x017D: ch = 0x8E; break;
+ case 0x017E: ch = 0x9E; break;
+ case 0x02C7: ch = 0xA1; break;
+ case 0x02D8: ch = 0xA2; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0xB2; break;
+ case 0x02DD: ch = 0xBD; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x0083:
+ case 0x0088:
+ case 0x0090:
+ case 0x0098:
+ case 0x00A0:
+ case 0x00A4:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00BB:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C7:
+ case 0x00C9:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00DA:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DF:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E7:
+ case 0x00E9:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00FA:
+ case 0x00FC:
+ case 0x00FD:
+ break;
+ case 0x0102: ch = 0xC3; break;
+ case 0x0103: ch = 0xE3; break;
+ case 0x0104: ch = 0xA5; break;
+ case 0x0105: ch = 0xB9; break;
+ case 0x0106: ch = 0xC6; break;
+ case 0x0107: ch = 0xE6; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x010E: ch = 0xCF; break;
+ case 0x010F: ch = 0xEF; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0118: ch = 0xCA; break;
+ case 0x0119: ch = 0xEA; break;
+ case 0x011A: ch = 0xCC; break;
+ case 0x011B: ch = 0xEC; break;
+ case 0x0139: ch = 0xC5; break;
+ case 0x013A: ch = 0xE5; break;
+ case 0x013D: ch = 0xBC; break;
+ case 0x013E: ch = 0xBE; break;
+ case 0x0141: ch = 0xA3; break;
+ case 0x0142: ch = 0xB3; break;
+ case 0x0143: ch = 0xD1; break;
+ case 0x0144: ch = 0xF1; break;
+ case 0x0147: ch = 0xD2; break;
+ case 0x0148: ch = 0xF2; break;
+ case 0x0150: ch = 0xD5; break;
+ case 0x0151: ch = 0xF5; break;
+ case 0x0154: ch = 0xC0; break;
+ case 0x0155: ch = 0xE0; break;
+ case 0x0158: ch = 0xD8; break;
+ case 0x0159: ch = 0xF8; break;
+ case 0x015A: ch = 0x8C; break;
+ case 0x015B: ch = 0x9C; break;
+ case 0x015E: ch = 0xAA; break;
+ case 0x015F: ch = 0xBA; break;
+ case 0x0160: ch = 0x8A; break;
+ case 0x0161: ch = 0x9A; break;
+ case 0x0162: ch = 0xDE; break;
+ case 0x0163: ch = 0xFE; break;
+ case 0x0164: ch = 0x8D; break;
+ case 0x0165: ch = 0x9D; break;
+ case 0x016E: ch = 0xD9; break;
+ case 0x016F: ch = 0xF9; break;
+ case 0x0170: ch = 0xDB; break;
+ case 0x0171: ch = 0xFB; break;
+ case 0x0179: ch = 0x8F; break;
+ case 0x017A: ch = 0x9F; break;
+ case 0x017B: ch = 0xAF; break;
+ case 0x017C: ch = 0xBF; break;
+ case 0x017D: ch = 0x8E; break;
+ case 0x017E: ch = 0x9E; break;
+ case 0x02C7: ch = 0xA1; break;
+ case 0x02D8: ch = 0xA2; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0xB2; break;
+ case 0x02DD: ch = 0xBD; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1250
+
+public class ENCwindows_1250 : CP1250
+{
+ public ENCwindows_1250() : base() {}
+
+}; // class ENCwindows_1250
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP1252.cs b/mcs/class/I18N/West/CP1252.cs
new file mode 100644
index 00000000000..291ef914bf4
--- /dev/null
+++ b/mcs/class/I18N/West/CP1252.cs
@@ -0,0 +1,399 @@
+/*
+ * CP1252.cs - Western European (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5348.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP1252 : ByteEncoding
+{
+ public CP1252()
+ : base(1252, ToChars, "Western European (Windows)",
+ "iso-8859-1", "Windows-1252", "Windows-1252",
+ true, true, true, true, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0192',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u02C6', '\u2030',
+ '\u0160', '\u2039', '\u0152', '\u008D', '\u017D', '\u008F',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u02DC', '\u2122', '\u0161', '\u203A',
+ '\u0153', '\u009D', '\u017E', '\u0178', '\u00A0', '\u00A1',
+ '\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u00B6', '\u00B7', '\u00B8', '\u00B9',
+ '\u00BA', '\u00BB', '\u00BC', '\u00BD', '\u00BE', '\u00BF',
+ '\u00C0', '\u00C1', '\u00C2', '\u00C3', '\u00C4', '\u00C5',
+ '\u00C6', '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB',
+ '\u00CC', '\u00CD', '\u00CE', '\u00CF', '\u00D0', '\u00D1',
+ '\u00D2', '\u00D3', '\u00D4', '\u00D5', '\u00D6', '\u00D7',
+ '\u00D8', '\u00D9', '\u00DA', '\u00DB', '\u00DC', '\u00DD',
+ '\u00DE', '\u00DF', '\u00E0', '\u00E1', '\u00E2', '\u00E3',
+ '\u00E4', '\u00E5', '\u00E6', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u00EC', '\u00ED', '\u00EE', '\u00EF',
+ '\u00F0', '\u00F1', '\u00F2', '\u00F3', '\u00F4', '\u00F5',
+ '\u00F6', '\u00F7', '\u00F8', '\u00F9', '\u00FA', '\u00FB',
+ '\u00FC', '\u00FD', '\u00FE', '\u00FF',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008D:
+ case 0x008F:
+ case 0x0090:
+ case 0x009D:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D0:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DE:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F0:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FD:
+ case 0x00FE:
+ case 0x00FF:
+ break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x0160: ch = 0x8A; break;
+ case 0x0161: ch = 0x9A; break;
+ case 0x0178: ch = 0x9F; break;
+ case 0x017D: ch = 0x8E; break;
+ case 0x017E: ch = 0x9E; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x008D:
+ case 0x008F:
+ case 0x0090:
+ case 0x009D:
+ case 0x00A0:
+ case 0x00A1:
+ case 0x00A2:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BC:
+ case 0x00BD:
+ case 0x00BE:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D0:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DE:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F0:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FD:
+ case 0x00FE:
+ case 0x00FF:
+ break;
+ case 0x0152: ch = 0x8C; break;
+ case 0x0153: ch = 0x9C; break;
+ case 0x0160: ch = 0x8A; break;
+ case 0x0161: ch = 0x9A; break;
+ case 0x0178: ch = 0x9F; break;
+ case 0x017D: ch = 0x8E; break;
+ case 0x017E: ch = 0x9E; break;
+ case 0x0192: ch = 0x83; break;
+ case 0x02C6: ch = 0x88; break;
+ case 0x02DC: ch = 0x98; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1252
+
+public class ENCwindows_1252 : CP1252
+{
+ public ENCwindows_1252() : base() {}
+
+}; // class ENCwindows_1252
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP1253.cs b/mcs/class/I18N/West/CP1253.cs
new file mode 100644
index 00000000000..70a1d1c0c06
--- /dev/null
+++ b/mcs/class/I18N/West/CP1253.cs
@@ -0,0 +1,405 @@
+/*
+ * CP1253.cs - Greek (Windows) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-5349.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP1253 : ByteEncoding
+{
+ public CP1253()
+ : base(1253, ToChars, "Greek (Windows)",
+ "iso-8859-7", "windows-1253", "windows-1253",
+ true, true, true, true, 1253)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u20AC', '\u0081', '\u201A', '\u0192',
+ '\u201E', '\u2026', '\u2020', '\u2021', '\u0088', '\u2030',
+ '\u008A', '\u2039', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022',
+ '\u2013', '\u2014', '\u0098', '\u2122', '\u009A', '\u203A',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u0385',
+ '\u0386', '\u00A3', '\u00A4', '\u00A5', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u2015', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u0384', '\u00B5', '\u00B6', '\u00B7', '\u0388', '\u0389',
+ '\u038A', '\u00BB', '\u038C', '\u00BD', '\u038E', '\u038F',
+ '\u0390', '\u0391', '\u0392', '\u0393', '\u0394', '\u0395',
+ '\u0396', '\u0397', '\u0398', '\u0399', '\u039A', '\u039B',
+ '\u039C', '\u039D', '\u039E', '\u039F', '\u03A0', '\u03A1',
+ '\u003F', '\u03A3', '\u03A4', '\u03A5', '\u03A6', '\u03A7',
+ '\u03A8', '\u03A9', '\u03AA', '\u03AB', '\u03AC', '\u03AD',
+ '\u03AE', '\u03AF', '\u03B0', '\u03B1', '\u03B2', '\u03B3',
+ '\u03B4', '\u03B5', '\u03B6', '\u03B7', '\u03B8', '\u03B9',
+ '\u03BA', '\u03BB', '\u03BC', '\u03BD', '\u03BE', '\u03BF',
+ '\u03C0', '\u03C1', '\u03C2', '\u03C3', '\u03C4', '\u03C5',
+ '\u03C6', '\u03C7', '\u03C8', '\u03C9', '\u03CA', '\u03CB',
+ '\u03CC', '\u03CD', '\u03CE', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x0088:
+ case 0x008A:
+ case 0x008C:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x0098:
+ case 0x009A:
+ case 0x009C:
+ case 0x009D:
+ case 0x009E:
+ case 0x009F:
+ case 0x00A0:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00BB:
+ case 0x00BD:
+ break;
+ case 0x0192: ch = 0x83; break;
+ case 0x0384: ch = 0xB4; break;
+ case 0x0385: ch = 0xA1; break;
+ case 0x0386: ch = 0xA2; break;
+ case 0x0388: ch = 0xB8; break;
+ case 0x0389: ch = 0xB9; break;
+ case 0x038A: ch = 0xBA; break;
+ case 0x038C: ch = 0xBC; break;
+ case 0x038E:
+ case 0x038F:
+ case 0x0390:
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ case 0x0398:
+ case 0x0399:
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ case 0x039E:
+ case 0x039F:
+ case 0x03A0:
+ case 0x03A1:
+ ch -= 0x02D0;
+ break;
+ case 0x03A3:
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ case 0x03AA:
+ case 0x03AB:
+ case 0x03AC:
+ case 0x03AD:
+ case 0x03AE:
+ case 0x03AF:
+ case 0x03B0:
+ case 0x03B1:
+ case 0x03B2:
+ case 0x03B3:
+ case 0x03B4:
+ case 0x03B5:
+ case 0x03B6:
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ case 0x03C2:
+ case 0x03C3:
+ case 0x03C4:
+ case 0x03C5:
+ case 0x03C6:
+ case 0x03C7:
+ case 0x03C8:
+ case 0x03C9:
+ case 0x03CA:
+ case 0x03CB:
+ case 0x03CC:
+ case 0x03CD:
+ case 0x03CE:
+ ch -= 0x02D0;
+ break;
+ case 0x03D5: ch = 0xF6; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2015: ch = 0xAF; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 128) switch(ch)
+ {
+ case 0x0081:
+ case 0x0088:
+ case 0x008A:
+ case 0x008C:
+ case 0x008D:
+ case 0x008E:
+ case 0x008F:
+ case 0x0090:
+ case 0x0098:
+ case 0x009A:
+ case 0x009C:
+ case 0x009D:
+ case 0x009E:
+ case 0x009F:
+ case 0x00A0:
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A5:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00BB:
+ case 0x00BD:
+ break;
+ case 0x0192: ch = 0x83; break;
+ case 0x0384: ch = 0xB4; break;
+ case 0x0385: ch = 0xA1; break;
+ case 0x0386: ch = 0xA2; break;
+ case 0x0388: ch = 0xB8; break;
+ case 0x0389: ch = 0xB9; break;
+ case 0x038A: ch = 0xBA; break;
+ case 0x038C: ch = 0xBC; break;
+ case 0x038E:
+ case 0x038F:
+ case 0x0390:
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ case 0x0398:
+ case 0x0399:
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ case 0x039E:
+ case 0x039F:
+ case 0x03A0:
+ case 0x03A1:
+ ch -= 0x02D0;
+ break;
+ case 0x03A3:
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ case 0x03AA:
+ case 0x03AB:
+ case 0x03AC:
+ case 0x03AD:
+ case 0x03AE:
+ case 0x03AF:
+ case 0x03B0:
+ case 0x03B1:
+ case 0x03B2:
+ case 0x03B3:
+ case 0x03B4:
+ case 0x03B5:
+ case 0x03B6:
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ case 0x03C2:
+ case 0x03C3:
+ case 0x03C4:
+ case 0x03C5:
+ case 0x03C6:
+ case 0x03C7:
+ case 0x03C8:
+ case 0x03C9:
+ case 0x03CA:
+ case 0x03CB:
+ case 0x03CC:
+ case 0x03CD:
+ case 0x03CE:
+ ch -= 0x02D0;
+ break;
+ case 0x03D5: ch = 0xF6; break;
+ case 0x2013: ch = 0x96; break;
+ case 0x2014: ch = 0x97; break;
+ case 0x2015: ch = 0xAF; break;
+ case 0x2018: ch = 0x91; break;
+ case 0x2019: ch = 0x92; break;
+ case 0x201A: ch = 0x82; break;
+ case 0x201C: ch = 0x93; break;
+ case 0x201D: ch = 0x94; break;
+ case 0x201E: ch = 0x84; break;
+ case 0x2020: ch = 0x86; break;
+ case 0x2021: ch = 0x87; break;
+ case 0x2022: ch = 0x95; break;
+ case 0x2026: ch = 0x85; break;
+ case 0x2030: ch = 0x89; break;
+ case 0x2039: ch = 0x8B; break;
+ case 0x203A: ch = 0x9B; break;
+ case 0x20AC: ch = 0x80; break;
+ case 0x2122: ch = 0x99; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP1253
+
+public class ENCwindows_1253 : CP1253
+{
+ public ENCwindows_1253() : base() {}
+
+}; // class ENCwindows_1253
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP28592.cs b/mcs/class/I18N/West/CP28592.cs
new file mode 100644
index 00000000000..6acf2c6ad1c
--- /dev/null
+++ b/mcs/class/I18N/West/CP28592.cs
@@ -0,0 +1,471 @@
+/*
+ * CP28592.cs - Central European (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-912.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP28592 : ByteEncoding
+{
+ public CP28592()
+ : base(28592, ToChars, "Central European (ISO)",
+ "iso-8859-2", "iso-8859-2", "iso-8859-2",
+ true, true, true, true, 1250)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u0104',
+ '\u02D8', '\u0141', '\u00A4', '\u013D', '\u015A', '\u00A7',
+ '\u00A8', '\u0160', '\u015E', '\u0164', '\u0179', '\u00AD',
+ '\u017D', '\u017B', '\u00B0', '\u0105', '\u02DB', '\u0142',
+ '\u00B4', '\u013E', '\u015B', '\u02C7', '\u00B8', '\u0161',
+ '\u015F', '\u0165', '\u017A', '\u02DD', '\u017E', '\u017C',
+ '\u0154', '\u00C1', '\u00C2', '\u0102', '\u00C4', '\u0139',
+ '\u0106', '\u00C7', '\u010C', '\u00C9', '\u0118', '\u00CB',
+ '\u011A', '\u00CD', '\u00CE', '\u010E', '\u0110', '\u0143',
+ '\u0147', '\u00D3', '\u00D4', '\u0150', '\u00D6', '\u00D7',
+ '\u0158', '\u016E', '\u00DA', '\u0170', '\u00DC', '\u00DD',
+ '\u0162', '\u00DF', '\u0155', '\u00E1', '\u00E2', '\u0103',
+ '\u00E4', '\u013A', '\u0107', '\u00E7', '\u010D', '\u00E9',
+ '\u0119', '\u00EB', '\u011B', '\u00ED', '\u00EE', '\u010F',
+ '\u0111', '\u0144', '\u0148', '\u00F3', '\u00F4', '\u0151',
+ '\u00F6', '\u00F7', '\u0159', '\u016F', '\u00FA', '\u0171',
+ '\u00FC', '\u00FD', '\u0163', '\u02D9',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00AD:
+ case 0x00B0:
+ case 0x00B4:
+ case 0x00B8:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C7:
+ case 0x00C9:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D0:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00DA:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DF:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E7:
+ case 0x00E9:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00FA:
+ case 0x00FC:
+ case 0x00FD:
+ break;
+ case 0x00A2: ch = 0x8D; break;
+ case 0x00A5: ch = 0x8E; break;
+ case 0x00A9: ch = 0x88; break;
+ case 0x00AE: ch = 0x9F; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x0102: ch = 0xC3; break;
+ case 0x0103: ch = 0xE3; break;
+ case 0x0104: ch = 0xA1; break;
+ case 0x0105: ch = 0xB1; break;
+ case 0x0106: ch = 0xC6; break;
+ case 0x0107: ch = 0xE6; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x010E: ch = 0xCF; break;
+ case 0x010F: ch = 0xEF; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0118: ch = 0xCA; break;
+ case 0x0119: ch = 0xEA; break;
+ case 0x011A: ch = 0xCC; break;
+ case 0x011B: ch = 0xEC; break;
+ case 0x0139: ch = 0xC5; break;
+ case 0x013A: ch = 0xE5; break;
+ case 0x013D: ch = 0xA5; break;
+ case 0x013E: ch = 0xB5; break;
+ case 0x0141: ch = 0xA3; break;
+ case 0x0142: ch = 0xB3; break;
+ case 0x0143: ch = 0xD1; break;
+ case 0x0144: ch = 0xF1; break;
+ case 0x0147: ch = 0xD2; break;
+ case 0x0148: ch = 0xF2; break;
+ case 0x0150: ch = 0xD5; break;
+ case 0x0151: ch = 0xF5; break;
+ case 0x0154: ch = 0xC0; break;
+ case 0x0155: ch = 0xE0; break;
+ case 0x0158: ch = 0xD8; break;
+ case 0x0159: ch = 0xF8; break;
+ case 0x015A: ch = 0xA6; break;
+ case 0x015B: ch = 0xB6; break;
+ case 0x015E: ch = 0xAA; break;
+ case 0x015F: ch = 0xBA; break;
+ case 0x0160: ch = 0xA9; break;
+ case 0x0161: ch = 0xB9; break;
+ case 0x0162: ch = 0xDE; break;
+ case 0x0163: ch = 0xFE; break;
+ case 0x0164: ch = 0xAB; break;
+ case 0x0165: ch = 0xBB; break;
+ case 0x016E: ch = 0xD9; break;
+ case 0x016F: ch = 0xF9; break;
+ case 0x0170: ch = 0xDB; break;
+ case 0x0171: ch = 0xFB; break;
+ case 0x0179: ch = 0xAC; break;
+ case 0x017A: ch = 0xBC; break;
+ case 0x017B: ch = 0xAF; break;
+ case 0x017C: ch = 0xBF; break;
+ case 0x017D: ch = 0xAE; break;
+ case 0x017E: ch = 0xBE; break;
+ case 0x02C7: ch = 0xB7; break;
+ case 0x02D8: ch = 0xA2; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0xB2; break;
+ case 0x02DD: ch = 0xBD; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2500: ch = 0x94; break;
+ case 0x2502: ch = 0x83; break;
+ case 0x250C: ch = 0x86; break;
+ case 0x2510: ch = 0x8F; break;
+ case 0x2514: ch = 0x90; break;
+ case 0x2518: ch = 0x85; break;
+ case 0x251C: ch = 0x93; break;
+ case 0x2524: ch = 0x84; break;
+ case 0x252C: ch = 0x92; break;
+ case 0x2534: ch = 0x91; break;
+ case 0x253C: ch = 0x95; break;
+ case 0x2550: ch = 0x9D; break;
+ case 0x2551: ch = 0x8A; break;
+ case 0x2554: ch = 0x99; break;
+ case 0x2557: ch = 0x8B; break;
+ case 0x255A: ch = 0x98; break;
+ case 0x255D: ch = 0x8C; break;
+ case 0x2560: ch = 0x9C; break;
+ case 0x2563: ch = 0x89; break;
+ case 0x2566: ch = 0x9B; break;
+ case 0x2569: ch = 0x9A; break;
+ case 0x256C: ch = 0x9E; break;
+ case 0x2580: ch = 0x97; break;
+ case 0x2584: ch = 0x96; break;
+ case 0x2588: ch = 0x87; break;
+ case 0x2591: ch = 0x80; break;
+ case 0x2592: ch = 0x81; break;
+ case 0x2593: ch = 0x82; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0x83; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A4:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00AD:
+ case 0x00B0:
+ case 0x00B4:
+ case 0x00B8:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C7:
+ case 0x00C9:
+ case 0x00CB:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D0:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00DA:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DF:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E7:
+ case 0x00E9:
+ case 0x00EB:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00FA:
+ case 0x00FC:
+ case 0x00FD:
+ break;
+ case 0x00A2: ch = 0x8D; break;
+ case 0x00A5: ch = 0x8E; break;
+ case 0x00A9: ch = 0x88; break;
+ case 0x00AE: ch = 0x9F; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x0102: ch = 0xC3; break;
+ case 0x0103: ch = 0xE3; break;
+ case 0x0104: ch = 0xA1; break;
+ case 0x0105: ch = 0xB1; break;
+ case 0x0106: ch = 0xC6; break;
+ case 0x0107: ch = 0xE6; break;
+ case 0x010C: ch = 0xC8; break;
+ case 0x010D: ch = 0xE8; break;
+ case 0x010E: ch = 0xCF; break;
+ case 0x010F: ch = 0xEF; break;
+ case 0x0110: ch = 0xD0; break;
+ case 0x0111: ch = 0xF0; break;
+ case 0x0118: ch = 0xCA; break;
+ case 0x0119: ch = 0xEA; break;
+ case 0x011A: ch = 0xCC; break;
+ case 0x011B: ch = 0xEC; break;
+ case 0x0139: ch = 0xC5; break;
+ case 0x013A: ch = 0xE5; break;
+ case 0x013D: ch = 0xA5; break;
+ case 0x013E: ch = 0xB5; break;
+ case 0x0141: ch = 0xA3; break;
+ case 0x0142: ch = 0xB3; break;
+ case 0x0143: ch = 0xD1; break;
+ case 0x0144: ch = 0xF1; break;
+ case 0x0147: ch = 0xD2; break;
+ case 0x0148: ch = 0xF2; break;
+ case 0x0150: ch = 0xD5; break;
+ case 0x0151: ch = 0xF5; break;
+ case 0x0154: ch = 0xC0; break;
+ case 0x0155: ch = 0xE0; break;
+ case 0x0158: ch = 0xD8; break;
+ case 0x0159: ch = 0xF8; break;
+ case 0x015A: ch = 0xA6; break;
+ case 0x015B: ch = 0xB6; break;
+ case 0x015E: ch = 0xAA; break;
+ case 0x015F: ch = 0xBA; break;
+ case 0x0160: ch = 0xA9; break;
+ case 0x0161: ch = 0xB9; break;
+ case 0x0162: ch = 0xDE; break;
+ case 0x0163: ch = 0xFE; break;
+ case 0x0164: ch = 0xAB; break;
+ case 0x0165: ch = 0xBB; break;
+ case 0x016E: ch = 0xD9; break;
+ case 0x016F: ch = 0xF9; break;
+ case 0x0170: ch = 0xDB; break;
+ case 0x0171: ch = 0xFB; break;
+ case 0x0179: ch = 0xAC; break;
+ case 0x017A: ch = 0xBC; break;
+ case 0x017B: ch = 0xAF; break;
+ case 0x017C: ch = 0xBF; break;
+ case 0x017D: ch = 0xAE; break;
+ case 0x017E: ch = 0xBE; break;
+ case 0x02C7: ch = 0xB7; break;
+ case 0x02D8: ch = 0xA2; break;
+ case 0x02D9: ch = 0xFF; break;
+ case 0x02DB: ch = 0xB2; break;
+ case 0x02DD: ch = 0xBD; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2500: ch = 0x94; break;
+ case 0x2502: ch = 0x83; break;
+ case 0x250C: ch = 0x86; break;
+ case 0x2510: ch = 0x8F; break;
+ case 0x2514: ch = 0x90; break;
+ case 0x2518: ch = 0x85; break;
+ case 0x251C: ch = 0x93; break;
+ case 0x2524: ch = 0x84; break;
+ case 0x252C: ch = 0x92; break;
+ case 0x2534: ch = 0x91; break;
+ case 0x253C: ch = 0x95; break;
+ case 0x2550: ch = 0x9D; break;
+ case 0x2551: ch = 0x8A; break;
+ case 0x2554: ch = 0x99; break;
+ case 0x2557: ch = 0x8B; break;
+ case 0x255A: ch = 0x98; break;
+ case 0x255D: ch = 0x8C; break;
+ case 0x2560: ch = 0x9C; break;
+ case 0x2563: ch = 0x89; break;
+ case 0x2566: ch = 0x9B; break;
+ case 0x2569: ch = 0x9A; break;
+ case 0x256C: ch = 0x9E; break;
+ case 0x2580: ch = 0x97; break;
+ case 0x2584: ch = 0x96; break;
+ case 0x2588: ch = 0x87; break;
+ case 0x2591: ch = 0x80; break;
+ case 0x2592: ch = 0x81; break;
+ case 0x2593: ch = 0x82; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0x83; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28592
+
+public class ENCiso_8859_2 : CP28592
+{
+ public ENCiso_8859_2() : base() {}
+
+}; // class ENCiso_8859_2
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP28593.cs b/mcs/class/I18N/West/CP28593.cs
new file mode 100644
index 00000000000..93f93e494de
--- /dev/null
+++ b/mcs/class/I18N/West/CP28593.cs
@@ -0,0 +1,319 @@
+/*
+ * CP28593.cs - Latin 3 (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-913.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP28593 : ByteEncoding
+{
+ public CP28593()
+ : base(28593, ToChars, "Latin 3 (ISO)",
+ "iso-8859-3", "iso-8859-3", "iso-8859-3",
+ true, true, true, true, 28593)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u0126',
+ '\u02D8', '\u00A3', '\u00A4', '\u003F', '\u0124', '\u00A7',
+ '\u00A8', '\u0130', '\u015E', '\u011E', '\u0134', '\u00AD',
+ '\u003F', '\u017B', '\u00B0', '\u0127', '\u00B2', '\u00B3',
+ '\u00B4', '\u00B5', '\u0125', '\u00B7', '\u00B8', '\u0131',
+ '\u015F', '\u011F', '\u0135', '\u00BD', '\u003F', '\u017C',
+ '\u00C0', '\u00C1', '\u00C2', '\u003F', '\u00C4', '\u010A',
+ '\u0108', '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB',
+ '\u00CC', '\u00CD', '\u00CE', '\u00CF', '\u003F', '\u00D1',
+ '\u00D2', '\u00D3', '\u00D4', '\u0120', '\u00D6', '\u00D7',
+ '\u011C', '\u00D9', '\u00DA', '\u00DB', '\u00DC', '\u016C',
+ '\u015C', '\u00DF', '\u00E0', '\u00E1', '\u00E2', '\u003F',
+ '\u00E4', '\u010B', '\u0109', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u00EC', '\u00ED', '\u00EE', '\u00EF',
+ '\u003F', '\u00F1', '\u00F2', '\u00F3', '\u00F4', '\u0121',
+ '\u00F6', '\u00F7', '\u011D', '\u00F9', '\u00FA', '\u00FB',
+ '\u00FC', '\u016D', '\u015D', '\u02D9',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00AD:
+ case 0x00B0:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00BD:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ break;
+ case 0x0108: ch = 0xC6; break;
+ case 0x0109: ch = 0xE6; break;
+ case 0x010A: ch = 0xC5; break;
+ case 0x010B: ch = 0xE5; break;
+ case 0x011C: ch = 0xD8; break;
+ case 0x011D: ch = 0xF8; break;
+ case 0x011E: ch = 0xAB; break;
+ case 0x011F: ch = 0xBB; break;
+ case 0x0120: ch = 0xD5; break;
+ case 0x0121: ch = 0xF5; break;
+ case 0x0124: ch = 0xA6; break;
+ case 0x0125: ch = 0xB6; break;
+ case 0x0126: ch = 0xA1; break;
+ case 0x0127: ch = 0xB1; break;
+ case 0x0130: ch = 0xA9; break;
+ case 0x0131: ch = 0xB9; break;
+ case 0x0134: ch = 0xAC; break;
+ case 0x0135: ch = 0xBC; break;
+ case 0x015C: ch = 0xDE; break;
+ case 0x015D: ch = 0xFE; break;
+ case 0x015E: ch = 0xAA; break;
+ case 0x015F: ch = 0xBA; break;
+ case 0x016C: ch = 0xDD; break;
+ case 0x016D: ch = 0xFD; break;
+ case 0x017B: ch = 0xAF; break;
+ case 0x017C: ch = 0xBF; break;
+ case 0x02D8: ch = 0xA2; break;
+ case 0x02D9: ch = 0xFF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A3:
+ case 0x00A4:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00AD:
+ case 0x00B0:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B5:
+ case 0x00B7:
+ case 0x00B8:
+ case 0x00BD:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C4:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E4:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ break;
+ case 0x0108: ch = 0xC6; break;
+ case 0x0109: ch = 0xE6; break;
+ case 0x010A: ch = 0xC5; break;
+ case 0x010B: ch = 0xE5; break;
+ case 0x011C: ch = 0xD8; break;
+ case 0x011D: ch = 0xF8; break;
+ case 0x011E: ch = 0xAB; break;
+ case 0x011F: ch = 0xBB; break;
+ case 0x0120: ch = 0xD5; break;
+ case 0x0121: ch = 0xF5; break;
+ case 0x0124: ch = 0xA6; break;
+ case 0x0125: ch = 0xB6; break;
+ case 0x0126: ch = 0xA1; break;
+ case 0x0127: ch = 0xB1; break;
+ case 0x0130: ch = 0xA9; break;
+ case 0x0131: ch = 0xB9; break;
+ case 0x0134: ch = 0xAC; break;
+ case 0x0135: ch = 0xBC; break;
+ case 0x015C: ch = 0xDE; break;
+ case 0x015D: ch = 0xFE; break;
+ case 0x015E: ch = 0xAA; break;
+ case 0x015F: ch = 0xBA; break;
+ case 0x016C: ch = 0xDD; break;
+ case 0x016D: ch = 0xFD; break;
+ case 0x017B: ch = 0xAF; break;
+ case 0x017C: ch = 0xBF; break;
+ case 0x02D8: ch = 0xA2; break;
+ case 0x02D9: ch = 0xFF; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28593
+
+public class ENCiso_8859_3 : CP28593
+{
+ public ENCiso_8859_3() : base() {}
+
+}; // class ENCiso_8859_3
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP28597.cs b/mcs/class/I18N/West/CP28597.cs
new file mode 100644
index 00000000000..b4a25378f03
--- /dev/null
+++ b/mcs/class/I18N/West/CP28597.cs
@@ -0,0 +1,339 @@
+/*
+ * CP28597.cs - Greek (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-4909.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP28597 : ByteEncoding
+{
+ public CP28597()
+ : base(28597, ToChars, "Greek (ISO)",
+ "iso-8859-7", "iso-8859-7", "iso-8859-7",
+ true, true, true, true, 1253)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u2018',
+ '\u2019', '\u00A3', '\u20AC', '\u003F', '\u00A6', '\u00A7',
+ '\u00A8', '\u00A9', '\u003F', '\u00AB', '\u00AC', '\u00AD',
+ '\u003F', '\u2015', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u00B4', '\u0385', '\u0386', '\u0387', '\u0388', '\u0389',
+ '\u038A', '\u00BB', '\u038C', '\u00BD', '\u038E', '\u038F',
+ '\u0390', '\u0391', '\u0392', '\u0393', '\u0394', '\u0395',
+ '\u0396', '\u0397', '\u0398', '\u0399', '\u039A', '\u039B',
+ '\u039C', '\u039D', '\u039E', '\u039F', '\u03A0', '\u03A1',
+ '\u003F', '\u03A3', '\u03A4', '\u03A5', '\u03A6', '\u03A7',
+ '\u03A8', '\u03A9', '\u03AA', '\u03AB', '\u03AC', '\u03AD',
+ '\u03AE', '\u03AF', '\u03B0', '\u03B1', '\u03B2', '\u03B3',
+ '\u03B4', '\u03B5', '\u03B6', '\u03B7', '\u03B8', '\u03B9',
+ '\u03BA', '\u03BB', '\u03BC', '\u03BD', '\u03BE', '\u03BF',
+ '\u03C0', '\u03C1', '\u03C2', '\u03C3', '\u03C4', '\u03C5',
+ '\u03C6', '\u03C7', '\u03C8', '\u03C9', '\u03CA', '\u03CB',
+ '\u03CC', '\u03CD', '\u03CE', '\u003F',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A3:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B7:
+ case 0x00BB:
+ case 0x00BD:
+ break;
+ case 0x0385:
+ case 0x0386:
+ case 0x0387:
+ case 0x0388:
+ case 0x0389:
+ case 0x038A:
+ ch -= 0x02D0;
+ break;
+ case 0x038C: ch = 0xBC; break;
+ case 0x038E:
+ case 0x038F:
+ case 0x0390:
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ case 0x0398:
+ case 0x0399:
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ case 0x039E:
+ case 0x039F:
+ case 0x03A0:
+ case 0x03A1:
+ ch -= 0x02D0;
+ break;
+ case 0x03A3:
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ case 0x03AA:
+ case 0x03AB:
+ case 0x03AC:
+ case 0x03AD:
+ case 0x03AE:
+ case 0x03AF:
+ case 0x03B0:
+ case 0x03B1:
+ case 0x03B2:
+ case 0x03B3:
+ case 0x03B4:
+ case 0x03B5:
+ case 0x03B6:
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ case 0x03C2:
+ case 0x03C3:
+ case 0x03C4:
+ case 0x03C5:
+ case 0x03C6:
+ case 0x03C7:
+ case 0x03C8:
+ case 0x03C9:
+ case 0x03CA:
+ case 0x03CB:
+ case 0x03CC:
+ case 0x03CD:
+ case 0x03CE:
+ ch -= 0x02D0;
+ break;
+ case 0x03D5: ch = 0xF6; break;
+ case 0x2015: ch = 0xAF; break;
+ case 0x2018: ch = 0xA1; break;
+ case 0x2019: ch = 0xA2; break;
+ case 0x20AC: ch = 0xA4; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 161) switch(ch)
+ {
+ case 0x00A3:
+ case 0x00A6:
+ case 0x00A7:
+ case 0x00A8:
+ case 0x00A9:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B4:
+ case 0x00B7:
+ case 0x00BB:
+ case 0x00BD:
+ break;
+ case 0x0385:
+ case 0x0386:
+ case 0x0387:
+ case 0x0388:
+ case 0x0389:
+ case 0x038A:
+ ch -= 0x02D0;
+ break;
+ case 0x038C: ch = 0xBC; break;
+ case 0x038E:
+ case 0x038F:
+ case 0x0390:
+ case 0x0391:
+ case 0x0392:
+ case 0x0393:
+ case 0x0394:
+ case 0x0395:
+ case 0x0396:
+ case 0x0397:
+ case 0x0398:
+ case 0x0399:
+ case 0x039A:
+ case 0x039B:
+ case 0x039C:
+ case 0x039D:
+ case 0x039E:
+ case 0x039F:
+ case 0x03A0:
+ case 0x03A1:
+ ch -= 0x02D0;
+ break;
+ case 0x03A3:
+ case 0x03A4:
+ case 0x03A5:
+ case 0x03A6:
+ case 0x03A7:
+ case 0x03A8:
+ case 0x03A9:
+ case 0x03AA:
+ case 0x03AB:
+ case 0x03AC:
+ case 0x03AD:
+ case 0x03AE:
+ case 0x03AF:
+ case 0x03B0:
+ case 0x03B1:
+ case 0x03B2:
+ case 0x03B3:
+ case 0x03B4:
+ case 0x03B5:
+ case 0x03B6:
+ case 0x03B7:
+ case 0x03B8:
+ case 0x03B9:
+ case 0x03BA:
+ case 0x03BB:
+ case 0x03BC:
+ case 0x03BD:
+ case 0x03BE:
+ case 0x03BF:
+ case 0x03C0:
+ case 0x03C1:
+ case 0x03C2:
+ case 0x03C3:
+ case 0x03C4:
+ case 0x03C5:
+ case 0x03C6:
+ case 0x03C7:
+ case 0x03C8:
+ case 0x03C9:
+ case 0x03CA:
+ case 0x03CB:
+ case 0x03CC:
+ case 0x03CD:
+ case 0x03CE:
+ ch -= 0x02D0;
+ break;
+ case 0x03D5: ch = 0xF6; break;
+ case 0x2015: ch = 0xAF; break;
+ case 0x2018: ch = 0xA1; break;
+ case 0x2019: ch = 0xA2; break;
+ case 0x20AC: ch = 0xA4; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28597
+
+public class ENCiso_8859_7 : CP28597
+{
+ public ENCiso_8859_7() : base() {}
+
+}; // class ENCiso_8859_7
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP28605.cs b/mcs/class/I18N/West/CP28605.cs
new file mode 100644
index 00000000000..71ab3c9f01d
--- /dev/null
+++ b/mcs/class/I18N/West/CP28605.cs
@@ -0,0 +1,327 @@
+/*
+ * CP28605.cs - Latin 9 (ISO) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-923.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP28605 : ByteEncoding
+{
+ public CP28605()
+ : base(28605, ToChars, "Latin 9 (ISO)",
+ "iso-8859-15", "iso-8859-15", "iso-8859-15",
+ false, true, true, true, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u007F', '\u0080', '\u0081', '\u0082', '\u0083',
+ '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089',
+ '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F',
+ '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095',
+ '\u0096', '\u0097', '\u0098', '\u0099', '\u009A', '\u009B',
+ '\u009C', '\u009D', '\u009E', '\u009F', '\u00A0', '\u00A1',
+ '\u00A2', '\u00A3', '\u20AC', '\u00A5', '\u0160', '\u00A7',
+ '\u0161', '\u00A9', '\u00AA', '\u00AB', '\u00AC', '\u00AD',
+ '\u00AE', '\u00AF', '\u00B0', '\u00B1', '\u00B2', '\u00B3',
+ '\u017D', '\u00B5', '\u00B6', '\u00B7', '\u017E', '\u00B9',
+ '\u00BA', '\u00BB', '\u0152', '\u0153', '\u0178', '\u00BF',
+ '\u00C0', '\u00C1', '\u00C2', '\u00C3', '\u00C4', '\u00C5',
+ '\u00C6', '\u00C7', '\u00C8', '\u00C9', '\u00CA', '\u00CB',
+ '\u00CC', '\u00CD', '\u00CE', '\u00CF', '\u00D0', '\u00D1',
+ '\u00D2', '\u00D3', '\u00D4', '\u00D5', '\u00D6', '\u00D7',
+ '\u00D8', '\u00D9', '\u00DA', '\u00DB', '\u00DC', '\u00DD',
+ '\u00DE', '\u00DF', '\u00E0', '\u00E1', '\u00E2', '\u00E3',
+ '\u00E4', '\u00E5', '\u00E6', '\u00E7', '\u00E8', '\u00E9',
+ '\u00EA', '\u00EB', '\u00EC', '\u00ED', '\u00EE', '\u00EF',
+ '\u00F0', '\u00F1', '\u00F2', '\u00F3', '\u00F4', '\u00F5',
+ '\u00F6', '\u00F7', '\u00F8', '\u00F9', '\u00FA', '\u00FB',
+ '\u00FC', '\u00FD', '\u00FE', '\u00FF',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 164) switch(ch)
+ {
+ case 0x00A5:
+ case 0x00A7:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D0:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DE:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F0:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FD:
+ case 0x00FE:
+ case 0x00FF:
+ break;
+ case 0x0152: ch = 0xBC; break;
+ case 0x0153: ch = 0xBD; break;
+ case 0x0160: ch = 0xA6; break;
+ case 0x0161: ch = 0xA8; break;
+ case 0x0178: ch = 0xBE; break;
+ case 0x017D: ch = 0xB4; break;
+ case 0x017E: ch = 0xB8; break;
+ case 0x20AC: ch = 0xA4; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 164) switch(ch)
+ {
+ case 0x00A5:
+ case 0x00A7:
+ case 0x00A9:
+ case 0x00AA:
+ case 0x00AB:
+ case 0x00AC:
+ case 0x00AD:
+ case 0x00AE:
+ case 0x00AF:
+ case 0x00B0:
+ case 0x00B1:
+ case 0x00B2:
+ case 0x00B3:
+ case 0x00B5:
+ case 0x00B6:
+ case 0x00B7:
+ case 0x00B9:
+ case 0x00BA:
+ case 0x00BB:
+ case 0x00BF:
+ case 0x00C0:
+ case 0x00C1:
+ case 0x00C2:
+ case 0x00C3:
+ case 0x00C4:
+ case 0x00C5:
+ case 0x00C6:
+ case 0x00C7:
+ case 0x00C8:
+ case 0x00C9:
+ case 0x00CA:
+ case 0x00CB:
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00CF:
+ case 0x00D0:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x00D3:
+ case 0x00D4:
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D7:
+ case 0x00D8:
+ case 0x00D9:
+ case 0x00DA:
+ case 0x00DB:
+ case 0x00DC:
+ case 0x00DD:
+ case 0x00DE:
+ case 0x00DF:
+ case 0x00E0:
+ case 0x00E1:
+ case 0x00E2:
+ case 0x00E3:
+ case 0x00E4:
+ case 0x00E5:
+ case 0x00E6:
+ case 0x00E7:
+ case 0x00E8:
+ case 0x00E9:
+ case 0x00EA:
+ case 0x00EB:
+ case 0x00EC:
+ case 0x00ED:
+ case 0x00EE:
+ case 0x00EF:
+ case 0x00F0:
+ case 0x00F1:
+ case 0x00F2:
+ case 0x00F3:
+ case 0x00F4:
+ case 0x00F5:
+ case 0x00F6:
+ case 0x00F7:
+ case 0x00F8:
+ case 0x00F9:
+ case 0x00FA:
+ case 0x00FB:
+ case 0x00FC:
+ case 0x00FD:
+ case 0x00FE:
+ case 0x00FF:
+ break;
+ case 0x0152: ch = 0xBC; break;
+ case 0x0153: ch = 0xBD; break;
+ case 0x0160: ch = 0xA6; break;
+ case 0x0161: ch = 0xA8; break;
+ case 0x0178: ch = 0xBE; break;
+ case 0x017D: ch = 0xB4; break;
+ case 0x017E: ch = 0xB8; break;
+ case 0x20AC: ch = 0xA4; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP28605
+
+public class ENCiso_8859_15 : CP28605
+{
+ public ENCiso_8859_15() : base() {}
+
+}; // class ENCiso_8859_15
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP437.cs b/mcs/class/I18N/West/CP437.cs
new file mode 100644
index 00000000000..8a67bfd158e
--- /dev/null
+++ b/mcs/class/I18N/West/CP437.cs
@@ -0,0 +1,681 @@
+/*
+ * CP437.cs - OEM United States code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-437.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP437 : ByteEncoding
+{
+ public CP437()
+ : base(437, ToChars, "OEM United States",
+ "IBM437", "IBM437", "IBM437",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5',
+ '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2',
+ '\u00FB', '\u00F9', '\u00FF', '\u00D6', '\u00DC', '\u00A2',
+ '\u00A3', '\u00A5', '\u20A7', '\u0192', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA',
+ '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393', '\u03C0',
+ '\u03A3', '\u03C3', '\u03BC', '\u03C4', '\u03A6', '\u0398',
+ '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
+ '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321',
+ '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u207F', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A5: ch = 0x9D; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A5: ch = 0x9D; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP437
+
+public class ENCibm437 : CP437
+{
+ public ENCibm437() : base() {}
+
+}; // class ENCibm437
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP850.cs b/mcs/class/I18N/West/CP850.cs
new file mode 100644
index 00000000000..6d8f744fb00
--- /dev/null
+++ b/mcs/class/I18N/West/CP850.cs
@@ -0,0 +1,681 @@
+/*
+ * CP850.cs - Western European (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-850.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP850 : ByteEncoding
+{
+ public CP850()
+ : base(850, ToChars, "Western European (DOS)",
+ "ibm850", "ibm850", "ibm850",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5',
+ '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2',
+ '\u00FB', '\u00F9', '\u00FF', '\u00D6', '\u00DC', '\u00F8',
+ '\u00A3', '\u00D8', '\u00D7', '\u0192', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA',
+ '\u00BF', '\u00AE', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u00C1', '\u00C2', '\u00C0', '\u00A9', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u00A2', '\u00A5', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u00E3', '\u00C3', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u00A4', '\u00F0', '\u00D0',
+ '\u00CA', '\u00CB', '\u00C8', '\u0131', '\u00CD', '\u00CE',
+ '\u00CF', '\u2518', '\u250C', '\u2588', '\u2584', '\u00A6',
+ '\u00CC', '\u2580', '\u00D3', '\u00DF', '\u00D4', '\u00D2',
+ '\u00F5', '\u00D5', '\u00B5', '\u00FE', '\u00DE', '\u00DA',
+ '\u00DB', '\u00D9', '\u00FD', '\u00DD', '\u00AF', '\u00B4',
+ '\u00AD', '\u00B1', '\u2017', '\u00BE', '\u00B6', '\u00A7',
+ '\u00F7', '\u00B8', '\u00B0', '\u00A8', '\u00B7', '\u00B9',
+ '\u00B3', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0xBD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A5: ch = 0xBE; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0xB8; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00AE: ch = 0xA9; break;
+ case 0x00AF: ch = 0xEE; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xFC; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B5: ch = 0xE6; break;
+ case 0x00B6: ch = 0xF4; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00B9: ch = 0xFB; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xF3; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0xB7; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C3: ch = 0xC7; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0xD4; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0xD2; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CC: ch = 0xDE; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00CF: ch = 0xD8; break;
+ case 0x00D0: ch = 0xD1; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xE3; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D5: ch = 0xE5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0x9E; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00D9: ch = 0xEB; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DB: ch = 0xEA; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0xED; break;
+ case 0x00DE: ch = 0xE8; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0xC6; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F0: ch = 0xD0; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0xE4; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0xEC; break;
+ case 0x00FE: ch = 0xE7; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0110: ch = 0xD1; break;
+ case 0x0131: ch = 0xD5; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x2017: ch = 0xF2; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xEE; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0xBD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xCF; break;
+ case 0x00A5: ch = 0xBE; break;
+ case 0x00A6: ch = 0xDD; break;
+ case 0x00A7: ch = 0xF5; break;
+ case 0x00A8: ch = 0xF9; break;
+ case 0x00A9: ch = 0xB8; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AD: ch = 0xF0; break;
+ case 0x00AE: ch = 0xA9; break;
+ case 0x00AF: ch = 0xEE; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xFC; break;
+ case 0x00B4: ch = 0xEF; break;
+ case 0x00B5: ch = 0xE6; break;
+ case 0x00B6: ch = 0xF4; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xF7; break;
+ case 0x00B9: ch = 0xFB; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xF3; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0xB7; break;
+ case 0x00C1: ch = 0xB5; break;
+ case 0x00C2: ch = 0xB6; break;
+ case 0x00C3: ch = 0xC7; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0xD4; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0xD2; break;
+ case 0x00CB: ch = 0xD3; break;
+ case 0x00CC: ch = 0xDE; break;
+ case 0x00CD: ch = 0xD6; break;
+ case 0x00CE: ch = 0xD7; break;
+ case 0x00CF: ch = 0xD8; break;
+ case 0x00D0: ch = 0xD1; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xE3; break;
+ case 0x00D3: ch = 0xE0; break;
+ case 0x00D4: ch = 0xE2; break;
+ case 0x00D5: ch = 0xE5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D7: ch = 0x9E; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00D9: ch = 0xEB; break;
+ case 0x00DA: ch = 0xE9; break;
+ case 0x00DB: ch = 0xEA; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0xED; break;
+ case 0x00DE: ch = 0xE8; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0xC6; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F0: ch = 0xD0; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0xE4; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0xEC; break;
+ case 0x00FE: ch = 0xE7; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0110: ch = 0xD1; break;
+ case 0x0131: ch = 0xD5; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x2017: ch = 0xF2; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xEE; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266C: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP850
+
+public class ENCibm850 : CP850
+{
+ public ENCibm850() : base() {}
+
+}; // class ENCibm850
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP860.cs b/mcs/class/I18N/West/CP860.cs
new file mode 100644
index 00000000000..ebb0b569de8
--- /dev/null
+++ b/mcs/class/I18N/West/CP860.cs
@@ -0,0 +1,681 @@
+/*
+ * CP860.cs - Portuguese (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-860.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP860 : ByteEncoding
+{
+ public CP860()
+ : base(860, ToChars, "Portuguese (DOS)",
+ "ibm860", "ibm860", "ibm860",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E3', '\u00E0', '\u00C1', '\u00E7', '\u00EA', '\u00CA',
+ '\u00E8', '\u00CD', '\u00D4', '\u00EC', '\u00C3', '\u00C2',
+ '\u00C9', '\u00C0', '\u00C8', '\u00F4', '\u00F5', '\u00F2',
+ '\u00DA', '\u00F9', '\u00CC', '\u00D5', '\u00DC', '\u00A2',
+ '\u00A3', '\u00D9', '\u20A7', '\u00D3', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA',
+ '\u00BF', '\u00D2', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393', '\u03C0',
+ '\u03A3', '\u03C3', '\u03BC', '\u03C4', '\u03A6', '\u0398',
+ '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
+ '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321',
+ '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u207F', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0x91; break;
+ case 0x00C1: ch = 0x86; break;
+ case 0x00C2: ch = 0x8F; break;
+ case 0x00C3: ch = 0x8E; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0x92; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0x89; break;
+ case 0x00CC: ch = 0x98; break;
+ case 0x00CD: ch = 0x8B; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xA9; break;
+ case 0x00D3: ch = 0x9F; break;
+ case 0x00D4: ch = 0x8C; break;
+ case 0x00D5: ch = 0x99; break;
+ case 0x00D9: ch = 0x9D; break;
+ case 0x00DA: ch = 0x96; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0x84; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C0: ch = 0x91; break;
+ case 0x00C1: ch = 0x86; break;
+ case 0x00C2: ch = 0x8F; break;
+ case 0x00C3: ch = 0x8E; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0x92; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0x89; break;
+ case 0x00CC: ch = 0x98; break;
+ case 0x00CD: ch = 0x8B; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D2: ch = 0xA9; break;
+ case 0x00D3: ch = 0x9F; break;
+ case 0x00D4: ch = 0x8C; break;
+ case 0x00D5: ch = 0x99; break;
+ case 0x00D9: ch = 0x9D; break;
+ case 0x00DA: ch = 0x96; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E3: ch = 0x84; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F5: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP860
+
+public class ENCibm860 : CP860
+{
+ public ENCibm860() : base() {}
+
+}; // class ENCibm860
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP861.cs b/mcs/class/I18N/West/CP861.cs
new file mode 100644
index 00000000000..cfb6073c6d6
--- /dev/null
+++ b/mcs/class/I18N/West/CP861.cs
@@ -0,0 +1,681 @@
+/*
+ * CP861.cs - Icelandic (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-861.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP861 : ByteEncoding
+{
+ public CP861()
+ : base(861, ToChars, "Icelandic (DOS)",
+ "ibm861", "ibm861", "ibm861",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00D0', '\u00F0', '\u00DE', '\u00C4', '\u00C5',
+ '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00FE',
+ '\u00FB', '\u00DD', '\u00FD', '\u00D6', '\u00DC', '\u00F8',
+ '\u00A3', '\u00D8', '\u20A7', '\u0192', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00C1', '\u00CD', '\u00D3', '\u00DA',
+ '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393', '\u03C0',
+ '\u03A3', '\u03C3', '\u03BC', '\u03C4', '\u03A6', '\u0398',
+ '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
+ '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321',
+ '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u207F', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C1: ch = 0xA4; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CD: ch = 0xA5; break;
+ case 0x00D0: ch = 0x8B; break;
+ case 0x00D3: ch = 0xA6; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00DA: ch = 0xA7; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0x97; break;
+ case 0x00DE: ch = 0x8D; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0x98; break;
+ case 0x00FE: ch = 0x95; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C1: ch = 0xA4; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CD: ch = 0xA5; break;
+ case 0x00D0: ch = 0x8B; break;
+ case 0x00D3: ch = 0xA6; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00DA: ch = 0xA7; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DD: ch = 0x97; break;
+ case 0x00DE: ch = 0x8D; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00F0: ch = 0x8C; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FD: ch = 0x98; break;
+ case 0x00FE: ch = 0x95; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP861
+
+public class ENCibm861 : CP861
+{
+ public ENCibm861() : base() {}
+
+}; // class ENCibm861
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP863.cs b/mcs/class/I18N/West/CP863.cs
new file mode 100644
index 00000000000..250dbb50975
--- /dev/null
+++ b/mcs/class/I18N/West/CP863.cs
@@ -0,0 +1,679 @@
+/*
+ * CP863.cs - French Canadian (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-863.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP863 : ByteEncoding
+{
+ public CP863()
+ : base(863, ToChars, "French Canadian (DOS)",
+ "IBM863", "IBM863", "IBM863",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00C2', '\u00E0', '\u00B6', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00EF', '\u00EE', '\u2017', '\u00C0', '\u00A7',
+ '\u00C9', '\u00C8', '\u00CA', '\u00F4', '\u00CB', '\u00CF',
+ '\u00FB', '\u00F9', '\u00A4', '\u00D4', '\u00DC', '\u00A2',
+ '\u00A3', '\u00D9', '\u00DB', '\u0192', '\u00A6', '\u00B4',
+ '\u00F3', '\u00FA', '\u00A8', '\u00B8', '\u00B3', '\u00AF',
+ '\u00CE', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00BE',
+ '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393', '\u03C0',
+ '\u03A3', '\u03C3', '\u03BC', '\u03C4', '\u03A6', '\u0398',
+ '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
+ '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321',
+ '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u207F', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0x98; break;
+ case 0x00A6: ch = 0xA0; break;
+ case 0x00A7: ch = 0x8F; break;
+ case 0x00A8: ch = 0xA4; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AF: ch = 0xA7; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xA6; break;
+ case 0x00B4: ch = 0xA1; break;
+ case 0x00B6: ch = 0x86; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xA5; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xAD; break;
+ case 0x00C0: ch = 0x8E; break;
+ case 0x00C2: ch = 0x84; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0x91; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0x92; break;
+ case 0x00CB: ch = 0x94; break;
+ case 0x00CE: ch = 0xA8; break;
+ case 0x00CF: ch = 0x95; break;
+ case 0x00D4: ch = 0x99; break;
+ case 0x00D9: ch = 0x9D; break;
+ case 0x00DB: ch = 0x9E; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2017: ch = 0x8D; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xA7; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A2: ch = 0x9B; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0x98; break;
+ case 0x00A6: ch = 0xA0; break;
+ case 0x00A7: ch = 0x8F; break;
+ case 0x00A8: ch = 0xA4; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00AF: ch = 0xA7; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B3: ch = 0xA6; break;
+ case 0x00B4: ch = 0xA1; break;
+ case 0x00B6: ch = 0x86; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00B8: ch = 0xA5; break;
+ case 0x00BB: ch = 0xAF; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BE: ch = 0xAD; break;
+ case 0x00C0: ch = 0x8E; break;
+ case 0x00C2: ch = 0x84; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C8: ch = 0x91; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00CA: ch = 0x92; break;
+ case 0x00CB: ch = 0x94; break;
+ case 0x00CE: ch = 0xA8; break;
+ case 0x00CF: ch = 0x95; break;
+ case 0x00D4: ch = 0x99; break;
+ case 0x00D9: ch = 0x9D; break;
+ case 0x00DB: ch = 0x9E; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2017: ch = 0x8D; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x203E: ch = 0xA7; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP863
+
+public class ENCibm863 : CP863
+{
+ public ENCibm863() : base() {}
+
+}; // class ENCibm863
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/CP865.cs b/mcs/class/I18N/West/CP865.cs
new file mode 100644
index 00000000000..011d4f164bd
--- /dev/null
+++ b/mcs/class/I18N/West/CP865.cs
@@ -0,0 +1,681 @@
+/*
+ * CP865.cs - Nordic (DOS) code page.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// Generated from "ibm-865.ucm".
+
+namespace I18N.West
+{
+
+using System;
+using I18N.Common;
+
+public class CP865 : ByteEncoding
+{
+ public CP865()
+ : base(865, ToChars, "Nordic (DOS)",
+ "IBM863", "IBM865", "IBM865",
+ false, false, false, false, 1252)
+ {}
+
+ private static readonly char[] ToChars = {
+ '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
+ '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
+ '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
+ '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
+ '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
+ '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
+ '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
+ '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
+ '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
+ '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
+ '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
+ '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
+ '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
+ '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
+ '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
+ '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
+ '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
+ '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
+ '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
+ '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
+ '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
+ '\u007E', '\u001A', '\u00C7', '\u00FC', '\u00E9', '\u00E2',
+ '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB',
+ '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5',
+ '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2',
+ '\u00FB', '\u00F9', '\u00FF', '\u00D6', '\u00DC', '\u00F8',
+ '\u00A3', '\u00D8', '\u20A7', '\u0192', '\u00E1', '\u00ED',
+ '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA',
+ '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1',
+ '\u00AB', '\u00A4', '\u2591', '\u2592', '\u2593', '\u2502',
+ '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563',
+ '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
+ '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C',
+ '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566',
+ '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564',
+ '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B',
+ '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C',
+ '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393', '\u03C0',
+ '\u03A3', '\u03C3', '\u03BC', '\u03C4', '\u03A6', '\u0398',
+ '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
+ '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321',
+ '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A',
+ '\u207F', '\u00B2', '\u25A0', '\u00A0',
+ };
+
+ protected override void ToBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(chars[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xAF; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+ protected override void ToBytes(String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int ch;
+ while(charCount > 0)
+ {
+ ch = (int)(s[charIndex++]);
+ if(ch >= 26) switch(ch)
+ {
+ case 0x001B:
+ case 0x001D:
+ case 0x001E:
+ case 0x001F:
+ case 0x0020:
+ case 0x0021:
+ case 0x0022:
+ case 0x0023:
+ case 0x0024:
+ case 0x0025:
+ case 0x0026:
+ case 0x0027:
+ case 0x0028:
+ case 0x0029:
+ case 0x002A:
+ case 0x002B:
+ case 0x002C:
+ case 0x002D:
+ case 0x002E:
+ case 0x002F:
+ case 0x0030:
+ case 0x0031:
+ case 0x0032:
+ case 0x0033:
+ case 0x0034:
+ case 0x0035:
+ case 0x0036:
+ case 0x0037:
+ case 0x0038:
+ case 0x0039:
+ case 0x003A:
+ case 0x003B:
+ case 0x003C:
+ case 0x003D:
+ case 0x003E:
+ case 0x003F:
+ case 0x0040:
+ case 0x0041:
+ case 0x0042:
+ case 0x0043:
+ case 0x0044:
+ case 0x0045:
+ case 0x0046:
+ case 0x0047:
+ case 0x0048:
+ case 0x0049:
+ case 0x004A:
+ case 0x004B:
+ case 0x004C:
+ case 0x004D:
+ case 0x004E:
+ case 0x004F:
+ case 0x0050:
+ case 0x0051:
+ case 0x0052:
+ case 0x0053:
+ case 0x0054:
+ case 0x0055:
+ case 0x0056:
+ case 0x0057:
+ case 0x0058:
+ case 0x0059:
+ case 0x005A:
+ case 0x005B:
+ case 0x005C:
+ case 0x005D:
+ case 0x005E:
+ case 0x005F:
+ case 0x0060:
+ case 0x0061:
+ case 0x0062:
+ case 0x0063:
+ case 0x0064:
+ case 0x0065:
+ case 0x0066:
+ case 0x0067:
+ case 0x0068:
+ case 0x0069:
+ case 0x006A:
+ case 0x006B:
+ case 0x006C:
+ case 0x006D:
+ case 0x006E:
+ case 0x006F:
+ case 0x0070:
+ case 0x0071:
+ case 0x0072:
+ case 0x0073:
+ case 0x0074:
+ case 0x0075:
+ case 0x0076:
+ case 0x0077:
+ case 0x0078:
+ case 0x0079:
+ case 0x007A:
+ case 0x007B:
+ case 0x007C:
+ case 0x007D:
+ case 0x007E:
+ break;
+ case 0x001A: ch = 0x7F; break;
+ case 0x001C: ch = 0x1A; break;
+ case 0x007F: ch = 0x1C; break;
+ case 0x00A0: ch = 0xFF; break;
+ case 0x00A1: ch = 0xAD; break;
+ case 0x00A3: ch = 0x9C; break;
+ case 0x00A4: ch = 0xAF; break;
+ case 0x00A7: ch = 0x15; break;
+ case 0x00AA: ch = 0xA6; break;
+ case 0x00AB: ch = 0xAE; break;
+ case 0x00AC: ch = 0xAA; break;
+ case 0x00B0: ch = 0xF8; break;
+ case 0x00B1: ch = 0xF1; break;
+ case 0x00B2: ch = 0xFD; break;
+ case 0x00B6: ch = 0x14; break;
+ case 0x00B7: ch = 0xFA; break;
+ case 0x00BA: ch = 0xA7; break;
+ case 0x00BC: ch = 0xAC; break;
+ case 0x00BD: ch = 0xAB; break;
+ case 0x00BF: ch = 0xA8; break;
+ case 0x00C4: ch = 0x8E; break;
+ case 0x00C5: ch = 0x8F; break;
+ case 0x00C6: ch = 0x92; break;
+ case 0x00C7: ch = 0x80; break;
+ case 0x00C9: ch = 0x90; break;
+ case 0x00D1: ch = 0xA5; break;
+ case 0x00D6: ch = 0x99; break;
+ case 0x00D8: ch = 0x9D; break;
+ case 0x00DC: ch = 0x9A; break;
+ case 0x00DF: ch = 0xE1; break;
+ case 0x00E0: ch = 0x85; break;
+ case 0x00E1: ch = 0xA0; break;
+ case 0x00E2: ch = 0x83; break;
+ case 0x00E4: ch = 0x84; break;
+ case 0x00E5: ch = 0x86; break;
+ case 0x00E6: ch = 0x91; break;
+ case 0x00E7: ch = 0x87; break;
+ case 0x00E8: ch = 0x8A; break;
+ case 0x00E9: ch = 0x82; break;
+ case 0x00EA: ch = 0x88; break;
+ case 0x00EB: ch = 0x89; break;
+ case 0x00EC: ch = 0x8D; break;
+ case 0x00ED: ch = 0xA1; break;
+ case 0x00EE: ch = 0x8C; break;
+ case 0x00EF: ch = 0x8B; break;
+ case 0x00F1: ch = 0xA4; break;
+ case 0x00F2: ch = 0x95; break;
+ case 0x00F3: ch = 0xA2; break;
+ case 0x00F4: ch = 0x93; break;
+ case 0x00F6: ch = 0x94; break;
+ case 0x00F7: ch = 0xF6; break;
+ case 0x00F8: ch = 0x9B; break;
+ case 0x00F9: ch = 0x97; break;
+ case 0x00FA: ch = 0xA3; break;
+ case 0x00FB: ch = 0x96; break;
+ case 0x00FC: ch = 0x81; break;
+ case 0x00FF: ch = 0x98; break;
+ case 0x0192: ch = 0x9F; break;
+ case 0x0393: ch = 0xE2; break;
+ case 0x0398: ch = 0xE9; break;
+ case 0x03A3: ch = 0xE4; break;
+ case 0x03A6: ch = 0xE8; break;
+ case 0x03A9: ch = 0xEA; break;
+ case 0x03B1: ch = 0xE0; break;
+ case 0x03B4: ch = 0xEB; break;
+ case 0x03B5: ch = 0xEE; break;
+ case 0x03BC: ch = 0xE6; break;
+ case 0x03C0: ch = 0xE3; break;
+ case 0x03C3: ch = 0xE5; break;
+ case 0x03C4: ch = 0xE7; break;
+ case 0x03C6: ch = 0xED; break;
+ case 0x2022: ch = 0x07; break;
+ case 0x203C: ch = 0x13; break;
+ case 0x207F: ch = 0xFC; break;
+ case 0x20A7: ch = 0x9E; break;
+ case 0x2190: ch = 0x1B; break;
+ case 0x2191: ch = 0x18; break;
+ case 0x2192: ch = 0x1A; break;
+ case 0x2193: ch = 0x19; break;
+ case 0x2194: ch = 0x1D; break;
+ case 0x2195: ch = 0x12; break;
+ case 0x21A8: ch = 0x17; break;
+ case 0x2219: ch = 0xF9; break;
+ case 0x221A: ch = 0xFB; break;
+ case 0x221E: ch = 0xEC; break;
+ case 0x221F: ch = 0x1C; break;
+ case 0x2229: ch = 0xEF; break;
+ case 0x2248: ch = 0xF7; break;
+ case 0x2261: ch = 0xF0; break;
+ case 0x2264: ch = 0xF3; break;
+ case 0x2265: ch = 0xF2; break;
+ case 0x2302: ch = 0x7F; break;
+ case 0x2310: ch = 0xA9; break;
+ case 0x2320: ch = 0xF4; break;
+ case 0x2321: ch = 0xF5; break;
+ case 0x2500: ch = 0xC4; break;
+ case 0x2502: ch = 0xB3; break;
+ case 0x250C: ch = 0xDA; break;
+ case 0x2510: ch = 0xBF; break;
+ case 0x2514: ch = 0xC0; break;
+ case 0x2518: ch = 0xD9; break;
+ case 0x251C: ch = 0xC3; break;
+ case 0x2524: ch = 0xB4; break;
+ case 0x252C: ch = 0xC2; break;
+ case 0x2534: ch = 0xC1; break;
+ case 0x253C: ch = 0xC5; break;
+ case 0x2550: ch = 0xCD; break;
+ case 0x2551: ch = 0xBA; break;
+ case 0x2552: ch = 0xD5; break;
+ case 0x2553: ch = 0xD6; break;
+ case 0x2554: ch = 0xC9; break;
+ case 0x2555: ch = 0xB8; break;
+ case 0x2556: ch = 0xB7; break;
+ case 0x2557: ch = 0xBB; break;
+ case 0x2558: ch = 0xD4; break;
+ case 0x2559: ch = 0xD3; break;
+ case 0x255A: ch = 0xC8; break;
+ case 0x255B: ch = 0xBE; break;
+ case 0x255C: ch = 0xBD; break;
+ case 0x255D: ch = 0xBC; break;
+ case 0x255E: ch = 0xC6; break;
+ case 0x255F: ch = 0xC7; break;
+ case 0x2560: ch = 0xCC; break;
+ case 0x2561: ch = 0xB5; break;
+ case 0x2562: ch = 0xB6; break;
+ case 0x2563: ch = 0xB9; break;
+ case 0x2564: ch = 0xD1; break;
+ case 0x2565: ch = 0xD2; break;
+ case 0x2566: ch = 0xCB; break;
+ case 0x2567: ch = 0xCF; break;
+ case 0x2568: ch = 0xD0; break;
+ case 0x2569: ch = 0xCA; break;
+ case 0x256A: ch = 0xD8; break;
+ case 0x256B: ch = 0xD7; break;
+ case 0x256C: ch = 0xCE; break;
+ case 0x2580: ch = 0xDF; break;
+ case 0x2584: ch = 0xDC; break;
+ case 0x2588: ch = 0xDB; break;
+ case 0x258C: ch = 0xDD; break;
+ case 0x2590: ch = 0xDE; break;
+ case 0x2591: ch = 0xB0; break;
+ case 0x2592: ch = 0xB1; break;
+ case 0x2593: ch = 0xB2; break;
+ case 0x25A0: ch = 0xFE; break;
+ case 0x25AC: ch = 0x16; break;
+ case 0x25B2: ch = 0x1E; break;
+ case 0x25BA: ch = 0x10; break;
+ case 0x25BC: ch = 0x1F; break;
+ case 0x25C4: ch = 0x11; break;
+ case 0x25CB: ch = 0x09; break;
+ case 0x25D8: ch = 0x08; break;
+ case 0x25D9: ch = 0x0A; break;
+ case 0x263A: ch = 0x01; break;
+ case 0x263B: ch = 0x02; break;
+ case 0x263C: ch = 0x0F; break;
+ case 0x2640: ch = 0x0C; break;
+ case 0x2642: ch = 0x0B; break;
+ case 0x2660: ch = 0x06; break;
+ case 0x2663: ch = 0x05; break;
+ case 0x2665: ch = 0x03; break;
+ case 0x2666: ch = 0x04; break;
+ case 0x266A: ch = 0x0D; break;
+ case 0x266B: ch = 0x0E; break;
+ case 0xFFE8: ch = 0xB3; break;
+ case 0xFFE9: ch = 0x1B; break;
+ case 0xFFEA: ch = 0x18; break;
+ case 0xFFEB: ch = 0x1A; break;
+ case 0xFFEC: ch = 0x19; break;
+ case 0xFFED: ch = 0xFE; break;
+ case 0xFFEE: ch = 0x09; break;
+ default:
+ {
+ if(ch >= 0xFF01 && ch <= 0xFF5E)
+ ch -= 0xFEE0;
+ else
+ ch = 0x3F;
+ }
+ break;
+ }
+ bytes[byteIndex++] = (byte)ch;
+ --charCount;
+ }
+ }
+
+}; // class CP865
+
+public class ENCibm865 : CP865
+{
+ public ENCibm865() : base() {}
+
+}; // class ENCibm865
+
+}; // namespace I18N.West
diff --git a/mcs/class/I18N/West/ibm-1275.ucm b/mcs/class/I18N/West/ibm-1275.ucm
new file mode 100644
index 00000000000..c6e6d6ec3d3
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-1275.ucm
@@ -0,0 +1,380 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B004FB.RPMAP100 and 04FB34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-1275"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-1275
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U00A0> \xCA |0
+<U00A1> \xC1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xDB |0
+<U00A5> \xB4 |0
+<U00A7> \xA4 |0
+<U00A8> \xAC |0
+<U00A9> \xA9 |0
+<U00AA> \xBB |0
+<U00AB> \xC7 |0
+<U00AC> \xC2 |0
+<U00AE> \xA8 |0
+<U00AF> \xF8 |0
+<U00B0> \xA1 |0
+<U00B1> \xB1 |0
+<U00B4> \xAB |0
+<U00B5> \xB5 |0
+<U00B6> \xA6 |0
+<U00B7> \xE1 |0
+<U00B8> \xFC |0
+<U00BA> \xBC |0
+<U00BB> \xC8 |0
+<U00BF> \xC0 |0
+<U00C0> \xCB |0
+<U00C1> \xE7 |0
+<U00C2> \xE5 |0
+<U00C3> \xCC |0
+<U00C4> \x80 |0
+<U00C5> \x81 |0
+<U00C6> \xAE |0
+<U00C7> \x82 |0
+<U00C8> \xE9 |0
+<U00C9> \x83 |0
+<U00CA> \xE6 |0
+<U00CB> \xE8 |0
+<U00CC> \xED |0
+<U00CD> \xEA |0
+<U00CE> \xEB |0
+<U00CF> \xEC |0
+<U00D1> \x84 |0
+<U00D2> \xF1 |0
+<U00D3> \xEE |0
+<U00D4> \xEF |0
+<U00D5> \xCD |0
+<U00D6> \x85 |0
+<U00D8> \xAF |0
+<U00D9> \xF4 |0
+<U00DA> \xF2 |0
+<U00DB> \xF3 |0
+<U00DC> \x86 |0
+<U00DF> \xA7 |0
+<U00E0> \x88 |0
+<U00E1> \x87 |0
+<U00E2> \x89 |0
+<U00E3> \x8B |0
+<U00E4> \x8A |0
+<U00E5> \x8C |0
+<U00E6> \xBE |0
+<U00E7> \x8D |0
+<U00E8> \x8F |0
+<U00E9> \x8E |0
+<U00EA> \x90 |0
+<U00EB> \x91 |0
+<U00EC> \x93 |0
+<U00ED> \x92 |0
+<U00EE> \x94 |0
+<U00EF> \x95 |0
+<U00F1> \x96 |0
+<U00F2> \x98 |0
+<U00F3> \x97 |0
+<U00F4> \x99 |0
+<U00F5> \x9B |0
+<U00F6> \x9A |0
+<U00F7> \xD6 |0
+<U00F8> \xBF |0
+<U00F9> \x9D |0
+<U00FA> \x9C |0
+<U00FB> \x9E |0
+<U00FC> \x9F |0
+<U00FF> \xD8 |0
+<U0131> \xF5 |0
+<U0152> \xCE |0
+<U0153> \xCF |0
+<U0178> \xD9 |0
+<U0192> \xC4 |0
+<U02C6> \xF6 |0
+<U02C7> \xFF |0
+<U02D8> \xF9 |0
+<U02D9> \xFA |0
+<U02DA> \xFB |0
+<U02DB> \xFE |0
+<U02DC> \xF7 |0
+<U02DD> \xFD |0
+<U03C0> \xB9 |0
+<U2013> \xD0 |0
+<U2014> \xD1 |0
+<U2018> \xD4 |0
+<U2019> \xD5 |0
+<U201A> \xE2 |0
+<U201C> \xD2 |0
+<U201D> \xD3 |0
+<U201E> \xE3 |0
+<U2020> \xA0 |0
+<U2021> \xE0 |0
+<U2022> \xA5 |0
+<U2026> \xC9 |0
+<U2030> \xE4 |0
+<U2039> \xDC |0
+<U203A> \xDD |0
+<U2044> \xDA |0
+<U2122> \xAA |0
+<U2126> \xBD |0
+<U2202> \xB6 |0
+<U2206> \xC6 |0
+<U220F> \xB8 |0
+<U2211> \xB7 |0
+<U221A> \xC3 |0
+<U221E> \xB0 |0
+<U222B> \xBA |0
+<U2248> \xC5 |0
+<U2260> \xAD |0
+<U2264> \xB2 |0
+<U2265> \xB3 |0
+<U2318> \x11 |1
+<U25CA> \xD7 |0
+<U2666> \x13 |1
+<U2713> \x12 |1
+<UF8FF> \xF0 |0
+<UFB01> \xDE |0
+<UFB02> \xDF |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-437.ucm b/mcs/class/I18N/West/ibm-437.ucm
new file mode 100644
index 00000000000..5d9a2ad5cdd
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-437.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:42 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B001B5.RPMAP100 and 01B534B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-437"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-437
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A2> \x9B |0
+<U00A3> \x9C |0
+<U00A5> \x9D |0
+<U00A7> \x15 |1
+<U00AA> \xA6 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B6> \x14 |1
+<U00B7> \xFA |0
+<U00BA> \xA7 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BF> \xA8 |0
+<U00C4> \x8E |0
+<U00C5> \x8F |0
+<U00C6> \x92 |0
+<U00C7> \x80 |0
+<U00C9> \x90 |0
+<U00D1> \xA5 |0
+<U00D6> \x99 |0
+<U00DC> \x9A |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E4> \x84 |0
+<U00E5> \x86 |0
+<U00E6> \x91 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00EC> \x8D |0
+<U00ED> \xA1 |0
+<U00EE> \x8C |0
+<U00EF> \x8B |0
+<U00F1> \xA4 |0
+<U00F2> \x95 |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U00FF> \x98 |0
+<U0192> \x9F |0
+<U0393> \xE2 |0
+<U0398> \xE9 |0
+<U03A3> \xE4 |0
+<U03A6> \xE8 |0
+<U03A9> \xEA |0
+<U03B1> \xE0 |0
+<U03B4> \xEB |0
+<U03B5> \xEE |0
+<U03BC> \xE6 |0
+<U03C0> \xE3 |0
+<U03C3> \xE5 |0
+<U03C4> \xE7 |0
+<U03C6> \xED |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U207F> \xFC |0
+<U20A7> \x9E |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221E> \xEC |0
+<U221F> \x1C |1
+<U2229> \xEF |0
+<U2248> \xF7 |0
+<U2261> \xF0 |0
+<U2264> \xF3 |0
+<U2265> \xF2 |0
+<U2302> \x7F |2
+<U2310> \xA9 |0
+<U2320> \xF4 |0
+<U2321> \xF5 |0
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-4909.ucm b/mcs/class/I18N/West/ibm-4909.ucm
new file mode 100644
index 00000000000..b1d893ecccc
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-4909.ucm
@@ -0,0 +1,374 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1999-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:44 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0132D.RPMAP100 and 132D44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-4909"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-4909
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A3> \xA3 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B7> \xB7 |1
+<U00BB> \xBB |0
+<U00BD> \xBD |0
+<U0385> \xB5 |0
+<U0386> \xB6 |0
+<U0387> \xB7 |0
+<U0388> \xB8 |0
+<U0389> \xB9 |0
+<U038A> \xBA |0
+<U038C> \xBC |0
+<U038E> \xBE |0
+<U038F> \xBF |0
+<U0390> \xC0 |0
+<U0391> \xC1 |0
+<U0392> \xC2 |0
+<U0393> \xC3 |0
+<U0394> \xC4 |0
+<U0395> \xC5 |0
+<U0396> \xC6 |0
+<U0397> \xC7 |0
+<U0398> \xC8 |0
+<U0399> \xC9 |0
+<U039A> \xCA |0
+<U039B> \xCB |0
+<U039C> \xCC |0
+<U039D> \xCD |0
+<U039E> \xCE |0
+<U039F> \xCF |0
+<U03A0> \xD0 |0
+<U03A1> \xD1 |0
+<U03A3> \xD3 |0
+<U03A4> \xD4 |0
+<U03A5> \xD5 |0
+<U03A6> \xD6 |0
+<U03A7> \xD7 |0
+<U03A8> \xD8 |0
+<U03A9> \xD9 |0
+<U03AA> \xDA |0
+<U03AB> \xDB |0
+<U03AC> \xDC |0
+<U03AD> \xDD |0
+<U03AE> \xDE |0
+<U03AF> \xDF |0
+<U03B0> \xE0 |0
+<U03B1> \xE1 |0
+<U03B2> \xE2 |0
+<U03B3> \xE3 |0
+<U03B4> \xE4 |0
+<U03B5> \xE5 |0
+<U03B6> \xE6 |0
+<U03B7> \xE7 |0
+<U03B8> \xE8 |0
+<U03B9> \xE9 |0
+<U03BA> \xEA |0
+<U03BB> \xEB |0
+<U03BC> \xEC |0
+<U03BD> \xED |0
+<U03BE> \xEE |0
+<U03BF> \xEF |0
+<U03C0> \xF0 |0
+<U03C1> \xF1 |0
+<U03C2> \xF2 |0
+<U03C3> \xF3 |0
+<U03C4> \xF4 |0
+<U03C5> \xF5 |0
+<U03C6> \xF6 |0
+<U03C7> \xF7 |0
+<U03C8> \xF8 |0
+<U03C9> \xF9 |0
+<U03CA> \xFA |0
+<U03CB> \xFB |0
+<U03CC> \xFC |0
+<U03CD> \xFD |0
+<U03CE> \xFE |0
+<U03D5> \xF6 |1
+<U2015> \xAF |0
+<U2018> \xA1 |0
+<U2019> \xA2 |0
+<U20AC> \xA4 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-5346.ucm b/mcs/class/I18N/West/ibm-5346.ucm
new file mode 100644
index 00000000000..d0c0fb6aa55
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-5346.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:44 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E2.RPMAP100 and 14E244B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5346"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5346
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U0083> \x83 |0
+<U0088> \x88 |0
+<U0090> \x90 |0
+<U0098> \x98 |0
+<U00A0> \xA0 |0
+<U00A4> \xA4 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00BB> \xBB |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C4> \xC4 |0
+<U00C7> \xC7 |0
+<U00C9> \xC9 |0
+<U00CB> \xCB |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00DA> \xDA |0
+<U00DC> \xDC |0
+<U00DD> \xDD |0
+<U00DF> \xDF |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E4> \xE4 |0
+<U00E7> \xE7 |0
+<U00E9> \xE9 |0
+<U00EB> \xEB |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00FA> \xFA |0
+<U00FC> \xFC |0
+<U00FD> \xFD |0
+<U0102> \xC3 |0
+<U0103> \xE3 |0
+<U0104> \xA5 |0
+<U0105> \xB9 |0
+<U0106> \xC6 |0
+<U0107> \xE6 |0
+<U010C> \xC8 |0
+<U010D> \xE8 |0
+<U010E> \xCF |0
+<U010F> \xEF |0
+<U0110> \xD0 |0
+<U0111> \xF0 |0
+<U0118> \xCA |0
+<U0119> \xEA |0
+<U011A> \xCC |0
+<U011B> \xEC |0
+<U0139> \xC5 |0
+<U013A> \xE5 |0
+<U013D> \xBC |0
+<U013E> \xBE |0
+<U0141> \xA3 |0
+<U0142> \xB3 |0
+<U0143> \xD1 |0
+<U0144> \xF1 |0
+<U0147> \xD2 |0
+<U0148> \xF2 |0
+<U0150> \xD5 |0
+<U0151> \xF5 |0
+<U0154> \xC0 |0
+<U0155> \xE0 |0
+<U0158> \xD8 |0
+<U0159> \xF8 |0
+<U015A> \x8C |0
+<U015B> \x9C |0
+<U015E> \xAA |0
+<U015F> \xBA |0
+<U0160> \x8A |0
+<U0161> \x9A |0
+<U0162> \xDE |0
+<U0163> \xFE |0
+<U0164> \x8D |0
+<U0165> \x9D |0
+<U016E> \xD9 |0
+<U016F> \xF9 |0
+<U0170> \xDB |0
+<U0171> \xFB |0
+<U0179> \x8F |0
+<U017A> \x9F |0
+<U017B> \xAF |0
+<U017C> \xBF |0
+<U017D> \x8E |0
+<U017E> \x9E |0
+<U02C7> \xA1 |0
+<U02D8> \xA2 |0
+<U02D9> \xFF |0
+<U02DB> \xB2 |0
+<U02DD> \xBD |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-5348.ucm b/mcs/class/I18N/West/ibm-5348.ucm
new file mode 100644
index 00000000000..6e5f9521527
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-5348.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:51:37 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E4.RPMAP100 and 14E444B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5348"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5348
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U008D> \x8D |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U009D> \x9D |0
+<U00A0> \xA0 |0
+<U00A1> \xA1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AA> \xAA |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00B9> \xB9 |0
+<U00BA> \xBA |0
+<U00BB> \xBB |0
+<U00BC> \xBC |0
+<U00BD> \xBD |0
+<U00BE> \xBE |0
+<U00BF> \xBF |0
+<U00C0> \xC0 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C3> \xC3 |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xC6 |0
+<U00C7> \xC7 |0
+<U00C8> \xC8 |0
+<U00C9> \xC9 |0
+<U00CA> \xCA |0
+<U00CB> \xCB |0
+<U00CC> \xCC |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00CF> \xCF |0
+<U00D0> \xD0 |0
+<U00D1> \xD1 |0
+<U00D2> \xD2 |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D5> \xD5 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xD8 |0
+<U00D9> \xD9 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DD> \xDD |0
+<U00DE> \xDE |0
+<U00DF> \xDF |0
+<U00E0> \xE0 |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E3> \xE3 |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xE6 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00EC> \xEC |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F0> \xF0 |0
+<U00F1> \xF1 |0
+<U00F2> \xF2 |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F5> \xF5 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xF8 |0
+<U00F9> \xF9 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U00FD> \xFD |0
+<U00FE> \xFE |0
+<U00FF> \xFF |0
+<U0152> \x8C |0
+<U0153> \x9C |0
+<U0160> \x8A |0
+<U0161> \x9A |0
+<U0178> \x9F |0
+<U017D> \x8E |0
+<U017E> \x9E |0
+<U0192> \x83 |0
+<U02C6> \x88 |0
+<U02DC> \x98 |0
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-5349.ucm b/mcs/class/I18N/West/ibm-5349.ucm
new file mode 100644
index 00000000000..900c9984fdb
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-5349.ucm
@@ -0,0 +1,376 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:44 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B014E5.RPMAP100 and 14E544B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-5349"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-5349
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0081> \x81 |0
+<U0088> \x88 |0
+<U008A> \x8A |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0098> \x98 |0
+<U009A> \x9A |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A5> \xA5 |0
+<U00A6> \xA6 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \xA9 |0
+<U00AA> \xAA |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00BB> \xBB |0
+<U00BD> \xBD |0
+<U0192> \x83 |0
+<U0384> \xB4 |0
+<U0385> \xA1 |0
+<U0386> \xA2 |0
+<U0388> \xB8 |0
+<U0389> \xB9 |0
+<U038A> \xBA |0
+<U038C> \xBC |0
+<U038E> \xBE |0
+<U038F> \xBF |0
+<U0390> \xC0 |0
+<U0391> \xC1 |0
+<U0392> \xC2 |0
+<U0393> \xC3 |0
+<U0394> \xC4 |0
+<U0395> \xC5 |0
+<U0396> \xC6 |0
+<U0397> \xC7 |0
+<U0398> \xC8 |0
+<U0399> \xC9 |0
+<U039A> \xCA |0
+<U039B> \xCB |0
+<U039C> \xCC |0
+<U039D> \xCD |0
+<U039E> \xCE |0
+<U039F> \xCF |0
+<U03A0> \xD0 |0
+<U03A1> \xD1 |0
+<U03A3> \xD3 |0
+<U03A4> \xD4 |0
+<U03A5> \xD5 |0
+<U03A6> \xD6 |0
+<U03A7> \xD7 |0
+<U03A8> \xD8 |0
+<U03A9> \xD9 |0
+<U03AA> \xDA |0
+<U03AB> \xDB |0
+<U03AC> \xDC |0
+<U03AD> \xDD |0
+<U03AE> \xDE |0
+<U03AF> \xDF |0
+<U03B0> \xE0 |0
+<U03B1> \xE1 |0
+<U03B2> \xE2 |0
+<U03B3> \xE3 |0
+<U03B4> \xE4 |0
+<U03B5> \xE5 |0
+<U03B6> \xE6 |0
+<U03B7> \xE7 |0
+<U03B8> \xE8 |0
+<U03B9> \xE9 |0
+<U03BA> \xEA |0
+<U03BB> \xEB |0
+<U03BC> \xEC |0
+<U03BD> \xED |0
+<U03BE> \xEE |0
+<U03BF> \xEF |0
+<U03C0> \xF0 |0
+<U03C1> \xF1 |0
+<U03C2> \xF2 |0
+<U03C3> \xF3 |0
+<U03C4> \xF4 |0
+<U03C5> \xF5 |0
+<U03C6> \xF6 |0
+<U03C7> \xF7 |0
+<U03C8> \xF8 |0
+<U03C9> \xF9 |0
+<U03CA> \xFA |0
+<U03CB> \xFB |0
+<U03CC> \xFC |0
+<U03CD> \xFD |0
+<U03CE> \xFE |0
+<U03D5> \xF6 |1
+<U2013> \x96 |0
+<U2014> \x97 |0
+<U2015> \xAF |0
+<U2018> \x91 |0
+<U2019> \x92 |0
+<U201A> \x82 |0
+<U201C> \x93 |0
+<U201D> \x94 |0
+<U201E> \x84 |0
+<U2020> \x86 |0
+<U2021> \x87 |0
+<U2022> \x95 |0
+<U2026> \x85 |0
+<U2030> \x89 |0
+<U2039> \x8B |0
+<U203A> \x9B |0
+<U20AC> \x80 |0
+<U2122> \x99 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-850.ucm b/mcs/class/I18N/West/ibm-850.ucm
new file mode 100644
index 00000000000..7502e8dca2b
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-850.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:42 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00352.RPMAP100 and 035234B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-850"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-850
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A2> \xBD |0
+<U00A3> \x9C |0
+<U00A4> \xCF |0
+<U00A5> \xBE |0
+<U00A6> \xDD |0
+<U00A7> \xF5 |0
+<U00A8> \xF9 |0
+<U00A9> \xB8 |0
+<U00AA> \xA6 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00AD> \xF0 |0
+<U00AE> \xA9 |0
+<U00AF> \xEE |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B3> \xFC |0
+<U00B4> \xEF |0
+<U00B5> \xE6 |0
+<U00B6> \xF4 |0
+<U00B7> \xFA |0
+<U00B8> \xF7 |0
+<U00B9> \xFB |0
+<U00BA> \xA7 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BE> \xF3 |0
+<U00BF> \xA8 |0
+<U00C0> \xB7 |0
+<U00C1> \xB5 |0
+<U00C2> \xB6 |0
+<U00C3> \xC7 |0
+<U00C4> \x8E |0
+<U00C5> \x8F |0
+<U00C6> \x92 |0
+<U00C7> \x80 |0
+<U00C8> \xD4 |0
+<U00C9> \x90 |0
+<U00CA> \xD2 |0
+<U00CB> \xD3 |0
+<U00CC> \xDE |0
+<U00CD> \xD6 |0
+<U00CE> \xD7 |0
+<U00CF> \xD8 |0
+<U00D0> \xD1 |0
+<U00D1> \xA5 |0
+<U00D2> \xE3 |0
+<U00D3> \xE0 |0
+<U00D4> \xE2 |0
+<U00D5> \xE5 |0
+<U00D6> \x99 |0
+<U00D7> \x9E |0
+<U00D8> \x9D |0
+<U00D9> \xEB |0
+<U00DA> \xE9 |0
+<U00DB> \xEA |0
+<U00DC> \x9A |0
+<U00DD> \xED |0
+<U00DE> \xE8 |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E3> \xC6 |0
+<U00E4> \x84 |0
+<U00E5> \x86 |0
+<U00E6> \x91 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00EC> \x8D |0
+<U00ED> \xA1 |0
+<U00EE> \x8C |0
+<U00EF> \x8B |0
+<U00F0> \xD0 |0
+<U00F1> \xA4 |0
+<U00F2> \x95 |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F5> \xE4 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00F8> \x9B |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U00FD> \xEC |0
+<U00FE> \xE7 |0
+<U00FF> \x98 |0
+<U0110> \xD1 |1
+<U0131> \xD5 |0
+<U0192> \x9F |0
+<U2017> \xF2 |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U203E> \xEE |1
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2302> \x7F |2
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2554> \xC9 |0
+<U2557> \xBB |0
+<U255A> \xC8 |0
+<U255D> \xBC |0
+<U2560> \xCC |0
+<U2563> \xB9 |0
+<U2566> \xCB |0
+<U2569> \xCA |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266C> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-860.ucm b/mcs/class/I18N/West/ibm-860.ucm
new file mode 100644
index 00000000000..05a02cba81f
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-860.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0035C.RPMAP100 and 035C34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-860"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-860
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A2> \x9B |0
+<U00A3> \x9C |0
+<U00A7> \x15 |1
+<U00AA> \xA6 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B6> \x14 |1
+<U00B7> \xFA |0
+<U00BA> \xA7 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BF> \xA8 |0
+<U00C0> \x91 |0
+<U00C1> \x86 |0
+<U00C2> \x8F |0
+<U00C3> \x8E |0
+<U00C7> \x80 |0
+<U00C8> \x92 |0
+<U00C9> \x90 |0
+<U00CA> \x89 |0
+<U00CC> \x98 |0
+<U00CD> \x8B |0
+<U00D1> \xA5 |0
+<U00D2> \xA9 |0
+<U00D3> \x9F |0
+<U00D4> \x8C |0
+<U00D5> \x99 |0
+<U00D9> \x9D |0
+<U00DA> \x96 |0
+<U00DC> \x9A |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E3> \x84 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EC> \x8D |0
+<U00ED> \xA1 |0
+<U00F1> \xA4 |0
+<U00F2> \x95 |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F5> \x94 |0
+<U00F7> \xF6 |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FC> \x81 |0
+<U0393> \xE2 |0
+<U0398> \xE9 |0
+<U03A3> \xE4 |0
+<U03A6> \xE8 |0
+<U03A9> \xEA |0
+<U03B1> \xE0 |0
+<U03B4> \xEB |0
+<U03B5> \xEE |0
+<U03BC> \xE6 |0
+<U03C0> \xE3 |0
+<U03C3> \xE5 |0
+<U03C4> \xE7 |0
+<U03C6> \xED |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U207F> \xFC |0
+<U20A7> \x9E |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221E> \xEC |0
+<U221F> \x1C |1
+<U2229> \xEF |0
+<U2248> \xF7 |0
+<U2261> \xF0 |0
+<U2264> \xF3 |0
+<U2265> \xF2 |0
+<U2302> \x7F |2
+<U2320> \xF4 |0
+<U2321> \xF5 |0
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-861.ucm b/mcs/class/I18N/West/ibm-861.ucm
new file mode 100644
index 00000000000..c93f5074542
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-861.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0035D.RPMAP100 and 035D34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-861"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-861
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A3> \x9C |0
+<U00A7> \x15 |1
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B6> \x14 |1
+<U00B7> \xFA |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BF> \xA8 |0
+<U00C1> \xA4 |0
+<U00C4> \x8E |0
+<U00C5> \x8F |0
+<U00C6> \x92 |0
+<U00C7> \x80 |0
+<U00C9> \x90 |0
+<U00CD> \xA5 |0
+<U00D0> \x8B |0
+<U00D3> \xA6 |0
+<U00D6> \x99 |0
+<U00D8> \x9D |0
+<U00DA> \xA7 |0
+<U00DC> \x9A |0
+<U00DD> \x97 |0
+<U00DE> \x8D |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E4> \x84 |0
+<U00E5> \x86 |0
+<U00E6> \x91 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00ED> \xA1 |0
+<U00F0> \x8C |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00F8> \x9B |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U00FD> \x98 |0
+<U00FE> \x95 |0
+<U0192> \x9F |0
+<U0393> \xE2 |0
+<U0398> \xE9 |0
+<U03A3> \xE4 |0
+<U03A6> \xE8 |0
+<U03A9> \xEA |0
+<U03B1> \xE0 |0
+<U03B4> \xEB |0
+<U03B5> \xEE |0
+<U03BC> \xE6 |0
+<U03C0> \xE3 |0
+<U03C3> \xE5 |0
+<U03C4> \xE7 |0
+<U03C6> \xED |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U207F> \xFC |0
+<U20A7> \x9E |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221E> \xEC |0
+<U221F> \x1C |1
+<U2229> \xEF |0
+<U2248> \xF7 |0
+<U2261> \xF0 |0
+<U2264> \xF3 |0
+<U2265> \xF2 |0
+<U2302> \x7F |2
+<U2310> \xA9 |0
+<U2320> \xF4 |0
+<U2321> \xF5 |0
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-863.ucm b/mcs/class/I18N/West/ibm-863.ucm
new file mode 100644
index 00000000000..1effe317097
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-863.ucm
@@ -0,0 +1,415 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B0035F.RPMAP100 and 035F34B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-863"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-863
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A2> \x9B |0
+<U00A3> \x9C |0
+<U00A4> \x98 |0
+<U00A6> \xA0 |0
+<U00A7> \x8F |0
+<U00A8> \xA4 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00AF> \xA7 |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B3> \xA6 |0
+<U00B4> \xA1 |0
+<U00B6> \x86 |0
+<U00B7> \xFA |0
+<U00B8> \xA5 |0
+<U00BB> \xAF |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BE> \xAD |0
+<U00C0> \x8E |0
+<U00C2> \x84 |0
+<U00C7> \x80 |0
+<U00C8> \x91 |0
+<U00C9> \x90 |0
+<U00CA> \x92 |0
+<U00CB> \x94 |0
+<U00CE> \xA8 |0
+<U00CF> \x95 |0
+<U00D4> \x99 |0
+<U00D9> \x9D |0
+<U00DB> \x9E |0
+<U00DC> \x9A |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E2> \x83 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00EE> \x8C |0
+<U00EF> \x8B |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F7> \xF6 |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U0192> \x9F |0
+<U0393> \xE2 |0
+<U0398> \xE9 |0
+<U03A3> \xE4 |0
+<U03A6> \xE8 |0
+<U03A9> \xEA |0
+<U03B1> \xE0 |0
+<U03B4> \xEB |0
+<U03B5> \xEE |0
+<U03BC> \xE6 |0
+<U03C0> \xE3 |0
+<U03C3> \xE5 |0
+<U03C4> \xE7 |0
+<U03C6> \xED |0
+<U2017> \x8D |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U203E> \xA7 |1
+<U207F> \xFC |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221E> \xEC |0
+<U221F> \x1C |1
+<U2229> \xEF |0
+<U2248> \xF7 |0
+<U2261> \xF0 |0
+<U2264> \xF3 |0
+<U2265> \xF2 |0
+<U2302> \x7F |2
+<U2310> \xA9 |0
+<U2320> \xF4 |0
+<U2321> \xF5 |0
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-865.ucm b/mcs/class/I18N/West/ibm-865.ucm
new file mode 100644
index 00000000000..f1362fbb2bb
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-865.ucm
@@ -0,0 +1,416 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 08:50:43 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00361.RPMAP100 and 036134B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-865"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x7F
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-865
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x7F |0
+<U001B> \x1B |0
+<U001C> \x1A |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x1C |0
+<U00A0> \xFF |0
+<U00A1> \xAD |0
+<U00A3> \x9C |0
+<U00A4> \xAF |0
+<U00A7> \x15 |1
+<U00AA> \xA6 |0
+<U00AB> \xAE |0
+<U00AC> \xAA |0
+<U00B0> \xF8 |0
+<U00B1> \xF1 |0
+<U00B2> \xFD |0
+<U00B6> \x14 |1
+<U00B7> \xFA |0
+<U00BA> \xA7 |0
+<U00BC> \xAC |0
+<U00BD> \xAB |0
+<U00BF> \xA8 |0
+<U00C4> \x8E |0
+<U00C5> \x8F |0
+<U00C6> \x92 |0
+<U00C7> \x80 |0
+<U00C9> \x90 |0
+<U00D1> \xA5 |0
+<U00D6> \x99 |0
+<U00D8> \x9D |0
+<U00DC> \x9A |0
+<U00DF> \xE1 |0
+<U00E0> \x85 |0
+<U00E1> \xA0 |0
+<U00E2> \x83 |0
+<U00E4> \x84 |0
+<U00E5> \x86 |0
+<U00E6> \x91 |0
+<U00E7> \x87 |0
+<U00E8> \x8A |0
+<U00E9> \x82 |0
+<U00EA> \x88 |0
+<U00EB> \x89 |0
+<U00EC> \x8D |0
+<U00ED> \xA1 |0
+<U00EE> \x8C |0
+<U00EF> \x8B |0
+<U00F1> \xA4 |0
+<U00F2> \x95 |0
+<U00F3> \xA2 |0
+<U00F4> \x93 |0
+<U00F6> \x94 |0
+<U00F7> \xF6 |0
+<U00F8> \x9B |0
+<U00F9> \x97 |0
+<U00FA> \xA3 |0
+<U00FB> \x96 |0
+<U00FC> \x81 |0
+<U00FF> \x98 |0
+<U0192> \x9F |0
+<U0393> \xE2 |0
+<U0398> \xE9 |0
+<U03A3> \xE4 |0
+<U03A6> \xE8 |0
+<U03A9> \xEA |0
+<U03B1> \xE0 |0
+<U03B4> \xEB |0
+<U03B5> \xEE |0
+<U03BC> \xE6 |0
+<U03C0> \xE3 |0
+<U03C3> \xE5 |0
+<U03C4> \xE7 |0
+<U03C6> \xED |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U207F> \xFC |0
+<U20A7> \x9E |0
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |1
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U2219> \xF9 |0
+<U221A> \xFB |0
+<U221E> \xEC |0
+<U221F> \x1C |1
+<U2229> \xEF |0
+<U2248> \xF7 |0
+<U2261> \xF0 |0
+<U2264> \xF3 |0
+<U2265> \xF2 |0
+<U2302> \x7F |2
+<U2310> \xA9 |0
+<U2320> \xF4 |0
+<U2321> \xF5 |0
+<U2500> \xC4 |0
+<U2502> \xB3 |0
+<U250C> \xDA |0
+<U2510> \xBF |0
+<U2514> \xC0 |0
+<U2518> \xD9 |0
+<U251C> \xC3 |0
+<U2524> \xB4 |0
+<U252C> \xC2 |0
+<U2534> \xC1 |0
+<U253C> \xC5 |0
+<U2550> \xCD |0
+<U2551> \xBA |0
+<U2552> \xD5 |0
+<U2553> \xD6 |0
+<U2554> \xC9 |0
+<U2555> \xB8 |0
+<U2556> \xB7 |0
+<U2557> \xBB |0
+<U2558> \xD4 |0
+<U2559> \xD3 |0
+<U255A> \xC8 |0
+<U255B> \xBE |0
+<U255C> \xBD |0
+<U255D> \xBC |0
+<U255E> \xC6 |0
+<U255F> \xC7 |0
+<U2560> \xCC |0
+<U2561> \xB5 |0
+<U2562> \xB6 |0
+<U2563> \xB9 |0
+<U2564> \xD1 |0
+<U2565> \xD2 |0
+<U2566> \xCB |0
+<U2567> \xCF |0
+<U2568> \xD0 |0
+<U2569> \xCA |0
+<U256A> \xD8 |0
+<U256B> \xD7 |0
+<U256C> \xCE |0
+<U2580> \xDF |0
+<U2584> \xDC |0
+<U2588> \xDB |0
+<U258C> \xDD |0
+<U2590> \xDE |0
+<U2591> \xB0 |0
+<U2592> \xB1 |0
+<U2593> \xB2 |0
+<U25A0> \xFE |0
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266B> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \xB3 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |1
+<UFFEC> \x19 |1
+<UFFED> \xFE |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-912.ucm b/mcs/class/I18N/West/ibm-912.ucm
new file mode 100644
index 00000000000..bcd31fa1477
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-912.ucm
@@ -0,0 +1,446 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00390.RPMAP100 and 039034B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-912"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-912
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A2> \x8D |1
+<U00A4> \xA4 |0
+<U00A5> \x8E |1
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00A9> \x88 |1
+<U00AD> \xAD |0
+<U00AE> \x9F |1
+<U00B0> \xB0 |0
+<U00B4> \xB4 |0
+<U00B6> \x14 |1
+<U00B8> \xB8 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C4> \xC4 |0
+<U00C7> \xC7 |0
+<U00C9> \xC9 |0
+<U00CB> \xCB |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00D0> \xD0 |1
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00DA> \xDA |0
+<U00DC> \xDC |0
+<U00DD> \xDD |0
+<U00DF> \xDF |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E4> \xE4 |0
+<U00E7> \xE7 |0
+<U00E9> \xE9 |0
+<U00EB> \xEB |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00FA> \xFA |0
+<U00FC> \xFC |0
+<U00FD> \xFD |0
+<U0102> \xC3 |0
+<U0103> \xE3 |0
+<U0104> \xA1 |0
+<U0105> \xB1 |0
+<U0106> \xC6 |0
+<U0107> \xE6 |0
+<U010C> \xC8 |0
+<U010D> \xE8 |0
+<U010E> \xCF |0
+<U010F> \xEF |0
+<U0110> \xD0 |0
+<U0111> \xF0 |0
+<U0118> \xCA |0
+<U0119> \xEA |0
+<U011A> \xCC |0
+<U011B> \xEC |0
+<U0139> \xC5 |0
+<U013A> \xE5 |0
+<U013D> \xA5 |0
+<U013E> \xB5 |0
+<U0141> \xA3 |0
+<U0142> \xB3 |0
+<U0143> \xD1 |0
+<U0144> \xF1 |0
+<U0147> \xD2 |0
+<U0148> \xF2 |0
+<U0150> \xD5 |0
+<U0151> \xF5 |0
+<U0154> \xC0 |0
+<U0155> \xE0 |0
+<U0158> \xD8 |0
+<U0159> \xF8 |0
+<U015A> \xA6 |0
+<U015B> \xB6 |0
+<U015E> \xAA |0
+<U015F> \xBA |0
+<U0160> \xA9 |0
+<U0161> \xB9 |0
+<U0162> \xDE |0
+<U0163> \xFE |0
+<U0164> \xAB |0
+<U0165> \xBB |0
+<U016E> \xD9 |0
+<U016F> \xF9 |0
+<U0170> \xDB |0
+<U0171> \xFB |0
+<U0179> \xAC |0
+<U017A> \xBC |0
+<U017B> \xAF |0
+<U017C> \xBF |0
+<U017D> \xAE |0
+<U017E> \xBE |0
+<U02C7> \xB7 |0
+<U02D8> \xA2 |0
+<U02D9> \xFF |0
+<U02DB> \xB2 |0
+<U02DD> \xBD |0
+<U2022> \x07 |1
+<U203C> \x13 |1
+<U2190> \x1B |1
+<U2191> \x18 |1
+<U2192> \x1A |2
+<U2193> \x19 |1
+<U2194> \x1D |1
+<U2195> \x12 |1
+<U21A8> \x17 |1
+<U221F> \x1C |1
+<U2500> \x94 |1
+<U2502> \x83 |1
+<U250C> \x86 |1
+<U2510> \x8F |1
+<U2514> \x90 |1
+<U2518> \x85 |1
+<U251C> \x93 |1
+<U2524> \x84 |1
+<U252C> \x92 |1
+<U2534> \x91 |1
+<U253C> \x95 |1
+<U2550> \x9D |1
+<U2551> \x8A |1
+<U2554> \x99 |1
+<U2557> \x8B |1
+<U255A> \x98 |1
+<U255D> \x8C |1
+<U2560> \x9C |1
+<U2563> \x89 |1
+<U2566> \x9B |1
+<U2569> \x9A |1
+<U256C> \x9E |1
+<U2580> \x97 |1
+<U2584> \x96 |1
+<U2588> \x87 |1
+<U2591> \x80 |1
+<U2592> \x81 |1
+<U2593> \x82 |1
+<U25AC> \x16 |1
+<U25B2> \x1E |1
+<U25BA> \x10 |1
+<U25BC> \x1F |1
+<U25C4> \x11 |1
+<U25CB> \x09 |1
+<U25D8> \x08 |1
+<U25D9> \x0A |1
+<U263A> \x01 |1
+<U263B> \x02 |1
+<U263C> \x0F |1
+<U2640> \x0C |1
+<U2642> \x0B |1
+<U2660> \x06 |1
+<U2663> \x05 |1
+<U2665> \x03 |1
+<U2666> \x04 |1
+<U266A> \x0D |1
+<U266C> \x0E |1
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+<UFFE8> \x83 |1
+<UFFE9> \x1B |1
+<UFFEA> \x18 |1
+<UFFEB> \x1A |2
+<UFFEC> \x19 |1
+<UFFEE> \x09 |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-913.ucm b/mcs/class/I18N/West/ibm-913.ucm
new file mode 100644
index 00000000000..213fbd6c7f8
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-913.ucm
@@ -0,0 +1,370 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1995-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 34B00391.RPMAP100 and 039134B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-913"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-913
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A3> \xA3 |0
+<U00A4> \xA4 |0
+<U00A7> \xA7 |0
+<U00A8> \xA8 |0
+<U00AD> \xAD |0
+<U00B0> \xB0 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B4> \xB4 |0
+<U00B5> \xB5 |0
+<U00B7> \xB7 |0
+<U00B8> \xB8 |0
+<U00BD> \xBD |0
+<U00C0> \xC0 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C4> \xC4 |0
+<U00C7> \xC7 |0
+<U00C8> \xC8 |0
+<U00C9> \xC9 |0
+<U00CA> \xCA |0
+<U00CB> \xCB |0
+<U00CC> \xCC |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00CF> \xCF |0
+<U00D1> \xD1 |0
+<U00D2> \xD2 |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D9> \xD9 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DF> \xDF |0
+<U00E0> \xE0 |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E4> \xE4 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00EC> \xEC |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F1> \xF1 |0
+<U00F2> \xF2 |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F9> \xF9 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U0108> \xC6 |0
+<U0109> \xE6 |0
+<U010A> \xC5 |0
+<U010B> \xE5 |0
+<U011C> \xD8 |0
+<U011D> \xF8 |0
+<U011E> \xAB |0
+<U011F> \xBB |0
+<U0120> \xD5 |0
+<U0121> \xF5 |0
+<U0124> \xA6 |0
+<U0125> \xB6 |0
+<U0126> \xA1 |0
+<U0127> \xB1 |0
+<U0130> \xA9 |0
+<U0131> \xB9 |0
+<U0134> \xAC |0
+<U0135> \xBC |0
+<U015C> \xDE |0
+<U015D> \xFE |0
+<U015E> \xAA |0
+<U015F> \xBA |0
+<U016C> \xDD |0
+<U016D> \xFD |0
+<U017B> \xAF |0
+<U017C> \xBF |0
+<U02D8> \xA2 |0
+<U02D9> \xFF |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/ibm-923.ucm b/mcs/class/I18N/West/ibm-923.ucm
new file mode 100644
index 00000000000..78cc496293d
--- /dev/null
+++ b/mcs/class/I18N/West/ibm-923.ucm
@@ -0,0 +1,377 @@
+# *******************************************************************************
+# *
+# * Copyright (C) 1998-2000, International Business Machines
+# * Corporation and others. All Rights Reserved.
+# *
+# *******************************************************************************
+#
+# File created on Mon Nov 13 09:28:04 2000
+#
+# File created by dtcocm version 3.00
+# from source files 44B0039B.RPMAP100 and 039B44B0.TPMAP100
+#
+# Table Version : 1.01
+#
+<code_set_name> "IBM-923"
+<char_name_mask> "AXXXX"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#ISO 10646 IBM-923
+#_________ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U0080> \x80 |0
+<U0081> \x81 |0
+<U0082> \x82 |0
+<U0083> \x83 |0
+<U0084> \x84 |0
+<U0085> \x85 |0
+<U0086> \x86 |0
+<U0087> \x87 |0
+<U0088> \x88 |0
+<U0089> \x89 |0
+<U008A> \x8A |0
+<U008B> \x8B |0
+<U008C> \x8C |0
+<U008D> \x8D |0
+<U008E> \x8E |0
+<U008F> \x8F |0
+<U0090> \x90 |0
+<U0091> \x91 |0
+<U0092> \x92 |0
+<U0093> \x93 |0
+<U0094> \x94 |0
+<U0095> \x95 |0
+<U0096> \x96 |0
+<U0097> \x97 |0
+<U0098> \x98 |0
+<U0099> \x99 |0
+<U009A> \x9A |0
+<U009B> \x9B |0
+<U009C> \x9C |0
+<U009D> \x9D |0
+<U009E> \x9E |0
+<U009F> \x9F |0
+<U00A0> \xA0 |0
+<U00A1> \xA1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A5> \xA5 |0
+<U00A7> \xA7 |0
+<U00A9> \xA9 |0
+<U00AA> \xAA |0
+<U00AB> \xAB |0
+<U00AC> \xAC |0
+<U00AD> \xAD |0
+<U00AE> \xAE |0
+<U00AF> \xAF |0
+<U00B0> \xB0 |0
+<U00B1> \xB1 |0
+<U00B2> \xB2 |0
+<U00B3> \xB3 |0
+<U00B5> \xB5 |0
+<U00B6> \xB6 |0
+<U00B7> \xB7 |0
+<U00B9> \xB9 |0
+<U00BA> \xBA |0
+<U00BB> \xBB |0
+<U00BF> \xBF |0
+<U00C0> \xC0 |0
+<U00C1> \xC1 |0
+<U00C2> \xC2 |0
+<U00C3> \xC3 |0
+<U00C4> \xC4 |0
+<U00C5> \xC5 |0
+<U00C6> \xC6 |0
+<U00C7> \xC7 |0
+<U00C8> \xC8 |0
+<U00C9> \xC9 |0
+<U00CA> \xCA |0
+<U00CB> \xCB |0
+<U00CC> \xCC |0
+<U00CD> \xCD |0
+<U00CE> \xCE |0
+<U00CF> \xCF |0
+<U00D0> \xD0 |0
+<U00D1> \xD1 |0
+<U00D2> \xD2 |0
+<U00D3> \xD3 |0
+<U00D4> \xD4 |0
+<U00D5> \xD5 |0
+<U00D6> \xD6 |0
+<U00D7> \xD7 |0
+<U00D8> \xD8 |0
+<U00D9> \xD9 |0
+<U00DA> \xDA |0
+<U00DB> \xDB |0
+<U00DC> \xDC |0
+<U00DD> \xDD |0
+<U00DE> \xDE |0
+<U00DF> \xDF |0
+<U00E0> \xE0 |0
+<U00E1> \xE1 |0
+<U00E2> \xE2 |0
+<U00E3> \xE3 |0
+<U00E4> \xE4 |0
+<U00E5> \xE5 |0
+<U00E6> \xE6 |0
+<U00E7> \xE7 |0
+<U00E8> \xE8 |0
+<U00E9> \xE9 |0
+<U00EA> \xEA |0
+<U00EB> \xEB |0
+<U00EC> \xEC |0
+<U00ED> \xED |0
+<U00EE> \xEE |0
+<U00EF> \xEF |0
+<U00F0> \xF0 |0
+<U00F1> \xF1 |0
+<U00F2> \xF2 |0
+<U00F3> \xF3 |0
+<U00F4> \xF4 |0
+<U00F5> \xF5 |0
+<U00F6> \xF6 |0
+<U00F7> \xF7 |0
+<U00F8> \xF8 |0
+<U00F9> \xF9 |0
+<U00FA> \xFA |0
+<U00FB> \xFB |0
+<U00FC> \xFC |0
+<U00FD> \xFD |0
+<U00FE> \xFE |0
+<U00FF> \xFF |0
+<U0152> \xBC |0
+<U0153> \xBD |0
+<U0160> \xA6 |0
+<U0161> \xA8 |0
+<U0178> \xBE |0
+<U017D> \xB4 |0
+<U017E> \xB8 |0
+<U20AC> \xA4 |0
+<UFF01> \x21 |1
+<UFF02> \x22 |1
+<UFF03> \x23 |1
+<UFF04> \x24 |1
+<UFF05> \x25 |1
+<UFF06> \x26 |1
+<UFF07> \x27 |1
+<UFF08> \x28 |1
+<UFF09> \x29 |1
+<UFF0A> \x2A |1
+<UFF0B> \x2B |1
+<UFF0C> \x2C |1
+<UFF0D> \x2D |1
+<UFF0E> \x2E |1
+<UFF0F> \x2F |1
+<UFF10> \x30 |1
+<UFF11> \x31 |1
+<UFF12> \x32 |1
+<UFF13> \x33 |1
+<UFF14> \x34 |1
+<UFF15> \x35 |1
+<UFF16> \x36 |1
+<UFF17> \x37 |1
+<UFF18> \x38 |1
+<UFF19> \x39 |1
+<UFF1A> \x3A |1
+<UFF1B> \x3B |1
+<UFF1C> \x3C |1
+<UFF1D> \x3D |1
+<UFF1E> \x3E |1
+<UFF1F> \x3F |1
+<UFF20> \x40 |1
+<UFF21> \x41 |1
+<UFF22> \x42 |1
+<UFF23> \x43 |1
+<UFF24> \x44 |1
+<UFF25> \x45 |1
+<UFF26> \x46 |1
+<UFF27> \x47 |1
+<UFF28> \x48 |1
+<UFF29> \x49 |1
+<UFF2A> \x4A |1
+<UFF2B> \x4B |1
+<UFF2C> \x4C |1
+<UFF2D> \x4D |1
+<UFF2E> \x4E |1
+<UFF2F> \x4F |1
+<UFF30> \x50 |1
+<UFF31> \x51 |1
+<UFF32> \x52 |1
+<UFF33> \x53 |1
+<UFF34> \x54 |1
+<UFF35> \x55 |1
+<UFF36> \x56 |1
+<UFF37> \x57 |1
+<UFF38> \x58 |1
+<UFF39> \x59 |1
+<UFF3A> \x5A |1
+<UFF3B> \x5B |1
+<UFF3C> \x5C |1
+<UFF3D> \x5D |1
+<UFF3E> \x5E |1
+<UFF3F> \x5F |1
+<UFF40> \x60 |1
+<UFF41> \x61 |1
+<UFF42> \x62 |1
+<UFF43> \x63 |1
+<UFF44> \x64 |1
+<UFF45> \x65 |1
+<UFF46> \x66 |1
+<UFF47> \x67 |1
+<UFF48> \x68 |1
+<UFF49> \x69 |1
+<UFF4A> \x6A |1
+<UFF4B> \x6B |1
+<UFF4C> \x6C |1
+<UFF4D> \x6D |1
+<UFF4E> \x6E |1
+<UFF4F> \x6F |1
+<UFF50> \x70 |1
+<UFF51> \x71 |1
+<UFF52> \x72 |1
+<UFF53> \x73 |1
+<UFF54> \x74 |1
+<UFF55> \x75 |1
+<UFF56> \x76 |1
+<UFF57> \x77 |1
+<UFF58> \x78 |1
+<UFF59> \x79 |1
+<UFF5A> \x7A |1
+<UFF5B> \x7B |1
+<UFF5C> \x7C |1
+<UFF5D> \x7D |1
+<UFF5E> \x7E |1
+END CHARMAP
diff --git a/mcs/class/I18N/West/list.unix b/mcs/class/I18N/West/list.unix
new file mode 100755
index 00000000000..892d20df39f
--- /dev/null
+++ b/mcs/class/I18N/West/list.unix
@@ -0,0 +1,15 @@
+CP10000.cs
+CP10079.cs
+CP1250.cs
+CP1252.cs
+CP1253.cs
+CP28592.cs
+CP28593.cs
+CP28597.cs
+CP28605.cs
+CP437.cs
+CP850.cs
+CP860.cs
+CP861.cs
+CP863.cs
+CP865.cs
diff --git a/mcs/class/I18N/West/mac-is.ucm b/mcs/class/I18N/West/mac-is.ucm
new file mode 100644
index 00000000000..08d5694066f
--- /dev/null
+++ b/mcs/class/I18N/West/mac-is.ucm
@@ -0,0 +1,290 @@
+#________________________________________________________________________
+#
+# (C) COPYRIGHT International Business Machines Corp. 2001
+# All Rights Reserved
+#
+#________________________________________________________________________
+#
+# File created on Thu Apr 05 09:38:46 PDT 2001
+#
+# File created by CharConv tool.
+# Platform: Linux redhat2 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686 unkglibc-
+#
+# Table Version : 1.0
+# The 1st column is the Unicode scalar value.
+# The 2nd column is the codepage byte sequence.
+# The 3rd column is the fallback indicator.
+# The fallback indicator can have one of the following values:
+# |0 for exact 1-1 roundtrip mapping
+# |1 for the best fallback codepage byte sequence.
+# |2 for the substitution character
+# |3 for the best reverse fallback Unicode scaler value
+#
+<code_set_name> "MAC_IS"
+<mb_cur_max> 1
+<mb_cur_min> 1
+<uconv_class> "SBCS"
+<subchar> \x1A
+#
+CHARMAP
+#
+#
+#UNICODE MAC_IS
+#_______ _________
+<U0000> \x00 |0
+<U0001> \x01 |0
+<U0002> \x02 |0
+<U0003> \x03 |0
+<U0004> \x04 |0
+<U0005> \x05 |0
+<U0006> \x06 |0
+<U0007> \x07 |0
+<U0008> \x08 |0
+<U0009> \x09 |0
+<U000A> \x0A |0
+<U000B> \x0B |0
+<U000C> \x0C |0
+<U000D> \x0D |0
+<U000E> \x0E |0
+<U000F> \x0F |0
+<U0010> \x10 |0
+<U0011> \x11 |0
+<U0012> \x12 |0
+<U0013> \x13 |0
+<U0014> \x14 |0
+<U0015> \x15 |0
+<U0016> \x16 |0
+<U0017> \x17 |0
+<U0018> \x18 |0
+<U0019> \x19 |0
+<U001A> \x1A |0
+<U001B> \x1B |0
+<U001C> \x1C |0
+<U001D> \x1D |0
+<U001E> \x1E |0
+<U001F> \x1F |0
+<U0020> \x20 |0
+<U0021> \x21 |0
+<U0022> \x22 |0
+<U0023> \x23 |0
+<U0024> \x24 |0
+<U0025> \x25 |0
+<U0026> \x26 |0
+<U0027> \x27 |0
+<U0028> \x28 |0
+<U0029> \x29 |0
+<U002A> \x2A |0
+<U002B> \x2B |0
+<U002C> \x2C |0
+<U002D> \x2D |0
+<U002E> \x2E |0
+<U002F> \x2F |0
+<U0030> \x30 |0
+<U0031> \x31 |0
+<U0032> \x32 |0
+<U0033> \x33 |0
+<U0034> \x34 |0
+<U0035> \x35 |0
+<U0036> \x36 |0
+<U0037> \x37 |0
+<U0038> \x38 |0
+<U0039> \x39 |0
+<U003A> \x3A |0
+<U003B> \x3B |0
+<U003C> \x3C |0
+<U003D> \x3D |0
+<U003E> \x3E |0
+<U003F> \x3F |0
+<U0040> \x40 |0
+<U0041> \x41 |0
+<U0042> \x42 |0
+<U0043> \x43 |0
+<U0044> \x44 |0
+<U0045> \x45 |0
+<U0046> \x46 |0
+<U0047> \x47 |0
+<U0048> \x48 |0
+<U0049> \x49 |0
+<U004A> \x4A |0
+<U004B> \x4B |0
+<U004C> \x4C |0
+<U004D> \x4D |0
+<U004E> \x4E |0
+<U004F> \x4F |0
+<U0050> \x50 |0
+<U0051> \x51 |0
+<U0052> \x52 |0
+<U0053> \x53 |0
+<U0054> \x54 |0
+<U0055> \x55 |0
+<U0056> \x56 |0
+<U0057> \x57 |0
+<U0058> \x58 |0
+<U0059> \x59 |0
+<U005A> \x5A |0
+<U005B> \x5B |0
+<U005C> \x5C |0
+<U005D> \x5D |0
+<U005E> \x5E |0
+<U005F> \x5F |0
+<U0060> \x60 |0
+<U0061> \x61 |0
+<U0062> \x62 |0
+<U0063> \x63 |0
+<U0064> \x64 |0
+<U0065> \x65 |0
+<U0066> \x66 |0
+<U0067> \x67 |0
+<U0068> \x68 |0
+<U0069> \x69 |0
+<U006A> \x6A |0
+<U006B> \x6B |0
+<U006C> \x6C |0
+<U006D> \x6D |0
+<U006E> \x6E |0
+<U006F> \x6F |0
+<U0070> \x70 |0
+<U0071> \x71 |0
+<U0072> \x72 |0
+<U0073> \x73 |0
+<U0074> \x74 |0
+<U0075> \x75 |0
+<U0076> \x76 |0
+<U0077> \x77 |0
+<U0078> \x78 |0
+<U0079> \x79 |0
+<U007A> \x7A |0
+<U007B> \x7B |0
+<U007C> \x7C |0
+<U007D> \x7D |0
+<U007E> \x7E |0
+<U007F> \x7F |0
+<U00A0> \xCA |0
+<U00A1> \xC1 |0
+<U00A2> \xA2 |0
+<U00A3> \xA3 |0
+<U00A4> \xDB |0
+<U00A5> \xB4 |0
+<U00A7> \xA4 |0
+<U00A8> \xAC |0
+<U00A9> \xA9 |0
+<U00AA> \xBB |0
+<U00AB> \xC7 |0
+<U00AC> \xC2 |0
+<U00AE> \xA8 |0
+<U00AF> \xF8 |0
+<U00B0> \xA1 |0
+<U00B1> \xB1 |0
+<U00B4> \xAB |0
+<U00B5> \xB5 |0
+<U00B6> \xA6 |0
+<U00B7> \xE1 |0
+<U00B8> \xFC |0
+<U00BA> \xBC |0
+<U00BB> \xC8 |0
+<U00BF> \xC0 |0
+<U00C0> \xCB |0
+<U00C1> \xE7 |0
+<U00C2> \xE5 |0
+<U00C3> \xCC |0
+<U00C4> \x80 |0
+<U00C5> \x81 |0
+<U00C6> \xAE |0
+<U00C7> \x82 |0
+<U00C8> \xE9 |0
+<U00C9> \x83 |0
+<U00CA> \xE6 |0
+<U00CB> \xE8 |0
+<U00CC> \xED |0
+<U00CD> \xEA |0
+<U00CE> \xEB |0
+<U00CF> \xEC |0
+<U00D1> \x84 |0
+<U00D2> \xF1 |0
+<U00D3> \xEE |0
+<U00D4> \xEF |0
+<U00D5> \xCD |0
+<U00D6> \x85 |0
+<U00D8> \xAF |0
+<U00D9> \xF4 |0
+<U00DA> \xF2 |0
+<U00DB> \xF3 |0
+<U00DC> \x86 |0
+<U00DE> \xDE |0
+<U00DF> \xA7 |0
+<U00E0> \x88 |0
+<U00E1> \x87 |0
+<U00E2> \x89 |0
+<U00E3> \x8B |0
+<U00E4> \x8A |0
+<U00E5> \x8C |0
+<U00E6> \xBE |0
+<U00E7> \x8D |0
+<U00E8> \x8F |0
+<U00E9> \x8E |0
+<U00EA> \x90 |0
+<U00EB> \x91 |0
+<U00EC> \x93 |0
+<U00ED> \x92 |0
+<U00EE> \x94 |0
+<U00EF> \x95 |0
+<U00F1> \x96 |0
+<U00F2> \x98 |0
+<U00F3> \x97 |0
+<U00F4> \x99 |0
+<U00F5> \x9B |0
+<U00F6> \x9A |0
+<U00F7> \xD6 |0
+<U00F8> \xBF |0
+<U00F9> \x9D |0
+<U00FA> \x9C |0
+<U00FB> \x9E |0
+<U00FC> \x9F |0
+<U00FE> \xDF |0
+<U00FF> \xD8 |0
+<U0110> \xDC |0
+<U0111> \xDD |0
+<U0131> \xF5 |0
+<U0152> \xCE |0
+<U0153> \xCF |0
+<U0178> \xD9 |0
+<U0192> \xC4 |0
+<U02C7> \xFF |0
+<U02D8> \xF9 |0
+<U02D9> \xFA |0
+<U02DA> \xFB |0
+<U02DB> \xFE |0
+<U02DD> \xFD |0
+<U0394> \xC6 |0
+<U03A9> \xBD |0
+<U03C0> \xB9 |0
+<U2013> \xD1 |0
+<U2014> \xD0 |0
+<U2018> \xD4 |0
+<U2019> \xD5 |0
+<U201A> \xE2 |0
+<U201C> \xD2 |0
+<U201D> \xD3 |0
+<U201E> \xE3 |0
+<U2020> \xA0 |0
+<U2021> \xE0 |0
+<U2022> \xA5 |0
+<U2026> \xC9 |0
+<U2030> \xE4 |0
+<U2044> \xDA |0
+<U2122> \xAA |0
+<U2202> \xB6 |0
+<U220F> \xB8 |0
+<U2211> \xB7 |0
+<U221A> \xC3 |0
+<U221E> \xB0 |0
+<U222B> \xBA |0
+<U2248> \xC5 |0
+<U2260> \xAD |0
+<U2264> \xB2 |0
+<U2265> \xB3 |0
+<U25C6> \xD7 |0
+<UE01E> \xF0 |0
+#
+END CHARMAP
+#
diff --git a/mcs/class/I18N/West/makefile.gnu b/mcs/class/I18N/West/makefile.gnu
new file mode 100755
index 00000000000..d4d99fc6f9c
--- /dev/null
+++ b/mcs/class/I18N/West/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../../..
+
+LIBRARY = $(topdir)/class/lib/I18N.West.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r mscorlib -r I18N
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/I18N/makefile.gnu b/mcs/class/I18N/makefile.gnu
new file mode 100755
index 00000000000..a7876bc24cb
--- /dev/null
+++ b/mcs/class/I18N/makefile.gnu
@@ -0,0 +1,14 @@
+INSTALL = /usr/bin/install
+prefix = /usr
+
+DIRS = Common West MidEast CJK Other Rare
+
+default: all
+
+all clean test:
+ @for i in $(DIRS) ; do \
+ if [ -d "$$i" ] && [ -f "$$i/makefile.gnu" ] ; then \
+ (cd $$i && $(MAKE) -f makefile.gnu $@) || exit 1; \
+ fi \
+ done
+
diff --git a/mcs/class/I18N/mklist.sh b/mcs/class/I18N/mklist.sh
new file mode 100755
index 00000000000..a3b462bd283
--- /dev/null
+++ b/mcs/class/I18N/mklist.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+#
+# mklist.sh - Make the I18N handler list file "I18N-handlers.def".
+#
+# Copyright (C) 2002 Southern Storm Software, Pty Ltd.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Process the command-line options.
+ILFIND="$1"
+OUTFILE="$2"
+if test "x$ILFIND" = "x" ; then
+ echo "$0: missing ilfind argument" 1>&2
+ exit 1
+fi
+if test "x$OUTFILE" = "x" ; then
+ echo "$0: missing output file argument" 1>&2
+ exit 1
+fi
+shift
+shift
+
+# Search all region assemblies for interesting classes and
+# write them to the specified output file.
+exec "${ILFIND}" --public-only --sub-string I18N $* | \
+ grep 'class ' | \
+ sed -e '1,$s/^.*: class //g' - | \
+ sed -e '1,$s/^class //g' - >"${OUTFILE}"
diff --git a/mcs/class/I18N/tools/.cvsignore b/mcs/class/I18N/tools/.cvsignore
new file mode 100644
index 00000000000..aaa5d839385
--- /dev/null
+++ b/mcs/class/I18N/tools/.cvsignore
@@ -0,0 +1,2 @@
+ucm2cp
+uni2tab
diff --git a/mcs/class/I18N/tools/cvt.sh b/mcs/class/I18N/tools/cvt.sh
new file mode 100755
index 00000000000..caa71f3d79f
--- /dev/null
+++ b/mcs/class/I18N/tools/cvt.sh
@@ -0,0 +1,547 @@
+#!/bin/sh
+#
+# This script can be used to regenerate the CPnnnn.cs files
+# from the ".ucm" files. The list of unsupported code pages
+# is at the end of this file.
+#
+# Copyright (C) 2002 Southern Storm Software, Pty Ltd.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Make sure that we are in the correct directory to start.
+if test -d ../Rare ; then
+ cd ..
+fi
+
+#if test "x$1" = "x--include-rare" ; then
+ RARE=""
+#else
+# RARE="--rare"
+#fi
+
+# Compile the "ucm2cp" tool.
+if gcc -o tools/ucm2cp tools/ucm2cp.c ; then
+ :
+else
+ exit 1
+fi
+UCM2CP=tools/ucm2cp
+
+${UCM2CP} --region Rare --page 37 --wpage 1252 \
+ --name 'IBM EBCDIC (US-Canada)' \
+ --webname IBM037 --bodyname IBM037 \
+ --headername IBM037 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-37.ucm >Rare/CP37.cs
+
+${UCM2CP} --region West --page 437 --wpage 1252 \
+ --name 'OEM United States' \
+ --webname IBM437 --bodyname IBM437 \
+ --headername IBM437 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-437.ucm >West/CP437.cs
+
+${UCM2CP} --region Rare --page 500 --wpage 1252 \
+ --name 'IBM EBCDIC (International)' \
+ --webname IBM500 --bodyname IBM500 \
+ --headername IBM500 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-500.ucm >Rare/CP500.cs
+
+${UCM2CP} --region Rare --page 708 --wpage 1256 \
+ --name 'Arabic (ASMO 708)' \
+ --webname asmo-708 --bodyname iso-8859-6 \
+ --headername asmo-708 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1089.ucm >Rare/CP708.cs
+
+${UCM2CP} --region West --page 850 --wpage 1252 \
+ --name 'Western European (DOS)' \
+ --webname ibm850 --bodyname ibm850 \
+ --headername ibm850 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-850.ucm >West/CP850.cs
+
+${UCM2CP} --region Rare --page 852 --wpage 1250 \
+ --name 'Central European (DOS)' \
+ --webname ibm852 --bodyname ibm852 \
+ --headername ibm852 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-852.ucm >Rare/CP852.cs
+
+${UCM2CP} --region Rare --page 855 --wpage 1251 \
+ --name 'Cyrillic (DOS)' \
+ --webname ibm855 --bodyname ibm855 \
+ --headername ibm855 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-855.ucm >Rare/CP855.cs
+
+${UCM2CP} --region Rare --page 857 --wpage 1254 \
+ --name 'Turkish (DOS)' \
+ --webname ibm857 --bodyname ibm857 \
+ --headername ibm857 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-857.ucm >Rare/CP857.cs
+
+${UCM2CP} --region Rare --page 858 --wpage 1252 \
+ --name 'Western European (DOS with Euro)' \
+ --webname IBM00858 --bodyname IBM00858 \
+ --headername IBM00858 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-858.ucm >Rare/CP858.cs
+
+${UCM2CP} --region West --page 860 --wpage 1252 \
+ --name 'Portuguese (DOS)' \
+ --webname ibm860 --bodyname ibm860 \
+ --headername ibm860 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-860.ucm >West/CP860.cs
+
+${UCM2CP} --region West --page 861 --wpage 1252 \
+ --name 'Icelandic (DOS)' \
+ --webname ibm861 --bodyname ibm861 \
+ --headername ibm861 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-861.ucm >West/CP861.cs
+
+${UCM2CP} --region Rare --page 862 --wpage 1255 \
+ --name 'Hebrew (DOS)' \
+ --webname ibm862 --bodyname ibm862 \
+ --headername ibm861 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-862.ucm >Rare/CP862.cs
+
+${UCM2CP} --region West --page 863 --wpage 1252 \
+ --name 'French Canadian (DOS)' \
+ --webname IBM863 --bodyname IBM863 \
+ --headername IBM863 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-863.ucm >West/CP863.cs
+
+${UCM2CP} --region Rare --page 864 --wpage 1256 \
+ --name 'Arabic (DOS)' \
+ --webname ibm864 --bodyname ibm864 \
+ --headername ibm864 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-864.ucm >Rare/CP864.cs
+
+${UCM2CP} --region West --page 865 --wpage 1252 \
+ --name 'Nordic (DOS)' \
+ --webname IBM865 --bodyname IBM863 \
+ --headername IBM865 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-865.ucm >West/CP865.cs
+
+${UCM2CP} --region Rare --page 866 --wpage 1251 \
+ --name 'Russian (DOS)' \
+ --webname ibm866 --bodyname ibm866 \
+ --headername ibm866 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-866.ucm >Rare/CP866.cs
+
+${UCM2CP} --region Rare --page 869 --wpage 1253 \
+ --name 'Greek (DOS)' \
+ --webname ibm869 --bodyname ibm869 \
+ --headername ibm869 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-869.ucm >Rare/CP869.cs
+
+${UCM2CP} --region Rare --page 870 --wpage 1250 \
+ --name 'IBM EBCDIC (Latin 2)' \
+ --webname ibm870 --bodyname ibm870 \
+ --headername ibm870 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-870.ucm >Rare/CP870.cs
+
+${UCM2CP} --region Other --page 874 --wpage 874 \
+ --name 'Thai (Windows)' \
+ --webname windows-874 --bodyname windows-874 \
+ --headername windows-874 Other/ibm-874.ucm >Other/CP874.cs
+
+${UCM2CP} --region Rare --page 875 --wpage 1253 \
+ --name 'IBM EBCDIC (Greek)' \
+ --webname ibm875 --bodyname ibm875 \
+ --headername ibm875 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-875.ucm >Rare/CP875.cs
+
+${UCM2CP} --region Rare --page 1026 --wpage 1254 \
+ --name 'IBM EBCDIC (Turkish)' \
+ --webname ibm1026 --bodyname ibm1026 \
+ --headername ibm1026 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1026.ucm >Rare/CP1026.cs
+
+${UCM2CP} --region Rare --page 1047 --wpage 1252 \
+ --name 'IBM EBCDIC (Open Systems Latin 1)' \
+ --webname ibm1047 --bodyname ibm1047 \
+ --headername ibm1047 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1047.ucm >Rare/CP1047.cs
+
+${UCM2CP} --region Rare --page 1140 --wpage 1252 \
+ --name 'IBM EBCDIC (US-Canada with Euro)' \
+ --webname IBM01140 --bodyname IBM01140 \
+ --headername IBM01140 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1140.ucm >Rare/CP1140.cs
+
+${UCM2CP} --region Rare --page 1141 --wpage 1252 \
+ --name 'IBM EBCDIC (Germany with Euro)' \
+ --webname IBM01141 --bodyname IBM01141 \
+ --headername IBM01141 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1141.ucm >Rare/CP1141.cs
+
+${UCM2CP} --region Rare --page 1142 --wpage 1252 \
+ --name 'IBM EBCDIC (Denmark/Norway with Euro)' \
+ --webname IBM01142 --bodyname IBM01142 \
+ --headername IBM01142 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1142.ucm >Rare/CP1142.cs
+
+${UCM2CP} --region Rare --page 1143 --wpage 1252 \
+ --name 'IBM EBCDIC (Finland/Sweden with Euro)' \
+ --webname IBM01143 --bodyname IBM01143 \
+ --headername IBM01143 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1143.ucm >Rare/CP1143.cs
+
+${UCM2CP} --region Rare --page 1144 --wpage 1252 \
+ --name 'IBM EBCDIC (Italy with Euro)' \
+ --webname ibm1144 --bodyname ibm1144 \
+ --headername ibm1144 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1144.ucm >Rare/CP1144.cs
+
+${UCM2CP} --region Rare --page 1145 --wpage 1252 \
+ --name 'IBM EBCDIC (Latin America/Spain with Euro)' \
+ --webname ibm1145 --bodyname ibm1145 \
+ --headername ibm1145 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1145.ucm >Rare/CP1145.cs
+
+${UCM2CP} --region Rare --page 1146 --wpage 1252 \
+ --name 'IBM EBCDIC (United Kingdom with Euro)' \
+ --webname ibm1146 --bodyname ibm1146 \
+ --headername ibm1146 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1146.ucm >Rare/CP1146.cs
+
+${UCM2CP} --region Rare --page 1147 --wpage 1252 \
+ --name 'IBM EBCDIC (France with Euro)' \
+ --webname ibm1147 --bodyname ibm1147 \
+ --headername ibm1147 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1147.ucm >Rare/CP1147.cs
+
+${UCM2CP} --region Rare --page 1148 --wpage 1252 \
+ --name 'IBM EBCDIC (International with Euro)' \
+ --webname ibm1148 --bodyname ibm1148 \
+ --headername ibm1148 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1148.ucm >Rare/CP1148.cs
+
+${UCM2CP} --region Rare --page 1149 --wpage 1252 \
+ --name 'IBM EBCDIC (Icelandic with Euro)' \
+ --webname ibm1149 --bodyname ibm1149 \
+ --headername ibm1149 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1149.ucm >Rare/CP1149.cs
+
+${UCM2CP} --region West --page 1250 --wpage 1250 \
+ --name 'Central European (Windows)' \
+ --webname windows-1250 --bodyname iso-8859-2 \
+ --headername windows-1250 West/ibm-5346.ucm >West/CP1250.cs
+
+${UCM2CP} --region Other --page 1251 --wpage 1251 \
+ --name 'Cyrillic (Windows)' \
+ --webname windows-1251 --bodyname koi8-r \
+ --headername windows-1251 Other/ibm-5347.ucm >Other/CP1251.cs
+
+${UCM2CP} --region West --page 1252 --wpage 1252 \
+ --name 'Western European (Windows)' \
+ --webname Windows-1252 --bodyname iso-8859-1 \
+ --headername Windows-1252 West/ibm-5348.ucm >West/CP1252.cs
+
+${UCM2CP} --region West --page 1253 --wpage 1253 \
+ --name 'Greek (Windows)' \
+ --webname windows-1253 --bodyname iso-8859-7 \
+ --headername windows-1253 West/ibm-5349.ucm >West/CP1253.cs
+
+${UCM2CP} --region MidEast --page 1254 --wpage 1254 \
+ --name 'Turkish (Windows)' \
+ --webname windows-1254 --bodyname iso-8859-9 \
+ --headername windows-1254 MidEast/ibm-5350.ucm >MidEast/CP1254.cs
+
+${UCM2CP} --region MidEast --page 1255 --wpage 1255 \
+ --name 'Hebrew (Windows)' \
+ --webname windows-1255 --bodyname windows-1255 \
+ --headername windows-1255 MidEast/ibm-5351.ucm >MidEast/CP1255.cs
+
+${UCM2CP} --region MidEast --page 1256 --wpage 1256 \
+ --name 'Arabic (Windows)' \
+ --webname windows-1256 --bodyname windows-1256 \
+ --headername windows-1256 MidEast/ibm-5352.ucm >MidEast/CP1256.cs
+
+${UCM2CP} --region Other --page 1257 --wpage 1257 \
+ --name 'Baltic (Windows)' \
+ --webname windows-1257 --bodyname iso-8859-4 \
+ --headername windows-1257 Other/ibm-5353.ucm >Other/CP1257.cs
+
+${UCM2CP} --region Other --page 1258 --wpage 1258 \
+ --name 'Vietnamese (Windows)' \
+ --webname windows-1258 --bodyname windows-1258 \
+ --headername windows-1258 Other/ibm-5354.ucm >Other/CP1258.cs
+
+${UCM2CP} --region West --page 10000 --wpage 1252 \
+ --name 'Western European (Mac)' \
+ --webname macintosh --bodyname macintosh \
+ --headername macintosh --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/ibm-1275.ucm >West/CP10000.cs
+
+${UCM2CP} --region West --page 10079 --wpage 1252 \
+ --name 'Icelandic (Mac)' \
+ --webname x-mac-icelandic --bodyname x-mac-icelandic \
+ --headername x-mac-icelandic --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save West/mac-is.ucm >West/CP10079.cs
+
+${UCM2CP} --region Rare --page 20273 --wpage 1252 \
+ --name 'IBM EBCDIC (Germany)' \
+ --webname IBM273 --bodyname IBM273 \
+ --headername IBM273 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-273.ucm >Rare/CP20273.cs
+
+${UCM2CP} --region Rare --page 20277 --wpage 1252 \
+ --name 'IBM EBCDIC (Denmark/Norway)' \
+ --webname IBM277 --bodyname IBM277 \
+ --headername IBM277 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-277.ucm >Rare/CP20277.cs
+
+${UCM2CP} --region Rare --page 20278 --wpage 1252 \
+ --name 'IBM EBCDIC (Finland/Sweden)' \
+ --webname IBM278 --bodyname IBM278 \
+ --headername IBM278 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-278.ucm >Rare/CP20278.cs
+
+${UCM2CP} --region Rare --page 20280 --wpage 1252 \
+ --name 'IBM EBCDIC (Italy)' \
+ --webname IBM280 --bodyname IBM280 \
+ --headername IBM280 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-280.ucm >Rare/CP20280.cs
+
+${UCM2CP} --region Rare --page 20284 --wpage 1252 \
+ --name 'IBM EBCDIC (Latin America/Spain)' \
+ --webname IBM284 --bodyname IBM284 \
+ --headername IBM284 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-284.ucm >Rare/CP20284.cs
+
+${UCM2CP} --region Rare --page 20285 --wpage 1252 \
+ --name 'IBM EBCDIC (United Kingdom)' \
+ --webname IBM285 --bodyname IBM285 \
+ --headername IBM285 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-285.ucm >Rare/CP20285.cs
+
+${UCM2CP} --region Rare --page 20290 --wpage 932 \
+ --name 'IBM EBCDIC (Japanese Katakana Extended)' \
+ --webname IBM290 --bodyname IBM290 \
+ --headername IBM290 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-290.ucm >Rare/CP20290.cs
+
+${UCM2CP} --region Rare --page 20297 --wpage 1252 \
+ --name 'IBM EBCDIC (France)' \
+ --webname IBM297 --bodyname IBM297 \
+ --headername IBM297 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-297.ucm >Rare/CP20297.cs
+
+${UCM2CP} --region Rare --page 20420 --wpage 1256 \
+ --name 'IBM EBCDIC (Arabic)' \
+ --webname IBM420 --bodyname IBM420 \
+ --headername IBM420 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-420.ucm >Rare/CP20420.cs
+
+${UCM2CP} --region Rare --page 20424 --wpage 1255 \
+ --name 'IBM EBCDIC (Hebrew)' \
+ --webname IBM424 --bodyname IBM424 \
+ --headername IBM424 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-424.ucm >Rare/CP20424.cs
+
+${UCM2CP} --region Other --page 20866 --wpage 1251 \
+ --name 'Cyrillic (KOI8-R)' \
+ --webname koi8-r --bodyname koi8-r \
+ --headername koi8-r Other/ibm-878.ucm >Other/CP20866.cs
+
+${UCM2CP} --region Rare --page 20871 --wpage 1252 \
+ --name 'IBM EBCDIC (Icelandic)' \
+ --webname IBM871 --bodyname IBM871 \
+ --headername IBM871 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-871.ucm >Rare/CP20871.cs
+
+${UCM2CP} --region Rare --page 21025 --wpage 1257 \
+ --name 'IBM EBCDIC (Cyrillic - Serbian, Bulgarian)' \
+ --webname IBM1025 --bodyname IBM1025 \
+ --headername IBM1025 --no-browser-display \
+ --no-browser-save --no-mailnews-display \
+ --no-mailnews-save Rare/ibm-1025.ucm >Rare/CP21025.cs
+
+${UCM2CP} --region Other --page 21866 --wpage 1251 \
+ --name 'Ukrainian (KOI8-U)' \
+ --webname koi8-u --bodyname koi8-u \
+ --headername koi8-u Other/koi8-u.ucm >Other/CP21866.cs
+
+${UCM2CP} --region West --page 28592 --wpage 1250 \
+ --name 'Central European (ISO)' \
+ --webname iso-8859-2 --bodyname iso-8859-2 \
+ --headername iso-8859-2 West/ibm-912.ucm >West/CP28592.cs
+
+${UCM2CP} --region West --page 28593 --wpage 28593 \
+ --name 'Latin 3 (ISO)' \
+ --webname iso-8859-3 --bodyname iso-8859-3 \
+ --headername iso-8859-3 West/ibm-913.ucm >West/CP28593.cs
+
+${UCM2CP} --region Other --page 28594 --wpage 1257 \
+ --name 'Baltic (ISO)' \
+ --webname iso-8859-4 --bodyname iso-8859-4 \
+ --headername iso-8859-4 Other/ibm-914.ucm >Other/CP28594.cs
+
+${UCM2CP} --region Other --page 28595 --wpage 1251 \
+ --name 'Cyrillic (ISO)' \
+ --webname iso-8859-5 --bodyname iso-8859-5 \
+ --headername iso-8859-5 Other/ibm-915.ucm >Other/CP28595.cs
+
+${UCM2CP} --region MidEast --page 28596 --wpage 1256 \
+ --name 'Arabic (ISO)' \
+ --webname iso-8859-6 --bodyname iso-8859-6 \
+ --headername iso-8859-6 MidEast/ibm-1089.ucm >MidEast/CP28596.cs
+
+${UCM2CP} --region West --page 28597 --wpage 1253 \
+ --name 'Greek (ISO)' \
+ --webname iso-8859-7 --bodyname iso-8859-7 \
+ --headername iso-8859-7 West/ibm-4909.ucm >West/CP28597.cs
+
+${UCM2CP} --region MidEast --page 28598 --wpage 1255 \
+ --name 'Hebrew (ISO)' \
+ --webname iso-8859-8 --bodyname iso-8859-8 \
+ --headername iso-8859-8 MidEast/ibm-916.ucm >MidEast/CP28598.cs
+
+${UCM2CP} --region MidEast --page 28599 --wpage 1254 \
+ --name 'Latin 5 (ISO)' \
+ --webname iso-8859-9 --bodyname iso-8859-9 \
+ --headername iso-8859-9 MidEast/ibm-920.ucm >MidEast/CP28599.cs
+
+${UCM2CP} --region West --page 28605 --wpage 1252 \
+ --name 'Latin 9 (ISO)' \
+ --webname iso-8859-15 --bodyname iso-8859-15 \
+ --headername iso-8859-15 --no-browser-display \
+ West/ibm-923.ucm >West/CP28605.cs
+
+${UCM2CP} --region MidEast --page 38598 --wpage 1255 \
+ --name 'Hebrew (ISO Alternative)' \
+ --webname windows-38598 --bodyname iso-8859-8 \
+ --headername windows-38598 MidEast/ibm-916.ucm >MidEast/CP38598.cs
+
+exit 0
+
+# Windows code pages that are handled internally by "Encoding":
+#
+# 1200 Unicode
+# 1201 Unicode (Big-Endian)
+# 20127 US-ASCII
+# 28591 Western European (ISO)
+# 65000 Unicode (UTF-7)
+# 65001 Unicode (UTF-8)
+#
+# Other Windows code pages that aren't done yet:
+#
+# 709 Arabic - ASMO 449+, BCON V4
+# 710 Arabic - Transparent Arabic
+# 720 Arabic - Transparent ASMO
+# 737 OEM - Greek (formerly 437G)
+# 775 OEM - Baltic
+# 936 Chinese Simplified (GB2312)
+# 949 Korean
+# 950 Chinese Traditional (Big5)
+# 1361 Korean (Johab)
+# 10001 MAC - Japanese
+# 10002 MAC - Traditional Chinese (Big5)
+# 10003 MAC - Korean
+# 10004 MAC - Arabic
+# 10005 MAC - Hebrew
+# 10006 MAC - Greek I
+# 10007 MAC - Cyrillic
+# 10008 MAC - Simplified Chinese (GB 2312)
+# 10010 MAC - Romania
+# 10017 MAC - Ukraine
+# 10021 MAC - Thai
+# 10029 MAC - Latin II
+# 10081 MAC - Turkish
+# 10082 MAC - Croatia
+# 12000 Unicode UCS-4 Little-Endian
+# 12001 Unicode UCS-4 Big-Endian
+# 20000 CNS - Taiwan
+# 20001 TCA - Taiwan
+# 20002 Eten - Taiwan
+# 20003 IBM5550 - Taiwan
+# 20004 TeleText - Taiwan
+# 20005 Wang - Taiwan
+# 20105 IA5 IRV International Alphabet No. 5 (7-bit)
+# 20106 IA5 German (7-bit)
+# 20107 IA5 Swedish (7-bit)
+# 20108 IA5 Norwegian (7-bit)
+# 20261 T.61
+# 20269 ISO 6937 Non-Spacing Accent
+# 20423 IBM EBCDIC - Greek
+# 20833 IBM EBCDIC - Korean Extended
+# 20838 IBM EBCDIC - Thai
+# 20880 IBM EBCDIC - Cyrillic (Russian)
+# 20905 IBM EBCDIC - Turkish
+# 20924 IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol)
+# 20932 JIX X 0208-1990 & 0212-1990
+# 20936 Simplified Chinese (GB2312)
+# 21027 Extended Alpha Lowercase
+# 21866 Ukrainian (KOI8-U)
+# 29001 Europa 3
+# 50220 Japanese (JIS)
+# 50221 Japanese (JIS-Allow 1 byte Kana)
+# 50222 Japanese (JIS-Allow 1 byte Kana - SO/SI)
+# 50225 Korean (ISO)
+# 50227 ISO-2022 Simplified Chinese
+# 50229 ISO-2022 Traditional Chinese
+# 50930 Japanese (Katakana) Extended
+# 50931 US/Canada and Japanese
+# 50933 Korean Extended and Korean
+# 50935 Simplified Chinese Extended and Simplified Chinese
+# 50936 Simplified Chinese
+# 50937 US/Canada and Traditional Chinese
+# 50939 Japanese (Latin) Extended and Japanese
+# 51932 Japanese (EUC)
+# 51936 Chinese Simplified (EUC)
+# 51949 Korean (EUC)
+# 51950 Traditional Chinese (EUC)
+# 52936 Chinese Simplified (HZ)
+# 54936 GB 18030-2000 Simplified Chinese
diff --git a/mcs/class/I18N/tools/ucm2cp.c b/mcs/class/I18N/tools/ucm2cp.c
new file mode 100644
index 00000000000..fa43452b078
--- /dev/null
+++ b/mcs/class/I18N/tools/ucm2cp.c
@@ -0,0 +1,599 @@
+/*
+ * ucm2cp.c - Convert IBM ".ucm" files into code page handling classes.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+
+Usage: ucm2cp [options] file
+
+ --region name I18N region name
+ --page num Code page number
+ --wpage num Windows code page number (optional)
+ --name str Human-readable encoding name
+ --webname str Web name of the encoding
+ --headername str Header name of the encoding (optional)
+ --bodyname str Body name of the encoding (optional)
+ --no-browser-display Set browser display value to false (optional)
+ --no-browser-save Set browser save value to false (optional)
+ --no-mailnews-display Set mail/news display value to false (optional)
+ --no-mailnews-save Set mail/news save value to false (optional)
+
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/*
+ * Option values.
+ */
+static char *region = 0;
+static int codePage = 0;
+static int windowsCodePage = 0;
+static char *name = 0;
+static char *webName = 0;
+static char *headerName = 0;
+static char *bodyName = 0;
+static int isBrowserDisplay = 1;
+static int isBrowserSave = 1;
+static int isMailNewsDisplay = 1;
+static int isMailNewsSave = 1;
+static const char *filename = 0;
+
+/*
+ * Forward declarations.
+ */
+static void usage(char *progname);
+static void loadCharMaps(FILE *file);
+static void printHeader(void);
+static void printFooter(void);
+static void printByteToChar(void);
+static void printCharToByte(void);
+
+int main(int argc, char *argv[])
+{
+ char *progname = argv[0];
+ FILE *file;
+ int len;
+
+ /* Process the command-line options */
+ while(argc > 1 && argv[1][0] == '-')
+ {
+ if(!strcmp(argv[1], "--page") && argc > 2)
+ {
+ codePage = atoi(argv[2]);
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--wpage") && argc > 2)
+ {
+ windowsCodePage = atoi(argv[2]);
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--region") && argc > 2)
+ {
+ region = argv[2];
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--name") && argc > 2)
+ {
+ name = argv[2];
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--webname") && argc > 2)
+ {
+ webName = argv[2];
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--headername") && argc > 2)
+ {
+ headerName = argv[2];
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--bodyname") && argc > 2)
+ {
+ bodyName = argv[2];
+ ++argv;
+ --argc;
+ }
+ else if(!strcmp(argv[1], "--no-browser-display"))
+ {
+ isBrowserDisplay = 0;
+ }
+ else if(!strcmp(argv[1], "--no-browser-save"))
+ {
+ isBrowserSave = 0;
+ }
+ else if(!strcmp(argv[1], "--no-mailnews-display"))
+ {
+ isMailNewsDisplay = 0;
+ }
+ else if(!strcmp(argv[1], "--no-mailnews-save"))
+ {
+ isMailNewsSave = 0;
+ }
+ ++argv;
+ --argc;
+ }
+
+ /* Make sure that we have sufficient options */
+ if(!region || !codePage || !name || !webName || argc != 2)
+ {
+ usage(progname);
+ return 1;
+ }
+
+ /* Set defaults for unspecified options */
+ if(!headerName)
+ {
+ headerName = webName;
+ }
+ if(!bodyName)
+ {
+ bodyName = webName;
+ }
+ if(!windowsCodePage)
+ {
+ windowsCodePage = codePage;
+ }
+
+ /* Open the UCM file */
+ file = fopen(argv[1], "r");
+ if(!file)
+ {
+ perror(argv[1]);
+ return 1;
+ }
+ filename = argv[1];
+ len = strlen(filename);
+ while(len > 0 && filename[len - 1] != '/' && filename[len - 1] != '\\')
+ {
+ --len;
+ }
+ filename += len;
+
+ /* Load the character maps from the input file */
+ loadCharMaps(file);
+
+ /* Print the output header */
+ printHeader();
+
+ /* Print the byte->char conversion table */
+ printByteToChar();
+
+ /* Output the char->byte conversion methods */
+ printCharToByte();
+
+ /* Print the output footer */
+ printFooter();
+
+ /* Clean up and exit */
+ fclose(file);
+ return 0;
+}
+
+static void usage(char *progname)
+{
+ fprintf(stderr, "Usage: %s [options] file\n\n", progname);
+ fprintf(stderr, " --region name I18N region name\n");
+ fprintf(stderr, " --page num Code page number\n");
+ fprintf(stderr, " --wpage num Windows code page number (optional)\n");
+ fprintf(stderr, " --name str Human-readable encoding name\n");
+ fprintf(stderr, " --webname str Web name of the encoding\n");
+ fprintf(stderr, " --headername str Header name of the encoding (optional)\n");
+ fprintf(stderr, " --bodyname str Body name of the encoding (optional)\n");
+ fprintf(stderr, " --no-browser-display Set browser display value to false (optional)\n");
+ fprintf(stderr, " --no-browser-save Set browser save value to false (optional)\n");
+ fprintf(stderr, " --no-mailnews-display Set mail/news display value to false (optional)\n");
+ fprintf(stderr, " --no-mailnews-save Set mail/news save value to false (optional)\n");
+}
+
+/*
+ * Map bytes to characters. The level value is used to determine
+ * which char mapping is the most likely if there is more than one.
+ */
+static unsigned byteToChar[256];
+static int byteToCharLevel[256];
+
+/*
+ * Map characters to bytes.
+ */
+static int charToByte[65536];
+
+/*
+ * Parse a hexadecimal value. Returns the length
+ * of the value that was parsed.
+ */
+static int parseHex(const char *buf, unsigned long *value)
+{
+ int len = 0;
+ char ch;
+ *value = 0;
+ while((ch = buf[len]) != '\0')
+ {
+ if(ch >= '0' && ch <= '9')
+ {
+ *value = *value * 16 + (unsigned long)(ch - '0');
+ }
+ else if(ch >= 'A' && ch <= 'F')
+ {
+ *value = *value * 16 + (unsigned long)(ch - 'A' + 10);
+ }
+ else if(ch >= 'a' && ch <= 'f')
+ {
+ *value = *value * 16 + (unsigned long)(ch - 'a' + 10);
+ }
+ else
+ {
+ break;
+ }
+ ++len;
+ }
+ return len;
+}
+
+/*
+ * Load the character mapping information from a UCM file.
+ */
+static void loadCharMaps(FILE *file)
+{
+ unsigned long posn;
+ unsigned long byteValue;
+ int level;
+ char buffer[BUFSIZ];
+ const char *buf;
+
+ /* Initialize the mapping tables */
+ for(posn = 0; posn < 256; ++posn)
+ {
+ byteToChar[posn] = (unsigned)'?';
+ byteToCharLevel[posn] = 100;
+ }
+ for(posn = 0; posn < 65536; ++posn)
+ {
+ charToByte[posn] = -1;
+ }
+
+ /* Read the contents of the file */
+ while(fgets(buffer, BUFSIZ, file))
+ {
+ /* Lines of interest begin with "<U" */
+ if(buffer[0] != '<' || buffer[1] != 'U')
+ {
+ continue;
+ }
+
+ /* Parse the fields on the line */
+ buf = buffer + 2;
+ buf += parseHex(buf, &posn);
+ if(posn >= 65536)
+ {
+ continue;
+ }
+ while(*buf != '\0' && *buf != '\\')
+ {
+ ++buf;
+ }
+ if(*buf != '\\' || buf[1] != 'x')
+ {
+ continue;
+ }
+ buf += 2;
+ buf += parseHex(buf, &byteValue);
+ if(byteValue >= 256)
+ {
+ continue;
+ }
+ while(*buf != '\0' && *buf != '|')
+ {
+ ++buf;
+ }
+ if(*buf != '|')
+ {
+ continue;
+ }
+ level = (int)(buf[1] - '0');
+
+ /* Update the byte->char mapping table */
+ if(level < byteToCharLevel[byteValue])
+ {
+ byteToCharLevel[byteValue] = level;
+ byteToChar[byteValue] = (unsigned)posn;
+ }
+
+ /* Update the char->byte mapping table */
+ charToByte[posn] = (int)byteValue;
+ }
+}
+
+#define COPYRIGHT_MSG \
+" *\n" \
+" * Copyright (c) 2002 Southern Storm Software, Pty Ltd\n" \
+" *\n" \
+" * Permission is hereby granted, free of charge, to any person obtaining\n" \
+" * a copy of this software and associated documentation files (the \"Software\"),\n" \
+" * to deal in the Software without restriction, including without limitation\n" \
+" * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n" \
+" * and/or sell copies of the Software, and to permit persons to whom the\n" \
+" * Software is furnished to do so, subject to the following conditions:\n" \
+" *\n" \
+" * The above copyright notice and this permission notice shall be included\n" \
+" * in all copies or substantial portions of the Software.\n" \
+" *\n" \
+" * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n" \
+" * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" \
+" * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n" \
+" * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n" \
+" * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n" \
+" * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n" \
+" * OTHER DEALINGS IN THE SOFTWARE.\n" \
+" */\n\n"
+
+/*
+ * Print the header for the current code page definition.
+ */
+static void printHeader(void)
+{
+ printf("/*\n * CP%d.cs - %s code page.\n", codePage, name);
+ fputs(COPYRIGHT_MSG, stdout);
+ printf("// Generated from \"%s\".\n\n", filename);
+ printf("namespace I18N.%s\n{\n\n", region);
+ printf("using System;\n");
+ printf("using I18N.Common;\n\n");
+ printf("public class CP%d : ByteEncoding\n{\n", codePage);
+ printf("\tpublic CP%d()\n", codePage);
+ printf("\t\t: base(%d, ToChars, \"%s\",\n", codePage, name);
+ printf("\t\t \"%s\", \"%s\", \"%s\",\n",
+ bodyName, headerName, webName);
+ printf("\t\t %s, %s, %s, %s, %d)\n",
+ (isBrowserDisplay ? "true" : "false"),
+ (isBrowserSave ? "true" : "false"),
+ (isMailNewsDisplay ? "true" : "false"),
+ (isMailNewsSave ? "true" : "false"),
+ windowsCodePage);
+ printf("\t{}\n\n");
+}
+
+/*
+ * Print an encoding name, adjusted to look like a type name.
+ */
+static void printEncodingName(const char *name)
+{
+ while(*name != '\0')
+ {
+ if(*name >= 'A' && *name <= 'Z')
+ {
+ putc(*name - 'A' + 'a', stdout);
+ }
+ else if(*name == '-')
+ {
+ putc('_', stdout);
+ }
+ else
+ {
+ putc(*name, stdout);
+ }
+ ++name;
+ }
+}
+
+/*
+ * Print the footer for the current code page definition.
+ */
+static void printFooter(void)
+{
+ printf("}; // class CP%d\n\n", codePage);
+ printf("public class ENC");
+ printEncodingName(webName);
+ printf(" : CP%d\n{\n", codePage);
+ printf("\tpublic ENC");
+ printEncodingName(webName);
+ printf("() : base() {}\n\n");
+ printf("}; // class ENC");
+ printEncodingName(webName);
+ printf("\n\n}; // namespace I18N.%s\n", region);
+}
+
+/*
+ * Print the byte->char conversion table.
+ */
+static void printByteToChar(void)
+{
+ int posn;
+ printf("\tprivate static readonly char[] ToChars = {");
+ for(posn = 0; posn < 256; ++posn)
+ {
+ if((posn % 6) == 0)
+ {
+ printf("\n\t\t");
+ }
+ printf("'\\u%04X', ", byteToChar[posn]);
+ }
+ printf("\n\t};\n\n");
+}
+
+/*
+ * Print a "switch" statement that converts "ch" from
+ * a character value into a byte value.
+ */
+static void printConvertSwitch(void)
+{
+ unsigned long directLimit;
+ unsigned long posn;
+ unsigned long posn2;
+ unsigned long rangeSize;
+ int haveDirect;
+ int haveFullWidth;
+
+ /* Find the limit of direct byte mappings */
+ directLimit = 0;
+ while(directLimit < 256 && charToByte[directLimit] == (int)directLimit)
+ {
+ ++directLimit;
+ }
+
+ /* Determine if we have the full-width Latin1 mappings, which
+ we can optimise in the default case of the switch */
+ haveFullWidth = 1;
+ for(posn = 0xFF01; posn <= 0xFF5E; ++posn)
+ {
+ if((charToByte[posn] - 0x21) != (int)(posn - 0xFF01))
+ {
+ haveFullWidth = 0;
+ }
+ }
+
+ /* Print the switch header. The "if" is an optimisation
+ to ignore the common case of direct ASCII mappings */
+ printf("\t\t\tif(ch >= %lu) switch(ch)\n", directLimit);
+ printf("\t\t\t{\n");
+
+ /* Handle all direct byte mappings above the direct limit */
+ haveDirect = 0;
+ for(posn = directLimit; posn < 256; ++posn)
+ {
+ if(charToByte[posn] == (int)posn)
+ {
+ haveDirect = 1;
+ printf("\t\t\t\tcase 0x%04lX:\n", posn);
+ }
+ }
+ if(haveDirect)
+ {
+ printf("\t\t\t\t\tbreak;\n");
+ }
+
+ /* Handle the indirect mappings */
+ for(posn = 0; posn < 65536; ++posn)
+ {
+ if(haveFullWidth && posn >= 0xFF01 && posn <= 0xFF5E)
+ {
+ /* Handle full-width Latin1 conversions later */
+ continue;
+ }
+ if(charToByte[posn] != (int)posn &&
+ charToByte[posn] != -1)
+ {
+ /* See if we have a run of 4 or more characters that
+ can be mapped algorithmically to some other range */
+ rangeSize = 1;
+ for(posn2 = posn + 1; posn2 < 65536; ++posn2)
+ {
+ if(charToByte[posn2] == (int)posn2 ||
+ charToByte[posn2] == -1)
+ {
+ break;
+ }
+ if((charToByte[posn2] - charToByte[posn]) !=
+ (int)(posn2 - posn))
+ {
+ break;
+ }
+ ++rangeSize;
+ }
+ if(rangeSize >= 4)
+ {
+ /* Output a range mapping for the characters */
+ for(posn2 = posn; posn2 < (posn + rangeSize); ++posn2)
+ {
+ printf("\t\t\t\tcase 0x%04lX:\n", posn2);
+ }
+ posn += rangeSize - 1;
+ if(((long)posn) >= (long)(charToByte[posn]))
+ {
+ printf("\t\t\t\t\tch -= 0x%04lX;\n",
+ (long)(posn - charToByte[posn]));
+ }
+ else
+ {
+ printf("\t\t\t\t\tch += 0x%04lX;\n",
+ (long)(charToByte[posn] - posn));
+ }
+ printf("\t\t\t\t\tbreak;\n");
+ }
+ else
+ {
+ /* Use a simple non-algorithmic mapping */
+ printf("\t\t\t\tcase 0x%04lX: ch = 0x%02X; break;\n",
+ posn, (unsigned)(charToByte[posn]));
+ }
+ }
+ }
+
+ /* Print the switch footer */
+ if(!haveFullWidth)
+ {
+ printf("\t\t\t\tdefault: ch = 0x3F; break;\n");
+ }
+ else
+ {
+ printf("\t\t\t\tdefault:\n");
+ printf("\t\t\t\t{\n");
+ printf("\t\t\t\t\tif(ch >= 0xFF01 && ch <= 0xFF5E)\n");
+ printf("\t\t\t\t\t\tch -= 0xFEE0;\n");
+ printf("\t\t\t\t\telse\n");
+ printf("\t\t\t\t\t\tch = 0x3F;\n");
+ printf("\t\t\t\t}\n");
+ printf("\t\t\t\tbreak;\n");
+ }
+ printf("\t\t\t}\n");
+}
+
+/*
+ * Print the char->byte conversion methods.
+ */
+static void printCharToByte(void)
+{
+ /* Print the conversion method for character buffers */
+ printf("\tprotected override void ToBytes(char[] chars, int charIndex, int charCount,\n");
+ printf("\t byte[] bytes, int byteIndex)\n");
+ printf("\t{\n");
+ printf("\t\tint ch;\n");
+ printf("\t\twhile(charCount > 0)\n");
+ printf("\t\t{\n");
+ printf("\t\t\tch = (int)(chars[charIndex++]);\n");
+ printConvertSwitch();
+ printf("\t\t\tbytes[byteIndex++] = (byte)ch;\n");
+ printf("\t\t\t--charCount;\n");
+ printf("\t\t}\n");
+ printf("\t}\n\n");
+
+ /* Print the conversion method for string buffers */
+ printf("\tprotected override void ToBytes(String s, int charIndex, int charCount,\n");
+ printf("\t byte[] bytes, int byteIndex)\n");
+ printf("\t{\n");
+ printf("\t\tint ch;\n");
+ printf("\t\twhile(charCount > 0)\n");
+ printf("\t\t{\n");
+ printf("\t\t\tch = (int)(s[charIndex++]);\n");
+ printConvertSwitch();
+ printf("\t\t\tbytes[byteIndex++] = (byte)ch;\n");
+ printf("\t\t\t--charCount;\n");
+ printf("\t\t}\n");
+ printf("\t}\n\n");
+}
diff --git a/mcs/class/I18N/tools/uni2tab.c b/mcs/class/I18N/tools/uni2tab.c
new file mode 100644
index 00000000000..5a6e1134b19
--- /dev/null
+++ b/mcs/class/I18N/tools/uni2tab.c
@@ -0,0 +1,411 @@
+/*
+ * uni2tab.c - Convert Unicode data files into CJK conversion tables.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+
+Usage: uni2tab
+
+Required files from ftp.unicode.org: Unihan.txt, shiftjis.txt
+
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/*
+ * Forward declarations.
+ */
+static void convertLine(char *buf);
+static void convertSJISLine(char *buf);
+static int createTables(void);
+
+int main(int argc, char *argv[])
+{
+ FILE *file;
+ char buffer[BUFSIZ];
+ int error;
+
+ /* Load the relevant contents from the Unihan.txt file */
+ if((file = fopen("Unihan.txt", "r")) == NULL)
+ {
+ perror("Unihan.txt");
+ return 1;
+ }
+ while(fgets(buffer, sizeof(buffer), file))
+ {
+ if(buffer[0] == 'U' && buffer[1] == '+')
+ {
+ convertLine(buffer + 2);
+ }
+ }
+ fclose(file);
+
+ /* Load the relevant contents from the shiftjis.txt file,
+ to get mappings for non-CJK characters */
+ if((file = fopen("shiftjis.txt", "r")) == NULL)
+ {
+ perror("shiftjis.txt");
+ return 1;
+ }
+ while(fgets(buffer, sizeof(buffer), file))
+ {
+ if(buffer[0] == '0' && buffer[1] == 'x')
+ {
+ convertSJISLine(buffer + 2);
+ }
+ }
+ fclose(file);
+
+ /* Create the output tables */
+ error = createTables();
+
+ /* Clean up and exit */
+ return error;
+}
+
+/*
+ * Parse a hexadecimal value. Returns the length
+ * of the value that was parsed.
+ */
+static int parseHex(const char *buf, unsigned long *value)
+{
+ int len = 0;
+ char ch;
+ *value = 0;
+ while((ch = buf[len]) != '\0')
+ {
+ if(ch >= '0' && ch <= '9')
+ {
+ *value = *value * 16 + (unsigned long)(ch - '0');
+ }
+ else if(ch >= 'A' && ch <= 'F')
+ {
+ *value = *value * 16 + (unsigned long)(ch - 'A' + 10);
+ }
+ else if(ch >= 'a' && ch <= 'f')
+ {
+ *value = *value * 16 + (unsigned long)(ch - 'a' + 10);
+ }
+ else
+ {
+ break;
+ }
+ ++len;
+ }
+ return len;
+}
+
+/*
+ * Parse "ku" and "ten" values from a buffer.
+ */
+static void parseKuTen(const char *buf, int *ku, int *ten)
+{
+ int value = 0;
+ while(*buf >= '0' && *buf <= '9')
+ {
+ value = value * 10 + (*buf++ - '0');
+ }
+ *ku = value / 100;
+ *ten = value % 100;
+}
+
+/*
+ * Tables.
+ */
+static unsigned short jisx0208ToUnicode[94*94];
+static unsigned short jisx0212ToUnicode[94*94];
+static unsigned short unicodeToJis[65536];
+static unsigned short greekToJis[0x451 - 0x0391 + 1];
+static unsigned short extraToJis[0xFFEF - 0xFF01 + 1];
+static unsigned long lowJis = 0xFFFF;
+static unsigned long highJis = 0x0000;
+
+/*
+ * Process a JIS X 0208 sequence by ku and ten values.
+ */
+static void processJis0208(unsigned long code, int ku, int ten)
+{
+ int offset = (ku - 1) * 94 + (ten - 1);
+ jisx0208ToUnicode[offset] = (unsigned short)code;
+ unicodeToJis[code] = (unsigned short)(offset + 0x0100);
+ if(code < lowJis)
+ {
+ lowJis = code;
+ }
+ if(code > highJis)
+ {
+ highJis = code;
+ }
+}
+
+/*
+ * Process a JIS X 0212 sequence by ku and ten values.
+ */
+static void processJis0212(unsigned long code, int ku, int ten)
+{
+ int offset = (ku - 1) * 94 + (ten - 1);
+ jisx0212ToUnicode[offset] = (unsigned short)code;
+ unicodeToJis[code] = (unsigned short)(offset + 0x8000);
+ if(code < lowJis)
+ {
+ lowJis = code;
+ }
+ if(code > highJis)
+ {
+ highJis = code;
+ }
+}
+
+/*
+ * Convert an input line into table entries.
+ */
+static void convertLine(char *buf)
+{
+ unsigned long code;
+ const char *key;
+ int ku, ten;
+
+ /* Parse the hex name of the Unicode character */
+ buf += parseHex(buf, &code);
+ if(code >= 0x10000)
+ {
+ /* Cannot handle surrogate-based CJK characters yet */
+ return;
+ }
+
+ /* Skip to the key name */
+ while(*buf != '\0' && *buf != 'k')
+ {
+ ++buf;
+ }
+ if(*buf == '\0')
+ {
+ return;
+ }
+
+ /* Extract the key name from the buffer */
+ key = buf;
+ while(*buf != '\0' && *buf != ' ' && *buf != '\t')
+ {
+ ++buf;
+ }
+ if(*buf == '\0')
+ {
+ return;
+ }
+ *buf++ = '\0';
+
+ /* Skip to the value field */
+ while(*buf != '\0' && (*buf == ' ' || *buf == '\t' ||
+ *buf == '\r' || *buf == '\n'))
+ {
+ ++buf;
+ }
+ if(*buf == '\0')
+ {
+ return;
+ }
+
+ /* Determine what to do based on the key */
+ if(!strcmp(key, "kJis0"))
+ {
+ parseKuTen(buf, &ku, &ten);
+ processJis0208(code, ku, ten);
+ }
+ else if(!strcmp(key, "kJis1"))
+ {
+ parseKuTen(buf, &ku, &ten);
+ processJis0212(code, ku, ten);
+ }
+}
+
+/*
+ * Convert a line from the "shiftjis.txt" file.
+ */
+static void convertSJISLine(char *buf)
+{
+ unsigned long sjis;
+ unsigned long code;
+ int ch1, ch2;
+ int offset;
+
+ /* Read the Shift-JIS code point */
+ buf += parseHex(buf, &sjis);
+ if(sjis < 0x8000)
+ {
+ return;
+ }
+ while(*buf != '\0' && (*buf == ' ' || *buf == '\t' ||
+ *buf == '\r' || *buf == '\n'))
+ {
+ ++buf;
+ }
+ if(*buf != '0' || buf[1] != 'x')
+ {
+ return;
+ }
+ buf += 2;
+
+ /* Read the Unicode code point */
+ buf += parseHex(buf, &code);
+
+ /* Convert the Shift-JIS code point into a JIS kuten value */
+ ch1 = (int)(sjis >> 8);
+ ch2 = (int)(sjis & 0xFF);
+ if(ch1 >= 0x81 && ch1 <= 0x9F)
+ {
+ offset = (ch1 - 0x81) * 0xBC;
+ }
+ else if(ch1 >= 0xE0 && ch1 <= 0xEF)
+ {
+ offset = (ch1 - 0xE0 + (0xA0 - 0x81)) * 0xBC;
+ }
+ else
+ {
+ /* Invalid first byte */
+ return;
+ }
+ if(ch2 >= 0x40 && ch2 <= 0x7E)
+ {
+ offset += (ch2 - 0x40);
+ }
+ else if(ch2 >= 0x80 && ch2 <= 0xFC)
+ {
+ offset += (ch2 - 0x80 + 0x3F);
+ }
+ else
+ {
+ /* Invalid second byte */
+ return;
+ }
+
+ /* Process the kuten value */
+ if(code >= 0x0391 && code <= 0x0451)
+ {
+ /* Greek subset */
+ greekToJis[code - 0x0391] = (unsigned short)(offset + 0x0100);
+ }
+ else if(code >= 0xFF01 && code <= 0xFFEF)
+ {
+ /* Extra subset */
+ extraToJis[code - 0xFF01] = (unsigned short)(offset + 0x0100);
+ }
+ else if(code >= 0x0100 && code < 0x4E00)
+ {
+ /* Non-CJK characters within JIS */
+ processJis0208(code, (offset / 94) + 1, (offset % 94) + 1);
+ }
+}
+
+/*
+ * Write a section header.
+ */
+static void writeSection(FILE *file, unsigned long num, unsigned long size)
+{
+ putc((int)(num & 0xFF), file);
+ putc((int)((num >> 8) & 0xFF), file);
+ putc((int)((num >> 16) & 0xFF), file);
+ putc((int)((num >> 24) & 0xFF), file);
+ putc((int)(size & 0xFF), file);
+ putc((int)((size >> 8) & 0xFF), file);
+ putc((int)((size >> 16) & 0xFF), file);
+ putc((int)((size >> 24) & 0xFF), file);
+}
+
+/*
+ * Write an array of 16-bit data values.
+ */
+static void writeData(FILE *file, unsigned short *data, unsigned long size)
+{
+ while(size > 0)
+ {
+ putc((int)(*data & 0xFF), file);
+ putc((int)((*data >> 8) & 0xFF), file);
+ ++data;
+ --size;
+ }
+}
+
+/*
+ * Section numbers for the JIS table.
+ */
+#define JISX0208_To_Unicode 1
+#define JISX0212_To_Unicode 2
+#define CJK_To_JIS 3
+#define Greek_To_JIS 4
+#define Extra_To_JIS 5
+
+/*
+ * Write the JIS table file.
+ */
+static void writeJis(FILE *file)
+{
+ unsigned long size;
+
+ /* Write the JIS X 0208 to Unicode conversion table */
+ writeSection(file, JISX0208_To_Unicode, 94 * 94 * 2);
+ writeData(file, jisx0208ToUnicode, 94 * 94);
+
+ /* Write the JIS X 0212 to Unicode conversion table */
+ writeSection(file, JISX0212_To_Unicode, 94 * 94 * 2);
+ writeData(file, jisx0212ToUnicode, 94 * 94);
+
+ /* Write the Unicode to JIS conversion table */
+ size = highJis - lowJis + 1;
+ writeSection(file, CJK_To_JIS, size * 2);
+ writeData(file, unicodeToJis + lowJis, size);
+ printf("JIS: U+%04lX to U+%04lX\n", lowJis, highJis);
+
+ /* Write the Greek to JIS conversion table */
+ writeSection(file, Greek_To_JIS, sizeof(greekToJis));
+ writeData(file, greekToJis, sizeof(greekToJis) / 2);
+
+ /* Write the Extra to JIS conversion table */
+ writeSection(file, Extra_To_JIS, sizeof(extraToJis));
+ writeData(file, extraToJis, sizeof(extraToJis) / 2);
+}
+
+/*
+ * Create all of the tables that we need based on the Unihan.txt file.
+ */
+static int createTables(void)
+{
+ FILE *file;
+
+ /* Create the JIS conversion table */
+ if((file = fopen("jis.table", "wb")) == NULL)
+ {
+ if((file = fopen("jis.table", "wb")) == NULL)
+ {
+ perror("jis.table");
+ return 1;
+ }
+ }
+ writeJis(file);
+ fclose(file);
+
+ /* Done */
+ return 0;
+}
diff --git a/mcs/class/Microsoft.VisualBasic/.cvsignore b/mcs/class/Microsoft.VisualBasic/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Microsoft.VisualBasic/Changelog b/mcs/class/Microsoft.VisualBasic/Changelog
new file mode 100644
index 00000000000..3e13ab05798
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Changelog
@@ -0,0 +1,21 @@
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * list:
+ * makefile.gnu:
+ Added files to allow build on linux.
+
+2002-05-12 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+
+ * Microsoft.VisualBasic.Strings: Strings.cs - Merged all method implementations provided
+ by Martin Adoue, with method signatures (specially attributes) provided
+ by Chris J. Breisch. Some tweaking for the Mid member (two overloads versus third optional parameter).
+
+
+
+2002-05-18 Chris J Breisch <cjbreisch@altavista.net>
+
+ * Microsoft.VisualBasic: *.cs/Test/*.cs - Cleaned up code, added
+ implementations for Collection.cs, Conversion.cs and NUnit Tests
+ for both
+
+
+
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.build b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.build
new file mode 100644
index 00000000000..bc0ddd3e961
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.build
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/Microsoft.VisualBasic.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+
+ <!-- cor compare dies with these currently -->
+ <!--<arg value="/nostdlib"/>--> <!-- don't reference mscorlib -->
+ <!--<arg value="/lib:../lib/"/>-->
+ <!--<arg value="/r:..\lib\corlib.dll"/>-->
+ <!--<arg value="/r:..\lib\System.dll"/>-->
+ <arg value="/r:System.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <!--<includes name="../lib/corlib.dll"/>-->
+ <!--<includes name="../lib/System.dll"/>-->
+ </references>
+ </csc>
+ <copy file="../lib/Microsoft.VisualBasic.dll" tofile="Test/Microsoft.VisualBasic.dll"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/Microsoft.VisualBasic.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/AppWinStyle.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/AppWinStyle.cs
new file mode 100644
index 00000000000..210ee7d8e4a
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/AppWinStyle.cs
@@ -0,0 +1,18 @@
+//
+// AppWinStyle.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum AppWinStyle : short {
+ Hide = 0,
+ NormalFocus = 1,
+ MinimizedFocus = 2,
+ MaximizedFocus = 3,
+ NormalNoFocus = 4,
+ MinimizedNoFocus = 6
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CallType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CallType.cs
new file mode 100644
index 00000000000..d726be52606
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CallType.cs
@@ -0,0 +1,16 @@
+//
+// CallType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum CallType : int {
+ Method = 1,
+ Get = 2,
+ Let = 4,
+ Set = 8
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
new file mode 100644
index 00000000000..9aa67f57abc
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
@@ -0,0 +1,6 @@
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog:
+ Added a ChangeLog
+ * Constants.cs:
+ Make these actual constants so mcs will compile them.
+
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Collection.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Collection.cs
new file mode 100644
index 00000000000..29e171b0b38
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Collection.cs
@@ -0,0 +1,314 @@
+//
+// Collection.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+using System;
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.ComponentModel;
+
+
+namespace Microsoft.VisualBasic {
+ sealed public class Collection : ICollection, IList {
+ //
+ // <summary>
+ // Collection : The BASIC Collection Object
+ // </summary>
+ //
+ // <remarks>
+ // </remarks>
+ // Declarations
+ private Hashtable m_Hashtable = new Hashtable();
+ private ArrayList m_HashIndexers = new ArrayList();
+ internal bool Modified = false;
+
+ private class ColEnumerator: IEnumerator
+ //
+ // <summary>
+ // ColEnumerator : This internal class is used
+ // for enumerating through our Collection
+ // </summary>
+ //
+ // <remarks>
+ // </remarks>
+ {
+ private int Index;
+ private Collection Col;
+ private object Item;
+
+ public ColEnumerator(Collection coll)
+ {
+ Col = coll;
+ Index = 0;
+ Col.Modified = false;
+ }
+
+ public void Reset()
+ {
+ if (Col.Modified)
+ {
+ // FIXME : spec says throw exception, MS doesn't
+ // throw new InvalidOperationException();
+ }
+ Index = 0;
+ }
+
+ public bool MoveNext()
+ {
+ if (Col.Modified)
+ {
+ // FIXME : spec says throw exception, MS doesn't
+ // throw new InvalidOperationException();
+ }
+ Index++;
+ try {
+ Item = Col[Index];
+ }
+ catch {
+ // do nothing
+ }
+
+ return Index <= Col.Count;
+ }
+
+ public object Current {
+ get {
+ if (Index == 0) {
+ // FIXME : spec says throw InvalidOperation,
+ // but MS throws IndexOutOfRange
+ throw new IndexOutOfRangeException();
+ // throw new InvalidOperationException();
+ }
+ else {
+ return Item;
+ }
+ }
+ }
+
+ // The current property on the IEnumerator interface:
+ object IEnumerator.Current {
+ get {
+ return(Current);
+ }
+ }
+ }
+ // Constructors
+ // Properties
+ System.Boolean IList.IsReadOnly {
+ get {return false;}
+ }
+
+ System.Boolean ICollection.IsSynchronized {
+ get {return m_Hashtable.IsSynchronized;}
+ }
+
+ System.Object ICollection.SyncRoot {
+ get {return m_Hashtable.SyncRoot;}
+ }
+
+ System.Boolean IList.IsFixedSize {
+ get {return false;}
+ }
+
+ public System.Int32 Count {
+ get {return m_HashIndexers.Count;}
+ }
+
+ [ReadOnly(true)]
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public System.Object this [System.Int32 Index] {
+ get {
+ try {
+ // Collections are 1-based
+ return m_Hashtable[m_HashIndexers[Index-1]];
+ }
+ catch {
+ throw new IndexOutOfRangeException();
+ }
+ }
+ set {throw new NotImplementedException();}
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public System.Object this [System.Object Index]
+ {
+ get {
+ if (Index is string) {
+ if (m_HashIndexers.IndexOf(Index) < 0) {
+ // throw new IndexOutOfRangeException();
+ // FIXME : Spec Says IndexOutOfRange...MS throws Argument
+ throw new ArgumentException();
+ }
+ return m_Hashtable[Index];
+ }
+ else {
+ throw new ArgumentException();
+ }
+ }
+ }
+
+ // Methods
+ System.Int32 IList.IndexOf (System.Object value)
+ {
+ int LastPos = 0;
+ bool Found = false;
+
+ while (!Found) {
+ LastPos = m_HashIndexers.IndexOf(value.GetHashCode(), LastPos);
+ if (LastPos == -1) {
+ Found = true;
+ } else if (m_Hashtable[m_HashIndexers[LastPos]] == value) {
+ Found = true;
+ }
+ }
+ return LastPos;
+ }
+
+ System.Boolean IList.Contains (System.Object value)
+ {
+ return m_Hashtable.ContainsValue(value);
+ }
+
+ void IList.Clear ()
+ {
+ m_Hashtable.Clear();
+ m_HashIndexers.Clear();
+ }
+
+ public void Remove (System.String Key)
+ {
+ int Index;
+
+ try {
+ Index = m_HashIndexers.IndexOf(Key) + 1;
+ Remove(Index);
+ }
+ catch {
+ throw new ArgumentException();
+ }
+ }
+
+ public void Remove (System.Int32 Index)
+ {
+ try {
+ // Collections are 1-based
+ m_Hashtable.Remove(m_HashIndexers[Index-1]);
+ m_HashIndexers.RemoveAt(Index-1);
+ Modified = true;
+ }
+ catch {
+ throw new IndexOutOfRangeException();
+ }
+ }
+
+ void IList.Remove (System.Object value)
+ {
+ if (!(value is string)) {
+ throw new ArgumentException();
+ }
+ Remove((string)value);
+ }
+
+ void IList.RemoveAt (System.Int32 index)
+ {
+ Remove(index);
+ }
+
+ void IList.Insert (System.Int32 index, System.Object value)
+ {
+ Insert(index, value, value.GetHashCode().ToString());
+ }
+
+ void Insert(System.Int32 index, System.Object value, string Key)
+ {
+ m_HashIndexers.Insert(index -1, Key);
+ m_Hashtable.Add(Key, value);
+ Modified = true;
+ }
+
+ System.Int32 IList.Add (System.Object Item)
+ {
+ return Add(Item, Item.GetHashCode().ToString());
+ }
+
+ System.Int32 Add(System.Object Item, string Key)
+ {
+ m_Hashtable.Add(Key, Item);
+ Modified = true;
+
+ return m_HashIndexers.Add(Key);
+ }
+
+ private int GetIndexPosition(System.Object Item)
+ {
+ int Position = int.MinValue;
+
+ if (Item is string) {
+ Position = m_HashIndexers.IndexOf(Item) + 1;
+ }
+ else if (Item is int) {
+ Position = Convert.ToInt32(Item);
+ }
+ else {
+ throw new InvalidCastException();
+ }
+ if (Position < 0) {
+ throw new ArgumentException();
+ }
+ return Position;
+ }
+
+ public void Add (System.Object Item,
+ [Optional] [DefaultValue(null)] String Key,
+ [Optional] [DefaultValue(null)] System.Object Before,
+ [Optional] [DefaultValue(null)] System.Object After)
+ {
+ int Position = int.MinValue;
+
+ // check for valid args
+ if (Before != null && After != null) {
+ throw new ArgumentException();
+ }
+ if (Key != null && m_HashIndexers.IndexOf(Key) != -1) {
+ throw new ArgumentException();
+ }
+ if (Before != null) {
+ Position = GetIndexPosition(Before);
+ }
+ if (After != null) {
+ Position = GetIndexPosition(After) + 1;
+ }
+ if (Key == null) {
+ Key = Item.GetHashCode().ToString();
+ }
+
+ if (Position > (m_HashIndexers.Count+1) || Position == int.MinValue) {
+ Add(Item, Key);
+ }
+ else {
+ Insert(Position, Item, Key);
+ }
+ }
+
+ void ICollection.CopyTo (System.Array array, System.Int32 index)
+ {
+ System.Array NewArray =
+ Array.CreateInstance(typeof(System.Object),
+ m_HashIndexers.Count - index);
+
+ // Collections are 1-based
+ for (int i = index -1; i < m_HashIndexers.Count; i++) {
+ NewArray.SetValue(m_Hashtable[m_HashIndexers[i]], i - index);
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new ColEnumerator(this);
+ }
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ComClassAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ComClassAttribute.cs
new file mode 100644
index 00000000000..efd694246b4
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ComClassAttribute.cs
@@ -0,0 +1,35 @@
+//
+// ComClassAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic {
+ [System.AttributeUsageAttribute(System.AttributeTargets.Class)]
+ sealed public class ComClassAttribute : System.Attribute {
+ // Declarations
+ // Constructors
+ [MonoTODO]
+ ComClassAttribute(System.String _ClassID) { throw new NotImplementedException (); }
+ [MonoTODO]
+ ComClassAttribute(System.String _ClassID, System.String _InterfaceID) { throw new NotImplementedException (); }
+ [MonoTODO]
+ ComClassAttribute(System.String _ClassID, System.String _InterfaceID, System.String _EventId) { throw new NotImplementedException (); }
+ // Properties
+ [MonoTODO]
+ public System.String EventID { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public System.Boolean InterfaceShadows { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public System.String ClassID { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public System.String InterfaceID { get { throw new NotImplementedException (); } }
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CompareMethod.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CompareMethod.cs
new file mode 100644
index 00000000000..5b93a2351ef
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/CompareMethod.cs
@@ -0,0 +1,26 @@
+//
+// CompareMethod.cs
+//
+// Author:
+// Martin Adoue (martin@cwanet.com)
+//
+// (C) 2002 Martin Adoue
+//
+namespace Microsoft.VisualBasic {
+
+ /// <summary>
+ /// The CompareMethod enumeration contains constants used to determine the
+ /// way strings are compared when using functions such as InStr and StrComp.
+ /// These constants can be used anywhere in your code.
+ /// </summary>
+ public enum CompareMethod : int {
+ /// <summary>
+ /// Performs a binary comparison
+ /// </summary>
+ Binary = 0,
+ /// <summary>
+ /// Performs a textual comparison
+ /// </summary>
+ Text = 1
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs
new file mode 100644
index 00000000000..7ffb8f73bb8
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Constants.cs
@@ -0,0 +1,136 @@
+//
+// Constants.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic {
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class Constants {
+ // Declarations
+ public const System.Int32 vbObjectError = (System.Int32)(-2147221504);
+ public const System.String vbCrLf = "\n\r";
+ public const System.String vbNewLine = "\n\r";
+ public const System.String vbCr = "\n";
+ public const System.String vbLf = "\r";
+ public const System.String vbBack = "\b";
+ public const System.String vbFormFeed = "\f";
+ public const System.String vbTab = "\t";
+ public const System.String vbVerticalTab = "\v";
+ public const System.String vbNullChar = "\0";
+ public const System.String vbNullString = "";
+
+ public const AppWinStyle vbHide = AppWinStyle.Hide;
+ public const AppWinStyle vbNormalFocus = AppWinStyle.NormalFocus;
+ public const AppWinStyle vbMinimizedFocus = AppWinStyle.MinimizedFocus;
+ public const AppWinStyle vbMaximizedFocus = AppWinStyle.MaximizedFocus;
+ public const AppWinStyle vbNormalNoFocus = AppWinStyle.NormalNoFocus;
+ public const AppWinStyle vbMinimizedNoFocus = AppWinStyle.MinimizedNoFocus;
+
+ public const CallType vbMethod = CallType.Method;
+ public const CallType vbGet = CallType.Get;
+ public const CallType vbLet = CallType.Let;
+ public const CallType vbSet = CallType.Set;
+
+ public const CompareMethod vbBinaryCompare = CompareMethod.Binary;
+ public const CompareMethod vbTextCompare = CompareMethod.Text;
+
+ public const DateFormat vbGeneralDate = DateFormat.GeneralDate;
+ public const DateFormat vbLongDate = DateFormat.LongDate;
+ public const DateFormat vbShortDate = DateFormat.ShortDate;
+ public const DateFormat vbLongTime = DateFormat.LongTime;
+ public const DateFormat vbShortTime = DateFormat.ShortTime;
+
+ public const FirstDayOfWeek vbUseSystemDayOfWeek = FirstDayOfWeek.System;
+ public const FirstDayOfWeek vbSunday = FirstDayOfWeek.Sunday;
+ public const FirstDayOfWeek vbMonday = FirstDayOfWeek.Monday;
+ public const FirstDayOfWeek vbTuesday = FirstDayOfWeek.Tuesday;
+ public const FirstDayOfWeek vbWednesday = FirstDayOfWeek.Wednesday;
+ public const FirstDayOfWeek vbThursday = FirstDayOfWeek.Thursday;
+ public const FirstDayOfWeek vbFriday = FirstDayOfWeek.Friday;
+ public const FirstDayOfWeek vbSaturday = FirstDayOfWeek.Saturday;
+
+ public const FileAttribute vbNormal = FileAttribute.Normal;
+ public const FileAttribute vbReadOnly = FileAttribute.ReadOnly;
+ public const FileAttribute vbHidden = FileAttribute.Hidden;
+ public const FileAttribute vbSystem = FileAttribute.System;
+ public const FileAttribute vbVolume = FileAttribute.Volume;
+ public const FileAttribute vbDirectory = FileAttribute.Directory;
+ public const FileAttribute vbArchive = FileAttribute.Archive;
+
+ public const FirstWeekOfYear vbUseSystem = FirstWeekOfYear.System;
+ public const FirstWeekOfYear vbFirstJan1 = FirstWeekOfYear.Jan1;
+ public const FirstWeekOfYear vbFirstFourDays = FirstWeekOfYear.FirstFourDays;
+ public const FirstWeekOfYear vbFirstFullWeek = FirstWeekOfYear.FirstFullWeek;
+
+ public const VbStrConv vbUpperCase = VbStrConv.UpperCase;
+ public const VbStrConv vbLowerCase = VbStrConv.LowerCase;
+ public const VbStrConv vbProperCase = VbStrConv.ProperCase;
+ public const VbStrConv vbWide = VbStrConv.Wide;
+ public const VbStrConv vbNarrow = VbStrConv.Narrow;
+ public const VbStrConv vbKatakana = VbStrConv.Katakana;
+ public const VbStrConv vbHiragana = VbStrConv.Hiragana;
+ public const VbStrConv vbSimplifiedChinese = VbStrConv.SimplifiedChinese;
+ public const VbStrConv vbTraditionalChinese = VbStrConv.TraditionalChinese;
+ public const VbStrConv vbLinguisticCasing = VbStrConv.LinguisticCasing;
+
+ public const TriState vbUseDefault = TriState.UseDefault;
+ public const TriState vbTrue = TriState.True;
+ public const TriState vbFalse = TriState.False;
+
+ public const VariantType vbEmpty = VariantType.Empty;
+ public const VariantType vbNull = VariantType.Null;
+ public const VariantType vbInteger = VariantType.Integer;
+ public const VariantType vbLong = VariantType.Long;
+ public const VariantType vbSingle = VariantType.Single;
+ public const VariantType vbDouble = VariantType.Double;
+ public const VariantType vbCurrency = VariantType.Currency;
+ public const VariantType vbDate = VariantType.Date;
+ public const VariantType vbString = VariantType.String;
+ public const VariantType vbObject = VariantType.Object;
+ public const VariantType vbBoolean = VariantType.Boolean;
+ public const VariantType vbVariant = VariantType.Variant;
+ public const VariantType vbDecimal = VariantType.Decimal;
+ public const VariantType vbByte = VariantType.Byte;
+ public const VariantType vbUserDefinedType = VariantType.UserDefinedType;
+ public const VariantType vbArray = VariantType.Array;
+
+ public const MsgBoxResult vbOK = MsgBoxResult.OK;
+ public const MsgBoxResult vbCancel = MsgBoxResult.Cancel;
+ public const MsgBoxResult vbAbort = MsgBoxResult.Abort;
+ public const MsgBoxResult vbRetry = MsgBoxResult.Retry;
+ public const MsgBoxResult vbIgnore = MsgBoxResult.Ignore;
+ public const MsgBoxResult vbYes = MsgBoxResult.Yes;
+ public const MsgBoxResult vbNo = MsgBoxResult.No;
+
+ public const MsgBoxStyle vbOKOnly = MsgBoxStyle.OKOnly;
+ public const MsgBoxStyle vbOKCancel = MsgBoxStyle.OKCancel;
+ public const MsgBoxStyle vbAbortRetryIgnore = MsgBoxStyle.AbortRetryIgnore;
+ public const MsgBoxStyle vbYesNoCancel = MsgBoxStyle.YesNoCancel;
+ public const MsgBoxStyle vbYesNo = MsgBoxStyle.YesNo;
+ public const MsgBoxStyle vbRetryCancel = MsgBoxStyle.RetryCancel;
+ public const MsgBoxStyle vbCritical = MsgBoxStyle.Critical;
+ public const MsgBoxStyle vbQuestion = MsgBoxStyle.Question;
+ public const MsgBoxStyle vbExclamation = MsgBoxStyle.Exclamation;
+ public const MsgBoxStyle vbInformation = MsgBoxStyle.Information;
+ public const MsgBoxStyle vbDefaultButton1 = MsgBoxStyle.DefaultButton1;
+ public const MsgBoxStyle vbDefaultButton2 = MsgBoxStyle.DefaultButton2;
+ public const MsgBoxStyle vbDefaultButton3 = MsgBoxStyle.DefaultButton3;
+ public const MsgBoxStyle vbApplicationModal = MsgBoxStyle.ApplicationModal;
+ public const MsgBoxStyle vbSystemModal = MsgBoxStyle.SystemModal;
+ public const MsgBoxStyle vbMsgBoxHelp = MsgBoxStyle.MsgBoxHelp;
+ public const MsgBoxStyle vbMsgBoxRight = MsgBoxStyle.MsgBoxRight;
+ public const MsgBoxStyle vbMsgBoxRtlReading = MsgBoxStyle.MsgBoxRtlReading;
+ public const MsgBoxStyle vbMsgBoxSetForeground = MsgBoxStyle.MsgBoxSetForeground;
+
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ControlChars.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ControlChars.cs
new file mode 100644
index 00000000000..480e4be1b25
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ControlChars.cs
@@ -0,0 +1,27 @@
+//
+// ControlChars.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ sealed public class ControlChars {
+ // Declarations
+ public const System.String CrLf = "\n\r";
+ public const System.String NewLine = "\n\r";
+ public const System.Char Cr = '\n';
+ public const System.Char Lf = '\r';
+ public const System.Char Back = '\b';
+ public const System.Char FormFeed = '\f';
+ public const System.Char Tab = '\t';
+ public const System.Char VerticalTab = '\v';
+ public const System.Char NullChar = '\0';
+ public const System.Char Quote = '"';
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Conversion.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Conversion.cs
new file mode 100644
index 00000000000..38308a61605
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Conversion.cs
@@ -0,0 +1,616 @@
+//
+// Conversion.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+using System.Text.RegularExpressions;
+
+namespace Microsoft.VisualBasic {
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class Conversion {
+ //
+ // <summary>
+ // Collection : The BASIC Collection Object
+ // </summary>
+ //
+ // <remarks>
+ // </remarks>
+ // Declarations
+ private static readonly char[] _HexDigits = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+ };
+ private static readonly char[] _OctDigits = {
+ '0', '1', '2', '3', '4', '5', '6', '7'
+ };
+ private static readonly long[] _Maxes = {
+ 32767, 2147483647, 9223372036854775807
+ };
+ private enum SizeIndexes {
+ Int16 = 0,
+ Int32 = 1,
+ Int64 = 2
+ };
+
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static string ErrorToString () {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static string ErrorToString (
+ System.Int32 ErrorNumber) {
+ throw new NotImplementedException ();
+ }
+
+ // Return whether d is +/- Could do this with a macro,
+ // but this is cleaner
+ private static int Sign(double d) { return d > 0 ? 1 : -1;}
+
+ // try to cast an Object to a string...used in several places
+ private static string CastToString (System.Object Expression) {
+ try {
+ return (string)Expression;
+ }
+ catch {
+ throw new InvalidCastException();
+ }
+ }
+
+ // Fix on Integer types doesn't do anything
+ public static short Fix (short Number) { return Number; }
+ public static int Fix (int Number) { return Number; }
+ public static long Fix (long Number) { return Number; }
+
+ // Fix on other numberic types = Sign(Number) * Int(Abs(Number))
+ public static double Fix (double Number) {
+ return Sign(Number) * Int (Math.Abs (Number));
+ }
+ public static float Fix (float Number) {
+ return Sign(Number) * Int (Math.Abs (Number));
+ }
+ public static decimal Fix (decimal Number) {
+ return Sign((double)Number) * Int (Math.Abs (Number));
+ }
+
+ // Fix on an Object type is trickier
+ // first we have to cast it to the right type
+ public static System.Object Fix (System.Object Number)
+ {
+ // always start out by throwing an exception
+ // if Number is null
+ if (Number == null) {
+ throw new ArgumentNullException ("Number",
+ "Value cannot be null");
+ }
+
+ TypeCode TC = Type.GetTypeCode (Number.GetType ());
+
+ // switch on TypeCode and call appropriate Fix method
+ switch (TC) {
+ case TypeCode.Decimal:
+ return Fix (Convert.ToDecimal (Number));
+ case TypeCode.Double:
+ return Fix (Convert.ToDouble (Number));
+ case TypeCode.Single:
+ return Fix (Convert.ToSingle (Number));
+ case TypeCode.String:
+ return Fix (Double.Parse (
+ CastToString (Number)));
+
+ // for integer types, don't need to do anything
+ case TypeCode.Byte:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.SByte:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ return Number;
+
+ // spec defines Empty as returning 0
+ case TypeCode.Empty:
+ return 0;
+
+ // we can't convert these types
+ case TypeCode.Boolean:
+ case TypeCode.Char:
+ case TypeCode.DateTime:
+ case TypeCode.DBNull:
+ case TypeCode.Object:
+ default:
+ throw new ArgumentException (
+ "Type of argument 'Number' is '"
+ + Number.GetType().FullName +
+ "', which is not numeric.");
+ }
+ }
+
+ // Int on Integer types doesn't do anything
+ public static short Int (short Number) { return Number; }
+ public static int Int (int Number) { return Number; }
+ public static long Int (long Number) { return Number; }
+
+ // Int on other numberic types is same thing as "Floor"
+ public static double Int (double Number) {
+ return (double) Math.Floor(Number);
+ }
+ public static float Int (float Number) {
+ return (float) Math.Floor(Number);
+ }
+ public static decimal Int (decimal Number) {
+ return Decimal.Floor(Number);
+ }
+
+ // doing an Int on an Object is trickier
+ // first we have to cast to the correct type
+ public static System.Object Int (System.Object Number) {
+ // always start out by throwing an exception
+ // if Number is null
+ if (Number == null) {
+ throw new ArgumentNullException("Number",
+ "Value cannot be null");
+ }
+
+ TypeCode TC = Type.GetTypeCode (Number.GetType ());
+
+ // switch on TypeCode and call appropriate Int method
+ switch (TC) {
+ case TypeCode.Decimal:
+ return Int (Convert.ToDecimal (Number));
+ case TypeCode.Double:
+ return Int (Convert.ToDouble (Number));
+ case TypeCode.Single:
+ return Int (Convert.ToSingle (Number));
+ case TypeCode.String:
+ return Int (Double.Parse (
+ CastToString(Number)));
+
+ // Int on integer types does nothing
+ case TypeCode.Byte:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.SByte:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ return Number;
+
+ // Spec defines Empty as returning 0
+ case TypeCode.Empty:
+ return 0;
+
+ // otherwise, it's we can't cast to a numeric
+ case TypeCode.Boolean:
+ case TypeCode.Char:
+ case TypeCode.DateTime:
+ case TypeCode.DBNull:
+ case TypeCode.Object:
+ default:
+ throw new ArgumentException (
+ "Type of argument 'Number' is '" +
+ Number.GetType().FullName +
+ "', which is not numeric.");
+ }
+ }
+
+ // we use this internally to get a string
+ // representation of a number in a specific base
+ private static string ToBase (ulong Number, int Length,
+ char[] BaseDigits, uint Base) {
+ int i;
+ ulong r;
+ // we use a char array here for performance
+ char [] c = new Char[Length];
+ string s = null;
+
+
+ for (i = Length - 1; i >= 0; i--) {
+ r = Number % Base;
+ Number = Number / Base;
+ c[i] = BaseDigits[r];
+ if (Number == 0) {
+ s = new string (c, i, Length - i);
+ break;
+ }
+ }
+ if (s == null) {
+ return new string (c);
+ }
+ else {
+ return s;
+ }
+ }
+
+
+ // convert a number to Hex
+ // a little bit of magic goes on here with negative #'s
+ private static string ToHex(long Number, int Digits,
+ SizeIndexes Size) {
+ ulong UNumber;
+
+ if (Number < 0) {
+ // we add maxint of the Number's type
+ // twice and then 2 more...this has the
+ // effect of turning it into a ulong
+ // that has the same hex representation
+ UNumber = (ulong)((Number + 2) +
+ _Maxes[(int)Size]) +
+ (ulong)_Maxes[(int)Size];
+ }
+ else {
+ UNumber = (ulong)Number;
+ }
+ return ToBase(UNumber, Digits, _HexDigits, 16);
+ }
+
+ // call our private function,
+ // passing it the size of the item to convert
+ public static string Hex (short Number) {
+ return ToHex(Number, 4, SizeIndexes.Int16);
+ }
+ public static string Hex (byte Number) {
+ return ToHex(Number, 2, SizeIndexes.Int16);
+ }
+ public static string Hex (int Number) {
+ return ToHex(Number, 8, SizeIndexes.Int32);
+ }
+ public static string Hex (long Number) {
+ return ToHex(Number, 16, SizeIndexes.Int64);
+ }
+
+ // Objects are trickier
+ // first we have to cast to appropriate type
+ public static System.String Hex (System.Object Number) {
+ // always start out by throwing an exception
+ // if Number is null
+ if (Number == null) {
+ throw new ArgumentNullException ("Number",
+ "Value cannot be null");
+ }
+
+ TypeCode TC = Type.GetTypeCode (Number.GetType ());
+
+ switch (TC) {
+ // try to parse the string as an Int32,
+ // then an Int64, if that fails
+ case TypeCode.String:
+ try {
+ return Hex (
+ Int32.Parse (
+ CastToString (Number)));
+ }
+ catch {
+ return Hex (
+ Int64.Parse (
+ CastToString (Number)));
+ }
+
+ // for the int types,
+ // just call the normal "Hex" for that type
+ case TypeCode.Byte:
+ return Hex ((byte)Number);
+ case TypeCode.Int16:
+ return Hex ((short)Number);
+ case TypeCode.Int32:
+ return Hex ((int)Number);
+ case TypeCode.Int64:
+ return Hex ((long)Number);
+
+ // empty is defined as returning 0
+ case TypeCode.Empty:
+ return "0";
+
+ // we can't do any of these types
+ case TypeCode.Boolean:
+ case TypeCode.Char:
+ case TypeCode.DBNull:
+ case TypeCode.DateTime:
+ case TypeCode.Decimal:
+ case TypeCode.Double:
+ case TypeCode.Object:
+ case TypeCode.SByte:
+ case TypeCode.Single:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ default:
+ throw new ArgumentException (
+ "Type of argument 'Number' is '" +
+ Number.GetType().FullName +
+ "', which is not numeric.");
+ }
+ }
+
+ // ToOct works just like ToHex, only in Octal.
+ private static string ToOct(long Number, int Digits,
+ SizeIndexes Size) {
+ ulong UNumber;
+
+ if (Number < 0) {
+ // for neg numbers add the maxint of
+ // the appropriate size twice, and then two more
+ // this has the effect of turning it
+ // into a ulong with the same oct representation
+ UNumber = (ulong)((Number + 2) +
+ _Maxes[(int)Size]) +
+ (ulong)(_Maxes[(int)Size]);
+ }
+ else {
+ UNumber = (ulong)Number;
+ }
+ return ToBase (UNumber, Digits, _OctDigits, 8);
+ }
+
+ // call ToOct with appropriate information
+ public static string Oct (short Number) {
+ return ToOct(Number, 6, SizeIndexes.Int16);
+ }
+ public static string Oct (byte Number) {
+ return ToOct(Number, 3, SizeIndexes.Int16);
+ }
+ public static string Oct (int Number) {
+ return ToOct(Number, 11, SizeIndexes.Int32);
+ }
+ public static string Oct (long Number) {
+ return ToOct(Number, 22, SizeIndexes.Int64);
+ }
+
+ // Objects are always trickier
+ // first need to cast to appropriate type
+ public static string Oct (System.Object Number) {
+ // first, always throw an exception if Number is null
+ if (Number == null) {
+ throw new ArgumentNullException("Number",
+ "Value cannot be null");
+ }
+
+ TypeCode TC = Type.GetTypeCode (Number.GetType ());
+
+ switch (TC) {
+ // try to parse a string as an Int32
+ // and then an Int64
+ case TypeCode.String:
+ try {
+ return Oct (
+ Int32.Parse (
+ CastToString (Number)));
+ }
+ catch {
+ return Oct (
+ Int64.Parse (
+ CastToString (Number)));
+ }
+
+ // integer types just call the appropriate "Oct"
+ case TypeCode.Byte:
+ return Oct ((byte)Number);
+ case TypeCode.Int16:
+ return Oct ((short)Number);
+ case TypeCode.Int32:
+ return Oct ((int)Number);
+ case TypeCode.Int64:
+ return Oct ((long)Number);
+
+ // Empty is defined as returning 0
+ case TypeCode.Empty:
+ return "0";
+
+ // We can't convert these to Octal
+ case TypeCode.Boolean:
+ case TypeCode.Char:
+ case TypeCode.DBNull:
+ case TypeCode.DateTime:
+ case TypeCode.Decimal:
+ case TypeCode.Double:
+ case TypeCode.Object:
+ case TypeCode.SByte:
+ case TypeCode.Single:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ default:
+ throw new ArgumentException (
+ "Type of argument 'Number' is '" +
+ Number.GetType().FullName +
+ "', which is not numeric.");
+ }
+ }
+
+ // Str is pretty easy now that we have a language
+ // with a ToString method()
+ public static string Str (System.Object Number) {
+
+ // check for null as always and throw an exception
+ if (Number == null) {
+ throw new ArgumentNullException("Number");
+ }
+
+ switch (Type.GetTypeCode (Number.GetType ())) {
+ // for unsigned types, just call ToString
+ case TypeCode.Byte:
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.UInt64:
+ return Number.ToString();
+
+ // for signed types, we have to leave a
+ // space for the missing + sign
+ case TypeCode.Decimal:
+ return ((decimal)Number > 0 ? " " : "")
+ + Number.ToString();
+ case TypeCode.Double:
+ return ((double)Number > 0 ? " " : "")
+ + Number.ToString();
+ case TypeCode.Int16:
+ return ((short)Number > 0 ? " " : "")
+ + Number.ToString();
+ case TypeCode.Int32:
+ return ((int)Number > 0 ? " " : "")
+ + Number.ToString();
+ case TypeCode.Int64:
+ return ((long)Number > 0 ? " " : "")
+ + Number.ToString();
+ case TypeCode.SByte:
+ return ((sbyte)Number > 0 ? " " : "")
+ + Number.ToString();
+ case TypeCode.Single:
+ return ((float)Number > 0 ? " " : "")
+ + Number.ToString();
+
+ // can't cast anything else to a Number
+ default:
+ throw new InvalidCastException(
+ "Argument 'Number' cannot be converted to a numeric value.");
+ }
+ }
+
+ // The Val function is pretty bizarre
+ // Val ("&HFF") = 255
+ // Val ("&O377") = 255
+ // Val ("1234 Any Street") = 1234
+ // Val (" 12 45 . 90 7 E + 0 0 2 ") = 1245.907e+002 = 124590.7
+ public static double Val (string InputStr) {
+ int i;
+ int Base;
+ int NumChars = 0;
+ char c;
+ int Length = InputStr.Length;
+ char[] Number = new char[Length];
+ bool FoundRadixPrefix = false;
+ Regex NumberReg;
+ Match NumberMatch;
+
+ Base = 10;
+ Number[0] = '\0';
+
+ // go through string
+ for (i = 0; i < Length; i++) {
+ c = InputStr[i];
+
+ // look for Radix prefix "&"
+ if (i == 0 && c == '&') {
+ FoundRadixPrefix = true;
+ }
+
+ // look for an H or O following the prefix
+ else if (FoundRadixPrefix && i == 1 &&
+ (char.ToLower(c) == 'h' ||
+ char.ToLower(c) == 'o')) {
+ if (c == 'H') {
+ Base = 16;
+ }
+ else {
+ Base = 8;
+ }
+ }
+
+ // if we didn't find a radix prefix,
+ // ignore whitespace
+ else if (char.IsWhiteSpace(c) && (Base == 10)) {
+ continue;
+ }
+
+ // mash what's left together
+ else {
+ Number[NumChars++] = c;
+ }
+ }
+
+ // now we have a string to parse
+ switch (Base) {
+ // FIXME : for Octal and Hex,
+ // Regex is probably overkill
+ // Even for base 10, it might be faster
+ // to write our own parser
+ case 8:
+ NumberReg = new Regex ("^[0-7]*");
+ NumberMatch = NumberReg.Match (
+ new string(Number, 0, NumChars));
+ break;
+ case 16:
+ NumberReg = new Regex ("^[0-9a-f]*",
+ RegexOptions.IgnoreCase);
+ NumberMatch = NumberReg.Match (
+ new string(Number, 0, NumChars));
+ break;
+ case 10:
+ default:
+ NumberReg = new Regex (
+ "^[+-]?\\d*\\.?\\d*(e?[+-]?\\d*)",
+ RegexOptions.IgnoreCase);
+ NumberMatch = NumberReg.Match (
+ new string(Number, 0, NumChars));
+ break;
+
+
+ }
+
+ // we found a match, try to convert it
+ if (NumberMatch.Success) {
+ try {
+ switch (Base) {
+ case 10:
+ return
+ Convert.ToDouble (
+ NumberMatch.Value);
+ case 8:
+ case 16:
+ return (double)
+ Convert.ToInt64 (
+ NumberMatch.Value,
+ Base);
+ default:
+ return (double)0;
+ }
+ }
+ catch {
+ throw new OverflowException();
+ }
+ }
+ else {
+ return (double)0;
+ }
+ }
+
+ // Val on a char type is pretty simple '9' = 9, 'a' = exception
+ public static int Val (char Expression) {
+ if (char.IsDigit(Expression)) {
+ return Expression - '0';
+ }
+ else {
+ throw new ArgumentException();
+ }
+ }
+
+ // if it's an object, and we can't convert
+ // it to a string, it's an exception
+ public static double Val (System.Object Expression) {
+ // always check for null first
+ if (Expression == null) {
+ throw new ArgumentNullException ("Expression",
+ "Value cannot be null");
+ }
+
+ try {
+ return Val (CastToString (Expression));
+ }
+ catch {
+ throw new ArgumentException(
+ "Type of argument 'Expression' is '" +
+ Expression.GetType().FullName +
+ "', which can nt be converted to numeric.");
+ }
+ }
+ // Events
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateAndTime.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateAndTime.cs
new file mode 100644
index 00000000000..6d809db4923
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateAndTime.cs
@@ -0,0 +1,478 @@
+//
+// DateAndTime.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace Microsoft.VisualBasic
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class DateAndTime {
+ public static string DateString {
+ get {
+ return DateTime.Today.ToString("MM-dd-yyyy");
+ }
+
+ set {
+ string [] formats = { "M-d-yyyy", "M-d-y", "M/d/yyyy", "M/d/y" };
+
+ try {
+ DateTime dtToday = DateTime.ParseExact(value, formats,
+ DateTimeFormatInfo.CurrentInfo,
+ DateTimeStyles.None);
+
+ Today = dtToday;
+ }
+ catch {
+ throw new InvalidCastException();
+ }
+ }
+ }
+
+ public static System.DateTime Today {
+ get { return DateTime.Today; }
+ set {
+ // FIXME: This needs to use some OS specific code
+ // I've already written it for Windows
+ // and Unix won't be hard, but need an
+ // OS object from the compiler
+ // OS specific code needs to check permissions
+ // too, and throw an ArgumentOutOfRangeException
+ // if no permissions
+// DateTime dtNow = DateTime.Now;
+//
+// SysTime.LocalTime = new DateTime(value.Year,
+// value.Month, value.Day, dtNow.Hour,
+// dtNow.Minute, dtNow.Second, dtNow.Millisecond);
+ throw new NotImplementedException();
+ }
+ }
+
+ public static double Timer {
+ get {
+ DateTime DTNow = DateTime.Now;
+
+ return DTNow.Hour * 3600 + DTNow.Minute * 60 +
+ DTNow.Second + DTNow.Millisecond /
+ 1000D;
+ }
+ }
+
+ public static System.DateTime Now {
+ get { return DateTime.Now; }
+ }
+
+ public static System.DateTime TimeOfDay {
+ get {
+ TimeSpan TSpan = DateTime.Now.TimeOfDay;
+
+ return new DateTime(1, 1, 1, TSpan.Hours,
+ TSpan.Minutes, TSpan.Seconds,
+ TSpan.Milliseconds);
+ }
+ set {
+ // FIXME: This needs to use some OS specific code
+ // I've already written it for Windows
+ // and Unix won't be hard, but need an
+ // OS object from the compiler
+ // OS specific code needs to check permissions
+ // too, and throw an ArgumentOutOfRangeException
+ // if no permissions
+// DateTime dtToday = DateTime.Today;
+//
+// SysTime.LocalTime = new DateTime(dtToday.Year,
+// dtToday.Month, dtToday.Day, value.Hour,
+// value.Minute, value.Second, value.Millisecond);
+ throw new NotImplementedException();
+ }
+ }
+
+ public static string TimeString {
+ get { return DateTime.Now.ToString("HH:mm:ss"); }
+ set {
+ string format = "HH:mm:ss";
+
+ try {
+ DateTime dtToday = DateTime.ParseExact(value, format,
+ DateTimeFormatInfo.CurrentInfo,
+ DateTimeStyles.None);
+
+ TimeOfDay = dtToday;
+ }
+ catch {
+ throw new InvalidCastException();
+ }
+ }
+ }
+
+ // Methods
+ public static System.DateTime DateAdd (DateInterval Interval,
+ double Number, System.DateTime DateValue) {
+
+ switch (Interval) {
+ case DateInterval.Year:
+ return DateValue.AddYears((int)Number);
+ case DateInterval.Quarter:
+ return DateValue.AddMonths((int)Number * 3);
+ case DateInterval.Month:
+ return DateValue.AddMonths((int)Number);
+ case DateInterval.WeekOfYear:
+ return DateValue.AddDays(Number * 7);
+ case DateInterval.Day:
+ case DateInterval.DayOfYear:
+ case DateInterval.Weekday:
+ return DateValue.AddDays(Number);
+ case DateInterval.Hour:
+ return DateValue.AddHours(Number);
+ case DateInterval.Minute:
+ return DateValue.AddMinutes(Number);
+ case DateInterval.Second:
+ return DateValue.AddSeconds(Number);
+ default:
+ throw new ArgumentException();
+ }
+ }
+
+ private static DayOfWeek GetDayRule(FirstDayOfWeek StartOfWeek, DayOfWeek DayRule)
+ {
+ switch (StartOfWeek) {
+ case FirstDayOfWeek.System:
+ return DayRule;
+ case FirstDayOfWeek.Sunday:
+ return DayOfWeek.Sunday;
+ case FirstDayOfWeek.Monday:
+ return DayOfWeek.Monday;
+ case FirstDayOfWeek.Tuesday:
+ return DayOfWeek.Tuesday;
+ case FirstDayOfWeek.Wednesday:
+ return DayOfWeek.Wednesday;
+ case FirstDayOfWeek.Thursday:
+ return DayOfWeek.Thursday;
+ case FirstDayOfWeek.Friday:
+ return DayOfWeek.Friday;
+ case FirstDayOfWeek.Saturday:
+ return DayOfWeek.Saturday;
+ default:
+ throw new ArgumentException();
+ }
+ }
+
+ private static CalendarWeekRule GetWeekRule(FirstWeekOfYear StartOfYear, CalendarWeekRule WeekRule)
+ {
+ switch (StartOfYear) {
+ case FirstWeekOfYear.System:
+ return WeekRule;
+ case FirstWeekOfYear.FirstFourDays:
+ return CalendarWeekRule.FirstFourDayWeek;
+ case FirstWeekOfYear.FirstFullWeek:
+ return CalendarWeekRule.FirstFullWeek;
+ case FirstWeekOfYear.Jan1:
+ return CalendarWeekRule.FirstDay;
+ default:
+ throw new ArgumentException();
+ }
+ }
+
+ public static long DateDiff (DateInterval Interval,
+ System.DateTime Date1, System.DateTime Date2,
+ [Optional] [DefaultValue(FirstDayOfWeek.Sunday)]
+ FirstDayOfWeek StartOfWeek,
+ [Optional] [DefaultValue(FirstWeekOfYear.Jan1)]
+ FirstWeekOfYear StartOfYear)
+ {
+
+ int YearMonths;
+ int YearQuarters;
+ int YearWeeks;
+ CalendarWeekRule WeekRule = CalendarWeekRule.FirstDay;
+ DayOfWeek DayRule = DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek;
+ Calendar CurCalendar = CultureInfo.CurrentCulture.Calendar;
+
+ switch (Interval) {
+ case DateInterval.Year:
+ return Date2.Year - Date1.Year;
+ case DateInterval.Quarter:
+ YearQuarters = (Date2.Year - Date1.Year) * 4;
+ return Date2.Month / 4 - Date1.Month / 4 + YearQuarters;
+ case DateInterval.Month:
+ YearMonths = (Date2.Year - Date1.Year) * 12;
+ return Date2.Month - Date1.Month + YearMonths;
+ case DateInterval.WeekOfYear:
+ YearWeeks = (Date2.Year - Date1.Year) * 53;
+ DayRule = GetDayRule(StartOfWeek, DayRule);
+ WeekRule = GetWeekRule(StartOfYear, WeekRule);
+ return CurCalendar.GetWeekOfYear(Date2, WeekRule, DayRule) -
+ CurCalendar.GetWeekOfYear(Date1,WeekRule, DayRule) +
+ YearWeeks;
+ case DateInterval.Weekday:
+ return ((TimeSpan)(Date2.Subtract(Date1))).Days / 7;
+ case DateInterval.DayOfYear:
+ case DateInterval.Day:
+ return ((TimeSpan)(Date2.Subtract(Date1))).Days;
+ case DateInterval.Hour:
+ return ((TimeSpan)(Date2.Subtract(Date1))).Hours;
+ case DateInterval.Minute:
+ return ((TimeSpan)(Date2.Subtract(Date1))).Minutes;
+ case DateInterval.Second:
+ return ((TimeSpan)(Date2.Subtract(Date1))).Seconds;
+ default:
+ throw new ArgumentException();
+ }
+ }
+
+ private static int ConvertWeekDay(DayOfWeek Day, int Offset)
+ {
+
+ int Weekday = (int)Day + Offset;
+
+ if (Weekday > 7) {
+ Weekday -= 7;
+ }
+
+ switch((DayOfWeek)Weekday) {
+ case DayOfWeek.Sunday:
+ return (int)FirstDayOfWeek.Sunday;
+ case DayOfWeek.Monday:
+ return (int)FirstDayOfWeek.Monday;
+ case DayOfWeek.Tuesday:
+ return (int)FirstDayOfWeek.Tuesday;
+ case DayOfWeek.Wednesday:
+ return (int)FirstDayOfWeek.Wednesday;
+ case DayOfWeek.Thursday:
+ return (int)FirstDayOfWeek.Thursday;
+ case DayOfWeek.Friday:
+ return (int)FirstDayOfWeek.Friday;
+ case DayOfWeek.Saturday:
+ return (int)FirstDayOfWeek.Saturday;
+ default:
+ throw new ArgumentException();
+ }
+
+ }
+
+ public static int DatePart
+ (
+ Microsoft.VisualBasic.DateInterval Interval,
+ System.DateTime DateValue,
+ [Optional] [DefaultValue(FirstDayOfWeek.Sunday)]
+ FirstDayOfWeek StartOfWeek,
+ [Optional] [DefaultValue(FirstWeekOfYear.Jan1)]
+ FirstWeekOfYear StartOfYear) {
+
+ CalendarWeekRule WeekRule = CalendarWeekRule.FirstDay;
+ DayOfWeek DayRule = DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek;
+ Calendar CurCalendar = CultureInfo.CurrentCulture.Calendar;
+
+ switch (Interval) {
+ case DateInterval.Year:
+ return DateValue.Year;
+ case DateInterval.Quarter:
+ return DateValue.Month / 4 + 1;
+ case DateInterval.Month:
+ return DateValue.Month;
+ case DateInterval.WeekOfYear:
+ DayRule = GetDayRule(StartOfWeek, DayRule);
+ WeekRule = GetWeekRule(StartOfYear, WeekRule);
+ return CurCalendar.GetWeekOfYear(DateValue, WeekRule, DayRule);
+ case DateInterval.Weekday:
+ return ConvertWeekDay(DateValue.DayOfWeek, (int)DayRule);
+ case DateInterval.DayOfYear:
+ return DateValue.DayOfYear;
+ case DateInterval.Day:
+ return DateValue.Day;
+ case DateInterval.Hour:
+ return DateValue.Hour;
+ case DateInterval.Minute:
+ return DateValue.Minute;
+ case DateInterval.Second:
+ return DateValue.Second;
+ default:
+ throw new ArgumentException();
+ }
+ }
+
+ private static DateInterval DateIntervalFromString(string Interval)
+ {
+ switch (Interval) {
+ case "yyyy":
+ return DateInterval.Year;
+ case "q":
+ return DateInterval.Quarter;
+ case "m":
+ return DateInterval.Month;
+ case "ww":
+ return DateInterval.WeekOfYear;
+ case "w":
+ return DateInterval.Weekday;
+ case "d":
+ return DateInterval.Day;
+ case "y":
+ return DateInterval.DayOfYear;
+ case "h":
+ return DateInterval.Hour;
+ case "n":
+ return DateInterval.Minute;
+ case "s":
+ return DateInterval.Second;
+ default:
+ throw new ArgumentException();
+ }
+ }
+
+ public static System.DateTime DateAdd (string Interval,
+ double Number, System.Object DateValue)
+ {
+ if (DateValue == null) {
+ throw new ArgumentNullException("DateValue", "Value can not be null.");
+ }
+ if (!(DateValue is DateTime)) {
+ throw new InvalidCastException();
+ }
+
+ return DateAdd(DateIntervalFromString(Interval), Number, (DateTime)DateValue);
+ }
+
+ public static System.Int64 DateDiff (string Interval,
+ System.Object Date1, System.Object Date2,
+ [Optional] [DefaultValue(FirstDayOfWeek.Sunday)]
+ FirstDayOfWeek StartOfWeek,
+ [Optional] [DefaultValue(FirstWeekOfYear.Jan1)]
+ FirstWeekOfYear StartOfYear)
+ {
+ if (Date1 == null) {
+ throw new ArgumentNullException("Date1", "Value can not be null.");
+ }
+ if (Date2 == null) {
+ throw new ArgumentNullException("Date2", "Value can not be null.");
+ }
+ if (!(Date1 is DateTime)) {
+ throw new InvalidCastException();
+ }
+ if (!(Date2 is DateTime)) {
+ throw new InvalidCastException();
+ }
+
+ return DateDiff(DateIntervalFromString(Interval), (DateTime)Date1,
+ (DateTime)Date2, StartOfWeek, StartOfYear);
+
+ }
+
+ public static System.Int32 DatePart (string Interval,
+ System.Object DateValue,
+ [Optional] [DefaultValue(FirstDayOfWeek.Sunday)]
+ FirstDayOfWeek StartOfWeek,
+ [Optional] [DefaultValue(FirstWeekOfYear.Jan1)]
+ FirstWeekOfYear StartOfYear)
+ {
+ if (DateValue == null) {
+ throw new ArgumentNullException("DateValue", "Value can not be null.");
+ }
+ if (!(DateValue is DateTime)) {
+ throw new InvalidCastException();
+ }
+
+
+ return DatePart(DateIntervalFromString(Interval),
+ (DateTime)DateValue, StartOfWeek, StartOfYear);
+ }
+
+ public static System.DateTime DateSerial (int Year, int Month, int Day)
+ {
+ return new DateTime(Year, Month, Day);
+ }
+
+ public static System.DateTime TimeSerial (int Hour, int Minute, int Second)
+ {
+ return new DateTime(1, 1, 1, Hour, Minute, Second);
+ }
+
+ public static System.DateTime DateValue (string StringDate)
+ {
+ return DateTime.Parse(StringDate);
+ }
+
+ public static System.DateTime TimeValue (string StringTime)
+ {
+ return DateTime.Parse(StringTime);
+ }
+
+ public static int Year (System.DateTime DateValue)
+ {
+ return DateValue.Year;
+ }
+
+ public static int Month (System.DateTime DateValue)
+ {
+ return DateValue.Month;
+ }
+
+ public static int Day (System.DateTime DateValue)
+ {
+ return DateValue.Day;
+ }
+
+ public static int Hour (System.DateTime TimeValue)
+ {
+ return TimeValue.Hour;
+ }
+
+ public static int Minute (System.DateTime TimeValue)
+ {
+ return TimeValue.Minute;
+ }
+
+ public static int Second (System.DateTime TimeValue)
+ {
+ return TimeValue.Second;
+ }
+
+ public static int Weekday (System.DateTime DateValue,
+ [Optional] [DefaultValue(FirstDayOfWeek.Sunday)]
+ FirstDayOfWeek StartOfWeek)
+ {
+ return DatePart(DateInterval.Weekday, DateValue, StartOfWeek, FirstWeekOfYear.System);
+ }
+
+ public static System.String MonthName (int Month,
+ [Optional] [DefaultValue(false)] bool Abbreviate)
+ {
+ if (Month < 1 || Month > 13) {
+ throw new ArgumentException();
+ }
+ if (Abbreviate) {
+ return CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(Month);
+ }
+ else {
+ return CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Month);
+ }
+ }
+
+ public static System.String WeekdayName (int Weekday,
+ [Optional] [DefaultValue(false)] System.Boolean Abbreviate,
+ [Optional] [DefaultValue(FirstDayOfWeek.System)]
+ FirstDayOfWeek FirstDayOfWeekValue)
+ {
+ if (Weekday < 1 || Weekday > 7) {
+ throw new ArgumentException();
+ }
+ Weekday += (int)FirstDayOfWeekValue;
+ if (Weekday > 7) {
+ Weekday -= 7;
+ }
+ if (Abbreviate) {
+ return CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedDayName((DayOfWeek)Weekday);
+ }
+ else {
+ return CultureInfo.CurrentCulture.DateTimeFormat.GetDayName((DayOfWeek)Weekday);
+ }
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateFormat.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateFormat.cs
new file mode 100644
index 00000000000..9ffcd7ebf10
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateFormat.cs
@@ -0,0 +1,37 @@
+//
+// DateFormat.cs
+//
+// Author:
+// Martin Adoue (martin@cwanet.com)
+//
+// (C) 2002 Martin Adoue
+//
+namespace Microsoft.VisualBasic {
+
+ /// <summary>
+ /// When you call the DateValue function, you can use the following
+ /// enumeration members in your code in place of the actual values.
+ /// </summary>
+ public enum DateFormat : int {
+ /// <summary>
+ /// For real numbers, displays a date and time. If the number has no fractional part, displays only a date. If the number has no integer part, displays time only. Date and time display is determined by your computer's regional settings.
+ /// </summary>
+ GeneralDate = 0,
+ /// <summary>
+ /// Displays a date using the long-date format specified in your computer's regional settings.
+ /// </summary>
+ LongDate = 1,
+ /// <summary>
+ /// Displays a date using the short-date format specified in your computer's regional settings.
+ /// </summary>
+ ShortDate = 2,
+ /// <summary>
+ /// Displays a time using the long-time format specified in your computer's regional settings.
+ /// </summary>
+ LongTime = 3,
+ /// <summary>
+ /// Displays a time using the short-time format specified in your computer's regional settings.
+ /// </summary>
+ ShortTime = 4
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateInterval.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateInterval.cs
new file mode 100644
index 00000000000..2c86a14733e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DateInterval.cs
@@ -0,0 +1,22 @@
+//
+// DateInterval.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum DateInterval : int {
+ Year = 0,
+ Quarter = 1,
+ Month = 2,
+ DayOfYear = 3,
+ Day = 4,
+ WeekOfYear = 5,
+ Weekday = 6,
+ Hour = 7,
+ Minute = 8,
+ Second = 9
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DueDate.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DueDate.cs
new file mode 100644
index 00000000000..82bc60f988e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/DueDate.cs
@@ -0,0 +1,14 @@
+//
+// DueDate.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum DueDate : int {
+ EndOfPeriod = 0,
+ BegOfPeriod = 1
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ErrObject.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ErrObject.cs
new file mode 100644
index 00000000000..54a9c6d1890
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ErrObject.cs
@@ -0,0 +1,121 @@
+//
+// ErrObject.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 pluto@tipic.com
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ sealed public class ErrObject {
+ // Declarations
+ int pHelpContext;
+ int pLastDllError;
+ int pNumber;
+ int pErl;
+ string pSource;
+ string pHelpFile;
+ string pDescription;
+ System.Exception pException;
+ // Constructors
+ // Properties
+ [MonoTODO]
+ public System.Int32 HelpContext
+ {
+ get {
+ return pHelpContext;
+ }
+ set {
+ pHelpContext = value;
+ }
+ }
+ [MonoTODO]
+ public System.Int32 LastDllError {
+ get {
+ return pLastDllError;
+ }
+ }
+ [MonoTODO]
+ public System.Int32 Number {
+ get {
+ return pNumber;
+ }
+ set {
+ pNumber = value;
+ }
+ }
+ [MonoTODO]
+ public System.Int32 Erl {
+ get {
+ return pErl;
+ }
+ }
+ [MonoTODO]
+ public System.String Source {
+ get {
+ return pSource;
+ }
+ set {
+ pSource = value;
+ }
+ }
+ [MonoTODO]
+ public System.String HelpFile {
+ get {
+ return pHelpFile;
+ }
+ set {
+ pHelpFile = value;
+ }
+ }
+ [MonoTODO]
+ public System.String Description {
+ get {
+ return pDescription;
+ }
+ set {
+ pDescription = value;
+ }
+ }
+ // Methods
+ [MonoTODO("We should parse the exception object to obtain VB-like error code. Not a trivial task!")]
+ internal void SetException (Exception ex)
+ {
+ if (pException != ex)
+ {
+ pNumber = 0xFFFF;
+ pSource = ex.Source;
+ pDescription = ex.Message + "\n" + ex.StackTrace;
+ }
+ }
+
+ [MonoTODO]
+ public System.Exception GetException ()
+ {
+ return pException;
+ }
+ [MonoTODO]
+ public void Clear () {
+ pHelpContext=0;
+ pLastDllError=0;
+ pNumber=0;
+ pErl=0;
+ pSource="";
+ pHelpFile="";
+ pDescription="";
+ pException= null;
+ }
+ [MonoTODO]
+ public void Raise (System.Int32 Number, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.Object Source, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.Object Description, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.Object HelpFile, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.Object HelpContext)
+ {
+ throw new NotImplementedException ();
+ }
+ // Events
+ };
+} \ No newline at end of file
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileAttribute.cs
new file mode 100644
index 00000000000..96dc29a3f4e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileAttribute.cs
@@ -0,0 +1,20 @@
+//
+// FileAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ [System.FlagsAttribute]
+ public enum FileAttribute : int {
+ Normal = 0,
+ ReadOnly = 1,
+ Hidden = 2,
+ System = 4,
+ Volume = 8,
+ Directory = 16,
+ Archive = 32
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs
new file mode 100644
index 00000000000..5e743d2bce1
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs
@@ -0,0 +1,422 @@
+//
+// FileSystem.cs
+//
+// Author:
+//
+// Daniel Campos ( danielcampos@myway.com )
+//
+//
+
+using System;
+using System.IO;
+namespace Microsoft.VisualBasic
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class FileSystem {
+ private static System.IO.FileStream[] FHandle=new FileStream[255];
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO("Needs testing")]
+ public static void ChDir (System.String Path)
+ {
+ if ( (Path=="") || (Path==null))
+ throw new System.ArgumentException("Path is empty");
+ try
+ {
+ Environment.CurrentDirectory=Path;
+ }
+ catch ( Exception e){ throw new System.IO.FileNotFoundException ("Invalid drive is specified, or drive is unavailable");}
+
+ }
+
+ [MonoTODO]
+ public static void ChDrive (System.Char Drive) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void ChDrive (System.String Drive) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static System.String CurDir ()
+ {
+ return Environment.CurrentDirectory;
+ }
+
+ [MonoTODO]
+ public static System.String CurDir (System.Char Drive) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String Dir () { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String Dir (System.String Pathname, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static void MkDir (System.String Path)
+ {
+ // if a file called like 'path' does exist
+ // no exception is generated using .net
+ // A little extrange?
+ if (Path==null || Path=="")
+ {
+ throw new System.ArgumentException();
+ }
+ else
+ {
+ if (System.IO.Directory.Exists (Path))
+ throw new System.IO.IOException("Directory already exists");
+ else
+ System.IO.Directory.CreateDirectory(Path);
+ }
+ }
+
+ [MonoTODO("Needs testing")]
+ public static void RmDir (System.String Path)
+ {
+ System.IO.Directory.Delete(Path);
+ }
+
+ [MonoTODO("Needs testing")]
+ public static void FileCopy (System.String Source, System.String Destination)
+ {
+ // using VB, filecopy always overwrites Destination
+ System.IO.File.Copy(Source,Destination,true);
+ }
+
+ [MonoTODO("Needs testing")]
+ public static System.DateTime FileDateTime (System.String PathName)
+ {
+ // A better exception handling is needed : exceptions
+ // are not the same as 'GetLastWriteTime'
+ return System.IO.File.GetLastWriteTime (PathName);
+ }
+
+ [MonoTODO]
+ public static System.Int64 FileLen (System.String PathName) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static Microsoft.VisualBasic.FileAttribute GetAttr (System.String PathName) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static void Kill (System.String PathName)
+ {
+ if (!System.IO.File.Exists(PathName))
+ throw new System.IO.FileNotFoundException();
+ else
+ System.IO.File.Delete(PathName);
+ }
+
+ [MonoTODO]
+ public static void SetAttr (System.String PathName, Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static void FileOpen (System.Int32 FileNumber, System.String FileName, Microsoft.VisualBasic.OpenMode Mode, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] Microsoft.VisualBasic.OpenAccess Access, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] Microsoft.VisualBasic.OpenShare Share, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 RecordLength)
+ {
+ // at this moment you can open a file
+ // only for Append, Input or Output
+ System.IO.FileMode MyMode;
+ System.IO.FileAccess MyAccess;
+ System.IO.FileShare MyShare;
+ if ( RecordLength < -1 )
+ throw new System.ArgumentException("Record Length is negative (nad not equal to -1)");
+ if ( RecordLength > 32767)
+ throw new System.ArgumentException ("Invalid Record Length");
+ if (FileNumber <0 || FileNumber > 255)
+ throw new System.IO.IOException(FileNumber.ToString() + " is invalid (<-1 or >255)",5);
+
+ FileNumber--;
+ if (FHandle[FileNumber] != null)
+ throw new System.IO.IOException (FileNumber.ToString() + " is in use",5);
+
+ switch (Mode)
+ {
+ case Microsoft.VisualBasic.OpenMode.Append :
+ MyMode=System.IO.FileMode.Append ;
+ break;
+ case Microsoft.VisualBasic.OpenMode.Binary :
+ throw new NotImplementedException ();
+
+ case Microsoft.VisualBasic.OpenMode.Input :
+ MyMode=System.IO.FileMode.Open ;
+ break;
+ case Microsoft.VisualBasic.OpenMode.Output :
+ MyMode=System.IO.FileMode.OpenOrCreate ;
+ break;
+ case Microsoft.VisualBasic.OpenMode.Random :
+ throw new NotImplementedException ();
+ default:
+ throw new System.ArgumentException("Invalid Share");
+ }
+ switch (Access)
+ {
+ case Microsoft.VisualBasic.OpenAccess.ReadWrite :
+ case Microsoft.VisualBasic.OpenAccess.Default :
+ MyAccess=System.IO.FileAccess.ReadWrite;
+ break;
+ case Microsoft.VisualBasic.OpenAccess.Read :
+ MyAccess=System.IO.FileAccess.Read;
+ break;
+ case Microsoft.VisualBasic.OpenAccess.Write :
+ MyAccess=System.IO.FileAccess.Write;
+ break;
+ default:
+ throw new System.ArgumentException("Invalid Access");
+
+ }
+ switch(Share)
+ {
+ case Microsoft.VisualBasic.OpenShare.Default :
+ case Microsoft.VisualBasic.OpenShare.Shared :
+ MyShare=System.IO.FileShare.ReadWrite ;
+ break;
+ case Microsoft.VisualBasic.OpenShare.LockRead :
+ MyShare=System.IO.FileShare.Write;
+ break;
+ case Microsoft.VisualBasic.OpenShare.LockReadWrite :
+ MyShare=System.IO.FileShare.None ;
+ break;
+ case Microsoft.VisualBasic.OpenShare.LockWrite :
+ MyShare=System.IO.FileShare.Read;
+ break;
+ default:
+ throw new System.ArgumentException("Invalid Share");
+ }
+ FHandle[FileNumber]=new System.IO.FileStream (FileName,MyMode,MyAccess,MyShare);
+
+
+
+
+ }
+
+ [MonoTODO("Needs testing")]
+ public static void FileClose (params System.Int32[] FileNumbers)
+ {
+ int bucle=0;
+ if (FileNumbers.Length == 0)
+ {
+ for(bucle=0;bucle<255;bucle++)
+ {
+ if (FHandle[bucle]!=null)
+ try
+ {
+ FHandle[bucle].Close();
+ }
+ catch (Exception e) {e.GetType (); FHandle[bucle]=null ;}
+ }
+ }
+ else
+ {
+ for(bucle=0;bucle<FileNumbers.Length;bucle++)
+ {
+ if ( FHandle [ FileNumbers[bucle] - 1 ] != null )
+ {
+ if (FileNumbers[bucle]>0 && FileNumbers[bucle]<256)
+ {
+ try
+ {
+ FHandle[ FileNumbers[bucle] - 1].Close();
+ FHandle[ FileNumbers[bucle] - 1]=null;
+ }
+ catch (Exception e){e.GetType (); FHandle[ FileNumbers[bucle] - 1]= null ;}
+ }
+ else
+ throw new System.IO.IOException (FileNumbers[bucle].ToString() + " Does not exist",52);
+ }
+ else
+ throw new System.IO.IOException (FileNumbers[bucle].ToString() + " Does not exist",52);
+ }
+ }
+ }
+
+ [MonoTODO]
+ public static void FileGetObject (System.Int32 FileNumber, ref System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.ValueType Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Array Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean ArrayIsDynamic, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Boolean Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Byte Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Int16 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Int32 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Int64 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Char Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Single Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Double Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.Decimal Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.String Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] ref System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileGet (System.Int32 FileNumber, ref System.DateTime Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] ref System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePutObject (System.Int32 FileNumber, System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.ObsoleteAttribute("Use FilePutObject to write Object types, or coerce FileNumber and RecordNumber to Integer for writing non-Object types", false)]
+ public static void FilePut (System.Object FileNumber, System.Object Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Object RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.ValueType Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Array Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean ArrayIsDynamic, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Boolean Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Byte Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Int16 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Int32 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Int64 Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Char Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Single Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Double Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.Decimal Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.String Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean StringIsFixedLength) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FilePut (System.Int32 FileNumber, System.DateTime Value, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int64 RecordNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Print (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void PrintLine (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Object Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Boolean Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Byte Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Int16 Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Int32 Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Int64 Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Char Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Single Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Double Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.Decimal Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.String Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Input (System.Int32 FileNumber, ref System.DateTime Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Write (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void WriteLine (System.Int32 FileNumber, params System.Object[] Output) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String InputString (System.Int32 FileNumber, System.Int32 CharCount) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static System.String LineInput (System.Int32 FileNumber)
+ {
+ string retval="";
+ int buf='\x00';
+ bool found=false;
+ if ( FileNumber<1 || FileNumber>255)
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);
+ if ( FHandle[FileNumber - 1] == null)
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);
+
+ if ( EOF(FileNumber) )
+ throw new System.IO.EndOfStreamException();
+
+ while (!found)
+ {
+
+ buf=FHandle[FileNumber - 1].ReadByte();
+ if ( (buf == -1) || (buf == '\x0A' ) )
+ found=true;
+ else
+ retval+= ((char)buf).ToString();
+ }
+ if ( retval.Length > 0 )
+ if ( (buf == '\x0A') && (retval[retval.Length -1 ] == '\x0D') )
+ retval=retval.Substring(0,retval.Length -1) ;
+ Console.WriteLine (retval);
+ return retval;
+
+ }
+
+ [MonoTODO]
+ public static void Lock (System.Int32 FileNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Lock (System.Int32 FileNumber, System.Int64 Record) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Lock (System.Int32 FileNumber, System.Int64 FromRecord, System.Int64 ToRecord) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Unlock (System.Int32 FileNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Unlock (System.Int32 FileNumber, System.Int64 Record) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Unlock (System.Int32 FileNumber, System.Int64 FromRecord, System.Int64 ToRecord) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void FileWidth (System.Int32 FileNumber, System.Int32 RecordWidth) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static System.Int32 FreeFile ()
+ {
+ int bucle=0;
+ bool found=false;
+ for (bucle=0;bucle<255;bucle++)
+ if (FHandle[bucle]==null)
+ {
+ found=true;
+ break;
+ }
+ if (!found)
+ throw new System.IO.IOException ("More than 255 files are in use",67);
+ else
+ return bucle+1;
+ }
+ [MonoTODO]
+ public static void Seek (System.Int32 FileNumber, System.Int64 Position) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Int64 Seek (System.Int32 FileNumber) { throw new NotImplementedException (); }
+
+ [MonoTODO("Needs testing")]
+ public static System.Boolean EOF ( System.Int32 FileNumber)
+ {
+ if (FileNumber<1 || FileNumber>255)
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);
+ if ( FHandle[FileNumber - 1] == null)
+ throw new System.IO.IOException (FileNumber.ToString() + " does not exists",52);
+ if ( FHandle[FileNumber - 1].Length == FHandle[FileNumber - 1].Position)
+ return true;
+ else
+ return false;
+
+ }
+
+ [MonoTODO]
+ public static System.Int64 Loc (System.Int32 FileNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Int64 LOF (System.Int32 FileNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static Microsoft.VisualBasic.TabInfo TAB () { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static Microsoft.VisualBasic.TabInfo TAB (System.Int16 Column) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static Microsoft.VisualBasic.SpcInfo SPC (System.Int16 Count) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static Microsoft.VisualBasic.OpenMode FileAttr (System.Int32 FileNumber) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Reset () { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void Rename (System.String OldPath, System.String NewPath) { throw new NotImplementedException (); }
+ // Events
+
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Financial.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Financial.cs
new file mode 100644
index 00000000000..613c49ea716
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Financial.cs
@@ -0,0 +1,48 @@
+//
+// Financial.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class Financial {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static System.Double DDB (System.Double Cost, System.Double Salvage, System.Double Life, System.Double Period, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(2)] System.Double Factor) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double FV (System.Double Rate, System.Double NPer, System.Double Pmt, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double PV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double IPmt (System.Double Rate, System.Double Per, System.Double NPer, System.Double PV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double FV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double IRR (ref System.Double[] ValueArray, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0.1)] ref System.Double Guess) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double MIRR (ref System.Double[] ValueArray, ref System.Double FinanceRate, ref System.Double ReinvestRate) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double NPer (System.Double Rate, System.Double Pmt, System.Double PV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double FV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double NPV (System.Double Rate, ref System.Double[] ValueArray) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double Pmt (System.Double Rate, System.Double NPer, System.Double PV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double FV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double PPmt (System.Double Rate, System.Double Per, System.Double NPer, System.Double PV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double FV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double PV (System.Double Rate, System.Double NPer, System.Double Pmt, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double FV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double Rate (System.Double NPer, System.Double Pmt, System.Double PV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] System.Double FV, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.DueDate Due, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0.1)] System.Double Guess) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double SLN (System.Double Cost, System.Double Salvage, System.Double Life) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double SYD (System.Double Cost, System.Double Salvage, System.Double Life, System.Double Period) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstDayOfWeek.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstDayOfWeek.cs
new file mode 100644
index 00000000000..05cf55c0c35
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstDayOfWeek.cs
@@ -0,0 +1,20 @@
+//
+// FirstDayOfWeek.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum FirstDayOfWeek : int {
+ System = 0,
+ Sunday = 1,
+ Monday = 2,
+ Tuesday = 3,
+ Wednesday = 4,
+ Thursday = 5,
+ Friday = 6,
+ Saturday = 7
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstWeekOfYear.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstWeekOfYear.cs
new file mode 100644
index 00000000000..035e5bd5feb
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FirstWeekOfYear.cs
@@ -0,0 +1,16 @@
+//
+// FirstWeekOfYear.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum FirstWeekOfYear : int {
+ System = 0,
+ Jan1 = 1,
+ FirstFourDays = 2,
+ FirstFullWeek = 3
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Globals.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Globals.cs
new file mode 100644
index 00000000000..2c89b994d4e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Globals.cs
@@ -0,0 +1,30 @@
+//
+// Globals.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class Globals {
+ // Declarations
+ // Constructors
+ // Properties
+ [MonoTODO]
+ public static System.String ScriptEngine { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public static System.Int32 ScriptEngineMajorVersion { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public static System.Int32 ScriptEngineMinorVersion { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public static System.Int32 ScriptEngineBuildVersion { get { throw new NotImplementedException (); } }
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs
new file mode 100644
index 00000000000..cb7e773d58d
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs
@@ -0,0 +1,61 @@
+//
+// Information.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com
+//
+// (C) 2002 Chris J Breisch
+// 2003 Tipic, Inc. (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class Information {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static Microsoft.VisualBasic.ErrObject Err () {
+ return Microsoft.VisualBasic.CompilerServices.ProjectData.Err;
+ }
+ [MonoTODO]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public static System.Int32 Erl () { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsArray (System.Object VarName) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsDate (System.Object Expression) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsDBNull (System.Object Expression) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsNothing (System.Object Expression) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsError (System.Object Expression) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsReference (System.Object Expression) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean IsNumeric (System.Object Expression) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Int32 LBound (System.Array Array, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(1)] System.Int32 Rank) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Int32 UBound (System.Array Array, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(1)] System.Int32 Rank) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String TypeName (System.Object VarName) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String SystemTypeName (System.String VbName) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String VbTypeName (System.String UrtName) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Int32 QBColor (System.Int32 Color) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Int32 RGB (System.Int32 Red, System.Int32 Green, System.Int32 Blue) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static Microsoft.VisualBasic.VariantType VarType (System.Object VarName) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs
new file mode 100644
index 00000000000..ad17f86ceef
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs
@@ -0,0 +1,39 @@
+//
+// Interaction.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)]
+ sealed public class Interaction {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Int32 Shell (System.String Pathname, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(2)] Microsoft.VisualBasic.AppWinStyle Style, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(false)] System.Boolean Wait, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 Timeout) { return 0;}
+ public static void AppActivate (System.Int32 ProcessId) { }
+ public static void AppActivate (System.String Title) { }
+ public static System.String Command () { return "";}
+ public static System.String Environ (System.Int32 Expression) { return "";}
+ public static System.String Environ (System.String Expression) { return "";}
+ public static void Beep () { }
+ public static System.String InputBox (System.String Prompt, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String Title, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String DefaultResponse, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 XPos, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 YPos) { return "";}
+ public static Microsoft.VisualBasic.MsgBoxResult MsgBox (System.Object Prompt, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.MsgBoxStyle Buttons, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.Object Title) { return 0;}
+ public static System.Object CallByName (System.Object ObjectRef, System.String ProcName, Microsoft.VisualBasic.CallType UseCallType, params System.Object[] Args) { return null;}
+ public static System.Object Choose (System.Double Index, params System.Object[] Choice) { return null;}
+ public static System.Object IIf (System.Boolean Expression, System.Object TruePart, System.Object FalsePart) { return null;}
+ public static System.String Partition (System.Int64 Number, System.Int64 Start, System.Int64 Stop, System.Int64 Interval) { return "";}
+ public static System.Object Switch (params System.Object[] VarExpr) { return null;}
+ public static void DeleteSetting (System.String AppName, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String Section, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String Key) { }
+ public static System.String[,] GetAllSettings (System.String AppName, System.String Section) { return null;}
+ public static System.String GetSetting (System.String AppName, System.String Section, System.String Key, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String Default) { return "";}
+ public static void SaveSetting (System.String AppName, System.String Section, System.String Key, System.String Setting) { }
+ public static System.Object CreateObject (System.String ProgId, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String ServerName) { return null;}
+ public static System.Object GetObject ([System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String PathName, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String Class) { return null;}
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/BooleanType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/BooleanType.cs
new file mode 100644
index 00000000000..45183bd6c33
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/BooleanType.cs
@@ -0,0 +1,32 @@
+//
+// BooleanType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 Tipic, Inc (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class BooleanType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Boolean FromString (System.String Value) { return System.Boolean.Parse(Value); }
+ public static System.Boolean FromObject (System.Object Value)
+ {
+ if ((object)Value == null) return false;
+ //if (Value.GetType() == typeof(string)) return FromString((string)Value);
+ else return System.Convert.ToBoolean(Value);
+ }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ByteType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ByteType.cs
new file mode 100644
index 00000000000..9ba599d7bdc
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ByteType.cs
@@ -0,0 +1,33 @@
+//
+// ByteType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 Tipic, Inc (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class ByteType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Byte FromString (System.String Value) { return System.Byte.Parse(Value); }
+
+ public static System.Byte FromObject (System.Object Value)
+ {
+ if ((object)Value == null) return 0;
+ else return System.Convert.ToByte(Value);
+ }
+
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharArrayType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharArrayType.cs
new file mode 100644
index 00000000000..0ff4c50c3b5
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharArrayType.cs
@@ -0,0 +1,27 @@
+//
+// CharArrayType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class CharArrayType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static System.Char[] FromString (System.String Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Char[] FromObject (System.Object Value) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharType.cs
new file mode 100644
index 00000000000..a493a84f45c
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharType.cs
@@ -0,0 +1,27 @@
+//
+// CharType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class CharType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static System.Char FromString (System.String Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Char FromObject (System.Object Value) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DateType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DateType.cs
new file mode 100644
index 00000000000..348b4ce3dd8
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DateType.cs
@@ -0,0 +1,36 @@
+//
+// DateType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 Tipic, Inc (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class DateType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.DateTime FromString (System.String Value) { return System.DateTime.Parse(Value); }
+ public static System.DateTime FromString (System.String Value, System.Globalization.CultureInfo culture)
+ {
+ return System.DateTime.Parse (Value,culture);
+ }
+ public static System.DateTime FromObject (System.Object Value) {
+ if ((object)Value ==null)
+ return new DateTime(1,1,1);
+ //if (Value.GetType() == typeof(string)) return FromString((string)Value);
+ else return System.Convert.ToDateTime(Value);
+ }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DecimalType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DecimalType.cs
new file mode 100644
index 00000000000..670f406f42b
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DecimalType.cs
@@ -0,0 +1,34 @@
+//
+// DecimalType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class DecimalType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static System.Decimal FromBoolean (System.Boolean Value) { throw new NotImplementedException (); }
+ public static System.Decimal FromString (System.String Value) { return System.Decimal.Parse(Value); }
+ [MonoTODO]
+ public static System.Decimal FromString (System.String Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Decimal FromObject (System.Object Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Decimal FromObject (System.Object Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Decimal Parse (System.String Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DoubleType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DoubleType.cs
new file mode 100644
index 00000000000..1d0e2b99fa3
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DoubleType.cs
@@ -0,0 +1,33 @@
+//
+// DoubleType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class DoubleType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Double FromString (System.String Value) { return System.Double.Parse(Value); }
+ [MonoTODO]
+ public static System.Double FromString (System.String Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double FromObject (System.Object Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Double FromObject (System.Object Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ public static System.Double Parse (System.String Value) { return System.Double.Parse(Value); }
+ [MonoTODO]
+ public static System.Double Parse (System.String Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ExceptionUtils.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ExceptionUtils.cs
new file mode 100644
index 00000000000..03442b7382f
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ExceptionUtils.cs
@@ -0,0 +1,20 @@
+//
+// ExceptionUtils.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic.CompilerServices {
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)]
+ sealed public class ExceptionUtils {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/FlowControl.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/FlowControl.cs
new file mode 100644
index 00000000000..50f5ff3b23f
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/FlowControl.cs
@@ -0,0 +1,41 @@
+//
+// FlowControl.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class FlowControl {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static System.Boolean ForNextCheckR4 (System.Single count, System.Single limit, System.Single StepValue) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean ForNextCheckR8 (System.Double count, System.Double limit, System.Double StepValue) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean ForNextCheckDec (System.Decimal count, System.Decimal limit, System.Decimal StepValue) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean ForLoopInitObj (System.Object Counter, System.Object Start, System.Object Limit, System.Object StepValue, ref System.Object LoopForResult, ref System.Object CounterResult) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean ForNextCheckObj (System.Object Counter, System.Object LoopObj, ref System.Object CounterResult) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Collections.IEnumerator ForEachInArr (System.Array ary) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Collections.IEnumerator ForEachInObj (System.Object obj) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean ForEachNextObj (ref System.Object obj, ref System.Collections.IEnumerator enumerator) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void CheckForSyncLockOnValueType (System.Object obj) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/HostServices.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/HostServices.cs
new file mode 100644
index 00000000000..49145ede7e9
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/HostServices.cs
@@ -0,0 +1,24 @@
+//
+// HostServices.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class HostServices {
+ // Declarations
+ // Constructors
+ // Properties
+ [MonoTODO]
+ public static Microsoft.VisualBasic.CompilerServices.IVbHost VBHost { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } }
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IVbHost.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IVbHost.cs
new file mode 100644
index 00000000000..abff24de804
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IVbHost.cs
@@ -0,0 +1,20 @@
+//
+// IVbHost.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic.CompilerServices {
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public interface IVbHost {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ System.String GetWindowTitle ();
+ // System.Windows.Forms.IWin32Window GetParentWindow ();
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IncompleteInitialization.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IncompleteInitialization.cs
new file mode 100644
index 00000000000..e22ac728bc1
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IncompleteInitialization.cs
@@ -0,0 +1,19 @@
+//
+// IncompleteInitialization.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic.CompilerServices {
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [MonoTODO]
+ sealed public class IncompleteInitialization : System.Exception, System.Runtime.Serialization.ISerializable {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IntegerType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IntegerType.cs
new file mode 100644
index 00000000000..ba41771ab1c
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IntegerType.cs
@@ -0,0 +1,33 @@
+//
+// IntegerType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 Tipic, Inc (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class IntegerType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Int32 FromString (System.String Value) { return System.Int32.Parse(Value); }
+
+ public static System.Int32 FromObject (System.Object Value)
+ {
+ if ((object)Value==null)
+ return 0;
+ else return System.Convert.ToInt32(Value);
+ }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
new file mode 100644
index 00000000000..22ce2f3faf3
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
@@ -0,0 +1,51 @@
+//
+// LateBinding.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class LateBinding {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ public static System.Object LateGet (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames, System.Boolean[] CopyBack) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ public static void LateSetComplex (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames, System.Boolean OptimisticSet, System.Boolean RValueBase) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ public static void LateSet (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ public static System.Object LateIndexGet (System.Object o, System.Object[] args, System.String[] paramnames) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ public static void LateIndexSetComplex (System.Object o, System.Object[] args, System.String[] paramnames, System.Boolean OptimisticSet, System.Boolean RValueBase) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ public static void LateIndexSet (System.Object o, System.Object[] args, System.String[] paramnames) { throw new NotImplementedException (); }
+ [MonoTODO]
+ [System.Diagnostics.DebuggerStepThroughAttribute]
+ [System.Diagnostics.DebuggerHiddenAttribute]
+ public static void LateCall (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames, System.Boolean[] CopyBack) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LongType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LongType.cs
new file mode 100644
index 00000000000..e90edd154c6
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LongType.cs
@@ -0,0 +1,26 @@
+//
+// LongType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class LongType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Int64 FromString (System.String Value) { return System.Int64.Parse(Value); }
+ [MonoTODO]
+ public static System.Int64 FromObject (System.Object Value) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
new file mode 100644
index 00000000000..b5ea837a1cb
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
@@ -0,0 +1,60 @@
+//
+// ObjectType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 Tipic, Inc (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class ObjectType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static System.Int32 ObjTst (System.Object o1, System.Object o2, System.Boolean TextCompare) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object PlusObj (System.Object obj) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object NegObj (System.Object obj) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object NotObj (System.Object obj) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object BitAndObj (System.Object obj1, System.Object obj2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object BitOrObj (System.Object obj1, System.Object obj2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object BitXorObj (System.Object obj1, System.Object obj2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object AddObj (System.Object o1, System.Object o2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object SubObj (System.Object o1, System.Object o2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object MulObj (System.Object o1, System.Object o2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object DivObj (System.Object o1, System.Object o2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object PowObj (System.Object obj1, System.Object obj2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object ModObj (System.Object o1, System.Object o2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object IDivObj (System.Object o1, System.Object o2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object XorObj (System.Object obj1, System.Object obj2) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean LikeObj (System.Object vLeft, System.Object vRight, Microsoft.VisualBasic.CompareMethod CompareOption) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object StrCatObj (System.Object vLeft, System.Object vRight) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object GetObjectValuePrimitive (System.Object o) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionCompareAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionCompareAttribute.cs
new file mode 100644
index 00000000000..ab0fbca18cb
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionCompareAttribute.cs
@@ -0,0 +1,32 @@
+//
+// OptionCompareAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Martin Adoue (martin@cwanet.com)
+//
+// (C) 2002 Ximian Inc.
+//
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.VisualBasic.CompilerServices {
+ [MonoTODO]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.Parameter)]
+ [StructLayoutAttribute(LayoutKind.Auto)]
+ sealed public class OptionCompareAttribute : Attribute {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ public OptionCompareAttribute()
+ {
+ //FIXME: should this do something?
+ throw new NotImplementedException();
+ }
+ };
+
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionTextAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionTextAttribute.cs
new file mode 100644
index 00000000000..97ac0cc262f
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionTextAttribute.cs
@@ -0,0 +1,20 @@
+//
+// OptionTextAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic.CompilerServices {
+ [System.AttributeUsageAttribute(System.AttributeTargets.Class)]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [MonoTODO]
+ sealed public class OptionTextAttribute : System.Attribute {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ProjectData.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ProjectData.cs
new file mode 100644
index 00000000000..173b1ac912a
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ProjectData.cs
@@ -0,0 +1,98 @@
+//
+// ProjectData.cs
+//
+// Authors:
+// Martin Adoue (martin@cwanet.com)
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Ximian Inc.
+// 2002 Tipic, Inc. (http://www.tipic.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ /// <summary>
+ /// FIXME: Summary description for ProjectData.
+ /// </summary>
+
+ [MonoTODO]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [StructLayout(LayoutKind.Auto)]
+ public class ProjectData{
+
+ internal static System.Exception projectError;
+ internal static int erl;
+ internal static Microsoft.VisualBasic.ErrObject pErr;
+
+ internal static Microsoft.VisualBasic.ErrObject Err
+ {
+ get
+ {
+ if (pErr==null)
+ pErr=new ErrObject();
+
+ return pErr;
+ }
+ set
+ {
+ pErr = value;
+ }
+ }
+
+ /// <summary>
+ /// FIXME: Summary description for ClearProjectError
+ /// </summary>
+ public static void ClearProjectError()
+ {
+ projectError = null;
+ erl = 0;
+ }
+
+ /// <summary>
+ /// FIXME: Summary description for SetProjectError
+ /// </summary>
+ /// <param name="ex">FIXME: Required. Summary description for ex</param>
+ [MonoTODO]
+ public static void SetProjectError(System.Exception ex)
+ {
+ SetProjectError(ex, 0);
+ }
+
+ /// <summary>
+ /// FIXME: Summary description for SetProjectError
+ /// </summary>
+ /// <param name="ex">FIXME: Required. Summary description for ex</param>
+ /// <param name="lErl">FIXME: Required. Summary description for lErl</param>
+ [MonoTODO]
+ public static void SetProjectError(System.Exception ex, int lErl)
+ {
+ projectError = ex;
+ erl = lErl;
+ Err.SetException (ex);
+ }
+
+ /*
+ [MonoTODO]
+ public static void EndApp()
+ {
+ //FIXME
+ }
+ */
+
+ /*
+ [MonoTODO]
+ protected static void Finalize()
+ {
+ //FIXME
+ }
+ */
+
+
+
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ShortType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ShortType.cs
new file mode 100644
index 00000000000..a06e424af7c
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ShortType.cs
@@ -0,0 +1,26 @@
+//
+// ShortType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ sealed public class ShortType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Int16 FromString (System.String Value) { return System.Int16.Parse(Value); }
+ [MonoTODO]
+ public static System.Int16 FromObject (System.Object Value) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/SingleType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/SingleType.cs
new file mode 100644
index 00000000000..134db71e4d4
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/SingleType.cs
@@ -0,0 +1,30 @@
+//
+// SingleType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class SingleType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.Single FromString (System.String Value) { return System.Single.Parse(Value); }
+ [MonoTODO]
+ public static System.Single FromString (System.String Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Single FromObject (System.Object Value) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Single FromObject (System.Object Value, System.Globalization.NumberFormatInfo NumberFormat) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StandardModuleAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StandardModuleAttribute.cs
new file mode 100644
index 00000000000..0da5cc2b145
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StandardModuleAttribute.cs
@@ -0,0 +1,20 @@
+//
+// StandardModuleAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic.CompilerServices {
+ [System.AttributeUsageAttribute(System.AttributeTargets.Class)]
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)]
+ sealed public class StandardModuleAttribute : System.Attribute {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StaticLocalInitFlag.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StaticLocalInitFlag.cs
new file mode 100644
index 00000000000..42fa6300a68
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StaticLocalInitFlag.cs
@@ -0,0 +1,20 @@
+//
+// StaticLocalInitFlag.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic.CompilerServices {
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)]
+ sealed public class StaticLocalInitFlag {
+ // Declarations
+ public System.Int16 State = (System.Int16)(0);
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StringType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StringType.cs
new file mode 100644
index 00000000000..5da897455e7
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StringType.cs
@@ -0,0 +1,94 @@
+//
+// StringType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// 2002 Tipic, Inc. (http://www.tipic.com)
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class StringType {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ public static System.String FromBoolean (System.Boolean Value) {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromByte (System.Byte Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromChar (System.Char Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromShort (System.Int16 Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromInteger (System.Int32 Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromLong (System.Int64 Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromSingle (System.Single Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromDouble (System.Double Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromSingle (System.Single Value, System.Globalization.NumberFormatInfo NumberFormat)
+ {
+ return Convert.ToString(Value,NumberFormat);
+ }
+ public static System.String FromDouble (System.Double Value, System.Globalization.NumberFormatInfo NumberFormat)
+ {
+ return Convert.ToString(Value,NumberFormat);
+ }
+ public static System.String FromDate (System.DateTime Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromDecimal (System.Decimal Value)
+ {
+ return Convert.ToString(Value);
+ }
+ public static System.String FromDecimal (System.Decimal Value, System.Globalization.NumberFormatInfo NumberFormat)
+ {
+ return Convert.ToString(Value,NumberFormat);
+ }
+ public static System.String FromObject (System.Object Value)
+ {
+ if ((object)Value==null) return "";
+ else return Convert.ToString(Value);
+ }
+ [MonoTODO("Last boolean parameter ignored")]
+ public static System.Int32 StrCmp (System.String sLeft, System.String sRight, System.Boolean TextCompare)
+ {
+ return sLeft.CompareTo(sRight);
+ }
+ [MonoTODO]
+ public static System.Boolean StrLike (System.String Source, System.String Pattern, Microsoft.VisualBasic.CompareMethod CompareOption) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean StrLikeBinary (System.String Source, System.String Pattern) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Boolean StrLikeText (System.String Source, System.String Pattern) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static void MidStmtStr (ref System.String sDest, ref System.Int32 StartPosition, ref System.Int32 MaxInsertLength, ref System.String sInsert) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/TODOAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/TODOAttribute.cs
new file mode 100644
index 00000000000..fe572f886c7
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/TODOAttribute.cs
@@ -0,0 +1,39 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
new file mode 100644
index 00000000000..6d13fa195a2
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
@@ -0,0 +1,31 @@
+//
+// Utils.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic.CompilerServices
+{
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class Utils {
+ // Declarations
+ // Constructors
+ // Properties
+ // Methods
+ [MonoTODO]
+ public static void ThrowException (System.Int32 hr) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Object SetCultureInfo (System.Globalization.CultureInfo Culture) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.Array CopyArray (System.Array arySrc, System.Array aryDest) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public static System.String MethodToString (System.Reflection.MethodBase Method) { throw new NotImplementedException (); }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxResult.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxResult.cs
new file mode 100644
index 00000000000..2f2094c748b
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxResult.cs
@@ -0,0 +1,19 @@
+//
+// MsgBoxResult.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum MsgBoxResult : int {
+ OK = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxStyle.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxStyle.cs
new file mode 100644
index 00000000000..91042bcdb93
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/MsgBoxStyle.cs
@@ -0,0 +1,32 @@
+//
+// MsgBoxStyle.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ [System.FlagsAttribute]
+ public enum MsgBoxStyle : int {
+ ApplicationModal = 0,
+ DefaultButton1 = 0,
+ OKOnly = 0,
+ OKCancel = 1,
+ AbortRetryIgnore = 2,
+ YesNoCancel = 3,
+ YesNo = 4,
+ RetryCancel = 5,
+ Critical = 16,
+ Question = 32,
+ Exclamation = 48,
+ Information = 64,
+ DefaultButton2 = 256,
+ DefaultButton3 = 512,
+ SystemModal = 4096,
+ MsgBoxHelp = 16384,
+ MsgBoxSetForeground = 65536,
+ MsgBoxRight = 524288,
+ MsgBoxRtlReading = 1048576
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenAccess.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenAccess.cs
new file mode 100644
index 00000000000..0db6fd0ccae
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenAccess.cs
@@ -0,0 +1,16 @@
+//
+// OpenAccess.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum OpenAccess : int {
+ Read = 1,
+ Write = 2,
+ ReadWrite = 3,
+ Default = -1
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenMode.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenMode.cs
new file mode 100644
index 00000000000..4374a0bccdc
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenMode.cs
@@ -0,0 +1,17 @@
+//
+// OpenMode.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum OpenMode : int {
+ Input = 1,
+ Output = 2,
+ Random = 4,
+ Append = 8,
+ Binary = 32
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenShare.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenShare.cs
new file mode 100644
index 00000000000..02d828f8188
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/OpenShare.cs
@@ -0,0 +1,17 @@
+//
+// OpenShare.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum OpenShare : int {
+ LockReadWrite = 0,
+ LockWrite = 1,
+ LockRead = 2,
+ Shared = 3,
+ Default = -1
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/SpcInfo.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/SpcInfo.cs
new file mode 100644
index 00000000000..65b3d2bba5c
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/SpcInfo.cs
@@ -0,0 +1,20 @@
+//
+// SpcInfo.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ [MonoTODO]
+ public struct SpcInfo {
+ // Declarations
+ public System.Int16 Count;
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs
new file mode 100644
index 00000000000..77466d775f8
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Strings.cs
@@ -0,0 +1,1124 @@
+//
+// Strings.cs
+//
+// Authors:
+// Martin Adoue (martin@cwanet.com)
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+// Daniel Campos (danielcampos@myway.com)
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) 2002 Ximian Inc.
+// 2002 Tipic, Inc. (http://www.tipic.com)
+//
+
+using System;
+using System.Text;
+using System.ComponentModel;
+
+using System.Runtime.InteropServices;
+using Microsoft.VisualBasic.CompilerServices;
+
+namespace Microsoft.VisualBasic
+{
+ /// <summary>
+ /// The Strings module contains procedures used to perform string operations.
+ /// </summary>
+
+ [StandardModule]
+ [StructLayout(LayoutKind.Auto)]
+ public class Strings
+ {
+ private Strings()
+ {
+ //Do nothing. Nobody should be creating this.
+ }
+
+
+ /// <summary>
+ /// Returns an Integer value representing the character code corresponding to a character.
+ /// </summary>
+ /// <param name="String">Required. Any valid Char or String expression. If String is a String expression, only the first character of the string is used for input. If String is Nothing or contains no characters, an ArgumentException error occurs.</param>
+ [MonoTODO]
+ public static int Asc(char Char)
+ {
+ //FIXME: Check the docs, it says something about Locales, DBCS, etc.
+ return (int)Char;
+ }
+
+
+ /// <summary>
+ /// Returns an Integer value representing the character code corresponding to a character.
+ /// </summary>
+ /// <param name="String">Required. Any valid Char or String expression. If String is a String expression, only the first character of the string is used for input. If String is Nothing or contains no characters, an ArgumentException error occurs.</param>
+ [MonoTODO]
+ public static int Asc(string String)
+ {
+ if ((String == null) || (String.Length < 1))
+ throw new ArgumentException("Length of argument 'String' must be at least one.", "String");
+
+ //FIXME: Check the docs, it says something about Locales, DBCS, etc.
+ return (int) String.ToCharArray(0, 1)[0];
+ //why? check http://bugzilla.ximian.com/show_bug.cgi?id=23540
+ }
+
+
+ /// <summary>
+ /// Returns an Integer value representing the character code corresponding to a character.
+ /// </summary>
+ /// <param name="String">Required. Any valid Char or String expression. If String is a String expression, only the first character of the string is used for input. If String is Nothing or contains no characters, an ArgumentException error occurs.</param>
+ [MonoTODO("Needs testing")]
+ public static int AscW(char String)
+ {
+ /*
+ * AscW returns the Unicode code point for the input character.
+ * This can be 0 through 65535. The returned value is independent
+ * of the culture and code page settings for the current thread.
+ */
+
+ return (int) String;
+ }
+
+ /// <summary>
+ /// Returns an Integer value representing the character code corresponding to a character.
+ /// </summary>
+ /// <param name="String">Required. Any valid Char or String expression. If String is a String expression, only the first character of the string is used for input. If String is Nothing or contains no characters, an ArgumentException error occurs.</param>
+ [MonoTODO("Needs testing")]
+ public static int AscW(string String)
+ {
+ /*
+ * AscW returns the Unicode code point for the input character.
+ * This can be 0 through 65535. The returned value is independent
+ * of the culture and code page settings for the current thread.
+ */
+ if ((String == null) || (String.Length == 0))
+ throw new ArgumentException("Length of argument 'String' must be at leasr one.", "String");
+ return (int) String.ToCharArray(0, 1)[0];
+
+ }
+
+ /// <summary>
+ /// Returns the character associated with the specified character code.
+ /// </summary>
+ /// <param name="CharCode">Required. An Integer expression representing the code point, or character code, for the character. If CharCode is outside the range -32768 through 65535, an ArgumentException error occurs.</param>
+ [MonoTODO]
+ public static char Chr(int CharCode)
+ {
+
+ // According to docs (ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafctchr.htm)
+ // Chr and ChrW should throw ArgumentException if ((CharCode < -32768) || (CharCode > 65535))
+ // Instead, VB.net throws an OverflowException. I'm following the implementation
+ // instead of the docs.
+
+ if ((CharCode < -32768) || (CharCode > 65535))
+ throw new OverflowException("Value was either too large or too small for a character.");
+
+ //FIXME: Check the docs, it says something about Locales, DBCS, etc.
+ return System.Convert.ToChar(CharCode);
+ }
+
+ /// <summary>
+ /// Returns the character associated with the specified character code.
+ /// </summary>
+ /// <param name="CharCode">Required. An Integer expression representing the code point, or character code, for the character. If CharCode is outside the range -32768 through 65535, an ArgumentException error occurs.</param>
+ [MonoTODO("Needs testing")]
+ public static char ChrW(int CharCode )
+ {
+ /*
+ * According to docs ()
+ * Chr and ChrW should throw ArgumentException if ((CharCode < -32768) || (CharCode > 65535))
+ * Instead, VB.net throws an OverflowException. I'm following the implementation
+ * instead of the docs
+ */
+ if ((CharCode < -32768) || (CharCode > 65535))
+ throw new OverflowException("Value was either too large or too small for a character.");
+
+ /*
+ * ChrW takes CharCode as a Unicode code point. The range is independent of the
+ * culture and code page settings for the current thread. Values from -32768 through
+ * -1 are treated the same as values in the range +32768 through +65535.
+ */
+ if (CharCode < 0)
+ CharCode += 0x10000;
+
+ return System.Convert.ToChar(CharCode);
+ }
+
+ /// <summary>
+ /// Returns a zero-based array containing a subset of a String array based on specified filter criteria.
+ /// </summary>
+ /// <param name="Source">Required. One-dimensional array of strings to be searched.</param>
+ /// <param name="Match">Required. String to search for.</param>
+ /// <param name="Include">Optional. Boolean value indicating whether to return substrings that include or exclude Match. If Include is True, the Filter function returns the subset of the array that contains Match as a substring. If Include is False, the Filter function returns the subset of the array that does not contain Match as a substring.</param>
+ /// <param name="Compare">Optional. Numeric value indicating the kind of string comparison to use. See Settings for values.</param>
+ [MonoTODO("Needs testing")]
+ public static string[] Filter(object[] Source,
+ string Match,
+ [Optional]
+ [DefaultValue(true)]
+ bool Include,
+ [OptionCompare] [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+
+ if (Source == null)
+ throw new ArgumentException("Argument 'Source' can not be null.", "Source");
+ if (Source.Rank > 1)
+ throw new ArgumentException("Argument 'Source' can have only one dimension.", "Source");
+
+ string[] strings;
+ strings = new string[Source.Length];
+
+ Source.CopyTo(strings, 0);
+ return Filter(strings, Match, Include, Compare);
+
+ }
+
+ /// <summary>
+ /// Returns a zero-based array containing a subset of a String array based on specified filter criteria.
+ /// </summary>
+ /// <param name="Source">Required. One-dimensional array of strings to be searched.</param>
+ /// <param name="Match">Required. String to search for.</param>
+ /// <param name="Include">Optional. Boolean value indicating whether to return substrings that include or exclude Match. If Include is True, the Filter function returns the subset of the array that contains Match as a substring. If Include is False, the Filter function returns the subset of the array that does not contain Match as a substring.</param>
+ /// <param name="Compare">Optional. Numeric value indicating the kind of string comparison to use. See Settings for values.</param>
+ public static string[] Filter(string[] Source,
+ string Match,
+ [Optional]
+ [DefaultValue(true)]
+ bool Include,
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+
+ if (Source == null)
+ throw new ArgumentException("Argument 'Source' can not be null.", "Source");
+ if (Source.Rank > 1)
+ throw new ArgumentException("Argument 'Source' can have only one dimension.", "Source");
+
+ /*
+ * Well, I don't like it either. But I figured that two iterations
+ * on the array would be better than many aloocations. Besides, this
+ * way I can isolate the special cases.
+ * I'd love to hear from a different approach.
+ */
+
+ int count = Source.Length;
+ bool[] matches = new bool[count];
+ int matchesCount = 0;
+
+ for (int i = 0; i < count; i++)
+ {
+ if (InStr(1, Match, Source[i], Compare) != 0)
+ {
+ //found one more
+ matches[i] = true;
+ matchesCount ++;
+ }
+ else
+ {
+ matches[i] = false;
+ }
+ }
+
+ if (matchesCount == 0)
+ {
+ if (Include)
+ return new string[0];
+ else
+ return Source;
+ }
+ else
+ {
+ if (matchesCount == count)
+ {
+ if (Include)
+ return Source;
+ else
+ return new string[0];
+ }
+ else
+ {
+ string[] ret;
+ int j = 0;
+ if (Include)
+ ret = new string [matchesCount];
+ else
+ ret = new string [count - matchesCount];
+
+ for (int i=0; i < count; i++)
+ {
+ if ((matches[i] && Include) || !(matches[i] || Include))
+ {
+ ret[j] = Source[i];
+ j++;
+ }
+ }
+ return ret;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns a string formatted according to instructions contained in a format String expression.
+ /// </summary>
+ /// <param name="Expression">Required. Any valid expression.</param>
+ /// <param name="Style">Optional. A valid named or user-defined format String expression. </param>
+ [MonoTODO]
+ public static string Format(object Expression,
+ [Optional]
+ [DefaultValue("")]
+ string Style)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ }
+
+
+ /// <summary>
+ /// Returns an expression formatted as a currency value using the currency symbol defined in the system control panel.
+ /// </summary>
+ /// <param name="Expression">Required. Expression to be formatted.</param>
+ /// <param name="NumDigitsAfterDecimal">Optional. Numeric value indicating how many places are displayed to the right of the decimal. Default value is –1, which indicates that the computer's regional settings are used.</param>
+ /// <param name="IncludeLeadingDigit">Optional. Tristate enumeration that indicates whether or not a leading zero is displayed for fractional values. See Settings for values.</param>
+ /// <param name="UseParensForNegativeNumbers">Optional. Tristate enumeration that indicates whether or not to place negative values within parentheses. See Settings for values.</param>
+ /// <param name="GroupDigits">Optional. Tristate enumeration that indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings. See Settings for values.</param>
+ [MonoTODO]
+ public static string FormatCurrency(object Expression,
+ [Optional]
+ [DefaultValue(-1)]
+ int NumDigitsAfterDecimal,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState IncludeLeadingDigit,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState UseParensForNegativeNumbers,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState GroupDigits)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ //throws InvalidCastException
+ //throws ArgumentException
+ }
+
+ /// <summary>
+ /// Returns an expression formatted as a date or time.
+ /// </summary>
+ /// <param name="Expression">Required. Date expression to be formatted. </param>
+ /// <param name="NamedFormat">Optional. Numeric value that indicates the date or time format used. If omitted, GeneralDate is used.</param>
+ [MonoTODO]
+ public static string FormatDateTime(DateTime Expression,
+ [Optional]
+ [DefaultValue(DateFormat.GeneralDate)]
+ DateFormat NamedFormat)
+ {
+ switch(NamedFormat)
+ {
+ case DateFormat.GeneralDate:
+ //FIXME: WTF should I do with it?
+ throw new NotImplementedException();
+ case DateFormat.LongDate:
+ return Expression.ToLongDateString();
+ case DateFormat.ShortDate:
+ return Expression.ToShortDateString();
+ case DateFormat.LongTime:
+ return Expression.ToLongTimeString();
+ case DateFormat.ShortTime:
+ return Expression.ToShortTimeString();
+ default:
+ throw new ArgumentException("Argument 'NamedFormat' must be a member of DateFormat", "NamedFormat");
+ }
+ }
+
+ /// <summary>
+ /// Returns an expression formatted as a number.
+ /// </summary>
+ /// <param name="Expression">Required. Expression to be formatted.</param>
+ /// <param name="NumDigitsAfterDecimal">Optional. Numeric value indicating how many places are displayed to the right of the decimal. Default value is –1, which indicates that the computer's regional settings are used.</param>
+ /// <param name="IncludeLeadingDigit">Optional. Tristate enumeration that indicates whether or not a leading zero is displayed for fractional values. See Settings for values.</param>
+ /// <param name="UseParensForNegativeNumbers">Optional. Tristate enumeration that indicates whether or not to place negative values within parentheses. See Settings for values.</param>
+ /// <param name="GroupDigits">Optional. Tristate enumeration that indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings. See Settings for values.</param>
+ [MonoTODO]
+ public static string FormatNumber(object Expression,
+ [Optional]
+ [DefaultValue(-1)]
+ int NumDigitsAfterDecimal,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState IncludeLeadingDigit,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState UseParensForNegativeNumbers,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState GroupDigits)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ //throws InvalidCastException
+ }
+
+ /// <summary>
+ /// Returns an expression formatted as a percentage (that is, multiplied by 100) with a trailing % character.
+ /// </summary>
+ /// <param name="Expression">Required. Expression to be formatted.</param>
+ /// <param name="NumDigitsAfterDecimal">Optional. Numeric value indicating how many places are displayed to the right of the decimal. Default value is –1, which indicates that the computer's regional settings are used.</param>
+ /// <param name="IncludeLeadingDigit">Optional. Tristate enumeration that indicates whether or not a leading zero is displayed for fractional values. See Settings for values.</param>
+ /// <param name="UseParensForNegativeNumbers">Optional. Tristate enumeration that indicates whether or not to place negative values within parentheses. See Settings for values.</param>
+ /// <param name="GroupDigits">Optional. Tristate enumeration that indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings. See Settings for values.</param>
+ [MonoTODO]
+ public static string FormatPercent(object Expression,
+ [Optional]
+ [DefaultValue(-1)]
+ int NumDigitsAfterDecimal,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState IncludeLeadingDigit,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState UseParensForNegativeNumbers,
+ [Optional]
+ [DefaultValue(TriState.UseDefault)]
+ TriState GroupDigits)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ //throws InvalidCastException
+ }
+
+ /// <summary>
+ /// Returns a Char value representing the character from the specified index in the supplied string.
+ /// </summary>
+ /// <param name="Str">Required. Any valid String expression.</param>
+ /// <param name="Index">Required. Integer expression. The (1-based) index of the character in Str to be returned.</param>
+ [MonoTODO("Needs testing")]
+ public static char GetChar(string Str,
+ int Index)
+ {
+
+ if ((Str == null) || (Str.Length == 0))
+ throw new ArgumentException("Length of argument 'Str' must be greater than zero.", "Sre");
+ if (Index < 1)
+ throw new ArgumentException("Argument 'Index' must be greater than or equal to 1.", "Index");
+ if (Index > Str.Length)
+ throw new ArgumentException("Argument 'Index' must be less than or equal to the length of argument 'String'.", "Index");
+
+ return Str.ToCharArray(Index -1, 1)[0];
+ }
+
+ /// <summary>
+ /// Returns an integer specifying the start position of the first occurrence of one string within another.
+ /// </summary>
+ /// <param name="Start">Required. Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. The start index is 1 based.</param>
+ /// <param name="String1">Required. String expression being searched.</param>
+ /// <param name="String2">Required. String expression sought.</param>
+ /// <param name="Compare">Optional. Specifies the type of string comparison. If Compare is omitted, the Option Compare setting determines the type of comparison. Specify a valid LCID (LocaleID) to use locale-specific rules in the comparison. </param>
+ [MonoTODO("Needs testing")]
+ public static int InStr(string String1,
+ string String2,
+ [OptionCompare]
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+ return InStr(1, String1, String2, Compare);
+ }
+
+ /// <summary>
+ /// Returns an integer specifying the start position of the first occurrence of one string within another.
+ /// </summary>
+ /// <param name="Start">Required. Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. The start index is 1 based.</param>
+ /// <param name="String1">Required. String expression being searched.</param>
+ /// <param name="String2">Required. String expression sought.</param>
+ /// <param name="Compare">Optional. Specifies the type of string comparison. If Compare is omitted, the Option Compare setting determines the type of comparison. Specify a valid LCID (LocaleID) to use locale-specific rules in the comparison. </param>
+ [MonoTODO("Needs testing")]
+ public static int InStr(int Start,
+ string String1,
+ string String2,
+ [OptionCompare]
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+ if (Start < 1)
+ throw new ArgumentException("Argument 'Start' must be non-negative.", "Start");
+
+ /*
+ * FIXME: ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafctinstr.htm
+ * If Compare is omitted, the Option Compare setting determines the type of comparison. Specify
+ * a valid LCID (LocaleID) to use locale-specific rules in the comparison.
+ * How do I do this?
+ */
+
+ /*
+ * If InStr returns
+ *
+ * String1 is zero length or Nothing 0
+ * String2 is zero length or Nothing start
+ * String2 is not found 0
+ * String2 is found within String1 Position where match begins
+ * Start > String2 0
+ */
+
+ //FIXME: someone with a non US setup should test this.
+ switch (Compare)
+ {
+ case CompareMethod.Text:
+ return System.Globalization.CultureInfo.CurrentCulture.CompareInfo.IndexOf(String2, String1, Start - 1) + 1;
+
+ case CompareMethod.Binary:
+ return String1.IndexOf(String2, Start - 1) + 1;
+ default:
+ throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare");
+ }
+
+
+ }
+
+ /// <summary>
+ /// Returns the position of the first occurrence of one string within another, starting from the right side of the string.
+ /// </summary>
+ /// <param name="StringCheck">Required. String expression being searched.</param>
+ /// <param name="StringMatch">Required. String expression being searched for.</param>
+ /// <param name="Start">Optional. Numeric expression that sets the one-based starting position for each search, starting from the left side of the string. If Start is omitted, –1 is used, which means that the search begins at the last character position. Search then proceeds from right to left.</param>
+ /// <param name="Compare">Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. If omitted, a binary comparison is performed. See Settings for values.</param>
+ [MonoTODO]
+ public static int InStrRev(string StringCheck,
+ string StringMatch,
+ string String2,
+ [Optional]
+ [DefaultValue(-1)]
+ int Start,
+ [OptionCompare]
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+ if ((Start == 0) || (Start < -1))
+ throw new ArgumentException("Argument 'Start' must be greater than 0 or equal to -1", "Start");
+
+ //FIXME: Use LastIndexOf()
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Returns a string created by joining a number of substrings contained in an array.
+ /// </summary>
+ /// <param name="SourceArray">Required. One-dimensional array containing substrings to be joined.</param>
+ /// <param name="Delimiter">Optional. String used to separate the substrings in the returned string. If omitted, the space character (" ") is used. If Delimiter is a zero-length string (""), all items in the list are concatenated with no delimiters.</param>
+ [MonoTODO("Needs testing")]
+ public static string Join(string[] SourceArray,
+ [Optional]
+ [DefaultValue(" ")]
+ string Delimiter)
+ {
+ if (SourceArray == null)
+ throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray");
+ if (SourceArray.Rank > 1)
+ throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray");
+
+ return string.Join(Delimiter, SourceArray);
+ }
+ /// <summary>
+ /// Returns a string created by joining a number of substrings contained in an array.
+ /// </summary>
+ /// <param name="SourceArray">Required. One-dimensional array containing substrings to be joined.</param>
+ /// <param name="Delimiter">Optional. String used to separate the substrings in the returned string. If omitted, the space character (" ") is used. If Delimiter is a zero-length string (""), all items in the list are concatenated with no delimiters.</param>
+ [MonoTODO("Needs testing")]
+ public static string Join(object[] SourceArray,
+ [Optional]
+ [DefaultValue(" ")]
+ string Delimiter)
+ {
+
+ if (SourceArray == null)
+ throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray");
+ if (SourceArray.Rank > 1)
+ throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray");
+
+ string[] dest;
+ dest = new string[SourceArray.Length];
+
+ SourceArray.CopyTo(dest, 0);
+ return string.Join(Delimiter, dest);
+ }
+
+ /// <summary>
+ /// Returns a string or character converted to lowercase.
+ /// </summary>
+ /// <param name="Value">Required. Any valid String or Char expression.</param>
+ [MonoTODO("Needs testing")]
+ public static char LCase(char Value)
+ {
+ return char.ToLower(Value);
+ }
+
+ /// <summary>
+ /// Returns a string or character converted to lowercase.
+ /// </summary>
+ /// <param name="Value">Required. Any valid String or Char expression.</param>
+ [MonoTODO("Needs testing")]
+ public static string LCase(string Value)
+ {
+ if ((Value == null) || (Value.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ return Value.ToLower();
+ }
+
+
+ /// <summary>
+ /// Returns a string containing a specified number of characters from the left side of a string.
+ /// </summary>
+ /// <param name="Str">Required. String expression from which the leftmost characters are returned.</param>
+ /// <param name="Length">Required. Integer expression. Numeric expression indicating how many characters to return. If 0, a zero-length string ("") is returned. If greater than or equal to the number of characters in Str, the entire string is returned.</param>
+ [MonoTODO]
+ public static string Left(string Str,
+ int Length)
+ {
+ if (Length < 0)
+ throw new ArgumentException("Argument 'Length' must be non-negative.", "Length");
+ if ((Str == null) || (Str.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ return Str.Substring(0, Length);
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(bool Expression)
+ {
+ return 2; //sizeof(bool)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(byte Expression)
+ {
+ return 1; //sizeof(byte)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(char Expression)
+ {
+ return 2; //sizeof(char)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(double Expression)
+ {
+ return 8; //sizeof(double)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(int Expression)
+ {
+ return 4; //sizeof(int)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(long Expression)
+ {
+ return 8; //sizeof(long)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO]
+ public static int Len(object Expression)
+ {
+ // FIXME:
+ // With user-defined types and Object variables, the Len function returns the size as it will
+ // be written to the file. If an Object contains a String, it will return the length of the string.
+ // If an Object contains any other type, it will return the size of the object as it will be written
+ // to the file.
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(short Expression)
+ {
+ return 2; //sizeof(short)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(Single Expression)
+ {
+ return 4; //sizeof(Single)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(string Expression)
+ {
+ return Expression.Length; //length of the string
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(DateTime Expression)
+ {
+ return 8; //sizeof(DateTime)
+ }
+
+ /// <summary>
+ /// Returns an integer containing either the number of characters in a string or the number of bytes required to store a variable.
+ /// </summary>
+ /// <param name="Expression">Any valid String expression or variable name. If Expression is of type Object, the Len function returns the size as it will be written to the file.</param>
+ [MonoTODO("Needs testing")]
+ public static int Len(decimal Expression)
+ {
+ return 16; //sizeof(decimal)
+ }
+
+ /// <summary>
+ /// Returns a left-aligned string containing the specified string adjusted to the specified length.
+ /// </summary>
+ /// <param name="Source">Required. String expression. Name of string variable.</param>
+ /// <param name="Length">Required. Integer expression. Length of returned string.</param>
+ [MonoTODO("Needs testing")]
+ public static string LSet(string Source,
+ int Length)
+ {
+ if (Length < 0)
+ throw new ArgumentOutOfRangeException("Length", "Length must be must be non-negative.");
+ if (Source == null)
+ Source = String.Empty;
+
+ return Source.PadRight(Length);
+ }
+
+ /// <summary>
+ /// Returns a string containing a copy of a specified string with no leading spaces.
+ /// </summary>
+ /// <param name="Str">Required. Any valid String expression.</param>
+ [MonoTODO("Needs testing")]
+ public static string LTrim(string Str)
+ {
+ if ((Str == null) || (Str.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ return Str.TrimStart(null);
+ }
+
+ /// <summary>
+ /// Returns a string containing a copy of a specified string with no trailing spaces.
+ /// </summary>
+ /// <param name="Str">Required. Any valid String expression.</param>
+ [MonoTODO("Needs testing")]
+ public static string RTrim(string Str)
+ {
+ if ((Str == null) || (Str.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ return Str.TrimEnd(null);
+ }
+
+ /// <summary>
+ /// Returns a string containing a copy of a specified string with no leading or trailing spaces.
+ /// </summary>
+ /// <param name="Str">Required. Any valid String expression.</param>
+ [MonoTODO("Needs testing")]
+ public static string Trim(string Str)
+ {
+ if ((Str == null) || (Str.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ return Str.Trim();
+ }
+
+ /// <summary>
+ /// Returns a string containing a specified number of characters from a string.
+ /// </summary>
+ /// <param name="Str">Required. String expression from which characters are returned.</param>
+ /// <param name="Start">Required. Integer expression. Character position in Str at which the part to be taken starts. If Start is greater than the number of characters in Str, the Mid function returns a zero-length string (""). Start is one based.</param>
+ /// <param name="Length">Required Integer expression. Number of characters to return. If there are fewer than Length characters in the text (including the character at position Start), all characters from the start position to the end of the string are returned.</param>
+ [MonoTODO("Verify if this is the correct behaviour for Length==0...[Rafael]")]
+ public static string Mid(string Str,
+ int Start,
+ int Length)
+ {
+
+ if (Length < 0)
+ throw new System.ArgumentException("Argument 'Length' must be greater or equal to zero.", "Length");
+ if (Start <= 0)
+ throw new System.ArgumentException("Argument 'Start' must be greater than zero.", "Start");
+ if ((Str == null) || (Str.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ if ((Length == 0) || (Start > Str.Length))
+ return String.Empty;
+
+ if (Length > (Str.Length - Start))
+ Length = (Str.Length - Start) + 1;
+
+ return Str.Substring(Start - 1, Length);
+
+ }
+
+ /// <summary>
+ /// Returns a string containing all characters from a string beyond an start point.
+ /// </summary>
+ /// <param name="Str">Required. String expression from which characters are returned.</param>
+ /// <param name="Start">Required. Integer expression. Character position in Str at which the part to be taken starts. If Start is greater than the number of characters in Str, the Mid function returns a zero-length string (""). Start is one based.</param>
+ [MonoTODO("Needs testing")]
+ public static string Mid (string Str, int Start)
+ {
+ if (Start <= 0)
+ throw new System.ArgumentException("Argument 'Start' must be greater than zero.", "Start");
+ if ((Str == null) || (Str.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ if (Start > Str.Length)
+ return String.Empty;
+
+ return Str.Substring(Start - 1);
+ }
+
+ /// <summary>
+ /// Returns a string in which a specified substring has been replaced with another substring a specified number of times.
+ /// </summary>
+ /// <param name="Expression">Required. String expression containing substring to replace.</param>
+ /// <param name="Find">Required. Substring being searched for.</param>
+ /// <param name="Replacement">Required. Replacement substring.</param>
+ /// <param name="Start">Optional. Position within Expression where substring search is to begin. If omitted, 1 is assumed.</param>
+ /// <param name="Count">Optional. Number of substring substitutions to perform. If omitted, the default value is –1, which means make all possible substitutions.</param>
+ /// <param name="Compare">Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings for values.</param>
+ [MonoTODO("Needs testing")]
+ public static string Replace(string Expression,
+ string Find,
+ string Replacement,
+ [Optional]
+ [DefaultValue(1)]
+ int Start,
+ [Optional]
+ [DefaultValue(-1)]
+ int Count,
+ [OptionCompare]
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+
+ if (Count < -1)
+ throw new ArgumentException("Argument 'Count' must be greater than or equal to -1.", "Count");
+ if (Start <= 0)
+ throw new ArgumentException("Argument 'Start' must be greater than zero.", "Start");
+
+ if ((Expression == null) || (Expression.Length == 0))
+ return String.Empty; // VB.net does this.
+ if ((Find == null) || (Find.Length == 0))
+ return Expression; // VB.net does this.
+ if (Replacement == null)
+ Replacement = String.Empty; // VB.net does this.
+
+ return Expression.Replace(Find, Replacement);
+ }
+
+ /// <summary>
+ /// Returns a string containing a specified number of characters from the right side of a string.
+ /// </summary>
+ /// <param name="Str">Required. String expression from which the rightmost characters are returned.</param>
+ /// <param name="Length">Required. Integer. Numeric expression indicating how many characters to return. If 0, a zero-length string ("") is returned. If greater than or equal to the number of characters in Str, the entire string is returned.</param>
+ [MonoTODO("Needs testing")]
+ public static string Right(string Str,
+ int Length)
+ {
+ if (Length < 0)
+ throw new ArgumentException("Argument 'Length' must be greater or equal to zero.", "Length");
+
+ return Str.Substring (Str.Length - Length);
+ }
+
+ /// <summary>
+ /// Returns a right-aligned string containing the specified string adjusted to the specified length.
+ /// </summary>
+ /// <param name="Source">Required. String expression. Name of string variable.</param>
+ /// <param name="Length">Required. Integer expression. Length of returned string.</param>
+ [MonoTODO("Needs testing")]
+ public static string RSet(string Source,
+ int Length)
+ {
+
+ if (Source == null)
+ Source = String.Empty;
+ if (Length < 0)
+ throw new ArgumentOutOfRangeException("Length", "Length must be non-negative.");
+
+ return Source.PadLeft(Length);
+ }
+
+ /// <summary>
+ /// Returns a string consisting of the specified number of spaces.
+ /// </summary>
+ /// <param name="Number">Required. Integer expression. The number of spaces you want in the string.</param>
+ [MonoTODO("Needs testing")]
+ public static string Space(int Number)
+ {
+ if (Number < 0)
+ throw new ArgumentException("Argument 'Number' must be greater or equal to zero.", "Number");
+
+ return new string((char) ' ', Number);
+ }
+
+ /// <summary>
+ /// Returns a zero-based, one-dimensional array containing a specified number of substrings.
+ /// </summary>
+ /// <param name="Expression">Required. String expression containing substrings and delimiters. If Expression is a zero-length string (""), the Split function returns an array with no elements and no data.</param>
+ /// <param name="Delimiter">Optional. Single character used to identify substring limits. If Delimiter is omitted, the space character (" ") is assumed to be the delimiter. If Delimiter is a zero-length string, a single-element array containing the entire Expression string is returned.</param>
+ /// <param name="Limit">Optional. Number of substrings to be returned; the default, –1, indicates that all substrings are returned.</param>
+ /// <param name="Compare">Optional. Numeric value indicating the comparison to use when evaluating substrings. See Settings for values.</param>
+ [MonoTODO]
+ public static string[] Split(string Expression,
+ [Optional]
+ [DefaultValue(" ")]
+ string Delimiter,
+ [Optional]
+ [DefaultValue(-1)]
+ int Limit,
+ [OptionCompare]
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+
+
+ if (Expression == null)
+ return new string[0];
+ if ((Delimiter == null) || (Delimiter.Length == 0))
+ {
+ string [] ret = new string[0];
+ ret[0] = Expression;
+ return ret;
+ }
+ if (Limit == 0)
+ Limit = 1; // VB.net does this. I call it a bug.
+
+ /*
+ * FIXME: VB.net does NOT do this. It simply fails with AritmethicException.
+ * What should I do?
+ */
+ if (Limit < -1)
+ throw new ArgumentOutOfRangeException("Limit", "Argument 'Limit' must be -1 or greater than zero.");
+
+ switch (Compare)
+ {
+ case CompareMethod.Binary:
+ return Expression.Split(Delimiter.ToCharArray(0, 1), Limit);
+ case CompareMethod.Text:
+ //FIXME
+ throw new NotImplementedException();
+ default:
+ throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare");
+ }
+
+
+ }
+
+ /// <summary>
+ /// Returns -1, 0, or 1, based on the result of a string comparison.
+ /// </summary>
+ /// <param name="String1">Required. Any valid String expression.</param>
+ /// <param name="String2">Required. Any valid String expression.</param>
+ /// <param name="Compare">Optional. Specifies the type of string comparison. If compare is omitted, the Option Compare setting determines the type of comparison.</param>
+ [MonoTODO("Needs testing")]
+ public static int StrComp(string String1,
+ string String2,
+ [OptionCompare]
+ [Optional]
+ [DefaultValue(CompareMethod.Binary)]
+ CompareMethod Compare)
+ {
+
+ switch (Compare)
+ {
+ case CompareMethod.Binary:
+ return string.Compare(String1, String2, true);
+ case CompareMethod.Text:
+ //FIXME: someone with a non US setup should test this.
+ return System.Globalization.CultureInfo.CurrentCulture.CompareInfo.Compare(String1, String2);
+ default:
+ throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text", "Compare");
+ }
+
+ }
+
+ /// <summary>
+ /// Returns a string converted as specified.
+ /// </summary>
+ /// <param name="Str">Required. String expression to be converted.</param>
+ /// <param name="Conversion">Required. VbStrConv member. The enumeration value specifying the type of conversion to perform. </param>
+ /// <param name="LocaleID">Optional. The LocaleID value, if different from the system LocaleID value. (The system LocaleID value is the default.)</param>
+ [MonoTODO("Not impemented")]
+ public static string StrConv (string str,
+ VbStrConv Conversion,
+ [Optional]
+ [DefaultValue(0)]
+ int LocaleID)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ //throws ArgumentException
+ }
+
+ /// <summary>
+ /// Returns a string or object consisting of the specified character repeated the specified number of times.
+ /// </summary>
+ /// <param name="Number">Required. Integer expression. The length to the string to be returned.</param>
+ /// <param name="Character">Required. Any valid Char, String, or Object expression. Only the first character of the expression will be used. If Character is of type Object, it must contain either a Char or a String value.</param>
+ [MonoTODO("Needs testing")]
+ public static string StrDup(int Number,
+ char Character)
+ {
+ if (Number < 0)
+ throw new ArgumentException("Argument 'Number' must be non-negative.", "Number");
+
+ return new string(Character, Number);
+ }
+ /// <summary>
+ /// Returns a string or object consisting of the specified character repeated the specified number of times.
+ /// </summary>
+ /// <param name="Number">Required. Integer expression. The length to the string to be returned.</param>
+ /// <param name="Character">Required. Any valid Char, String, or Object expression. Only the first character of the expression will be used. If Character is of type Object, it must contain either a Char or a String value.</param>
+ [MonoTODO("Needs testing")]
+ public static string StrDup(int Number,
+ string Character)
+ {
+ if (Number < 0)
+ throw new ArgumentException("Argument 'Number' must be greater or equal to zero.", "Number");
+ if ((Character == null) || (Character.Length == 0))
+ throw new ArgumentNullException("Character", "Length of argument 'Character' must be greater than zero.");
+
+ return new string(Character.ToCharArray()[0], Number);
+ }
+
+ /// <summary>
+ /// Returns a string or object consisting of the specified character repeated the specified number of times.
+ /// </summary>
+ /// <param name="Number">Required. Integer expression. The length to the string to be returned.</param>
+ /// <param name="Character">Required. Any valid Char, String, or Object expression. Only the first character of the expression will be used. If Character is of type Object, it must contain either a Char or a String value.</param>
+ [MonoTODO("Needs testing")]
+ public static object StrDup(int Number,
+ object Character)
+ {
+ if (Number < 0)
+ throw new ArgumentException("Argument 'Number' must be non-negative.", "Number");
+
+ if (Character is string)
+ {
+ string sCharacter = (string) Character;
+ if ((sCharacter == null) || (sCharacter.Length == 0))
+ throw new ArgumentNullException("Character", "Length of argument 'Character' must be greater than zero.");
+
+ return StrDup(Number, sCharacter);
+ }
+ else
+ {
+ if (Character is char)
+ {
+ return StrDup(Number, (char) Character);
+ }
+ else
+ {
+ // "If Character is of type Object, it must contain either a Char or a String value."
+ throw new ArgumentException("Argument 'Character' is not a valid value.", "Character");
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns a string in which the character order of a specified string is reversed.
+ /// </summary>
+ /// <param name="Expression">Required. String expression whose characters are to be reversed. If Expression is a zero-length string (""), a zero-length string is returned.</param>
+ public static string StrReverse(string Expression)
+ {
+ // patched by Daniel Campos
+ // danielcampos@myway.com
+ if (Expression != null)
+ {
+ if ( Expression.Length>0)
+ {
+ int counter=0;
+ char[] buf=new char[Expression.Length];
+
+ for (int backwardsCounter=Expression.Length - 1;
+ backwardsCounter>=0;
+ backwardsCounter--)
+ buf[counter++]=Expression[backwardsCounter];
+ return new string(buf);
+ }
+ else
+ return String.Empty;
+ }
+ else
+ return String.Empty;
+ }
+
+ /// <summary>
+ /// Returns a string or character containing the specified string converted to uppercase.
+ /// </summary>
+ /// <param name="Value">Required. Any valid String or Char expression.</param>
+ public static char UCase(char Value)
+ {
+ return char.ToUpper(Value);
+ }
+
+ /// <summary>
+ /// Returns a string or character containing the specified string converted to uppercase.
+ /// </summary>
+ /// <param name="Value">Required. Any valid String or Char expression.</param>
+ public static string UCase(string Value)
+ {
+ if ((Value == null) || (Value.Length == 0))
+ return String.Empty; // VB.net does this.
+
+ return Value.ToUpper();
+ }
+
+
+
+ }
+
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TODOAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TODOAttribute.cs
new file mode 100644
index 00000000000..a38969af212
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TODOAttribute.cs
@@ -0,0 +1,39 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace Microsoft.VisualBasic {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TabInfo.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TabInfo.cs
new file mode 100644
index 00000000000..d14dd2f0b03
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TabInfo.cs
@@ -0,0 +1,23 @@
+//
+// TabInfo.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+
+namespace Microsoft.VisualBasic {
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [MonoTODO]
+ public struct TabInfo {
+ // Declarations
+ public System.Int16 Column;
+ // Constructors
+ // Properties
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TriState.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TriState.cs
new file mode 100644
index 00000000000..9773ea3552e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/TriState.cs
@@ -0,0 +1,19 @@
+//
+// TriState.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ /// <summary>
+ /// When you call number-formatting functions, you can use the following enumeration
+ /// members in your code in place of the actual values.
+ /// </summary>
+ public enum TriState : int {
+ False = 0,
+ UseDefault = -2,
+ True = -1
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedArrayAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedArrayAttribute.cs
new file mode 100644
index 00000000000..dbc879b4e2e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedArrayAttribute.cs
@@ -0,0 +1,30 @@
+//
+// VBFixedArrayAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ [System.AttributeUsageAttribute(System.AttributeTargets.Field)]
+ sealed public class VBFixedArrayAttribute : System.Attribute {
+ // Declarations
+ // Constructors
+ [MonoTODO]
+ VBFixedArrayAttribute(System.Int32 UpperBound1) { throw new NotImplementedException (); }
+ [MonoTODO]
+ VBFixedArrayAttribute(System.Int32 UpperBound1, System.Int32 UpperBound2) { throw new NotImplementedException (); }
+ // Properties
+ [MonoTODO]
+ public System.Int32 Length { get { throw new NotImplementedException (); } }
+ [MonoTODO]
+ public System.Int32[] Bounds { get { throw new NotImplementedException (); } }
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedStringAttribute.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedStringAttribute.cs
new file mode 100644
index 00000000000..c4de1009ebd
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBFixedStringAttribute.cs
@@ -0,0 +1,26 @@
+//
+// VBFixedStringAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ [System.AttributeUsageAttribute(System.AttributeTargets.Field)]
+ sealed public class VBFixedStringAttribute : System.Attribute {
+ // Declarations
+ // Constructors
+ [MonoTODO]
+ VBFixedStringAttribute(System.Int32 Length) { throw new NotImplementedException (); }
+ // Properties
+ [MonoTODO]
+ public System.Int32 Length { get { throw new NotImplementedException (); } }
+ // Methods
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBMath.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBMath.cs
new file mode 100644
index 00000000000..f7ab89abb93
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VBMath.cs
@@ -0,0 +1,53 @@
+//
+// VBMath.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+// Francesco Delfino (pluto@tipic.com)
+//
+// (C) 2002 Chris J Breisch
+// (C) 2002 Tipic Inc
+//
+
+using System;
+
+namespace Microsoft.VisualBasic {
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ sealed public class VBMath {
+ // Declarations
+ // Constructors
+ // Properties
+ static Random rnd = new Random();
+ static float last = (float)rnd.NextDouble();
+ // Methods
+ public static float Rnd () {
+ last = (float)rnd.NextDouble();
+ return last;
+ }
+ public static float Rnd (float Number)
+ {
+ if (Number == 0.0)
+ {
+ return last;
+ }
+ else if (Number < 0.0 )
+ {
+ //fd: What does this mean?
+ //fd: ms-help://MS.VSCC/MS.MSDNVS/script56/html/vsstmRandomize
+ //fd: ms-help://MS.VSCC/MS.MSDNVS/script56/html/vsfctrnd.htm
+ Randomize(Number);
+ return Rnd();
+ }
+ return Rnd();
+ }
+ public static void Randomize () {
+ rnd = new Random();
+ }
+ [MonoTODO("Rethink the double => int conversion")]
+ public static void Randomize (double Number)
+ {
+ rnd = new Random((int)Number);
+ }
+ // Events
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VariantType.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VariantType.cs
new file mode 100644
index 00000000000..7eab4e4c86a
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VariantType.cs
@@ -0,0 +1,32 @@
+//
+// VariantType.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace Microsoft.VisualBasic {
+ public enum VariantType : int {
+ Empty = 0,
+ Null = 1,
+ Short = 2,
+ Integer = 3,
+ Single = 4,
+ Double = 5,
+ Currency = 6,
+ Date = 7,
+ String = 8,
+ Object = 9,
+ Error = 10,
+ Boolean = 11,
+ Variant = 12,
+ DataObject = 13,
+ Decimal = 14,
+ Byte = 17,
+ Char = 18,
+ Long = 20,
+ UserDefinedType = 36,
+ Array = 8192
+ };
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VbStrConv.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VbStrConv.cs
new file mode 100644
index 00000000000..a61d2db79da
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/VbStrConv.cs
@@ -0,0 +1,73 @@
+//
+// VbStrConv.cs
+//
+// Authors:
+// Martin Adoue (martin@cwanet.com)
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Ximian Inc.
+//
+
+using System;
+
+namespace Microsoft.VisualBasic
+{
+ /// <summary>
+ /// When you call the StrConv function, you can use the following enumeration
+ /// members in your code in place of the actual values.
+ /// </summary>
+ [System.FlagsAttribute]
+ public enum VbStrConv : int {
+ /// <summary>
+ /// Performs no conversion
+ /// </summary>
+ None = 0,
+ /// <summary>
+ /// Uses linguistic rules for casing, rather than File System (default). Valid with UpperCase and LowerCase only.
+ /// </summary>
+ LinguisticCasing = 1024,
+ /// <summary>
+ /// Converts the string to uppercase characters.
+ /// </summary>
+ UpperCase = 1,
+ /// <summary>
+ /// Converts the string to lowercase characters.
+ /// </summary>
+ LowerCase = 2,
+ /// <summary>
+ /// Converts the first letter of every word in string to uppercase.
+ /// </summary>
+ ProperCase = 3,
+ /// <summary>
+ /// Converts narrow (half-width) characters in the string to wide (full-width) characters. (Applies to Asian locales.)
+ /// </summary>
+ Wide = 4, //*
+ /// <summary>
+ /// Converts wide (full-width) characters in the string to narrow (half-width) characters. (Applies to Asian locales.)
+ /// </summary>
+ Narrow = 8, //*
+ /// <summary>
+ /// Converts Hiragana characters in the string to Katakana characters. (Applies to Japan only.)
+ /// </summary>
+ Katakana = 16, //**
+ /// <summary>
+ /// Converts Katakana characters in the string to Hiragana characters. (Applies to Japan only.)
+ /// </summary>
+ Hiragana = 32, //**
+ /// <summary>
+ /// Converts Traditional Chinese characters to Simplified Chinese. (Applies to Asian locales.)
+ /// </summary>
+ SimplifiedChinese =256, //*
+ /// <summary>
+ /// Converts Simplified Chinese characters to Traditional Chinese. (Applies to Asian locales.)
+ /// </summary>
+ TraditionalChinese = 512 //*
+ /*
+
+ * Applies to Asian locales.
+ ** Applies to Japan only.
+
+ */
+ }
+
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/.cvsignore b/mcs/class/Microsoft.VisualBasic/Test/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/Microsoft.VisualBasic/Test/AllTests.cs b/mcs/class/Microsoft.VisualBasic/Test/AllTests.cs
new file mode 100644
index 00000000000..ba8e35d1604
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/AllTests.cs
@@ -0,0 +1,33 @@
+// MonoTests.AllTests, Microsoft.VisualBasic.dll
+//
+// Author:
+// Mario Martinez (mariom925@home.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+
+namespace MonoTests
+{
+ /// <summary>
+ /// Combines all unit tests for the Microsoft.VisualBasic.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests(string name) : base(name) {}
+ public AllTests() : base("Microsoft.VisualBasic.AllTests") {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (Microsoft.VisualBasic.CollectionTest.Suite);
+ suite.AddTest (Microsoft.VisualBasic.ConversionTest.Suite);
+ suite.AddTest (Microsoft.VisualBasic.DateAndTimeTest.Suite);
+
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/ChangeLog b/mcs/class/Microsoft.VisualBasic/Test/ChangeLog
new file mode 100644
index 00000000000..b558398f96d
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/ChangeLog
@@ -0,0 +1,8 @@
+2002/10/28 Nick Drochak <ndrochak@gol.com>
+
+ * DateAndTimeTest.cs: Make tests pass on Windows with .NET
+
+2002-10-23 Nick Drochak <ndrochak@gol.com>
+
+ * DateAndTimeTest.cs: Try to set the culture for these tests and see
+ if that helps. All but one works on my machine.
diff --git a/mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs b/mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs
new file mode 100644
index 00000000000..457bc821b75
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs
@@ -0,0 +1,535 @@
+// Collection.cs - NUnit Test Cases for Microsoft.VisualBasic.Collection
+//
+// Author:
+// Chris J. Breisch (cjbreisch@altavista.net)
+//
+// (C) Chris J. Breisch
+//
+
+using NUnit.Framework;
+using System;
+using Microsoft.VisualBasic;
+using System.Collections;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+
+ public class CollectionTest : TestCase
+ {
+
+ public CollectionTest() : base ("Microsoft.VisualBasic.Collection") {}
+ public CollectionTest(string name) : base(name) {}
+
+ protected override void SetUp() {}
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(CollectionTest));
+ }
+ }
+
+ // Test Constructor
+ public void TestNew ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ AssertNotNull("#N01", c);
+ AssertEquals("#N02", 0, c.Count);
+ }
+
+ // Test Add method with Key == null
+ public void TestAddNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+
+ AssertEquals("#ANK01", 3, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#ANK02", typeof(string), c[3]);
+
+ }
+
+ // Test Add method with Key specified
+ public void TestAddKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", null, null);
+ c.Add("Basketball", "Basket", null, null);
+ c.Add("Volleyball", "Volley", null, null);
+
+ AssertEquals("#AK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#AK02", "Baseball", c[1]);
+ AssertEquals("#AK03", "Volleyball", c["Volley"]);
+
+ }
+
+ // Test Add method with Before specified and Key == null
+ public void TestAddBeforeNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, 1, null);
+ c.Add(typeof(string), null, 2, null);
+ c.Add(typeof(object), null, 2, null);
+
+ AssertEquals("#ABNK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#ABNK02", typeof(int), c[4]);
+ AssertEquals("#ABNK03", typeof(double), c[1]);
+ AssertEquals("#ABNK04", typeof(object), c[2]);
+
+ }
+
+ // Test Add method with Before and Key
+ public void TestAddBeforeKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", 1, null);
+ c.Add("Basketball", "Basket", 1, null);
+ c.Add("Volleyball", "Volley", 3, null);
+
+ AssertEquals("#ABK01", 4, c.Count);
+ AssertEquals("#ABK02", "Basketball", c[1]);
+ AssertEquals("#ABK03", "Baseball", c[4]);
+ AssertEquals("#ABK04", "Volleyball", c["Volley"]);
+ AssertEquals("#ABK05", "Football", c["Foot"]);
+
+ }
+
+ // Test Add method with After specified and Key == null
+ public void TestAddAfterNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, 0);
+ c.Add(typeof(double), null, null, 1);
+ c.Add(typeof(string), null, null, 1);
+ c.Add(typeof(object), null, null, 3);
+
+ AssertEquals("#AANK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#AANK02", typeof(object), c[4]);
+ AssertEquals("#AANK03", typeof(int), c[1]);
+ AssertEquals("#AANK04", typeof(string), c[2]);
+
+ }
+
+ // Test Add method with After and Key
+ public void TestAddAfterKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, 0);
+ c.Add("Football", "Foot", null, 1);
+ c.Add("Basketball", "Basket", null, 1);
+ c.Add("Volleyball", "Volley", null, 2);
+
+ AssertEquals("#AAK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#AAK02", "Baseball", c[1]);
+ AssertEquals("#AAK03", "Football", c[4]);
+ AssertEquals("#AAK04", "Basketball", c["Basket"]);
+ AssertEquals("#AAK05", "Volleyball", c["Volley"]);
+ }
+
+ // Test GetEnumerator method
+ public void TestGetEnumerator ()
+ {
+ Collection c;
+ IEnumerator e;
+ object[] o = new object[4] {typeof(int),
+ typeof(double), typeof(string), typeof(object)};
+ int i = 0;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+ c.Add(typeof(object), null, null, null);
+
+ e = c.GetEnumerator();
+
+ AssertNotNull("#GE01", e);
+
+ while (e.MoveNext()) {
+ AssertEquals("#GE02." + i.ToString(), o[i], e.Current);
+ i++;
+ }
+
+ e.Reset();
+ e.MoveNext();
+
+ AssertEquals("#GE03", o[0], e.Current);
+
+ }
+
+ // Test GetEnumerator method again, this time using foreach
+ public void Testforeach ()
+ {
+ Collection c;
+ object[] o = new object[4] {typeof(int),
+ typeof(double), typeof(string), typeof(object)};
+ int i = 0;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+ c.Add(typeof(object), null, null, null);
+
+
+ foreach (object item in c) {
+ AssertEquals("#fe01." + i.ToString(), o[i], item);
+ i++;
+ }
+
+ }
+
+ // Test Remove method with Index
+ public void TestRemoveNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+ c.Add(typeof(object), null, null, null);
+
+ AssertEquals("#RNK01", 4, c.Count);
+
+ c.Remove(3);
+
+ AssertEquals("#RNK02", 3, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#RNK03", typeof(object), c[3]);
+
+ c.Remove(1);
+
+ AssertEquals("#RNK04", 2, c.Count);
+ AssertEquals("#RNK05", typeof(double), c[1]);
+ AssertEquals("#RNK06", typeof(object), c[2]);
+
+ c.Remove(2);
+
+ AssertEquals("#RNK07", 1, c.Count);
+ AssertEquals("#RNK08", typeof(double), c[1]);
+
+ c.Remove(1);
+
+ AssertEquals("#RNK09", 0, c.Count);
+
+ }
+
+ // Test Remove method with Key
+ public void TestRemoveKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", null, null);
+ c.Add("Basketball", "Basket", null, null);
+ c.Add("Volleyball", "Volley", null, null);
+
+ AssertEquals("#RK01", 4, c.Count);
+
+ c.Remove("Foot");
+
+ AssertEquals("#RK02", 3, c.Count);
+ AssertEquals("#RK03", "Basketball", c["Basket"]);
+
+ // Collection class is 1-based
+ AssertEquals("#RK04", "Volleyball", c[3]);
+
+ c.Remove("Base");
+
+ AssertEquals("#RK05", 2, c.Count);
+ AssertEquals("#RK06", "Basketball", c[1]);
+ AssertEquals("#RK07", "Volleyball", c["Volley"]);
+
+ c.Remove(2);
+
+ AssertEquals("#RK08", 1, c.Count);
+ AssertEquals("#RK09", "Basketball", c[1]);
+ AssertEquals("#RK10", "Basketball", c["Basket"]);
+
+ c.Remove(1);
+
+ AssertEquals("#RK11", 0, c.Count);
+ }
+
+ // Test all the Exceptions we're supposed to throw
+ public void TestException ()
+ {
+ Collection c;
+ bool caughtException = false;
+
+ c = new Collection();
+
+ try {
+ // nothing in Collection yet
+ object o = c[0];
+ }
+ catch (Exception e) {
+ AssertEquals("#E01", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E02", true, caughtException);
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", null, null);
+ c.Add("Basketball", "Basket", null, null);
+ c.Add("Volleyball", "Volley", null, null);
+
+ caughtException = false;
+
+ try {
+ // only 4 elements
+ object o = c[5];
+ }
+ catch (Exception e) {
+ AssertEquals("#E03", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Collection class is 1-based
+ object o = c[0];
+ }
+ catch (Exception e) {
+ AssertEquals("#E05", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E06", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // no member with Key == "Kick"
+ object o = c["Kick"];
+ }
+ catch (Exception e) {
+ // FIXME
+ // VB Language Reference says IndexOutOfRangeException
+ // here, but MS throws ArgumentException
+ // AssertEquals("#E07", typeof(IndexOutOfRangeException), e.GetType());
+ AssertEquals("#E07", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E08", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Even though Indexer is an object, really it's a string
+ object o = c[typeof(int)];
+ }
+ catch (Exception e) {
+ AssertEquals("#E09", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E10", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // can't specify both Before and After
+ c.Add("Kickball", "Kick", "Volley", "Foot");
+ }
+ catch (Exception e) {
+ AssertEquals("#E11", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E12", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Key "Foot" already exists
+ c.Add("Kickball", "Foot", null, null);
+ }
+ catch (Exception e) {
+ AssertEquals("#E13", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E14", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Even though Before is object, it's really a string
+ c.Add("Dodgeball", "Dodge", typeof(int), null);
+ }
+ catch (Exception e) {
+ AssertEquals("#E15", typeof(InvalidCastException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E16", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Even though After is object, it's really a string
+ c.Add("Wallyball", "Wally", null, typeof(int));
+ }
+ catch (Exception e) {
+ AssertEquals("#E17", typeof(InvalidCastException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E18", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // have to pass a legitimate value to remove
+ c.Remove(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#E19", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E20", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // no Key "Golf" exists
+ c.Remove("Golf");
+ }
+ catch (Exception e) {
+ AssertEquals("#E21", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E22", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // no Index 10 exists
+ c.Remove(10);
+ }
+ catch (Exception e) {
+ AssertEquals("#E23", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E24", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ IEnumerator e = c.GetEnumerator();
+
+ // Must MoveNext before Current
+ object item = e.Current;
+ }
+ catch (Exception e) {
+ // FIXME
+ // On-line help says InvalidOperationException here,
+ // but MS throws IndexOutOfRangeException
+ // AssertEquals("#E25", typeof(InvalidOperationException), e.GetType());
+ AssertEquals("#E25", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E26", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ IEnumerator e = c.GetEnumerator();
+ e.MoveNext();
+
+ c.Add("Paintball", "Paint", null, null);
+
+ // Can't MoveNext if Collection has been modified
+ e.MoveNext();
+ }
+ catch (Exception e) {
+ // FIXME
+ // On-line help says this should throw an error. MS doesn't.
+ AssertEquals("#E27", typeof(InvalidOperationException), e.GetType());
+ caughtException = true;
+ }
+
+ // FIXME
+ // What to do about this? MS doesn't throw an error
+ // AssertEquals("#E28", true, caughtException);
+ AssertEquals("#E28", false, caughtException);
+
+ caughtException = false;
+
+ try {
+ IEnumerator e = c.GetEnumerator();
+ e.MoveNext();
+
+ c.Add("Racketball", "Racket", null, null);
+
+ // Can't Reset if Collection has been modified
+ e.Reset();
+ }
+ catch (Exception e) {
+ // FIXME
+ // On-line help says this should throw an error. MS doesn't.
+ AssertEquals("#E29", typeof(InvalidOperationException), e.GetType());
+ caughtException = true;
+ }
+
+ // FIXME
+ // What to do about this? MS doesn't throw an error
+ // AssertEquals("#E30", true, caughtException);
+ AssertEquals("#E30", false, caughtException);
+
+ caughtException = false;
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs b/mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs
new file mode 100644
index 00000000000..991e6e82f61
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs
@@ -0,0 +1,674 @@
+// Collection.cs - NUnit Test Cases for Microsoft.VisualBasic.Collection
+//
+// Author:
+// Chris J. Breisch (cjbreisch@altavista.net)
+//
+// (C) Chris J. Breisch
+//
+
+using NUnit.Framework;
+using System;
+using Microsoft.VisualBasic;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+
+ public class ConversionTest : TestCase
+ {
+
+ public ConversionTest() : base ("Microsoft.VisualBasic.Conversion") {}
+ public ConversionTest(string name) : base(name) {}
+
+ protected override void SetUp() {}
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ConversionTest));
+ }
+ }
+
+ public void TestErrorToStringEmpty() {
+ // FIXME : Do something here, but write the ErrorToString code first :-)
+ }
+
+ public void TestErrorToStringNumber() {
+ // FIXME : Do something here, but write the ErrorToString code first :-)
+ }
+
+ // Test the Fix function
+ public void TestFix() {
+ System.Single Sng;
+ System.Double Dbl;
+ System.Decimal Dec;
+ System.String S;
+ System.Object O;
+
+ AssertEquals("#F01", System.Int16.MaxValue, Conversion.Fix(System.Int16.MaxValue));
+ AssertEquals("#F02", System.Int16.MinValue, Conversion.Fix(System.Int16.MinValue));
+ AssertEquals("#F03", System.Int32.MaxValue, Conversion.Fix(System.Int32.MaxValue));
+ AssertEquals("#F04", System.Int32.MinValue, Conversion.Fix(System.Int32.MinValue));
+ AssertEquals("#F05", System.Int64.MaxValue, Conversion.Fix(System.Int64.MaxValue));
+ AssertEquals("#F06", System.Int64.MinValue, Conversion.Fix(System.Int64.MinValue));
+ AssertEquals("#F07", (System.Single)Math.Floor(System.Single.MaxValue), Conversion.Fix(System.Single.MaxValue));
+ AssertEquals("#F08", -1 * (System.Single)Math.Floor(-1 * System.Single.MinValue), Conversion.Fix(System.Single.MinValue));
+ AssertEquals("#F09", Math.Floor(System.Double.MaxValue), Conversion.Fix(System.Double.MaxValue));
+ AssertEquals("#F10", -1 * Math.Floor(-1 * System.Double.MinValue), Conversion.Fix(System.Double.MinValue));
+ AssertEquals("#F11", Decimal.Floor(System.Decimal.MaxValue), Conversion.Fix(System.Decimal.MaxValue));
+ AssertEquals("#F12", -1 * Decimal.Floor(-1 * System.Decimal.MinValue), Conversion.Fix(System.Decimal.MinValue));
+
+ Sng = 99.1F;
+
+ AssertEquals("#F13", 99F, Conversion.Fix(Sng));
+
+ Sng = 99.6F;
+
+ AssertEquals("#F14", 99F, Conversion.Fix(Sng));
+
+ Sng = -99.1F;
+
+ AssertEquals("#F15", -99F, Conversion.Fix(Sng));
+
+ Sng = -99.6F;
+
+ AssertEquals("#F16", -99F, Conversion.Fix(Sng));
+
+ Dbl = 99.1;
+
+ AssertEquals("#F17", 99D, Conversion.Fix(Dbl));
+
+ Dbl = 99.6;
+
+ AssertEquals("#F18", 99D, Conversion.Fix(Dbl));
+
+ Dbl = -99.1;
+
+ AssertEquals("#F19", -99D, Conversion.Fix(Dbl));
+
+ Dbl = -99.6;
+
+ AssertEquals("#F20", -99D, Conversion.Fix(Dbl));
+
+ Dec = 99.1M;
+
+ AssertEquals("#F21", 99M, Conversion.Fix(Dec));
+
+ Dec = 99.6M;
+
+ AssertEquals("#F22", 99M, Conversion.Fix(Dec));
+
+ Dec = -99.1M;
+
+ AssertEquals("#F23", -99M, Conversion.Fix(Dec));
+
+ Dec = -99.6M;
+
+ AssertEquals("#F24", -99M, Conversion.Fix(Dec));
+
+ Dbl = 99.1;
+ S = Dbl.ToString();
+
+ AssertEquals("#F25", 99D, Conversion.Fix(S));
+
+ Dbl = 99.6;
+ S = Dbl.ToString();
+
+ AssertEquals("#F26", 99D, Conversion.Fix(S));
+
+ Dbl = -99.1;
+ S = Dbl.ToString();
+
+ AssertEquals("#F27", -99D, Conversion.Fix(S));
+
+ Dbl = -99.6;
+ S = Dbl.ToString();
+
+ AssertEquals("#F28", -99D, Conversion.Fix(S));
+
+ Dbl = 99.1;
+ O = Dbl;
+
+ AssertEquals("#F29", 99D, Conversion.Fix(O));
+
+ Sng = 99.6F;
+ O = Sng;
+
+ AssertEquals("#F30", (System.Object)99F, Conversion.Fix(O));
+
+ Dbl = -99.1;
+ O = Dbl;
+
+ AssertEquals("#F31", -99D, Conversion.Fix(O));
+
+ Dec = -99.6M;
+ O = Dec;
+
+ AssertEquals("#F32", (System.Object)(-99M), Conversion.Fix(O));
+
+ O = typeof(int);
+
+ // test for Exceptions
+ bool caughtException = false;
+ try {
+ Conversion.Fix(O);
+ }
+ catch (Exception e) {
+ AssertEquals("#F33", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#F34", true, caughtException);
+
+ caughtException = false;
+ try {
+ Conversion.Fix(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#F35", typeof(ArgumentNullException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#F36", true, caughtException);
+
+ }
+
+ // Test the Int function
+ public void TestInt() {
+ System.Single Sng;
+ System.Double Dbl;
+ System.Decimal Dec;
+ System.String S;
+ System.Object O;
+
+ AssertEquals("#I01", System.Int16.MaxValue, Conversion.Int(System.Int16.MaxValue));
+ AssertEquals("#I02", System.Int16.MinValue, Conversion.Int(System.Int16.MinValue));
+ AssertEquals("#I03", System.Int32.MaxValue, Conversion.Int(System.Int32.MaxValue));
+ AssertEquals("#I04", System.Int32.MinValue, Conversion.Int(System.Int32.MinValue));
+ AssertEquals("#I05", System.Int64.MaxValue, Conversion.Int(System.Int64.MaxValue));
+ AssertEquals("#I06", System.Int64.MinValue, Conversion.Int(System.Int64.MinValue));
+ AssertEquals("#I07", (System.Single)Math.Floor(System.Single.MaxValue), Conversion.Int(System.Single.MaxValue));
+ AssertEquals("#I08", (System.Single)Math.Floor(System.Single.MinValue), Conversion.Int(System.Single.MinValue));
+ AssertEquals("#I09", Math.Floor(System.Double.MaxValue), Conversion.Int(System.Double.MaxValue));
+ AssertEquals("#I10", Math.Floor(System.Double.MinValue), Conversion.Int(System.Double.MinValue));
+ AssertEquals("#I11", Decimal.Floor(System.Decimal.MaxValue), Conversion.Int(System.Decimal.MaxValue));
+ AssertEquals("#I12", Decimal.Floor(System.Decimal.MinValue), Conversion.Int(System.Decimal.MinValue));
+
+ Sng = 99.1F;
+
+ AssertEquals("#I13", 99F, Conversion.Int(Sng));
+
+ Sng = 99.6F;
+
+ AssertEquals("#I14", 99F, Conversion.Int(Sng));
+
+ Sng = -99.1F;
+
+ AssertEquals("#I15", -100F, Conversion.Int(Sng));
+
+ Sng = -99.6F;
+
+ AssertEquals("#I16", -100F, Conversion.Int(Sng));
+
+ Dbl = 99.1;
+
+ AssertEquals("#I17", 99D, Conversion.Int(Dbl));
+
+ Dbl = 99.6;
+
+ AssertEquals("#I18", 99D, Conversion.Int(Dbl));
+
+ Dbl = -99.1;
+
+ AssertEquals("#I19", -100D, Conversion.Int(Dbl));
+
+ Dbl = -99.6;
+
+ AssertEquals("#I20", -100D, Conversion.Int(Dbl));
+
+ Dec = 99.1M;
+
+ AssertEquals("#I21", 99M, Conversion.Int(Dec));
+
+ Dec = 99.6M;
+
+ AssertEquals("#I22", 99M, Conversion.Int(Dec));
+
+ Dec = -99.1M;
+
+ AssertEquals("#I23", -100M, Conversion.Int(Dec));
+
+ Dec = -99.6M;
+
+ AssertEquals("#I24", -100M, Conversion.Int(Dec));
+
+ Dbl = 99.1;
+ S = Dbl.ToString();
+
+ AssertEquals("#I25", 99D, Conversion.Int(S));
+
+ Dbl = 99.6;
+ S = Dbl.ToString();
+
+ AssertEquals("#I26", 99D, Conversion.Int(S));
+
+ Dbl = -99.1;
+ S = Dbl.ToString();
+
+ AssertEquals("#I27", -100D, Conversion.Int(S));
+
+ Dbl = -99.6;
+ S = Dbl.ToString();
+
+ AssertEquals("#I28", -100D, Conversion.Int(S));
+
+ Dbl = 99.1;
+ O = Dbl;
+
+ AssertEquals("#I29", 99D, Conversion.Int(O));
+
+ Sng = 99.6F;
+ O = Sng;
+
+ AssertEquals("#I30", 99F, Conversion.Int(O));
+
+ Dbl = -99.1;
+ O = Dbl;
+
+ AssertEquals("#I31", -100D, Conversion.Int(O));
+
+ Dec = -99.6M;
+ O = Dec;
+
+ AssertEquals("#I32", -100M, Conversion.Int(O));
+
+ // test the exceptions it's supposed to throw
+
+ O = typeof(int);
+ bool caughtException = false;
+
+ try {
+ Conversion.Fix(O);
+ }
+ catch (Exception e) {
+ AssertEquals("#I33", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#I34", true, caughtException);
+
+ caughtException = false;
+ try {
+ Conversion.Int(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#I35", typeof(ArgumentNullException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#I36", true, caughtException);
+
+
+ }
+
+ // test the Hex function
+ public void TestHex() {
+ AssertEquals("#H01", "FF", Conversion.Hex(System.Byte.MaxValue));
+ AssertEquals("#H02", "0", Conversion.Hex(System.Byte.MinValue));
+ AssertEquals("#H03", "7FFF", Conversion.Hex(System.Int16.MaxValue));
+ AssertEquals("#H04", "8000", Conversion.Hex(System.Int16.MinValue));
+ AssertEquals("#H05", "7FFFFFFF", Conversion.Hex(System.Int32.MaxValue));
+ AssertEquals("#H06", "80000000", Conversion.Hex(System.Int32.MinValue));
+ AssertEquals("#H07", "7FFFFFFFFFFFFFFF", Conversion.Hex(System.Int64.MaxValue));
+ AssertEquals("#H08", "8000000000000000", Conversion.Hex(System.Int64.MinValue));
+
+ System.Byte UI8;
+ System.Int16 I16;
+ System.Int32 I32;
+ System.Int64 I64;
+ System.Object O;
+ System.String S;
+
+ UI8 = 15;
+ AssertEquals("#H09", "F", Conversion.Hex(UI8));
+
+ I16 = System.Byte.MaxValue;
+ AssertEquals("#H10", "FF", Conversion.Hex(I16));
+
+ I16 = (System.Int16)((I16 + 1) * -1);
+ AssertEquals("#H11", "FF00", Conversion.Hex(I16));
+
+ I16 = -2;
+ AssertEquals("#H12", "FFFE", Conversion.Hex(I16));
+
+ I32 = System.UInt16.MaxValue;
+ AssertEquals("#H13", "FFFF", Conversion.Hex(I32));
+
+ I32 = (I32 + 1) * -1;
+ AssertEquals("#H14", "FFFF0000", Conversion.Hex(I32));
+
+ I32 = -2;
+ AssertEquals("#H15", "FFFFFFFE", Conversion.Hex(I32));
+
+ I64 = System.UInt32.MaxValue;
+ AssertEquals("#H16", "FFFFFFFF", Conversion.Hex(I64));
+
+ I64 = (I64 + 1) * -1;
+ AssertEquals("#H17", "FFFFFFFF00000000", Conversion.Hex(I64));
+
+ I64 = -2;
+ AssertEquals("#H18", "FFFFFFFFFFFFFFFE", Conversion.Hex(I64));
+
+ I16 = System.Byte.MaxValue;
+ S = I16.ToString();
+ AssertEquals("#H19", "FF", Conversion.Hex(S));
+
+ I16 = (System.Int16)((I16 + 1) * -1);
+ S = I16.ToString();
+ AssertEquals("#H20", "FFFFFF00", Conversion.Hex(S));
+
+ I16 = -1;
+ S = I16.ToString();
+ AssertEquals("#H21", "FFFFFFFF", Conversion.Hex(S));
+
+ I32 = System.UInt16.MaxValue;
+ S = I32.ToString();
+ AssertEquals("#H22", "FFFF", Conversion.Hex(S));
+
+ I32 = (I32 + 1) * -1;
+ S = I32.ToString();
+ AssertEquals("#H23", "FFFF0000", Conversion.Hex(S));
+
+ I32 = -2;
+ S = I32.ToString();
+ AssertEquals("#H24", "FFFFFFFE", Conversion.Hex(S));
+
+ I64 = System.UInt32.MaxValue;
+ S = I64.ToString();
+ AssertEquals("#H25", "FFFFFFFF", Conversion.Hex(S));
+
+ I64 = (I64 + 1) * -1;
+ S = I64.ToString();
+ AssertEquals("#H26", "FFFFFFFF00000000", Conversion.Hex(S));
+
+ UI8 = System.Byte.MaxValue;
+ O = UI8;
+ AssertEquals("#H27", "FF", Conversion.Hex(O));
+
+ I16 = System.Byte.MaxValue;
+ O = I16;
+ AssertEquals("#H28", "FF", Conversion.Hex(O));
+
+ I16 = (System.Int16)((I16 + 1) * -1);
+ O = I16;
+ AssertEquals("#H29", "FF00", Conversion.Hex(O));
+
+ I16 = -2;
+ O = I16;
+ AssertEquals("#H30", "FFFE", Conversion.Hex(O));
+
+ I32 = System.UInt16.MaxValue;
+ O = I32;
+ AssertEquals("#H31", "FFFF", Conversion.Hex(O));
+
+ I32 = (I32 + 1) * -1;
+ O = I32;
+ AssertEquals("#H32", "FFFF0000", Conversion.Hex(O));
+
+ I32 = -2;
+ O = I32;
+ AssertEquals("#H33", "FFFFFFFE", Conversion.Hex(O));
+
+ I64 = System.UInt32.MaxValue;
+ O = I64;
+ AssertEquals("#H34", "FFFFFFFF", Conversion.Hex(O));
+
+ I64 = (I64 + 1) * -1;
+ O = I64;
+ AssertEquals("#H35", "FFFFFFFF00000000", Conversion.Hex(O));
+
+ I64 = -2;
+ O = I64;
+ // FIXME : MS doesn't pass this test
+ //AssertEquals("#H35", "FFFFFFFFFFFFFFFE", Conversion.Hex(O));
+
+ O = typeof(int);
+
+ bool caughtException = false;
+ try {
+ Conversion.Hex(O);
+ }
+ catch (Exception e) {
+ AssertEquals("#H36", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#H37", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ Conversion.Hex(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#H38", typeof(ArgumentNullException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#H39", true, caughtException);
+ }
+
+ // test the Oct function
+ public void TestOct() {
+ AssertEquals("#O01", "377", Conversion.Oct(System.Byte.MaxValue));
+ AssertEquals("#O02", "0", Conversion.Oct(System.Byte.MinValue));
+ AssertEquals("#O03", "77777", Conversion.Oct(System.Int16.MaxValue));
+ AssertEquals("#O04", "100000", Conversion.Oct(System.Int16.MinValue));
+ AssertEquals("#O05", "17777777777", Conversion.Oct(System.Int32.MaxValue));
+ AssertEquals("#O06", "20000000000", Conversion.Oct(System.Int32.MinValue));
+ AssertEquals("#O07", "777777777777777777777", Conversion.Oct(System.Int64.MaxValue));
+ //AssertEquals("#O08", "1000000000000000000000", Conversion.Oct(System.Int64.MinValue));
+
+ System.Byte UI8;
+ System.Int16 I16;
+ System.Int32 I32;
+ System.Int64 I64;
+ System.Object O;
+ System.String S;
+
+ UI8 = 15;
+ AssertEquals("#O09", "17", Conversion.Oct(UI8));
+
+ I16 = System.Byte.MaxValue;
+ AssertEquals("#O10", "377", Conversion.Oct(I16));
+
+ I16 = (System.Int16)((I16 + 1) * -1);
+ AssertEquals("#O11", "177400", Conversion.Oct(I16));
+
+ I16 = -2;
+ AssertEquals("#O12", "177776", Conversion.Oct(I16));
+
+ I32 = System.UInt16.MaxValue;
+ AssertEquals("#O13", "177777", Conversion.Oct(I32));
+
+ I32 = (I32 + 1) * -1;
+ AssertEquals("#O14", "37777600000", Conversion.Oct(I32));
+
+ I32 = -2;
+ AssertEquals("#O15", "37777777776", Conversion.Oct(I32));
+
+ I64 = System.UInt32.MaxValue;
+ AssertEquals("#O16", "37777777777", Conversion.Oct(I64));
+
+ I64 = (I64 + 1) * -1;
+ AssertEquals("#O17", "1777777777740000000000", Conversion.Oct(I64));
+
+ I64 = -2;
+ AssertEquals("#O18", "1777777777777777777776", Conversion.Oct(I64));
+
+ I16 = System.Byte.MaxValue;
+ S = I16.ToString();
+ AssertEquals("#O19", "377", Conversion.Oct(S));
+
+ I16 = (System.Int16)((I16 + 1) * -1);
+ S = I16.ToString();
+ AssertEquals("#O20", "37777777400", Conversion.Oct(S));
+
+ I16 = -2;
+ S = I16.ToString();
+ AssertEquals("#O21", "37777777776", Conversion.Oct(S));
+
+ I32 = System.UInt16.MaxValue;
+ S = I32.ToString();
+ AssertEquals("#O22", "177777", Conversion.Oct(S));
+
+ I32 = (I32 + 1) * -1;
+ S = I32.ToString();
+ AssertEquals("#O23", "37777600000", Conversion.Oct(S));
+
+ I32 = -2;
+ S = I32.ToString();
+ AssertEquals("#O24", "37777777776", Conversion.Oct(S));
+
+ I64 = System.UInt32.MaxValue;
+ S = I64.ToString();
+ AssertEquals("#O25", "37777777777", Conversion.Oct(S));
+
+ I64 = (I64 + 1) * -1;
+ S = I64.ToString();
+ AssertEquals("#O26", "1777777777740000000000", Conversion.Oct(S));
+
+ UI8 = System.Byte.MaxValue;
+ O = UI8;
+ AssertEquals("#O27", "377", Conversion.Oct(O));
+
+ I16 = System.Byte.MaxValue;
+ O = I16;
+ AssertEquals("#O28", "377", Conversion.Oct(O));
+
+ I16 = (System.Int16)((I16 + 1) * -1);
+ O = I16;
+ AssertEquals("#O29", "177400", Conversion.Oct(O));
+
+ I16 = -2;
+ O = I16;
+ AssertEquals("#O29", "177776", Conversion.Oct(O));
+
+ I32 = System.UInt16.MaxValue;
+ O = I32;
+ AssertEquals("#O30", "177777", Conversion.Oct(O));
+
+ I32 = (I32 + 1) * -1;
+ O = I32;
+ AssertEquals("#O31", "37777600000", Conversion.Oct(O));
+
+ I32 = -2;
+ O = I32;
+ AssertEquals("#O32", "37777777776", Conversion.Oct(O));
+
+ I64 = System.UInt32.MaxValue;
+ O = I64;
+ AssertEquals("#O33", "37777777777", Conversion.Oct(O));
+
+ I64 = (I64 + 1) * -1;
+ O = I64;
+ AssertEquals("#O34", "1777777777740000000000", Conversion.Oct(O));
+
+ I64 = -2;
+ O = I64;
+
+ // FIXME: MS doesn't pass this test
+ // AssertEquals("#O35", "1777777777777777777776", Conversion.Oct(O));
+
+ O = typeof(int);
+
+ bool caughtException = false;
+ try {
+ Conversion.Oct(O);
+ }
+ catch (Exception e) {
+ AssertEquals("#O36", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#O37", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ Conversion.Oct(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#O38", typeof(ArgumentNullException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#O39", true, caughtException);
+ }
+
+ // test the Str function
+ public void TestStr() {
+ AssertEquals("#S01", "-1", Conversion.Str(-1));
+ AssertEquals("#S02", " 1", Conversion.Str(1));
+
+ bool caughtException = false;
+ Object O = typeof(int);
+
+ try {
+ Conversion.Str(O);
+ }
+ catch (Exception e) {
+ AssertEquals("#S03", typeof(InvalidCastException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#S04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ Conversion.Str(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#S05", typeof(ArgumentNullException), e.GetType());
+ caughtException = true;
+ }
+ }
+
+ // Test the Val function
+ public void TestVal() {
+ AssertEquals("#V01", 4, Conversion.Val('4'));
+ AssertEquals("#V02", -3542.76, Conversion.Val(" - 3 5 .4 2 7 6E+ 0 0 2 "));
+ AssertEquals("#V03", 255D, Conversion.Val("&HFF"));
+ AssertEquals("#V04", 255D, Conversion.Val("&o377"));
+
+ System.Object O = " - 3 5 .4 7 6E+ 0 0 3";
+
+ AssertEquals("#V05", -35476D, Conversion.Val(O));
+
+ bool caughtException;
+
+ caughtException = false;
+
+ try {
+ Conversion.Val("3E+9999999");
+ }
+ catch (Exception e) {
+ AssertEquals("#V06", typeof(OverflowException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#V07", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ Conversion.Val(typeof(int));
+ }
+ catch (Exception e) {
+ AssertEquals("#V08", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#V09", true, caughtException);
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs b/mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs
new file mode 100644
index 00000000000..0c8f38436f7
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs
@@ -0,0 +1,388 @@
+// Collection.cs - NUnit Test Cases for Microsoft.VisualBasic.Collection
+//
+// Author:
+// Chris J. Breisch (cjbreisch@altavista.net)
+//
+// (C) Chris J. Breisch
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+using Microsoft.VisualBasic;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+
+ public class DateAndTimeTest : TestCase {
+
+ private CultureInfo oldcult;
+
+ public DateAndTimeTest() : base ("Microsoft.VisualBasic.DateAndTime") {}
+ public DateAndTimeTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ // the current culture determines the result of formatting
+ oldcult = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
+ }
+
+ protected override void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = oldcult;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(DateAndTimeTest));
+ }
+ }
+
+ public void TestDateString() {
+ string s = DateAndTime.DateString;
+ DateTime dtNow = DateTime.Today;
+ AssertEquals("#DS01", dtNow.ToShortDateString(), DateTime.Parse(s).ToShortDateString());
+
+ // TODO: Add a test for setting the date string too
+ }
+
+ public void TestToday() {
+ AssertEquals("#TO01", DateTime.Today, DateAndTime.Today);
+
+ // TODO: Add a test for setting Today
+ }
+
+ public void TestTimer() {
+ double secTimer = DateAndTime.Timer;
+ DateTime dtNow = DateTime.Now;
+ double secNow = dtNow.Hour * 3600 + dtNow.Minute * 60 + dtNow.Second + (dtNow.Millisecond + 1) / 1000D;
+ double secTimer2 = DateAndTime.Timer + .001;
+
+ // waste a little time
+ for (int i = 0; i < int.MaxValue; i++);
+
+ // get another timer
+ double secTimer3 = DateAndTime.Timer;
+
+ // should be same time within a reasonable tolerance
+ Assert("#TI01", secNow >= secTimer);
+ Assert("#TI02: SecTimer2=" + secTimer2 + " secNow=" + secNow, secTimer2 >= secNow);
+
+ // third timer should be greater than the first
+ Assert("#TI03", secTimer3 > secTimer);
+ }
+
+ public void TestNow() {
+ DateTime dtNow = DateTime.Now;
+ DateTime dtTest = DateAndTime.Now;
+ DateTime dtNow2 = DateTime.Now;
+
+ Assert("#N01", dtTest >= dtNow);
+ Assert("#N02", dtNow2 >= dtTest);
+ }
+
+ public void TestTimeOfDay() {
+ DateTime dtNow = DateTime.Now;
+ TimeSpan tsNow = new TimeSpan(dtNow.Hour, dtNow.Minute, dtNow.Second);
+ DateTime dtTest = DateAndTime.TimeOfDay;
+ TimeSpan tsTest = new TimeSpan(dtTest.Hour, dtTest.Minute, dtTest.Second);
+ DateTime dtNow2 = DateTime.Now;
+ TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
+
+ Assert("#TOD01", tsTest.Ticks >= tsNow.Ticks);
+ Assert("#TOD02", tsNow2.Ticks >= tsTest.Ticks);
+
+ // TODO: add a test case for setting time of day
+ }
+
+ public void TestTimeString() {
+ DateTime dtNow = DateTime.Now;
+ TimeSpan tsNow = new TimeSpan(dtNow.Hour, dtNow.Minute, dtNow.Second);
+ string s = DateAndTime.TimeString;
+ DateTime dtTest = DateTime.Parse(s);
+ TimeSpan tsTest = new TimeSpan(dtTest.Hour, dtTest.Minute, dtTest.Second);
+ DateTime dtNow2 = DateTime.Now;
+ TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
+
+ Assert("#TS01", tsTest.Ticks >= tsNow.Ticks);
+ Assert("#TS02", tsNow2.Ticks >= tsTest.Ticks);
+
+ // TODO: add a test case for setting TimeString
+ }
+
+ public void TestDateAdd() {
+ DateTime dtNow = DateTime.Now;
+
+ AssertEquals("#DA01", dtNow.AddYears(1), DateAndTime.DateAdd(DateInterval.Year, 1, dtNow));
+ AssertEquals("#DA02", dtNow.AddYears(-1), DateAndTime.DateAdd("yyyy", -1, dtNow));
+
+
+ bool caughtException = false;
+
+ try {
+ DateAndTime.DateAdd("foo", 1, dtNow);
+ }
+ catch (Exception e) {
+ AssertEquals("#DA03", e.GetType(), typeof(ArgumentException));
+ caughtException = true;
+ }
+
+ AssertEquals("#DA04", caughtException, true);
+
+ AssertEquals("#DA05", dtNow.AddMonths(6), DateAndTime.DateAdd(DateInterval.Quarter, 2, dtNow));
+ AssertEquals("#DA06", dtNow.AddMonths(-6), DateAndTime.DateAdd("q", -2, dtNow));
+
+ AssertEquals("#DA07", dtNow.AddMonths(3), DateAndTime.DateAdd(DateInterval.Month, 3, dtNow));
+ AssertEquals("#DA08", dtNow.AddMonths(-3), DateAndTime.DateAdd("m", -3, dtNow));
+
+ AssertEquals("#DA09", dtNow.AddDays(28), DateAndTime.DateAdd(DateInterval.WeekOfYear, 4, dtNow));
+ AssertEquals("#DA10", dtNow.AddDays(-28), DateAndTime.DateAdd("ww", -4, dtNow));
+
+ AssertEquals("#DA11", dtNow.AddDays(5), DateAndTime.DateAdd(DateInterval.Weekday, 5, dtNow));
+ AssertEquals("#DA12", dtNow.AddDays(-5), DateAndTime.DateAdd("w", -5, dtNow));
+
+ AssertEquals("#DA13", dtNow.AddDays(6), DateAndTime.DateAdd(DateInterval.DayOfYear, 6, dtNow));
+ AssertEquals("#DA14", dtNow.AddDays(-6), DateAndTime.DateAdd("y", -6, dtNow));
+
+ AssertEquals("#DA15", dtNow.AddDays(7), DateAndTime.DateAdd(DateInterval.Day, 7, dtNow));
+ AssertEquals("#DA16", dtNow.AddDays(-7), DateAndTime.DateAdd("d", -7, dtNow));
+
+ AssertEquals("#DA17", dtNow.AddHours(8), DateAndTime.DateAdd(DateInterval.Hour, 8, dtNow));
+ AssertEquals("#DA18", dtNow.AddHours(-8), DateAndTime.DateAdd(DateInterval.Hour, -8, dtNow));
+
+ AssertEquals("#DA19", dtNow.AddMinutes(9), DateAndTime.DateAdd(DateInterval.Minute, 9, dtNow));
+ AssertEquals("#DA20", dtNow.AddMinutes(-9), DateAndTime.DateAdd("n", -9, dtNow));
+
+ AssertEquals("#DA21", dtNow.AddSeconds(10), DateAndTime.DateAdd(DateInterval.Second, 10, dtNow));
+ AssertEquals("#DA22", dtNow.AddSeconds(-10), DateAndTime.DateAdd("s", -10, dtNow));
+
+ caughtException = false;
+
+ try {
+ DateAndTime.DateAdd(DateInterval.Year, int.MinValue, dtNow);
+ }
+ catch (Exception e) {
+ caughtException = true;
+ AssertEquals("#DA23", e.GetType(), typeof(Exception));
+ }
+
+ // AssertEquals("#DA24", caughtException, true);
+ }
+
+ public void TestDateDiff () {
+ DateTime dtNow = DateTime.Now;
+ DateTime dtOld = dtNow.AddYears(-1);
+
+ // TODO: Test this better
+ long diff = DateAndTime.DateDiff(DateInterval.Year, dtOld, dtNow, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD01", dtNow, dtOld.AddYears((int)diff));
+
+ DateTime dtJan1 = new DateTime(2002, 1, 1);
+ DateTime dtDec31 = new DateTime(2001, 12, 31);
+
+ diff = DateAndTime.DateDiff(DateInterval.Year, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD02", 1L, diff);
+
+ diff = DateAndTime.DateDiff(DateInterval.Quarter, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD03", 1L, diff);
+
+ diff = DateAndTime.DateDiff(DateInterval.Month, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD04", 1L, diff);
+
+ DateTime dtJan4 = new DateTime(2001, 1, 4); // This is a Thursday
+ DateTime dtJan9 = new DateTime(2001, 1, 9); // This is the next Tuesday
+
+
+ long WD = DateAndTime.DateDiff(DateInterval.Weekday, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals ("#DD05", 0L, WD);
+
+ long WY = DateAndTime.DateDiff(DateInterval.WeekOfYear, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals ("#DD06", 1L, WY);
+ }
+
+ public void TestDatePart () {
+ DateTime dtJan4 = new DateTime(2001, 1, 4);
+
+ // TODO: Test this better
+
+ AssertEquals("#DP01", 2001, DateAndTime.DatePart(DateInterval.Year, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP02", 1, DateAndTime.DatePart(DateInterval.Quarter, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP03", 1, DateAndTime.DatePart(DateInterval.Month, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP04", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP05", 53, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFullWeek));
+ AssertEquals("#DP06", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.Jan1));
+ AssertEquals("#DP07", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP08", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Friday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP09", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Saturday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP10", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP11", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP12", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Tuesday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP13", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Wednesday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP14", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Thursday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP15", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
+
+
+ }
+
+ public void TestDateSerial () {
+ DateTime dtJan4 = new DateTime(2001, 1, 4);
+ DateTime dtSerial = DateAndTime.DateSerial(2001, 1, 4);
+
+ AssertEquals("#DS01", dtJan4, dtSerial);
+ }
+
+ public void TestTimeSerial () {
+ bool caughtException = false;
+
+ try {
+ DateAndTime.TimeSerial(0, -1440, -1);
+ }
+ catch (Exception e) {
+ AssertEquals("#TS01", e.GetType(), typeof(ArgumentOutOfRangeException));
+ caughtException = true;
+ }
+ AssertEquals("#TS02", true, caughtException);
+
+ AssertEquals("#TS03", new DateTime(1, 1, 1, 1, 1, 1), DateAndTime.TimeSerial(1, 1, 1));
+
+ }
+
+ public void TestDateValue () {
+ try {
+ DateAndTime.DateValue("This is not a date.");
+ }
+ catch (FormatException) {
+ /* do nothing. this is what we expect */
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception:" + e);
+ }
+ AssertEquals("#DV03", new DateTime(1969, 2, 12), DateAndTime.DateValue("February 12, 1969"));
+ }
+
+ public void TestTimeValue () {
+ try {
+ DateAndTime.TimeValue("This is not a time.");
+ }
+ catch (FormatException) {
+ /* do nothing. this is what we expect */
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception:" + e);
+ }
+ AssertEquals("#TV03", new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 35, 17), DateAndTime.TimeValue("4:35:17 PM"));
+ }
+
+ public void TestYear () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#Y01", jan1.Year, DateAndTime.Year(jan1));
+ }
+
+ public void TestMonth () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#MO01", jan1.Month, DateAndTime.Month(jan1));
+ }
+
+ public void TestDay () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#D01", jan1.Day, DateAndTime.Day(jan1));
+ }
+
+ public void TestHour () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#H01", jan1.Hour, DateAndTime.Hour(jan1));
+ }
+
+ public void TestMinute () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#MI01", jan1.Minute, DateAndTime.Minute(jan1));
+ }
+
+ public void TestSecond () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#S01", jan1.Second, DateAndTime.Second(jan1));
+ }
+
+ public void TestWeekday () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#W01", (int)jan1.DayOfWeek + 1, DateAndTime.Weekday(jan1, FirstDayOfWeek.System));
+ }
+
+ public void TestMonthName () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#MN01", CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(jan1.Month),
+ DateAndTime.MonthName(jan1.Month, true));
+ AssertEquals("#MN02", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(jan1.Month),
+ DateAndTime.MonthName(jan1.Month, false));
+
+ bool caughtException = false;
+
+ try {
+ DateAndTime.MonthName(0, false);
+ }
+ catch (Exception e) {
+ AssertEquals("#MN03", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#MN04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ DateAndTime.MonthName(14, false);
+ }
+ catch (Exception e) {
+ AssertEquals("#MN05", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#MN06", true, caughtException);
+
+ //AssertEquals("#MN07", "", DateAndTime.MonthName(13, false));
+ }
+
+ public void TestWeekdayName () {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#WN01", "Tue",
+ DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, true, FirstDayOfWeek.System));
+ AssertEquals("#WN02", "Tuesday",
+ DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
+
+ bool caughtException = false;
+
+ try {
+ DateAndTime.WeekdayName(0, false, FirstDayOfWeek.System);
+ }
+ catch (Exception e) {
+ AssertEquals("#WN03", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#WN04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ DateAndTime.WeekdayName(8, false, FirstDayOfWeek.System);
+ }
+ catch (Exception e) {
+ AssertEquals("#WN05", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#WN06", true, caughtException);
+
+ AssertEquals("#WN07", "Tuesday", DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
+ }
+
+
+
+
+
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic_test.build b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic_test.build
new file mode 100644
index 00000000000..3e205b08b8f
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic_test.build
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Data_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System.Data_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="Microsoft.VisualBasic_test.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <!--<arg value="/lib:../../lib/"/>-->
+
+ <!-- cor compare dies with these currently -->
+ <!--<arg value="/nostdlib"/>--> <!-- don't reference mscorlib -->
+ <!--<arg value="/r:corlib.dll"/>-->
+ <arg value="/r:System.dll"/>
+ <arg value="/r:.\Microsoft.VisualBasic.dll"/>
+ </csc>
+
+<!--
+ <csc target="exe" output="RunTests.Microsoft.VisualBasic.exe" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="AllTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitBase.dll"/>
+ </references>
+ <arg value="/nowarn:1595"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:..\..\lib\corlib.dll"/>
+ <arg value="/r:..\..\lib\System.dll"/>
+ <arg value="/r:..\..\lib\Microsoft.VisualBasic.dll"/>
+ </csc>
+
+-->
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.AllTests,Microsoft.VisualBasic_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="Microsoft.VisualBasic.dll" failonerror="false"/>
+ <delete file="Microsoft.VisualBasic_test.dll" failonerror="false"/>
+ <delete file="corlib.dll" failonerror="false"/>
+ <delete file="System.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Microsoft.VisualBasic/list b/mcs/class/Microsoft.VisualBasic/list
new file mode 100644
index 00000000000..a6c1c5261f4
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/list
@@ -0,0 +1,62 @@
+Microsoft.VisualBasic/AppWinStyle.cs
+Microsoft.VisualBasic/CallType.cs
+Microsoft.VisualBasic/Collection.cs
+Microsoft.VisualBasic/ComClassAttribute.cs
+Microsoft.VisualBasic/CompareMethod.cs
+Microsoft.VisualBasic/Constants.cs
+Microsoft.VisualBasic/ControlChars.cs
+Microsoft.VisualBasic/Conversion.cs
+Microsoft.VisualBasic/DateAndTime.cs
+Microsoft.VisualBasic/DateFormat.cs
+Microsoft.VisualBasic/DateInterval.cs
+Microsoft.VisualBasic/DueDate.cs
+Microsoft.VisualBasic/ErrObject.cs
+Microsoft.VisualBasic/FileAttribute.cs
+Microsoft.VisualBasic/FileSystem.cs
+Microsoft.VisualBasic/Financial.cs
+Microsoft.VisualBasic/FirstDayOfWeek.cs
+Microsoft.VisualBasic/FirstWeekOfYear.cs
+Microsoft.VisualBasic/Globals.cs
+Microsoft.VisualBasic/Information.cs
+Microsoft.VisualBasic/Interaction.cs
+Microsoft.VisualBasic/MsgBoxResult.cs
+Microsoft.VisualBasic/MsgBoxStyle.cs
+Microsoft.VisualBasic/OpenAccess.cs
+Microsoft.VisualBasic/OpenMode.cs
+Microsoft.VisualBasic/OpenShare.cs
+Microsoft.VisualBasic/SpcInfo.cs
+Microsoft.VisualBasic/Strings.cs
+Microsoft.VisualBasic/TODOAttribute.cs
+Microsoft.VisualBasic/TabInfo.cs
+Microsoft.VisualBasic/TriState.cs
+Microsoft.VisualBasic/VBFixedArrayAttribute.cs
+Microsoft.VisualBasic/VBFixedStringAttribute.cs
+Microsoft.VisualBasic/VBMath.cs
+Microsoft.VisualBasic/VariantType.cs
+Microsoft.VisualBasic/VbStrConv.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/BooleanType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ByteType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharArrayType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/CharType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DateType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DecimalType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/DoubleType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ExceptionUtils.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/FlowControl.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/HostServices.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IVbHost.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IncompleteInitialization.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/IntegerType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LongType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionCompareAttribute.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/OptionTextAttribute.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ProjectData.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ShortType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/SingleType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StandardModuleAttribute.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StaticLocalInitFlag.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/StringType.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/TODOAttribute.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
diff --git a/mcs/class/Microsoft.VisualBasic/makefile.gnu b/mcs/class/Microsoft.VisualBasic/makefile.gnu
new file mode 100644
index 00000000000..c4767e1781b
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Microsoft.VisualBasic.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.CSharp.Debugger/.cvsignore b/mcs/class/Mono.CSharp.Debugger/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.CSharp.Debugger/ChangeLog b/mcs/class/Mono.CSharp.Debugger/ChangeLog
new file mode 100644
index 00000000000..78351d180e7
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/ChangeLog
@@ -0,0 +1,377 @@
+2003-01-17 Zoltan Varga <vargaz@freemail.hu>
+
+ * MonoSymbolWriter.cs (OpenMethod): Make it work on constructors.
+
+2002-10-13 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 28.
+ (SourceFileEntry): Read the methods when they're needed.
+ (MethodSourceEntry): Made this a struct, not a class.
+
+2002-10-13 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 27. Added a source
+ file table which is used to search a method by source file + line number.
+
+2002-09-21 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 26. Removed all the dynamic
+ stuff, this library now just deals with the compiler generated symbol table.
+ The dynamic stuff is private between the JIT and the debugger.
+
+2002-09-21 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 25. Added information about
+ local variables.
+
+2002-09-20 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 24. Added a type index
+ table. Write the type of a local variable or a parameter as an index
+ into this table.
+
+2002-09-20 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs: Remove all the unused interfaces.
+
+2002-09-20 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 23, include the size
+ of a variable.
+
+2002-09-20 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 22. Provide information
+ about parameters and local variables.
+
+2002-09-20 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs: Use fullly qualified name for
+ System.Diagnostics.SymbolStore.ISymbolWriter rather than `using' this
+ namespace. This allows us to use the name `ISymbolWriter' in our own
+ code.
+
+2002-09-18 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 21. Encode the source file
+ as a 4-byte length field followed by the UTF8 encoded string.
+
+2002-09-18 Martin Baulig <martin@gnome.org>
+
+ * IMonoBinaryReader.cs: New interface.
+
+ * MonoSymbolTable.cs: Use IMonoBinaryReader instead of binary reader.
+
+2002-09-16 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 20.
+
+2002-09-14 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolWriter.cs, IMonoSymbolWriter.cs, MonoSymbolTableWriter.cs:
+ Make all classes and interfaces which don't need to be public internal.
+
+2002-09-14 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Use only CLS-compliant types here, bumped version
+ number to 19.
+
+ * MonoSymbolTableReader.cs: Removed, this is now in the debugger.
+
+2002-09-03 Martin Baulig <martin@gnome.org>
+
+ * AssemblerWriterI386.cs, IAssemblerWriter.cs, MonoDwarfFileWriter.cs,
+ README, README.relocation-table, csharp-lang.[ch], gdb-csharp-support.patch,
+ gdb-variable-scopes.patch: Removed.
+
+2002-09-03 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTableReader.cs (MonoSymbolTableReader.ImageFile): New
+ public property.
+
+ * MonoSymbolTable.cs: Bumped version number to 18.
+
+2002-08-27 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs (MethodAddress): Removed `TrampolineAddress'.
+
+2002-08-27 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Changed the file format in a way that allows us
+ open it read-only and to use a specially malloced area for all the
+ dynamic data.
+
+2002-08-25 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTableReader.cs: New file. This is the reader for the
+ new symbol file format.
+
+2002-08-24 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs, MonoSymbolTableWriter.cs: New files. This
+ creates a binary application.dbg file which will be used by the
+ JIT to display source lines for exceptions.
+
+ * list.unix: Disabled the dwarf file writer in the build.
+
+2002-08-23 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolWriter.cs (MonoSymbolWriter.Initialize): Added
+ assembly name argument. Since the symbol writer needs to read the
+ final assembly, we need to give it its full pathname.
+
+2002-08-23 Martin Baulig <martin@gnome.org>
+
+ * makefile.gnu, list.unix: Added.
+
+2002-07-05 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Added support for types in referenced assemblies.
+
+2002-07-05 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Added support for arrays.
+
+ * gdb-csharp-support.patch: Updated.
+
+2002-06-29 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs (DieInheritance): Make this actually work.
+
+2002-06-29 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs, MonoSymbolWriter.cs: Put all TAG_subprogram's into their
+ corresponding struct/class declarations.
+
+2002-06-28 Martin Baulig <martin@gnome.org>
+
+ * gdb-csharp-support.patch: Updated.
+
+2002-06-28 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Use a TAG_string_type when we're using GNU extensions.
+ Make static struct/class fields actually work. Provide a TAG_typedef for struct's
+ and classes.
+
+2002-05-30 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter (IMonoSymbolWriter): Added custom `Initialize' method.
+
+ * MonoSymbolWriter.cs (Initialize): The ISymbolWriter's `Initialize' method
+ is no longer supported and throws an exception.
+ (Initialize (string, string[])): New custom initialization function.
+
+ * MonoDwarfFileWriter.cs (DwarfFileWriter): Added `string[] args' argument
+ to the constructor to pass command line arguments.
+
+ * gdb-csharp-support.patch: Updated for GDB 5.2.
+
+2002-05-30 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolWriter.cs (MonoSymbolWriter): The constructor now get's the
+ AssemblyBuilder's `methods' array as third argument.
+ (OpenMethod): Use this array to get the method builder rather than using an
+ interncall for it.
+ (get_method_builder): Removed this interncall.
+
+2002-05-25 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Finished the type rewrite, put back strings and arrays.
+
+2002-05-24 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceMethod): Added `FullName' and `Parameters'.
+ (ITypeHandle): New interface.
+
+ * DwarfFileWriter.cs: Largely reorganized the type writing code. Types are
+ now represented by ITypeHandle objects which are stored in a per-dwarf-writer
+ hash table. At the moment, all types still need to be in one compile unit due
+ to lacking support in gdb - but this new type code here already supports this.
+
+ * MonoSymbolWriter.cs: Moved all the subclasses to the top-level and made them
+ public, cleaned up the code, put everything into one compile unit.
+ (DefineLocalVariable): Added a version of this function which takes useful args.
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (IMonoSymbolWriter): Added `Sources' and `Methods'
+ properties.
+
+ * MonoDwarfFileWriter.cs (WriteSymbolTable): New public method. Moved the
+ code that writes the "mono_line_numbers" section here from the LineNumberEngine.
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (IVariable): Replaced Token with `ISourceMethod Method'.
+
+ * MonoSymbolWriter.cs (MonoSymbolWriter): The constructor now has an additional
+ ModuleBuilder argument.
+ (OpenMethod): Immediately call the `get_method' interncall to get the MethodBase
+ from the token, then store the MethodBase instead of the token. The token may
+ still change during the metadata library's fixup process.
+ (DoFixups): When the image has been written to disk, call the GetToken () method
+ on all MethodBuilders and all ConstructorBuilders to get the final metadata tokens.
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * AssemblerWriterI386.cs: Don't use GNU extensions and produce assembler
+ output which is free of comments and extra whitespaces so that it's suitable
+ for `as -f'.
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceMethod): Replaced `MethodInfo MethodInfo' with
+ `MethodBase MethodBase' and added `Type ReturnType'. We're now correctly
+ dealing with constructors and not crashing anymore.
+
+2002-05-21 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Write a special line number table which can be read
+ in by the metadata library to get line number information in backtraces.
+
+2002-05-06 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolWriter.cs (MonoSymbolWriter.Close): Use Assembly.LoadFrom (), not
+ AppDomain.Load () to load the assembly.
+
+2002-04-26 Martin Baulig <martin@gnome.org>
+
+ * gdb-csharp-support.patch: A patch for GDB (against the latest CVS version)
+ to implement C# support.
+
+ * csharp-lang.c, csharp-lang.h, csharp-mono-lang.c: Copy these into your GDB
+ source directory after applying the patch.
+
+2002-04-26 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs (DieInternalString): Removed.
+
+2002-04-25 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Reflect latest MonoString changes.
+
+2002-04-13 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceBlock): Added `Blocks' property and `AddBlock'
+ method to support nested blocks.
+
+ * MonoSymbolWriter.cs: Correctly handle nested blocks.
+
+ * MonoDwarfFileWriter.cs (DieMember): Provide info for all fields, not just for
+ public ones; also added DW_AT_accessibility.
+ (DieVariable): Reflected latest debug-symfile.c changes.
+
+2002-04-12 Martin Baulig <martin@gnome.org>
+
+ * gdb-variable-scopes.patch: A patch for GDB (against the latest CVS version)
+ to implement variable lifetimes.
+
+2002-04-12 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs (DieVariable): Provide info about the variable's
+ lifetime using DW_AT_begin_scope and a new baulig extension DW_AT_end_scope.
+
+2002-03-29 Martin Baulig <martin@gnome.org>
+
+ * AssemblerWriterI386.cs: Rewrote most of the string output function, do the
+ number->string conversion manually. It's now taking about 15 seconds to write
+ a symbol file for MCS, no longer more than a minute.
+
+ * MonoDwarfFileWriter.cs: Added some profiling code, speeded things up, fixed
+ a few bugs.
+
+2002-03-25 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs (CreateType): Return a `DieType'.
+ (RegisterType): Add the type to the type hash before creating dependency types
+ so we don't get recursion loops.
+ (RegisterPointerType): New func to register a "pointer to type" type.
+ (DieTypeDef, DiePointerType, DieArrayType, DieStringType, DieClassType): New
+ types; added support for strings, arrays and basic support for classes.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs: Killed all methods in this interface, no longer needed.
+
+ * MonoSymbolWriter.cs (MonoSymbolWriter): The constructor now takes a string
+ argument which is the full pathname of the assembly - you must call Close()
+ after the assembly has been written to disk since the symbol writer needs to
+ load the finished assembly to get its metadata.
+
+ * MonoDwarfFileWriter.cs: Added support for enums and structs.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Added support for method parameters.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (IMonoSymbolWriter): Removed my custom OpenMethod(),
+ we're now using the ISymbolWriter's method.
+ (IVariable): Added `byte[] Signature' property.
+
+ * MonoSymbolWriter.cs (SetAssembly): New method. This must be called before
+ Close(); the assembly parameter is the already-written assembly, ie. it must
+ contain the full metadata.
+ (OpenMethod): Only take the token argument and set MethodInfo later in DoFixups.
+ (SetMethodSourceRange): You must call this function to tell the symbol writer
+ in which source file the method is defined.
+ (DefineLocal): Store the signature in the local.
+ (DoFixups): Use two new interncalls to set the SourceMethod's MethodInfo field
+ and the LocalVariable's Type field.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceBlock): New interface.
+ (ILocalVariable): Renamed this interface to IVariable.
+ (IVariable): Added Line, Type, Token.
+ (ILocalVariable, IMethodParameter): New interfaces, derive from IVariable.
+ (ISourceMethod): Added Blocks. Renamed FirstLine and LastLine to Start and End,
+ changed their type to ISourceLine. Removed CodeSize.
+ (ISourceLine): Renamed Line to Row, added Column. Added OffsetType and Offset.
+
+ * MonoDwarfFileWriter.cs (MonoDwarfFileWriter.DieLexicalBlock): New class.
+ (MonoDwarfFileWriter.DieMethodVariable): New class.
+
+ * MonoSymbolWriter.cs (OpenScope, CloseScope): Implemented.
+ Reflected latest IMonoSymbolWriter interface changes.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * IAssemblerWriter.cs: New interface.
+
+ * AssemblerWriterI386.cs: New class.
+
+ * MonoDwarfFileWriter.cs: Use the IAssemblerWriter interface to make this class
+ platform and assembler independent.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceMethod): Added FirstLine, LastLine, CodeSize and
+ Token properties.
+
+ * MonoDwarfFileWriter.cs: Implemented line number support.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceFile, ISourceMethod, ISourceLine, ILocalVariable):
+ New interfaces.
+
+ * IMonoSymbolWriter.cs (OpenMethod): Take a System.Reflection.MethodInfo, not
+ a string.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ This is an implementation of the System.Diagnostics.SymbolStore.SymbolWriter
+ interface. It's still work in progress and not yet used anywhere.
+
+ There is some preliminary documentation in the source files and some more
+ docu in the README and README.relocation-table files.
+
+ * IMonoSymbolWriter.cs: New file.
+ * MonoDwarfFileWriter.cs: New file.
+ * MonoSymbolDocumentWriter.cs: New file.
+ * MonoSymbolWriter.cs: New file.
+
+ * README, README.relocation-table: Documentation.
+
diff --git a/mcs/class/Mono.CSharp.Debugger/IMonoBinaryReader.cs b/mcs/class/Mono.CSharp.Debugger/IMonoBinaryReader.cs
new file mode 100644
index 00000000000..33c8e44e565
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/IMonoBinaryReader.cs
@@ -0,0 +1,26 @@
+//
+// System.Diagnostics.SymbolStore/IMonoBinaryReader.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace Mono.CSharp.Debugger
+{
+ public interface IMonoBinaryReader
+ {
+ long Position {
+ get; set;
+ }
+
+ int ReadInt32 ();
+
+ long ReadInt64 ();
+
+ byte[] ReadBuffer (int size);
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs b/mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs
new file mode 100644
index 00000000000..e14052a40bb
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs
@@ -0,0 +1,47 @@
+//
+// System.Diagnostics.SymbolStore/IMonoSymbolWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This interface is derived from System.Diagnostics.SymbolStore.ISymbolWriter.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Collections;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ public interface IMonoSymbolWriter : System.Diagnostics.SymbolStore.ISymbolWriter
+ {
+ void Initialize (string assembly_filename, string filename, string[] args);
+ }
+
+ internal enum SourceOffsetType
+ {
+ OFFSET_NONE,
+ OFFSET_IL,
+ OFFSET_LOCAL,
+ OFFSET_PARAMETER
+ }
+
+ internal interface ITypeHandle
+ {
+ string Name {
+ get;
+ }
+
+ Type Type {
+ get;
+ }
+
+ int Token {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build b/mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build
new file mode 100644
index 00000000000..04c1931126a
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.CSharp.Debugger.dll -->
+
+<project name="Mono.CSharp.Debugger" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.CSharp.Debugger.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.CSharp.Debugger.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs
new file mode 100644
index 00000000000..27c4ea48749
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs
@@ -0,0 +1,60 @@
+//
+// System.Diagnostics.SymbolStore/MonoSymbolDocumentWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This is the default implementation of the
+// System.Diagnostics.SymbolStore.ISymbolDocumentWriter interface.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics.SymbolStore;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+
+ public class MonoSymbolDocumentWriter : ISymbolDocumentWriter
+ {
+ protected string url;
+
+ //
+ // Constructor
+ //
+ public MonoSymbolDocumentWriter (string url)
+ {
+ this.url = url;
+ }
+
+ public string FileName {
+ get {
+ return url;
+ }
+ }
+
+ //
+ // Interface ISymbolDocumentWriter
+ //
+
+ //
+ // MonoSymbolWriter creates a DWARF 2 debugging file and DWARF operates
+ // on file names, but has no way to include a whole source file in the
+ // symbol file.
+ //
+
+ public void SetCheckSum (Guid algorithmId, byte[] checkSum)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void SetSource (byte[] source)
+ {
+ throw new NotSupportedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
new file mode 100644
index 00000000000..7692f6579fd
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
@@ -0,0 +1,419 @@
+//
+// System.Diagnostics.SymbolStore/MonoSymbolTable.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Collections;
+using System.Text;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ public struct OffsetTable
+ {
+ public const int Version = 28;
+ public const long Magic = 0x45e82623fd7fa614;
+
+ public int total_file_size;
+ public int source_table_offset;
+ public int source_table_size;
+ public int method_count;
+ public int method_table_offset;
+ public int method_table_size;
+ public int line_number_table_offset;
+ public int line_number_table_size;
+ public int local_variable_table_offset;
+ public int local_variable_table_size;
+ public int source_file_table_offset;
+ public int source_file_table_size;
+ public int source_file_count;
+ public int type_count;
+ public int type_index_table_offset;
+ public int type_index_table_size;
+
+ public OffsetTable (IMonoBinaryReader reader)
+ {
+ total_file_size = reader.ReadInt32 ();
+ source_table_offset = reader.ReadInt32 ();
+ source_table_size = reader.ReadInt32 ();
+ method_count = reader.ReadInt32 ();
+ method_table_offset = reader.ReadInt32 ();
+ method_table_size = reader.ReadInt32 ();
+ line_number_table_offset = reader.ReadInt32 ();
+ line_number_table_size = reader.ReadInt32 ();
+ local_variable_table_offset = reader.ReadInt32 ();
+ local_variable_table_size = reader.ReadInt32 ();
+ source_file_table_offset = reader.ReadInt32 ();
+ source_file_table_size = reader.ReadInt32 ();
+ source_file_count = reader.ReadInt32 ();
+ type_count = reader.ReadInt32 ();
+ type_index_table_offset = reader.ReadInt32 ();
+ type_index_table_size = reader.ReadInt32 ();
+ }
+
+ public void Write (BinaryWriter bw)
+ {
+ bw.Write (total_file_size);
+ bw.Write (source_table_offset);
+ bw.Write (source_table_size);
+ bw.Write (method_count);
+ bw.Write (method_table_offset);
+ bw.Write (method_table_size);
+ bw.Write (line_number_table_offset);
+ bw.Write (line_number_table_size);
+ bw.Write (local_variable_table_offset);
+ bw.Write (local_variable_table_size);
+ bw.Write (source_file_table_offset);
+ bw.Write (source_file_table_size);
+ bw.Write (source_file_count);
+ bw.Write (type_count);
+ bw.Write (type_index_table_offset);
+ bw.Write (type_index_table_size);
+ }
+ }
+
+ public struct LineNumberEntry
+ {
+ public readonly int Row;
+ public readonly int Offset;
+
+ public LineNumberEntry (int row, int offset)
+ {
+ this.Row = row;
+ this.Offset = offset;
+ }
+
+ internal LineNumberEntry (SourceLine line)
+ : this (line.Row, line.Offset)
+ { }
+
+ public LineNumberEntry (IMonoBinaryReader reader)
+ {
+ Row = reader.ReadInt32 ();
+ Offset = reader.ReadInt32 ();
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ bw.Write (Row);
+ bw.Write (Offset);
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[Line {0}:{1}]", Row, Offset);
+ }
+ }
+
+ public struct LocalVariableEntry
+ {
+ public readonly string Name;
+ public readonly FieldAttributes Attributes;
+ public readonly byte[] Signature;
+
+ public LocalVariableEntry (string Name, FieldAttributes Attributes, byte[] Signature)
+ {
+ this.Name = Name;
+ this.Attributes = Attributes;
+ this.Signature = Signature;
+ }
+
+ public LocalVariableEntry (IMonoBinaryReader reader)
+ {
+ int name_length = reader.ReadInt32 ();
+ byte[] name = reader.ReadBuffer (name_length);
+ Name = Encoding.UTF8.GetString (name);
+ Attributes = (FieldAttributes) reader.ReadInt32 ();
+ int sig_length = reader.ReadInt32 ();
+ Signature = reader.ReadBuffer (sig_length);
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ byte[] name = Encoding.UTF8.GetBytes (Name);
+ bw.Write ((int) name.Length);
+ bw.Write (name);
+ bw.Write ((int) Attributes);
+ bw.Write ((int) Signature.Length);
+ bw.Write (Signature);
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[LocalVariable {0}:{1}]", Name, Attributes);
+ }
+ }
+
+ public class SourceFileEntry
+ {
+ public readonly string SourceFile;
+
+ IMonoBinaryReader reader;
+ long method_position;
+ ArrayList methods;
+ int count;
+
+ internal SourceFileEntry (string source_file)
+ {
+ this.SourceFile = source_file;
+ this.methods = new ArrayList ();
+ this.count = 0;
+ }
+
+ internal void AddMethod (MethodSourceEntry method)
+ {
+ methods.Add (method);
+ count++;
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ byte[] name = Encoding.UTF8.GetBytes (SourceFile);
+ bw.Write ((int) name.Length);
+ bw.Write (name);
+
+ methods.Sort ();
+ bw.Write (methods.Count);
+ foreach (MethodSourceEntry method in methods)
+ method.Write (bw);
+ }
+
+ public SourceFileEntry (IMonoBinaryReader reader)
+ {
+ int name_length = reader.ReadInt32 ();
+ byte[] name = reader.ReadBuffer (name_length);
+ SourceFile = Encoding.UTF8.GetString (name);
+
+ count = reader.ReadInt32 ();
+ this.reader = reader;
+ this.method_position = reader.Position;
+
+ reader.Position += count * MethodSourceEntry.Size;
+ }
+
+ public MethodSourceEntry[] Methods {
+ get {
+ read_methods ();
+ MethodSourceEntry[] retval = new MethodSourceEntry [methods.Count];
+ methods.CopyTo (retval, 0);
+ return retval;
+ }
+ }
+
+ void read_methods ()
+ {
+ if (methods != null)
+ return;
+
+ reader.Position = method_position;
+ methods = new ArrayList ();
+ for (int i = 0; i < count; i++)
+ methods.Add (new MethodSourceEntry (reader));
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("SourceFileEntry ({0}:{1})", SourceFile, count);
+ }
+ }
+
+ public struct MethodSourceEntry : IComparable
+ {
+ public readonly int Index;
+ public readonly int FileOffset;
+ public readonly int StartRow;
+ public readonly int EndRow;
+
+ public MethodSourceEntry (int index, int file_offset, int start, int end)
+ {
+ this.Index = index;
+ this.FileOffset = file_offset;
+ this.StartRow = start;
+ this.EndRow = end;
+ }
+
+ public MethodSourceEntry (IMonoBinaryReader reader)
+ {
+ Index = reader.ReadInt32 ();
+ FileOffset = reader.ReadInt32 ();
+ StartRow = reader.ReadInt32 ();
+ EndRow = reader.ReadInt32 ();
+ }
+
+ public static int Size
+ {
+ get {
+ return 16;
+ }
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ bw.Write (Index);
+ bw.Write (FileOffset);
+ bw.Write (StartRow);
+ bw.Write (EndRow);
+ }
+
+ public int CompareTo (object obj)
+ {
+ MethodSourceEntry method = (MethodSourceEntry) obj;
+
+ if (method.StartRow < StartRow)
+ return -1;
+ else if (method.StartRow > StartRow)
+ return 1;
+ else
+ return 0;
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("MethodSourceEntry ({0}:{1}:{2}:{3})",
+ Index, FileOffset, StartRow, EndRow);
+ }
+ }
+
+ public class MethodEntry
+ {
+ public readonly int Token;
+ public readonly int StartRow;
+ public readonly int EndRow;
+ public readonly int NumLineNumbers;
+ public readonly int ThisTypeIndex;
+ public readonly int NumParameters;
+ public readonly int NumLocals;
+
+ public int TypeIndexTableOffset;
+ public int LocalVariableTableOffset;
+ public readonly int SourceFileOffset;
+ public readonly int LineNumberTableOffset;
+
+ public readonly string SourceFile = null;
+ public readonly LineNumberEntry[] LineNumbers = null;
+ public readonly int[] ParamTypeIndices = null;
+ public readonly int[] LocalTypeIndices = null;
+ public readonly LocalVariableEntry[] Locals = null;
+
+ public static int Size
+ {
+ get {
+ return 44;
+ }
+ }
+
+ public MethodEntry (IMonoBinaryReader reader)
+ {
+ Token = reader.ReadInt32 ();
+ StartRow = reader.ReadInt32 ();
+ EndRow = reader.ReadInt32 ();
+ ThisTypeIndex = reader.ReadInt32 ();
+ NumParameters = reader.ReadInt32 ();
+ NumLocals = reader.ReadInt32 ();
+ NumLineNumbers = reader.ReadInt32 ();
+ TypeIndexTableOffset = reader.ReadInt32 ();
+ LocalVariableTableOffset = reader.ReadInt32 ();
+ SourceFileOffset = reader.ReadInt32 ();
+ LineNumberTableOffset = reader.ReadInt32 ();
+
+ if (SourceFileOffset != 0) {
+ long old_pos = reader.Position;
+ reader.Position = SourceFileOffset;
+ int source_file_length = reader.ReadInt32 ();
+ byte[] source_file = reader.ReadBuffer (source_file_length);
+ SourceFile = Encoding.UTF8.GetString (source_file);
+ reader.Position = old_pos;
+ }
+
+ if (LineNumberTableOffset != 0) {
+ long old_pos = reader.Position;
+ reader.Position = LineNumberTableOffset;
+
+ LineNumbers = new LineNumberEntry [NumLineNumbers];
+
+ for (int i = 0; i < NumLineNumbers; i++)
+ LineNumbers [i] = new LineNumberEntry (reader);
+
+ reader.Position = old_pos;
+ }
+
+ if (LocalVariableTableOffset != 0) {
+ long old_pos = reader.Position;
+ reader.Position = LocalVariableTableOffset;
+
+ Locals = new LocalVariableEntry [NumLocals];
+
+ for (int i = 0; i < NumLocals; i++)
+ Locals [i] = new LocalVariableEntry (reader);
+
+ reader.Position = old_pos;
+ }
+
+ if (TypeIndexTableOffset != 0) {
+ long old_pos = reader.Position;
+ reader.Position = TypeIndexTableOffset;
+
+ ParamTypeIndices = new int [NumParameters];
+ LocalTypeIndices = new int [NumLocals];
+
+ for (int i = 0; i < NumParameters; i++)
+ ParamTypeIndices [i] = reader.ReadInt32 ();
+ for (int i = 0; i < NumLocals; i++)
+ LocalTypeIndices [i] = reader.ReadInt32 ();
+
+ reader.Position = old_pos;
+ }
+ }
+
+ internal MethodEntry (int token, int sf_offset, string source_file,
+ int this_type_index, int[] param_type_indices,
+ int[] local_type_indices, LocalVariableEntry[] locals,
+ LineNumberEntry[] lines, int lnt_offset,
+ int start_row, int end_row)
+ {
+ this.Token = token;
+ this.StartRow = start_row;
+ this.EndRow = end_row;
+ this.NumLineNumbers = lines.Length;
+ this.ThisTypeIndex = this_type_index;
+ this.NumParameters = param_type_indices.Length;
+ this.NumLocals = local_type_indices.Length;
+ this.ParamTypeIndices = param_type_indices;
+ this.LocalTypeIndices = local_type_indices;
+ this.Locals = locals;
+ this.SourceFileOffset = sf_offset;
+ this.LineNumberTableOffset = lnt_offset;
+ this.SourceFile = source_file;
+ this.LineNumbers = lines;
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ bw.Write (Token);
+ bw.Write (StartRow);
+ bw.Write (EndRow);
+ bw.Write (ThisTypeIndex);
+ bw.Write (NumParameters);
+ bw.Write (NumLocals);
+ bw.Write (NumLineNumbers);
+ bw.Write (TypeIndexTableOffset);
+ bw.Write (LocalVariableTableOffset);
+ bw.Write (SourceFileOffset);
+ bw.Write (LineNumberTableOffset);
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[Method {0}:{1}:{2}:{3}:{4} - {5}:{6}]",
+ Token, SourceFile, StartRow, EndRow,
+ NumLineNumbers, SourceFileOffset, LineNumberTableOffset);
+ }
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs
new file mode 100644
index 00000000000..4e8e1595b9d
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs
@@ -0,0 +1,213 @@
+//
+// System.Diagnostics.SymbolStore/MonoSymbolTableWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Collections;
+using System.Text;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ internal class MonoSymbolTableWriter : IDisposable
+ {
+ BinaryWriter bw;
+ Hashtable type_hash;
+ int last_type_index;
+
+ public MonoSymbolTableWriter (string output_filename)
+ {
+ FileStream stream = new FileStream (output_filename, FileMode.Create);
+ bw = new BinaryWriter (stream);
+ type_hash = new Hashtable ();
+ }
+
+ int GetTypeIndex (Type type)
+ {
+ if (type_hash.Contains (type))
+ return (int) type_hash [type];
+
+ int index = ++last_type_index;
+ type_hash.Add (type, index);
+ return index;
+ }
+
+ public void WriteSymbolTable (MonoSymbolWriter symwriter)
+ {
+ // Magic number and file version.
+ bw.Write (OffsetTable.Magic);
+ bw.Write (OffsetTable.Version);
+
+ OffsetTable ot = new OffsetTable ();
+
+ //
+ // Offsets of file sections; we must write this after we're done
+ // writing the whole file, so we just reserve the space for it here.
+ //
+ long offset_table_offset = bw.BaseStream.Position;
+ ot.Write (bw);
+
+ //
+ // Write source file table.
+ //
+ Hashtable sources = new Hashtable ();
+
+ ot.source_table_offset = (int) bw.BaseStream.Position;
+ foreach (SourceFile source in symwriter.Sources) {
+ if (sources.ContainsKey (source))
+ continue;
+
+ sources.Add (source, (int) bw.BaseStream.Position);
+ byte[] file_name = Encoding.UTF8.GetBytes (source.FileName);
+ bw.Write ((int) file_name.Length);
+ bw.Write (file_name);
+ }
+ ot.source_table_size = (int) bw.BaseStream.Position - ot.source_table_offset;
+
+ Hashtable source_table = new Hashtable ();
+
+ //
+ // Write line number table
+ //
+ ArrayList methods = new ArrayList ();
+
+ int num_methods = 0;
+
+ ot.line_number_table_offset = (int) bw.BaseStream.Position;
+ foreach (SourceMethod method in symwriter.Methods) {
+ if (method.Start == null || method.Start.Row == 0)
+ continue;
+
+ int count = method.Lines.Length;
+ LineNumberEntry[] lines = new LineNumberEntry [count];
+
+ int pos = (int) bw.BaseStream.Position;
+
+ int num_params = method.Parameters.Length;
+ int[] param_type_indices = new int [num_params];
+ for (int i = 0; i < num_params; i++) {
+ Type type = method.Parameters [i].ParameterType;
+ param_type_indices [i] = GetTypeIndex (type);
+ }
+
+ int num_locals = method.Locals.Length;
+ int[] local_type_indices = new int [num_locals];
+ for (int i = 0; i < num_locals; i++)
+ local_type_indices [i] = ++last_type_index;
+
+ int type_index_table_offset = ot.type_index_table_size;
+ ot.type_index_table_size += 4 * (num_params + num_locals);
+
+ int this_type_index = 0;
+ if (!method.MethodBase.IsStatic)
+ this_type_index = GetTypeIndex (method.MethodBase.ReflectedType);
+
+ for (int i = 0; i < count; i++) {
+ lines [i] = new LineNumberEntry (method.Lines [i]);
+ lines [i].Write (bw);
+ }
+
+ MethodEntry entry = new MethodEntry (
+ (int) method.Token, (int) sources [method.SourceFile],
+ method.SourceFile.FileName, this_type_index,
+ param_type_indices, local_type_indices, method.Locals, lines, pos,
+ (int) method.Start.Row, (int) method.End.Row);
+
+ methods.Add (entry);
+ }
+ ot.line_number_table_size = (int) bw.BaseStream.Position -
+ ot.line_number_table_offset;
+
+ //
+ // Write type index table.
+ //
+
+ ot.type_index_table_offset = (int) bw.BaseStream.Position;
+ for (int i = 0; i < methods.Count; i++) {
+ MethodEntry entry = (MethodEntry) methods [i];
+
+ entry.TypeIndexTableOffset = (int) bw.BaseStream.Position;
+
+ for (int j = 0; j < entry.NumParameters; j++)
+ bw.Write (entry.ParamTypeIndices [j]);
+ for (int j = 0; j < entry.NumLocals; j++)
+ bw.Write (entry.LocalTypeIndices [j]);
+ }
+ ot.type_index_table_size = (int) bw.BaseStream.Position -
+ ot.type_index_table_offset;
+
+ //
+ // Write local variable table.
+ //
+
+ ot.local_variable_table_offset = (int) bw.BaseStream.Position;
+ for (int i = 0; i < methods.Count; i++) {
+ MethodEntry entry = (MethodEntry) methods [i];
+
+ entry.LocalVariableTableOffset = (int) bw.BaseStream.Position;
+
+ for (int j = 0; j < entry.NumLocals; j++)
+ entry.Locals [j].Write (bw);
+ }
+ ot.local_variable_table_size = (int) bw.BaseStream.Position -
+ ot.local_variable_table_offset;
+
+ //
+ // Write method table
+ //
+ ot.method_count = methods.Count;
+ ot.method_table_offset = (int) bw.BaseStream.Position;
+ for (int i = 0; i < methods.Count; i++) {
+ MethodEntry entry = (MethodEntry) methods [i];
+ SourceFileEntry source = (SourceFileEntry) source_table [entry.SourceFileOffset];
+ if (source == null) {
+ source = new SourceFileEntry (entry.SourceFile);
+ source_table.Add (entry.SourceFileOffset, source);
+ }
+
+ source.AddMethod (new MethodSourceEntry (
+ i, (int) bw.BaseStream.Position, entry.StartRow, entry.EndRow));
+
+ entry.Write (bw);
+ }
+ ot.method_table_size = (int) bw.BaseStream.Position - ot.method_table_offset;
+
+ //
+ // Write source file table.
+ //
+ ot.source_file_count = source_table.Count;
+ ot.source_file_table_offset = (int) bw.BaseStream.Position;
+ foreach (SourceFileEntry source in source_table.Values)
+ source.Write (bw);
+ ot.source_file_table_size = (int) bw.BaseStream.Position - ot.source_file_table_offset;
+
+ //
+ // Write offset table
+ //
+ ot.type_count = last_type_index;
+ ot.total_file_size = (int) bw.BaseStream.Position;
+ bw.Seek ((int) offset_table_offset, SeekOrigin.Begin);
+ ot.Write (bw);
+ bw.Seek (0, SeekOrigin.End);
+ }
+
+ void IDisposable.Dispose() {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing)
+ {
+ bw.Close ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
new file mode 100755
index 00000000000..8293b2a75d4
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
@@ -0,0 +1,643 @@
+//
+// System.Diagnostics.SymbolStore/MonoSymbolWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This is the default implementation of the System.Diagnostics.SymbolStore.ISymbolWriter
+// interface.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.SymbolStore;
+using System.Collections;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ internal class SourceFile
+ {
+ private ArrayList _methods = new ArrayList ();
+ private string _file_name;
+
+ public SourceFile (string filename)
+ {
+ this._file_name = filename;
+ }
+
+ public override string ToString ()
+ {
+ return _file_name;
+ }
+
+ public string FileName {
+ get {
+ return _file_name;
+ }
+ }
+
+ public SourceMethod[] Methods {
+ get {
+ SourceMethod[] retval = new SourceMethod [_methods.Count];
+ _methods.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddMethod (SourceMethod method)
+ {
+ _methods.Add (method);
+ }
+ }
+
+ internal class SourceBlock
+ {
+ static private int next_index;
+ private readonly int _index;
+
+ public SourceBlock (SourceMethod method, SourceLine start, SourceLine end)
+ {
+ this._method = method;
+ this._start = start;
+ this._end = end;
+ this._index = ++next_index;
+ }
+
+ internal SourceBlock (SourceMethod method, int startOffset)
+ {
+ this._method = method;
+ this._start = new SourceLine (startOffset);
+ this._index = ++next_index;
+ }
+
+ public override string ToString ()
+ {
+ return "SourceBlock #" + ID + " (" + Start + " - " + End + ")";
+ }
+
+ private readonly SourceMethod _method;
+ private ArrayList _blocks = new ArrayList ();
+ internal SourceLine _start;
+ internal SourceLine _end;
+
+ private ArrayList _locals = new ArrayList ();
+
+ public SourceMethod SourceMethod {
+ get {
+ return _method;
+ }
+ }
+
+ public SourceBlock[] Blocks {
+ get {
+ SourceBlock[] retval = new SourceBlock [_blocks.Count];
+ _blocks.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddBlock (SourceBlock block)
+ {
+ _blocks.Add (block);
+ }
+
+ public SourceLine Start {
+ get {
+ return _start;
+ }
+ }
+
+ public SourceLine End {
+ get {
+ return _end;
+ }
+ }
+
+ public int ID {
+ get {
+ return _index;
+ }
+ }
+
+ public LocalVariableEntry[] Locals {
+ get {
+ LocalVariableEntry[] retval = new LocalVariableEntry [_locals.Count];
+ _locals.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddLocal (LocalVariableEntry local)
+ {
+ _locals.Add (local);
+ }
+ }
+
+ internal class SourceLine
+ {
+ public SourceLine (int row, int column)
+ : this (0, row, column)
+ {
+ this._type = SourceOffsetType.OFFSET_NONE;
+ }
+
+ public SourceLine (int offset, int row, int column)
+ {
+ this._offset = offset;
+ this._row = row;
+ this._column = column;
+ this._type = SourceOffsetType.OFFSET_IL;
+ }
+
+ internal SourceLine (int offset)
+ : this (offset, 0, 0)
+ { }
+
+ public override string ToString ()
+ {
+ return "SourceLine (" + _offset + "@" + _row + ":" + _column + ")";
+ }
+
+ internal SourceOffsetType _type;
+ internal int _offset;
+ internal int _row;
+ internal int _column;
+
+ // interface SourceLine
+
+ public SourceOffsetType OffsetType {
+ get {
+ return _type;
+ }
+ }
+
+ public int Offset {
+ get {
+ return _offset;
+ }
+ }
+
+ public int Row {
+ get {
+ return _row;
+ }
+ }
+
+ public int Column {
+ get {
+ return _column;
+ }
+ }
+ }
+
+ internal class SourceMethod
+ {
+ private ArrayList _lines = new ArrayList ();
+ private ArrayList _blocks = new ArrayList ();
+ private Hashtable _block_hash = new Hashtable ();
+ private Stack _block_stack = new Stack ();
+
+ internal readonly MethodBase _method_base;
+ internal SourceFile _source_file;
+ internal int _token;
+
+ private SourceBlock _implicit_block;
+
+ public SourceMethod (MethodBase method_base, SourceFile source_file)
+ : this (method_base)
+ {
+ this._source_file = source_file;
+ }
+
+ internal SourceMethod (MethodBase method_base)
+ {
+ this._method_base = method_base;
+
+ this._implicit_block = new SourceBlock (this, 0);
+ }
+
+ public void SetSourceRange (SourceFile sourceFile,
+ int startLine, int startColumn,
+ int endLine, int endColumn)
+ {
+ _source_file = sourceFile;
+ _implicit_block._start = new SourceLine (startLine, startColumn);
+ _implicit_block._end = new SourceLine (endLine, endColumn);
+ }
+
+
+ public void StartBlock (SourceBlock block)
+ {
+ _block_stack.Push (block);
+ }
+
+ public void EndBlock (int endOffset) {
+ SourceBlock block = (SourceBlock) _block_stack.Pop ();
+
+ block._end = new SourceLine (endOffset);
+
+ if (_block_stack.Count > 0) {
+ SourceBlock parent = (SourceBlock) _block_stack.Peek ();
+
+ parent.AddBlock (block);
+ } else
+ _blocks.Add (block);
+
+ _block_hash.Add (block.ID, block);
+ }
+
+ public void SetBlockRange (int BlockID, int startOffset, int endOffset)
+ {
+ SourceBlock block = (SourceBlock) _block_hash [BlockID];
+ ((SourceLine) block.Start)._offset = startOffset;
+ ((SourceLine) block.End)._offset = endOffset;
+ }
+
+ public SourceBlock CurrentBlock {
+ get {
+ if (_block_stack.Count > 0)
+ return (SourceBlock) _block_stack.Peek ();
+ else
+ return _implicit_block;
+ }
+ }
+
+ public SourceLine[] Lines {
+ get {
+ SourceLine[] retval = new SourceLine [_lines.Count];
+ _lines.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddLine (SourceLine line)
+ {
+ _lines.Add (line);
+ }
+
+ public SourceBlock[] Blocks {
+ get {
+ SourceBlock[] retval = new SourceBlock [_blocks.Count];
+ _blocks.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public LocalVariableEntry[] Locals {
+ get {
+ return _implicit_block.Locals;
+ }
+ }
+
+ public void AddLocal (LocalVariableEntry local)
+ {
+ _implicit_block.AddLocal (local);
+ }
+
+ public MethodBase MethodBase {
+ get {
+ return _method_base;
+ }
+ }
+
+ public string FullName {
+ get {
+ return _method_base.DeclaringType.FullName + "." + _method_base.Name;
+ }
+ }
+
+ public Type ReturnType {
+ get {
+ if (_method_base is MethodInfo)
+ return ((MethodInfo)_method_base).ReturnType;
+ else if (_method_base is ConstructorInfo)
+ return _method_base.DeclaringType;
+ else
+ throw new NotSupportedException ();
+ }
+ }
+
+ public ParameterInfo[] Parameters {
+ get {
+ if (_method_base == null)
+ return new ParameterInfo [0];
+
+ ParameterInfo [] retval = _method_base.GetParameters ();
+ if (retval == null)
+ return new ParameterInfo [0];
+ else
+ return retval;
+ }
+ }
+
+ public SourceFile SourceFile {
+ get {
+ return _source_file;
+ }
+ }
+
+ public int Token {
+ get {
+ if (_token != 0)
+ return _token;
+ else
+ throw new NotSupportedException ();
+ }
+ }
+
+ public SourceLine Start {
+ get {
+ return _implicit_block.Start;
+ }
+ }
+
+ public SourceLine End {
+ get {
+ return _implicit_block.End;
+ }
+ }
+ }
+
+ public class MonoSymbolWriter : IMonoSymbolWriter
+ {
+ protected Assembly assembly;
+ protected ModuleBuilder module_builder;
+ protected ArrayList locals = null;
+ protected ArrayList orphant_methods = null;
+ protected ArrayList methods = null;
+ protected Hashtable sources = null;
+ private ArrayList mbuilder_array = null;
+
+ internal SourceMethod[] Methods {
+ get {
+ SourceMethod[] retval = new SourceMethod [methods.Count];
+ methods.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ internal SourceFile[] Sources {
+ get {
+ SourceFile[] retval = new SourceFile [sources.Count];
+ sources.Values.CopyTo (retval, 0);
+ return retval;
+ }
+ }
+
+ private SourceMethod current_method = null;
+ private string assembly_filename = null;
+ private string output_filename = null;
+
+ //
+ // Interface IMonoSymbolWriter
+ //
+
+ public MonoSymbolWriter (ModuleBuilder mb, string filename, ArrayList mbuilder_array)
+ {
+ this.assembly_filename = filename;
+ this.module_builder = mb;
+ this.methods = new ArrayList ();
+ this.sources = new Hashtable ();
+ this.orphant_methods = new ArrayList ();
+ this.locals = new ArrayList ();
+ this.mbuilder_array = mbuilder_array;
+ }
+
+ public void Close () {
+ if (assembly == null)
+ assembly = Assembly.LoadFrom (assembly_filename);
+
+ DoFixups (assembly);
+
+ CreateOutput (assembly);
+ }
+
+ public void CloseNamespace () {
+ }
+
+ // Create and return a new IMonoSymbolDocumentWriter.
+ public ISymbolDocumentWriter DefineDocument (string url,
+ Guid language,
+ Guid languageVendor,
+ Guid documentType)
+ {
+ return new MonoSymbolDocumentWriter (url);
+ }
+
+ public void DefineField (
+ SymbolToken parent,
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void DefineGlobalVariable (
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void DefineLocalVariable (string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3,
+ int startOffset,
+ int endOffset)
+ {
+ if (current_method == null)
+ return;
+
+ current_method.AddLocal (new LocalVariableEntry (name, attributes, signature));
+ }
+
+ public void DefineParameter (string name,
+ ParameterAttributes attributes,
+ int sequence,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void DefineSequencePoints (ISymbolDocumentWriter document,
+ int[] offsets,
+ int[] lines,
+ int[] columns,
+ int[] endLines,
+ int[] endColumns)
+ {
+ if (current_method == null)
+ return;
+
+ SourceLine source_line = new SourceLine (offsets [0], lines [0], columns [0]);
+
+ if (current_method != null)
+ current_method.AddLine (source_line);
+ }
+
+ public void Initialize (IntPtr emitter, string filename, bool fFullBuild)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void Initialize (string assembly_filename, string filename, string[] args)
+ {
+ this.output_filename = filename;
+ this.assembly_filename = assembly_filename;
+ }
+
+ public void OpenMethod (SymbolToken symbol_token)
+ {
+ int token = symbol_token.GetToken ();
+
+ if ((token & 0xff000000) != 0x06000000)
+ throw new ArgumentException ();
+
+ int index = (token & 0xffffff) - 1;
+
+ MethodBase mb = (MethodBase) mbuilder_array [index];
+
+ current_method = new SourceMethod (mb);
+
+ methods.Add (current_method);
+ }
+
+ public void SetMethodSourceRange (ISymbolDocumentWriter startDoc,
+ int startLine, int startColumn,
+ ISymbolDocumentWriter endDoc,
+ int endLine, int endColumn)
+ {
+ if (current_method == null)
+ return;
+
+ if ((startDoc == null) || (endDoc == null))
+ throw new NullReferenceException ();
+
+ if (!(startDoc is MonoSymbolDocumentWriter) || !(endDoc is MonoSymbolDocumentWriter))
+ throw new NotSupportedException ("both startDoc and endDoc must be of type "
+ + "MonoSymbolDocumentWriter");
+
+ if (!startDoc.Equals (endDoc))
+ throw new NotSupportedException ("startDoc and endDoc must be the same");
+
+ string source_file = ((MonoSymbolDocumentWriter) startDoc).FileName;
+ SourceFile source_info;
+
+ if (sources.ContainsKey (source_file))
+ source_info = (SourceFile) sources [source_file];
+ else {
+ source_info = new SourceFile (source_file);
+ sources.Add (source_file, source_info);
+ }
+
+ current_method.SetSourceRange (source_info, startLine, startColumn,
+ endLine, endColumn);
+
+ source_info.AddMethod (current_method);
+ }
+
+ public void CloseMethod () {
+ current_method = null;
+ }
+
+ public void OpenNamespace (string name)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public int OpenScope (int startOffset)
+ {
+ if (current_method == null)
+ return 0;
+
+ SourceBlock block = new SourceBlock (current_method, startOffset);
+ current_method.StartBlock (block);
+
+ return block.ID;
+ }
+
+ public void CloseScope (int endOffset) {
+ if (current_method == null)
+ return;
+
+ current_method.EndBlock (endOffset);
+ }
+
+ public void SetScopeRange (int scopeID, int startOffset, int endOffset)
+ {
+ if (current_method == null)
+ return;
+
+ current_method.SetBlockRange (scopeID, startOffset, endOffset);
+ }
+
+ public void SetSymAttribute (SymbolToken parent, string name, byte[] data)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void SetUnderlyingWriter (IntPtr underlyingWriter)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void SetUserEntryPoint (SymbolToken entryMethod)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void UsingNamespace (string fullName)
+ {
+ throw new NotSupportedException ();
+ }
+
+ //
+ // MonoSymbolWriter implementation
+ //
+ protected void DoFixups (Assembly assembly)
+ {
+ foreach (SourceMethod method in methods) {
+ if (method._method_base is MethodBuilder) {
+ MethodBuilder mb = (MethodBuilder) method._method_base;
+ method._token = mb.GetToken ().Token;
+ } else if (method._method_base is ConstructorBuilder) {
+ ConstructorBuilder cb = (ConstructorBuilder) method._method_base;
+ method._token = cb.GetToken ().Token;
+ } else
+ throw new NotSupportedException ();
+
+ if (method.SourceFile == null)
+ orphant_methods.Add (method);
+ }
+ }
+
+ protected void CreateOutput (Assembly assembly)
+ {
+ using (MonoSymbolTableWriter writer = new MonoSymbolTableWriter (output_filename))
+ writer.WriteSymbolTable (this);
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.CSharp.Debugger/list.unix b/mcs/class/Mono.CSharp.Debugger/list.unix
new file mode 100644
index 00000000000..bc2f020249e
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/list.unix
@@ -0,0 +1,6 @@
+IMonoSymbolWriter.cs
+MonoSymbolDocumentWriter.cs
+MonoSymbolWriter.cs
+MonoSymbolTable.cs
+MonoSymbolTableWriter.cs
+IMonoBinaryReader.cs
diff --git a/mcs/class/Mono.CSharp.Debugger/makefile.gnu b/mcs/class/Mono.CSharp.Debugger/makefile.gnu
new file mode 100644
index 00000000000..092d442937c
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.CSharp.Debugger.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib
+
+SOURCES_INCLUDE=*.cs
+
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.DB2Client/ChangeLog b/mcs/class/Mono.Data.DB2Client/ChangeLog
new file mode 100644
index 00000000000..8dd5076c36d
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/ChangeLog
@@ -0,0 +1,27 @@
+2003-01-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.Db2Client/DB2ClientConnection.cs: added parsing and setting
+ of connection string values. Prior to this change, the server, username, and
+ authentication were hard-coded.
+
+ * Mono.Data.Db2Client/DB2ClientUtils.cs: prevent warning about
+ unreachable code
+
+ * Test/TestDB2Conn/TestDB2Conn.cs: modify test to accept
+ database, username, and password from command line. Also, test
+ a CREATE TABLE statement with ExecuteNonQuery()
+
+2003-01-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.Db2Client.build: added file for Windows build
+
+2003-01-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * makefile.gnu: added --unsafe command line option, needed for unsafe
+ code. The IBM DB2 provider now compiles on Mono.
+
+ * list: added missing file.
+
+2003-01-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ Added IBM DB2 provider from cleared <cleared@rogers.com>.
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.DB2Client.build b/mcs/class/Mono.Data.DB2Client/Mono.Data.DB2Client.build
new file mode 100755
index 00000000000..9d8794bd161
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.DB2Client.build
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.DB2Client.dll -->
+
+<project name="Mono.Data.DB2Client" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.DB2Client.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/System.Data.dll" tofile="Test/System.Data.dll"/>
+ <copy file="../lib/Mono.Data.DB2Client.dll" tofile="Test/Mono.Data.DB2Client.dll"/>
+ <copy file="../lib/Mono.Data.DB2Client.dll" tofile="Mono.Data.DB2Client/Mono.Data.DB2Client.dll"/>
+ <copy file="../lib/Mono.Data.DB2Client.dll" tofile="../System.Data/Test/Mono.Data.DB2Client.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="Test/System.Data.dll" failonerror="false"/>
+ <delete file="../lib/Mono.Data.DB2Client.dll" failonerror="false"/>
+ <delete file="Test/Mono.Data.DB2Client.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/AssemblyInfo.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientCommand.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientCommand.cs
new file mode 100644
index 00000000000..333f4206f85
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientCommand.cs
@@ -0,0 +1,279 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// Summary description for DB2ClientCommand.
+ /// </summary>
+ public class DB2ClientCommand : IDbCommand
+ {
+ #region Private data members
+ private string commandText;
+ private DB2ClientConnection db2Conn;
+ private DB2ClientTransaction db2Trans;
+ private int commandTimeout;
+ private bool prepared = false;
+ private IntPtr hwndStmt; //Our statement handle
+
+ #endregion
+
+ #region Constructors
+ /// <summary>
+ /// Default constructor. Since I'm using CLI functions to do this stuff, we're stuck
+ /// until we get the database environment handle.
+ /// </summary>
+ public DB2ClientCommand()
+ {
+ hwndStmt = IntPtr.Zero;
+ }
+ public DB2ClientCommand(string commandStr)
+ {
+ commandText = commandStr;
+ hwndStmt = IntPtr.Zero;
+ }
+ public DB2ClientCommand(string commandStr, DB2ClientConnection con)
+ {
+ commandText = commandStr;
+ db2Conn = con;
+ AllocateStatement("Constructor 3");
+ }
+ public DB2ClientCommand (string commandStr, DB2ClientConnection con, DB2ClientTransaction trans)
+ {
+ commandText = commandStr;
+ db2Conn = con;
+ db2Trans = trans;
+ AllocateStatement("Constructor 4");
+ }
+ ///DB2 Specific constructors
+ ///
+ public DB2ClientCommand (IntPtr hwndSt)
+ {
+ hwndStmt = hwndSt;
+ }
+ public void Dispose()
+ {
+ }
+ #endregion
+ #region CommandText property
+ ///
+ ///The query
+ ///
+ public string CommandText
+ {
+ get
+ {
+ return commandText;
+ }
+ set
+ {
+ commandText = value;
+ }
+ }
+ #endregion
+ #region CommandTimeout property
+ ///
+ /// The Timeout property states how long we wait for results to return
+ ///
+ public int CommandTimeout
+ {
+ get
+ {
+ return commandTimeout;
+ }
+ set
+ {
+ commandTimeout = value;
+ }
+ }
+ #endregion
+ #region CommandType property
+ ///
+ /// I believe this one is left as text all of the time for DB2, but I have to check that...
+ ///
+ public CommandType CommandType
+ {
+ get
+ {
+ return CommandType.Text;
+ }
+ set
+ {
+ ///Do nothing
+ }
+ }
+ #endregion
+ #region Connection property
+ ///
+ /// The connection we'll be executing on.
+ ///
+ public IDbConnection Connection
+ {
+ get
+ {
+ return db2Conn;
+ }
+ set
+ {
+ db2Conn = (DB2ClientConnection)value;
+ }
+ }
+ #endregion
+ #region Parameters property
+ ///
+ /// Parameter list, Not yet implemented
+ ///
+ public IDataParameterCollection Parameters
+ {
+ get
+ {
+ throw new DB2ClientException("TBD");
+ }
+ }
+ #endregion
+ #region Transaction property
+ ///
+ /// The transaction this command is associated with
+ ///
+ public IDbTransaction Transaction
+ {
+ get
+ {
+ return db2Trans;
+ }
+ set
+ {
+ db2Trans = (DB2ClientTransaction)value;
+ }
+ }
+ #endregion
+ #region UpdatedRowSource property
+ ///
+ /// Need to see how this works with DB2...
+ ///
+ public UpdateRowSource UpdatedRowSource
+ {
+ get
+ {
+ throw new DB2ClientException ("TBD");
+ }
+ set
+ {
+ throw new DB2ClientException ("TBD");
+ }
+ }
+ #endregion
+ #region Statement Handle
+ ///
+ /// returns the DB2Client statement handle
+ ///
+ public IntPtr statementHandle
+ {
+ get
+ {
+ return hwndStmt;
+ }
+ }
+ #endregion
+ #region AllocateStatement function
+ ///
+ /// Allocate a statement handle, internal. Pass in the name of the caller for exception info.
+ /// I think I'll make the handle a property and add a constructor with the handle argument so that
+ /// statements can be executed on the same handle if need be, though you could accomplish the same by
+ /// just keeping the command object open.
+ ///
+ internal void AllocateStatement(string location)
+ {
+ short sqlRet;
+ sqlRet = DB2ClientPrototypes.SQLAllocHandle(DB2ClientConstants.SQL_HANDLE_STMT, db2Conn.DBHandle, ref hwndStmt);
+ if (sqlRet == DB2ClientConstants.SQL_ERROR)
+ throw new DB2ClientException(DB2ClientConstants.SQL_HANDLE_DBC, db2Conn.DBHandle, location +": Unable to allocate statement handle.");
+ }
+ #endregion
+ #region Cancel
+ /// <summary>
+ /// Attempt to cancel an executing command
+ /// </summary>
+ public void Cancel()
+ {
+ DB2ClientPrototypes.SQLCancel(hwndStmt);
+ }
+ #endregion
+ #region CreateParameter
+ ///
+ ///Returns a parameter
+ ///
+ public IDbDataParameter CreateParameter()
+ {
+ //Will wait until I get deeper into the DB2/.Net interface. I'm not sure how
+ //.Net and DB2 parameters talk to each other
+ throw new DB2ClientException("Parameters not yet supported in this driver.");
+ }
+ #endregion
+ #region ExecuteNonQuery
+ ///
+ /// ExecuteNonQuery Executes an SQL statement without returning a DataSet
+ ///
+ public int ExecuteNonQuery()
+ {
+ short sqlRet;
+ if (prepared)
+ sqlRet = DB2ClientPrototypes.SQLExecute(hwndStmt);
+ else
+ sqlRet = DB2ClientPrototypes.SQLExecDirect(hwndStmt, commandText, commandText.Length);
+
+ int numRows = 0;
+ sqlRet = DB2ClientPrototypes.SQLRowCount(hwndStmt, ref numRows); //How many rows affected. numRows will be -1 if we aren't dealing with an Insert, Delete or Update, or if the statement did not execute successfully
+ ///At this point, I think we need to save any results, but not return them
+ ///For now, we will go execute and return the number of rows affected
+ return numRows;
+ }
+ #endregion
+ #region ExecuteReader calls
+ ///
+ ///ExecuteReader
+ ///
+ public IDataReader ExecuteReader()
+ {
+
+ ExecuteNonQuery();
+ DB2ClientDataReader reader = new DB2ClientDataReader(db2Conn, this);
+ return reader;
+
+ }
+ public IDataReader ExecuteReader(CommandBehavior behavior)
+ {
+ throw new DB2ClientException("TBD");
+ }
+ #endregion
+ #region ExecuteScalar
+ ///
+ /// ExecuteScalar
+ ///
+ public object ExecuteScalar()
+ {
+ throw new DB2ClientException("TBD");
+ }
+ #endregion
+
+ #region Prepare
+ ///
+ /// Prepare
+ ///
+ public void Prepare()
+ {
+ throw new DB2ClientException("TBD");
+ }
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConnection.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConnection.cs
new file mode 100644
index 00000000000..fb90af80b89
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConnection.cs
@@ -0,0 +1,229 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ ///
+ /// Authors:
+ /// Christopher Bockner
+ ///
+ /// Copyright 2003 By Christopher Bockner
+ ///
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace DB2ClientCS
+{
+ /// <summary> /// This class is IDbConnection compliant. Refer to MSDN documentation for reference.
+ /// </summary>
+ ///
+
+ public class DB2ClientConnection : IDbConnection
+ {
+ private string connectionString = null;
+ private StringBuilder outConnectStr;
+ private string dbName = null;
+ private int connectionTimeout;
+
+ private IntPtr dbHandle = IntPtr.Zero;
+ private bool disposed = false;
+ public DB2ClientConnection()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ public DB2ClientConnection(string conString)
+ {
+ SetConnectionString(conString);
+ }
+ #region ConnectionString property
+ ///
+ ///Accessor for the connectionString property
+ public string ConnectionString
+ {
+ get
+ {
+ return connectionString;
+ }
+ set
+ {
+ SetConnectionString(value);
+ }
+ }
+ #endregion
+ #region ConnectionTimeout property
+ public int ConnectionTimeout
+ {
+ get
+ {
+ return connectionTimeout;
+ }
+ set
+ {
+ connectionTimeout = value;
+ }
+ }
+ #endregion
+ #region Database property
+ public string Database
+ {
+ get
+ {
+ return dbName;
+ }
+ set
+ {
+ dbName = value;
+ }
+ }
+ #endregion
+ #region State property
+ /// <summary>
+ /// The Connection State property, open or closed.
+ /// NOTE: IBM's docs on SqlFreeHandle do not state what is done when a handle is freed
+ /// i.e. if the handle is set to SQL_NULL_HANDLE.
+ /// </summary>
+
+ unsafe public ConnectionState State
+ {
+ get
+ {
+ if ((long)dbHandle.ToPointer() == DB2ClientConstants.SQL_NULL_HANDLE)
+ return ConnectionState.Closed;
+ else
+ return ConnectionState.Open;
+ }
+ }
+ #endregion
+ #region DBHandle
+ ///
+ /// Handle Returns an IntPtr of the dbm handle
+ ///
+ public IntPtr DBHandle
+ {
+ get
+ {
+ return dbHandle;
+ }
+ }
+ #endregion
+
+ #region BeginTransaction Method
+ /// <summary>
+ /// Opens a transaction against the database at the default isolation level, which will be
+ /// that which the packages were bound at, unless overriden in the connection string, and if nothing was specified at that point
+ /// then I believe the default level is Cursor Stability (don't quote me on that, I haven't
+ /// found the appropriate reference yet), ODBC equivalent is SQL_TXN_READ_COMMITTED
+ /// </summary>
+ /// <returns></returns>
+ public IDbTransaction BeginTransaction()
+ {
+ return null;
+ }
+ #endregion
+ #region BeginTransaction (IsolationLevel) Method
+ /// <summary>
+ /// BeginTransaction again overloadded to let us set the transaction level for the statement
+ /// </summary>
+ /// <param name="isolationL"></param>
+ /// <returns></returns>
+ public IDbTransaction BeginTransaction(IsolationLevel isolationL)
+ {
+ return null;
+ }
+ #endregion
+ #region ChangeDatabase
+ unsafe public void ChangeDatabase(string newDBName)
+ {
+ }
+ #endregion
+ #region Close
+ ///Close, per MSDN documentation
+ ///
+ unsafe public void Close()
+ {
+ DB2ClientPrototypes.SQLDisconnect(dbHandle);
+ dbHandle = new IntPtr(DB2ClientConstants.SQL_NULL_HANDLE);
+ }
+ #endregion
+ #region CreateCommand
+ /// <summary>
+ /// CreateCommand per MSDN
+ /// </summary>
+ /// <returns></returns>
+ public IDbCommand CreateCommand()
+ {
+ CheckState();
+ return new DB2ClientCommand();
+ }
+ #endregion
+ #region Open
+ /// <summary>
+ /// Open, per MSDN
+ /// </summary>
+ unsafe public void Open()
+ {
+ DB2ClientUtils util = new DB2ClientUtils();
+ outConnectStr = new StringBuilder(60); //Set some initial size, we know we're gettig a chunk of data back
+ IntPtr penvHandle=IntPtr.Zero;
+ IntPtr numOutCharsReturned = IntPtr.Zero;
+ short sqlRet=0;
+
+ try
+ {
+ sqlRet = DB2ClientPrototypes.SQLAllocHandle(DB2ClientConstants.SQL_HANDLE_ENV, IntPtr.Zero, ref penvHandle);
+ util.DB2CheckReturn(sqlRet, 0, IntPtr.Zero, "Unable to allocate Environment handle in DB2ClientConnection.");
+
+ sqlRet = DB2ClientPrototypes.SQLAllocHandle(DB2ClientConstants.SQL_HANDLE_DBC, penvHandle, ref dbHandle);
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_ENV, penvHandle, "Unable to allocate database handle in DB2ClientConnection.");
+
+ sqlRet = DB2ClientPrototypes.SQLDriverConnect(dbHandle, 0, connectionString,
+ connectionString.Length, outConnectStr, 100, numOutCharsReturned,
+ DB2ClientConstants.SQL_DRIVER_COMPLETE);
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_ENV, penvHandle, "Unable to connect to the database.");
+
+ }
+ catch (DB2ClientException DB2E)
+ {
+ Console.WriteLine(DB2E.Message);
+ Dispose();
+ throw DB2E;
+ }
+ }
+ #endregion
+ #region Dispose
+ /// <summary>
+ /// Dispose
+ /// </summary>
+ unsafe public void Dispose()
+ {
+ if(!disposed)
+ {
+ this.Close();
+ disposed = true;
+ } else
+ return;
+ }
+
+ #endregion
+
+ private void CheckState()
+ {
+ if (ConnectionState.Closed == State)
+ throw new DB2ClientException ("Connection is currently closed.");
+ }
+
+ void SetConnectionString (string connectionString)
+ {
+ this.connectionString = connectionString;
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConstants.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConstants.cs
new file mode 100644
index 00000000000..6a020ba834b
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientConstants.cs
@@ -0,0 +1,75 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// Summary description for DB2Constants.
+ /// </summary>
+ public class DB2ClientConstants
+ {
+ public DB2ClientConstants()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+
+ }
+ public const short SQL_HANDLE_ENV = 1;
+ public const short SQL_HANDLE_DBC = 2;
+ public const short SQL_HANDLE_STMT = 3;
+ public const short SQL_HANDLE_DESC = 4;
+
+ /* RETCODE values */
+ public const long SQL_SUCCESS = 0;
+ public const long SQL_SUCCESS_WITH_INFO = 1;
+ public const long SQL_NEED_DATA = 99;
+ public const long SQL_NO_DATA = 100;
+ public const long SQL_STILL_EXECUTING = 2;
+ public const long SQL_ERROR = -1;
+ public const long SQL_INVALID_HANDLE = -2;
+ public const long SQL_NULL_HANDLE = 0L;
+ public const short SQL_COMMIT = 0;
+ public const short SQL_ROLLBACK = 1;
+ public const short SQL_NO_DATA_FOUND = 100;
+
+ /* Isolation levels */
+ public const long SQL_TXN_READ_UNCOMMITTED = 0x00000001L;
+ public const long SQL_TXN_READ_COMMITTED = 0x00000002L;
+ public const long SQL_TXN_REPEATABLE_READ = 0x00000004L;
+ public const long SQL_TXN_SERIALIZABLE_READ = 0x00000008L;
+ public const long SQL_TXN_NOCOMMIT = 0x00000020L;
+
+ /* Connect options */
+ public const long SQL_TXN_ISOLATION = 108;
+ public const long SQL_AUTOCOMMIT = 102;
+
+ public const long SQL_AUTOCOMMIT_OFF = 0L;
+ public const long SQL_AUTOCOMMIT_ON = 1L;
+
+ /* Data Types */
+ public const int SQL_CHAR = 1;
+ public const int SQL_DECIMAL = 3;
+ public const int SQL_VARCHAR = 12;
+ public const int SQL_TYPE_DATE = 91;
+ public const int SQL_TYPE_TIME = 92;
+ public const int SQL_TYPE_TIMESTAMP = 93;
+
+ public const int SQL_C_CHAR = SQL_CHAR;
+
+ /* SQLDriverConnect Options */
+ public const int SQL_DRIVER_NOPROMPT = 0;
+ public const int SQL_DRIVER_COMPLETE = 1;
+ public const int SQL_DRIVER_PROMPT = 2;
+ public const int SQL_DRIVER_COMPLETE_REQUIRED = 3;
+
+
+ }
+}
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientDataReader.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientDataReader.cs
new file mode 100644
index 00000000000..e03b1662ad8
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientDataReader.cs
@@ -0,0 +1,458 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.Text;
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// Summary description for DB2ClientDataReader.
+ /// DB2ClientDataReader.
+ /// </summary>
+ unsafe public class DB2ClientDataReader : IDataReader
+ {
+ internal DataTable rs; //Our result set is a datatable
+ internal DB2ClientConnection db2Conn; //The connection we're working with
+ internal IntPtr hwndStmt; //The statement handle returning the results
+ private int row=-1; //Row pointer
+ private int numCols=0;
+
+ #region Constructors and destructors
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="con"></Connection object to DB2>
+ /// <param name="com"></Command object>
+ internal DB2ClientDataReader(DB2ClientConnection con, DB2ClientCommand com)
+ {
+ db2Conn = con;
+ hwndStmt = com.statementHandle; //We have access to the results through the statement handle
+
+ short sqlRet;
+ StringBuilder colName = new StringBuilder(18);
+ short colNameMaxLength=18;
+ IntPtr colNameLength=IntPtr.Zero;
+ IntPtr sqlDataType=IntPtr.Zero;
+ IntPtr colSize=IntPtr.Zero;
+ IntPtr scale=IntPtr.Zero;
+ IntPtr nullable=IntPtr.Zero;
+ DB2ClientUtils util = new DB2ClientUtils();
+ rs = new DataTable();
+
+ sqlRet = DB2ClientPrototypes.SQLNumResultCols(hwndStmt, ref numCols);
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLNumResultCols");
+ IntPtr[] dbVals = new IntPtr[numCols];
+ IntPtr[] sqlLen_or_IndPtr = new IntPtr[numCols];
+ for (ushort i=1; i<=numCols; i++)
+ {
+ sqlRet = DB2ClientPrototypes.SQLDescribeCol(hwndStmt, i, colName, colNameMaxLength, colNameLength, ref sqlDataType, ref colSize, ref scale, ref nullable);
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLDescribeCol");
+ ///At this point I have the data type information as well, but for now I will insert the data as
+ ///Ansi strings and see how it goes. Maybe we can speed things up later...
+ ///
+ rs.Columns.Add(colName.ToString());
+
+ sqlLen_or_IndPtr[i-1] = new IntPtr();
+ dbVals[i-1] = Marshal.AllocHGlobal(colSize.ToInt32()+1);
+
+ try
+ {
+ switch (sqlDataType.ToInt32())
+ {
+ case DB2ClientConstants.SQL_DECIMAL: //These types are treated as SQL_C_CHAR for binding purposes
+ case DB2ClientConstants.SQL_TYPE_DATE:
+ case DB2ClientConstants.SQL_TYPE_TIME:
+ case DB2ClientConstants.SQL_TYPE_TIMESTAMP:
+ case DB2ClientConstants.SQL_VARCHAR:
+ sqlRet = DB2ClientPrototypes.SQLBindCol(hwndStmt, i, DB2ClientConstants.SQL_C_CHAR, dbVals[i-1],(short)colSize.ToInt32()+1, ref sqlLen_or_IndPtr[i-1]);
+ break;
+ default:
+ sqlRet = DB2ClientPrototypes.SQLBindCol(hwndStmt, i, (short)sqlDataType.ToInt32(), dbVals[i-1],(short)colSize.ToInt32()+1, ref sqlLen_or_IndPtr[i-1]);
+ break;
+ }
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLBindCol");
+ }
+ catch(DB2ClientException e)
+ {
+ System.Console.Write(e.Message);
+ }
+ isClosed = false;
+ }
+ sqlRet = DB2ClientPrototypes.SQLFetch(hwndStmt);
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLFetch 1");
+ while(sqlRet != DB2ClientConstants.SQL_NO_DATA_FOUND)
+ {
+ DataRow newRow = rs.NewRow();
+ for (short y=1;y<=numCols;y++)
+ {
+ newRow[y-1] = Marshal.PtrToStringAnsi(dbVals[y-1]);
+ util.DB2CheckReturn(sqlRet, DB2ClientConstants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLFetch 2");
+ }
+ rs.Rows.Add(newRow);
+
+ sqlRet = DB2ClientPrototypes.SQLFetch(hwndStmt);
+ }
+ for (int n=0;n<numCols;n++)
+ Marshal.FreeHGlobal(dbVals[n]);
+ }
+ public void Dispose()
+ {
+ Close();
+ }
+ #endregion
+ #region Properties
+ #region Depth property
+ ///
+ ///Depth of nesting for the current row, need to figure out what this translates into
+ ///with DB2.
+ ///
+ private int depth = 0;
+ public int Depth
+ {
+ get
+ {
+ return depth;
+ }
+ }
+ #endregion
+ #region IsClosed property
+ /// <summary>
+ /// True if the reader is closed.
+ /// </summary>
+ private bool isClosed = true;
+ public bool IsClosed
+ {
+ get
+ {
+ return isClosed;
+ }
+ }
+ #endregion
+ #region RecordsAffected property
+ ///
+ /// Number of records affected by this operation. Will be zero until we close the
+ /// reader
+ ///
+ private int recordsAffected = 0;
+ public int RecordsAffected
+ {
+ get
+ {
+ return recordsAffected;
+ }
+ }
+ #endregion
+ #endregion
+ #region Methods
+ #region Close method
+ ///
+ ///
+ public void Close()
+ {
+ if (rs != null)
+ {
+ recordsAffected = rs.Rows.Count;
+ rs.Dispose();
+ rs = null;
+ isClosed=true;
+ }
+ }
+ #endregion
+ #region GetSchemaTable
+ ///
+ /// We'll return an empty table for now...ughh this one will be tedious to write
+ ///
+ public DataTable GetSchemaTable()
+ {
+ throw new DB2ClientException ("TBD");
+ }
+ #endregion
+ #region NextResult
+ ///
+ /// Ummm is this related to SQLBulkOperations stuff..?
+ ///
+ public bool NextResult()
+ {
+ throw new DB2ClientException("To be done");
+
+ //Deferring the meat of this until the batch stuff is implemented
+ }
+ #endregion
+ #region Read
+ ///
+ /// Apparently, this function does nothing other than tell you if you can move to the
+ /// next row in the resultset. I have to move the fetching stuff elswhere...
+ ///
+ public bool Read()
+ {
+ if (isClosed) return false;
+ row++;
+ //do something with the fetched data now...
+ if(row < rs.Rows.Count)
+ return true;
+ else
+ return false;
+
+ }
+ #endregion
+ #endregion
+
+ #region IDataRecord Interface
+ ///Code for the IDataRecord interface
+ ///
+ #region FieldCount
+ ///
+ ///
+ private int fieldCount = -1;
+ public int FieldCount
+ {
+ get
+ {
+ if (IsClosed)
+ fieldCount = 0;
+ else
+ fieldCount = rs.Columns.Count;
+ return fieldCount;
+ }
+ }
+ #endregion
+ #region Item accessors
+ public object this[string name]
+ {
+ get
+ {
+ return rs.Rows[row][name];
+ }
+ }
+ public object this[int col]
+ {
+ get
+ {
+ return rs.Rows[row][col];
+ }
+ }
+ #endregion
+ #region GetBoolean method
+ ///
+ ///Use the Convert class for all of these returns
+ ///
+ public bool GetBoolean(int col)
+ {
+ return Convert.ToBoolean(this[col]);
+ }
+ #endregion
+ #region GetByte
+ ///
+ ///GetByte
+ ///
+ public byte GetByte(int col)
+ {
+ return Convert.ToByte(this[col]);
+ }
+ #endregion
+ #region GetBytes
+ ///
+ /// GetBytes, return a stream of bytes
+ ///
+ public long GetBytes(int col, long fieldOffset, byte[] buffer, int bufferOffset, int length)
+ {
+ //Hmm... How shall we deal with this one?
+ return 0;
+ }
+ #endregion
+ #region GetChar
+ ///
+ ///GetChar, return column as a char
+ ///
+ public char GetChar(int col)
+ {
+ return Convert.ToChar(this[col]);
+ }
+ #endregion
+ #region GetChars
+ ///
+ ///GetChars, returns char array
+ ///
+ public long GetChars(int col, long fieldOffset, char[] buffer, int bufferOffset, int length)
+ {
+ //Again, not sure how I'll deal with this just yet
+ return 0;
+ }
+ #endregion
+ #region GetData
+ ///
+ /// GetData method
+ ///
+ public IDataReader GetData(int col)
+ {
+ //Have to research this one, not quite sure what the docs mean
+ //DB2 does have some structured data types, is that what this is for?
+ throw new DB2ClientException("Not yet supported.");
+ }
+ #endregion
+ #region GetDataTypeName
+ ///
+ ///GetDataTypeName return the type of data
+ ///
+ public string GetDataTypeName(int col)
+ {
+ //I could check the meta data as a starting point for this one, but until I implement
+ //returning the result sets, I'm not exactly sure what info I'll have, so this function
+ //waits until then...
+ throw new DB2ClientException("Not yet implemented");
+ }
+ #endregion
+ #region GetDateTime
+ ///
+ /// GetDateTime method
+ ///
+ public DateTime GetDateTime(int col)
+ {
+ return Convert.ToDateTime(this[col]);
+ }
+ #endregion
+ #region GetDecimal
+ ///
+ ///GetDecimal method
+ ///
+ public decimal GetDecimal(int col)
+ {
+ return Convert.ToDecimal(this[col]);
+ }
+ #endregion
+ #region GetDouble
+ ///
+ /// GetDouble
+ ///
+ public double GetDouble(int col)
+ {
+ return Convert.ToDouble(this[col]);
+ }
+ #endregion
+ #region GetFieldType
+ ///
+ /// Type GetFieldType
+ ///
+ public Type GetFieldType(int col)
+ {
+ //Again need more research here
+ return typeof(int);
+ }
+ #endregion
+ #region GetFloat
+ ///
+ /// GetFloat
+ ///
+ public float GetFloat(int col)
+ {
+ return (float) Convert.ToDouble(this[col].ToString(),new CultureInfo("en-US").NumberFormat);
+ }
+ #endregion
+ #region GetGuid
+ ///
+ /// GetGuid
+ ///
+ public Guid GetGuid(int col)
+ {
+ // a Guid is a 128 bit unique value. Could be like a GENERATE UNIQUE in DB2
+ // as usual, need more research
+ throw new DB2ClientException("TBD");
+ }
+ #endregion
+ #region The GetInt?? series
+ ///
+ ///GetInt16
+ ///
+ public short GetInt16(int col)
+ {
+ return Convert.ToInt16(this[col]);
+ }
+ ///
+ ///GetInt32
+ ///
+ public int GetInt32(int col)
+ {
+ return Convert.ToInt32(this[col]);
+ }
+ ///
+ ///GetInt64
+ ///
+ public long GetInt64(int col)
+ {
+ return Convert.ToInt64(this[col]);
+ }
+ #endregion
+ #region GetName
+ ///
+ ///GetName, returns the name of the field
+ ///
+ public string GetName(int col)
+ {
+ return (rs.Columns[col].ColumnName);
+ }
+ #endregion
+ #region GetOrdinal
+ ///
+ /// GetOrdinal, return the index of the named column
+ ///
+ public int GetOrdinal(string name)
+ {
+ return rs.Columns[name].Ordinal;
+ }
+ #endregion
+ #region GetString
+ ///
+ /// GetString returns a string
+ ///
+ public string GetString(int col)
+ {
+ return Convert.ToString(this[col]);
+ }
+ #endregion
+ #region GetValue
+ ///
+ /// GetVCalue, returns an object
+ ///
+ public object GetValue(int col)
+ {
+ return this[col];
+ }
+ #endregion
+ #region GetValues
+ ///
+ /// GetValues returns all columns in the row through the argument, and the number of columns in the return value
+ ///
+ public int GetValues(object[] values)
+ {
+ int numCols = FieldCount;
+ if (values.Length<numCols)
+ throw new DB2ClientException("GetValues argument too small for number of columns in row.");
+ for (int i = 0; i<=numCols; i++)
+ values[i] = this[i];
+ return numCols;
+ }
+ #endregion
+ #region IsDBNull
+ ///
+ /// IsDBNull Is the column null
+ ///
+ public bool IsDBNull(int col)
+ {
+ //Proper implementation once I get the SQLDescribe/SQLBind/SQLFetch stuff in place
+ return false;
+ }
+ #endregion
+
+ #endregion ///For IDataRecord
+ }
+
+}
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientException.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientException.cs
new file mode 100644
index 00000000000..06a98f0998b
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientException.cs
@@ -0,0 +1,57 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// Exception class. We will throw our own exception in the case of SQL_ERROR returns
+ /// and call SQLGetDiagRec to get the error info.
+ /// </summary>
+ public class DB2ClientException : Exception
+ {
+ internal string message;
+ public DB2ClientException(string Message)
+ {
+ this.message = Message;
+ }
+ unsafe public DB2ClientException(short sqlHandleType, IntPtr sqlHandle, string Message)
+ {
+ StringBuilder sqlState = new StringBuilder(50);
+ StringBuilder errorMessage = new StringBuilder(1025);
+
+ int sqlReturn;
+ short recNum=1;
+ short bufLength = 1025;
+
+ IntPtr textLengthPtr = IntPtr.Zero;
+ IntPtr nativeErrorPtr = IntPtr.Zero;
+
+ sqlReturn = DB2ClientPrototypes.SQLGetDiagRec(sqlHandleType, sqlHandle, recNum, sqlState, ref nativeErrorPtr, errorMessage, bufLength, ref textLengthPtr);
+ this.message = Message + "\n" + sqlState.ToString() + " " + errorMessage.ToString()+"\n";
+ //See if there are more errors to retrieve and get them.
+ while (sqlReturn != DB2ClientConstants.SQL_NO_DATA && sqlReturn > 0)
+ {
+ recNum++;
+ sqlReturn = DB2ClientPrototypes.SQLGetDiagRec(sqlHandleType, sqlHandle, recNum, sqlState, ref nativeErrorPtr, errorMessage, bufLength, ref textLengthPtr);
+ this.message += "\n" + sqlState.ToString() + " " + errorMessage.ToString()+"\n";
+ }
+
+ }
+ public override string Message
+ {
+ get
+ {
+ return this.message;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientPrototypes.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientPrototypes.cs
new file mode 100644
index 00000000000..8ba23cae195
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientPrototypes.cs
@@ -0,0 +1,53 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// DB2CLIPrototypes class is a wrapper for the db2cli.lib, IBM's Call Level Interface to DB2
+ /// </summary>
+ unsafe internal class DB2ClientPrototypes
+ {
+ [DllImport("db2cli.dll", EntryPoint = "SQLAllocHandle")]
+ unsafe public static extern short SQLAllocHandle(short handleType, IntPtr inputHandle, ref IntPtr outputHandle);
+ [DllImport("db2cli.Dll", EntryPoint = "SQLConnect")]
+ unsafe public static extern short SQLConnect(IntPtr sqlHdbc, string serverName, short serverNameLength, string userName, short userNameLength, string authentication, short authenticationLength);
+ [DllImport("db2cli.Dll", CharSet = CharSet.Auto, EntryPoint = "SQLDisconnect")]
+ unsafe public static extern short SQLDisconnect(IntPtr sqlHdbc);
+ [DllImport("db2cli.dll", EntryPoint = "SQLGetDiagRec")]
+ unsafe public static extern short SQLGetDiagRec( short handleType, IntPtr handle, short recNum, [Out] StringBuilder sqlState, ref IntPtr nativeErrorPtr, [Out] StringBuilder errorMessage, short bufferLength, ref IntPtr shortTextLengthPtr);
+ [DllImport("db2cli.Dll", EntryPoint = "SQLSetConnectAttr")]
+ unsafe public static extern short SQLSetConnectAttr(IntPtr sqlHdbc, long sqlAttr, IntPtr sqlValuePtr, long sqlStrLength);
+ [DllImport("db2cli.Dll", EntryPoint = "SQLEndTran")]
+ unsafe public static extern short SQLEndTran (short handleType, IntPtr handle, short fType);
+ [DllImport("db2cli.Dll", EntryPoint = "SQLCancel")]
+ unsafe public static extern short SQLCancel(IntPtr handle);
+ [DllImport("db2cli.dll", EntryPoint = "SQLNumResultCols")]
+ unsafe public static extern short SQLNumResultCols(IntPtr handle, ref int numCols);
+ [DllImport("db2cli.Dll", EntryPoint = "SQLFetch")]
+ unsafe public static extern short SQLFetch(IntPtr handle);
+ [DllImport("db2cli.dll", EntryPoint = "SQLRowCount")]
+ unsafe public static extern short SQLRowCount(IntPtr stmtHandle, ref int numRows);
+ [DllImport("db2cli.dll", EntryPoint = "SQLExecute")]
+ unsafe public static extern short SQLExecute(IntPtr handle);
+ [DllImport ("db2cli.dll", EntryPoint = "SQLExecDirect")]
+ unsafe public static extern short SQLExecDirect(IntPtr stmtHandle, string stmt, int length);
+ [DllImport("db2cli.Dll", EntryPoint = "SQLDescribeCol")]
+ unsafe public static extern short SQLDescribeCol(IntPtr stmtHandle, ushort colNum, [Out] StringBuilder colName, short colNameMaxLength, IntPtr colNameLength, ref IntPtr dataType, ref IntPtr colSizePtr, ref IntPtr scalePtr, ref IntPtr nullablePtr );
+ [DllImport("db2cli.dll", EntryPoint = "SQLBindCol")]
+ unsafe public static extern short SQLBindCol(IntPtr stmtHandle, ushort colNum, int dataType,[In][Out] IntPtr dataBufferPtr, int dataBufferLength, ref IntPtr StrLen_or_IndPtr);
+ [DllImport("db2cli.dll", EntryPoint = "SQLDriverConnect")]
+ unsafe public static extern short SQLDriverConnect(IntPtr hdbc, int centered, [In] string inConnectStr, [In] int inStrLength, [Out] StringBuilder outConnectStr, [Out] int outStrCapacity, [Out] IntPtr outStrLengthReturned, [In] int completion);
+ }
+}
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientTransaction.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientTransaction.cs
new file mode 100644
index 00000000000..dd0a86e5a3a
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientTransaction.cs
@@ -0,0 +1,100 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+using System.Data;
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// DB2ClientTransaction. DB2 requires nothing specific to be done to open a transaction, so we set the
+ /// isolation level, make sure AUTOCOMMIT is off. DB2 Also allows you to set transaction isolation
+ /// at the statement level, but I haven't worked that in here yet.
+ /// </summary>
+ public class DB2ClientTransaction : IDbTransaction
+ {
+ IsolationLevel IL = IsolationLevel.Unspecified;
+ DB2ClientConnection db2Conn;
+ public DB2ClientTransaction(DB2ClientConnection con, IsolationLevel isoL)
+ {
+ IL = isoL;
+ long db2IsoL = DB2ClientConstants.SQL_TXN_READ_COMMITTED;
+ db2Conn = con;
+ short sqlRet;
+
+ switch (isoL)
+ {
+ case System.Data.IsolationLevel.Chaos:
+ break;
+ case System.Data.IsolationLevel.ReadCommitted: //SQL_TXN_READ_COMMITTED
+ db2IsoL = DB2ClientConstants.SQL_TXN_READ_COMMITTED;
+ break;
+ case System.Data.IsolationLevel.ReadUncommitted: //SQL_TXN_READ_UNCOMMITTED
+ db2IsoL = DB2ClientConstants.SQL_TXN_READ_UNCOMMITTED;
+ break;
+ case System.Data.IsolationLevel.RepeatableRead: //SQL_TXN_REPEATABLE_READ
+ db2IsoL = DB2ClientConstants.SQL_TXN_REPEATABLE_READ;
+ break;
+ case System.Data.IsolationLevel.Serializable: //SQL_TXN_SERIALIZABLE_READ
+ db2IsoL = DB2ClientConstants.SQL_TXN_SERIALIZABLE_READ;
+ break;
+ }
+
+ IntPtr iso = new IntPtr(db2IsoL);
+ IntPtr attr = new IntPtr(DB2ClientConstants.SQL_AUTOCOMMIT_OFF);
+ sqlRet = DB2ClientPrototypes.SQLSetConnectAttr(db2Conn.DBHandle, DB2ClientConstants.SQL_AUTOCOMMIT, attr, 0);
+ sqlRet = DB2ClientPrototypes.SQLSetConnectAttr(db2Conn.DBHandle, DB2ClientConstants.SQL_TXN_ISOLATION, iso, 0);
+
+ }
+
+ /// <summary>
+ /// DB2ClientConnection associated with this transaction
+ /// </summary>
+ public IDbConnection Connection
+ {
+ get
+ {
+ return db2Conn;
+ }
+ }
+ /// <summary>
+ /// IsolationLevel property
+ /// </summary>
+ ///
+ public IsolationLevel IsolationLevel
+ {
+ get
+ {
+ return IL;
+ }
+ }
+
+ public void Commit() {
+ DB2ClientPrototypes.SQLEndTran(DB2ClientConstants.SQL_HANDLE_DBC, db2Conn.DBHandle, DB2ClientConstants.SQL_COMMIT);
+ }
+ public void Rollback()
+ {
+ DB2ClientPrototypes.SQLEndTran(DB2ClientConstants.SQL_HANDLE_DBC, db2Conn.DBHandle, DB2ClientConstants.SQL_ROLLBACK);
+ }
+
+ /// <summary>
+ /// Dispose method.
+ /// </summary>
+ private bool Done = false;
+ public void Dispose()
+ {
+ if (Done)
+ return;
+ Rollback();
+ IL = IsolationLevel.Unspecified;
+ db2Conn = null;
+ Done = true;
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientUtils.cs b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientUtils.cs
new file mode 100644
index 00000000000..d18c5821275
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Mono.Data.Db2Client/DB2ClientUtils.cs
@@ -0,0 +1,48 @@
+#region Licence
+ /// DB2DriverCS - A DB2 driver for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+#endregion
+using System;
+
+namespace DB2ClientCS
+{
+ /// <summary>
+ /// Utility functions class, i.e. functions like SQL return code error checking
+ /// </summary>
+ public class DB2ClientUtils
+ {
+ public DB2ClientUtils()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ #region DB2CheckReturn
+ /// <summary>
+ /// Check the return value from a Call Level Interface call and respond to errors (by tossing exception)
+ /// </summary>
+ /// <param name="sqlRet"><The return value>
+ /// <param name="handleType"><Type of handle, 0 means we don't care, so don't try to check the handle for any messages placed there by DB2>
+ /// <param name="handle"><The handle in question, don't care if handletype is 0>
+ /// <param name="message"><Message we may throw>
+ /// <returns></returns>
+ public int DB2CheckReturn(short sqlRet, short handleType, IntPtr handle, string message)
+ {
+ switch ((long)sqlRet)
+ {
+ case DB2ClientConstants.SQL_ERROR:
+ if (handleType != 0)
+ throw new DB2ClientException(handleType, handle, message);
+ else
+ throw new DB2ClientException(message);
+ default:
+ return 0;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/App.ico b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/App.ico
new file mode 100644
index 00000000000..3a5525fd794
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/App.ico
Binary files differ
diff --git a/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/AssemblyInfo.cs b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/ChangeLog b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/ChangeLog
new file mode 100755
index 00000000000..70464a96939
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/ChangeLog
@@ -0,0 +1,6 @@
+2003-01-18 Daniel Morgan <danmorg@sc.rr.com>
+
+ * TestDB2Conn.cs: use a different connection string
+ which uses the format
+ "DSN=database;UID=userid;PWD=password"
+ \ No newline at end of file
diff --git a/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/TestDB2Conn.cs b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/TestDB2Conn.cs
new file mode 100644
index 00000000000..73d80310f13
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/Test/TestDB2Conn/TestDB2Conn.cs
@@ -0,0 +1,93 @@
+#region Licence
+ /// DB2DriverCS Test Code - A DB2 driver test for .Net
+ /// Copyright 2003 By Christopher Bockner
+ /// Released under the terms of the MIT/X11 Licence
+ /// Please refer to the Licence.txt file that should be distributed with this package
+ /// This software requires that DB2 client software be installed correctly on the machine
+ /// (or instance) on which the driver is running.
+ ///
+#endregion
+
+using System;
+using System.Data;
+using DB2ClientCS;
+using System.Text;
+
+namespace TestDB2Conn {
+ /// <summary>
+ /// Code to test DB2DriverCS.
+ /// </summary>
+ class TestDB2Client
+ {
+ static void DoTest(string database, string userid, string password)
+ {
+ IDbCommand command = null;
+ string connectionString = String.Format(
+ "DSN={0};UID={1};PWD={2}",
+ database, userid, password);
+ try {
+ Console.WriteLine("Create DB2 client Connection...");
+ DB2ClientConnection DB2Conn = new DB2ClientConnection();
+
+ Console.WriteLine("connection string: " + connectionString);
+
+ Console.WriteLine("Set connection string...");
+ DB2Conn.ConnectionString = connectionString;
+
+ Console.WriteLine("Open a connection...");
+ DB2Conn.Open();
+
+ string createTestTableSQL =
+ "CREATE TABLE mono_db2_test1 ( " +
+ " testid varchar(2), " +
+ " testdesc varchar(16) " +
+ ")";
+ Console.WriteLine("SQL:\n" + createTestTableSQL);
+
+ Console.WriteLine("Create a command using sql and connection...");
+ command = new DB2ClientCommand(createTestTableSQL,DB2Conn);
+ Console.WriteLine("Execute Non Query...");
+ command.ExecuteNonQuery();
+
+ string selectSQL = "select * from employee";
+ Console.WriteLine("SQL:\n" + selectSQL);
+ Console.WriteLine("create command and set connection and connection string...");
+ command = new DB2ClientCommand(selectSQL,DB2Conn);
+ Console.WriteLine("ExecuteReader...");
+ IDataReader dr = command.ExecuteReader();
+ Console.WriteLine("Read row...");
+ dr.Read();
+ Console.WriteLine("Read row...");
+ dr.Read();
+ Console.WriteLine("GetString...");
+ string dt = dr.GetString(1);
+ Console.WriteLine("dt: " + dt);
+ string s = dr.GetString(5);
+ Console.WriteLine("s: " + s);
+ DateTime t = dr.GetDateTime(6);
+ Console.WriteLine("t: " + t);
+
+ Console.WriteLine("Close connection...");
+ DB2Conn.Close();
+ }
+ catch(DB2ClientException e) {
+ System.Console.Write(e.Message);
+ }
+ }
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ if(args.Length != 3)
+ Console.WriteLine("Usage: mono TestDB2Conn.exe database userid password");
+ else {
+ Console.WriteLine("Test Begin.");
+ // database, userid, password
+ DoTest(args[0], args[1], args[2]);
+ Console.WriteLine("Test End.");
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.DB2Client/licence.txt b/mcs/class/Mono.Data.DB2Client/licence.txt
new file mode 100644
index 00000000000..7f854d33414
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/licence.txt
@@ -0,0 +1,18 @@
+Copyright (c) 2003 Christopher Bockner
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this
+software and associated documentation files (the "Software"), to deal in the Software
+without restriction, including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
diff --git a/mcs/class/Mono.Data.DB2Client/list b/mcs/class/Mono.Data.DB2Client/list
new file mode 100644
index 00000000000..66e3aa6c0f7
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/list
@@ -0,0 +1,9 @@
+Mono.Data.Db2Client/AssemblyInfo.cs
+Mono.Data.Db2Client/DB2ClientCommand.cs
+Mono.Data.Db2Client/DB2ClientConnection.cs
+Mono.Data.Db2Client/DB2ClientConstants.cs
+Mono.Data.Db2Client/DB2ClientDataReader.cs
+Mono.Data.Db2Client/DB2ClientException.cs
+Mono.Data.Db2Client/DB2ClientPrototypes.cs
+Mono.Data.Db2Client/DB2ClientTransaction.cs
+Mono.Data.Db2Client/DB2ClientUtils.cs
diff --git a/mcs/class/Mono.Data.DB2Client/makefile.gnu b/mcs/class/Mono.Data.DB2Client/makefile.gnu
new file mode 100644
index 00000000000..68dbbb684f2
--- /dev/null
+++ b/mcs/class/Mono.Data.DB2Client/makefile.gnu
@@ -0,0 +1,12 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.DB2Client.dll
+
+LIB_LIST = list
+LIB_FLAGS = --unsafe -r corlib -r System -r System.Xml -r System.Data
+
+SOURCES_INCLUDE=*.cs
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.MySql/.cvsignore b/mcs/class/Mono.Data.MySql/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Data.MySql/ChangeLog b/mcs/class/Mono.Data.MySql/ChangeLog
new file mode 100644
index 00000000000..979c8b13c47
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/ChangeLog
@@ -0,0 +1,269 @@
+2002-11-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlParameter.cs
+ * Mono.Data.MySql/MySqlParameterCollection.cs: added
+ simple input parameters support. AFAIK, MySQL does not
+ support parameters, so this is just a search and replace
+
+ * Test/TestParameters.cs: add file to test Parameters
+
+ * Test/TestDataAdapter.cs: add file to test MySqlDataAdapter
+
+ * Mono.Data.MySql.build: added files to windows build
+
+ * list: added files to linux build
+
+ * Mono.Data.MySql/MySql.cs: make sure all
+ DllImport attributes
+ also have the SuppressUnmanagedCodeSecurity attribute
+
+ * Mono.Data.MySql/MySqlCommand.cs: add support for
+ input parameters, don't execute empty queries,
+ and support of CommandTypes of StoredProcedure and TableDirect
+
+ * Mono.Data.MySql/MySqlConnection.cs: borrowed Tim Coleman's
+ code from SqlConnection to handle connection
+ parameters correctly
+
+ * Mono.Data.MySql/MySqlTypes.cs
+ * Mono.Data.MySql/MySqlDataReader.cs: started support
+ for NULL values.
+
+ * Test/MySqlTest.cs: test for NULL values, stored procedures,
+ executing a non-query via ExecuteReader(), new connection
+ string functionality, and exception handling
+
+2002-11-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlDataAdapter.cs
+ * Mono.Data.MySql/MySqlRowUpdatedEventArgs.cs
+ * Mono.Data.MySql/MySqlRowUpdatedEventHandler.cs
+ * Mono.Data.MySql/MySqlRowUpdatingEventArgs.cs
+ * Mono.Data.MySql/MySqlRowUpdatingEventHandler.cs: added new
+ files for the Data Adapter for the MySQL data provider
+
+ * list: added new files to Linux build
+
+ * Mono.Data.MySql/MySqlCommand.cs: implement the
+ interfaces correctly and Dispose(). Allow the provider to
+ execute multiple queries for a reader
+
+ * Mono.Data.MySql/MySqlTransaction.cs
+ * Mono.Data.MySql/MySqlConnection.cs: implement the
+ interfaces correctly and Dispose
+
+ * Mono.Data.MySql/MySqlDataReader.cs: implement the
+ interfaces correctly and Dispose(). Allow the provider to
+ execute multiple queries for a reader. Implement
+ IEnumerable.GetEnumerator() to return a DbEnumerator
+ which can be used to do a
+ foreach (DbDataRecord rec in myDataReader) { ... }
+ and allows a IDataReader to be "data binded" to a DataGrid.
+ Thanks goes to Tim Coleman (I copied this from his SqlDataReader).
+
+2002-10-26 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlError.cs
+ * Mono.Data.MySql/MySqlErrorCollection.cs
+ * Mono.Data.MySql/MySqlException.cs: added files for
+ MySQL Exceptions
+
+ * Mono.Data.MySql.build: removed excludes for new
+ files (thus adding them to the build) on Windows
+
+ * list: added files to build on Linux
+
+ * Mono.Data.MySql/MySqlCommand.cs
+ * Mono.Data.MySql/MySqlConnection.cs: modified
+ to throw a new MySqlException when a MySqlError occurs
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlDataReader.cs: change "DataType" in
+ schema DataTable to be typeof(Type) instead of
+ typeof(string) to make it more like MS.NET
+
+ * Test/MySqlTest.cs: tweaks
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlCommand.cs:
+ * Mono.Data.MySql/MySqlConnection.cs:
+ * Mono.Data.MySql/MySqlDataReader.cs:
+ * Mono.Data.MySql/MySqlTypes.cs: modifed -
+ handle MySQL types to .NET types and some fixes
+
+2002-10-12 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/MySqlTest.cs: added file - to do
+ various Tests for the MySql provider
+
+ * Mono.Data.MySql/Field.cs: enum MySqlFieldFlags
+ should be unit. Rename class Field to MySqlMarshalledField
+ to represent what it really is. Redo handling of field Flags.
+
+ * Mono.Data.MySql/MySql.cs: added method AffectedRows() to
+ pinvoke into mysql_affected_rows() so we can know what rows
+ were affected by an INSERT, UPDATE, or DELETE SQL statement.
+
+ * Mono.Data.MySql/MySqlCommand.cs: rename
+ internal method rowVal() to GetColumnData(). In GetColumnData,
+ if IntPtr.Zero, return an empty "" string instead of "NULL".
+ Pass command behavior to data reader.
+
+ * Mono.Data.MySql/MySqlDataReader.cs: redo the
+ way field meta data and data is structured so
+ a schema DataTable can be built. Implement
+ GetSchemaTable() to create a DataTable holding the schema
+ of the fields. Implemented more methods.
+
+ * Mono.Data.MySql/MySqlTypes.cs: added method to
+ translate System.Data.DbType to System.Type
+
+ * est/TestMySqlExecuteReader.cs: minor tweaks
+
+2002-10-11 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlTransaction.cs: added to
+ support transactions (BEGIN, COMMIT/ROLLBACK).
+
+ * Mono.Data.MySql.build: included MySqlTransaction
+ in build on Windows
+
+ * list: included MySqlTransaction
+ in build on Linux
+
+ * Mono.Data.MySql/MySql.cs: the mysql thread functions
+ were misnamed and prevented them from being loaded
+ by the mono JIT - my_thread_init() and my_thread_end().
+ Now, threading should work in the MySQL provider and
+ less memory leaks too.
+
+ * Mono.Data.MySql/Test.cs: remove conditional comiliation
+ since everything compiles fine on Mono now
+
+ * Mono.Data.MySql/MySqlCommand.cs: remove Console.WriteLine()
+
+ * Mono.Data.MySql/MySqlConnection.cs: added transaction
+ support, implemented method ChangeDatabase(), implemented
+ property ServerVersion
+
+ * Test/TestMySqlInsert.cs: modified test
+ to handle transactions
+
+2002-10-10 Rodrigo Moya <rodrigo@ximian.com>
+
+ * makefile.gnu: added makefile for linux build.
+
+ * list: updated to contain all missing files.
+
+ * Mono.Data.MySql/makefile: removed unneeded makefile.
+
+2002-10-09 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlDataReader.cs: added
+ started implementing Reader for MySQL provider
+
+ * Mono.Data.MySql/MySqlTypes.cs: added
+ to hold internal helper methods, enums, structs, classes
+ for handling MySQL data types
+
+ * Test/TestMySqlExecuteReader.cs
+ * Test/TestMySqlExecuteScalar.cs: added simple tests
+ for ExecuteScalar() and ExecuteReader() methods
+ in MySqlCommand. We are able to retrieve data
+ from MySQL now.
+
+ * Mono.Data.MySql.build: took out exclude
+ so MySqlExecuteReader.cs will build
+
+ * Mono.Data.MySql/Field.cs: added enum to file
+ and added helper methods field flags
+
+ * Mono.Data.MySql/MySqlCommand.cs: started
+ implementation of ExecuteScalar nd ExecuteReader methods
+ to retrieve data. Also, added internal method rowVal
+ for marshalling field data.
+
+ * Mono.Data.MySql/Test.cs: take out a bunch of
+ Console.WriteLines'
+
+2002-08-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql/MySqlCommand.cs: modified
+ rowsRetrieved should be rowsAffected in ExecuteNonQuery
+ because the number is only to show the rows affected
+ by an INSERT, UPDATE, or DELETE; anything else, the
+ number is -1
+
+ * Mono.Data.MySql/Test.cs: modified
+ enable retrieving the results from a query. even though
+ this still does not work for some reason, i thought
+ i would enable it so others could see the problem.
+
+2002-05-30 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql.build: modified
+ need to copy Mono.Data.MySql.dll to mcs/class/System.Data/Test
+ so the SqlSharpCli test program can use MySql too
+
+2002-05-30 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestMySqlInsert.cs: added test
+ to do an SQL INSERT to insert a row into table.
+ Works on cygwin compiled using mcs and mono and
+ runs on mint, but it fails running on mono.
+
+ * Mono.Data.MySql/MySqlCommand.cs
+ * Mono.Data.MySql/TODOAttribute.cs
+ * Mono.Data.MySql/MySqlConnection.cs: added
+
+ * list: added
+ so can build with mcs/mono on linux
+ I only tested it on Cygwin though.
+ To work on linux, the library name in the pinvokes
+ in MySql.cs will need to be changed.
+
+ * Mono.Data.MySql.build: modified
+ exclude files from build. also copy Mono.Data.MySql.dll
+ to Mono.Data.MySql so you can build and run Test.cs
+
+ * Mono.Data.MySql/MySql.cs: modified
+ tweaks to compile under mcs/mono and run under mint or mono.
+ Runs under mint, but not mono. Had to comment out
+ mysql_thread_begin/mysql_thread_end functions because they refused
+ to load in mono. Until this is fixed, a memory leak will occur.
+ Can not retrieve field data from MySQL because the PtrToStructure()
+ needs to be implemented in System.Runtime.InteropServices.Marshal class.
+ However, this will be very complicated to do. So, we connect to
+ MySQL and execute SQL Commands, but we can not do Queries yet.
+
+ * Mono.Data.MySql/Test.cs: modified
+ tweaks to test C# bindings with compiling mcs/mono and
+ running on mint and mono. Runs on mint, but not mono.
+
+2002-05-28 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.MySql
+ * Mono.Data.MySql/Mono.Data.MySql: add directories
+ for the Mono.Data.MySql assembly and namespace. This
+ will contain the MySql .NET Data Provider which will use
+ C# bindings to libMySQL
+
+ * Mono.Data.MySql/Test.cs: added file to
+ test the C# bindings to MySQL
+
+ * Mono.Data.MySql/MySql.cs
+ * Mono.Data.MySql/Field.cs: added files
+ for the beginnings of C# bindings to MySQL
+
+ * Mono.Data.MySql/makefile: added file
+ to build the MySQL C# bindings on csc/Microsoft.NET
+
+ These C# bindings to the MySQL libMySQL.dll were created by
+ Brad Merrill <zbrad@cybercom.net>
+ and can be downloaded from
+ http://www.cybercom.net/~zbrad/DotNet/MySql/
+ and put into the Mono Class Library under the X11/MIT License
+ with Brad Merril's permission.
+
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql.build b/mcs/class/Mono.Data.MySql/Mono.Data.MySql.build
new file mode 100644
index 00000000000..fc5a98bad96
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql.build
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.MySql.dll -->
+
+<project name="Mono.Data.MySql" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.MySql.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="Mono.Data.MySql/Test.cs"/>
+ <excludes name="Mono.Data.MySql/MySqlClientPermission.cs"/>
+ <excludes name="Mono.Data.MySql/MySqlClientPermissionAttribute.cs"/>
+ <excludes name="Mono.Data.MySql/MySqlCommandBuilder.cs"/>
+ <excludes name="Mono.Data.MySql/MySqlInfoMessageEventArgs.cs"/>
+ <excludes name="Mono.Data.MySql/MySqlInfoMessageEventHandler.cs"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/System.Data.dll" tofile="Test/System.Data.dll"/>
+ <copy file="../lib/Mono.Data.MySql.dll" tofile="Test/Mono.Data.MySql.dll"/>
+ <copy file="../lib/Mono.Data.MySql.dll" tofile="Mono.Data.MySql/Mono.Data.MySql.dll"/>
+ <copy file="../lib/Mono.Data.MySql.dll" tofile="../System.Data/Test/Mono.Data.MySql.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Data.dll" failonerror="false"/>
+ <delete file="Test/System.Data.dll" failonerror="false"/>
+ <delete file="../lib/Mono.Data.MySql.dll" failonerror="false"/>
+ <delete file="Test/Mono.Data.MySql.dll" failonerror="false"/>
+
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/.cvsignore b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/Field.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/Field.cs
new file mode 100644
index 00000000000..d2e22b3beca
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/Field.cs
@@ -0,0 +1,117 @@
+//
+// Field.cs
+//
+// Provide definition for the Field class
+// Part of the C# bindings to MySQL library libMySQL.dll
+//
+// Author:
+// Brad Merrill <zbrad@cybercom.net>
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C)Copyright 2002 Brad Merril
+// (C)Copyright 2002 Daniel Morgan
+//
+// http://www.cybercom.net/~zbrad/DotNet/MySql/
+//
+// Mono has gotten permission from Brad Merrill to include in
+// the Mono Class Library
+// his C# bindings to MySQL under the X11 License
+//
+// Mono can be found at http://www.go-mono.com/
+// The X11/MIT License can be found
+// at http://www.opensource.org/licenses/mit-license.html
+//
+
+
+namespace Mono.Data.MySql {
+ using System;
+ using System.Runtime.InteropServices;
+
+ [Flags]
+ internal enum MySqlFieldFlags : uint {
+ NOT_NULL_FLAG = 1,
+ PRI_KEY_FLAG = 2,
+ UNIQUE_KEY_FLAG = 4,
+ MULTIPLE_KEY_FLAG = 8,
+ BLOB_FLAG = 16,
+ UNSIGNED_FLAG = 32,
+ ZEROFILL_FLAG = 64,
+ BINARY_FLAG = 128,
+ ENUM_FLAG = 256,
+ AUTO_INCREMENT_FLAG = 512,
+ TIMESTAMP_FLAG = 1024,
+ SET_FLAG = 2048,
+ NUM_FLAG = 32768,
+ PART_KEY_FLAG = 16384,
+ GROUP_FLAG = 32768,
+ UNIQUE_FLAG = 65536
+ }
+
+ ///<remarks>
+ ///<para>
+ /// MySql P/Invoke implementation test program
+ /// Brad Merrill
+ /// 3-Mar-2002
+ ///</para>
+ ///<para>
+ /// This structure contains information about a field, such as the
+ /// field's name, type, and size. Its members are described in more
+ /// detail below. You may obtain the <see cref="Field"/> structures for
+ /// each field by calling
+ /// <see cref="MySql.FetchField"/>
+ /// repeatedly.
+ /// Field values are not part of this structure;
+ /// they are contained in a Row structure.
+ ///</para>
+ ///</remarks>
+ [StructLayout(LayoutKind.Sequential)]
+ public class MySqlMarshalledField {
+
+ ///<value>name of column</value>
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string Name;
+ ///<value>table of column</value>
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string Table;
+ ///<value>default value</value>
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string Def;
+ ///<value>type of field</value>
+ public int FieldType;
+ ///<value>width of column</value>
+ public uint Length;
+ ///<value>max width of selected set</value>
+ public uint MaxLength;
+ ///<value>div flags</value>
+ public uint Flags;
+ ///<value>number of decimals in field</value>
+ public uint Decimals;
+ }
+
+ internal sealed class MySqlFieldHelper {
+
+ public static bool IsPrimaryKey(uint fieldFlags) {
+ // if ((SomeEnum)U & SomeEnum.EnumFlagValue) != 0) {...}
+ if(! (((MySqlFieldFlags) fieldFlags) & MySqlFieldFlags.PRI_KEY_FLAG).Equals(0))
+ return true;
+ else
+ return false;
+ }
+
+ public static bool IsNotNull(uint fieldFlags) {
+
+ if(! (((MySqlFieldFlags) fieldFlags) & MySqlFieldFlags.NOT_NULL_FLAG).Equals(0))
+ return true;
+ else
+ return false;
+ }
+
+ public static bool IsBlob(uint fieldFlags) {
+
+ if(! (((MySqlFieldFlags) fieldFlags) & MySqlFieldFlags.BLOB_FLAG).Equals(0))
+ return true;
+ else
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySql.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySql.cs
new file mode 100644
index 00000000000..5f41a9a5ac9
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySql.cs
@@ -0,0 +1,242 @@
+//
+// MySql.cs
+//
+// Provides the core of C# bindings
+// to the MySQL library libMySQL.dll
+//
+// Author:
+// Brad Merrill <zbrad@cybercom.net>
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C)Copyright 2002 Brad Merril
+// (C)Copyright 2002 Daniel Morgan
+//
+// http://www.cybercom.net/~zbrad/DotNet/MySql/
+//
+// Mono has gotten permission from Brad Merrill to include in
+// the Mono Class Library
+// his C# bindings to MySQL under the X11 License
+//
+// Mono can be found at http://www.go-mono.com/
+// The X11/MIT License can be found
+// at http://www.opensource.org/licenses/mit-license.html
+//
+
+namespace Mono.Data.MySql {
+ using System;
+ using System.Security;
+ using System.Runtime.InteropServices;
+
+ internal sealed class MySql {
+ ///<value>protocol version</value>
+ public static readonly uint ProtocolVersion = 10;
+ ///<value>server version</value>
+ public static readonly string ServerVersion = "3.23.49";
+ ///<value>server suffix</value>
+ public static readonly string ServerSuffix = "";
+ ///<value>server version as int</value>
+ public static readonly uint VersionId = 32349;
+ ///<value>server port number</value>
+ public static readonly uint Port = 3306;
+ ///<value>unix named socket</value>
+ public static readonly string UnixAddr = "/tmp/mysql.sock";
+ ///<value>character set</value>
+ public static readonly string CharSet = "latin1";
+
+ ///<summary>Gets or initializes a `MySql' structure</summary>
+ ///<returns>An initialized `MYSQL*' handle. IntPtr.Zero if there was insufficient memory to allocate a new object.</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL", EntryPoint="mysql_init", ExactSpelling=true)]
+ public static extern IntPtr Init(IntPtr db);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL", EntryPoint="mysql_affected_rows", ExactSpelling=true)]
+ public static extern ulong AffectedRows(IntPtr db);
+ //my_ulonglong mysql_affected_rows(MYSQL *mysql);
+
+ ///<summary>Connects to a MySql server</summary>
+ ///<returns><paramref name="db"/> value on success, else returns IntPtr.Zero</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_connect", ExactSpelling=true)]
+ public static extern IntPtr Connect(IntPtr db,
+ [In] string host, [In] string user, [In] string passwd,
+ [In] string dbname,
+ uint port, [In] string socketName, uint flags
+ );
+
+ ///<summary>Selects a database</summary>
+ ///<returns>Zero for success. Non-zero if an error occurred.</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_select_db", ExactSpelling=true)]
+ public static extern int SelectDb(IntPtr conn, [In] string db);
+
+ ///<summary>Closes a server connection</summary>
+ //[SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL", EntryPoint="mysql_close", ExactSpelling=true)]
+ public static extern void Close(IntPtr db);
+
+ ///<summary>Executes a SQL query specified as a string</summary>
+ ///<returns>number of rows changed, -1 if zero</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_query", ExactSpelling=true)]
+ public static extern int Query(IntPtr conn, [In] string query);
+
+ ///<summary>Retrieves a complete result set to the client</summary>
+ ///<returns>An IntPtr result structure with the results. IntPtr.Zero if an error occurred.</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_store_result", ExactSpelling=true)]
+ public static extern IntPtr StoreResult(IntPtr conn);
+
+ ///<returns>Returns the number of rows in a result set</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_num_rows", ExactSpelling=true)]
+ public static extern int NumRows(IntPtr r);
+
+ ///<returns>Returns the number of columns in a result set</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_num_fields", ExactSpelling=true)]
+ public static extern int NumFields(IntPtr r);
+
+ ///<returns>Returns an IntPtr to all field structures</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_fetch_field", ExactSpelling=true)]
+ public static extern IntPtr FetchField(IntPtr r);
+
+ ///<summary>Retrieves the next row of a result set</summary>
+ ///<returns>An IntPtr structure for the next row. IntPtr.Zero if there are no more rows to retrieve or if an error occurred.</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_fetch_row", ExactSpelling=true)]
+ public static extern IntPtr FetchRow(IntPtr r);
+
+ ///<summary>Frees the memory allocated for a result set by <see cref="StoreResult"/></summary>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_free_result", ExactSpelling=true)]
+ public static extern void FreeResult(IntPtr r);
+
+ ///<returns>Returns a string that represents the client library version</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_get_client_info", ExactSpelling=true)]
+ public static extern string GetClientInfo();
+
+ ///<returns></returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_get_host_info", ExactSpelling=true)]
+ public static extern string GetHostInfo(IntPtr db);
+
+ ///<returns>A string describing the type of connection in use, including the server host name.</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_get_server_info", ExactSpelling=true)]
+ public static extern string GetServerInfo(IntPtr db);
+
+ ///<returns>A string describing the server status. null if an error occurred.</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_stat", ExactSpelling=true)]
+ public static extern string Stat(IntPtr db);
+
+ ///<summary>
+ /// Returns a result set describing the current server
+ /// threads. This is the same kind of information as that
+ /// reported by `mysqladmin processlist' or a `SHOW PROCESSLIST'
+ /// query. You must free the result set with
+ /// <see cref="FreeResult"/>.
+ ///</summary>
+ ///<returns>
+ /// A IntPtr result set for success. IntPtr.Zero if an error
+ /// occurred.
+ ///</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_list_processes", ExactSpelling=true)]
+ public static extern IntPtr ListProcesses(IntPtr db);
+
+ ///<summary>
+ ///<para>
+ /// Returns a result set consisting of table names in
+ /// the current database that match the simple regular expression
+ /// specified by the <paramref name="wild"/> parameter.
+ /// <paramref name="wild"/>may contain the wild-card characters
+ /// "%" or "_", or may be a null pointer to match all tables.
+ ///</para>
+ ///<para>
+ /// Calling <see cref="ListTables"/> is similar to executing
+ /// the query "SHOW tables [LIKE wild]".
+ ///</para>
+ ///<para>
+ /// You must free the result set with <see cref="FreeResult"/>.
+ ///</para>
+ ///</summary>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ EntryPoint="mysql_list_tables", ExactSpelling=true)]
+ public static extern IntPtr ListTables(IntPtr db, [In] string wild);
+
+ ///<summary>
+ /// For the connection specified by <paramref name="db"/>,
+ /// <see cref="Error"/> returns the
+ /// error message for the most recently invoked API function
+ /// that can succeed or fail. An empty string ("") is
+ /// returned if no error occurred.
+ ///</summary>
+ ///<returns>
+ /// A string that describes the error. An empty string if no error occurred.
+ ///</returns>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="mysql_error", ExactSpelling=true)]
+ public static extern string Error(IntPtr db);
+
+ ///<summary>
+ ///<para>
+ /// This function needs to be called before exiting
+ /// to free memory allocated explicitly by
+ /// <see cref="ThreadInit"/> or implicitly by
+ /// <see cref="Init"/>.
+ ///</para>
+ ///<para>
+ /// Note that this function is NOT invoked automatically by the client
+ /// library!
+ ///</para>
+ ///</summary>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="my_thread_end", ExactSpelling=true)]
+ public static extern void ThreadEnd();
+
+ ///<summary>
+ ///<para>
+ /// This function needs to be called for each created thread
+ /// to initialize thread specific variables.
+ ///</para>
+ ///<para>
+ /// This is automatically called by <see cref="Init"/>.
+ ///</para>
+ ///</summary>
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport("libmySQL",
+ CharSet=System.Runtime.InteropServices.CharSet.Ansi,
+ EntryPoint="my_thread_init", ExactSpelling=true)]
+ public static extern void ThreadInit();
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlCommand.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlCommand.cs
new file mode 100644
index 00000000000..52cf320b8cf
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlCommand.cs
@@ -0,0 +1,554 @@
+//
+// Mono.Data.MySql.MySqlCommand.cs
+//
+// Author:
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Daniel Morgan, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Xml;
+
+namespace Mono.Data.MySql {
+ public sealed class MySqlCommand : Component, IDbCommand, ICloneable {
+
+ #region Fields
+
+ private string sql = "";
+ private int timeout = 30;
+ // default is 30 seconds
+ // for command execution
+
+ private MySqlConnection conn = null;
+ private MySqlTransaction trans = null;
+ private CommandType cmdType = CommandType.Text;
+ private bool designTime = false;
+ private MySqlParameterCollection parmCollection = new
+ MySqlParameterCollection();
+
+ // MySqlDataReader state data for ExecuteReader()
+ //private MySqlDataReader dataReader = null;
+ private string[] commands = null;
+ private int currentQuery = -1;
+ private CommandBehavior cmdBehavior = CommandBehavior.Default;
+
+ private bool disposed = false;
+
+ private const char bindChar = ':';
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MySqlCommand() {
+ sql = "";
+ }
+
+ public MySqlCommand (string cmdText) {
+ sql = cmdText;
+ }
+
+ public MySqlCommand (string cmdText, MySqlConnection connection) {
+ sql = cmdText;
+ conn = connection;
+ }
+
+ public MySqlCommand (string cmdText, MySqlConnection connection,
+ MySqlTransaction transaction) {
+ sql = cmdText;
+ conn = connection;
+ trans = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void Cancel () {
+ // FIXME: use non-blocking Exec for this
+ throw new NotImplementedException ();
+ }
+
+ // FIXME: is this the correct way to return a stronger type?
+ [MonoTODO]
+ IDbDataParameter IDbCommand.CreateParameter () {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ public MySqlParameter CreateParameter () {
+ return new MySqlParameter ();
+ }
+
+ public int ExecuteNonQuery () {
+ int rowsAffected = -1;
+
+ IntPtr res = ExecuteSQL (sql);
+
+ if(res.Equals(IntPtr.Zero)) {
+ // no result set returned, get records affected
+ rowsAffected = (int) MySql.AffectedRows(conn.NativeMySqlInitStruct);
+ }
+
+ MySql.FreeResult(res);
+ res = IntPtr.Zero;
+
+ // >= 0 of the number of rows affected by
+ // INSERT, UPDATE, DELETE
+ // otherwise, -1
+ return rowsAffected;
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader () {
+ return ExecuteReader ();
+ }
+
+ [MonoTODO]
+ public MySqlDataReader ExecuteReader () {
+ return ExecuteReader(CommandBehavior.Default);
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader (
+ CommandBehavior behavior) {
+
+ return ExecuteReader (behavior);
+ }
+
+ [MonoTODO]
+ public MySqlDataReader ExecuteReader (CommandBehavior behavior) {
+
+ MySqlDataReader reader = null;
+
+ currentQuery = -1;
+
+ commands = sql.Split(new Char[] {';'});
+ reader = new MySqlDataReader(this, behavior);
+ reader.NextResult();
+
+ return reader;
+ }
+
+ // called by an MySqlDataReader's NextResult()
+ internal IntPtr NextResult (out bool result) {
+
+ IntPtr mysqlResult = IntPtr.Zero;
+ result = false;
+
+ currentQuery++;
+ if(currentQuery < commands.Length) {
+ string query = "";
+
+ // don't execute empty queries
+ while((query = commands[currentQuery]).Equals("")) {
+ currentQuery++;
+ if(currentQuery >= commands.Length)
+ return IntPtr.Zero;
+ }
+ mysqlResult = ExecuteSQL (query);
+ result = true; // has result
+ }
+
+ return mysqlResult;
+ }
+
+ public object ExecuteScalar () {
+
+ object obj = null;
+
+ IntPtr res = ExecuteSQL (sql);
+
+ int numRows = MySql.NumRows(res);
+ int numFields = MySql.NumFields(res);
+
+ MySqlMarshalledField fd;
+ fd = (MySqlMarshalledField) Marshal.PtrToStructure(MySql.FetchField(res),
+ typeof(MySqlMarshalledField));
+ string fieldName = fd.Name;
+ int fieldType = fd.FieldType;
+ MySqlEnumFieldTypes mysqlFieldType = (MySqlEnumFieldTypes) fieldType;
+ DbType fieldDbType = MySqlHelper.MySqlTypeToDbType(mysqlFieldType);
+
+ IntPtr row;
+ row = MySql.FetchRow(res);
+ if(row == IntPtr.Zero) {
+ // EOF
+ obj = null;
+ }
+ else {
+ // only get first column/first row
+ string objValue = GetColumnData(row, 0);
+ obj = MySqlHelper.ConvertDbTypeToSystem (mysqlFieldType, fieldDbType, objValue);
+ row = IntPtr.Zero;
+ }
+ MySql.FreeResult(res);
+ res = IntPtr.Zero;
+
+ return obj;
+ }
+
+ // command: string in - SQL command
+ // IntPtr (MySqlResult) return - the result
+ // Use of this function needs to check to see if
+ // if the return equal to IntPtr.Zero
+ // Example: IntPtr res = ExecuteSQL ("SELECT * FROM DB");
+ // if (res == IntPtr.Zero) { // do something }
+ //
+ internal IntPtr ExecuteSQL (string command) {
+ string msg = "";
+
+ if (conn == null)
+ throw new InvalidOperationException(
+ "Connection is null");
+
+ if (conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnectionState is not Open");
+
+ if (sql.Equals (String.Empty))
+ throw new InvalidOperationException(
+ "CommandText is Empty");
+
+ string query = TweakQuery(sql);
+
+ int rcq = MySql.Query(conn.NativeMySqlInitStruct, query);
+ if (rcq != 0) {
+ msg =
+ "MySql Error: " +
+ "Could not execute command [" +
+ sql +
+ "] on server because: " +
+ MySql.Error(conn.NativeMySqlInitStruct);
+ throw new MySqlException(msg);
+ }
+ IntPtr result = MySql.StoreResult(conn.NativeMySqlInitStruct);
+ return result;
+ }
+
+ string TweakQuery(string query) {
+ string statement = "";
+
+ switch(cmdType) {
+ case CommandType.Text:
+ statement = ReplaceParameterPlaceholders (query);
+ break;
+ case CommandType.StoredProcedure:
+ string sParmList = GetStoredProcParmList ();
+ statement = "SELECT " + query + "(" + sParmList + ")";
+ break;
+ case CommandType.TableDirect:
+ statement =
+ "SELECT * FROM " + query;
+ break;
+ }
+ return statement;
+ }
+
+ string GetStoredProcParmList () {
+ StringBuilder s = new StringBuilder();
+
+ int addedCount = 0;
+ for(int p = 0; p < parmCollection.Count; p++) {
+ MySqlParameter prm = parmCollection[p];
+ if(prm.Direction == ParameterDirection.Input) {
+ string strObj = MySqlHelper.
+ ObjectToString(prm.DbType,
+ prm.Value);
+ if(addedCount > 0)
+ s.Append(",");
+ s.Append(strObj);
+ addedCount++;
+ }
+ }
+ return s.ToString();
+ }
+
+ // TODO: this only supports input parameters,
+ // need support for output, input/output,
+ // and return parameters
+ // As far as I know, MySQL does not support
+ // parameters so the parameters support in this
+ // provider is just a search and replace.
+ string ReplaceParameterPlaceholders (string query) {
+
+ string resultSql = "";
+
+ StringBuilder result = new StringBuilder();
+ char[] chars = sql.ToCharArray();
+ bool bStringConstFound = false;
+
+ for(int i = 0; i < chars.Length; i++) {
+ if(chars[i] == '\'') {
+ if(bStringConstFound == true)
+ bStringConstFound = false;
+ else
+ bStringConstFound = true;
+
+ result.Append(chars[i]);
+ }
+ else if(chars[i] == bindChar &&
+ bStringConstFound == false) {
+
+ StringBuilder parm = new StringBuilder();
+ i++;
+ while(i <= chars.Length) {
+ char ch;
+ if(i == chars.Length)
+ ch = ' '; // a space
+ else
+ ch = chars[i];
+
+ if(Char.IsLetterOrDigit(ch)) {
+ parm.Append(ch);
+ }
+ else {
+ string p = parm.ToString();
+ bool found = BindReplace(result, p);
+
+ if(found == true)
+ break;
+ else {
+ // *** Error Handling
+ Console.WriteLine("Error: parameter not found: " + p);
+ return "";
+ }
+ }
+ i++;
+ }
+ i--;
+ }
+ else
+ result.Append(chars[i]);
+ }
+
+ resultSql = result.ToString();
+ return resultSql;
+ }
+
+ bool BindReplace (StringBuilder result, string p) {
+ // bind variable
+ bool found = false;
+
+ if(parmCollection.Contains(p) == true) {
+ // parameter found
+ MySqlParameter prm = parmCollection[p];
+
+ // convert object to string and place
+ // into SQL
+ if(prm.Direction == ParameterDirection.Input) {
+ string strObj = MySqlHelper.
+ ObjectToString(prm.DbType,
+ prm.Value);
+ result.Append(strObj);
+ }
+ else
+ result.Append(bindChar + p);
+
+ found = true;
+ }
+ return found;
+ }
+
+ [MonoTODO]
+ public XmlReader ExecuteXmlReader () {
+ //MySqlDataReader dataReader = ExecuteReader ();
+ //MySqlXmlTextReader textReader = new MySqlXmlTextReader (dataReader);
+ //XmlReader xmlReader = new XmlTextReader (textReader);
+ //return xmlReader;
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Prepare () {
+ // FIXME: parameters have to be implemented for this
+ throw new NotImplementedException ();
+ }
+
+ object ICloneable.Clone() {
+ throw new NotImplementedException ();
+ }
+
+ // Used to marshal a field value from the database result set.
+ // The indexed column data on the current result set row.
+ // res = the result set from a MySql.Query().
+ // index = the column index.
+ internal string GetColumnData(IntPtr res, int index) {
+ IntPtr str = Marshal.ReadIntPtr(res, index*IntPtr.Size);
+ if (str == IntPtr.Zero)
+ return "";
+ string s = Marshal.PtrToStringAnsi(str);
+ return s;
+ }
+
+ #endregion // Methods
+
+ #region Properties
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+
+ set {
+ sql = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+
+ set {
+ // FIXME: if value < 0, throw
+ // ArgumentException
+ // if (value < 0)
+ // throw ArgumentException;
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return cmdType;
+ }
+
+ set {
+ cmdType = value;
+ }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during a
+ // transaction in progress
+
+ // csc
+ Connection = (MySqlConnection) value;
+ // mcs
+ // Connection = value;
+
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public MySqlConnection Connection {
+ get {
+ // conn defaults to null
+ return conn;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during
+ // a transaction in progress
+ conn = value;
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTime;
+ }
+
+ set{
+ designTime = value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ public MySqlParameterCollection Parameters {
+ get {
+ return parmCollection;
+ }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return Transaction;
+ }
+
+ set {
+ // FIXME: error handling - do not allow
+ // setting of transaction if transaction
+ // has already begun
+ Transaction = (MySqlTransaction) value;
+
+ }
+ }
+
+ public MySqlTransaction Transaction {
+ get {
+ return trans;
+ }
+
+ set {
+ // FIXME: error handling
+ trans = value;
+ }
+ }
+
+ [MonoTODO]
+ public UpdateRowSource UpdatedRowSource {
+ // FIXME: do this once DbDataAdaptor
+ // and DataRow are done
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Inner Classes
+
+ #endregion // Inner Classes
+
+ #region Destructors
+
+ protected override void Dispose(bool disposing) {
+ if(!this.disposed)
+ try {
+ if(disposing) {
+ // release any managed resources
+ }
+ // release any unmanaged resources
+ // close any handles
+
+ this.disposed = true;
+ }
+ finally {
+ base.Dispose(disposing);
+ }
+ }
+
+ // aka Finalize()
+ ~MySqlCommand () {
+ Dispose (false);
+ }
+
+ #endregion //Destructors
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlConnection.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlConnection.cs
new file mode 100644
index 00000000000..7deb8f7af08
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlConnection.cs
@@ -0,0 +1,537 @@
+//
+// Mono.Data.MySql.MyConnection.cs
+//
+// Author:
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Data.MySql {
+
+ public sealed class MySqlConnection : Component, ICloneable, IDbConnection {
+
+ #region Fields
+
+ private IntPtr mysqlInitStruct = IntPtr.Zero;
+ private IntPtr mysqlConn = IntPtr.Zero;
+
+ private string connectionString = "";
+ private string mysqlConnectionString = "";
+
+ private MySqlTransaction trans = null;
+ private int connectionTimeout = 15;
+ // default for 15 seconds
+
+ // MySQL connection string parameters
+ string host = "";
+ string user = "";
+ string passwd = "";
+ string dbname = "";
+ uint port = MySql.Port;
+ string socketName = "";
+ uint flags = 0;
+
+ // connection state
+ private ConnectionState conState = ConnectionState.Closed;
+
+ // DataReader state
+ //private MySqlDataReader rdr = null;
+ private bool dataReaderOpen = false;
+ // FIXME: if true, throw an exception if SqlConnection
+ // is used for anything other than reading
+ // data using SqlDataReader
+
+ private string versionString = "Unknown";
+ private bool disposed = false;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ // A lot of the defaults were initialized in the Fields
+ [MonoTODO]
+ public MySqlConnection () {
+
+ }
+
+ [MonoTODO]
+ public MySqlConnection (String connectionString) {
+ SetConnectionString (connectionString);
+ }
+
+ #endregion // Constructors
+
+ #region Destructors
+
+ protected override void Dispose(bool disposing) {
+ if(!this.disposed)
+ try {
+ if(disposing) {
+ // release any managed resources
+ trans = null;
+ }
+ // release any unmanaged resources
+ mysqlInitStruct = IntPtr.Zero;
+ IntPtr mysqlConn = IntPtr.Zero;
+
+ // close any handles
+
+ this.disposed = true;
+ }
+ finally {
+ base.Dispose(disposing);
+ }
+ }
+
+ // aka Finalize
+ ~MySqlConnection() {
+ Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ #region Public Methods
+
+ IDbTransaction IDbConnection.BeginTransaction () {
+ return BeginTransaction ();
+ }
+
+ public MySqlTransaction BeginTransaction () {
+ return TransactionBegin (); // call private method
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel
+ il) {
+ return BeginTransaction (il);
+ }
+
+ public MySqlTransaction BeginTransaction (IsolationLevel il) {
+ return TransactionBegin (il); // call private method
+ }
+
+ [MonoTODO]
+ public MySqlTransaction BeginTransaction(string transactionName) {
+
+ // FIXME: Can MySQL handle named transactions?
+ return TransactionBegin (); // call private method
+ }
+
+ [MonoTODO]
+ public MySqlTransaction BeginTransaction(IsolationLevel iso,
+ string transactionName) {
+
+ // FIXME: Can MySQL handle named transactions?
+ return TransactionBegin (iso); // call private method
+ }
+
+ public void ChangeDatabase (string databaseName) {
+ dbname = databaseName;
+ int sdb = MySql.SelectDb(mysqlInitStruct, dbname);
+ if (sdb != 0) {
+ string msg =
+ "MySql Error: " +
+ "Can not select the " +
+ dbname +
+ " database because: " +
+ MySql.Error(mysqlInitStruct);
+ throw new MySqlException (msg);
+ }
+ }
+
+ object ICloneable.Clone() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Close () {
+ if(dataReaderOpen == true) {
+ // TODO: what do I do if
+ // the user Closes the connection
+ // without closing the Reader first?
+
+ }
+ CloseDataSource ();
+ }
+
+ IDbCommand IDbConnection.CreateCommand () {
+ return CreateCommand ();
+ }
+
+ public MySqlCommand CreateCommand () {
+ MySqlCommand sqlcmd = new MySqlCommand ("", this);
+
+ return sqlcmd;
+ }
+
+ [MonoTODO]
+ public void Open () {
+ if(dbname.Equals(""))
+ throw new InvalidOperationException(
+ "dbname missing");
+ else if(conState == ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is already Open");
+ else if(connectionString.Equals(String.Empty))
+ throw new InvalidOperationException(
+ "ConnectionString is not set");
+
+ // FIXME: check to make sure we have
+ // everything to connect,
+ // otherwise, throw an exception
+
+ mysqlInitStruct = MySql.Init(IntPtr.Zero);
+ if (mysqlInitStruct == IntPtr.Zero) {
+ throw new MySqlException("MySQL Init failed.");
+ }
+
+
+ // *** this is what it should be ***
+ //mysqlConn = MySql.Connect(mysqlInitStruct,
+ // host.Equals("") ? null : host,
+ // user.Equals("") ? null : user,
+ // passwd.Equals("") ? null : passwd,
+ // dbname.Equals("") ? null : dbname,
+ // port,
+ // socketName.Equals("") ? null : socketName,
+ // flags);
+ //
+ mysqlConn = MySql.Connect(mysqlInitStruct,
+ host,
+ user,
+ passwd,
+ dbname,
+ port,
+ socketName,
+ flags);
+ if (mysqlConn == IntPtr.Zero) {
+ string msg = "MySQL Connect failed, " +
+ MySql.Error(mysqlInitStruct);
+ throw new MySqlException(msg);
+ }
+
+ this.ChangeDatabase (dbname);
+
+ // Successfully Connected
+ SetupConnection();
+ }
+
+ #endregion // Public Methods
+
+ #region Protected Methods
+
+ #endregion
+
+ #region Internal Methods
+
+ // Used to prevent MySqlConnection
+ // from doing anything while
+ // MySqlDataReader is open.
+ // Open the Reader. (called from MySqlCommand)
+ /*
+ internal void OpenReader(MySqlDataReader reader) {
+ if(dataReaderOpen == true) {
+ // TODO: throw exception here?
+ // because a reader
+ // is already open
+ }
+ else {
+ rdr = reader;
+ dataReaderOpen = true;
+ }
+ }
+ */
+
+ // Used to prevent MySqlConnection
+ // from doing anything while
+ // MySqlDataReader is open
+ // Close the Reader (called from MySqlCommand)
+ // if closeConnection true, Close() the connection
+ // this is based on CommandBehavior.CloseConnection
+ internal void CloseReader(bool closeConnection) {
+ if(closeConnection == true)
+ CloseDataSource();
+ else
+ dataReaderOpen = false;
+ }
+
+ #endregion // Internal Methods
+
+ #region Private Methods
+
+ private void SetupConnection() {
+ conState = ConnectionState.Open;
+
+ versionString = GetDatabaseServerVersion();
+ }
+
+ private string GetDatabaseServerVersion() {
+ MySqlCommand cmd = new MySqlCommand("select version()",this);
+ return (string) cmd.ExecuteScalar();
+ }
+
+ private void CloseDataSource () {
+ // FIXME: just a quick hack
+ if(conState == ConnectionState.Open) {
+ /*
+ if(trans != null)
+ if(trans.DoingTransaction == true) {
+ trans.Rollback();
+ // trans.Dispose();
+ trans = null;
+ }
+ */
+ conState = ConnectionState.Closed;
+ MySql.Close(mysqlInitStruct);
+ MySql.ThreadEnd();
+ mysqlConn = IntPtr.Zero;
+ }
+ }
+
+ void SetConnectionString (string connectionString) {
+ this.connectionString = connectionString;
+
+ connectionString += ";";
+ NameValueCollection parameters = new NameValueCollection ();
+
+ if (connectionString == String.Empty)
+ return;
+
+ bool inQuote = false;
+ bool inDQuote = false;
+
+ string name = String.Empty;
+ string value = String.Empty;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in connectionString) {
+ switch (c) {
+ case '\'':
+ inQuote = !inQuote;
+ break;
+ case '"' :
+ inDQuote = !inDQuote;
+ break;
+ case ';' :
+ if (!inDQuote && !inQuote) {
+ if (name != String.Empty && name != null) {
+ value = sb.ToString ();
+ parameters [name.ToUpper ().Trim ()] = value.Trim ();
+ }
+ name = String.Empty;
+ value = String.Empty;
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ case '=' :
+ if (!inDQuote && !inQuote) {
+ name = sb.ToString ();
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ default:
+ sb.Append (c);
+ break;
+ }
+ }
+
+ SetProperties (parameters);
+ }
+
+ private void SetProperties (NameValueCollection parameters) {
+
+ StringBuilder connectionStr = new StringBuilder();
+
+ string value;
+ foreach (string name in parameters) {
+ value = parameters[name];
+
+ bool found = true;
+ switch (name) {
+ case "PORT" :
+ port = UInt32.Parse(value);
+ break;
+ case "DATA SOURCE" :
+ case "SERVER" :
+ case "HOST" :
+ // set DataSource property
+ host = value;
+ break;
+ case "INITIAL CATALOG" :
+ case "DATABASE" :
+ case "DBNAME" :
+ // set Database property
+ dbname = value;
+ break;
+ case "PASSWORD" :
+ case "PWD" :
+ case "PASSWD" :
+ passwd = value;
+ break;
+ case "USER ID" :
+ case "UID" :
+ case "USER" :
+ user = value;
+ break;
+ case "SOCKETNAME":
+ socketName = value;
+ break;
+ case "FLAGS" :
+ // FIXME: how to get these flags and
+ // and pass to MySQL?
+ // flags is a bitfield
+ flags = UInt32.Parse(value);
+ break;
+ default:
+ found = false;
+ // FIXME: throw exception?
+ break;
+ }
+ if (found == true) {
+ string valuePair = name + "=" + value;
+ connectionStr.Append (valuePair + " ");
+ }
+ }
+ this.mysqlConnectionString = connectionStr.ToString ();
+ }
+
+ private MySqlTransaction TransactionBegin () {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new MySqlTransaction ();
+ // using internal methods of SqlTransaction
+ trans.SetConnection (this);
+ trans.Begin();
+
+ return trans;
+ }
+
+ private MySqlTransaction TransactionBegin (IsolationLevel il) {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new MySqlTransaction ();
+ // using internal methods of MySqlTransaction
+ trans.SetConnection (this);
+ trans.SetIsolationLevel (il);
+ trans.Begin();
+
+ return trans;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ [MonoTODO]
+ public ConnectionState State {
+ get {
+ return conState;
+ }
+ }
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ SetConnectionString (value);
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+ public string Database {
+ get {
+ return dbname;
+ }
+ }
+
+ public string DataSource {
+ get {
+ return host;
+ }
+ }
+
+ public int PacketSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string ServerVersion {
+ get {
+ return versionString;
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Internal Properties
+
+ // For Mono.Data.MySql classes
+ // to get the current transaction
+ // in progress - if any
+ internal MySqlTransaction Transaction {
+ get {
+ return trans;
+ }
+ }
+
+ // For Mono.Data.MySql classes
+ // to get the unmanaged MySql connection
+ internal IntPtr NativeMySqlConnection {
+ get {
+ return mysqlConn;
+ }
+ }
+
+ // For Mono.Data.MySql classes
+ // to get the unmanaged MySql connection
+ internal IntPtr NativeMySqlInitStruct {
+ get {
+ return mysqlInitStruct;
+ }
+ }
+
+ // Used to prevent SqlConnection
+ // from doing anything while
+ // SqlDataReader is open
+ internal bool IsReaderOpen {
+ get {
+ return dataReaderOpen;
+ }
+ }
+
+ #endregion // Internal Properties
+
+ #region Events
+/*
+ public event
+ MyInfoMessageEventHandler InfoMessage;
+
+ public event
+ StateChangeEventHandler StateChange;
+*/
+ #endregion
+
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataAdapter.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataAdapter.cs
new file mode 100755
index 00000000000..069f7079e9d
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataAdapter.cs
@@ -0,0 +1,174 @@
+//
+// Mono.Data.MySql.MySqlDataAdapter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Tim Coleman, 2002
+// Copyright (C) Daniel Morgan, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.MySql
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used
+ /// to fill the DataSet and update a data source, all this
+ /// from a SQL database.
+ /// </summary>
+ public sealed class MySqlDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ MySqlCommand deleteCommand;
+ MySqlCommand insertCommand;
+ MySqlCommand selectCommand;
+ MySqlCommand updateCommand;
+
+ static readonly object EventRowUpdated = new object();
+ static readonly object EventRowUpdating = new object();
+
+ #endregion
+
+ #region Constructors
+
+ public MySqlDataAdapter ()
+ : this (new MySqlCommand ())
+ {
+ }
+
+ public MySqlDataAdapter (MySqlCommand selectCommand)
+ {
+ DeleteCommand = new MySqlCommand ();
+ InsertCommand = new MySqlCommand ();
+ SelectCommand = selectCommand;
+ UpdateCommand = new MySqlCommand ();
+ }
+
+ public MySqlDataAdapter (string selectCommandText, MySqlConnection selectConnection)
+ : this (new MySqlCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public MySqlDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new MySqlConnection (selectConnectionString))
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public MySqlCommand DeleteCommand {
+ get { return deleteCommand; }
+ set { deleteCommand = value; }
+ }
+
+ public MySqlCommand InsertCommand {
+ get { return insertCommand; }
+ set { insertCommand = value; }
+ }
+
+ public MySqlCommand SelectCommand {
+ get { return selectCommand; }
+ set { selectCommand = value; }
+ }
+
+ public MySqlCommand UpdateCommand {
+ get { return updateCommand; }
+ set { updateCommand = value; }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is MySqlCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (MySqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is MySqlCommand))
+ throw new ArgumentException ();
+ InsertCommand = (MySqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is MySqlCommand))
+ throw new ArgumentException ();
+ SelectCommand = (MySqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is MySqlCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (MySqlCommand)value;
+ }
+ }
+
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new MySqlRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new MySqlRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ MySqlRowUpdatedEventHandler handler = (MySqlRowUpdatedEventHandler) Events[EventRowUpdated];
+ if ((handler != null) && (value is MySqlRowUpdatedEventArgs))
+ handler (this, (MySqlRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ MySqlRowUpdatingEventHandler handler = (MySqlRowUpdatingEventHandler) Events[EventRowUpdating];
+ if ((handler != null) && (value is MySqlRowUpdatingEventArgs))
+ handler (this, (MySqlRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event MySqlRowUpdatedEventHandler RowUpdated {
+ add { Events.AddHandler (EventRowUpdated, value); }
+ remove { Events.RemoveHandler (EventRowUpdated, value); }
+ }
+
+ public event MySqlRowUpdatingEventHandler RowUpdating {
+ add { Events.AddHandler (EventRowUpdating, value); }
+ remove { Events.RemoveHandler (EventRowUpdating, value); }
+ }
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataReader.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataReader.cs
new file mode 100644
index 00000000000..b24d1ffc7cf
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlDataReader.cs
@@ -0,0 +1,539 @@
+//
+// Mono.Data.MySql.MySqlDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.MySql {
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams
+ /// of result sets obtained by executing a command
+ /// at a SQL database.
+ /// </summary>
+ public sealed class MySqlDataReader : MarshalByRefObject,
+ IEnumerable, IDataReader, IDisposable, IDataRecord
+ {
+
+ #region Fields
+
+ private MySqlCommand cmd;
+
+ // field meta data
+ private string[] fieldName;
+ private MySqlEnumFieldTypes[] fieldType; // MySQL data type
+ private DbType[] fieldDbType; // DbType translated from MySQL type
+ private uint[] fieldLength;
+ private uint[] fieldMaxLength;
+ private uint[] fieldFlags;
+ // field data value
+ private object[] dataValue;
+
+ private bool open = false;
+
+ private int recordsAffected = -1;
+ private int currentQuery = 0;
+
+ private int currentRow = -1;
+ private IntPtr res = IntPtr.Zero;
+ private IntPtr row = IntPtr.Zero;
+
+ private int numFields;
+ private int numRows;
+
+ private CommandBehavior cmdBehavior;
+
+ private bool disposed = false;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal MySqlDataReader (MySqlCommand sqlCmd, CommandBehavior behavior) {
+
+ cmd = sqlCmd;
+ open = true;
+ // cmd.OpenReader(this);
+ cmdBehavior = behavior;
+ }
+
+ #endregion // Fields
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Close() {
+ open = false;
+
+ // free MySqlDataReader resources in SqlCommand
+ // and allow SqlConnection to be used again
+ //cmd.CloseReader();
+
+ // TODO: get parameters from result
+
+ Dispose(true);
+ }
+
+ public DataTable GetSchemaTable() {
+
+ DataTable dataTableSchema = null;
+ // Only Results from SQL SELECT Queries
+ // get a DataTable for schema of the result
+ // otherwise, DataTable is null reference
+ if(numFields > 0) {
+
+ dataTableSchema = new DataTable ("SchemaTable");
+
+ dataTableSchema.Columns.Add ("ColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
+ dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
+ dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
+ dataTableSchema.Columns.Add ("NumericScale", typeof (int));
+ dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
+ dataTableSchema.Columns.Add ("IsKey", typeof (bool));
+ DataColumn dc = dataTableSchema.Columns["IsKey"];
+ dc.AllowDBNull = true; // IsKey can have a DBNull
+ dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
+ dataTableSchema.Columns.Add ("DataType", typeof(Type));
+ dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
+ dataTableSchema.Columns.Add ("ProviderType", typeof (int));
+ dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
+ dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
+ dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
+ dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
+ dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
+ dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
+ dataTableSchema.Columns.Add ("IsLong", typeof (bool));
+ dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
+
+ DataRow schemaRow;
+
+ Type typ;
+
+ for (int i = 0; i < numFields; i += 1 ) {
+
+ schemaRow = dataTableSchema.NewRow ();
+
+ schemaRow["ColumnName"] = fieldName[i];
+ schemaRow["ColumnOrdinal"] = i + 1;
+
+ schemaRow["ColumnSize"] = (int) fieldMaxLength[i];
+ schemaRow["NumericPrecision"] = 0;
+ schemaRow["NumericScale"] = 0;
+
+ if((cmdBehavior & CommandBehavior.KeyInfo) == CommandBehavior.KeyInfo) {
+ // TODO: need to get KeyInfo
+ schemaRow["IsUnique"] = false;
+ schemaRow["IsKey"] = false;
+ }
+ else {
+ schemaRow["IsUnique"] = false;
+ schemaRow["IsKey"] = DBNull.Value;
+ }
+ schemaRow["BaseCatalogName"] = "";
+
+ schemaRow["BaseColumnName"] = fieldName[i];
+ schemaRow["BaseSchemaName"] = "";
+ schemaRow["BaseTableName"] = "";
+
+ typ = MySqlHelper.DbTypeToSystemType (fieldDbType[i]);
+ schemaRow["DataType"] = typ;
+
+ schemaRow["AllowDBNull"] = false;
+
+ schemaRow["ProviderType"] = (int) fieldType[i];
+ schemaRow["IsAliased"] = false;
+ schemaRow["IsExpression"] = false;
+ schemaRow["IsIdentity"] = false;
+ schemaRow["IsAutoIncrement"] = false;
+ schemaRow["IsRowVersion"] = false;
+ schemaRow["IsHidden"] = false;
+ schemaRow["IsLong"] = false;
+ schemaRow["IsReadOnly"] = false;
+
+ dataTableSchema.Rows.Add (schemaRow);
+ }
+ }
+
+ return dataTableSchema;
+ }
+
+ private void ClearFields () {
+ numRows = 0;
+ numFields = 0;
+ fieldName = null;
+ fieldType = null;
+ fieldLength = null;
+ fieldMaxLength = null;
+ fieldFlags = null;
+ dataValue = null;
+ }
+
+ public bool NextResult () {
+
+ // reset
+ recordsAffected = -1;
+ currentRow = -1;
+
+ bool resultReturned;
+ res = cmd.NextResult (out resultReturned);
+ if (resultReturned == false)
+ return false; // no result returned
+
+ if ((cmdBehavior & CommandBehavior.SingleResult) == CommandBehavior.SingleResult)
+ if (currentQuery > 0) {
+ if(res == IntPtr.Zero)
+ recordsAffected = (int) MySql.AffectedRows(cmd.Connection.NativeMySqlInitStruct);
+ ClearFields();
+ return true; // result returned
+ }
+
+ if((cmdBehavior & CommandBehavior.SchemaOnly) == CommandBehavior.SchemaOnly) {
+ ClearFields ();
+ return false; // no result returned
+ }
+
+ if(res == IntPtr.Zero) {
+ // no result set returned
+ recordsAffected = (int) MySql.AffectedRows (cmd.Connection.NativeMySqlInitStruct);
+ ClearFields();
+ }
+ else {
+ dataValue = null;
+
+ // get meta data about result set
+ numRows = MySql.NumRows(res);
+ numFields = MySql.NumFields(res);
+ // get meta data about each field
+ fieldName = new string[numFields];
+ fieldType = new MySqlEnumFieldTypes[numFields];
+ fieldLength = new uint[numFields];
+ fieldMaxLength = new uint[numFields];
+ fieldFlags = new uint[numFields];
+
+ fieldDbType = new DbType[numFields];
+
+ // marshal each meta data field
+ // into field* arrays
+ MySqlMarshalledField marshField = null;
+ for (int i = 0; i < numFields; i++) {
+ // marshal field
+ marshField = (MySqlMarshalledField) Marshal.PtrToStructure(MySql.FetchField(res),
+ typeof(MySqlMarshalledField));
+
+ // copy memebers in marshalField to fields[i]
+ fieldName[i] = marshField.Name;
+ int myType = marshField.FieldType;
+ fieldType[i] = (MySqlEnumFieldTypes) myType;
+ fieldLength[i] = marshField.Length;
+ fieldMaxLength[i] = marshField.MaxLength;
+ fieldFlags[i] = marshField.Flags;
+
+ fieldDbType[i] = MySqlHelper.MySqlTypeToDbType((MySqlEnumFieldTypes)fieldType[i]);
+ marshField = null;
+ }
+ }
+ return true; // result returned
+ }
+
+ public bool Read() {
+
+ dataValue = null;
+
+ if(currentRow < numRows - 1) {
+
+ currentRow++;
+
+ if(numFields > 0 && currentRow > 0)
+ if((cmdBehavior & CommandBehavior.SingleRow) ==
+ CommandBehavior.SingleRow) {
+
+ currentRow = numRows - 1;
+ return false; // EOF
+ }
+
+ row = MySql.FetchRow (res);
+ if (row == IntPtr.Zero) {
+ MySql.FreeResult (res);
+ res = IntPtr.Zero;
+ return false; // EOF
+ }
+ else {
+ dataValue = new object[numFields];
+ for (int col = 0; col < numFields; col++) {
+ GetDataValue (row, col);
+ }
+ }
+ return true; // not EOF
+ }
+ return false; // EOF
+ }
+
+ void GetDataValue (IntPtr row, int col) {
+ // marshal column data value
+ string objValue = cmd.GetColumnData(row, col);
+
+ // tranlate from native MySql c type
+ // to a .NET type here
+ dataValue[col] = MySqlHelper.ConvertDbTypeToSystem (fieldType[col],
+ fieldDbType[col], objValue);
+
+ // TODO: for CommandBehavior.SequentialAccess -
+ // used for reading Large OBjects
+ //if((cmdBehavior & CommandBehavior.SequentialAccess) ==
+ // CommandBehavior.SequentialAccess) {
+ //}
+ }
+
+ [MonoTODO]
+ public byte GetByte (int i) {
+ throw new NotImplementedException ();
+ }
+
+ // TODO: CommandBehavior.SequentialAccess
+ // and handling LOBs
+ [MonoTODO]
+ public long GetBytes (int i, long fieldOffset,
+ byte[] buffer, int bufferOffset,
+ int length) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar (int i) {
+ throw new NotImplementedException ();
+ }
+
+ // TODO: CommandBehavior.SequentialAccess
+ // and handling LOBs
+ [MonoTODO]
+ public long GetChars (int i, long fieldOffset,
+ char[] buffer, int bufferOffset,
+ int length) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDataReader GetData (int i) {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int i) {
+ return MySqlHelper.GetMySqlTypeName (fieldType[i]);
+ }
+
+ public DateTime GetDateTime(int i) {
+ return (DateTime) dataValue[i];
+ }
+
+ public decimal GetDecimal(int i) {
+ return (decimal) dataValue[i];
+ }
+
+ public double GetDouble(int i) {
+ return (double) dataValue[i];
+ }
+
+ public Type GetFieldType(int i) {
+ return MySqlHelper.DbTypeToSystemType (fieldDbType[i]);
+ }
+
+ public float GetFloat(int i) {
+ return (float) dataValue[i];
+ }
+
+ public Guid GetGuid(int i) {
+ throw new NotImplementedException ();
+ }
+
+ public short GetInt16(int i) {
+ return (short) dataValue[i];
+ }
+
+ public int GetInt32(int i) {
+ return (int) dataValue[i];
+ }
+
+ public long GetInt64(int i) {
+ return (long) dataValue[i];
+ }
+
+ public string GetName(int i) {
+ return fieldName[i];
+ }
+
+ public int GetOrdinal (string name) {
+
+ int i;
+
+ for(i = 0; i < numFields; i++) {
+ if(fieldName[i].Equals (name))
+ return i;
+ }
+
+ for(i = 0; i < numFields; i++) {
+ string ta;
+ string n;
+
+ ta = fieldName[i].ToUpper ();
+ n = name.ToUpper ();
+
+ if(ta.Equals (n)) {
+ return i;
+ }
+ }
+
+ throw new MissingFieldException ("Missing field: " + name);
+ }
+
+ public string GetString (int i) {
+ return (string) dataValue[i];
+ }
+
+ public object GetValue (int i) {
+ return dataValue[i];
+ }
+
+ public int GetValues(object[] values)
+ {
+ Array.Copy (dataValue, values, dataValue.Length);
+ return dataValue.Length;
+ }
+
+ public bool IsDBNull(int i) {
+ if(dataValue[i] == DBNull.Value)
+ return true;
+ return false;
+ }
+
+ public bool GetBoolean(int i) {
+ return (bool) dataValue[i];
+ }
+
+ IEnumerator IEnumerable.GetEnumerator () {
+ return new DbEnumerator (this);
+ }
+
+ #endregion // Public Methods
+
+ #region Destructors
+
+ private void Dispose(bool disposing) {
+ if(!this.disposed) {
+ if(disposing) {
+ // release any managed resources
+ cmd = null;
+ fieldName = null;
+ fieldType = null;
+ fieldDbType = null;
+ fieldLength = null;
+ fieldMaxLength = null;
+ fieldFlags = null;
+ dataValue = null;
+ }
+ // release any unmanaged resources
+
+ // clear unmanaged MySQL result set
+ row = IntPtr.Zero;
+ if(res != IntPtr.Zero) {
+ MySql.FreeResult(res);
+ res = IntPtr.Zero;
+ }
+
+ // close any handles
+ this.disposed = true;
+ }
+ }
+
+ void IDisposable.Dispose() {
+ Dispose(true);
+ }
+
+ // aka Finalize
+ ~MySqlDataReader() {
+ Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ #region Properties
+
+ public int Depth {
+ get {
+ return 0; // always return zero, unless
+ // this provider will allow
+ // nesting of a row
+ }
+ }
+
+ public bool IsClosed {
+ get {
+ if(open == false)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public int RecordsAffected {
+ get {
+ return recordsAffected;
+ }
+ }
+
+ public int FieldCount {
+ get {
+ return numFields;
+ }
+ }
+
+ public object this[string name] {
+ get {
+ int i;
+
+ for(i = 0; i < numFields; i++) {
+ if(fieldName[i].Equals(name))
+ return dataValue[i];
+ }
+
+ for(i = 0; i < numFields; i++) {
+ string ta;
+ string n;
+
+ ta = fieldName[i].ToUpper();
+ n = name.ToUpper();
+
+ if(ta.Equals(n)) {
+ return dataValue[i];
+ }
+ }
+
+ throw new MissingFieldException("Missing field: " + name);
+ }
+ }
+
+ public object this[int i] {
+ get {
+ return dataValue[i];
+ }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlError.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlError.cs
new file mode 100755
index 00000000000..68a20b3e4a8
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlError.cs
@@ -0,0 +1,74 @@
+//
+// Mono.Data.MySql.MySqlError
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.MySql
+{
+ public class MySqlError
+ {
+ private string message;
+ private string source;
+ private string sqlstate;
+ private int nativeerror;
+
+ #region Constructors
+
+ internal MySqlError(string Source)
+ {
+ nativeerror = 1;
+ source = Source;
+ message = "Error in " + source;
+ sqlstate = "";
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Message
+ {
+ get
+ {
+ return message;
+ }
+ }
+
+ public int NativeError
+ {
+ get
+ {
+ return nativeerror;
+ }
+ }
+
+ public string Source
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public string SQLState
+ {
+ get
+ {
+ return sqlstate;
+ }
+ }
+
+ #endregion // Properties
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlErrorCollection.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlErrorCollection.cs
new file mode 100755
index 00000000000..1d6aa4d30fc
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlErrorCollection.cs
@@ -0,0 +1,87 @@
+//
+// Mono.Data.MySql.MySqlErrorCollection
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)Copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.MySql
+{
+ public sealed class MySqlErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count
+ {
+ get
+ {
+ return list.Count;
+ }
+ }
+
+ public MySqlError this[int index]
+ {
+ get
+ {
+ return (MySqlError) list[index];
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return list.SyncRoot;
+ }
+ }
+
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return list.IsSynchronized;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Add (MySqlError error)
+ {
+ list.Add ((object) error);
+ }
+
+ [MonoTODO]
+ public void CopyTo (Array array, int index)
+ {
+ ((MySqlError[])(list.ToArray ())).CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlException.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlException.cs
new file mode 100755
index 00000000000..a7d6c600f42
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlException.cs
@@ -0,0 +1,64 @@
+//
+// Mono.Data.MySql.Exception
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)Copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.MySql {
+ public class MySqlException : SystemException {
+ MySqlErrorCollection errors;
+
+ internal MySqlException (MySqlError error) : base (error.Message) {
+ errors = new MySqlErrorCollection ();
+ errors.Add (error);
+ }
+
+ internal MySqlException (string message) : base (message) {
+ MySqlError error = new MySqlError (message);
+ errors = new MySqlErrorCollection ();
+ errors.Add (error);
+ }
+
+ #region Properties
+
+ public int ErrorCode {
+ get {
+ return errors[0].NativeError;
+ }
+ }
+
+ public MySqlErrorCollection Errors {
+ get {
+ return errors;
+ }
+ }
+
+ public override string Source {
+ get {
+ return errors[0].Source;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context) {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameter.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameter.cs
new file mode 100755
index 00000000000..0a679426210
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameter.cs
@@ -0,0 +1,225 @@
+//
+// Mono.Data.MySql.MySqlParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.MySql
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally,
+ /// its mapping to DataSet columns; and is implemented by .NET
+ /// data providers that access data sources.
+ /// </summary>
+ //public sealed class MySqlParameter : MarshalByRefObject,
+ // IDbDataParameter, IDataParameter, ICloneable
+ public sealed class MySqlParameter : IDbDataParameter, IDataParameter
+ {
+ private string parmName;
+ private DbType dbtype;
+ private object objValue;
+ private int size;
+ private string sourceColumn;
+ private ParameterDirection direction;
+ private bool isNullable;
+ private byte precision;
+ private byte scale;
+ private DataRowVersion sourceVersion;
+ private int offset;
+
+ [MonoTODO]
+ public MySqlParameter () {
+
+ }
+
+ [MonoTODO]
+ public MySqlParameter (string parameterName, object value) {
+ this.parmName = parameterName;
+ this.objValue = value;
+ }
+
+ [MonoTODO]
+ public MySqlParameter(string parameterName, DbType dbType) {
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ }
+
+ [MonoTODO]
+ public MySqlParameter(string parameterName, DbType dbType,
+ int size) {
+
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ this.size = size;
+ }
+
+ [MonoTODO]
+ public MySqlParameter(string parameterName, DbType dbType,
+ int size, string sourceColumn) {
+
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ this.size = size;
+ this.sourceColumn = sourceColumn;
+ }
+
+ [MonoTODO]
+ public MySqlParameter(string parameterName, DbType dbType,
+ int size, ParameterDirection direction,
+ bool isNullable, byte precision,
+ byte scale, string sourceColumn,
+ DataRowVersion sourceVersion, object value) {
+
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ this.size = size;
+ this.sourceColumn = sourceColumn;
+ this.direction = direction;
+ this.isNullable = isNullable;
+ this.precision = precision;
+ this.scale = scale;
+ this.sourceVersion = sourceVersion;
+ this.objValue = value;
+ }
+
+ [MonoTODO]
+ public DbType DbType {
+ get {
+ return dbtype;
+ }
+ set {
+ dbtype = value;
+ }
+ }
+
+ [MonoTODO]
+ public ParameterDirection Direction {
+ get {
+ return direction;
+ }
+ set {
+ direction = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool IsNullable {
+ get {
+ return isNullable;
+ }
+ }
+
+ [MonoTODO]
+ public int Offset {
+ get {
+ return offset;
+ }
+
+ set {
+ offset = value;
+ }
+ }
+
+
+ string IDataParameter.ParameterName {
+ get {
+ return parmName;
+ }
+
+ set {
+ parmName = value;
+ }
+ }
+
+ public string ParameterName {
+ get {
+ return parmName;
+ }
+
+ set {
+ parmName = value;
+ }
+ }
+
+ [MonoTODO]
+ public string SourceColumn {
+ get {
+ return sourceColumn;
+ }
+
+ set {
+ sourceColumn = value;
+ }
+ }
+
+ [MonoTODO]
+ public DataRowVersion SourceVersion {
+ get {
+ return sourceVersion;
+ }
+
+ set {
+ sourceVersion = value;
+ }
+ }
+
+ [MonoTODO]
+ public object Value {
+ get {
+ return objValue;
+ }
+
+ set {
+ objValue = value;
+ }
+ }
+
+ [MonoTODO]
+ public byte Precision {
+ get {
+ return precision;
+ }
+
+ set {
+ precision = value;
+ }
+ }
+
+ [MonoTODO]
+ public byte Scale {
+ get {
+ return scale;
+ }
+
+ set {
+ scale = value;
+ }
+ }
+
+ [MonoTODO]
+ public int Size
+ {
+ get {
+ return size;
+ }
+
+ set {
+ size = value;
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ return parmName;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameterCollection.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameterCollection.cs
new file mode 100755
index 00000000000..c310cf7191d
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlParameterCollection.cs
@@ -0,0 +1,293 @@
+//
+// Mono.Data.MySql.MySqlParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+
+namespace Mono.Data.MySql
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object
+ /// and their mappings to DataSet columns.
+ /// </summary>
+ public sealed class MySqlParameterCollection : MarshalByRefObject,
+ IDataParameterCollection, IList, ICollection, IEnumerable
+ {
+ private ArrayList parameterList = new ArrayList();
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ return new MySqlParameterEnumerator (parameterList);
+ }
+
+ public int Add( object value)
+ {
+ // Call the add version that receives a SqlParameter
+
+ // Check if value is a MySqlParameter.
+ CheckType(value);
+ Add((MySqlParameter) value);
+
+ return IndexOf (value);
+ }
+
+
+ public MySqlParameter Add(MySqlParameter value)
+ {
+ parameterList.Add(value);
+ return value;
+ }
+
+
+ public MySqlParameter Add(string parameterName, object value)
+ {
+ MySqlParameter sqlparam = new MySqlParameter();
+ sqlparam.Value = value;
+ // TODO: Get the DbType from system type of value.
+
+ return Add(sqlparam);
+ }
+
+
+ public MySqlParameter Add(string parameterName, DbType dbType)
+ {
+ MySqlParameter sqlparam = new MySqlParameter();
+ sqlparam.ParameterName = parameterName;
+ sqlparam.DbType = dbType;
+ return Add(sqlparam);
+ }
+
+
+ public MySqlParameter Add(string parameterName,
+ DbType dbType, int size)
+ {
+ MySqlParameter sqlparam = new MySqlParameter();
+ sqlparam.ParameterName = parameterName;
+ sqlparam.DbType = dbType;
+ sqlparam.Size = size;
+ return Add(sqlparam);
+ }
+
+
+ public MySqlParameter Add(string parameterName,
+ DbType dbType, int size, string sourceColumn)
+ {
+ MySqlParameter sqlparam = new MySqlParameter();
+ sqlparam.ParameterName = parameterName;
+ sqlparam.DbType = dbType;
+ sqlparam.Size = size;
+ sqlparam.SourceColumn = sourceColumn;
+ return Add(sqlparam);
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public bool Contains(object value)
+ {
+ // Check if value is a SqlParameter
+ CheckType(value);
+ return Contains(((MySqlParameter)value).ParameterName);
+ }
+
+
+ [MonoTODO]
+ public bool Contains(string value)
+ {
+ for(int p = 0; p < parameterList.Count; p++) {
+ if(((MySqlParameter)parameterList[p]).ParameterName.Equals(value))
+ return true;
+ }
+ return false;
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public int IndexOf(object value)
+ {
+ // Check if value is a SqlParameter
+ CheckType(value);
+ return IndexOf(((MySqlParameter)value).ParameterName);
+ }
+
+
+ public int IndexOf(string parameterName)
+ {
+ int p = -1;
+
+ for(p = 0; p < parameterList.Count; p++) {
+ if(((MySqlParameter)parameterList[p]).ParameterName.Equals(parameterName))
+ return p;
+ }
+ return p;
+ }
+
+ [MonoTODO]
+ public void Insert(int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Count {
+ get {
+ return parameterList.Count;
+ }
+ }
+
+ object IList.this[int index] {
+ [MonoTODO]
+ get {
+ return (MySqlParameter) this[index];
+ }
+
+ [MonoTODO]
+ set {
+ this[index] = (MySqlParameter) value;
+ }
+ }
+
+ public MySqlParameter this[int index] {
+ get {
+ return (MySqlParameter) parameterList[index];
+ }
+
+ set {
+ parameterList[index] = (MySqlParameter) value;
+ }
+ }
+
+ object IDataParameterCollection.this[string parameterName] {
+ [MonoTODO]
+ get {
+ return this[parameterName];
+ }
+
+ [MonoTODO]
+ set {
+ CheckType(value);
+ this[parameterName] = (MySqlParameter) value;
+ }
+ }
+
+ public MySqlParameter this[string parameterName] {
+ get {
+ for(int p = 0; p < parameterList.Count; p++) {
+ if(parameterName.Equals(((MySqlParameter)parameterList[p]).ParameterName))
+ return (MySqlParameter) parameterList[p];
+ }
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ }
+
+ set {
+ for(int p = 0; p < parameterList.Count; p++) {
+ if(parameterName.Equals(((MySqlParameter)parameterList[p]).ParameterName))
+ parameterList[p] = value;
+ }
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ }
+ }
+
+ bool IList.IsFixedSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// <summary>
+ /// This method checks if the parameter value is of
+ /// MySqlParameter type. If it doesn't, throws an InvalidCastException.
+ /// </summary>
+ private void CheckType(object value)
+ {
+ if(!(value is MySqlParameter))
+ throw new InvalidCastException("Only MySqlParameter objects can be used.");
+ }
+
+ private class MySqlParameterEnumerator : IEnumerator {
+ public MySqlParameterEnumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count)
+ throw new InvalidOperationException ();
+
+ return list[ptr];
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count)
+ throw new InvalidOperationException ();
+
+ return ++ ptr < list.Count;
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+
+ private IList list;
+ private int ptr;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventArgs.cs
new file mode 100755
index 00000000000..b4b8bbf8ca3
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// Mono.Data.MySql.MySqlRowUpdatedEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Tim Coleman, 2002
+// Copyright (C) Daniel Morgan, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.MySql {
+ public sealed class MySqlRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ [MonoTODO]
+ public MySqlRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new MySqlCommand Command {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ ~MySqlRowUpdatedEventArgs ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventHandler.cs
new file mode 100755
index 00000000000..c255b452135
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatedEventHandler.cs
@@ -0,0 +1,12 @@
+//
+// Mono.Data.MySql.MySqlRowUpdatedEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.MySql {
+ public delegate void MySqlRowUpdatedEventHandler(object sender, MySqlRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventArgs.cs
new file mode 100755
index 00000000000..06898f386ef
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventArgs.cs
@@ -0,0 +1,36 @@
+//
+// Mono.Data.MySql.MySqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.MySql
+{
+ public sealed class MySqlRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ [MonoTODO]
+ public MySqlRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new MySqlCommand Command {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ ~MySqlRowUpdatingEventArgs() {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventHandler.cs
new file mode 100755
index 00000000000..21277d59779
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlRowUpdatingEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// Mono.Data.MySql.MySqlRowUpdatingEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.MySql {
+ public delegate void MySqlRowUpdatingEventHandler(object sender, MySqlRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTransaction.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTransaction.cs
new file mode 100644
index 00000000000..10cc47aa8c0
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTransaction.cs
@@ -0,0 +1,192 @@
+//
+// Mono.Data.MySql.MySqlTransaction.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.MySql
+{
+ /// <summary>
+ /// Represents a transaction to be performed on a SQL database.
+ /// </summary>
+ public sealed class MySqlTransaction : MarshalByRefObject,
+ IDbTransaction, IDisposable
+ {
+ #region Fields
+
+ private bool doingTransaction = false;
+ private MySqlConnection conn = null;
+ private IsolationLevel isolationLevel =
+ IsolationLevel.ReadCommitted;
+ // FIXME: What is the default isolation level for MySQL?
+
+ private bool disposed = false;
+
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Commit ()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Commit transaction.");
+
+ MySqlCommand cmd = new MySqlCommand("COMMIT", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ [MonoTODO]
+ public void Rollback()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Rollback transaction.");
+
+ MySqlCommand cmd = new MySqlCommand("ROLLBACK", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ // For MySQL, Rollback(string) will not be implemented
+ // because MySQL does not support Savepoints
+ [Obsolete]
+ public void Rollback(string transactionName) {
+ // throw new NotImplementedException ();
+ Rollback();
+ }
+
+ // For MySQL, Save(string) will not be implemented
+ // because MySQL does not support Savepoints
+ [Obsolete]
+ public void Save (string savePointName) {
+ // throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods to Mono.Data.MySql Assembly
+
+ internal void Begin()
+ {
+ if(doingTransaction == true)
+ throw new InvalidOperationException(
+ "Transaction has begun " +
+ "and MySQL does not " +
+ "support nested transactions.");
+
+ MySqlCommand cmd = new MySqlCommand("BEGIN", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = true;
+ }
+
+ internal void SetIsolationLevel(IsolationLevel isoLevel)
+ {
+ String sSql = "SET TRANSACTION ISOLATION LEVEL ";
+
+ switch (isoLevel) {
+ case IsolationLevel.ReadCommitted:
+ sSql += "READ COMMITTED";
+ break;
+ case IsolationLevel.ReadUncommitted:
+ sSql += "READ UNCOMMITTED";
+ break;
+ case IsolationLevel.RepeatableRead:
+ sSql += "REPEATABLE READ";
+ break;
+ case IsolationLevel.Serializable:
+ sSql += "SERIALIZABLE";
+ break;
+ default:
+ // generate exception here for anything else
+ break;
+ }
+ MySqlCommand cmd = new MySqlCommand(sSql, conn);
+ cmd.ExecuteNonQuery();
+
+ this.isolationLevel = isoLevel;
+ }
+
+ internal void SetConnection(MySqlConnection connection)
+ {
+ this.conn = connection;
+ }
+
+ #endregion // Internal Methods to System.Data.dll Assembly
+
+ #region Properties
+
+ IDbConnection IDbTransaction.Connection {
+ get {
+ return Connection;
+ }
+ }
+
+ public MySqlConnection Connection {
+ get {
+ return conn;
+ }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get {
+ return isolationLevel;
+ }
+ }
+
+ internal bool DoingTransaction {
+ get {
+ return doingTransaction;
+ }
+ }
+
+ #endregion Properties
+
+ #region Destructors
+
+ // Destructors aka Finalize and Dispose
+
+ private void Dispose(bool disposing) {
+ if(!this.disposed) {
+ if(disposing) {
+ // release any managed resources
+ conn = null;
+ }
+ // release any unmanaged resources
+
+ // close any handles
+ this.disposed = true;
+ }
+ }
+
+ void IDisposable.Dispose() {
+ Dispose(true);
+ }
+
+ // aka Finalize
+ ~MySqlTransaction() {
+ Dispose (false);
+ }
+ #endregion // Destructors
+
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTypes.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTypes.cs
new file mode 100644
index 00000000000..ff40d3d8cd7
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/MySqlTypes.cs
@@ -0,0 +1,533 @@
+//
+// MySqlTypes.cs - enums, classes, and structs for handling MySql Types
+//
+// Assembly: Mono.Data.MySql.dll
+// Namespace: Mono.Data.MySql
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+using System.Text;
+
+namespace Mono.Data.MySql {
+ internal enum MySqlEnumFieldTypes {
+ FIELD_TYPE_DECIMAL,
+ FIELD_TYPE_TINY,
+ FIELD_TYPE_SHORT,
+ FIELD_TYPE_LONG,
+ FIELD_TYPE_FLOAT,
+ FIELD_TYPE_DOUBLE,
+ FIELD_TYPE_NULL,
+ FIELD_TYPE_TIMESTAMP,
+ FIELD_TYPE_LONGLONG,
+ FIELD_TYPE_INT24,
+ FIELD_TYPE_DATE,
+ FIELD_TYPE_TIME,
+ FIELD_TYPE_DATETIME,
+ FIELD_TYPE_YEAR,
+ FIELD_TYPE_NEWDATE,
+ FIELD_TYPE_ENUM=247,
+ FIELD_TYPE_SET=248,
+ FIELD_TYPE_TINY_BLOB=249,
+ FIELD_TYPE_MEDIUM_BLOB=250,
+ FIELD_TYPE_LONG_BLOB=251,
+ FIELD_TYPE_BLOB=252,
+ FIELD_TYPE_VAR_STRING=253,
+ FIELD_TYPE_STRING=254
+ }
+
+ sealed internal class MySqlHelper {
+
+ public static string GetMySqlTypeName(MySqlEnumFieldTypes mysqlFieldType) {
+
+ string typeName;
+
+ switch(mysqlFieldType) {
+ case MySqlEnumFieldTypes.FIELD_TYPE_DECIMAL:
+ typeName = "decimal";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TINY:
+ typeName = "tiny";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_SHORT:
+ typeName = "short";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_LONG:
+ typeName = "long";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_FLOAT:
+ typeName = "float";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_DOUBLE:
+ typeName = "double";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_NULL:
+ typeName = "null";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TIMESTAMP:
+ typeName = "timestamp";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_LONGLONG:
+ typeName = "longlong";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_INT24:
+ typeName = "int24";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_DATE:
+ typeName = "date";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TIME:
+ typeName = "time";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_DATETIME:
+ typeName = "datetime";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_YEAR:
+ typeName = "year";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_NEWDATE:
+ typeName = "newdate";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_ENUM:
+ typeName = "enum";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_SET:
+ typeName = "set";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TINY_BLOB:
+ typeName = "tinyblob";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_MEDIUM_BLOB:
+ typeName = "mediumblob";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_LONG_BLOB:
+ typeName = "longblob";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_BLOB:
+ typeName = "blob";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_VAR_STRING:
+ typeName = "varchar";
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_STRING:
+ typeName = "char";
+ break;
+ default:
+ typeName = "text";
+ break;
+ }
+ return typeName;
+ }
+
+ public static DbType MySqlTypeToDbType(MySqlEnumFieldTypes mysqlFieldType) {
+ DbType dbType;
+
+ // FIXME: verify these translation are correct
+
+ switch(mysqlFieldType) {
+ case MySqlEnumFieldTypes.FIELD_TYPE_DECIMAL:
+ dbType = DbType.Decimal;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TINY:
+ dbType = DbType.Int16;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_SHORT:
+ dbType = DbType.Int16;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_LONG:
+ dbType = DbType.Int32;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_FLOAT:
+ dbType = DbType.Single;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_DOUBLE:
+ dbType = DbType.Double;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_NULL:
+ dbType = DbType.String;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TIMESTAMP:
+ dbType = DbType.String;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_LONGLONG:
+ dbType = DbType.Int64;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_INT24:
+ dbType = DbType.Int64;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_DATE:
+ dbType = DbType.Date;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TIME:
+ dbType = DbType.Time;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_DATETIME:
+ dbType = DbType.DateTime;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_YEAR:
+ dbType = DbType.Int16;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_NEWDATE:
+ dbType = DbType.Date;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_ENUM:
+ dbType = DbType.Int32;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_SET:
+ dbType = DbType.String;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_TINY_BLOB:
+ case MySqlEnumFieldTypes.FIELD_TYPE_MEDIUM_BLOB:
+ case MySqlEnumFieldTypes.FIELD_TYPE_LONG_BLOB:
+ case MySqlEnumFieldTypes.FIELD_TYPE_BLOB:
+ dbType = DbType.Binary;
+ break;
+ case MySqlEnumFieldTypes.FIELD_TYPE_VAR_STRING:
+ case MySqlEnumFieldTypes.FIELD_TYPE_STRING:
+ dbType = DbType.String;
+ break;
+ default:
+ dbType = DbType.String;
+ break;
+ }
+
+ return dbType;
+ }
+
+ // Translates System.Data.DbType to System.Type
+ public static Type DbTypeToSystemType (DbType dType) {
+
+ Type typ = null;
+
+ switch(dType) {
+ case DbType.String:
+ typ = typeof(String);
+ break;
+ case DbType.Boolean:
+ typ = typeof(Boolean);
+ break;
+ case DbType.Int16:
+ typ = typeof(Int16);
+ break;
+ case DbType.Int32:
+ typ = typeof(Int32);
+ break;
+ case DbType.Int64:
+ typ = typeof(Int64);
+ break;
+ case DbType.Decimal:
+ typ = typeof(Decimal);
+ break;
+ case DbType.Single:
+ typ = typeof(Single);
+ break;
+ case DbType.Double:
+ typ = typeof(Double);
+ break;
+ case DbType.Date:
+ case DbType.Time:
+ case DbType.DateTime:
+ typ = typeof(DateTime);
+ break;
+ default:
+ typ = typeof(String);
+ break;
+ }
+ return typ;
+ }
+
+ // Converts data value from database to .NET System type.
+ public static object ConvertDbTypeToSystem (MySqlEnumFieldTypes mysqlFieldType,
+ DbType typ, String myValue) {
+
+ object obj = null;
+
+ //Console.WriteLine("DEBUG: ConvertDbTypeToSystem: " + myValue);
+
+ // FIXME: how do you handle NULL and "" for MySQL correctly?
+ if(myValue == null) {
+ return DBNull.Value;
+ }
+ else if(myValue.Equals("")) {
+ return DBNull.Value;
+ }
+
+ switch(mysqlFieldType) {
+ case MySqlEnumFieldTypes.FIELD_TYPE_TIMESTAMP:
+ if(myValue.Equals("00000000000000"))
+ return DBNull.Value;
+ break;
+ }
+
+ // Date, Time, and DateTime
+ // are parsed based on ISO format
+ // "YYYY-MM-DD hh:mi:ss"
+
+ switch(typ) {
+ case DbType.String:
+ obj = String.Copy(myValue);
+ break;
+ case DbType.Boolean:
+ obj = myValue.Equals("t");
+ break;
+ case DbType.Int16:
+ obj = Int16.Parse(myValue);
+ break;
+ case DbType.Int32:
+ obj = Int32.Parse(myValue);
+ break;
+ case DbType.Int64:
+ obj = Int64.Parse(myValue);
+ break;
+ case DbType.Decimal:
+ obj = Decimal.Parse(myValue);
+ break;
+ case DbType.Single:
+ obj = Single.Parse(myValue);
+ break;
+ case DbType.Double:
+ obj = Double.Parse(myValue);
+ break;
+ case DbType.Date:
+ String[] sd = myValue.Split(new Char[] {'-'});
+ obj = new DateTime(
+ Int32.Parse(sd[0]), Int32.Parse(sd[1]), Int32.Parse(sd[2]),
+ 0,0,0);
+ break;
+ case DbType.Time:
+ String[] st = myValue.Split(new Char[] {':'});
+ obj = new DateTime(0001,01,01,
+ Int32.Parse(st[0]),Int32.Parse(st[1]),Int32.Parse(st[2]));
+ break;
+ case DbType.DateTime:
+ Int32 YYYY,MM,DD,hh,mi,ss;
+ YYYY = Int32.Parse(myValue.Substring(0,4));
+ MM = Int32.Parse(myValue.Substring(5,2));
+ DD = Int32.Parse(myValue.Substring(8,2));
+ hh = Int32.Parse(myValue.Substring(11,2));
+ mi = Int32.Parse(myValue.Substring(14,2));
+ ss = Int32.Parse(myValue.Substring(17,2));
+ obj = new DateTime(YYYY,MM,DD,hh,mi,ss,0);
+ break;
+ default:
+ obj = String.Copy(myValue);
+ break;
+ }
+
+ return obj;
+ }
+
+ // FIXME: handle NULLs correctly in MySQL
+ public static string DBNullObjectToString(DbType dbtype) {
+
+ string s = "";
+
+ const string NullString = "''";
+ const string Null = "NULL";
+
+ switch(dbtype) {
+ case DbType.String:
+ s = NullString;
+ break;
+ case DbType.Boolean:
+ s = NullString;
+ break;
+ case DbType.Int16:
+ s = Null;
+ break;
+ case DbType.Int32:
+ s = Null;
+ break;
+ case DbType.Int64:
+ s = Null;
+ break;
+ case DbType.Decimal:
+ s = Null;
+ break;
+ case DbType.Single:
+ s = Null;
+ break;
+ case DbType.Double:
+ s = Null;
+ break;
+ case DbType.Date:
+ s = NullString;
+ break;
+ case DbType.Time:
+ s = NullString;
+ break;
+ case DbType.DateTime:
+ s = NullString;
+ break;
+ default:
+ // default to DbType.String
+ s = NullString;
+ break;
+ }
+
+ return s;
+ }
+
+ // Convert a .NET System value type (Int32, String, Boolean, etc)
+ // to a string that can be included within a SQL statement.
+ // This is to methods provides the parameters support
+ // for the MySQL .NET Data provider
+ public static string ObjectToString(DbType dbtype, object obj) {
+
+ string s = "";
+
+ // FIXME: how do we handle NULLs?
+ // code is untested
+ if(obj.Equals(DBNull.Value)) {
+ return DBNullObjectToString(dbtype);
+ }
+
+ // Date, Time, and DateTime are expressed in ISO format
+ // which is "YYYY-MM-DD hh:mm:ss.ms";
+ DateTime dt;
+ StringBuilder sb;
+
+ const string zero = "0";
+
+ switch(dbtype) {
+ case DbType.String:
+ s = "'" + obj + "'";
+ break;
+ case DbType.Boolean:
+ if((bool)obj == true)
+ s = "'t'";
+ else
+ s = "'f'";
+ break;
+ case DbType.Int16:
+ s = obj.ToString();
+ break;
+ case DbType.Int32:
+ s = obj.ToString();
+ break;
+ case DbType.Int64:
+ s = obj.ToString();
+ break;
+ case DbType.Decimal:
+ s = obj.ToString();
+ break;
+ case DbType.Single:
+ s = obj.ToString();
+ break;
+ case DbType.Double:
+ s = obj.ToString();
+ break;
+ case DbType.Date:
+ dt = (DateTime) obj;
+ sb = new StringBuilder();
+ sb.Append('\'');
+ // year
+ if(dt.Year < 10)
+ sb.Append("000" + dt.Year);
+ else if(dt.Year < 100)
+ sb.Append("00" + dt.Year);
+ else if(dt.Year < 1000)
+ sb.Append("0" + dt.Year);
+ else
+ sb.Append(dt.Year);
+ sb.Append("-");
+ // month
+ if(dt.Month < 10)
+ sb.Append(zero + dt.Month);
+ else
+ sb.Append(dt.Month);
+ sb.Append("-");
+ // day
+ if(dt.Day < 10)
+ sb.Append(zero + dt.Day);
+ else
+ sb.Append(dt.Day);
+ sb.Append('\'');
+ s = sb.ToString();
+ break;
+ case DbType.Time:
+ dt = (DateTime) obj;
+ sb = new StringBuilder();
+ sb.Append('\'');
+ // hour
+ if(dt.Hour < 10)
+ sb.Append(zero + dt.Hour);
+ else
+ sb.Append(dt.Hour);
+ sb.Append(":");
+ // minute
+ if(dt.Minute < 10)
+ sb.Append(zero + dt.Minute);
+ else
+ sb.Append(dt.Minute);
+ sb.Append(":");
+ // second
+ if(dt.Second < 10)
+ sb.Append(zero + dt.Second);
+ else
+ sb.Append(dt.Second);
+ sb.Append('\'');
+ s = sb.ToString();
+ break;
+ case DbType.DateTime:
+ dt = (DateTime) obj;
+ sb = new StringBuilder();
+ sb.Append('\'');
+ // year
+ if(dt.Year < 10)
+ sb.Append("000" + dt.Year);
+ else if(dt.Year < 100)
+ sb.Append("00" + dt.Year);
+ else if(dt.Year < 1000)
+ sb.Append("0" + dt.Year);
+ else
+ sb.Append(dt.Year);
+ sb.Append("-");
+ // month
+ if(dt.Month < 10)
+ sb.Append(zero + dt.Month);
+ else
+ sb.Append(dt.Month);
+ sb.Append("-");
+ // day
+ if(dt.Day < 10)
+ sb.Append(zero + dt.Day);
+ else
+ sb.Append(dt.Day);
+ sb.Append(" ");
+ // hour
+ if(dt.Hour < 10)
+ sb.Append(zero + dt.Hour);
+ else
+ sb.Append(dt.Hour);
+ sb.Append(":");
+ // minute
+ if(dt.Minute < 10)
+ sb.Append(zero + dt.Minute);
+ else
+ sb.Append(dt.Minute);
+ sb.Append(":");
+ // second
+ if(dt.Second < 10)
+ sb.Append(zero + dt.Second);
+ else
+ sb.Append(dt.Second);
+ sb.Append('\'');
+ s = sb.ToString();
+ break;
+ default:
+ // default to DbType.String
+ s = "'" + obj + "'";
+ break;
+ }
+ return s;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/TODOAttribute.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/TODOAttribute.cs
new file mode 100644
index 00000000000..22481a86a83
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.MySql {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Mono.Data.MySql/Test.cs b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/Test.cs
new file mode 100644
index 00000000000..6f266246937
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Mono.Data.MySql/Test.cs
@@ -0,0 +1,238 @@
+//
+// Test.cs
+//
+// Used to Test the C# bindings to MySQL. This test
+// is based on the test that comes with MySQL.
+// Part of the C# bindings to MySQL library libMySQL.dll
+//
+// Author:
+// Brad Merrill <zbrad@cybercom.net>
+//
+// (C)Copyright 2002 Brad Merril
+//
+// http://www.cybercom.net/~zbrad/DotNet/MySql/
+//
+// Mono has gotten permission from Brad Merrill to include in
+// the Mono Class Library
+// his C# bindings to MySQL under the X11 License
+//
+// Mono can be found at http://www.go-mono.com/
+// The X11/MIT License can be found
+// at http://www.opensource.org/licenses/mit-license.html
+//
+
+using System;
+using System.Runtime.InteropServices;
+using Mono.Data.MySql;
+
+///<remarks>
+///<para>
+/// MySql P/Invoke implementation test program
+/// Brad Merrill
+/// 3-Mar-2002
+///</para>
+///<para>
+/// This is based on the myTest.c program in the
+/// libmysqltest example directory of the mysql distribution.
+///</para>
+///<para>
+/// I noticed during implementation that the C api libraries are
+/// thread sensitive, in that they store information in the
+/// currently executing thread local storage. This is
+/// incompatible with the thread pool model in the CLR, in which
+/// you could be executing the same context on different
+/// threads.
+///</para>
+///<para>
+/// A better implementation would be to rewrite the libmysql
+/// layer in managed code, and do all the socket APIs, and mysql
+/// protocol using the .NET Framework APIs. However, that's a
+/// bit more than a weekend of work.
+///</para>
+///</remarks>
+public class Test {
+ [STAThread]
+ public static int Main() {
+ Console.WriteLine("Test for MySQL C# Bindings started...");
+ Console.Out.Flush();
+ int rcq;
+
+ string myDb = "test";
+ string myStmt = "SELECT * FROM sometable";
+ string insertStmt = "INSERT INTO SOMETABLE (TID,TDESC,AINT) VALUES ('MySQL','Mono.Data',12)";
+
+ Console.WriteLine("MySql Init...");
+ Console.Out.Flush();
+ IntPtr db = MySql.Init(IntPtr.Zero);
+ if (db == IntPtr.Zero) {
+ Console.WriteLine("Error: Init failed.");
+ Console.Out.Flush();
+ return 1;
+ }
+
+ Console.WriteLine("MySql Connection...");
+ Console.Out.Flush();
+ IntPtr conn = MySql.Connect(db, "", "", "", "", MySql.Port,
+ "", (uint)0);
+ //IntPtr conn = MySql.mysql_connect(db, null, null, null, null, MySql.Port,
+ // null, (uint)0);
+ if (conn == IntPtr.Zero) {
+ Console.WriteLine("Error: Connect failed.");
+ Console.Out.Flush();
+ Console.WriteLine("MySql Error: " + MySql.Error(db));
+ Console.Out.Flush();
+ return 1;
+ }
+
+ Console.WriteLine("MySql Selecting Database: " + myDb + "...");
+ Console.Out.Flush();
+ int sdb = MySql.SelectDb(db, myDb);
+ if (sdb != 0) {
+ Console.WriteLine("Error: Can not select the "+myDb+" database.");
+ Console.Out.Flush();
+ Console.WriteLine("MySql Error: " + MySql.Error(db));
+ Console.Out.Flush();
+ return 1;
+ }
+
+ Console.WriteLine("Insert SQL: "+insertStmt);
+ Console.Out.Flush();
+ rcq = MySql.Query(db, insertStmt);
+ if (rcq != 0) {
+ Console.WriteLine("Couldn't execute ["+insertStmt+"] on server.");
+ Console.Out.Flush();
+ Console.WriteLine("MySql Error: " + MySql.Error(db));
+ Console.Out.Flush();
+ return 1;
+ }
+
+ Console.WriteLine("Query: "+myStmt);
+ Console.Out.Flush();
+ rcq = MySql.Query(db, myStmt);
+ if (rcq != 0) {
+ Console.WriteLine("?Couldn't execute ["+myStmt+"] on server.");
+ Console.Out.Flush();
+ Console.WriteLine("MySql Error: " + MySql.Error(db));
+ Console.Out.Flush();
+ return 1;
+ }
+
+ Console.WriteLine("Process Results...");
+ Console.Out.Flush();
+ procResults(db);
+
+ Console.WriteLine("==== Diagnostic info ====");
+ Console.Out.Flush();
+ Console.WriteLine("Client info: "+MySql.GetClientInfo());
+ Console.WriteLine("Host info: "+MySql.GetHostInfo(db));
+ Console.WriteLine("Server info: "+MySql.GetServerInfo(db));
+ Console.Out.Flush();
+
+ Console.WriteLine("List Processes...");
+ Console.Out.Flush();
+ listProcesses(db);
+ Console.WriteLine("List Tables...");
+ Console.Out.Flush();
+ listTables(db);
+
+ Console.WriteLine("MySql Stat...");
+ Console.Out.Flush();
+ Console.WriteLine(MySql.Stat(db));
+
+ Console.WriteLine("MySql Close...");
+ Console.Out.Flush();
+ MySql.Close(db);
+
+ Console.WriteLine("MySql Thread End...");
+ Console.Out.Flush();
+ MySql.ThreadEnd();
+
+ Console.WriteLine("Exiting...");
+ Console.Out.Flush();
+
+ return 0;
+ }
+
+ static void procResults(IntPtr db) {
+ IntPtr res = MySql.StoreResult(db);
+ int numRows = MySql.NumRows(res);
+ Console.WriteLine("Number of records found: " + numRows);
+ int numFields = MySql.NumFields(res);
+ string[] fields = new string[numFields];
+ for (int i = 0; i < numFields; i++) {
+ Field fd = (Field) Marshal.PtrToStructure(MySql.FetchField(res), typeof(Field));
+ fields[i] = fd.Name;
+ }
+ IntPtr row;
+ int recCnt = 1;
+ while ((row = MySql.FetchRow(res)) != IntPtr.Zero) {
+ Console.WriteLine("Record #" + recCnt + ":");
+ for (int i = 0, j = 1; i < numFields; i++, j++) {
+ Console.WriteLine(" theField[[[" + fields[i] + "]]]\n");
+ Console.Out.Flush();
+ Console.WriteLine(" Fld #"+j+" ("+fields[i]+"): "+rowVal(row, i));
+ Console.Out.Flush();
+ }
+ Console.WriteLine("==============================");
+ }
+ MySql.FreeResult(res);
+ }
+
+ static string rowVal(IntPtr res, int index) {
+ IntPtr str = Marshal.ReadIntPtr(res, index*IntPtr.Size);
+ if (str == IntPtr.Zero)
+ return "NULL";
+ string s = Marshal.PtrToStringAnsi(str);
+ return s;
+ }
+
+ static void listProcesses(IntPtr db) {
+ IntPtr res = MySql.ListProcesses(db);
+ if (res == IntPtr.Zero) {
+ Console.WriteLine("Got error "+MySql.Error(db)+" when retreiving processlist");
+ return;
+ }
+ int numRows = MySql.NumRows(res);
+ Console.WriteLine("Number of records found: " + numRows);
+ int numFields = MySql.NumFields(res);
+ string[] fields = new string[numFields];
+ for (int i = 0; i < numFields; i++) {
+ Field fd = (Field) Marshal.PtrToStructure(MySql.FetchField(res), typeof(Field));
+ fields[i] = fd.Name;
+ }
+ IntPtr row;
+ int recCnt = 1;
+ while ((row = MySql.FetchRow(res)) != IntPtr.Zero) {
+ Console.WriteLine("Process #" + recCnt + ":");
+ for (int i = 0, j = 1; i < numFields; i++, j++) {
+ Console.WriteLine(" Fld #"+j+" ("+fields[i]+"): "+rowVal(row, i));
+ }
+ Console.WriteLine("==============================");
+ }
+ MySql.FreeResult(res);
+ }
+
+ static void listTables(IntPtr db) {
+ IntPtr res = MySql.ListTables(db, "%");
+ if (res == IntPtr.Zero)
+ return;
+ int numRows = MySql.NumRows(res);
+ Console.WriteLine("Number of records found: " + numRows);
+ int numFields = MySql.NumFields(res);
+ string[] fields = new string[numFields];
+ for (int i = 0; i < numFields; i++) {
+ Field fd = (Field) Marshal.PtrToStructure(MySql.FetchField(res), typeof(Field));
+ fields[i] = fd.Name;
+ }
+ IntPtr row;
+ int recCnt = 1;
+ while ((row = MySql.FetchRow(res)) != IntPtr.Zero) {
+ Console.WriteLine("Process #" + recCnt + ":");
+ for (int i = 0, j = 1; i < numFields; i++, j++) {
+ Console.WriteLine(" Fld #"+j+" ("+fields[i]+"): "+rowVal(row, i));
+ }
+ Console.WriteLine("==============================");
+ }
+ MySql.FreeResult(res);
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Test/.cvsignore b/mcs/class/Mono.Data.MySql/Test/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/Mono.Data.MySql/Test/MySqlTest.cs b/mcs/class/Mono.Data.MySql/Test/MySqlTest.cs
new file mode 100644
index 00000000000..9110450e651
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/MySqlTest.cs
@@ -0,0 +1,517 @@
+/* MySqlTest.cs - based on PostgresTest.cs which is based
+ * on postgres-test.c in libgda
+ *
+ * Copyright (C) 2002 Gonzalo Paniagua Javier
+ * Copyright (C) 2002 Daniel Morgan
+ *
+ * ORIGINAL AUTHOR:
+ * Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+ * PORTING FROM C TO C# AUTHOR:
+ * Daniel Morgan <danmorg@sc.rr.com>
+ *
+ * Permission was given from the original author, Gonzalo Paniagua Javier,
+ * to port and include his original work in Mono.
+ *
+ * The original work falls under the LGPL, but the port to C# falls
+ * under the X11 license.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+//
+// To compile on Windows using Cygwin, you will need to do:
+// mono C:/cygwin/home/danmorg/mono/install/bin/mcs.exe MySqlTest.cs -r System.Data.dll -r Mono.Data.MySql.dll
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using Mono.Data.MySql;
+
+namespace Test.Mono.Data.MySql {
+
+ public class MySqlTest {
+
+ // execute SQL CREATE TABLE Command using ExecuteNonQuery()
+ public static void CreateTable (IDbConnection cnc) {
+
+ IDbCommand createCommand = cnc.CreateCommand();
+
+ createCommand.CommandText =
+ "CREATE TABLE mono_mysql_test (" +
+ "tinyint_value TINYINT," +
+ "smallint_value SMALLINT," +
+ "mediumint_value MEDIUMINT," +
+ "int_value INT," +
+ "integer_value INTEGER," +
+ "bigint_value BIGINT," +
+ "real_value REAL," +
+ "double_value DOUBLE," +
+ "float_value FLOAT," +
+ "decimal_value DECIMAL(8,2)," +
+ "numeric_value NUMERIC(15,2)," +
+ "char_value CHAR(2)," +
+ "varchar_value VARCHAR(5)," +
+ "date_value DATE," +
+ "time_value TIME," +
+ "timestamp_value TIMESTAMP," +
+ "datetime_value DATETIME," +
+ "tinyblob_value TINYBLOB," +
+ "blob_value BLOB," +
+ "mediumblob_value MEDIUMBLOB," +
+ "longblob_value LONGBLOB," +
+ "tinytext_value TINYTEXT," +
+ "text_value TEXT," +
+ "mediumtext_value MEDIUMTEXT," +
+ "longtext_value LONGTEXT," +
+ "enum_value ENUM('dog','cat','bird','fish')," +
+ "set_value SET('value1','value2','value3','value4'), " +
+ "null_tinyint_value TINYINT," +
+ "null_smallint_value SMALLINT," +
+ "null_mediumint_value MEDIUMINT," +
+ "null_int_value INT," +
+ "null_integer_value INTEGER," +
+ "null_bigint_value BIGINT," +
+ "null_real_value REAL," +
+ "null_double_value DOUBLE," +
+ "null_float_value FLOAT," +
+ "null_decimal_value DECIMAL(8,2)," +
+ "null_numeric_value NUMERIC(15,2)," +
+ "null_char_value CHAR(2)," +
+ "null_varchar_value VARCHAR(5)," +
+ "null_date_value DATE," +
+ "null_time_value TIME," +
+ "null_timestamp_value TIMESTAMP," +
+ "null_datetime_value DATETIME," +
+ "null_tinyblob_value TINYBLOB," +
+ "null_blob_value BLOB," +
+ "null_mediumblob_value MEDIUMBLOB," +
+ "null_longblob_value LONGBLOB," +
+ "null_tinytext_value TINYTEXT," +
+ "null_text_value TEXT," +
+ "null_mediumtext_value MEDIUMTEXT," +
+ "null_longtext_value LONGTEXT," +
+ "null_enum_value ENUM('dog','cat','bird','fish')," +
+ "null_set_value SET('value1','value2','value3','value4') " +
+ ") ";
+
+ int rowsAffected;
+ rowsAffected = createCommand.ExecuteNonQuery ();
+ Console.WriteLine("Rows Affected: " + rowsAffected);
+ }
+
+ // execute SQL DROP TABLE Command using ExecuteNonQuery
+ public static void DropTable (IDbConnection cnc) {
+
+ IDbCommand dropCommand = cnc.CreateCommand ();
+
+ dropCommand.CommandText =
+ "DROP TABLE mono_mysql_test";
+
+ int rowsAffected;
+ rowsAffected = dropCommand.ExecuteNonQuery ();
+ Console.WriteLine("Rows Affected: " + rowsAffected);
+
+ }
+
+ // execute stored procedure using ExecuteScalar()
+ public static object CallStoredProcedure (IDbConnection cnc) {
+
+ IDbCommand callStoredProcCommand = cnc.CreateCommand ();
+ object data;
+
+ callStoredProcCommand.CommandType =
+ CommandType.StoredProcedure;
+ callStoredProcCommand.CommandText =
+ "version";
+
+ data = callStoredProcCommand.ExecuteScalar ();
+
+ return data;
+ }
+
+ // execute SQL INSERT Command using ExecuteNonQuery()
+ public static void InsertData (IDbConnection cnc) {
+
+ IDbCommand insertCommand = cnc.CreateCommand();
+
+ insertCommand.CommandText =
+ "INSERT INTO mono_mysql_test (" +
+ "tinyint_value," +
+ "smallint_value," +
+ "mediumint_value," +
+ "int_value," +
+ "integer_value," +
+ "bigint_value," +
+ "real_value," +
+ "double_value," +
+ "float_value," +
+ "decimal_value," +
+ "numeric_value," +
+ "char_value," +
+ "varchar_value," +
+ "date_value," +
+ "time_value," +
+ "timestamp_value," +
+ "datetime_value," +
+ "tinyblob_value," +
+ "blob_value," +
+ "mediumblob_value," +
+ "longblob_value," +
+ "tinytext_value," +
+ "text_value," +
+ "mediumtext_value," +
+ "longtext_value," +
+ "enum_value," +
+ "set_value " +
+ ") VALUES (" +
+ "1,2,3,4,5,6, " +
+ "1.1, 2.2, 3.3, " +
+ "10.10, 11.11, " +
+ "'AB','mono'," +
+ "'2002-12-31', '11:15:07'," +
+ "'20021231111507', '2002-12-31 11:15:07'," +
+ "'fe','fi','fo','thumb','i','smell','some','food'," +
+ "'cat', 'value2,value3' " +
+ ")";
+
+ int rowsAffected;
+ rowsAffected = insertCommand.ExecuteNonQuery ();
+ Console.WriteLine("Rows Affected: " + rowsAffected);
+ }
+
+ // execute a SQL SELECT Query using ExecuteReader() to retrieve
+ // a IDataReader so we retrieve data
+ public static IDataReader SelectData (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // FIXME: System.Data classes need to handle NULLs
+ // this would be done by System.DBNull ?
+ // FIXME: System.Data needs to handle more data types
+
+ selectCommand.CommandText =
+ "SELECT * " +
+ "FROM mono_mysql_test";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+ // Tests a SQL Command (INSERT, UPDATE, DELETE)
+ // executed via ExecuteReader
+ public static IDataReader SelectDataUsingInsertCommand (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // This is a SQL INSERT Command, not a Query
+ selectCommand.CommandText =
+ "INSERT INTO mono_mysql_test (" +
+ "tinyint_value," +
+ "smallint_value," +
+ "mediumint_value," +
+ "int_value," +
+ "integer_value," +
+ "bigint_value," +
+ "real_value," +
+ "double_value," +
+ "float_value," +
+ "decimal_value," +
+ "numeric_value," +
+ "char_value," +
+ "varchar_value," +
+ "date_value," +
+ "time_value," +
+ "timestamp_value," +
+ "datetime_value," +
+ "tinyblob_value," +
+ "blob_value," +
+ "mediumblob_value," +
+ "longblob_value," +
+ "tinytext_value," +
+ "text_value," +
+ "mediumtext_value," +
+ "longtext_value," +
+ "enum_value," +
+ "set_value " +
+ ") VALUES (" +
+ "91,92,93,94,95,96, " +
+ "91.1, 92.2, 93.3, " +
+ "910.10, 911.11, " +
+ "'CD','mcs'," +
+ "'2003-11-23', '10:24:45'," +
+ "'20031123122445', '2003-11-23 10:24:45'," +
+ "'ack','bleh','heh','pop','me','nope','yeah','fun'," +
+ "'dog', 'value1,value3,value4' " +
+ ")";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+ // Tests a SQL Command not (INSERT, UPDATE, DELETE)
+ // executed via ExecuteReader
+ public static IDataReader SelectDataUsingCommand (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // This is a SQL Command, not a Query
+ selectCommand.CommandText =
+ "SET AUTOCOMMIT=0";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+
+ // execute an SQL UPDATE Command using ExecuteNonQuery()
+ public static void UpdateData (IDbConnection cnc) {
+
+ IDbCommand updateCommand = cnc.CreateCommand();
+
+ updateCommand.CommandText =
+ "UPDATE mono_mysql_test " +
+ "SET " +
+ "int_value = 777 " +
+ "WHERE char_value = 'AB'";
+
+ updateCommand.ExecuteNonQuery ();
+ }
+
+ // used to do a min(), max(), count(), sum(), or avg()
+ // execute SQL SELECT Query using ExecuteScalar
+ public static object SelectAggregate (IDbConnection cnc, String agg) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ object data;
+
+ Console.WriteLine("Aggregate: " + agg);
+
+ selectCommand.CommandType = CommandType.Text;
+ selectCommand.CommandText =
+ "SELECT " + agg +
+ "FROM mono_mysql_test";
+
+ data = selectCommand.ExecuteScalar ();
+
+ Console.WriteLine("Agg Result: " + data);
+
+ return data;
+ }
+
+ // used internally by ReadData() to read each result set
+ public static void ReadResult(IDataReader rdr, DataTable dt) {
+
+ // number of columns in the table
+ Console.WriteLine(" Total Columns: " +
+ dt.Rows.Count);
+
+ // display the schema
+ string colName;
+ string colValue;
+ foreach (DataRow schemaRow in dt.Rows) {
+ foreach (DataColumn schemaCol in dt.Columns) {
+ colName = schemaCol.ColumnName;
+ colValue = (schemaRow[schemaCol]).ToString();
+ Console.WriteLine(colName + " = " + colValue);
+ }
+ Console.WriteLine();
+ }
+
+ int nRows = 0;
+ int c = 0;
+ string output, metadataValue, dataValue;
+ // Read and display the rows
+ Console.WriteLine("Gonna do a Read() now...");
+ while(rdr.Read()) {
+ Console.WriteLine(" Row " + nRows + ": ");
+
+ for(c = 0; c < rdr.FieldCount; c++) {
+ // column meta data
+ metadataValue =
+ " Col " +
+ c + ": " +
+ rdr.GetName(c);
+
+ // column data
+ if(rdr.IsDBNull(c) == true)
+ dataValue = " is NULL";
+ else
+ dataValue =
+ ": " +
+ rdr.GetValue(c).ToString();
+
+ // display column meta data and data
+ output = metadataValue + dataValue;
+ Console.WriteLine(output);
+ }
+ nRows++;
+ }
+ Console.WriteLine(" Total Rows Retrieved: " +
+ nRows);
+ }
+
+ // Used to read data from IDataReader after calling IDbCommand:ExecuteReader()
+ public static void ReadData(IDataReader rdr) {
+
+ int results = 0;
+ if(rdr == null) {
+
+ Console.WriteLine("IDataReader has a Null Reference.");
+ }
+ else {
+ do {
+ results++;
+ if(rdr.FieldCount > 0) {
+ // Results for
+ // SQL SELECT Queries
+ // have RecordsAffected = -1
+ // and GetSchemaTable() returns a reference to a DataTable
+ DataTable dt = rdr.GetSchemaTable();
+ Console.WriteLine("Result is from a SELECT SQL Query. Records Affected: " + rdr.RecordsAffected);
+
+ Console.WriteLine("Result Set " + results + "...");
+
+ ReadResult(rdr, dt);
+ }
+ if(rdr.RecordsAffected >= 0) {
+ // Results for
+ // SQL INSERT, UPDATE, DELETE Commands
+ // have RecordsAffected >= 0
+ Console.WriteLine("Result is from a SQL Command (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ }
+ else {
+ // Results for
+ // SQL Commands not INSERT, UPDATE, nor DELETE
+ // have RecordsAffected == -1
+ // and GetSchemaTable() returns a null reference
+ Console.WriteLine("Result is from a SQL Command not (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ }
+ } while(rdr.NextResult());
+ Console.WriteLine("Total Result sets: " + results);
+
+ rdr.Close();
+ }
+ }
+
+ /* MySQL provider tests */
+ public static void PerformTest (IDbConnection cnc) {
+
+ IDataReader reader;
+ Object oDataValue;
+
+ Console.WriteLine ("\tMySQL provider specific tests...\n");
+
+ /* Drops the mono_mysql_test table. */
+
+ Console.WriteLine ("\t\tDrop table: ");
+ try {
+ DropTable (cnc);
+ Console.WriteLine ("OK");
+ }
+ catch (MySqlException e) {
+ Console.WriteLine("Error (don't worry about this one)" + e);
+ }
+
+ try {
+ /* Creates a table with all supported data types */
+ Console.WriteLine ("\t\tCreate table with all supported types: ");
+ CreateTable (cnc);
+ Console.WriteLine ("OK");
+
+ /* Inserts values */
+ Console.WriteLine ("\t\tInsert values for all known types: ");
+ InsertData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Update values */
+ Console.WriteLine ("\t\tUpdate values: ");
+ UpdateData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Inserts values */
+ Console.WriteLine ("\t\tInsert values for all known types: ");
+ InsertData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Select aggregates */
+ SelectAggregate (cnc, "count(*)");
+ SelectAggregate (cnc, "avg(int_value)");
+ SelectAggregate (cnc, "min(char_value)");
+ SelectAggregate (cnc, "max(integer_value)");
+ SelectAggregate (cnc, "sum(double_value)");
+
+ /* Select values */
+ Console.WriteLine ("\t\tSelect values from the database: ");
+ reader = SelectData (cnc);
+ ReadData(reader);
+
+ /* SQL Command via ExecuteReader/MySqlDataReader */
+ /* Command is not INSERT, UPDATE, or DELETE */
+ Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Not INSERT,UPDATE,DELETE).");
+ reader = SelectDataUsingCommand(cnc);
+ ReadData(reader);
+
+ /* SQL Command via ExecuteReader/MySqlDataReader */
+ /* Command is INSERT, UPDATE, or DELETE */
+ Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Is INSERT,UPDATE,DELETE).");
+ reader = SelectDataUsingInsertCommand(cnc);
+ ReadData(reader);
+
+ // Call a Stored Procedure named Version()
+ Console.WriteLine("\t\tCalling stored procedure version()");
+ object obj = CallStoredProcedure(cnc);
+ Console.WriteLine("Result: " + obj);
+
+ Console.WriteLine("Database Server Version: " +
+ ((MySqlConnection)cnc).ServerVersion);
+
+ /* Clean up */
+ //Console.WriteLine ("Clean up...");
+ //Console.WriteLine ("\t\tDrop table...");
+ //DropTable (cnc);
+ //Console.WriteLine("OK");
+ }
+ catch(Exception e) {
+ Console.WriteLine("Exception caught: " + e);
+ }
+ }
+
+ [STAThread]
+ public static void Main(string[] args) {
+
+ MySqlConnection dbconn = new MySqlConnection ();
+
+ // ConnectionString can be:
+ // "Server=localhost;Database=test;User ID=someuser;Password=somepass"
+ // or it could be:
+ // "host=localhost;dbname=test;user=someuser;passwd=somepass"
+ string connectionString =
+ "dbname=test;";
+ dbconn.ConnectionString = connectionString;
+
+ dbconn.Open();
+ PerformTest(dbconn);
+ dbconn.Close();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Test/TestDataAdapter.cs b/mcs/class/Mono.Data.MySql/Test/TestDataAdapter.cs
new file mode 100755
index 00000000000..aac6371a842
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/TestDataAdapter.cs
@@ -0,0 +1,53 @@
+
+namespace TestSystemDataSqlClient {
+ using System;
+ using System.Collections;
+ using System.Data;
+ using System.Data.Common;
+ using Mono.Data.MySql;
+
+ public class TestSqlDataAdapter {
+ public static void Test() {
+ string connectionString;
+ string sqlQuery;
+
+ MySqlDataAdapter adapter = null;
+ DataSet dataSet = null;
+
+ connectionString =
+ "dbname=test;";
+
+
+ sqlQuery = "select * from mono_mysql_test";
+
+ System.Console.WriteLine ("new MySqlDataAdapter...");
+ adapter = new MySqlDataAdapter (sqlQuery,
+ connectionString);
+
+ System.Console.WriteLine ("new DataSet...");
+ dataSet = new DataSet ();
+
+ System.Console.WriteLine("Fill...");
+ adapter.Fill (dataSet, "Table1");
+
+ System.Console.WriteLine ("Get Each Row in DataTable...");
+ if (dataSet != null) {
+
+ foreach (DataRow row in dataSet.Tables["Table1"].Rows)
+ Console.WriteLine ("int_value: " +
+ row["int_value"]);
+
+ string filename = "DataSetTest.xml";
+ Console.WriteLine ("Write DataSet to XML file: " +
+ filename);
+ dataSet.WriteXml (filename);
+ }
+ Console.WriteLine ("Done.");
+
+ }
+
+ public static void Main() {
+ Test();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteReader.cs b/mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteReader.cs
new file mode 100644
index 00000000000..cb5077837ef
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteReader.cs
@@ -0,0 +1,75 @@
+//
+// Test/SqlDataRead.cs
+//
+// Test to do read a simple forward read only record set.
+// Using SqlCommand.ExecuteReader() to return a SqlDataReader
+// which can be used to Read a row
+// and Get a String or Int32.
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C) 2002 Daniel Morgan
+//
+
+namespace TestSystemDataSqlClient {
+ using System;
+ using System.Data;
+ using Mono.Data.MySql;
+
+ class TestSqlDataReader {
+
+ [STAThread]
+ static void Main(string[] args) {
+ Console.WriteLine("Started.");
+
+ String connectionString = null;
+ connectionString =
+ "dbname=mysql";
+
+ MySqlConnection con;
+ Console.WriteLine("Create MySQL Connection...");
+ con = new MySqlConnection(connectionString);
+ Console.WriteLine("Open the connection...");
+ con.Open();
+
+ string sql;
+ sql = "select * from db";
+
+ Console.WriteLine("Create command...");
+ MySqlCommand cmd;
+ cmd = con.CreateCommand();
+
+ cmd.CommandText = sql;
+
+ MySqlDataReader reader;
+ Console.WriteLine("ExecuteReader...");
+ reader = cmd.ExecuteReader();
+
+ int row = 0;
+ Console.WriteLine("Reading data...");
+ while(reader.Read()){
+ row++;
+ Console.WriteLine("Row: " + row);
+ for(int col = 0; col < reader.FieldCount; col++) {
+ Console.WriteLine(" Field: " + col);
+
+ Console.WriteLine(" Name: " +
+ reader.GetName(col));
+ Console.WriteLine(" Value: " +
+ reader.GetValue(col));
+ }
+ }
+ Console.WriteLine("Clean up...");
+
+ reader.Close();
+ reader = null;
+ cmd.Dispose();
+ cmd = null;
+ con.Close();
+ con = null;
+
+ Console.WriteLine("Done.");
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteScalar.cs b/mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteScalar.cs
new file mode 100644
index 00000000000..34f6a8e9609
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/TestMySqlExecuteScalar.cs
@@ -0,0 +1,68 @@
+//
+// TestSqlExecuteScalar.cs
+//
+// To Test MySqlConnection and MySqlCommand by connecting
+// to a MySQL database
+// and then executing an SELECT SQL statement
+// using ExecuteScalar
+//
+// To use:
+// change strings to your database, userid, tables, etc...:
+// connectionString
+// selectStatement
+//
+// To test:
+// mcs TestMySqlExecuteScalar.cs -r System.Data.dll -r Mono.Data.MySql.dll
+// mono TestMySqlExecuteScalar.exe
+//
+// Author:
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C)Copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Data;
+using Mono.Data.MySql;
+
+namespace TestMonoDataMysql {
+ class TestMySqlInsert {
+ [STAThread]
+ static void Main(string[] args) {
+ MySqlConnection conn;
+ MySqlCommand cmd;
+
+ String connectionString;
+ String selectStatement;
+
+ connectionString =
+ "dbname=test";
+
+ selectStatement =
+ "select count(*)" +
+ "from sometable";
+
+ // Connect to a MySQL database
+ Console.WriteLine ("Connect to database...");
+ conn = new MySqlConnection(connectionString);
+ conn.Open();
+
+ // create SELECT command
+ Console.WriteLine ("Create Command initializing " +
+ "with an SELECT statement...");
+ cmd = new MySqlCommand (selectStatement, conn);
+
+ // execute the SELECT SQL command
+ Console.WriteLine ("Execute SELECT SQL Command...");
+ Object obj = cmd.ExecuteScalar();
+ Console.WriteLine ("Object: " + obj.ToString());
+
+ // Close connection to database
+ Console.WriteLine ("Close database connection...");
+ conn.Close();
+
+ Console.WriteLine ("Assuming everything " +
+ "was successful.");
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Test/TestMySqlInsert.cs b/mcs/class/Mono.Data.MySql/Test/TestMySqlInsert.cs
new file mode 100644
index 00000000000..80f6ddd87fc
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/TestMySqlInsert.cs
@@ -0,0 +1,125 @@
+//
+// TestSqlInsert.cs
+//
+// To Test MySqlConnection, MySqlCommand, and MySqlTransaction
+// by connecting to a MySQL database
+// and then executing some SQL statements
+//
+// To use:
+// change strings to your database, userid, tables, etc...:
+// connectionString
+// insertStatement
+// sqlToBeRolledBack
+//
+// To test:
+// mcs TestMySqlInsert.cs -r System.Data.dll -r Mono.Data.MySql.dll
+// mono TestMySqlInsert.exe
+//
+// Author:
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C)Copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Data;
+using Mono.Data.MySql;
+
+namespace TestMonoDataMysql
+{
+ class TestMySqlInsert
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ MySqlConnection conn;
+ MySqlCommand cmd;
+ MySqlTransaction trans;
+
+ int rowsAffected;
+
+ String connectionString;
+ String insertStatement;
+ String deleteStatement;
+
+ connectionString =
+ "dbname=test";
+
+ insertStatement =
+ "insert into sometable " +
+ "(tid, tdesc) " +
+ "values ('beer', 'Beer for All!') ";
+
+ deleteStatement =
+ "delete from sometable " +
+ "where tid = 'beer' ";
+
+ // Connect to a MySQL database
+ Console.WriteLine ("Connect to database...");
+ conn = new MySqlConnection(connectionString);
+ conn.Open();
+
+ // begin transaction
+ Console.WriteLine ("Begin Transaction...");
+ trans = conn.BeginTransaction();
+
+ // create SQL DELETE command
+ Console.WriteLine ("Create Command initializing " +
+ "with an DELETE statement...");
+ cmd = new MySqlCommand (deleteStatement, conn);
+
+ // execute the DELETE SQL command
+ Console.WriteLine ("Execute DELETE SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // change the SQL command to an SQL INSERT Command
+ Console.WriteLine ("Now use INSERT SQL Command...");
+ cmd.CommandText = insertStatement;
+
+ // execute the INSERT SQL command
+ Console.WriteLine ("Execute INSERT SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // if successfull at INSERT, commit the transaction,
+ // otherwise, do a rollback the transaction using
+ // trans.Rollback();
+ // FIXME: need to have exceptions working in
+ // Mono.Data.MySql classes before you can do rollback
+ Console.WriteLine ("Commit transaction...");
+ trans.Commit();
+
+ cmd = null;
+ trans = null;
+
+ string sqlToBeRolledBack =
+ "insert into sometable " +
+ "(tid, tdesc) " +
+ "values ('beer', 'Will not be committed!') ";
+
+ Console.WriteLine("Create new command to be rolled back");
+ cmd = conn.CreateCommand();
+ cmd.CommandText = sqlToBeRolledBack;
+
+ Console.WriteLine("Test Begin Transaction");
+ trans = conn.BeginTransaction();
+
+ Console.WriteLine("Execute INSERT SQL...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ Console.WriteLine("Rollback Transaction...");
+ trans.Rollback();
+
+ // Close connection to database
+ Console.WriteLine ("Close database connection...");
+ conn.Close();
+
+ Console.WriteLine ("Assuming everything " +
+ "was successful.");
+ Console.WriteLine ("Verify data in database to " +
+ "see if row is there.");
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/Test/TestParameters.cs b/mcs/class/Mono.Data.MySql/Test/TestParameters.cs
new file mode 100755
index 00000000000..5c8ca16cf62
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/Test/TestParameters.cs
@@ -0,0 +1,122 @@
+//
+// TestParameters.cs - test parameters for the MySQL .NET Data Provider in Mono
+// using *Parameter and *ParameterCollection
+//
+// Note: it currently only tests input parameters. Output is next on the list.
+// Then output/input and return parameters.
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.Data;
+using Mono.Data.MySql;
+
+namespace TestMonoDataMySql {
+
+ public class TestParameters {
+ public static void Main() {
+ Console.WriteLine("** Start Test...");
+
+ String connectionString = null;
+ connectionString =
+ "dbname=test";
+
+ MySqlConnection con;
+ Console.WriteLine("** Creating connection...");
+ con = new MySqlConnection(connectionString);
+ Console.WriteLine("** opening connection...");
+ con.Open();
+
+ string charValue = "CD";
+
+ string sql;
+ sql = "SELECT char_value, int_value FROM mono_mysql_test WHERE char_value = :inCharValue";
+
+ Console.WriteLine("** Creating command...");
+ MySqlCommand cmd = new MySqlCommand(sql, con);
+
+ // add parameter for inTableName
+ Console.WriteLine("** Create parameter...");
+ MySqlParameter parm = new MySqlParameter("inCharValue", DbType.String);
+
+ Console.WriteLine("** set direction of parameter to input");
+ parm.Direction = ParameterDirection.Input;
+
+ Console.WriteLine("** set the parameter value...");
+ parm.Value = charValue;
+
+ Console.WriteLine("** add parameter to parameters collection in the command...");
+ cmd.Parameters.Add(parm);
+
+ MySqlDataReader rdr;
+ Console.WriteLine("** ExecuteReader()...");
+
+ rdr = cmd.ExecuteReader();
+
+ Console.WriteLine("[][] And now we are going to our results [][]...");
+ int c;
+ int results = 0;
+ do {
+ results++;
+ Console.WriteLine("Result Set " + results + "...");
+
+ // get the DataTable that holds
+ // the schema
+ DataTable dt = rdr.GetSchemaTable();
+
+ // number of columns in the table
+ Console.WriteLine(" Total Columns: " +
+ dt.Columns.Count);
+
+ // display the schema
+ foreach (DataRow schemaRow in dt.Rows) {
+ foreach (DataColumn schemaCol in dt.Columns)
+ Console.WriteLine(schemaCol.ColumnName +
+ " = " +
+ schemaRow[schemaCol]);
+ Console.WriteLine();
+ }
+
+ string output, metadataValue, dataValue;
+ int nRows = 0;
+
+ // Read and display the rows
+ while(rdr.Read()) {
+ Console.WriteLine(" Row " + nRows + ": ");
+
+ for(c = 0; c < rdr.FieldCount; c++) {
+ // column meta data
+ DataRow dr = dt.Rows[c];
+ metadataValue =
+ " Col " +
+ c + ": " +
+ dr["ColumnName"];
+
+ // column data
+ if(rdr.IsDBNull(c) == true)
+ dataValue = " is NULL";
+ else
+ dataValue =
+ ": " +
+ rdr.GetValue(c);
+
+ // display column meta data and data
+ output = metadataValue + dataValue;
+ Console.WriteLine(output);
+ }
+ nRows++;
+ }
+ Console.WriteLine(" Total Rows: " +
+ nRows);
+ } while(rdr.NextResult());
+ Console.WriteLine("Total Result sets: " + results);
+
+ con.Close();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.MySql/list b/mcs/class/Mono.Data.MySql/list
new file mode 100644
index 00000000000..7ea33f01cf0
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/list
@@ -0,0 +1,19 @@
+Mono.Data.MySql/Field.cs
+Mono.Data.MySql/MySqlCommand.cs
+Mono.Data.MySql/MySqlConnection.cs
+Mono.Data.MySql/MySql.cs
+Mono.Data.MySql/TODOAttribute.cs
+Mono.Data.MySql/MySqlDataReader.cs
+Mono.Data.MySql/MySqlTypes.cs
+Mono.Data.MySql/MySqlTransaction.cs
+Mono.Data.MySql/MySqlError.cs
+Mono.Data.MySql/MySqlErrorCollection.cs
+Mono.Data.MySql/MySqlException.cs
+Mono.Data.MySql/MySqlDataAdapter.cs
+Mono.Data.MySql/MySqlRowUpdatedEventArgs.cs
+Mono.Data.MySql/MySqlRowUpdatedEventHandler.cs
+Mono.Data.MySql/MySqlRowUpdatingEventArgs.cs
+Mono.Data.MySql/MySqlRowUpdatingEventHandler.cs
+Mono.Data.MySql/MySqlParameter.cs
+Mono.Data.MySql/MySqlParameterCollection.cs
+
diff --git a/mcs/class/Mono.Data.MySql/makefile.gnu b/mcs/class/Mono.Data.MySql/makefile.gnu
new file mode 100644
index 00000000000..9ab36d3e64f
--- /dev/null
+++ b/mcs/class/Mono.Data.MySql/makefile.gnu
@@ -0,0 +1,14 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.MySql.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.Data
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/.cvsignore b/mcs/class/Mono.Data.PostgreSqlClient/.cvsignore
new file mode 100644
index 00000000000..8744e149aac
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/.cvsignore
@@ -0,0 +1,3 @@
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/ChangeLog b/mcs/class/Mono.Data.PostgreSqlClient/ChangeLog
new file mode 100644
index 00000000000..6d917177b5c
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/ChangeLog
@@ -0,0 +1,89 @@
+2002-12-06 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.PostgreSqlClient/PgSqlCommand.cs: added
+ public methods EscapeString() and EscapeByteArray()
+
+ * Mono.Data.PostgreSqlClient/PostgresLibrary.cs: updated
+ DllImport functions PQescapeString() and PQescapeBytea()
+
+2002-11-26 Daniel Morgan <danmorg@sc.rr.com>
+
+ * list: changed the name of the files beginning
+ with Sql to PgSql. Added missing files to linux build.
+
+ * makefile.gnu: added .dll to end of assembly names
+
+ * Mono.Data.PostgreSqlClient: created new directory within
+ mcs/class/Mono.Data.PostgreSqlClient
+
+ * copy files from ./*.cs to ./Mono.Data.PostgreSqlClient/*.cs
+ on cvs server (thanks to Miguel)
+
+ * remove ./*.cs files
+
+2002-11-14 Daniel Morgan <danmorg@sc.rr.com>
+
+ * PgSqlConnection.cs: redid connection parameters
+ based on SqlClient's SqlConnection
+
+ * PgSqlCommand.cs: redid handling of different
+ CommandType of CommandText, StoredProcedure,
+ and TableDirect. Got rid of debug messages
+
+2002-11-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * PgSqlCommand.cs: get rid of warning
+
+ * PgSqlDataReader.cs: implemented GetEnumerator(),
+ and Dispose()
+
+2002-10-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * ParmUtil.cs
+ * PostgresLibrary.cs
+ * PostgresTypes.cs
+ * SqlClientPermission.cs
+ * SqlClientPermissionAttribute.cs
+ * SqlCommand.cs
+ * SqlCommandBuilder.cs
+ * SqlConnection.cs
+ * SqlDataAdapter.cs
+ * SqlDataReader.cs
+ * SqlError.cs
+ * SqlErrorCollection.cs
+ * SqlException.cs
+ * SqlInfoMessageEventArgs.cs
+ * SqlInfoMessageEventHandler.cs
+ * SqlParameter.cs
+ * SqlParameterCollection.cs
+ * SqlRowUpdatedEventArgs.cs
+ * SqlRowUpdatedEventHandler.cs
+ * SqlRowUpdatingEventArgs.cs
+ * SqlRowUpdatingEventHandler.cs
+ * SqlTransaction.cs: thanks to Miguel, he copied
+ files on the mono cvs server
+ from mcs/class/System.Data/System.Data.SqlClient
+ for the PostgreSQL provider
+ to mcs/class/Mono.Data.PostgreSqlClient.
+ This frees up
+ mcs/class/System.Data/System.Data.SqlClient for
+ the Microsoft SQL Server provider.
+ Any Mono.Data.PostgreSqlClient/Sql*.cs files
+ were copied on the cvs server
+ to Mono.Data.PostgreSqlClient/PgSql*.cs files
+ and the old Mono.Data.PostgreSqlClient/Sql*.cs
+ files were removed. Copying, renaming, and removing
+ was done on the server so we could keep
+ the cvs change history.
+
+ * ChangeLog: added this file for logging changes
+
+ * Mono.Data.PostgreSqlClient.build: added file for Windows build
+
+ * library-deps.stamp
+ * list
+ * makefile.gnu: added for Linux build
+
+ * Locale.cs: added file for Locale.GetText(string);
+
+ * TODOAttribute.cs: added file for [MonoTODO] attribute
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient.build b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient.build
new file mode 100644
index 00000000000..727df3b0492
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient.build
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.PostgreSqlClient.dll -->
+
+<project name="Mono.Data.PostgreSqlClient" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.PostgreSqlClient.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/System.Data.dll" tofile="Test/System.Data.dll"/>
+ <copy file="../lib/Mono.Data.PostgreSqlClient.dll" tofile="Test/Mono.Data.PostgreSqlClient.dll"/>
+ <copy file="../lib/Mono.Data.PostgreSqlClient.dll" tofile="Mono.Data.PostgreSqlClient.dll"/>
+ <copy file="../lib/Mono.Data.PostgreSqlClient.dll" tofile="../System.Data/Test/Mono.Data.PostgreSqlClient.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="Test/System.Data.dll" failonerror="false"/>
+ <delete file="../lib/Mono.Data.PostgreSqlClient.dll" failonerror="false"/>
+ <delete file="Test/Mono.Data.PostgreSqlClient.dll" failonerror="false"/>
+
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/Locale.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/Locale.cs
new file mode 100644
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/ParmUtil.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/ParmUtil.cs
new file mode 100644
index 00000000000..beb3537f937
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/ParmUtil.cs
@@ -0,0 +1,176 @@
+//
+// ParmUtil.cs - utility to bind variables in a SQL statement to parameters in C# code
+// This is in the PostgreSQL .NET Data provider in Mono
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Daniel Morgan
+//
+
+// comment DEBUG_ParmUtil for production, for debug messages, uncomment
+//#define DEBUG_ParmUtil
+
+using System;
+using System.Data;
+using System.Text;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ enum PostgresBindVariableCharacter {
+ Semicolon,
+ At,
+ QuestionMark
+ }
+
+ public class ParmUtil {
+
+ private string sql = "";
+ private string resultSql = "";
+ private PgSqlParameterCollection parmsCollection = null;
+
+ static private PostgresBindVariableCharacter PgbindChar = PostgresBindVariableCharacter.Semicolon;
+ static char bindChar;
+
+ // static constructor
+ static ParmUtil() {
+ switch(PgbindChar) {
+ case PostgresBindVariableCharacter.Semicolon:
+ bindChar = ':';
+ break;
+ case PostgresBindVariableCharacter.At:
+ bindChar = '@';
+ break;
+ case PostgresBindVariableCharacter.QuestionMark:
+ // this doesn't have named parameters,
+ // they must be in order
+ bindChar = '?';
+ break;
+ }
+ }
+
+ public ParmUtil(string query, PgSqlParameterCollection parms) {
+ sql = query;
+ parmsCollection = parms;
+ }
+
+ public string ResultSql {
+ get {
+ return resultSql;
+ }
+ }
+
+ // TODO: currently only works for input variables,
+ // need to do input/output, output, and return
+ public string ReplaceWithParms() {
+
+ StringBuilder result = new StringBuilder();
+ char[] chars = sql.ToCharArray();
+ bool bStringConstFound = false;
+
+ for(int i = 0; i < chars.Length; i++) {
+ if(chars[i] == '\'') {
+ if(bStringConstFound == true)
+ bStringConstFound = false;
+ else
+ bStringConstFound = true;
+
+ result.Append(chars[i]);
+ }
+ else if(chars[i] == bindChar &&
+ bStringConstFound == false) {
+#if DEBUG_ParmUtil
+ Console.WriteLine("Bind Variable character found...");
+#endif
+ StringBuilder parm = new StringBuilder();
+ i++;
+ while(i <= chars.Length) {
+ char ch;
+ if(i == chars.Length)
+ ch = ' '; // a space
+ else
+ ch = chars[i];
+
+#if DEBUG_ParmUtil
+ Console.WriteLine("Is char Letter or digit?");
+#endif
+ if(Char.IsLetterOrDigit(ch)) {
+#if DEBUG_ParmUtil
+ Console.WriteLine("Char IS letter or digit. " +
+ "Now, append char to parm StringBuilder");
+#endif
+ parm.Append(ch);
+ }
+ else {
+#if DEBUG_ParmUtil
+ Console.WriteLine("Char is NOT letter or char. " +
+ "thus we got rest of bind variable name. ");
+
+ // replace bind variable placeholder
+ // with data value constant
+ Console.WriteLine("parm StringBuilder to string p...");
+#endif
+ string p = parm.ToString();
+#if DEBUG_ParmUtil
+ Console.WriteLine("calling BindReplace...");
+#endif
+ bool found = BindReplace(result, p);
+#if DEBUG_ParmUtil
+ Console.WriteLine(" Found = " + found);
+#endif
+ if(found == true)
+ break;
+ else {
+ // *** Error Handling
+ Console.WriteLine("Error: parameter not found: " + p);
+ return "";
+ }
+ }
+ i++;
+ }
+ i--;
+ }
+ else
+ result.Append(chars[i]);
+ }
+
+ resultSql = result.ToString();
+ return resultSql;
+ }
+
+ public bool BindReplace (StringBuilder result, string p) {
+ // bind variable
+ bool found = false;
+
+#if DEBUG_ParmUtil
+ Console.WriteLine("Does the parmsCollection contain the parameter???: " + p);
+#endif
+ if(parmsCollection.Contains(p) == true) {
+ // parameter found
+#if DEBUG_ParmUtil
+ Console.WriteLine("Parameter Found: " + p);
+#endif
+ PgSqlParameter prm = parmsCollection[p];
+
+#if DEBUG_ParmUtil
+ // DEBUG
+ Console.WriteLine(" Value: " + prm.Value);
+ Console.WriteLine(" Direction: " + prm.Direction);
+#endif
+ // convert object to string and place
+ // into SQL
+ if(prm.Direction == ParameterDirection.Input) {
+ string strObj = PostgresHelper.
+ ObjectToString(prm.DbType,
+ prm.Value);
+ result.Append(strObj);
+ }
+ else
+ result.Append(bindChar + p);
+
+ found = true;
+ }
+ return found;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
new file mode 100644
index 00000000000..8ef58881165
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
@@ -0,0 +1,78 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlClientPermission.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ public sealed class PgSqlClientPermission : DBDataPermission {
+
+ [MonoTODO]
+ public PgSqlClientPermission() {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public PgSqlClientPermission(PermissionState state) {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public PgSqlClientPermission(PermissionState state,
+ bool allowBlankPassword) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml(SecurityElement
+ securityElement) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~PgSqlClientPermission() {
+ // FIXME: destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
new file mode 100644
index 00000000000..6c9f5b126db
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
@@ -0,0 +1,46 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlClientPermissionAttribute.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class PgSqlClientPermissionAttribute :
+ DBDataPermissionAttribute {
+
+ [MonoTODO]
+ public PgSqlClientPermissionAttribute(SecurityAction action) :
+ base(action)
+ {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public override IPermission CreatePermission() {
+ throw new NotImplementedException ();
+ }
+
+ //[MonoTODO]
+ //~PgSqlClientPermissionAttribute() {
+ // // FIXME: destructor to release resources
+ //}
+ }
+
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
new file mode 100644
index 00000000000..39d843b821a
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
@@ -0,0 +1,922 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002 http://www.ximian.com/
+// (C) Daniel Morgan, 2002
+// (C) Copyright 2002 Tim Coleman
+//
+// Credits:
+// SQL and concepts were used from libgda 0.8.190 (GNOME Data Access)
+// http://www.gnome-db.org/
+// with permission from the authors of the
+// PostgreSQL provider in libgda:
+// Michael Lausch <michael@lausch.at>
+// Rodrigo Moya <rodrigo@gnome-db.org>
+// Vivien Malerba <malerba@gnome-db.org>
+// Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+//
+
+// use #define DEBUG_SqlCommand if you want to spew debug messages
+// #define DEBUG_SqlCommand
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Xml;
+
+namespace Mono.Data.PostgreSqlClient {
+ /// <summary>
+ /// Represents a SQL statement that is executed
+ /// while connected to a SQL database.
+ /// </summary>
+ // public sealed class PgSqlCommand : Component, IDbCommand, ICloneable
+ public sealed class PgSqlCommand : IDbCommand {
+
+ #region Fields
+
+ private string sql = "";
+ private int timeout = 30;
+ // default is 30 seconds
+ // for command execution
+
+ private PgSqlConnection conn = null;
+ private PgSqlTransaction trans = null;
+ private CommandType cmdType = CommandType.Text;
+ private bool designTime = false;
+ private PgSqlParameterCollection parmCollection = new
+ PgSqlParameterCollection();
+
+ // PgSqlDataReader state data for ExecuteReader()
+ private PgSqlDataReader dataReader = null;
+ private string[] queries = null;
+ private int currentQuery = -1;
+ private CommandBehavior cmdBehavior = CommandBehavior.Default;
+
+ private ParmUtil parmUtil = null;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public PgSqlCommand() {
+ sql = "";
+ }
+
+ public PgSqlCommand (string cmdText) {
+ sql = cmdText;
+ }
+
+ public PgSqlCommand (string cmdText, PgSqlConnection connection) {
+ sql = cmdText;
+ conn = connection;
+ }
+
+ public PgSqlCommand (string cmdText, PgSqlConnection connection,
+ PgSqlTransaction transaction) {
+ sql = cmdText;
+ conn = connection;
+ trans = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void Cancel () {
+ // FIXME: use non-blocking Exec for this
+ throw new NotImplementedException ();
+ }
+
+ // FIXME: is this the correct way to return a stronger type?
+ [MonoTODO]
+ IDbDataParameter IDbCommand.CreateParameter () {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ public PgSqlParameter CreateParameter () {
+ return new PgSqlParameter ();
+ }
+
+ public uint EscapeString (string to, string from, uint length) {
+ uint result = PostgresLibrary.PQescapeString (out to, from, length);
+ return result;
+ }
+
+ public byte[] EscapeByteArray (byte[] bintext, uint binlen,
+ uint bytealen) {
+
+ byte[] result;
+ result = PostgresLibrary.PQescapeBytea (bintext,
+ binlen, bytealen);
+
+ return result;
+ }
+
+ public int ExecuteNonQuery () {
+ IntPtr pgResult; // PGresult
+ int rowsAffected = -1;
+ ExecStatusType execStatus;
+ String rowsAffectedString;
+ string query;
+
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is not Open");
+
+ query = TweakQuery(sql, cmdType);
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (conn.PostgresConnection, query);
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+
+ if(execStatus == ExecStatusType.PGRES_COMMAND_OK ||
+ execStatus == ExecStatusType.PGRES_TUPLES_OK ) {
+
+ rowsAffectedString = PostgresLibrary.
+ PQcmdTuples (pgResult);
+
+ if(rowsAffectedString != null)
+ if(rowsAffectedString.Equals("") == false)
+ rowsAffected = int.Parse(rowsAffectedString);
+
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+ }
+ else {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+
+ throw new PgSqlException(0, 0,
+ errorMessage, 0, "",
+ conn.DataSource, "SqlCommand", 0);
+ }
+
+ return rowsAffected;
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader () {
+ return ExecuteReader ();
+ }
+
+ [MonoTODO]
+ public PgSqlDataReader ExecuteReader () {
+ return ExecuteReader(CommandBehavior.Default);
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader (
+ CommandBehavior behavior) {
+ return ExecuteReader (behavior);
+ }
+
+ [MonoTODO]
+ public PgSqlDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnectionState is not Open");
+
+ cmdBehavior = behavior;
+
+ queries = null;
+ currentQuery = -1;
+ dataReader = new PgSqlDataReader(this);
+
+ queries = sql.Split(new Char[] {';'});
+
+ dataReader.NextResult();
+
+ return dataReader;
+ }
+
+ internal PgSqlResult NextResult()
+ {
+ PgSqlResult res = new PgSqlResult();
+ res.Connection = this.Connection;
+ res.Behavior = cmdBehavior;
+ string statement;
+
+ currentQuery++;
+
+ res.CurrentQuery = currentQuery;
+
+ if(currentQuery < queries.Length && queries[currentQuery].Equals("") == false) {
+ res.SQL = queries[currentQuery];
+ statement = TweakQuery(queries[currentQuery], cmdType);
+ ExecuteQuery(statement, res);
+ res.ResultReturned = true;
+ }
+ else {
+ res.ResultReturned = false;
+ }
+
+ return res;
+ }
+
+ private string TweakQuery(string query, CommandType commandType) {
+ string statement = "";
+
+ // finish building SQL based on CommandType
+ switch(commandType) {
+ case CommandType.Text:
+ // TODO: this parameters utility
+ // currently only support input variables
+ // need todo output, input/output, and return.
+ parmUtil = new ParmUtil(query, parmCollection);
+ statement = parmUtil.ReplaceWithParms();
+ break;
+ case CommandType.StoredProcedure:
+ string sParmList = GetStoredProcParmList ();
+ statement = "SELECT " + query + "(" + sParmList + ")";
+ break;
+ case CommandType.TableDirect:
+ statement = "SELECT * FROM " + query;
+ break;
+ }
+
+ return statement;
+ }
+
+ string GetStoredProcParmList () {
+ StringBuilder s = new StringBuilder();
+
+ int addedCount = 0;
+ for(int p = 0; p < parmCollection.Count; p++) {
+ PgSqlParameter prm = parmCollection[p];
+ if(prm.Direction == ParameterDirection.Input) {
+ string strObj = PostgresHelper.
+ ObjectToString(prm.DbType,
+ prm.Value);
+ if(addedCount > 0)
+ s.Append(",");
+ s.Append(strObj);
+ addedCount++;
+ }
+ }
+ return s.ToString();
+ }
+
+ private void ExecuteQuery (string query, PgSqlResult res)
+ {
+ IntPtr pgResult;
+
+ ExecStatusType execStatus;
+
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnectionState is not Open");
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (conn.PostgresConnection, query);
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+
+ res.ExecStatus = execStatus;
+
+ if(execStatus == ExecStatusType.PGRES_TUPLES_OK ||
+ execStatus == ExecStatusType.PGRES_COMMAND_OK) {
+
+ res.BuildTableSchema(pgResult);
+ }
+ else {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+
+ throw new PgSqlException(0, 0,
+ errorMessage, 0, "",
+ conn.DataSource, "SqlCommand", 0);
+ }
+ }
+
+ // since SqlCommand has resources so SqlDataReader
+ // can do Read() and NextResult(), need to free
+ // those resources. Also, need to allow this SqlCommand
+ // and this SqlConnection to do things again.
+ internal void CloseReader() {
+ dataReader = null;
+ queries = null;
+
+ if((cmdBehavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection) {
+ conn.CloseReader(true);
+ }
+ else {
+ conn.CloseReader(false);
+ }
+ }
+
+ // only meant to be used between SqlConnectioin,
+ // SqlCommand, and SqlDataReader
+ internal void OpenReader(PgSqlDataReader reader) {
+ conn.OpenReader(reader);
+ }
+
+ /// <summary>
+ /// ExecuteScalar is used to retrieve one object
+ /// from one result set
+ /// that has one row and one column.
+ /// It is lightweight compared to ExecuteReader.
+ /// </summary>
+ [MonoTODO]
+ public object ExecuteScalar () {
+ IntPtr pgResult; // PGresult
+ ExecStatusType execStatus;
+ object obj = null; // return
+ int nRow = 0; // first row
+ int nCol = 0; // first column
+ String value;
+ int nRows;
+ int nFields;
+ string query;
+
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is not Open");
+
+ query = TweakQuery(sql, cmdType);
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (conn.PostgresConnection, query);
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+ if(execStatus == ExecStatusType.PGRES_COMMAND_OK) {
+ // result was a SQL Command
+
+ // close result set
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+
+ return null; // return null reference
+ }
+ else if(execStatus == ExecStatusType.PGRES_TUPLES_OK) {
+ // result was a SQL Query
+
+ nRows = PostgresLibrary.
+ PQntuples(pgResult);
+
+ nFields = PostgresLibrary.
+ PQnfields(pgResult);
+
+ if(nRows > 0 && nFields > 0) {
+
+ // get column name
+ //String fieldName;
+ //fieldName = PostgresLibrary.
+ // PQfname(pgResult, nCol);
+
+ int oid;
+ string sType;
+ DbType dbType;
+ // get PostgreSQL data type (OID)
+ oid = PostgresLibrary.
+ PQftype(pgResult, nCol);
+ sType = PostgresHelper.
+ OidToTypname (oid, conn.Types);
+ dbType = PostgresHelper.
+ TypnameToSqlDbType(sType);
+
+ int definedSize;
+ // get defined size of column
+ definedSize = PostgresLibrary.
+ PQfsize(pgResult, nCol);
+
+ // get data value
+ value = PostgresLibrary.
+ PQgetvalue(
+ pgResult,
+ nRow, nCol);
+
+ int columnIsNull;
+ // is column NULL?
+ columnIsNull = PostgresLibrary.
+ PQgetisnull(pgResult,
+ nRow, nCol);
+
+ int actualLength;
+ // get Actual Length
+ actualLength = PostgresLibrary.
+ PQgetlength(pgResult,
+ nRow, nCol);
+
+ obj = PostgresHelper.
+ ConvertDbTypeToSystem (
+ dbType,
+ value);
+ }
+
+ // close result set
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+
+ }
+ else {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+
+ throw new PgSqlException(0, 0,
+ errorMessage, 0, "",
+ conn.DataSource, "SqlCommand", 0);
+ }
+
+ return obj;
+ }
+
+ [MonoTODO]
+ public XmlReader ExecuteXmlReader () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Prepare () {
+ // FIXME: parameters have to be implemented for this
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public PgSqlCommand Clone () {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Properties
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+
+ set {
+ sql = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+
+ set {
+ // FIXME: if value < 0, throw
+ // ArgumentException
+ // if (value < 0)
+ // throw ArgumentException;
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return cmdType;
+ }
+
+ set {
+ cmdType = value;
+ }
+ }
+
+ // FIXME: for property Connection, is this the correct
+ // way to handle a return of a stronger type?
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during a
+ // transaction in progress
+
+ // csc
+ Connection = (PgSqlConnection) value;
+ // mcs
+ // Connection = value;
+
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public PgSqlConnection Connection {
+ get {
+ // conn defaults to null
+ return conn;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during
+ // a transaction in progress
+ conn = value;
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTime;
+ }
+
+ set{
+ designTime = value;
+ }
+ }
+
+ // FIXME; for property Parameters, is this the correct
+ // way to handle a stronger return type?
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ public PgSqlParameterCollection Parameters {
+ get {
+ return parmCollection;
+ }
+ }
+
+ // FIXME: for property Transaction, is this the correct
+ // way to handle a return of a stronger type?
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return Transaction;
+ }
+
+ set {
+ // FIXME: error handling - do not allow
+ // setting of transaction if transaction
+ // has already begun
+
+ // csc
+ Transaction = (PgSqlTransaction) value;
+ // mcs
+ // Transaction = value;
+ }
+ }
+
+ public PgSqlTransaction Transaction {
+ get {
+ return trans;
+ }
+
+ set {
+ // FIXME: error handling
+ trans = value;
+ }
+ }
+
+ [MonoTODO]
+ public UpdateRowSource UpdatedRowSource {
+ // FIXME: do this once DbDataAdaptor
+ // and DataRow are done
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Inner Classes
+
+ #endregion // Inner Classes
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose() {
+ // FIXME: need proper way to release resources
+ // Dispose(true);
+ }
+
+ [MonoTODO]
+ ~PgSqlCommand() {
+ // FIXME: need proper way to release resources
+ // Dispose(false);
+ }
+
+ #endregion //Destructors
+ }
+
+ // SqlResult is used for passing Result Set data
+ // from SqlCommand to SqlDataReader
+ internal class PgSqlResult {
+
+ private DataTable dataTableSchema = null; // only will contain the schema
+ private IntPtr pg_result = IntPtr.Zero; // native PostgreSQL PGresult
+ private int rowCount = 0;
+ private int fieldCount = 0;
+ private string[] pgtypes = null; // PostgreSQL types (typname)
+ private bool resultReturned = false;
+ private PgSqlConnection con = null;
+ private int rowsAffected = -1;
+ private ExecStatusType execStatus = ExecStatusType.PGRES_FATAL_ERROR;
+ private int currentQuery = -1;
+ private string sql = "";
+ private CommandBehavior cmdBehavior = CommandBehavior.Default;
+
+ internal CommandBehavior Behavior {
+ get {
+ return cmdBehavior;
+ }
+ set {
+ cmdBehavior = value;
+ }
+ }
+
+ internal string SQL {
+ get {
+ return sql;
+ }
+ set {
+ sql = value;
+ }
+ }
+
+ internal ExecStatusType ExecStatus {
+ get {
+ return execStatus;
+ }
+ set {
+ execStatus = value;
+ }
+ }
+
+ internal int CurrentQuery {
+ get {
+ return currentQuery;
+ }
+
+ set {
+ currentQuery = value;
+ }
+
+ }
+
+ internal PgSqlConnection Connection {
+ get {
+ return con;
+ }
+
+ set {
+ con = value;
+ }
+ }
+
+ internal int RecordsAffected {
+ get {
+ return rowsAffected;
+ }
+ }
+
+ internal bool ResultReturned {
+ get {
+ return resultReturned;
+ }
+ set {
+ resultReturned = value;
+ }
+ }
+
+ internal DataTable Table {
+ get {
+ return dataTableSchema;
+ }
+ }
+
+ internal IntPtr PgResult {
+ get {
+ return pg_result;
+ }
+ }
+
+ internal int RowCount {
+ get {
+ return rowCount;
+ }
+ }
+
+ internal int FieldCount {
+ get {
+ return fieldCount;
+ }
+ }
+
+ internal string[] PgTypes {
+ get {
+ return pgtypes;
+ }
+ }
+
+ internal void BuildTableSchema (IntPtr pgResult) {
+ pg_result = pgResult;
+
+ // need to set IDataReader.RecordsAffected property
+ string rowsAffectedString;
+ rowsAffectedString = PostgresLibrary.
+ PQcmdTuples (pgResult);
+ if(rowsAffectedString != null)
+ if(rowsAffectedString.Equals("") == false)
+ rowsAffected = int.Parse(rowsAffectedString);
+
+ // Only Results from SQL SELECT Queries
+ // get a DataTable for schema of the result
+ // otherwise, DataTable is null reference
+ if(execStatus == ExecStatusType.PGRES_TUPLES_OK) {
+
+ dataTableSchema = new DataTable ();
+ dataTableSchema.Columns.Add ("ColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
+ dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
+ dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
+ dataTableSchema.Columns.Add ("NumericScale", typeof (int));
+ dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
+ dataTableSchema.Columns.Add ("IsKey", typeof (bool));
+ DataColumn dc = dataTableSchema.Columns["IsKey"];
+ dc.AllowDBNull = true; // IsKey can have a DBNull
+ dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
+ dataTableSchema.Columns.Add ("DataType", typeof(Type));
+ dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
+ dataTableSchema.Columns.Add ("ProviderType", typeof (int));
+ dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
+ dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
+ dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
+ dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
+ dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
+ dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
+ dataTableSchema.Columns.Add ("IsLong", typeof (bool));
+ dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
+
+ fieldCount = PostgresLibrary.PQnfields (pgResult);
+ rowCount = PostgresLibrary.PQntuples(pgResult);
+ pgtypes = new string[fieldCount];
+
+ // TODO: for CommandBehavior.SingleRow
+ // use IRow, otherwise, IRowset
+ if(fieldCount > 0)
+ if((cmdBehavior & CommandBehavior.SingleRow) == CommandBehavior.SingleRow)
+ fieldCount = 1;
+
+ // TODO: for CommandBehavior.SchemaInfo
+ if((cmdBehavior & CommandBehavior.SchemaOnly) == CommandBehavior.SchemaOnly)
+ fieldCount = 0;
+
+ // TODO: for CommandBehavior.SingleResult
+ if((cmdBehavior & CommandBehavior.SingleResult) == CommandBehavior.SingleResult)
+ if(currentQuery > 0)
+ fieldCount = 0;
+
+ // TODO: for CommandBehavior.SequentialAccess - used for reading Large OBjects
+ //if((cmdBehavior & CommandBehavior.SequentialAccess) == CommandBehavior.SequentialAccess) {
+ //}
+
+ DataRow schemaRow;
+ int oid;
+ DbType dbType;
+ Type typ;
+
+ for (int i = 0; i < fieldCount; i += 1 ) {
+ schemaRow = dataTableSchema.NewRow ();
+
+ string columnName = PostgresLibrary.PQfname (pgResult, i);
+
+ schemaRow["ColumnName"] = columnName;
+ schemaRow["ColumnOrdinal"] = i+1;
+ schemaRow["ColumnSize"] = PostgresLibrary.PQfsize (pgResult, i);
+ schemaRow["NumericPrecision"] = 0;
+ schemaRow["NumericScale"] = 0;
+ // TODO: need to get KeyInfo
+ if((cmdBehavior & CommandBehavior.KeyInfo) == CommandBehavior.KeyInfo) {
+ bool IsUnique, IsKey;
+ GetKeyInfo(columnName, out IsUnique, out IsKey);
+ }
+ else {
+ schemaRow["IsUnique"] = false;
+ schemaRow["IsKey"] = DBNull.Value;
+ }
+ schemaRow["BaseCatalogName"] = "";
+ schemaRow["BaseColumnName"] = columnName;
+ schemaRow["BaseSchemaName"] = "";
+ schemaRow["BaseTableName"] = "";
+
+ // PostgreSQL type to .NET type stuff
+ oid = PostgresLibrary.PQftype (pgResult, i);
+ pgtypes[i] = PostgresHelper.OidToTypname (oid, con.Types);
+ dbType = PostgresHelper.TypnameToSqlDbType (pgtypes[i]);
+
+ typ = PostgresHelper.DbTypeToSystemType (dbType);
+ string st = typ.ToString();
+ schemaRow["DataType"] = typ;
+
+ schemaRow["AllowDBNull"] = false;
+ schemaRow["ProviderType"] = oid;
+ schemaRow["IsAliased"] = false;
+ schemaRow["IsExpression"] = false;
+ schemaRow["IsIdentity"] = false;
+ schemaRow["IsAutoIncrement"] = false;
+ schemaRow["IsRowVersion"] = false;
+ schemaRow["IsHidden"] = false;
+ schemaRow["IsLong"] = false;
+ schemaRow["IsReadOnly"] = false;
+ schemaRow.AcceptChanges();
+ dataTableSchema.Rows.Add (schemaRow);
+ }
+
+#if DEBUG_SqlCommand
+ Console.WriteLine("********** DEBUG Table Schema BEGIN ************");
+ foreach (DataRow myRow in dataTableSchema.Rows) {
+ foreach (DataColumn myCol in dataTableSchema.Columns)
+ Console.WriteLine(myCol.ColumnName + " = " + myRow[myCol]);
+ Console.WriteLine();
+ }
+ Console.WriteLine("********** DEBUG Table Schema END ************");
+#endif // DEBUG_SqlCommand
+
+ }
+ }
+
+ // TODO: how do we get the key info if
+ // we don't have the tableName?
+ private void GetKeyInfo(string columnName, out bool isUnique, out bool isKey) {
+ isUnique = false;
+ isKey = false;
+/*
+ string sql;
+
+ sql =
+ "SELECT i.indkey, i.indisprimary, i.indisunique " +
+ "FROM pg_class c, pg_class c2, pg_index i " +
+ "WHERE c.relname = ':tableName' AND c.oid = i.indrelid " +
+ "AND i.indexrelid = c2.oid ";
+*/
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
new file mode 100644
index 00000000000..ddd6c126754
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
@@ -0,0 +1,103 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlCommandBuilder.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.ComponentModel;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ /// <summary>
+ /// Builder of one command
+ /// that will be used in manipulating a table for
+ /// a DataSet that is assoicated with a database.
+ /// </summary>
+ public sealed class PgSqlCommandBuilder : Component {
+
+ [MonoTODO]
+ public PgSqlCommandBuilder() {
+
+ }
+
+ [MonoTODO]
+ public PgSqlCommandBuilder(PgSqlDataAdapter adapter) {
+
+ }
+
+ [MonoTODO]
+ public PgSqlDataAdapter DataAdapter {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuotePrefix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuoteSuffix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static void DeriveParameters(PgSqlCommand command) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public PgSqlCommand GetDeleteCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public PgSqlCommand GetInsertCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public PgSqlCommand GetUpdateCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshSchema() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~PgSqlCommandBuilder() {
+ // FIXME: create destructor - release resources
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs
new file mode 100644
index 00000000000..226b00fb6e5
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs
@@ -0,0 +1,711 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlConnection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+// Credits:
+// SQL and concepts were used from libgda 0.8.190 (GNOME Data Access)
+// http://www.gnome-db.org/
+// with permission from the authors of the
+// PostgreSQL provider in libgda:
+// Michael Lausch <michael@lausch.at>
+// Rodrigo Moya <rodrigo@gnome-db.org>
+// Vivien Malerba <malerba@gnome-db.org>
+// Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+//
+
+// use #define DEBUG_SqlConnection if you want to spew debug messages
+// #define DEBUG_SqlConnection
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ /// <summary>
+ /// Represents an open connection to a SQL data source
+ /// </summary>
+ public sealed class PgSqlConnection : Component, IDbConnection,
+ ICloneable
+ {
+ // FIXME: Need to implement class Component,
+ // and interfaces: ICloneable and IDisposable
+
+ #region Fields
+
+ private PostgresTypes types = null;
+ private IntPtr pgConn = IntPtr.Zero;
+
+ // PGConn (Postgres Connection)
+ private string connectionString = "";
+ // OLE DB Connection String
+ private string pgConnectionString = "";
+ // PostgreSQL Connection String
+ private PgSqlTransaction trans = null;
+ private int connectionTimeout = 15;
+ // default for 15 seconds
+
+ // connection parameters in connection string
+ private string host = "";
+ // Name of host to connect to
+ private string hostaddr = "";
+ // IP address of host to connect to
+ // should be in "n.n.n.n" format
+ private string port = "";
+ // Port number to connect to at the server host
+ private string dbname = ""; // The database name.
+ private string user = ""; // User name to connect as.
+ private string password = "";
+ // Password to be used if the server
+ // demands password authentication.
+ private string options = "";
+ // Trace/debug options to be sent to the server.
+ private string tty = "";
+ // A file or tty for optional
+ // debug output from the backend.
+ private string requiressl = "";
+ // Set to 1 to require
+ // SSL connection to the backend.
+ // Libpq will then refuse to connect
+ // if the server does not
+ // support SSL. Set to 0 (default) to
+ // negotiate with server.
+
+ // connection state
+ private ConnectionState conState = ConnectionState.Closed;
+
+ // DataReader state
+ private PgSqlDataReader rdr = null;
+ private bool dataReaderOpen = false;
+ // FIXME: if true, throw an exception if SqlConnection
+ // is used for anything other than reading
+ // data using SqlDataReader
+
+ private string versionString = "Unknown";
+
+ private bool disposed = false;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ // A lot of the defaults were initialized in the Fields
+ [MonoTODO]
+ public PgSqlConnection () {
+
+ }
+
+ [MonoTODO]
+ public PgSqlConnection (String connectionString) {
+ SetConnectionString (connectionString);
+ }
+
+ #endregion // Constructors
+
+ #region Destructors
+
+ protected override void Dispose(bool disposing) {
+ if(!this.disposed)
+ try {
+ if(disposing) {
+ // release any managed resources
+ }
+ // release any unmanaged resources
+ // close any handles
+
+ this.disposed = true;
+ }
+ finally {
+ base.Dispose(disposing);
+ }
+ }
+
+ // aka Finalize()
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ [MonoTODO]
+ ~PgSqlConnection() {
+ Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ #region Public Methods
+
+ IDbTransaction IDbConnection.BeginTransaction () {
+ return BeginTransaction ();
+ }
+
+ public PgSqlTransaction BeginTransaction () {
+ return TransactionBegin (); // call private method
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel
+ il) {
+ return BeginTransaction (il);
+ }
+
+ public PgSqlTransaction BeginTransaction (IsolationLevel il) {
+ return TransactionBegin (il); // call private method
+ }
+
+ // PostgreSQL does not support named transactions/savepoint
+ // nor nested transactions
+ [Obsolete]
+ public PgSqlTransaction BeginTransaction(string transactionName) {
+ return TransactionBegin (); // call private method
+ }
+
+ [Obsolete]
+ public PgSqlTransaction BeginTransaction(IsolationLevel iso,
+ string transactionName) {
+ return TransactionBegin (iso); // call private method
+ }
+
+ [MonoTODO]
+ public void ChangeDatabase (string databaseName) {
+ throw new NotImplementedException ();
+ }
+
+ object ICloneable.Clone() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Close () {
+ if(dataReaderOpen == true) {
+ // TODO: what do I do if
+ // the user Closes the connection
+ // without closing the Reader first?
+
+ }
+ CloseDataSource ();
+ }
+
+ IDbCommand IDbConnection.CreateCommand () {
+ return CreateCommand ();
+ }
+
+ public PgSqlCommand CreateCommand () {
+ PgSqlCommand sqlcmd = new PgSqlCommand ("", this);
+
+ return sqlcmd;
+ }
+
+ [MonoTODO]
+ public void Open () {
+ if(dbname.Equals(""))
+ throw new InvalidOperationException(
+ "dbname missing");
+ else if(conState == ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is already Open");
+
+ ConnStatusType connStatus;
+
+ // FIXME: check to make sure we have
+ // everything to connect,
+ // otherwise, throw an exception
+
+ pgConn = PostgresLibrary.PQconnectdb
+ (pgConnectionString);
+
+ // FIXME: should we use PQconnectStart/PQconnectPoll
+ // instead of PQconnectdb?
+ // PQconnectdb blocks
+ // PQconnectStart/PQconnectPoll is non-blocking
+
+ connStatus = PostgresLibrary.PQstatus (pgConn);
+ if(connStatus == ConnStatusType.CONNECTION_OK) {
+ // Successfully Connected
+ disposed = false;
+
+ SetupConnection();
+ }
+ else {
+ String errorMessage = PostgresLibrary.
+ PQerrorMessage (pgConn);
+ errorMessage += ": Could not connect to database.";
+
+ throw new PgSqlException(0, 0,
+ errorMessage, 0, "",
+ host, "SqlConnection", 0);
+ }
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods
+
+ // Used to prevent SqlConnection
+ // from doing anything while
+ // SqlDataReader is open.
+ // Open the Reader. (called from SqlCommand)
+ internal void OpenReader(PgSqlDataReader reader)
+ {
+ if(dataReaderOpen == true) {
+ // TODO: throw exception here?
+ // because a reader
+ // is already open
+ }
+ else {
+ rdr = reader;
+ dataReaderOpen = true;
+ }
+ }
+
+ // Used to prevent SqlConnection
+ // from doing anything while
+ // SqlDataReader is open
+ // Close the Reader (called from SqlCommand)
+ // if closeConnection true, Close() the connection
+ // this is based on CommandBehavior.CloseConnection
+ internal void CloseReader(bool closeConnection)
+ { if(closeConnection == true)
+ CloseDataSource();
+ else
+ dataReaderOpen = false;
+ }
+
+ #endregion // Internal Methods
+
+ #region Private Methods
+
+ void SetupConnection() {
+
+ conState = ConnectionState.Open;
+
+ // FIXME: load types into hashtable
+ types = new PostgresTypes(this);
+ types.Load();
+
+ versionString = GetDatabaseServerVersion();
+
+ // set DATE style to YYYY/MM/DD
+ IntPtr pgResult = IntPtr.Zero;
+ pgResult = PostgresLibrary.PQexec (pgConn, "SET DATESTYLE TO 'ISO'");
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+ }
+
+ string GetDatabaseServerVersion()
+ {
+ PgSqlCommand cmd = new PgSqlCommand("select version()",this);
+ return (string) cmd.ExecuteScalar();
+ }
+
+ void CloseDataSource () {
+ // FIXME: just a quick hack
+ if(conState == ConnectionState.Open) {
+ if(trans != null)
+ if(trans.DoingTransaction == true) {
+ trans.Rollback();
+ // trans.Dispose();
+ trans = null;
+ }
+
+ conState = ConnectionState.Closed;
+ PostgresLibrary.PQfinish (pgConn);
+ pgConn = IntPtr.Zero;
+ }
+ }
+
+ void SetConnectionString (string connectionString) {
+ this.connectionString = connectionString;
+ StringBuilder postgresConnectionString = new StringBuilder ();
+
+ connectionString += ";";
+ NameValueCollection parameters = new NameValueCollection ();
+
+ if (connectionString == String.Empty)
+ return;
+
+ bool inQuote = false;
+ bool inDQuote = false;
+
+ string name = String.Empty;
+ string value = String.Empty;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in connectionString) {
+ switch (c) {
+ case '\'':
+ inQuote = !inQuote;
+ break;
+ case '"' :
+ inDQuote = !inDQuote;
+ break;
+ case ';' :
+ if (!inDQuote && !inQuote) {
+ if (name != String.Empty && name != null) {
+ value = sb.ToString ();
+ parameters [name.ToUpper ().Trim ()] = value.Trim ();
+ }
+ name = String.Empty;
+ value = String.Empty;
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ case '=' :
+ if (!inDQuote && !inQuote) {
+ name = sb.ToString ();
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ default:
+ sb.Append (c);
+ break;
+ }
+ }
+
+ SetProperties (parameters);
+ }
+
+ private void SetProperties (NameValueCollection parameters) {
+ StringBuilder postgresConnectionString = new StringBuilder ();
+
+ string value;
+ foreach (string name in parameters) {
+ value = parameters[name];
+
+ bool found = true;
+ switch (name) {
+ case "PORT" :
+ port = value;
+ break;
+ case "DATA SOURCE" :
+ case "SERVER" :
+ case "HOST" :
+ // set DataSource property
+ host = value;
+ break;
+ case "OPTIONS" :
+ options = value;
+ break;
+ case "TTY" :
+ tty = value;
+ break;
+ case "REQUIRESSL" :
+ requiressl = value;
+ break;
+ case "ADDRESS" :
+ case "ADDR" :
+ case "NETWORK ADDRESS" :
+ case "HOSTADDR" :
+ hostaddr = value;
+ break;
+ case "INITIAL CATALOG" :
+ case "DATABASE" :
+ case "DBNAME":
+ // set Database property
+ dbname = value;
+ break;
+ case "PASSWORD" :
+ case "PWD" :
+ password = value;
+ break;
+ case "UID" :
+ case "USER ID" :
+ case "USER" :
+ user = value;
+ break;
+ default:
+ found = false;
+ break;
+ }
+ if (found == true) {
+ string valuePair = name.ToLower() + "=" + value;
+ postgresConnectionString.Append (valuePair + " ");
+ }
+ }
+ this.pgConnectionString = postgresConnectionString.ToString ();
+ }
+
+ private PgSqlTransaction TransactionBegin () {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new PgSqlTransaction ();
+ // using internal methods of SqlTransaction
+ trans.SetConnection (this);
+ trans.Begin();
+
+ return trans;
+ }
+
+ private PgSqlTransaction TransactionBegin (IsolationLevel il) {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new PgSqlTransaction ();
+ // using internal methods of SqlTransaction
+ trans.SetConnection (this);
+ trans.SetIsolationLevel (il);
+ trans.Begin();
+
+ return trans;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ [MonoTODO]
+ public ConnectionState State {
+ get {
+ return conState;
+ }
+ }
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ SetConnectionString (value);
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+ public string Database {
+ get {
+ return dbname;
+ }
+ }
+
+ public string DataSource {
+ get {
+ return host;
+ }
+ }
+
+ public int PacketSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string ServerVersion {
+ get {
+ return versionString;
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Internal Properties
+
+ // For System.Data.SqlClient classes
+ // to get the current transaction
+ // in progress - if any
+ internal PgSqlTransaction Transaction {
+ get {
+ return trans;
+ }
+ }
+
+ // For System.Data.SqlClient classes
+ // to get the unmanaged PostgreSQL connection
+ internal IntPtr PostgresConnection {
+ get {
+ return pgConn;
+ }
+ }
+
+ // For System.Data.SqlClient classes
+ // to get the list PostgreSQL types
+ // so can look up based on OID to
+ // get the .NET System type.
+ internal ArrayList Types {
+ get {
+ return types.List;
+ }
+ }
+
+ // Used to prevent SqlConnection
+ // from doing anything while
+ // SqlDataReader is open
+ internal bool IsReaderOpen {
+ get {
+ return dataReaderOpen;
+ }
+ }
+
+ #endregion // Internal Properties
+
+ #region Events
+
+ public event
+ PgSqlInfoMessageEventHandler InfoMessage;
+
+ public event
+ StateChangeEventHandler StateChange;
+
+ #endregion
+
+ #region Inner Classes
+
+ private class PostgresTypes {
+ // TODO: create hashtable for
+ // PostgreSQL types to .NET types
+ // containing: oid, typname, SqlDbType
+
+ private Hashtable hashTypes;
+ private ArrayList pgTypes;
+ private PgSqlConnection con;
+
+ // Got this SQL with the permission from
+ // the authors of libgda
+ private const string SEL_SQL_GetTypes =
+ "SELECT oid, typname FROM pg_type " +
+ "WHERE typrelid = 0 AND typname !~ '^_' " +
+ " AND typname not in ('SET', 'cid', " +
+ "'int2vector', 'oidvector', 'regproc', " +
+ "'smgr', 'tid', 'unknown', 'xid') " +
+ "ORDER BY typname";
+
+ internal PostgresTypes(PgSqlConnection sqlcon) {
+
+ con = sqlcon;
+ hashTypes = new Hashtable();
+ }
+
+ private void AddPgType(Hashtable types,
+ string typname, DbType dbType) {
+
+ PostgresType pgType = new PostgresType();
+
+ pgType.typname = typname;
+ pgType.dbType = dbType;
+
+ types.Add(pgType.typname, pgType);
+ }
+
+ private void BuildTypes(IntPtr pgResult,
+ int nRows, int nFields) {
+
+ String value;
+
+ int r;
+ for(r = 0; r < nRows; r++) {
+ PostgresType pgType =
+ new PostgresType();
+
+ // get data value (oid)
+ value = PostgresLibrary.
+ PQgetvalue(
+ pgResult,
+ r, 0);
+
+ pgType.oid = Int32.Parse(value);
+
+ // get data value (typname)
+ value = PostgresLibrary.
+ PQgetvalue(
+ pgResult,
+ r, 1);
+ pgType.typname = String.Copy(value);
+ pgType.dbType = PostgresHelper.
+ TypnameToSqlDbType(
+ pgType.typname);
+
+ pgTypes.Add(pgType);
+ }
+ pgTypes = ArrayList.ReadOnly(pgTypes);
+ }
+
+ internal void Load() {
+ pgTypes = new ArrayList();
+ IntPtr pgResult = IntPtr.Zero; // PGresult
+
+ if(con.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is not Open");
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (con.PostgresConnection, SEL_SQL_GetTypes);
+
+ if(pgResult.Equals(IntPtr.Zero)) {
+ throw new PgSqlException(0, 0,
+ "No Resultset from PostgreSQL", 0, "",
+ con.DataSource, "SqlConnection", 0);
+ }
+ else {
+ ExecStatusType execStatus;
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+
+ if(execStatus == ExecStatusType.PGRES_TUPLES_OK) {
+ int nRows;
+ int nFields;
+
+ nRows = PostgresLibrary.
+ PQntuples(pgResult);
+
+ nFields = PostgresLibrary.
+ PQnfields(pgResult);
+
+ BuildTypes (pgResult, nRows, nFields);
+
+ // close result set
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+ }
+ else {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ // close result set
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+
+ throw new PgSqlException(0, 0,
+ errorMessage, 0, "",
+ con.DataSource, "SqlConnection", 0);
+ }
+ }
+ }
+
+ public ArrayList List {
+ get {
+ return pgTypes;
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
new file mode 100644
index 00000000000..aee4ceee59d
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
@@ -0,0 +1,191 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used
+ /// to fill the DataSet and update a data source, all this
+ /// from a SQL database.
+ /// </summary>
+ public sealed class PgSqlDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ PgSqlCommand deleteCommand;
+ PgSqlCommand insertCommand;
+ PgSqlCommand selectCommand;
+ PgSqlCommand updateCommand;
+
+ static readonly object EventRowUpdated = new object();
+ static readonly object EventRowUpdating = new object();
+
+ #endregion
+
+ #region Constructors
+
+ public PgSqlDataAdapter ()
+ : this (new PgSqlCommand ())
+ {
+ }
+
+ public PgSqlDataAdapter (PgSqlCommand selectCommand)
+ {
+ DeleteCommand = new PgSqlCommand ();
+ InsertCommand = new PgSqlCommand ();
+ SelectCommand = selectCommand;
+ UpdateCommand = new PgSqlCommand ();
+ }
+
+ public PgSqlDataAdapter (string selectCommandText, PgSqlConnection selectConnection)
+ : this (new PgSqlCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public PgSqlDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new PgSqlConnection (selectConnectionString))
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public PgSqlCommand DeleteCommand {
+ get {
+ return deleteCommand;
+ }
+ set {
+ deleteCommand = value;
+ }
+ }
+
+ public PgSqlCommand InsertCommand {
+ get {
+ return insertCommand;
+ }
+ set {
+ insertCommand = value;
+ }
+ }
+
+ public PgSqlCommand SelectCommand {
+ get {
+ return selectCommand;
+ }
+ set {
+ selectCommand = value;
+ }
+ }
+
+ public PgSqlCommand UpdateCommand {
+ get {
+ return updateCommand;
+ }
+ set {
+ updateCommand = value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is PgSqlCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (PgSqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is PgSqlCommand))
+ throw new ArgumentException ();
+ InsertCommand = (PgSqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is PgSqlCommand))
+ throw new ArgumentException ();
+ SelectCommand = (PgSqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is PgSqlCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (PgSqlCommand)value;
+ }
+ }
+
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new PgSqlRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new PgSqlRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ PgSqlRowUpdatedEventHandler handler = (PgSqlRowUpdatedEventHandler) Events[EventRowUpdated];
+ if ((handler != null) && (value is PgSqlRowUpdatedEventArgs))
+ handler(this, (PgSqlRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ PgSqlRowUpdatingEventHandler handler = (PgSqlRowUpdatingEventHandler) Events[EventRowUpdating];
+ if ((handler != null) && (value is PgSqlRowUpdatingEventArgs))
+ handler(this, (PgSqlRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event PgSqlRowUpdatedEventHandler RowUpdated {
+ add { Events.AddHandler (EventRowUpdated, value); }
+ remove { Events.RemoveHandler (EventRowUpdated, value); }
+ }
+
+ public event PgSqlRowUpdatingEventHandler RowUpdating {
+ add { Events.AddHandler (EventRowUpdating, value); }
+ remove { Events.RemoveHandler (EventRowUpdating, value); }
+ }
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
new file mode 100644
index 00000000000..f855654067d
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
@@ -0,0 +1,447 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+//
+// Credits:
+// SQL and concepts were used from libgda 0.8.190 (GNOME Data Access)
+// http://www.gnome-db.org/
+// with permission from the authors of the
+// PostgreSQL provider in libgda:
+// Michael Lausch <michael@lausch.at>
+// Rodrigo Moya <rodrigo@gnome-db.org>
+// Vivien Malerba <malerba@gnome-db.org>
+// Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+//
+
+// *** uncomment #define to get debug messages, comment for production ***
+//#define DEBUG_SqlDataReader
+
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.PostgreSqlClient {
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams
+ /// of result sets obtained by executing a command
+ /// at a SQL database.
+ /// </summary>
+ public sealed class PgSqlDataReader : MarshalByRefObject,
+ IEnumerable, IDataReader, IDisposable, IDataRecord {
+
+ #region Fields
+
+ private PgSqlCommand cmd;
+ private DataTable table = null;
+
+ // columns in a row
+ private object[] fields; // data value in a .NET type
+ private string[] types; // PostgreSQL Type
+ private bool[] isNull; // is NULL?
+ private int[] actualLength; // ActualLength of data
+ private DbType[] dbTypes; // DB data type
+ // actucalLength = -1 is variable-length
+
+ private bool open = false;
+ IntPtr pgResult; // PGresult
+ private int rows;
+ private int cols;
+
+ private int recordsAffected = -1; // TODO: get this value
+
+ private int currentRow = -1; // no Read() has been done yet
+
+ private bool disposed = false;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal PgSqlDataReader (PgSqlCommand sqlCmd) {
+
+ cmd = sqlCmd;
+ open = true;
+ cmd.OpenReader(this);
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Close() {
+ open = false;
+
+ // free PgSqlDataReader resources in PgSqlCommand
+ // and allow PgSqlConnection to be used again
+ cmd.CloseReader();
+
+ // TODO: get parameters from result
+
+ Dispose (true);
+ }
+
+ [MonoTODO]
+ public DataTable GetSchemaTable() {
+ return table;
+ }
+
+ [MonoTODO]
+ public bool NextResult() {
+ PgSqlResult res;
+ currentRow = -1;
+ bool resultReturned;
+
+ // reset
+ table = null;
+ pgResult = IntPtr.Zero;
+ rows = 0;
+ cols = 0;
+ types = null;
+ recordsAffected = -1;
+
+ res = cmd.NextResult();
+ resultReturned = res.ResultReturned;
+
+ if(resultReturned == true) {
+ table = res.Table;
+ pgResult = res.PgResult;
+ rows = res.RowCount;
+ cols = res.FieldCount;
+ types = res.PgTypes;
+ recordsAffected = res.RecordsAffected;
+ }
+
+ res = null;
+ return resultReturned;
+ }
+
+ [MonoTODO]
+ public bool Read() {
+
+ string dataValue;
+ int c = 0;
+
+ if(currentRow < rows - 1) {
+
+ currentRow++;
+
+ // re-init row
+ fields = new object[cols];
+ //dbTypes = new DbType[cols];
+ actualLength = new int[cols];
+ isNull = new bool[cols];
+
+ for(c = 0; c < cols; c++) {
+
+ // get data value
+ dataValue = PostgresLibrary.
+ PQgetvalue(
+ pgResult,
+ currentRow, c);
+
+ // is column NULL?
+ //isNull[c] = PostgresLibrary.
+ // PQgetisnull(pgResult,
+ // currentRow, c);
+
+ // get Actual Length
+ actualLength[c] = PostgresLibrary.
+ PQgetlength(pgResult,
+ currentRow, c);
+
+ DbType dbType;
+ dbType = PostgresHelper.
+ TypnameToSqlDbType(types[c]);
+
+ if(dataValue == null) {
+ fields[c] = null;
+ isNull[c] = true;
+ }
+ else if(dataValue.Equals("")) {
+ fields[c] = null;
+ isNull[c] = true;
+ }
+ else {
+ isNull[c] = false;
+ fields[c] = PostgresHelper.
+ ConvertDbTypeToSystem (
+ dbType,
+ dataValue);
+ }
+ }
+ return true;
+ }
+ return false; // EOF
+ }
+
+ [MonoTODO]
+ public byte GetByte(int i) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetBytes(int i, long fieldOffset,
+ byte[] buffer, int bufferOffset,
+ int length) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar(int i) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetChars(int i, long fieldOffset,
+ char[] buffer, int bufferOffset,
+ int length) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDataReader GetData(int i) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDataTypeName(int i) {
+ return types[i];
+ }
+
+ [MonoTODO]
+ public DateTime GetDateTime(int i) {
+ return (DateTime) fields[i];
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal(int i) {
+ return (decimal) fields[i];
+ }
+
+ [MonoTODO]
+ public double GetDouble(int i) {
+ return (double) fields[i];
+ }
+
+ [MonoTODO]
+ public Type GetFieldType(int i) {
+
+ DataRow row = table.Rows[i];
+ return Type.GetType((string)row["DataType"]);
+ }
+
+ [MonoTODO]
+ public float GetFloat(int i) {
+ return (float) fields[i];
+ }
+
+ [MonoTODO]
+ public Guid GetGuid(int i) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public short GetInt16(int i) {
+ return (short) fields[i];
+ }
+
+ [MonoTODO]
+ public int GetInt32(int i) {
+ return (int) fields[i];
+ }
+
+ [MonoTODO]
+ public long GetInt64(int i) {
+ return (long) fields[i];
+ }
+
+ [MonoTODO]
+ public string GetName(int i) {
+
+ DataRow row = table.Rows[i];
+ return (string) row["ColumnName"];
+ }
+
+ [MonoTODO]
+ public int GetOrdinal(string name) {
+
+ int i;
+ DataRow row;
+
+ for(i = 0; i < table.Rows.Count; i++) {
+ row = table.Rows[i];
+ if(((string) row["ColumnName"]).Equals(name))
+ return i;
+ }
+
+ for(i = 0; i < table.Rows.Count; i++) {
+ string ta;
+ string n;
+
+ row = table.Rows[i];
+ ta = ((string) row["ColumnName"]).ToUpper();
+ n = name.ToUpper();
+
+ if(ta.Equals(n)) {
+ return i;
+ }
+ }
+
+ throw new MissingFieldException("Missing field: " + name);
+ }
+
+ [MonoTODO]
+ public string GetString(int i) {
+ return (string) fields[i];
+ }
+
+ [MonoTODO]
+ public object GetValue(int i) {
+ return fields[i];
+ }
+
+ [MonoTODO]
+ public int GetValues(object[] values)
+ {
+ Array.Copy (fields, values, fields.Length);
+ return fields.Length;
+ }
+
+ [MonoTODO]
+ public bool IsDBNull(int i) {
+ return isNull[i];
+ }
+
+ [MonoTODO]
+ public bool GetBoolean(int i) {
+ return (bool) fields[i];
+ }
+
+ [MonoTODO]
+ IEnumerator IEnumerable.GetEnumerator () {
+ return new DbEnumerator (this);
+ }
+
+ #endregion // Public Methods
+
+ #region Destructors
+
+ private void Dispose(bool disposing) {
+ if(!this.disposed) {
+ if(disposing) {
+ // release any managed resources
+ cmd = null;
+ table = null;
+ fields = null;
+ types = null;
+ isNull = null;
+ actualLength = null;
+ dbTypes = null;
+ }
+ // release any unmanaged resources
+
+ // clear unmanaged PostgreSQL result set
+ if (pgResult != IntPtr.Zero) {
+ PostgresLibrary.PQclear (pgResult);
+ pgResult = IntPtr.Zero;
+ }
+
+ // close any handles
+ this.disposed = true;
+ }
+ }
+
+ void IDisposable.Dispose() {
+ Dispose(true);
+ }
+
+ ~PgSqlDataReader() {
+ Dispose(false);
+ }
+
+ #endregion // Destructors
+
+ #region Properties
+
+ public int Depth {
+ [MonoTODO]
+ get {
+ return 0; // always return zero, unless
+ // this provider will allow
+ // nesting of a row
+ }
+ }
+
+ public bool IsClosed {
+ [MonoTODO]
+ get {
+ if(open == false)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public int RecordsAffected {
+ [MonoTODO]
+ get {
+ return recordsAffected;
+ }
+ }
+
+ public int FieldCount {
+ [MonoTODO]
+ get {
+ return cols;
+ }
+ }
+
+ public object this[string name] {
+ [MonoTODO]
+ get {
+ int i;
+ DataRow row;
+
+ for(i = 0; i < table.Rows.Count; i++) {
+ row = table.Rows[i];
+ if(row["ColumnName"].Equals(name))
+ return fields[i];
+ }
+
+ for(i = 0; i < table.Rows.Count; i++) {
+ string ta;
+ string n;
+
+ row = table.Rows[i];
+ ta = ((string) row["ColumnName"]).ToUpper();
+ n = name.ToUpper();
+
+ if(ta.Equals(n)) {
+ return fields[i];
+ }
+ }
+
+ throw new MissingFieldException("Missing field: " + name);
+ }
+ }
+
+ public object this[int i] {
+ [MonoTODO]
+ get {
+ return fields[i];
+ }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs
new file mode 100644
index 00000000000..42e63996bec
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs
@@ -0,0 +1,155 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class PgSqlError
+ {
+ byte theClass = 0;
+ int lineNumber = 0;
+ string message = "";
+ int number = 0;
+ string procedure = "";
+ string server = "";
+ string source = "";
+ byte state = 0;
+
+ internal PgSqlError(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ /// <summary>
+ /// severity level of the error
+ /// </summary>
+ public byte Class {
+ get {
+ return theClass;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ return lineNumber;
+ }
+ }
+
+ [MonoTODO]
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ return number;
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ return procedure;
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ return server;
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ return source;
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ return state;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ String toStr;
+ String stackTrace;
+ stackTrace = " <Stack Trace>";
+ // FIXME: generate the correct SQL error string
+ toStr = "PgSqlError:" + message + stackTrace;
+ return toStr;
+ }
+
+ internal void SetClass(byte theClass) {
+ this.theClass = theClass;
+ }
+
+ internal void SetLineNumber(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ internal void SetMessage(string message) {
+ this.message = message;
+ }
+
+ internal void SetNumber(int number) {
+ this.number = number;
+ }
+
+ internal void SetProcedure(string procedure) {
+ this.procedure = procedure;
+ }
+
+ internal void SetServer(string server) {
+ this.server = server;
+ }
+
+ internal void SetSource(string source) {
+ this.source = source;
+ }
+
+ internal void SetState(byte state) {
+ this.state = state;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
new file mode 100644
index 00000000000..bff6205b87b
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
@@ -0,0 +1,114 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class PgSqlErrorCollection : ICollection, IEnumerable
+ {
+ ArrayList errorList = new ArrayList();
+
+ internal PgSqlErrorCollection() {
+ }
+
+ internal PgSqlErrorCollection(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public int Count {
+ get {
+ return errorList.Count;
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ // Index property (indexer)
+ // [MonoTODO]
+ public PgSqlError this[int index] {
+ get {
+ return (PgSqlError) errorList[index];
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ internal void Add(PgSqlError error) {
+ errorList.Add(error);
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ PgSqlError error = new PgSqlError(theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ Add(error);
+ }
+
+ #region Destructors
+
+ [MonoTODO]
+ ~PgSqlErrorCollection()
+ {
+ // FIXME: do the destructor - release resources
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs
new file mode 100644
index 00000000000..854b6cc4b2d
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs
@@ -0,0 +1,204 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlException.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc
+//
+using System;
+using System.Data;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Exceptions, as returned by SQL databases.
+ /// </summary>
+ public sealed class PgSqlException : SystemException
+ {
+ private PgSqlErrorCollection errors;
+
+ internal PgSqlException()
+ : base("a SQL Exception has occurred") {
+ errors = new PgSqlErrorCollection();
+ }
+
+ internal PgSqlException(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state)
+ : base(message) {
+
+ errors = new PgSqlErrorCollection (theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public byte Class {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ else
+ return errors[0].Class;
+ }
+
+ set {
+ errors[0].SetClass(value);
+ }
+ }
+
+ [MonoTODO]
+ public PgSqlErrorCollection Errors {
+ get {
+ return errors;
+ }
+
+ set {
+ errors = value;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ return errors[0].LineNumber;
+ }
+
+ set {
+ errors[0].SetLineNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Message {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else {
+ String msg = "";
+ int i = 0;
+
+ for(i = 0; i < errors.Count - 1; i++) {
+ msg = msg + errors[i].Message + "\n";
+ }
+ msg = msg + errors[i].Message;
+
+ return msg;
+ }
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].Number;
+ }
+
+ set {
+ errors[0].SetNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Procedure;
+ }
+
+ set {
+ errors[0].SetProcedure(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Server;
+ }
+
+ set {
+ errors[0].SetServer(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Source {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Source;
+ }
+
+ set {
+ errors[0].SetSource(value);
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].State;
+ }
+
+ set {
+ errors[0].SetState(value);
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo si,
+ StreamingContext context) {
+ // FIXME: to do
+ }
+
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ public override string ToString() {
+ String toStr = "";
+ for (int i = 0; i < errors.Count; i++) {
+ toStr = toStr + errors[i].ToString() + "\n";
+ }
+ return toStr;
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors.Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ [MonoTODO]
+ ~PgSqlException() {
+ // FIXME: destructor to release resources
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..f2a7a7e8a81
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlInfoMessageEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ public sealed class PgSqlInfoMessageEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public PgSqlErrorCollection Errors {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Message
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ // representation of InfoMessage event
+ return "'ToString() for SqlInfoMessageEventArgs Not Implemented'";
+ }
+
+ //[MonoTODO]
+ //~PgSqlInfoMessageEventArgs() {
+ // FIXME: destructor needs to release resources
+ //}
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..d96fc3f7050
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlInfoMessageEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ public delegate void
+ PgSqlInfoMessageEventHandler (object sender,
+ PgSqlInfoMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs
new file mode 100644
index 00000000000..287febfcf42
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs
@@ -0,0 +1,237 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally,
+ /// its mapping to DataSet columns; and is implemented by .NET
+ /// data providers that access data sources.
+ /// </summary>
+ //public sealed class PgSqlParameter : MarshalByRefObject,
+ // IDbDataParameter, IDataParameter, ICloneable
+ public sealed class PgSqlParameter : IDbDataParameter, IDataParameter
+ {
+ private string parmName;
+ private SqlDbType dbtype;
+ private DbType theDbType;
+ private object objValue;
+ private int size;
+ private string sourceColumn;
+ private ParameterDirection direction;
+ private bool isNullable;
+ private byte precision;
+ private byte scale;
+ private DataRowVersion sourceVersion;
+ private int offset;
+
+ [MonoTODO]
+ public PgSqlParameter () {
+
+ }
+
+ [MonoTODO]
+ public PgSqlParameter (string parameterName, object value) {
+ this.parmName = parameterName;
+ this.objValue = value;
+ }
+
+ [MonoTODO]
+ public PgSqlParameter(string parameterName, SqlDbType dbType) {
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ }
+
+ [MonoTODO]
+ public PgSqlParameter(string parameterName, SqlDbType dbType,
+ int size) {
+
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ this.size = size;
+ }
+
+ [MonoTODO]
+ public PgSqlParameter(string parameterName, SqlDbType dbType,
+ int size, string sourceColumn) {
+
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ this.size = size;
+ this.sourceColumn = sourceColumn;
+ }
+
+ [MonoTODO]
+ public PgSqlParameter(string parameterName, SqlDbType dbType,
+ int size, ParameterDirection direction,
+ bool isNullable, byte precision,
+ byte scale, string sourceColumn,
+ DataRowVersion sourceVersion, object value) {
+
+ this.parmName = parameterName;
+ this.dbtype = dbType;
+ this.size = size;
+ this.sourceColumn = sourceColumn;
+ this.direction = direction;
+ this.isNullable = isNullable;
+ this.precision = precision;
+ this.scale = scale;
+ this.sourceVersion = sourceVersion;
+ this.objValue = value;
+ }
+
+ [MonoTODO]
+ public DbType DbType {
+ get {
+ return theDbType;
+ }
+ set {
+ theDbType = value;
+ }
+ }
+
+ [MonoTODO]
+ public ParameterDirection Direction {
+ get {
+ return direction;
+ }
+ set {
+ direction = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool IsNullable {
+ get {
+ return isNullable;
+ }
+ }
+
+ [MonoTODO]
+ public int Offset {
+ get {
+ return offset;
+ }
+
+ set {
+ offset = value;
+ }
+ }
+
+
+ string IDataParameter.ParameterName {
+ get {
+ return parmName;
+ }
+
+ set {
+ parmName = value;
+ }
+ }
+
+ public string ParameterName {
+ get {
+ return parmName;
+ }
+
+ set {
+ parmName = value;
+ }
+ }
+
+ [MonoTODO]
+ public string SourceColumn {
+ get {
+ return sourceColumn;
+ }
+
+ set {
+ sourceColumn = value;
+ }
+ }
+
+ [MonoTODO]
+ public DataRowVersion SourceVersion {
+ get {
+ return sourceVersion;
+ }
+
+ set {
+ sourceVersion = value;
+ }
+ }
+
+ [MonoTODO]
+ public SqlDbType SqlDbType {
+ get {
+ return dbtype;
+ }
+
+ set {
+ dbtype = value;
+ }
+ }
+
+ [MonoTODO]
+ public object Value {
+ get {
+ return objValue;
+ }
+
+ set {
+ objValue = value;
+ }
+ }
+
+ [MonoTODO]
+ public byte Precision {
+ get {
+ return precision;
+ }
+
+ set {
+ precision = value;
+ }
+ }
+
+ [MonoTODO]
+ public byte Scale {
+ get {
+ return scale;
+ }
+
+ set {
+ scale = value;
+ }
+ }
+
+ [MonoTODO]
+ public int Size
+ {
+ get {
+ return size;
+ }
+
+ set {
+ size = value;
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ return parmName;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
new file mode 100644
index 00000000000..0cd47323cd2
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
@@ -0,0 +1,267 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object
+ /// and their mappings to DataSet columns.
+ /// </summary>
+ // public sealed class PgSqlParameterCollection : MarshalByRefObject,
+ // IDataParameterCollection, IList, ICollection, IEnumerable
+ public sealed class PgSqlParameterCollection : IDataParameterCollection,
+ IList
+ {
+ private ArrayList parameterList = new ArrayList();
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public int Add( object value)
+ {
+ // Call the add version that receives a SqlParameter
+
+ // Check if value is a PgSqlParameter.
+ CheckType(value);
+ Add((PgSqlParameter) value);
+
+ return IndexOf (value);
+ }
+
+
+ public PgSqlParameter Add(PgSqlParameter value)
+ {
+ parameterList.Add(value);
+ return value;
+ }
+
+
+ public PgSqlParameter Add(string parameterName, object value)
+ {
+ PgSqlParameter sqlparam = new PgSqlParameter();
+ sqlparam.Value = value;
+ // TODO: Get the dbtype and Sqldbtype from system type of value.
+
+ return Add(sqlparam);
+ }
+
+
+ public PgSqlParameter Add(string parameterName, SqlDbType sqlDbType)
+ {
+ PgSqlParameter sqlparam = new PgSqlParameter();
+ sqlparam.ParameterName = parameterName;
+ sqlparam.SqlDbType = sqlDbType;
+ return Add(sqlparam);
+ }
+
+
+ public PgSqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size)
+ {
+ PgSqlParameter sqlparam = new PgSqlParameter();
+ sqlparam.ParameterName = parameterName;
+ sqlparam.SqlDbType = sqlDbType;
+ sqlparam.Size = size;
+ return Add(sqlparam);
+ }
+
+
+ public PgSqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size, string sourceColumn)
+ {
+ PgSqlParameter sqlparam = new PgSqlParameter();
+ sqlparam.ParameterName = parameterName;
+ sqlparam.SqlDbType = sqlDbType;
+ sqlparam.Size = size;
+ sqlparam.SourceColumn = sourceColumn;
+ return Add(sqlparam);
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public bool Contains(object value)
+ {
+ // Check if value is a SqlParameter
+ CheckType(value);
+ return Contains(((PgSqlParameter)value).ParameterName);
+ }
+
+
+ [MonoTODO]
+ public bool Contains(string value)
+ {
+ for(int p = 0; p < parameterList.Count; p++) {
+ if(((PgSqlParameter)parameterList[p]).ParameterName.Equals(value))
+ return true;
+ }
+ return false;
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public int IndexOf(object value)
+ {
+ // Check if value is a SqlParameter
+ CheckType(value);
+ return IndexOf(((PgSqlParameter)value).ParameterName);
+ }
+
+
+ public int IndexOf(string parameterName)
+ {
+ int p = -1;
+
+ for(p = 0; p < parameterList.Count; p++) {
+ if(((PgSqlParameter)parameterList[p]).ParameterName.Equals(parameterName))
+ return p;
+ }
+ return p;
+ }
+
+ [MonoTODO]
+ public void Insert(int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Count {
+ get {
+ return parameterList.Count;
+ }
+ }
+
+ object IList.this[int index] {
+ [MonoTODO]
+ get {
+ return (PgSqlParameter) this[index];
+ }
+
+ [MonoTODO]
+ set {
+ this[index] = (PgSqlParameter) value;
+ }
+ }
+
+ public PgSqlParameter this[int index] {
+ get {
+ return (PgSqlParameter) parameterList[index];
+ }
+
+ set {
+ parameterList[index] = (PgSqlParameter) value;
+ }
+ }
+
+ object IDataParameterCollection.this[string parameterName] {
+ [MonoTODO]
+ get {
+ return this[parameterName];
+ }
+
+ [MonoTODO]
+ set {
+ CheckType(value);
+ this[parameterName] = (PgSqlParameter) value;
+ }
+ }
+
+ public PgSqlParameter this[string parameterName] {
+ get {
+ for(int p = 0; p < parameterList.Count; p++) {
+ if(parameterName.Equals(((PgSqlParameter)parameterList[p]).ParameterName))
+ return (PgSqlParameter) parameterList[p];
+ }
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ }
+
+ set {
+ for(int p = 0; p < parameterList.Count; p++) {
+ if(parameterName.Equals(((PgSqlParameter)parameterList[p]).ParameterName))
+ parameterList[p] = value;
+ }
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ }
+ }
+
+ bool IList.IsFixedSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// <summary>
+ /// This method checks if the parameter value is of
+ /// PgSqlParameter type. If it doesn't, throws an InvalidCastException.
+ /// </summary>
+ private void CheckType(object value)
+ {
+ if(!(value is PgSqlParameter))
+ throw new InvalidCastException("Only PgSqlParameter objects can be used.");
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..1b7beb61461
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
@@ -0,0 +1,37 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlRowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.PostgreSqlClient {
+ public sealed class PgSqlRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ [MonoTODO]
+ public PgSqlRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new PgSqlCommand Command {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ ~PgSqlRowUpdatedEventArgs ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..c577aabc8d1
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlRowUpdatedEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ public delegate void PgSqlRowUpdatedEventHandler(object sender,
+ PgSqlRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..f61e2f69338
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
@@ -0,0 +1,43 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ public sealed class PgSqlRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ [MonoTODO]
+ public PgSqlRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new PgSqlCommand Command {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ ~PgSqlRowUpdatingEventArgs()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..672239c23d8
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlRowUpdatingEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ public delegate void PgSqlRowUpdatingEventHandler(object sender,
+ PgSqlRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
new file mode 100644
index 00000000000..e3d0a87b2a2
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
@@ -0,0 +1,191 @@
+//
+// Mono.Data.PostgreSqlClient.PgSqlTransaction.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+// use #define DEBUG_SqlTransaction if you want to spew debug messages
+// #define DEBUG_SqlTransaction
+
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.PostgreSqlClient
+{
+ /// <summary>
+ /// Represents a transaction to be performed on a SQL database.
+ /// </summary>
+ // public sealed class PgSqlTransaction : MarshalByRefObject,
+ // IDbTransaction, IDisposable
+ public sealed class PgSqlTransaction : IDbTransaction
+ {
+ #region Fields
+
+ private bool doingTransaction = false;
+ private PgSqlConnection conn = null;
+ private IsolationLevel isolationLevel =
+ IsolationLevel.ReadCommitted;
+ // There are only two IsolationLevel's for PostgreSQL:
+ // ReadCommitted and Serializable,
+ // but ReadCommitted is the default
+
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Commit ()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Commit transaction.");
+
+ PgSqlCommand cmd = new PgSqlCommand("COMMIT", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ [MonoTODO]
+ public void Rollback()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Rollback transaction.");
+
+ PgSqlCommand cmd = new PgSqlCommand("ROLLBACK", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ // For PostgreSQL, Rollback(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Rollback(string transactionName) {
+ // throw new NotImplementedException ();
+ Rollback();
+ }
+
+ // For PostgreSQL, Save(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Save (string savePointName) {
+ // throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods to Mono.Data.PostgreSqlClient.dll Assembly
+
+ internal void Begin()
+ {
+ if(doingTransaction == true)
+ throw new InvalidOperationException(
+ "Transaction has begun " +
+ "and PostgreSQL does not " +
+ "support nested transactions.");
+
+ PgSqlCommand cmd = new PgSqlCommand("BEGIN", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = true;
+ }
+
+ internal void SetIsolationLevel(IsolationLevel isoLevel)
+ {
+ String sSql = "SET TRANSACTION ISOLATION LEVEL ";
+
+ switch (isoLevel)
+ {
+ case IsolationLevel.ReadCommitted:
+ sSql += "READ COMMITTED";
+ break;
+
+ case IsolationLevel.Serializable:
+ sSql += "SERIALIZABLE";
+ break;
+
+ default:
+ // FIXME: generate exception here
+ // PostgreSQL only supports:
+ // ReadCommitted or Serializable
+ break;
+ }
+ PgSqlCommand cmd = new PgSqlCommand(sSql, conn);
+ cmd.ExecuteNonQuery();
+
+ this.isolationLevel = isoLevel;
+ }
+
+ internal void SetConnection(PgSqlConnection connection)
+ {
+ this.conn = connection;
+ }
+
+ #endregion // Internal Methods to System.Data.dll Assembly
+
+ #region Properties
+
+ IDbConnection IDbTransaction.Connection {
+ get {
+ return Connection;
+ }
+ }
+
+ public PgSqlConnection Connection {
+ get {
+ return conn;
+ }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get {
+ return isolationLevel;
+ }
+ }
+
+ internal bool DoingTransaction {
+ get {
+ return doingTransaction;
+ }
+ }
+
+ #endregion Properties
+
+ #region Destructors
+
+ // Destructors aka Finalize and Dispose
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ // FIXME: need to properly release resources
+ // Dispose(true);
+ }
+
+ // Destructor
+ [MonoTODO]
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~PgSqlTransaction() {
+ // FIXME: need to properly release resources
+ // Dispose(false);
+ }
+
+ #endregion // Destructors
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs
new file mode 100644
index 00000000000..f2b44a7697b
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs
@@ -0,0 +1,475 @@
+//
+// Mono.Data.PostgreSqlClient.PostgresLibrary.cs
+//
+// PInvoke methods to libpq
+// which is PostgreSQL client library
+//
+// May also contain enumerations,
+// data types, or wrapper methods.
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// *** uncomment #define to get debug messages, comment for production ***
+//#define DEBUG_PostgresLibrary
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+using System.Collections;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ /* IMPORTANT: DO NOT CHANGE ANY OF THESE ENUMS BELOW */
+
+ internal enum ConnStatusType
+ {
+ CONNECTION_OK,
+ CONNECTION_BAD,
+ CONNECTION_STARTED,
+ CONNECTION_MADE,
+ CONNECTION_AWAITING_RESPONSE,
+ CONNECTION_AUTH_OK,
+ CONNECTION_SETENV
+ }
+
+ internal enum PostgresPollingStatusType
+ {
+ PGRES_POLLING_FAILED = 0,
+ PGRES_POLLING_READING,
+ PGRES_POLLING_WRITING,
+ PGRES_POLLING_OK,
+ PGRES_POLLING_ACTIVE
+ }
+
+ internal enum ExecStatusType
+ {
+ PGRES_EMPTY_QUERY = 0,
+ PGRES_COMMAND_OK,
+ PGRES_TUPLES_OK,
+ PGRES_COPY_OUT,
+ PGRES_COPY_IN,
+ PGRES_BAD_RESPONSE,
+ PGRES_NONFATAL_ERROR,
+ PGRES_FATAL_ERROR
+ }
+
+ sealed internal class PostgresLibrary
+ {
+ #region PInvoke Functions
+
+ // pinvoke prototypes to PostgreSQL client library
+ // pq.dll on windows and libpq.so on linux
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectStart (string conninfo);
+ // PGconn *PQconnectStart(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern PostgresPollingStatusType PQconnectPoll (IntPtr conn);
+ // PostgresPollingStatusType PQconnectPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectdb (string conninfo);
+ // PGconn *PQconnectdb(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetdbLogin (string pghost,
+ string pgport, string pgoptions,
+ string pgtty, string dbName,
+ string login, string pwd);
+ // PGconn *PQsetdbLogin(const char *pghost,
+ // const char *pgport, const char *pgoptions,
+ // const char *pgtty, const char *dbName,
+ // const char *login, const char *pwd);
+
+ [DllImport("pq")]
+ public static extern void PQfinish (IntPtr conn);
+ // void PQfinish(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconndefaults ();
+ // PQconninfoOption *PQconndefaults(void);
+
+ [DllImport("pq")]
+ public static extern void PQconninfoFree (IntPtr connOptions);
+ // void PQconninfoFree(PQconninfoOption *connOptions);
+
+ [DllImport("pq")]
+ public static extern int PQresetStart (IntPtr conn);
+ // int PQresetStart(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQresetPoll (IntPtr conn);
+ // PostgresPollingStatusType PQresetPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQreset (IntPtr conn);
+ // void PQreset(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQrequestCancel (IntPtr conn);
+ // int PQrequestCancel(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQdb (IntPtr conn);
+ // char *PQdb(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQuser (IntPtr conn);
+ // char *PQuser(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQpass (IntPtr conn);
+ // char *PQpass(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQhost (IntPtr conn);
+ // char *PQhost(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQport (IntPtr conn);
+ // char *PQport(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQtty (IntPtr conn);
+ // char *PQtty(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQoptions (IntPtr conn);
+ // char *PQoptions(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern ConnStatusType PQstatus (IntPtr conn);
+ // ConnStatusType PQstatus(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQerrorMessage (IntPtr conn);
+ // char *PQerrorMessage(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsocket (IntPtr conn);
+ // int PQsocket(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQbackendPID (IntPtr conn);
+ // int PQbackendPID(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQclientEncoding (IntPtr conn);
+ // int PQclientEncoding(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetClientEncoding (IntPtr conn,
+ string encoding);
+ // int PQsetClientEncoding(PGconn *conn,
+ // const char *encoding);
+
+ //FIXME: when loading, causes runtime exception
+ //[DllImport("pq")]
+ //public static extern IntPtr PQgetssl (IntPtr conn);
+ // SSL *PQgetssl(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQtrace (IntPtr conn,
+ IntPtr debug_port);
+ // void PQtrace(PGconn *conn,
+ // FILE *debug_port);
+
+ [DllImport("pq")]
+ public static extern void PQuntrace (IntPtr conn);
+ // void PQuntrace(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetNoticeProcessor (IntPtr conn,
+ IntPtr proc, IntPtr arg);
+ // PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
+ // PQnoticeProcessor proc, void *arg);
+
+ [DllImport("pq")]
+ public static extern uint PQescapeString (out string to,
+ string from, uint length);
+ // size_t PQescapeString(char *to,
+ // const char *from, size_t length);
+
+ [DllImport("pq")]
+ public static extern byte[] PQescapeBytea (byte[] bintext,
+ uint binlen, uint bytealen);
+ // unsigned char *PQescapeBytea(unsigned char *bintext,
+ // size_t binlen, size_t *bytealen);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQexec (IntPtr conn,
+ string query);
+ // PGresult *PQexec(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQnotifies (IntPtr conn);
+ // PGnotify *PQnotifies(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQfreeNotify (IntPtr notify);
+ // void PQfreeNotify(PGnotify *notify);
+
+ [DllImport("pq")]
+ public static extern int PQsendQuery (IntPtr conn,
+ string query);
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQgetResult (IntPtr conn);
+ // PGresult *PQgetResult(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQisBusy (IntPtr conn);
+ // int PQisBusy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQconsumeInput (IntPtr conn);
+ // int PQconsumeInput(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQgetline (IntPtr conn,
+ string str, int length);
+ // int PQgetline(PGconn *conn,
+ // char *string, int length);
+
+ [DllImport("pq")]
+ public static extern int PQputline (IntPtr conn,
+ string str);
+ // int PQputline(PGconn *conn,
+ // const char *string);
+
+ [DllImport("pq")]
+ public static extern int PQgetlineAsync (IntPtr conn,
+ string buffer, int bufsize);
+ // int PQgetlineAsync(PGconn *conn, char *buffer,
+ // int bufsize);
+
+ [DllImport("pq")]
+ public static extern int PQputnbytes (IntPtr conn,
+ string buffer, int nbytes);
+ // int PQputnbytes(PGconn *conn,
+ //const char *buffer, int nbytes);
+
+ [DllImport("pq")]
+ public static extern int PQendcopy (IntPtr conn);
+ // int PQendcopy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetnonblocking (IntPtr conn,
+ int arg);
+ // int PQsetnonblocking(PGconn *conn, int arg);
+
+ [DllImport("pq")]
+ public static extern int PQisnonblocking (IntPtr conn);
+ // int PQisnonblocking(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQflush (IntPtr conn);
+ // int PQflush(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQfn (IntPtr conn, int fnid,
+ IntPtr result_buf, IntPtr result_len,
+ int result_is_int, IntPtr args,
+ int nargs);
+ // PGresult *PQfn(PGconn *conn, int fnid,
+ // int *result_buf, int *result_len,
+ // int result_is_int, const PQArgBlock *args,
+ // int nargs);
+
+ [DllImport("pq")]
+ public static extern ExecStatusType PQresultStatus (IntPtr res);
+ // ExecStatusType PQresultStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQresStatus (ExecStatusType status);
+ // char *PQresStatus(ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern string PQresultErrorMessage (IntPtr res);
+ // char *PQresultErrorMessage(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQntuples (IntPtr res);
+ // int PQntuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQnfields (IntPtr res);
+ // int PQnfields(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQbinaryTuples (IntPtr res);
+ // int PQbinaryTuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQfname (IntPtr res,
+ int field_num);
+ // char *PQfname(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfnumber (IntPtr res,
+ string field_name);
+ // int PQfnumber(const PGresult *res,
+ // const char *field_name);
+
+ [DllImport("pq")]
+ public static extern int PQftype (IntPtr res,
+ int field_num);
+ // Oid PQftype(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfsize (IntPtr res,
+ int field_num);
+ // int PQfsize(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfmod (IntPtr res, int field_num);
+ // int PQfmod(const PGresult *res, int field_num);
+
+ [DllImport("pq")]
+ public static extern string PQcmdStatus (IntPtr res);
+ // char *PQcmdStatus(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQoidStatus (IntPtr res);
+ // char *PQoidStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQoidValue (IntPtr res);
+ // Oid PQoidValue(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQcmdTuples (IntPtr res);
+ // char *PQcmdTuples(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQgetvalue (IntPtr res,
+ int tup_num, int field_num);
+ // char *PQgetvalue(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetlength (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetlength(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetisnull (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetisnull(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern void PQclear (IntPtr res);
+ // void PQclear(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQmakeEmptyPGresult (IntPtr conn,
+ IntPtr status);
+ // PGresult *PQmakeEmptyPGresult(PGconn *conn,
+ // ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern void PQprint (IntPtr fout,
+ IntPtr res, IntPtr ps);
+ // void PQprint(FILE *fout,
+ // const PGresult *res, const PQprintOpt *ps);
+
+ [DllImport("pq")]
+ public static extern void PQdisplayTuples (IntPtr res,
+ IntPtr fp, int fillAlign, string fieldSep,
+ int printHeader, int quiet);
+ // void PQdisplayTuples(const PGresult *res,
+ // FILE *fp, int fillAlign, const char *fieldSep,
+ // int printHeader, int quiet);
+
+ [DllImport("pq")]
+ public static extern void PQprintTuples (IntPtr res,
+ IntPtr fout, int printAttName, int terseOutput,
+ int width);
+ // void PQprintTuples(const PGresult *res,
+ // FILE *fout, int printAttName, int terseOutput,
+ // int width);
+
+ [DllImport("pq")]
+ public static extern int lo_open (IntPtr conn,
+ int lobjId, int mode);
+ // int lo_open(PGconn *conn,
+ // Oid lobjId, int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_close (IntPtr conn, int fd);
+ // int lo_close(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_read (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_read(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_write (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_write(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_lseek (IntPtr conn,
+ int fd, int offset, int whence);
+ // int lo_lseek(PGconn *conn,
+ // int fd, int offset, int whence);
+
+ [DllImport("pq")]
+ public static extern int lo_creat (IntPtr conn,
+ int mode);
+ // Oid lo_creat(PGconn *conn,
+ // int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_tell (IntPtr conn, int fd);
+ // int lo_tell(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_unlink (IntPtr conn,
+ int lobjId);
+ // int lo_unlink(PGconn *conn,
+ // Oid lobjId);
+
+ [DllImport("pq")]
+ public static extern int lo_import (IntPtr conn,
+ string filename);
+ // Oid lo_import(PGconn *conn,
+ // const char *filename);
+
+ [DllImport("pq")]
+ public static extern int lo_export (IntPtr conn,
+ int lobjId, string filename);
+ // int lo_export(PGconn *conn,
+ // Oid lobjId, const char *filename);
+
+ [DllImport("pq")]
+ public static extern int PQmblen (string s,
+ int encoding);
+ // int PQmblen(const unsigned char *s,
+ // int encoding);
+
+ [DllImport("pq")]
+ public static extern int PQenv2encoding ();
+ // int PQenv2encoding(void);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresTypes.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresTypes.cs
new file mode 100644
index 00000000000..b20742876f8
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresTypes.cs
@@ -0,0 +1,511 @@
+//
+// PostgresTypes.cs - holding methods to convert
+// between PostgreSQL types and .NET types
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Daniel Morgan
+//
+
+// Note: this might become PostgresType and PostgresTypeCollection
+// also, the PostgresTypes that exist as an inner internal class
+// within PgSqlConnection maybe moved here in the future
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+using System.Text;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ internal struct PostgresType {
+ public int oid;
+ public string typname;
+ public DbType dbType;
+ }
+
+ sealed internal class PostgresHelper {
+
+ // translates the PostgreSQL typname to System.Data.DbType
+ public static DbType TypnameToSqlDbType(string typname) {
+ DbType sqlType;
+
+ // FIXME: use hashtable here?
+
+ switch(typname) {
+
+ case "abstime":
+ sqlType = DbType.Int32;
+ break;
+
+ case "aclitem":
+ sqlType = DbType.String;
+ break;
+
+ case "bit":
+ sqlType = DbType.String;
+ break;
+
+ case "bool":
+ sqlType = DbType.Boolean;
+ break;
+
+ case "box":
+ sqlType = DbType.String;
+ break;
+
+ case "bpchar":
+ sqlType = DbType.String;
+ break;
+
+ case "bytea":
+ sqlType = DbType.String;
+ break;
+
+ case "char":
+ sqlType = DbType.String;
+ break;
+
+ case "cidr":
+ sqlType = DbType.String;
+ break;
+
+ case "circle":
+ sqlType = DbType.String;
+ break;
+
+ case "date":
+ sqlType = DbType.Date;
+ break;
+
+ case "float4":
+ sqlType = DbType.Single;
+ break;
+
+ case "float8":
+ sqlType = DbType.Double;
+ break;
+
+ case "inet":
+ sqlType = DbType.String;
+ break;
+
+ case "int2":
+ sqlType = DbType.Int16;
+ break;
+
+ case "int4":
+ sqlType = DbType.Int32;
+ break;
+
+ case "int8":
+ sqlType = DbType.Int64;
+ break;
+
+ case "interval":
+ sqlType = DbType.String;
+ break;
+
+ case "line":
+ sqlType = DbType.String;
+ break;
+
+ case "lseg":
+ sqlType = DbType.String;
+ break;
+
+ case "macaddr":
+ sqlType = DbType.String;
+ break;
+
+ case "money":
+ sqlType = DbType.Decimal;
+ break;
+
+ case "name":
+ sqlType = DbType.String;
+ break;
+
+ case "numeric":
+ sqlType = DbType.Decimal;
+ break;
+
+ case "oid":
+ sqlType = DbType.Int32;
+ break;
+
+ case "path":
+ sqlType = DbType.String;
+ break;
+
+ case "point":
+ sqlType = DbType.String;
+ break;
+
+ case "polygon":
+ sqlType = DbType.String;
+ break;
+
+ case "refcursor":
+ sqlType = DbType.String;
+ break;
+
+ case "reltime":
+ sqlType = DbType.String;
+ break;
+
+ case "text":
+ sqlType = DbType.String;
+ break;
+
+ case "time":
+ sqlType = DbType.Time;
+ break;
+
+ case "timestamp":
+ sqlType = DbType.DateTime;
+ break;
+
+ case "timestamptz":
+ sqlType = DbType.DateTime;
+ break;
+
+ case "timetz":
+ sqlType = DbType.DateTime;
+ break;
+
+ case "tinterval":
+ sqlType = DbType.String;
+ break;
+
+ case "varbit":
+ sqlType = DbType.String;
+ break;
+
+ case "varchar":
+ sqlType = DbType.String;
+ break;
+
+ default:
+ sqlType = DbType.String;
+ break;
+ }
+ return sqlType;
+ }
+
+ // Converts data value from database to .NET System type.
+ public static object ConvertDbTypeToSystem (DbType typ, String value) {
+ object obj = null;
+
+ // FIXME: more types need
+ // to be converted
+ // from PostgreSQL oid type
+ // to .NET System.<type>
+
+ // FIXME: need to handle a NULL for each type
+ // maybe setting obj to System.DBNull.Value ?
+
+
+ if(value == null) {
+ //Console.WriteLine("ConvertDbTypeToSystemDbType typ: " +
+ // typ + " value is null");
+ return null;
+ }
+ else if(value.Equals("")) {
+ //Console.WriteLine("ConvertDbTypeToSystemDbType typ: " +
+ // typ + " value is string empty");
+ return null;
+ }
+
+ //Console.WriteLine("ConvertDbTypeToSystemDbType typ: " +
+ // typ + " value: " + value);
+
+ // Date, Time, and DateTime
+ // are parsed based on ISO format
+ // "YYYY-MM-DD hh:mi:ss.ms"
+
+ switch(typ) {
+ case DbType.String:
+ obj = String.Copy(value);
+ break;
+ case DbType.Boolean:
+ obj = value.Equals("t");
+ break;
+ case DbType.Int16:
+ obj = Int16.Parse(value);
+ break;
+ case DbType.Int32:
+ obj = Int32.Parse(value);
+ break;
+ case DbType.Int64:
+ obj = Int64.Parse(value);
+ break;
+ case DbType.Decimal:
+ obj = Decimal.Parse(value);
+ break;
+ case DbType.Single:
+ obj = Single.Parse(value);
+ break;
+ case DbType.Double:
+ obj = Double.Parse(value);
+ break;
+ case DbType.Date:
+ String[] sd = value.Split(new Char[] {'-'});
+ obj = new DateTime(
+ Int32.Parse(sd[0]), Int32.Parse(sd[1]), Int32.Parse(sd[2]),
+ 0,0,0);
+ break;
+ case DbType.Time:
+ String[] st = value.Split(new Char[] {':'});
+ obj = new DateTime(0001,01,01,
+ Int32.Parse(st[0]),Int32.Parse(st[1]),Int32.Parse(st[2]));
+ break;
+ case DbType.DateTime:
+ Int32 YYYY,MM,DD,hh,mi,ss,ms;
+ YYYY = Int32.Parse(value.Substring(0,4));
+ MM = Int32.Parse(value.Substring(5,2));
+ DD = Int32.Parse(value.Substring(8,2));
+ hh = Int32.Parse(value.Substring(11,2));
+ mi = Int32.Parse(value.Substring(14,2));
+ ss = Int32.Parse(value.Substring(17,2));
+ ms = Int32.Parse(value.Substring(20,2));
+ obj = new DateTime(YYYY,MM,DD,hh,mi,ss,ms);
+ break;
+ default:
+ obj = String.Copy(value);
+ break;
+ }
+
+ return obj;
+ }
+
+ // Translates System.Data.DbType to System.Type
+ public static Type DbTypeToSystemType (DbType dType) {
+ // FIXME: more types need
+ // to be mapped
+ // from PostgreSQL oid type
+ // to .NET System.<type>
+
+ Type typ = null;
+
+ switch(dType) {
+ case DbType.String:
+ typ = typeof(String);
+ break;
+ case DbType.Boolean:
+ typ = typeof(Boolean);
+ break;
+ case DbType.Int16:
+ typ = typeof(Int16);
+ break;
+ case DbType.Int32:
+ typ = typeof(Int32);
+ break;
+ case DbType.Int64:
+ typ = typeof(Int64);
+ break;
+ case DbType.Decimal:
+ typ = typeof(Decimal);
+ break;
+ case DbType.Single:
+ typ = typeof(Single);
+ break;
+ case DbType.Double:
+ typ = typeof(Double);
+ break;
+ case DbType.Date:
+ case DbType.Time:
+ case DbType.DateTime:
+ typ = typeof(DateTime);
+ break;
+ default:
+ typ = typeof(String);
+ break;
+ }
+ return typ;
+ }
+
+ // Find DbType for oid
+ // which requires a look up of PostgresTypes
+ // DbType <-> typname <-> oid
+ public static string OidToTypname (int oid, ArrayList pgTypes) {
+ // FIXME: more types need
+ // to be mapped
+ // from PostgreSQL oid type
+ // to .NET System.<type>
+
+ string typname = "text"; // default
+ int i;
+ for(i = 0; i < pgTypes.Count; i++) {
+ PostgresType pt = (PostgresType) pgTypes[i];
+ if(pt.oid == oid) {
+ typname = pt.typname;
+ break;
+ }
+ }
+
+ return typname;
+ }
+
+ // Convert a .NET System value type (Int32, String, Boolean, etc)
+ // to a string that can be included within a SQL statement.
+ // This is to methods provides the parameters support
+ // for the PostgreSQL .NET Data provider
+ public static string ObjectToString(DbType dbtype, object obj) {
+
+ // TODO: how do we handle a NULL?
+ //if(isNull == true)
+ // return "NULL";
+
+ string s;
+
+ // Date, Time, and DateTime are expressed in ISO format
+ // which is "YYYY-MM-DD hh:mm:ss.ms";
+ DateTime dt;
+ StringBuilder sb;
+
+ const string zero = "0";
+
+ switch(dbtype) {
+ case DbType.String:
+ s = "'" + obj + "'";
+ break;
+ case DbType.Boolean:
+ if((bool)obj == true)
+ s = "'t'";
+ else
+ s = "'f'";
+ break;
+ case DbType.Int16:
+ s = obj.ToString();
+ break;
+ case DbType.Int32:
+ s = obj.ToString();
+ break;
+ case DbType.Int64:
+ s = obj.ToString();
+ break;
+ case DbType.Decimal:
+ s = obj.ToString();
+ break;
+ case DbType.Single:
+ s = obj.ToString();
+ break;
+ case DbType.Double:
+ s = obj.ToString();
+ break;
+ case DbType.Date:
+ dt = (DateTime) obj;
+ sb = new StringBuilder();
+ sb.Append('\'');
+ // year
+ if(dt.Year < 10)
+ sb.Append("000" + dt.Year);
+ else if(dt.Year < 100)
+ sb.Append("00" + dt.Year);
+ else if(dt.Year < 1000)
+ sb.Append("0" + dt.Year);
+ else
+ sb.Append(dt.Year);
+ sb.Append("-");
+ // month
+ if(dt.Month < 10)
+ sb.Append(zero + dt.Month);
+ else
+ sb.Append(dt.Month);
+ sb.Append("-");
+ // day
+ if(dt.Day < 10)
+ sb.Append(zero + dt.Day);
+ else
+ sb.Append(dt.Day);
+ sb.Append('\'');
+ s = sb.ToString();
+ break;
+ case DbType.Time:
+ dt = (DateTime) obj;
+ sb = new StringBuilder();
+ sb.Append('\'');
+ // hour
+ if(dt.Hour < 10)
+ sb.Append(zero + dt.Hour);
+ else
+ sb.Append(dt.Hour);
+ sb.Append(":");
+ // minute
+ if(dt.Minute < 10)
+ sb.Append(zero + dt.Minute);
+ else
+ sb.Append(dt.Minute);
+ sb.Append(":");
+ // second
+ if(dt.Second < 10)
+ sb.Append(zero + dt.Second);
+ else
+ sb.Append(dt.Second);
+ sb.Append('\'');
+ s = sb.ToString();
+ break;
+ case DbType.DateTime:
+ dt = (DateTime) obj;
+ sb = new StringBuilder();
+ sb.Append('\'');
+ // year
+ if(dt.Year < 10)
+ sb.Append("000" + dt.Year);
+ else if(dt.Year < 100)
+ sb.Append("00" + dt.Year);
+ else if(dt.Year < 1000)
+ sb.Append("0" + dt.Year);
+ else
+ sb.Append(dt.Year);
+ sb.Append("-");
+ // month
+ if(dt.Month < 10)
+ sb.Append(zero + dt.Month);
+ else
+ sb.Append(dt.Month);
+ sb.Append("-");
+ // day
+ if(dt.Day < 10)
+ sb.Append(zero + dt.Day);
+ else
+ sb.Append(dt.Day);
+ sb.Append(" ");
+ // hour
+ if(dt.Hour < 10)
+ sb.Append(zero + dt.Hour);
+ else
+ sb.Append(dt.Hour);
+ sb.Append(":");
+ // minute
+ if(dt.Minute < 10)
+ sb.Append(zero + dt.Minute);
+ else
+ sb.Append(dt.Minute);
+ sb.Append(":");
+ // second
+ if(dt.Second < 10)
+ sb.Append(zero + dt.Second);
+ else
+ sb.Append(dt.Second);
+ sb.Append(".");
+ // millisecond
+ if(dt.Millisecond < 10)
+ sb.Append(zero + dt.Millisecond);
+ else
+ sb.Append(dt.Millisecond);
+ sb.Append('\'');
+ s = sb.ToString();
+ break;
+ default:
+ // default to DbType.String
+ s = "'" + obj + "'";
+ break;
+ }
+ return s;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/TODOAttribute.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/TODOAttribute.cs
new file mode 100644
index 00000000000..dd7e68a69c4
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.PostgreSqlClient {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/list b/mcs/class/Mono.Data.PostgreSqlClient/list
new file mode 100644
index 00000000000..d0714f78d43
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/list
@@ -0,0 +1,24 @@
+Mono.Data.PostgreSqlClient/Locale.cs
+Mono.Data.PostgreSqlClient/ParmUtil.cs
+Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
+Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
+Mono.Data.PostgreSqlClient/PgSqlCommand.cs
+Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
+Mono.Data.PostgreSqlClient/PgSqlConnection.cs
+Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
+Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
+Mono.Data.PostgreSqlClient/PgSqlError.cs
+Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
+Mono.Data.PostgreSqlClient/PgSqlException.cs
+Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
+Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
+Mono.Data.PostgreSqlClient/PgSqlParameter.cs
+Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
+Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
+Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
+Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
+Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
+Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
+Mono.Data.PostgreSqlClient/PostgresLibrary.cs
+Mono.Data.PostgreSqlClient/PostgresTypes.cs
+Mono.Data.PostgreSqlClient/TODOAttribute.cs
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/makefile.gnu b/mcs/class/Mono.Data.PostgreSqlClient/makefile.gnu
new file mode 100644
index 00000000000..8970d51ec33
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/makefile.gnu
@@ -0,0 +1,12 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.PostgreSqlClient.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.Data
+
+SOURCES_INCLUDE=*.cs
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.SqliteClient/.cvsignore b/mcs/class/Mono.Data.SqliteClient/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Data.SqliteClient/ChangeLog b/mcs/class/Mono.Data.SqliteClient/ChangeLog
new file mode 100644
index 00000000000..1ebfc696bb8
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/ChangeLog
@@ -0,0 +1,44 @@
+2002-11-16 Tim Coleman <tim@timcoleman.com>
+ * makefile.gnu:
+ Add MONO_PATH_PREFIX so build doesn't
+ fail if System.Data has not yet been installed.
+
+2002-11-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.SqliteClient/SqliteDataReader.cs: redid the
+ implementation for GetSchemaTable() and
+ implemented IEnumerator IEnumerable.GetEnumerator ()
+
+2002-10-16 Miguel de Icaza <miguel@ximian.com>
+
+ * Mono.Data.SqliteClient/SqliteCommand.cs: Reworked to return the
+ error from SqlLite.
+
+2002-10-12 Vladimir Vukicevic <vladimir@pobox.com>
+
+ * sources.list: whoops, fix dir name
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test: added new directory to hold
+ tests for Mono.Data.SqliteClient
+
+ * Test/SqliteTest.cs: added file
+ to test Mono.Data.SqliteClient.
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.SqliteClient: add file
+ to build on Windows
+
+ * Mono.Data.SqliteClient/SqliteCommand.cs: modified
+ added unsafe { } around call to sqlite_exec() which calls
+ an unsafe method SqliteCallbackFunction
+
+2002-10-12 Vladimir Vukicevic <vladimir@pobox.com>
+
+ * Mono.Data.SqlClient/SqliteCobmmand.cs, SqliteDataReader.cs,
+ SqliteParameterCollection.cs, SqliteConnection.cs,
+ SqliteParameter.cs:
+ Initial checkin
+
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient.build b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient.build
new file mode 100644
index 00000000000..276a8c3dd08
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient.build
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.SqliteClient.dll -->
+
+<project name="Mono.Data.SqliteClient" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.SqliteClient.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/System.Data.dll" tofile="Test/System.Data.dll"/>
+ <copy file="../lib/Mono.Data.SqliteClient.dll" tofile="Test/Mono.Data.SqliteClient.dll"/>
+ <copy file="../lib/Mono.Data.SqliteClient.dll" tofile="Mono.Data.SqliteClient/Mono.Data.SqliteClient.dll"/>
+ <copy file="../lib/Mono.Data.SqliteClient.dll" tofile="../System.Data/Test/Mono.Data.SqliteClient.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Data.dll" failonerror="false"/>
+ <delete file="Test/System.Data.dll" failonerror="false"/>
+ <delete file="../lib/Mono.Data.SqliteClient.dll" failonerror="false"/>
+ <delete file="Test/Mono.Data.SqliteClient.dll" failonerror="false"/>
+
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/.cvsignore b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs
new file mode 100644
index 00000000000..bf3e98944c5
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs
@@ -0,0 +1,280 @@
+// -*- c-basic-offset: 8; inent-tabs-mode: nil -*-
+//
+// SqliteCommand.cs
+//
+// Author(s): Vladimir Vukicevic <vladimir@pobox.com>
+//
+// Copyright (C) 2002 Vladimir Vukicevic
+//
+
+using System;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Data;
+
+namespace Mono.Data.SqliteClient {
+ public class SqliteCommand : IDbCommand
+ {
+ SqliteConnection parent_conn;
+// SqliteTransaction transaction;
+ IDbTransaction transaction;
+ string sql;
+ int timeout;
+ CommandType type;
+ UpdateRowSource upd_row_source;
+ SqliteParameterCollection sql_params;
+
+ public SqliteCommand ()
+ {
+ sql = "";
+ sql_params = new SqliteParameterCollection ();
+ }
+
+ public SqliteCommand (string sqlText, SqliteConnection dbConn)
+ {
+ sql = sqlText;
+ parent_conn = dbConn;
+ sql_params = new SqliteParameterCollection ();
+ }
+
+ public SqliteCommand (string sqlText, SqliteConnection dbConn, IDbTransaction trans)
+ {
+ sql = sqlText;
+ parent_conn = dbConn;
+ transaction = trans;
+ sql_params = new SqliteParameterCollection ();
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+ set {
+ sql = value;
+ }
+ }
+
+ // note that we could actually implement
+ // a timeout with sqlite, but setting up a signal to interrupt us after
+ // a certain amount of time, but it's probably not worth the effort
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+ set {
+ timeout = value;
+ }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get {
+ return parent_conn;
+ }
+ set {
+ if (!(value is SqliteConnection)) {
+ throw new InvalidOperationException ("Can't set Connection to something other than a SqliteConnection");
+ }
+ parent_conn = (SqliteConnection) value;
+ }
+ }
+
+ public SqliteConnection Connection {
+ get {
+ return parent_conn;
+ }
+ set {
+ parent_conn = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ public SqliteParameterCollection Parameters {
+ get {
+ return sql_params;
+ }
+ }
+
+ public IDbTransaction Transaction {
+ get {
+ return transaction;
+ }
+ set {
+ transaction = value;
+ }
+ }
+
+ public UpdateRowSource UpdatedRowSource {
+ get {
+ return upd_row_source;
+ }
+ set {
+ upd_row_source = value;
+ }
+ }
+
+ public void Prepare ()
+ {
+ }
+
+ public void Cancel ()
+ {
+ }
+
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ public SqliteParameter CreateParameter ()
+ {
+ return new SqliteParameter ();
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ int rows_affected;
+ SqliteDataReader r = ExecuteReader (CommandBehavior.Default, false, out rows_affected);
+ return rows_affected;
+ }
+
+ public object ExecuteScalar ()
+ {
+ SqliteDataReader r = ExecuteReader ();
+ if (r == null || !r.Read ()) {
+ return null;
+ }
+ object o = r[0];
+ r.Close ();
+ return o;
+ }
+
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ return ExecuteReader ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+ {
+ return ExecuteReader (behavior);
+ }
+
+ public SqliteDataReader ExecuteReader ()
+ {
+ return ExecuteReader (CommandBehavior.Default);
+ }
+
+ public SqliteDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ int r;
+ return ExecuteReader (behavior, true, out r);
+ }
+
+ public SqliteDataReader ExecuteReader (CommandBehavior behavior, bool want_results, out int rows_affected)
+ {
+ SqliteDataReader reader = null;
+ SqliteError err;
+
+ parent_conn.StartExec ();
+
+ string msg = "";
+ unsafe {
+ byte *msg_result;
+
+ try {
+ if (want_results) {
+ reader = new SqliteDataReader (this);
+
+ err = sqlite_exec (parent_conn.Handle,
+ sql,
+ new SqliteCallbackFunction (reader.SqliteCallback),
+ IntPtr.Zero, &msg_result);
+ reader.ReadingDone ();
+ } else {
+ err = sqlite_exec (parent_conn.Handle,
+ sql,
+ null,
+ IntPtr.Zero, &msg_result);
+ }
+ } finally {
+ parent_conn.EndExec ();
+ }
+
+ if (msg_result != null){
+ StringBuilder sb = new StringBuilder ();
+
+ for (byte *y = msg_result; *y != 0; y++)
+ sb.Append ((char) *y);
+ msg = sb.ToString ();
+
+ sqliteFree (msg_result);
+ }
+ }
+
+ if (err != SqliteError.OK)
+ throw new ApplicationException ("Sqlite error " + msg);
+
+ rows_affected = NumChanges ();
+ return reader;
+ }
+
+
+ internal int NumChanges () {
+ return sqlite_changes (parent_conn.Handle);
+ }
+
+ internal unsafe delegate int SqliteCallbackFunction (ref object o, int argc, sbyte **argv, sbyte **colnames);
+
+ [DllImport("sqlite")]
+ unsafe static extern SqliteError sqlite_exec (IntPtr handle, string sql, SqliteCallbackFunction callback,
+ IntPtr user_data, byte **errstr_ptr);
+
+ [DllImport ("sqlite")]
+ unsafe static extern void sqliteFree (void *ptr);
+
+ [DllImport("sqlite")]
+ static extern int sqlite_changes (IntPtr handle);
+
+ internal enum SqliteError : int {
+ OK,
+ Error,
+ Internal,
+ Perm,
+ Abort,
+ Busy,
+ Locked,
+ NoMem,
+ ReadOnly,
+ Interrupt,
+ IOErr,
+ Corrupt,
+ NotFound,
+ Full,
+ CantOpen,
+ Protocol,
+ Empty,
+ Schema,
+ TooBig,
+ Constraint,
+ Mismatch,
+ Misuse
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteConnection.cs b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteConnection.cs
new file mode 100644
index 00000000000..02dacfe9b44
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteConnection.cs
@@ -0,0 +1,197 @@
+// -*- c-basic-offset: 8; inent-tabs-mode: nil -*-
+//
+// SqliteConnection.cs
+//
+// Author(s): Vladimir Vukicevic <vladimir@pobox.com>
+//
+// Copyright (C) 2002 Vladimir Vukicevic
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Data;
+
+namespace Mono.Data.SqliteClient
+{
+ public class SqliteConnection : IDbConnection
+ {
+ string conn_str;
+ string db_file;
+ int db_mode;
+ IntPtr sqlite_handle;
+
+ ConnectionState state;
+
+ public SqliteConnection ()
+ {
+ db_file = null;
+ db_mode = 0644;
+ state = ConnectionState.Closed;
+ sqlite_handle = IntPtr.Zero;
+ }
+
+ public SqliteConnection (string connstring)
+ : this ()
+ {
+ ConnectionString = connstring;
+ }
+
+ public void Dispose ()
+ {
+ Close ();
+ }
+
+ public string ConnectionString
+ {
+ get {
+ return conn_str;
+ }
+ set {
+ if (value == null) {
+ Close ();
+ conn_str = null;
+ return;
+ }
+
+ if (value != conn_str) {
+ Close ();
+ conn_str = value;
+
+ db_file = null;
+ db_mode = 0644;
+
+ string[] conn_pieces = value.Split (',');
+ foreach (string piece in conn_pieces) {
+ piece.Trim ();
+ string[] arg_pieces = piece.Split ('=');
+ if (arg_pieces.Length != 2) {
+ throw new InvalidOperationException ("Invalid connection string");
+ }
+ string token = arg_pieces[0].ToLower ();
+ string tvalue = arg_pieces[1];
+ string tvalue_lc = arg_pieces[1].ToLower ();
+ if (token == "uri") {
+ if (tvalue_lc.StartsWith ("file://")) {
+ db_file = tvalue.Substring (6);
+ } else if (tvalue_lc.StartsWith ("file:")) {
+ db_file = tvalue.Substring (5);
+ } else if (tvalue_lc.StartsWith ("/")) {
+ db_file = tvalue;
+ } else {
+ throw new InvalidOperationException ("Invalid connection string: invalid URI");
+ }
+ } else if (token == "mode") {
+ db_mode = Convert.ToInt32 (tvalue);
+ }
+ }
+
+ if (db_file == null) {
+ throw new InvalidOperationException ("Invalid connection string: no URI");
+ }
+ }
+ }
+ }
+
+ public int ConnectionTimeout
+ {
+ get {
+ return 0;
+ }
+ }
+
+ public string Database
+ {
+ get {
+ return db_file;
+ }
+ }
+
+ public ConnectionState State
+ {
+ get {
+ return state;
+ }
+ }
+
+ internal IntPtr Handle
+ {
+ get {
+ return sqlite_handle;
+ }
+ }
+
+ public void Open ()
+ {
+ if (conn_str == null) {
+ throw new InvalidOperationException ("No database specified");
+ }
+
+ if (state != ConnectionState.Closed) {
+ return;
+ }
+
+ string errmsg;
+ sqlite_handle = sqlite_open (db_file, db_mode, out errmsg);
+
+ if (errmsg != null) {
+ throw new ApplicationException (errmsg);
+ }
+
+ state = ConnectionState.Open;
+ }
+
+ public void Close ()
+ {
+ if (state != ConnectionState.Open) {
+ return;
+ }
+
+ state = ConnectionState.Closed;
+
+ sqlite_close (sqlite_handle);
+ sqlite_handle = IntPtr.Zero;
+ }
+
+ public void ChangeDatabase (string databaseName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ public SqliteCommand CreateCommand ()
+ {
+ return new SqliteCommand (null, this);
+ }
+
+ public IDbTransaction BeginTransaction ()
+ {
+ return null;
+ }
+
+ public IDbTransaction BeginTransaction (IsolationLevel il)
+ {
+ return null;
+ }
+
+ internal void StartExec ()
+ {
+ // use a mutex here
+ state = ConnectionState.Executing;
+ }
+
+ internal void EndExec ()
+ {
+ state = ConnectionState.Open;
+ }
+
+ [DllImport("sqlite")]
+ static extern IntPtr sqlite_open (string dbname, int db_mode, out string errstr);
+
+ [DllImport("sqlite")]
+ static extern void sqlite_close (IntPtr sqlite_handle);
+ }
+}
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs
new file mode 100644
index 00000000000..6deb60d812f
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs
@@ -0,0 +1,364 @@
+// -*- c-basic-offset: 8; inent-tabs-mode: nil -*-
+//
+// SqliteDataReader.cs
+//
+// Author(s): Vladimir Vukicevic <vladimir@pobox.com>
+//
+// Copyright (C) 2002 Vladimir Vukicevic
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.SqliteClient
+{
+ public class SqliteDataReader : MarshalByRefObject,
+ IEnumerable, IDataReader, IDisposable, IDataRecord
+ {
+ SqliteCommand command;
+ ArrayList rows;
+ ArrayList columns;
+ Hashtable column_names;
+ int current_row;
+ bool closed;
+ bool reading;
+ int records_affected;
+
+ internal SqliteDataReader (SqliteCommand cmd)
+ {
+ command = cmd;
+ rows = new ArrayList ();
+ columns = new ArrayList ();
+ column_names = new Hashtable ();
+ closed = false;
+ current_row = -1;
+ reading = true;
+ }
+
+ internal void ReadingDone ()
+ {
+ records_affected = command.NumChanges ();
+ reading = false;
+ }
+
+ public void Close ()
+ {
+ closed = true;
+ }
+
+ public void Dispose ()
+ {
+ // nothing to do
+ }
+
+ IEnumerator IEnumerable.GetEnumerator () {
+ return new DbEnumerator (this);
+ }
+
+ public DataTable GetSchemaTable () {
+
+ // We sort of cheat here since sqlite treats all types as strings
+ // we -could- parse the table definition (since that's the only info
+ // that we can get out of sqlite about the table), but it's probably
+ // not worth it.
+
+ DataTable dataTableSchema = null;
+
+ DataColumn dc;
+ DataRow schemaRow;
+
+ // only create the schema DataTable if
+ // there is fields in a result set due
+ // to the result of a query; otherwise,
+ // a null needs to be returned
+ if(this.FieldCount > 0) {
+
+ dataTableSchema = new DataTable ();
+
+ dataTableSchema.Columns.Add ("ColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
+ dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
+ dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
+ dataTableSchema.Columns.Add ("NumericScale", typeof (int));
+ dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
+ dataTableSchema.Columns.Add ("IsKey", typeof (bool));
+ dc = dataTableSchema.Columns["IsKey"];
+ dc.AllowDBNull = true; // IsKey can have a DBNull
+ dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
+ dataTableSchema.Columns.Add ("DataType", typeof(Type));
+ dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
+ dataTableSchema.Columns.Add ("ProviderType", typeof (int));
+ dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
+ dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
+ dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
+ dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
+ dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
+ dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
+ dataTableSchema.Columns.Add ("IsLong", typeof (bool));
+ dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
+
+ for (int i = 0; i < this.FieldCount; i += 1 ) {
+
+ schemaRow = dataTableSchema.NewRow ();
+
+ schemaRow["ColumnName"] = columns[i];
+ schemaRow["ColumnOrdinal"] = i + 1;
+
+ // FIXME: how do you determine the column size
+ // using SQL Lite?
+ int columnSize = 8192; // pulled out of the air
+ schemaRow["ColumnSize"] = columnSize;
+ schemaRow["NumericPrecision"] = 0;
+ schemaRow["NumericScale"] = 0;
+
+ schemaRow["IsUnique"] = false;
+ schemaRow["IsKey"] = DBNull.Value;
+
+ schemaRow["BaseCatalogName"] = "";
+
+ schemaRow["BaseColumnName"] = columns[i];
+ schemaRow["BaseSchemaName"] = "";
+ schemaRow["BaseTableName"] = "";
+
+ // FIXME: don't know how to determine
+ // the .NET type based on the
+ // SQL Lite data type
+ // Use string
+ schemaRow["DataType"] = typeof(string);
+
+ schemaRow["AllowDBNull"] = true;
+
+ // FIXME: don't know how to get the
+ // SQL Lite data type
+ int providerType = 0; // out of the air
+ schemaRow["ProviderType"] = providerType;
+
+ schemaRow["IsAliased"] = false;
+ schemaRow["IsExpression"] = false;
+ schemaRow["IsIdentity"] = false;
+ schemaRow["IsAutoIncrement"] = false;
+ schemaRow["IsRowVersion"] = false;
+ schemaRow["IsHidden"] = false;
+ schemaRow["IsLong"] = false;
+ schemaRow["IsReadOnly"] = false;
+
+ schemaRow.AcceptChanges();
+
+ dataTableSchema.Rows.Add (schemaRow);
+ }
+ }
+ return dataTableSchema;
+ }
+
+ public bool NextResult ()
+ {
+ current_row++;
+ if (current_row < rows.Count)
+ return true;
+ return false;
+ }
+
+ public bool Read ()
+ {
+ return NextResult ();
+ }
+
+ public int Depth {
+ get {
+ return 0;
+ }
+ }
+
+ public bool IsClosed {
+ get {
+ return closed;
+ }
+ }
+
+ public int RecordsAffected {
+ get {
+ return records_affected;
+ }
+ }
+
+ // sqlite callback
+ internal unsafe int SqliteCallback (ref object o, int argc, sbyte **argv, sbyte **colnames)
+ {
+ // cache names of columns if we need to
+ if (column_names.Count == 0) {
+ for (int i = 0; i < argc; i++) {
+ string col = new String (colnames[i]);
+ columns.Add (col);
+ column_names[col.ToLower ()] = i++;
+ }
+ }
+
+ ArrayList data_row = new ArrayList (argc);
+ for (int i = 0; i < argc; i++) {
+ if (argv[i] != ((sbyte *)0)) {
+ data_row.Add(new String (argv[i]));
+ } else {
+ data_row.Add(null);
+ }
+ }
+ rows.Add (data_row);
+ return 0;
+ }
+
+ //
+ // IDataRecord getters
+ //
+
+ public bool GetBoolean (int i)
+ {
+ return Convert.ToBoolean ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public byte GetByte (int i)
+ {
+ return Convert.ToByte ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public long GetBytes (int i, long fieldOffset, byte[] buffer,
+ int bufferOffset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public char GetChar (int i)
+ {
+ return Convert.ToChar ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public long GetChars (int i, long fieldOffset, char[] buffer,
+ int bufferOffset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDataReader GetData (int i)
+ {
+ // sigh.. in the MSDN docs, it says that "This member supports the
+ // .NET Framework infrastructure and is not nitended to be used
+ // directly from your code." -- so why the hell is it in the public
+ // interface?
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int i)
+ {
+ return "text"; // SQL Lite data type
+ }
+
+ public DateTime GetDateTime (int i)
+ {
+ return Convert.ToDateTime ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public decimal GetDecimal (int i)
+ {
+ return Convert.ToDecimal ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public double GetDouble (int i)
+ {
+ return Convert.ToDouble ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public Type GetFieldType (int i)
+ {
+ return System.Type.GetType ("System.String"); // .NET data type
+ }
+
+ public float GetFloat (int i)
+ {
+ return Convert.ToSingle ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public Guid GetGuid (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public short GetInt16 (int i)
+ {
+ return Convert.ToInt16 ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public int GetInt32 (int i)
+ {
+ return Convert.ToInt32 ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public long GetInt64 (int i)
+ {
+ return Convert.ToInt64 ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public string GetName (int i)
+ {
+ return (string) columns[i];
+ }
+
+ public int GetOrdinal (string name)
+ {
+ return (int) column_names[name];
+ }
+
+ public string GetString (int i)
+ {
+ return ((string) ((ArrayList) rows[current_row])[i]);
+ }
+
+ public object GetValue (int i)
+ {
+ return ((ArrayList) rows[current_row])[i];
+ }
+
+ public int GetValues (object[] values)
+ {
+ int num_to_fill = Math.Min (values.Length, columns.Count);
+ for (int i = 0; i < num_to_fill; i++) {
+ if (((ArrayList) rows[current_row])[i] != null) {
+ values[i] = ((ArrayList) rows[current_row])[i];
+ } else {
+ values[i] = DBNull.Value;
+ }
+ }
+ return num_to_fill;
+ }
+
+ public bool IsDBNull (int i)
+ {
+ if (((ArrayList) rows[current_row])[i] == null)
+ return true;
+ return false;
+ }
+
+ public int FieldCount {
+ get {
+ if (current_row == -1 || current_row == rows.Count)
+ return 0;
+ return columns.Count;
+ }
+ }
+
+ public object this[string name] {
+ get {
+ return ((ArrayList) rows[current_row])[(int) column_names[name]];
+ }
+ }
+
+ public object this[int i] {
+ get {
+ return ((ArrayList) rows[current_row])[i];
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameter.cs b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameter.cs
new file mode 100644
index 00000000000..4d2bd80d39c
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameter.cs
@@ -0,0 +1,147 @@
+// -*- c-basic-offset: 8; inent-tabs-mode: nil -*-
+//
+// SqliteParameter.cs
+//
+// Author(s): Vladimir Vukicevic <vladimir@pobox.com>
+//
+// Copyright (C) 2002 Vladimir Vukicevic
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.SqliteClient
+{
+ public class SqliteParameter : IDbDataParameter
+ {
+ string name;
+ DbType type;
+ string source_column;
+ ParameterDirection direction;
+ DataRowVersion row_version;
+ object param_value;
+ byte precision;
+ byte scale;
+ int size;
+
+ public SqliteParameter ()
+ {
+ type = DbType.String;
+ direction = ParameterDirection.Input;
+ }
+
+ public SqliteParameter (string name_in, DbType type_in)
+ {
+ name = name_in;
+ type = type_in;
+ }
+
+ public SqliteParameter (string name_in, object param_value_in)
+ {
+ name = name_in;
+ type = DbType.String;
+ param_value = param_value_in;
+ direction = ParameterDirection.Input;
+ }
+
+ public SqliteParameter (string name_in, DbType type_in, int size_in)
+ : this (name_in, type_in)
+ {
+ size = size_in;
+ }
+
+ public SqliteParameter (string name_in, DbType type_in, int size, string src_column)
+ : this (name_in ,type_in)
+ {
+ source_column = src_column;
+ }
+
+ public DbType DbType {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+
+ public ParameterDirection Direction {
+ get {
+ return direction;
+ }
+ set {
+ direction = value;
+ }
+ }
+
+ public bool IsNullable {
+ get {
+ // uhh..
+ return true;
+ }
+ }
+
+ public string ParameterName {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ public string SourceColumn {
+ get {
+ return source_column;
+ }
+ set {
+ source_column = value;
+ }
+ }
+
+ public DataRowVersion SourceVersion {
+ get {
+ return row_version;
+ }
+ set {
+ row_version = value;
+ }
+ }
+
+ public object Value {
+ get {
+ return param_value;
+ }
+ set {
+ param_value = value;
+ }
+ }
+
+ public byte Precision {
+ get {
+ return precision;
+ }
+ set {
+ precision = value;
+ }
+ }
+
+ public byte Scale {
+ get {
+ return scale;
+ }
+ set {
+ scale = value;
+ }
+ }
+
+ public int Size {
+ get {
+ return size;
+ }
+ set {
+ size = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameterCollection.cs b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameterCollection.cs
new file mode 100644
index 00000000000..3e1893438ca
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteParameterCollection.cs
@@ -0,0 +1,223 @@
+// -*- c-basic-offset: 8; inent-tabs-mode: nil -*-
+//
+// SqliteParameterCollection.cs
+//
+// Author(s): Vladimir Vukicevic <vladimir@pobox.com>
+//
+// Copyright (C) 2002 Vladimir Vukicevic
+//
+
+using System;
+using System.Data;
+using System.Collections;
+
+namespace Mono.Data.SqliteClient
+{
+ public class SqliteParameterCollection : IDataParameterCollection,
+ IList
+ {
+ ArrayList numeric_param_list = new ArrayList ();
+ Hashtable named_param_hash = new Hashtable ();
+
+ public IEnumerator GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void RemoveAt (string parameterName)
+ {
+ if (!named_param_hash.Contains (parameterName))
+ throw new ApplicationException ("Parameter " + parameterName + " not found");
+
+ numeric_param_list.RemoveAt ((int) named_param_hash[parameterName]);
+ named_param_hash.Remove (parameterName);
+
+ RecreateNamedHash ();
+ }
+
+ public void RemoveAt (SqliteParameter param)
+ {
+ RemoveAt (param.ParameterName);
+ }
+
+ public void RemoveAt (int index)
+ {
+ RemoveAt (((SqliteParameter) numeric_param_list[index]).ParameterName);
+ }
+
+ int IList.IndexOf (object o)
+ {
+ return IndexOf ((SqliteParameter) o);
+ }
+
+ public int IndexOf (string parameterName)
+ {
+ return (int) named_param_hash[parameterName];
+ }
+
+ public int IndexOf (SqliteParameter param)
+ {
+ return IndexOf (param.ParameterName);
+ }
+
+ bool IList.Contains (object value)
+ {
+ return Contains ((SqliteParameter) value);
+ }
+
+ public bool Contains (string parameterName)
+ {
+ return named_param_hash.Contains (parameterName);
+ }
+
+ public bool Contains (SqliteParameter param)
+ {
+ return Contains (param.ParameterName);
+ }
+
+ object IList.this[int index] {
+ get {
+ return this[index];
+ }
+ set {
+ CheckSqliteParam (value);
+ this[index] = (SqliteParameter) value;
+ }
+ }
+
+ object IDataParameterCollection.this[string parameterName] {
+ get {
+ return this[parameterName];
+ }
+ set {
+ CheckSqliteParam (value);
+ this[parameterName] = (SqliteParameter) value;
+ }
+ }
+
+ public SqliteParameter this[string parameterName] {
+ get {
+ return this[(int) named_param_hash[parameterName]];
+ }
+ set {
+ if (this.Contains (parameterName))
+ numeric_param_list[(int) named_param_hash[parameterName]] = value;
+ else // uhm, do we add it if it doesn't exist? what does ms do?
+ Add (value);
+ }
+ }
+
+ public SqliteParameter this[int parameterIndex] {
+ get {
+ return (SqliteParameter) numeric_param_list[parameterIndex];
+ }
+ set {
+ numeric_param_list[parameterIndex] = value;
+ }
+ }
+
+ public int Add (object value)
+ {
+ CheckSqliteParam (value);
+ SqliteParameter sqlp = (SqliteParameter) value;
+ if (named_param_hash.Contains (sqlp.ParameterName))
+ throw new DuplicateNameException ("Parameter collection already contains given value.");
+
+ named_param_hash[value] = numeric_param_list.Add (value);
+
+ return (int) named_param_hash[value];
+ }
+
+ // IList
+
+ public SqliteParameter Add (SqliteParameter param)
+ {
+ Add (param);
+ return param;
+ }
+
+ public SqliteParameter Add (string name, object value)
+ {
+ return Add (new SqliteParameter (name, value));
+ }
+
+ public SqliteParameter Add (string name, DbType type)
+ {
+ return Add (new SqliteParameter (name, type));
+ }
+
+ public bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public void Clear ()
+ {
+ numeric_param_list.Clear ();
+ named_param_hash.Clear ();
+ }
+
+ public void Insert (int index, object value)
+ {
+ CheckSqliteParam (value);
+ if (numeric_param_list.Count == index) {
+ Add (value);
+ return;
+ }
+
+ numeric_param_list.Insert (index, value);
+ RecreateNamedHash ();
+ }
+
+ public void Remove (object value)
+ {
+ CheckSqliteParam (value);
+ RemoveAt ((SqliteParameter) value);
+ }
+
+ // ICollection
+
+ public int Count {
+ get {
+ return numeric_param_list.Count;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return null;
+ }
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ private void CheckSqliteParam (object value)
+ {
+ if (!(value is SqliteParameter))
+ throw new InvalidCastException ("Can only use SqliteParameter objects");
+ }
+
+ private void RecreateNamedHash ()
+ {
+ for (int i = 0; i < numeric_param_list.Count; i++) {
+ named_param_hash[((SqliteParameter) numeric_param_list[i]).ParameterName] = i;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SqliteClient/Test/.cvsignore b/mcs/class/Mono.Data.SqliteClient/Test/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Test/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/Mono.Data.SqliteClient/Test/SqliteTest.cs b/mcs/class/Mono.Data.SqliteClient/Test/SqliteTest.cs
new file mode 100644
index 00000000000..142da93ac93
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/Test/SqliteTest.cs
@@ -0,0 +1,90 @@
+//
+// SqliteTest.cs - Test for the Sqlite ADO.NET Provider in Mono.Data.SqliteClient
+// This provider works on Linux and Windows and uses the native
+// sqlite.dll or sqlite.so library.
+//
+// Modify or add to this test as needed...
+//
+// SQL Lite can be downloaded from
+// http://www.hwaci.com/sw/sqlite/download.html
+//
+// There are binaries for Windows and Linux.
+//
+// To compile:
+// mcs SqliteTest.cs -r System.Data.dll -r Mono.Data.SqliteClient.dll
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+
+using System;
+using System.Data;
+using Mono.Data.SqliteClient;
+
+namespace Test.Mono.Data.SqliteClient
+{
+ class SqliteTest
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("If this test works, you should get:");
+ Console.WriteLine("Data 1: 5");
+ Console.WriteLine("Data 2: Mono");
+
+ Console.WriteLine("create SqliteConnection...");
+ SqliteConnection dbcon = new SqliteConnection();
+
+ // the connection string is a URL that points
+ // to a file. If the file does not exist, a
+ // file is created.
+
+ // "URI=file:some/path"
+ string connectionString =
+ "URI=file:SqliteTest.db";
+ Console.WriteLine("setting ConnectionString using: " +
+ connectionString);
+ dbcon.ConnectionString = connectionString;
+
+ Console.WriteLine("open the connection...");
+ dbcon.Open();
+
+ Console.WriteLine("create SqliteCommand to CREATE TABLE MONO_TEST");
+ SqliteCommand dbcmd = new SqliteCommand();
+ dbcmd.Connection = dbcon;
+
+ dbcmd.CommandText =
+ "CREATE TABLE MONO_TEST ( " +
+ "NID INT, " +
+ "NDESC TEXT )";
+ Console.WriteLine("execute command...");
+ dbcmd.ExecuteNonQuery();
+
+ Console.WriteLine("set and execute command to INSERT INTO MONO_TEST");
+ dbcmd.CommandText =
+ "INSERT INTO MONO_TEST " +
+ "(NID, NDESC )"+
+ "VALUES(5,'Mono')";
+ dbcmd.ExecuteNonQuery();
+
+ Console.WriteLine("set command to SELECT FROM MONO_TEST");
+ dbcmd.CommandText =
+ "SELECT * FROM MONO_TEST";
+ SqliteDataReader reader;
+ Console.WriteLine("execute reader...");
+ reader = dbcmd.ExecuteReader();
+
+ Console.WriteLine("read and display data...");
+ while(reader.Read()) {
+ Console.WriteLine("Data 1: " + reader[0].ToString());
+ Console.WriteLine("Data 2: " + reader[1].ToString());
+ }
+ Console.WriteLine("clean up...");
+ reader.Close();
+ dbcmd.Dispose();
+ dbcon.Close();
+
+ Console.WriteLine("Done.");
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SqliteClient/makefile.gnu b/mcs/class/Mono.Data.SqliteClient/makefile.gnu
new file mode 100644
index 00000000000..84bdffc481c
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+#TEST_DIR = Test
+LIBRARY = $(topdir)/class/lib/Mono.Data.SqliteClient.dll
+
+LIB_LIST = sources.list
+LIB_FLAGS = --unsafe -r System.Data
+
+SOURCES_INCLUDE=*.cs
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.SqliteClient/sources.list b/mcs/class/Mono.Data.SqliteClient/sources.list
new file mode 100644
index 00000000000..b474137ca76
--- /dev/null
+++ b/mcs/class/Mono.Data.SqliteClient/sources.list
@@ -0,0 +1,5 @@
+Mono.Data.SqliteClient/SqliteCommand.cs
+Mono.Data.SqliteClient/SqliteConnection.cs
+Mono.Data.SqliteClient/SqliteDataReader.cs
+Mono.Data.SqliteClient/SqliteParameter.cs
+Mono.Data.SqliteClient/SqliteParameterCollection.cs
diff --git a/mcs/class/Mono.Data.SybaseClient/.cvsignore b/mcs/class/Mono.Data.SybaseClient/.cvsignore
new file mode 100644
index 00000000000..8744e149aac
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/.cvsignore
@@ -0,0 +1,3 @@
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Data.SybaseClient/ChangeLog b/mcs/class/Mono.Data.SybaseClient/ChangeLog
new file mode 100644
index 00000000000..1d23029b063
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/ChangeLog
@@ -0,0 +1,142 @@
+2002-12-01 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ Change to reflect TdsSchemaInfo -> TdsDataColumnCollection
+ shift.
+
+2002-11-26 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.SybaseClient.build:
+ Copy dll into Test directory.
+ * Mono.Data.SybaseClient/SybaseCommand.cs:
+ * Mono.Data.SybaseClient/SybaseConnection.cs:
+ * Mono.Data.SybaseClient/SybaseParameter.cs:
+ * Mono.Data.SybaseClient/SybaseParameterCollection.cs:
+ * Mono.Data.SybaseClient/SybaseTransaction.cs:
+ Many changes around making PREPAREs work in
+ Sybase as well as SQL Server.
+
+2002-11-21 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.SybaseClient.build:
+ * Mono.Data.SybaseClient/SybaseCommand.cs:
+ * Mono.Data.SybaseClient/SybaseConnection.cs:
+ * Mono.Data.SybaseClient/SybaseConnectionPool.cs:
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ * Mono.Data.SybaseClient/SybaseException.cs:
+ * Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs:
+ * Mono.Data.SybaseClient/SybaseParameter.cs:
+ * Mono.Data.SybaseClient/SybaseTransaction.cs:
+ * Mono.Data.SybaseTypes/SybaseDecimal.cs:
+ Modify to accept new Mono.Data.Tds.Protocol
+ namespace in Mono.Data.Tds assembly, replacing
+ Mono.Data.TdsClient.Internal
+
+2002-11-19 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.SybaseClient/SybaseCommand.cs:
+ Fix BuildExec to work.
+
+2002-11-18 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.SybaseClient/SybaseCommand.cs:
+ * Mono.Data.SybaseClient/SybaseConnection.cs:
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ * Mono.Data.SybaseClient/SybaseException.cs:
+ * Mono.Data.SybaseClient/SybaseParameter.cs:
+ * Mono.Data.SybaseClient/SybaseParameterCollection.cs:
+ * Mono.Data.SybaseClient/SybaseTransaction.cs:
+ * Mono.Data.SybaseTypes/SybaseDecimal.cs:
+ Various changes to overhaul Sybase provider,
+ and bring it closer to being in-line with
+ the SqlClient. Can now connect to Sybase DB.
+
+2002-11-14 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ Change SchemaTable handling
+
+2002-11-12 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Remove Mono.Data.TdsClient.Internal/TdsContext.cs
+
+2002-11-09 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add new internal tds classes
+ * Mono.Data.SybaseClient/SybaseConnectionPool.cs:
+ * Mono.Data.SybaseClient/SybaseConnection.cs:
+ Implement connection timeouts
+
+2002-11-04 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add Mono.Data.TdsClient.Internal.TdsInternalError
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorCollection
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventHandler
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventArgs
+ Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventHandler
+ Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventArgs
+ Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResult
+ Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResultCollection
+ Remove Mono.Data.TdsClient.Internal.TdsPacketMessageResult
+ * Mono.Data.SybaseClient/SybaseCommand.cs:
+ * Mono.Data.SybaseClient/SybaseConnection.cs:
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ * Mono.Data.SybaseClient/SybaseException.cs:
+ * Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs:
+ * Mono.Data.SybaseClient/SybaseTransaction.cs:
+ Remove error checks in favour of event handlers
+
+2002-11-04 Tim Coleman (tim@timcoleman.com)
+ * list :
+ Add Mono.Data.TdsClient.Internal.TdsBigDecimal
+
+2002-11-03 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add Mono.Data.TdsClient.Internal.TdsColumnStatus
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ Add more schema information
+
+2002-11-01 Tim Coleman (tim@timcoleman.com)
+ * Mono.Data.SybaseClient/Locale.cs:
+ * Mono.Data.SybaseClient/SybaseCommand.cs:
+ * Mono.Data.SybaseClient/SybaseCommandBuilder.cs:
+ * Mono.Data.SybaseClient/SybaseConnection.cs:
+ * Mono.Data.SybaseClient/SybaseConnectionPool.cs:
+ * Mono.Data.SybaseClient/SybaseDataAdapter.cs:
+ * Mono.Data.SybaseClient/SybaseDataReader.cs:
+ * Mono.Data.SybaseClient/SybaseError.cs:
+ * Mono.Data.SybaseClient/SybaseErrorCollection.cs:
+ * Mono.Data.SybaseClient/SybaseException.cs:
+ * Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs:
+ * Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs:
+ * Mono.Data.SybaseClient/SybaseParameter.cs:
+ * Mono.Data.SybaseClient/SybaseParameterCollection.cs:
+ * Mono.Data.SybaseClient/SybasePermission.cs:
+ * Mono.Data.SybaseClient/SybasePermissionAttribute.cs:
+ * Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs:
+ * Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs:
+ * Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs:
+ * Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs:
+ * Mono.Data.SybaseClient/SybaseTransaction.cs:
+ * Mono.Data.SybaseClient/SybaseType.cs:
+ * Mono.Data.SybaseClient/TODOAttribute.cs:
+ * Mono.Data.SybaseTypes/SybaseBinary.cs:
+ * Mono.Data.SybaseTypes/SybaseBoolean.cs:
+ * Mono.Data.SybaseTypes/SybaseByte.cs:
+ * Mono.Data.SybaseTypes/SybaseCompareOptions.cs:
+ * Mono.Data.SybaseTypes/SybaseDateTime.cs:
+ * Mono.Data.SybaseTypes/SybaseDecimal.cs:
+ * Mono.Data.SybaseTypes/SybaseDouble.cs:
+ * Mono.Data.SybaseTypes/SybaseGuid.cs:
+ * Mono.Data.SybaseTypes/SybaseInt16.cs:
+ * Mono.Data.SybaseTypes/SybaseInt32.cs:
+ * Mono.Data.SybaseTypes/SybaseInt64.cs:
+ * Mono.Data.SybaseTypes/SybaseMoney.cs:
+ * Mono.Data.SybaseTypes/SybaseNullValueException.cs:
+ * Mono.Data.SybaseTypes/SybaseSingle.cs:
+ * Mono.Data.SybaseTypes/SybaseString.cs:
+ * Mono.Data.SybaseTypes/SybaseTruncateException.cs:
+ * Mono.Data.SybaseTypes/SybaseTypeException.cs:
+ New classes added to start this namespace. These are mostly
+ just copies of the SqlClient classes, with changed names and
+ namespaces.
+ * list:
+ * makefile.gnu:
+ * Mono.Data.SybaseClient.build:
+ New files added to build this assembly
+ * ChangeLog:
+ New changelog added
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.build b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.build
new file mode 100644
index 00000000000..56b8311df16
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.build
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.SybaseClient.dll -->
+
+<project name="Mono.Data.SybaseClient" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.SybaseClient.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0679"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <arg value="/r:System.EnterpriseServices.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:../lib/Mono.Data.Tds.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ <includes name="../lib/System.EnterpriseServices.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/Mono.Data.Tds.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/Mono.Data.SybaseClient.dll" tofile="Test/Mono.Data.SybaseClient.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.Data.SybaseClient.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/Locale.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/Locale.cs
new file mode 100644
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs
new file mode 100644
index 00000000000..66cc5c14f17
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs
@@ -0,0 +1,379 @@
+//
+// Mono.Data.SybaseClient.SybaseCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002 http://www.ximian.com/
+// (C) Daniel Morgan, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseCommand : Component, IDbCommand, ICloneable
+ {
+ #region Fields
+
+ bool disposed = false;
+ int commandTimeout;
+ bool designTimeVisible;
+ string commandText;
+ CommandType commandType;
+ SybaseConnection connection;
+ SybaseTransaction transaction;
+ UpdateRowSource updatedRowSource;
+ CommandBehavior behavior = CommandBehavior.Default;
+ SybaseParameterCollection parameters;
+ string preparedStatement = null;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SybaseCommand()
+ : this (String.Empty, null, null)
+ {
+ }
+
+ public SybaseCommand (string commandText)
+ : this (commandText, null, null)
+ {
+ commandText = commandText;
+ }
+
+ public SybaseCommand (string commandText, SybaseConnection connection)
+ : this (commandText, connection, null)
+ {
+ Connection = connection;
+ }
+
+ public SybaseCommand (string commandText, SybaseConnection connection, SybaseTransaction transaction)
+ {
+ this.commandText = commandText;
+ this.connection = connection;
+ this.transaction = transaction;
+ this.commandType = CommandType.Text;
+ this.updatedRowSource = UpdateRowSource.Both;
+
+ this.designTimeVisible = false;
+ this.commandTimeout = 30;
+ parameters = new SybaseParameterCollection (this);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ internal CommandBehavior CommandBehavior {
+ get { return behavior; }
+ }
+
+ public string CommandText {
+ get { return commandText; }
+ set {
+ if (value != commandText && preparedStatement != null)
+ Unprepare ();
+ commandText = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get { return commandTimeout; }
+ set {
+ if (commandTimeout < 0)
+ throw new ArgumentException ("The property value assigned is less than 0.");
+ commandTimeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get { return commandType; }
+ set {
+ if (value == CommandType.TableDirect)
+ throw new ArgumentException ("CommandType.TableDirect is not supported by the Mono SybaseClient Data Provider.");
+ commandType = value;
+ }
+ }
+
+ public SybaseConnection Connection {
+ get { return connection; }
+ set {
+ if (transaction != null && connection.Transaction != null && connection.Transaction.IsOpen)
+ throw new InvalidOperationException ("The Connection property was changed while a transaction was in progress.");
+ transaction = null;
+ connection = value;
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get { return designTimeVisible; }
+ set { designTimeVisible = value; }
+ }
+
+ public SybaseParameterCollection Parameters {
+ get { return parameters; }
+ }
+
+ internal ITds Tds {
+ get { return Connection.Tds; }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get { return Connection; }
+ set {
+ if (!(value is SybaseConnection))
+ throw new InvalidCastException ("The value was not a valid SybaseConnection.");
+ Connection = (SybaseConnection) value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get { return Parameters; }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get { return Transaction; }
+ set {
+ if (!(value is SybaseTransaction))
+ throw new ArgumentException ();
+ Transaction = (SybaseTransaction) value;
+ }
+ }
+
+ public SybaseTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
+ }
+
+ public UpdateRowSource UpdatedRowSource {
+ get { return updatedRowSource; }
+ set { updatedRowSource = value; }
+ }
+
+ #endregion // Fields
+
+ #region Methods
+
+ public void Cancel ()
+ {
+ if (Connection == null || Connection.Tds == null)
+ return;
+ Connection.Tds.Cancel ();
+ }
+
+ internal void CloseDataReader (bool moreResults)
+ {
+ GetOutputParameters ();
+ Connection.DataReader = null;
+
+ if ((behavior & CommandBehavior.CloseConnection) != 0)
+ Connection.Close ();
+ }
+
+ public SybaseParameter CreateParameter ()
+ {
+ return new SybaseParameter ();
+ }
+
+ internal void DeriveParameters ()
+ {
+ if (commandType != CommandType.StoredProcedure)
+ throw new InvalidOperationException (String.Format ("SybaseCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType));
+ ValidateCommand ("DeriveParameters");
+
+ SybaseParameterCollection localParameters = new SybaseParameterCollection (this);
+ localParameters.Add ("@P1", SybaseType.NVarChar, commandText.Length).Value = commandText;
+
+ string sql = "sp_procedure_params_rowset";
+
+ Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true);
+
+ SybaseDataReader reader = new SybaseDataReader (this);
+ parameters.Clear ();
+ object[] dbValues = new object[reader.FieldCount];
+
+ while (reader.Read ()) {
+ reader.GetValues (dbValues);
+ parameters.Add (new SybaseParameter (dbValues));
+ }
+ reader.Close ();
+ }
+
+ private void Execute (CommandBehavior behavior, bool wantResults)
+ {
+ TdsMetaParameterCollection parms = Parameters.MetaParameters;
+ if (preparedStatement == null) {
+ bool schemaOnly = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
+ bool keyInfo = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
+
+ StringBuilder sql1 = new StringBuilder ();
+ StringBuilder sql2 = new StringBuilder ();
+
+ if (schemaOnly || keyInfo)
+ sql1.Append ("SET FMTONLY OFF;");
+ if (keyInfo) {
+ sql1.Append ("SET NO_BROWSETABLE ON;");
+ sql2.Append ("SET NO_BROWSETABLE OFF;");
+ }
+ if (schemaOnly) {
+ sql1.Append ("SET FMTONLY ON;");
+ sql2.Append ("SET FMTONLY OFF;");
+ }
+
+ switch (CommandType) {
+ case CommandType.StoredProcedure:
+ if (keyInfo || schemaOnly)
+ Connection.Tds.Execute (sql1.ToString ());
+ Connection.Tds.ExecProc (CommandText, parms, CommandTimeout, wantResults);
+ if (keyInfo || schemaOnly)
+ Connection.Tds.Execute (sql2.ToString ());
+ break;
+ case CommandType.Text:
+ string sql = String.Format ("{0}{1}{2}", sql1.ToString (), CommandText, sql2.ToString ());
+ Connection.Tds.Execute (sql, parms, CommandTimeout, wantResults);
+ break;
+ }
+ }
+ else
+ Connection.Tds.ExecPrepared (preparedStatement, parms, CommandTimeout, wantResults);
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ ValidateCommand ("ExecuteNonQuery");
+ int result = 0;
+
+ try {
+ Execute (CommandBehavior.Default, false);
+ }
+ catch (TdsTimeoutException e) {
+ throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ GetOutputParameters ();
+ return result;
+ }
+
+ public SybaseDataReader ExecuteReader ()
+ {
+ return ExecuteReader (CommandBehavior.Default);
+ }
+
+ public SybaseDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ ValidateCommand ("ExecuteReader");
+ try {
+ Execute (behavior, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
+ }
+ Connection.DataReader = new SybaseDataReader (this);
+ return Connection.DataReader;
+ }
+
+ public object ExecuteScalar ()
+ {
+ ValidateCommand ("ExecuteScalar");
+ try {
+ Execute (CommandBehavior.Default, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ if (!Connection.Tds.NextResult () || !Connection.Tds.NextRow ())
+ return null;
+
+ object result = Connection.Tds.ColumnValues [0];
+ CloseDataReader (true);
+ return result;
+ }
+
+ private void GetOutputParameters ()
+ {
+ Connection.Tds.SkipToEnd ();
+
+ IList list = Connection.Tds.ColumnValues;
+
+ if (list != null && list.Count > 0) {
+ int index = 0;
+ foreach (SybaseParameter parameter in parameters) {
+ if (parameter.Direction != ParameterDirection.Input) {
+ parameter.Value = list [index];
+ index += 1;
+ }
+ if (index >= list.Count)
+ break;
+ }
+ }
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new SybaseCommand (commandText, Connection);
+ }
+
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ return ExecuteReader ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+ {
+ return ExecuteReader (behavior);
+ }
+
+ public void Prepare ()
+ {
+ ValidateCommand ("Prepare");
+ if (CommandType == CommandType.Text)
+ preparedStatement = Connection.Tds.Prepare (CommandText, Parameters.MetaParameters);
+ }
+
+ public void ResetCommandTimeout ()
+ {
+ commandTimeout = 30;
+ }
+
+ private void Unprepare ()
+ {
+ Connection.Tds.Unprepare (preparedStatement);
+ preparedStatement = null;
+ }
+
+ private void ValidateCommand (string method)
+ {
+ if (Connection == null)
+ throw new InvalidOperationException (String.Format ("{0} requires a Connection object to continue.", method));
+ if (Connection.Transaction != null && transaction != Connection.Transaction)
+ throw new InvalidOperationException ("The Connection object does not have the same transaction as the command object.");
+ if (Connection.State != ConnectionState.Open)
+ throw new InvalidOperationException (String.Format ("ExecuteNonQuery requires an open Connection object to continue. This connection is closed.", method));
+ if (commandText == String.Empty || commandText == null)
+ throw new InvalidOperationException ("The command text for this Command has not been set.");
+ if (Connection.DataReader != null)
+ throw new InvalidOperationException ("There is already an open DataReader associated with this Connection which must be closed first.");
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs
new file mode 100644
index 00000000000..e4ae234bcfd
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs
@@ -0,0 +1,94 @@
+//
+// Mono.Data.SybaseClient.SybaseCommandBuilder.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.ComponentModel;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseCommandBuilder : Component
+ {
+ #region Constructors
+
+ [MonoTODO]
+ public SybaseCommandBuilder()
+ {
+ }
+
+ [MonoTODO]
+ public SybaseCommandBuilder(SybaseDataAdapter adapter)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [MonoTODO]
+ public SybaseDataAdapter DataAdapter {
+ get { throw new NotImplementedException (); }
+ set{ throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string QuotePrefix {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string QuoteSuffix {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public static void DeriveParameters (SybaseCommand command)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SybaseCommand GetDeleteCommand()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SybaseCommand GetInsertCommand()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SybaseCommand GetUpdateCommand()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshSchema()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
new file mode 100644
index 00000000000..08a88e73666
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
@@ -0,0 +1,518 @@
+//
+// Mono.Data.SybaseClient.SybaseConnection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.EnterpriseServices;
+using System.Net;
+using System.Text;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseConnection : Component, IDbConnection, ICloneable
+ {
+ #region Fields
+ bool disposed = false;
+
+ // The set of SQL connection pools
+ static Hashtable SybaseConnectionPools = new Hashtable ();
+
+ // The current connection pool
+ SybaseConnectionPool pool;
+
+ // The connection string that identifies this connection
+ string connectionString = null;
+
+ // The transaction object for the current transaction
+ SybaseTransaction transaction = null;
+
+ // Connection parameters
+ TdsConnectionParameters parms = new TdsConnectionParameters ();
+ bool connectionReset;
+ bool pooling;
+ string dataSource;
+ int connectionTimeout;
+ int minPoolSize;
+ int maxPoolSize;
+ int packetSize;
+ int port = 1533;
+
+ // The current state
+ ConnectionState state = ConnectionState.Closed;
+
+ SybaseDataReader dataReader = null;
+
+ // The TDS object
+ ITds tds;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SybaseConnection ()
+ : this (String.Empty)
+ {
+ }
+
+ public SybaseConnection (string connectionString)
+ {
+ ConnectionString = connectionString;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string ConnectionString {
+ get { return connectionString; }
+ set { SetConnectionString (value); }
+ }
+
+ public int ConnectionTimeout {
+ get { return connectionTimeout; }
+ }
+
+ public string Database {
+ get { return tds.Database; }
+ }
+
+ internal SybaseDataReader DataReader {
+ get { return dataReader; }
+ set { dataReader = value; }
+ }
+
+ public string DataSource {
+ get { return dataSource; }
+ }
+
+ public int PacketSize {
+ get { return packetSize; }
+ }
+
+ public string ServerVersion {
+ get { return tds.ServerVersion; }
+ }
+
+ public ConnectionState State {
+ get { return state; }
+ }
+
+ internal ITds Tds {
+ get { return tds; }
+ }
+
+ internal SybaseTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
+ }
+
+ public string WorkstationId {
+ get { return parms.Hostname; }
+ }
+
+ #endregion // Properties
+
+ #region Events and Delegates
+
+ public event SybaseInfoMessageEventHandler InfoMessage;
+ public event StateChangeEventHandler StateChange;
+
+ private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
+ {
+ throw new SybaseException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SybaseClient Data Provider", e.State);
+ }
+
+ private void MessageHandler (object sender, TdsInternalInfoMessageEventArgs e)
+ {
+ OnSybaseInfoMessage (CreateSybaseInfoMessageEvent (e.Errors));
+ }
+
+ #endregion // Events and Delegates
+
+ #region Methods
+
+ public SybaseTransaction BeginTransaction ()
+ {
+ return BeginTransaction (IsolationLevel.ReadCommitted, String.Empty);
+ }
+
+ public SybaseTransaction BeginTransaction (IsolationLevel iso)
+ {
+ return BeginTransaction (iso, String.Empty);
+ }
+
+ public SybaseTransaction BeginTransaction (string transactionName)
+ {
+ return BeginTransaction (IsolationLevel.ReadCommitted, transactionName);
+ }
+
+ public SybaseTransaction BeginTransaction (IsolationLevel iso, string transactionName)
+ {
+ if (State == ConnectionState.Closed)
+ throw new InvalidOperationException ("The connection is not open.");
+ if (Transaction != null)
+ throw new InvalidOperationException ("SybaseConnection does not support parallel transactions.");
+
+ string isolevel = String.Empty;
+ switch (iso) {
+ case IsolationLevel.Chaos:
+ isolevel = "CHAOS";
+ break;
+ case IsolationLevel.ReadCommitted:
+ isolevel = "READ COMMITTED";
+ break;
+ case IsolationLevel.ReadUncommitted:
+ isolevel = "READ UNCOMMITTED";
+ break;
+ case IsolationLevel.RepeatableRead:
+ isolevel = "REPEATABLE READ";
+ break;
+ case IsolationLevel.Serializable:
+ isolevel = "SERIALIZABLE";
+ break;
+ }
+
+ tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0}\nBEGIN TRANSACTION {1}", isolevel, transactionName));
+ transaction = new SybaseTransaction (this, iso);
+ return transaction;
+ }
+
+ public void ChangeDatabase (string database)
+ {
+ if (!IsValidDatabaseName (database))
+ throw new ArgumentException (String.Format ("The database name {0} is not valid."));
+ if (State != ConnectionState.Open)
+ throw new InvalidOperationException ("The connection is not open");
+ tds.Execute (String.Format ("use {0}", database));
+ }
+
+ private void ChangeState (ConnectionState currentState)
+ {
+ ConnectionState originalState = state;
+ state = currentState;
+ OnStateChange (CreateStateChangeEvent (originalState, currentState));
+ }
+
+ public void Close ()
+ {
+ if (Transaction != null && Transaction.IsOpen)
+ Transaction.Rollback ();
+ if (pooling)
+ pool.ReleaseConnection (tds);
+ else
+ tds.Disconnect ();
+ tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler (ErrorHandler);
+ tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler (MessageHandler);
+ ChangeState (ConnectionState.Closed);
+ }
+
+ public SybaseCommand CreateCommand ()
+ {
+ SybaseCommand command = new SybaseCommand ();
+ command.Connection = this;
+ return command;
+ }
+
+ private StateChangeEventArgs CreateStateChangeEvent (ConnectionState originalState, ConnectionState currentState)
+ {
+ return new StateChangeEventArgs (originalState, currentState);
+ }
+
+ private SybaseInfoMessageEventArgs CreateSybaseInfoMessageEvent (TdsInternalErrorCollection errors)
+ {
+ return new SybaseInfoMessageEventArgs (errors);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ if (State == ConnectionState.Open)
+ Close ();
+ parms = null;
+ dataSource = null;
+ }
+ base.Dispose (disposing);
+ disposed = true;
+ }
+ }
+
+ [MonoTODO]
+ public void EnlistDistributedTransaction (ITransaction transaction)
+ {
+ throw new NotImplementedException ();
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new SybaseConnection (ConnectionString);
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel iso)
+ {
+ return BeginTransaction (iso);
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ [MonoTODO ("Figure out the Sybase way to reset the connection.")]
+ public void Open ()
+ {
+ if (connectionString == null)
+ throw new InvalidOperationException ("Connection string has not been initialized.");
+
+ try {
+ if (!pooling)
+ tds = new Tds50 (DataSource, port, PacketSize, ConnectionTimeout);
+ else {
+ pool = (SybaseConnectionPool) SybaseConnectionPools [connectionString];
+ if (pool == null) {
+ pool = new SybaseConnectionPool (dataSource, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
+ SybaseConnectionPools [connectionString] = pool;
+ }
+ tds = pool.AllocateConnection ();
+ }
+ }
+ catch (TdsTimeoutException e) {
+ throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ tds.TdsErrorMessage += new TdsInternalErrorMessageEventHandler (ErrorHandler);
+ tds.TdsInfoMessage += new TdsInternalInfoMessageEventHandler (MessageHandler);
+
+ if (!tds.IsConnected) {
+ tds.Connect (parms);
+ ChangeState (ConnectionState.Open);
+ ChangeDatabase (parms.Database);
+ }
+ else if (connectionReset) {
+ // tds.ExecuteNonQuery ("EXEC sp_reset_connection"); FIXME
+ ChangeState (ConnectionState.Open);
+ }
+ }
+
+ void SetConnectionString (string connectionString)
+ {
+ connectionString += ";";
+ NameValueCollection parameters = new NameValueCollection ();
+
+ if (connectionString == String.Empty)
+ return;
+
+ bool inQuote = false;
+ bool inDQuote = false;
+
+ string name = String.Empty;
+ string value = String.Empty;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in connectionString)
+ {
+ switch (c) {
+ case '\'':
+ inQuote = !inQuote;
+ break;
+ case '"' :
+ inDQuote = !inDQuote;
+ break;
+ case ';' :
+ if (!inDQuote && !inQuote) {
+ if (name != String.Empty && name != null) {
+ value = sb.ToString ();
+ parameters [name.ToUpper ().Trim ()] = value.Trim ();
+ }
+ name = String.Empty;
+ value = String.Empty;
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ case '=' :
+ if (!inDQuote && !inQuote) {
+ name = sb.ToString ();
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ default:
+ sb.Append (c);
+ break;
+ }
+ }
+
+ if (this.ConnectionString == null)
+ {
+ SetDefaultConnectionParameters (parameters);
+ }
+
+ SetProperties (parameters);
+
+ this.connectionString = connectionString;
+ }
+
+ void SetDefaultConnectionParameters (NameValueCollection parameters)
+ {
+ if (null == parameters.Get ("APPLICATION NAME"))
+ parameters["APPLICATION NAME"] = ".Net SybaseClient Data Provider";
+ if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT"))
+ parameters["CONNECT TIMEOUT"] = "15";
+ if (null == parameters.Get ("CONNECTION LIFETIME"))
+ parameters["CONNECTION LIFETIME"] = "0";
+ if (null == parameters.Get ("CONNECTION RESET"))
+ parameters["CONNECTION RESET"] = "true";
+ if (null == parameters.Get ("ENLIST"))
+ parameters["ENLIST"] = "true";
+ if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
+ parameters["INTEGRATED SECURITY"] = "false";
+ if (null == parameters.Get ("MAX POOL SIZE"))
+ parameters["MAX POOL SIZE"] = "100";
+ if (null == parameters.Get ("MIN POOL SIZE"))
+ parameters["MIN POOL SIZE"] = "0";
+ if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
+ parameters["NETWORK LIBRARY"] = "dbmssocn";
+ if (null == parameters.Get ("PACKET SIZE"))
+ parameters["PACKET SIZE"] = "512";
+ if (null == parameters.Get ("PERSIST SECURITY INFO"))
+ parameters["PERSIST SECURITY INFO"] = "false";
+ if (null == parameters.Get ("POOLING"))
+ parameters["POOLING"] = "true";
+ if (null == parameters.Get ("WORKSTATION ID"))
+ parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
+ }
+
+ private void SetProperties (NameValueCollection parameters)
+ {
+ string value;
+ foreach (string name in parameters) {
+ value = parameters[name];
+
+ switch (name) {
+ case "APPLICATION NAME" :
+ parms.ApplicationName = value;
+ break;
+ case "ATTACHDBFILENAME" :
+ case "EXTENDED PROPERTIES" :
+ case "INITIAL FILE NAME" :
+ break;
+ case "CONNECT TIMEOUT" :
+ case "CONNECTION TIMEOUT" :
+ connectionTimeout = Int32.Parse (value);
+ break;
+ case "CONNECTION LIFETIME" :
+ break;
+ case "CONNECTION RESET" :
+ connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
+ break;
+ case "CURRENT LANGUAGE" :
+ parms.Language = value;
+ break;
+ case "DATA SOURCE" :
+ case "SERVER" :
+ case "ADDRESS" :
+ case "ADDR" :
+ case "NETWORK ADDRESS" :
+ dataSource = value;
+ break;
+ case "ENLIST" :
+ break;
+ case "INITIAL CATALOG" :
+ case "DATABASE" :
+ parms.Database = value;
+ break;
+ case "INTEGRATED SECURITY" :
+ case "TRUSTED_CONNECTION" :
+ break;
+ case "MAX POOL SIZE" :
+ maxPoolSize = Int32.Parse (value);
+ break;
+ case "MIN POOL SIZE" :
+ minPoolSize = Int32.Parse (value);
+ break;
+ case "NET" :
+ case "NETWORK LIBRARY" :
+ if (!value.ToUpper ().Equals ("DBMSSOCN"))
+ throw new ArgumentException ("Unsupported network library.");
+ break;
+ case "PACKET SIZE" :
+ packetSize = Int32.Parse (value);
+ break;
+ case "PASSWORD" :
+ case "PWD" :
+ parms.Password = value;
+ break;
+ case "PERSIST SECURITY INFO" :
+ break;
+ case "POOLING" :
+ pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
+ break;
+ case "USER ID" :
+ parms.User = value;
+ break;
+ case "WORKSTATION ID" :
+ parms.Hostname = value;
+ break;
+ }
+ }
+ }
+
+
+ static bool IsValidDatabaseName (string database)
+ {
+ if (database.Length > 32 || database.Length < 1)
+ return false;
+
+ if (database[0] == '"' && database[database.Length] == '"')
+ database = database.Substring (1, database.Length - 2);
+ else if (Char.IsDigit (database[0]))
+ return false;
+
+ if (database[0] == '_')
+ return false;
+
+ foreach (char c in database.Substring (1, database.Length - 1))
+ if (!Char.IsLetterOrDigit (c) && c != '_')
+ return false;
+ return true;
+ }
+
+ private void OnSybaseInfoMessage (SybaseInfoMessageEventArgs value)
+ {
+ if (InfoMessage != null)
+ InfoMessage (this, value);
+ }
+
+ private void OnStateChange (StateChangeEventArgs value)
+ {
+ if (StateChange != null)
+ StateChange (this, value);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionPool.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionPool.cs
new file mode 100644
index 00000000000..8f6760815b8
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionPool.cs
@@ -0,0 +1,167 @@
+//
+// Mono.Data.SybaseClient.SybaseConnectionPool.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Threading;
+
+namespace Mono.Data.SybaseClient {
+ internal class SybaseConnectionPool : MarshalByRefObject, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ int maxSize;
+ int minSize;
+ int packetSize;
+ int port;
+ int timeout;
+
+ string dataSource;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SybaseConnectionPool (string dataSource, int port, int packetSize, int timeout, int minSize, int maxSize)
+ {
+ this.dataSource = dataSource;
+ this.port = port;
+ this.packetSize = packetSize;
+ this.timeout = timeout;
+ this.minSize = minSize;
+ this.maxSize = maxSize;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ITds this[int index] {
+ get { return (ITds) list[index]; }
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set { throw new InvalidOperationException (); }
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return true; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public int MaxSize {
+ get { return maxSize; }
+ }
+
+ public int MinSize {
+ get { return minSize; }
+ }
+
+ public object SyncRoot {
+ get { throw new InvalidOperationException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object o)
+ {
+ return list.Add ((ITds) o);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object o)
+ {
+ return list.Contains ((ITds) o);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public ITds AllocateConnection ()
+ {
+ // make sure we have the minimum count (really only useful the first time)
+ lock (list) {
+ for (int i = Count; i < minSize; i += 1)
+ Add (new Tds50 (dataSource, port, packetSize, timeout));
+ }
+
+ // Try to obtain a lock
+ foreach (object o in list)
+ if (Monitor.TryEnter (o))
+ return (ITds) o;
+
+ if (Count < maxSize) {
+ ITds tds = new Tds50 (dataSource, port, packetSize, timeout);
+ Monitor.Enter (tds);
+ Add (tds);
+ return tds;
+ }
+
+ // else we have to wait for one to be available
+
+ return null;
+ }
+
+ public void ReleaseConnection (ITds tds)
+ {
+ Monitor.Exit (tds);
+ }
+
+ public int IndexOf (object o)
+ {
+ return list.IndexOf ((ITds) o);
+ }
+
+ public void Insert (int index, object o)
+ {
+ list.Insert (index, (ITds) o);
+ }
+
+ public void Remove (object o)
+ {
+ list.Remove ((ITds) o);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs
new file mode 100644
index 00000000000..3e8399b0b20
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs
@@ -0,0 +1,166 @@
+//
+// Mono.Data.SybaseClient.SybaseDataAdapter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ SybaseCommand deleteCommand;
+ SybaseCommand insertCommand;
+ SybaseCommand selectCommand;
+ SybaseCommand updateCommand;
+
+ static readonly object EventRowUpdated = new object();
+ static readonly object EventRowUpdating = new object();
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseDataAdapter ()
+ : this (new SybaseCommand ())
+ {
+ }
+
+ public SybaseDataAdapter (SybaseCommand selectCommand)
+ {
+ DeleteCommand = new SybaseCommand ();
+ InsertCommand = new SybaseCommand ();
+ SelectCommand = selectCommand;
+ UpdateCommand = new SybaseCommand ();
+ }
+
+ public SybaseDataAdapter (string selectCommandText, SybaseConnection selectConnection)
+ : this (new SybaseCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public SybaseDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new SybaseConnection (selectConnectionString))
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public SybaseCommand DeleteCommand {
+ get { return deleteCommand; }
+ set { deleteCommand = value; }
+ }
+
+ public SybaseCommand InsertCommand {
+ get { return insertCommand; }
+ set { insertCommand = value; }
+ }
+
+ public SybaseCommand SelectCommand {
+ get { return selectCommand; }
+ set { selectCommand = value; }
+ }
+
+ public SybaseCommand UpdateCommand {
+ get { return updateCommand; }
+ set { updateCommand = value; }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is SybaseCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (SybaseCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is SybaseCommand))
+ throw new ArgumentException ();
+ InsertCommand = (SybaseCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is SybaseCommand))
+ throw new ArgumentException ();
+ SelectCommand = (SybaseCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is SybaseCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (SybaseCommand)value;
+ }
+ }
+
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new SybaseRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new SybaseRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ SybaseRowUpdatedEventHandler handler = (SybaseRowUpdatedEventHandler) Events[EventRowUpdated];
+ if ((handler != null) && (value is SybaseRowUpdatedEventArgs))
+ handler(this, (SybaseRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ SybaseRowUpdatingEventHandler handler = (SybaseRowUpdatingEventHandler) Events[EventRowUpdating];
+ if ((handler != null) && (value is SybaseRowUpdatingEventArgs))
+ handler(this, (SybaseRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event SybaseRowUpdatedEventHandler RowUpdated {
+ add { Events.AddHandler (EventRowUpdated, value); }
+ remove { Events.RemoveHandler (EventRowUpdated, value); }
+ }
+
+ public event SybaseRowUpdatingEventHandler RowUpdating {
+ add { Events.AddHandler (EventRowUpdating, value); }
+ remove { Events.RemoveHandler (EventRowUpdating, value); }
+ }
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs
new file mode 100644
index 00000000000..9d333db6e24
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs
@@ -0,0 +1,748 @@
+//
+// Mono.Data.SybaseClient.SybaseDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseTypes;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
+ {
+ #region Fields
+
+ SybaseCommand command;
+ ArrayList dataTypeNames;
+ bool disposed = false;
+ int fieldCount;
+ bool isClosed;
+ bool isSelect;
+ bool moreResults;
+ int resultsRead;
+ int rowsRead;
+ DataTable schemaTable;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SybaseDataReader (SybaseCommand command)
+ {
+ this.command = command;
+ schemaTable = ConstructSchemaTable ();
+ resultsRead = 0;
+ fieldCount = 0;
+ isClosed = false;
+ isSelect = (command.CommandText.Trim ().ToUpper ().StartsWith ("SELECT"));
+ command.Tds.RecordsAffected = 0;
+ NextResult ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Depth {
+ get { return 0; }
+ }
+
+ public int FieldCount {
+ get { return fieldCount; }
+ }
+
+ public bool IsClosed {
+ get { return isClosed; }
+ }
+
+ public object this [int i] {
+ get { return GetValue (i); }
+ }
+
+ public object this [string name] {
+ get { return GetValue (GetOrdinal (name)); }
+ }
+
+ public int RecordsAffected {
+ get {
+ if (isSelect)
+ return -1;
+ else
+ return command.Tds.RecordsAffected;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Close ()
+ {
+ isClosed = true;
+ command.CloseDataReader (moreResults);
+ }
+
+ private static DataTable ConstructSchemaTable ()
+ {
+ Type booleanType = Type.GetType ("System.Boolean");
+ Type stringType = Type.GetType ("System.String");
+ Type intType = Type.GetType ("System.Int32");
+ Type typeType = Type.GetType ("System.Type");
+ Type shortType = Type.GetType ("System.Int16");
+
+ DataTable schemaTable = new DataTable ("SchemaTable");
+ schemaTable.Columns.Add ("ColumnName", stringType);
+ schemaTable.Columns.Add ("ColumnOrdinal", intType);
+ schemaTable.Columns.Add ("ColumnSize", intType);
+ schemaTable.Columns.Add ("NumericPrecision", shortType);
+ schemaTable.Columns.Add ("NumericScale", shortType);
+ schemaTable.Columns.Add ("IsUnique", booleanType);
+ schemaTable.Columns.Add ("IsKey", booleanType);
+ schemaTable.Columns.Add ("BaseServerName", stringType);
+ schemaTable.Columns.Add ("BaseCatalogName", stringType);
+ schemaTable.Columns.Add ("BaseColumnName", stringType);
+ schemaTable.Columns.Add ("BaseSchemaName", stringType);
+ schemaTable.Columns.Add ("BaseTableName", stringType);
+ schemaTable.Columns.Add ("DataType", typeType);
+ schemaTable.Columns.Add ("AllowDBNull", booleanType);
+ schemaTable.Columns.Add ("ProviderType", intType);
+ schemaTable.Columns.Add ("IsAliased", booleanType);
+ schemaTable.Columns.Add ("IsExpression", booleanType);
+ schemaTable.Columns.Add ("IsIdentity", booleanType);
+ schemaTable.Columns.Add ("IsAutoIncrement", booleanType);
+ schemaTable.Columns.Add ("IsRowVersion", booleanType);
+ schemaTable.Columns.Add ("IsHidden", booleanType);
+ schemaTable.Columns.Add ("IsLong", booleanType);
+ schemaTable.Columns.Add ("IsReadOnly", booleanType);
+
+ return schemaTable;
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ schemaTable.Dispose ();
+ Close ();
+ }
+ disposed = true;
+ }
+ }
+
+ public bool GetBoolean (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is bool))
+ throw new InvalidCastException ();
+ return (bool) value;
+ }
+
+ public byte GetByte (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is byte))
+ throw new InvalidCastException ();
+ return (byte) value;
+ }
+
+ public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ object value = GetValue (i);
+ if (!(value is byte []))
+ throw new InvalidCastException ();
+ Array.Copy ((byte []) value, (int) dataIndex, buffer, bufferIndex, length);
+ return ((byte []) value).Length - dataIndex;
+ }
+
+ public char GetChar (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is char))
+ throw new InvalidCastException ();
+ return (char) value;
+ }
+
+ public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ object value = GetValue (i);
+ if (!(value is char[]))
+ throw new InvalidCastException ();
+ Array.Copy ((char []) value, (int) dataIndex, buffer, bufferIndex, length);
+ return ((char []) value).Length - dataIndex;
+ }
+
+ [MonoTODO ("Implement GetData")]
+ public IDataReader GetData (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int i)
+ {
+ return (string) dataTypeNames [i];
+ }
+
+ public DateTime GetDateTime (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is DateTime))
+ throw new InvalidCastException ();
+ return (DateTime) value;
+ }
+
+ public decimal GetDecimal (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is decimal))
+ throw new InvalidCastException ();
+ return (decimal) value;
+ }
+
+ public double GetDouble (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is double))
+ throw new InvalidCastException ();
+ return (double) value;
+ }
+
+ public Type GetFieldType (int i)
+ {
+ return (Type) schemaTable.Rows[i]["DataType"];
+ }
+
+ public float GetFloat (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is float))
+ throw new InvalidCastException ();
+ return (float) value;
+ }
+
+ public Guid GetGuid (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is Guid))
+ throw new InvalidCastException ();
+ return (Guid) value;
+ }
+
+ public short GetInt16 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is short))
+ throw new InvalidCastException ();
+ return (short) value;
+ }
+
+ public int GetInt32 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is int))
+ throw new InvalidCastException ();
+ return (int) value;
+ }
+
+ public long GetInt64 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is long))
+ throw new InvalidCastException ();
+ return (long) value;
+ }
+
+ public string GetName (int i)
+ {
+ return (string) schemaTable.Rows[i]["ColumnName"];
+ }
+
+ public int GetOrdinal (string name)
+ {
+ foreach (DataRow schemaRow in schemaTable.Rows)
+ if (((string) schemaRow ["ColumnName"]).Equals (name))
+ return (int) schemaRow ["ColumnOrdinal"];
+ foreach (DataRow schemaRow in schemaTable.Rows)
+ if (String.Compare (((string) schemaRow ["ColumnName"]), name, true) == 0)
+ return (int) schemaRow ["ColumnOrdinal"];
+ throw new IndexOutOfRangeException ();
+ }
+
+ public DataTable GetSchemaTable ()
+ {
+ if (schemaTable.Rows != null && schemaTable.Rows.Count > 0)
+ return schemaTable;
+
+ if (!moreResults)
+ return null;
+
+ fieldCount = 0;
+
+ dataTypeNames = new ArrayList ();
+
+ foreach (TdsDataColumn schema in command.Tds.Columns) {
+ DataRow row = schemaTable.NewRow ();
+
+ row ["ColumnName"] = GetSchemaValue (schema, "ColumnName");
+ row ["ColumnSize"] = GetSchemaValue (schema, "ColumnSize");
+ row ["ColumnOrdinal"] = GetSchemaValue (schema, "ColumnOrdinal");
+ row ["NumericPrecision"] = GetSchemaValue (schema, "NumericPrecision");
+ row ["NumericScale"] = GetSchemaValue (schema, "NumericScale");
+ row ["IsUnique"] = GetSchemaValue (schema, "IsUnique");
+ row ["IsKey"] = GetSchemaValue (schema, "IsKey");
+ row ["BaseServerName"] = GetSchemaValue (schema, "BaseServerName");
+ row ["BaseCatalogName"] = GetSchemaValue (schema, "BaseCatalogName");
+ row ["BaseColumnName"] = GetSchemaValue (schema, "BaseColumnName");
+ row ["BaseSchemaName"] = GetSchemaValue (schema, "BaseSchemaName");
+ row ["BaseTableName"] = GetSchemaValue (schema, "BaseTableName");
+ row ["AllowDBNull"] = GetSchemaValue (schema, "AllowDBNull");
+ row ["IsAliased"] = GetSchemaValue (schema, "IsAliased");
+ row ["IsExpression"] = GetSchemaValue (schema, "IsExpression");
+ row ["IsIdentity"] = GetSchemaValue (schema, "IsIdentity");
+ row ["IsAutoIncrement"] = GetSchemaValue (schema, "IsAutoIncrement");
+ row ["IsRowVersion"] = GetSchemaValue (schema, "IsRowVersion");
+ row ["IsHidden"] = GetSchemaValue (schema, "IsHidden");
+ row ["IsReadOnly"] = GetSchemaValue (schema, "IsReadOnly");
+
+ // We don't always get the base column name.
+ if (row ["BaseColumnName"] == DBNull.Value)
+ row ["BaseColumnName"] = row ["ColumnName"];
+
+ switch ((TdsColumnType) schema ["ColumnType"]) {
+ case TdsColumnType.Image :
+ dataTypeNames.Add ("image");
+ row ["ProviderType"] = (int) SybaseType.Image;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.Text :
+ dataTypeNames.Add ("text");
+ row ["ProviderType"] = (int) SybaseType.Text;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.UniqueIdentifier :
+ dataTypeNames.Add ("uniqueidentifier");
+ row ["ProviderType"] = (int) SybaseType.UniqueIdentifier;
+ row ["DataType"] = typeof (Guid);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.VarBinary :
+ case TdsColumnType.BigVarBinary :
+ dataTypeNames.Add ("varbinary");
+ row ["ProviderType"] = (int) SybaseType.VarBinary;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.IntN :
+ case TdsColumnType.Int4 :
+ dataTypeNames.Add ("int");
+ row ["ProviderType"] = (int) SybaseType.Int;
+ row ["DataType"] = typeof (int);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.VarChar :
+ case TdsColumnType.BigVarChar :
+ dataTypeNames.Add ("varchar");
+ row ["ProviderType"] = (int) SybaseType.VarChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Binary :
+ case TdsColumnType.BigBinary :
+ dataTypeNames.Add ("binary");
+ row ["ProviderType"] = (int) SybaseType.Binary;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.Char :
+ case TdsColumnType.BigChar :
+ dataTypeNames.Add ("char");
+ row ["ProviderType"] = (int) SybaseType.Char;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Int1 :
+ dataTypeNames.Add ("tinyint");
+ row ["ProviderType"] = (int) SybaseType.TinyInt;
+ row ["DataType"] = typeof (byte);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Bit :
+ case TdsColumnType.BitN :
+ dataTypeNames.Add ("bit");
+ row ["ProviderType"] = (int) SybaseType.Bit;
+ row ["DataType"] = typeof (bool);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Int2 :
+ dataTypeNames.Add ("smallint");
+ row ["ProviderType"] = (int) SybaseType.SmallInt;
+ row ["DataType"] = typeof (short);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.DateTime4 :
+ case TdsColumnType.DateTime :
+ case TdsColumnType.DateTimeN :
+ dataTypeNames.Add ("datetime");
+ row ["ProviderType"] = (int) SybaseType.DateTime;
+ row ["DataType"] = typeof (DateTime);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Real :
+ dataTypeNames.Add ("real");
+ row ["ProviderType"] = (int) SybaseType.Real;
+ row ["DataType"] = typeof (float);
+ break;
+ case TdsColumnType.Money :
+ case TdsColumnType.MoneyN :
+ case TdsColumnType.Money4 :
+ dataTypeNames.Add ("money");
+ row ["ProviderType"] = (int) SybaseType.Money;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Float8 :
+ case TdsColumnType.FloatN :
+ dataTypeNames.Add ("float");
+ row ["ProviderType"] = (int) SybaseType.Float;
+ row ["DataType"] = typeof (double);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.NText :
+ dataTypeNames.Add ("ntext");
+ row ["ProviderType"] = (int) SybaseType.NText;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.NVarChar :
+ dataTypeNames.Add ("nvarchar");
+ row ["ProviderType"] = (int) SybaseType.NVarChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Decimal :
+ case TdsColumnType.Numeric :
+ dataTypeNames.Add ("decimal");
+ row ["ProviderType"] = (int) SybaseType.Decimal;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.NChar :
+ dataTypeNames.Add ("nchar");
+ row ["ProviderType"] = (int) SybaseType.NChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.SmallMoney :
+ dataTypeNames.Add ("smallmoney");
+ row ["ProviderType"] = (int) SybaseType.SmallMoney;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ default :
+ dataTypeNames.Add ("variant");
+ row ["ProviderType"] = (int) SybaseType.Variant;
+ row ["DataType"] = typeof (object);
+ row ["IsLong"] = false;
+ break;
+ }
+
+ schemaTable.Rows.Add (row);
+
+ fieldCount += 1;
+ }
+ return schemaTable;
+ }
+
+ private static object GetSchemaValue (TdsDataColumn schema, object key)
+ {
+ if (schema.ContainsKey (key) && schema [key] != null)
+ return schema [key];
+ return DBNull.Value;
+ }
+
+ public SybaseBinary GetSybaseBinary (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public SybaseBoolean GetSybaseBoolean (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseBoolean))
+ throw new InvalidCastException ();
+ return (SybaseBoolean) value;
+ }
+
+ public SybaseByte GetSybaseByte (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseByte))
+ throw new InvalidCastException ();
+ return (SybaseByte) value;
+ }
+
+ public SybaseDateTime GetSybaseDateTime (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseDateTime))
+ throw new InvalidCastException ();
+ return (SybaseDateTime) value;
+ }
+
+ public SybaseDecimal GetSybaseDecimal (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseDecimal))
+ throw new InvalidCastException ();
+ return (SybaseDecimal) value;
+ }
+
+ public SybaseDouble GetSybaseDouble (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseDouble))
+ throw new InvalidCastException ();
+ return (SybaseDouble) value;
+ }
+
+ public SybaseGuid GetSybaseGuid (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseGuid))
+ throw new InvalidCastException ();
+ return (SybaseGuid) value;
+ }
+
+ public SybaseInt16 GetSybaseInt16 (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseInt16))
+ throw new InvalidCastException ();
+ return (SybaseInt16) value;
+ }
+
+ public SybaseInt32 GetSybaseInt32 (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseInt32))
+ throw new InvalidCastException ();
+ return (SybaseInt32) value;
+ }
+
+ public SybaseInt64 GetSybaseInt64 (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseInt64))
+ throw new InvalidCastException ();
+ return (SybaseInt64) value;
+ }
+
+ public SybaseMoney GetSybaseMoney (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseMoney))
+ throw new InvalidCastException ();
+ return (SybaseMoney) value;
+ }
+
+ public SybaseSingle GetSybaseSingle (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseSingle))
+ throw new InvalidCastException ();
+ return (SybaseSingle) value;
+ }
+
+ public SybaseString GetSybaseString (int i)
+ {
+ object value = GetSybaseValue (i);
+ if (!(value is SybaseString))
+ throw new InvalidCastException ();
+ return (SybaseString) value;
+ }
+
+ [MonoTODO ("Implement TdsBigDecimal conversion. SybaseType.Real fails tests?")]
+ public object GetSybaseValue (int i)
+ {
+ SybaseType type = (SybaseType) (schemaTable.Rows [i]["ProviderType"]);
+ object value = GetValue (i);
+
+ switch (type) {
+ case SybaseType.BigInt:
+ if (value == null)
+ return SybaseInt64.Null;
+ return (SybaseInt64) ((long) value);
+ case SybaseType.Binary:
+ case SybaseType.Image:
+ case SybaseType.VarBinary:
+ case SybaseType.Timestamp:
+ if (value == null)
+ return SybaseBinary.Null;
+ return (SybaseBinary) ((byte[]) value);
+ case SybaseType.Bit:
+ if (value == null)
+ return SybaseBoolean.Null;
+ return (SybaseBoolean) ((bool) value);
+ case SybaseType.Char:
+ case SybaseType.NChar:
+ case SybaseType.NText:
+ case SybaseType.NVarChar:
+ case SybaseType.Text:
+ case SybaseType.VarChar:
+ if (value == null)
+ return SybaseString.Null;
+ return (SybaseString) ((string) value);
+ case SybaseType.DateTime:
+ case SybaseType.SmallDateTime:
+ if (value == null)
+ return SybaseDateTime.Null;
+ return (SybaseDateTime) ((DateTime) value);
+ case SybaseType.Decimal:
+ if (value == null)
+ return SybaseDecimal.Null;
+ if (value is TdsBigDecimal)
+ return SybaseDecimal.FromTdsBigDecimal ((TdsBigDecimal) value);
+ return (SybaseDecimal) ((decimal) value);
+ case SybaseType.Float:
+ if (value == null)
+ return SybaseDouble.Null;
+ return (SybaseDouble) ((double) value);
+ case SybaseType.Int:
+ if (value == null)
+ return SybaseInt32.Null;
+ return (SybaseInt32) ((int) value);
+ case SybaseType.Money:
+ case SybaseType.SmallMoney:
+ if (value == null)
+ return SybaseMoney.Null;
+ return (SybaseMoney) ((decimal) value);
+ case SybaseType.Real:
+ if (value == null)
+ return SybaseSingle.Null;
+ return (SybaseSingle) ((float) value);
+ case SybaseType.UniqueIdentifier:
+ if (value == null)
+ return SybaseGuid.Null;
+ return (SybaseGuid) ((Guid) value);
+ case SybaseType.SmallInt:
+ if (value == null)
+ return SybaseInt16.Null;
+ return (SybaseInt16) ((short) value);
+ case SybaseType.TinyInt:
+ if (value == null)
+ return SybaseByte.Null;
+ return (SybaseByte) ((byte) value);
+ }
+
+ throw new InvalidOperationException ("The type of this column is unknown.");
+ }
+
+ public int GetSybaseValues (object[] values)
+ {
+ int count = 0;
+ int columnCount = schemaTable.Rows.Count;
+ int arrayCount = values.Length;
+
+ if (arrayCount > columnCount)
+ count = columnCount;
+ else
+ count = arrayCount;
+
+ for (int i = 0; i < count; i += 1)
+ values [i] = GetSybaseValue (i);
+
+ return count;
+ }
+
+ public string GetString (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is string))
+ throw new InvalidCastException ();
+ return (string) value;
+ }
+
+ public object GetValue (int i)
+ {
+ return command.Tds.ColumnValues [i];
+ }
+
+ public int GetValues (object[] values)
+ {
+ int len = values.Length;
+ int bigDecimalIndex = command.Tds.ColumnValues.BigDecimalIndex;
+
+ // If a four-byte decimal is stored, then we can't convert to
+ // a native type. Throw an OverflowException.
+ if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
+ throw new OverflowException ();
+
+ command.Tds.ColumnValues.CopyTo (0, values, 0, len);
+ return (len > FieldCount ? len : FieldCount);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new DbEnumerator (this);
+ }
+
+ public bool IsDBNull (int i)
+ {
+ return GetValue (i) == null;
+ }
+
+ public bool NextResult ()
+ {
+ if ((command.CommandBehavior & CommandBehavior.SingleResult) != 0 && resultsRead > 0)
+ return false;
+ if (command.Tds.DoneProc)
+ return false;
+
+ schemaTable.Rows.Clear ();
+
+ moreResults = command.Tds.NextResult ();
+ GetSchemaTable ();
+
+ rowsRead = 0;
+ resultsRead += 1;
+ return moreResults;
+ }
+
+ public bool Read ()
+ {
+ if ((command.CommandBehavior & CommandBehavior.SingleRow) != 0 && rowsRead > 0)
+ return false;
+ if ((command.CommandBehavior & CommandBehavior.SchemaOnly) != 0)
+ return false;
+ if (!moreResults)
+ return false;
+
+ bool result = command.Tds.NextRow ();
+
+ rowsRead += 1;
+
+ return result;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs
new file mode 100644
index 00000000000..d85d4478cd1
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs
@@ -0,0 +1,139 @@
+//
+// Mono.Data.SybaseClient.SybaseError.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.SybaseClient {
+ [MonoTODO]
+ public sealed class SybaseError
+ {
+ #region Fields
+
+ byte theClass = 0;
+ int lineNumber = 0;
+ string message = "";
+ int number = 0;
+ string procedure = "";
+ string server = "";
+ string source = "";
+ byte state = 0;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SybaseError(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [MonoTODO]
+ public byte Class {
+ get { return theClass; }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ [MonoTODO]
+ public string Message {
+ get { return message; }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get { return number; }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get { return procedure; }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get { return server; }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get { return source; }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get { return state; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetClass (byte theClass) {
+ this.theClass = theClass;
+ }
+
+ internal void SetLineNumber (int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ internal void SetMessage (string message) {
+ this.message = message;
+ }
+
+ internal void SetNumber (int number) {
+ this.number = number;
+ }
+
+ internal void SetProcedure (string procedure) {
+ this.procedure = procedure;
+ }
+
+ internal void SetServer (string server) {
+ this.server = server;
+ }
+
+ internal void SetSource (string source) {
+ this.source = source;
+ }
+
+ internal void SetState (byte state) {
+ this.state = state;
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ String toStr;
+ String stackTrace;
+ stackTrace = " <Stack Trace>";
+ // FIXME: generate the correct SQL error string
+ toStr = "SybaseError:" + message + stackTrace;
+ return toStr;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs
new file mode 100644
index 00000000000..03457725673
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs
@@ -0,0 +1,88 @@
+//
+// Mono.Data.SybaseClient.SybaseErrorCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+using System;
+using System.Collections;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace Mono.Data.SybaseClient {
+ [MonoTODO]
+ public sealed class SybaseErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SybaseErrorCollection () {
+ }
+
+ internal SybaseErrorCollection (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ Add (theClass, lineNumber, message, number, procedure, server, source, state);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+ get { throw new NotImplementedException (); }
+ }
+
+ public SybaseError this[int index]
+ {
+ get { return (SybaseError) list[index]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void Add(SybaseError error)
+ {
+ list.Add(error);
+ }
+
+ internal void Add(byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ SybaseError error = new SybaseError(theClass, lineNumber, message, number, procedure, server, source, state);
+ Add(error);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs
new file mode 100644
index 00000000000..94db7800b92
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs
@@ -0,0 +1,105 @@
+//
+// Mono.Data.SybaseClient.SybaseException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace Mono.Data.SybaseClient {
+ [Serializable]
+ public sealed class SybaseException : SystemException
+ {
+ #region Fields
+
+ SybaseErrorCollection errors;
+
+ #endregion Fields
+
+ #region Constructors
+
+ internal SybaseException ()
+ : base ("a SQL Exception has occurred.")
+ {
+ errors = new SybaseErrorCollection();
+ }
+
+ internal SybaseException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ : base (message)
+ {
+ errors = new SybaseErrorCollection (theClass, lineNumber, message, number, procedure, server, source, state);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte Class {
+ get { return errors [0].Class; }
+ }
+
+ public SybaseErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public int LineNumber {
+ get { return errors [0].LineNumber; }
+ }
+
+ public override string Message {
+ get {
+ StringBuilder result = new StringBuilder ();
+ foreach (SybaseError error in Errors) {
+ if (result.Length > 0)
+ result.Append ('\n');
+ result.Append (error.Message);
+ }
+ return result.ToString ();
+ }
+ }
+
+ public int Number {
+ get { return errors [0].Number; }
+ }
+
+ public string Procedure {
+ get { return errors [0].Procedure; }
+ }
+
+ public string Server {
+ get { return errors [0].Server; }
+ }
+
+ public override string Source {
+ get { return errors [0].Source; }
+ }
+
+ public byte State {
+ get { return errors [0].State; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal static SybaseException FromTdsInternalException (TdsInternalException e)
+ {
+ return new SybaseException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SybaseClient Data Provider", e.State);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..022bd0bb95a
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs
@@ -0,0 +1,58 @@
+//
+// Mono.Data.SybaseClient.SybaseInfoMessageEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseInfoMessageEventArgs : EventArgs
+ {
+ #region Fields
+
+ SybaseErrorCollection errors = new SybaseErrorCollection ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SybaseInfoMessageEventArgs (TdsInternalErrorCollection tdsErrors)
+ {
+ foreach (TdsInternalError e in tdsErrors)
+ errors.Add (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SybaseClient Data Provider", e.State);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SybaseErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public string Message {
+ get { return errors[0].Message; }
+ }
+
+ public string Source {
+ get { return errors[0].Source; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override string ToString ()
+ {
+ return Message;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..4bf74398406
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// Mono.Data.SybaseClient.SybaseInfoMessageEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.SybaseClient {
+ public delegate void SybaseInfoMessageEventHandler (object sender, SybaseInfoMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs
new file mode 100644
index 00000000000..d4a72964fb1
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs
@@ -0,0 +1,557 @@
+//
+// Mono.Data.SybaseClient.SybaseParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+ {
+ #region Fields
+
+ TdsMetaParameter metaParameter;
+
+ SybaseParameterCollection container = null;
+ DbType dbType;
+ ParameterDirection direction = ParameterDirection.Input;
+ bool isNullable;
+ bool isSizeSet = false;
+ bool isTypeSet = false;
+ int offset;
+ SybaseType sybaseType;
+ string sourceColumn;
+ DataRowVersion sourceVersion;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SybaseParameter ()
+ : this (String.Empty, SybaseType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public SybaseParameter (string parameterName, object value)
+ {
+ metaParameter = new TdsMetaParameter (parameterName, value);
+ this.sourceVersion = DataRowVersion.Current;
+ InferSybaseType (value);
+ }
+
+ public SybaseParameter (string parameterName, SybaseType dbType)
+ : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public SybaseParameter (string parameterName, SybaseType dbType, int size)
+ : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public SybaseParameter (string parameterName, SybaseType dbType, int size, string sourceColumn)
+ : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null)
+ {
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public SybaseParameter (string parameterName, SybaseType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value)
+ {
+ metaParameter = new TdsMetaParameter (parameterName, size, isNullable, precision, scale, value);
+
+ SybaseType = dbType;
+ Direction = direction;
+ SourceColumn = sourceColumn;
+ SourceVersion = sourceVersion;
+ }
+
+ // This constructor is used internally to construct a
+ // SybaseParameter. The value array comes from sp_procedure_params_rowset.
+ // This is in SybaseCommand.DeriveParameters.
+ internal SybaseParameter (object[] dbValues)
+ {
+ Precision = 0;
+ Scale = 0;
+ Direction = ParameterDirection.Input;
+
+ ParameterName = (string) dbValues[3];
+
+ switch ((short) dbValues[5]) {
+ case 1:
+ Direction = ParameterDirection.Input;
+ break;
+ case 2:
+ Direction = ParameterDirection.Output;
+ break;
+ case 3:
+ Direction = ParameterDirection.InputOutput;
+ break;
+ case 4:
+ Direction = ParameterDirection.ReturnValue;
+ break;
+ }
+
+ IsNullable = (bool) dbValues[8];
+
+ if (dbValues[12] != null)
+ Precision = (byte) ((short) dbValues[12]);
+ if (dbValues[13] != null)
+ Scale = (byte) ((short) dbValues[13]);
+
+ SetDbTypeName ((string) dbValues[16]);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ // Used to ensure that only one collection can contain this
+ // parameter
+ internal SybaseParameterCollection Container {
+ get { return container; }
+ set { container = value; }
+ }
+
+ public DbType DbType {
+ get { return dbType; }
+ set {
+ SetDbType (value);
+ isTypeSet = true;
+ }
+ }
+
+ public ParameterDirection Direction {
+ get { return direction; }
+ set {
+ direction = value;
+ if (direction == ParameterDirection.Output)
+ MetaParameter.Direction = TdsParameterDirection.Output;
+ }
+ }
+
+ internal TdsMetaParameter MetaParameter {
+ get { return metaParameter; }
+ }
+
+ string IDataParameter.ParameterName {
+ get { return metaParameter.ParameterName; }
+ set { metaParameter.ParameterName = value; }
+ }
+
+ public bool IsNullable {
+ get { return metaParameter.IsNullable; }
+ set { metaParameter.IsNullable = value; }
+ }
+
+ public int Offset {
+ get { return offset; }
+ set { offset = value; }
+ }
+
+ public string ParameterName {
+ get { return metaParameter.ParameterName; }
+ set { metaParameter.ParameterName = value; }
+ }
+
+ public byte Precision {
+ get { return metaParameter.Precision; }
+ set { metaParameter.Precision = value; }
+ }
+
+ public byte Scale {
+ get { return metaParameter.Scale; }
+ set { metaParameter.Scale = value; }
+ }
+
+ public int Size {
+ get { return metaParameter.Size; }
+ set { metaParameter.Size = value; }
+ }
+
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
+ }
+
+ public DataRowVersion SourceVersion {
+ get { return sourceVersion; }
+ set { sourceVersion = value; }
+ }
+
+ public SybaseType SybaseType {
+ get { return sybaseType; }
+ set {
+ SetSybaseType (value);
+ isTypeSet = true;
+ }
+ }
+
+ public object Value {
+ get { return metaParameter.Value; }
+ set {
+ if (!isTypeSet)
+ InferSybaseType (value);
+ metaParameter.Value = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ object ICloneable.Clone ()
+ {
+ return new SybaseParameter (ParameterName, SybaseType, Size, Direction, IsNullable, Precision, Scale, SourceColumn, SourceVersion, Value);
+ }
+
+ // If the value is set without the DbType/SybaseType being set, then we
+ // infer type information.
+ private void InferSybaseType (object value)
+ {
+ Type type = value.GetType ();
+
+ string exception = String.Format ("The parameter data type of {0} is invalid.", type.Name);
+
+ switch (type.FullName) {
+ case "System.Int64":
+ SetSybaseType (SybaseType.BigInt);
+ break;
+ case "System.Boolean":
+ SetSybaseType (SybaseType.Bit);
+ break;
+ case "System.String":
+ SetSybaseType (SybaseType.NVarChar);
+ break;
+ case "System.DateTime":
+ SetSybaseType (SybaseType.DateTime);
+ break;
+ case "System.Decimal":
+ SetSybaseType (SybaseType.Decimal);
+ break;
+ case "System.Double":
+ SetSybaseType (SybaseType.Float);
+ break;
+ case "System.Byte[]":
+ SetSybaseType (SybaseType.VarBinary);
+ break;
+ case "System.Byte":
+ SetSybaseType (SybaseType.TinyInt);
+ break;
+ case "System.Int32":
+ SetSybaseType (SybaseType.Int);
+ break;
+ case "System.Single":
+ SetSybaseType (SybaseType.Real);
+ break;
+ case "System.Int16":
+ SetSybaseType (SybaseType.SmallInt);
+ break;
+ case "System.Guid":
+ SetSybaseType (SybaseType.UniqueIdentifier);
+ break;
+ case "System.Object":
+ SetSybaseType (SybaseType.Variant);
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ }
+
+ // When the DbType is set, we also set the SybaseType, as well as the SQL Server
+ // string representation of the type name. If the DbType is not convertible
+ // to an SybaseType, throw an exception.
+ private void SetDbType (DbType type)
+ {
+ string exception = String.Format ("No mapping exists from DbType {0} to a known SybaseType.", type);
+
+ switch (type) {
+ case DbType.AnsiString:
+ MetaParameter.TypeName = "varchar";
+ sybaseType = SybaseType.VarChar;
+ break;
+ case DbType.AnsiStringFixedLength:
+ MetaParameter.TypeName = "char";
+ sybaseType = SybaseType.Char;
+ break;
+ case DbType.Binary:
+ MetaParameter.TypeName = "varbinary";
+ sybaseType = SybaseType.VarBinary;
+ break;
+ case DbType.Boolean:
+ MetaParameter.TypeName = "bit";
+ sybaseType = SybaseType.Bit;
+ break;
+ case DbType.Byte:
+ MetaParameter.TypeName = "tinyint";
+ sybaseType = SybaseType.TinyInt;
+ break;
+ case DbType.Currency:
+ sybaseType = SybaseType.Money;
+ MetaParameter.TypeName = "money";
+ break;
+ case DbType.Date:
+ case DbType.DateTime:
+ MetaParameter.TypeName = "datetime";
+ sybaseType = SybaseType.DateTime;
+ break;
+ case DbType.Decimal:
+ MetaParameter.TypeName = "decimal";
+ sybaseType = SybaseType.Decimal;
+ break;
+ case DbType.Double:
+ MetaParameter.TypeName = "float";
+ sybaseType = SybaseType.Float;
+ break;
+ case DbType.Guid:
+ MetaParameter.TypeName = "uniqueidentifier";
+ sybaseType = SybaseType.UniqueIdentifier;
+ break;
+ case DbType.Int16:
+ MetaParameter.TypeName = "smallint";
+ sybaseType = SybaseType.SmallInt;
+ break;
+ case DbType.Int32:
+ MetaParameter.TypeName = "int";
+ sybaseType = SybaseType.Int;
+ break;
+ case DbType.Int64:
+ MetaParameter.TypeName = "bigint";
+ sybaseType = SybaseType.BigInt;
+ break;
+ case DbType.Object:
+ MetaParameter.TypeName = "sql_variant";
+ sybaseType = SybaseType.Variant;
+ break;
+ case DbType.Single:
+ MetaParameter.TypeName = "real";
+ sybaseType = SybaseType.Real;
+ break;
+ case DbType.String:
+ MetaParameter.TypeName = "nvarchar";
+ sybaseType = SybaseType.NVarChar;
+ break;
+ case DbType.StringFixedLength:
+ MetaParameter.TypeName = "nchar";
+ sybaseType = SybaseType.NChar;
+ break;
+ case DbType.Time:
+ MetaParameter.TypeName = "datetime";
+ sybaseType = SybaseType.DateTime;
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ dbType = type;
+ }
+
+ // Used by internal constructor which has a SQL Server typename
+ private void SetDbTypeName (string dbTypeName)
+ {
+ switch (dbTypeName.ToLower ()) {
+ case "bigint":
+ SybaseType = SybaseType.BigInt;
+ break;
+ case "binary":
+ SybaseType = SybaseType.Binary;
+ break;
+ case "bit":
+ SybaseType = SybaseType.Bit;
+ break;
+ case "char":
+ SybaseType = SybaseType.Char;
+ break;
+ case "datetime":
+ SybaseType = SybaseType.DateTime;
+ break;
+ case "decimal":
+ SybaseType = SybaseType.Decimal;
+ break;
+ case "float":
+ SybaseType = SybaseType.Float;
+ break;
+ case "image":
+ SybaseType = SybaseType.Image;
+ break;
+ case "int":
+ SybaseType = SybaseType.Int;
+ break;
+ case "money":
+ SybaseType = SybaseType.Money;
+ break;
+ case "nchar":
+ SybaseType = SybaseType.NChar;
+ break;
+ case "ntext":
+ SybaseType = SybaseType.NText;
+ break;
+ case "nvarchar":
+ SybaseType = SybaseType.NVarChar;
+ break;
+ case "real":
+ SybaseType = SybaseType.Real;
+ break;
+ case "smalldatetime":
+ SybaseType = SybaseType.SmallDateTime;
+ break;
+ case "smallint":
+ SybaseType = SybaseType.SmallInt;
+ break;
+ case "smallmoney":
+ SybaseType = SybaseType.SmallMoney;
+ break;
+ case "text":
+ SybaseType = SybaseType.Text;
+ break;
+ case "timestamp":
+ SybaseType = SybaseType.Timestamp;
+ break;
+ case "tinyint":
+ SybaseType = SybaseType.TinyInt;
+ break;
+ case "uniqueidentifier":
+ SybaseType = SybaseType.UniqueIdentifier;
+ break;
+ case "varbinary":
+ SybaseType = SybaseType.VarBinary;
+ break;
+ case "varchar":
+ SybaseType = SybaseType.VarChar;
+ break;
+ default:
+ SybaseType = SybaseType.Variant;
+ break;
+ }
+ }
+
+ // When the SybaseType is set, we also set the DbType, as well as the SQL Server
+ // string representation of the type name. If the SybaseType is not convertible
+ // to a DbType, throw an exception.
+ private void SetSybaseType (SybaseType type)
+ {
+ string exception = String.Format ("No mapping exists from SybaseType {0} to a known DbType.", type);
+
+ switch (type) {
+ case SybaseType.BigInt:
+ MetaParameter.TypeName = "bigint";
+ dbType = DbType.Int64;
+ break;
+ case SybaseType.Binary:
+ MetaParameter.TypeName = "binary";
+ dbType = DbType.Binary;
+ break;
+ case SybaseType.Timestamp:
+ MetaParameter.TypeName = "timestamp";
+ dbType = DbType.Binary;
+ break;
+ case SybaseType.VarBinary:
+ MetaParameter.TypeName = "varbinary";
+ dbType = DbType.Binary;
+ break;
+ case SybaseType.Bit:
+ MetaParameter.TypeName = "bit";
+ dbType = DbType.Boolean;
+ break;
+ case SybaseType.Char:
+ MetaParameter.TypeName = "char";
+ dbType = DbType.AnsiStringFixedLength;
+ break;
+ case SybaseType.DateTime:
+ MetaParameter.TypeName = "datetime";
+ dbType = DbType.DateTime;
+ break;
+ case SybaseType.SmallDateTime:
+ MetaParameter.TypeName = "smalldatetime";
+ dbType = DbType.DateTime;
+ break;
+ case SybaseType.Decimal:
+ MetaParameter.TypeName = "decimal";
+ dbType = DbType.Decimal;
+ break;
+ case SybaseType.Float:
+ MetaParameter.TypeName = "float";
+ dbType = DbType.Double;
+ break;
+ case SybaseType.Image:
+ MetaParameter.TypeName = "image";
+ dbType = DbType.Binary;
+ break;
+ case SybaseType.Int:
+ MetaParameter.TypeName = "int";
+ dbType = DbType.Int32;
+ break;
+ case SybaseType.Money:
+ MetaParameter.TypeName = "money";
+ dbType = DbType.Currency;
+ break;
+ case SybaseType.SmallMoney:
+ MetaParameter.TypeName = "smallmoney";
+ dbType = DbType.Currency;
+ break;
+ case SybaseType.NChar:
+ MetaParameter.TypeName = "nchar";
+ dbType = DbType.StringFixedLength;
+ break;
+ case SybaseType.NText:
+ MetaParameter.TypeName = "ntext";
+ dbType = DbType.String;
+ break;
+ case SybaseType.NVarChar:
+ MetaParameter.TypeName = "nvarchar";
+ dbType = DbType.String;
+ break;
+ case SybaseType.Real:
+ MetaParameter.TypeName = "real";
+ dbType = DbType.Single;
+ break;
+ case SybaseType.SmallInt:
+ MetaParameter.TypeName = "smallint";
+ dbType = DbType.Int16;
+ break;
+ case SybaseType.Text:
+ MetaParameter.TypeName = "text";
+ dbType = DbType.AnsiString;
+ break;
+ case SybaseType.VarChar:
+ MetaParameter.TypeName = "varchar";
+ dbType = DbType.AnsiString;
+ break;
+ case SybaseType.TinyInt:
+ MetaParameter.TypeName = "tinyint";
+ dbType = DbType.Byte;
+ break;
+ case SybaseType.UniqueIdentifier:
+ MetaParameter.TypeName = "uniqueidentifier";
+ dbType = DbType.Guid;
+ break;
+ case SybaseType.Variant:
+ MetaParameter.TypeName = "sql_variant";
+ dbType = DbType.Object;
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ sybaseType = type;
+ }
+
+ public override string ToString()
+ {
+ return ParameterName;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs
new file mode 100644
index 00000000000..853d859a9fe
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs
@@ -0,0 +1,211 @@
+//
+// Mono.Data.SybaseClient.SybaseParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+
+namespace Mono.Data.SybaseClient {
+ [ListBindable (false)]
+ public sealed class SybaseParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList();
+ TdsMetaParameterCollection metaParameters;
+ SybaseCommand command;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SybaseParameterCollection (SybaseCommand command)
+ {
+ this.command = command;
+ metaParameters = new TdsMetaParameterCollection ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public SybaseParameter this [int index] {
+ get { return (SybaseParameter) list [index]; }
+ set { list [index] = (SybaseParameter) value; }
+ }
+
+ object IDataParameterCollection.this [string parameterName] {
+ get { return this[parameterName]; }
+ set {
+ if (!(value is SybaseParameter))
+ throw new InvalidCastException ("Only SQLParameter objects can be used.");
+ this [parameterName] = (SybaseParameter) value;
+ }
+ }
+
+ public SybaseParameter this [string parameterName] {
+ get {
+ foreach (SybaseParameter p in list)
+ if (p.ParameterName.Equals (parameterName))
+ return p;
+ throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
+ }
+ set {
+ if (!Contains (parameterName))
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ this [IndexOf (parameterName)] = value;
+ }
+ }
+
+ object IList.this [int index] {
+ get { return (SybaseParameter) this [index]; }
+ set { this [index] = (SybaseParameter) value; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ internal TdsMetaParameterCollection MetaParameters {
+ get { return metaParameters; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ if (!(value is SybaseParameter))
+ throw new InvalidCastException ("The parameter was not an SybaseParameter.");
+ Add ((SybaseParameter) value);
+ return IndexOf (value);
+ }
+
+ public SybaseParameter Add (SybaseParameter value)
+ {
+ if (value.Container != null)
+ throw new ArgumentException ("The SybaseParameter specified in the value parameter is already added to this or another SybaseParameterCollection.");
+
+ value.Container = this;
+ list.Add (value);
+ metaParameters.Add (value.MetaParameter);
+ return value;
+ }
+
+ public SybaseParameter Add (string parameterName, object value)
+ {
+ return Add (new SybaseParameter (parameterName, value));
+ }
+
+ public SybaseParameter Add (string parameterName, SybaseType sybaseType)
+ {
+ return Add (new SybaseParameter (parameterName, sybaseType));
+ }
+
+ public SybaseParameter Add (string parameterName, SybaseType sybaseType, int size)
+ {
+ return Add (new SybaseParameter (parameterName, sybaseType, size));
+ }
+
+ public SybaseParameter Add (string parameterName, SybaseType sybaseType, int size, string sourceColumn)
+ {
+ return Add (new SybaseParameter (parameterName, sybaseType, size, sourceColumn));
+ }
+
+ public void Clear()
+ {
+ metaParameters.Clear ();
+ list.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ if (!(value is SybaseParameter))
+ throw new InvalidCastException ("The parameter was not an SybaseParameter.");
+ return Contains (((SybaseParameter) value).ParameterName);
+ }
+
+ public bool Contains (string value)
+ {
+ foreach (SybaseParameter p in list)
+ if (p.ParameterName.Equals (value))
+ return true;
+ return false;
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object value)
+ {
+ if (!(value is SybaseParameter))
+ throw new InvalidCastException ("The parameter was not an SybaseParameter.");
+ return IndexOf (((SybaseParameter) value).ParameterName);
+ }
+
+ public int IndexOf (string parameterName)
+ {
+ return list.IndexOf (parameterName);
+ }
+
+ public void Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (object value)
+ {
+ metaParameters.Remove (((SybaseParameter) value).MetaParameter);
+ list.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ metaParameters.RemoveAt (index);
+ list.RemoveAt (index);
+ }
+
+ public void RemoveAt (string parameterName)
+ {
+ RemoveAt (IndexOf (parameterName));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs
new file mode 100644
index 00000000000..6d93b1125c1
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs
@@ -0,0 +1,79 @@
+//
+// Mono.Data.SybaseClient.SybasePermission.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybasePermission : DBDataPermission
+ {
+ [MonoTODO]
+ public SybasePermission ()
+ {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SybasePermission (PermissionState state)
+ {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SybasePermission (PermissionState state, bool allowBlankPassword)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement securityElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs
new file mode 100644
index 00000000000..0e76df37d82
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs
@@ -0,0 +1,34 @@
+//
+// Mono.Data.SybaseClient.SybasePermissionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace Mono.Data.SybaseClient {
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SybasePermissionAttribute : DBDataPermissionAttribute
+ {
+ [MonoTODO]
+ public SybasePermissionAttribute(SecurityAction action)
+ : base(action)
+ {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public override IPermission CreatePermission()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..d3557312108
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.SybaseClient.SybaseRowUpdatedEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ #region Constructors
+
+ [MonoTODO]
+ public SybaseRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [MonoTODO]
+ public new SybaseCommand Command
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..890c1d98ad8
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// Mono.Data.SybaseClient.SybaseRowUpdatedEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.SybaseClient {
+ public delegate void SybaseRowUpdatedEventHandler (object sender, SybaseRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..499e0519b46
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// Mono.Data.SybaseClient.SybaseRowUpdatingEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ #region Constructors
+
+ [MonoTODO]
+ public SybaseRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [MonoTODO]
+ public new SybaseCommand Command {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..a64d25bdfa6
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// Mono.Data.SybaseClient.SybaseRowUpdatingEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.SybaseClient {
+ public delegate void SybaseRowUpdatingEventHandler (object sender, SybaseRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs
new file mode 100644
index 00000000000..5a25751721e
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs
@@ -0,0 +1,106 @@
+//
+// Mono.Data.SybaseClient.SybaseTransaction.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.SybaseClient {
+ public sealed class SybaseTransaction : MarshalByRefObject, IDbTransaction, IDisposable
+ {
+ #region Fields
+
+ bool disposed = false;
+
+ SybaseConnection connection;
+ IsolationLevel isolationLevel;
+ bool isOpen;
+
+ #endregion
+
+ #region Constructors
+
+ internal SybaseTransaction (SybaseConnection connection, IsolationLevel isolevel)
+ {
+ this.connection = connection;
+ this.isolationLevel = isolevel;
+ isOpen = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SybaseConnection Connection {
+ get { return connection; }
+ }
+
+ internal bool IsOpen {
+ get { return isOpen; }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get { return isolationLevel; }
+ }
+
+ IDbConnection IDbTransaction.Connection {
+ get { return Connection; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Commit ()
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute ("COMMIT TRANSACTION");
+ connection.Transaction = null;
+ isOpen = false;
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing)
+ Rollback ();
+ disposed = true;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public void Rollback ()
+ {
+ Rollback (String.Empty);
+ }
+
+ public void Rollback (string transactionName)
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute (String.Format ("ROLLBACK TRANSACTION {0}", transactionName));
+ isOpen = false;
+ }
+
+ public void Save (string savePointName)
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute (String.Format ("SAVE TRANSACTION {0}", savePointName));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs
new file mode 100644
index 00000000000..ea4534094ea
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs
@@ -0,0 +1,41 @@
+//
+// Mono.Data.SybaseClient.SybaseType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.SybaseClient {
+ [Serializable]
+ public enum SybaseType
+ {
+ BigInt = 0,
+ Binary = 1,
+ Bit = 2,
+ Char = 3,
+ DateTime = 4,
+ Decimal = 5,
+ Float = 6,
+ Image = 7,
+ Int = 8,
+ Money = 9,
+ NChar = 10,
+ NText = 11,
+ NVarChar = 12,
+ Real = 13,
+ UniqueIdentifier = 14,
+ SmallDateTime = 15,
+ SmallInt = 16,
+ SmallMoney = 17,
+ Text = 18,
+ Timestamp = 19,
+ TinyInt = 20,
+ VarBinary = 21,
+ VarChar = 22,
+ Variant = 23
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/TODOAttribute.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/TODOAttribute.cs
new file mode 100644
index 00000000000..1c3e5574463
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.SybaseClient {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs
new file mode 100644
index 00000000000..d0fbe92d52f
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs
@@ -0,0 +1,230 @@
+//
+// Mono.Data.SybaseTypes.SybaseBinary
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseBinary : INullable, IComparable
+ {
+ #region Fields
+
+ byte[] value;
+ private bool notNull;
+
+ public static readonly SybaseBinary Null;
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseBinary (byte[] value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public byte this[int index] {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ("The property contains Null.");
+ else if (index >= this.Length)
+ throw new SybaseNullValueException ("The index parameter indicates a position beyond the length of the byte array.");
+ else
+ return value [index];
+ }
+ }
+
+ public int Length {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ("The property contains Null.");
+ else
+ return value.Length;
+ }
+ }
+
+ public byte[] Value
+ {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public int CompareTo (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseBinary Concat (SybaseBinary x, SybaseBinary y)
+ {
+ return (x + y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseBinary))
+ return false;
+ else
+ return (bool) (this == (SybaseBinary)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseBinary x, SybaseBinary y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Operators
+
+ public static SybaseBoolean GreaterThan (SybaseBinary x, SybaseBinary y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseBinary x, SybaseBinary y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseBinary x, SybaseBinary y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseBinary x, SybaseBinary y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseBinary x, SybaseBinary y)
+ {
+ return (x != y);
+ }
+
+ public SybaseGuid ToSybaseGuid ()
+ {
+ return new SybaseGuid (value);
+ }
+
+ public override string ToString ()
+ {
+ if (IsNull)
+ return "null";
+ return String.Format ("SybaseBinary ({0})", Length);
+ }
+
+ #endregion
+
+ #region Operators
+
+ [MonoTODO]
+ public static SybaseBinary operator + (SybaseBinary x, SybaseBinary y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator == (SybaseBinary x, SybaseBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator > (SybaseBinary x, SybaseBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator >= (SybaseBinary x, SybaseBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator != (SybaseBinary x, SybaseBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator < (SybaseBinary x, SybaseBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator <= (SybaseBinary x, SybaseBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ public static explicit operator byte[] (SybaseBinary x)
+ {
+ return x.Value;
+ }
+
+ [MonoTODO]
+ public static explicit operator SybaseBinary (SybaseGuid x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static implicit operator SybaseBinary (byte[] x)
+ {
+ return new SybaseBinary (x);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs
new file mode 100644
index 00000000000..92fbfcd84dc
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs
@@ -0,0 +1,384 @@
+//
+// Mono.Data.SybaseTypes.SybaseBoolean
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseBoolean : INullable, IComparable
+ {
+ #region Fields
+
+ byte value;
+
+ // default is false
+ private bool notNull;
+
+ public static readonly SybaseBoolean False = new SybaseBoolean (false);
+ public static readonly SybaseBoolean Null;
+ public static readonly SybaseBoolean One = new SybaseBoolean (1);
+ public static readonly SybaseBoolean True = new SybaseBoolean (true);
+ public static readonly SybaseBoolean Zero = new SybaseBoolean (0);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SybaseBoolean (bool value)
+ {
+ this.value = (byte) (value ? 1 : 0);
+ notNull = true;
+ }
+
+ public SybaseBoolean (int value)
+ {
+ this.value = (byte) (value != 0 ? 1 : 0);
+ notNull = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte ByteValue {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException(Locale.GetText("The property is set to null."));
+ else
+ return value;
+ }
+ }
+
+ public bool IsFalse {
+ get {
+ if (this.IsNull)
+ return false;
+ else
+ return (value == 0);
+ }
+ }
+
+ public bool IsNull {
+ get {
+ return !notNull;
+ }
+ }
+
+ public bool IsTrue {
+ get {
+ if (this.IsNull)
+ return false;
+ else
+ return (value != 0);
+ }
+ }
+
+ public bool Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException(Locale.GetText("The property is set to null."));
+ else
+ return this.IsTrue;
+ }
+ }
+
+ #endregion // Properties
+
+ public static SybaseBoolean And (SybaseBoolean x, SybaseBoolean y)
+ {
+ return (x & y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseBoolean))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseBoolean"));
+ else if (((SybaseBoolean)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseBoolean)value).ByteValue);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is SybaseByte))
+ return false;
+ else
+ return (bool) (this == (SybaseBoolean)value);
+ }
+
+ public static SybaseBoolean Equals(SybaseBoolean x, SybaseBoolean y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)value;
+ }
+
+ public static SybaseBoolean NotEquals(SybaseBoolean x, SybaseBoolean y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseBoolean OnesComplement(SybaseBoolean x)
+ {
+ return ~x;
+ }
+
+ public static SybaseBoolean Or(SybaseBoolean x, SybaseBoolean y)
+ {
+ return (x | y);
+ }
+
+ public static SybaseBoolean Parse(string s)
+ {
+ return new SybaseBoolean (Boolean.Parse (s));
+ }
+
+ public SybaseByte ToSybaseByte()
+ {
+ return new SybaseByte (value);
+ }
+
+ // **************************************************
+ // Conversion from SybaseBoolean to other SybaseTypes
+ // **************************************************
+
+ public SybaseDecimal ToSybaseDecimal()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString()
+ {
+ if (this.IsNull)
+ return new SybaseString ("Null");
+ if (this.IsTrue)
+ return new SybaseString ("True");
+ else
+ return new SybaseString ("False");
+ }
+
+ public override string ToString()
+ {
+ if (this.IsNull)
+ return "Null";
+ if (this.IsTrue)
+ return "True";
+ else
+ return "False";
+ }
+
+ // Bitwise exclusive-OR (XOR)
+ public static SybaseBoolean Xor(SybaseBoolean x, SybaseBoolean y)
+ {
+ return (x ^ y);
+ }
+
+ // **************************************************
+ // Public Operators
+ // **************************************************
+
+ // Bitwise AND
+ public static SybaseBoolean operator & (SybaseBoolean x, SybaseBoolean y)
+ {
+ return new SybaseBoolean (x.Value & y.Value);
+ }
+
+ // Bitwise OR
+ public static SybaseBoolean operator | (SybaseBoolean x, SybaseBoolean y)
+ {
+ return new SybaseBoolean (x.Value | y.Value);
+
+ }
+
+ // Compares two instances for equality
+ public static SybaseBoolean operator == (SybaseBoolean x, SybaseBoolean y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ // Bitwize exclusive-OR (XOR)
+ public static SybaseBoolean operator ^ (SybaseBoolean x, SybaseBoolean y)
+ {
+ return new SybaseBoolean (x.Value ^ y.Value);
+ }
+
+ // test Value of SybaseBoolean to determine it is false.
+ public static bool operator false (SybaseBoolean x)
+ {
+ return x.IsFalse;
+ }
+
+ // in-equality
+ public static SybaseBoolean operator != (SybaseBoolean x, SybaseBoolean y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value != y.Value);
+ }
+
+ // Logical NOT
+ public static SybaseBoolean operator ! (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!x.Value);
+ }
+
+ // One's Complement
+ public static SybaseBoolean operator ~ (SybaseBoolean x)
+ {
+ return new SybaseBoolean (~x.ByteValue);
+ }
+
+ // test to see if value is true
+ public static bool operator true (SybaseBoolean x)
+ {
+ return x.IsTrue;
+ }
+
+ // ****************************************
+ // Type Conversion
+ // ****************************************
+
+
+ // SybaseBoolean to Boolean
+ public static explicit operator bool (SybaseBoolean x)
+ {
+ return x.Value;
+ }
+
+
+ // SybaseByte to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseDecimal to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseDouble to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseInt16 to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseInt32 to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean (x.Value);
+ }
+
+ // SybaseInt64 to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseMoney to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseSingle to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseBoolean ((int)x.Value);
+ }
+
+ // SybaseString to SybaseBoolean
+ public static explicit operator SybaseBoolean (SybaseString x)
+ {
+ return SybaseBoolean.Parse (x.Value);
+ }
+
+ // Boolean to SybaseBoolean
+ public static implicit operator SybaseBoolean (bool x)
+ {
+ return new SybaseBoolean (x);
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs
new file mode 100644
index 00000000000..0b65ffaa52a
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs
@@ -0,0 +1,393 @@
+//
+// Mono.Data.SybaseTypes.SybaseByte
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseByte : INullable, IComparable
+ {
+ #region Fields
+
+ byte value;
+ private bool notNull;
+
+ public static readonly SybaseByte MaxValue = new SybaseByte (0xff);
+ public static readonly SybaseByte MinValue = new SybaseByte (0);
+ public static readonly SybaseByte Null;
+ public static readonly SybaseByte Zero = new SybaseByte (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseByte (byte value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public byte Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseByte Add (SybaseByte x, SybaseByte y)
+ {
+ return (x + y);
+ }
+
+ public static SybaseByte BitwiseAnd (SybaseByte x, SybaseByte y)
+ {
+ return (x & y);
+ }
+
+ public static SybaseByte BitwiseOr (SybaseByte x, SybaseByte y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseByte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseByte"));
+ else if (((SybaseByte)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseByte)value).Value);
+ }
+
+ public static SybaseByte Divide (SybaseByte x, SybaseByte y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseByte))
+ return false;
+ else
+ return (bool) (this == (SybaseByte)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseByte x, SybaseByte y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseByte x, SybaseByte y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseByte x, SybaseByte y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseByte x, SybaseByte y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseByte x, SybaseByte y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseByte Mod (SybaseByte x, SybaseByte y)
+ {
+ return (x % y);
+ }
+
+ public static SybaseByte Multiply (SybaseByte x, SybaseByte y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseByte x, SybaseByte y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseByte OnesComplement (SybaseByte x)
+ {
+ return ~x;
+ }
+
+ public static SybaseByte Parse (string s)
+ {
+ return new SybaseByte (Byte.Parse (s));
+ }
+
+ public static SybaseByte Subtract (SybaseByte x, SybaseByte y)
+ {
+ return (x - y);
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal ()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble ()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16 ()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64 ()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney ()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle ()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static SybaseByte Xor (SybaseByte x, SybaseByte y)
+ {
+ return (x ^ y);
+ }
+
+ public static SybaseByte operator + (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value + y.Value));
+ }
+
+ public static SybaseByte operator & (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value & y.Value));
+ }
+
+ public static SybaseByte operator | (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value | y.Value));
+ }
+
+ public static SybaseByte operator / (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value / y.Value));
+ }
+
+ public static SybaseBoolean operator == (SybaseByte x, SybaseByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseByte operator ^ (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value ^ y.Value));
+ }
+
+ public static SybaseBoolean operator > (SybaseByte x, SybaseByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseByte x, SybaseByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseByte x, SybaseByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseByte x, SybaseByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseByte x, SybaseByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ public static SybaseByte operator % (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value % y.Value));
+ }
+
+ public static SybaseByte operator * (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value * y.Value));
+ }
+
+ public static SybaseByte operator ~ (SybaseByte x)
+ {
+ return new SybaseByte ((byte) ~x.Value);
+ }
+
+ public static SybaseByte operator - (SybaseByte x, SybaseByte y)
+ {
+ return new SybaseByte ((byte) (x.Value - y.Value));
+ }
+
+ public static explicit operator SybaseByte (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte (x.ByteValue);
+ }
+
+ public static explicit operator byte (SybaseByte x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseByte (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+ public static explicit operator SybaseByte (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+ public static explicit operator SybaseByte (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+ public static explicit operator SybaseByte (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+ public static explicit operator SybaseByte (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+ public static explicit operator SybaseByte (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+ public static explicit operator SybaseByte (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseByte ((byte)x.Value);
+ }
+
+
+ public static explicit operator SybaseByte (SybaseString x)
+ {
+ return SybaseByte.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseByte (byte x)
+ {
+ return new SybaseByte (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs
new file mode 100644
index 00000000000..a0c522f4e36
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs
@@ -0,0 +1,30 @@
+//
+// Mono.Data.SybaseTypes.SybaseCompareOptions.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+
+namespace Mono.Data.SybaseTypes {
+ /// <summary>
+ /// Specifies the compare option values for a SybaseString structure.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum SybaseCompareOptions {
+ BinarySort = 0x8000,
+ IgnoreCase = 0x1,
+ IgnoreKanaType = 0x8,
+ IgnoreNonSpace = 0x2,
+ IgnoreWidth = 0x10,
+ None = 0
+ }
+
+}
+
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs
new file mode 100644
index 00000000000..36981171e5c
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs
@@ -0,0 +1,254 @@
+//
+// Mono.Data.SybaseTypes.SybaseDateTime
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseDateTime : INullable, IComparable
+ {
+ #region Fields
+ private DateTime value;
+ private bool notNull;
+
+ public static readonly SybaseDateTime MaxValue = new SybaseDateTime (9999,12,31);
+ public static readonly SybaseDateTime MinValue = new SybaseDateTime (1753,1,1);
+ public static readonly SybaseDateTime Null;
+ public static readonly int SQLTicksPerHour;
+ public static readonly int SQLTicksPerMinute;
+ public static readonly int SQLTicksPerSecond;
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseDateTime (DateTime value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ [MonoTODO]
+ public SybaseDateTime (int dayTicks, int timeTicks)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public SybaseDateTime (int year, int month, int day)
+ {
+ this.value = new DateTime (year, month, day);
+ notNull = true;
+ }
+
+ public SybaseDateTime (int year, int month, int day, int hour, int minute, int second)
+ {
+ this.value = new DateTime (year, month, day, hour, minute, second);
+ notNull = true;
+ }
+
+ [MonoTODO]
+ public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public int DayTicks {
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ [MonoTODO]
+ public int TimeTicks {
+ get { throw new NotImplementedException (); }
+ }
+
+ public DateTime Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseDateTime))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDateTime"));
+ else if (((SybaseDateTime)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseDateTime)value).Value);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseDateTime))
+ return false;
+ else
+ return (bool) (this == (SybaseDateTime)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseDateTime x, SybaseDateTime y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return 42;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseDateTime x, SybaseDateTime y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseDateTime x, SybaseDateTime y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseDateTime x, SybaseDateTime y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseDateTime x, SybaseDateTime y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseDateTime x, SybaseDateTime y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static SybaseDateTime Parse (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ [MonoTODO]
+ public static SybaseDateTime operator + (SybaseDateTime x, TimeSpan t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseBoolean operator == (SybaseDateTime x, SybaseDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseBoolean operator > (SybaseDateTime x, SybaseDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseDateTime x, SybaseDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseDateTime x, SybaseDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseDateTime x, SybaseDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseDateTime x, SybaseDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ [MonoTODO]
+ public static SybaseDateTime operator - (SybaseDateTime x, TimeSpan t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static explicit operator DateTime (SybaseDateTime x)
+ {
+ return x.Value;
+ }
+
+ [MonoTODO]
+ public static explicit operator SybaseDateTime (SybaseString x)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static implicit operator SybaseDateTime (DateTime x)
+ {
+ return new SybaseDateTime (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs
new file mode 100644
index 00000000000..aa1f5ddb297
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs
@@ -0,0 +1,653 @@
+//
+// Mono.Data.SybaseTypes.SybaseDecimal
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseDecimal : INullable, IComparable
+ {
+
+ #region Fields
+
+ int[] value;
+ byte precision;
+ byte scale;
+ bool positive;
+
+ bool notNull;
+
+ // borrowed from System.Decimal
+ const int SCALE_SHIFT = 16;
+ const int SIGN_SHIFT = 31;
+ const int RESERVED_SS32_BITS = 0x7F00FFFF;
+
+ public static readonly byte MaxPrecision = 38;
+ public static readonly byte MaxScale = 38;
+
+ public static readonly SybaseDecimal MaxValue = new SybaseDecimal (MaxPrecision, (byte)0, true, (int)716002642, Int32.MaxValue, (int)1518778966, (int)1262177448);
+ public static readonly SybaseDecimal MinValue = new SybaseDecimal (MaxPrecision, (byte)0, false, (int)716002642, Int32.MaxValue, (int)1518778966, (int)1262177448);
+ public static readonly SybaseDecimal Null;
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseDecimal (decimal value)
+ {
+ int[] binData = Decimal.GetBits (value);
+
+ this.precision = MaxPrecision; // this value seems unclear
+
+ this.scale = (byte)(binData[3] >> SCALE_SHIFT);
+ if (this.scale > MaxScale || (this.scale & RESERVED_SS32_BITS) != 0)
+ throw new ArgumentException(Locale.GetText ("Invalid scale"));
+
+ this.positive = ((binData[3] >> SIGN_SHIFT) > 0);
+ this.value = new int[4];
+ this.value[0] = binData[0];
+ this.value[1] = binData[1];
+ this.value[2] = binData[2];
+ this.value[3] = 0;
+ notNull = true;
+ }
+
+ public SybaseDecimal (double value) : this ((decimal)value) { }
+ public SybaseDecimal (int value) : this ((decimal)value) { }
+ public SybaseDecimal (long value) : this ((decimal)value) { }
+
+ public SybaseDecimal (byte bPrecision, byte bScale, bool fPositive, int[] bits) : this (bPrecision, bScale, fPositive, bits[0], bits[1], bits[2], bits[3]) { }
+
+ public SybaseDecimal (byte bPrecision, byte bScale, bool fPositive, int data1, int data2, int data3, int data4)
+ {
+ this.precision = bPrecision;
+ this.scale = bScale;
+ this.positive = fPositive;
+ this.value = new int[4];
+ this.value[0] = data1;
+ this.value[1] = data2;
+ this.value[2] = data3;
+ this.value[3] = data4;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public byte[] BinData {
+ get { throw new NotImplementedException (); }
+ }
+
+ public int[] Data {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return (value);
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public bool IsPositive {
+ get { return positive; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ }
+
+ public decimal Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ if (this.value[3] > 0)
+ throw new OverflowException ();
+ else
+ System.Console.WriteLine( "boo!" );
+ return new decimal (value[0], value[1], value[2], !positive, scale);
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public static SybaseDecimal Abs (SybaseDecimal n)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static SybaseDecimal Add (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x + y);
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal AdjustScale (SybaseDecimal n, int digits, bool fRound)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal Ceiling (SybaseDecimal n)
+ {
+ throw new NotImplementedException();
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseDecimal))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDecimal"));
+ else if (((SybaseDecimal)value).IsNull)
+ return 1;
+ else
+ return this.Value.CompareTo (((SybaseDecimal)value).Value);
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal ConvertToPrecScale (SybaseDecimal n, int precision, int scale)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseDecimal Divide (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseDecimal))
+ return false;
+ else
+ return (bool) (this == (SybaseDecimal)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal Floor (SybaseDecimal n)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal static SybaseDecimal FromTdsBigDecimal (TdsBigDecimal x)
+ {
+ if (x == null)
+ return Null;
+ else
+ return new SybaseDecimal (x.Precision, x.Scale, !x.IsNegative, x.Data);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)this.Value;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseDecimal Multiply (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal Parse (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal Power (SybaseDecimal n, double exp)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal Round (SybaseDecimal n, int position)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseInt32 Sign (SybaseDecimal n)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseDecimal Subtract (SybaseDecimal x, SybaseDecimal y)
+ {
+ return (x - y);
+ }
+
+ public double ToDouble ()
+ {
+ return ((double)this.Value);
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte ()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDouble ToSybaseDouble ()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16 ()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64 ()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney ()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle ()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal Truncate (SybaseDecimal n, int position)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseDecimal operator + (SybaseDecimal x, SybaseDecimal y)
+ {
+ // if one of them is negative, perform subtraction
+ if (x.IsPositive && !y.IsPositive) return x - y;
+ if (y.IsPositive && !x.IsPositive) return y - x;
+
+ // adjust the scale to the smaller of the two beforehand
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ // set the precision to the greater of the two
+ byte resultPrecision;
+ if (x.Precision > y.Precision)
+ resultPrecision = x.Precision;
+ else
+ resultPrecision = y.Precision;
+
+ int[] xData = x.Data;
+ int[] yData = y.Data;
+ int[] resultBits = new int[4];
+
+ ulong res;
+ ulong carry = 0;
+
+ // add one at a time, and carry the results over to the next
+ for (int i = 0; i < 4; i +=1)
+ {
+ carry = 0;
+ res = (ulong)(xData[i]) + (ulong)(yData[i]) + carry;
+ if (res > Int32.MaxValue)
+ {
+ carry = res - Int32.MaxValue;
+ res = Int32.MaxValue;
+ }
+ resultBits [i] = (int)res;
+ }
+
+ // if we have carry left, then throw an exception
+ if (carry > 0)
+ throw new OverflowException ();
+ else
+ return new SybaseDecimal (resultPrecision, x.Scale, x.IsPositive, resultBits);
+ }
+
+ [MonoTODO]
+ public static SybaseDecimal operator / (SybaseDecimal x, SybaseDecimal y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseBoolean operator == (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 0; i < 4; i += 1)
+ {
+ if (x.Data[i] != y.Data[i])
+ return new SybaseBoolean (false);
+ }
+ return new SybaseBoolean (true);
+ }
+
+ public static SybaseBoolean operator > (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new SybaseBoolean (x.Data[i] > y.Data[i]);
+ }
+ return new SybaseBoolean (false);
+ }
+
+ public static SybaseBoolean operator >= (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new SybaseBoolean (x.Data[i] >= y.Data[i]);
+ }
+ return new SybaseBoolean (true);
+ }
+
+ public static SybaseBoolean operator != (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 0; i < 4; i += 1)
+ {
+ if (x.Data[i] != y.Data[i])
+ return new SybaseBoolean (true);
+ }
+ return new SybaseBoolean (false);
+ }
+
+ public static SybaseBoolean operator < (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+
+ return new SybaseBoolean (x.Data[i] < y.Data[i]);
+ }
+ return new SybaseBoolean (false);
+ }
+
+ public static SybaseBoolean operator <= (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new SybaseBoolean (x.Data[i] <= y.Data[i]);
+ }
+ return new SybaseBoolean (true);
+ }
+
+ public static SybaseDecimal operator * (SybaseDecimal x, SybaseDecimal y)
+ {
+ // adjust the scale to the smaller of the two beforehand
+ if (x.Scale > y.Scale)
+ x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ // set the precision to the greater of the two
+ byte resultPrecision;
+ if (x.Precision > y.Precision)
+ resultPrecision = x.Precision;
+ else
+ resultPrecision = y.Precision;
+
+ int[] xData = x.Data;
+ int[] yData = y.Data;
+ int[] resultBits = new int[4];
+
+ ulong res;
+ ulong carry = 0;
+
+ // multiply one at a time, and carry the results over to the next
+ for (int i = 0; i < 4; i +=1)
+ {
+ carry = 0;
+ res = (ulong)(xData[i]) * (ulong)(yData[i]) + carry;
+ if (res > Int32.MaxValue)
+ {
+ carry = res - Int32.MaxValue;
+ res = Int32.MaxValue;
+ }
+ resultBits [i] = (int)res;
+ }
+
+ // if we have carry left, then throw an exception
+ if (carry > 0)
+ throw new OverflowException ();
+ else
+ return new SybaseDecimal (resultPrecision, x.Scale, (x.IsPositive == y.IsPositive), resultBits);
+
+ }
+
+ public static SybaseDecimal operator - (SybaseDecimal x, SybaseDecimal y)
+ {
+ if (x.IsPositive && !y.IsPositive) return x + y;
+ if (!x.IsPositive && y.IsPositive) return -(x + y);
+ if (!x.IsPositive && !y.IsPositive) return y - x;
+
+ // otherwise, x is positive and y is positive
+ bool resultPositive = (bool)(x > y);
+ int[] yData = y.Data;
+
+ for (int i = 0; i < 4; i += 1) yData[i] = -yData[i];
+
+ SybaseDecimal yInverse = new SybaseDecimal (y.Precision, y.Scale, y.IsPositive, yData);
+
+ if (resultPositive)
+ return x + yInverse;
+ else
+ return -(x + yInverse);
+ }
+
+ public static SybaseDecimal operator - (SybaseDecimal n)
+ {
+ return new SybaseDecimal (n.Precision, n.Scale, !n.IsPositive, n.Data);
+ }
+
+ public static explicit operator SybaseDecimal (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.ByteValue);
+ }
+
+ public static explicit operator Decimal (SybaseDecimal n)
+ {
+ return n.Value;
+ }
+
+ public static explicit operator SybaseDecimal (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ public static explicit operator SybaseDecimal (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ [MonoTODO]
+ public static explicit operator SybaseDecimal (SybaseString x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static implicit operator SybaseDecimal (decimal x)
+ {
+ return new SybaseDecimal (x);
+ }
+
+ public static implicit operator SybaseDecimal (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseDecimal (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseDecimal (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseDecimal (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseDecimal (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDecimal ((decimal)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs
new file mode 100644
index 00000000000..de880819f6e
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs
@@ -0,0 +1,349 @@
+//
+// Mono.Data.SybaseTypes.SybaseDouble
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseDouble : INullable, IComparable
+ {
+ #region Fields
+ double value;
+
+ private bool notNull;
+
+ public static readonly SybaseDouble MaxValue = new SybaseDouble (1.7976931348623157e308);
+ public static readonly SybaseDouble MinValue = new SybaseDouble (-1.7976931348623157e308);
+ public static readonly SybaseDouble Null;
+ public static readonly SybaseDouble Zero = new SybaseDouble (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseDouble (double value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public double Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseDouble Add (SybaseDouble x, SybaseDouble y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseDouble))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDouble"));
+ else if (((SybaseDouble)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseDouble)value).Value);
+ }
+
+ public static SybaseDouble Divide (SybaseDouble x, SybaseDouble y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseDouble))
+ return false;
+ else
+ return (bool) (this == (SybaseDouble)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseDouble x, SybaseDouble y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ long LongValue = (long)value;
+ return (int)(LongValue ^ (LongValue >> 32));
+
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseDouble x, SybaseDouble y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseDouble x, SybaseDouble y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseDouble x, SybaseDouble y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseDouble x, SybaseDouble y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseDouble Multiply (SybaseDouble x, SybaseDouble y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseDouble x, SybaseDouble y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseDouble Parse (string s)
+ {
+ return new SybaseDouble (Double.Parse (s));
+ }
+
+ public static SybaseDouble Subtract (SybaseDouble x, SybaseDouble y)
+ {
+ return (x - y);
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte ()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal ()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16 ()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64 ()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney ()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle ()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SybaseDouble operator + (SybaseDouble x, SybaseDouble y)
+ {
+ return new SybaseDouble (x.Value + y.Value);
+ }
+
+ public static SybaseDouble operator / (SybaseDouble x, SybaseDouble y)
+ {
+ return new SybaseDouble (x.Value / y.Value);
+ }
+
+ public static SybaseBoolean operator == (SybaseDouble x, SybaseDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseBoolean operator > (SybaseDouble x, SybaseDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseDouble x, SybaseDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseDouble x, SybaseDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseDouble x, SybaseDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseDouble x, SybaseDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ public static SybaseDouble operator * (SybaseDouble x, SybaseDouble y)
+ {
+ return new SybaseDouble (x.Value * y.Value);
+ }
+
+ public static SybaseDouble operator - (SybaseDouble x, SybaseDouble y)
+ {
+ return new SybaseDouble (x.Value - y.Value);
+ }
+
+ public static SybaseDouble operator - (SybaseDouble n)
+ {
+ return new SybaseDouble (-(n.Value));
+ }
+
+ public static explicit operator SybaseDouble (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.ByteValue);
+ }
+
+ public static explicit operator double (SybaseDouble x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseDouble (SybaseString x)
+ {
+ return SybaseDouble.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseDouble (double x)
+ {
+ return new SybaseDouble (x);
+ }
+
+ public static implicit operator SybaseDouble (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ public static implicit operator SybaseDouble (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ public static implicit operator SybaseDouble (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ public static implicit operator SybaseDouble (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ public static implicit operator SybaseDouble (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ public static implicit operator SybaseDouble (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ public static implicit operator SybaseDouble (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseDouble ((double)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs
new file mode 100644
index 00000000000..21c26b68d39
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs
@@ -0,0 +1,222 @@
+//
+// Mono.Data.SybaseTypes.SybaseGuid
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseGuid : INullable, IComparable
+ {
+ #region Fields
+
+ Guid value;
+
+ private bool notNull;
+
+ public static readonly SybaseGuid Null;
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseGuid (byte[] value)
+ {
+ this.value = new Guid (value);
+ notNull = true;
+ }
+
+ public SybaseGuid (Guid g)
+ {
+ this.value = g;
+ notNull = true;
+ }
+
+ public SybaseGuid (string s)
+ {
+ this.value = new Guid (s);
+ notNull = true;
+ }
+
+ public SybaseGuid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
+ {
+ this.value = new Guid (a, b, c, d, e, f, g, h, i, j, k);
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public Guid Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseGuid))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseGuid"));
+ else if (((SybaseGuid)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseGuid)value).Value);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseGuid))
+ return false;
+ else
+ return (bool) (this == (SybaseGuid)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseGuid x, SybaseGuid y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return 42;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseGuid x, SybaseGuid y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseGuid x, SybaseGuid y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseGuid x, SybaseGuid y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseGuid x, SybaseGuid y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseGuid x, SybaseGuid y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static SybaseGuid Parse (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte[] ToByteArray()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public SybaseBinary ToSybaseBinary ()
+ {
+ return ((SybaseBinary)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SybaseBoolean operator == (SybaseGuid x, SybaseGuid y)
+ {
+ if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator > (SybaseGuid x, SybaseGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator >= (SybaseGuid x, SybaseGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseBoolean operator != (SybaseGuid x, SybaseGuid y)
+ {
+ if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator < (SybaseGuid x, SybaseGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SybaseBoolean operator <= (SybaseGuid x, SybaseGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static explicit operator SybaseGuid (SybaseBinary x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static explicit operator Guid (SybaseGuid x)
+ {
+ return x.Value;
+ }
+
+ [MonoTODO]
+ public static explicit operator SybaseGuid (SybaseString x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static implicit operator SybaseGuid (Guid x)
+ {
+ return new SybaseGuid (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs
new file mode 100644
index 00000000000..2712592162d
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs
@@ -0,0 +1,397 @@
+//
+// Mono.Data.SybaseTypes.SybaseInt16
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseInt16 : INullable, IComparable
+ {
+ #region Fields
+
+ short value;
+ private bool notNull;
+
+ public static readonly SybaseInt16 MaxValue = new SybaseInt16 (32767);
+ public static readonly SybaseInt16 MinValue = new SybaseInt16 (-32768);
+ public static readonly SybaseInt16 Null;
+ public static readonly SybaseInt16 Zero = new SybaseInt16 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseInt16 (short value)
+ {
+ this.value = value;
+ notNull = true;;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public short Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseInt16 Add (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x + y);
+ }
+
+ public static SybaseInt16 BitwiseAnd (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x & y);
+ }
+
+ public static SybaseInt16 BitwiseOr (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseInt16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseInt16"));
+ else if (((SybaseInt16)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseInt16)value).Value);
+ }
+
+ public static SybaseInt16 Divide (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseInt16))
+ return false;
+ else
+ return (bool) (this == (SybaseInt16)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseInt16 Mod (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x % y);
+ }
+
+ public static SybaseInt16 Multiply (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseInt16 OnesComplement (SybaseInt16 x)
+ {
+ return ~x;
+ }
+
+ public static SybaseInt16 Parse (string s)
+ {
+ return new SybaseInt16 (Int16.Parse (s));
+ }
+
+ public static SybaseInt16 Subtract (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x - y);
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte ()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal ()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble ()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64 ()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney ()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle ()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static SybaseInt16 Xor (SybaseInt16 x, SybaseInt16 y)
+ {
+ return (x ^ y);
+ }
+
+ public static SybaseInt16 operator + (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.Value + y.Value));
+ }
+
+ public static SybaseInt16 operator & (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.value & y.Value));
+ }
+
+ public static SybaseInt16 operator | (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) ((byte) x.Value | (byte) y.Value));
+ }
+
+ public static SybaseInt16 operator / (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.Value / y.Value));
+ }
+
+ public static SybaseBoolean operator == (SybaseInt16 x, SybaseInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseInt16 operator ^ (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.Value ^ y.Value));
+ }
+
+ public static SybaseBoolean operator > (SybaseInt16 x, SybaseInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseInt16 x, SybaseInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseInt16 x, SybaseInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseInt16 x, SybaseInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseInt16 x, SybaseInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ public static SybaseInt16 operator % (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.Value % y.Value));
+ }
+
+ public static SybaseInt16 operator * (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.Value * y.Value));
+ }
+
+ public static SybaseInt16 operator ~ (SybaseInt16 x)
+ {
+ return new SybaseInt16 ((short) (~x.Value));
+ }
+
+ public static SybaseInt16 operator - (SybaseInt16 x, SybaseInt16 y)
+ {
+ return new SybaseInt16 ((short) (x.Value - y.Value));
+ }
+
+ public static SybaseInt16 operator - (SybaseInt16 n)
+ {
+ return new SybaseInt16 ((short) (-n.Value));
+ }
+
+ public static explicit operator SybaseInt16 (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.ByteValue);
+ }
+
+ public static explicit operator SybaseInt16 (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ public static explicit operator SybaseInt16 (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ public static explicit operator short (SybaseInt16 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseInt16 (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ public static explicit operator SybaseInt16 (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ public static explicit operator SybaseInt16 (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ public static explicit operator SybaseInt16 (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ public static explicit operator SybaseInt16 (SybaseString x)
+ {
+ return SybaseInt16.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseInt16 (short x)
+ {
+ return new SybaseInt16 (x);
+ }
+
+ public static implicit operator SybaseInt16 (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt16 ((short)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs
new file mode 100644
index 00000000000..1aad52ec732
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs
@@ -0,0 +1,417 @@
+//
+// Mono.Data.SybaseTypes.SybaseInt32
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseInt32 : INullable, IComparable
+ {
+ #region Fields
+
+ int value;
+ private bool notNull;
+
+ public static readonly SybaseInt32 MaxValue = new SybaseInt32 (2147483647);
+ public static readonly SybaseInt32 MinValue = new SybaseInt32 (-2147483648);
+ public static readonly SybaseInt32 Null;
+ public static readonly SybaseInt32 Zero = new SybaseInt32 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseInt32(int value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public int Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseInt32 Add (SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x + y);
+ }
+
+ public static SybaseInt32 BitwiseAnd(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x & y);
+ }
+
+ public static SybaseInt32 BitwiseOr(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo(object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseInt32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseInt32"));
+ else if (((SybaseInt32)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseInt32)value).Value);
+ }
+
+ public static SybaseInt32 Divide(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is SybaseInt32))
+ return false;
+ else
+ return (bool) (this == (SybaseInt32)value);
+ }
+
+ public static SybaseBoolean Equals(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ return value;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseInt32 Mod(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x % y);
+ }
+
+ public static SybaseInt32 Multiply(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseInt32 OnesComplement(SybaseInt32 x)
+ {
+ return ~x;
+ }
+
+ public static SybaseInt32 Parse(string s)
+ {
+ return new SybaseInt32 (Int32.Parse (s));
+ }
+
+ public static SybaseInt32 Subtract(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x - y);
+ }
+
+ public SybaseBoolean ToSybaseBoolean()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static SybaseInt32 Xor(SybaseInt32 x, SybaseInt32 y)
+ {
+ return (x ^ y);
+ }
+
+ #endregion
+
+ #region Operators
+
+ // Compute Addition
+ public static SybaseInt32 operator + (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value + y.Value);
+ }
+
+ // Bitwise AND
+ public static SybaseInt32 operator & (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value & y.Value);
+ }
+
+ // Bitwise OR
+ public static SybaseInt32 operator | (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value | y.Value);
+ }
+
+ // Compute Division
+ public static SybaseInt32 operator / (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value / y.Value);
+ }
+
+ // Compare Equality
+ public static SybaseBoolean operator == (SybaseInt32 x, SybaseInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ // Bitwise Exclusive-OR (XOR)
+ public static SybaseInt32 operator ^ (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value ^ y.Value);
+ }
+
+ // > Compare
+ public static SybaseBoolean operator >(SybaseInt32 x, SybaseInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ // >= Compare
+ public static SybaseBoolean operator >= (SybaseInt32 x, SybaseInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ // != Inequality Compare
+ public static SybaseBoolean operator != (SybaseInt32 x, SybaseInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value != y.Value);
+ }
+
+ // < Compare
+ public static SybaseBoolean operator < (SybaseInt32 x, SybaseInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ // <= Compare
+ public static SybaseBoolean operator <= (SybaseInt32 x, SybaseInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ // Compute Modulus
+ public static SybaseInt32 operator % (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value % y.Value);
+ }
+
+ // Compute Multiplication
+ public static SybaseInt32 operator * (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value * y.Value);
+ }
+
+ // Ones Complement
+ public static SybaseInt32 operator ~ (SybaseInt32 x)
+ {
+ return new SybaseInt32 (~x.Value);
+ }
+
+ // Subtraction
+ public static SybaseInt32 operator - (SybaseInt32 x, SybaseInt32 y)
+ {
+ return new SybaseInt32 (x.Value - y.Value);
+ }
+
+ // Negates the Value
+ public static SybaseInt32 operator - (SybaseInt32 x)
+ {
+ return new SybaseInt32 (-x.Value);
+ }
+
+ // Type Conversions
+ public static explicit operator SybaseInt32 (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.ByteValue);
+ }
+
+ public static explicit operator SybaseInt32 (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ public static explicit operator SybaseInt32 (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ public static explicit operator int (SybaseInt32 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseInt32 (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ public static explicit operator SybaseInt32(SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ public static explicit operator SybaseInt32(SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ public static explicit operator SybaseInt32(SybaseString x)
+ {
+ return SybaseInt32.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseInt32(int x)
+ {
+ return new SybaseInt32 (x);
+ }
+
+ public static implicit operator SybaseInt32(SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ public static implicit operator SybaseInt32(SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseInt32 ((int)x.Value);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs
new file mode 100644
index 00000000000..b9ec5870bd8
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs
@@ -0,0 +1,400 @@
+//
+// Mono.Data.SybaseTypes.SybaseInt64
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseInt64 : INullable, IComparable
+ {
+ #region Fields
+
+ long value;
+
+ private bool notNull;
+
+ public static readonly SybaseInt64 MaxValue = new SybaseInt64 (9223372036854775807);
+ public static readonly SybaseInt64 MinValue = new SybaseInt64 (-9223372036854775808);
+
+ public static readonly SybaseInt64 Null;
+ public static readonly SybaseInt64 Zero = new SybaseInt64 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseInt64 (long value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public long Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseInt64 Add (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x + y);
+ }
+
+ public static SybaseInt64 BitwiseAnd (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x & y);
+ }
+
+ public static SybaseInt64 BitwiseOr (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseInt64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseInt64"));
+ else if (((SybaseInt64)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseInt64)value).Value);
+ }
+
+ public static SybaseInt64 Divide (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseInt64))
+ return false;
+ else
+ return (bool) (this == (SybaseInt64)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseInt64 Mod (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x % y);
+ }
+
+ public static SybaseInt64 Multiply (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseInt64 OnesComplement (SybaseInt64 x)
+ {
+ return ~x;
+ }
+
+
+ public static SybaseInt64 Parse (string s)
+ {
+ return new SybaseInt64 (Int64.Parse (s));
+ }
+
+ public static SybaseInt64 Subtract (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x - y);
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte ()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal ()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble ()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16 ()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseMoney ToSybaseMoney ()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle ()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+
+ return value.ToString ();
+ }
+
+ public static SybaseInt64 Xor (SybaseInt64 x, SybaseInt64 y)
+ {
+ return (x ^ y);
+ }
+
+ public static SybaseInt64 operator + (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.Value + y.Value);
+ }
+
+ public static SybaseInt64 operator & (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.value & y.Value);
+ }
+
+ public static SybaseInt64 operator | (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.value | y.Value);
+ }
+
+ public static SybaseInt64 operator / (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.Value / y.Value);
+ }
+
+ public static SybaseBoolean operator == (SybaseInt64 x, SybaseInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseInt64 operator ^ (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.Value ^ y.Value);
+ }
+
+ public static SybaseBoolean operator > (SybaseInt64 x, SybaseInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseInt64 x, SybaseInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseInt64 x, SybaseInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseInt64 x, SybaseInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseInt64 x, SybaseInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ public static SybaseInt64 operator % (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64(x.Value % y.Value);
+ }
+
+ public static SybaseInt64 operator * (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.Value * y.Value);
+ }
+
+ public static SybaseInt64 operator ~ (SybaseInt64 x)
+ {
+ return new SybaseInt64 (~(x.Value));
+ }
+
+ public static SybaseInt64 operator - (SybaseInt64 x, SybaseInt64 y)
+ {
+ return new SybaseInt64 (x.Value - y.Value);
+ }
+
+ public static SybaseInt64 operator - (SybaseInt64 n)
+ {
+ return new SybaseInt64 (-(n.Value));
+ }
+
+ public static explicit operator SybaseInt64 (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.ByteValue);
+ }
+
+ public static explicit operator SybaseInt64 (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ public static explicit operator SybaseInt64 (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ public static explicit operator long (SybaseInt64 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseInt64 (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ public static explicit operator SybaseInt64 (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ public static explicit operator SybaseInt64 (SybaseString x)
+ {
+ return SybaseInt64.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseInt64 (long x)
+ {
+ return new SybaseInt64 (x);
+ }
+
+ public static implicit operator SybaseInt64 (SybaseByte x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ public static implicit operator SybaseInt64 (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ public static implicit operator SybaseInt64 (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return SybaseInt64.Null;
+ else
+ return new SybaseInt64 ((long)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs
new file mode 100644
index 00000000000..81fa78de5a2
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs
@@ -0,0 +1,390 @@
+//
+// Mono.Data.SybaseTypes.SybaseMoney
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseMoney : INullable, IComparable
+ {
+ #region Fields
+
+ decimal value;
+
+ private bool notNull;
+
+ public static readonly SybaseMoney MaxValue = new SybaseMoney (922337203685477.5807);
+ public static readonly SybaseMoney MinValue = new SybaseMoney (-922337203685477.5808);
+ public static readonly SybaseMoney Null;
+ public static readonly SybaseMoney Zero = new SybaseMoney (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseMoney (decimal value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ public SybaseMoney (double value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ public SybaseMoney (int value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ public SybaseMoney (long value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public decimal Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseMoney Add (SybaseMoney x, SybaseMoney y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseMoney))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseMoney"));
+ else if (((SybaseMoney)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseMoney)value).Value);
+ }
+
+ public static SybaseMoney Divide (SybaseMoney x, SybaseMoney y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseMoney))
+ return false;
+ else
+ return (bool) (this == (SybaseMoney)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseMoney x, SybaseMoney y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseMoney x, SybaseMoney y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseMoney x, SybaseMoney y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseMoney x, SybaseMoney y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseMoney x, SybaseMoney y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseMoney Multiply (SybaseMoney x, SybaseMoney y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseMoney x, SybaseMoney y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseMoney Parse (string s)
+ {
+ decimal d = Decimal.Parse (s);
+
+ if (d > SybaseMoney.MaxValue.Value || d < SybaseMoney.MinValue.Value)
+ throw new OverflowException ("");
+
+ return new SybaseMoney (d);
+ }
+
+ public static SybaseMoney Subtract (SybaseMoney x, SybaseMoney y)
+ {
+ return (x - y);
+ }
+
+ public decimal ToDecimal ()
+ {
+ return value;
+ }
+
+ public double ToDouble ()
+ {
+ return (double)value;
+ }
+
+ public int ToInt32 ()
+ {
+ return (int)value;
+ }
+
+ public long ToInt64 ()
+ {
+ return (long)value;
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte ()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal ()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble ()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16 ()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64 ()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseSingle ToSybaseSingle ()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SybaseMoney operator + (SybaseMoney x, SybaseMoney y)
+ {
+ return new SybaseMoney (x.Value + y.Value);
+ }
+
+ public static SybaseMoney operator / (SybaseMoney x, SybaseMoney y)
+ {
+ return new SybaseMoney (x.Value / y.Value);
+ }
+
+ public static SybaseBoolean operator == (SybaseMoney x, SybaseMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseBoolean operator > (SybaseMoney x, SybaseMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseMoney x, SybaseMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseMoney x, SybaseMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseMoney x, SybaseMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseMoney x, SybaseMoney y)
+ {
+ if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ public static SybaseMoney operator * (SybaseMoney x, SybaseMoney y)
+ {
+ return new SybaseMoney (x.Value * y.Value);
+ }
+
+ public static SybaseMoney operator - (SybaseMoney x, SybaseMoney y)
+ {
+ return new SybaseMoney (x.Value - y.Value);
+ }
+
+ public static SybaseMoney operator - (SybaseMoney n)
+ {
+ return new SybaseMoney (-(n.Value));
+ }
+
+ public static explicit operator SybaseMoney (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.ByteValue);
+ }
+
+ public static explicit operator SybaseMoney (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney (x.Value);
+ }
+
+ public static explicit operator SybaseMoney (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.Value);
+ }
+
+ public static explicit operator decimal (SybaseMoney x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseMoney (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.Value);
+ }
+
+ public static explicit operator SybaseMoney (SybaseString x)
+ {
+ return SybaseMoney.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseMoney (decimal x)
+ {
+ return new SybaseMoney (x);
+ }
+
+ public static implicit operator SybaseMoney (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseMoney (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseMoney (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator SybaseMoney (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseMoney ((decimal)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs
new file mode 100644
index 00000000000..0b6029ac921
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs
@@ -0,0 +1,32 @@
+//
+// Mono.Data.SybaseTypes.SybaseNullValueException.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.SybaseTypes {
+ [Serializable]
+ public class SybaseNullValueException : SybaseTypeException
+ {
+ #region Constructors
+
+ public SybaseNullValueException ()
+ : base (Locale.GetText ("The value property is null"))
+ {
+ }
+
+ public SybaseNullValueException (string message)
+ : base (message)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs
new file mode 100644
index 00000000000..f94723345e9
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs
@@ -0,0 +1,335 @@
+//
+// System.Data.SybaseTypes.SybaseSingle
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseSingle : INullable, IComparable
+ {
+ #region Fields
+
+ float value;
+
+ private bool notNull;
+
+ public static readonly SybaseSingle MaxValue = new SybaseSingle (3.40282346638528859e38);
+ public static readonly SybaseSingle MinValue = new SybaseSingle (-3.40282346638528859e38);
+ public static readonly SybaseSingle Null;
+ public static readonly SybaseSingle Zero = new SybaseSingle (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SybaseSingle (double value)
+ {
+ this.value = (float)value;
+ notNull = true;
+ }
+
+ public SybaseSingle (float value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public float Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SybaseSingle Add (SybaseSingle x, SybaseSingle y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseSingle))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseSingle"));
+ else if (((SybaseSingle)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseSingle)value).Value);
+ }
+
+ public static SybaseSingle Divide (SybaseSingle x, SybaseSingle y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SybaseSingle))
+ return false;
+ else
+ return (bool) (this == (SybaseSingle)value);
+ }
+
+ public static SybaseBoolean Equals (SybaseSingle x, SybaseSingle y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ long LongValue = (long) value;
+ return (int)(LongValue ^ (LongValue >> 32));
+ }
+
+ public static SybaseBoolean GreaterThan (SybaseSingle x, SybaseSingle y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual (SybaseSingle x, SybaseSingle y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan (SybaseSingle x, SybaseSingle y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual (SybaseSingle x, SybaseSingle y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseSingle Multiply (SybaseSingle x, SybaseSingle y)
+ {
+ return (x * y);
+ }
+
+ public static SybaseBoolean NotEquals (SybaseSingle x, SybaseSingle y)
+ {
+ return (x != y);
+ }
+
+ public static SybaseSingle Parse (string s)
+ {
+ return new SybaseSingle (Single.Parse (s));
+ }
+
+ public static SybaseSingle Subtract (SybaseSingle x, SybaseSingle y)
+ {
+ return (x - y);
+ }
+
+ public SybaseBoolean ToSybaseBoolean ()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte ()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal ()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble ()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16 ()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32 ()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64 ()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney ()
+ {
+ return ((SybaseMoney)this);
+ }
+
+
+ public SybaseString ToSybaseString ()
+ {
+ return ((SybaseString)this);
+ }
+
+ public override string ToString ()
+ {
+ return value.ToString ();
+ }
+
+ public static SybaseSingle operator + (SybaseSingle x, SybaseSingle y)
+ {
+ return new SybaseSingle (x.Value + y.Value);
+ }
+
+ public static SybaseSingle operator / (SybaseSingle x, SybaseSingle y)
+ {
+ return new SybaseSingle (x.Value / y.Value);
+ }
+
+ public static SybaseBoolean operator == (SybaseSingle x, SybaseSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ public static SybaseBoolean operator > (SybaseSingle x, SybaseSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value > y.Value);
+ }
+
+ public static SybaseBoolean operator >= (SybaseSingle x, SybaseSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value >= y.Value);
+ }
+
+ public static SybaseBoolean operator != (SybaseSingle x, SybaseSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (!(x.Value == y.Value));
+ }
+
+ public static SybaseBoolean operator < (SybaseSingle x, SybaseSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value < y.Value);
+ }
+
+ public static SybaseBoolean operator <= (SybaseSingle x, SybaseSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
+ return new SybaseBoolean (x.Value <= y.Value);
+ }
+
+ public static SybaseSingle operator * (SybaseSingle x, SybaseSingle y)
+ {
+ return new SybaseSingle (x.Value * y.Value);
+ }
+
+ public static SybaseSingle operator - (SybaseSingle x, SybaseSingle y)
+ {
+ return new SybaseSingle (x.Value - y.Value);
+ }
+
+ public static SybaseSingle operator - (SybaseSingle n)
+ {
+ return new SybaseSingle (-(n.Value));
+ }
+
+ public static explicit operator SybaseSingle (SybaseBoolean x)
+ {
+ return new SybaseSingle((float)x.ByteValue);
+ }
+
+ public static explicit operator SybaseSingle (SybaseDouble x)
+ {
+ return new SybaseSingle((float)x.Value);
+ }
+
+ public static explicit operator float (SybaseSingle x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SybaseSingle (SybaseString x)
+ {
+ return SybaseSingle.Parse (x.Value);
+ }
+
+ public static implicit operator SybaseSingle (float x)
+ {
+ return new SybaseSingle (x);
+ }
+
+ public static implicit operator SybaseSingle (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseSingle((float)x.Value);
+ }
+
+ public static implicit operator SybaseSingle (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseSingle((float)x.Value);
+ }
+
+ public static implicit operator SybaseSingle (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseSingle((float)x.Value);
+ }
+
+ public static implicit operator SybaseSingle (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseSingle((float)x.Value);
+ }
+
+ public static implicit operator SybaseSingle (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseSingle((float)x.Value);
+ }
+
+ public static implicit operator SybaseSingle (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseSingle((float)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs
new file mode 100644
index 00000000000..d6d28ed249c
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs
@@ -0,0 +1,457 @@
+//
+// Mono.Data.SybaseTypes.SybaseString
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.SybaseTypes {
+ public struct SybaseString : INullable, IComparable
+ {
+ #region Fields
+
+ string value;
+
+ private bool notNull;
+
+ public static readonly int BinarySort;
+ public static readonly int IgnoreCase;
+ public static readonly int IgnoreKanaType;
+ public static readonly int IgnoreNonSpace;
+ public static readonly int IgnoreWidth;
+ public static readonly SybaseString Null;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ // init with a string data
+ public SybaseString (string data)
+ {
+ this.value = data;
+ notNull = true;
+ }
+
+ // init with a string data and locale id values.
+ [MonoTODO]
+ public SybaseString (string data, int lcid)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options,
+ // and an array of bytes data
+ [MonoTODO]
+ public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with string data, locale id, and compare options
+ [MonoTODO]
+ public SybaseString (string data, int lcid, SybaseCompareOptions compareOptions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // and whether unicode is encoded or not
+ [MonoTODO]
+ public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, bool fUnicode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array,
+ // and number of bytes to copy
+ [MonoTODO]
+ public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array, number of byte to copy,
+ // and whether unicode is encoded or not
+ [MonoTODO]
+ public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+
+ #region Public Properties
+
+ public CompareInfo CompareInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public CultureInfo CultureInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ // geographics location and language (locale id)
+ public int LCID {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public SybaseCompareOptions SybaseCompareOptions {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public string Value {
+ get {
+ if (this.IsNull)
+ throw new SybaseNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ [MonoTODO]
+ public SybaseString Clone()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static CompareOptions CompareOptionsFromSybaseCompareOptions (SybaseCompareOptions compareOptions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // **********************************
+ // Comparison Methods
+ // **********************************
+
+ public int CompareTo(object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SybaseString))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseString"));
+ else if (((SybaseString)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SybaseString)value).Value);
+ }
+
+ public static SybaseString Concat(SybaseString x, SybaseString y)
+ {
+ return (x + y);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is SybaseString))
+ return false;
+ else
+ return (bool) (this == (SybaseString)value);
+ }
+
+ public static SybaseBoolean Equals(SybaseString x, SybaseString y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte[] GetNonUnicodeBytes()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte[] GetUnicodeBytes()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseBoolean GreaterThan(SybaseString x, SybaseString y)
+ {
+ return (x > y);
+ }
+
+ public static SybaseBoolean GreaterThanOrEqual(SybaseString x, SybaseString y)
+ {
+ return (x >= y);
+ }
+
+ public static SybaseBoolean LessThan(SybaseString x, SybaseString y)
+ {
+ return (x < y);
+ }
+
+ public static SybaseBoolean LessThanOrEqual(SybaseString x, SybaseString y)
+ {
+ return (x <= y);
+ }
+
+ public static SybaseBoolean NotEquals(SybaseString x, SybaseString y)
+ {
+ return (x != y);
+ }
+
+ // ****************************************
+ // Type Conversions From SybaseString To ...
+ // ****************************************
+
+ public SybaseBoolean ToSybaseBoolean()
+ {
+ return ((SybaseBoolean)this);
+ }
+
+ public SybaseByte ToSybaseByte()
+ {
+ return ((SybaseByte)this);
+ }
+
+ public SybaseDateTime ToSybaseDateTime()
+ {
+ return ((SybaseDateTime)this);
+ }
+
+ public SybaseDecimal ToSybaseDecimal()
+ {
+ return ((SybaseDecimal)this);
+ }
+
+ public SybaseDouble ToSybaseDouble()
+ {
+ return ((SybaseDouble)this);
+ }
+
+ public SybaseGuid ToSybaseGuid()
+ {
+ return ((SybaseGuid)this);
+ }
+
+ public SybaseInt16 ToSybaseInt16()
+ {
+ return ((SybaseInt16)this);
+ }
+
+ public SybaseInt32 ToSybaseInt32()
+ {
+ return ((SybaseInt32)this);
+ }
+
+ public SybaseInt64 ToSybaseInt64()
+ {
+ return ((SybaseInt64)this);
+ }
+
+ public SybaseMoney ToSybaseMoney()
+ {
+ return ((SybaseMoney)this);
+ }
+
+ public SybaseSingle ToSybaseSingle()
+ {
+ return ((SybaseSingle)this);
+ }
+
+ public override string ToString()
+ {
+ return ((string)this);
+ }
+
+ // ***********************************
+ // Operators
+ // ***********************************
+
+ // Concatenates
+ public static SybaseString operator + (SybaseString x, SybaseString y)
+ {
+ return new SybaseString (x.Value + y.Value);
+ }
+
+ // Equality
+ public static SybaseBoolean operator == (SybaseString x, SybaseString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value == y.Value);
+ }
+
+ // Greater Than
+ public static SybaseBoolean operator > (SybaseString x, SybaseString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // Greater Than Or Equal
+ public static SybaseBoolean operator >= (SybaseString x, SybaseString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ public static SybaseBoolean operator != (SybaseString x, SybaseString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ return new SybaseBoolean (x.Value != y.Value);
+ }
+
+ // Less Than
+ public static SybaseBoolean operator < (SybaseString x, SybaseString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // Less Than Or Equal
+ public static SybaseBoolean operator <= (SybaseString x, SybaseString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SybaseBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // **************************************
+ // Type Conversions
+ // **************************************
+
+ public static explicit operator SybaseString (SybaseBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.ByteValue.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseDateTime x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseGuid x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator SybaseString (SybaseSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SybaseString (x.Value.ToString ());
+ }
+
+ public static explicit operator string (SybaseString x)
+ {
+ return x.Value;
+ }
+
+ public static implicit operator SybaseString (string x)
+ {
+ return new SybaseString (x);
+ }
+
+ #endregion // Public Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs
new file mode 100644
index 00000000000..8423d38ba51
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs
@@ -0,0 +1,32 @@
+//
+// Mono.Data.SybaseTypes.SybaseTruncateException.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.SybaseTypes {
+ [Serializable]
+ public class SybaseTruncateException : SybaseTypeException
+ {
+ #region Constructors
+
+ public SybaseTruncateException ()
+ : base (Locale.GetText ("This value is being truncated"))
+ {
+ }
+
+ public SybaseTruncateException (string message)
+ : base (message)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs
new file mode 100644
index 00000000000..85447ba92c4
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs
@@ -0,0 +1,32 @@
+//
+// Mono.Data.SybaseTypes.SybaseTypeException.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using Mono.Data.SybaseClient;
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.SybaseTypes {
+ [Serializable]
+ public class SybaseTypeException : SystemException
+ {
+ #region Constructors
+
+ public SybaseTypeException (string message)
+ : base (message)
+ {
+ }
+
+ protected SybaseTypeException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/TODOAttribute.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/TODOAttribute.cs
new file mode 100644
index 00000000000..5d534be9dc8
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.SybaseTypes {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.SybaseClient/list b/mcs/class/Mono.Data.SybaseClient/list
new file mode 100644
index 00000000000..51254e1ad8c
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/list
@@ -0,0 +1,41 @@
+Mono.Data.SybaseClient/Locale.cs
+Mono.Data.SybaseClient/SybaseCommand.cs
+Mono.Data.SybaseClient/SybaseCommandBuilder.cs
+Mono.Data.SybaseClient/SybaseConnection.cs
+Mono.Data.SybaseClient/SybaseConnectionPool.cs
+Mono.Data.SybaseClient/SybaseDataAdapter.cs
+Mono.Data.SybaseClient/SybaseDataReader.cs
+Mono.Data.SybaseClient/SybaseError.cs
+Mono.Data.SybaseClient/SybaseErrorCollection.cs
+Mono.Data.SybaseClient/SybaseException.cs
+Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs
+Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs
+Mono.Data.SybaseClient/SybaseParameter.cs
+Mono.Data.SybaseClient/SybaseParameterCollection.cs
+Mono.Data.SybaseClient/SybasePermission.cs
+Mono.Data.SybaseClient/SybasePermissionAttribute.cs
+Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
+Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs
+Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs
+Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs
+Mono.Data.SybaseClient/SybaseTransaction.cs
+Mono.Data.SybaseClient/SybaseType.cs
+Mono.Data.SybaseClient/TODOAttribute.cs
+Mono.Data.SybaseTypes/SybaseBinary.cs
+Mono.Data.SybaseTypes/SybaseBoolean.cs
+Mono.Data.SybaseTypes/SybaseByte.cs
+Mono.Data.SybaseTypes/SybaseCompareOptions.cs
+Mono.Data.SybaseTypes/SybaseDateTime.cs
+Mono.Data.SybaseTypes/SybaseDecimal.cs
+Mono.Data.SybaseTypes/SybaseDouble.cs
+Mono.Data.SybaseTypes/SybaseGuid.cs
+Mono.Data.SybaseTypes/SybaseInt16.cs
+Mono.Data.SybaseTypes/SybaseInt32.cs
+Mono.Data.SybaseTypes/SybaseInt64.cs
+Mono.Data.SybaseTypes/SybaseMoney.cs
+Mono.Data.SybaseTypes/SybaseNullValueException.cs
+Mono.Data.SybaseTypes/SybaseSingle.cs
+Mono.Data.SybaseTypes/SybaseString.cs
+Mono.Data.SybaseTypes/SybaseTruncateException.cs
+Mono.Data.SybaseTypes/SybaseTypeException.cs
+Mono.Data.SybaseTypes/TODOAttribute.cs
diff --git a/mcs/class/Mono.Data.SybaseClient/makefile.gnu b/mcs/class/Mono.Data.SybaseClient/makefile.gnu
new file mode 100644
index 00000000000..97d87331e04
--- /dev/null
+++ b/mcs/class/Mono.Data.SybaseClient/makefile.gnu
@@ -0,0 +1,16 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.SybaseClient.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.EnterpriseServices -r System.Data -r Mono.Data.Tds
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ *TestGDA.cs \
+ ./System.Xml*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.Tds/.cvsignore b/mcs/class/Mono.Data.Tds/.cvsignore
new file mode 100644
index 00000000000..8744e149aac
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/.cvsignore
@@ -0,0 +1,3 @@
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Data.Tds/ChangeLog b/mcs/class/Mono.Data.Tds/ChangeLog
new file mode 100644
index 00000000000..54e830ce44b
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/ChangeLog
@@ -0,0 +1,140 @@
+2002-12-22 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.Tds.Protocol/TdsComm.cs:
+ Change GetString to NOT explicitly add a NUL
+ to the end of the string since Encoder.GetString ()
+ will do that.
+
+2002-12-14 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.Tds.Protocol/Tds70.cs: single quotes in SQL string
+ need to be escaped as two single quotes
+
+2002-12-01 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Remove more unnecessary files.
+ * Mono.Data.Tds.Protocol/TdsDataRow.cs:
+ * Mono.Data.Tds.Protocol/TdsDataColumn.cs:
+ * Mono.Data.Tds.Protocol/TdsDataColumnCollection.cs:
+ New classes
+ * Mono.Data.Tds.Protocol/TdsPacketColumnInfoResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnOrderResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketControlResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketOutputParam.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketRowResult.cs:
+ * Mono.Data.Tds.Protocol/TdsSchemaInfo.cs:
+ Remove obsolete classes
+ * Mono.Data.Tds.Protocol/ITds.cs:
+ * Mono.Data.Tds.Protocol/Tds.cs:
+ * Mono.Data.Tds.Protocol/Tds42.cs:
+ * Mono.Data.Tds.Protocol/Tds50.cs:
+ * Mono.Data.Tds.Protocol/Tds70.cs:
+ * Mono.Data.Tds.Protocol/Tds80.cs:
+ Change Schema and ColumnValues
+
+
+2002-11-30 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Remove unnecessary files.
+ * Mono.Data.Tds.Protocol/TdsPacketEndTokenResult.cs:
+ * Mono.Data.Tds.Protocol/TdsMessage.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketUnknown.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketRetStatResult.cs:
+ Remove these classes as they are unused.
+ * Mono.Data.Tds.Protocol/TdsPacketColumnNamesResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketTableNameResult.cs:
+ Remove these classes, since they are essentially just
+ ArrayLists.
+ * Mono.Data.Tds.Protocol/Tds.cs:
+ * Mono.Data.Tds.Protocol/Tds42.cs:
+ * Mono.Data.Tds.Protocol/Tds50.cs:
+ * Mono.Data.Tds.Protocol/Tds70.cs:
+ Make ProcessSubPacket return an enum instead of instantiating
+ useless classes. Remove the TdsPacketColumnNamesResult
+ and TdsPacketTableNameResult in favour of ArrayLists.
+ * Mono.Data.Tds.Protocol/TdsPacketColumnInfoResult.cs:
+ Add a Count property.
+
+2002-11-26 Tim Coleman <tim@timcoleman.com>
+ * list:
+ * Mono.Data.Tds/TdsMetaParameter.cs:
+ * Mono.Data.Tds/TdsMetaParameterCollection.cs:
+ * Mono.Data.Tds/TdsParameterDirection.cs:
+ * Mono.Data.Tds.Protocol/ITds.cs:
+ * Mono.Data.Tds.Protocol/Tds.cs:
+ * Mono.Data.Tds.Protocol/Tds50.cs:
+ * Mono.Data.Tds.Protocol/Tds70.cs:
+ * Mono.Data.Tds.Protocol/Tds80.cs:
+ * Mono.Data.Tds.Protocol/TdsColumnType.cs:
+ * Mono.Data.Tds.Protocol/TdsComm.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnInfoResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnNamesResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnOrderResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketSubType.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketType.cs:
+ Restructuring around making Sybase and SQL Server
+ support both work with same interface. In particular,
+ the bulk of parameter work is moved into the meta
+ parameter objects from the native objects. The
+ Sybase TDS50 stuff needs intimate access to the parameters.
+ This will also allow me to eventually plonk output values
+ directly into parameters rather than through the current
+ klugey interface.
+
+
+2002-11-24 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.Tds.Protocol/Tds.cs: Change error/
+ message conditions because they were
+ reversed (caused wrongful exceptions).
+
+2002-11-21 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.Tds.build: added missing file
+ for Windows build
+
+2002-11-21 Tim Coleman <tim@timcoleman.com>
+ * list:
+ * ChangeLog:
+ * Mono.Data.Tds.build:
+ * makefile.gnu:
+ * Mono.Data.Tds.Protocol/ITds.cs:
+ * Mono.Data.Tds.Protocol/Tds.cs:
+ * Mono.Data.Tds.Protocol/Tds42.cs:
+ * Mono.Data.Tds.Protocol/Tds50.cs:
+ * Mono.Data.Tds.Protocol/Tds70.cs:
+ * Mono.Data.Tds.Protocol/Tds80.cs:
+ * Mono.Data.Tds.Protocol/TdsBigDecimal.cs:
+ * Mono.Data.Tds.Protocol/TdsColumnStatus.cs:
+ * Mono.Data.Tds.Protocol/TdsColumnType.cs:
+ * Mono.Data.Tds.Protocol/TdsComm.cs:
+ * Mono.Data.Tds.Protocol/TdsConnectionParameters.cs:
+ * Mono.Data.Tds.Protocol/TdsEnvPacketSubType.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalError.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalErrorCollection.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventArgs.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventHandler.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalException.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventArgs.cs:
+ * Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventHandler.cs:
+ * Mono.Data.Tds.Protocol/TdsMessage.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnInfoResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnNamesResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketColumnOrderResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketControlResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketEndTokenResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketOutputParam.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketRetStatResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketRowResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketSubType.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketTableNameResult.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketType.cs:
+ * Mono.Data.Tds.Protocol/TdsPacketUnknown.cs:
+ * Mono.Data.Tds.Protocol/TdsSchemaInfo.cs:
+ * Mono.Data.Tds.Protocol/TdsServerType.cs:
+ * Mono.Data.Tds.Protocol/TdsTimeoutException.cs:
+ * Mono.Data.Tds.Protocol/TdsVersion.cs:
+ * Mono.Data.Tds.Protocol/TODOAttribute.cs:
+ New assembly. The Protocol files came from
+ Mono.Data.TdsClient.Internal, and thus their
+ protection levels and namespaces have changed.
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
new file mode 100644
index 00000000000..818760a65ef
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
@@ -0,0 +1,250 @@
+2002-12-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Tds.cs:
+ (Disconnect): close the stream and set connected to false.
+ (NextResult): check if after DoneProc we have a ColumnMetadata + Row,
+ which holds the values for the output parameters and read them.
+ (LoadRow): add the values to outputParameters if DoneProc.
+ When executing a stored procedure, we execute the procedure and then
+ select the parameter values.
+
+ * Tds70.cs:
+ (BuildParameters): check Parameters.
+
+ * TdsComm.cs: added Close () to close the stream.
+
+ * TdsConnectionParameters.cs: initialize all the string to be empty.
+
+2002-11-04 Tim Coleman (tim@timcoleman.com)
+ * TdsBigDecimal.cs:
+ New class added to handle (potentially) large
+ decimal values
+ * Tds.cs:
+ Modified to use TdsBigDecimal instead of
+ decimal for transit of (potentially) large
+ decimal values
+
+2002-11-03 Tim Coleman (tim@timcoleman.com)
+ * TdsColumnStatus.cs:
+ Newly added to handle column metadata
+ * Tds.cs
+ Handle table name and column detail results
+ * Tds42.cs
+ * Tds50.cs
+ * Tds70.cs
+ rename TableName BaseTableName for consistency
+ * TdsPacketSubType.cs:
+ We now know what subtype 0xa5 is
+ * TdsPacketTableNameResult.cs:
+ Add means to store table names
+ * TdsSchemaInfo.cs:
+ Add new schema information
+
+2002-11-01 Tim Coleman (tim@timcoleman.com)
+ * ITds.cs:
+ Add DoneProc property
+ * Tds.cs:
+ *Lots*. Some stuff to get binary types
+ to work, other stuff to get new prepares
+ working.
+ * TdsPacketEndTokenResult.cs:
+ Add Packetsubtype property
+ * TdsPacketRowResult:
+ Now implements ICollection and IList.
+
+2002-10-31 Tim Coleman (tim@timcoleman.com)
+ * TdsSchemaInfo.cs:
+ Added because I can't really use SchemaInfo
+ * ITds.cs:
+ * Tds.cs :
+ * TdsPacketColumnInfoResult.cs :
+ ChangeDefinition of schema
+ * Tds42.cs :
+ * Tds50.cs :
+ * Tds70.cs :
+ Add new information to schema
+
+
+2002-10-30 Tim Coleman (tim@timcoleman.com)
+ * TdsColumnSchema.cs:
+ Ditch this in favor of System.Data.Common.SchemaInfo
+ * ITds.cs:
+ Change ColumnInfo to Schema
+ * Tds.cs:
+ Uses new SchemaInfo object
+ Supports TEXT now.
+ * Tds42.cs:
+ * Tds50.cs:
+ * Tds70.cs:
+ * TdsPacketColumnInfoResult.cs:
+ * TdsPacketRowResult.cs:
+ Uses new SchemaInfo object
+
+
+2002-10-29 Tim Coleman (tim@timcoleman.com)
+ * ITds.cs:
+ Add OutputParameters collection
+ * Tds.cs:
+ Much reformatting, added handling for dates,
+ fixed handling of output parameters, and a
+ whole lot more
+ * TdsPacketEndTokenResult.cs:
+ Remove incorrect exception
+ * TdsPacketType.cs:
+ Add Logoff packet type.
+
+2002-10-28 Tim Coleman (tim@timcoleman.com)
+ * Tds.cs:
+ Add much handling to get the following types
+ working in queries: string, int, decimal
+ All sorts of other bug fixing and general
+ purpose hackery.
+ * Tds42.cs:
+ * Tds50.cs:
+ * Tds70.cs:
+ ProcessColumnInfo was abstracted in Tds.cs
+ and subclassed, because 7.0 provides the information
+ in a different format.
+ * TdsColumnSchema.cs:
+ Added size, precision, scale
+ * TdsComm.cs:
+ Fixed GetString because it wasn't working properly
+ with TDS 7.0.
+ * TdsMessage.cs:
+ Change state and severity to byte instead of int
+ because that is more consitent.
+
+
+2002-10-25 Tim Coleman (tim@timcoleman.com)
+ * TdsPacketErrorResultCollection.cs:
+ New class added for exporting errors
+ * ITds.cs:
+ * Tds.cs:
+ * Tds70.cs:
+ * TdsComm.cs:
+ * TdsPacketEndTokenResult.cs:
+ * TdsPacketRowResult.cs:
+ Changes to make SqlClient build.
+
+2002-10-24 Tim Coleman (tim@timcoleman.com)
+ * ITds.cs:
+ Added column info, and NextResult/NextRow
+ to interface
+ * TdsColumnSchema.cs:
+ New class added to keep track of column info
+ * Tds.cs:
+ Many, many changes to get queries working
+ for the most part.
+ * TdsPacketColumnInfoResult.cs:
+ * TdsPacketColumnNamesResult.cs:
+ Doesn't use a DataColumnCollection anymore
+ Also more complete.
+ * TdsPacketRowResult.cs:
+ Added Add() method.
+
+2002-10-23 Tim Coleman (tim@timcoleman.com)
+ * ITds.cs:
+ * Tds42.cs:
+ * Tds50.cs:
+ * Tds70.cs:
+ * Tds80.cs:
+ New classes added. Functionality
+ is split up because different protocols
+ have slight differences.
+ * Tds.cs:
+ Remove some unnecessary code after
+ the above split, and add in a whole
+ lot more stuff for completeness.
+ * TdsColumnType.cs:
+ Fix Int4. Wrong enum value.
+ * TdsComm.cs:
+ Move the encoder out of constructor
+ because we don't know the charset at
+ that point
+ * TdsConnectionParameters.cs:
+ Small changes
+ * TdsPacketEndTokenResult.cs:
+ Implement ToString ()
+
+
+2002-10-22 Tim Coleman (tim@timcoleman.com)
+ * Tds.cs :
+ More implementation. Does some
+ query stuff now. Can also change
+ database.
+ * TdsConnectionParameters.cs:
+ Rename Host to DataSource, and
+ add Hostname for the local hostname.
+ * TdsPacketEndTokenResult.cs:
+ Change TODO attribute
+ * TODOAttribute.cs:
+ New class added
+
+
+2002-10-21 Tim Coleman (tim@timcoleman.com)
+ * Tds.cs
+ * TdsComm.cs:
+ A whole slew of changes to get logon
+ to work (it now works in both TDS 7.0
+ and TDS 4.2) ... danmorg can test with
+ 8.0 if he likes.
+ TdsComm has some simplifications too,
+ because C# has some features not present
+ in the Java implementation.
+ * TdsConnectionParameters.cs:
+ Change a few default values.
+ * TdsMessage.cs:
+ Implement this class.
+
+2002-10-20 Tim Coleman (tim@timcoleman.com)
+ * TdsColumnType.cs:
+ * TdsContext.cs:
+ * TdsEnvPacketSubType.cs:
+ * TdsMessage.cs:
+ * TdsPacketColumnInfoResult.cs:
+ * TdsPacketColumnNamesResult.cs:
+ * TdsPacketColumnOrderResult.cs:
+ * TdsPacketControlResult.cs:
+ * TdsPacketEndTokenResult.cs:
+ * TdsPacketErrorResult.cs:
+ * TdsPacketMessageResult.cs:
+ * TdsPacketOutputParam.cs:
+ * TdsPacketResult.cs:
+ * TdsPacketRetStatResult.cs:
+ * TdsPacketRowResult.cs:
+ * TdsPacketSubType.cs:
+ * TdsPacketTableNameResult.cs:
+ * TdsPacketUnknown.cs:
+ New classes added as part of TDS internal implementation.
+ * Tds.cs:
+ Some work on receiving and interpreting packages received from
+ SQL Server. Still doesn't work completely.
+ * TdsComm.cs:
+ Add some methods as part of the ongoing work with Tds.cs
+ * TdsConnectionParameters.cs:
+ Add default values for Encoding ("iso-8859-1"), Port (1433),
+ TDS Version (4.2).
+
+2002-10-18 Tim Coleman (tim@timcoleman.com)
+ * TdsConnectionInternal:
+ Add some implementation details
+ * TdsCommInternal:
+ New class, which will handle the low-level
+ communication with the database
+ * TdsPacketTypeInternal:
+ Add new packet type, TdsPacketTypeInternal.None
+ which is used when no packet is being constructed.
+ The value is 0.
+
+2002-10-17 Tim Coleman (tim@timcoleman.com)
+ * ChangeLog:
+ New changelog added
+ * TdsCommandInternal.cs:
+ * TdsConnectionInternal.cs:
+ * TdsPacketTypeInternal.cs:
+ * TdsServerTypeInternal.cs:
+ * TdsTransactionInternal.cs:
+ * TdsVersionInternal.cs:
+ New classes added. These are the
+ internal implementations, meant for
+ "wrapping" from other locations.
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ITds.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ITds.cs
new file mode 100644
index 00000000000..26745edbc92
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ITds.cs
@@ -0,0 +1,86 @@
+//
+// Mono.Data.Tds.Protocol.ITds.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds;
+using System;
+using System.Collections;
+
+namespace Mono.Data.Tds.Protocol {
+ public interface ITds
+ {
+ #region Properties
+
+ string Database {
+ get;
+ }
+
+ bool DoneProc {
+ get;
+ }
+
+ bool IsConnected {
+ get;
+ }
+
+ string ServerVersion {
+ get;
+ }
+
+ TdsDataColumnCollection Columns {
+ get;
+ }
+
+ TdsDataRow ColumnValues {
+ get;
+ }
+
+ ArrayList OutputParameters {
+ get;
+ set;
+ }
+
+ int RecordsAffected {
+ get;
+ set;
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ void Cancel ();
+ bool Connect (TdsConnectionParameters connectionParameters);
+ void Disconnect ();
+
+ void Execute (string commandText);
+ void ExecProc (string procedure);
+
+ void Execute (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults);
+ void ExecPrepared (string statementId, TdsMetaParameterCollection parameters, int timeout, bool wantResults);
+ void ExecProc (string procedure, TdsMetaParameterCollection parameters, int timeout, bool wantResults);
+
+ bool NextResult ();
+ bool NextRow ();
+
+ string Prepare (string commandText, TdsMetaParameterCollection parameters);
+
+ void SkipToEnd ();
+
+ void Unprepare (string statementId);
+
+ #endregion
+
+ #region Events
+
+ event TdsInternalErrorMessageEventHandler TdsErrorMessage;
+ event TdsInternalInfoMessageEventHandler TdsInfoMessage;
+
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TODOAttribute.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TODOAttribute.cs
new file mode 100644
index 00000000000..5936e6bfa26
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ public class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs
new file mode 100644
index 00000000000..85c2027c2dc
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs
@@ -0,0 +1,1191 @@
+//
+// Mono.Data.Tds.Protocol.Tds.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Net.Sockets;
+using System.Text;
+
+namespace Mono.Data.Tds.Protocol {
+ public abstract class Tds : Component, ITds
+ {
+ #region Fields
+
+ TdsComm comm;
+ TdsVersion tdsVersion;
+
+ int packetSize;
+ string dataSource;
+ string database;
+ string databaseProductName;
+ string databaseProductVersion;
+ int databaseMajorVersion;
+
+ string charset;
+ string language;
+
+ bool connected = false;
+ bool moreResults;
+
+ Encoding encoder;
+ bool autoCommit;
+
+ bool doneProc;
+ TdsDataRow currentRow = null;
+ TdsDataColumnCollection columns;
+
+ ArrayList tableNames;
+ ArrayList columnNames;
+
+ TdsMetaParameterCollection parameters;
+
+ bool queryInProgress;
+ int cancelsRequested;
+ int cancelsProcessed;
+
+ bool isDone;
+ bool isDoneInProc;
+
+ ArrayList outputParameters = new ArrayList ();
+ protected TdsInternalErrorCollection messages = new TdsInternalErrorCollection ();
+
+ int recordsAffected = 0;
+
+ #endregion // Fields
+
+ #region Properties
+
+ protected string Charset {
+ get { return charset; }
+ }
+
+ public bool DoneProc {
+ get { return doneProc; }
+ }
+
+ protected string Language {
+ get { return language; }
+ }
+
+ protected ArrayList ColumnNames {
+ get { return columnNames; }
+ }
+
+ public TdsDataRow ColumnValues {
+ get { return currentRow; }
+ }
+
+ internal TdsComm Comm {
+ get { return comm; }
+ }
+
+ public string Database {
+ get { return database; }
+ }
+
+ public string DataSource {
+ get { return dataSource; }
+ }
+
+ public bool IsConnected {
+ get { return connected; }
+ set { connected = value; }
+ }
+
+ public bool MoreResults {
+ get { return moreResults; }
+ set { moreResults = value; }
+ }
+
+ public int PacketSize {
+ get { return packetSize; }
+ }
+
+ public int RecordsAffected {
+ get { return recordsAffected; }
+ set { recordsAffected = value; }
+ }
+
+ public string ServerVersion {
+ get { return databaseProductVersion; }
+ }
+
+ public TdsDataColumnCollection Columns {
+ get { return columns; }
+ }
+
+ public TdsVersion TdsVersion {
+ get { return tdsVersion; }
+ }
+
+ public ArrayList OutputParameters {
+ get { return outputParameters; }
+ set { outputParameters = value; }
+ }
+
+ protected TdsMetaParameterCollection Parameters {
+ get { return parameters; }
+ set { parameters = value; }
+ }
+
+ #endregion // Properties
+
+ #region Events
+
+ public event TdsInternalErrorMessageEventHandler TdsErrorMessage;
+ public event TdsInternalInfoMessageEventHandler TdsInfoMessage;
+
+ #endregion // Events
+
+ #region Constructors
+
+ public Tds (string dataSource, int port, int packetSize, int timeout, TdsVersion tdsVersion)
+ {
+ this.tdsVersion = tdsVersion;
+ this.packetSize = packetSize;
+ this.dataSource = dataSource;
+
+ comm = new TdsComm (dataSource, port, packetSize, timeout, tdsVersion);
+ }
+
+ #endregion // Constructors
+
+ #region Public Methods
+
+ public void Cancel ()
+ {
+ if (queryInProgress) {
+ if (cancelsRequested == cancelsProcessed) {
+ comm.StartPacket (TdsPacketType.Cancel);
+ comm.SendPacket ();
+ cancelsRequested += 1;
+ }
+ }
+ }
+
+ public abstract bool Connect (TdsConnectionParameters connectionParameters);
+
+ public static TdsTimeoutException CreateTimeoutException (string dataSource, string method)
+ {
+ string message = "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.";
+ return new TdsTimeoutException (0, 0, message, -2, method, dataSource, "Mono TdsClient Data Provider", 0);
+ }
+
+ public void Disconnect ()
+ {
+ comm.StartPacket (TdsPacketType.Logoff);
+ comm.Append ((byte) 0);
+ comm.SendPacket ();
+ comm.Close ();
+ connected = false;
+ }
+
+ public void Execute (string sql)
+ {
+ Execute (sql, null, 0, false);
+ }
+
+ public void ExecProc (string sql)
+ {
+ ExecProc (sql, null, 0, false);
+ }
+
+ public virtual void Execute (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ ExecuteQuery (sql, timeout, wantResults);
+ }
+
+ public virtual void ExecProc (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ ExecuteQuery (String.Format ("exec {0}", sql), timeout, wantResults);
+ }
+
+ public virtual void ExecPrepared (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ throw new NotSupportedException ();
+ }
+
+ protected void ExecuteQuery (string sql, int timeout, bool wantResults)
+ {
+ moreResults = true;
+ doneProc = false;
+ messages.Clear ();
+ outputParameters.Clear ();
+
+ Comm.StartPacket (TdsPacketType.Query);
+ Comm.Append (sql);
+ Comm.SendPacket ();
+
+ CheckForData (timeout);
+ if (!wantResults)
+ SkipToEnd ();
+ }
+
+ public bool NextResult ()
+ {
+ if (!moreResults)
+ return false;
+
+ TdsPacketSubType subType;
+
+ bool done = false;
+ bool outputParams = false;
+
+ while (!done) {
+ subType = ProcessSubPacket ();
+ if (outputParams) {
+ moreResults = false;
+ break;
+ }
+
+ switch (subType) {
+ case TdsPacketSubType.ColumnInfo:
+ case TdsPacketSubType.ColumnMetadata:
+ case TdsPacketSubType.RowFormat:
+ byte peek = Comm.Peek ();
+ done = (peek != (byte) TdsPacketSubType.TableName);
+ if (done && doneProc && peek == (byte) TdsPacketSubType.Row) {
+ outputParams = true;
+ done = false;
+ }
+
+ break;
+ case TdsPacketSubType.TableName:
+ done = true;
+ break;
+ default:
+ done = !moreResults;
+ break;
+ }
+ }
+
+ return moreResults;
+ }
+
+ public bool NextRow ()
+ {
+ TdsPacketSubType subType;
+ bool done = false;
+ bool result = false;
+
+ do {
+ subType = ProcessSubPacket ();
+ switch (subType) {
+ case TdsPacketSubType.Row:
+ result = true;
+ done = true;
+ break;
+ case TdsPacketSubType.Done:
+ case TdsPacketSubType.DoneProc:
+ case TdsPacketSubType.DoneInProc:
+ result = false;
+ done = true;
+ break;
+ }
+ } while (!done);
+
+ return result;
+ }
+
+ public virtual string Prepare (string sql, TdsMetaParameterCollection parameters)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void SkipToEnd ()
+ {
+ while (NextResult ()) { /* DO NOTHING */ }
+ }
+
+ public virtual void Unprepare (string statementId)
+ {
+ throw new NotSupportedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region // Private Methods
+
+ [MonoTODO ("Is cancel enough, or do we need to drop the connection?")]
+ protected void CheckForData (int timeout)
+ {
+ if (timeout > 0 && !comm.Poll (timeout, SelectMode.SelectRead)) {
+ Cancel ();
+ throw CreateTimeoutException (dataSource, "CheckForData()");
+ }
+ }
+
+ protected TdsInternalInfoMessageEventArgs CreateTdsInfoMessageEvent (TdsInternalErrorCollection errors)
+ {
+ return new TdsInternalInfoMessageEventArgs (errors);
+ }
+
+ protected TdsInternalErrorMessageEventArgs CreateTdsErrorMessageEvent (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ return new TdsInternalErrorMessageEventArgs (new TdsInternalError (theClass, lineNumber, message, number, procedure, server, source, state));
+ }
+
+ private object GetColumnValue (TdsColumnType colType, bool outParam)
+ {
+ return GetColumnValue (colType, outParam, -1);
+ }
+
+ private object GetColumnValue (TdsColumnType colType, bool outParam, int ordinal)
+ {
+ int len;
+ object element = null;
+
+ switch (colType) {
+ case TdsColumnType.IntN :
+ if (outParam)
+ comm.Skip (1);
+ element = GetIntValue (colType);
+ break;
+ case TdsColumnType.Int1 :
+ case TdsColumnType.Int2 :
+ case TdsColumnType.Int4 :
+ element = GetIntValue (colType);
+ break;
+ case TdsColumnType.Image :
+ if (outParam)
+ comm.Skip (1);
+ element = GetImageValue ();
+ break;
+ case TdsColumnType.Text :
+ if (outParam)
+ comm.Skip (1);
+ element = GetTextValue (false);
+ break;
+ case TdsColumnType.NText :
+ if (outParam)
+ comm.Skip (1);
+ element = GetTextValue (true);
+ break;
+ case TdsColumnType.Char :
+ case TdsColumnType.VarChar :
+ if (outParam)
+ comm.Skip (1);
+ element = GetStringValue (false, false);
+ break;
+ case TdsColumnType.BigVarBinary :
+ comm.GetTdsShort ();
+ len = comm.GetTdsShort ();
+ element = comm.GetBytes (len, true);
+ break;
+ case TdsColumnType.BigVarChar :
+ comm.Skip (2);
+ element = GetStringValue (false, false);
+ break;
+ case TdsColumnType.NChar :
+ case TdsColumnType.NVarChar :
+ if (outParam)
+ comm.Skip (1);
+ element = GetStringValue (true, false);
+ break;
+ case TdsColumnType.Real :
+ case TdsColumnType.Float8 :
+ element = GetFloatValue (colType);
+ break;
+ case TdsColumnType.FloatN :
+ if (outParam)
+ comm.Skip (1);
+ element = GetFloatValue (colType);
+ break;
+ case TdsColumnType.SmallMoney :
+ case TdsColumnType.Money :
+ element = GetMoneyValue (colType);
+ break;
+ case TdsColumnType.MoneyN :
+ if (outParam)
+ comm.Skip (1);
+ element = GetMoneyValue (colType);
+ break;
+ case TdsColumnType.Numeric :
+ case TdsColumnType.Decimal :
+ byte precision;
+ byte scale;
+ if (outParam) {
+ comm.Skip (1);
+ precision = comm.GetByte ();
+ scale = comm.GetByte ();
+ }
+ else {
+ precision = (byte) columns[ordinal]["NumericPrecision"];
+ scale = (byte) columns[ordinal]["NumericScale"];
+ }
+
+ element = GetDecimalValue (precision, scale);
+ break;
+ case TdsColumnType.DateTimeN :
+ if (outParam)
+ comm.Skip (1);
+ element = GetDateTimeValue (colType);
+ break;
+ case TdsColumnType.DateTime4 :
+ case TdsColumnType.DateTime :
+ element = GetDateTimeValue (colType);
+ break;
+ case TdsColumnType.VarBinary :
+ case TdsColumnType.Binary :
+ if (outParam)
+ comm.Skip (1);
+ element = GetBinaryValue ();
+ break;
+ case TdsColumnType.BitN :
+ if (outParam)
+ comm.Skip (1);
+ if (comm.GetByte () == 0)
+ element = null;
+ else
+ element = (comm.GetByte() != 0);
+ break;
+ case TdsColumnType.Bit :
+ int columnSize = comm.GetByte ();
+ element = (columnSize != 0);
+ break;
+ case TdsColumnType.UniqueIdentifier :
+ if (comm.Peek () != 16) // If it's null, then what to do?
+ break;
+
+ len = comm.GetByte () & 0xff;
+ if (len > 0) {
+ byte[] guidBytes = comm.GetBytes (len, true);
+ element = new Guid (guidBytes);
+ }
+ break;
+ default :
+ return null;
+ }
+
+ return element;
+ }
+
+ private object GetBinaryValue ()
+ {
+ int len;
+ object result = null;
+ if (tdsVersion == TdsVersion.tds70) {
+ len = comm.GetTdsShort ();
+ if (len != 0xffff && len > 0)
+ result = comm.GetBytes (len, true);
+ }
+ else {
+ len = (comm.GetByte () & 0xff);
+ if (len != 0)
+ result = comm.GetBytes (len, true);
+ }
+ return result;
+ }
+
+ private object GetDateTimeValue (TdsColumnType type)
+ {
+ int len = 0;
+ object result = null;
+
+ switch (type) {
+ case TdsColumnType.DateTime4:
+ len = 4;
+ break;
+ case TdsColumnType.DateTime:
+ len = 8;
+ break;
+ case TdsColumnType.DateTimeN:
+ byte tmp = comm.Peek ();
+ if (tmp != 0 && tmp != 4 && tmp != 8)
+ break;
+ len = comm.GetByte ();
+ break;
+ }
+
+ DateTime epoch = new DateTime (1900, 1, 1);
+
+ switch (len) {
+ case 8 :
+ result = epoch.AddDays (comm.GetTdsInt ());
+ int seconds = comm.GetTdsInt ();
+ long millis = ((((long) seconds) % 300L) * 1000L) / 300L;
+ if (seconds != 0 || millis != 0) {
+ result = ((DateTime) result).AddSeconds (seconds / 300);
+ result = ((DateTime) result).AddMilliseconds (millis);
+ }
+ break;
+ case 4 :
+ result = epoch.AddDays ((int) comm.GetTdsShort ());
+ short minutes = comm.GetTdsShort ();
+ if (minutes != 0)
+ result = ((DateTime) result).AddMinutes ((int) minutes);
+ break;
+ }
+
+ return result;
+ }
+
+ private object GetDecimalValue (byte precision, byte scale)
+ {
+ int[] bits = new int[4] {0,0,0,0};
+
+ int len = (comm.GetByte() & 0xff) - 1;
+ bool positive = (comm.GetByte () == 1);
+
+ if (len < 0)
+ return null;
+ if (len > 16)
+ throw new OverflowException ();
+
+ for (int i = 0, index = 0; i < len && i < 16; i += 4, index += 1)
+ bits[index] = comm.GetTdsInt ();
+
+ if (bits [3] != 0)
+ return new TdsBigDecimal (precision, scale, !positive, bits);
+ else
+ return new Decimal (bits[0], bits[1], bits[2], !positive, scale);
+ }
+
+ private object GetFloatValue (TdsColumnType columnType)
+ {
+ int columnSize = 0;
+ object result = null;
+
+ switch (columnType) {
+ case TdsColumnType.Real:
+ columnSize = 4;
+ break;
+ case TdsColumnType.Float8:
+ columnSize = 8;
+ break;
+ case TdsColumnType.FloatN:
+ columnSize = comm.GetByte ();
+ break;
+ }
+
+ switch (columnSize) {
+ case 8 :
+ result = BitConverter.Int64BitsToDouble (comm.GetTdsInt64 ());
+ break;
+ case 4 :
+ result = BitConverter.ToSingle (BitConverter.GetBytes (comm.GetTdsInt ()), 0);
+ break;
+ }
+
+ return result;
+ }
+
+ private object GetImageValue ()
+ {
+ byte hasValue = comm.GetByte ();
+
+ if (hasValue == 0)
+ return null;
+
+ comm.Skip (24);
+ int len = comm.GetTdsInt ();
+
+ if (len < 0)
+ return null;
+
+ return (comm.GetBytes (len, true));
+ }
+
+ private object GetIntValue (TdsColumnType type)
+ {
+ int len;
+
+ switch (type) {
+ case TdsColumnType.IntN :
+ len = comm.GetByte ();
+ break;
+ case TdsColumnType.Int4 :
+ len = 4;
+ break;
+ case TdsColumnType.Int2 :
+ len = 2;
+ break;
+ case TdsColumnType.Int1 :
+ len = 1;
+ break;
+ default:
+ return null;
+ }
+
+ switch (len) {
+ case 4 :
+ return (comm.GetTdsInt ());
+ case 2 :
+ return (comm.GetTdsShort ());
+ case 1 :
+ return (comm.GetByte ());
+ default:
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ private object GetMoneyValue (TdsColumnType type)
+ {
+ int len;
+ object result = null;
+
+ switch (type) {
+ case TdsColumnType.SmallMoney :
+ case TdsColumnType.Money4 :
+ len = 4;
+ break;
+ case TdsColumnType.Money :
+ len = 8;
+ break;
+ case TdsColumnType.MoneyN :
+ len = comm.GetByte ();
+ break;
+ default:
+ return null;
+ }
+
+ long rawValue = 0;
+
+ switch (len) {
+ case 4:
+ rawValue = comm.GetTdsInt ();
+ break;
+ case 8:
+ byte[] bits = new byte[8];
+ bits[4] = comm.GetByte ();
+ bits[5] = comm.GetByte ();
+ bits[6] = comm.GetByte ();
+ bits[7] = comm.GetByte ();
+ bits[0] = comm.GetByte ();
+ bits[1] = comm.GetByte ();
+ bits[2] = comm.GetByte ();
+ bits[3] = comm.GetByte ();
+ rawValue = BitConverter.ToInt64 (bits, 0);
+ break;
+ default:
+ return null;
+ }
+
+ result = new Decimal (rawValue);
+
+ return (((decimal) result) / 10000);
+ }
+
+ private object GetStringValue (bool wideChars, bool outputParam)
+ {
+ object result = null;
+ bool shortLen = (tdsVersion == TdsVersion.tds70) && (wideChars || !outputParam);
+
+ int len = shortLen ? comm.GetTdsShort () : (comm.GetByte () & 0xff);
+
+ if ((tdsVersion < TdsVersion.tds70 && len == 0) || (tdsVersion == TdsVersion.tds70 && len == 0xff))
+ result = null;
+ else if (len >= 0) {
+ if (wideChars)
+ result = comm.GetString (len / 2);
+ else
+ result = comm.GetString (len, false);
+ if (tdsVersion < TdsVersion.tds70 && ((string) result).Equals (" "))
+ result = "";
+ }
+ else
+ result = null;
+ return result;
+ }
+
+ protected int GetSubPacketLength ()
+ {
+ return comm.GetTdsShort ();
+ }
+
+ private object GetTextValue (bool wideChars)
+ {
+ string result = null;
+ byte hasValue = comm.GetByte ();
+
+ if (hasValue != 16)
+ return null;
+
+ // 16 Byte TEXTPTR, 8 Byte TIMESTAMP
+ comm.Skip (24);
+
+ int len = comm.GetTdsInt ();
+
+ if (len == 0)
+ return null;
+
+ if (wideChars)
+ result = comm.GetString (len / 2);
+ else
+ result = comm.GetString (len, false);
+ len /= 2;
+
+ if ((byte) tdsVersion < (byte) TdsVersion.tds70 && result == " ")
+ result = "";
+
+ return result;
+ }
+
+ internal static bool IsFixedSizeColumn (TdsColumnType columnType)
+ {
+ switch (columnType) {
+ case TdsColumnType.Int1 :
+ case TdsColumnType.Int2 :
+ case TdsColumnType.Int4 :
+ case TdsColumnType.Float8 :
+ case TdsColumnType.DateTime :
+ case TdsColumnType.Bit :
+ case TdsColumnType.Money :
+ case TdsColumnType.Money4 :
+ case TdsColumnType.SmallMoney :
+ case TdsColumnType.Real :
+ case TdsColumnType.DateTime4 :
+ return true;
+ case TdsColumnType.IntN :
+ case TdsColumnType.MoneyN :
+ case TdsColumnType.VarChar :
+ case TdsColumnType.NVarChar :
+ case TdsColumnType.DateTimeN :
+ case TdsColumnType.FloatN :
+ case TdsColumnType.Char :
+ case TdsColumnType.NChar :
+ case TdsColumnType.NText :
+ case TdsColumnType.Image :
+ case TdsColumnType.VarBinary :
+ case TdsColumnType.Binary :
+ case TdsColumnType.Decimal :
+ case TdsColumnType.Numeric :
+ case TdsColumnType.BitN :
+ case TdsColumnType.UniqueIdentifier :
+ return false;
+ default :
+ return false;
+ }
+ }
+
+ protected void LoadRow ()
+ {
+ currentRow = new TdsDataRow ();
+
+ int i = 0;
+ foreach (TdsDataColumn column in columns) {
+ object o = GetColumnValue ((TdsColumnType) column["ColumnType"], false, i);
+ currentRow.Add (o);
+ if (doneProc)
+ outputParameters.Add (o);
+
+ if (o is TdsBigDecimal && currentRow.BigDecimalIndex < 0)
+ currentRow.BigDecimalIndex = i;
+ i += 1;
+ }
+ }
+
+ internal static int LookupBufferSize (TdsColumnType columnType)
+ {
+ switch (columnType) {
+ case TdsColumnType.Int1 :
+ case TdsColumnType.Bit :
+ return 1;
+ case TdsColumnType.Int2 :
+ return 2;
+ case TdsColumnType.Int4 :
+ case TdsColumnType.Real :
+ case TdsColumnType.DateTime4 :
+ case TdsColumnType.Money4 :
+ case TdsColumnType.SmallMoney :
+ return 4;
+ case TdsColumnType.Float8 :
+ case TdsColumnType.DateTime :
+ case TdsColumnType.Money :
+ return 8;
+ default :
+ return 0;
+ }
+ }
+
+ private int LookupDisplaySize (TdsColumnType columnType)
+ {
+ switch (columnType) {
+ case TdsColumnType.Int1 :
+ return 3;
+ case TdsColumnType.Int2 :
+ return 6;
+ case TdsColumnType.Int4 :
+ return 11;
+ case TdsColumnType.Real :
+ return 14;
+ case TdsColumnType.Float8 :
+ return 24;
+ case TdsColumnType.DateTime :
+ return 23;
+ case TdsColumnType.DateTime4 :
+ return 16;
+ case TdsColumnType.Bit :
+ return 1;
+ case TdsColumnType.Money :
+ return 21;
+ case TdsColumnType.Money4 :
+ case TdsColumnType.SmallMoney :
+ return 12;
+ default:
+ return 0;
+ }
+ }
+
+ protected void ProcessColumnDetail ()
+ {
+ int len = GetSubPacketLength ();
+ byte[] values = new byte[3];
+ int columnNameLength;
+ string baseColumnName = String.Empty;
+ int position = 0;
+
+ while (position < len) {
+ for (int j = 0; j < 3; j += 1)
+ values[j] = comm.GetByte ();
+ position += 3;
+
+ if ((values[2] & (byte) TdsColumnStatus.Rename) != 0) {
+ if (tdsVersion == TdsVersion.tds70) {
+ columnNameLength = comm.GetByte ();
+ position += 2 * len + 1;
+ }
+ else {
+ columnNameLength = comm.GetByte ();
+ position += len + 1;
+ }
+ baseColumnName = comm.GetString (columnNameLength);
+ }
+
+ if ((values[2] & (byte) TdsColumnStatus.Hidden) == 0) {
+ byte index = (byte) (values[0] - (byte) 1);
+ byte tableIndex = (byte) (values[1] - (byte) 1);
+
+ columns [index]["IsExpression"] = ((values[2] & (byte) TdsColumnStatus.IsExpression) != 0);
+ columns [index]["IsKey"] = ((values[2] & (byte) TdsColumnStatus.IsKey) != 0);
+
+ if ((values[2] & (byte) TdsColumnStatus.Rename) != 0)
+ columns [index]["BaseColumnName"] = baseColumnName;
+ columns [index]["BaseTableName"] = tableNames [tableIndex];
+ }
+ }
+ }
+
+ protected abstract TdsDataColumnCollection ProcessColumnInfo ();
+
+ protected void ProcessColumnNames ()
+ {
+ columnNames = new ArrayList ();
+
+ int totalLength = comm.GetTdsShort ();
+ int bytesRead = 0;
+ int i = 0;
+
+ while (bytesRead < totalLength) {
+ int columnNameLength = comm.GetByte ();
+ string columnName = comm.GetString (columnNameLength);
+ bytesRead = bytesRead + 1 + columnNameLength;
+ columnNames.Add (columnName);
+ i += 1;
+ }
+ }
+
+ [MonoTODO ("Make sure counting works right, especially with multiple resultsets.")]
+ protected void ProcessEndToken (TdsPacketSubType type)
+ {
+ byte status = Comm.GetByte ();
+ Comm.Skip (1);
+ byte op = comm.GetByte ();
+ Comm.Skip (1);
+
+ int rowCount = comm.GetTdsInt ();
+
+ if (op == (byte) 0xc1)
+ rowCount = 0;
+ if (type == TdsPacketSubType.DoneInProc)
+ rowCount = -1;
+
+ moreResults = ((status & 0x01) != 0);
+ bool cancelled = ((status & 0x20) != 0);
+
+ if (type == TdsPacketSubType.DoneProc) {
+ doneProc = true;
+ if (rowCount > 0)
+ recordsAffected += rowCount;
+ }
+
+ if (moreResults)
+ queryInProgress = false;
+ if (cancelled)
+ cancelsProcessed += 1;
+ if (messages.Count > 0 && !moreResults)
+ OnTdsInfoMessage (CreateTdsInfoMessageEvent (messages));
+ }
+
+ protected void ProcessEnvironmentChange ()
+ {
+ int len = GetSubPacketLength ();
+ TdsEnvPacketSubType type = (TdsEnvPacketSubType) comm.GetByte ();
+ int cLen;
+
+ switch (type) {
+ case TdsEnvPacketSubType.BlockSize :
+ string blockSize;
+ cLen = comm.GetByte () & 0xff;
+ blockSize = comm.GetString (cLen);
+
+ if (tdsVersion == TdsVersion.tds70)
+ comm.Skip (len - 2 - cLen * 2);
+ else
+ comm.Skip (len - 2 - cLen);
+
+ comm.ResizeOutBuf (Int32.Parse (blockSize));
+ break;
+ case TdsEnvPacketSubType.CharSet :
+ cLen = comm.GetByte () & 0xff;
+ if (tdsVersion == TdsVersion.tds70) {
+ //this.language = comm.GetString (cLen); // FIXME
+ comm.GetString (cLen);
+ comm.Skip (len - 2 - cLen * 2);
+ }
+ else {
+ SetCharset (comm.GetString (cLen));
+ comm.Skip (len - 2 - cLen);
+ }
+
+ break;
+ case TdsEnvPacketSubType.Database :
+ cLen = comm.GetByte () & 0xff;
+ string newDB = comm.GetString (cLen);
+ cLen = comm.GetByte () & 0xff;
+ string oldDB = comm.GetString (cLen);
+ database = newDB;
+ break;
+ default:
+ comm.Skip (len - 1);
+ break;
+ }
+ }
+
+ protected void ProcessLoginAck ()
+ {
+ GetSubPacketLength ();
+
+ if (tdsVersion == TdsVersion.tds70) {
+ comm.Skip (5);
+ int nameLength = comm.GetByte ();
+ databaseProductName = comm.GetString (nameLength);
+ databaseMajorVersion = comm.GetByte ();
+ databaseProductVersion = String.Format ("0{0}.0{1}.0{2}", databaseMajorVersion, comm.GetByte (), ((256 * (comm.GetByte () + 1)) + comm.GetByte ()));
+ }
+ else {
+ comm.Skip (5);
+ short nameLength = comm.GetByte ();
+ databaseProductName = comm.GetString (nameLength);
+ comm.Skip (1);
+ databaseMajorVersion = comm.GetByte ();
+ databaseProductVersion = String.Format ("{0}.{1}", databaseMajorVersion, comm.GetByte ());
+ comm.Skip (1);
+ }
+
+ if (databaseProductName.Length > 1 && -1 != databaseProductName.IndexOf ('\0')) {
+ int last = databaseProductName.IndexOf ('\0');
+ databaseProductName = databaseProductName.Substring (0, last);
+ }
+
+ connected = true;
+ }
+
+ protected void OnTdsErrorMessage (TdsInternalErrorMessageEventArgs e)
+ {
+ if (TdsErrorMessage != null)
+ TdsErrorMessage (this, e);
+ }
+
+ protected void OnTdsInfoMessage (TdsInternalInfoMessageEventArgs e)
+ {
+ if (TdsInfoMessage != null)
+ TdsInfoMessage (this, e);
+ messages.Clear ();
+ }
+
+ protected void ProcessMessage (TdsPacketSubType subType)
+ {
+ GetSubPacketLength ();
+
+ int number = comm.GetTdsInt ();
+ byte state = comm.GetByte ();
+ byte theClass = comm.GetByte ();
+ string message;
+ string server;
+ string procedure;
+ byte lineNumber;
+ string source;
+ bool isError = false;
+
+ if (subType == TdsPacketSubType.EED) {
+ isError = (theClass > 10);
+ comm.Skip (comm.GetByte ()); // SQL State
+ comm.Skip (1); // Status
+ comm.Skip (2); // TranState
+ } else
+ isError = (subType == TdsPacketSubType.Error);
+
+ message = comm.GetString (comm.GetTdsShort ());
+ server = comm.GetString (comm.GetByte ());
+ procedure = comm.GetString (comm.GetByte ());
+ lineNumber = comm.GetByte ();
+ comm.Skip (1);
+ source = String.Empty; // FIXME
+
+ if (isError)
+ OnTdsErrorMessage (CreateTdsErrorMessageEvent (theClass, lineNumber, message, number, procedure, server, source, state));
+ else
+ messages.Add (new TdsInternalError (theClass, lineNumber, message, number, procedure, server, source, state));
+ }
+
+ protected void ProcessOutputParam ()
+ {
+ GetSubPacketLength ();
+ comm.GetString (comm.GetByte () & 0xff);
+ comm.Skip (5);
+
+ TdsColumnType colType = (TdsColumnType) comm.GetByte ();
+ object value = GetColumnValue (colType, true);
+
+ outputParameters.Add (value);
+ }
+
+ protected void ProcessDynamic ()
+ {
+ Comm.Skip (2);
+ byte type = Comm.GetByte ();
+ byte status = Comm.GetByte ();
+ string id = Comm.GetString (Comm.GetByte ());
+ }
+
+ protected virtual TdsPacketSubType ProcessSubPacket ()
+ {
+ TdsPacketSubType subType = (TdsPacketSubType) comm.GetByte ();
+
+ switch (subType) {
+ case TdsPacketSubType.Dynamic2:
+ comm.Skip (comm.GetTdsInt ());
+ break;
+ case TdsPacketSubType.AltName:
+ case TdsPacketSubType.AltFormat:
+ case TdsPacketSubType.Capability:
+ case TdsPacketSubType.ParamFormat:
+ comm.Skip (comm.GetTdsShort ());
+ break;
+ case TdsPacketSubType.Dynamic:
+ ProcessDynamic ();
+ break;
+ case TdsPacketSubType.EnvironmentChange:
+ ProcessEnvironmentChange ();
+ break;
+ case TdsPacketSubType.Info: // TDS 4.2/7.0
+ case TdsPacketSubType.EED: // TDS 5.0
+ case TdsPacketSubType.Error: // TDS 4.2/7.0
+ ProcessMessage (subType);
+ break;
+ case TdsPacketSubType.Param:
+ ProcessOutputParam ();
+ break;
+ case TdsPacketSubType.LoginAck:
+ ProcessLoginAck ();
+ break;
+ case TdsPacketSubType.ReturnStatus :
+ Comm.Skip (4);
+ break;
+ case TdsPacketSubType.ProcId:
+ Comm.Skip (8);
+ break;
+ case TdsPacketSubType.Done:
+ case TdsPacketSubType.DoneProc:
+ case TdsPacketSubType.DoneInProc:
+ ProcessEndToken (subType);
+ break;
+ case TdsPacketSubType.ColumnName:
+ Comm.Skip (8);
+ ProcessColumnNames ();
+ break;
+ case TdsPacketSubType.ColumnInfo: // TDS 4.2
+ case TdsPacketSubType.ColumnMetadata: // TDS 7.0
+ case TdsPacketSubType.RowFormat: // TDS 5.0
+ columns = ProcessColumnInfo ();
+ break;
+ case TdsPacketSubType.ColumnDetail:
+ ProcessColumnDetail ();
+ break;
+ case TdsPacketSubType.TableName:
+ ProcessTableName ();
+ break;
+ case TdsPacketSubType.ColumnOrder:
+ comm.Skip (comm.GetTdsShort ());
+ break;
+ case TdsPacketSubType.Control:
+ comm.Skip (comm.GetTdsShort ());
+ break;
+ case TdsPacketSubType.Row:
+ LoadRow ();
+ break;
+ }
+
+ return subType;
+ }
+
+ protected void ProcessTableName ()
+ {
+ tableNames = new ArrayList ();
+ int totalLength = comm.GetTdsShort ();
+ int position = 0;
+ int len;
+
+ while (position < totalLength) {
+ if (tdsVersion == TdsVersion.tds70) {
+ len = comm.GetTdsShort ();
+ position += 2 * (len + 1);
+ }
+ else {
+ len = comm.GetByte ();
+ position += len + 1;
+ }
+ tableNames.Add (comm.GetString (len));
+ }
+ }
+
+ protected void SetCharset (string charset)
+ {
+ if (charset == null || charset.Length > 30)
+ charset = "iso_1";
+
+ if (this.charset != null && this.charset != charset)
+ return;
+
+ if (charset.StartsWith ("cp")) {
+ encoder = Encoding.GetEncoding (Int32.Parse (charset.Substring (2)));
+ this.charset = charset;
+ }
+ else {
+ encoder = Encoding.GetEncoding ("iso-8859-1");
+ this.charset = "iso_1";
+ }
+ comm.Encoder = encoder;
+ }
+
+ protected void SetLanguage (string language)
+ {
+ if (language == null || language.Length > 30)
+ language = "us_english";
+
+ this.language = language;
+ }
+
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds42.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds42.cs
new file mode 100644
index 00000000000..b5dfbfde6b7
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds42.cs
@@ -0,0 +1,270 @@
+//
+// Mono.Data.Tds.Protocol.Tds42.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public class Tds42 : Tds
+ {
+ #region Fields
+
+ public static readonly TdsVersion Version = TdsVersion.tds42;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Tds42 (string server, int port)
+ : this (server, port, 512, 15)
+ {
+ }
+
+ public Tds42 (string server, int port, int packetSize, int timeout)
+ : base (server, port, packetSize, timeout, Version)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public override bool Connect (TdsConnectionParameters connectionParameters)
+ {
+ if (IsConnected)
+ throw new InvalidOperationException ("The connection is already open.");
+
+ SetCharset (connectionParameters.Charset);
+ SetLanguage (connectionParameters.Language);
+
+ byte pad = (byte) 0;
+ byte[] empty = new byte[0];
+
+ Comm.StartPacket (TdsPacketType.Logon);
+
+ // hostname (offset 0)
+ byte[] tmp = Comm.Append (connectionParameters.Hostname, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // username (offset 31 0x1f)
+ tmp = Comm.Append (connectionParameters.User, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // password (offset 62 0x3e)
+ tmp = Comm.Append (connectionParameters.Password, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // hostproc (offset 93 0x5d)
+ Comm.Append ("00000116", 8, pad);
+
+ // unused (offset 109 0x6d)
+ Comm.Append (empty, (30-14), pad);
+
+ // apptype
+ Comm.Append ((byte) 0x0);
+ Comm.Append ((byte) 0xa0);
+ Comm.Append ((byte) 0x24);
+ Comm.Append ((byte) 0xcc);
+ Comm.Append ((byte) 0x50);
+ Comm.Append ((byte) 0x12);
+
+ // hostproc length
+ Comm.Append ((byte) 8);
+
+ // Byte order of 2 byte ints
+ // 2 = <MSB, LSB>, 3 = <LSB, MSB>
+ Comm.Append ((byte) 3);
+
+ // Byte order of 4 byte ints
+ // 0 = <MSB, LSB>, 1 = <LSB, MSB>
+ Comm.Append ((byte) 1);
+
+ // Character representation
+ // (6 = ASCII, 7 = EBCDIC)
+ Comm.Append ((byte) 6);
+
+ // Eight byte floating point representation
+ // 4 = IEEE <MSB, ..., LSB>
+ // 5 = VAX 'D'
+ // 10 = IEEE <LSB, ..., MSB>
+ // 11 = ND5000
+ Comm.Append ((byte) 10);
+
+ // Eight byte date format
+ // 8 = <MSB, ..., LSB>
+ Comm.Append ((byte) 9);
+
+ // notify of use db
+ Comm.Append ((byte) 1);
+
+ // disallow dump/load and bulk insert
+ Comm.Append ((byte) 1);
+
+ // sql interface type
+ Comm.Append ((byte) 0);
+
+ // type of network connection
+ Comm.Append ((byte) 0);
+
+
+ // spare [7]
+ Comm.Append (empty, 7, pad);
+ // appname
+ tmp = Comm.Append (connectionParameters.ApplicationName, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // server name
+ tmp = Comm.Append (DataSource, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // remote passwords
+ Comm.Append (empty, 2, pad);
+ tmp = Comm.Append (connectionParameters.Password, 253, pad);
+ Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
+
+ // tds version
+ Comm.Append ((byte) (((byte) Version) / 10));
+ Comm.Append ((byte) (((byte) Version) % 10));
+ Comm.Append ((byte) 0);
+ Comm.Append ((byte) 0);
+
+ // prog name
+ tmp = Comm.Append (connectionParameters.ProgName, 10, pad);
+ Comm.Append ((byte) (tmp.Length < 10 ? tmp.Length : 10));
+
+ // prog version
+ Comm.Append ((byte) 6);
+
+ // Tell the server we can handle SQLServer version 6
+ Comm.Append ((byte) 0);
+
+ // Send zero to tell the server we can't handle any other version
+ Comm.Append ((byte) 0);
+ Comm.Append ((byte) 0);
+
+ // auto convert short
+ Comm.Append ((byte) 0);
+
+ // type of flt4
+ Comm.Append ((byte) 0x0d);
+
+ // type of date4
+ Comm.Append ((byte) 0x11);
+
+ // language
+ tmp = Comm.Append (Language, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // notify on lang change
+ Comm.Append ((byte) 1);
+
+ // security label hierarchy
+ Comm.Append ((short) 0);
+
+ // security components
+ Comm.Append (empty, 8, pad);
+
+ // security spare
+ Comm.Append ((short) 0);
+
+ // security login role
+ Comm.Append ((byte) 0);
+
+ // charset
+ tmp = Comm.Append (Charset, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // notify on charset change
+ Comm.Append ((byte) 1);
+
+ // length of tds packets
+ tmp = Comm.Append (PacketSize.ToString (), 6, pad);
+ Comm.Append ((byte) 3);
+
+ // pad out to a longword
+ Comm.Append (empty, 8, pad);
+
+ Comm.SendPacket ();
+
+ MoreResults = true;
+ SkipToEnd ();
+
+ return IsConnected;
+ }
+
+ protected override TdsDataColumnCollection ProcessColumnInfo ()
+ {
+ byte precision;
+ byte scale;
+ int totalLength = Comm.GetTdsShort ();
+ int bytesRead = 0;
+
+ TdsDataColumnCollection result = new TdsDataColumnCollection ();
+
+ while (bytesRead < totalLength) {
+ scale = 0;
+ precision = 0;
+
+ int bufLength = -1;
+ byte[] flagData = new byte[4];
+ for (int i = 0; i < 4; i += 1) {
+ flagData[i] = Comm.GetByte ();
+ bytesRead += 1;
+ }
+ bool nullable = (flagData[2] & 0x01) > 0;
+ bool caseSensitive = (flagData[2] & 0x02) > 0;
+ bool writable = (flagData[2] & 0x0c) > 0;
+ bool autoIncrement = (flagData[2] & 0x10) > 0;
+
+ string tableName = String.Empty;
+ TdsColumnType columnType = (TdsColumnType) Comm.GetByte ();
+
+ bytesRead += 1;
+
+ if (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image) {
+ Comm.Skip (4);
+ bytesRead += 4;
+
+ int tableNameLength = Comm.GetTdsShort ();
+ bytesRead += 2;
+ tableName = Comm.GetString (tableNameLength);
+ bytesRead += tableNameLength;
+ bufLength = 2 << 31 - 1;
+ }
+ else if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric) {
+ bufLength = Comm.GetByte ();
+ bytesRead += 1;
+ precision = Comm.GetByte ();
+ bytesRead += 1;
+ scale = Comm.GetByte ();
+ bytesRead += 1;
+ }
+ else if (IsFixedSizeColumn (columnType))
+ bufLength = LookupBufferSize (columnType);
+ else {
+ bufLength = (int) Comm.GetByte () & 0xff;
+ bytesRead += 1;
+ }
+
+ int index = result.Add (new TdsDataColumn ());
+ result[index]["NumericPrecision"] = precision;
+ result[index]["NumericScale"] = scale;
+ result[index]["ColumnSize"] = bufLength;
+ result[index]["ColumnName"] = ColumnNames[index];
+ result[index]["ColumnType"] = columnType;
+ result[index]["BaseTableName"] = tableName;
+ result[index]["AllowDBNull"] = nullable;
+ result[index]["IsReadOnly"] = !writable;
+ }
+
+ return result;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds50.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds50.cs
new file mode 100644
index 00000000000..14e93818898
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds50.cs
@@ -0,0 +1,505 @@
+//
+// Mono.Data.Tds.Protocol.Tds50.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds;
+using System;
+using System.Text;
+
+namespace Mono.Data.Tds.Protocol {
+ [MonoTODO ("FIXME: Can packetsize be anything other than 512?")]
+ public class Tds50 : Tds
+ {
+ #region Fields
+
+ public static readonly TdsVersion Version = TdsVersion.tds50;
+ int packetSize;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Tds50 (string server, int port)
+ : this (server, port, 512, 15)
+ {
+ }
+
+ public Tds50 (string server, int port, int packetSize, int timeout)
+ : base (server, port, packetSize, timeout, Version)
+ {
+ this.packetSize = packetSize;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public string BuildExec (string sql)
+ {
+ if (Parameters == null || Parameters.Count == 0)
+ return sql;
+
+ StringBuilder select = new StringBuilder ();
+ StringBuilder set = new StringBuilder ();
+ StringBuilder declare = new StringBuilder ();
+ int count = 0;
+ foreach (TdsMetaParameter p in Parameters) {
+ declare.Append (String.Format ("declare {0}\n", p.Prepare ()));
+ set.Append (String.Format ("select {0}=", p.ParameterName));
+ if (p.Direction == TdsParameterDirection.Input)
+ set.Append (FormatParameter (p));
+ else {
+ set.Append ("NULL");
+ select.Append (p.ParameterName);
+ if (count == 0)
+ select.Append ("select ");
+ else
+ select.Append (", ");
+ count += 1;
+ }
+ set.Append ("\n");
+ }
+ return String.Format ("{0}{1}{2}\n{3}", declare.ToString (), set.ToString (), sql, select.ToString ());
+ }
+
+ public override bool Connect (TdsConnectionParameters connectionParameters)
+ {
+ if (IsConnected)
+ throw new InvalidOperationException ("The connection is already open.");
+
+ byte[] capabilityRequest = {0x03, 0xef, 0x65, 0x41, 0xff, 0xff, 0xff, 0xd6};
+ byte[] capabilityResponse = {0x00, 0x00, 0x00, 0x06, 0x48, 0x00, 0x00, 0x08};
+
+ SetCharset (connectionParameters.Charset);
+ SetLanguage (connectionParameters.Language);
+
+ byte pad = (byte) 0;
+ byte[] empty = new byte[0];
+
+ Comm.StartPacket (TdsPacketType.Logon);
+
+ // hostname (offset 0)
+ // 0-30
+ byte[] tmp = Comm.Append (connectionParameters.Hostname, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // username (offset 31 0x1f)
+ // 31-61
+ tmp = Comm.Append (connectionParameters.User, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // password (offset 62 0x3e)
+ // 62-92
+ tmp = Comm.Append (connectionParameters.Password, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // hostproc (offset 93 0x5d)
+ // 93-123
+ tmp = Comm.Append ("37876", 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // Byte order of 2 byte ints
+ // 2 = <MSB, LSB>, 3 = <LSB, MSB>
+ // 124
+ Comm.Append ((byte) 3);
+
+ // Byte order of 4 byte ints
+ // 0 = <MSB, LSB>, 1 = <LSB, MSB>
+ // 125
+ Comm.Append ((byte) 1);
+
+ // Character representation
+ // (6 = ASCII, 7 = EBCDIC)
+ // 126
+ Comm.Append ((byte) 6);
+
+ // Eight byte floating point representation
+ // 4 = IEEE <MSB, ..., LSB>
+ // 5 = VAX 'D'
+ // 10 = IEEE <LSB, ..., MSB>
+ // 11 = ND5000
+ // 127
+ Comm.Append ((byte) 10);
+
+ // Eight byte date format
+ // 8 = <MSB, ..., LSB>
+ // 128
+ Comm.Append ((byte) 9);
+
+ // notify of use db
+ // 129
+ Comm.Append ((byte) 1);
+
+ // disallow dump/load and bulk insert
+ // 130
+ Comm.Append ((byte) 1);
+
+ // sql interface type
+ // 131
+ Comm.Append ((byte) 0);
+
+ // type of network connection
+ // 132
+ Comm.Append ((byte) 0);
+
+ // spare [7]
+ // 133-139
+ Comm.Append (empty, 7, pad);
+
+ // appname
+ // 140-170
+ tmp = Comm.Append (connectionParameters.ApplicationName, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // server name
+ // 171-201
+ tmp = Comm.Append (DataSource, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // remote passwords
+ // 202-457
+ Comm.Append (empty, 2, pad);
+ tmp = Comm.Append (connectionParameters.Password, 253, pad);
+ Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
+
+ // tds version
+ // 458-461
+ Comm.Append ((byte) 5);
+ Comm.Append ((byte) 0);
+ Comm.Append ((byte) 0);
+ Comm.Append ((byte) 0);
+
+ // prog name
+ // 462-472
+ tmp = Comm.Append (connectionParameters.ProgName, 10, pad);
+ Comm.Append ((byte) (tmp.Length < 10 ? tmp.Length : 10));
+
+ // prog version
+ // 473-476
+ Comm.Append ((byte) 6);
+ Comm.Append ((byte) 0);
+ Comm.Append ((byte) 0);
+ Comm.Append ((byte) 0);
+
+ // auto convert short
+ // 477
+ Comm.Append ((byte) 0);
+
+ // type of flt4
+ // 478
+ Comm.Append ((byte) 0x0d);
+
+ // type of date4
+ // 479
+ Comm.Append ((byte) 0x11);
+
+ // language
+ // 480-510
+ tmp = Comm.Append (Language, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // notify on lang change
+ // 511
+ Comm.Append ((byte) 1);
+
+ // security label hierarchy
+ // 512-513
+ Comm.Append ((short) 0);
+
+ // security components
+ // 514-521
+ Comm.Append (empty, 8, pad);
+
+ // security spare
+ // 522-523
+ Comm.Append ((short) 0);
+
+ // security login role
+ // 524
+ Comm.Append ((byte) 0);
+
+ // charset
+ // 525-555
+ tmp = Comm.Append (Charset, 30, pad);
+ Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
+
+ // notify on charset change
+ // 556
+ Comm.Append ((byte) 1);
+
+ // length of tds packets
+ // 557-563
+ tmp = Comm.Append (PacketSize.ToString (), 6, pad);
+ Comm.Append ((byte) (tmp.Length < 6 ? tmp.Length : 6));
+
+ Comm.Append (empty, 8, pad);
+ // Padding...
+ // 564-567
+ //Comm.Append (empty, 4, pad);
+
+ // Capabilities
+ Comm.Append ((byte) TdsPacketSubType.Capability);
+ Comm.Append ((short) 20);
+ Comm.Append ((byte) 0x01); // TDS_CAP_REQUEST
+ Comm.Append (capabilityRequest);
+ Comm.Append ((byte) 0x02);
+ Comm.Append (capabilityResponse);
+
+ Comm.SendPacket ();
+
+ MoreResults = true;
+ SkipToEnd ();
+
+ return IsConnected;
+ }
+
+ public override void ExecPrepared (string id, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ Parameters = parameters;
+ bool hasParameters = (Parameters != null && Parameters.Count > 0);
+
+ Comm.StartPacket (TdsPacketType.Normal);
+
+ Comm.Append ((byte) TdsPacketSubType.Dynamic);
+ Comm.Append ((short) (id.Length + 5));
+ Comm.Append ((byte) 0x02); // TDS_DYN_EXEC
+ Comm.Append ((byte) (hasParameters ? 0x01 : 0x00));
+ Comm.Append ((byte) id.Length);
+ Comm.Append (id);
+ Comm.Append ((short) 0);
+
+ if (hasParameters) {
+ SendParamFormat ();
+ SendParams ();
+ }
+
+ MoreResults = true;
+ Comm.SendPacket ();
+ CheckForData (timeout);
+ if (!wantResults)
+ SkipToEnd ();
+ }
+
+ public override void Execute (string sql, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ Parameters = parameters;
+ ExecuteQuery (BuildExec (sql), timeout, wantResults);
+ }
+
+ private string FormatParameter (TdsMetaParameter parameter)
+ {
+ if (parameter.Direction == TdsParameterDirection.Output)
+ return String.Format ("{0} output", parameter.ParameterName);
+
+ if (parameter.Value == null)
+ return "NULL";
+
+ switch (parameter.TypeName) {
+ case "bigint":
+ case "decimal":
+ case "float":
+ case "int":
+ case "money":
+ case "real":
+ case "smallint":
+ case "smallmoney":
+ case "tinyint":
+ return parameter.Value.ToString ();
+ case "nvarchar":
+ case "nchar":
+ return String.Format ("N'{0}'", parameter.Value.ToString ().Replace ("'", "''"));
+ case "uniqueidentifier":
+ return String.Format ("0x{0}", ((Guid) parameter.Value).ToString ("N"));
+ case "bit":
+ if (parameter.Value.GetType () == typeof (bool))
+ return (((bool) parameter.Value) ? "0x1" : "0x0");
+ return parameter.Value.ToString ();
+ case "image":
+ case "binary":
+ case "varbinary":
+ return String.Format ("0x{0}", BitConverter.ToString ((byte[]) parameter.Value).Replace ("-", "").ToLower ());
+ default:
+ return String.Format ("'{0}'", parameter.Value.ToString ().Replace ("'", "''"));
+ }
+ }
+
+ public override string Prepare (string sql, TdsMetaParameterCollection parameters)
+ {
+ Parameters = parameters;
+
+ Random rand = new Random ();
+ StringBuilder idBuilder = new StringBuilder ();
+ for (int i = 0; i < 25; i += 1)
+ idBuilder.Append ((char) (rand.Next (26) + 65));
+ string id = idBuilder.ToString ();
+
+ StringBuilder declare = new StringBuilder ();
+
+
+ sql = String.Format ("create proc {0} as\n{1}", id, sql);
+ short len = (short) ((id.Length) + sql.Length + 5);
+
+ Comm.StartPacket (TdsPacketType.Normal);
+ Comm.Append ((byte) TdsPacketSubType.Dynamic);
+ Comm.Append (len);
+ Comm.Append ((byte) 0x1); // PREPARE
+ Comm.Append ((byte) 0x0); // UNUSED
+ Comm.Append ((byte) id.Length);
+ Comm.Append (id);
+ Comm.Append ((short) sql.Length);
+ Comm.Append (sql);
+
+ Comm.SendPacket ();
+ MoreResults = true;
+ SkipToEnd ();
+
+ return id;
+ }
+
+ protected override TdsDataColumnCollection ProcessColumnInfo ()
+ {
+ TdsDataColumnCollection result = new TdsDataColumnCollection ();
+ int totalLength = Comm.GetTdsShort ();
+ int count = Comm.GetTdsShort ();
+ for (int i = 0; i < count; i += 1) {
+ string columnName = Comm.GetString (Comm.GetByte ());
+ int status = Comm.GetByte ();
+ bool hidden = (status & 0x01) > 0;
+ bool isKey = (status & 0x02) > 0;
+ bool isRowVersion = (status & 0x04) > 0;
+ bool isUpdatable = (status & 0x10) > 0;
+ bool allowDBNull = (status & 0x20) > 0;
+ bool isIdentity = (status & 0x40) > 0;
+
+ Comm.Skip (4); // User type
+
+ byte type = Comm.GetByte ();
+ bool isBlob = (type == 0x24);
+
+ TdsColumnType columnType = (TdsColumnType) type;
+ int bufLength = 0;
+
+ byte precision = 0;
+ byte scale = 0;
+
+ if (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image) {
+ bufLength = Comm.GetTdsInt ();
+ Comm.Skip (Comm.GetTdsShort ());
+ }
+ else if (IsFixedSizeColumn (columnType))
+ bufLength = LookupBufferSize (columnType);
+ else
+ //bufLength = Comm.GetTdsShort ();
+ bufLength = Comm.GetByte ();
+
+ if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric) {
+ precision = Comm.GetByte ();
+ scale = Comm.GetByte ();
+ }
+
+ Comm.Skip (Comm.GetByte ()); // Locale
+ if (isBlob)
+ Comm.Skip (Comm.GetTdsShort ()); // Class ID
+
+ int index = result.Add (new TdsDataColumn ());
+ result[index]["NumericPrecision"] = precision;
+ result[index]["NumericScale"] = scale;
+ result[index]["ColumnSize"] = bufLength;
+ result[index]["ColumnName"] = columnName;
+ result[index]["AllowDBNull"] = allowDBNull;
+ result[index]["IsReadOnly"] = !isUpdatable;
+ result[index]["IsIdentity"] = isIdentity;
+ result[index]["IsRowVersion"] = isRowVersion;
+ result[index]["IsKey"] = isKey;
+ result[index]["Hidden"] = hidden;
+ result[index]["ColumnType"] = columnType;
+ }
+ return result;
+ }
+
+ private void SendParamFormat ()
+ {
+ Comm.Append ((byte) TdsPacketSubType.ParamFormat);
+
+ int len = 2 + (8 * Parameters.Count);
+ TdsColumnType metaType;
+ foreach (TdsMetaParameter p in Parameters) {
+ metaType = p.GetMetaType ();
+ if (!IsFixedSizeColumn (metaType))
+ len += 1;
+ if (metaType == TdsColumnType.Numeric || metaType == TdsColumnType.Decimal)
+ len += 2;
+ }
+
+ Comm.Append ((short) len);
+ Comm.Append ((short) Parameters.Count);
+
+ foreach (TdsMetaParameter p in Parameters) {
+ string locale = String.Empty;
+ string parameterName = String.Empty;
+ int userType = 0;
+
+ byte status = 0x00;
+ if (p.IsNullable)
+ status |= 0x20;
+ if (p.Direction == TdsParameterDirection.Output)
+ status |= 0x01;
+
+ metaType = p.GetMetaType ();
+
+ Comm.Append ((byte) parameterName.Length);
+ Comm.Append (parameterName);
+ Comm.Append (status);
+ Comm.Append (userType);
+ Comm.Append ((byte) metaType);
+
+ if (!IsFixedSizeColumn (metaType))
+ Comm.Append ((byte) p.Size); // MAXIMUM SIZE
+ if (metaType == TdsColumnType.Numeric || metaType == TdsColumnType.Decimal) {
+ Comm.Append (p.Precision);
+ Comm.Append (p.Scale);
+ }
+ Comm.Append ((byte) locale.Length);
+ Comm.Append (locale);
+ }
+ }
+
+ private void SendParams ()
+ {
+ Comm.Append ((byte) TdsPacketSubType.Parameters);
+
+ TdsColumnType metaType;
+ foreach (TdsMetaParameter p in Parameters) {
+ metaType = p.GetMetaType ();
+ bool isNull = (p.Value == DBNull.Value || p.Value == null);
+ if (!IsFixedSizeColumn (metaType))
+ Comm.Append ((byte) p.GetActualSize ());
+ if (!isNull)
+ Comm.Append (p.Value);
+ }
+ }
+
+ public override void Unprepare (string statementId)
+ {
+ Comm.StartPacket (TdsPacketType.Normal);
+ Comm.Append ((byte) TdsPacketSubType.Dynamic);
+ Comm.Append ((short) (3 + statementId.Length));
+ Comm.Append ((byte) 0x04);
+ Comm.Append ((byte) 0x00);
+ Comm.Append ((byte) statementId.Length);
+ Comm.Append (statementId);
+ //Comm.Append ((short) 0);
+
+ MoreResults = true;
+ Comm.SendPacket ();
+ SkipToEnd ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
new file mode 100644
index 00000000000..4467291b98d
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
@@ -0,0 +1,408 @@
+//
+// Mono.Data.Tds.Protocol.Tds70.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Text;
+
+namespace Mono.Data.Tds.Protocol {
+ public class Tds70 : Tds
+ {
+ #region Fields
+
+ public readonly static TdsVersion Version = TdsVersion.tds70;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Tds70 (string server, int port)
+ : this (server, port, 512, 15)
+ {
+ }
+
+ public Tds70 (string server, int port, int packetSize, int timeout)
+ : base (server, port, packetSize, timeout, Version)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ private string BuildExec (string sql)
+ {
+ string esql = sql.Replace ("'", "''"); // escape single quote
+ if (Parameters != null && Parameters.Count > 0)
+ return BuildProcedureCall (String.Format ("sp_executesql N'{0}', N'{1}', ", esql, BuildPreparedParameters ()));
+ else
+ return BuildProcedureCall (String.Format ("sp_executesql N'{0}'", esql));
+ }
+
+ private string BuildParameters ()
+ {
+ if (Parameters == null || Parameters.Count == 0)
+ return String.Empty;
+
+ StringBuilder result = new StringBuilder ();
+ foreach (TdsMetaParameter p in Parameters) {
+ if (result.Length > 0)
+ result.Append (", ");
+ result.Append (FormatParameter (p));
+ }
+ return result.ToString ();
+ }
+
+ private string BuildPreparedParameters ()
+ {
+ StringBuilder parms = new StringBuilder ();
+ foreach (TdsMetaParameter p in Parameters) {
+ if (parms.Length > 0)
+ parms.Append (", ");
+ parms.Append (p.Prepare ());
+ if (p.Direction == TdsParameterDirection.Output)
+ parms.Append (" output");
+ }
+ return parms.ToString ();
+ }
+
+ private string BuildPreparedQuery (string id)
+ {
+ return BuildProcedureCall (String.Format ("sp_execute {0},", id));
+ }
+
+ private string BuildProcedureCall (string procedure)
+ {
+ StringBuilder declare = new StringBuilder ();
+ StringBuilder select = new StringBuilder ();
+ StringBuilder set = new StringBuilder ();
+ int count = 0;
+ if (Parameters != null) {
+ foreach (TdsMetaParameter p in Parameters) {
+ if (p.Direction == TdsParameterDirection.Output) {
+ declare.Append (String.Format ("declare {0}\n", p.Prepare ()));
+ if (count == 0)
+ select.Append ("select ");
+ else
+ select.Append (", ");
+
+ set.Append (String.Format ("set {0}=NULL\n", p.ParameterName));
+ select.Append (p.ParameterName);
+ count += 1;
+ }
+ }
+ }
+ string exec = String.Empty;
+ if (count > 0)
+ exec = "exec ";
+
+ return String.Format ("{0}{1}{2}{3} {4}\n{5}", declare.ToString (), set.ToString (), exec, procedure, BuildParameters (), select.ToString ());
+ }
+
+ public override bool Connect (TdsConnectionParameters connectionParameters)
+ {
+ if (IsConnected)
+ throw new InvalidOperationException ("The connection is already open.");
+
+ SetLanguage (connectionParameters.Language);
+ SetCharset ("utf-8");
+
+ byte[] empty = new byte[0];
+ byte pad = (byte) 0;
+
+ byte[] magic1 = {0x06, 0x83, 0xf2, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x88, 0xff, 0xff, 0xff, 0x36, 0x04, 0x00, 0x00};
+ byte[] magic2 = {0x00, 0x40, 0x33, 0x9a, 0x6b, 0x50};
+ byte[] magic3 = {0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50}; // NTLMSSP
+ short partialPacketSize = (short) (86 + 2 * (
+ connectionParameters.Hostname.Length +
+ connectionParameters.User.Length +
+ connectionParameters.ApplicationName.Length +
+ connectionParameters.Password.Length +
+ DataSource.Length +
+ connectionParameters.LibraryName.Length +
+ Language.Length +
+ connectionParameters.Database.Length));
+ short totalPacketSize = (short) (partialPacketSize + 48);
+ Comm.StartPacket (TdsPacketType.Logon70);
+ Comm.Append (totalPacketSize);
+ Comm.Append (empty, 5, pad);
+
+ Comm.Append ((byte) 0x70); // TDS VERSION 7
+ Comm.Append (empty, 7, pad);
+ Comm.Append (magic1);
+
+ short curPos = 86;
+
+ // Hostname
+ Comm.Append (curPos);
+ Comm.Append ((short) connectionParameters.Hostname.Length);
+ curPos += (short) (connectionParameters.Hostname.Length * 2);
+
+ // Username
+ Comm.Append (curPos);
+ Comm.Append ((short) connectionParameters.User.Length);
+ curPos += (short) (connectionParameters.User.Length * 2);
+
+ // Password
+ Comm.Append (curPos);
+ Comm.Append ((short) connectionParameters.Password.Length);
+ curPos += (short) (connectionParameters.Password.Length * 2);
+
+ // AppName
+ Comm.Append (curPos);
+ Comm.Append ((short) connectionParameters.ApplicationName.Length);
+ curPos += (short) (connectionParameters.ApplicationName.Length * 2);
+
+ // Server Name
+ Comm.Append (curPos);
+ Comm.Append ((short) DataSource.Length);
+ curPos += (short) (DataSource.Length * 2);
+
+ // Unknown
+ Comm.Append ((short) 0);
+ Comm.Append ((short) 0);
+
+ // Library Name
+ Comm.Append (curPos);
+ Comm.Append ((short) connectionParameters.LibraryName.Length);
+ curPos += (short) (connectionParameters.LibraryName.Length * 2);
+
+ // Language
+ Comm.Append (curPos);
+ Comm.Append ((short) Language.Length);
+ curPos += (short) (Language.Length * 2);
+
+ // Database
+ Comm.Append (curPos);
+ Comm.Append ((short) connectionParameters.Database.Length);
+ curPos += (short) (connectionParameters.Database.Length * 2);
+
+ Comm.Append (magic2);
+ Comm.Append (partialPacketSize);
+ Comm.Append ((short) 48);
+ Comm.Append (totalPacketSize);
+ Comm.Append ((short) 0);
+
+ string scrambledPwd = EncryptPassword (connectionParameters.Password);
+
+ Comm.Append (connectionParameters.Hostname);
+ Comm.Append (connectionParameters.User);
+ Comm.Append (scrambledPwd);
+ Comm.Append (connectionParameters.ApplicationName);
+ Comm.Append (DataSource);
+ Comm.Append (connectionParameters.LibraryName);
+ Comm.Append (Language);
+ Comm.Append (connectionParameters.Database);
+ Comm.Append (magic3);
+
+ Comm.Append ((byte) 0x0);
+ Comm.Append ((byte) 0x1);
+ Comm.Append (empty, 3, pad);
+ Comm.Append ((byte) 0x6);
+ Comm.Append ((byte) 0x82);
+ Comm.Append (empty, 22, pad);
+ Comm.Append ((byte) 0x30);
+ Comm.Append (empty, 7, pad);
+ Comm.Append ((byte) 0x30);
+ Comm.Append (empty, 3, pad);
+ Comm.SendPacket ();
+
+ MoreResults = true;
+ SkipToEnd ();
+
+ return IsConnected;
+ }
+
+ private static string EncryptPassword (string pass)
+ {
+ int xormask = 0x5a5a;
+ int len = pass.Length;
+ char[] chars = new char[len];
+
+ for (int i = 0; i < len; ++i) {
+ int c = ((int) (pass[i])) ^ xormask;
+ int m1 = (c >> 4) & 0x0f0f;
+ int m2 = (c << 4) & 0xf0f0;
+ chars[i] = (char) (m1 | m2);
+ }
+
+ return new String (chars);
+ }
+
+ public override void ExecPrepared (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ Parameters = parameters;
+ ExecuteQuery (BuildPreparedQuery (commandText), timeout, wantResults);
+ }
+
+ public override void ExecProc (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ Parameters = parameters;
+ ExecuteQuery (BuildProcedureCall (commandText), timeout, wantResults);
+ }
+
+ public override void Execute (string commandText, TdsMetaParameterCollection parameters, int timeout, bool wantResults)
+ {
+ Parameters = parameters;
+ string sql = commandText;
+ if (wantResults || (Parameters != null && Parameters.Count > 0))
+ sql = BuildExec (commandText);
+ ExecuteQuery (sql, timeout, wantResults);
+ }
+
+ private bool IsBlobType (TdsColumnType columnType)
+ {
+ return (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image || columnType == TdsColumnType.NText);
+ }
+
+ private bool IsLargeType (TdsColumnType columnType)
+ {
+ return (columnType == TdsColumnType.NChar || (byte) columnType > 128);
+ }
+
+ private string FormatParameter (TdsMetaParameter parameter)
+ {
+ if (parameter.Direction == TdsParameterDirection.Output)
+ return String.Format ("{0} output", parameter.ParameterName);
+
+ if (parameter.Value == null)
+ return "NULL";
+
+ switch (parameter.TypeName) {
+ case "bigint":
+ case "decimal":
+ case "float":
+ case "int":
+ case "money":
+ case "real":
+ case "smallint":
+ case "smallmoney":
+ case "tinyint":
+ return parameter.Value.ToString ();
+ case "nvarchar":
+ case "nchar":
+ return String.Format ("N'{0}'", parameter.Value.ToString ().Replace ("'", "''"));
+ case "uniqueidentifier":
+ return String.Format ("0x{0}", ((Guid) parameter.Value).ToString ("N"));
+ case "bit":
+ if (parameter.Value.GetType () == typeof (bool))
+ return (((bool) parameter.Value) ? "0x1" : "0x0");
+ return parameter.Value.ToString ();
+ case "image":
+ case "binary":
+ case "varbinary":
+ return String.Format ("0x{0}", BitConverter.ToString ((byte[]) parameter.Value).Replace ("-", "").ToLower ());
+ default:
+ return String.Format ("'{0}'", parameter.Value.ToString ().Replace ("'", "''"));
+ }
+ }
+
+ public override string Prepare (string commandText, TdsMetaParameterCollection parameters)
+ {
+ Parameters = parameters;
+
+ TdsMetaParameterCollection parms = new TdsMetaParameterCollection ();
+ TdsMetaParameter parm = new TdsMetaParameter ("@P1", "int", null);
+ parm.Direction = TdsParameterDirection.Output;
+ parms.Add (parm);
+
+ parms.Add (new TdsMetaParameter ("@P2", "nvarchar", BuildPreparedParameters ()));
+ parms.Add (new TdsMetaParameter ("@P3", "nvarchar", commandText));
+
+ ExecProc ("sp_prepare", parms, 0, true);
+ if (!NextResult () || !NextRow () || ColumnValues [0] == null)
+ throw new TdsInternalException ();
+ SkipToEnd ();
+ return ColumnValues [0].ToString ();
+ }
+
+ protected override TdsDataColumnCollection ProcessColumnInfo ()
+ {
+ TdsDataColumnCollection result = new TdsDataColumnCollection ();
+ int numColumns = Comm.GetTdsShort ();
+
+ for (int i = 0; i < numColumns; i += 1) {
+ byte[] flagData = new byte[4];
+ for (int j = 0; j < 4; j += 1)
+ flagData[j] = Comm.GetByte ();
+
+ bool nullable = (flagData[2] & 0x01) > 0;
+ bool caseSensitive = (flagData[2] & 0x02) > 0;
+ bool writable = (flagData[2] & 0x0c) > 0;
+ bool autoIncrement = (flagData[2] & 0x10) > 0;
+ bool isIdentity = (flagData[2] & 0x10) > 0;
+
+ TdsColumnType columnType = (TdsColumnType) (Comm.GetByte () & 0xff);
+ if ((byte) columnType == 0xef)
+ columnType = TdsColumnType.NChar;
+
+ byte xColumnType = 0;
+ if (IsLargeType (columnType)) {
+ xColumnType = (byte) columnType;
+ if (columnType != TdsColumnType.NChar)
+ columnType -= 128;
+ }
+
+ int columnSize;
+ string tableName = null;
+
+ if (IsBlobType (columnType)) {
+ columnSize = Comm.GetTdsInt ();
+ tableName = Comm.GetString (Comm.GetTdsShort ());
+ }
+
+ else if (IsFixedSizeColumn (columnType))
+ columnSize = LookupBufferSize (columnType);
+ else if (IsLargeType ((TdsColumnType) xColumnType))
+ columnSize = Comm.GetTdsShort ();
+ else
+ columnSize = Comm.GetByte () & 0xff;
+
+ byte precision = 0;
+ byte scale = 0;
+
+ switch (columnType) {
+ case TdsColumnType.NText:
+ case TdsColumnType.NChar:
+ case TdsColumnType.NVarChar:
+ columnSize /= 2;
+ break;
+ case TdsColumnType.Decimal:
+ case TdsColumnType.Numeric:
+ precision = Comm.GetByte ();
+ scale = Comm.GetByte ();
+ break;
+ }
+
+ string columnName = Comm.GetString (Comm.GetByte ());
+
+ int index = result.Add (new TdsDataColumn ());
+ result[index]["AllowDBNull"] = nullable;
+ result[index]["ColumnName"] = columnName;
+ result[index]["ColumnSize"] = columnSize;
+ result[index]["ColumnType"] = columnType;
+ result[index]["IsIdentity"] = isIdentity;
+ result[index]["IsReadOnly"] = !writable;
+ result[index]["NumericPrecision"] = precision;
+ result[index]["NumericScale"] = scale;
+ result[index]["BaseTableName"] = tableName;
+ }
+
+ return result;
+ }
+
+ public override void Unprepare (string statementId)
+ {
+ TdsMetaParameterCollection parms = new TdsMetaParameterCollection ();
+ parms.Add (new TdsMetaParameter ("@P1", "int", Int32.Parse (statementId)));
+ ExecProc ("sp_unprepare", parms, 0, false);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds80.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds80.cs
new file mode 100644
index 00000000000..0df2421499f
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds80.cs
@@ -0,0 +1,50 @@
+//
+// Mono.Data.Tds.Protocol.Tds80.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds;
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public class Tds80 : Tds
+ {
+ #region Fields
+
+ public static readonly TdsVersion Version = TdsVersion.tds80;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Tds80 (string server, int port)
+ : this (server, port, 512, 15)
+ {
+ }
+
+ public Tds80 (string server, int port, int packetSize, int timeout)
+ : base (server, port, packetSize, timeout, Version)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public override bool Connect (TdsConnectionParameters connectionParameters)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override TdsDataColumnCollection ProcessColumnInfo ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsBigDecimal.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsBigDecimal.cs
new file mode 100644
index 00000000000..e920af151ed
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsBigDecimal.cs
@@ -0,0 +1,54 @@
+//
+// Mono.Data.Tds.Protocol.TdsBigDecimal.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsBigDecimal
+ {
+ #region Fields
+
+ bool isNegative;
+ byte precision;
+ byte scale;
+ int[] data;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsBigDecimal (byte precision, byte scale, bool isNegative, int[] data)
+ {
+ this.isNegative = isNegative;
+ this.precision = precision;
+ this.scale = scale;
+ this.data = data;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int[] Data {
+ get { return data; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ }
+
+ public bool IsNegative {
+ get { return isNegative; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnStatus.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnStatus.cs
new file mode 100644
index 00000000000..c9749d5bfed
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnStatus.cs
@@ -0,0 +1,17 @@
+//
+// Mono.Data.Tds.Protocol.TdsColumnStatus.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsColumnStatus {
+ IsExpression = 0x04,
+ IsKey = 0x08,
+ Hidden = 0x10,
+ Rename = 0x20
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnType.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnType.cs
new file mode 100644
index 00000000000..c83adf60219
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsColumnType.cs
@@ -0,0 +1,46 @@
+//
+// Mono.Data.Tds.Protocol.TdsColumnType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsColumnType {
+ Binary = 0x2d,
+ Bit = 0x32,
+ Char = 0x2f,
+ DateTime = 0x3d,
+ DateTime4 = 0x3a,
+ DateTimeN = 0x6f,
+ Decimal = 0x6a,
+ Real = 0x3b,
+ Float8 = 0x3e,
+ FloatN = 0x6d,
+ Image = 0x22,
+ Int1 = 0x30,
+ Int2 = 0x34,
+ Int4 = 0x38,
+ IntN = 0x26,
+ Void = 0x1f,
+ Text = 0x23,
+ UniqueIdentifier = 0x24, // This is TDS_BLOB in Sybase?
+ VarBinary = 0x25,
+ VarChar = 0x27,
+ Money = 0x3c,
+ NText = 0x63,
+ NVarChar = 0x67,
+ BitN = 0x68,
+ Numeric = 0x6c,
+ MoneyN = 0x6e,
+ Money4 = 0x70,
+ NChar = 0xef,
+ BigBinary = 0xad,
+ BigVarBinary = 0xa5,
+ BigVarChar = 0xa7,
+ BigChar = 0xaf,
+ SmallMoney = 0x7a
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs
new file mode 100644
index 00000000000..e844bb97beb
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs
@@ -0,0 +1,476 @@
+//
+// Mono.Data.Tds.Protocol.TdsComm.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+
+namespace Mono.Data.Tds.Protocol {
+ internal sealed class TdsComm
+ {
+ #region Fields
+
+ NetworkStream stream;
+ int packetSize;
+ TdsPacketType packetType = TdsPacketType.None;
+ Encoding encoder;
+
+ string dataSource;
+ int commandTimeout;
+ int connectionTimeout;
+
+ byte[] outBuffer;
+ int outBufferLength;
+ int nextOutBufferIndex = 0;
+
+ byte[] inBuffer;
+ int inBufferLength;
+ int inBufferIndex = 0;
+
+ static int headerLength = 8;
+
+ byte[] tmpBuf = new byte[8];
+ byte[] resBuffer = new byte[256];
+
+ int packetsSent = 0;
+ int packetsReceived = 0;
+
+ Socket socket;
+ TdsVersion tdsVersion;
+
+ ManualResetEvent connected = new ManualResetEvent (false);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO ("Fix when asynchronous socket connect works on Linux.")]
+ public TdsComm (string dataSource, int port, int packetSize, int timeout, TdsVersion tdsVersion)
+ {
+ this.packetSize = packetSize;
+ this.tdsVersion = tdsVersion;
+ this.dataSource = dataSource;
+ this.connectionTimeout = timeout;
+
+ outBuffer = new byte[packetSize];
+ inBuffer = new byte[packetSize];
+
+ outBufferLength = packetSize;
+ inBufferLength = packetSize;
+
+ socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ IPHostEntry hostEntry = Dns.Resolve (dataSource);
+ IPEndPoint endPoint;
+ endPoint = new IPEndPoint (hostEntry.AddressList [0], port);
+
+ // This replaces the code below for now
+ socket.Connect (endPoint);
+
+ /*
+ FIXME: Asynchronous socket connection doesn't work right on linux, so comment
+ this out for now. This *does* do the right thing on windows
+
+ connected.Reset ();
+ IAsyncResult asyncResult = socket.BeginConnect (endPoint, new AsyncCallback (ConnectCallback), socket);
+
+ if (timeout > 0 && !connected.WaitOne (new TimeSpan (0, 0, timeout), true))
+ throw Tds.CreateTimeoutException (dataSource, "Open()");
+ else if (timeout > 0 && !connected.WaitOne ())
+ throw Tds.CreateTimeoutException (dataSource, "Open()");
+ */
+
+ stream = new NetworkStream (socket);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int CommandTimeout {
+ get { return commandTimeout; }
+ set { commandTimeout = value; }
+ }
+
+ internal Encoding Encoder {
+ set { encoder = value; }
+ }
+
+ public int PacketSize {
+ get { return packetSize; }
+ set { packetSize = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Append (object o)
+ {
+ switch (o.GetType ().ToString ()) {
+ case "System.Byte":
+ Append ((byte) o);
+ return;
+ case "System.Byte[]":
+ Append ((byte[]) o);
+ return;
+ case "System.Int16":
+ Append ((short) o);
+ return;
+ case "System.Int32":
+ Append ((int) o);
+ return;
+ case "System.String":
+ Append ((string) o);
+ return;
+ case "System.Double":
+ Append ((double) o);
+ return;
+ case "System.Int64":
+ Append ((long) o);
+ return;
+ }
+ }
+
+ public void Append (byte b)
+ {
+ if (nextOutBufferIndex == outBufferLength) {
+ SendPhysicalPacket (false);
+ nextOutBufferIndex = headerLength;
+ }
+ Store (nextOutBufferIndex, b);
+ nextOutBufferIndex++;
+ }
+
+ public void Append (byte[] b)
+ {
+ Append (b, b.Length, (byte) 0);
+ }
+
+ public void Append (byte[] b, int len, byte pad)
+ {
+ int i = 0;
+ for ( ; i < b.Length && i < len; i++)
+ Append (b[i]);
+
+ for ( ; i < len; i++)
+ Append (pad);
+ }
+
+ public void Append (short s)
+ {
+ Append (BitConverter.GetBytes (s));
+ }
+
+ public void Append (int i)
+ {
+ Append (BitConverter.GetBytes (i));
+ }
+
+ public void Append (string s)
+ {
+ if (tdsVersion < TdsVersion.tds70)
+ Append (encoder.GetBytes (s));
+ else
+ foreach (char c in s)
+ Append (BitConverter.GetBytes (c));
+ }
+
+ // Appends with padding
+ public byte[] Append (string s, int len, byte pad)
+ {
+ if (s == null)
+ return new byte[0];
+
+ byte[] result = encoder.GetBytes (s);
+ Append (result, len, pad);
+ return result;
+ }
+
+ public void Append (double value)
+ {
+ Append (BitConverter.DoubleToInt64Bits (value));
+ }
+
+ public void Append (long l)
+ {
+ if (tdsVersion < TdsVersion.tds70) {
+ Append ((byte) (((byte) (l >> 56)) & 0xff));
+ Append ((byte) (((byte) (l >> 48)) & 0xff));
+ Append ((byte) (((byte) (l >> 40)) & 0xff));
+ Append ((byte) (((byte) (l >> 32)) & 0xff));
+ Append ((byte) (((byte) (l >> 24)) & 0xff));
+ Append ((byte) (((byte) (l >> 16)) & 0xff));
+ Append ((byte) (((byte) (l >> 8)) & 0xff));
+ Append ((byte) (((byte) (l >> 0)) & 0xff));
+ }
+ else
+ Append (BitConverter.GetBytes (l));
+ }
+
+ public void Close ()
+ {
+ stream.Close ();
+ }
+
+ private void ConnectCallback (IAsyncResult ar)
+ {
+ Socket s = (Socket) ar.AsyncState;
+ if (Poll (s, connectionTimeout, SelectMode.SelectWrite)) {
+ socket.EndConnect (ar);
+ connected.Set ();
+ }
+ }
+
+ public byte GetByte ()
+ {
+ byte result;
+
+ if (inBufferIndex >= inBufferLength) {
+ // out of data, read another physical packet.
+ GetPhysicalPacket ();
+ }
+
+ result = inBuffer[inBufferIndex++];
+ return result;
+ }
+
+ public byte[] GetBytes (int len, bool exclusiveBuffer)
+ {
+ byte[] result = null;
+ int i;
+
+ // Do not keep an internal result buffer larger than 16k.
+ // This would unnecessarily use up memory.
+ if (exclusiveBuffer || len > 16384)
+ result = new byte[len];
+ else
+ {
+ if (resBuffer.Length < len)
+ resBuffer = new byte[len];
+ result = resBuffer;
+ }
+
+ for (i = 0; i<len; )
+ {
+ if (inBufferIndex >= inBufferLength)
+ GetPhysicalPacket ();
+
+ int avail = inBufferLength - inBufferIndex;
+ avail = avail>len-i ? len-i : avail;
+
+ System.Array.Copy (inBuffer, inBufferIndex, result, i, avail);
+ i += avail;
+ inBufferIndex += avail;
+ }
+
+ return result;
+ }
+
+ public string GetString (int len)
+ {
+ if (tdsVersion == TdsVersion.tds70)
+ return GetString (len, true);
+ else
+ return GetString (len, false);
+ }
+
+ public string GetString (int len, bool wide)
+ {
+ if (wide) {
+ char[] chars = new char[len];
+ for (int i = 0; i < len; ++i) {
+ int lo = ((byte) GetByte ()) & 0xFF;
+ int hi = ((byte) GetByte ()) & 0xFF;
+ chars[i] = (char) (lo | ( hi << 8));
+ }
+ return new String (chars);
+ }
+ else {
+ byte[] result = new byte[len + 1];
+ Array.Copy (GetBytes (len, false), result, len);
+ return (encoder.GetString (result));
+ }
+ }
+
+ public int GetNetShort ()
+ {
+ byte[] tmp = new byte[2];
+ tmp[0] = GetByte ();
+ tmp[1] = GetByte ();
+ return Ntohs (tmp, 0);
+ }
+
+ public short GetTdsShort ()
+ {
+ byte[] input = new byte[2];
+
+ for (int i = 0; i < 2; i += 1)
+ input[i] = GetByte ();
+
+ return (BitConverter.ToInt16 (input, 0));
+ }
+
+
+ public int GetTdsInt ()
+ {
+ byte[] input = new byte[4];
+ for (int i = 0; i < 4; i += 1)
+ input[i] = GetByte ();
+ return (BitConverter.ToInt32 (input, 0));
+ }
+
+ public long GetTdsInt64 ()
+ {
+ byte[] input = new byte[8];
+ for (int i = 0; i < 8; i += 1)
+ input[i] = GetByte ();
+ return (BitConverter.ToInt64 (input, 0));
+ }
+
+ private void GetPhysicalPacket ()
+ {
+ int nread = 0;
+
+ // read the header
+ while (nread < 8)
+ nread += stream.Read (tmpBuf, nread, 8 - nread);
+
+ TdsPacketType packetType = (TdsPacketType) tmpBuf[0];
+ if (packetType != TdsPacketType.Logon && packetType != TdsPacketType.Query && packetType != TdsPacketType.Reply)
+ {
+ throw new Exception (String.Format ("Unknown packet type {0}", tmpBuf[0]));
+ }
+
+ // figure out how many bytes are remaining in this packet.
+ int len = Ntohs (tmpBuf, 2) - 8;
+
+ if (len >= inBuffer.Length)
+ inBuffer = new byte[len];
+
+ if (len < 0) {
+ throw new Exception (String.Format ("Confused by a length of {0}", len));
+ }
+
+ // now get the data
+ nread = 0;
+ while (nread < len) {
+ nread += stream.Read (inBuffer, nread, len - nread);
+ }
+
+ packetsReceived++;
+
+ // adjust the bookkeeping info about the incoming buffer
+ inBufferLength = len;
+ inBufferIndex = 0;
+ }
+
+ private static int Ntohs (byte[] buf, int offset)
+ {
+ int lo = ((int) buf[offset + 1] & 0xff);
+ int hi = (((int) buf[offset] & 0xff ) << 8);
+
+ return hi | lo;
+ // return an int since we really want an _unsigned_
+ }
+
+ public byte Peek ()
+ {
+ // If out of data, read another physical packet.
+ if (inBufferIndex >= inBufferLength)
+ GetPhysicalPacket ();
+
+ return inBuffer[inBufferIndex];
+ }
+
+ public bool Poll (int seconds, SelectMode selectMode)
+ {
+ return Poll (socket, seconds, selectMode);
+ }
+
+ private bool Poll (Socket s, int seconds, SelectMode selectMode)
+ {
+ long uSeconds = seconds * 1000000;
+ bool bState = false;
+
+ while (uSeconds > (long) Int32.MaxValue) {
+ bState = s.Poll (Int32.MaxValue, selectMode);
+ if (bState)
+ return true;
+ uSeconds -= Int32.MaxValue;
+ }
+ return s.Poll ((int) uSeconds, selectMode);
+ }
+
+ internal void ResizeOutBuf (int newSize)
+ {
+ if (newSize > outBufferLength) {
+ byte[] newBuf = new byte [newSize];
+ Array.Copy (outBuffer, 0, newBuf, 0, outBufferLength);
+ outBufferLength = newSize;
+ outBuffer = newBuf;
+ }
+ }
+
+ public void SendPacket ()
+ {
+ SendPhysicalPacket (true);
+ nextOutBufferIndex = 0;
+ packetType = TdsPacketType.None;
+ }
+
+ private void SendPhysicalPacket (bool isLastSegment)
+ {
+ if (nextOutBufferIndex > headerLength || packetType == TdsPacketType.Cancel) {
+ // packet type
+ Store (0, (byte) packetType);
+ Store (1, (byte) (isLastSegment ? 1 : 0));
+ Store (2, (short) nextOutBufferIndex );
+ Store (4, (byte) 0);
+ Store (5, (byte) 0);
+ Store (6, (byte) (tdsVersion == TdsVersion.tds70 ? 0x1 : 0x0));
+ Store (7, (byte) 0);
+
+ stream.Write (outBuffer, 0, nextOutBufferIndex);
+ stream.Flush ();
+ packetsSent++;
+ }
+ }
+
+ public void Skip (int i)
+ {
+ for ( ; i > 0; i--)
+ GetByte ();
+ }
+
+ public void StartPacket (TdsPacketType type)
+ {
+ if (type != TdsPacketType.Cancel && inBufferIndex != inBufferLength)
+ inBufferIndex = inBufferLength;
+
+ packetType = type;
+ nextOutBufferIndex = headerLength;
+ }
+
+ private void Store (int index, byte value)
+ {
+ outBuffer[index] = value;
+ }
+
+ private void Store (int index, short value)
+ {
+ outBuffer[index] = (byte) (((byte) (value >> 8)) & 0xff);
+ outBuffer[index + 1] = (byte) (((byte) (value >> 0)) & 0xff);
+ }
+
+ #endregion // Methods
+ }
+
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsConnectionParameters.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsConnectionParameters.cs
new file mode 100644
index 00000000000..89b4ee6f07b
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsConnectionParameters.cs
@@ -0,0 +1,24 @@
+//
+// Mono.Data.Tds.Protocol.TdsConnectionParameters.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+namespace Mono.Data.Tds.Protocol {
+ public class TdsConnectionParameters
+ {
+ public string ApplicationName = "Mono";
+ public string Database = String.Empty;
+ public string Charset = String.Empty;
+ public string Hostname = "localhost";
+ public string Language = String.Empty;
+ public string LibraryName = "Mono";
+ public string Password = String.Empty;
+ public string ProgName = "Mono";
+ public string User = String.Empty;
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumn.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumn.cs
new file mode 100644
index 00000000000..4d0ae9d6a76
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumn.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.Common.TdsDataColumn.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsDataColumn : Hashtable
+ {
+ #region Constructors
+
+ public TdsDataColumn ()
+ {
+ SetDefaultValues ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ private void SetDefaultValues ()
+ {
+ Add ("AllowDBNull", true);
+ Add ("ColumnOrdinal", 0);
+ Add ("IsAutoIncrement", false);
+ Add ("IsIdentity", false);
+ Add ("IsReadOnly", false);
+ Add ("IsRowVersion", false);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumnCollection.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumnCollection.cs
new file mode 100644
index 00000000000..617ec1ec089
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataColumnCollection.cs
@@ -0,0 +1,61 @@
+//
+// Mono.Data.Tds.Protocol.TdsDataColumnCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System.Collections;
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsDataColumnCollection : IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsDataColumnCollection ()
+ {
+ list = new ArrayList ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public TdsDataColumn this [int index] {
+ get { return (TdsDataColumn) list[index]; }
+ set { list[index] = value; }
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (TdsDataColumn schema)
+ {
+ int index;
+ index = list.Add (schema);
+ schema["ColumnOrdinal"] = index;
+ return index;
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataRow.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataRow.cs
new file mode 100644
index 00000000000..c0905f051c7
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsDataRow.cs
@@ -0,0 +1,125 @@
+//
+// Mono.Data.Tds.Protocol.TdsDataRow.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsDataRow : IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+ int bigDecimalIndex;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsDataRow ()
+ {
+ list = new ArrayList ();
+ bigDecimalIndex = -1;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int BigDecimalIndex {
+ get { return bigDecimalIndex; }
+ set { bigDecimalIndex = value; }
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public object this[int index] {
+ get {
+ if (index > list.Count)
+ throw new IndexOutOfRangeException ();
+ return list[index];
+ }
+ set { list[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ return list.Add (value);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ return list.Contains (value);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public void CopyTo (int index, Array array, int arrayIndex, int count)
+ {
+ list.CopyTo (index, array, arrayIndex, count);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object value)
+ {
+ return list.IndexOf (value);
+ }
+
+ public void Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (object value)
+ {
+ list.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsEnvPacketSubType.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsEnvPacketSubType.cs
new file mode 100644
index 00000000000..693f453a4ca
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsEnvPacketSubType.cs
@@ -0,0 +1,16 @@
+//
+// Mono.Data.Tds.Protocol.TdsEnvPacketSubType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsEnvPacketSubType {
+ Database = 0x1,
+ CharSet = 0x3,
+ BlockSize = 0x4
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalError.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalError.cs
new file mode 100644
index 00000000000..a7bb9888cb1
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalError.cs
@@ -0,0 +1,89 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalError.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public sealed class TdsInternalError
+ {
+ #region Fields
+
+ byte theClass;
+ int lineNumber;
+ string message;
+ int number;
+ string procedure;
+ string server;
+ string source;
+ byte state;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsInternalError (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Byte Class {
+ get { return theClass; }
+ set { theClass = value; }
+ }
+
+ public int LineNumber {
+ get { return lineNumber; }
+ set { lineNumber = value; }
+ }
+
+ public string Message {
+ get { return message; }
+ set { message = value; }
+ }
+
+ public int Number {
+ get { return number; }
+ set { number = value; }
+ }
+
+ public string Procedure {
+ get { return procedure; }
+ set { procedure = value; }
+ }
+
+ public string Server {
+ get { return server; }
+ set { server = value;}
+ }
+
+ public string Source {
+ get { return source; }
+ set { source = value; }
+ }
+
+ public byte State {
+ get { return state; }
+ set { state = value; }
+ }
+
+ #endregion // Properties
+ }
+}
+
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorCollection.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorCollection.cs
new file mode 100644
index 00000000000..077435d4dde
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorCollection.cs
@@ -0,0 +1,64 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalErrorCollection.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace Mono.Data.Tds.Protocol {
+ public sealed class TdsInternalErrorCollection : IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsInternalErrorCollection ()
+ {
+ list = new ArrayList ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public TdsInternalError this [int index] {
+ get { return (TdsInternalError) list[index]; }
+ set { list[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (TdsInternalError error)
+ {
+ return list.Add (error);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
+
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventArgs.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventArgs.cs
new file mode 100644
index 00000000000..397d9325b9e
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventArgs.cs
@@ -0,0 +1,24 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public sealed class TdsInternalErrorMessageEventArgs : TdsInternalInfoMessageEventArgs
+ {
+ #region Constructors
+
+ public TdsInternalErrorMessageEventArgs (TdsInternalError error)
+ : base (error)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventHandler.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventHandler.cs
new file mode 100644
index 00000000000..8e3029f0340
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventHandler.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public delegate void TdsInternalErrorMessageEventHandler (object sender, TdsInternalErrorMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalException.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalException.cs
new file mode 100644
index 00000000000..ad8c70e4c2f
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalException.cs
@@ -0,0 +1,97 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsInternalException : SystemException
+ {
+ #region Fields
+
+ byte theClass;
+ int lineNumber;
+ string message;
+ int number;
+ string procedure;
+ string server;
+ string source;
+ byte state;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal TdsInternalException ()
+ : base ("a TDS Exception has occurred.")
+ {
+ }
+
+ internal TdsInternalException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ : base (message)
+ {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte Class {
+ get { return theClass; }
+ }
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public override string Message {
+ get { return message; }
+ }
+
+ public int Number {
+ get { return number; }
+ }
+
+ public string Procedure {
+ get { return procedure; }
+ }
+
+ public string Server {
+ get { return server; }
+ }
+
+ public override string Source {
+ get { return source; }
+ }
+
+ public byte State {
+ get { return state; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventArgs.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..20d09075c47
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventArgs.cs
@@ -0,0 +1,85 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalInfoMessageEventArgs.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsInternalInfoMessageEventArgs : EventArgs
+ {
+ #region Fields
+
+ TdsInternalErrorCollection errors;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsInternalInfoMessageEventArgs (TdsInternalErrorCollection errors)
+ {
+ this.errors = errors;
+ }
+
+ public TdsInternalInfoMessageEventArgs (TdsInternalError error)
+ {
+ this.errors = new TdsInternalErrorCollection ();
+ errors.Add (error);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public TdsInternalErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public byte Class {
+ get { return errors[0].Class; }
+ }
+
+ public int LineNumber {
+ get { return errors[0].LineNumber; }
+ }
+
+ public string Message {
+ get { return errors[0].Message; }
+ }
+
+ public int Number {
+ get { return errors[0].Number; }
+ }
+
+ public string Procedure {
+ get { return errors[0].Procedure; }
+ }
+
+ public string Server {
+ get { return errors[0].Server; }
+ }
+
+ public string Source {
+ get { return errors[0].Source; }
+ }
+
+ public byte State {
+ get { return errors[0].State; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ return errors.Add (new TdsInternalError (theClass, lineNumber, message, number, procedure, server, source, state));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventHandler.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..a90d7c9dda7
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// Mono.Data.Tds.Protocol.TdsInternalInfoMessageEventHandler.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public delegate void TdsInternalInfoMessageEventHandler (object sender, TdsInternalInfoMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketSubType.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketSubType.cs
new file mode 100644
index 00000000000..4a5f23de25a
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketSubType.cs
@@ -0,0 +1,40 @@
+//
+// Mono.Data.Tds.Protocol.TdsPacketSubType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsPacketSubType {
+ Capability = 0xe2,
+ Dynamic = 0xe7,
+ Dynamic2 = 0xa3,
+ EnvironmentChange = 0xe3,
+ Error = 0xaa,
+ Info = 0xab,
+ EED = 0xe5,
+ Param = 0xac,
+ LoginAck = 0xad,
+ ReturnStatus = 0x79,
+ ProcId = 0x7c,
+ Done = 0xfd,
+ DoneProc = 0xfe,
+ DoneInProc = 0xff,
+ ColumnName = 0xa0,
+ ColumnInfo = 0xa1,
+ ColumnDetail = 0xa5,
+ AltName = 0xa7,
+ AltFormat = 0xa8,
+ TableName = 0xa4,
+ ColumnOrder = 0xa9,
+ Control = 0xae,
+ Row = 0xd1,
+ ColumnMetadata = 0x81,
+ RowFormat = 0xee,
+ ParamFormat = 0xec,
+ Parameters = 0xd7
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketType.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketType.cs
new file mode 100644
index 00000000000..5174000c61f
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsPacketType.cs
@@ -0,0 +1,23 @@
+//
+// Mono.Data.Tds.Protocol.TdsPacketType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsPacketType
+ {
+ None = 0x0,
+ Query = 0x1,
+ Logon = 0x2,
+ Proc = 0x3,
+ Reply = 0x4,
+ Cancel = 0x6,
+ Logon70 = 0x10,
+ Logoff = 0x71,
+ Normal = 0x0f
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsServerType.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsServerType.cs
new file mode 100644
index 00000000000..c25ab9a653e
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsServerType.cs
@@ -0,0 +1,17 @@
+//
+// Mono.Data.Tds.Protocol.TdsServerType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsServerType
+ {
+ Generic, // use TDS version 4.2
+ SqlServer, // use TDS version 4.2, 7.0, 8.0
+ Sybase // use TDS version 4,2, 5.0
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsTimeoutException.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsTimeoutException.cs
new file mode 100644
index 00000000000..c6e51b12357
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsTimeoutException.cs
@@ -0,0 +1,20 @@
+//
+// Mono.Data.Tds.Protocol.TdsTimeoutException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+
+namespace Mono.Data.Tds.Protocol {
+ public class TdsTimeoutException : TdsInternalException
+ {
+ internal TdsTimeoutException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ : base (theClass, lineNumber, message, number, procedure, server, source, state)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsVersion.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsVersion.cs
new file mode 100644
index 00000000000..05f652b9d00
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsVersion.cs
@@ -0,0 +1,18 @@
+//
+// Mono.Data.Tds.Protocol.TdsVersionInternal.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) 2002 Daniel Morgan
+//
+
+namespace Mono.Data.Tds.Protocol {
+ public enum TdsVersion
+ {
+ tds42 = 42, // used by older Sybase and Microsoft SQL (< 7.0) servers
+ tds50 = 50, // used by Sybase
+ tds70 = 70, // used by Microsoft SQL server 7.0/2000
+ tds80 = 80 // used by Microsoft SQL server 2000
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.build b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.build
new file mode 100755
index 00000000000..57e88122c30
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.build
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.Tds.dll -->
+
+<project name="Mono.Data.Tds" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.Tds.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/Mono.Data.Tds.dll" tofile="../System.Data/Test/Mono.Data.Tds.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../System.Data/Test/Mono.Data.Tds.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameter.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameter.cs
new file mode 100644
index 00000000000..9c28363410c
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameter.cs
@@ -0,0 +1,221 @@
+//
+// Mono.Data.Tds.TdsMetaParameter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Text;
+
+namespace Mono.Data.Tds {
+ public class TdsMetaParameter
+ {
+ #region Fields
+
+ TdsParameterDirection direction = TdsParameterDirection.Input;
+ byte precision;
+ byte scale;
+ int size;
+ string typeName;
+ string name;
+ bool isSizeSet = false;
+ bool isNullable;
+ object value;
+
+ #endregion // Fields
+
+ public TdsMetaParameter (string name, object value)
+ : this (name, String.Empty, value)
+ {
+ }
+
+ public TdsMetaParameter (string name, string typeName, object value)
+ {
+ ParameterName = name;
+ Value = value;
+ TypeName = typeName;
+ IsNullable = false;
+ }
+
+ public TdsMetaParameter (string name, int size, bool isNullable, byte precision, byte scale, object value)
+ {
+ ParameterName = name;
+ Size = size;
+ IsNullable = isNullable;
+ Precision = precision;
+ Scale = scale;
+ Value = value;
+ }
+
+ #region Properties
+
+ public TdsParameterDirection Direction {
+ get { return direction; }
+ set { direction = value; }
+ }
+
+ public string TypeName {
+ get { return typeName; }
+ set { typeName = value; }
+ }
+
+ public string ParameterName {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public bool IsNullable {
+ get { return isNullable; }
+ set { isNullable = value; }
+ }
+
+ public object Value {
+ get { return value; }
+ set { this.value = value; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ set { precision = value; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ set { scale = value; }
+ }
+
+ public int Size {
+ get { return GetSize (); }
+ set {
+ size = value;
+ isSizeSet = true;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal string Prepare ()
+ {
+ StringBuilder result = new StringBuilder (String.Format ("{0} {1}", ParameterName, TypeName));
+ switch (TypeName) {
+ case "decimal":
+ case "numeric":
+ result.Append (String.Format ("({0},{1})", Precision, Scale));
+ break;
+ case "varchar":
+ case "nvarchar":
+ case "varbinary":
+ result.Append (String.Format ("({0})", Size));
+ break;
+ case "char":
+ case "nchar":
+ case "binary":
+ if (isSizeSet && Size > 0)
+ result.Append (String.Format ("({0})", Size));
+ break;
+ }
+ return result.ToString ();
+ }
+
+ internal int GetActualSize ()
+ {
+ if (Value == DBNull.Value || Value == null)
+ return 0;
+
+ switch (Value.GetType ().ToString ()) {
+ case "System.String":
+ return ((string) value).Length;
+ case "System.Byte[]":
+ return ((byte[]) value).Length;
+ }
+ return GetSize ();
+ }
+
+ private int GetSize ()
+ {
+ if (IsNullable) {
+ switch (TypeName) {
+ case "bigint":
+ return 8;
+ case "datetime":
+ return 8;
+ case "float":
+ return 8;
+ case "int":
+ return 4;
+ case "real":
+ return 4;
+ case "smalldatetime":
+ return 4;
+ case "smallint":
+ return 2;
+ case "tinyint":
+ return 1;
+ }
+ }
+ return size;
+ }
+
+ internal TdsColumnType GetMetaType ()
+ {
+ switch (TypeName) {
+ case "binary":
+ return TdsColumnType.Binary;
+ case "bit":
+ return TdsColumnType.Bit;
+ case "char":
+ return TdsColumnType.Char;
+ case "decimal":
+ return TdsColumnType.Decimal;
+ case "datetime":
+ if (IsNullable)
+ return TdsColumnType.DateTimeN;
+ return TdsColumnType.DateTime;
+ case "float":
+ return TdsColumnType.Float8;
+ case "image":
+ return TdsColumnType.Image;
+ case "int":
+ if (IsNullable)
+ return TdsColumnType.IntN;
+ return TdsColumnType.Int4;
+ case "numeric":
+ return TdsColumnType.Numeric;
+ case "nchar":
+ return TdsColumnType.NChar;
+ case "ntext":
+ return TdsColumnType.NText;
+ case "nvarchar":
+ return TdsColumnType.NVarChar;
+ case "real":
+ return TdsColumnType.Real;
+ case "smallint":
+ if (IsNullable)
+ return TdsColumnType.IntN;
+ return TdsColumnType.Int2;
+ case "text":
+ return TdsColumnType.Text;
+ case "tinyint":
+ if (IsNullable)
+ return TdsColumnType.IntN;
+ return TdsColumnType.Int1;
+ case "uniqueidentifier":
+ return TdsColumnType.UniqueIdentifier;
+ case "varbinary":
+ return TdsColumnType.VarBinary;
+ case "varchar":
+ return TdsColumnType.VarChar;
+ default:
+ throw new NotSupportedException ();
+ }
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameterCollection.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameterCollection.cs
new file mode 100644
index 00000000000..f39bfb08982
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsMetaParameterCollection.cs
@@ -0,0 +1,113 @@
+//
+// Mono.Data.Tds.TdsMetaParameter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace Mono.Data.Tds {
+ public class TdsMetaParameterCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+
+ #endregion // Fields
+
+ public TdsMetaParameterCollection ()
+ {
+ list = new ArrayList ();
+ }
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public TdsMetaParameter this [int index] {
+ get { return (TdsMetaParameter) list [index]; }
+ }
+
+ public TdsMetaParameter this [string name] {
+ get { return (TdsMetaParameter) this [IndexOf (name)]; }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (TdsMetaParameter value)
+ {
+ return list.Add (value);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (TdsMetaParameter value)
+ {
+ return list.Contains (value);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (TdsMetaParameter value)
+ {
+ return list.IndexOf (value);
+ }
+
+ public int IndexOf (string name)
+ {
+ for (int i = 0; i < Count; i += 1)
+ if (this [i].ParameterName.Equals (name))
+ return i;
+ return -1;
+ }
+
+ public void Insert (int index, TdsMetaParameter value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (TdsMetaParameter value)
+ {
+ list.Remove (value);
+ }
+
+ public void Remove (string name)
+ {
+ RemoveAt (IndexOf (name));
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsParameterDirection.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsParameterDirection.cs
new file mode 100644
index 00000000000..910a729a1a3
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds/TdsParameterDirection.cs
@@ -0,0 +1,21 @@
+//
+// Mono.Data.Tds.TdsRunBehavior.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.Tds {
+ [Serializable]
+ public enum TdsParameterDirection
+ {
+ Input,
+ Output,
+ InputOutput,
+ ReturnValue
+ }
+}
diff --git a/mcs/class/Mono.Data.Tds/list b/mcs/class/Mono.Data.Tds/list
new file mode 100644
index 00000000000..f869f5ab6b6
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/list
@@ -0,0 +1,30 @@
+Mono.Data.Tds/TdsMetaParameter.cs
+Mono.Data.Tds/TdsMetaParameterCollection.cs
+Mono.Data.Tds/TdsParameterDirection.cs
+Mono.Data.Tds.Protocol/ITds.cs
+Mono.Data.Tds.Protocol/Tds.cs
+Mono.Data.Tds.Protocol/Tds42.cs
+Mono.Data.Tds.Protocol/Tds50.cs
+Mono.Data.Tds.Protocol/Tds70.cs
+Mono.Data.Tds.Protocol/Tds80.cs
+Mono.Data.Tds.Protocol/TdsBigDecimal.cs
+Mono.Data.Tds.Protocol/TdsColumnStatus.cs
+Mono.Data.Tds.Protocol/TdsColumnType.cs
+Mono.Data.Tds.Protocol/TdsComm.cs
+Mono.Data.Tds.Protocol/TdsConnectionParameters.cs
+Mono.Data.Tds.Protocol/TdsDataColumn.cs
+Mono.Data.Tds.Protocol/TdsDataColumnCollection.cs
+Mono.Data.Tds.Protocol/TdsDataRow.cs
+Mono.Data.Tds.Protocol/TdsEnvPacketSubType.cs
+Mono.Data.Tds.Protocol/TdsInternalError.cs
+Mono.Data.Tds.Protocol/TdsInternalErrorCollection.cs
+Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventArgs.cs
+Mono.Data.Tds.Protocol/TdsInternalErrorMessageEventHandler.cs
+Mono.Data.Tds.Protocol/TdsInternalException.cs
+Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventArgs.cs
+Mono.Data.Tds.Protocol/TdsInternalInfoMessageEventHandler.cs
+Mono.Data.Tds.Protocol/TdsPacketSubType.cs
+Mono.Data.Tds.Protocol/TdsPacketType.cs
+Mono.Data.Tds.Protocol/TdsTimeoutException.cs
+Mono.Data.Tds.Protocol/TdsVersion.cs
+Mono.Data.Tds.Protocol/TODOAttribute.cs
diff --git a/mcs/class/Mono.Data.Tds/makefile.gnu b/mcs/class/Mono.Data.Tds/makefile.gnu
new file mode 100644
index 00000000000..b6d71f4b473
--- /dev/null
+++ b/mcs/class/Mono.Data.Tds/makefile.gnu
@@ -0,0 +1,14 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.Tds.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data.TdsClient/.cvsignore b/mcs/class/Mono.Data.TdsClient/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Data.TdsClient/ChangeLog b/mcs/class/Mono.Data.TdsClient/ChangeLog
new file mode 100644
index 00000000000..100c2361637
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/ChangeLog
@@ -0,0 +1,249 @@
+2002-12-01 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient/TdsDataReader.cs:
+ Change to reflect TdsSchemaInfo -> TdsDataColumnCollection
+ shift.
+
+2002-11-26 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.build:
+ * makefile.gnu:
+ Add System.EnterpriseServices to build.
+ * Mono.Data.TdsClient/TdsCommand.cs:
+ * Mono.Data.TdsClient/TdsConnection.cs:
+ * Mono.Data.TdsClient/TdsDataReader.cs:
+ * Mono.Data.TdsClient/TdsException.cs:
+ * Mono.Data.TdsClient/TdsParameter.cs:
+ * Mono.Data.TdsClient/TdsParameterCollection.cs:
+ * Mono.Data.TdsClient/TdsTransaction.cs:
+ * Mono.Data.TdsTypes/TdsDecimal.cs:
+ Copied over from the Sybase classes because the
+ whole world is changing and I want generic
+ TDS to keep up.
+
+2002-11-21 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.build:
+ * Mono.Data.TdsClient/TdsCommand.cs:
+ * Mono.Data.TdsClient/TdsConnection.cs:
+ * Mono.Data.TdsClient/TdsConnectionPool.cs:
+ * Mono.Data.TdsClient/TdsDataReader.cs:
+ * Mono.Data.TdsClient/TdsError.cs:
+ * Mono.Data.TdsClient/TdsErrorCollection.cs:
+ * Mono.Data.TdsClient/TdsException.cs:
+ * Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs:
+ * Mono.Data.TdsClient/TdsParameterCollection.cs:
+ * Mono.Data.TdsClient/TdsTransaction.cs:
+ * Mono.Data.TdsTypes/TdsDecimal.cs:
+ Modify to accept new Mono.Data.Tds.Protocol
+ namespace in Mono.Data.Tds assembly, replacing
+ Mono.Data.TdsClient.Internal
+
+2002-11-19 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ * Mono.Data.TdsClient.Internal/Tds50.cs:
+ * Mono.Data.TdsClient.Internal/TdsPacketSubType.cs:
+ More changes to get Sybase queries working
+ properly.
+
+
+2002-11-18 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ * Mono.Data.TdsClient.Internal/Tds50.cs:
+ * Mono.Data.TdsClient.Internal/TdsComm.cs:
+ * Mono.Data.TdsClient.Internal/TdsPacketSubType.cs:
+ * Mono.Data.TdsClient.Internal/TdsPacketType.cs:
+ Sybase compatibility fixes.
+
+2002-11-15 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ Add support for UniqueIdentifier (GUID),
+ Money types
+
+2002-11-14 Tim Coleman <tim@timcoleman.com>
+ * list:
+ * Mono.Data.TdsClient/TdsType.cs:
+ Add this class
+ * Mono.Data.TdsClient/TdsDataReader.cs:
+ Add GetSchemaTable implementation
+ * Mono.Data.TdsClient.Internal/ITds.cs:
+ Add RecordsAffected
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ Add RecordsAffected
+ Fix handling of DateTime, decimal, and float types
+ * Mono.Data.TdsClient.Internal/Tds42.cs:
+ * Mono.Data.TdsClient.Internal/Tds50.cs:
+ * Mono.Data.TdsClient.Internal/Tds70.cs:
+ * Mono.Data.TdsClient.Internal/TdsPacketColumnInfoResult.cs:
+ * Mono.Data.TdsClient.Internal/TdsSchemaInfo.cs:
+ Change SchemaTable handling
+ * Mono.Data.TdsClient.Internal/TdsPacketRowResult.cs:
+ Add proper decimal handling
+
+2002-11-13 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ Fix GetStringValue, GetTextValue when handling NULL
+ values.
+ * Mono.Data.TdsClient.Internal/TdsComm.cs:
+ Comment out asynchronous socket connect
+ because it doesn't work properly yet on
+ Linux.
+
+2002-11-12 Tim Coleman <tim@timcoleman.com>
+ * Mono.Data.TdsClient.Internal/TdsContext.cs:
+ Remove this class as it is not being used
+ * Mono.Data.TdsClient.Internal/ITds.cs
+ * Mono.Data.TdsClient.Internal/Tds.cs
+ * Mono.Data.TdsClient.Internal/Tds42.cs
+ * Mono.Data.TdsClient.Internal/Tds50.cs
+ * Mono.Data.TdsClient.Internal/Tds70.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketColumnInfoResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketColumnNamesResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketColumnOrderResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketControlResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketEndTokenResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketOutputParam.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketRetStatResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketRowResult.cs
+ * Mono.Data.TdsClient.Internal/TdsPacketUnknown.cs
+ Remove references to System.Data
+
+2002-11-09 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add new internal classes
+ * Mono.Data.TdsClient.Internal/TdsInternalException.cs:
+ * Mono.Data.TdsClient.Internal/TdsTimeoutException.cs:
+ Add new classes to implement timeouts
+ * Mono.DataTdsClient/TdsConnection.cs:
+ * Mono.DataTdsClient/TdsConnectionPool.cs:
+ Add connection timeout
+ * Mono.Data.TdsClient.Internal/ITds.cs:
+ Add command timeouts
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ * Mono.Data.TdsClient.Internal/Tds42.cs:
+ * Mono.Data.TdsClient.Internal/Tds50.cs:
+ * Mono.Data.TdsClient.Internal/Tds70.cs:
+ * Mono.Data.TdsClient.Internal/Tds80.cs:
+ * Mono.Data.TdsClient.Internal/TdsComm.cs:
+ Add command, connection timeouts
+
+2002-11-04 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add Mono.Data.TdsClient.Internal.TdsInternalError
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorCollection
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventHandler
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventArgs
+ Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventHandler
+ Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventArgs
+ Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResult
+ Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResultCollection
+ Remove Mono.Data.TdsClient.Internal.TdsPacketMessageResult
+ * Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs:
+ * Mono.Data.TdsClient/TdsInfoMessageEventHandler.cs:
+ * Mono.Data.TdsClient.Internal/TdsInternalError.cs:
+ * Mono.Data.TdsClient.Internal/TdsInternalErrorCollection.cs:
+ * Mono.Data.TdsClient.Internal/TdsInternalErrorMessageEventArgs.cs:
+ * Mono.Data.TdsClient.Internal/TdsInternalErrorMessageEventHandler.cs:
+ * Mono.Data.TdsClient.Internal/TdsInternalInfoMessageEventArgs.cs:
+ * Mono.Data.TdsClient.Internal/TdsInternalInfoMessageEventHandler.cs:
+ New classes added
+ * Mono.Data.TdsClient.Internal/TdsPacketErrorResult.cs:
+ * Mono.Data.TdsClient.Internal/TdsPacketErrorResultCollection.cs:
+ * Mono.Data.TdsClient.Internal/TdsPacketMessageResult.cs:
+ Classes removed
+ * Mono.Data.TdsClient/TdsCommand.cs:
+ * Mono.Data.TdsClient/TdsConnection.cs:
+ * Mono.Data.TdsClient/TdsError.cs:
+ * Mono.Data.TdsClient/TdsErrorCollection.cs:
+ * Mono.Data.TdsClient/TdsException.cs:
+ * Mono.Data.TdsClient/TdsTransaction.cs:
+ * Mono.Data.TdsClient/TdsPacketColumnInfoResult.cs:
+ More implementation
+ * Mono.Data.TdsClient.Internal/ITds.cs:
+ * Mono.Data.TdsClient.Internal/Tds.cs:
+ * Mono.Data.TdsClient.Internal/Tds42.cs:
+ * Mono.Data.TdsClient.Internal/Tds50.cs:
+ * Mono.Data.TdsClient.Internal/Tds70.cs:
+ * Mono.Data.TdsClient.Internal/Tds80.cs:
+ New events added
+
+2002-11-04 Tim Coleman (tim@timcoleman.com)
+ * list :
+ Add Mono.Data.TdsClient.Internal.TdsBigDecimal
+
+2002-11-03 Tim Coleman (tim@timcoleman.com)
+ * list :
+ Add Mono.Data.TdsTypes
+ Add Mono.Data.TdsClient.Locale.cs
+ Add Mono.Data.TdsClient.Internal.TdsColumnStatus.cs
+
+2002-10-31 Tim Coleman (tim@timcoleman.com)
+ * list :
+ Add TdsSchemaInfo.cs
+
+2002-10-30 Tim Coleman (tim@timcoleman.com)
+ * list :
+ Remove TdsColumnSchema.cs
+
+2002-10-25 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add new files to build.
+
+2002-10-24 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add new files to build.
+
+2002-10-23 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add new files to build
+ * Mono.Data.TdsClient.build:
+ Exclude Tds70.cs, Tds80.cs, Tds50.cs
+ Those should only be included with
+ the appropriate providers.
+
+
+2002-10-22 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add TODOAttribute in both
+ namespaces
+ Add TdsConnectionPool
+
+2002-10-20 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add new files to build.
+
+2002-10-19 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add new files to build.
+
+2002-10-18 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add Mono.Data.TdsClient.Internal/TdsCommInternal.cs
+ Add
+ Mono.Data.TdsClient.Internal/TdsConnectionParametersInternal.cs
+ Mono.Data.TdsClient.Internal/TdsInternal.cs
+
+2002-10-17 Tim Coleman (tim@timcoleman.com)
+ * list:
+ Add files from Mono.Data.TdsClient.Internal
+ * makefile.gnu:
+ Add reference to System.Data.dll. This is
+ fine, just not the reverse.
+
+2002-10-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Mono.Data.TdsClient.build: added build for windows
+
+ * Test: added directory for tests
+
+ * Mono.Data.TdsClient/TdsVersion.cs: added file for
+ enum TdsVersion
+
+ * Mono.Data.TdsClient/TdsConnection.cs: added public
+ property TdsVersion so it can be set to
+ use TDS version 4.2, 5.0, 7.0, or 8.0. Also, added
+ comments
+
+
+2002-10-16 Tim Coleman (tim@timcoleman.com)
+ * ChangeLog:
+ * list:
+ * makefile.gnu:
+ Added new files to start this assembly
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient.build b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient.build
new file mode 100644
index 00000000000..deec8da52f6
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient.build
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.TdsClient.dll -->
+
+<project name="Mono.Data.TdsClient" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.TdsClient.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.EnterpriseServices.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <arg value="/r:../lib/Mono.Data.Tds.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="Mono.Data.TdsClient.Internal/**"/>
+ <excludes name="Mono.Data.TdsClient/Test.cs"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.EnterpriseServices.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ <includes name="../lib/Mono.Data.Tds.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.Data.TdsClient.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/ChangeLog b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/ChangeLog
new file mode 100644
index 00000000000..d08d2dce883
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/ChangeLog
@@ -0,0 +1,126 @@
+2002-11-04 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Locale.cs: added missing file. Build blocker.
+
+2002-11-03 Tim Coleman (tim@timcoleman.com)
+ * TdsDatareader.cs:
+ Add BaseColumnName, rename BaseTableName
+
+2002-10-31 Tim Coleman (tim@timcoleman.com)
+ * TdsDataReader.cs:
+ D'oh! Now use TdsSchemaInfo because SchemaInfo
+ is internal to System.Data.dll
+
+2002-10-30 Tim Coleman (tim@timcoleman.com)
+ * TdsDataReader.cs:
+ Use SchemaInfo instead of TdsColumnSchema
+
+
+2002-10-25 Tim Coleman (tim@timcoleman.com)
+ * TdsConnection.cs:
+ * TdsConnectionPool.cs:
+ Use a different locking mechanism for connection
+ pools.
+ The connection pool now uses a Monitor to have
+ exclusive access.
+ * TdsDataReader.cs:
+ Implement a bit more.
+
+2002-10-24 Tim Coleman (tim@timcoleman.com)
+ * TdsDataAdapter.cs:
+ * TdsRowUpdatedEventArgs.cs:
+ * TdsRowUpdatedEventHandler.cs:
+ * TdsRowUpdatingEventArgs.cs:
+ * TdsRowUpdatingEventHandler.cs:
+ New classes added.
+ * TdsCommand.cs:
+ Implemented the ExecuteReader ()
+ method
+ * TdsConnection.cs:
+ Added Dispose (), fixed connection parameter bug
+ * TdsDataReader.cs:
+ Implemented many methods
+
+2002-10-23 Tim Coleman (tim@timcoleman.com)
+ * TdsCommand.cs:
+ Change ExecuteReader call
+ * TdsConnection.cs:
+ Much to do with the restructuring
+ of the TDS objects and some
+ simplification.
+ * TdsConnectionPool.cs:
+ Some modifications to do with above.
+ * TdsTransaction.cs:
+ Move calls out of Tds object and
+ into here. Simpler, makes Tds
+ object smaller, doesn't change this
+ much.
+
+2002-10-22 Tim Coleman (tim@timcoleman.com)
+ * TdsConnectionPool.cs:
+ New class added for pooling connections
+ * TdsCommand.cs:
+ * TdsTransaction.cs:
+ Some implementation, handling of
+ pooled connections and such.
+ * TdsConnection.cs:
+ Code cleanups, more implementation
+ Connection pooling (works!)
+ * TODOAttribute.cs:
+ Add this to this namespace
+ * TdsDataReader.cs:
+ * TdsErrorCollection.cs:
+ * TdsException.cs:
+ * TdsParameterCollection.cs:
+ Change the TODO attributes
+
+2002-10-21 Tim Coleman (tim@timcoleman.com)
+ * TdsConnection.cs:
+ Make sure to set the TDS Version. (This will
+ use 4.2)
+
+2002-10-20 Tim Coleman (tim@timcoleman.com)
+ * TdsConnection.cs:
+ Lots of stuff to get this working somewhat.
+
+2002-10-19 Tim Coleman (tim@timcoleman.com)
+ * TdsDataReader.cs:
+ * TdsError.cs:
+ * TdsErrorCollection.cs:
+ * TdsException.cs:
+ * TdsParameter.cs:
+ * TdsParameterCollection.cs:
+ Added new classes, to get started with this namespace.
+ This is pretty much what is needed to do things like
+ TdsConnection and so on.
+ * TdsCommand.cs:
+ De-wrappify this class. There is no longer a
+ Mono.Data.TdsClient.Internal.TdsCommandInternal class.
+ * TdsConnection.cs:
+ De-wrappify this class. There is no longer a
+ Mono.Data.TdsClient.Internal.TdsConnectionInternal class.
+ * TdsTransaction.cs:
+ De-wrappify this class. There is no longer a
+ Mono.Data.TdsClient.Internal.TdsTransactionInternal class.
+
+2002-10-17 Tim Coleman (tim@timcoleman.com)
+ * IsolationLevel.cs:
+ Removed, as we now use IsolationLevel from System.Data
+ * TdsCommand.cs:
+ * TdsConnection.cs:
+ * TdsTransaction.cs:
+ These classes are now just wrappers for the
+ Mono.Data.TdsClient.Internal classes.
+ * TdsServerType.cs:
+ Slight modification
+
+
+2002-10-16 Tim Coleman (tim@timcoleman.com)
+ * ChangeLog:
+ New ChangeLog
+ * IsolationLevel.cs:
+ * TdsCommand.cs:
+ * TdsConnection.cs:
+ * TdsServerType.cs:
+ * TdsTransaction.cs:
+ Added skeletons to get started.
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/Locale.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/Locale.cs
new file mode 100755
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TODOAttribute.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TODOAttribute.cs
new file mode 100644
index 00000000000..1aa003214d7
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.TdsClient {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsCommand.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsCommand.cs
new file mode 100644
index 00000000000..f01591bc930
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsCommand.cs
@@ -0,0 +1,362 @@
+//
+// Mono.Data.TdsClient.TdsCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002 http://www.ximian.com/
+// (C) Daniel Morgan, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsCommand : Component, IDbCommand, ICloneable
+ {
+ #region Fields
+
+ bool disposed = false;
+ int commandTimeout;
+ bool designTimeVisible;
+ string commandText;
+ CommandType commandType;
+ TdsConnection connection;
+ TdsTransaction transaction;
+ UpdateRowSource updatedRowSource;
+ CommandBehavior behavior = CommandBehavior.Default;
+ TdsParameterCollection parameters;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsCommand()
+ : this (String.Empty, null, null)
+ {
+ }
+
+ public TdsCommand (string commandText)
+ : this (commandText, null, null)
+ {
+ commandText = commandText;
+ }
+
+ public TdsCommand (string commandText, TdsConnection connection)
+ : this (commandText, connection, null)
+ {
+ Connection = connection;
+ }
+
+ public TdsCommand (string commandText, TdsConnection connection, TdsTransaction transaction)
+ {
+ this.commandText = commandText;
+ this.connection = connection;
+ this.transaction = transaction;
+ this.commandType = CommandType.Text;
+ this.updatedRowSource = UpdateRowSource.Both;
+
+ this.designTimeVisible = false;
+ this.commandTimeout = 30;
+ parameters = new TdsParameterCollection (this);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ internal CommandBehavior CommandBehavior {
+ get { return behavior; }
+ }
+
+ public string CommandText {
+ get { return commandText; }
+ set { commandText = value; }
+ }
+
+ public int CommandTimeout {
+ get { return commandTimeout; }
+ set {
+ if (commandTimeout < 0)
+ throw new ArgumentException ("The property value assigned is less than 0.");
+ commandTimeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get { return commandType; }
+ set {
+ if (value == CommandType.TableDirect)
+ throw new ArgumentException ("CommandType.TableDirect is not supported by the Mono TdsClient Data Provider.");
+ commandType = value;
+ }
+ }
+
+ public TdsConnection Connection {
+ get { return connection; }
+ set {
+ if (transaction != null && connection.Transaction != null && connection.Transaction.IsOpen)
+ throw new InvalidOperationException ("The Connection property was changed while a transaction was in progress.");
+ transaction = null;
+ connection = value;
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get { return designTimeVisible; }
+ set { designTimeVisible = value; }
+ }
+
+ public TdsParameterCollection Parameters {
+ get { return parameters; }
+ }
+
+ internal ITds Tds {
+ get { return Connection.Tds; }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get { return Connection; }
+ set {
+ if (!(value is TdsConnection))
+ throw new InvalidCastException ("The value was not a valid TdsConnection.");
+ Connection = (TdsConnection) value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get { return Parameters; }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get { return Transaction; }
+ set {
+ if (!(value is TdsTransaction))
+ throw new ArgumentException ();
+ Transaction = (TdsTransaction) value;
+ }
+ }
+
+ public TdsTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
+ }
+
+ public UpdateRowSource UpdatedRowSource {
+ get { return updatedRowSource; }
+ set { updatedRowSource = value; }
+ }
+
+ #endregion // Fields
+
+ #region Methods
+
+ public void Cancel ()
+ {
+ if (Connection == null || Connection.Tds == null)
+ return;
+ Connection.Tds.Cancel ();
+ }
+
+ internal void CloseDataReader (bool moreResults)
+ {
+ GetOutputParameters ();
+ Connection.DataReader = null;
+
+ if ((behavior & CommandBehavior.CloseConnection) != 0)
+ Connection.Close ();
+ }
+
+ public TdsParameter CreateParameter ()
+ {
+ return new TdsParameter ();
+ }
+
+ internal void DeriveParameters ()
+ {
+ if (commandType != CommandType.StoredProcedure)
+ throw new InvalidOperationException (String.Format ("TdsCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType));
+ ValidateCommand ("DeriveParameters");
+
+ TdsParameterCollection localParameters = new TdsParameterCollection (this);
+ localParameters.Add ("@P1", TdsType.NVarChar, commandText.Length).Value = commandText;
+
+ string sql = "sp_procedure_params_rowset";
+
+ Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true);
+
+ TdsDataReader reader = new TdsDataReader (this);
+ parameters.Clear ();
+ object[] dbValues = new object[reader.FieldCount];
+
+ while (reader.Read ()) {
+ reader.GetValues (dbValues);
+ parameters.Add (new TdsParameter (dbValues));
+ }
+ reader.Close ();
+ }
+
+ private void Execute (CommandBehavior behavior, bool wantResults)
+ {
+ TdsMetaParameterCollection parms = Parameters.MetaParameters;
+ bool schemaOnly = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
+ bool keyInfo = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
+
+ StringBuilder sql1 = new StringBuilder ();
+ StringBuilder sql2 = new StringBuilder ();
+
+ if (schemaOnly || keyInfo)
+ sql1.Append ("SET FMTONLY OFF;");
+ if (keyInfo) {
+ sql1.Append ("SET NO_BROWSETABLE ON;");
+ sql2.Append ("SET NO_BROWSETABLE OFF;");
+ }
+ if (schemaOnly) {
+ sql1.Append ("SET FMTONLY ON;");
+ sql2.Append ("SET FMTONLY OFF;");
+ }
+
+ switch (CommandType) {
+ case CommandType.StoredProcedure:
+ if (keyInfo || schemaOnly)
+ Connection.Tds.Execute (sql1.ToString ());
+ Connection.Tds.ExecProc (CommandText, parms, CommandTimeout, wantResults);
+ if (keyInfo || schemaOnly)
+ Connection.Tds.Execute (sql2.ToString ());
+ break;
+ case CommandType.Text:
+ string sql = String.Format ("{0}{1}{2}", sql1.ToString (), CommandText, sql2.ToString ());
+ Connection.Tds.Execute (sql, parms, CommandTimeout, wantResults);
+ break;
+ }
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ ValidateCommand ("ExecuteNonQuery");
+ int result = 0;
+
+ try {
+ Execute (CommandBehavior.Default, false);
+ }
+ catch (TdsTimeoutException e) {
+ throw TdsException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ GetOutputParameters ();
+ return result;
+ }
+
+ public TdsDataReader ExecuteReader ()
+ {
+ return ExecuteReader (CommandBehavior.Default);
+ }
+
+ public TdsDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ ValidateCommand ("ExecuteReader");
+ try {
+ Execute (behavior, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw TdsException.FromTdsInternalException ((TdsInternalException) e);
+ }
+ Connection.DataReader = new TdsDataReader (this);
+ return Connection.DataReader;
+ }
+
+ public object ExecuteScalar ()
+ {
+ ValidateCommand ("ExecuteScalar");
+ try {
+ Execute (CommandBehavior.Default, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw TdsException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ if (!Connection.Tds.NextResult () || !Connection.Tds.NextRow ())
+ return null;
+
+ object result = Connection.Tds.ColumnValues [0];
+ CloseDataReader (true);
+ return result;
+ }
+
+ private void GetOutputParameters ()
+ {
+ Connection.Tds.SkipToEnd ();
+
+ IList list = Connection.Tds.ColumnValues;
+
+ if (list != null && list.Count > 0) {
+ int index = 0;
+ foreach (TdsParameter parameter in parameters) {
+ if (parameter.Direction != ParameterDirection.Input) {
+ parameter.Value = list [index];
+ index += 1;
+ }
+ if (index >= list.Count)
+ break;
+ }
+ }
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new TdsCommand (commandText, Connection);
+ }
+
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ return ExecuteReader ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+ {
+ return ExecuteReader (behavior);
+ }
+
+ public void Prepare ()
+ {
+ throw new NotSupportedException ("TdsClient does not support PREPARE.");
+ }
+
+ public void ResetCommandTimeout ()
+ {
+ commandTimeout = 30;
+ }
+
+ private void ValidateCommand (string method)
+ {
+ if (Connection == null)
+ throw new InvalidOperationException (String.Format ("{0} requires a Connection object to continue.", method));
+ if (Connection.Transaction != null && transaction != Connection.Transaction)
+ throw new InvalidOperationException ("The Connection object does not have the same transaction as the command object.");
+ if (Connection.State != ConnectionState.Open)
+ throw new InvalidOperationException (String.Format ("ExecuteNonQuery requires an open Connection object to continue. This connection is closed.", method));
+ if (commandText == String.Empty || commandText == null)
+ throw new InvalidOperationException ("The command text for this Command has not been set.");
+ if (Connection.DataReader != null)
+ throw new InvalidOperationException ("There is already an open DataReader associated with this Connection which must be closed first.");
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnection.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnection.cs
new file mode 100644
index 00000000000..66a554dc954
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnection.cs
@@ -0,0 +1,518 @@
+//
+// Mono.Data.TdsClient.TdsConnection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.EnterpriseServices;
+using System.Net;
+using System.Text;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsConnection : Component, IDbConnection, ICloneable
+ {
+ #region Fields
+ bool disposed = false;
+
+ // The set of SQL connection pools
+ static Hashtable TdsConnectionPools = new Hashtable ();
+
+ // The current connection pool
+ TdsConnectionPool pool;
+
+ // The connection string that identifies this connection
+ string connectionString = null;
+
+ // The transaction object for the current transaction
+ TdsTransaction transaction = null;
+
+ // Connection parameters
+ TdsConnectionParameters parms = new TdsConnectionParameters ();
+ bool connectionReset;
+ bool pooling;
+ string dataSource;
+ int connectionTimeout;
+ int minPoolSize;
+ int maxPoolSize;
+ int packetSize;
+ int port = 1533;
+
+ // The current state
+ ConnectionState state = ConnectionState.Closed;
+
+ TdsDataReader dataReader = null;
+
+ // The TDS object
+ ITds tds;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsConnection ()
+ : this (String.Empty)
+ {
+ }
+
+ public TdsConnection (string connectionString)
+ {
+ ConnectionString = connectionString;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string ConnectionString {
+ get { return connectionString; }
+ set { SetConnectionString (value); }
+ }
+
+ public int ConnectionTimeout {
+ get { return connectionTimeout; }
+ }
+
+ public string Database {
+ get { return tds.Database; }
+ }
+
+ internal TdsDataReader DataReader {
+ get { return dataReader; }
+ set { dataReader = value; }
+ }
+
+ public string DataSource {
+ get { return dataSource; }
+ }
+
+ public int PacketSize {
+ get { return packetSize; }
+ }
+
+ public string ServerVersion {
+ get { return tds.ServerVersion; }
+ }
+
+ public ConnectionState State {
+ get { return state; }
+ }
+
+ internal ITds Tds {
+ get { return tds; }
+ }
+
+ internal TdsTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
+ }
+
+ public string WorkstationId {
+ get { return parms.Hostname; }
+ }
+
+ #endregion // Properties
+
+ #region Events and Delegates
+
+ public event TdsInfoMessageEventHandler InfoMessage;
+ public event StateChangeEventHandler StateChange;
+
+ private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
+ {
+ throw new TdsException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono TdsClient Data Provider", e.State);
+ }
+
+ private void MessageHandler (object sender, TdsInternalInfoMessageEventArgs e)
+ {
+ OnTdsInfoMessage (CreateTdsInfoMessageEvent (e.Errors));
+ }
+
+ #endregion // Events and Delegates
+
+ #region Methods
+
+ public TdsTransaction BeginTransaction ()
+ {
+ return BeginTransaction (IsolationLevel.ReadCommitted, String.Empty);
+ }
+
+ public TdsTransaction BeginTransaction (IsolationLevel iso)
+ {
+ return BeginTransaction (iso, String.Empty);
+ }
+
+ public TdsTransaction BeginTransaction (string transactionName)
+ {
+ return BeginTransaction (IsolationLevel.ReadCommitted, transactionName);
+ }
+
+ public TdsTransaction BeginTransaction (IsolationLevel iso, string transactionName)
+ {
+ if (State == ConnectionState.Closed)
+ throw new InvalidOperationException ("The connection is not open.");
+ if (Transaction != null)
+ throw new InvalidOperationException ("TdsConnection does not support parallel transactions.");
+
+ string isolevel = String.Empty;
+ switch (iso) {
+ case IsolationLevel.Chaos:
+ isolevel = "CHAOS";
+ break;
+ case IsolationLevel.ReadCommitted:
+ isolevel = "READ COMMITTED";
+ break;
+ case IsolationLevel.ReadUncommitted:
+ isolevel = "READ UNCOMMITTED";
+ break;
+ case IsolationLevel.RepeatableRead:
+ isolevel = "REPEATABLE READ";
+ break;
+ case IsolationLevel.Serializable:
+ isolevel = "SERIALIZABLE";
+ break;
+ }
+
+ tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0}\nBEGIN TRANSACTION {1}", isolevel, transactionName));
+ transaction = new TdsTransaction (this, iso);
+ return transaction;
+ }
+
+ public void ChangeDatabase (string database)
+ {
+ if (!IsValidDatabaseName (database))
+ throw new ArgumentException (String.Format ("The database name {0} is not valid."));
+ if (State != ConnectionState.Open)
+ throw new InvalidOperationException ("The connection is not open");
+ tds.Execute (String.Format ("use {0}", database));
+ }
+
+ private void ChangeState (ConnectionState currentState)
+ {
+ ConnectionState originalState = state;
+ state = currentState;
+ OnStateChange (CreateStateChangeEvent (originalState, currentState));
+ }
+
+ public void Close ()
+ {
+ if (Transaction != null && Transaction.IsOpen)
+ Transaction.Rollback ();
+ if (pooling)
+ pool.ReleaseConnection (tds);
+ else
+ tds.Disconnect ();
+ tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler (ErrorHandler);
+ tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler (MessageHandler);
+ ChangeState (ConnectionState.Closed);
+ }
+
+ public TdsCommand CreateCommand ()
+ {
+ TdsCommand command = new TdsCommand ();
+ command.Connection = this;
+ return command;
+ }
+
+ private StateChangeEventArgs CreateStateChangeEvent (ConnectionState originalState, ConnectionState currentState)
+ {
+ return new StateChangeEventArgs (originalState, currentState);
+ }
+
+ private TdsInfoMessageEventArgs CreateTdsInfoMessageEvent (TdsInternalErrorCollection errors)
+ {
+ return new TdsInfoMessageEventArgs (errors);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ if (State == ConnectionState.Open)
+ Close ();
+ parms = null;
+ dataSource = null;
+ }
+ base.Dispose (disposing);
+ disposed = true;
+ }
+ }
+
+ [MonoTODO]
+ public void EnlistDistributedTransaction (ITransaction transaction)
+ {
+ throw new NotImplementedException ();
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new TdsConnection (ConnectionString);
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel iso)
+ {
+ return BeginTransaction (iso);
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ [MonoTODO ("Figure out the Tds way to reset the connection.")]
+ public void Open ()
+ {
+ if (connectionString == null)
+ throw new InvalidOperationException ("Connection string has not been initialized.");
+
+ try {
+ if (!pooling)
+ tds = new Tds42 (DataSource, port, PacketSize, ConnectionTimeout);
+ else {
+ pool = (TdsConnectionPool) TdsConnectionPools [connectionString];
+ if (pool == null) {
+ pool = new TdsConnectionPool (dataSource, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
+ TdsConnectionPools [connectionString] = pool;
+ }
+ tds = pool.AllocateConnection ();
+ }
+ }
+ catch (TdsTimeoutException e) {
+ throw TdsException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ tds.TdsErrorMessage += new TdsInternalErrorMessageEventHandler (ErrorHandler);
+ tds.TdsInfoMessage += new TdsInternalInfoMessageEventHandler (MessageHandler);
+
+ if (!tds.IsConnected) {
+ tds.Connect (parms);
+ ChangeState (ConnectionState.Open);
+ ChangeDatabase (parms.Database);
+ }
+ else if (connectionReset) {
+ // tds.ExecuteNonQuery ("EXEC sp_reset_connection"); FIXME
+ ChangeState (ConnectionState.Open);
+ }
+ }
+
+ void SetConnectionString (string connectionString)
+ {
+ connectionString += ";";
+ NameValueCollection parameters = new NameValueCollection ();
+
+ if (connectionString == String.Empty)
+ return;
+
+ bool inQuote = false;
+ bool inDQuote = false;
+
+ string name = String.Empty;
+ string value = String.Empty;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in connectionString)
+ {
+ switch (c) {
+ case '\'':
+ inQuote = !inQuote;
+ break;
+ case '"' :
+ inDQuote = !inDQuote;
+ break;
+ case ';' :
+ if (!inDQuote && !inQuote) {
+ if (name != String.Empty && name != null) {
+ value = sb.ToString ();
+ parameters [name.ToUpper ().Trim ()] = value.Trim ();
+ }
+ name = String.Empty;
+ value = String.Empty;
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ case '=' :
+ if (!inDQuote && !inQuote) {
+ name = sb.ToString ();
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ default:
+ sb.Append (c);
+ break;
+ }
+ }
+
+ if (this.ConnectionString == null)
+ {
+ SetDefaultConnectionParameters (parameters);
+ }
+
+ SetProperties (parameters);
+
+ this.connectionString = connectionString;
+ }
+
+ void SetDefaultConnectionParameters (NameValueCollection parameters)
+ {
+ if (null == parameters.Get ("APPLICATION NAME"))
+ parameters["APPLICATION NAME"] = ".Net TdsClient Data Provider";
+ if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT"))
+ parameters["CONNECT TIMEOUT"] = "15";
+ if (null == parameters.Get ("CONNECTION LIFETIME"))
+ parameters["CONNECTION LIFETIME"] = "0";
+ if (null == parameters.Get ("CONNECTION RESET"))
+ parameters["CONNECTION RESET"] = "true";
+ if (null == parameters.Get ("ENLIST"))
+ parameters["ENLIST"] = "true";
+ if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
+ parameters["INTEGRATED SECURITY"] = "false";
+ if (null == parameters.Get ("MAX POOL SIZE"))
+ parameters["MAX POOL SIZE"] = "100";
+ if (null == parameters.Get ("MIN POOL SIZE"))
+ parameters["MIN POOL SIZE"] = "0";
+ if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
+ parameters["NETWORK LIBRARY"] = "dbmssocn";
+ if (null == parameters.Get ("PACKET SIZE"))
+ parameters["PACKET SIZE"] = "512";
+ if (null == parameters.Get ("PERSIST SECURITY INFO"))
+ parameters["PERSIST SECURITY INFO"] = "false";
+ if (null == parameters.Get ("POOLING"))
+ parameters["POOLING"] = "true";
+ if (null == parameters.Get ("WORKSTATION ID"))
+ parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
+ }
+
+ private void SetProperties (NameValueCollection parameters)
+ {
+ string value;
+ foreach (string name in parameters) {
+ value = parameters[name];
+
+ switch (name) {
+ case "APPLICATION NAME" :
+ parms.ApplicationName = value;
+ break;
+ case "ATTACHDBFILENAME" :
+ case "EXTENDED PROPERTIES" :
+ case "INITIAL FILE NAME" :
+ break;
+ case "CONNECT TIMEOUT" :
+ case "CONNECTION TIMEOUT" :
+ connectionTimeout = Int32.Parse (value);
+ break;
+ case "CONNECTION LIFETIME" :
+ break;
+ case "CONNECTION RESET" :
+ connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
+ break;
+ case "CURRENT LANGUAGE" :
+ parms.Language = value;
+ break;
+ case "DATA SOURCE" :
+ case "SERVER" :
+ case "ADDRESS" :
+ case "ADDR" :
+ case "NETWORK ADDRESS" :
+ dataSource = value;
+ break;
+ case "ENLIST" :
+ break;
+ case "INITIAL CATALOG" :
+ case "DATABASE" :
+ parms.Database = value;
+ break;
+ case "INTEGRATED SECURITY" :
+ case "TRUSTED_CONNECTION" :
+ break;
+ case "MAX POOL SIZE" :
+ maxPoolSize = Int32.Parse (value);
+ break;
+ case "MIN POOL SIZE" :
+ minPoolSize = Int32.Parse (value);
+ break;
+ case "NET" :
+ case "NETWORK LIBRARY" :
+ if (!value.ToUpper ().Equals ("DBMSSOCN"))
+ throw new ArgumentException ("Unsupported network library.");
+ break;
+ case "PACKET SIZE" :
+ packetSize = Int32.Parse (value);
+ break;
+ case "PASSWORD" :
+ case "PWD" :
+ parms.Password = value;
+ break;
+ case "PERSIST SECURITY INFO" :
+ break;
+ case "POOLING" :
+ pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
+ break;
+ case "USER ID" :
+ parms.User = value;
+ break;
+ case "WORKSTATION ID" :
+ parms.Hostname = value;
+ break;
+ }
+ }
+ }
+
+
+ static bool IsValidDatabaseName (string database)
+ {
+ if (database.Length > 32 || database.Length < 1)
+ return false;
+
+ if (database[0] == '"' && database[database.Length] == '"')
+ database = database.Substring (1, database.Length - 2);
+ else if (Char.IsDigit (database[0]))
+ return false;
+
+ if (database[0] == '_')
+ return false;
+
+ foreach (char c in database.Substring (1, database.Length - 1))
+ if (!Char.IsLetterOrDigit (c) && c != '_')
+ return false;
+ return true;
+ }
+
+ private void OnTdsInfoMessage (TdsInfoMessageEventArgs value)
+ {
+ if (InfoMessage != null)
+ InfoMessage (this, value);
+ }
+
+ private void OnStateChange (StateChangeEventArgs value)
+ {
+ if (StateChange != null)
+ StateChange (this, value);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnectionPool.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnectionPool.cs
new file mode 100644
index 00000000000..0571ede63b4
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsConnectionPool.cs
@@ -0,0 +1,167 @@
+//
+// Mono.Data.TdsClient.TdsConnectionPool.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Threading;
+
+namespace Mono.Data.TdsClient {
+ internal class TdsConnectionPool : MarshalByRefObject, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ int maxSize;
+ int minSize;
+ int packetSize;
+ int port;
+ int timeout;
+
+ string dataSource;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsConnectionPool (string dataSource, int port, int packetSize, int timeout, int minSize, int maxSize)
+ {
+ this.dataSource = dataSource;
+ this.port = port;
+ this.packetSize = packetSize;
+ this.timeout = timeout;
+ this.minSize = minSize;
+ this.maxSize = maxSize;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ITds this[int index] {
+ get { return (ITds) list[index]; }
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set { throw new InvalidOperationException (); }
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return true; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public int MaxSize {
+ get { return maxSize; }
+ }
+
+ public int MinSize {
+ get { return minSize; }
+ }
+
+ public object SyncRoot {
+ get { throw new InvalidOperationException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object o)
+ {
+ return list.Add ((ITds) o);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object o)
+ {
+ return list.Contains ((ITds) o);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public ITds AllocateConnection ()
+ {
+ // make sure we have the minimum count (really only useful the first time)
+ lock (list) {
+ for (int i = Count; i < minSize; i += 1)
+ Add (new Tds42 (dataSource, port, packetSize, timeout));
+ }
+
+ // Try to obtain a lock
+ foreach (object o in list)
+ if (Monitor.TryEnter (o))
+ return (ITds) o;
+
+ if (Count < maxSize) {
+ ITds tds = new Tds42 (dataSource, port, packetSize, timeout);
+ Monitor.Enter (tds);
+ Add (tds);
+ return tds;
+ }
+
+ // else we have to wait for one to be available
+
+ return null;
+ }
+
+ public void ReleaseConnection (ITds tds)
+ {
+ Monitor.Exit (tds);
+ }
+
+ public int IndexOf (object o)
+ {
+ return list.IndexOf ((ITds) o);
+ }
+
+ public void Insert (int index, object o)
+ {
+ list.Insert (index, (ITds) o);
+ }
+
+ public void Remove (object o)
+ {
+ list.Remove ((ITds) o);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataAdapter.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataAdapter.cs
new file mode 100644
index 00000000000..46fe9be7cc7
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataAdapter.cs
@@ -0,0 +1,172 @@
+//
+// Mono.Data.TdsClient.TdsDataAdapter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.TdsClient
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used
+ /// to fill the DataSet and update a data source, all this
+ /// from a SQL database.
+ /// </summary>
+ public sealed class TdsDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ TdsCommand deleteCommand;
+ TdsCommand insertCommand;
+ TdsCommand selectCommand;
+ TdsCommand updateCommand;
+
+ static readonly object EventRowUpdated = new object();
+ static readonly object EventRowUpdating = new object();
+
+ #endregion
+
+ #region Constructors
+
+ public TdsDataAdapter ()
+ : this (new TdsCommand ())
+ {
+ }
+
+ public TdsDataAdapter (TdsCommand selectCommand)
+ {
+ DeleteCommand = new TdsCommand ();
+ InsertCommand = new TdsCommand ();
+ SelectCommand = selectCommand;
+ UpdateCommand = new TdsCommand ();
+ }
+
+ public TdsDataAdapter (string selectCommandText, TdsConnection selectConnection)
+ : this (new TdsCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public TdsDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new TdsConnection (selectConnectionString))
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public TdsCommand DeleteCommand {
+ get { return deleteCommand; }
+ set { deleteCommand = value; }
+ }
+
+ public TdsCommand InsertCommand {
+ get { return insertCommand; }
+ set { insertCommand = value; }
+ }
+
+ public TdsCommand SelectCommand {
+ get { return selectCommand; }
+ set { selectCommand = value; }
+ }
+
+ public TdsCommand UpdateCommand {
+ get { return updateCommand; }
+ set { updateCommand = value; }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is TdsCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (TdsCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is TdsCommand))
+ throw new ArgumentException ();
+ InsertCommand = (TdsCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is TdsCommand))
+ throw new ArgumentException ();
+ SelectCommand = (TdsCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is TdsCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (TdsCommand)value;
+ }
+ }
+
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new TdsRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new TdsRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ TdsRowUpdatedEventHandler handler = (TdsRowUpdatedEventHandler) Events[EventRowUpdated];
+ if ((handler != null) && (value is TdsRowUpdatedEventArgs))
+ handler (this, (TdsRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ TdsRowUpdatingEventHandler handler = (TdsRowUpdatingEventHandler) Events[EventRowUpdating];
+ if ((handler != null) && (value is TdsRowUpdatingEventArgs))
+ handler (this, (TdsRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event TdsRowUpdatedEventHandler RowUpdated {
+ add { Events.AddHandler (EventRowUpdated, value); }
+ remove { Events.RemoveHandler (EventRowUpdated, value); }
+ }
+
+ public event TdsRowUpdatingEventHandler RowUpdating {
+ add { Events.AddHandler (EventRowUpdating, value); }
+ remove { Events.RemoveHandler (EventRowUpdating, value); }
+ }
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataReader.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataReader.cs
new file mode 100644
index 00000000000..7cfed377b5d
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsDataReader.cs
@@ -0,0 +1,748 @@
+//
+// Mono.Data.TdsClient.TdsDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.TdsTypes;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
+ {
+ #region Fields
+
+ TdsCommand command;
+ ArrayList dataTypeNames;
+ bool disposed = false;
+ int fieldCount;
+ bool isClosed;
+ bool isSelect;
+ bool moreResults;
+ int resultsRead;
+ int rowsRead;
+ DataTable schemaTable;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal TdsDataReader (TdsCommand command)
+ {
+ this.command = command;
+ schemaTable = ConstructSchemaTable ();
+ resultsRead = 0;
+ fieldCount = 0;
+ isClosed = false;
+ isSelect = (command.CommandText.Trim ().ToUpper ().StartsWith ("SELECT"));
+ command.Tds.RecordsAffected = 0;
+ NextResult ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Depth {
+ get { return 0; }
+ }
+
+ public int FieldCount {
+ get { return fieldCount; }
+ }
+
+ public bool IsClosed {
+ get { return isClosed; }
+ }
+
+ public object this [int i] {
+ get { return GetValue (i); }
+ }
+
+ public object this [string name] {
+ get { return GetValue (GetOrdinal (name)); }
+ }
+
+ public int RecordsAffected {
+ get {
+ if (isSelect)
+ return -1;
+ else
+ return command.Tds.RecordsAffected;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Close ()
+ {
+ isClosed = true;
+ command.CloseDataReader (moreResults);
+ }
+
+ private static DataTable ConstructSchemaTable ()
+ {
+ Type booleanType = Type.GetType ("System.Boolean");
+ Type stringType = Type.GetType ("System.String");
+ Type intType = Type.GetType ("System.Int32");
+ Type typeType = Type.GetType ("System.Type");
+ Type shortType = Type.GetType ("System.Int16");
+
+ DataTable schemaTable = new DataTable ("SchemaTable");
+ schemaTable.Columns.Add ("ColumnName", stringType);
+ schemaTable.Columns.Add ("ColumnOrdinal", intType);
+ schemaTable.Columns.Add ("ColumnSize", intType);
+ schemaTable.Columns.Add ("NumericPrecision", shortType);
+ schemaTable.Columns.Add ("NumericScale", shortType);
+ schemaTable.Columns.Add ("IsUnique", booleanType);
+ schemaTable.Columns.Add ("IsKey", booleanType);
+ schemaTable.Columns.Add ("BaseServerName", stringType);
+ schemaTable.Columns.Add ("BaseCatalogName", stringType);
+ schemaTable.Columns.Add ("BaseColumnName", stringType);
+ schemaTable.Columns.Add ("BaseSchemaName", stringType);
+ schemaTable.Columns.Add ("BaseTableName", stringType);
+ schemaTable.Columns.Add ("DataType", typeType);
+ schemaTable.Columns.Add ("AllowDBNull", booleanType);
+ schemaTable.Columns.Add ("ProviderType", intType);
+ schemaTable.Columns.Add ("IsAliased", booleanType);
+ schemaTable.Columns.Add ("IsExpression", booleanType);
+ schemaTable.Columns.Add ("IsIdentity", booleanType);
+ schemaTable.Columns.Add ("IsAutoIncrement", booleanType);
+ schemaTable.Columns.Add ("IsRowVersion", booleanType);
+ schemaTable.Columns.Add ("IsHidden", booleanType);
+ schemaTable.Columns.Add ("IsLong", booleanType);
+ schemaTable.Columns.Add ("IsReadOnly", booleanType);
+
+ return schemaTable;
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ schemaTable.Dispose ();
+ Close ();
+ }
+ disposed = true;
+ }
+ }
+
+ public bool GetBoolean (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is bool))
+ throw new InvalidCastException ();
+ return (bool) value;
+ }
+
+ public byte GetByte (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is byte))
+ throw new InvalidCastException ();
+ return (byte) value;
+ }
+
+ public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ object value = GetValue (i);
+ if (!(value is byte []))
+ throw new InvalidCastException ();
+ Array.Copy ((byte []) value, (int) dataIndex, buffer, bufferIndex, length);
+ return ((byte []) value).Length - dataIndex;
+ }
+
+ public char GetChar (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is char))
+ throw new InvalidCastException ();
+ return (char) value;
+ }
+
+ public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ object value = GetValue (i);
+ if (!(value is char[]))
+ throw new InvalidCastException ();
+ Array.Copy ((char []) value, (int) dataIndex, buffer, bufferIndex, length);
+ return ((char []) value).Length - dataIndex;
+ }
+
+ [MonoTODO ("Implement GetData")]
+ public IDataReader GetData (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int i)
+ {
+ return (string) dataTypeNames [i];
+ }
+
+ public DateTime GetDateTime (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is DateTime))
+ throw new InvalidCastException ();
+ return (DateTime) value;
+ }
+
+ public decimal GetDecimal (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is decimal))
+ throw new InvalidCastException ();
+ return (decimal) value;
+ }
+
+ public double GetDouble (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is double))
+ throw new InvalidCastException ();
+ return (double) value;
+ }
+
+ public Type GetFieldType (int i)
+ {
+ return (Type) schemaTable.Rows[i]["DataType"];
+ }
+
+ public float GetFloat (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is float))
+ throw new InvalidCastException ();
+ return (float) value;
+ }
+
+ public Guid GetGuid (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is Guid))
+ throw new InvalidCastException ();
+ return (Guid) value;
+ }
+
+ public short GetInt16 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is short))
+ throw new InvalidCastException ();
+ return (short) value;
+ }
+
+ public int GetInt32 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is int))
+ throw new InvalidCastException ();
+ return (int) value;
+ }
+
+ public long GetInt64 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is long))
+ throw new InvalidCastException ();
+ return (long) value;
+ }
+
+ public string GetName (int i)
+ {
+ return (string) schemaTable.Rows[i]["ColumnName"];
+ }
+
+ public int GetOrdinal (string name)
+ {
+ foreach (DataRow schemaRow in schemaTable.Rows)
+ if (((string) schemaRow ["ColumnName"]).Equals (name))
+ return (int) schemaRow ["ColumnOrdinal"];
+ foreach (DataRow schemaRow in schemaTable.Rows)
+ if (String.Compare (((string) schemaRow ["ColumnName"]), name, true) == 0)
+ return (int) schemaRow ["ColumnOrdinal"];
+ throw new IndexOutOfRangeException ();
+ }
+
+ public DataTable GetSchemaTable ()
+ {
+ if (schemaTable.Rows != null && schemaTable.Rows.Count > 0)
+ return schemaTable;
+
+ if (!moreResults)
+ return null;
+
+ fieldCount = 0;
+
+ dataTypeNames = new ArrayList ();
+
+ foreach (TdsDataColumn schema in command.Tds.Columns) {
+ DataRow row = schemaTable.NewRow ();
+
+ row ["ColumnName"] = GetSchemaValue (schema, "ColumnName");
+ row ["ColumnSize"] = GetSchemaValue (schema, "ColumnSize");
+ row ["ColumnOrdinal"] = GetSchemaValue (schema, "ColumnOrdinal");
+ row ["NumericPrecision"] = GetSchemaValue (schema, "NumericPrecision");
+ row ["NumericScale"] = GetSchemaValue (schema, "NumericScale");
+ row ["IsUnique"] = GetSchemaValue (schema, "IsUnique");
+ row ["IsKey"] = GetSchemaValue (schema, "IsKey");
+ row ["BaseServerName"] = GetSchemaValue (schema, "BaseServerName");
+ row ["BaseCatalogName"] = GetSchemaValue (schema, "BaseCatalogName");
+ row ["BaseColumnName"] = GetSchemaValue (schema, "BaseColumnName");
+ row ["BaseSchemaName"] = GetSchemaValue (schema, "BaseSchemaName");
+ row ["BaseTableName"] = GetSchemaValue (schema, "BaseTableName");
+ row ["AllowDBNull"] = GetSchemaValue (schema, "AllowDBNull");
+ row ["IsAliased"] = GetSchemaValue (schema, "IsAliased");
+ row ["IsExpression"] = GetSchemaValue (schema, "IsExpression");
+ row ["IsIdentity"] = GetSchemaValue (schema, "IsIdentity");
+ row ["IsAutoIncrement"] = GetSchemaValue (schema, "IsAutoIncrement");
+ row ["IsRowVersion"] = GetSchemaValue (schema, "IsRowVersion");
+ row ["IsHidden"] = GetSchemaValue (schema, "IsHidden");
+ row ["IsReadOnly"] = GetSchemaValue (schema, "IsReadOnly");
+
+ // We don't always get the base column name.
+ if (row ["BaseColumnName"] == DBNull.Value)
+ row ["BaseColumnName"] = row ["ColumnName"];
+
+ switch ((TdsColumnType) schema ["ColumnType"]) {
+ case TdsColumnType.Image :
+ dataTypeNames.Add ("image");
+ row ["ProviderType"] = (int) TdsType.Image;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.Text :
+ dataTypeNames.Add ("text");
+ row ["ProviderType"] = (int) TdsType.Text;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.UniqueIdentifier :
+ dataTypeNames.Add ("uniqueidentifier");
+ row ["ProviderType"] = (int) TdsType.UniqueIdentifier;
+ row ["DataType"] = typeof (Guid);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.VarBinary :
+ case TdsColumnType.BigVarBinary :
+ dataTypeNames.Add ("varbinary");
+ row ["ProviderType"] = (int) TdsType.VarBinary;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.IntN :
+ case TdsColumnType.Int4 :
+ dataTypeNames.Add ("int");
+ row ["ProviderType"] = (int) TdsType.Int;
+ row ["DataType"] = typeof (int);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.VarChar :
+ case TdsColumnType.BigVarChar :
+ dataTypeNames.Add ("varchar");
+ row ["ProviderType"] = (int) TdsType.VarChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Binary :
+ case TdsColumnType.BigBinary :
+ dataTypeNames.Add ("binary");
+ row ["ProviderType"] = (int) TdsType.Binary;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.Char :
+ case TdsColumnType.BigChar :
+ dataTypeNames.Add ("char");
+ row ["ProviderType"] = (int) TdsType.Char;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Int1 :
+ dataTypeNames.Add ("tinyint");
+ row ["ProviderType"] = (int) TdsType.TinyInt;
+ row ["DataType"] = typeof (byte);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Bit :
+ case TdsColumnType.BitN :
+ dataTypeNames.Add ("bit");
+ row ["ProviderType"] = (int) TdsType.Bit;
+ row ["DataType"] = typeof (bool);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Int2 :
+ dataTypeNames.Add ("smallint");
+ row ["ProviderType"] = (int) TdsType.SmallInt;
+ row ["DataType"] = typeof (short);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.DateTime4 :
+ case TdsColumnType.DateTime :
+ case TdsColumnType.DateTimeN :
+ dataTypeNames.Add ("datetime");
+ row ["ProviderType"] = (int) TdsType.DateTime;
+ row ["DataType"] = typeof (DateTime);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Real :
+ dataTypeNames.Add ("real");
+ row ["ProviderType"] = (int) TdsType.Real;
+ row ["DataType"] = typeof (float);
+ break;
+ case TdsColumnType.Money :
+ case TdsColumnType.MoneyN :
+ case TdsColumnType.Money4 :
+ dataTypeNames.Add ("money");
+ row ["ProviderType"] = (int) TdsType.Money;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Float8 :
+ case TdsColumnType.FloatN :
+ dataTypeNames.Add ("float");
+ row ["ProviderType"] = (int) TdsType.Float;
+ row ["DataType"] = typeof (double);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.NText :
+ dataTypeNames.Add ("ntext");
+ row ["ProviderType"] = (int) TdsType.NText;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.NVarChar :
+ dataTypeNames.Add ("nvarchar");
+ row ["ProviderType"] = (int) TdsType.NVarChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Decimal :
+ case TdsColumnType.Numeric :
+ dataTypeNames.Add ("decimal");
+ row ["ProviderType"] = (int) TdsType.Decimal;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.NChar :
+ dataTypeNames.Add ("nchar");
+ row ["ProviderType"] = (int) TdsType.NChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.SmallMoney :
+ dataTypeNames.Add ("smallmoney");
+ row ["ProviderType"] = (int) TdsType.SmallMoney;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ default :
+ dataTypeNames.Add ("variant");
+ row ["ProviderType"] = (int) TdsType.Variant;
+ row ["DataType"] = typeof (object);
+ row ["IsLong"] = false;
+ break;
+ }
+
+ schemaTable.Rows.Add (row);
+
+ fieldCount += 1;
+ }
+ return schemaTable;
+ }
+
+ private static object GetSchemaValue (TdsDataColumn schema, object key)
+ {
+ if (schema.ContainsKey (key) && schema [key] != null)
+ return schema [key];
+ return DBNull.Value;
+ }
+
+ public TdsBinary GetTdsBinary (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public TdsBoolean GetTdsBoolean (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsBoolean))
+ throw new InvalidCastException ();
+ return (TdsBoolean) value;
+ }
+
+ public TdsByte GetTdsByte (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsByte))
+ throw new InvalidCastException ();
+ return (TdsByte) value;
+ }
+
+ public TdsDateTime GetTdsDateTime (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsDateTime))
+ throw new InvalidCastException ();
+ return (TdsDateTime) value;
+ }
+
+ public TdsDecimal GetTdsDecimal (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsDecimal))
+ throw new InvalidCastException ();
+ return (TdsDecimal) value;
+ }
+
+ public TdsDouble GetTdsDouble (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsDouble))
+ throw new InvalidCastException ();
+ return (TdsDouble) value;
+ }
+
+ public TdsGuid GetTdsGuid (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsGuid))
+ throw new InvalidCastException ();
+ return (TdsGuid) value;
+ }
+
+ public TdsInt16 GetTdsInt16 (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsInt16))
+ throw new InvalidCastException ();
+ return (TdsInt16) value;
+ }
+
+ public TdsInt32 GetTdsInt32 (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsInt32))
+ throw new InvalidCastException ();
+ return (TdsInt32) value;
+ }
+
+ public TdsInt64 GetTdsInt64 (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsInt64))
+ throw new InvalidCastException ();
+ return (TdsInt64) value;
+ }
+
+ public TdsMoney GetTdsMoney (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsMoney))
+ throw new InvalidCastException ();
+ return (TdsMoney) value;
+ }
+
+ public TdsSingle GetTdsSingle (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsSingle))
+ throw new InvalidCastException ();
+ return (TdsSingle) value;
+ }
+
+ public TdsString GetTdsString (int i)
+ {
+ object value = GetTdsValue (i);
+ if (!(value is TdsString))
+ throw new InvalidCastException ();
+ return (TdsString) value;
+ }
+
+ [MonoTODO ("Implement TdsBigDecimal conversion. TdsType.Real fails tests?")]
+ public object GetTdsValue (int i)
+ {
+ TdsType type = (TdsType) (schemaTable.Rows [i]["ProviderType"]);
+ object value = GetValue (i);
+
+ switch (type) {
+ case TdsType.BigInt:
+ if (value == null)
+ return TdsInt64.Null;
+ return (TdsInt64) ((long) value);
+ case TdsType.Binary:
+ case TdsType.Image:
+ case TdsType.VarBinary:
+ case TdsType.Timestamp:
+ if (value == null)
+ return TdsBinary.Null;
+ return (TdsBinary) ((byte[]) value);
+ case TdsType.Bit:
+ if (value == null)
+ return TdsBoolean.Null;
+ return (TdsBoolean) ((bool) value);
+ case TdsType.Char:
+ case TdsType.NChar:
+ case TdsType.NText:
+ case TdsType.NVarChar:
+ case TdsType.Text:
+ case TdsType.VarChar:
+ if (value == null)
+ return TdsString.Null;
+ return (TdsString) ((string) value);
+ case TdsType.DateTime:
+ case TdsType.SmallDateTime:
+ if (value == null)
+ return TdsDateTime.Null;
+ return (TdsDateTime) ((DateTime) value);
+ case TdsType.Decimal:
+ if (value == null)
+ return TdsDecimal.Null;
+ if (value is TdsBigDecimal)
+ return TdsDecimal.FromTdsBigDecimal ((TdsBigDecimal) value);
+ return (TdsDecimal) ((decimal) value);
+ case TdsType.Float:
+ if (value == null)
+ return TdsDouble.Null;
+ return (TdsDouble) ((double) value);
+ case TdsType.Int:
+ if (value == null)
+ return TdsInt32.Null;
+ return (TdsInt32) ((int) value);
+ case TdsType.Money:
+ case TdsType.SmallMoney:
+ if (value == null)
+ return TdsMoney.Null;
+ return (TdsMoney) ((decimal) value);
+ case TdsType.Real:
+ if (value == null)
+ return TdsSingle.Null;
+ return (TdsSingle) ((float) value);
+ case TdsType.UniqueIdentifier:
+ if (value == null)
+ return TdsGuid.Null;
+ return (TdsGuid) ((Guid) value);
+ case TdsType.SmallInt:
+ if (value == null)
+ return TdsInt16.Null;
+ return (TdsInt16) ((short) value);
+ case TdsType.TinyInt:
+ if (value == null)
+ return TdsByte.Null;
+ return (TdsByte) ((byte) value);
+ }
+
+ throw new InvalidOperationException ("The type of this column is unknown.");
+ }
+
+ public int GetTdsValues (object[] values)
+ {
+ int count = 0;
+ int columnCount = schemaTable.Rows.Count;
+ int arrayCount = values.Length;
+
+ if (arrayCount > columnCount)
+ count = columnCount;
+ else
+ count = arrayCount;
+
+ for (int i = 0; i < count; i += 1)
+ values [i] = GetTdsValue (i);
+
+ return count;
+ }
+
+ public string GetString (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is string))
+ throw new InvalidCastException ();
+ return (string) value;
+ }
+
+ public object GetValue (int i)
+ {
+ return command.Tds.ColumnValues [i];
+ }
+
+ public int GetValues (object[] values)
+ {
+ int len = values.Length;
+ int bigDecimalIndex = command.Tds.ColumnValues.BigDecimalIndex;
+
+ // If a four-byte decimal is stored, then we can't convert to
+ // a native type. Throw an OverflowException.
+ if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
+ throw new OverflowException ();
+
+ command.Tds.ColumnValues.CopyTo (0, values, 0, len);
+ return (len > FieldCount ? len : FieldCount);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new DbEnumerator (this);
+ }
+
+ public bool IsDBNull (int i)
+ {
+ return GetValue (i) == null;
+ }
+
+ public bool NextResult ()
+ {
+ if ((command.CommandBehavior & CommandBehavior.SingleResult) != 0 && resultsRead > 0)
+ return false;
+ if (command.Tds.DoneProc)
+ return false;
+
+ schemaTable.Rows.Clear ();
+
+ moreResults = command.Tds.NextResult ();
+ GetSchemaTable ();
+
+ rowsRead = 0;
+ resultsRead += 1;
+ return moreResults;
+ }
+
+ public bool Read ()
+ {
+ if ((command.CommandBehavior & CommandBehavior.SingleRow) != 0 && rowsRead > 0)
+ return false;
+ if ((command.CommandBehavior & CommandBehavior.SchemaOnly) != 0)
+ return false;
+ if (!moreResults)
+ return false;
+
+ bool result = command.Tds.NextRow ();
+
+ rowsRead += 1;
+
+ return result;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsError.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsError.cs
new file mode 100644
index 00000000000..f21d825eaff
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsError.cs
@@ -0,0 +1,91 @@
+//
+// Mono.Data.TdsClient.TdsError.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsError
+ {
+ #region Fields
+
+ byte theClass = 0x0;
+ int lineNumber;
+ string message;
+ int number;
+ string procedure;
+ string server;
+ string source;
+ byte state;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal TdsError (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte Class {
+ get { return theClass; }
+ }
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public string Message {
+ get { return message; }
+ }
+
+ public int Number {
+ get { return number; }
+ }
+
+ public string Procedure {
+ get { return procedure; }
+ }
+
+ public string Server {
+ get { return server; }
+ }
+
+ public string Source {
+ get { return source; }
+ }
+
+ public byte State {
+ get { return state; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsErrorCollection.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsErrorCollection.cs
new file mode 100644
index 00000000000..3f7e8961165
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsErrorCollection.cs
@@ -0,0 +1,83 @@
+//
+// Mono.Data.TdsClient.TdsErrorCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+
+namespace Mono.Data.TdsClient {
+ public class TdsErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal TdsErrorCollection ()
+ {
+ }
+
+ internal TdsErrorCollection (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ Add (theClass, lineNumber, message, number, procedure, server, source, state);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public TdsError this [int index] {
+ get { return (TdsError) list[index]; }
+ }
+
+ bool ICollection.IsSynchronized {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void Add (TdsError error)
+ {
+ list.Add (error);
+ }
+
+ internal void Add (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ Add (new TdsError (theClass, lineNumber, message, number, procedure, server, source, state));
+ }
+
+ [MonoTODO]
+ public void CopyTo (Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsException.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsException.cs
new file mode 100644
index 00000000000..e88b45c151e
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsException.cs
@@ -0,0 +1,105 @@
+//
+// Mono.Data.TdsClient.TdsException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace Mono.Data.TdsClient {
+ [Serializable]
+ public sealed class TdsException : SystemException
+ {
+ #region Fields
+
+ TdsErrorCollection errors;
+
+ #endregion Fields
+
+ #region Constructors
+
+ internal TdsException ()
+ : base ("a SQL Exception has occurred.")
+ {
+ errors = new TdsErrorCollection();
+ }
+
+ internal TdsException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ : base (message)
+ {
+ errors = new TdsErrorCollection (theClass, lineNumber, message, number, procedure, server, source, state);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte Class {
+ get { return errors [0].Class; }
+ }
+
+ public TdsErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public int LineNumber {
+ get { return errors [0].LineNumber; }
+ }
+
+ public override string Message {
+ get {
+ StringBuilder result = new StringBuilder ();
+ foreach (TdsError error in Errors) {
+ if (result.Length > 0)
+ result.Append ('\n');
+ result.Append (error.Message);
+ }
+ return result.ToString ();
+ }
+ }
+
+ public int Number {
+ get { return errors [0].Number; }
+ }
+
+ public string Procedure {
+ get { return errors [0].Procedure; }
+ }
+
+ public string Server {
+ get { return errors [0].Server; }
+ }
+
+ public override string Source {
+ get { return errors [0].Source; }
+ }
+
+ public byte State {
+ get { return errors [0].State; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal static TdsException FromTdsInternalException (TdsInternalException e)
+ {
+ return new TdsException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono TdsClient Data Provider", e.State);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..bfd461519f9
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// Mono.Data.TdsClient.TdsInfoMessageEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsInfoMessageEventArgs : EventArgs
+ {
+ #region Fields
+
+ TdsErrorCollection errors = new TdsErrorCollection ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal TdsInfoMessageEventArgs (TdsInternalErrorCollection tdsErrors)
+ {
+ foreach (TdsInternalError e in tdsErrors)
+ errors.Add (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono TdsClient Data Provider", e.State);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public TdsErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public string Message {
+ get { return errors[0].Message; }
+ }
+
+ public string Source {
+ get { return errors[0].Source; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override string ToString ()
+ {
+ return Message;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventHandler.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..ce64b675f5d
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsInfoMessageEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// Mono.Data.TdsClient.TdsInfoMessageEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.TdsClient {
+ public delegate void TdsInfoMessageEventHandler (object sender, TdsInfoMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameter.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameter.cs
new file mode 100644
index 00000000000..7cc4280b2da
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameter.cs
@@ -0,0 +1,557 @@
+//
+// Mono.Data.TdsClient.TdsParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+ {
+ #region Fields
+
+ TdsMetaParameter metaParameter;
+
+ TdsParameterCollection container = null;
+ DbType dbType;
+ ParameterDirection direction = ParameterDirection.Input;
+ bool isNullable;
+ bool isSizeSet = false;
+ bool isTypeSet = false;
+ int offset;
+ TdsType sybaseType;
+ string sourceColumn;
+ DataRowVersion sourceVersion;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsParameter ()
+ : this (String.Empty, TdsType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public TdsParameter (string parameterName, object value)
+ {
+ metaParameter = new TdsMetaParameter (parameterName, value);
+ this.sourceVersion = DataRowVersion.Current;
+ InferTdsType (value);
+ }
+
+ public TdsParameter (string parameterName, TdsType dbType)
+ : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public TdsParameter (string parameterName, TdsType dbType, int size)
+ : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public TdsParameter (string parameterName, TdsType dbType, int size, string sourceColumn)
+ : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null)
+ {
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public TdsParameter (string parameterName, TdsType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value)
+ {
+ metaParameter = new TdsMetaParameter (parameterName, size, isNullable, precision, scale, value);
+
+ TdsType = dbType;
+ Direction = direction;
+ SourceColumn = sourceColumn;
+ SourceVersion = sourceVersion;
+ }
+
+ // This constructor is used internally to construct a
+ // TdsParameter. The value array comes from sp_procedure_params_rowset.
+ // This is in TdsCommand.DeriveParameters.
+ internal TdsParameter (object[] dbValues)
+ {
+ Precision = 0;
+ Scale = 0;
+ Direction = ParameterDirection.Input;
+
+ ParameterName = (string) dbValues[3];
+
+ switch ((short) dbValues[5]) {
+ case 1:
+ Direction = ParameterDirection.Input;
+ break;
+ case 2:
+ Direction = ParameterDirection.Output;
+ break;
+ case 3:
+ Direction = ParameterDirection.InputOutput;
+ break;
+ case 4:
+ Direction = ParameterDirection.ReturnValue;
+ break;
+ }
+
+ IsNullable = (bool) dbValues[8];
+
+ if (dbValues[12] != null)
+ Precision = (byte) ((short) dbValues[12]);
+ if (dbValues[13] != null)
+ Scale = (byte) ((short) dbValues[13]);
+
+ SetDbTypeName ((string) dbValues[16]);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ // Used to ensure that only one collection can contain this
+ // parameter
+ internal TdsParameterCollection Container {
+ get { return container; }
+ set { container = value; }
+ }
+
+ public DbType DbType {
+ get { return dbType; }
+ set {
+ SetDbType (value);
+ isTypeSet = true;
+ }
+ }
+
+ public ParameterDirection Direction {
+ get { return direction; }
+ set {
+ direction = value;
+ if (direction == ParameterDirection.Output)
+ MetaParameter.Direction = TdsParameterDirection.Output;
+ }
+ }
+
+ internal TdsMetaParameter MetaParameter {
+ get { return metaParameter; }
+ }
+
+ string IDataParameter.ParameterName {
+ get { return metaParameter.ParameterName; }
+ set { metaParameter.ParameterName = value; }
+ }
+
+ public bool IsNullable {
+ get { return metaParameter.IsNullable; }
+ set { metaParameter.IsNullable = value; }
+ }
+
+ public int Offset {
+ get { return offset; }
+ set { offset = value; }
+ }
+
+ public string ParameterName {
+ get { return metaParameter.ParameterName; }
+ set { metaParameter.ParameterName = value; }
+ }
+
+ public byte Precision {
+ get { return metaParameter.Precision; }
+ set { metaParameter.Precision = value; }
+ }
+
+ public byte Scale {
+ get { return metaParameter.Scale; }
+ set { metaParameter.Scale = value; }
+ }
+
+ public int Size {
+ get { return metaParameter.Size; }
+ set { metaParameter.Size = value; }
+ }
+
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
+ }
+
+ public DataRowVersion SourceVersion {
+ get { return sourceVersion; }
+ set { sourceVersion = value; }
+ }
+
+ public TdsType TdsType {
+ get { return sybaseType; }
+ set {
+ SetTdsType (value);
+ isTypeSet = true;
+ }
+ }
+
+ public object Value {
+ get { return metaParameter.Value; }
+ set {
+ if (!isTypeSet)
+ InferTdsType (value);
+ metaParameter.Value = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ object ICloneable.Clone ()
+ {
+ return new TdsParameter (ParameterName, TdsType, Size, Direction, IsNullable, Precision, Scale, SourceColumn, SourceVersion, Value);
+ }
+
+ // If the value is set without the DbType/TdsType being set, then we
+ // infer type information.
+ private void InferTdsType (object value)
+ {
+ Type type = value.GetType ();
+
+ string exception = String.Format ("The parameter data type of {0} is invalid.", type.Name);
+
+ switch (type.FullName) {
+ case "System.Int64":
+ SetTdsType (TdsType.BigInt);
+ break;
+ case "System.Boolean":
+ SetTdsType (TdsType.Bit);
+ break;
+ case "System.String":
+ SetTdsType (TdsType.NVarChar);
+ break;
+ case "System.DateTime":
+ SetTdsType (TdsType.DateTime);
+ break;
+ case "System.Decimal":
+ SetTdsType (TdsType.Decimal);
+ break;
+ case "System.Double":
+ SetTdsType (TdsType.Float);
+ break;
+ case "System.Byte[]":
+ SetTdsType (TdsType.VarBinary);
+ break;
+ case "System.Byte":
+ SetTdsType (TdsType.TinyInt);
+ break;
+ case "System.Int32":
+ SetTdsType (TdsType.Int);
+ break;
+ case "System.Single":
+ SetTdsType (TdsType.Real);
+ break;
+ case "System.Int16":
+ SetTdsType (TdsType.SmallInt);
+ break;
+ case "System.Guid":
+ SetTdsType (TdsType.UniqueIdentifier);
+ break;
+ case "System.Object":
+ SetTdsType (TdsType.Variant);
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ }
+
+ // When the DbType is set, we also set the TdsType, as well as the SQL Server
+ // string representation of the type name. If the DbType is not convertible
+ // to an TdsType, throw an exception.
+ private void SetDbType (DbType type)
+ {
+ string exception = String.Format ("No mapping exists from DbType {0} to a known TdsType.", type);
+
+ switch (type) {
+ case DbType.AnsiString:
+ MetaParameter.TypeName = "varchar";
+ sybaseType = TdsType.VarChar;
+ break;
+ case DbType.AnsiStringFixedLength:
+ MetaParameter.TypeName = "char";
+ sybaseType = TdsType.Char;
+ break;
+ case DbType.Binary:
+ MetaParameter.TypeName = "varbinary";
+ sybaseType = TdsType.VarBinary;
+ break;
+ case DbType.Boolean:
+ MetaParameter.TypeName = "bit";
+ sybaseType = TdsType.Bit;
+ break;
+ case DbType.Byte:
+ MetaParameter.TypeName = "tinyint";
+ sybaseType = TdsType.TinyInt;
+ break;
+ case DbType.Currency:
+ sybaseType = TdsType.Money;
+ MetaParameter.TypeName = "money";
+ break;
+ case DbType.Date:
+ case DbType.DateTime:
+ MetaParameter.TypeName = "datetime";
+ sybaseType = TdsType.DateTime;
+ break;
+ case DbType.Decimal:
+ MetaParameter.TypeName = "decimal";
+ sybaseType = TdsType.Decimal;
+ break;
+ case DbType.Double:
+ MetaParameter.TypeName = "float";
+ sybaseType = TdsType.Float;
+ break;
+ case DbType.Guid:
+ MetaParameter.TypeName = "uniqueidentifier";
+ sybaseType = TdsType.UniqueIdentifier;
+ break;
+ case DbType.Int16:
+ MetaParameter.TypeName = "smallint";
+ sybaseType = TdsType.SmallInt;
+ break;
+ case DbType.Int32:
+ MetaParameter.TypeName = "int";
+ sybaseType = TdsType.Int;
+ break;
+ case DbType.Int64:
+ MetaParameter.TypeName = "bigint";
+ sybaseType = TdsType.BigInt;
+ break;
+ case DbType.Object:
+ MetaParameter.TypeName = "sql_variant";
+ sybaseType = TdsType.Variant;
+ break;
+ case DbType.Single:
+ MetaParameter.TypeName = "real";
+ sybaseType = TdsType.Real;
+ break;
+ case DbType.String:
+ MetaParameter.TypeName = "nvarchar";
+ sybaseType = TdsType.NVarChar;
+ break;
+ case DbType.StringFixedLength:
+ MetaParameter.TypeName = "nchar";
+ sybaseType = TdsType.NChar;
+ break;
+ case DbType.Time:
+ MetaParameter.TypeName = "datetime";
+ sybaseType = TdsType.DateTime;
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ dbType = type;
+ }
+
+ // Used by internal constructor which has a SQL Server typename
+ private void SetDbTypeName (string dbTypeName)
+ {
+ switch (dbTypeName.ToLower ()) {
+ case "bigint":
+ TdsType = TdsType.BigInt;
+ break;
+ case "binary":
+ TdsType = TdsType.Binary;
+ break;
+ case "bit":
+ TdsType = TdsType.Bit;
+ break;
+ case "char":
+ TdsType = TdsType.Char;
+ break;
+ case "datetime":
+ TdsType = TdsType.DateTime;
+ break;
+ case "decimal":
+ TdsType = TdsType.Decimal;
+ break;
+ case "float":
+ TdsType = TdsType.Float;
+ break;
+ case "image":
+ TdsType = TdsType.Image;
+ break;
+ case "int":
+ TdsType = TdsType.Int;
+ break;
+ case "money":
+ TdsType = TdsType.Money;
+ break;
+ case "nchar":
+ TdsType = TdsType.NChar;
+ break;
+ case "ntext":
+ TdsType = TdsType.NText;
+ break;
+ case "nvarchar":
+ TdsType = TdsType.NVarChar;
+ break;
+ case "real":
+ TdsType = TdsType.Real;
+ break;
+ case "smalldatetime":
+ TdsType = TdsType.SmallDateTime;
+ break;
+ case "smallint":
+ TdsType = TdsType.SmallInt;
+ break;
+ case "smallmoney":
+ TdsType = TdsType.SmallMoney;
+ break;
+ case "text":
+ TdsType = TdsType.Text;
+ break;
+ case "timestamp":
+ TdsType = TdsType.Timestamp;
+ break;
+ case "tinyint":
+ TdsType = TdsType.TinyInt;
+ break;
+ case "uniqueidentifier":
+ TdsType = TdsType.UniqueIdentifier;
+ break;
+ case "varbinary":
+ TdsType = TdsType.VarBinary;
+ break;
+ case "varchar":
+ TdsType = TdsType.VarChar;
+ break;
+ default:
+ TdsType = TdsType.Variant;
+ break;
+ }
+ }
+
+ // When the TdsType is set, we also set the DbType, as well as the SQL Server
+ // string representation of the type name. If the TdsType is not convertible
+ // to a DbType, throw an exception.
+ private void SetTdsType (TdsType type)
+ {
+ string exception = String.Format ("No mapping exists from TdsType {0} to a known DbType.", type);
+
+ switch (type) {
+ case TdsType.BigInt:
+ MetaParameter.TypeName = "bigint";
+ dbType = DbType.Int64;
+ break;
+ case TdsType.Binary:
+ MetaParameter.TypeName = "binary";
+ dbType = DbType.Binary;
+ break;
+ case TdsType.Timestamp:
+ MetaParameter.TypeName = "timestamp";
+ dbType = DbType.Binary;
+ break;
+ case TdsType.VarBinary:
+ MetaParameter.TypeName = "varbinary";
+ dbType = DbType.Binary;
+ break;
+ case TdsType.Bit:
+ MetaParameter.TypeName = "bit";
+ dbType = DbType.Boolean;
+ break;
+ case TdsType.Char:
+ MetaParameter.TypeName = "char";
+ dbType = DbType.AnsiStringFixedLength;
+ break;
+ case TdsType.DateTime:
+ MetaParameter.TypeName = "datetime";
+ dbType = DbType.DateTime;
+ break;
+ case TdsType.SmallDateTime:
+ MetaParameter.TypeName = "smalldatetime";
+ dbType = DbType.DateTime;
+ break;
+ case TdsType.Decimal:
+ MetaParameter.TypeName = "decimal";
+ dbType = DbType.Decimal;
+ break;
+ case TdsType.Float:
+ MetaParameter.TypeName = "float";
+ dbType = DbType.Double;
+ break;
+ case TdsType.Image:
+ MetaParameter.TypeName = "image";
+ dbType = DbType.Binary;
+ break;
+ case TdsType.Int:
+ MetaParameter.TypeName = "int";
+ dbType = DbType.Int32;
+ break;
+ case TdsType.Money:
+ MetaParameter.TypeName = "money";
+ dbType = DbType.Currency;
+ break;
+ case TdsType.SmallMoney:
+ MetaParameter.TypeName = "smallmoney";
+ dbType = DbType.Currency;
+ break;
+ case TdsType.NChar:
+ MetaParameter.TypeName = "nchar";
+ dbType = DbType.StringFixedLength;
+ break;
+ case TdsType.NText:
+ MetaParameter.TypeName = "ntext";
+ dbType = DbType.String;
+ break;
+ case TdsType.NVarChar:
+ MetaParameter.TypeName = "nvarchar";
+ dbType = DbType.String;
+ break;
+ case TdsType.Real:
+ MetaParameter.TypeName = "real";
+ dbType = DbType.Single;
+ break;
+ case TdsType.SmallInt:
+ MetaParameter.TypeName = "smallint";
+ dbType = DbType.Int16;
+ break;
+ case TdsType.Text:
+ MetaParameter.TypeName = "text";
+ dbType = DbType.AnsiString;
+ break;
+ case TdsType.VarChar:
+ MetaParameter.TypeName = "varchar";
+ dbType = DbType.AnsiString;
+ break;
+ case TdsType.TinyInt:
+ MetaParameter.TypeName = "tinyint";
+ dbType = DbType.Byte;
+ break;
+ case TdsType.UniqueIdentifier:
+ MetaParameter.TypeName = "uniqueidentifier";
+ dbType = DbType.Guid;
+ break;
+ case TdsType.Variant:
+ MetaParameter.TypeName = "sql_variant";
+ dbType = DbType.Object;
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ sybaseType = type;
+ }
+
+ public override string ToString()
+ {
+ return ParameterName;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameterCollection.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameterCollection.cs
new file mode 100644
index 00000000000..c55549b06e8
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsParameterCollection.cs
@@ -0,0 +1,211 @@
+//
+// Mono.Data.TdsClient.TdsParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+
+namespace Mono.Data.TdsClient {
+ [ListBindable (false)]
+ public sealed class TdsParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList();
+ TdsMetaParameterCollection metaParameters;
+ TdsCommand command;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal TdsParameterCollection (TdsCommand command)
+ {
+ this.command = command;
+ metaParameters = new TdsMetaParameterCollection ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public TdsParameter this [int index] {
+ get { return (TdsParameter) list [index]; }
+ set { list [index] = (TdsParameter) value; }
+ }
+
+ object IDataParameterCollection.this [string parameterName] {
+ get { return this[parameterName]; }
+ set {
+ if (!(value is TdsParameter))
+ throw new InvalidCastException ("Only SQLParameter objects can be used.");
+ this [parameterName] = (TdsParameter) value;
+ }
+ }
+
+ public TdsParameter this [string parameterName] {
+ get {
+ foreach (TdsParameter p in list)
+ if (p.ParameterName.Equals (parameterName))
+ return p;
+ throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
+ }
+ set {
+ if (!Contains (parameterName))
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ this [IndexOf (parameterName)] = value;
+ }
+ }
+
+ object IList.this [int index] {
+ get { return (TdsParameter) this [index]; }
+ set { this [index] = (TdsParameter) value; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ internal TdsMetaParameterCollection MetaParameters {
+ get { return metaParameters; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ if (!(value is TdsParameter))
+ throw new InvalidCastException ("The parameter was not an TdsParameter.");
+ Add ((TdsParameter) value);
+ return IndexOf (value);
+ }
+
+ public TdsParameter Add (TdsParameter value)
+ {
+ if (value.Container != null)
+ throw new ArgumentException ("The TdsParameter specified in the value parameter is already added to this or another TdsParameterCollection.");
+
+ value.Container = this;
+ list.Add (value);
+ metaParameters.Add (value.MetaParameter);
+ return value;
+ }
+
+ public TdsParameter Add (string parameterName, object value)
+ {
+ return Add (new TdsParameter (parameterName, value));
+ }
+
+ public TdsParameter Add (string parameterName, TdsType sybaseType)
+ {
+ return Add (new TdsParameter (parameterName, sybaseType));
+ }
+
+ public TdsParameter Add (string parameterName, TdsType sybaseType, int size)
+ {
+ return Add (new TdsParameter (parameterName, sybaseType, size));
+ }
+
+ public TdsParameter Add (string parameterName, TdsType sybaseType, int size, string sourceColumn)
+ {
+ return Add (new TdsParameter (parameterName, sybaseType, size, sourceColumn));
+ }
+
+ public void Clear()
+ {
+ metaParameters.Clear ();
+ list.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ if (!(value is TdsParameter))
+ throw new InvalidCastException ("The parameter was not an TdsParameter.");
+ return Contains (((TdsParameter) value).ParameterName);
+ }
+
+ public bool Contains (string value)
+ {
+ foreach (TdsParameter p in list)
+ if (p.ParameterName.Equals (value))
+ return true;
+ return false;
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object value)
+ {
+ if (!(value is TdsParameter))
+ throw new InvalidCastException ("The parameter was not an TdsParameter.");
+ return IndexOf (((TdsParameter) value).ParameterName);
+ }
+
+ public int IndexOf (string parameterName)
+ {
+ return list.IndexOf (parameterName);
+ }
+
+ public void Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (object value)
+ {
+ metaParameters.Remove (((TdsParameter) value).MetaParameter);
+ list.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ metaParameters.RemoveAt (index);
+ list.RemoveAt (index);
+ }
+
+ public void RemoveAt (string parameterName)
+ {
+ RemoveAt (IndexOf (parameterName));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..3ca707f0ce6
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventArgs.cs
@@ -0,0 +1,36 @@
+//
+// Mono.Data.TdsClient.TdsRowUpdatedEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ [MonoTODO]
+ public TdsRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new TdsCommand Command {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ ~TdsRowUpdatedEventArgs ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..49e34cd6035
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatedEventHandler.cs
@@ -0,0 +1,12 @@
+//
+// Mono.Data.TdsClient.TdsRowUpdatedEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace Mono.Data.TdsClient {
+ public delegate void TdsRowUpdatedEventHandler(object sender, TdsRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..3fb9a18c720
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventArgs.cs
@@ -0,0 +1,36 @@
+//
+// Mono.Data.TdsClient.TdsRowUpdatingEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.TdsClient
+{
+ public sealed class TdsRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ [MonoTODO]
+ public TdsRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new TdsCommand Command {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ ~TdsRowUpdatingEventArgs() {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..cbfa2843a50
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsRowUpdatingEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// Mono.Data.TdsClient.TdsRowUpdatingEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.TdsClient {
+ public delegate void TdsRowUpdatingEventHandler(object sender, TdsRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsTransaction.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsTransaction.cs
new file mode 100644
index 00000000000..a84a6014076
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsTransaction.cs
@@ -0,0 +1,106 @@
+//
+// Mono.Data.TdsClient.TdsTransaction.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace Mono.Data.TdsClient {
+ public sealed class TdsTransaction : MarshalByRefObject, IDbTransaction, IDisposable
+ {
+ #region Fields
+
+ bool disposed = false;
+
+ TdsConnection connection;
+ IsolationLevel isolationLevel;
+ bool isOpen;
+
+ #endregion
+
+ #region Constructors
+
+ internal TdsTransaction (TdsConnection connection, IsolationLevel isolevel)
+ {
+ this.connection = connection;
+ this.isolationLevel = isolevel;
+ isOpen = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public TdsConnection Connection {
+ get { return connection; }
+ }
+
+ internal bool IsOpen {
+ get { return isOpen; }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get { return isolationLevel; }
+ }
+
+ IDbConnection IDbTransaction.Connection {
+ get { return Connection; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Commit ()
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute ("COMMIT TRANSACTION");
+ connection.Transaction = null;
+ isOpen = false;
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing)
+ Rollback ();
+ disposed = true;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public void Rollback ()
+ {
+ Rollback (String.Empty);
+ }
+
+ public void Rollback (string transactionName)
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute (String.Format ("ROLLBACK TRANSACTION {0}", transactionName));
+ isOpen = false;
+ }
+
+ public void Save (string savePointName)
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute (String.Format ("SAVE TRANSACTION {0}", savePointName));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsType.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsType.cs
new file mode 100644
index 00000000000..aaab919ddd0
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsClient/TdsType.cs
@@ -0,0 +1,41 @@
+//
+// Mono.Data.TdsClient.TdsType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace Mono.Data.TdsClient {
+ [Serializable]
+ public enum TdsType
+ {
+ BigInt = 0,
+ Binary = 1,
+ Bit = 2,
+ Char = 3,
+ DateTime = 4,
+ Decimal = 5,
+ Float = 6,
+ Image = 7,
+ Int = 8,
+ Money = 9,
+ NChar = 10,
+ NText = 11,
+ NVarChar = 12,
+ Real = 13,
+ UniqueIdentifier = 14,
+ SmallDateTime = 15,
+ SmallInt = 16,
+ SmallMoney = 17,
+ Text = 18,
+ Timestamp = 19,
+ TinyInt = 20,
+ VarBinary = 21,
+ VarChar = 22,
+ Variant = 23
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/ChangeLog b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/ChangeLog
new file mode 100644
index 00000000000..b33acea47da
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/ChangeLog
@@ -0,0 +1,21 @@
+2002-11-03 Tim Coleman (tim@timcoleman.com)
+ * TdsBinary.cs:
+ * TdsBoolean.cs:
+ * TdsByte.cs:
+ * TdsCompareOptions.cs:
+ * TdsDateTime.cs:
+ * TdsDecimal.cs:
+ * TdsDouble.cs:
+ * TdsGuid.cs:
+ * TdsInt16.cs:
+ * TdsInt32.cs:
+ * TdsInt64.cs:
+ * TdsMoney.cs:
+ * TdsNullValueException.cs:
+ * TdsSingle.cs:
+ * TdsString.cs:
+ * TdsTruncateException.cs:
+ * TdsTypeException.cs:
+ New classes added for TDS types.
+ * ChangeLog
+ New ChangeLog added
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TODOAttribute.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TODOAttribute.cs
new file mode 100644
index 00000000000..c0d41cafc8f
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace Mono.Data.TdsTypes {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBinary.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBinary.cs
new file mode 100644
index 00000000000..75bb0e3bcdc
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBinary.cs
@@ -0,0 +1,230 @@
+//
+// Mono.Data.TdsTypes.TdsBinary
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsBinary : INullable, IComparable
+ {
+ #region Fields
+
+ byte[] value;
+ private bool notNull;
+
+ public static readonly TdsBinary Null;
+
+ #endregion
+
+ #region Constructors
+
+ public TdsBinary (byte[] value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public byte this[int index] {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ("The property contains Null.");
+ else if (index >= this.Length)
+ throw new TdsNullValueException ("The index parameter indicates a position beyond the length of the byte array.");
+ else
+ return value [index];
+ }
+ }
+
+ public int Length {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ("The property contains Null.");
+ else
+ return value.Length;
+ }
+ }
+
+ public byte[] Value
+ {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public int CompareTo (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsBinary Concat (TdsBinary x, TdsBinary y)
+ {
+ return (x + y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsBinary))
+ return false;
+ else
+ return (bool) (this == (TdsBinary)value);
+ }
+
+ public static TdsBoolean Equals (TdsBinary x, TdsBinary y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Operators
+
+ public static TdsBoolean GreaterThan (TdsBinary x, TdsBinary y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsBinary x, TdsBinary y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsBinary x, TdsBinary y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsBinary x, TdsBinary y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsBoolean NotEquals (TdsBinary x, TdsBinary y)
+ {
+ return (x != y);
+ }
+
+ public TdsGuid ToTdsGuid ()
+ {
+ return new TdsGuid (value);
+ }
+
+ public override string ToString ()
+ {
+ if (IsNull)
+ return "null";
+ return String.Format ("TdsBinary ({0})", Length);
+ }
+
+ #endregion
+
+ #region Operators
+
+ [MonoTODO]
+ public static TdsBinary operator + (TdsBinary x, TdsBinary y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator == (TdsBinary x, TdsBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator > (TdsBinary x, TdsBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator >= (TdsBinary x, TdsBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator != (TdsBinary x, TdsBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator < (TdsBinary x, TdsBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator <= (TdsBinary x, TdsBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ public static explicit operator byte[] (TdsBinary x)
+ {
+ return x.Value;
+ }
+
+ [MonoTODO]
+ public static explicit operator TdsBinary (TdsGuid x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static implicit operator TdsBinary (byte[] x)
+ {
+ return new TdsBinary (x);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBoolean.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBoolean.cs
new file mode 100644
index 00000000000..43a0fc161e3
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsBoolean.cs
@@ -0,0 +1,384 @@
+//
+// Mono.Data.TdsTypes.TdsBoolean
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsBoolean : INullable, IComparable
+ {
+ #region Fields
+
+ byte value;
+
+ // default is false
+ private bool notNull;
+
+ public static readonly TdsBoolean False = new TdsBoolean (false);
+ public static readonly TdsBoolean Null;
+ public static readonly TdsBoolean One = new TdsBoolean (1);
+ public static readonly TdsBoolean True = new TdsBoolean (true);
+ public static readonly TdsBoolean Zero = new TdsBoolean (0);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TdsBoolean (bool value)
+ {
+ this.value = (byte) (value ? 1 : 0);
+ notNull = true;
+ }
+
+ public TdsBoolean (int value)
+ {
+ this.value = (byte) (value != 0 ? 1 : 0);
+ notNull = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte ByteValue {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException(Locale.GetText("The property is set to null."));
+ else
+ return value;
+ }
+ }
+
+ public bool IsFalse {
+ get {
+ if (this.IsNull)
+ return false;
+ else
+ return (value == 0);
+ }
+ }
+
+ public bool IsNull {
+ get {
+ return !notNull;
+ }
+ }
+
+ public bool IsTrue {
+ get {
+ if (this.IsNull)
+ return false;
+ else
+ return (value != 0);
+ }
+ }
+
+ public bool Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException(Locale.GetText("The property is set to null."));
+ else
+ return this.IsTrue;
+ }
+ }
+
+ #endregion // Properties
+
+ public static TdsBoolean And (TdsBoolean x, TdsBoolean y)
+ {
+ return (x & y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsBoolean))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsBoolean"));
+ else if (((TdsBoolean)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsBoolean)value).ByteValue);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is TdsByte))
+ return false;
+ else
+ return (bool) (this == (TdsBoolean)value);
+ }
+
+ public static TdsBoolean Equals(TdsBoolean x, TdsBoolean y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)value;
+ }
+
+ public static TdsBoolean NotEquals(TdsBoolean x, TdsBoolean y)
+ {
+ return (x != y);
+ }
+
+ public static TdsBoolean OnesComplement(TdsBoolean x)
+ {
+ return ~x;
+ }
+
+ public static TdsBoolean Or(TdsBoolean x, TdsBoolean y)
+ {
+ return (x | y);
+ }
+
+ public static TdsBoolean Parse(string s)
+ {
+ return new TdsBoolean (Boolean.Parse (s));
+ }
+
+ public TdsByte ToTdsByte()
+ {
+ return new TdsByte (value);
+ }
+
+ // **************************************************
+ // Conversion from TdsBoolean to other TdsTypes
+ // **************************************************
+
+ public TdsDecimal ToTdsDecimal()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString()
+ {
+ if (this.IsNull)
+ return new TdsString ("Null");
+ if (this.IsTrue)
+ return new TdsString ("True");
+ else
+ return new TdsString ("False");
+ }
+
+ public override string ToString()
+ {
+ if (this.IsNull)
+ return "Null";
+ if (this.IsTrue)
+ return "True";
+ else
+ return "False";
+ }
+
+ // Bitwise exclusive-OR (XOR)
+ public static TdsBoolean Xor(TdsBoolean x, TdsBoolean y)
+ {
+ return (x ^ y);
+ }
+
+ // **************************************************
+ // Public Operators
+ // **************************************************
+
+ // Bitwise AND
+ public static TdsBoolean operator & (TdsBoolean x, TdsBoolean y)
+ {
+ return new TdsBoolean (x.Value & y.Value);
+ }
+
+ // Bitwise OR
+ public static TdsBoolean operator | (TdsBoolean x, TdsBoolean y)
+ {
+ return new TdsBoolean (x.Value | y.Value);
+
+ }
+
+ // Compares two instances for equality
+ public static TdsBoolean operator == (TdsBoolean x, TdsBoolean y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ // Bitwize exclusive-OR (XOR)
+ public static TdsBoolean operator ^ (TdsBoolean x, TdsBoolean y)
+ {
+ return new TdsBoolean (x.Value ^ y.Value);
+ }
+
+ // test Value of TdsBoolean to determine it is false.
+ public static bool operator false (TdsBoolean x)
+ {
+ return x.IsFalse;
+ }
+
+ // in-equality
+ public static TdsBoolean operator != (TdsBoolean x, TdsBoolean y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value != y.Value);
+ }
+
+ // Logical NOT
+ public static TdsBoolean operator ! (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!x.Value);
+ }
+
+ // One's Complement
+ public static TdsBoolean operator ~ (TdsBoolean x)
+ {
+ return new TdsBoolean (~x.ByteValue);
+ }
+
+ // test to see if value is true
+ public static bool operator true (TdsBoolean x)
+ {
+ return x.IsTrue;
+ }
+
+ // ****************************************
+ // Type Conversion
+ // ****************************************
+
+
+ // TdsBoolean to Boolean
+ public static explicit operator bool (TdsBoolean x)
+ {
+ return x.Value;
+ }
+
+
+ // TdsByte to TdsBoolean
+ public static explicit operator TdsBoolean (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsDecimal to TdsBoolean
+ public static explicit operator TdsBoolean (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsDouble to TdsBoolean
+ public static explicit operator TdsBoolean (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsInt16 to TdsBoolean
+ public static explicit operator TdsBoolean (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsInt32 to TdsBoolean
+ public static explicit operator TdsBoolean (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean (x.Value);
+ }
+
+ // TdsInt64 to TdsBoolean
+ public static explicit operator TdsBoolean (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsMoney to TdsBoolean
+ public static explicit operator TdsBoolean (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsSingle to TdsBoolean
+ public static explicit operator TdsBoolean (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsBoolean ((int)x.Value);
+ }
+
+ // TdsString to TdsBoolean
+ public static explicit operator TdsBoolean (TdsString x)
+ {
+ return TdsBoolean.Parse (x.Value);
+ }
+
+ // Boolean to TdsBoolean
+ public static implicit operator TdsBoolean (bool x)
+ {
+ return new TdsBoolean (x);
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsByte.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsByte.cs
new file mode 100644
index 00000000000..ea50e30172f
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsByte.cs
@@ -0,0 +1,393 @@
+//
+// Mono.Data.TdsTypes.TdsByte
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsByte : INullable, IComparable
+ {
+ #region Fields
+
+ byte value;
+ private bool notNull;
+
+ public static readonly TdsByte MaxValue = new TdsByte (0xff);
+ public static readonly TdsByte MinValue = new TdsByte (0);
+ public static readonly TdsByte Null;
+ public static readonly TdsByte Zero = new TdsByte (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsByte (byte value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public byte Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsByte Add (TdsByte x, TdsByte y)
+ {
+ return (x + y);
+ }
+
+ public static TdsByte BitwiseAnd (TdsByte x, TdsByte y)
+ {
+ return (x & y);
+ }
+
+ public static TdsByte BitwiseOr (TdsByte x, TdsByte y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsByte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsByte"));
+ else if (((TdsByte)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsByte)value).Value);
+ }
+
+ public static TdsByte Divide (TdsByte x, TdsByte y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsByte))
+ return false;
+ else
+ return (bool) (this == (TdsByte)value);
+ }
+
+ public static TdsBoolean Equals (TdsByte x, TdsByte y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static TdsBoolean GreaterThan (TdsByte x, TdsByte y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsByte x, TdsByte y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsByte x, TdsByte y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsByte x, TdsByte y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsByte Mod (TdsByte x, TdsByte y)
+ {
+ return (x % y);
+ }
+
+ public static TdsByte Multiply (TdsByte x, TdsByte y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsByte x, TdsByte y)
+ {
+ return (x != y);
+ }
+
+ public static TdsByte OnesComplement (TdsByte x)
+ {
+ return ~x;
+ }
+
+ public static TdsByte Parse (string s)
+ {
+ return new TdsByte (Byte.Parse (s));
+ }
+
+ public static TdsByte Subtract (TdsByte x, TdsByte y)
+ {
+ return (x - y);
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsDecimal ToTdsDecimal ()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble ()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16 ()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64 ()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney ()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle ()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static TdsByte Xor (TdsByte x, TdsByte y)
+ {
+ return (x ^ y);
+ }
+
+ public static TdsByte operator + (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value + y.Value));
+ }
+
+ public static TdsByte operator & (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value & y.Value));
+ }
+
+ public static TdsByte operator | (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value | y.Value));
+ }
+
+ public static TdsByte operator / (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value / y.Value));
+ }
+
+ public static TdsBoolean operator == (TdsByte x, TdsByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsByte operator ^ (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value ^ y.Value));
+ }
+
+ public static TdsBoolean operator > (TdsByte x, TdsByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsByte x, TdsByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsByte x, TdsByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsByte x, TdsByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsByte x, TdsByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ public static TdsByte operator % (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value % y.Value));
+ }
+
+ public static TdsByte operator * (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value * y.Value));
+ }
+
+ public static TdsByte operator ~ (TdsByte x)
+ {
+ return new TdsByte ((byte) ~x.Value);
+ }
+
+ public static TdsByte operator - (TdsByte x, TdsByte y)
+ {
+ return new TdsByte ((byte) (x.Value - y.Value));
+ }
+
+ public static explicit operator TdsByte (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte (x.ByteValue);
+ }
+
+ public static explicit operator byte (TdsByte x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsByte (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+ public static explicit operator TdsByte (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+ public static explicit operator TdsByte (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+ public static explicit operator TdsByte (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+ public static explicit operator TdsByte (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+ public static explicit operator TdsByte (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+ public static explicit operator TdsByte (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsByte ((byte)x.Value);
+ }
+
+
+ public static explicit operator TdsByte (TdsString x)
+ {
+ return TdsByte.Parse (x.Value);
+ }
+
+ public static implicit operator TdsByte (byte x)
+ {
+ return new TdsByte (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsCompareOptions.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsCompareOptions.cs
new file mode 100644
index 00000000000..909136bd841
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsCompareOptions.cs
@@ -0,0 +1,30 @@
+//
+// Mono.Data.TdsTypes.TdsCompareOptions.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+
+namespace Mono.Data.TdsTypes {
+ /// <summary>
+ /// Specifies the compare option values for a TdsString structure.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum TdsCompareOptions {
+ BinarySort = 0x8000,
+ IgnoreCase = 0x1,
+ IgnoreKanaType = 0x8,
+ IgnoreNonSpace = 0x2,
+ IgnoreWidth = 0x10,
+ None = 0
+ }
+
+}
+
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDateTime.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDateTime.cs
new file mode 100644
index 00000000000..d4d3fbc02ce
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDateTime.cs
@@ -0,0 +1,254 @@
+//
+// Mono.Data.TdsTypes.TdsDateTime
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsDateTime : INullable, IComparable
+ {
+ #region Fields
+ private DateTime value;
+ private bool notNull;
+
+ public static readonly TdsDateTime MaxValue = new TdsDateTime (9999,12,31);
+ public static readonly TdsDateTime MinValue = new TdsDateTime (1753,1,1);
+ public static readonly TdsDateTime Null;
+ public static readonly int SQLTicksPerHour;
+ public static readonly int SQLTicksPerMinute;
+ public static readonly int SQLTicksPerSecond;
+
+ #endregion
+
+ #region Constructors
+
+ public TdsDateTime (DateTime value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ [MonoTODO]
+ public TdsDateTime (int dayTicks, int timeTicks)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public TdsDateTime (int year, int month, int day)
+ {
+ this.value = new DateTime (year, month, day);
+ notNull = true;
+ }
+
+ public TdsDateTime (int year, int month, int day, int hour, int minute, int second)
+ {
+ this.value = new DateTime (year, month, day, hour, minute, second);
+ notNull = true;
+ }
+
+ [MonoTODO]
+ public TdsDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public TdsDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public int DayTicks {
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ [MonoTODO]
+ public int TimeTicks {
+ get { throw new NotImplementedException (); }
+ }
+
+ public DateTime Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsDateTime))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsDateTime"));
+ else if (((TdsDateTime)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsDateTime)value).Value);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsDateTime))
+ return false;
+ else
+ return (bool) (this == (TdsDateTime)value);
+ }
+
+ public static TdsBoolean Equals (TdsDateTime x, TdsDateTime y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return 42;
+ }
+
+ public static TdsBoolean GreaterThan (TdsDateTime x, TdsDateTime y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsDateTime x, TdsDateTime y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsDateTime x, TdsDateTime y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsDateTime x, TdsDateTime y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsBoolean NotEquals (TdsDateTime x, TdsDateTime y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static TdsDateTime Parse (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ [MonoTODO]
+ public static TdsDateTime operator + (TdsDateTime x, TimeSpan t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsBoolean operator == (TdsDateTime x, TdsDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsBoolean operator > (TdsDateTime x, TdsDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsDateTime x, TdsDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsDateTime x, TdsDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsDateTime x, TdsDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsDateTime x, TdsDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ [MonoTODO]
+ public static TdsDateTime operator - (TdsDateTime x, TimeSpan t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static explicit operator DateTime (TdsDateTime x)
+ {
+ return x.Value;
+ }
+
+ [MonoTODO]
+ public static explicit operator TdsDateTime (TdsString x)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static implicit operator TdsDateTime (DateTime x)
+ {
+ return new TdsDateTime (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDecimal.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDecimal.cs
new file mode 100644
index 00000000000..f6fb0fc96e8
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDecimal.cs
@@ -0,0 +1,653 @@
+//
+// Mono.Data.TdsTypes.TdsDecimal
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsDecimal : INullable, IComparable
+ {
+
+ #region Fields
+
+ int[] value;
+ byte precision;
+ byte scale;
+ bool positive;
+
+ bool notNull;
+
+ // borrowed from System.Decimal
+ const int SCALE_SHIFT = 16;
+ const int SIGN_SHIFT = 31;
+ const int RESERVED_SS32_BITS = 0x7F00FFFF;
+
+ public static readonly byte MaxPrecision = 38;
+ public static readonly byte MaxScale = 38;
+
+ public static readonly TdsDecimal MaxValue = new TdsDecimal (MaxPrecision, (byte)0, true, (int)716002642, Int32.MaxValue, (int)1518778966, (int)1262177448);
+ public static readonly TdsDecimal MinValue = new TdsDecimal (MaxPrecision, (byte)0, false, (int)716002642, Int32.MaxValue, (int)1518778966, (int)1262177448);
+ public static readonly TdsDecimal Null;
+
+ #endregion
+
+ #region Constructors
+
+ public TdsDecimal (decimal value)
+ {
+ int[] binData = Decimal.GetBits (value);
+
+ this.precision = MaxPrecision; // this value seems unclear
+
+ this.scale = (byte)(binData[3] >> SCALE_SHIFT);
+ if (this.scale > MaxScale || (this.scale & RESERVED_SS32_BITS) != 0)
+ throw new ArgumentException(Locale.GetText ("Invalid scale"));
+
+ this.positive = ((binData[3] >> SIGN_SHIFT) > 0);
+ this.value = new int[4];
+ this.value[0] = binData[0];
+ this.value[1] = binData[1];
+ this.value[2] = binData[2];
+ this.value[3] = 0;
+ notNull = true;
+ }
+
+ public TdsDecimal (double value) : this ((decimal)value) { }
+ public TdsDecimal (int value) : this ((decimal)value) { }
+ public TdsDecimal (long value) : this ((decimal)value) { }
+
+ public TdsDecimal (byte bPrecision, byte bScale, bool fPositive, int[] bits) : this (bPrecision, bScale, fPositive, bits[0], bits[1], bits[2], bits[3]) { }
+
+ public TdsDecimal (byte bPrecision, byte bScale, bool fPositive, int data1, int data2, int data3, int data4)
+ {
+ this.precision = bPrecision;
+ this.scale = bScale;
+ this.positive = fPositive;
+ this.value = new int[4];
+ this.value[0] = data1;
+ this.value[1] = data2;
+ this.value[2] = data3;
+ this.value[3] = data4;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public byte[] BinData {
+ get { throw new NotImplementedException (); }
+ }
+
+ public int[] Data {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return (value);
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public bool IsPositive {
+ get { return positive; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ }
+
+ public decimal Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ if (this.value[3] > 0)
+ throw new OverflowException ();
+ else
+ System.Console.WriteLine( "boo!" );
+ return new decimal (value[0], value[1], value[2], !positive, scale);
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public static TdsDecimal Abs (TdsDecimal n)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static TdsDecimal Add (TdsDecimal x, TdsDecimal y)
+ {
+ return (x + y);
+ }
+
+ [MonoTODO]
+ public static TdsDecimal AdjustScale (TdsDecimal n, int digits, bool fRound)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsDecimal Ceiling (TdsDecimal n)
+ {
+ throw new NotImplementedException();
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsDecimal))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsDecimal"));
+ else if (((TdsDecimal)value).IsNull)
+ return 1;
+ else
+ return this.Value.CompareTo (((TdsDecimal)value).Value);
+ }
+
+ [MonoTODO]
+ public static TdsDecimal ConvertToPrecScale (TdsDecimal n, int precision, int scale)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsDecimal Divide (TdsDecimal x, TdsDecimal y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsDecimal))
+ return false;
+ else
+ return (bool) (this == (TdsDecimal)value);
+ }
+
+ public static TdsBoolean Equals (TdsDecimal x, TdsDecimal y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public static TdsDecimal Floor (TdsDecimal n)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal static TdsDecimal FromTdsBigDecimal (TdsBigDecimal x)
+ {
+ if (x == null)
+ return Null;
+ else
+ return new TdsDecimal (x.Precision, x.Scale, !x.IsNegative, x.Data);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)this.Value;
+ }
+
+ public static TdsBoolean GreaterThan (TdsDecimal x, TdsDecimal y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsDecimal x, TdsDecimal y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsDecimal x, TdsDecimal y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsDecimal x, TdsDecimal y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsDecimal Multiply (TdsDecimal x, TdsDecimal y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsDecimal x, TdsDecimal y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static TdsDecimal Parse (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsDecimal Power (TdsDecimal n, double exp)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsDecimal Round (TdsDecimal n, int position)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsInt32 Sign (TdsDecimal n)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsDecimal Subtract (TdsDecimal x, TdsDecimal y)
+ {
+ return (x - y);
+ }
+
+ public double ToDouble ()
+ {
+ return ((double)this.Value);
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte ()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDouble ToTdsDouble ()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16 ()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64 ()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney ()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle ()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ [MonoTODO]
+ public static TdsDecimal Truncate (TdsDecimal n, int position)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsDecimal operator + (TdsDecimal x, TdsDecimal y)
+ {
+ // if one of them is negative, perform subtraction
+ if (x.IsPositive && !y.IsPositive) return x - y;
+ if (y.IsPositive && !x.IsPositive) return y - x;
+
+ // adjust the scale to the smaller of the two beforehand
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ // set the precision to the greater of the two
+ byte resultPrecision;
+ if (x.Precision > y.Precision)
+ resultPrecision = x.Precision;
+ else
+ resultPrecision = y.Precision;
+
+ int[] xData = x.Data;
+ int[] yData = y.Data;
+ int[] resultBits = new int[4];
+
+ ulong res;
+ ulong carry = 0;
+
+ // add one at a time, and carry the results over to the next
+ for (int i = 0; i < 4; i +=1)
+ {
+ carry = 0;
+ res = (ulong)(xData[i]) + (ulong)(yData[i]) + carry;
+ if (res > Int32.MaxValue)
+ {
+ carry = res - Int32.MaxValue;
+ res = Int32.MaxValue;
+ }
+ resultBits [i] = (int)res;
+ }
+
+ // if we have carry left, then throw an exception
+ if (carry > 0)
+ throw new OverflowException ();
+ else
+ return new TdsDecimal (resultPrecision, x.Scale, x.IsPositive, resultBits);
+ }
+
+ [MonoTODO]
+ public static TdsDecimal operator / (TdsDecimal x, TdsDecimal y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsBoolean operator == (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 0; i < 4; i += 1)
+ {
+ if (x.Data[i] != y.Data[i])
+ return new TdsBoolean (false);
+ }
+ return new TdsBoolean (true);
+ }
+
+ public static TdsBoolean operator > (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new TdsBoolean (x.Data[i] > y.Data[i]);
+ }
+ return new TdsBoolean (false);
+ }
+
+ public static TdsBoolean operator >= (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new TdsBoolean (x.Data[i] >= y.Data[i]);
+ }
+ return new TdsBoolean (true);
+ }
+
+ public static TdsBoolean operator != (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 0; i < 4; i += 1)
+ {
+ if (x.Data[i] != y.Data[i])
+ return new TdsBoolean (true);
+ }
+ return new TdsBoolean (false);
+ }
+
+ public static TdsBoolean operator < (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+
+ return new TdsBoolean (x.Data[i] < y.Data[i]);
+ }
+ return new TdsBoolean (false);
+ }
+
+ public static TdsBoolean operator <= (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new TdsBoolean (x.Data[i] <= y.Data[i]);
+ }
+ return new TdsBoolean (true);
+ }
+
+ public static TdsDecimal operator * (TdsDecimal x, TdsDecimal y)
+ {
+ // adjust the scale to the smaller of the two beforehand
+ if (x.Scale > y.Scale)
+ x = TdsDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = TdsDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ // set the precision to the greater of the two
+ byte resultPrecision;
+ if (x.Precision > y.Precision)
+ resultPrecision = x.Precision;
+ else
+ resultPrecision = y.Precision;
+
+ int[] xData = x.Data;
+ int[] yData = y.Data;
+ int[] resultBits = new int[4];
+
+ ulong res;
+ ulong carry = 0;
+
+ // multiply one at a time, and carry the results over to the next
+ for (int i = 0; i < 4; i +=1)
+ {
+ carry = 0;
+ res = (ulong)(xData[i]) * (ulong)(yData[i]) + carry;
+ if (res > Int32.MaxValue)
+ {
+ carry = res - Int32.MaxValue;
+ res = Int32.MaxValue;
+ }
+ resultBits [i] = (int)res;
+ }
+
+ // if we have carry left, then throw an exception
+ if (carry > 0)
+ throw new OverflowException ();
+ else
+ return new TdsDecimal (resultPrecision, x.Scale, (x.IsPositive == y.IsPositive), resultBits);
+
+ }
+
+ public static TdsDecimal operator - (TdsDecimal x, TdsDecimal y)
+ {
+ if (x.IsPositive && !y.IsPositive) return x + y;
+ if (!x.IsPositive && y.IsPositive) return -(x + y);
+ if (!x.IsPositive && !y.IsPositive) return y - x;
+
+ // otherwise, x is positive and y is positive
+ bool resultPositive = (bool)(x > y);
+ int[] yData = y.Data;
+
+ for (int i = 0; i < 4; i += 1) yData[i] = -yData[i];
+
+ TdsDecimal yInverse = new TdsDecimal (y.Precision, y.Scale, y.IsPositive, yData);
+
+ if (resultPositive)
+ return x + yInverse;
+ else
+ return -(x + yInverse);
+ }
+
+ public static TdsDecimal operator - (TdsDecimal n)
+ {
+ return new TdsDecimal (n.Precision, n.Scale, !n.IsPositive, n.Data);
+ }
+
+ public static explicit operator TdsDecimal (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.ByteValue);
+ }
+
+ public static explicit operator Decimal (TdsDecimal n)
+ {
+ return n.Value;
+ }
+
+ public static explicit operator TdsDecimal (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ public static explicit operator TdsDecimal (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ [MonoTODO]
+ public static explicit operator TdsDecimal (TdsString x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static implicit operator TdsDecimal (decimal x)
+ {
+ return new TdsDecimal (x);
+ }
+
+ public static implicit operator TdsDecimal (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsDecimal (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsDecimal (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsDecimal (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsDecimal (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDecimal ((decimal)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDouble.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDouble.cs
new file mode 100644
index 00000000000..c09d6607d02
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsDouble.cs
@@ -0,0 +1,349 @@
+//
+// Mono.Data.TdsTypes.TdsDouble
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsDouble : INullable, IComparable
+ {
+ #region Fields
+ double value;
+
+ private bool notNull;
+
+ public static readonly TdsDouble MaxValue = new TdsDouble (1.7976931348623157e308);
+ public static readonly TdsDouble MinValue = new TdsDouble (-1.7976931348623157e308);
+ public static readonly TdsDouble Null;
+ public static readonly TdsDouble Zero = new TdsDouble (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsDouble (double value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public double Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsDouble Add (TdsDouble x, TdsDouble y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsDouble))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsDouble"));
+ else if (((TdsDouble)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsDouble)value).Value);
+ }
+
+ public static TdsDouble Divide (TdsDouble x, TdsDouble y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsDouble))
+ return false;
+ else
+ return (bool) (this == (TdsDouble)value);
+ }
+
+ public static TdsBoolean Equals (TdsDouble x, TdsDouble y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ long LongValue = (long)value;
+ return (int)(LongValue ^ (LongValue >> 32));
+
+ }
+
+ public static TdsBoolean GreaterThan (TdsDouble x, TdsDouble y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsDouble x, TdsDouble y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsDouble x, TdsDouble y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsDouble x, TdsDouble y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsDouble Multiply (TdsDouble x, TdsDouble y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsDouble x, TdsDouble y)
+ {
+ return (x != y);
+ }
+
+ public static TdsDouble Parse (string s)
+ {
+ return new TdsDouble (Double.Parse (s));
+ }
+
+ public static TdsDouble Subtract (TdsDouble x, TdsDouble y)
+ {
+ return (x - y);
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte ()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDecimal ToTdsDecimal ()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsInt16 ToTdsInt16 ()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64 ()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney ()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle ()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static TdsDouble operator + (TdsDouble x, TdsDouble y)
+ {
+ return new TdsDouble (x.Value + y.Value);
+ }
+
+ public static TdsDouble operator / (TdsDouble x, TdsDouble y)
+ {
+ return new TdsDouble (x.Value / y.Value);
+ }
+
+ public static TdsBoolean operator == (TdsDouble x, TdsDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsBoolean operator > (TdsDouble x, TdsDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsDouble x, TdsDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsDouble x, TdsDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsDouble x, TdsDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsDouble x, TdsDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ public static TdsDouble operator * (TdsDouble x, TdsDouble y)
+ {
+ return new TdsDouble (x.Value * y.Value);
+ }
+
+ public static TdsDouble operator - (TdsDouble x, TdsDouble y)
+ {
+ return new TdsDouble (x.Value - y.Value);
+ }
+
+ public static TdsDouble operator - (TdsDouble n)
+ {
+ return new TdsDouble (-(n.Value));
+ }
+
+ public static explicit operator TdsDouble (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.ByteValue);
+ }
+
+ public static explicit operator double (TdsDouble x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsDouble (TdsString x)
+ {
+ return TdsDouble.Parse (x.Value);
+ }
+
+ public static implicit operator TdsDouble (double x)
+ {
+ return new TdsDouble (x);
+ }
+
+ public static implicit operator TdsDouble (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ public static implicit operator TdsDouble (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ public static implicit operator TdsDouble (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ public static implicit operator TdsDouble (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ public static implicit operator TdsDouble (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ public static implicit operator TdsDouble (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ public static implicit operator TdsDouble (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsDouble ((double)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsGuid.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsGuid.cs
new file mode 100644
index 00000000000..54319c8fa3a
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsGuid.cs
@@ -0,0 +1,222 @@
+//
+// Mono.Data.TdsTypes.TdsGuid
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsGuid : INullable, IComparable
+ {
+ #region Fields
+
+ Guid value;
+
+ private bool notNull;
+
+ public static readonly TdsGuid Null;
+
+ #endregion
+
+ #region Constructors
+
+ public TdsGuid (byte[] value)
+ {
+ this.value = new Guid (value);
+ notNull = true;
+ }
+
+ public TdsGuid (Guid g)
+ {
+ this.value = g;
+ notNull = true;
+ }
+
+ public TdsGuid (string s)
+ {
+ this.value = new Guid (s);
+ notNull = true;
+ }
+
+ public TdsGuid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
+ {
+ this.value = new Guid (a, b, c, d, e, f, g, h, i, j, k);
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public Guid Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsGuid))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsGuid"));
+ else if (((TdsGuid)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsGuid)value).Value);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsGuid))
+ return false;
+ else
+ return (bool) (this == (TdsGuid)value);
+ }
+
+ public static TdsBoolean Equals (TdsGuid x, TdsGuid y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return 42;
+ }
+
+ public static TdsBoolean GreaterThan (TdsGuid x, TdsGuid y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsGuid x, TdsGuid y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsGuid x, TdsGuid y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsGuid x, TdsGuid y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsBoolean NotEquals (TdsGuid x, TdsGuid y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static TdsGuid Parse (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte[] ToByteArray()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public TdsBinary ToTdsBinary ()
+ {
+ return ((TdsBinary)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static TdsBoolean operator == (TdsGuid x, TdsGuid y)
+ {
+ if (x.IsNull || y.IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator > (TdsGuid x, TdsGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator >= (TdsGuid x, TdsGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsBoolean operator != (TdsGuid x, TdsGuid y)
+ {
+ if (x.IsNull || y.IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator < (TdsGuid x, TdsGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TdsBoolean operator <= (TdsGuid x, TdsGuid y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static explicit operator TdsGuid (TdsBinary x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static explicit operator Guid (TdsGuid x)
+ {
+ return x.Value;
+ }
+
+ [MonoTODO]
+ public static explicit operator TdsGuid (TdsString x)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static implicit operator TdsGuid (Guid x)
+ {
+ return new TdsGuid (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt16.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt16.cs
new file mode 100644
index 00000000000..b794704fb7d
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt16.cs
@@ -0,0 +1,397 @@
+//
+// Mono.Data.TdsTypes.TdsInt16
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsInt16 : INullable, IComparable
+ {
+ #region Fields
+
+ short value;
+ private bool notNull;
+
+ public static readonly TdsInt16 MaxValue = new TdsInt16 (32767);
+ public static readonly TdsInt16 MinValue = new TdsInt16 (-32768);
+ public static readonly TdsInt16 Null;
+ public static readonly TdsInt16 Zero = new TdsInt16 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsInt16 (short value)
+ {
+ this.value = value;
+ notNull = true;;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public short Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsInt16 Add (TdsInt16 x, TdsInt16 y)
+ {
+ return (x + y);
+ }
+
+ public static TdsInt16 BitwiseAnd (TdsInt16 x, TdsInt16 y)
+ {
+ return (x & y);
+ }
+
+ public static TdsInt16 BitwiseOr (TdsInt16 x, TdsInt16 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsInt16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsInt16"));
+ else if (((TdsInt16)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsInt16)value).Value);
+ }
+
+ public static TdsInt16 Divide (TdsInt16 x, TdsInt16 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsInt16))
+ return false;
+ else
+ return (bool) (this == (TdsInt16)value);
+ }
+
+ public static TdsBoolean Equals (TdsInt16 x, TdsInt16 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static TdsBoolean GreaterThan (TdsInt16 x, TdsInt16 y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsInt16 x, TdsInt16 y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsInt16 x, TdsInt16 y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsInt16 x, TdsInt16 y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsInt16 Mod (TdsInt16 x, TdsInt16 y)
+ {
+ return (x % y);
+ }
+
+ public static TdsInt16 Multiply (TdsInt16 x, TdsInt16 y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsInt16 x, TdsInt16 y)
+ {
+ return (x != y);
+ }
+
+ public static TdsInt16 OnesComplement (TdsInt16 x)
+ {
+ return ~x;
+ }
+
+ public static TdsInt16 Parse (string s)
+ {
+ return new TdsInt16 (Int16.Parse (s));
+ }
+
+ public static TdsInt16 Subtract (TdsInt16 x, TdsInt16 y)
+ {
+ return (x - y);
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte ()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDecimal ToTdsDecimal ()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble ()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64 ()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney ()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle ()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static TdsInt16 Xor (TdsInt16 x, TdsInt16 y)
+ {
+ return (x ^ y);
+ }
+
+ public static TdsInt16 operator + (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.Value + y.Value));
+ }
+
+ public static TdsInt16 operator & (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.value & y.Value));
+ }
+
+ public static TdsInt16 operator | (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) ((byte) x.Value | (byte) y.Value));
+ }
+
+ public static TdsInt16 operator / (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.Value / y.Value));
+ }
+
+ public static TdsBoolean operator == (TdsInt16 x, TdsInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsInt16 operator ^ (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.Value ^ y.Value));
+ }
+
+ public static TdsBoolean operator > (TdsInt16 x, TdsInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsInt16 x, TdsInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsInt16 x, TdsInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsInt16 x, TdsInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsInt16 x, TdsInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ public static TdsInt16 operator % (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.Value % y.Value));
+ }
+
+ public static TdsInt16 operator * (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.Value * y.Value));
+ }
+
+ public static TdsInt16 operator ~ (TdsInt16 x)
+ {
+ return new TdsInt16 ((short) (~x.Value));
+ }
+
+ public static TdsInt16 operator - (TdsInt16 x, TdsInt16 y)
+ {
+ return new TdsInt16 ((short) (x.Value - y.Value));
+ }
+
+ public static TdsInt16 operator - (TdsInt16 n)
+ {
+ return new TdsInt16 ((short) (-n.Value));
+ }
+
+ public static explicit operator TdsInt16 (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.ByteValue);
+ }
+
+ public static explicit operator TdsInt16 (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ public static explicit operator TdsInt16 (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ public static explicit operator short (TdsInt16 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsInt16 (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ public static explicit operator TdsInt16 (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ public static explicit operator TdsInt16 (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ public static explicit operator TdsInt16 (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ public static explicit operator TdsInt16 (TdsString x)
+ {
+ return TdsInt16.Parse (x.Value);
+ }
+
+ public static implicit operator TdsInt16 (short x)
+ {
+ return new TdsInt16 (x);
+ }
+
+ public static implicit operator TdsInt16 (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt16 ((short)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt32.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt32.cs
new file mode 100644
index 00000000000..c283f23b17c
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt32.cs
@@ -0,0 +1,417 @@
+//
+// Mono.Data.TdsTypes.TdsInt32
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsInt32 : INullable, IComparable
+ {
+ #region Fields
+
+ int value;
+ private bool notNull;
+
+ public static readonly TdsInt32 MaxValue = new TdsInt32 (2147483647);
+ public static readonly TdsInt32 MinValue = new TdsInt32 (-2147483648);
+ public static readonly TdsInt32 Null;
+ public static readonly TdsInt32 Zero = new TdsInt32 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsInt32(int value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public int Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsInt32 Add (TdsInt32 x, TdsInt32 y)
+ {
+ return (x + y);
+ }
+
+ public static TdsInt32 BitwiseAnd(TdsInt32 x, TdsInt32 y)
+ {
+ return (x & y);
+ }
+
+ public static TdsInt32 BitwiseOr(TdsInt32 x, TdsInt32 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo(object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsInt32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsInt32"));
+ else if (((TdsInt32)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsInt32)value).Value);
+ }
+
+ public static TdsInt32 Divide(TdsInt32 x, TdsInt32 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is TdsInt32))
+ return false;
+ else
+ return (bool) (this == (TdsInt32)value);
+ }
+
+ public static TdsBoolean Equals(TdsInt32 x, TdsInt32 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ return value;
+ }
+
+ public static TdsBoolean GreaterThan (TdsInt32 x, TdsInt32 y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsInt32 x, TdsInt32 y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan(TdsInt32 x, TdsInt32 y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual(TdsInt32 x, TdsInt32 y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsInt32 Mod(TdsInt32 x, TdsInt32 y)
+ {
+ return (x % y);
+ }
+
+ public static TdsInt32 Multiply(TdsInt32 x, TdsInt32 y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals(TdsInt32 x, TdsInt32 y)
+ {
+ return (x != y);
+ }
+
+ public static TdsInt32 OnesComplement(TdsInt32 x)
+ {
+ return ~x;
+ }
+
+ public static TdsInt32 Parse(string s)
+ {
+ return new TdsInt32 (Int32.Parse (s));
+ }
+
+ public static TdsInt32 Subtract(TdsInt32 x, TdsInt32 y)
+ {
+ return (x - y);
+ }
+
+ public TdsBoolean ToTdsBoolean()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDecimal ToTdsDecimal()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt64 ToTdsInt64()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static TdsInt32 Xor(TdsInt32 x, TdsInt32 y)
+ {
+ return (x ^ y);
+ }
+
+ #endregion
+
+ #region Operators
+
+ // Compute Addition
+ public static TdsInt32 operator + (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value + y.Value);
+ }
+
+ // Bitwise AND
+ public static TdsInt32 operator & (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value & y.Value);
+ }
+
+ // Bitwise OR
+ public static TdsInt32 operator | (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value | y.Value);
+ }
+
+ // Compute Division
+ public static TdsInt32 operator / (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value / y.Value);
+ }
+
+ // Compare Equality
+ public static TdsBoolean operator == (TdsInt32 x, TdsInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ // Bitwise Exclusive-OR (XOR)
+ public static TdsInt32 operator ^ (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value ^ y.Value);
+ }
+
+ // > Compare
+ public static TdsBoolean operator >(TdsInt32 x, TdsInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ // >= Compare
+ public static TdsBoolean operator >= (TdsInt32 x, TdsInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ // != Inequality Compare
+ public static TdsBoolean operator != (TdsInt32 x, TdsInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value != y.Value);
+ }
+
+ // < Compare
+ public static TdsBoolean operator < (TdsInt32 x, TdsInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ // <= Compare
+ public static TdsBoolean operator <= (TdsInt32 x, TdsInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ // Compute Modulus
+ public static TdsInt32 operator % (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value % y.Value);
+ }
+
+ // Compute Multiplication
+ public static TdsInt32 operator * (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value * y.Value);
+ }
+
+ // Ones Complement
+ public static TdsInt32 operator ~ (TdsInt32 x)
+ {
+ return new TdsInt32 (~x.Value);
+ }
+
+ // Subtraction
+ public static TdsInt32 operator - (TdsInt32 x, TdsInt32 y)
+ {
+ return new TdsInt32 (x.Value - y.Value);
+ }
+
+ // Negates the Value
+ public static TdsInt32 operator - (TdsInt32 x)
+ {
+ return new TdsInt32 (-x.Value);
+ }
+
+ // Type Conversions
+ public static explicit operator TdsInt32 (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.ByteValue);
+ }
+
+ public static explicit operator TdsInt32 (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ public static explicit operator TdsInt32 (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ public static explicit operator int (TdsInt32 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsInt32 (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ public static explicit operator TdsInt32(TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ public static explicit operator TdsInt32(TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ public static explicit operator TdsInt32(TdsString x)
+ {
+ return TdsInt32.Parse (x.Value);
+ }
+
+ public static implicit operator TdsInt32(int x)
+ {
+ return new TdsInt32 (x);
+ }
+
+ public static implicit operator TdsInt32(TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ public static implicit operator TdsInt32(TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsInt32 ((int)x.Value);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt64.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt64.cs
new file mode 100644
index 00000000000..83d0212d567
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsInt64.cs
@@ -0,0 +1,400 @@
+//
+// Mono.Data.TdsTypes.TdsInt64
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsInt64 : INullable, IComparable
+ {
+ #region Fields
+
+ long value;
+
+ private bool notNull;
+
+ public static readonly TdsInt64 MaxValue = new TdsInt64 (9223372036854775807);
+ public static readonly TdsInt64 MinValue = new TdsInt64 (-9223372036854775808);
+
+ public static readonly TdsInt64 Null;
+ public static readonly TdsInt64 Zero = new TdsInt64 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsInt64 (long value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public long Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsInt64 Add (TdsInt64 x, TdsInt64 y)
+ {
+ return (x + y);
+ }
+
+ public static TdsInt64 BitwiseAnd (TdsInt64 x, TdsInt64 y)
+ {
+ return (x & y);
+ }
+
+ public static TdsInt64 BitwiseOr (TdsInt64 x, TdsInt64 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsInt64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsInt64"));
+ else if (((TdsInt64)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsInt64)value).Value);
+ }
+
+ public static TdsInt64 Divide (TdsInt64 x, TdsInt64 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsInt64))
+ return false;
+ else
+ return (bool) (this == (TdsInt64)value);
+ }
+
+ public static TdsBoolean Equals (TdsInt64 x, TdsInt64 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ public static TdsBoolean GreaterThan (TdsInt64 x, TdsInt64 y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsInt64 x, TdsInt64 y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsInt64 x, TdsInt64 y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsInt64 x, TdsInt64 y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsInt64 Mod (TdsInt64 x, TdsInt64 y)
+ {
+ return (x % y);
+ }
+
+ public static TdsInt64 Multiply (TdsInt64 x, TdsInt64 y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsInt64 x, TdsInt64 y)
+ {
+ return (x != y);
+ }
+
+ public static TdsInt64 OnesComplement (TdsInt64 x)
+ {
+ return ~x;
+ }
+
+
+ public static TdsInt64 Parse (string s)
+ {
+ return new TdsInt64 (Int64.Parse (s));
+ }
+
+ public static TdsInt64 Subtract (TdsInt64 x, TdsInt64 y)
+ {
+ return (x - y);
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte ()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDecimal ToTdsDecimal ()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble ()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16 ()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsMoney ToTdsMoney ()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle ()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+
+ return value.ToString ();
+ }
+
+ public static TdsInt64 Xor (TdsInt64 x, TdsInt64 y)
+ {
+ return (x ^ y);
+ }
+
+ public static TdsInt64 operator + (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.Value + y.Value);
+ }
+
+ public static TdsInt64 operator & (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.value & y.Value);
+ }
+
+ public static TdsInt64 operator | (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.value | y.Value);
+ }
+
+ public static TdsInt64 operator / (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.Value / y.Value);
+ }
+
+ public static TdsBoolean operator == (TdsInt64 x, TdsInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsInt64 operator ^ (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.Value ^ y.Value);
+ }
+
+ public static TdsBoolean operator > (TdsInt64 x, TdsInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsInt64 x, TdsInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsInt64 x, TdsInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsInt64 x, TdsInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsInt64 x, TdsInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ public static TdsInt64 operator % (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64(x.Value % y.Value);
+ }
+
+ public static TdsInt64 operator * (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.Value * y.Value);
+ }
+
+ public static TdsInt64 operator ~ (TdsInt64 x)
+ {
+ return new TdsInt64 (~(x.Value));
+ }
+
+ public static TdsInt64 operator - (TdsInt64 x, TdsInt64 y)
+ {
+ return new TdsInt64 (x.Value - y.Value);
+ }
+
+ public static TdsInt64 operator - (TdsInt64 n)
+ {
+ return new TdsInt64 (-(n.Value));
+ }
+
+ public static explicit operator TdsInt64 (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.ByteValue);
+ }
+
+ public static explicit operator TdsInt64 (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ public static explicit operator TdsInt64 (TdsDouble x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ public static explicit operator long (TdsInt64 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsInt64 (TdsMoney x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ public static explicit operator TdsInt64 (TdsSingle x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ public static explicit operator TdsInt64 (TdsString x)
+ {
+ return TdsInt64.Parse (x.Value);
+ }
+
+ public static implicit operator TdsInt64 (long x)
+ {
+ return new TdsInt64 (x);
+ }
+
+ public static implicit operator TdsInt64 (TdsByte x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ public static implicit operator TdsInt64 (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ public static implicit operator TdsInt64 (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return TdsInt64.Null;
+ else
+ return new TdsInt64 ((long)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsMoney.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsMoney.cs
new file mode 100644
index 00000000000..0f8f326459c
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsMoney.cs
@@ -0,0 +1,390 @@
+//
+// Mono.Data.TdsTypes.TdsMoney
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsMoney : INullable, IComparable
+ {
+ #region Fields
+
+ decimal value;
+
+ private bool notNull;
+
+ public static readonly TdsMoney MaxValue = new TdsMoney (922337203685477.5807);
+ public static readonly TdsMoney MinValue = new TdsMoney (-922337203685477.5808);
+ public static readonly TdsMoney Null;
+ public static readonly TdsMoney Zero = new TdsMoney (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsMoney (decimal value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ public TdsMoney (double value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ public TdsMoney (int value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ public TdsMoney (long value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public decimal Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsMoney Add (TdsMoney x, TdsMoney y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsMoney))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsMoney"));
+ else if (((TdsMoney)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsMoney)value).Value);
+ }
+
+ public static TdsMoney Divide (TdsMoney x, TdsMoney y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsMoney))
+ return false;
+ else
+ return (bool) (this == (TdsMoney)value);
+ }
+
+ public static TdsBoolean Equals (TdsMoney x, TdsMoney y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static TdsBoolean GreaterThan (TdsMoney x, TdsMoney y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsMoney x, TdsMoney y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsMoney x, TdsMoney y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsMoney x, TdsMoney y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsMoney Multiply (TdsMoney x, TdsMoney y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsMoney x, TdsMoney y)
+ {
+ return (x != y);
+ }
+
+ public static TdsMoney Parse (string s)
+ {
+ decimal d = Decimal.Parse (s);
+
+ if (d > TdsMoney.MaxValue.Value || d < TdsMoney.MinValue.Value)
+ throw new OverflowException ("");
+
+ return new TdsMoney (d);
+ }
+
+ public static TdsMoney Subtract (TdsMoney x, TdsMoney y)
+ {
+ return (x - y);
+ }
+
+ public decimal ToDecimal ()
+ {
+ return value;
+ }
+
+ public double ToDouble ()
+ {
+ return (double)value;
+ }
+
+ public int ToInt32 ()
+ {
+ return (int)value;
+ }
+
+ public long ToInt64 ()
+ {
+ return (long)value;
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte ()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDecimal ToTdsDecimal ()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble ()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16 ()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64 ()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsSingle ToTdsSingle ()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static TdsMoney operator + (TdsMoney x, TdsMoney y)
+ {
+ return new TdsMoney (x.Value + y.Value);
+ }
+
+ public static TdsMoney operator / (TdsMoney x, TdsMoney y)
+ {
+ return new TdsMoney (x.Value / y.Value);
+ }
+
+ public static TdsBoolean operator == (TdsMoney x, TdsMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsBoolean operator > (TdsMoney x, TdsMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsMoney x, TdsMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsMoney x, TdsMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsMoney x, TdsMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsMoney x, TdsMoney y)
+ {
+ if (x.IsNull || y.IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ public static TdsMoney operator * (TdsMoney x, TdsMoney y)
+ {
+ return new TdsMoney (x.Value * y.Value);
+ }
+
+ public static TdsMoney operator - (TdsMoney x, TdsMoney y)
+ {
+ return new TdsMoney (x.Value - y.Value);
+ }
+
+ public static TdsMoney operator - (TdsMoney n)
+ {
+ return new TdsMoney (-(n.Value));
+ }
+
+ public static explicit operator TdsMoney (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.ByteValue);
+ }
+
+ public static explicit operator TdsMoney (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney (x.Value);
+ }
+
+ public static explicit operator TdsMoney (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.Value);
+ }
+
+ public static explicit operator decimal (TdsMoney x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsMoney (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.Value);
+ }
+
+ public static explicit operator TdsMoney (TdsString x)
+ {
+ return TdsMoney.Parse (x.Value);
+ }
+
+ public static implicit operator TdsMoney (decimal x)
+ {
+ return new TdsMoney (x);
+ }
+
+ public static implicit operator TdsMoney (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsMoney (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsMoney (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator TdsMoney (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsMoney ((decimal)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsNullValueException.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsNullValueException.cs
new file mode 100644
index 00000000000..e4a110a3d04
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsNullValueException.cs
@@ -0,0 +1,32 @@
+//
+// Mono.Data.TdsTypes.TdsNullValueException.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using Mono.Data.TdsClient;
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.TdsTypes {
+ [Serializable]
+ public class TdsNullValueException : TdsTypeException
+ {
+ #region Constructors
+
+ public TdsNullValueException ()
+ : base (Locale.GetText ("The value property is null"))
+ {
+ }
+
+ public TdsNullValueException (string message)
+ : base (message)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsSingle.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsSingle.cs
new file mode 100644
index 00000000000..367dc69b040
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsSingle.cs
@@ -0,0 +1,335 @@
+//
+// System.Data.TdsTypes.TdsSingle
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsSingle : INullable, IComparable
+ {
+ #region Fields
+
+ float value;
+
+ private bool notNull;
+
+ public static readonly TdsSingle MaxValue = new TdsSingle (3.40282346638528859e38);
+ public static readonly TdsSingle MinValue = new TdsSingle (-3.40282346638528859e38);
+ public static readonly TdsSingle Null;
+ public static readonly TdsSingle Zero = new TdsSingle (0);
+
+ #endregion
+
+ #region Constructors
+
+ public TdsSingle (double value)
+ {
+ this.value = (float)value;
+ notNull = true;
+ }
+
+ public TdsSingle (float value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public float Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static TdsSingle Add (TdsSingle x, TdsSingle y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsSingle))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsSingle"));
+ else if (((TdsSingle)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsSingle)value).Value);
+ }
+
+ public static TdsSingle Divide (TdsSingle x, TdsSingle y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TdsSingle))
+ return false;
+ else
+ return (bool) (this == (TdsSingle)value);
+ }
+
+ public static TdsBoolean Equals (TdsSingle x, TdsSingle y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ long LongValue = (long) value;
+ return (int)(LongValue ^ (LongValue >> 32));
+ }
+
+ public static TdsBoolean GreaterThan (TdsSingle x, TdsSingle y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual (TdsSingle x, TdsSingle y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan (TdsSingle x, TdsSingle y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual (TdsSingle x, TdsSingle y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsSingle Multiply (TdsSingle x, TdsSingle y)
+ {
+ return (x * y);
+ }
+
+ public static TdsBoolean NotEquals (TdsSingle x, TdsSingle y)
+ {
+ return (x != y);
+ }
+
+ public static TdsSingle Parse (string s)
+ {
+ return new TdsSingle (Single.Parse (s));
+ }
+
+ public static TdsSingle Subtract (TdsSingle x, TdsSingle y)
+ {
+ return (x - y);
+ }
+
+ public TdsBoolean ToTdsBoolean ()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte ()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDecimal ToTdsDecimal ()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble ()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsInt16 ToTdsInt16 ()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32 ()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64 ()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney ()
+ {
+ return ((TdsMoney)this);
+ }
+
+
+ public TdsString ToTdsString ()
+ {
+ return ((TdsString)this);
+ }
+
+ public override string ToString ()
+ {
+ return value.ToString ();
+ }
+
+ public static TdsSingle operator + (TdsSingle x, TdsSingle y)
+ {
+ return new TdsSingle (x.Value + y.Value);
+ }
+
+ public static TdsSingle operator / (TdsSingle x, TdsSingle y)
+ {
+ return new TdsSingle (x.Value / y.Value);
+ }
+
+ public static TdsBoolean operator == (TdsSingle x, TdsSingle y)
+ {
+ if (x.IsNull || y .IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ public static TdsBoolean operator > (TdsSingle x, TdsSingle y)
+ {
+ if (x.IsNull || y .IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value > y.Value);
+ }
+
+ public static TdsBoolean operator >= (TdsSingle x, TdsSingle y)
+ {
+ if (x.IsNull || y .IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value >= y.Value);
+ }
+
+ public static TdsBoolean operator != (TdsSingle x, TdsSingle y)
+ {
+ if (x.IsNull || y .IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (!(x.Value == y.Value));
+ }
+
+ public static TdsBoolean operator < (TdsSingle x, TdsSingle y)
+ {
+ if (x.IsNull || y .IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value < y.Value);
+ }
+
+ public static TdsBoolean operator <= (TdsSingle x, TdsSingle y)
+ {
+ if (x.IsNull || y .IsNull) return TdsBoolean.Null;
+ return new TdsBoolean (x.Value <= y.Value);
+ }
+
+ public static TdsSingle operator * (TdsSingle x, TdsSingle y)
+ {
+ return new TdsSingle (x.Value * y.Value);
+ }
+
+ public static TdsSingle operator - (TdsSingle x, TdsSingle y)
+ {
+ return new TdsSingle (x.Value - y.Value);
+ }
+
+ public static TdsSingle operator - (TdsSingle n)
+ {
+ return new TdsSingle (-(n.Value));
+ }
+
+ public static explicit operator TdsSingle (TdsBoolean x)
+ {
+ return new TdsSingle((float)x.ByteValue);
+ }
+
+ public static explicit operator TdsSingle (TdsDouble x)
+ {
+ return new TdsSingle((float)x.Value);
+ }
+
+ public static explicit operator float (TdsSingle x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator TdsSingle (TdsString x)
+ {
+ return TdsSingle.Parse (x.Value);
+ }
+
+ public static implicit operator TdsSingle (float x)
+ {
+ return new TdsSingle (x);
+ }
+
+ public static implicit operator TdsSingle (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsSingle((float)x.Value);
+ }
+
+ public static implicit operator TdsSingle (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsSingle((float)x.Value);
+ }
+
+ public static implicit operator TdsSingle (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsSingle((float)x.Value);
+ }
+
+ public static implicit operator TdsSingle (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsSingle((float)x.Value);
+ }
+
+ public static implicit operator TdsSingle (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsSingle((float)x.Value);
+ }
+
+ public static implicit operator TdsSingle (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsSingle((float)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsString.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsString.cs
new file mode 100644
index 00000000000..f0255372271
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsString.cs
@@ -0,0 +1,457 @@
+//
+// Mono.Data.TdsTypes.TdsString
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright Tim Coleman, 2002
+//
+
+using Mono.Data.TdsClient;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+
+namespace Mono.Data.TdsTypes {
+ public struct TdsString : INullable, IComparable
+ {
+ #region Fields
+
+ string value;
+
+ private bool notNull;
+
+ public static readonly int BinarySort;
+ public static readonly int IgnoreCase;
+ public static readonly int IgnoreKanaType;
+ public static readonly int IgnoreNonSpace;
+ public static readonly int IgnoreWidth;
+ public static readonly TdsString Null;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ // init with a string data
+ public TdsString (string data)
+ {
+ this.value = data;
+ notNull = true;
+ }
+
+ // init with a string data and locale id values.
+ [MonoTODO]
+ public TdsString (string data, int lcid)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options,
+ // and an array of bytes data
+ [MonoTODO]
+ public TdsString (int lcid, TdsCompareOptions compareOptions, byte[] data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with string data, locale id, and compare options
+ [MonoTODO]
+ public TdsString (string data, int lcid, TdsCompareOptions compareOptions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // and whether unicode is encoded or not
+ [MonoTODO]
+ public TdsString (int lcid, TdsCompareOptions compareOptions, byte[] data, bool fUnicode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array,
+ // and number of bytes to copy
+ [MonoTODO]
+ public TdsString (int lcid, TdsCompareOptions compareOptions, byte[] data, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array, number of byte to copy,
+ // and whether unicode is encoded or not
+ [MonoTODO]
+ public TdsString (int lcid, TdsCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+
+ #region Public Properties
+
+ public CompareInfo CompareInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public CultureInfo CultureInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ // geographics location and language (locale id)
+ public int LCID {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public TdsCompareOptions TdsCompareOptions {
+ [MonoTODO]
+ get { throw new NotImplementedException ();
+ }
+ }
+
+ public string Value {
+ get {
+ if (this.IsNull)
+ throw new TdsNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ [MonoTODO]
+ public TdsString Clone()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static CompareOptions CompareOptionsFromTdsCompareOptions (TdsCompareOptions compareOptions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // **********************************
+ // Comparison Methods
+ // **********************************
+
+ public int CompareTo(object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is TdsString))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.TdsTypes.TdsString"));
+ else if (((TdsString)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((TdsString)value).Value);
+ }
+
+ public static TdsString Concat(TdsString x, TdsString y)
+ {
+ return (x + y);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is TdsString))
+ return false;
+ else
+ return (bool) (this == (TdsString)value);
+ }
+
+ public static TdsBoolean Equals(TdsString x, TdsString y)
+ {
+ return (x == y);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte[] GetNonUnicodeBytes()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte[] GetUnicodeBytes()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TdsBoolean GreaterThan(TdsString x, TdsString y)
+ {
+ return (x > y);
+ }
+
+ public static TdsBoolean GreaterThanOrEqual(TdsString x, TdsString y)
+ {
+ return (x >= y);
+ }
+
+ public static TdsBoolean LessThan(TdsString x, TdsString y)
+ {
+ return (x < y);
+ }
+
+ public static TdsBoolean LessThanOrEqual(TdsString x, TdsString y)
+ {
+ return (x <= y);
+ }
+
+ public static TdsBoolean NotEquals(TdsString x, TdsString y)
+ {
+ return (x != y);
+ }
+
+ // ****************************************
+ // Type Conversions From TdsString To ...
+ // ****************************************
+
+ public TdsBoolean ToTdsBoolean()
+ {
+ return ((TdsBoolean)this);
+ }
+
+ public TdsByte ToTdsByte()
+ {
+ return ((TdsByte)this);
+ }
+
+ public TdsDateTime ToTdsDateTime()
+ {
+ return ((TdsDateTime)this);
+ }
+
+ public TdsDecimal ToTdsDecimal()
+ {
+ return ((TdsDecimal)this);
+ }
+
+ public TdsDouble ToTdsDouble()
+ {
+ return ((TdsDouble)this);
+ }
+
+ public TdsGuid ToTdsGuid()
+ {
+ return ((TdsGuid)this);
+ }
+
+ public TdsInt16 ToTdsInt16()
+ {
+ return ((TdsInt16)this);
+ }
+
+ public TdsInt32 ToTdsInt32()
+ {
+ return ((TdsInt32)this);
+ }
+
+ public TdsInt64 ToTdsInt64()
+ {
+ return ((TdsInt64)this);
+ }
+
+ public TdsMoney ToTdsMoney()
+ {
+ return ((TdsMoney)this);
+ }
+
+ public TdsSingle ToTdsSingle()
+ {
+ return ((TdsSingle)this);
+ }
+
+ public override string ToString()
+ {
+ return ((string)this);
+ }
+
+ // ***********************************
+ // Operators
+ // ***********************************
+
+ // Concatenates
+ public static TdsString operator + (TdsString x, TdsString y)
+ {
+ return new TdsString (x.Value + y.Value);
+ }
+
+ // Equality
+ public static TdsBoolean operator == (TdsString x, TdsString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value == y.Value);
+ }
+
+ // Greater Than
+ public static TdsBoolean operator > (TdsString x, TdsString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // Greater Than Or Equal
+ public static TdsBoolean operator >= (TdsString x, TdsString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ public static TdsBoolean operator != (TdsString x, TdsString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ return new TdsBoolean (x.Value != y.Value);
+ }
+
+ // Less Than
+ public static TdsBoolean operator < (TdsString x, TdsString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // Less Than Or Equal
+ public static TdsBoolean operator <= (TdsString x, TdsString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return TdsBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // **************************************
+ // Type Conversions
+ // **************************************
+
+ public static explicit operator TdsString (TdsBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.ByteValue.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsDateTime x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsGuid x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator TdsString (TdsSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new TdsString (x.Value.ToString ());
+ }
+
+ public static explicit operator string (TdsString x)
+ {
+ return x.Value;
+ }
+
+ public static implicit operator TdsString (string x)
+ {
+ return new TdsString (x);
+ }
+
+ #endregion // Public Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTruncateException.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTruncateException.cs
new file mode 100644
index 00000000000..93156f69cb7
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTruncateException.cs
@@ -0,0 +1,32 @@
+//
+// Mono.Data.TdsTypes.TdsTruncateException.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using Mono.Data.TdsClient;
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.TdsTypes {
+ [Serializable]
+ public class TdsTruncateException : TdsTypeException
+ {
+ #region Constructors
+
+ public TdsTruncateException ()
+ : base (Locale.GetText ("This value is being truncated"))
+ {
+ }
+
+ public TdsTruncateException (string message)
+ : base (message)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTypeException.cs b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTypeException.cs
new file mode 100644
index 00000000000..269aa76461c
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/Mono.Data.TdsTypes/TdsTypeException.cs
@@ -0,0 +1,32 @@
+//
+// Mono.Data.TdsTypes.TdsTypeException.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using Mono.Data.TdsClient;
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Mono.Data.TdsTypes {
+ [Serializable]
+ public class TdsTypeException : SystemException
+ {
+ #region Constructors
+
+ public TdsTypeException (string message)
+ : base (message)
+ {
+ }
+
+ protected TdsTypeException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/Mono.Data.TdsClient/list b/mcs/class/Mono.Data.TdsClient/list
new file mode 100644
index 00000000000..4662eeb82bf
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/list
@@ -0,0 +1,38 @@
+Mono.Data.TdsClient/Locale.cs
+Mono.Data.TdsClient/TdsCommand.cs
+Mono.Data.TdsClient/TdsConnection.cs
+Mono.Data.TdsClient/TdsConnectionPool.cs
+Mono.Data.TdsClient/TdsDataAdapter.cs
+Mono.Data.TdsClient/TdsDataReader.cs
+Mono.Data.TdsClient/TdsError.cs
+Mono.Data.TdsClient/TdsErrorCollection.cs
+Mono.Data.TdsClient/TdsException.cs
+Mono.Data.TdsClient/TdsInfoMessageEventHandler.cs
+Mono.Data.TdsClient/TdsInfoMessageEventArgs.cs
+Mono.Data.TdsClient/TdsParameter.cs
+Mono.Data.TdsClient/TdsParameterCollection.cs
+Mono.Data.TdsClient/TdsRowUpdatedEventArgs.cs
+Mono.Data.TdsClient/TdsRowUpdatedEventHandler.cs
+Mono.Data.TdsClient/TdsRowUpdatingEventArgs.cs
+Mono.Data.TdsClient/TdsRowUpdatingEventHandler.cs
+Mono.Data.TdsClient/TdsTransaction.cs
+Mono.Data.TdsClient/TdsType.cs
+Mono.Data.TdsClient/TODOAttribute.cs
+Mono.Data.TdsTypes/TdsBinary.cs
+Mono.Data.TdsTypes/TdsBoolean.cs
+Mono.Data.TdsTypes/TdsByte.cs
+Mono.Data.TdsTypes/TdsCompareOptions.cs
+Mono.Data.TdsTypes/TdsDateTime.cs
+Mono.Data.TdsTypes/TdsDecimal.cs
+Mono.Data.TdsTypes/TdsDouble.cs
+Mono.Data.TdsTypes/TdsGuid.cs
+Mono.Data.TdsTypes/TdsInt16.cs
+Mono.Data.TdsTypes/TdsInt32.cs
+Mono.Data.TdsTypes/TdsInt64.cs
+Mono.Data.TdsTypes/TdsMoney.cs
+Mono.Data.TdsTypes/TdsNullValueException.cs
+Mono.Data.TdsTypes/TdsSingle.cs
+Mono.Data.TdsTypes/TdsString.cs
+Mono.Data.TdsTypes/TdsTruncateException.cs
+Mono.Data.TdsTypes/TdsTypeException.cs
+Mono.Data.TdsTypes/TODOAttribute.cs
diff --git a/mcs/class/Mono.Data.TdsClient/makefile.gnu b/mcs/class/Mono.Data.TdsClient/makefile.gnu
new file mode 100644
index 00000000000..60c8e05726b
--- /dev/null
+++ b/mcs/class/Mono.Data.TdsClient/makefile.gnu
@@ -0,0 +1,15 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.TdsClient.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.Data -r Mono.Data.Tds -r System.EnterpriseServices
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ ./System.Xml*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data/DataTools.cs b/mcs/class/Mono.Data/DataTools.cs
new file mode 100755
index 00000000000..713ba118c5d
--- /dev/null
+++ b/mcs/class/Mono.Data/DataTools.cs
@@ -0,0 +1,85 @@
+//
+// Mono.Data.DataTools
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+//
+using System;
+using System.Data;
+
+namespace Mono.Data
+{
+ /// <summary>
+ /// Summary description for ProviderTools.
+ /// </summary>
+ public class DataTools
+ {
+ public DataTools()
+ {
+ }
+
+ static public IDataParameter AddParameter(IDbCommand Cmd, string ParameterName, DbType DbType,
+ ParameterDirection Direction)
+ {
+ IDataParameter param=Cmd.CreateParameter();
+ Cmd.Parameters.Add(param);
+ param.ParameterName=ParameterName;
+ param.Direction=Direction;
+ param.DbType=DbType;
+ return param;
+ }
+
+ static public IDataParameter AddParameter(IDbCommand Cmd, string ParameterName, DbType DbType)
+ {
+ IDataParameter param=Cmd.CreateParameter();
+ Cmd.Parameters.Add(param);
+ param.ParameterName=ParameterName;
+ param.DbType=DbType;
+ return param;
+ }
+
+ static public DataSet FillDataSet(IDbConnection conn, string SelectCommand)
+ {
+ DataSet ds=new DataSet();
+ IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(conn, SelectCommand);
+ if (conn.State!=ConnectionState.Open)
+ conn.Open();
+ adapter.Fill(ds);
+ return ds;
+ }
+
+ static public DataSet FillDataSet(IDbCommand SelectCommand)
+ {
+ DataSet ds=new DataSet();
+ IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(SelectCommand);
+ if (adapter.SelectCommand.Connection.State!=ConnectionState.Open)
+ adapter.SelectCommand.Connection.Open();
+ adapter.Fill(ds);
+ return ds;
+ }
+
+ static public DataSet FillDataSet(string ConfigSetting, string SelectCommand)
+ {
+ IDbConnection conn=ProviderFactory.CreateConnectionFromConfig(ConfigSetting);
+ conn.Open();
+ DataSet ds=null;
+ try
+ {
+ ds=new DataSet();
+ IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(SelectCommand);
+ adapter.Fill(ds);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ return ds;
+ }
+
+
+ }
+}
diff --git a/mcs/class/Mono.Data/Mono.Data.build b/mcs/class/Mono.Data/Mono.Data.build
new file mode 100644
index 00000000000..5e901a954c7
--- /dev/null
+++ b/mcs/class/Mono.Data/Mono.Data.build
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.dll -->
+
+<project name="Mono.Data" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Data.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.Data.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data/Provider.cs b/mcs/class/Mono.Data/Provider.cs
new file mode 100755
index 00000000000..978a0197103
--- /dev/null
+++ b/mcs/class/Mono.Data/Provider.cs
@@ -0,0 +1,115 @@
+//
+// Mono.Data.Provider
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+//
+using System;
+using System.Data;
+using System.Reflection;
+
+namespace Mono.Data
+{
+ public class Provider
+ {
+ private string name = null;
+ private string connectionTypeName;
+ private string adapterTypeName;
+ private string commandTypeName;
+ private Type connectionType;
+ private Type adapterType;
+ private Type commandType;
+ private string assemblyName;
+ private string description;
+
+ public Provider(string _name, string _connection,
+ string _dataadapter, string _command, string _assembly,
+ string _description)
+ {
+ name = _name;
+ connectionTypeName = _connection;
+ adapterTypeName = _dataadapter;
+ assemblyName = _assembly;
+ commandTypeName = _command;
+ description = _description;
+ }
+
+ public Provider(string _name, Type _connection, Type _dataadapter, Type _command,
+ string _description)
+ {
+ name = _name;
+ connectionTypeName = _connection.FullName;
+ adapterTypeName = _dataadapter.FullName;
+ commandTypeName = _command.FullName;
+ connectionType = _connection;
+ adapterType = _dataadapter;
+ commandType = _command;
+ description = _description;
+ }
+
+ public string Name
+ {
+ get {return name;}
+ }
+
+ public string Description
+ {
+ get {return description;}
+ }
+
+ public Type ConnectionType
+ {
+ get
+ {
+ if (connectionType==null)
+ {
+ connectionType=Type.GetType(connectionTypeName+","+assemblyName);
+ }
+ return connectionType;
+ }
+ }
+
+ public Type DataAdapterType
+ {
+ get
+ {
+ if (adapterType==null)
+ {
+ adapterType=Type.GetType(adapterTypeName+","+assemblyName);
+ }
+ return adapterType;
+ }
+ }
+
+ public Type CommandType
+ {
+ get
+ {
+ if (commandType==null)
+ {
+ commandType=Type.GetType(commandTypeName+","+assemblyName);
+ }
+ return commandType;
+ }
+ }
+
+ public IDbConnection CreateConnection()
+ {
+ return (IDbConnection) Activator.CreateInstance(ConnectionType);
+ }
+
+ public IDbDataAdapter CreateDataAdapter()
+ {
+ return (IDbDataAdapter) Activator.CreateInstance(DataAdapterType);
+ }
+
+ public IDbCommand CreateCommand()
+ {
+ return (IDbCommand) Activator.CreateInstance(CommandType);
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data/ProviderCollection.cs b/mcs/class/Mono.Data/ProviderCollection.cs
new file mode 100755
index 00000000000..154b9d71b18
--- /dev/null
+++ b/mcs/class/Mono.Data/ProviderCollection.cs
@@ -0,0 +1,271 @@
+//
+// Mono.Data.ProviderCollection
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+//
+namespace Mono.Data
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Specialized;
+
+
+ /// <summary>
+ /// <para>
+ /// A collection that stores <see cref='.Provider'/> objects.
+ /// </para>
+ /// </summary>
+ /// <seealso cref='.ProviderCollection'/>
+ [Serializable()]
+ public class ProviderCollection : DictionaryBase
+ {
+
+ /// <summary>
+ /// <para>
+ /// Initializes a new instance of <see cref='.ProviderCollection'/>.
+ /// </para>
+ /// </summary>
+ public ProviderCollection()
+ {
+ }
+
+ /// <summary>
+ /// <para>
+ /// Initializes a new instance of <see cref='.ProviderCollection'/> based on another <see cref='.ProviderCollection'/>.
+ /// </para>
+ /// </summary>
+ /// <param name='value'>
+ /// A <see cref='.ProviderCollection'/> from which the contents are copied
+ /// </param>
+ public ProviderCollection(ProviderCollection value)
+ {
+ this.AddRange(value);
+ }
+
+ /// <summary>
+ /// <para>
+ /// Initializes a new instance of <see cref='.ProviderCollection'/> containing any array of <see cref='.Provider'/> objects.
+ /// </para>
+ /// </summary>
+ /// <param name='value'>
+ /// A array of <see cref='.Provider'/> objects with which to intialize the collection
+ /// </param>
+ public ProviderCollection(Provider[] value)
+ {
+ this.AddRange(value);
+ }
+
+ /// <summary>
+ /// <para>Represents the entry at the specified index of the <see cref='.Provider'/>.</para>
+ /// </summary>
+ /// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
+ /// <value>
+ /// <para> The entry at the specified index of the collection.</para>
+ /// </value>
+ /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
+ public Provider this[string Name]
+ {
+ get
+ {
+ return ((Provider)(Dictionary[Name]));
+ }
+ set
+ {
+ Dictionary[Name] = value;
+ }
+ }
+
+ public Provider FindByCommandType(Type CommandType)
+ {
+ foreach (Provider p in this)
+ {
+ if (p.CommandType==CommandType)
+ return p;
+ }
+ throw new IndexOutOfRangeException();
+ }
+
+ public Provider FindByDataAdapterType(Type DataAdapterType)
+ {
+ foreach (Provider p in this)
+ {
+ if (p.DataAdapterType==DataAdapterType)
+ return p;
+ }
+ throw new IndexOutOfRangeException();
+ }
+
+ public Provider FindByConnectionType(Type ConnectionType)
+ {
+ foreach (Provider p in this)
+ {
+ if (p.ConnectionType==ConnectionType)
+ return p;
+ }
+ throw new IndexOutOfRangeException();
+ }
+
+ /// <summary>
+ /// <para>Adds a <see cref='.Provider'/> with the specified value to the
+ /// <see cref='.ProviderCollection'/> .</para>
+ /// </summary>
+ /// <param name='value'>The <see cref='.Provider'/> to add.</param>
+ /// <returns>
+ /// <para>The index at which the new element was inserted.</para>
+ /// </returns>
+ /// <seealso cref='.ProviderCollection.AddRange'/>
+ public void Add(Provider value)
+ {
+ Dictionary.Add(value.Name, value);
+ }
+
+ /// <summary>
+ /// <para>Copies the elements of an array to the end of the <see cref='.ProviderCollection'/>.</para>
+ /// </summary>
+ /// <param name='value'>
+ /// An array of type <see cref='.Provider'/> containing the objects to add to the collection.
+ /// </param>
+ /// <returns>
+ /// <para>None.</para>
+ /// </returns>
+ /// <seealso cref='.ProviderCollection.Add'/>
+ public void AddRange(Provider[] value)
+ {
+ for (int i = 0; (i < value.Length); i = (i + 1))
+ {
+ this.Add(value[i]);
+ }
+ }
+
+ /// <summary>
+ /// <para>
+ /// Adds the contents of another <see cref='.ProviderCollection'/> to the end of the collection.
+ /// </para>
+ /// </summary>
+ /// <param name='value'>
+ /// A <see cref='.ProviderCollection'/> containing the objects to add to the collection.
+ /// </param>
+ /// <returns>
+ /// <para>None.</para>
+ /// </returns>
+ /// <seealso cref='.ProviderCollection.Add'/>
+ public void AddRange(ProviderCollection value)
+ {
+ foreach (Provider p in value)
+ {
+ this.Add(p);
+ }
+ }
+
+ /// <summary>
+ /// <para>Gets a value indicating whether the
+ /// <see cref='.ProviderCollection'/> contains the specified <see cref='.Provider'/>.</para>
+ /// </summary>
+ /// <param name='value'>The <see cref='.Provider'/> to locate.</param>
+ /// <returns>
+ /// <para><see langword='true'/> if the <see cref='.Provider'/> is contained in the collection;
+ /// otherwise, <see langword='false'/>.</para>
+ /// </returns>
+ /// <seealso cref='.ProviderCollection.IndexOf'/>
+ public bool Contains(Provider value)
+ {
+ return Dictionary.Contains(value);
+ }
+
+ /// <summary>
+ /// <para>Copies the <see cref='.ProviderCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
+ /// specified index.</para>
+ /// </summary>
+ /// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='.ProviderCollection'/> .</para></param>
+ /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
+ /// <returns>
+ /// <para>None.</para>
+ /// </returns>
+ /// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='.ProviderCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
+ /// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
+ /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
+ /// <seealso cref='System.Array'/>
+ public void CopyTo(Provider[] array, int index)
+ {
+ Dictionary.CopyTo(array, index);
+ }
+
+ /// <summary>
+ /// <para>Returns an enumerator that can iterate through
+ /// the <see cref='.ProviderCollection'/> .</para>
+ /// </summary>
+ /// <returns><para>None.</para></returns>
+ /// <seealso cref='System.Collections.IEnumerator'/>
+ public new ProviderEnumerator GetEnumerator()
+ {
+ return new ProviderEnumerator(this);
+ }
+
+ /// <summary>
+ /// <para> Removes a specific <see cref='.Provider'/> from the
+ /// <see cref='.ProviderCollection'/> .</para>
+ /// </summary>
+ /// <param name='value'>The <see cref='.Provider'/> to remove from the <see cref='.ProviderCollection'/> .</param>
+ /// <returns><para>None.</para></returns>
+ /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
+ public void Remove(Provider value)
+ {
+ Dictionary.Remove(value);
+ }
+
+ public class ProviderEnumerator : object, IEnumerator
+ {
+
+ private IEnumerator baseEnumerator;
+
+ private IEnumerable temp;
+
+ public ProviderEnumerator(ProviderCollection mappings)
+ {
+ this.temp = ((IEnumerable)(mappings));
+ this.baseEnumerator = temp.GetEnumerator();
+ }
+
+ public Provider Current
+ {
+ get
+ {
+ return ((Provider) ((DictionaryEntry) (baseEnumerator.Current)).Value);
+ }
+ }
+
+ object IEnumerator.Current
+ {
+ get
+ {
+ return baseEnumerator.Current;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ return baseEnumerator.MoveNext();
+ }
+
+ bool IEnumerator.MoveNext()
+ {
+ return baseEnumerator.MoveNext();
+ }
+
+ public void Reset()
+ {
+ baseEnumerator.Reset();
+ }
+
+ void IEnumerator.Reset()
+ {
+ baseEnumerator.Reset();
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data/ProviderFactory.cs b/mcs/class/Mono.Data/ProviderFactory.cs
new file mode 100755
index 00000000000..827f5fe26eb
--- /dev/null
+++ b/mcs/class/Mono.Data/ProviderFactory.cs
@@ -0,0 +1,112 @@
+//
+// Mono.Data.ProviderFactory
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+//
+using System;
+using System.Data;
+using System.Reflection;
+using System.Runtime.Remoting;
+using System.Configuration;
+using System.Xml;
+using System.Collections.Specialized;
+
+namespace Mono.Data
+{
+ public class ProviderFactory
+ {
+ private static ProviderCollection providers;
+
+ static ProviderFactory()
+ {
+ providers=(ProviderCollection) ConfigurationSettings.GetConfig("mono.data/providers");
+ if (providers==null)
+ providers=new ProviderCollection();
+ }
+
+ static public ProviderCollection Providers
+ {
+ get
+ {
+ return providers;
+ }
+ }
+
+ static public IDbConnection CreateConnectionFromConfig(string Setting)
+ {
+ return CreateConnection(ConfigurationSettings.AppSettings[Setting]);
+ }
+
+ static public IDbConnection CreateConnection(string ConnectionString)
+ {
+ string[] ConnectionAttributes=ConnectionString.Split(new Char[1] { ';' });
+ string ProviderName=null;
+ string NewConnectionString="";
+ foreach (string s in ConnectionAttributes)
+ {
+ string[] AttributeParts=s.Split(new Char[1] { '=' });
+ if (AttributeParts[0].ToLower().Trim()=="factory")
+ ProviderName=AttributeParts[1].Trim();
+ else
+ NewConnectionString+=";"+s;
+ }
+ NewConnectionString=NewConnectionString.Remove(0,1);
+ return CreateConnection(ProviderName, NewConnectionString);
+ }
+
+ static public IDbConnection CreateConnection(string ProviderName, string ConnectionString)
+ {
+ Provider provider=providers[ProviderName];
+ IDbConnection conn=provider.CreateConnection();
+ conn.ConnectionString=ConnectionString;
+ return conn;
+ }
+
+ static public IDbCommand CreateStoredProc(IDbConnection Conn, string CommandName)
+ {
+ IDbCommand cmd=Conn.CreateCommand();
+ cmd.CommandText=CommandName;
+ cmd.CommandType=CommandType.StoredProcedure;
+ return cmd;
+ }
+
+ static public IDbDataAdapter CreateDataAdapter(IDbCommand SelectCommand)
+ {
+ Provider provider=providers.FindByCommandType(SelectCommand.GetType());
+ IDbDataAdapter adapter=provider.CreateDataAdapter();
+ adapter.SelectCommand=SelectCommand;
+ return adapter;
+ }
+
+ static public IDbDataAdapter CreateDataAdapter(string ProviderName)
+ {
+ Provider provider=providers[ProviderName];
+ IDbDataAdapter adapter=provider.CreateDataAdapter();
+ return adapter;
+ }
+
+ static public IDbDataAdapter CreateDataAdapter(IDbConnection Conn, string SelectCommand)
+ {
+ IDbCommand cmd=Conn.CreateCommand();
+ cmd.CommandText=SelectCommand;
+ return CreateDataAdapter(cmd);
+ }
+
+ static public IDbCommand CreateCommand(string ProviderName)
+ {
+ Provider provider=providers[ProviderName];
+ return provider.CreateCommand();
+ }
+
+ static public IDbCommand CreateCommand(IDbConnection Conn)
+ {
+ return Conn.CreateCommand();
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data/ProviderSectionHandler.cs b/mcs/class/Mono.Data/ProviderSectionHandler.cs
new file mode 100755
index 00000000000..bc4a874d81d
--- /dev/null
+++ b/mcs/class/Mono.Data/ProviderSectionHandler.cs
@@ -0,0 +1,49 @@
+//
+// Mono.Data.ProviderSectionHandler
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+//
+using System;
+using System.Xml;
+using System.Configuration;
+
+namespace Mono.Data
+{
+ public class ProviderSectionHandler : IConfigurationSectionHandler
+ {
+ public virtual object Create(object parent,object configContext,XmlNode section)
+ {
+ ProviderCollection providers=new ProviderCollection();
+ foreach (XmlElement ProviderNode in section.ChildNodes)
+ {
+ Provider provider=new Provider(
+ GetStringValue(ProviderNode,"name",true),
+ GetStringValue(ProviderNode,"connection",true),
+ GetStringValue(ProviderNode,"adapter",true),
+ GetStringValue(ProviderNode,"command",true),
+ GetStringValue(ProviderNode,"assembly",true),
+ GetStringValue(ProviderNode,"description",false));
+ providers.Add(provider);
+ }
+ return providers;
+ }
+
+ private string GetStringValue(XmlNode _node, string _attribute, bool required)
+ {
+ XmlNode a = _node.Attributes.RemoveNamedItem(_attribute);
+ if(a==null)
+ {
+ if (required)
+ throw new ConfigurationException("Attribute required: " + _attribute);
+ else
+ return null;
+ }
+ return a.Value;
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data/app.config b/mcs/class/Mono.Data/app.config
new file mode 100755
index 00000000000..29f0ab57946
--- /dev/null
+++ b/mcs/class/Mono.Data/app.config
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="mono.data">
+ <section name="providers" type="Mono.Data.ProviderSectionHandler,Mono.Data" />
+ </sectionGroup>
+ </configSections>
+ <appSettings>
+ <add key="PubsConnStr" value="factory=System.Data.SqlClient;server=speedy;database=pubs;uid=sa;pwd=" />
+ </appSettings>
+ <mono.data>
+ <providers>
+ <provider
+ name="System.Data.SqlClient"
+ connection="System.Data.SqlClient.SqlConnection"
+ adapter="System.Data.SqlClient.SqlDataAdapter"
+ command="System.Data.SqlClient.SqlCommand"
+ assembly="System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ description="Microsoft SQL Server 7.0/2000" />
+ <provider
+ name="System.Data.OleDb"
+ connection="System.Data.OleDb.OleDbConnection"
+ adapter="System.Data.OleDb.OleDbDataAdapter"
+ command="System.Data.OleDb.OleDbCommand"
+ assembly="System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ description="OLE DB" />
+ <provider
+ name="System.Data.Odbc"
+ connection="System.Data.Odbc.OdbcConnection"
+ adapter="System.Data.Odbc.OdbcDataAdapter"
+ command="System.Data.Odbc.OdbcCommand"
+ assembly="odbc"
+ description="ODBC" />
+ <provider
+ name="Mono.Data.TdsClient"
+ connection="Mono.Data.TdsClient.TdsConnection"
+ adapter="Mono.Data.TdsClient.TdsDataAdapter"
+ command="Mono.Data.TdsClient.TdsCommand"
+ assembly="Mono.Data.TdsClient"
+ description="TDS Generic" />
+ <provider name="Mono.Data.MySql"
+ connection="Mono.Data.MySql.MySqlConnection"
+ adapter="Mono.Data.MySql.MySqlDataAdapter"
+ command="Mono.Data.MySql.MySqlCommand"
+ assembly="Mono.Data.MySql"
+ description="MySQL" />
+ <provider
+ name="Mono.Data.PostgreSqlClient"
+ connection="Mono.Data.PostgreSqlClient.PgSqlConnection"
+ adapter="Mono.Data.PostgreSqlClient.PgSqlDataAdapter"
+ command="Mono.Data.PostgreSqlClient.PgSqlCommand"
+ assembly="Mono.Data.PostgreSqlClient"
+ description="PostgreSQL" />
+ <provider
+ name="Mono.Data.SqliteClient"
+ connection="Mono.Data.SqliteClient.SqliteConnection"
+ adapter="Mono.Data.SqliteClient.SqliteDataAdapter"
+ command="Mono.Data.SqliteClient.SqliteCommand"
+ assembly="Mono.Data.SqliteClient"
+ description="SQL Lite" />
+ <provider
+ name="Mono.Data.SybaseClient"
+ connection="Mono.Data.SybaseClient.SybaseConnection"
+ adapter="Mono.Data.SybaseClient.SybaseDataAdapter"
+ command="Mono.Data.SybaseClient.SybaseCommand"
+ assembly="Mono.Data.SybaseClient"
+ description="Sybase" />
+ </providers>
+ </mono.data>
+</configuration>
diff --git a/mcs/class/Mono.Data/library-deps.stamp b/mcs/class/Mono.Data/library-deps.stamp
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/Mono.Data/library-deps.stamp
diff --git a/mcs/class/Mono.Data/list b/mcs/class/Mono.Data/list
new file mode 100644
index 00000000000..89223d97953
--- /dev/null
+++ b/mcs/class/Mono.Data/list
@@ -0,0 +1,5 @@
+Provider.cs
+ProviderCollection.cs
+ProviderFactory.cs
+ProviderSectionHandler.cs
+ProviderTools.cS
diff --git a/mcs/class/Mono.Data/makefile.gnu b/mcs/class/Mono.Data/makefile.gnu
new file mode 100755
index 00000000000..03ded5b915b
--- /dev/null
+++ b/mcs/class/Mono.Data/makefile.gnu
@@ -0,0 +1,14 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.Data.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.Data
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.Data/test/Mono.Data.dll b/mcs/class/Mono.Data/test/Mono.Data.dll
new file mode 100755
index 00000000000..159446b383a
--- /dev/null
+++ b/mcs/class/Mono.Data/test/Mono.Data.dll
Binary files differ
diff --git a/mcs/class/Mono.Data/test/test.build b/mcs/class/Mono.Data/test/test.build
new file mode 100644
index 00000000000..2fb4e15ce95
--- /dev/null
+++ b/mcs/class/Mono.Data/test/test.build
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Data.dll -->
+
+<project name="Mono.Data" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="exe" output="test.exe" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <arg value="/r:../../lib/Mono.Data.dll" />
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ <references>
+ <includes name="../../lib/corlib.dll"/>
+ <includes name="../../lib/System.dll"/>
+ <includes name="../../lib/System.Xml.dll"/>
+ <includes name="../../lib/System.Data.dll"/>
+ <includes name="../../lib/Mono.Data.dll" />
+ </references>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="test.exe" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Data/test/test.cs b/mcs/class/Mono.Data/test/test.cs
new file mode 100755
index 00000000000..eb1ef289c95
--- /dev/null
+++ b/mcs/class/Mono.Data/test/test.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using Mono.Data;
+
+namespace testclient
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+
+ public static void TestProviderFactory()
+ {
+ Console.WriteLine("Configured Providers:");
+ foreach (Provider p in ProviderFactory.Providers)
+ Console.WriteLine(p.Description);
+ Console.WriteLine();
+ Console.WriteLine("Connection Factory Test:");
+ Console.WriteLine("Get Connection using PubsConnStr in app.config");
+ IDbConnection conn=ProviderFactory.CreateConnectionFromConfig("PubsConnStr");
+ Console.WriteLine("Open Connection");
+ conn.Open();
+ IDbCommand cmd=conn.CreateCommand();
+ cmd.CommandText="select * from authors";
+ IDataReader reader=cmd.ExecuteReader();
+ reader.Read();
+ Console.WriteLine(reader[0].ToString());
+ Console.ReadLine();
+ }
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ TestProviderFactory();
+
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data/test/test.exe b/mcs/class/Mono.Data/test/test.exe
new file mode 100755
index 00000000000..fe3af67bd99
--- /dev/null
+++ b/mcs/class/Mono.Data/test/test.exe
Binary files differ
diff --git a/mcs/class/Mono.Data/test/test.exe.config b/mcs/class/Mono.Data/test/test.exe.config
new file mode 100755
index 00000000000..29f0ab57946
--- /dev/null
+++ b/mcs/class/Mono.Data/test/test.exe.config
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="mono.data">
+ <section name="providers" type="Mono.Data.ProviderSectionHandler,Mono.Data" />
+ </sectionGroup>
+ </configSections>
+ <appSettings>
+ <add key="PubsConnStr" value="factory=System.Data.SqlClient;server=speedy;database=pubs;uid=sa;pwd=" />
+ </appSettings>
+ <mono.data>
+ <providers>
+ <provider
+ name="System.Data.SqlClient"
+ connection="System.Data.SqlClient.SqlConnection"
+ adapter="System.Data.SqlClient.SqlDataAdapter"
+ command="System.Data.SqlClient.SqlCommand"
+ assembly="System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ description="Microsoft SQL Server 7.0/2000" />
+ <provider
+ name="System.Data.OleDb"
+ connection="System.Data.OleDb.OleDbConnection"
+ adapter="System.Data.OleDb.OleDbDataAdapter"
+ command="System.Data.OleDb.OleDbCommand"
+ assembly="System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ description="OLE DB" />
+ <provider
+ name="System.Data.Odbc"
+ connection="System.Data.Odbc.OdbcConnection"
+ adapter="System.Data.Odbc.OdbcDataAdapter"
+ command="System.Data.Odbc.OdbcCommand"
+ assembly="odbc"
+ description="ODBC" />
+ <provider
+ name="Mono.Data.TdsClient"
+ connection="Mono.Data.TdsClient.TdsConnection"
+ adapter="Mono.Data.TdsClient.TdsDataAdapter"
+ command="Mono.Data.TdsClient.TdsCommand"
+ assembly="Mono.Data.TdsClient"
+ description="TDS Generic" />
+ <provider name="Mono.Data.MySql"
+ connection="Mono.Data.MySql.MySqlConnection"
+ adapter="Mono.Data.MySql.MySqlDataAdapter"
+ command="Mono.Data.MySql.MySqlCommand"
+ assembly="Mono.Data.MySql"
+ description="MySQL" />
+ <provider
+ name="Mono.Data.PostgreSqlClient"
+ connection="Mono.Data.PostgreSqlClient.PgSqlConnection"
+ adapter="Mono.Data.PostgreSqlClient.PgSqlDataAdapter"
+ command="Mono.Data.PostgreSqlClient.PgSqlCommand"
+ assembly="Mono.Data.PostgreSqlClient"
+ description="PostgreSQL" />
+ <provider
+ name="Mono.Data.SqliteClient"
+ connection="Mono.Data.SqliteClient.SqliteConnection"
+ adapter="Mono.Data.SqliteClient.SqliteDataAdapter"
+ command="Mono.Data.SqliteClient.SqliteCommand"
+ assembly="Mono.Data.SqliteClient"
+ description="SQL Lite" />
+ <provider
+ name="Mono.Data.SybaseClient"
+ connection="Mono.Data.SybaseClient.SybaseConnection"
+ adapter="Mono.Data.SybaseClient.SybaseDataAdapter"
+ command="Mono.Data.SybaseClient.SybaseCommand"
+ assembly="Mono.Data.SybaseClient"
+ description="Sybase" />
+ </providers>
+ </mono.data>
+</configuration>
diff --git a/mcs/class/Mono.Directory.LDAP/ChangeLog b/mcs/class/Mono.Directory.LDAP/ChangeLog
new file mode 100644
index 00000000000..119a5f75b04
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/ChangeLog
@@ -0,0 +1,7 @@
+2002-12-11 Jeroen Janssen <japj@darius.demon.nl>
+
+ * add reference to corlib.dll in order to eliminate [MonoTODO] build error
+
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * added Mono.Directory.LDAP.build file \ No newline at end of file
diff --git a/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP.build b/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP.build
new file mode 100644
index 00000000000..38ea0f2e9fc
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP.build
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.Directory.LDAP.dll -->
+
+<project name="Mono.Directory.LDAP" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.Directory.LDAP.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:corlib.dll"/>
+
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.Directory.LDAP.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAP.cs b/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAP.cs
new file mode 100644
index 00000000000..4fe55f52c57
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAP.cs
@@ -0,0 +1,141 @@
+//
+// Mono.Directory.LDAP.LDAP
+//
+// Author:
+// Chris Toshok (toshok@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+// Just enough (for now) LDAP support to get System.DirectoryServices
+// working.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Mono.Directory.LDAP
+{
+ class TimeVal {
+ public int tv_sec;
+ public int tv_usec;
+
+ public static TimeVal FromTimeSpan (TimeSpan span) {
+ TimeVal tv = new TimeVal();
+ long nanoseconds;
+
+ /* make sure we're dealing with a positive TimeSpan */
+ span = span.Duration();
+
+ nanoseconds = span.Ticks * 100;
+
+ tv.tv_sec = (int)(nanoseconds / 1E+09);
+ tv.tv_usec = (int)((nanoseconds % 1E+09) / 1000);
+
+ return tv;
+ }
+ }
+
+ public enum SearchScope {
+ Base = 0x0000,
+ OneLevel = 0x0001,
+ SubTree = 0x0002
+ }
+
+ public class LDAP {
+
+ /* Search Scopes */
+ public LDAP (string uri) {
+ int rv;
+ rv = ldap_initialize (out ld, uri);
+ // FIXME throw something here if ldap_initialize returns an error
+ }
+
+ public LDAP (string host, int port) {
+ ld = ldap_init (host, port);
+ // FIXME throw something here if ldap_init fails.
+ }
+
+ public int BindSimple (string who, string cred) {
+ return ldap_simple_bind_s (ld, who, cred);
+ }
+
+ public int StartTLS () {
+ // FIXME should expose client/server ctrls
+ return ldap_start_tls_s (ld, (IntPtr)null, (IntPtr)null);
+ }
+
+ public int Search (string base_entry,
+ SearchScope scope,
+ string filter,
+ string[] attrs,
+ bool attrsonly,
+ TimeSpan timeOut,
+ int sizeLimit,
+ out LDAPMessage res) {
+ // FIXME should expose client/server ctrls
+ IntPtr serverctrls = new IntPtr();
+ IntPtr clientctrls = new IntPtr();
+ TimeVal tv = TimeVal.FromTimeSpan (timeOut);
+ IntPtr native_res;
+ int rv;
+
+ rv = ldap_search_ext_s (ld, base_entry, (int) scope, filter,
+ attrs, attrsonly ? 1 : 0,
+ serverctrls, clientctrls,
+ ref tv, sizeLimit, out native_res);
+
+ if (native_res != IntPtr.Zero)
+ res = new LDAPMessage (this, native_res);
+ else
+ res = null;
+
+ return rv;
+ }
+
+
+ public void Unbind () {
+ // FIXME should expose client/server ctrls
+ ldap_unbind_ext_s (ld, (IntPtr)null, (IntPtr)null);
+ // FIXME throw something here if ldap_unbind_ext_s returns an error
+ }
+
+ public IntPtr NativeLDAP {
+ get { return ld; }
+ }
+
+ [DllImport("ldap")]
+ static extern IntPtr ldap_init(string host, int port);
+
+ [DllImport("ldap")]
+ static extern int ldap_initialize(out IntPtr ld, string uri);
+
+ [DllImport("ldap")]
+ static extern int ldap_simple_bind_s(IntPtr ld,
+ string who, string cred);
+
+ [DllImport("ldap")]
+ static extern int ldap_start_tls_s (IntPtr ld,
+ IntPtr serverctrls,
+ IntPtr clientctrls);
+
+ [DllImport("ldap")]
+ static extern int ldap_search_ext_s (IntPtr ld,
+ string base_entry,
+ int scope,
+ string filter,
+ string[] attrs,
+ int attrsonly,
+ IntPtr serverctrls,
+ IntPtr clientctrls,
+ ref TimeVal timeout,
+ int sizelimit,
+ out IntPtr res);
+
+ [DllImport("ldap")]
+ static extern int ldap_unbind_ext_s (IntPtr ld,
+ IntPtr serverctrls,
+ IntPtr clientctrls);
+
+ IntPtr ld;
+ }
+}
diff --git a/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAPMessage.cs b/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAPMessage.cs
new file mode 100644
index 00000000000..8e99c4102e4
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Mono.Directory.LDAP/LDAPMessage.cs
@@ -0,0 +1,134 @@
+//
+// Mono.Directory.LDAP.LDAPMessage
+//
+// Author:
+// Chris Toshok (toshok@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+// Just enough (for now) LDAP support to get System.DirectoryServices
+// working.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Mono.Directory.LDAP
+{
+ public class LDAPMessage {
+
+ internal LDAPMessage(LDAP ld, IntPtr ldm) {
+ this.ld = ld;
+ this.ldm = ldm;
+ }
+
+ public LDAPMessage FirstMessage () {
+ IntPtr nm = ldap_first_message (ld.NativeLDAP ,ldm);
+
+ if (nm == IntPtr.Zero)
+ return null;
+ else
+ return new LDAPMessage (ld, nm);
+ }
+
+ public LDAPMessage NextMessage () {
+ IntPtr nm = ldap_next_message (ld.NativeLDAP ,ldm);
+
+ if (nm == IntPtr.Zero)
+ return null;
+ else
+ return new LDAPMessage (ld, nm);
+ }
+
+ public int CountMessages () {
+ return ldap_count_messages (ld.NativeLDAP, ldm);
+ }
+
+ public LDAPMessage FirstEntry() {
+ IntPtr nm = ldap_first_entry (ld.NativeLDAP ,ldm);
+
+ if (nm == IntPtr.Zero)
+ return null;
+ else
+ return new LDAPMessage (ld, nm);
+ }
+
+ public LDAPMessage NextEntry() {
+ IntPtr nm = ldap_next_entry (ld.NativeLDAP ,ldm);
+
+ if (nm == IntPtr.Zero)
+ return null;
+ else
+ return new LDAPMessage (ld, nm);
+ }
+
+ public int CountEntries() {
+ return ldap_count_entries (ld.NativeLDAP, ldm);
+ }
+
+ public string DN {
+ get { return ldap_get_dn (ld.NativeLDAP, ldm); }
+ }
+
+ [MonoTODO]
+ public string[] GetValues (string target) {
+ throw new NotImplementedException ();
+ /*
+ string[] ldap_values;
+
+ Console.WriteLine ("calling ldap_get_values ({0})", target);
+
+ ldap_values = ldap_get_values (ld.NativeLDAP, ldm, target);
+
+ if (ldap_values != null) {
+ string[] rv;
+ int i;
+
+ rv = new string[ldap_values.Length - 1];
+ for (i = 0; i < ldap_values.Length - 1; i ++)
+ rv[i] = ldap_values[i];
+
+ return rv;
+ }
+ else {
+ return null;
+ }
+ */
+ }
+
+ [DllImport("ldap")]
+ extern static string ldap_get_dn (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static IntPtr ldap_first_message (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static IntPtr ldap_next_message (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static int ldap_count_messages (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static IntPtr ldap_first_entry (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static IntPtr ldap_next_entry (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static int ldap_count_entries (IntPtr ld, IntPtr ldm);
+
+ [DllImport("ldap")]
+ extern static string ldap_first_attribute (IntPtr ld, IntPtr ldm, out IntPtr ber);
+
+ [DllImport("ldap")]
+ extern static string ldap_next_attribute (IntPtr ld, IntPtr ldm, IntPtr ber);
+
+ /*
+ [DllImport("ldapglue")]
+ extern static void ldapsharp_get_values (IntPtr ld, IntPtr ldm, string target,
+ out string[] values, out int count);
+ */
+ IntPtr ldm;
+ LDAP ld;
+ }
+}
diff --git a/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/AllTests.cs b/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/AllTests.cs
new file mode 100644
index 00000000000..678d57d296a
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/AllTests.cs
@@ -0,0 +1,30 @@
+//
+// MonoTests.System.DirectoryServices.AllTests, System.DirectoryServices.dll
+//
+// Author:
+// Chris Toshok <toshok@ximian.com>
+//
+
+using NUnit.Framework;
+using System;
+using MonoTests.Directory.LDAP;
+
+namespace MonoTests.Directory.LDAP {
+
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name)
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (BindSimpleTest.Suite);
+ suite.AddTest (QueryRootDSE.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/BindSimpleTest.cs b/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/BindSimpleTest.cs
new file mode 100644
index 00000000000..c184d668603
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/BindSimpleTest.cs
@@ -0,0 +1,43 @@
+
+using NUnit.Framework;
+using System;
+using Mono.Directory.LDAP;
+
+namespace MonoTests.Directory.LDAP
+{
+ public class BindSimpleTest : TestCase {
+ public BindSimpleTest () :
+ base ("[MonoTests.Directory.LDAP.BindSimpleTest]'") {}
+
+ public BindSimpleTest (string name) :
+ base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (BindSimpleTest));
+ }
+ }
+
+
+ public void TestStuff() {
+ string myLDAPPath = "ldap://ldap.toshok.org";
+ string username = "cn=Manager,dc=toshok,dc=org", passwd = "evotest";
+ try {
+ LDAP ld = new LDAP (myLDAPPath);
+
+ ld.BindSimple (username, passwd);
+
+ Console.WriteLine("Successfully bound {0} at {1}", username, myLDAPPath);
+ }
+ catch(Exception e) {
+ Console.WriteLine("The '" + myLDAPPath + "' path not found.");
+ Console.WriteLine("Exception : " + e.Message);
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/QueryRootDSE.cs b/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/QueryRootDSE.cs
new file mode 100644
index 00000000000..68b77163b8a
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Test/Mono.Directory.LDAP/QueryRootDSE.cs
@@ -0,0 +1,70 @@
+
+using NUnit.Framework;
+using System;
+using Mono.Directory.LDAP;
+
+namespace MonoTests.Directory.LDAP
+{
+ public class QueryRootDSE : TestCase {
+ public QueryRootDSE () :
+ base ("[MonoTests.Directory.LDAP.QueryRootDSE]'") {}
+
+ public QueryRootDSE (string name) :
+ base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (QueryRootDSE));
+ }
+ }
+
+
+ public void TestStuff() {
+ string myLDAPPath = "ldap://ldap.toshok.org";
+ try {
+ LDAP ld = new LDAP (myLDAPPath);
+ LDAPMessage res, entry;
+ string[] attrs = { "+", null };
+
+ /* don't bind, we do this anonymously */
+
+ ld.Search ("" /* root dse */,
+ SearchScope.Base,
+ "(objectclass=*)",
+ attrs, false,
+ TimeSpan.FromSeconds(10), 0 /* no size limit */,
+ out res);
+
+ if (res == null) {
+ Console.WriteLine ("the search failed");
+ }
+
+ Console.WriteLine ("There are {0} entries", res.CountEntries());
+
+ entry = res.FirstEntry();
+ if (entry == null)
+ Console.WriteLine ("null returned from res.FirstEntry");
+
+ string[] extensions = entry.GetValues ("supportedExtension");
+
+ if (extensions != null) {
+ foreach( String e in extensions )
+ Console.WriteLine ("Supported Extension: {0}\n", e);
+ }
+ else {
+ Console.WriteLine ("null returned from entry.GetValues\n");
+ }
+ }
+ catch(Exception e) {
+ Console.WriteLine("The '" + myLDAPPath + "' path not found.");
+ Console.WriteLine("Exception : " + e.Message);
+ Console.WriteLine(e.StackTrace);
+ }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Directory.LDAP/Test/NUnit.Prefs b/mcs/class/Mono.Directory.LDAP/Test/NUnit.Prefs
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Test/NUnit.Prefs
diff --git a/mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args b/mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args
new file mode 100644
index 00000000000..f6fbe0f7853
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args
@@ -0,0 +1,10 @@
+--target library
+-o dslib_linux_test.dll
+--noconfig
+-r ../../lib/Mono.Directory.LDAP.dll
+-r ../../lib/corlib.dll
+-r ../../lib/System.dll
+-r ../../../nunit/NUnitCore_mono.dll
+Mono.Directory.LDAP/BindSimpleTest.cs
+Mono.Directory.LDAP/QueryRootDSE.cs
+Mono.Directory.LDAP/AllTests.cs
diff --git a/mcs/class/Mono.Directory.LDAP/Test/makefile.gnu b/mcs/class/Mono.Directory.LDAP/Test/makefile.gnu
new file mode 100644
index 00000000000..943289f4cb7
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/Test/makefile.gnu
@@ -0,0 +1,23 @@
+topdir = ../../..
+
+LIBRARY = dslib_linux_test.dll
+
+LIB_LIST = dslib_linux_test.args
+LIB_FLAGS = -r ../../lib/Mono.Directory.LDAP.dll -r ../../lib/corlib.dll -r ../../lib/System.dll \
+ -r $(topdir)/nunit/src/NUnitCore/NUnitCore_mono.dll
+
+include ../../library.make
+
+MCS_FLAGS = --target library --noconfig
+
+TEST_SUITE_PREFIX = MonoTests.Directory.LDAP.
+TEST_SUITE = AllTests
+NUNITCONSOLE=$(topdir)/nunit/src/NUnitConsole/NUnitConsole_mono.exe
+NUNIT_MONO_PATH=$(topdir)/nunit/src/NUnitCore:.
+
+test: $(LIBRARY) run_test
+
+.PHONY: run_test
+
+run_test:
+ MONO_PATH=$(NUNIT_MONO_PATH) mono $(NUNITCONSOLE) $(TEST_SUITE_PREFIX)$(TEST_SUITE),dslib_linux_test.dll
diff --git a/mcs/class/Mono.Directory.LDAP/list b/mcs/class/Mono.Directory.LDAP/list
new file mode 100644
index 00000000000..fffdb42294d
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/list
@@ -0,0 +1,2 @@
+Mono.Directory.LDAP/LDAP.cs
+Mono.Directory.LDAP/LDAPMessage.cs
diff --git a/mcs/class/Mono.Directory.LDAP/makefile.gnu b/mcs/class/Mono.Directory.LDAP/makefile.gnu
new file mode 100644
index 00000000000..6ca9c4697dc
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/makefile.gnu
@@ -0,0 +1,14 @@
+topdir = ../..
+
+LIBRARY = ../lib/Mono.Directory.LDAP.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Data -r mscorlib
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test*
+
+export MONO_PATH_PREFIX = ../lib:
+
+include ../library.make
diff --git a/mcs/class/Mono.GetOptions/.cvsignore b/mcs/class/Mono.GetOptions/.cvsignore
new file mode 100644
index 00000000000..97274c3c4a6
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/.cvsignore
@@ -0,0 +1,4 @@
+*.pdb
+*.dll
+*.csproj.user
+
diff --git a/mcs/class/Mono.GetOptions/AboutAttribute.cs b/mcs/class/Mono.GetOptions/AboutAttribute.cs
new file mode 100644
index 00000000000..39f4b6b169c
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/AboutAttribute.cs
@@ -0,0 +1,29 @@
+//
+// AboutAttribute.cs
+//
+// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) 2002 Rafael Teixeira
+//
+
+
+using System;
+
+namespace Mono
+{
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public class AboutAttribute : System.Attribute
+ {
+ public string Details;
+
+ public AboutAttribute(string details)
+ {
+ Details = details;
+ }
+
+ public override string ToString()
+ {
+ return Details;
+ }
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs b/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs
new file mode 100644
index 00000000000..bbe235f7179
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Mono.GetOptions
+{
+
+ [AttributeUsage(AttributeTargets.Method)]
+ public class ArgumentProcessorAttribute : Attribute
+ {
+ public ArgumentProcessorAttribute() {}
+ }
+
+}
diff --git a/mcs/class/Mono.GetOptions/AssemblyInfo.cs b/mcs/class/Mono.GetOptions/AssemblyInfo.cs
new file mode 100644
index 00000000000..e8a5b7d3153
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/AssemblyInfo.cs
@@ -0,0 +1,59 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
+
diff --git a/mcs/class/Mono.GetOptions/AuthorAttribute.cs b/mcs/class/Mono.GetOptions/AuthorAttribute.cs
new file mode 100644
index 00000000000..3941b2ec34d
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/AuthorAttribute.cs
@@ -0,0 +1,38 @@
+//
+// AuthorAttribute.cs
+//
+// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) 2002 Rafael Teixeira
+//
+using System;
+
+namespace Mono
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
+ public class AuthorAttribute : System.Attribute
+ {
+ public string Name;
+ public string SubProject;
+
+ public AuthorAttribute(string name)
+ {
+ Name = name;
+ SubProject = null;
+ }
+
+ public AuthorAttribute(string name, string subProject)
+ {
+ Name = name;
+ SubProject = subProject;
+ }
+
+ public override string ToString()
+ {
+ if (SubProject == null)
+ return Name;
+ else
+ return Name + " (" + SubProject + ")";
+ }
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/ChangeLog b/mcs/class/Mono.GetOptions/ChangeLog
new file mode 100644
index 00000000000..f14487f7824
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/ChangeLog
@@ -0,0 +1,15 @@
+2003-01-20 Duncan Mak <duncan@ximian.com>
+
+ * list.unix: Remove the extra reference to ArgumentProcessorAttribute.cs
+
+2002-09-03 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+
+ * added AboutAttribute.cs, AuthorAttribute.cs, OptionAttribute.cs,
+ UsageComplementAttribute.cs, OptionDetails.cs, Options.cs.
+ Now reflection is used to drive de options processing.
+
+ * added GetOptTest test subproject
+
+2002-08-30 Juli Mallett <jmallett@FreeBSD.org>
+
+ * list.unix, makefile.gnu: Added build glue for UNIX.
diff --git a/mcs/class/Mono.GetOptions/GetOptTest/AssemblyInfo.cs b/mcs/class/Mono.GetOptions/GetOptTest/AssemblyInfo.cs
new file mode 100644
index 00000000000..2157ee7cb76
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/GetOptTest/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("GetOptTest")]
+[assembly: AssemblyDescription("Mono.GetOptions Test driver")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("(C) 2002 Rafael Teixeira")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: Mono.About("Distributed under the GPL")]
+
+[assembly: Mono.UsageComplement("some strings")]
+
+[assembly: Mono.Author("Rafael Teixeira")]
+[assembly: Mono.Author("Dean Scarff")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/mcs/class/Mono.GetOptions/GetOptTest/GetOptTester.cs b/mcs/class/Mono.GetOptions/GetOptTest/GetOptTester.cs
new file mode 100644
index 00000000000..0ef35a602bd
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/GetOptTest/GetOptTester.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections;
+using Mono.GetOptions;
+
+namespace GetOptTest
+{
+ class GetOptTestOptions : Options
+ {
+ [Option(3, "Just a testing Parameter", 'p')]
+ public string[] param = new string[] { "Default value" };
+
+ [Option("Just a boolean testing parameter", 't')]
+ public bool turnItOn = false;
+
+ private bool verboseOn = false;
+
+ [Option("Be verbose", 'v')]
+ public bool verbose
+ {
+ set
+ {
+ verboseOn = value;
+ Console.WriteLine("verbose was set to : " + verboseOn);
+ }
+ }
+
+ [Option(-1, "Execute a test routine", 's', null)]
+ public WhatToDoNext simpleProcedure(int dids)
+ {
+ Console.WriteLine("Inside simpleProcedure({0})", dids);
+ return WhatToDoNext.GoAhead;
+ }
+
+ [Option("Show usage syntax", 'u', "usage")]
+ public override WhatToDoNext DoUsage()
+ {
+ base.DoUsage();
+ return WhatToDoNext.GoAhead;
+ }
+
+ public override WhatToDoNext DoHelp() // uses parent´s OptionAttribute as is
+ {
+ base.DoHelp();
+ return WhatToDoNext.GoAhead;
+ }
+
+ public GetOptTestOptions()
+ {
+ this.ParsingMode = OptionsParsingMode.Both;
+ }
+ }
+
+ /// <summary>
+ /// Summary description for GetOptTester.
+ /// </summary>
+ class GetOptTester
+ {
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("------------ Original 'args'");
+ for(int i = 0; i < args.Length; i++)
+ Console.WriteLine("args[{0}] = \"{1}\"",i,args[i]);
+ Console.WriteLine("----------------------------------------");
+ Console.WriteLine("------------ GetOptions Processing");
+ GetOptTestOptions options = new GetOptTestOptions();
+ options.ProcessArgs(args);
+ Console.WriteLine("----------------------------------------");
+ Console.WriteLine("------------ Results");
+ if (options.param != null)
+ {
+ Console.WriteLine("Parameters supplied for 'param' were:");
+ foreach (string Parameter in options.param)
+ Console.WriteLine("\t" + Parameter);
+ }
+ for(int i = 0; i < options.RemainingArguments.Length; i++)
+ Console.WriteLine("remaining args[{0}] = \"{1}\"",i,options.RemainingArguments[i]);
+ Console.WriteLine("----------------------------------------");
+ }
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/Mono.GetOptions.build b/mcs/class/Mono.GetOptions/Mono.GetOptions.build
new file mode 100755
index 00000000000..9d51e531834
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/Mono.GetOptions.build
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.GetOptions.dll -->
+
+<project name="Mono.GetOptions" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.GetOptions.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="GetOptTest/**"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.GetOptions.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.GetOptions/Mono.GetOptions.csproj b/mcs/class/Mono.GetOptions/Mono.GetOptions.csproj
new file mode 100644
index 00000000000..6f47d7f3cd6
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/Mono.GetOptions.csproj
@@ -0,0 +1,131 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{8D3008AB-7C0F-4DBE-A305-752926C366A7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Mono.GetOptions"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Mono.GetOptions"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AboutAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ArgumentProcessorAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AuthorAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "OptionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OptionDetails.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OptionList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Options.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToDo"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "UsageComplementAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/Mono.GetOptions/OptionAttribute.cs b/mcs/class/Mono.GetOptions/OptionAttribute.cs
new file mode 100644
index 00000000000..739d71f15bb
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/OptionAttribute.cs
@@ -0,0 +1,66 @@
+using System;
+
+namespace Mono.GetOptions
+{
+
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)]
+ public class OptionAttribute : Attribute
+ {
+ public string ShortDescription;
+ public char ShortForm;
+ public string LongForm;
+ public int MaxOccurs; // negative means there is no limit
+
+ private void SetValues(
+ string shortDescription,
+ char shortForm,
+ string longForm,
+ int maxOccurs)
+ {
+ ShortDescription = shortDescription;
+ ShortForm = shortForm;
+ LongForm = longForm;
+ MaxOccurs = maxOccurs;
+ }
+
+ public OptionAttribute(string shortDescription)
+ {
+ SetValues(shortDescription, ' ', string.Empty, 0);
+ }
+
+ public OptionAttribute(string shortDescription, char shortForm)
+ {
+ SetValues(shortDescription, shortForm, string.Empty, 0);
+ }
+
+ public OptionAttribute(string shortDescription, char shortForm, string longForm)
+ {
+ SetValues(shortDescription, shortForm, longForm, 0);
+ }
+
+ public OptionAttribute(string shortDescription, string longForm)
+ {
+ SetValues(shortDescription, ' ', longForm, 0);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription)
+ {
+ SetValues(shortDescription, ' ', string.Empty, maxOccurs);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription, char shortForm)
+ {
+ SetValues(shortDescription, shortForm, string.Empty, maxOccurs);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription, char shortForm, string longForm)
+ {
+ SetValues(shortDescription, shortForm, longForm, maxOccurs);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription, string longForm)
+ {
+ SetValues(shortDescription, ' ', longForm, maxOccurs);
+ }
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/OptionDetails.cs b/mcs/class/Mono.GetOptions/OptionDetails.cs
new file mode 100644
index 00000000000..37e93f4fc19
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/OptionDetails.cs
@@ -0,0 +1,200 @@
+//
+// OptionDetails.cs
+//
+// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) 2002 Rafael Teixeira
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+
+namespace Mono.GetOptions
+{
+ public enum WhatToDoNext
+ {
+ AbandonProgram,
+ GoAhead
+ }
+
+ internal class OptionDetails : IComparable
+ {
+ public char ShortForm;
+ public string LongForm;
+ public string ShortDescription;
+ public bool NeedsParameter;
+ public int MaxOccurs; // negative means there is no limit
+ public int Occurs;
+ public Options OptionBundle;
+ public MemberInfo MemberInfo;
+ public ArrayList Values;
+ public System.Type ParameterType;
+
+ public override string ToString()
+ {
+ string optionHelp;
+ // TODO: Yet not that good
+ optionHelp = " ";
+ optionHelp += (this.ShortForm != ' ') ? "-"+this.ShortForm+" " : " ";
+ optionHelp += (this.LongForm != string.Empty && this.LongForm != null) ? "--"+this.LongForm : "";
+ if (NeedsParameter)
+ {
+ if (this.LongForm != string.Empty && this.LongForm != null)
+ optionHelp += "=PARAM";
+ else
+ optionHelp += "PARAM";
+ }
+ optionHelp = optionHelp.PadRight(23) + " ";
+ optionHelp += this.ShortDescription;
+ return optionHelp;
+ }
+
+ private static System.Type TypeOfMember(MemberInfo memberInfo)
+ {
+ if ((memberInfo.MemberType == MemberTypes.Field && memberInfo is FieldInfo))
+ return ((FieldInfo)memberInfo).FieldType;
+
+ if ((memberInfo.MemberType == MemberTypes.Property && memberInfo is PropertyInfo))
+ return ((PropertyInfo)memberInfo).PropertyType;
+
+ if ((memberInfo.MemberType == MemberTypes.Method && memberInfo is MethodInfo))
+ {
+ if (((MethodInfo)memberInfo).ReturnType.FullName != typeof(WhatToDoNext).FullName)
+ throw new NotSupportedException("Option method must return '" + typeof(WhatToDoNext).FullName + "'");
+
+ ParameterInfo[] parameters = ((MethodInfo)memberInfo).GetParameters();
+ if ((parameters == null) || (parameters.Length == 0))
+ return null;
+ else
+ return parameters[0].ParameterType;
+ }
+
+ throw new NotSupportedException("'" + memberInfo.MemberType + "' memberType is not supportted");
+ }
+
+ public OptionDetails(MemberInfo memberInfo, OptionAttribute option, Options optionBundle)
+ {
+ this.ShortForm = option.ShortForm;
+ this.LongForm = (option.LongForm == string.Empty)? memberInfo.Name:option.LongForm;
+ this.ShortDescription = option.ShortDescription;
+ this.Occurs = 0;
+ this.OptionBundle = optionBundle;
+ this.MemberInfo = memberInfo;
+ this.NeedsParameter = false;
+ this.Values = null;
+ this.MaxOccurs = 1;
+ this.ParameterType = TypeOfMember(memberInfo);
+
+ if (this.ParameterType != null && this.ParameterType.FullName != "System.Boolean")
+ {
+ this.NeedsParameter = true;
+ if (this.ParameterType.IsArray)
+ {
+ this.Values = new ArrayList();
+ this.MaxOccurs = option.MaxOccurs;
+ }
+ else
+ {
+ if (this.MemberInfo is MethodInfo)
+ this.MaxOccurs = option.MaxOccurs;
+ }
+ }
+ }
+
+ internal string Key
+ {
+ get { return ((this.ShortForm != ' ') ? this.ShortForm + "" : "") + this.LongForm; }
+ }
+
+ int IComparable.CompareTo(object other)
+ {
+ return Key.CompareTo(((OptionDetails)other).Key);
+ }
+
+ public void TransferValues()
+ {
+ if (Values != null)
+ {
+ if (MemberInfo is FieldInfo)
+ {
+ ((FieldInfo)MemberInfo).SetValue(OptionBundle, Values.ToArray(ParameterType.GetElementType()));
+ return;
+ }
+
+ if (MemberInfo is PropertyInfo)
+ {
+ ((PropertyInfo)MemberInfo).SetValue(OptionBundle, Values.ToArray(ParameterType.GetElementType()), null);
+ return;
+ }
+
+ if ((WhatToDoNext)((MethodInfo)MemberInfo).Invoke(OptionBundle, new object[] { Values.ToArray(ParameterType.GetElementType()) }) == WhatToDoNext.AbandonProgram)
+ System.Environment.Exit(1);
+ }
+ }
+
+ private void DoIt(string parameter)
+ {
+ Occurs++;
+
+ if (MaxOccurs > 0 && Occurs > MaxOccurs)
+ throw new IndexOutOfRangeException("Option " + ShortForm + " can be used at most " + MaxOccurs + " times");
+
+ if (!NeedsParameter)
+ {
+ if (MemberInfo is FieldInfo)
+ {
+ ((FieldInfo)MemberInfo).SetValue(OptionBundle, true);
+ return;
+ }
+ if (MemberInfo is PropertyInfo)
+ {
+ ((PropertyInfo)MemberInfo).SetValue(OptionBundle, true, null);
+ return;
+ }
+ if ((WhatToDoNext)((MethodInfo)MemberInfo).Invoke(OptionBundle, null) == WhatToDoNext.AbandonProgram)
+ System.Environment.Exit(1);
+
+ return;
+ }
+
+ object convertedParameter = null;
+
+ if (Values != null && parameter != null)
+ {
+ convertedParameter = Convert.ChangeType(parameter, ParameterType.GetElementType());
+ Values.Add(convertedParameter);
+ return;
+ }
+
+ if (parameter != null)
+ convertedParameter = Convert.ChangeType(parameter, ParameterType);
+
+ if (MemberInfo is FieldInfo)
+ {
+ ((FieldInfo)MemberInfo).SetValue(OptionBundle, convertedParameter);
+ return;
+ }
+
+ if (MemberInfo is PropertyInfo)
+ {
+ ((PropertyInfo)MemberInfo).SetValue(OptionBundle, convertedParameter, null);
+ return;
+ }
+
+ if ((WhatToDoNext)((MethodInfo)MemberInfo).Invoke(OptionBundle, new object[] { convertedParameter }) == WhatToDoNext.AbandonProgram)
+ System.Environment.Exit(1);
+ }
+
+ public bool ProcessArgument(string arg, string nextArg)
+ {
+ if (arg == ("-" + ShortForm) || arg == ("--" + LongForm))
+ {
+ DoIt(nextArg);
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/OptionList.cs b/mcs/class/Mono.GetOptions/OptionList.cs
new file mode 100644
index 00000000000..4962db1d8d8
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/OptionList.cs
@@ -0,0 +1,407 @@
+//
+// OptionList.cs
+//
+// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com) (original)
+// Author: Dean Scarff (D_Scarff@AIMINGFORSPAMFREEmsn.com) (modifications)
+//
+// (C) 2002 Rafael Teixeira
+// Modifications (C) 2002 Dean Scarff, distributed under the Gnu General Public License Version 2 or later
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+
+namespace Mono.GetOptions
+{
+
+ [Flags]
+ public enum OptionsParsingMode
+ {
+ Linux = 1,
+ Windows = 2,
+ Both = 3
+ }
+
+ /// <summary>
+ /// Option Parsing
+ /// </summary>
+ public class OptionList
+ {
+
+ private Options optionBundle = null;
+ private OptionsParsingMode parsingMode;
+ private bool endOptionProcessingWithDoubleDash;
+
+ private string appExeName;
+ private string appVersion;
+
+ private string appTitle = "Add a [assembly: AssemblyTitle(\"Here goes the application name\")] to your assembly";
+ private string appCopyright = "Add a [assembly: AssemblyCopyright(\"(c)200n Here goes the copyright holder name\")] to your assembly";
+ private string appDescription = "Add a [assembly: AssemblyDescription(\"Here goes the short description\")] to your assembly";
+ private string appAboutDetails = "Add a [assembly: Mono.About(\"Here goes the short about details\")] to your assembly";
+ private string appUsageComplement = "Add a [assembly: Mono.UsageComplement(\"Here goes the usage clause complement\")] to your assembly";
+ private string[] appAuthors;
+
+ private ArrayList list = new ArrayList();
+ private ArrayList arguments = new ArrayList();
+ private ArrayList argumentsTail = new ArrayList();
+ private MethodInfo argumentProcessor = null;
+
+ public string Usage
+ {
+ get
+ {
+ return "Usage: " + appExeName + " [options] " + appUsageComplement;
+ }
+ }
+
+ public string AboutDetails
+ {
+ get
+ {
+ return appAboutDetails;
+ }
+ }
+
+ #region Assembly Attributes
+
+ Assembly entry;
+
+ private object[] GetAssemblyAttributes(Type type)
+ {
+ return entry.GetCustomAttributes(type, false);
+ }
+
+ private string[] GetAssemblyAttributeStrings(Type type)
+ {
+ object[] result = GetAssemblyAttributes(type);
+
+ if ((result == null) || (result.Length == 0))
+ return new string[0];
+
+ int i = 0;
+ string[] var = new string[result.Length];
+
+ foreach(object o in result)
+ var[i++] = o.ToString();
+
+ return var;
+ }
+
+ private void GetAssemblyAttributeValue(Type type, string propertyName, ref string var)
+ {
+ object[] result = GetAssemblyAttributes(type);
+
+ if ((result != null) && (result.Length > 0))
+ var = (string)type.InvokeMember(propertyName, BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty | BindingFlags.Instance, null, result[0], new object [] {}); ;
+ }
+
+ private void GetAssemblyAttributeValue(Type type, ref string var)
+ {
+ object[] result = GetAssemblyAttributes(type);
+
+ if ((result != null) && (result.Length > 0))
+ var = result[0].ToString();
+ }
+
+ #endregion
+
+ #region Constructors
+
+ private void AddArgumentProcessor(MemberInfo memberInfo)
+ {
+ if (argumentProcessor != null)
+ throw new NotSupportedException("More than one argument processor method found");
+
+ if ((memberInfo.MemberType == MemberTypes.Method && memberInfo is MethodInfo))
+ {
+ if (((MethodInfo)memberInfo).ReturnType.FullName != typeof(void).FullName)
+ throw new NotSupportedException("Argument processor method must return 'void'");
+
+ ParameterInfo[] parameters = ((MethodInfo)memberInfo).GetParameters();
+ if ((parameters == null) || (parameters.Length != 1) || (parameters[0].ParameterType.FullName != typeof(string).FullName))
+ throw new NotSupportedException("Argument processor method must have a string parameter");
+
+ argumentProcessor = (MethodInfo)memberInfo;
+ }
+ else
+ throw new NotSupportedException("Argument processor marked member isn't a method");
+ }
+
+ private void Initialize(Options optionBundle)
+ {
+ if (optionBundle == null)
+ throw new ArgumentNullException("optionBundle");
+
+ entry = Assembly.GetEntryAssembly();
+ appExeName = entry.GetName().Name;
+ appVersion = entry.GetName().Version.ToString();
+
+ this.optionBundle = optionBundle;
+ this.parsingMode = optionBundle.ParsingMode ;
+ this.endOptionProcessingWithDoubleDash = optionBundle.EndOptionProcessingWithDoubleDash;
+
+ GetAssemblyAttributeValue(typeof(AssemblyTitleAttribute), "Title", ref appTitle);
+ GetAssemblyAttributeValue(typeof(AssemblyCopyrightAttribute), "Copyright", ref appCopyright);
+ GetAssemblyAttributeValue(typeof(AssemblyDescriptionAttribute), "Description", ref appDescription);
+ GetAssemblyAttributeValue(typeof(Mono.AboutAttribute), ref appAboutDetails);
+ GetAssemblyAttributeValue(typeof(Mono.UsageComplementAttribute), ref appUsageComplement);
+ appAuthors = GetAssemblyAttributeStrings(typeof(AuthorAttribute));
+ if (appAuthors.Length == 0)
+ {
+ appAuthors = new String[1];
+ appAuthors[0] = "Add one or more [assembly: Mono.GetOptions.Author(\"Here goes the author name\")] to your assembly";
+ }
+
+ foreach(MemberInfo mi in optionBundle.GetType().GetMembers())
+ {
+ object[] attribs = mi.GetCustomAttributes(typeof(OptionAttribute), true);
+ if (attribs != null && attribs.Length > 0)
+ list.Add(new OptionDetails(mi, (OptionAttribute)attribs[0], optionBundle));
+ else
+ {
+ attribs = mi.GetCustomAttributes(typeof(ArgumentProcessorAttribute), true);
+ if (attribs != null && attribs.Length > 0)
+ AddArgumentProcessor(mi);
+ }
+ }
+ }
+
+ public OptionList(Options optionBundle)
+ {
+ Initialize(optionBundle);
+ }
+
+ #endregion
+
+ #region Prebuilt Options
+
+ private void ShowTitleLines()
+ {
+ Console.WriteLine(appTitle + " " + appVersion + " - " + appCopyright);
+ Console.WriteLine(appDescription);
+ Console.WriteLine();
+ }
+
+ private void ShowAbout()
+ {
+ ShowTitleLines();
+ Console.WriteLine(appAboutDetails);
+ Console.WriteLine();
+ Console.WriteLine("Authors:");
+ foreach(string s in appAuthors)
+ Console.WriteLine ("\t" + s);
+ }
+
+ private void ShowHelp()
+ {
+ ShowTitleLines();
+ Console.WriteLine(Usage);
+ Console.WriteLine("Options:");
+ foreach (OptionDetails option in list)
+ Console.WriteLine(option);
+ }
+
+ private void ShowUsage()
+ {
+ Console.WriteLine(Usage);
+ Console.Write("Short Options: ");
+ foreach (OptionDetails option in list)
+ Console.Write((option.ShortForm != ' ') ? option.ShortForm.ToString() : "");
+ Console.WriteLine();
+
+ }
+
+ private void ShowUsage(string errorMessage)
+ {
+ Console.WriteLine("ERROR: " + errorMessage.TrimEnd());
+ ShowUsage();
+ }
+
+ internal WhatToDoNext DoUsage()
+ {
+ ShowUsage();
+ return WhatToDoNext.AbandonProgram;
+ }
+
+ internal WhatToDoNext DoAbout()
+ {
+ ShowAbout();
+ return WhatToDoNext.GoAhead;
+ }
+
+ internal WhatToDoNext DoHelp()
+ {
+ ShowHelp();
+ return WhatToDoNext.AbandonProgram;
+ }
+
+ #endregion
+
+ #region Arguments Processing
+
+ public string[] ExpandResponseFiles(string[] args)
+ {
+ ArrayList result = new ArrayList();
+
+ foreach(string arg in args)
+ {
+ if (arg.StartsWith("@"))
+ {
+ try
+ {
+ StreamReader tr = new StreamReader(arg.Substring(1));
+ string line;
+ while ((line = tr.ReadLine()) != null)
+ {
+ result.AddRange(line.Split());
+ }
+ tr.Close();
+ }
+ catch (FileNotFoundException exception)
+ {
+ Console.WriteLine("Could not find response file: " + arg.Substring(1));
+ continue;
+ }
+ catch (Exception exception)
+ {
+ Console.WriteLine("Error trying to read response file: " + arg.Substring(1));
+ Console.WriteLine(exception.Message);
+ continue;
+ }
+ }
+ else
+ result.Add(arg);
+ }
+
+ return (string[])result.ToArray(typeof(string));
+ }
+
+ public string[] NormalizeArgs(string[] args)
+ {
+ bool ParsingOptions = true;
+ ArrayList result = new ArrayList();
+
+ foreach(string arg in ExpandResponseFiles(args))
+ {
+ if (arg.Length > 0)
+ {
+ if (ParsingOptions)
+ {
+ if (endOptionProcessingWithDoubleDash && (arg == "--"))
+ {
+ ParsingOptions = false;
+ continue;
+ }
+
+ if ((parsingMode & OptionsParsingMode.Windows) > 0)
+ {
+ if ((arg.Length == 2) && (arg[0] == '/')) // Windows options only come in this fashion
+ {
+ result.Add("-" + arg[1]); // translate to Linux style
+ continue;
+ }
+ }
+
+ if ((parsingMode & OptionsParsingMode.Linux) > 0)
+ {
+ if ((arg[0] == '-') && (arg[1] != '-'))
+ {
+ foreach(char c in arg.Substring(1)) // many single-letter options
+ result.Add("-" + c); // expand into individualized options
+ continue;
+ }
+
+ if (arg.StartsWith("--"))
+ {
+ result.AddRange(arg.Split('=')); // put in the same form of one-letter options with a parameter
+ continue;
+ }
+ }
+ }
+ else
+ {
+ argumentsTail.Add(arg);
+ continue;
+ }
+
+ // if nothing else matches then it get here
+ result.Add(arg);
+ }
+ }
+
+ return (string[])result.ToArray(typeof(string));
+ }
+
+ public string[] ProcessArgs(string[] args)
+ {
+ string arg;
+ string nextArg;
+ bool OptionWasProcessed;
+
+ list.Sort();
+
+ args = NormalizeArgs(args);
+
+ try
+ {
+ int argc = args.Length;
+ for(int i = 0; i < argc; i++)
+ {
+ arg = args[i];
+ if (i+1 < argc)
+ {
+ nextArg = args[i+1];
+ if (nextArg.StartsWith("-"))
+ nextArg = null;
+ }
+ else
+ nextArg = null;
+
+ OptionWasProcessed = false;
+
+ if (arg.StartsWith("-"))
+ {
+ foreach(OptionDetails option in list)
+ {
+ if (option.ProcessArgument(arg, nextArg))
+ {
+ OptionWasProcessed = true;
+ if (nextArg != null)
+ i++;
+ break;
+ }
+ }
+ }
+
+ if (!OptionWasProcessed)
+ arguments.Add(arg);
+ }
+
+ foreach(OptionDetails option in list)
+ option.TransferValues();
+
+ foreach(string argument in argumentsTail)
+ arguments.Add(argument);
+
+ if (argumentProcessor == null)
+ return (string[])arguments.ToArray(typeof(string));
+
+ foreach(string argument in arguments)
+ argumentProcessor.Invoke(optionBundle, new object[] { argument });
+ }
+ catch (Exception ex)
+ {
+ ShowUsage(ex.Message);
+ System.Environment.Exit(1);
+ }
+
+ return null;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/Options.cs b/mcs/class/Mono.GetOptions/Options.cs
new file mode 100644
index 00000000000..c6f6a36c11f
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/Options.cs
@@ -0,0 +1,47 @@
+using System;
+
+namespace Mono.GetOptions
+{
+ public class Options
+ {
+ public OptionsParsingMode ParsingMode;
+ public bool EndOptionProcessingWithDoubleDash;
+
+ private OptionList optionParser;
+
+ public string[] RemainingArguments;
+
+ public Options()
+ {
+ ParsingMode = OptionsParsingMode.Both;
+ EndOptionProcessingWithDoubleDash = true;
+ }
+
+ public void ProcessArgs(string[] args)
+ {
+ optionParser = new OptionList(this);
+ RemainingArguments = optionParser.ProcessArgs(args);
+ }
+
+ [Option("Show this help list", '?',"help")]
+ public virtual WhatToDoNext DoHelp()
+ {
+ return optionParser.DoHelp();
+ }
+
+ [Option("Display version and licensing information", 'V', "version")]
+ public virtual WhatToDoNext DoAbout()
+ {
+ return optionParser.DoAbout();
+ }
+
+ [Option("Show usage syntax and exit", ' ',"usage")]
+ public virtual WhatToDoNext DoUsage()
+ {
+ return optionParser.DoUsage();
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/Mono.GetOptions/UsageComplementAttribute.cs b/mcs/class/Mono.GetOptions/UsageComplementAttribute.cs
new file mode 100644
index 00000000000..d6f03be4d4c
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/UsageComplementAttribute.cs
@@ -0,0 +1,29 @@
+//
+// UsageComplementAttribute.cs
+//
+// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) 2002 Rafael Teixeira
+//
+
+
+using System;
+
+namespace Mono
+{
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public class UsageComplementAttribute : System.Attribute
+ {
+ public string Details;
+
+ public UsageComplementAttribute(string details)
+ {
+ Details = details;
+ }
+
+ public override string ToString()
+ {
+ return Details;
+ }
+ }
+}
diff --git a/mcs/class/Mono.GetOptions/list.unix b/mcs/class/Mono.GetOptions/list.unix
new file mode 100644
index 00000000000..b42fa7830bd
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/list.unix
@@ -0,0 +1,9 @@
+AssemblyInfo.cs
+ArgumentProcessorAttribute.cs
+AboutAttribute.cs
+AuthorAttribute.cs
+OptionAttribute.cs
+UsageComplementAttribute.cs
+OptionList.cs
+OptionDetails.cs
+Options.cs
diff --git a/mcs/class/Mono.GetOptions/makefile.gnu b/mcs/class/Mono.GetOptions/makefile.gnu
new file mode 100644
index 00000000000..17925f1cd71
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.GetOptions.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r System.Data -r System.Xml
+
+SOURCES_INCLUDE=*.cs
+
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.PEToolkit/.cvsignore b/mcs/class/Mono.PEToolkit/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.PEToolkit/BadImageException.cs b/mcs/class/Mono.PEToolkit/BadImageException.cs
new file mode 100644
index 00000000000..6ee75fb3ee8
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/BadImageException.cs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit {
+
+ public class BadImageException : Exception {
+
+ public BadImageException() : base()
+ {
+ }
+
+ public BadImageException(string msg) : base(msg)
+ {
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/COFFHeader.cs b/mcs/class/Mono.PEToolkit/COFFHeader.cs
new file mode 100644
index 00000000000..56c08727411
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/COFFHeader.cs
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit {
+
+ /// <summary>
+ /// IMAGE_FILE_HEADER
+ /// </summary>
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct COFFHeader {
+
+ internal MachineId machine;
+ internal short sections;
+ internal uint tdStampRaw;
+ internal uint symTabPtr;
+ internal uint numSymbols;
+ internal short optHeaderSize;
+ internal Characteristics characteristics;
+
+
+
+ /// <summary>
+ /// Machine identifier.
+ /// </summary>
+ public MachineId Machine {
+ get {
+ return machine;
+ }
+ set {
+ machine = value;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public short NumberOfSections {
+ get {
+ return sections;
+ }
+ set {
+ sections = value;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public uint TimeDateStamp {
+ get {
+ return tdStampRaw;
+ }
+ set {
+ tdStampRaw = value;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public DateTime TimeStamp {
+ get {
+ return (new DateTime(1970, 1, 1) +
+ TimeSpan.FromSeconds(tdStampRaw)).ToLocalTime();
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public uint PointerToSymbolTable {
+ get {
+ return symTabPtr;
+ }
+ set {
+ symTabPtr = value;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public uint NumberOfSymbols {
+ get {
+ return numSymbols;
+ }
+ set {
+ numSymbols = value;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public short SizeOfOptionalHeader {
+ get {
+ return optHeaderSize;
+ }
+ set {
+ optHeaderSize = value;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public Characteristics Characteristics {
+ get {
+ return characteristics;
+ }
+ set {
+ characteristics = value;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ unsafe public void Read(BinaryReader reader) {
+ fixed (void* pThis = &this) {
+ PEUtils.ReadStruct(reader, pThis, sizeof (COFFHeader), typeof (COFFHeader));
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <param name="writer"></param>
+ public void Dump(TextWriter writer)
+ {
+ writer.WriteLine(
+ "Machine ID : {0}" + Environment.NewLine +
+ "Sections : {1}" + Environment.NewLine +
+ "timestamp : {2}" + Environment.NewLine +
+ "Characteristics : {3}" + Environment.NewLine,
+ machine, sections,
+ TimeStamp + " (" + tdStampRaw.ToString("X") + ")",
+ characteristics + " (0x" + characteristics.ToString("X") + ")"
+ );
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+
+
+ }
+}
diff --git a/mcs/class/Mono.PEToolkit/Characteristics.cs b/mcs/class/Mono.PEToolkit/Characteristics.cs
new file mode 100644
index 00000000000..3e0ae62a416
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/Characteristics.cs
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit {
+
+ [Flags]
+ public enum Characteristics : ushort {
+
+
+ /// <summary>
+ /// Relocation info stripped from file.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_RELOCS_STRIPPED
+ /// </remarks>
+ RELOCS_STRIPPED = 0x0001,
+
+
+
+ /// <summary>
+ /// File is executable
+ /// (i.e. file is neither object file nor library file,
+ /// so there are no unresolved externel references).
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_EXECUTABLE_IMAGE
+ /// </remarks>
+ EXECUTABLE_IMAGE = 0x0002,
+
+
+ /// <summary>
+ /// Line nunbers stripped from file.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_LINE_NUMS_STRIPPED
+ /// </remarks>
+ LINE_NUMS_STRIPPED = 0x0004,
+
+
+ /// <summary>
+ /// Local symbols stripped from file.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_LOCAL_SYMS_STRIPPED
+ /// </remarks>
+ LOCAL_SYMS_STRIPPED = 0x0008,
+
+
+ /// <summary>
+ /// Agressively trim working set
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_AGGRESIVE_WS_TRIM
+ /// </remarks>
+ AGGRESIVE_WS_TRIM = 0x0010,
+
+
+ /// <summary>
+ /// App can handle >2gb addresses
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_LARGE_ADDRESS_AWARE
+ /// </remarks>
+ LARGE_ADDRESS_AWARE = 0x0020,
+
+
+ /// <summary>
+ /// Bytes of machine word are reversed.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_BYTES_REVERSED_LO
+ /// </remarks>
+ BYTES_REVERSED_LO = 0x0080,
+
+
+ /// <summary>
+ /// 32 bit word machine.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_32BIT_MACHINE
+ /// </remarks>
+ MACHINE_32BIT = 0x0100,
+
+
+ /// <summary>
+ /// Debugging info stripped from file in .DBG file
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_DEBUG_STRIPPED
+ /// </remarks>
+ DEBUG_STRIPPED = 0x0200,
+
+
+ /// <summary>
+ /// If Image is on removable media, copy and run from the swap file.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP
+ /// </remarks>
+ REMOVABLE_RUN_FROM_SWAP = 0x0400,
+
+
+ /// <summary>
+ /// If Image is on Net, copy and run from the swap file.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_NET_RUN_FROM_SWAP
+ /// </remarks>
+ NET_RUN_FROM_SWAP = 0x0800,
+
+
+ /// <summary>
+ /// This flag is used to indicate that the file
+ /// is a system sile, such as device driver.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_SYSTEM
+ /// </remarks>
+ SYSTEM = 0x1000,
+
+
+ /// <summary>
+ /// This flag indicates that the file
+ /// is a dynamic library (DLL).
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_DLL
+ /// </remarks>
+ DLL = 0x2000,
+
+
+ /// <summary>
+ /// File should only be run on a uni-processor (UP) machine.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_UP_SYSTEM_ONLY
+ /// </remarks>
+ UP_SYSTEM_ONLY = 0x4000,
+
+
+ /// <summary>
+ /// Bytes of machine word are reversed.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_BYTES_REVERSED_HI
+ /// </remarks>
+ BYTES_REVERSED_HI = 0x8000,
+
+
+
+ /// <summary>
+ /// Default flags that must be set in CIL-only image.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, 24.2.2.1
+ /// </remarks>
+ CIL_DEFAULT = LINE_NUMS_STRIPPED |
+ LOCAL_SYMS_STRIPPED |
+ DEBUG_STRIPPED
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/CheckSum.cs b/mcs/class/Mono.PEToolkit/CheckSum.cs
new file mode 100644
index 00000000000..153e607fd3b
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/CheckSum.cs
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+// see http://cvs.winehq.com/cvsweb/wine/dlls/imagehlp/modify.c
+// starting from Revision 1.8
+
+using System;
+using System.IO;
+
+namespace Mono.PEToolkit {
+
+ public sealed class CheckSum {
+
+ private CheckSum()
+ {
+ // Never instantiated.
+ }
+
+
+ public static uint Calc(string peFile)
+ {
+ uint res = 0;
+
+ FileInfo pe = new FileInfo(peFile);
+ if (!pe.Exists) {
+ throw new Exception("CheckSum : Invalid file path.");
+ }
+
+ using (BinaryReader reader = new BinaryReader(pe.OpenRead())) {
+ if (!reader.BaseStream.CanSeek) {
+ throw new Exception("Can't seek.");
+ }
+
+ DOSHeader dosHdr = new DOSHeader();
+ COFFHeader coffHdr = new COFFHeader();
+ PEHeader peHdr = new PEHeader();
+
+ dosHdr.Read (reader);
+ reader.BaseStream.Position = dosHdr.lfanew;
+ ExeSignature peSig = (ExeSignature) reader.ReadUInt16();
+ if (peSig != ExeSignature.NT) {
+ throw new BadImageException("Checksum : Invalid image format, cannot find PE signature.");
+ }
+
+ peSig = (ExeSignature) reader.ReadUInt16();
+ if (peSig != ExeSignature.NT2) {
+ throw new BadImageException("Checksum : Invalid image format, cannot find PE signature.");
+ }
+
+ coffHdr.Read(reader);
+ peHdr.Read(reader);
+
+ uint oldSum = peHdr.CheckSum;
+ reader.BaseStream.Position = 0;
+ long len = pe.Length;
+ long whole = len >> 1;
+ uint sum = 0;
+ uint hi, lo;
+ for (long i = whole; --i >= 0;) {
+ sum += reader.ReadUInt16();
+ hi = sum >> 16;
+ if (hi != 0) {
+ sum = hi + (sum & 0xFFFF);
+ }
+ }
+ if ((len & 1L) != 0) {
+ sum += (uint) reader.ReadByte();
+ hi = sum >> 16;
+ if (hi != 0) {
+ sum = hi + (sum & 0xFFFF);
+ }
+ }
+
+ // fix low word of checksum
+ lo = oldSum & 0xFFFF;
+ if ((sum & 0xFFFF) >= lo) {
+ sum -= lo;
+ } else {
+ sum = (((sum & 0xFFFF) - lo) & 0xFFFF) - 1;
+ }
+
+ // fix high word of checksum
+ hi = oldSum >> 16;
+ if ((sum & 0xFFFF) >= hi) {
+ sum -= hi;
+ } else {
+ sum = (((sum & 0xFFFF) - hi) & 0xFFFF) - 1;
+ }
+ }
+
+ return res;
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/CorHeader.cs b/mcs/class/Mono.PEToolkit/CorHeader.cs
new file mode 100644
index 00000000000..0674f369a70
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/CorHeader.cs
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+using Mono.PEToolkit.Metadata;
+
+namespace Mono.PEToolkit {
+
+ [Flags]
+ public enum CorFlags : uint {
+ /// <summary>
+ /// COMIMAGE_FLAGS_ILONLY
+ /// </summary>
+ ILONLY = 0x00000001,
+
+ /// <summary>
+ /// COMIMAGE_FLAGS_32BITREQUIRED
+ /// </summary>
+ REQUIRED_32BIT = 0x00000002,
+
+ /// <summary>
+ /// COMIMAGE_FLAGS_IL_LIBRARY
+ /// </summary>
+ IL_LIBRARY = 0x00000004,
+
+ /// <summary>
+ /// COMIMAGE_FLAGS_TRACKDEBUGDATA
+ /// </summary>
+ TRACKDEBUGDATA = 0x00010000,
+ }
+
+
+ /// <summary>
+ /// CLR 2.0 header structure.
+ /// IMAGE_COR20_HEADER
+ /// </summary>
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct CorHeader {
+ // Header versioning
+ internal uint cb;
+ internal short runtimeMaj;
+ internal short runtimeMin;
+
+ // Symbol table and startup information.
+ internal DataDir meta;
+ internal CorFlags flags;
+ internal uint entryTok;
+
+ // Binding information.
+ internal DataDir rsrc;
+ internal DataDir strongSig;
+
+ // Regular fixup and binding information.
+ internal DataDir codeManTab;
+ internal DataDir vtab;
+ internal DataDir jumps;
+
+ // Managed Native Code.
+ internal DataDir eeInfo;
+ internal DataDir helper;
+ internal DataDir dynInfo;
+ internal DataDir delayInfo;
+ internal DataDir modImg;
+ internal DataDir extFixups;
+ internal DataDir ridMap;
+ internal DataDir dbgMap;
+
+ // obsolete?
+ internal DataDir ipMap;
+
+
+ //
+ // Accessors
+ //
+
+ public uint Size {
+ get {
+ return cb;
+ }
+ set {
+ cb = value;
+ }
+ }
+
+ public short MajorRuntimeVersion {
+ get {
+ return runtimeMaj;
+ }
+ set {
+ runtimeMaj = value;
+ }
+ }
+
+ public short MinorRuntimeVersion {
+ get {
+ return runtimeMin;
+ }
+ set {
+ runtimeMin = value;
+ }
+ }
+
+ public string RuntimeVersion {
+ get {
+ return String.Format("{0}.{1}", runtimeMaj, runtimeMin);
+ }
+ }
+
+ public DataDir MetaData {
+ get {
+ return meta;
+ }
+ set {
+ meta = value;
+ }
+ }
+
+ public CorFlags Flags {
+ get {
+ return flags;
+ }
+ set {
+ flags = value;
+ }
+ }
+
+ public MDToken EntryPointToken {
+ get {
+ return entryTok;
+ }
+ set {
+ entryTok = value;
+ }
+ }
+
+ public DataDir Resources {
+ get {
+ return rsrc;
+ }
+ set {
+ rsrc = value;
+ }
+ }
+
+ public DataDir StrongNameSignature {
+ get {
+ return strongSig;
+ }
+ set {
+ strongSig = value;
+ }
+ }
+
+ public DataDir CodeManagerTable {
+ get {
+ return codeManTab;
+ }
+ set {
+ codeManTab = value;
+ }
+ }
+
+ public DataDir VTableFixups {
+ get {
+ return vtab;
+ }
+ set {
+ vtab = value;
+ }
+ }
+
+ public DataDir ExportAddressTableJumps {
+ get {
+ return jumps;
+ }
+ set {
+ jumps = value;
+ }
+ }
+
+
+ public DataDir EEInfoTable {
+ get {
+ return eeInfo;
+ }
+ set {
+ eeInfo = value;
+ }
+ }
+
+ public DataDir HelperTable {
+ get {
+ return helper;
+ }
+ set {
+ helper = value;
+ }
+ }
+
+ public DataDir DynamicInfo {
+ get {
+ return dynInfo;
+ }
+ set {
+ dynInfo = value;
+ }
+ }
+
+ public DataDir DelayLoadInfo {
+ get {
+ return delayInfo;
+ }
+ set {
+ delayInfo = value;
+ }
+ }
+
+ public DataDir ModuleImage {
+ get {
+ return modImg;
+ }
+ set {
+ modImg = value;
+ }
+ }
+
+ public DataDir ExternalFixups {
+ get {
+ return extFixups;
+ }
+ set {
+ extFixups = value;
+ }
+ }
+
+ public DataDir RidMap {
+ get {
+ return ridMap;
+ }
+ set {
+ ridMap = value;
+ }
+ }
+
+ public DataDir DebugMap {
+ get {
+ return dbgMap;
+ }
+ set {
+ dbgMap = value;
+ }
+ }
+
+
+ public DataDir IPMap {
+ get {
+ return ipMap;
+ }
+ set {
+ ipMap = value;
+ }
+ }
+
+
+ unsafe public void Read(BinaryReader reader)
+ {
+ // TODO: clear structure before reading to initialize/reset
+ // unused fields. initblk would be great.
+
+ // Read exactly the number of bytes as specified in the header.
+ // This number is duplicated in PEHeader::CLIHdrDir.
+ cb = reader.ReadUInt32();
+ if (cb > sizeof(uint)) {
+ fixed (void* ptr = &this.runtimeMaj, pThis = &this) {
+ PEUtils.ReadStruct(reader, ptr, (int)cb - sizeof (uint));
+ if (!System.BitConverter.IsLittleEndian) {
+ // fix entries on big-endian machine
+ // preserving cb
+ uint oldcb = cb;
+ PEUtils.ChangeStructEndianess(pThis, typeof (CorHeader));
+ cb = oldcb;
+ }
+ }
+ }
+ }
+
+
+ public void Dump(TextWriter writer)
+ {
+ writer.WriteLine(String.Format (
+ "Header Size : {0}" + Environment.NewLine +
+ "Runtime Version : {1}" + Environment.NewLine +
+ "MetaData Root : {2}" + Environment.NewLine +
+ "Flags : {3}" + Environment.NewLine +
+ "Entry Point Token : {4}" + Environment.NewLine +
+ "Resources : {5}" + Environment.NewLine +
+ "Strong Name Signature : {6}" + Environment.NewLine +
+ "Code Manager Table : {7}" + Environment.NewLine +
+ "VTable Fixups : {8}" + Environment.NewLine +
+ "Export Address Table Jumps : {9}" + Environment.NewLine +
+ "EE Info Table : {10}" + Environment.NewLine +
+ "Helper Table : {11}" + Environment.NewLine +
+ "Dynamic Info : {12}" + Environment.NewLine +
+ "Delay Load Info : {13}" + Environment.NewLine +
+ "Module Image : {14}" + Environment.NewLine +
+ "External Fixups : {15}" + Environment.NewLine +
+ "Rid Map : {16}" + Environment.NewLine +
+ "Debug Map : {17}" + Environment.NewLine +
+ "IP Map : {18}" + Environment.NewLine,
+ cb + String.Format(" (0x{0})", cb.ToString("X")),
+ RuntimeVersion,
+ meta, flags, EntryPointToken,
+ rsrc, strongSig,
+ codeManTab, vtab, jumps,
+ eeInfo, helper, dynInfo, delayInfo, modImg, extFixups,
+ ridMap, dbgMap, ipMap
+ ));
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString() {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Mono.PEToolkit/DOSHeader.cs b/mcs/class/Mono.PEToolkit/DOSHeader.cs
new file mode 100644
index 00000000000..05120664d39
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/DOSHeader.cs
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit {
+
+ [StructLayout(LayoutKind.Explicit)]
+ public struct DOSHeader {
+ // Magic number (ExeSignature.DOS).
+ [FieldOffset(0*2)] public ExeSignature magic;
+
+ // Bytes on last page of file.
+ [FieldOffset(1*2)] public short cblp;
+
+ // Pages in file.
+ [FieldOffset(2*2)] public short cp;
+
+ // Relocations.
+ [FieldOffset(3*2)] public short crlc;
+
+ // Size of header in paragraphs.
+ [FieldOffset(4*2)] public short cparhdr;
+
+ // Minimum extra paragraphs needed.
+ [FieldOffset(5*2)] public short minalloc;
+
+ // Maximum extra paragraphs needed.
+ [FieldOffset(6*2)] public short maxalloc;
+
+ // Initial (relative) SS value.
+ [FieldOffset(7*2)] public short ss;
+
+ // Initial SP value.
+ [FieldOffset(8*2)] public short sp;
+
+ // Checksum.
+ [FieldOffset(9*2)] public short csum;
+
+ // Initial IP value.
+ [FieldOffset(10*2)] public short ip;
+
+ // Initial (relative) CS value.
+ [FieldOffset(11*2)] public short cs;
+
+ // File address of relocation table.
+ [FieldOffset(12*2)] public short lfarlc;
+
+ // Overlay number.
+ [FieldOffset(13*2)] public short ovno;
+
+ // Reserved words.
+ // short[4] res;
+
+ // OEM identifier (for e_oeminfo).
+ [FieldOffset(18*2)] public short oemid;
+
+ // OEM information; e_oemid specific.
+ [FieldOffset(19*2)] public short oeminfo;
+
+ // Reserved words
+ // short[10] res2;
+
+ // File address of new exe header.
+ [FieldOffset(30*2)] public uint lfanew;
+
+
+
+ /// <summary>
+ /// </summary>
+ unsafe public void Read(BinaryReader reader)
+ {
+ fixed (void* pThis = &this) {
+ PEUtils.ReadStruct(reader, pThis, sizeof (DOSHeader), typeof (DOSHeader));
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <param name="writer"></param>
+ public void Dump(TextWriter writer)
+ {
+ writer.WriteLine(
+ "Number of pages : {0}" + Environment.NewLine +
+ "Bytes on last pages : {1}" + Environment.NewLine +
+ "New header offset : {2}" + Environment.NewLine +
+ "Initial CS:IP : {3}:{4}" + Environment.NewLine +
+ "Initial SS:SP : {5}:{6}" + Environment.NewLine +
+ "Overlay number : {7}" + Environment.NewLine,
+ cp, cblp,
+ lfanew + " (0x" + lfanew.ToString("X") + ")",
+ cs.ToString("X"), ip.ToString("X"),
+ ss.ToString("X"), sp.ToString("X"),
+ ovno
+ );
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/DataDir.cs b/mcs/class/Mono.PEToolkit/DataDir.cs
new file mode 100644
index 00000000000..c4b7bfcab98
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/DataDir.cs
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit {
+
+ /// <summary>
+ /// IMAGE_DATA_DIRECTORY.
+ /// </summary>
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct DataDir {
+
+ public static readonly DataDir Null;
+
+ public RVA virtAddr;
+ public uint size;
+
+ static DataDir ()
+ {
+ Null.virtAddr = 0;
+ Null.size = 0;
+ }
+
+
+ public RVA VirtualAddress {
+ get {
+ return virtAddr;
+ }
+ set {
+ virtAddr = value;
+ }
+ }
+
+ public uint Size {
+ get {
+ return size;
+ }
+ set {
+ size = value;
+ }
+ }
+
+ public bool IsNull {
+ get {
+ return (this == Null);
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return (virtAddr.GetHashCode() ^ (int)(size << 1));
+ }
+
+ public override bool Equals(object obj)
+ {
+ bool res = (obj is DataDir);
+ if (res) {
+ DataDir that = (DataDir) obj;
+ res = (this.virtAddr == that.virtAddr) &&
+ (this.size == that.size);
+ }
+ return res;
+ }
+
+ public static bool operator == (DataDir d1, DataDir d2)
+ {
+ return d1.Equals(d2);
+ }
+
+ public static bool operator != (DataDir d1, DataDir d2)
+ {
+ return !d1.Equals(d2);
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ if (this.IsNull) return "NULL";
+ return String.Format("RVA = {0}, size = 0x{1}", virtAddr, size.ToString("X"));
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/ExeSignature.cs b/mcs/class/Mono.PEToolkit/ExeSignature.cs
new file mode 100644
index 00000000000..a8faff3e8e5
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/ExeSignature.cs
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+namespace Mono.PEToolkit {
+
+ public enum ExeSignature : ushort {
+
+ UNKNOWN = 0,
+
+ /// <summary>
+ /// "MZ"
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_DOS_SIGNATURE
+ /// </remarks>
+ DOS = 0x5A4D,
+
+
+ /// <summary>
+ /// "NE"
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_OS2_SIGNATURE
+ /// </remarks>
+ OS2 = 0x454E,
+
+
+ /// <summary>
+ /// "LE"
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_OS2_SIGNATURE_LE
+ /// </remarks>
+ OS2_LE = 0x454C,
+
+
+ /// <summary>
+ /// "LE"
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_VXD_SIGNATURE
+ /// </remarks>
+ VXD = OS2_LE,
+
+
+ /// <summary>
+ /// "PE", the complete signature is "PE\0\0"
+ /// (that is, NT followed by NT2).
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_NT_SIGNATURE
+ /// </remarks>
+ NT = 0x4550,
+ NT2 = 0
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/Image.cs b/mcs/class/Mono.PEToolkit/Image.cs
new file mode 100644
index 00000000000..c1399c7faf0
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/Image.cs
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+using Mono.PEToolkit.Metadata;
+
+namespace Mono.PEToolkit {
+
+ public class Image : IDisposable {
+
+ internal DOSHeader dosHdr;
+ internal COFFHeader coffHdr;
+ internal PEHeader peHdr;
+
+ internal CorHeader corHdr;
+
+ internal Hashtable sections;
+ // File position right after PEHeader (NT Optional Header).
+ protected long sectionsPos;
+
+ private MetaDataRoot mdRoot;
+
+ private string name;
+ private bool open;
+ internal BinaryReader reader;
+
+ public Image(string name)
+ {
+ this.name = name;
+ open = false;
+ reader = null;
+
+ mdRoot = null;
+
+ dosHdr = new DOSHeader();
+ coffHdr = new COFFHeader();
+ peHdr = new PEHeader();
+ corHdr = new CorHeader();
+
+ sections = new Hashtable();
+ sectionsPos = -1;
+ }
+
+ ~Image()
+ {
+ Close();
+ }
+
+
+ public Hashtable Sections {
+ get {
+ return sections;
+ }
+ }
+
+ public void Open()
+ {
+ lock (this) if (!open) {
+ FileInfo pe = new FileInfo(name);
+ if (!pe.Exists) {
+ throw new Exception("Invalid file path.");
+ }
+
+ reader = new BinaryReader(new BufferedStream(pe.OpenRead()));
+ if (!reader.BaseStream.CanSeek) {
+ throw new Exception("Can't seek.");
+ }
+
+ open = true;
+ }
+ }
+
+ public void Close()
+ {
+ lock (this) if (open) {
+ reader.Close();
+ open = false;
+ }
+ }
+
+ // IDisposable
+ public void Dispose()
+ {
+ Close();
+ }
+
+
+ public bool IsCLI {
+ get {
+ return peHdr.IsCLIImage;
+ }
+ }
+
+ public MetaDataRoot MetadataRoot {
+ get {
+ return mdRoot;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public void ReadHeaders()
+ {
+ if (!open) {
+ throw new Exception("You must open image before trying to read it.");
+ }
+
+ dosHdr.Read(reader);
+ reader.BaseStream.Position = dosHdr.lfanew;
+ ExeSignature peSig = (ExeSignature) reader.ReadUInt16();
+ if (peSig != ExeSignature.NT) {
+ throw new Exception ("Invalid image format: cannot find PE signature.");
+ }
+ peSig = (ExeSignature) reader.ReadUInt16();
+ if (peSig != ExeSignature.NT2) {
+ throw new Exception ("Invalid image format: cannot find PE signature.");
+ }
+
+ coffHdr.Read(reader);
+ peHdr.Read(reader);
+ sectionsPos = reader.BaseStream.Position;
+ ReadSections();
+
+ if (this.IsCLI) {
+ reader.BaseStream.Position = RVAToVA(peHdr.CLIHdrDir.virtAddr);
+ corHdr.Read(reader);
+
+ mdRoot = new MetaDataRoot(this);
+ reader.BaseStream.Position = RVAToVA(corHdr.MetaData.virtAddr);
+ mdRoot.Read(reader);
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ protected void ReadSections()
+ {
+ if (sectionsPos < 0) {
+ throw new Exception("Read headers first.");
+ }
+ reader.BaseStream.Position = sectionsPos;
+
+ int n = coffHdr.NumberOfSections;
+ for (int i = n; --i >=0;) {
+ Section sect = new Section();
+ sect.Read(reader);
+ sections [sect.Name] = sect;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <param name="writer"></param>
+ public void Dump(TextWriter writer)
+ {
+ writer.WriteLine (
+ dosHdr.ToString() + Environment.NewLine +
+ coffHdr.ToString() + Environment.NewLine +
+ peHdr.ToString() + Environment.NewLine +
+ corHdr.ToString()
+ );
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+
+ /// <summary>
+ /// Returns name of the section for the given RVA.
+ /// </summary>
+ /// <param name="rva"></param>
+ /// <returns></returns>
+ public string RVAToSectionName(RVA rva)
+ {
+ string res = null;
+ foreach (Section s in Sections.Values) {
+ RVA sva = s.VirtualAddress;
+ if (rva >= sva && rva < sva + s.SizeOfRawData) {
+ res = s.Name;
+ break;
+ }
+ }
+ return res;
+ }
+
+ public long RVAToVA(RVA rva)
+ {
+ string sectName = RVAToSectionName(rva);
+ long res = 0;
+ if (sectName != null) {
+ Section s = (Section) Sections [sectName];
+ res = rva + (s.PointerToRawData - s.VirtualAddress);
+ }
+ return res;
+ }
+
+ public MetaDataRoot MetaDataRoot {
+ get {
+ return mdRoot;
+ }
+ }
+
+ public void DumpStreamHeader(TextWriter writer, string name)
+ {
+ if (mdRoot == null || name == null || name == String.Empty || writer == null) return;
+ writer.Write(name + " header: ");
+ MDStream s = MetaDataRoot.Streams[name] as MDStream;
+ if (s != null) {
+ writer.WriteLine();
+ writer.WriteLine(s);
+ } else {
+ writer.WriteLine("not present.");
+ writer.WriteLine();
+ }
+ }
+
+ public void DumpStreamHeader(string name)
+ {
+ DumpStreamHeader(Console.Out, name);
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/LEBitConverter.cs b/mcs/class/Mono.PEToolkit/LEBitConverter.cs
new file mode 100644
index 00000000000..25bfb5cd6d3
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/LEBitConverter.cs
@@ -0,0 +1,251 @@
+
+// Auto-generated file - DO NOT EDIT!
+// Please edit bitconverter.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit {
+
+ /// <summary>
+ /// Little-endian bit converter.
+ /// </summary>
+ public sealed class LEBitConverter {
+
+ internal interface IConverter {
+
+ short ToInt16(byte [] val, int idx);
+ ushort ToUInt16(byte [] val, int idx);
+ int ToInt32(byte [] val, int idx);
+ uint ToUInt32(byte [] val, int idx);
+ long ToInt64(byte [] val, int idx);
+ ulong ToUInt64(byte [] val, int idx);
+
+ }
+
+ public static readonly bool Native = System.BitConverter.IsLittleEndian;
+
+ private static readonly IConverter impl = System.BitConverter.IsLittleEndian
+ ? new LEConverter() as IConverter
+ : new BEConverter() as IConverter;
+
+
+
+
+ private LEBitConverter()
+ {
+ // Never instantiated.
+ }
+
+ ///<summary></summary>
+ unsafe public static short SwapInt16(short x)
+ {
+ short* p = stackalloc short [1];
+ *p = x;
+ byte* bp = (byte*) p;
+ byte b = bp [0];
+ bp [0] = bp [1];
+ bp [1] = b;
+ return *p;
+ }
+
+ ///<summary></summary>
+ unsafe public static ushort SwapUInt16(ushort x)
+ {
+ ushort* p = stackalloc ushort [1];
+ *p = x;
+ byte* bp = (byte*) p;
+ byte b = bp [0];
+ bp [0] = bp [1];
+ bp [1] = b;
+ return *p;
+ }
+
+ ///<summary></summary>
+ unsafe public static int SwapInt32(int x)
+ {
+ int* p = stackalloc int [1];
+ *p = x;
+ byte* bp = (byte*) p;
+ byte b = bp [0];
+ bp [0] = bp [3];
+ bp [3] = b;
+ b = bp [1];
+ bp [1] = bp [2];
+ bp [2] = b;
+ return *p;
+ }
+
+ ///<summary></summary>
+ unsafe public static uint SwapUInt32(uint x)
+ {
+ uint* p = stackalloc uint [1];
+ *p = x;
+ byte* bp = (byte*) p;
+ byte b = bp [0];
+ bp [0] = bp [3];
+ bp [3] = b;
+ b = bp [1];
+ bp [1] = bp [2];
+ bp [2] = b;
+ return *p;
+ }
+
+ ///<summary></summary>
+ unsafe public static long SwapInt64(long x)
+ {
+ long* p = stackalloc long [1];
+ *p = x;
+ byte* bp = (byte*) p;
+ byte b = bp [0];
+ bp [0] = bp [7];
+ bp [7] = b;
+ b = bp [1];
+ bp [1] = bp [6];
+ bp [6] = b;
+ b = bp [2];
+ bp [2] = bp [5];
+ bp [5] = b;
+ b = bp [3];
+ bp [3] = bp [4];
+ bp [4] = b;
+ return *p;
+ }
+
+ ///<summary></summary>
+ unsafe public static ulong SwapUInt64(ulong x)
+ {
+ ulong* p = stackalloc ulong [1];
+ *p = x;
+ byte* bp = (byte*) p;
+ byte b = bp [0];
+ bp [0] = bp [7];
+ bp [7] = b;
+ b = bp [1];
+ bp [1] = bp [6];
+ bp [6] = b;
+ b = bp [2];
+ bp [2] = bp [5];
+ bp [5] = b;
+ b = bp [3];
+ bp [3] = bp [4];
+ bp [4] = b;
+ return *p;
+ }
+
+
+
+
+
+ internal sealed class LEConverter : IConverter {
+ ///<summary></summary>
+ public short ToInt16(byte [] val, int idx)
+ {
+ return BitConverter.ToInt16(val, idx);
+ }
+ ///<summary></summary>
+ public ushort ToUInt16(byte [] val, int idx)
+ {
+ return BitConverter.ToUInt16(val, idx);
+ }
+ ///<summary></summary>
+ public int ToInt32(byte [] val, int idx)
+ {
+ return BitConverter.ToInt32(val, idx);
+ }
+ ///<summary></summary>
+ public uint ToUInt32(byte [] val, int idx)
+ {
+ return BitConverter.ToUInt32(val, idx);
+ }
+ ///<summary></summary>
+ public long ToInt64(byte [] val, int idx)
+ {
+ return BitConverter.ToInt64(val, idx);
+ }
+ ///<summary></summary>
+ public ulong ToUInt64(byte [] val, int idx)
+ {
+ return BitConverter.ToUInt64(val, idx);
+ }
+
+ }
+
+ internal sealed class BEConverter : IConverter {
+ ///<summary></summary>
+ public short ToInt16(byte [] val, int idx)
+ {
+ return SwapInt16(BitConverter.ToInt16(val, idx));
+ }
+ ///<summary></summary>
+ public ushort ToUInt16(byte [] val, int idx)
+ {
+ return SwapUInt16(BitConverter.ToUInt16(val, idx));
+ }
+ ///<summary></summary>
+ public int ToInt32(byte [] val, int idx)
+ {
+ return SwapInt32(BitConverter.ToInt32(val, idx));
+ }
+ ///<summary></summary>
+ public uint ToUInt32(byte [] val, int idx)
+ {
+ return SwapUInt32(BitConverter.ToUInt32(val, idx));
+ }
+ ///<summary></summary>
+ public long ToInt64(byte [] val, int idx)
+ {
+ return SwapInt64(BitConverter.ToInt64(val, idx));
+ }
+ ///<summary></summary>
+ public ulong ToUInt64(byte [] val, int idx)
+ {
+ return SwapUInt64(BitConverter.ToUInt64(val, idx));
+ }
+
+ }
+
+
+
+
+ ///<summary></summary>
+ public static short ToInt16(byte [] val, int idx)
+ {
+ return impl.ToInt16(val, idx);
+ }
+
+ ///<summary></summary>
+ public static ushort ToUInt16(byte [] val, int idx)
+ {
+ return impl.ToUInt16(val, idx);
+ }
+
+ ///<summary></summary>
+ public static int ToInt32(byte [] val, int idx)
+ {
+ return impl.ToInt32(val, idx);
+ }
+
+ ///<summary></summary>
+ public static uint ToUInt32(byte [] val, int idx)
+ {
+ return impl.ToUInt32(val, idx);
+ }
+
+ ///<summary></summary>
+ public static long ToInt64(byte [] val, int idx)
+ {
+ return impl.ToInt64(val, idx);
+ }
+
+ ///<summary></summary>
+ public static ulong ToUInt64(byte [] val, int idx)
+ {
+ return impl.ToUInt64(val, idx);
+ }
+
+
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/MachineId.cs b/mcs/class/Mono.PEToolkit/MachineId.cs
new file mode 100644
index 00000000000..f0c598e1ea8
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/MachineId.cs
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+namespace Mono.PEToolkit {
+
+ public enum MachineId : ushort {
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_UNKNOWN
+ /// </remarks>
+ UNKNOWN = 0,
+
+ /// <summary>
+ /// Intel 386.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_I386
+ /// </remarks>
+ I386 = 0x014c,
+
+ /// <summary>
+ /// Intel 486.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ I486 = 0x014d,
+
+ /// <summary>
+ /// Intel Pentium.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ PENTIUM = 0x014e,
+
+ /// <summary>
+ /// MIPS 3K big-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_R3000
+ /// </remarks>
+ R3000_BE = 0x0160,
+
+ /// <summary>
+ /// MIPS 3K little-endian, 0x160 big-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_R3000
+ /// </remarks>
+ R3000 = 0x0162,
+
+ /// <summary>
+ /// MIPS 4K little-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_R4000
+ /// </remarks>
+ R4000 = 0x0166,
+
+ /// <summary>
+ /// MIPS little-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_R10000
+ /// </remarks>
+ R10000 = 0x0168,
+
+ /// <summary>
+ /// MIPS little-endian WCE v2
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_WCEMIPSV2
+ /// </remarks>
+ WCEMIPSV2 = 0x0169,
+
+ /// <summary>
+ /// Alpha_AXP
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_ALPHA
+ /// </remarks>
+ ALPHA = 0x0184,
+
+ /// <summary>
+ /// SH3 little-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_SH3
+ /// </remarks>
+ SH3 = 0x01a2,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_SH3DSP
+ /// </remarks>
+ SH3DSP = 0x01a3,
+
+ /// <summary>
+ /// SH3E little-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_SH3E
+ /// </remarks>
+ SH3E = 0x01a4,
+
+ /// <summary>
+ /// SH4 little-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_SH4
+ /// </remarks>
+ SH4 = 0x01a6,
+
+ /// <summary>
+ /// SH5
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_SH5
+ /// </remarks>
+ SH5 = 0x01a8,
+
+ /// <summary>
+ /// ARM Little-Endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_ARM
+ /// </remarks>
+ ARM = 0x01c0,
+
+ /// <summary>
+ /// ARM 10 Thumb family CPU.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_THUMB
+ /// http://www.arm.com/armtech/ARM10_Thumb?OpenDocument&ExpandSection=2
+ /// </remarks>
+ THUMB = 0x01c2,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_AM33
+ /// </remarks>
+ AM33 = 0x01d3,
+
+ /// <summary>
+ /// IBM PowerPC Little-Endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_POWERPC
+ /// </remarks>
+ POWERPC = 0x01F0,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_POWERPCFP
+ /// </remarks>
+ POWERPCFP = 0x01f1,
+
+ /// <summary>
+ /// Intel 64
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_IA64
+ /// </remarks>
+ IA64 = 0x0200,
+
+ /// <summary>
+ /// MIPS
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_MIPS16
+ /// </remarks>
+ MIPS16 = 0x0266,
+
+ /// <summary>
+ /// ALPHA64
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_ALPHA64
+ /// </remarks>
+ ALPHA64 = 0x0284,
+
+ /// <summary>
+ /// MIPS
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_MIPSFPU
+ /// </remarks>
+ MIPSFPU = 0x0366,
+
+ /// <summary>
+ /// MIPS
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_MIPSFPU16
+ /// </remarks>
+ MIPSFPU16 = 0x0466,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_AXP64
+ /// </remarks>
+ AXP64 = ALPHA64,
+
+ /// <summary>
+ /// Infineon
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_TRICORE
+ /// http://www.infineon.com/tricore
+ /// </remarks>
+ TRICORE = 0x0520,
+
+ /// <summary>
+ /// Common Executable Format (Windows CE).
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_CEF
+ /// </remarks>
+ CEF = 0x0CEF,
+
+ /// <summary>
+ /// EFI Byte Code
+ /// </summary>
+ EBC = 0x0EBC,
+
+ /// <summary>
+ /// AMD64 (K8)
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_AMD64
+ /// </remarks>
+ AMD64 = 0x8664,
+
+ /// <summary>
+ /// M32R little-endian
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_M32R
+ /// </remarks>
+ M32R = 0x9104,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_FILE_MACHINE_CEE
+ /// </remarks>
+ CEE = 0xC0EE,
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/PEHeader.cs b/mcs/class/Mono.PEToolkit/PEHeader.cs
new file mode 100644
index 00000000000..8da65d10a85
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/PEHeader.cs
@@ -0,0 +1,558 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit {
+
+ // IMAGE_OPTIONAL_HEADER
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct PEHeader {
+
+ /// <summary>
+ /// Standard PE/COFF fields.
+ /// </summary>
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct StdFields {
+ internal short magic; // always 0x10B?
+ internal byte lMajor;
+ internal byte lMinor;
+ internal uint codeSize;
+ internal uint initDataSize;
+ internal uint uninitDataSize;
+ internal RVA entryRVA;
+ internal RVA codeBase;
+ internal RVA dataBase;
+
+
+ /// <summary>
+ /// </summary>
+ public string LinkerVersion {
+ get {
+ return String.Format("{0}.{1}", lMajor, lMinor);
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString() {
+ return String.Format(
+ "Magic : 0x{0}" + Environment.NewLine +
+ "Linker ver. : {1}" + Environment.NewLine +
+ "Size of code : {2}" + Environment.NewLine +
+ "Size of initialized data : {3}" + Environment.NewLine +
+ "Size of uinitialized data (BSS) : {4}" + Environment.NewLine,
+ magic.ToString("X"), LinkerVersion,
+ codeSize, initDataSize, uninitDataSize
+ );
+ }
+ }
+
+
+ /// <summary>
+ /// Windows-specific fields.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, 24.2.3.2
+ /// </remarks>
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct NTFields {
+ internal uint imgBase;
+ internal uint sectAlign;
+ internal uint fileAlign;
+ internal short osMaj;
+ internal short osMin;
+ internal short imgMaj;
+ internal short imgMin;
+ internal short subSysMaj;
+ internal short subSysMin;
+ internal int reserved_win32ver;
+ internal uint imgSize;
+ internal uint hdrSize;
+ internal uint chksum;
+ internal Subsystem subSys;
+ internal short dllFlags;
+ internal uint stackRes;
+ internal uint stackCommit;
+ internal uint heapRes;
+ internal uint heapCommit;
+ internal uint ldrFlags;
+ internal uint numDirs;
+
+ public string OSVersion {
+ get {
+ return String.Format("{0}.{1}", osMaj, osMin);
+ }
+ }
+
+ public string ImageVersion {
+ get {
+ return String.Format("{0}.{1}", imgMaj, imgMin);
+ }
+ }
+
+ public string SubsysVersion {
+ get {
+ return String.Format("{0}.{1}", subSysMaj, subSysMin);
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString() {
+ return String.Format(
+ "Image Base : 0x{0}" + Environment.NewLine +
+ "Section Alignment : 0x{1}" + Environment.NewLine +
+ "File Alignment : 0x{2}" + Environment.NewLine +
+ "OS Version : {3}" + Environment.NewLine +
+ "Image Version : {4}" + Environment.NewLine +
+ "Subsystem Version : {5}" + Environment.NewLine +
+ "Reserved/Win32Ver : {6}" + Environment.NewLine +
+ "Image Size : {7}" + Environment.NewLine +
+ "Header Size : {8}" + Environment.NewLine +
+ "Checksum : 0x{9}" + Environment.NewLine +
+ "Subsystem : {10}" + Environment.NewLine +
+ "DLL Flags : {11}" + Environment.NewLine +
+ "Stack Reserve Size : 0x{12}" + Environment.NewLine +
+ "Stack Commit Size : 0x{13}" + Environment.NewLine +
+ "Heap Reserve Size : 0x{14}" + Environment.NewLine +
+ "Heap Commit Size : 0x{15}" + Environment.NewLine +
+ "Loader Flags : {16}" + Environment.NewLine +
+ "Number of Directories : {17}" + Environment.NewLine,
+ imgBase.ToString("X"), sectAlign.ToString("X"), fileAlign.ToString("X"),
+ OSVersion, ImageVersion, SubsysVersion,
+ reserved_win32ver,
+ imgSize, hdrSize, chksum.ToString("X"), subSys, dllFlags,
+ stackRes.ToString("X"), stackCommit.ToString("X"), heapRes.ToString("X"), heapCommit.ToString ("X"),
+ ldrFlags, numDirs
+ );
+ }
+ }
+
+
+ internal StdFields stdFlds;
+ internal NTFields ntFlds;
+
+ internal DataDir exportDir;
+ internal DataDir importDir;
+ internal DataDir resourceDir;
+ internal DataDir exceptionDir;
+ internal DataDir securityDir;
+ internal DataDir baseRelocDir;
+ internal DataDir debugDir;
+ internal DataDir copyrightDir;
+ internal DataDir GPDir;
+ internal DataDir TLSDir;
+ internal DataDir loadCfgDir;
+ internal DataDir boundImpDir;
+ internal DataDir IATDir;
+ internal DataDir delayImpDir;
+ internal DataDir CLIHdrDir;
+ internal DataDir reservedDir;
+
+
+ public bool IsCLIImage {
+ get {
+ return (CLIHdrDir.virtAddr.Value != 0);
+ }
+ }
+
+
+ //
+ // Accessors for standard COFF fields.
+ //
+
+ public short Magic {
+ get {
+ return stdFlds.magic;
+ }
+ set {
+ stdFlds.magic = value;
+ }
+ }
+
+ public byte MajorLinkerVersion {
+ get {
+ return stdFlds.lMajor;
+ }
+ set {
+ stdFlds.lMajor = value;
+ }
+ }
+
+ public byte MinorLinkerVersion {
+ get {
+ return stdFlds.lMinor;
+ }
+ set {
+ stdFlds.lMinor = value;
+ }
+ }
+
+ public uint SizeOfCode {
+ get {
+ return stdFlds.codeSize;
+ }
+ set {
+ stdFlds.codeSize = value;
+ }
+ }
+
+ public uint SizeOfInitializedData {
+ get {
+ return stdFlds.initDataSize;
+ }
+ set {
+ stdFlds.initDataSize = value;
+ }
+ }
+
+ public uint SizeOfUninitializedData {
+ get {
+ return stdFlds.uninitDataSize;
+ }
+ set {
+ stdFlds.uninitDataSize = value;
+ }
+ }
+
+ public RVA AddressOfEntryPoint {
+ get {
+ return stdFlds.entryRVA;
+ }
+ set {
+ stdFlds.entryRVA.value = value.value;
+ }
+ }
+
+ public RVA BaseOfCode {
+ get {
+ return stdFlds.codeBase;
+ }
+ set {
+ stdFlds.codeBase.value = value.value;
+ }
+ }
+
+ public RVA BaseOfData {
+ get {
+ return stdFlds.dataBase;
+ }
+ set {
+ stdFlds.dataBase.value = value.value;
+ }
+ }
+
+
+ //
+ // Accessors for Windows-specific fields.
+ //
+
+
+ /// <summary>
+ /// Preferred address of image when loaded into memory.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This is a linear address and not RVA,
+ /// and must be a multiple of 64K.
+ /// </para>
+ /// <para>
+ /// Table in the Partition II states that for CIL images
+ /// it must be 0x400000.
+ /// </para>
+ /// </remarks>
+ public uint ImageBase {
+ get {
+ return ntFlds.imgBase;
+ }
+ set {
+ ntFlds.imgBase = value;
+ }
+ }
+
+ /// <summary>
+ /// Alignment of section when loaded into memory.
+ /// </summary>
+ /// <remarks>
+ /// Must be greater or equal to FileAlignment.
+ /// Default is the native page size.
+ /// According to specs for CIL images it must be set to 8K.
+ /// </remarks>
+ public uint SectionAlignment {
+ get {
+ return ntFlds.sectAlign;
+ }
+ set {
+ ntFlds.sectAlign = value;
+ }
+ }
+
+ /// <summary>
+ /// Byte alignment of pages in image file.
+ /// </summary>
+ /// <remarks>
+ /// Valid values are powers of 2 between 512 and 64K.
+ /// For CIL images it must be either 512 or 4K.
+ /// </remarks>
+ public uint FileAlignment {
+ get {
+ return ntFlds.fileAlign;
+ }
+ set {
+ ntFlds.fileAlign = value;
+ }
+ }
+
+
+ public short MajorOperatingSystemVersion {
+ get {
+ return ntFlds.osMaj;
+ }
+ set {
+ ntFlds.osMaj = value;
+ }
+ }
+
+ public short MinorOperatingSystemVersion {
+ get {
+ return ntFlds.osMin;
+ }
+ set {
+ ntFlds.osMin = value;
+ }
+ }
+
+ public short MajorImageVersion {
+ get {
+ return ntFlds.imgMaj;
+ }
+ set {
+ ntFlds.imgMaj = value;
+ }
+ }
+
+ public short MinorImageVersion {
+ get {
+ return ntFlds.imgMin;
+ }
+ set {
+ ntFlds.imgMin = value;
+ }
+ }
+
+ public short MajorSubsystemVersion {
+ get {
+ return ntFlds.subSysMaj;
+ }
+ set {
+ ntFlds.subSysMaj = value;
+ }
+ }
+
+ public short MinorSubsystemVersion {
+ get {
+ return ntFlds.subSysMin;
+ }
+ set {
+ ntFlds.subSysMin = value;
+ }
+ }
+
+ public int Win32VersionValue {
+ get {
+ return ntFlds.reserved_win32ver;
+ }
+ set {
+ ntFlds.reserved_win32ver = value;
+ }
+ }
+
+ public int Reserved {
+ get {
+ return ntFlds.reserved_win32ver;
+ }
+ set {
+ ntFlds.reserved_win32ver = value;
+ }
+ }
+
+ public uint SizeOfImage {
+ get {
+ return ntFlds.imgSize;
+ }
+ set {
+ ntFlds.imgSize = value;
+ }
+ }
+
+ public uint SizeOfHeaders {
+ get {
+ return ntFlds.hdrSize;
+ }
+ set {
+ ntFlds.hdrSize = value;
+ }
+ }
+
+ public uint CheckSum {
+ get {
+ return ntFlds.chksum;
+ }
+ set {
+ ntFlds.chksum = value;
+ }
+ }
+
+ public Subsystem Subsystem {
+ get {
+ return ntFlds.subSys;
+ }
+ set {
+ ntFlds.subSys = value;
+ }
+ }
+
+ public short DllCharacteristics {
+ get {
+ return ntFlds.dllFlags;
+ }
+ set {
+ ntFlds.dllFlags = value;
+ }
+ }
+
+
+ public uint SizeOfStackReserve {
+ get {
+ return ntFlds.stackRes;
+ }
+ set {
+ ntFlds.stackRes = value;
+ }
+ }
+
+ public uint SizeOfStackCommit {
+ get {
+ return ntFlds.stackCommit;
+ }
+ set {
+ ntFlds.stackCommit = value;
+ }
+ }
+
+ public uint SizeOfHeapReserve {
+ get {
+ return ntFlds.heapRes;
+ }
+ set {
+ ntFlds.heapRes = value;
+ }
+ }
+
+ public uint SizeOfHeapCommit {
+ get {
+ return ntFlds.heapCommit;
+ }
+ set {
+ ntFlds.heapCommit = value;
+ }
+ }
+
+ public uint LoaderFlags {
+ get {
+ return ntFlds.ldrFlags;
+ }
+ set {
+ ntFlds.ldrFlags = value;
+ }
+ }
+
+ public uint NumberOfRvaAndSizes {
+ get {
+ return ntFlds.numDirs;
+ }
+ set {
+ ntFlds.numDirs = value;
+ }
+ }
+
+
+
+
+
+ /// <summary>
+ /// </summary>
+ unsafe public void Read(BinaryReader reader)
+ {
+ fixed (void* pThis = &this) {
+ int hdrSize = sizeof (StdFields) + sizeof (NTFields);
+ PEUtils.ReadStruct(reader, pThis, hdrSize);
+ PEUtils.ReadStruct(reader, (byte*)pThis + hdrSize, (int) NumberOfRvaAndSizes * sizeof (DataDir));
+
+ if (!System.BitConverter.IsLittleEndian) {
+ PEUtils.ChangeStructEndianess(pThis, typeof (PEHeader));
+ }
+ }
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer)
+ {
+ string dirs = String.Format(
+ "Export Table : {0}" + Environment.NewLine +
+ "Import Table : {1}" + Environment.NewLine +
+ "Win32 Resource Table : {2}" + Environment.NewLine +
+ "Exception Table : {3}" + Environment.NewLine +
+ "Certificate Table : {4}" + Environment.NewLine +
+ "Base Relocation Table : {5}" + Environment.NewLine +
+ "Debug Table : {6}" + Environment.NewLine +
+ "Copyright : {7}" + Environment.NewLine +
+ "MIPS Global Ptr : {8}" + Environment.NewLine +
+ "TLS Table : {9}" + Environment.NewLine +
+ "Load Config Table : {10}" + Environment.NewLine +
+ "Bound Import : {11}" + Environment.NewLine +
+ "IAT : {12}" + Environment.NewLine +
+ "Delay Import Descriptor : {13}" + Environment.NewLine +
+ "CLI Header : {14}" + Environment.NewLine +
+ "Reserved : {15}" + Environment.NewLine,
+ exportDir, importDir, resourceDir, exceptionDir,
+ securityDir, baseRelocDir, debugDir, copyrightDir,
+ GPDir, TLSDir, loadCfgDir, boundImpDir, IATDir, delayImpDir,
+ CLIHdrDir, reservedDir
+ );
+
+ writer.WriteLine(
+ stdFlds.ToString() + Environment.NewLine +
+ ntFlds.ToString() + Environment.NewLine +
+ "Directories: "+ Environment.NewLine +
+ dirs
+ );
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/PEToolkit.build b/mcs/class/Mono.PEToolkit/PEToolkit.build
new file mode 100755
index 00000000000..31ed9e1ce9f
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/PEToolkit.build
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.PEToolkit.dll -->
+
+<project name="Mono.PEToolkit" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/Mono.PEToolkit.dll" debug="${debug}">
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ </csc>
+ </target>
+
+ <target name="clean">
+ <delete file="../lib/Mono.PEToolkit.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.PEToolkit/PEUtils.cs b/mcs/class/Mono.PEToolkit/PEUtils.cs
new file mode 100644
index 00000000000..1375a7ebec5
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/PEUtils.cs
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit {
+
+ public sealed class PEUtils {
+
+ private PEUtils()
+ {
+ }
+
+
+
+ /// <summary>
+ /// Reads structure from the input stream preserving its endianess.
+ /// </summary>
+ /// <param name="reader"></param>
+ /// <param name="pStruct"></param>
+ /// <param name="len"></param>
+ unsafe internal static void ReadStruct(BinaryReader reader, void* pStruct, int len)
+ {
+ byte* p = (byte*) pStruct;
+
+ if (System.BitConverter.IsLittleEndian) {
+ // On a little-endian machine read data in 64-bit chunks,
+ // this won't work on big-endian machine because
+ // BinaryReader APIs are little-endian while
+ // memory writes are platform-native.
+ // This seems faster than ReadBytes/Copy method
+ // in the "else" clause, especially if used often
+ // (no extra memory allocation for byte[]?).
+ int whole = len >> 3;
+ int rem = len & 7;
+
+ for (int i = whole; --i >= 0;) {
+ long qw = reader.ReadInt64();
+ Marshal.WriteInt64((IntPtr) p, qw);
+ p += sizeof (long);
+ }
+ for (int i = rem; --i >= 0;) {
+ *p++ = (byte) reader.ReadByte();
+ }
+ } else {
+ byte [] buff = reader.ReadBytes(len);
+ Marshal.Copy(buff, 0, (IntPtr) p, len);
+ }
+ }
+
+ /// <summary>
+ /// Reads structure from the input stream
+ /// changing its endianess if required
+ /// (if running on big-endian hardware).
+ /// </summary>
+ /// <param name="reader"></param>
+ /// <param name="pStruct"></param>
+ /// <param name="len"></param>
+ /// <param name="type"></param>
+ unsafe internal static void ReadStruct(BinaryReader reader, void* pStruct, int len, Type type)
+ {
+ ReadStruct(reader, pStruct, len);
+ if (!System.BitConverter.IsLittleEndian) {
+ ChangeStructEndianess(pStruct, type);
+ }
+ }
+
+
+ unsafe private static int SwapByTypeCode(byte* p, TypeCode tcode)
+ {
+ int inc = 0;
+ switch (tcode) {
+ case TypeCode.Int16 :
+ short* sp = (short*) p;
+ short sx = *sp;
+ sx = LEBitConverter.SwapInt16(sx);
+ *sp = sx;
+ inc = sizeof (short);
+ break;
+ case TypeCode.UInt16 :
+ ushort* usp = (ushort*) p;
+ ushort usx = *usp;
+ usx = LEBitConverter.SwapUInt16(usx);
+ *usp = usx;
+ inc = sizeof (ushort);
+ break;
+ case TypeCode.Int32 :
+ int* ip = (int*) p;
+ int ix = *ip;
+ ix = LEBitConverter.SwapInt32(ix);
+ *ip = ix;
+ inc = sizeof (int);
+ break;
+ case TypeCode.UInt32 :
+ uint* uip = (uint*) p;
+ uint uix = *uip;
+ uix = LEBitConverter.SwapUInt32(uix);
+ *uip = uix;
+ inc = sizeof (uint);
+ break;
+ case TypeCode.Int64 :
+ long* lp = (long*) p;
+ long lx = *lp;
+ lx = LEBitConverter.SwapInt64(lx);
+ *lp = lx;
+ inc = sizeof (long);
+ break;
+ case TypeCode.UInt64 :
+ ulong* ulp = (ulong*) p;
+ ulong ulx = *ulp;
+ ulx = LEBitConverter.SwapUInt64(ulx);
+ *ulp = ulx;
+ inc = sizeof (ulong);
+ break;
+ case TypeCode.Byte :
+ case TypeCode.SByte :
+ inc = sizeof (byte);
+ break;
+ default :
+ break;
+ }
+ return inc;
+ }
+
+ unsafe internal static int ChangeStructEndianess(void* pStruct, Type type)
+ {
+ if (type == null || !type.IsValueType) return 0;
+ if (!type.IsLayoutSequential && !type.IsExplicitLayout) {
+ throw new Exception("Internal error: struct must have explicit or sequential layout.");
+ }
+
+ bool seq = type.IsLayoutSequential;
+ byte* p = (byte*) pStruct;
+ int offs = 0;
+ int inc;
+ FieldInfo [] fields = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
+
+ foreach (FieldInfo fi in fields) {
+ if (!seq) offs = Marshal.OffsetOf(type, fi.Name).ToInt32 ();
+ Type ft = fi.FieldType;
+ TypeCode tcode = Type.GetTypeCode(ft);
+ if (tcode == TypeCode.Object) {
+ // not a primitive type, process recursively.
+ inc = ChangeStructEndianess(p + offs, ft);
+ } else {
+ inc = SwapByTypeCode(p + offs, tcode);
+ }
+ if (seq) offs += inc;
+ }
+
+ return offs;
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/README b/mcs/class/Mono.PEToolkit/README
new file mode 100644
index 00000000000..9229f3fffc9
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/README
@@ -0,0 +1 @@
+The PEToolkit was authored by Sergey Chaban (serge@wildwestsoftware.com)
diff --git a/mcs/class/Mono.PEToolkit/RVA.cs b/mcs/class/Mono.PEToolkit/RVA.cs
new file mode 100644
index 00000000000..14aee790781
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/RVA.cs
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit {
+
+ /// <summary>
+ /// Relative Virtual Address.
+ /// </summary>
+ public struct RVA {
+
+ public static readonly RVA Null;
+
+ public uint value;
+
+ static RVA()
+ {
+ Null = new RVA(0);
+ }
+
+
+ public RVA(uint val)
+ {
+ value = val;
+ }
+
+
+ public uint Value {
+ get {
+ return value;
+ }
+ set {
+ this.value = value;
+ }
+ }
+
+
+ public static implicit operator RVA (uint val)
+ {
+ return new RVA(val);
+ }
+
+ public static implicit operator uint (RVA rva)
+ {
+ return rva.value;
+ }
+
+ public override int GetHashCode()
+ {
+ return (int) value;
+ }
+
+ public override bool Equals(object o)
+ {
+ bool res = o is RVA;
+ if (res) res = (this.value == ((RVA)o).value);
+ return res;
+ }
+
+ public static bool operator == (RVA rva1, RVA rva2)
+ {
+ return rva1.Equals(rva2);
+ }
+
+ public static bool operator != (RVA rva1, RVA rva2)
+ {
+ return !rva1.Equals(rva2);
+ }
+
+ public static bool operator < (RVA rva1, RVA rva2)
+ {
+ return (rva1.value < rva2.value);
+ }
+
+ public static bool operator > (RVA rva1, RVA rva2) {
+ return (rva1.value > rva2.value);
+ }
+
+ public static bool operator <= (RVA rva1, RVA rva2)
+ {
+ return (rva1.value <= rva2.value);
+ }
+
+ public static bool operator >= (RVA rva1, RVA rva2)
+ {
+ return (rva1.value >= rva2.value);
+ }
+
+ public static RVA operator + (RVA rva, uint x)
+ {
+ return new RVA (rva.value + x);
+ }
+
+ public static RVA operator - (RVA rva, uint x)
+ {
+ return new RVA (rva.value - x);
+ }
+
+
+ public override string ToString()
+ {
+ if (this == Null) return "NULL";
+ return ("0x" + value.ToString("X"));
+ }
+
+ unsafe public static int Size {
+ get {
+ return sizeof (uint);
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/Section.cs b/mcs/class/Mono.PEToolkit/Section.cs
new file mode 100644
index 00000000000..2021b0c6695
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/Section.cs
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit {
+
+ public class Section {
+
+ // IMAGE_SECTION_HEADER
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct Header {
+ internal uint phAddr_virtSize;
+ internal RVA virtAddr;
+ internal uint rawSize;
+ internal RVA rawDataPtr;
+ internal RVA relocPtr;
+ internal RVA lineNumPtr;
+ internal short relocNum;
+ internal short linenumNum;
+ internal SectionCharacteristics flags;
+ }
+
+ private string name;
+ internal Header hdr;
+
+ public readonly static Section Invalid;
+
+ static Section()
+ {
+ Invalid = new Section();
+ }
+
+ public Section()
+ {
+ }
+
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+
+ public uint PhysicalAddress {
+ get {
+ return hdr.phAddr_virtSize;
+ }
+ set {
+ hdr.phAddr_virtSize = value;
+ }
+ }
+
+ public uint VirtualSize {
+ get {
+ return hdr.phAddr_virtSize;
+ }
+ set {
+ hdr.phAddr_virtSize = value;
+ }
+ }
+
+ public RVA VirtualAddress {
+ get {
+ return hdr.virtAddr;
+ }
+ set {
+ hdr.virtAddr = value;
+ }
+ }
+
+ public uint SizeOfRawData {
+ get {
+ return hdr.rawSize;
+ }
+ set {
+ hdr.rawSize = value;
+ }
+ }
+
+ public RVA PointerToRawData {
+ get {
+ return hdr.rawDataPtr;
+ }
+ set {
+ hdr.rawDataPtr = value;
+ }
+ }
+
+ public RVA PointerToRelocations {
+ get {
+ return hdr.relocPtr;
+ }
+ set {
+ hdr.relocPtr = value;
+ }
+ }
+
+ public RVA PointerToLinenumbers {
+ get {
+ return hdr.lineNumPtr;
+ }
+ set {
+ hdr.lineNumPtr = value;
+ }
+ }
+
+ public short NumberOfRelocations {
+ get {
+ return hdr.relocNum;
+ }
+ set {
+ hdr.relocNum = value;
+ }
+ }
+
+ public short NumberOfLinenumbers {
+ get {
+ return hdr.linenumNum;
+ }
+ set {
+ hdr.linenumNum = value;
+ }
+ }
+
+ public SectionCharacteristics Characteristics {
+ get {
+ return hdr.flags;
+ }
+ set {
+ hdr.flags = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ unsafe public void Read(BinaryReader reader)
+ {
+ sbyte* pName = stackalloc sbyte [8];
+ sbyte* p = pName;
+
+ for (int i = 8; --i >=0;) {
+ sbyte c = reader.ReadSByte();
+ if (c == 0) break;
+ *p++ = c;
+ }
+
+ int len = (int) (p - pName);
+ if (len != 0) {
+ name = new string(pName, 0, len, Encoding.ASCII);
+ } else {
+ name = String.Empty;
+ }
+
+ reader.BaseStream.Position += 8 - len - 1;
+
+ fixed (void* pHdr = &this.hdr) {
+ PEUtils.ReadStruct(reader, pHdr, sizeof (Header), typeof (Header));
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/SectionCharacteristics.cs b/mcs/class/Mono.PEToolkit/SectionCharacteristics.cs
new file mode 100644
index 00000000000..1b8b5ba6059
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/SectionCharacteristics.cs
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit {
+
+ [Flags]
+ public enum SectionCharacteristics : uint {
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_REG = 0x00000000,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_DSECT = 0x00000001,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_NOLOAD = 0x00000002,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_GROUP = 0x00000004,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_NO_PAD = 0x00000008,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_COPY = 0x00000010,
+
+ /// <summary>
+ /// Section contains code.
+ /// </summary>
+ IMAGE_SCN_CNT_CODE = 0x00000020,
+
+ /// <summary>
+ /// Section contains initialized data.
+ /// </summary>
+ IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
+
+ /// <summary>
+ /// Section contains uninitialized data.
+ /// </summary>
+ IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_LNK_OTHER = 0x00000100,
+
+ /// <summary>
+ /// Section contains comments or some other type of information.
+ /// </summary>
+ IMAGE_SCN_LNK_INFO = 0x00000200,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ IMAGE_SCN_TYPE_OVER = 0x00000400,
+
+ /// <summary>
+ /// Section contents will not become part of image.
+ /// </summary>
+ IMAGE_SCN_LNK_REMOVE = 0x00000800,
+
+ /// <summary>
+ /// Section contents comdat.
+ /// </summary>
+ IMAGE_SCN_LNK_COMDAT = 0x00001000,
+
+
+ /// <summary>
+ /// Reset speculative exceptions handling bits in the TLB entries for this section.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SCN_MEM_PROTECTED - Obsolete.
+ /// </remarks>
+ IMAGE_SCN_NO_DEFER_SPEC_EXC = 0x00004000,
+
+ /// <summary>
+ /// Section content can be accessed relative to GP (MIPS).
+ /// </summary>
+ IMAGE_SCN_GPREL = 0x00008000,
+
+ /// <summary>
+ /// </summary>
+ IMAGE_SCN_MEM_FARDATA = 0x00008000,
+
+ /// <summary>
+ /// Obsolete.
+ /// </summary>
+ IMAGE_SCN_MEM_PURGEABLE = 0x00020000,
+
+ /// <summary>
+ /// Obsolete.
+ /// </summary>
+ IMAGE_SCN_MEM_16BIT = 0x00020000,
+
+ /// <summary>
+ /// Obsolete.
+ /// </summary>
+ IMAGE_SCN_MEM_LOCKED = 0x00040000,
+
+ /// <summary>
+ /// Obsolete.
+ /// </summary>
+ IMAGE_SCN_MEM_PRELOAD = 0x00080000,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SCN_MEM_SYSHEAP - Obsolete 0x00010000
+ /// </remarks>
+ IMAGE_SCN_ALIGN_1BYTES = 0x00100000,
+
+ IMAGE_SCN_ALIGN_2BYTES = 0x00200000,
+ IMAGE_SCN_ALIGN_4BYTES = 0x00300000,
+ IMAGE_SCN_ALIGN_8BYTES = 0x00400000,
+
+ // default alignment
+ IMAGE_SCN_ALIGN_16BYTES = 0x00500000,
+
+ IMAGE_SCN_ALIGN_32BYTES = 0x00600000,
+ IMAGE_SCN_ALIGN_64BYTES = 0x00700000,
+ IMAGE_SCN_ALIGN_128BYTES = 0x00800000,
+ IMAGE_SCN_ALIGN_256BYTES = 0x00900000,
+ IMAGE_SCN_ALIGN_512BYTES = 0x00A00000,
+ IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000,
+ IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000,
+ IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000,
+ IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000,
+
+ IMAGE_SCN_ALIGN_MASK = 0x00F00000,
+
+ /// <summary>
+ /// Section contains extended relocations.
+ /// </summary>
+ IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000,
+
+ /// <summary>
+ /// Section can be discarded.
+ /// </summary>
+ IMAGE_SCN_MEM_DISCARDABLE = 0x02000000,
+
+ /// <summary>
+ /// Section is not cachable.
+ /// </summary>
+ IMAGE_SCN_MEM_NOT_CACHED = 0x04000000,
+
+ /// <summary>
+ /// Section is not pageable.
+ /// </summary>
+ IMAGE_SCN_MEM_NOT_PAGED = 0x08000000,
+
+ /// <summary>
+ /// Section is shareable.
+ /// </summary>
+ IMAGE_SCN_MEM_SHARED = 0x10000000,
+
+ /// <summary>
+ /// Section is executable.
+ /// </summary>
+ IMAGE_SCN_MEM_EXECUTE = 0x20000000,
+
+ /// <summary>
+ /// Section is readable.
+ /// </summary>
+ IMAGE_SCN_MEM_READ = 0x40000000,
+
+ /// <summary>
+ /// Section is writeable.
+ /// </summary>
+ IMAGE_SCN_MEM_WRITE = 0x80000000,
+
+
+ /// <summary>
+ /// TLS index is scaled.
+ /// </summary>
+ IMAGE_SCN_SCALE_INDEX = 0x00000001,
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/Subsystem.cs b/mcs/class/Mono.PEToolkit/Subsystem.cs
new file mode 100644
index 00000000000..eda66549cdd
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/Subsystem.cs
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+namespace Mono.PEToolkit {
+
+ /// <summary>
+ /// </summary>
+ public enum Subsystem : short {
+
+ /// <summary>
+ /// Unknown subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_UNKNOWN
+ /// </remarks>
+ UNKNOWN = 0,
+
+ /// <summary>
+ /// Image doesn't require a subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_NATIVE
+ /// </remarks>
+ NATIVE = 1,
+
+ /// <summary>
+ /// Image runs in the Windows GUI subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_WINDOWS_GUI
+ /// </remarks>
+ WINDOWS_GUI = 2,
+
+ /// <summary>
+ /// Image runs in the Windows character subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_WINDOWS_CUI
+ /// </remarks>
+ WINDOWS_CUI = 3,
+
+ /// <summary>
+ /// Image runs in the OS/2 character subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_OS2_CUI
+ /// </remarks>
+ OS2_CUI = 5,
+
+ /// <summary>
+ /// Image runs in the Posix character subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_POSIX_CUI
+ /// </remarks>
+ POSIX_CUI = 7,
+
+ /// <summary>
+ /// Image is a native Win9x driver.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_NATIVE_WINDOWS
+ /// </remarks>
+ NATIVE_WINDOWS = 8,
+
+ /// <summary>
+ /// Image runs in the Windows CE subsystem.
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_WINDOWS_CE_GUI
+ /// </remarks>
+ WINDOWS_CE_GUI = 9,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_EFI_APPLICATION
+ /// </remarks>
+ EFI_APPLICATION = 10,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
+ /// </remarks>
+ EFI_BOOT_SERVICE_DRIVER = 11,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
+ /// </remarks>
+ EFI_RUNTIME_DRIVER = 12,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_EFI_ROM
+ /// </remarks>
+ EFI_ROM = 13,
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// IMAGE_SUBSYSTEM_XBOX
+ /// </remarks>
+ XBOX = 14,
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/build/mddump.cs b/mcs/class/Mono.PEToolkit/build/mddump.cs
new file mode 100644
index 00000000000..d717e4bcf31
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/mddump.cs
@@ -0,0 +1,60 @@
+using System;
+using System.IO;
+
+using Mono.PEToolkit;
+using Mono.PEToolkit.Metadata;
+
+
+public sealed class MDDump {
+
+ private MDDump() {}
+
+
+ public static uint Dump (string peFile)
+ {
+
+ using (Image pe = new Image (peFile)) {
+ pe.Open ();
+ pe.ReadHeaders ();
+
+ Console.WriteLine (pe);
+
+ if (pe.IsCLI) {
+ pe.DumpStreamHeader("#~");
+ pe.DumpStreamHeader("#-");
+ pe.DumpStreamHeader("#Strings");
+ pe.DumpStreamHeader("#US");
+ pe.DumpStreamHeader("#GUID");
+ pe.DumpStreamHeader("#Blob");
+
+ Console.WriteLine("CLI image detected, dumping metadata tables.");
+ TablesHeap tabs = pe.MetaDataRoot.TablesHeap;
+
+ foreach (MDTable t in tabs.Tables) {
+ t.Dump (Console.Out);
+ }
+
+ /*
+ MethodIL il = pe.MetaDataRoot.GetMethodBody(1);
+ Console.WriteLine(il);
+ il.DumpHexBytecode(Console.Out);
+ */
+ }
+ }
+
+ return 0;
+ }
+
+
+
+
+
+ public static void Main (string [] args) {
+ if (args.Length == 0) {
+ Console.WriteLine ("mddump <PE file>");
+ } else {
+ Dump (args [0]);
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/build/pet.build b/mcs/class/Mono.PEToolkit/build/pet.build
new file mode 100644
index 00000000000..d1ad0cdadec
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/pet.build
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<project name="PET" default="all" basedir=".">
+
+ <target name="init">
+ <tstamp/>
+ <echo message="Init..."/>
+ <property name="debug" value="false"/>
+ <property name="src.dir" value="..\src"/>
+ <property name="bin.dir" value="..\bin"/>
+ </target>
+
+
+ <target name="compile" depends="init">
+ <csc target="library" output="${bin.dir}/pet.dll" debug="${debug}">
+ <arg value="/unsafe"/>
+ <sources basedir="..\src\PEToolkit">
+ <includes name="**/*.cs"/>
+ </sources>
+ </csc>
+ <csc target="exe" output="${bin.dir}/mddump.exe" debug="${debug}">
+ <sources>
+ <includes name="mddump.cs"/>
+ </sources>
+ <arg value="/reference:..\bin\pet.dll"/>
+ </csc>
+ </target>
+
+
+ <target name="all" depends="init,compile">
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/a.bat b/mcs/class/Mono.PEToolkit/build/srcgen/a.bat
new file mode 100755
index 00000000000..4a541189bd9
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/a.bat
@@ -0,0 +1,14 @@
+@echo off
+set X=cscript //nologo xslt.wsf /inFile:data\md-schema.xml
+
+: dir /b /on *.cs > common.src
+:cscript //nologo xslt.wsf /inFile:bitconv-types.xml /styleFile:bitconverter.xsl
+
+
+%X% /styleFile:table-id.xsl > code\TableId.cs
+%X% /styleFile:coded-id.xsl > code\CodedTokenId.cs
+%X% /styleFile:elem-type.xsl > code\ElementType.cs
+%X% /styleFile:tabs-decoder.xsl > code\TabsDecoder.cs
+%X% /styleFile:tabs-base.xsl > code\TablesHeapBase.cs
+%X% /styleFile:rows.xsl > code\Rows.cs
+%X% /styleFile:tabs.xsl > code\Tables.cs
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/bitconv-types.xml b/mcs/class/Mono.PEToolkit/build/srcgen/bitconv-types.xml
new file mode 100644
index 00000000000..f8550b38239
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/bitconv-types.xml
@@ -0,0 +1,10 @@
+<types>
+ <type name="Int16" short="short" size="2"/>
+ <type name="UInt16" short="ushort" size="2"/>
+
+ <type name="Int32" short="int" size="4"/>
+ <type name="UInt32" short="uint" size="4"/>
+
+ <type name="Int64" short="long" size="8"/>
+ <type name="UInt64" short="ulong" size="8"/>
+</types> \ No newline at end of file
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/bitconverter.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/bitconverter.xsl
new file mode 100644
index 00000000000..5a25e3be717
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/bitconverter.xsl
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">
+// Auto-generated file - DO NOT EDIT!
+// Please edit bitconverter.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit {
+
+ /// &lt;summary&gt;
+ /// Little-endian bit converter.
+ /// &lt;/summary&gt;
+ public sealed class LEBitConverter {
+
+ internal interface IConverter {
+
+<xsl:apply-templates select="types/type" mode="ifc"/>
+ }
+
+ public static readonly bool Native = System.BitConverter.IsLittleEndian;
+
+ private static readonly IConverter impl = System.BitConverter.IsLittleEndian
+ ? new LEConverter() as IConverter
+ : new BEConverter() as IConverter;
+
+
+
+
+ private LEBitConverter()
+ {
+ // Never instantiated.
+ }
+
+<xsl:apply-templates select="types/type" mode="swap"/>
+
+
+
+ internal sealed class LEConverter : IConverter {
+<xsl:apply-templates select="types/type" mode="le"/>
+ }
+
+ internal sealed class BEConverter : IConverter {
+<xsl:apply-templates select="types/type" mode="be"/>
+ }
+
+
+
+
+<xsl:apply-templates select="types/type" mode="main"/>
+
+ }
+
+}
+</xsl:template>
+
+
+
+<xsl:template match="types/type" mode="ifc">
+ <xsl:value-of select="concat('&#9;&#9;&#9;',@short,' To',@name,'(byte [] val, int idx);&#xD;&#xA;')"/>
+</xsl:template>
+
+
+<xsl:template match="types/type" mode="main">
+ <xsl:text>&#9;&#9;///&lt;summary&gt;&lt;/summary&gt;&#xD;&#xA;</xsl:text>
+ <xsl:value-of select="concat('&#9;&#9;public static ',@short,' To',@name,'(byte [] val, int idx)&#xD;&#xA;')"/>
+ <xsl:text>&#9;&#9;{&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;return impl.To</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(val, idx);&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;}&#xD;&#xA;&#xD;&#xA;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="types/type" mode="le">
+ <xsl:text>&#9;&#9;&#9;///&lt;summary&gt;&lt;/summary&gt;&#xD;&#xA;</xsl:text>
+ <xsl:value-of select="concat('&#9;&#9;&#9;public ',@short,' To',@name,'(byte [] val, int idx)&#xD;&#xA;')"/>
+ <xsl:text>&#9;&#9;&#9;{&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;&#9;return BitConverter.To</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(val, idx);&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;}&#xD;&#xA;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="types/type" mode="be">
+ <xsl:text>&#9;&#9;&#9;///&lt;summary&gt;&lt;/summary&gt;&#xD;&#xA;</xsl:text>
+ <xsl:value-of select="concat('&#9;&#9;&#9;public ',@short,' To',@name,'(byte [] val, int idx)&#xD;&#xA;')"/>
+ <xsl:text>&#9;&#9;&#9;{&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;&#9;return Swap</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(BitConverter.To</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(val, idx));&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;}&#xD;&#xA;</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="types/type" mode="swap">
+ <xsl:text>&#9;&#9;///&lt;summary&gt;&lt;/summary&gt;&#xD;&#xA;</xsl:text>
+ <xsl:value-of select="concat('&#9;&#9;unsafe public static ',@short,' Swap',@name,'(',@short,' x)&#xD;&#xA;')"/>
+ <xsl:text>&#9;&#9;{&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;</xsl:text><xsl:value-of select="concat(@short,'* p = stackalloc ',@short,' [1];')"/><xsl:text>&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;*p = x;&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;byte* bp = (byte*) p;&#xD;&#xA;</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@size = '2'">
+ <xsl:text>&#9;&#9;&#9;byte b = bp [0];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [0] = bp [1];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [1] = b;&#xD;&#xA;</xsl:text>
+ </xsl:when>
+ <xsl:when test="@size = '4'">
+ <xsl:text>&#9;&#9;&#9;byte b = bp [0];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [0] = bp [3];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [3] = b;&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;b = bp [1];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [1] = bp [2];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [2] = b;&#xD;&#xA;</xsl:text>
+ </xsl:when>
+ <xsl:when test="@size = '8'">
+ <xsl:text>&#9;&#9;&#9;byte b = bp [0];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [0] = bp [7];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [7] = b;&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;b = bp [1];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [1] = bp [6];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [6] = b;&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;b = bp [2];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [2] = bp [5];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [5] = b;&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;b = bp [3];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [3] = bp [4];&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;&#9;bp [4] = b;&#xD;&#xA;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>&#9;&#9;&#9;// Not implemented&#xD;&#xA;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>&#9;&#9;&#9;return *p;&#xD;&#xA;</xsl:text>
+ <xsl:text>&#9;&#9;}&#xD;&#xA;&#xD;&#xA;</xsl:text>
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/coded-id.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/coded-id.xsl
new file mode 100644
index 00000000000..3f3b3aee542
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/coded-id.xsl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or coded-id.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:text><![CDATA[
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public enum CodedTokenId {
+
+]]></xsl:text>
+
+<xsl:for-each select="md-schema/coded-tokens/map">
+<xsl:text>&#9;&#9;</xsl:text><xsl:value-of select="@name"/> = <xsl:value-of select="position() - 1"/>,
+</xsl:for-each>
+ }
+
+}
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/data/ilasm.xml b/mcs/class/Mono.PEToolkit/build/srcgen/data/ilasm.xml
new file mode 100644
index 00000000000..877ac5540ad
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/data/ilasm.xml
@@ -0,0 +1,549 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<ilasm>
+ <opcodes>
+ <opcode name="nop" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x0"/>
+ <opcode name="break" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Break" o1="0xFF" o2="0x1"/>
+ <opcode name="ldarg.0" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x2"/>
+ <opcode name="ldarg.1" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x3"/>
+ <opcode name="ldarg.2" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x4"/>
+ <opcode name="ldarg.3" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5"/>
+ <opcode name="ldloc.0" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x6"/>
+ <opcode name="ldloc.1" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x7"/>
+ <opcode name="ldloc.2" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x8"/>
+ <opcode name="ldloc.3" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x9"/>
+ <opcode name="stloc.0" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA"/>
+ <opcode name="stloc.1" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xB"/>
+ <opcode name="stloc.2" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC"/>
+ <opcode name="stloc.3" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xD"/>
+ <opcode name="ldarg.s" size="1" opcode-type="Macro" operand-type="ShortInlineVar" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xE"/>
+ <opcode name="ldarga.s" size="1" opcode-type="Macro" operand-type="ShortInlineVar" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xF"/>
+ <opcode name="starg.s" size="1" opcode-type="Macro" operand-type="ShortInlineVar" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x10"/>
+ <opcode name="ldloc.s" size="1" opcode-type="Macro" operand-type="ShortInlineVar" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x11"/>
+ <opcode name="ldloca.s" size="1" opcode-type="Macro" operand-type="ShortInlineVar" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x12"/>
+ <opcode name="stloc.s" size="1" opcode-type="Macro" operand-type="ShortInlineVar" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x13"/>
+ <opcode name="ldnull" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop0" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x14"/>
+ <opcode name="ldc.i4.m1" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x15"/>
+ <opcode name="ldc.i4.0" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x16"/>
+ <opcode name="ldc.i4.1" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x17"/>
+ <opcode name="ldc.i4.2" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x18"/>
+ <opcode name="ldc.i4.3" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x19"/>
+ <opcode name="ldc.i4.4" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x1A"/>
+ <opcode name="ldc.i4.5" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x1B"/>
+ <opcode name="ldc.i4.6" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x1C"/>
+ <opcode name="ldc.i4.7" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x1D"/>
+ <opcode name="ldc.i4.8" size="1" opcode-type="Macro" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x1E"/>
+ <opcode name="ldc.i4.s" size="1" opcode-type="Macro" operand-type="ShortInlineI" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x1F"/>
+ <opcode name="ldc.i4" size="1" opcode-type="Primitive" operand-type="InlineI" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x20"/>
+ <opcode name="ldc.i8" size="1" opcode-type="Primitive" operand-type="InlineI8" pop="Pop0" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x21"/>
+ <opcode name="ldc.r4" size="1" opcode-type="Primitive" operand-type="ShortInlineR" pop="Pop0" push="Pushr4" flow-ctrl="Next" o1="0xFF" o2="0x22"/>
+ <opcode name="ldc.r8" size="1" opcode-type="Primitive" operand-type="InlineR" pop="Pop0" push="Pushr8" flow-ctrl="Next" o1="0xFF" o2="0x23"/>
+ <opcode name="dup" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Push1_push1" flow-ctrl="Next" o1="0xFF" o2="0x25"/>
+ <opcode name="pop" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x26"/>
+ <opcode name="jmp" size="1" opcode-type="Primitive" operand-type="InlineMethod" pop="Pop0" push="Push0" flow-ctrl="Call" o1="0xFF" o2="0x27"/>
+ <opcode name="call" size="1" opcode-type="Primitive" operand-type="InlineMethod" pop="Varpop" push="Varpush" flow-ctrl="Call" o1="0xFF" o2="0x28"/>
+ <opcode name="calli" size="1" opcode-type="Primitive" operand-type="InlineSig" pop="Varpop" push="Varpush" flow-ctrl="Call" o1="0xFF" o2="0x29"/>
+ <opcode name="ret" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Varpop" push="Push0" flow-ctrl="Return" o1="0xFF" o2="0x2A"/>
+ <opcode name="br.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop0" push="Push0" flow-ctrl="Branch" o1="0xFF" o2="0x2B"/>
+ <opcode name="brfalse.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Popi" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x2C"/>
+ <opcode name="brtrue.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Popi" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x2D"/>
+ <opcode name="beq.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x2E"/>
+ <opcode name="bge.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x2F"/>
+ <opcode name="bgt.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x30"/>
+ <opcode name="ble.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x31"/>
+ <opcode name="blt.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x32"/>
+ <opcode name="bne.un.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x33"/>
+ <opcode name="bge.un.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x34"/>
+ <opcode name="bgt.un.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x35"/>
+ <opcode name="ble.un.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x36"/>
+ <opcode name="blt.un.s" size="1" opcode-type="Macro" operand-type="ShortInlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x37"/>
+ <opcode name="br" size="1" opcode-type="Primitive" operand-type="InlineBrTarget" pop="Pop0" push="Push0" flow-ctrl="Branch" o1="0xFF" o2="0x38"/>
+ <opcode name="brfalse" size="1" opcode-type="Primitive" operand-type="InlineBrTarget" pop="Popi" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x39"/>
+ <opcode name="brtrue" size="1" opcode-type="Primitive" operand-type="InlineBrTarget" pop="Popi" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x3A"/>
+ <opcode name="beq" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x3B"/>
+ <opcode name="bge" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x3C"/>
+ <opcode name="bgt" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x3D"/>
+ <opcode name="ble" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x3E"/>
+ <opcode name="blt" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x3F"/>
+ <opcode name="bne.un" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x40"/>
+ <opcode name="bge.un" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x41"/>
+ <opcode name="bgt.un" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x42"/>
+ <opcode name="ble.un" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x43"/>
+ <opcode name="blt.un" size="1" opcode-type="Macro" operand-type="InlineBrTarget" pop="Pop1_pop1" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x44"/>
+ <opcode name="switch" size="1" opcode-type="Primitive" operand-type="InlineSwitch" pop="Popi" push="Push0" flow-ctrl="Cond_Branch" o1="0xFF" o2="0x45"/>
+ <opcode name="ldind.i1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x46"/>
+ <opcode name="ldind.u1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x47"/>
+ <opcode name="ldind.i2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x48"/>
+ <opcode name="ldind.u2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x49"/>
+ <opcode name="ldind.i4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x4A"/>
+ <opcode name="ldind.u4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x4B"/>
+ <opcode name="ldind.i8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x4C"/>
+ <opcode name="ldind.i" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x4D"/>
+ <opcode name="ldind.r4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushr4" flow-ctrl="Next" o1="0xFF" o2="0x4E"/>
+ <opcode name="ldind.r8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushr8" flow-ctrl="Next" o1="0xFF" o2="0x4F"/>
+ <opcode name="ldind.ref" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x50"/>
+ <opcode name="stind.ref" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x51"/>
+ <opcode name="stind.i1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x52"/>
+ <opcode name="stind.i2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x53"/>
+ <opcode name="stind.i4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x54"/>
+ <opcode name="stind.i8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi8" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x55"/>
+ <opcode name="stind.r4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popr4" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x56"/>
+ <opcode name="stind.r8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popr8" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x57"/>
+ <opcode name="add" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x58"/>
+ <opcode name="sub" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x59"/>
+ <opcode name="mul" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5A"/>
+ <opcode name="div" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5B"/>
+ <opcode name="div.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5C"/>
+ <opcode name="rem" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5D"/>
+ <opcode name="rem.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5E"/>
+ <opcode name="and" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x5F"/>
+ <opcode name="or" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x60"/>
+ <opcode name="xor" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x61"/>
+ <opcode name="shl" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x62"/>
+ <opcode name="shr" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x63"/>
+ <opcode name="shr.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x64"/>
+ <opcode name="neg" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x65"/>
+ <opcode name="not" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x66"/>
+ <opcode name="conv.i1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x67"/>
+ <opcode name="conv.i2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x68"/>
+ <opcode name="conv.i4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x69"/>
+ <opcode name="conv.i8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x6A"/>
+ <opcode name="conv.r4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushr4" flow-ctrl="Next" o1="0xFF" o2="0x6B"/>
+ <opcode name="conv.r8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushr8" flow-ctrl="Next" o1="0xFF" o2="0x6C"/>
+ <opcode name="conv.u4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x6D"/>
+ <opcode name="conv.u8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x6E"/>
+ <opcode name="callvirt" size="1" opcode-type="Objmodel" operand-type="InlineMethod" pop="Varpop" push="Varpush" flow-ctrl="Call" o1="0xFF" o2="0x6F"/>
+ <opcode name="cpobj" size="1" opcode-type="Objmodel" operand-type="InlineType" pop="Popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x70"/>
+ <opcode name="ldobj" size="1" opcode-type="Objmodel" operand-type="InlineType" pop="Popi" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x71"/>
+ <opcode name="ldstr" size="1" opcode-type="Objmodel" operand-type="InlineString" pop="Pop0" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x72"/>
+ <opcode name="newobj" size="1" opcode-type="Objmodel" operand-type="InlineMethod" pop="Varpop" push="Pushref" flow-ctrl="Call" o1="0xFF" o2="0x73"/>
+ <opcode name="castclass" size="1" opcode-type="Objmodel" operand-type="InlineType" pop="Popref" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x74"/>
+ <opcode name="isinst" size="1" opcode-type="Objmodel" operand-type="InlineType" pop="Popref" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x75"/>
+ <opcode name="conv.r.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushr8" flow-ctrl="Next" o1="0xFF" o2="0x76"/>
+ <opcode name="unbox" size="1" opcode-type="Primitive" operand-type="InlineType" pop="Popref" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x79"/>
+ <opcode name="throw" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref" push="Push0" flow-ctrl="Throw" o1="0xFF" o2="0x7A"/>
+ <opcode name="ldfld" size="1" opcode-type="Objmodel" operand-type="InlineField" pop="Popref" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x7B"/>
+ <opcode name="ldflda" size="1" opcode-type="Objmodel" operand-type="InlineField" pop="Popref" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x7C"/>
+ <opcode name="stfld" size="1" opcode-type="Objmodel" operand-type="InlineField" pop="Popref_pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x7D"/>
+ <opcode name="ldsfld" size="1" opcode-type="Objmodel" operand-type="InlineField" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0x7E"/>
+ <opcode name="ldsflda" size="1" opcode-type="Objmodel" operand-type="InlineField" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x7F"/>
+ <opcode name="stsfld" size="1" opcode-type="Objmodel" operand-type="InlineField" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x80"/>
+ <opcode name="stobj" size="1" opcode-type="Primitive" operand-type="InlineType" pop="Popi_pop1" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x81"/>
+ <opcode name="conv.ovf.i1.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x82"/>
+ <opcode name="conv.ovf.i2.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x83"/>
+ <opcode name="conv.ovf.i4.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x84"/>
+ <opcode name="conv.ovf.i8.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x85"/>
+ <opcode name="conv.ovf.u1.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x86"/>
+ <opcode name="conv.ovf.u2.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x87"/>
+ <opcode name="conv.ovf.u4.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x88"/>
+ <opcode name="conv.ovf.u8.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x89"/>
+ <opcode name="conv.ovf.i.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x8A"/>
+ <opcode name="conv.ovf.u.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x8B"/>
+ <opcode name="boxval" size="1" opcode-type="Primitive" operand-type="InlineType" pop="Pop1" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x8C"/>
+ <opcode name="box" size="1" opcode-type="Primitive" operand-type="InlineType" pop="Pop1" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x8C"/>
+ <opcode name="newarr" size="1" opcode-type="Objmodel" operand-type="InlineType" pop="Popi" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x8D"/>
+ <opcode name="ldlen" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x8E"/>
+ <opcode name="ldelema" size="1" opcode-type="Objmodel" operand-type="InlineType" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x8F"/>
+ <opcode name="ldelem.i1" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x90"/>
+ <opcode name="ldelem.u1" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x91"/>
+ <opcode name="ldelem.i2" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x92"/>
+ <opcode name="ldelem.u2" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x93"/>
+ <opcode name="ldelem.i4" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x94"/>
+ <opcode name="ldelem.u4" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x95"/>
+ <opcode name="ldelem.i8" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0x96"/>
+ <opcode name="ldelem.i" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0x97"/>
+ <opcode name="ldelem.r4" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushr4" flow-ctrl="Next" o1="0xFF" o2="0x98"/>
+ <opcode name="ldelem.r8" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushr8" flow-ctrl="Next" o1="0xFF" o2="0x99"/>
+ <opcode name="ldelem.ref" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi" push="Pushref" flow-ctrl="Next" o1="0xFF" o2="0x9A"/>
+ <opcode name="stelem.i" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x9B"/>
+ <opcode name="stelem.i1" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x9C"/>
+ <opcode name="stelem.i2" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x9D"/>
+ <opcode name="stelem.i4" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x9E"/>
+ <opcode name="stelem.i8" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popi8" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x9F"/>
+ <opcode name="stelem.r4" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popr4" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA0"/>
+ <opcode name="stelem.r8" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popr8" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA1"/>
+ <opcode name="stelem.ref" size="1" opcode-type="Objmodel" operand-type="InlineNone" pop="Popref_popi_popref" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA2"/>
+ <opcode name="conv.ovf.i1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xB3"/>
+ <opcode name="conv.ovf.u1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xB4"/>
+ <opcode name="conv.ovf.i2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xB5"/>
+ <opcode name="conv.ovf.u2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xB6"/>
+ <opcode name="conv.ovf.i4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xB7"/>
+ <opcode name="conv.ovf.u4" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xB8"/>
+ <opcode name="conv.ovf.i8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0xB9"/>
+ <opcode name="conv.ovf.u8" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi8" flow-ctrl="Next" o1="0xFF" o2="0xBA"/>
+ <opcode name="refanyval" size="1" opcode-type="Primitive" operand-type="InlineType" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xC2"/>
+ <opcode name="ckfinite" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushr8" flow-ctrl="Next" o1="0xFF" o2="0xC3"/>
+ <opcode name="mkrefany" size="1" opcode-type="Primitive" operand-type="InlineType" pop="Popi" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xC6"/>
+ <opcode name="ldtoken" size="1" opcode-type="Primitive" operand-type="InlineTok" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xD0"/>
+ <opcode name="conv.u2" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xD1"/>
+ <opcode name="conv.u1" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xD2"/>
+ <opcode name="conv.i" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xD3"/>
+ <opcode name="conv.ovf.i" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xD4"/>
+ <opcode name="conv.ovf.u" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xD5"/>
+ <opcode name="add.ovf" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xD6"/>
+ <opcode name="add.ovf.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xD7"/>
+ <opcode name="mul.ovf" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xD8"/>
+ <opcode name="mul.ovf.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xD9"/>
+ <opcode name="sub.ovf" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xDA"/>
+ <opcode name="sub.ovf.un" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Push1" flow-ctrl="Next" o1="0xFF" o2="0xDB"/>
+ <opcode name="endfinally" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Return" o1="0xFF" o2="0xDC"/>
+ <opcode name="leave" size="1" opcode-type="Primitive" operand-type="InlineBrTarget" pop="Pop0" push="Push0" flow-ctrl="Branch" o1="0xFF" o2="0xDD"/>
+ <opcode name="leave.s" size="1" opcode-type="Primitive" operand-type="ShortInlineBrTarget" pop="Pop0" push="Push0" flow-ctrl="Branch" o1="0xFF" o2="0xDE"/>
+ <opcode name="stind.i" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xDF"/>
+ <opcode name="conv.u" size="1" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFF" o2="0xE0"/>
+ <opcode name="prefix7" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xF8"/>
+ <opcode name="prefix6" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xF9"/>
+ <opcode name="prefix5" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xFA"/>
+ <opcode name="prefix4" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xFB"/>
+ <opcode name="prefix3" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xFC"/>
+ <opcode name="prefix2" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xFD"/>
+ <opcode name="prefix1" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xFE"/>
+ <opcode name="prefixref" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFF" o2="0xFF"/>
+ <opcode name="arglist" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x0"/>
+ <opcode name="ceq" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x1"/>
+ <opcode name="cgt" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x2"/>
+ <opcode name="cgt.un" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x3"/>
+ <opcode name="clt" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x4"/>
+ <opcode name="clt.un" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1_pop1" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x5"/>
+ <opcode name="ldftn" size="2" opcode-type="Primitive" operand-type="InlineMethod" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x6"/>
+ <opcode name="ldvirtftn" size="2" opcode-type="Primitive" operand-type="InlineMethod" pop="Popref" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x7"/>
+ <opcode name="ldarg" size="2" opcode-type="Primitive" operand-type="InlineVar" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFE" o2="0x9"/>
+ <opcode name="ldarga" size="2" opcode-type="Primitive" operand-type="InlineVar" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0xA"/>
+ <opcode name="starg" size="2" opcode-type="Primitive" operand-type="InlineVar" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0xB"/>
+ <opcode name="ldloc" size="2" opcode-type="Primitive" operand-type="InlineVar" pop="Pop0" push="Push1" flow-ctrl="Next" o1="0xFE" o2="0xC"/>
+ <opcode name="ldloca" size="2" opcode-type="Primitive" operand-type="InlineVar" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0xD"/>
+ <opcode name="stloc" size="2" opcode-type="Primitive" operand-type="InlineVar" pop="Pop1" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0xE"/>
+ <opcode name="localloc" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0xF"/>
+ <opcode name="endfilter" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Popi" push="Push0" flow-ctrl="Return" o1="0xFE" o2="0x11"/>
+ <opcode name="unaligned." size="2" opcode-type="Prefix" operand-type="ShortInlineI" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFE" o2="0x12"/>
+ <opcode name="volatile." size="2" opcode-type="Prefix" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFE" o2="0x13"/>
+ <opcode name="tail." size="2" opcode-type="Prefix" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0xFE" o2="0x14"/>
+ <opcode name="initobj" size="2" opcode-type="Objmodel" operand-type="InlineType" pop="Popi" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x15"/>
+ <opcode name="cpblk" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi_popi" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x17"/>
+ <opcode name="initblk" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Popi_popi_popi" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x18"/>
+ <opcode name="rethrow" size="2" opcode-type="Objmodel" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Throw" o1="0xFE" o2="0x1A"/>
+ <opcode name="sizeof" size="2" opcode-type="Primitive" operand-type="InlineType" pop="Pop0" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x1C"/>
+ <opcode name="refanytype" size="2" opcode-type="Primitive" operand-type="InlineNone" pop="Pop1" push="Pushi" flow-ctrl="Next" o1="0xFE" o2="0x1D"/>
+
+ <opcode name="unused99" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x24"/>
+ <opcode name="unused58" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x77"/>
+ <opcode name="unused1" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0x78"/>
+ <opcode name="unused2" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA3"/>
+ <opcode name="unused3" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA4"/>
+ <opcode name="unused4" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA5"/>
+ <opcode name="unused5" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA6"/>
+ <opcode name="unused6" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA7"/>
+ <opcode name="unused7" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA8"/>
+ <opcode name="unused8" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xA9"/>
+ <opcode name="unused9" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xAA"/>
+ <opcode name="unused10" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xAB"/>
+ <opcode name="unused11" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xAC"/>
+ <opcode name="unused12" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xAD"/>
+ <opcode name="unused13" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xAE"/>
+ <opcode name="unused14" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xAF"/>
+ <opcode name="unused15" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xB0"/>
+ <opcode name="unused16" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xB1"/>
+ <opcode name="unused17" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xB2"/>
+ <opcode name="unused50" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xBB"/>
+ <opcode name="unused18" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xBC"/>
+ <opcode name="unused19" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xBD"/>
+ <opcode name="unused20" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xBE"/>
+ <opcode name="unused21" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xBF"/>
+ <opcode name="unused22" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC0"/>
+ <opcode name="unused23" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC1"/>
+ <opcode name="unused24" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC4"/>
+ <opcode name="unused25" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC5"/>
+ <opcode name="unused59" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC7"/>
+ <opcode name="unused60" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC8"/>
+ <opcode name="unused61" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xC9"/>
+ <opcode name="unused62" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xCA"/>
+ <opcode name="unused63" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xCB"/>
+ <opcode name="unused64" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xCC"/>
+ <opcode name="unused65" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xCD"/>
+ <opcode name="unused66" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xCE"/>
+ <opcode name="unused67" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xCF"/>
+ <opcode name="unused26" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE1"/>
+ <opcode name="unused27" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE2"/>
+ <opcode name="unused28" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE3"/>
+ <opcode name="unused29" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE4"/>
+ <opcode name="unused30" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE5"/>
+ <opcode name="unused31" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE6"/>
+ <opcode name="unused32" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE7"/>
+ <opcode name="unused33" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE8"/>
+ <opcode name="unused34" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xE9"/>
+ <opcode name="unused35" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xEA"/>
+ <opcode name="unused36" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xEB"/>
+ <opcode name="unused37" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xEC"/>
+ <opcode name="unused38" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xED"/>
+ <opcode name="unused39" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xEE"/>
+ <opcode name="unused40" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xEF"/>
+ <opcode name="unused41" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF0"/>
+ <opcode name="unused42" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF1"/>
+ <opcode name="unused43" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF2"/>
+ <opcode name="unused44" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF3"/>
+ <opcode name="unused45" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF4"/>
+ <opcode name="unused46" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF5"/>
+ <opcode name="unused47" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF6"/>
+ <opcode name="unused48" size="1" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFF" o2="0xF7"/>
+ <opcode name="unused56" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x08"/>
+ <opcode name="unused57" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x10"/>
+ <opcode name="unused68" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x16"/>
+ <opcode name="unused69" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x19"/>
+ <opcode name="unused52" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x1E"/>
+ <opcode name="unused53" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x1F"/>
+ <opcode name="unused54" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x20"/>
+ <opcode name="unused55" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x21"/>
+ <opcode name="unused70" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Next" o1="0xFE" o2="0x22"/>
+ <opcode name="illegal" size="2" opcode-type="Nternal" operand-type="InlineNone" pop="Pop0" push="Push0" flow-ctrl="Meta" o1="0x00" o2="0x00"/>
+ </opcodes>
+
+
+ <directives>
+ <directive name=".addon"/>
+ <directive name=".algorithm"/>
+ <directive name=".assembly"/>
+ <directive name=".backing"/>
+ <directive name=".blob"/>
+ <directive name=".capability"/>
+ <directive name=".cctor"/>
+ <directive name=".class"/>
+ <directive name=".comtype"/>
+ <directive name=".config"/>
+ <directive name=".corflags"/>
+ <directive name=".ctor"/>
+ <directive name=".custom"/>
+ <directive name=".data"/>
+ <directive name=".emitbyte"/>
+ <directive name=".entrypoint"/>
+ <directive name=".event"/>
+ <directive name=".exeloc"/>
+ <directive name=".export"/>
+ <directive name=".field"/>
+ <directive name=".file"/>
+ <directive name=".fire"/>
+ <directive name=".get"/>
+ <directive name=".hash"/>
+ <directive name=".implicitcom"/>
+ <directive name=".language"/>
+ <directive name=".line"/>
+ <directive name="#line"/>
+ <directive name=".locale"/>
+ <directive name=".locals"/>
+ <directive name=".manifestres"/>
+ <directive name=".maxstack"/>
+ <directive name=".method"/>
+ <directive name=".mime"/>
+ <directive name=".module"/>
+ <directive name=".mresource"/>
+ <directive name=".namespace"/>
+ <directive name=".originator"/>
+ <directive name=".os"/>
+ <directive name=".other"/>
+ <directive name=".override"/>
+ <directive name=".pack"/>
+ <directive name=".param"/>
+ <directive name=".permission"/>
+ <directive name=".permissionset"/>
+ <directive name=".processor"/>
+ <directive name=".property"/>
+ <directive name=".publickey"/>
+ <directive name=".publickeytoken"/>
+ <directive name=".removeon"/>
+ <directive name=".set"/>
+ <directive name=".size"/>
+ <directive name=".subsystem"/>
+ <directive name=".title"/>
+ <directive name=".try"/>
+ <directive name=".ver"/>
+ <directive name=".vtable"/>
+ <directive name=".vtentry"/>
+ <directive name=".vtfixup"/>
+ <directive name=".zeroinit"/>
+ </directives>
+
+ <keywords>
+ <keyword name="at"/>
+ <keyword name="as"/>
+ <keyword name="implicitcom"/>
+ <keyword name="implicitres"/>
+ <keyword name="noappdomain"/>
+ <keyword name="noprocess"/>
+ <keyword name="nomachine"/>
+ <keyword name="extern"/>
+ <keyword name="instance"/>
+ <keyword name="explicit"/>
+ <keyword name="default"/>
+ <keyword name="vararg"/>
+ <keyword name="unmanaged"/>
+ <keyword name="cdecl"/>
+ <keyword name="stdcall"/>
+ <keyword name="thiscall"/>
+ <keyword name="fastcall"/>
+ <keyword name="marshal"/>
+ <keyword name="in"/>
+ <keyword name="out"/>
+ <keyword name="opt"/>
+ <keyword name="lcid"/>
+ <keyword name="retval"/>
+ <keyword name="static"/>
+ <keyword name="public"/>
+ <keyword name="private"/>
+ <keyword name="family"/>
+ <keyword name="initonly"/>
+ <keyword name="rtspecialname"/>
+ <keyword name="specialname"/>
+ <keyword name="assembly"/>
+ <keyword name="famandassem"/>
+ <keyword name="famorassem"/>
+ <keyword name="privatescope"/>
+ <keyword name="literal"/>
+ <keyword name="notserialized"/>
+ <keyword name="value"/>
+ <keyword name="not_in_gc_heap"/>
+ <keyword name="interface"/>
+ <keyword name="sealed"/>
+ <keyword name="abstract"/>
+ <keyword name="auto"/>
+ <keyword name="sequential"/>
+ <keyword name="ansi"/>
+ <keyword name="unicode"/>
+ <keyword name="autochar"/>
+ <keyword name="import"/>
+ <keyword name="serializable"/>
+ <keyword name="nested"/>
+ <keyword name="lateinit"/>
+ <keyword name="extends"/>
+ <keyword name="implements"/>
+ <keyword name="final"/>
+ <keyword name="virtual"/>
+ <keyword name="hidebysig"/>
+ <keyword name="newslot"/>
+ <keyword name="unmanagedexp"/>
+ <keyword name="pinvokeimpl"/>
+ <keyword name="nomangle"/>
+ <keyword name="ole"/>
+ <keyword name="lasterr"/>
+ <keyword name="winapi"/>
+ <keyword name="native"/>
+ <keyword name="il"/>
+ <keyword name="cil"/>
+ <keyword name="optil"/>
+ <keyword name="managed"/>
+ <keyword name="forwardref"/>
+ <keyword name="runtime"/>
+ <keyword name="internalcall"/>
+ <keyword name="synchronized"/>
+ <keyword name="noinlining"/>
+ <keyword name="custom"/>
+ <keyword name="fixed"/>
+ <keyword name="sysstring"/>
+ <keyword name="array"/>
+ <keyword name="variant"/>
+ <keyword name="currency"/>
+ <keyword name="syschar"/>
+ <keyword name="void"/>
+ <keyword name="bool"/>
+ <keyword name="int8"/>
+ <keyword name="int16"/>
+ <keyword name="int32"/>
+ <keyword name="int64"/>
+ <keyword name="float32"/>
+ <keyword name="float64"/>
+ <keyword name="error"/>
+ <keyword name="unsigned"/>
+ <keyword name="decimal"/>
+ <keyword name="date"/>
+ <keyword name="bstr"/>
+ <keyword name="lpstr"/>
+ <keyword name="lpwstr"/>
+ <keyword name="lptstr"/>
+ <keyword name="objectref"/>
+ <keyword name="iunknown"/>
+ <keyword name="idispatch"/>
+ <keyword name="struct"/>
+ <keyword name="safearray"/>
+ <keyword name="int"/>
+ <keyword name="byvalstr"/>
+ <keyword name="tbstr"/>
+ <keyword name="lpvoid"/>
+ <keyword name="any"/>
+ <keyword name="float"/>
+ <keyword name="lpstruct"/>
+ <keyword name="null"/>
+ <keyword name="ptr"/>
+ <keyword name="vector"/>
+ <keyword name="hresult"/>
+ <keyword name="carray"/>
+ <keyword name="userdefined"/>
+ <keyword name="record"/>
+ <keyword name="filetime"/>
+ <keyword name="blob"/>
+ <keyword name="stream"/>
+ <keyword name="storage"/>
+ <keyword name="streamed_object"/>
+ <keyword name="stored_object"/>
+ <keyword name="blob_object"/>
+ <keyword name="cf"/>
+ <keyword name="clsid"/>
+ <keyword name="method"/>
+ <keyword name="class"/>
+ <keyword name="pinned"/>
+ <keyword name="modreq"/>
+ <keyword name="modopt"/>
+ <keyword name="typedref"/>
+ <keyword name="wchar"/>
+ <keyword name="char"/>
+ <keyword name="fromunmanaged"/>
+ <keyword name="callmostderived"/>
+ <keyword name="bytearray"/>
+ <keyword name="with"/>
+ <keyword name="init"/>
+ <keyword name="to"/>
+ <keyword name="catch"/>
+ <keyword name="filter"/>
+ <keyword name="finally"/>
+ <keyword name="fault"/>
+ <keyword name="handler"/>
+ <keyword name="tls"/>
+ <keyword name="field"/>
+ <keyword name="request"/>
+ <keyword name="demand"/>
+ <keyword name="assert"/>
+ <keyword name="deny"/>
+ <keyword name="permitonly"/>
+ <keyword name="linkcheck"/>
+ <keyword name="inheritcheck"/>
+ <keyword name="reqmin"/>
+ <keyword name="reqopt"/>
+ <keyword name="reqrefuse"/>
+ <keyword name="prejitgrant"/>
+ <keyword name="prejitdeny"/>
+ <keyword name="noncasdemand"/>
+ <keyword name="noncaslinkdemand"/>
+ <keyword name="noncasinheritance"/>
+ <keyword name="readonly"/>
+ <keyword name="nometadata"/>
+ <keyword name="algorithm"/>
+ <keyword name="fullorigin"/>
+ <keyword name="nan"/>
+ <keyword name="inf"/>
+ <keyword name="publickey"/>
+ <keyword name="enablejittracking"/>
+ <keyword name="disablejitoptimizer"/>
+ <keyword name="preservesig"/>
+ <keyword name="beforefieldinit"/>
+
+ <keyword name="alignment"/>
+ <keyword name="nullref"/>
+ <keyword name="valuetype"/>
+ <keyword name="Compilercontrolled"/>
+ <keyword name="reqsecobj"/>
+
+ <keyword name="enum"/>
+ <keyword name="object"/>
+ <keyword name="string"/>
+ <keyword name="true"/>
+ <keyword name="false"/>
+
+ </keywords>
+
+</ilasm>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/data/md-schema.xml b/mcs/class/Mono.PEToolkit/build/srcgen/data/md-schema.xml
new file mode 100644
index 00000000000..b36af43ab08
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/data/md-schema.xml
@@ -0,0 +1,589 @@
+<!-- updated according to final specs -->
+<md-schema version="1.0">
+
+<!-- see tables in 23.2.6 -->
+<coded-tokens>
+
+ <!-- NOTE: specs use token-type spelling (map/table/@token-type) rather than table id -->
+
+ <map name="TypeDefOrRef" bits="2">
+ <table name="TypeDef" tag="0"/>
+ <table name="TypeRef" tag="1"/>
+ <table name="TypeSpec" tag="2"/>
+ </map>
+
+ <map name="HasConstant" bits="2">
+ <table name="Field" tag="0" token-type="FieldDef"/>
+ <table name="Param" tag="1" token-type="ParamDef"/>
+ <table name="Property" tag="2"/>
+ </map>
+
+ <map name="HasCustomAttribute" bits="5"><!-- specs: HasCustomattribute -->
+ <table name="Method" tag="0" token-type="MethodDef"/>
+ <table name="Field" tag="1" token-type="FieldDef"/>
+ <table name="TypeRef" tag="2"/>
+ <table name="TypeDef" tag="3"/>
+ <table name="Param" tag="4" token-type="ParamDef"/>
+ <table name="InterfaceImpl" tag="5"/>
+ <table name="MemberRef" tag="6"/>
+ <table name="Module" tag="7"/>
+ <table name="DeclSecurity" tag="8" token-type="Permission"/>
+ <table name="Property" tag="9"/>
+ <table name="Event" tag="10"/>
+ <table name="StandAloneSig" tag="11" token-type="Signature"/>
+ <table name="ModuleRef" tag="12"/>
+ <table name="TypeSpec" tag="13"/>
+ <table name="Assembly" tag="14"/>
+ <table name="AssemblyRef" tag="15"/>
+ <table name="File" tag="16"/>
+ <table name="ExportedType" tag="17"/>
+ <table name="ManifestResource" tag="18"/>
+ </map>
+
+ <map name="HasFieldMarshal" bits="1"><!-- specs: HasFieldMarshall -->
+ <table name="Field" tag="0" token-type="FieldDef"/>
+ <table name="Param" tag="1" token-type="ParamDef"/>
+ </map>
+
+ <map name="HasDeclSecurity" bits="2">
+ <table name="TypeDef" tag="0"/>
+ <table name="Method" tag="1" token-type="MethodDef"/>
+ <table name="Assembly" tag="2"/>
+ </map>
+
+ <map name="MemberRefParent" bits="3">
+ <table name="TypeDef" tag="0"/><!-- specs: Not used -->
+ <table name="TypeRef" tag="1"/>
+ <table name="ModuleRef" tag="2"/>
+ <table name="Method" tag="3" token-type="MethodDef"/>
+ <table name="TypeSpec" tag="4"/>
+ </map>
+
+ <map name="HasSemantics" bits="1">
+ <table name="Event" tag="0"/>
+ <table name="Property" tag="1"/>
+ </map>
+
+ <map name="MethodDefOrRef" bits="1">
+ <table name="Method" tag="0" token-type="MethodDef"/>
+ <table name="MemberRef" tag="1"/>
+ </map>
+
+ <map name="MemberForwarded" bits="1">
+ <table name="Field" tag="0" token-type="FieldDef"/>
+ <table name="Method" tag="1" token-type="MethodDef"/>
+ </map>
+
+ <map name="Implementation" bits="2">
+ <table name="File" tag="0"/>
+ <table name="AssemblyRef" tag="1"/>
+ <table name="ExportedType" tag="2"/><!-- specs: tag value absent -->
+ </map>
+
+ <map name="CustomAttributeType" bits="3">
+ <table name="TypeRef" tag="0"/><!-- specs: not used -->
+ <table name="TypeDef" tag="1"/><!-- specs: not used -->
+ <table name="Method" tag="2" token-type="MethodDef"/>
+ <table name="MemberRef" tag="3"/>
+ <table name="String" tag="4"/><!-- specs: not used -->
+ </map>
+
+ <!-- LAMESPEC: 2 bits per tag, specs claims 3 -->
+ <map name="ResolutionScope" bits="2">
+ <table name="Module" tag="0"/>
+ <table name="ModuleRef" tag="1"/>
+ <table name="AssemblyRef" tag="2"/><!-- LAMESPEC: tag=3 -->
+ <table name="TypeRef" tag="3"/><!-- LAMESPEC: tag=4 -->
+ </map>
+
+</coded-tokens>
+
+
+<!-- 22.1.15 Element Types used in Signatures -->
+<element-types>
+ <type name="End" value="0x00" remarks="Marks end of a list."/>
+ <type name="Void" value="0x01"/>
+ <type name="Boolean" value="0x02"/>
+ <type name="Char" value="0x03"/>
+ <type name="I1" value="0x04"/>
+ <type name="U1" value="0x05"/>
+ <type name="I2" value="0x06"/>
+ <type name="U2" value="0x07"/>
+ <type name="I4" value="0x08"/>
+ <type name="U4" value="0x09"/>
+ <type name="I8" value="0x0a"/>
+ <type name="U8" value="0x0b"/>
+ <type name="R4" value="0x0c"/>
+ <type name="R8" value="0x0d"/>
+ <type name="String" value="0x0e"/>
+ <type name="Ptr" value="0x0f" remarks="Followed by &lt;type&gt; token."/>
+ <type name="ByRef" value="0x10" remarks="Followed by &lt;type&gt; token."/>
+ <type name="ValueType" value="0x11" remarks="Followed by &lt;type&gt; token."/>
+ <type name="Class" value="0x12" remarks="Followed by &lt;type&gt; token."/>
+ <type name="Array" value="0x14"/>
+ <type name="TypedByRef" value="0x16"/>
+ <type name="I" value="0x18" remarks="System.IntPtr"/>
+ <type name="U" value="0x19" remarks="System.UIntPtr"/>
+ <type name="FnPtr" value="0x1b" remarks="Followed by full method signature."/>
+ <type name="Object" value="0x1c" remarks="System.Object"/>
+ <type name="SzArray" value="0x1d" remarks="Single-dim array with 0 lower bound."/>
+ <type name="CModReqd" value="0x1f" remarks="Required modifier : followed by a TypeDef or TypeRef token."/>
+ <type name="CModOpt" value="0x20" remarks="Optional modifier : followed by a TypeDef or TypeRef token."/>
+ <type name="Internal" value="0x21" remarks="Implemented within the CLR."/>
+
+ <type name="Modifier" value="0x40" remarks="Or'd with following element types."/>
+ <type name="Sentinel" value="0x41" remarks="Sentinel for varargs method signature."/>
+ <type name="Pinned" value="0x45" remarks="Denotes a local variable that points at a pinned object."/>
+</element-types>
+
+
+
+
+<!--
+ Metadata tables.
+-->
+
+<tables>
+
+ <!-- -->
+ <table name="Module" id="0x00" section="21.27">
+ <schema>
+ <field name="Generation" type="ushort"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Mvid" type="index(#GUID)"/>
+ <field name="EncId" type="index(#GUID)"/>
+ <field name="EncBaseId" type="index(#GUID)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="TypeRef" id="0x01" section="21.35">
+ <schema>
+ <field name="ResolutionScope" type="coded-index(ResolutionScope)"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Namespace" type="index(#Strings)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="TypeDef" id="0x02" section="21.34">
+ <schema>
+ <field name="Flags" type="uint" cli-type="System.Reflection.TypeAttributes"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Namespace" type="index(#Strings)"/>
+ <field name="Extends" type="coded-index(TypeDefOrRef)"/>
+ <field name="FieldList" type="index(Field)"/>
+ <field name="MethodList" type="index(Method)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="FieldPtr" id="0x03" temporary="yes">
+ <schema>
+ <field name="Field" type="index(Field)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Field" id="0x04" section="21.15">
+ <schema>
+ <field name="Flags" type="ushort" cli-type="System.Reflection.FieldAttributes"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Signature" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="MethodPtr" id="0x05" temporary="yes">
+ <schema>
+ <field name="Method" type="index(Method)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Method" id="0x06" section="21.24">
+ <schema>
+ <field name="RVA" type="RVA" remarks="RVA of the COR_ILMETHOD structure for the body of the method."/>
+ <field name="ImplFlags" type="ushort" cli-type="System.Reflection.MethodImplAttributes"/>
+ <field name="Flags" type="ushort" cli-type="System.Reflection.MethodAttributes"/><!-- ??? MethodAttribute -->
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Signature" type="index(#Blob)"/>
+ <field name="ParamList" type="index(Param)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ParamPtr" id="0x07" temporary="yes">
+ <schema>
+ <field name="Param" type="index(Param)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Param" id="0x08" section="21.30">
+ <schema>
+ <field name="Flags" type="ushort" cli-type="System.Reflection.ParameterAttributes"/><!-- specs: ParamAttributes -->
+ <field name="Sequence" type="ushort"/>
+ <field name="Name" type="index(#Strings)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="InterfaceImpl" id="0x09" section="21.21">
+ <schema>
+ <field name="Class" type="index(TypeDef)"/>
+ <field name="Interface" type="coded-index(TypeDefOrRef)"/>
+ </schema>
+ </table>
+
+
+
+ <!-- -->
+ <table name="MemberRef" id="0x0a" section="21.23">
+ <schema>
+ <field name="Class" type="coded-index(MemberRefParent)"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Signature" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Constant" id="0x0b" section="21.9">
+ <schema>
+ <field name="Type" type="short" cli-type="ElementType" remarks="1 byte ElementType constant, followed by a 1-byte padding zero."/>
+ <field name="Parent" type="coded-index(HasConstant)"/>
+ <field name="Value" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="CustomAttribute" id="0x0c" section="21.10">
+ <schema>
+ <field name="Parent" type="coded-index(HasCustomAttribute)"/>
+ <field name="Type" type="coded-index(CustomAttributeType)"/>
+ <field name="Value" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="FieldMarshal" id="0x0d" section="21.17">
+ <schema>
+ <field name="Parent" type="coded-index(HasFieldMarshal)"/>
+ <field name="NativeType" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="DeclSecurity" id="0x0e" section="21.11">
+ <schema>
+ <field name="Action" type="short"/><!-- TODO: System.Security.SecurityAction -->
+ <field name="Parent" type="coded-index(HasDeclSecurity)"/>
+ <field name="PermissionSet" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ClassLayout" id="0x0f" section="21.8">
+ <schema>
+ <field name="PackingSize" type="short"/><!-- TODO: use enum? -->
+ <field name="ClassSize" type="int"/>
+ <field name="Parent" type="index(TypeDef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="FieldLayout" id="0x10" section="21.16">
+ <schema>
+ <field name="Offset" type="int"/>
+ <field name="Field" type="index(Field)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="StandAloneSig" id="0x11" section="21.33">
+ <schema>
+ <field name="Signature" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="EventMap" id="0x12" section="21.12">
+ <schema>
+ <field name="Parent" type="index(TypeDef)"/>
+ <field name="EventList" type="index(Event)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="EventPtr" id="0x13" temporary="yes">
+ <schema>
+ <field name="Event" type="index(Event)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Event" id="0x14" section="21.13">
+ <schema>
+ <field name="EventFlags" type="short" cli-type="System.Reflection.EventAttributes"/><!-- specs: EventAttribute -->
+ <field name="Name" type="index(#Strings)"/>
+ <field name="EventType" type="coded-index(TypeDefOrRef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="PropertyMap" id="0x15" section="21.32">
+ <schema>
+ <field name="Parent" type="index(TypeDef)"/>
+ <field name="PropertyList" type="index(Property)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="PropertyPtr" id="0x16" temporary="yes">
+ <schema>
+ <field name="Property" type="index(Property)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Property" id="0x17" section="21.30"><!-- NOTE: previous name was "Properties" -->
+ <schema>
+ <field name="Flags" type="ushort" cli-type="System.Reflection.PropertyAttributes"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Type" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="MethodSemantics" id="0x18" section="21.26">
+ <schema>
+ <field name="Semantics" type="ushort" cli-type="MethodSemanticsAttributes"/>
+ <field name="Method" type="index(Method)"/>
+ <field name="Association" type="coded-index(HasSemantics)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="MethodImpl" id="0x19" section="21.25">
+ <schema>
+ <field name="Class" type="index(TypeDef)"/>
+ <field name="MethodBody" type="coded-index(MethodDefOrRef)"/>
+ <field name="MethodDeclaration" type="coded-index(MethodDefOrRef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ModuleRef" id="0x1a" section="21.28">
+ <schema>
+ <field name="Name" type="index(#Strings)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="TypeSpec" id="0x1b" section="21.36">
+ <schema>
+ <field name="Signature" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ImplMap" id="0x1c" section="21.20">
+ <schema>
+ <field name="MappingFlags" type="ushort" cli-type="PInvokeAttributes"/>
+ <field name="MemberForwarded" type="coded-index(MemberForwarded)"/>
+ <field name="ImportName" type="index(#Strings)"/>
+ <field name="ImportScope" type="index(ModuleRef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="FieldRVA" id="0x1d" section="21.18">
+ <schema>
+ <field name="RVA" type="RVA"/>
+ <field name="Field" type="index(Field)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ENCLog" id="0x1e" temporary="yes">
+ <schema>
+ <field name="Token" type="uint"/>
+ <field name="FuncCode" type="uint"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ENCMap" id="0x1f" temporary="yes">
+ <schema>
+ <field name="Token" type="uint"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="Assembly" id="0x20" section="21.2">
+ <schema>
+ <field name="HashAlgId" type="int" cli-type="System.Configuration.Assemblies.AssemblyHashAlgorithm"/>
+ <field name="MajorVersion" type="short"/>
+ <field name="MinorVersion" type="short"/>
+ <field name="BuildNumber" type="short"/>
+ <field name="RevisionNumber" type="short"/>
+ <field name="Flags" type="uint" cli-type="AssemblyFlags"/>
+ <field name="PublicKey" type="index(#Blob)"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Culture" type="index(#Strings)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="AssemblyProcessor" id="0x21" section="21.4">
+ <schema>
+ <field name="Processor" type="int"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="AssemblyOS" id="0x22" section="21.3">
+ <schema>
+ <field name="OSPlatformID" type="int"/>
+ <field name="OSMajorVersion" type="int"/>
+ <field name="OSMinorVersion" type="int"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="AssemblyRef" id="0x23" section="21.5">
+ <schema>
+ <field name="MajorVersion" type="short"/>
+ <field name="MinorVersion" type="short"/>
+ <field name="BuildNumber" type="short"/>
+ <field name="RevisionNumber" type="short"/>
+ <field name="Flags" type="uint" cli-type="AssemblyFlags"/>
+ <field name="PublicKeyOrToken" type="index(#Blob)"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Culture" type="index(#Strings)"/>
+ <field name="HashValue" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="AssemblyRefProcessor" id="0x24" section="21.7">
+ <schema>
+ <field name="Processor" type="int"/>
+ <field name="AssemblyRef" type="index(AssemblyRef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="AssemblyRefOS" id="0x25" section="21.6">
+ <schema>
+ <field name="OSPlatformID" type="int"/>
+ <field name="OSMajorVersion" type="int"/>
+ <field name="OSMinorVersion" type="int"/>
+ <field name="AssemblyRef" type="index(AssemblyRef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="File" id="0x26" section="21.19">
+ <schema>
+ <field name="Flags" type="uint" cli-type="System.IO.FileAttributes"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="HashValue" type="index(#Blob)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ExportedType" id="0x27" section="21.14">
+ <schema>
+ <field name="Flags" type="uint" cli-type="System.Reflection.TypeAttributes"/>
+ <field name="TypeDefId" type="index(TypeDef)"/>
+ <field name="TypeName" type="index(#Strings)"/>
+ <field name="TypeNamespace" type="index(#Strings)"/>
+ <field name="Implementation" type="coded-index(Implementation)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="ManifestResource" id="0x28" section="21.22">
+ <schema>
+ <field name="Offset" type="int"/>
+ <field name="Flags" type="uint" cli-type="ManifestResourceAttributes"/>
+ <field name="Name" type="index(#Strings)"/>
+ <field name="Implementation" type="coded-index(Implementation)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="NestedClass" id="0x29" section="21.29">
+ <schema>
+ <field name="NestedClass" type="index(TypeDef)"/>
+ <field name="EnclosingClass" type="index(TypeDef)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="TypeTyPar" id="0x2a" temporary="yes">
+ <schema>
+ <field name="Number" type="ushort"/>
+ <field name="Class" type="index(TypeDef)"/>
+ <field name="Bound" type="coded-index(TypeDefOrRef)"/>
+ <field name="Name" type="index(#Strings)"/>
+ </schema>
+ </table>
+
+
+ <!-- -->
+ <table name="MethodTyPar" id="0x2b" temporary="yes">
+ <schema>
+ <field name="Number" type="ushort"/>
+ <field name="Method" type="index(Method)"/>
+ <field name="Bound" type="coded-index(TypeDefOrRef)"/>
+ <field name="Name" type="index(#Strings)"/>
+ </schema>
+ </table>
+
+
+</tables>
+
+</md-schema>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/elem-type.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/elem-type.xsl
new file mode 100644
index 00000000000..48493493b79
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/elem-type.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or elem-type.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:text><![CDATA[
+ /// <summary>
+ /// Element types.
+ /// </summary>
+ /// <remarks>
+ /// Partition II, 22.1.14 Element Types used in Signatures
+ /// </remarks>
+ public enum ElementType {
+
+]]></xsl:text>
+
+<xsl:for-each select="md-schema/element-types/type">
+<xsl:text>&#9;&#9;</xsl:text><xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>,
+</xsl:for-each>
+ }
+
+}
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/gen-utils.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/gen-utils.xsl
new file mode 100644
index 00000000000..f80f75a322f
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/gen-utils.xsl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- -->
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+
+<!-- ******************************************************************* -->
+<!-- extracts arg x from expression of from 'f(x)' -->
+<xsl:template name="extract-arg">
+ <xsl:param name="expr" select="@type"/>
+ <xsl:value-of select="normalize-space(substring-after(substring-before($expr,')'),'('))"/>
+</xsl:template>
+
+
+<!-- ******************************************************************* -->
+<xsl:template name="get-expanded-size">
+ <xsl:param name="fields" select="schema/field"/>
+
+ <xsl:for-each select="$fields">
+ <xsl:choose>
+ <!-- RVA special case, PE library type -->
+ <xsl:when test="@type = 'RVA'">
+ <xsl:text>RVA.Size</xsl:text>
+ </xsl:when>
+ <!-- table indices -->
+ <xsl:when test="starts-with(@type,'index') or starts-with(@type,'coded-index')">
+ <xsl:text>4</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('sizeof (', @type, ')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="position() != last()">
+ <xsl:text> + </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+
+
+<!-- ******************************************************************* -->
+<xsl:template name="get-field-type">
+ <xsl:param name="field" select="."/>
+
+ <xsl:choose>
+ <!-- table indices -->
+ <xsl:when test="starts-with($field/@type,'index')">
+ <xsl:text>int</xsl:text>
+ </xsl:when>
+ <!-- coded token -->
+ <xsl:when test="starts-with($field/@type,'coded-index')">
+ <xsl:text>MDToken</xsl:text>
+ </xsl:when>
+ <!-- explicit library type -->
+ <xsl:when test="$field/@cli-type">
+ <xsl:value-of select="$field/@cli-type"/>
+ </xsl:when>
+ <!-- primitive type -->
+ <xsl:otherwise>
+ <xsl:value-of select="$field/@type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+
+
+</xsl:stylesheet>
+
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/rows.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/rows.xsl
new file mode 100644
index 00000000000..26c9178fedc
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/rows.xsl
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:import href="gen-utils.xsl"/>
+<xsl:output method="text"/>
+
+
+<!--
+-->
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or rows.xsl if you want to make changes.
+
+using System;
+using System.IO;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:for-each select="md-schema/tables/table">
+
+ /// &lt;summary&gt;
+ /// Represents row in <xsl:value-of select="@name"/> table.
+ /// &lt;/summary&gt;
+ /// &lt;remarks&gt;
+ /// <xsl:if test="@section">See Partition II, Metadata; section <xsl:value-of select="@section"/></xsl:if>
+ /// &lt;/remarks&gt;
+ public class <xsl:value-of select="@name"/>Row : Row {
+
+ private MDTable table;
+
+ <xsl:for-each select="schema/field">
+ public <xsl:call-template name="get-field-type"/><xsl:value-of select="concat(' ',@name)"/>;</xsl:for-each>
+
+ public <xsl:value-of select="@name"/>Row()
+ {
+ }
+
+ public <xsl:value-of select="@name"/>Row(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// &lt;summary&gt;
+ /// Row in <xsl:value-of select="@name"/> table has <xsl:value-of select="count(schema/field)"/> columns.
+ /// &lt;/summary&gt;
+ public virtual int NumberOfColumns {
+ get {
+ return <xsl:value-of select="count(schema/field)"/>;
+ }
+ }
+
+
+ /// &lt;summary&gt;
+ /// Logical size of this instance in bytes.
+ /// &lt;/summary&gt;
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// &lt;summary&gt;
+ /// &lt;/summary&gt;
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// &lt;summary&gt;
+ /// Logical size of this type of row in bytes.
+ /// &lt;/summary&gt;
+ unsafe public static int LogicalSize {
+ get {
+ return <xsl:call-template name="get-expanded-size"/>;
+ }
+ }
+
+
+ /// &lt;summary&gt;
+ /// Fills the row from the array of bytes.
+ /// &lt;/summary&gt;
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+ <xsl:for-each select="schema/field">
+ this.<xsl:value-of select="@name"/> = <xsl:call-template name="get-field-conversion-code"/>;
+ <xsl:if test="position() != last()">
+ <xsl:text>offs += </xsl:text>
+ <xsl:call-template name="get-expanded-size">
+ <xsl:with-param name="fields" select="."/>
+ </xsl:call-template>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ }
+
+ <xsl:variable name="spaces" select="' '"/>
+
+ /// &lt;summary&gt;
+ /// &lt;/summary&gt;
+ public void Dump(TextWriter writer) {
+ <xsl:text>string dump = String.Format(</xsl:text>
+ <xsl:for-each select="schema/field">
+ "<xsl:value-of select="concat(@name,substring($spaces,1,18 - string-length(@name)))"/>: {<xsl:value-of select="position () - 1"/>}" <xsl:text>+ Environment.NewLine</xsl:text>
+ <xsl:if test="position() != last()"><xsl:text> + </xsl:text></xsl:if>
+ <xsl:if test="position() = last()"><xsl:text>,</xsl:text></xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="schema/field">
+ <xsl:choose><!-- TODO: do something about ugly expression below -->
+ <xsl:when test="contains(@type,'#Strings')">
+ (<xsl:text>Table == null) ? </xsl:text>
+ <xsl:value-of select="concat(@name, '.ToString()')"/>
+ <xsl:text> : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [</xsl:text>
+ <xsl:value-of select="@name"/><xsl:text>] + "\" (#Strings[0x" + </xsl:text><xsl:value-of select="@name"/><xsl:text>.ToString("X") + "])"</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(@type,'index') and not(contains(@type,'coded-index'))">
+ &quot;<xsl:call-template name="extract-arg"/>[&quot; + <xsl:value-of select="@name"/><xsl:text>.ToString() + "]"</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ this.<xsl:value-of select="@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="position() != last()"><xsl:text>,</xsl:text></xsl:if>
+ </xsl:for-each>
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// &lt;summary&gt;
+ /// &lt;/summary&gt;
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+</xsl:for-each>
+
+
+}
+</xsl:template>
+
+
+
+
+
+
+<!-- ******************************************************************* -->
+<xsl:template name="get-field-conversion-code">
+ <xsl:param name="field" select="."/>
+ <xsl:variable name="type" select="$field/@type"/>
+
+ <xsl:choose>
+ <!-- RVA - library type -->
+ <xsl:when test="$type = 'RVA'">
+ <xsl:text>LEBitConverter.ToUInt32(buff, offs)</xsl:text>
+ </xsl:when>
+
+ <!-- table indices -->
+ <xsl:when test="starts-with($type,'index')">
+ <xsl:text>LEBitConverter.ToInt32(buff, offs)</xsl:text>
+ </xsl:when>
+
+ <!-- coded tokens -->
+ <xsl:when test="starts-with($type,'coded-index')">
+ <xsl:text>TabsDecoder.DecodeToken(CodedTokenId.</xsl:text>
+ <xsl:call-template name="extract-arg">
+ <xsl:with-param name="expr" select="$type"/>
+ </xsl:call-template>
+ <xsl:text>, LEBitConverter.ToInt32(buff, offs))</xsl:text>
+ </xsl:when>
+
+ <!-- primitive type -->
+ <xsl:otherwise>
+ <!-- explicitly mapped to library type -->
+ <xsl:if test="$field/@cli-type">
+ <xsl:value-of select="concat('(', $field/@cli-type, ') ')"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$type = 'byte'">
+ <xsl:text>buff [offs]</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'short'">
+ <xsl:text>LEBitConverter.ToInt16(buff, offs)</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'ushort'">
+ <xsl:text>LEBitConverter.ToUInt16(buff, offs)</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'int'">
+ <xsl:text>LEBitConverter.ToInt32(buff, offs)</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'uint'">
+ <xsl:text>LEBitConverter.ToUInt32(buff, offs)</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'long'">
+ <xsl:text>LEBitConverter.ToInt64(buff, offs)</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'ulong'">
+ <xsl:text>LEBitConverter.ToUInt64(buff, offs)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>/* ERROR! */</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/table-id.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/table-id.xsl
new file mode 100644
index 00000000000..9d9cdb5e0a8
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/table-id.xsl
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or table-id.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:text><![CDATA[
+ /// <summary>
+ /// Identifiers for tables in #~ heap.
+ /// </summary>
+ /// <remarks>
+ /// Partition II, 21.x
+ /// </remarks>
+ public enum TableId {
+]]></xsl:text>
+
+<xsl:for-each select="md-schema/tables/table">
+<xsl:text>&#9;&#9;</xsl:text><xsl:value-of select="@name"/> = <xsl:value-of select="@id"/>,
+</xsl:for-each>
+
+ <!-- NOTE: bound values assigned explicitly based on XML definition,
+ so it's safe to add your own members below/above these lines.
+ -->
+ MAX = <xsl:value-of select="md-schema/tables/table[position()=last()]/@name"/>,
+ Count = MAX + 1
+ }
+
+}
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/tabs-base.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/tabs-base.xsl
new file mode 100644
index 00000000000..e3fa441e8ea
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/tabs-base.xsl
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or tabs-base.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:text><![CDATA[
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public abstract class TablesHeapBase : MDHeap {
+
+ internal TablesHeapBase(MDStream stream) : base(stream)
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets bitvector of valid tables (64-bit).
+ /// </summary>
+ public abstract long Valid {get; set;}
+
+ /// <summary>
+ /// Gets or sets bitvector of sorted tables (64-bit).
+ /// </summary>
+ public abstract long Sorted {get; set;}
+
+
+ //
+ // Accessors to decode Valid bitvector.
+ //
+
+]]></xsl:text>
+
+<xsl:for-each select="md-schema/tables/table">
+ /// &lt;summary&gt;
+ /// True if heap has <xsl:value-of select="@name"/> table.
+ /// &lt;/summary&gt;
+ public bool Has<xsl:value-of select="@name"/> {
+ get {
+ return (Valid &amp; (1L &lt;&lt; <xsl:value-of select="@id"/>)) != 0;
+ }
+ set {
+ long mask = (1L &lt;&lt; <xsl:value-of select="@id"/>);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &amp;= ~mask;
+ }
+ }
+ }
+</xsl:for-each>
+
+ }
+
+}
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/tabs-decoder.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/tabs-decoder.xsl
new file mode 100644
index 00000000000..e6c71d4ce58
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/tabs-decoder.xsl
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:import href="gen-utils.xsl"/>
+
+<xsl:output method="text"/>
+
+
+<!-- ******************************************************************* -->
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or tabs-decoder.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:text><![CDATA[
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public sealed class TabsDecoder {
+
+ private TabsDecoder()
+ {
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public static MDToken DecodeToken(CodedTokenId id, int data)
+ {
+ MDToken res = new MDToken();
+ int tag;
+ int rid;
+ TokenType tok;
+
+ switch (id) {
+]]></xsl:text>
+
+<xsl:for-each select="md-schema/coded-tokens/map">
+ case CodedTokenId.<xsl:value-of select="@name"/> :
+ tag = data &amp; 0x<xsl:value-of select="substring('000103070F1F3F7FFF',1 + (2 * @bits),2)"/>;
+ rid = (int) ((uint) data &gt;&gt; <xsl:value-of select="@bits"/>);
+ switch (tag) {
+<xsl:for-each select="table">
+ <xsl:variable name="tok-type">
+ <xsl:choose>
+ <xsl:when test="boolean(@token-type)">
+ <xsl:value-of select="@token-type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ case <xsl:value-of select="@tag"/> :
+ tok = TokenType.<xsl:value-of select="$tok-type"/>;
+ break;
+</xsl:for-each>
+ default :
+ throw new BadMetaDataException("Invalid coded token for <xsl:value-of select="@name"/>, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+</xsl:for-each>
+
+
+<xsl:text><![CDATA[
+ default:
+ break;
+ }
+ return res;
+ }
+
+
+ private static int GetCodedIndexSize(TablesHeap heap, CodedTokenId id, int [] rows)
+ {
+ int res = 0;
+
+ switch (id) {
+]]></xsl:text>
+
+<xsl:for-each select="md-schema/coded-tokens/map">
+ case CodedTokenId.<xsl:value-of select="@name"/> :
+ res = MDUtils.Max(<xsl:call-template name="get-tables-list"/>);
+ res = res &lt; (1 &lt;&lt; (16 - <xsl:value-of select="@bits"/>)) ? 2 : 4;
+ break;
+</xsl:for-each>
+
+<xsl:text><![CDATA[
+ default:
+ break;
+ }
+
+ return res;
+ }
+
+
+ private static int GetIndexSize(TableId tab, int [] rows)
+ {
+ // Index is 2 bytes wide if table has less than 2^16 rows
+ // otherwise it's 4 bytes wide.
+ return ((uint) rows [(int) tab]) < (1 << 16) ? 2 : 4;
+ }
+
+
+ private static void AllocBuff(ref byte [] buff, int size)
+ {
+ if (buff == null || buff.Length < size) {
+ buff = new byte [(size + 4) & ~3];
+ }
+ Array.Clear(buff, 0, size);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ unsafe public static int DecodePhysicalTables(TablesHeap heap, byte [] data, int offs, int [] rows)
+ {
+ int rowSize; // expanded row size (all indices are dwords)
+ int fldSize; // physical field size
+ int dest;
+ int nRows;
+ byte [] buff = null;
+ int si = heap.StringsIndexSize;
+ int gi = heap.GUIDIndexSize;
+ int bi = heap.BlobIndexSize;
+]]></xsl:text>
+
+ <xsl:apply-templates select="md-schema/tables/table"/>
+
+<xsl:text><![CDATA[
+ return offs;
+ }
+
+ } // end class
+} // end namespace
+]]></xsl:text>
+
+</xsl:template>
+
+
+
+<!-- ******************************************************************* -->
+<xsl:template name="get-tables-list">
+ <xsl:param name="map-node" select="."/>
+
+ <xsl:for-each select="$map-node/table">
+ <xsl:choose>
+ <xsl:when test="@name = 'String'"><!-- HACK -->
+ <xsl:text>(heap.StringsIndexSize &gt; 2 ? 1 &lt;&lt; 17 : 1)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>rows [(int) TableId.</xsl:text><xsl:value-of select="@name"/><xsl:text>]</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+
+
+
+<!-- ******************************************************************* -->
+<xsl:template name="get-field-size">
+ <xsl:param name="type" select="@type"/>
+
+ <xsl:choose>
+ <!-- RVA special case, PE library type -->
+ <xsl:when test="$type = 'RVA'">
+ <xsl:text>RVA.Size</xsl:text>
+ </xsl:when>
+ <!-- #Strings, #Blob or #GUID -->
+ <xsl:when test="contains($type,'#')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-after($type, '#'), 'Strings')">
+ <xsl:text>si</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(substring-after($type, '#'), 'Blob')">
+ <xsl:text>bi</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(substring-after($type, '#'), 'GUID')">
+ <xsl:text>gi</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>ERROR: Unknown index - </xsl:text>
+ <xsl:value-of select="$type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- table indices -->
+ <xsl:when test="starts-with($type,'index')">
+ <xsl:variable name="tab">
+ <xsl:call-template name="extract-arg"/>
+ </xsl:variable>
+ <xsl:value-of select="concat('GetIndexSize(TableId.', $tab, ', rows)')"/>
+ </xsl:when>
+ <!-- coded tokens -->
+ <xsl:when test="starts-with($type,'coded-index')">
+ <xsl:variable name="tab">
+ <xsl:call-template name="extract-arg"/>
+ </xsl:variable>
+ <xsl:value-of select="concat('GetCodedIndexSize(heap, CodedTokenId.', $tab, ', rows)')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('sizeof (', $type, ')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+
+
+<!-- ******************************************************************* -->
+<xsl:template match="md-schema/tables/table">
+ if (heap.Has<xsl:value-of select="@name"/>) {
+ rowSize = <xsl:call-template name="get-expanded-size"/>;
+ nRows = rows [(int) TableId.<xsl:value-of select="@name"/>];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new <xsl:value-of select="@name"/>Table(heap);
+
+ for (int i = nRows; --i >= 0;) {
+ <xsl:for-each select="schema/field">
+ <xsl:variable name="fld-size">
+ <xsl:call-template name="get-field-size"/>
+ </xsl:variable>
+ <xsl:variable name="exp-fld-size">
+ <xsl:call-template name="get-expanded-size">
+ <xsl:with-param name="fields" select="."/>
+ </xsl:call-template>
+ </xsl:variable>
+ // <xsl:value-of select="@name"/>, <xsl:value-of select="@type"/>
+ fldSize = <xsl:value-of select="$fld-size"/>;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += <xsl:value-of select="$exp-fld-size"/>;
+ </xsl:for-each>
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/tabs.xsl b/mcs/class/Mono.PEToolkit/build/srcgen/tabs.xsl
new file mode 100644
index 00000000000..7845be66a48
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/tabs.xsl
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or tabs.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+<xsl:for-each select="md-schema/tables/table">
+ public class <xsl:value-of select="@name"/>Table : MDTableBase {
+
+ public <xsl:value-of select="@name"/>Table(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new <xsl:value-of select="@name"/>Row(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += <xsl:value-of select="@name"/>Row.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "<xsl:value-of select="@name"/>";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.<xsl:value-of select="@name"/>;
+ }
+ }
+ }
+</xsl:for-each>
+
+}
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mcs/class/Mono.PEToolkit/build/srcgen/xslt.wsf b/mcs/class/Mono.PEToolkit/build/srcgen/xslt.wsf
new file mode 100644
index 00000000000..ea99a085bb9
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/build/srcgen/xslt.wsf
@@ -0,0 +1,231 @@
+<?xml version="1.0"?>
+
+<!--
+ | Author: Sergey Chaban <serge@wildwestsoftware.com>
+ -->
+
+<job id="xslt">
+
+ <runtime>
+
+ <description></description>
+
+ <named name="inFile"
+ type="string"
+ required="true"
+ helpstring=""
+ />
+
+ <named name="styleFile"
+ type="string"
+ required="true"
+ helpstring=""
+ />
+
+ <named name="outFile"
+ type="string"
+ required="false"
+ helpstring=""
+ />
+
+
+ <named name="unicode"
+ type="boolean"
+ required="false"
+ helpstring=""
+ />
+
+ <named name="timestamp"
+ type="boolean"
+ required="false"
+ helpstring=""
+ />
+
+
+ <named name="timing"
+ type="boolean"
+ required="false"
+ helpstring=""
+ />
+
+ <unnamed name="params"
+ type="string"
+ many="true"
+ required="false"
+ helpstring=""
+ />
+
+ </runtime>
+
+<script language="JScript"><![CDATA[
+
+ function Filter(str) {
+ this.data=str.split("\r\n");
+ this.namespaces=new Array();
+ this.pos=0;
+ this.numLines=0;
+ this.docComment=false;
+ this.indent="";
+ this.readLine=Filter_readLine;
+ }
+
+ function Filter_readLine() {
+
+ if (this.data==null
+ || this.data.length==0
+ || this.pos>=this.data.length)
+ return null;
+
+ var res=this.data[this.pos++];
+
+ if (res.charCodeAt(0)==127) {
+ this.docComment^=true;
+ if (this.docComment) {
+ var n=res.charCodeAt(1)-0x30;
+ this.indent="";
+ for (var i=0;i<n;i++,this.indent+="\t");
+ }
+ res=this.readLine();
+ } else if (this.docComment) {
+ res=this.indent+"/// "+res;
+ } else if (res.charCodeAt(0)==126) {
+ var ns=res.substr(1);
+ if (this.namespaces[ns]==null) {
+ this.namespaces[ns]=true;
+ res="using "+ns+";";
+ } else {
+ res=this.readLine();
+ }
+ }
+ ++this.numLines;
+ return res;
+ }
+
+
+
+ var isUnicode=false;
+ var timestamp=true;
+ var timing=false;
+
+ var start=0;
+ var ellapsed=0;
+
+
+ function writeFile(fileName,data) {
+ var res=0;
+ try {
+ var fso=WScript.CreateObject("Scripting.FileSystemObject");
+ var txtStream=fso.CreateTextFile(fileName,true,isUnicode);
+ if (false) {
+ txtStream.Write(data);
+ } else {
+ var filter=new Filter(data);
+ var str=filter.readLine();
+ while (str!=null) {
+ txtStream.WriteLine(str);
+ str=filter.readLine();
+ }
+ res=filter.numLines;
+ }
+ txtStream.Close();
+ } catch (e) {
+ WScript.Echo("writeFile() error: "+e);
+ }
+ return res;
+ }
+
+ var xmlFile=WScript.Arguments.Named.Item("inFile");
+ var xslFile=WScript.Arguments.Named.Item("styleFile");
+ var outFile=WScript.Arguments.Named.Item("outFile");
+
+ var unicodeFlag=WScript.Arguments.Named.Item("unicode");
+ isUnicode=(unicodeFlag!=null)?unicodeFlag:false;
+
+ var timestampFlag=WScript.Arguments.Named.Item("timestamp");
+ timestamp=(timestampFlag!=null)?timestampFlag:true;
+
+ var timingFlag=WScript.Arguments.Named.Item("timing");
+ timing=(timingFlag!=null)?timingFlag:false;
+
+ var writeToFile=(outFile!=null);
+
+ var params=new Array();
+
+
+ for (var i=0;i<WScript.Arguments.Unnamed.Count;i++) {
+ var prm=WScript.Arguments.Unnamed.Item(i);
+ var nv=prm.split("=");
+ if (nv.length==2) {
+ params[params.length]={name:nv[0],value:nv[1]};
+ }
+ }
+
+ if (timestamp) {
+ params[params.length]={name:"time-stamp",value:(new Date()).toGMTString()};
+ }
+
+ var res;
+ var xmlObj,xslObj;
+
+ var xmlVer="";
+
+ try {
+ xmlObj=WScript.CreateObject("Msxml2.FreeThreadedDOMDocument"+xmlVer);
+ xslObj=WScript.CreateObject("Msxml2.FreeThreadedDOMDocument"+xmlVer);
+ } catch (e) {
+ WScript.Echo("This script requires MSXML 3.0 (release) or better.")
+ WScript.Quit(-1);
+ }
+
+
+ xmlObj.async=false;
+ res=xmlObj.load(xmlFile);
+ if (!res) {
+ WScript.Echo("Unable to load source file.")
+ WScript.Quit(-1);
+ }
+
+ xslObj.async=false;
+ res=xslObj.load(xslFile);
+ if (!res) {
+ WScript.Echo("Unable to load stylesheet file.")
+ WScript.Quit(-1);
+ }
+
+ var template=WScript.CreateObject("Msxml2.XSLTemplate"+xmlVer);
+ template.stylesheet=xslObj;
+ var processor=template.createProcessor();
+ processor.input=xmlObj;
+ for (var i in params) {
+ processor.addParameter(params[i].name,params[i].value);
+ }
+
+ start=(new Date()).valueOf();
+ res=processor.transform();
+ ellapsed=(new Date()).valueOf()-start;
+
+ if (timing) {
+ WScript.Echo("Transform took "+ellapsed+" ms.")
+ }
+
+ var n=0;
+ var output=processor.output;
+
+ if (writeToFile) {
+ n=writeFile(outFile,output);
+ } else {
+ var filter=new Filter(output);
+ var str=filter.readLine();
+ while (str!=null) {
+ WScript.Echo(str);
+ str=filter.readLine();
+ }
+ n=filter.numLines;
+ }
+
+
+ WScript.Quit(0);
+
+]]></script>
+
+</job>
diff --git a/mcs/class/Mono.PEToolkit/list.unix b/mcs/class/Mono.PEToolkit/list.unix
new file mode 100644
index 00000000000..d5441d6343a
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/list.unix
@@ -0,0 +1,42 @@
+build/mddump.cs
+BadImageException.cs
+COFFHeader.cs
+Characteristics.cs
+CheckSum.cs
+CorHeader.cs
+DOSHeader.cs
+DataDir.cs
+ExeSignature.cs
+Image.cs
+LEBitConverter.cs
+MachineId.cs
+PEHeader.cs
+PEUtils.cs
+RVA.cs
+Section.cs
+SectionCharacteristics.cs
+Subsystem.cs
+metadata/AssemblyFlags.cs
+metadata/BadMetaDataException.cs
+metadata/CodedTokenId.cs
+metadata/ElementType.cs
+metadata/GUIDHeap.cs
+metadata/MDHeap.cs
+metadata/MDStream.cs
+metadata/MDTable.cs
+metadata/MDToken.cs
+metadata/MDUtils.cs
+metadata/ManifestResourceAttributes.cs
+metadata/MetaDataRoot.cs
+metadata/MethodIL.cs
+metadata/MethodSemanticsAttributes.cs
+metadata/PInvokeAttributes.cs
+metadata/Row.cs
+metadata/Rows.cs
+metadata/StringsHeap.cs
+metadata/TableId.cs
+metadata/Tables.cs
+metadata/TablesHeap.cs
+metadata/TablesHeapBase.cs
+metadata/TabsDecoder.cs
+metadata/TokenType.cs
diff --git a/mcs/class/Mono.PEToolkit/makefile.gnu b/mcs/class/Mono.PEToolkit/makefile.gnu
new file mode 100644
index 00000000000..d53b62840ef
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/Mono.PEToolkit.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = --unsafe -r corlib -r System.Xml -r mscorlib
+
+SOURCES_INCLUDE=
+SOURCES_EXCLUDE=
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/Mono.PEToolkit/metadata/AssemblyFlags.cs b/mcs/class/Mono.PEToolkit/metadata/AssemblyFlags.cs
new file mode 100644
index 00000000000..8b0b00d2c06
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/AssemblyFlags.cs
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Values for AssemblyFlags.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, 22.1.2
+ /// </remarks>
+ [Flags]
+ public enum AssemblyFlags {
+ /// <summary>
+ /// The assembly reference holds the full (unhashed) public key.
+ /// </summary>
+ PublicKey = 0x0001,
+
+ /// <summary>
+ /// The assembly is side by side compatible.
+ /// </summary>
+ SideBySideCompatible = 0x0000,
+
+ /// <summary>
+ /// The assembly cannot execute with other versions
+ /// if they are executing in the same application domain.
+ /// </summary>
+ NonSideBySideAppDomain = 0x0010,
+
+ /// <summary>
+ /// The assembly cannot execute with other versions
+ /// if they are executing in the same process.
+ /// </summary>
+ NonSideBySideProcess = 0x0020,
+
+ /// <summary>
+ /// The assembly cannot execute with other versions
+ /// if they are executing on the same machine.
+ /// </summary>
+ NonSideBySideMachine = 0x0030,
+
+ /// <summary>
+ /// JIT should generate CIL-to-native code map.
+ /// </summary>
+ EnableJITcompileTracking = 0x8000,
+
+ /// <summary>
+ /// JIT should not generate optimized code.
+ /// </summary>
+ DisableJITcompileOptimizer = 0x4000,
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/BadMetaDataException.cs b/mcs/class/Mono.PEToolkit/metadata/BadMetaDataException.cs
new file mode 100644
index 00000000000..16e321f5b73
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/BadMetaDataException.cs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ public class BadMetaDataException : Exception {
+
+ public BadMetaDataException() : base()
+ {
+ }
+
+ public BadMetaDataException(string msg) : base(msg)
+ {
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/CodedTokenId.cs b/mcs/class/Mono.PEToolkit/metadata/CodedTokenId.cs
new file mode 100644
index 00000000000..381a1ccad00
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/CodedTokenId.cs
@@ -0,0 +1,31 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or coded-id.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public enum CodedTokenId {
+
+ TypeDefOrRef = 0,
+ HasConstant = 1,
+ HasCustomAttribute = 2,
+ HasFieldMarshal = 3,
+ HasDeclSecurity = 4,
+ MemberRefParent = 5,
+ HasSemantics = 6,
+ MethodDefOrRef = 7,
+ MemberForwarded = 8,
+ Implementation = 9,
+ CustomAttributeType = 10,
+ ResolutionScope = 11,
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/ElementType.cs b/mcs/class/Mono.PEToolkit/metadata/ElementType.cs
new file mode 100644
index 00000000000..c8ac9f6c57a
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/ElementType.cs
@@ -0,0 +1,53 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or elem-type.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+ /// <summary>
+ /// Element types.
+ /// </summary>
+ /// <remarks>
+ /// Partition II, 22.1.14 Element Types used in Signatures
+ /// </remarks>
+ public enum ElementType {
+
+ End = 0x00,
+ Void = 0x01,
+ Boolean = 0x02,
+ Char = 0x03,
+ I1 = 0x04,
+ U1 = 0x05,
+ I2 = 0x06,
+ U2 = 0x07,
+ I4 = 0x08,
+ U4 = 0x09,
+ I8 = 0x0a,
+ U8 = 0x0b,
+ R4 = 0x0c,
+ R8 = 0x0d,
+ String = 0x0e,
+ Ptr = 0x0f,
+ ByRef = 0x10,
+ ValueType = 0x11,
+ Class = 0x12,
+ Array = 0x14,
+ TypedByRef = 0x16,
+ I = 0x18,
+ U = 0x19,
+ FnPtr = 0x1b,
+ Object = 0x1c,
+ SzArray = 0x1d,
+ CModReqd = 0x1f,
+ CModOpt = 0x20,
+ Internal = 0x21,
+ Modifier = 0x40,
+ Sentinel = 0x41,
+ Pinned = 0x45,
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/GUIDHeap.cs b/mcs/class/Mono.PEToolkit/metadata/GUIDHeap.cs
new file mode 100644
index 00000000000..d396a740fa7
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/GUIDHeap.cs
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// #GUID heap
+ /// </summary>
+ /// <remarks>
+ /// 23.1.5
+ /// </remarks>
+ public class GUIDHeap : MDHeap {
+
+ private byte [] data;
+
+ internal GUIDHeap(MDStream stream) : base(stream)
+ {
+ }
+
+ unsafe override public void FromRawData(byte [] rawData)
+ {
+ data = rawData;
+ }
+
+ public Guid this [int index] {
+ get {
+ if (index + 16 > data.Length)
+ throw new IndexOutOfRangeException();
+ byte [] buff = new byte [16];
+ Buffer.BlockCopy(data, index, buff, 0, 16);
+ return new Guid(buff);
+ }
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/Mono.PEToolkit/metadata/MDHeap.cs b/mcs/class/Mono.PEToolkit/metadata/MDHeap.cs
new file mode 100644
index 00000000000..2f25cb51ccb
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MDHeap.cs
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Base class for all metadata heaps.
+ /// </summary>
+ public abstract class MDHeap {
+
+
+ protected MDStream stream;
+
+ protected MDHeap(MDStream stream)
+ {
+ this.stream = stream;
+ if (stream.RawData != null) {
+ FromRawData(stream.RawData);
+ }
+ }
+
+ public MDStream Stream {
+ get {
+ return stream;
+ }
+ }
+
+ public abstract void FromRawData(byte [] rawData);
+
+
+ /// <summary>
+ /// Heap factory.
+ /// </summary>
+ /// <param name="stream">Base stream.</param>
+ /// <returns></returns>
+ public static MDHeap Create(MDStream stream)
+ {
+ MDHeap res = null;
+
+ switch (stream.Name) {
+ case "#~" :
+ case "#-" :
+ res = new TablesHeap(stream);
+ break;
+ case "#Strings" :
+ res = new StringsHeap(stream);
+ break;
+ case "#GUID" :
+ res = new GUIDHeap(stream);
+ break;
+ }
+
+ return res;
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/MDStream.cs b/mcs/class/Mono.PEToolkit/metadata/MDStream.cs
new file mode 100644
index 00000000000..25c5c3b128e
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MDStream.cs
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Metadata stream.
+ /// </summary>
+ public class MDStream {
+
+ /// <summary>
+ /// MetaData stream header as described
+ /// in ECMA CLI specs, Partition II Metadata, 23.1.2
+ /// </summary>
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct Header {
+ internal uint offs;
+ internal uint size;
+ internal string name;
+
+
+ unsafe public void Read(BinaryReader reader, MDStream stream)
+ {
+ sbyte* pName = stackalloc sbyte [32];
+ sbyte* p = pName;
+
+ fixed (void* pThis = &this.offs) {
+ PEUtils.ReadStruct(reader, pThis, 2 * sizeof (uint));
+ }
+
+ while (true) {
+ sbyte c = reader.ReadSByte();
+ if (c == 0) break;
+ *p++ = c;
+ }
+
+ int len = (int) (p - pName);
+ if (len != 0) {
+ name = new string(pName, 0, len, Encoding.ASCII);
+ } else {
+ throw new BadImageException("Invalid stream name.");
+ }
+
+ // Round up to dword boundary.
+ long pos = reader.BaseStream.Position;
+ if (stream != null) pos -= stream.Root.filePos;
+ pos += 3;
+ pos &= ~3;
+ if (stream != null) pos += stream.Root.filePos;
+
+ // Advance file pointer.
+ reader.BaseStream.Position = pos;
+ }
+ } // header
+
+
+
+ private MetaDataRoot root;
+ private MDHeap heap;
+ internal Header hdr;
+ private byte [] data;
+
+
+ public MDStream(MetaDataRoot root)
+ {
+ this.root = root;
+ hdr = new Header();
+ data = null;
+ heap = null;
+ }
+
+
+ public uint Offset {
+ get {
+ return hdr.offs;
+ }
+ set {
+ hdr.offs = value;
+ }
+ }
+
+ public uint Size {
+ get {
+ return hdr.size;
+ }
+ set {
+ hdr.size = value;
+ }
+ }
+
+ /// <summary>
+ /// Name of the stream.
+ /// </summary>
+ /// <remarks>
+ /// Stored on-disk as a null-terminated ASCII string,
+ /// rounded up to 4-byte boundary.
+ /// </remarks>
+ public string Name {
+ get {
+ return hdr.name;
+ }
+ set {
+ hdr.name = value;
+ }
+ }
+
+ public byte [] RawData {
+ get {
+ return data;
+ }
+ }
+
+ public MetaDataRoot Root {
+ get {
+ return root;
+ }
+ }
+
+ public MDHeap Heap {
+ get {
+ lock (this) {
+ if (heap == null) InitHeap();
+ return heap;
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// Reads stream header and body from supplied BinaryReader.
+ /// </summary>
+ /// <remarks>
+ /// Reader must be positioned at the first byte of metadata stream.
+ /// </remarks>
+ /// <param name="reader"></param>
+ unsafe public void Read(BinaryReader reader)
+ {
+ hdr.Read(reader, this);
+ long oldPos = reader.BaseStream.Position;
+
+ // Offset field in the stream header is relataive to
+ // the start of metadata.
+ reader.BaseStream.Position = root.filePos + hdr.offs;
+ data = reader.ReadBytes((int) hdr.size);
+
+ // set reader's position to the first byte after
+ // stream header.
+ reader.BaseStream.Position = oldPos;
+ }
+
+
+ /// <summary>
+ /// Initializes heap for this stream.
+ /// </summary>
+ protected void InitHeap()
+ {
+ heap = MDHeap.Create(this);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Name : {0}" + Environment.NewLine +
+ "Offset : 0x{1:x8}" + Environment.NewLine +
+ "Size : 0x{2:x8}" + Environment.NewLine,
+ hdr.name, hdr.offs, hdr.size
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter ();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/MDTable.cs b/mcs/class/Mono.PEToolkit/metadata/MDTable.cs
new file mode 100644
index 00000000000..418fcd219b5
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MDTable.cs
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit.Metadata {
+
+ public interface MDTable {
+ /// <summary>
+ /// Number of rows in the table.
+ /// </summary>
+ int NumberOfRows {get;}
+
+ /// <summary>
+ /// Gets ot sets a row in the metadata table.
+ /// </summary>
+ Row this [int rowNum] {get; set;}
+
+ void Add(Row row);
+
+ void FromRawData(byte [] buff, int offs, int numRows);
+
+ string Name {get;}
+
+ TableId Id {get;}
+
+ MDHeap Heap {get;}
+
+ void Dump(TextWriter writer);
+ }
+
+
+ public abstract class MDTableBase : MDTable {
+ protected ArrayList rows; // rows storage
+ protected MDHeap heap; // base heap
+
+ public MDTableBase(MDHeap heap)
+ {
+ rows = new ArrayList();
+ this.heap = heap;
+
+ if (heap is TablesHeap) {
+ (heap as TablesHeap).RegisterTable(this);
+ }
+ }
+
+ public virtual int NumberOfRows {
+ get {
+ return rows.Count;
+ }
+ }
+
+
+ public virtual Row this [int rowNum] {
+ get {
+ if (rowNum < 0) throw new IndexOutOfRangeException("Row[]");
+
+ // Zero row, special case
+ if (rowNum == 0) return NullRow.Instance;
+ return rows [rowNum - 1] as Row;
+ }
+ set {
+ rows.Insert(rowNum, value);
+ }
+ }
+
+ public virtual void Add(Row row)
+ {
+ rows.Add(row);
+ }
+
+ public abstract void FromRawData(byte [] buff, int offs, int numRows);
+
+ public abstract string Name {get;}
+
+ public abstract TableId Id {get;}
+
+ public virtual MDHeap Heap {
+ get {
+ return heap;
+ }
+ }
+
+ public virtual void Dump(TextWriter writer)
+ {
+ writer.WriteLine("=========================================");
+ writer.WriteLine("Table '{0}', id = {1} (0x{2}), rows = {3}",
+ Name, Id, ((int) Id).ToString("X"), NumberOfRows);
+ int n = 1;
+ foreach (Row row in rows) {
+ writer.WriteLine();
+ writer.WriteLine("Row #{0}", n++);
+ writer.WriteLine("-------------");
+ row.Dump(writer);
+ writer.WriteLine();
+ }
+ }
+
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/MDToken.cs b/mcs/class/Mono.PEToolkit/metadata/MDToken.cs
new file mode 100644
index 00000000000..ba4bec4a954
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MDToken.cs
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit.Metadata {
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ public struct MDToken {
+
+ internal int token;
+
+ /// <summary>
+ /// Creates new token with specified token type and record id.
+ /// </summary>
+ /// <param name="type">Token type.</param>
+ /// <param name="rid">Record IDentifier.</param>
+ public MDToken(TokenType type, int rid)
+ {
+ token = (int)type | rid;
+ }
+
+ /// <summary>
+ /// Creates new Nil token of a given type.
+ /// </summary>
+ /// <param name="type"></param>
+ public MDToken(TokenType type) : this(type, 0)
+ {
+ }
+
+ /// <summary>
+ /// </summary>
+ /// <param name="tok"></param>
+ public MDToken(MDToken tok) : this(tok.Type, tok.RID)
+ {
+ }
+
+
+ /// <summary>
+ /// Gets or sets metadata token Record IDentifier (RID).
+ /// </summary>
+ public int RID {
+ get {
+ return token & (~(int)TokenType.__mask);
+ }
+ set {
+ token &= (int)TokenType.__mask;
+ token |= value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets metadata token type.
+ /// </summary>
+ public TokenType Type {
+ get {
+ return (TokenType) token & (TokenType.__mask);
+ }
+ set {
+ token &= ~(int)TokenType.__mask;
+ token |= (int)value;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if this token is a Nil token (it's RID is 0).
+ /// </summary>
+ public bool IsNilToken {
+ get {
+ return (RID == 0);
+ }
+ }
+
+
+ /// <summary>
+ /// Returns token value.
+ /// </summary>
+ /// <returns></returns>
+ public override int GetHashCode ()
+ {
+ return token;
+ }
+
+
+
+ // See Metadata Unmanaged API doc (10.8)
+ public int Compress(out int len)
+ {
+ int res = token;
+ len = 4;
+ int rid = this.RID;
+
+ // Make room for type bits.
+ rid <<= 2;
+
+ TokenType type = this.Type;
+
+ // Token type (table that this token indexes) is encoded
+ // in the least significant 2 bits:
+ // TypeDef = 0
+ // TypeRef = 1
+ // TypeSpec = 2
+ // BaseType = 3
+ switch (type) {
+ case TokenType.TypeDef:
+ break;
+ case TokenType.TypeRef:
+ rid |= 1;
+ break;
+ case TokenType.TypeSpec:
+ rid |= 2;
+ break;
+ case TokenType.BaseType:
+ rid |= 3;
+ break;
+ default:
+ // Invalid operation for this type of token.
+ return res;
+ }
+
+ len = MDUtils.CompressData(rid, out res);
+
+ return res;
+ }
+
+
+ unsafe public static int Size {
+ get {
+ return sizeof (int);
+ }
+ }
+
+ public static implicit operator MDToken (uint val) {
+ MDToken res = new MDToken();
+ res.token = (int) val;
+ return res;
+ }
+
+ public static implicit operator uint (MDToken tok) {
+ return (uint)tok.token;
+ }
+
+ public override string ToString()
+ {
+ if (this.token == 0) return "NULL";
+ return String.Format("{0}[{1}]",
+ ((int)Type >> (int)TokenType.__shift <= (int)TableId.MAX)
+ ? ((TableId)((int)Type >> (int)TokenType.__shift)).ToString()
+ : Type.ToString(), RID);
+ //String.Format ("type = {0}, RID = {1}", Type, RID);
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/MDUtils.cs b/mcs/class/Mono.PEToolkit/metadata/MDUtils.cs
new file mode 100644
index 00000000000..6f11aa551a1
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MDUtils.cs
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+//using System.Runtime.InteropServices;
+
+namespace Mono.PEToolkit.Metadata {
+
+ public sealed class MDUtils {
+
+ // Holds true if machine is little-endian.
+ private static bool isLE;
+
+ static MDUtils()
+ {
+ isLE = BitConverter.IsLittleEndian;
+ }
+
+ private MDUtils()
+ {
+ }
+
+
+ public static int CompressData(int data, out int res)
+ {
+ res = data;
+ int len = 4;
+
+ if (data < 0) {
+ // data is actually unsigned,
+ // that's why this empty clause is needed.
+ } else if (data < 0x80) {
+ res = data;
+ len = 1;
+ } else if (data < 0x4000) {
+ res = ((data >> 8) | 0x80) + ((data & 0xFF) << 8);
+ len = 2;
+ } else if (data < 0x1FFFFFFF) {
+ res = ((data >> 24) | 0xC0) |
+ (((data >> 16) & 0xFF) << 8) |
+ (((data >> 8) & 0xFF) << 16) |
+ ((data & 0xFF) << 24);
+ len = 4;
+ }
+
+ return len;
+ }
+
+ unsafe public static int CompressData(void* pData, void* pRes)
+ {
+ byte* p = (byte*) pData;
+
+ int data = (isLE)
+ ? *(int*)p
+ : p [0] + (p [1] << 8) + (p [2] << 16) + (p [3] << 24);
+
+ int res = 0;
+ int len = CompressData(data, out res);
+ p = (byte*) pRes;
+
+ if (isLE) {
+ *(int*)p = res;
+ } else {
+ *p++ = (byte) (res & 0xFF);
+ *p++ = (byte) (res >> 8);
+ *p++ = (byte) (res >> 16);
+ *p++ = (byte) (res >> 24);
+ }
+ return len;
+ }
+
+
+ public static int Max(params int [] list)
+ {
+ int len = (list != null) ? list.Length : 0;
+ if (len == 0) return 0;
+ int max = list [0];
+ for (int i = 1; i < len; i++) {
+ if (list [i] > max) max = list [i];
+ }
+ return max;
+ }
+
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/ManifestResourceAttributes.cs b/mcs/class/Mono.PEToolkit/metadata/ManifestResourceAttributes.cs
new file mode 100644
index 00000000000..3e6a099e416
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/ManifestResourceAttributes.cs
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Flags for ManifestResource.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, 22.1.8
+ /// </remarks>
+ [Flags]
+ public enum ManifestResourceAttributes {
+ VisibilityMask = 0x0007,
+
+ /// <summary>
+ /// The Resource is exported from the Assembly.
+ /// </summary>
+ Public = 0x0001,
+
+ /// <summary>
+ /// The Resource is private to the Assembly.
+ /// </summary>
+ Private = 0x0002,
+ }
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/MetaDataRoot.cs b/mcs/class/Mono.PEToolkit/metadata/MetaDataRoot.cs
new file mode 100644
index 00000000000..9fd9b699eb8
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MetaDataRoot.cs
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+
+namespace Mono.PEToolkit.Metadata {
+
+ public class MetaDataRoot {
+
+ /// <summary>
+ /// "BSJB" signature.
+ /// </summary>
+ public static readonly uint Sig = 0x424A5342;
+
+ // Metadata Root header, see 23.1.1
+ internal uint sig;
+ internal short majVer; // currently 1
+ internal short minVer; // currently 1
+ internal uint reserved;
+ internal int len;
+ internal string verStr;
+ internal short flags;
+ internal short nStreams;
+
+
+ // Instance data
+
+ internal Hashtable streams;
+
+ // file position of the first byte of the header
+ internal long filePos;
+
+ private int strIdx;
+ private int guidIdx;
+ private int blobIdx;
+
+ internal Image img;
+
+
+ public MetaDataRoot(Image img)
+ {
+ this.img = img;
+ }
+
+ public Hashtable Streams {
+ get {
+ // never return null
+ if (streams == null) streams = new Hashtable();
+ return streams;
+ }
+ }
+
+
+ public uint Signature {
+ get {
+ return sig;
+ }
+ }
+
+ public string Version {
+ get {
+ return String.Format("{0}.{1}", majVer, minVer);
+ }
+ }
+
+ public string VersionString {
+ get {
+ return verStr;
+ }
+ set {
+ verStr = value;
+ len = value.Length;
+ }
+ }
+
+
+
+ public int StringsIndexSize {
+ get {
+ return strIdx;
+ }
+ }
+
+ public int GUIDIndexSize {
+ get {
+ return guidIdx;
+ }
+ }
+
+ public int BlobIndexSize {
+ get {
+ return blobIdx;
+ }
+ }
+
+
+ unsafe public void Read(BinaryReader reader)
+ {
+ filePos = reader.BaseStream.Position;
+
+ sig = reader.ReadUInt32();
+ if (sig != Sig) {
+ throw new BadImageException("Invalid MetaData Signature.");
+ }
+
+ majVer = reader.ReadInt16();
+ minVer = reader.ReadInt16();
+ reserved = reader.ReadUInt32();
+
+ // Length of version string.
+ len = reader.ReadInt32();
+
+ // Read version string.
+ if (len != 0) {
+ sbyte* pVer = stackalloc sbyte [len];
+ sbyte* p = pVer;
+
+ long pos = reader.BaseStream.Position;
+ int i;
+ for (i = len; --i >= 0;) {
+ sbyte c = reader.ReadSByte();
+ if (c == 0) break;
+ *p++ = c;
+ }
+
+ verStr = new string(pVer, 0, len-i-1, Encoding.UTF8);
+
+ // Round up to dword boundary, relative to header start.
+ pos += len;
+ pos -= filePos;
+ pos += 3;
+ pos &= ~3;
+ pos += filePos;
+
+ // Advance file pointer.
+ reader.BaseStream.Position = pos;
+ } else {
+ VersionString = String.Empty;
+ }
+
+ flags = reader.ReadInt16();
+ nStreams = reader.ReadInt16();
+
+ streams = new Hashtable(nStreams);
+
+ // load all streams into memory
+ for (int i = nStreams; --i >=0;) {
+ MDStream s = new MDStream(this);
+ s.Read(reader);
+ // TODO: check for duplicated streams,
+ // use Add instead of indexer.
+ streams[s.Name] = s;
+ }
+
+ MDStream tabs = Streams["#~"] as MDStream;
+ // Try uncompressed stream.
+ if (tabs == null) tabs = Streams["#-"] as MDStream;
+ if (tabs == null) throw new BadMetaDataException("Missing #~ stream.");
+
+ TablesHeap tabsHeap = tabs.Heap as TablesHeap;
+ // cache index sizes
+ strIdx = tabsHeap.StringsIndexSize;
+ guidIdx = tabsHeap.GUIDIndexSize;
+ blobIdx = tabsHeap.BlobIndexSize;
+ }
+
+ public TablesHeap TablesHeap {
+ get {
+ MDStream tabs = Streams["#~"] as MDStream;
+ // Try uncompressed stream.
+ if (tabs == null) tabs = Streams["#-"] as MDStream;
+ return (tabs.Heap as TablesHeap);
+ }
+ }
+
+ public MethodIL GetMethodBody(int num)
+ {
+ MethodIL il = null;
+ if (img == null) return il;
+ MDStream tabs = Streams["#~"] as MDStream;
+ TablesHeap tabsHeap = tabs.Heap as TablesHeap;
+ if (tabsHeap.HasMethod) {
+ MDTable methods = tabsHeap[TableId.Method];
+ if (methods == null) return il;
+ MethodRow row = methods[num] as MethodRow;
+ if (row == null) return il;
+ BinaryReader reader = img.reader;
+ reader.BaseStream.Position = img.RVAToVA(row.RVA);
+ il = new MethodIL();
+ il.Read(reader);
+ }
+ return il;
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/MethodIL.cs b/mcs/class/Mono.PEToolkit/metadata/MethodIL.cs
new file mode 100644
index 00000000000..63c3be325cf
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MethodIL.cs
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <remarks>
+ /// See Partition II
+ /// 24.4 Common Intermediate Language Physical Layout
+ /// </remarks>
+ public class MethodIL {
+
+ public enum Format {
+ // CorILMethod_TinyFormat, 24.4.2
+ Tiny = 2,
+ // CorILMethod_FatFormat, 24.4.3
+ Fat = 3,
+
+ // encoded in 3 bits
+ Shift = 3,
+ Mask = 0x7
+ }
+
+ public enum Flags {
+ TinyFormat = MethodIL.Format.Tiny,
+ FatFormat = MethodIL.Format.Fat,
+ MoreSections = 0x8,
+ InitLocals = 0x10
+ }
+
+ internal int fatFlags;
+ internal int maxStack;
+
+ internal byte[] bytecode;
+
+ public MethodIL()
+ {
+ fatFlags = 0;
+ maxStack = 0;
+ }
+
+ public byte [] ByteCode {
+ get {
+ return bytecode;
+ }
+ }
+
+ public int CodeSize {
+ get {
+ return (bytecode != null)
+ ? bytecode.Length : 0;
+ }
+ }
+
+ public int MaxStack {
+ get {
+ return maxStack;
+ }
+ set {
+ maxStack = value;
+ }
+ }
+
+ public bool InitLocals {
+ get {
+ return (fatFlags & (int)Flags.InitLocals) != 0;
+ }
+ }
+
+ public bool HasMoreSections {
+ get {
+ return (fatFlags & (int)Flags.MoreSections) != 0;
+ }
+ }
+
+ internal static bool IsMethodTiny(int flags)
+ {
+ return ((Format)(flags & ((int)Format.Mask >> 1)) == Format.Tiny);
+ }
+
+ public void Read(BinaryReader reader)
+ {
+ fatFlags = 0;
+ int codeSize;
+ bytecode = null;
+ int data = reader.ReadByte();
+ if (IsMethodTiny(data)) {
+ codeSize = data >> ((int)Format.Shift - 1);
+ maxStack = 0; // no locals
+ bytecode = reader.ReadBytes(codeSize);
+ } else {
+ long headPos = reader.BaseStream.Position - 1;
+ fatFlags = data | (reader.ReadByte() << 8);
+ // first 12 bits are flags
+ // next 4 bits is the
+ // "size of this header expressed as the count
+ // of 4-byte integers occupied"
+ int headSize = ((fatFlags >> 12) & 0xF) << 2;
+ fatFlags &= 0xFFF;
+ maxStack = reader.ReadInt16();
+ codeSize = reader.ReadInt32();
+ int localTok = reader.ReadInt32();
+ reader.BaseStream.Position = headPos + headSize;
+ bytecode = reader.ReadBytes(codeSize);
+ }
+ }
+
+ public virtual void Dump(TextWriter writer)
+ {
+ string dump = String.Format(
+ "Code size : {0:x4}" + Environment.NewLine +
+ "MaxStack : {1:x4}" + Environment.NewLine +
+ "InitLocals : {2}" + Environment.NewLine +
+ "MoreSections : {3}" + Environment.NewLine,
+ CodeSize, MaxStack, InitLocals, HasMoreSections
+ );
+ writer.Write(dump);
+ }
+
+ public void DumpHexBytecode(TextWriter w)
+ {
+ int n = CodeSize >> 3;
+ int i = 0;
+ for (int x = n; --x >= 0; i += 8) {
+ w.WriteLine(
+ String.Format("{0:x2} {1:x2} {2:x2} {3:x2} {4:x2} {5:x2} {6:x2} {7:x2}",
+ ByteCode[i], ByteCode[i + 1], ByteCode[i + 2], ByteCode[i + 3],
+ ByteCode[i + 4], ByteCode[i + 5], ByteCode[i + 6], ByteCode[i + 7]
+ )
+ );
+ }
+ for (;i < CodeSize; i++) {
+ w.Write("{0:x2} ", ByteCode[i]);
+ }
+ w.WriteLine();
+ }
+
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/MethodSemanticsAttributes.cs b/mcs/class/Mono.PEToolkit/metadata/MethodSemanticsAttributes.cs
new file mode 100644
index 00000000000..95b2d033add
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/MethodSemanticsAttributes.cs
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Flags for MethodSemantics.
+ /// </summary>
+ /// <remarks>
+ /// See Partiotion II, 22.1.10
+ /// </remarks>
+ [Flags]
+ public enum MethodSemanticsAttributes {
+ Setter = 0x0001,
+ Getter = 0x0002,
+ Other = 0x0004,
+ AddOn = 0x0008,
+ RemoveOn = 0x0010,
+ Fire = 0x0020,
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/PInvokeAttributes.cs b/mcs/class/Mono.PEToolkit/metadata/PInvokeAttributes.cs
new file mode 100644
index 00000000000..eff8a6f808b
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/PInvokeAttributes.cs
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Flags for ImplMap.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, 22.1.7;
+ /// This is similar to PInvokeMap enum found
+ /// in older XML library spec (all.xml).
+ /// </remarks>
+ [Flags]
+ public enum PInvokeAttributes {
+ /// <summary>
+ /// PInvoke is to use the member name as specified.
+ /// </summary>
+ NoMangle = 0x0001,
+
+ /// <summary>
+ /// </summary>
+ CharSetMask = 0x0006,
+ /// <summary>
+ /// </summary>
+ CharSetNotSpec = 0x0000,
+ /// <summary>
+ /// </summary>
+ CharSetAnsi = 0x0002, // specs: CharSetAns
+ /// <summary>
+ /// </summary>
+ CharSetUnicode = 0x0004,
+ /// <summary>
+ /// </summary>
+ CharSetAuto = 0x0006,
+
+ CallConvMask = 0x0700,
+ CallConvWinapi = 0x0100,
+ CallConvCdecl = 0x0200,
+ CallConvStdcall = 0x0300,
+ CallConvThiscall = 0x0400,
+ CallConvFastcall = 0x0500,
+
+ PinvokeOLE = 0x0020, // as reported by verifier, not in specs
+ // also value from all.xml
+
+ SupportsLastError = 0x0040,
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/Row.cs b/mcs/class/Mono.PEToolkit/metadata/Row.cs
new file mode 100644
index 00000000000..4716cbfd080
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/Row.cs
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Metadata row interface.
+ /// </summary>
+ public interface Row {
+
+ /// <summary>
+ /// Number of colums in a row.
+ /// </summary>
+ int NumberOfColumns {get;}
+
+ int Size {get;}
+
+ /// <summary>
+ /// Returns reference to parent table or null.
+ /// </summary>
+ MDTable Table {get;}
+
+ void FromRawData(byte [] buff, int offs);
+
+ void Dump(TextWriter writer);
+
+ }
+
+
+ public sealed class NullRow : Row {
+ public static readonly NullRow Instance;
+
+ static NullRow()
+ {
+ Instance = new NullRow();
+ }
+
+ private NullRow()
+ {
+ }
+
+ public int NumberOfColumns {
+ get {
+ return 0;
+ }
+ }
+
+ public int Size {
+ get {
+ return 0;
+ }
+ }
+
+ public MDTable Table {
+ get {
+ return null;
+ }
+ }
+
+ public void FromRawData(byte [] buff, int offs)
+ {
+ }
+
+ public void Dump(TextWriter writer)
+ {
+ writer.WriteLine("Null row.");
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/Rows.cs b/mcs/class/Mono.PEToolkit/metadata/Rows.cs
new file mode 100644
index 00000000000..1b01343052f
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/Rows.cs
@@ -0,0 +1,4887 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or rows.xsl if you want to make changes.
+
+using System;
+using System.IO;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+
+ /// <summary>
+ /// Represents row in Module table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.27
+ /// </remarks>
+ public class ModuleRow : Row {
+
+ private MDTable table;
+
+
+ public ushort Generation;
+ public int Name;
+ public int Mvid;
+ public int EncId;
+ public int EncBaseId;
+
+ public ModuleRow()
+ {
+ }
+
+ public ModuleRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Module table has 5 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 5;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Generation = LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Mvid = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.EncId = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.EncBaseId = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Generation : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "Mvid : {2}" + Environment.NewLine +
+ "EncId : {3}" + Environment.NewLine +
+ "EncBaseId : {4}" + Environment.NewLine,
+ this.Generation,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ "#GUID[" + Mvid.ToString() + "]",
+ "#GUID[" + EncId.ToString() + "]",
+ "#GUID[" + EncBaseId.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in TypeRef table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.35
+ /// </remarks>
+ public class TypeRefRow : Row {
+
+ private MDTable table;
+
+
+ public MDToken ResolutionScope;
+ public int Name;
+ public int Namespace;
+
+ public TypeRefRow()
+ {
+ }
+
+ public TypeRefRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in TypeRef table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.ResolutionScope = TabsDecoder.DecodeToken(CodedTokenId.ResolutionScope, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Namespace = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "ResolutionScope : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "Namespace : {2}" + Environment.NewLine,
+ this.ResolutionScope,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ (Table == null) ? Namespace.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Namespace] + "\" (#Strings[0x" + Namespace.ToString("X") + "])"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in TypeDef table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.34
+ /// </remarks>
+ public class TypeDefRow : Row {
+
+ private MDTable table;
+
+
+ public System.Reflection.TypeAttributes Flags;
+ public int Name;
+ public int Namespace;
+ public MDToken Extends;
+ public int FieldList;
+ public int MethodList;
+
+ public TypeDefRow()
+ {
+ }
+
+ public TypeDefRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in TypeDef table has 6 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 6;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (uint) + 4 + 4 + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Flags = (System.Reflection.TypeAttributes) LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Namespace = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Extends = TabsDecoder.DecodeToken(CodedTokenId.TypeDefOrRef, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.FieldList = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.MethodList = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Flags : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "Namespace : {2}" + Environment.NewLine +
+ "Extends : {3}" + Environment.NewLine +
+ "FieldList : {4}" + Environment.NewLine +
+ "MethodList : {5}" + Environment.NewLine,
+ this.Flags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ (Table == null) ? Namespace.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Namespace] + "\" (#Strings[0x" + Namespace.ToString("X") + "])",
+ this.Extends,
+ "Field[" + FieldList.ToString() + "]",
+ "Method[" + MethodList.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in FieldPtr table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class FieldPtrRow : Row {
+
+ private MDTable table;
+
+
+ public int Field;
+
+ public FieldPtrRow()
+ {
+ }
+
+ public FieldPtrRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in FieldPtr table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Field = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Field : {0}" + Environment.NewLine,
+ "Field[" + Field.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Field table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.15
+ /// </remarks>
+ public class FieldRow : Row {
+
+ private MDTable table;
+
+
+ public System.Reflection.FieldAttributes Flags;
+ public int Name;
+ public int Signature;
+
+ public FieldRow()
+ {
+ }
+
+ public FieldRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Field table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Flags = (System.Reflection.FieldAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Signature = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Flags : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "Signature : {2}" + Environment.NewLine,
+ this.Flags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ "#Blob[" + Signature.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in MethodPtr table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class MethodPtrRow : Row {
+
+ private MDTable table;
+
+
+ public int Method;
+
+ public MethodPtrRow()
+ {
+ }
+
+ public MethodPtrRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in MethodPtr table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Method = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Method : {0}" + Environment.NewLine,
+ "Method[" + Method.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Method table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.24
+ /// </remarks>
+ public class MethodRow : Row {
+
+ private MDTable table;
+
+
+ public RVA RVA;
+ public System.Reflection.MethodImplAttributes ImplFlags;
+ public System.Reflection.MethodAttributes Flags;
+ public int Name;
+ public int Signature;
+ public int ParamList;
+
+ public MethodRow()
+ {
+ }
+
+ public MethodRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Method table has 6 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 6;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return RVA.Size + sizeof (ushort) + sizeof (ushort) + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.RVA = LEBitConverter.ToUInt32(buff, offs);
+ offs += RVA.Size;
+ this.ImplFlags = (System.Reflection.MethodImplAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Flags = (System.Reflection.MethodAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Signature = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.ParamList = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "RVA : {0}" + Environment.NewLine +
+ "ImplFlags : {1}" + Environment.NewLine +
+ "Flags : {2}" + Environment.NewLine +
+ "Name : {3}" + Environment.NewLine +
+ "Signature : {4}" + Environment.NewLine +
+ "ParamList : {5}" + Environment.NewLine,
+ this.RVA,
+ this.ImplFlags,
+ this.Flags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ "#Blob[" + Signature.ToString() + "]",
+ "Param[" + ParamList.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ParamPtr table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class ParamPtrRow : Row {
+
+ private MDTable table;
+
+
+ public int Param;
+
+ public ParamPtrRow()
+ {
+ }
+
+ public ParamPtrRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ParamPtr table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Param = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Param : {0}" + Environment.NewLine,
+ "Param[" + Param.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Param table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.30
+ /// </remarks>
+ public class ParamRow : Row {
+
+ private MDTable table;
+
+
+ public System.Reflection.ParameterAttributes Flags;
+ public ushort Sequence;
+ public int Name;
+
+ public ParamRow()
+ {
+ }
+
+ public ParamRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Param table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + sizeof (ushort) + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Flags = (System.Reflection.ParameterAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Sequence = LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Flags : {0}" + Environment.NewLine +
+ "Sequence : {1}" + Environment.NewLine +
+ "Name : {2}" + Environment.NewLine,
+ this.Flags,
+ this.Sequence,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in InterfaceImpl table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.21
+ /// </remarks>
+ public class InterfaceImplRow : Row {
+
+ private MDTable table;
+
+
+ public int Class;
+ public MDToken Interface;
+
+ public InterfaceImplRow()
+ {
+ }
+
+ public InterfaceImplRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in InterfaceImpl table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Class = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Interface = TabsDecoder.DecodeToken(CodedTokenId.TypeDefOrRef, LEBitConverter.ToInt32(buff, offs));
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Class : {0}" + Environment.NewLine +
+ "Interface : {1}" + Environment.NewLine,
+ "TypeDef[" + Class.ToString() + "]",
+ this.Interface
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in MemberRef table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.23
+ /// </remarks>
+ public class MemberRefRow : Row {
+
+ private MDTable table;
+
+
+ public MDToken Class;
+ public int Name;
+ public int Signature;
+
+ public MemberRefRow()
+ {
+ }
+
+ public MemberRefRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in MemberRef table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Class = TabsDecoder.DecodeToken(CodedTokenId.MemberRefParent, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Signature = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Class : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "Signature : {2}" + Environment.NewLine,
+ this.Class,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ "#Blob[" + Signature.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Constant table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.9
+ /// </remarks>
+ public class ConstantRow : Row {
+
+ private MDTable table;
+
+
+ public ElementType Type;
+ public MDToken Parent;
+ public int Value;
+
+ public ConstantRow()
+ {
+ }
+
+ public ConstantRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Constant table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (short) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Type = (ElementType) LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.Parent = TabsDecoder.DecodeToken(CodedTokenId.HasConstant, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Value = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Type : {0}" + Environment.NewLine +
+ "Parent : {1}" + Environment.NewLine +
+ "Value : {2}" + Environment.NewLine,
+ this.Type,
+ this.Parent,
+ "#Blob[" + Value.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in CustomAttribute table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.10
+ /// </remarks>
+ public class CustomAttributeRow : Row {
+
+ private MDTable table;
+
+
+ public MDToken Parent;
+ public MDToken Type;
+ public int Value;
+
+ public CustomAttributeRow()
+ {
+ }
+
+ public CustomAttributeRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in CustomAttribute table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Parent = TabsDecoder.DecodeToken(CodedTokenId.HasCustomAttribute, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Type = TabsDecoder.DecodeToken(CodedTokenId.CustomAttributeType, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Value = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Parent : {0}" + Environment.NewLine +
+ "Type : {1}" + Environment.NewLine +
+ "Value : {2}" + Environment.NewLine,
+ this.Parent,
+ this.Type,
+ "#Blob[" + Value.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in FieldMarshal table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.17
+ /// </remarks>
+ public class FieldMarshalRow : Row {
+
+ private MDTable table;
+
+
+ public MDToken Parent;
+ public int NativeType;
+
+ public FieldMarshalRow()
+ {
+ }
+
+ public FieldMarshalRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in FieldMarshal table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Parent = TabsDecoder.DecodeToken(CodedTokenId.HasFieldMarshal, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.NativeType = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Parent : {0}" + Environment.NewLine +
+ "NativeType : {1}" + Environment.NewLine,
+ this.Parent,
+ "#Blob[" + NativeType.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in DeclSecurity table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.11
+ /// </remarks>
+ public class DeclSecurityRow : Row {
+
+ private MDTable table;
+
+
+ public short Action;
+ public MDToken Parent;
+ public int PermissionSet;
+
+ public DeclSecurityRow()
+ {
+ }
+
+ public DeclSecurityRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in DeclSecurity table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (short) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Action = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.Parent = TabsDecoder.DecodeToken(CodedTokenId.HasDeclSecurity, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.PermissionSet = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Action : {0}" + Environment.NewLine +
+ "Parent : {1}" + Environment.NewLine +
+ "PermissionSet : {2}" + Environment.NewLine,
+ this.Action,
+ this.Parent,
+ "#Blob[" + PermissionSet.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ClassLayout table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.8
+ /// </remarks>
+ public class ClassLayoutRow : Row {
+
+ private MDTable table;
+
+
+ public short PackingSize;
+ public int ClassSize;
+ public int Parent;
+
+ public ClassLayoutRow()
+ {
+ }
+
+ public ClassLayoutRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ClassLayout table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (short) + sizeof (int) + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.PackingSize = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.ClassSize = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.Parent = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "PackingSize : {0}" + Environment.NewLine +
+ "ClassSize : {1}" + Environment.NewLine +
+ "Parent : {2}" + Environment.NewLine,
+ this.PackingSize,
+ this.ClassSize,
+ "TypeDef[" + Parent.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in FieldLayout table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.16
+ /// </remarks>
+ public class FieldLayoutRow : Row {
+
+ private MDTable table;
+
+
+ public int Offset;
+ public int Field;
+
+ public FieldLayoutRow()
+ {
+ }
+
+ public FieldLayoutRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in FieldLayout table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int) + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Offset = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.Field = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Offset : {0}" + Environment.NewLine +
+ "Field : {1}" + Environment.NewLine,
+ this.Offset,
+ "Field[" + Field.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in StandAloneSig table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.33
+ /// </remarks>
+ public class StandAloneSigRow : Row {
+
+ private MDTable table;
+
+
+ public int Signature;
+
+ public StandAloneSigRow()
+ {
+ }
+
+ public StandAloneSigRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in StandAloneSig table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Signature = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Signature : {0}" + Environment.NewLine,
+ "#Blob[" + Signature.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in EventMap table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.12
+ /// </remarks>
+ public class EventMapRow : Row {
+
+ private MDTable table;
+
+
+ public int Parent;
+ public int EventList;
+
+ public EventMapRow()
+ {
+ }
+
+ public EventMapRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in EventMap table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Parent = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.EventList = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Parent : {0}" + Environment.NewLine +
+ "EventList : {1}" + Environment.NewLine,
+ "TypeDef[" + Parent.ToString() + "]",
+ "Event[" + EventList.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in EventPtr table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class EventPtrRow : Row {
+
+ private MDTable table;
+
+
+ public int Event;
+
+ public EventPtrRow()
+ {
+ }
+
+ public EventPtrRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in EventPtr table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Event = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Event : {0}" + Environment.NewLine,
+ "Event[" + Event.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Event table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.13
+ /// </remarks>
+ public class EventRow : Row {
+
+ private MDTable table;
+
+
+ public System.Reflection.EventAttributes EventFlags;
+ public int Name;
+ public MDToken EventType;
+
+ public EventRow()
+ {
+ }
+
+ public EventRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Event table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (short) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.EventFlags = (System.Reflection.EventAttributes) LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.EventType = TabsDecoder.DecodeToken(CodedTokenId.TypeDefOrRef, LEBitConverter.ToInt32(buff, offs));
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "EventFlags : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "EventType : {2}" + Environment.NewLine,
+ this.EventFlags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ this.EventType
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in PropertyMap table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.32
+ /// </remarks>
+ public class PropertyMapRow : Row {
+
+ private MDTable table;
+
+
+ public int Parent;
+ public int PropertyList;
+
+ public PropertyMapRow()
+ {
+ }
+
+ public PropertyMapRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in PropertyMap table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Parent = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.PropertyList = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Parent : {0}" + Environment.NewLine +
+ "PropertyList : {1}" + Environment.NewLine,
+ "TypeDef[" + Parent.ToString() + "]",
+ "Property[" + PropertyList.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in PropertyPtr table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class PropertyPtrRow : Row {
+
+ private MDTable table;
+
+
+ public int Property;
+
+ public PropertyPtrRow()
+ {
+ }
+
+ public PropertyPtrRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in PropertyPtr table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Property = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Property : {0}" + Environment.NewLine,
+ "Property[" + Property.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Property table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.30
+ /// </remarks>
+ public class PropertyRow : Row {
+
+ private MDTable table;
+
+
+ public System.Reflection.PropertyAttributes Flags;
+ public int Name;
+ public int Type;
+
+ public PropertyRow()
+ {
+ }
+
+ public PropertyRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Property table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Flags = (System.Reflection.PropertyAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Type = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Flags : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "Type : {2}" + Environment.NewLine,
+ this.Flags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ "#Blob[" + Type.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in MethodSemantics table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.26
+ /// </remarks>
+ public class MethodSemanticsRow : Row {
+
+ private MDTable table;
+
+
+ public MethodSemanticsAttributes Semantics;
+ public int Method;
+ public MDToken Association;
+
+ public MethodSemanticsRow()
+ {
+ }
+
+ public MethodSemanticsRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in MethodSemantics table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Semantics = (MethodSemanticsAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Method = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Association = TabsDecoder.DecodeToken(CodedTokenId.HasSemantics, LEBitConverter.ToInt32(buff, offs));
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Semantics : {0}" + Environment.NewLine +
+ "Method : {1}" + Environment.NewLine +
+ "Association : {2}" + Environment.NewLine,
+ this.Semantics,
+ "Method[" + Method.ToString() + "]",
+ this.Association
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in MethodImpl table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.25
+ /// </remarks>
+ public class MethodImplRow : Row {
+
+ private MDTable table;
+
+
+ public int Class;
+ public MDToken MethodBody;
+ public MDToken MethodDeclaration;
+
+ public MethodImplRow()
+ {
+ }
+
+ public MethodImplRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in MethodImpl table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Class = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.MethodBody = TabsDecoder.DecodeToken(CodedTokenId.MethodDefOrRef, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.MethodDeclaration = TabsDecoder.DecodeToken(CodedTokenId.MethodDefOrRef, LEBitConverter.ToInt32(buff, offs));
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Class : {0}" + Environment.NewLine +
+ "MethodBody : {1}" + Environment.NewLine +
+ "MethodDeclaration : {2}" + Environment.NewLine,
+ "TypeDef[" + Class.ToString() + "]",
+ this.MethodBody,
+ this.MethodDeclaration
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ModuleRef table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.28
+ /// </remarks>
+ public class ModuleRefRow : Row {
+
+ private MDTable table;
+
+
+ public int Name;
+
+ public ModuleRefRow()
+ {
+ }
+
+ public ModuleRefRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ModuleRef table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Name : {0}" + Environment.NewLine,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in TypeSpec table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.36
+ /// </remarks>
+ public class TypeSpecRow : Row {
+
+ private MDTable table;
+
+
+ public int Signature;
+
+ public TypeSpecRow()
+ {
+ }
+
+ public TypeSpecRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in TypeSpec table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Signature = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Signature : {0}" + Environment.NewLine,
+ "#Blob[" + Signature.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ImplMap table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.20
+ /// </remarks>
+ public class ImplMapRow : Row {
+
+ private MDTable table;
+
+
+ public PInvokeAttributes MappingFlags;
+ public MDToken MemberForwarded;
+ public int ImportName;
+ public int ImportScope;
+
+ public ImplMapRow()
+ {
+ }
+
+ public ImplMapRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ImplMap table has 4 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.MappingFlags = (PInvokeAttributes) LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.MemberForwarded = TabsDecoder.DecodeToken(CodedTokenId.MemberForwarded, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.ImportName = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.ImportScope = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "MappingFlags : {0}" + Environment.NewLine +
+ "MemberForwarded : {1}" + Environment.NewLine +
+ "ImportName : {2}" + Environment.NewLine +
+ "ImportScope : {3}" + Environment.NewLine,
+ this.MappingFlags,
+ this.MemberForwarded,
+ (Table == null) ? ImportName.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [ImportName] + "\" (#Strings[0x" + ImportName.ToString("X") + "])",
+ "ModuleRef[" + ImportScope.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in FieldRVA table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.18
+ /// </remarks>
+ public class FieldRVARow : Row {
+
+ private MDTable table;
+
+
+ public RVA RVA;
+ public int Field;
+
+ public FieldRVARow()
+ {
+ }
+
+ public FieldRVARow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in FieldRVA table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return RVA.Size + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.RVA = LEBitConverter.ToUInt32(buff, offs);
+ offs += RVA.Size;
+ this.Field = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "RVA : {0}" + Environment.NewLine +
+ "Field : {1}" + Environment.NewLine,
+ this.RVA,
+ "Field[" + Field.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ENCLog table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class ENCLogRow : Row {
+
+ private MDTable table;
+
+
+ public uint Token;
+ public uint FuncCode;
+
+ public ENCLogRow()
+ {
+ }
+
+ public ENCLogRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ENCLog table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (uint) + sizeof (uint);
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Token = LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.FuncCode = LEBitConverter.ToUInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Token : {0}" + Environment.NewLine +
+ "FuncCode : {1}" + Environment.NewLine,
+ this.Token,
+ this.FuncCode
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ENCMap table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class ENCMapRow : Row {
+
+ private MDTable table;
+
+
+ public uint Token;
+
+ public ENCMapRow()
+ {
+ }
+
+ public ENCMapRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ENCMap table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (uint);
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Token = LEBitConverter.ToUInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Token : {0}" + Environment.NewLine,
+ this.Token
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in Assembly table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.2
+ /// </remarks>
+ public class AssemblyRow : Row {
+
+ private MDTable table;
+
+
+ public System.Configuration.Assemblies.AssemblyHashAlgorithm HashAlgId;
+ public short MajorVersion;
+ public short MinorVersion;
+ public short BuildNumber;
+ public short RevisionNumber;
+ public AssemblyFlags Flags;
+ public int PublicKey;
+ public int Name;
+ public int Culture;
+
+ public AssemblyRow()
+ {
+ }
+
+ public AssemblyRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in Assembly table has 9 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 9;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int) + sizeof (short) + sizeof (short) + sizeof (short) + sizeof (short) + sizeof (uint) + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.HashAlgId = (System.Configuration.Assemblies.AssemblyHashAlgorithm) LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.MajorVersion = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.MinorVersion = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.BuildNumber = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.RevisionNumber = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.Flags = (AssemblyFlags) LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.PublicKey = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Culture = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "HashAlgId : {0}" + Environment.NewLine +
+ "MajorVersion : {1}" + Environment.NewLine +
+ "MinorVersion : {2}" + Environment.NewLine +
+ "BuildNumber : {3}" + Environment.NewLine +
+ "RevisionNumber : {4}" + Environment.NewLine +
+ "Flags : {5}" + Environment.NewLine +
+ "PublicKey : {6}" + Environment.NewLine +
+ "Name : {7}" + Environment.NewLine +
+ "Culture : {8}" + Environment.NewLine,
+ this.HashAlgId,
+ this.MajorVersion,
+ this.MinorVersion,
+ this.BuildNumber,
+ this.RevisionNumber,
+ this.Flags,
+ "#Blob[" + PublicKey.ToString() + "]",
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ (Table == null) ? Culture.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Culture] + "\" (#Strings[0x" + Culture.ToString("X") + "])"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in AssemblyProcessor table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.4
+ /// </remarks>
+ public class AssemblyProcessorRow : Row {
+
+ private MDTable table;
+
+
+ public int Processor;
+
+ public AssemblyProcessorRow()
+ {
+ }
+
+ public AssemblyProcessorRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in AssemblyProcessor table has 1 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int);
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Processor = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Processor : {0}" + Environment.NewLine,
+ this.Processor
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in AssemblyOS table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.3
+ /// </remarks>
+ public class AssemblyOSRow : Row {
+
+ private MDTable table;
+
+
+ public int OSPlatformID;
+ public int OSMajorVersion;
+ public int OSMinorVersion;
+
+ public AssemblyOSRow()
+ {
+ }
+
+ public AssemblyOSRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in AssemblyOS table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int) + sizeof (int) + sizeof (int);
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.OSPlatformID = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.OSMajorVersion = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.OSMinorVersion = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "OSPlatformID : {0}" + Environment.NewLine +
+ "OSMajorVersion : {1}" + Environment.NewLine +
+ "OSMinorVersion : {2}" + Environment.NewLine,
+ this.OSPlatformID,
+ this.OSMajorVersion,
+ this.OSMinorVersion
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in AssemblyRef table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.5
+ /// </remarks>
+ public class AssemblyRefRow : Row {
+
+ private MDTable table;
+
+
+ public short MajorVersion;
+ public short MinorVersion;
+ public short BuildNumber;
+ public short RevisionNumber;
+ public AssemblyFlags Flags;
+ public int PublicKeyOrToken;
+ public int Name;
+ public int Culture;
+ public int HashValue;
+
+ public AssemblyRefRow()
+ {
+ }
+
+ public AssemblyRefRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in AssemblyRef table has 9 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 9;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (short) + sizeof (short) + sizeof (short) + sizeof (short) + sizeof (uint) + 4 + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.MajorVersion = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.MinorVersion = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.BuildNumber = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.RevisionNumber = LEBitConverter.ToInt16(buff, offs);
+ offs += sizeof (short);
+ this.Flags = (AssemblyFlags) LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.PublicKeyOrToken = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Culture = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.HashValue = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "MajorVersion : {0}" + Environment.NewLine +
+ "MinorVersion : {1}" + Environment.NewLine +
+ "BuildNumber : {2}" + Environment.NewLine +
+ "RevisionNumber : {3}" + Environment.NewLine +
+ "Flags : {4}" + Environment.NewLine +
+ "PublicKeyOrToken : {5}" + Environment.NewLine +
+ "Name : {6}" + Environment.NewLine +
+ "Culture : {7}" + Environment.NewLine +
+ "HashValue : {8}" + Environment.NewLine,
+ this.MajorVersion,
+ this.MinorVersion,
+ this.BuildNumber,
+ this.RevisionNumber,
+ this.Flags,
+ "#Blob[" + PublicKeyOrToken.ToString() + "]",
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ (Table == null) ? Culture.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Culture] + "\" (#Strings[0x" + Culture.ToString("X") + "])",
+ "#Blob[" + HashValue.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in AssemblyRefProcessor table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.7
+ /// </remarks>
+ public class AssemblyRefProcessorRow : Row {
+
+ private MDTable table;
+
+
+ public int Processor;
+ public int AssemblyRef;
+
+ public AssemblyRefProcessorRow()
+ {
+ }
+
+ public AssemblyRefProcessorRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in AssemblyRefProcessor table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int) + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Processor = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.AssemblyRef = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Processor : {0}" + Environment.NewLine +
+ "AssemblyRef : {1}" + Environment.NewLine,
+ this.Processor,
+ "AssemblyRef[" + AssemblyRef.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in AssemblyRefOS table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.6
+ /// </remarks>
+ public class AssemblyRefOSRow : Row {
+
+ private MDTable table;
+
+
+ public int OSPlatformID;
+ public int OSMajorVersion;
+ public int OSMinorVersion;
+ public int AssemblyRef;
+
+ public AssemblyRefOSRow()
+ {
+ }
+
+ public AssemblyRefOSRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in AssemblyRefOS table has 4 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int) + sizeof (int) + sizeof (int) + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.OSPlatformID = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.OSMajorVersion = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.OSMinorVersion = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.AssemblyRef = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "OSPlatformID : {0}" + Environment.NewLine +
+ "OSMajorVersion : {1}" + Environment.NewLine +
+ "OSMinorVersion : {2}" + Environment.NewLine +
+ "AssemblyRef : {3}" + Environment.NewLine,
+ this.OSPlatformID,
+ this.OSMajorVersion,
+ this.OSMinorVersion,
+ "AssemblyRef[" + AssemblyRef.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in File table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.19
+ /// </remarks>
+ public class FileRow : Row {
+
+ private MDTable table;
+
+
+ public System.IO.FileAttributes Flags;
+ public int Name;
+ public int HashValue;
+
+ public FileRow()
+ {
+ }
+
+ public FileRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in File table has 3 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (uint) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Flags = (System.IO.FileAttributes) LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.HashValue = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Flags : {0}" + Environment.NewLine +
+ "Name : {1}" + Environment.NewLine +
+ "HashValue : {2}" + Environment.NewLine,
+ this.Flags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ "#Blob[" + HashValue.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ExportedType table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.14
+ /// </remarks>
+ public class ExportedTypeRow : Row {
+
+ private MDTable table;
+
+
+ public System.Reflection.TypeAttributes Flags;
+ public int TypeDefId;
+ public int TypeName;
+ public int TypeNamespace;
+ public MDToken Implementation;
+
+ public ExportedTypeRow()
+ {
+ }
+
+ public ExportedTypeRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ExportedType table has 5 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 5;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (uint) + 4 + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Flags = (System.Reflection.TypeAttributes) LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.TypeDefId = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.TypeName = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.TypeNamespace = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Implementation = TabsDecoder.DecodeToken(CodedTokenId.Implementation, LEBitConverter.ToInt32(buff, offs));
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Flags : {0}" + Environment.NewLine +
+ "TypeDefId : {1}" + Environment.NewLine +
+ "TypeName : {2}" + Environment.NewLine +
+ "TypeNamespace : {3}" + Environment.NewLine +
+ "Implementation : {4}" + Environment.NewLine,
+ this.Flags,
+ "TypeDef[" + TypeDefId.ToString() + "]",
+ (Table == null) ? TypeName.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [TypeName] + "\" (#Strings[0x" + TypeName.ToString("X") + "])",
+ (Table == null) ? TypeNamespace.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [TypeNamespace] + "\" (#Strings[0x" + TypeNamespace.ToString("X") + "])",
+ this.Implementation
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in ManifestResource table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.22
+ /// </remarks>
+ public class ManifestResourceRow : Row {
+
+ private MDTable table;
+
+
+ public int Offset;
+ public ManifestResourceAttributes Flags;
+ public int Name;
+ public MDToken Implementation;
+
+ public ManifestResourceRow()
+ {
+ }
+
+ public ManifestResourceRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in ManifestResource table has 4 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (int) + sizeof (uint) + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Offset = LEBitConverter.ToInt32(buff, offs);
+ offs += sizeof (int);
+ this.Flags = (ManifestResourceAttributes) LEBitConverter.ToUInt32(buff, offs);
+ offs += sizeof (uint);
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Implementation = TabsDecoder.DecodeToken(CodedTokenId.Implementation, LEBitConverter.ToInt32(buff, offs));
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Offset : {0}" + Environment.NewLine +
+ "Flags : {1}" + Environment.NewLine +
+ "Name : {2}" + Environment.NewLine +
+ "Implementation : {3}" + Environment.NewLine,
+ this.Offset,
+ this.Flags,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])",
+ this.Implementation
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in NestedClass table.
+ /// </summary>
+ /// <remarks>
+ /// See Partition II, Metadata; section 21.29
+ /// </remarks>
+ public class NestedClassRow : Row {
+
+ private MDTable table;
+
+
+ public int NestedClass;
+ public int EnclosingClass;
+
+ public NestedClassRow()
+ {
+ }
+
+ public NestedClassRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in NestedClass table has 2 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 2;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.NestedClass = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.EnclosingClass = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "NestedClass : {0}" + Environment.NewLine +
+ "EnclosingClass : {1}" + Environment.NewLine,
+ "TypeDef[" + NestedClass.ToString() + "]",
+ "TypeDef[" + EnclosingClass.ToString() + "]"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in TypeTyPar table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class TypeTyParRow : Row {
+
+ private MDTable table;
+
+
+ public ushort Number;
+ public int Class;
+ public MDToken Bound;
+ public int Name;
+
+ public TypeTyParRow()
+ {
+ }
+
+ public TypeTyParRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in TypeTyPar table has 4 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Number = LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Class = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Bound = TabsDecoder.DecodeToken(CodedTokenId.TypeDefOrRef, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Number : {0}" + Environment.NewLine +
+ "Class : {1}" + Environment.NewLine +
+ "Bound : {2}" + Environment.NewLine +
+ "Name : {3}" + Environment.NewLine,
+ this.Number,
+ "TypeDef[" + Class.ToString() + "]",
+ this.Bound,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents row in MethodTyPar table.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public class MethodTyParRow : Row {
+
+ private MDTable table;
+
+
+ public ushort Number;
+ public int Method;
+ public MDToken Bound;
+ public int Name;
+
+ public MethodTyParRow()
+ {
+ }
+
+ public MethodTyParRow(MDTable parent)
+ {
+ table = parent;
+ }
+
+
+ /// <summary>
+ /// Row in MethodTyPar table has 4 columns.
+ /// </summary>
+ public virtual int NumberOfColumns {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this instance in bytes.
+ /// </summary>
+ public virtual int Size {
+ get {
+ return LogicalSize;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public virtual MDTable Table {
+ get {
+ return table;
+ }
+ }
+
+
+ /// <summary>
+ /// Logical size of this type of row in bytes.
+ /// </summary>
+ unsafe public static int LogicalSize {
+ get {
+ return sizeof (ushort) + 4 + 4 + 4;
+ }
+ }
+
+
+ /// <summary>
+ /// Fills the row from the array of bytes.
+ /// </summary>
+ unsafe public void FromRawData(byte [] buff, int offs)
+ {
+ if (buff == null) throw new Exception("buff == null");
+ if (offs + Size > buff.Length) throw new Exception("bounds");
+
+
+ this.Number = LEBitConverter.ToUInt16(buff, offs);
+ offs += sizeof (ushort);
+ this.Method = LEBitConverter.ToInt32(buff, offs);
+ offs += 4;
+ this.Bound = TabsDecoder.DecodeToken(CodedTokenId.TypeDefOrRef, LEBitConverter.ToInt32(buff, offs));
+ offs += 4;
+ this.Name = LEBitConverter.ToInt32(buff, offs);
+
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public void Dump(TextWriter writer) {
+ string dump = String.Format(
+ "Number : {0}" + Environment.NewLine +
+ "Method : {1}" + Environment.NewLine +
+ "Bound : {2}" + Environment.NewLine +
+ "Name : {3}" + Environment.NewLine,
+ this.Number,
+ "Method[" + Method.ToString() + "]",
+ this.Bound,
+ (Table == null) ? Name.ToString() : "\"" + ((Table.Heap.Stream.Root.Streams["#Strings"] as MDStream).Heap as StringsHeap) [Name] + "\" (#Strings[0x" + Name.ToString("X") + "])"
+ );
+ writer.WriteLine(dump);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString()
+ {
+ StringWriter sw = new StringWriter();
+ Dump(sw);
+ return sw.ToString();
+ }
+
+ }
+
+
+
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/StringsHeap.cs b/mcs/class/Mono.PEToolkit/metadata/StringsHeap.cs
new file mode 100644
index 00000000000..02953f34c9e
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/StringsHeap.cs
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.Text;
+using System.Collections;
+
+namespace Mono.PEToolkit.Metadata {
+
+ // 23.1.3
+ public class StringsHeap : MDHeap {
+
+ private SortedList strings;
+ private int dataLen;
+
+ internal StringsHeap(MDStream stream) : base(stream)
+ {
+ }
+
+ unsafe override public void FromRawData(byte[] rawData)
+ {
+ strings = new SortedList();
+ strings.Add (0, String.Empty);
+ if (rawData == null) return;
+
+ int len = rawData.Length;
+ dataLen = len;
+ // the first entry in the string heap is always EmptyString
+ if (len < 1 || rawData [0] != 0) {
+ throw new BadMetaDataException("Invalid #Strings heap.");
+ }
+
+ int idx = 1;
+ for (int i = 1; i < len; i++) {
+ if (rawData [i] == 0) {
+ fixed (void* p = &rawData[idx]) {
+ string s = new string ((sbyte*)p, 0, i - idx, Encoding.UTF8);
+ strings.Add (idx, s);
+ }
+ idx = i + 1;
+ }
+ }
+ }
+
+ public string this [int index] {
+ get {
+ string res = null;
+ if (strings != null && index >= 0 && index < dataLen) {
+ res = strings[index] as string;
+ if (res == null) {
+ // cope with garbage/substrings
+ IList indices = strings.GetKeyList();
+ int i = FindNextIndex(indices, index);
+ if (i < 0) {
+ throw new Exception("Internal error (#Strings binary search).");
+ }
+ if (i != 0) {
+ // Position of the super-string in the heap.
+ int pos = (int) indices [i - 1];
+ res = strings[pos] as string;
+ // NOTE: Substring returns String.Empty if index
+ // is equal to the length.
+ res = res.Substring(index - pos);
+ }
+ }
+ }
+ return res;
+ }
+ }
+
+ /// <summary>
+ /// Binary search.
+ /// </summary>
+ /// <param name="list">List of "edge" indices.</param>
+ /// <param name="index"></param>
+ /// <returns></returns>
+ private static int FindNextIndex(IList list, int index) {
+ int len = list.Count;
+
+ if (len == 0) return ~0;
+
+ int left = 0;
+ int right = len-1;
+
+ while (left <= right) {
+ int guess = (left + right) >> 1;
+ int cmp = index - (int) list [guess];
+ if (cmp == 0) return ~guess;
+ cmp &= ~Int32.MaxValue;
+ if (cmp == 0) left = guess+1;
+ else right = guess-1;
+ }
+
+ return left;
+ }
+
+ public int Count {
+ get {
+ return (strings == null) ? 0 : strings.Count;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/TableId.cs b/mcs/class/Mono.PEToolkit/metadata/TableId.cs
new file mode 100644
index 00000000000..bd0b1d06abe
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/TableId.cs
@@ -0,0 +1,66 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or table-id.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+ /// <summary>
+ /// Identifiers for tables in #~ heap.
+ /// </summary>
+ /// <remarks>
+ /// Partition II, 21.x
+ /// </remarks>
+ public enum TableId {
+ Module = 0x00,
+ TypeRef = 0x01,
+ TypeDef = 0x02,
+ FieldPtr = 0x03,
+ Field = 0x04,
+ MethodPtr = 0x05,
+ Method = 0x06,
+ ParamPtr = 0x07,
+ Param = 0x08,
+ InterfaceImpl = 0x09,
+ MemberRef = 0x0a,
+ Constant = 0x0b,
+ CustomAttribute = 0x0c,
+ FieldMarshal = 0x0d,
+ DeclSecurity = 0x0e,
+ ClassLayout = 0x0f,
+ FieldLayout = 0x10,
+ StandAloneSig = 0x11,
+ EventMap = 0x12,
+ EventPtr = 0x13,
+ Event = 0x14,
+ PropertyMap = 0x15,
+ PropertyPtr = 0x16,
+ Property = 0x17,
+ MethodSemantics = 0x18,
+ MethodImpl = 0x19,
+ ModuleRef = 0x1a,
+ TypeSpec = 0x1b,
+ ImplMap = 0x1c,
+ FieldRVA = 0x1d,
+ ENCLog = 0x1e,
+ ENCMap = 0x1f,
+ Assembly = 0x20,
+ AssemblyProcessor = 0x21,
+ AssemblyOS = 0x22,
+ AssemblyRef = 0x23,
+ AssemblyRefProcessor = 0x24,
+ AssemblyRefOS = 0x25,
+ File = 0x26,
+ ExportedType = 0x27,
+ ManifestResource = 0x28,
+ NestedClass = 0x29,
+ TypeTyPar = 0x2a,
+ MethodTyPar = 0x2b,
+
+ MAX = MethodTyPar,
+ Count = MAX + 1
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/Tables.cs b/mcs/class/Mono.PEToolkit/metadata/Tables.cs
new file mode 100644
index 00000000000..ed858f6d202
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/Tables.cs
@@ -0,0 +1,1375 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or tabs.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+ public class ModuleTable : MDTableBase {
+
+ public ModuleTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ModuleRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ModuleRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Module";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Module;
+ }
+ }
+ }
+
+ public class TypeRefTable : MDTableBase {
+
+ public TypeRefTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new TypeRefRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += TypeRefRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "TypeRef";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.TypeRef;
+ }
+ }
+ }
+
+ public class TypeDefTable : MDTableBase {
+
+ public TypeDefTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new TypeDefRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += TypeDefRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "TypeDef";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.TypeDef;
+ }
+ }
+ }
+
+ public class FieldPtrTable : MDTableBase {
+
+ public FieldPtrTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new FieldPtrRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += FieldPtrRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "FieldPtr";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.FieldPtr;
+ }
+ }
+ }
+
+ public class FieldTable : MDTableBase {
+
+ public FieldTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new FieldRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += FieldRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Field";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Field;
+ }
+ }
+ }
+
+ public class MethodPtrTable : MDTableBase {
+
+ public MethodPtrTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new MethodPtrRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += MethodPtrRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "MethodPtr";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.MethodPtr;
+ }
+ }
+ }
+
+ public class MethodTable : MDTableBase {
+
+ public MethodTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new MethodRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += MethodRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Method";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Method;
+ }
+ }
+ }
+
+ public class ParamPtrTable : MDTableBase {
+
+ public ParamPtrTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ParamPtrRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ParamPtrRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ParamPtr";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ParamPtr;
+ }
+ }
+ }
+
+ public class ParamTable : MDTableBase {
+
+ public ParamTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ParamRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ParamRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Param";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Param;
+ }
+ }
+ }
+
+ public class InterfaceImplTable : MDTableBase {
+
+ public InterfaceImplTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new InterfaceImplRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += InterfaceImplRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "InterfaceImpl";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.InterfaceImpl;
+ }
+ }
+ }
+
+ public class MemberRefTable : MDTableBase {
+
+ public MemberRefTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new MemberRefRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += MemberRefRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "MemberRef";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.MemberRef;
+ }
+ }
+ }
+
+ public class ConstantTable : MDTableBase {
+
+ public ConstantTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ConstantRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ConstantRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Constant";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Constant;
+ }
+ }
+ }
+
+ public class CustomAttributeTable : MDTableBase {
+
+ public CustomAttributeTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new CustomAttributeRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += CustomAttributeRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "CustomAttribute";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.CustomAttribute;
+ }
+ }
+ }
+
+ public class FieldMarshalTable : MDTableBase {
+
+ public FieldMarshalTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new FieldMarshalRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += FieldMarshalRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "FieldMarshal";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.FieldMarshal;
+ }
+ }
+ }
+
+ public class DeclSecurityTable : MDTableBase {
+
+ public DeclSecurityTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new DeclSecurityRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += DeclSecurityRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "DeclSecurity";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.DeclSecurity;
+ }
+ }
+ }
+
+ public class ClassLayoutTable : MDTableBase {
+
+ public ClassLayoutTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ClassLayoutRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ClassLayoutRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ClassLayout";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ClassLayout;
+ }
+ }
+ }
+
+ public class FieldLayoutTable : MDTableBase {
+
+ public FieldLayoutTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new FieldLayoutRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += FieldLayoutRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "FieldLayout";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.FieldLayout;
+ }
+ }
+ }
+
+ public class StandAloneSigTable : MDTableBase {
+
+ public StandAloneSigTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new StandAloneSigRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += StandAloneSigRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "StandAloneSig";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.StandAloneSig;
+ }
+ }
+ }
+
+ public class EventMapTable : MDTableBase {
+
+ public EventMapTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new EventMapRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += EventMapRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "EventMap";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.EventMap;
+ }
+ }
+ }
+
+ public class EventPtrTable : MDTableBase {
+
+ public EventPtrTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new EventPtrRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += EventPtrRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "EventPtr";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.EventPtr;
+ }
+ }
+ }
+
+ public class EventTable : MDTableBase {
+
+ public EventTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new EventRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += EventRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Event";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Event;
+ }
+ }
+ }
+
+ public class PropertyMapTable : MDTableBase {
+
+ public PropertyMapTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new PropertyMapRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += PropertyMapRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "PropertyMap";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.PropertyMap;
+ }
+ }
+ }
+
+ public class PropertyPtrTable : MDTableBase {
+
+ public PropertyPtrTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new PropertyPtrRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += PropertyPtrRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "PropertyPtr";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.PropertyPtr;
+ }
+ }
+ }
+
+ public class PropertyTable : MDTableBase {
+
+ public PropertyTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new PropertyRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += PropertyRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Property";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Property;
+ }
+ }
+ }
+
+ public class MethodSemanticsTable : MDTableBase {
+
+ public MethodSemanticsTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new MethodSemanticsRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += MethodSemanticsRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "MethodSemantics";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.MethodSemantics;
+ }
+ }
+ }
+
+ public class MethodImplTable : MDTableBase {
+
+ public MethodImplTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new MethodImplRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += MethodImplRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "MethodImpl";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.MethodImpl;
+ }
+ }
+ }
+
+ public class ModuleRefTable : MDTableBase {
+
+ public ModuleRefTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ModuleRefRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ModuleRefRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ModuleRef";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ModuleRef;
+ }
+ }
+ }
+
+ public class TypeSpecTable : MDTableBase {
+
+ public TypeSpecTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new TypeSpecRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += TypeSpecRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "TypeSpec";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.TypeSpec;
+ }
+ }
+ }
+
+ public class ImplMapTable : MDTableBase {
+
+ public ImplMapTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ImplMapRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ImplMapRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ImplMap";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ImplMap;
+ }
+ }
+ }
+
+ public class FieldRVATable : MDTableBase {
+
+ public FieldRVATable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new FieldRVARow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += FieldRVARow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "FieldRVA";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.FieldRVA;
+ }
+ }
+ }
+
+ public class ENCLogTable : MDTableBase {
+
+ public ENCLogTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ENCLogRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ENCLogRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ENCLog";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ENCLog;
+ }
+ }
+ }
+
+ public class ENCMapTable : MDTableBase {
+
+ public ENCMapTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ENCMapRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ENCMapRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ENCMap";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ENCMap;
+ }
+ }
+ }
+
+ public class AssemblyTable : MDTableBase {
+
+ public AssemblyTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new AssemblyRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += AssemblyRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "Assembly";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.Assembly;
+ }
+ }
+ }
+
+ public class AssemblyProcessorTable : MDTableBase {
+
+ public AssemblyProcessorTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new AssemblyProcessorRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += AssemblyProcessorRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "AssemblyProcessor";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.AssemblyProcessor;
+ }
+ }
+ }
+
+ public class AssemblyOSTable : MDTableBase {
+
+ public AssemblyOSTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new AssemblyOSRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += AssemblyOSRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "AssemblyOS";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.AssemblyOS;
+ }
+ }
+ }
+
+ public class AssemblyRefTable : MDTableBase {
+
+ public AssemblyRefTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new AssemblyRefRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += AssemblyRefRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "AssemblyRef";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.AssemblyRef;
+ }
+ }
+ }
+
+ public class AssemblyRefProcessorTable : MDTableBase {
+
+ public AssemblyRefProcessorTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new AssemblyRefProcessorRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += AssemblyRefProcessorRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "AssemblyRefProcessor";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.AssemblyRefProcessor;
+ }
+ }
+ }
+
+ public class AssemblyRefOSTable : MDTableBase {
+
+ public AssemblyRefOSTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new AssemblyRefOSRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += AssemblyRefOSRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "AssemblyRefOS";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.AssemblyRefOS;
+ }
+ }
+ }
+
+ public class FileTable : MDTableBase {
+
+ public FileTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new FileRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += FileRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "File";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.File;
+ }
+ }
+ }
+
+ public class ExportedTypeTable : MDTableBase {
+
+ public ExportedTypeTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ExportedTypeRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ExportedTypeRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ExportedType";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ExportedType;
+ }
+ }
+ }
+
+ public class ManifestResourceTable : MDTableBase {
+
+ public ManifestResourceTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new ManifestResourceRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += ManifestResourceRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "ManifestResource";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.ManifestResource;
+ }
+ }
+ }
+
+ public class NestedClassTable : MDTableBase {
+
+ public NestedClassTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new NestedClassRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += NestedClassRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "NestedClass";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.NestedClass;
+ }
+ }
+ }
+
+ public class TypeTyParTable : MDTableBase {
+
+ public TypeTyParTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new TypeTyParRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += TypeTyParRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "TypeTyPar";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.TypeTyPar;
+ }
+ }
+ }
+
+ public class MethodTyParTable : MDTableBase {
+
+ public MethodTyParTable(MDHeap heap)
+ : base(heap)
+ {
+ }
+
+
+ public override void FromRawData(byte [] buff, int offs, int numRows) {
+ for (int i = numRows; --i >= 0;) {
+ Row row = new MethodTyParRow(this);
+ row.FromRawData(buff, offs);
+ Add(row);
+ offs += MethodTyParRow.LogicalSize;
+ }
+ }
+
+
+ public override string Name {
+ get {
+ return "MethodTyPar";
+ }
+ }
+
+ public override TableId Id {
+ get {
+ return TableId.MethodTyPar;
+ }
+ }
+ }
+
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/TablesHeap.cs b/mcs/class/Mono.PEToolkit/metadata/TablesHeap.cs
new file mode 100644
index 00000000000..5ae11b60df1
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/TablesHeap.cs
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// Metadata tables heap (#~).
+ /// </summary>
+ /// <remarks>
+ /// Partition II; Chapter 21 & 23.1.6
+ /// </remarks>
+ public class TablesHeap : TablesHeapBase {
+
+ private long valid; // bitvector of valid tables
+ //(64-bit, max index = TableId.MAX)
+ private int numTabs; // number of tables (calculated from valid)
+
+ private long sorted; // bitvector of sorted tables (64-bit)
+
+ // schema version (currently 1.0)
+ private byte verMaj;
+ private byte verMin;
+
+ // bitvector for heap-size flags:
+ // bit 1 - if set #Strings heap uses wide indices (dword)
+ // bit 2 - if set #GUID heap uses wide indices
+ // bit 3 - if set #Blob heap uses wide indices
+ // otherwise (particular bit is not set) index size is word.
+ private byte heapSizes;
+
+
+ private Hashtable tables;
+
+
+ internal TablesHeap (MDStream stream) : base (stream)
+ {
+ }
+
+
+ /// <summary>
+ /// Gets or sets bitvector of valid tables (64-bit).
+ /// </summary>
+ public override long Valid {
+ get {
+ return valid;
+ }
+ set {
+ valid = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets bitvector of sorted tables (64-bit).
+ /// </summary>
+ public override long Sorted {
+ get {
+ return sorted;
+ }
+ set {
+ sorted = value;
+ }
+ }
+
+
+ //
+ // "Universal" accessors for Valid and Sorted bitvectors.
+ //
+
+
+ public bool IsValid (TableId tab)
+ {
+ return (valid & (1L << (int) tab)) != 0;
+ }
+
+ public void SetValid (TableId tab, bool b)
+ {
+ long mask = 1L << (int) tab;
+ if (b) {
+ valid |= mask;
+ } else {
+ valid &= ~mask;
+ }
+ }
+
+
+ /// <summary>
+ /// True if the given table in this heap is sorted.
+ /// </summary>
+ /// <param name="tab"></param>
+ /// <returns></returns>
+ public bool IsSorted (TableId tab)
+ {
+ return (sorted & (1L << (int) tab)) != 0;
+ }
+
+ /// <summary>
+ /// Marks specified table in this heap as sorted or unsorted.
+ /// </summary>
+ /// <param name="tab"></param>
+ /// <param name="b"></param>
+ public void SetSorted (TableId tab, bool b)
+ {
+ long mask = 1L << (int) tab;
+ if (b) {
+ sorted |= mask;
+ } else {
+ sorted &= ~mask;
+ }
+ }
+
+
+
+ public byte HeapSizes {
+ get {
+ return heapSizes;
+ }
+ set {
+ heapSizes = value;
+ }
+ }
+
+ public int StringsIndexSize {
+ get {
+ return 2 + ((heapSizes & 1) << 1);
+ }
+ }
+
+ public int GUIDIndexSize {
+ get {
+ return 2 + (heapSizes & 2);
+ }
+ }
+
+ public int BlobIndexSize {
+ get {
+ return 2 + ((heapSizes & 4) >> 1);
+ }
+ }
+
+
+
+ unsafe override public void FromRawData (byte [] rawData)
+ {
+ valid = 0;
+ sorted = 0;
+
+ if (rawData == null || rawData.Length < 24) {
+ throw new BadMetaDataException ("Invalid header for #~ heap.");
+ }
+
+ verMaj = rawData [4];
+ verMin = rawData [5];
+ heapSizes = rawData [6];
+
+ valid = LEBitConverter.ToInt64 (rawData, 8);
+ sorted = LEBitConverter.ToInt64 (rawData, 16);
+
+ // Calc number of tables from valid bitvector.
+ numTabs = 0;
+ for (int i = (int) TableId.Count; --i >= 0;) {
+ numTabs += (int) (valid >> i) & 1;
+ }
+
+ int [] rows = new int [(int) TableId.Count];
+ Array.Clear (rows, 0, rows.Length);
+ int offs = 24; // offset to #~::Rows
+ for (int i = 0; i < numTabs; i++) {
+ int n = -1;
+ int vpos = -1;
+ long v = valid;
+ while (n < i && v != 0) {
+ n += (int) (v & 1L);
+ v >>= 1;
+ vpos++;
+ }
+ if (vpos != -1) {
+ rows [vpos] = LEBitConverter.ToInt32 (rawData, offs);
+ offs += sizeof (int);
+ }
+ }
+
+ // TODO: this could be called from constructor
+ // This sequence: MDHeap::.ctor -> FromRawData -> RegisterTable
+ // and we are making "this" available here, before the object
+ // is fully constructed. This is bad, fix it somehow.
+ TabsDecoder.DecodePhysicalTables (this, rawData, offs, rows);
+
+ }
+
+
+ public void RegisterTable (MDTable tab)
+ {
+ if (tables == null) tables = new Hashtable (64);
+ tables [tab.Id] = tab;
+ }
+
+ public MDTable this [TableId id] {
+ get {
+ return tables [id] as MDTable;
+ }
+ }
+
+ public ICollection Tables {
+ get {
+ return tables.Values;
+ }
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/Mono.PEToolkit/metadata/TablesHeapBase.cs b/mcs/class/Mono.PEToolkit/metadata/TablesHeapBase.cs
new file mode 100644
index 00000000000..8606ae176dc
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/TablesHeapBase.cs
@@ -0,0 +1,787 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or tabs-base.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public abstract class TablesHeapBase : MDHeap {
+
+ internal TablesHeapBase(MDStream stream) : base(stream)
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets bitvector of valid tables (64-bit).
+ /// </summary>
+ public abstract long Valid {get; set;}
+
+ /// <summary>
+ /// Gets or sets bitvector of sorted tables (64-bit).
+ /// </summary>
+ public abstract long Sorted {get; set;}
+
+
+ //
+ // Accessors to decode Valid bitvector.
+ //
+
+
+ /// <summary>
+ /// True if heap has Module table.
+ /// </summary>
+ public bool HasModule {
+ get {
+ return (Valid & (1L << 0x00)) != 0;
+ }
+ set {
+ long mask = (1L << 0x00);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has TypeRef table.
+ /// </summary>
+ public bool HasTypeRef {
+ get {
+ return (Valid & (1L << 0x01)) != 0;
+ }
+ set {
+ long mask = (1L << 0x01);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has TypeDef table.
+ /// </summary>
+ public bool HasTypeDef {
+ get {
+ return (Valid & (1L << 0x02)) != 0;
+ }
+ set {
+ long mask = (1L << 0x02);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has FieldPtr table.
+ /// </summary>
+ public bool HasFieldPtr {
+ get {
+ return (Valid & (1L << 0x03)) != 0;
+ }
+ set {
+ long mask = (1L << 0x03);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Field table.
+ /// </summary>
+ public bool HasField {
+ get {
+ return (Valid & (1L << 0x04)) != 0;
+ }
+ set {
+ long mask = (1L << 0x04);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has MethodPtr table.
+ /// </summary>
+ public bool HasMethodPtr {
+ get {
+ return (Valid & (1L << 0x05)) != 0;
+ }
+ set {
+ long mask = (1L << 0x05);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Method table.
+ /// </summary>
+ public bool HasMethod {
+ get {
+ return (Valid & (1L << 0x06)) != 0;
+ }
+ set {
+ long mask = (1L << 0x06);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ParamPtr table.
+ /// </summary>
+ public bool HasParamPtr {
+ get {
+ return (Valid & (1L << 0x07)) != 0;
+ }
+ set {
+ long mask = (1L << 0x07);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Param table.
+ /// </summary>
+ public bool HasParam {
+ get {
+ return (Valid & (1L << 0x08)) != 0;
+ }
+ set {
+ long mask = (1L << 0x08);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has InterfaceImpl table.
+ /// </summary>
+ public bool HasInterfaceImpl {
+ get {
+ return (Valid & (1L << 0x09)) != 0;
+ }
+ set {
+ long mask = (1L << 0x09);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has MemberRef table.
+ /// </summary>
+ public bool HasMemberRef {
+ get {
+ return (Valid & (1L << 0x0a)) != 0;
+ }
+ set {
+ long mask = (1L << 0x0a);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Constant table.
+ /// </summary>
+ public bool HasConstant {
+ get {
+ return (Valid & (1L << 0x0b)) != 0;
+ }
+ set {
+ long mask = (1L << 0x0b);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has CustomAttribute table.
+ /// </summary>
+ public bool HasCustomAttribute {
+ get {
+ return (Valid & (1L << 0x0c)) != 0;
+ }
+ set {
+ long mask = (1L << 0x0c);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has FieldMarshal table.
+ /// </summary>
+ public bool HasFieldMarshal {
+ get {
+ return (Valid & (1L << 0x0d)) != 0;
+ }
+ set {
+ long mask = (1L << 0x0d);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has DeclSecurity table.
+ /// </summary>
+ public bool HasDeclSecurity {
+ get {
+ return (Valid & (1L << 0x0e)) != 0;
+ }
+ set {
+ long mask = (1L << 0x0e);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ClassLayout table.
+ /// </summary>
+ public bool HasClassLayout {
+ get {
+ return (Valid & (1L << 0x0f)) != 0;
+ }
+ set {
+ long mask = (1L << 0x0f);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has FieldLayout table.
+ /// </summary>
+ public bool HasFieldLayout {
+ get {
+ return (Valid & (1L << 0x10)) != 0;
+ }
+ set {
+ long mask = (1L << 0x10);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has StandAloneSig table.
+ /// </summary>
+ public bool HasStandAloneSig {
+ get {
+ return (Valid & (1L << 0x11)) != 0;
+ }
+ set {
+ long mask = (1L << 0x11);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has EventMap table.
+ /// </summary>
+ public bool HasEventMap {
+ get {
+ return (Valid & (1L << 0x12)) != 0;
+ }
+ set {
+ long mask = (1L << 0x12);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has EventPtr table.
+ /// </summary>
+ public bool HasEventPtr {
+ get {
+ return (Valid & (1L << 0x13)) != 0;
+ }
+ set {
+ long mask = (1L << 0x13);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Event table.
+ /// </summary>
+ public bool HasEvent {
+ get {
+ return (Valid & (1L << 0x14)) != 0;
+ }
+ set {
+ long mask = (1L << 0x14);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has PropertyMap table.
+ /// </summary>
+ public bool HasPropertyMap {
+ get {
+ return (Valid & (1L << 0x15)) != 0;
+ }
+ set {
+ long mask = (1L << 0x15);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has PropertyPtr table.
+ /// </summary>
+ public bool HasPropertyPtr {
+ get {
+ return (Valid & (1L << 0x16)) != 0;
+ }
+ set {
+ long mask = (1L << 0x16);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Property table.
+ /// </summary>
+ public bool HasProperty {
+ get {
+ return (Valid & (1L << 0x17)) != 0;
+ }
+ set {
+ long mask = (1L << 0x17);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has MethodSemantics table.
+ /// </summary>
+ public bool HasMethodSemantics {
+ get {
+ return (Valid & (1L << 0x18)) != 0;
+ }
+ set {
+ long mask = (1L << 0x18);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has MethodImpl table.
+ /// </summary>
+ public bool HasMethodImpl {
+ get {
+ return (Valid & (1L << 0x19)) != 0;
+ }
+ set {
+ long mask = (1L << 0x19);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ModuleRef table.
+ /// </summary>
+ public bool HasModuleRef {
+ get {
+ return (Valid & (1L << 0x1a)) != 0;
+ }
+ set {
+ long mask = (1L << 0x1a);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has TypeSpec table.
+ /// </summary>
+ public bool HasTypeSpec {
+ get {
+ return (Valid & (1L << 0x1b)) != 0;
+ }
+ set {
+ long mask = (1L << 0x1b);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ImplMap table.
+ /// </summary>
+ public bool HasImplMap {
+ get {
+ return (Valid & (1L << 0x1c)) != 0;
+ }
+ set {
+ long mask = (1L << 0x1c);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has FieldRVA table.
+ /// </summary>
+ public bool HasFieldRVA {
+ get {
+ return (Valid & (1L << 0x1d)) != 0;
+ }
+ set {
+ long mask = (1L << 0x1d);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ENCLog table.
+ /// </summary>
+ public bool HasENCLog {
+ get {
+ return (Valid & (1L << 0x1e)) != 0;
+ }
+ set {
+ long mask = (1L << 0x1e);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ENCMap table.
+ /// </summary>
+ public bool HasENCMap {
+ get {
+ return (Valid & (1L << 0x1f)) != 0;
+ }
+ set {
+ long mask = (1L << 0x1f);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has Assembly table.
+ /// </summary>
+ public bool HasAssembly {
+ get {
+ return (Valid & (1L << 0x20)) != 0;
+ }
+ set {
+ long mask = (1L << 0x20);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has AssemblyProcessor table.
+ /// </summary>
+ public bool HasAssemblyProcessor {
+ get {
+ return (Valid & (1L << 0x21)) != 0;
+ }
+ set {
+ long mask = (1L << 0x21);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has AssemblyOS table.
+ /// </summary>
+ public bool HasAssemblyOS {
+ get {
+ return (Valid & (1L << 0x22)) != 0;
+ }
+ set {
+ long mask = (1L << 0x22);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has AssemblyRef table.
+ /// </summary>
+ public bool HasAssemblyRef {
+ get {
+ return (Valid & (1L << 0x23)) != 0;
+ }
+ set {
+ long mask = (1L << 0x23);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has AssemblyRefProcessor table.
+ /// </summary>
+ public bool HasAssemblyRefProcessor {
+ get {
+ return (Valid & (1L << 0x24)) != 0;
+ }
+ set {
+ long mask = (1L << 0x24);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has AssemblyRefOS table.
+ /// </summary>
+ public bool HasAssemblyRefOS {
+ get {
+ return (Valid & (1L << 0x25)) != 0;
+ }
+ set {
+ long mask = (1L << 0x25);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has File table.
+ /// </summary>
+ public bool HasFile {
+ get {
+ return (Valid & (1L << 0x26)) != 0;
+ }
+ set {
+ long mask = (1L << 0x26);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ExportedType table.
+ /// </summary>
+ public bool HasExportedType {
+ get {
+ return (Valid & (1L << 0x27)) != 0;
+ }
+ set {
+ long mask = (1L << 0x27);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has ManifestResource table.
+ /// </summary>
+ public bool HasManifestResource {
+ get {
+ return (Valid & (1L << 0x28)) != 0;
+ }
+ set {
+ long mask = (1L << 0x28);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has NestedClass table.
+ /// </summary>
+ public bool HasNestedClass {
+ get {
+ return (Valid & (1L << 0x29)) != 0;
+ }
+ set {
+ long mask = (1L << 0x29);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has TypeTyPar table.
+ /// </summary>
+ public bool HasTypeTyPar {
+ get {
+ return (Valid & (1L << 0x2a)) != 0;
+ }
+ set {
+ long mask = (1L << 0x2a);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if heap has MethodTyPar table.
+ /// </summary>
+ public bool HasMethodTyPar {
+ get {
+ return (Valid & (1L << 0x2b)) != 0;
+ }
+ set {
+ long mask = (1L << 0x2b);
+ if (value) {
+ Valid |= mask;
+ } else {
+ Valid &= ~mask;
+ }
+ }
+ }
+
+
+ }
+
+}
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/TabsDecoder.cs b/mcs/class/Mono.PEToolkit/metadata/TabsDecoder.cs
new file mode 100644
index 00000000000..cc6436a7c98
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/TabsDecoder.cs
@@ -0,0 +1,1933 @@
+// Auto-generated file - DO NOT EDIT!
+// Please edit md-schema.xml or tabs-decoder.xsl if you want to make changes.
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public sealed class TabsDecoder {
+
+ private TabsDecoder()
+ {
+ }
+
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public static MDToken DecodeToken(CodedTokenId id, int data)
+ {
+ MDToken res = new MDToken();
+ int tag;
+ int rid;
+ TokenType tok;
+
+ switch (id) {
+
+ case CodedTokenId.TypeDefOrRef :
+ tag = data & 0x03;
+ rid = (int) ((uint) data >> 2);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.TypeDef;
+ break;
+
+ case 1 :
+ tok = TokenType.TypeRef;
+ break;
+
+ case 2 :
+ tok = TokenType.TypeSpec;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for TypeDefOrRef, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.HasConstant :
+ tag = data & 0x03;
+ rid = (int) ((uint) data >> 2);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.FieldDef;
+ break;
+
+ case 1 :
+ tok = TokenType.ParamDef;
+ break;
+
+ case 2 :
+ tok = TokenType.Property;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for HasConstant, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.HasCustomAttribute :
+ tag = data & 0x1F;
+ rid = (int) ((uint) data >> 5);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.MethodDef;
+ break;
+
+ case 1 :
+ tok = TokenType.FieldDef;
+ break;
+
+ case 2 :
+ tok = TokenType.TypeRef;
+ break;
+
+ case 3 :
+ tok = TokenType.TypeDef;
+ break;
+
+ case 4 :
+ tok = TokenType.ParamDef;
+ break;
+
+ case 5 :
+ tok = TokenType.InterfaceImpl;
+ break;
+
+ case 6 :
+ tok = TokenType.MemberRef;
+ break;
+
+ case 7 :
+ tok = TokenType.Module;
+ break;
+
+ case 8 :
+ tok = TokenType.Permission;
+ break;
+
+ case 9 :
+ tok = TokenType.Property;
+ break;
+
+ case 10 :
+ tok = TokenType.Event;
+ break;
+
+ case 11 :
+ tok = TokenType.Signature;
+ break;
+
+ case 12 :
+ tok = TokenType.ModuleRef;
+ break;
+
+ case 13 :
+ tok = TokenType.TypeSpec;
+ break;
+
+ case 14 :
+ tok = TokenType.Assembly;
+ break;
+
+ case 15 :
+ tok = TokenType.AssemblyRef;
+ break;
+
+ case 16 :
+ tok = TokenType.File;
+ break;
+
+ case 17 :
+ tok = TokenType.ExportedType;
+ break;
+
+ case 18 :
+ tok = TokenType.ManifestResource;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for HasCustomAttribute, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.HasFieldMarshal :
+ tag = data & 0x01;
+ rid = (int) ((uint) data >> 1);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.FieldDef;
+ break;
+
+ case 1 :
+ tok = TokenType.ParamDef;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for HasFieldMarshal, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.HasDeclSecurity :
+ tag = data & 0x03;
+ rid = (int) ((uint) data >> 2);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.TypeDef;
+ break;
+
+ case 1 :
+ tok = TokenType.MethodDef;
+ break;
+
+ case 2 :
+ tok = TokenType.Assembly;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for HasDeclSecurity, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.MemberRefParent :
+ tag = data & 0x07;
+ rid = (int) ((uint) data >> 3);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.TypeDef;
+ break;
+
+ case 1 :
+ tok = TokenType.TypeRef;
+ break;
+
+ case 2 :
+ tok = TokenType.ModuleRef;
+ break;
+
+ case 3 :
+ tok = TokenType.MethodDef;
+ break;
+
+ case 4 :
+ tok = TokenType.TypeSpec;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for MemberRefParent, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.HasSemantics :
+ tag = data & 0x01;
+ rid = (int) ((uint) data >> 1);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.Event;
+ break;
+
+ case 1 :
+ tok = TokenType.Property;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for HasSemantics, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.MethodDefOrRef :
+ tag = data & 0x01;
+ rid = (int) ((uint) data >> 1);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.MethodDef;
+ break;
+
+ case 1 :
+ tok = TokenType.MemberRef;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for MethodDefOrRef, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.MemberForwarded :
+ tag = data & 0x01;
+ rid = (int) ((uint) data >> 1);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.FieldDef;
+ break;
+
+ case 1 :
+ tok = TokenType.MethodDef;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for MemberForwarded, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.Implementation :
+ tag = data & 0x03;
+ rid = (int) ((uint) data >> 2);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.File;
+ break;
+
+ case 1 :
+ tok = TokenType.AssemblyRef;
+ break;
+
+ case 2 :
+ tok = TokenType.ExportedType;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for Implementation, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.CustomAttributeType :
+ tag = data & 0x07;
+ rid = (int) ((uint) data >> 3);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.TypeRef;
+ break;
+
+ case 1 :
+ tok = TokenType.TypeDef;
+ break;
+
+ case 2 :
+ tok = TokenType.MethodDef;
+ break;
+
+ case 3 :
+ tok = TokenType.MemberRef;
+ break;
+
+ case 4 :
+ tok = TokenType.String;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for CustomAttributeType, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ case CodedTokenId.ResolutionScope :
+ tag = data & 0x03;
+ rid = (int) ((uint) data >> 2);
+ switch (tag) {
+
+ case 0 :
+ tok = TokenType.Module;
+ break;
+
+ case 1 :
+ tok = TokenType.ModuleRef;
+ break;
+
+ case 2 :
+ tok = TokenType.AssemblyRef;
+ break;
+
+ case 3 :
+ tok = TokenType.TypeRef;
+ break;
+
+ default :
+ throw new BadMetaDataException("Invalid coded token for ResolutionScope, unknown table tag - " + tag);
+ }
+ res = new MDToken(tok, rid);
+ break;
+
+ default:
+ break;
+ }
+ return res;
+ }
+
+
+ private static int GetCodedIndexSize(TablesHeap heap, CodedTokenId id, int [] rows)
+ {
+ int res = 0;
+
+ switch (id) {
+
+ case CodedTokenId.TypeDefOrRef :
+ res = MDUtils.Max(rows [(int) TableId.TypeDef], rows [(int) TableId.TypeRef], rows [(int) TableId.TypeSpec]);
+ res = res < (1 << (16 - 2)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.HasConstant :
+ res = MDUtils.Max(rows [(int) TableId.Field], rows [(int) TableId.Param], rows [(int) TableId.Property]);
+ res = res < (1 << (16 - 2)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.HasCustomAttribute :
+ res = MDUtils.Max(rows [(int) TableId.Method], rows [(int) TableId.Field], rows [(int) TableId.TypeRef], rows [(int) TableId.TypeDef], rows [(int) TableId.Param], rows [(int) TableId.InterfaceImpl], rows [(int) TableId.MemberRef], rows [(int) TableId.Module], rows [(int) TableId.DeclSecurity], rows [(int) TableId.Property], rows [(int) TableId.Event], rows [(int) TableId.StandAloneSig], rows [(int) TableId.ModuleRef], rows [(int) TableId.TypeSpec], rows [(int) TableId.Assembly], rows [(int) TableId.AssemblyRef], rows [(int) TableId.File], rows [(int) TableId.ExportedType], rows [(int) TableId.ManifestResource]);
+ res = res < (1 << (16 - 5)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.HasFieldMarshal :
+ res = MDUtils.Max(rows [(int) TableId.Field], rows [(int) TableId.Param]);
+ res = res < (1 << (16 - 1)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.HasDeclSecurity :
+ res = MDUtils.Max(rows [(int) TableId.TypeDef], rows [(int) TableId.Method], rows [(int) TableId.Assembly]);
+ res = res < (1 << (16 - 2)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.MemberRefParent :
+ res = MDUtils.Max(rows [(int) TableId.TypeDef], rows [(int) TableId.TypeRef], rows [(int) TableId.ModuleRef], rows [(int) TableId.Method], rows [(int) TableId.TypeSpec]);
+ res = res < (1 << (16 - 3)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.HasSemantics :
+ res = MDUtils.Max(rows [(int) TableId.Event], rows [(int) TableId.Property]);
+ res = res < (1 << (16 - 1)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.MethodDefOrRef :
+ res = MDUtils.Max(rows [(int) TableId.Method], rows [(int) TableId.MemberRef]);
+ res = res < (1 << (16 - 1)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.MemberForwarded :
+ res = MDUtils.Max(rows [(int) TableId.Field], rows [(int) TableId.Method]);
+ res = res < (1 << (16 - 1)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.Implementation :
+ res = MDUtils.Max(rows [(int) TableId.File], rows [(int) TableId.AssemblyRef], rows [(int) TableId.ExportedType]);
+ res = res < (1 << (16 - 2)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.CustomAttributeType :
+ res = MDUtils.Max(rows [(int) TableId.TypeRef], rows [(int) TableId.TypeDef], rows [(int) TableId.Method], rows [(int) TableId.MemberRef], (heap.StringsIndexSize > 2 ? 1 << 17 : 1));
+ res = res < (1 << (16 - 3)) ? 2 : 4;
+ break;
+
+ case CodedTokenId.ResolutionScope :
+ res = MDUtils.Max(rows [(int) TableId.Module], rows [(int) TableId.ModuleRef], rows [(int) TableId.AssemblyRef], rows [(int) TableId.TypeRef]);
+ res = res < (1 << (16 - 2)) ? 2 : 4;
+ break;
+
+ default:
+ break;
+ }
+
+ return res;
+ }
+
+
+ private static int GetIndexSize(TableId tab, int [] rows)
+ {
+ // Index is 2 bytes wide if table has less than 2^16 rows
+ // otherwise it's 4 bytes wide.
+ return ((uint) rows [(int) tab]) < (1 << 16) ? 2 : 4;
+ }
+
+
+ private static void AllocBuff(ref byte [] buff, int size)
+ {
+ if (buff == null || buff.Length < size) {
+ buff = new byte [(size + 4) & ~3];
+ }
+ Array.Clear(buff, 0, size);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ unsafe public static int DecodePhysicalTables(TablesHeap heap, byte [] data, int offs, int [] rows)
+ {
+ int rowSize; // expanded row size (all indices are dwords)
+ int fldSize; // physical field size
+ int dest;
+ int nRows;
+ byte [] buff = null;
+ int si = heap.StringsIndexSize;
+ int gi = heap.GUIDIndexSize;
+ int bi = heap.BlobIndexSize;
+
+ if (heap.HasModule) {
+ rowSize = sizeof (ushort) + 4 + 4 + 4 + 4;
+ nRows = rows [(int) TableId.Module];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ModuleTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Generation, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Mvid, index(#GUID)
+ fldSize = gi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // EncId, index(#GUID)
+ fldSize = gi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // EncBaseId, index(#GUID)
+ fldSize = gi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasTypeRef) {
+ rowSize = 4 + 4 + 4;
+ nRows = rows [(int) TableId.TypeRef];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new TypeRefTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // ResolutionScope, coded-index(ResolutionScope)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.ResolutionScope, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Namespace, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasTypeDef) {
+ rowSize = sizeof (uint) + 4 + 4 + 4 + 4 + 4;
+ nRows = rows [(int) TableId.TypeDef];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new TypeDefTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Flags, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Namespace, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Extends, coded-index(TypeDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.TypeDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // FieldList, index(Field)
+ fldSize = GetIndexSize(TableId.Field, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // MethodList, index(Method)
+ fldSize = GetIndexSize(TableId.Method, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasFieldPtr) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.FieldPtr];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new FieldPtrTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Field, index(Field)
+ fldSize = GetIndexSize(TableId.Field, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasField) {
+ rowSize = sizeof (ushort) + 4 + 4;
+ nRows = rows [(int) TableId.Field];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new FieldTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Flags, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Signature, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasMethodPtr) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.MethodPtr];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new MethodPtrTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Method, index(Method)
+ fldSize = GetIndexSize(TableId.Method, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasMethod) {
+ rowSize = RVA.Size + sizeof (ushort) + sizeof (ushort) + 4 + 4 + 4;
+ nRows = rows [(int) TableId.Method];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new MethodTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // RVA, RVA
+ fldSize = RVA.Size;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += RVA.Size;
+
+ // ImplFlags, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Flags, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Signature, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // ParamList, index(Param)
+ fldSize = GetIndexSize(TableId.Param, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasParamPtr) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.ParamPtr];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ParamPtrTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Param, index(Param)
+ fldSize = GetIndexSize(TableId.Param, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasParam) {
+ rowSize = sizeof (ushort) + sizeof (ushort) + 4;
+ nRows = rows [(int) TableId.Param];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ParamTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Flags, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Sequence, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasInterfaceImpl) {
+ rowSize = 4 + 4;
+ nRows = rows [(int) TableId.InterfaceImpl];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new InterfaceImplTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Class, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Interface, coded-index(TypeDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.TypeDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasMemberRef) {
+ rowSize = 4 + 4 + 4;
+ nRows = rows [(int) TableId.MemberRef];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new MemberRefTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Class, coded-index(MemberRefParent)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.MemberRefParent, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Signature, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasConstant) {
+ rowSize = sizeof (short) + 4 + 4;
+ nRows = rows [(int) TableId.Constant];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ConstantTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Type, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // Parent, coded-index(HasConstant)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.HasConstant, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Value, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasCustomAttribute) {
+ rowSize = 4 + 4 + 4;
+ nRows = rows [(int) TableId.CustomAttribute];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new CustomAttributeTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Parent, coded-index(HasCustomAttribute)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.HasCustomAttribute, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Type, coded-index(CustomAttributeType)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.CustomAttributeType, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Value, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasFieldMarshal) {
+ rowSize = 4 + 4;
+ nRows = rows [(int) TableId.FieldMarshal];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new FieldMarshalTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Parent, coded-index(HasFieldMarshal)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.HasFieldMarshal, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // NativeType, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasDeclSecurity) {
+ rowSize = sizeof (short) + 4 + 4;
+ nRows = rows [(int) TableId.DeclSecurity];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new DeclSecurityTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Action, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // Parent, coded-index(HasDeclSecurity)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.HasDeclSecurity, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // PermissionSet, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasClassLayout) {
+ rowSize = sizeof (short) + sizeof (int) + 4;
+ nRows = rows [(int) TableId.ClassLayout];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ClassLayoutTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // PackingSize, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // ClassSize, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // Parent, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasFieldLayout) {
+ rowSize = sizeof (int) + 4;
+ nRows = rows [(int) TableId.FieldLayout];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new FieldLayoutTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Offset, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // Field, index(Field)
+ fldSize = GetIndexSize(TableId.Field, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasStandAloneSig) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.StandAloneSig];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new StandAloneSigTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Signature, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasEventMap) {
+ rowSize = 4 + 4;
+ nRows = rows [(int) TableId.EventMap];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new EventMapTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Parent, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // EventList, index(Event)
+ fldSize = GetIndexSize(TableId.Event, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasEventPtr) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.EventPtr];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new EventPtrTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Event, index(Event)
+ fldSize = GetIndexSize(TableId.Event, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasEvent) {
+ rowSize = sizeof (short) + 4 + 4;
+ nRows = rows [(int) TableId.Event];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new EventTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // EventFlags, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // EventType, coded-index(TypeDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.TypeDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasPropertyMap) {
+ rowSize = 4 + 4;
+ nRows = rows [(int) TableId.PropertyMap];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new PropertyMapTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Parent, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // PropertyList, index(Property)
+ fldSize = GetIndexSize(TableId.Property, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasPropertyPtr) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.PropertyPtr];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new PropertyPtrTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Property, index(Property)
+ fldSize = GetIndexSize(TableId.Property, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasProperty) {
+ rowSize = sizeof (ushort) + 4 + 4;
+ nRows = rows [(int) TableId.Property];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new PropertyTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Flags, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Type, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasMethodSemantics) {
+ rowSize = sizeof (ushort) + 4 + 4;
+ nRows = rows [(int) TableId.MethodSemantics];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new MethodSemanticsTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Semantics, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Method, index(Method)
+ fldSize = GetIndexSize(TableId.Method, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Association, coded-index(HasSemantics)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.HasSemantics, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasMethodImpl) {
+ rowSize = 4 + 4 + 4;
+ nRows = rows [(int) TableId.MethodImpl];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new MethodImplTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Class, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // MethodBody, coded-index(MethodDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.MethodDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // MethodDeclaration, coded-index(MethodDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.MethodDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasModuleRef) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.ModuleRef];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ModuleRefTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasTypeSpec) {
+ rowSize = 4;
+ nRows = rows [(int) TableId.TypeSpec];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new TypeSpecTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Signature, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasImplMap) {
+ rowSize = sizeof (ushort) + 4 + 4 + 4;
+ nRows = rows [(int) TableId.ImplMap];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ImplMapTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // MappingFlags, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // MemberForwarded, coded-index(MemberForwarded)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.MemberForwarded, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // ImportName, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // ImportScope, index(ModuleRef)
+ fldSize = GetIndexSize(TableId.ModuleRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasFieldRVA) {
+ rowSize = RVA.Size + 4;
+ nRows = rows [(int) TableId.FieldRVA];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new FieldRVATable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // RVA, RVA
+ fldSize = RVA.Size;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += RVA.Size;
+
+ // Field, index(Field)
+ fldSize = GetIndexSize(TableId.Field, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasENCLog) {
+ rowSize = sizeof (uint) + sizeof (uint);
+ nRows = rows [(int) TableId.ENCLog];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ENCLogTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Token, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // FuncCode, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasENCMap) {
+ rowSize = sizeof (uint);
+ nRows = rows [(int) TableId.ENCMap];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ENCMapTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Token, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasAssembly) {
+ rowSize = sizeof (int) + sizeof (short) + sizeof (short) + sizeof (short) + sizeof (short) + sizeof (uint) + 4 + 4 + 4;
+ nRows = rows [(int) TableId.Assembly];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new AssemblyTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // HashAlgId, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // MajorVersion, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // MinorVersion, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // BuildNumber, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // RevisionNumber, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // Flags, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // PublicKey, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Culture, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasAssemblyProcessor) {
+ rowSize = sizeof (int);
+ nRows = rows [(int) TableId.AssemblyProcessor];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new AssemblyProcessorTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Processor, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasAssemblyOS) {
+ rowSize = sizeof (int) + sizeof (int) + sizeof (int);
+ nRows = rows [(int) TableId.AssemblyOS];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new AssemblyOSTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // OSPlatformID, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // OSMajorVersion, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // OSMinorVersion, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasAssemblyRef) {
+ rowSize = sizeof (short) + sizeof (short) + sizeof (short) + sizeof (short) + sizeof (uint) + 4 + 4 + 4 + 4;
+ nRows = rows [(int) TableId.AssemblyRef];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new AssemblyRefTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // MajorVersion, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // MinorVersion, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // BuildNumber, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // RevisionNumber, short
+ fldSize = sizeof (short);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (short);
+
+ // Flags, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // PublicKeyOrToken, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Culture, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // HashValue, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasAssemblyRefProcessor) {
+ rowSize = sizeof (int) + 4;
+ nRows = rows [(int) TableId.AssemblyRefProcessor];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new AssemblyRefProcessorTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Processor, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // AssemblyRef, index(AssemblyRef)
+ fldSize = GetIndexSize(TableId.AssemblyRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasAssemblyRefOS) {
+ rowSize = sizeof (int) + sizeof (int) + sizeof (int) + 4;
+ nRows = rows [(int) TableId.AssemblyRefOS];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new AssemblyRefOSTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // OSPlatformID, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // OSMajorVersion, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // OSMinorVersion, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // AssemblyRef, index(AssemblyRef)
+ fldSize = GetIndexSize(TableId.AssemblyRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasFile) {
+ rowSize = sizeof (uint) + 4 + 4;
+ nRows = rows [(int) TableId.File];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new FileTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Flags, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // HashValue, index(#Blob)
+ fldSize = bi;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasExportedType) {
+ rowSize = sizeof (uint) + 4 + 4 + 4 + 4;
+ nRows = rows [(int) TableId.ExportedType];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ExportedTypeTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Flags, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // TypeDefId, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // TypeName, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // TypeNamespace, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Implementation, coded-index(Implementation)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.Implementation, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasManifestResource) {
+ rowSize = sizeof (int) + sizeof (uint) + 4 + 4;
+ nRows = rows [(int) TableId.ManifestResource];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new ManifestResourceTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Offset, int
+ fldSize = sizeof (int);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (int);
+
+ // Flags, uint
+ fldSize = sizeof (uint);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (uint);
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Implementation, coded-index(Implementation)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.Implementation, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasNestedClass) {
+ rowSize = 4 + 4;
+ nRows = rows [(int) TableId.NestedClass];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new NestedClassTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // NestedClass, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // EnclosingClass, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasTypeTyPar) {
+ rowSize = sizeof (ushort) + 4 + 4 + 4;
+ nRows = rows [(int) TableId.TypeTyPar];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new TypeTyParTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Number, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Class, index(TypeDef)
+ fldSize = GetIndexSize(TableId.TypeDef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Bound, coded-index(TypeDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.TypeDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ if (heap.HasMethodTyPar) {
+ rowSize = sizeof (ushort) + 4 + 4 + 4;
+ nRows = rows [(int) TableId.MethodTyPar];
+ AllocBuff(ref buff, rowSize * nRows);
+ dest = 0;
+
+ MDTable tab = new MethodTyParTable(heap);
+
+ for (int i = nRows; --i >= 0;) {
+
+ // Number, ushort
+ fldSize = sizeof (ushort);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += sizeof (ushort);
+
+ // Method, index(Method)
+ fldSize = GetIndexSize(TableId.Method, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Bound, coded-index(TypeDefOrRef)
+ fldSize = GetCodedIndexSize(heap, CodedTokenId.TypeDefOrRef, rows);
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ // Name, index(#Strings)
+ fldSize = si;
+ Array.Copy(data, offs, buff, dest, fldSize);
+ offs += fldSize;
+ dest += 4;
+
+ }
+
+ tab.FromRawData(buff, 0, nRows);
+ }
+
+ return offs;
+ }
+
+ } // end class
+} // end namespace
+
diff --git a/mcs/class/Mono.PEToolkit/metadata/TokenType.cs b/mcs/class/Mono.PEToolkit/metadata/TokenType.cs
new file mode 100644
index 00000000000..dd4b9a49e8f
--- /dev/null
+++ b/mcs/class/Mono.PEToolkit/metadata/TokenType.cs
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+using System;
+
+namespace Mono.PEToolkit.Metadata {
+
+ /// <summary>
+ /// TokenType enum.
+ /// See mdt* constants in CorHdr.
+ /// </summary>
+ /// <remarks>
+ /// See Metadata Unmanaged API, 9.1 Token Types
+ /// </remarks>
+ public enum TokenType : int {
+ __shift = 24,
+ __mask = 0xFF << __shift,
+
+ Module = 0x00 << __shift,
+ TypeRef = 0x01 << __shift,
+ TypeDef = 0x02 << __shift,
+ FieldDef = 0x04 << __shift,
+ MethodDef = 0x06 << __shift,
+ ParamDef = 0x08 << __shift,
+ InterfaceImpl = 0x09 << __shift,
+ MemberRef = 0x0a << __shift,
+ CustomAttribute = 0x0c << __shift,
+ Permission = 0x0e << __shift,
+ Signature = 0x11 << __shift,
+ Event = 0x14 << __shift,
+ Property = 0x17 << __shift,
+ ModuleRef = 0x1a << __shift,
+ TypeSpec = 0x1b << __shift,
+ Assembly = 0x20 << __shift,
+ AssemblyRef = 0x23 << __shift,
+ File = 0x26 << __shift,
+ ExportedType = 0x27 << __shift,
+ ManifestResource = 0x28 << __shift,
+
+ String = 0x70 << __shift,
+ Name = 0x71 << __shift,
+ BaseType = 0x72 << __shift,
+ }
+
+}
diff --git a/mcs/class/README b/mcs/class/README
new file mode 100644
index 00000000000..97382f10b20
--- /dev/null
+++ b/mcs/class/README
@@ -0,0 +1,277 @@
+The class libraries are grouped together in the assemblies they belong.
+
+Each directory here represents an assembly, and inside each directory we
+divide the code based on the namespace they implement.
+
+In addition, each assembly directory contains a Test directory that holds the
+NUnit tests for that assembly.
+
+The nant build file for an assembly creates two versions of the dll for that
+assembly. One version is a "full" dll. The full dll contains (almost) all
+of the classes, regardless of how complete the classes are. The name of this
+dll is the normal name you would expect, like "corlib.dll" or "System.dll".
+These full dll's are created in the /mcs/class/lib directory.
+
+The other dll which is built is a "restricted" dll. The restricted dll
+omits incomplete classes that would prevent the NUnit testrunner from actually
+running the tests. These restricted dll's are created in the Test directory
+of their respective assembly and named with a "_res" suffix. So, for example,
+the NUnit-testable dll for corlib is /mcs/class/corlib/Test/corlib_res.dll.
+
+The final dll which is built is the one which houses the actual NUnit tests.
+This dll is built from all of the classes in the Test directory and below, and
+is named with a "_test" suffix. So, for example, the NUnit tests for corlib
+are in /mcs/class/corlib/Test/corlib_test.dll. This dll is also linked with
+the restricted dll found in the same directory.
+
+
+* Missing implementation bits
+
+ If you implement a class and you are missing implementation bits,
+ please use the attribute [MonoTODO]. This attribute can be used
+ to programatically generate our status web pages:
+
+ [MonoTODO]
+ int MyFunction ()
+ {
+ throw new NotImplementedException ();
+ }
+
+* Tagging buggy code
+
+ If there is a bug in your implementation tag the problem by using
+ the word "FIXME" in the code, together with a description of the
+ problem.
+
+ Do not use XXX or obscure descriptions, because otherwise people
+ will not be able to understand what you mean.
+
+* Tagging Problematic specs.
+
+ If the documentation and the Microsoft implementation do
+ differ (you wrote a test case to prove this), I suggest that you edit
+ the file `mcs/class/doc/API-notes' so we can keep track of these problems
+ and submit our comments to ECMA or Microsoft and seek clarification.
+
+ Sometimes the documentation might be buggy, and sometimes the implementation
+ might be buggy. Lets try to identify and pinpoint which one
+ is the correct one.
+
+ Sometimes the specification will be lame (consider Version.ToString (fieldCount)
+ where there is no way of knowing how many fields are available, making the API
+ not only stupid, but leading to unreliable code).
+
+ In those cases, use the keyword "LAMESPEC".
+
+
+* Coding considerations and style.
+
+ In order to keep the code consistent, please use the following
+ conventions. From here on `good' and `bad' are used to attribute
+ things that would make the coding style match, or not match. It is not
+ a judgement call on your coding abilities, but more of a style and
+ look call. Please try to follow these guidelines to ensure prettiness.
+
+ Use 8 space tabs for writing your code (hopefully we can keep
+ this consistent). If you are modifying someone else's code, try
+ to keep the coding style similar.
+
+ Since we are using 8-space tabs, you might want to consider the Linus
+ Torvals trick to reduce code nesting. Many times in a loop, you will
+ find yourself doing a test, and if the test is true, you will nest.
+ Many times this can be changed. Example:
+
+
+ for (i = 0; i < 10; i++) {
+ if (something (i)) {
+ do_more ();
+ }
+ }
+
+ This take precious space, instead write it like this:
+
+ for (i = 0; i < 10; i++) {
+ if (!something (i))
+ continue;
+ do_more ();
+ }
+
+ A few guidelines:
+
+ * Use a space before an opening parenthesis when calling
+ functions, or indexing, like this:
+
+ method (a);
+ b [10];
+
+ * Do not put a space after the opening parenthesis and the
+ closing one, ie:
+
+ good: method (a); array [10];
+
+ bad: method ( a ); array[ 10 ];
+
+ * Inside a code block, put the opening brace on the same line
+ as the statement:
+
+ good:
+ if (a) {
+ code ();
+ code ();
+ }
+
+ bad:
+ if (a)
+ {
+ code ();
+ code ();
+ }
+
+ * Avoid using unecessary open/close braces, vertical space
+ is usually limited:
+
+ good:
+ if (a)
+ code ();
+
+ bad:
+ if (a) {
+ code ();
+ }
+
+ * When defining a method, use the C style for brace placement,
+ that means, use a new line for the brace, like this:
+
+ good:
+ void Method ()
+ {
+ }
+
+ bad:
+ void Method () {
+ }
+
+ * Properties and indexers are an exception, keep the
+ brace on the same line as the property declaration.
+ Rationale: this makes it visually
+ simple to distinguish them.
+
+ good:
+ int Property {
+ get {
+ return value;
+ }
+ }
+
+ bad:
+ int Property
+ {
+ get {
+ return value;
+ }
+ }
+
+ Notice how the accessor "get" also keeps its brace on the same
+ line.
+
+ For very small properties, you can compress things:
+
+ ok:
+ int Property {
+ get { return value; }
+ set { x = value; }
+ }
+
+ * Use white space in expressions liberally, except in the presence
+ of parenthesis:
+
+ good:
+
+ if (a + 5 > method (blah () + 4))
+
+ bad:
+ if (a+5>method(blah()+4))
+
+ * For any new files, please use a descriptive introduction, like
+ this:
+
+ //
+ // System.Comment.cs: Handles comments in System files.
+ //
+ // Author:
+ // Juan Perez (juan@address.com)
+ //
+ // (C) 2002 Address, Inc (http://www.address.com)
+ //
+
+ * If you are modyfing someone else's code, and your contribution
+ is significant, please add yourself to the Authors list.
+
+ * Switch statements have the case at the same indentation as the
+ switch:
+
+ switch (x) {
+ case 'a':
+ ...
+ case 'b':
+ ...
+ }
+
+ * Argument names should use the camel casing for
+ identifiers, like this:
+
+ good:
+ void Method (string myArgument)
+
+ bad:
+ void Method (string lpstrArgument)
+ void Method (string my_string)
+
+ Here are a couple of examples:
+
+class X : Y {
+
+ bool Method (int argument_1, int argument_2)
+ {
+ if (argument_1 == argument_2)
+ throw new Exception (Locale.GetText ("They are equal!");
+
+ if (argument_1 < argument_2) {
+ if (argument_1 * 3 > 4)
+ return true;
+ else
+ return false;
+ }
+
+ //
+ // This sample helps keep your sanity while using 8-spaces for tabs
+ //
+ VeryLongIdentifierWhichTakesManyArguments (
+ Argument1, Argument2, Argument3,
+ NestedCallHere (
+ MoreNested));
+ }
+
+ bool MyProperty {
+ get {
+ return x;
+ }
+
+ set {
+ x = value;
+ }
+ }
+
+ void AnotherMethod ()
+ {
+ if ((a + 5) != 4) {
+ }
+
+ while (blah) {
+ if (a)
+ continue;
+ b++;
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/mcs/class/System.Configuration.Install/.cvsignore b/mcs/class/System.Configuration.Install/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Configuration.Install/ChangeLog b/mcs/class/System.Configuration.Install/ChangeLog
new file mode 100644
index 00000000000..1404b40064a
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/ChangeLog
@@ -0,0 +1,19 @@
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * updated .build file(s) to correctly contain required buildfile
+ attribute for nant
+
+2002-12-01 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * list.unix: Changed
+ * makefile.gnu: Add assembly to compile.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix:
+ * makefile.gnu:
+ Files added to build this on linux.
+
+2002-08-13 Jonathan Pryor <jonpryor@vt.edu>
+ * ChangeLog: Add change log to this directory
+ * System.Configuration.Install.build: Add build file to this directory.
+
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install.build b/mcs/class/System.Configuration.Install/System.Configuration.Install.build
new file mode 100644
index 00000000000..2369da3e3af
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install.build
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Configuration.Install.dll -->
+
+<project name="System.Configuration.install" default="build">
+ <property name="debug" value="true"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Configuration.Install.dll" debug="${debug}">
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+
+ <!-- cor compare dies with these currently -->
+ <!--arg value="/nostdlib"/--> <!-- don't reference mscorlib -->
+ <arg value="/r:mscorlib.dll"/>
+ <arg value="/r:System.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ <copy file="../lib/System.Configuration.Install.dll" tofile="Test/System.Configuration.Install.dll"/>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog b/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog
new file mode 100644
index 00000000000..d68031d8799
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog
@@ -0,0 +1,19 @@
+2002-12-01 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * IManagedInstaller.cs,
+ Installer.cs,
+ InstallException.cs,
+ ComponentInstaller.cs,
+ InstallContext.cs,
+ InstallEventArgs.cs,
+ InstallerCollection.cs,
+ InstallEventHandler.cs: Added.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * UninstallAction.cs: Changed namespace to
+ proper System.Configuration.Install;
+
+2002-08-13 Jonathan Pryor <jonpryor@vt.edu>
+ * ChangeLog: Add change log to this directory
+ * UninstallAction.cs: Implemented.
+
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs
new file mode 100644
index 00000000000..80151125f37
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs
@@ -0,0 +1,28 @@
+// System.Configuration.Install.ComponentInstaller.cs
+//
+// Author:
+// Alejandro Sánchez Acosta
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.ComponentModel;
+
+namespace System.Configuration.Install
+{
+ public abstract class ComponentInstaller : Installer
+ {
+ [MonoTODO]
+ protected ComponentInstaller () {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void CopyFromComponent (IComponent component);
+
+ [MonoTODO]
+ public virtual bool IsEquivalentInstaller (ComponentInstaller otherInstaller)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/IManagedInstaller.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/IManagedInstaller.cs
new file mode 100644
index 00000000000..986c5b8d288
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/IManagedInstaller.cs
@@ -0,0 +1,19 @@
+// System.Configuration.Installer.IManagedInstaller.cs
+//
+// Author:
+// Alejandro Sánchez Acosta
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Configuration.Installer
+{
+ //[Guid("")]
+ //[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IManagedInstaller
+ {
+ int ManagedInstall (string commandLine, int hInstall);
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs
new file mode 100644
index 00000000000..0221cba139e
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs
@@ -0,0 +1,55 @@
+// System.Configuration.Install.InstallContext.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections.Specialized;
+
+namespace System.Configuration.Install
+{
+ public class InstallContext
+ {
+ private StringDictionary parameters;
+
+ [MonoTODO]
+ public InstallContext () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public InstallContext (string logFilePath, string[] commandLine) {
+ throw new NotImplementedException ();
+ }
+
+ public StringDictionary Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool IsParameterTrue (string paramName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void LogMessage (string message)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected static StringDictionary ParseCommandLine (string[] args)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventArgs.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventArgs.cs
new file mode 100644
index 00000000000..ffbbc5f53ac
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventArgs.cs
@@ -0,0 +1,34 @@
+// System.Configuration.Install.InstallEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+
+namespace System.Configuration.Install
+{
+ public class InstallEventArgs : EventArgs
+ {
+ private IDictionary savedstate;
+
+ public InstallEventArgs() {
+ }
+
+ public InstallEventArgs (IDictionary savedState) {
+ this.savedstate = savedState;
+ }
+
+ public IDictionary SavedState {
+ get {
+ return savedstate;
+ }
+
+ set {
+ savedstate = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventHandler.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventHandler.cs
new file mode 100644
index 00000000000..cd1dc226266
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallEventHandler.cs
@@ -0,0 +1,15 @@
+// System.Configuration.Install.InstallEventHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Configuration.Install
+{
+ [Serializable]
+ public delegate void InstallEventHandler (object sender, InstallEventArgs e);
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallException.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallException.cs
new file mode 100644
index 00000000000..f05bee8f573
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallException.cs
@@ -0,0 +1,37 @@
+// System.Configuration.Install.InstallException.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Configuration.Install
+{
+ [Serializable]
+ public class InstallException : SystemException
+ {
+ private Exception innerException;
+
+ public InstallException ()
+ {
+ }
+
+ public InstallException (string message) : base (message)
+ {
+ }
+
+ protected InstallException (SerializationInfo info, StreamingContext context) : base (info, context)
+ {
+ }
+
+ public InstallException (string message, Exception innerException) : base (message)
+ {
+ this.innerException = innerException;
+ }
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs
new file mode 100644
index 00000000000..f91d5e0f263
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs
@@ -0,0 +1,154 @@
+// System.Configuration.Install.Installer.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Configuration.Install
+{
+ public class Installer : Component
+ {
+ private InstallContext context;
+ private string helptext;
+ InstallerCollection installers;
+ Installer parent;
+
+ [MonoTODO]
+ public Installer () {
+ throw new NotImplementedException ();
+ }
+
+ public InstallContext Context {
+ get {
+ return context;
+ }
+
+ set {
+ context = value;
+ }
+ }
+
+ public virtual string HelpText {
+ get {
+ return helptext;
+ }
+
+ set {
+ helptext = value;
+ }
+ }
+
+ public InstallerCollection Installers {
+ get {
+ return installers;
+ }
+
+ set {
+ installers = value;
+ }
+ }
+
+ public Installer Parent {
+ get {
+ return parent;
+ }
+
+ set {
+ parent = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual void Commit (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Install (IDictionary stateSaver)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnAfterInstall (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnAfterRollback (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnAfterUninstall (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnBeforeInstall (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnBeforeRollback (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnBeforeUninstall (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnCommitted (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnCommitting (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Rollback (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Uninstall (IDictionary savedState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public event InstallEventHandler AfterInstall;
+
+ public event InstallEventHandler AfterRollback;
+
+ public event InstallEventHandler AfterUninstall;
+
+ public event InstallEventHandler BeforeInstall;
+
+ public event InstallEventHandler BeforeRollback;
+
+ public event InstallEventHandler BeforeUninstall;
+
+ public event InstallEventHandler Committed;
+
+ public event InstallEventHandler Committing;
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallerCollection.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallerCollection.cs
new file mode 100644
index 00000000000..c8262496b2b
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallerCollection.cs
@@ -0,0 +1,81 @@
+// System.Configuration.Install.Installer.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+
+namespace System.Configuration.Install
+{
+ public class InstallerCollection : CollectionBase
+ {
+ [MonoTODO]
+ public Installer this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Add (Installer value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange (Installer[] value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange (InstallerCollection value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains (Installer value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo (Installer[] array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf (Installer value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Insert (int index, Installer value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnInsert (int index, object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnRemove (int index, object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnSet (int index, object oldValue, object newValue) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove (Installer value) {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/TODOAttribute.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/TODOAttribute.cs
new file mode 100644
index 00000000000..1682ac8df6e
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/TODOAttribute.cs
@@ -0,0 +1,39 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Configuration.Install {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/UninstallAction.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/UninstallAction.cs
new file mode 100644
index 00000000000..9239419e06f
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/UninstallAction.cs
@@ -0,0 +1,20 @@
+//
+// System.Configuration.Install.UninstallAction.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.Configuration.Install {
+
+ [Serializable]
+ public enum UninstallAction {
+ NoAction=0x01,
+ Remove=0x00
+ }
+}
+
diff --git a/mcs/class/System.Configuration.Install/Test/.cvsignore b/mcs/class/System.Configuration.Install/Test/.cvsignore
new file mode 100644
index 00000000000..e47122844d5
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/.cvsignore
@@ -0,0 +1,2 @@
+*.dll
+*.pdb \ No newline at end of file
diff --git a/mcs/class/System.Configuration.Install/Test/AllTests.cs b/mcs/class/System.Configuration.Install/Test/AllTests.cs
new file mode 100644
index 00000000000..8fe40431485
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/AllTests.cs
@@ -0,0 +1,29 @@
+//
+// MonoTests.AllTests.cs
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests
+{
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite
+ {
+ get {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (System.Configuration.Install.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Configuration.Install/Test/ChangeLog b/mcs/class/System.Configuration.Install/Test/ChangeLog
new file mode 100644
index 00000000000..334d62bcf81
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/ChangeLog
@@ -0,0 +1,12 @@
+2002-07-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: New file.
+ * System.Configuration.Install_test.build: modified randomly until it
+ works.
+
+ Fixes 'make test'.
+
+2002-08-13 Jonathan Pryor <jonpryor@vt.edu>
+ * ChangeLog: Add change log to this directory
+ * System.Configuration.Install_test.build: Add build file to this directory.
+
diff --git a/mcs/class/System.Configuration.Install/Test/System.Configuration.Install/AllTests.cs b/mcs/class/System.Configuration.Install/Test/System.Configuration.Install/AllTests.cs
new file mode 100644
index 00000000000..742b185f6c8
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/System.Configuration.Install/AllTests.cs
@@ -0,0 +1,27 @@
+//
+// MonoTests.System.Configuration.Install.AllTests
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Configuration.Install {
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Configuration.Install/Test/System.Configuration.Install/ChangeLog b/mcs/class/System.Configuration.Install/Test/System.Configuration.Install/ChangeLog
new file mode 100644
index 00000000000..a67be6de96b
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/System.Configuration.Install/ChangeLog
@@ -0,0 +1,5 @@
+2002-07-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: New file.
+ * ChangeLog: New file.
+
diff --git a/mcs/class/System.Configuration.Install/Test/System.Configuration.Install_test.build b/mcs/class/System.Configuration.Install/Test/System.Configuration.Install_test.build
new file mode 100644
index 00000000000..d92e5e78fb4
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/System.Configuration.Install_test.build
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Configuration.Install_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System_test" default="build">
+ <property name="debug" value="true"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System.Configuration.Install_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+
+ <arg value="/noconfig"/>
+ </csc>
+
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.AllTests,System.Configuration.Install_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System.Configuration.Install_test.dll" failonerror="false"/>
+ <delete file="System.Configuration.Install_test.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Configuration.Install/Test/makefile.gnu b/mcs/class/System.Configuration.Install/Test/makefile.gnu
new file mode 100644
index 00000000000..34211373291
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/makefile.gnu
@@ -0,0 +1,29 @@
+topdir = ../../..
+
+LIBRARY = system_configuration_install_linux_test.dll
+
+LIB_LIST = system_configuration_install_linux_test.args
+LIB_FLAGS = \
+ -r $(topdir)/class/lib/corlib.dll \
+ -r $(topdir)/class/lib/System.dll \
+ -r $(topdir)/class/lib/NUnitCore_mono.dll
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=_DUMMY_
+
+include $(topdir)/class/library.make
+
+MCS_FLAGS = --target library --noconfig
+
+TEST_SUITE_PREFIX = MonoTests.
+TEST_SUITE = AllTests
+NUNITCONSOLE=$(topdir)/class/lib/NUnitConsole_mono.exe
+MONO_PATH = $(topdir)/class/lib:.
+
+
+test: $(LIBRARY) run_test
+
+.PHONY: run_test
+
+run_test:
+ -MONO_PATH=$(MONO_PATH) mono $(NUNITCONSOLE) $(TEST_SUITE_PREFIX)$(TEST_SUITE),system_configuration_install_linux_test.dll
diff --git a/mcs/class/System.Configuration.Install/Test/system_configuration_install_linux_test.args b/mcs/class/System.Configuration.Install/Test/system_configuration_install_linux_test.args
new file mode 100644
index 00000000000..319c3080e66
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/Test/system_configuration_install_linux_test.args
@@ -0,0 +1,2 @@
+./AllTests.cs
+./System.Configuration.Install/AllTests.cs
diff --git a/mcs/class/System.Configuration.Install/list.unix b/mcs/class/System.Configuration.Install/list.unix
new file mode 100644
index 00000000000..3eafa8c51bd
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/list.unix
@@ -0,0 +1,9 @@
+System.Configuration.Install/IManagedInstaller.cs
+System.Configuration.Install/Installer.cs
+System.Configuration.Install/InstallException.cs
+System.Configuration.Install/ComponentInstaller.cs
+System.Configuration.Install/InstallContext.cs
+System.Configuration.Install/InstallEventArgs.cs
+System.Configuration.Install/InstallerCollection.cs
+System.Configuration.Install/InstallEventHandler.cs
+System.Configuration.Install/UninstallAction.cs
diff --git a/mcs/class/System.Configuration.Install/makefile.gnu b/mcs/class/System.Configuration.Install/makefile.gnu
new file mode 100644
index 00000000000..1cd8d871d21
--- /dev/null
+++ b/mcs/class/System.Configuration.Install/makefile.gnu
@@ -0,0 +1,14 @@
+topdir = ../..
+
+TEST_DIR= Test
+LIBRARY = $(topdir)/class/lib/System.Configuration.Install.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Data.OracleClient/ChangeLog b/mcs/class/System.Data.OracleClient/ChangeLog
new file mode 100755
index 00000000000..dea939b563d
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/ChangeLog
@@ -0,0 +1,53 @@
+2002-12-08 Daniel Morgan <danmorg@sc.rr.com>
+
+ * list
+ * makefile.gnu: added files for linux build
+
+ * System.Data.OracleClient.build: added file
+ for windows build
+
+ * .cvsignore: added file for cvs to ignore files
+
+ * System.Data.OracleClient/OciGlue.cs
+ * System.Data.OracleClient/ociglue.h
+ * System.Data.OracleClient/ociglue.c: code clean up
+ and better error handling
+
+2002-12-05 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.OracleClient
+ * System.Data.OracleClient/System.Data.OracleClient
+ added directory to mcs/class for the Oracle 8i
+ data provider
+
+ * System.Data.OracleClient/OciGlue.cs
+ * System.Data.OracleClient/OracleConnection.cs
+ * System.Data.OracleClient/OracleCommand.cs: added
+ files for the System.Data.OracleClient.dll assembly
+
+ * System.Data.OracleClient/ociglue.c
+ * System.Data.OracleClient/ociglue.h: added
+ files for thte System.Data.OracleClient.gluelib.dll
+ unmanaged c shared library
+
+ * System.Data.OracleClient/TestOracleClient.cs: test
+ the OracleClient data provider for Oracle 8i database
+
+ * ChangeLog: added file
+
+ * README.TXT: added file
+
+ * System.Data.OracleClient/OciGlueLib_MSVC_win32.make:
+ added makefile for ociglue shared lib on Win32 platform
+ and compiler Visual C++ 7.0
+
+ * System.Data.OracleClient/OciGlueLib_BCC_win32.make:
+ added makefile for ociglue shared lib on Win32 platform
+ and compiler Borland C++ 5.5
+
+ * MonoOracleClient.csproj
+ * MonoOracleClient.csproj.usr
+ * MonoOracleClient.sln
+ * MonoOracleClient.suo: added Visual Studio 1.0
+ project files to build the
+ assembly System.Data.OracleClient.dll
diff --git a/mcs/class/System.Data.OracleClient/README.TXT b/mcs/class/System.Data.OracleClient/README.TXT
new file mode 100755
index 00000000000..6b93b50b793
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/README.TXT
@@ -0,0 +1,87 @@
+
+README.TXT for Mono Oracle 8i data provider
+
+Located at
+mcs/class/System.Data.OracleClient
+
+Requirements:
+
+1. C#/CLR compiler. (only tried with Visual Studio.NET)
+ to build the OracleClient assembly.
+
+2. C compiler (only tried with the command-line c compilers
+ Borland C++ 5.5 and Visual C++ 7.0) that can build
+ the OracleClient glue shared library.
+
+ A free command-line
+ version of the Borland C++ 5.5 compiler
+ for Win32 can be downloaded
+ from http://www.borland.com/
+
+3. Oracle 8i client software via either of the following:
+ a. Oracle 8i client with access to an Oracle 8i database
+ b. Oracle 8i server
+
+ Either one, the client software needs to include the
+ oci shared library. This is oci.dll on Win32.
+ Oracle 8i can be downloaded from
+ http://www.oracle.com/
+
+4. GLIB 2.0. You should already have this installed since
+ Mono requires it. It can be downloaded from
+ http://www.gtk.org/
+ or for Win32, it can be downloaded from
+ http://www.gimp.org/win32
+
+Notes:
+
+I seriously doubt this will build within the
+mcs/class/System.Data.OracleClient directory
+structure. Maybe, moving the project files to
+a simpler directory structure may help.
+
+There are two parts:
+
+1. assembly System.Data.OracleClient.dll which
+ includes files OracleCommand.cs and OracleConnection.cs
+
+2. unmanaged System.Data.OracleClient.ociglue.dll which
+ must be built with a compiler that can link with the
+ oci shared library. On Windows,
+ the Oracle shared library oci.dll
+ This shared library provides the glue between
+ System.Data.OracleClient.dll and oci.dll
+
+How to build the various parts:
+
+1. System.Data.OracleClient.dll is built
+ using Visual Studio.NET 1.0 via its projects files
+ I have not tried building it
+ via only the .NET Framework 1.0 command-line tools.
+
+2. System.Data.OracleClient.ociglue.dll is built by the
+ C compiler that can build a native c shared library
+ that can link with the Oracle 8i oci shared libary and
+ the GLIB 2.0 shared library. A Makefile for
+ command-line compilers for Borland C++ 5.5
+ and Visual C++ 7.0 I have only tried building this
+ on Windows XP.
+
+TODO:
+
+1. get the OracleClient assembly to run on mono
+2. get the OracleClient glue lib to build with mcs on mono
+3. get the OracleClient to build with gcc
+4. get the OracleClient assembly and glub lib to
+ build with mcs on mono and run on mono on GNU/Linux
+5. Add transactions
+6. Add a data reader and retrieve simple data types
+7. Add parameters (binding variables)
+8. Add a data adapter
+9. add connection pooling support
+10. add more complex types
+11. add support for stored procedures, functions, and packages
+12. add support for security permissions
+13. add ability to execute queries in SQL# CLI
+14. add ability to execute queries in SQL# For GTK#
+
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.build b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.build
new file mode 100755
index 00000000000..b138d336b15
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.build
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Data.OracleClient.dll -->
+
+<project name="System.Data.OracleClient" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Data.OracleClient.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Data.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/System.Data.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/System.Data.dll" tofile="Test/System.Data.dll"/>
+ <copy file="../lib/System.Data.OracleClient.dll" tofile="Test/System.Data.OracleClient.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Data.OracleClient.dll" failonerror="false"/>
+ <delete file="Test/System.Data.OracleClient.dll" failonerror="false"/>
+ <delete file="Test/System.Data.dll" failonerror="false"/>
+
+ </target>
+</project>
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj
new file mode 100755
index 00000000000..5fa9b6ef82a
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj
@@ -0,0 +1,98 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{799D520E-73ED-43A1-91FD-81D64C32A6F0}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.Data.OracleClient"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "System.Data.OracleClient"
+ StartupObject = "Test.OracleClient.OracleTest"
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "OciGlue.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OracleCommand.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OracleConnection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user
new file mode 100755
index 00000000000..4089d2bb533
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln
new file mode 100755
index 00000000000..1e200c744b0
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoOracleClient", "MonoOracleClient.csproj", "{799D520E-73ED-43A1-91FD-81D64C32A6F0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\Test\Test.csproj", "{2A30C592-6B73-48E0-9640-A0DE8CA3C02F}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Debug.ActiveCfg = Debug|.NET
+ {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Debug.Build.0 = Debug|.NET
+ {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Release.ActiveCfg = Release|.NET
+ {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Release.Build.0 = Release|.NET
+ {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Debug.ActiveCfg = Debug|.NET
+ {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Debug.Build.0 = Debug|.NET
+ {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Release.ActiveCfg = Release|.NET
+ {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo
new file mode 100755
index 00000000000..f5e1a101efc
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo
Binary files differ
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs
new file mode 100755
index 00000000000..16400eaa1b2
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs
@@ -0,0 +1,203 @@
+//
+// ociglue.cs - provides glue between
+// managed C#/.NET System.Data.OracleClient.dll and
+// unmanaged native c library oci.dll
+// to be used in Mono System.Data.OracleClient as
+// the Oracle 8i data provider.
+//
+// Part of managed C#/.NET library System.Data.OracleClient.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Data.OracleClient.OCI {
+ internal sealed class OciGlue {
+
+ // TODO: need to clean up, dispose, close, etc...
+
+ // connection parameters
+ string database = "";
+ string username = "";
+ string password = "";
+
+ public const Int32 OCI_SUCCESS = 0;
+ public const Int32 OCI_SUCCESS_WITH_INFO = 1;
+ public const Int32 OCI_RESERVED_FOR_INT_USE = 200;
+ public const Int32 OCI_NO_DATA = 100;
+ public const Int32 OCI_ERROR = -1;
+ public const Int32 OCI_INVALID_HANDLE = -2;
+ public const Int32 OCI_NEED_DATA = 99;
+ public const Int32 OCI_STILL_EXECUTING = -3123;
+ public const Int32 OCI_CONTINUE = -24200;
+
+ private UInt32 ociGlueConnectionHandle = 0;
+
+ // http://download-west.oracle.com/docs/cd/A87861_01/NT817EE/index.htm
+ // from oracle/ora81/oci/include/oci.h
+
+ [DllImport("System.Data.OracleClient.ociglue.dll")]
+ public static extern IntPtr OciGlue_Connect (out Int32 status,
+ out UInt32 ociGlueConnectionHandle, out uint errcode,
+ string database, string username, string password);
+
+ [DllImport("System.Data.OracleClient.ociglue.dll")]
+ public static extern Int32 OciGlue_Disconnect (UInt32 connection_handle);
+
+ [DllImport("System.Data.OracleClient.ociglue.dll")]
+ public static extern Int32 OciGlue_PrepareAndExecuteNonQuerySimple (
+ UInt32 ociGlueConnectionHandle,
+ string sqlstmt, out int found);
+
+ [DllImport("System.Data.OracleClient.ociglue.dll")]
+ public static extern UInt32 OciGlue_ConnectionCount();
+
+ [DllImport("System.Data.OracleClient.ociglue.dll")]
+ public static extern IntPtr OciGlue_CheckError (Int32 status, UInt32 connection_handle);
+
+ [DllImport("System.Data.OracleClient.ociglue.dll")]
+ public static extern void OciGlue_Free (IntPtr obj);
+
+ public string CheckError(Int32 status) {
+ IntPtr intptrMsg = IntPtr.Zero;
+ string strMsg = "";
+ string msg = "";
+
+ intptrMsg = OciGlue_CheckError(status, ociGlueConnectionHandle);
+ if(intptrMsg != IntPtr.Zero)
+ strMsg = Marshal.PtrToStringAnsi(intptrMsg);
+ if(strMsg != null) {
+ msg = String.Copy(strMsg);
+ OciGlue_Free(intptrMsg);
+ }
+
+ return msg;
+ }
+
+ public Int32 Connect(OracleConnectionInfo conInfo) {
+
+ Int32 status = 0;
+ string error = "";
+ uint errcode = 0;
+ string errmsg = "";
+ string strMsg = "";
+ IntPtr ipErrMsg = IntPtr.Zero;
+
+ database = conInfo.Database;
+ username = conInfo.Username;
+ password = conInfo.Password;
+
+ Console.WriteLine("OciGlue_Connect");
+ ipErrMsg = OciGlue_Connect (out status,
+ out ociGlueConnectionHandle, out errcode,
+ database, username, password);
+ Console.WriteLine(" Handle: " + ociGlueConnectionHandle);
+
+ if(status != 0) {
+ if(status == -1) {
+ if(ipErrMsg != IntPtr.Zero) {
+ strMsg = "";
+ strMsg = Marshal.PtrToStringAnsi(ipErrMsg);
+ if(strMsg != null) {
+ errmsg = String.Copy(strMsg);
+ OciGlue_Free(ipErrMsg);
+ }
+ }
+ error = "OCI Error - errcode: " + errcode.ToString() + " errmsg: " + errmsg;
+
+ }
+ else
+ error = CheckStatus(status);
+
+ throw new Exception("Error: Unable to connect: " + error);
+ }
+
+ return status;
+ }
+
+ public Int32 Disconnect() {
+
+ Int32 status = 0;
+ string msg = "";
+
+ Console.WriteLine("OciGlue_Disconnect");
+ Console.WriteLine(" Handle: " + ociGlueConnectionHandle);
+ status = OciGlue.OciGlue_Disconnect (ociGlueConnectionHandle);
+ ociGlueConnectionHandle = 0;
+
+ if(status != 0) {
+ msg = CheckStatus(status);
+ throw new Exception(msg);
+ }
+
+ return status;
+ }
+
+
+ // Helper methods
+ public Int32 PrepareAndExecuteNonQuerySimple(string sql)
+ {
+ Int32 status = 0;
+ int found = 0;
+
+ Console.WriteLine("PrepareAndExecuteNonQuerySimple");
+ status = OciGlue_PrepareAndExecuteNonQuerySimple (
+ ociGlueConnectionHandle, sql, out found);
+
+ Console.WriteLine(" Handle: " + ociGlueConnectionHandle +
+ " Found: " + found.ToString());
+
+ CheckStatus(status);
+ return status;
+ }
+
+ public string CheckStatus(Int32 status) {
+ string msg = "";
+
+ switch (status) {
+ case OCI_SUCCESS:
+ msg = "Succsss";
+ break;
+ case OCI_SUCCESS_WITH_INFO:
+ msg = "Error - OCI_SUCCESS_WITH_INFO";
+ break;
+ case OCI_NEED_DATA:
+ msg = "Error - OCI_NEED_DATA";
+ break;
+ case OCI_NO_DATA:
+ msg = "Error - OCI_NODATA";
+ break;
+ case OCI_ERROR:
+ if(ociGlueConnectionHandle != 0)
+ msg = CheckError(status);
+ else
+ msg = "OCI_ERROR";
+ break;
+ case OCI_INVALID_HANDLE:
+ msg = "Error - OCI_INVALID_HANDLE";
+ break;
+ case OCI_STILL_EXECUTING:
+ msg = "Error - OCI_STILL_EXECUTE";
+ break;
+ case OCI_CONTINUE:
+ msg = "Error - OCI_CONTINUE";
+ break;
+ default:
+ msg = "Default";
+ break;
+ }
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make
new file mode 100755
index 00000000000..78e374fa046
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make
@@ -0,0 +1,22 @@
+#
+# Makefile for System.Data.OracleClient.gluelib.dll
+# using Borland C++
+#
+# This Makefile untested for Borland C++
+# a free Borland C++ 5.5 command-line
+# compiler can be downloaded
+# from http://www.borland.com/
+#
+
+all: System.Data.OracleClient.ociglue.dll
+
+System.Data.OracleClient.ociglue.dll: ociglue.c ocglue.h
+ set BINC=%BORLAND_HOME%\include
+ set BLIB=%BORLAND_HOME%\lib
+ %BORLAND_HOME%\bin\bcc32 -w-pro -c -a4 -DOCI_BORLAND -I. -I%BINC% -I..\include ociglue.c -I..\..\cygwin\home\DanielMorgan\mono\install\include\glib-2.0 -I..\..\cygwin\home\DanielMorgan\mono\install\lib\glib-2.0\include
+ echo LIBRARY System.Data.OracleClient.ociglue.dll > System.Data.OracleClient.ociglue.def
+ echo DESCRIPTION 'System.Data.OracleClient.ociglue.dll' >> System.Data.OracleClient.ociglue.def
+ echo EXPORTS >> System.Data.OracleClient.ociglue.def
+ echo _qxiqtbi=qxiqtbi >> System.Data.OracleClient.ociglue.def
+ %BORLAND_HOME%\bin\bcc32 -tWD -L%BLIB% -L..\lib\bc System.Data.OracleClient.ociglue.obj oci.lib bidsfi.lib glib-2.0.lib intl.lib iconv.lib
+ :end
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make
new file mode 100755
index 00000000000..09627e01d20
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make
@@ -0,0 +1,66 @@
+#
+# ociglue.c - provides glue between
+# managed C#/.NET System.Data.OracleClient.dll and
+# unmanaged native c library oci.dll
+# to be used in Mono System.Data.OracleClient as
+# the Oracle 8i data provider.
+#
+# Builds unmanaged C library System.Data.OracleClient.ociglue.dll
+#
+# Author:
+# Daniel Morgan <danmorg@sc.rr.com>
+#
+# Copyright (C) Daniel Morgan, 2002
+#
+#
+# Licensed under the MIT/X11 License.
+#
+
+# builds with command-line Microsoft C 7.0 using cl and nmake
+# builds using the MSVC OCI import library oci.lib (lib that exports symbols from oci.dll)
+
+# Two environment variables need to be set: ORACLE_HOME and GLIB_PREFIX
+# ORACLE_HOME set to directory above where your /oci/lib
+# For example:
+# set ORACLE_HOME=F:\oracle\ora81
+# Where f:\oracle\ora81 has a subdirectory oci
+#
+# GLIB_PREFIX set to where GLIB 2.0 prefix is installed
+# For example:
+# set GLIB_PREFIX=F:\cygwin\home\DanielMorgan\mono\install
+# Which assumes your glib-2.0 libraries are in $(GLIB_PREFIX)\lib
+# and your glib-2.0 include files are in $(GLIB_PREFIX)\include
+
+# GLIB 2.0 for Win32 found at http://www.gimp.org/win32
+
+PROJECT = System.Data.OracleClient.ociglue.dll
+
+GLIB_CFLAGS = -I$(GLIB_PREFIX)\include\glib-2.0 -I$(GLIB_PREFIX)\lib\glib-2.0\include
+GLIB_LIBS = /LIBPATH:$(GLIB_PREFIX)\lib glib-2.0.lib intl.lib iconv.lib
+
+#GLIB_CFLAGS = -IF:\cygwin\home\DanielMorgan\mono\install\include\glib-2.0 -IF:\cygwin\home\DanielMorgan\mono\install\lib\glib-2.0\include
+#GLIB_LIBS = /LIBPATH:F:\cygwin\home\DanielMorgan\mono\install\lib glib-2.0.lib intl.lib iconv.lib
+
+# Oracle 8i OCI
+ORACLE_CFLAGS = -I%ORACLE_HOME%\oci\include
+ORACLE_LIBS = /LIBPATH:%ORACLE_HOME%\oci\lib\msvc oci.lib
+
+OCIGLUELIB_CFLAGS = -I. -D_DLL -D_MT $(ORACLE_CFLAGS) $(GLIB_CFLAGS)
+OCIGLUELIB_LIBS = kernel32.lib msvcrt.lib $(ORACLE_LIBS) $(GLIB_LIBS)
+OCIGLUELIB_LINKFLAGS = /link /Dll /out:System.Data.OracleClient.ociglue.dll /nod:libc $(OCIGLUELIB_LIBS) $(OCIGLUELIB_EXPORTS)
+
+OCIGLUELIB_EXPORTS = /export:OciGlue_Connect /export:OciGlue_PrepareAndExecuteNonQuerySimple /export:OciGlue_Disconnect /export:OciGlue_ConnectionCount /export:OciGlue_CheckError /export:Free
+
+SOURCE_H_FILES = ociglue.h
+SOURCE_C_FILES = ociglue.c
+
+all: System.Data.OracleClient.ociglue.dll
+
+$(SOURCE_C_FILES) : $(SOURCE_H_FILES)
+
+System.Data.OracleClient.ociglue.dll : $(SOURCE_C_FILES)
+ cl $(OCIGLUELIB_CFLAGS) $(SOURCE_C_FILES) $(OCIGLUELIB_LINKFLAGS)
+
+clean:
+ rm -f System.Data.OracleClient.ociglue.dll
+ rm -f System.Data.OracleClient.ociglue.o
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
new file mode 100755
index 00000000000..15ad899b2e6
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
@@ -0,0 +1,77 @@
+//
+// OracleCommand.cs
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author: Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+// Licensed under the MIT/X11 License.
+//
+
+using System;
+using System.Data;
+using System.Data.OracleClient.OCI;
+
+namespace System.Data.OracleClient
+{
+ public class OracleCommand
+ {
+ string sql = "";
+ OracleConnection conn = null;
+
+ public OracleCommand ()
+ {
+
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ int rowsAffected = -1;
+
+ if(conn == null)
+ throw new Exception("Connection is null");
+ if(conn.State != ConnectionState.Open)
+ throw new Exception("ConnectionState not Open");
+ if(sql.Equals(""))
+ throw new Exception("CommandText is StringEmpty");
+
+ Int32 status;
+ status = conn.Oci.PrepareAndExecuteNonQuerySimple (sql);
+ if(status != 0) {
+ string statusText;
+ statusText = conn.Oci.CheckStatus(status);
+ string msg =
+ "SQL Error: [" +
+ sql + "] " +
+ statusText;
+ throw new Exception(msg);
+ }
+
+ return rowsAffected;
+ }
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+ set {
+ sql = value;
+ }
+ }
+
+ public OracleConnection Connection {
+ get {
+ return conn;
+ }
+ set {
+ conn = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs
new file mode 100755
index 00000000000..598fd4ecaea
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs
@@ -0,0 +1,198 @@
+//
+// OracleConnection.cs
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author: Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+// Original source code for setting ConnectionString
+// by Tim Coleman <tim@timcoleman.com>
+//
+// Copyright (C) Tim Coleman, 2002
+//
+// Licensed under the MIT/X11 License.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Data;
+using System.Data.OracleClient.OCI;
+using System.Text;
+
+namespace System.Data.OracleClient
+{
+ internal struct OracleConnectionInfo
+ {
+ public string Username;
+ public string Password;
+ public string Database;
+ }
+
+ public class OracleConnection
+ {
+ private OciGlue oci;
+ private ConnectionState state;
+ private OracleConnectionInfo conInfo;
+ private string connectionString = "";
+
+ public OracleConnection ()
+ {
+ state = ConnectionState.Closed;
+ oci = new OciGlue ();
+ }
+
+ public OracleConnection (string connectionString) : this()
+ {
+ this.connectionString = connectionString;
+ }
+
+ public void Open ()
+ {
+ Int32 status;
+
+ status = oci.Connect(conInfo);
+ if(status != 0)
+ throw new Exception("Error: Unable to connect: " +
+ status.ToString() +
+ ": " +
+ oci.CheckError(status));
+ else
+ state = ConnectionState.Open;
+ }
+
+ public void Close ()
+ {
+ Int32 status = oci.Disconnect();
+ state = ConnectionState.Closed;
+ if(status != 0)
+ throw new Exception("Error: Unable to disconnect: " +
+ status.ToString() +
+ ": " +
+ oci.CheckError(status));
+ }
+
+ // only for DEBUG purposes - not part of MS.NET 1.1 OracleClient
+ public static uint ConnectionCount
+ {
+ get {
+ uint count = OciGlue.OciGlue_ConnectionCount();
+ return count;
+ }
+ }
+
+ public ConnectionState State
+ {
+ get {
+ return state;
+ }
+ }
+
+ public string ConnectionString
+ {
+ get {
+ return connectionString;
+ }
+ set {
+ SetConnectionString(value);
+ }
+ }
+
+ internal OciGlue Oci
+ {
+ get {
+ return oci;
+ }
+ }
+
+ void SetConnectionString (string connectionString)
+ {
+ this.connectionString = connectionString;
+ conInfo.Username = "";
+ conInfo.Database = "";
+ conInfo.Password = "";
+
+ if (connectionString == String.Empty)
+ return;
+
+ connectionString += ";";
+ NameValueCollection parameters = new NameValueCollection ();
+
+ bool inQuote = false;
+ bool inDQuote = false;
+
+ string name = String.Empty;
+ string value = String.Empty;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in connectionString) {
+ switch (c) {
+ case '\'':
+ inQuote = !inQuote;
+ break;
+ case '"' :
+ inDQuote = !inDQuote;
+ break;
+ case ';' :
+ if (!inDQuote && !inQuote) {
+ if (name != String.Empty && name != null) {
+ value = sb.ToString ();
+ parameters [name.ToUpper ().Trim ()] = value.Trim ();
+ }
+ name = String.Empty;
+ value = String.Empty;
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ case '=' :
+ if (!inDQuote && !inQuote) {
+ name = sb.ToString ();
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ default:
+ sb.Append (c);
+ break;
+ }
+ }
+
+ SetProperties (parameters);
+ }
+
+ private void SetProperties (NameValueCollection parameters)
+ {
+ string value;
+ foreach (string name in parameters) {
+ value = parameters[name];
+
+ switch (name) {
+ case "DATA SOURCE" :
+ case "DATABASE" :
+ // set Database property
+ conInfo.Database = value;
+ break;
+ case "PASSWORD" :
+ case "PWD" :
+ conInfo.Password = value;
+ break;
+ case "UID" :
+ case "USER ID" :
+ conInfo.Username = value;
+ break;
+ default:
+ throw new Exception("Connection parameter not supported.");
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c
new file mode 100755
index 00000000000..02e4d7d52f8
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c
@@ -0,0 +1,389 @@
+//
+// ociglue.c - provides glue between
+// managed C#/.NET System.Data.OracleClient.dll and
+// unmanaged native c library oci.dll
+// to be used in Mono System.Data.OracleClient as
+// the Oracle 8i data provider.
+//
+// Part of unmanaged C library System.Data.OracleClient.ociglue.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+// Licensed under the MIT/X11 License.
+//
+
+#include "ociglue.h"
+
+/* ------------- Global Variables ---------------------- */
+GSList *conlist = NULL; /* singly linked list of oci_glue_connection_t */
+
+/* ------------- Private Function Prototypes ----------- */
+oci_glue_connection_t *find_connection (ub4 connection_handle);
+GSList *find_connection_node (ub4 connection_handle);
+text *check_error_internal (oci_glue_connection_t *oci_glue_handle, sb4 *errcode);
+
+/* ------------- Public Functions ----------- */
+text *OciGlue_Connect (sword *status, ub4 *connection_handle, sb4 *errcode,
+ char *database, char *username, char *password)
+{
+ oci_glue_connection_t *oci_glue_handle;
+ text *errbuf = NULL;
+
+ if(!connection_handle || !errcode || !database || !username || !password) {
+ return NULL;
+ }
+
+ *errcode = 0;
+
+ *connection_handle = 0;
+
+ oci_glue_handle = g_new(oci_glue_connection_t, 1);
+
+ *connection_handle = (ub4) oci_glue_handle;
+
+ oci_glue_handle->connection_handle = *connection_handle;
+ oci_glue_handle->envhp = (OCIEnv *) 0;
+ oci_glue_handle->errhp = (OCIError *) 0;
+ oci_glue_handle->authp = (OCISession *) 0;
+ oci_glue_handle->srvhp = (OCIServer *) 0;
+ oci_glue_handle->svchp = (OCISvcCtx *) 0;
+ oci_glue_handle->stmthp = (OCIStmt *) 0;
+
+ conlist = g_slist_append (conlist, oci_glue_handle);
+
+ *status = OCIEnvCreate(&(oci_glue_handle->envhp), OCI_DEFAULT, (dvoid *)0,
+ 0, 0, 0, (size_t) 0, (dvoid **)0);
+
+ if(*status != 0) {
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return NULL;
+ }
+
+ *status = OCIHandleAlloc( (dvoid *) (oci_glue_handle->envhp),
+ (dvoid **) &(oci_glue_handle->errhp),
+ OCI_HTYPE_ERROR,
+ (size_t) 0, (dvoid **) 0);
+
+ if(*status != 0) {
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return NULL;
+ }
+
+ /* server contexts */
+ *status = OCIHandleAlloc( (dvoid *) (oci_glue_handle->envhp),
+ (dvoid **) &(oci_glue_handle->srvhp), OCI_HTYPE_SERVER,
+ (size_t) 0, (dvoid **) 0);
+
+ if(*status != 0) {
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return NULL;
+ }
+
+ *status = OCIHandleAlloc( (dvoid *) (oci_glue_handle->envhp),
+ (dvoid **) &(oci_glue_handle->svchp), OCI_HTYPE_SVCCTX,
+ (size_t) 0, (dvoid **) 0);
+
+ if(*status != 0) {
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return NULL;
+ }
+
+ *status = OCIServerAttach(oci_glue_handle->srvhp,
+ oci_glue_handle->errhp, (text *)"", strlen(""), 0);
+
+ if(*status != 0) {
+ errbuf = check_error_internal (oci_glue_handle, errcode);
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return errbuf;
+ }
+
+ *status = OCIAttrSet( (dvoid *) (oci_glue_handle->svchp), OCI_HTYPE_SVCCTX,
+ (dvoid *) (oci_glue_handle->srvhp),
+ (ub4) 0, OCI_ATTR_SERVER,
+ (OCIError *) (oci_glue_handle->errhp));
+
+ if(*status != 0) {
+ errbuf = check_error_internal (oci_glue_handle, errcode);
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return errbuf;
+ }
+
+ *status = OCIHandleAlloc((dvoid *) (oci_glue_handle->envhp),
+ (dvoid **)&(oci_glue_handle->authp),
+ (ub4) OCI_HTYPE_SESSION, (size_t) 0, (dvoid **) 0);
+
+ if(*status != 0) {
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return NULL;
+ }
+
+ *status = OCIAttrSet((dvoid *) oci_glue_handle->authp, (ub4) OCI_HTYPE_SESSION,
+ (dvoid *) username, (ub4) strlen((char *)username),
+ (ub4) OCI_ATTR_USERNAME, oci_glue_handle->errhp);
+
+ if(*status != 0) {
+ errbuf = check_error_internal (oci_glue_handle, errcode);
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return errbuf;
+ }
+
+ *status = OCIAttrSet((dvoid *) oci_glue_handle->authp, (ub4) OCI_HTYPE_SESSION,
+ (dvoid *) password, (ub4) strlen((char *)password),
+ (ub4) OCI_ATTR_PASSWORD, oci_glue_handle->errhp);
+
+ if(*status != 0) {
+ errbuf = check_error_internal (oci_glue_handle, errcode);
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return errbuf;
+ }
+
+ *status = OCISessionBegin ( oci_glue_handle->svchp,
+ oci_glue_handle->errhp,
+ oci_glue_handle->authp,
+ OCI_CRED_RDBMS,
+ (ub4) OCI_DEFAULT);
+
+ if(*status != 0) {
+ errbuf = check_error_internal (oci_glue_handle, errcode);
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return errbuf;
+ }
+
+ *status = OCIAttrSet((dvoid *) (oci_glue_handle->svchp),
+ (ub4) OCI_HTYPE_SVCCTX,
+ (dvoid *) (oci_glue_handle->authp), (ub4) 0,
+ (ub4) OCI_ATTR_SESSION,
+ oci_glue_handle->errhp);
+
+ if(*status != 0) {
+ errbuf = check_error_internal (oci_glue_handle, errcode);
+ OciGlue_Disconnect (*connection_handle);
+ *connection_handle = 0;
+ return errbuf;
+ }
+
+ return errbuf;
+}
+
+sword OciGlue_PrepareAndExecuteNonQuerySimple (ub4 connection_handle,
+ text *sqlstmt, ub4 *found)
+{
+ sword status = 0;
+ oci_glue_connection_t *oci_glue_handle;
+ void *node;
+ GSList *con_node;
+
+ if(!conlist)
+ return -1;
+
+ if(connection_handle == 0)
+ return -2;
+
+ if(!found)
+ return -1;
+
+ *found = 0;
+
+ oci_glue_handle = find_connection (connection_handle);
+
+ if(!oci_glue_handle)
+ return -1;
+ else
+ *found = oci_glue_handle->connection_handle;
+
+ if(!(oci_glue_handle->stmthp)) {
+ status = OCIHandleAlloc((dvoid *) (oci_glue_handle->envhp),
+ (dvoid **) &(oci_glue_handle->stmthp),
+ (ub4)OCI_HTYPE_STMT, (CONST size_t) 0, (dvoid **) 0);
+
+ if(status != 0)
+ return status;
+ }
+
+ status = OCIStmtPrepare((oci_glue_handle->stmthp),
+ oci_glue_handle->errhp,
+ (CONST OraText *)sqlstmt, (ub4)strlen(sqlstmt),
+ (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
+
+ if(status != 0)
+ return status;
+
+ status = OCIStmtExecute(oci_glue_handle->svchp,
+ oci_glue_handle->stmthp,
+ oci_glue_handle->errhp,
+ (ub4) 1, (ub4) 0,
+ (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
+
+ return status;
+}
+
+sword OciGlue_Disconnect (ub4 connection_handle)
+{
+ sword status = -1;
+
+ GSList *node = NULL;
+ oci_glue_connection_t *oci_glue_handle = NULL;
+
+ if(connection_handle == 0)
+ return -2;
+
+ if(conlist == NULL)
+ return -2;
+
+ oci_glue_handle = find_connection (connection_handle);
+
+ if(oci_glue_handle) {
+
+ if(oci_glue_handle->svchp && oci_glue_handle->errhp && oci_glue_handle->authp)
+ status = OCISessionEnd(oci_glue_handle->svchp,
+ oci_glue_handle->errhp, oci_glue_handle->authp, (ub4) 0);
+
+ if(oci_glue_handle->srvhp && oci_glue_handle->errhp)
+ status = OCIServerDetach(oci_glue_handle->srvhp, oci_glue_handle->errhp,
+ (ub4) OCI_DEFAULT);
+
+ if (oci_glue_handle->srvhp)
+ status = OCIHandleFree((dvoid *) oci_glue_handle->srvhp, (ub4) OCI_HTYPE_SERVER);
+
+ if (oci_glue_handle->svchp)
+ status = OCIHandleFree((dvoid *) oci_glue_handle->svchp, (ub4) OCI_HTYPE_SVCCTX);
+
+ if (oci_glue_handle->errhp)
+ status = OCIHandleFree((dvoid *) oci_glue_handle->errhp, (ub4) OCI_HTYPE_ERROR);
+
+ if (oci_glue_handle->authp)
+ status = OCIHandleFree((dvoid *) oci_glue_handle->authp, (ub4) OCI_HTYPE_SESSION);
+
+ if (oci_glue_handle->stmthp)
+ status = OCIHandleFree((dvoid *) oci_glue_handle->stmthp, (ub4) OCI_HTYPE_STMT);
+
+ if (oci_glue_handle->envhp)
+ status = OCIHandleFree((dvoid *) oci_glue_handle->envhp, (ub4) OCI_HTYPE_ENV);
+
+ }
+ node = find_connection_node (connection_handle);
+ if(node) {
+ conlist = g_slist_remove_link (conlist, node);
+ g_slist_free_1 (node);
+ node = NULL;
+ }
+ if(oci_glue_handle) {
+ g_free (oci_glue_handle);
+ oci_glue_handle = NULL;
+ }
+
+ status = 0;
+
+ return status;
+}
+
+guint OciGlue_ConnectionCount ()
+{
+ return g_slist_length (conlist);
+}
+
+text *OciGlue_CheckError (sword status, ub4 connection_handle)
+{
+ oci_glue_connection_t *oci_glue_handle = NULL;
+ text *errbuf;
+ sb4 errcode = 0;
+ size_t errbuf_size;
+
+ if(!conlist)
+ return NULL;
+
+ if(connection_handle == 0)
+ return NULL;
+
+ oci_glue_handle = find_connection (connection_handle);
+
+ if(!oci_glue_handle)
+ return NULL;
+
+ errbuf_size = sizeof(text) * 512;
+ errbuf = (text *) g_malloc(errbuf_size);
+
+ OCIErrorGet((dvoid *)(oci_glue_handle->errhp),
+ (ub4) 1, (text *) NULL, &errcode,
+ errbuf, (ub4) errbuf_size, OCI_HTYPE_ERROR);
+
+ return errbuf;
+}
+
+void OciGlue_Free (void *obj)
+{
+ g_free(obj);
+}
+
+/* ------------- Private Functions ----------- */
+
+text *check_error_internal (oci_glue_connection_t *oci_glue_handle, sb4 *errcode)
+{
+ text* errbuf = NULL;
+ size_t errbuf_size;
+
+ if(!oci_glue_handle)
+ return NULL;
+ if(!errcode)
+ return NULL;
+
+ errbuf_size = sizeof(text) * 512;
+ errbuf = (text *) g_malloc(errbuf_size);
+
+ OCIErrorGet((dvoid *)(oci_glue_handle->errhp),
+ (ub4) 1, (text *) NULL, errcode,
+ errbuf, (ub4) errbuf_size, OCI_HTYPE_ERROR);
+
+ return errbuf;
+}
+
+GSList *find_connection_node (ub4 connection_handle)
+{
+ GSList *node = NULL;
+ oci_glue_connection_t *oci_glue_handle = NULL;
+
+ for(node = conlist;
+ node;
+ node = node->next) {
+
+ oci_glue_handle = (oci_glue_connection_t *) node->data;
+ if(oci_glue_handle->connection_handle == connection_handle)
+ return node;
+ }
+ return NULL;
+}
+
+oci_glue_connection_t *find_connection (ub4 connection_handle)
+{
+ GSList *node = NULL;
+ oci_glue_connection_t *oci_glue_handle = NULL;
+
+ for(node = conlist;
+ node;
+ node = node->next) {
+
+ oci_glue_handle = (oci_glue_connection_t *) node->data;
+ if(oci_glue_handle->connection_handle == connection_handle)
+ return oci_glue_handle;
+ }
+ return NULL;
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h
new file mode 100755
index 00000000000..3f91dbe0c94
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h
@@ -0,0 +1,55 @@
+//
+// ociglue.c - provides glue between
+// managed C#/.NET System.Data.OracleClient.dll and
+// unmanaged native c library oci.dll
+// to be used in Mono System.Data.OracleClient as
+// the Oracle 8i data provider.
+//
+// Part of unmanaged C library System.Data.OracleClient.ociglue.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+// Licensed under the MIT/X11 License.
+//
+
+#ifndef __MONO_OCIGLUE_LIB_H__
+#define __MONO_OCIGLUE_LIB_H__
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <oci.h>
+
+struct _oci_glue_connection_t
+{
+ ub4 connection_handle;
+
+ OCIEnv *envhp;
+ OCIError *errhp;
+ OCISession *authp;
+ OCIServer *srvhp;
+ OCISvcCtx *svchp;
+ OCIStmt *stmthp;
+};
+
+typedef struct _oci_glue_connection_t oci_glue_connection_t;
+
+text *OciGlue_Connect (sword *status, ub4 *connection_handle, sb4 *errcode, char *database, char *username, char *password);
+sword OciGlue_PrepareAndExecuteNonQuerySimple (ub4 connection_handle, text *sqlstmt, ub4 *found);
+sword OciGlue_Disconnect (ub4 connection_handle);
+guint OciGlue_ConnectionCount ();
+CONST text *OciGlue_CheckError (sword status, ub4 connection_handle);
+void OciGlue_Free (void *obj);
+
+#endif /* __MONO_OCIGLUE_H__ */
+
diff --git a/mcs/class/System.Data.OracleClient/Test/Test.csproj b/mcs/class/System.Data.OracleClient/Test/Test.csproj
new file mode 100755
index 00000000000..e70b91c7811
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/Test/Test.csproj
@@ -0,0 +1,93 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{2A30C592-6B73-48E0-9640-A0DE8CA3C02F}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Exe"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.XML"
+ HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "MonoOracleClient"
+ Project = "{799D520E-73ED-43A1-91FD-81D64C32A6F0}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "TestOracleClient.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Data.OracleClient/Test/Test.csproj.user b/mcs/class/System.Data.OracleClient/Test/Test.csproj.user
new file mode 100755
index 00000000000..e31ed2b1364
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/Test/Test.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Data.OracleClient/Test/TestOracleClient.cs b/mcs/class/System.Data.OracleClient/Test/TestOracleClient.cs
new file mode 100755
index 00000000000..e83c4c54cf9
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/Test/TestOracleClient.cs
@@ -0,0 +1,146 @@
+//
+// TestOracleClient.cs - Tests Sytem.Data.OracleClient
+// data provider in Mono.
+//
+// Part of managed C#/.NET library System.Data.OracleClient.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Tests:
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Data.OracleClient;
+
+namespace Test.OracleClient
+{
+ public class OracleTest
+ {
+ public OracleTest()
+ {
+
+ }
+
+ static void DoTest1(OracleConnection con, int conn)
+ {
+ string inst = conn.ToString();
+
+ string insertSql =
+ "insert into scott.emp " +
+ "(empno, ename, job, sal, deptno) " +
+ "values(123" + inst + "," +
+ "'conn" + inst + "'," +
+ "'homy" + inst + "'," +
+ "321" + inst + ",20)";
+
+ Console.WriteLine("insertSql: " + insertSql);
+ OracleCommand cmd = new OracleCommand();
+ cmd.Connection = con;
+
+ cmd.CommandText = insertSql;
+ cmd.ExecuteNonQuery();
+
+ if(conn == 2)
+ cmd.CommandText = "rollback";
+ else
+ cmd.CommandText = "commit";
+ cmd.ExecuteNonQuery();
+ }
+
+ static void DoTest9(OracleConnection con) {
+ string inst = "9";
+
+ string insertSql =
+ "insert into scott.emp " +
+ "(empno, ename, job, sal, deptno) " +
+ "values(123" + inst + "," +
+ "'conn" + inst + "'," +
+ "'homy" + inst + "'," +
+ "321" + inst + ",20)";
+
+ Console.WriteLine("insertSql: " + insertSql);
+ OracleCommand cmd = new OracleCommand();
+ cmd.Connection = con;
+
+ cmd.CommandText = insertSql;
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = "commit";
+ cmd.ExecuteNonQuery();
+ }
+
+ static void ConnectionCount() {
+ uint count = OracleConnection.ConnectionCount;
+ string msg = "Connection Count: " + count.ToString();
+ Console.WriteLine(msg);
+ }
+
+ static void Wait(string msg)
+ {
+ Console.WriteLine(msg);
+ Console.WriteLine("Waiting... Presee Enter to continue...");
+ string nothing = Console.ReadLine();
+ }
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ string connectionString;
+ connectionString =
+ "Data Source=dansdb;" +
+ "User ID=scott;" +
+ "Password=tiger";
+
+ Wait("Verify database.");
+
+ ConnectionCount(); // should be 0
+
+ OracleConnection con1 = new OracleConnection();
+ con1.ConnectionString = connectionString;
+ con1.Open();
+ ConnectionCount(); // should be 1
+
+ OracleConnection con2 = new OracleConnection();
+ con2.ConnectionString = connectionString;
+ con2.Open();
+ ConnectionCount(); // should be 2
+
+ OracleConnection con3 = new OracleConnection();
+ con3.ConnectionString = connectionString;
+ con3.Open();
+ ConnectionCount(); // should be 3
+
+ Wait("Verify Connected.");
+
+ DoTest1(con1, 1);
+ DoTest1(con2, 2);
+ DoTest1(con3, 3);
+
+ DoTest9(con1);
+
+ Wait("Verify Proper Results.");
+
+ ConnectionCount(); // should be 3
+
+ con1.Close();
+ ConnectionCount(); // should be 2
+
+ con2.Close();
+ ConnectionCount(); // should be 1
+
+ con3.Close();
+ ConnectionCount(); // should be 0
+
+ Wait("Verify Disconnected");
+ }
+ }
+}
diff --git a/mcs/class/System.Data.OracleClient/list b/mcs/class/System.Data.OracleClient/list
new file mode 100755
index 00000000000..af6ec7d2ec2
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/list
@@ -0,0 +1,3 @@
+System.Data.OracleClient/OciGlue.cs
+System.Data.OracleClient/OracleConnection.cs
+System.Data.OracleClient/OracleCommand.cs \ No newline at end of file
diff --git a/mcs/class/System.Data.OracleClient/makefile.gnu b/mcs/class/System.Data.OracleClient/makefile.gnu
new file mode 100755
index 00000000000..6951f66023c
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/makefile.gnu
@@ -0,0 +1,14 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.Data.OracleClient.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.Data
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Data/.cvsignore b/mcs/class/System.Data/.cvsignore
new file mode 100644
index 00000000000..0e3f75b9676
--- /dev/null
+++ b/mcs/class/System.Data/.cvsignore
@@ -0,0 +1,6 @@
+.makefrag
+.response
+System.Data.dll
+library-deps.stamp
+Temp
+tmp
diff --git a/mcs/class/System.Data/ChangeLog b/mcs/class/System.Data/ChangeLog
new file mode 100644
index 00000000000..e2250bb21a2
--- /dev/null
+++ b/mcs/class/System.Data/ChangeLog
@@ -0,0 +1,2578 @@
+2003-01-17 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient.SqlConnection.cs: add connection
+ parameter UID which is the same thing as User ID
+
+2003-01-13 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs: lots of bugfixes and more implemented
+ methods.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added System.Data/DataTablePropertyDescriptor.cs
+
+2002-12-27 Ville Palo <vi64pa@koti.soon.fi>
+
+ * list: Added System.Data/XmlDataLoader.cs
+
+2002-12-16 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs: Now rollback works. It means all
+ types of transactions works, i guess ;)
+
+2002-12-14 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs: Adding row via XmlDataDocument to
+ DataSet's datatable is now possible.
+
+2002-12-11 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs: Implemented GetRowFromElement() and
+ GetElementFromRowElement () -methods. Somefixed and little clean up.
+
+2002-12-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Data.SqlClient/SqlCommand.cs:
+ (CloseReader): don't get the output parameters here.
+ (GetOutputParameters): don't skip the stream. The parameters will be
+ there.
+
+ * System.Data.SqlClient/SqlConnection.cs: don't try to execute
+ 'sp_reset_connection'.
+
+ * System.Data.SqlClient/SqlDataReader.cs: get the output parameters
+ after the end of the results.
+
+2002-12-04 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs: Now this works in both ways,
+ DataSet <--> XmlDataDocument.cs at some level at least.
+
+2002-12-02 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs : some fixes and some imlemented
+ methods.
+
+2002-12-01 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Change to reflect TdsSchemaInfo -> TdsDataColumnCollection
+ shift.
+
+2002-12-01 Ville Palo <vi64pa@koti.soon.fi>
+
+ * list: Added XmlDataDocument.cs
+ * System.Xml/XmlDataDocument.cs: more implementation.
+
+2002-11-30 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.Odbc/OdbcDataReader.cs: implemented GetValues() method
+ needed by OdbcDataAdapter
+
+ * System.Data.Odbc/OdbcDataAdapter.cs
+ * System.Data.Odbc/OdbcRowUpdatedEventArgs.cs
+ * System.Data.Odbc/OdbcRowUpdatedEventHandler.cs
+ * System.Data.Odbc/OdbcRowUpdatingEventArgs.cs
+ * System.Data.Odbc/OdbcRowUpdatingEventHandler.cs: added files for an
+ ODBC Data Adapter
+
+ * list: added new files to linux build
+ in namespace System.Data.Odbc for the ODBC Data Adapter
+
+ * System.Xml/XmlDataDocument.cs: commented method
+ protected internal override XPathNavigator CreateNavigator(XmlNode node)
+ because it would not compile on .NET Framework. Added
+ a FIXME comment there
+
+2002-11-29 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocument.cs: Started to implement.
+
+2002-11-26 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlCommand.cs:
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlDataReader.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ Many changes around restructuring of parameter
+ information so that the Sybase provider supports
+ PREPAREs too.
+
+2002-11-25 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data/DataSet.cs : Started to implement ReadXmlSchema -method
+
+2002-11-21 Tim Coleman <tim@timcoleman.com>
+ * System.Data.build:
+ * System.Data.SqlClient/SqlCommand.cs:
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlConnectionPool.cs:
+ * System.Data.SqlClient/SqlDataReader.cs:
+ * System.Data.SqlClient/SqlException.cs:
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ * System.Data.SqlClient/SqlXmlTextReader.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ Modify to accept new Mono.Data.Tds.Protocol
+ namespace in Mono.Data.Tds assembly, replacing
+ Mono.Data.TdsClient.Internal
+
+2002-11-20 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlDecimal.cs: Ported some divide-stuff from
+ decimal.c file. Does not work correctly yet.
+
+2002-11-18 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlConnection.cs:
+ BeginTransaction bug.
+ * System.Data.SqlClient/SqlParameter.cs:
+ Add some comments to describe what is going on.
+ * System.Data.SqlClient/SqlCommand.cs:
+ Add a TODO.
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Add support to get SQL Types
+
+2002-11-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataView.cs: fix bug
+ with DataViewEnumerator causing InvalidOperationException
+ on the last item
+
+2002-11-15 Tim Coleman <tim@timcoleman.com>
+ * System.Data.Common/DbDataPermission.cs:
+ * System.Data.SqlClient/SqlClientPermission.cs:
+ Make these agree on the class status page.
+ * System.Data.SqlClient/SqlCommand.cs:
+ - Fix up handling of GUID and [Var]Binary, and Image types
+ * System.Data.SqlClient/SqlParameter.cs:
+ - Provide support for conversion between Type,
+ DbType, SqlDbType, and the SQL server type names.
+ - Fix up handling of GUID and [Var]Binary types
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ Correct all of the Add methods.
+ * Test/SqlTest.cs:
+ - Add more types to test: unique identifier, binary,
+ image, smalldatetime, money, smallmoney, timestamp
+
+2002-11-14 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataColumnPropertyDescriptor.cs
+ * System.Data/DataRowView.cs
+ * System.Data/DataView.cs
+ * System.Data.Common/DbDataRecord.cs: a little bit more
+ implementation for data binding purposes
+
+ * Test/PostgresTest.cs
+ * Test/TestSqlDataAdapter.cs
+ * Test/TestSqlException.cs
+ * TestSqlParameters.cs: fixed test for PostgreSQL's new home
+ at Mono.Data.PostgreSqlClient
+
+2002-11-14 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlCommand.cs:
+ Slight reformatting of Bit values and sql statements
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Implement RecordsAffected
+ Complete SchemaTable
+ * System.Data.SqlClient/SqlParameter.cs:
+ Propertly support Char/NChar
+ * System.Data.SqlClient/SqlXmlTextReader.cs:
+ Add Close () to the Dispose () method
+
+2002-11-13 Tim Coleman <tim@timcoleman.com>
+ * Test/SqlTest.cs:
+ New class added for testing SqlClient
+ * System.Data.SqlClient/SqlCommand.cs:
+ Add handling for SqlDbType.Bit
+ * System.Data.SqlClient/SqlConnection.cs:
+ Implement Dispose () methods.
+ Change ConnectionString setter
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Implement Dispose () methods.
+ Set RecordsAffected to -1 by default. Need to
+ set this correctly in the future.
+ * System.Data.SqlClient/SqlCommandBuilder.cs:
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ * System.Data.SqlClient/SqlXmlTextReader.cs:
+ Implement Dispose () methods.
+
+2002-11-12 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Remove Mono.Data.TdsClient.Internal/TdsContext.cs
+ * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs:
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
+ Complete these classes
+ * System.Data.Common/DbDataAdapter.cs:
+ Experimental support for FillSchema ()
+
+2002-11-11 Tim Coleman <tim@timcoleman.com>
+ * System.Data/ResDescriptionAttribute.cs:
+ * list
+ New internal class added
+ * System.Data/Constraint.cs:
+ * System.Data/ConstraintCollection.cs:
+ * System.Data/DBConcurrencyException.cs:
+ * System.Data/DataColumn.cs:
+ * System.Data/DataColumnCollection.cs:
+ * System.Data/DataRelation.cs:
+ * System.Data/DataRelationCollection.cs:
+ * System.Data/DataRow.cs:
+ * System.Data/DataRowBuilder.cs:
+ * System.Data/DataRowBuilder.cs:
+ * System.Data/DataRowCollection.cs:
+ * System.Data/DataSet.cs:
+ * System.Data/DataTable.cs:
+ * System.Data/DataTableCollection.cs:
+ * System.Data/DataView.cs:
+ * System.Data/DataViewManager.cs:
+ * System.Data/DataViewSetting.cs:
+ * System.Data/DataViewSettingCollection.cs:
+ * System.Data/ForeignKeyConstraint.cs:
+ * System.Data/ForeignKeyConstraint.cs:
+ * System.Data/InternalDataCollectionBase.cs:
+ * System.Data/MergeFailedEventArgs.cs:
+ * System.Data/StrongTypingException.cs:
+ * System.Data/TypeDataSetGeneratorException.cs:
+ * System.Data/UniqueConstraint.cs:
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataTableMapping.cs:
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataAdapter.cs:
+ * System.Data.Common/DbDataPermission.cs:
+ * System.Data.Common/DbDataPermissionAttribute.cs:
+ * System.Data.Common/DbEnumerator.cs:
+ * System.Data.SqlClient/SqlCommand.cs:
+ * System.Data.SqlClient/SqlCommandBuilder.cs:
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ Add missing attributes, methods, properties based on information
+ from System.Data class status page on go-mono.com.
+
+
+2002-11-10 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlString.cs: Now all methods are implemented
+
+2002-11-09 Tim Coleman <tim@timcoleman.com>
+ * list:
+ * System.Data/DataCategoryAttribute.cs:
+ Add new attribute based on corcompare
+
+2002-11-09 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbDataAdapter.cs: cleaned up implementation,
+ based on the PgSql/SqlClient data adapter classes.
+
+2002-11-09 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add new internal tds classes
+ * System.Data.Common/DbDataAdapter.cs:
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ Change event calling system
+ * System.Data.SqlClient/SqlClientPermission.cs:
+ * System.Data.SqlClient/SqlClientPermissionAttribute.cs:
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Add comments
+ * System.Data.SqlClient/SqlCommand.cs:
+ Some changes to make consistent with .NET based on Sql server traces
+ Implement command timeout
+ * System.Data.SqlClient/SqlCommandBuilder.cs:
+ Make sure that we only build a command if key info found
+ * System.Data.SqlClient/SqlConnection.cs:
+ Change event calling system
+ Some changes to make consistent with .NET based on Sql server traces
+ Implement connection timeout
+ * System.Data.SqlClient/SqlConnectionPool.cs:
+ Implement connection timeout
+ * System.Data.SqlClient/SqlError.cs:
+ Implement ToString ()
+ * System.Data.SqlClient/SqlException.cs:
+ Mucho implementation and cleanup
+ * System.Data.SqlClient/SqlParameter.cs:
+ Implement Clone ()
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ Code cleanup
+ * System.Data.SqlClient/SqlTransaction.cs:
+ Move some of the transaction creation to SqlConnection to be consistent
+ with .NET SQL traces
+
+2002-11-08 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataRow.cs:
+ * System.Data/DataTable.cs:
+ Some fix-ups related to the DbDataAdapter to make it work.
+ * System.Data.Common/DbDataAdapter.cs:
+ Fix the Fill () and Update () methods. These now work
+ fairly well. Need mucho testing.
+ * System.Data.SqlClient/SqlCommandBuilder.cs:
+ Support table mappings and parameter source versions now.
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ Add set accessor for transaction so that SqlTransaction.Commit ()
+ will remove itself from the connection.
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ Update/Insert/Delete command should be null by default.
+ * System.Data.SqlClient/SqlException.cs:
+ Remove a TODO attribute
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
+ Properly handle the SqlCommand object
+
+2002-11-08 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlDateTime.cs: Now the all methods are
+ implemented.
+
+2002-11-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Data.SqlTypes/SqlDecimal.cs: fixed build. Someone should check
+ my comments and do something more appropiate.
+
+2002-11-07 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/SqlMoney.cs:
+ * System.Data.SqlTypes/SqlSingle.cs:
+ * System.Data.SqlTypes/SqlString.cs: Implemented more methods and
+ fixed some. SqlBoolean Equals (object value) -method improvements to
+ all classes.
+
+2002-11-07 Tim Coleman <tim@timcoleman.com>
+ * System.Data.Common/DbDataAdapter.cs:
+ Remove NotImplementedException in Dispose
+ * System.Data.Common/FieldNameLookup.cs:
+ Should be sealed
+ * System.Data.SqlClient/SqlCommand.cs:
+ Fix CommandText accessor (stack overflow)
+ Implement DeriveParameters method
+ * System.Data.SqlClient/SqlCommandBuilder.cs:
+ Implement this class
+ * System.Data.SqlClient/SqlConnection.cs:
+ Change application name to "Mono SqlClient Data Provider"
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Add new schema information
+ * System.Data.SqlClient/SqlError.cs:
+ * System.Data.SqlClient/SqlErrorCollection.cs:
+ Remove internal methods, TODO attributes
+ * System.Data.SqlClient/SqlParameter.cs:
+ Add new internal constructor for DeriveParameters use
+ * System.Data.SqlClient/SqlParameterConverter.cs:
+ Add missing methods based on class status
+
+2002-11-07 Nick Drochak <ndrochak@gol.com>
+ * list: add System.Data/ColumnDataPropertyDescriptor.cs
+
+2002-11-04 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add Mono.Data.TdsClient.Internal.TdsInternalError
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorCollection
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventHandler
+ Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventArgs
+ Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventHandler
+ Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventArgs
+ Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResult
+ Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResultCollection
+ Remove Mono.Data.TdsClient.Internal.TdsPacketMessageResult
+ * System.Data.Common/RowUpdatedEventArgs.cs:
+ * System.Data.Common/RowUpdatingEventArgs.cs:
+ Implement
+ * System.Data.SqlClient/SqlCommand.cs:
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Remove checks for errors. These are now handled by events
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlError.cs:
+ * System.Data.SqlClient/SqlException.cs:
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs:
+ Add event handlers and triggers for errors, messages, state change
+ * System.Data.SqlClient/SqlParameter.cs:
+ Re-add refreshproperties
+ * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs:
+ * System.Data.SqlClient/SqlRowUpdatedEventHandler.cs:
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
+ * System.Data.SqlClient/SqlRowUpdatingEventHandler.cs:
+ Implement
+
+2002-11-04 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add Mono.Data.TdsClient.Internal.TdsBigDecimal
+ Add System.Data.SqlClient.SqlParameterConverter
+ Add System.Data.DataSysDescriptionAttribute
+ * System.Data/DataSysDescriptionAttribute.cs:
+ New class added
+ * System.Data.Common/DbDataPermission.cs:
+ Add CreateInstance method
+ * System.Data.SqlClient/SqlClientPermission.cs:
+ * System.Data.SqlClient/SqlError.cs:
+ Add Serializable attribute
+ * System.Data.SqlClient/SqlCommand.cs:
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ Add some missing property attributes
+ * System.Data.SqlClient/SqlCommandBuilder.cs:
+ Add some missing property attributes
+ Implement properties
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Implement missing methods
+ * System.Data.SqlClient/SqlErrorCollection.cs:
+ Implement the properties
+ * System.Data.SqlClient/SqlException.cs:
+ Remove extra property accessors
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs:
+ Add internal constructor
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ Add internal constructor
+ Add property attributes
+ * System.Data.SqlClient/SqlParameterConverter.cs:
+ New internal class added
+ * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs:
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
+ Remove destructor
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ Add implicit conversion from TdsBigDecimal to SqlDecimal
+ * System.Data.SqlTypes/SqlString.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ Change code to remove compiler warnings
+
+2002-11-04 Stuart Caborn <stuart.caborn@clearswift.com>
+
+ * list: added System.Data/XmlConstants.cs to
+ Linux build
+
+ * System.Data/XmlConstants.cs: added -
+ * System.Data/DataTable.cs
+ * System.Data/DataSet.cs
+ * System.Data/DataColumn.cs
+ * System.Data/DataColumnCollection.cs
+ * System.Data/DataRelation.cs: modified -
+ Began initial implementation of WriteXml
+ and WriteXmlSchema. There is no support for DiffGrams
+ yet. In WriteSchema mode, relationships are missing,
+ all types are xs:string and the namespacing is not
+ working properly. Added support for Ordinals in the
+ DataColumnCollection and added support for
+ namespaces and prefixes.
+
+2002-11-03 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlBinary.cs: Finished and no errors generated
+ by NUnitConsole_mono.exe
+
+2002-11-03 Tim Coleman (tim@timcoleman.com)
+ * System.Data.SqlClient/SqlCommand.cs:
+ Use SET NO_BROWSETABLE ON when CommandBehavior is KeyInfo
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Get more schema info if available
+ * list:
+ Add Mono.Data.TdsClient.Internal.TdsColumnStatus
+
+2002-11-02 Tim Coleman (tim@timcoleman.com)
+ * System.Data.SqlClient/SqlCommand.cs:
+ Change to use sp_executesql to run regular text queries.
+ Now, sp_executesql for text, sp_execute for prepared,
+ and execute for SPs means everything runs a procedure.
+ * System.Data.SqlClient/SqlParameter.cs:
+ Allow client to set parameter name in Prepare ()
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ Implement some methods
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Since everything is an SP now, we know that when
+ we see DoneProc, that we are really done.
+
+2002-11-01 Tim Coleman (tim@timcoleman.com) :
+ * System.Data.Common/DbEnumerator.cs :
+ Throw correct exception on Reset ()
+ Add ColumnSize to schema table.
+ * System.Data.SqlClient/SqlDataReader.cs :
+ Add ColumnSize to schema table.
+ * System.Data.SqlClient/SqlCommand.cs :
+ Change the way that preparing is handled.
+ Now uses sp_prepare on the server instead of temp
+ stored procedures because it's the Right Thing[tm] to do.
+ * System.Data.SqlClient/SqlConnection.cs :
+ Store data readers here rather than in command
+ * System.Data.SqlClient/SqlDataReader.cs :
+ More implementation, including binary types
+ * System.Data.SqlClient/SqlParameter.cs :
+ Lowercase type name
+
+2002-10-31 Tim Coleman (tim@timcoleman.com)
+ * System.Data.Common/DbDataAdapter.cs :
+ Fix handling of nulls
+ * System.Data.Common/DbDataRecord.cs :
+ Change GetFieldType ()
+ * System.Data.Common/DbEnumerator.cs :
+ Add new schema information
+ * System.Data.Common/FieldNameLookup.cs :
+ Change definition of schema
+ * System.Data.Common/SchemaInfo.cs :
+ Add more information
+ * System.Data.SqlClient/SqlDataReader.cs :
+ get more schema table data
+ * list :
+ Add Mono.Data.TdsClient.Internal.TdsSchemaInfo
+
+2002-10-31 Ville Palo <vi64pa@koti.soon.fi>
+
+ * SqlBinary.cs:
+ * SqlBoolean.cs:
+ * SqlByte.cs:
+ * SqlDecimal.cs:
+ * SqlDouble.cs:
+ * SqlInt16.cs:
+ * SqlInt64.cs:
+ * SqlString.cs: Some bugfixes and some TODOs but so much
+ work to do.
+
+2002-10-30 Tim Coleman (tim@timcoleman.com)
+ * System.Data.Common/FieldNameLookup.cs:
+ * System.Data.Common/SchemaInfo.cs:
+ * System.Data.SqlClient/SqlXmlTextReader.cs:
+ New classes added
+ * list :
+ Class list changed in build
+ * System.Data.SqlClient/SqlCommand.cs:
+ Added support for command behaviors
+ Refactored a bunch of code
+ Implement ExecuteScalar
+ Implement ExecuteXmlReader
+ * System.Data.SqlClient/SqlConnection.cs:
+ Moved CheckForErrors here
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ Code reformatting
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Implement GetEnumerator
+ Fix NextResult, Read
+ Add SqlDataReaderEnumerator private class
+ * System.Data.SqlClient/SqlParameter.cs:
+ Move some of the Prepare code from SqlCommand to here
+ * System.Data.SqlClient/SqlTransaction.cs:
+ Move error checking to SqlConnection
+
+2002-10-29 Tim Coleman (tim@timcoleman.com)
+ * System.Data.SqlClient/SqlCommand.cs:
+ Added code to handle parameters for queries
+ * System.Data.SqlClient/SqlConnection.cs:
+ Properly handle resetting SqlConnections
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Properly handle the case where no results are returned
+ * System.Data.SqlClient/SqlParameter.cs:
+ Default direction to Input
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ Implement GetEnumerator
+
+2002-10-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * makefile.gnu: added Test directory.
+
+2002-10-29 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlGuid.cs: Fixed some bugs and finished
+ couple of MonoTODOs.
+
+2002-10-28 Tim Coleman (tim@timcoleman.com)
+ * System.Data.SqlClient/SqlCommand.cs:
+ Add some error handling
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Add some error handling
+ Add precision/scale to schema table
+ * System.Data.SqlClient/SqlException.cs:
+ Generate a SqlException from TDS error
+ collection
+ * System.Data.SqlClient/SqlTransaction.cs:
+ Add some error handling
+
+
+2002-10-28 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/Money.cs:
+ * System.Data.SqlTypes/SqlSingle.cs:
+ * System.Data.SqlTypes/SqlString.cs:
+ * System.Data.SqlTypes/SqlSingle.cs: Fixed internal loop bugs and
+ some other minor fixes.
+
+2002-10-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbDataAdapter.cs (Fill, FillSchema,
+ GetFillParameters, Update): added overloaded methods.
+
+ * System.Data.OleDb/OleDbCommand.cs:
+ * System.Data.OleDb/OleDbDataReader.cs:
+ * System.Data.OleDb/OleDbConnection.cs: removed limitation of one
+ data adapter at a time. Mono's version can open as many as you want,
+ for free.
+
+2002-10-25 Tim Coleman (tim@timcoleman.com)
+ * System.Data.SqlClient/SqlConnectionPool.cs:
+ New class added
+ * System.Data.SqlClient/SqlClientPermission.cs:
+ * System.Data.SqlClient/SqlClientPermissionAttribute.cs:
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs:
+ * System.Data.SqlClient/SqlInfoMessageEventHandler.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ Code reformatting
+ * System.Data.SqlClient/SqlCommand.cs:
+ * System.Data.SqlClient/SqlConnection.cs:
+ * System.Data.SqlClient/SqlException.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ New code based on work in TDS Client
+ * list:
+ New files added for SqlClient, and TdsClient.Internal
+ * System.Data.build:
+ Added reference to System.EnterpriseServices.dll
+ Still leave SqlClient out of build until danmorg
+ can fix.
+
+2002-10-23 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlSingle.cs: Finished
+
+2002-10-23 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlInt64.cs: Finished.
+
+2002-10-21 Rodrigo Moya <rodrigo@ximian.com>
+
+ * list: removed libodbchelper.cs file, which has been removed.
+
+2002-10-16 Tim Coleamn <tim@timcoleman.com>
+ * list:
+ * System.Data.build:
+ Exclude compiling of System.Data.SqlClient in
+ preparation for overhauls of that system.
+
+2002-10-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * ParmUtil.cs
+ * PostgresLibrary.cs
+ * PostgresTypes.cs
+ * SqlClientPermission.cs
+ * SqlClientPermissionAttribute.cs
+ * SqlCommand.cs
+ * SqlCommandBuilder.cs
+ * SqlConnection.cs
+ * SqlDataAdapter.cs
+ * SqlDataReader.cs
+ * SqlError.cs
+ * SqlErrorCollection.cs
+ * SqlException.cs
+ * SqlInfoMessageEventArgs.cs
+ * SqlInfoMessageEventHandler.cs
+ * SqlParameter.cs
+ * SqlParameterCollection.cs
+ * SqlRowUpdatedEventArgs.cs
+ * SqlRowUpdatedEventHandler.cs
+ * SqlRowUpdatingEventArgs.cs
+ * SqlRowUpdatingEventHandler.cs
+ * SqlTransaction.cs: thanks to Miguel de Icaza, he
+ copied files on the mono cvs server
+ from mcs/class/System.Data/System.Data.SqlClient
+ for the PostgreSQL provider
+ to mcs/class/Mono.Data.PostgreSqlClient.
+ This frees up
+ mcs/class/System.Data/System.Data.SqlClient for
+ the Microsoft SQL Server provider.
+ Any Mono.Data.PostgreSqlClient/Sql*.cs files
+ were copied on the cvs server
+ to Mono.Data.PostgreSqlClient/PgSql*.cs files
+ and the old Mono.Data.PostgreSqlClient/Sql*.cs
+ files were removed. Copying, renaming, and removing
+ was done on the cvs server so we could keep
+ the cvs change history.
+
+2002-10-15 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.OleDb/libgda.cs: added more functions
+ to platfrom invoke into shared library libgda
+
+ * System.Data.OleDb/OleDbDataReader.cs: implemented
+ GetSchemaTable() and GetFieldType()
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataRow.cs: don't throw exception
+ if DBNull is false. Had to do comment this line
+ to allow a typeof(Type).
+
+ * System.Data.SqlClient/SqlCommand.cs: the "DataType"
+ DataColumn and DataRows in a DataTable for a schema should
+ be typeof Type, not string. This is to make it
+ compatible with MS.NET
+
+ * System.Data.SqlClient/SqlConnection.cs: the
+ isolation level should be set before
+ beginning the transaction
+
+ * Test/SqlSharpCli.cs: change string to Type for
+ "DataType" from a DataRow in a DataTable
+ that contains a schema.
+
+2002-10-14 Rodrigo Moya <rodrigo@ximian.com>
+
+ * list: added missing Odbc files.
+
+2002-10-09 Rodrigo Moya <rodrigo@ximian.com>
+
+ * list: added System.Data.Odbc files.
+
+2002-10-09 Brian Ritchie <brianlritchie@hotmail.com>
+
+ * System.Data.Odbc/*: added first version of ODBC managed provider.
+
+2002-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Data/ConstraintCollection.cs:
+ * System.Data/DataColumnCollection.cs:
+ * System.Data/DataRowCollection.cs:
+ * System.Data/DataTableCollection.cs:
+ * System.Data/InternalDataCollectionBase.cs: made List internal to fix
+ the build with csc. It must be a mcs bug. I will try to get a test case.
+
+2002-10-06 Luis Fernandez <luifer@onetel.net.uk>
+
+ * System.Data/Constraint.cs (AssertConstraint): added overloaded
+ method.
+
+ * System.Data/DataColumnCollection.cs: added constraints when needed.
+
+ * System.Data/DataRow.cs: validate UniqueConstraint's.
+
+ * System.Data/DataRowCollection.cs (ValidateDataRowInternal): new
+ internal method to validate a given DataRow with respect to the
+ DataRowCollection.
+
+ * System.Data/ForeignKeyConstraint.cs (AssertConstraint): stubs for
+ new overloaded method.
+
+ * System.Data/UniqueConstraint.cs: added implementation.
+ (AseertConstraint): implemented new overloaded method.
+
+2002-10-01 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (Open): commented code from
+ last commit, which wasn't supposed to be in CVS yet.
+
+2002-10-01 Luis Fernandez <luifer@onetel.net.uk>
+
+ * System.Data/DataColumn.cs:
+ * System.Data/DataRow.cs:
+ * System.Data/DataRowCollection.cs:
+ * System.Data/DataTable.cs: some fixes and implementation.
+
+2002-09-28 Vladimir Vukicevic <vladimir@pobox.com>
+
+ * System.Data.OleDb/OleDbConnection.cs: Close
+ reader properly in call to ExecuteScalar().
+
+2002-09-07 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (Open): changed to use OleDb
+ connection strings, which are then converted to GDA connection
+ strings, instead of using directly GDA data source names.
+
+ * System.Data.OleDb/libgda.cs: added more needed functions.
+
+2002-09-06 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data/DataColumn.cs: More flushing out.
+
+ * System.Data/ForeignKeyConstraint.cs: Implemented GetHashCode()
+
+ * System.Data/UniqueKeyConstraint.cs: Implemented GetHashCode()
+
+ * Tests: See Changelog for System.Data/Test
+
+2002-09-04 Franklin Wise <gracenote@earthlink.net>
+
+ * Tests: See Changelog for System.Data/Test
+
+ * New Files:
+ System.Data/DataColumnCollectionTest.cs
+ System.Data/DataRowCollectionTest.cs
+ System.Data/DataRowTest.cs
+
+ * System.Data/DataColumn.cs: Flushing out validation, type conversion for
+ autoincrement. Added lots of TODO's.
+ * System.Data/DataColumnCollection.cs: Wrote out add logic as a comment.
+ Tagged implementation with FIXME tags. Lot's more validation
+ and setup needs to be done, much of which is now tagged as todo's
+ or FIXME's
+
+ * System.Data/DataRow.cs: Lot's of fixme's added.
+
+ * System.Data/DataRowCollection.cs: TODO's added.
+
+ * System.Data/DataTable.cs: Implemented PrimaryKey.
+
+ * System.Data/UniqueConstraint.cs: Implemented related PrimaryKey
+ helpers.
+
+2002-08-25 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbTransaction.cs (OleDbTransaction): manage
+ correctly the isolation level.
+ (IsolationLevel): likewise.
+ (~OleDbTransaction): implemented.
+
+ * System.Data.OleDb/libgda.cs: added more needed stuff.
+
+2002-08-22 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlParameter.cs: flush
+
+ * System.Data.SqlClient/SqlParameterCollection.cs: fixes
+ for the Item property, IndexOf, and Contains.
+
+ * Test/SqlSharpCli.cs: added input parameters support.
+ when a query is executed, if a parameter name matches
+ a SQL# internal variable name, it uses that value for the parameter; otherwise,
+ the user is prompted for the parameter value. Currently, it only supports
+ string parameters.
+
+2002-08-21 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: adapted to changes in libgda (get_vtype
+ and get_type for GdaValue).
+
+ * System.Data.OleDb/OleDbDataReader.cs: adapted to changes in
+ libgda.cs.
+
+2002-08-20 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (DataReader): new internal
+ property.
+ (Close): set the dataReader to null.
+
+ * System.Data.OleDb/OleDbDataReader.cs (OleDbDataReader): set the
+ connection's DataReader property to this object.
+ (Close): set it to null here.
+ (Depth, IsDbNull): implemented.
+ (this): implemented the Item property with a string indexer.
+
+ * System.Data.OleDb/OleDbCommand.cs (ExecuteNonQuery, ExecuteReader,
+ ExecuteScalar): do nothing if there's already an open data reader.
+
+ * System.Data.OleDb/libgda.cs: more API functions.
+
+ * System.Data.OleDb/TestOleDb.cs (TestDataReader): close the data
+ reader before continuing.
+
+2002-08-20 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data/System.Data.build: added nowarn:0679
+
+ * System.Data/System.DataTable: cleaned up class, added MonoTODO tags
+ setup to begin implementing. Implemented ctor().
+
+ * Tests: See System.Data\Test\ChangeLog
+
+
+2002-08-19 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbSchemaGuid.cs: initialize static members.
+
+2002-08-19 Franklin Wise <gracenote@earthlink.net>
+
+ * Tests: See System.Data\Test\ChangeLog
+
+ * System.Data/UniqueConstraint.cs: More validation.
+
+ * System.Data/ForeignKeyConstraint.cs: Added more validation rules.
+ Another LAMESPEC tag. Implemented more of Add/Remove Setup/Cleanup
+ logic.
+
+ * System.Data/DataTable.cs: Added more MonoTODO tags
+
+ * class/System.Data/.cvsignore: added tmp & Temp
+
+ * System.Data/Constraint.cs: Changed abstract helpers to virtual and
+ internal.
+
+ * System.Data/ConstraintCollection.cs: Commented out unused line.
+
+2002-08-18 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (ChangeDatabase): implemented.
+
+ * System.Data.OleDb/OleDbException.cs (OleDbException): added internal
+ constructor.
+ (ErrorCode, Message, Source, Errors): implemented.
+
+ * System.Data.OleDb/OleDbError.cs: implemented the full class.
+
+ * System.Data.OleDb/libgda.cs: added more libgda functions.
+
+ * System.Data.OleDb/TestOleDb.cs (TestOleDb): display properties for
+ the opened connection.
+
+2002-08-18 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (ServerVersion): implemented.
+
+ * System.Data.OleDb/OleDbDataReader.cs (Close): clear the results
+ ArrayList after releasing the items.
+ (GetName, GetDateTime, GetDouble, GetSingle, GetInt16, GetInt32,
+ GetOrdinal, GetString): implemented.
+ (GetDataTypeName): made it get the type from the data model, not from
+ the current value, which could not have been retrieved yet.
+ (GetValue): call the Get* method corresponding with the data type of
+ the requested column.
+
+ * System.Data.OleDb/libgda.cs: added more libgda functions.
+ (GdaTimestamp, GdaDate, GdaTime): new marshalled structures.
+
+ * System.Data.OleDb/TestOleDb.cs (TestDateReader): display column
+ titles via OleDbDataReader.GetName ().
+ (TestOleDb): create temporary table with a date field.
+ (InsertRow): set current date for the date field.
+
+2002-08-18 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbDataReader.cs (this[]): made it just call
+ GetValue, which will take care of all the work needed.
+ (Close): implemented basic stuff.
+ (~OleDbDataReader): implemented.
+
+ * System.Data.OleDb/libgda.cs: added more needed functions.
+
+2002-08-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/TestOleDb.cs: made it work with a temporary table
+ we create.
+ (TestTransaction): added test for transactions.
+
+2002-08-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: added new needed libgda functions.
+
+ * System.Data.OleDb/OleDbDataReader.cs (GetBoolean): throw exceptions
+ when there are errors.
+ (GetByte, GetChar, GetDataTypeName, GetValue, Read): implemented.
+
+ * System.Data.OleDb/TestOleDb.cs: added more testing code for data
+ readers.
+
+2002-08-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: added new needed libgda functions.
+
+ * System.Data.OleDb/OleDbParameterCollection.cs (GdaParameterList):
+ create an empty GdaParameterList.
+
+ * System.Data.OleDb/OleDbCommand.cs (ExecuteReader): check values
+ for NULL before passing them to Marshal.PtrToStructure, which issues
+ an exception if the value is NULL.
+
+2002-08-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/UniqueConstraint.cs (UniqueConstraint): commented
+ unreachable code to avoid compiler warning.
+
+ * System.Data.OleDb/libgda.cs (GdaList): added new internal class.
+
+ * System.Data.OleDb/OleDbConnection.cs (DataSource): implemented.
+ (OpenReader): removed internal method.
+
+ * System.Data.OleDb/OleDbCommand.cs (ExecuteReader): split correctly
+ the list of returned data models.
+
+2002-08-15 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data/Constraint.cs: Added helper virtual functions
+
+ * System.Data/ConstraintCollection.cs: Improved constraint removal,
+ validation. Removed specific knowledge of subclasses of
+ Constraint.
+
+ * System.Data/DataColumn.cs: Added static helper function to compare
+ if two DataColumn arrays are the same.
+
+ * System.Data/ForeignKeyConstraint.cs: Continued to flush out.
+
+ * System.Data/UniqueConstraint.cs: Implemented. Still some constraint
+ validation to do.
+
+2002-08-13 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data/DataRow.cs: Added several fixme tags.
+
+2002-08-13 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlDataAdapter.cs (DeleteCommand,
+ InsertCommand, SelectCommand, UpdateCommand): removed 'new' keyword
+ to avoid compiler warnings.
+
+2002-08-12 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data/Constraint.cs: Implemented
+
+ * System.Data/UniqueConstraint.cs: GetHashCode() &
+ special case Ctor. Still need to be implemented. LAMESPEC tags
+ added.
+
+ * System.Data/ConstraintCollection.cs: Clear() &
+ AddRange() need to be finished. Several LAMESPEC tags.
+
+ * Allow Constraint collection to be created in DataTable.
+
+ * System.Data/ForeignKeyConstraint: Added a couple of
+ helper functions.
+
+ * System.Data/DataColumnCollection New/Added DataColumns now have
+ Table property set.
+
+2002-08-11 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: added some GdaValue functions.
+
+ * System.Data.OleDb/OleDbCommand.cs (OpenReader): removed this
+ internal method, since we don't need it.
+ (ExecuteReader): call SetupGdaCommand before executing the command
+ via libgda functions.
+ (ExecuteScalar): implemented.
+
+ * System.Data.OleDb/OleDbDateReader.cs (OleDbDataReader): removed call
+ to OleDbCommand.OpenReader.
+ (GetBoolean): implemented.
+
+2002-08-08 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data/IDbComand.cs: IDbCommand now inherits IDisposable
+
+ * System.Data/IDbConnection.cs: IDbConnection now inherits IDisposable
+
+ * System.Data.SqlTypes/SqlCompareOptions.cs: Enum now set to correct
+ values.
+
+2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs: little fixes to make it work
+ and don't show a warning in Open.
+
+ * System.Data.OleDb/TestOleDb.cs: added Close.
+
+2002-08-05 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (ConnectionString,
+ ConnectionTimeout, ServerVersion, GdaConnection):
+ corrected style.
+ (OleDbConnection): call libgda.gda_init on constructor.
+
+ * System.Data.OleDb/libgda.cs (libgda): removed static constructor,
+ which wasn't been called.
+
+ * System.Data.OleDb/TestOleDb.cs (TestOleDb): updated to really
+ make some tests.
+
+2002-08-04 Rodrigo Moya <rodrigo@ximian.com>
+
+ * list: added missing System.Data.OleDb and
+ System.Data.Common files.
+
+ * System.Data.OleDb/ChangeLog: removed and merged with
+ System.Data's ChangeLog.
+
+ * System.Data.OleDb/OleDbDataAdapter.cs:
+ * System.Data.OleDb/OleDbPermission.cs: compilation fixes.
+
+2002-07-30 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbDataReader.cs (FieldCount): implemented.
+ (IsClosed, Item, RecordsAffected): implemented some properties.
+
+ * libgda.cs: added GdaDataModel methods.
+
+2002-07-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbDataReader.cs (OleDbDataReader constructor): changed to receive
+ a second argument (ArrayList results).
+ (NextResult): implemented.
+
+ * System.Data.OleDb/OleDbCommand.cs: don't store the ArrayList of results, since we'll
+ pass that to the OleDbDataReader.
+ (OleDbCommand constructor): don't create the ArrayList of results.
+ (GdaResults): removed property.
+ (ExecuteReader): create a temporary ArrayList and pass that to the
+ OleDbDataReader constructor.
+
+2002-07-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbCommand.cs (ExecuteReader):
+ (CreateParameter): implemented IDbCommand methods.
+ (CommandText): don't create many GdaCommand's, only one is needed.
+ (ExecuteNonQuery): set up the internal GDA command object.
+ (ExecuteReader): use correctly the unique GDA command object.
+
+ * System.Data.OleDb/libgda.cs: added new libgda calls.
+
+2002-07-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbConnection.cs (CreateCommand):
+ (BeginTransaction): implemented IDbConnection methods.
+
+2002-07-12 Rodrigo Moya <rodrigo@ximian.com>
+
+ * list: added System.Data.OleDb files to file list.
+
+2002-07-11 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: added new libgda functions and some enumerations.
+
+ * System.Data.OleDb/OleDbParameter.cs (IsNullable): removed explicit implementation
+ of the set method for this property.
+
+ * System.Data.OleDb/OleDbDataAdapter.cs (MissingMappingAction): implemented.
+ (MissingSchemaAction): implemented.
+
+2002-07-10 Tim Coleman <tim@timcoleman.com>
+
+ * System.Data.OleDb/OleDbCommandBuilder.cs: Added new methods, properties
+ * System.Data.OleDb/OleDbConnection.cs: Modified constructor
+ * System.Data.OleDb/OleDbError.cs: Added stubbs
+ * System.Data.OleDb/OleDbException.cs: Added stubbs
+ * System.Data.OleDb/OleDbInfoMessageEventArgs.cs: Added stubbs
+ * System.Data.OleDb/OleDbInfoMessageEventHandler.cs: style change
+ * System.Data.OleDb/OleDbParameter.cs: Added conversion from type to OleDbType
+ * System.Data.OleDb/OleDbPermission.cs: Added stubbs
+ * System.Data.OleDb/OleDbSchemaGuid.cs: Added stubbs
+ * System.Data.OleDb/OleDbTransaction.cs: New constructors, changes to methods to
+ support transaction nesting
+ * System.Data.OleDb/libgda.cs: Added my name to this file
+
+2002-07-09 Tim Coleman <tim@timcoleman.com>
+
+ * System.Data.OleDb/OleDbCommand.cs: Style changes, added new methods
+ * System.Data.OleDb/OleDbConnection.cs: Style changes, added new methods
+ * System.Data.OleDb/OleDbDataAdapter.cs: Implementation
+ * System.Data.OleDb/OleDbDataReader.cs: Added stubbs
+ * System.Data.OleDb/OleDbErrorCollection.cs: Added stubbs, some implementation
+ * System.Data.OleDb/OleDbParameter.cs: Style changes, added new methods
+ * System.Data.OleDb/OleDbParameterCollection.cs: Style changes, added new methods
+ * System.Data.OleDb/OleDbPermissionAttribute.cs: Style changes, added new methods
+ * System.Data.OleDb/OleDbRowUpdatedEventArgs.cs: Added stubbs
+ * System.Data.OleDb/OleDbRowUpdatingEventArgs.cs: Added stubbs
+ * System.Data.OleDb/OleDbTransaction.cs: Style changes, added new methods
+ * System.Data.OleDb/OleDbType.cs: Fixed two typos
+ * System.Data.OleDb/libgda.cs: Style changes, added new methods
+
+2002-07-09 Tim Coleman <tim@timcoleman.com>
+
+ * System.Data.build: remove restriction on System.Data.OleDb build
+
+2002-06-03 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbParameterCollection.cs (GetEnumerator, SyncRoot,
+ IsSynchronized): implemented.
+
+2002-06-02 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbTransaction.cs (Dispose): added missing method.
+
+ * System.Data.OleDb/OleDbCommand.cs (Clone): added missing methods.
+ (Parameters, Transaction, Connection): made these overload
+ IDbCommand's ones.
+
+ * System.Data.OleDb/OleDbParameterCollection.cs (IndexOf, Remove, RemoveAt):
+ call m_list methods, not own ones.
+
+ * System.Data.OleDb/OleDbParameter.cs: more implementation.
+
+2002-06-02 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/OleDbTransaction.cs (Connection, IsolationLevel, Begin,
+ Commit, Rollback): implemented.
+ (GdaConnection): added new internal property.
+
+ * System.Data.OleDb/OleDbParameter.cs:
+ * System.Data.OleDb/OleDbParameterCollection.cs: implemented some methods and
+ properties.
+
+ * System.Data.OleDb/libgda.cs: added yet more libgda API functions.
+
+2002-06-01 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: added new libgda API functions.
+
+ * System.Data.OleDb/OleDbConnection.cs (Provider): implemented.
+ (BeginTransaction): made it overload IDbConnection methods.
+ (ChangeDatabase): new stub, needs some work on libgda for being
+ implemented.
+ (Clone): new stub.
+ (Close): implemented.
+ (CreateCommand): implemented.
+ (GetOleDbSchemaTable): new stub, until I understand what to do here.
+ (Open): implemented basic stuff, which is just supporting connection
+ strings that represent a GDA data source name. More to come.
+ (InfoMessage, StateChange): added events.
+
+ * System.Data.OleDb/TestOleDb.cs: test program for System.Data.OleDb.
+
+2002-05-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: added static constructor.
+ (GdaClient): new static property to get the underlying GdaClient
+ object.
+
+ * System.Data.OleDb/OleDbConnection.cs: removed GDA initialization, which belongs to
+ the static 'libgda' class.
+
+2002-05-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/libgda.cs: static class for libgda API calls.
+
+ * System.Data.OleDb/OleDbConnection.cs: implemented constructors.
+ (ConnectionString, Connectiontimeout, Database, State):
+ implemented class properties.
+ (BeginTransaction): implemented.
+
+ * System.Data.OleDb/OleDbTransaction.cs: implemented protected constructors.
+
+ * System.Data.OleDb/TestGDA.cs: simple test for libgda API.
+
+2002-05-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.OleDb/*: started System.Data.OleDb provider, based on libgda.
+
+2002-06-06 Rodrigo Moya <rodrigo@ximian.com>
+
+ * list: added missing PostgresTypes.cs file.
+
+2002-06-02 Francisco Jr. <fxjrlists@yahoo.com.br>
+
+ * System.Data.SqlClient/SqlParameterCollection.cs: implemented missing
+ methods.
+
+2002-05-30 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: modifed -
+ start to implement the interfaces properly and
+ properly doing a Close(), Dispose(), and
+ releasing resources
+
+ * Test/SqlSharpCli.cs: modified -
+ add support for MySQL in Mono.Data.MySql
+ and OleDb support in System.Data.OleDb. However,
+ the OleDb support is commented right now.
+ When the program starts up, a shorter help menu should
+ display the most important commands: help and quit
+
+2002-05-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.build: exclude System.Data.OleDb files.
+
+2002-05-27 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: typo
+ should be CommandBehavior.KeyInfo
+
+ * Test/SqlSharpCli.cs: refactored and added a few more
+ features.
+
+2002-05-27 Tim Coleman <tim@timcoleman.com>
+ * list: update to compile properly (add missing
+ files and switch path delimiter from '\' to '/').
+
+2002-05-26 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataRow.cs
+ * System.Data.Common/DbDataAdapter.cs: fix to
+ get Test/TestSqlDataAdapter.cs to work again
+
+ * Test/TestSqlDataAdapter.cs: removed comment
+ about SqlDataReader:NextResult() not being implemented; it
+ bas been implemented
+
+2002-05-26 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataRow.cs: modified
+ support setting of DBNull.Value
+ using the Item indexer this[DataColumn]
+
+ * System.Data.SqlClient/SqlCommand.cs: modified
+ tweaks to show TODO's for other CommandBehavior.
+ Set AllowDBNull column to true for IsKey row
+ in schema DataTable.
+
+ * System.Data.SqlClient/SqlConnection.cs: modified
+ if transaction is in progress when a Close() is called,
+ do a transaction Rollback.
+
+2002-05-26 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/SqlSharpCli.cs: added file
+ My new toy. SQL# is a command-line tool to enter
+ SQL commands and queries using Mono System.Data.
+ It also serves as a test for Mono System.Data.
+
+ * System.Data.SqlClient/SqlCommand.cs: modified
+ - ExecuteNonQuery(), ExecuteScalar(), and ExecuteReader()
+ should handle the results from SQL Commands and Queries.
+ - Internal class SqlResult should not create schema Table
+ for the result from a SQL Command. Also, set the RecordsRetrieved
+ property for SqlDataReader.
+ - Closing the SqlDataReader should Close() the SqlConnection for
+ a CommandBehavior.CloseConnection.
+ - Set defaults for SqlResult
+
+ * System.Data.SqlClient/SqlConnection.cs: modified -
+ when SqlDataReader is Close()
+ should Close() the SqlConnection for
+ a CommandBehavior.CloseConnection. Changed internal Property
+ from OpenReader get/set to IsReaderOpen get and created
+ internal methods OpenReader()/CloseReader() for SqlCommand to call.
+ SqlConnection needs to be prevented from doing while SqlDataReader
+ is being used.
+
+ * System.Data.SqlClient/SqlDataReader.cs: modified -
+ call SqlCommand's OpenReader() internal method. get
+ RecordsRetrieved from SqlResult. set/reset default
+ values for SqlDataReader.
+
+ * Test/PostgresTest.cs
+ * Test/TestExecuteScalar.cs
+ * Test/TestSqlDataReader.cs: modified
+ for the Execute...() methods in SqlCommand
+ to test SQL Queries and Commands
+
+ * Test/System.Data_test.build: modified
+ exclude new file Test/SqlSharpCli.cs from
+ test build
+
+2002-05-24 Tim Coleman <tim@timcoleman.com>
+ * System.Data.Common/DbDataAdapter.cs: remove IDbCommands, except
+ for get accessors. These should be implemented in derived classes. See
+ SqlDataAdapter for clues.
+ * System.Data.SqlClient/SqlDataAdapter.cs: implement IDbDataAdapter
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DataTableMapping.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataColumnMapping.cs:
+ Properly (I hope!) implement all of the appropriate interfaces
+ for these classes.
+
+
+2002-05-23 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlCommand.cs: include
+ the BaseColumnName in the schema table. Was missed before.
+ * System.Data.Common/DbDataAdapter.cs: Use DataTable
+ mappings so that the DataSet and DataTable are more closely tied.
+ Get schema information from the DataTable using GetSchemaTable ()
+ Various other little fixes
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataTableMapping.cs:
+ * System.Data.Common/DataTableMappingCollection.cs: Some
+ implementation, enough to be used by DbDataAdapter.
+
+2002-05-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: set
+ the "ProviderType" to the PostgreSQL type oid
+
+ * System.Data.SqlClient/SqlDataReader.cs: fix
+ for various properties and methods that
+ return meta data: Item indexers this[name] and this[index],
+ GetFieldType, GetName, and GetOrdinal. SqlDataAdapter
+ should work again.
+
+2002-05-22 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataRow.cs: change suggested
+ by tim: in Item indexer, do an EndEdit()
+
+ * System.Data.SqlClient/SqlCommand.cs: more
+ fixes to SqlResult. After setting each item in
+ the DataRow, do an AcceptChanges() to commit
+ the changes in the DataRow. For DataType, use a Type
+ of System.String since System.Type nor System.Object
+ seems to work.
+
+ * Test/TestSqlDataReader.cs
+ * Test/PostgresTest.cs: updated to to be on
+ the way schema table is suppose to work
+
+2002-05-22 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: more work on
+ building the schema table
+
+2002-05-22 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlCommand.cs: preliminary work
+ on getting the schema table correctly built.
+
+2002-05-21 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/ParmUtil.cs: added file - to
+ provide utility for conversion of input parameters
+
+ * System.Data.SqlClient/PostgresTypes.cs: added file -
+ moved the PostgreHelper class to here. May eventually
+ move the internal class PostgresTypes that's inside the
+ SqlConnection to here as well.
+ Handling of PostgreSQL <-> .NET types need to be though
+ out more. Also, the PostgreHelper has a method to convert
+ from .NET types to a string which can be put into used in
+ an SQL statement to execute against a PostgreSQL database.
+ This is the beginnings of parameters support. It currently
+ only supports input parameters. Still need to do output,
+ input/output, and return parameters.
+
+ * Test/TestSqlParameters.cs: new test to test the input
+ parameters in System.Data.SqlClient against a
+ PostgreSQL db.
+
+ * System.Data.SqlClient/PostgresLibrary.cs: moved
+ PostgresHelper class to file PostgresTypes.cs. Also
+ moved struct PostgresType there too.
+
+ * System.Data.SqlClient/SqlCommand.cs: added input
+ parameters support
+
+ * System.Data.SqlClient/SqlParameter.cs: got
+ SqlParameter to work
+
+ * System.Data.SqlClient/SqlParameterCollection.cs: got
+ SqlParameterCollection to work
+
+ * Test/System.Data_test.build: added files to exclude
+ from test build
+
+ * System.Data.SqlClient/SqlConnection.cs: release resources
+ no longer used
+
+2002-05-18 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Xml: added directory for classes with namespace
+ System.Xml to go into the System.Data.dll assembly
+
+ * System.Xml/XmlDataDocument: added file
+ for stubbed concrete class XmlDataDocument which
+ inherits from XmlDocument. Its purpose is to provide
+ a W3C XML DOM Document for relational data and interacting
+ with a DataSet
+
+2002-05-18 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: handle CommandTypes
+ Text, TableDirect, and StoredProcedure
+
+ * Test/PostgresTest.cs: changed call to version()
+ stored procedure to use the CommandType of StoredProcedure
+
+ * Test/TestSqlDataReader.cs: test all the CommandTypes
+
+2002-05-18 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: took out all excluded
+ files except the ones in the Test directory
+ because all files compile now. It does not
+ mean they all work or have implementations
+ though.
+
+ * System.Data/DataRelationCollection.cs
+ * System.Data/DataTableRelationCollection.cs
+ * System.Data/InternalDataCollectionBase.cs
+ * System.Data.Common/DbDataPermission.cs
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs
+ * System.Data.SqlClient/SqlClientPermission.cs
+ * System.Data.SqlClient/SqlClientPermissionAttribute.cs: changes
+ to get all System.Data* files to compile.
+
+ * System.Data.SqlClient/SqlCommand.cs: started coding
+ to prevent SqlConnection and SqlCommand from doing
+ anyting while fetching data using SqlDataReader. Also,
+ started coding to undo this prevention once the
+ SqlDataReader is closed.
+
+ * System.Data.SqlClient/SqlConnection.cs: get database server
+ version. Started coding to prevent connection from
+ doing anything while fetching data and undo once the reader
+ is closed. Include events SqlInfoMessage and StateChange.
+
+ * System.Data.SqlClient/SqlDataReader.cs: start coding to
+ prevent connection and command from doing anything while
+ fetching data, and undo when closed.
+
+ * Test/PostgresTest.cs: added test to get ServerVersion
+ property from SqlConnection
+
+2002-05-18 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataRow.cs: More implementation,
+ as well as boundary checks and small semantic
+ repairs
+
+2002-05-18 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataRow.cs: Try to reduce memory
+ usage by only creating the original and proposed
+ arrays as required in BeginEdit, and then destroying
+ proposed during EndEdit, and original during AcceptChanges.
+ * System.Data.Common/DbDataAdapter.cs: Make the
+ startRecord and maxRecords parameters work correctly.
+
+2002-05-18 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataRow.cs: Move the null check in
+ ItemArray set to above the Invalid Cast check, so
+ that we don't get null reference exceptions.
+
+2002-05-17 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/PostgresLibrary.cs: handle
+ data value from database being NULL
+
+ * System.Data.SqlClient/SqlCommand.cs: for ExecuteReader,
+ allow multiple result sets. Added new internal class
+ SqlResult to pass result set data from SqlCommand
+ to SqlDataReader.
+
+ * System.Data.SqlClient/SqlDataReader.cs: allow
+ multiple result sets.
+
+ * System.Data.SqlClient/SqlConnection.cs: moved
+ things around. Implement IDisposable.
+
+ * Test/TestSqlDataReader.cs: test for execution
+ of multiple result sets and display the results
+ of these multiple results sets
+
+ * Test/TestSqlDataAdapter.cs: tweaks
+
+2002-05-17 Tim Coleman <tim@timcoleman.com>
+ * System.Data.Common/DbDataAdapter.cs:
+ - More implementation of Fill methods
+ - Get rid of isDirty flag, because we can just check
+ if the table exists
+ - Do *not* remove DataTables before Filling them
+ - Implicitly open the connection before doing a Fill
+ if it does not exist.
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ - Minor fixup
+ * System.Data/DataTableCollection.cs:
+ - Add DataSet to internal, undocumented constructor
+ - When a table is created, set its DataSet property
+ - Default table name for creation is "Table1" (see .NET)
+ - Inherit the ArrayList list from InternalDataCollecitonBase
+ and maintain a hashtable between table names and
+ DataTables
+ * System.Data/DataTable.cs:
+ - Add internal dataSet field. This is used by
+ DataTableCollection when the DataTable is constructed.
+ * System.Data/DataSet.cs:
+ - Pass a reference to the DataSet when constructing the
+ DataTableCollection.
+
+2002-05-16 Tim Coleman <tim@timcoleman.com>
+ * System.Data.Common/DbDataAdapter.cs:
+ Use table.Rows.Add (itemArray) instead of
+ table.Rows.Add (thisRow) to provide better
+ abstraction.
+ * System.Data/DataRowCollection.cs:
+ Some implementation of this class.
+ * System.Data/InternalDataCollectionBase.cs:
+ Some implementation. Most notably, this now
+ has an enumerator so we can use foreach (DataRow row in table.Rows)
+ in the test classes.
+ * System.Data/DataTable.cs:
+ Since DataRowCollection now accepts a DataTable in
+ its internal constructor, we must pass one in.
+
+2002-05-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestSqlDataAdapter.cs: added new test
+ for SqlDataAdapter, DataSet, DataTableCollection, DataTable,
+ DataRowCollection, and DataRow. It tests retrieving data
+ based on a SQL SELECT query. This test is based on Tim Coleman's
+ test he sent to me.
+
+2002-05-16 Tim Coleman <tim@timcoleman.com>
+ * System.Data.Common/DbDataAdapter.cs:
+ Use table.Rows.Add (thisRow) instead of
+ table.ImportRow (thisRow)
+ * System.Data/DataRowCollection.cs:
+ Construct the ArrayList before using it
+
+2002-05-16 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataTable.cs:
+ Construct the DataRowCollection in the DataTable
+ constructor. Otherwise, it's a null reference.
+
+2002-05-16 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlClient/SqlDataReader.cs:
+ Modify GetValues to use Array.Copy() to copy
+ the results from fields to values, rather than
+ an assignment, which results in loss of data.
+
+2002-05-16 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataRow.cs:
+ More implementation and documentation. It should
+ work more like expected, although there is no way
+ to demonstrate this well yet. DataTable requires
+ more work.
+
+2002-05-15 Tim Coleman <tim@timcoleman.com>
+ * System.Data/DataRow.cs:
+ Minor tweaks as I determine exactly how to
+ implement this class.
+
+
+2002-05-14 Duncan Mak <duncan@ximian.com>
+
+ * System.Data/DataTable.cs (NewRow): Added missing paren to fix build.
+
+2002-05-14 Tim Coleman
+ * System.Data/DataRow.cs:
+ * System.Data/DataRowBuilder.cs:
+ * System.Data/DataTable.cs:
+ More implementation of these classes. DataRow
+ can now (possibly) do some useful things.
+ Still not sure what DataRowBuilder is all about,
+ other than passing a DataTable in.
+
+2002-05-14 Tim Coleman
+ * System.Data/DataRowBuilder.cs:
+ Add stubb for this internal class.
+
+2002-05-13 Tim Coleman
+ * System.Data.Common/DbDataAdapter.cs:
+ The maxRecords check was not correct.
+
+2002-05-13 Tim Coleman
+ * System.Data/DataTableCollection.cs:
+ Fix an issue when adding a DataTable and size == 0.
+ Now explicitly checks if size > 0 before doing Array.Copy ()
+ * System.Data.Common/DbDataAdapter.cs:
+ Move closer to a working implementation.
+ Make the IDbCommand fields protected so that they can
+ be inherited.
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ This should inherit the IDbCommands instead of having its
+ own. An explicit cast is used to force conversion between
+ IDbCommand and SqlCommand
+
+2002-05-13 Tim Coleman
+ * System.Data.Common/DataTableMappingCollection.cs:
+ Some implementation to allow progress with DbDataAdapter
+
+2002-05-13 Tim Coleman
+ * System.Data.Common/DbDataAdapter.cs:
+ Modify to not break compile.
+
+2002-05-13 Tim Coleman
+ * System.Data.build:
+ include SqlDataAdapter, SqlRowUpdatedEventArgs,
+ SqlRowUpdatingEventArgs, SqlRowUpdatedEventHandler,
+ SqlRowUpdatingEventHandler in the build.
+
+2002-05-13 Tim Coleman
+ * System.Data.Common/DbDataAdapter.cs:
+ More implementation.
+ * System.Data.Common/DataAdapter.cs:
+ Correction of some of the stubbing, as well as a
+ little bit more implementation
+
+2002-05-11 Tim Coleman
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.Common/DbDataAdapter.cs:
+ Moved methods that weren't supposed to
+ be in SqlDataAdapter out. They should be implemented
+ in DbDataAdapter.
+
+
+2002-05-11 Tim Coleman
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ some implementation of this class. Note
+ that none of the functionality has been
+ tested yet, but I felt it should be checked
+ in at this point as it compiles.
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
+ * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs:
+ Modified so that they will compile properly.
+ Needed to include SqlDataAdapter in the build.
+
+2002-05-11 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataTable.cs (Clear): implemented.
+ (DataTable): removed repeated code in constructors, and call the
+ basic constructor from the others.
+
+ * System.Data/DataColumn.cs: some tweaks.
+
+ * System.Data/DataRow.cs (RowState): implemented.
+ (CancelEdit): set rowState property back to Unchanged.
+ (RejectChanges): call CancelEdit.
+ (Delete): set rowState to Deleted.
+
+2002-05-11 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: added copy of System.Data.dll to Test directory
+ for easy testing. Also, added clean for it too.
+
+ * System.Data.SqlClient/PostgresLibrary.cs: changed setting of boolean
+ from PostgreSQL data type to .NET type.
+
+ * System.Data.SqlClient/SqlDataReader.cs: beginnings
+ handling of a NULL value from the database
+
+ * Test/PostgresTest.cs: added tests for NULL values retrieved
+ from the database
+
+ * Test/ReadPostgresData.cs
+ * Test/TestExecuteScalar.cs
+ * Test/TestSqlDataReader.cs
+ * Test/TestSqlException.cs
+ * Test/TestSqlIsolationLevel.cs: updated tests to use databas user
+ "postgres". These tests may eventually be removed since they
+ are not flexible.
+
+2002-05-10 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.build: removed reference to non-existant
+ TestDataColumn.cs file.
+
+ * System.Data/DataSet.cs: added some implementation.
+
+2002-05-09 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/PostgresLibrary.cs: got
+ PostgreSQL data types time, date, timestamp (DateTime like)
+ mapped to .NET System.DateTime working based
+ on ISO DateTime formatting "YYYY-MM-DD hh:mi:ss.ms"
+ Also mapped pg type boolean to .net Boolean
+
+ * SqlClient/SqlConnection.cs: run SQL command to set
+ Date style to ISO
+
+ * Test/PostgresTest.cs: added test for an UPDATE SQL command,
+ added tests for aggregates min(), max(), sum(), count(). could
+ not get avg() to work due to some formatting error; someone claimed
+ that it was my locale settings. added tests for SELECT of columns
+ of type boolean, float, double, date, time, and timestamp. They
+ have not been fully tested, but its a start.
+
+2002-05-09 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlTypes/SqlDecimal.cs: Implementations of
+ addition, subtraction, and multiplication for the
+ SqlDecimal type, as well as modification of some other
+ operations. More to come on this one.
+
+2002-05-08 Rodrigo Moya <rodrigo@ximian.com>
+
+ * Test/System.Data_test.build: excluded TestDataColumn, which
+ should be replaced with a nunit test.
+
+ * Test/TestDataColumn.cs: added basic test for DataColumn.cs.
+
+2002-05-07 Tim Coleman <tim@timcoleman.com>
+ * SqlBinary.cs:
+ * SqlBoolean.cs:
+ * SqlByte.cs:
+ * SqlDateTime.cs:
+ * SqlDecimal.cs:
+ * SqlDouble.cs:
+ * SqlGuid.cs:
+ * SqlInt16.cs:
+ * SqlInt32.cs:
+ * SqlInt64.cs:
+ * SqlMoney.cs:
+ * SqlSingle.cs:
+ * SqlString.cs:
+ Fix the broken build I made before. Bad
+ me.
+
+2002-05-07 Tim Coleman <tim@timcoleman.com>
+ * SqlString.cs:
+ Fix a symantic error I made in SqlString
+ Equals where I copied and pasted wrongly
+
+2002-05-07 Tim Coleman <tim@timcoleman.com>
+ * INullable.cs:
+ * SqlBinary.cs:
+ * SqlBoolean.cs:
+ * SqlByte.cs:
+ * SqlCompareOptions.cs:
+ * SqlDateTime.cs:
+ * SqlDecimal.cs:
+ * SqlDouble.cs:
+ * SqlGuid.cs:
+ * SqlInt16.cs:
+ * SqlInt32.cs:
+ * SqlInt64.cs:
+ * SqlMoney.cs:
+ * SqlSingle.cs:
+ * SqlString.cs:
+ Implement CompareTo, Equals, and String conversions
+ for many types
+
+2002-05-05 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/PostgresTest.cs: modified to run completely. There
+ are many TODOs in System.Data, so not all data types are
+ included in the SELECT SQL query. Also, I made it to where
+ it would connect
+ using "host=localhost;dbname=test;user=postgres"
+ instead of my userid and password. When more types are included,
+ update this test.
+
+2002-05-05 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/PostgresTest.cs: added - ported
+ libgda postgres-test.c originally by
+ Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+ to C#.
+
+2002-05-05 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/SqlMoney.cs:
+ * System.Data.SqlTypes/SqlSingle.cs:
+ * System.Data.SqlTypes/SqlString.cs:
+ More implementation, and code clean-up for consistency.
+ Also, I had implemented many conversions as explicit
+ that should have been implicit. This should remove
+ many of the red X's and green pluses from the
+ System.Data.SqlTypes namespace.
+
+2002-05-05 Miguel de Icaza <miguel@ximian.com>
+
+ * System.Data/DataSet.cs: Remove [Serializable] attributes from
+ methods, those only apply to structs or classes.
+
+ Stub out ISerializable, ISupportInitialize, and IListSource methods
+
+ * System.Data/DataRowView.cs: Stub out interface methods for
+ IEditableObject, ICustomTypeDescriptor and IDataErrorInfo
+
+ * System.Data/DataView.cs: Comment out non-implemented
+ interfaces.
+
+ * System.Data/DataViewSettingsCollection.cs: Type cast variables
+ to the correct type to make it compile.
+
+ * System.Data/DataViewSettings.cs: remove reference to
+ non-existance type ApplyDefaultSort, it is a boolean.
+
+
+2002-05-05 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/SqlMoney.cs:
+ * System.Data.SqlTypes/SqlSingle.cs:
+ * System.Data.SqlTypes/SqlString.cs:
+ Various fixes, including adding the SqlNullValueException
+ when trying to retrieve the value of a null SqlType,
+ and when casting values, a Null of type A converts to a
+ Null of type B.
+
+2002-05-04 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/PostgresLibrary.cs
+ * System.Data.SqlClient/SqlCommand.cs
+ * System.Data.SqlClient/SqlConnection.cs
+ * System.Data.SqlClient/SqlDataReader.cs
+ oid should not be hard coded because they
+ can change from one version of PostgreSQL
+ to the next. Use the typname's instead.
+ The PostgreSQL type data retrieves
+ at database connection time. Any unimplemented
+ types just default to string. These were things
+ suggested by Gonzalo.
+
+ * Test/ReadPostgresData.cs - stuff
+ * Test/TestSqlDataReader.cs - stuff
+
+ * System.Data.SqlTypes/SqlInt32.cs - added a using
+
+2002-05-03 Tim Coleman <tim@timcoleman.com>
+ * System.Data.build: Fix the build so that test depends on build
+
+2002-05-03 Tim Coleman <tim@timcoleman.com>
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/SqlMoney.cs:
+ * System.Data.SqlTypes/SqlSingle.cs:
+ These files were mysteriously excluded from the last
+ patch I made and sent to Rodrigo
+ * System.Data.build: include the System.Data.SqlTypes in the build
+
+2002-05-03 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: removed comments
+
+ * System.Data.SqlClient/PostgresLibrary.cs: changed
+ the hard-coded PostgreSQL oid type int's to using an
+ enum. Also, added PostgreSQL bpchar (character) type.
+
+ * Test/TestSqlDataReader.cs: updated test
+ to include new bpchar PostgreSQL type
+
+2002-05-03 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlString.cs: more implementation, by
+ Tim Coleman <tcoleman@opentext.com>.
+
+2002-05-03 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestExecuteScalar.cs: added test for
+ method ExecuteScalar in class SqlCommand.
+
+ * System.Data/DataColumnCollection.cs - it should
+ inherit properties from base InternalDataCollectionBase
+ and use them instead of overriding them, such as, List.
+
+ * System.Data/DataColumn.cs
+ * System.Data/DataTable.cs: tweaks to retrieve
+ meta data from the database
+
+ * System.Data.SqlClient/PostgresLibrary.cs -
+ added method OidToType to convert PostgreSQL oid type
+ to System.Type. Renamed method OidTypeToSystem
+ to ConvertPgTypeToSystem for converting the data value
+ from a PostgreSQL type to a .NET System type.
+
+ * System.Data.SqlClient/SqlCommand.cs: implemented
+ method ExecuteReader which returns a SqlDataReader
+ for a light forward only read only result set.
+ It works on types int4 ==> Int32 and
+ varchar ==> String. Other types
+ will come later.
+
+ * System.Data.SqlClient/SqlConnection.cs: added comment
+
+ * System.Data.SqlClient/SqlDataReader.cs: implemented
+ class. It works, but still lots to do.
+
+ * Test/ReadPostgresData.cs: stuff
+
+ * Test/TestSqlDataReader.cs: updated test for SqlDataReader
+ to display meta data and the data
+
+2002-05-03 Duncan Mak <duncan@ximian.com>
+
+ * TODO: Took out all the Exceptions. They should be all done now.
+
+ * System.Data/ConstraintException.cs:
+ * System.Data/DBConcurrencyException.cs:
+ * System.Data/DataException.cs:
+ * System.Data/DeletedRowInaccessibleException.cs:
+ * System.Data/DuplicateNameException.cs:
+ * System.Data/EvaluateException.cs:
+ * System.Data/InRowChangingEventException.cs:
+ * System.Data/InvalidConstraintException.cs:
+ * System.Data/InvalidExpressionException.cs:
+ * System.Data/MissingPrimaryKeyException.cs:
+ * System.Data/NoNullAllowedException.cs:
+ * System.Data/ReadOnlyException.cs:
+ * System.Data/RowNotInTableException.cs:
+ * System.Data/StrongTypingException.cs:
+ * System.Data/SyntaxErrorException.cs:
+ * System.Data/TypeDataSetGeneratorException.cs:
+ * System.Data/VersionNotFoundException.cs: Added to CVS.
+
+ * System.Data.SqlTypes/SqlNullValueException.cs:
+ * System.Data.SqlTypes/SqlTruncateException.cs:
+ * System.Data.SqlTypes/SqlTypeException.cs: Added to CVS.
+
+2002-05-02 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataViewSettingCollection.cs: implemented.
+
+ * System.Data/DataRowView.cs: new stubs.
+
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/SqlMoney.cs:
+ * System.Data.SqlTypes/SqlSingle.cs: new stubs, contributed
+ by Tim Coleman <tcoleman@opentext.com>
+
+ * System.Data.build: excluded newly-added files.
+
+2002-05-02 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/PostgresLibrary.cs: included new
+ internal class that will be a helper class in using
+ PostgreSQL. PostgresLibrary is used for the
+ pinvoke methods to the PostgreSQL Client
+ native C library libpq while the class PostgresHelper
+ is used for wrapper or helper methods. It currently only
+ has one static method OidTypeToSystem in converting
+ PostgreSQL types to .NET System.<type>s, such as,
+ a PostgreSQL int8 becomes a .NET System.Int64.
+ Only a few types have been added, such as, int2,
+ int4, int8, varchar, text, bool, and char. Other types
+ will come later.
+
+ * System.Data.SqlClient/SqlCommand.cs: implemented
+ method ExecuteScalar which allows us to do aggregate
+ functions, such as, count, avg, min, max, and sum. We
+ also are able to retrieve the result, convert it to the .NET type
+ as an object. The user of the returned object must explicitly cast.
+
+ * Test/ReadPostgresData.cs: updated sample
+ to help us learn to retrieve data in System.Data.SqlClient
+ classes
+
+2002-05-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: added /nowarn: nnnn arguments
+ so you will not get a ton of warnings. The warnings
+ being excluded are: 1595, 0067, 0109, 0169, and 0649
+
+2002-05-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: modified to exclude more
+ files from the build
+
+2002-05-01 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlClientPermission.cs: added missing
+ 'using's.
+
+ * System.Data/MergeFailedEventArgs.cs: new class, contributed
+ by John Dugaw <jdugaw@unizenconsulting.com>.
+
+ * System.Data.build: excluded new files from build.
+
+2002-04-29 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/ReadPostgresData.cs: added - Uses the
+ PostgresLibrary to retrieve a recordset.
+ This is not meant to be used in Production, but as a
+ learning aid in coding
+ class System.Data.SqlClient.SqlDataReader.
+ This sample does work.
+
+ * Test/TestSqlDataReader.cs: added - used
+ to test SqlDataReader (does not work yet)
+ Forgot to add to ChangeLog on last commit.
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataViewSetting.cs: new class.
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataViewManager.cs: new class.
+
+ * System.Data.SqlTypes/INullable.cs: properties for interfaces
+ don't have implementation.
+
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlString.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs: removed destructor, since
+ these are strctures.
+
+ * System.Data.SqlClient/SqlClientPermissionAttribute.cs: added
+ missing 'using's.
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataTableRelationCollection.cs: use 'new' keyword
+ for correctly hiding parent class' members.
+ (AddRange): use 'override' keyword on overriden method.
+ (Clear): likewise.
+ (Contains): likewise.
+ (IndexOf): likewise.
+ (OnCollectionChanged): likewise.
+ (OnCollectionChanging): likewise.
+ (RemoveCore): likewise.
+
+ * System.Data/DataColumnCollection.cs: use 'new' keyword.
+
+ * System.Data/DataSet.cs: added missing 'using's.
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataSet.cs:
+ * System.Data/DataTableCollection.cs:
+ * System.Data/DataView.cs: compilation fixes on Linux.
+
+2002-04-28 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataRelation.cs
+ * System.Data/ForeignKeyConstraint.cs
+ * System.Data/UniqueConstraint.cs: added more stubs
+
+ * System.Data/DataTableRelationCollection.cs: added back to cvs
+ and modified for compile errors. DataRelationCollection is an
+ abstract class and there must be a class that implements for
+ DataTable/DataSet. DataTableRelationCollection was changed
+ to an internal class.
+
+ * System.Data.build: modified - new files added
+ also wanted to include files/classes in the build
+ so we can get a compilable forward read only result set.
+ It compiles now using csc/nant with warnings, but this
+ is a start for adding functionality for the result set.
+ Classes associated with/and DataSet are still excluded.
+
+ * TODO: modified - updated to do list for System.Data
+
+ * System.Data/Constraint.cs
+ * System.Data/ConstraintCollection.cs
+ * System.Data/DataRelationCollection.cs
+ * System.Data/DataRow.cs
+ * System.Data/DataRowChangeEventArgs.cs
+ * System.Data/DataRowCollection.cs
+ * System.Data/DataTable.cs
+ * System.Data/DataTableCollection.cs
+ * System.Data/InternalDataCollectionBase.cs
+ * System.Data/PropertyCollection.cs: modified -
+ changes to compile SqlDataReader/DataTable and
+ dependencies
+
+ * System.Data/IDbCommand.cs
+ * System.Data.SqlClient/SqlCommand.cs: modified -
+ un-commented overloaded methods ExecuteReader
+ which returns a SqlDataReader
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataTableCollection.cs: more implementation.
+ (Count): added 'override' keyword, as pointer out by Martin.
+
+ * System.Data.Common/DataColumnMappingCollection.cs (Add, AddRange):
+ only call Array.Copy when there is really stuff to be copied.
+ (CopyTo): don't create the temporary array, it's not needed.
+
+ * System.Data.build: excluded newly added file from build.
+
+2002-04-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataTableRelationCollection.cs: removed, it's not
+ on MS SDK documentation.
+
+ * System.Data/DataTableCollection.cs: new class.
+
+2002-04-27 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/DataRowChangeEventArgs.cs
+ * System.Data/DataRowCollection.cs
+ * System.Data/DataView.cs
+ * System.Data/PropertyCollection.cs: added new stubs
+
+ * System.Data.build: modified - added new files to exclude
+ from build
+
+ * TODO: modified - removed files from TODO list
+ that were stubbed above
+
+ * System.Data/DataColumn.cs
+ * System.Data/DataRow.cs: modified - various tweaks
+ and added internal method SetTable to set the reference
+ to a DataTable
+
+ * System.Data/DataSet.cs: modified - class was not
+ completely stubbed.
+
+ * System.Data/DataTable.cs: modified - temporarily commented
+ DataSet and DataView references - trying to compile a SqlDataReader,
+ DataTable, and dependencies for a forward read-only result set.
+ SqlDataAdapter, DataSet, and DataView will come later once we can get
+ a forward read only result set working.
+
+ * System.Data/IDataRecord.cs: modified - source code lines should
+ not be > 80
+
+ * System.Data/InternalDataCollectionBase.cs: modified - started
+ implementing this base class for collection of data rows,
+ columns, tables, relations, and constraints
+
+ * System.Data.SqlClient/SqlException.cs: modified -
+ call base(message) so a unhandled exception displays
+ the message of a SQL error instead of the
+ default SystemException message
+
+ * Test/TestSqlException.cs: modified -
+ handle the rollback properly for a SqlException on a
+ failure to connect
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: modified - added new
+ files to exclude from build
+
+ * System.Data/Constraint.cs
+ * System.Data/ConstraintCollection.cs
+ * System.Data/InternalDataCollectionBase.cs: added -
+ stubs which are needed to build DataTable.cs
+
+ * TODO: modified - added more classes TODO and
+ added more stuff TODO, such as, create script
+ to create test database monotestdb for testing
+ classes in System.Data
+
+2002-04-23 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataPermission.cs:
+ * System.Data.Common/DbDataPermissionAttribute.cs: some
+ compilation errors fixed.
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * TODO: modified - added classes TODO, and
+ a poor attempt at System.Data plan
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * ChangeLog: modified - put tabs where they belong
+
+ * System.Data.SqlClient/SqlDataReader.cs
+ * System.Data/DataColumn.cs: modified - compile errors
+ trying to compile SqlDataAdapter and dependencies
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlTypes/SqlBoolean.cs
+ * System.Data.SqlTypes/SqlCompareOptions.cs
+ * System.Data.SqlTypes/SqlInt32.cs
+ * System.Data.SqlTypes/SqlString.cs: added - new stubs
+
+ * System.Data/DataTable.cs
+ * System.Data.SqlClient/SqlCommand.cs
+ * System.Data.SqlClient/SqlConnection.cs
+ * System.Data.SqlClient/SqlError.cs
+ * System.Data.SqlClient/SqlTransaction.cs: modified -
+ misc. tweaks
+
+ * System.Data.SqlClient/SqlException.cs: modified -
+ missing Message on indexer for Message property
+
+2002-04-21 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: modified - to
+ compile using mcs. This problem is
+ returning a stronger type in csc vs. msc
+
+ * System.Data.SqlClient/SqlConnection.cs: modified - msc
+ can not do a using PGconn = IntPtr; and then declare
+ with PGconn pgConn = IntPtr.Zero;
+ Thiw works under csc though. Had to comment using and
+ changed declaration to IntPtr pgConn = IntPtr.Zero;
+ Also, got rid of compile warnings for hostaddr and port.
+
+ * System.Data.SqlClient/SqlErrorCollection.cs: modified - got
+ rid of compile warnings. Commented MonoTODO attribute because mcs
+ doesn't seem to work with C# array property indexer (Item)
+ this[int index]
+
+ * System.Data.SqlClient/SqlParameterCollection.cs: modified -
+ commented MonoTODO attribute for indexer for mcs compiling
+
+ * Test/TestSqlIsolationLevel.cs:
+ * Test/TestSqlInsert.cs:
+ * Test/TestSqlException.cs: modified -
+ removed extra ExecuteNonQuery which caused two inserted rows
+
+2002-04-20 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/StateChangeEventArgs.cs - added
+ needed to compile System.Data.dll with mcs.
+
+2002-04-20 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.OleDb: added directory - for OleDb database
+ provider classes
+
+ * System.Data.SqlClient/SqlClientPermission.cs
+ * System.Data.SqlClient/SqlClientPermissionAttribute.cs
+ * System.Data.SqlClient/SqlCommandBuilder.cs
+ * System.Data.SqlClient/SqlInfoMessageEventHandler.cs
+ * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
+ * System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
+ * System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
+ * Test/TestSqlException.cs
+ * Test/TestSqlIsolationLevel.cs: added - more tests
+
+ * System.Data.build: modified - added new files - excludes these too
+
+ * System.Data.SqlClient/PostgresLibrary.cs - modified - comment
+
+ * System.Data.SqlClient/SqlConnection.cs
+ * System.Data.SqlClient/SqlCommand.cs
+ * System.Data.SqlClient/SqlTransaction.cs
+ * System.Data.SqlClient/SqlException.cs
+ * System.Data.SqlClient/SqlErrorCollection.cs
+ * System.Data.SqlClient/SqlError.cs: modified - transaction and
+ exception/error handling. SqlConnection(connectionString)
+ constructor should not automatically connect.
+
+ * System.Data.SqlClient/SqlDataReader.cs
+ * System.Data.SqlClient/SqlDataAdapter.cs
+ * System.Data.SqlClient/SqlParameter.cs
+ * System.Data.SqlClient/SqlParameterCollection.cs: modified -
+ added using System.ComponentModel;
+
+ * Test/TestSqlInsert.cs: modified - to use transaction
+
+2002-04-17 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataRow.cs: new skeletons.
+
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataTableMapping.cs:
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataAdapter.cs:
+ * System.Data.Common/RowUpdatedEventArgs.cs:
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs: compilation
+ fixes for Linux.
+
+ * System.Data.Common/DbDataRecord.cs:
+ * System.Data.Common/DbEnumerator.cs: removed MS implementation
+ internal classes.
+
+2002-04-17 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestSqlInsert.cs: modified - do
+ a SQL DELETE before SQL INSERT of row so you can use this
+ test over and over.
+
+ * System.Data.SqlClient/SqlTransaction.cs: modified - default
+ IsolationLevel for PostgreSQL is ReadCommitted. However,
+ PostgreSQL allows Serializable as well.
+ (Thanks to Gonzalo for that!)
+
+ * System.Data.SqlClient/SqlConnection.cs: modified
+ * System.Data.SqlClient/SqlCommand.cs: modified
+ * System.Data.SqlClient/SqlTransaction.cs: modified - got transactions
+ working; however, we still need to implement SQL errors
+ and exceptions to properly handle transactions. Also, added
+ status and error message support from the PostgreSQL database.
+ Currently, this does a Console.WriteLine() to display the
+ status and error messages, but this is a TODO
+ for SQL errors and exceptions.
+
+ * System.Data/TODOAttribute.cs: added - needed MonoTODO
+ attribute for System.Data.dll assembly
+
+ * System.Data/IDbCommand.cs: modified - commented
+ overloaded method ExecuteReader
+ so System.Data.SqlClient.SqlCommand can compile
+
+ * System.Data/IDbCommand.cs: modified
+ * System.Data/IDbConnection.cs: modified - added using System;
+ * System.Data/IDataParameter.cs
+
+ * System.Data.build: modified - build classes
+ in System.Data.SqlClient and exclude others in System.Data
+
+ * System.Data.SqlClient/PostgresLibrary.cs: modified - change
+ parameter data type from IntPtr to enum ExecStatusType
+
+ * ChangeLog: modified - corrected previous entries in log
+
+2002-04-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataColumnMappingCollection.cs: added basic
+ implementation. Still missing some stuff.
+
+2002-04-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: modified - got
+ to compile, run, and connect to PostgreSQL database
+
+ * System.Data.SqlClient/SqlCommand.cs: modified - got
+ to compile, run, and execute a SQL INSERT command
+ which successfully inserted a row
+ into the PostgreSQL database
+
+ * System.Data.SqlClient/SqlTransaction.cs: modified
+ * System.Data.SqlClient/SqlParameter.cs: modified
+ * System.Data.SqlClient/SqlParameterCollection.cs: modified
+ * System.Data.SqlClient/SqlError.cs: modified
+ * System.Data.SqlClient/SqlErrorCollection.cs: modified
+ * System.Data.SqlClient/SqlException.cs: modified
+ * System.Data.SqlClient/PostgresLibrary.cs: modified - to compile
+
+ * System.Data.SqlClient/SqlAdapter: modified
+ * System.Data.SqlClient/SqlReader: modified - add more stubs
+
+2002-04-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestSqlInsert.cs: added
+
+2002-04-15 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs: added - using in
+ class SqlConnecition
+ * System.Data.SqlClient/SqlErrorCollection.cs: added
+ * System.Data.SqlClient/SqlErrors.cs: removed - no such class SqlErrors
+
+2002-04-15 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * System.Data.IDbDataParameter: Added Interface to IDataParameter.
+ * System.Data.IDbTransaction: Added Interface to IDisposable.
+ * System.Data.IDbCommand: Fixed Capitalization of class name.
+ * System.Data.IDbConnection: Fixed Capitalization of class name.
+
+2002-04-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DbDataPermissionAttribute.cs:
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DbDataPermission.cs: added some implementation.
+
+2002-04-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: fixed constructor chaining
+ syntax, as pointed out by Levent Camlibel.
+
+2002-04-14 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/INullable.cs: new skeletons.
+
+2002-04-14 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/PostgresLibrary.cs: new internal class, which
+ contains all calls the the PostgreSQL client library, to be used
+ everywhere in System.Data.SqlClient.
+
+2002-03-30 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: implemented basic
+ constructors.
+
+ * System.Data.SqlTypes/SqlNullValueException.cs: new skeletons.
+
+2002-03-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DbDataRecord.cs:
+ * System.Data.Common/DbEnumerator.cs:
+ * System.Data.Common/RowUpdatedEventArgs.cs:
+ * System.Data.Common/RowUpdatingEventArgs.cs:
+ * System.Data.Common/DbDataPermissionAttribute.cs: new skeletons.
+
+2002-03-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataAdapter.cs:
+ * System.Data.Common/DbDataPermission.cs:
+ * System.Data.Common/DataTableMapping.cs: new skeletons.
+
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlDataReader.cs:
+ * System.Data.SqlClient/SqlErrors.cs:
+ * System.Data.SqlClient/SqlError.cs:
+ * System.Data.SqlClient/SqlException.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ * System.Data.SqlClient/SqlCommand.cs: fixed skeletons.
+
+2002-03-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataAdapter.cs: created skeletons.
+
+ * System.Data.build: exclude new directories from build.
+
+2002-03-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlTransaction.cs: started implementation.
+
+ * System.Data.SqlClient/SqlConnection.cs (BeginTransaction):
+ implemented (2 methods).
+
+2002-03-24 Duncan Mak <duncan@ximian.com>
+
+ * System.Data.build: Excluded System.Data.SqlClient from the build.
+ The stubs are incomplete and they are stopping the build.
+
+ * System.Data.SqlClient/SqlCommand.cs: Replaced 'implements' with ':'.
+
+2002-03-24 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/*: added skeletons for the SQL managed
+ provider for ADO.Net, to be based initially in PostgreSQL.
+
+2002-03-15 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ Changed the Namespace on some Enums from mono.System.Data to System.Data
+
+2002-03-01 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * DataColumnCollection.cs : When an existing DataColumn is added, will now Assign a
+ default name if the ColumnName is null.
+ * DataSet.cs : Added
+ * DataTable.cs : Added
+ * DataRelationCollection.cs : Added
+ * DataTableRelationCollection.cs : Added
+ * DataColumn : Added
+
+2002-02-11 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * DataColumnChangeEventArgs.cs : Added
+ * DataColumnCollection.cs : Added
+
+2002-02-10 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * Removed *.cs from System.Data as the correct files are in mcs/class/System.Data/System.Data
+ * Updated all Enums, Interfaces, and Delegates in System.Data
diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog
new file mode 100755
index 00000000000..f911be6e884
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/ChangeLog
@@ -0,0 +1,18 @@
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DbDataRecord.cs: return DbNull.Value in GetValue () if value is null.
+
+2002-10-31 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SchemaInfo.cs: added missing properties to fix mcs build
+
+2002-05-05 Miguel de Icaza <miguel@ximian.com>
+
+ * DataTableMapping.cs, DataTableMappingCollection.cs: comment out
+ interfaces we do not implement yet.
+
+ * DbDataAdapter.cs: Stub IEnumerable, comment out interfaces
+ we do not implement yet.
+
+ * DbDataPermissionAttribute.cs: call base constructor.
+
diff --git a/mcs/class/System.Data/System.Data.Common/DataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DataAdapter.cs
new file mode 100644
index 00000000000..9b507ea0fda
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataAdapter.cs
@@ -0,0 +1,127 @@
+//
+// System.Data.Common.DataAdapter
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Represents a set of data commands and a database connection that are used to fill the DataSet and update the data source.
+ /// </summary>
+ public abstract class DataAdapter : Component, IDataAdapter
+ {
+ #region Fields
+
+ private bool acceptChangesDuringFill;
+ private bool continueUpdateOnError;
+ private MissingMappingAction missingMappingAction;
+ private MissingSchemaAction missingSchemaAction;
+ private DataTableMappingCollection tableMappings;
+
+ #endregion
+
+ #region Constructors
+
+ protected DataAdapter ()
+ {
+ acceptChangesDuringFill = true;
+ continueUpdateOnError = false;
+ missingMappingAction = MissingMappingAction.Passthrough;
+ missingSchemaAction = MissingSchemaAction.Add;
+ tableMappings = new DataTableMappingCollection ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DataCategory ("Fill")]
+ [DataSysDescription ("Whether or not Fill will call DataRow.AcceptChanges.")]
+ [DefaultValue (true)]
+ public bool AcceptChangesDuringFill {
+ get { return acceptChangesDuringFill; }
+ set { acceptChangesDuringFill = value; }
+ }
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Whether or not to continue to the next DataRow when the Update events, RowUpdating and RowUpdated, Status is UpdateStatus.ErrorsOccurred.")]
+ [DefaultValue (false)]
+ public bool ContinueUpdateOnError {
+ get { return continueUpdateOnError; }
+ set { continueUpdateOnError = value; }
+ }
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ [DataCategory ("Mapping")]
+ [DataSysDescription ("The action taken when a table or column in the TableMappings is missing.")]
+ [DefaultValue (MissingMappingAction.Passthrough)]
+ public MissingMappingAction MissingMappingAction {
+ get { return missingMappingAction; }
+ set { missingMappingAction = value; }
+ }
+
+ [DataCategory ("Mapping")]
+ [DataSysDescription ("The action taken when a table or column in the DataSet is missing.")]
+ [DefaultValue (MissingSchemaAction.Add)]
+ public MissingSchemaAction MissingSchemaAction {
+ get { return missingSchemaAction; }
+ set { missingSchemaAction = value; }
+ }
+
+ [DataCategory ("Mapping")]
+ [DataSysDescription ("How to map source table to DataSet table.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public DataTableMappingCollection TableMappings {
+ get { return tableMappings; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ protected virtual DataAdapter CloneInternals ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual DataTableMappingCollection CreateTableMappings ()
+ {
+ tableMappings = new DataTableMappingCollection ();
+ return tableMappings;
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract int Fill (DataSet dataSet);
+ public abstract DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType);
+ public abstract IDataParameter[] GetFillParameters ();
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeTableMappings ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract int Update (DataSet dataSet);
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs
new file mode 100644
index 00000000000..e25bb52cf09
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs
@@ -0,0 +1,85 @@
+//
+// System.Data.Common.DataColumnMapping
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common {
+ public sealed class DataColumnMapping : MarshalByRefObject, IColumnMapping, ICloneable
+ {
+ #region Fields
+
+ string sourceColumn;
+ string dataSetColumn;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataColumnMapping ()
+ {
+ sourceColumn = String.Empty;
+ dataSetColumn = String.Empty;
+ }
+
+ public DataColumnMapping (string sourceColumn, string dataSetColumn)
+ {
+ this.sourceColumn = sourceColumn;
+ this.dataSetColumn = dataSetColumn;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataSysDescription ("DataColumn.ColumnName")]
+ [DefaultValue ("")]
+ public string DataSetColumn {
+ get { return dataSetColumn; }
+ set { dataSetColumn = value; }
+ }
+
+ [DataSysDescription ("Source column name - case sensitive.")]
+ [DefaultValue ("")]
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public DataColumn GetDataColumnBySchemaAction (DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)
+ {
+ if (dataTable.Columns.Contains (dataSetColumn))
+ return dataTable.Columns [dataSetColumn];
+ if (schemaAction == MissingSchemaAction.Ignore)
+ return null;
+ if (schemaAction == MissingSchemaAction.Error)
+ throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", DataSetColumn, dataTable.TableName, SourceColumn));
+ return new DataColumn (dataSetColumn, dataType);
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new DataColumnMapping (SourceColumn, DataSetColumn);
+ }
+
+ public override string ToString ()
+ {
+ return SourceColumn;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs
new file mode 100644
index 00000000000..83dfdefc6e4
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs
@@ -0,0 +1,220 @@
+//
+// System.Data.Common.DataColumnMappingCollection
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common {
+ public sealed class DataColumnMappingCollection : MarshalByRefObject, IColumnMappingCollection , IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+ Hashtable sourceColumns;
+ Hashtable dataSetColumns;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataColumnMappingCollection ()
+ {
+ list = new ArrayList ();
+ sourceColumns = new Hashtable ();
+ dataSetColumns = new Hashtable ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [Browsable (false)]
+ [DataSysDescription ("The number of items in the collection")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int Count {
+ get { return list.Count; }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The specified DataColumnMapping object.")]
+ public DataColumnMapping this [int index] {
+ get { return (DataColumnMapping)(list[index]); }
+ set {
+ DataColumnMapping mapping = (DataColumnMapping)(list[index]);
+ sourceColumns[mapping] = value;
+ dataSetColumns[mapping] = value;
+ list[index] = value;
+ }
+ }
+
+ public DataColumnMapping this [string sourceColumn] {
+ get { return (DataColumnMapping) sourceColumns[sourceColumn]; }
+ set { this [list.IndexOf (sourceColumns[sourceColumn])] = value; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object IColumnMappingCollection.this [string sourceColumn] {
+ get { return this [sourceColumn]; }
+ set {
+ if (!(value is DataColumnMapping))
+ throw new ArgumentException ();
+ this [sourceColumn] = (DataColumnMapping) value;
+ }
+ }
+
+ object IList.this [int index] {
+ get { return this[index]; }
+ set {
+ if (!(value is DataColumnMapping))
+ throw new ArgumentException ();
+ this [index] = (DataColumnMapping) value;
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ if (!(value is DataColumnMapping))
+ throw new InvalidCastException ();
+
+ list.Add (value);
+ sourceColumns[((DataColumnMapping)value).SourceColumn] = value;
+ dataSetColumns[((DataColumnMapping)value).DataSetColumn] = value;
+ return list.IndexOf (value);
+ }
+
+ public DataColumnMapping Add (string sourceColumn, string dataSetColumn)
+ {
+ DataColumnMapping mapping = new DataColumnMapping (sourceColumn, dataSetColumn);
+ Add (mapping);
+ return mapping;
+ }
+
+ public void AddRange (DataColumnMapping[] values)
+ {
+ foreach (DataColumnMapping mapping in values)
+ Add (mapping);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ return (list.Contains (value));
+ }
+
+ public bool Contains (string value)
+ {
+ return (sourceColumns.Contains (value));
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ ((DataColumn[])(list.ToArray())).CopyTo (array, index);
+ }
+
+ public DataColumnMapping GetByDataSetColumn (string value)
+ {
+ return (DataColumnMapping)(dataSetColumns[value]);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public static DataColumnMapping GetColumnMappingBySchemaAction (DataColumnMappingCollection columnMappings, string sourceColumn, MissingMappingAction mappingAction)
+ {
+ if (columnMappings.Contains (sourceColumn))
+ return columnMappings[sourceColumn];
+ if (mappingAction == MissingMappingAction.Ignore)
+ return null;
+ if (mappingAction == MissingMappingAction.Error)
+ throw new InvalidOperationException (String.Format ("Missing SourceColumn mapping for '{0}'", sourceColumn));
+ return new DataColumnMapping (sourceColumn, sourceColumn);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ IColumnMapping IColumnMappingCollection.Add (string sourceColumnName, string dataSetColumnName)
+ {
+ return Add (sourceColumnName, dataSetColumnName);
+ }
+
+ IColumnMapping IColumnMappingCollection.GetByDataSetColumn (string dataSetColumnName)
+ {
+ return GetByDataSetColumn (dataSetColumnName);
+ }
+
+ public int IndexOf (object value)
+ {
+ return list.IndexOf (value);
+ }
+
+ public int IndexOf (string sourceColumn)
+ {
+ return list.IndexOf (sourceColumns[sourceColumn]);
+ }
+
+ public int IndexOfDataSetColumn (string value)
+ {
+ return list.IndexOf (dataSetColumns[value]);
+ }
+
+ public void Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ sourceColumns[((DataColumnMapping)value).SourceColumn] = value;
+ dataSetColumns[((DataColumnMapping)value).DataSetColumn] = value;
+ }
+
+ public void Remove (object value)
+ {
+ sourceColumns.Remove(((DataColumnMapping)value).SourceColumn);
+ dataSetColumns.Remove(((DataColumnMapping)value).DataSetColumn);
+ list.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ Remove (list[index]);
+ }
+
+ public void RemoveAt (string sourceColumn)
+ {
+ RemoveAt (list.IndexOf (sourceColumns[sourceColumn]));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs
new file mode 100644
index 00000000000..04f3dcaebc8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs
@@ -0,0 +1,110 @@
+//
+// System.Data.Common.DataTableMapping.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common {
+ public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable
+ {
+ #region Fields
+
+ string sourceTable;
+ string dataSetTable;
+ DataColumnMappingCollection columnMappings;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataTableMapping ()
+ {
+ dataSetTable = String.Empty;
+ sourceTable = String.Empty;
+ columnMappings = new DataColumnMappingCollection ();
+ }
+
+ public DataTableMapping (string sourceTable, string dataSetTable)
+ : this ()
+ {
+ this.sourceTable = sourceTable;
+ this.dataSetTable = dataSetTable;
+ }
+
+ public DataTableMapping (string sourceTable, string dataSetTable, DataColumnMapping[] columnMappings)
+ : this (sourceTable, dataSetTable)
+ {
+ this.columnMappings.AddRange (columnMappings);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataSysDescription ("Individual columns mappings when this table mapping is matched.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public DataColumnMappingCollection ColumnMappings {
+ get { return columnMappings; }
+ }
+
+ [DataSysDescription ("DataTable.TableName")]
+ [DefaultValue ("")]
+ public string DataSetTable {
+ get { return dataSetTable; }
+ set { dataSetTable = value; }
+ }
+
+ IColumnMappingCollection ITableMapping.ColumnMappings {
+ get { return ColumnMappings; }
+ }
+
+ [DataSysDescription ("The DataTableMapping source table name. This name is case sensitive.")]
+ [DefaultValue ("")]
+ public string SourceTable {
+ get { return sourceTable; }
+ set { sourceTable = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction)
+ {
+ return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction)
+ {
+ if (dataSet.Tables.Contains (DataSetTable))
+ return dataSet.Tables [DataSetTable];
+ if (schemaAction == MissingSchemaAction.Ignore)
+ return null;
+ if (schemaAction == MissingSchemaAction.Error)
+ throw new InvalidOperationException (String.Format ("Missing the '{0} DataTable for the '{1}' SourceTable", DataSetTable, SourceTable));
+ return new DataTable (DataSetTable);
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new DataTableMapping (SourceTable, DataSetTable);
+ }
+
+ public override string ToString ()
+ {
+ return SourceTable;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs
new file mode 100644
index 00000000000..30d71ff489a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs
@@ -0,0 +1,222 @@
+//
+// System.Data.Common.DataTableMappingCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data.Common {
+ [ListBindable (false)]
+ public sealed class DataTableMappingCollection : MarshalByRefObject, ITableMappingCollection, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList mappings;
+ Hashtable sourceTables;
+ Hashtable dataSetTables;
+
+ #endregion
+
+ #region Constructors
+
+ public DataTableMappingCollection()
+ {
+ mappings = new ArrayList ();
+ sourceTables = new Hashtable ();
+ dataSetTables = new Hashtable ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataSysDescription ("The number of items in the collection")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int Count {
+ get { return mappings.Count; }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The specified DataTableMapping object")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DataTableMapping this [int index] {
+ get { return (DataTableMapping)(mappings[index]); }
+ set {
+ DataTableMapping mapping = (DataTableMapping) mappings[index];
+ sourceTables [mapping.SourceTable] = value;
+ dataSetTables [mapping.DataSetTable] = value;
+ mappings [index] = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The specified DataTableMapping object")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DataTableMapping this [string sourceTable] {
+ get { return (DataTableMapping) sourceTables[sourceTable]; }
+ set { this [mappings.IndexOf (sourceTables[sourceTable])] = value; }
+ }
+
+ object IList.this [int index] {
+ get { return (object)(this[index]); }
+ set {
+ if (!(value is DataTableMapping))
+ throw new ArgumentException ();
+ this[index] = (DataTableMapping)value;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return mappings.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return mappings.SyncRoot; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ object ITableMappingCollection.this [string sourceTable] {
+ get { return this [sourceTable]; }
+ set {
+ if (!(value is DataTableMapping))
+ throw new ArgumentException ();
+ this [sourceTable] = (DataTableMapping) value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ if (!(value is System.Data.Common.DataTableMapping))
+ throw new SystemException ("The object passed in was not a DataTableMapping object.");
+
+ sourceTables[((DataTableMapping)value).SourceTable] = value;
+ dataSetTables[((DataTableMapping)value).DataSetTable] = value;
+ return mappings.Add (value);
+ }
+
+ public DataTableMapping Add (string sourceTable, string dataSetTable)
+ {
+ DataTableMapping mapping = new DataTableMapping (sourceTable, dataSetTable);
+ Add (mapping);
+ return mapping;
+ }
+
+ public void AddRange (DataTableMapping[] values)
+ {
+ foreach (DataTableMapping dataTableMapping in values)
+ this.Add (dataTableMapping);
+ }
+
+ public void Clear ()
+ {
+ sourceTables.Clear ();
+ dataSetTables.Clear ();
+ mappings.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ return mappings.Contains (value);
+ }
+
+ public bool Contains (string value)
+ {
+ return sourceTables.Contains (value);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ mappings.CopyTo (array, index);
+ }
+
+ public DataTableMapping GetByDataSetTable (string dataSetTable)
+ {
+ return (DataTableMapping)(dataSetTables[dataSetTable]);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public static DataTableMapping GetTableMappingBySchemaAction (DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction)
+ {
+ if (tableMappings.Contains (sourceTable))
+ return tableMappings[sourceTable];
+ if (mappingAction == MissingMappingAction.Error)
+ throw new InvalidOperationException ();
+ if (mappingAction == MissingMappingAction.Ignore)
+ return null;
+ return new DataTableMapping (sourceTable, dataSetTable);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return mappings.GetEnumerator ();
+ }
+
+ public int IndexOf (object value)
+ {
+ return mappings.IndexOf (value);
+ }
+
+ public int IndexOf (string sourceTable)
+ {
+ return IndexOf (sourceTables[sourceTable]);
+ }
+
+ public int IndexOfDataSetTable (string dataSetTable)
+ {
+ return IndexOf ((DataTableMapping)(dataSetTables[dataSetTable]));
+ }
+
+ public void Insert (int index, object value)
+ {
+ mappings.Insert (index, value);
+ }
+
+ ITableMapping ITableMappingCollection.Add (string sourceTableName, string dataSetTableName)
+ {
+ ITableMapping tableMapping = new DataTableMapping (sourceTableName, dataSetTableName);
+ Add (tableMapping);
+ return tableMapping;
+ }
+
+ ITableMapping ITableMappingCollection.GetByDataSetTable (string dataSetTableName)
+ {
+ return this [mappings.IndexOf (dataSetTables [dataSetTableName])];
+ }
+
+ public void Remove (object value)
+ {
+ mappings.Remove ((DataTableMapping) value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ mappings.RemoveAt (index);
+ }
+
+ public void RemoveAt (string sourceTable)
+ {
+ RemoveAt (mappings.IndexOf (sourceTables[sourceTable]));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
new file mode 100644
index 00000000000..4402b1b06eb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
@@ -0,0 +1,468 @@
+//
+// System.Data.Common.DbDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common {
+ public abstract class DbDataAdapter : DataAdapter, ICloneable
+ {
+ #region Fields
+
+ public const string DefaultSourceTableName = "Table";
+ const string DefaultSourceColumnName = "Column";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected DbDataAdapter()
+ {
+ }
+
+ #endregion // Fields
+
+ #region Properties
+
+ IDbCommand DeleteCommand {
+ get { return ((IDbDataAdapter) this).DeleteCommand; }
+ }
+
+ IDbCommand InsertCommand {
+ get { return ((IDbDataAdapter) this).InsertCommand; }
+ }
+
+ IDbCommand SelectCommand {
+ get { return ((IDbDataAdapter) this).SelectCommand; }
+ }
+
+
+ IDbCommand UpdateCommand {
+ get { return ((IDbDataAdapter) this).UpdateCommand; }
+ }
+
+ #endregion // Properties
+
+ #region Events
+
+ [DataCategory ("Fill")]
+ [DataSysDescription ("Event triggered when a recoverable error occurs during Fill.")]
+ public event FillErrorEventHandler FillError;
+
+ #endregion // Events
+
+ #region Methods
+
+ protected abstract RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping);
+ protected abstract RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping);
+
+ private FillErrorEventArgs CreateFillErrorEvent (DataTable dataTable, object[] values, Exception e)
+ {
+ FillErrorEventArgs args = new FillErrorEventArgs (dataTable, values);
+ args.Errors = e;
+ args.Continue = false;
+ return args;
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ }
+
+ public override int Fill (DataSet dataSet)
+ {
+ return Fill (dataSet, 0, 0, DefaultSourceTableName, SelectCommand, CommandBehavior.Default);
+ }
+
+ public int Fill (DataTable dataTable)
+ {
+ if (dataTable == null)
+ throw new NullReferenceException ();
+
+ return Fill (dataTable, SelectCommand, CommandBehavior.Default);
+ }
+
+ public int Fill (DataSet dataSet, string srcTable)
+ {
+ return Fill (dataSet, 0, 0, srcTable, SelectCommand, CommandBehavior.Default);
+ }
+
+ [MonoTODO ("Support filling after we have already filled.")]
+ protected virtual int Fill (DataTable dataTable, IDataReader dataReader)
+ {
+ int count = 0;
+ bool doContinue = true;
+
+ object[] itemArray = new object [dataReader.FieldCount];
+ SetupSchema (SchemaType.Mapped, dataTable.TableName, dataTable); // FIXME
+ BuildSchema (dataReader, dataTable, SchemaType.Mapped);
+
+ while (doContinue && dataReader.Read ()) {
+ dataReader.GetValues (itemArray);
+ try {
+ dataTable.BeginLoadData ();
+ dataTable.LoadDataRow (itemArray, AcceptChangesDuringFill);
+ dataTable.EndLoadData ();
+ count += 1;
+ }
+ catch (Exception e) {
+ FillErrorEventArgs args = CreateFillErrorEvent (dataTable, itemArray, e);
+ OnFillError (args);
+ doContinue = args.Continue;
+ }
+ }
+ dataReader.Close ();
+
+ return count;
+ }
+
+ protected virtual int Fill (DataTable dataTable, IDbCommand command, CommandBehavior behavior)
+ {
+ return Fill (dataTable, command.ExecuteReader (behavior));
+ }
+
+ public int Fill (DataSet dataSet, int startRecord, int maxRecords, string srcTable)
+ {
+ return this.Fill (dataSet, startRecord, maxRecords, srcTable, SelectCommand, CommandBehavior.Default);
+ }
+
+ [MonoTODO ("Support filling after we have already filled.")]
+ protected virtual int Fill (DataSet dataSet, string srcTable, IDataReader dataReader, int startRecord, int maxRecords)
+ {
+ if (startRecord < 0)
+ throw new ArgumentException ("The startRecord parameter was less than 0.");
+ if (maxRecords < 0)
+ throw new ArgumentException ("The maxRecords parameter was less than 0.");
+
+ DataTable dataTable;
+ int resultIndex = 0;
+ int count = 0;
+ bool doContinue = true;
+
+ string tableName = srcTable;
+ object[] itemArray = new object [dataReader.FieldCount];
+
+ do {
+ dataTable = new DataTable ();
+ SetupSchema (SchemaType.Mapped, tableName, dataTable);
+
+ if (dataSet.Tables.Contains (dataTable.TableName))
+ dataTable = dataSet.Tables [tableName];
+ BuildSchema (dataReader, dataTable, SchemaType.Mapped);
+
+ for (int i = 0; i < startRecord; i += 1)
+ dataReader.Read ();
+
+ while (doContinue && dataReader.Read () && !(maxRecords > 0 && count >= maxRecords)) {
+ dataReader.GetValues (itemArray);
+ try {
+ dataTable.BeginLoadData ();
+ dataTable.LoadDataRow (itemArray, AcceptChangesDuringFill);
+ dataTable.EndLoadData ();
+ count += 1;
+ }
+ catch (Exception e) {
+ FillErrorEventArgs args = CreateFillErrorEvent (dataTable, itemArray, e);
+ OnFillError (args);
+ doContinue = args.Continue;
+ }
+ }
+
+ if (dataTable.Rows.Count > 0) {
+ dataSet.Tables.Add (dataTable);
+ tableName = String.Format ("{0}{1}", srcTable, ++resultIndex);
+ }
+
+ startRecord = 0;
+ maxRecords = 0;
+
+ } while (doContinue && dataReader.NextResult ());
+
+ dataReader.Close ();
+
+ return count;
+ }
+
+
+ protected virtual int Fill (DataSet dataSet, int startRecord, int maxRecords, string srcTable, IDbCommand command, CommandBehavior behavior)
+ {
+ CommandBehavior commandBehavior = behavior;
+ if (command.Connection.State == ConnectionState.Closed) {
+ command.Connection.Open ();
+ commandBehavior |= CommandBehavior.CloseConnection;
+ }
+ return Fill (dataSet, srcTable, command.ExecuteReader (commandBehavior), startRecord, maxRecords);
+ }
+
+ public override DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType)
+ {
+ return FillSchema (dataSet, schemaType, SelectCommand, DefaultSourceTableName, CommandBehavior.Default);
+ }
+
+ public DataTable FillSchema (DataTable dataTable, SchemaType schemaType)
+ {
+ return FillSchema (dataTable, schemaType, SelectCommand, CommandBehavior.Default);
+ }
+
+ public DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType, string srcTable)
+ {
+ return FillSchema (dataSet, schemaType, SelectCommand, srcTable, CommandBehavior.Default);
+ }
+
+ [MonoTODO ("Verify")]
+ protected virtual DataTable FillSchema (DataTable dataTable, SchemaType schemaType, IDbCommand command, CommandBehavior behavior)
+ {
+ DataTable table;
+ behavior |= CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo;
+ if (command.Connection.State == ConnectionState.Closed) {
+ command.Connection.Open ();
+ behavior |= CommandBehavior.CloseConnection;
+ }
+
+ IDataReader reader = command.ExecuteReader (behavior);
+ table = new DataTable ();
+ SetupSchema (schemaType, DefaultSourceTableName, table);
+ BuildSchema (reader, table, schemaType);
+
+ reader.Close ();
+ return table;
+ }
+
+ [MonoTODO ("Verify")]
+ protected virtual DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType, IDbCommand command, string srcTable, CommandBehavior behavior)
+ {
+ behavior |= CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo;
+ if (command.Connection.State == ConnectionState.Closed) {
+ command.Connection.Open ();
+ behavior |= CommandBehavior.CloseConnection;
+ }
+
+ IDataReader reader = command.ExecuteReader (behavior);
+ ArrayList output = new ArrayList ();
+ string tableName = srcTable;
+ int index = 0;
+
+ do {
+ DataTable table = new DataTable ();
+ SetupSchema (schemaType, tableName, table);
+ if (dataSet.Tables.Contains (table.TableName))
+ table = dataSet.Tables [table.TableName];
+ else
+ dataSet.Tables.Add (table);
+ BuildSchema (reader, table, schemaType);
+ output.Add (table);
+ tableName = String.Format ("{0}{1}", srcTable, ++index);
+ } while (reader.NextResult ());
+ reader.Close ();
+ return (DataTable[]) output.ToArray (typeof (DataTable));
+ }
+
+ private void SetupSchema (SchemaType schemaType, string sourceTableName, DataTable table)
+ {
+ DataTableMapping tableMapping = null;
+
+ if (schemaType == SchemaType.Mapped)
+ tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, sourceTableName, "", MissingMappingAction.Ignore);
+
+ if (tableMapping != null)
+ table.TableName = tableMapping.DataSetTable;
+ else
+ table.TableName = sourceTableName;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public override IDataParameter[] GetFillParameters ()
+ {
+ object[] parameters = new object [SelectCommand.Parameters.Count];
+ SelectCommand.Parameters.CopyTo (parameters, 0);
+ return (IDataParameter[]) parameters;
+ }
+
+ [MonoTODO ("Test")]
+ private void BuildSchema (IDataReader reader, DataTable table, SchemaType schemaType)
+ {
+ string sourceColumnName;
+ string sourceTableName;
+ string dsColumnName;
+
+ ArrayList primaryKey = new ArrayList ();
+ table.Columns.Clear ();
+
+ foreach (DataRow schemaRow in reader.GetSchemaTable ().Rows) {
+ // generate a unique column name in the dataset table.
+ if (schemaRow ["BaseColumnName"].Equals (DBNull.Value))
+ sourceColumnName = DefaultSourceColumnName;
+ else
+ sourceColumnName = (string) schemaRow ["BaseColumnName"];
+
+ dsColumnName = sourceColumnName;
+
+ for (int i = 1; table.Columns.Contains (dsColumnName); i += 1)
+ dsColumnName = String.Format ("{0}{1}", sourceColumnName, i);
+
+ if (schemaRow ["BaseTableName"].Equals (DBNull.Value))
+ sourceTableName = table.TableName;
+ else
+ sourceTableName = (string) schemaRow ["BaseTableName"];
+
+ DataTableMapping tableMapping = null;
+ if (schemaType == SchemaType.Mapped)
+ tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, sourceTableName, table.TableName, MissingMappingAction.Ignore);
+ if (tableMapping != null) {
+ table.TableName = tableMapping.DataSetTable;
+
+ // check to see if the column mapping exists
+ if (tableMapping.ColumnMappings.IndexOfDataSetColumn (dsColumnName) < 0) {
+ if (MissingSchemaAction == MissingSchemaAction.Error)
+ throw new SystemException ();
+ tableMapping.ColumnMappings.Add (sourceColumnName, dsColumnName);
+ }
+ if (!TableMappings.Contains (tableMapping))
+ TableMappings.Add (tableMapping);
+ }
+
+ table.Columns.Add (dsColumnName, (Type) schemaRow ["DataType"]);
+
+
+ if (!schemaRow["IsKey"].Equals (DBNull.Value))
+ if ((bool) (schemaRow ["IsKey"]))
+ primaryKey.Add (table.Columns [dsColumnName]);
+ }
+ if (MissingSchemaAction == MissingSchemaAction.AddWithKey && primaryKey.Count > 0)
+ table.PrimaryKey = (DataColumn[])(primaryKey.ToArray());
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update (DataRow[] dataRows)
+ {
+ throw new NotImplementedException (); // FIXME: Which mapping?
+ }
+
+ public override int Update (DataSet dataSet)
+ {
+ int result = 0;
+ foreach (DataTable table in dataSet.Tables)
+ result += Update (table);
+ return result;
+ }
+
+ public int Update (DataTable dataTable)
+ {
+ int index = TableMappings.IndexOfDataSetTable (dataTable.TableName);
+ if (index < 0)
+ throw new ArgumentException ();
+ return Update (dataTable, TableMappings [index]);
+ }
+
+ private int Update (DataTable dataTable, DataTableMapping tableMapping)
+ {
+ DataRow[] rows = new DataRow [dataTable.Rows.Count];
+ dataTable.Rows.CopyTo (rows, 0);
+ return Update (rows, tableMapping);
+ }
+
+ [MonoTODO]
+ protected virtual int Update (DataRow[] dataRows, DataTableMapping tableMapping)
+ {
+ int updateCount = 0;
+ foreach (DataRow row in dataRows) {
+ StatementType statementType = StatementType.Update;
+ IDbCommand command = null;
+ string commandName = String.Empty;
+ bool useCommandBuilder = false;
+
+ switch (row.RowState) {
+ case DataRowState.Added:
+ statementType = StatementType.Insert;
+ command = InsertCommand;
+ commandName = "Insert";
+ break;
+ case DataRowState.Deleted:
+ statementType = StatementType.Delete;
+ command = DeleteCommand;
+ commandName = "Delete";
+ break;
+ case DataRowState.Modified:
+ statementType = StatementType.Update;
+ command = UpdateCommand;
+ commandName = "Update";
+ break;
+ case DataRowState.Unchanged:
+ continue;
+ case DataRowState.Detached:
+ throw new NotImplementedException ();
+ }
+
+ if (command == null)
+ useCommandBuilder = true;
+
+ RowUpdatingEventArgs args = CreateRowUpdatingEvent (row, command, statementType, tableMapping);
+ OnRowUpdating (args);
+
+ if (args.Status == UpdateStatus.ErrorsOccurred)
+ throw (args.Errors);
+
+ if (command == null && args.Command != null)
+ command = args.Command;
+ else if (command == null)
+ throw new InvalidOperationException (String.Format ("Update requires a valid {0}Command when passed a DataRow collection with modified rows.", commandName));
+
+ if (!useCommandBuilder) {
+ DataColumnMappingCollection columnMappings = tableMapping.ColumnMappings;
+
+ foreach (IDataParameter parameter in command.Parameters) {
+ string dsColumnName = columnMappings [parameter.SourceColumn].DataSetColumn;
+ DataRowVersion rowVersion = DataRowVersion.Proposed;
+
+ // Parameter version is ignored for non-update commands
+ if (statementType == StatementType.Update)
+ rowVersion = parameter.SourceVersion;
+
+ parameter.Value = row [dsColumnName, rowVersion];
+ }
+ row.AcceptChanges ();
+ }
+ updateCount += command.ExecuteNonQuery ();
+
+ OnRowUpdated (CreateRowUpdatedEvent (row, command, statementType, tableMapping));
+ }
+ return updateCount;
+ }
+
+ public int Update (DataSet dataSet, string sourceTable)
+ {
+ int result = 0;
+ DataTableMapping tableMapping = TableMappings [sourceTable];
+ foreach (DataTable dataTable in dataSet.Tables)
+ result += Update (dataTable, tableMapping);
+ return result;
+ }
+
+ protected virtual void OnFillError (FillErrorEventArgs value)
+ {
+ if (FillError != null)
+ FillError (this, value);
+ }
+
+ protected abstract void OnRowUpdated (RowUpdatedEventArgs value);
+ protected abstract void OnRowUpdating (RowUpdatingEventArgs value);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
new file mode 100644
index 00000000000..0d157b60e6c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
@@ -0,0 +1,112 @@
+//
+// System.Data.Common.DbDataPermission.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Data.Common {
+ [Serializable]
+ public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ #region Fields
+
+ bool allowBlankPassword;
+ PermissionState state;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected DBDataPermission ()
+ : this (PermissionState.None, false)
+ {
+ }
+
+ protected DBDataPermission (PermissionState state)
+ : this (state, false)
+ {
+ }
+
+ public DBDataPermission (PermissionState state, bool allowBlankPassword)
+ {
+ this.state = state;
+ this.allowBlankPassword = allowBlankPassword;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowBlankPassword {
+ get { return allowBlankPassword; }
+ set { allowBlankPassword = value; }
+ }
+
+ internal PermissionState State {
+ get { return state; }
+ set { state = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override IPermission Copy ()
+ {
+ DBDataPermission copy = CreateInstance ();
+ copy.AllowBlankPassword = this.allowBlankPassword;
+ copy.State = this.state;
+ return copy;
+ }
+
+ protected virtual DBDataPermission CreateInstance ()
+ {
+ return (DBDataPermission) Activator.CreateInstance (this.GetType ());
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement securityElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool IsUnrestricted ()
+ {
+ return (state == PermissionState.Unrestricted);
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs
new file mode 100644
index 00000000000..02cff942be6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs
@@ -0,0 +1,47 @@
+//
+// System.Data.Common.DbDataPermissionAttribute.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Data.Common {
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method)]
+ [Serializable]
+ public abstract class DBDataPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ #region Fields
+
+ SecurityAction securityAction;
+ bool allowBlankPassword;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected DBDataPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ securityAction = action;
+ allowBlankPassword = false;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowBlankPassword {
+ get { return allowBlankPassword; }
+ set { allowBlankPassword = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs b/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs
new file mode 100644
index 00000000000..f627df6ba98
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataRecord.cs
@@ -0,0 +1,270 @@
+//
+// System.Data.Common.DbDataRecord.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common {
+ public class DbDataRecord : IDataRecord, ICustomTypeDescriptor
+ {
+ #region Fields
+
+ SchemaInfo[] schema;
+ object[] values;
+ int fieldCount;
+ FieldNameLookup lookup;
+
+ #endregion
+
+ #region Constructors
+
+ internal DbDataRecord (SchemaInfo[] schema, object[] values, FieldNameLookup lookup)
+ {
+ this.schema = schema;
+ this.lookup = lookup;
+ this.values = values;
+ this.fieldCount = values.Length;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int FieldCount {
+ get { return fieldCount; }
+ }
+
+ public object this [string name] {
+ get { return this [GetOrdinal (name)]; }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public object this [int index] {
+ get { return GetValue (index); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public bool GetBoolean (int i)
+ {
+ return (bool) GetValue (i);
+ }
+
+ public byte GetByte (int i)
+ {
+ return (byte) GetValue (i);
+ }
+
+ [MonoTODO]
+ public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public char GetChar (int i)
+ {
+ return (char) GetValue (i);
+ }
+
+ [MonoTODO]
+ public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDataReader GetData (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int i)
+ {
+ return schema[i].DataTypeName;
+ }
+
+ public DateTime GetDateTime (int i)
+ {
+ return (DateTime) GetValue (i);
+ }
+
+ public decimal GetDecimal (int i)
+ {
+ return (decimal) GetValue (i);
+ }
+
+ public double GetDouble (int i)
+ {
+ return (double) GetValue (i);
+ }
+
+ public Type GetFieldType (int i)
+ {
+ return schema[i].FieldType;
+ }
+
+ public float GetFloat (int i)
+ {
+ return (float) GetValue (i);
+ }
+
+ public Guid GetGuid (int i)
+ {
+ return (Guid) GetValue (i);
+ }
+
+ public short GetInt16 (int i)
+ {
+ return (short) GetValue (i);
+ }
+
+ public int GetInt32 (int i)
+ {
+ return (int) GetValue (i);
+ }
+
+ public long GetInt64 (int i)
+ {
+ return (long) GetValue (i);
+ }
+
+ public string GetName (int i)
+ {
+ return (string) lookup [i];
+ }
+
+ public int GetOrdinal (string name)
+ {
+ return lookup.IndexOf (name);
+ }
+
+ public string GetString (int i)
+ {
+ return (string) GetValue (i);
+ }
+
+ public object GetValue (int i)
+ {
+ object value = values [i];
+ if (value == null)
+ value = DBNull.Value;
+ return value;
+ }
+
+ [MonoTODO]
+ public int GetValues (object[] values)
+ {
+ object[] newArray = new object[this.values.Length];
+ values.CopyTo (newArray, 0);
+ return values.Length;
+ }
+
+ [MonoTODO]
+ AttributeCollection ICustomTypeDescriptor.GetAttributes ()
+ {
+ return new AttributeCollection(null);
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetClassName ()
+ {
+ return "";
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetComponentName ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ TypeConverter ICustomTypeDescriptor.GetConverter ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
+ {
+ return new EventDescriptorCollection(null);
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute[] attributes)
+ {
+ return new EventDescriptorCollection(null);
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
+ {
+ DataColumnPropertyDescriptor[] descriptors =
+ new DataColumnPropertyDescriptor[FieldCount];
+
+ DataColumnPropertyDescriptor descriptor;
+ DataColumn dataColumn;
+ for(int col = 0; col < FieldCount; col++) {
+ descriptor = new DataColumnPropertyDescriptor(
+ GetName(col), col, null);
+ descriptor.SetComponentType(typeof(DbDataRecord));
+ descriptor.SetPropertyType(GetFieldType(col));
+
+ descriptors[col] = descriptor;
+ }
+
+ return new PropertyDescriptorCollection (descriptors);
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute[] attributes)
+ {
+ PropertyDescriptorCollection descriptors;
+ descriptors = ((ICustomTypeDescriptor) this).GetProperties ();
+ // TODO: filter out descriptors which do not contain
+ // any of those attributes
+ // except, those descriptors
+ // that contain DefaultMemeberAttribute
+ return descriptors;
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
+ {
+ return this;
+ }
+
+ public bool IsDBNull (int i)
+ {
+ return GetValue (i) == null;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs b/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs
new file mode 100644
index 00000000000..39cded06a71
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbEnumerator.cs
@@ -0,0 +1,110 @@
+//
+// System.Data.SqlClient.DbEnumerator.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common {
+ public class DbEnumerator : IEnumerator
+ {
+ #region Fields
+
+ IDataReader reader;
+ bool closeReader;
+ SchemaInfo[] schema;
+ FieldNameLookup lookup;
+ int fieldCount;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DbEnumerator (IDataReader reader)
+ : this (reader, false)
+ {
+ }
+
+ public DbEnumerator (IDataReader reader, bool closeReader)
+ {
+ this.reader = reader;
+ this.closeReader = closeReader;
+ this.lookup = new FieldNameLookup ();
+ this.fieldCount = reader.FieldCount;
+ LoadSchema (reader.GetSchemaTable ());
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public object Current {
+ get {
+ object[] values = new object[fieldCount];
+ reader.GetValues (values);
+ return new DbDataRecord (schema, values, lookup);
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ private void LoadSchema (DataTable schemaTable)
+ {
+ schema = new SchemaInfo [fieldCount];
+ int index = 0;
+ foreach (DataRow row in schemaTable.Rows) {
+ SchemaInfo columnSchema = new SchemaInfo ();
+
+ lookup.Add ((string) row["ColumnName"]);
+
+ columnSchema.AllowDBNull = (bool) row ["AllowDBNull"];
+ columnSchema.ColumnName = row ["ColumnName"].ToString ();
+ columnSchema.ColumnOrdinal = (int) row ["ColumnOrdinal"];
+ columnSchema.ColumnSize = (int) row ["ColumnSize"];
+ columnSchema.DataTypeName = reader.GetDataTypeName (index);
+ columnSchema.FieldType = reader.GetFieldType (index);
+ columnSchema.IsReadOnly = (bool) row ["IsReadOnly"];
+ columnSchema.TableName = row ["BaseTableName"].ToString ();
+
+ if (row ["NumericPrecision"] != DBNull.Value)
+ columnSchema.NumericPrecision = (byte) row ["NumericPrecision"];
+ else
+ columnSchema.NumericPrecision = (byte) 0;
+
+ if (row ["NumericScale"] != DBNull.Value)
+ columnSchema.NumericScale = (byte) row ["NumericScale"];
+ else
+ columnSchema.NumericScale = (byte) 0;
+
+ schema [index] = columnSchema;
+ index += 1;
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (reader.Read ())
+ return true;
+ if (closeReader)
+ reader.Close ();
+ return false;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public void Reset ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/FieldNameLookup.cs b/mcs/class/System.Data/System.Data.Common/FieldNameLookup.cs
new file mode 100644
index 00000000000..4a48e3055a7
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/FieldNameLookup.cs
@@ -0,0 +1,116 @@
+//
+// System.Data.Common.FieldNameLookup.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Data;
+
+namespace System.Data.Common {
+ internal sealed class FieldNameLookup : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+
+ #endregion
+
+ #region Constructors
+
+ public FieldNameLookup ()
+ {
+ list = new ArrayList ();
+ }
+
+ public FieldNameLookup (DataTable schemaTable)
+ : this ()
+ {
+ foreach (DataRow row in schemaTable.Rows)
+ list.Add ((string) row["ColumnName"]);
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public string this [int index] {
+ get { return (string) list[index]; }
+ set { list[index] = value; }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ return list.Add (value);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ return list.Contains (value);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object value)
+ {
+ return list.IndexOf (value);
+ }
+
+ public void Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (object value)
+ {
+ list.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..53a121617ba
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs
@@ -0,0 +1,86 @@
+//
+// System.Data.Common.RowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+
+namespace System.Data.Common {
+ public abstract class RowUpdatedEventArgs : EventArgs
+ {
+ #region Fields
+
+ DataRow dataRow;
+ IDbCommand command;
+ StatementType statementType;
+ DataTableMapping tableMapping;
+ Exception errors;
+ UpdateStatus status;
+ int recordsAffected;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ protected RowUpdatedEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ this.dataRow = dataRow;
+ this.command = command;
+ this.statementType = statementType;
+ this.tableMapping = tableMapping;
+ this.errors = null;
+ this.status = UpdateStatus.Continue;
+ this.recordsAffected = 0; // FIXME
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [MonoTODO]
+ public IDbCommand Command {
+ get { return command; }
+ }
+
+ [MonoTODO]
+ public Exception Errors {
+ get { return errors; }
+ set { errors = value; }
+ }
+
+ [MonoTODO]
+ public int RecordsAffected {
+ get { return recordsAffected; }
+ }
+
+ [MonoTODO]
+ public DataRow Row {
+ get { return dataRow; }
+ }
+
+ [MonoTODO]
+ public StatementType StatementType {
+ get { return statementType; }
+ }
+
+ [MonoTODO]
+ public UpdateStatus Status {
+ get { return status; }
+ set { status = value; }
+ }
+
+ [MonoTODO]
+ public DataTableMapping TableMapping {
+ get { return tableMapping; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..d84e6a7b9bb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs
@@ -0,0 +1,71 @@
+//
+// System.Data.Common.RowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Data.Common {
+ public abstract class RowUpdatingEventArgs : EventArgs
+ {
+ #region Fields
+
+ DataRow dataRow;
+ IDbCommand command;
+ StatementType statementType;
+ DataTableMapping tableMapping;
+ UpdateStatus status;
+ Exception errors;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected RowUpdatingEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ this.dataRow = dataRow;
+ this.command = command;
+ this.statementType = statementType;
+ this.tableMapping = tableMapping;
+ this.status = UpdateStatus.Continue;
+ this.errors = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public IDbCommand Command {
+ get { return command; }
+ set { command = value; }
+ }
+
+ public Exception Errors {
+ get { return errors; }
+ set { errors = value; }
+ }
+
+ public DataRow Row {
+ get { return dataRow; }
+ }
+
+ public StatementType StatementType {
+ get { return statementType; }
+ }
+
+ public UpdateStatus Status {
+ get { return status; }
+ set { status = value; }
+ }
+
+ public DataTableMapping TableMapping {
+ get { return tableMapping; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/SchemaInfo.cs b/mcs/class/System.Data/System.Data.Common/SchemaInfo.cs
new file mode 100644
index 00000000000..916c35ecdd2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/SchemaInfo.cs
@@ -0,0 +1,94 @@
+//
+// System.Data.Common.SchemaInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Data.Common {
+ internal class SchemaInfo
+ {
+ #region Fields
+
+ string columnName;
+ string tableName;
+ string dataTypeName;
+ object value;
+ bool allowDBNull;
+ bool isReadOnly;
+ int ordinal;
+ int size;
+ byte precision;
+ byte scale;
+ Type fieldType;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SchemaInfo ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowDBNull {
+ get { return allowDBNull; }
+ set { allowDBNull = value; }
+ }
+
+ public string ColumnName {
+ get { return columnName; }
+ set { columnName = value; }
+ }
+
+ public int ColumnOrdinal {
+ get { return ordinal; }
+ set { ordinal = value; }
+ }
+
+ public int ColumnSize {
+ get { return size; }
+ set { size = value; }
+ }
+
+ public String DataTypeName {
+ get { return dataTypeName; }
+ set { dataTypeName = value; }
+ }
+
+ public Type FieldType {
+ get { return fieldType; }
+ set { fieldType = value; }
+ }
+
+ public byte NumericPrecision {
+ get { return precision; }
+ set { precision = value; }
+ }
+
+ public byte NumericScale {
+ get { return scale; }
+ set { scale = value; }
+ }
+
+ public string TableName {
+ get { return tableName; }
+ set { tableName = value; }
+ }
+
+ public bool IsReadOnly {
+ get { return isReadOnly; }
+ set { isReadOnly = value; }
+ }
+
+ #endregion // Properties
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/System.Data.Odbc/ChangeLog
new file mode 100644
index 00000000000..04b7beb0a27
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/ChangeLog
@@ -0,0 +1,19 @@
+2002-11-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * OdbcDataReader.cs: - uncommented code, but
+ I put a FIXME: according to Brian,
+ this does not work on MS .NET
+ however, we need it for Mono
+ for now. schemaRow.AcceptChanges(),
+ - implement IEnumerable.GetEnumerator()
+
+ * libodbc.cs: changed the DllImport from "odbc32.dll"
+ to "odbc32"
+
+2002-10-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog: added.
+ * OdbcError.cs:
+ * OdbcException.cs: added dummy implementation for these missing
+ classes.
+
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs
new file mode 100644
index 00000000000..2f42017e04b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs
@@ -0,0 +1,111 @@
+using System;
+
+namespace System.Data.Odbc
+{
+ /// <summary>
+ /// Summary description for OdbcColumn.
+ /// </summary>
+ internal class OdbcColumn
+ {
+ internal string ColumnName;
+ internal OdbcType OdbcType;
+ internal bool AllowDBNull;
+ internal int MaxLength;
+ internal int Digits;
+ internal object Value;
+
+ internal OdbcColumn(string Name, OdbcType Type)
+ {
+ this.ColumnName=Name;
+ this.OdbcType=Type;
+ AllowDBNull=false;
+ MaxLength=0;
+ Digits=0;
+ Value=null;
+ }
+
+ internal Type DataType
+ {
+ get
+ {
+ switch (OdbcType)
+ {
+ case OdbcType.TinyInt:
+ return typeof(System.Byte);
+ case OdbcType.BigInt:
+ return typeof(System.Int64);
+ case OdbcType.Image:
+ case OdbcType.VarBinary:
+ case OdbcType.Binary:
+ return typeof(byte[]);
+ case OdbcType.Bit:
+ return typeof(bool);
+ case OdbcType.NChar:
+ case OdbcType.Char:
+ return typeof(char);
+ case OdbcType.Time:
+ case OdbcType.Timestamp:
+ case OdbcType.DateTime:
+ case OdbcType.Date:
+ case OdbcType.SmallDateTime:
+ return typeof(DateTime);
+ case OdbcType.Decimal:
+ return typeof(Decimal);
+ case OdbcType.Numeric:
+ case OdbcType.Double:
+ return typeof(Double);
+ case OdbcType.Int:
+ return typeof(System.Int32);
+ case OdbcType.Text:
+ case OdbcType.NText:
+ case OdbcType.NVarChar:
+ case OdbcType.VarChar:
+ return typeof(string);
+ case OdbcType.Real:
+ return typeof(float);
+ case OdbcType.SmallInt:
+ return typeof(System.Int16);
+ case OdbcType.UniqueIndetifier:
+ return typeof(Guid);
+ }
+ throw new InvalidCastException();
+ }
+ }
+
+ internal bool IsDateType
+ {
+ get
+ {
+ switch (OdbcType)
+ {
+ case OdbcType.Time:
+ case OdbcType.Timestamp:
+ case OdbcType.DateTime:
+ case OdbcType.Date:
+ case OdbcType.SmallDateTime:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+
+ internal bool IsStringType
+ {
+ get
+ {
+ switch (OdbcType)
+ {
+ case OdbcType.Text:
+ case OdbcType.NText:
+ case OdbcType.NVarChar:
+ case OdbcType.VarChar:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs
new file mode 100644
index 00000000000..23b8cbb9126
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs
@@ -0,0 +1,324 @@
+//
+// System.Data.Odbc.OdbcCommand
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.Data.Odbc
+{
+ /// <summary>
+ /// Represents an SQL statement or stored procedure to execute against a data source.
+ /// </summary>
+ public sealed class OdbcCommand : Component, ICloneable, IDbCommand
+ {
+ #region Fields
+
+ string commandText;
+ int timeout;
+ CommandType commandType;
+ OdbcConnection connection;
+ OdbcParameterCollection parameters;
+ OdbcTransaction transaction;
+ bool designTimeVisible;
+ bool prepared=false;
+ OdbcDataReader dataReader;
+ public IntPtr hstmt;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public OdbcCommand ()
+ {
+ commandText = String.Empty;
+ timeout = 30; // default timeout
+ commandType = CommandType.Text;
+ connection = null;
+ parameters = new OdbcParameterCollection ();
+ transaction = null;
+ designTimeVisible = false;
+ dataReader = null;
+ }
+
+ public OdbcCommand (string cmdText) : this ()
+ {
+ CommandText = cmdText;
+ }
+
+ public OdbcCommand (string cmdText, OdbcConnection connection)
+ : this (cmdText)
+ {
+ Connection = connection;
+ }
+
+ public OdbcCommand (string cmdText,
+ OdbcConnection connection,
+ OdbcTransaction transaction) : this (cmdText, connection)
+ {
+ this.transaction = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ internal IntPtr hStmt
+ {
+ get { return hstmt; }
+ }
+
+ public string CommandText
+ {
+ get {
+ return commandText;
+ }
+ set {
+ prepared=false;
+ commandText = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+ set {
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return commandType;
+ }
+ set {
+ commandType = value;
+ }
+ }
+
+ public OdbcConnection Connection {
+ get {
+ return connection;
+ }
+ set {
+ connection = value;
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTimeVisible;
+ }
+ set {
+ designTimeVisible = value;
+ }
+ }
+
+ public OdbcParameterCollection Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value;
+ }
+ }
+
+ public OdbcTransaction Transaction {
+ get {
+ return transaction;
+ }
+ set {
+ transaction = value;
+ }
+ }
+
+ public UpdateRowSource UpdatedRowSource {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+ set {
+ Connection = (OdbcConnection) value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return (IDbTransaction) Transaction;
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Cancel ()
+ {
+ if (hstmt!=IntPtr.Zero)
+ {
+ OdbcReturn Ret=libodbc.SQLCancel(hstmt);
+ if ((Ret!=OdbcReturn.Success) && (Ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLCancel",OdbcHandleType.Stmt,hstmt));
+ }
+ else
+ throw new InvalidOperationException();
+ }
+
+ public OdbcParameter CreateParameter ()
+ {
+ return new OdbcParameter ();
+ }
+
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ }
+
+ private void ExecSQL(string sql)
+ {
+ OdbcReturn ret;
+
+ if ((parameters.Count>0) && !prepared)
+ Prepare();
+
+ if (prepared)
+ {
+ ret=libodbc.SQLExecute(hstmt);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLExecute",OdbcHandleType.Stmt,hstmt));
+ }
+ else
+ {
+ ret=libodbc.SQLAllocHandle(OdbcHandleType.Stmt, Connection.hDbc, ref hstmt);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLAllocHandle",OdbcHandleType.Dbc,Connection.hDbc));
+
+ ret=libodbc.SQLExecDirect(hstmt, sql, sql.Length);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLExecDirect",OdbcHandleType.Stmt,hstmt));
+ }
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ if (connection == null)
+ throw new InvalidOperationException ();
+ if (connection.State == ConnectionState.Closed)
+ throw new InvalidOperationException ();
+ // FIXME: a third check is mentioned in .NET docs
+ if (connection.DataReader != null)
+ throw new InvalidOperationException ();
+
+ ExecSQL(CommandText);
+
+// if (!prepared)
+// libodbc.SQLFreeHandle( (ushort) OdbcHandleType.Stmt, hstmt);
+ return 0;
+ }
+
+ public void Prepare()
+ {
+ OdbcReturn ret=libodbc.SQLAllocHandle(OdbcHandleType.Stmt, Connection.hDbc, ref hstmt);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLAllocHandle",OdbcHandleType.Dbc,Connection.hDbc));
+
+ ret=libodbc.SQLPrepare(hstmt, CommandText, CommandText.Length);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLPrepare",OdbcHandleType.Stmt,hstmt));
+
+ int i=1;
+ foreach (OdbcParameter p in parameters)
+ {
+ p.Bind(hstmt, i);
+ i++;
+ }
+
+ prepared=true;
+ }
+
+ public OdbcDataReader ExecuteReader ()
+ {
+ return ExecuteReader (CommandBehavior.Default);
+ }
+
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ return ExecuteReader ();
+ }
+
+ public OdbcDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ ExecuteNonQuery();
+ dataReader=new OdbcDataReader(this,behavior);
+ return dataReader;
+ }
+
+ IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+ {
+ return ExecuteReader (behavior);
+ }
+
+ public object ExecuteScalar ()
+ {
+ if (connection.DataReader != null)
+ throw new InvalidOperationException ();
+ object val;
+ OdbcDataReader reader=ExecuteReader();
+ try
+ {
+ val=reader[0];
+ }
+ finally
+ {
+ reader.Close();
+ }
+ return val;
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void ResetCommandTimeout ()
+ {
+ timeout = 30;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs
new file mode 100644
index 00000000000..f8234a439bc
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs
@@ -0,0 +1,245 @@
+//
+// System.Data.Odbc.OdbcConnection
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ public sealed class OdbcConnection : Component, ICloneable, IDbConnection
+ {
+ #region Fields
+
+ string connectionString;
+ int connectionTimeout;
+ OdbcDataReader dataReader;
+ public OdbcTransaction transaction;
+ IntPtr henv=IntPtr.Zero, hdbc=IntPtr.Zero;
+
+ #endregion
+
+ #region Constructors
+
+ public OdbcConnection ()
+ {
+ OdbcReturn ret;
+
+ // allocate Environment handle
+ ret=libodbc.SQLAllocHandle(OdbcHandleType.Env, IntPtr.Zero, ref henv);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLAllocHandle"));
+
+ ret=libodbc.SQLSetEnvAttr(henv, OdbcEnv.OdbcVersion, (IntPtr) 3 , 0);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLSetEnvAttr",OdbcHandleType.Env,henv));
+
+ //Console.WriteLine("ODBCInit Complete.");
+ connectionTimeout = 15;
+ connectionString = null;
+ dataReader = null;
+ }
+
+ public OdbcConnection (string connectionString) : this ()
+ {
+ ConnectionString = connectionString;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ internal IntPtr hDbc
+ {
+ get { return hdbc; }
+ }
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ connectionString = value;
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+// public string DataSource {
+// get {
+// if (State==ConnectionState.Open)
+// return _dsn;
+// else
+// return null;
+// }
+// }
+
+ public string Database {
+ get {
+ return "";
+ }
+ }
+
+ public ConnectionState State
+ {
+ get {
+ if (hdbc!=IntPtr.Zero) {
+ return ConnectionState.Open;
+ }
+ else
+ return ConnectionState.Closed;
+ }
+ }
+
+ public OdbcDataReader DataReader
+ {
+ get {
+ return dataReader;
+ }
+ set {
+ dataReader = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public OdbcTransaction BeginTransaction ()
+ {
+ return BeginTransaction(IsolationLevel.Unspecified);
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return (IDbTransaction) BeginTransaction();
+ }
+
+ public OdbcTransaction BeginTransaction (IsolationLevel level)
+ {
+ if (transaction==null)
+ {
+ transaction=new OdbcTransaction(this,level);
+ return transaction;
+ }
+ else
+ throw new InvalidOperationException();
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel level)
+ {
+ return (IDbTransaction) BeginTransaction(level);
+ }
+
+ public void Close ()
+ {
+ if (State == ConnectionState.Open) {
+ // TODO: Free handles
+ dataReader = null;
+ hdbc = IntPtr.Zero;
+ transaction=null;
+ }
+ else
+ throw new InvalidOperationException();
+ }
+
+ public OdbcCommand CreateCommand ()
+ {
+ return new OdbcCommand("", this, transaction);
+ }
+
+ [MonoTODO]
+ public void ChangeDatabase(string Database)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException();
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return (IDbCommand) CreateCommand ();
+ }
+
+ public void Open ()
+ {
+ if (State == ConnectionState.Open)
+ throw new InvalidOperationException ();
+
+ // allocate connection handle
+ OdbcReturn ret=libodbc.SQLAllocHandle(OdbcHandleType.Dbc, henv, ref hdbc);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLAllocHandle",OdbcHandleType.Env,henv));
+
+ // DSN connection
+ if (connectionString.ToLower().IndexOf("dsn=")>=0)
+ {
+ string _uid="", _pwd="", _dsn="";
+ string[] items=connectionString.Split(new char[1]{';'});
+ foreach (string item in items)
+ {
+ string[] parts=item.Split(new char[1] {'='});
+ switch (parts[0].Trim().ToLower())
+ {
+ case "dsn":
+ _dsn=parts[1].Trim();
+ break;
+ case "uid":
+ _uid=parts[1].Trim();
+ break;
+ case "pwd":
+ _pwd=parts[1].Trim();
+ break;
+ }
+ }
+ ret=libodbc.SQLConnect(hdbc, _dsn, -3, _uid, -3, _pwd, -3);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLConnect",OdbcHandleType.Dbc,hdbc));
+ }
+ else
+ {
+ // DSN-less Connection
+ string OutConnectionString=new String(' ',1024);
+ short OutLen=0;
+ ret=libodbc.SQLDriverConnect(hdbc, IntPtr.Zero, connectionString, -3,
+ OutConnectionString, (short) OutConnectionString.Length, ref OutLen, 0);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLDriverConnect",OdbcHandleType.Dbc,hdbc));
+ }
+
+ }
+
+ [MonoTODO]
+ public static void ReleaseObjectPool ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Events and Delegates
+
+ public event StateChangeEventHandler StateChange;
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs
new file mode 100755
index 00000000000..fd4c4c5dd08
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs
@@ -0,0 +1,187 @@
+//
+// System.Data.Odbc.OdbcDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc {
+ [DefaultEvent ("RowUpdated")]
+ public sealed class OdbcDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ bool disposed = false;
+ OdbcCommand deleteCommand;
+ OdbcCommand insertCommand;
+ OdbcCommand selectCommand;
+ OdbcCommand updateCommand;
+
+ #endregion
+
+ #region Constructors
+
+ public OdbcDataAdapter ()
+ : this (new OdbcCommand ())
+ {
+ }
+
+ public OdbcDataAdapter (OdbcCommand selectCommand)
+ {
+ DeleteCommand = null;
+ InsertCommand = null;
+ SelectCommand = selectCommand;
+ UpdateCommand = null;
+ }
+
+ public OdbcDataAdapter (string selectCommandText, OdbcConnection selectConnection)
+ : this (new OdbcCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public OdbcDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new OdbcConnection (selectConnectionString))
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Used during Update for deleted rows in DataSet.")]
+ [DefaultValue (null)]
+ public OdbcCommand DeleteCommand {
+ get { return deleteCommand; }
+ set { deleteCommand = value; }
+ }
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Used during Update for new rows in DataSet.")]
+ [DefaultValue (null)]
+ public OdbcCommand InsertCommand {
+ get { return insertCommand; }
+ set { insertCommand = value; }
+ }
+
+ [DataCategory ("Fill")]
+ [DataSysDescription ("Used during Fill/FillSchema.")]
+ [DefaultValue (null)]
+ public OdbcCommand SelectCommand {
+ get { return selectCommand; }
+ set { selectCommand = value; }
+ }
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Used during Update for modified rows in DataSet.")]
+ [DefaultValue (null)]
+ public OdbcCommand UpdateCommand {
+ get { return updateCommand; }
+ set { updateCommand = value; }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is OdbcCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (OdbcCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is OdbcCommand))
+ throw new ArgumentException ();
+ InsertCommand = (OdbcCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is OdbcCommand))
+ throw new ArgumentException ();
+ SelectCommand = (OdbcCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is OdbcCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (OdbcCommand)value;
+ }
+ }
+
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new OdbcRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new OdbcRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ // Release managed resources
+ }
+ // Release unmanaged resources
+ disposed = true;
+ }
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ if (RowUpdated != null)
+ RowUpdated (this, (OdbcRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ if (RowUpdating != null)
+ RowUpdating (this, (OdbcRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Event triggered before every DataRow during Update.")]
+ public event OdbcRowUpdatedEventHandler RowUpdated;
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Event triggered after every DataRow during Update.")]
+ public event OdbcRowUpdatingEventHandler RowUpdating;
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs
new file mode 100644
index 00000000000..8e812213721
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs
@@ -0,0 +1,534 @@
+//
+// System.Data.Odbc.OdbcDataReader
+//
+// Author:
+// Brian Ritchie (brianlritchie@hotmail.com)
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Brian Ritchie, 2002
+// Copyright (C) Daniel Morgan, 2002
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ public sealed class OdbcDataReader : MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
+ {
+ #region Fields
+
+ private OdbcCommand command;
+ private bool open;
+ private int currentRow;
+ private OdbcColumn[] cols;
+ private IntPtr hstmt;
+ private CommandBehavior behavior;
+
+ #endregion
+
+ #region Constructors
+
+ internal OdbcDataReader (OdbcCommand command, CommandBehavior behavior)
+ {
+ this.command = command;
+ this.behavior=behavior;
+ this.command.Connection.DataReader = this;
+ open = true;
+ currentRow = -1;
+ hstmt=command.hStmt;
+ // Init columns array;
+ short colcount=0;
+ libodbc.SQLNumResultCols(hstmt, ref colcount);
+ cols=new OdbcColumn[colcount];
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int Depth {
+ get {
+ return 0; // no nested selects supported
+ }
+ }
+
+ public int FieldCount {
+ get {
+ return cols.Length;
+ }
+ }
+
+ public bool IsClosed {
+ get {
+ return !open;
+ }
+ }
+
+ public object this[string name] {
+ get {
+ int pos;
+
+ if (currentRow == -1)
+ throw new InvalidOperationException ();
+
+ pos = ColIndex(name);
+
+ if (pos == -1)
+ throw new IndexOutOfRangeException ();
+
+ return this[pos];
+ }
+ }
+
+ public object this[int index] {
+ get {
+ return (object) GetValue (index);
+ }
+ }
+
+ public int RecordsAffected {
+ get {
+ return -1;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ private int ColIndex(string colname)
+ {
+ int i=0;
+ foreach (OdbcColumn col in cols)
+ {
+ if (col.ColumnName==colname)
+ return i;
+ i++;
+ }
+ return 0;
+ }
+
+ // Dynamically load column descriptions as needed.
+ private OdbcColumn GetColumn(int ordinal)
+ {
+ if (cols[ordinal]==null)
+ {
+ short bufsize=255;
+ byte[] colname_buffer=new byte[bufsize];
+ string colname;
+ short colname_size=0;
+ short ColSize=0, DecDigits=0, Nullable=0, dt=0;
+ OdbcReturn ret=libodbc.SQLDescribeCol(hstmt, Convert.ToUInt16(ordinal+1),
+ colname_buffer, bufsize, ref colname_size, ref dt, ref ColSize,
+ ref DecDigits, ref Nullable);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLDescribeCol",OdbcHandleType.Stmt,hstmt));
+ colname=System.Text.Encoding.Default.GetString(colname_buffer);
+ colname=colname.Replace((char) 0,' ').Trim();
+ OdbcColumn c=new OdbcColumn(colname, (OdbcType) dt);
+ c.AllowDBNull=(Nullable!=0);
+ c.Digits=DecDigits;
+ if (c.IsStringType)
+ c.MaxLength=ColSize;
+ cols[ordinal]=c;
+ }
+ return cols[ordinal];
+ }
+
+ public void Close ()
+ {
+ // libodbc.SQLFreeHandle((ushort) OdbcHandleType.Stmt, hstmt);
+
+ OdbcReturn ret=libodbc.SQLCloseCursor(hstmt);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLCloseCursor",OdbcHandleType.Stmt,hstmt));
+
+ open = false;
+ currentRow = -1;
+
+ this.command.Connection.DataReader = null;
+
+ if ((behavior & CommandBehavior.CloseConnection)==CommandBehavior.CloseConnection)
+ this.command.Connection.Close();
+ }
+
+ ~OdbcDataReader ()
+ {
+ if (open)
+ Close ();
+ }
+
+ public bool GetBoolean (int ordinal)
+ {
+ return (bool) GetValue(ordinal);
+ }
+
+ [MonoTODO]
+ public byte GetByte (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetBytes (int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetChars (int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OdbcDataReader GetData (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int index)
+ {
+ return GetColumn(index).OdbcType.ToString();
+ }
+
+ public DateTime GetDateTime (int ordinal)
+ {
+ return (DateTime) GetValue(ordinal);
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public double GetDouble (int ordinal)
+ {
+ return (double) GetValue(ordinal);
+ }
+
+ public Type GetFieldType (int index)
+ {
+ return GetColumn(index).DataType;
+ }
+
+ public float GetFloat (int ordinal)
+ {
+ return (float) GetValue(ordinal);
+ }
+
+ [MonoTODO]
+ public Guid GetGuid (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public short GetInt16 (int ordinal)
+ {
+ return (short) GetValue(ordinal);
+ }
+
+ public int GetInt32 (int ordinal)
+ {
+ return (int) GetValue(ordinal);
+ }
+
+ public long GetInt64 (int ordinal)
+ {
+ return (long) GetValue(ordinal);
+ }
+
+ public string GetName (int index)
+ {
+ if (currentRow == -1)
+ return null;
+ return GetColumn(index).ColumnName;
+ }
+
+ public int GetOrdinal (string name)
+ {
+ if (currentRow == -1)
+ throw new IndexOutOfRangeException ();
+
+ int i=ColIndex(name);
+
+ if (i==-1)
+ throw new IndexOutOfRangeException ();
+ else
+ return i;
+ }
+
+ [MonoTODO]
+ public DataTable GetSchemaTable()
+ {
+
+ DataTable dataTableSchema = null;
+ // Only Results from SQL SELECT Queries
+ // get a DataTable for schema of the result
+ // otherwise, DataTable is null reference
+ if(cols.Length > 0)
+ {
+
+ dataTableSchema = new DataTable ();
+
+ dataTableSchema.Columns.Add ("ColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
+ dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
+ dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
+ dataTableSchema.Columns.Add ("NumericScale", typeof (int));
+ dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
+ dataTableSchema.Columns.Add ("IsKey", typeof (bool));
+ DataColumn dc = dataTableSchema.Columns["IsKey"];
+ dc.AllowDBNull = true; // IsKey can have a DBNull
+ dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
+ dataTableSchema.Columns.Add ("DataType", typeof(Type));
+ dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
+ dataTableSchema.Columns.Add ("ProviderType", typeof (int));
+ dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
+ dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
+ dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
+ dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
+ dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
+ dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
+ dataTableSchema.Columns.Add ("IsLong", typeof (bool));
+ dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
+
+ DataRow schemaRow;
+
+ for (int i = 0; i < cols.Length; i += 1 )
+ {
+ OdbcColumn col=GetColumn(i);
+ //Console.WriteLine("{0}:{1}:{2}",col.ColumnName,col.DataType,col.OdbcType);
+
+ schemaRow = dataTableSchema.NewRow ();
+ dataTableSchema.Rows.Add (schemaRow);
+
+ schemaRow["ColumnName"] = col.ColumnName;
+ schemaRow["ColumnOrdinal"] = i + 1;
+
+ schemaRow["ColumnSize"] = col.MaxLength;
+ schemaRow["NumericPrecision"] = 0;
+ schemaRow["NumericScale"] = 0;
+ // TODO: need to get KeyInfo
+ schemaRow["IsUnique"] = false;
+ schemaRow["IsKey"] = DBNull.Value;
+
+ schemaRow["BaseCatalogName"] = "";
+ schemaRow["BaseColumnName"] = col.ColumnName;
+ schemaRow["BaseSchemaName"] = "";
+ schemaRow["BaseTableName"] = "";
+ schemaRow["DataType"] = col.DataType;
+
+ schemaRow["AllowDBNull"] = col.AllowDBNull;
+
+ schemaRow["ProviderType"] = (int) col.OdbcType;
+ // TODO: all of these
+ schemaRow["IsAliased"] = false;
+ schemaRow["IsExpression"] = false;
+ schemaRow["IsIdentity"] = false;
+ schemaRow["IsAutoIncrement"] = false;
+ schemaRow["IsRowVersion"] = false;
+ schemaRow["IsHidden"] = false;
+ schemaRow["IsLong"] = false;
+ schemaRow["IsReadOnly"] = false;
+
+ // FIXME: according to Brian,
+ // this does not work on MS .NET
+ // however, we need it for Mono
+ // for now
+ schemaRow.AcceptChanges();
+
+ }
+
+ }
+ dataTableSchema.AcceptChanges();
+ return dataTableSchema;
+ }
+
+ public string GetString (int ordinal)
+ {
+ return (string) GetValue(ordinal);
+ }
+
+ [MonoTODO]
+ public TimeSpan GetTimeSpan (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object GetValue (int ordinal)
+ {
+ if (currentRow == -1)
+ throw new IndexOutOfRangeException ();
+
+ if (ordinal>cols.Length-1 || ordinal<0)
+ throw new IndexOutOfRangeException ();
+
+ OdbcReturn ret;
+ int outsize=0, bufsize;
+ byte[] buffer;
+ OdbcColumn col=GetColumn(ordinal);
+ object DataValue=null;
+ ushort ColIndex=Convert.ToUInt16(ordinal+1);
+
+ // Check cached values
+ if (col.Value==null)
+ {
+
+ // odbc help file
+ // mk:@MSITStore:C:\program%20files\Microsoft%20Data%20Access%20SDK\Docs\odbc.chm::/htm/odbcc_data_types.htm
+ switch (col.OdbcType)
+ {
+ case OdbcType.Decimal:
+ bufsize=50;
+ buffer=new byte[bufsize]; // According to sqlext.h, use SQL_CHAR for decimal
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Char, buffer, bufsize, ref outsize);
+ if (outsize!=-1)
+ DataValue=Decimal.Parse(System.Text.Encoding.Default.GetString(buffer));
+ break;
+ case OdbcType.TinyInt:
+ short short_data=0;
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.TinyInt, ref short_data, 0, ref outsize);
+ DataValue=short_data;
+ break;
+ case OdbcType.Int:
+ int int_data=0;
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Int, ref int_data, 0, ref outsize);
+ DataValue=int_data;
+ break;
+ case OdbcType.BigInt:
+ long long_data=0;
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.BigInt, ref long_data, 0, ref outsize);
+ DataValue=long_data;
+ break;
+ case OdbcType.NVarChar:
+ bufsize=col.MaxLength*2+1; // Unicode is double byte
+ buffer=new byte[bufsize];
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.NVarChar, buffer, bufsize, ref outsize);
+ if (outsize!=-1)
+ DataValue=System.Text.Encoding.Unicode.GetString(buffer,0,outsize);
+ break;
+ case OdbcType.VarChar:
+ bufsize=col.MaxLength+1;
+ buffer=new byte[bufsize]; // According to sqlext.h, use SQL_CHAR for both char and varchar
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Char, buffer, bufsize, ref outsize);
+ if (outsize!=-1)
+ DataValue=System.Text.Encoding.Default.GetString(buffer,0,outsize);
+ break;
+ case OdbcType.Real:
+ float float_data=0;
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Real, ref float_data, 0, ref outsize);
+ DataValue=float_data;
+ break;
+ case OdbcType.Timestamp:
+ case OdbcType.DateTime:
+ OdbcTimestamp ts_data=new OdbcTimestamp();
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.DateTime, ref ts_data, 0, ref outsize);
+ if (outsize!=-1) // This means SQL_NULL_DATA
+ DataValue=new DateTime(ts_data.year,ts_data.month,ts_data.day,ts_data.hour,
+ ts_data.minute,ts_data.second,Convert.ToInt32(ts_data.fraction));
+ break;
+ default:
+ //Console.WriteLine("Fetching unsupported data type as string: "+col.OdbcType.ToString());
+ bufsize=255;
+ buffer=new byte[bufsize];
+ ret=libodbc.SQLGetData(hstmt, ColIndex, OdbcType.Char, buffer, bufsize, ref outsize);
+ DataValue=System.Text.Encoding.Default.GetString(buffer);
+ break;
+ }
+
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLGetData",OdbcHandleType.Stmt,hstmt));
+
+ if (outsize==-1) // This means SQL_NULL_DATA
+ col.Value=DBNull.Value;
+ else
+ col.Value=DataValue;
+ }
+ return col.Value;
+ }
+
+ public int GetValues (object[] values)
+ {
+ int numValues = 0;
+
+ // copy values
+ for (int i = 0; i < values.Length; i++) {
+ if (i < FieldCount) {
+ values[i] = GetValue(i);
+ }
+ else {
+ values[i] = null;
+ }
+ }
+
+ // get number of object instances in array
+ if (values.Length < FieldCount)
+ numValues = values.Length;
+ else if (values.Length == FieldCount)
+ numValues = FieldCount;
+ else
+ numValues = FieldCount;
+
+ return numValues;
+ }
+
+ [MonoTODO]
+ IDataReader IDataRecord.GetData (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IDisposable.Dispose ()
+ {
+ }
+
+ [MonoTODO]
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new DbEnumerator (this);
+ }
+
+ public bool IsDBNull (int ordinal)
+ {
+ return (GetValue(ordinal) is DBNull);
+ }
+
+ public bool NextResult ()
+ {
+ OdbcReturn ret=libodbc.SQLFetch(hstmt);
+ if (ret!=OdbcReturn.Success)
+ currentRow=-1;
+ else
+ currentRow++;
+ // Clear cached values from last record
+ foreach (OdbcColumn col in cols)
+ {
+ if (col!=null)
+ col.Value=null;
+ }
+ return (ret==OdbcReturn.Success);
+ }
+
+ public bool Read ()
+ {
+ return NextResult();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs
new file mode 100644
index 00000000000..0b0465d0b44
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs
@@ -0,0 +1,118 @@
+//
+// System.Data.Odbc.OdbcError
+//
+// Author:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ public class OdbcError
+ {
+ string message,source,sqlstate;
+ int nativeerror;
+
+ #region Constructors
+
+ internal OdbcError(string Source)
+ {
+ nativeerror=1;
+ source=Source;
+ message="Error in "+source;
+ sqlstate="";
+ }
+
+ internal OdbcError(string Source, OdbcHandleType HandleType, IntPtr Handle)
+ {
+ short buflen=256,txtlen=0;
+ OdbcReturn ret=OdbcReturn.Success;
+ byte[] buf_MsgText=new byte[buflen];
+ byte[] buf_SqlState=new byte[buflen];
+ bool NeedsDecode=true;
+ this.source=Source;
+ switch (HandleType)
+ {
+ case OdbcHandleType.Dbc:
+ ret=libodbc.SQLError(IntPtr.Zero,Handle,IntPtr.Zero, buf_SqlState,
+ ref nativeerror, buf_MsgText, buflen, ref txtlen);
+ break;
+ case OdbcHandleType.Stmt:
+ ret=libodbc.SQLError(IntPtr.Zero,IntPtr.Zero,Handle, buf_SqlState,
+ ref nativeerror, buf_MsgText, buflen, ref txtlen);
+ break;
+ case OdbcHandleType.Env:
+ ret=libodbc.SQLError(Handle,IntPtr.Zero,IntPtr.Zero, buf_SqlState,
+ ref nativeerror, buf_MsgText, buflen, ref txtlen);
+ break;
+ default:
+ nativeerror=1;
+ source=Source;
+ message="Error in "+source;
+ sqlstate="";
+ NeedsDecode=false;
+ break;
+ }
+ if (NeedsDecode)
+ {
+ if (ret!=OdbcReturn.Success)
+ {
+ nativeerror=1;
+ source=Source;
+ message="Unable to retreive error information from ODBC driver manager";
+ sqlstate="";
+ }
+ else
+ {
+ sqlstate=System.Text.Encoding.Default.GetString(buf_SqlState).Replace((char) 0,' ').Trim();;
+ message=System.Text.Encoding.Default.GetString(buf_MsgText).Replace((char) 0,' ').Trim();;
+ }
+ }
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Message
+ {
+ get
+ {
+ return message;
+ }
+ }
+
+ public int NativeError
+ {
+ get
+ {
+ return nativeerror;
+ }
+ }
+
+ public string Source
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public string SQLState
+ {
+ get
+ {
+ return sqlstate;
+ }
+ }
+
+ #endregion // Properties
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcErrorCollection.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcErrorCollection.cs
new file mode 100755
index 00000000000..3a8402e9e0c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcErrorCollection.cs
@@ -0,0 +1,87 @@
+//
+// System.Data.Odbc.OdbcErrorCollection
+//
+// Author:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ public sealed class OdbcErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count
+ {
+ get
+ {
+ return list.Count;
+ }
+ }
+
+ public OdbcError this[int index]
+ {
+ get
+ {
+ return (OdbcError) list[index];
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return list.SyncRoot;
+ }
+ }
+
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return list.IsSynchronized;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Add (OdbcError error)
+ {
+ list.Add ((object) error);
+ }
+
+ [MonoTODO]
+ public void CopyTo (Array array, int index)
+ {
+ ((OdbcError[])(list.ToArray ())).CopyTo (array, index);
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcException.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcException.cs
new file mode 100644
index 00000000000..d11dad3cb3d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcException.cs
@@ -0,0 +1,66 @@
+//
+// System.Data.Odbc.OdbcDataReader
+//
+// Author:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Data.Odbc
+{
+ public class OdbcException : SystemException
+ {
+ OdbcErrorCollection col;
+
+
+ internal OdbcException(OdbcError Error) : base (Error.Message)
+ {
+ col=new OdbcErrorCollection();
+ col.Add(Error);
+ }
+
+
+ public int ErrorCode
+ {
+ get
+ {
+ return col[0].NativeError;
+ }
+ }
+
+ public OdbcErrorCollection Errors
+ {
+ get
+ {
+ return col;
+ }
+ }
+
+ public override string Source
+ {
+ get
+ {
+ return col[0].Source;
+ }
+ }
+
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs
new file mode 100644
index 00000000000..22ffdf22585
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs
@@ -0,0 +1,209 @@
+//
+// System.Data.Odbc.OdbcParameter
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ public sealed class OdbcParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+ {
+ #region Fields
+
+ string name;
+ object ParamValue;
+ int size;
+ bool isNullable;
+ byte precision;
+ byte scale;
+ DataRowVersion sourceVersion;
+ string sourceColumn;
+ ParameterDirection direction;
+ OdbcType odbcType;
+ DbType dbType;
+
+ // Buffers for parameter value based on type. Currently I've only optimized
+ // for int parameters and everything else is just converted to a string.
+ int intbuf;
+ byte[] buffer;
+
+ #endregion
+
+ #region Constructors
+
+ public OdbcParameter ()
+ {
+ name = String.Empty;
+ ParamValue = null;
+ size = 0;
+ isNullable = true;
+ precision = 0;
+ scale = 0;
+ sourceColumn = String.Empty;
+ }
+
+ public OdbcParameter (string name, object value)
+ : this ()
+ {
+ this.name = name;
+ this.ParamValue = value;
+ }
+
+ public OdbcParameter (string name, OdbcType dataType)
+ : this ()
+ {
+ this.name = name;
+ OdbcType = dataType;
+ }
+
+ public OdbcParameter (string name, OdbcType dataType, int size)
+ : this (name, dataType)
+ {
+ this.size = size;
+ }
+
+ public OdbcParameter (string name, OdbcType dataType, int size, string srcColumn)
+ : this (name, dataType, size)
+ {
+ this.sourceColumn = srcColumn;
+ }
+
+ public OdbcParameter(string name, OdbcType dataType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value)
+ : this (name, dataType, size, srcColumn)
+ {
+ this.direction = direction;
+ this.isNullable = isNullable;
+ this.precision = precision;
+ this.scale = scale;
+ this.sourceVersion = srcVersion;
+ this.ParamValue = value;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public DbType DbType {
+ get { return dbType; }
+ set {
+ dbType = value;
+ }
+ }
+
+ public ParameterDirection Direction {
+ get { return direction; }
+ set { direction = value; }
+ }
+
+ public bool IsNullable {
+ get { return isNullable; }
+ }
+
+ public OdbcType OdbcType {
+ get { return odbcType; }
+ set {
+ odbcType = value;
+ }
+ }
+
+ public string ParameterName {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ set { precision = value; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ set { scale = value; }
+ }
+
+ public int Size {
+ get { return size; }
+ set { size = value; }
+ }
+
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
+ }
+
+ public DataRowVersion SourceVersion {
+ get { return sourceVersion; }
+ set { sourceVersion = value; }
+ }
+
+ public object Value {
+ get {
+ return ParamValue;
+ }
+ set {
+ this.ParamValue = value;
+ // Load buffer with new value
+ if (odbcType==OdbcType.Int)
+ intbuf=(int) value;
+ else
+ {
+ // Treat everything else as a string
+ // Init string buffer
+ if (buffer==null || buffer.Length< ((size>20)?size:20) )
+ buffer=new byte[(size>20)?size:20];
+ else
+ buffer.Initialize();
+ // Convert value into string and store into buffer
+ byte[] strValueBuffer=System.Text.Encoding.ASCII.GetBytes(ParamValue.ToString());
+ strValueBuffer.CopyTo(buffer,0);
+ }
+ }
+ }
+
+ #endregion // Properties
+
+ #region public Properties
+
+ public void Bind(IntPtr hstmt,int ParamNum)
+ {
+ OdbcReturn ret;
+ // Convert System.Data.ParameterDirection into odbc enum
+ OdbcInputOutputDirection paramdir=libodbc.ConvertParameterDirection(this.direction);
+ // Bind parameter based on type
+ if (odbcType==OdbcType.Int)
+ ret=libodbc.SQLBindParameter(hstmt, (ushort) ParamNum, (short) paramdir,
+ (short) odbcType, (short) odbcType, Convert.ToUInt32(size),
+ 0, ref intbuf, 0, 0);
+ else
+ ret=libodbc.SQLBindParameter(hstmt, (ushort) ParamNum, (short) paramdir,
+ (short) OdbcType.Char, (short) odbcType, Convert.ToUInt32(size),
+ 0, buffer, 0, 0);
+ // Check for error condition
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLBindParam",OdbcHandleType.Stmt,hstmt));
+ }
+
+ #endregion // public Properties
+
+ #region Methods
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ return ParameterName;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcParameterCollection.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcParameterCollection.cs
new file mode 100644
index 00000000000..07497dadcd4
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcParameterCollection.cs
@@ -0,0 +1,205 @@
+//
+// System.Data.Odbc.OdbcParameterCollection
+//
+// Author:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+ public sealed class OdbcParameterCollection : MarshalByRefObject,
+ IDataParameterCollection, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public OdbcParameter this[int index] {
+ get { return (OdbcParameter) list[index]; }
+ set { list[index] = value; }
+ }
+
+ public OdbcParameter this[string parameterName] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ int ICollection.Count {
+ get { return list.Count; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ object IList.this[int index] {
+ get { return list[index]; }
+ set { list[index] = value; }
+ }
+
+ object IDataParameterCollection.this[string name]
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+
+ public OdbcParameter Add (OdbcParameter parameter)
+ {
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OdbcParameter Add (string name, object value)
+ {
+ OdbcParameter parameter = new OdbcParameter (name, value);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OdbcParameter Add (string name, OdbcType type)
+ {
+ OdbcParameter parameter = new OdbcParameter (name, type);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OdbcParameter Add (string name, OdbcType type, int width)
+ {
+ OdbcParameter parameter = new OdbcParameter (name, type, width);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OdbcParameter Add (string name, OdbcType type,
+ int width, string src_col)
+ {
+ OdbcParameter parameter = new OdbcParameter (name, type, width, src_col);
+ list.Add (parameter);
+ return parameter;
+ }
+
+
+ public void Bind(IntPtr hstmt)
+ {
+ for (int i=0;i<Count;i++)
+ {
+ this[i].Bind(hstmt,i+1);
+
+ }
+ }
+
+ int IList.Add (object value)
+ {
+ if (!(value is IDataParameter))
+ throw new InvalidCastException ();
+
+
+ list.Add (value);
+ return list.IndexOf (value);
+ }
+
+ void IList.Clear ()
+ {
+ list.Clear ();
+ }
+
+ bool IList.Contains (object value)
+ {
+ return list.Contains (value);
+ }
+
+ bool IDataParameterCollection.Contains (string value)
+ {
+ for (int i = 0; i < list.Count; i++) {
+ IDataParameter parameter;
+
+ parameter = (IDataParameter) list[i];
+ if (parameter.ParameterName == value)
+ return true;
+ }
+
+ return false;
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ ((OdbcParameter[])(list.ToArray ())).CopyTo (array, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return list.IndexOf (value);
+ }
+
+ int IDataParameterCollection.IndexOf (string name)
+ {
+ return list.IndexOf (((IDataParameterCollection) this)[name]);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ void IList.Remove (object value)
+ {
+ list.Remove (value);
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ list.Remove ((object) list[index]);
+ }
+
+ void IDataParameterCollection.RemoveAt (string name)
+ {
+ list.Remove (((IDataParameterCollection) this)[name]);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs
new file mode 100755
index 00000000000..bf4cc56baa1
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs
@@ -0,0 +1,37 @@
+//
+// System.Data.Odbc.OdbcRowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc {
+ public sealed class OdbcRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ #region Constructors
+
+ public OdbcRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public new OdbcCommand Command {
+ get { return (OdbcCommand) base.Command; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs
new file mode 100755
index 00000000000..c49aefb7dce
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Data.Odbc.OdbcRowUpdatedEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data.Odbc {
+ public delegate void OdbcRowUpdatedEventHandler (object sender, OdbcRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs
new file mode 100755
index 00000000000..4333b43627b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.Odbc.OdbcRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc {
+ public sealed class OdbcRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ #region Constructors
+
+ public OdbcRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public new OdbcCommand Command {
+ get { return (OdbcCommand) base.Command; }
+ set { base.Command = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs
new file mode 100755
index 00000000000..248b78c64c5
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Data.Odbc.OdbcRowUpdatingEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data.Odbc {
+ public delegate void OdbcRowUpdatingEventHandler(object sender, OdbcRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs
new file mode 100644
index 00000000000..64ad630d617
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcTransaction.cs
@@ -0,0 +1,83 @@
+//
+// System.Data.Odbc.OdbcTransaction
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+using System;
+using System.Data;
+
+namespace System.Data.Odbc
+{
+ /// <summary>
+ /// Summary description for OdbcTransaction.
+ /// </summary>
+ public class OdbcTransaction : MarshalByRefObject
+ {
+ private OdbcConnection connection;
+ private IsolationLevel isolationlevel;
+
+ internal OdbcTransaction(OdbcConnection conn, IsolationLevel isolationlevel)
+ {
+ // Set Auto-commit (102) to false
+ OdbcReturn ret=libodbc.SQLSetConnectAttr(conn.hDbc, OdbcConnectionAttribute.AutoCommit, IntPtr.Zero, 0);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLSetConnectAttr",OdbcHandleType.Dbc,conn.hDbc));
+ // Handle isolation level
+ int lev=0;
+ switch (isolationlevel)
+ {
+ case IsolationLevel.ReadUncommitted:
+ lev=1;
+ break;
+ case IsolationLevel.ReadCommitted:
+ lev=2;
+ break;
+ case IsolationLevel.RepeatableRead:
+ lev=3;
+ break;
+ case IsolationLevel.Serializable:
+ lev=4;
+ break;
+ case IsolationLevel.Unspecified:
+ lev=0;
+ break;
+ default:
+ throw new NotSupportedException();
+ }
+ libodbc.SQLSetConnectAttr(conn.hDbc, OdbcConnectionAttribute.TransactionIsolation, (IntPtr) lev, 0);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLSetConnectAttr",OdbcHandleType.Dbc,conn.hDbc));
+ this.isolationlevel=isolationlevel;
+ connection=conn;
+ }
+
+ public void Commit()
+ {
+ if (connection.transaction==this)
+ {
+ OdbcReturn ret=libodbc.SQLEndTran((short) OdbcHandleType.Dbc, connection.hDbc, 0);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLEndTran",OdbcHandleType.Dbc,connection.hDbc));
+ connection.transaction=null;
+ }
+ else
+ throw new InvalidOperationException();
+ }
+
+ public void Rollback()
+ {
+ if (connection.transaction==this)
+ {
+ OdbcReturn ret=libodbc.SQLEndTran((short) OdbcHandleType.Dbc, connection.hDbc, 1);
+ if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo))
+ throw new OdbcException(new OdbcError("SQLEndTran",OdbcHandleType.Dbc,connection.hDbc));
+ connection.transaction=null;
+ }
+ else
+ throw new InvalidOperationException();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs
new file mode 100644
index 00000000000..0b390e27261
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/OdbcType.cs
@@ -0,0 +1,58 @@
+//
+// System.Data.Odbc.OdbcType
+//
+// Author:
+// Brian Ritchie
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc
+{
+
+// From the ODBC documentation:
+//
+// In ODBC 3.x, the identifiers for date, time, and timestamp SQL data types
+// have changed from SQL_DATE, SQL_TIME, and SQL_TIMESTAMP (with instances of
+// #define in the header file of 9, 10, and 11) to SQL_TYPE_DATE, SQL_TYPE_TIME,
+// and SQL_TYPE_TIMESTAMP (with instances of #define in the header file of 91, 92, and 93),
+// respectively.
+
+ // Unmapped SQL Types
+ //
+ //#define SQL_FLOAT 6
+ // could map to SQL_DOUBLE?
+ //#define SQL_INTERVAL 10
+ // could map to SmallDateTime?
+
+ public enum OdbcType : short
+ {
+ BigInt=-5, // SQL_BIGINT
+ Binary=-2, // SQL_BINARY
+ Bit=-7, // SQL_BIT
+ Char=1, // SQL_CHAR
+ Date=91, // SQL_TYPE_DATE
+ DateTime=9, // SQL_DATETIME
+ Decimal=3, // SQL_DECIMAL
+ Double=8, // SQL_DOUBLE
+ Image=-4, // SQL_LONGVARBINARY
+ Int=4, // SQL_INTEGER
+ NChar=-95, // SQL_UNICODE_CHAR
+ NText=-97, // SQL_UNICODE_LONGVARCHAR
+ Numeric=2, // SQL_NUMERIC
+ NVarChar=-96, // SQL_UNICODE_VARCHAR
+ Real=7, // SQL_REAL
+ SmallDateTime=0,// ??????????????????????????
+ SmallInt=5, // SQL_SMALLINT
+ Time=92, // SQL_TYPE_TIME
+ Text=-1, // SQL_LONGVARCHAR
+ Timestamp=93, // SQL_TYPE_TIMESTAMP
+ TinyInt=-6, // SQL_TINYINT
+ UniqueIndetifier=-11, // SQL_GUID
+ VarBinary=-3, // SQL_VARBINARY
+ VarChar=12 // SQL_VARCHAR
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/libodbc.cs b/mcs/class/System.Data/System.Data.Odbc/libodbc.cs
new file mode 100644
index 00000000000..949ba5b8a3f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Odbc/libodbc.cs
@@ -0,0 +1,192 @@
+//
+// System.Data.Odbc.libodbc
+//
+// Authors:
+// Brian Ritchie (brianlritchie@hotmail.com)
+//
+//
+// Copyright (C) Brian Ritchie, 2002
+//
+//
+
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace System.Data.Odbc
+{
+ internal enum OdbcHandleType : short {
+ Env = 1,
+ Dbc = 2,
+ Stmt = 3,
+ Desc = 4
+ };
+
+ internal enum OdbcReturn : short {
+ Error = -1,
+ InvalidHandle = -2,
+ StillExecuting = 2,
+ NeedData = 99,
+ Success = 0,
+ SuccessWithInfo = 1,
+ NoData=100
+ }
+
+ internal enum OdbcEnv : ushort {
+ OdbcVersion = 200,
+ ConnectionPooling = 201,
+ CPMatch = 202
+ }
+
+ internal enum OdbcConnectionAttribute : int
+ {
+ AutoCommit=102,
+ TransactionIsolation=108
+ }
+
+ internal enum OdbcInputOutputDirection : short
+ {
+ Input=1,
+ InputOutput=2,
+ ResultCol=3,
+ Output=4,
+ ReturnValue=5
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct OdbcTimestamp
+ {
+ internal short year;
+ internal ushort month;
+ internal ushort day;
+ internal ushort hour;
+ internal ushort minute;
+ internal ushort second;
+ internal ulong fraction;
+ }
+
+
+// sealed internal class libodbc
+ internal class libodbc
+ {
+ internal static OdbcInputOutputDirection ConvertParameterDirection(
+ ParameterDirection dir)
+ {
+ switch (dir)
+ {
+ case ParameterDirection.Input:
+ return OdbcInputOutputDirection.Input;
+ case ParameterDirection.InputOutput:
+ return OdbcInputOutputDirection.InputOutput;
+ case ParameterDirection.Output:
+ return OdbcInputOutputDirection.Output;
+ case ParameterDirection.ReturnValue:
+ return OdbcInputOutputDirection.ReturnValue;
+ default:
+ return OdbcInputOutputDirection.Input;
+ }
+ }
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLAllocHandle (OdbcHandleType HandleType, IntPtr InputHandle, ref IntPtr OutputHandlePtr);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLSetEnvAttr (IntPtr EnvHandle, OdbcEnv Attribute, IntPtr Value, int StringLength);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLConnect (IntPtr ConnectionHandle, string ServerName, short NameLength1, string UserName, short NameLength2, string Authentication, short NameLength3);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLDriverConnect(IntPtr ConnectionHandle, IntPtr WindowHandle, string InConnectionString, short StringLength1, string OutConnectionString, short BufferLength, ref short StringLength2Ptr, ushort DriverCompletion);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLExecDirect (IntPtr StatementHandle, string StatementText, int TextLength);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLRowCount (IntPtr StatementHandle, ref int RowCount);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLNumResultCols (IntPtr StatementHandle, ref short ColumnCount);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLFetch (IntPtr StatementHandle);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref bool TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref double TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref long TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref short TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref float TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref OdbcTimestamp TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, ref int TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetData (IntPtr StatementHandle, ushort ColumnNumber, OdbcType TargetType, byte[] TargetPtr, int BufferLen, ref int Len);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLDescribeCol(IntPtr StatementHandle, ushort ColumnNumber, byte[] ColumnName, short BufferLength, ref short NameLength, ref short DataType, ref short ColumnSize, ref short DecimalDigits, ref short Nullable);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLFreeHandle(ushort HandleType, IntPtr SqlHandle);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLDisconnect(IntPtr ConnectionHandle);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLPrepare(IntPtr StatementHandle, string Statement, int TextLength);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLExecute(IntPtr StatementHandle);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLSetConnectAttr(IntPtr ConnectionHandle, OdbcConnectionAttribute Attribute, IntPtr Value, int Length);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLEndTran(int HandleType, IntPtr Handle, short CompletionType);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLBindParameter(IntPtr StatementHandle, ushort ParamNum,
+ short InputOutputType, short ValueType, short ParamType, uint ColSize,
+ short DecimalDigits, byte[] ParamValue, int BufLen, int StrLen);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLBindParameter(IntPtr StatementHandle, ushort ParamNum,
+ short InputOutputType, short ValueType, short ParamType, uint ColSize,
+ short DecimalDigits, ref int ParamValue, int BufLen, int StrLen);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLCancel(IntPtr StatementHandle);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLCloseCursor(IntPtr StatementHandle);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLError(IntPtr EnvironmentHandle,
+ IntPtr ConnectionHandle, IntPtr StatementHandle,
+ byte[] Sqlstate, ref int NativeError,
+ byte[] MessageText, short BufferLength,
+ ref short TextLength);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLGetStmtAttr(IntPtr StatementHandle,
+ int Attribute, ref IntPtr Value, int BufLen, int StrLen);
+
+ [DllImport("odbc32")]
+ internal static extern OdbcReturn SQLSetDescField(IntPtr DescriptorHandle,
+ short RecNumber, short FieldIdentifier, byte[] Value, int BufLen);
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/ChangeLog b/mcs/class/System.Data/System.Data.OleDb/ChangeLog
new file mode 100644
index 00000000000..fe6597ab02d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/ChangeLog
@@ -0,0 +1,5 @@
+2002-11-01 Daniel Morgan <danmorg@sc.rr.com>
+
+ * OleDbDataReader.cs: implemented
+ Dispose() and GetEnumerator()
+
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs
new file mode 100644
index 00000000000..8de3e49794c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs
@@ -0,0 +1,335 @@
+//
+// System.Data.OleDb.OleDbCommand
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.Data.OleDb
+{
+ /// <summary>
+ /// Represents an SQL statement or stored procedure to execute against a data source.
+ /// </summary>
+ public sealed class OleDbCommand : Component, ICloneable, IDbCommand
+ {
+ #region Fields
+
+ string commandText;
+ int timeout;
+ CommandType commandType;
+ OleDbConnection connection;
+ OleDbParameterCollection parameters;
+ OleDbTransaction transaction;
+ bool designTimeVisible;
+ OleDbDataReader dataReader;
+ CommandBehavior behavior;
+ IntPtr gdaCommand;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public OleDbCommand ()
+ {
+ commandText = String.Empty;
+ timeout = 30; // default timeout per .NET
+ commandType = CommandType.Text;
+ connection = null;
+ parameters = new OleDbParameterCollection ();
+ transaction = null;
+ designTimeVisible = false;
+ dataReader = null;
+ behavior = CommandBehavior.Default;
+ gdaCommand = IntPtr.Zero;
+ }
+
+ public OleDbCommand (string cmdText) : this ()
+ {
+ CommandText = cmdText;
+ }
+
+ public OleDbCommand (string cmdText, OleDbConnection connection)
+ : this (cmdText)
+ {
+ Connection = connection;
+ }
+
+ public OleDbCommand (string cmdText,
+ OleDbConnection connection,
+ OleDbTransaction transaction) : this (cmdText, connection)
+ {
+ this.transaction = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string CommandText
+ {
+ get {
+ return commandText;
+ }
+ set {
+ commandText = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+ set {
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return commandType;
+ }
+ set {
+ commandType = value;
+ }
+ }
+
+ public OleDbConnection Connection {
+ get {
+ return connection;
+ }
+ set {
+ connection = value;
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTimeVisible;
+ }
+ set {
+ designTimeVisible = value;
+ }
+ }
+
+ public OleDbParameterCollection Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value;
+ }
+ }
+
+ public OleDbTransaction Transaction {
+ get {
+ return transaction;
+ }
+ set {
+ transaction = value;
+ }
+ }
+
+ public UpdateRowSource UpdatedRowSource {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+ set {
+ Connection = (OleDbConnection) value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return Transaction;
+ }
+ set {
+ Transaction = (OleDbTransaction) value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void Cancel ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public OleDbParameter CreateParameter ()
+ {
+ return new OleDbParameter ();
+ }
+
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ private void SetupGdaCommand ()
+ {
+ GdaCommandType type;
+
+ switch (commandType) {
+ case CommandType.TableDirect :
+ type = GdaCommandType.Table;
+ break;
+ case CommandType.StoredProcedure :
+ type = GdaCommandType.Procedure;
+ break;
+ case CommandType.Text :
+ default :
+ type = GdaCommandType.Sql;
+ break;
+ }
+
+ if (gdaCommand != IntPtr.Zero) {
+ libgda.gda_command_set_text (gdaCommand, commandText);
+ libgda.gda_command_set_command_type (gdaCommand, type);
+ } else {
+ gdaCommand = libgda.gda_command_new (commandText, type, 0);
+ }
+
+ //libgda.gda_command_set_transaction
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ if (connection == null)
+ throw new InvalidOperationException ("connection == null");
+ if (connection.State == ConnectionState.Closed)
+ throw new InvalidOperationException ("State == Closed");
+ // FIXME: a third check is mentioned in .NET docs
+
+ IntPtr gdaConnection = connection.GdaConnection;
+ IntPtr gdaParameterList = parameters.GdaParameterList;
+
+ SetupGdaCommand ();
+ return libgda.gda_connection_execute_non_query (gdaConnection,
+ (IntPtr) gdaCommand,
+ gdaParameterList);
+ }
+
+ public OleDbDataReader ExecuteReader ()
+ {
+ return ExecuteReader (CommandBehavior.Default);
+ }
+
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ return ExecuteReader ();
+ }
+
+ public OleDbDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ ArrayList results = new ArrayList ();
+ IntPtr rs_list;
+ GdaList glist_node;
+
+ if (connection.State != ConnectionState.Open)
+ throw new InvalidOperationException ("State != Open");
+
+ this.behavior = behavior;
+
+ IntPtr gdaConnection = connection.GdaConnection;
+ IntPtr gdaParameterList = parameters.GdaParameterList;
+
+ /* execute the command */
+ SetupGdaCommand ();
+ rs_list = libgda.gda_connection_execute_command (
+ gdaConnection,
+ gdaCommand,
+ gdaParameterList);
+ if (rs_list != IntPtr.Zero) {
+ glist_node = (GdaList) Marshal.PtrToStructure (rs_list, typeof (GdaList));
+
+ while (glist_node != null) {
+ results.Add (glist_node.data);
+ if (glist_node.next == IntPtr.Zero)
+ break;
+
+ glist_node = (GdaList) Marshal.PtrToStructure (glist_node.next,
+ typeof (GdaList));
+ }
+ dataReader = new OleDbDataReader (this, results);
+ dataReader.NextResult ();
+ }
+
+ return dataReader;
+ }
+
+ IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+ {
+ return ExecuteReader (behavior);
+ }
+
+ public object ExecuteScalar ()
+ {
+ SetupGdaCommand ();
+ OleDbDataReader reader = ExecuteReader ();
+ if (reader == null) {
+ return null;
+ }
+ if (!reader.Read ()) {
+ reader.Close ();
+ return null;
+ }
+ object o = reader.GetValue (0);
+ reader.Close ();
+ return o;
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Prepare ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void ResetCommandTimeout ()
+ {
+ timeout = 30;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbCommandBuilder.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbCommandBuilder.cs
new file mode 100644
index 00000000000..50ab006116e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbCommandBuilder.cs
@@ -0,0 +1,118 @@
+//
+// System.Data.OleDb.OleDbCommandBuilder
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ /// <summary>
+ /// Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.
+ /// </summary>
+ public sealed class OleDbCommandBuilder : Component
+ {
+ #region Fields
+
+ OleDbDataAdapter adapter;
+ string quotePrefix;
+ string quoteSuffix;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public OleDbCommandBuilder ()
+ {
+ adapter = null;
+ quotePrefix = String.Empty;
+ quoteSuffix = String.Empty;
+ }
+
+ public OleDbCommandBuilder (OleDbDataAdapter adapter)
+ : this ()
+ {
+ this.adapter = adapter;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public OleDbDataAdapter DataAdapter {
+ get {
+ return adapter;
+ }
+ set {
+ adapter = value;
+ }
+ }
+
+ public string QuotePrefix {
+ get {
+ return quotePrefix;
+ }
+ set {
+ quotePrefix = value;
+ }
+ }
+
+ public string QuoteSuffix {
+ get {
+ return quoteSuffix;
+ }
+ set {
+ quoteSuffix = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public static void DeriveParameters (OleDbCommand command)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbCommand GetDeleteCommand ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbCommand GetInsertCommand ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbCommand GetUpdatetCommand ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshSchema ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs
new file mode 100644
index 00000000000..8251b1d417b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs
@@ -0,0 +1,272 @@
+//
+// System.Data.OleDb.OleDbConnection
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbConnection : Component, ICloneable, IDbConnection
+ {
+ #region Fields
+
+ string connectionString;
+ int connectionTimeout;
+ IntPtr gdaConnection;
+
+ #endregion
+
+ #region Constructors
+
+ public OleDbConnection ()
+ {
+ libgda.gda_init ("System.Data.OleDb", "1.0", 0, new string [0]);
+ gdaConnection = IntPtr.Zero;
+ connectionTimeout = 15;
+ connectionString = null;
+ }
+
+ public OleDbConnection (string connectionString) : this ()
+ {
+ this.connectionString = connectionString;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ connectionString = value;
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+ public string Database {
+ get {
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_database (gdaConnection);
+ }
+
+ return null;
+ }
+ }
+
+ public string DataSource {
+ get {
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_dsn (gdaConnection);
+ }
+
+ return null;
+ }
+ }
+
+ public string Provider {
+ get {
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_provider (gdaConnection);
+ }
+
+ return null;
+ }
+ }
+
+ public string ServerVersion {
+ get {
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_server_version (gdaConnection);
+ }
+
+ return null;
+ }
+ }
+
+ public ConnectionState State
+ {
+ get {
+ if (gdaConnection != IntPtr.Zero) {
+ if (libgda.gda_connection_is_open (gdaConnection))
+ return ConnectionState.Open;
+ }
+
+ return ConnectionState.Closed;
+ }
+ }
+
+ internal IntPtr GdaConnection
+ {
+ get {
+ return gdaConnection;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public OleDbTransaction BeginTransaction ()
+ {
+ if (gdaConnection != IntPtr.Zero)
+ return new OleDbTransaction (this);
+
+ return null;
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ public OleDbTransaction BeginTransaction (IsolationLevel level)
+ {
+ if (gdaConnection != IntPtr.Zero)
+ return new OleDbTransaction (this, level);
+
+ return null;
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel level)
+ {
+ return BeginTransaction (level);
+ }
+
+ public void ChangeDatabase (string name)
+ {
+ if (gdaConnection == IntPtr.Zero)
+ throw new ArgumentException ();
+ if (State != ConnectionState.Open)
+ throw new InvalidOperationException ();
+
+ if (!libgda.gda_connection_change_database (gdaConnection, name))
+ throw new OleDbException (this);
+ }
+
+ public void Close ()
+ {
+ if (State == ConnectionState.Open) {
+ libgda.gda_connection_close (gdaConnection);
+ gdaConnection = IntPtr.Zero;
+ }
+ }
+
+ public OleDbCommand CreateCommand ()
+ {
+ if (State == ConnectionState.Open)
+ return new OleDbCommand (null, this);
+
+ return null;
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetOleDbSchemaTable (Guid schema, object[] restrictions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException();
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ public void Open ()
+ {
+ string provider = "Default";
+ string gdaCncStr = "";
+ string[] args;
+ int len;
+ char [] separator = { ';' };
+
+ if (State == ConnectionState.Open)
+ throw new InvalidOperationException ();
+
+ gdaConnection = libgda.gda_client_open_connection (libgda.GdaClient,
+ connectionString,
+ "", "");
+
+ /* convert the connection string to its GDA equivalent */
+ //args = connectionString.Split (';');
+ //len = args.Length;
+ //for (int i = 0; i < len; i++) {
+ // string[] values = args[i].Split (separator, 2);
+ // if (values[0] == "Provider") {
+ // if (values[1] == "SQLOLEDB")
+ // provider = "FreeTDS";
+ // else if (values[1] == "MSDAORA")
+ // provider = "Oracle";
+ // else if (values[2] == "Microsoft.Jet.OLEDB.4.0")
+ // provider = "MS Access";
+ // else
+ // provider = values[2];
+ // }
+ // else if (values[0] == "Addr" || values[0] == "Address")
+ // gdaCncStr = String.Concat (gdaCncStr, "HOST=", values[1], ";");
+ // else if (values[0] == "Database")
+ // gdaCncStr = String.Concat (gdaCncStr, "DATABASE=", values[1], ";");
+ // else if (values[0] == "Connection Lifetime")
+ // connectionTimeout = System.Convert.ToInt32 (values[1]);
+ // else if (values[0] == "File Name")
+ // gdaCncStr = String.Concat (gdaCncStr, "FILENAME=", values[1], ";");
+ // else if (values[0] == "Password" || values[0] == "Pwd")
+ // gdaCncStr = String.Concat (gdaCncStr, "PASSWORD=", values[1], ";");
+ // else if (values[0] == "User ID")
+ // gdaCncStr = String.Concat (gdaCncStr, "USERNAME=", values[1], ";");
+ //}
+
+ /* open the connection */
+ //System.Console.WriteLine ("Opening connection for provider " +
+ // provider + " with " + gdaCncStr);
+ //gdaConnection = libgda.gda_client_open_connection_from_string (libgda.GdaClient,
+ // provider,
+ // gdaCncStr);
+ }
+
+ [MonoTODO]
+ public static void ReleaseObjectPool ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Events and Delegates
+
+ public event OleDbInfoMessageEventHandler InfoMessage;
+ public event StateChangeEventHandler StateChange;
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs
new file mode 100644
index 00000000000..72f39a53480
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs
@@ -0,0 +1,208 @@
+//
+// System.Data.OleDb.OleDbDataAdapter
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ OleDbCommand deleteCommand;
+ OleDbCommand insertCommand;
+ OleDbCommand selectCommand;
+ OleDbCommand updateCommand;
+ MissingMappingAction missingMappingAction;
+ MissingSchemaAction missingSchemaAction;
+
+ #endregion
+
+ #region Constructors
+
+ public OleDbDataAdapter ()
+ : this (new OleDbCommand ())
+ {
+ }
+
+ public OleDbDataAdapter (OleDbCommand selectCommand)
+ {
+ DeleteCommand = new OleDbCommand ();
+ InsertCommand = new OleDbCommand ();
+ SelectCommand = selectCommand;
+ UpdateCommand = new OleDbCommand ();
+ }
+
+ public OleDbDataAdapter (string selectCommandText, OleDbConnection selectConnection)
+ : this (new OleDbCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public OleDbDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new OleDbConnection (selectConnectionString))
+ {
+ }
+
+ #endregion // Fields
+
+ #region Properties
+
+ public OleDbCommand DeleteCommand {
+ get {
+ return deleteCommand;
+ }
+ set {
+ deleteCommand = value;
+ }
+ }
+
+ public OleDbCommand InsertCommand {
+ get {
+ return insertCommand;
+ }
+ set {
+ insertCommand = value;
+ }
+ }
+
+ public OleDbCommand SelectCommand {
+ get {
+ return selectCommand;
+ }
+ set {
+ selectCommand = value;
+ }
+ }
+
+ public OleDbCommand UpdateCommand {
+ get {
+ return updateCommand;
+ }
+ set {
+ updateCommand = value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get {
+ return DeleteCommand;
+ }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (OleDbCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get {
+ return InsertCommand;
+ }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ InsertCommand = (OleDbCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get {
+ return SelectCommand;
+ }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ SelectCommand = (OleDbCommand)value;
+ }
+ }
+
+ MissingMappingAction IDataAdapter.MissingMappingAction {
+ get {
+ return missingMappingAction;
+ }
+ set {
+ missingMappingAction = value;
+ }
+ }
+
+ MissingSchemaAction IDataAdapter.MissingSchemaAction {
+ get {
+ return missingSchemaAction;
+ }
+ set {
+ missingSchemaAction = value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get {
+ return UpdateCommand;
+ }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (OleDbCommand)value;
+ }
+ }
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get {
+ return TableMappings;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping)
+ {
+ return new OleDbRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping)
+ {
+ return new OleDbRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ if (RowUpdated != null)
+ RowUpdated (this, (OleDbRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ if (RowUpdating != null)
+ RowUpdating (this, (OleDbRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event OleDbRowUpdatedEventHandler RowUpdated;
+ public event OleDbRowUpdatingEventHandler RowUpdating;
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs
new file mode 100644
index 00000000000..d11afa9d9ab
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs
@@ -0,0 +1,682 @@
+//
+// System.Data.OleDb.OleDbDataReader
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbDataReader : MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
+ {
+ #region Fields
+
+ private OleDbCommand command;
+ private bool open;
+ private ArrayList gdaResults;
+ private int currentResult;
+ private int currentRow;
+ private bool disposed = false;
+
+ #endregion
+
+ #region Constructors
+
+ internal OleDbDataReader (OleDbCommand command, ArrayList results)
+ {
+ this.command = command;
+ open = true;
+ if (results != null)
+ gdaResults = results;
+ else
+ gdaResults = new ArrayList ();
+ currentResult = -1;
+ currentRow = -1;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int Depth {
+ get {
+ return 0; // no nested selects supported
+ }
+ }
+
+ public int FieldCount {
+ get {
+ if (currentResult < 0 ||
+ currentResult >= gdaResults.Count)
+ return 0;
+
+ return libgda.gda_data_model_get_n_columns (
+ (IntPtr) gdaResults[currentResult]);
+ }
+ }
+
+ public bool IsClosed {
+ get {
+ return !open;
+ }
+ }
+
+ public object this[string name] {
+ get {
+ int pos;
+
+ if (currentResult == -1)
+ throw new InvalidOperationException ();
+
+ pos = libgda.gda_data_model_get_column_position (
+ (IntPtr) gdaResults[currentResult],
+ name);
+ if (pos == -1)
+ throw new IndexOutOfRangeException ();
+
+ return this[pos];
+ }
+ }
+
+ public object this[int index] {
+ get {
+ return (object) GetValue (index);
+ }
+ }
+
+ public int RecordsAffected {
+ get {
+ int total_rows;
+
+ if (currentResult < 0 ||
+ currentResult >= gdaResults.Count)
+ return 0;
+
+ total_rows = libgda.gda_data_model_get_n_rows (
+ (IntPtr) gdaResults[currentResult]);
+ if (total_rows > 0) {
+ if (FieldCount > 0) {
+ // It's a SELECT statement
+ return -1;
+ }
+ }
+
+ return FieldCount > 0 ? -1 : total_rows;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public void Close ()
+ {
+ for (int i = 0; i < gdaResults.Count; i++) {
+ IntPtr obj = (IntPtr) gdaResults[i];
+ libgda.FreeObject (obj);
+ }
+
+ gdaResults.Clear ();
+ gdaResults = null;
+
+ open = false;
+ currentResult = -1;
+ currentRow = -1;
+ }
+
+ public bool GetBoolean (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Boolean)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_boolean (value);
+ }
+
+ public byte GetByte (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Tinyint)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_tinyint (value);
+ }
+
+ [MonoTODO]
+ public long GetBytes (int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public char GetChar (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Tinyint)
+ throw new InvalidCastException ();
+ return (char) libgda.gda_value_get_tinyint (value);
+ }
+
+ [MonoTODO]
+ public long GetChars (int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbDataReader GetData (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int index)
+ {
+ IntPtr attrs;
+ GdaValueType type;
+
+ if (currentResult == -1)
+ return "unknown";
+
+
+ attrs = libgda.gda_data_model_describe_column ((IntPtr) gdaResults[currentResult],
+ index);
+ if (attrs == IntPtr.Zero)
+ return "unknown";
+
+ type = libgda.gda_field_attributes_get_gdatype (attrs);
+ libgda.gda_field_attributes_free (attrs);
+
+ return libgda.gda_type_to_string (type);
+ }
+
+ public DateTime GetDateTime (int ordinal)
+ {
+ IntPtr value;
+ DateTime dt;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) == GdaValueType.Date) {
+ GdaDate gdt;
+
+ gdt = (GdaDate) Marshal.PtrToStructure (libgda.gda_value_get_date (value),
+ typeof (GdaDate));
+ return new DateTime ((int) gdt.year, (int) gdt.month, (int) gdt.day);
+ } else if (libgda.gda_value_get_type (value) == GdaValueType.Time) {
+ GdaTime gdt;
+
+ gdt = (GdaTime) Marshal.PtrToStructure (libgda.gda_value_get_time (value),
+ typeof (GdaTime));
+ return new DateTime (0, 0, 0, (int) gdt.hour, (int) gdt.minute, (int) gdt.second, 0);
+ } else if (libgda.gda_value_get_type (value) == GdaValueType.Timestamp) {
+ GdaTimestamp gdt;
+
+ gdt = (GdaTimestamp) Marshal.PtrToStructure (libgda.gda_value_get_timestamp (value),
+ typeof (GdaTimestamp));
+
+ return new DateTime ((int) gdt.year, (int) gdt.month, (int) gdt.day,
+ (int) gdt.hour, (int) gdt.minute, (int) gdt.second,
+ (int) gdt.fraction);
+ }
+
+ throw new InvalidCastException ();
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public double GetDouble (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Double)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_double (value);
+ }
+
+ [MonoTODO]
+ public Type GetFieldType (int index)
+ {
+ IntPtr value;
+ GdaValueType type;
+
+ if (currentResult == -1)
+ throw new IndexOutOfRangeException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ index, currentRow);
+ if (value == IntPtr.Zero)
+ throw new IndexOutOfRangeException ();
+
+ type = libgda.gda_value_get_type (value);
+ switch (type) {
+ case GdaValueType.Bigint : return typeof (long);
+ case GdaValueType.Boolean : return typeof (bool);
+ case GdaValueType.Date : return typeof (DateTime);
+ case GdaValueType.Double : return typeof (double);
+ case GdaValueType.Integer : return typeof (int);
+ case GdaValueType.Single : return typeof (float);
+ case GdaValueType.Smallint : return typeof (byte);
+ case GdaValueType.String : return typeof (string);
+ case GdaValueType.Time : return typeof (DateTime);
+ case GdaValueType.Timestamp : return typeof (DateTime);
+ case GdaValueType.Tinyint : return typeof (byte);
+ }
+
+ return typeof(string); // default
+ }
+
+ public float GetFloat (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Single)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_single (value);
+ }
+
+ [MonoTODO]
+ public Guid GetGuid (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public short GetInt16 (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Smallint)
+ throw new InvalidCastException ();
+ return (short) libgda.gda_value_get_smallint (value);
+ }
+
+ public int GetInt32 (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Integer)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_integer (value);
+ }
+
+ public long GetInt64 (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.Bigint)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_bigint (value);
+ }
+
+ public string GetName (int index)
+ {
+ if (currentResult == -1)
+ return null;
+
+ return libgda.gda_data_model_get_column_title (
+ (IntPtr) gdaResults[currentResult], index);
+ }
+
+ public int GetOrdinal (string name)
+ {
+ if (currentResult == -1)
+ throw new IndexOutOfRangeException ();
+
+ for (int i = 0; i < FieldCount; i++) {
+ if (GetName (i) == name)
+ return i;
+ }
+
+ throw new IndexOutOfRangeException ();
+ }
+
+ public DataTable GetSchemaTable ()
+ {
+ DataTable dataTableSchema = null;
+ // Only Results from SQL SELECT Queries
+ // get a DataTable for schema of the result
+ // otherwise, DataTable is null reference
+ if(this.FieldCount > 0) {
+
+ IntPtr attrs;
+ GdaValueType gdaType;
+ long columnSize = 0;
+
+ if (currentResult == -1) {
+ // FIXME: throw an exception?
+ Console.WriteLine("Error: current result -1");
+ return null;
+ }
+
+ dataTableSchema = new DataTable ();
+
+ dataTableSchema.Columns.Add ("ColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
+ dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
+ dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
+ dataTableSchema.Columns.Add ("NumericScale", typeof (int));
+ dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
+ dataTableSchema.Columns.Add ("IsKey", typeof (bool));
+ DataColumn dc = dataTableSchema.Columns["IsKey"];
+ dc.AllowDBNull = true; // IsKey can have a DBNull
+ dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
+ dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
+ dataTableSchema.Columns.Add ("DataType", typeof(Type));
+ dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
+ dataTableSchema.Columns.Add ("ProviderType", typeof (int));
+ dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
+ dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
+ dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
+ dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
+ dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
+ dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
+ dataTableSchema.Columns.Add ("IsLong", typeof (bool));
+ dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
+
+ DataRow schemaRow;
+ DbType dbType;
+ Type typ;
+
+ for (int i = 0; i < this.FieldCount; i += 1 ) {
+
+ schemaRow = dataTableSchema.NewRow ();
+
+ attrs = libgda.gda_data_model_describe_column ((IntPtr) gdaResults[currentResult],
+ i);
+ if (attrs == IntPtr.Zero){
+ // FIXME: throw exception
+ Console.WriteLine("Error: attrs null");
+ return null;
+ }
+
+ gdaType = libgda.gda_field_attributes_get_gdatype (attrs);
+ columnSize = libgda.gda_field_attributes_get_defined_size (attrs);
+ libgda.gda_field_attributes_free (attrs);
+
+ schemaRow["ColumnName"] = this.GetName(i);
+ schemaRow["ColumnOrdinal"] = i + 1;
+
+ schemaRow["ColumnSize"] = (int) columnSize;
+ schemaRow["NumericPrecision"] = 0;
+ schemaRow["NumericScale"] = 0;
+ // TODO: need to get KeyInfo
+ //if((cmdBehavior & CommandBehavior.KeyInfo) == CommandBehavior.KeyInfo) {
+ // bool IsUnique, IsKey;
+ // GetKeyInfo(field[i].Name, out IsUnique, out IsKey);
+ //}
+ //else {
+ schemaRow["IsUnique"] = false;
+ schemaRow["IsKey"] = DBNull.Value;
+ //}
+ schemaRow["BaseCatalogName"] = "";
+
+ schemaRow["BaseColumnName"] = this.GetName(i);
+ schemaRow["BaseSchemaName"] = "";
+ schemaRow["BaseTableName"] = "";
+
+ schemaRow["DataType"] = this.GetFieldType(i);
+
+ schemaRow["AllowDBNull"] = false;
+
+ schemaRow["ProviderType"] = (int) gdaType;
+ schemaRow["IsAliased"] = false;
+ schemaRow["IsExpression"] = false;
+ schemaRow["IsIdentity"] = false;
+ schemaRow["IsAutoIncrement"] = false;
+ schemaRow["IsRowVersion"] = false;
+ schemaRow["IsHidden"] = false;
+ schemaRow["IsLong"] = false;
+ schemaRow["IsReadOnly"] = false;
+
+ schemaRow.AcceptChanges();
+
+ dataTableSchema.Rows.Add (schemaRow);
+ }
+
+#if DEBUG_OleDbDataReader
+ Console.WriteLine("********** DEBUG Table Schema BEGIN ************");
+ foreach (DataRow myRow in dataTableSchema.Rows) {
+ foreach (DataColumn myCol in dataTableSchema.Columns)
+ Console.WriteLine(myCol.ColumnName + " = " + myRow[myCol]);
+ Console.WriteLine();
+ }
+ Console.WriteLine("********** DEBUG Table Schema END ************");
+#endif // DEBUG_OleDbDataReader
+
+ }
+
+ return dataTableSchema;
+ }
+
+ public string GetString (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new InvalidCastException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new InvalidCastException ();
+
+ if (libgda.gda_value_get_type (value) != GdaValueType.String)
+ throw new InvalidCastException ();
+ return libgda.gda_value_get_string (value);
+ }
+
+ [MonoTODO]
+ public TimeSpan GetTimeSpan (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object GetValue (int ordinal)
+ {
+ IntPtr value;
+ GdaValueType type;
+
+ if (currentResult == -1)
+ throw new IndexOutOfRangeException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new IndexOutOfRangeException ();
+
+ type = libgda.gda_value_get_type (value);
+ switch (type) {
+ case GdaValueType.Bigint : return GetInt64 (ordinal);
+ case GdaValueType.Boolean : return GetBoolean (ordinal);
+ case GdaValueType.Date : return GetDateTime (ordinal);
+ case GdaValueType.Double : return GetDouble (ordinal);
+ case GdaValueType.Integer : return GetInt32 (ordinal);
+ case GdaValueType.Single : return GetFloat (ordinal);
+ case GdaValueType.Smallint : return GetByte (ordinal);
+ case GdaValueType.String : return GetString (ordinal);
+ case GdaValueType.Time : return GetDateTime (ordinal);
+ case GdaValueType.Timestamp : return GetDateTime (ordinal);
+ case GdaValueType.Tinyint : return GetByte (ordinal);
+ }
+
+ return (object) libgda.gda_value_stringify (value);
+ }
+
+ [MonoTODO]
+ public int GetValues (object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IDataReader IDataRecord.GetData (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new DbEnumerator (this);
+ }
+
+ public bool IsDBNull (int ordinal)
+ {
+ IntPtr value;
+
+ if (currentResult == -1)
+ throw new IndexOutOfRangeException ();
+
+ value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
+ ordinal, currentRow);
+ if (value == IntPtr.Zero)
+ throw new IndexOutOfRangeException ();
+
+ return libgda.gda_value_is_null (value);
+ }
+
+ public bool NextResult ()
+ {
+ int i = currentResult + 1;
+ if (i >= 0 && i < gdaResults.Count) {
+ currentResult++;
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool Read ()
+ {
+ if (currentResult < 0 ||
+ currentResult >= gdaResults.Count)
+ return false;
+
+ currentRow++;
+ if (currentRow <
+ libgda.gda_data_model_get_n_rows ((IntPtr) gdaResults[currentResult]))
+ return true;
+
+ return false;
+ }
+
+ #endregion
+
+ #region Destructors
+
+ private void Dispose (bool disposing) {
+ if (!this.disposed) {
+ if (disposing) {
+ // release any managed resources
+ command = null;
+ }
+ // release any unmanaged resources
+ if (gdaResults != null) {
+ gdaResults.Clear ();
+ gdaResults = null;
+ }
+
+ // close any handles
+ if (open)
+ Close ();
+
+ this.disposed = true;
+ }
+ }
+
+ void IDisposable.Dispose() {
+ Dispose (true);
+ }
+
+ ~OleDbDataReader() {
+ Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbError.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbError.cs
new file mode 100644
index 00000000000..b672820a095
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbError.cs
@@ -0,0 +1,74 @@
+//
+// System.Data.OleDb.OleDbError
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbError
+ {
+ private string errorMessage;
+ private int nativeError;
+ private string errorSource;
+ private string sqlState;
+
+ #region Constructors
+
+ internal OleDbError (string msg, int code, string source, string sql)
+ {
+ errorMessage = msg;
+ nativeError = code;
+ errorSource = source;
+ sqlState = sql;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Message {
+ get {
+ return errorMessage;
+ }
+ }
+
+ public int NativeError {
+ get {
+ return nativeError;
+ }
+ }
+
+ public string Source {
+ get {
+ return errorSource;
+ }
+ }
+
+ public string SqlState {
+ get {
+ return sqlState;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbErrorCollection.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbErrorCollection.cs
new file mode 100644
index 00000000000..8768459bc2e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbErrorCollection.cs
@@ -0,0 +1,80 @@
+//
+// System.Data.OleDb.OleDbErrorCollection
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list;
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count {
+ get {
+ return list.Count;
+ }
+ }
+
+ public OleDbError this[int index] {
+ get {
+ return (OleDbError) list[index];
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return list.SyncRoot;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return list.IsSynchronized;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void Add (OleDbError error)
+ {
+ list.Add ((object) error);
+ }
+
+ [MonoTODO]
+ public void CopyTo (Array array, int index)
+ {
+ ((OleDbError[])(list.ToArray ())).CopyTo (array, index);
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbException.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbException.cs
new file mode 100644
index 00000000000..ad66403bd7e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbException.cs
@@ -0,0 +1,123 @@
+//
+// System.Data.OleDb.OleDbException
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Data.OleDb
+{
+ [Serializable]
+ public sealed class OleDbException : ExternalException
+ {
+ private OleDbConnection connection;
+
+ #region Constructors
+
+ internal OleDbException (OleDbConnection cnc)
+ {
+ connection = cnc;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override int ErrorCode {
+ get {
+ GdaList glist;
+ IntPtr errors;
+
+ errors = libgda.gda_connection_get_errors (connection.GdaConnection);
+ if (errors != IntPtr.Zero) {
+ glist = (GdaList) Marshal.PtrToStructure (errors, typeof (GdaList));
+ return (int) libgda.gda_error_get_number (glist.data);
+ }
+
+ return -1;
+ }
+ }
+
+ public OleDbErrorCollection Errors {
+ get {
+ GdaList glist;
+ IntPtr errors;
+ OleDbErrorCollection col = new OleDbErrorCollection ();
+
+ errors = libgda.gda_connection_get_errors (connection.GdaConnection);
+ if (errors != IntPtr.Zero) {
+ glist = (GdaList) Marshal.PtrToStructure (errors, typeof (GdaList));
+ while (glist != null) {
+ col.Add (new OleDbError (
+ libgda.gda_error_get_description (glist.data),
+ (int) libgda.gda_error_get_number (glist.data),
+ libgda.gda_error_get_source (glist.data),
+ libgda.gda_error_get_sqlstate (glist.data)));
+ glist = (GdaList) Marshal.PtrToStructure (glist.next,
+ typeof (GdaList));
+ }
+ }
+
+ return col;
+ }
+ }
+
+ public override string Message {
+ get {
+ GdaList glist;
+ IntPtr errors;
+ string msg = "";
+
+ errors = libgda.gda_connection_get_errors (connection.GdaConnection);
+ if (errors != IntPtr.Zero) {
+ glist = (GdaList) Marshal.PtrToStructure (errors, typeof (GdaList));
+ while (glist != null) {
+ msg = msg + ";" + libgda.gda_error_get_description (glist.data);
+ glist = (GdaList) Marshal.PtrToStructure (glist.next,
+ typeof (GdaList));
+ }
+
+ return msg;
+ }
+
+ return null;
+ }
+ }
+
+ public override string Source {
+ get {
+ GdaList glist;
+ IntPtr errors;
+
+ errors = libgda.gda_connection_get_errors (connection.GdaConnection);
+ if (errors != IntPtr.Zero) {
+ glist = (GdaList) Marshal.PtrToStructure (errors, typeof (GdaList));
+ return libgda.gda_error_get_source (glist.data);
+ }
+
+ return null;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventArgs.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..9c0b5fa89bf
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Data.OleDb.OleDbInfoMessageEventArgs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbInfoMessageEventArgs : EventArgs
+ {
+ #region Properties
+
+ public int ErrorCode {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public OleDbErrorCollection Errors {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Message {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Source {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventHandler.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..60fd9c96339
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Data.OleDb.OleDbInfoMessageEventHandler
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ [Serializable]
+ public delegate void OleDbInfoMessageEventHandler (object sender, OleDbInfoMessageEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbLiteral.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbLiteral.cs
new file mode 100644
index 00000000000..b9b2da42d27
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbLiteral.cs
@@ -0,0 +1,48 @@
+//
+// System.Data.OleDb.OleDbLiteral
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public enum OleDbLiteral {
+ Binary_Literal,
+ Catalog_Name,
+ Catalog_Separator,
+ Char_Literal,
+ Column_Alias,
+ Column_Name,
+ Correlation_Name,
+ Cube_Name,
+ Cursor_Name,
+ Dimension_Name,
+ Escape_Percent_Prefix,
+ Escape_Percent_Suffix,
+ Escape_Underscore_Prefix,
+ Escape_Underscore_Suffix,
+ Hierarchy_Name,
+ Index_Name,
+ Invalid,
+ Level_Name,
+ Like_Percent,
+ Like_Underscore,
+ Member_Name,
+ Procedure_Name,
+ Property_Name,
+ Quote_Prefix,
+ Quote_Suffix,
+ Schema_Name,
+ Schema_Separator,
+ Table_Name,
+ Text_Command,
+ User_Name,
+ View_Name
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbParameter.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbParameter.cs
new file mode 100644
index 00000000000..fc9d2aa4861
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbParameter.cs
@@ -0,0 +1,364 @@
+//
+// System.Data.OleDb.OleDbParameter
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+ {
+ #region Fields
+
+ string name;
+ object value;
+ int size;
+ bool isNullable;
+ byte precision;
+ byte scale;
+ DataRowVersion sourceVersion;
+ string sourceColumn;
+ ParameterDirection direction;
+ OleDbType oleDbType;
+ DbType dbType;
+
+ IntPtr gdaParameter;
+
+ #endregion
+
+ #region Constructors
+
+ public OleDbParameter ()
+ {
+ name = String.Empty;
+ value = null;
+ size = 0;
+ isNullable = true;
+ precision = 0;
+ scale = 0;
+ sourceColumn = String.Empty;
+ gdaParameter = IntPtr.Zero;
+ }
+
+ public OleDbParameter (string name, object value)
+ : this ()
+ {
+ this.name = name;
+ this.value = value;
+ OleDbType = GetOleDbType (value);
+ }
+
+ public OleDbParameter (string name, OleDbType dataType)
+ : this ()
+ {
+ this.name = name;
+ OleDbType = dataType;
+ }
+
+ public OleDbParameter (string name, OleDbType dataType, int size)
+ : this (name, dataType)
+ {
+ this.size = size;
+ }
+
+ public OleDbParameter (string name, OleDbType dataType, int size, string srcColumn)
+ : this (name, dataType, size)
+ {
+ this.sourceColumn = srcColumn;
+ }
+
+ public OleDbParameter(string name, OleDbType dataType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value)
+ : this (name, dataType, size, srcColumn)
+ {
+ this.direction = direction;
+ this.isNullable = isNullable;
+ this.precision = precision;
+ this.scale = scale;
+ this.sourceVersion = srcVersion;
+ this.value = value;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public DbType DbType {
+ get { return dbType; }
+ set {
+ dbType = value;
+ oleDbType = DbTypeToOleDbType (value);
+ }
+ }
+
+ public ParameterDirection Direction {
+ get { return direction; }
+ set { direction = value; }
+ }
+
+ public bool IsNullable {
+ get { return isNullable; }
+ }
+
+ public OleDbType OleDbType {
+ get { return oleDbType; }
+ set {
+ oleDbType = value;
+ dbType = OleDbTypeToDbType (value);
+ }
+ }
+
+ public string ParameterName {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ set { precision = value; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ set { scale = value; }
+ }
+
+ public int Size {
+ get { return size; }
+ set { size = value; }
+ }
+
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
+ }
+
+ public DataRowVersion SourceVersion {
+ get { return sourceVersion; }
+ set { sourceVersion = value; }
+ }
+
+ public object Value {
+ get { return value; }
+ set { this.value = value; }
+ }
+
+ #endregion // Properties
+
+ #region Internal Properties
+
+ internal IntPtr GdaParameter {
+ get { return gdaParameter; }
+ }
+
+ #endregion // Internal Properties
+
+ #region Methods
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ return ParameterName;
+ }
+
+ private OleDbType DbTypeToOleDbType (DbType dbType)
+ {
+ switch (dbType) {
+ case DbType.AnsiString :
+ return OleDbType.VarChar;
+ case DbType.AnsiStringFixedLength :
+ return OleDbType.Char;
+ case DbType.Binary :
+ return OleDbType.Binary;
+ case DbType.Boolean :
+ return OleDbType.Boolean;
+ case DbType.Byte :
+ return OleDbType.UnsignedTinyInt;
+ case DbType.Currency :
+ return OleDbType.Currency;
+ case DbType.Date :
+ return OleDbType.Date;
+ case DbType.DateTime :
+ throw new NotImplementedException ();
+ case DbType.Decimal :
+ return OleDbType.Decimal;
+ case DbType.Double :
+ return OleDbType.Double;
+ case DbType.Guid :
+ return OleDbType.Guid;
+ case DbType.Int16 :
+ return OleDbType.SmallInt;
+ case DbType.Int32 :
+ return OleDbType.Integer;
+ case DbType.Int64 :
+ return OleDbType.BigInt;
+ case DbType.Object :
+ return OleDbType.Variant;
+ case DbType.SByte :
+ return OleDbType.TinyInt;
+ case DbType.Single :
+ return OleDbType.Single;
+ case DbType.String :
+ return OleDbType.WChar;
+ case DbType.StringFixedLength :
+ return OleDbType.VarWChar;
+ case DbType.Time :
+ throw new NotImplementedException ();
+ case DbType.UInt16 :
+ return OleDbType.UnsignedSmallInt;
+ case DbType.UInt32 :
+ return OleDbType.UnsignedInt;
+ case DbType.UInt64 :
+ return OleDbType.UnsignedBigInt;
+ case DbType.VarNumeric :
+ return OleDbType.VarNumeric;
+ }
+ return OleDbType.Variant;
+ }
+
+ private DbType OleDbTypeToDbType (OleDbType oleDbType)
+ {
+ switch (oleDbType) {
+ case OleDbType.BigInt :
+ return DbType.Int64;
+ case OleDbType.Binary :
+ return DbType.Binary;
+ case OleDbType.Boolean :
+ return DbType.Boolean;
+ case OleDbType.BSTR :
+ return DbType.AnsiString;
+ case OleDbType.Char :
+ return DbType.AnsiStringFixedLength;
+ case OleDbType.Currency :
+ return DbType.Currency;
+ case OleDbType.Date :
+ return DbType.DateTime;
+ case OleDbType.DBDate :
+ return DbType.DateTime;
+ case OleDbType.DBTime :
+ throw new NotImplementedException ();
+ case OleDbType.DBTimeStamp :
+ return DbType.DateTime;
+ case OleDbType.Decimal :
+ return DbType.Decimal;
+ case OleDbType.Double :
+ return DbType.Double;
+ case OleDbType.Empty :
+ throw new NotImplementedException ();
+ case OleDbType.Error :
+ throw new NotImplementedException ();
+ case OleDbType.Filetime :
+ return DbType.DateTime;
+ case OleDbType.Guid :
+ return DbType.Guid;
+ case OleDbType.IDispatch :
+ return DbType.Object;
+ case OleDbType.Integer :
+ return DbType.Int32;
+ case OleDbType.IUnknown :
+ return DbType.Object;
+ case OleDbType.LongVarBinary :
+ return DbType.Binary;
+ case OleDbType.LongVarChar :
+ return DbType.AnsiString;
+ case OleDbType.LongVarWChar :
+ return DbType.String;
+ case OleDbType.Numeric :
+ return DbType.Decimal;
+ case OleDbType.PropVariant :
+ return DbType.Object;
+ case OleDbType.Single :
+ return DbType.Single;
+ case OleDbType.SmallInt :
+ return DbType.Int16;
+ case OleDbType.TinyInt :
+ return DbType.SByte;
+ case OleDbType.UnsignedBigInt :
+ return DbType.UInt64;
+ case OleDbType.UnsignedInt :
+ return DbType.UInt32;
+ case OleDbType.UnsignedSmallInt :
+ return DbType.UInt16;
+ case OleDbType.UnsignedTinyInt :
+ return DbType.Byte;
+ case OleDbType.VarBinary :
+ return DbType.Binary;
+ case OleDbType.VarChar :
+ return DbType.AnsiString;
+ case OleDbType.Variant :
+ return DbType.Object;
+ case OleDbType.VarNumeric :
+ return DbType.VarNumeric;
+ case OleDbType.VarWChar :
+ return DbType.StringFixedLength;
+ case OleDbType.WChar :
+ return DbType.String;
+ }
+ return DbType.Object;
+ }
+
+ private OleDbType GetOleDbType (object value)
+ {
+ if (value is Guid) return OleDbType.Guid;
+ if (value is TimeSpan) return OleDbType.DBTime;
+
+ switch (Type.GetTypeCode (value.GetType ())) {
+ case TypeCode.Boolean :
+ return OleDbType.Boolean;
+ case TypeCode.Byte :
+ if (value.GetType().IsArray)
+ return OleDbType.Binary;
+ else
+ return OleDbType.UnsignedTinyInt;
+ case TypeCode.Char :
+ return OleDbType.Char;
+ case TypeCode.DateTime :
+ return OleDbType.Date;
+ case TypeCode.DBNull :
+ return OleDbType.Empty;
+ case TypeCode.Decimal :
+ return OleDbType.Decimal;
+ case TypeCode.Double :
+ return OleDbType.Double;
+ case TypeCode.Empty :
+ return OleDbType.Empty;
+ case TypeCode.Int16 :
+ return OleDbType.SmallInt;
+ case TypeCode.Int32 :
+ return OleDbType.Integer;
+ case TypeCode.Int64 :
+ return OleDbType.BigInt;
+ case TypeCode.SByte :
+ return OleDbType.TinyInt;
+ case TypeCode.String :
+ return OleDbType.VarChar;
+ case TypeCode.Single :
+ return OleDbType.Single;
+ case TypeCode.UInt64 :
+ return OleDbType.UnsignedBigInt;
+ case TypeCode.UInt32 :
+ return OleDbType.UnsignedInt;
+ case TypeCode.UInt16 :
+ return OleDbType.UnsignedSmallInt;
+ case TypeCode.Object :
+ return OleDbType.Variant;
+ }
+ return OleDbType.IUnknown;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbParameterCollection.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbParameterCollection.cs
new file mode 100644
index 00000000000..8d09e465c16
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbParameterCollection.cs
@@ -0,0 +1,208 @@
+//
+// System.Data.OleDb.OleDbParameterCollection
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbParameterCollection : MarshalByRefObject,
+ IDataParameterCollection, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public OleDbParameter this[int index] {
+ get { return (OleDbParameter) list[index]; }
+ set { list[index] = value; }
+ }
+
+ public OleDbParameter this[string parameterName] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ int ICollection.Count {
+ get { return list.Count; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ object IList.this[int index] {
+ get { return list[index]; }
+ set { list[index] = value; }
+ }
+
+ object IDataParameterCollection.this[string name]
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal IntPtr GdaParameterList {
+ [MonoTODO]
+ get {
+ IntPtr param_list;
+
+ param_list = libgda.gda_parameter_list_new ();
+ // FIXME: add parameters to list
+
+ return param_list;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+
+ public OleDbParameter Add (OleDbParameter parameter)
+ {
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OleDbParameter Add (string name, object value)
+ {
+ OleDbParameter parameter = new OleDbParameter (name, value);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OleDbParameter Add (string name, OleDbType type)
+ {
+ OleDbParameter parameter = new OleDbParameter (name, type);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OleDbParameter Add (string name, OleDbType type, int width)
+ {
+ OleDbParameter parameter = new OleDbParameter (name, type, width);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ public OleDbParameter Add (string name, OleDbType type,
+ int width, string src_col)
+ {
+ OleDbParameter parameter = new OleDbParameter (name, type, width, src_col);
+ list.Add (parameter);
+ return parameter;
+ }
+
+ int IList.Add (object value)
+ {
+ if (!(value is IDataParameter))
+ throw new InvalidCastException ();
+
+ list.Add (value);
+ return list.IndexOf (value);
+ }
+
+ void IList.Clear ()
+ {
+ list.Clear ();
+ }
+
+ bool IList.Contains (object value)
+ {
+ return list.Contains (value);
+ }
+
+ bool IDataParameterCollection.Contains (string value)
+ {
+ for (int i = 0; i < list.Count; i++) {
+ IDataParameter parameter;
+
+ parameter = (IDataParameter) list[i];
+ if (parameter.ParameterName == value)
+ return true;
+ }
+
+ return false;
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ ((OleDbParameter[])(list.ToArray ())).CopyTo (array, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return list.IndexOf (value);
+ }
+
+ int IDataParameterCollection.IndexOf (string name)
+ {
+ return list.IndexOf (((IDataParameterCollection) this)[name]);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ void IList.Remove (object value)
+ {
+ list.Remove (value);
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ list.Remove ((object) list[index]);
+ }
+
+ void IDataParameterCollection.RemoveAt (string name)
+ {
+ list.Remove (((IDataParameterCollection) this)[name]);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs
new file mode 100644
index 00000000000..2bf95972a5e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs
@@ -0,0 +1,95 @@
+//
+// System.Data.OleDb.OleDbPermission
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Data.OleDb
+{
+ [Serializable]
+ public sealed class OleDbPermission : DBDataPermission
+ {
+ #region Constructors
+
+ [MonoTODO]
+ public OleDbPermission ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbPermission (PermissionState state)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbPermission (PermissionState state, bool allowBlankPassword)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public string Provider {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override IPermission Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement securityElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbPermissionAttribute.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbPermissionAttribute.cs
new file mode 100644
index 00000000000..1de7a88e6ea
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbPermissionAttribute.cs
@@ -0,0 +1,62 @@
+//
+// System.Data.OleDb.OleDbPermissionAttribute
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Data.OleDb
+{
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class OleDbPermissionAttribute : DBDataPermissionAttribute
+ {
+
+ #region Constructors
+
+ [MonoTODO]
+ OleDbPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public string Provider {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..036e31bfaad
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventArgs.cs
@@ -0,0 +1,46 @@
+//
+// System.Data.OleDb.OleDbRowUpdatedEventArgs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ #region Fields
+
+ OleDbCommand command;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public OleDbRowUpdatedEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (dataRow, command, statementType, tableMapping)
+
+ {
+ this.command = (OleDbCommand) command;
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public new OleDbCommand Command {
+ get { return command; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..fc911b7c6c6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatedEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Data.OleDb.OleDbRowUpdatedEventHandler
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ [Serializable]
+ public delegate void OleDbRowUpdatedEventHandler (
+ object sender,
+ OleDbRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..8cf9aedafd2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventArgs.cs
@@ -0,0 +1,48 @@
+//
+// System.Data.OleDb.OleDbRowUpdatingEventArgs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+
+ #region Fields
+
+ OleDbCommand command = null;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO]
+ public OleDbRowUpdatingEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (dataRow, command, statementType, tableMapping)
+
+ {
+ this.command = (OleDbCommand) command;
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public new OleDbCommand Command {
+ get { return command; }
+ set { command = value; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..42e42fcc628
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbRowUpdatingEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Data.OleDb.OleDbRowUpdatingEventHandler
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ [Serializable]
+ public delegate void OleDbRowUpdatingEventHandler (
+ object sender,
+ OleDbRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbSchemaGuid.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbSchemaGuid.cs
new file mode 100644
index 00000000000..1250ee96e57
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbSchemaGuid.cs
@@ -0,0 +1,67 @@
+//
+// System.Data.OleDb.OleDbSchemaGuid
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbSchemaGuid
+ {
+ #region Fields
+
+ public static readonly Guid Assertions = new Guid ("df855bea-fb95-4abc-8932-e57e45c7ddae");
+ public static readonly Guid Catalogs = new Guid ("e4a67334-f03c-45af-8b1d-531f99268045");
+ public static readonly Guid Character_Sets = new Guid ("e4533bdb-0b55-48ee-986d-17d07143657d");
+ public static readonly Guid Check_Constraints = new Guid ("fedf7f5d-cfb4-4635-af02-45eb4bb4e8f3");
+ public static readonly Guid Check_Constraints_By_Table = new Guid ("d76547ef-837d-413c-8d76-bab1d7bb014a");
+ public static readonly Guid Collations = new Guid ("5145b85c-c448-4b9e-8929-4c2de31ffa30");
+ public static readonly Guid Columns = new Guid ("86dcd6e2-9a8c-4c6d-bc1c-e0e334c727c9");
+ public static readonly Guid Column_Domain_Usage = new Guid ("058acb5e-eb1d-4b6e-8e98-a7d59a959ff1");
+ public static readonly Guid Column_Privileges = new Guid ("43152796-f3b4-4342-9647-008f1060e352");
+ public static readonly Guid Constraint_Column_Usage = new Guid ("3a39f999-f481-4293-8b9f-af7e91b4ee7d");
+ public static readonly Guid Constraint_Table_Usage = new Guid ("d689719b-24b0-4963-a635-097c480edcd2");
+ public static readonly Guid DbInfoLiterals = new Guid ("7a564da6-f3bc-474b-9e66-71cb47bde5b0");
+ public static readonly Guid Foreign_Keys = new Guid ("d9e547ce-e62d-4200-b849-566bc3dc29de");
+ public static readonly Guid Indexes = new Guid ("69d8523c-96ad-40cb-a89a-ee98d2d6fcec");
+ public static readonly Guid Key_Column_Usage = new Guid ("65423211-805e-4822-8eb4-f4f6d540056e");
+ public static readonly Guid Primary_Keys = new Guid ("c6e5b174-fbd8-4055-b757-8585040e463f");
+ public static readonly Guid Procedures = new Guid ("61f276ad-4f25-4c26-b4ae-8238e06d56db");
+ public static readonly Guid Procedure_Columns = new Guid ("7148080d-e053-4ada-b79a-9a2ff614a3d4");
+ public static readonly Guid Procedure_Parameters = new Guid ("984af700-8fe7-476f-81c2-4b814df67907");
+ public static readonly Guid Provider_Types = new Guid ("0bc2da44-d834-4136-9ff0-3cef477784b9");
+ public static readonly Guid Referential_Constraints = new Guid ("d2eab85e-49a7-462d-aa22-1d97c74178ae");
+ public static readonly Guid Schemata = new Guid ("2fbd7503-0af3-43d2-92c6-51e78b84dd37");
+ public static readonly Guid Sql_Languages = new Guid ("d60a511d-a07f-4e59-aac2-71c25fab5b02");
+ public static readonly Guid Statistics = new Guid ("03ed9f7d-35bc-45fe-993f-ee7a5f29fb74");
+ public static readonly Guid Tables = new Guid ("ceac88ba-240c-4bb4-821e-4a49fc013371");
+ public static readonly Guid Tables_Info = new Guid ("9ff81c59-2b1e-4371-a08b-3a2d373189fa");
+ public static readonly Guid Table_Constraints = new Guid ("62883c55-082d-42cb-bb00-747985ca6047");
+ public static readonly Guid Table_Privileges = new Guid ("1a73f478-8c8e-4ede-b3ec-22ba13ab55a0");
+ public static readonly Guid Table_Statistics = new Guid ("9c944744-cd51-448a-8be4-7095f039d0ef");
+ public static readonly Guid Translations = new Guid ("5578b57e-a682-4f1b-bdb4-f8a14ad6f61e");
+ public static readonly Guid Trustee = new Guid ("521207e2-3a23-42b6-ac78-810a3fce3271");
+ public static readonly Guid Usage_Privileges = new Guid ("f8113a2b-2934-4c67-ab7b-adbe3ab74973");
+ public static readonly Guid Views = new Guid ("9a6345b6-61a0-40fd-9b45-402f3c9c9c3e");
+ public static readonly Guid View_Column_Usage = new Guid ("2c91ef91-02d8-4d38-ae5a-1e826873d6ea");
+ public static readonly Guid View_Table_Usage = new Guid ("7dcb7f53-1045-4fdf-86a1-d3caaf27c7f5");
+
+ #endregion
+
+ #region Constructors
+
+ public OleDbSchemaGuid ()
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
new file mode 100644
index 00000000000..68386f5cdda
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
@@ -0,0 +1,149 @@
+//
+// System.Data.OleDb.OleDbTransaction
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public sealed class OleDbTransaction : MarshalByRefObject, IDbTransaction, IDisposable
+ {
+ #region Fields
+
+ OleDbConnection connection;
+ IntPtr gdaTransaction;
+ int depth;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal OleDbTransaction (OleDbConnection connection, int depth)
+ : this (connection, depth, IsolationLevel.ReadCommitted)
+ {
+ }
+
+ internal OleDbTransaction (OleDbConnection connection)
+ : this (connection, 1)
+ {
+ }
+
+ internal OleDbTransaction (OleDbConnection connection, int depth, IsolationLevel isolevel)
+ {
+ this.connection = connection;
+
+ gdaTransaction = libgda.gda_transaction_new (depth.ToString ());
+
+ switch (isolevel) {
+ case IsolationLevel.ReadCommitted :
+ libgda.gda_transaction_set_isolation_level (gdaTransaction,
+ GdaTransactionIsolation.ReadCommitted);
+ break;
+ case IsolationLevel.ReadUncommitted :
+ libgda.gda_transaction_set_isolation_level (gdaTransaction,
+ GdaTransactionIsolation.ReadUncommitted);
+ break;
+ case IsolationLevel.RepeatableRead :
+ libgda.gda_transaction_set_isolation_level (gdaTransaction,
+ GdaTransactionIsolation.RepeatableRead);
+ break;
+ case IsolationLevel.Serializable :
+ libgda.gda_transaction_set_isolation_level (gdaTransaction,
+ GdaTransactionIsolation.Serializable);
+ break;
+ }
+
+ libgda.gda_connection_begin_transaction (connection.GdaConnection, gdaTransaction);
+ }
+
+ internal OleDbTransaction (OleDbConnection connection, IsolationLevel isolevel)
+ : this (connection, 1, isolevel)
+ {
+ }
+
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public OleDbConnection Connection {
+ get {
+ return connection;
+ }
+ }
+
+ IDbConnection IDbTransaction.Connection {
+ get {
+ return connection;
+ }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get {
+ switch (libgda.gda_transaction_get_isolation_level (gdaTransaction)) {
+ case GdaTransactionIsolation.ReadCommitted :
+ return IsolationLevel.ReadCommitted;
+ case GdaTransactionIsolation.ReadUncommitted :
+ return IsolationLevel.ReadUncommitted;
+ case GdaTransactionIsolation.RepeatableRead :
+ return IsolationLevel.RepeatableRead;
+ case GdaTransactionIsolation.Serializable :
+ return IsolationLevel.Serializable;
+ }
+
+ return IsolationLevel.Unspecified;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public OleDbTransaction Begin ()
+ {
+ return new OleDbTransaction (connection, depth + 1);
+ }
+
+ public OleDbTransaction Begin (IsolationLevel isolevel)
+ {
+ return new OleDbTransaction (connection, depth + 1, isolevel);
+ }
+
+ public void Commit ()
+ {
+ if (!libgda.gda_connection_commit_transaction (connection.GdaConnection,
+ gdaTransaction))
+ throw new InvalidOperationException ();
+ }
+
+ [MonoTODO]
+ ~OleDbTransaction ()
+ {
+ libgda.FreeObject (gdaTransaction);
+ gdaTransaction = IntPtr.Zero;
+ }
+
+ [MonoTODO]
+ void IDisposable.Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Rollback ()
+ {
+ if (!libgda.gda_connection_rollback_transaction (connection.GdaConnection,
+ gdaTransaction))
+ throw new InvalidOperationException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbType.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbType.cs
new file mode 100644
index 00000000000..fcd3ae46efd
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbType.cs
@@ -0,0 +1,56 @@
+//
+// System.Data.OleDb.OleDbType
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.OleDb
+{
+ public enum OleDbType {
+ BigInt,
+ Binary,
+ Boolean,
+ BSTR,
+ Char,
+ Currency,
+ Date,
+ DBDate,
+ DBTime,
+ DBTimeStamp,
+ Decimal,
+ Double,
+ Empty,
+ Error,
+ Filetime,
+ Guid,
+ IDispatch,
+ Integer,
+ IUnknown,
+ LongVarBinary,
+ LongVarChar,
+ LongVarWChar,
+ Numeric,
+ PropVariant,
+ Single,
+ SmallInt,
+ TinyInt,
+ UnsignedBigInt,
+ UnsignedInt,
+ UnsignedSmallInt,
+ UnsignedTinyInt,
+ VarBinary,
+ VarChar,
+ Variant,
+ VarNumeric,
+ VarWChar,
+ WChar
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/TestGDA.cs b/mcs/class/System.Data/System.Data.OleDb/TestGDA.cs
new file mode 100644
index 00000000000..19eea663949
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/TestGDA.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Data.OleDb;
+
+namespace Mono.Data.GDA.Test
+{
+ public class TestGDA
+ {
+ private IntPtr m_gdaClient = IntPtr.Zero;
+ private IntPtr m_gdaConnection = IntPtr.Zero;
+
+ static void Main (string[] args)
+ {
+ TestGDA test = new TestGDA ();
+
+ /* initialization */
+ libgda.gda_init ("TestGDA#", "0.1", args.Length, args);
+ test.m_gdaClient = libgda.gda_client_new ();
+
+ /* open connection */
+ test.m_gdaConnection = libgda.gda_client_open_connection (
+ test.m_gdaClient,
+ "PostgreSQL",
+ "", "");
+ if (test.m_gdaConnection != IntPtr.Zero) {
+ System.Console.Write ("Connection successful!");
+
+ /* close connection */
+ libgda.gda_connection_close (test.m_gdaConnection);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs b/mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs
new file mode 100644
index 00000000000..117efe4ab8d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/TestOleDb.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Data.OleDb;
+
+namespace System.Data.OleDb.Test
+{
+ public class TestOleDb
+ {
+ private OleDbConnection m_cnc;
+
+ private TestOleDb ()
+ {
+ OleDbCommand cmd;
+
+ m_cnc = new OleDbConnection ("Provider=PostgreSQL;Addr=127.0.0.1;Database=rodrigo");
+ m_cnc.Open ();
+
+ Console.WriteLine ("Connected to:");
+ Console.WriteLine (" Data Source: " + m_cnc.DataSource);
+ Console.WriteLine (" Database: " + m_cnc.Database);
+ Console.WriteLine (" Connection string: " + m_cnc.ConnectionString);
+ Console.WriteLine (" Provider: " + m_cnc.Provider);
+ Console.WriteLine (" Server version:" + m_cnc.ServerVersion);
+
+ /* create temporary table */
+ Console.WriteLine ("Creating temporary table...");
+ cmd = new OleDbCommand ("CREATE TABLE mono_test_table ( " +
+ " name varchar(25), email varchar(50), date_entered timestamp)",
+ m_cnc);
+ cmd.ExecuteNonQuery ();
+ InsertRow ("Mike Smith", "mike@smiths.com");
+ InsertRow ("Julie Andrews", "julie@hollywood.com");
+ InsertRow ("Michael Jordan", "michael@bulls.com");
+ }
+
+ void InsertRow (string name, string email)
+ {
+ OleDbCommand cmd;
+
+ cmd = new OleDbCommand ("INSERT INTO mono_test_table (name, email, date_entered) VALUES ('" +
+ name + "', '" + email +"', date 'now')", m_cnc);
+ Console.WriteLine ("Executing command '" + cmd.CommandText + "'");
+ cmd.ExecuteNonQuery ();
+
+ }
+
+ void DisplayRow (OleDbDataReader reader)
+ {
+ for (int i = 0; i < reader.FieldCount; i++) {
+ Console.WriteLine (" " + reader.GetDataTypeName (i) + ": " +
+ reader.GetValue (i).ToString ());
+ }
+ }
+
+ void TestDataReader ()
+ {
+ int i = 0;
+ string sql = "SELECT * FROM mono_test_table";
+
+ Console.WriteLine ("Executing SELECT command...");
+ OleDbCommand cmd = new OleDbCommand (sql, m_cnc);
+ OleDbDataReader reader = cmd.ExecuteReader ();
+
+ Console.WriteLine (" Recordset description:");
+ for (i = 0; i < reader.FieldCount; i++) {
+ Console.WriteLine (" Field " + i + ": " +
+ reader.GetName (i) + " (" +
+ reader.GetDataTypeName (i) + ")");
+ }
+
+ Console.WriteLine ("Reading data...");
+ i = 0;
+ while (reader.Read ()) {
+ Console.WriteLine ("Row " + i + ":");
+ DisplayRow (reader);
+ i++;
+ }
+
+ reader.Close ();
+ }
+
+ void TestTransaction ()
+ {
+ Console.WriteLine ("Starting transaction...");
+ OleDbTransaction xaction = m_cnc.BeginTransaction ();
+
+ Console.WriteLine ("Aborting transaction...");
+ xaction.Rollback ();
+ }
+
+ void Close ()
+ {
+ OleDbCommand cmd = new OleDbCommand ("DROP TABLE mono_test_table", m_cnc);
+ cmd.ExecuteNonQuery ();
+ m_cnc.Close ();
+ }
+
+ static void Main (string[] args)
+ {
+ try {
+ TestOleDb test = new TestOleDb ();
+ test.TestDataReader ();
+ test.TestTransaction ();
+ test.Close ();
+ } catch (Exception e) {
+ Console.WriteLine ("An error has occured: {0}", e.ToString ());
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.OleDb/libgda.cs b/mcs/class/System.Data/System.Data.OleDb/libgda.cs
new file mode 100644
index 00000000000..0a9242dfb3a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.OleDb/libgda.cs
@@ -0,0 +1,311 @@
+//
+// System.Data.OleDb.libgda
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace System.Data.OleDb
+{
+ internal enum GdaCommandOptions {
+ IgnoreErrors = 1,
+ StopOnErrors = 1 << 1,
+ BadOption = 1 << 2,
+ };
+
+ internal enum GdaCommandType {
+ Sql = 0,
+ Xml = 1,
+ Procedure = 2,
+ Table = 3,
+ Schema = 4,
+ Invalid = 5
+ };
+
+ internal enum GdaTransactionIsolation {
+ Unknown,
+ ReadCommitted,
+ ReadUncommitted,
+ RepeatableRead,
+ Serializable
+ };
+
+ internal enum GdaValueType {
+ Null = 0,
+ Bigint = 1,
+ Binary = 2,
+ Boolean = 3,
+ Date = 4,
+ Double = 5,
+ GeometricPoint = 6,
+ Integer = 7,
+ List = 8,
+ Numeric = 9,
+ Single = 10,
+ Smallint = 11,
+ String = 12,
+ Time = 13,
+ Timestamp = 14,
+ Tinyint = 15,
+ Type = 16,
+ Unknown = 17
+ };
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GdaDate
+ {
+ public short year;
+ public ushort month;
+ public ushort day;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GdaTime
+ {
+ public ushort hour;
+ public ushort minute;
+ public ushort second;
+ public long timezone;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GdaTimestamp
+ {
+ public short year;
+ public ushort month;
+ public ushort day;
+ public ushort hour;
+ public ushort minute;
+ public ushort second;
+ public ulong fraction;
+ public long timezone;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GdaList
+ {
+ public IntPtr data;
+ public IntPtr next;
+ public IntPtr prev;
+ }
+
+ sealed internal class libgda
+ {
+ private static IntPtr gdaClient = IntPtr.Zero;
+
+ public static IntPtr GdaClient
+ {
+ get {
+ if (gdaClient == IntPtr.Zero)
+ gdaClient = gda_client_new ();
+
+ return gdaClient;
+ }
+ }
+
+ [DllImport("gobject-2.0",
+ EntryPoint="g_object_unref")]
+ public static extern void FreeObject (IntPtr obj);
+
+ [DllImport("gda-2")]
+ public static extern void gda_init (string app_id, string version, int nargs, string[] args);
+
+ [DllImport("gda-2")]
+ public static extern GdaValueType gda_value_get_type (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern long gda_value_get_bigint (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_value_get_boolean (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_value_get_date (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern double gda_value_get_double (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern int gda_value_get_integer (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern float gda_value_get_single (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern int gda_value_get_smallint (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern string gda_value_get_string (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_value_get_time (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_value_get_timestamp (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern byte gda_value_get_tinyint (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_value_is_null (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern string gda_value_stringify (IntPtr value);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_parameter_list_new ();
+
+ [DllImport("gda-2")]
+ public static extern string gda_type_to_string (GdaValueType type);
+
+ [DllImport("gda-2")]
+ public static extern int gda_data_model_get_n_rows (IntPtr model);
+
+ [DllImport("gda-2")]
+ public static extern int gda_data_model_get_n_columns (IntPtr model);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_data_model_get_value_at (IntPtr model, int col, int row);
+
+ [DllImport("gda-2")]
+ public static extern string gda_data_model_get_column_title (IntPtr model, int col);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_data_model_describe_column (IntPtr model, int col);
+
+ [DllImport("gda-2")]
+ public static extern int gda_data_model_get_column_position (IntPtr model, string name);
+
+ [DllImport("gda-2")]
+ public static extern void gda_field_attributes_free (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern string gda_field_attributes_get_name (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern GdaValueType gda_field_attributes_get_gdatype (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern long gda_field_attributes_get_defined_size (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern long gda_field_attributes_get_scale (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_field_attributes_get_allow_null (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_field_attributes_get_primary_key (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_field_attributes_get_unique_key (IntPtr fa);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_client_new ();
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_client_open_connection (IntPtr client, string dsn, string username, string password);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_client_open_connection_from_string (IntPtr client,
+ string provider,
+ string cnc_string);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_is_open (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_close (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_server_version (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_database (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_dsn (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_cnc_string (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_provider (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_username (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern string gda_connection_get_password (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_change_database (IntPtr cnc, string name);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_transaction_new (string name);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_transaction_get_name (IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_transaction_set_name (IntPtr xaction, string name);
+
+ [DllImport("gda-2")]
+ public static extern GdaTransactionIsolation gda_transaction_get_isolation_level (IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern void gda_transaction_set_isolation_level (IntPtr xaction,
+ GdaTransactionIsolation level);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_begin_transaction (IntPtr cnc, IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_commit_transaction (IntPtr cnc, IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_rollback_transaction (IntPtr cnc, IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_connection_execute_command (IntPtr cnc, IntPtr cmd, IntPtr parameterList);
+
+ [DllImport("gda-2")]
+ public static extern int gda_connection_execute_non_query (IntPtr cnc, IntPtr command, IntPtr parameterList);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_connection_execute_single_command (IntPtr cnc, IntPtr command, IntPtr parameterList);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_connection_get_errors (IntPtr cnc);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_command_new (string text, GdaCommandType type, GdaCommandOptions options);
+
+ [DllImport("gda-2")]
+ public static extern void gda_command_set_text (IntPtr cmd, string text);
+
+ [DllImport("gda-2")]
+ public static extern void gda_command_set_command_type (IntPtr cmd, GdaCommandType type);
+
+ [DllImport("gda-2")]
+ public static extern string gda_error_get_description (IntPtr error);
+
+ [DllImport("gda-2")]
+ public static extern long gda_error_get_number (IntPtr error);
+
+ [DllImport("gda-2")]
+ public static extern string gda_error_get_source (IntPtr error);
+
+ [DllImport("gda-2")]
+ public static extern string gda_error_get_sqlstate (IntPtr error);
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
new file mode 100644
index 00000000000..ad826984b71
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
@@ -0,0 +1,57 @@
+//
+// System.Data.SqlClient.SqlClientPermission.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Data.SqlClient {
+ [Serializable]
+ public sealed class SqlClientPermission : DBDataPermission
+ {
+ #region Fields
+
+ PermissionState state;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlClientPermission ()
+ : this (PermissionState.None, false)
+ {
+ }
+
+ public SqlClientPermission (PermissionState state)
+ : this (state, false)
+ {
+ }
+
+ public SqlClientPermission (PermissionState state, bool allowBlankPassword)
+ {
+ AllowBlankPassword = allowBlankPassword;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ protected override DBDataPermission CreateInstance ()
+ {
+ return (DBDataPermission) new SqlClientPermission ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs
new file mode 100644
index 00000000000..a53703b8bfa
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs
@@ -0,0 +1,43 @@
+//
+// System.Data.SqlClient.SqlClientPermissionAttribute.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Data.SqlClient {
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SqlClientPermissionAttribute : DBDataPermissionAttribute
+ {
+ #region Constructors
+
+ public SqlClientPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override IPermission CreatePermission()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
new file mode 100644
index 00000000000..51e51cce74f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
@@ -0,0 +1,420 @@
+//
+// System.Data.SqlClient.SqlCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002 http://www.ximian.com/
+// (C) Daniel Morgan, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Xml;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlCommand : Component, IDbCommand, ICloneable
+ {
+ #region Fields
+
+ bool disposed = false;
+ int commandTimeout;
+ bool designTimeVisible;
+ string commandText;
+ CommandType commandType;
+ SqlConnection connection;
+ SqlTransaction transaction;
+ UpdateRowSource updatedRowSource;
+ CommandBehavior behavior = CommandBehavior.Default;
+ SqlParameterCollection parameters;
+ string preparedStatement = null;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlCommand()
+ : this (String.Empty, null, null)
+ {
+ }
+
+ public SqlCommand (string commandText)
+ : this (commandText, null, null)
+ {
+ commandText = commandText;
+ }
+
+ public SqlCommand (string commandText, SqlConnection connection)
+ : this (commandText, connection, null)
+ {
+ Connection = connection;
+ }
+
+ public SqlCommand (string commandText, SqlConnection connection, SqlTransaction transaction)
+ {
+ this.commandText = commandText;
+ this.connection = connection;
+ this.transaction = transaction;
+ this.commandType = CommandType.Text;
+ this.updatedRowSource = UpdateRowSource.Both;
+
+ this.designTimeVisible = false;
+ this.commandTimeout = 30;
+ parameters = new SqlParameterCollection (this);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ internal CommandBehavior CommandBehavior {
+ get { return behavior; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Command text to execute.")]
+ [DefaultValue ("")]
+ [RefreshProperties (RefreshProperties.All)]
+ public string CommandText {
+ get { return commandText; }
+ set {
+ if (value != commandText && preparedStatement != null)
+ Unprepare ();
+ commandText = value;
+ }
+ }
+
+ [DataSysDescription ("Time to wait for command to execute.")]
+ [DefaultValue (30)]
+ public int CommandTimeout {
+ get { return commandTimeout; }
+ set {
+ if (commandTimeout < 0)
+ throw new ArgumentException ("The property value assigned is less than 0.");
+ commandTimeout = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("How to interpret the CommandText.")]
+ [DefaultValue (CommandType.Text)]
+ [RefreshProperties (RefreshProperties.All)]
+ public CommandType CommandType {
+ get { return commandType; }
+ set {
+ if (value == CommandType.TableDirect)
+ throw new ArgumentException ("CommandType.TableDirect is not supported by the Mono SqlClient Data Provider.");
+ commandType = value;
+ }
+ }
+
+ [DataCategory ("Behavior")]
+ [DefaultValue (null)]
+ [DataSysDescription ("Connection used by the command.")]
+ public SqlConnection Connection {
+ get { return connection; }
+ set {
+ if (transaction != null && connection.Transaction != null && connection.Transaction.IsOpen)
+ throw new InvalidOperationException ("The Connection property was changed while a transaction was in progress.");
+ transaction = null;
+ connection = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DefaultValue (true)]
+ [DesignOnly (true)]
+ public bool DesignTimeVisible {
+ get { return designTimeVisible; }
+ set { designTimeVisible = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("The parameters collection.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public SqlParameterCollection Parameters {
+ get { return parameters; }
+ }
+
+ internal ITds Tds {
+ get { return Connection.Tds; }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get { return Connection; }
+ set {
+ if (!(value is SqlConnection))
+ throw new InvalidCastException ("The value was not a valid SqlConnection.");
+ Connection = (SqlConnection) value;
+ }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get { return Parameters; }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get { return Transaction; }
+ set {
+ if (!(value is SqlTransaction))
+ throw new ArgumentException ();
+ Transaction = (SqlTransaction) value;
+ }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The transaction used by the command.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SqlTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
+ }
+
+ [DataCategory ("Behavior")]
+ [DataSysDescription ("When used by a DataAdapter.Update, how command results are applied to the current DataRow.")]
+ [DefaultValue (UpdateRowSource.Both)]
+ public UpdateRowSource UpdatedRowSource {
+ get { return updatedRowSource; }
+ set { updatedRowSource = value; }
+ }
+
+ #endregion // Fields
+
+ #region Methods
+
+ public void Cancel ()
+ {
+ if (Connection == null || Connection.Tds == null)
+ return;
+ Connection.Tds.Cancel ();
+ }
+
+ internal void CloseDataReader (bool moreResults)
+ {
+ Connection.DataReader = null;
+
+ if ((behavior & CommandBehavior.CloseConnection) != 0)
+ Connection.Close ();
+ }
+
+ public SqlParameter CreateParameter ()
+ {
+ return new SqlParameter ();
+ }
+
+ internal void DeriveParameters ()
+ {
+ if (commandType != CommandType.StoredProcedure)
+ throw new InvalidOperationException (String.Format ("SqlCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType));
+ ValidateCommand ("DeriveParameters");
+
+ SqlParameterCollection localParameters = new SqlParameterCollection (this);
+ localParameters.Add ("@P1", SqlDbType.NVarChar, commandText.Length).Value = commandText;
+
+ string sql = "sp_procedure_params_rowset";
+
+ Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true);
+
+ SqlDataReader reader = new SqlDataReader (this);
+ parameters.Clear ();
+ object[] dbValues = new object[reader.FieldCount];
+
+ while (reader.Read ()) {
+ reader.GetValues (dbValues);
+ parameters.Add (new SqlParameter (dbValues));
+ }
+ reader.Close ();
+ }
+
+ private void Execute (CommandBehavior behavior, bool wantResults)
+ {
+ TdsMetaParameterCollection parms = Parameters.MetaParameters;
+ if (preparedStatement == null) {
+ bool schemaOnly = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
+ bool keyInfo = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
+
+ StringBuilder sql1 = new StringBuilder ();
+ StringBuilder sql2 = new StringBuilder ();
+
+ if (schemaOnly || keyInfo)
+ sql1.Append ("SET FMTONLY OFF;");
+ if (keyInfo) {
+ sql1.Append ("SET NO_BROWSETABLE ON;");
+ sql2.Append ("SET NO_BROWSETABLE OFF;");
+ }
+ if (schemaOnly) {
+ sql1.Append ("SET FMTONLY ON;");
+ sql2.Append ("SET FMTONLY OFF;");
+ }
+
+ switch (CommandType) {
+ case CommandType.StoredProcedure:
+ if (keyInfo || schemaOnly)
+ Connection.Tds.Execute (sql1.ToString ());
+ Connection.Tds.ExecProc (CommandText, parms, CommandTimeout, wantResults);
+ if (keyInfo || schemaOnly)
+ Connection.Tds.Execute (sql2.ToString ());
+ break;
+ case CommandType.Text:
+ string sql = String.Format ("{0}{1}{2}", sql1.ToString (), CommandText, sql2.ToString ());
+ Connection.Tds.Execute (sql, parms, CommandTimeout, wantResults);
+ break;
+ }
+ }
+ else
+ Connection.Tds.ExecPrepared (preparedStatement, parms, CommandTimeout, wantResults);
+ }
+
+ public int ExecuteNonQuery ()
+ {
+ ValidateCommand ("ExecuteNonQuery");
+ int result = 0;
+
+ try {
+ Execute (CommandBehavior.Default, false);
+ }
+ catch (TdsTimeoutException e) {
+ throw SqlException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ GetOutputParameters ();
+ return result;
+ }
+
+ public SqlDataReader ExecuteReader ()
+ {
+ return ExecuteReader (CommandBehavior.Default);
+ }
+
+ public SqlDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ ValidateCommand ("ExecuteReader");
+ try {
+ Execute (behavior, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw SqlException.FromTdsInternalException ((TdsInternalException) e);
+ }
+ Connection.DataReader = new SqlDataReader (this);
+ return Connection.DataReader;
+ }
+
+ public object ExecuteScalar ()
+ {
+ ValidateCommand ("ExecuteScalar");
+ try {
+ Execute (CommandBehavior.Default, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw SqlException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ if (!Connection.Tds.NextResult () || !Connection.Tds.NextRow ())
+ return null;
+
+ object result = Connection.Tds.ColumnValues [0];
+ CloseDataReader (true);
+ return result;
+ }
+
+ public XmlReader ExecuteXmlReader ()
+ {
+ ValidateCommand ("ExecuteXmlReader");
+ try {
+ Execute (CommandBehavior.Default, true);
+ }
+ catch (TdsTimeoutException e) {
+ throw SqlException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ SqlDataReader dataReader = new SqlDataReader (this);
+ SqlXmlTextReader textReader = new SqlXmlTextReader (dataReader);
+ XmlReader xmlReader = new XmlTextReader (textReader);
+ return xmlReader;
+ }
+
+ internal void GetOutputParameters ()
+ {
+ IList list = Connection.Tds.OutputParameters;
+
+ if (list != null && list.Count > 0) {
+ int index = 0;
+ foreach (SqlParameter parameter in parameters) {
+ if (parameter.Direction != ParameterDirection.Input) {
+ parameter.Value = list [index];
+ index += 1;
+ }
+ if (index >= list.Count)
+ break;
+ }
+ }
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new SqlCommand (commandText, Connection);
+ }
+
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ return ExecuteReader ();
+ }
+
+ IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+ {
+ return ExecuteReader (behavior);
+ }
+
+ public void Prepare ()
+ {
+ ValidateCommand ("Prepare");
+ if (CommandType == CommandType.Text)
+ preparedStatement = Connection.Tds.Prepare (CommandText, Parameters.MetaParameters);
+ }
+
+ public void ResetCommandTimeout ()
+ {
+ commandTimeout = 30;
+ }
+
+ private void Unprepare ()
+ {
+ Connection.Tds.Unprepare (preparedStatement);
+ preparedStatement = null;
+ }
+
+ private void ValidateCommand (string method)
+ {
+ if (Connection == null)
+ throw new InvalidOperationException (String.Format ("{0} requires a Connection object to continue.", method));
+ if (Connection.Transaction != null && transaction != Connection.Transaction)
+ throw new InvalidOperationException ("The Connection object does not have the same transaction as the command object.");
+ if (Connection.State != ConnectionState.Open)
+ throw new InvalidOperationException (String.Format ("ExecuteNonQuery requires an open Connection object to continue. This connection is closed.", method));
+ if (commandText == String.Empty || commandText == null)
+ throw new InvalidOperationException ("The command text for this Command has not been set.");
+ if (Connection.DataReader != null)
+ throw new InvalidOperationException ("There is already an open DataReader associated with this Connection which must be closed first.");
+ if (Connection.XmlReader != null)
+ throw new InvalidOperationException ("There is already an open XmlReader associated with this Connection which must be closed first.");
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs
new file mode 100644
index 00000000000..32803cac2ce
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs
@@ -0,0 +1,493 @@
+//
+// System.Data.SqlClient.SqlCommandBuilder.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Text;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlCommandBuilder : Component
+ {
+ #region Fields
+
+ bool disposed = false;
+
+ DataTable dbSchemaTable;
+ SqlDataAdapter adapter;
+ string quotePrefix;
+ string quoteSuffix;
+ string[] columnNames;
+ string tableName;
+
+ SqlCommand deleteCommand;
+ SqlCommand insertCommand;
+ SqlCommand updateCommand;
+
+ // Used to construct WHERE clauses
+ static readonly string clause1 = "({0} IS NULL AND {1} IS NULL)";
+ static readonly string clause2 = "({0} = {1})";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlCommandBuilder ()
+ {
+ dbSchemaTable = null;
+ adapter = null;
+ quoteSuffix = String.Empty;
+ quotePrefix = String.Empty;
+ }
+
+ public SqlCommandBuilder (SqlDataAdapter adapter)
+ : this ()
+ {
+ DataAdapter = adapter;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataSysDescription ("The DataAdapter for which to automatically generate SqlCommands")]
+ [DefaultValue (null)]
+ public SqlDataAdapter DataAdapter {
+ get { return adapter; }
+ set {
+ adapter = value;
+ if (adapter != null)
+ adapter.RowUpdating += new SqlRowUpdatingEventHandler (RowUpdatingHandler);
+ }
+ }
+
+ private string QuotedTableName {
+ get { return GetQuotedString (tableName); }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The character used in a text command as the opening quote for quoting identifiers that contain special characters.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string QuotePrefix {
+ get { return quotePrefix; }
+ set {
+ if (dbSchemaTable != null)
+ throw new InvalidOperationException ("The QuotePrefix and QuoteSuffix properties cannot be changed once an Insert, Update, or Delete command has been generated.");
+ quotePrefix = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The character used in a text command as the closing quote for quoting identifiers that contain special characters.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string QuoteSuffix {
+ get { return quoteSuffix; }
+ set {
+ if (dbSchemaTable != null)
+ throw new InvalidOperationException ("The QuotePrefix and QuoteSuffix properties cannot be changed once an Insert, Update, or Delete command has been generated.");
+ quoteSuffix = value;
+ }
+ }
+
+ private SqlCommand SourceCommand {
+ get {
+ if (adapter != null)
+ return adapter.SelectCommand;
+ return null;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ private void BuildCache (bool closeConnection)
+ {
+ SqlCommand sourceCommand = SourceCommand;
+ if (sourceCommand == null)
+ throw new InvalidOperationException ("The DataAdapter.SelectCommand property needs to be initialized.");
+ SqlConnection connection = sourceCommand.Connection;
+ if (connection == null)
+ throw new InvalidOperationException ("The DataAdapter.SelectCommand.Connection property needs to be initialized.");
+
+ if (dbSchemaTable == null) {
+ if (connection.State == ConnectionState.Open)
+ closeConnection = false;
+ else
+ connection.Open ();
+
+ SqlDataReader reader = sourceCommand.ExecuteReader (CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
+ dbSchemaTable = reader.GetSchemaTable ();
+ reader.Close ();
+ if (closeConnection)
+ connection.Close ();
+ BuildInformation (dbSchemaTable);
+ }
+ }
+
+ private void BuildInformation (DataTable schemaTable)
+ {
+ tableName = String.Empty;
+ foreach (DataRow schemaRow in schemaTable.Rows) {
+ if (tableName == String.Empty)
+ tableName = (string) schemaRow ["BaseTableName"];
+ if (tableName != (string) schemaRow["BaseTableName"])
+ throw new InvalidOperationException ("Dynamic SQL generation is not supported against multiple base tables.");
+ }
+ dbSchemaTable = schemaTable;
+ }
+
+ private SqlCommand CreateDeleteCommand (DataRow row, DataTableMapping tableMapping)
+ {
+ // If no table was found, then we can't do an delete
+ if (QuotedTableName == String.Empty)
+ return null;
+
+
+ CreateNewCommand (ref deleteCommand);
+
+ string command = String.Format ("DELETE FROM {0} ", QuotedTableName);
+ StringBuilder columns = new StringBuilder ();
+ StringBuilder where = new StringBuilder ();
+ string dsColumnName = String.Empty;
+ bool keyFound = false;
+ int parmIndex = 1;
+
+ foreach (DataRow schemaRow in dbSchemaTable.Rows) {
+ if (!IncludedInWhereClause (schemaRow))
+ continue;
+
+ if (where.Length > 0)
+ where.Append (" AND ");
+
+ bool isKey = (bool) schemaRow ["IsKey"];
+ SqlParameter parameter = null;
+
+ if (!isKey) {
+ parameter = deleteCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));
+
+ dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;
+ if (row != null)
+ parameter.Value = row [dsColumnName, DataRowVersion.Current];
+ where.Append ("(");
+ where.Append (String.Format (clause1, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));
+ where.Append (" OR ");
+ }
+ else
+ keyFound = true;
+
+ parameter = deleteCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));
+
+ dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;
+ if (row != null)
+ parameter.Value = row [dsColumnName, DataRowVersion.Current];
+
+ where.Append (String.Format (clause2, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));
+
+ if (!isKey)
+ where.Append (")");
+ }
+ if (!keyFound)
+ throw new InvalidOperationException ("Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information.");
+
+ // We're all done, so bring it on home
+ string sql = String.Format ("{0} WHERE ( {1} )", command, where.ToString ());
+ deleteCommand.CommandText = sql;
+ return deleteCommand;
+ }
+
+ private SqlCommand CreateInsertCommand (DataRow row, DataTableMapping tableMapping)
+ {
+ if (QuotedTableName == String.Empty)
+ return null;
+
+ CreateNewCommand (ref insertCommand);
+
+ string command = String.Format ("INSERT INTO {0}", QuotedTableName);
+ string sql;
+ StringBuilder columns = new StringBuilder ();
+ StringBuilder values = new StringBuilder ();
+ string dsColumnName = String.Empty;
+
+ int parmIndex = 1;
+ foreach (DataRow schemaRow in dbSchemaTable.Rows) {
+ if (!IncludedInInsert (schemaRow))
+ continue;
+
+ if (parmIndex > 1) {
+ columns.Append (" , ");
+ values.Append (" , ");
+ }
+
+ SqlParameter parameter = insertCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));
+
+ dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;
+ if (row != null)
+ parameter.Value = row [dsColumnName];
+
+ columns.Append (GetQuotedString (parameter.SourceColumn));
+ values.Append (parameter.ParameterName);
+ }
+
+ sql = String.Format ("{0}( {1} ) VALUES ( {2} )", command, columns.ToString (), values.ToString ());
+ insertCommand.CommandText = sql;
+ return insertCommand;
+ }
+
+ private void CreateNewCommand (ref SqlCommand command)
+ {
+ SqlCommand sourceCommand = SourceCommand;
+ if (command == null) {
+ command = sourceCommand.Connection.CreateCommand ();
+ command.CommandTimeout = sourceCommand.CommandTimeout;
+ command.Transaction = sourceCommand.Transaction;
+ }
+ command.CommandType = CommandType.Text;
+ command.UpdatedRowSource = UpdateRowSource.None;
+ }
+
+ private SqlCommand CreateUpdateCommand (DataRow row, DataTableMapping tableMapping)
+ {
+ // If no table was found, then we can't do an update
+ if (QuotedTableName == String.Empty)
+ return null;
+
+ CreateNewCommand (ref updateCommand);
+
+ string command = String.Format ("UPDATE {0} SET ", QuotedTableName);
+ StringBuilder columns = new StringBuilder ();
+ StringBuilder where = new StringBuilder ();
+ int parmIndex = 1;
+ string dsColumnName = String.Empty;
+ bool keyFound = false;
+
+ // First, create the X=Y list for UPDATE
+ foreach (DataRow schemaRow in dbSchemaTable.Rows) {
+ if (columns.Length > 0)
+ columns.Append (" , ");
+
+ SqlParameter parameter = updateCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));
+
+ dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;
+ if (row != null)
+ parameter.Value = row [dsColumnName, DataRowVersion.Proposed];
+
+ columns.Append (String.Format ("{0} = {1}", GetQuotedString (parameter.SourceColumn), parameter.ParameterName));
+ }
+
+ // Now, create the WHERE clause. This may be optimizable, but it would be ugly to incorporate
+ // into the loop above. "Premature optimization is the root of all evil." -- Knuth
+ foreach (DataRow schemaRow in dbSchemaTable.Rows) {
+ if (!IncludedInWhereClause (schemaRow))
+ continue;
+
+ if (where.Length > 0)
+ where.Append (" AND ");
+
+ bool isKey = (bool) schemaRow ["IsKey"];
+ SqlParameter parameter = null;
+
+
+ if (!isKey) {
+ parameter = updateCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));
+
+ dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;
+ if (row != null)
+ parameter.Value = row [dsColumnName];
+
+ where.Append ("(");
+ where.Append (String.Format (clause1, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));
+ where.Append (" OR ");
+ }
+ else
+ keyFound = true;
+
+ parameter = updateCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));
+
+ dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;
+ if (row != null)
+ parameter.Value = row [dsColumnName];
+
+ where.Append (String.Format (clause2, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));
+
+ if (!isKey)
+ where.Append (")");
+ }
+ if (!keyFound)
+ throw new InvalidOperationException ("Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.");
+
+ // We're all done, so bring it on home
+ string sql = String.Format ("{0}{1} WHERE ( {2} )", command, columns.ToString (), where.ToString ());
+ updateCommand.CommandText = sql;
+ return updateCommand;
+ }
+
+ private SqlParameter CreateParameter (int parmIndex, DataRow schemaRow)
+ {
+ string name = String.Format ("@p{0}", parmIndex);
+ string sourceColumn = (string) schemaRow ["BaseColumnName"];
+ SqlDbType sqlDbType = (SqlDbType) schemaRow ["ProviderType"];
+ int size = (int) schemaRow ["ColumnSize"];
+
+ return new SqlParameter (name, sqlDbType, size, sourceColumn);
+ }
+
+ public static void DeriveParameters (SqlCommand command)
+ {
+ command.DeriveParameters ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ if (insertCommand != null)
+ insertCommand.Dispose ();
+ if (deleteCommand != null)
+ deleteCommand.Dispose ();
+ if (updateCommand != null)
+ updateCommand.Dispose ();
+ if (dbSchemaTable != null)
+ dbSchemaTable.Dispose ();
+ }
+ disposed = true;
+ }
+ }
+
+ public SqlCommand GetDeleteCommand ()
+ {
+ BuildCache (true);
+ return CreateDeleteCommand (null, null);
+ }
+
+ public SqlCommand GetInsertCommand ()
+ {
+ BuildCache (true);
+ return CreateInsertCommand (null, null);
+ }
+
+ private string GetQuotedString (string value)
+ {
+ if (value == String.Empty || value == null)
+ return value;
+ if (quotePrefix == String.Empty && quoteSuffix == String.Empty)
+ return value;
+ return String.Format ("{0}{1}{2}", quotePrefix, value, quoteSuffix);
+ }
+
+ public SqlCommand GetUpdateCommand ()
+ {
+ BuildCache (true);
+ return CreateUpdateCommand (null, null);
+ }
+
+ private bool IncludedInInsert (DataRow schemaRow)
+ {
+ // If the parameter has one of these properties, then we don't include it in the insert:
+ // AutoIncrement, Hidden, Expression, RowVersion, ReadOnly
+
+ if ((bool) schemaRow ["IsAutoIncrement"])
+ return false;
+ if ((bool) schemaRow ["IsHidden"])
+ return false;
+ if ((bool) schemaRow ["IsExpression"])
+ return false;
+ if ((bool) schemaRow ["IsRowVersion"])
+ return false;
+ if ((bool) schemaRow ["IsReadOnly"])
+ return false;
+ return true;
+ }
+
+ private bool IncludedInUpdate (DataRow schemaRow)
+ {
+ // If the parameter has one of these properties, then we don't include it in the insert:
+ // AutoIncrement, Hidden, RowVersion
+
+ if ((bool) schemaRow ["IsAutoIncrement"])
+ return false;
+ if ((bool) schemaRow ["IsHidden"])
+ return false;
+ if ((bool) schemaRow ["IsRowVersion"])
+ return false;
+ return true;
+ }
+
+ private bool IncludedInWhereClause (DataRow schemaRow)
+ {
+ if ((bool) schemaRow ["IsLong"])
+ return false;
+ return true;
+ }
+
+ [MonoTODO ("Figure out what else needs to be cleaned up when we refresh.")]
+ public void RefreshSchema ()
+ {
+ tableName = String.Empty;
+ dbSchemaTable = null;
+ }
+
+ #endregion // Methods
+
+ #region Event Handlers
+
+ private void RowUpdatingHandler (object sender, SqlRowUpdatingEventArgs e)
+ {
+ if (e.Status != UpdateStatus.Continue)
+ return;
+
+ switch (e.StatementType) {
+ case StatementType.Delete:
+ deleteCommand = e.Command;
+ break;
+ case StatementType.Insert:
+ insertCommand = e.Command;
+ break;
+ case StatementType.Update:
+ updateCommand = e.Command;
+ break;
+ default:
+ return;
+ }
+
+ try {
+ BuildCache (false);
+
+ switch (e.StatementType) {
+ case StatementType.Delete:
+ e.Command = CreateDeleteCommand (e.Row, e.TableMapping);
+ e.Status = UpdateStatus.Continue;
+ break;
+ case StatementType.Insert:
+ e.Command = CreateInsertCommand (e.Row, e.TableMapping);
+ e.Status = UpdateStatus.Continue;
+ break;
+ case StatementType.Update:
+ e.Command = CreateUpdateCommand (e.Row, e.TableMapping);
+ e.Status = UpdateStatus.Continue;
+ break;
+ }
+
+ if (e.Command != null && e.Row != null) {
+ e.Row.AcceptChanges ();
+ e.Status = UpdateStatus.SkipCurrentRow;
+ }
+ }
+ catch (Exception exception) {
+ e.Errors = exception;
+ e.Status = UpdateStatus.ErrorsOccurred;
+ }
+ }
+
+ #endregion // Event Handlers
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
new file mode 100644
index 00000000000..d4caced4e8a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
@@ -0,0 +1,566 @@
+//
+// System.Data.SqlClient.SqlConnection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.EnterpriseServices;
+using System.Net;
+using System.Text;
+using System.Xml;
+
+namespace System.Data.SqlClient {
+ [DefaultEvent ("InfoMessage")]
+ public sealed class SqlConnection : Component, IDbConnection, ICloneable
+ {
+ #region Fields
+ bool disposed = false;
+
+ // The set of SQL connection pools
+ static Hashtable SqlConnectionPools = new Hashtable ();
+
+ // The current connection pool
+ SqlConnectionPool pool;
+
+ // The connection string that identifies this connection
+ string connectionString = null;
+
+ // The transaction object for the current transaction
+ SqlTransaction transaction = null;
+
+ // Connection parameters
+ TdsConnectionParameters parms = new TdsConnectionParameters ();
+ bool connectionReset;
+ bool pooling;
+ string dataSource;
+ int connectionTimeout;
+ int minPoolSize;
+ int maxPoolSize;
+ int packetSize;
+ int port = 1433;
+
+ // The current state
+ ConnectionState state = ConnectionState.Closed;
+
+ SqlDataReader dataReader = null;
+ XmlReader xmlReader = null;
+
+ // The TDS object
+ ITds tds;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlConnection ()
+ : this (String.Empty)
+ {
+ }
+
+ public SqlConnection (string connectionString)
+ {
+ ConnectionString = connectionString;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Information used to connect to a DataSource, such as 'Data Source=x;Initial Catalog=x;Integrated Security=SSPI'.")]
+ [DefaultValue ("")]
+ [RecommendedAsConfigurable (true)]
+ [RefreshProperties (RefreshProperties.All)]
+ public string ConnectionString {
+ get { return connectionString; }
+ set { SetConnectionString (value); }
+ }
+
+ [DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int ConnectionTimeout {
+ get { return connectionTimeout; }
+ }
+
+ [DataSysDescription ("Current SQL Server database, 'Initial Catalog=X' in the ConnectionString.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Database {
+ get { return tds.Database; }
+ }
+
+ internal SqlDataReader DataReader {
+ get { return dataReader; }
+ set { dataReader = value; }
+ }
+
+ [DataSysDescription ("Current SqlServer that the connection is opened to, 'Data Source=X' in the ConnectionString.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string DataSource {
+ get { return dataSource; }
+ }
+
+ [DataSysDescription ("Network packet size, 'Packet Size=x' in the ConnectionString.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int PacketSize {
+ get { return packetSize; }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("Version of the SQL Server accessed by the SqlConnection.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string ServerVersion {
+ get { return tds.ServerVersion; }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("The ConnectionState indicating whether the connection is open or closed.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public ConnectionState State {
+ get { return state; }
+ }
+
+ internal ITds Tds {
+ get { return tds; }
+ }
+
+ internal SqlTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
+ }
+
+ [DataSysDescription ("Workstation Id, 'Workstation Id=x' in the ConnectionString.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string WorkstationId {
+ get { return parms.Hostname; }
+ }
+
+ internal XmlReader XmlReader {
+ get { return xmlReader; }
+ set { xmlReader = value; }
+ }
+
+ #endregion // Properties
+
+ #region Events
+
+ [DataCategory ("InfoMessage")]
+ [DataSysDescription ("Event triggered when messages arrive from the DataSource.")]
+ public event SqlInfoMessageEventHandler InfoMessage;
+
+ [DataCategory ("StateChange")]
+ [DataSysDescription ("Event triggered when the connection changes state.")]
+ public event StateChangeEventHandler StateChange;
+
+ #endregion // Events
+
+ #region Delegates
+
+ private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
+ {
+ throw new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State);
+ }
+
+ private void MessageHandler (object sender, TdsInternalInfoMessageEventArgs e)
+ {
+ OnSqlInfoMessage (CreateSqlInfoMessageEvent (e.Errors));
+ }
+
+ #endregion // Delegates
+
+ #region Methods
+
+ public SqlTransaction BeginTransaction ()
+ {
+ return BeginTransaction (IsolationLevel.ReadCommitted, String.Empty);
+ }
+
+ public SqlTransaction BeginTransaction (IsolationLevel iso)
+ {
+ return BeginTransaction (iso, String.Empty);
+ }
+
+ public SqlTransaction BeginTransaction (string transactionName)
+ {
+ return BeginTransaction (IsolationLevel.ReadCommitted, transactionName);
+ }
+
+ public SqlTransaction BeginTransaction (IsolationLevel iso, string transactionName)
+ {
+ if (state == ConnectionState.Closed)
+ throw new InvalidOperationException ("The connection is not open.");
+ if (transaction != null)
+ throw new InvalidOperationException ("SqlConnection does not support parallel transactions.");
+
+ string isolevel = String.Empty;
+ switch (iso) {
+ case IsolationLevel.Chaos:
+ isolevel = "CHAOS";
+ break;
+ case IsolationLevel.ReadCommitted:
+ isolevel = "READ COMMITTED";
+ break;
+ case IsolationLevel.ReadUncommitted:
+ isolevel = "READ UNCOMMITTED";
+ break;
+ case IsolationLevel.RepeatableRead:
+ isolevel = "REPEATABLE READ";
+ break;
+ case IsolationLevel.Serializable:
+ isolevel = "SERIALIZABLE";
+ break;
+ }
+
+ tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0};BEGIN TRANSACTION {1}", isolevel, transactionName));
+
+ transaction = new SqlTransaction (this, iso);
+ return transaction;
+ }
+
+ public void ChangeDatabase (string database)
+ {
+ if (!IsValidDatabaseName (database))
+ throw new ArgumentException (String.Format ("The database name {0} is not valid."));
+ if (state != ConnectionState.Open)
+ throw new InvalidOperationException ("The connection is not open.");
+ tds.Execute (String.Format ("use {0}", database));
+ }
+
+ private void ChangeState (ConnectionState currentState)
+ {
+ ConnectionState originalState = state;
+ state = currentState;
+ OnStateChange (CreateStateChangeEvent (originalState, currentState));
+ }
+
+ public void Close ()
+ {
+ if (transaction != null && transaction.IsOpen)
+ transaction.Rollback ();
+ if (pooling)
+ pool.ReleaseConnection (tds);
+ else
+ tds.Disconnect ();
+
+ tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler (ErrorHandler);
+ tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler (MessageHandler);
+
+ ChangeState (ConnectionState.Closed);
+ }
+
+ public SqlCommand CreateCommand ()
+ {
+ SqlCommand command = new SqlCommand ();
+ command.Connection = this;
+ return command;
+ }
+
+ private SqlInfoMessageEventArgs CreateSqlInfoMessageEvent (TdsInternalErrorCollection errors)
+ {
+ return new SqlInfoMessageEventArgs (errors);
+ }
+
+ private StateChangeEventArgs CreateStateChangeEvent (ConnectionState originalState, ConnectionState currentState)
+ {
+ return new StateChangeEventArgs (originalState, currentState);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ if (State == ConnectionState.Open)
+ Close ();
+ parms = null;
+ dataSource = null;
+ }
+ base.Dispose (disposing);
+ disposed = true;
+ }
+ }
+
+ [MonoTODO ("Not sure what this means at present.")]
+ public void EnlistDistributedTransaction (ITransaction transaction)
+ {
+ throw new NotImplementedException ();
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new SqlConnection (ConnectionString);
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel iso)
+ {
+ return BeginTransaction (iso);
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public void Open ()
+ {
+ if (connectionString == null)
+ throw new InvalidOperationException ("Connection string has not been initialized.");
+
+ try {
+ if (!pooling)
+ tds = new Tds70 (DataSource, port, PacketSize, ConnectionTimeout);
+ else {
+ pool = (SqlConnectionPool) SqlConnectionPools [connectionString];
+ if (pool == null) {
+ pool = new SqlConnectionPool (dataSource, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
+ SqlConnectionPools [connectionString] = pool;
+ }
+ tds = pool.AllocateConnection ();
+ }
+ }
+ catch (TdsTimeoutException e) {
+ throw SqlException.FromTdsInternalException ((TdsInternalException) e);
+ }
+
+ tds.TdsErrorMessage += new TdsInternalErrorMessageEventHandler (ErrorHandler);
+ tds.TdsInfoMessage += new TdsInternalInfoMessageEventHandler (MessageHandler);
+
+ if (!tds.IsConnected)
+ tds.Connect (parms);
+ /* Not sure ebout removing these 2 lines.
+ * The command that gets to the sql server is just
+ * 'sp_reset_connection' and it fails.
+ * Either remove them definitely or fix it
+ else if (connectionReset)
+ tds.ExecProc ("sp_reset_connection");
+ */
+
+ ChangeState (ConnectionState.Open);
+ }
+
+ void SetConnectionString (string connectionString)
+ {
+ connectionString += ";";
+ NameValueCollection parameters = new NameValueCollection ();
+
+ if (connectionString == String.Empty)
+ return;
+
+ bool inQuote = false;
+ bool inDQuote = false;
+
+ string name = String.Empty;
+ string value = String.Empty;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in connectionString)
+ {
+ switch (c) {
+ case '\'':
+ inQuote = !inQuote;
+ break;
+ case '"' :
+ inDQuote = !inDQuote;
+ break;
+ case ';' :
+ if (!inDQuote && !inQuote) {
+ if (name != String.Empty && name != null) {
+ value = sb.ToString ();
+ parameters [name.ToUpper ().Trim ()] = value.Trim ();
+ }
+ name = String.Empty;
+ value = String.Empty;
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ case '=' :
+ if (!inDQuote && !inQuote) {
+ name = sb.ToString ();
+ sb = new StringBuilder ();
+ }
+ else
+ sb.Append (c);
+ break;
+ default:
+ sb.Append (c);
+ break;
+ }
+ }
+
+ if (this.ConnectionString == null)
+ {
+ SetDefaultConnectionParameters (parameters);
+ }
+
+ SetProperties (parameters);
+
+ this.connectionString = connectionString;
+ }
+
+ void SetDefaultConnectionParameters (NameValueCollection parameters)
+ {
+ if (null == parameters.Get ("APPLICATION NAME"))
+ parameters["APPLICATION NAME"] = "Mono SqlClient Data Provider";
+ if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT"))
+ parameters["CONNECT TIMEOUT"] = "15";
+ if (null == parameters.Get ("CONNECTION LIFETIME"))
+ parameters["CONNECTION LIFETIME"] = "0";
+ if (null == parameters.Get ("CONNECTION RESET"))
+ parameters["CONNECTION RESET"] = "true";
+ if (null == parameters.Get ("ENLIST"))
+ parameters["ENLIST"] = "true";
+ if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
+ parameters["INTEGRATED SECURITY"] = "false";
+ if (null == parameters.Get ("MAX POOL SIZE"))
+ parameters["MAX POOL SIZE"] = "100";
+ if (null == parameters.Get ("MIN POOL SIZE"))
+ parameters["MIN POOL SIZE"] = "0";
+ if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
+ parameters["NETWORK LIBRARY"] = "dbmssocn";
+ if (null == parameters.Get ("PACKET SIZE"))
+ parameters["PACKET SIZE"] = "512";
+ if (null == parameters.Get ("PERSIST SECURITY INFO"))
+ parameters["PERSIST SECURITY INFO"] = "false";
+ if (null == parameters.Get ("POOLING"))
+ parameters["POOLING"] = "true";
+ if (null == parameters.Get ("WORKSTATION ID"))
+ parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
+ }
+
+ private void SetProperties (NameValueCollection parameters)
+ {
+ string value;
+ foreach (string name in parameters) {
+ value = parameters[name];
+
+ switch (name) {
+ case "APPLICATION NAME" :
+ parms.ApplicationName = value;
+ break;
+ case "ATTACHDBFILENAME" :
+ case "EXTENDED PROPERTIES" :
+ case "INITIAL FILE NAME" :
+ break;
+ case "CONNECT TIMEOUT" :
+ case "CONNECTION TIMEOUT" :
+ connectionTimeout = Int32.Parse (value);
+ break;
+ case "CONNECTION LIFETIME" :
+ break;
+ case "CONNECTION RESET" :
+ connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
+ break;
+ case "CURRENT LANGUAGE" :
+ parms.Language = value;
+ break;
+ case "DATA SOURCE" :
+ case "SERVER" :
+ case "ADDRESS" :
+ case "ADDR" :
+ case "NETWORK ADDRESS" :
+ dataSource = value;
+ break;
+ case "ENLIST" :
+ break;
+ case "INITIAL CATALOG" :
+ case "DATABASE" :
+ parms.Database = value;
+ break;
+ case "INTEGRATED SECURITY" :
+ case "TRUSTED_CONNECTION" :
+ break;
+ case "MAX POOL SIZE" :
+ maxPoolSize = Int32.Parse (value);
+ break;
+ case "MIN POOL SIZE" :
+ minPoolSize = Int32.Parse (value);
+ break;
+ case "NET" :
+ case "NETWORK LIBRARY" :
+ if (!value.ToUpper ().Equals ("DBMSSOCN"))
+ throw new ArgumentException ("Unsupported network library.");
+ break;
+ case "PACKET SIZE" :
+ packetSize = Int32.Parse (value);
+ break;
+ case "PASSWORD" :
+ case "PWD" :
+ parms.Password = value;
+ break;
+ case "PERSIST SECURITY INFO" :
+ break;
+ case "POOLING" :
+ pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
+ break;
+ case "UID" :
+ case "USER ID" :
+ parms.User = value;
+ break;
+ case "WORKSTATION ID" :
+ parms.Hostname = value;
+ break;
+ }
+ }
+ }
+
+ static bool IsValidDatabaseName (string database)
+ {
+ if (database.Length > 32 || database.Length < 1)
+ return false;
+
+ if (database[0] == '"' && database[database.Length] == '"')
+ database = database.Substring (1, database.Length - 2);
+ else if (Char.IsDigit (database[0]))
+ return false;
+
+ if (database[0] == '_')
+ return false;
+
+ foreach (char c in database.Substring (1, database.Length - 1))
+ if (!Char.IsLetterOrDigit (c) && c != '_')
+ return false;
+ return true;
+ }
+
+ private void OnSqlInfoMessage (SqlInfoMessageEventArgs value)
+ {
+ if (InfoMessage != null)
+ InfoMessage (this, value);
+ }
+
+ private void OnStateChange (StateChangeEventArgs value)
+ {
+ if (StateChange != null)
+ StateChange (this, value);
+ }
+
+ #endregion // Methods
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs
new file mode 100644
index 00000000000..e2cfcdd732f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs
@@ -0,0 +1,167 @@
+//
+// System.Data.SqlClient.SqlConnectionPool.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.Threading;
+
+namespace System.Data.SqlClient {
+ internal class SqlConnectionPool : MarshalByRefObject, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList ();
+
+ int maxSize;
+ int minSize;
+ int packetSize;
+ int port;
+ int timeout;
+
+ string dataSource;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlConnectionPool (string dataSource, int port, int packetSize, int timeout, int minSize, int maxSize)
+ {
+ this.dataSource = dataSource;
+ this.port = port;
+ this.packetSize = packetSize;
+ this.timeout = timeout;
+ this.minSize = minSize;
+ this.maxSize = maxSize;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ITds this[int index] {
+ get { return (ITds) list[index]; }
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set { throw new InvalidOperationException (); }
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return true; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public int MaxSize {
+ get { return maxSize; }
+ }
+
+ public int MinSize {
+ get { return minSize; }
+ }
+
+ public object SyncRoot {
+ get { throw new InvalidOperationException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object o)
+ {
+ return list.Add ((Tds) o);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object o)
+ {
+ return list.Contains ((Tds) o);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ [MonoTODO ("Handle pool exhaustion.")]
+ public ITds AllocateConnection ()
+ {
+ // make sure we have the minimum count (really only useful the first time)
+ lock (list) {
+ for (int i = Count; i < minSize; i += 1)
+ Add (new Tds70 (dataSource, port, packetSize, timeout));
+ }
+
+ // Try to obtain a lock
+ foreach (object o in list)
+ if (Monitor.TryEnter (o))
+ return (ITds) o;
+
+ if (Count < maxSize) {
+ Tds tds = new Tds70 (dataSource, port, packetSize, timeout);
+ Monitor.Enter (tds);
+ Add (tds);
+ return tds;
+ }
+
+ // else we have to wait for one to be available
+
+ return null;
+ }
+
+ public void ReleaseConnection (ITds tds)
+ {
+ Monitor.Exit (tds);
+ }
+
+ public int IndexOf (object o)
+ {
+ return list.IndexOf ((Tds) o);
+ }
+
+ public void Insert (int index, object o)
+ {
+ list.Insert (index, (Tds) o);
+ }
+
+ public void Remove (object o)
+ {
+ list.Remove ((Tds) o);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs
new file mode 100644
index 00000000000..bbd207f6e6b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs
@@ -0,0 +1,187 @@
+//
+// System.Data.SqlClient.SqlDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ [DefaultEvent ("RowUpdated")]
+ public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Fields
+
+ bool disposed = false;
+ SqlCommand deleteCommand;
+ SqlCommand insertCommand;
+ SqlCommand selectCommand;
+ SqlCommand updateCommand;
+
+ #endregion
+
+ #region Constructors
+
+ public SqlDataAdapter ()
+ : this (new SqlCommand ())
+ {
+ }
+
+ public SqlDataAdapter (SqlCommand selectCommand)
+ {
+ DeleteCommand = null;
+ InsertCommand = null;
+ SelectCommand = selectCommand;
+ UpdateCommand = null;
+ }
+
+ public SqlDataAdapter (string selectCommandText, SqlConnection selectConnection)
+ : this (new SqlCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public SqlDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new SqlConnection (selectConnectionString))
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Used during Update for deleted rows in DataSet.")]
+ [DefaultValue (null)]
+ public SqlCommand DeleteCommand {
+ get { return deleteCommand; }
+ set { deleteCommand = value; }
+ }
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Used during Update for new rows in DataSet.")]
+ [DefaultValue (null)]
+ public SqlCommand InsertCommand {
+ get { return insertCommand; }
+ set { insertCommand = value; }
+ }
+
+ [DataCategory ("Fill")]
+ [DataSysDescription ("Used during Fill/FillSchema.")]
+ [DefaultValue (null)]
+ public SqlCommand SelectCommand {
+ get { return selectCommand; }
+ set { selectCommand = value; }
+ }
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Used during Update for modified rows in DataSet.")]
+ [DefaultValue (null)]
+ public SqlCommand UpdateCommand {
+ get { return updateCommand; }
+ set { updateCommand = value; }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is SqlCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (SqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is SqlCommand))
+ throw new ArgumentException ();
+ InsertCommand = (SqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is SqlCommand))
+ throw new ArgumentException ();
+ SelectCommand = (SqlCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is SqlCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (SqlCommand)value;
+ }
+ }
+
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new SqlRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new SqlRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ // Release managed resources
+ }
+ // Release unmanaged resources
+ disposed = true;
+ }
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ if (RowUpdated != null)
+ RowUpdated (this, (SqlRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ if (RowUpdating != null)
+ RowUpdating (this, (SqlRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Event triggered before every DataRow during Update.")]
+ public event SqlRowUpdatedEventHandler RowUpdated;
+
+ [DataCategory ("Update")]
+ [DataSysDescription ("Event triggered after every DataRow during Update.")]
+ public event SqlRowUpdatingEventHandler RowUpdating;
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs
new file mode 100644
index 00000000000..419d9a75e26
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs
@@ -0,0 +1,767 @@
+//
+// System.Data.SqlClient.SqlDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlTypes;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
+ {
+ #region Fields
+
+ SqlCommand command;
+ ArrayList dataTypeNames;
+ bool disposed = false;
+ int fieldCount;
+ bool isClosed;
+ bool isSelect;
+ bool moreResults;
+ int resultsRead;
+ int rowsRead;
+ DataTable schemaTable;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlDataReader (SqlCommand command)
+ {
+ this.command = command;
+ schemaTable = ConstructSchemaTable ();
+ resultsRead = 0;
+ fieldCount = 0;
+ isClosed = false;
+ isSelect = (command.CommandText.Trim ().ToUpper ().StartsWith ("SELECT"));
+ command.Tds.RecordsAffected = 0;
+ NextResult ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Depth {
+ get { return 0; }
+ }
+
+ public int FieldCount {
+ get { return fieldCount; }
+ }
+
+ public bool IsClosed {
+ get { return isClosed; }
+ }
+
+ public object this [int i] {
+ get { return GetValue (i); }
+ }
+
+ public object this [string name] {
+ get { return GetValue (GetOrdinal (name)); }
+ }
+
+ public int RecordsAffected {
+ get {
+ if (isSelect)
+ return -1;
+ else
+ return command.Tds.RecordsAffected;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Close ()
+ {
+ isClosed = true;
+ command.CloseDataReader (moreResults);
+ }
+
+ private static DataTable ConstructSchemaTable ()
+ {
+ Type booleanType = Type.GetType ("System.Boolean");
+ Type stringType = Type.GetType ("System.String");
+ Type intType = Type.GetType ("System.Int32");
+ Type typeType = Type.GetType ("System.Type");
+ Type shortType = Type.GetType ("System.Int16");
+
+ DataTable schemaTable = new DataTable ("SchemaTable");
+ schemaTable.Columns.Add ("ColumnName", stringType);
+ schemaTable.Columns.Add ("ColumnOrdinal", intType);
+ schemaTable.Columns.Add ("ColumnSize", intType);
+ schemaTable.Columns.Add ("NumericPrecision", shortType);
+ schemaTable.Columns.Add ("NumericScale", shortType);
+ schemaTable.Columns.Add ("IsUnique", booleanType);
+ schemaTable.Columns.Add ("IsKey", booleanType);
+ schemaTable.Columns.Add ("BaseServerName", stringType);
+ schemaTable.Columns.Add ("BaseCatalogName", stringType);
+ schemaTable.Columns.Add ("BaseColumnName", stringType);
+ schemaTable.Columns.Add ("BaseSchemaName", stringType);
+ schemaTable.Columns.Add ("BaseTableName", stringType);
+ schemaTable.Columns.Add ("DataType", typeType);
+ schemaTable.Columns.Add ("AllowDBNull", booleanType);
+ schemaTable.Columns.Add ("ProviderType", intType);
+ schemaTable.Columns.Add ("IsAliased", booleanType);
+ schemaTable.Columns.Add ("IsExpression", booleanType);
+ schemaTable.Columns.Add ("IsIdentity", booleanType);
+ schemaTable.Columns.Add ("IsAutoIncrement", booleanType);
+ schemaTable.Columns.Add ("IsRowVersion", booleanType);
+ schemaTable.Columns.Add ("IsHidden", booleanType);
+ schemaTable.Columns.Add ("IsLong", booleanType);
+ schemaTable.Columns.Add ("IsReadOnly", booleanType);
+
+ return schemaTable;
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ schemaTable.Dispose ();
+ Close ();
+ }
+ disposed = true;
+ }
+ }
+
+ public bool GetBoolean (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is bool))
+ throw new InvalidCastException ();
+ return (bool) value;
+ }
+
+ public byte GetByte (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is byte))
+ throw new InvalidCastException ();
+ return (byte) value;
+ }
+
+ public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ object value = GetValue (i);
+ if (!(value is byte []))
+ throw new InvalidCastException ();
+ Array.Copy ((byte []) value, (int) dataIndex, buffer, bufferIndex, length);
+ return ((byte []) value).Length - dataIndex;
+ }
+
+ public char GetChar (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is char))
+ throw new InvalidCastException ();
+ return (char) value;
+ }
+
+ public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ object value = GetValue (i);
+ if (!(value is char[]))
+ throw new InvalidCastException ();
+ Array.Copy ((char []) value, (int) dataIndex, buffer, bufferIndex, length);
+ return ((char []) value).Length - dataIndex;
+ }
+
+ [MonoTODO ("Implement GetData")]
+ public IDataReader GetData (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetDataTypeName (int i)
+ {
+ return (string) dataTypeNames [i];
+ }
+
+ public DateTime GetDateTime (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is DateTime))
+ throw new InvalidCastException ();
+ return (DateTime) value;
+ }
+
+ public decimal GetDecimal (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is decimal))
+ throw new InvalidCastException ();
+ return (decimal) value;
+ }
+
+ public double GetDouble (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is double))
+ throw new InvalidCastException ();
+ return (double) value;
+ }
+
+ public Type GetFieldType (int i)
+ {
+ return (Type) schemaTable.Rows[i]["DataType"];
+ }
+
+ public float GetFloat (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is float))
+ throw new InvalidCastException ();
+ return (float) value;
+ }
+
+ public Guid GetGuid (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is Guid))
+ throw new InvalidCastException ();
+ return (Guid) value;
+ }
+
+ public short GetInt16 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is short))
+ throw new InvalidCastException ();
+ return (short) value;
+ }
+
+ public int GetInt32 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is int))
+ throw new InvalidCastException ();
+ return (int) value;
+ }
+
+ public long GetInt64 (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is long))
+ throw new InvalidCastException ();
+ return (long) value;
+ }
+
+ public string GetName (int i)
+ {
+ return (string) schemaTable.Rows[i]["ColumnName"];
+ }
+
+ public int GetOrdinal (string name)
+ {
+ foreach (DataRow schemaRow in schemaTable.Rows)
+ if (((string) schemaRow ["ColumnName"]).Equals (name))
+ return (int) schemaRow ["ColumnOrdinal"];
+ foreach (DataRow schemaRow in schemaTable.Rows)
+ if (String.Compare (((string) schemaRow ["ColumnName"]), name, true) == 0)
+ return (int) schemaRow ["ColumnOrdinal"];
+ throw new IndexOutOfRangeException ();
+ }
+
+ public DataTable GetSchemaTable ()
+ {
+ if (schemaTable.Rows != null && schemaTable.Rows.Count > 0)
+ return schemaTable;
+
+ if (!moreResults)
+ return null;
+
+ fieldCount = 0;
+
+ dataTypeNames = new ArrayList ();
+
+ foreach (TdsDataColumn schema in command.Tds.Columns) {
+ DataRow row = schemaTable.NewRow ();
+
+ row ["ColumnName"] = GetSchemaValue (schema, "ColumnName");
+ row ["ColumnSize"] = GetSchemaValue (schema, "ColumnSize");
+ row ["ColumnOrdinal"] = GetSchemaValue (schema, "ColumnOrdinal");
+ row ["NumericPrecision"] = GetSchemaValue (schema, "NumericPrecision");
+ row ["NumericScale"] = GetSchemaValue (schema, "NumericScale");
+ row ["IsUnique"] = GetSchemaValue (schema, "IsUnique");
+ row ["IsKey"] = GetSchemaValue (schema, "IsKey");
+ row ["BaseServerName"] = GetSchemaValue (schema, "BaseServerName");
+ row ["BaseCatalogName"] = GetSchemaValue (schema, "BaseCatalogName");
+ row ["BaseColumnName"] = GetSchemaValue (schema, "BaseColumnName");
+ row ["BaseSchemaName"] = GetSchemaValue (schema, "BaseSchemaName");
+ row ["BaseTableName"] = GetSchemaValue (schema, "BaseTableName");
+ row ["AllowDBNull"] = GetSchemaValue (schema, "AllowDBNull");
+ row ["IsAliased"] = GetSchemaValue (schema, "IsAliased");
+ row ["IsExpression"] = GetSchemaValue (schema, "IsExpression");
+ row ["IsIdentity"] = GetSchemaValue (schema, "IsIdentity");
+ row ["IsAutoIncrement"] = GetSchemaValue (schema, "IsAutoIncrement");
+ row ["IsRowVersion"] = GetSchemaValue (schema, "IsRowVersion");
+ row ["IsHidden"] = GetSchemaValue (schema, "IsHidden");
+ row ["IsReadOnly"] = GetSchemaValue (schema, "IsReadOnly");
+
+ // We don't always get the base column name.
+ if (row ["BaseColumnName"] == DBNull.Value)
+ row ["BaseColumnName"] = row ["ColumnName"];
+
+ switch ((TdsColumnType) schema ["ColumnType"]) {
+ case TdsColumnType.Int1:
+ case TdsColumnType.Int2:
+ case TdsColumnType.Int4:
+ case TdsColumnType.IntN:
+ switch ((int) schema ["ColumnSize"]) {
+ case 1:
+ dataTypeNames.Add ("tinyint");
+ row ["ProviderType"] = (int) SqlDbType.TinyInt;
+ row ["DataType"] = typeof (byte);
+ row ["IsLong"] = false;
+ break;
+ case 2:
+ dataTypeNames.Add ("smallint");
+ row ["ProviderType"] = (int) SqlDbType.SmallInt;
+ row ["DataType"] = typeof (short);
+ row ["IsLong"] = false;
+ break;
+ case 4:
+ dataTypeNames.Add ("int");
+ row ["ProviderType"] = (int) SqlDbType.Int;
+ row ["DataType"] = typeof (int);
+ row ["IsLong"] = false;
+ break;
+ case 8:
+ dataTypeNames.Add ("bigint");
+ row ["ProviderType"] = (int) SqlDbType.BigInt;
+ row ["DataType"] = typeof (long);
+ row ["IsLong"] = false;
+ break;
+ }
+ break;
+ case TdsColumnType.Real:
+ case TdsColumnType.Float8:
+ case TdsColumnType.FloatN:
+ switch ((int) schema ["ColumnSize"]) {
+ case 4:
+ dataTypeNames.Add ("real");
+ row ["ProviderType"] = (int) SqlDbType.Real;
+ row ["DataType"] = typeof (float);
+ row ["IsLong"] = false;
+ break;
+ case 8:
+ dataTypeNames.Add ("float");
+ row ["ProviderType"] = (int) SqlDbType.Float;
+ row ["DataType"] = typeof (double);
+ row ["IsLong"] = false;
+ break;
+ }
+ break;
+ case TdsColumnType.Image :
+ dataTypeNames.Add ("image");
+ row ["ProviderType"] = (int) SqlDbType.Image;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.Text :
+ dataTypeNames.Add ("text");
+ row ["ProviderType"] = (int) SqlDbType.Text;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.UniqueIdentifier :
+ dataTypeNames.Add ("uniqueidentifier");
+ row ["ProviderType"] = (int) SqlDbType.UniqueIdentifier;
+ row ["DataType"] = typeof (Guid);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.VarBinary :
+ case TdsColumnType.BigVarBinary :
+ dataTypeNames.Add ("varbinary");
+ row ["ProviderType"] = (int) SqlDbType.VarBinary;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.VarChar :
+ case TdsColumnType.BigVarChar :
+ dataTypeNames.Add ("varchar");
+ row ["ProviderType"] = (int) SqlDbType.VarChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Binary :
+ case TdsColumnType.BigBinary :
+ dataTypeNames.Add ("binary");
+ row ["ProviderType"] = (int) SqlDbType.Binary;
+ row ["DataType"] = typeof (byte[]);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.Char :
+ case TdsColumnType.BigChar :
+ dataTypeNames.Add ("char");
+ row ["ProviderType"] = (int) SqlDbType.Char;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Bit :
+ case TdsColumnType.BitN :
+ dataTypeNames.Add ("bit");
+ row ["ProviderType"] = (int) SqlDbType.Bit;
+ row ["DataType"] = typeof (bool);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.DateTime4 :
+ case TdsColumnType.DateTime :
+ case TdsColumnType.DateTimeN :
+ dataTypeNames.Add ("datetime");
+ row ["ProviderType"] = (int) SqlDbType.DateTime;
+ row ["DataType"] = typeof (DateTime);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Money :
+ case TdsColumnType.MoneyN :
+ case TdsColumnType.Money4 :
+ dataTypeNames.Add ("money");
+ row ["ProviderType"] = (int) SqlDbType.Money;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.NText :
+ dataTypeNames.Add ("ntext");
+ row ["ProviderType"] = (int) SqlDbType.NText;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = true;
+ break;
+ case TdsColumnType.NVarChar :
+ dataTypeNames.Add ("nvarchar");
+ row ["ProviderType"] = (int) SqlDbType.NVarChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.Decimal :
+ case TdsColumnType.Numeric :
+ dataTypeNames.Add ("decimal");
+ row ["ProviderType"] = (int) SqlDbType.Decimal;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.NChar :
+ dataTypeNames.Add ("nchar");
+ row ["ProviderType"] = (int) SqlDbType.NChar;
+ row ["DataType"] = typeof (string);
+ row ["IsLong"] = false;
+ break;
+ case TdsColumnType.SmallMoney :
+ dataTypeNames.Add ("smallmoney");
+ row ["ProviderType"] = (int) SqlDbType.SmallMoney;
+ row ["DataType"] = typeof (decimal);
+ row ["IsLong"] = false;
+ break;
+ default :
+ dataTypeNames.Add ("variant");
+ row ["ProviderType"] = (int) SqlDbType.Variant;
+ row ["DataType"] = typeof (object);
+ row ["IsLong"] = false;
+ break;
+ }
+
+ schemaTable.Rows.Add (row);
+
+ fieldCount += 1;
+ }
+ return schemaTable;
+ }
+
+ private static object GetSchemaValue (TdsDataColumn schema, object key)
+ {
+ if (schema.ContainsKey (key) && schema [key] != null)
+ return schema [key];
+ return DBNull.Value;
+ }
+
+ public SqlBinary GetSqlBinary (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public SqlBoolean GetSqlBoolean (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlBoolean))
+ throw new InvalidCastException ();
+ return (SqlBoolean) value;
+ }
+
+ public SqlByte GetSqlByte (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlByte))
+ throw new InvalidCastException ();
+ return (SqlByte) value;
+ }
+
+ public SqlDateTime GetSqlDateTime (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlDateTime))
+ throw new InvalidCastException ();
+ return (SqlDateTime) value;
+ }
+
+ public SqlDecimal GetSqlDecimal (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlDecimal))
+ throw new InvalidCastException ();
+ return (SqlDecimal) value;
+ }
+
+ public SqlDouble GetSqlDouble (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlDouble))
+ throw new InvalidCastException ();
+ return (SqlDouble) value;
+ }
+
+ public SqlGuid GetSqlGuid (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlGuid))
+ throw new InvalidCastException ();
+ return (SqlGuid) value;
+ }
+
+ public SqlInt16 GetSqlInt16 (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlInt16))
+ throw new InvalidCastException ();
+ return (SqlInt16) value;
+ }
+
+ public SqlInt32 GetSqlInt32 (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlInt32))
+ throw new InvalidCastException ();
+ return (SqlInt32) value;
+ }
+
+ public SqlInt64 GetSqlInt64 (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlInt64))
+ throw new InvalidCastException ();
+ return (SqlInt64) value;
+ }
+
+ public SqlMoney GetSqlMoney (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlMoney))
+ throw new InvalidCastException ();
+ return (SqlMoney) value;
+ }
+
+ public SqlSingle GetSqlSingle (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlSingle))
+ throw new InvalidCastException ();
+ return (SqlSingle) value;
+ }
+
+ public SqlString GetSqlString (int i)
+ {
+ object value = GetSqlValue (i);
+ if (!(value is SqlString))
+ throw new InvalidCastException ();
+ return (SqlString) value;
+ }
+
+ [MonoTODO ("Implement TdsBigDecimal conversion. SqlDbType.Real fails tests?")]
+ public object GetSqlValue (int i)
+ {
+ SqlDbType type = (SqlDbType) (schemaTable.Rows [i]["ProviderType"]);
+ object value = GetValue (i);
+
+ switch (type) {
+ case SqlDbType.BigInt:
+ if (value == null)
+ return SqlInt64.Null;
+ return (SqlInt64) ((long) value);
+ case SqlDbType.Binary:
+ case SqlDbType.Image:
+ case SqlDbType.VarBinary:
+ case SqlDbType.Timestamp:
+ if (value == null)
+ return SqlBinary.Null;
+ return (SqlBinary) ((byte[]) value);
+ case SqlDbType.Bit:
+ if (value == null)
+ return SqlBoolean.Null;
+ return (SqlBoolean) ((bool) value);
+ case SqlDbType.Char:
+ case SqlDbType.NChar:
+ case SqlDbType.NText:
+ case SqlDbType.NVarChar:
+ case SqlDbType.Text:
+ case SqlDbType.VarChar:
+ if (value == null)
+ return SqlString.Null;
+ return (SqlString) ((string) value);
+ case SqlDbType.DateTime:
+ case SqlDbType.SmallDateTime:
+ if (value == null)
+ return SqlDateTime.Null;
+ return (SqlDateTime) ((DateTime) value);
+ case SqlDbType.Decimal:
+ if (value == null)
+ return SqlDecimal.Null;
+ if (value is TdsBigDecimal)
+ return SqlDecimal.FromTdsBigDecimal ((TdsBigDecimal) value);
+ return (SqlDecimal) ((decimal) value);
+ case SqlDbType.Float:
+ if (value == null)
+ return SqlDouble.Null;
+ return (SqlDouble) ((double) value);
+ case SqlDbType.Int:
+ if (value == null)
+ return SqlInt32.Null;
+ return (SqlInt32) ((int) value);
+ case SqlDbType.Money:
+ case SqlDbType.SmallMoney:
+ if (value == null)
+ return SqlMoney.Null;
+ return (SqlMoney) ((decimal) value);
+ case SqlDbType.Real:
+ if (value == null)
+ return SqlSingle.Null;
+ return (SqlSingle) ((float) value);
+ case SqlDbType.UniqueIdentifier:
+ if (value == null)
+ return SqlGuid.Null;
+ return (SqlGuid) ((Guid) value);
+ case SqlDbType.SmallInt:
+ if (value == null)
+ return SqlInt16.Null;
+ return (SqlInt16) ((short) value);
+ case SqlDbType.TinyInt:
+ if (value == null)
+ return SqlByte.Null;
+ return (SqlByte) ((byte) value);
+ }
+
+ throw new InvalidOperationException ("The type of this column is unknown.");
+ }
+
+ public int GetSqlValues (object[] values)
+ {
+ int count = 0;
+ int columnCount = schemaTable.Rows.Count;
+ int arrayCount = values.Length;
+
+ if (arrayCount > columnCount)
+ count = columnCount;
+ else
+ count = arrayCount;
+
+ for (int i = 0; i < count; i += 1)
+ values [i] = GetSqlValue (i);
+
+ return count;
+ }
+
+ public string GetString (int i)
+ {
+ object value = GetValue (i);
+ if (!(value is string))
+ throw new InvalidCastException ();
+ return (string) value;
+ }
+
+ public object GetValue (int i)
+ {
+ return command.Tds.ColumnValues [i];
+ }
+
+ public int GetValues (object[] values)
+ {
+ int len = values.Length;
+ int bigDecimalIndex = command.Tds.ColumnValues.BigDecimalIndex;
+
+ // If a four-byte decimal is stored, then we can't convert to
+ // a native type. Throw an OverflowException.
+ if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
+ throw new OverflowException ();
+
+ command.Tds.ColumnValues.CopyTo (0, values, 0, len);
+ return (len > FieldCount ? len : FieldCount);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new DbEnumerator (this);
+ }
+
+ public bool IsDBNull (int i)
+ {
+ return GetValue (i) == null;
+ }
+
+ public bool NextResult ()
+ {
+ if ((command.CommandBehavior & CommandBehavior.SingleResult) != 0 && resultsRead > 0)
+ return false;
+
+ schemaTable.Rows.Clear ();
+
+ moreResults = command.Tds.NextResult ();
+ if (!moreResults)
+ command.GetOutputParameters ();
+
+ GetSchemaTable ();
+
+ rowsRead = 0;
+ resultsRead += 1;
+ return moreResults;
+ }
+
+ public bool Read ()
+ {
+ if ((command.CommandBehavior & CommandBehavior.SingleRow) != 0 && rowsRead > 0)
+ return false;
+ if ((command.CommandBehavior & CommandBehavior.SchemaOnly) != 0)
+ return false;
+ if (!moreResults)
+ return false;
+
+ bool result = command.Tds.NextRow ();
+
+ rowsRead += 1;
+
+ return result;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlError.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlError.cs
new file mode 100644
index 00000000000..7081b355323
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlError.cs
@@ -0,0 +1,99 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient {
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [Serializable]
+ public sealed class SqlError
+ {
+ #region Fields
+
+ byte theClass = 0;
+ int lineNumber = 0;
+ string message = "";
+ int number = 0;
+ string procedure = "";
+ string server = "";
+ string source = "";
+ byte state = 0;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlError (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte Class {
+ get { return theClass; }
+ }
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public string Message {
+ get { return message; }
+ }
+
+ public int Number {
+ get { return number; }
+ }
+
+ public string Procedure {
+ get { return procedure; }
+ }
+
+ public string Server {
+ get { return server; }
+ }
+
+ public string Source {
+ get { return source; }
+ }
+
+ public byte State {
+ get { return state; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override string ToString ()
+ {
+ return Message;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs
new file mode 100644
index 00000000000..41ad3e9ba7e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs
@@ -0,0 +1,87 @@
+//
+// System.Data.SqlClient.SqlErrorCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient {
+ [ListBindable (false)]
+ [Serializable]
+ public sealed class SqlErrorCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlErrorCollection ()
+ {
+ }
+
+ internal SqlErrorCollection (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ Add (theClass, lineNumber, message, number, procedure, server, source, state);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public SqlError this[int index] {
+ get { return (SqlError) list [index]; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ internal void Add(SqlError error)
+ {
+ list.Add (error);
+ }
+
+ internal void Add(byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ {
+ SqlError error = new SqlError (theClass, lineNumber, message, number, procedure, server, source, state);
+ Add (error);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs
new file mode 100644
index 00000000000..acad81f7847
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs
@@ -0,0 +1,110 @@
+//
+// System.Data.SqlClient.SqlException.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace System.Data.SqlClient {
+ [Serializable]
+ public sealed class SqlException : SystemException
+ {
+ #region Fields
+
+ SqlErrorCollection errors;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlException ()
+ : base ("a SQL Exception has occurred.")
+ {
+ errors = new SqlErrorCollection();
+ }
+
+ internal SqlException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
+ : base (message)
+ {
+ errors = new SqlErrorCollection (theClass, lineNumber, message, number, procedure, server, source, state);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte Class {
+ get { return Errors [0].Class; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public SqlErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public int LineNumber {
+ get { return Errors [0].LineNumber; }
+ }
+
+ public override string Message {
+ get {
+ StringBuilder result = new StringBuilder ();
+ foreach (SqlError error in Errors) {
+ if (result.Length > 0)
+ result.Append ('\n');
+ result.Append (error.Message);
+ }
+ return result.ToString ();
+ }
+ }
+
+ public int Number {
+ get { return Errors [0].Number; }
+ }
+
+ public string Procedure {
+ get { return Errors [0].Procedure; }
+ }
+
+ public string Server {
+ get { return Errors [0].Server; }
+ }
+
+ public override string Source {
+ get { return Errors [0].Source; }
+ }
+
+ public byte State {
+ get { return Errors [0].State; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal static SqlException FromTdsInternalException (TdsInternalException e)
+ {
+ return new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State);
+ }
+
+ [MonoTODO ("Determine how to serialize this class.")]
+ public override void GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..9f366804db3
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlInfoMessageEventArgs : EventArgs
+ {
+ #region Fields
+
+ SqlErrorCollection errors = new SqlErrorCollection ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlInfoMessageEventArgs (TdsInternalErrorCollection tdsErrors)
+ {
+ foreach (TdsInternalError e in tdsErrors)
+ errors.Add (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SqlErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public string Message {
+ get { return errors[0].Message; }
+ }
+
+ public string Source {
+ get { return errors[0].Source; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override string ToString()
+ {
+ return Message;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..1263b75549b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient {
+ public delegate void SqlInfoMessageEventHandler (object sender, SqlInfoMessageEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
new file mode 100644
index 00000000000..bd6f77ac1f6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
@@ -0,0 +1,598 @@
+//
+// System.Data.SqlClient.SqlParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using Mono.Data.Tds.Protocol;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+ {
+ #region Fields
+
+ TdsMetaParameter metaParameter;
+
+ SqlParameterCollection container = null;
+ DbType dbType;
+ ParameterDirection direction = ParameterDirection.Input;
+ bool isNullable;
+ bool isSizeSet = false;
+ bool isTypeSet = false;
+ int offset;
+ SqlDbType sqlDbType;
+ string sourceColumn;
+ DataRowVersion sourceVersion;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlParameter ()
+ : this (String.Empty, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public SqlParameter (string parameterName, object value)
+ {
+ metaParameter = new TdsMetaParameter (parameterName, value);
+ this.sourceVersion = DataRowVersion.Current;
+ InferSqlType (value);
+ }
+
+ public SqlParameter (string parameterName, SqlDbType dbType)
+ : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public SqlParameter (string parameterName, SqlDbType dbType, int size)
+ : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
+ {
+ }
+
+ public SqlParameter (string parameterName, SqlDbType dbType, int size, string sourceColumn)
+ : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null)
+ {
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value)
+ {
+ metaParameter = new TdsMetaParameter (parameterName, size, isNullable, precision, scale, value);
+
+ SqlDbType = dbType;
+ Direction = direction;
+ SourceColumn = sourceColumn;
+ SourceVersion = sourceVersion;
+ }
+
+ // This constructor is used internally to construct a
+ // SqlParameter. The value array comes from sp_procedure_params_rowset.
+ // This is in SqlCommand.DeriveParameters.
+ internal SqlParameter (object[] dbValues)
+ {
+ Precision = 0;
+ Scale = 0;
+ Direction = ParameterDirection.Input;
+
+ ParameterName = (string) dbValues[3];
+
+ switch ((short) dbValues[5]) {
+ case 1:
+ Direction = ParameterDirection.Input;
+ break;
+ case 2:
+ Direction = ParameterDirection.Output;
+ break;
+ case 3:
+ Direction = ParameterDirection.InputOutput;
+ break;
+ case 4:
+ Direction = ParameterDirection.ReturnValue;
+ break;
+ }
+
+ IsNullable = (bool) dbValues[8];
+
+ if (dbValues[12] != null)
+ Precision = (byte) ((short) dbValues[12]);
+ if (dbValues[13] != null)
+ Scale = (byte) ((short) dbValues[13]);
+
+ SetDbTypeName ((string) dbValues[16]);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ // Used to ensure that only one collection can contain this
+ // parameter
+ internal SqlParameterCollection Container {
+ get { return container; }
+ set { container = value; }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("The parameter generic type.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [RefreshProperties (RefreshProperties.All)]
+ public DbType DbType {
+ get { return dbType; }
+ set {
+ SetDbType (value);
+ isTypeSet = true;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Input, output, or bidirectional parameter.")]
+ [DefaultValue (ParameterDirection.Input)]
+ public ParameterDirection Direction {
+ get { return direction; }
+ set {
+ direction = value;
+ if (direction == ParameterDirection.Output)
+ MetaParameter.Direction = TdsParameterDirection.Output;
+ }
+ }
+
+ internal TdsMetaParameter MetaParameter {
+ get { return metaParameter; }
+ }
+
+ string IDataParameter.ParameterName {
+ get { return metaParameter.ParameterName; }
+ set { metaParameter.ParameterName = value; }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("a design-time property used for strongly typed code-generation.")]
+ [DefaultValue (false)]
+ [DesignOnly (true)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public bool IsNullable {
+ get { return metaParameter.IsNullable; }
+ set { metaParameter.IsNullable = value; }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("Offset in variable length data types.")]
+ [DefaultValue (0)]
+ public int Offset {
+ get { return offset; }
+ set { offset = value; }
+ }
+
+ [DataSysDescription ("Name of the parameter, like '@p1'")]
+ [DefaultValue ("")]
+ public string ParameterName {
+ get { return metaParameter.ParameterName; }
+ set { metaParameter.ParameterName = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")]
+ [DefaultValue (0)]
+ public byte Precision {
+ get { return metaParameter.Precision; }
+ set { metaParameter.Precision = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")]
+ [DefaultValue (0)]
+ public byte Scale {
+ get { return metaParameter.Scale; }
+ set { metaParameter.Scale = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Size of variable length datatypes (strings & arrays).")]
+ [DefaultValue (0)]
+ public int Size {
+ get { return metaParameter.Size; }
+ set { metaParameter.Size = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("When used by a DataAdapter.Update, the source column name that is used to find the DataSetColumn name in the ColumnMappings. This is to copy a value between the parameter and a datarow.")]
+ [DefaultValue ("")]
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("When used by a DataAdapter.Update (UpdateCommand only), the version of the DataRow value that is used to update the data source.")]
+ [DefaultValue (DataRowVersion.Current)]
+ public DataRowVersion SourceVersion {
+ get { return sourceVersion; }
+ set { sourceVersion = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("The parameter native type.")]
+ [DefaultValue (SqlDbType.NVarChar)]
+ [RefreshProperties (RefreshProperties.All)]
+ public SqlDbType SqlDbType {
+ get { return sqlDbType; }
+ set {
+ SetSqlDbType (value);
+ isTypeSet = true;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Value of the parameter.")]
+ [DefaultValue (null)]
+ public object Value {
+ get { return metaParameter.Value; }
+ set {
+ if (!isTypeSet)
+ InferSqlType (value);
+ metaParameter.Value = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ object ICloneable.Clone ()
+ {
+ return new SqlParameter (ParameterName, SqlDbType, Size, Direction, IsNullable, Precision, Scale, SourceColumn, SourceVersion, Value);
+ }
+
+ // If the value is set without the DbType/SqlDbType being set, then we
+ // infer type information.
+ private void InferSqlType (object value)
+ {
+ Type type = value.GetType ();
+
+ string exception = String.Format ("The parameter data type of {0} is invalid.", type.Name);
+
+ switch (type.FullName) {
+ case "System.Int64":
+ SetSqlDbType (SqlDbType.BigInt);
+ break;
+ case "System.Boolean":
+ SetSqlDbType (SqlDbType.Bit);
+ break;
+ case "System.String":
+ SetSqlDbType (SqlDbType.NVarChar);
+ break;
+ case "System.DateTime":
+ SetSqlDbType (SqlDbType.DateTime);
+ break;
+ case "System.Decimal":
+ SetSqlDbType (SqlDbType.Decimal);
+ break;
+ case "System.Double":
+ SetSqlDbType (SqlDbType.Float);
+ break;
+ case "System.Byte[]":
+ SetSqlDbType (SqlDbType.VarBinary);
+ break;
+ case "System.Byte":
+ SetSqlDbType (SqlDbType.TinyInt);
+ break;
+ case "System.Int32":
+ SetSqlDbType (SqlDbType.Int);
+ break;
+ case "System.Single":
+ SetSqlDbType (SqlDbType.Real);
+ break;
+ case "System.Int16":
+ SetSqlDbType (SqlDbType.SmallInt);
+ break;
+ case "System.Guid":
+ SetSqlDbType (SqlDbType.UniqueIdentifier);
+ break;
+ case "System.Object":
+ SetSqlDbType (SqlDbType.Variant);
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ }
+
+ // When the DbType is set, we also set the SqlDbType, as well as the SQL Server
+ // string representation of the type name. If the DbType is not convertible
+ // to an SqlDbType, throw an exception.
+ private void SetDbType (DbType type)
+ {
+ string exception = String.Format ("No mapping exists from DbType {0} to a known SqlDbType.", type);
+
+ switch (type) {
+ case DbType.AnsiString:
+ MetaParameter.TypeName = "varchar";
+ sqlDbType = SqlDbType.VarChar;
+ break;
+ case DbType.AnsiStringFixedLength:
+ MetaParameter.TypeName = "char";
+ sqlDbType = SqlDbType.Char;
+ break;
+ case DbType.Binary:
+ MetaParameter.TypeName = "varbinary";
+ sqlDbType = SqlDbType.VarBinary;
+ break;
+ case DbType.Boolean:
+ MetaParameter.TypeName = "bit";
+ sqlDbType = SqlDbType.Bit;
+ break;
+ case DbType.Byte:
+ MetaParameter.TypeName = "tinyint";
+ sqlDbType = SqlDbType.TinyInt;
+ break;
+ case DbType.Currency:
+ sqlDbType = SqlDbType.Money;
+ MetaParameter.TypeName = "money";
+ break;
+ case DbType.Date:
+ case DbType.DateTime:
+ MetaParameter.TypeName = "datetime";
+ sqlDbType = SqlDbType.DateTime;
+ break;
+ case DbType.Decimal:
+ MetaParameter.TypeName = "decimal";
+ sqlDbType = SqlDbType.Decimal;
+ break;
+ case DbType.Double:
+ MetaParameter.TypeName = "float";
+ sqlDbType = SqlDbType.Float;
+ break;
+ case DbType.Guid:
+ MetaParameter.TypeName = "uniqueidentifier";
+ sqlDbType = SqlDbType.UniqueIdentifier;
+ break;
+ case DbType.Int16:
+ MetaParameter.TypeName = "smallint";
+ sqlDbType = SqlDbType.SmallInt;
+ break;
+ case DbType.Int32:
+ MetaParameter.TypeName = "int";
+ sqlDbType = SqlDbType.Int;
+ break;
+ case DbType.Int64:
+ MetaParameter.TypeName = "bigint";
+ sqlDbType = SqlDbType.BigInt;
+ break;
+ case DbType.Object:
+ MetaParameter.TypeName = "sql_variant";
+ sqlDbType = SqlDbType.Variant;
+ break;
+ case DbType.Single:
+ MetaParameter.TypeName = "real";
+ sqlDbType = SqlDbType.Real;
+ break;
+ case DbType.String:
+ MetaParameter.TypeName = "nvarchar";
+ sqlDbType = SqlDbType.NVarChar;
+ break;
+ case DbType.StringFixedLength:
+ MetaParameter.TypeName = "nchar";
+ sqlDbType = SqlDbType.NChar;
+ break;
+ case DbType.Time:
+ MetaParameter.TypeName = "datetime";
+ sqlDbType = SqlDbType.DateTime;
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ dbType = type;
+ }
+
+ // Used by internal constructor which has a SQL Server typename
+ private void SetDbTypeName (string dbTypeName)
+ {
+ switch (dbTypeName.ToLower ()) {
+ case "bigint":
+ SqlDbType = SqlDbType.BigInt;
+ break;
+ case "binary":
+ SqlDbType = SqlDbType.Binary;
+ break;
+ case "bit":
+ SqlDbType = SqlDbType.Bit;
+ break;
+ case "char":
+ SqlDbType = SqlDbType.Char;
+ break;
+ case "datetime":
+ SqlDbType = SqlDbType.DateTime;
+ break;
+ case "decimal":
+ SqlDbType = SqlDbType.Decimal;
+ break;
+ case "float":
+ SqlDbType = SqlDbType.Float;
+ break;
+ case "image":
+ SqlDbType = SqlDbType.Image;
+ break;
+ case "int":
+ SqlDbType = SqlDbType.Int;
+ break;
+ case "money":
+ SqlDbType = SqlDbType.Money;
+ break;
+ case "nchar":
+ SqlDbType = SqlDbType.NChar;
+ break;
+ case "ntext":
+ SqlDbType = SqlDbType.NText;
+ break;
+ case "nvarchar":
+ SqlDbType = SqlDbType.NVarChar;
+ break;
+ case "real":
+ SqlDbType = SqlDbType.Real;
+ break;
+ case "smalldatetime":
+ SqlDbType = SqlDbType.SmallDateTime;
+ break;
+ case "smallint":
+ SqlDbType = SqlDbType.SmallInt;
+ break;
+ case "smallmoney":
+ SqlDbType = SqlDbType.SmallMoney;
+ break;
+ case "text":
+ SqlDbType = SqlDbType.Text;
+ break;
+ case "timestamp":
+ SqlDbType = SqlDbType.Timestamp;
+ break;
+ case "tinyint":
+ SqlDbType = SqlDbType.TinyInt;
+ break;
+ case "uniqueidentifier":
+ SqlDbType = SqlDbType.UniqueIdentifier;
+ break;
+ case "varbinary":
+ SqlDbType = SqlDbType.VarBinary;
+ break;
+ case "varchar":
+ SqlDbType = SqlDbType.VarChar;
+ break;
+ default:
+ SqlDbType = SqlDbType.Variant;
+ break;
+ }
+ }
+
+ // When the SqlDbType is set, we also set the DbType, as well as the SQL Server
+ // string representation of the type name. If the SqlDbType is not convertible
+ // to a DbType, throw an exception.
+ private void SetSqlDbType (SqlDbType type)
+ {
+ string exception = String.Format ("No mapping exists from SqlDbType {0} to a known DbType.", type);
+
+ switch (type) {
+ case SqlDbType.BigInt:
+ MetaParameter.TypeName = "bigint";
+ dbType = DbType.Int64;
+ break;
+ case SqlDbType.Binary:
+ MetaParameter.TypeName = "binary";
+ dbType = DbType.Binary;
+ break;
+ case SqlDbType.Timestamp:
+ MetaParameter.TypeName = "timestamp";
+ dbType = DbType.Binary;
+ break;
+ case SqlDbType.VarBinary:
+ MetaParameter.TypeName = "varbinary";
+ dbType = DbType.Binary;
+ break;
+ case SqlDbType.Bit:
+ MetaParameter.TypeName = "bit";
+ dbType = DbType.Boolean;
+ break;
+ case SqlDbType.Char:
+ MetaParameter.TypeName = "char";
+ dbType = DbType.AnsiStringFixedLength;
+ break;
+ case SqlDbType.DateTime:
+ MetaParameter.TypeName = "datetime";
+ dbType = DbType.DateTime;
+ break;
+ case SqlDbType.SmallDateTime:
+ MetaParameter.TypeName = "smalldatetime";
+ dbType = DbType.DateTime;
+ break;
+ case SqlDbType.Decimal:
+ MetaParameter.TypeName = "decimal";
+ dbType = DbType.Decimal;
+ break;
+ case SqlDbType.Float:
+ MetaParameter.TypeName = "float";
+ dbType = DbType.Double;
+ break;
+ case SqlDbType.Image:
+ MetaParameter.TypeName = "image";
+ dbType = DbType.Binary;
+ break;
+ case SqlDbType.Int:
+ MetaParameter.TypeName = "int";
+ dbType = DbType.Int32;
+ break;
+ case SqlDbType.Money:
+ MetaParameter.TypeName = "money";
+ dbType = DbType.Currency;
+ break;
+ case SqlDbType.SmallMoney:
+ MetaParameter.TypeName = "smallmoney";
+ dbType = DbType.Currency;
+ break;
+ case SqlDbType.NChar:
+ MetaParameter.TypeName = "nchar";
+ dbType = DbType.StringFixedLength;
+ break;
+ case SqlDbType.NText:
+ MetaParameter.TypeName = "ntext";
+ dbType = DbType.String;
+ break;
+ case SqlDbType.NVarChar:
+ MetaParameter.TypeName = "nvarchar";
+ dbType = DbType.String;
+ break;
+ case SqlDbType.Real:
+ MetaParameter.TypeName = "real";
+ dbType = DbType.Single;
+ break;
+ case SqlDbType.SmallInt:
+ MetaParameter.TypeName = "smallint";
+ dbType = DbType.Int16;
+ break;
+ case SqlDbType.Text:
+ MetaParameter.TypeName = "text";
+ dbType = DbType.AnsiString;
+ break;
+ case SqlDbType.VarChar:
+ MetaParameter.TypeName = "varchar";
+ dbType = DbType.AnsiString;
+ break;
+ case SqlDbType.TinyInt:
+ MetaParameter.TypeName = "tinyint";
+ dbType = DbType.Byte;
+ break;
+ case SqlDbType.UniqueIdentifier:
+ MetaParameter.TypeName = "uniqueidentifier";
+ dbType = DbType.Guid;
+ break;
+ case SqlDbType.Variant:
+ MetaParameter.TypeName = "sql_variant";
+ dbType = DbType.Object;
+ break;
+ default:
+ throw new ArgumentException (exception);
+ }
+ sqlDbType = type;
+ }
+
+ public override string ToString()
+ {
+ return ParameterName;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs
new file mode 100644
index 00000000000..8ca0e9dab62
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs
@@ -0,0 +1,217 @@
+//
+// System.Data.SqlClient.SqlParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds;
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Collections;
+
+namespace System.Data.SqlClient {
+ [ListBindable (false)]
+ public sealed class SqlParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList list = new ArrayList();
+ TdsMetaParameterCollection metaParameters;
+ SqlCommand command;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlParameterCollection (SqlCommand command)
+ {
+ this.command = command;
+ metaParameters = new TdsMetaParameterCollection ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int Count {
+ get { return list.Count; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SqlParameter this [int index] {
+ get { return (SqlParameter) list [index]; }
+ set { list [index] = (SqlParameter) value; }
+ }
+
+ object IDataParameterCollection.this [string parameterName] {
+ get { return this[parameterName]; }
+ set {
+ if (!(value is SqlParameter))
+ throw new InvalidCastException ("Only SQLParameter objects can be used.");
+ this [parameterName] = (SqlParameter) value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SqlParameter this [string parameterName] {
+ get {
+ foreach (SqlParameter p in list)
+ if (p.ParameterName.Equals (parameterName))
+ return p;
+ throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
+ }
+ set {
+ if (!Contains (parameterName))
+ throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+ this [IndexOf (parameterName)] = value;
+ }
+ }
+
+ object IList.this [int index] {
+ get { return (SqlParameter) this [index]; }
+ set { this [index] = (SqlParameter) value; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ internal TdsMetaParameterCollection MetaParameters {
+ get { return metaParameters; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object value)
+ {
+ if (!(value is SqlParameter))
+ throw new InvalidCastException ("The parameter was not an SqlParameter.");
+ Add ((SqlParameter) value);
+ return IndexOf (value);
+ }
+
+ public SqlParameter Add (SqlParameter value)
+ {
+ if (value.Container != null)
+ throw new ArgumentException ("The SqlParameter specified in the value parameter is already added to this or another SqlParameterCollection.");
+
+ value.Container = this;
+ list.Add (value);
+ metaParameters.Add (value.MetaParameter);
+ return value;
+ }
+
+ public SqlParameter Add (string parameterName, object value)
+ {
+ return Add (new SqlParameter (parameterName, value));
+ }
+
+ public SqlParameter Add (string parameterName, SqlDbType sqlDbType)
+ {
+ return Add (new SqlParameter (parameterName, sqlDbType));
+ }
+
+ public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size)
+ {
+ return Add (new SqlParameter (parameterName, sqlDbType, size));
+ }
+
+ public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size, string sourceColumn)
+ {
+ return Add (new SqlParameter (parameterName, sqlDbType, size, sourceColumn));
+ }
+
+ public void Clear()
+ {
+ metaParameters.Clear ();
+ list.Clear ();
+ }
+
+ public bool Contains (object value)
+ {
+ if (!(value is SqlParameter))
+ throw new InvalidCastException ("The parameter was not an SqlParameter.");
+ return Contains (((SqlParameter) value).ParameterName);
+ }
+
+ public bool Contains (string value)
+ {
+ foreach (SqlParameter p in list)
+ if (p.ParameterName.Equals (value))
+ return true;
+ return false;
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object value)
+ {
+ if (!(value is SqlParameter))
+ throw new InvalidCastException ("The parameter was not an SqlParameter.");
+ return IndexOf (((SqlParameter) value).ParameterName);
+ }
+
+ public int IndexOf (string parameterName)
+ {
+ return list.IndexOf (parameterName);
+ }
+
+ public void Insert (int index, object value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (object value)
+ {
+ metaParameters.Remove (((SqlParameter) value).MetaParameter);
+ list.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ metaParameters.RemoveAt (index);
+ list.RemoveAt (index);
+ }
+
+ public void RemoveAt (string parameterName)
+ {
+ RemoveAt (IndexOf (parameterName));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs
new file mode 100644
index 00000000000..24c6dc6a6c0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs
@@ -0,0 +1,43 @@
+//
+// System.Data.SqlClient.SqlParameterConverter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Data.SqlClient {
+ internal sealed class SqlParameterConverter : ExpandableObjectConverter
+ {
+ #region Constructors
+
+ [MonoTODO]
+ public SqlParameterConverter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..eba30c3b553
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
@@ -0,0 +1,37 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs
+ {
+ #region Constructors
+
+ public SqlRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public new SqlCommand Command {
+ get { return (SqlCommand) base.Command; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..7aaffe10e10
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data.SqlClient {
+ public delegate void SqlRowUpdatedEventHandler (object sender, SqlRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..22bdb98dfbd
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ #region Constructors
+
+ public SqlRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (row, command, statementType, tableMapping)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public new SqlCommand Command {
+ get { return (SqlCommand) base.Command; }
+ set { base.Command = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..4d5cbaff984
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data.SqlClient {
+ public delegate void SqlRowUpdatingEventHandler(object sender, SqlRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
new file mode 100644
index 00000000000..06144e8c918
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
@@ -0,0 +1,106 @@
+//
+// System.Data.SqlClient.SqlTransaction.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlTransaction : MarshalByRefObject, IDbTransaction, IDisposable
+ {
+ #region Fields
+
+ bool disposed = false;
+ SqlConnection connection;
+ IsolationLevel isolationLevel;
+ bool isOpen;
+
+ #endregion
+
+ #region Constructors
+
+ internal SqlTransaction (SqlConnection connection, IsolationLevel isolevel)
+ {
+ this.connection = connection;
+ this.isolationLevel = isolevel;
+ isOpen = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SqlConnection Connection {
+ get { return connection; }
+ }
+
+ internal bool IsOpen {
+ get { return isOpen; }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get { return isolationLevel; }
+ }
+
+ IDbConnection IDbTransaction.Connection {
+ get { return Connection; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Commit ()
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute ("COMMIT TRANSACTION");
+ connection.Transaction = null;
+ isOpen = false;
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ Rollback ();
+ }
+ disposed = true;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public void Rollback ()
+ {
+ Rollback (String.Empty);
+ }
+
+ public void Rollback (string transactionName)
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute (String.Format ("ROLLBACK TRANSACTION {0}", transactionName));
+ isOpen = false;
+ }
+
+ public void Save (string savePointName)
+ {
+ if (!isOpen)
+ throw new InvalidOperationException ("The Transaction was not open.");
+ connection.Tds.Execute (String.Format ("SAVE TRANSACTION {0}", savePointName));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs
new file mode 100644
index 00000000000..4bd8a6eeea3
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs
@@ -0,0 +1,159 @@
+//
+// System.Data.SqlClient.SqlXmlTextReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.IO;
+using System.Text;
+
+namespace System.Data.SqlClient {
+ internal sealed class SqlXmlTextReader : TextReader, IDisposable
+ {
+ #region Fields
+
+ bool disposed = false;
+ bool eof = false;
+ SqlDataReader reader;
+ string localBuffer = "<results>";
+ int position;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SqlXmlTextReader (SqlDataReader reader)
+ : base ()
+ {
+ this.reader = reader;
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void Close()
+ {
+ reader.Close ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (disposing) {
+ Close ();
+ ((IDisposable) reader).Dispose ();
+ }
+ disposed = true;
+ }
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ private bool GetNextBuffer ()
+ {
+ if (eof) {
+ localBuffer = null;
+ return false;
+ }
+
+ position = 0;
+ if (reader.Read ())
+ localBuffer = reader.GetString (0);
+ else if (reader.NextResult () && reader.Read ())
+ localBuffer = reader.GetString (0);
+ else {
+ eof = true;
+ localBuffer = "</results>";
+ return false;
+ }
+ return true;
+ }
+
+ public override int Peek ()
+ {
+ bool moreResults;
+ if (localBuffer == null || localBuffer.Length == 0) {
+ moreResults = GetNextBuffer ();
+ if (!moreResults)
+ return -1;
+ }
+ return (int) localBuffer[position];
+ }
+
+ public override int Read ()
+ {
+ int result = Peek ();
+ position += 1;
+ return result;
+ }
+
+ public override int Read (char[] buffer, int index, int count)
+ {
+ bool moreResults = true;
+ int countRead = 0;
+
+ if (localBuffer == null)
+ moreResults = GetNextBuffer ();
+
+ while (moreResults && count - countRead > localBuffer.Length - position) {
+ localBuffer.CopyTo (position, buffer, index + countRead, localBuffer.Length);
+ countRead += localBuffer.Length;
+ moreResults = GetNextBuffer ();
+ }
+ if (moreResults && countRead < count) {
+ localBuffer.CopyTo (position, buffer, index + countRead, count - countRead);
+ position += count - countRead;
+ }
+
+ return countRead;
+ }
+
+ public override int ReadBlock (char[] buffer, int index, int count)
+ {
+ return Read (buffer, index, count);
+ }
+
+ public override string ReadLine ()
+ {
+ bool moreResults = true;
+ string outBuffer;
+ if (localBuffer == null)
+ moreResults = GetNextBuffer ();
+ if (!moreResults)
+ return null;
+ outBuffer = localBuffer;
+ GetNextBuffer ();
+ return outBuffer;
+ }
+
+ public override string ReadToEnd ()
+ {
+ string outBuffer = String.Empty;
+
+ bool moreResults = true;
+ if (localBuffer == null)
+ moreResults = GetNextBuffer ();
+ while (moreResults) {
+ outBuffer += localBuffer;
+ moreResults = GetNextBuffer ();
+ }
+ return outBuffer;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/INullable.cs b/mcs/class/System.Data/System.Data.SqlTypes/INullable.cs
new file mode 100644
index 00000000000..cc4b6f9bb8f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/INullable.cs
@@ -0,0 +1,22 @@
+//
+// System.Data.SqlTypes.INullable
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// All of the System.Data.SqlTypes objects and structures implement the INullable interface,
+ /// reflecting the fact that, unlike the corresponding system types, SqlTypes can legally contain the value null.
+ /// </summary>
+ public interface INullable
+ {
+ bool IsNull {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs
new file mode 100644
index 00000000000..fd926e8774f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs
@@ -0,0 +1,307 @@
+//
+// System.Data.SqlTypes.SqlBinary
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ximian, Inc.
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// Represents a variable-length stream of binary data to be stored in or retrieved from a database.
+ /// </summary>
+ public struct SqlBinary : INullable, IComparable
+ {
+
+ #region Fields
+
+ byte[] value;
+ private bool notNull;
+
+ public static readonly SqlBinary Null;
+
+ #endregion
+
+ #region Constructors
+
+ public SqlBinary (byte[] value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public byte this[int index] {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ("The property contains Null.");
+ else if (index >= this.Length)
+ throw new SqlNullValueException ("The index parameter indicates a position beyond the length of the byte array.");
+ else
+ return value [index];
+ }
+ }
+
+ public int Length {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ("The property contains Null.");
+ else
+ return value.Length;
+ }
+ }
+
+ public byte[] Value
+ {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlBinary))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlBinary"));
+ else if (((SqlBinary)value).IsNull)
+ return 1;
+ else
+ return Compare (this, (SqlBinary)value);
+ }
+
+ public static SqlBinary Concat (SqlBinary x, SqlBinary y)
+ {
+ return (x + y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlBinary))
+ return false;
+ else if (this.IsNull && ((SqlBinary)value).IsNull)
+ return true;
+ else if (((SqlBinary)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlBinary)value);
+ }
+
+ public static SqlBoolean Equals(SqlBinary x, SqlBinary y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ // FIXME: I'm not sure is this a right way
+ int result = 10;
+ for (int i = 0; i < value.Length; i++) {
+
+ result = 91 * result + (int)value [i];
+ }
+
+ return result;
+ }
+
+ #endregion
+
+ #region Operators
+
+ public static SqlBoolean GreaterThan (SqlBinary x, SqlBinary y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlBinary x, SqlBinary y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlBinary x, SqlBinary y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlBinary x, SqlBinary y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlBoolean NotEquals (SqlBinary x, SqlBinary y)
+ {
+ return (x != y);
+ }
+
+ public SqlGuid ToSqlGuid ()
+ {
+ return (SqlGuid)this;
+ }
+
+ public override string ToString ()
+ {
+ return "SqlBinary(" + value.Length + ")";
+ }
+
+ #endregion
+
+ #region Operators
+
+ [MonoTODO]
+ public static SqlBinary operator + (SqlBinary x, SqlBinary y)
+ {
+ byte [] b = new byte [x.Value.Length + y.Value.Length];
+ int j = 0;
+ int i;
+
+ for (i = 0; i < x.Value.Length; i++)
+ b [i] = x.Value [i];
+
+
+ for (; i < (x.Value.Length + y.Value.Length); i++) {
+ b [i] = y.Value [j];
+ j++;
+ }
+
+ return new SqlBinary (b);
+ }
+
+ public static SqlBoolean operator == (SqlBinary x, SqlBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (Compare (x, y) == 0);
+ }
+
+ public static SqlBoolean operator > (SqlBinary x, SqlBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ return new SqlBoolean (Compare (x, y) > 0);
+ }
+
+ public static SqlBoolean operator >= (SqlBinary x, SqlBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ return new SqlBoolean (Compare (x, y) >= 0);
+ }
+
+ public static SqlBoolean operator != (SqlBinary x, SqlBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (Compare (x, y) != 0);
+ }
+
+ public static SqlBoolean operator < (SqlBinary x, SqlBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ return new SqlBoolean (Compare (x, y) < 0);
+ }
+
+ public static SqlBoolean operator <= (SqlBinary x, SqlBinary y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ return new SqlBoolean (Compare (x, y) <= 0);
+ }
+
+ public static explicit operator byte[] (SqlBinary x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlBinary (SqlGuid x)
+ {
+ return new SqlBinary (x.ToByteArray ());
+ }
+
+ public static implicit operator SqlBinary (byte[] x)
+ {
+ return new SqlBinary (x);
+ }
+
+ #endregion
+
+ // Helper method to Compare methods and operators.
+ // Returns 0 if x == y
+ // 1 if x > y
+ // -1 if x < y
+ private static int Compare(SqlBinary x, SqlBinary y)
+ {
+
+ int LengthDiff = 0;
+
+ // If they are different size test are bytes something else than 0
+ if (x.Value.Length != y.Value.Length) {
+
+ LengthDiff = x.Value.Length - y.Value.Length;
+
+ // If more than zero, x is longer
+ if (LengthDiff > 0) {
+
+ for (int i = x.Value.Length - 1; i > x.Value.Length - LengthDiff; i--) {
+ // If byte is more than zero the x is bigger
+ if (x.Value [i] != (byte)0)
+ return 1;
+ }
+ } else {
+
+ for (int i = y.Value.Length - 1; i > y.Value.Length - LengthDiff; i--) {
+ // If byte is more than zero then y is bigger
+ if (y.Value [i] != (byte)0)
+ return -1;
+ }
+ }
+ }
+
+ // choose shorter
+ int lenght = (LengthDiff > 0) ? y.Value.Length : x.Value.Length;
+
+ for (int i = lenght - 1 ; i > 0; i--) {
+
+ byte X = x.Value [i];
+ byte Y = y.Value [i];
+
+ if (X > Y)
+ return 1;
+ else if (X < Y)
+ return -1;
+ }
+
+ // If we are here, x and y were same size
+ return 0;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs
new file mode 100644
index 00000000000..b417759bb43
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs
@@ -0,0 +1,427 @@
+//
+// System.Data.SqlTypes.SqlBoolean
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. 2002
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// Represents an integer value that is either 1 or 0
+ /// to be stored in or retrieved from a database.
+ /// </summary>
+ public struct SqlBoolean : INullable, IComparable
+ {
+
+ #region Fields
+
+ byte value;
+
+ // default is false
+ private bool notNull;
+
+ public static readonly SqlBoolean False = new SqlBoolean (false);
+ public static readonly SqlBoolean Null;
+ public static readonly SqlBoolean One = new SqlBoolean (1);
+ public static readonly SqlBoolean True = new SqlBoolean (true);
+ public static readonly SqlBoolean Zero = new SqlBoolean (0);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlBoolean (bool value)
+ {
+ this.value = (byte) (value ? 1 : 0);
+ notNull = true;
+ }
+
+ public SqlBoolean (int value)
+ {
+ this.value = (byte) (value != 0 ? 1 : 0);
+ notNull = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte ByteValue {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException(Locale.GetText("The property is set to null."));
+ else
+ return value;
+ }
+ }
+
+ public bool IsFalse {
+ get {
+ if (this.IsNull)
+ return false;
+ else
+ return (value == 0);
+ }
+ }
+
+ public bool IsNull {
+ get {
+ return !notNull;
+ }
+ }
+
+ public bool IsTrue {
+ get {
+ if (this.IsNull)
+ return false;
+ else
+ return (value != 0);
+ }
+ }
+
+ public bool Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException(Locale.GetText("The property is set to null."));
+ else
+ return this.IsTrue;
+ }
+ }
+
+ #endregion // Properties
+
+ public static SqlBoolean And (SqlBoolean x, SqlBoolean y)
+ {
+ return (x & y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlBoolean))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlBoolean"));
+ else if (((SqlBoolean)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlBoolean)value).ByteValue);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is SqlBoolean))
+ return false;
+ if (this.IsNull && ((SqlBoolean)value).IsNull)
+ return true;
+ else if (((SqlBoolean)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlBoolean)value);
+ }
+
+ public static SqlBoolean Equals(SqlBoolean x, SqlBoolean y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ int hash;
+ if (this.IsTrue)
+ hash = 1;
+ else
+ hash = 0;
+
+ return hash;
+ }
+
+ public static SqlBoolean NotEquals(SqlBoolean x, SqlBoolean y)
+ {
+ return (x != y);
+ }
+
+ public static SqlBoolean OnesComplement(SqlBoolean x)
+ {
+ return ~x;
+ }
+
+ public static SqlBoolean Or(SqlBoolean x, SqlBoolean y)
+ {
+ return (x | y);
+ }
+
+ public static SqlBoolean Parse(string s)
+ {
+ return new SqlBoolean (Boolean.Parse (s));
+ }
+
+ public SqlByte ToSqlByte()
+ {
+ return new SqlByte (value);
+ }
+
+ // **************************************************
+ // Conversion from SqlBoolean to other SqlTypes
+ // **************************************************
+
+ public SqlDecimal ToSqlDecimal()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString()
+ {
+ if (this.IsNull)
+ return new SqlString ("Null");
+ if (this.IsTrue)
+ return new SqlString ("True");
+ else
+ return new SqlString ("False");
+ }
+
+ public override string ToString()
+ {
+ if (this.IsNull)
+ return "Null";
+ if (this.IsTrue)
+ return "True";
+ else
+ return "False";
+ }
+
+ // Bitwise exclusive-OR (XOR)
+ public static SqlBoolean Xor(SqlBoolean x, SqlBoolean y)
+ {
+ return (x ^ y);
+ }
+
+ // **************************************************
+ // Public Operators
+ // **************************************************
+
+ // Bitwise AND
+ public static SqlBoolean operator & (SqlBoolean x, SqlBoolean y)
+ {
+ return new SqlBoolean (x.Value & y.Value);
+ }
+
+ // Bitwise OR
+ public static SqlBoolean operator | (SqlBoolean x, SqlBoolean y)
+ {
+ return new SqlBoolean (x.Value | y.Value);
+
+ }
+
+ // Compares two instances for equality
+ public static SqlBoolean operator == (SqlBoolean x, SqlBoolean y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ // Bitwize exclusive-OR (XOR)
+ public static SqlBoolean operator ^ (SqlBoolean x, SqlBoolean y)
+ {
+ return new SqlBoolean (x.Value ^ y.Value);
+ }
+
+ // test Value of SqlBoolean to determine it is false.
+ public static bool operator false (SqlBoolean x)
+ {
+ return x.IsFalse;
+ }
+
+ // in-equality
+ public static SqlBoolean operator != (SqlBoolean x, SqlBoolean y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value != y.Value);
+ }
+
+ // Logical NOT
+ public static SqlBoolean operator ! (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!x.Value);
+ }
+
+ // One's Complement
+ public static SqlBoolean operator ~ (SqlBoolean x)
+ {
+ SqlBoolean b;
+ if (x.IsTrue)
+ b = new SqlBoolean(false);
+ else
+ b = new SqlBoolean(true);
+
+ return b;
+ }
+
+ // test to see if value is true
+ public static bool operator true (SqlBoolean x)
+ {
+ return x.IsTrue;
+ }
+
+ // ****************************************
+ // Type Conversion
+ // ****************************************
+
+
+ // SqlBoolean to Boolean
+ public static explicit operator bool (SqlBoolean x)
+ {
+ return x.Value;
+ }
+
+
+ // SqlByte to SqlBoolean
+ public static explicit operator SqlBoolean (SqlByte x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ }
+ }
+
+ // SqlDecimal to SqlBoolean
+ public static explicit operator SqlBoolean (SqlDecimal x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ }
+ }
+
+ // SqlDouble to SqlBoolean
+ public static explicit operator SqlBoolean (SqlDouble x)
+ {
+ // FIXME
+ //checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ //}
+ }
+
+ // SqlInt16 to SqlBoolean
+ public static explicit operator SqlBoolean (SqlInt16 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ }
+ }
+
+ // SqlInt32 to SqlBoolean
+ public static explicit operator SqlBoolean (SqlInt32 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean (x.Value);
+ }
+ }
+
+ // SqlInt64 to SqlBoolean
+ public static explicit operator SqlBoolean (SqlInt64 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ }
+ }
+
+ // SqlMoney to SqlBoolean
+ public static explicit operator SqlBoolean (SqlMoney x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ }
+ }
+
+ // SqlSingle to SqlBoolean
+ public static explicit operator SqlBoolean (SqlSingle x)
+ {
+ // FIXME
+ //checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlBoolean ((int)x.Value);
+ //}
+ }
+
+ // SqlString to SqlBoolean
+ public static explicit operator SqlBoolean (SqlString x)
+ {
+ checked {
+ return SqlBoolean.Parse (x.Value);
+ }
+ }
+
+ // Boolean to SqlBoolean
+ public static implicit operator SqlBoolean (bool x)
+ {
+ return new SqlBoolean (x);
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlByte.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlByte.cs
new file mode 100644
index 00000000000..75cee9d38e2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlByte.cs
@@ -0,0 +1,425 @@
+//
+// System.Data.SqlTypes.SqlByte
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlByte : INullable, IComparable
+ {
+ #region Fields
+
+ byte value;
+ private bool notNull;
+
+ public static readonly SqlByte MaxValue = new SqlByte (0xff);
+ public static readonly SqlByte MinValue = new SqlByte (0);
+ public static readonly SqlByte Null;
+ public static readonly SqlByte Zero = new SqlByte (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlByte (byte value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public byte Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlByte Add (SqlByte x, SqlByte y)
+ {
+ return (x + y);
+ }
+
+ public static SqlByte BitwiseAnd (SqlByte x, SqlByte y)
+ {
+ return (x & y);
+ }
+
+ public static SqlByte BitwiseOr (SqlByte x, SqlByte y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlByte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlByte"));
+ else if (((SqlByte)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlByte)value).Value);
+ }
+
+ public static SqlByte Divide (SqlByte x, SqlByte y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlByte))
+ return false;
+ else if (this.IsNull && ((SqlByte)value).IsNull)
+ return true;
+ else if (((SqlByte)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlByte)value);
+ }
+
+ public static SqlBoolean Equals (SqlByte x, SqlByte y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static SqlBoolean GreaterThan (SqlByte x, SqlByte y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlByte x, SqlByte y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlByte x, SqlByte y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlByte x, SqlByte y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlByte Mod (SqlByte x, SqlByte y)
+ {
+ return (x % y);
+ }
+
+ public static SqlByte Multiply (SqlByte x, SqlByte y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlByte x, SqlByte y)
+ {
+ return (x != y);
+ }
+
+ public static SqlByte OnesComplement (SqlByte x)
+ {
+ return ~x;
+ }
+
+ public static SqlByte Parse (string s)
+ {
+ checked {
+ return new SqlByte (Byte.Parse (s));
+ }
+ }
+
+ public static SqlByte Subtract (SqlByte x, SqlByte y)
+ {
+ return (x - y);
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlDecimal ToSqlDecimal ()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble ()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16 ()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64 ()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney ()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle ()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static SqlByte Xor (SqlByte x, SqlByte y)
+ {
+ return (x ^ y);
+ }
+
+ public static SqlByte operator + (SqlByte x, SqlByte y)
+ {
+ checked {
+ return new SqlByte ((byte) (x.Value + y.Value));
+ }
+ }
+
+ public static SqlByte operator & (SqlByte x, SqlByte y)
+ {
+ return new SqlByte ((byte) (x.Value & y.Value));
+ }
+
+ public static SqlByte operator | (SqlByte x, SqlByte y)
+ {
+ return new SqlByte ((byte) (x.Value | y.Value));
+ }
+
+ public static SqlByte operator / (SqlByte x, SqlByte y)
+ {
+ checked {
+ return new SqlByte ((byte) (x.Value / y.Value));
+ }
+ }
+
+ public static SqlBoolean operator == (SqlByte x, SqlByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlByte operator ^ (SqlByte x, SqlByte y)
+ {
+ return new SqlByte ((byte) (x.Value ^ y.Value));
+ }
+
+ public static SqlBoolean operator > (SqlByte x, SqlByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlByte x, SqlByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlByte x, SqlByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlByte x, SqlByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlByte x, SqlByte y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlByte operator % (SqlByte x, SqlByte y)
+ {
+ return new SqlByte ((byte) (x.Value % y.Value));
+ }
+
+ public static SqlByte operator * (SqlByte x, SqlByte y)
+ {
+ checked {
+ return new SqlByte ((byte) (x.Value * y.Value));
+ }
+ }
+
+ public static SqlByte operator ~ (SqlByte x)
+ {
+ return new SqlByte ((byte) ~x.Value);
+ }
+
+ public static SqlByte operator - (SqlByte x, SqlByte y)
+ {
+ checked {
+ return new SqlByte ((byte) (x.Value - y.Value));
+ }
+ }
+
+ public static explicit operator SqlByte (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte (x.ByteValue);
+ }
+
+ public static explicit operator byte (SqlByte x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlByte (SqlDecimal x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ }
+ }
+
+ public static explicit operator SqlByte (SqlDouble x)
+ {
+ // FIXME
+ // checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ //}
+ }
+
+ public static explicit operator SqlByte (SqlInt16 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ }
+ }
+
+ public static explicit operator SqlByte (SqlInt32 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ }
+ }
+
+ public static explicit operator SqlByte (SqlInt64 x)
+ {
+ // FIXME
+ //checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ //}
+ }
+
+ public static explicit operator SqlByte (SqlMoney x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ }
+ }
+
+ public static explicit operator SqlByte (SqlSingle x)
+ {
+ // FIXME:
+ //checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlByte ((byte)x.Value);
+ //}
+ }
+
+
+ public static explicit operator SqlByte (SqlString x)
+ {
+ checked {
+ return SqlByte.Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlByte (byte x)
+ {
+ return new SqlByte (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs
new file mode 100644
index 00000000000..c0ffcb53eb6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs
@@ -0,0 +1,29 @@
+//
+// System.Data.SqlTypes.SqlCompareOptions.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// Specifies the compare option values for a SqlString structure.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum SqlCompareOptions {
+ BinarySort = 0x8000,
+ IgnoreCase = 0x1,
+ IgnoreKanaType = 0x8,
+ IgnoreNonSpace = 0x2,
+ IgnoreWidth = 0x10,
+ None = 0
+ }
+
+}
+
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlDateTime.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlDateTime.cs
new file mode 100644
index 00000000000..5423e6730e7
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlDateTime.cs
@@ -0,0 +1,282 @@
+//
+// System.Data.SqlTypes.SqlDateTime
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlDateTime : INullable, IComparable
+ {
+ #region Fields
+ private DateTime value;
+ private bool notNull;
+
+ public static readonly SqlDateTime MaxValue = new SqlDateTime (9999,12,31,23,59,59);
+ public static readonly SqlDateTime MinValue = new SqlDateTime (1753,1,1);
+ public static readonly SqlDateTime Null;
+ public static readonly int SQLTicksPerHour = 1080000;
+ public static readonly int SQLTicksPerMinute = 18000;
+ public static readonly int SQLTicksPerSecond = 300;
+
+ #endregion
+
+ #region Constructors
+
+ public SqlDateTime (DateTime value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ public SqlDateTime (int dayTicks, int timeTicks)
+ {
+ DateTime temp = new DateTime (1900, 1, 1);
+ this.value = new DateTime (temp.Ticks + (long)(dayTicks + timeTicks));
+ notNull = true;
+ }
+
+ public SqlDateTime (int year, int month, int day)
+ {
+ this.value = new DateTime (year, month, day);
+ notNull = true;
+ }
+
+ public SqlDateTime (int year, int month, int day, int hour, int minute, int second)
+ {
+ this.value = new DateTime (year, month, day, hour, minute, second);
+ notNull = true;
+ }
+
+ public SqlDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
+ {
+ DateTime t = new DateTime(year, month, day);
+
+ this.value = new DateTime ((long)(t.Day * 24 * SQLTicksPerHour +
+ hour * SQLTicksPerHour +
+ minute * SQLTicksPerMinute +
+ second * SQLTicksPerSecond +
+ millisecond * 1000));
+ notNull = true;
+ }
+
+ public SqlDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
+ {
+ DateTime t = new DateTime(year, month, day);
+
+ this.value = new DateTime ((long)(t.Day * 24 * SQLTicksPerHour +
+ hour * SQLTicksPerHour +
+ minute * SQLTicksPerMinute +
+ second * SQLTicksPerSecond +
+ bilisecond));
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int DayTicks {
+ get {
+ float DateTimeTicksPerHour = 3.6E+10f;
+
+ DateTime temp = new DateTime (1900, 1, 1);
+
+ int result = (int)((this.Value.Ticks - temp.Ticks) / (24 * DateTimeTicksPerHour));
+ return result;
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public int TimeTicks {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+
+ return (int)(value.Hour * SQLTicksPerHour +
+ value.Minute * SQLTicksPerMinute +
+ value.Second * SQLTicksPerSecond +
+ value.Millisecond);
+ }
+ }
+
+ public DateTime Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlDateTime))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlDateTime"));
+ else if (((SqlDateTime)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlDateTime)value).Value);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlDateTime))
+ return false;
+ else if (this.IsNull && ((SqlDateTime)value).IsNull)
+ return true;
+ else if (((SqlDateTime)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlDateTime)value);
+ }
+
+ public static SqlBoolean Equals (SqlDateTime x, SqlDateTime y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return value.GetHashCode ();
+ }
+
+ public static SqlBoolean GreaterThan (SqlDateTime x, SqlDateTime y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlDateTime x, SqlDateTime y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlDateTime x, SqlDateTime y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlDateTime x, SqlDateTime y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlBoolean NotEquals (SqlDateTime x, SqlDateTime y)
+ {
+ return (x != y);
+ }
+
+ public static SqlDateTime Parse (string s)
+ {
+ return new SqlDateTime (DateTime.Parse (s));
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SqlDateTime operator + (SqlDateTime x, TimeSpan t)
+ {
+ if (x.IsNull)
+ return SqlDateTime.Null;
+
+ return new SqlDateTime (x.Value + t);
+ }
+
+ public static SqlBoolean operator == (SqlDateTime x, SqlDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlBoolean operator > (SqlDateTime x, SqlDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlDateTime x, SqlDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlDateTime x, SqlDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlDateTime x, SqlDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlDateTime x, SqlDateTime y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlDateTime operator - (SqlDateTime x, TimeSpan t)
+ {
+ return new SqlDateTime (x.Value - t);
+ }
+
+ public static explicit operator DateTime (SqlDateTime x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlDateTime (SqlString x)
+ {
+ return SqlDateTime.Parse (x.Value);
+ }
+
+ public static implicit operator SqlDateTime (DateTime x)
+ {
+ return new SqlDateTime (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlDecimal.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlDecimal.cs
new file mode 100644
index 00000000000..7b65bbfbb7e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlDecimal.cs
@@ -0,0 +1,1326 @@
+//
+// System.Data.SqlTypes.SqlDecimal
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using Mono.Data.Tds.Protocol;
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlDecimal : INullable, IComparable
+ {
+ #region Fields
+
+ int[] value;
+ byte precision;
+ byte scale;
+ bool positive;
+
+ private bool notNull;
+
+ // borrowed from System.Decimal
+ const int SCALE_SHIFT = 16;
+ const int SIGN_SHIFT = 31;
+ const int RESERVED_SS32_BITS = 0x7F00FFFF;
+ const ulong LIT_GUINT64_HIGHBIT = 0x8000000000000000;
+ const ulong LIT_GUINT32_HIGHBIT = 0x80000000;
+ const byte DECIMAL_MAX_INTFACTORS = 9;
+ static uint [] constantsDecadeInt32Factors = new uint [10]
+ {
+ 1u, 10u, 100u, 1000u, 10000u, 100000u, 1000000u,
+ 10000000u, 100000000u, 1000000000u
+ };
+
+ public static readonly byte MaxPrecision = 38;
+ public static readonly byte MaxScale = 38;
+
+ // This should be 99999999999999999999999999999999999999
+ public static readonly SqlDecimal MaxValue = new SqlDecimal (MaxPrecision,
+ (byte)0,
+ true,
+ (int)-1,
+ 160047679,
+ 1518781562,
+ 1262177448);
+ // This should be -99999999999999999999999999999999999999
+ public static readonly SqlDecimal MinValue = new SqlDecimal (MaxPrecision,
+ (byte)0, false,
+ -1,
+ 160047679,
+ 1518781562,
+ 1262177448);
+
+ public static readonly SqlDecimal Null;
+
+ #endregion
+
+ #region Constructors
+
+ public SqlDecimal (decimal value)
+ {
+ int[] binData = Decimal.GetBits (value);
+
+ this.precision = MaxPrecision; // this value seems unclear
+
+ this.scale = (byte)(((uint)binData [3]) >> SCALE_SHIFT);
+
+ if (this.scale > MaxScale || ((uint)binData [3] & RESERVED_SS32_BITS) != 0)
+ throw new ArgumentException(Locale.GetText ("Invalid scale"));
+
+ this.value = new int[4];
+ this.value[0] = binData[0];
+ this.value[1] = binData[1];
+ this.value[2] = binData[2];
+ this.value[3] = 0;
+
+ if (value >= 0)
+ positive = true;
+ else
+ positive = false;
+
+ notNull = true;
+ precision = GetPrecision (value);
+ }
+
+ public SqlDecimal (double value) : this ((decimal)value) { }
+ public SqlDecimal (int value) : this ((decimal)value) { }
+ public SqlDecimal (long value) : this ((decimal)value) { }
+
+ public SqlDecimal (byte bPrecision, byte bScale, bool fPositive, int[] bits) : this (bPrecision, bScale, fPositive, bits[0], bits[1], bits[2], bits[3]) { }
+
+ [MonoTODO]
+ public SqlDecimal (byte bPrecision, byte bScale, bool fPositive, int data1, int data2, int data3, int data4)
+ {
+ this.precision = bPrecision;
+ this.scale = bScale;
+ this.positive = fPositive;
+ this.value = new int[4];
+ this.value[0] = data1;
+ this.value[1] = data2;
+ this.value[2] = data3;
+ this.value[3] = data4;
+ notNull = true;
+
+ if (precision < scale)
+ throw new ArgumentException(Locale.GetText ("Invalid scale"));
+
+ // FIXME: What is the right message of Exception
+ if (this.ToDouble () > (Math.Pow (10, 38) - 1) ||
+ this.ToDouble () < -(Math.Pow (10, 38)))
+ throw new SqlTypeException ("Can't convert to SqlDecimal");
+ }
+
+ #endregion
+
+ #region Properties
+
+ public byte[] BinData {
+ get {
+
+ byte [] b = new byte [value.Length * 4];
+
+ int j = 0;
+ for (int i = 0; i < value.Length; i++) {
+
+ b [j++] = (byte)(0xff & value [i]);
+ b [j++] = (byte)(0xff & value [i] >> 8);
+ b [j++] = (byte)(0xff & value [i] >> 16);
+ b [j++] = (byte)(0xff & value [i] >> 24);
+ }
+
+ return b;
+ }
+ }
+
+ public int[] Data {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return (value);
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public bool IsPositive {
+ get { return positive; }
+ }
+
+ public byte Precision {
+ get { return precision; }
+ }
+
+ public byte Scale {
+ get { return scale; }
+ }
+
+ public decimal Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+
+ if (this.value[3] > 0)
+ throw new OverflowException ();
+
+ return new decimal (value[0], value[1], value[2], !positive, scale);
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlDecimal Abs (SqlDecimal n)
+ {
+ return new SqlDecimal (n.Precision, n.Scale, true,
+ n.BinData [0], n.BinData [1],
+ n.BinData [2], n.BinData [3]);
+ }
+
+ public static SqlDecimal Add (SqlDecimal x, SqlDecimal y)
+ {
+ return (x + y);
+ }
+
+ public static SqlDecimal AdjustScale (SqlDecimal n, int digits, bool fRound)
+ {
+ byte prec = n.Precision;
+ if (n.IsNull)
+ throw new SqlNullValueException ();
+
+ if (digits > 0)
+ prec = (byte)(prec + digits);
+
+ if (fRound)
+ n = Round (n, digits + n.Scale);
+
+ return new SqlDecimal (prec,
+ (byte)(n.Scale + digits),
+ n.IsPositive, n.Data);
+ }
+
+ public static SqlDecimal Ceiling (SqlDecimal n)
+ {
+ return AdjustScale (n, -(n.Scale), true);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlDecimal))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlDecimal"));
+ else if (((SqlDecimal)value).IsNull)
+ return 1;
+ else
+ return this.Value.CompareTo (((SqlDecimal)value).Value);
+ }
+
+ public static SqlDecimal ConvertToPrecScale (SqlDecimal n, int precision, int scale)
+ {
+ return new SqlDecimal ((byte)precision, (byte)scale, n.IsPositive, n.Data);
+ }
+
+ public static SqlDecimal Divide (SqlDecimal x, SqlDecimal y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlDecimal))
+ return false;
+ else if (this.IsNull && ((SqlDecimal)value).IsNull)
+ return true;
+ else if (((SqlDecimal)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlDecimal)value);
+ }
+
+ public static SqlBoolean Equals (SqlDecimal x, SqlDecimal y)
+ {
+ return (x == y);
+ }
+
+ public static SqlDecimal Floor (SqlDecimal n)
+ {
+ return AdjustScale (n, -(n.Scale), false);
+ }
+
+ internal static SqlDecimal FromTdsBigDecimal (TdsBigDecimal x)
+ {
+ if (x == null)
+ return Null;
+ else
+ return new SqlDecimal (x.Precision, x.Scale, !x.IsNegative, x.Data);
+ }
+
+ public override int GetHashCode ()
+ {
+ int result = 10;
+ result = 91 * result + this.Data[0];
+ result = 91 * result + this.Data[1];
+ result = 91 * result + this.Data[2];
+ result = 91 * result + this.Data[3];
+ result = 91 * result + (int)this.Scale;
+ result = 91 * result + (int)this.Precision;
+
+ return result;
+ }
+
+ public static SqlBoolean GreaterThan (SqlDecimal x, SqlDecimal y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlDecimal x, SqlDecimal y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlDecimal x, SqlDecimal y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlDecimal x, SqlDecimal y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlDecimal Multiply (SqlDecimal x, SqlDecimal y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlDecimal x, SqlDecimal y)
+ {
+ return (x != y);
+ }
+
+ [MonoTODO]
+ public static SqlDecimal Parse (string s)
+ {
+ // FIXME: Huh, There must be better way to do this
+ if (s == null)
+ throw new ArgumentNullException ();
+ else
+ return SqlDouble.Parse (s).ToSqlDecimal ();
+ }
+
+ public static SqlDecimal Power (SqlDecimal n, double exp)
+ {
+ if (n.IsNull)
+ return SqlDecimal.Null;
+
+ return new SqlDecimal (Math.Pow (n.ToDouble (), exp));
+ }
+
+ [MonoTODO]
+ public static SqlDecimal Round (SqlDecimal n, int position)
+ {
+ // FIXME: There must be better way to do this
+ if (n.IsNull)
+ throw new SqlNullValueException ();
+
+ SqlDecimal result = new SqlDecimal (Math.Round (
+ (double)(n.ToDouble () * Math.Pow (10, position))));
+
+ result = result / new SqlDecimal(Math.Pow (10, position));
+
+ return result;
+ }
+
+ public static SqlInt32 Sign (SqlDecimal n)
+ {
+ SqlInt32 result = 0;
+
+ if (n >= new SqlDecimal (0))
+ result = 1;
+ else
+ result = -1;
+
+ return result;
+ }
+
+ public static SqlDecimal Subtract (SqlDecimal x, SqlDecimal y)
+ {
+ return (x - y);
+ }
+
+ private byte GetPrecision (decimal value)
+ {
+ string str = value.ToString ();
+ byte result = 0;
+
+ foreach (char c in str) {
+
+ if (c >= '0' && c <= '9')
+ result++;
+ }
+
+ return result;
+ }
+
+ public double ToDouble ()
+ {
+ // FIXME: This is wrong way to do this
+ double d = (uint)this.Data [0];
+ d += ((uint)this.Data [1]) * Math.Pow (2, 32);
+ d += ((uint)this.Data [2]) * Math.Pow (2, 64);
+ d += ((uint)this.Data [3]) * Math.Pow (2, 96);
+ d = d / Math.Pow (10, scale);
+
+ return d;
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte ()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDouble ToSqlDouble ()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16 ()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64 ()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney ()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle ()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+
+ // convert int [4] --> ulong [2]
+ ulong lo = (uint)this.Data [0];
+ lo += (ulong)((ulong)this.Data [1] << 32);
+ ulong hi = (uint)this.Data [2];
+ hi += (ulong)((ulong)this.Data [3] << 32);
+
+ uint rest = 0;
+ String result = "";
+ StringBuilder Result = new StringBuilder ();
+ for (int i = 0; lo != 0 || hi != 0; i++) {
+
+ Div128By32 (ref hi, ref lo, 10, ref rest);
+ Result.Insert (0, rest.ToString ());
+ }
+
+ while (Result.Length < this.Precision)
+ Result.Append ("0");
+
+ while (Result.Length > this.Precision)
+ Result.Remove (Result.Length - 1, 1);
+
+ if (this.Scale > 0)
+ Result.Insert (Result.Length - this.Scale, ".");
+
+ return Result.ToString ();
+ }
+
+ // From decimal.c
+ private static int Div128By32(ref ulong hi, ref ulong lo, uint divider)
+ {
+ uint t = 0;
+ return Div128By32 (ref hi, ref lo, divider, ref t);
+ }
+
+ // From decimal.c
+ private static int Div128By32(ref ulong hi, ref ulong lo, uint divider, ref uint rest)
+ {
+ ulong a = 0;
+ ulong b = 0;
+ ulong c = 0;
+
+ a = (uint)(hi >> 32);
+ b = a / divider;
+ a -= b * divider;
+ a <<= 32;
+ a |= (uint)hi;
+ c = a / divider;
+ a -= c * divider;
+ a <<= 32;
+ hi = b << 32 | (uint)c;
+
+ a |= (uint)(lo >> 32);
+ b = a / divider;
+ a -= b * divider;
+ a <<= 32;
+ a |= (uint)lo;
+ c = a / divider;
+ a -= c * divider;
+ lo = b << 32 | (uint)c;
+ rest = (uint)a;
+ a <<= 1;
+
+ return (a > divider || (a == divider && (c & 1) == 1)) ? 1 : 0;
+
+ }
+
+ [MonoTODO("Find out what is the right way to set scale and precision")]
+ private static SqlDecimal DecimalDiv (SqlDecimal x, SqlDecimal y)
+ {
+ ulong lo = 0;
+ ulong hi = 0;
+ int sc = 0; // scale
+ int texp = 0;
+ int rc = 0;
+ byte prec = 0; // precision
+
+ prec = x.Precision >= y.Precision ? x.Precision : y.Precision;
+ DecimalDivSub (ref x, ref y, ref lo, ref hi, ref texp);
+
+ sc = x.Scale - y.Scale;
+
+ Rescale128 (ref lo, ref hi, ref sc, texp, 0, 38, 1);
+
+ uint r = 0;
+ while (prec < sc) {
+ Div128By32(ref hi, ref lo, 10, ref r);
+ sc--;
+ }
+
+ if (r >= 5)
+ lo++;
+
+ while ((((double)hi) * Math.Pow(2,64) + lo) - Math.Pow (10, prec) > 0)
+ prec++;
+
+ while ((prec + sc) > MaxScale) {
+ Div128By32(ref hi, ref lo, 10, ref r);
+ sc--;
+ if (r >= 5)
+ lo++;
+ }
+
+ int resultLo = (int)lo;
+ int resultMi = (int)(lo >> 32);
+ int resultMi2 = (int)(hi);
+ int resultHi = (int)(hi >> 32);
+
+ return new SqlDecimal (prec, (byte)sc, true, resultLo,
+ resultMi, resultMi2,
+ resultHi);
+ }
+
+ // From decimal.c
+ private static void Rescale128 (ref ulong clo, ref ulong chi,
+ ref int scale, int texp,
+ int minScale, int maxScale,
+ int roundFlag)
+ {
+ uint factor = 0;
+ uint overhang = 0;
+ int sc = 0;
+ int i = 0;
+ int rc = 0;
+ int roundBit = 0;
+
+ sc = scale;
+ if (texp > 0) {
+
+ // reduce exp
+ while (texp > 0 && sc <= maxScale) {
+
+ overhang = (uint)(chi >> 64);
+ while (texp > 0 && (((clo & 1) == 0) || overhang > 0)) {
+
+ if (--texp == 0)
+ roundBit = (int)(clo & 1);
+ RShift128 (ref clo, ref chi);
+
+ overhang = (uint)(chi >> 32);
+ }
+
+ if (texp > DECIMAL_MAX_INTFACTORS)
+ i = DECIMAL_MAX_INTFACTORS;
+ else
+ i = texp;
+
+ if (sc + i > maxScale)
+ i = maxScale - sc;
+
+ if (i == 0)
+ break;
+
+ texp -= i;
+ sc += i;
+
+ // 10^i/2^i=5^i
+ factor = constantsDecadeInt32Factors [i] >> i;
+ System.Console.WriteLine ("***");
+ Mult128By32 (ref clo, ref chi, factor, 0);
+ System.Console.WriteLine ((((double)chi) * Math.Pow (2,64) + clo));
+
+ }
+
+ while (texp > 0) {
+ if (--texp == 0)
+ roundBit = (int)(clo & 1);
+ RShift128 (ref clo, ref chi);
+ }
+ }
+
+ while (sc > maxScale) {
+ i = scale - maxScale;
+ if (i > DECIMAL_MAX_INTFACTORS)
+ i = DECIMAL_MAX_INTFACTORS;
+ sc -= i;
+ roundBit = Div128By32 (ref clo, ref chi,
+ constantsDecadeInt32Factors[i]);
+ }
+
+ while (sc < minScale) {
+ if (roundFlag == 0)
+ roundBit = 0;
+ i = minScale - sc;
+ if (i > DECIMAL_MAX_INTFACTORS)
+ i = DECIMAL_MAX_INTFACTORS;
+ sc += i;
+ Mult128By32 (ref clo, ref chi,
+ constantsDecadeInt32Factors[i], roundBit);
+ roundBit = 0;
+ }
+ scale = sc;
+ Normalize128 (ref clo, ref chi, ref sc, roundFlag, roundBit);
+ }
+
+ // From decimal.c
+ private static void Normalize128(ref ulong clo, ref ulong chi, ref int scale, int roundFlag, int roundBit)
+ {
+ int sc = scale;
+ int deltaScale;
+
+ scale = sc;
+ if ((roundFlag != 0) && (roundBit != 0))
+ RoundUp128 (ref clo, ref chi);
+ }
+
+ // From decimal.c
+ private static void RoundUp128(ref ulong lo, ref ulong hi)
+ {
+ if ((++lo) == 0)
+ ++hi;
+ }
+
+ // From decimal.c
+ private static void DecimalDivSub (ref SqlDecimal x, ref SqlDecimal y, ref ulong clo, ref ulong chi, ref int exp)
+ {
+ ulong xlo, xmi, xhi;
+ ulong tlo = 0;
+ ulong tmi = 0;
+ ulong thi = 0;;
+ uint ylo = 0;
+ uint ymi = 0;
+ uint ymi2 = 0;
+ uint yhi = 0;
+ int ashift = 0;
+ int bshift = 0;
+ int extraBit = 0;
+
+ xhi = (ulong)((ulong)x.Data [3] << 32) | (ulong)x.Data [2];
+ xmi = (ulong)((ulong)x.Data [1] << 32) | (ulong)x.Data [0];
+ xlo = (uint)0;
+ ylo = (uint)y.Data [0];
+ ymi = (uint)y.Data [1];
+ ymi2 = (uint)y.Data [2];
+ yhi = (uint)y.Data [3];
+
+ if (ylo == 0 && ymi == 0 && ymi2 == 0 && yhi == 0)
+ throw new DivideByZeroException ();
+
+ if (xmi == 0 && xhi == 0) {
+ clo = chi = 0;
+ return;
+ }
+
+ // enlarge dividend to get maximal precision
+ for (ashift = 0; (xhi & LIT_GUINT64_HIGHBIT) == 0; ++ashift)
+ LShift128 (ref xmi, ref xhi);
+
+ // ensure that divisor is at least 2^95
+ for (bshift = 0; (yhi & LIT_GUINT32_HIGHBIT) == 0; ++bshift)
+ LShift128 (ref ylo, ref ymi, ref ymi2, ref yhi);
+
+ thi = ((ulong)yhi) << 32 | (ulong)ymi2;
+ tmi = ((ulong)ymi) << 32 | (ulong)ylo;
+ tlo = 0;
+
+ if (xhi > thi || (xhi == thi && xmi >=tmi)) {
+ Sub192(xlo, xmi, xhi, tlo, tmi, thi, ref xlo, ref xmi, ref xhi);
+ extraBit = 1;
+ } else {
+ extraBit = 0;
+ }
+
+ Div192By128To128 (xlo, xmi, xhi, ylo, ymi, ymi2, yhi, ref clo, ref chi);
+
+ exp = 128 + ashift - bshift;
+
+ if (extraBit != 0) {
+ RShift128 (ref clo, ref chi);
+ chi += LIT_GUINT64_HIGHBIT;
+ exp--;
+ }
+
+ // try loss free right shift
+ while (exp > 0 && (clo & 1) == 0) {
+ RShift128 (ref clo, ref chi);
+ exp--;
+ }
+ }
+
+ // From decimal.c
+ private static void RShift192(ref ulong lo, ref ulong mi, ref ulong hi)
+ {
+
+ lo >>= 1;
+ if ((mi & 1) != 0)
+ lo |= LIT_GUINT64_HIGHBIT;
+
+ mi >>= 1;
+ if ((hi & 1) != 0)
+ mi |= LIT_GUINT64_HIGHBIT;
+
+ hi >>= 1;
+ }
+
+ // From decimal.c
+ private static void RShift128(ref ulong lo, ref ulong hi)
+ {
+ lo >>=1;
+ if ((hi & 1) != 0)
+ lo |= LIT_GUINT64_HIGHBIT;
+ hi >>= 1;
+ }
+
+ // From decimal.c
+ private static void LShift128(ref ulong lo, ref ulong hi)
+ {
+ hi <<= 1;
+
+ if ((lo & LIT_GUINT64_HIGHBIT) != 0)
+ hi++;
+
+ lo <<= 1;
+ }
+
+ // From decimal.c
+ private static void LShift128(ref uint lo, ref uint mi, ref uint mi2, ref uint hi)
+ {
+ hi <<= 1;
+ if ((mi2 & LIT_GUINT32_HIGHBIT) != 0)
+ hi++;
+
+ mi2 <<= 1;
+ if ((mi & LIT_GUINT32_HIGHBIT) != 0)
+ mi2++;
+
+ mi <<= 1;
+ if ((lo & LIT_GUINT32_HIGHBIT) != 0)
+ mi++;
+
+ lo <<= 1;
+ }
+
+ // From decimal.c
+ private static void Div192By128To128 (ulong xlo, ulong xmi, ulong xhi,
+ uint ylo, uint ymi, uint ymi2,
+ uint yhi, ref ulong clo, ref ulong chi)
+ {
+ ulong rlo, rmi, rhi; // remainders
+ uint h, c;
+
+ rlo = xlo;
+ rmi = xmi;
+ rhi = xhi;
+
+ h = Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
+
+ // mid 32 bit
+ rhi = (rhi << 32) | (rmi >> 32);
+ rmi = (rmi << 32) | (rlo >> 32);
+ rlo <<= 32;
+
+ chi = (((ulong)h) << 32) | Div192By128To32WithRest (
+ ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
+
+ // low 32 bit
+ rhi = (rhi << 32) | (rmi >> 32);
+ rmi = (rmi << 32) | (rlo >> 32);
+ rlo <<= 32;
+
+ h = Div192By128To32WithRest (ref rlo, ref rmi, ref rhi,
+ ylo, ymi, ymi2, yhi);
+
+ // estimate lowest 32 bit (two last bits may be wrong)
+ if (rhi >= yhi)
+ c = 0xFFFFFFFF;
+ else {
+ rhi <<= 32;
+ c = (uint)(rhi / yhi);
+ }
+
+ clo = (((ulong)h) << 32) | c;
+ }
+
+ // From decimal.c
+ private static uint Div192By128To32WithRest(ref ulong xlo, ref ulong xmi,
+ ref ulong xhi, uint ylo,
+ uint ymi, uint ymi2, uint yhi)
+ {
+ ulong rlo, rmi, rhi; // remainder
+ ulong tlo = 0;
+ ulong thi = 0;
+ uint c;
+
+ rlo = xlo;
+ rmi = xmi;
+ rhi = xhi;
+
+ if (rhi >= (((ulong)yhi << 32)))
+ c = 0xFFFFFFFF;
+ else
+ c = (uint) (rhi / yhi);
+
+ Mult128By32To128 (ylo, ymi, ymi2, yhi, c, ref tlo, ref thi);
+ Sub192 (rlo, rmi, rhi, 0, tlo, thi, ref rlo, ref rmi, ref rhi);
+
+ while (((long)rhi) < 0) {
+ c--;
+ Add192 (rlo, rmi, rhi, 0, (((ulong)ymi) << 32) | ylo, yhi | ymi2, ref rlo, ref rmi, ref rhi);
+ }
+ xlo = rlo;
+ xmi = rmi;
+ xhi = rhi;
+
+ return c;
+ }
+
+ // From decimal.c
+ private static void Mult192By32 (ref ulong clo, ref ulong cmi, ref ulong chi, ulong factor, int roundBit)
+ {
+ ulong a = 0;
+ uint h0 = 0;
+ uint h1 = 0;
+ uint h2 = 0;
+
+ a = ((ulong)(uint)clo) * factor;
+
+ if (roundBit != 0)
+ a += factor / 2;
+
+ h0 = (uint)a;
+ a >>= 32;
+ a += (clo >> 32) * factor;
+ h1 = (uint)a;
+
+ clo = ((ulong)h1) << 32 | h0;
+
+ a >>= 32;
+ a += ((ulong)(uint)cmi) * factor;
+ h0 = (uint)a;
+
+ a >>= 32;
+ a += (cmi >> 32) * factor;
+ h1 = (uint)a;
+
+ cmi = ((ulong)h1) << 32 | h0;
+ a >>= 32;
+ a += ((ulong)(uint)chi) * factor;
+ h0 = (uint)a;
+
+ a >>= 32;
+ a += (chi >> 32) * factor;
+ h1 = (uint)a;
+ chi = ((ulong)h1) << 32 | h0;
+ }
+
+ // From decimal.c
+ private static void Mult128By32 (ref ulong clo, ref ulong chi, uint factor, int roundBit)
+ {
+ ulong a = 0;
+ uint h0 = 0;
+ uint h1 = 0;
+ uint h2 = 0;
+
+ a = ((ulong)(uint)clo) * factor;
+
+ if (roundBit != 0)
+ a += factor / 2;
+
+ h0 = (uint)a;
+
+ a >>= 32;
+ a += (clo >> 32) * factor;
+ h1 = (uint)a;
+
+ clo = ((ulong)h1) << 32 | h0;
+
+ a >>= 32;
+ a += ((ulong)(uint)chi) * factor;
+ h0 = (uint)a;
+
+ a >>= 32;
+ a += (chi >> 32) * factor;
+ h1 = (uint)a;
+
+ chi = ((ulong)h1) << 32 | h0;
+ }
+
+
+ // From decimal.c
+ private static void Mult128By32To128(uint xlo, uint xmi, uint xmi2, uint xhi,
+ uint factor, ref ulong clo, ref ulong chi)
+ {
+ ulong a;
+ uint h0, h1, h2;
+
+ a = ((ulong)xlo) * factor;
+ h0 = (uint)a;
+
+ a >>= 32;
+ a += ((ulong)xmi) * factor;
+ h1 = (uint)a;
+
+ a >>= 32;
+ a += ((ulong)xmi2) * factor;
+ h2 = (uint)a;
+
+ a >>= 32;
+ a += ((ulong)xhi) * factor;
+
+ clo = ((ulong)h1) << 32 | h0;
+ chi = a | h2;
+ }
+
+ // From decimal.c
+ private static void Add192 (ulong xlo, ulong xmi, ulong xhi,
+ ulong ylo, ulong ymi, ulong yhi,
+ ref ulong clo, ref ulong cmi, ref ulong chi)
+ {
+ xlo += ylo;
+ if (xlo < ylo) {
+ xmi++;
+ if (xmi == 0)
+ xhi++;
+ }
+
+ xmi += ymi;
+
+ if (xmi < ymi)
+ xmi++;
+
+ xhi += yhi;
+ clo = xlo;
+ cmi = xmi;
+ chi = xhi;
+ }
+
+ // From decimal.c
+ private static void Sub192 (ulong xlo, ulong xmi, ulong xhi,
+ ulong ylo, ulong ymi, ulong yhi,
+ ref ulong lo, ref ulong mi, ref ulong hi)
+ {
+
+ ulong clo = 0;
+ ulong cmi = 0;
+ ulong chi = 0;
+
+ clo = xlo - ylo;
+ cmi = xmi - ymi;
+ chi = xhi - yhi;
+
+ if (xlo < ylo) {
+ if (cmi == 0)
+ chi--;
+ cmi--;
+ }
+
+ if (xmi < ymi)
+ chi--;
+
+ lo = clo;
+ mi = cmi;
+ hi = chi;
+ }
+
+ public static SqlDecimal Truncate (SqlDecimal n, int position)
+ {
+ int prec = n.Precision;// + (position - n.Scale);
+ int sc = position;
+ return new SqlDecimal ((byte)prec, (byte)sc,
+ n.IsPositive, n.Data);
+ }
+
+ public static SqlDecimal operator + (SqlDecimal x, SqlDecimal y)
+ {
+ // if one of them is negative, perform subtraction
+ if (x.IsPositive && !y.IsPositive) return x - y;
+ if (y.IsPositive && !x.IsPositive) return y - x;
+
+ // adjust the scale to the smaller of the two beforehand
+ if (x.Scale > y.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ // set the precision to the greater of the two
+ byte resultPrecision;
+ if (x.Precision > y.Precision)
+ resultPrecision = x.Precision;
+ else
+ resultPrecision = y.Precision;
+
+ int[] xData = x.Data;
+ int[] yData = y.Data;
+ int[] resultBits = new int[4];
+
+ ulong res;
+ ulong carry = 0;
+
+ // add one at a time, and carry the results over to the next
+ for (int i = 0; i < 4; i +=1)
+ {
+ carry = 0;
+ res = (ulong)(xData[i]) + (ulong)(yData[i]) + carry;
+ if (res > Int32.MaxValue)
+ {
+ carry = res - Int32.MaxValue;
+ res = Int32.MaxValue;
+ }
+ resultBits [i] = (int)res;
+ }
+
+ // if we have carry left, then throw an exception
+ if (carry > 0)
+ throw new OverflowException ();
+ else
+ return new SqlDecimal (resultPrecision, x.Scale, x.IsPositive, resultBits);
+ }
+
+ public static SqlDecimal operator / (SqlDecimal x, SqlDecimal y)
+ {
+ // return new SqlDecimal (x.Value / y.Value);
+ return DecimalDiv (x, y);
+ }
+
+ public static SqlBoolean operator == (SqlDecimal x, SqlDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, false);
+ else if (y.Scale > x.Scale)
+ x = SqlDecimal.AdjustScale(y, y.Scale - x.Scale, false);
+
+ for (int i = 0; i < 4; i += 1)
+ {
+ if (x.Data[i] != y.Data[i])
+ return new SqlBoolean (false);
+ }
+ return new SqlBoolean (true);
+ }
+
+ public static SqlBoolean operator > (SqlDecimal x, SqlDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, false);
+ else if (y.Scale > x.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, false);
+
+ for (int i = 3; i >= 0; i--)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new SqlBoolean (x.Data[i] > y.Data[i]);
+ }
+ return new SqlBoolean (false);
+ }
+
+ public static SqlBoolean operator >= (SqlDecimal x, SqlDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+ else if (y.Scale > x.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new SqlBoolean (x.Data[i] >= y.Data[i]);
+ }
+ return new SqlBoolean (true);
+ }
+
+ public static SqlBoolean operator != (SqlDecimal x, SqlDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ for (int i = 0; i < 4; i += 1)
+ {
+ if (x.Data[i] != y.Data[i])
+ return new SqlBoolean (true);
+ }
+ return new SqlBoolean (false);
+ }
+
+ public static SqlBoolean operator < (SqlDecimal x, SqlDecimal y)
+ {
+
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+ else if (y.Scale > x.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+
+ return new SqlBoolean (x.Data[i] < y.Data[i]);
+ }
+ return new SqlBoolean (false);
+
+ }
+
+ public static SqlBoolean operator <= (SqlDecimal x, SqlDecimal y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Scale > y.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+ else if (y.Scale > x.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+
+ for (int i = 3; i >= 0; i -= 1)
+ {
+ if (x.Data[i] == 0 && y.Data[i] == 0)
+ continue;
+ else
+ return new SqlBoolean (x.Data[i] <= y.Data[i]);
+ }
+ return new SqlBoolean (true);
+ }
+
+ public static SqlDecimal operator * (SqlDecimal x, SqlDecimal y)
+ {
+ // adjust the scale to the smaller of the two beforehand
+ if (x.Scale > y.Scale)
+ x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);
+ else if (y.Scale > x.Scale)
+ y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);
+
+ // set the precision to the greater of the two
+ byte resultPrecision;
+ if (x.Precision > y.Precision)
+ resultPrecision = x.Precision;
+ else
+ resultPrecision = y.Precision;
+
+ int[] xData = x.Data;
+ int[] yData = y.Data;
+ int[] resultBits = new int[4];
+
+ ulong res;
+ ulong carry = 0;
+
+ // multiply one at a time, and carry the results over to the next
+ for (int i = 0; i < 4; i +=1)
+ {
+ carry = 0;
+ res = (ulong)(xData[i]) * (ulong)(yData[i]) + carry;
+ if (res > Int32.MaxValue)
+ {
+ carry = res - Int32.MaxValue;
+ res = Int32.MaxValue;
+ }
+ resultBits [i] = (int)res;
+ }
+
+ // if we have carry left, then throw an exception
+ if (carry > 0)
+ throw new OverflowException ();
+ else
+ return new SqlDecimal (resultPrecision, x.Scale, (x.IsPositive == y.IsPositive), resultBits);
+
+ }
+
+ public static SqlDecimal operator - (SqlDecimal x, SqlDecimal y)
+ {
+ if (x.IsPositive && !y.IsPositive) return x + y;
+ if (!x.IsPositive && y.IsPositive) return -(x + y);
+ if (!x.IsPositive && !y.IsPositive) return y - x;
+
+ // otherwise, x is positive and y is positive
+ bool resultPositive = (bool)(x > y);
+ int[] yData = y.Data;
+
+ for (int i = 0; i < 4; i += 1) yData[i] = -yData[i];
+
+ SqlDecimal yInverse = new SqlDecimal (y.Precision, y.Scale, y.IsPositive, yData);
+
+ if (resultPositive)
+ return x + yInverse;
+ else
+ return -(x + yInverse);
+ }
+
+ public static SqlDecimal operator - (SqlDecimal n)
+ {
+ return new SqlDecimal (n.Precision, n.Scale, !n.IsPositive, n.Data);
+ }
+
+ public static explicit operator SqlDecimal (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.ByteValue);
+ }
+
+ public static explicit operator Decimal (SqlDecimal n)
+ {
+ return n.Value;
+ }
+
+ public static explicit operator SqlDecimal (SqlDouble x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+ }
+
+ public static explicit operator SqlDecimal (SqlSingle x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+ }
+
+ public static explicit operator SqlDecimal (SqlString x)
+ {
+ checked {
+ return Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlDecimal (decimal x)
+ {
+ return new SqlDecimal (x);
+ }
+
+ public static implicit operator SqlDecimal (SqlByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlDecimal (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlDecimal (SqlInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlDecimal (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlDecimal (SqlMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDecimal ((decimal)x.Value);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs
new file mode 100644
index 00000000000..1194898b6b7
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlDouble.cs
@@ -0,0 +1,362 @@
+//
+// System.Data.SqlTypes.SqlDouble
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlDouble : INullable, IComparable
+ {
+ #region Fields
+ double value;
+
+ private bool notNull;
+
+ public static readonly SqlDouble MaxValue = new SqlDouble (1.7976931348623157E+308);
+ public static readonly SqlDouble MinValue = new SqlDouble (-1.7976931348623157E+308);
+ public static readonly SqlDouble Null;
+ public static readonly SqlDouble Zero = new SqlDouble (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlDouble (double value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public double Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlDouble Add (SqlDouble x, SqlDouble y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlDouble))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlDouble"));
+ else if (((SqlDouble)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlDouble)value).Value);
+ }
+
+ public static SqlDouble Divide (SqlDouble x, SqlDouble y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlDouble))
+ return false;
+ if (this.IsNull && ((SqlDouble)value).IsNull)
+ return true;
+ else if (((SqlDouble)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlDouble)value);
+ }
+
+ public static SqlBoolean Equals (SqlDouble x, SqlDouble y)
+ {
+ return (x == y);
+ }
+ public override int GetHashCode ()
+ {
+ long LongValue = (long)value;
+ return (int)(LongValue ^ (LongValue >> 32));
+
+ }
+
+ public static SqlBoolean GreaterThan (SqlDouble x, SqlDouble y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlDouble x, SqlDouble y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlDouble x, SqlDouble y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlDouble x, SqlDouble y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlDouble Multiply (SqlDouble x, SqlDouble y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlDouble x, SqlDouble y)
+ {
+ return (x != y);
+ }
+
+ public static SqlDouble Parse (string s)
+ {
+ return new SqlDouble (Double.Parse (s));
+ }
+
+ public static SqlDouble Subtract (SqlDouble x, SqlDouble y)
+ {
+ return (x - y);
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte ()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDecimal ToSqlDecimal ()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlInt16 ToSqlInt16 ()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64 ()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney ()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle ()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SqlDouble operator + (SqlDouble x, SqlDouble y)
+ {
+ checked {
+ return new SqlDouble (x.Value + y.Value);
+ }
+ }
+
+ public static SqlDouble operator / (SqlDouble x, SqlDouble y)
+ {
+ checked {
+ return new SqlDouble (x.Value / y.Value);
+ }
+ }
+
+ public static SqlBoolean operator == (SqlDouble x, SqlDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlBoolean operator > (SqlDouble x, SqlDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlDouble x, SqlDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlDouble x, SqlDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlDouble x, SqlDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlDouble x, SqlDouble y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlDouble operator * (SqlDouble x, SqlDouble y)
+ {
+ checked {
+ return new SqlDouble (x.Value * y.Value);
+ }
+ }
+
+ public static SqlDouble operator - (SqlDouble x, SqlDouble y)
+ {
+ checked {
+ return new SqlDouble (x.Value - y.Value);
+ }
+ }
+
+ public static SqlDouble operator - (SqlDouble n)
+ {
+ return new SqlDouble (-(n.Value));
+ }
+
+ public static explicit operator SqlDouble (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.ByteValue);
+ }
+
+ public static explicit operator double (SqlDouble x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlDouble (SqlString x)
+ {
+ checked {
+ return SqlDouble.Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlDouble (double x)
+ {
+ return new SqlDouble (x);
+ }
+
+ public static implicit operator SqlDouble (SqlByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.Value);
+ }
+
+ public static implicit operator SqlDouble (SqlDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble (x.ToDouble ());
+ }
+
+ public static implicit operator SqlDouble (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.Value);
+ }
+
+ public static implicit operator SqlDouble (SqlInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.Value);
+ }
+
+ public static implicit operator SqlDouble (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.Value);
+ }
+
+ public static implicit operator SqlDouble (SqlMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.Value);
+ }
+
+ public static implicit operator SqlDouble (SqlSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlDouble ((double)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlGuid.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlGuid.cs
new file mode 100644
index 00000000000..93c124c2589
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlGuid.cs
@@ -0,0 +1,250 @@
+//
+// System.Data.SqlTypes.SqlGuid
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlGuid : INullable, IComparable
+ {
+ #region Fields
+
+ Guid value;
+
+ private bool notNull;
+
+ public static readonly SqlGuid Null;
+
+ #endregion
+
+ #region Constructors
+
+ public SqlGuid (byte[] value)
+ {
+ this.value = new Guid (value);
+ notNull = true;
+ }
+
+ public SqlGuid (Guid g)
+ {
+ this.value = g;
+ notNull = true;
+ }
+
+ public SqlGuid (string s)
+ {
+ this.value = new Guid (s);
+ notNull = true;
+ }
+
+ public SqlGuid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
+ {
+ this.value = new Guid (a, b, c, d, e, f, g, h, i, j, k);
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public Guid Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ("The property contains Null.");
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlGuid))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlGuid"));
+ else if (((SqlGuid)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlGuid)value).Value);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlGuid))
+ return false;
+ else if (this.IsNull && ((SqlGuid)value).IsNull)
+ return true;
+ else if (((SqlGuid)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlGuid)value);
+ }
+
+ public static SqlBoolean Equals (SqlGuid x, SqlGuid y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ byte [] bytes = this.ToByteArray ();
+
+ int result = 10;
+ foreach (byte b in bytes) {
+ result = 91 * result + b.GetHashCode ();
+ }
+
+ return result;
+ }
+
+ public static SqlBoolean GreaterThan (SqlGuid x, SqlGuid y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlGuid x, SqlGuid y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlGuid x, SqlGuid y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlGuid x, SqlGuid y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlBoolean NotEquals (SqlGuid x, SqlGuid y)
+ {
+ return (x != y);
+ }
+
+ public static SqlGuid Parse (string s)
+ {
+ return new SqlGuid (s);
+ }
+
+ public byte[] ToByteArray()
+ {
+ return value.ToByteArray ();
+ }
+
+ public SqlBinary ToSqlBinary ()
+ {
+ return ((SqlBinary)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SqlBoolean operator == (SqlGuid x, SqlGuid y)
+ {
+ if (x.IsNull || y.IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlBoolean operator > (SqlGuid x, SqlGuid y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Value.CompareTo (y.Value) > 0)
+ return new SqlBoolean (true);
+ else
+ return new SqlBoolean (false);
+ }
+
+ public static SqlBoolean operator >= (SqlGuid x, SqlGuid y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Value.CompareTo (y.Value) >= 0)
+ return new SqlBoolean (true);
+ else
+ return new SqlBoolean (false);
+
+ }
+
+ public static SqlBoolean operator != (SqlGuid x, SqlGuid y)
+ {
+ if (x.IsNull || y.IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlGuid x, SqlGuid y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Value.CompareTo (y.Value) < 0)
+ return new SqlBoolean (true);
+ else
+ return new SqlBoolean (false);
+
+ }
+
+ public static SqlBoolean operator <= (SqlGuid x, SqlGuid y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+
+ if (x.Value.CompareTo (y.Value) <= 0)
+ return new SqlBoolean (true);
+ else
+ return new SqlBoolean (false);
+ }
+
+ public static explicit operator SqlGuid (SqlBinary x)
+ {
+ return new SqlGuid (x.Value);
+ }
+
+ public static explicit operator Guid (SqlGuid x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlGuid (SqlString x)
+ {
+ return new SqlGuid (x.Value);
+ }
+
+ public static implicit operator SqlGuid (Guid x)
+ {
+ return new SqlGuid (x);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlInt16.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt16.cs
new file mode 100644
index 00000000000..79325214d40
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt16.cs
@@ -0,0 +1,433 @@
+//
+// System.Data.SqlTypes.SqlInt16
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlInt16 : INullable, IComparable
+ {
+ #region Fields
+
+ short value;
+ private bool notNull;
+
+ public static readonly SqlInt16 MaxValue = new SqlInt16 (32767);
+ public static readonly SqlInt16 MinValue = new SqlInt16 (-32768);
+ public static readonly SqlInt16 Null;
+ public static readonly SqlInt16 Zero = new SqlInt16 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlInt16 (short value)
+ {
+ this.value = value;
+ notNull = true;;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public short Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlInt16 Add (SqlInt16 x, SqlInt16 y)
+ {
+ return (x + y);
+ }
+
+ public static SqlInt16 BitwiseAnd (SqlInt16 x, SqlInt16 y)
+ {
+ return (x & y);
+ }
+
+ public static SqlInt16 BitwiseOr (SqlInt16 x, SqlInt16 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlInt16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlInt16"));
+ else if (((SqlInt16)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlInt16)value).Value);
+ }
+
+ public static SqlInt16 Divide (SqlInt16 x, SqlInt16 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlInt16))
+ return false;
+ else if (this.IsNull && ((SqlInt16)value).IsNull)
+ return true;
+ else if (((SqlInt16)value).IsNull)
+ return false;
+ else
+ return (bool)(this == (SqlInt16)value);
+ }
+
+ public static SqlBoolean Equals (SqlInt16 x, SqlInt16 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static SqlBoolean GreaterThan (SqlInt16 x, SqlInt16 y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlInt16 x, SqlInt16 y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlInt16 x, SqlInt16 y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlInt16 x, SqlInt16 y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlInt16 Mod (SqlInt16 x, SqlInt16 y)
+ {
+ return (x % y);
+ }
+
+ public static SqlInt16 Multiply (SqlInt16 x, SqlInt16 y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlInt16 x, SqlInt16 y)
+ {
+ return (x != y);
+ }
+
+ public static SqlInt16 OnesComplement (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+
+ return ~x;
+ }
+
+ public static SqlInt16 Parse (string s)
+ {
+ checked {
+ return new SqlInt16 (Int16.Parse (s));
+ }
+ }
+
+ public static SqlInt16 Subtract (SqlInt16 x, SqlInt16 y)
+ {
+ return (x - y);
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte ()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDecimal ToSqlDecimal ()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble ()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64 ()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney ()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle ()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static SqlInt16 Xor (SqlInt16 x, SqlInt16 y)
+ {
+ return (x ^ y);
+ }
+
+ public static SqlInt16 operator + (SqlInt16 x, SqlInt16 y)
+ {
+ checked {
+ return new SqlInt16 ((short) (x.Value + y.Value));
+ }
+ }
+
+ public static SqlInt16 operator & (SqlInt16 x, SqlInt16 y)
+ {
+ return new SqlInt16 ((short) (x.value & y.Value));
+ }
+
+ public static SqlInt16 operator | (SqlInt16 x, SqlInt16 y)
+ {
+ return new SqlInt16 ((short) ((byte) x.Value | (byte) y.Value));
+ }
+
+ public static SqlInt16 operator / (SqlInt16 x, SqlInt16 y)
+ {
+ checked {
+ return new SqlInt16 ((short) (x.Value / y.Value));
+ }
+ }
+
+ public static SqlBoolean operator == (SqlInt16 x, SqlInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlInt16 operator ^ (SqlInt16 x, SqlInt16 y)
+ {
+ return new SqlInt16 ((short) (x.Value ^ y.Value));
+ }
+
+ public static SqlBoolean operator > (SqlInt16 x, SqlInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlInt16 x, SqlInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlInt16 x, SqlInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlInt16 x, SqlInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlInt16 x, SqlInt16 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlInt16 operator % (SqlInt16 x, SqlInt16 y)
+ {
+ return new SqlInt16 ((short) (x.Value % y.Value));
+ }
+
+ public static SqlInt16 operator * (SqlInt16 x, SqlInt16 y)
+ {
+ checked {
+ return new SqlInt16 ((short) (x.Value * y.Value));
+ }
+ }
+
+ public static SqlInt16 operator ~ (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+
+ return new SqlInt16 ((short) (~x.Value));
+ }
+
+ public static SqlInt16 operator - (SqlInt16 x, SqlInt16 y)
+ {
+ checked {
+ return new SqlInt16 ((short) (x.Value - y.Value));
+ }
+ }
+
+ public static SqlInt16 operator - (SqlInt16 n)
+ {
+ checked {
+ return new SqlInt16 ((short) (-n.Value));
+ }
+ }
+
+ public static explicit operator SqlInt16 (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 ((short)x.ByteValue);
+ }
+
+ public static explicit operator SqlInt16 (SqlDecimal x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 ((short)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt16 (SqlDouble x)
+ {
+ // checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 (checked ((short)x.Value));
+ //}
+ }
+
+ public static explicit operator short (SqlInt16 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlInt16 (SqlInt32 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 ((short)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt16 (SqlInt64 x)
+ {
+ //checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 ((short)x.Value);
+ // }
+ }
+
+ public static explicit operator SqlInt16 (SqlMoney x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 ((short)x.Value);
+ }
+ }
+
+
+ public static explicit operator SqlInt16 (SqlSingle x)
+ {
+ // FIXME
+ //checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt16 ((short)x.Value);
+ //}
+ }
+
+ public static explicit operator SqlInt16 (SqlString x)
+ {
+ if (x.IsNull)
+ return Null;
+
+ return SqlInt16.Parse (x.Value);
+ }
+
+ public static implicit operator SqlInt16 (short x)
+ {
+ return new SqlInt16 (x);
+ }
+
+ public static implicit operator SqlInt16 (SqlByte x)
+ {
+ return new SqlInt16 ((short)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs
new file mode 100644
index 00000000000..1db4d96b2ee
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs
@@ -0,0 +1,451 @@
+//
+// System.Data.SqlTypes.SqlInt32
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ximian, Inc. 2002
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+
+ /// <summary>
+ /// a 32-bit signed integer to be used in reading or writing
+ /// of data from a database
+ /// </summary>
+ public struct SqlInt32 : INullable, IComparable
+ {
+ #region Fields
+
+ int value;
+ private bool notNull;
+
+ public static readonly SqlInt32 MaxValue = new SqlInt32 (2147483647);
+ public static readonly SqlInt32 MinValue = new SqlInt32 (-2147483648);
+ public static readonly SqlInt32 Null;
+ public static readonly SqlInt32 Zero = new SqlInt32 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlInt32(int value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public int Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlInt32 Add (SqlInt32 x, SqlInt32 y)
+ {
+ return (x + y);
+ }
+
+ public static SqlInt32 BitwiseAnd(SqlInt32 x, SqlInt32 y)
+ {
+ return (x & y);
+ }
+
+ public static SqlInt32 BitwiseOr(SqlInt32 x, SqlInt32 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo(object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlInt32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlInt32"));
+ else if (((SqlInt32)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlInt32)value).Value);
+ }
+
+ public static SqlInt32 Divide(SqlInt32 x, SqlInt32 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is SqlInt32))
+ return false;
+ else if (this.IsNull && ((SqlInt32)value).IsNull)
+ return true;
+ else if (((SqlInt32)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlInt32)value);
+ }
+
+ public static SqlBoolean Equals(SqlInt32 x, SqlInt32 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ return value;
+ }
+
+ public static SqlBoolean GreaterThan (SqlInt32 x, SqlInt32 y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlInt32 x, SqlInt32 y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan(SqlInt32 x, SqlInt32 y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual(SqlInt32 x, SqlInt32 y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlInt32 Mod(SqlInt32 x, SqlInt32 y)
+ {
+ return (x % y);
+ }
+
+ public static SqlInt32 Multiply(SqlInt32 x, SqlInt32 y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals(SqlInt32 x, SqlInt32 y)
+ {
+ return (x != y);
+ }
+
+ public static SqlInt32 OnesComplement(SqlInt32 x)
+ {
+ return ~x;
+ }
+
+ public static SqlInt32 Parse(string s)
+ {
+ return new SqlInt32 (Int32.Parse (s));
+ }
+
+ public static SqlInt32 Subtract(SqlInt32 x, SqlInt32 y)
+ {
+ return (x - y);
+ }
+
+ public SqlBoolean ToSqlBoolean()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDecimal ToSqlDecimal()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt64 ToSqlInt64()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString()
+ {
+ if (this.IsNull)
+ return "Null";
+ else
+ return value.ToString ();
+ }
+
+ public static SqlInt32 Xor(SqlInt32 x, SqlInt32 y)
+ {
+ return (x ^ y);
+ }
+
+ #endregion
+
+ #region Operators
+
+ // Compute Addition
+ public static SqlInt32 operator + (SqlInt32 x, SqlInt32 y)
+ {
+ checked {
+ return new SqlInt32 (x.Value + y.Value);
+ }
+ }
+
+ // Bitwise AND
+ public static SqlInt32 operator & (SqlInt32 x, SqlInt32 y)
+ {
+ return new SqlInt32 (x.Value & y.Value);
+ }
+
+ // Bitwise OR
+ public static SqlInt32 operator | (SqlInt32 x, SqlInt32 y)
+ {
+ checked {
+ return new SqlInt32 (x.Value | y.Value);
+ }
+ }
+
+ // Compute Division
+ public static SqlInt32 operator / (SqlInt32 x, SqlInt32 y)
+ {
+ checked {
+ return new SqlInt32 (x.Value / y.Value);
+ }
+ }
+
+ // Compare Equality
+ public static SqlBoolean operator == (SqlInt32 x, SqlInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ // Bitwise Exclusive-OR (XOR)
+ public static SqlInt32 operator ^ (SqlInt32 x, SqlInt32 y)
+ {
+ return new SqlInt32 (x.Value ^ y.Value);
+ }
+
+ // > Compare
+ public static SqlBoolean operator >(SqlInt32 x, SqlInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ // >= Compare
+ public static SqlBoolean operator >= (SqlInt32 x, SqlInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ // != Inequality Compare
+ public static SqlBoolean operator != (SqlInt32 x, SqlInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value != y.Value);
+ }
+
+ // < Compare
+ public static SqlBoolean operator < (SqlInt32 x, SqlInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ // <= Compare
+ public static SqlBoolean operator <= (SqlInt32 x, SqlInt32 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ // Compute Modulus
+ public static SqlInt32 operator % (SqlInt32 x, SqlInt32 y)
+ {
+ return new SqlInt32 (x.Value % y.Value);
+ }
+
+ // Compute Multiplication
+ public static SqlInt32 operator * (SqlInt32 x, SqlInt32 y)
+ {
+ checked {
+ return new SqlInt32 (x.Value * y.Value);
+ }
+ }
+
+ // Ones Complement
+ public static SqlInt32 operator ~ (SqlInt32 x)
+ {
+ return new SqlInt32 (~x.Value);
+ }
+
+ // Subtraction
+ public static SqlInt32 operator - (SqlInt32 x, SqlInt32 y)
+ {
+ checked {
+ return new SqlInt32 (x.Value - y.Value);
+ }
+ }
+
+ // Negates the Value
+ public static SqlInt32 operator - (SqlInt32 x)
+ {
+ return new SqlInt32 (-x.Value);
+ }
+
+ // Type Conversions
+ public static explicit operator SqlInt32 (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.ByteValue);
+ }
+
+ public static explicit operator SqlInt32 (SqlDecimal x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt32 (SqlDouble x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+ }
+
+ public static explicit operator int (SqlInt32 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlInt32 (SqlInt64 x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt32(SqlMoney x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt32(SqlSingle x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt32(SqlString x)
+ {
+ checked {
+ return SqlInt32.Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlInt32(int x)
+ {
+ return new SqlInt32 (x);
+ }
+
+ public static implicit operator SqlInt32(SqlByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+
+ public static implicit operator SqlInt32(SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlInt32 ((int)x.Value);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs
new file mode 100644
index 00000000000..bdd80858256
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt64.cs
@@ -0,0 +1,430 @@
+//
+// System.Data.SqlTypes.SqlInt64
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlInt64 : INullable, IComparable
+ {
+ #region Fields
+
+ long value;
+
+ private bool notNull;
+
+ public static readonly SqlInt64 MaxValue = new SqlInt64 (9223372036854775807);
+ public static readonly SqlInt64 MinValue = new SqlInt64 (-9223372036854775808);
+
+ public static readonly SqlInt64 Null;
+ public static readonly SqlInt64 Zero = new SqlInt64 (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlInt64 (long value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public long Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlInt64 Add (SqlInt64 x, SqlInt64 y)
+ {
+ return (x + y);
+ }
+
+ public static SqlInt64 BitwiseAnd (SqlInt64 x, SqlInt64 y)
+ {
+ return (x & y);
+ }
+
+ public static SqlInt64 BitwiseOr (SqlInt64 x, SqlInt64 y)
+ {
+ return (x | y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlInt64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlInt64"));
+ else if (((SqlInt64)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlInt64)value).Value);
+ }
+
+ public static SqlInt64 Divide (SqlInt64 x, SqlInt64 y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlInt64))
+ return false;
+ else if (this.IsNull && ((SqlInt64)value).IsNull)
+ return true;
+ else if (((SqlInt64)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlInt64)value);
+ }
+
+ public static SqlBoolean Equals (SqlInt64 x, SqlInt64 y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ public static SqlBoolean GreaterThan (SqlInt64 x, SqlInt64 y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlInt64 x, SqlInt64 y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlInt64 x, SqlInt64 y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlInt64 x, SqlInt64 y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlInt64 Mod (SqlInt64 x, SqlInt64 y)
+ {
+ return (x % y);
+ }
+
+ public static SqlInt64 Multiply (SqlInt64 x, SqlInt64 y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlInt64 x, SqlInt64 y)
+ {
+ return (x != y);
+ }
+
+ public static SqlInt64 OnesComplement (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+
+ return ~x;
+ }
+
+
+ public static SqlInt64 Parse (string s)
+ {
+ checked {
+ return new SqlInt64 (Int64.Parse (s));
+ }
+ }
+
+ public static SqlInt64 Subtract (SqlInt64 x, SqlInt64 y)
+ {
+ return (x - y);
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte ()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDecimal ToSqlDecimal ()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble ()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16 ()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlMoney ToSqlMoney ()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle ()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return "Null";
+
+ return value.ToString ();
+ }
+
+ public static SqlInt64 Xor (SqlInt64 x, SqlInt64 y)
+ {
+ return (x ^ y);
+ }
+
+ public static SqlInt64 operator + (SqlInt64 x, SqlInt64 y)
+ {
+ checked {
+ return new SqlInt64 (x.Value + y.Value);
+ }
+ }
+
+ public static SqlInt64 operator & (SqlInt64 x, SqlInt64 y)
+ {
+ return new SqlInt64 (x.value & y.Value);
+ }
+
+ public static SqlInt64 operator | (SqlInt64 x, SqlInt64 y)
+ {
+ return new SqlInt64 (x.value | y.Value);
+ }
+
+ public static SqlInt64 operator / (SqlInt64 x, SqlInt64 y)
+ {
+ checked {
+ return new SqlInt64 (x.Value / y.Value);
+ }
+ }
+
+ public static SqlBoolean operator == (SqlInt64 x, SqlInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlInt64 operator ^ (SqlInt64 x, SqlInt64 y)
+ {
+ return new SqlInt64 (x.Value ^ y.Value);
+ }
+
+ public static SqlBoolean operator > (SqlInt64 x, SqlInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlInt64 x, SqlInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlInt64 x, SqlInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlInt64 x, SqlInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlInt64 x, SqlInt64 y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlInt64 operator % (SqlInt64 x, SqlInt64 y)
+ {
+ return new SqlInt64(x.Value % y.Value);
+ }
+
+ public static SqlInt64 operator * (SqlInt64 x, SqlInt64 y)
+ {
+ checked {
+ return new SqlInt64 (x.Value * y.Value);
+ }
+ }
+
+ public static SqlInt64 operator ~ (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return SqlInt64.Null;
+
+ return new SqlInt64 (~(x.Value));
+ }
+
+ public static SqlInt64 operator - (SqlInt64 x, SqlInt64 y)
+ {
+ checked {
+ return new SqlInt64 (x.Value - y.Value);
+ }
+ }
+
+ public static SqlInt64 operator - (SqlInt64 n)
+ {
+ return new SqlInt64 (-(n.Value));
+ }
+
+ public static explicit operator SqlInt64 (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.ByteValue);
+ }
+
+ public static explicit operator SqlInt64 (SqlDecimal x)
+ {
+ checked {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt64 (SqlDouble x)
+ {
+ //checked {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ //}
+ }
+
+ public static explicit operator long (SqlInt64 x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlInt64 (SqlMoney x)
+ {
+ checked {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ }
+ }
+
+ public static explicit operator SqlInt64 (SqlSingle x)
+ {
+ //checked {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ //}
+ }
+
+ public static explicit operator SqlInt64 (SqlString x)
+ {
+ checked {
+ return SqlInt64.Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlInt64 (long x)
+ {
+ return new SqlInt64 (x);
+ }
+
+ public static implicit operator SqlInt64 (SqlByte x)
+ {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ }
+
+ public static implicit operator SqlInt64 (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ }
+
+ public static implicit operator SqlInt64 (SqlInt32 x)
+ {
+ if (x.IsNull)
+ return SqlInt64.Null;
+ else
+ return new SqlInt64 ((long)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs
new file mode 100644
index 00000000000..35894e94251
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs
@@ -0,0 +1,412 @@
+//
+// System.Data.SqlTypes.SqlMoney
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlMoney : INullable, IComparable
+ {
+ #region Fields
+
+ decimal value;
+
+ private bool notNull;
+
+ public static readonly SqlMoney MaxValue = new SqlMoney (922337203685477.5807m);
+ public static readonly SqlMoney MinValue = new SqlMoney (-922337203685477.5808m);
+ public static readonly SqlMoney Null;
+ public static readonly SqlMoney Zero = new SqlMoney (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlMoney (decimal value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ public SqlMoney (double value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ public SqlMoney (int value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ public SqlMoney (long value)
+ {
+ this.value = (decimal)value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public decimal Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlMoney Add (SqlMoney x, SqlMoney y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlMoney))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlMoney"));
+ else if (((SqlMoney)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlMoney)value).Value);
+ }
+
+ public static SqlMoney Divide (SqlMoney x, SqlMoney y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlMoney))
+ return false;
+ if (this.IsNull && ((SqlMoney)value).IsNull)
+ return true;
+ else if (((SqlMoney)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlMoney)value);
+ }
+
+ public static SqlBoolean Equals (SqlMoney x, SqlMoney y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)value;
+ }
+
+ public static SqlBoolean GreaterThan (SqlMoney x, SqlMoney y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlMoney x, SqlMoney y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlMoney x, SqlMoney y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlMoney x, SqlMoney y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlMoney Multiply (SqlMoney x, SqlMoney y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlMoney x, SqlMoney y)
+ {
+ return (x != y);
+ }
+
+ public static SqlMoney Parse (string s)
+ {
+ decimal d = Decimal.Parse (s);
+
+ if (d > SqlMoney.MaxValue.Value || d < SqlMoney.MinValue.Value)
+ throw new OverflowException ("");
+
+ return new SqlMoney (d);
+ }
+
+ public static SqlMoney Subtract (SqlMoney x, SqlMoney y)
+ {
+ return (x - y);
+ }
+
+ public decimal ToDecimal ()
+ {
+ return value;
+ }
+
+ public double ToDouble ()
+ {
+ return (double)value;
+ }
+
+ public int ToInt32 ()
+ {
+ return (int)value;
+ }
+
+ public long ToInt64 ()
+ {
+ return (long)value;
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte ()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDecimal ToSqlDecimal ()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble ()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16 ()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64 ()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlSingle ToSqlSingle ()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ if (this.IsNull)
+ return String.Empty;
+ else
+ return value.ToString ();
+ }
+
+ public static SqlMoney operator + (SqlMoney x, SqlMoney y)
+ {
+ checked {
+ return new SqlMoney (x.Value + y.Value);
+ }
+ }
+
+ public static SqlMoney operator / (SqlMoney x, SqlMoney y)
+ {
+ checked {
+ return new SqlMoney (x.Value / y.Value);
+ }
+ }
+
+ public static SqlBoolean operator == (SqlMoney x, SqlMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlBoolean operator > (SqlMoney x, SqlMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlMoney x, SqlMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlMoney x, SqlMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlMoney x, SqlMoney y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlMoney x, SqlMoney y)
+ {
+ if (x.IsNull || y.IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlMoney operator * (SqlMoney x, SqlMoney y)
+ {
+ checked {
+ return new SqlMoney (x.Value * y.Value);
+ }
+ }
+
+ public static SqlMoney operator - (SqlMoney x, SqlMoney y)
+ {
+ checked {
+ return new SqlMoney (x.Value - y.Value);
+ }
+ }
+
+ public static SqlMoney operator - (SqlMoney n)
+ {
+ return new SqlMoney (-(n.Value));
+ }
+
+ public static explicit operator SqlMoney (SqlBoolean x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.ByteValue);
+ }
+ }
+
+ public static explicit operator SqlMoney (SqlDecimal x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney (x.Value);
+ }
+ }
+
+ public static explicit operator SqlMoney (SqlDouble x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.Value);
+ }
+ }
+
+ public static explicit operator decimal (SqlMoney x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlMoney (SqlSingle x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.Value);
+ }
+ }
+
+ public static explicit operator SqlMoney (SqlString x)
+ {
+ checked {
+ return SqlMoney.Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlMoney (decimal x)
+ {
+ return new SqlMoney (x);
+ }
+
+ public static implicit operator SqlMoney (SqlByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlMoney (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlMoney (SqlInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.Value);
+ }
+
+ public static implicit operator SqlMoney (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlMoney ((decimal)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlNullValueException.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlNullValueException.cs
new file mode 100644
index 00000000000..19c3c13ed4d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlNullValueException.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.SqlNullValueException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlTypes {
+
+ [Serializable]
+ public class SqlNullValueException : SqlTypeException
+ {
+ public SqlNullValueException ()
+ : base (Locale.GetText ("The value property is null"))
+ {
+ }
+
+ public SqlNullValueException (string message)
+ : base (message)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs
new file mode 100644
index 00000000000..862e0075c8a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlSingle.cs
@@ -0,0 +1,362 @@
+//
+// System.Data.SqlTypes.SqlSingle
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Data.SqlTypes
+{
+ public struct SqlSingle : INullable, IComparable
+ {
+ #region Fields
+
+ float value;
+
+ private bool notNull;
+
+ public static readonly SqlSingle MaxValue = new SqlSingle (3.40282346638528859E+38f);
+ public static readonly SqlSingle MinValue = new SqlSingle (-3.40282346638528859E+38f);
+ public static readonly SqlSingle Null;
+ public static readonly SqlSingle Zero = new SqlSingle (0);
+
+ #endregion
+
+ #region Constructors
+
+ public SqlSingle (double value)
+ {
+ this.value = (float)value;
+ notNull = true;
+ }
+
+ public SqlSingle (float value)
+ {
+ this.value = value;
+ notNull = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ public float Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException ();
+ else
+ return value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public static SqlSingle Add (SqlSingle x, SqlSingle y)
+ {
+ return (x + y);
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlSingle))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlSingle"));
+ else if (((SqlSingle)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlSingle)value).Value);
+ }
+
+ public static SqlSingle Divide (SqlSingle x, SqlSingle y)
+ {
+ return (x / y);
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is SqlSingle))
+ return false;
+ else if (this.IsNull && ((SqlSingle)value).IsNull)
+ return true;
+ else if (((SqlSingle)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlSingle)value);
+ }
+
+ public static SqlBoolean Equals (SqlSingle x, SqlSingle y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode ()
+ {
+ long LongValue = (long) value;
+ return (int)(LongValue ^ (LongValue >> 32));
+ }
+
+ public static SqlBoolean GreaterThan (SqlSingle x, SqlSingle y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual (SqlSingle x, SqlSingle y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan (SqlSingle x, SqlSingle y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual (SqlSingle x, SqlSingle y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlSingle Multiply (SqlSingle x, SqlSingle y)
+ {
+ return (x * y);
+ }
+
+ public static SqlBoolean NotEquals (SqlSingle x, SqlSingle y)
+ {
+ return (x != y);
+ }
+
+ public static SqlSingle Parse (string s)
+ {
+ return new SqlSingle (Single.Parse (s));
+ }
+
+ public static SqlSingle Subtract (SqlSingle x, SqlSingle y)
+ {
+ return (x - y);
+ }
+
+ public SqlBoolean ToSqlBoolean ()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte ()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDecimal ToSqlDecimal ()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble ()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlInt16 ToSqlInt16 ()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32 ()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64 ()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney ()
+ {
+ return ((SqlMoney)this);
+ }
+
+
+ public SqlString ToSqlString ()
+ {
+ return ((SqlString)this);
+ }
+
+ public override string ToString ()
+ {
+ return value.ToString ();
+ }
+
+ public static SqlSingle operator + (SqlSingle x, SqlSingle y)
+ {
+ checked {
+ return new SqlSingle ((float)(x.Value + y.Value));
+ }
+ }
+
+ public static SqlSingle operator / (SqlSingle x, SqlSingle y)
+ {
+ checked {
+ return new SqlSingle (x.Value / y.Value);
+ }
+ }
+
+ public static SqlBoolean operator == (SqlSingle x, SqlSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ public static SqlBoolean operator > (SqlSingle x, SqlSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value > y.Value);
+ }
+
+ public static SqlBoolean operator >= (SqlSingle x, SqlSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value >= y.Value);
+ }
+
+ public static SqlBoolean operator != (SqlSingle x, SqlSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (!(x.Value == y.Value));
+ }
+
+ public static SqlBoolean operator < (SqlSingle x, SqlSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value < y.Value);
+ }
+
+ public static SqlBoolean operator <= (SqlSingle x, SqlSingle y)
+ {
+ if (x.IsNull || y .IsNull) return SqlBoolean.Null;
+ return new SqlBoolean (x.Value <= y.Value);
+ }
+
+ public static SqlSingle operator * (SqlSingle x, SqlSingle y)
+ {
+ checked {
+ return new SqlSingle (x.Value * y.Value);
+ }
+ }
+
+ public static SqlSingle operator - (SqlSingle x, SqlSingle y)
+ {
+ checked {
+ return new SqlSingle (x.Value - y.Value);
+ }
+ }
+
+ public static SqlSingle operator - (SqlSingle n)
+ {
+ return new SqlSingle (-(n.Value));
+ }
+
+ public static explicit operator SqlSingle (SqlBoolean x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+
+ return new SqlSingle((float)x.ByteValue);
+ }
+ }
+
+ public static explicit operator SqlSingle (SqlDouble x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+
+ return new SqlSingle((float)x.Value);
+ }
+ }
+
+ public static explicit operator float (SqlSingle x)
+ {
+ return x.Value;
+ }
+
+ public static explicit operator SqlSingle (SqlString x)
+ {
+ checked {
+ if (x.IsNull)
+ return Null;
+
+ return SqlSingle.Parse (x.Value);
+ }
+ }
+
+ public static implicit operator SqlSingle (float x)
+ {
+ return new SqlSingle (x);
+ }
+
+ public static implicit operator SqlSingle (SqlByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlSingle((float)x.Value);
+ }
+
+ public static implicit operator SqlSingle (SqlDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlSingle((float)x.Value);
+ }
+
+ public static implicit operator SqlSingle (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlSingle((float)x.Value);
+ }
+
+ public static implicit operator SqlSingle (SqlInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlSingle((float)x.Value);
+ }
+
+ public static implicit operator SqlSingle (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlSingle((float)x.Value);
+ }
+
+ public static implicit operator SqlSingle (SqlMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlSingle((float)x.Value);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs
new file mode 100644
index 00000000000..7e4ea983ae9
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs
@@ -0,0 +1,548 @@
+//
+// System.Data.SqlTypes.SqlString
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ximian, Inc. 2002
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Globalization;
+using System.Threading;
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// A variable-length stream of characters
+ /// to be stored in or retrieved from the database
+ /// </summary>
+ public struct SqlString : INullable, IComparable
+ {
+
+ #region Fields
+
+ string value;
+
+ private bool notNull;
+
+ // FIXME: locale id is not working yet
+ private int lcid;
+ private SqlCompareOptions compareOptions;
+
+ public static readonly int BinarySort = 0x8000;
+ public static readonly int IgnoreCase = 0x1;
+ public static readonly int IgnoreKanaType = 0x8;
+ public static readonly int IgnoreNonSpace = 0x2;
+ public static readonly int IgnoreWidth = 0x10;
+ public static readonly SqlString Null;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ // init with a string data
+ public SqlString (string data)
+ {
+ this.value = data;
+ lcid = CultureInfo.CurrentCulture.LCID;
+ notNull = true;
+ this.compareOptions = SqlCompareOptions.None;
+ }
+
+ // init with a string data and locale id values.
+ public SqlString (string data, int lcid)
+ {
+ this.value = data;
+ this.lcid = lcid;
+ notNull = true;
+ this.compareOptions = SqlCompareOptions.None;
+ }
+
+ // init with locale id, compare options,
+ // and an array of bytes data
+ public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data)
+ : this (lcid, compareOptions, data, true) { }
+
+ // init with string data, locale id, and compare options
+ public SqlString (string data, int lcid, SqlCompareOptions compareOptions)
+ {
+ this.value = data;
+ this.lcid = lcid;
+ this.compareOptions = compareOptions;
+ notNull = true;
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // and whether unicode is encoded or not
+ public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, bool fUnicode)
+ {
+ char [] chars;
+
+ if (fUnicode)
+ chars = new char [data.Length/2];
+ else
+ chars = new char [data.Length];
+
+ int j = 0;
+ for (int i = 0; i < chars.Length; i++) {
+
+ if (fUnicode) {
+ chars [i] = (char)(data [j] << 16);
+ chars [i] += (char)data [j + 1];
+ j += 2;
+ } else {
+ chars [i] = (char)data[i];
+ }
+ }
+
+ this.value = new String (chars);
+ this.lcid = lcid;
+ this.compareOptions = compareOptions;
+ notNull = true;
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array,
+ // and number of bytes to copy
+ public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data,
+ int index, int count)
+ : this (lcid, compareOptions, data, index, count, true) { }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array, number of byte to copy,
+ // and whether unicode is encoded or not
+ public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
+ {
+ char [] chars;
+
+ if (fUnicode)
+ chars = new char [(count - index) / 2];
+ else
+ chars = new char [count - index];
+
+ int j = 0;
+ for (int i = index; i < chars.Length; i++) {
+
+ if (fUnicode) {
+ chars [i] = (char)(data[j] << 16);
+ chars [i] += (char)data[j+1];
+ j += 2;
+ } else {
+ chars [i] = (char)data [j];
+ j++;
+ }
+ }
+
+ this.value = new String (chars);
+ this.lcid = lcid;
+ this.compareOptions = compareOptions;
+ notNull = true;
+ }
+
+ #endregion // Constructors
+
+
+ #region Public Properties
+
+ public CompareInfo CompareInfo {
+ get {
+ return new CultureInfo (lcid).CompareInfo;
+ }
+ }
+
+ public CultureInfo CultureInfo {
+ get {
+ return new CultureInfo (lcid);
+ }
+ }
+
+ public bool IsNull {
+ get { return !notNull; }
+ }
+
+ // geographics location and language (locale id)
+ public int LCID {
+ get {
+ return lcid;
+ }
+ }
+
+ public SqlCompareOptions SqlCompareOptions {
+ get {
+ return compareOptions;
+ }
+ }
+
+ public string Value {
+ get {
+ if (this.IsNull)
+ throw new SqlNullValueException (Locale.GetText ("The property contains Null."));
+ else
+ return value;
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ public SqlString Clone()
+ {
+ return new SqlString (value, lcid, compareOptions);
+ }
+
+ public static CompareOptions CompareOptionsFromSqlCompareOptions (SqlCompareOptions compareOptions)
+ {
+ CompareOptions options = CompareOptions.None;
+
+ if ((compareOptions & SqlCompareOptions.IgnoreCase) != 0)
+ options |= CompareOptions.IgnoreCase;
+ if ((compareOptions & SqlCompareOptions.IgnoreKanaType) != 0)
+ options |= CompareOptions.IgnoreKanaType;
+ if ((compareOptions & SqlCompareOptions.IgnoreNonSpace) != 0)
+ options |= CompareOptions.IgnoreNonSpace;
+ if ((compareOptions & SqlCompareOptions.IgnoreWidth) != 0)
+ options |= CompareOptions.IgnoreWidth;
+ if ((compareOptions & SqlCompareOptions.BinarySort) != 0)
+ // FIXME: Exception string
+ throw new ArgumentOutOfRangeException ();
+
+ return options;
+ }
+
+ // **********************************
+ // Comparison Methods
+ // **********************************
+
+ public int CompareTo(object value)
+ {
+ if (value == null)
+ return 1;
+ else if (!(value is SqlString))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SqlTypes.SqlString"));
+ else if (((SqlString)value).IsNull)
+ return 1;
+ else
+ return this.value.CompareTo (((SqlString)value).Value);
+ }
+
+ public static SqlString Concat(SqlString x, SqlString y)
+ {
+ return (x + y);
+ }
+
+ public override bool Equals(object value)
+ {
+ if (!(value is SqlString))
+ return false;
+ if (this.IsNull && ((SqlString)value).IsNull)
+ return true;
+ else if (((SqlString)value).IsNull)
+ return false;
+ else
+ return (bool) (this == (SqlString)value);
+ }
+
+ public static SqlBoolean Equals(SqlString x, SqlString y)
+ {
+ return (x == y);
+ }
+
+ public override int GetHashCode()
+ {
+ int result = 10;
+ for (int i = 0; i < value.Length; i++)
+ result = 91 * result + (int)(value [i] ^ (value [i] >> 32));
+
+ result = 91 * result + lcid.GetHashCode ();
+ result = 91 * result + (int)compareOptions;
+
+ return result;
+ }
+
+ public byte[] GetNonUnicodeBytes()
+ {
+ byte [] bytes = new byte [value.Length];
+
+ for (int i = 0; i < bytes.Length; i++)
+ bytes [i] = (byte)value [i];
+
+ return bytes;
+ }
+
+ public byte[] GetUnicodeBytes()
+ {
+ byte [] bytes = new byte [value.Length * 2];
+
+ int j = 0;
+ for (int i = 0; i < value.Length; i++) {
+ bytes [j] = (byte)(value [i] & 0x0000FFFF);
+ bytes [j + 1] = (byte)((value [i] & 0xFFFF0000) >> 16);
+ j += 2;
+ }
+
+ return bytes;
+ }
+
+ public static SqlBoolean GreaterThan(SqlString x, SqlString y)
+ {
+ return (x > y);
+ }
+
+ public static SqlBoolean GreaterThanOrEqual(SqlString x, SqlString y)
+ {
+ return (x >= y);
+ }
+
+ public static SqlBoolean LessThan(SqlString x, SqlString y)
+ {
+ return (x < y);
+ }
+
+ public static SqlBoolean LessThanOrEqual(SqlString x, SqlString y)
+ {
+ return (x <= y);
+ }
+
+ public static SqlBoolean NotEquals(SqlString x, SqlString y)
+ {
+ return (x != y);
+ }
+
+ // ****************************************
+ // Type Conversions From SqlString To ...
+ // ****************************************
+
+ public SqlBoolean ToSqlBoolean()
+ {
+ return ((SqlBoolean)this);
+ }
+
+ public SqlByte ToSqlByte()
+ {
+ return ((SqlByte)this);
+ }
+
+ public SqlDateTime ToSqlDateTime()
+ {
+ return ((SqlDateTime)this);
+ }
+
+ public SqlDecimal ToSqlDecimal()
+ {
+ return ((SqlDecimal)this);
+ }
+
+ public SqlDouble ToSqlDouble()
+ {
+ return ((SqlDouble)this);
+ }
+
+ public SqlGuid ToSqlGuid()
+ {
+ return ((SqlGuid)this);
+ }
+
+ public SqlInt16 ToSqlInt16()
+ {
+ return ((SqlInt16)this);
+ }
+
+ public SqlInt32 ToSqlInt32()
+ {
+ return ((SqlInt32)this);
+ }
+
+ public SqlInt64 ToSqlInt64()
+ {
+ return ((SqlInt64)this);
+ }
+
+ public SqlMoney ToSqlMoney()
+ {
+ return ((SqlMoney)this);
+ }
+
+ public SqlSingle ToSqlSingle()
+ {
+ return ((SqlSingle)this);
+ }
+
+ public override string ToString()
+ {
+ return ((string)this);
+ }
+
+ // ***********************************
+ // Operators
+ // ***********************************
+
+ // Concatenates
+ public static SqlString operator + (SqlString x, SqlString y)
+ {
+ return new SqlString (x.Value + y.Value);
+ }
+
+ // Equality
+ public static SqlBoolean operator == (SqlString x, SqlString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value == y.Value);
+ }
+
+ // Greater Than
+ public static SqlBoolean operator > (SqlString x, SqlString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // Greater Than Or Equal
+ public static SqlBoolean operator >= (SqlString x, SqlString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ public static SqlBoolean operator != (SqlString x, SqlString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ return new SqlBoolean (x.Value != y.Value);
+ }
+
+ // Less Than
+ public static SqlBoolean operator < (SqlString x, SqlString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // Less Than Or Equal
+ public static SqlBoolean operator <= (SqlString x, SqlString y)
+ {
+ if (x.IsNull || y.IsNull)
+ return SqlBoolean.Null;
+ else
+ throw new NotImplementedException ();
+ }
+
+ // **************************************
+ // Type Conversions
+ // **************************************
+
+ public static explicit operator SqlString (SqlBoolean x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlByte x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlDateTime x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlDecimal x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlDouble x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlGuid x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlInt16 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlInt32 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlInt64 x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlMoney x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator SqlString (SqlSingle x)
+ {
+ if (x.IsNull)
+ return Null;
+ else
+ return new SqlString (x.Value.ToString ());
+ }
+
+ public static explicit operator string (SqlString x)
+ {
+ return x.Value;
+ }
+
+ public static implicit operator SqlString (string x)
+ {
+ return new SqlString (x);
+ }
+
+ #endregion // Public Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlTruncateException.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlTruncateException.cs
new file mode 100644
index 00000000000..067b9195f17
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlTruncateException.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.SqlTruncateException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlTypes {
+
+ [Serializable]
+ public class SqlTruncateException : SqlTypeException
+ {
+ public SqlTruncateException ()
+ : base (Locale.GetText ("This value is being truncated"))
+ {
+ }
+
+ public SqlTruncateException (string message)
+ : base (message)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlTypeException.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlTypeException.cs
new file mode 100644
index 00000000000..6cb4b3f86aa
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlTypeException.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.SqlTypeException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlTypes {
+
+ [Serializable]
+ public class SqlTypeException : SystemException
+ {
+ public SqlTypeException (string message)
+ : base (message)
+ {
+ }
+
+ protected SqlTypeException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.build b/mcs/class/System.Data/System.Data.build
new file mode 100644
index 00000000000..47e5ba30bf4
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.build
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Data.dll -->
+
+<project name="System.Data" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Data.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0679"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.EnterpriseServices.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:../lib/Mono.Data.Tds.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.EnterpriseServices.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ <includes name="../lib/Mono.Data.Tds.dll"/>
+ </references>
+ </csc>
+ <copy file="../lib/System.Data.dll" tofile="Test/System.Data.dll"/>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Data.dll" failonerror="false"/>
+ <delete file="Test/System.Data.dll" failonerror="false"/>
+
+ </target>
+</project>
diff --git a/mcs/class/System.Data/System.Data/AcceptRejectRule.cs b/mcs/class/System.Data/System.Data/AcceptRejectRule.cs
new file mode 100644
index 00000000000..c4481175a6c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/AcceptRejectRule.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.AcceptRejectRule.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+
+ /// <summary>
+ /// Determines the action that occurs when
+ /// the AcceptChanges or RejectChanges method
+ /// is invoked on a DataTable with a ForeignKeyConstraint.
+ /// </summary>
+ [Serializable]
+ public enum AcceptRejectRule
+ {
+ Cascade = 1,
+ None = 0
+ }
+
+}
diff --git a/mcs/class/System.Data/System.Data/ChangeLog b/mcs/class/System.Data/System.Data/ChangeLog
new file mode 100644
index 00000000000..5e1f69ce4e8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ChangeLog
@@ -0,0 +1,193 @@
+2003-01-18 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataTableCollection.cs: Now names new DataTable if it doesn't
+ already have a name.
+
+2003-01-17 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlSchemaMapper.cs: Improvments.
+ * XmlConstaints.cs: Added more constants.
+ * DataSet.cs: Improvments of reading and writing xml
+ * DataColumn.cs: Added default values of properties.
+
+2003-01-14 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlSchemaMapper.cs: Some improvments
+
+2003-01-13 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRowCollection.cs: Added IndexOutOfRangeException
+ * DataTableCollection.cs: Added OnCollectionChanging and
+ OnCollectionChanged events.
+ * DataSet.cs: Many fixes. Implemented Clone () and Copy () -methods
+ * DataTable.cs: Implemented Copy () and Clone () methods.
+ * XmlDataLoader.cs: some fixes.
+ * XmlSchemaMapper.cs: comments.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataColumnPropertyDescriptor.cs: store columnIndex in the .ctor.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataColumnPropertyDescriptor.cs: fixed typo.
+ * DataViewManagerListItemTypeDescriptor.cs: added new internal property
+ to get the DataViewManager and removed TablePD class.
+ * DataTablePropertyDescriptor.cs: TablePD class is now this one as
+ suggested by danmorg.
+
+2003-01-06 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlDataLoader.cs: Moved diffgram stuff to new internal class
+ XmlDiffLoader.
+ * XmlDiffLoader.cs: new class for diffgrams. Added handling of
+ diffgr:Errors and some fixes and changed XmlReader to XPathNavigator.
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataView.cs: made dataViewManager internal.
+ * DataViewManager.cs: use ICustomTypeDescriptor. We don't want the
+ properties of the object, but the values of the columns present in a
+ row.
+
+ * DataViewManagerListItemTypeDescriptor.cs: implemented GetProperties,
+ which returns a PropertyDescriptorCollection. Created a new class
+ derived from PropertyDescriptor that treats Table as an object whose
+ properties are DataRowView.
+
+2003-01-04 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlSchemaMapper.cs: Added handling for Constraints, Attributes.
+
+2003-01-04 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataColumn.cs: ExtendedProperties is by default !null-
+
+2003-01-04 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataColumnCollection.cs: Add (DataColumn Column) -method didn't
+ set column's ordinal.
+
+2003-01-02 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs:
+ * XmlDataLoader.cs: XmlReader closing fixes.
+ * XmlSchemaReader.cs: Added support for ref=
+
+2003-01-01 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs:
+ - Added XmlReader and XmlWriter Closing.
+ - Moved ReadXmlSchema stuff to new internal class XmlSchemaMapper.
+ * XmlSchemaMapper.cs
+ - Much better way IMHO to map xmlschema than the old one in
+ DataSet.cs. Its, more flexible, cleaner, ...
+
+2002-12-29 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlDataLoader.cs: Reading diffgrams.
+
+2002-12-29 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRow.cs: Little fix to indexer and DataColumnCang* trigger fixes.
+ * DataTable.cs: Added ChanginDataColumn () for triggering
+ DataColumnChanging event
+
+2002-12-28 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs: Indentations to WriteXmlSchema () and one little fix
+
+2002-12-28 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs: Indentations to WriteXml ()
+
+2002-12-27 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs:
+ * XmlDataLoader.cs: Moved ReadXml -stuff from DataSet.cs to new
+ class XmlDataLoader.cs
+
+2002-12-19 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs Implemented ReadXml with XmlReadMode.ReadSchema
+
+2002-12-18 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs: Started to implement ReadXml-methods.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataSet.cs: implemented DefaultViewManager and GetList.
+
+ * DataViewManager.cs: a bit of work on IList and ITypedList needed by
+ DataList in System.Web.
+
+ * DataViewManagerListItemTypeDescriptor.cs: custom type descriptor for
+ DataViewManager.
+
+2002-12-16 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRow.cs
+ * DataTable.cs: Fixed NullException (rollback -event)
+ * DataSet.cs: WriteXml -method does not anymore write <?xml... row.
+
+2002-12-15 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRow.cs:
+ * DataRowCollection.cs: Moved event triggering from DataRow to
+ DataRowCollection.
+
+2002-12-09 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs: Little fix to WriteTable () -method
+ and DoReadXmlSchema () -method.
+
+2002-12-06 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSet.cs: Clean up to reading xmlschema. This looks much better
+ now (work better too), but it not working correctly yet.
+
+2002-12-04 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRow.cs:
+ * DataRowCollection.cs: Added some event handlins stuff.
+ * DataSet.cs: Some fixes.
+ * DataTable.cs: Added event handlers.
+
+2002-11-30 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRowChangeEventArgs.cs: Implemented Action and Row properties
+
+2002-11-30 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data/DataRow.cs: Added internal property XmlDataID
+
+2002-11-29 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataSystem.Data.DataTableCollection.cs:
+ Removed HashTable. There could be situations where DataTable
+ is added to collection before it hava TableName. So using
+ HashTable is impossible.
+
+2002-11-19 Carlos Guzmán Álvarez <carlosga@telefonica.net>
+
+ * DataRow.cs: an object that is equal to null
+ should be allowed to be set in this indexer too
+ to be like .NET
+
+2002-11-06 Daniel Morgan <danmorg@sc.rr.com>
+
+ * DataColumnPropertyDescriptor.cs: added file
+
+ * System.Data/DataRowView.cs: started implementation
+
+ * DataTable.cs: stubbed more interfaces. Implemented
+ IListSource.GetList()
+
+ * DataView.cs: stubbed more interfaces. Implemented
+ some properties and methods: GetEnumerator(),
+ ITypedList.GetItemProperties, Item indexer, CopyTo()
+
+2002-05-18 Nick Drochak <ndrochak@gol.com>
+
+ * DataRow.cs: Fix typo.
diff --git a/mcs/class/System.Data/System.Data/CommandBehavior.cs b/mcs/class/System.Data/System.Data/CommandBehavior.cs
new file mode 100644
index 00000000000..918722e1937
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/CommandBehavior.cs
@@ -0,0 +1,30 @@
+//
+// System.Data.CommandBehavior.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+
+ /// <summary>
+ /// Specifies a description of the results and the affect on the database of the query command.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum CommandBehavior
+ {
+ Default = 0,
+ SingleResult = 1,
+ SchemaOnly = 2,
+ KeyInfo = 4,
+ SingleRow = 8,
+ SequentialAccess = 16,
+ CloseConnection = 32
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/CommandType.cs b/mcs/class/System.Data/System.Data/CommandType.cs
new file mode 100644
index 00000000000..61bf5be81cb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/CommandType.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.CommandType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how a command string is interpreted.
+ /// </summary>
+ [Serializable]
+ public enum CommandType
+ {
+ Text = 1,
+ StoredProcedure = 4,
+ TableDirect = 512
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ConnectionState.cs b/mcs/class/System.Data/System.Data/ConnectionState.cs
new file mode 100644
index 00000000000..63f51af0ea8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ConnectionState.cs
@@ -0,0 +1,30 @@
+//
+// System.Data.ConnectionState.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+
+ /// <summary>
+ /// Returns the current state of the connection to a data source.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum ConnectionState
+ {
+ Closed = 0,
+ Open = 1,
+ Connecting = 2,
+ Executing = 4,
+ Fetching = 8,
+ Broken = 16
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/Constraint.cs b/mcs/class/System.Data/System.Data/Constraint.cs
new file mode 100644
index 00000000000..61e9bb4381d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/Constraint.cs
@@ -0,0 +1,133 @@
+//
+// System.Data.Constraint.cs
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+// Daniel Morgan
+// Tim Coleman (tim@timcoleman.com)
+//
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+ [Serializable]
+ internal delegate void DelegateConstraintNameChange (object sender, string newName);
+
+ [DefaultProperty ("ConstraintName")]
+ [Serializable]
+ public abstract class Constraint
+ {
+ internal event DelegateConstraintNameChange BeforeConstraintNameChange;
+
+ //if constraintName is not set then a name is
+ //created when it is added to
+ //the ConstraintCollection
+ //it can not be set to null, empty or duplicate
+ //once it has been added to the collection
+ private string _constraintName = null;
+ private PropertyCollection _properties = null;
+
+ //Used for membership checking
+ private ConstraintCollection _constraintCollection;
+
+ DataSet dataSet;
+
+ protected Constraint ()
+ {
+ dataSet = null;
+ _properties = new PropertyCollection();
+ }
+
+ protected internal virtual DataSet _DataSet {
+ get { return dataSet; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the name of this constraint.")]
+ [DefaultValue ("")]
+ public virtual string ConstraintName {
+ get{ return "" + _constraintName; }
+ set{
+ //This should only throw an exception when it
+ //is a member of a ConstraintCollection which
+ //means we should let the ConstraintCollection
+ //handle exceptions when this value changes
+ _onConstraintNameChange(value);
+ _constraintName = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds custom user information.")]
+ public PropertyCollection ExtendedProperties {
+ get { return _properties; }
+ }
+
+ [DataSysDescription ("Indicates the table of this constraint.")]
+ public abstract DataTable Table {
+ get;
+ }
+
+ internal ConstraintCollection ConstraintCollection {
+ get{ return _constraintCollection; }
+ set{ _constraintCollection = value; }
+ }
+
+ private void _onConstraintNameChange (string newName)
+ {
+ if (null != BeforeConstraintNameChange)
+ {
+ BeforeConstraintNameChange (this, newName);
+ }
+ }
+
+ //call once before adding a constraint to a collection
+ //will throw an exception to prevent the add if a rule is broken
+ internal virtual void AddToConstraintCollectionSetup (ConstraintCollection collection)
+ {
+ }
+
+ internal virtual void AssertConstraint ()
+ {
+ }
+
+ internal virtual void AssertConstraint (DataRow row)
+ {
+ }
+
+ //call once before removing a constraint to a collection
+ //can throw an exception to prevent the removal
+ internal virtual void RemoveFromConstraintCollectionCleanup (ConstraintCollection collection)
+ {
+ }
+
+ [MonoTODO]
+ protected void CheckStateForProperty ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected internal void SetDataSet (DataSet dataSet)
+ {
+ this.dataSet = dataSet;
+ }
+
+ /// <summary>
+ /// Gets the ConstraintName, if there is one, as a string.
+ /// </summary>
+ public override string ToString ()
+ {
+ return "" + _constraintName;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ConstraintCollection.cs b/mcs/class/System.Data/System.Data/ConstraintCollection.cs
new file mode 100644
index 00000000000..0a01173a87c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ConstraintCollection.cs
@@ -0,0 +1,342 @@
+//
+// System.Data.ConstraintCollection.cs
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+// Daniel Morgan
+//
+// (C) Ximian, Inc. 2002
+// (C) 2002 Franklin Wise
+// (C) 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data {
+ [Serializable]
+ internal delegate void DelegateValidateRemoveConstraint(ConstraintCollection sender, Constraint constraintToRemove, ref bool fail,ref string failReason);
+
+ /// <summary>
+ /// hold collection of constraints for data table
+ /// </summary>
+ [DefaultEvent ("CollectionChanged")]
+ [Serializable]
+ public class ConstraintCollection : InternalDataCollectionBase
+ {
+ //private bool beginInit = false;
+
+ public event CollectionChangeEventHandler CollectionChanged;
+ internal event DelegateValidateRemoveConstraint ValidateRemoveConstraint;
+
+ //Don't allow public instantiation
+ //Will be instantianted from DataTable
+ internal ConstraintCollection(){}
+
+ public virtual Constraint this[string name] {
+ get {
+ //If the name is not found we just return null
+ int index = IndexOf(name); //case insensitive
+ if (-1 == index) return null;
+ return this[index];
+ }
+ }
+
+ public virtual Constraint this[int index] {
+ get {
+ if (index < 0 || index >= List.Count)
+ throw new IndexOutOfRangeException();
+ return (Constraint)List[index];
+ }
+ }
+
+ private void _handleBeforeConstraintNameChange(object sender, string newName)
+ {
+ //null or empty
+ if (newName == null || newName == "")
+ throw new ArgumentException("ConstraintName cannot be set to null or empty " +
+ " after it has been added to a ConstraintCollection.");
+
+ if (_isDuplicateConstraintName(newName,(Constraint)sender))
+ throw new DuplicateNameException("Constraint name already exists.");
+ }
+
+ private bool _isDuplicateConstraintName(string constraintName, Constraint excludeFromComparison)
+ {
+ string cmpr = constraintName.ToUpper();
+ foreach (Constraint cst in List)
+ {
+ //Case insensitive comparision
+ if ( cmpr.CompareTo(cst.ConstraintName.ToUpper()) == 0 &&
+ cst != excludeFromComparison)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ //finds an open name slot of ConstraintXX
+ //where XX is a number
+ private string _createNewConstraintName()
+ {
+ bool loopAgain = false;
+ int index = 1;
+
+ do
+ {
+ loopAgain = false;
+ foreach (Constraint cst in List)
+ {
+ //Case insensitive
+ if (cst.ConstraintName.ToUpper().CompareTo("CONSTRAINT" +
+ index.ToString()) == 0 )
+ {
+ loopAgain = true;
+ index++;
+ }
+ }
+ } while (loopAgain);
+
+ return "Constraint" + index.ToString();
+
+ }
+
+
+ // Overloaded Add method (5 of them)
+ // to add Constraint object to the collection
+
+ public void Add(Constraint constraint)
+ {
+ //not null
+ if (null == constraint) throw new ArgumentNullException("Can not add null.");
+
+ //check constraint membership
+ //can't already exist in this collection or any other
+ if (this == constraint.ConstraintCollection)
+ throw new ArgumentException("Constraint already belongs to this collection.");
+ if (null != constraint.ConstraintCollection)
+ throw new ArgumentException("Constraint already belongs to another collection.");
+
+ //check for duplicate name
+ if (_isDuplicateConstraintName(constraint.ConstraintName,null) )
+ throw new DuplicateNameException("Constraint name already exists.");
+
+ //Allow constraint to run validation rules and setup
+ constraint.AddToConstraintCollectionSetup(this); //may throw if it can't setup
+
+ //Run Constraint to check existing data in table
+ constraint.AssertConstraint();
+
+ //if name is null or empty give it a name
+ if (constraint.ConstraintName == null ||
+ constraint.ConstraintName == "" )
+ {
+ constraint.ConstraintName = _createNewConstraintName();
+ }
+
+ //Add event handler for ConstraintName change
+ constraint.BeforeConstraintNameChange += new DelegateConstraintNameChange(
+ _handleBeforeConstraintNameChange);
+
+ constraint.ConstraintCollection = this;
+ List.Add(constraint);
+
+ OnCollectionChanged( new CollectionChangeEventArgs( CollectionChangeAction.Add, this) );
+ }
+
+
+
+ public virtual Constraint Add(string name, DataColumn column, bool primaryKey)
+ {
+
+ UniqueConstraint uc = new UniqueConstraint(name, column, primaryKey);
+ Add(uc);
+
+ return uc;
+ }
+
+ public virtual Constraint Add(string name, DataColumn primaryKeyColumn,
+ DataColumn foreignKeyColumn)
+ {
+ ForeignKeyConstraint fc = new ForeignKeyConstraint(name, primaryKeyColumn,
+ foreignKeyColumn);
+ Add(fc);
+
+ return fc;
+ }
+
+ public virtual Constraint Add(string name, DataColumn[] columns, bool primaryKey)
+ {
+ UniqueConstraint uc = new UniqueConstraint(name, columns, primaryKey);
+ Add(uc);
+
+ return uc;
+ }
+
+ public virtual Constraint Add(string name, DataColumn[] primaryKeyColumns,
+ DataColumn[] foreignKeyColumns)
+ {
+ ForeignKeyConstraint fc = new ForeignKeyConstraint(name, primaryKeyColumns,
+ foreignKeyColumns);
+ Add(fc);
+
+ return fc;
+ }
+
+ [MonoTODO]
+ public void AddRange(Constraint[] constraints) {
+
+ throw new NotImplementedException ();
+ }
+
+ public bool CanRemove(Constraint constraint)
+ {
+
+ //Rule A UniqueConstraint can't be removed if there is
+ //a foreign key relationship to that column
+
+ //not null
+ //LAMESPEC: MSFT implementation throws and exception here
+ //spec says nothing about this
+ if (null == constraint) throw new ArgumentNullException("Constraint can't be null.");
+
+ //LAMESPEC: spec says return false (which makes sense) and throw exception for False case (?).
+ //TODO: I may want to change how this is done
+ //maybe put a CanRemove on the Constraint class
+ //and have the Constraint fire this event
+
+ //discover if there is a related ForeignKey
+ string failReason ="";
+ return _canRemoveConstraint(constraint, ref failReason);
+
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+
+ //CanRemove? See Lamespec below.
+
+ //the Constraints have a reference to us
+ //and we listen to name change events
+ //we should remove these before clearing
+ foreach (Constraint con in List)
+ {
+ con.ConstraintCollection = null;
+ con.BeforeConstraintNameChange -= new DelegateConstraintNameChange(
+ _handleBeforeConstraintNameChange);
+ }
+
+ //LAMESPEC: MSFT implementation allows this
+ //even when a ForeignKeyConstraint exist for a UniqueConstraint
+ //thus violating the CanRemove logic
+ List.Clear(); //Will violate CanRemove rule
+ OnCollectionChanged( new CollectionChangeEventArgs(CollectionChangeAction.Refresh, this) );
+ }
+
+ public bool Contains(string name)
+ {
+ return (-1 != IndexOf(name));
+ }
+
+ public int IndexOf(Constraint constraint)
+ {
+ return List.IndexOf(constraint);
+ }
+
+ public virtual int IndexOf(string constraintName)
+ {
+ //LAMESPEC: Spec doesn't say case insensitive
+ //it should to be consistant with the other
+ //case insensitive comparisons in this class
+
+ int index = 0;
+ foreach (Constraint con in List)
+ {
+ if (constraintName.ToUpper().CompareTo( con.ConstraintName.ToUpper() ) == 0)
+ {
+ return index;
+ }
+
+ index++;
+ }
+ return -1; //not found
+ }
+
+ public void Remove(Constraint constraint) {
+ //LAMESPEC: spec doesn't document the ArgumentException the
+ //will be thrown if the CanRemove rule is violated
+
+ //LAMESPEC: spec says an exception will be thrown
+ //if the element is not in the collection. The implementation
+ //doesn't throw an exception. ArrayList.Remove doesn't throw if the
+ //element doesn't exist
+ //ALSO the overloaded remove in the spec doesn't say it throws any exceptions
+
+ //not null
+ if (null == constraint) throw new ArgumentNullException();
+
+ string failReason = "";
+ if (! _canRemoveConstraint(constraint, ref failReason) )
+ {
+ if (failReason != null || failReason != "")
+ throw new ArgumentException(failReason);
+ else
+ throw new ArgumentException("Can't remove constraint.");
+ }
+
+ constraint.RemoveFromConstraintCollectionCleanup(this);
+ List.Remove(constraint);
+ OnCollectionChanged( new CollectionChangeEventArgs(CollectionChangeAction.Remove,this));
+ }
+
+ public void Remove(string name)
+ {
+ //if doesn't exist fail quietly
+ int index = IndexOf(name);
+ if (-1 == index) return;
+
+ Remove(this[index]);
+ }
+
+ public void RemoveAt(int index)
+ {
+ if (index < 0 || index + 1 > List.Count)
+ throw new IndexOutOfRangeException("Index out of range, index = "
+ + index.ToString() + ".");
+
+ this[index].RemoveFromConstraintCollectionCleanup(this);
+ List.RemoveAt(index);
+ OnCollectionChanged( new CollectionChangeEventArgs(CollectionChangeAction.Remove,this));
+ }
+
+ protected override ArrayList List {
+ get{
+ return base.List;
+ }
+ }
+
+ protected virtual void OnCollectionChanged( CollectionChangeEventArgs ccevent)
+ {
+ if (null != CollectionChanged)
+ {
+ CollectionChanged(this, ccevent);
+ }
+ }
+
+ private bool _canRemoveConstraint(Constraint constraint, ref string failReason )
+ {
+ bool cancel = false;
+ string tmp = "";
+ if (null != ValidateRemoveConstraint)
+ {
+ ValidateRemoveConstraint(this, constraint, ref cancel, ref tmp);
+ }
+ failReason = tmp;
+ return !cancel;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ConstraintException.cs b/mcs/class/System.Data/System.Data/ConstraintException.cs
new file mode 100644
index 00000000000..12293ddd655
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ConstraintException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.ConstraintException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class ConstraintException : DataException
+ {
+ public ConstraintException ()
+ : base (Locale.GetText ("This operation violates a constraint"))
+ {
+ }
+
+ public ConstraintException (string message)
+ : base (message)
+ {
+ }
+
+ protected ConstraintException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DBConcurrencyException.cs b/mcs/class/System.Data/System.Data/DBConcurrencyException.cs
new file mode 100644
index 00000000000..0d5247f5291
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DBConcurrencyException.cs
@@ -0,0 +1,39 @@
+//
+// System.Data.DBConcurrencyException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+ [Serializable]
+ public sealed class DBConcurrencyException : SystemException
+ {
+ public DBConcurrencyException (string message)
+ : base (message)
+ {
+ }
+
+ public DBConcurrencyException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ DataRow row;
+
+ public DataRow Row {
+ get { return row; }
+ set { row = value;} // setting the row has no effect
+ }
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataCategoryAttribute.cs b/mcs/class/System.Data/System.Data/DataCategoryAttribute.cs
new file mode 100644
index 00000000000..58c8fb9554b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataCategoryAttribute.cs
@@ -0,0 +1,42 @@
+//
+// System.Data/DataCategoryAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data {
+ [AttributeUsage (AttributeTargets.All)]
+ internal sealed class DataCategoryAttribute : CategoryAttribute
+ {
+ #region Fields
+
+ string category;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataCategoryAttribute (string category)
+ {
+ this.category = category;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ protected override string GetLocalizedString (string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumn.cs b/mcs/class/System.Data/System.Data/DataColumn.cs
new file mode 100644
index 00000000000..0032a1395fc
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumn.cs
@@ -0,0 +1,533 @@
+//
+// System.Data.DataColumn.cs
+//
+// Author:
+// Franklin Wise (gracenote@earthlink.net)
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright 2002, Franklin Wise
+// (C) Chris Podurgiel
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Data {
+ internal delegate void DelegateColumnValueChange(DataColumn column, DataRow row, object proposedValue);
+
+ /// <summary>
+ /// Summary description for DataColumn.
+ /// </summary>
+
+ [DefaultMember ("Item")]
+ [DefaultProperty ("ColumnName")]
+ [DesignTimeVisible (false)]
+ public class DataColumn : MarshalByValueComponent
+ {
+ #region Events
+ [MonoTODO]
+ //used for constraint validation
+ //if an exception is fired during this event the change should be canceled
+ internal event DelegateColumnValueChange ValidateColumnValueChange;
+
+ //used for FK Constraint Cascading rules
+ internal event DelegateColumnValueChange ColumnValueChanging;
+ #endregion //Events
+
+ #region Fields
+
+ private bool _allowDBNull = true;
+ private bool _autoIncrement = false;
+ private long _autoIncrementSeed = 0;
+ private long _autoIncrementStep = 1;
+ private string _caption = null;
+ private MappingType _columnMapping = MappingType.Element;
+ private string _columnName = null;
+ private Type _dataType = Type.GetType ("System.String");
+ private object _defaultValue = DBNull.Value;
+ private string expression = "";
+ private PropertyCollection _extendedProperties = new PropertyCollection ();
+ private int maxLength = -1; //-1 represents no length limit
+ private string nameSpace = "";
+ private int _ordinal = -1; //-1 represents not part of a collection
+ private string prefix = "";
+ private bool readOnly = false;
+ private DataTable _table = null;
+ private bool unique = false;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataColumn()
+ {
+ }
+
+ //TODO: Ctor init vars directly
+ public DataColumn(string columnName): this()
+ {
+ ColumnName = columnName;
+ }
+
+ public DataColumn(string columnName, Type dataType): this(columnName)
+ {
+ if(dataType == null) {
+ throw new ArgumentNullException("dataType can't be null.");
+ }
+
+ DataType = dataType;
+
+ }
+
+ public DataColumn( string columnName, Type dataType,
+ string expr): this(columnName, dataType)
+ {
+ Expression = expr;
+ }
+
+ public DataColumn(string columnName, Type dataType,
+ string expr, MappingType type): this(columnName, dataType, expr)
+ {
+ ColumnMapping = type;
+ }
+ #endregion
+
+ #region Properties
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether null values are allowed in this column.")]
+ [DefaultValue (true)]
+ public bool AllowDBNull
+ {
+ get {
+ return _allowDBNull;
+ }
+ set {
+ //TODO: If we are a part of the table and this value changes
+ //we need to validate that all the existing values conform to the new setting
+
+ if (true == value)
+ {
+ _allowDBNull = true;
+ return;
+ }
+
+ //if Value == false case
+ if (null != _table)
+ {
+ if (_table.Rows.Count > 0)
+ {
+ //TODO: Validate no null values exist
+ //do we also check different versions of the row??
+ }
+ }
+
+ _allowDBNull = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the column automatically increments the value of the column for new rows added to the table.
+ /// </summary>
+ /// <remarks>
+ /// If the type of this column is not Int16, Int32, or Int64 when this property is set,
+ /// the DataType property is coerced to Int32. An exception is generated if this is a computed column
+ /// (that is, the Expression property is set.) The incremented value is used only if the row's value for this column,
+ /// when added to the columns collection, is equal to the default value.
+ /// </remarks>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether the column automatically increments itself for new rows added to the table. The type of this column must be Int16, Int32, or Int64.")]
+ [DefaultValue (false)]
+ [RefreshProperties (RefreshProperties.All)]
+ public bool AutoIncrement
+ {
+ get {
+ return _autoIncrement;
+ }
+ set {
+ if(value == true)
+ {
+ //Can't be true if this is a computed column
+ if(Expression != null)
+ {
+ throw new ArgumentException("Can't Auto Increment a computed column.");
+ }
+
+ //If the DataType of this Column isn't an Int
+ //Make it an int
+ if(Type.GetTypeCode(_dataType) != TypeCode.Int16 &&
+ Type.GetTypeCode(_dataType) != TypeCode.Int32 &&
+ Type.GetTypeCode(_dataType) != TypeCode.Int64)
+ {
+ _dataType = typeof(Int32);
+ }
+ }
+ _autoIncrement = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the starting value for an AutoIncrement column.")]
+ [DefaultValue (0)]
+ public long AutoIncrementSeed
+ {
+ get {
+ return _autoIncrementSeed;
+ }
+ set {
+ _autoIncrementSeed = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the increment used by an AutoIncrement column.")]
+ [DefaultValue (1)]
+ public long AutoIncrementStep
+ {
+ get {
+ return _autoIncrementStep;
+ }
+ set {
+ _autoIncrementStep = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the default user-interface caption for this column.")]
+ public string Caption
+ {
+ get {
+ if(_caption == null)
+ return ColumnName;
+ else
+ return _caption;
+ }
+ set {
+ _caption = value;
+ }
+ }
+ [DataSysDescription ("Indicates how this column persists in XML: as an attribute, element, simple content node, or nothing.")]
+ [DefaultValue (MappingType.Element)]
+ public virtual MappingType ColumnMapping
+ {
+ get {
+ return _columnMapping;
+ }
+ set {
+ _columnMapping = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the name used to look up this column in the Columns collection of a DataTable.")]
+ [RefreshProperties (RefreshProperties.All)]
+ public string ColumnName
+ {
+ get {
+ return "" + _columnName;
+ }
+ set {
+ //Both are checked after the column is part of the collection
+ //TODO: Check Name duplicate
+ //TODO: check Name != null
+ _columnName = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the type of data stored in this column.")]
+ [DefaultValue (typeof (string))]
+ [RefreshProperties (RefreshProperties.All)]
+ public Type DataType
+ {
+ get {
+ return _dataType;
+ }
+ set {
+ //TODO: check if data already exists can we change the datatype
+
+ //TODO: we want to check that the datatype is supported?
+
+ //Check AutoIncrement status, make compatible datatype
+ //TODO: Check for other int values i.e. Int16 etc
+ if(AutoIncrement == true &&
+ Type.GetTypeCode(value) != TypeCode.Int32)
+ {
+ throw new Exception(); //TODO: correction exception type
+ }
+ _dataType = value;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>When AutoIncrement is set to true, there can be no default value.</remarks>
+ /// <exception cref="System.InvalidCastException"></exception>
+ /// <exception cref="System.ArgumentException"></exception>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the default column value used when adding new rows to the table.")]
+ public object DefaultValue
+ {
+ get {
+ return _defaultValue;
+ }
+ set {
+
+ //If autoIncrement == true throw
+ if (AutoIncrement)
+ {
+ throw new ArgumentException("Can not set default value while" +
+ " AutoIncrement is true on this column.");
+ }
+
+ //Will throw invalid cast exception
+ //if value is not the correct type
+ //FIXME: some types can be casted
+ if (value.GetType() != _dataType)
+ {
+ throw new InvalidCastException("Default Value type is not compatible with" +
+ " column type.");
+ }
+
+ _defaultValue = value;
+ }
+ }
+
+ [MonoTODO]
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the value that this column computes for each row based on other columns instead of taking user input.")]
+ [DefaultValue ("")]
+ [RefreshProperties (RefreshProperties.All)]
+ public string Expression
+ {
+ get {
+ return expression;
+ }
+ set {
+ //TODO: validation of the expression
+ expression = value; //Check?
+ }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds custom user information.")]
+ public PropertyCollection ExtendedProperties
+ {
+ get {
+ return _extendedProperties;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the maximum length of the value this column allows.")]
+ [DefaultValue (-1)]
+ public int MaxLength
+ {
+ get {
+ //Default == -1 no max length
+ return maxLength;
+ }
+ set {
+ //only applies to string columns
+ maxLength = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the XML uri for elements stored in this column.")]
+ public string Namespace
+ {
+ get {
+ return nameSpace;
+ }
+ set {
+ nameSpace = value;
+ }
+ }
+
+ //Need a good way to set the Ordinal when the column is added to a columnCollection.
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the index of this column in the Columns collection.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int Ordinal
+ {
+ get {
+ //value is -1 if not part of a collection
+ return _ordinal;
+ }
+ }
+
+ internal void SetOrdinal(int ordinal)
+ {
+ _ordinal = ordinal;
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the prefix used for this DataColumn in the xml representation.")]
+ [DefaultValue ("")]
+ public string Prefix
+ {
+ get {
+ return prefix;
+ }
+ set {
+ prefix = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether this column allows changes once a row has been added to the table.")]
+ [DefaultValue (false)]
+ public bool ReadOnly
+ {
+ get {
+ return readOnly;
+ }
+ set {
+ readOnly = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("Returns the DataTable to which this column belongs.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DataTable Table
+ {
+ get {
+ return _table;
+ }
+ }
+
+ [MonoTODO]
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether this column should restrict its values in the rows of the table to be unique.")]
+ [DefaultValue (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool Unique
+ {
+ get {
+ return unique;
+ }
+ set {
+ //if Table == null then the UniqueConstraint is
+ //created on addition to the collection
+
+ //FIXME?: need to check if value is the same
+ //because when calling "new UniqueConstraint"
+ //the new object tries to set "column.Unique = True"
+ //which creates an infinite loop.
+ if(unique != value)
+ {
+ unique = value;
+
+ if( value )
+ {
+ if( _table != null )
+ {
+ UniqueConstraint uc = new UniqueConstraint(this);
+ _table.Constraints.Add(uc);
+ }
+ }
+ else
+ {
+ if( _table != null )
+ {
+ //FIXME: Add code to remove constraint from DataTable
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+/* ??
+ [MonoTODO]
+ protected internal void CheckNotAllowNull() {
+ }
+
+ [MonoTODO]
+ protected void CheckUnique() {
+ }
+*/
+
+ [MonoTODO]
+ internal void AssertCanAddToCollection()
+ {
+ //Check if Default Value is set and AutoInc is set
+ }
+
+ [MonoTODO]
+ protected internal virtual void
+ OnPropertyChanging (PropertyChangedEventArgs pcevent) {
+ }
+
+ [MonoTODO]
+ protected internal void RaisePropertyChanging(string name) {
+ }
+
+ /// <summary>
+ /// Gets the Expression of the column, if one exists.
+ /// </summary>
+ /// <returns>The Expression value, if the property is set;
+ /// otherwise, the ColumnName property.</returns>
+ [MonoTODO]
+ public override string ToString()
+ {
+ if (expression != null)
+ return expression;
+
+ return ColumnName;
+ }
+
+ [MonoTODO]
+ internal void SetTable(DataTable table) {
+ _table = table;
+ // this will get called by DataTable
+ // and DataColumnCollection
+ }
+
+
+ // Returns true if all the same collumns are in columnSet and compareSet
+ internal static bool AreColumnSetsTheSame(DataColumn[] columnSet, DataColumn[] compareSet)
+ {
+ if (null == columnSet && null == compareSet) return true;
+ if (null == columnSet || null == compareSet) return false;
+
+ if (columnSet.Length != compareSet.Length) return false;
+
+ foreach (DataColumn col in columnSet)
+ {
+ bool matchFound = false;
+ foreach (DataColumn compare in compareSet)
+ {
+ if (col == compare)
+ {
+ matchFound = true;
+ }
+ }
+ if (! matchFound) return false;
+ }
+
+ return true;
+ }
+
+ #endregion // Methods
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs b/mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs
new file mode 100644
index 00000000000..f79d27eaf1e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs
@@ -0,0 +1,80 @@
+//
+// System.Data.DataColumnChangeEventArgs.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Provides data for the ColumnChanging event.
+ /// </summary>
+ public class DataColumnChangeEventArgs : EventArgs
+ {
+
+ private DataColumn _column = null;
+ private DataRow _row = null;
+ private object _proposedValue = null;
+
+ /// <summary>
+ /// Initializes a new instance of the DataColumnChangeEventArgs class.
+ /// </summary>
+ /// <param name="row"></param>
+ /// <param name="column"></param>
+ /// <param name="value"></param>
+ public DataColumnChangeEventArgs(DataRow row, DataColumn column, object value)
+ {
+ _column = column;
+ _row = row;
+ _proposedValue = value;
+ }
+
+ /// <summary>
+ /// Gets the DataColumn with a changing value.
+ /// </summary>
+ public DataColumn Column
+ {
+ get
+ {
+ return _column;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets or sets the proposed new value for the column.
+ /// </summary>
+ public object ProposedValue
+ {
+ get
+ {
+ return _proposedValue;
+ }
+ set
+ {
+ _proposedValue = value;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets the DataRow of the column with a changing value.
+ /// </summary>
+ public DataRow Row
+ {
+ get
+ {
+ return _row;
+ }
+ }
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs b/mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs
new file mode 100644
index 00000000000..1932d38f2fe
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.DataColumnChangeEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the the ColumnChanging event.
+ /// </summary>
+ [Serializable]
+ public delegate void DataColumnChangeEventHandler(object sender, DataColumnChangeEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataColumnCollection.cs b/mcs/class/System.Data/System.Data/DataColumnCollection.cs
new file mode 100644
index 00000000000..c7b4bfa4a62
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnCollection.cs
@@ -0,0 +1,452 @@
+//
+// System.Data.DataColumnCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Stuart Caborn <stuart.caborn@virgin.net>
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Chris Podurgiel
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data {
+ [DefaultEvent ("CollectionChanged")]
+ public class DataColumnCollection : InternalDataCollectionBase
+ {
+ // The defaultNameIndex is used to create a default name for a column if one wasn't given.
+ private int defaultNameIndex;
+
+ //table should be the DataTable this DataColumnCollection belongs to.
+ private DataTable parentTable = null;
+
+ // Internal Constructor. This Class can only be created from other classes in this assembly.
+ internal DataColumnCollection(DataTable table):base()
+ {
+ defaultNameIndex = 1;
+ parentTable = table;
+ }
+
+ /// <summary>
+ /// Gets the DataColumn from the collection at the specified index.
+ /// </summary>
+ public virtual DataColumn this[int index]
+ {
+ get
+ {
+ return (DataColumn) base.List[index];
+ }
+ }
+
+ /// <summary>
+ /// Gets the DataColumn from the collection with the specified name.
+ /// </summary>
+ public virtual DataColumn this[string name]
+ {
+ get
+ {
+ foreach (DataColumn column in base.List)
+ {
+ if (column.ColumnName == name)
+ {
+ return column;
+ }
+ }
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of the DataColumnCollection items.
+ /// </summary>
+ protected override ArrayList List
+ {
+ get
+ {
+ return base.List;
+ }
+ }
+
+ //Add Logic
+ //
+ //Changing Event
+ //DefaultValue set and AutoInc set check
+ //?Validate Expression??
+ //Name check and creation
+ //Set Table
+ //Check Unique if true then add a unique constraint
+ //?Notify Rows of new column ?
+ //Add to collection
+ //Changed Event
+
+ /// <summary>
+ /// Creates and adds a DataColumn object to the DataColumnCollection.
+ /// </summary>
+ /// <returns></returns>
+ public virtual DataColumn Add()
+ {
+ //FIXME:
+ DataColumn column = new DataColumn("Column" + defaultNameIndex.ToString());
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+
+ column.SetTable(parentTable);
+ base.List.Add(column);
+ OnCollectionChanged(e);
+ defaultNameIndex++;
+ return column;
+ }
+
+ /// <summary>
+ /// Creates and adds the specified DataColumn object to the DataColumnCollection.
+ /// </summary>
+ /// <param name="column">The DataColumn to add.</param>
+ [MonoTODO]
+ public void Add(DataColumn column)
+ {
+ //FIXME:
+ if(Contains(column.ColumnName))
+ {
+ throw new DuplicateNameException("A column named " + column.ColumnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+
+ column.SetTable( parentTable);
+ int ordinal = base.List.Add(column);
+ column.SetOrdinal (ordinal);
+
+ //add constraints if neccesary
+
+ if(column.Unique)
+ {
+ UniqueConstraint uc = new UniqueConstraint(column);
+ parentTable.Constraints.Add(uc);
+ }
+
+ //TODO: add missing constraints. i.e. Primary/Foreign keys
+
+ OnCollectionChanged(e);
+ return;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object with the specified name to the DataColumnCollection.
+ /// </summary>
+ /// <param name="columnName">The name of the column.</param>
+ /// <returns>The newly created DataColumn.</returns>
+ public virtual DataColumn Add(string columnName)
+ {
+
+ //FIXME: this wont work. If the user decides to add a column named
+ //"ColumnXX" where XX is a number these two will conflict.
+ if (columnName == null || columnName == String.Empty)
+ {
+ columnName = "Column" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ if(Contains(columnName))
+ {
+ throw new DuplicateNameException("A column named " + columnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ DataColumn column = new DataColumn(columnName);
+
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ column.SetTable(parentTable);
+ int ordinal = base.List.Add(column);
+ column.SetOrdinal( ordinal );
+ OnCollectionChanged(e);
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object with the specified name and type to the DataColumnCollection.
+ /// </summary>
+ /// <param name="columnName">The ColumnName to use when cretaing the column.</param>
+ /// <param name="type">The DataType of the new column.</param>
+ /// <returns>The newly created DataColumn.</returns>
+ public virtual DataColumn Add(string columnName, Type type)
+ {
+ if (columnName == null || columnName == "")
+ {
+ //FIXME: this wont work. If the user decides to add a column named
+ //"ColumnXX" where XX is a number these two will conflict.
+ columnName = "Column" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ if(Contains(columnName))
+ {
+ throw new DuplicateNameException("A column named " + columnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ DataColumn column = new DataColumn(columnName, type);
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ column.SetTable(parentTable);
+ int ordinal = base.List.Add(column);
+ column.SetOrdinal( ordinal );
+ OnCollectionChanged(e);
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object with the specified name, type, and expression to the DataColumnCollection.
+ /// </summary>
+ /// <param name="columnName">The name to use when creating the column.</param>
+ /// <param name="type">The DataType of the new column.</param>
+ /// <param name="expression">The expression to assign to the Expression property.</param>
+ /// <returns>The newly created DataColumn.</returns>
+ public virtual DataColumn Add(string columnName, Type type, string expression)
+ {
+ //FIXME: See Add Logic
+ if (columnName == null || columnName == "")
+ {
+ columnName = "Column" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ if(Contains(columnName))
+ {
+ throw new DuplicateNameException("A column named " + columnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ DataColumn column = new DataColumn(columnName, type, expression);
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ column.SetTable(parentTable);
+ int ordinal = base.List.Add(column);
+ column.SetOrdinal( ordinal );
+ OnCollectionChanged(e);
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Copies the elements of the specified DataColumn array to the end of the collection.
+ /// </summary>
+ /// <param name="columns">The array of DataColumn objects to add to the collection.</param>
+ public void AddRange(DataColumn[] columns)
+ {
+ foreach (DataColumn column in columns)
+ {
+ Add(column);
+ }
+ return;
+ }
+
+ /// <summary>
+ /// Checks whether a given column can be removed from the collection.
+ /// </summary>
+ /// <param name="column">A DataColumn in the collection.</param>
+ /// <returns>true if the column can be removed; otherwise, false.</returns>
+ public bool CanRemove(DataColumn column)
+ {
+
+ //Check that the column does not have a null reference.
+ if (column == null)
+ {
+ return false;
+ }
+
+
+ //Check that the column is part of this collection.
+ if (!Contains(column.ColumnName))
+ {
+ return false;
+ }
+
+
+
+ //Check if this column is part of a relationship. (this could probably be written better)
+ foreach (DataRelation childRelation in parentTable.ChildRelations)
+ {
+ foreach (DataColumn childColumn in childRelation.ChildColumns)
+ {
+ if (childColumn == column)
+ {
+ return false;
+ }
+ }
+
+ foreach (DataColumn parentColumn in childRelation.ParentColumns)
+ {
+ if (parentColumn == column)
+ {
+ return false;
+ }
+ }
+ }
+
+ //Check if this column is part of a relationship. (this could probably be written better)
+ foreach (DataRelation parentRelation in parentTable.ParentRelations)
+ {
+ foreach (DataColumn childColumn in parentRelation.ChildColumns)
+ {
+ if (childColumn == column)
+ {
+ return false;
+ }
+ }
+
+ foreach (DataColumn parentColumn in parentRelation.ParentColumns)
+ {
+ if (parentColumn == column)
+ {
+ return false;
+ }
+ }
+ }
+
+
+ //Check if another column's expression depends on this column.
+
+ foreach (DataColumn dataColumn in List)
+ {
+ if (dataColumn.Expression.ToString().IndexOf(column.ColumnName) > 0)
+ {
+ return false;
+ }
+ }
+
+ //TODO: check constraints
+
+ return true;
+ }
+
+ /// <summary>
+ /// Clears the collection of any columns.
+ /// </summary>
+ public void Clear()
+ {
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Refresh, this);
+ base.List.Clear();
+ OnCollectionChanged(e);
+ return;
+ }
+
+ /// <summary>
+ /// Checks whether the collection contains a column with the specified name.
+ /// </summary>
+ /// <param name="name">The ColumnName of the column to check for.</param>
+ /// <returns>true if a column exists with this name; otherwise, false.</returns>
+ public bool Contains(string name)
+ {
+ return (IndexOf(name) != -1);
+ }
+
+ /// <summary>
+ /// Gets the index of a column specified by name.
+ /// </summary>
+ /// <param name="column">The name of the column to return.</param>
+ /// <returns>The index of the column specified by column if it is found; otherwise, -1.</returns>
+ public virtual int IndexOf(DataColumn column)
+ {
+ return base.List.IndexOf(column);
+ }
+
+ /// <summary>
+ /// Gets the index of the column with the given name (the name is not case sensitive).
+ /// </summary>
+ /// <param name="columnName">The name of the column to find.</param>
+ /// <returns>The zero-based index of the column with the specified name, or -1 if the column doesn't exist in the collection.</returns>
+ public int IndexOf(string columnName)
+ {
+
+ DataColumn column = this[columnName];
+
+ if (column != null)
+ {
+ return IndexOf(column);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ /// <summary>
+ /// Raises the OnCollectionChanged event.
+ /// </summary>
+ /// <param name="ccevent">A CollectionChangeEventArgs that contains the event data.</param>
+ protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ {
+ CollectionChanged(this, ccevent);
+ }
+ }
+
+ /// <summary>
+ /// Raises the OnCollectionChanging event.
+ /// </summary>
+ /// <param name="ccevent">A CollectionChangeEventArgs that contains the event data.</param>
+ protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ {
+ //FIXME: this is not right
+ //CollectionChanged(this, ccevent);
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// Removes the specified DataColumn object from the collection.
+ /// </summary>
+ /// <param name="column">The DataColumn to remove.</param>
+ public void Remove(DataColumn column)
+ {
+ //TODO: can remove first with exceptions
+ //and OnChanging Event
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Remove, this);
+
+ int ordinal = column.Ordinal;
+ base.List.Remove(column);
+
+ //Update the ordinals
+ for( int i = ordinal ; i < this.Count ; i ++ )
+ {
+ this[i].SetOrdinal( i );
+ }
+
+ OnCollectionChanged(e);
+ return;
+ }
+
+ /// <summary>
+ /// Removes the DataColumn object with the specified name from the collection.
+ /// </summary>
+ /// <param name="name">The name of the column to remove.</param>
+ public void Remove(string name)
+ {
+ DataColumn column = this[name];
+ Remove( column );
+ }
+
+ /// <summary>
+ /// Removes the column at the specified index from the collection.
+ /// </summary>
+ /// <param name="index">The index of the column to remove.</param>
+ public void RemoveAt(int index)
+ {
+ DataColumn column = this[index];
+ Remove( column );
+ }
+
+ /// <summary>
+ /// Occurs when the columns collection changes, either by adding or removing a column.
+ /// </summary>
+ public event CollectionChangeEventHandler CollectionChanged;
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs b/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs
new file mode 100755
index 00000000000..4f94d92726d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnPropertyDescriptor.cs
@@ -0,0 +1,149 @@
+//
+// System.Data.DataColumnPropertyDescriptor.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c) copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Data.Common;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Data
+{
+ public class DataColumnPropertyDescriptor : PropertyDescriptor
+ {
+ private bool readOnly = true;
+ private Type componentType = null;
+ private Type propertyType = null;
+ private PropertyInfo prop = null;
+ private int columnIndex = 0;
+
+ public DataColumnPropertyDescriptor (string name, int columnIndex, Attribute [] attrs)
+ : base (name, attrs)
+ {
+ this.columnIndex = columnIndex;
+ }
+
+ public void SetReadOnly (bool value)
+ {
+ readOnly = value;
+ }
+
+ public void SetComponentType (Type type)
+ {
+ componentType = type;
+ }
+
+ public void SetPropertyType (Type type)
+ {
+ propertyType = type;
+ }
+
+ private PropertyInfo GetPropertyInfo ()
+ {
+ string defaultMemberName = "";
+ object[] attribs = componentType.GetCustomAttributes (true);
+
+ for (int at = 0; at < attribs.Length; at++) {
+ if (attribs[at] is DefaultMemberAttribute) {
+ defaultMemberName = ((DefaultMemberAttribute) attribs[at]).MemberName;
+ break;
+ }
+ }
+
+ // FIXME: what do I do if a DefaultMemeberAttribute is not found?
+ // should I try looking for DefaultPropertyAttribute?
+ if (defaultMemberName.Equals(""))
+ throw new Exception("Default property not found.");
+
+ Type[] parmTypes = new Type[1];
+ parmTypes[0] = propertyType;
+ PropertyInfo propertyInfo = componentType.GetProperty (defaultMemberName, parmTypes);
+ return propertyInfo;
+ }
+
+ public override object GetValue (object component)
+ {
+ // FIXME: what is the correct way to Get a Value?
+ if(componentType == typeof(DataRowView) && component is DataRowView) {
+ DataRowView drv = (DataRowView) component;
+ return drv[base.Name];
+ }
+ else if(componentType == typeof(DbDataRecord) && component is DbDataRecord) {
+ DbDataRecord dr = (DbDataRecord) component;
+ return dr[columnIndex];
+ }
+ throw new InvalidOperationException();
+
+ /*
+ if (prop == null)
+ prop = GetPropertyInfo ();
+
+ // FIXME: should I allow multiple parameters?
+ object[] parms = new object[1];
+ parms[0] = base.Name;
+ return prop.GetValue (component, parms);
+ */
+ }
+
+ public override void SetValue(object component, object value)
+ {
+ DataRowView drv = (DataRowView) component;
+ drv[base.Name] = value;
+ /*
+ if (prop == null)
+ prop = GetPropertyInfo ();
+
+ if (readOnly == true) {
+ // FIXME: what really happens if read only?
+ throw new Exception("Property is ReadOnly");
+ }
+
+ // FIXME: should I allow multiple parameters?
+ object[] parms = new Object[1];
+ parms[0] = base.Name;
+ prop.SetValue (component, value, parms);
+ */
+ }
+
+ [MonoTODO]
+ public override void ResetValue(object component)
+ {
+ // FIXME:
+ }
+
+ [MonoTODO]
+ public override bool CanResetValue(object component)
+ {
+ return false; // FIXEME
+ }
+
+ [MonoTODO]
+ public override bool ShouldSerializeValue(object component)
+ {
+ return false;
+ }
+
+ public override Type ComponentType {
+ get {
+ return componentType;
+ }
+ }
+
+ public override bool IsReadOnly {
+ get {
+ return readOnly;
+ }
+ }
+
+ public override Type PropertyType {
+ get {
+ return propertyType;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataException.cs b/mcs/class/System.Data/System.Data/DataException.cs
new file mode 100644
index 00000000000..3a512de87f0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataException.cs
@@ -0,0 +1,37 @@
+//
+// System.Data.DataException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class DataException : SystemException
+ {
+ public DataException ()
+ : base (Locale.GetText ("A Data exception has occurred"))
+ {
+ }
+
+ public DataException (string message)
+ : base (message)
+ {
+ }
+
+ protected DataException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public DataException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRelation.cs b/mcs/class/System.Data/System.Data/DataRelation.cs
new file mode 100644
index 00000000000..16984c90ee9
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRelation.cs
@@ -0,0 +1,188 @@
+//
+// System.Data.DataRelation.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C) 2002 Daniel Morgan
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.ComponentModel;
+using System.Runtime.Serialization;
+
+namespace System.Data
+{
+ /// <summary>
+ /// DataRelation is used for a parent/child relationship
+ /// between two DataTable objects
+ /// </summary>
+ [DefaultProperty ("RelationName")]
+ [Serializable]
+ public class DataRelation {
+
+ #region Constructors
+
+ [MonoTODO]
+ public DataRelation (string relationName, DataColumn parentColumn, DataColumn childColumn)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRelation (string relationName, DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRelation (string relationName, DataColumn parentColumn, DataColumn childColumn, bool createConstraints)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRelation (string relationName, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ [Browsable (false)]
+ public DataRelation (string relationName, string parentTableName, string childTableName, string[] parentColumnNames, string[] childColumnNames, bool nested)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the child columns of this relation.")]
+ public virtual DataColumn[] ChildColumns {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual ForeignKeyConstraint ChildKeyConstraint {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual DataTable ChildTable {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public virtual DataSet DataSet {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds custom user information.")]
+ public PropertyCollection ExtendedProperties {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether relations are nested.")]
+ [DefaultValue (false)]
+ public virtual bool Nested {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the parent columns of this relation.")]
+ public virtual DataColumn[] ParentColumns {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual UniqueConstraint ParentKeyConstraint {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual DataTable ParentTable {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("The name used to look up this relation in the Relations collection of a DataSet.")]
+ [DefaultValue ("")]
+ public virtual string RelationName {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected void CheckStateForProperty ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal void OnPropertyChanging (PropertyChangedEventArgs pcevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal void RaisePropertyChanging (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRelationCollection.cs b/mcs/class/System.Data/System.Data/DataRelationCollection.cs
new file mode 100644
index 00000000000..455135f97ca
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRelationCollection.cs
@@ -0,0 +1,343 @@
+//
+// System.Data.DataRelationCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Daniel Morgan <danmorg@sc.rr.com>
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Chris Podurgiel
+// (C) 2002 Daniel Morgan
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data {
+ /// <summary>
+ /// Represents the collection of DataRelation objects for this DataSet.
+ /// </summary>
+ [DefaultEvent ("CollectionChanged")]
+ [Serializable]
+ public abstract class DataRelationCollection : InternalDataCollectionBase
+ {
+ private int defaultNameIndex;
+ private bool inTransition;
+
+ /// <summary>
+ /// Initializes a new instance of the DataRelationCollection class.
+ /// </summary>
+ protected DataRelationCollection ()
+ : base ()
+ {
+ defaultNameIndex = 1;
+ inTransition = false;
+ }
+
+ /// <summary>
+ /// Gets the DataRelation object specified by name.
+ /// </summary>
+ public abstract DataRelation this[string name]{get;}
+
+ /// <summary>
+ /// Gets the DataRelation object at the specified index.
+ /// </summary>
+ public abstract DataRelation this[int index]{get;}
+
+
+ #region Add Methods
+ /// <summary>
+ /// Adds a DataRelation to the DataRelationCollection.
+ /// </summary>
+ /// <param name="relation">The DataRelation to add to the collection.</param>
+ [MonoTODO]
+ public void Add(DataRelation relation)
+ {
+ if(List != null)
+ {
+ //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ List.Add(relation);
+ //OnCollectionChanged(e);
+ }
+ return;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection. The name is defaulted.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is fired if it succeeds.
+ /// </summary>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <param name="childColumn">child column of relation.</param>
+ /// <returns>The created DataRelation.</returns>
+ [MonoTODO]
+ public virtual DataRelation Add(DataColumn parentColumn, DataColumn childColumn)
+ {
+
+ if(parentColumn == null)
+ {
+ throw new ArgumentNullException("parentColumn");
+ }
+ else if( childColumn == null)
+ {
+ throw new ArgumentNullException("childColumn");
+ }
+
+ // FIXME: temporarily commented so we can compile
+ /*
+ if(parentColumn.Table.DataSet != childColumn.Table.DataSet)
+ {
+ throw new InvalidConstraintException("my ex");
+ }
+ */
+
+ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumn, childColumn);
+ //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ List.Add(dataRelation);
+ //OnCollectionChanged(e);
+ defaultNameIndex++;
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection. The name is defaulted.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <returns>The created DataRelation.</returns>
+ [MonoTODO]
+ public virtual DataRelation Add(DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumns, childColumns);
+ List.Add(dataRelation);
+ defaultNameIndex++;
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive).
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="name">The name of the relation.</param>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <returns>The created DataRelation.</returns>
+ /// <returns></returns>
+ [MonoTODO]
+ public virtual DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn);
+ List.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a DataRelation with the specified name, and arrays of parent and child columns, and adds it to the collection.
+ /// </summary>
+ /// <param name="name">The name of the DataRelation to create.</param>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <returns>The created DataRelation.</returns>
+ [MonoTODO]
+ public virtual DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns);
+ List.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive).
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="name">The name of the relation.</param>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <param name="childColumn">child column of relation.</param>
+ /// <param name="createConstraints">true to create constraints; otherwise false. (default is true)</param>
+ /// <returns>The created DataRelation.</returns>
+ [MonoTODO]
+ public virtual DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn, bool createConstraints)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn, createConstraints);
+ List.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a DataRelation with the specified name, arrays of parent and child columns,
+ /// and value specifying whether to create a constraint, and adds it to the collection.
+ /// </summary>
+ /// <param name="name">The name of the DataRelation to create.</param>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <param name="createConstraints">true to create a constraint; otherwise false.</param>
+ /// <returns>The created DataRelation.</returns>
+ [MonoTODO]
+ public virtual DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns, createConstraints);
+ AddCore(dataRelation);
+ List.Add(dataRelation);
+ return dataRelation;
+ }
+ #endregion
+
+ /// <summary>
+ /// Performs verification on the table.
+ /// </summary>
+ /// <param name="relation">The relation to check.</param>
+ [MonoTODO]
+ protected virtual void AddCore(DataRelation relation)
+ {
+ if (relation == null)
+ {
+ //TODO: Issue a good exception message.
+ throw new ArgumentNullException();
+ }
+ else if(List.IndexOf(relation) != -1)
+ {
+ //TODO: Issue a good exception message.
+ throw new ArgumentException();
+ }
+ else if(List.Contains(relation.RelationName))
+ {
+ //TODO: Issue a good exception message.
+ throw new DuplicateNameException("A Relation named " + relation.RelationName + " already belongs to this DataSet.");
+ }
+ }
+
+ /// <summary>
+ /// Copies the elements of the specified DataRelation array to the end of the collection.
+ /// </summary>
+ /// <param name="relations">The array of DataRelation objects to add to the collection.</param>
+ [MonoTODO]
+ public virtual void AddRange(DataRelation[] relations)
+ {
+ //TODO: Implement
+
+ DataSet dataSet = GetDataSet();
+
+ throw new NotImplementedException ();
+
+ /*
+ foreach(DataRelation dataRelation in relations)
+ {
+
+ }
+ */
+
+ }
+
+ [MonoTODO]
+ public virtual bool CanRemove(DataRelation relation)
+ {
+ //TODO: Implement.
+ return false;
+ }
+
+ public virtual void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool Contains(string name)
+ {
+ return false;
+ }
+
+ private CollectionChangeEventArgs CreateCollectionChangeEvent (CollectionChangeAction action)
+ {
+ return new CollectionChangeEventArgs (action, this);
+ }
+
+ protected abstract DataSet GetDataSet();
+
+ public virtual int IndexOf(DataRelation relation)
+ {
+ return List.IndexOf(relation);
+ }
+
+ public virtual int IndexOf(string relationName)
+ {
+ return List.IndexOf(this[relationName]);
+ }
+
+ protected virtual void OnCollectionChanged (CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ CollectionChanged (this, ccevent);
+ }
+
+ [MonoTODO]
+ protected internal virtual void OnCollectionChanging (CollectionChangeEventArgs ccevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Remove (DataRelation relation)
+ {
+ RemoveCore (relation);
+ List.Remove (relation);
+ OnCollectionChanged (CreateCollectionChangeEvent (CollectionChangeAction.Remove));
+ }
+
+ public void Remove (string name)
+ {
+ Remove ((DataRelation) List[IndexOf (name)]);
+ }
+
+ public void RemoveAt (int index)
+ {
+ List.RemoveAt (index);
+ }
+
+ [MonoTODO]
+ protected virtual void RemoveCore(DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [ResDescriptionAttribute ("Occurs whenever this collection's membership changes.")]
+ public event CollectionChangeEventHandler CollectionChanged;
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs
new file mode 100644
index 00000000000..c004a3978c2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRow.cs
@@ -0,0 +1,750 @@
+//
+// System.Data.DataRow.cs
+//
+// Author:
+// Rodrigo Moya <rodrigo@ximian.com>
+// Daniel Morgan <danmorg@sc.rr.com>
+// Tim Coleman <tim@timcoleman.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Data {
+ /// <summary>
+ /// Represents a row of data in a DataTable.
+ /// </summary>
+ [Serializable]
+ public class DataRow
+ {
+ #region Fields
+
+ private DataTable _table;
+
+ private object[] original;
+ private object[] proposed;
+ private object[] current;
+
+ private string[] columnErrors;
+ private string rowError;
+ private DataRowState rowState;
+ internal int xmlRowID = 0;
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure and is not intended to be
+ /// used directly from your code.
+ /// </summary>
+ protected internal DataRow (DataRowBuilder builder)
+ {
+ _table = builder.Table;
+
+ original = null;
+ proposed = null;
+ current = new object[_table.Columns.Count];
+
+ columnErrors = new string[_table.Columns.Count];
+ rowError = String.Empty;
+
+ //rowState = DataRowState.Unchanged;
+
+ //on first creating a DataRow it is always detached.
+ rowState = DataRowState.Detached;
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets a value indicating whether there are errors in a row.
+ /// </summary>
+ public bool HasErrors {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the data stored in the column specified by name.
+ /// </summary>
+ public object this[string columnName] {
+ [MonoTODO] //FIXME: will return different values depending on DataRowState
+ get { return this[columnName, DataRowVersion.Current]; }
+ [MonoTODO]
+ set {
+ DataColumn column = _table.Columns[columnName];
+ if (column == null)
+ throw new IndexOutOfRangeException ();
+ this[column] = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the data stored in specified DataColumn
+ /// </summary>
+ public object this[DataColumn column] {
+ [MonoTODO] //FIXME: will return different values depending on DataRowState
+ get { return this[column, DataRowVersion.Current]; }
+
+ [MonoTODO]
+ set {
+ value = (value == null) ? DBNull.Value : value;
+ bool objIsDBNull = value.Equals(DBNull.Value);
+ if (column == null)
+ throw new ArgumentNullException (Locale.GetText ("'column' argument cannot be null."));
+ int columnIndex = _table.Columns.IndexOf (column);
+ if (columnIndex == -1)
+ throw new ArgumentException ();
+ if(column.DataType != value.GetType ()) {
+ if(objIsDBNull == true && column.AllowDBNull == false)
+ throw new InvalidCastException ();
+ //else if(objIsDBNull == false)
+ // throw new InvalidCastException ();
+ }
+
+ if (rowState == DataRowState.Deleted)
+ throw new DeletedRowInaccessibleException ();
+
+ _table.ChangingDataColumn (this, column, value);
+
+ //MS Implementation doesn't seem to create the proposed or original
+ //set of values when a datarow has just been created or added to the
+ //DataTable and AcceptChanges() has not been called yet.
+
+ if(rowState == DataRowState.Detached || rowState == DataRowState.Added) {
+ if(objIsDBNull)
+ current[columnIndex] = DBNull.Value;
+ else
+ current[columnIndex] = value;
+ _table.ChangedDataColumn (this, column, value);
+ }
+ else {
+ BeginEdit (); // implicitly called
+
+ if(objIsDBNull)
+ proposed[columnIndex] = DBNull.Value;
+ else
+ proposed[columnIndex] = value;
+
+ _table.ChangedDataColumn (this, column, value);
+
+ rowState = DataRowState.Modified;
+ current [columnIndex] = proposed[columnIndex];
+ proposed[columnIndex] = null;
+ }
+
+ //Don't know if this is the rigth thing to do,
+ //but it fixes my test. I believe the MS docs only say this
+ //method is implicitly called when calling AcceptChanges()
+
+ //EndEdit (); // is this the right thing to do?
+
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the data stored in column specified by index.
+ /// </summary>
+ public object this[int columnIndex] {
+ [MonoTODO] //FIXME: not always supposed to return current
+ get { return this[columnIndex, DataRowVersion.Current]; }
+ [MonoTODO]
+ set {
+ DataColumn column = _table.Columns[columnIndex]; //FIXME: will throw
+ if (column == null)
+ throw new IndexOutOfRangeException ();
+ this[column] = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the specified version of data stored in the named column.
+ /// </summary>
+ public object this[string columnName, DataRowVersion version] {
+ [MonoTODO]
+ get {
+ DataColumn column = _table.Columns[columnName]; //FIXME: will throw
+ if (column == null)
+ throw new IndexOutOfRangeException ();
+ return this[column, version];
+ }
+ }
+
+ /// <summary>
+ /// Gets the specified version of data stored in the specified DataColumn.
+ /// </summary>
+ public object this[DataColumn column, DataRowVersion version] {
+ get {
+ if (column == null)
+ throw new ArgumentNullException ();
+
+ int columnIndex = _table.Columns.IndexOf (column);
+
+ if (columnIndex == -1)
+ throw new ArgumentException ();
+
+ if (version == DataRowVersion.Default)
+ return column.DefaultValue;
+
+ if (!HasVersion (version))
+ throw new VersionNotFoundException (Locale.GetText ("There is no " + version.ToString () + " data to access."));
+
+ switch (version)
+ {
+ case DataRowVersion.Proposed:
+ return proposed[columnIndex];
+ case DataRowVersion.Current:
+ return current[columnIndex];
+ case DataRowVersion.Original:
+ return original[columnIndex];
+ default:
+ throw new ArgumentException ();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the data stored in the column, specified by index and version of the data to
+ /// retrieve.
+ /// </summary>
+ public object this[int columnIndex, DataRowVersion version] {
+ [MonoTODO]
+ get {
+ DataColumn column = _table.Columns[columnIndex]; //FIXME: throws
+ if (column == null)
+ throw new IndexOutOfRangeException ();
+ return this[column, version];
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets all of the values for this row through an array.
+ /// </summary>
+ [MonoTODO]
+ public object[] ItemArray {
+ get { return current; }
+ set {
+ if (value.Length > _table.Columns.Count)
+ throw new ArgumentException ();
+
+ if (rowState == DataRowState.Deleted)
+ throw new DeletedRowInaccessibleException ();
+
+ for (int i = 0; i < value.Length; i += 1)
+ {
+ if (_table.Columns[i].ReadOnly && value[i] != this[i])
+ throw new ReadOnlyException ();
+
+ if (value[i] == null)
+ {
+ if (!_table.Columns[i].AllowDBNull)
+ throw new NoNullAllowedException ();
+ continue;
+ }
+
+ //FIXME: int strings can be converted to ints
+ if (_table.Columns[i].DataType != value[i].GetType())
+ throw new InvalidCastException ();
+ }
+
+ //FIXME: BeginEdit() not correct
+ BeginEdit (); // implicitly called
+ rowState = DataRowState.Modified;
+
+ //FIXME: this isn't correct. a shorter array can set the first few values
+ //and not touch the rest. So not all the values will get replaced
+ proposed = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the custom error description for a row.
+ /// </summary>
+ public string RowError {
+ get { return rowError; }
+ set { rowError = value; }
+ }
+
+ /// <summary>
+ /// Gets the current state of the row in regards to its relationship to the
+ /// DataRowCollection.
+ /// </summary>
+ public DataRowState RowState {
+ get { return rowState; }
+ }
+
+ //FIXME?: Couldn't find a way to set the RowState when adding the DataRow
+ //to a Datatable so I added this method. Delete if there is a better way.
+ internal DataRowState RowStateInternal {
+ set { rowState = value;}
+ }
+
+ /// <summary>
+ /// Gets the DataTable for which this row has a schema.
+ /// </summary>
+ public DataTable Table {
+ get { return _table; }
+ }
+
+ /// <summary>
+ /// Gets and sets index of row. This is used from
+ /// XmlDataDocument.
+ // </summary>
+ internal int XmlRowID {
+ get { return xmlRowID; }
+ set { xmlRowID = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
+ /// Commits all the changes made to this row since the last time AcceptChanges was
+ /// called.
+ /// </summary>
+ [MonoTODO]
+ public void AcceptChanges ()
+ {
+
+ if(rowState == DataRowState.Added)
+ {
+ //Instantiate original and proposed values so that we can call
+ //EndEdit()
+ this.BeginEdit();
+ }
+
+ this.EndEdit ();
+
+ switch (rowState)
+ {
+ case DataRowState.Added:
+ case DataRowState.Detached:
+ case DataRowState.Modified:
+ rowState = DataRowState.Unchanged;
+ break;
+ case DataRowState.Deleted:
+ _table.Rows.Remove (this); //FIXME: this should occur in end edit
+ break;
+ }
+
+ //MS implementation assigns the Proposed values
+ //to both current and original and keeps original after calling AcceptChanges
+ //Copy proposed to original in this.EndEdit()
+ //original = null;
+ }
+
+ /// <summary>
+ /// Begins an edit operation on a DataRow object.
+ /// </summary>
+ [MonoTODO]
+ public void BeginEdit()
+ {
+ if (rowState == DataRowState.Deleted)
+ throw new DeletedRowInaccessibleException ();
+
+ if (!HasVersion (DataRowVersion.Proposed))
+ {
+ proposed = new object[_table.Columns.Count];
+ Array.Copy (current, proposed, _table.Columns.Count);
+ }
+ //TODO: Suspend validation
+
+ //FIXME: this doesn't happen on begin edit
+ if (!HasVersion (DataRowVersion.Original))
+ {
+ original = new object[_table.Columns.Count];
+ Array.Copy (current, original, _table.Columns.Count);
+ }
+ }
+
+ /// <summary>
+ /// Cancels the current edit on the row.
+ /// </summary>
+ [MonoTODO]
+ public void CancelEdit ()
+ {
+ //FIXME: original doesn't get erased on CancelEdit
+ //TODO: Events
+ if (HasVersion (DataRowVersion.Proposed))
+ {
+ original = null;
+ proposed = null;
+ rowState = DataRowState.Unchanged;
+ }
+ }
+
+ /// <summary>
+ /// Clears the errors for the row, including the RowError and errors set with
+ /// SetColumnError.
+ /// </summary>
+ public void ClearErrors ()
+ {
+ rowError = String.Empty;
+ columnErrors = new String[_table.Columns.Count];
+ }
+
+ /// <summary>
+ /// Deletes the DataRow.
+ /// </summary>
+ [MonoTODO]
+ public void Delete ()
+ {
+ switch (rowState) {
+ case DataRowState.Added:
+ Table.Rows.Remove (this);
+ break;
+ case DataRowState.Deleted:
+ throw new DeletedRowInaccessibleException ();
+ default:
+ //TODO: Events, Constraints
+ rowState = DataRowState.Deleted;
+ break;
+ }
+ }
+
+ /// <summary>
+ /// Ends the edit occurring on the row.
+ /// </summary>
+ [MonoTODO]
+ public void EndEdit ()
+ {
+ if (HasVersion (DataRowVersion.Proposed))
+ {
+ rowState = DataRowState.Modified;
+
+ //Calling next method validates UniqueConstraints
+ //and ForeignKeys.
+ _table.Rows.ValidateDataRowInternal(this);
+
+ Array.Copy (proposed, current, _table.Columns.Count);
+
+ //FIXME: MS implementation assigns the proposed values to
+ //the original values. Should this be done here or on the
+ //AcceptChanges() method?
+ Array.Copy (proposed, original, _table.Columns.Count);
+
+ proposed = null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the child rows of this DataRow using the specified DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetChildRows (DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the child rows of a DataRow using the specified RelationName of a
+ /// DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetChildRows (string relationName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the child rows of a DataRow using the specified DataRelation, and
+ /// DataRowVersion.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetChildRows (DataRelation relation, DataRowVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the child rows of a DataRow using the specified RelationName of a
+ /// DataRelation, and DataRowVersion.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetChildRows (string relationName, DataRowVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the error description of the specified DataColumn.
+ /// </summary>
+ public string GetColumnError (DataColumn column)
+ {
+ return GetColumnError (_table.Columns.IndexOf(column));
+ }
+
+ /// <summary>
+ /// Gets the error description for the column specified by index.
+ /// </summary>
+ public string GetColumnError (int columnIndex)
+ {
+ if (columnIndex < 0 || columnIndex >= columnErrors.Length)
+ throw new IndexOutOfRangeException ();
+
+ return columnErrors[columnIndex];
+ }
+
+ /// <summary>
+ /// Gets the error description for the column, specified by name.
+ /// </summary>
+ public string GetColumnError (string columnName)
+ {
+ return GetColumnError (_table.Columns.IndexOf(columnName));
+ }
+
+ /// <summary>
+ /// Gets an array of columns that have errors.
+ /// </summary>
+ public DataColumn[] GetColumnsInError ()
+ {
+ ArrayList dataColumns = new ArrayList ();
+
+ for (int i = 0; i < columnErrors.Length; i += 1)
+ {
+ if (columnErrors[i] != String.Empty)
+ dataColumns.Add (_table.Columns[i]);
+ }
+
+ return (DataColumn[])(dataColumns.ToArray ());
+ }
+
+ /// <summary>
+ /// Gets the parent row of a DataRow using the specified DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public DataRow GetParentRow (DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent row of a DataRow using the specified RelationName of a
+ /// DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public DataRow GetParentRow (string relationName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent row of a DataRow using the specified DataRelation, and
+ /// DataRowVersion.
+ /// </summary>
+ [MonoTODO]
+ public DataRow GetParentRow (DataRelation relation, DataRowVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent row of a DataRow using the specified RelationName of a
+ /// DataRelation, and DataRowVersion.
+ /// </summary>
+ [MonoTODO]
+ public DataRow GetParentRow (string relationName, DataRowVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent rows of a DataRow using the specified DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetParentRows (DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent rows of a DataRow using the specified RelationName of a
+ /// DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetParentRows (string relationName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent rows of a DataRow using the specified DataRelation, and
+ /// DataRowVersion.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetParentRows (DataRelation relation, DataRowVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the parent rows of a DataRow using the specified RelationName of a
+ /// DataRelation, and DataRowVersion.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] GetParentRows (string relationName, DataRowVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether a specified version exists.
+ /// </summary>
+ public bool HasVersion (DataRowVersion version)
+ {
+ switch (version)
+ {
+ case DataRowVersion.Default:
+ return true;
+ case DataRowVersion.Proposed:
+ return (proposed != null);
+ case DataRowVersion.Current:
+ return (current != null);
+ case DataRowVersion.Original:
+ return (original != null);
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the specified DataColumn contains a null value.
+ /// </summary>
+ public bool IsNull (DataColumn column)
+ {
+ return (this[column] == null);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the column at the specified index contains a null
+ /// value.
+ /// </summary>
+ public bool IsNull (int columnIndex)
+ {
+ return (this[columnIndex] == null);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the named column contains a null value.
+ /// </summary>
+ public bool IsNull (string columnName)
+ {
+ return (this[columnName] == null);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the specified DataColumn and DataRowVersion
+ /// contains a null value.
+ /// </summary>
+ public bool IsNull (DataColumn column, DataRowVersion version)
+ {
+ return (this[column, version] == null);
+ }
+
+ /// <summary>
+ /// Rejects all changes made to the row since AcceptChanges was last called.
+ /// </summary>
+ public void RejectChanges ()
+ {
+ // If original is null, then nothing has happened since AcceptChanges
+ // was last called. We have no "original" to go back to.
+ if (original != null)
+ {
+ Array.Copy (original, current, _table.Columns.Count);
+
+ _table.ChangedDataRow (this, DataRowAction.Rollback);
+ CancelEdit ();
+ switch (rowState)
+ {
+ case DataRowState.Added:
+ _table.Rows.Remove (this);
+ break;
+ case DataRowState.Modified:
+ rowState = DataRowState.Unchanged;
+ break;
+ case DataRowState.Deleted:
+ rowState = DataRowState.Unchanged;
+ break;
+ }
+
+ }
+ else {
+ // If rows are just loaded via Xml the original values are null.
+ // So in this case we have to remove all columns.
+ // FIXME: I'm not realy sure, does this break something else, but
+ // if so: FIXME ;)
+
+ if ((rowState & DataRowState.Added) > 0)
+ _table.Rows.Remove (this);
+ }
+ }
+
+ /// <summary>
+ /// Sets the error description for a column specified as a DataColumn.
+ /// </summary>
+ public void SetColumnError (DataColumn column, string error)
+ {
+ SetColumnError (_table.Columns.IndexOf (column), error);
+ }
+
+ /// <summary>
+ /// Sets the error description for a column specified by index.
+ /// </summary>
+ public void SetColumnError (int columnIndex, string error)
+ {
+ if (columnIndex < 0 || columnIndex >= columnErrors.Length)
+ throw new IndexOutOfRangeException ();
+ columnErrors[columnIndex] = error;
+ }
+
+ /// <summary>
+ /// Sets the error description for a column specified by name.
+ /// </summary>
+ public void SetColumnError (string columnName, string error)
+ {
+ SetColumnError (_table.Columns.IndexOf (columnName), error);
+ }
+
+ /// <summary>
+ /// Sets the value of the specified DataColumn to a null value.
+ /// </summary>
+ [MonoTODO]
+ protected void SetNull (DataColumn column)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Sets the parent row of a DataRow with specified new parent DataRow.
+ /// </summary>
+ [MonoTODO]
+ public void SetParentRow (DataRow parentRow)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Sets the parent row of a DataRow with specified new parent DataRow and
+ /// DataRelation.
+ /// </summary>
+ [MonoTODO]
+ public void SetParentRow (DataRow parentRow, DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRowAction.cs b/mcs/class/System.Data/System.Data/DataRowAction.cs
new file mode 100644
index 00000000000..b6423b374ca
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowAction.cs
@@ -0,0 +1,28 @@
+//
+// System.Data.DataRowAction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Describes the action taken on a DataRow.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DataRowAction
+ {
+ Nothing = 0,
+ Delete = 1,
+ Change = 2,
+ Rollback = 4,
+ Commit = 8,
+ Add = 16
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowBuilder.cs b/mcs/class/System.Data/System.Data/DataRowBuilder.cs
new file mode 100644
index 00000000000..0e78cee8028
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowBuilder.cs
@@ -0,0 +1,52 @@
+//
+// System.Data.DataRowBuilder
+//
+// Author:
+// Tim Coleman <tim@timcoleman.com>
+//
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// A supporting class that exists solely to support
+ /// DataRow and DataTable
+ /// Implementation of something meaningful will follow.
+ /// Presumably, what that is will become apparent when
+ /// constructing DataTable and DataRow.
+ /// </summary>
+
+ public class DataRowBuilder
+ {
+ #region Fields
+
+ private DataTable table;
+
+ #endregion
+
+ #region Constructors
+
+ // DataRowBuilder on .NET takes 3 arguments, a
+ // DataTable and two Int32. For consistency, this
+ // class will also take those arguments.
+
+ internal DataRowBuilder (DataTable table, Int32 x, Int32 y)
+ {
+ this.table = table;
+ }
+
+ #endregion
+
+ #region Properties
+
+ protected internal DataTable Table {
+ get { return table; }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs b/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs
new file mode 100644
index 00000000000..42fc543a8c0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowChangeEventArgs.cs
@@ -0,0 +1,41 @@
+//
+// System.Data.DataRowChangeEventArgs.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Ximian, Inc 2002
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// argument data for events RowChanged, RowChanging,
+ /// OnRowDeleting, and OnRowDeleted
+ /// </summary>
+ public class DataRowChangeEventArgs : EventArgs {
+
+ private DataRow row;
+ private DataRowAction action;
+
+ public DataRowChangeEventArgs(DataRow row,
+ DataRowAction action) {
+
+ this.row = row;
+ this.action = action;
+ }
+
+ public DataRowAction Action {
+ get {
+ return action;
+ }
+ }
+
+ public DataRow Row {
+ get {
+ return row;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs b/mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs
new file mode 100644
index 00000000000..4959e38f3bf
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.DataRowChangeEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the RowChanging, RowChanged, RowDeleting, and RowDeleted events of a DataTable.
+ /// </summary>
+ [Serializable]
+ public delegate void DataRowChangeEventHandler(object sender, DataRowChangeEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowCollection.cs b/mcs/class/System.Data/System.Data/DataRowCollection.cs
new file mode 100644
index 00000000000..9a52a654fb2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowCollection.cs
@@ -0,0 +1,171 @@
+//
+// System.Data.DataRowCollection.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Ximian, Inc 2002
+// (C) Copyright 2002 Tim Coleman
+// (C) Copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Collection of DataRows in a DataTable
+ /// </summary>
+ [Serializable]
+ public class DataRowCollection : InternalDataCollectionBase
+ {
+ private DataTable table;
+
+ /// <summary>
+ /// Internal constructor used to build a DataRowCollection.
+ /// </summary>
+ internal DataRowCollection (DataTable table) : base ()
+ {
+ this.table = table;
+ }
+
+ /// <summary>
+ /// Gets the row at the specified index.
+ /// </summary>
+ public DataRow this[int index]
+ {
+ get {
+ if (index >= Count)
+ throw new IndexOutOfRangeException ("There is no row at position " + index + ".");
+
+ return (DataRow) list[index];
+ }
+ }
+
+ /// <summary>
+ /// This member overrides InternalDataCollectionBase.List
+ /// </summary>
+ protected override ArrayList List
+ {
+ get { return list; }
+ }
+
+ /// <summary>
+ /// Adds the specified DataRow to the DataRowCollection object.
+ /// </summary>
+ public void Add (DataRow row)
+ {
+ //TODO: AutoIncrement
+ //TODO: validation
+ list.Add (row);
+ row.RowStateInternal = DataRowState.Added;
+ row.Table.ChangedDataRow (row, DataRowAction.Add);
+ }
+
+ /// <summary>
+ /// Creates a row using specified values and adds it to the DataRowCollection.
+ /// </summary>
+ public virtual DataRow Add (object[] values)
+ {
+ DataRow row = table.NewRow ();
+ row.ItemArray = values;
+ Add (row);
+ return row;
+ }
+
+ /// <summary>
+ /// Clears the collection of all rows.
+ /// </summary>
+ [MonoTODO]
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the primary key of any row in the collection contains
+ /// the specified value.
+ /// </summary>
+ [MonoTODO]
+ public bool Contains (object key)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the primary key column(s) of any row in the
+ /// collection contains the values specified in the object array.
+ /// </summary>
+ [MonoTODO]
+ public bool Contains (object[] keys)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the row specified by the primary key value.
+ /// </summary>
+ [MonoTODO]
+ public DataRow Find (object key)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Gets the row containing the specified primary key values.
+ /// </summary>
+ [MonoTODO]
+ public DataRow Find (object[] keys)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Inserts a new row into the collection at the specified location.
+ /// </summary>
+ public void InsertAt (DataRow row, int pos)
+ {
+ list.Insert (pos, row);
+ }
+
+ /// <summary>
+ /// Removes the specified DataRow from the collection.
+ /// </summary>
+ public void Remove (DataRow row)
+ {
+ list.Remove (row);
+ table.DeletedDataRow (row, DataRowAction.Delete);
+ }
+
+ /// <summary>
+ /// Removes the row at the specified index from the collection.
+ /// </summary>
+ public void RemoveAt (int index)
+ {
+ DataRow row = (DataRow)list [index];
+ list.RemoveAt (index);
+ table.DeletedDataRow (row, DataRowAction.Delete);
+ }
+
+ ///<summary>
+ ///Internal method used to validate a given DataRow with respect
+ ///to the DataRowCollection
+ ///</summary>
+ [MonoTODO]
+ internal void ValidateDataRowInternal(DataRow row)
+ {
+ //FIXME: this validates constraints in the order they appear
+ //in the collection. Most probably we need to do it in a
+ //specific order like unique/primary keys first, then Foreignkeys, etc
+ foreach(Constraint constraint in table.Constraints)
+ {
+ constraint.AssertConstraint(row);
+ }
+
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRowState.cs b/mcs/class/System.Data/System.Data/DataRowState.cs
new file mode 100644
index 00000000000..4e77e406203
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowState.cs
@@ -0,0 +1,26 @@
+//
+// System.Data.DataRowState.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Gets the state of a DataRow object.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DataRowState
+ {
+ Detached = 1,
+ Unchanged = 2,
+ Added = 4,
+ Deleted = 8,
+ Modified = 16
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowVersion.cs b/mcs/class/System.Data/System.Data/DataRowVersion.cs
new file mode 100644
index 00000000000..ad757946bcb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowVersion.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.DataRowVersion.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Describes the version of a DataRow.
+ /// </summary>
+ [Serializable]
+ public enum DataRowVersion
+ {
+ Original = 256,
+ Current = 512,
+ Proposed = 1024,
+ Default = 1536
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowView.cs b/mcs/class/System.Data/System.Data/DataRowView.cs
new file mode 100644
index 00000000000..3af7e3c19a1
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowView.cs
@@ -0,0 +1,265 @@
+//
+// System.Data.DataRowView.cs
+//
+// Author:
+// Rodrigo Moya <rodrigo@ximian.com>
+// Miguel de Icaza <miguel@ximian.com>
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C) Ximian, Inc 2002
+// (C) Daniel Morgan 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a customized view of a DataRow exposed as a fully featured Windows Forms control.
+ /// </summary>
+ public class DataRowView : ICustomTypeDescriptor, IEditableObject, IDataErrorInfo
+ {
+ #region Fields
+
+ DataView dataView;
+ DataRow dataRow;
+ DataRowVersion rowVersion = DataRowVersion.Default;
+
+ // FIXME: what are the defaults?
+ bool isEdit = false;
+ bool isNew = false;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal DataRowView (DataView dataView, int rowIndex) {
+ this.dataView = dataView;
+ this.dataRow = dataView.Table.Rows[rowIndex];
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void BeginEdit ()
+ {
+ // FIXME:
+ }
+
+ [MonoTODO]
+ public void CancelEdit ()
+ {
+ // FIXME:
+ }
+
+ [MonoTODO]
+ public DataView CreateChildView (DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataView CreateChildView (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Delete ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void EndEdit ()
+ {
+ // FIXME:
+ }
+
+ #endregion // Methods
+
+ #region Properties
+
+ public DataView DataView
+ {
+ [MonoTODO]
+ get {
+ return dataView;
+ }
+ }
+
+ public bool IsEdit {
+ [MonoTODO]
+ get {
+ return isEdit;
+ }
+ }
+
+ public bool IsNew {
+ [MonoTODO]
+ get {
+ return isNew;
+ }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public object this[string column] {
+ [MonoTODO]
+ get {
+ DataColumn dc = dataView.Table.Columns[column];
+ return dataRow[dc];
+ }
+ [MonoTODO]
+ set {
+ DataColumn dc = dataView.Table.Columns[column];
+ dataRow[dc] = value;
+ }
+ }
+
+ public string Error {
+ get {
+ return ""; // FIXME:
+ }
+ }
+
+ // the compiler creates a DefaultMemeberAttribute from
+ // this IndexerNameAttribute
+ public object this[int column] {
+ [MonoTODO]
+ get {
+ DataColumn dc = dataView.Table.Columns[column];
+ return dataRow[dc];
+ }
+ [MonoTODO]
+ set {
+ DataColumn dc = dataView.Table.Columns[column];
+ dataRow[dc] = value;
+
+ }
+ }
+
+ public DataRow Row {
+ [MonoTODO]
+ get {
+ return dataRow;
+ }
+ }
+
+ public DataRowVersion RowVersion {
+ [MonoTODO]
+ get {
+ return rowVersion;
+ }
+ }
+
+ #endregion // Properties
+
+ #region ICustomTypeDescriptor implementations
+
+ [MonoTODO]
+ AttributeCollection ICustomTypeDescriptor.GetAttributes ()
+ {
+ System.ComponentModel.AttributeCollection attributes;
+ attributes = AttributeCollection.Empty;
+ return attributes;
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetClassName ()
+ {
+ return "";
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetComponentName ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ TypeConverter ICustomTypeDescriptor.GetConverter ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
+ {
+ return new EventDescriptorCollection(null);
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] attributes)
+ {
+ return new EventDescriptorCollection(null);
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
+ {
+ ITypedList typedList = (ITypedList) dataView;
+ return typedList.GetItemProperties(new PropertyDescriptor[0]);
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] attributes)
+ {
+ PropertyDescriptorCollection descriptors;
+ descriptors = ((ICustomTypeDescriptor) this).GetProperties ();
+ // TODO: filter out descriptors which do not contain
+ // any of those attributes
+ // except, those descriptors
+ // that contain DefaultMemeberAttribute
+ return descriptors;
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
+ {
+ return this;
+ }
+
+ #endregion // ICustomTypeDescriptor implementations
+
+ #region IDataErrorInfo implementation
+
+ string IDataErrorInfo.Error {
+ [MonoTODO]
+ get {
+ return ""; // FIXME
+ }
+ }
+
+ string IDataErrorInfo.this[string columnName] {
+ [MonoTODO]
+ get {
+ return ""; // FIXME
+ }
+ }
+
+ #endregion // IDataErrorInfo implementation
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataSet.cs b/mcs/class/System.Data/System.Data/DataSet.cs
new file mode 100644
index 00000000000..9b600983dcc
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataSet.cs
@@ -0,0 +1,930 @@
+//
+// System.Data/DataSet.cs
+//
+// Author:
+// Christopher Podurgiel <cpodurgiel@msn.com>
+// Daniel Morgan <danmorg@sc.rr.com>
+// Rodrigo Moya <rodrigo@ximian.com>
+// Stuart Caborn <stuart.caborn@virgin.net>
+// Tim Coleman (tim@timcoleman.com)
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Threading;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Xml;
+using System.Xml.Schema;
+
+namespace System.Data {
+ /// <summary>
+ /// an in-memory cache of data
+ /// </summary>
+ [DefaultProperty ("DataSetName")]
+ [Serializable]
+ public class DataSet : MarshalByValueComponent, IListSource,
+ ISupportInitialize, ISerializable {
+
+ private string dataSetName = "NewDataSet";
+ private string _namespace = "";
+ private string prefix;
+ private bool caseSensitive;
+ private bool enforceConstraints = true;
+ private DataTableCollection tableCollection;
+ // private DataTableRelationCollection relationCollection;
+ private PropertyCollection properties;
+ private DataViewManager defaultView;
+
+ #region Constructors
+
+ [MonoTODO]
+ public DataSet() {
+ tableCollection = new DataTableCollection (this);
+ }
+
+ [MonoTODO]
+ public DataSet(string name) : this () {
+ dataSetName = name;
+ }
+
+ [MonoTODO]
+ protected DataSet(SerializationInfo info, StreamingContext context) : this () {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Public Properties
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether comparing strings within the DataSet is case sensitive.")]
+ [DefaultValue (false)]
+ public bool CaseSensitive {
+ get { return caseSensitive; }
+ set { caseSensitive = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("The name of this DataSet.")]
+ [DefaultValue ("")]
+ public string DataSetName {
+ get { return dataSetName; }
+ set { dataSetName = value; }
+ }
+
+ [DataSysDescription ("Indicates a custom \"view\" of the data contained by the DataSet. This view allows filtering, searching, and navigating through the custom data view.")]
+ [Browsable (false)]
+ public DataViewManager DefaultViewManager {
+ get {
+ if (defaultView == null)
+ defaultView = new DataViewManager (this);
+ return defaultView;
+ }
+ }
+
+ [DataSysDescription ("Indicates whether constraint rules are to be followed.")]
+ [DefaultValue (true)]
+ public bool EnforceConstraints {
+ get { return enforceConstraints; }
+ set { enforceConstraints = value; }
+ }
+
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds custom user information.")]
+ public PropertyCollection ExtendedProperties {
+ [MonoTODO]
+ get { return properties; }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("Indicates that the DataSet has errors.")]
+ public bool HasErrors {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates a locale under which to compare strings within the DataSet.")]
+ public CultureInfo Locale {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the XML uri namespace for the root element pointed at by this DataSet.")]
+ [DefaultValue ("")]
+ public string Namespace {
+ [MonoTODO]
+ get { return _namespace; }
+ [MonoTODO]
+ set {
+ //TODO - trigger an event if this happens?
+ _namespace = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the prefix of the namespace used for this DataSet.")]
+ [DefaultValue ("")]
+ public string Prefix {
+ [MonoTODO]
+ get { return prefix; }
+ [MonoTODO]
+ set {
+ //TODO - trigger an event if this happens?
+ prefix = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds the relations for this DatSet.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public DataRelationCollection Relations {
+ [MonoTODO]
+ get{
+ //return relationCollection;
+ throw new NotImplementedException();
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override ISite Site {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds the tables for this DataSet.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public DataTableCollection Tables {
+ get { return tableCollection; }
+ }
+
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void AcceptChanges()
+ {
+ foreach (DataTable tempTable in tableCollection)
+ tempTable.AcceptChanges ();
+ }
+
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual DataSet Clone()
+ {
+ DataSet Copy = new DataSet ();
+ CopyProperties (Copy);
+
+ foreach (DataTable Table in Tables) {
+ Copy.Tables.Add (Table.Clone ());
+ }
+
+ return Copy;
+ }
+
+ // Copies both the structure and data for this DataSet.
+ public DataSet Copy()
+ {
+ DataSet Copy = new DataSet ();
+ CopyProperties (Copy);
+
+ // Copy DatSet's tables
+ foreach (DataTable Table in Tables) {
+ Copy.Tables.Add (Table.Copy ());
+ }
+
+ return Copy;
+ }
+
+ [MonoTODO]
+ private void CopyProperties (DataSet Copy)
+ {
+ Copy.CaseSensitive = CaseSensitive;
+ //Copy.Container = Container
+ Copy.DataSetName = DataSetName;
+ //Copy.DefaultViewManager
+ //Copy.DesignMode
+ Copy.EnforceConstraints = EnforceConstraints;
+ //Copy.ExtendedProperties
+ //Copy.HasErrors
+ //Copy.Locale = Locale;
+ Copy.Namespace = Namespace;
+ Copy.Prefix = Prefix;
+ //Copy.Relations = Relations;
+ //Copy.Site = Site;
+
+ }
+
+ public DataSet GetChanges()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public DataSet GetChanges(DataRowState rowStates)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetXml()
+ {
+ StringWriter Writer = new StringWriter ();
+ WriteXml (Writer, XmlWriteMode.IgnoreSchema);
+ return Writer.ToString ();
+ }
+
+ public string GetXmlSchema()
+ {
+ StringWriter Writer = new StringWriter ();
+ WriteXmlSchema (Writer);
+ return Writer.ToString ();
+ }
+
+ public virtual void RejectChanges()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void Reset()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void WriteXml(Stream stream)
+ {
+ XmlWriter writer = new XmlTextWriter(stream, null );
+
+ WriteXml( writer );
+ }
+
+ ///<summary>
+ /// Writes the current data for the DataSet to the specified file.
+ /// </summary>
+ /// <param name="filename">Fully qualified filename to write to</param>
+ public void WriteXml(string fileName)
+ {
+ XmlWriter writer = new XmlTextWriter(fileName, null );
+
+ WriteXml( writer );
+ }
+
+ public void WriteXml(TextWriter writer)
+ {
+ XmlWriter xwriter = new XmlTextWriter(writer );
+
+ WriteXml( xwriter );
+ }
+
+ public void WriteXml(XmlWriter writer)
+ {
+ WriteXml( writer, XmlWriteMode.IgnoreSchema );
+ }
+
+ public void WriteXml(Stream stream, XmlWriteMode mode)
+ {
+ XmlWriter writer = new XmlTextWriter(stream, null );
+
+ WriteXml( writer, mode );
+ }
+
+ public void WriteXml(string fileName, XmlWriteMode mode)
+ {
+ XmlWriter writer = new XmlTextWriter(fileName, null );
+
+ WriteXml( writer, mode );
+ }
+
+ public void WriteXml(TextWriter writer, XmlWriteMode mode)
+ {
+ XmlWriter xwriter = new XmlTextWriter(writer);
+
+ WriteXml( xwriter, mode );
+ }
+
+ public void WriteXml(XmlWriter writer, XmlWriteMode mode)
+ {
+ ((XmlTextWriter)writer).Formatting = Formatting.Indented;
+ WriteStartElement( writer, mode, Namespace, Prefix, DataSetName );
+
+ if( mode == XmlWriteMode.WriteSchema )
+ {
+ DoWriteXmlSchema( writer );
+ }
+
+ //Write out each table in order, providing it is not
+ //part of another table structure via a nested parent relationship
+ foreach( DataTable table in Tables )
+ {
+ bool isTopLevel = true;
+ //FIXME: Uncomment this when Parentrelations is implemented
+ /*
+ foreach( DataRelation rel in table.ParentRelations )
+ {
+ if( rel.Nested )
+ {
+ isTopLevel = false;
+ break;
+ }
+ }
+ */
+
+ if( isTopLevel )
+ {
+ WriteTable( writer, table, mode );
+ }
+ }
+
+ writer.WriteEndElement();
+
+ writer.WriteEndDocument();
+ }
+
+ public void WriteXmlSchema(Stream stream)
+ {
+ XmlWriter writer = new XmlTextWriter(stream, null );
+
+ WriteXmlSchema( writer );
+ }
+
+ public void WriteXmlSchema(string fileName)
+ {
+ XmlWriter writer = new XmlTextWriter( fileName, null );
+
+ WriteXmlSchema( writer );
+ }
+
+ public void WriteXmlSchema(TextWriter writer)
+ {
+ XmlWriter xwriter = new XmlTextWriter( writer );
+
+ WriteXmlSchema( xwriter );
+ }
+
+ public void WriteXmlSchema(XmlWriter writer)
+ {
+ ((XmlTextWriter)writer).Formatting = Formatting.Indented;
+ //Create a skeleton doc and then write the schema
+ //proper which is common to the WriteXml method in schema mode
+ writer.WriteStartDocument();
+
+ DoWriteXmlSchema( writer );
+
+ writer.WriteEndDocument();
+ }
+
+ public void ReadXmlSchema(Stream stream)
+ {
+ XmlReader reader = new XmlTextReader( stream, null );
+ ReadXmlSchema( reader);
+ }
+
+ public void ReadXmlSchema(string str)
+ {
+ XmlReader reader = new XmlTextReader( str );
+ ReadXmlSchema( reader );
+ }
+
+ public void ReadXmlSchema(TextReader treader)
+ {
+ XmlReader reader = new XmlTextReader( treader );
+ ReadXmlSchema( reader );
+ }
+
+ public void ReadXmlSchema(XmlReader reader)
+ {
+ XmlSchemaMapper SchemaMapper = new XmlSchemaMapper (this);
+ SchemaMapper.Read (reader);
+ }
+
+ public XmlReadMode ReadXml (Stream stream)
+ {
+ return ReadXml (new XmlTextReader (stream));
+ }
+
+ public XmlReadMode ReadXml (string str)
+ {
+ return ReadXml (new XmlTextReader (str));
+ }
+
+ public XmlReadMode ReadXml (TextReader reader)
+ {
+ return ReadXml (new XmlTextReader (reader));
+ }
+
+ public XmlReadMode ReadXml (XmlReader r)
+ {
+ XmlDataLoader Loader = new XmlDataLoader (this);
+ // FIXME: somekinda exception?
+ if (!r.Read ())
+ return XmlReadMode.Auto; // FIXME
+
+ /*\
+ * If document is diffgram we will use diffgram
+ \*/
+ if (r.LocalName == "diffgram")
+ return ReadXml (r, XmlReadMode.DiffGram);
+
+ /*\
+ * If we already have a schema, or the document
+ * contains an in-line schema, sets XmlReadMode to ReadSchema.
+ \*/
+
+ // FIXME: is this always true: "if we have tables we have to have schema also"
+ if (Tables.Count > 0)
+ return ReadXml (r, XmlReadMode.ReadSchema);
+
+ /*\
+ * If we dont have a schema yet and document
+ * contains no inline-schema mode is XmlReadMode.InferSchema
+ \*/
+
+ return ReadXml (r, XmlReadMode.InferSchema);
+
+ }
+
+ public XmlReadMode ReadXml (Stream stream, XmlReadMode mode)
+ {
+ return ReadXml (new XmlTextReader (stream), mode);
+ }
+
+ public XmlReadMode ReadXml (string str, XmlReadMode mode)
+ {
+ return ReadXml (new XmlTextReader (str), mode);
+ }
+
+ public XmlReadMode ReadXml (TextReader reader, XmlReadMode mode)
+ {
+ return ReadXml (new XmlTextReader (reader), mode);
+ }
+
+ [MonoTODO]
+ public XmlReadMode ReadXml (XmlReader reader, XmlReadMode mode)
+ {
+ XmlReadMode Result = XmlReadMode.Auto;
+
+ if (mode == XmlReadMode.DiffGram) {
+ XmlDiffLoader DiffLoader = new XmlDiffLoader (this);
+ DiffLoader.Load (reader);
+ Result = XmlReadMode.DiffGram;
+ }
+ else {
+ XmlDataLoader Loader = new XmlDataLoader (this);
+ Result = Loader.LoadData (reader, mode);
+ }
+
+ return Result;
+ }
+
+ #endregion // Public Methods
+
+ #region Public Events
+
+ [DataCategory ("Action")]
+ [DataSysDescription ("Occurs when it is not possible to merge schemas for two tables with the same name.")]
+ public event MergeFailedEventHandler MergeFailed;
+
+ #endregion // Public Events
+
+ #region Destructors
+
+ ~DataSet()
+ {
+ }
+
+ #endregion Destructors
+
+ #region IListSource methods
+ IList IListSource.GetList ()
+ {
+ return DefaultViewManager;
+ }
+
+ bool IListSource.ContainsListCollection {
+ get {
+ return true;
+ }
+ }
+ #endregion IListSource methods
+
+ #region ISupportInitialize methods
+ void ISupportInitialize.BeginInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ void ISupportInitialize.EndInit ()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ #region ISerializable
+ void ISerializable.GetObjectData (SerializationInfo si, StreamingContext sc)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ #region Private Xml Serialisation
+
+ private void WriteTable( XmlWriter writer, DataTable table, XmlWriteMode mode )
+ {
+ //The columns can be attributes, hidden, elements, or simple content
+ //There can be 0-1 simple content cols or 0-* elements
+ System.Collections.ArrayList atts;
+ System.Collections.ArrayList elements;
+ DataColumn simple = null;
+
+ SplitColumns( table, out atts, out elements, out simple );
+
+ foreach( DataRow row in table.Rows )
+ {
+ //sort out the namespacing
+ string nspc = table.Namespace.Length > 0 ? table.Namespace : Namespace;
+
+ // First check are all the rows null. If they are we just write empty element
+ bool AllNulls = true;
+ foreach (DataColumn dc in table.Columns) {
+
+ if (row [dc.ColumnName] != DBNull.Value) {
+ AllNulls = false;
+ break;
+ }
+ }
+
+ // If all of the columns were null, we have to write empty element
+ if (AllNulls) {
+ writer.WriteElementString (table.TableName, "");
+ continue;
+ }
+
+ WriteStartElement( writer, mode, nspc, table.Prefix, table.TableName );
+
+ foreach( DataColumn col in atts )
+ {
+ WriteAttributeString( writer, mode, col.Namespace, col.Prefix, col.ColumnName, row[col].ToString() );
+ }
+
+ if( simple != null )
+ {
+ writer.WriteString( row[simple].ToString() );
+ }
+ else
+ {
+ foreach( DataColumn col in elements )
+ {
+ string colnspc = nspc;
+ object rowObject = row [col];
+
+ if (rowObject == null)
+ continue;
+
+ if( col.Namespace != null )
+ {
+ colnspc = col.Namespace;
+ }
+
+ //TODO check if I can get away with write element string
+ WriteStartElement( writer, mode, colnspc, col.Prefix, col.ColumnName );
+ writer.WriteString( rowObject.ToString() );
+ writer.WriteEndElement();
+ }
+ }
+
+ //TODO write out the nested child relations
+
+ writer.WriteEndElement();
+ }
+
+ }
+
+ private void WriteStartElement( XmlWriter writer, XmlWriteMode mode, string nspc, string prefix, string name )
+ {
+ switch( mode )
+ {
+ case XmlWriteMode.WriteSchema:
+ if( nspc == null || nspc == "" )
+ {
+ writer.WriteStartElement( name );
+ }
+ else if( prefix != null )
+ {
+ writer.WriteStartElement(prefix, name, nspc );
+ }
+ else
+ {
+ writer.WriteStartElement( writer.LookupPrefix( nspc ), name, nspc );
+ }
+ break;
+ case XmlWriteMode.DiffGram:
+ throw new NotImplementedException();
+ default:
+ writer.WriteStartElement(name );
+ break;
+ };
+ }
+
+ private void WriteAttributeString( XmlWriter writer, XmlWriteMode mode, string nspc, string prefix, string name, string stringValue )
+ {
+ switch( mode )
+ {
+ case XmlWriteMode.WriteSchema:
+ writer.WriteAttributeString(prefix, name, nspc );
+ break;
+ case XmlWriteMode.DiffGram:
+ throw new NotImplementedException();
+ default:
+ writer.WriteAttributeString(name, stringValue );
+ break;
+ };
+ }
+
+ private void DoWriteXmlSchema( XmlWriter writer )
+ {
+ //Create the root element and declare all the namespaces etc
+ writer.WriteStartElement(XmlConstants.SchemaPrefix, XmlConstants.SchemaElement,
+ XmlConstants.SchemaNamespace );
+ writer.WriteAttributeString( XmlConstants.TargetNamespace, Namespace );
+ writer.WriteAttributeString( "xmlns:" + XmlConstants.TnsPrefix, Namespace );
+ writer.WriteAttributeString( "xmlns", Namespace );
+ writer.WriteAttributeString( "xmlns:" + XmlConstants.MsdataPrefix,
+ XmlConstants.MsdataNamespace );
+ //Set up the attribute and element forms.
+ //TODO - is it possible to change this?
+ //I couldn't spot if it was so I assumed
+ //that this is set to qualified all round basedon the MS output
+ writer.WriteAttributeString( XmlConstants.AttributeFormDefault,
+ XmlConstants.Qualified );
+ writer.WriteAttributeString( XmlConstants.ElementFormDefault,
+ XmlConstants.Qualified );
+
+
+ //<xs:element name="DSName msdata:IsDataSet="true" msdata:Locale="machine-locale">
+ //Create the data set element
+ //All the tables are represented as choice elements in an unlimited series
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.Element,
+ XmlConstants.SchemaNamespace );
+
+ writer.WriteAttributeString( XmlConstants.Name, DataSetName );
+ writer.WriteAttributeString( XmlConstants.MsdataPrefix, XmlConstants.IsDataSet, XmlConstants.MsdataNamespace, "true" );
+ //FIXME - sort out the locale string!
+
+ writer.WriteAttributeString( XmlConstants.MsdataPrefix, XmlConstants.Locale, XmlConstants.MsdataNamespace, Thread.CurrentThread.CurrentCulture.Name);
+
+ //<xs:complexType>
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.ComplexType,
+ XmlConstants.SchemaNamespace );
+
+ //<xs:choice maxOccurs="unbounded">
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.Choice,
+ XmlConstants.SchemaNamespace );
+
+ writer.WriteAttributeString( XmlConstants.MaxOccurs, XmlConstants.Unbounded );
+
+
+ //Write out schema for each table in order, providing it is not
+ //part of another table structure via a nested parent relationship
+ //TODO - is this correct? should I be using nested objects?
+ foreach( DataTable table in Tables )
+ {
+ bool isTopLevel = true;
+ //FIXME: Uncomment this when ParentRelations class is implemented
+ /*
+ foreach( DataRelation rel in table.ParentRelations )
+ {
+ if( rel.Nested )
+ {
+ isTopLevel = false;
+ break;
+ }
+ }
+ */
+
+ if( isTopLevel )
+ {
+ WriteTableSchema( writer, table );
+ }
+ }
+
+ //</xs:choice>
+ writer.WriteEndElement();
+ //</xs:complexType>
+ writer.WriteEndElement();
+
+ //TODO - now add in the relationships as key and unique constraints etc
+
+ //</xs:element>
+ writer.WriteEndElement();
+
+
+ //</schema>
+ writer.WriteEndElement();
+ }
+
+ private void WriteTableSchema( XmlWriter writer, DataTable table )
+ {
+ ArrayList elements;
+ ArrayList atts;
+ DataColumn simple;
+
+ SplitColumns( table,out atts, out elements, out simple );
+
+ //<xs:element name="TableName">
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.Element,
+ XmlConstants.SchemaNamespace );
+
+ writer.WriteAttributeString( XmlConstants.Name, table.TableName );
+
+ //<xs:complexType>
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.ComplexType,
+ XmlConstants.SchemaNamespace );
+
+ //TODO - what about the simple content?
+ if( elements.Count == 0 )
+ {
+ }
+ else
+ {
+ //A sequence of element types or a simple content node
+ //<xs:sequence>
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.Sequence,
+ XmlConstants.SchemaNamespace );
+ foreach( DataColumn col in elements )
+ {
+ //<xs:element name=ColumnName type=MappedType Ordinal=index>
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.Element,
+ XmlConstants.SchemaNamespace );
+
+ writer.WriteAttributeString( XmlConstants.Name, col.ColumnName );
+
+ if (col.ColumnName != col.Caption && col.Caption != string.Empty)
+ writer.WriteAttributeString( XmlConstants.MsdataPrefix, XmlConstants.Caption,
+ XmlConstants.MsdataNamespace, col.Caption);
+
+ if (col.DefaultValue.ToString () != string.Empty)
+ writer.WriteAttributeString( XmlConstants.Default, col.DefaultValue.ToString ());
+
+ writer.WriteAttributeString( XmlConstants.Type, MapType( col.DataType ) );
+
+ if( col.AllowDBNull )
+ {
+ writer.WriteAttributeString( XmlConstants.MinOccurs, "0" );
+ }
+
+ //writer.WriteAttributeString( XmlConstants.MsdataPrefix,
+ // XmlConstants.Ordinal,
+ // XmlConstants.MsdataNamespace,
+ // col.Ordinal.ToString() );
+
+ // Write SimpleType if column have MaxLength
+ if (col.MaxLength > -1) {
+
+ WriteTableSimpleType (writer, col);
+ }
+
+
+ //</xs:element>
+ writer.WriteEndElement();
+ }
+ //</xs:sequence>
+ writer.WriteEndElement();
+
+ }
+ //Then a list of attributes
+ foreach( DataColumn col in atts )
+ {
+ //<xs:attribute name=col.ColumnName form="unqualified" type=MappedType/>
+ writer.WriteStartElement( XmlConstants.SchemaPrefix,
+ XmlConstants.Attribute,
+ XmlConstants.SchemaNamespace );
+
+ writer.WriteAttributeString( XmlConstants.Name, col.ColumnName );
+ writer.WriteAttributeString( XmlConstants.Form, XmlConstants.Unqualified );
+ writer.WriteAttributeString( XmlConstants.Type, MapType( col.DataType ) );
+
+ writer.WriteEndElement();
+ }
+
+ //</xs:complexType>
+ writer.WriteEndElement();
+
+ //</xs:element>
+ writer.WriteEndElement();
+ }
+
+ private void WriteTableSimpleType (XmlWriter writer, DataColumn col)
+ {
+ // SimpleType
+ writer.WriteStartElement( XmlConstants.SchemaPrefix, XmlConstants.SimpleType,
+ XmlConstants.SchemaNamespace);
+
+ // Restriction
+ writer.WriteStartElement( XmlConstants.SchemaPrefix, XmlConstants.Restriction,
+ XmlConstants.SchemaNamespace);
+
+ writer.WriteAttributeString( XmlConstants.Base, MapType( col.DataType ) );
+
+ // MaxValue
+ writer.WriteStartElement( XmlConstants.SchemaPrefix, XmlConstants.MaxLength,
+ XmlConstants.SchemaNamespace);
+ writer.WriteAttributeString( XmlConstants.Value, col.MaxLength.ToString ());
+
+
+ writer.WriteEndElement();
+
+ writer.WriteEndElement();
+
+ writer.WriteEndElement();
+ }
+
+ ///<summary>
+ /// Helper function to split columns into attributes elements and simple
+ /// content
+ /// </summary>
+ private void SplitColumns( DataTable table,
+ out ArrayList atts,
+ out ArrayList elements,
+ out DataColumn simple)
+ {
+ //The columns can be attributes, hidden, elements, or simple content
+ //There can be 0-1 simple content cols or 0-* elements
+ atts = new System.Collections.ArrayList();
+ elements = new System.Collections.ArrayList();
+ simple = null;
+
+ //Sort out the columns
+ foreach( DataColumn col in table.Columns )
+ {
+ switch( col.ColumnMapping )
+ {
+ case MappingType.Attribute:
+ atts.Add( col );
+ break;
+ case MappingType.Element:
+ elements.Add( col );
+ break;
+ case MappingType.SimpleContent:
+ if( simple != null )
+ {
+ throw new System.InvalidOperationException( "There may only be one simple content element" );
+ }
+ simple = col;
+ break;
+ default:
+ //ignore Hidden elements
+ break;
+ }
+ }
+ }
+
+ [MonoTODO]
+ private string MapType( Type type )
+ {
+ string Result;
+
+ Result = "xs:string";
+
+ return Result;
+ }
+
+ #endregion //Private Xml Serialisation
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs b/mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs
new file mode 100644
index 00000000000..e6dd0965cbb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs
@@ -0,0 +1,41 @@
+//
+// System.Data/DataSysDescriptionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data {
+ [AttributeUsage (AttributeTargets.All)]
+ public class DataSysDescriptionAttribute : DescriptionAttribute
+ {
+ #region Fields
+
+ string description;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataSysDescriptionAttribute (string description)
+ : base (description)
+ {
+ this.description = description;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Description {
+ get { return description; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs
new file mode 100644
index 00000000000..68771d82259
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataTable.cs
@@ -0,0 +1,902 @@
+//
+// System.Data.DataTable.cs
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Daniel Morgan <danmorg@sc.rr.com>
+// Rodrigo Moya <rodrigo@ximian.com>
+// Tim Coleman (tim@timcoleman.com)
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Chris Podurgiel
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+ [DefaultEvent ("RowChanging")]
+ [DefaultProperty ("TableName")]
+ [DesignTimeVisible (false)]
+ [Serializable]
+ public class DataTable : MarshalByValueComponent, IListSource, ISupportInitialize, ISerializable
+ {
+ internal DataSet dataSet;
+
+ private bool _caseSensitive;
+ private DataColumnCollection _columnCollection;
+ private ConstraintCollection _constraintCollection;
+ private DataView _defaultView;
+
+ private string _displayExpression;
+ private PropertyCollection _extendedProperties;
+ private bool _hasErrors;
+ private CultureInfo _locale;
+ private int _minimumCapacity;
+ private string _nameSpace;
+ // FIXME: temporarily commented
+ // private DataTableRelationCollection _childRelations;
+ // private DataTableRelationCollection _parentRelations;
+ private string _prefix;
+ private DataColumn[] _primaryKey;
+ private DataRowCollection _rows;
+ private ISite _site;
+ private string _tableName;
+ private bool _containsListCollection;
+ private string _encodedTableName;
+
+ /// <summary>
+ /// Initializes a new instance of the DataTable class with no arguments.
+ /// </summary>
+
+ public DataTable()
+ {
+ dataSet = null;
+ _columnCollection = new DataColumnCollection(this);
+ _constraintCollection = new ConstraintCollection();
+ _extendedProperties = new PropertyCollection();
+ _tableName = "";
+ _nameSpace = null;
+ _caseSensitive = false; //default value
+ _displayExpression = null;
+ _primaryKey = null;
+ _site = null;
+ _rows = new DataRowCollection (this);
+ _locale = CultureInfo.CurrentCulture;
+
+ //LAMESPEC: spec says 25 impl does 50
+ _minimumCapacity = 50;
+
+ // FIXME: temporaily commented DataTableRelationCollection
+ // _childRelations = new DataTableRelationCollection();
+ // _parentRelations = new DataTableRelationCollection();
+
+
+ _defaultView = new DataView(this);
+ }
+
+ /// <summary>
+ /// Intitalizes a new instance of the DataTable class with the specified table name.
+ /// </summary>
+
+ public DataTable(string tableName) : this ()
+ {
+ _tableName = tableName;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the DataTable class with the SerializationInfo and the StreamingContext.
+ /// </summary>
+
+ [MonoTODO]
+ protected DataTable(SerializationInfo info, StreamingContext context)
+ : this ()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ /// <summary>
+ /// Indicates whether string comparisons within the table are case-sensitive.
+ /// </summary>
+ [DataSysDescription ("Indicates whether comparing strings within the table is case sensitive.")]
+ public bool CaseSensitive {
+ get { return _caseSensitive; }
+ set { _caseSensitive = value; }
+ }
+
+
+ internal void ChangedDataColumn (DataRow dr, DataColumn dc, object pv)
+ {
+ DataColumnChangeEventArgs e = new DataColumnChangeEventArgs (dr, dc, pv);
+ OnColumnChanged(e);
+ }
+
+ internal void ChangingDataColumn (DataRow dr, DataColumn dc, object pv)
+ {
+ DataColumnChangeEventArgs e = new DataColumnChangeEventArgs (dr, dc, pv);
+ OnColumnChanging (e);
+ }
+
+ internal void DeletedDataRow (DataRow dr, DataRowAction action)
+ {
+ DataRowChangeEventArgs e = new DataRowChangeEventArgs (dr, action);
+ OnRowDeleted (e);
+ }
+
+ internal void ChangedDataRow (DataRow dr, DataRowAction action)
+ {
+ DataRowChangeEventArgs e = new DataRowChangeEventArgs (dr, action);
+ OnRowChanged (e);
+ }
+
+ /// <summary>
+ /// Gets the collection of child relations for this DataTable.
+ /// </summary>
+ [MonoTODO]
+ [Browsable (false)]
+ [DataSysDescription ("Returns the child relations for this table.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DataRelationCollection ChildRelations {
+ get {
+ // FIXME: temporarily commented to compile
+ // return (DataRelationCollection)_childRelations;
+
+ //We are going to have to Inherit a class from
+ //DataRelationCollection because DRC is abstract
+
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of columns that belong to this table.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds the columns for this table.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public DataColumnCollection Columns {
+ get { return _columnCollection; }
+ }
+
+ /// <summary>
+ /// Gets the collection of constraints maintained by this table.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds the constraints for this table.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public ConstraintCollection Constraints {
+ get { return _constraintCollection; }
+ }
+
+ /// <summary>
+ /// Gets the DataSet that this table belongs to.
+ /// </summary>
+ [Browsable (false)]
+ [DataSysDescription ("Indicates the DataSet to which this table belongs.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DataSet DataSet {
+ get { return dataSet; }
+ }
+
+
+
+ /// <summary>
+ /// Gets a customized view of the table which may
+ /// include a filtered view, or a cursor position.
+ /// </summary>
+ [MonoTODO]
+ [Browsable (false)]
+ [DataSysDescription ("This is the default DataView for the table.")]
+ public DataView DefaultView {
+ get { return _defaultView; }
+ }
+
+
+ /// <summary>
+ /// Gets or sets the expression that will return
+ /// a value used to represent this table in the user interface.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("The expression used to compute the data-bound value of this row.")]
+ [DefaultValue ("")]
+ public string DisplayExpression {
+ get { return "" + _displayExpression; }
+ set { _displayExpression = value; }
+ }
+
+ /// <summary>
+ /// Gets the collection of customized user information.
+ /// </summary>
+ [Browsable (false)]
+ [DataCategory ("Data")]
+ [DataSysDescription ("The collection that holds custom user information.")]
+ public PropertyCollection ExtendedProperties {
+ get { return _extendedProperties; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether there are errors in
+ /// any of the_rows in any of the tables of the DataSet to
+ /// which the table belongs.
+ /// </summary>
+ [Browsable (false)]
+ [DataSysDescription ("Returns whether the table has errors.")]
+ public bool HasErrors {
+ get { return _hasErrors; }
+ }
+
+ /// <summary>
+ /// Gets or sets the locale information used to
+ /// compare strings within the table.
+ /// </summary>
+ [DataSysDescription ("Indicates a locale under which to compare strings within the table.")]
+ public CultureInfo Locale {
+ get { return _locale; }
+ set { _locale = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the initial starting size for this table.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates an initial starting size for this table.")]
+ [DefaultValue (50)]
+ public int MinimumCapacity {
+ get { return _minimumCapacity; }
+ set { _minimumCapacity = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the namespace for the XML represenation
+ /// of the data stored in the DataTable.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the XML uri namespace for the elements contained in this table.")]
+ public string Namespace {
+ get { return "" + _nameSpace; }
+ set { _nameSpace = value; }
+ }
+
+ /// <summary>
+ /// Gets the collection of parent relations for
+ /// this DataTable.
+ /// </summary>
+ [MonoTODO]
+ [Browsable (false)]
+ [DataSysDescription ("Returns the parent relations for this table.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DataRelationCollection ParentRelations {
+ get {
+ // FIXME: temporarily commented to compile
+ // return _parentRelations;
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the namespace for the XML represenation
+ /// of the data stored in the DataTable.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the Prefix of the namespace used for this table in XML representation.")]
+ [DefaultValue ("")]
+ public string Prefix {
+ get { return "" + _prefix; }
+ set { _prefix = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets an array of columns that function as
+ /// primary keys for the data table.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the column(s) that represent the primary key for this table.")]
+ public DataColumn[] PrimaryKey
+ {
+ get {
+ UniqueConstraint uc = UniqueConstraint.GetPrimaryKeyConstraint( Constraints);
+ if (null == uc) return new DataColumn[] {};
+ return uc.Columns;
+ }
+ set {
+
+ //YUK: msft removes a previous unique constraint if it is flagged as a pk
+ //when a new pk is set
+
+ //clear Primary Key if value == null
+ if (null == value)
+ {
+ UniqueConstraint.SetAsPrimaryKey(this.Constraints, null);
+ return;
+ }
+
+
+ //Does constraint exist for these columns
+ UniqueConstraint uc = UniqueConstraint.GetUniqueConstraintForColumnSet(
+ this.Constraints, (DataColumn[]) value);
+
+ //if constraint doesn't exist for columns
+ //create new unique primary key constraint
+ if (null == uc)
+ {
+ uc = new UniqueConstraint( (DataColumn[]) value, true);
+ }
+ else //set existing constraint as the new primary key
+ {
+ UniqueConstraint.SetAsPrimaryKey(this.Constraints, uc);
+ }
+
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of_rows that belong to this table.
+ /// </summary>
+ [Browsable (false)]
+ [DataSysDescription ("Indicates the collection that holds the rows of data for this table.")]
+ public DataRowCollection Rows {
+ get { return _rows; }
+ }
+
+ /// <summary>
+ /// Gets or sets an System.ComponentModel.ISite
+ /// for the DataTable.
+ /// </summary>
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override ISite Site {
+ get { return _site; }
+ set { _site = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the the DataTable.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the name used to look up this table in the Tables collection of a DataSet.")]
+ [DefaultValue ("")]
+ [RefreshProperties (RefreshProperties.All)]
+ public string TableName {
+ get { return "" + _tableName; }
+ set { _tableName = value; }
+ }
+
+ bool IListSource.ContainsListCollection {
+ get {
+ // the collection is a DataView
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Commits all the changes made to this table since the
+ /// last time AcceptChanges was called.
+ /// </summary>
+
+ public void AcceptChanges()
+ {
+
+ //FIXME: Do we need to validate anything here or
+ //try to catch any errors to deal with them?
+
+ foreach(DataRow myRow in _rows)
+ {
+ myRow.AcceptChanges();
+ }
+
+ }
+
+ /// <summary>
+ /// Begins the initialization of a DataTable that is used
+ /// on a form or used by another component. The initialization
+ /// occurs at runtime.
+ /// </summary>
+
+ public void BeginInit()
+ {
+ }
+
+ /// <summary>
+ /// Turns off notifications, index maintenance, and
+ /// constraints while loading data.
+ /// </summary>
+
+ public void BeginLoadData()
+ {
+ }
+
+ /// <summary>
+ /// Clears the DataTable of all data.
+ /// </summary>
+
+ public void Clear()
+ {
+ _rows.Clear ();
+ }
+
+ /// <summary>
+ /// Clones the structure of the DataTable, including
+ /// all DataTable schemas and constraints.
+ /// </summary>
+
+ [MonoTODO]
+ public virtual DataTable Clone()
+ {
+ DataTable Copy = new DataTable ();
+ CopyProperties (Copy);
+ return Copy;
+ }
+
+ /// <summary>
+ /// Computes the given expression on the current_rows that
+ /// pass the filter criteria.
+ /// </summary>
+
+ [MonoTODO]
+ public object Compute(string expression, string filter)
+ {
+ //FIXME: //Do a real compute
+ object obj = "a";
+ return obj;
+ }
+
+ /// <summary>
+ /// Copies both the structure and data for this DataTable.
+ /// </summary>
+ [MonoTODO]
+ public DataTable Copy()
+ {
+ DataTable Copy = new DataTable ();
+
+
+ CopyProperties (Copy);
+
+ foreach (DataRow Row in Rows) {
+ DataRow NewRow = Copy.NewRow ();
+ NewRow.RowError = Row.RowError;
+ foreach (DataColumn C in Copy.Columns) {
+ NewRow [C.ColumnName] = Row [C.ColumnName];
+ }
+ Copy.Rows.Add (NewRow);
+ }
+
+ return Copy;
+ }
+
+ [MonoTODO]
+ private void CopyProperties (DataTable Copy)
+ {
+ Copy.CaseSensitive = CaseSensitive;
+ // Copy.ChildRelations
+ // Copy.Constraints
+ // Copy.Container
+ // Copy.DefaultView
+ // Copy.DesignMode
+ Copy.DisplayExpression = DisplayExpression;
+ // Copy.ExtendedProperties
+ Copy.Locale = Locale;
+ Copy.MinimumCapacity = MinimumCapacity;
+ Copy.Namespace = Namespace;
+ // Copy.ParentRelations
+ Copy.Prefix = Prefix;
+ //Copy.PrimaryKey = PrimaryKey;
+ Copy.Site = Site;
+ Copy.TableName = TableName;
+
+ // Copy columns
+ foreach (DataColumn Column in Columns) {
+ Copy.Columns.Add (CopyColumn (Column));
+ }
+
+ }
+ /// <summary>
+ /// Ends the initialization of a DataTable that is used
+ /// on a form or used by another component. The
+ /// initialization occurs at runtime.
+ /// </summary>
+
+ public void EndInit()
+ {
+ }
+
+ /// <summary>
+ /// Turns on notifications, index maintenance, and
+ /// constraints after loading data.
+ /// </summary>
+
+ public void EndLoadData()
+ {
+ }
+
+ /// <summary>
+ /// Gets a copy of the DataTable that contains all
+ /// changes made to it since it was loaded or
+ /// AcceptChanges was last called.
+ /// </summary>
+ [MonoTODO]
+ public DataTable GetChanges()
+ {
+ //TODO:
+ return this;
+ }
+
+ /// <summary>
+ /// Gets a copy of the DataTable containing all
+ /// changes made to it since it was last loaded, or
+ /// since AcceptChanges was called, filtered by DataRowState.
+ /// </summary>
+ [MonoTODO]
+ public DataTable GetChanges(DataRowState rowStates)
+ {
+ //TODO:
+ return this;
+ }
+
+ /// <summary>
+ /// Gets an array of DataRow objects that contain errors.
+ /// </summary>
+
+ [MonoTODO]
+ public DataRow[] GetErrors()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ /// </summary>
+
+ //protected virtual Type GetRowType()
+ //{
+ //}
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ ///
+ /// Used for Data Binding between System.Web.UI. controls
+ /// like a DataGrid
+ /// or
+ /// System.Windows.Forms controls like a DataGrid
+ /// </summary>
+ IList IListSource.GetList()
+ {
+ IList list = (IList) _defaultView;
+ return list;
+ }
+
+ /// <summary>
+ /// Copies a DataRow into a DataTable, preserving any
+ /// property settings, as well as original and current values.
+ /// </summary>
+ [MonoTODO]
+ public void ImportRow(DataRow row)
+ {
+ }
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ /// </summary>
+
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ }
+
+ /// <summary>
+ /// Finds and updates a specific row. If no matching row
+ /// is found, a new row is created using the given values.
+ /// </summary>
+ [MonoTODO]
+ public DataRow LoadDataRow(object[] values, bool fAcceptChanges)
+ {
+ DataRow row = null;
+ if (PrimaryKey.Length == 0) {
+ row = Rows.Add (values);
+ if (fAcceptChanges)
+ row.AcceptChanges ();
+ }
+ else
+ throw new NotImplementedException ();
+ return row;
+ }
+
+ /// <summary>
+ /// Creates a new DataRow with the same schema as the table.
+ /// </summary>
+ public DataRow NewRow()
+ {
+ return this.NewRowFromBuilder (new DataRowBuilder (this, 0, 0));
+ }
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ /// </summary>
+ [MonoTODO]
+ protected internal DataRow[] NewRowArray(int size)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Creates a new row from an existing row.
+ /// </summary>
+
+ protected virtual DataRow NewRowFromBuilder(DataRowBuilder builder)
+ {
+ return new DataRow (builder);
+ }
+
+
+ /// <summary>
+ /// Rolls back all changes that have been made to the
+ /// table since it was loaded, or the last time AcceptChanges
+ /// was called.
+ /// </summary>
+
+ [MonoTODO]
+ public void RejectChanges()
+ {
+
+ //foreach(DataRow myRow in _rows)
+ //{
+ for (int i = _rows.Count - 1; i >= 0; i--) {
+ DataRow row = _rows [i];
+ if (row.RowState != DataRowState.Unchanged)
+ _rows [i].RejectChanges ();
+ }
+ }
+
+ /// <summary>
+ /// Resets the DataTable to its original state.
+ /// </summary>
+
+ [MonoTODO]
+ public virtual void Reset()
+ {
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects.
+ /// </summary>
+
+ [MonoTODO]
+ public DataRow[] Select()
+ {
+ //FIXME:
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects that match
+ /// the filter criteria in order of primary key (or
+ /// lacking one, order of addition.)
+ /// </summary>
+
+ [MonoTODO]
+ public DataRow[] Select(string filterExpression)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects that
+ /// match the filter criteria, in the the
+ /// specified sort order.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] Select(string filterExpression, string sort)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects that match
+ /// the filter in the order of the sort, that match
+ /// the specified state.
+ /// </summary>
+ [MonoTODO]
+ public DataRow[] Select(string filterExpression, string sort, DataViewRowState recordStates)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets the TableName and DisplayExpression, if
+ /// there is one as a concatenated string.
+ /// </summary>
+ public override string ToString()
+ {
+ //LAMESPEC: spec says concat the two. impl puts a
+ //plus sign infront of DisplayExpression
+ return TableName + " " + DisplayExpression;
+ }
+
+
+ #region Events /////////////////
+
+ /// <summary>
+ /// Raises the ColumnChanged event.
+ /// </summary>
+ protected virtual void OnColumnChanged(DataColumnChangeEventArgs e)
+ {
+ if (null != ColumnChanged)
+ {
+ ColumnChanged(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Raises the ColumnChanging event.
+ /// </summary>
+ protected virtual void OnColumnChanging(DataColumnChangeEventArgs e)
+ {
+ if (null != ColumnChanging)
+ {
+ ColumnChanging(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Raises the PropertyChanging event.
+ /// </summary>
+ [MonoTODO]
+ protected internal virtual void OnPropertyChanging(PropertyChangedEventArgs pcevent)
+ {
+// if (null != PropertyChanging)
+// {
+// PropertyChanging(this, e);
+// }
+ }
+
+ /// <summary>
+ /// Notifies the DataTable that a DataColumn is being removed.
+ /// </summary>
+ [MonoTODO]
+ protected internal virtual void OnRemoveColumn(DataColumn column)
+ {
+// if (null != RemoveColumn)
+// {
+// RemoveColumn(this, e);
+// }
+ }
+
+ /// <summary>
+ /// Raises the RowChanged event.
+ /// </summary>
+
+ protected virtual void OnRowChanged(DataRowChangeEventArgs e)
+ {
+ if (null != RowChanged)
+ {
+ RowChanged(this, e);
+ }
+ }
+
+
+ /// <summary>
+ /// Raises the RowChanging event.
+ /// </summary>
+
+ protected virtual void OnRowChanging(DataRowChangeEventArgs e)
+ {
+ if (null != RowChanging)
+ {
+ RowChanging(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Raises the RowDeleted event.
+ /// </summary>
+ protected virtual void OnRowDeleted(DataRowChangeEventArgs e)
+ {
+ if (null != RowDeleted)
+ {
+ RowDeleted(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Raises the RowDeleting event.
+ /// </summary>
+ protected virtual void OnRowDeleting(DataRowChangeEventArgs e)
+ {
+ if (null != RowDeleting)
+ {
+ RowDeleting(this, e);
+ }
+ }
+
+ [MonoTODO]
+ private DataColumn CopyColumn (DataColumn Column)
+ {
+ DataColumn Copy = new DataColumn ();
+
+ // Copy all the properties of column
+ Copy.AllowDBNull = Column.AllowDBNull;
+ Copy.AutoIncrement = Column.AutoIncrement;
+ Copy.AutoIncrementSeed = Column.AutoIncrementSeed;
+ Copy.AutoIncrementStep = Column.AutoIncrementStep;
+ Copy.Caption = Column.Caption;
+ Copy.ColumnMapping = Column.ColumnMapping;
+ Copy.ColumnName = Column.ColumnName;
+ // Copy.Container
+ // Copy.DataType
+ // Copy.DefaultValue
+ Copy.Expression = Column.Expression;
+ //Copy.ExtendedProperties
+ Copy.MaxLength = Column.MaxLength;
+ Copy.Namespace = Column.Namespace;
+ Copy.Prefix = Column.Prefix;
+ Copy.ReadOnly = Column.ReadOnly;
+ //Copy.Site
+ Copy.Unique = Column.Unique;
+
+ return Copy;
+ }
+
+ /// <summary>
+ /// Occurs when after a value has been changed for
+ /// the specified DataColumn in a DataRow.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs when a value has been changed for this column.")]
+ public event DataColumnChangeEventHandler ColumnChanged;
+
+ /// <summary>
+ /// Occurs when a value is being changed for the specified
+ /// DataColumn in a DataRow.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs when a value has been submitted for this column. The user can modify the proposed value and should throw an exception to cancel the edit.")]
+ public event DataColumnChangeEventHandler ColumnChanging;
+
+ /// <summary>
+ /// Occurs after a DataRow has been changed successfully.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs after a row in the table has been successfully edited.")]
+ public event DataRowChangeEventHandler RowChanged;
+
+ /// <summary>
+ /// Occurs when a DataRow is changing.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs when the row is being changed so that the event handler can modify or cancel the change. The user can modify values in the row and should throw an exception to cancel the edit.")]
+ public event DataRowChangeEventHandler RowChanging;
+
+ /// <summary>
+ /// Occurs after a row in the table has been deleted.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs after a row in the table has been successfully deleted.")]
+ public event DataRowChangeEventHandler RowDeleted;
+
+ /// <summary>
+ /// Occurs before a row in the table is about to be deleted.
+ /// </summary>
+ [DataCategory ("Data")]
+ [DataSysDescription ("Occurs when a row in the table marked for deletion. Throw an exception to cancel the deletion.")]
+ public event DataRowChangeEventHandler RowDeleting;
+
+ #endregion //Events
+ }
+
+}
diff --git a/mcs/class/System.Data/System.Data/DataTableCollection.cs b/mcs/class/System.Data/System.Data/DataTableCollection.cs
new file mode 100644
index 00000000000..d96cf397f42
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataTableCollection.cs
@@ -0,0 +1,184 @@
+//
+// System.Data.DataTableCollection.cs
+//
+// Authors:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Chris Podurgiel
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Data {
+ /// <summary>
+ /// Represents the collection of tables for the DataSet.
+ /// </summary>
+ [DefaultEvent ("CollectionChanged")]
+ [ListBindable (false)]
+ [Serializable]
+ public class DataTableCollection : InternalDataCollectionBase
+ {
+ DataSet dataSet;
+
+ #region Constructors
+
+ internal DataTableCollection (DataSet dataSet)
+ : base ()
+ {
+ this.dataSet = dataSet;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public DataTable this[int index] {
+ get { return (DataTable)(list[index]); }
+ }
+
+ public DataTable this[string name] {
+ get {
+ foreach (DataTable dt in list) {
+ if (dt.TableName == name)
+ return dt;
+ }
+
+ return null;
+ }
+ }
+
+ protected override ArrayList List {
+ get { return list; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public virtual DataTable Add ()
+ {
+ DataTable Table = new DataTable ();
+ Add (Table);
+ return Table;
+ }
+
+ public virtual void Add (DataTable table)
+ {
+ if (table.TableName == null || table.TableName == string.Empty)
+ NameTable (table);
+
+ list.Add (table);
+ table.dataSet = dataSet;
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, table));
+ }
+
+ public virtual DataTable Add (string name)
+ {
+ DataTable table = new DataTable (name);
+ this.Add (table);
+ return table;
+ }
+
+ public void AddRange (DataTable[] tables)
+ {
+ foreach (DataTable table in tables)
+ this.Add (table);
+ }
+
+ [MonoTODO]
+ public bool CanRemove (DataTable table)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (string name)
+ {
+ foreach (DataTable dt in list) {
+ if (dt.TableName == name)
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual int IndexOf (DataTable table)
+ {
+ return list.IndexOf (table);
+ }
+
+ public virtual int IndexOf (string name)
+ {
+ return list.IndexOf (this [name]);
+ }
+
+ public void Remove (DataTable table)
+ {
+ this.Remove (table.TableName);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, table));
+ }
+
+ public void Remove (string name)
+ {
+ list.Remove (this [name]);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion
+
+ #region Protected methods
+
+ protected internal virtual void OnCollectionChanging (CollectionChangeEventArgs Args)
+ {
+ if (CollectionChanging != null)
+ CollectionChanging (this, Args);
+ }
+
+ protected virtual void OnCollectionChanged (CollectionChangeEventArgs Args)
+ {
+ if (CollectionChanged != null)
+ CollectionChanged (this, Args);
+ }
+
+ #endregion
+
+ #region Private methods
+
+ /// <summary>
+ /// gives name to Table (Table1, Table2, Table3,...)
+ /// </summary>
+ private void NameTable (DataTable Table)
+ {
+ string Name = "Table";
+ int i = 1;
+ while (Contains (Name + i))
+ i++;
+
+ Table.TableName = Name + i;
+ }
+
+ #endregion // Private methods
+
+ #region Events
+
+ [ResDescriptionAttribute ("Occurs whenever this collection's membership changes.")]
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ public event CollectionChangeEventHandler CollectionChanging;
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataTablePropertyDescriptor.cs b/mcs/class/System.Data/System.Data/DataTablePropertyDescriptor.cs
new file mode 100644
index 00000000000..a9fa2bf5e42
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataTablePropertyDescriptor.cs
@@ -0,0 +1,80 @@
+//
+// System.Data.DataTablePropertyDescriptor
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2003 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ internal class DataTablePropertyDescriptor : PropertyDescriptor
+ {
+ DataTable table;
+
+ public DataTablePropertyDescriptor (DataTable table) : base (table.TableName, null)
+ {
+ this.table = table;
+ }
+
+ public override object GetValue (object component)
+ {
+ DataViewManagerListItemTypeDescriptor desc = component as DataViewManagerListItemTypeDescriptor;
+ if (desc == null)
+ return null;
+
+ DataView dv = new DataView (table);
+ dv.dataViewManager = desc.DataViewManager;
+ return dv;
+ }
+
+ public override bool CanResetValue (object component)
+ {
+ return false;
+ }
+
+ public override bool Equals (object other)
+ {
+ return (other is DataTablePropertyDescriptor &&
+ ((DataTablePropertyDescriptor) other).table == table);
+ }
+
+ public override int GetHashCode ()
+ {
+ return table.GetHashCode ();
+ }
+
+ public override bool ShouldSerializeValue (object component)
+ {
+ return false;
+ }
+
+ public override void ResetValue (object component)
+ {
+ }
+
+ public override void SetValue (object component, object value)
+ {
+ }
+
+ public override bool IsReadOnly
+ {
+ get { return false; }
+ }
+
+ public override Type ComponentType
+ {
+ get { return typeof (DataRowView); }
+ }
+
+ public override Type PropertyType
+ {
+ get { return typeof (IBindingList); }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs b/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs
new file mode 100644
index 00000000000..5f23fc1204f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs
@@ -0,0 +1,122 @@
+//
+// System.Data.DataTableRelationCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data.Common;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Summary description for DataTableRelationCollection.
+ /// </summary>
+ internal class DataTableRelationCollection : DataRelationCollection
+ {
+ /// <summary>
+ /// Initializes a new instance of the DataRelationCollection class.
+ /// </summary>
+ [MonoTODO]
+ internal DataTableRelationCollection():base()
+ {
+ // TODO: need to the constructor
+ }
+
+ /// <summary>
+ /// Gets the DataRelation object specified by name.
+ /// </summary>
+ [MonoTODO]
+ public override DataRelation this[string name]
+ {
+ get
+ {
+ foreach (DataRelation dataRelation in list)
+ {
+ if (dataRelation.RelationName == name)
+ {
+ return dataRelation;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the DataRelation object at the specified index.
+ /// </summary>
+ [MonoTODO]
+ public override DataRelation this[int index]
+ {
+ get
+ {
+ return (DataRelation)list[index];
+ }
+ }
+
+ /// <summary>
+ /// Copies the elements of the specified DataRelation array to the end of the collection.
+ /// </summary>
+ /// <param name="relations">The array of DataRelation objects to add to the collection.</param>
+ [MonoTODO]
+ public override void AddRange(DataRelation[] relations)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool CanRemove(DataRelation relation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Contains(string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override DataSet GetDataSet()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int IndexOf(DataRelation relation)
+ {
+ return list.IndexOf(relation);
+ }
+
+ [MonoTODO]
+ public override int IndexOf(string relationName)
+ {
+ return list.IndexOf(this[relationName]);
+ }
+
+ [MonoTODO]
+ protected override void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void OnCollectionChanging(CollectionChangeEventArgs ccevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataView.cs b/mcs/class/System.Data/System.Data/DataView.cs
new file mode 100644
index 00000000000..99809095a78
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataView.cs
@@ -0,0 +1,578 @@
+//
+// System.Data.DataView.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Data {
+ /// <summary>
+ /// A DataView is used in the binding of data between
+ /// a DataTable and Windows Forms or Web Forms allowing
+ /// a view of a DataTable for editing, filtering,
+ /// navigation, searching, and sorting.
+ /// </summary>
+ [DefaultEvent ("PositionChanged")]
+ [DefaultProperty ("Table")]
+ public class DataView : MarshalByValueComponent, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize
+ {
+
+ DataTable dataTable = null;
+ string rowFilter = "";
+ string sort = "";
+ DataViewRowState rowState;
+
+ // FIXME: what are the default values?
+ bool allowNew = true;
+ bool allowEdit = true;
+ bool allowDelete = true;
+ bool applyDefaultSort = false;
+ bool isSorted = false;
+
+ bool isOpen = false;
+
+ internal DataViewManager dataViewManager = null;
+
+ [MonoTODO]
+ public DataView () {
+ dataTable = new DataTable ();
+ rowState = DataViewRowState.None;
+ }
+
+ [MonoTODO]
+ public DataView (DataTable table) {
+
+ dataTable = table;
+ rowState = DataViewRowState.None;
+ Open ();
+ }
+
+ [MonoTODO]
+ public DataView (DataTable table, string RowFilter,
+ string Sort, DataViewRowState RowState) : this (table) {
+
+ rowFilter = RowFilter;
+ sort = Sort;
+ rowState = RowState;
+
+ Open();
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether this DataView and the user interface associated with it allows deletes.")]
+ [DefaultValue (true)]
+ public bool AllowDelete {
+ [MonoTODO]
+ get {
+ return allowDelete;
+ }
+
+ [MonoTODO]
+ set {
+ allowDelete = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether this DataView and the user interface associated with it allows edits.")]
+ [DefaultValue (true)]
+ public bool AllowEdit {
+ [MonoTODO]
+ get {
+ return allowEdit;
+ }
+
+ [MonoTODO]
+ set {
+ allowEdit = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether this DataView and the user interface associated with it allows new rows to be added.")]
+ [DefaultValue (true)]
+ public bool AllowNew {
+ [MonoTODO]
+ get {
+ return allowNew;
+ }
+
+ [MonoTODO]
+ set {
+ allowNew = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates whether to use the default sort if the Sort property is not set.")]
+ [DefaultValue (false)]
+ [RefreshProperties (RefreshProperties.All)]
+ public bool ApplyDefaultSort {
+ [MonoTODO]
+ get {
+ return applyDefaultSort;
+ }
+
+ [MonoTODO]
+ set {
+ applyDefaultSort = value;
+ }
+ }
+
+ // get the count of rows in the DataView after RowFilter
+ // and RowStateFilter have been applied
+ [Browsable (false)]
+ [DataSysDescription ("Returns the number of items currently in this view.")]
+ public int Count {
+ [MonoTODO]
+ get {
+ // TODO: apply RowFilter
+ // TODO: apply RowStateFilter
+ return dataTable.Rows.Count;
+ }
+ }
+
+ [Browsable (false)]
+ [DataSysDescription ("This returns a pointer to back to the DataViewManager that owns this DataSet (if any).")]
+ public DataViewManager DataViewManager {
+ [MonoTODO]
+ get {
+ return dataViewManager;
+ }
+ }
+
+ // Item indexer
+ // the compiler creates a DefaultMemeberAttribute from
+ // this IndexerNameAttribute
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public DataRowView this[int recordIndex] {
+ [MonoTODO]
+ get {
+ return new DataRowView(this, recordIndex);
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates an expression used to filter the data returned by this DataView.")]
+ [DefaultValue ("")]
+ public virtual string RowFilter {
+ [MonoTODO]
+ get {
+ return rowFilter;
+ }
+
+ [MonoTODO]
+ set {
+ rowFilter = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the versions of data returned by this DataView.")]
+ [DefaultValue (DataViewRowState.CurrentRows)]
+ public DataViewRowState RowStateFilter {
+ [MonoTODO]
+ get {
+ return rowState;
+ }
+
+ [MonoTODO]
+ set {
+ rowState = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the order in which data is returned by this DataView.")]
+ [DefaultValue ("")]
+ public string Sort {
+ [MonoTODO]
+ get {
+ return sort;
+ }
+
+ [MonoTODO]
+ set {
+ sort = value;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the table this DataView uses to get data.")]
+ [DefaultValue (null)]
+ [RefreshProperties (RefreshProperties.All)]
+ public DataTable Table {
+ [MonoTODO]
+ get {
+ return dataTable;
+ }
+
+ [MonoTODO]
+ set {
+ dataTable = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual DataRowView AddNew() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void BeginInit() {
+ // FIXME:
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index) {
+ // TODO: apply RowFilter
+ // TODO: apply RowStateFilter
+ for (int row = 0; row < dataTable.Rows.Count; row++) {
+ array.SetValue(this[row], index + row);
+ }
+ }
+
+ [MonoTODO]
+ public void Delete(int index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void EndInit() {
+ // FIXME:
+ }
+
+ [MonoTODO]
+ public int Find(object key) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Find(object[] key) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRowView[] FindRows(object key) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRowView[] FindRows(object[] key) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ // TODO: apply RowFilter
+ // TODO: apply RowStateFilter
+ DataRowView[] dataRowViews;
+ dataRowViews = new DataRowView[dataTable.Rows.Count];
+ this.CopyTo (dataRowViews, 0);
+ return new DataViewEnumerator (dataRowViews);
+ }
+
+ [MonoTODO]
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the data returned by this DataView has somehow changed.")]
+ public event ListChangedEventHandler ListChanged;
+
+ protected bool IsOpen {
+ [MonoTODO]
+ get {
+ return isOpen;
+ }
+ }
+
+ [MonoTODO]
+ protected void Close() {
+ // FIXME:
+ isOpen = false;
+ }
+
+ [MonoTODO]
+ protected virtual void ColumnCollectionChanged(
+ object sender, CollectionChangeEventArgs e) {
+
+ throw new NotImplementedException ();
+ }
+
+ protected override void Dispose (bool disposing) {
+
+ }
+
+ [MonoTODO]
+ protected virtual void IndexListChanged(object sender, ListChangedEventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnListChanged(ListChangedEventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void Open() {
+ // FIXME:
+ isOpen = true;
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ITypedList.GetItemProperties (
+ PropertyDescriptor[] listAccessors) {
+
+ // FIXME: use listAccessors somehow
+
+ DataColumnPropertyDescriptor[] descriptors =
+ new DataColumnPropertyDescriptor[dataTable.Columns.Count];
+
+ DataColumnPropertyDescriptor descriptor;
+ DataColumn dataColumn;
+ for(int col = 0; col < dataTable.Columns.Count; col++)
+ {
+ dataColumn = dataTable.Columns[col];
+
+ descriptor = new DataColumnPropertyDescriptor(
+ dataColumn.ColumnName, col, null);
+ descriptor.SetComponentType(typeof(System.Data.DataRowView));
+ descriptor.SetPropertyType(dataColumn.DataType);
+
+ descriptors[col] = descriptor;
+ }
+
+ return new PropertyDescriptorCollection (descriptors);
+ }
+
+ [MonoTODO]
+ string ITypedList.GetListName (PropertyDescriptor[] listAccessors) {
+ return "";
+ }
+
+ //int ICollection.Count {
+ // get {
+ // return Count;
+ // }
+ //}
+
+ bool ICollection.IsSynchronized {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ [MonoTODO]
+ get {
+ // FIXME:
+ return this;
+ }
+ }
+
+ //void ICollection.CopyTo (Array array, int index) {
+ // CopyTo (array, index);
+ //}
+
+ bool IList.IsFixedSize {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ bool IList.IsReadOnly {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ object IList.this[int recordIndex] {
+ [MonoTODO]
+ get {
+ return this[recordIndex];
+ }
+
+ [MonoTODO]
+ set{
+ throw new InvalidOperationException();
+ }
+ }
+
+ [MonoTODO]
+ int IList.Add (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Clear () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index,object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove(object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt(int index) {
+ throw new NotImplementedException ();
+ }
+
+ #region IBindingList implementation
+
+ [MonoTODO]
+ void IBindingList.AddIndex (PropertyDescriptor property) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object IBindingList.AddNew () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IBindingList.Find (PropertyDescriptor property, object key) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IBindingList.RemoveIndex (PropertyDescriptor property) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IBindingList.RemoveSort () {
+ throw new NotImplementedException ();
+ }
+
+ bool IBindingList.AllowEdit {
+ [MonoTODO]
+ get {
+ return AllowEdit;
+ }
+ }
+
+ bool IBindingList.AllowNew {
+ [MonoTODO]
+ get {
+ return AllowNew;
+ }
+ }
+
+ bool IBindingList.AllowRemove {
+ [MonoTODO]
+ get {
+ return AllowDelete;
+ }
+ }
+
+ bool IBindingList.IsSorted {
+ [MonoTODO]
+ get {
+ return isSorted;
+ }
+ }
+
+ ListSortDirection IBindingList.SortDirection {
+ [MonoTODO]
+ get {
+ // FIXME:
+ return ListSortDirection.Ascending;
+ }
+ }
+
+ PropertyDescriptor IBindingList.SortProperty {
+ [MonoTODO]
+ get {
+ // FIXME:
+ return null;
+ }
+ }
+
+ bool IBindingList.SupportsChangeNotification {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ bool IBindingList.SupportsSearching {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ bool IBindingList.SupportsSorting {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ #endregion // IBindingList implementation
+
+ private class DataViewEnumerator : IEnumerator {
+ private DataRowView[] rows;
+ int on = -1;
+
+ internal DataViewEnumerator (DataRowView[] dataRowViews) {
+ rows = dataRowViews;
+ }
+
+ public object Current {
+ get {
+ if(on == -1 || on >= rows.Length)
+ throw new InvalidOperationException ();
+ return rows[on];
+ }
+ }
+
+ public bool MoveNext() {
+ // TODO: how do you determine
+ // if a collection has been
+ // changed?
+ if(on < rows.Length - 1) {
+ on++;
+ return true;
+ }
+
+ return false; // EOF
+ }
+
+ public void Reset() {
+ on = -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataViewManager.cs b/mcs/class/System.Data/System.Data/DataViewManager.cs
new file mode 100644
index 00000000000..9e8dbe042d0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataViewManager.cs
@@ -0,0 +1,286 @@
+//
+// System.Data.DataViewManager
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Contains a default DataViewSettingCollection for each DataTable in a DataSet.
+ /// </summary>
+ public class DataViewManager : MarshalByValueComponent, IBindingList, ICollection, IList, ITypedList, IEnumerable
+ {
+ #region Fields
+
+ DataSet dataSet;
+ DataViewManagerListItemTypeDescriptor descriptor;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DataViewManager ()
+ {
+ dataSet = null;
+ }
+
+ public DataViewManager (DataSet ds)
+ {
+ dataSet = ds;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DataSysDescription ("Indicates the source of data for this DataViewManager.")]
+ [DefaultValue (null)]
+ public DataSet DataSet {
+ get { return dataSet; }
+ set { dataSet = value; }
+ }
+
+ [MonoTODO]
+ [DataSysDescription ("Indicates the sorting/filtering/state settings for any table in the corresponding DataSet.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ public string DataViewSettingCollectionString {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataViewSettingCollection DataViewSettings {
+ get { throw new NotImplementedException (); }
+ }
+
+ int ICollection.Count {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return true; }
+ }
+
+ object IList.this [int index] {
+ get {
+ if (descriptor == null)
+ descriptor = new DataViewManagerListItemTypeDescriptor (this);
+
+ return descriptor;
+ }
+
+ set { throw new ArgumentException ("Not modifiable"); }
+ }
+
+ bool IBindingList.AllowEdit {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IBindingList.AllowNew {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IBindingList.AllowRemove {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IBindingList.IsSorted {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ ListSortDirection IBindingList.SortDirection {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ PropertyDescriptor IBindingList.SortProperty {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IBindingList.SupportsChangeNotification {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IBindingList.SupportsSearching {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ bool IBindingList.SupportsSorting {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public DataView CreateDataView (DataTable table)
+ {
+ return new DataView (table);
+ }
+
+ [MonoTODO]
+ void IBindingList.AddIndex (PropertyDescriptor property)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object IBindingList.AddNew ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IBindingList.Find (PropertyDescriptor property, object key)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IBindingList.RemoveIndex (PropertyDescriptor property)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IBindingList.RemoveSort ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ICollection.CopyTo (Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Clear ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert (int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor[] listAccessors)
+ {
+ if (dataSet == null)
+ throw new DataException ("dataset is null");
+
+ if (listAccessors == null || listAccessors.Length == 0) {
+ ICustomTypeDescriptor desc = new DataViewManagerListItemTypeDescriptor (this);
+ return desc.GetProperties ();
+ }
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ string ITypedList.GetListName (PropertyDescriptor[] listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnListChanged (ListChangedEventArgs e)
+ {
+ if (ListChanged != null)
+ ListChanged (this, e);
+ }
+
+ protected virtual void RelationCollectionChanged (object sender, CollectionChangeEventArgs e)
+ {
+ }
+
+ protected virtual void TableCollectionChanged (object sender, CollectionChangeEventArgs e)
+ {
+ }
+
+ #endregion // Methods
+
+ #region Events
+
+ public event ListChangedEventHandler ListChanged;
+
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataViewManagerListItemTypeDescriptor.cs b/mcs/class/System.Data/System.Data/DataViewManagerListItemTypeDescriptor.cs
new file mode 100644
index 00000000000..0b1fb84220f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataViewManagerListItemTypeDescriptor.cs
@@ -0,0 +1,110 @@
+//
+// System.Data.DataViewManagerListItemTypeDscriptor
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ class DataViewManagerListItemTypeDescriptor : ICustomTypeDescriptor
+ {
+ DataViewManager dvm;
+ PropertyDescriptorCollection propsCollection;
+
+ internal DataViewManagerListItemTypeDescriptor (DataViewManager dvm)
+ {
+ this.dvm = dvm;
+ }
+
+ internal DataViewManager DataViewManager {
+ get { return dvm; }
+ }
+
+ AttributeCollection ICustomTypeDescriptor.GetAttributes ()
+ {
+ return new AttributeCollection (null);
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetClassName ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetComponentName ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ TypeConverter ICustomTypeDescriptor.GetConverter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents (System.Attribute[] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
+ {
+ DataSet ds = dvm.DataSet;
+ if (ds == null)
+ return null;
+
+ DataTableCollection tables = ds.Tables;
+ int index = 0;
+ PropertyDescriptor [] descriptors = new PropertyDescriptor [tables.Count];
+ foreach (DataTable table in tables)
+ descriptors [index++] = new DataTablePropertyDescriptor (table);
+
+ return new PropertyDescriptorCollection (descriptors);
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (System.Attribute[] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data/DataViewRowState.cs b/mcs/class/System.Data/System.Data/DataViewRowState.cs
new file mode 100644
index 00000000000..2768fbe0e0f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataViewRowState.cs
@@ -0,0 +1,29 @@
+//
+// System.Data.DataViewRowState.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Describes the version of data in a DataRow.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DataViewRowState
+ {
+ None = 0,
+ Unchanged = 2,
+ Added = 4,
+ Deleted = 8,
+ ModifiedCurrent = 16,
+ CurrentRows = 22,
+ ModifiedOriginal = 32,
+ OriginalRows = 42
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataViewSetting.cs b/mcs/class/System.Data/System.Data/DataViewSetting.cs
new file mode 100644
index 00000000000..af728abfcf8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataViewSetting.cs
@@ -0,0 +1,75 @@
+//
+// System.Data.DataViewSetting
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the default settings for ApplyDefaultSort, DataViewManager, RowFilter, RowStateFilter, Sort, and Table for DataViews created from the DataViewManager.
+ /// </summary>
+ [Serializable]
+ public class DataViewSetting
+ {
+ #region Fields
+
+ bool defaultSort;
+ DataViewManager viewManager;
+ string rowFilter;
+ DataViewRowState rowStateFilter;
+ string sortString;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal DataViewSetting ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool ApplyDefaultSort {
+ get { return defaultSort; }
+ set { defaultSort = value; }
+ }
+
+ [Browsable (false)]
+ public DataViewManager DataViewManager {
+ get { return viewManager; }
+ }
+
+ public string RowFilter {
+ get { return rowFilter; }
+ set { rowFilter = value; }
+ }
+
+ public DataViewRowState RowStateFilter {
+ get { return rowStateFilter; }
+ set { rowStateFilter = value; }
+ }
+
+ public string Sort {
+ get { return sortString; }
+ set { sortString = value; }
+ }
+
+ [MonoTODO]
+ [Browsable (false)]
+ public DataTable Table {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs b/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs
new file mode 100755
index 00000000000..4634ee7de1b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataViewSettingCollection.cs
@@ -0,0 +1,106 @@
+//
+// System.Data.DataViewSettingCollection.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Miguel de Icaza (miguel@gnome.org)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data {
+ /// <summary>
+ /// Contains a read-only collection of DataViewSetting objects for each DataTable in a DataSet.
+ /// </summary>
+ [Serializable]
+ public class DataViewSettingCollection : ICollection, IEnumerable
+ {
+ #region Fields
+
+ ArrayList settingList;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal DataViewSettingCollection (DataViewManager manager)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [Browsable (false)]
+ public virtual int Count {
+ get { return settingList.Count; }
+ }
+
+ [Browsable (false)]
+ public bool IsReadOnly {
+ get { return settingList.IsReadOnly; }
+ }
+
+ [Browsable (false)]
+ public bool IsSynchronized {
+ get { return settingList.IsSynchronized; }
+ }
+
+ public virtual DataViewSetting this [DataTable dt] {
+ get {
+ for (int i = 0; i < settingList.Count; i++) {
+ DataViewSetting dvs = (DataViewSetting) settingList[i];
+ if (dvs.Table == dt)
+ return dvs;
+ }
+ return null;
+ }
+ set {
+ this[dt] = value;
+ }
+ }
+
+ public virtual DataViewSetting this[string name] {
+ get {
+ for (int i = 0; i < settingList.Count; i++) {
+ DataViewSetting dvs = (DataViewSetting) settingList[i];
+ if (dvs.Table.TableName == name)
+ return dvs;
+ }
+ return null;
+ }
+ }
+
+ public virtual DataViewSetting this[int index] {
+ get { return (DataViewSetting) settingList[index]; }
+ set { settingList[index] = value; }
+ }
+
+ [Browsable (false)]
+ public object SyncRoot {
+ get { return settingList.SyncRoot; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void CopyTo (Array ar, int index)
+ {
+ settingList.CopyTo (ar, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return settingList.GetEnumerator ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DbType.cs b/mcs/class/System.Data/System.Data/DbType.cs
new file mode 100644
index 00000000000..9a0cad9a631
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DbType.cs
@@ -0,0 +1,44 @@
+//
+// System.Data.DbType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Gets the data type of a field, a property, or a Parameter object of a .NET data provider.
+ /// </summary>
+ [Serializable]
+ public enum DbType
+ {
+ AnsiString = 0,
+ Binary = 1,
+ Byte = 2,
+ Boolean = 3,
+ Currency = 4,
+ Date = 5,
+ DateTime = 6,
+ Decimal = 7,
+ Double = 8,
+ Guid = 9,
+ Int16 = 10,
+ Int32 = 11,
+ Int64 = 12,
+ Object = 13,
+ SByte = 14,
+ Single = 15,
+ String = 16,
+ Time = 17,
+ UInt16 = 18,
+ UInt32 = 19,
+ UInt64 = 20,
+ VarNumeric = 21,
+ AnsiStringFixedLength = 22,
+ StringFixedLength = 23
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DeletedRowInaccessibleException.cs b/mcs/class/System.Data/System.Data/DeletedRowInaccessibleException.cs
new file mode 100644
index 00000000000..4088cc700b0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DeletedRowInaccessibleException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.DeletedRowInaccessibleException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class DeletedRowInaccessibleException : DataException
+ {
+ public DeletedRowInaccessibleException ()
+ : base (Locale.GetText ("This DataRow has been deleted"))
+ {
+ }
+
+ public DeletedRowInaccessibleException (string message)
+ : base (message)
+ {
+ }
+
+ protected DeletedRowInaccessibleException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DuplicateNameException.cs b/mcs/class/System.Data/System.Data/DuplicateNameException.cs
new file mode 100644
index 00000000000..660840716e3
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DuplicateNameException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.DuplicateNameException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class DuplicateNameException : DataException
+ {
+ public DuplicateNameException ()
+ : base (Locale.GetText ("There is a database object with the same name"))
+ {
+ }
+
+ public DuplicateNameException (string message)
+ : base (message)
+ {
+ }
+
+ protected DuplicateNameException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/EvaluateException.cs b/mcs/class/System.Data/System.Data/EvaluateException.cs
new file mode 100644
index 00000000000..426742eb90a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/EvaluateException.cs
@@ -0,0 +1,31 @@
+//
+// System.Data.EvaluateException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+ [Serializable]
+ public class EvaluateException : InvalidExpressionException
+ {
+ public EvaluateException ()
+ : base (Locale.GetText ("This expression cannot be evaluated"))
+ {
+ }
+
+ public EvaluateException (string message)
+ : base (message)
+ {
+ }
+
+ protected EvaluateException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/FillErrorEventArgs.cs b/mcs/class/System.Data/System.Data/FillErrorEventArgs.cs
new file mode 100755
index 00000000000..4950d833916
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/FillErrorEventArgs.cs
@@ -0,0 +1,58 @@
+//
+// System.Data.FillErrorEventArgs.cs
+//
+// Author:
+// Miguel de Icaza <miguel@ximian.com>
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data
+{
+ public class FillErrorEventArgs : EventArgs {
+ DataTable data_table;
+ object [] values;
+ Exception errors;
+ bool f_continue;
+
+ public FillErrorEventArgs (DataTable dataTable, object [] values)
+ {
+ this.data_table = dataTable;
+ this.values = values;
+ }
+
+ public bool Continue {
+ get {
+ return f_continue;
+ }
+
+ set {
+ f_continue = value;
+ }
+ }
+
+ public DataTable DataTable {
+ get {
+ return data_table;
+ }
+ }
+
+ public Exception Errors {
+ get {
+ return errors;
+ }
+
+ set {
+ errors = value;
+ }
+ }
+
+ public object [] Values {
+ get {
+ return values;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/FillErrorEventHandler.cs b/mcs/class/System.Data/System.Data/FillErrorEventHandler.cs
new file mode 100644
index 00000000000..8f63a935cdb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/FillErrorEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.FillErrorEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the FillError event.
+ /// </summary>
+ [Serializable]
+ public delegate void FillErrorEventHandler(object sender, FillErrorEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
new file mode 100644
index 00000000000..55d48213776
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
@@ -0,0 +1,377 @@
+//
+// System.Data.ForeignKeyConstraint.cs
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C) 2002 Franklin Wise
+// (C) 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Data {
+ [DefaultProperty ("ConstraintName")]
+ [Serializable]
+ public class ForeignKeyConstraint : Constraint
+ {
+ private UniqueConstraint _parentUniqueConstraint;
+ private DataColumn [] _parentColumns;
+ private DataColumn [] _childColumns;
+ private Rule _deleteRule;
+ private Rule _updateRule;
+ private AcceptRejectRule _acceptRejectRule;
+
+ #region Constructors
+
+ public ForeignKeyConstraint(DataColumn parentColumn, DataColumn childColumn)
+ {
+ if (null == parentColumn || null == childColumn) {
+ throw new ArgumentNullException("Neither parentColumn or" +
+ " childColumn can be null.");
+ }
+
+ _foreignKeyConstraint(null, new DataColumn[] {parentColumn},
+ new DataColumn[] {childColumn});
+ }
+
+ public ForeignKeyConstraint(DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ _foreignKeyConstraint(null, parentColumns, childColumns);
+ }
+
+ public ForeignKeyConstraint(string constraintName, DataColumn parentColumn, DataColumn childColumn)
+ {
+ if (null == parentColumn || null == childColumn) {
+ throw new ArgumentNullException("Neither parentColumn or" +
+ " childColumn can be null.");
+ }
+
+ _foreignKeyConstraint(constraintName, new DataColumn[] {parentColumn},
+ new DataColumn[] {childColumn});
+ }
+
+ public ForeignKeyConstraint(string constraintName, DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ _foreignKeyConstraint(constraintName, parentColumns, childColumns);
+ }
+
+ //special case
+ [MonoTODO]
+ [Browsable (false)]
+ public ForeignKeyConstraint(string constraintName, string parentTableName, string[] parentColumnNames, string[] childColumnNames, AcceptRejectRule acceptRejectRule, Rule deleteRule, Rule updateRule)
+ {
+ }
+
+ private void _foreignKeyConstraint(string constraintName, DataColumn[] parentColumns,
+ DataColumn[] childColumns)
+ {
+
+ //Validate
+ _validateColumns(parentColumns, childColumns);
+
+ //Set Constraint Name
+ base.ConstraintName = constraintName;
+
+ //Keep reference to columns
+ _parentColumns = parentColumns;
+ _childColumns = childColumns;
+ }
+
+ #endregion // Constructors
+
+ #region Helpers
+
+ private void _validateColumns(DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ //not null
+ if (null == parentColumns || null == childColumns)
+ throw new ArgumentNullException();
+
+ //at least one element in each array
+ if (parentColumns.Length < 1 || childColumns.Length < 1)
+ throw new ArgumentException("Neither ParentColumns or ChildColumns can't be" +
+ " zero length.");
+
+ //same size arrays
+ if (parentColumns.Length != childColumns.Length)
+ throw new ArgumentException("Parent columns and child columns must be the same length.");
+
+
+ DataTable ptable = parentColumns[0].Table;
+ DataTable ctable = childColumns[0].Table;
+
+
+ foreach (DataColumn pc in parentColumns)
+ {
+ //not null check
+ if (null == pc.Table)
+ {
+ throw new ArgumentException("All columns must belong to a table." +
+ " ColumnName: " + pc.ColumnName + " does not belong to a table.");
+ }
+
+ //All columns must belong to the same table
+ if (ptable != pc.Table)
+ throw new InvalidConstraintException("Parent columns must all belong to the same table.");
+
+ foreach (DataColumn cc in childColumns)
+ {
+ //not null
+ if (null == pc.Table)
+ {
+ throw new ArgumentException("All columns must belong to a table." +
+ " ColumnName: " + pc.ColumnName + " does not belong to a table.");
+ }
+
+ //All columns must belong to the same table.
+ if (ctable != cc.Table)
+ throw new InvalidConstraintException("Child columns must all belong to the same table.");
+
+
+ //Can't be the same column
+ if (pc == cc)
+ throw new InvalidOperationException("Parent and child columns can't be the same column.");
+
+ if (! pc.DataType.Equals(cc.DataType))
+ {
+ //LAMESPEC: spec says throw InvalidConstraintException
+ // implementation throws InvalidOperationException
+ throw new InvalidOperationException("Parent column is not type compatible with it's child"
+ + " column.");
+ }
+ }
+ }
+
+
+ //Same dataset. If both are null it's ok
+ if (ptable.DataSet != ctable.DataSet)
+ {
+ //LAMESPEC: spec says InvalidConstraintExceptoin
+ // impl does InvalidOperationException
+ throw new InvalidOperationException("Parent column and child column must belong to" +
+ " tables that belong to the same DataSet.");
+
+ }
+
+
+ }
+
+
+
+ private void _validateRemoveParentConstraint(ConstraintCollection sender,
+ Constraint constraint, ref bool cancel, ref string failReason)
+ {
+ //if we hold a reference to the parent then cancel it
+ if (constraint == _parentUniqueConstraint)
+ {
+ cancel = true;
+ failReason = "Cannot remove UniqueConstraint because the"
+ + " ForeignKeyConstraint " + this.ConstraintName + " exists.";
+ }
+ }
+
+ //Checks to see if a related unique constraint exists
+ //if it doesn't then a unique constraint is created.
+ //if a unique constraint can't be created an exception will be thrown
+ private void _ensureUniqueConstraintExists(ConstraintCollection collection,
+ DataColumn [] parentColumns)
+ {
+ //not null
+ if (null == parentColumns) throw new ArgumentNullException(
+ "ParentColumns can't be null");
+
+ UniqueConstraint uc = null;
+
+ //see if unique constraint already exists
+ //if not create unique constraint
+ uc = UniqueConstraint.GetUniqueConstraintForColumnSet(collection, parentColumns);
+
+ if (null == uc) uc = new UniqueConstraint(parentColumns, false); //could throw
+
+ //keep reference
+ _parentUniqueConstraint = uc;
+
+ //if this unique constraint is attempted to be removed before us
+ //we can fail the validation
+ collection.ValidateRemoveConstraint += new DelegateValidateRemoveConstraint(
+ _validateRemoveParentConstraint);
+ }
+
+
+ #endregion //Helpers
+
+ #region Properties
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("For accept and reject changes, indicates what kind of cascading should take place across this relation.")]
+ [DefaultValue (AcceptRejectRule.None)]
+ public virtual AcceptRejectRule AcceptRejectRule {
+ get { return _acceptRejectRule; }
+ set { _acceptRejectRule = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the child columns of this constraint.")]
+ [ReadOnly (true)]
+ public virtual DataColumn[] Columns {
+ get { return _childColumns; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("For deletions, indicates what kind of cascading should take place across this relation.")]
+ [DefaultValue (Rule.Cascade)]
+ public virtual Rule DeleteRule {
+ get { return _deleteRule; }
+ set { _deleteRule = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("For updates, indicates what kind of cascading should take place across this relation.")]
+ [DefaultValue (Rule.Cascade)]
+ public virtual Rule UpdateRule {
+ get { return _updateRule; }
+ set { _updateRule = value; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the parent columns of this constraint.")]
+ [ReadOnly (true)]
+ public virtual DataColumn[] RelatedColumns {
+ get { return _parentColumns; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the child table of this constraint.")]
+ [ReadOnly (true)]
+ public virtual DataTable RelatedTable {
+ get {
+ if (_parentColumns != null)
+ if (_parentColumns.Length > 0)
+ return _parentColumns[0].Table;
+
+ return null;
+ }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the table of this constraint.")]
+ [ReadOnly (true)]
+ public override DataTable Table {
+ get {
+ if (_childColumns != null)
+ if (_childColumns.Length > 0)
+ return _childColumns[0].Table;
+
+ return null;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override bool Equals(object key)
+ {
+ ForeignKeyConstraint fkc = key as ForeignKeyConstraint;
+ if (null == fkc) return false;
+
+ //if the fk constrains the same columns then they are equal
+ if (! DataColumn.AreColumnSetsTheSame( this.RelatedColumns, fkc.RelatedColumns))
+ return false;
+ if (! DataColumn.AreColumnSetsTheSame( this.Columns, fkc.Columns) )
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ //initialize hash1 and hash2 with default hashes
+ //any two DIFFERENT numbers will do here
+ int hash1 = 32, hash2 = 88;
+ int i;
+
+ //derive the hash code from the columns that way
+ //Equals and GetHashCode return Equal objects to be the
+ //same
+
+ //Get the first parent column hash
+ if (this.Columns.Length > 0)
+ hash1 ^= this.Columns[0].GetHashCode();
+
+ //get the rest of the parent column hashes if there any
+ for (i = 1; i < this.Columns.Length; i++)
+ {
+ hash1 ^= this.Columns[1].GetHashCode();
+
+ }
+
+ //Get the child column hash
+ if (this.RelatedColumns.Length > 0)
+ hash2 ^= this.Columns[0].GetHashCode();
+
+ for (i = 1; i < this.RelatedColumns.Length; i++)
+ {
+ hash2 ^= this.RelatedColumns[1].GetHashCode();
+ }
+
+ //combine the two hashes
+ return hash1 ^ hash2;
+ }
+
+ internal override void AddToConstraintCollectionSetup(
+ ConstraintCollection collection)
+ {
+
+ //run Ctor rules again
+ _validateColumns(_parentColumns, _childColumns);
+
+ //we must have a unique constraint on the parent
+ _ensureUniqueConstraintExists(collection, _parentColumns);
+
+ //Make sure we can create this thing
+ AssertConstraint(); //TODO:if this fails and we created a unique constraint
+ //we should probably roll it back
+
+ }
+
+
+ [MonoTODO]
+ internal override void RemoveFromConstraintCollectionCleanup(
+ ConstraintCollection collection)
+ {
+ return; //no rules yet
+ }
+
+ [MonoTODO]
+ internal override void AssertConstraint()
+ {
+ //Constraint only works if both tables are part of the same dataset
+
+ //if DataSet ...
+ if (Table == null || RelatedTable == null) return; //TODO: Do we want this
+
+ if (Table.DataSet == null || RelatedTable.DataSet == null) return; //
+
+ //TODO:
+ //check for orphaned children
+ //check for...
+
+ }
+
+ [MonoTODO]
+ internal override void AssertConstraint(DataRow row)
+ {
+ //Implement: this should be used to validate ForeignKeys constraints
+ //when modifiying the DataRow values of a DataTable.
+ }
+
+ #endregion // Methods
+ }
+
+}
diff --git a/mcs/class/System.Data/System.Data/IColumnMapping.cs b/mcs/class/System.Data/System.Data/IColumnMapping.cs
new file mode 100644
index 00000000000..2e307763533
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IColumnMapping.cs
@@ -0,0 +1,35 @@
+//
+// System.Data.IColumnMapping.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Associates a data source column with a DataSet column, and is implemented by the DataColumnMapping class, which is used in common by .NET data providers.
+ /// </summary>
+ public interface IColumnMapping
+ {
+ /// <summary>
+ /// Gets or sets the name of the column within the DataSet to map to.
+ /// </summary>
+ string DataSetColumn
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the column within the data source to map from. The name is case-sensitive.
+ /// </summary>
+ string SourceColumn
+ {
+ get;
+ set;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IColumnMappingCollection.cs b/mcs/class/System.Data/System.Data/IColumnMappingCollection.cs
new file mode 100644
index 00000000000..a23a2ae6056
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IColumnMappingCollection.cs
@@ -0,0 +1,35 @@
+//
+// System.Data.IColumnMappingCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System.Collections;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Contains a collection of ColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET data providers.
+ /// </summary>
+ public interface IColumnMappingCollection : IList, ICollection, IEnumerable
+ {
+ IColumnMapping Add(string sourceColumnName, string dataSetColumnName);
+
+ bool Contains(string sourceColumnName);
+
+ IColumnMapping GetByDataSetColumn(string dataSetColumnName);
+
+ int IndexOf(string sourceColumnName);
+
+ void RemoveAt(string sourceColumnName);
+
+ object this[string index]
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDataAdapter.cs b/mcs/class/System.Data/System.Data/IDataAdapter.cs
new file mode 100644
index 00000000000..be6f09036b0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataAdapter.cs
@@ -0,0 +1,33 @@
+//
+// System.Data.IDataAdapter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Allows an object to implement a DataAdapter, and represents a set of methods and mapping action-related properties used to fill and refresh a DataSet and update a data source.
+ /// </summary>
+ public interface IDataAdapter
+ {
+ int Fill(DataSet dataSet);
+
+ DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType);
+
+ IDataParameter[] GetFillParameters();
+
+ int Update(DataSet dataSet);
+
+ MissingMappingAction MissingMappingAction{get;set;}
+
+ MissingSchemaAction MissingSchemaAction{get;set;}
+
+ ITableMappingCollection TableMappings{get;}
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDataParameter.cs b/mcs/class/System.Data/System.Data/IDataParameter.cs
new file mode 100644
index 00000000000..3528cb2f246
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataParameter.cs
@@ -0,0 +1,36 @@
+//
+// System.Data.IDataParameter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally, its mapping to DataSet columns; and is implemented by .NET data providers that access data sources.
+ /// </summary>
+ public interface IDataParameter
+ {
+
+ DbType DbType{get;set;}
+
+ ParameterDirection Direction{get;set;}
+
+ bool IsNullable{get;}
+
+ string ParameterName{get;set;}
+
+ string SourceColumn{get;set;}
+
+ DataRowVersion SourceVersion {get;set;}
+
+ object Value {get;set;}
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDataParameterCollection.cs b/mcs/class/System.Data/System.Data/IDataParameterCollection.cs
new file mode 100644
index 00000000000..41da8ab9d77
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataParameterCollection.cs
@@ -0,0 +1,28 @@
+//
+// System.Data.IDataParameterCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object and their mappings to DataSet columns, and is implemented by .NET data providers that access data sources.
+ /// </summary>
+ public interface IDataParameterCollection : IList, ICollection, IEnumerable
+ {
+ void RemoveAt(string parameterName);
+
+ int IndexOf(string parameterName);
+
+ bool Contains(string parameterName);
+
+ object this[string parameterName]{get; set;}
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDataReader.cs b/mcs/class/System.Data/System.Data/IDataReader.cs
new file mode 100644
index 00000000000..746d0d72ed6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataReader.cs
@@ -0,0 +1,33 @@
+//
+// System.Data.IDataReader.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams of result sets obtained by executing a command at a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDataReader : IDisposable, IDataRecord
+ {
+ void Close();
+
+ DataTable GetSchemaTable();
+
+ bool NextResult();
+
+ bool Read();
+
+ int Depth{get;}
+
+ bool IsClosed{get;}
+
+ int RecordsAffected{get;}
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDataRecord.cs b/mcs/class/System.Data/System.Data/IDataRecord.cs
new file mode 100644
index 00000000000..0bb6376da12
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataRecord.cs
@@ -0,0 +1,71 @@
+//
+// System.Data.IDataRecord.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Provides access to the column values within
+ /// each row for a DataReader, and is implemented by .NET data
+ /// providers that access relational databases.
+ /// </summary>
+ public interface IDataRecord
+ {
+ bool GetBoolean(int i);
+
+ byte GetByte(int i);
+
+ long GetBytes(int i, long fieldOffset, byte[] buffer,
+ int bufferOffset, int length);
+
+ char GetChar(int i);
+
+ long GetChars(int i, long fieldOffset, char[] buffer,
+ int bufferOffset, int length);
+
+ IDataReader GetData(int i);
+
+ string GetDataTypeName(int i);
+
+ DateTime GetDateTime(int i);
+
+ decimal GetDecimal(int i);
+
+ double GetDouble(int i);
+
+ Type GetFieldType(int i);
+
+ float GetFloat(int i);
+
+ Guid GetGuid(int i);
+
+ short GetInt16(int i);
+
+ int GetInt32(int i);
+
+ long GetInt64(int i);
+
+ string GetName(int i);
+
+ int GetOrdinal(string name);
+
+ string GetString(int i);
+
+ object GetValue(int i);
+
+ int GetValues(object[] values);
+
+ bool IsDBNull(int i);
+
+ int FieldCount{get;}
+
+ object this[string name]{get;}
+
+ object this[int i]{get;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbCommand.cs b/mcs/class/System.Data/System.Data/IDbCommand.cs
new file mode 100644
index 00000000000..6242c3fdb6b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbCommand.cs
@@ -0,0 +1,47 @@
+//
+// System.Data.IDBCommand.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a SQL statement that is executed while connected to a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbCommand : IDisposable
+ {
+ void Cancel();
+
+ IDbDataParameter CreateParameter();
+
+ int ExecuteNonQuery();
+
+ IDataReader ExecuteReader();
+
+ IDataReader ExecuteReader(CommandBehavior behavior);
+
+ object ExecuteScalar();
+
+ void Prepare();
+
+ string CommandText{get; set;}
+
+ int CommandTimeout{get; set;}
+
+ CommandType CommandType{get; set;}
+
+ IDbConnection Connection{get; set;}
+
+ IDataParameterCollection Parameters{get;}
+
+ IDbTransaction Transaction{get; set;}
+
+ UpdateRowSource UpdatedRowSource{get; set;}
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDbConnection.cs b/mcs/class/System.Data/System.Data/IDbConnection.cs
new file mode 100644
index 00000000000..17f44da8da5
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbConnection.cs
@@ -0,0 +1,41 @@
+//
+// System.Data.IDBConnection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents an open connection to a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbConnection : IDisposable
+ {
+ IDbTransaction BeginTransaction();
+
+ IDbTransaction BeginTransaction(IsolationLevel il);
+
+ void ChangeDatabase(string databaseName);
+
+ void Close();
+
+ IDbCommand CreateCommand();
+
+ void Open();
+
+
+ string ConnectionString{get; set;}
+
+ int ConnectionTimeout{get;}
+
+ string Database{get;}
+
+ ConnectionState State{get;}
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDbDataAdapter.cs b/mcs/class/System.Data/System.Data/IDbDataAdapter.cs
new file mode 100644
index 00000000000..78c1173da09
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbDataAdapter.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.IDbDataAdapter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used to fill the DataSet and update a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbDataAdapter : IDataAdapter
+ {
+ IDbCommand DeleteCommand{get; set;}
+
+ IDbCommand InsertCommand{get; set;}
+
+ IDbCommand SelectCommand{get; set;}
+
+ IDbCommand UpdateCommand{get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbDataParameter.cs b/mcs/class/System.Data/System.Data/IDbDataParameter.cs
new file mode 100644
index 00000000000..5eeba691179
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbDataParameter.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.IDbDataParameter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Used by the Visual Basic .NET Data Designers to represent a parameter to a Command object, and optionally, its mapping to DataSet columns.
+ /// </summary>
+ public interface IDbDataParameter : IDataParameter
+ {
+ byte Precision{get; set;}
+
+ byte Scale{get; set;}
+
+ int Size{get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbTransaction.cs b/mcs/class/System.Data/System.Data/IDbTransaction.cs
new file mode 100644
index 00000000000..792a78052b0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbTransaction.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.IDbTransaction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a transaction to be performed at a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbTransaction : IDisposable
+ {
+ void Commit();
+
+ void Rollback();
+
+ IDbConnection Connection{get;}
+
+ IsolationLevel IsolationLevel{get;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/ITableMapping.cs b/mcs/class/System.Data/System.Data/ITableMapping.cs
new file mode 100644
index 00000000000..82f5329b083
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ITableMapping.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.ITableMapping.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Associates a source table with a table in a DataSet, and is implemented by the DataTableMapping class, which is used in common by .NET data providers.
+ /// </summary>
+ public interface ITableMapping
+ {
+ IColumnMappingCollection ColumnMappings{get;}
+
+ string DataSetTable{get; set;}
+
+ string SourceTable{get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/ITableMappingCollection.cs b/mcs/class/System.Data/System.Data/ITableMappingCollection.cs
new file mode 100644
index 00000000000..5ca052f94ab
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ITableMappingCollection.cs
@@ -0,0 +1,31 @@
+//
+// System.Data.ITableMappingCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System.Collections;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Contains a collection of TableMapping objects, and is implemented by the DataTableMappingCollection, which is used in common by .NET data providers.
+ /// </summary>
+ public interface ITableMappingCollection : IList, ICollection, IEnumerable
+ {
+ ITableMapping Add(string sourceTableName, string dataSetTableName);
+
+ bool Contains(string sourceTableName);
+
+ ITableMapping GetByDataSetTable(string dataSetTableName);
+
+ int IndexOf(string sourceTableName);
+
+ void RemoveAt(string sourceTableName);
+
+ object this[string index]{get; set;}
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/InRowChangingEventException.cs b/mcs/class/System.Data/System.Data/InRowChangingEventException.cs
new file mode 100644
index 00000000000..8c7be400702
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/InRowChangingEventException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.InRowChangingEventException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class InRowChangingEventException : DataException
+ {
+ public InRowChangingEventException ()
+ : base (Locale.GetText ("Cannot EndEdit within a RowChanging event"))
+ {
+ }
+
+ public InRowChangingEventException (string message)
+ : base (message)
+ {
+ }
+
+ protected InRowChangingEventException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs
new file mode 100644
index 00000000000..9d0a3031de2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs
@@ -0,0 +1,122 @@
+//
+// System.Data.InternalDataCollectionBase.cs
+//
+// Base class for:
+// DataRowCollection
+// DataColumnCollection
+// DataTableCollection
+// DataRelationCollection
+// DataConstraintCollection
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+// Tim Coleman <tim@timcoleman.com>
+//
+// (C) Copyright 2002 Daniel Morgan
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Base class for System.Data collection classes
+ /// that are used within a DataTable object
+ /// to represent a collection of
+ /// relations, tables, rows, columns, and constraints
+ /// </summary>
+
+ public class InternalDataCollectionBase : ICollection, IEnumerable
+ {
+ #region Fields
+
+ protected ArrayList list = null;
+ protected bool readOnly = false;
+ protected bool synchronized = false;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO]
+ public InternalDataCollectionBase()
+ {
+ list = new ArrayList();
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets the total number of elements in a collection.
+ /// </summary>
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the InternalDataCollectionBase is read-only.
+ /// </summary>
+ [Browsable (false)]
+ public bool IsReadOnly {
+ get { return readOnly; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the InternalDataCollectionBase is synchronized.
+ /// </summary>
+ [Browsable (false)]
+ public bool IsSynchronized {
+ get { return synchronized; }
+ }
+
+ /// <summary>
+ /// Gets the items of the collection as a list.
+ /// </summary>
+ protected virtual ArrayList List {
+ get { return list; }
+ }
+
+ /// <summary>
+ /// Gets an object that can be used to synchronize the collection.
+ /// </summary>
+ [Browsable (false)]
+ public object SyncRoot {
+ [MonoTODO]
+ get {
+ // FIXME: how do we sync?
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
+ /// Copies all the elements in the current InternalDataCollectionBase to a one-
+ /// dimensional Array, starting at the specified InternalDataCollectionBase index.
+ /// </summary>
+ public void CopyTo(Array ar, int index)
+ {
+ list.CopyTo (ar, index);
+
+ }
+
+ /// <summary>
+ /// Gets an IEnumerator for the collection.
+ /// </summary>
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/InvalidConstraintException.cs b/mcs/class/System.Data/System.Data/InvalidConstraintException.cs
new file mode 100644
index 00000000000..2327b7d2a9e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/InvalidConstraintException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.InvalidConstraintException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class InvalidConstraintException : DataException
+ {
+ public InvalidConstraintException ()
+ : base (Locale.GetText ("Cannot access or create this relation"))
+ {
+ }
+
+ public InvalidConstraintException (string message)
+ : base (message)
+ {
+ }
+
+ protected InvalidConstraintException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/InvalidExpressionException.cs b/mcs/class/System.Data/System.Data/InvalidExpressionException.cs
new file mode 100644
index 00000000000..ac383cba5fe
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/InvalidExpressionException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.InvalidExpressionException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class InvalidExpressionException : DataException
+ {
+ public InvalidExpressionException ()
+ : base (Locale.GetText ("This Expression is invalid"))
+ {
+ }
+
+ public InvalidExpressionException (string message)
+ : base (message)
+ {
+ }
+
+ protected InvalidExpressionException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IsolationLevel.cs b/mcs/class/System.Data/System.Data/IsolationLevel.cs
new file mode 100644
index 00000000000..3a25ef9cc0e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IsolationLevel.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.IsolationLevel.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the transaction locking behavior for the connection.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum IsolationLevel
+ {
+ Unspecified = -1,
+ Chaos = 16,
+ ReadUncommitted = 256,
+ ReadCommitted = 4096,
+ RepeatableRead = 65536,
+ Serializable = 1048576
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/Locale.cs b/mcs/class/System.Data/System.Data/Locale.cs
new file mode 100755
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/MappingType.cs b/mcs/class/System.Data/System.Data/MappingType.cs
new file mode 100644
index 00000000000..dbdeb9fc23e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MappingType.cs
@@ -0,0 +1,26 @@
+//
+// System.Data.MappingType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how a DataColumn is mapped.
+ /// </summary>
+ [Serializable]
+ public enum MappingType
+ {
+ Element = 1,
+ Attribute = 2,
+ SimpleContent = 3,
+ Hidden = 4
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs b/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs
new file mode 100644
index 00000000000..e34f1da6a35
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MergeFailedEventArgs.cs
@@ -0,0 +1,46 @@
+//
+// System.Data.MergeFailedEventArgs.cs
+//
+// Author:
+// Miguel de Icaza <miguel@ximian.com>
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Data {
+ public class MergeFailedEventArgs : EventArgs
+ {
+ #region Fields
+
+ DataTable data_table;
+ string conflict;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MergeFailedEventArgs (DataTable dataTable, string conflict)
+ {
+ this.data_table = dataTable;
+ this.conflict = conflict;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public DataTable Table {
+ get { return data_table; }
+ }
+
+ public string Conflict {
+ get { return conflict; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs b/mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs
new file mode 100644
index 00000000000..3ec7962496a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.MergeFailedEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the MergeFailed event.
+ /// </summary>
+ [Serializable]
+ public delegate void MergeFailedEventHandler(object sender, MergeFailedEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MissingMappingAction.cs b/mcs/class/System.Data/System.Data/MissingMappingAction.cs
new file mode 100644
index 00000000000..74ce838d9c9
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MissingMappingAction.cs
@@ -0,0 +1,24 @@
+//
+// System.Data.MissingMappingAction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Determines the action that occurs when a mapping is missing from a source table or a source column.
+ /// </summary>
+ [Serializable]
+ public enum MissingMappingAction
+ {
+ Passthrough = 1,
+ Ignore = 2,
+ Error = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MissingPrimaryKeyException.cs b/mcs/class/System.Data/System.Data/MissingPrimaryKeyException.cs
new file mode 100644
index 00000000000..dcb0b3aca59
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MissingPrimaryKeyException.cs
@@ -0,0 +1,33 @@
+//
+// System.Data.MissingPrimaryKeyException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+
+ [Serializable]
+ public class MissingPrimaryKeyException : DataException
+ {
+ public MissingPrimaryKeyException ()
+ : base (Locale.GetText ("This table has no primary key"))
+ {
+ }
+
+ public MissingPrimaryKeyException (string message)
+ : base (message)
+ {
+ }
+
+ protected MissingPrimaryKeyException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/MissingSchemaAction.cs b/mcs/class/System.Data/System.Data/MissingSchemaAction.cs
new file mode 100644
index 00000000000..52051457961
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MissingSchemaAction.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.MissingSchemaAction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the action to take when adding data to the DataSet and the required DataTable or DataColumn is missing.
+ /// </summary>
+ [Serializable]
+ public enum MissingSchemaAction
+ {
+ Add = 1,
+ Ignore = 2,
+ Error = 3,
+ AddWithKey = 4
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/NoNullAllowedException.cs b/mcs/class/System.Data/System.Data/NoNullAllowedException.cs
new file mode 100644
index 00000000000..3a5593285d3
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/NoNullAllowedException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.NoNullAllowedException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class NoNullAllowedException : DataException
+ {
+ public NoNullAllowedException ()
+ : base (Locale.GetText ("Cannot insert a NULL value"))
+ {
+ }
+
+ public NoNullAllowedException (string message)
+ : base (message)
+ {
+ }
+
+ protected NoNullAllowedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ParameterDirection.cs b/mcs/class/System.Data/System.Data/ParameterDirection.cs
new file mode 100644
index 00000000000..7de26dfc868
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ParameterDirection.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.ParameterDirection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the type of a parameter within a query relative to the DataSet.
+ /// </summary>
+ [Serializable]
+ public enum ParameterDirection
+ {
+ Input = 1,
+ Output = 2,
+ InputOutput = 3,
+ ReturnValue = 6
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/PropertyAttributes.cs b/mcs/class/System.Data/System.Data/PropertyAttributes.cs
new file mode 100644
index 00000000000..6e43646100e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/PropertyAttributes.cs
@@ -0,0 +1,28 @@
+//
+// System.Data.PropertyAttributes.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the attributes of a property.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum PropertyAttributes
+ {
+ NotSupported = 0,
+ Required = 1,
+ Optional = 2,
+ Read = 512,
+ Write = 1024
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/PropertyCollection.cs b/mcs/class/System.Data/System.Data/PropertyCollection.cs
new file mode 100644
index 00000000000..ef720923387
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/PropertyCollection.cs
@@ -0,0 +1,31 @@
+//
+// System.Data.PropertyCollection.cs
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c) Ximian, Inc. 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// a collection of properties that can be added to
+ /// DataColumn, DataSet, or DataTable.
+ /// The ExtendedProperties property of a
+ /// DataColumn, DataSet, or DataTable class can
+ /// retrieve a PropertyCollection.
+ /// </summary>
+ public class PropertyCollection : Hashtable {
+ [MonoTODO]
+ public PropertyCollection() {
+ }
+
+ // the only public methods and properties
+ // are all inherited from Hashtable
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ReadOnlyException.cs b/mcs/class/System.Data/System.Data/ReadOnlyException.cs
new file mode 100644
index 00000000000..a45f5d22d17
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ReadOnlyException.cs
@@ -0,0 +1,33 @@
+//
+// System.Data.ReadOnlyException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+
+ [Serializable]
+ public class ReadOnlyException : DataException
+ {
+ public ReadOnlyException ()
+ : base (Locale.GetText ("Cannot change a value in a read-only column"))
+ {
+ }
+
+ public ReadOnlyException (string message)
+ : base (message)
+ {
+ }
+
+ protected ReadOnlyException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs b/mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs
new file mode 100644
index 00000000000..a7a6674f1c2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ResDescriptionAttribute.cs
@@ -0,0 +1,41 @@
+//
+// System.Data/ResDescriptionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data {
+ [AttributeUsage (AttributeTargets.All)]
+ internal sealed class ResDescriptionAttribute : DescriptionAttribute
+ {
+ #region Fields
+
+ string description;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ResDescriptionAttribute (string description)
+ : base (description)
+ {
+ this.description = description;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Description {
+ get { return description; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/RowNotInTableException.cs b/mcs/class/System.Data/System.Data/RowNotInTableException.cs
new file mode 100644
index 00000000000..9209312d0ca
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/RowNotInTableException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.RowNotInTableException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class RowNotInTableException : DataException
+ {
+ public RowNotInTableException ()
+ : base (Locale.GetText ("This DataRow is not in this DataTable"))
+ {
+ }
+
+ public RowNotInTableException (string message)
+ : base (message)
+ {
+ }
+
+ protected RowNotInTableException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/Rule.cs b/mcs/class/System.Data/System.Data/Rule.cs
new file mode 100644
index 00000000000..e8fc4166f34
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/Rule.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.Rule.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Indicates the action that occurs when a ForeignKeyConstraint is enforced.
+ /// </summary>
+ [Serializable]
+ public enum Rule
+ {
+ None = 0,
+ Cascade = 1,
+ SetNull = 2,
+ SetDefault = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/SchemaType.cs b/mcs/class/System.Data/System.Data/SchemaType.cs
new file mode 100644
index 00000000000..8c0d1dbf904
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/SchemaType.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.SchemaType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how to handle existing schema mappings when performing a FillSchema operation.
+ /// </summary>
+ [Serializable]
+ public enum SchemaType
+ {
+ Source = 1,
+ Mapped = 2
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/SqlDbType.cs b/mcs/class/System.Data/System.Data/SqlDbType.cs
new file mode 100644
index 00000000000..9c4afccf5e0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/SqlDbType.cs
@@ -0,0 +1,45 @@
+//
+// System.Data.SqlDbType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies SQL Server data types.
+ /// </summary>
+ [Serializable]
+ public enum SqlDbType
+ {
+ BigInt = 0,
+ Binary = 1,
+ Bit = 2,
+ Char = 3,
+ DateTime = 4,
+ Decimal = 5,
+ Float = 6,
+ Image = 7,
+ Int = 8,
+ Money = 9,
+ NChar = 10,
+ NText = 11,
+ NVarChar = 12,
+ Real = 13,
+ UniqueIdentifier = 14,
+ SmallDateTime = 15,
+ SmallInt = 16,
+ SmallMoney = 17,
+ Text = 18,
+ Timestamp = 19,
+ TinyInt = 20,
+ VarBinary = 21,
+ VarChar = 22,
+ Variant = 23
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/StateChangeEventArgs.cs b/mcs/class/System.Data/System.Data/StateChangeEventArgs.cs
new file mode 100644
index 00000000000..5ec455c44ca
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StateChangeEventArgs.cs
@@ -0,0 +1,47 @@
+//
+// System.Data.StateChangeEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Data {
+ public sealed class StateChangeEventArgs : EventArgs
+ {
+ #region Fields
+
+ ConnectionState originalState;
+ ConnectionState currentState;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public StateChangeEventArgs (ConnectionState originalState, ConnectionState currentState)
+ {
+ this.originalState = originalState;
+ this.currentState = currentState;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ConnectionState CurrentState {
+ get { return currentState; }
+ }
+
+ public ConnectionState OriginalState {
+ get { return originalState; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/StateChangeEventHandler.cs b/mcs/class/System.Data/System.Data/StateChangeEventHandler.cs
new file mode 100644
index 00000000000..29ad7703030
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StateChangeEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.StateChangeEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the StateChange event.
+ /// </summary>
+ [Serializable]
+ public delegate void StateChangeEventHandler(object sender, StateChangeEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/StatementType.cs b/mcs/class/System.Data/System.Data/StatementType.cs
new file mode 100644
index 00000000000..11cc51c1bba
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StatementType.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.StatementType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the type of SQL query to be used by the OleDbRowUpdatedEventArgs, OleDbRowUpdatingEventArgs, SqlRowUpdatedEventArgs, or SqlRowUpdatingEventArgs class.
+ /// </summary>
+ [Serializable]
+ public enum StatementType
+ {
+ Select = 0,
+ Insert = 1,
+ Update = 2,
+ Delete = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/StrongTypingException.cs b/mcs/class/System.Data/System.Data/StrongTypingException.cs
new file mode 100644
index 00000000000..ce6322935df
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StrongTypingException.cs
@@ -0,0 +1,31 @@
+//
+// System.Data.StrongTypingException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+ [Serializable]
+ public class StrongTypingException : DataException
+ {
+ public StrongTypingException ()
+ : base (Locale.GetText ("Trying to access a DBNull value in a strongly-typed DataSet"))
+ {
+ }
+
+ public StrongTypingException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ protected StrongTypingException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/SyntaxErrorException.cs b/mcs/class/System.Data/System.Data/SyntaxErrorException.cs
new file mode 100644
index 00000000000..6f97458d654
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/SyntaxErrorException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.SyntaxErrorException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+ [Serializable]
+ public class SyntaxErrorException : InvalidExpressionException
+ {
+ public SyntaxErrorException ()
+ : base (Locale.GetText ("There is a syntax error in this Expression"))
+ {
+ }
+
+ public SyntaxErrorException (string message)
+ : base (message)
+ {
+ }
+
+ protected SyntaxErrorException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/TODOAttribute.cs b/mcs/class/System.Data/System.Data/TODOAttribute.cs
new file mode 100644
index 00000000000..9aae1ca30bb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Data {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs b/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs
new file mode 100644
index 00000000000..d3ad34c860a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/TypeDataSetGeneratorException.cs
@@ -0,0 +1,34 @@
+//
+// System.Data.TypedDataSetGeneratorException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class TypedDataSetGeneratorException : DataException
+ {
+ public TypedDataSetGeneratorException ()
+ : base (Locale.GetText ("There is a name conflict"))
+ {
+ }
+
+ [MonoTODO]
+ public TypedDataSetGeneratorException (ArrayList list)
+ : base (Locale.GetText ("There is a name conflict"))
+ {
+ }
+
+ protected TypedDataSetGeneratorException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/UniqueConstraint.cs b/mcs/class/System.Data/System.Data/UniqueConstraint.cs
new file mode 100644
index 00000000000..f75e8a2aedc
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/UniqueConstraint.cs
@@ -0,0 +1,427 @@
+//
+// System.Data.UniqueConstraint.cs
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+// Daniel Morgan <danmorg@sc.rr.com>
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) 2002 Franklin Wise
+// (C) 2002 Daniel Morgan
+// Copyright (C) Tim Coleman, 2002
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Data {
+ [DefaultProperty ("ConstraintName")]
+ public class UniqueConstraint : Constraint
+ {
+ private bool _isPrimaryKey = false;
+ private DataTable _dataTable; //set by ctor except when unique case
+
+ private DataColumn [] _dataColumns;
+
+ //TODO:provide helpers for this case
+ private string [] _dataColumnNames; //unique case
+
+
+ #region Constructors
+
+ public UniqueConstraint (DataColumn column)
+ {
+ _uniqueConstraint ("", column, false);
+ }
+
+ public UniqueConstraint (DataColumn[] columns)
+ {
+ _uniqueConstraint ("", columns, false);
+ }
+
+ public UniqueConstraint (DataColumn column, bool isPrimaryKey)
+ {
+ _uniqueConstraint ("", column, isPrimaryKey);
+ }
+
+ public UniqueConstraint (DataColumn[] columns, bool isPrimaryKey)
+ {
+ _uniqueConstraint ("", columns, isPrimaryKey);
+ }
+
+ public UniqueConstraint (string name, DataColumn column)
+ {
+ _uniqueConstraint (name, column, false);
+ }
+
+ public UniqueConstraint (string name, DataColumn[] columns)
+ {
+ _uniqueConstraint (name, columns, false);
+ }
+
+ public UniqueConstraint (string name, DataColumn column, bool isPrimaryKey)
+ {
+ _uniqueConstraint (name, column, isPrimaryKey);
+ }
+
+ public UniqueConstraint (string name, DataColumn[] columns, bool isPrimaryKey)
+ {
+ _uniqueConstraint (name, columns, isPrimaryKey);
+ }
+
+ //Special case. Can only be added to the Collection with AddRange
+ [MonoTODO]
+ [Browsable (false)]
+ public UniqueConstraint (string name, string[] columnNames, bool isPrimaryKey)
+ {
+ throw new NotImplementedException(); //need to finish related logic
+ /*
+ base.ConstraintName = name;
+
+ //set unique
+ //must set unique when added to the collection
+
+ //keep list of names to resolve later
+ _dataColumnNames = columnNames;
+
+ _isPrimaryKey = isPrimaryKey;
+ */
+ }
+
+ //helper ctor
+ private void _uniqueConstraint(string name, DataColumn column, bool isPrimaryKey)
+ {
+ //validate
+ _validateColumn (column);
+
+ //Set Constraint Name
+ base.ConstraintName = name;
+
+ //set unique
+ column.Unique = true;
+
+ //keep reference
+ _dataColumns = new DataColumn [] {column};
+
+ //PK?
+ _isPrimaryKey = isPrimaryKey;
+
+ //Get table reference
+ _dataTable = column.Table;
+ }
+
+ //helpter ctor
+ private void _uniqueConstraint(string name, DataColumn[] columns, bool isPrimaryKey)
+ {
+
+ //validate
+ _validateColumns (columns, out _dataTable);
+
+ //Set Constraint Name
+ base.ConstraintName = name;
+
+ //set unique
+ if (columns.Length == 1) columns[0].Unique = true;
+
+ //keep reference
+ _dataColumns = columns;
+
+ //PK?
+ _isPrimaryKey = isPrimaryKey;
+
+ }
+
+ #endregion // Constructors
+
+ #region Helpers
+
+ private void _validateColumns(DataColumn [] columns)
+ {
+ DataTable table;
+ _validateColumns(columns, out table);
+ }
+
+ //Validates a collection of columns with the ctor rules
+ private void _validateColumns(DataColumn [] columns, out DataTable table) {
+ table = null;
+
+ //not null
+ if (null == columns) throw new ArgumentNullException();
+
+ //check that there is at least one column
+ //LAMESPEC: not in spec
+ if (columns.Length < 1)
+ throw new InvalidConstraintException("Must be at least one column.");
+
+ DataTable compareTable = columns[0].Table;
+ //foreach
+ foreach (DataColumn col in columns){
+
+ //check individual column rules
+ _validateColumn (col);
+
+
+ //check that columns are all from the same table??
+ //LAMESPEC: not in spec
+ if (compareTable != col.Table)
+ throw new InvalidConstraintException("Columns must be from the same table.");
+
+ }
+
+ table = compareTable;
+ }
+
+ //validates a column with the ctor rules
+ private void _validateColumn(DataColumn column) {
+
+ //not null
+ if (null == column) throw new ArgumentNullException();
+
+ //column must belong to a table
+ //LAMESPEC: not in spec
+ if (null == column.Table)
+ throw new ArgumentException("Column " + column.ColumnName + " must belong to a table.");
+
+ }
+
+ internal static void SetAsPrimaryKey(ConstraintCollection collection, UniqueConstraint newPrimaryKey)
+ {
+ //not null
+ if (null == collection) throw new ArgumentNullException("ConstraintCollection can't be null.");
+
+ //make sure newPrimaryKey belongs to the collection parm unless it is null
+ if ( collection.IndexOf(newPrimaryKey) < 1 && (null != newPrimaryKey) )
+ throw new ArgumentException("newPrimaryKey must belong to collection.");
+
+ //Get existing pk
+ UniqueConstraint uc = GetPrimaryKeyConstraint(collection);
+
+ //clear existing
+ if (null != uc) uc._isPrimaryKey = false;
+
+ //set new key
+ if (null != newPrimaryKey) newPrimaryKey._isPrimaryKey = true;
+
+
+ }
+
+ internal static UniqueConstraint GetPrimaryKeyConstraint(ConstraintCollection collection)
+ {
+ if (null == collection) throw new ArgumentNullException("Collection can't be null.");
+
+ UniqueConstraint uc;
+ IEnumerator enumer = collection.GetEnumerator();
+ while (enumer.MoveNext())
+ {
+ uc = enumer.Current as UniqueConstraint;
+ if (null == uc) continue;
+
+ if (uc.IsPrimaryKey) return uc;
+ }
+
+ //if we got here there was no pk
+ return null;
+
+ }
+
+ internal static UniqueConstraint GetUniqueConstraintForColumnSet(ConstraintCollection collection,
+ DataColumn[] columns)
+ {
+ if (null == collection) throw new ArgumentNullException("Collection can't be null.");
+ if (null == columns ) return null;
+
+ UniqueConstraint uniqueConstraint;
+ IEnumerator enumer = collection.GetEnumerator();
+ while (enumer.MoveNext())
+ {
+ uniqueConstraint = enumer.Current as UniqueConstraint;
+ if (uniqueConstraint != null)
+ {
+ if ( DataColumn.AreColumnSetsTheSame(uniqueConstraint.Columns, columns) )
+ {
+ return uniqueConstraint;
+ }
+ }
+ }
+ return null;
+ }
+
+ #endregion //Helpers
+
+ #region Properties
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the columns of this constraint.")]
+ [ReadOnly (true)]
+ public virtual DataColumn[] Columns {
+ get { return _dataColumns; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates if this constraint is a primary key.")]
+ [ReadOnly (true)]
+ public bool IsPrimaryKey {
+ get { return _isPrimaryKey; }
+ }
+
+ [DataCategory ("Data")]
+ [DataSysDescription ("Indicates the table of this constraint.")]
+ [ReadOnly (true)]
+ public override DataTable Table {
+ get { return _dataTable; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override bool Equals(object key2) {
+
+ UniqueConstraint cst = key2 as UniqueConstraint;
+ if (null == cst) return false;
+
+ //according to spec if the cols are equal
+ //then two UniqueConstraints are equal
+ return DataColumn.AreColumnSetsTheSame(cst.Columns, this.Columns);
+
+ }
+
+ public override int GetHashCode()
+ {
+ //initialize hash with default value
+ int hash = 42;
+ int i;
+
+ //derive the hash code from the columns that way
+ //Equals and GetHashCode return Equal objects to be the
+ //same
+
+ //Get the first column hash
+ if (this.Columns.Length > 0)
+ hash ^= this.Columns[0].GetHashCode();
+
+ //get the rest of the column hashes if there any
+ for (i = 1; i < this.Columns.Length; i++)
+ {
+ hash ^= this.Columns[1].GetHashCode();
+
+ }
+
+ return hash ;
+ }
+
+ [MonoTODO]
+ internal override void AddToConstraintCollectionSetup(
+ ConstraintCollection collection)
+ {
+ //run Ctor rules again
+ _validateColumns(_dataColumns);
+
+ //make sure a unique constraint doesn't already exists for these columns
+ UniqueConstraint uc = UniqueConstraint.GetUniqueConstraintForColumnSet(collection, this.Columns);
+ if (null != uc) throw new ArgumentException("Unique constraint already exists for these" +
+ " columns. Existing ConstraintName is " + uc.ConstraintName);
+
+ //Allow only one primary key
+ if (this.IsPrimaryKey)
+ {
+ uc = GetPrimaryKeyConstraint(collection);
+ if (null != uc) uc._isPrimaryKey = false;
+
+ }
+
+ //FIXME: ConstraintCollection calls AssertContraint() again rigth after calling
+ //this method, so that it is executed twice. Need to investigate which
+ // call to remove as that migth affect other parts of the classes.
+ AssertConstraint();
+ }
+
+
+ internal override void RemoveFromConstraintCollectionCleanup(
+ ConstraintCollection collection)
+ {
+ }
+
+ [MonoTODO]
+ internal override void AssertConstraint()
+ {
+
+ if (_dataTable == null) return; //???
+ if (_dataColumns == null) return; //???
+
+
+ //Unique?
+ DataTable tbl = _dataTable;
+
+ //TODO: Investigate other ways of speeding up the validation work below.
+ //FIXME: This only works when only one DataColumn has been specified.
+
+ //validate no duplicates exists.
+ //Only validate when there are at least 2 rows
+ //so that a duplicate migth exist.
+ if(tbl.Rows.Count > 1) {
+ //get copy of rows collection first so that we do not modify the
+ //original.
+ DataRow[] rows = new DataRow [tbl.Rows.Count];
+ tbl.Rows.CopyTo (rows, 0);
+ ArrayList clonedDataList = new ArrayList (rows);
+
+ ArrayList newDataList = new ArrayList();
+
+ //copy to array list only the column we are interested in.
+ foreach (DataRow row in clonedDataList)
+ newDataList.Add (row[this._dataColumns[0]]);
+
+ //sort ArrayList and check adjacent values for duplicates.
+ newDataList.Sort ();
+
+ for (int i = 0 ; i < newDataList.Count - 1 ; i++)
+ if (newDataList[i].Equals (newDataList[i+1]))
+ throw new InvalidConstraintException (String.Format ("Column '{0}' contains non-unique values", this._dataColumns[0]));
+ }
+
+
+ }
+
+ [MonoTODO]
+ internal override void AssertConstraint(DataRow row)
+ {
+
+ if (_dataTable == null) return; //???
+ if (_dataColumns == null) return; //???
+
+
+ //Unique?
+ DataTable tbl = _dataTable;
+
+ foreach(DataRow compareRow in tbl.Rows)
+ {
+ //skip if it is the same row to be validated
+ if(!row.Equals(compareRow))
+ {
+ if(compareRow.HasVersion (DataRowVersion.Original))
+ {
+ //FIXME: should we compare to compareRow[DataRowVersion.Current]?
+ //FIXME: We need to compare to all columns the constraint is set to.
+ if(row[_dataColumns[0], DataRowVersion.Proposed].Equals( compareRow[_dataColumns[0], DataRowVersion.Current]))
+ {
+ string ExceptionMessage;
+ ExceptionMessage = "Column '" + _dataColumns[0].ColumnName + "' is constrained to be unique.";
+ ExceptionMessage += " Value '" + row[_dataColumns[0], DataRowVersion.Proposed].ToString();
+ ExceptionMessage += "' is already present.";
+
+ throw new ConstraintException (ExceptionMessage);
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/UpdateRowSource.cs b/mcs/class/System.Data/System.Data/UpdateRowSource.cs
new file mode 100644
index 00000000000..6ccf40d5306
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/UpdateRowSource.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.UpdateRowSource.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how query command results are applied to the row being updated.
+ /// </summary>
+ [Serializable]
+ public enum UpdateRowSource
+ {
+ None = 0,
+ OutputParameters = 1,
+ FirstReturnedRecord = 2,
+ Both = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/UpdateStatus.cs b/mcs/class/System.Data/System.Data/UpdateStatus.cs
new file mode 100644
index 00000000000..f686d6cd1aa
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/UpdateStatus.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.UpdateStatus.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the action to take with regard to the current and remaining rows during an Update.
+ /// </summary>
+ [Serializable]
+ public enum UpdateStatus
+ {
+ Continue = 0,
+ ErrorsOccurred = 1,
+ SkipCurrentRow = 2,
+ SkipAllRemainingRows = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/VersionNotFoundException.cs b/mcs/class/System.Data/System.Data/VersionNotFoundException.cs
new file mode 100644
index 00000000000..f26a642eb53
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/VersionNotFoundException.cs
@@ -0,0 +1,32 @@
+//
+// System.Data.VersionNotFoundException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data {
+
+ [Serializable]
+ public class VersionNotFoundException : DataException
+ {
+ public VersionNotFoundException ()
+ : base (Locale.GetText ("This DataRow has been deleted"))
+ {
+ }
+
+ public VersionNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ protected VersionNotFoundException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/XmlConstants.cs b/mcs/class/System.Data/System.Data/XmlConstants.cs
new file mode 100755
index 00000000000..12c348f99a1
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlConstants.cs
@@ -0,0 +1,63 @@
+//
+// System.Data/DataSet.cs
+//
+// Author:
+// Stuart Caborn <stuart.caborn@virgin.net>
+//
+// (C) Stuart Caborn 2002
+
+namespace System.Data
+{
+///<summary>
+///Constants class to hold XmlSerialisation
+///strings
+///</summary>
+internal class XmlConstants
+{
+ ///<summary>The namespace prefix for the xml schema namespace</summary>
+ public const string SchemaPrefix = "xs";
+
+ ///<summary>
+ /// The w3 XmlSchema namespace
+ /// </summary>
+ public const string SchemaNamespace = "http://www.w3.org/2001/XMLSchema";
+
+
+ //xs elements and values
+ //TODO - these must exist somwhere else???
+ public const string SchemaElement = "schema";
+ public const string AttributeFormDefault = "attributeFormDefault";
+ public const string ElementFormDefault = "elementFormDefault";
+ public const string Qualified = "qualified";
+ public const string Unqualified = "unqualified";
+ public const string Element = "element";
+ public const string Choice = "choice";
+ public const string ComplexType = "complexType";
+ public const string SimpleType = "simpleType";
+ public const string Restriction = "restriction";
+ public const string MaxLength = "maxLength";
+ public const string Sequence = "sequence";
+ public const string MaxOccurs = "maxOccurs";
+ public const string MinOccurs = "minOccurs";
+ public const string Unbounded = "unbounded";
+ public const string Name = "name";
+ public const string Type = "type";
+ public const string Id = "id";
+ public const string TargetNamespace = "targetNamespace";
+ public const string Form = "form";
+ public const string Attribute = "attribute";
+ public const string Default = "default";
+ public const string Caption = "Caption";
+ public const string Base = "base";
+ public const string Value = "value";
+
+ //ms schema objects
+ public const string MsdataPrefix = "msdata";
+ public const string MsdataNamespace = "urn:schemas-microsoft-com:xml-msdata";
+ public const string TnsPrefix = "mstns";
+ public const string IsDataSet = "IsDataSet";
+ public const string Locale = "Locale";
+ public const string Ordinal = "Ordinal";
+}
+
+}
diff --git a/mcs/class/System.Data/System.Data/XmlDataLoader.cs b/mcs/class/System.Data/System.Data/XmlDataLoader.cs
new file mode 100644
index 00000000000..b100e6625d3
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlDataLoader.cs
@@ -0,0 +1,187 @@
+//
+// mcs/class/System.Data/System.Data/XmlDataLoader.cs
+//
+// Purpose: Loads XmlDocument to DataSet
+//
+// class: XmlDataLoader
+// assembly: System.Data.dll
+// namespace: System.Data
+//
+// Author:
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (c)copyright 2002 Ville Palo
+//
+// XmlDataLoader is included within the Mono Class Library.
+//
+
+using System;
+using System.Data;
+using System.Xml;
+using System.Xml.XPath;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Data {
+
+ internal class XmlDataLoader
+ {
+
+ private DataSet DSet;
+ Hashtable DiffGrRows = new Hashtable ();
+
+ public XmlDataLoader (DataSet set)
+ {
+ DSet = set;
+ }
+
+ public XmlReadMode LoadData (XmlReader reader, XmlReadMode mode)
+ {
+ XmlReadMode Result = XmlReadMode.Auto;
+
+ switch (mode) {
+
+ case XmlReadMode.Fragment:
+ break;
+ case XmlReadMode.ReadSchema:
+ Result = XmlReadMode.ReadSchema;
+ ReadModeSchema (reader, false);
+ break;
+ case XmlReadMode.IgnoreSchema:
+ Result = XmlReadMode.IgnoreSchema;
+ ReadModeSchema (reader, true);
+ break;
+ case XmlReadMode.InferSchema:
+ Result = XmlReadMode.InferSchema;
+ ReadModeInferSchema (reader);
+ break;
+ default:
+ break;
+ }
+
+ return Result;
+ }
+
+ #region reading
+
+ // XmlReadMode.InferSchema
+ [MonoTODO]
+ private void ReadModeInferSchema (XmlReader reader)
+ {
+ // root element is DataSets name
+ reader.MoveToContent ();
+
+ DSet.DataSetName = reader.LocalName;
+
+ // And now comes tables
+ while (reader.Read ()) {
+
+ // skip possible inline-schema
+ if (String.Compare (reader.LocalName, "schema", true) == 0 && reader.NodeType == XmlNodeType.Element) {
+ while (reader.Read () && (reader.NodeType != XmlNodeType.EndElement
+ || String.Compare (reader.LocalName, "schema", true) != 0));
+ }
+
+
+ if (reader.NodeType == XmlNodeType.Element) {
+
+ string datatablename = reader.LocalName;
+ DataTable table;
+ bool NewTable = false;
+
+ if (!DSet.Tables.Contains (datatablename)) {
+ table = new DataTable (reader.LocalName);
+ DSet.Tables.Add (table);
+ NewTable = true;
+ }
+ else {
+ table = DSet.Tables [datatablename];
+ }
+
+ Hashtable rowValue = new Hashtable ();
+
+ while (reader.Read () && (reader.NodeType != XmlNodeType.EndElement
+ || reader.LocalName != datatablename))
+ {
+ if (reader.NodeType == XmlNodeType.Element) {
+
+ string dataColumnName = reader.LocalName;
+ if (NewTable)
+ table.Columns.Add (dataColumnName);
+
+ // FIXME: exception?
+ if (!reader.Read ())
+ return;
+
+ rowValue.Add (dataColumnName, reader.Value);
+ }
+ }
+
+ DataRow row = table.NewRow ();
+
+ IDictionaryEnumerator enumerator = rowValue.GetEnumerator ();
+ while (enumerator.MoveNext ()) {
+ row [enumerator.Key.ToString ()] = enumerator.Value.ToString ();
+ }
+
+ table.Rows.Add (row);
+ }
+ }
+ }
+
+ // Read Xmldocument. XmlReadMode.ReadSchema and XmlReadMode.IgnoreSchema
+ [MonoTODO]
+ private void ReadModeSchema (XmlReader reader, bool IgnoreSchema)
+ {
+ /*\
+ * Reads any inline schema, but an exception is thrown
+ * if any tables in the inline schema already exist in the DataSet.
+ \*/
+
+ reader.MoveToContent ();
+
+ while (reader.Read ()) {
+
+ // FIXME: possible inline-schema should be readed here
+ if (String.Compare (reader.LocalName, "schema", true) == 0 && reader.NodeType == XmlNodeType.Element) {
+ if (!IgnoreSchema)
+ DSet.ReadXmlSchema (reader);
+ }
+
+ // find table
+ if (reader.NodeType == XmlNodeType.Element && DSet.Tables.Contains (reader.LocalName)) {
+
+ DataTable table = DSet.Tables [reader.LocalName];
+ DataRow row = table.NewRow ();
+
+ ReadColumns (reader, row, table, reader.LocalName);
+
+ table.Rows.Add (row);
+ }
+ }
+ }
+
+ #endregion // reading
+
+ #region Private helper methods
+
+ private void ReadColumns (XmlReader reader, DataRow row, DataTable table, string TableName)
+ {
+ do {
+ if (reader.NodeType == XmlNodeType.Element &&
+ table.Columns.Contains (reader.LocalName)) {
+ string columName = reader.LocalName;
+ reader.Read ();
+ row [columName] = reader.Value;
+ }
+ else {
+ reader.Read ();
+ }
+
+ } while (table.TableName != reader.LocalName
+ || reader.NodeType != XmlNodeType.EndElement);
+ }
+
+ #endregion // Private helper methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/XmlDiffLoader.cs b/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
new file mode 100644
index 00000000000..dc25262b65e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
@@ -0,0 +1,246 @@
+//
+// mcs/class/System.Data/System.Data/XmlDiffLoader.cs
+//
+// Purpose: Loads XmlDiffGrams to DataSet
+//
+// class: XmlDiffLoader
+// assembly: System.Data.dll
+// namespace: System.Data
+//
+// Author:
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (c)copyright 2003 Ville Palo
+//
+using System;
+using System.Data;
+using System.Xml;
+using System.Xml.XPath;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Data {
+
+ internal class XmlDiffLoader
+ {
+
+ #region Fields
+
+ private DataSet DSet;
+ private Hashtable DiffGrRows = new Hashtable ();
+ private Hashtable ErrorRows = new Hashtable ();
+
+ #endregion // Fields
+
+ #region ctors
+
+ public XmlDiffLoader (DataSet DSet)
+ {
+ this.DSet = DSet;
+ }
+
+ #endregion //ctors
+
+ #region Public methods
+
+ public void Load (XmlReader Reader)
+ {
+ XmlTextReader TextReader = new XmlTextReader (Reader.BaseURI);
+ XmlDocument Document = new XmlDocument ();
+ Document.Load (TextReader);
+ TextReader.Close ();
+
+ XPathNavigator Navigator = Document.CreateNavigator ();
+ LoadBefore (Navigator);
+ LoadCurrent (Navigator);
+ LoadErrors (Navigator);
+ }
+
+ #endregion // Public methods
+
+ #region Private methods
+
+ private void LoadCurrent (XPathNavigator Navigator)
+ {
+ Navigator.MoveToRoot ();
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ if (Navigator.Name == "diffgr:diffgram") {
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ if (DSet.Tables.Contains (Navigator.LocalName)) {
+
+ DataTable Table = DSet.Tables [Navigator.LocalName];
+ DataRow Row = null;
+ bool NewRow = false;
+ bool HasErrors = false;
+ string id = "";
+
+ if (Navigator.MoveToFirstAttribute ()) {
+
+ do {
+ // Find out was there same row in 'before' section
+ if (Navigator.LocalName == "id") {
+ id = Navigator.Value;
+ if (DiffGrRows.Contains (id))
+ Row = (DataRow)DiffGrRows [id];
+
+ }
+ else if (Navigator.LocalName == "hasErrors" && String.Compare (Navigator.Value, "true", true) == 0)
+ HasErrors = true;
+ } while (Navigator.MoveToNextAttribute ());
+
+ // back to business
+ Navigator.MoveToParent ();
+ }
+
+ if (Row == null) {
+
+ Row = Table.NewRow ();
+ NewRow = true;
+ }
+
+ LoadColumns (Table, Row, Navigator, NewRow);
+
+ if (HasErrors) // If row had errors add row to hashtable for later use
+ ErrorRows.Add (id, Row);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void LoadBefore (XPathNavigator Navigator)
+ {
+ Navigator.MoveToRoot ();
+
+ if (!Navigator.MoveToFirstChild ())
+ return; // FIXME: exception
+
+ if (Navigator.Name != "diffgr:diffgram")
+ return; // FIXME: exception
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ while (Navigator.Name != "diffgr:before") {
+
+ if (!Navigator.MoveToNext ()) // there is no before
+ return;
+ }
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ do {
+ if (DSet.Tables.Contains (Navigator.LocalName)) {
+
+ String id = null;
+ DataTable Table = DSet.Tables [Navigator.LocalName];
+ DataRow Row = Table.NewRow ();
+
+ if (Navigator.MoveToFirstAttribute ()) {
+
+ do {
+ if (Navigator.Name == "diffgr:id")
+ id = Navigator.Value;
+
+ } while (Navigator.MoveToNextAttribute ());
+
+ Navigator.MoveToParent ();
+ }
+
+ LoadColumns (Table, Row, Navigator, true);
+ DiffGrRows.Add (id, Row); // for later use
+ Row.AcceptChanges ();
+ }
+ else {
+ throw new DataException (Locale.GetText ("Cannot load diffGram. Table '" + Navigator.LocalName + "' is missing in the destination dataset"));
+ }
+ } while (Navigator.MoveToNext ());
+ }
+ }
+ }
+
+
+ private void LoadErrors (XPathNavigator Navigator)
+ {
+ Navigator.MoveToRoot ();
+
+ if (!Navigator.MoveToFirstChild ())
+ return; // FIXME: exception
+
+ if (Navigator.Name != "diffgr:diffgram")
+ return; // FIXME: exception
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ while (Navigator.Name != "diffgr:errors") {
+ if (!Navigator.MoveToNext ())
+ return;
+ }
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ DataRow Row = null;
+
+ // find the row in 'current' section
+ if (Navigator.MoveToFirstAttribute ()) {
+
+ do {
+ if (Navigator.Name == "diffgr:id") {
+
+ if (ErrorRows.Contains (Navigator.Value))
+ Row = (DataRow)ErrorRows [Navigator.Value];
+ }
+
+ } while (Navigator.MoveToNextAttribute ());
+
+ Navigator.MoveToParent ();
+ }
+
+ if (Navigator.MoveToFirstChild ()) {
+
+ string Error = "";
+
+ do {
+ if (Navigator.MoveToFirstAttribute ()) {
+ do {
+ if (Navigator.Name == "diffgr:Error")
+ Error = Navigator.Value;
+
+ } while (Navigator.MoveToNextAttribute ());
+
+ Navigator.MoveToParent ();
+ }
+
+ Row.SetColumnError (Navigator.LocalName, Error);
+
+ } while (Navigator.MoveToNext ());
+ }
+ }
+ }
+ }
+
+ private void LoadColumns (DataTable Table, DataRow Row, XPathNavigator Navigator, bool NewRow)
+ {
+ if (Navigator.MoveToFirstChild ()) {
+
+ do {
+ if (Table.Columns.Contains (Navigator.LocalName))
+ Row [Navigator.LocalName] = Navigator.Value;
+
+ } while (Navigator.MoveToNext ());
+
+ if (NewRow)
+ Table.Rows.Add (Row);
+ }
+ }
+
+
+ #endregion // Private methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/XmlReadMode.cs b/mcs/class/System.Data/System.Data/XmlReadMode.cs
new file mode 100644
index 00000000000..d8db21dbd19
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlReadMode.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.XmlReadMode.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how to read XML data and a relational schema into a DataSet.
+ /// </summary>
+ [Serializable]
+ public enum XmlReadMode
+ {
+ Auto = 0,
+ ReadSchema = 1,
+ IgnoreSchema = 2,
+ InferSchema = 3,
+ DiffGram = 4,
+ Fragment = 5
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs b/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs
new file mode 100644
index 00000000000..2efd3e4c423
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs
@@ -0,0 +1,390 @@
+//
+// mcs/class/System.Data/System.Data/XmlSchemaMapper.cs
+//
+// Purpose: Maps XmlSchema to DataSet
+//
+// class: XmlSchemaMapper
+// assembly: System.Data.dll
+// namespace: System.Data
+//
+// Author:
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) 2002 Ville Palo
+//
+// TODO: Relations
+//
+
+using System;
+using System.Data;
+using System.Xml;
+using System.Xml.Schema;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Data {
+
+ internal class XmlSchemaMapper
+ {
+ #region Fields
+
+ private DataSet DSet;
+ enum ElementType {ELEMENT_UNDEFINED, ELEMENT_TABLE, ELEMENT_COLUMN};
+ private Hashtable TypeCollection = new Hashtable ();
+ private Hashtable ElementCollection = new Hashtable ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public XmlSchemaMapper (DataSet dataset)
+ {
+ DSet = dataset;
+ }
+
+ #endregion // Constructors
+
+ #region Public methods
+
+ public void Read (XmlReader Reader)
+ {
+ XmlSchema Schema = XmlSchema.Read (Reader, new ValidationEventHandler (OnXmlSchemaValidation));
+
+ // read items
+ foreach (XmlSchemaObject Item in Schema.Items)
+ ReadXmlSchemaItem (Item);
+ }
+
+ #endregion // Public methods
+
+ #region Private methods
+
+ private void ReadXmlSchemaItem (XmlSchemaObject Item)
+ {
+ XmlSchemaObject SchemaObject;
+
+ if (Item is XmlSchemaType)
+ ReadXmlSchemaType ((XmlSchemaType)Item);
+ else if ((SchemaObject = Item as XmlSchemaElement) != null)
+ ReadXmlSchemaElement (SchemaObject as XmlSchemaElement, ElementType.ELEMENT_UNDEFINED);
+ }
+
+ private void ReadXmlSchemaSequence (XmlSchemaSequence Sequence)
+ {
+ ReadXmlSchemaSequence (Sequence, null);
+ }
+
+ private void ReadXmlSchemaSequence (XmlSchemaSequence Sequence, DataTable Table)
+ {
+ foreach (XmlSchemaObject TempObj in Sequence.Items) {
+
+ XmlSchemaObject SchemaObject;
+ if ((SchemaObject = TempObj as XmlSchemaElement) != null)
+ ReadXmlSchemaElement ((XmlSchemaElement)SchemaObject, ElementType.ELEMENT_COLUMN, Table);
+ }
+ }
+
+ private void ReadXmlSchemaChoice (XmlSchemaChoice Choice)
+ {
+ XmlSchemaObject SchemaObject;
+ foreach (XmlSchemaObject TempObject in Choice.Items) {
+
+ if ((SchemaObject = TempObject as XmlSchemaElement) != null)
+ ReadXmlSchemaElement ((XmlSchemaElement)SchemaObject, ElementType.ELEMENT_TABLE);
+ }
+ }
+
+ private void ReadXmlSchemaElement (XmlSchemaElement Element)
+ {
+ ReadXmlSchemaElement (Element, ElementType.ELEMENT_UNDEFINED);
+ }
+
+ private void ReadXmlSchemaElement (XmlSchemaElement Element, ElementType ElType)
+ {
+ ReadXmlSchemaElement (Element, ElType, null);
+ }
+
+ private void ReadXmlSchemaElement (XmlSchemaElement Element, ElementType ElType, DataTable Table)
+ {
+ Hashtable Attributes = ReadUnhandledAttributes (Element.UnhandledAttributes);
+ DataTable Table2 = null;
+
+ if (Attributes.Contains ("IsDataSet")) { // DataSet -elemt
+
+ if (String.Compare (Attributes ["IsDataSet"].ToString (), "true", true) == 0)
+ DSet.DataSetName = Element.Name;
+ }
+ else if (Element.SchemaTypeName != null && Element.SchemaTypeName.Namespace != XmlConstants.SchemaNamespace
+ && Element.SchemaTypeName.Name != String.Empty) {
+
+ //
+ // If type is not standard type
+ //
+
+ DataTable TempTable = new DataTable (Element.Name);
+ DSet.Tables.Add (TempTable);
+
+ // If type is already defined in schema read it...
+ if (TypeCollection.Contains (Element.SchemaTypeName.ToString ()))
+ ReadXmlSchemaType ((XmlSchemaType)TypeCollection [Element.SchemaTypeName.ToString ()], TempTable);
+ else // but if it's not yet defined put it safe to wait if we need it later.
+ ElementCollection.Add (Element.SchemaTypeName.Name, TempTable);
+
+ }
+ else if (Element.RefName != null && Element.RefName.Name != string.Empty) { // if there is a ref=
+
+ if (ElementCollection.Contains (Element.RefName.Name))
+ ReadXmlSchemaElement ((XmlSchemaElement)ElementCollection [Element.RefName.Name], ElementType.ELEMENT_TABLE);
+ }
+ else if (ElementType.ELEMENT_UNDEFINED != ElType) {
+
+ if (ElType == ElementType.ELEMENT_TABLE)
+ ReadTable (Element);
+ else if (ElType == ElementType.ELEMENT_COLUMN && Table != null)
+ ReadColumn (Element, Table);
+ }
+ else {
+ // this element is undefined, for now
+ ElementCollection.Add (Element.Name, Element);
+ }
+
+ // Read Element type
+ if (Element.SchemaType != null)
+ ReadXmlSchemaType (Element.SchemaType);
+
+ // Read possible constraints
+ if (Element.Constraints != null && Element.Constraints.Count > 0)
+ ReadXmlSchemaConstraints (Element.Constraints);
+ }
+
+ private void ReadTable (XmlSchemaElement Element)
+ {
+ DataTable TempTable = new DataTable (Element.Name);
+ DSet.Tables.Add (TempTable);
+ ReadXmlSchemaType (Element.SchemaType, TempTable);
+ }
+
+ private void ReadColumn (XmlSchemaElement Element, DataTable Table)
+ {
+ DataColumn Column = new DataColumn (Element.Name);
+ Table.Columns.Add (Column);
+
+ if (Element.UnhandledAttributes != null) {
+
+ foreach (XmlAttribute Attr in Element.UnhandledAttributes) {
+
+ switch (Attr.LocalName) {
+
+ case "Caption":
+ Column.Caption = Attr.Value;
+ break;
+ case "DataType":
+ Column.DataType = Type.GetType (Attr.Value);
+ break;
+ case "type":
+ // FIXME:
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ //
+ // Handel rest of the parameters
+ //
+
+ if (Column.DataType == null)
+ Column.DataType = Type.GetType ("System.String");
+
+ if (Element.DefaultValue != null)
+ Column.DefaultValue = Element.DefaultValue;
+
+ // If Element have type
+ if (Element.SchemaType != null)
+ ReadXmlSchemaType (Element.SchemaType, Column);
+ }
+
+ // Makes new Hashtable of the attributes.
+ private Hashtable ReadUnhandledAttributes (XmlAttribute [] Attributes)
+ {
+ Hashtable Result = new Hashtable ();
+
+ if (Attributes == null)
+ return Result;
+
+ foreach (XmlAttribute attribute in Attributes) {
+ Result.Add (attribute.LocalName, attribute.Value);
+ }
+
+ return Result;
+ }
+
+ private void ReadXmlSchemaConstraints (XmlSchemaObjectCollection Constraints)
+ {
+ foreach (XmlSchemaObject Constraint in Constraints) {
+
+ if (Constraint is XmlSchemaUnique)
+ ReadXmlSchemaUnique ((XmlSchemaUnique)Constraint);
+ }
+ }
+
+ [MonoTODO()]
+ private void ReadXmlSchemaUnique (XmlSchemaUnique Unique)
+ {
+ // FIXME: Parsing XPath
+
+ string TableName = Unique.Selector.XPath;
+ if (TableName.StartsWith (".//"))
+ TableName = TableName.Substring (3);
+
+ DataColumn [] Columns;
+ if (DSet.Tables.Contains (TableName)) {
+
+ DataTable Table = DSet.Tables [TableName];
+ Columns = new DataColumn [Unique.Fields.Count];
+ int i = 0;
+ foreach (XmlSchemaXPath Field in Unique.Fields) {
+
+ if (Table.Columns.Contains (Field.XPath)) {
+ Table.Columns [Field.XPath].Unique = true;
+ Columns [i] = Table.Columns [Field.XPath];
+ i++;
+ }
+ }
+
+ UniqueConstraint Constraint = new UniqueConstraint (Unique.Name, Columns);
+ }
+ }
+
+ #endregion // Private methods
+
+ #region Private listeners
+
+ private void OnXmlSchemaValidation (object sender, ValidationEventArgs args)
+ {
+ ;
+ }
+
+ #endregion // Private listeners
+
+ #region Private TypeReaders
+
+ // Reads XmlSchemaType
+ private void ReadXmlSchemaType (XmlSchemaType SchemaType)
+ {
+ ReadXmlSchemaType (SchemaType, (DataTable)null);
+ }
+
+ // Reads XmlSchemaType and decides is it Complex or Simple and continue reading those types
+ private void ReadXmlSchemaType (XmlSchemaType SchemaType, DataTable Table)
+ {
+ if (SchemaType is XmlSchemaComplexType)
+ ReadXmlSchemaComplexType ((XmlSchemaComplexType)SchemaType, Table);
+ else if (SchemaType is XmlSchemaSimpleType)
+ ReadXmlSchemaSimpleType ((XmlSchemaSimpleType)SchemaType, Table);
+ }
+
+ // Same as above but with DataColumn
+ private void ReadXmlSchemaType (XmlSchemaType SchemaType, DataColumn Column)
+ {
+ if (SchemaType is XmlSchemaComplexType)
+ ReadXmlSchemaComplexType ((XmlSchemaComplexType)SchemaType, Column);
+ else if (SchemaType is XmlSchemaSimpleType)
+ ReadXmlSchemaSimpleType ((XmlSchemaSimpleType)SchemaType, Column);
+ }
+
+ #endregion // PrivateTypeReader
+
+ #region TypeReaderHelppers
+
+ private void ReadXmlSchemaSimpleType (XmlSchemaSimpleType SimpleType, DataColumn Column)
+ {
+ // Read Contents
+ if (SimpleType.Content is XmlSchemaSimpleTypeRestriction)
+ ReadXmlSchemaSimpleTypeRestriction ((XmlSchemaSimpleTypeRestriction)SimpleType.Content, Column);
+ }
+
+ [MonoTODO]
+ private void ReadXmlSchemaSimpleType (XmlSchemaSimpleType SimpleType, DataTable Table)
+ {
+ // TODO: Is it possible that Table-element have simpletype???
+ }
+
+ [MonoTODO]
+ private void ReadXmlSchemaSimpleTypeRestriction (XmlSchemaSimpleTypeRestriction Restriction, DataColumn Column)
+ {
+ foreach (XmlSchemaObject Facet in Restriction.Facets) {
+
+ // FIXME: I dont know are everyone of these needed but, let them be here for now
+ if (Facet is XmlSchemaMaxLengthFacet)
+ Column.MaxLength = Int32.Parse(((XmlSchemaFacet)Facet).Value);
+ //else if (Facet is XmlSchemaMinLengthFacet)
+ // ;
+ //else if (Facet is XmlSchemaLengthFacet)
+ // ;
+ //else if (Facet is XmlSchemaPatternFacet)
+ // ;
+ //else if (Facet is XmlSchemaEnumerationFacet)
+ // ;
+ //else if (Facet is XmlSchemaMaxInclusiveFacet)
+ // ;
+ //else if (Facet is XmlSchemaMaxExclusiveFacet)
+ // ;
+ //else if (Facet is XmlSchemaMinInclusiveFacet)
+ // ;
+ //else if (Facet is XmlSchemaMinExclusiveFacet)
+ // ;
+ //else if (Facet is XmlSchemaFractionDigitsFacet)
+ // ;
+ //else if (Facet is XmlSchemaTotalDigitsFacet)
+ // ;
+ //else if (Facet is XmlSchemaWhiteSpaceFacet)
+ // ;
+ }
+ }
+
+ [MonoTODO]
+ private void ReadXmlSchemaComplexType (XmlSchemaComplexType Type, DataColumn Column)
+ {
+ // TODO: is it possible that column-element have complextype
+ }
+
+ // Reads XmlSchemaComplexType with DataTable
+ private void ReadXmlSchemaComplexType (XmlSchemaComplexType Type, DataTable Table)
+ {
+ XmlSchemaComplexType ComplexType = Type as XmlSchemaComplexType;
+
+ if (ComplexType.Name != null && ComplexType.Name != string.Empty) {
+ if (ElementCollection.Contains (ComplexType.Name)) {
+
+ XmlSchemaParticle Particle;
+ if ((Particle = ComplexType.Particle as XmlSchemaChoice) != null) {
+ ReadXmlSchemaChoice (Particle as XmlSchemaChoice);
+ }
+ else if ((Particle = ComplexType.Particle as XmlSchemaSequence) != null) {
+ DataTable TempTable = ElementCollection [ComplexType.Name] as DataTable;
+ ElementCollection.Remove (ComplexType.Name);
+ ReadXmlSchemaSequence (Particle as XmlSchemaSequence, TempTable);
+ }
+
+ }
+ else if (ComplexType.Name != null && !TypeCollection.Contains (ComplexType.Name)) {
+ TypeCollection.Add (ComplexType.Name, ComplexType);
+ }
+ }
+ else {
+ XmlSchemaParticle Particle;
+ if ((Particle = ComplexType.Particle as XmlSchemaChoice) != null) {
+ ReadXmlSchemaChoice (Particle as XmlSchemaChoice);
+ }
+ else if ((Particle = ComplexType.Particle as XmlSchemaSequence) != null) {
+ ReadXmlSchemaSequence (Particle as XmlSchemaSequence, Table);
+ }
+ }
+ }
+
+ #endregion // TypeReaderHelppers
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data/XmlWriteMode.cs b/mcs/class/System.Data/System.Data/XmlWriteMode.cs
new file mode 100644
index 00000000000..f70b9c5850b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlWriteMode.cs
@@ -0,0 +1,24 @@
+//
+// System.Data.XmlWriteMode.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Use the members of this enumeration when setting the WriteMode parameter of the WriteXml method.
+ /// </summary>
+ [Serializable]
+ public enum XmlWriteMode
+ {
+ WriteSchema = 0,
+ IgnoreSchema = 1,
+ DiffGram = 2
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Xml/XmlDataDocument.cs b/mcs/class/System.Data/System.Xml/XmlDataDocument.cs
new file mode 100644
index 00000000000..89bc7fbd3e2
--- /dev/null
+++ b/mcs/class/System.Data/System.Xml/XmlDataDocument.cs
@@ -0,0 +1,726 @@
+//
+// mcs/class/System.Data/System.Xml/XmlDataDocument.cs
+//
+// Purpose: Provides a W3C XML DOM Document to interact with
+// relational data in a DataSet
+//
+// class: XmlDataDocument
+// assembly: System.Data.dll
+// namespace: System.Xml
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (c)copyright 2002 Daniel Morgan
+// (c)copyright 2003 Ville Palo
+//
+// XmlDataDocument is included within the Mono Class Library.
+//
+
+using System;
+using System.Data;
+using System.IO;
+using System.Text;
+using System.Xml.XPath;
+using System.Collections;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Xml {
+
+ public class XmlDataDocument : XmlDocument {
+
+ #region Fields
+
+ private DataSet dataSet;
+ private bool isReadOnly = false;
+
+ private int dataRowID = 1;
+ private ArrayList dataRowIDList = new ArrayList ();
+
+ // this is needed for inserting new row to datatable via xml
+ private Hashtable TempTable = new Hashtable ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public XmlDataDocument() {
+
+ dataSet = new DataSet();
+ dataSet.Tables.CollectionChanged += new CollectionChangeEventHandler (OnDataTableChanged);
+
+ this.NodeChanged += new XmlNodeChangedEventHandler (OnNodeChanged);
+ this.NodeChanging += new XmlNodeChangedEventHandler (OnNodeChanging);
+ this.NodeInserting += new XmlNodeChangedEventHandler (OnNodeInserting);
+ this.NodeRemoved += new XmlNodeChangedEventHandler (OnNodeRemoved);
+ this.NodeInserted += new XmlNodeChangedEventHandler (OnNodeInserted);
+ DataSet.EnforceConstraints = false;
+ }
+
+ public XmlDataDocument(DataSet dataset) {
+
+ this.dataSet = dataset;
+
+ // Read DataSet in as document if there is data in tables
+ bool HaveRows = false;
+ foreach (DataTable T in dataSet.Tables) {
+
+ if (T.Rows.Count > 0) {
+ HaveRows = true;
+ break;
+ }
+ }
+
+ if (HaveRows) {
+
+ XmlReader xmlReader = new XmlTextReader (new StringReader (dataSet.GetXml ()));
+
+ // Load DataSet's xml-data
+ base.Load (xmlReader);
+ xmlReader.Close ();
+ }
+
+ foreach (DataTable Table in DataSet.Tables) {
+
+ foreach (DataRow Row in Table.Rows) {
+ Row.XmlRowID = dataRowID;
+ dataRowIDList.Add (dataRowID);
+ dataRowID++;
+ }
+ }
+
+ this.NodeChanged += new XmlNodeChangedEventHandler (OnNodeChanged);
+ this.NodeChanging += new XmlNodeChangedEventHandler (OnNodeChanging);
+ this.NodeInserting += new XmlNodeChangedEventHandler (OnNodeInserting);
+ this.NodeRemoved += new XmlNodeChangedEventHandler (OnNodeRemoved);
+ this.NodeInserted += new XmlNodeChangedEventHandler (OnNodeInserted);
+
+ foreach (DataTable Table in dataSet.Tables) {
+ Table.ColumnChanged += new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+ Table.RowDeleted += new DataRowChangeEventHandler (OnDataTableRowDeleted);
+ Table.RowChanged += new DataRowChangeEventHandler (OnDataTableRowChanged);
+ }
+ }
+
+ // bool clone. If we are cloning XmlDataDocument then clone should be true.
+ private XmlDataDocument (DataSet dataset, bool clone)
+ {
+ this.dataSet = dataset;
+
+ foreach (DataTable Table in DataSet.Tables) {
+
+ foreach (DataRow Row in Table.Rows) {
+ Row.XmlRowID = dataRowID;
+ dataRowIDList.Add (dataRowID);
+ dataRowID++;
+ }
+ }
+
+ this.NodeChanged += new XmlNodeChangedEventHandler (OnNodeChanged);
+ this.NodeChanging += new XmlNodeChangedEventHandler (OnNodeChanging);
+ this.NodeInserting += new XmlNodeChangedEventHandler (OnNodeInserting);
+ this.NodeRemoved += new XmlNodeChangedEventHandler (OnNodeRemoved);
+ this.NodeInserted += new XmlNodeChangedEventHandler (OnNodeInserted);
+
+ foreach (DataTable Table in dataSet.Tables) {
+ Table.ColumnChanged += new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+ Table.RowDeleted += new DataRowChangeEventHandler (OnDataTableRowDeleted);
+ Table.RowChanged += new DataRowChangeEventHandler (OnDataTableRowChanged);
+ }
+ }
+
+ #endregion // Constructors
+
+ #region Public Properties
+
+ public override string BaseURI {
+ [MonoTODO]
+ get {
+ // TODO: why are we overriding?
+ return base.BaseURI;
+ }
+ }
+
+ public DataSet DataSet {
+ get {
+ return dataSet;
+ }
+ }
+
+ // override inheritted method from XmlDocument
+ public override string InnerXml {
+ [MonoTODO("override???")]
+ get {
+ return base.InnerXml;
+ }
+
+ [MonoTODO]
+ set {
+ base.InnerXml = value;
+ }
+ }
+
+ public override bool IsReadOnly {
+ [MonoTODO("override???")]
+ get {
+ return isReadOnly;
+ }
+
+ }
+
+ // Item indexer
+ public override XmlElement this[string name] {
+ [MonoTODO("override???")]
+ get {
+ return base [name];
+ }
+ }
+
+ // Item indexer
+ public override XmlElement this[string localname, string ns] {
+ [MonoTODO("override???")]
+ get {
+ return base [localname, ns];
+ }
+ }
+
+ public override string LocalName {
+ [MonoTODO("override???")]
+ get {
+ return base.LocalName;
+ }
+ }
+
+ public override string Name {
+ [MonoTODO("override??")]
+ get {
+ return base.Name;
+ }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get {
+ return null;
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ [MonoTODO]
+ public override XmlNode CloneNode(bool deep)
+ {
+ XmlDataDocument Document;
+ if (deep)
+ Document = new XmlDataDocument (DataSet.Copy (), true);
+ else
+ Document = new XmlDataDocument (DataSet.Clone (), true);
+
+ RemoveXmlDocumentListeners ();
+
+ Document.PreserveWhitespace = PreserveWhitespace;
+ if (deep) {
+ foreach(XmlNode n in ChildNodes)
+ Document.AppendChild (Document.ImportNode (n, deep));
+ }
+
+ AddXmlDocumentListeners ();
+
+ return Document;
+ }
+
+ #region overloaded CreateElement methods
+
+ [MonoTODO ("why this is override?")]
+ public override XmlElement CreateElement(string prefix,
+ string localName, string namespaceURI)
+ {
+ if ((localName == null) || (localName == String.Empty))
+ throw new ArgumentException ("The local name for elements or attributes cannot be null" +
+ "or an empty string.");
+ string pref = prefix != null ? prefix : String.Empty;
+ return base.CreateElement (pref, localName, namespaceURI != null ? namespaceURI : String.Empty);
+ }
+
+ #endregion // overloaded CreateElement Methods
+
+ // will not be supported
+ public override XmlEntityReference CreateEntityReference(string name)
+ {
+ throw new NotSupportedException();
+ }
+
+ // will not be supported
+ public override XmlElement GetElementById(string elemId)
+ {
+ throw new NotSupportedException();
+ }
+
+ // get the XmlElement associated with the DataRow
+ [MonoTODO ("Exceptions")]
+ public XmlElement GetElementFromRow(DataRow r)
+ {
+ if (r.XmlRowID == 0) // datarow was not in xmldatadocument
+ throw new Exception ();
+
+ int elementRow = dataRowIDList.IndexOf (r.XmlRowID);
+
+ return (XmlElement)GetElementsByTagName (r.Table.TableName) [elementRow];
+ }
+
+ // get the DataRow associated with the XmlElement
+ [MonoTODO ("Exceptions")]
+ public DataRow GetRowFromElement(XmlElement e)
+ {
+ XmlElement node = e;
+ if (node == null)
+ return null;
+
+ XPathNavigator nodeNavigator = node.CreateNavigator ();
+ int c = GetElementsByTagName (node.Name).Count;
+
+ if (c == 0)
+ return null;
+
+ XmlNodeList nodeList = GetElementsByTagName (node.Name);
+
+ int i = 0;
+ bool isSame = false;
+
+ while (i < c && !isSame) {
+
+ XPathNavigator docNavigator = nodeList [i].CreateNavigator ();
+ isSame = docNavigator.IsSamePosition (nodeNavigator);
+ docNavigator = nodeList [i].CreateNavigator ();
+ if (!isSame)
+ i++;
+ }
+
+ if (!isSame)
+ return null;
+
+ if (i >= dataRowIDList.Count)
+ return null;
+
+ // now we know rownum
+ int xmlrowid = (int)dataRowIDList [i];
+ if (xmlrowid <= 0)
+ return null;
+
+ DataTable dt = DataSet.Tables [node.Name];
+ DataRow row = null;
+
+ if (dt == null)
+ return null;
+
+ foreach (DataRow r in dt.Rows) {
+ if (xmlrowid == r.XmlRowID) {
+ row = r;
+ }
+ }
+
+ return row;
+ }
+
+ #region overload Load methods
+
+ public override void Load(Stream inStream) {
+ Load (new XmlTextReader (inStream));
+ }
+
+ public override void Load(string filename) {
+ Load (new XmlTextReader (filename));
+ }
+
+ public override void Load(TextReader txtReader) {
+ Load (new XmlTextReader (txtReader));
+ }
+
+ public override void Load(XmlReader reader) {
+
+ bool OldEC = DataSet.EnforceConstraints;
+ DataSet.EnforceConstraints = false;
+
+ dataSet.Tables.CollectionChanged -= new CollectionChangeEventHandler (OnDataTableChanged);
+
+ // For reading xml to XmlDocument
+ XmlTextReader textReader = new XmlTextReader (
+ reader.BaseURI);
+
+ // dont listen these events
+ RemoveXmlDocumentListeners ();
+ DataTable dt = null;
+
+
+ if (reader.NodeType != XmlNodeType.Element)
+ reader.MoveToContent ();
+
+ // read to next element
+ while (reader.Read () && reader.NodeType != XmlNodeType.Element);
+
+ do {
+
+ // Find right table from tablecollection
+ if (DataSet.Tables.Contains (reader.LocalName)) {
+
+ dt = DataSet.Tables [reader.LocalName];
+ dt.ColumnChanged += new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+ dt.RowDeleted += new DataRowChangeEventHandler (OnDataTableRowDeleted);
+ dt.RowChanged += new DataRowChangeEventHandler (OnDataTableRowChanged);
+ }
+ else
+ continue;
+
+ // Read rows to table
+ DataRow tempRow = dt.NewRow ();
+ while ((reader.NodeType != XmlNodeType.EndElement ||
+ reader.Name != dt.TableName) && reader.Read()) {
+
+ switch (reader.NodeType) {
+
+ case XmlNodeType.Element:
+ // Add column to DataRow
+ LoadRow (reader, ref tempRow);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Every row must have unique id.
+ tempRow.XmlRowID = dataRowID;
+ dataRowIDList.Add (dataRowID);
+ dt.Rows.Add (tempRow);
+ dataRowID++;
+
+
+ } while (reader.Read ());
+
+ base.Load (textReader);
+ textReader.Close ();
+
+ DataSet.EnforceConstraints = OldEC;
+ AddXmlDocumentListeners ();
+ dataSet.Tables.CollectionChanged += new CollectionChangeEventHandler (OnDataTableChanged);
+ }
+
+ #endregion // overloaded Load methods
+
+ [MonoTODO]
+ public override void WriteContentTo(XmlWriter xw) {
+ base.WriteContentTo (xw);
+ }
+
+ [MonoTODO]
+ public override void WriteTo(XmlWriter w) {
+ base.WriteTo (w);
+ }
+
+ #endregion // Public Methods
+
+ #region Protected Methods
+
+ //FIXME: when internal protected bug is fixed uncomment this
+ //[MonoTODO]
+ //protected internal override XPathNavigator CreateNavigator(XmlNode node) {
+ // throw new NotImplementedException();
+ //}
+
+ #endregion // Protected Methods
+
+ #region XmlDocument event handlers
+
+ private void OnNodeChanging (object sender, XmlNodeChangedEventArgs args)
+ {
+ if (DataSet.EnforceConstraints)
+ throw new InvalidOperationException (Locale.GetText ("Please set DataSet.EnforceConstraints == false " +
+ "before trying to edit XmlDataDocument using " +
+ "XML operations."));
+ }
+
+ // Invoked when XmlNode is changed colum is changed
+ [MonoTODO]
+ private void OnNodeChanged (object sender, XmlNodeChangedEventArgs args)
+ {
+
+ if (args.Node == null)
+ return;
+
+ DataRow row = GetRowFromElement ((XmlElement)args.Node.ParentNode.ParentNode);
+
+ if (row == null)
+ return;
+
+ if (!row.Table.Columns.Contains (args.Node.ParentNode.Name))
+ return;
+
+ row.Table.ColumnChanged -= new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+
+ if (row [args.Node.ParentNode.Name].ToString () != args.Node.InnerText)
+ row [args.Node.ParentNode.Name] = args.Node.InnerText;
+
+ row.Table.ColumnChanged += new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+ }
+
+ // Invoked when XmlNode is removed
+ [MonoTODO]
+ private void OnNodeRemoved (object sender, XmlNodeChangedEventArgs args)
+ {
+ if (args.OldParent == null)
+ return;
+
+ if (!(args.OldParent is XmlElement))
+ return;
+
+ DataRow row = GetRowFromElement ((XmlElement)args.OldParent);
+
+ if (row == null)
+ return ;
+
+ // Dont trig event again
+ row.Table.ColumnChanged -= new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+
+ row [args.Node.Name] = null;
+
+ row.Table.ColumnChanged += new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+ }
+
+ private void OnNodeInserting (object sender, XmlNodeChangedEventArgs args)
+ {
+ if (DataSet.EnforceConstraints)
+ throw new InvalidOperationException (Locale.GetText ("Please set DataSet.EnforceConstraints == false " +
+ "before trying to edit XmlDataDocument using " +
+ "XML operations."));
+
+ }
+
+ private void OnNodeInserted (object sender, XmlNodeChangedEventArgs args)
+ {
+
+ // this is table element
+ if (DataSet.Tables.Contains (args.NewParent.Name)) {
+
+ Hashtable ht = null;
+ if (TempTable.ContainsKey (args.NewParent.Name)) {
+
+ // if TempTable contains table name, get it and remove it from hashtable
+ // so we can later add it :)
+ ht = TempTable [args.NewParent.Name] as Hashtable;
+ TempTable.Remove (args.NewParent.Name);
+ }
+ else
+ ht = new Hashtable ();
+
+ ht.Add (args.Node.Name, args.Node.InnerText);
+ TempTable.Add (args.NewParent.Name, ht);
+ }
+ else if (DataSet.Tables.Contains (args.Node.Name)) {
+
+ // if nodes name is same as some table in the list is is time to
+ // add row to datatable
+
+ DataTable dt = DataSet.Tables [args.Node.Name];
+ DataRow row = dt.NewRow ();
+
+ Hashtable ht = TempTable [args.Node.Name] as Hashtable;
+
+ IDictionaryEnumerator enumerator = ht.GetEnumerator ();
+ while (enumerator.MoveNext ()) {
+ if (dt.Columns.Contains (enumerator.Key.ToString ()))
+ row [enumerator.Key.ToString ()] = enumerator.Value.ToString ();
+ }
+
+ dt.RowChanged -= new DataRowChangeEventHandler (OnDataTableRowChanged);
+ DataSet.Tables [args.Node.Name].Rows.Add (row);
+ dt.RowChanged += new DataRowChangeEventHandler (OnDataTableRowChanged);
+ }
+ }
+
+ #endregion // DataSet event handlers
+
+ #region DataSet event handlers
+
+ // If DataTable is added or removed from DataSet
+ private void OnDataTableChanged (object sender, CollectionChangeEventArgs eventArgs)
+ {
+ DataTable Table = (DataTable)eventArgs.Element;
+ if (eventArgs.Action == CollectionChangeAction.Add) {
+ Table.ColumnChanged += new DataColumnChangeEventHandler (OnDataTableColumnChanged);
+ Table.RowDeleted += new DataRowChangeEventHandler (OnDataTableRowDeleted);
+ Table.RowChanged += new DataRowChangeEventHandler (OnDataTableRowChanged);
+ }
+ }
+
+ // If column has changed
+ [MonoTODO]
+ private void OnDataTableColumnChanged(object sender,
+ DataColumnChangeEventArgs eventArgs)
+ {
+ RemoveXmlDocumentListeners ();
+
+ // row is not yet in datatable
+ if (eventArgs.Row.XmlRowID == 0)
+ return;
+
+ // TODO: Here should be some kind of error checking.
+ GetElementsByTagName (eventArgs.Column.ToString ()) [dataRowIDList.IndexOf (
+ eventArgs.Row.XmlRowID)].InnerText = eventArgs.ProposedValue.ToString ();
+
+ AddXmlDocumentListeners ();
+ }
+
+ [MonoTODO]
+ private void OnDataTableRowDeleted(object sender,
+ DataRowChangeEventArgs eventArgs)
+ {
+
+ DataRow deletedRow = null;
+ deletedRow = eventArgs.Row;
+
+ if (eventArgs.Row.XmlRowID == 0)
+ return;
+
+ int rowIndex = dataRowIDList.IndexOf (eventArgs.Row.XmlRowID);
+ if (rowIndex == -1 || eventArgs.Row.XmlRowID == 0 ||
+ rowIndex > GetElementsByTagName (deletedRow.Table.TableName).Count - 1)
+ return;
+
+ // Remove element from xmldocument and row indexlist
+ // FIXME: this is one way to do this, but i hope someday i find out much better way.
+ XmlNode p = GetElementsByTagName (deletedRow.Table.TableName) [rowIndex].ParentNode;
+ if (p != null) {
+ p.RemoveChild (GetElementsByTagName (deletedRow.Table.TableName) [rowIndex]);
+ dataRowIDList.RemoveAt (rowIndex);
+ }
+ }
+
+ [MonoTODO]
+ private void OnDataTableRowChanged(object sender, DataRowChangeEventArgs eventArgs)
+ {
+ switch (eventArgs.Action) {
+
+ case DataRowAction.Delete:
+ OnDataTableRowDeleted (sender, eventArgs);
+ break;
+
+ case DataRowAction.Add:
+ OnDataTableRowAdded (eventArgs);
+ break;
+
+ case DataRowAction.Rollback:
+ OnDataTableRowRollback (eventArgs);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Added
+ [MonoTODO]
+ private void OnDataTableRowAdded (DataRowChangeEventArgs args)
+ {
+ RemoveXmlDocumentListeners ();
+
+ // If XmlRowID is != 0 then it is already added
+ if (args.Row.XmlRowID != 0)
+ return;
+
+ // Create row element. Row's name same as TableName
+ DataRow row = args.Row;
+ row.XmlRowID = dataRowID;
+ dataRowIDList.Add (dataRowID);
+ dataRowID++;
+
+ if (DocumentElement == null)
+ this.AppendChild (CreateElement (DataSet.DataSetName));
+
+ XmlElement element = CreateElement (args.Row.Table.TableName);
+ DocumentElement.AppendChild (element);
+
+ XmlElement rowElement = null;
+
+ for (int i = 0; i < row.Table.Columns.Count; i++) {
+
+ rowElement = CreateElement (row.Table.Columns [i].ToString ());
+ rowElement.InnerText = (string)row [i];
+ element.AppendChild (rowElement);
+ }
+
+ AddXmlDocumentListeners ();
+ }
+
+ // Rollback
+ [MonoTODO]
+ private void OnDataTableRowRollback (DataRowChangeEventArgs args)
+ {
+ RemoveXmlDocumentListeners ();
+
+ DataRow row = args.Row;
+ int rowid = dataRowIDList.IndexOf (row.XmlRowID);
+
+ // find right element in xmldocument
+ if (rowid == 0 || rowid >= GetElementsByTagName (row.Table.TableName).Count)
+ return;
+
+ XmlNode node = GetElementsByTagName (row.Table.TableName) [rowid];
+
+ int rowValue = 0;
+ for (int i = 0; i < node.ChildNodes.Count; i++) {
+
+ XmlNode child = node.ChildNodes [i];
+ if (child.NodeType != XmlNodeType.Whitespace) {
+ child.InnerText = (string)row [rowValue++];
+ }
+ }
+
+ AddXmlDocumentListeners ();
+ }
+
+ #endregion // DataSet event handlers
+
+ #region Private methods
+
+ [MonoTODO]
+ private void LoadRow (XmlReader reader, ref DataRow row)
+ {
+ // dt.Rows.Add (LoadRow (reader, dt.NewRow ()));
+ // This method returns DataRow filled by values
+ // from xmldocument
+ string rowname = reader.Name;
+ string column = "";
+
+ if (reader.NodeType == XmlNodeType.Element)
+ column = reader.Name;
+
+ reader.Read ();
+
+ if (reader.NodeType == XmlNodeType.Text) {
+
+ string val = reader.Value;
+ if (row.Table.Columns.Contains (column))
+ row [column] = val;
+ }
+ }
+
+ private void RemoveXmlDocumentListeners ()
+ {
+ this.NodeInserting -= new XmlNodeChangedEventHandler (OnNodeInserting);
+ this.NodeInserted -= new XmlNodeChangedEventHandler (OnNodeInserted);
+ this.NodeChanged -= new XmlNodeChangedEventHandler (OnNodeChanged);
+ this.NodeChanging -= new XmlNodeChangedEventHandler (OnNodeChanging);
+ }
+
+ private void AddXmlDocumentListeners ()
+ {
+ this.NodeInserting += new XmlNodeChangedEventHandler (OnNodeInserting);
+ this.NodeInserted += new XmlNodeChangedEventHandler (OnNodeInserted);
+ this.NodeChanged += new XmlNodeChangedEventHandler (OnNodeChanged);
+ this.NodeChanging += new XmlNodeChangedEventHandler (OnNodeChanging);
+ }
+ #endregion // Private methods
+ }
+}
+
diff --git a/mcs/class/System.Data/TODO b/mcs/class/System.Data/TODO
new file mode 100644
index 00000000000..acd1a7f4234
--- /dev/null
+++ b/mcs/class/System.Data/TODO
@@ -0,0 +1,134 @@
+System.Data TODO List
+=====================
+
+Update this file as needed...
+
+* To get ExecuteReader() in a SqlCommand object to return
+ a SqlDataReader object which can Read() data and get a String or
+ Int32 from the database. Other types can be done later.
+
+ A class (SqlDataReader) that implements IDataReader/IDataRecord
+ only has one row in memory at a time.
+
+In order to do this, we need to compile and edit these classes:
+ SqlDataReader DataTable DataRowCollection DataRow
+ DataColumnCollection DataColumn
+ DataConstraintCollection DataConstraint
+ DataRelationCollection DataRelation
+ DataTableCollection
+ and dependencies...
+
+System.Data.Common classes that need to be implemented:
+ - implement DataAdapter.cs
+ - implement DataColumnMapping.cs
+ - implement DataColumnMappingCollection.cs
+ - implement DataTableMapping.cs
+ - implement DataTableMappingCollection.cs
+ - implement DbDataAdapter.cs
+ - implement DbDataPermission.cs
+ - implement DbDataPermissionAttribute.cs
+ - implement RowUpdatedEventArgs.cs
+ - implement RowUpdatingEventArgs.cs
+
+The following classes implement InternalDataCollectionBase:
+ * DataRowCollection
+ * DataColumnCollection
+ * DataTableCollection
+ * DataRelationCollection - an abstract class used by DataTable and DataSet
+ * ConstraintCollection
+
+DataTableRelationCollection is an internal class that implements DataRelationCollection
+and is used by DataTable for parent/child relations. Don't know if it will/will not
+be used by DataSet.
+
+Other classes, structs, etc. that are missing:
+ DataRowView
+ DataSysDescriptionAttribute
+ DataViewManager
+ DataViewSetting
+ FillErrorEventArgs
+ MergeFailedEventArgs
+ TypedDataSetGenerator
+
+The additional System.Data.SqlTypes classes need to be implemented:
+ SqlByte
+ SqlDataTime
+ SqlDecimal
+ SqlDouble
+ SqlGuid
+ SqlInt16
+ SqlInt64
+ SqlMoney
+ SqlSingle
+
+* provide a standard scheme for storing
+ connection string data
+
+* allow Execute methods in SqlCommand to
+ call a stored procedure
+
+* Create a script for testing System.Data:
+ - calls script to create
+ a test database named monotestdb
+ - set up nunit for testing System.Data
+ - set up System.Data.Config or some other
+ file to hold connection strings and other
+ configuration settings for the testing System.Data
+ - any other stuff needed...
+
+* get SqlParameter/SqlParameterCollection
+ working so you can:
+ - for queries/commands that have parameters:
+ o input
+ o output
+ o return
+ o input/output
+ - call a stored procedure with parameters
+
+* be able to return a XmlReader from
+ using method ExecuteXmlReader of
+ a SqlCommand object
+
+* get SqlDataAdapter/DataSet working
+
+* Create Library for PInvoking into libgda
+ This will be used by System.Data.OleDb classes
+
+* Begin System.Data.OleDb classes:
+ - OleDbConnection
+ - OleDbCommand
+ - OleDbTransaction
+
+* Do more of the OleDb classes to
+ retrieve a OleDbDataReader object
+ from a query (SELECT FROM):
+ - OleDbDataReader
+ - others...
+
+* Do more OleDb classes for DataSet:
+ - OleDbDataAdapter
+ - others...
+
+* Security Audit of System.Data
+
+* Create a MySQL ADO.NET Provider
+
+* Create an Oracle ADO.NET Provider
+
+* Create an Interbase ADO.NET Provider
+
+* Create a Sybase ADO.NET Provider (TDS?)
+
+* Create an IBM UDB DB2 ADO.NET Provider
+
+* Create other ADO.NET providers...
+
+Integration
+===========
+
+* get System.Data to work with ASP.NET's
+ System.Web.UI.WebControls.DataGrid
+
+* get System.Data to work with GUI
+ System.Windows.Forms.DataGrid
+
diff --git a/mcs/class/System.Data/Test/.cvsignore b/mcs/class/System.Data/Test/.cvsignore
new file mode 100644
index 00000000000..335c71fd7fa
--- /dev/null
+++ b/mcs/class/System.Data/Test/.cvsignore
@@ -0,0 +1,2 @@
+*.dll
+*.pdb
diff --git a/mcs/class/System.Data/Test/AllTests.cs b/mcs/class/System.Data/Test/AllTests.cs
new file mode 100644
index 00000000000..772d94b7396
--- /dev/null
+++ b/mcs/class/System.Data/Test/AllTests.cs
@@ -0,0 +1,22 @@
+// Author: Tim Coleman (tim@timcoleman.com)
+// Copyright 2002 Tim Coleman
+
+using System;
+using System.Data;
+using System.Data.SqlTypes;
+using NUnit.Framework;
+
+namespace MonoTests {
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (System.Data.SqlTypes.AllTests.Suite);
+ suite.AddTest (System.Data.Xml.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/ChangeLog b/mcs/class/System.Data/Test/ChangeLog
new file mode 100644
index 00000000000..cd087158a63
--- /dev/null
+++ b/mcs/class/System.Data/Test/ChangeLog
@@ -0,0 +1,340 @@
+2003-01-13 Ville Palo <vi64pa@koti.soon.fi>
+
+ * data_linux_test.args: Added some classes
+
+2002-12-16 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocumentTest.cs: some fixes.
+
+2002-12-14 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocumentTest.cs: Added three new tests
+
+2002-12-10 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocumentTest.cs: Added new tests
+ * System.Xml/region.xml: Changed XmlDocument.
+
+2002-11-24 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Xml/XmlDataDocumentTest.cs: Added new test suite for
+ XmlDataDocument.
+ * System.Xml/store.xsd:
+ * System.Xml/region.xsd
+ * System.Xml/region.xml:
+ * System.Xml/2books.xml: Needed by XmlDocumentTest.cs
+ * AllTests.cs:
+ * data_linux_test.args:Added XmlDataDocumentTest.cs
+
+2002-11-12 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlStringTest.cs: Added tests
+
+2002-11-10 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlStringTest.cs: Added more tests
+
+2002-11-07 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlDecimalTest.cs
+ * System.Data.SqlTypes/SqlDoubleTest.cs
+ * System.Data.SqlTypes/SqlMoneyTest.cs
+ * System.Data.SqlTypes/SqlSingleTest.cs:
+ mcs don't understand (currently) correctly what 1e10 means,
+ with mcs it must be 1E+10.
+
+2002-11-02 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlDoubleTest.cs: More tests.
+
+2002-10-31 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlInt16Test.cs: Litle bugfix
+
+2002-10-24 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/AllTests.cs:
+ * System.Data.SqlTypes/SqlStringTest.cs:
+ * System.Data.SqlTypes/SqlDecimalTest.cs: new test suites for
+ SqlDecimal and SqlString
+
+2002-10-19 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/AllTests.cs:
+ * System.Data.SqlTypes/SqlGuidTest.cs: new test suite for SqlGuid.
+
+2002-10-19 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/AllTest.cs:
+ * System.Data.SqlTypes/SqlMoneyTest.cs new test suite for SqlMoney
+ * System.Data.SqlTypes/SqlDateTimeTest.cs new test suite for
+ SqlDateTime
+
+2002-10-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * TestSqlDataReader.cs: got to work
+ with new place for the PostgreSQL provider
+ at Mono.Data.PostgreSqlClient.
+
+2002-10-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlTypes/AllTests.cs:
+ * System.Data.SqlTypes/SqlBinary.cs: new test suite for SqlBinary, by
+ Ville Palo (vi64pa@koti.soon.fi).
+
+2002-10-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: remove file
+ from this directory because it has been
+ moved to
+ mcs/tools/SqlSharp
+
+2002-10-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * PostresTest.cs: modified to
+ use the new namepace and assembly for PostgreSQL
+ provider which is Mono.Data.PostgreSqlClient
+
+2002-10-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlTypes/AllTests.cs: added new test.
+
+2002-10-15 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlSingleTest.cs: added test suite for
+ SqlSingle.
+
+2002-10-15 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: get it to work with System.Data.OleDb
+ on MS .net when connected to Oracle 8i. Also, get data
+ to space correctly when data size is smaller than the
+ header size. If DataType is DateTime, use GetDataTime(),
+ otherwise, use GetValue().
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: better formatting of output
+
+2002-10-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: modified
+ - add support for the external Mono.Data.SqliteClient
+ ADO.NET provider. All the user has to do is
+ "/provider sqlite"
+ to load it instead of the usual syntax for loading
+ external providers
+ "/loadextprovider Mono.Data.SqliteClient Mono.Data.SqliteClient.SqliteConnection".
+
+2002-10-11 Daniel Morgan <danmorg@sc.rr.com>
+
+ * OdbcTest.cs: added
+ for System.Data.Odbc tests. Modify this
+ test as needed...
+
+2002-10-10 Ville Palo (vi64pa@koti.soon.fi)
+
+ * System.Data.SqlTypes/SqlDoubleTest.cs: new test suite for SqlDouble.
+
+2002-10-10 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: modified
+ - add support for System.Data.Odbc
+ - created simple reader to display data for those providers
+ which have not implemented GetSchemaTable - UseSimpleReader
+ - allow only providers that support parameters to use them
+ during exection of SQL - UseParameters
+ - add support for postional parameter marker (question mark),
+ the delimted named parameter markers (square brackets) in addition
+ to colon and at parameter markers. Allow, the parameter marker
+ to be settable.
+
+2002-10-09 Ville Palo (vi64pa@koti.soon.fi)
+
+ * System.Data.SqlTypes/SqlInt16Test.cs:
+ * System.Data.SqlTypes/SqlInt64Test.cs: new test suites.
+
+2002-10-04 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: modified
+ - fix compile errors due to mcs has better error checking
+ - fix exection of query with semicolon at end which resulted in an exception
+ - added support for ? postioned parameters
+ - added support for [] delimited named parameters
+ - misc. tidbits
+
+2002-10-03 ville <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlClient/AllTests.cs:
+ * System.Data.SqlClient/SqlByteTest.cs: added SqlByte test suite.
+
+2002-10-01 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/AllTests.cs: added SqlBoolean test.
+
+2002-10-01 ville <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlClient/SqlBooleanTest.cs: new test suite for
+ SqlBoolean class.
+
+2002-09-06 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data\ForeignKeyConstraintTest.cs: added
+ TestEqualAndHashCode() test.
+
+ * System.Data\UniqueConstraint.cs: Added testing for HashCode
+
+2002-09-04 Franklin Wise <gracenote@earthlink.net>
+
+ * New Files:
+ System.Data\DataRowCollectionTest.cs
+ System.Data\DataRowTest.cs
+ System.Data\DataColumnCollectionTest.cs
+
+2002-08-20 Franklin Wise <gracenote@earthlink.net>
+
+ * NewFile: System.Data\DataTableTest.cs
+
+ * AllTests.cs: Added DataTableTest to tests.
+
+2002-08-19 Franklin Wise <gracenote@earthlink.net>
+
+ * System.Data\ForeignKeyConstraintTest.cs: Added more tests.
+
+2002-08-15 Franklin Wise <gracenote@earthlink.net>
+
+ * AllTests.cs: Added ForeignKeyConstraintTest to active running tests.
+
+ * NewFile: System.Data\ForeignKeyConstraintTest.cs
+
+ * System.Data\ConstraintTest: Added new test.
+
+ * System.Data\UniqueConstraintTest: Added more tests.
+
+2002-08-14 Daniel Morgan <danmorg@sc.rr.com>
+
+ * SqlSharpCli.cs: modified
+ - implemented the following commands:
+ \f FILENAME to read a batch of Sql# commands/queries from file.");
+ \o FILENAME to write out the result of Sql# commands executed to file.");
+ \load FILENAME to load from file SQL commands into SQL buffer.");
+ \save FILENAME to save SQL commands from SQL buffer to file.
+ \print - show what's in the SQL buffer now.
+ - can save output of result to an html file or text
+ - entering command "\provider mysql" will dynamically load mysql provider
+ from its assembly Mono.Data.MySql.dll
+
+2002-08-13 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/SqlSharpCli.cs: modified
+ - removed dependency on Mono.Data.MySql assembly and classes
+ (if you still want to use Mono.Data.MySql, use \loadextprovider to load it).
+ - added use of provider System.Data.OleDb classes; however, you must
+ have a working libgda.
+ - added dynamic loading of .NET Data Provider's assembly and Connection class
+ which can be loaded via \loadextprovider
+ - renamed providers: postgresclient to postgresql, oracleclient to oracle
+ - add new command \exenonquery to execute non queries
+ - add new command \exescalar to execute and return one row/one column of data
+ - added beginnings of internal variables by adding new commands: \set, \unset, and
+ \variable
+ - add new command \r to reset (clear) the query buffer
+ - if quiting, need to close database connection if still open
+
+2002-08-12 Franklin Wise <gracenote@earthlink.net>
+ * NewFile: Added test for System.Data.UniqueConstraintTest.cs
+
+ * NewFile: Added test for System.Data.ConstraintTest.cs
+
+ * NewFile: Added test for System.Data.ConstraintCollection.cs
+
+ * Added blank test for DataColumnTest so that NUnit won't warn
+ of no tests
+
+ * Updated System.Data.AllTests.cs to include the new tests
+
+2002-05-27 Tim Coleman <tim@timcoleman.com>
+ * TestSqlDataAdapter.cs: remove explicit opening of connection.
+ This should occur implicitly now.
+
+2002-05-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * TestSqlParameters.cs: read and display the schema columns
+ correctly
+
+2002-05-16 Tim Coleman <tim@timcoleman.com>
+ * TestSqlDataAdapter.cs: Added the foreach loop to iterate through
+ all of the DataRows in the DataSet table "Table", as the
+ GetEnumerator method of InternalDataCollectionBase has now been
+ implemented.
+
+
+2002/05/17 Nick Drochak <ndrochak@gol.com>
+
+ * System.Data_test.build: Remove RunTests from the default build. We
+ can add this later, but it keeps the build from breaking for now.
+
+ * TestSqlDataAdapter.cs: Fix build breaker.
+
+2002-05-11 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/PostgresTest.cs: added call to PostgreSQL stored procedure
+ version() which returns the version of the PostgreSQL DBMS you
+ are connected to. This works and I did not realize it. Thanks
+ goes to Gonzalo.
+
+2002-05-11 Daniel Morgan <danmorg@sc.rr.com>
+
+ * AllTests.cs: needed a using for System.Data and System.Data.SqlClient,
+ changed SqlTypes.AllTests.Suite to System.Data.SqlTypes.AllTests.Suite
+
+ * System.Data/DataColumnTest.cs: changed typeof to DataColumnTest
+
+2002-05-10 Rodrigo Moya <rodrigo@ximian.com>
+
+ * TestDataColumn.cs: removed.
+
+ * System.Data_test.build: removed reference to TestDataColumn.
+
+ * TheTests.cs: added RunDataColumnTest class.
+ (RunAllTests.AddAllTests): added test for RunDataColumnTest.
+
+ * System.Data/AllTests.cs: test suite for System.Data.
+
+ * System.Data/DataColumnTest.cs: NUnit test for DataColumn.
+
+2002-05-09 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data_test.build: exclude file TestDataColumn.cs
+ test.build files have two places where a file needs to
+ be excluded
+
+2002-05-06 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlTypes.SqlInt32Test.cs: missing
+ declaration for SqlInt32 z which was a test build blocker
+
+ * PostgresTest.cs: got rid of warning about missing e
+
+ * Test/PostgresTest.cs: exclude PostgresTest.cs
+ from test build
+
+2002-05-05 Tim Coleman <tim@timcoleman.com>
+ * TheTests.cs:
+ * System.Data.SqlTypes/SqlInt32Test.cs:
+ More test cases for System.Data.SqlTypes.SqlInt32
+
+2002-05-03 Tim Coleman <tim@timcoleman.com>
+ * Added ChangeLog to test dir
+ * Added NUnit framework necessary for make test
+ * Added subdirectory for System.Data.SqlTypes
+ * New files:
+ ChangeLog
+ AllTests.cs
+ TheTests.cs
+ System.Data_test.build
+ System.Data.SqlTypes
+ System.Data.SqlTypes/AllTests.cs
+ System.Data.SqlTypes/SqlInt32Test.cs
+
+
diff --git a/mcs/class/System.Data/Test/OdbcTest.cs b/mcs/class/System.Data/Test/OdbcTest.cs
new file mode 100644
index 00000000000..943ecdf0912
--- /dev/null
+++ b/mcs/class/System.Data/Test/OdbcTest.cs
@@ -0,0 +1,60 @@
+//
+// OdbcTest.cs - Test for the ODBC ADO.NET Provider in System.Data.Odbc
+//
+// The test works on Windows XP using Microsoft .NET Framework 1.1 Beta
+//
+// To compile under Windows using Microsoft .NET 1.1
+// E:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc OdbcTest.cs /reference:System.Data.dll
+//
+// To compile under Windows using Mono:
+// mcs OdbcTest.cs -r System.Data.dll
+//
+// I have not tested it on Linux using unixODBC
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+
+using System;
+using System.Data;
+using System.Data.Odbc;
+
+namespace Test.OdbcTest
+{
+ class OdbcTest
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ OdbcConnection dbcon = new OdbcConnection();
+ // connection string to a Microsoft SQL Server 2000 database
+ // that does not use a DSN
+ //dbcon.ConnectionString =
+ // "DRIVER={SQL Server};" +
+ // "SERVER=(local);" +
+ // "Trusted_connection=true;" +
+ // "DATABASE=pubs;";
+
+ // connection string that uses a DSN.
+ dbcon.ConnectionString =
+ "DSN=LocalServer;UID=sa;PWD=";
+
+ dbcon.Open();
+
+ OdbcCommand dbcmd = new OdbcCommand();
+ dbcmd.Connection = dbcon;
+ dbcmd.CommandType = CommandType.Text;
+ dbcmd.CommandText = "SELECT lname FROM employee";
+
+ OdbcDataReader reader;
+ reader = (OdbcDataReader) dbcmd.ExecuteReader();
+
+ while(reader.Read()) {
+ Console.WriteLine("Last Name: " + reader[0].ToString());
+ }
+ reader.Close();
+ dbcmd.Dispose();
+ dbcon.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/PostgresTest.cs b/mcs/class/System.Data/Test/PostgresTest.cs
new file mode 100644
index 00000000000..e60e523d363
--- /dev/null
+++ b/mcs/class/System.Data/Test/PostgresTest.cs
@@ -0,0 +1,526 @@
+/* PostgresTest.cs - based on the postgres-test.c in libgda
+ *
+ * Copyright (C) 2002 Gonzalo Paniagua Javier
+ * Copyright (C) 2002 Daniel Morgan
+ *
+ * ORIGINAL AUTHOR:
+ * Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+ * PORTING FROM C TO C# AUTHOR:
+ * Daniel Morgan <danmorg@sc.rr.com>
+ *
+ * Permission was given from the original author, Gonzalo Paniagua Javier,
+ * to port and include his original work in Mono.
+ *
+ * The original work falls under the LGPL, but the port to C# falls
+ * under the X11 license.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+using System.Data;
+using Mono.Data.PostgreSqlClient;
+
+namespace Test.Mono.Data.PostgreSqlClient {
+
+ class PostgresTest {
+
+ // execute SQL CREATE TABLE Command using ExecuteNonQuery()
+ static void CreateTable (IDbConnection cnc) {
+
+ IDbCommand createCommand = cnc.CreateCommand();
+
+ createCommand.CommandText =
+ "create table mono_postgres_test (" +
+ "boolean_value boolean, " +
+ "int2_value smallint, " +
+ "int4_value integer, " +
+ "bigint_value bigint, " +
+ "float_value real, " +
+ "double_value double precision, " +
+ "numeric_value numeric(15, 3), " +
+ "char_value char(50), " +
+ "varchar_value varchar(20), " +
+ "text_value text, " +
+ "point_value point, " +
+ "time_value time, " +
+ "date_value date, " +
+ "timestamp_value timestamp, " +
+ "null_boolean_value boolean, " +
+ "null_int2_value smallint, " +
+ "null_int4_value integer, " +
+ "null_bigint_value bigint, " +
+ "null_float_value real, " +
+ "null_double_value double precision, " +
+ "null_numeric_value numeric(15, 3), " +
+ "null_char_value char(50), " +
+ "null_varchar_value varchar(20), " +
+ "null_text_value text, " +
+ "null_point_value point, " +
+ "null_time_value time, " +
+ "null_date_value date, " +
+ "null_timestamp_value timestamp " +
+ ")";
+
+ createCommand.ExecuteNonQuery ();
+ }
+
+ // execute SQL DROP TABLE Command using ExecuteNonQuery
+ static void DropTable (IDbConnection cnc) {
+
+ IDbCommand dropCommand = cnc.CreateCommand ();
+
+ dropCommand.CommandText =
+ "drop table mono_postgres_test";
+
+ dropCommand.ExecuteNonQuery ();
+ }
+
+ // execute stored procedure using ExecuteScalar()
+ static object CallStoredProcedure (IDbConnection cnc) {
+
+ IDbCommand callStoredProcCommand = cnc.CreateCommand ();
+ object data;
+
+ callStoredProcCommand.CommandType =
+ CommandType.StoredProcedure;
+ callStoredProcCommand.CommandText =
+ "version";
+
+ data = callStoredProcCommand.ExecuteScalar ();
+
+ return data;
+ }
+
+ // execute SQL INSERT Command using ExecuteNonQuery()
+ static void InsertData (IDbConnection cnc) {
+
+ IDbCommand insertCommand = cnc.CreateCommand();
+
+ insertCommand.CommandText =
+ "insert into mono_postgres_test (" +
+ "boolean_value, " +
+ "int2_value, " +
+ "int4_value, " +
+ "bigint_value, " +
+ "float_value, " +
+ "double_value, " +
+ "numeric_value, " +
+ "char_value, " +
+ "varchar_value, " +
+ "text_value, " +
+ "time_value, " +
+ "date_value, " +
+ "timestamp_value, " +
+ "point_value " +
+ ") values (" +
+ "'T', " +
+ "-22, " +
+ "1048000, " +
+ "123456789012345, " +
+ "3.141592, " +
+ "3.1415926969696, " +
+ "123456789012.345, " +
+ "'This is a char', " +
+ "'This is a varchar', " +
+ "'This is a text', " +
+ "'21:13:14', " +
+ "'2000-02-29', " +
+ "'2004-02-29 14:00:11.31', " +
+ "'(1,0)' " +
+ ")";
+
+ insertCommand.ExecuteNonQuery ();
+ }
+
+ // execute a SQL SELECT Query using ExecuteReader() to retrieve
+ // a IDataReader so we retrieve data
+ static IDataReader SelectData (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // FIXME: System.Data classes need to handle NULLs
+ // this would be done by System.DBNull ?
+ // FIXME: System.Data needs to handle more data types
+ /*
+ selectCommand.CommandText =
+ "select * " +
+ "from mono_postgres_test";
+ */
+
+ selectCommand.CommandText =
+ "select " +
+ "boolean_value, " +
+ "int2_value, " +
+ "int4_value, " +
+ "bigint_value, " +
+ "float_value, " +
+ "double_value, " +
+ "numeric_value, " +
+ "char_value, " +
+ "varchar_value, " +
+ "text_value, " +
+ "point_value, " +
+ "time_value, " +
+ "date_value, " +
+ "timestamp_value, " +
+ "null_boolean_value, " +
+ "null_int2_value, " +
+ "null_int4_value, " +
+ "null_bigint_value, " +
+ "null_float_value, " +
+ "null_double_value, " +
+ "null_numeric_value, " +
+ "null_char_value, " +
+ "null_varchar_value, " +
+ "null_text_value, " +
+ "null_point_value, " +
+ "null_time_value, " +
+ "null_date_value, " +
+ "null_timestamp_value " +
+ "from mono_postgres_test";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+ // Tests a SQL Command (INSERT, UPDATE, DELETE)
+ // executed via ExecuteReader
+ static IDataReader SelectDataUsingInsertCommand (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // This is a SQL INSERT Command, not a Query
+ selectCommand.CommandText =
+ "insert into mono_postgres_test (" +
+ "boolean_value, " +
+ "int2_value, " +
+ "int4_value, " +
+ "bigint_value, " +
+ "float_value, " +
+ "double_value, " +
+ "numeric_value, " +
+ "char_value, " +
+ "varchar_value, " +
+ "text_value, " +
+ "time_value, " +
+ "date_value, " +
+ "timestamp_value, " +
+ "point_value " +
+ ") values (" +
+ "'T', " +
+ "-22, " +
+ "1048000, " +
+ "123456789012345, " +
+ "3.141592, " +
+ "3.1415926969696, " +
+ "123456789012.345, " +
+ "'This is a char', " +
+ "'This is a varchar', " +
+ "'This is a text', " +
+ "'21:13:14', " +
+ "'2000-02-29', " +
+ "'2004-02-29 14:00:11.31', " +
+ "'(1,0)' " +
+ ")";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+ // Tests a SQL Command not (INSERT, UPDATE, DELETE)
+ // executed via ExecuteReader
+ static IDataReader SelectDataUsingCommand (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // This is a SQL Command, not a Query
+ selectCommand.CommandText =
+ "SET DATESTYLE TO 'ISO'";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+
+ // execute an SQL UPDATE Command using ExecuteNonQuery()
+ static void UpdateData (IDbConnection cnc) {
+
+ IDbCommand updateCommand = cnc.CreateCommand();
+
+ updateCommand.CommandText =
+ "update mono_postgres_test " +
+ "set " +
+ "boolean_value = 'F', " +
+ "int2_value = 5, " +
+ "int4_value = 3, " +
+ "bigint_value = 9, " +
+ "char_value = 'Mono.Data!' , " +
+ "varchar_value = 'It was not me!', " +
+ "text_value = 'We got data!' " +
+ "where int2_value = -22";
+
+ updateCommand.ExecuteNonQuery ();
+ }
+
+ // used to do a min(), max(), count(), sum(), or avg()
+ // execute SQL SELECT Query using ExecuteScalar
+ static object SelectAggregate (IDbConnection cnc, String agg) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ object data;
+
+ Console.WriteLine("Aggregate: " + agg);
+
+ selectCommand.CommandType = CommandType.Text;
+ selectCommand.CommandText =
+ "select " + agg +
+ "from mono_postgres_test";
+
+ data = selectCommand.ExecuteScalar ();
+
+ Console.WriteLine("Agg Result: " + data);
+
+ return data;
+ }
+
+ // used internally by ReadData() to read each result set
+ static void ReadResult(IDataReader rdr, DataTable dt) {
+
+ // number of columns in the table
+ Console.WriteLine(" Total Columns: " +
+ dt.Rows.Count);
+
+ // display the schema
+ foreach (DataRow schemaRow in dt.Rows) {
+ foreach (DataColumn schemaCol in dt.Columns)
+ Console.WriteLine(schemaCol.ColumnName +
+ " = " +
+ schemaRow[schemaCol]);
+ Console.WriteLine();
+ }
+
+ int nRows = 0;
+ int c = 0;
+ string output, metadataValue, dataValue;
+ // Read and display the rows
+ Console.WriteLine("Gonna do a Read() now...");
+ while(rdr.Read()) {
+ Console.WriteLine(" Row " + nRows + ": ");
+
+ for(c = 0; c < rdr.FieldCount; c++) {
+ // column meta data
+ DataRow dr = dt.Rows[c];
+ metadataValue =
+ " Col " +
+ c + ": " +
+ dr["ColumnName"];
+
+ // column data
+ if(rdr.IsDBNull(c) == true)
+ dataValue = " is NULL";
+ else
+ dataValue =
+ ": " +
+ rdr.GetValue(c);
+
+ // display column meta data and data
+ output = metadataValue + dataValue;
+ Console.WriteLine(output);
+ }
+ nRows++;
+ }
+ Console.WriteLine(" Total Rows Retrieved: " +
+ nRows);
+ }
+
+ // Used to read data from IDataReader after calling IDbCommand:ExecuteReader()
+ static void ReadData(IDataReader rdr) {
+
+ int results = 0;
+ if(rdr == null) {
+
+ Console.WriteLine("IDataReader has a Null Reference.");
+ }
+ else {
+ do {
+ DataTable dt = rdr.GetSchemaTable();
+ if(rdr.RecordsAffected != -1) {
+ // Results for
+ // SQL INSERT, UPDATE, DELETE Commands
+ // have RecordsAffected >= 0
+ Console.WriteLine("Result is from a SQL Command (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ }
+ else if(dt == null)
+ // Results for
+ // SQL Commands not INSERT, UPDATE, nor DELETE
+ // have RecordsAffected == -1
+ // and GetSchemaTable() returns a null reference
+ Console.WriteLine("Result is from a SQL Command not (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ else {
+ // Results for
+ // SQL SELECT Queries
+ // have RecordsAffected = -1
+ // and GetSchemaTable() returns a reference to a DataTable
+ Console.WriteLine("Result is from a SELECT SQL Query. Records Affected: " + rdr.RecordsAffected);
+
+ results++;
+ Console.WriteLine("Result Set " + results + "...");
+
+ ReadResult(rdr, dt);
+ }
+
+ } while(rdr.NextResult());
+ Console.WriteLine("Total Result sets: " + results);
+
+ rdr.Close();
+ }
+ }
+
+ /* Postgres provider tests */
+ static void DoPostgresTest (IDbConnection cnc) {
+
+ IDataReader reader;
+ Object oDataValue;
+
+ Console.WriteLine ("\tPostgres provider specific tests...\n");
+
+ /* Drops the gda_postgres_test table. */
+ Console.WriteLine ("\t\tDrop table: ");
+ try {
+ DropTable (cnc);
+ Console.WriteLine ("OK");
+ }
+ catch (PgSqlException e) {
+ Console.WriteLine("Error (don't worry about this one)" + e);
+ }
+
+ try {
+ /* Creates a table with all supported data types */
+ Console.WriteLine ("\t\tCreate table with all supported types: ");
+ CreateTable (cnc);
+ Console.WriteLine ("OK");
+
+ /* Inserts values */
+ Console.WriteLine ("\t\tInsert values for all known types: ");
+ InsertData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Update values */
+ Console.WriteLine ("\t\tUpdate values: ");
+ UpdateData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Inserts values */
+ Console.WriteLine ("\t\tInsert values for all known types: ");
+ InsertData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Select aggregates */
+ SelectAggregate (cnc, "count(*)");
+ // FIXME: still having a problem with avg()
+ // because it returns a decimal.
+ // It may have something to do
+ // with culture not being set
+ // properly.
+ //SelectAggregate (cnc, "avg(int4_value)");
+ SelectAggregate (cnc, "min(text_value)");
+ SelectAggregate (cnc, "max(int4_value)");
+ SelectAggregate (cnc, "sum(int4_value)");
+
+ /* Select values */
+ Console.WriteLine ("\t\tSelect values from the database: ");
+ reader = SelectData (cnc);
+ ReadData(reader);
+
+ /* SQL Command via ExecuteReader/SqlDataReader */
+ /* Command is not INSERT, UPDATE, or DELETE */
+ Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Not INSERT,UPDATE,DELETE).");
+ reader = SelectDataUsingCommand(cnc);
+ ReadData(reader);
+
+ /* SQL Command via ExecuteReader/SqlDataReader */
+ /* Command is INSERT, UPDATE, or DELETE */
+ Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Is INSERT,UPDATE,DELETE).");
+ reader = SelectDataUsingInsertCommand(cnc);
+ ReadData(reader);
+
+ // Call a Stored Procedure named Version()
+ Console.WriteLine("\t\tCalling stored procedure version()");
+ object obj = CallStoredProcedure(cnc);
+ Console.WriteLine("Result: " + obj);
+
+ Console.WriteLine("Database Server Version: " +
+ ((PgSqlConnection)cnc).ServerVersion);
+
+ /* Clean up */
+ Console.WriteLine ("Clean up...");
+ Console.WriteLine ("\t\tDrop table...");
+ DropTable (cnc);
+ Console.WriteLine("OK");
+ }
+ catch(Exception e) {
+ Console.WriteLine("Exception caught: " + e);
+ }
+ }
+
+ [STAThread]
+ static void Main(string[] args) {
+ Console.WriteLine("Tests Start.");
+ Console.WriteLine("Creating PgSqlConnectioin...");
+ PgSqlConnection cnc = new PgSqlConnection ();
+
+ // possible PostgreSQL Provider ConnectionStrings
+ //string connectionString =
+ // "Server=hostname;" +
+ // "Database=database;" +
+ // "User ID=userid;" +
+ // "Password=password";
+ // or
+ //string connectionString =
+ // "host=hostname;" +
+ // "dbname=database;" +
+ // "user=userid;" +
+ // "password=password";
+
+ string connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=postgres";
+
+ Console.WriteLine("Setting ConnectionString: " +
+ connectionString);
+ cnc.ConnectionString = connectionString;
+
+ Console.WriteLine("Opening database connection...");
+ cnc.Open();
+
+ Console.WriteLine("Do Tests....");
+ DoPostgresTest(cnc);
+
+ Console.WriteLine("Close database connection...");
+ cnc.Close();
+
+ Console.WriteLine("Tests Done.");
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/SqlTest.cs b/mcs/class/System.Data/Test/SqlTest.cs
new file mode 100644
index 00000000000..993e090730e
--- /dev/null
+++ b/mcs/class/System.Data/Test/SqlTest.cs
@@ -0,0 +1,716 @@
+/* SqlTest.cs - based on PostgresTest.cs
+ *
+ * Copyright (C) 2002 Gonzalo Paniagua Javier
+ * Copyright (C) 2002 Daniel Morgan
+ * Copyright (C) 2002 Tim Coleman
+ *
+ * ORIGINAL AUTHOR:
+ * Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+ * PORTING FROM C TO C# AUTHOR:
+ * Daniel Morgan <danmorg@sc.rr.com>
+ * PORTING TO SQL SERVER AUTHOR:
+ * Tim Coleman <tim@timcoleman.com>
+ *
+ * Permission was given from the original author, Gonzalo Paniagua Javier,
+ * to port and include his original work in Mono.
+ *
+ * The original work falls under the LGPL, but the port to C# falls
+ * under the X11 license.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using System.Text;
+
+namespace Test.Mono.Data.SqlClient {
+
+ class SqlTest {
+
+ // execute SQL CREATE TABLE Command using ExecuteNonQuery()
+ static void CreateTable (IDbConnection cnc) {
+
+ IDbCommand createCommand = cnc.CreateCommand();
+
+ createCommand.CommandText =
+ "create table mono_sql_test (" +
+ "bit_value bit, " +
+ "binary_value binary (8), " +
+ "char_value char(50), " +
+ "datetime_value datetime, " +
+ "decimal_value decimal(15, 3), " +
+ "float_value float, " +
+ "image_value image, " +
+ "int_value int, " +
+ "money_value money, " +
+ "nchar_value nchar(50), " +
+ "ntext_value ntext, " +
+ "nvarchar_value nvarchar(20), " +
+ "real_value real, " +
+ "smalldatetime_value smalldatetime, " +
+ "smallint_value smallint, " +
+ "smallmoney_value smallmoney, " +
+ "text_value text, " +
+ "timestamp_value timestamp, " +
+ "tinyint_value tinyint, " +
+ "uniqueidentifier_value uniqueidentifier, " +
+ "varbinary_value varbinary (8), " +
+ "varchar_value varchar(20), " +
+ "null_bit_value bit, " +
+ "null_binary_value binary (8), " +
+ "null_char_value char(50), " +
+ "null_datetime_value datetime, " +
+ "null_decimal_value decimal(15, 3), " +
+ "null_float_value float, " +
+ "null_image_value image, " +
+ "null_int_value int, " +
+ "null_money_value int, " +
+ "null_nchar_value nchar(50), " +
+ "null_ntext_value ntext, " +
+ "null_nvarchar_value nvarchar(20), " +
+ "null_real_value real, " +
+ "null_smalldatetime_value smalldatetime, " +
+ "null_smallint_value smallint, " +
+ "null_smallmoney_value int, " +
+ "null_text_value text, " +
+ "null_tinyint_value tinyint, " +
+ "null_uniqueidentifier_value uniqueidentifier, " +
+ "null_varbinary_value varbinary (8), " +
+ "null_varchar_value varchar(20) " +
+ ")";
+
+ createCommand.ExecuteNonQuery ();
+ }
+
+ // execute SQL DROP TABLE Command using ExecuteNonQuery
+ static void DropTable (IDbConnection cnc) {
+
+ IDbCommand dropCommand = cnc.CreateCommand ();
+
+ dropCommand.CommandText =
+ "drop table mono_sql_test";
+
+ dropCommand.ExecuteNonQuery ();
+ }
+
+ // execute stored procedure using ExecuteScalar()
+ static object CallStoredProcedure (IDbConnection cnc) {
+
+ IDbCommand callStoredProcCommand = cnc.CreateCommand ();
+ object data;
+
+ callStoredProcCommand.CommandType =
+ CommandType.StoredProcedure;
+ callStoredProcCommand.CommandText =
+ "sp_server_info";
+
+ data = callStoredProcCommand.ExecuteScalar ();
+
+ return data;
+ }
+
+ // execute SQL INSERT Command using ExecuteNonQuery()
+ static void InsertData (IDbConnection cnc) {
+
+ IDbCommand insertCommand = cnc.CreateCommand();
+
+ insertCommand.CommandText =
+ "insert into mono_sql_test (" +
+ "bit_value, " +
+ "binary_value, " +
+ "char_value, " +
+ "datetime_value, " +
+ "decimal_value, " +
+ "float_value, " +
+ "image_value, " +
+ "int_value, " +
+ "money_value, " +
+ "nchar_value, " +
+ "ntext_value, " +
+ "nvarchar_value, " +
+ "real_value, " +
+ "smalldatetime_value, " +
+ "smallint_value, " +
+ "smallmoney_value, " +
+ "text_value, " +
+ "tinyint_value, " +
+ "uniqueidentifier_value, " +
+ "varbinary_value, " +
+ "varchar_value " +
+ ") values (" +
+ "@p1, " +
+ "@p2, " +
+ "@p3, " +
+ "@p4, " +
+ "@p5, " +
+ "@p6, " +
+ "@p7, " +
+ "@p8, " +
+ "@p9, " +
+ "@p10, " +
+ "@p11, " +
+ "@p12, " +
+ "@p13, " +
+ "@p14, " +
+ "@p15, " +
+ "@p16, " +
+ "@p17, " +
+ "@p18, " +
+ "@p19, " +
+ "@p20, " +
+ "@p21 " +
+ ")";
+
+ SqlParameterCollection parameters = ((SqlCommand) insertCommand).Parameters;
+
+ parameters.Add ("@p1", SqlDbType.Bit);
+ parameters.Add ("@p2", SqlDbType.Binary, 8);
+ parameters.Add ("@p3", SqlDbType.Char, 14);
+ parameters.Add ("@p4", SqlDbType.DateTime);
+ parameters.Add ("@p5", SqlDbType.Decimal);
+ parameters.Add ("@p6", SqlDbType.Float);
+ parameters.Add ("@p7", SqlDbType.Image);
+ parameters.Add ("@p8", SqlDbType.Int);
+ parameters.Add ("@p9", SqlDbType.Money);
+ parameters.Add ("@p10", SqlDbType.NChar, 16);
+ parameters.Add ("@p11", SqlDbType.NText);
+ parameters.Add ("@p12", SqlDbType.NVarChar, 19);
+ parameters.Add ("@p13", SqlDbType.Real);
+ parameters.Add ("@p14", SqlDbType.SmallDateTime);
+ parameters.Add ("@p15", SqlDbType.SmallInt);
+ parameters.Add ("@p16", SqlDbType.SmallMoney);
+ parameters.Add ("@p17", SqlDbType.Text);
+ parameters.Add ("@p18", SqlDbType.TinyInt);
+ parameters.Add ("@p19", SqlDbType.UniqueIdentifier);
+ parameters.Add ("@p20", SqlDbType.VarBinary, 8);
+ parameters.Add ("@p21", SqlDbType.VarChar, 17);
+
+ parameters ["@p1"].Value = true;
+ parameters ["@p2"].Value = new byte[2] {0x12,0x34};
+ parameters ["@p3"].Value = "This is a char";
+ parameters ["@p4"].Value = new DateTime (1959, 7, 17); // My mom's birthday!
+
+ parameters ["@p5"].Value = 123456789012.345;
+ parameters ["@p5"].Precision = 15;
+ parameters ["@p5"].Scale = 3;
+
+ parameters ["@p6"].Value = 3.1415926969696;
+ parameters ["@p7"].Value = new byte[4] {0xde, 0xad, 0xbe, 0xef};
+ parameters ["@p8"].Value = 1048000;
+ parameters ["@p9"].Value = 31337.456;
+ parameters ["@p10"].Value = "This is an nchar";
+ parameters ["@p11"].Value = "This is an ntext";
+ parameters ["@p12"].Value = "This is an nvarchar";
+ parameters ["@p13"].Value = 3.141592;
+ parameters ["@p14"].Value = new DateTime (1976, 10, 31); // My birthday!
+ parameters ["@p15"].Value = -22;
+ parameters ["@p16"].Value = 31337.456;
+ parameters ["@p17"].Value = "This is a text";
+ parameters ["@p18"].Value = 15;
+ parameters ["@p19"].Value = Guid.NewGuid ();
+ parameters ["@p20"].Value = new byte[2] {0x56,0x78};
+ parameters ["@p21"].Value = "This is a varchar";
+
+ insertCommand.ExecuteNonQuery ();
+ }
+
+ // execute a SQL SELECT Query using ExecuteReader() to retrieve
+ // a IDataReader so we retrieve data
+ static IDataReader SelectData (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // FIXME: System.Data classes need to handle NULLs
+ // this would be done by System.DBNull ?
+ // FIXME: System.Data needs to handle more data types
+ /*
+ selectCommand.CommandText =
+ "select * " +
+ "from mono_postgres_test";
+ */
+
+ selectCommand.CommandText =
+ "select " +
+ "bit_value, " +
+ "binary_value, " +
+ "char_value, " +
+ "datetime_value, " +
+ "decimal_value, " +
+ "float_value, " +
+ "image_value, " +
+ "int_value, " +
+ "money_value, " +
+ "nchar_value, " +
+ "ntext_value, " +
+ "nvarchar_value, " +
+ "real_value, " +
+ "smalldatetime_value, " +
+ "smallint_value, " +
+ "smallmoney_value, " +
+ "text_value, " +
+ "timestamp_value, " +
+ "tinyint_value, " +
+ "uniqueidentifier_value, " +
+ "varbinary_value, " +
+ "varchar_value, " +
+ "null_bit_value, " +
+ "null_binary_value, " +
+ "null_char_value, " +
+ "null_datetime_value, " +
+ "null_decimal_value, " +
+ "null_float_value, " +
+ "null_image_value, " +
+ "null_int_value, " +
+ "null_money_value, " +
+ "null_nchar_value, " +
+ "null_ntext_value, " +
+ "null_nvarchar_value, " +
+ "null_real_value, " +
+ "null_smalldatetime_value, " +
+ "null_smallint_value, " +
+ "null_smallmoney_value, " +
+ "null_text_value, " +
+ "null_tinyint_value, " +
+ "null_uniqueidentifier_value, " +
+ "null_varbinary_value, " +
+ "null_varchar_value " +
+ "from mono_sql_test";
+
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+ // Tests a SQL Command (INSERT, UPDATE, DELETE)
+ // executed via ExecuteReader
+ static IDataReader SelectDataUsingInsertCommand (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // This is a SQL INSERT Command, not a Query
+ selectCommand.CommandText =
+ "insert into mono_sql_test (" +
+ "bit_value, " +
+ "binary_value, " +
+ "char_value, " +
+ "datetime_value, " +
+ "decimal_value, " +
+ "float_value, " +
+ "image_value, " +
+ "int_value, " +
+ "money_value, " +
+ "nchar_value, " +
+ "ntext_value, " +
+ "nvarchar_value, " +
+ "real_value, " +
+ "smalldatetime_value, " +
+ "smallint_value, " +
+ "smallmoney_value, " +
+ "text_value, " +
+ "tinyint_value, " +
+ "uniqueidentifier_value, " +
+ "varbinary_value, " +
+ "varchar_value " +
+ ") values (" +
+ "@p1, " +
+ "@p2, " +
+ "@p3, " +
+ "@p4, " +
+ "@p5, " +
+ "@p6, " +
+ "@p7, " +
+ "@p8, " +
+ "@p9, " +
+ "@p10, " +
+ "@p11, " +
+ "@p12, " +
+ "@p13, " +
+ "@p14, " +
+ "@p15, " +
+ "@p16, " +
+ "@p17, " +
+ "@p18, " +
+ "@p19, " +
+ "@p20, " +
+ "@p21 " +
+ ")";
+
+ SqlParameterCollection parameters = ((SqlCommand) selectCommand).Parameters;
+
+ parameters.Add ("@p1", SqlDbType.Bit);
+ parameters.Add ("@p2", SqlDbType.Binary, 8);
+ parameters.Add ("@p3", SqlDbType.Char, 14);
+ parameters.Add ("@p4", SqlDbType.DateTime);
+ parameters.Add ("@p5", SqlDbType.Decimal);
+ parameters.Add ("@p6", SqlDbType.Float);
+ parameters.Add ("@p7", SqlDbType.Image);
+ parameters.Add ("@p8", SqlDbType.Int);
+ parameters.Add ("@p9", SqlDbType.Money);
+ parameters.Add ("@p10", SqlDbType.NChar, 16);
+ parameters.Add ("@p11", SqlDbType.NText);
+ parameters.Add ("@p12", SqlDbType.NVarChar, 19);
+ parameters.Add ("@p13", SqlDbType.Real);
+ parameters.Add ("@p14", SqlDbType.SmallDateTime);
+ parameters.Add ("@p15", SqlDbType.SmallInt);
+ parameters.Add ("@p16", SqlDbType.SmallMoney);
+ parameters.Add ("@p17", SqlDbType.Text);
+ parameters.Add ("@p18", SqlDbType.TinyInt);
+ parameters.Add ("@p19", SqlDbType.UniqueIdentifier);
+ parameters.Add ("@p20", SqlDbType.VarBinary, 8);
+ parameters.Add ("@p21", SqlDbType.VarChar, 17);
+
+ parameters ["@p1"].Value = true;
+ parameters ["@p2"].Value = new byte[2] {0x9a,0xbc};
+ parameters ["@p3"].Value = "This is a char";
+ parameters ["@p4"].Value = DateTime.Now;
+
+ parameters ["@p5"].Value = 123456789012.345;
+ parameters ["@p5"].Precision = 15;
+ parameters ["@p5"].Scale = 3;
+
+ parameters ["@p6"].Value = 3.1415926969696;
+ parameters ["@p7"].Value = new byte[4] {0xfe, 0xeb, 0xda, 0xed};
+ parameters ["@p8"].Value = 1048000;
+ parameters ["@p9"].Value = 31337.456;
+ parameters ["@p10"].Value = "This is an nchar";
+ parameters ["@p11"].Value = "This is an ntext";
+ parameters ["@p12"].Value = "This is an nvarchar";
+ parameters ["@p13"].Value = 3.141592;
+ parameters ["@p14"].Value = new DateTime (1978, 6, 30); // My brother's birthday!
+ parameters ["@p15"].Value = -22;
+ parameters ["@p16"].Value = 31337.456;
+ parameters ["@p17"].Value = "This is a text";
+ parameters ["@p18"].Value = 15;
+ parameters ["@p19"].Value = Guid.NewGuid ();
+ parameters ["@p20"].Value = new byte[2] {0xde, 0xef};
+ parameters ["@p21"].Value = "This is a varchar";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+ // Tests a SQL Command not (INSERT, UPDATE, DELETE)
+ // executed via ExecuteReader
+ static IDataReader SelectDataUsingCommand (IDbConnection cnc) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ IDataReader reader;
+
+ // This is a SQL Command, not a Query
+ selectCommand.CommandText =
+ "SET FMTONLY OFF";
+
+ reader = selectCommand.ExecuteReader ();
+
+ return reader;
+ }
+
+
+ // execute an SQL UPDATE Command using ExecuteNonQuery()
+ static void UpdateData (IDbConnection cnc) {
+
+ IDbCommand updateCommand = cnc.CreateCommand();
+
+ updateCommand.CommandText =
+ "update mono_sql_test " +
+ "set " +
+ "bit_value = @p1, " +
+ "tinyint_value = @p2, " +
+ "smallint_value = @p3, " +
+ "int_value = @p4, " +
+ "char_value = @p5, " +
+ "nchar_value = @p6, " +
+ "varchar_value = @p7, " +
+ "nvarchar_value = @p8, " +
+ "text_value = @p9, " +
+ "ntext_value = @p10, " +
+ "uniqueidentifier_value = @p11, " +
+ "binary_value = @p12, " +
+ "varbinary_value = @p13 " +
+ "where smallint_value = @p14";
+
+ SqlParameterCollection parameters = ((SqlCommand) updateCommand).Parameters;
+
+ parameters.Add ("@p1", SqlDbType.Bit);
+ parameters.Add ("@p2", SqlDbType.TinyInt);
+ parameters.Add ("@p3", SqlDbType.SmallInt);
+ parameters.Add ("@p4", SqlDbType.Int);
+ parameters.Add ("@p5", SqlDbType.Char, 10);
+ parameters.Add ("@p6", SqlDbType.NChar, 10);
+ parameters.Add ("@p7", SqlDbType.VarChar, 14);
+ parameters.Add ("@p8", SqlDbType.NVarChar, 14);
+ parameters.Add ("@p9", SqlDbType.Text);
+ parameters.Add ("@p10", SqlDbType.NText);
+ parameters.Add ("@p11", SqlDbType.UniqueIdentifier);
+ parameters.Add ("@p12", SqlDbType.Binary, 8);
+ parameters.Add ("@p13", SqlDbType.VarBinary, 8);
+ parameters.Add ("@p14", SqlDbType.SmallInt);
+
+ parameters ["@p1"].Value = false;
+ parameters ["@p2"].Value = 2;
+ parameters ["@p3"].Value = 5;
+ parameters ["@p4"].Value = 3;
+ parameters ["@p5"].Value = "Mono.Data!";
+ parameters ["@p6"].Value = "Mono.Data!";
+ parameters ["@p7"].Value = "It was not me!";
+ parameters ["@p8"].Value = "It was not me!";
+ parameters ["@p9"].Value = "We got data!";
+ parameters ["@p10"].Value = "We got data!";
+ parameters ["@p11"].Value = Guid.NewGuid ();
+ parameters ["@p12"].Value = new byte[2] {0x57,0x3e};
+ parameters ["@p13"].Value = new byte[2] {0xa2,0xf7};
+ parameters ["@p14"].Value = -22;
+
+ updateCommand.ExecuteNonQuery ();
+ }
+
+ // used to do a min(), max(), count(), sum(), or avg()
+ // execute SQL SELECT Query using ExecuteScalar
+ static object SelectAggregate (IDbConnection cnc, String agg) {
+
+ IDbCommand selectCommand = cnc.CreateCommand();
+ object data;
+
+ Console.WriteLine("Aggregate: " + agg);
+
+ selectCommand.CommandType = CommandType.Text;
+ selectCommand.CommandText =
+ "select " + agg +
+ "from mono_sql_test";
+
+ data = selectCommand.ExecuteScalar ();
+
+ Console.WriteLine("Agg Result: " + data);
+
+ return data;
+ }
+
+ // used internally by ReadData() to read each result set
+ static void ReadResult(IDataReader rdr, DataTable dt) {
+
+ // number of columns in the table
+ Console.WriteLine(" Total Columns: " +
+ dt.Rows.Count);
+
+ // display the schema
+ foreach (DataRow schemaRow in dt.Rows) {
+ foreach (DataColumn schemaCol in dt.Columns)
+ Console.WriteLine(schemaCol.ColumnName +
+ " = " +
+ schemaRow[schemaCol]);
+ Console.WriteLine();
+ }
+
+ int nRows = 0;
+ int c = 0;
+ string output, metadataValue, dataValue;
+ // Read and display the rows
+ Console.WriteLine("Gonna do a Read() now...");
+ while(rdr.Read()) {
+ Console.WriteLine(" Row " + nRows + ": ");
+
+ for(c = 0; c < rdr.FieldCount; c++) {
+ // column meta data
+ DataRow dr = dt.Rows[c];
+ metadataValue =
+ " Col " +
+ c + ": " +
+ dr["ColumnName"];
+
+ // column data
+ if (rdr.IsDBNull(c) == true)
+ dataValue = " is NULL";
+ else if ((Type) dr["DataType"] == typeof (byte[]))
+ dataValue =
+ ": 0x" +
+ BitConverter.ToString ((byte[]) rdr.GetValue (c)).Replace ("-", "").ToLower ();
+ else
+ dataValue =
+ ": " +
+ rdr.GetValue(c);
+
+ // display column meta data and data
+ output = metadataValue + dataValue;
+ Console.WriteLine(output);
+ }
+ nRows++;
+ }
+ Console.WriteLine(" Total Rows Retrieved: " +
+ nRows);
+ }
+
+ // Used to read data from IDataReader after calling IDbCommand:ExecuteReader()
+ static void ReadData(IDataReader rdr) {
+
+ int results = 0;
+ if(rdr == null) {
+
+ Console.WriteLine("IDataReader has a Null Reference.");
+ }
+ else {
+ do {
+ DataTable dt = rdr.GetSchemaTable();
+ if(rdr.RecordsAffected != -1) {
+ // Results for
+ // SQL INSERT, UPDATE, DELETE Commands
+ // have RecordsAffected >= 0
+ Console.WriteLine("Result is from a SQL Command (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ }
+ else if(dt == null)
+ // Results for
+ // SQL Commands not INSERT, UPDATE, nor DELETE
+ // have RecordsAffected == -1
+ // and GetSchemaTable() returns a null reference
+ Console.WriteLine("Result is from a SQL Command not (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ else {
+ // Results for
+ // SQL SELECT Queries
+ // have RecordsAffected = -1
+ // and GetSchemaTable() returns a reference to a DataTable
+ Console.WriteLine("Result is from a SELECT SQL Query. Records Affected: " + rdr.RecordsAffected);
+
+ results++;
+ Console.WriteLine("Result Set " + results + "...");
+
+ ReadResult(rdr, dt);
+ }
+
+ } while(rdr.NextResult());
+ Console.WriteLine("Total Result sets: " + results);
+
+ rdr.Close();
+ }
+ }
+
+ /* Sql provider tests */
+ static void DoSqlTest (IDbConnection cnc) {
+
+ IDataReader reader;
+ Object oDataValue;
+
+ Console.WriteLine ("\tSql provider specific tests...\n");
+
+ /* Drops the mono_sql_test table. */
+ Console.WriteLine ("\t\tDrop table: ");
+ try {
+ DropTable (cnc);
+ Console.WriteLine ("OK");
+ }
+ catch (SqlException e) {
+ Console.WriteLine("Error (don't worry about this one)" + e);
+ }
+
+ try {
+ /* Creates a table with all supported data types */
+ Console.WriteLine ("\t\tCreate table with all supported types: ");
+ CreateTable (cnc);
+ Console.WriteLine ("OK");
+
+ /* Inserts values */
+ Console.WriteLine ("\t\tInsert values for all known types: ");
+ InsertData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Update values */
+ Console.WriteLine ("\t\tUpdate values: ");
+ UpdateData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Inserts values */
+ Console.WriteLine ("\t\tInsert values for all known types: ");
+ InsertData (cnc);
+ Console.WriteLine ("OK");
+
+ /* Select aggregates */
+ SelectAggregate (cnc, "count(*)");
+ // FIXME: still having a problem with avg()
+ // because it returns a decimal.
+ // It may have something to do
+ // with culture not being set
+ // properly.
+ //SelectAggregate (cnc, "avg(int_value)");
+ SelectAggregate (cnc, "min(varchar_value)");
+ SelectAggregate (cnc, "max(int_value)");
+ SelectAggregate (cnc, "sum(int_value)");
+
+ /* Select values */
+ Console.WriteLine ("\t\tSelect values from the database: ");
+ reader = SelectData (cnc);
+ ReadData(reader);
+
+ /* SQL Command via ExecuteReader/SqlDataReader */
+ /* Command is not INSERT, UPDATE, or DELETE */
+ Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Not INSERT,UPDATE,DELETE).");
+ reader = SelectDataUsingCommand(cnc);
+ ReadData(reader);
+
+ /* SQL Command via ExecuteReader/SqlDataReader */
+ /* Command is INSERT, UPDATE, or DELETE */
+ Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Is INSERT,UPDATE,DELETE).");
+ reader = SelectDataUsingInsertCommand(cnc);
+ ReadData(reader);
+
+ // Call a Stored Procedure named Version()
+ Console.WriteLine("\t\tCalling stored procedure sp_server_info()");
+ object obj = CallStoredProcedure(cnc);
+ Console.WriteLine("Result: " + obj);
+
+ Console.WriteLine("Database Server Version: " +
+ ((SqlConnection)cnc).ServerVersion);
+
+ /* Clean up */
+ Console.WriteLine ("Clean up...");
+ Console.WriteLine ("\t\tDrop table...");
+ //DropTable (cnc);
+ Console.WriteLine("OK");
+ }
+ catch(Exception e) {
+ Console.WriteLine("Exception caught: " + e);
+ }
+ }
+
+ [STAThread]
+ static void Main(string[] args) {
+ SqlConnection cnc = new SqlConnection ();
+
+ /*
+ string connectionString =
+ "host=hostname;" +
+ "dbname=database;" +
+ "user=userid;" +
+ "password=password";
+ */
+
+ string connectionString =
+ "Server=localhost;" +
+ "Database=test;" +
+ "User ID=sql;" +
+ "Password=";
+
+ cnc.ConnectionString = connectionString;
+
+ cnc.Open();
+ DoSqlTest(cnc);
+ cnc.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/AllTests.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/AllTests.cs
new file mode 100644
index 00000000000..938ae3fb8a5
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/AllTests.cs
@@ -0,0 +1,39 @@
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ /// <summary>
+ /// Combines all unit tests for the System.Data.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new TestSuite (typeof (SqlBinaryTest)));
+ suite.AddTest (new TestSuite (typeof (SqlBooleanTest)));
+ suite.AddTest (new TestSuite (typeof (SqlByteTest)));
+ suite.AddTest (new TestSuite (typeof (SqlDoubleTest)));
+ suite.AddTest (new TestSuite (typeof (SqlInt16Test)));
+ suite.AddTest (new TestSuite (typeof (SqlInt32Test)));
+ suite.AddTest (new TestSuite (typeof (SqlInt64Test)));
+ suite.AddTest (new TestSuite (typeof (SqlSingleTest)));
+ suite.AddTest (new TestSuite (typeof (SqlMoneyTest)));
+ suite.AddTest (new TestSuite (typeof (SqlDateTimeTest)));
+ suite.AddTest (new TestSuite (typeof (SqlGuidTest)));
+ suite.AddTest (new TestSuite (typeof (SqlDecimalTest)));
+ suite.AddTest (new TestSuite (typeof (SqlStringTest)));
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog b/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog
new file mode 100755
index 00000000000..44efbde6f41
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog
@@ -0,0 +1,3 @@
+2002/11/08 Nick Drochak <ndrochak@gol.com>
+
+ * SqlSingleTest.cs : Remove debug statement that was breaking the build
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBinaryTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBinaryTest.cs
new file mode 100644
index 00000000000..605db9c8f46
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBinaryTest.cs
@@ -0,0 +1,275 @@
+//
+// SqlBinaryTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlBinary
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlBinaryTest : TestCase {
+
+ SqlBinary Test1;
+ SqlBinary Test2;
+ SqlBinary Test3;
+
+ public SqlBinaryTest() : base ("System.Data.SqlTypes.SqlBinary") {}
+ public SqlBinaryTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ byte [] b1 = new Byte [2];
+ byte [] b2 = new Byte [3];
+ byte [] b3 = new Byte [2];
+
+ b1 [0] = 240;
+ b1 [1] = 15;
+ b2 [0] = 10;
+ b2 [1] = 10;
+ b2 [2] = 10;
+ b3 [0] = 240;
+ b3 [1] = 15;
+
+ Test1 = new SqlBinary(b1);
+ Test2 = new SqlBinary(b2);
+ Test3 = new SqlBinary(b3);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlBinary));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ byte [] b = new byte [3];
+ SqlBinary Test = new SqlBinary (b);
+ Assert ("#A01", !(Test.IsNull));
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ Assert ("#B01", SqlBinary.Null.IsNull);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ byte [] b = new byte [2];
+ b [0] = 64;
+ b [1] = 128;
+
+ SqlBinary TestBinary = new SqlBinary (b);
+
+ // IsNull
+ Assert ("#C01", SqlBinary.Null.IsNull);
+
+ // Item
+ AssertEquals ("#C02", (byte)128, TestBinary [1]);
+ AssertEquals ("#C03", (byte)64, TestBinary [0]);
+
+ // FIXME: MSDN says that should throw SqlNullValueException
+ // but throws IndexOutOfRangeException
+ try {
+ byte test = TestBinary [TestBinary.Length];
+ Fail ("#C04");
+ } catch (Exception e) {
+ AssertEquals ("#C05", typeof (SqlNullValueException),
+ e.GetType ());
+ }
+
+ try {
+ byte test = SqlBinary.Null [2];
+ Fail ("#C06");
+ } catch (Exception e) {
+ AssertEquals ("#C07", typeof (SqlNullValueException),
+ e.GetType ());
+ }
+
+ // Length
+ AssertEquals ("#C08", 2, TestBinary.Length);
+
+ try {
+ int test = SqlBinary.Null.Length;
+ Fail ("#C09");
+ } catch (Exception e) {
+ AssertEquals ("#C10", typeof (SqlNullValueException),
+ e.GetType ());
+ }
+
+ // Value
+ AssertEquals ("#C11", (byte)128, TestBinary [1]);
+ AssertEquals ("#C12", (byte)64, TestBinary [0]);
+
+ try {
+ Byte [] test = SqlBinary.Null.Value;
+ Fail ("#C13");
+ } catch (Exception e) {
+ AssertEquals ("#C14", typeof (SqlNullValueException),
+ e.GetType ());
+ }
+ }
+
+ // Methods
+
+ public void TestComparisonMethods()
+ {
+ // GreaterThan
+ Assert ("#D01", SqlBinary.GreaterThan (Test1, Test2).Value);
+ Assert ("#D02", SqlBinary.GreaterThan (Test3, Test2).Value);
+ Assert ("#D03", !SqlBinary.GreaterThan (Test2, Test1).Value);
+
+ // GreaterThanOrEqual
+ Assert ("#D04", SqlBinary.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#D05", SqlBinary.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#D06", !SqlBinary.GreaterThanOrEqual (Test2, Test1).Value);
+
+ // LessThan
+ Assert ("#D07", !SqlBinary.LessThan (Test1, Test2).Value);
+ Assert ("#D08", !SqlBinary.LessThan (Test3, Test2).Value);
+ Assert ("#D09", SqlBinary.LessThan (Test2, Test1).Value);
+
+ // LessThanOrEqual
+ Assert ("#D10", !SqlBinary.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#D11", SqlBinary.LessThanOrEqual (Test3, Test1).Value);
+ Assert ("#D12", SqlBinary.LessThanOrEqual (Test2, Test1).Value);
+
+ // Equals
+ Assert ("#D13", !Test1.Equals (Test2));
+ Assert ("#D14", !Test3.Equals (Test2));
+ Assert ("#D15", Test3.Equals (Test1));
+
+ // NotEquals
+ Assert ("#D16", SqlBinary.NotEquals (Test1, Test2).Value);
+ Assert ("#D17", !SqlBinary.NotEquals (Test3, Test1).Value);
+ Assert ("#D18", SqlBinary.NotEquals (Test2, Test1).Value);
+ }
+
+
+ public void TestCompareTo()
+ {
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("#E01", Test1.CompareTo(Test2) > 0);
+ Assert ("#E02", Test2.CompareTo(Test1) < 0);
+ Assert ("#E03", Test1.CompareTo(Test3) == 0);
+
+ try {
+ Test1.CompareTo (TestString);
+ Fail ("#E04");
+ } catch(Exception e) {
+ AssertEquals ("#E05", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestGetHashCode()
+ {
+ AssertEquals ("#F01", Test1.GetHashCode (), Test1.GetHashCode ());
+ Assert ("#F02", Test2.GetHashCode () != Test1.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ AssertEquals("#G01", "System.Data.SqlTypes.SqlBinary",
+ Test1.GetType().ToString());
+ }
+
+ public void TestConcat()
+ {
+ SqlBinary TestBinary;
+
+ TestBinary = SqlBinary.Concat (Test2, Test3);
+ AssertEquals ("H01", (byte)15, TestBinary [4]);
+
+ TestBinary = SqlBinary.Concat (Test1, Test2);
+ AssertEquals ("#H02", (byte)240, TestBinary [0]);
+ AssertEquals ("#H03", (byte)15, TestBinary [1]);
+ }
+
+ public void TestToSqlGuid()
+ {
+ SqlBinary TestBinary = new SqlBinary (new byte [16]);
+ SqlGuid TestGuid = TestBinary.ToSqlGuid ();
+ Assert ("#I01", !TestGuid.IsNull);
+ }
+
+ public void TestToString()
+ {
+ AssertEquals ("#J01", "SqlBinary(3)", Test2.ToString ());
+ AssertEquals ("#J02", "SqlBinary(2)", Test1.ToString ());
+ }
+
+ // OPERATORS
+
+ public void TestAdditionOperator()
+ {
+ SqlBinary TestBinary = Test1 + Test2;
+ AssertEquals ("#K01", (byte)240, TestBinary [0]);
+ AssertEquals ("#K02", (byte)15, TestBinary [1]);
+ }
+
+ public void TestComparisonOperators()
+ {
+ // Equality
+ Assert ("#L01", !(Test1 == Test2).Value);
+ Assert ("#L02", (Test3 == Test1).Value);
+
+ // Greater than
+ Assert ("#L03", (Test1 > Test2).Value);
+ Assert ("#L04", !(Test3 > Test1).Value);
+
+ // Greater than or equal
+ Assert ("#L05", (Test1 >= Test2).Value);
+ Assert ("#L06", (Test3 >= Test2).Value);
+
+ // Inequality
+ Assert ("#L07", (Test1 != Test2).Value);
+ Assert ("#L08", !(Test3 != Test1).Value);
+
+ // Less than
+ Assert ("#L09", !(Test1 < Test2).Value);
+ Assert ("#L10", !(Test3 < Test2).Value);
+
+ // Less than or equal
+ Assert ("#L11", !(Test1 <= Test2).Value);
+ Assert ("#L12", (Test3 <= Test1).Value);
+ }
+
+ public void TestSqlBinaryToByteArray()
+ {
+ byte [] TestByteArray = (Byte[])Test1;
+ AssertEquals ("#M01", (byte)240, TestByteArray[0]);
+ }
+
+ public void TestSqlGuidToSqlBinary()
+ {
+ byte [] TestByteArray = new Byte [16];
+ TestByteArray [0] = 15;
+ TestByteArray [1] = 200;
+ SqlGuid TestGuid = new SqlGuid (TestByteArray);
+
+ SqlBinary TestBinary = (SqlBinary)TestGuid;
+ AssertEquals ("#N01", (byte)15, TestBinary [0]);
+ }
+
+ public void TestByteArrayToSqlBinary()
+ {
+ byte [] TestByteArray = new Byte [2];
+ TestByteArray [0] = 15;
+ TestByteArray [1] = 200;
+ SqlBinary TestBinary = (SqlBinary)TestByteArray;
+ AssertEquals ("#O1", (byte)15, TestBinary [0]);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBooleanTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBooleanTest.cs
new file mode 100644
index 00000000000..f209e19b783
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlBooleanTest.cs
@@ -0,0 +1,913 @@
+// SqlDataTimeTest.cs - NUnit Test Cases for [explain here]
+//
+// Ville Palo (vi64pa@users.sourceforge.net)
+//
+// (C) Ville Palo
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlBooleanTest : TestCase {
+
+ private SqlBoolean SqlTrue;
+ private SqlBoolean SqlFalse;
+
+ public SqlBooleanTest() : base ("System.Data.SqlTypes.SqlBoolean") {}
+ public SqlBooleanTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp() {
+ SqlTrue = new SqlBoolean(true);
+ SqlFalse = new SqlBoolean(false);
+
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlBoolean));
+ }
+ }
+
+ public void TestCreate ()
+ {
+ SqlBoolean SqlTrue2 = new SqlBoolean(1);
+ SqlBoolean SqlFalse2 = new SqlBoolean(0);
+
+ Assert("Creation of SqlBoolean failed", SqlTrue.Value);
+ Assert("Creation of SqlBoolean failed", SqlTrue2.Value);
+ Assert("Creation of SqlBoolean failed", !SqlFalse.Value);
+ Assert("Creation of SqlBoolean failed", !SqlFalse2.Value);
+
+ }
+
+ ////
+ // PUBLIC STATIC METHODS
+ //
+
+ // And
+ public void TestAnd() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ // One result value
+ SqlBoolean sqlResult;
+
+ // true && false
+ sqlResult = SqlBoolean.And(SqlTrue, SqlFalse);
+ Assert("And method does not work correctly (true && false)", !sqlResult.Value);
+ sqlResult = SqlBoolean.And(SqlFalse, SqlTrue);
+ Assert("And method does not work correctly (false && true)", !sqlResult.Value);
+
+ // true && true
+ sqlResult = SqlBoolean.And(SqlTrue, SqlTrue2);
+ Assert("And method does not work correctly (true && true)", sqlResult.Value);
+
+ sqlResult = SqlBoolean.And(SqlTrue, SqlTrue);
+ Assert("And method does not work correctly (true && true2)", sqlResult.Value);
+
+ // false && false
+ sqlResult = SqlBoolean.And(SqlFalse, SqlFalse2);
+ Assert("And method does not work correctly (false && false)", !sqlResult.Value);
+ sqlResult = SqlBoolean.And(SqlFalse, SqlFalse);
+ Assert("And method does not work correctly (false && false2)", !sqlResult.Value);
+
+ }
+
+ // NotEquals
+ public void TestNotEquals() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+
+ // true != false
+ SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlFalse);
+ Assert("NotEquals method does not work correctly (true != false)", SqlResult.Value);
+ SqlResult = SqlBoolean.NotEquals(SqlFalse, SqlTrue);
+ Assert("NotEquals method does not work correctly (false != true)", SqlResult.Value);
+
+
+ // true != true
+ SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlTrue);
+ Assert("NotEquals method does not work correctly (true != true)", !SqlResult.Value);
+ SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlTrue2);
+ Assert("NotEquals method does not work correctly (true != true2)", !SqlResult.Value);
+ // false != false
+ SqlResult = SqlBoolean.NotEquals(SqlFalse, SqlFalse);
+ Assert("NotEquals method does not work correctly (false != false)", !SqlResult.Value);
+ SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlTrue2);
+ Assert("NotEquals method does not work correctly (false != false2)", !SqlResult.Value);
+
+ // If either instance of SqlBoolean is null, the Value of the SqlBoolean will be Null.
+ SqlResult = SqlBoolean.NotEquals(SqlBoolean.Null, SqlFalse);
+ Assert("NotEquals method does not work correctly (Null != false)", SqlResult.IsNull);
+ SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlBoolean.Null);
+ Assert("NotEquals method does not work correctly (false != Null)", SqlResult.IsNull);
+
+ }
+
+ // OnesComplement
+ public void TestOnesComplement() {
+
+ SqlBoolean SqlFalse2 = SqlBoolean.OnesComplement(SqlTrue);
+ Assert("OnesComplement method does not work correctly", !SqlFalse2.Value);
+
+ SqlBoolean SqlTrue2 = SqlBoolean.OnesComplement(SqlFalse);
+ Assert("OnesComplement method does not work correctly", SqlTrue2.Value);
+
+ }
+
+ // Or
+ public void TestOr() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+
+ // true || false
+ SqlResult = SqlBoolean.Or(SqlTrue, SqlFalse);
+ Assert("Or method does not work correctly (true || false)", SqlResult.Value);
+ SqlResult = SqlBoolean.Or(SqlFalse, SqlTrue);
+ Assert("Or method does not work correctly (false || true)", SqlResult.Value);
+
+ // true || true
+ SqlResult = SqlBoolean.Or(SqlTrue, SqlTrue);
+ Assert("Or method does not work correctly (true || true)", SqlResult.Value);
+ SqlResult = SqlBoolean.Or(SqlTrue, SqlTrue2);
+ Assert("Or method does not work correctly (true || true2)", SqlResult.Value);
+
+ // false || false
+ SqlResult = SqlBoolean.Or(SqlFalse, SqlFalse);
+ Assert("Or method does not work correctly (false || false)", !SqlResult.Value);
+ SqlResult = SqlBoolean.Or(SqlFalse, SqlFalse2);
+ Assert("Or method does not work correctly (false || false2)", !SqlResult.Value);
+
+ }
+
+
+ // Parse
+ public void TestParse() {
+
+ String error = "Parse method does not work correctly ";
+
+ Assert(error + "(\"True\")", SqlBoolean.Parse("True").Value);
+ Assert(error + "(\" True\")", SqlBoolean.Parse(" True").Value);
+ Assert(error + "(\"True \")", SqlBoolean.Parse("True ").Value);
+ Assert(error + "(\"tRue\")", SqlBoolean.Parse("tRuE").Value);
+ Assert(error + "(\"False\")", !SqlBoolean.Parse("False").Value);
+ Assert(error + "(\" False\")", !SqlBoolean.Parse(" False").Value);
+ Assert(error + "(\"False \")", !SqlBoolean.Parse("False ").Value);
+ Assert(error + "(\"fAlSe\")", !SqlBoolean.Parse("fAlSe").Value);
+
+ }
+
+ // Xor
+ public void TestXor() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+
+ // true ^ false
+ SqlResult = SqlBoolean.Xor(SqlTrue, SqlFalse);
+ Assert("Xor method does not work correctly (true ^ false)", SqlResult.Value);
+ SqlResult = SqlBoolean.Xor(SqlFalse, SqlTrue);
+ Assert("Xor method does not work correctly (false ^ true)", SqlResult.Value);
+
+ // true ^ true
+ SqlResult = SqlBoolean.Xor(SqlTrue, SqlTrue2);
+ Assert("Xor method does not work correctly (true ^ true)", !SqlResult.Value);
+
+ // false ^ false
+ SqlResult = SqlBoolean.Xor(SqlFalse, SqlFalse2);
+ Assert("Xor method does not work correctly (false ^ false)", !SqlResult.Value);
+
+ }
+
+ // static Equals
+ public void TestStaticEquals() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+ String error = "Static Equals method does not work correctly ";
+
+ Assert(error + "(true == true)", SqlBoolean.Equals(SqlTrue, SqlTrue2).Value);
+ Assert(error + "(false == false)", SqlBoolean.Equals(SqlFalse, SqlFalse2).Value);
+
+ Assert(error + "(true == false)", !SqlBoolean.Equals(SqlTrue, SqlFalse).Value);
+ Assert(error + "(false == true)", !SqlBoolean.Equals(SqlFalse, SqlTrue).Value);
+
+ AssertEquals(error + "(null == false)", SqlBoolean.Null, SqlBoolean.Equals(SqlBoolean.Null, SqlFalse));
+ AssertEquals(error + "(true == null)", SqlBoolean.Null, SqlBoolean.Equals(SqlTrue, SqlBoolean.Null));
+
+ }
+
+ //
+ // END OF STATIC METHODS
+ ////
+
+ ////
+ // PUBLIC METHODS
+ //
+
+ // CompareTo
+ public void TestCompareTo() {
+
+ String error = "CompareTo method does not work correctly";
+
+ Assert(error, (SqlTrue.CompareTo(SqlBoolean.Null) > 0));
+ Assert(error, (SqlTrue.CompareTo(SqlFalse) > 0));
+ Assert(error, (SqlFalse.CompareTo(SqlTrue) < 0));
+ Assert(error, (SqlFalse.CompareTo(SqlFalse) == 0));
+
+ }
+
+ // Equals
+ public void TestEquals() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ String error = "Equals method does not work correctly ";
+
+ Assert(error + "(true == true)", SqlTrue.Equals(SqlTrue2));
+ Assert(error + "(false == false)", SqlFalse.Equals(SqlFalse2));
+
+ Assert(error + "(true == false)", !SqlTrue.Equals(SqlFalse));
+ Assert(error + "(false == true)", !SqlFalse.Equals(SqlTrue));
+
+ Assert(error + "(true == false)", !SqlTrue.Equals(null));
+
+ }
+
+ public void TestGetHashCode() {
+
+ AssertEquals("GetHashCode method does not work correctly",
+ 1, SqlTrue.GetHashCode());
+
+ AssertEquals("GetHashCode method does not work correctly",
+ 0, SqlFalse.GetHashCode());
+
+ }
+
+ // GetType
+ public void TestGetType() {
+
+ AssertEquals("GetType method does not work correctly",
+ SqlTrue.GetType().ToString(), "System.Data.SqlTypes.SqlBoolean");
+ }
+
+ // ToSqlByte
+ public void TestToSqlByte() {
+
+ SqlByte SqlTestByte;
+
+ String error = "ToSqlByte method does not work correctly ";
+
+ SqlTestByte = SqlTrue.ToSqlByte();
+ AssertEquals(error, (byte)1,SqlTestByte.Value);
+
+ SqlTestByte = SqlFalse.ToSqlByte();
+ AssertEquals(error, (byte)0, SqlTestByte.Value);
+
+ }
+
+ // ToSqlDecimal
+ public void TestToSqlDecimal() {
+
+ SqlDecimal SqlTestDecimal;
+
+ String error = "ToSqlDecimal method does not work correctly ";
+
+ SqlTestDecimal = SqlTrue.ToSqlDecimal();
+
+ AssertEquals(error, (decimal)1, SqlTestDecimal.Value);
+
+ SqlTestDecimal = SqlFalse.ToSqlDecimal();
+ AssertEquals(error, (decimal)0, SqlTestDecimal.Value);
+ }
+
+ // ToSqlDouble
+ public void TestToSqlDouble() {
+
+ SqlDouble SqlTestDouble;
+
+ String error = "ToSqlDouble method does not work correctly ";
+
+ SqlTestDouble = SqlTrue.ToSqlDouble();
+ AssertEquals(error, (double)1, SqlTestDouble.Value);
+
+ SqlTestDouble = SqlFalse.ToSqlDouble();
+ AssertEquals(error, (double)0, SqlTestDouble.Value);
+ }
+
+ // ToSqlInt16
+ public void TestToSqlInt16() {
+
+ SqlInt16 SqlTestInt16;
+
+ String error = "ToSqlInt16 method does not work correctly ";
+
+ SqlTestInt16 = SqlTrue.ToSqlInt16();
+ AssertEquals(error, (short)1, SqlTestInt16.Value);
+
+ SqlTestInt16 = SqlFalse.ToSqlInt16();
+ AssertEquals(error, (short)0, SqlTestInt16.Value);
+
+ }
+
+ // ToSqlInt32
+ public void TestToSqlInt32() {
+
+ SqlInt32 SqlTestInt32;
+
+ String error = "ToSqlInt32 method does not work correctly ";
+
+ SqlTestInt32 = SqlTrue.ToSqlInt32();
+ AssertEquals(error, (int)1, SqlTestInt32.Value);
+
+ SqlTestInt32 = SqlFalse.ToSqlInt32();
+ AssertEquals(error, (int)0, SqlTestInt32.Value);
+
+ }
+
+ // ToSqlInt64
+ public void TestToSqlInt64() {
+
+ SqlInt64 SqlTestInt64;
+
+ String error = "ToSqlInt64 method does not work correctly ";
+
+ SqlTestInt64 = SqlTrue.ToSqlInt64();
+ AssertEquals(error, (long)1, SqlTestInt64.Value);
+
+ SqlTestInt64 = SqlFalse.ToSqlInt64();
+ AssertEquals(error, (long)0, SqlTestInt64.Value);
+
+ }
+
+ // ToSqlMoney
+ public void TestToSqlMoney() {
+
+ SqlMoney SqlTestMoney;
+
+ String error = "ToSqlMoney method does not work correctly ";
+
+ SqlTestMoney = SqlTrue.ToSqlMoney();
+ AssertEquals(error, (decimal)1, SqlTestMoney.Value);
+
+ SqlTestMoney = SqlFalse.ToSqlMoney();
+ AssertEquals(error, (decimal)0, SqlTestMoney.Value);
+
+ }
+
+ // ToSqlSingle
+ public void TestToSqlsingle() {
+
+ SqlSingle SqlTestSingle;
+
+ String error = "ToSqlSingle method does not work correctly ";
+
+ SqlTestSingle = SqlTrue.ToSqlSingle();
+ AssertEquals(error, (float)1, SqlTestSingle.Value);
+
+ SqlTestSingle = SqlFalse.ToSqlSingle();
+ AssertEquals(error, (float)0, SqlTestSingle.Value);
+
+ }
+
+ // ToSqlString
+ public void TestToSqlString() {
+
+ SqlString SqlTestString;
+
+ String error = "ToSqlString method does not work correctly ";
+
+ SqlTestString = SqlTrue.ToSqlString();
+ AssertEquals(error, "True", SqlTestString.Value);
+
+ SqlTestString = SqlFalse.ToSqlString();
+ AssertEquals(error, "False", SqlTestString.Value);
+
+ }
+
+ // ToString
+ public void TestToString() {
+
+ SqlString TestString;
+
+ String error = "ToString method does not work correctly ";
+
+ TestString = SqlTrue.ToString();
+ AssertEquals(error, "True", TestString.Value);
+
+ TestString = SqlFalse.ToSqlString();
+ AssertEquals(error, "False", TestString.Value);
+
+ }
+
+ // END OF PUBLIC METHODS
+ ////
+
+ ////
+ // OPERATORS
+
+ // BitwixeAnd operator
+ public void TestBitwiseAndOperator() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+ String error = "BitwiseAnd operator does not work correctly ";
+
+ SqlResult = SqlTrue & SqlFalse;
+ Assert(error + "(true & false)", !SqlResult.Value);
+ SqlResult = SqlFalse & SqlTrue;
+ Assert(error + "(false & true)", !SqlResult.Value);
+
+ SqlResult = SqlTrue & SqlTrue2;
+ Assert(error + "(true & true)", SqlResult.Value);
+
+ SqlResult = SqlFalse & SqlFalse2;
+ Assert(error + "(false & false)", !SqlResult.Value);
+
+
+ }
+
+ // BitwixeOr operator
+ public void TestBitwiseOrOperator() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+ String error = "BitwiseOr operator does not work correctly ";
+
+ SqlResult = SqlTrue | SqlFalse;
+ Assert(error + "(true | false)", SqlResult.Value);
+ SqlResult = SqlFalse | SqlTrue;
+
+ Assert(error + "(false | true)", SqlResult.Value);
+
+ SqlResult = SqlTrue | SqlTrue2;
+ Assert(error + "(true | true)", SqlResult.Value);
+
+ SqlResult = SqlFalse | SqlFalse2;
+ Assert(error + "(false | false)", !SqlResult.Value);
+
+ }
+
+ // Equality operator
+ public void TestEqualityOperator() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+ String error = "Equality operator does not work correctly ";
+
+ SqlResult = SqlTrue == SqlFalse;
+ Assert(error + "(true == false)", !SqlResult.Value);
+ SqlResult = SqlFalse == SqlTrue;
+ Assert(error + "(false == true)", !SqlResult.Value);
+
+ SqlResult = SqlTrue == SqlTrue2;
+ Assert(error + "(true == true)", SqlResult.Value);
+
+ SqlResult = SqlFalse == SqlFalse2;
+ Assert(error + "(false == false)", SqlResult.Value);
+
+ SqlResult = SqlFalse == SqlBoolean.Null;
+ Assert(error + "(false == Null)", SqlResult.IsNull);
+ SqlResult = SqlBoolean.Null == SqlBoolean.Null;
+ Assert(error + "(Null == true)", SqlResult.IsNull);
+
+ }
+
+ // ExlusiveOr operator
+ public void TestExlusiveOrOperator() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ SqlBoolean SqlResult;
+ String error = "ExclusiveOr operator does not work correctly ";
+
+ SqlResult = SqlTrue ^ SqlFalse;
+ Assert(error + "(true ^ false)", SqlResult.Value);
+ SqlResult = SqlFalse | SqlTrue;
+ Assert(error + "(false ^ true)", SqlResult.Value);
+
+ SqlResult = SqlTrue ^ SqlTrue2;
+ Assert(error + "(true ^ true)", !SqlResult.Value);
+
+ SqlResult = SqlFalse ^ SqlFalse2;
+ Assert(error + "(false ^ false)", !SqlResult.Value);
+
+ }
+
+ // false operator
+ public void TestFalseOperator() {
+
+ String error = "false operator does not work correctly ";
+
+ AssertEquals(error + "(true)", SqlBoolean.False, (!SqlTrue));
+ AssertEquals(error + "(false)", SqlBoolean.True, (!SqlFalse));
+
+ }
+
+ // Inequality operator
+ public void TestInequalityOperator() {
+
+ SqlBoolean SqlTrue2 = new SqlBoolean(true);
+ SqlBoolean SqlFalse2 = new SqlBoolean(false);
+
+ String error = "Inequality operator does not work correctly" ;
+
+ AssertEquals(error + "(true != true)", SqlBoolean.False, SqlTrue != SqlTrue);
+ AssertEquals(error + "(true != true)", SqlBoolean.False, SqlTrue != SqlTrue2);
+ AssertEquals(error + "(false != false)", SqlBoolean.False, SqlFalse != SqlFalse);
+ AssertEquals(error + "(false != false)", SqlBoolean.False, SqlFalse != SqlFalse2);
+ AssertEquals(error + "(true != false)", SqlBoolean.True, SqlTrue != SqlFalse);
+ AssertEquals(error + "(false != true)", SqlBoolean.True, SqlFalse != SqlTrue);
+ AssertEquals(error + "(null != true)", SqlBoolean.Null, SqlBoolean.Null != SqlTrue);
+ AssertEquals(error + "(false != null)", SqlBoolean.Null, SqlFalse != SqlBoolean.Null);
+
+ }
+
+ // Logical Not operator
+ public void TestLogicalNotOperator() {
+
+ String error = "Logical Not operator does not work correctly" ;
+
+ AssertEquals(error + "(true)", SqlBoolean.False, !SqlTrue);
+ AssertEquals(error + "(false)", SqlBoolean.True, !SqlFalse);
+
+ }
+
+ // OnesComplement operator
+ public void TestOnesComplementOperator() {
+
+ String error = "Ones complement operator does not work correctly" ;
+
+ SqlBoolean SqlResult;
+
+ SqlResult = ~SqlTrue;
+ Assert(error + "(true)", !SqlResult.Value);
+ SqlResult = ~SqlFalse;
+ Assert(error + "(false)", SqlResult.Value);
+
+ }
+
+
+ // true operator
+ public void TestTrueOperator() {
+
+ String error = "true operator does not work correctly ";
+
+ AssertEquals(error + "(true)", SqlBoolean.True, (SqlTrue));
+ AssertEquals(error + "(false)", SqlBoolean.False, (SqlFalse));
+
+ }
+
+ // SqlBoolean to Boolean
+ public void TestSqlBooleanToBoolean() {
+
+ String error = "SqlBooleanToBoolean operator does not work correctly ";
+
+ Boolean TestBoolean = (Boolean)SqlTrue;
+ Assert(error + "(true)", TestBoolean);
+ TestBoolean = (Boolean)SqlFalse;
+ Assert(error + "(false)", !TestBoolean);
+
+ }
+
+ // SqlByte to SqlBoolean
+ public void TestSqlByteToSqlBoolean() {
+
+ SqlByte SqlTestByte;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlByteToSqlBoolean operator does not work correctly ";
+
+ SqlTestByte = new SqlByte(1);
+ SqlTestBoolean = (SqlBoolean)SqlTestByte;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTestByte = new SqlByte(2);
+ SqlTestBoolean = (SqlBoolean)SqlTestByte;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTestByte = new SqlByte(0);
+ SqlTestBoolean = (SqlBoolean)SqlTestByte;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlDecimal to SqlBoolean
+ public void TestSqlDecimalToSqlBoolean() {
+
+ SqlDecimal SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlDecimalToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlDecimal(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlDecimal(19);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlDecimal(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlDouble to SqlBoolean
+ public void TestSqlDoubleToSqlBoolean() {
+
+ SqlDouble SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlDoubleToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlDouble(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlDouble(-19.8);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlDouble(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlIn16 to SqlBoolean
+ public void TestSqlInt16ToSqlBoolean() {
+
+ SqlInt16 SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlInt16ToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlInt16(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlInt16(-143);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlInt16(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlInt32 to SqlBoolean
+ public void TestSqlInt32ToSqlBoolean() {
+
+ SqlInt32 SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlInt32ToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlInt32(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlInt32(1430);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlInt32(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+ }
+
+ // SqlInt64 to SqlBoolean
+ public void TestSqlInt64ToSqlBoolean() {
+
+ SqlInt64 SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlInt64ToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlInt64(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlInt64(-14305);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlInt64(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlMoney to SqlBoolean
+ public void TestSqlMoneyToSqlBoolean() {
+
+ SqlMoney SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlMoneyToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlMoney(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlMoney(1305);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlMoney(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlSingle to SqlBoolean
+ public void TestSqlSingleToSqlBoolean() {
+
+ SqlSingle SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlSingleToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlSingle(1);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlSingle(1305);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlSingle(-305.3);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlSingle(0);
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // SqlString to SqlBoolean
+ public void TestSqlStringToSqlBoolean() {
+
+ SqlString SqlTest;
+ SqlBoolean SqlTestBoolean;
+ String error = "SqlSingleToSqlBoolean operator does not work correctly ";
+
+ SqlTest = new SqlString("true");
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlString("TRUE");
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlString("True");
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+ SqlTest = new SqlString("false");
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // Boolean to SqlBoolean
+ public void BooleanToSqlBoolean() {
+
+ SqlBoolean SqlTestBoolean;
+ bool btrue = true;
+ bool bfalse = false;
+ String error = "BooleanToSqlBoolean operator does not work correctly ";
+
+ Boolean SqlTest = true;
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+ SqlTestBoolean = (SqlBoolean)btrue;
+ Assert(error + "(true)", SqlTestBoolean.Value);
+
+
+ SqlTest = false;
+ SqlTestBoolean = (SqlBoolean)SqlTest;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+ SqlTestBoolean = (SqlBoolean)bfalse;
+ Assert(error + "(false)", !SqlTestBoolean.Value);
+
+ }
+
+ // END OF OPERATORS
+ ////
+
+ ////
+ // PROPERTIES
+
+ // ByteValue property
+ public void TestByteValueProperty() {
+
+ String error = "ByteValue property does not work correctly ";
+
+ AssertEquals(error + "(true)", (byte)1, SqlTrue.ByteValue);
+ AssertEquals(error + "(false)", (byte)0, SqlFalse.ByteValue);
+
+ }
+
+ // IsFalse property
+ public void TestIsFalseProperty() {
+
+ String error = "IsFalse property does not work correctly ";
+
+ Assert(error + "(true)", !SqlTrue.IsFalse);
+ Assert(error + "(false)", SqlFalse.IsFalse);
+
+ }
+
+ // IsNull property
+ public void TestIsNullProperty() {
+
+ String error = "IsNull property does not work correctly ";
+
+ Assert(error + "(true)", !SqlTrue.IsNull);
+ Assert(error + "(false)", !SqlFalse.IsNull);
+ Assert(error + "(Null)", SqlBoolean.Null.IsNull);
+
+ }
+
+ // IsTrue property
+ public void TestIsTrueProperty() {
+
+ String error = "IsTrue property does not work correctly ";
+
+ Assert(error + "(true)", SqlTrue.IsTrue);
+ Assert(error + "(false)", !SqlFalse.IsTrue);
+
+ }
+
+ // Value property
+ public void TestValueProperty() {
+
+ String error = "Value property does not work correctly ";
+
+ Assert(error + "(true)", SqlTrue.Value);
+ Assert(error + "(false)", !SqlFalse.Value);
+
+ }
+
+ // END OF PROPERTIEs
+ ////
+
+ ////
+ // FIELDS
+
+ public void TestFalseField() {
+
+ Assert("False field does not work correctly",
+ !SqlBoolean.False.Value);
+
+ }
+
+ public void TestNullField() {
+
+ Assert("Null field does not work correctly",
+ SqlBoolean.Null.IsNull);
+
+ }
+
+ public void TestOneField() {
+
+ AssertEquals("One field does not work correctly",
+ (byte)1, SqlBoolean.One.ByteValue);
+ }
+
+
+ public void TestTrueField() {
+
+ Assert("True field does not work correctly",
+ SqlBoolean.True.Value);
+
+ }
+
+ public void TestZeroField() {
+
+ AssertEquals("Zero field does not work correctly",
+ (byte)0, SqlBoolean.Zero.ByteValue);
+
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlByteTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlByteTest.cs
new file mode 100644
index 00000000000..8e4f4cfee28
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlByteTest.cs
@@ -0,0 +1,908 @@
+//
+// SqlByteTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlByte
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlByteTest : TestCase {
+
+ private const string Error = " does not work correctly";
+
+ public SqlByteTest() : base ("System.Data.SqlTypes.SqlByte") {}
+ public SqlByteTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp() {
+
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlString));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ byte b = 29;
+ SqlByte TestByte = new SqlByte(b);
+ AssertEquals("Constructor 1 does not work correctly", (byte)29, TestByte.Value);
+
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+
+ AssertEquals("MaxValue field" + Error, (SqlByte)255, SqlByte.MaxValue);
+ AssertEquals("MinValue field" + Error, (SqlByte)0, SqlByte.MinValue);
+ Assert("Null field" + Error, SqlByte.Null.IsNull);
+ AssertEquals("Zero field" + Error, (byte)0, SqlByte.Zero.Value);
+
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+
+ SqlByte TestByte = new SqlByte(54);
+ SqlByte TestByte2 = new SqlByte(1);
+
+ Assert("IsNull property" + Error, SqlByte.Null.IsNull);
+ AssertEquals("Value property 1" + Error, (byte)54, TestByte.Value);
+ AssertEquals("Value property 2" + Error, (byte)1, TestByte2.Value);
+
+ }
+
+ // PUBLIC STATIC METHODS
+
+ public void TestAddMethod()
+ {
+
+ SqlByte TestByte64 = new SqlByte(64);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte164 = new SqlByte(164);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("AddMethod 1" + Error, (byte)64, SqlByte.Add(TestByte64, TestByte0).Value);
+ AssertEquals("AddMethod 2" + Error, (byte)228, SqlByte.Add(TestByte64, TestByte164).Value);
+ AssertEquals("AddMethod 3" + Error, (byte)164, SqlByte.Add(TestByte0, TestByte164).Value);
+ AssertEquals("AddMethod 4" + Error, (byte)255, SqlByte.Add(TestByte255, TestByte0).Value);
+
+ try {
+ SqlByte.Add(TestByte255, TestByte64);
+ Fail ("AddMethod 6" + Error);
+ } catch (Exception e) {
+ AssertEquals("AddMethod 5" + Error, typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestBitwiseAndMethod()
+ {
+
+ SqlByte TestByte2 = new SqlByte(2);
+ SqlByte TestByte1 = new SqlByte(1);
+ SqlByte TestByte62 = new SqlByte(62);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("BitwiseAnd method 1" + Error,
+ (byte)0, SqlByte.BitwiseAnd(TestByte2, TestByte1).Value);
+ AssertEquals("BitwiseAnd method 2" + Error,
+ (byte)0, SqlByte.BitwiseAnd(TestByte1, TestByte62).Value);
+ AssertEquals("BitwiseAnd method 3" + Error,
+ (byte)2, SqlByte.BitwiseAnd(TestByte62, TestByte2).Value);
+ AssertEquals("BitwiseAnd method 4" + Error,
+ (byte)1, SqlByte.BitwiseAnd(TestByte1, TestByte255).Value);
+ AssertEquals("BitwiseAnd method 5" + Error,
+ (byte)62, SqlByte.BitwiseAnd(TestByte62, TestByte255).Value);
+
+ }
+
+ public void TestBitwiseOrMethod()
+ {
+
+ SqlByte TestByte2 = new SqlByte(2);
+ SqlByte TestByte1 = new SqlByte(1);
+ SqlByte TestByte62 = new SqlByte(62);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("BitwiseOr method 1" + Error,
+ (byte)3, SqlByte.BitwiseOr(TestByte2, TestByte1).Value);
+ AssertEquals("BitwiseOr method 2" + Error,
+ (byte)63, SqlByte.BitwiseOr(TestByte1, TestByte62).Value);
+ AssertEquals("BitwiseOr method 3" + Error,
+ (byte)62, SqlByte.BitwiseOr(TestByte62, TestByte2).Value);
+ AssertEquals("BitwiseOr method 4" + Error,
+ (byte)255, SqlByte.BitwiseOr(TestByte1, TestByte255).Value);
+ AssertEquals("BitwiseOr method 5" + Error,
+ (byte)255, SqlByte.BitwiseOr(TestByte62, TestByte255).Value);
+
+ }
+
+
+ public void TestCompareTo()
+ {
+
+ SqlByte TestByte13 = new SqlByte(13);
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte10II = new SqlByte(10);
+
+ SqlString TestString = new SqlString("This is a test");
+
+ Assert("CompareTo method 1" + Error, TestByte13.CompareTo(TestByte10) > 0);
+ Assert("CompareTo method 2" + Error, TestByte10.CompareTo(TestByte13) < 0);
+ Assert("CompareTo method 3" + Error, TestByte10.CompareTo(TestByte10II) == 0);
+
+ try {
+ TestByte13.CompareTo(TestString);
+ Fail("CompareTo method 4" + Error);
+ } catch(Exception e) {
+ AssertEquals("Parse method 5" + Error, typeof(ArgumentException), e.GetType());
+ }
+
+ }
+
+ public void TestDivideMethod()
+ {
+
+ SqlByte TestByte13 = new SqlByte(13);
+ SqlByte TestByte0 = new SqlByte(0);
+
+ SqlByte TestByte2 = new SqlByte(2);
+ SqlByte TestByte180 = new SqlByte(180);
+ SqlByte TestByte3 = new SqlByte(3);
+
+ AssertEquals("Divide method 1" + Error,
+ (byte)6, SqlByte.Divide(TestByte13, TestByte2).Value);
+ AssertEquals("Divide method 2" + Error,
+ (byte)90, SqlByte.Divide(TestByte180, TestByte2).Value);
+ AssertEquals("Divide method 3" + Error,
+ (byte)60, SqlByte.Divide(TestByte180, TestByte3).Value);
+ AssertEquals("Divide method 4" + Error,
+ (byte)0, SqlByte.Divide(TestByte13, TestByte180).Value);
+ AssertEquals("Divide method 5" + Error,
+ (byte)0, SqlByte.Divide(TestByte13, TestByte180).Value);
+
+ try {
+ SqlByte.Divide(TestByte13, TestByte0);
+ Fail ("Divide method 6" + Error);
+ } catch(Exception e) {
+ AssertEquals("DivideByZeroException", typeof(DivideByZeroException), e.GetType());
+
+ }
+
+ }
+
+ public void TestEqualsMethod()
+ {
+
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte158 = new SqlByte(158);
+ SqlByte TestByte180 = new SqlByte(180);
+ SqlByte TestByte180II = new SqlByte(180);
+
+ Assert("Equals method 1" + Error, !TestByte0.Equals(TestByte158));
+ Assert("Equals method 2" + Error, !TestByte158.Equals(TestByte180));
+ Assert("Equals method 3" + Error, !TestByte180.Equals(new SqlString("TEST")));
+ Assert("Equals method 4" + Error, TestByte180.Equals(TestByte180II));
+
+ }
+
+ public void TestStaticEqualsMethod()
+ {
+
+ SqlByte TestByte34 = new SqlByte(34);
+ SqlByte TestByte34II = new SqlByte(34);
+ SqlByte TestByte15 = new SqlByte(15);
+
+ Assert("static Equals method 1" + Error, SqlByte.Equals(TestByte34, TestByte34II).Value);
+ Assert("static Equals method 2" + Error, !SqlByte.Equals(TestByte34, TestByte15).Value);
+ Assert("static Equals method 3" + Error, !SqlByte.Equals(TestByte15, TestByte34II).Value);
+
+ }
+
+ public void TestGetHashCode()
+ {
+
+ SqlByte TestByte15 = new SqlByte(15);
+ SqlByte TestByte216 = new SqlByte(216);
+
+ AssertEquals("GetHashCode method 1" + Error, 15, TestByte15.GetHashCode());
+ AssertEquals("GetHashCode method 2" + Error, 216, TestByte216.GetHashCode());
+
+ }
+
+ public void TestGetType()
+ {
+
+ SqlByte TestByte = new SqlByte(84);
+
+ AssertEquals("GetType method" + Error,
+ "System.Data.SqlTypes.SqlByte", TestByte.GetType().ToString());
+
+ }
+
+ public void TestGreaterThan()
+ {
+
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte10II = new SqlByte(10);
+ SqlByte TestByte110 = new SqlByte(110);
+
+ Assert("GreaterThan method 1" + Error, !SqlByte.GreaterThan(TestByte10, TestByte110).Value);
+ Assert("GreaterThan method 2" + Error, SqlByte.GreaterThan(TestByte110, TestByte10).Value);
+ Assert("GreaterThan method 3" + Error, !SqlByte.GreaterThan(TestByte10II, TestByte10).Value);
+
+ }
+
+ public void TestGreaterThanOrEqual()
+ {
+
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte10II = new SqlByte(10);
+ SqlByte TestByte110 = new SqlByte(110);
+
+ Assert("GreaterThanOrEqual method 1" + Error,
+ !SqlByte.GreaterThanOrEqual(TestByte10, TestByte110).Value);
+
+ Assert("GreaterThanOrEqual method 2" + Error,
+ SqlByte.GreaterThanOrEqual(TestByte110, TestByte10).Value);
+
+ Assert("GreaterThanOrEqual method 3" + Error,
+ SqlByte.GreaterThanOrEqual(TestByte10II, TestByte10).Value);
+
+ }
+
+ public void TestLessThan()
+ {
+
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte10II = new SqlByte(10);
+ SqlByte TestByte110 = new SqlByte(110);
+
+ Assert("LessThan method 1" + Error,
+ SqlByte.LessThan(TestByte10, TestByte110).Value);
+
+ Assert("LessThan method 2" + Error,
+ !SqlByte.LessThan(TestByte110, TestByte10).Value);
+
+ Assert("LessThan method 3" + Error,
+ !SqlByte.LessThan(TestByte10II, TestByte10).Value);
+
+ }
+
+ public void TestLessThanOrEqual()
+ {
+
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte10II = new SqlByte(10);
+ SqlByte TestByte110 = new SqlByte(110);
+
+ Assert("LessThanOrEqual method 1" + Error,
+ SqlByte.LessThanOrEqual(TestByte10, TestByte110).Value);
+
+ Assert("LessThanOrEqual method 2" + Error,
+ !SqlByte.LessThanOrEqual(TestByte110, TestByte10).Value);
+
+ Assert("LessThanOrEqual method 3" + Error,
+ SqlByte.LessThanOrEqual(TestByte10II, TestByte10).Value);
+
+ Assert("LessThanOrEqual method 4" + Error,
+ SqlByte.LessThanOrEqual(TestByte10II, SqlByte.Null).IsNull);
+ }
+
+ public void TestMod()
+ {
+
+ SqlByte TestByte132 = new SqlByte(132);
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte200 = new SqlByte(200);
+
+ AssertEquals("Mod method 1" + Error, (SqlByte)2, SqlByte.Mod(TestByte132, TestByte10));
+ AssertEquals("Mod method 2" + Error, (SqlByte)10, SqlByte.Mod(TestByte10, TestByte200));
+ AssertEquals("Mod method 3" + Error, (SqlByte)0, SqlByte.Mod(TestByte200, TestByte10));
+ AssertEquals("Mod method 4" + Error, (SqlByte)68, SqlByte.Mod(TestByte200, TestByte132));
+
+ }
+
+ public void TestMultiply()
+ {
+
+ SqlByte TestByte12 = new SqlByte (12);
+ SqlByte TestByte2 = new SqlByte (2);
+ SqlByte TestByte128 = new SqlByte (128);
+
+ AssertEquals ("Multiply method 1" + Error,
+ (byte)24, SqlByte.Multiply(TestByte12, TestByte2).Value);
+ AssertEquals ("Multiply method 2" + Error,
+ (byte)24, SqlByte.Multiply(TestByte2, TestByte12).Value);
+
+ try {
+ SqlByte.Multiply(TestByte128, TestByte2);
+ Fail ("Multiply method 3");
+ } catch(Exception e) {
+
+ AssertEquals("OverflowException" + Error, typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestNotEquals()
+ {
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte128 = new SqlByte(128);
+ SqlByte TestByte128II = new SqlByte(128);
+
+ Assert("NotEquals method 1" + Error, SqlByte.NotEquals(TestByte12, TestByte128).Value);
+ Assert("NotEquals method 2" + Error, SqlByte.NotEquals(TestByte128, TestByte12).Value);
+ Assert("NotEquals method 3" + Error, SqlByte.NotEquals(TestByte128II, TestByte12).Value);
+ Assert("NotEquals method 4" + Error, !SqlByte.NotEquals(TestByte128II, TestByte128).Value);
+ Assert("NotEquals method 5" + Error, !SqlByte.NotEquals(TestByte128, TestByte128II).Value);
+
+ }
+
+ public void TestOnesComplement()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte128 = new SqlByte(128);
+
+ AssertEquals("OnesComplement method 1" + Error,
+ (SqlByte)243, SqlByte.OnesComplement(TestByte12));
+ AssertEquals("OnesComplement method 2" + Error,
+ (SqlByte)127, SqlByte.OnesComplement(TestByte128));
+
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlByte.Parse(null);
+ Fail("Parse method 2" + Error);
+ }
+ catch (Exception e) {
+ AssertEquals("Parse method 3" + Error, typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ SqlByte.Parse("not-a-number");
+ Fail("Parse method 4" + Error);
+ }
+ catch (Exception e) {
+ AssertEquals("Parse method 5" + Error, typeof(FormatException), e.GetType());
+ }
+
+ try {
+ int OverInt = (int)SqlByte.MaxValue + 1;
+ SqlByte.Parse(OverInt.ToString());
+ Fail("Parse method 6" + Error);
+ }
+ catch (Exception e) {
+ AssertEquals("Parse method 7" + Error, typeof(OverflowException), e.GetType());
+ }
+
+ AssertEquals("Parse method 8" + Error, (byte)150, SqlByte.Parse("150").Value);
+
+ }
+
+ public void TestSubtract()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte128 = new SqlByte(128);
+ AssertEquals("Subtract method 1" + Error, (byte)116, SqlByte.Subtract(TestByte128, TestByte12).Value);
+
+ try {
+ SqlByte.Subtract(TestByte12, TestByte128);
+ } catch(Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestToSqlBoolean()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByteNull = SqlByte.Null;
+
+ Assert("ToSqlBoolean method 1" + Error, TestByte12.ToSqlBoolean().Value);
+ Assert("ToSqlBoolean method 2" + Error, !TestByte0.ToSqlBoolean().Value);
+ Assert("ToSqlBoolean method 3" + Error, TestByteNull.ToSqlBoolean().IsNull);
+ }
+
+ public void TestToSqlDecimal()
+ {
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqlDecimal method 1" + Error,
+ (decimal)12, TestByte12.ToSqlDecimal().Value);
+ AssertEquals("ToSqlDecimal method 2" + Error,
+ (decimal)0, TestByte0.ToSqlDecimal().Value);
+ AssertEquals("ToSqlDecimal method 3" + Error,
+ (decimal)228, TestByte228.ToSqlDecimal().Value);
+
+ }
+
+ public void TestToSqlDouble()
+ {
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqlDouble method 1" + Error,
+ (double)12, TestByte12.ToSqlDouble().Value);
+ AssertEquals("ToSqlDouble method 2" + Error,
+ (double)0, TestByte0.ToSqlDouble().Value);
+ AssertEquals("ToSqlDouble method 3" + Error,
+ (double)228, TestByte228.ToSqlDouble().Value);
+
+ }
+
+ public void TestToSqlInt16()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqInt16 method 1" + Error,
+ (short)12, TestByte12.ToSqlInt16().Value);
+ AssertEquals("ToSqlInt16 method 2" + Error,
+ (short)0, TestByte0.ToSqlInt16().Value);
+ AssertEquals("ToSqlInt16 method 3" + Error,
+ (short)228, TestByte228.ToSqlInt16().Value);
+ }
+
+ public void TestToSqlInt32()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqInt32 method 1" + Error,
+ (int)12, TestByte12.ToSqlInt32().Value);
+ AssertEquals("ToSqlInt32 method 2" + Error,
+ (int)0, TestByte0.ToSqlInt32().Value);
+ AssertEquals("ToSqlInt32 method 3" + Error,
+ (int)228, TestByte228.ToSqlInt32().Value);
+
+ }
+
+ public void TestToSqlInt64()
+ {
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqInt64 method " + Error,
+ (long)12, TestByte12.ToSqlInt64().Value);
+ AssertEquals("ToSqlInt64 method 2" + Error,
+ (long)0, TestByte0.ToSqlInt64().Value);
+ AssertEquals("ToSqlInt64 method 3" + Error,
+ (long)228, TestByte228.ToSqlInt64().Value);
+
+ }
+
+ public void TestToSqlMoney()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqMoney method 1" + Error,
+ (decimal)12, TestByte12.ToSqlMoney().Value);
+ AssertEquals("ToSqlMoney method 2" + Error,
+ (decimal)0, TestByte0.ToSqlMoney().Value);
+ AssertEquals("ToSqlMoney method 3" + Error,
+ (decimal)228, TestByte228.ToSqlMoney().Value);
+ }
+
+ public void TestToSqlSingle()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqlSingle method 1" + Error,
+ (float)12, TestByte12.ToSqlSingle().Value);
+ AssertEquals("ToSqlSingle method 2" + Error,
+ (float)0, TestByte0.ToSqlSingle().Value);
+ AssertEquals("ToSqlSingle method 3" + Error,
+ (float)228, TestByte228.ToSqlSingle().Value);
+
+ }
+
+ public void TestToSqlString()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToSqlString method 1" + Error,
+ "12", TestByte12.ToSqlString().Value);
+ AssertEquals("ToSqlString method 2" + Error,
+ "0", TestByte0.ToSqlString().Value);
+ AssertEquals("ToSqlString method 3" + Error,
+ "228", TestByte228.ToSqlString().Value);
+
+ }
+
+ public void TestToString()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte0 = new SqlByte(0);
+ SqlByte TestByte228 = new SqlByte(228);
+
+ AssertEquals("ToString method 1" + Error,
+ "12", TestByte12.ToString());
+ AssertEquals("ToString method 2" + Error,
+ "0", TestByte0.ToString());
+ AssertEquals("ToString method 3" + Error,
+ "228", TestByte228.ToString());
+ }
+
+ public void TestXor()
+ {
+
+ SqlByte TestByte14 = new SqlByte(14);
+ SqlByte TestByte58 = new SqlByte(58);
+ SqlByte TestByte130 = new SqlByte(130);
+
+ AssertEquals("Xor method 1" + Error, (byte)52, SqlByte.Xor(TestByte14, TestByte58).Value);
+ AssertEquals("Xor method 2" + Error, (byte)140, SqlByte.Xor(TestByte14, TestByte130).Value);
+ AssertEquals("Xor method 3" + Error, (byte)184, SqlByte.Xor(TestByte58, TestByte130).Value);
+
+ }
+
+ // OPERATORS
+
+ public void TestAdditionOperator()
+ {
+
+ SqlByte TestByte24 = new SqlByte(24);
+ SqlByte TestByte64 = new SqlByte(64);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("Addition operator" + Error, (SqlByte)88,TestByte24 + TestByte64);
+
+ try {
+ SqlByte result = TestByte64 + TestByte255;
+ Fail("Addition operator 1" + Error);
+ } catch (Exception e) {
+ AssertEquals("Addition operator 2" + Error, typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestBitwiseAndOperator()
+ {
+
+ SqlByte TestByte2 = new SqlByte(2);
+ SqlByte TestByte4 = new SqlByte(4);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("Bitwise and operator 1" + Error, (SqlByte)0,TestByte2 & TestByte4);
+ AssertEquals("Bitwise and operaror 2" + Error, (SqlByte)2, TestByte2 & TestByte255);
+ }
+
+ public void TestBitwiseOrOperator()
+ {
+
+ SqlByte TestByte2 = new SqlByte(2);
+ SqlByte TestByte4 = new SqlByte(4);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("Bitwise or operator 1" + Error, (SqlByte)6,TestByte2 | TestByte4);
+ AssertEquals("Bitwise or operaror 2" + Error, (SqlByte)255, TestByte2 | TestByte255);
+ }
+
+ public void TestDivisionOperator()
+ {
+
+ SqlByte TestByte2 = new SqlByte(2);
+ SqlByte TestByte4 = new SqlByte(4);
+ SqlByte TestByte255 = new SqlByte(255);
+ SqlByte TestByte0 = new SqlByte(0);
+
+ AssertEquals("Division operator 1" + Error, (SqlByte)2,TestByte4 / TestByte2);
+ AssertEquals("Division operaror 2" + Error, (SqlByte)127, TestByte255 / TestByte2);
+
+ try {
+ TestByte2 = TestByte255 / TestByte0;
+ Fail("Division operator 3" + Error);
+ } catch (Exception e) {
+ AssertEquals("DivideByZeroException", typeof(DivideByZeroException), e.GetType());
+ }
+
+ }
+
+ public void TestEqualityOperator()
+ {
+
+ SqlByte TestByte15 = new SqlByte(15);
+ SqlByte TestByte15II = new SqlByte(15);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ Assert("== operator" + Error, (TestByte15 == TestByte15II).Value);
+ Assert("== operator 2" + Error, !(TestByte15 == TestByte255).Value);
+ Assert("!= operator" + Error, !(TestByte15 != TestByte15II).Value);
+ Assert("!= operator 2" + Error, (TestByte15 != TestByte255).Value);
+
+ }
+
+ public void TestExclusiveOrOperator()
+ {
+
+ SqlByte TestByte15 = new SqlByte(15);
+ SqlByte TestByte10 = new SqlByte(10);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ AssertEquals("Exclusive or operator 1" + Error, (SqlByte)5, (TestByte15 ^ TestByte10));
+ AssertEquals("Exclusive or operator 2" + Error, (SqlByte)240, (TestByte15 ^ TestByte255));
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+
+ SqlByte TestByte165 = new SqlByte(165);
+ SqlByte TestByte100 = new SqlByte(100);
+ SqlByte TestByte100II = new SqlByte(100);
+ SqlByte TestByte255 = new SqlByte(255);
+
+ Assert("> operator 1" + Error, (TestByte165 > TestByte100).Value);
+ Assert("> operator 2" + Error, !(TestByte165 > TestByte255).Value);
+ Assert("> operator 3" + Error, !(TestByte100 > TestByte100II).Value);
+ Assert(">= operator 1" + Error, !(TestByte165 >= TestByte255).Value);
+ Assert(">= operator 2" + Error, (TestByte255 >= TestByte165).Value);
+ Assert(">= operator 3" + Error, (TestByte100 >= TestByte100II).Value);
+
+ Assert("< operator 1" + Error, !(TestByte165 < TestByte100).Value);
+ Assert("< operator 2" + Error, (TestByte165 < TestByte255).Value);
+ Assert("< operator 3" + Error, !(TestByte100 < TestByte100II).Value);
+ Assert("<= operator 1" + Error, (TestByte165 <= TestByte255).Value);
+ Assert("<= operator 2" + Error, !(TestByte255 <= TestByte165).Value);
+ Assert("<= operator 3" + Error, (TestByte100 <= TestByte100II).Value);
+ }
+
+
+ public void TestMultiplicationOperator()
+ {
+
+ SqlByte TestByte4 = new SqlByte(4);
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte128 = new SqlByte(128);
+
+ AssertEquals("Multiplication operator 1" + Error, (SqlByte)48, TestByte4 * TestByte12);
+ try {
+ SqlByte test = (TestByte128 * TestByte4);
+ Fail("Multiplication operator 2" + Error);
+ } catch (Exception e) {
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestOnesComplementOperator()
+ {
+
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte128 = new SqlByte(128);
+
+ AssertEquals("OnesComplement operator 1" + Error,
+ (SqlByte)243, ~TestByte12);
+ AssertEquals("OnesComplement operator 2" + Error,
+ (SqlByte)127, ~TestByte128);
+
+ }
+
+ public void TestSubtractionOperator()
+ {
+
+ SqlByte TestByte4 = new SqlByte(4);
+ SqlByte TestByte12 = new SqlByte(12);
+ SqlByte TestByte128 = new SqlByte(128);
+
+ AssertEquals("Subtraction operator 1" + Error, (SqlByte)8, TestByte12 - TestByte4);
+ try {
+
+ SqlByte test = TestByte4 - TestByte128;
+ Fail("Sybtraction operator 2" + Error);
+
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlBooleanToSqlByte()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean(true);
+ SqlByte TestByte;
+
+ TestByte = (SqlByte)TestBoolean;
+
+ AssertEquals("SqlBooleanToSqlByte op" + Error,
+ (byte)1, TestByte.Value);
+ }
+
+ public void TestSqlByteToByte()
+ {
+ SqlByte TestByte = new SqlByte(12);
+ byte test = (byte)TestByte;
+ AssertEquals("SqlByteToByte" + Error, (byte)12, test);
+ }
+
+ public void TestSqlDecimalToSqlByte()
+ {
+ SqlDecimal TestDecimal64 = new SqlDecimal(64);
+ SqlDecimal TestDecimal900 = new SqlDecimal(900);
+
+ AssertEquals("SqlDecimalToByte" + Error, (byte)64, ((SqlByte)TestDecimal64).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestDecimal900;
+ Fail("SqlDecimalToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlDoubleToSqlByte()
+ {
+ SqlDouble TestDouble64 = new SqlDouble(64);
+ SqlDouble TestDouble900 = new SqlDouble(900);
+
+ AssertEquals("SqlDecimalToByte" + Error, (byte)64, ((SqlByte)TestDouble64).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestDouble900;
+ Fail("SqlDoubleToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlInt16ToSqlByte()
+ {
+ SqlInt16 TestInt1664 = new SqlInt16(64);
+ SqlInt16 TestInt16900 = new SqlInt16(900);
+
+ AssertEquals("SqlInt16ToByte" + Error, (byte)64, ((SqlByte)TestInt1664).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestInt16900;
+ Fail("SqlInt16ToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlInt32ToSqlByte()
+ {
+ SqlInt32 TestInt3264 = new SqlInt32(64);
+ SqlInt32 TestInt32900 = new SqlInt32(900);
+
+ AssertEquals("SqlInt32ToByte" + Error, (byte)64, ((SqlByte)TestInt3264).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestInt32900;
+ Fail("SqlInt32ToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlInt64ToSqlByte()
+ {
+ SqlInt64 TestInt6464 = new SqlInt64(64);
+ SqlInt64 TestInt64900 = new SqlInt64(900);
+
+ AssertEquals("SqlInt64ToByte" + Error, (byte)64, ((SqlByte)TestInt6464).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestInt64900;
+ Fail("SqlInt64ToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlMoneyToSqlByte()
+ {
+ SqlMoney TestMoney64 = new SqlMoney(64);
+ SqlMoney TestMoney900 = new SqlMoney(900);
+
+ AssertEquals("SqlMoneyToByte" + Error, (byte)64, ((SqlByte)TestMoney64).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestMoney900;
+ Fail("SqlMoneyToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlSingleToSqlByte()
+ {
+ SqlSingle TestSingle64 = new SqlSingle(64);
+ SqlSingle TestSingle900 = new SqlSingle(900);
+
+ AssertEquals("SqlSingleToByte" + Error, (byte)64, ((SqlByte)TestSingle64).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestSingle900;
+ Fail("SqlSingleToByte 2" + Error);
+ } catch (Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ }
+
+ public void TestSqlStringToSqlByte()
+ {
+ SqlString TestString = new SqlString("Test string");
+ SqlString TestString100 = new SqlString("100");
+ SqlString TestString1000 = new SqlString("1000");
+
+ AssertEquals ("SqlStringToByte 1" + Error, (byte)100, ((SqlByte)TestString100).Value);
+
+ try {
+ SqlByte test = (SqlByte)TestString1000;
+ } catch(Exception e) {
+
+ AssertEquals("OverflowException", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ SqlByte test = (SqlByte)TestString;
+ Fail("SqlStringToByte 2" + Error);
+
+ } catch(Exception e) {
+ AssertEquals("FormatException", typeof(FormatException), e.GetType());
+ }
+ }
+
+ public void TestByteToSqlByte()
+ {
+ byte TestByte = 14;
+ AssertEquals ("ByteToSqlByte" + Error,
+ (byte)14, ((SqlByte)TestByte).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDateTimeTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDateTimeTest.cs
new file mode 100755
index 00000000000..a83c9c22ce1
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDateTimeTest.cs
@@ -0,0 +1,521 @@
+//
+// SqlDateTimeTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlDateTime
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlDateTimeTest : TestCase {
+
+ private long[] myTicks = {
+ 631501920000000000L, // 25 Feb 2002 - 00:00:00
+ 631502475130080000L, // 25 Feb 2002 - 15:25:13,8
+ 631502115130080000L, // 25 Feb 2002 - 05:25:13,8
+ 631502115000000000L, // 25 Feb 2002 - 05:25:00
+ 631502115130000000L, // 25 Feb 2002 - 05:25:13
+ 631502079130000000L, // 25 Feb 2002 - 04:25:13
+ 629197085770000000L // 06 Nov 1994 - 08:49:37
+ };
+
+ private SqlDateTime Test1;
+ private SqlDateTime Test2;
+ private SqlDateTime Test3;
+
+ public SqlDateTimeTest() : base ("System.Data.SqlTypes.SqlDateTime") {}
+ public SqlDateTimeTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ Test1 = new SqlDateTime (2002, 10, 19, 9, 40, 0);
+ Test2 = new SqlDateTime (2003, 11, 20,10, 50, 1);
+ Test3 = new SqlDateTime (2003, 11, 20, 10, 50, 1);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlDateTime));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ // SqlDateTime (DateTime)
+ SqlDateTime CTest = new SqlDateTime (
+ new DateTime (2002, 5, 19, 3, 34, 0));
+ AssertEquals ("#A01", 2002, CTest.Value.Year);
+
+ // SqlDateTime (int, int)
+ CTest = new SqlDateTime (0, 0);
+
+ // SqlDateTime (int, int, int)
+ AssertEquals ("#A02", 1900, CTest.Value.Year);
+ AssertEquals ("#A03", 1, CTest.Value.Month);
+ AssertEquals ("#A04", 1, CTest.Value.Day);
+ AssertEquals ("#A05", 0, CTest.Value.Hour);
+
+ // SqlDateTime (int, int, int, int, int, int)
+ CTest = new SqlDateTime (5000, 12, 31);
+ AssertEquals ("#A06", 5000, CTest.Value.Year);
+ AssertEquals ("#A07", 12, CTest.Value.Month);
+ AssertEquals ("#A08", 31, CTest.Value.Day);
+
+ // SqlDateTime (int, int, int, int, int, int, double)
+ CTest = new SqlDateTime (1978, 5, 19, 3, 34, 0);
+ AssertEquals ("#A09", 1978, CTest.Value.Year);
+ AssertEquals ("#A10", 5, CTest.Value.Month);
+ AssertEquals ("#A11", 19, CTest.Value.Day);
+ AssertEquals ("#A12", 3, CTest.Value.Hour);
+ AssertEquals ("#A13", 34, CTest.Value.Minute);
+ AssertEquals ("#A14", 0, CTest.Value.Second);
+
+ try {
+ CTest = new SqlDateTime (10000, 12, 31);
+ Fail ("#A15");
+ } catch (Exception e) {
+ AssertEquals ("#A16", typeof (SqlTypeException),
+ e.GetType ());
+ }
+
+ // SqlDateTime (int, int, int, int, int, int, int)
+ CTest = new SqlDateTime (1978, 5, 19, 3, 34, 0, 12);
+ AssertEquals ("#A17", 1978, CTest.Value.Year);
+ AssertEquals ("#A18", 5, CTest.Value.Month);
+ AssertEquals ("#A19", 19, CTest.Value.Day);
+ AssertEquals ("#A20", 3, CTest.Value.Hour);
+ AssertEquals ("#A21", 34, CTest.Value.Minute);
+ AssertEquals ("#A22", 0, CTest.Value.Second);
+ AssertEquals ("#A23", 0, CTest.Value.Millisecond);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ // MaxValue
+ AssertEquals ("#B01", 9999, SqlDateTime.MaxValue.Value.Year);
+ AssertEquals ("#B02", 12, SqlDateTime.MaxValue.Value.Month);
+ AssertEquals ("#B03", 31, SqlDateTime.MaxValue.Value.Day);
+ AssertEquals ("#B04", 23, SqlDateTime.MaxValue.Value.Hour);
+ AssertEquals ("#B05", 59, SqlDateTime.MaxValue.Value.Minute);
+ AssertEquals ("#B06", 59, SqlDateTime.MaxValue.Value.Second);
+
+ // MinValue
+ AssertEquals ("#B07", 1753, SqlDateTime.MinValue.Value.Year);
+ AssertEquals ("#B08", 1, SqlDateTime.MinValue.Value.Month);
+ AssertEquals ("#B09", 1, SqlDateTime.MinValue.Value.Day);
+ AssertEquals ("#B10", 0, SqlDateTime.MinValue.Value.Hour);
+ AssertEquals ("#B11", 0, SqlDateTime.MinValue.Value.Minute);
+ AssertEquals ("#B12", 0, SqlDateTime.MinValue.Value.Second);
+
+ // Null
+ Assert ("#B13", SqlDateTime.Null.IsNull);
+
+ // SQLTicksPerHour
+ AssertEquals ("#B14", 1080000, SqlDateTime.SQLTicksPerHour);
+
+ // SQLTicksPerMinute
+ AssertEquals ("#B15", 18000, SqlDateTime.SQLTicksPerMinute);
+
+ // SQLTicksPerSecond
+ AssertEquals ("#B16", 300, SqlDateTime.SQLTicksPerSecond);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ // DayTicks
+ AssertEquals ("#C01", 37546, Test1.DayTicks);
+
+ try {
+ int test = SqlDateTime.Null.DayTicks;
+ Fail ("#C02");
+ } catch (Exception e) {
+ AssertEquals ("#C03", typeof (SqlNullValueException),
+ e.GetType ());
+ }
+
+ // IsNull
+ Assert ("#C04", SqlDateTime.Null.IsNull);
+ Assert ("#C05", !Test2.IsNull);
+
+ // TimeTicks
+ AssertEquals ("#C06", 10440000, Test1.TimeTicks);
+
+ try {
+ int test = SqlDateTime.Null.TimeTicks;
+ Fail ("#C07");
+ } catch (Exception e) {
+ AssertEquals ("#C08", typeof (SqlNullValueException),
+ e.GetType ());
+ }
+
+ // Value
+ AssertEquals ("#C09", 2003, Test2.Value.Year);
+ AssertEquals ("#C10", 2002, Test1.Value.Year);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestCompareTo()
+ {
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("#D01", Test1.CompareTo (Test3) < 0);
+ Assert ("#D02", Test2.CompareTo (Test1) > 0);
+ Assert ("#D03", Test2.CompareTo (Test3) == 0);
+ Assert ("#D04", Test1.CompareTo (SqlDateTime.Null) > 0);
+
+ try {
+ Test1.CompareTo (TestString);
+ Fail("#D05");
+ } catch(Exception e) {
+ AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethods()
+ {
+ Assert ("#E01", !Test1.Equals (Test2));
+ Assert ("#E03", !Test2.Equals (new SqlString ("TEST")));
+ Assert ("#E04", Test2.Equals (Test3));
+
+ // Static Equals()-method
+ Assert ("#E05", SqlDateTime.Equals (Test2, Test3).Value);
+ Assert ("#E06", !SqlDateTime.Equals (Test1, Test2).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#F01", Test1.GetHashCode (), Test1.GetHashCode ());
+ Assert ("#F02", Test2.GetHashCode () != Test1.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ AssertEquals ("#G01", "System.Data.SqlTypes.SqlDateTime",
+ Test1.GetType ().ToString ());
+ AssertEquals ("#G02", "System.DateTime",
+ Test1.Value.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ // GreateThan ()
+ Assert ("#H01", !SqlDateTime.GreaterThan (Test1, Test2).Value);
+ Assert ("#H02", SqlDateTime.GreaterThan (Test2, Test1).Value);
+ Assert ("#H03", !SqlDateTime.GreaterThan (Test2, Test3).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("#H04", !SqlDateTime.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#H05", SqlDateTime.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#H06", SqlDateTime.GreaterThanOrEqual (Test2, Test3).Value);
+ }
+
+ public void TestLessers()
+ {
+ // LessThan()
+ Assert ("#I01", !SqlDateTime.LessThan (Test2, Test3).Value);
+ Assert ("#I02", !SqlDateTime.LessThan (Test2, Test1).Value);
+ Assert ("#I03", SqlDateTime.LessThan (Test1, Test3).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#I04", SqlDateTime.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#I05", !SqlDateTime.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#I06", SqlDateTime.LessThanOrEqual (Test3, Test2).Value);
+ Assert ("#I07", SqlDateTime.LessThanOrEqual (Test1, SqlDateTime.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ Assert ("#J01", SqlDateTime.NotEquals (Test1, Test2).Value);
+ Assert ("#J02", SqlDateTime.NotEquals (Test3, Test1).Value);
+ Assert ("#J03", !SqlDateTime.NotEquals (Test2, Test3).Value);
+ Assert ("#J04", SqlDateTime.NotEquals (SqlDateTime.Null, Test2).IsNull);
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlDateTime.Parse (null);
+ Fail ("#K01");
+ } catch (Exception e) {
+ AssertEquals ("#K02", typeof (ArgumentNullException),
+ e.GetType ());
+ }
+
+ try {
+ SqlDateTime.Parse ("not-a-number");
+ Fail ("#K03");
+ } catch (Exception e) {
+ AssertEquals ("#K04", typeof (FormatException),
+ e.GetType ());
+ }
+
+ SqlDateTime t1 = SqlDateTime.Parse ("02/25/2002");
+ AssertEquals ("#K05", myTicks[0], t1.Value.Ticks);
+
+ try {
+ t1 = SqlDateTime.Parse ("2002-02-25");
+ } catch (Exception e) {
+ Fail ("#K06 " + e);
+ }
+
+ // Thanks for Martin Baulig for these (DateTimeTest.cs)
+ AssertEquals ("#K07", myTicks[0], t1.Value.Ticks);
+ t1 = SqlDateTime.Parse ("Monday, 25 February 2002");
+ AssertEquals ("#K08", myTicks[0], t1.Value.Ticks);
+ t1 = SqlDateTime.Parse ("Monday, 25 February 2002 05:25");
+ AssertEquals ("#K09", myTicks[3], t1.Value.Ticks);
+ t1 = SqlDateTime.Parse ("Monday, 25 February 2002 05:25:13");
+ AssertEquals ("#K10", myTicks[4], t1.Value.Ticks);
+ t1 = SqlDateTime.Parse ("02/25/2002 05:25");
+ AssertEquals ("#K11", myTicks[3], t1.Value.Ticks);
+ t1 = SqlDateTime.Parse ("02/25/2002 05:25:13");
+ AssertEquals ("#K12", myTicks[4], t1.Value.Ticks);
+ t1 = SqlDateTime.Parse ("2002-02-25 04:25:13Z");
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1.Value);
+ AssertEquals ("#K13", 2002, t1.Value.Year);
+ AssertEquals ("#K14", 02, t1.Value.Month);
+ AssertEquals ("#K15", 25, t1.Value.Day);
+ AssertEquals ("#K16", 04, t1.Value.Hour);
+ AssertEquals ("#K17", 25, t1.Value.Minute);
+ AssertEquals ("#K18", 13, t1.Value.Second);
+
+ SqlDateTime t2 = new SqlDateTime (DateTime.Today.Year, 2, 25);
+ t1 = SqlDateTime.Parse ("February 25");
+ AssertEquals ("#K19", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (DateTime.Today.Year, 2, 8);
+ t1 = SqlDateTime.Parse ("February 08");
+ AssertEquals ("#K20", t2.Value.Ticks, t1.Value.Ticks);
+
+ t1 = SqlDateTime.Parse ("Mon, 25 Feb 2002 04:25:13 GMT");
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1.Value);
+ AssertEquals ("#K21", 2002, t1.Value.Year);
+ AssertEquals ("#K22", 02, t1.Value.Month);
+ AssertEquals ("#K23", 25, t1.Value.Day);
+ AssertEquals ("#K24", 04, t1.Value.Hour);
+ AssertEquals ("#K25", 25, t1.Value.Minute);
+ AssertEquals ("#K26", 13, t1.Value.Second);
+
+ t1 = SqlDateTime.Parse ("2002-02-25T05:25:13");
+ AssertEquals ("#K27", myTicks[4], t1.Value.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,0);
+ t1 = SqlDateTime.Parse ("05:25");
+ AssertEquals("#K28", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,13);
+ t1 = SqlDateTime.Parse ("05:25:13");
+ AssertEquals("#K29", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (2002, 2, 1);
+ t1 = SqlDateTime.Parse ("2002 February");
+ AssertEquals ("#K30", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (2002, 2, 1);
+ t1 = SqlDateTime.Parse ("2002 February");
+ AssertEquals ("#K31", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (DateTime.Today.Year, 2, 8);
+ t1 = SqlDateTime.Parse ("February 8");
+
+ AssertEquals ("#K32", t2.Value.Ticks, t1.Value.Ticks);
+ }
+
+ public void TestToString()
+ {
+ //
+ // Thanks for Marting Baulig for these (DateTimeTest.cs)
+ //
+
+ SqlDateTime t1 = new SqlDateTime (2002, 2, 25, 5, 25, 13);
+ SqlDateTime t2 = new SqlDateTime (2002, 2, 25, 15, 25, 13);
+
+ // Standard patterns
+ AssertEquals("L01", "25.2.2002 5:25:13", t1.ToString ());
+ AssertEquals("L02", (SqlString)"25.2.2002 5:25:13", t1.ToSqlString ());
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ TimeSpan TestSpan = new TimeSpan (20, 1, 20, 20);
+ SqlDateTime ResultDateTime;
+
+ // "+"-operator
+ ResultDateTime = Test1 + TestSpan;
+ AssertEquals ("#M01", 2002, ResultDateTime.Value.Year);
+ AssertEquals ("#M02", 8, ResultDateTime.Value.Day);
+ AssertEquals ("#M03", 11, ResultDateTime.Value.Hour);
+ AssertEquals ("#M04", 0, ResultDateTime.Value.Minute);
+ AssertEquals ("#M05", 20, ResultDateTime.Value.Second);
+ Assert ("#M06", (SqlDateTime.Null + TestSpan).IsNull);
+
+ try {
+ ResultDateTime = SqlDateTime.MaxValue + TestSpan;
+ Fail ("#M07");
+ } catch (Exception e) {
+ AssertEquals ("#M08", typeof (ArgumentOutOfRangeException), e.GetType ());
+ }
+
+ // "-"-operator
+ ResultDateTime = Test1 - TestSpan;
+ AssertEquals ("#M09", 2002, ResultDateTime.Value.Year);
+ AssertEquals ("#M10", 29, ResultDateTime.Value.Day);
+ AssertEquals ("#M11", 8, ResultDateTime.Value.Hour);
+ AssertEquals ("#M12", 19, ResultDateTime.Value.Minute);
+ AssertEquals ("#M13", 40, ResultDateTime.Value.Second);
+ Assert ("#M14", (SqlDateTime.Null - TestSpan).IsNull);
+
+ try {
+ ResultDateTime = SqlDateTime.MinValue - TestSpan;
+ Fail ("#M15");
+ } catch (Exception e) {
+ AssertEquals ("#M16", typeof (SqlTypeException), e.GetType ());
+ }
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ // == -operator
+ Assert ("#N01", (Test2 == Test3).Value);
+ Assert ("#N02", !(Test1 == Test2).Value);
+ Assert ("#N03", (Test1 == SqlDateTime.Null).IsNull);
+
+ // != -operator
+ Assert ("#N04", !(Test2 != Test3).Value);
+ Assert ("#N05", (Test1 != Test3).Value);
+ Assert ("#N06", (Test1 != SqlDateTime.Null).IsNull);
+
+ // > -operator
+ Assert ("#N07", (Test2 > Test1).Value);
+ Assert ("#N08", !(Test3 > Test2).Value);
+ Assert ("#N09", (Test1 > SqlDateTime.Null).IsNull);
+
+ // >= -operator
+ Assert ("#N10", !(Test1 >= Test3).Value);
+ Assert ("#N11", (Test3 >= Test1).Value);
+ Assert ("#N12", (Test2 >= Test3).Value);
+ Assert ("#N13", (Test1 >= SqlDateTime.Null).IsNull);
+
+ // < -operator
+ Assert ("#N14", !(Test2 < Test1).Value);
+ Assert ("#N15", (Test1 < Test3).Value);
+ Assert ("#N16", !(Test2 < Test3).Value);
+ Assert ("#N17", (Test1 < SqlDateTime.Null).IsNull);
+
+ // <= -operator
+ Assert ("#N18", (Test1 <= Test3).Value);
+ Assert ("#N19", !(Test3 <= Test1).Value);
+ Assert ("#N20", (Test2 <= Test3).Value);
+ Assert ("#N21", (Test1 <= SqlDateTime.Null).IsNull);
+ }
+
+ public void TestSqlDateTimeToDateTime()
+ {
+ AssertEquals ("O01", 2002, ((DateTime)Test1).Year);
+ AssertEquals ("O03", 2003, ((DateTime)Test2).Year);
+ AssertEquals ("O04", 10, ((DateTime)Test1).Month);
+ AssertEquals ("O05", 19, ((DateTime)Test1).Day);
+ AssertEquals ("O06", 9, ((DateTime)Test1).Hour);
+ AssertEquals ("O07", 40, ((DateTime)Test1).Minute);
+ AssertEquals ("O08", 0, ((DateTime)Test1).Second);
+ }
+
+ public void TestSqlStringToSqlDateTime()
+ {
+
+ SqlString TestString = new SqlString ("02/25/2002");
+ SqlDateTime t1 = (SqlDateTime)TestString;
+
+ AssertEquals ("#P01", myTicks[0], t1.Value.Ticks);
+
+ // Thanks for Martin Baulig for these (DateTimeTest.cs)
+ AssertEquals ("#P02", myTicks[0], t1.Value.Ticks);
+ t1 = (SqlDateTime) new SqlString ("Monday, 25 February 2002");
+ AssertEquals ("#P04", myTicks[0], t1.Value.Ticks);
+ t1 = (SqlDateTime) new SqlString ("Monday, 25 February 2002 05:25");
+ AssertEquals ("#P05", myTicks[3], t1.Value.Ticks);
+ t1 = (SqlDateTime) new SqlString ("Monday, 25 February 2002 05:25:13");
+ AssertEquals ("#P05", myTicks[4], t1.Value.Ticks);
+ t1 = (SqlDateTime) new SqlString ("02/25/2002 05:25");
+ AssertEquals ("#P06", myTicks[3], t1.Value.Ticks);
+ t1 = (SqlDateTime) new SqlString ("02/25/2002 05:25:13");
+ AssertEquals ("#P07", myTicks[4], t1.Value.Ticks);
+ t1 = (SqlDateTime) new SqlString ("2002-02-25 04:25:13Z");
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1.Value);
+ AssertEquals ("#P08", 2002, t1.Value.Year);
+ AssertEquals ("#P09", 02, t1.Value.Month);
+ AssertEquals ("#P10", 25, t1.Value.Day);
+ AssertEquals ("#P11", 04, t1.Value.Hour);
+ AssertEquals ("#P12", 25, t1.Value.Minute);
+ AssertEquals ("#P13", 13, t1.Value.Second);
+
+ SqlDateTime t2 = new SqlDateTime (DateTime.Today.Year, 2, 25);
+ t1 = (SqlDateTime) new SqlString ("February 25");
+ AssertEquals ("#P14", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (DateTime.Today.Year, 2, 8);
+ t1 = (SqlDateTime) new SqlString ("February 08");
+ AssertEquals ("#P15", t2.Value.Ticks, t1.Value.Ticks);
+
+ t1 = (SqlDateTime) new SqlString ("Mon, 25 Feb 2002 04:25:13 GMT");
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1.Value);
+ AssertEquals ("#P16", 2002, t1.Value.Year);
+ AssertEquals ("#P17", 02, t1.Value.Month);
+ AssertEquals ("#P18", 25, t1.Value.Day);
+ AssertEquals ("#P19", 04, t1.Value.Hour);
+ AssertEquals ("#P20", 25, t1.Value.Minute);
+ AssertEquals ("#P21", 13, t1.Value.Second);
+
+ t1 = (SqlDateTime) new SqlString ("2002-02-25T05:25:13");
+ AssertEquals ("#P22", myTicks[4], t1.Value.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,0);
+ t1 = (SqlDateTime) new SqlString ("05:25");
+ AssertEquals("#P23", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,13);
+ t1 = (SqlDateTime) new SqlString ("05:25:13");
+ AssertEquals("#P24", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (2002, 2, 1);
+ t1 = (SqlDateTime) new SqlString ("2002 February");
+ AssertEquals ("#P25", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (2002, 2, 1);
+ t1 = (SqlDateTime) new SqlString ("2002 February");
+ AssertEquals ("#P26", t2.Value.Ticks, t1.Value.Ticks);
+
+ t2 = new SqlDateTime (DateTime.Today.Year, 2, 8);
+ t1 = (SqlDateTime) new SqlString ("February 8");
+
+ AssertEquals ("#P27", t2.Value.Ticks, t1.Value.Ticks);
+ }
+
+ public void TestDateTimeToSqlDateTime()
+ {
+ DateTime DateTimeTest = new DateTime (2002, 10, 19, 11, 53, 4);
+ SqlDateTime Result = (SqlDateTime)DateTimeTest;
+ AssertEquals ("#Q01", 2002, Result.Value.Year);
+ AssertEquals ("#Q02", 10, Result.Value.Month);
+ AssertEquals ("#Q03", 19, Result.Value.Day);
+ AssertEquals ("#Q04", 11, Result.Value.Hour);
+ AssertEquals ("#Q05", 53, Result.Value.Minute);
+ AssertEquals ("#Q06", 4, Result.Value.Second);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDecimalTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDecimalTest.cs
new file mode 100755
index 00000000000..cf9d2fd5a63
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDecimalTest.cs
@@ -0,0 +1,592 @@
+//
+// SqlDecimalTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlDecimal
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlDecimalTest : TestCase {
+
+ private SqlDecimal Test1;
+ private SqlDecimal Test2;
+ private SqlDecimal Test3;
+ private SqlDecimal Test4;
+
+ public SqlDecimalTest() : base ("System.Data.SqlTypes.SqlDecimal") {}
+ public SqlDecimalTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ Test1 = new SqlDecimal (6464.6464m);
+ Test2 = new SqlDecimal (10000.00m);
+ Test3 = new SqlDecimal (10000.00m);
+ Test4 = new SqlDecimal (-6m);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlDecimal));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ // SqlDecimal (decimal)
+ SqlDecimal Test = new SqlDecimal (30.3098m);
+ AssertEquals ("#A01", (decimal)30.3098, Test.Value);
+
+ try {
+ SqlDecimal test = new SqlDecimal (Decimal.MaxValue + 1);
+ Fail ("#A02");
+ } catch (Exception e) {
+ AssertEquals ("#A03", typeof (OverflowException), e.GetType ());
+ }
+
+ // SqlDecimal (double)
+ Test = new SqlDecimal (10E+10d);
+ AssertEquals ("#A05", 100000000000m, Test.Value);
+
+ try {
+ SqlDecimal test = new SqlDecimal (10E+200d);
+ Fail ("#A06");
+ } catch (Exception e) {
+ AssertEquals ("#A07", typeof (OverflowException), e.GetType ());
+ }
+
+ // SqlDecimal (int)
+ Test = new SqlDecimal (-1);
+ AssertEquals ("#A08", -1m, Test.Value);
+
+ // SqlDecimal (long)
+ Test = new SqlDecimal ((long)(-99999));
+ AssertEquals ("#A09", -99999m, Test.Value);
+
+ // SqlDecimal (byte, byte, bool. int[]
+ Test = new SqlDecimal (10, 3, false, new int [4] {200, 1, 0, 0});
+ AssertEquals ("#A10", -4294967.496m, Test.Value);
+
+ try {
+ Test = new SqlDecimal (100, 100, false,
+ new int [4] {Int32.MaxValue,
+ Int32.MaxValue, Int32.MaxValue,
+ Int32.MaxValue});
+ Fail ("#A11");
+ } catch (Exception e) {
+ AssertEquals ("#A12", typeof (SqlTypeException), e.GetType ());
+ }
+
+ // sqlDecimal (byte, byte, bool, int, int, int, int)
+ Test = new SqlDecimal (12, 2, true, 100, 100, 0, 0);
+ AssertEquals ("#A13", 4294967297m, Test.Value);
+
+ try {
+ Test = new SqlDecimal (100, 100, false,
+ Int32.MaxValue,
+ Int32.MaxValue, Int32.MaxValue,
+ Int32.MaxValue);
+ Fail ("#A14");
+ } catch (Exception e) {
+ AssertEquals ("#A15", typeof (SqlTypeException), e.GetType ());
+ }
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ AssertEquals ("#B01", (byte)38, SqlDecimal.MaxPrecision);
+ AssertEquals ("#B02", (byte)38, SqlDecimal.MaxScale);
+
+ // FIXME: on windows: Conversion overflow
+ AssertEquals ("#B03a", 1262177448, SqlDecimal.MaxValue.Data [3]);
+
+
+ AssertEquals ("#B04", 1262177448, SqlDecimal.MinValue.Data [3]);
+ Assert ("#B05", SqlDecimal.Null.IsNull);
+ Assert ("#B06", !Test1.IsNull);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ byte[] b = Test1.BinData;
+ AssertEquals ("#C01", (byte)64, b [0]);
+
+ int[] i = Test1.Data;
+ AssertEquals ("#C02", 64646464, i [0]);
+
+ Assert ("#C03", SqlDecimal.Null.IsNull);
+ Assert ("#C04", Test1.IsPositive);
+ Assert ("#C05", !Test4.IsPositive);
+ AssertEquals ("#C06", (byte)8, Test1.Precision);
+ AssertEquals ("#C07", (byte)0, Test2.Scale);
+ AssertEquals ("#C08", 6464.6464m, Test1.Value);
+ AssertEquals ("#C09", (byte)4, Test1.Scale);
+ AssertEquals ("#C06", (byte)5, Test2.Precision);
+ AssertEquals ("#C06", (byte)1, Test4.Precision);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestArithmeticMethods()
+ {
+
+ // Abs
+ AssertEquals ("#D01", (SqlDecimal)6m, SqlDecimal.Abs (Test4));
+ AssertEquals ("#D02", new SqlDecimal (6464.6464m).Value, SqlDecimal.Abs (Test1).Value);
+
+ AssertEquals ("#D03", SqlDecimal.Null, SqlDecimal.Abs (SqlDecimal.Null));
+
+ // Add()
+ AssertEquals ("#D04", 16464.6464m, SqlDecimal.Add (Test1, Test2).Value);
+
+ try {
+ SqlDecimal test = SqlDecimal.Add (SqlDecimal.MaxValue, SqlDecimal.MaxValue);
+ Fail ("#D05");
+ } catch (Exception e) {
+ AssertEquals ("#D06", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals ("#D07", (SqlDecimal)6465m, SqlDecimal.Ceiling(Test1));
+ AssertEquals ("#D08", SqlDecimal.Null, SqlDecimal.Ceiling(SqlDecimal.Null));
+
+ // Divide()
+ AssertEquals ("#D09", (SqlDecimal)(-1077.441066m), SqlDecimal.Divide (Test1, Test4));
+ AssertEquals ("#D10", 1.546875015m, SqlDecimal.Divide (Test2, Test1).Value);
+
+ try {
+ SqlDecimal test = SqlDecimal.Divide(Test1, new SqlDecimal(0)).Value;
+ Fail ("#D11");
+ } catch(Exception e) {
+ AssertEquals ("#D12", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ AssertEquals ("#D13", (SqlDecimal)6464m, SqlDecimal.Floor (Test1));
+
+ // Multiply()
+ AssertEquals ("#D14", 64646464m, SqlDecimal.Multiply (Test1, Test2).Value);
+ AssertEquals ("#D15", -38787.8784m, SqlDecimal.Multiply (Test1, Test4).Value);
+
+ try {
+ SqlDecimal test = SqlDecimal.Multiply (SqlDecimal.MaxValue, Test1);
+ Fail ("#D16");
+ } catch (Exception e) {
+ AssertEquals ("#D17", typeof (OverflowException), e.GetType ());
+ }
+
+ // Power
+ AssertEquals ("#D18", (SqlDecimal)41791653.0770m, SqlDecimal.Power (Test1, 2));
+
+ // Round
+ AssertEquals ("#D19", (SqlDecimal)6464.65m, SqlDecimal.Round (Test1, 2));
+
+ // Subtract()
+ AssertEquals ("#D20", -3535.3536m, SqlDecimal.Subtract (Test1, Test3).Value);
+
+ try {
+ SqlDecimal test = SqlDecimal.Subtract(SqlDecimal.MinValue, SqlDecimal.MaxValue);
+ Fail ("#D21");
+ } catch (Exception e) {
+ AssertEquals ("#D22", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals ("#D23", (SqlInt32)1, SqlDecimal.Sign (Test1));
+ AssertEquals ("#D24", new SqlInt32(-1), SqlDecimal.Sign (Test4));
+ }
+
+ public void TestAdjustScale()
+ {
+ AssertEquals ("#E01", (SqlString)"6464.646400", SqlDecimal.AdjustScale (Test1, 2, false).ToSqlString ());
+ AssertEquals ("#E02", (SqlString)"6464.65", SqlDecimal.AdjustScale (Test1, -2, true).ToSqlString ());
+ AssertEquals ("#E03", (SqlString)"6464.64", SqlDecimal.AdjustScale (Test1, -2, false).ToSqlString ());
+ AssertEquals ("#E01", (SqlString)"10000.0000000000", SqlDecimal.AdjustScale (Test2, 10, false).ToSqlString ());
+ }
+
+ public void TestConvertToPrecScale()
+ {
+ AssertEquals ("#F01", new SqlDecimal(6464.6m).Value, SqlDecimal.ConvertToPrecScale (Test1, 5, 1).Value);
+
+ try {
+ SqlDecimal test = SqlDecimal.ConvertToPrecScale (Test1, 6, 5);
+ Fail ("#F02");
+ } catch (Exception e) {
+ AssertEquals ("#F03", typeof (SqlTruncateException), e.GetType ());
+ }
+
+ AssertEquals ("#F01", (SqlString)"10000.00", SqlDecimal.ConvertToPrecScale (Test2, 7, 2).ToSqlString ());
+ }
+
+ public void TestCompareTo()
+ {
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("#G01", Test1.CompareTo (Test3) < 0);
+ Assert ("#G02", Test2.CompareTo (Test1) > 0);
+ Assert ("#G03", Test2.CompareTo (Test3) == 0);
+ Assert ("#G04", Test4.CompareTo (SqlDecimal.Null) > 0);
+
+ try {
+ Test1.CompareTo (TestString);
+ Fail("#G05");
+ } catch(Exception e) {
+ AssertEquals ("#G06", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethods()
+ {
+ Assert ("#H01", !Test1.Equals (Test2));
+ Assert ("#H02", !Test2.Equals (new SqlString ("TEST")));
+ Assert ("#H03", Test2.Equals (Test3));
+
+ // Static Equals()-method
+ Assert ("#H05", SqlDecimal.Equals (Test2, Test2).Value);
+ Assert ("#H06", !SqlDecimal.Equals (Test1, Test2).Value);
+
+ // NotEquals
+ Assert ("#H07", SqlDecimal.NotEquals (Test1, Test2).Value);
+ Assert ("#H08", SqlDecimal.NotEquals (Test4, Test1).Value);
+ Assert ("#H09", !SqlDecimal.NotEquals (Test2, Test3).Value);
+ Assert ("#H10", SqlDecimal.NotEquals (SqlDecimal.Null, Test3).IsNull);
+ }
+
+ public void TestGetHashCode()
+ {
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#I01", -1281249885, Test1.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ AssertEquals ("#J01", "System.Data.SqlTypes.SqlDecimal",
+ Test1.GetType ().ToString ());
+ AssertEquals ("#J02", "System.Decimal", Test1.Value.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ // GreateThan ()
+ Assert ("#K01", !SqlDecimal.GreaterThan (Test1, Test2).Value);
+ Assert ("#K02", SqlDecimal.GreaterThan (Test2, Test1).Value);
+ Assert ("#K03", !SqlDecimal.GreaterThan (Test2, Test3).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("#K04", !SqlDecimal.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#K05", SqlDecimal.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#K06", SqlDecimal.GreaterThanOrEqual (Test2, Test3).Value);
+ }
+
+ public void TestLessers()
+ {
+ // LessThan()
+ Assert ("#L01", !SqlDecimal.LessThan (Test3, Test2).Value);
+ Assert ("#L02", !SqlDecimal.LessThan (Test2, Test1).Value);
+ Assert ("#L03", SqlDecimal.LessThan (Test1, Test2).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#L04", SqlDecimal.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#L05", !SqlDecimal.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#L06", SqlDecimal.LessThanOrEqual (Test2, Test3).Value);
+ Assert ("#L07", SqlDecimal.LessThanOrEqual (Test1, SqlDecimal.Null).IsNull);
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlDecimal.Parse (null);
+ Fail ("#m01");
+ } catch (Exception e) {
+ AssertEquals ("#M02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlDecimal.Parse ("not-a-number");
+ Fail ("#M03");
+ } catch (Exception e) {
+ AssertEquals ("#M04", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlDecimal test = SqlDecimal.Parse ("9e300");
+ Fail ("#M05");
+ } catch (Exception e) {
+ AssertEquals ("#M06", typeof (FormatException), e.GetType ());
+ }
+
+ AssertEquals("#M07", 150m, SqlDecimal.Parse ("150").Value);
+ }
+
+ public void TestConversions()
+ {
+ // ToDouble
+ AssertEquals ("N01", 6464.6464, Test1.ToDouble ());
+
+ // ToSqlBoolean ()
+ AssertEquals ("#N02", new SqlBoolean(1), Test1.ToSqlBoolean ());
+
+ SqlDecimal Test = new SqlDecimal (0);
+ Assert ("#N03", !Test.ToSqlBoolean ().Value);
+
+ Test = new SqlDecimal (0);
+ Assert ("#N04", !Test.ToSqlBoolean ().Value);
+ Assert ("#N05", SqlDecimal.Null.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ Test = new SqlDecimal (250);
+ AssertEquals ("#N06", (byte)250, Test.ToSqlByte ().Value);
+
+ try {
+ SqlByte b = (byte)Test2.ToSqlByte ();
+ Fail ("#N07");
+ } catch (Exception e) {
+ AssertEquals ("#N08", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDouble ()
+ AssertEquals ("#N09", (SqlDouble)6464.6464, Test1.ToSqlDouble ());
+
+ // ToSqlInt16 ()
+ AssertEquals ("#N10", (short)1, new SqlDecimal (1).ToSqlInt16 ().Value);
+
+ try {
+ SqlInt16 test = SqlDecimal.MaxValue.ToSqlInt16().Value;
+ Fail ("#N11");
+ } catch (Exception e) {
+ AssertEquals ("#N12", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt32 ()
+ // FIXME: 6464.6464 --> 64646464 ??? with windows
+ AssertEquals ("#N13a", (int)64646464, Test1.ToSqlInt32 ().Value);
+ AssertEquals ("#N13b", (int)1212, new SqlDecimal(12.12m).ToSqlInt32 ().Value);
+
+ try {
+ SqlInt32 test = SqlDecimal.MaxValue.ToSqlInt32 ().Value;
+ Fail ("#N14");
+ } catch (Exception e) {
+ AssertEquals ("#N15", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt64 ()
+ AssertEquals ("#N16", (long)6464, Test1.ToSqlInt64 ().Value);
+
+ // ToSqlMoney ()
+ AssertEquals ("#N17", (decimal)6464.6464, Test1.ToSqlMoney ().Value);
+
+ try {
+ SqlMoney test = SqlDecimal.MaxValue.ToSqlMoney ().Value;
+ Fail ("#N18");
+ } catch (Exception e) {
+ AssertEquals ("#N19", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlSingle ()
+ AssertEquals ("#N20", (float)6464.6464, Test1.ToSqlSingle ().Value);
+
+ // ToSqlString ()
+ AssertEquals ("#N21", "6464.6464", Test1.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("#N22", "6464.6464", Test1.ToString ());
+ AssertEquals ("#N23", (SqlDouble)1E+38, SqlDecimal.MaxValue.ToSqlDouble ());
+
+ }
+
+ public void TestTruncate()
+ {
+ AssertEquals ("#O01", new SqlDecimal (6464.64m).Value, SqlDecimal.Truncate (Test1, 2).Value);
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ // "+"-operator
+ AssertEquals ("#P01", new SqlDecimal(16464.6464m), Test1 + Test2);
+
+ try {
+ SqlDecimal test = SqlDecimal.MaxValue + SqlDecimal.MaxValue;
+ Fail ("#P02");
+ } catch (Exception e) {
+ AssertEquals ("#P03", typeof (OverflowException), e.GetType ());
+ }
+
+ // "/"-operator
+ AssertEquals ("#P04", (SqlDecimal)1.546875015m, Test2 / Test1);
+
+ try {
+ SqlDecimal test = Test3 / new SqlDecimal (0);
+ Fail ("#P05");
+ } catch (Exception e) {
+ AssertEquals ("#P06", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // "*"-operator
+ AssertEquals ("#P07", (SqlDecimal)64646464m, Test1 * Test2);
+
+ try {
+ SqlDecimal test = SqlDecimal.MaxValue * Test1;
+ Fail ("#P08");
+ } catch (Exception e) {
+ AssertEquals ("#P09", typeof (OverflowException), e.GetType ());
+ }
+
+ // "-"-operator
+ AssertEquals ("#P10", (SqlDecimal)3535.3536m, Test2 - Test1);
+
+ try {
+ SqlDecimal test = SqlDecimal.MinValue - SqlDecimal.MaxValue;
+ Fail ("#P11");
+ } catch (Exception e) {
+ AssertEquals ("#P12", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals ("#P13", SqlDecimal.Null, SqlDecimal.Null + Test1);
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+
+ // == -operator
+ Assert ("#Q01", (Test2 == Test3).Value);
+ Assert ("#Q02", !(Test1 == Test2).Value);
+ Assert ("#Q03", (Test1 == SqlDecimal.Null).IsNull);
+
+ // != -operator
+ Assert ("#Q04", !(Test2 != Test3).Value);
+ Assert ("#Q05", (Test1 != Test3).Value);
+ Assert ("#Q06", (Test4 != Test3).Value);
+ Assert ("#Q07", (Test1 != SqlDecimal.Null).IsNull);
+
+ // > -operator
+ Assert ("#Q08", (Test2 > Test1).Value);
+ Assert ("#Q09", !(Test1 > Test3).Value);
+ Assert ("#Q10", !(Test2 > Test3).Value);
+ Assert ("#Q11", (Test1 > SqlDecimal.Null).IsNull);
+
+ // >= -operator
+ Assert ("#Q12", !(Test1 >= Test3).Value);
+ Assert ("#Q13", (Test3 >= Test1).Value);
+ Assert ("#Q14", (Test2 >= Test3).Value);
+ Assert ("#Q15", (Test1 >= SqlDecimal.Null).IsNull);
+
+ // < -operator
+ Assert ("#Q16", !(Test2 < Test1).Value);
+ Assert ("#Q17", (Test1 < Test3).Value);
+ Assert ("#Q18", !(Test2 < Test3).Value);
+ Assert ("#Q19", (Test1 < SqlDecimal.Null).IsNull);
+
+ // <= -operator
+ Assert ("#Q20", (Test1 <= Test3).Value);
+ Assert ("#Q21", !(Test3 <= Test1).Value);
+ Assert ("#Q22", (Test2 <= Test3).Value);
+ Assert ("#Q23", (Test1 <= SqlDecimal.Null).IsNull);
+ }
+
+ public void TestUnaryNegation()
+ {
+ AssertEquals ("#R01", 6m, -Test4.Value);
+ AssertEquals ("#R02", -6464.6464m, -Test1.Value);
+ AssertEquals ("#R03", SqlDecimal.Null, SqlDecimal.Null);
+ }
+
+ public void TestSqlBooleanToSqlDecimal()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+ SqlDecimal Result;
+
+ Result = (SqlDecimal)TestBoolean;
+
+ AssertEquals ("#S01", 1m, Result.Value);
+
+ Result = (SqlDecimal)SqlBoolean.Null;
+ Assert ("#S02", Result.IsNull);
+ AssertEquals ("#S03", SqlDecimal.Null, (SqlDecimal)SqlBoolean.Null);
+ }
+
+ public void TestSqlDecimalToDecimal()
+ {
+ AssertEquals ("#T01", 6464.6464m, (Decimal)Test1);
+ }
+
+ public void TestSqlDoubleToSqlDecimal()
+ {
+ SqlDouble Test = new SqlDouble (12E+10);
+ AssertEquals ("#U01", 120000000000m, ((SqlDecimal)Test).Value);
+ }
+
+ public void TestSqlSingleToSqlDecimal()
+ {
+ SqlSingle Test = new SqlSingle (1E+9);
+ AssertEquals ("#V01", 1000000000m, ((SqlDecimal)Test).Value);
+
+ try {
+ SqlDecimal test = (SqlDecimal)SqlSingle.MaxValue;
+ Fail ("#V02");
+ } catch (Exception e) {
+ AssertEquals ("#V03", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlStringToSqlDecimal()
+ {
+ SqlString TestString = new SqlString ("Test string");
+ SqlString TestString100 = new SqlString ("100");
+
+ AssertEquals ("#W01", 100m, ((SqlDecimal)TestString100).Value);
+
+ try {
+ SqlDecimal test = (SqlDecimal)TestString;
+ Fail ("#W02");
+ } catch(Exception e) {
+ AssertEquals ("#W03", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlDecimal test = (SqlDecimal)new SqlString("9E+100");
+ Fail ("#W04");
+ } catch (Exception e) {
+ AssertEquals ("#W05", typeof (FormatException), e.GetType());
+ }
+ }
+
+ public void TestDecimalToSqlDecimal()
+ {
+ decimal d = 1000.1m;
+ AssertEquals ("#X01", (SqlDecimal)1000.1m, (SqlDecimal)d);
+ }
+
+ public void TestByteToSqlDecimal()
+ {
+ AssertEquals ("#Y01", 255m, ((SqlDecimal)SqlByte.MaxValue).Value);
+ }
+
+
+ public void TestSqlIntToSqlDouble()
+ {
+ SqlInt16 Test64 = new SqlInt16 (64);
+ SqlInt32 Test640 = new SqlInt32 (640);
+ SqlInt64 Test64000 = new SqlInt64 (64000);
+ AssertEquals ("#Z01", 64m, ((SqlDecimal)Test64).Value);
+ AssertEquals ("#Z02", 640m,((SqlDecimal)Test640).Value);
+ AssertEquals ("#Z03", 64000m, ((SqlDecimal)Test64000).Value);
+ }
+
+
+ public void TestSqlMoneyToSqlDecimal()
+ {
+ SqlMoney TestMoney64 = new SqlMoney(64);
+ AssertEquals ("#AA01", 64M, ((SqlDecimal)TestMoney64).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDoubleTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDoubleTest.cs
new file mode 100644
index 00000000000..45f30378c8b
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlDoubleTest.cs
@@ -0,0 +1,534 @@
+//
+// SqlDoubleTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlDouble
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlDoubleTest : TestCase {
+
+ public SqlDoubleTest() : base ("System.Data.SqlTypes.SqlDouble") {}
+ public SqlDoubleTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlDouble));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ SqlDouble Test= new SqlDouble ((double)34.87);
+ AssertEquals ("#A01", 34.87D, Test.Value);
+
+ Test = new SqlDouble (-9000.6543);
+ AssertEquals ("#A02", -9000.6543D, Test.Value);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ AssertEquals ("#B01", 1.7976931348623157e+308, SqlDouble.MaxValue.Value);
+ AssertEquals ("#B02", -1.7976931348623157e+308, SqlDouble.MinValue.Value);
+ Assert ("#B03", SqlDouble.Null.IsNull);
+ AssertEquals ("#B04", 0d, SqlDouble.Zero.Value);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ SqlDouble Test5443 = new SqlDouble (5443e12);
+ SqlDouble Test1 = new SqlDouble (1);
+
+ Assert ("#C01", SqlDouble.Null.IsNull);
+ AssertEquals ("#C02", 5443e12, Test5443.Value);
+ AssertEquals ("#C03", (double)1, Test1.Value);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestArithmeticMethods()
+ {
+ SqlDouble Test0 = new SqlDouble (0);
+ SqlDouble Test1 = new SqlDouble (15E+108);
+ SqlDouble Test2 = new SqlDouble (-65E+64);
+ SqlDouble Test3 = new SqlDouble (5E+64);
+ SqlDouble Test4 = new SqlDouble (5E+108);
+ SqlDouble TestMax = new SqlDouble (SqlDouble.MaxValue.Value);
+
+ // Add()
+ AssertEquals ("#D01A", 15E+108, SqlDouble.Add (Test1, Test0).Value);
+ AssertEquals ("#D02A", 1.5E+109, SqlDouble.Add (Test1, Test2).Value);
+
+ try {
+ SqlDouble test = SqlDouble.Add (SqlDouble.MaxValue, SqlDouble.MaxValue);
+ Fail ("#D03A");
+ } catch (Exception e) {
+ AssertEquals ("#D04A", typeof (OverflowException), e.GetType ());
+ }
+
+ // Divide()
+ AssertEquals ("#D01B", (SqlDouble)3, SqlDouble.Divide (Test1, Test4));
+ AssertEquals ("#D02B", -13d, SqlDouble.Divide (Test2, Test3).Value);
+
+ try {
+ SqlDouble test = SqlDouble.Divide(Test1, Test0).Value;
+ Fail ("#D03B");
+ } catch(Exception e) {
+ AssertEquals ("#D04B", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // Multiply()
+ AssertEquals ("#D01D", (double)(75E+216), SqlDouble.Multiply (Test1, Test4).Value);
+ AssertEquals ("#D02D", (double)0, SqlDouble.Multiply (Test1, Test0).Value);
+
+ try {
+ SqlDouble test = SqlDouble.Multiply (TestMax, Test1);
+ Fail ("#D03D");
+ } catch (Exception e) {
+ AssertEquals ("#D04D", typeof (OverflowException), e.GetType ());
+ }
+
+
+ // Subtract()
+ AssertEquals ("#D01F", (double)1.5E+109, SqlDouble.Subtract (Test1, Test3).Value);
+
+ try {
+ SqlDouble test = SqlDouble.Subtract(SqlDouble.MinValue, SqlDouble.MaxValue);
+ Fail ("D02F");
+ } catch (Exception e) {
+ AssertEquals ("#D03F", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestCompareTo()
+ {
+ SqlDouble Test1 = new SqlDouble (4e64);
+ SqlDouble Test11 = new SqlDouble (4e64);
+ SqlDouble Test2 = new SqlDouble (-9e34);
+ SqlDouble Test3 = new SqlDouble (10000);
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("#E01", Test1.CompareTo (Test3) > 0);
+ Assert ("#E02", Test2.CompareTo (Test3) < 0);
+ Assert ("#E03", Test1.CompareTo (Test11) == 0);
+ Assert ("#E04", Test11.CompareTo (SqlDouble.Null) > 0);
+
+ try {
+ Test1.CompareTo (TestString);
+ Fail("#E05");
+ } catch(Exception e) {
+ AssertEquals ("#E06", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethods()
+ {
+ SqlDouble Test0 = new SqlDouble (0);
+ SqlDouble Test1 = new SqlDouble (1.58e30);
+ SqlDouble Test2 = new SqlDouble (1.8e180);
+ SqlDouble Test22 = new SqlDouble (1.8e180);
+
+ Assert ("#F01", !Test0.Equals (Test1));
+ Assert ("#F02", !Test1.Equals (Test2));
+ Assert ("#F03", !Test2.Equals (new SqlString ("TEST")));
+ Assert ("#F04", Test2.Equals (Test22));
+
+ // Static Equals()-method
+ Assert ("#F05", SqlDouble.Equals (Test2, Test22).Value);
+ Assert ("#F06", !SqlDouble.Equals (Test1, Test2).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ SqlDouble Test15 = new SqlDouble (15);
+
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#G01", Test15.GetHashCode (), Test15.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ SqlDouble Test = new SqlDouble (84);
+ AssertEquals ("#H01", "System.Data.SqlTypes.SqlDouble", Test.GetType ().ToString ());
+ AssertEquals ("#H02", "System.Double", Test.Value.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ SqlDouble Test1 = new SqlDouble (1e100);
+ SqlDouble Test11 = new SqlDouble (1e100);
+ SqlDouble Test2 = new SqlDouble (64e164);
+
+ // GreateThan ()
+ Assert ("#I01", !SqlDouble.GreaterThan (Test1, Test2).Value);
+ Assert ("#I02", SqlDouble.GreaterThan (Test2, Test1).Value);
+ Assert ("#I03", !SqlDouble.GreaterThan (Test1, Test11).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("#I04", !SqlDouble.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#I05", SqlDouble.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#I06", SqlDouble.GreaterThanOrEqual (Test1, Test11).Value);
+ }
+
+ public void TestLessers()
+ {
+ SqlDouble Test1 = new SqlDouble (1.8e100);
+ SqlDouble Test11 = new SqlDouble (1.8e100);
+ SqlDouble Test2 = new SqlDouble (64e164);
+
+ // LessThan()
+ Assert ("#J01", !SqlDouble.LessThan (Test1, Test11).Value);
+ Assert ("#J02", !SqlDouble.LessThan (Test2, Test1).Value);
+ Assert ("#J03", SqlDouble.LessThan (Test11, Test2).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#J04", SqlDouble.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#J05", !SqlDouble.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#J06", SqlDouble.LessThanOrEqual (Test11, Test1).Value);
+ Assert ("#J07", SqlDouble.LessThanOrEqual (Test11, SqlDouble.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ SqlDouble Test1 = new SqlDouble (1280000000001);
+ SqlDouble Test2 = new SqlDouble (128e10);
+ SqlDouble Test22 = new SqlDouble (128e10);
+
+ Assert ("#K01", SqlDouble.NotEquals (Test1, Test2).Value);
+ Assert ("#K02", SqlDouble.NotEquals (Test2, Test1).Value);
+ Assert ("#K03", SqlDouble.NotEquals (Test22, Test1).Value);
+ Assert ("#K04", !SqlDouble.NotEquals (Test22, Test2).Value);
+ Assert ("#K05", !SqlDouble.NotEquals (Test2, Test22).Value);
+ Assert ("#K06", SqlDouble.NotEquals (SqlDouble.Null, Test22).IsNull);
+ Assert ("#K07", SqlDouble.NotEquals (SqlDouble.Null, Test22).IsNull);
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlDouble.Parse (null);
+ Fail ("#L01");
+ } catch (Exception e) {
+ AssertEquals ("#L02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlDouble.Parse ("not-a-number");
+ Fail ("#L03");
+ } catch (Exception e) {
+
+ AssertEquals ("#L04", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlDouble.Parse ("9e400");
+ Fail ("#L05");
+ } catch (Exception e) {
+ AssertEquals ("#L06", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals("#L07", (double)150, SqlDouble.Parse ("150").Value);
+ }
+
+ public void TestConversions()
+ {
+ SqlDouble Test0 = new SqlDouble (0);
+ SqlDouble Test1 = new SqlDouble (250);
+ SqlDouble Test2 = new SqlDouble (64e64);
+ SqlDouble Test3 = new SqlDouble (64e164);
+ SqlDouble TestNull = SqlDouble.Null;
+
+ // ToSqlBoolean ()
+ Assert ("#M01A", Test1.ToSqlBoolean ().Value);
+ Assert ("#M02A", !Test0.ToSqlBoolean ().Value);
+ Assert ("#M03A", TestNull.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ AssertEquals ("#M01B", (byte)250, Test1.ToSqlByte ().Value);
+ AssertEquals ("#M02B", (byte)0, Test0.ToSqlByte ().Value);
+
+ try {
+ SqlByte b = (byte)Test2.ToSqlByte ();
+ Fail ("#M03B");
+ } catch (Exception e) {
+ AssertEquals ("#M04B", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDecimal ()
+ AssertEquals ("#M01C", (decimal)250, Test1.ToSqlDecimal ().Value);
+ AssertEquals ("#M02C", (decimal)0, Test0.ToSqlDecimal ().Value);
+
+ try {
+ SqlDecimal test = Test3.ToSqlDecimal ().Value;
+ Fail ("#M03C");
+ } catch (Exception e) {
+ AssertEquals ("#M04C", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt16 ()
+ AssertEquals ("#M01D", (short)250, Test1.ToSqlInt16 ().Value);
+ AssertEquals ("#M02D", (short)0, Test0.ToSqlInt16 ().Value);
+
+ try {
+ SqlInt16 test = Test2.ToSqlInt16().Value;
+ Fail ("#M03D");
+ } catch (Exception e) {
+ AssertEquals ("#M04D", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt32 ()
+ AssertEquals ("#M01E", (int)250, Test1.ToSqlInt32 ().Value);
+ AssertEquals ("#M02E", (int)0, Test0.ToSqlInt32 ().Value);
+
+ try {
+ SqlInt32 test = Test2.ToSqlInt32 ().Value;
+ Fail ("#M03E");
+ } catch (Exception e) {
+ AssertEquals ("#M04E", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt64 ()
+ AssertEquals ("#M01F", (long)250, Test1.ToSqlInt64 ().Value);
+ AssertEquals ("#M02F", (long)0, Test0.ToSqlInt64 ().Value);
+
+ try {
+ SqlInt64 test = Test2.ToSqlInt64 ().Value;
+ Fail ("#M03F");
+ } catch (Exception e) {
+ AssertEquals ("#M04F", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlMoney ()
+ AssertEquals ("#M01G", (decimal)250, Test1.ToSqlMoney ().Value);
+ AssertEquals ("#M02G", (decimal)0, Test0.ToSqlMoney ().Value);
+
+ try {
+ SqlMoney test = Test2.ToSqlMoney ().Value;
+ Fail ("#M03G");
+ } catch (Exception e) {
+ AssertEquals ("#M04G", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlSingle ()
+ AssertEquals ("#M01H", (float)250, Test1.ToSqlSingle ().Value);
+ AssertEquals ("#M02H", (float)0, Test0.ToSqlSingle ().Value);
+
+ try {
+ SqlSingle test = Test2.ToSqlSingle().Value;
+ Fail ("#MO3H");
+ } catch (Exception e) {
+ AssertEquals ("#M04H", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlString ()
+ AssertEquals ("#M01I", "250", Test1.ToSqlString ().Value);
+ AssertEquals ("#M02I", "0", Test0.ToSqlString ().Value);
+ AssertEquals ("#M03I", "6,4E+65", Test2.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("#M01J", "250", Test1.ToString ());
+ AssertEquals ("#M02J", "0", Test0.ToString ());
+ AssertEquals ("#M03J", "6,4E+65", Test2.ToString ());
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ SqlDouble Test0 = new SqlDouble (0);
+ SqlDouble Test1 = new SqlDouble (24E+100);
+ SqlDouble Test2 = new SqlDouble (64E+164);
+ SqlDouble Test3 = new SqlDouble (12E+100);
+ SqlDouble Test4 = new SqlDouble (1E+10);
+ SqlDouble Test5 = new SqlDouble (2E+10);
+
+ // "+"-operator
+ AssertEquals ("#N01", (SqlDouble)3E+10, Test4 + Test5);
+
+ try {
+ SqlDouble test = SqlDouble.MaxValue + SqlDouble.MaxValue;
+ Fail ("#N02");
+ } catch (Exception e) {
+ AssertEquals ("#N03", typeof (OverflowException), e.GetType ());
+ }
+
+ // "/"-operator
+ AssertEquals ("#N04", (SqlDouble)2, Test1 / Test3);
+
+ try {
+ SqlDouble test = Test3 / Test0;
+ Fail ("#N05");
+ } catch (Exception e) {
+ AssertEquals ("#N06", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // "*"-operator
+ AssertEquals ("#N07", (SqlDouble)2e20, Test4 * Test5);
+
+ try {
+ SqlDouble test = SqlDouble.MaxValue * Test1;
+ Fail ("#N08");
+ } catch (Exception e) {
+ AssertEquals ("#N09", typeof (OverflowException), e.GetType ());
+ }
+
+ // "-"-operator
+ AssertEquals ("#N10", (SqlDouble)12e100, Test1 - Test3);
+
+ try {
+ SqlDouble test = SqlDouble.MinValue - SqlDouble.MaxValue;
+ Fail ("#N11");
+ } catch (Exception e) {
+ AssertEquals ("#N12", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ SqlDouble Test1 = new SqlDouble (1E+164);
+ SqlDouble Test2 = new SqlDouble (9.7E+100);
+ SqlDouble Test22 = new SqlDouble (9.7E+100);
+ SqlDouble Test3 = new SqlDouble (2E+200);
+
+ // == -operator
+ Assert ("#O01", (Test2 == Test22).Value);
+ Assert ("#O02", !(Test1 == Test2).Value);
+ Assert ("#O03", (Test1 == SqlDouble.Null).IsNull);
+
+ // != -operator
+ Assert ("#O04", !(Test2 != Test22).Value);
+ Assert ("#O05", (Test2 != Test3).Value);
+ Assert ("#O06", (Test1 != Test3).Value);
+ Assert ("#O07", (Test1 != SqlDouble.Null).IsNull);
+
+ // > -operator
+ Assert ("#O08", (Test1 > Test2).Value);
+ Assert ("#O09", !(Test1 > Test3).Value);
+ Assert ("#O10", !(Test2 > Test22).Value);
+ Assert ("#O11", (Test1 > SqlDouble.Null).IsNull);
+
+ // >= -operator
+ Assert ("#O12", !(Test1 >= Test3).Value);
+ Assert ("#O13", (Test3 >= Test1).Value);
+ Assert ("#O14", (Test2 >= Test22).Value);
+ Assert ("#O15", (Test1 >= SqlDouble.Null).IsNull);
+
+ // < -operator
+ Assert ("#O16", !(Test1 < Test2).Value);
+ Assert ("#O17", (Test1 < Test3).Value);
+ Assert ("#O18", !(Test2 < Test22).Value);
+ Assert ("#O19", (Test1 < SqlDouble.Null).IsNull);
+
+ // <= -operator
+ Assert ("#O20", (Test1 <= Test3).Value);
+ Assert ("#O21", !(Test3 <= Test1).Value);
+ Assert ("#O22", (Test2 <= Test22).Value);
+ Assert ("#O23", (Test1 <= SqlDouble.Null).IsNull);
+ }
+
+ public void TestUnaryNegation()
+ {
+ SqlDouble Test = new SqlDouble (2000000001);
+ SqlDouble TestNeg = new SqlDouble (-3000);
+
+ SqlDouble Result = -Test;
+ AssertEquals ("#P01", (double)(-2000000001), Result.Value);
+
+ Result = -TestNeg;
+ AssertEquals ("#P02", (double)3000, Result.Value);
+ }
+
+ public void TestSqlBooleanToSqlDouble()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+ SqlDouble Result;
+
+ Result = (SqlDouble)TestBoolean;
+
+ AssertEquals ("#Q01", (double)1, Result.Value);
+
+ Result = (SqlDouble)SqlBoolean.Null;
+ Assert ("#Q02", Result.IsNull);
+ }
+
+ public void TestSqlDoubleToDouble()
+ {
+ SqlDouble Test = new SqlDouble (12e12);
+ Double Result = (double)Test;
+ AssertEquals ("#R01", 12e12, Result);
+ }
+
+ public void TestSqlStringToSqlDouble()
+ {
+ SqlString TestString = new SqlString ("Test string");
+ SqlString TestString100 = new SqlString ("100");
+
+ AssertEquals ("#S01", (double)100, ((SqlDouble)TestString100).Value);
+
+ try {
+ SqlDouble test = (SqlDouble)TestString;
+ Fail ("#S02");
+ } catch(Exception e) {
+ AssertEquals ("#S03", typeof (FormatException), e.GetType ());
+ }
+ }
+
+ public void TestDoubleToSqlDouble()
+ {
+ double Test1 = 5e64;
+ SqlDouble Result = (SqlDouble)Test1;
+ AssertEquals ("#T01", 5e64, Result.Value);
+ }
+
+ public void TestByteToSqlDouble()
+ {
+ short TestShort = 14;
+ AssertEquals ("#U01", (double)14, ((SqlDouble)TestShort).Value);
+ }
+
+ public void TestSqlDecimalToSqlDouble()
+ {
+ SqlDecimal TestDecimal64 = new SqlDecimal (64);
+
+ AssertEquals ("#V01", (double)64, ((SqlDouble)TestDecimal64).Value);
+ AssertEquals ("#V02", SqlDouble.Null, ((SqlDouble)SqlDecimal.Null));
+ }
+
+ public void TestSqlIntToSqlDouble()
+ {
+ SqlInt16 Test64 = new SqlInt16 (64);
+ SqlInt32 Test640 = new SqlInt32 (640);
+ SqlInt64 Test64000 = new SqlInt64 (64000);
+ AssertEquals ("#W01", (double)64, ((SqlDouble)Test64).Value);
+ AssertEquals ("#W02", (double)640, ((SqlDouble)Test640).Value);
+ AssertEquals ("#W03", (double)64000, ((SqlDouble)Test64000).Value);
+ }
+
+
+ public void TestSqlMoneyToSqlDouble()
+ {
+ SqlMoney TestMoney64 = new SqlMoney(64);
+ AssertEquals ("#X01", (double)64, ((SqlDouble)TestMoney64).Value);
+ }
+
+ public void TestSqlSingleToSqlDouble()
+ {
+ SqlSingle TestSingle64 = new SqlSingle (64);
+ AssertEquals ("#Y01", (double)64, ((SqlDouble)TestSingle64).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlGuidTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlGuidTest.cs
new file mode 100644
index 00000000000..26451ec99f2
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlGuidTest.cs
@@ -0,0 +1,316 @@
+//
+// SqlGuidTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlGuid
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlGuidTest : TestCase {
+
+ // 00000a01-0000-0000-0000-000000000000
+ private SqlGuid Test1;
+
+ // 00000f64-0000-0000-0000-000000000000
+ private SqlGuid Test2;
+ private SqlGuid Test3;
+
+ // 0000fafa-0000-0000-0000-000000000000
+ private SqlGuid Test4;
+
+ public SqlGuidTest() : base ("System.Data.SqlTypes.SqlGuid") {}
+ public SqlGuidTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ byte [] b1 = new byte [16];
+ byte [] b2 = new byte [16];
+ byte [] b3 = new byte [16];
+ byte [] b4 = new byte [16];
+
+ b1 [0] = 1;
+ b1 [1] = 10;
+ b2 [0] = 100;
+ b2 [1] = 15;
+ b3 [0] = 100;
+ b3 [1] = 15;
+ b4 [0] = 250;
+ b4 [1] = 250;
+
+ Test1 = new SqlGuid (b1);
+ Test2 = new SqlGuid (b2);
+ Test3 = new SqlGuid (b3);
+ Test4 = new SqlGuid (b4);
+ }
+
+
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlGuid));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ // SqlGuid (Byte[])
+ byte [] b = new byte [16];
+ b [0] = 100;
+ b [1] = 200;
+
+ try {
+ SqlGuid Test = new SqlGuid (b);
+
+ // SqlGuid (Guid)
+ Guid TestGuid = new Guid (b);
+ Test = new SqlGuid (TestGuid);
+
+ // SqlGuid (string)
+ Test = new SqlGuid ("12345678-1234-1234-1234-123456789012");
+
+ // SqlGuid (int, short, short, byte, byte, byte, byte, byte, byte, byte, byte)
+ Test = new SqlGuid (10, 1, 2, 13, 14, 15, 16, 17, 19, 20 ,21);
+
+ } catch (Exception e) {
+ Fail ("#A01 " + e);
+ }
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ Assert ("#B01", SqlGuid.Null.IsNull);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ Guid ResultGuid = new Guid ("00000f64-0000-0000-0000-000000000000");
+ Assert ("#C01", !Test1.IsNull);
+ Assert ("#C02", SqlGuid.Null.IsNull);
+ AssertEquals ("#C03", ResultGuid, Test2.Value);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestCompareTo()
+ {
+ String TestString = "This is a test string";
+ Assert ("#D01", Test1.CompareTo (Test3) < 0);
+ Assert ("#D02", Test4.CompareTo (Test1) > 0);
+ Assert ("#D03", Test3.CompareTo (Test2) == 0);
+ Assert ("#D04", Test4.CompareTo (SqlGuid.Null) > 0);
+
+ try {
+ Test1.CompareTo (TestString);
+ Fail("#D05");
+ } catch(Exception e) {
+ AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethods()
+ {
+ Assert ("#E01", !Test1.Equals (Test2));
+ Assert ("#E02", !Test2.Equals (Test4));
+ Assert ("#E03", !Test2.Equals (new SqlString ("TEST")));
+ Assert ("#E04", Test2.Equals (Test3));
+
+ // Static Equals()-method
+ Assert ("#E05", SqlGuid.Equals (Test2, Test3).Value);
+ Assert ("#E06", !SqlGuid.Equals (Test1, Test2).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ AssertEquals ("#F01", Test1.GetHashCode (), Test1.GetHashCode ());
+ Assert ("#F02", Test1.GetHashCode () != Test2.GetHashCode ());
+ AssertEquals ("#F02", Test3.GetHashCode (), Test2.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ AssertEquals ("#G01", "System.Data.SqlTypes.SqlGuid", Test1.GetType ().ToString ());
+ AssertEquals ("#G02", "System.Guid", Test3.Value.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ // GreateThan ()
+ Assert ("#H01", !SqlGuid.GreaterThan (Test1, Test2).Value);
+ Assert ("#H02", SqlGuid.GreaterThan (Test2, Test1).Value);
+ Assert ("#H03", !SqlGuid.GreaterThan (Test2, Test3).Value);
+ // GreaterTharOrEqual ()
+ Assert ("#H04", !SqlGuid.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#H05", SqlGuid.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#H06", SqlGuid.GreaterThanOrEqual (Test2, Test3).Value);
+ }
+
+ public void TestLessers()
+ {
+ // LessThan()
+ Assert ("#I01", !SqlGuid.LessThan (Test2, Test3).Value);
+ Assert ("#I02", !SqlGuid.LessThan (Test2, Test1).Value);
+ Assert ("#I03", SqlGuid.LessThan (Test1, Test2).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#I04", SqlGuid.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#I05", !SqlGuid.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#I06", SqlGuid.LessThanOrEqual (Test2, Test3).Value);
+ Assert ("#I07", SqlGuid.LessThanOrEqual (Test4, SqlGuid.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ Assert ("#J01", SqlGuid.NotEquals (Test1, Test2).Value);
+ Assert ("#J02", SqlGuid.NotEquals (Test2, Test1).Value);
+ Assert ("#J03", SqlGuid.NotEquals (Test3, Test1).Value);
+ Assert ("#J04", !SqlGuid.NotEquals (Test3, Test2).Value);
+ Assert ("#J05", SqlGuid.NotEquals (SqlGuid.Null, Test2).IsNull);
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlGuid.Parse (null);
+ Fail ("#K01");
+ } catch (Exception e) {
+ AssertEquals ("#K02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlGuid.Parse ("not-a-number");
+ Fail ("#K03");
+ } catch (Exception e) {
+ AssertEquals ("#K04", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlGuid.Parse ("9e400");
+ Fail ("#K05");
+ } catch (Exception e) {
+ AssertEquals ("#K06", typeof (FormatException), e.GetType ());
+ }
+
+ AssertEquals("#K07", new Guid("87654321-0000-0000-0000-000000000000"),
+ SqlGuid.Parse ("87654321-0000-0000-0000-000000000000").Value);
+ }
+
+ public void TestConversions()
+ {
+ // ToByteArray ()
+ AssertEquals ("#L01", (byte)1, Test1.ToByteArray () [0]);
+ AssertEquals ("#L02", (byte)15, Test2.ToByteArray () [1]);
+
+ // ToSqlBinary ()
+ byte [] b = new byte [2];
+ b [0] = 100;
+ b [1] = 15;
+
+ AssertEquals ("#L03", new SqlBinary (b), Test3.ToSqlBinary ());
+
+ // ToSqlString ()
+ AssertEquals ("#L04", "00000a01-0000-0000-0000-000000000000",
+ Test1.ToSqlString ().Value);
+ AssertEquals ("#L05", "0000fafa-0000-0000-0000-000000000000",
+ Test4.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("#L06", "00000a01-0000-0000-0000-000000000000",
+ Test1.ToString ());
+ AssertEquals ("#L07", "0000fafa-0000-0000-0000-000000000000",
+ Test4.ToString ());
+ }
+
+ // OPERATORS
+
+ public void TestThanOrEqualOperators()
+ {
+ // == -operator
+ Assert ("#M01", (Test3 == Test2).Value);
+ Assert ("#M02", !(Test1 == Test2).Value);
+ Assert ("#M03", (Test1 == SqlGuid.Null).IsNull);
+
+ // != -operator
+ Assert ("#M04", !(Test2 != Test3).Value);
+ Assert ("#M05", (Test1 != Test3).Value);
+ Assert ("#M06", (Test1 != SqlGuid.Null).IsNull);
+
+ // > -operator
+ Assert ("#M07", (Test2 > Test1).Value);
+ Assert ("#M08", !(Test1 > Test3).Value);
+ Assert ("#M09", !(Test3 > Test2).Value);
+ Assert ("#M10", (Test1 > SqlGuid.Null).IsNull);
+
+ // >= -operator
+ Assert ("#M12", !(Test1 >= Test3).Value);
+ Assert ("#M13", (Test3 >= Test1).Value);
+ Assert ("#M14", (Test3 >= Test2).Value);
+ Assert ("#M15", (Test1 >= SqlGuid.Null).IsNull);
+
+ // < -operator
+ Assert ("#M16", !(Test2 < Test1).Value);
+ Assert ("#M17", (Test1 < Test3).Value);
+ Assert ("#M18", !(Test2 < Test3).Value);
+ Assert ("#M19", (Test1 < SqlGuid.Null).IsNull);
+
+ // <= -operator
+ Assert ("#M20", (Test1 <= Test3).Value);
+ Assert ("#M21", !(Test3 <= Test1).Value);
+ Assert ("#M22", (Test2 <= Test3).Value);
+ Assert ("#M23", (Test1 <= SqlGuid.Null).IsNull);
+ }
+
+ public void TestSqlBinaryToSqlGuid()
+ {
+ byte [] b = new byte [16];
+ b [0] = 100;
+ b [1] = 200;
+ SqlBinary TestBinary = new SqlBinary (b);
+
+ AssertEquals ("#N01", new Guid("0000c864-0000-0000-0000-000000000000"),
+ ((SqlGuid)TestBinary).Value);
+ }
+
+
+ public void TestSqlGuidToGuid()
+ {
+ AssertEquals ("#O01", new Guid("00000a01-0000-0000-0000-000000000000"),
+ (Guid)Test1);
+ AssertEquals ("#O02", new Guid("00000f64-0000-0000-0000-000000000000"),
+ (Guid)Test2);
+ }
+
+ public void TestSqlStringToSqlGuid()
+ {
+ SqlString TestString = new SqlString ("Test string");
+ SqlString TestString100 = new SqlString ("0000c864-0000-0000-0000-000000000000");
+
+ AssertEquals ("#P01", new Guid("0000c864-0000-0000-0000-000000000000"),
+ ((SqlGuid)TestString100).Value);
+
+ try {
+ SqlGuid test = (SqlGuid)TestString;
+ Fail ("#P02");
+ } catch(Exception e) {
+ AssertEquals ("#P03", typeof (FormatException), e.GetType ());
+ }
+ }
+
+ public void TestGuidToSqlGuid()
+ {
+ Guid TestGuid = new Guid("0000c864-0000-0000-0000-000007650000");
+ AssertEquals ("#Q01", new SqlGuid("0000c864-0000-0000-0000-000007650000"),
+ (SqlGuid)TestGuid);
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt16Test.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt16Test.cs
new file mode 100644
index 00000000000..e3b8c0cd713
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt16Test.cs
@@ -0,0 +1,645 @@
+//
+// SqlInt16Test.cs - NUnit Test Cases for System.Data.SqlTypes.SqlInt16
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlInt16Test : TestCase {
+
+ public SqlInt16Test() : base ("System.Data.SqlTypes.SqlInt16") {}
+ public SqlInt16Test(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlInt16));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ SqlInt16 TestShort = new SqlInt16 (29);
+ AssertEquals ("Test#1", (short)29, TestShort.Value);
+
+ TestShort = new SqlInt16 (-9000);
+ AssertEquals ("Test#2", (short)-9000, TestShort.Value);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ AssertEquals ("Test#1", (SqlInt16)32767, SqlInt16.MaxValue);
+ AssertEquals ("Test#2", (SqlInt16)(-32768), SqlInt16.MinValue);
+ Assert ("Test#3", SqlInt16.Null.IsNull);
+ AssertEquals ("Test#4", (short)0, SqlInt16.Zero.Value);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ SqlInt16 Test5443 = new SqlInt16 (5443);
+ SqlInt16 Test1 = new SqlInt16 (1);
+ Assert ("Test#1", SqlInt16.Null.IsNull);
+ AssertEquals ("Test#2", (short)5443, Test5443.Value);
+ AssertEquals ("Test#3", (short)1, Test1.Value);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestArithmeticMethods()
+ {
+ SqlInt16 Test64 = new SqlInt16 (64);
+ SqlInt16 Test0 = new SqlInt16 (0);
+ SqlInt16 Test164 = new SqlInt16 (164);
+ SqlInt16 TestMax = new SqlInt16 (SqlInt16.MaxValue.Value);
+
+ // Add()
+ AssertEquals ("Test#1", (short)64, SqlInt16.Add (Test64, Test0).Value);
+ AssertEquals ("Test#2", (short)228, SqlInt16.Add (Test64, Test164).Value);
+ AssertEquals ("Test#3", (short)164, SqlInt16.Add (Test0, Test164).Value);
+ AssertEquals ("Test#4", (short)SqlInt16.MaxValue, SqlInt16.Add (TestMax, Test0).Value);
+
+ try {
+ SqlInt16.Add (TestMax, Test64);
+ Fail ("Test#5");
+ } catch (Exception e) {
+ AssertEquals ("Test#6", typeof (OverflowException), e.GetType ());
+ }
+
+ // Divide()
+ AssertEquals ("Test#7", (short)2, SqlInt16.Divide (Test164, Test64).Value);
+ AssertEquals ("Test#8", (short)0, SqlInt16.Divide (Test64, Test164).Value);
+ try {
+ SqlInt16.Divide(Test64, Test0);
+ Fail ("Test#9");
+ } catch(Exception e) {
+ AssertEquals ("Test#10", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // Mod()
+ AssertEquals ("Test#11", (SqlInt16)36, SqlInt16.Mod (Test164, Test64));
+ AssertEquals ("Test#12", (SqlInt16)64, SqlInt16.Mod (Test64, Test164));
+
+ // Multiply()
+ AssertEquals ("Test#13", (short)10496, SqlInt16.Multiply (Test64, Test164).Value);
+ AssertEquals ("Test#14", (short)0, SqlInt16.Multiply (Test64, Test0).Value);
+
+ try {
+ SqlInt16.Multiply (TestMax, Test64);
+ Fail ("Test#15");
+ } catch(Exception e) {
+ AssertEquals ("Test#16", typeof (OverflowException), e.GetType ());
+ }
+
+ // Subtract()
+ AssertEquals ("Test#17", (short)100, SqlInt16.Subtract (Test164, Test64).Value);
+
+ try {
+ SqlInt16.Subtract (SqlInt16.MinValue, Test164);
+ Fail("Test#18");
+ } catch(Exception e) {
+ AssertEquals ("Test#19", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestBitwiseMethods()
+ {
+ short MaxValue = SqlInt16.MaxValue.Value;
+ SqlInt16 TestInt = new SqlInt16 (0);
+ SqlInt16 TestIntMax = new SqlInt16 (MaxValue);
+ SqlInt16 TestInt2 = new SqlInt16 (10922);
+ SqlInt16 TestInt3 = new SqlInt16 (21845);
+
+ // BitwiseAnd
+ AssertEquals ("Test#1", (short)21845, SqlInt16.BitwiseAnd (TestInt3, TestIntMax).Value);
+ AssertEquals ("Test#2", (short)0, SqlInt16.BitwiseAnd (TestInt2, TestInt3).Value);
+ AssertEquals ("Test#3", (short)10922, SqlInt16.BitwiseAnd (TestInt2, TestIntMax).Value);
+
+ //BitwiseOr
+ AssertEquals ("Test#4", (short)MaxValue, SqlInt16.BitwiseOr (TestInt2, TestInt3).Value);
+ AssertEquals ("Test#5", (short)21845, SqlInt16.BitwiseOr (TestInt, TestInt3).Value);
+ AssertEquals ("Test#6", (short)MaxValue, SqlInt16.BitwiseOr (TestIntMax, TestInt2).Value);
+ }
+
+ public void TestCompareTo()
+ {
+ SqlInt16 TestInt4000 = new SqlInt16 (4000);
+ SqlInt16 TestInt4000II = new SqlInt16 (4000);
+ SqlInt16 TestInt10 = new SqlInt16 (10);
+ SqlInt16 TestInt10000 = new SqlInt16 (10000);
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("Test#1", TestInt4000.CompareTo (TestInt10) > 0);
+ Assert ("Test#2", TestInt10.CompareTo (TestInt4000) < 0);
+ Assert ("Test#3", TestInt4000II.CompareTo (TestInt4000) == 0);
+ Assert ("Test#4", TestInt4000II.CompareTo (SqlInt16.Null) > 0);
+
+ try {
+ TestInt10.CompareTo (TestString);
+ Fail ("Test#5");
+ } catch(Exception e) {
+ AssertEquals ("Test#6", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethod()
+ {
+ SqlInt16 Test0 = new SqlInt16 (0);
+ SqlInt16 Test158 = new SqlInt16 (158);
+ SqlInt16 Test180 = new SqlInt16 (180);
+ SqlInt16 Test180II = new SqlInt16 (180);
+
+ Assert ("Test#1", !Test0.Equals (Test158));
+ Assert ("Test#2", !Test158.Equals (Test180));
+ Assert ("Test#3", !Test180.Equals (new SqlString ("TEST")));
+ Assert ("Test#4", Test180.Equals (Test180II));
+ }
+
+ public void TestStaticEqualsMethod()
+ {
+ SqlInt16 Test34 = new SqlInt16 (34);
+ SqlInt16 Test34II = new SqlInt16 (34);
+ SqlInt16 Test15 = new SqlInt16 (15);
+
+ Assert ("Test#1", SqlInt16.Equals (Test34, Test34II).Value);
+ Assert ("Test#2", !SqlInt16.Equals (Test34, Test15).Value);
+ Assert ("Test#3", !SqlInt16.Equals (Test15, Test34II).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ SqlInt16 Test15 = new SqlInt16 (15);
+
+ // FIXME: Better way to test GetHashCode()-methods
+ AssertEquals ("Test#1", Test15.GetHashCode (), Test15.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ SqlInt16 Test = new SqlInt16 (84);
+ AssertEquals ("Test#1", "System.Data.SqlTypes.SqlInt16", Test.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ SqlInt16 Test10 = new SqlInt16 (10);
+ SqlInt16 Test10II = new SqlInt16 (10);
+ SqlInt16 Test110 = new SqlInt16 (110);
+
+ // GreateThan ()
+ Assert ("Test#1", !SqlInt16.GreaterThan (Test10, Test110).Value);
+ Assert ("Test#2", SqlInt16.GreaterThan (Test110, Test10).Value);
+ Assert ("Test#3", !SqlInt16.GreaterThan (Test10II, Test10).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("Test#4", !SqlInt16.GreaterThanOrEqual (Test10, Test110).Value);
+ Assert ("Test#5", SqlInt16.GreaterThanOrEqual (Test110, Test10).Value);
+ Assert ("Test#6", SqlInt16.GreaterThanOrEqual (Test10II, Test10).Value);
+ }
+
+ public void TestLessers()
+ {
+ SqlInt16 Test10 = new SqlInt16 (10);
+ SqlInt16 Test10II = new SqlInt16 (10);
+ SqlInt16 Test110 = new SqlInt16 (110);
+
+ // LessThan()
+ Assert ("Test#1", SqlInt16.LessThan (Test10, Test110).Value);
+ Assert ("Test#2", !SqlInt16.LessThan (Test110, Test10).Value);
+ Assert ("Test#3", !SqlInt16.LessThan (Test10II, Test10).Value);
+
+ // LessThanOrEqual ()
+ Assert ("Test#4", SqlInt16.LessThanOrEqual (Test10, Test110).Value);
+ Assert ("Test#5", !SqlInt16.LessThanOrEqual (Test110, Test10).Value);
+ Assert ("Test#6", SqlInt16.LessThanOrEqual (Test10II, Test10).Value);
+ Assert ("Test#7", SqlInt16.LessThanOrEqual (Test10II, SqlInt16.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ SqlInt16 Test12 = new SqlInt16 (12);
+ SqlInt16 Test128 = new SqlInt16 (128);
+ SqlInt16 Test128II = new SqlInt16 (128);
+
+ Assert ("Test#1", SqlInt16.NotEquals (Test12, Test128).Value);
+ Assert ("Test#2", SqlInt16.NotEquals (Test128, Test12).Value);
+ Assert ("Test#3", SqlInt16.NotEquals (Test128II, Test12).Value);
+ Assert ("Test#4", !SqlInt16.NotEquals (Test128II, Test128).Value);
+ Assert ("Test#5", !SqlInt16.NotEquals (Test128, Test128II).Value);
+ Assert ("Test#6", SqlInt16.NotEquals (SqlInt16.Null, Test128II).IsNull);
+ Assert ("Test#7", SqlInt16.NotEquals (SqlInt16.Null, Test128II).IsNull);
+ }
+
+ public void TestOnesComplement()
+ {
+ SqlInt16 Test12 = new SqlInt16(12);
+ SqlInt16 Test128 = new SqlInt16(128);
+
+ AssertEquals ("Test#1", (SqlInt16)(-13), SqlInt16.OnesComplement (Test12));
+ AssertEquals ("Test#2", (SqlInt16)(-129), SqlInt16.OnesComplement (Test128));
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlInt16.Parse (null);
+ Fail ("Test#1");
+ } catch (Exception e) {
+ AssertEquals ("Test#2", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlInt16.Parse ("not-a-number");
+ Fail ("Test#3");
+ } catch (Exception e) {
+ AssertEquals ("Test#4", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ int OverInt = (int)SqlInt16.MaxValue + 1;
+ SqlInt16.Parse (OverInt.ToString ());
+ Fail ("Test#5");
+ } catch (Exception e) {
+ AssertEquals ("Test#6", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals("Test#7", (short)150, SqlInt16.Parse ("150").Value);
+ }
+
+ public void TestConversions()
+ {
+ SqlInt16 Test12 = new SqlInt16 (12);
+ SqlInt16 Test0 = new SqlInt16 (0);
+ SqlInt16 TestNull = SqlInt16.Null;
+ SqlInt16 Test1000 = new SqlInt16 (1000);
+ SqlInt16 Test288 = new SqlInt16(288);
+
+ // ToSqlBoolean ()
+ Assert ("TestA#1", Test12.ToSqlBoolean ().Value);
+ Assert ("TestA#2", !Test0.ToSqlBoolean ().Value);
+ Assert ("TestA#3", TestNull.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ AssertEquals ("TestB#1", (byte)12, Test12.ToSqlByte ().Value);
+ AssertEquals ("TestB#2", (byte)0, Test0.ToSqlByte ().Value);
+
+ try {
+ SqlByte b = (byte)Test1000.ToSqlByte ();
+ Fail ("TestB#4");
+ } catch (Exception e) {
+ AssertEquals ("TestB#5", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDecimal ()
+ AssertEquals ("TestC#1", (decimal)12, Test12.ToSqlDecimal ().Value);
+ AssertEquals ("TestC#2", (decimal)0, Test0.ToSqlDecimal ().Value);
+ AssertEquals ("TestC#3", (decimal)288, Test288.ToSqlDecimal ().Value);
+
+ // ToSqlDouble ()
+ AssertEquals ("TestD#1", (double)12, Test12.ToSqlDouble ().Value);
+ AssertEquals ("TestD#2", (double)0, Test0.ToSqlDouble ().Value);
+ AssertEquals ("TestD#3", (double)1000, Test1000.ToSqlDouble ().Value);
+
+ // ToSqlInt32 ()
+ AssertEquals ("TestE#1", (int)12, Test12.ToSqlInt32 ().Value);
+ AssertEquals ("TestE#2", (int)0, Test0.ToSqlInt32 ().Value);
+ AssertEquals ("TestE#3", (int)288, Test288.ToSqlInt32().Value);
+
+ // ToSqlInt64 ()
+ AssertEquals ("TestF#1", (long)12, Test12.ToSqlInt64 ().Value);
+ AssertEquals ("TestF#2", (long)0, Test0.ToSqlInt64 ().Value);
+ AssertEquals ("TestF#3", (long)288, Test288.ToSqlInt64 ().Value);
+
+ // ToSqlMoney ()
+ AssertEquals ("TestG#1", (decimal)12, Test12.ToSqlMoney ().Value);
+ AssertEquals ("TestG#2", (decimal)0, Test0.ToSqlMoney ().Value);
+ AssertEquals ("TestG#3", (decimal)288, Test288.ToSqlMoney ().Value);
+
+ // ToSqlSingle ()
+ AssertEquals ("TestH#1", (float)12, Test12.ToSqlSingle ().Value);
+ AssertEquals ("TestH#2", (float)0, Test0.ToSqlSingle ().Value);
+ AssertEquals ("TestH#3", (float)288, Test288.ToSqlSingle().Value);
+
+ // ToSqlString ()
+ AssertEquals ("TestI#1", "12", Test12.ToSqlString ().Value);
+ AssertEquals ("TestI#2", "0", Test0.ToSqlString ().Value);
+ AssertEquals ("TestI#3", "288", Test288.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("TestJ#1", "12", Test12.ToString ());
+ AssertEquals ("TestJ#2", "0", Test0.ToString ());
+ AssertEquals ("TestJ#3", "288", Test288.ToString ());
+ }
+
+
+ public void TestXor()
+ {
+ SqlInt16 Test14 = new SqlInt16 (14);
+ SqlInt16 Test58 = new SqlInt16 (58);
+ SqlInt16 Test130 = new SqlInt16 (130);
+ SqlInt16 TestMax = new SqlInt16 (SqlInt16.MaxValue.Value);
+ SqlInt16 Test0 = new SqlInt16 (0);
+
+ AssertEquals ("Test#1", (short)52, SqlInt16.Xor (Test14, Test58).Value);
+ AssertEquals ("Test#2", (short)140, SqlInt16.Xor (Test14, Test130).Value);
+ AssertEquals ("Test#3", (short)184, SqlInt16.Xor (Test58, Test130).Value);
+ AssertEquals ("Test#4", (short)0, SqlInt16.Xor (TestMax, TestMax).Value);
+ AssertEquals ("Test#5", TestMax.Value, SqlInt16.Xor (TestMax, Test0).Value);
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ SqlInt16 Test24 = new SqlInt16 (24);
+ SqlInt16 Test64 = new SqlInt16 (64);
+ SqlInt16 Test2550 = new SqlInt16 (2550);
+ SqlInt16 Test0 = new SqlInt16 (0);
+
+ // "+"-operator
+ AssertEquals ("TestA#1", (SqlInt16)2614,Test2550 + Test64);
+ try {
+ SqlInt16 result = Test64 + SqlInt16.MaxValue;
+ Fail ("TestA#2");
+ } catch (Exception e) {
+ AssertEquals ("TestA#3", typeof (OverflowException), e.GetType ());
+ }
+
+ // "/"-operator
+ AssertEquals ("TestB#1", (SqlInt16)39, Test2550 / Test64);
+ AssertEquals ("TestB#2", (SqlInt16)0, Test24 / Test64);
+
+ try {
+ SqlInt16 result = Test2550 / Test0;
+ Fail ("TestB#3");
+ } catch (Exception e) {
+ AssertEquals ("TestB#4", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // "*"-operator
+ AssertEquals ("TestC#1", (SqlInt16)1536, Test64 * Test24);
+
+ try {
+ SqlInt16 test = (SqlInt16.MaxValue * Test64);
+ Fail ("TestC#2");
+ } catch (Exception e) {
+ AssertEquals ("TestC#3", typeof (OverflowException), e.GetType ());
+ }
+
+ // "-"-operator
+ AssertEquals ("TestD#1", (SqlInt16)2526, Test2550 - Test24);
+
+ try {
+ SqlInt16 test = SqlInt16.MinValue - Test64;
+ Fail ("TestD#2");
+ } catch (Exception e) {
+ AssertEquals ("OverflowException", typeof (OverflowException), e.GetType ());
+ }
+
+ // "%"-operator
+ AssertEquals ("TestE#1", (SqlInt16)54, Test2550 % Test64);
+ AssertEquals ("TestE#2", (SqlInt16)24, Test24 % Test64);
+ AssertEquals ("TestE#1", (SqlInt16)0, new SqlInt16 (100) % new SqlInt16 (10));
+ }
+
+ public void TestBitwiseOperators()
+ {
+ SqlInt16 Test2 = new SqlInt16 (2);
+ SqlInt16 Test4 = new SqlInt16 (4);
+ SqlInt16 Test2550 = new SqlInt16 (2550);
+
+ // & -operator
+ AssertEquals ("TestA#1", (SqlInt16)0, Test2 & Test4);
+ AssertEquals ("TestA#2", (SqlInt16)2, Test2 & Test2550);
+ AssertEquals ("TestA#3", (SqlInt16)0, SqlInt16.MaxValue & SqlInt16.MinValue);
+
+ // | -operator
+ AssertEquals ("TestB#1", (SqlInt16)6,Test2 | Test4);
+ AssertEquals ("TestB#2", (SqlInt16)2550, Test2 | Test2550);
+ AssertEquals ("TestB#3", (SqlInt16)(-1), SqlInt16.MinValue | SqlInt16.MaxValue);
+
+ // ^ -operator
+ AssertEquals("TestC#1", (SqlInt16)2546, (Test2550 ^ Test4));
+ AssertEquals("TestC#2", (SqlInt16)6, (Test2 ^ Test4));
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ SqlInt16 Test165 = new SqlInt16 (165);
+ SqlInt16 Test100 = new SqlInt16 (100);
+ SqlInt16 Test100II = new SqlInt16 (100);
+ SqlInt16 Test255 = new SqlInt16 (2550);
+
+ // == -operator
+ Assert ("TestA#1", (Test100 == Test100II).Value);
+ Assert ("TestA#2", !(Test165 == Test100).Value);
+ Assert ("TestA#3", (Test165 == SqlInt16.Null).IsNull);
+
+ // != -operator
+ Assert ("TestB#1", !(Test100 != Test100II).Value);
+ Assert ("TestB#2", (Test100 != Test255).Value);
+ Assert ("TestB#3", (Test165 != Test255).Value);
+ Assert ("TestB#4", (Test165 != SqlInt16.Null).IsNull);
+
+ // > -operator
+ Assert ("TestC#1", (Test165 > Test100).Value);
+ Assert ("TestC#2", !(Test165 > Test255).Value);
+ Assert ("TestC#3", !(Test100 > Test100II).Value);
+ Assert ("TestC#4", (Test165 > SqlInt16.Null).IsNull);
+
+ // >= -operator
+ Assert ("TestD#1", !(Test165 >= Test255).Value);
+ Assert ("TestD#2", (Test255 >= Test165).Value);
+ Assert ("TestD#3", (Test100 >= Test100II).Value);
+ Assert ("TestD#4", (Test165 >= SqlInt16.Null).IsNull);
+
+ // < -operator
+ Assert ("TestE#1", !(Test165 < Test100).Value);
+ Assert ("TestE#2", (Test165 < Test255).Value);
+ Assert ("TestE#3", !(Test100 < Test100II).Value);
+ Assert ("TestE#4", (Test165 < SqlInt16.Null).IsNull);
+
+ // <= -operator
+ Assert ("TestF#1", (Test165 <= Test255).Value);
+ Assert ("TestF#2", !(Test255 <= Test165).Value);
+ Assert ("TestF#3", (Test100 <= Test100II).Value);
+ Assert ("TestF#4", (Test165 <= SqlInt16.Null).IsNull);
+ }
+
+ public void TestOnesComplementOperator()
+ {
+ SqlInt16 Test12 = new SqlInt16 (12);
+ SqlInt16 Test128 = new SqlInt16 (128);
+
+ AssertEquals ("Test#1", (SqlInt16)(-13), ~Test12);
+ AssertEquals ("Test#2", (SqlInt16)(-129), ~Test128);
+ AssertEquals ("Test#3", SqlInt16.Null, ~SqlInt16.Null);
+ }
+
+ public void TestUnaryNegation()
+ {
+ SqlInt16 Test = new SqlInt16 (2000);
+ SqlInt16 TestNeg = new SqlInt16 (-3000);
+
+ SqlInt16 Result = -Test;
+ AssertEquals ("Test#1", (short)(-2000), Result.Value);
+
+ Result = -TestNeg;
+ AssertEquals ("Test#2", (short)3000, Result.Value);
+ }
+
+ public void TestSqlBooleanToSqlInt16()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+ SqlInt16 Result;
+
+ Result = (SqlInt16)TestBoolean;
+
+ AssertEquals ("Test#1", (short)1, Result.Value);
+
+ Result = (SqlInt16)SqlBoolean.Null;
+ Assert ("Test#2", Result.IsNull);
+ }
+
+ public void TestSqlDecimalToSqlInt16()
+ {
+ SqlDecimal TestDecimal64 = new SqlDecimal (64);
+ SqlDecimal TestDecimal900 = new SqlDecimal (90000);
+
+ AssertEquals ("Test#1", (short)64, ((SqlInt16)TestDecimal64).Value);
+ AssertEquals ("Test#2", SqlInt16.Null, ((SqlInt16)SqlDecimal.Null));
+
+ try {
+ SqlInt16 test = (SqlInt16)TestDecimal900;
+ Fail ("Test#3");
+ } catch (Exception e) {
+ AssertEquals("Test#4", typeof(OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlDoubleToSqlInt16()
+ {
+ SqlDouble TestDouble64 = new SqlDouble (64);
+ SqlDouble TestDouble900 = new SqlDouble (90000);
+
+ AssertEquals ("Test#1", (short)64, ((SqlInt16)TestDouble64).Value);
+ AssertEquals ("Test#2", SqlInt16.Null, ((SqlInt16)SqlDouble.Null));
+
+ try {
+ SqlInt16 test = (SqlInt16)TestDouble900;
+ Fail ("Test#3");
+ } catch (Exception e) {
+ AssertEquals("Test#4", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlIntToInt16()
+ {
+ SqlInt16 Test = new SqlInt16(12);
+ Int16 Result = (Int16)Test;
+ AssertEquals("Test#1", (short)12, Result);
+ }
+
+ public void TestSqlInt32ToSqlInt16()
+ {
+ SqlInt32 Test64 = new SqlInt32 (64);
+ SqlInt32 Test900 = new SqlInt32 (90000);
+
+ AssertEquals ("Test#1", (short)64, ((SqlInt16)Test64).Value);
+
+ try {
+ SqlInt16 test = (SqlInt16)Test900;
+ Fail ("Test#2");
+ } catch (Exception e) {
+ AssertEquals ("Test#3", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlInt64ToSqlInt16()
+ {
+ SqlInt64 Test64 = new SqlInt64 (64);
+ SqlInt64 Test900 = new SqlInt64 (90000);
+
+ AssertEquals ("Test#1", (short)64, ((SqlInt16)Test64).Value);
+
+ try {
+ SqlInt16 test = (SqlInt16)Test900;
+ Fail ("Test#2");
+ } catch (Exception e) {
+ AssertEquals("Test#3", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlMoneyToSqlInt16()
+ {
+ SqlMoney TestMoney64 = new SqlMoney(64);
+ SqlMoney TestMoney900 = new SqlMoney(90000);
+
+ AssertEquals ("Test#1", (short)64, ((SqlInt16)TestMoney64).Value);
+
+ try {
+ SqlInt16 test = (SqlInt16)TestMoney900;
+ Fail ("Test#2");
+ } catch (Exception e) {
+ AssertEquals("test#3", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlSingleToSqlInt16()
+ {
+ SqlSingle TestSingle64 = new SqlSingle(64);
+ SqlSingle TestSingle900 = new SqlSingle(90000);
+
+ AssertEquals("Test#1", (short)64, ((SqlInt16)TestSingle64).Value);
+
+ try {
+ SqlInt16 test = (SqlInt16)TestSingle900;
+ Fail ("Test#2");
+ } catch (Exception e) {
+ AssertEquals ("Test#3", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlStringToSqlInt16()
+ {
+ SqlString TestString = new SqlString("Test string");
+ SqlString TestString100 = new SqlString("100");
+ SqlString TestString1000 = new SqlString("100000");
+
+ AssertEquals ("Test#1", (short)100, ((SqlInt16)TestString100).Value);
+
+ try {
+ SqlInt16 test = (SqlInt16)TestString1000;
+ Fail ("Test#2");
+ } catch(Exception e) {
+ AssertEquals ("Test#3", typeof (OverflowException), e.GetType ());
+ }
+
+ try {
+ SqlInt16 test = (SqlInt16)TestString;
+ Fail ("Test#3");
+ } catch(Exception e) {
+ AssertEquals ("Test#4", typeof (FormatException), e.GetType ());
+ }
+ }
+
+ public void TestByteToSqlInt16()
+ {
+ short TestShort = 14;
+ AssertEquals ("Test#1", (short)14, ((SqlInt16)TestShort).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt32Test.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt32Test.cs
new file mode 100644
index 00000000000..4cd335ce17c
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt32Test.cs
@@ -0,0 +1,413 @@
+// SqlInt32Test.cs - NUnit Test Cases for System.Data.SqlTypes.SqlInt32
+//
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Tim Coleman
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlInt32Test : TestCase
+ {
+
+ public SqlInt32Test() : base ("System.Data.SqlTypes.SqlInt32") {}
+ public SqlInt32Test(string name) : base(name) {}
+
+ protected override void SetUp() {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlInt32));
+ }
+ }
+
+ public void TestCreate ()
+ {
+ SqlInt32 foo = new SqlInt32 (5);
+ AssertEquals ("Test explicit cast to int", (int)foo, 5);
+ }
+
+ public void TestAdd ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x;
+ SqlInt32 y;
+ SqlInt32 z;
+
+ x = new SqlInt32 (a);
+ y = new SqlInt32 (b);
+ z = x + y;
+ AssertEquals ("Addition operator does not work correctly", z.Value, a + b);
+ z = SqlInt32.Add (x, y);
+ AssertEquals ("Addition function does not work correctly", z.Value, a + b);
+ }
+
+ public void TestBitwiseAnd ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x & y;
+ AssertEquals ("Bitwise And operator does not work correctly", z.Value, a & b);
+ z = SqlInt32.BitwiseAnd (x, y);
+ AssertEquals ("Bitwise And function does not work correctly", z.Value, a & b);
+ }
+
+ public void TestBitwiseOr ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x | y;
+ AssertEquals ("Bitwise Or operator does not work correctly", z.Value, a | b);
+ z = SqlInt32.BitwiseOr (x, y);
+ AssertEquals ("Bitwise Or function does not work correctly", z.Value, a | b);
+ }
+
+ public void TestDivide ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x / y;
+ AssertEquals ("Division operator does not work correctly", z.Value, a / b);
+ z = SqlInt32.Divide (x, y);
+ AssertEquals ("Division function does not work correctly", z.Value, a / b);
+ }
+
+ public void TestEquals ()
+ {
+ SqlInt32 x;
+ SqlInt32 y;
+
+ // Case 1: either is SqlInt32.Null
+ x = SqlInt32.Null;
+ y = new SqlInt32 (5);
+ AssertEquals ("Equality operator didn't return Null when one was Null.", x == y, SqlBoolean.Null);
+ AssertEquals ("Equality function didn't return Null when one was Null.", SqlInt32.Equals (x, y), SqlBoolean.Null);
+
+ // Case 2: both are SqlInt32.Null
+ y = SqlInt32.Null;
+ AssertEquals ("Equality operator didn't return Null when both were Null.", x == y, SqlBoolean.Null);
+ AssertEquals ("Equality function didn't return Null when both were Null.", SqlInt32.Equals (x, y), SqlBoolean.Null);
+
+ // Case 3: both are equal
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (5);
+ AssertEquals ("Equality operator didn't return true when they were equal.", x == y, SqlBoolean.True);
+ AssertEquals ("Equality function didn't return true when they were equal.", SqlInt32.Equals (x, y), SqlBoolean.True);
+
+ // Case 4: inequality
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (6);
+ AssertEquals ("Equality operator didn't return false when they were not equal.", x == y, SqlBoolean.False);
+ AssertEquals ("Equality function didn't return false when they were not equal.", SqlInt32.Equals (x, y), SqlBoolean.False);
+ }
+
+ public void TestGreaterThan ()
+ {
+ SqlInt32 x;
+ SqlInt32 y;
+
+ // Case 1: either is SqlInt32.Null
+ x = SqlInt32.Null;
+ y = new SqlInt32 (5);
+ AssertEquals ("Greater Than operator didn't return Null when one was Null.", x > y, SqlBoolean.Null);
+ AssertEquals ("Greater Than function didn't return Null when one was Null.", SqlInt32.GreaterThan (x, y), SqlBoolean.Null);
+
+ // Case 2: both are SqlInt32.Null
+ y = SqlInt32.Null;
+ AssertEquals ("Greater Than operator didn't return Null when both were Null.", x > y, SqlBoolean.Null);
+ AssertEquals ("Greater Than function didn't return Null when both were Null.", SqlInt32.GreaterThan (x, y), SqlBoolean.Null);
+
+ // Case 3: x > y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (4);
+ AssertEquals ("Greater than operator didn't return true when x > y.", x > y, SqlBoolean.True);
+ AssertEquals ("Greater than function didn't return true when x > y.", SqlInt32.GreaterThan (x,y), SqlBoolean.True);
+
+ // Case 4: x < y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (6);
+ AssertEquals ("Greater than operator didn't return false when x < y.", x > y, SqlBoolean.False);
+ AssertEquals ("Greater than function didn't return false when x < y.", SqlInt32.GreaterThan (x,y), SqlBoolean.False);
+ }
+
+ public void TestGreaterThanOrEqual ()
+ {
+ SqlInt32 x;
+ SqlInt32 y;
+
+ // Case 1: either is SqlInt32.Null
+ x = SqlInt32.Null;
+ y = new SqlInt32 (5);
+ AssertEquals ("Greater Than Or Equal operator didn't return Null when one was Null.", x >= y, SqlBoolean.Null);
+ AssertEquals ("Greater Than Or Equal function didn't return Null when one was Null.", SqlInt32.GreaterThanOrEqual (x, y), SqlBoolean.Null);
+
+ // Case 2: both are SqlInt32.Null
+ y = SqlInt32.Null;
+ AssertEquals ("Greater Than Or Equal operator didn't return Null when both were Null.", x >= y, SqlBoolean.Null);
+ AssertEquals ("Greater Than Or Equal function didn't return Null when both were Null.", SqlInt32.GreaterThanOrEqual (x, y), SqlBoolean.Null);
+
+ // Case 3: x > y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (4);
+ AssertEquals ("Greater than or equal operator didn't return true when x > y.", x >= y, SqlBoolean.True);
+ AssertEquals ("Greater than or equal function didn't return true when x > y.", SqlInt32.GreaterThanOrEqual (x,y), SqlBoolean.True);
+
+ // Case 4: x < y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (6);
+ AssertEquals ("Greater than or equal operator didn't return false when x < y.", x >= y, SqlBoolean.False);
+ AssertEquals ("Greater than or equal function didn't return false when x < y.", SqlInt32.GreaterThanOrEqual (x,y), SqlBoolean.False);
+
+ // Case 5: x == y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (5);
+ AssertEquals ("Greater than or equal operator didn't return true when x == y.", x >= y, SqlBoolean.True);
+ AssertEquals ("Greater than or equal function didn't return true when x == y.", SqlInt32.GreaterThanOrEqual (x,y), SqlBoolean.True);
+ }
+
+ public void TestLessThan ()
+ {
+ SqlInt32 x;
+ SqlInt32 y;
+
+ // Case 1: either is SqlInt32.Null
+ x = SqlInt32.Null;
+ y = new SqlInt32 (5);
+ AssertEquals ("Less Than operator didn't return Null when one was Null.", x < y, SqlBoolean.Null);
+ AssertEquals ("Less Than function didn't return Null when one was Null.", SqlInt32.LessThan (x, y), SqlBoolean.Null);
+
+ // Case 2: both are SqlInt32.Null
+ y = SqlInt32.Null;
+ AssertEquals ("Less Than operator didn't return Null when both were Null.", x < y, SqlBoolean.Null);
+ AssertEquals ("Less Than function didn't return Null when both were Null.", SqlInt32.LessThan (x, y), SqlBoolean.Null);
+
+ // Case 3: x > y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (4);
+ AssertEquals ("Less than operator didn't return false when x > y.", x < y, SqlBoolean.False);
+ AssertEquals ("Less than function didn't return false when x > y.", SqlInt32.LessThan (x,y), SqlBoolean.False);
+
+ // Case 4: x < y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (6);
+ AssertEquals ("Less than operator didn't return true when x < y.", x < y, SqlBoolean.True);
+ AssertEquals ("Less than function didn't return true when x < y.", SqlInt32.LessThan (x,y), SqlBoolean.True);
+ }
+
+ public void TestLessThanOrEqual ()
+ {
+ SqlInt32 x;
+ SqlInt32 y;
+
+ // Case 1: either is SqlInt32.Null
+ x = SqlInt32.Null;
+ y = new SqlInt32 (5);
+ AssertEquals ("Less Than Or Equal operator didn't return Null when one was Null.", x <= y, SqlBoolean.Null);
+ AssertEquals ("Less Than Or Equal function didn't return Null when one was Null.", SqlInt32.LessThanOrEqual (x, y), SqlBoolean.Null);
+
+ // Case 2: both are SqlInt32.Null
+ y = SqlInt32.Null;
+ AssertEquals ("Less Than Or Equal operator didn't return Null when both were Null.", x <= y, SqlBoolean.Null);
+ AssertEquals ("Less Than Or Equal function didn't return Null when both were Null.", SqlInt32.LessThanOrEqual (x, y), SqlBoolean.Null);
+
+ // Case 3: x > y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (4);
+ AssertEquals ("Less than or equal operator didn't return false when x > y.", x <= y, SqlBoolean.False);
+ AssertEquals ("Less than or equal function didn't return false when x > y.", SqlInt32.LessThanOrEqual (x,y), SqlBoolean.False);
+
+ // Case 4: x < y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (6);
+ AssertEquals ("Less than or equal operator didn't return true when x < y.", x <= y, SqlBoolean.True);
+ AssertEquals ("Less than or equal function didn't return true when x < y.", SqlInt32.LessThanOrEqual (x,y), SqlBoolean.True);
+
+ // Case 5: x == y
+ x = new SqlInt32 (5);
+ y = new SqlInt32 (5);
+ AssertEquals ("Less than or equal operator didn't return true when x == y.", x <= y, SqlBoolean.True);
+ AssertEquals ("Less than or equal function didn't return true when x == y.", SqlInt32.LessThanOrEqual (x,y), SqlBoolean.True);
+ }
+
+ public void TestMod ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x % y;
+ AssertEquals ("Modulus operator does not work correctly", z.Value, a % b);
+ z = SqlInt32.Mod (x, y);
+ AssertEquals ("Modulus function does not work correctly", z.Value, a % b);
+ }
+
+ public void TestMultiply ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x * y;
+ AssertEquals ("Multiplication operator does not work correctly", z.Value, a * b);
+ z = SqlInt32.Multiply (x, y);
+ AssertEquals ("Multiplication function does not work correctly", z.Value, a * b);
+ }
+
+ public void TestNotEquals ()
+ {
+ SqlInt32 x;
+ SqlInt32 y;
+
+ x = new SqlInt32 (5);
+ y = SqlInt32.Null;
+
+ AssertEquals ("Not Equals operator does not return null when one or both of the parameters is Null.", x != y, SqlBoolean.Null);
+ AssertEquals ("Not Equals function does not return null when one or both of the parameters is Null.", SqlInt32.NotEquals (x, y), SqlBoolean.Null);
+
+ y = new SqlInt32 (5);
+ AssertEquals ("Not Equals operator does not return false when x == y.", x != y, SqlBoolean.False);
+ AssertEquals ("Not Equals function does not return false when x == y.", SqlInt32.NotEquals (x, y), SqlBoolean.False);
+
+ y = new SqlInt32 (6);
+ AssertEquals ("Not Equals operator does not return true when x != y.", x != y, SqlBoolean.True);
+ AssertEquals ("Not Equals function does not return true when x != y.", SqlInt32.NotEquals (x, y), SqlBoolean.True);
+ }
+
+ public void TestOnesComplement ()
+ {
+ int a = 5;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 z = ~x;
+ AssertEquals ("Ones Complement operator does not work correctly", z.Value, ~a);
+ z = SqlInt32.OnesComplement (x);
+ AssertEquals ("Ones Complement function does not work correctly", z.Value, ~a);
+ }
+
+ public void TestIsNullProperty ()
+ {
+ SqlInt32 n = SqlInt32.Null;
+ Assert ("Null is not defined correctly", n.IsNull);
+ }
+
+ public void TestSubtract ()
+ {
+ int a = 7;
+ int b = 5;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x - y;
+ AssertEquals ("Subtraction operator does not work correctly", z.Value, a - b);
+ z = SqlInt32.Subtract (x, y);
+ AssertEquals ("Subtraction function does not work correctly", z.Value, a - b);
+ }
+
+ public void TestConversionMethods ()
+ {
+ SqlInt32 x;
+
+ // Case 1: SqlInt32.Null -> SqlBoolean == SqlBoolean.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlBoolean does not yield SqlBoolean.Null.", x.ToSqlBoolean (), SqlBoolean.Null );
+
+ // Case 2: SqlInt32.Zero -> SqlBoolean == False
+ x = SqlInt32.Zero;
+ AssertEquals ("SqlInt32.Zero -> SqlBoolean does not yield SqlBoolean.False.", x.ToSqlBoolean (), SqlBoolean.False );
+
+ // Case 3: SqlInt32(nonzero) -> SqlBoolean == True
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlBoolean does not yield SqlBoolean.True.", x.ToSqlBoolean (), SqlBoolean.True );
+
+ // Case 4: SqlInt32.Null -> SqlByte == SqlByte.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlByte does not yield SqlByte.Null.", x.ToSqlByte (), SqlByte.Null );
+
+ // Case 5: Test non-null conversion to SqlByte
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlByte does not yield a value of 27", x.ToSqlByte ().Value, (byte)27);
+
+ // Case 6: SqlInt32.Null -> SqlDecimal == SqlDecimal.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlDecimal does not yield SqlDecimal.Null.", x.ToSqlDecimal (), SqlDecimal.Null );
+
+ // Case 7: Test non-null conversion to SqlDecimal
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlDecimal does not yield a value of 27", x.ToSqlDecimal ().Value, (decimal)27);
+
+ // Case 8: SqlInt32.Null -> SqlDouble == SqlDouble.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlDouble does not yield SqlDouble.Null.", x.ToSqlDouble (), SqlDouble.Null );
+
+ // Case 9: Test non-null conversion to SqlDouble
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlDouble does not yield a value of 27", x.ToSqlDouble ().Value, (double)27);
+
+ // Case 10: SqlInt32.Null -> SqlInt16 == SqlInt16.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlInt16 does not yield SqlInt16.Null.", x.ToSqlInt16 (), SqlInt16.Null );
+
+ // Case 11: Test non-null conversion to SqlInt16
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlInt16 does not yield a value of 27", x.ToSqlInt16 ().Value, (short)27);
+
+ // Case 12: SqlInt32.Null -> SqlInt64 == SqlInt64.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlInt64 does not yield SqlInt64.Null.", x.ToSqlInt64 (), SqlInt64.Null );
+
+ // Case 13: Test non-null conversion to SqlInt64
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlInt64 does not yield a value of 27", x.ToSqlInt64 ().Value, (long)27);
+
+ // Case 14: SqlInt32.Null -> SqlMoney == SqlMoney.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlMoney does not yield SqlMoney.Null.", x.ToSqlMoney (), SqlMoney.Null );
+
+ // Case 15: Test non-null conversion to SqlMoney
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlMoney does not yield a value of 27", x.ToSqlMoney ().Value, (decimal)27);
+
+ // Case 16: SqlInt32.Null -> SqlSingle == SqlSingle.Null
+ x = SqlInt32.Null;
+ AssertEquals ("SqlInt32.Null -> SqlSingle does not yield SqlSingle.Null.", x.ToSqlSingle (), SqlSingle.Null );
+
+ // Case 17: Test non-null conversion to SqlSingle
+ x = new SqlInt32 (27);
+ AssertEquals ("SqlInt32 (27) -> SqlSingle does not yield a value of 27", x.ToSqlSingle ().Value, (float)27);
+ }
+
+ public void TestXor ()
+ {
+ int a = 5;
+ int b = 7;
+
+ SqlInt32 x = new SqlInt32 (a);
+ SqlInt32 y = new SqlInt32 (b);
+ SqlInt32 z = x ^ y;
+ AssertEquals ("Xor operator does not work correctly", z.Value, a ^ b);
+ z = SqlInt32.Xor (x, y);
+ AssertEquals ("Xor function does not work correctly", z.Value, a ^ b);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt64Test.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt64Test.cs
new file mode 100644
index 00000000000..9f7a28b0fb1
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlInt64Test.cs
@@ -0,0 +1,609 @@
+//
+// SqlInt64Test.cs - NUnit Test Cases for System.Data.SqlTypes.SqlInt64
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlInt64Test : TestCase {
+
+ public SqlInt64Test() : base ("System.Data.SqlTypes.SqlInt64") {}
+ public SqlInt64Test(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlInt64));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ SqlInt64 TestLong = new SqlInt64 (29);
+ AssertEquals ("#A01", (long)29, TestLong.Value);
+
+ TestLong = new SqlInt64 (-9000);
+ AssertEquals ("#A02", (long)-9000, TestLong.Value);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ AssertEquals ("#B01", (long)9223372036854775807, SqlInt64.MaxValue.Value);
+ AssertEquals ("#B02", (long)(-9223372036854775808), SqlInt64.MinValue.Value);
+ Assert ("#B03", SqlInt64.Null.IsNull);
+ AssertEquals ("#B04", (long)0, SqlInt64.Zero.Value);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ SqlInt64 Test5443 = new SqlInt64 (5443);
+ SqlInt64 Test1 = new SqlInt64 (1);
+
+ Assert ("#C01", SqlInt64.Null.IsNull);
+ AssertEquals ("#C02", (long)5443, Test5443.Value);
+ AssertEquals ("#C03", (long)1, Test1.Value);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestArithmeticMethods()
+ {
+ SqlInt64 Test64 = new SqlInt64 (64);
+ SqlInt64 Test0 = new SqlInt64 (0);
+ SqlInt64 Test164 = new SqlInt64 (164);
+ SqlInt64 TestMax = new SqlInt64 (SqlInt64.MaxValue.Value);
+
+ // Add()
+ AssertEquals ("#D01", (long)64, SqlInt64.Add (Test64, Test0).Value);
+ AssertEquals ("#D02", (long)228, SqlInt64.Add (Test64, Test164).Value);
+ AssertEquals ("#D03", (long)164, SqlInt64.Add (Test0, Test164).Value);
+ AssertEquals ("#D04", (long)SqlInt64.MaxValue, SqlInt64.Add (TestMax, Test0).Value);
+
+ try {
+ SqlInt64.Add (TestMax, Test64);
+ Fail ("#D05");
+ } catch (Exception e) {
+ AssertEquals ("#D06", typeof (OverflowException), e.GetType ());
+ }
+
+ // Divide()
+ AssertEquals ("#D07", (long)2, SqlInt64.Divide (Test164, Test64).Value);
+ AssertEquals ("#D08", (long)0, SqlInt64.Divide (Test64, Test164).Value);
+
+ try {
+ SqlInt64.Divide(Test64, Test0);
+ Fail ("#D09");
+ } catch(Exception e) {
+ AssertEquals ("#D10", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // Mod()
+ AssertEquals ("#D11", (SqlInt64)36, SqlInt64.Mod (Test164, Test64));
+ AssertEquals ("#D12", (SqlInt64)64, SqlInt64.Mod (Test64, Test164));
+
+ // Multiply()
+ AssertEquals ("#D13", (long)10496, SqlInt64.Multiply (Test64, Test164).Value);
+ AssertEquals ("#D14", (long)0, SqlInt64.Multiply (Test64, Test0).Value);
+
+ try {
+ SqlInt64.Multiply (TestMax, Test64);
+ Fail ("#D15");
+ } catch(Exception e) {
+ AssertEquals ("#D16", typeof (OverflowException), e.GetType ());
+ }
+
+ // Subtract()
+ AssertEquals ("#D17", (long)100, SqlInt64.Subtract (Test164, Test64).Value);
+
+ try {
+ SqlInt64.Subtract (SqlInt64.MinValue, Test164);
+ Fail ("#D18");
+ } catch(Exception e) {
+ AssertEquals ("#D19", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestBitwiseMethods()
+ {
+ long MaxValue = SqlInt64.MaxValue.Value;
+ SqlInt64 TestInt = new SqlInt64 (0);
+ SqlInt64 TestIntMax = new SqlInt64 (MaxValue);
+ SqlInt64 TestInt2 = new SqlInt64 (10922);
+ SqlInt64 TestInt3 = new SqlInt64 (21845);
+
+ // BitwiseAnd
+ AssertEquals ("#E01", (long)21845, SqlInt64.BitwiseAnd (TestInt3, TestIntMax).Value);
+ AssertEquals ("#E02", (long)0, SqlInt64.BitwiseAnd (TestInt2, TestInt3).Value);
+ AssertEquals ("#E03", (long)10922, SqlInt64.BitwiseAnd (TestInt2, TestIntMax).Value);
+
+ //BitwiseOr
+ AssertEquals ("#E04", (long)21845, SqlInt64.BitwiseOr (TestInt, TestInt3).Value);
+ AssertEquals ("#E05", (long)MaxValue, SqlInt64.BitwiseOr (TestIntMax, TestInt2).Value);
+ }
+
+ public void TestCompareTo()
+ {
+ SqlInt64 TestInt4000 = new SqlInt64 (4000);
+ SqlInt64 TestInt4000II = new SqlInt64 (4000);
+ SqlInt64 TestInt10 = new SqlInt64 (10);
+ SqlInt64 TestInt10000 = new SqlInt64 (10000);
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("#F01", TestInt4000.CompareTo (TestInt10) > 0);
+ Assert ("#F02", TestInt10.CompareTo (TestInt4000) < 0);
+ Assert ("#F03", TestInt4000II.CompareTo (TestInt4000) == 0);
+ Assert ("#F04", TestInt4000II.CompareTo (SqlInt64.Null) > 0);
+
+ try {
+ TestInt10.CompareTo (TestString);
+ Fail("#F05");
+ } catch(Exception e) {
+ AssertEquals ("#F06", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethod()
+ {
+ SqlInt64 Test0 = new SqlInt64 (0);
+ SqlInt64 Test158 = new SqlInt64 (158);
+ SqlInt64 Test180 = new SqlInt64 (180);
+ SqlInt64 Test180II = new SqlInt64 (180);
+
+ Assert ("#G01", !Test0.Equals (Test158));
+ Assert ("#G01", !Test158.Equals (Test180));
+ Assert ("#G03", !Test180.Equals (new SqlString ("TEST")));
+ Assert ("#G04", Test180.Equals (Test180II));
+ }
+
+ public void TestStaticEqualsMethod()
+ {
+ SqlInt64 Test34 = new SqlInt64 (34);
+ SqlInt64 Test34II = new SqlInt64 (34);
+ SqlInt64 Test15 = new SqlInt64 (15);
+
+ Assert ("#H01", SqlInt64.Equals (Test34, Test34II).Value);
+ Assert ("#H02", !SqlInt64.Equals (Test34, Test15).Value);
+ Assert ("#H03", !SqlInt64.Equals (Test15, Test34II).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ SqlInt64 Test15 = new SqlInt64 (15);
+
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#I01", (int)15, Test15.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ SqlInt64 Test = new SqlInt64 (84);
+ AssertEquals ("#J01", "System.Data.SqlTypes.SqlInt64", Test.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ SqlInt64 Test10 = new SqlInt64 (10);
+ SqlInt64 Test10II = new SqlInt64 (10);
+ SqlInt64 Test110 = new SqlInt64 (110);
+
+ // GreateThan ()
+ Assert ("#K01", !SqlInt64.GreaterThan (Test10, Test110).Value);
+ Assert ("#K02", SqlInt64.GreaterThan (Test110, Test10).Value);
+ Assert ("#K03", !SqlInt64.GreaterThan (Test10II, Test10).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("#K04", !SqlInt64.GreaterThanOrEqual (Test10, Test110).Value);
+ Assert ("#K05", SqlInt64.GreaterThanOrEqual (Test110, Test10).Value);
+ Assert ("#K06", SqlInt64.GreaterThanOrEqual (Test10II, Test10).Value);
+ }
+
+ public void TestLessers()
+ {
+ SqlInt64 Test10 = new SqlInt64 (10);
+ SqlInt64 Test10II = new SqlInt64 (10);
+ SqlInt64 Test110 = new SqlInt64 (110);
+
+ // LessThan()
+ Assert ("#L01", SqlInt64.LessThan (Test10, Test110).Value);
+ Assert ("#L02", !SqlInt64.LessThan (Test110, Test10).Value);
+ Assert ("#L03", !SqlInt64.LessThan (Test10II, Test10).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#L04", SqlInt64.LessThanOrEqual (Test10, Test110).Value);
+ Assert ("#L05", !SqlInt64.LessThanOrEqual (Test110, Test10).Value);
+ Assert ("#L06", SqlInt64.LessThanOrEqual (Test10II, Test10).Value);
+ Assert ("#L07", SqlInt64.LessThanOrEqual (Test10II, SqlInt64.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ SqlInt64 Test12 = new SqlInt64 (12);
+ SqlInt64 Test128 = new SqlInt64 (128);
+ SqlInt64 Test128II = new SqlInt64 (128);
+
+ Assert ("#M01", SqlInt64.NotEquals (Test12, Test128).Value);
+ Assert ("#M02", SqlInt64.NotEquals (Test128, Test12).Value);
+ Assert ("#M03", SqlInt64.NotEquals (Test128II, Test12).Value);
+ Assert ("#M04", !SqlInt64.NotEquals (Test128II, Test128).Value);
+ Assert ("#M05", !SqlInt64.NotEquals (Test128, Test128II).Value);
+ Assert ("#M06", SqlInt64.NotEquals (SqlInt64.Null, Test128II).IsNull);
+ Assert ("#M07", SqlInt64.NotEquals (SqlInt64.Null, Test128II).IsNull);
+ }
+
+ public void TestOnesComplement()
+ {
+ SqlInt64 Test12 = new SqlInt64(12);
+ SqlInt64 Test128 = new SqlInt64(128);
+
+ AssertEquals ("#N01", (SqlInt64)(-13), SqlInt64.OnesComplement (Test12));
+ AssertEquals ("#N02", (SqlInt64)(-129), SqlInt64.OnesComplement (Test128));
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlInt64.Parse (null);
+ Fail ("#O01");
+ } catch (Exception e) {
+ AssertEquals ("#O02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlInt64.Parse ("not-a-number");
+ Fail ("#O03");
+ } catch (Exception e) {
+ AssertEquals ("#O04", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlInt64.Parse ("1000000000000000000000000000");
+ Fail ("#O05");
+ } catch (Exception e) {
+ AssertEquals ("#O06", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals("#O07", (long)150, SqlInt64.Parse ("150").Value);
+ }
+
+ public void TestConversions()
+ {
+ SqlInt64 Test12 = new SqlInt64 (12);
+ SqlInt64 Test0 = new SqlInt64 (0);
+ SqlInt64 TestNull = SqlInt64.Null;
+ SqlInt64 Test1000 = new SqlInt64 (1000);
+ SqlInt64 Test288 = new SqlInt64(288);
+
+ // ToSqlBoolean ()
+ Assert ("#P01", Test12.ToSqlBoolean ().Value);
+ Assert ("#P02", !Test0.ToSqlBoolean ().Value);
+ Assert ("#P03", TestNull.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ AssertEquals ("#P04", (byte)12, Test12.ToSqlByte ().Value);
+ AssertEquals ("#P05", (byte)0, Test0.ToSqlByte ().Value);
+
+ try {
+ SqlByte b = (byte)Test1000.ToSqlByte ();
+ Fail ("#P06");
+ } catch (Exception e) {
+ AssertEquals ("#P07", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDecimal ()
+ AssertEquals ("#P08", (decimal)12, Test12.ToSqlDecimal ().Value);
+ AssertEquals ("#P09", (decimal)0, Test0.ToSqlDecimal ().Value);
+ AssertEquals ("#P10", (decimal)288, Test288.ToSqlDecimal ().Value);
+
+ // ToSqlDouble ()
+ AssertEquals ("#P11", (double)12, Test12.ToSqlDouble ().Value);
+ AssertEquals ("#P12", (double)0, Test0.ToSqlDouble ().Value);
+ AssertEquals ("#P13", (double)1000, Test1000.ToSqlDouble ().Value);
+
+ // ToSqlInt32 ()
+ AssertEquals ("#P14", (int)12, Test12.ToSqlInt32 ().Value);
+ AssertEquals ("#P15", (int)0, Test0.ToSqlInt32 ().Value);
+ AssertEquals ("#P16", (int)288, Test288.ToSqlInt32().Value);
+
+ // ToSqlInt16 ()
+ AssertEquals ("#P17", (short)12, Test12.ToSqlInt16 ().Value);
+ AssertEquals ("#P18", (short)0, Test0.ToSqlInt16 ().Value);
+ AssertEquals ("#P19", (short)288, Test288.ToSqlInt16 ().Value);
+
+ // ToSqlMoney ()
+ AssertEquals ("#P20", (decimal)12, Test12.ToSqlMoney ().Value);
+ AssertEquals ("#P21", (decimal)0, Test0.ToSqlMoney ().Value);
+ AssertEquals ("#P22", (decimal)288, Test288.ToSqlMoney ().Value);
+
+ // ToSqlSingle ()
+ AssertEquals ("#P23", (float)12, Test12.ToSqlSingle ().Value);
+ AssertEquals ("#P24", (float)0, Test0.ToSqlSingle ().Value);
+ AssertEquals ("#P25", (float)288, Test288.ToSqlSingle().Value);
+
+ // ToSqlString ()
+ AssertEquals ("#P26", "12", Test12.ToSqlString ().Value);
+ AssertEquals ("#P27", "0", Test0.ToSqlString ().Value);
+ AssertEquals ("#P28", "288", Test288.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("#P29", "12", Test12.ToString ());
+ AssertEquals ("#P30", "0", Test0.ToString ());
+ AssertEquals ("#P31", "288", Test288.ToString ());
+ }
+
+ public void TestXor()
+ {
+ SqlInt64 Test14 = new SqlInt64 (14);
+ SqlInt64 Test58 = new SqlInt64 (58);
+ SqlInt64 Test130 = new SqlInt64 (130);
+ SqlInt64 TestMax = new SqlInt64 (SqlInt64.MaxValue.Value);
+ SqlInt64 Test0 = new SqlInt64 (0);
+
+ AssertEquals ("#Q01", (long)52, SqlInt64.Xor (Test14, Test58).Value);
+ AssertEquals ("#Q02", (long)140, SqlInt64.Xor (Test14, Test130).Value);
+ AssertEquals ("#Q03", (long)184, SqlInt64.Xor (Test58, Test130).Value);
+ AssertEquals ("#Q04", (long)0, SqlInt64.Xor (TestMax, TestMax).Value);
+ AssertEquals ("#Q05", TestMax.Value, SqlInt64.Xor (TestMax, Test0).Value);
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ SqlInt64 Test24 = new SqlInt64 (24);
+ SqlInt64 Test64 = new SqlInt64 (64);
+ SqlInt64 Test2550 = new SqlInt64 (2550);
+ SqlInt64 Test0 = new SqlInt64 (0);
+
+ // "+"-operator
+ AssertEquals ("#R01", (SqlInt64)2614,Test2550 + Test64);
+ try {
+ SqlInt64 result = Test64 + SqlInt64.MaxValue;
+ Fail ("#R02");
+ } catch (Exception e) {
+ AssertEquals ("#R03", typeof (OverflowException), e.GetType ());
+ }
+
+ // "/"-operator
+ AssertEquals ("#R04", (SqlInt64)39, Test2550 / Test64);
+ AssertEquals ("#R05", (SqlInt64)0, Test24 / Test64);
+
+ try {
+ SqlInt64 result = Test2550 / Test0;
+ Fail ("#R06");
+ } catch (Exception e) {
+ AssertEquals ("#R07", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // "*"-operator
+ AssertEquals ("#R08", (SqlInt64)1536, Test64 * Test24);
+
+ try {
+ SqlInt64 test = (SqlInt64.MaxValue * Test64);
+ Fail ("TestC#2");
+ } catch (Exception e) {
+ AssertEquals ("#R08", typeof (OverflowException), e.GetType ());
+ }
+
+ // "-"-operator
+ AssertEquals ("#R09", (SqlInt64)2526, Test2550 - Test24);
+
+ try {
+ SqlInt64 test = SqlInt64.MinValue - Test64;
+ Fail ("#R10");
+ } catch (Exception e) {
+ AssertEquals ("#R11", typeof (OverflowException), e.GetType ());
+ }
+
+ // "%"-operator
+ AssertEquals ("#R12", (SqlInt64)54, Test2550 % Test64);
+ AssertEquals ("#R13", (SqlInt64)24, Test24 % Test64);
+ AssertEquals ("#R14", (SqlInt64)0, new SqlInt64 (100) % new SqlInt64 (10));
+ }
+
+ public void TestBitwiseOperators()
+ {
+ SqlInt64 Test2 = new SqlInt64 (2);
+ SqlInt64 Test4 = new SqlInt64 (4);
+
+ SqlInt64 Test2550 = new SqlInt64 (2550);
+
+ // & -operator
+ AssertEquals ("#S01", (SqlInt64)0, Test2 & Test4);
+ AssertEquals ("#S02", (SqlInt64)2, Test2 & Test2550);
+ AssertEquals ("#S03", (SqlInt64)0, SqlInt64.MaxValue & SqlInt64.MinValue);
+
+ // | -operator
+ AssertEquals ("#S04", (SqlInt64)6,Test2 | Test4);
+ AssertEquals ("#S05", (SqlInt64)2550, Test2 | Test2550);
+ AssertEquals ("#S06", (SqlInt64)(-1), SqlInt64.MinValue | SqlInt64.MaxValue);
+
+ // ^ -operator
+ AssertEquals("#S07", (SqlInt64)2546, (Test2550 ^ Test4));
+ AssertEquals("#S08", (SqlInt64)6, (Test2 ^ Test4));
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ SqlInt64 Test165 = new SqlInt64 (165);
+ SqlInt64 Test100 = new SqlInt64 (100);
+ SqlInt64 Test100II = new SqlInt64 (100);
+ SqlInt64 Test255 = new SqlInt64 (2550);
+
+ // == -operator
+ Assert ("#T01", (Test100 == Test100II).Value);
+ Assert ("#T02", !(Test165 == Test100).Value);
+ Assert ("#T03", (Test165 == SqlInt64.Null).IsNull);
+
+ // != -operator
+ Assert ("#T04", !(Test100 != Test100II).Value);
+ Assert ("#T05", (Test100 != Test255).Value);
+ Assert ("#T06", (Test165 != Test255).Value);
+ Assert ("#T07", (Test165 != SqlInt64.Null).IsNull);
+
+ // > -operator
+ Assert ("#T08", (Test165 > Test100).Value);
+ Assert ("#T09", !(Test165 > Test255).Value);
+ Assert ("#T10", !(Test100 > Test100II).Value);
+ Assert ("#T11", (Test165 > SqlInt64.Null).IsNull);
+
+ // >= -operator
+ Assert ("#T12", !(Test165 >= Test255).Value);
+ Assert ("#T13", (Test255 >= Test165).Value);
+ Assert ("#T14", (Test100 >= Test100II).Value);
+ Assert ("#T15", (Test165 >= SqlInt64.Null).IsNull);
+
+ // < -operator
+ Assert ("#T16", !(Test165 < Test100).Value);
+ Assert ("#T17", (Test165 < Test255).Value);
+ Assert ("#T18", !(Test100 < Test100II).Value);
+ Assert ("#T19", (Test165 < SqlInt64.Null).IsNull);
+
+ // <= -operator
+ Assert ("#T20", (Test165 <= Test255).Value);
+ Assert ("#T21", !(Test255 <= Test165).Value);
+ Assert ("#T22", (Test100 <= Test100II).Value);
+ Assert ("#T23", (Test165 <= SqlInt64.Null).IsNull);
+ }
+
+ public void TestOnesComplementOperator()
+ {
+ SqlInt64 Test12 = new SqlInt64 (12);
+ SqlInt64 Test128 = new SqlInt64 (128);
+
+ AssertEquals ("#V01", (SqlInt64)(-13), ~Test12);
+ AssertEquals ("#V02", (SqlInt64)(-129), ~Test128);
+ AssertEquals ("#V03", SqlInt64.Null, ~SqlInt64.Null);
+ }
+
+ public void TestUnaryNegation()
+ {
+ SqlInt64 Test = new SqlInt64 (2000);
+ SqlInt64 TestNeg = new SqlInt64 (-3000);
+
+ SqlInt64 Result = -Test;
+ AssertEquals ("#W01", (long)(-2000), Result.Value);
+
+ Result = -TestNeg;
+ AssertEquals ("#W02", (long)3000, Result.Value);
+ }
+
+ public void TestSqlBooleanToSqlInt64()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+ SqlInt64 Result;
+
+ Result = (SqlInt64)TestBoolean;
+
+ AssertEquals ("#X01", (long)1, Result.Value);
+
+ Result = (SqlInt64)SqlBoolean.Null;
+ Assert ("#X02", Result.IsNull);
+ }
+
+ public void TestSqlDecimalToSqlInt64()
+ {
+ SqlDecimal TestDecimal64 = new SqlDecimal (64);
+ SqlDecimal TestDecimal900 = new SqlDecimal (90000);
+
+ AssertEquals("#Y01", (long)64, ((SqlInt64)TestDecimal64).Value);
+ AssertEquals("#Y02", SqlInt64.Null, ((SqlInt64)SqlDecimal.Null));
+
+ try {
+ SqlInt64 test = (SqlInt64)SqlDecimal.MaxValue;
+ Fail("#Y03");
+ } catch (Exception e) {
+ AssertEquals("#Y04", typeof(OverflowException), e.GetType());
+ }
+ }
+
+ public void TestSqlDoubleToSqlInt64()
+ {
+ SqlDouble TestDouble64 = new SqlDouble (64);
+ SqlDouble TestDouble900 = new SqlDouble (90000);
+
+ AssertEquals ("#Z01", (long)64, ((SqlInt64)TestDouble64).Value);
+ AssertEquals ("#Z02", SqlInt64.Null, ((SqlInt64)SqlDouble.Null));
+
+ try {
+ SqlInt64 test = (SqlInt64)SqlDouble.MaxValue;
+ Fail ("#Z03");
+ } catch (Exception e) {
+ AssertEquals("#Z04", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSql64IntToInt64()
+ {
+ SqlInt64 Test = new SqlInt64 (12);
+ Int64 Result = (Int64)Test;
+ AssertEquals ("#AA01", (long)12, Result);
+ }
+
+ public void TestSqlInt32ToSqlInt64()
+ {
+ SqlInt32 Test64 = new SqlInt32 (64);
+ AssertEquals ("#AB01", (long)64, ((SqlInt64)Test64).Value);
+ }
+
+ public void TestSqlInt16ToSqlInt64()
+ {
+ SqlInt16 Test64 = new SqlInt16 (64);
+ AssertEquals ("#AC01", (long)64, ((SqlInt64)Test64).Value);
+ }
+
+ public void TestSqlMoneyToSqlInt64()
+ {
+ SqlMoney TestMoney64 = new SqlMoney(64);
+ AssertEquals ("#AD01", (long)64, ((SqlInt64)TestMoney64).Value);
+ }
+
+ public void TestSqlSingleToSqlInt64()
+ {
+ SqlSingle TestSingle64 = new SqlSingle (64);
+ AssertEquals ("#AE01", (long)64, ((SqlInt64)TestSingle64).Value);
+ }
+
+ public void TestSqlStringToSqlInt64()
+ {
+ SqlString TestString = new SqlString ("Test string");
+ SqlString TestString100 = new SqlString ("100");
+ SqlString TestString1000 = new SqlString ("1000000000000000000000");
+
+ AssertEquals ("#AF01", (long)100, ((SqlInt64)TestString100).Value);
+
+ try {
+ SqlInt64 test = (SqlInt64)TestString1000;
+ Fail ("#AF02");
+ } catch(Exception e) {
+ AssertEquals ("#AF03", typeof (OverflowException), e.GetType ());
+ }
+
+ try {
+ SqlInt64 test = (SqlInt64)TestString;
+ Fail ("#AF03");
+ } catch(Exception e) {
+ AssertEquals ("#AF04", typeof (FormatException), e.GetType ());
+ }
+ }
+
+ public void TestByteToSqlInt64()
+ {
+ short TestShort = 14;
+ AssertEquals ("#G01", (long)14, ((SqlInt64)TestShort).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlMoneyTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlMoneyTest.cs
new file mode 100755
index 00000000000..91a8e101bf4
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlMoneyTest.cs
@@ -0,0 +1,517 @@
+//
+// SqlMoneyTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlMoney
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlMoneyTest : TestCase {
+
+ private SqlMoney Test1;
+ private SqlMoney Test2;
+ private SqlMoney Test3;
+ private SqlMoney Test4;
+
+ public SqlMoneyTest() : base ("System.Data.SqlTypes.SqlMoney") {}
+ public SqlMoneyTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ Test1 = new SqlMoney (6464.6464d);
+ Test2 = new SqlMoney (90000.0m);
+ Test3 = new SqlMoney (90000.0m);
+ Test4 = new SqlMoney (-45000.0m);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlMoney));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ try {
+ SqlMoney Test = new SqlMoney (1000000000000000m);
+ Fail ("#B01");
+ } catch (Exception e) {
+ AssertEquals ("#A02", typeof (OverflowException),
+ e.GetType ());
+ }
+
+ SqlMoney CreationTest = new SqlMoney ((decimal)913.3);
+ AssertEquals ("A03", 913.3m, CreationTest.Value);
+
+ try {
+ SqlMoney Test = new SqlMoney (1e200);
+ Fail ("#B04");
+ } catch (Exception e) {
+ AssertEquals ("#A05", typeof (OverflowException),
+ e.GetType ());
+ }
+
+ SqlMoney CreationTest2 = new SqlMoney ((double)913.3);
+ AssertEquals ("A06", 913.3m, CreationTest2.Value);
+
+ SqlMoney CreationTest3 = new SqlMoney ((int)913);
+ AssertEquals ("A07", 913m, CreationTest3.Value);
+
+ SqlMoney CreationTest4 = new SqlMoney ((long)913.3);
+ AssertEquals ("A08", 913m, CreationTest4.Value);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ // FIXME: There is a error in msdn docs, it says thath MaxValue
+ // is 922,337,203,685,475.5807 when the actual value is
+ // 922,337,203,685,477.5807
+ AssertEquals ("#B01", 922337203685477.5807m, SqlMoney.MaxValue.Value);
+ AssertEquals ("#B02", -922337203685477.5808m, SqlMoney.MinValue.Value);
+ Assert ("#B03", SqlMoney.Null.IsNull);
+ AssertEquals ("#B04", 0m, SqlMoney.Zero.Value);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ AssertEquals ("#C01", 90000m, Test2.Value);
+ AssertEquals ("#C02", -45000m, Test4.Value);
+ Assert ("#C03", SqlMoney.Null.IsNull);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestArithmeticMethods()
+ {
+ SqlMoney TestMoney2 = new SqlMoney (2);
+
+ // Add
+ AssertEquals ("#D01", (SqlMoney)96464.6464m, SqlMoney.Add (Test1, Test2));
+ AssertEquals ("#D02", (SqlMoney)180000m, SqlMoney.Add (Test2, Test2));
+ AssertEquals ("#D03", (SqlMoney)45000m, SqlMoney.Add (Test2, Test4));
+
+ try {
+ SqlMoney test = SqlMoney.Add(SqlMoney.MaxValue, Test2);
+ Fail ("#D04");
+ } catch (Exception e) {
+ AssertEquals ("#D05", typeof (OverflowException), e.GetType ());
+ }
+
+ // Divide
+ AssertEquals ("#D06", (SqlMoney)45000m, SqlMoney.Divide (Test2, TestMoney2));
+ try {
+ SqlMoney test = SqlMoney.Divide (Test2, SqlMoney.Zero);
+ Fail ("#D07");
+ } catch (Exception e) {
+ AssertEquals ("#D08", typeof (DivideByZeroException),
+ e.GetType());
+ }
+
+ // Multiply
+ AssertEquals ("#D09", (SqlMoney)581818176m, SqlMoney.Multiply (Test1, Test2));
+ AssertEquals ("#D10", (SqlMoney)(-4050000000m), SqlMoney.Multiply (Test3, Test4));
+
+ try {
+ SqlMoney test = SqlMoney.Multiply (SqlMoney.MaxValue, Test2);
+ Fail ("#D11");
+ } catch (Exception e) {
+ AssertEquals ("#D12", typeof (OverflowException), e.GetType ());
+ }
+
+ // Subtract
+ AssertEquals ("#D13", (SqlMoney)0m, SqlMoney.Subtract (Test2, Test3));
+ AssertEquals ("#D14", (SqlMoney)83535.3536m, SqlMoney.Subtract (Test2, Test1));
+
+ try {
+ SqlMoney test = SqlMoney.Subtract (SqlMoney.MinValue, Test2);
+ } catch (Exception e) {
+ AssertEquals ("#D15", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestCompareTo()
+ {
+ Assert ("#E01", Test1.CompareTo (Test2) < 0);
+ Assert ("#E02", Test3.CompareTo (Test1) > 0);
+ Assert ("#E03", Test3.CompareTo (Test2) == 0);
+ Assert ("#E04", Test3.CompareTo (SqlMoney.Null) > 0);
+ }
+
+ public void TestEqualsMethods()
+ {
+ Assert ("#F01", !Test1.Equals (Test2));
+ Assert ("#F02", Test2.Equals (Test3));
+ Assert ("#F03", !SqlMoney.Equals (Test1, Test2).Value);
+ Assert ("#F04", SqlMoney.Equals (Test3, Test2).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#G01", Test3.GetHashCode (), Test2.GetHashCode ());
+ Assert ("#G02", Test2.GetHashCode () != Test1.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ AssertEquals ("#H01", "System.Data.SqlTypes.SqlMoney",
+ Test1.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ // GreateThan ()
+ Assert ("#I01", !SqlMoney.GreaterThan (Test1, Test2).Value);
+ Assert ("#I02", SqlMoney.GreaterThan (Test2, Test1).Value);
+ Assert ("#I03", !SqlMoney.GreaterThan (Test2, Test3).Value);
+ Assert ("#I04", SqlMoney.GreaterThan (Test2, SqlMoney.Null).IsNull);
+
+ // GreaterTharOrEqual ()
+ Assert ("#I05", !SqlMoney.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#I06", SqlMoney.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#I07", SqlMoney.GreaterThanOrEqual (Test3, Test2).Value);
+ Assert ("#I08", SqlMoney.GreaterThanOrEqual (Test3, SqlMoney.Null).IsNull);
+ }
+
+ public void TestLessers()
+ {
+ // LessThan()
+ Assert ("#J01", !SqlMoney.LessThan (Test2, Test3).Value);
+ Assert ("#J02", !SqlMoney.LessThan (Test2, Test1).Value);
+ Assert ("#J03", SqlMoney.LessThan (Test1, Test2).Value);
+ Assert ("#J04", SqlMoney.LessThan (SqlMoney.Null, Test2).IsNull);
+
+ // LessThanOrEqual ()
+ Assert ("#J05", SqlMoney.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#J06", !SqlMoney.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#J07", SqlMoney.LessThanOrEqual (Test2, Test2).Value);
+ Assert ("#J08", SqlMoney.LessThanOrEqual (Test2, SqlMoney.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ Assert ("#K01", SqlMoney.NotEquals (Test1, Test2).Value);
+ Assert ("#K02", SqlMoney.NotEquals (Test2, Test1).Value);
+ Assert ("#K03", !SqlMoney.NotEquals (Test2, Test3).Value);
+ Assert ("#K04", !SqlMoney.NotEquals (Test3, Test2).Value);
+ Assert ("#K05", SqlMoney.NotEquals (SqlMoney.Null, Test2).IsNull);
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlMoney.Parse (null);
+ Fail ("#L01");
+ } catch (Exception e) {
+ AssertEquals ("#L02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlMoney.Parse ("not-a-number");
+ Fail ("#L03");
+ } catch (Exception e) {
+
+ AssertEquals ("#L04", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlMoney.Parse ("1000000000000000");
+ Fail ("#L05");
+ } catch (Exception e) {
+ AssertEquals ("#L06", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals("#L07", (decimal)150, SqlMoney.Parse ("150").Value);
+ }
+
+ public void TestConversions()
+ {
+ SqlMoney TestMoney100 = new SqlMoney (100);
+
+ // ToDecimal
+ AssertEquals ("#M01", (decimal)6464.6464, Test1.ToDecimal ());
+
+ // ToDouble
+ AssertEquals ("#M02", (double)6464.6464, Test1.ToDouble ());
+
+ // ToInt32
+ AssertEquals ("#M03", (int)90000, Test2.ToInt32 ());
+ AssertEquals ("#M04", (int)6465, Test1.ToInt32 ());
+
+ // ToInt64
+ AssertEquals ("#M05", (long)90000, Test2.ToInt64 ());
+ AssertEquals ("#M06", (long)6465, Test1.ToInt64 ());
+
+ // ToSqlBoolean ()
+ Assert ("#M07", Test1.ToSqlBoolean ().Value);
+ Assert ("#M08", !SqlMoney.Zero.ToSqlBoolean ().Value);
+ Assert ("#M09", SqlMoney.Null.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ AssertEquals ("#M10", (byte)100, TestMoney100.ToSqlByte ().Value);
+
+ try {
+ SqlByte b = (byte)Test2.ToSqlByte ();
+ Fail ("#M11");
+ } catch (Exception e) {
+ AssertEquals ("#M12", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDecimal ()
+ AssertEquals ("#M13", (decimal)6464.6464, Test1.ToSqlDecimal ().Value);
+ AssertEquals ("#M14", (decimal)-45000, Test4.ToSqlDecimal ().Value);
+
+ // ToSqlInt16 ()
+ AssertEquals ("#M15", (short)6465, Test1.ToSqlInt16 ().Value);
+
+ try {
+ SqlInt16 test = SqlMoney.MaxValue.ToSqlInt16().Value;
+ Fail ("#M17");
+ } catch (Exception e) {
+ AssertEquals ("#M18", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt32 ()
+ AssertEquals ("#M19", (int)6465, Test1.ToSqlInt32 ().Value);
+ AssertEquals ("#M20", (int)(-45000), Test4.ToSqlInt32 ().Value);
+
+ try {
+ SqlInt32 test = SqlMoney.MaxValue.ToSqlInt32 ().Value;
+ Fail ("#M21");
+ } catch (Exception e) {
+ AssertEquals ("#M22", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt64 ()
+ AssertEquals ("#M23", (long)6465, Test1.ToSqlInt64 ().Value);
+ AssertEquals ("#M24", (long)(-45000), Test4.ToSqlInt64 ().Value);
+
+ // ToSqlSingle ()
+ AssertEquals ("#M25", (float)6464.6464, Test1.ToSqlSingle ().Value);
+
+ // ToSqlString ()
+ AssertEquals ("#M26", "6464,6464", Test1.ToSqlString ().Value);
+ AssertEquals ("#M27", "90000", Test2.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("#M28", "6464,6464", Test1.ToString ());
+ AssertEquals ("#M29", "90000", Test2.ToString ());
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ // "+"-operator
+ AssertEquals ("#N01", (SqlMoney)96464.6464m, Test1 + Test2);
+
+ try {
+ SqlMoney test = SqlMoney.MaxValue + SqlMoney.MaxValue;
+ Fail ("#N02");
+ } catch (Exception e) {
+ AssertEquals ("#N03", typeof (OverflowException), e.GetType ());
+ }
+
+ // "/"-operator
+ AssertEquals ("#N04", (SqlMoney)13.9219m, Test2 / Test1);
+
+ try {
+ SqlMoney test = Test3 / SqlMoney.Zero;
+ Fail ("#N05");
+ } catch (Exception e) {
+ AssertEquals ("#N06", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // "*"-operator
+ AssertEquals ("#N07", (SqlMoney)581818176m, Test1 * Test2);
+
+ try {
+ SqlMoney test = SqlMoney.MaxValue * Test1;
+ Fail ("#N08");
+ } catch (Exception e) {
+ AssertEquals ("#N09", typeof (OverflowException), e.GetType ());
+ }
+
+ // "-"-operator
+ AssertEquals ("#N10", (SqlMoney)83535.3536m, Test2 - Test1);
+
+ try {
+ SqlMoney test = SqlMoney.MinValue - SqlMoney.MaxValue;
+ Fail ("#N11");
+ } catch (Exception e) {
+ AssertEquals ("#N12", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ // == -operator
+ Assert ("#O01", (Test2 == Test2).Value);
+ Assert ("#O02", !(Test1 == Test2).Value);
+ Assert ("#O03", (Test1 == SqlMoney.Null).IsNull);
+
+ // != -operator
+ Assert ("#O04", !(Test2 != Test3).Value);
+ Assert ("#O05", (Test1 != Test3).Value);
+ Assert ("#O06", (Test1 != Test4).Value);
+ Assert ("#O07", (Test1 != SqlMoney.Null).IsNull);
+
+ // > -operator
+ Assert ("#O08", (Test1 > Test4).Value);
+ Assert ("#O09", (Test2 > Test1).Value);
+ Assert ("#O10", !(Test2 > Test3).Value);
+ Assert ("#O11", (Test1 > SqlMoney.Null).IsNull);
+
+ // >= -operator
+ Assert ("#O12", !(Test1 >= Test3).Value);
+ Assert ("#O13", (Test3 >= Test1).Value);
+ Assert ("#O14", (Test2 >= Test3).Value);
+ Assert ("#O15", (Test1 >= SqlMoney.Null).IsNull);
+
+ // < -operator
+ Assert ("#O16", !(Test2 < Test1).Value);
+ Assert ("#O17", (Test1 < Test3).Value);
+ Assert ("#O18", !(Test2 < Test3).Value);
+ Assert ("#O19", (Test1 < SqlMoney.Null).IsNull);
+
+ // <= -operator
+ Assert ("#O20", (Test1 <= Test3).Value);
+ Assert ("#O21", !(Test3 <= Test1).Value);
+ Assert ("#O22", (Test2 <= Test3).Value);
+ Assert ("#O23", (Test1 <= SqlMoney.Null).IsNull);
+ }
+
+ public void TestUnaryNegation()
+ {
+
+ AssertEquals ("#P01", (decimal)(-6464.6464), -(Test1).Value);
+ AssertEquals ("#P02", (decimal)45000, -(Test4).Value);
+ }
+
+ public void TestSqlBooleanToSqlMoney()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+
+ AssertEquals ("#Q01", (decimal)1, ((SqlMoney)TestBoolean).Value);
+ Assert ("#Q02", ((SqlDecimal)SqlBoolean.Null).IsNull);
+ }
+
+ public void TestSqlDecimalToSqlMoney()
+ {
+ SqlDecimal TestDecimal = new SqlDecimal (4000);
+ SqlDecimal TestDecimal2 = new SqlDecimal (1E+20);
+
+ SqlMoney TestMoney = (SqlMoney)TestDecimal;
+ AssertEquals ("#R01", TestMoney.Value, TestDecimal.Value);
+
+ try {
+ SqlMoney test = (SqlMoney)TestDecimal2;
+ Fail ("#R02");
+ } catch (Exception e) {
+ AssertEquals ("#R03", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestSqlDoubleToSqlMoney()
+ {
+ SqlDouble TestDouble = new SqlDouble (1E+9);
+ SqlDouble TestDouble2 = new SqlDouble (1E+20);
+
+ SqlMoney TestMoney = (SqlMoney)TestDouble;
+ AssertEquals ("#S01", 1000000000m, TestMoney.Value);
+
+ try {
+ SqlMoney test = (SqlMoney)TestDouble2;
+ Fail ("#S02");
+ } catch (Exception e) {
+ AssertEquals ("#S03", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void SqlMoneyToDecimal()
+ {
+ AssertEquals ("#T01", (decimal)6464.6464, (decimal)Test1);
+ AssertEquals ("#T02", (decimal)(-45000), (decimal)Test4);
+ }
+
+ public void SqlSingleToSqlMoney()
+ {
+ SqlSingle TestSingle = new SqlSingle (1e10);
+ SqlSingle TestSingle2 = new SqlSingle (1e20);
+
+ AssertEquals ("#U01", 10000000000m, ((SqlMoney)TestSingle).Value);
+
+ try {
+ SqlMoney test = (SqlMoney)TestSingle2;
+ Fail ("#U02");
+ } catch (Exception e) {
+ AssertEquals ("#U03", typeof (OverflowException), e.GetType());
+ }
+ }
+
+ public void TestSqlStringToSqlMoney()
+ {
+ SqlString TestString = new SqlString ("Test string");
+ SqlString TestString100 = new SqlString ("100");
+
+ AssertEquals ("#V01", (decimal)100, ((SqlMoney)TestString100).Value);
+
+ try {
+ SqlMoney test = (SqlMoney)TestString;
+ Fail ("#V02");
+ } catch(Exception e) {
+ AssertEquals ("#V03", typeof (FormatException), e.GetType ());
+ }
+ }
+
+ public void DecimalToSqlMoney()
+ {
+ decimal TestDecimal = 1e10m;
+ decimal TestDecimal2 = 1e20m;
+ AssertEquals ("#W01", 10000000000, ((SqlMoney)TestDecimal).Value);
+
+ try {
+ SqlMoney test = (SqlMoney)TestDecimal2;
+ Fail ("#W02");
+ } catch (Exception e) {
+ AssertEquals ("#W03", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void SqlByteToSqlMoney()
+ {
+ SqlByte TestByte = new SqlByte ((byte)200);
+ AssertEquals ("#X01", 200m, ((SqlMoney)TestByte).Value);
+ }
+
+ public void IntsToSqlMoney()
+ {
+ SqlInt16 TestInt16 = new SqlInt16 (5000);
+ SqlInt32 TestInt32 = new SqlInt32 (5000);
+ SqlInt64 TestInt64 = new SqlInt64 (5000);
+
+ AssertEquals ("#Y01", 5000m, ((SqlMoney)TestInt16).Value);
+ AssertEquals ("#Y02", 5000m, ((SqlMoney)TestInt32).Value);
+ AssertEquals ("#Y03", 5000m, ((SqlMoney)TestInt64).Value);
+
+ try {
+ SqlMoney test = (SqlMoney)SqlInt64.MaxValue;
+ Fail ("#Y04");
+ } catch (Exception e) {
+ AssertEquals ("#Y05", typeof (OverflowException), e.GetType ());
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlSingleTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlSingleTest.cs
new file mode 100644
index 00000000000..f714e38d7a1
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlSingleTest.cs
@@ -0,0 +1,540 @@
+//
+// SqlSingleTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlSingle
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlSingleTest : TestCase {
+
+ public SqlSingleTest() : base ("System.Data.SqlTypes.SqlSingle") {}
+ public SqlSingleTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SqlSingle));
+ }
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+ SqlSingle Test= new SqlSingle ((float)34.87);
+ SqlSingle Test2 = 45.2f;
+
+ AssertEquals ("#A01", 34.87f, Test.Value);
+ AssertEquals ("#A02", 45.2f, Test2.Value);
+
+ Test = new SqlSingle (-9000.6543);
+ AssertEquals ("#A03", -9000.6543f, Test.Value);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ AssertEquals ("#B01", 3.40282346638528859E+38f,
+ SqlSingle.MaxValue.Value);
+ AssertEquals ("#B02", -3.40282346638528859E+38f,
+ SqlSingle.MinValue.Value);
+ Assert ("#B03", SqlSingle.Null.IsNull);
+ AssertEquals ("#B04", 0f, SqlSingle.Zero.Value);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ SqlSingle Test = new SqlSingle (5443e12f);
+ SqlSingle Test1 = new SqlSingle (1);
+
+ Assert ("#C01", SqlSingle.Null.IsNull);
+ AssertEquals ("#C02", 5443e12f, Test.Value);
+ AssertEquals ("#C03", (float)1, Test1.Value);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestArithmeticMethods()
+ {
+ SqlSingle Test0 = new SqlSingle (0);
+ SqlSingle Test1 = new SqlSingle (15E+18);
+ SqlSingle Test2 = new SqlSingle (-65E+6);
+ SqlSingle Test3 = new SqlSingle (5E+30);
+ SqlSingle Test4 = new SqlSingle (5E+18);
+ SqlSingle TestMax = new SqlSingle (SqlSingle.MaxValue.Value);
+
+ // Add()
+ AssertEquals ("#D01A", 15E+18f, SqlSingle.Add (Test1, Test0).Value);
+ AssertEquals ("#D02A", 1.5E+19f, SqlSingle.Add (Test1, Test2).Value);
+
+ try {
+ SqlSingle test = SqlSingle.Add (SqlSingle.MaxValue,
+ SqlSingle.MaxValue);
+ Fail ("#D03A");
+ } catch (Exception e) {
+ AssertEquals ("#D04A", typeof (OverflowException), e.GetType ());
+ }
+
+ // Divide()
+ AssertEquals ("#D01B", (SqlSingle)3, SqlSingle.Divide (Test1, Test4));
+ AssertEquals ("#D02B", -1.3E-23f, SqlSingle.Divide (Test2, Test3).Value);
+
+ try {
+ SqlSingle test = SqlSingle.Divide(Test1, Test0).Value;
+ Fail ("#D03B");
+ } catch(Exception e) {
+ AssertEquals ("#D04B", typeof (DivideByZeroException),
+ e.GetType ());
+ }
+
+ // Multiply()
+ AssertEquals ("#D01D", (float)(7.5E+37),
+ SqlSingle.Multiply (Test1, Test4).Value);
+ AssertEquals ("#D02D", (float)0, SqlSingle.Multiply (Test1, Test0).Value);
+
+ try {
+ SqlSingle test = SqlSingle.Multiply (TestMax, Test1);
+ Fail ("#D03D");
+ } catch (Exception e) {
+ AssertEquals ("#D04D", typeof (OverflowException), e.GetType ());
+ }
+
+
+ // Subtract()
+ AssertEquals ("#D01F", (float)(-5E+30),
+ SqlSingle.Subtract (Test1, Test3).Value);
+
+ try {
+ SqlSingle test = SqlSingle.Subtract(
+ SqlSingle.MinValue, SqlSingle.MaxValue);
+ Fail ("D02F");
+ } catch (Exception e) {
+ AssertEquals ("#D03F", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestCompareTo()
+ {
+ SqlSingle Test1 = new SqlSingle (4E+30);
+ SqlSingle Test11 = new SqlSingle (4E+30);
+ SqlSingle Test2 = new SqlSingle (-9E+30);
+ SqlSingle Test3 = new SqlSingle (10000);
+ SqlString TestString = new SqlString ("This is a test");
+
+ Assert ("#E01", Test1.CompareTo (Test3) > 0);
+ Assert ("#E02", Test2.CompareTo (Test3) < 0);
+ Assert ("#E03", Test1.CompareTo (Test11) == 0);
+ Assert ("#E04", Test11.CompareTo (SqlSingle.Null) > 0);
+
+ try {
+ Test1.CompareTo (TestString);
+ Fail("#E05");
+ } catch(Exception e) {
+ AssertEquals ("#E06", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestEqualsMethods()
+ {
+ SqlSingle Test0 = new SqlSingle (0);
+ SqlSingle Test1 = new SqlSingle (1.58e30);
+ SqlSingle Test2 = new SqlSingle (1.8e32);
+ SqlSingle Test22 = new SqlSingle (1.8e32);
+
+ Assert ("#F01", !Test0.Equals (Test1));
+ Assert ("#F02", !Test1.Equals (Test2));
+ Assert ("#F03", !Test2.Equals (new SqlString ("TEST")));
+ Assert ("#F04", Test2.Equals (Test22));
+
+ // Static Equals()-method
+ Assert ("#F05", SqlSingle.Equals (Test2, Test22).Value);
+ Assert ("#F06", !SqlSingle.Equals (Test1, Test2).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ SqlSingle Test15 = new SqlSingle (15);
+
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#G01", Test15.GetHashCode (), Test15.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ SqlSingle Test = new SqlSingle (84);
+ AssertEquals ("#H01", "System.Data.SqlTypes.SqlSingle",
+ Test.GetType ().ToString ());
+ AssertEquals ("#H02", "System.Single", Test.Value.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+ SqlSingle Test1 = new SqlSingle (1e10);
+ SqlSingle Test11 = new SqlSingle (1e10);
+ SqlSingle Test2 = new SqlSingle (64e14);
+
+ // GreateThan ()
+ Assert ("#I01", !SqlSingle.GreaterThan (Test1, Test2).Value);
+ Assert ("#I02", SqlSingle.GreaterThan (Test2, Test1).Value);
+ Assert ("#I03", !SqlSingle.GreaterThan (Test1, Test11).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("#I04", !SqlSingle.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#I05", SqlSingle.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#I06", SqlSingle.GreaterThanOrEqual (Test1, Test11).Value);
+ }
+
+ public void TestLessers()
+ {
+ SqlSingle Test1 = new SqlSingle(1.8e10);
+ SqlSingle Test11 = new SqlSingle (1.8e10);
+ SqlSingle Test2 = new SqlSingle (64e14);
+
+ // LessThan()
+ Assert ("#J01", !SqlSingle.LessThan (Test1, Test11).Value);
+ Assert ("#J02", !SqlSingle.LessThan (Test2, Test1).Value);
+ Assert ("#J03", SqlSingle.LessThan (Test11, Test2).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#J04", SqlSingle.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#J05", !SqlSingle.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#J06", SqlSingle.LessThanOrEqual (Test11, Test1).Value);
+ Assert ("#J07", SqlSingle.LessThanOrEqual (Test11, SqlSingle.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ SqlSingle Test1 = new SqlSingle (12800000000001);
+ SqlSingle Test2 = new SqlSingle (128e10);
+ SqlSingle Test22 = new SqlSingle (128e10);
+
+ Assert ("#K01", SqlSingle.NotEquals (Test1, Test2).Value);
+ Assert ("#K02", SqlSingle.NotEquals (Test2, Test1).Value);
+ Assert ("#K03", SqlSingle.NotEquals (Test22, Test1).Value);
+ Assert ("#K04", !SqlSingle.NotEquals (Test22, Test2).Value);
+ Assert ("#K05", !SqlSingle.NotEquals (Test2, Test22).Value);
+ Assert ("#K06", SqlSingle.NotEquals (SqlSingle.Null, Test22).IsNull);
+ Assert ("#K07", SqlSingle.NotEquals (SqlSingle.Null, Test22).IsNull);
+ }
+
+ public void TestParse()
+ {
+ try {
+ SqlSingle.Parse (null);
+ Fail ("#L01");
+ } catch (Exception e) {
+ AssertEquals ("#L02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ SqlSingle.Parse ("not-a-number");
+ Fail ("#L03");
+ } catch (Exception e) {
+ AssertEquals ("#L04", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlSingle.Parse ("9e44");
+ Fail ("#L05");
+ } catch (Exception e) {
+ AssertEquals ("#L06", typeof (OverflowException), e.GetType ());
+ }
+
+ AssertEquals("#L07", (float)150, SqlSingle.Parse ("150").Value);
+ }
+
+ public void TestConversions()
+ {
+ SqlSingle Test0 = new SqlSingle (0);
+ SqlSingle Test1 = new SqlSingle (250);
+ SqlSingle Test2 = new SqlSingle (64E+16);
+ SqlSingle Test3 = new SqlSingle (64E+30);
+ SqlSingle TestNull = SqlSingle.Null;
+
+ // ToSqlBoolean ()
+ Assert ("#M01A", Test1.ToSqlBoolean ().Value);
+ Assert ("#M02A", !Test0.ToSqlBoolean ().Value);
+ Assert ("#M03A", TestNull.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ AssertEquals ("#M01B", (byte)250, Test1.ToSqlByte ().Value);
+ AssertEquals ("#M02B", (byte)0, Test0.ToSqlByte ().Value);
+
+ try {
+ SqlByte b = (byte)Test2.ToSqlByte ();
+ Fail ("#M03B");
+ } catch (Exception e) {
+ AssertEquals ("#M04B", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDecimal ()
+ AssertEquals ("#M01C", (decimal)250, Test1.ToSqlDecimal ().Value);
+ AssertEquals ("#M02C", (decimal)0, Test0.ToSqlDecimal ().Value);
+
+ try {
+ SqlDecimal test = Test3.ToSqlDecimal ().Value;
+ Fail ("#M03C");
+ } catch (Exception e) {
+ AssertEquals ("#M04C", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt16 ()
+ AssertEquals ("#M01D", (short)250, Test1.ToSqlInt16 ().Value);
+ AssertEquals ("#M02D", (short)0, Test0.ToSqlInt16 ().Value);
+
+ try {
+ SqlInt16 test = Test2.ToSqlInt16().Value;
+ Fail ("#M03D");
+ } catch (Exception e) {
+ AssertEquals ("#M04D", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt32 ()
+ AssertEquals ("#M01E", (int)250, Test1.ToSqlInt32 ().Value);
+ AssertEquals ("#M02E", (int)0, Test0.ToSqlInt32 ().Value);
+
+ try {
+ SqlInt32 test = Test2.ToSqlInt32 ().Value;
+ Fail ("#M03E");
+ } catch (Exception e) {
+ AssertEquals ("#M04E", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlInt64 ()
+ AssertEquals ("#M01F", (long)250, Test1.ToSqlInt64 ().Value);
+ AssertEquals ("#M02F", (long)0, Test0.ToSqlInt64 ().Value);
+
+ try {
+ SqlInt64 test = Test3.ToSqlInt64 ().Value;
+ Fail ("#M03F");
+ } catch (Exception e) {
+ AssertEquals ("#M04F", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlMoney ()
+ AssertEquals ("#M01G", (decimal)250, Test1.ToSqlMoney ().Value);
+ AssertEquals ("#M02G", (decimal)0, Test0.ToSqlMoney ().Value);
+
+ try {
+ SqlMoney test = Test3.ToSqlMoney ().Value;
+ Fail ("#M03G");
+ } catch (Exception e) {
+ AssertEquals ("#M04G", typeof (OverflowException), e.GetType ());
+ }
+
+
+ // ToSqlString ()
+ AssertEquals ("#M01H", "250", Test1.ToSqlString ().Value);
+ AssertEquals ("#M02H", "0", Test0.ToSqlString ().Value);
+ AssertEquals ("#M03H", "6,4E+17", Test2.ToSqlString ().Value);
+
+ // ToString ()
+ AssertEquals ("#M01I", "250", Test1.ToString ());
+ AssertEquals ("#M02I", "0", Test0.ToString ());
+ AssertEquals ("#M03I", "6,4E+17", Test2.ToString ());
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ SqlSingle Test0 = new SqlSingle (0);
+ SqlSingle Test1 = new SqlSingle (24E+11);
+ SqlSingle Test2 = new SqlSingle (64E+32);
+ SqlSingle Test3 = new SqlSingle (12E+11);
+ SqlSingle Test4 = new SqlSingle (1E+10);
+ SqlSingle Test5 = new SqlSingle (2E+10);
+
+ // "+"-operator
+ AssertEquals ("#N01", (SqlSingle)3E+10, Test4 + Test5);
+
+ try {
+ SqlSingle test = SqlSingle.MaxValue + SqlSingle.MaxValue;
+ Fail ("#N02");
+ } catch (Exception e) {
+ AssertEquals ("#N03", typeof (OverflowException), e.GetType ());
+ }
+
+ try {
+ SqlSingle test = SqlSingle.MaxValue + SqlSingle.MaxValue;
+ } catch (Exception e) {
+ AssertEquals ("#N03a", typeof (OverflowException), e.GetType ());
+ }
+
+ // "/"-operator
+ AssertEquals ("#N04", (SqlSingle)2, Test1 / Test3);
+
+ try {
+ SqlSingle test = Test3 / Test0;
+ Fail ("#N05");
+ } catch (Exception e) {
+ AssertEquals ("#N06", typeof (DivideByZeroException), e.GetType ());
+ }
+
+ // "*"-operator
+ AssertEquals ("#N07", (SqlSingle)2E+20, Test4 * Test5);
+
+ try {
+ SqlSingle test = SqlSingle.MaxValue * Test1;
+ Fail ("#N08");
+ } catch (Exception e) {
+ AssertEquals ("#N09", typeof (OverflowException), e.GetType ());
+ }
+
+ // "-"-operator
+ AssertEquals ("#N10", (SqlSingle)12e11, Test1 - Test3);
+
+ try {
+ SqlSingle test = SqlSingle.MinValue - SqlSingle.MaxValue;
+ Fail ("#N11");
+ } catch (Exception e) {
+ AssertEquals ("#N12", typeof (OverflowException), e.GetType ());
+ }
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ SqlSingle Test1 = new SqlSingle (1.0E+14f);
+ SqlSingle Test2 = new SqlSingle (9.7E+11);
+ SqlSingle Test22 = new SqlSingle (9.7E+11);
+ SqlSingle Test3 = new SqlSingle (2.0E+22f);
+
+ // == -operator
+ Assert ("#O01", (Test2 == Test22).Value);
+ Assert ("#O02", !(Test1 == Test2).Value);
+ Assert ("#O03", (Test1 == SqlSingle.Null).IsNull);
+
+ // != -operator
+ Assert ("#O04", !(Test2 != Test22).Value);
+ Assert ("#O05", (Test2 != Test3).Value);
+ Assert ("#O06", (Test1 != Test3).Value);
+ Assert ("#O07", (Test1 != SqlSingle.Null).IsNull);
+
+ // > -operator
+ Assert ("#O08", (Test1 > Test2).Value);
+ Assert ("#O09", !(Test1 > Test3).Value);
+ Assert ("#O10", !(Test2 > Test22).Value);
+ Assert ("#O11", (Test1 > SqlSingle.Null).IsNull);
+
+ // >= -operator
+ Assert ("#O12", !(Test1 >= Test3).Value);
+ Assert ("#O13", (Test3 >= Test1).Value);
+ Assert ("#O14", (Test2 >= Test22).Value);
+ Assert ("#O15", (Test1 >= SqlSingle.Null).IsNull);
+
+ // < -operator
+ Assert ("#O16", !(Test1 < Test2).Value);
+ Assert ("#O17", (Test1 < Test3).Value);
+ Assert ("#O18", !(Test2 < Test22).Value);
+ Assert ("#O19", (Test1 < SqlSingle.Null).IsNull);
+
+ // <= -operator
+ Assert ("#O20", (Test1 <= Test3).Value);
+ Assert ("#O21", !(Test3 <= Test1).Value);
+ Assert ("#O22", (Test2 <= Test22).Value);
+ Assert ("#O23", (Test1 <= SqlSingle.Null).IsNull);
+ }
+
+ public void TestUnaryNegation()
+ {
+ SqlSingle Test = new SqlSingle (2000000001);
+ SqlSingle TestNeg = new SqlSingle (-3000);
+
+ SqlSingle Result = -Test;
+ AssertEquals ("#P01", (float)(-2000000001), Result.Value);
+
+ Result = -TestNeg;
+ AssertEquals ("#P02", (float)3000, Result.Value);
+ }
+
+ public void TestSqlBooleanToSqlSingle()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+ SqlSingle Result;
+
+ Result = (SqlSingle)TestBoolean;
+
+ AssertEquals ("#Q01", (float)1, Result.Value);
+
+ Result = (SqlSingle)SqlBoolean.Null;
+ Assert ("#Q02", Result.IsNull);
+ }
+
+ public void TestSqlDoubleToSqlSingle()
+ {
+ SqlDouble Test = new SqlDouble (12e12);
+ SqlSingle TestSqlSingle = (SqlSingle)Test;
+ AssertEquals ("R01", 12e12f, TestSqlSingle.Value);
+ }
+
+ public void TestSqlSingleToSingle()
+ {
+ SqlSingle Test = new SqlSingle (12e12);
+ Single Result = (Single)Test;
+ AssertEquals ("#S01", 12e12f, Result);
+ }
+
+ public void TestSqlStringToSqlSingle()
+ {
+ SqlString TestString = new SqlString ("Test string");
+ SqlString TestString100 = new SqlString ("100");
+
+ AssertEquals ("#T01", (float)100, ((SqlSingle)TestString100).Value);
+
+ try {
+ SqlSingle test = (SqlSingle)TestString;
+ Fail ("#T02");
+ } catch(Exception e) {
+ AssertEquals ("#T03", typeof (FormatException), e.GetType ());
+ }
+ }
+
+ public void TestByteToSqlSingle()
+ {
+ short TestShort = 14;
+ AssertEquals ("#U01", (float)14, ((SqlSingle)TestShort).Value);
+ }
+
+ public void TestSqlDecimalToSqlSingle()
+ {
+ SqlDecimal TestDecimal64 = new SqlDecimal (64);
+
+ AssertEquals ("#V01", (float)64, ((SqlSingle)TestDecimal64).Value);
+ AssertEquals ("#V02", SqlSingle.Null, ((SqlSingle)SqlDecimal.Null));
+ }
+
+ public void TestSqlIntToSqlSingle()
+ {
+ SqlInt16 Test64 = new SqlInt16 (64);
+ SqlInt32 Test640 = new SqlInt32 (640);
+ SqlInt64 Test64000 = new SqlInt64 (64000);
+ AssertEquals ("#W01", (float)64, ((SqlSingle)Test64).Value);
+ AssertEquals ("#W02", (float)640, ((SqlSingle)Test640).Value);
+ AssertEquals ("#W03", (float)64000, ((SqlSingle)Test64000).Value);
+ }
+
+
+ public void TestSqlMoneyToSqlSingle()
+ {
+ SqlMoney TestMoney64 = new SqlMoney(64);
+ AssertEquals ("#X01", (float)64, ((SqlSingle)TestMoney64).Value);
+ }
+
+ public void TestSingleToSqlSingle()
+ {
+ Single TestSingle64 = 64;
+ AssertEquals ("#Y01", (float)64, ((SqlSingle)TestSingle64).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs
new file mode 100644
index 00000000000..35206236bd7
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs
@@ -0,0 +1,640 @@
+// SqlStringTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlString
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class SqlStringTest : TestCase {
+
+ private SqlString Test1 = null;
+ private SqlString Test2 = null;
+ private SqlString Test3 = null;
+
+ public SqlStringTest() : base ("System.Data.SqlTypes.SqlString") {}
+ public SqlStringTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ Test1 = new SqlString ("First TestString");
+ Test2 = new SqlString ("This is just a test SqlString");
+ Test3 = new SqlString ("This is just a test SqlString");
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-AU");
+ }
+
+ public static ITest Suite {
+ get {
+
+ return new TestSuite(typeof(SqlDateTime));
+
+ }
+
+ }
+
+ // Test constructor
+ public void TestCreate()
+ {
+
+ // SqlString (String)
+ SqlString TestString = new SqlString ("Test");
+ AssertEquals ("#A01", "Test", TestString.Value);
+
+ // SqlString (String, int)
+ TestString = new SqlString ("Test", 2057);
+ AssertEquals ("#A02", 2057, TestString.LCID);
+
+ // SqlString (int, SqlCompareOptions, byte[])
+ TestString = new SqlString (2057,
+ SqlCompareOptions.BinarySort|SqlCompareOptions.IgnoreCase,
+ new byte [2] {123, 221});
+ AssertEquals ("#A03", 2057, TestString.CompareInfo.LCID);
+
+ // SqlString(string, int, SqlCompareOptions)
+ TestString = new SqlString ("Test", 2057, SqlCompareOptions.IgnoreNonSpace);
+ Assert ("#A04", !TestString.IsNull);
+
+ // SqlString (int, SqlCompareOptions, byte[], bool)
+ TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [4] {100, 100, 200, 45}, true);
+ AssertEquals ("#A05", (byte)63, TestString.GetNonUnicodeBytes () [0]);
+ TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, false);
+ AssertEquals ("#A06", (String)"qd", TestString.Value);
+
+ // SqlString (int, SqlCompareOptions, byte[], int, int)
+ TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 0, 2);
+ Assert ("#A07", !TestString.IsNull);
+
+ try {
+ TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 2, 1);
+ Fail ("#A07b");
+ } catch (Exception e) {
+ AssertEquals ("#A07c", typeof (ArgumentOutOfRangeException), e.GetType ());
+ }
+
+ try {
+ TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 0, 4);
+ Fail ("#A07d");
+ } catch (Exception e) {
+ AssertEquals ("#A07e", typeof (ArgumentOutOfRangeException), e.GetType ());
+ }
+
+ // SqlString (int, SqlCompareOptions, byte[], int, int, bool)
+ TestString = new SqlString (2057, SqlCompareOptions.IgnoreCase, new byte [3] {100, 111, 50}, 1, 2, false);
+ AssertEquals ("#A08", "o2", TestString.Value);
+ TestString = new SqlString (2057, SqlCompareOptions.IgnoreCase, new byte [3] {123, 111, 222}, 1, 2, true);
+ Assert ("#A09", !TestString.IsNull);
+ }
+
+ // Test public fields
+ public void TestPublicFields()
+ {
+ // BinarySort
+ AssertEquals ("#B01", 32768, SqlString.BinarySort);
+
+ // IgnoreCase
+ AssertEquals ("#B02", 1, SqlString.IgnoreCase);
+
+ // IgnoreKanaType
+ AssertEquals ("#B03", 8, SqlString.IgnoreKanaType);
+
+ // IgnoreNonSpace
+ AssertEquals ("#B04", 2, SqlString.IgnoreNonSpace);
+
+ // IgnoreWidth
+ AssertEquals ("#B05", 16, SqlString.IgnoreWidth);
+
+ // Null
+ Assert ("#B06", SqlString.Null.IsNull);
+ }
+
+ // Test properties
+ public void TestProperties()
+ {
+ // CompareInfo
+ AssertEquals ("#C01", 3081, Test1.CompareInfo.LCID);
+
+ // CultureInfo
+ AssertEquals ("#C02", 3081, Test1.CultureInfo.LCID);
+
+ // IsNull
+ Assert ("#C03", !Test1.IsNull);
+ Assert ("#C04", SqlString.Null.IsNull);
+
+ // LCID
+ AssertEquals ("#C05", 3081, Test1.LCID);
+
+ // SqlCompareOptions
+ AssertEquals ("#C06", "IgnoreCase, IgnoreKanaType, IgnoreWidth",
+ Test1.SqlCompareOptions.ToString ());
+
+ // Value
+ AssertEquals ("#C07", "First TestString", Test1.Value);
+ }
+
+ // PUBLIC METHODS
+
+ public void TestCompareTo()
+ {
+ SqlByte Test = new SqlByte (1);
+
+ Assert ("#D01", Test1.CompareTo (Test3) < 0);
+ Assert ("#D02", Test2.CompareTo (Test1) > 0);
+ Assert ("#D03", Test2.CompareTo (Test3) == 0);
+ Assert ("#D04", Test3.CompareTo (SqlString.Null) > 0);
+
+ try {
+ Test1.CompareTo (Test);
+ Fail("#D05");
+ } catch(Exception e) {
+ AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());
+ }
+
+ SqlString T1 = new SqlString ("test", 2057, SqlCompareOptions.IgnoreCase);
+ SqlString T2 = new SqlString ("TEST", 2057, SqlCompareOptions.None);
+
+ try {
+ T1.CompareTo (T2);
+ Fail ("#D07");
+ } catch (Exception e) {
+ AssertEquals ("#D08", typeof (SqlTypeException), e.GetType ());
+ }
+
+ // IgnoreCase
+ T1 = new SqlString ("test", 2057, SqlCompareOptions.IgnoreCase);
+ T2 = new SqlString ("TEST", 2057, SqlCompareOptions.IgnoreCase);
+ Assert ("#D09", T2.CompareTo (T1) == 0);
+
+ T1 = new SqlString ("test", 2057);
+ T2 = new SqlString ("TEST", 2057);
+ Assert ("#D10", T2.CompareTo (T1) == 0);
+
+ T1 = new SqlString ("test", 2057, SqlCompareOptions.None);
+ T2 = new SqlString ("TEST", 2057, SqlCompareOptions.None);
+ Assert ("#D11", T2.CompareTo (T1) != 0);
+
+ // IgnoreNonSpace
+ T1 = new SqlString ("TESTñ", 2057, SqlCompareOptions.IgnoreNonSpace);
+ T2 = new SqlString ("TESTn", 2057, SqlCompareOptions.IgnoreNonSpace);
+ Assert ("#D12", T2.CompareTo (T1) == 0);
+
+ T1 = new SqlString ("TESTñ", 2057, SqlCompareOptions.None);
+ T2 = new SqlString ("TESTn", 2057, SqlCompareOptions.None);
+ Assert ("#D13", T2.CompareTo (T1) != 0);
+
+ // BinarySort
+ T1 = new SqlString ("01_", 2057, SqlCompareOptions.BinarySort);
+ T2 = new SqlString ("_01", 2057, SqlCompareOptions.BinarySort);
+ Assert ("#D14", T1.CompareTo (T2) < 0);
+
+ T1 = new SqlString ("01_", 2057, SqlCompareOptions.None);
+ T2 = new SqlString ("_01", 2057, SqlCompareOptions.None);
+ Assert ("#D15", T1.CompareTo (T2) > 0);
+ }
+
+ public void TestEqualsMethods()
+ {
+ Assert ("#E01", !Test1.Equals (Test2));
+ Assert ("#E02", !Test3.Equals (Test1));
+ Assert ("#E03", !Test2.Equals (new SqlString ("TEST")));
+ Assert ("#E04", Test2.Equals (Test3));
+
+ // Static Equals()-method
+ Assert ("#E05", SqlString.Equals (Test2, Test3).Value);
+ Assert ("#E06", !SqlString.Equals (Test1, Test2).Value);
+ }
+
+ public void TestGetHashCode()
+ {
+ // FIXME: Better way to test HashCode
+ AssertEquals ("#F01", Test1.GetHashCode (),
+ Test1.GetHashCode ());
+ Assert ("#F02", Test1.GetHashCode () != Test2.GetHashCode ());
+ Assert ("#F03", Test2.GetHashCode () == Test2.GetHashCode ());
+ }
+
+ public void TestGetType()
+ {
+ AssertEquals ("#G01", "System.Data.SqlTypes.SqlString",
+ Test1.GetType ().ToString ());
+ AssertEquals ("#G02", "System.String",
+ Test1.Value.GetType ().ToString ());
+ }
+
+ public void TestGreaters()
+ {
+
+ // GreateThan ()
+ Assert ("#H01", !SqlString.GreaterThan (Test1, Test2).Value);
+ Assert ("#H02", SqlString.GreaterThan (Test2, Test1).Value);
+ Assert ("#H03", !SqlString.GreaterThan (Test2, Test3).Value);
+
+ // GreaterTharOrEqual ()
+ Assert ("#H04", !SqlString.GreaterThanOrEqual (Test1, Test2).Value);
+ Assert ("#H05", SqlString.GreaterThanOrEqual (Test2, Test1).Value);
+ Assert ("#H06", SqlString.GreaterThanOrEqual (Test2, Test3).Value);
+ }
+
+ public void TestLessers()
+ {
+ // LessThan()
+ Assert ("#I01", !SqlString.LessThan (Test2, Test3).Value);
+ Assert ("#I02", !SqlString.LessThan (Test2, Test1).Value);
+ Assert ("#I03", SqlString.LessThan (Test1, Test2).Value);
+
+ // LessThanOrEqual ()
+ Assert ("#I04", SqlString.LessThanOrEqual (Test1, Test2).Value);
+ Assert ("#I05", !SqlString.LessThanOrEqual (Test2, Test1).Value);
+ Assert ("#I06", SqlString.LessThanOrEqual (Test3, Test2).Value);
+ Assert ("#I07", SqlString.LessThanOrEqual (Test2, SqlString.Null).IsNull);
+ }
+
+ public void TestNotEquals()
+ {
+ Assert ("#J01", SqlString.NotEquals (Test1, Test2).Value);
+ Assert ("#J02", SqlString.NotEquals (Test2, Test1).Value);
+ Assert ("#J03", SqlString.NotEquals (Test3, Test1).Value);
+ Assert ("#J04", !SqlString.NotEquals (Test2, Test3).Value);
+
+ Assert ("#J05", SqlString.NotEquals (SqlString.Null, Test3).IsNull);
+ }
+
+ public void TestConcat()
+ {
+ Test1 = new SqlString ("First TestString");
+ Test2 = new SqlString ("This is just a test SqlString");
+ Test3 = new SqlString ("This is just a test SqlString");
+
+ AssertEquals ("#K01",
+ (SqlString)"First TestStringThis is just a test SqlString",
+ SqlString.Concat (Test1, Test2));
+
+ AssertEquals ("#K02", SqlString.Null,
+ SqlString.Concat (Test1, SqlString.Null));
+ }
+
+ public void TestClone()
+ {
+ SqlString TestSqlString = Test1.Clone ();
+ AssertEquals ("#L01", Test1, TestSqlString);
+ }
+
+ public void TestCompareOptionsFromSqlCompareOptions()
+ {
+ AssertEquals ("#M01", CompareOptions.IgnoreCase,
+ SqlString.CompareOptionsFromSqlCompareOptions (
+ SqlCompareOptions.IgnoreCase));
+ AssertEquals ("#M02", CompareOptions.IgnoreCase,
+ SqlString.CompareOptionsFromSqlCompareOptions (
+ SqlCompareOptions.IgnoreCase));
+ try {
+
+ CompareOptions test = SqlString.CompareOptionsFromSqlCompareOptions (
+ SqlCompareOptions.BinarySort);
+ Fail ("#M03");
+ } catch (Exception e) {
+ AssertEquals ("#M04", typeof (ArgumentOutOfRangeException), e.GetType ());
+ }
+ }
+
+ public void TestUnicodeBytes()
+ {
+ AssertEquals ("#N01", (byte)105, Test1.GetNonUnicodeBytes () [1]);
+ AssertEquals ("#N02", (byte)32, Test1.GetNonUnicodeBytes () [5]);
+
+ AssertEquals ("#N03", (byte)70, Test1.GetUnicodeBytes () [0]);
+ AssertEquals ("#N03b", (byte)70, Test1.GetNonUnicodeBytes () [0]);
+ AssertEquals ("#N03c", (byte)0, Test1.GetUnicodeBytes () [1]);
+ AssertEquals ("#N03d", (byte)105, Test1.GetNonUnicodeBytes () [1]);
+ AssertEquals ("#N03e", (byte)105, Test1.GetUnicodeBytes () [2]);
+ AssertEquals ("#N03f", (byte)114, Test1.GetNonUnicodeBytes () [2]);
+ AssertEquals ("#N03g", (byte)0, Test1.GetUnicodeBytes () [3]);
+ AssertEquals ("#N03h", (byte)115, Test1.GetNonUnicodeBytes () [3]);
+ AssertEquals ("#N03i", (byte)114, Test1.GetUnicodeBytes () [4]);
+ AssertEquals ("#N03j", (byte)116, Test1.GetNonUnicodeBytes () [4]);
+
+ AssertEquals ("#N04", (byte)105, Test1.GetUnicodeBytes () [2]);
+
+ try {
+ byte test = Test1.GetUnicodeBytes () [105];
+ Fail ("#N05");
+ } catch (Exception e) {
+ AssertEquals ("#N06", typeof (IndexOutOfRangeException), e.GetType());
+ }
+ }
+
+ public void TestConversions()
+ {
+
+ SqlString String250 = new SqlString ("250");
+ SqlString String9E300 = new SqlString ("9E+300");
+
+ // ToSqlBoolean ()
+
+ try {
+ bool test = Test1.ToSqlBoolean ().Value;
+ Fail ("#01");
+ } catch (Exception e) {
+ AssertEquals ("#01.5", typeof (FormatException), e.GetType());
+ }
+
+ Assert ("#O02", (new SqlString("1")).ToSqlBoolean ().Value);
+ Assert ("#O03", !(new SqlString("0")).ToSqlBoolean ().Value);
+ Assert ("#O04", (new SqlString("True")).ToSqlBoolean ().Value);
+ Assert ("#O05", !(new SqlString("FALSE")).ToSqlBoolean ().Value);
+ Assert ("#O06", SqlString.Null.ToSqlBoolean ().IsNull);
+
+ // ToSqlByte ()
+ try {
+ byte test = Test1.ToSqlByte ().Value;
+ Fail ("#07");
+ } catch (Exception e) {
+ AssertEquals ("#O07.5", typeof (FormatException), e.GetType());
+ }
+
+ AssertEquals ("#O08", (byte)250, String250.ToSqlByte ().Value);
+ try {
+ SqlByte b = (byte)(new SqlString ("2500")).ToSqlByte ();
+ Fail ("#O09");
+ } catch (Exception e) {
+ AssertEquals ("#O10", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlDateTime
+ AssertEquals ("#O11", 10,
+ (new SqlString ("2002-10-10")).ToSqlDateTime ().Value.Day);
+
+ // ToSqlDecimal ()
+ try {
+ AssertEquals ("#O13", (decimal)250, Test1.ToSqlDecimal ().Value);
+ Fail ("#O14");
+ } catch (Exception e) {
+ AssertEquals ("#O15", typeof (FormatException), e.GetType ());
+ }
+
+ AssertEquals ("#O16", (decimal)250, String250.ToSqlDecimal ().Value);
+
+ try {
+ SqlDecimal test = String9E300.ToSqlDecimal ().Value;
+ Fail ("#O17");
+ } catch (Exception e) {
+ AssertEquals ("#O18", typeof (FormatException), e.GetType ());
+ }
+
+ // ToSqlDouble
+ AssertEquals ("#O19", (SqlDouble)9E+300, String9E300.ToSqlDouble ());
+
+ try {
+ SqlDouble test = (new SqlString ("4e400")).ToSqlDouble ();
+ Fail ("#O20");
+ } catch (Exception e) {
+ AssertEquals ("#O21", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToSqlGuid
+ SqlString TestGuid = new SqlString("11111111-1111-1111-1111-111111111111");
+ AssertEquals ("#O22", new SqlGuid("11111111-1111-1111-1111-111111111111"), TestGuid.ToSqlGuid ());
+
+ try {
+ SqlGuid test = String9E300.ToSqlGuid ();
+ } catch (Exception e) {
+ AssertEquals ("#O23", typeof (FormatException), e.GetType ());
+ }
+
+ // ToSqlInt16 ()
+ AssertEquals ("#O24", (short)250, String250.ToSqlInt16 ().Value);
+
+ try {
+ SqlInt16 test = String9E300.ToSqlInt16().Value;
+ Fail ("#O25");
+ } catch (Exception e) {
+ AssertEquals ("#O26", typeof (FormatException), e.GetType ());
+ }
+
+ // ToSqlInt32 ()
+ AssertEquals ("#O27", (int)250, String250.ToSqlInt32 ().Value);
+
+ try {
+ SqlInt32 test = String9E300.ToSqlInt32 ().Value;
+ Fail ("#O28");
+ } catch (Exception e) {
+ AssertEquals ("#O29", typeof (FormatException), e.GetType ());
+ }
+
+ try {
+ SqlInt32 test = Test1.ToSqlInt32 ().Value;
+ Fail ("#O30");
+ } catch (Exception e) {
+ AssertEquals ("#O31", typeof (FormatException), e.GetType ());
+ }
+
+ // ToSqlInt64 ()
+ AssertEquals ("#O32", (long)250, String250.ToSqlInt64 ().Value);
+
+ try {
+ SqlInt64 test = String9E300.ToSqlInt64 ().Value;
+ Fail ("#O33");
+ } catch (Exception e) {
+ AssertEquals ("#O34", typeof (FormatException), e.GetType ());
+ }
+
+ // ToSqlMoney ()
+ AssertEquals ("#O35", (decimal)250, String250.ToSqlMoney ().Value);
+
+ try {
+ SqlMoney test = String9E300.ToSqlMoney ().Value;
+ Fail ("#O36");
+ } catch (Exception e) {
+ AssertEquals ("#O37", typeof (FormatException), e.GetType ());
+ }
+
+ // ToSqlSingle ()
+ AssertEquals ("#O38", (float)250, String250.ToSqlSingle ().Value);
+
+ try {
+ SqlSingle test = String9E300.ToSqlSingle().Value;
+ Fail ("#O39");
+ } catch (Exception e) {
+ AssertEquals ("#O40", typeof (OverflowException), e.GetType ());
+ }
+
+ // ToString ()
+ AssertEquals ("#O41", "First TestString", Test1.ToString ());
+ }
+
+ // OPERATORS
+
+ public void TestArithmeticOperators()
+ {
+ SqlString TestString = new SqlString ("...Testing...");
+ AssertEquals ("#P01", (SqlString)"First TestString...Testing...",
+ Test1 + TestString);
+ AssertEquals ("#P02", SqlString.Null,
+ Test1 + SqlString.Null);
+ }
+
+ public void TestThanOrEqualOperators()
+ {
+ // == -operator
+ Assert ("#Q01", (Test2 == Test3).Value);
+ Assert ("#Q02", !(Test1 == Test2).Value);
+ Assert ("#Q03", (Test1 == SqlString.Null).IsNull);
+
+ // != -operator
+ Assert ("#Q04", !(Test3 != Test2).Value);
+ Assert ("#Q05", !(Test2 != Test3).Value);
+ Assert ("#Q06", (Test1 != Test3).Value);
+ Assert ("#Q07", (Test1 != SqlString.Null).IsNull);
+
+ // > -operator
+ Assert ("#Q08", (Test2 > Test1).Value);
+ Assert ("#Q09", !(Test1 > Test3).Value);
+ Assert ("#Q10", !(Test2 > Test3).Value);
+ Assert ("#Q11", (Test1 > SqlString.Null).IsNull);
+
+ // >= -operator
+ Assert ("#Q12", !(Test1 >= Test3).Value);
+ Assert ("#Q13", (Test3 >= Test1).Value);
+ Assert ("#Q14", (Test2 >= Test3).Value);
+ Assert ("#Q15", (Test1 >= SqlString.Null).IsNull);
+
+ // < -operator
+ Assert ("#Q16", (Test1 < Test2).Value);
+ Assert ("#Q17", (Test1 < Test3).Value);
+ Assert ("#Q18", !(Test2 < Test3).Value);
+ Assert ("#Q19", (Test1 < SqlString.Null).IsNull);
+
+ // <= -operator
+ Assert ("#Q20", (Test1 <= Test3).Value);
+ Assert ("#Q21", !(Test3 <= Test1).Value);
+ Assert ("#Q22", (Test2 <= Test3).Value);
+ Assert ("#Q23", (Test1 <= SqlString.Null).IsNull);
+ }
+
+ public void TestSqlBooleanToSqlString()
+ {
+ SqlBoolean TestBoolean = new SqlBoolean (true);
+ SqlBoolean TestBoolean2 = new SqlBoolean (false);
+ SqlString Result;
+
+ Result = (SqlString)TestBoolean;
+ AssertEquals ("#R01", "True", Result.Value);
+
+ Result = (SqlString)TestBoolean2;
+ AssertEquals ("#R02", "False", Result.Value);
+
+ Result = (SqlString)SqlBoolean.Null;
+ Assert ("#R03", Result.IsNull);
+ }
+
+ public void TestSqlByteToBoolean()
+ {
+ SqlByte TestByte = new SqlByte (250);
+ AssertEquals ("#S01", "250", ((SqlString)TestByte).Value);
+ try {
+ SqlString test = ((SqlString)SqlByte.Null).Value;
+ Fail ("#S02");
+ } catch (Exception e) {
+ AssertEquals ("#S03", typeof (SqlNullValueException), e.GetType ());
+ }
+ }
+
+ public void TestSqlDateTimeToSqlString()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-AU");
+ SqlDateTime TestTime = new SqlDateTime(2002, 10, 22, 9, 52, 30);
+ AssertEquals ("#T01", "22/10/2002 9:52:30 AM", ((SqlString)TestTime).Value);
+ }
+
+ public void TestSqlDecimalToSqlString()
+ {
+ SqlDecimal TestDecimal = new SqlDecimal (1000.2345);
+ AssertEquals ("#U01", "1000.2345000000000", ((SqlString)TestDecimal).Value);
+ }
+
+ public void TestSqlDoubleToSqlString()
+ {
+ SqlDouble TestDouble = new SqlDouble (64E+64);
+ AssertEquals ("#V01", "6.4E+65", ((SqlString)TestDouble).Value);
+ }
+
+ public void TestSqlGuidToSqlString()
+ {
+ byte [] b = new byte [16];
+ b [0] = 100;
+ b [1] = 64;
+ SqlGuid TestGuid = new SqlGuid (b);
+
+ AssertEquals ("#W01", "00004064-0000-0000-0000-000000000000",
+ ((SqlString)TestGuid).Value);
+ try {
+ SqlString test = ((SqlString)SqlGuid.Null).Value;
+ Fail ("#W02");
+ } catch (Exception e) {
+ AssertEquals ("#W03", typeof (SqlNullValueException), e.GetType());
+ }
+ }
+
+ public void TestSqlInt16ToSqlString()
+ {
+ SqlInt16 TestInt = new SqlInt16(20012);
+ AssertEquals ("#X01", "20012", ((SqlString)TestInt).Value);
+ try {
+ SqlString test = ((SqlString)SqlInt16.Null).Value;
+ Fail ("#X02");
+ } catch (Exception e) {
+ AssertEquals ("#X03", typeof (SqlNullValueException), e.GetType ());
+ }
+ }
+
+ public void TestSqlInt32ToSqlString()
+ {
+ SqlInt32 TestInt = new SqlInt32(-12456);
+ AssertEquals ("#Y01", "-12456", ((SqlString)TestInt).Value);
+ try {
+ SqlString test = ((SqlString)SqlInt32.Null).Value;
+ Fail ("#Y02");
+ } catch (Exception e) {
+ AssertEquals ("#Y03", typeof (SqlNullValueException), e.GetType ());
+ }
+ }
+
+ public void TestSqlInt64ToSqlString()
+ {
+ SqlInt64 TestInt = new SqlInt64(10101010);
+ AssertEquals ("#Z01", "10101010", ((SqlString)TestInt).Value);
+ }
+
+ public void TestSqlMoneyToSqlString()
+ {
+ SqlMoney TestMoney = new SqlMoney (646464.6464);
+ AssertEquals ("#AA01", "646464.6464", ((SqlString)TestMoney).Value);
+ }
+
+ public void TestSqlSingleToSqlString()
+ {
+ SqlSingle TestSingle = new SqlSingle (3E+20);
+ AssertEquals ("#AB01", "3E+20", ((SqlString)TestSingle).Value);
+ }
+
+ public void TestSqlStringToString()
+ {
+ AssertEquals ("#AC01", "First TestString",(String)Test1);
+ }
+
+ public void TestStringToSqlString()
+ {
+ String TestString = "Test String";
+ AssertEquals ("#AD01", "Test String", ((SqlString)TestString).Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/Test/System.Data/AllTests.cs b/mcs/class/System.Data/Test/System.Data/AllTests.cs
new file mode 100644
index 00000000000..09c8b622d4b
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/AllTests.cs
@@ -0,0 +1,39 @@
+// MonoTests.System.Data.AllTests.cs
+//
+// Author:
+// Rodrigo Moya <rodrigo@ximian.com>
+//
+// (C) Copyright 2002 Rodrigo Moya
+//
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data
+{
+ /// <summary>
+ /// Combines all unit tests for the System.Data.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base (name) { }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new TestSuite (typeof (DataColumnTest)));
+ suite.AddTest (new TestSuite (typeof (UniqueConstraintTest)));
+ suite.AddTest (new TestSuite (typeof (ConstraintTest)));
+ suite.AddTest (new TestSuite (typeof (ConstraintCollectionTest)));
+ suite.AddTest (new TestSuite (typeof (ForeignKeyConstraintTest)));
+ suite.AddTest (new TestSuite (typeof (DataTableTest)));
+ suite.AddTest (new TestSuite (typeof (DataRowCollectionTest)));
+ suite.AddTest (new TestSuite (typeof (DataRowTest)));
+ suite.AddTest (new TestSuite (typeof (DataColumnCollectionTest)));
+ suite.AddTest (new TestSuite (typeof (DataSetTest)));
+ suite.AddTest (new TestSuite (typeof (DataRelationTest)));
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog
new file mode 100644
index 00000000000..e2222dc0872
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/ChangeLog
@@ -0,0 +1,32 @@
+2003-14-01 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRelationTest.cs: Added more tests
+
+2003-13-01 Ville Palo <vi64pa@koti.soon.fi>
+
+ * DataRelationTest.cs: Test class for DataRelation
+
+2002-12-26 Ville Palo <vi64pa@koti.soon.fi>
+
+ * own_schema.xsd: XmlSchema for testing ReadXmlSchema() -method
+ * DataSetTest.cs: Added more Xml-tests.
+
+2002-12-17 Ville Palo <vi64pa@koti.soon.fi>
+
+ * region.xml:
+ * store.xsd: new xmldoment and xmlschema for testing DataSet
+ * DataSetTest.cs: Added some Xml-tests.
+ * AllTests.cs: Added DataSetTest
+
+2002-10-23 Nick Drochak <ndrochak@gol.com>
+
+ * ConstraintCollectionTest.cs (SetUp): Clear the constraints before
+ each test.
+ * ConstraintTest.cs: same
+ * DataColumnTest.cs: Get exceptions straight. Some are thrown and some
+ aren't
+
+2002-10-22 Nick Drochak <ndrochak@gol.com>
+
+ * DataColumnTest.cs: Remove compiler warnings and use caught exception
+ to report useful info.
diff --git a/mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest.cs b/mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest.cs
new file mode 100644
index 00000000000..d638f15307a
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest.cs
@@ -0,0 +1,328 @@
+// ConstraintCollection.cs - NUnit Test Cases for testing the ConstraintCollection
+// class.
+//
+//
+// Franklin Wise (gracenote@earthlink.net)
+//
+// (C) Franklin Wise
+//
+
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+
+namespace MonoTests.System.Data
+{
+
+
+ public class ConstraintCollectionTest : TestCase
+ {
+ private DataTable _table;
+ private DataTable _table2;
+ private Constraint _constraint1;
+ private Constraint _constraint2;
+
+ public ConstraintCollectionTest() : base ("MonoTests.System.Data.ConstraintCollectionTest") {}
+ public ConstraintCollectionTest(string name) : base(name) {}
+
+ public void PublicSetup(){SetUp();}
+ protected override void SetUp()
+ {
+ //Setup DataTable
+ _table = new DataTable("TestTable");
+ _table.Columns.Add("Col1",typeof(int));
+ _table.Columns.Add("Col2",typeof(int));
+ _table.Columns.Add("Col3",typeof(int));
+
+ _table2 = new DataTable("TestTable");
+ _table2.Columns.Add("Col1",typeof(int));
+ _table2.Columns.Add("Col2",typeof(int));
+
+ //Use UniqueConstraint to test Constraint Base Class
+ _constraint1 = new UniqueConstraint(_table.Columns[0],false);
+ _constraint2 = new UniqueConstraint(_table.Columns[1],false);
+
+ // not sure why this is needed since a new _table was just created
+ // for us, but this Clear() keeps the tests from throwing
+ // an exception when the Add() is called.
+ _table.Constraints.Clear();
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(ConstraintCollectionTest));
+ }
+ }
+
+ public void TestAdd()
+ {
+ ConstraintCollection col = _table.Constraints;
+ col.Add(_constraint1);
+ col.Add(_constraint2);
+
+ Assertion.AssertEquals("Count doesn't equal added.",2, col.Count);
+ }
+
+ public void TestAddExceptions()
+ {
+ ConstraintCollection col = _table.Constraints;
+
+ //null
+ try
+ {
+ col.Add(null);
+ Assertion.Fail("B1: Failed to throw ArgumentNullException.");
+ }
+ catch (ArgumentNullException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch
+ {
+ Assertion.Fail("A1: Wrong exception type");
+ }
+
+ //duplicate name
+ try
+ {
+ _constraint1.ConstraintName = "Dog";
+ _constraint2.ConstraintName = "dog"; //case insensitive
+ col.Add(_constraint1);
+ col.Add(_constraint2);
+ Assertion.Fail("Failed to throw Duplicate name exception.");
+ }
+ catch (DuplicateNameException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("A2: Wrong exception type. " + exc.ToString());
+ }
+
+ //Constraint Already exists
+ try
+ {
+ col.Add(_constraint1);
+ Assertion.Fail("B2: Failed to throw ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch
+ {
+ Assertion.Fail("A3: Wrong exception type");
+ }
+ }
+
+ public void TestIndexer()
+ {
+ Constraint c1 = new UniqueConstraint(_table.Columns[0]);
+ Constraint c2 = new UniqueConstraint(_table.Columns[1]);
+
+ c1.ConstraintName = "first";
+ c2.ConstraintName = "second";
+
+
+ _table.Constraints.Add(c1);
+ _table.Constraints.Add(c2);
+
+ Assertion.AssertSame("A1", c1, _table.Constraints[0]);
+ Assertion.AssertSame("A2", c2, _table.Constraints[1]);
+
+ Assertion.AssertSame("A3", c1, _table.Constraints["first"]);
+ Assertion.AssertSame("A4", c2, _table.Constraints["sEcond"]); //case insensitive
+
+ }
+
+ public void TestIndexOf()
+ {
+ Constraint c1 = new UniqueConstraint(_table.Columns[0]);
+ Constraint c2 = new UniqueConstraint(_table.Columns[1]);
+
+ c1.ConstraintName = "first";
+ c2.ConstraintName = "second";
+
+ _table.Constraints.Add(c1);
+ _table.Constraints.Add(c2);
+
+ Assertion.AssertEquals("A1", 0, _table.Constraints.IndexOf(c1));
+ Assertion.AssertEquals("A2", 1, _table.Constraints.IndexOf(c2));
+ Assertion.AssertEquals("A3", 0, _table.Constraints.IndexOf("first"));
+ Assertion.AssertEquals("A4", 1, _table.Constraints.IndexOf("second"));
+ }
+
+ public void TestContains()
+ {
+ Constraint c1 = new UniqueConstraint(_table.Columns[0]);
+ Constraint c2 = new UniqueConstraint(_table.Columns[1]);
+
+ c1.ConstraintName = "first";
+ c2.ConstraintName = "second";
+
+ _table.Constraints.Add(c1);
+
+ Assertion.Assert("A1", _table.Constraints.Contains(c1.ConstraintName)); //true
+ Assertion.Assert("A2", _table.Constraints.Contains(c2.ConstraintName) == false); //doesn't contain
+ }
+
+ public void TestIndexerFailures()
+ {
+ _table.Constraints.Add(new UniqueConstraint(_table.Columns[0]));
+
+ //This doesn't throw
+ Assertion.AssertNull(_table.Constraints["notInCollection"]);
+
+ //Index too high
+ try
+ {
+ Constraint c = _table.Constraints[_table.Constraints.Count];
+ Assertion.Fail("B1: Failed to throw IndexOutOfRangeException.");
+ }
+ catch (IndexOutOfRangeException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch
+ {
+ Assertion.Fail("A1: Wrong exception type");
+ }
+
+ //Index too low
+ try
+ {
+ Constraint c = _table.Constraints[-1];
+ Assertion.Fail("B2: Failed to throw IndexOutOfRangeException.");
+ }
+ catch (IndexOutOfRangeException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch
+ {
+ Assertion.Fail("A2: Wrong exception type");
+ }
+
+ }
+
+ //TODO: Implementation not ready for this test yet
+// public void TestAddFkException1()
+// {
+// DataSet ds = new DataSet();
+// ds.Tables.Add(_table);
+// ds.Tables.Add(_table2);
+//
+// _table.Rows.Add(new object [] {1});
+// _table.Rows.Add(new object [] {1});
+//
+// //FKC: can't create unique constraint because duplicate values already exist
+// try
+// {
+// ForeignKeyConstraint fkc = new ForeignKeyConstraint( _table.Columns[0],
+// _table2.Columns[0]);
+//
+// _table2.Constraints.Add(fkc); //should throw
+// Assertion.Fail("B1: Failed to throw ArgumentException.");
+// }
+// catch (ArgumentException) {}
+// catch (AssertionFailedError exc) {throw exc;}
+// catch (Exception exc)
+// {
+// Assertion.Fail("A1: Wrong Exception type. " + exc.ToString());
+// }
+//
+//
+// }
+
+
+ //TODO: Implementation not ready for this test yet
+// public void TestAddFkException2()
+// {
+// //Foreign key rules only work when the tables
+// //are apart of the dataset
+// DataSet ds = new DataSet();
+// ds.Tables.Add(_table);
+// ds.Tables.Add(_table2);
+//
+// _table.Rows.Add(new object [] {1});
+//
+// // will need a matching parent value in
+// // _table
+// _table2.Rows.Add(new object [] {3});
+//
+//
+// //FKC: no matching parent value
+// try
+// {
+// ForeignKeyConstraint fkc = new ForeignKeyConstraint( _table.Columns[0],
+// _table2.Columns[0]);
+//
+// _table2.Constraints.Add(fkc); //should throw
+// Assertion.Fail("B1: Failed to throw ArgumentException.");
+// }
+// catch (ArgumentException) {}
+// catch (AssertionFailedError exc) {throw exc;}
+// catch (Exception exc)
+// {
+// Assertion.Fail("A1: Wrong Exception type. " + exc.ToString());
+// }
+//
+//
+// }
+
+
+ //TODO: Implementation not ready for this test yet
+// public void TestAddUniqueExceptions()
+// {
+//
+//
+// //UC: can't create unique constraint because duplicate values already exist
+// try
+// {
+// _table.Rows.Add(new object [] {1});
+// _table.Rows.Add(new object [] {1});
+// UniqueConstraint uc = new UniqueConstraint( _table.Columns[0]);
+//
+// _table.Constraints.Add(uc); //should throw
+// Assertion.Fail("B1: Failed to throw ArgumentException.");
+// }
+// catch (ArgumentException) {}
+// catch (AssertionFailedError exc) {throw exc;}
+// catch (Exception exc)
+// {
+// Assertion.Fail("A1: Wrong Exception type. " + exc.ToString());
+// }
+// }
+
+ public void TestAddRange()
+ {
+ }
+
+ public void TestClear()
+ {
+
+ }
+
+ public void TestCanRemove()
+ {
+
+ }
+
+ public void TestCollectionChanged()
+ {
+
+ }
+
+ public void TestRemoveAt()
+ {
+ }
+
+ public void TestRemove()
+ {
+ }
+
+
+ public void TestRemoveExceptions()
+ {
+
+
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/ConstraintTest.cs b/mcs/class/System.Data/Test/System.Data/ConstraintTest.cs
new file mode 100644
index 00000000000..1d3e26e1680
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/ConstraintTest.cs
@@ -0,0 +1,138 @@
+// ConstraintTest.cs - NUnit Test Cases for testing the abstract class System.Data.Constraint
+// The tests use an inherited class (UniqueConstraint) to test the Constraint class.
+//
+// Franklin Wise <gracenote@earthlink.net>
+//
+// (C) 2002 Franklin Wise
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+// public class MyUniqueConstraint: UniqueConstraint {
+// public MyUniqueConstraint(DataColumn col, bool pk): base(col,pk){}
+// string _myval = "";
+// public override string ConstraintName {
+// get{
+// return _myval;
+// return base.ConstraintName;
+// }
+// set{
+// Console.WriteLine("NameSet = " + value);
+// base.ConstraintName = value;
+// _myval = value;
+// }
+// }
+// }
+
+ public class ConstraintTest : TestCase
+ {
+ private DataTable _table;
+ private Constraint _constraint1;
+ private Constraint _constraint2;
+
+ public ConstraintTest() : base ("MonoTests.System.Data.ConstraintTest") {}
+ public ConstraintTest(string name) : base(name) {}
+
+ public void PublicSetup(){SetUp();}
+ protected override void SetUp() {
+
+ //Setup DataTable
+ _table = new DataTable("TestTable");
+
+ _table.Columns.Add("Col1",typeof(int));
+ _table.Columns.Add("Col2",typeof(int));
+
+ //Use UniqueConstraint to test Constraint Base Class
+ _constraint1 = new UniqueConstraint(_table.Columns[0],false);
+ _constraint2 = new UniqueConstraint(_table.Columns[1],false);
+
+ // not sure why this is needed since a new _table was just created
+ // for us, but this Clear() keeps the tests from throwing
+ // an exception when the Add() is called.
+ _table.Constraints.Clear();
+ }
+
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ConstraintTest));
+ }
+ }
+
+ public void TestSetConstraintNameNullOrEmptyExceptions() {
+ bool exceptionCaught = false;
+ string name = null;
+
+ _table.Constraints.Add (_constraint1);
+
+ for (int i = 0; i <= 1; i++) {
+ exceptionCaught = false;
+ if (0 == i) name = null;
+ if (1 == i) name = String.Empty;
+
+ try {
+
+ //Next line should throw ArgumentException
+ //Because ConstraintName can't be set to null
+ //or empty while the constraint is part of the
+ //collection
+ _constraint1.ConstraintName = name;
+ }
+ catch (ArgumentException){
+ exceptionCaught = true;
+ }
+ catch {
+ Assertion.Fail("Wrong exception type thrown.");
+ }
+
+ Assertion.Assert("Failed to throw exception.",
+ true == exceptionCaught);
+ }
+ }
+
+ public void TestSetConstraintNameDuplicateException() {
+ _constraint1.ConstraintName = "Dog";
+ _constraint2.ConstraintName = "Cat";
+
+ _table.Constraints.Add(_constraint1);
+ _table.Constraints.Add(_constraint2);
+
+ try {
+ //Should throw DuplicateNameException
+ _constraint2.ConstraintName = "Dog";
+
+ Assertion.Fail("Failed to throw " +
+ " DuplicateNameException exception.");
+ }
+ catch (DuplicateNameException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch {
+ Assertion.Fail("Wrong exception type thrown.");
+ }
+
+ }
+
+ public void TestToString() {
+ _constraint1.ConstraintName = "Test";
+ Assertion.Assert("ToString is the same as constraint name.", _constraint1.ConstraintName.CompareTo( _constraint1.ToString()) == 0);
+
+ _constraint1.ConstraintName = null;
+ Assertion.AssertNotNull("ToString should return empty.",_constraint1.ToString());
+ }
+
+ public void TestGetExtendedProperties() {
+ PropertyCollection col = _constraint1.ExtendedProperties as
+ PropertyCollection;
+
+ Assertion.AssertNotNull("ExtendedProperties returned null or didn't " +
+ "return the correct type", col);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs b/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs
new file mode 100644
index 00000000000..b07f42fbe1e
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs
@@ -0,0 +1,46 @@
+// DataColumnCollectionTest.cs - NUnit Test Cases for System.Data.DataColumnCollection
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+//
+// (C) Copyright 2002 Franklin Wise
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+ public class DataColumnCollectionTest : TestCase
+ {
+ public DataColumnCollectionTest () : base ("MonoTest.System.Data.DataColumnCollectionTest") {}
+ public DataColumnCollectionTest (string name) : base (name) {}
+
+ private DataTable _tbl;
+
+ protected override void SetUp ()
+ {
+ _tbl = new DataTable();
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (DataColumnCollectionTest));
+ }
+ }
+
+ //TODO
+ public void TestAddValidationExceptions()
+ {
+
+ //Set DefaultValue and AutoIncr == true
+ //And get an exception
+ }
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs b/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
new file mode 100644
index 00000000000..f3b4e402600
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
@@ -0,0 +1,210 @@
+// DataColumnTest.cs - NUnit Test Cases for System.Data.DataColumn
+//
+// Author:
+// Franklin Wise <gracenote@earthlink.net>
+// Rodrigo Moya <rodrigo@ximian.com>
+//
+// (C) Copyright 2002 Franklin Wise
+// (C) Copyright 2002 Rodrigo Moya
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+ public class DataColumnTest : TestCase
+ {
+ public DataColumnTest () : base ("System.Data.DataColumn") {}
+ public DataColumnTest (string name) : base (name) {}
+
+ private DataTable _tbl;
+
+ protected override void SetUp ()
+ {
+ _tbl = new DataTable();
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (DataColumnTest));
+ }
+ }
+
+ public void TestCtor()
+ {
+ string colName = "ColName";
+ DataColumn col = new DataColumn();
+
+ //These should all ctor without an exception
+ col = new DataColumn(colName);
+ col = new DataColumn(colName,typeof(int));
+ col = new DataColumn(colName,typeof(int),null);
+ col = new DataColumn(colName,typeof(int),null,MappingType.Attribute);
+
+ //DataType Null
+ try
+ {
+ col = new DataColumn(colName, null);
+ Assertion.Fail("Failed to throw ArgumentNullException.");
+ }
+ catch (ArgumentNullException){}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("DataColumnNull. Wrong exception type. Got:" + exc);
+ }
+
+ }
+
+ public void TestAllowDBNull()
+ {
+ DataColumn col = new DataColumn("NullCheck",typeof(int));
+ _tbl.Columns.Add(col);
+ col.AllowDBNull = true;
+ _tbl.Rows.Add(_tbl.NewRow());
+ _tbl.Rows[0]["NullCheck"] = DBNull.Value;
+ col.AllowDBNull = false;
+ }
+
+ public void TestAutoIncrement()
+ {
+ DataColumn col = new DataColumn("Auto",typeof(string));
+ col.AutoIncrement = true;
+
+ //Check for Correct Default Values
+ Assertion.AssertEquals("Seed default", (long)0, col.AutoIncrementSeed);
+ Assertion.AssertEquals("Step default", (long)1, col.AutoIncrementStep);
+
+ //Check for auto type convert
+ Assertion.Assert("AutoInc type convert failed." ,col.DataType == typeof (int));
+
+ }
+
+ public void TestAutoIncrementExceptions()
+ {
+ DataColumn col = new DataColumn();
+
+ col.Expression = "SomeExpression";
+
+ //if computed column exception is thrown
+ try
+ {
+ col.AutoIncrement = true;
+ Assertion.Fail("Failed to throw ArgumentException");
+ }
+ catch (ArgumentException){}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("ExprAutoInc. Wrong exception type. Got:" + exc);
+ }
+
+
+ }
+
+ public void TestCaption()
+ {
+ DataColumn col = new DataColumn("ColName");
+ //Caption not set at this point
+ Assertion.AssertEquals("Caption Should Equal Col Name", col.ColumnName, col.Caption);
+
+ //Set caption
+ col.Caption = "MyCaption";
+ Assertion.AssertEquals("Caption should equal caption.", "MyCaption", col.Caption);
+
+ //Clear caption
+ col.Caption = null;
+ Assertion.AssertEquals("Caption Should Equal Col Name after clear", col.ColumnName, col.Caption);
+
+ }
+
+ public void TestForColumnNameException()
+ {
+ DataColumn col = new DataColumn();
+ DataColumn col2 = new DataColumn();
+ DataColumn col3 = new DataColumn();
+ DataColumn col4 = new DataColumn();
+
+ col.ColumnName = "abc";
+ AssertEquals( "abc", col.ColumnName);
+
+ _tbl.Columns.Add(col);
+
+ //Duplicate name exception
+ try
+ {
+ col2.ColumnName = "abc";
+ _tbl.Columns.Add(col2);
+ AssertEquals( "abc", col2.ColumnName);
+ Assertion.Fail("Failed to throw duplicate name exception.");
+ }
+ catch (DuplicateNameException){}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("DNE: Wrong exception type. " + exc.ToString());
+ }
+
+ // Make sure case matters in duplicate checks
+ col3.ColumnName = "ABC";
+ _tbl.Columns.Add(col3);
+ }
+
+ public void TestDefaultValue()
+ {
+ DataTable tbl = new DataTable();
+ tbl.Columns.Add("MyCol", typeof(int));
+
+ //Set default Value if Autoincrement is true
+ tbl.Columns[0].AutoIncrement = true;
+ try
+ {
+ tbl.Columns[0].DefaultValue = 2;
+ Assertion.Fail("Failed to throw ArgumentException.");
+ }
+ catch (ArgumentException){}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("WET1: Wrong exception type. " + exc.ToString());
+ }
+
+
+ tbl.Columns[0].AutoIncrement = false;
+
+ //Set default value to an incompatible datatype
+ try
+ {
+ tbl.Columns[0].DefaultValue = "hello";
+ Assertion.Fail("Failed to throw InvalidCastException.");
+ }
+ catch (InvalidCastException){}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("WET2: Wrong exception type. " + exc.ToString());
+ }
+
+ //TODO: maybe add tests for setting default value for types that can implict
+ //cast
+
+
+
+
+ }
+
+ public void TestSetDataType()
+ {
+ //test for DataAlready exists and change the datatype
+
+ //supported datatype
+
+ //AutoInc column dataType supported
+
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataRelationTest.cs b/mcs/class/System.Data/Test/System.Data/DataRelationTest.cs
new file mode 100644
index 00000000000..5d782246ea9
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataRelationTest.cs
@@ -0,0 +1,378 @@
+//
+// DataRelationTest.cs - NUnit Test Cases for DataRelation
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2003
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+
+ public class DataRelationTest : TestCase
+ {
+ public DataRelationTest() : base ("MonoTests.System.Data.DataRelation") {}
+ public DataRelationTest(string name) : base(name) {}
+
+ protected override void SetUp() {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(DataRelationTest));
+ }
+ }
+
+ public void TestCreation ()
+ {
+ DataSet Set = new DataSet ();
+ DataTable Mom = new DataTable ("Mom");
+ DataTable Child = new DataTable ("Child");
+ Set.Tables.Add (Mom);
+ Set.Tables.Add (Child);
+
+ DataColumn Col = new DataColumn ("Name");
+ DataColumn Col2 = new DataColumn ("ChildName");
+ Mom.Columns.Add (Col);
+ Mom.Columns.Add (Col2);
+
+ DataColumn Col3 = new DataColumn ("Name");
+ DataColumn Col4 = new DataColumn ("Age");
+ Child.Columns.Add (Col3);
+ Child.Columns.Add (Col4);
+
+ DataRelation Relation = new DataRelation ("Rel", Col2, Col3);
+ Set.Relations.Add (Relation);
+ DataRelation Test = null;
+ AssertEquals ("test#01", 1, Mom.ChildRelations.Count);
+ AssertEquals ("test#02", 0, Child.ChildRelations.Count);
+ AssertEquals ("test#03", 0, Mom.ParentRelations.Count);
+ AssertEquals ("test#04", 1, Child.ParentRelations.Count);
+
+ Test = Child.ParentRelations [0];
+ AssertEquals ("test#05", "Rel", Test.ToString ());
+ AssertEquals ("test#06", "Rel", Test.RelationName);
+ AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);
+ AssertEquals ("test#08", 1, Test.ParentKeyConstraint.Columns.Length);
+ AssertEquals ("test#09", false, Test.ParentKeyConstraint.IsPrimaryKey);
+ AssertEquals ("test#10", 1, Test.ParentColumns.Length);
+ AssertEquals ("test#11", false, Test.Nested);
+ AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);
+ AssertEquals ("test#13", "Child", Test.ChildTable.TableName);
+ AssertEquals ("test#14", "Rel", Test.ChildKeyConstraint.ConstraintName);
+ AssertEquals ("test#15", 1, Test.ChildColumns.Length);
+ }
+
+ public void TestCreation2 ()
+ {
+ DataSet Set = new DataSet ();
+ DataTable Mom = new DataTable ("Mom");
+ DataTable Child = new DataTable ("Child");
+ DataTable Hubby = new DataTable ("Hubby");
+ Set.Tables.Add (Mom);
+ Set.Tables.Add (Child);
+ Set.Tables.Add (Hubby);
+
+ DataColumn Col = new DataColumn ("Name");
+ DataColumn Col2 = new DataColumn ("ChildName");
+ DataColumn Col3 = new DataColumn ("hubby");
+ Mom.Columns.Add (Col);
+ Mom.Columns.Add (Col2);
+ Mom.Columns.Add (Col3);
+
+ DataColumn Col4 = new DataColumn ("Name");
+ DataColumn Col5 = new DataColumn ("Age");
+ DataColumn Col6 = new DataColumn ("father");
+ Child.Columns.Add (Col4);
+ Child.Columns.Add (Col5);
+ Child.Columns.Add (Col6);
+
+
+ DataColumn Col7 = new DataColumn ("Name");
+ DataColumn Col8 = new DataColumn ("Age");
+ Hubby.Columns.Add (Col7);
+ Hubby.Columns.Add (Col8);
+
+
+ DataColumn [] Parents = new DataColumn [2];
+ Parents [0] = Col2;
+ Parents [1] = Col3;
+ DataColumn [] Childs = new DataColumn [2];
+ Childs [0] = Col4;
+ Childs [1] = Col7;
+
+ DataRelation Relation = null;
+ try {
+ Relation = new DataRelation ("Rel", Parents, Childs);
+ Fail ("test#01");
+ } catch (Exception e) {
+ AssertEquals ("test#02", typeof (InvalidConstraintException), e.GetType ());
+ AssertEquals ("test#03", "Cannot create a Key from Columns that belong to different tables.", e.Message);
+ }
+
+ Childs [1] = Col6;
+ Relation = new DataRelation ("Rel", Parents, Childs);
+
+ Set.Relations.Add (Relation);
+
+ DataRelation Test = null;
+ AssertEquals ("test#01", 1, Mom.ChildRelations.Count);
+ AssertEquals ("test#02", 0, Child.ChildRelations.Count);
+ AssertEquals ("test#03", 0, Mom.ParentRelations.Count);
+ AssertEquals ("test#04", 1, Child.ParentRelations.Count);
+
+ Test = Child.ParentRelations [0];
+ AssertEquals ("test#05", "Rel", Test.ToString ());
+ AssertEquals ("test#06", "Rel", Test.RelationName);
+ AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);
+ AssertEquals ("test#08", 2, Test.ParentKeyConstraint.Columns.Length);
+ AssertEquals ("test#09", false, Test.ParentKeyConstraint.IsPrimaryKey);
+ AssertEquals ("test#10", 2, Test.ParentColumns.Length);
+ AssertEquals ("test#11", false, Test.Nested);
+ AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);
+ AssertEquals ("test#13", "Child", Test.ChildTable.TableName);
+ AssertEquals ("test#14", "Rel", Test.ChildKeyConstraint.ConstraintName);
+ AssertEquals ("test#15", 2, Test.ChildColumns.Length);
+ AssertEquals ("test#16", 1, Mom.Constraints.Count);
+ AssertEquals ("test#17", "Constraint1", Mom.Constraints [0].ToString ());
+ AssertEquals ("test#18", 1, Child.Constraints.Count);
+ AssertEquals ("test#19", 0, Hubby.Constraints.Count);
+ }
+
+ public void TestCreation3 ()
+ {
+ DataSet Set = new DataSet ();
+ DataTable Mom = new DataTable ("Mom");
+ DataTable Child = new DataTable ("Child");
+ Set.Tables.Add (Mom);
+ Set.Tables.Add (Child);
+
+ DataColumn Col = new DataColumn ("Name");
+ DataColumn Col2 = new DataColumn ("ChildName");
+ Mom.Columns.Add (Col);
+ Mom.Columns.Add (Col2);
+
+ DataColumn Col3 = new DataColumn ("Name");
+ DataColumn Col4 = new DataColumn ("Age");
+ Child.Columns.Add (Col3);
+ Child.Columns.Add (Col4);
+
+ DataRelation Relation = new DataRelation ("Rel", Col2, Col3, false);
+ Set.Relations.Add (Relation);
+ DataRelation Test = null;
+
+ AssertEquals ("test#01", 1, Mom.ChildRelations.Count);
+ AssertEquals ("test#02", 0, Child.ChildRelations.Count);
+ AssertEquals ("test#03", 0, Mom.ParentRelations.Count);
+ AssertEquals ("test#04", 1, Child.ParentRelations.Count);
+
+ Test = Child.ParentRelations [0];
+
+ AssertEquals ("test#05", "Rel", Test.ToString ());
+
+ AssertEquals ("test#06", "Rel", Test.RelationName);
+ AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);
+
+ Assert ("test#08", Test.ParentKeyConstraint == null);
+
+ Assert ("test#09", Test.ParentKeyConstraint == null);
+
+ AssertEquals ("test#10", 1, Test.ParentColumns.Length);
+ AssertEquals ("test#11", false, Test.Nested);
+ AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);
+ AssertEquals ("test#13", "Child", Test.ChildTable.TableName);
+
+ Assert ("test#14", Test.ChildKeyConstraint == null);
+ AssertEquals ("test#15", 1, Test.ChildColumns.Length);
+ AssertEquals ("test#16", 0, Mom.Constraints.Count);
+ AssertEquals ("test#17", 0, Child.Constraints.Count);
+
+ }
+
+ public void TestCreation4 ()
+ {
+ DataSet Set = new DataSet ();
+ DataTable Mom = new DataTable ("Mom");
+ DataTable Child = new DataTable ("Child");
+ Set.Tables.Add (Mom);
+ Set.Tables.Add (Child);
+
+ DataColumn Col = new DataColumn ("Name");
+ DataColumn Col2 = new DataColumn ("ChildName");
+ Mom.Columns.Add (Col);
+ Mom.Columns.Add (Col2);
+
+ DataColumn Col3 = new DataColumn ("Name");
+ DataColumn Col4 = new DataColumn ("Age");
+ Child.Columns.Add (Col3);
+ Child.Columns.Add (Col4);
+
+ DataRelation Relation = new DataRelation ("Rel", "Mom", "Child",
+ new string [] {"ChildName"},
+ new string [] {"Name"}, true);
+
+ try {
+ Set.Relations.Add (Relation);
+ Fail ("test#01");
+ } catch (Exception e) {
+ AssertEquals ("test#02", typeof (NullReferenceException), e.GetType ());
+ }
+
+ try {
+ Set.Relations.AddRange (new DataRelation [] {Relation});
+ Fail ("test#03");
+ } catch (Exception e) {
+ AssertEquals ("test#04", typeof (NullReferenceException), e.GetType ());
+ }
+
+ Set.BeginInit ();
+ Set.Relations.AddRange (new DataRelation [] {Relation});
+ Set.EndInit ();
+
+ DataRelation Test = null;
+ AssertEquals ("test#01", 1, Mom.ChildRelations.Count);
+ AssertEquals ("test#02", 0, Child.ChildRelations.Count);
+ AssertEquals ("test#03", 0, Mom.ParentRelations.Count);
+ AssertEquals ("test#04", 1, Child.ParentRelations.Count);
+
+ Test = Child.ParentRelations [0];
+ AssertEquals ("test#05", "Rel", Test.ToString ());
+ AssertEquals ("test#06", "Rel", Test.RelationName);
+ AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);
+
+ AssertEquals ("test#08", true, Test.ParentKeyConstraint == null);
+
+ AssertEquals ("test#10", 1, Test.ParentColumns.Length);
+ AssertEquals ("test#11", true, Test.Nested);
+ AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);
+ AssertEquals ("test#13", "Child", Test.ChildTable.TableName);
+ AssertEquals ("test#14", true, Test.ChildKeyConstraint == null);
+ AssertEquals ("test#15", 1, Test.ChildColumns.Length);
+
+ }
+
+ public void TestRelationFromSchema ()
+ {
+ DataSet Set = new DataSet ();
+ Set.ReadXmlSchema ("System.Data/store.xsd");
+ DataTable Table = Set.Tables [0];
+
+ AssertEquals ("test#01", false, Table.CaseSensitive);
+ AssertEquals ("test#02", 1, Table.ChildRelations.Count);
+ AssertEquals ("test#03", 0, Table.ParentRelations.Count);
+ AssertEquals ("test#04", 1, Table.Constraints.Count);
+ AssertEquals ("test#05", 1, Table.PrimaryKey.Length);
+ AssertEquals ("test#06", 0, Table.Rows.Count);
+ AssertEquals ("test#07", "bookstore", Table.TableName);
+ AssertEquals ("test#08", 1, Table.Columns.Count);
+
+ DataRelation Relation = Table.ChildRelations [0];
+ AssertEquals ("test#09", 1, Relation.ChildColumns.Length);
+ AssertEquals ("test#10", "bookstore_book", Relation.ChildKeyConstraint.ConstraintName);
+ AssertEquals ("test#11", 1, Relation.ChildKeyConstraint.Columns.Length);
+ AssertEquals ("test#12", "book", Relation.ChildTable.TableName);
+ AssertEquals ("test#13", "NewDataSet", Relation.DataSet.DataSetName);
+ AssertEquals ("test#14", 0, Relation.ExtendedProperties.Count);
+ AssertEquals ("test#15", true, Relation.Nested);
+ AssertEquals ("test#16", 1, Relation.ParentColumns.Length);
+ AssertEquals ("test#17", "Constraint1", Relation.ParentKeyConstraint.ConstraintName);
+ AssertEquals ("test#18", "bookstore", Relation.ParentTable.TableName);
+ AssertEquals ("test#19", "bookstore_book", Relation.RelationName);
+
+ Table = Set.Tables [1];
+
+ AssertEquals ("test#20", false, Table.CaseSensitive);
+ AssertEquals ("test#21", 1, Table.ChildRelations.Count);
+ AssertEquals ("test#22", 1, Table.ParentRelations.Count);
+ AssertEquals ("test#23", 2, Table.Constraints.Count);
+ AssertEquals ("test#24", 1, Table.PrimaryKey.Length);
+ AssertEquals ("test#25", 0, Table.Rows.Count);
+ AssertEquals ("test#26", "book", Table.TableName);
+ AssertEquals ("test#27", 5, Table.Columns.Count);
+
+ Relation = Table.ChildRelations [0];
+ AssertEquals ("test#28", 1, Relation.ChildColumns.Length);
+ AssertEquals ("test#29", "book_author", Relation.ChildKeyConstraint.ConstraintName);
+ AssertEquals ("test#30", 1, Relation.ChildKeyConstraint.Columns.Length);
+ AssertEquals ("test#31", "author", Relation.ChildTable.TableName);
+ AssertEquals ("test#32", "NewDataSet", Relation.DataSet.DataSetName);
+ AssertEquals ("test#33", 0, Relation.ExtendedProperties.Count);
+ AssertEquals ("test#34", true, Relation.Nested);
+ AssertEquals ("test#35", 1, Relation.ParentColumns.Length);
+ AssertEquals ("test#36", "Constraint1", Relation.ParentKeyConstraint.ConstraintName);
+ AssertEquals ("test#37", "book", Relation.ParentTable.TableName);
+ AssertEquals ("test#38", "book_author", Relation.RelationName);
+
+ Table = Set.Tables [2];
+ AssertEquals ("test#39", false, Table.CaseSensitive);
+ AssertEquals ("test#40", 0, Table.ChildRelations.Count);
+ AssertEquals ("test#41", 1, Table.ParentRelations.Count);
+ AssertEquals ("test#42", 1, Table.Constraints.Count);
+ AssertEquals ("test#43", 0, Table.PrimaryKey.Length);
+ AssertEquals ("test#44", 0, Table.Rows.Count);
+ AssertEquals ("test#45", "author", Table.TableName);
+ AssertEquals ("test#46", 3, Table.Columns.Count);
+ }
+
+ public void TestChildRows ()
+ {
+ DataSet Set = new DataSet ();
+ DataTable Mom = new DataTable ("Mom");
+ DataTable Child = new DataTable ("Child");
+ Set.Tables.Add (Mom);
+ Set.Tables.Add (Child);
+
+ DataColumn Col = new DataColumn ("Name");
+ DataColumn Col2 = new DataColumn ("ChildName");
+ Mom.Columns.Add (Col);
+ Mom.Columns.Add (Col2);
+
+ DataColumn Col3 = new DataColumn ("Name");
+ DataColumn Col4 = new DataColumn ("Age");
+ Child.Columns.Add (Col3);
+ Child.Columns.Add (Col4);
+
+ DataRelation Relation = new DataRelation ("Rel", Col2, Col3);
+ Set.Relations.Add (Relation);
+
+ DataRow TempRow = Mom.NewRow ();
+ TempRow [0] = "teresa";
+ TempRow [1] = "john";
+ Mom.Rows.Add (TempRow);
+
+ TempRow = Mom.NewRow ();
+ TempRow [0] = "teresa";
+ TempRow [1] = "Dick";
+ Mom.Rows.Add (TempRow);
+
+ TempRow = Child.NewRow ();
+ TempRow [0] = "john";
+ TempRow [1] = "15";
+ Child.Rows.Add (TempRow);
+
+ TempRow = Child.NewRow ();
+ TempRow [0] = "Dick";
+ TempRow [1] = "10";
+ Child.Rows.Add (TempRow);
+
+ DataRow Row = Mom.Rows [1];
+ TempRow = Row.GetChildRows ("Rel") [0];
+ AssertEquals ("test#01", "Dick", TempRow [0]);
+ AssertEquals ("test#02", "10", TempRow [1]);
+ TempRow = TempRow.GetParentRow ("Rel");
+ AssertEquals ("test#03", "teresa", TempRow [0]);
+ AssertEquals ("test#04", "Dick", TempRow [1]);
+
+ Row = Child.Rows [0];
+ TempRow = Row.GetParentRows ("Rel") [0];
+ AssertEquals ("test#05", "teresa", TempRow [0]);
+ AssertEquals ("test#06", "john", TempRow [1]);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest.cs b/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest.cs
new file mode 100644
index 00000000000..325a049dd1a
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest.cs
@@ -0,0 +1,56 @@
+// DataRowCollectionTest.cs - NUnit Test Cases for System.DataRowCollection
+//
+// Franklin Wise (gracenote@earthlink.net)
+//
+// (C) Copyright 2002 Franklin Wise
+//
+
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+
+ public class DataRowCollectionTest : TestCase
+ {
+
+ public DataRowCollectionTest() : base ("MonoTests.System.Data.DataRowCollectionTest") {}
+ public DataRowCollectionTest(string name) : base(name) {}
+
+ private DataTable _tbl;
+
+ protected override void SetUp()
+ {
+ _tbl = new DataTable();
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(DataRowCollectionTest));
+ }
+ }
+
+ //FINISHME
+ public void TestAutoIncrement()
+ {
+ DataColumn col = new DataColumn();
+ col.AutoIncrement = true;
+ col.AutoIncrementSeed = 0;
+ col.AutoIncrementStep = 1;
+
+ _tbl.Columns.Add(col);
+ _tbl.Rows.Add(_tbl.NewRow());
+
+ //Assertion.AssertEquals("Inc 0" , 0, Convert.ToInt32(_tbl.Rows[0]["Auto"] ));
+
+ _tbl.Rows.Add(_tbl.NewRow());
+ //Assertion.AssertEquals("Inc 1" , 1, Convert.ToInt32(_tbl.Rows[0]["Auto"] ));
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataRowTest.cs b/mcs/class/System.Data/Test/System.Data/DataRowTest.cs
new file mode 100644
index 00000000000..0dfb63ed1d3
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataRowTest.cs
@@ -0,0 +1,42 @@
+// DataRowTest.cs - NUnit Test Cases for System.DataRow
+//
+// Franklin Wise (gracenote@earthlink.net)
+//
+// (C) Copyright 2002 Franklin Wise
+//
+
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+
+ public class DataRowTest : TestCase
+ {
+
+ public DataRowTest() : base ("MonoTests.System.Data.DataRowTest") {}
+ public DataRowTest(string name) : base(name) {}
+
+ private DataTable _tbl;
+
+ protected override void SetUp()
+ {
+ _tbl = new DataTable();
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(DataRowTest));
+ }
+ }
+
+ //Remove when real tests are added.
+ public void TestRemoveMe(){}
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
new file mode 100644
index 00000000000..2b036768e2a
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
@@ -0,0 +1,832 @@
+// MonoTests.System.Data.DataSetTest.cs
+//
+// Author:
+// Ville Palo <vi64pa@koti.soon.fi>
+//
+// (C) Copyright 2002 Ville Palo
+//
+
+using NUnit.Framework;
+using System;
+using System.Xml;
+using System.IO;
+using System.Data;
+using System.Data.SqlTypes;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System.Data
+{
+
+ public class DataSetTest : TestCase
+ {
+
+ public DataSetTest() : base ("MonoTests.System.Data.DataSetTest") {}
+ public DataSetTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("fi-FI");
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(DataSetTest));
+ }
+ }
+
+ public void TestReadXmlSchema ()
+ {
+ DataSet ds = new DataSet ();
+ ds.ReadXmlSchema ("System.Data/own_schema.xsd");
+
+ AssertEquals ("test#01", 2, ds.Tables.Count);
+ DataTable Table = ds.Tables [0];
+ AssertEquals ("test#02", "test_table", Table.TableName);
+ AssertEquals ("test#03", "", Table.Namespace);
+ AssertEquals ("test#04", 2, Table.Columns.Count);
+ AssertEquals ("test#05", 0, Table.Rows.Count);
+ AssertEquals ("test#06", false, Table.CaseSensitive);
+ AssertEquals ("test#07", 1, Table.Constraints.Count);
+ AssertEquals ("test#08", "", Table.Prefix);
+
+ Constraint cons = Table.Constraints [0];
+ AssertEquals ("test#09", "Constraint1", cons.ConstraintName.ToString ());
+ AssertEquals ("test#10", "Constraint1", cons.ToString ());
+
+ DataColumn column = Table.Columns [0];
+ AssertEquals ("test#11", true, column.AllowDBNull);
+ AssertEquals ("test#12", false, column.AutoIncrement);
+ AssertEquals ("test#13", 0L, column.AutoIncrementSeed);
+ AssertEquals ("test#14", 1L, column.AutoIncrementStep);
+ AssertEquals ("test#15", "test", column.Caption);
+ AssertEquals ("test#16", "Element", column.ColumnMapping.ToString ());
+ AssertEquals ("test#17", "first", column.ColumnName);
+ AssertEquals ("test#18", "System.String", column.DataType.ToString ());
+ AssertEquals ("test#19", "test_default_value", column.DefaultValue.ToString ());
+ AssertEquals ("test#20", false, column.DesignMode);
+ AssertEquals ("test#21", "", column.Expression);
+ AssertEquals ("test#22", 100, column.MaxLength);
+ AssertEquals ("test#23", "", column.Namespace);
+ AssertEquals ("test#24", 0, column.Ordinal);
+ AssertEquals ("test#25", "", column.Prefix);
+ AssertEquals ("test#26", false, column.ReadOnly);
+ AssertEquals ("test#27", true, column.Unique);
+
+ DataColumn column2 = Table.Columns [1];
+ AssertEquals ("test#28", true, column2.AllowDBNull);
+ AssertEquals ("test#29", false, column2.AutoIncrement);
+ AssertEquals ("test#30", 0L, column2.AutoIncrementSeed);
+ AssertEquals ("test#31", 1L, column2.AutoIncrementStep);
+ AssertEquals ("test#32", "second", column2.Caption);
+ AssertEquals ("test#33", "Element", column2.ColumnMapping.ToString ());
+ AssertEquals ("test#34", "second", column2.ColumnName);
+ AssertEquals ("test#35", "System.Data.SqlTypes.SqlGuid", column2.DataType.ToString ());
+ AssertEquals ("test#36", "", column2.DefaultValue.ToString ());
+ AssertEquals ("test#37", false, column2.DesignMode);
+ AssertEquals ("test#38", "", column2.Expression);
+ AssertEquals ("test#39", -1, column2.MaxLength);
+ AssertEquals ("test#40", "", column2.Namespace);
+ AssertEquals ("test#41", 1, column2.Ordinal);
+ AssertEquals ("test#42", "", column2.Prefix);
+ AssertEquals ("test#43", false, column2.ReadOnly);
+ AssertEquals ("test#44", false, column2.Unique);
+
+ DataTable Table2 = ds.Tables [1];
+ AssertEquals ("test#45", "second_test_table", Table2.TableName);
+ AssertEquals ("test#46", "", Table2.Namespace);
+ AssertEquals ("test#47", 1, Table2.Columns.Count);
+ AssertEquals ("test#48", 0, Table2.Rows.Count);
+ AssertEquals ("test#49", false, Table2.CaseSensitive);
+ AssertEquals ("test#50", 1, Table2.Constraints.Count);
+ AssertEquals ("test#51", "", Table2.Prefix);
+
+ DataColumn column3 = Table2.Columns [0];
+ AssertEquals ("test#52", true, column3.AllowDBNull);
+ AssertEquals ("test#53", false, column3.AutoIncrement);
+ AssertEquals ("test#54", 0L, column3.AutoIncrementSeed);
+ AssertEquals ("test#55", 1L, column3.AutoIncrementStep);
+ AssertEquals ("test#56", "second_first", column3.Caption);
+ AssertEquals ("test#57", "Element", column3.ColumnMapping.ToString ());
+ AssertEquals ("test#58", "second_first", column3.ColumnName);
+ AssertEquals ("test#59", "System.String", column3.DataType.ToString ());
+ AssertEquals ("test#60", "default_value", column3.DefaultValue.ToString ());
+ AssertEquals ("test#61", false, column3.DesignMode);
+ AssertEquals ("test#62", "", column3.Expression);
+ AssertEquals ("test#63", 100, column3.MaxLength);
+ AssertEquals ("test#64", "", column3.Namespace);
+ AssertEquals ("test#65", 0, column3.Ordinal);
+ AssertEquals ("test#66", "", column3.Prefix);
+ AssertEquals ("test#67", false, column3.ReadOnly);
+ AssertEquals ("test#68", true, column3.Unique);
+ }
+
+ public void TestOwnWriteXmlSchema ()
+ {
+ DataSet ds = new DataSet ("test_dataset");
+ DataTable table = new DataTable ("test_table");
+ DataColumn column = new DataColumn ("first", typeof (string));
+ column.AllowDBNull = true;
+ column.DefaultValue = "test_default_value";
+ column.MaxLength = 100;
+ column.Caption = "test";
+ column.Unique = true;
+ table.Columns.Add (column);
+
+ DataColumn column2 = new DataColumn ("second", typeof (SqlGuid));
+ column2.ColumnMapping = MappingType.Element;
+ table.Columns.Add (column2);
+ ds.Tables.Add (table);
+
+ DataTable table2 = new DataTable ("second_test_table");
+ DataColumn column3 = new DataColumn ("second_first", typeof (string));
+ column3.AllowDBNull = true;
+ column3.DefaultValue = "default_value";
+ column3.MaxLength = 100;
+ column3.Unique = true;
+ table2.Columns.Add (column3);
+ ds.Tables.Add (table2);
+
+ TextWriter writer = new StringWriter ();
+ ds.WriteXmlSchema (writer);
+
+ string TextString = writer.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#01", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#02", "<xs:schema id=\"test_dataset\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#03", " <xs:element name=\"test_dataset\" msdata:IsDataSet=\"true\" msdata:Locale=\"fi-FI\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#04", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", " <xs:choice maxOccurs=\"unbounded\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " <xs:element name=\"test_table\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#08", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#09", " <xs:element name=\"first\" msdata:Caption=\"test\" default=\"test_default_value\" minOccurs=\"0\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#10", " <xs:simpleType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#11", " <xs:restriction base=\"xs:string\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#12", " <xs:maxLength value=\"100\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#13", " </xs:restriction>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#14", " </xs:simpleType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#15", " </xs:element>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#16", " <xs:element name=\"second\" msdata:DataType=\"System.Data.SqlTypes.SqlGuid, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" type=\"xs:string\" minOccurs=\"0\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#17", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#18", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#19", " </xs:element>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#20", " <xs:element name=\"second_test_table\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#21", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#22", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#23", " <xs:element name=\"second_first\" default=\"default_value\" minOccurs=\"0\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#24", " <xs:simpleType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#25", " <xs:restriction base=\"xs:string\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#26", " <xs:maxLength value=\"100\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#27", " </xs:restriction>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#28", " </xs:simpleType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#29", " </xs:element>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#30", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#31", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#32", " </xs:element>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#33", " </xs:choice>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#34", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#36", " <xs:unique name=\"Constraint1\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#37", " <xs:selector xpath=\".//test_table\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#38", " <xs:field xpath=\"first\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#39", " </xs:unique>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#40", " <xs:unique name=\"second_test_table_Constraint1\" msdata:ConstraintName=\"Constraint1\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#41", " <xs:selector xpath=\".//second_test_table\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#42", " <xs:field xpath=\"second_first\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#43", " </xs:unique>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#44", " </xs:element>", substring);
+ AssertEquals ("test#45", "</xs:schema>", TextString);
+ }
+
+ public void TestReadWriteXml ()
+ {
+ DataSet ds = new DataSet ();
+ ds.ReadXml ("System.Data/region.xml");
+ TextWriter writer = new StringWriter ();
+ ds.WriteXml (writer);
+
+ string TextString = writer.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#01", "<Root>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#02", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#03", " <RegionID>1</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#04", " <RegionDescription>Eastern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#08", " <RegionID>2</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#09", " <RegionDescription>Western", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#10", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#11", " </Region>", substring);
+
+ AssertEquals ("test#11", "</Root>", TextString);
+ }
+
+ public void TestReadWriteXmlDiffGram ()
+ {
+ DataSet ds = new DataSet ();
+ ds.ReadXml ("System.Data/region.xml", XmlReadMode.DiffGram);
+ TextWriter writer = new StringWriter ();
+ ds.WriteXml (writer);
+
+ string TextString = writer.ToString ();
+ AssertEquals ("test#01", "<NewDataSet />", TextString);
+
+ ds.WriteXml (writer, XmlWriteMode.DiffGram);
+ TextString = writer.ToString ();
+
+ AssertEquals ("test#02", "<NewDataSet /><diffgr:diffgram xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:diffgr=\"urn:schemas-microsoft-com:xml-diffgram-v1\" />", TextString);
+
+
+ ds = new DataSet ();
+ ds.ReadXml ("System.Data/region.xml");
+ DataTable table = ds.Tables ["Region"];
+ table.Rows [0] [0] = "64";
+ ds.ReadXml ("System.Data/region.xml", XmlReadMode.DiffGram);
+ ds.WriteXml (writer, XmlWriteMode.DiffGram);
+
+ TextString = writer.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#03", "<NewDataSet /><diffgr:diffgram xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:diffgr=\"urn:schemas-microsoft-com:xml-diffgram-v1\" /><diffgr:diffgram xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:diffgr=\"urn:schemas-microsoft-com:xml-diffgram-v1\">",substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#04", " <Root>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", " <Region diffgr:id=\"Region1\" msdata:rowOrder=\"0\" diffgr:hasChanges=\"inserted\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " <RegionID>64</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " <RegionDescription>Eastern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#08", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#09", " <Region diffgr:id=\"Region2\" msdata:rowOrder=\"1\" diffgr:hasChanges=\"inserted\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#10", " <RegionID>2</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#11", " <RegionDescription>Western", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#12", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#13", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#14", " </Root>", substring);
+
+ AssertEquals ("test#15", "</diffgr:diffgram>", TextString);
+ }
+
+ public void TestWriteXmlSchema ()
+ {
+ DataSet ds = new DataSet ();
+ ds.ReadXml ("System.Data/region.xml");
+ TextWriter writer = new StringWriter ();
+ ds.WriteXmlSchema (writer);
+
+ string TextString = writer.ToString ();
+
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#01", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#02", "<xs:schema id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#03", " <xs:element name=\"Root\" msdata:IsDataSet=\"true\" msdata:Locale=\"fi-FI\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#04", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", " <xs:choice maxOccurs=\"unbounded\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " <xs:element name=\"Region\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#08", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#09", " <xs:element name=\"RegionID\" type=\"xs:string\" minOccurs=\"0\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#10", " <xs:element name=\"RegionDescription\" type=\"xs:string\" minOccurs=\"0\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#11", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#12", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#13", " </xs:element>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#14", " </xs:choice>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#15", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#16", " </xs:element>", substring);
+
+ AssertEquals ("test#17", "</xs:schema>", TextString);
+ }
+
+ public void TestReadWriteXmlSchemaIgnoreSchema ()
+ {
+ DataSet ds = new DataSet ();
+ ds.ReadXmlSchema ("System.Data/store.xsd");
+ ds.ReadXml ("System.Data/region.xml", XmlReadMode.IgnoreSchema);
+ TextWriter writer = new StringWriter ();
+
+ ds.WriteXmlSchema (writer);
+ string TextString = writer.ToString ();
+
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#01", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#02", "<xs:schema id=\"NewDataSet\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#03", " <xs:complexType name=\"bookstoreType\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#04", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", " <xs:element name=\"book\" type=\"bookType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#08", " <xs:complexType name=\"bookType\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#09", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#10", " <xs:element name=\"title\" type=\"xs:string\" msdata:Ordinal=\"1\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#11", " <xs:element name=\"price\" type=\"xs:decimal\" msdata:Ordinal=\"2\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#12", " <xs:element name=\"author\" type=\"authorName\" minOccurs=\"0\" maxOccurs=\"unbounded\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#13", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#14", " <xs:attribute name=\"genre\" type=\"xs:string\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#15", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#16", " <xs:complexType name=\"authorName\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#17", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#18", " <xs:element name=\"first-name\" type=\"xs:string\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#19", " <xs:element name=\"last-name\" type=\"xs:string\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#20", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#21", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#22", " <xs:element name=\"bookstore\" type=\"bookstoreType\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#23", " <xs:element name=\"NewDataSet\" msdata:IsDataSet=\"true\" msdata:Locale=\"fi-FI\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#24", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#25", " <xs:choice maxOccurs=\"unbounded\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#26", " <xs:element ref=\"bookstore\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#27", " </xs:choice>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#28", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#29", " </xs:element>", substring);
+
+ AssertEquals ("test#30", "</xs:schema>", TextString);
+ }
+
+ public void TestReadWriteXmlSchema ()
+ {
+ DataSet ds = new DataSet ();
+ ds.ReadXmlSchema ("System.Data/store.xsd");
+ ds.ReadXml ("System.Data/region.xml", XmlReadMode.InferSchema);
+ TextWriter writer = new StringWriter ();
+ ds.WriteXmlSchema (writer);
+
+ string TextString = writer.ToString ();
+
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#01", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#02", "<xs:schema id=\"Root\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#03", " <xs:complexType name=\"bookstoreType\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#04", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", " <xs:element name=\"book\" type=\"bookType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#08", " <xs:complexType name=\"bookType\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#09", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#10", " <xs:element name=\"title\" type=\"xs:string\" msdata:Ordinal=\"1\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#11", " <xs:element name=\"price\" type=\"xs:decimal\" msdata:Ordinal=\"2\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#12", " <xs:element name=\"author\" type=\"authorName\" minOccurs=\"0\" maxOccurs=\"unbounded\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#13", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#14", " <xs:attribute name=\"genre\" type=\"xs:string\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#15", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#16", " <xs:complexType name=\"authorName\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#17", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#18", " <xs:element name=\"first-name\" type=\"xs:string\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#19", " <xs:element name=\"last-name\" type=\"xs:string\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#20", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#21", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#22", " <xs:element name=\"bookstore\" type=\"bookstoreType\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#23", " <xs:element name=\"Root\" msdata:IsDataSet=\"true\" msdata:Locale=\"fi-FI\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#24", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#25", " <xs:choice maxOccurs=\"unbounded\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#26", " <xs:element ref=\"bookstore\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#27", " <xs:element name=\"Region\">", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#28", " <xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#29", " <xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#30", " <xs:element name=\"RegionID\" type=\"xs:string\" minOccurs=\"0\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#31", " <xs:element name=\"RegionDescription\" type=\"xs:string\" minOccurs=\"0\" />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#32", " </xs:sequence>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#33", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#34", " </xs:element>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#35", " </xs:choice>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#36", " </xs:complexType>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#37", " </xs:element>", substring);
+
+ AssertEquals ("test#38", "</xs:schema>", TextString);
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/DataTableTest.cs b/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
new file mode 100644
index 00000000000..ea6a90c6adb
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
@@ -0,0 +1,71 @@
+// DataTableTest.cs - NUnit Test Cases for testing the DataTable
+//
+// Franklin Wise (gracenote@earthlink.net)
+//
+// (C) Franklin Wise
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+
+ public class DataTableTest : TestCase
+ {
+
+ public DataTableTest() : base ("MonoTest.System.Data.DataTableTest") {}
+ public DataTableTest(string name) : base(name) {}
+
+ protected override void SetUp() {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(DataTableTest));
+ }
+ }
+
+ public void TestCtor()
+ {
+ DataTable dt = new DataTable();
+
+ Assertion.AssertEquals("CaseSensitive must be false." ,false,dt.CaseSensitive);
+ Assertion.Assert("Col",dt.Columns != null);
+ //Assertion.Assert(dt.ChildRelations != null);
+ Assertion.Assert("Const", dt.Constraints != null);
+ Assertion.Assert("ds", dt.DataSet == null);
+ Assertion.Assert("dv", dt.DefaultView != null);
+ Assertion.Assert("de", dt.DisplayExpression == "");
+ Assertion.Assert("ep", dt.ExtendedProperties != null);
+ Assertion.Assert("he", dt.HasErrors == false);
+ Assertion.Assert("lc", dt.Locale != null);
+ Assertion.Assert("mc", dt.MinimumCapacity == 50); //LAMESPEC:
+ Assertion.Assert("ns", dt.Namespace == "");
+ //Assertion.Assert(dt.ParentRelations != null);
+ Assertion.Assert("pf", dt.Prefix == "");
+ Assertion.Assert("pk", dt.PrimaryKey != null);
+ Assertion.Assert("rows", dt.Rows != null);
+ Assertion.Assert("Site", dt.Site == null);
+ Assertion.Assert("tname", dt.TableName == "");
+
+ }
+
+ public void TestToString()
+ {
+ DataTable dt = new DataTable();
+ dt.Columns.Add("Col1",typeof(int));
+
+ dt.TableName = "Myzable";
+ dt.DisplayExpression = "Col1";
+
+
+ string cmpr = dt.TableName + " " + dt.DisplayExpression;
+ Assertion.AssertEquals(cmpr,dt.ToString());
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs b/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs
new file mode 100644
index 00000000000..27667742e66
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs
@@ -0,0 +1,228 @@
+// ForeignKeyConstraintTest.cs - NUnit Test Cases for [explain here]
+//
+// Franklin Wise (gracenote@earthlink.net)
+//
+// (C) Franklin Wise
+//
+
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+
+ public class ForeignKeyConstraintTest : TestCase
+ {
+ private DataSet _ds;
+
+ //NOTE: fk constraints only work when the table is part of a DataSet
+
+ public ForeignKeyConstraintTest() : base ("MonoTests.System.Data.ForeignKeyConstraintTest") {}
+ public ForeignKeyConstraintTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ _ds = new DataSet();
+
+ //Setup DataTable
+ DataTable table;
+ table = new DataTable("TestTable");
+ table.Columns.Add("Col1",typeof(int));
+ table.Columns.Add("Col2",typeof(int));
+ table.Columns.Add("Col3",typeof(int));
+
+ _ds.Tables.Add(table);
+
+ table = new DataTable("TestTable2");
+ table.Columns.Add("Col1",typeof(int));
+ table.Columns.Add("Col2",typeof(int));
+ table.Columns.Add("Col3",typeof(int));
+
+ _ds.Tables.Add(table);
+
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(ForeignKeyConstraintTest));
+ }
+ }
+
+
+ public void TestCtorExceptions ()
+ {
+ ForeignKeyConstraint fkc;
+
+ DataTable localTable = new DataTable();
+ localTable.Columns.Add("Col1",typeof(int));
+ localTable.Columns.Add("Col2",typeof(bool));
+
+ //Null
+ try
+ {
+ fkc = new ForeignKeyConstraint((DataColumn)null,(DataColumn)null);
+ Assertion.Fail("Failed to throw ArgumentNullException.");
+ }
+ catch (ArgumentNullException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("A1: Wrong Exception type. " + exc.ToString());
+ }
+
+ //zero length collection
+ try
+ {
+ fkc = new ForeignKeyConstraint(new DataColumn[]{},new DataColumn[]{});
+ Assertion.Fail("B1: Failed to throw ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("A2: Wrong Exception type. " + exc.ToString());
+ }
+
+ //different datasets
+ try
+ {
+ fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[0]);
+ Assertion.Fail("Failed to throw InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("A3: Wrong Exception type. " + exc.ToString());
+ }
+
+ //different dataTypes
+ try
+ {
+ fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[1]);
+ Assertion.Fail("Failed to throw InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("A4: Wrong Exception type. " + exc.ToString());
+ }
+
+
+ }
+ public void TestCtorExceptions2 ()
+ {
+ DataColumn col = new DataColumn("MyCol1",typeof(int));
+
+ ForeignKeyConstraint fkc;
+
+ //Columns must belong to a Table
+ try
+ {
+ fkc = new ForeignKeyConstraint(col, _ds.Tables[0].Columns[0]);
+ Assertion.Fail("FTT1: Failed to throw ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("WET1: Wrong Exception type. " + exc.ToString());
+ }
+
+ //Columns must belong to the same table
+ //InvalidConstraintException
+
+ DataColumn [] difTable = new DataColumn [] {_ds.Tables[0].Columns[2],
+ _ds.Tables[1].Columns[0]};
+ try
+ {
+ fkc = new ForeignKeyConstraint(difTable,new DataColumn[] {
+ _ds.Tables[0].Columns[1],
+ _ds.Tables[0].Columns[0]});
+
+ Assertion.Fail("FTT2: Failed to throw InvalidConstraintException.");
+ }
+ catch (InvalidConstraintException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("WET2: Wrong Exception type. " + exc.ToString());
+ }
+
+
+ //parent columns and child columns should be the same length
+ //ArgumentException
+ DataColumn [] twoCol =
+ new DataColumn [] {_ds.Tables[0].Columns[0],_ds.Tables[0].Columns[1]};
+
+
+ try
+ {
+ fkc = new ForeignKeyConstraint(twoCol,
+ new DataColumn[] { _ds.Tables[0].Columns[0]});
+
+ Assertion.Fail("FTT3: Failed to throw ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("WET3: Wrong Exception type. " + exc.ToString());
+ }
+
+ //InvalidOperation: Parent and child are the same column.
+ try
+ {
+ fkc = new ForeignKeyConstraint( _ds.Tables[0].Columns[0],
+ _ds.Tables[0].Columns[0] );
+
+ Assertion.Fail("FTT4: Failed to throw InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch (Exception exc)
+ {
+ Assertion.Fail("WET4: Wrong Exception type. " + exc.ToString());
+ }
+
+ }
+
+ public void TestEqualsAndHashCode()
+ {
+ DataTable tbl = _ds.Tables[0];
+ DataTable tbl2 = _ds.Tables[1];
+
+ ForeignKeyConstraint fkc = new ForeignKeyConstraint(
+ new DataColumn[] {tbl.Columns[0], tbl.Columns[1]} ,
+ new DataColumn[] {tbl2.Columns[0], tbl2.Columns[1]} );
+
+ ForeignKeyConstraint fkc2 = new ForeignKeyConstraint(
+ new DataColumn[] {tbl.Columns[0], tbl.Columns[1]} ,
+ new DataColumn[] {tbl2.Columns[0], tbl2.Columns[1]} );
+
+ ForeignKeyConstraint fkcDiff =
+ new ForeignKeyConstraint( tbl.Columns[1], tbl.Columns[2]);
+
+ Assertion.Assert( "Equals failed. 1" , fkc.Equals(fkc2));
+ Assertion.Assert( "Equals failed. 2" , fkc2.Equals(fkc));
+ Assertion.Assert( "Equals failed. 3" , fkc.Equals(fkc));
+
+ Assertion.Assert( "Equals failed diff. 1" , fkc.Equals(fkcDiff) == false);
+
+ Assertion.Assert( "Hash Code Failed. 1", fkc.GetHashCode() == fkc2.GetHashCode() );
+ Assertion.Assert( "Hash Code Failed. 2", fkc.GetHashCode() != fkcDiff.GetHashCode() );
+
+
+
+
+
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/UniqueConstraintTest.cs b/mcs/class/System.Data/Test/System.Data/UniqueConstraintTest.cs
new file mode 100644
index 00000000000..3f94e762674
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/UniqueConstraintTest.cs
@@ -0,0 +1,188 @@
+// UniqueConstraintTest.cs - NUnit Test Cases for testing the class System.Data.UniqueConstraint
+//
+// Franklin Wise <gracenote@earthlink.net>
+//
+// (C) 2002 Franklin Wise
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+
+namespace MonoTests.System.Data
+{
+ public class UniqueConstraintTest : TestCase
+ {
+ private DataTable _table;
+
+ public UniqueConstraintTest() : base ("MonoTests.System.Data.UniqueConstraintTest") {}
+ public UniqueConstraintTest(string name) : base(name) {}
+
+ public void PublicSetup() {this.SetUp();}
+ protected override void SetUp() {
+
+ //Setup DataTable
+ _table = new DataTable("TestTable");
+ _table.Columns.Add("Col1",typeof(int));
+ _table.Columns.Add("Col2",typeof(int));
+ _table.Columns.Add("Col3",typeof(int));
+
+ }
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(UniqueConstraintTest));
+ }
+ }
+
+ public void TestCtorExceptions() {
+ //UniqueConstraint(string name, DataColumn column, bool isPrimaryKey)
+
+ UniqueConstraint cst;
+
+ //must have DataTable exception
+ try{
+ //Should throw an ArgumentException
+ //Can only add DataColumns that are attached
+ //to a DataTable
+ cst = new UniqueConstraint(new DataColumn(""));
+
+ Assertion.Fail("Failed to throw ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch {
+ Assertion.Fail("A1: Wrong Exception type.");
+ }
+
+ //Null exception
+ try {
+ //Should throw argument null exception
+ cst = new UniqueConstraint((DataColumn)null);
+ }
+ catch (ArgumentNullException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch {
+ Assertion.Fail("A2: Wrong Exception type.");
+ }
+
+
+ try {
+ //Should throw exception
+ //must have at least one valid column
+ //InvalidConstraintException is thrown by msft ver
+ cst = new UniqueConstraint(new DataColumn [] {});
+
+ Assertion.Fail("B1: Failed to throw InvalidConstraintException.");
+ }
+ catch (InvalidConstraintException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch {
+ Assertion.Fail("A3: Wrong Exception type.");
+ }
+
+ DataTable dt = new DataTable("Table1");
+ dt.Columns.Add("Col1",typeof(int));
+ DataTable dt2 = new DataTable("Table2");
+ dt2.Columns.Add("Col1",typeof(int));
+
+ DataSet ds = new DataSet();
+ ds.Tables.Add(dt);
+ ds.Tables.Add(dt2);
+
+ //columns from two different tables.
+ try {
+ //next line should throw
+ //can't have columns from two different tables
+ cst = new UniqueConstraint(new DataColumn [] {
+ dt.Columns[0], dt2.Columns[0]});
+
+ Assertion.Fail("B2: Failed to throw InvalidConstraintException");
+ }
+ catch (InvalidConstraintException) {}
+ catch (AssertionFailedError exc) {throw exc;}
+ catch {
+ Assertion.Fail("A4: Wrong Exception type.");
+ }
+
+
+
+ }
+
+
+ public void TestCtor() {
+
+ UniqueConstraint cst;
+
+ //Success case
+ try {
+ cst = new UniqueConstraint(_table.Columns[0]);
+ }
+ catch (Exception exc) {
+ Assertion.Fail("A1: Failed to ctor. " + exc.ToString());
+ }
+
+
+ try {
+ cst = new UniqueConstraint( new DataColumn [] {
+ _table.Columns[0], _table.Columns[1]});
+ }
+ catch (Exception exc) {
+ Assertion.Fail("A2: Failed to ctor. " + exc.ToString());
+ }
+
+
+ //table is set on ctor
+ cst = new UniqueConstraint(_table.Columns[0]);
+
+ Assertion.AssertSame("B1", cst.Table, _table);
+
+ //table is set on ctor
+ cst = new UniqueConstraint( new DataColumn [] {
+ _table.Columns[0], _table.Columns[1]});
+ Assertion.AssertSame ("B2", cst.Table, _table);
+
+ cst = new UniqueConstraint("MyName",_table.Columns[0],true);
+
+ //Test ctor parm set for ConstraintName & IsPrimaryKey
+ Assertion.AssertEquals("ConstraintName not set in ctor.",
+ "MyName", cst.ConstraintName);
+ Assertion.AssertEquals("IsPrimaryKey not set in ctor.",
+ true, cst.IsPrimaryKey);
+
+ }
+
+ public void TestEqualsAndHashCode() {
+ UniqueConstraint cst = new UniqueConstraint( new DataColumn [] {
+ _table.Columns[0], _table.Columns[1]});
+ UniqueConstraint cst2 = new UniqueConstraint( new DataColumn [] {
+ _table.Columns[1], _table.Columns[0]});
+
+ UniqueConstraint cst3 = new UniqueConstraint(_table.Columns[0]);
+ UniqueConstraint cst4 = new UniqueConstraint(_table.Columns[2]);
+
+ //true
+ Assertion.Assert(cst.Equals(cst2) == true);
+
+ //false
+ Assertion.Assert("A1", cst.Equals(23) == false);
+ Assertion.Assert("A2", cst.Equals(cst3) == false);
+ Assertion.Assert("A3", cst3.Equals(cst) == false);
+ Assertion.Assert("A4", cst.Equals(cst4) == false);
+
+ //true
+ Assertion.Assert("HashEquals", cst.GetHashCode() == cst2.GetHashCode());
+
+ //false
+ Assertion.Assert("Hash Not Equals", (cst.GetHashCode() == cst3.GetHashCode()) == false);
+
+
+ }
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Data/own_schema.xsd b/mcs/class/System.Data/Test/System.Data/own_schema.xsd
new file mode 100755
index 00000000000..dd5e4cbfdd7
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/own_schema.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<xs:schema id="test_dataset" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xs:element name="test_dataset" msdata:IsDataSet="true" msdata:Locale="fi-FI">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="test_table">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="first" msdata:Caption="test" default="test_default_value" minOccurs="0">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="100" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="second" msdata:DataType="System.Data.SqlTypes.SqlGuid, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:string" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="second_test_table">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="second_first" default="default_value" minOccurs="0">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="100" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ <xs:unique name="Constraint1">
+ <xs:selector xpath=".//test_table" />
+ <xs:field xpath="first" />
+ </xs:unique>
+ <xs:unique name="second_test_table_Constraint1" msdata:ConstraintName="Constraint1">
+ <xs:selector xpath=".//second_test_table" />
+ <xs:field xpath="second_first" />
+ </xs:unique>
+ </xs:element>
+</xs:schema>
diff --git a/mcs/class/System.Data/Test/System.Data/region.xml b/mcs/class/System.Data/Test/System.Data/region.xml
new file mode 100644
index 00000000000..eacd9fec203
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/region.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" standalone="yes"?>
+<Root>
+ <Region>
+ <RegionID>1</RegionID>
+ <RegionDescription>Eastern
+ </RegionDescription>
+ </Region>
+ <Region>
+ <RegionID>2</RegionID>
+ <RegionDescription>Western
+ </RegionDescription>
+ </Region>
+</Root>
diff --git a/mcs/class/System.Data/Test/System.Data/store.xsd b/mcs/class/System.Data/Test/System.Data/store.xsd
new file mode 100755
index 00000000000..1e2533ed2c1
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/store.xsd
@@ -0,0 +1,27 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="bookstore" type="bookstoreType"/>
+
+ <xsd:complexType name="bookstoreType">
+ <xsd:sequence maxOccurs="unbounded">
+ <xsd:element name="book" type="bookType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="bookType">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string"/>
+ <xsd:element name="author" type="authorName"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ </xsd:sequence>
+ <xsd:attribute name="genre" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="authorName">
+ <xsd:sequence>
+ <xsd:element name="first-name" type="xsd:string"/>
+ <xsd:element name="last-name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema> \ No newline at end of file
diff --git a/mcs/class/System.Data/Test/System.Data_test.build b/mcs/class/System.Data/Test/System.Data_test.build
new file mode 100644
index 00000000000..586a4557386
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data_test.build
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Data_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System.Data_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System.Data_test.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ <excludes name="ReadPostgresData.cs"/>
+ <excludes name="TestExecuteScalar.cs"/>
+ <excludes name="TestSqlDataReader.cs"/>
+ <excludes name="TestSqlException.cs"/>
+ <excludes name="TestSqlInsert.cs"/>
+ <excludes name="TestSqlIsolationLevel.cs"/>
+ <excludes name="TestSqlDataAdapter.cs"/>
+ <excludes name="PostgresTest.cs"/>
+ <excludes name="TestSqlParameters.cs"/>
+ <excludes name="SqlSharpCli.cs"/>
+ <excludes name="OdbcTest.cs"/>
+
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/r:..\..\lib\System.Data.dll"/>
+ </csc>
+ </target>
+
+ <target name="RunTests">
+ <csc target="exe" output="RunTests.System.Data.exe" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="**/AllTests.cs"/>
+ <excludes name="**/MartinTests.cs"/>
+ <excludes name="ReadPostgresData.cs"/>
+ <excludes name="TestExecuteScalar.cs"/>
+ <excludes name="TestSqlDataReader.cs"/>
+ <excludes name="TestSqlException.cs"/>
+ <excludes name="TestSqlInsert.cs"/>
+ <excludes name="TestSqlIsolationLevel.cs"/>
+ <excludes name="PostgresTest.cs"/>
+ <excludes name="TestSqlDataAdapter.cs"/>
+ <excludes name="TestSqlParameters.cs"/>
+ <excludes name="SqlSharpCli.cs"/>
+ <excludes name="OdbcTest.cs"/>
+
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitBase.dll"/>
+ </references>
+ <arg value="/nowarn:1595"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:..\..\lib\System.Data.dll"/>
+ </csc>
+
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.System.Data.AllTests,System.Data_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System.Data.dll" failonerror="false"/>
+ <delete file="System.Data_test.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Data/Test/System.Xml/2books.xml b/mcs/class/System.Data/Test/System.Xml/2books.xml
new file mode 100755
index 00000000000..fc3b3c3d695
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/2books.xml
@@ -0,0 +1,11 @@
+<!--sample XML fragment-->
+<bookstore>
+ <book genre='novel' ISBN='10-861003-324'>
+ <title>The Handmaid's Tale</title>
+ <price>19.95</price>
+ </book>
+ <book genre='novel' ISBN='1-861001-57-5'>
+ <title>Pride And Prejudice</title>
+ <price>24.95</price>
+ </book>
+</bookstore>
diff --git a/mcs/class/System.Data/Test/System.Xml/AllTests.cs b/mcs/class/System.Data/Test/System.Xml/AllTests.cs
new file mode 100644
index 00000000000..faa01eaf5e5
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/AllTests.cs
@@ -0,0 +1,23 @@
+// Author:
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Copyright 2002 Ville Palo
+//
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.Xml
+{
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new TestSuite (typeof (XmlDataDocumentTest)));
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Xml/ChangeLog b/mcs/class/System.Data/Test/System.Xml/ChangeLog
new file mode 100644
index 00000000000..bdeb671458d
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/ChangeLog
@@ -0,0 +1,3 @@
+2003-01-13 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlDataDocumentTest.cs: Added more tests
diff --git a/mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest.cs b/mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest.cs
new file mode 100755
index 00000000000..c9efe56e52a
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest.cs
@@ -0,0 +1,807 @@
+//
+// XmlDataDocumentTestTest.cs - NUnit Test Cases for XmlDataDocument
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Data;
+using System.Xml;
+using System.Xml.XPath;
+using System.IO;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System.Data.Xml
+{
+ public class XmlDataDocumentTest : TestCase {
+
+
+ public XmlDataDocumentTest() : base ("System.Xml.XmlDataDocument") {}
+ public XmlDataDocumentTest(string name) : base(name) {}
+
+ protected override void TearDown() {}
+
+ protected override void SetUp()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(XmlDataDocumentTest));
+ }
+ }
+
+ public void TestCloneNode ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+
+ XmlDataDocument doc2 = (XmlDataDocument)doc.CloneNode (false);
+
+ AssertEquals ("#I01", 0, doc2.ChildNodes.Count);
+ AssertEquals ("#I02", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", doc2.DataSet.GetXmlSchema ().Substring (0, 39));
+
+ doc2 = (XmlDataDocument)doc.CloneNode (true);
+
+ AssertEquals ("#I03", 2, doc2.ChildNodes.Count);
+ AssertEquals ("#I04", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", doc2.DataSet.GetXmlSchema ().Substring (0, 39));
+
+ doc.DataSet.Tables [0].Rows [0][0] = "64";
+
+ AssertEquals ("#I05", "1", doc2.DataSet.Tables [0].Rows [0][0].ToString ());
+ }
+
+ public void TestEditingXmlTree ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+
+ XmlElement Element = doc.GetElementFromRow (doc.DataSet.Tables [0].Rows [1]);
+ Element.FirstChild.InnerText = "64";
+ AssertEquals ("test#01", "64", doc.DataSet.Tables [0].Rows [1] [0]);
+
+ DataSet Set = new DataSet ();
+ Set.ReadXml ("System.Xml/region.xml");
+ doc = new XmlDataDocument (Set);
+
+ Element = doc.GetElementFromRow (doc.DataSet.Tables [0].Rows [1]);
+
+ try {
+ Element.FirstChild.InnerText = "64";
+ Fail ("test#02");
+ } catch (Exception e) {
+ AssertEquals ("test#03", typeof (InvalidOperationException), e.GetType ());
+ AssertEquals ("test#04", "Please set DataSet.EnforceConstraints == false before trying to edit XmlDataDocument using XML operations.", e.Message);
+ }
+
+ AssertEquals ("test#05", "2", doc.DataSet.Tables [0].Rows [1] [0]);
+
+ Set.EnforceConstraints = false;
+ Element.FirstChild.InnerText = "64";
+ AssertEquals ("test#06", "64", doc.DataSet.Tables [0].Rows [1] [0]);
+ }
+
+ public void TestEditingDataSet ()
+ {
+ XmlReader Reader = new XmlTextReader ("System.Xml/region.xml");
+ XmlDataDocument Doc = new XmlDataDocument ();
+ Doc.DataSet.ReadXml (Reader);
+ AssertEquals ("test#01", "Interactive", Reader.ReadState.ToString ());
+
+ DataSet Set = Doc.DataSet;
+ Set.Tables [0].Rows [1] [0] = "64";
+ AssertEquals ("test#02", "64", Doc.FirstChild.FirstChild.NextSibling.FirstChild.InnerText);
+ }
+
+ public void TestCreateElement1 ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+
+ XmlElement Element = doc.CreateElement ("prefix", "localname", "namespaceURI");
+ AssertEquals ("test#01", "prefix", Element.Prefix);
+ AssertEquals ("test#02", "localname", Element.LocalName);
+ AssertEquals ("test#03", "namespaceURI", Element.NamespaceURI);
+ doc.ImportNode (Element, false);
+
+ TextWriter text = new StringWriter ();
+
+ doc.Save(text);
+
+ string substring = "";
+ string TextString = text.ToString ();
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ //AssertEquals ("test#04", "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#05", "<Root>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#06", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("test#07", " <RegionID>1</RegionID>", substring);
+
+ for (int i = 0; i < 26; i++) {
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ }
+
+ substring = TextString.Substring (0, TextString.Length);
+ AssertEquals ("test#07", "</Root>", substring);
+ }
+
+ public void TestCreateElement2 ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+
+ XmlElement Element = doc.CreateElement ("ElementName");
+ AssertEquals ("test#01", "", Element.Prefix);
+ AssertEquals ("test#02", "ElementName", Element.LocalName);
+ AssertEquals ("test#03", "", Element.NamespaceURI);
+
+ Element = doc.CreateElement ("prefix:ElementName");
+ AssertEquals ("test#04", "prefix", Element.Prefix);
+ AssertEquals ("test#05", "ElementName", Element.LocalName);
+ AssertEquals ("test#06", "", Element.NamespaceURI);
+ }
+
+ public void TestCreateElement3 ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+
+ XmlElement Element = doc.CreateElement ("ElementName", "namespace");
+ AssertEquals ("test#01", "", Element.Prefix);
+ AssertEquals ("test#02", "ElementName", Element.LocalName);
+ AssertEquals ("test#03", "namespace", Element.NamespaceURI);
+
+ Element = doc.CreateElement ("prefix:ElementName", "namespace");
+ AssertEquals ("test#04", "prefix", Element.Prefix);
+ AssertEquals ("test#05", "ElementName", Element.LocalName);
+ AssertEquals ("test#06", "namespace", Element.NamespaceURI);
+ }
+
+ public void TestNavigator ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+
+ XPathNavigator Nav = doc.CreateNavigator ();
+
+ Nav.MoveToRoot ();
+ Nav.MoveToFirstChild ();
+
+ AssertEquals ("test#01", "Root", Nav.Name.ToString ());
+ AssertEquals ("test#02", "", Nav.NamespaceURI.ToString ());
+ AssertEquals ("test#03", "False", Nav.IsEmptyElement.ToString ());
+ AssertEquals ("test#04", "Element", Nav.NodeType.ToString ());
+ AssertEquals ("test#05", "", Nav.Prefix);
+
+ Nav.MoveToFirstChild ();
+ Nav.MoveToNext ();
+ AssertEquals ("test#06", "Region", Nav.Name.ToString ());
+
+ AssertEquals ("test#07", "2Western", Nav.Value.Substring(0, Nav.Value.IndexOf ("\n") - 1));
+ Nav.MoveToFirstChild ();
+ AssertEquals ("test#08", "2", Nav.Value);
+ Nav.MoveToRoot ();
+ AssertEquals ("test#09", "Root", Nav.NodeType.ToString ());
+
+ }
+
+ // Test constructor
+ public void Test1()
+ {
+
+ //Create an XmlDataDocument.
+ XmlDataDocument doc = new XmlDataDocument();
+
+ //Load the schema file.
+ doc.DataSet.ReadXmlSchema("System.Xml/store.xsd");
+
+ //Load the XML data.
+ doc.Load("System.Xml/2books.xml");
+
+ //Update the price on the first book using the DataSet methods.
+ DataTable books = doc.DataSet.Tables["book"];
+ books.Rows[0]["price"] = "12,95";
+
+ //string outstring = "";
+ TextWriter text = new StringWriter ();
+ doc.Save(text);
+
+ //str.Read (bytes, 0, (int)str.Length);
+ //String OutString = new String (bytes);
+
+ string TextString = text.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A01", "<?xml version=\"1.0\" encoding=\"utf-16\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A02", "<!--sample XML fragment-->", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A03", "<bookstore>", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A04", " <book genre=\"novel\" ISBN=\"10-861003-324\">", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A05", " <title>The Handmaid's Tale</title>", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A06", " <price>12.95</price>", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A07", " </book>", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A08", " <book genre=\"novel\" ISBN=\"1-861001-57-5\">", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A09", " <title>Pride And Prejudice</title>", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A10", " <price>24.95</price>", substring);
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#A11", " </book>", substring);
+ substring = TextString;
+ AssertEquals ("#A12", "</bookstore>", substring);
+
+ }
+
+ // Test public fields
+ public void Test2()
+ {
+ DataSet RegionDS = new DataSet ();
+ DataRow RegionRow;
+ RegionDS.ReadXmlSchema ("System.Xml/region.xsd");
+ XmlDataDocument DataDoc = new XmlDataDocument (RegionDS);
+ DataDoc.Load("System.Xml/region.xml" );
+
+
+ RegionRow = RegionDS.Tables[0].Rows[0];
+
+ RegionDS.AcceptChanges ();
+ RegionRow["RegionDescription"] = "Reeeeeaalllly Far East!";
+ RegionDS.AcceptChanges ();
+
+ TextWriter text = new StringWriter ();
+
+ DataDoc.Save (text);
+ string TextString = text.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+
+ //AssertEquals ("#B01", "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B02", "<Root>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B03", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B04", " <RegionID>1</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B05", " <RegionDescription>Reeeeeaalllly Far East!</RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B06", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B07", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B08", " <RegionID>2</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B09", " <RegionDescription>Western", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B10", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B11", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B12", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B13", " <RegionID>3</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B14", " <RegionDescription>Northern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B15", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B16", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B17", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B18", " <RegionID>4</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B19", " <RegionDescription>Southern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B20", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B21", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B22", " <MoreData>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B23", " <Column1>12</Column1>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B24", " <Column2>Hi There</Column2>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B25", " </MoreData>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B26", " <MoreData>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B27", " <Column1>12</Column1>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B28", " <Column2>Hi There</Column2>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#B29", " </MoreData>", substring);
+ }
+
+ public void Test3()
+ {
+ XmlDataDocument DataDoc = new XmlDataDocument ();
+ DataSet dataset = DataDoc.DataSet;
+ dataset.ReadXmlSchema ("System.Xml/region.xsd");
+ DataDoc.Load("System.Xml/region.xml" );
+
+ DataDoc.GetElementsByTagName ("Region") [0].RemoveAll ();
+
+ TextWriter text = new StringWriter ();
+ dataset.WriteXml (text);
+ //DataDoc.Save (text);
+ string TextString = text.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+
+ AssertEquals ("#C01", "<Root>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C02", " <Region />", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C03", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C04", " <RegionID>2</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C05", " <RegionDescription>Western", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C06", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C07", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C08", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C09", " <RegionID>3</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C10", " <RegionDescription>Northern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C11", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C12", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C13", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C14", " <RegionID>4</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C15", " <RegionDescription>Southern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C16", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#C17", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.Length);
+ AssertEquals ("#C18", "</Root>", substring);
+
+ }
+
+
+ public void Test4 ()
+ {
+ DataSet RegionDS = new DataSet ();
+
+ RegionDS.ReadXmlSchema ("System.Xml/region.xsd");
+ XmlDataDocument DataDoc = new XmlDataDocument (RegionDS);
+ DataDoc.Load("System.Xml/region.xml" );
+ DataTable table = DataDoc.DataSet.Tables ["Region"];
+ DataRow newRow = table.NewRow ();
+ newRow [0] = "new row";
+ newRow [1] = "new description";
+ table.Rows.Add (newRow);
+
+ TextWriter text = new StringWriter ();
+
+ DataDoc.Save (text);
+ string TextString = text.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+
+ //AssertEquals ("#F01", "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F02", "<Root>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F03", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F04", " <RegionID>1</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F05", " <RegionDescription>Eastern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F06", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F07", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F08", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F09", " <RegionID>2</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F10", " <RegionDescription>Western", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F11", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F12", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F13", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F14", " <RegionID>3</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F15", " <RegionDescription>Northern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F16", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F17", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F18", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F19", " <RegionID>4</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F20", " <RegionDescription>Southern", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F21", " </RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F22", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F23", " <MoreData>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F24", " <Column1>12</Column1>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F25", " <Column2>Hi There</Column2>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F26", " </MoreData>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F27", " <MoreData>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F28", " <Column1>12</Column1>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F29", " <Column2>Hi There</Column2>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F30", " </MoreData>", substring);
+
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F31", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F32", " <RegionID>new row</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F33", " <RegionDescription>new description</RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#F34", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.Length);
+ AssertEquals ("#F35", "</Root>", substring);
+
+ }
+
+ public void Test5 ()
+ {
+ DataSet RegionDS = new DataSet ();
+
+ RegionDS.ReadXmlSchema ("System.Xml/region.xsd");
+ XmlDataDocument DataDoc = new XmlDataDocument (RegionDS);
+ DataDoc.Load("System.Xml/region.xml" );
+ try {
+ DataDoc.DocumentElement.AppendChild (DataDoc.DocumentElement.FirstChild);
+ Fail ("#G01");
+ } catch (Exception e) {
+ AssertEquals ("#G02", typeof (InvalidOperationException), e.GetType ());
+ AssertEquals ("#G03", "Please set DataSet.EnforceConstraints == false before trying to edit " +
+ "XmlDataDocument using XML operations.", e.Message);
+ DataDoc.DataSet.EnforceConstraints = false;
+ }
+ XmlElement newNode = DataDoc.CreateElement ("Region");
+ XmlElement newChildNode = DataDoc.CreateElement ("RegionID");
+ newChildNode.InnerText = "64";
+ XmlElement newChildNode2 = DataDoc.CreateElement ("RegionDescription");
+ newChildNode2.InnerText = "test node";
+ newNode.AppendChild (newChildNode);
+ newNode.AppendChild (newChildNode2);
+ DataDoc.DocumentElement.AppendChild (newNode);
+ TextWriter text = new StringWriter ();
+
+ //DataDoc.Save (text);
+ DataDoc.DataSet.WriteXml(text);
+ string TextString = text.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+
+ for (int i = 0; i < 21; i++) {
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ }
+ AssertEquals ("#G04", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#G05", " <RegionID>64</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#G06", " <RegionDescription>test node</RegionDescription>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#G07", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.Length);
+ AssertEquals ("#G08", "</Root>", substring);
+
+ }
+
+ public void Test6 ()
+ {
+ DataSet RegionDS = new DataSet ();
+
+ RegionDS.ReadXmlSchema ("System.Xml/region.xsd");
+ XmlDataDocument DataDoc = new XmlDataDocument (RegionDS);
+ DataDoc.Load("System.Xml/region.xml" );
+ DataDoc.DataSet.EnforceConstraints = false;
+
+ XmlElement newNode = DataDoc.CreateElement ("Region");
+ XmlElement newChildNode = DataDoc.CreateElement ("RegionID");
+ newChildNode.InnerText = "64";
+ XmlElement newChildNode2 = null;
+ try {
+ newChildNode2 = DataDoc.CreateElement ("something else");
+ Fail ("#H01");
+ } catch (Exception e) {
+ AssertEquals ("#H02", typeof (XmlException), e.GetType ());
+ newChildNode2 = DataDoc.CreateElement ("something_else");
+ }
+
+ newChildNode2.InnerText = "test node";
+ newNode.AppendChild (newChildNode);
+ newNode.AppendChild (newChildNode2);
+ DataDoc.DocumentElement.AppendChild (newNode);
+
+ TextWriter text = new StringWriter ();
+
+ //DataDoc.Save (text);
+ DataDoc.DataSet.WriteXml(text);
+ string TextString = text.ToString ();
+ string substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+
+ for (int i = 0; i < 21; i++) {
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ }
+
+ AssertEquals ("#H03", " <Region>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#H04", " <RegionID>64</RegionID>", substring);
+
+ substring = TextString.Substring (0, TextString.IndexOf("\n") - 1);
+ TextString = TextString.Substring (TextString.IndexOf("\n") + 1);
+ AssertEquals ("#H05", " </Region>", substring);
+
+ substring = TextString.Substring (0, TextString.Length);
+ AssertEquals ("#H06", "</Root>", substring);
+
+ }
+
+ public void TestGetElementFromRow ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+ DataTable table = doc.DataSet.Tables ["Region"];
+
+ XmlElement element = doc.GetElementFromRow (table.Rows [2]);
+ AssertEquals ("#D01", "Region", element.Name);
+ AssertEquals ("#D02", "3", element ["RegionID"].InnerText);
+
+ try {
+ element = doc.GetElementFromRow (table.Rows [4]);
+ Fail ("#D03");
+ } catch (Exception e) {
+ AssertEquals ("#D04", typeof (IndexOutOfRangeException), e.GetType ());
+ AssertEquals ("#D05", "There is no row at position 4.", e.Message);
+ }
+ }
+
+ public void TestGetRowFromElement ()
+ {
+ XmlDataDocument doc = new XmlDataDocument ();
+ doc.DataSet.ReadXmlSchema ("System.Xml/region.xsd");
+ doc.Load ("System.Xml/region.xml");
+ XmlElement root = doc.DocumentElement;
+
+ DataRow row = doc.GetRowFromElement((XmlElement)root.FirstChild);
+
+ AssertEquals ("#E01", "1", row [0]);
+
+ row = doc.GetRowFromElement((XmlElement)root.ChildNodes [2]);
+ AssertEquals ("#E02", "3", row [0]);
+
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/System.Xml/region.xml b/mcs/class/System.Data/Test/System.Xml/region.xml
new file mode 100755
index 00000000000..51c7a70fc28
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/region.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" standalone="yes"?>
+<Root>
+ <Region>
+ <RegionID>1</RegionID>
+ <RegionDescription>Eastern
+ </RegionDescription>
+ </Region>
+ <Region>
+ <RegionID>2</RegionID>
+ <RegionDescription>Western
+ </RegionDescription>
+ </Region>
+ <Region>
+ <RegionID>3</RegionID>
+ <RegionDescription>Northern
+ </RegionDescription>
+ </Region>
+ <Region>
+ <RegionID>4</RegionID>
+ <RegionDescription>Southern
+ </RegionDescription>
+ </Region>
+ <MoreData>
+ <Column1>12</Column1>
+ <Column2>Hi There</Column2>
+ </MoreData>
+ <MoreData>
+ <Column1>12</Column1>
+ <Column2>Hi There</Column2>
+ </MoreData>
+</Root>
diff --git a/mcs/class/System.Data/Test/System.Xml/region.xsd b/mcs/class/System.Data/Test/System.Xml/region.xsd
new file mode 100755
index 00000000000..fee8a8182a6
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/region.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" standalone="yes"?>
+<xsd:schema id="Root" xmlns=""
+xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-
+com:xml-msdata">
+ <xsd:element name="Root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="Region">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="RegionID" type="xsd:string"
+ minOccurs="0" />
+ <xsd:element name="RegionDescription" type="xsd:string"
+ minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
diff --git a/mcs/class/System.Data/Test/System.Xml/store.xsd b/mcs/class/System.Data/Test/System.Xml/store.xsd
new file mode 100755
index 00000000000..ab2bcd3d1ce
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Xml/store.xsd
@@ -0,0 +1,27 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:complexType name="bookstoreType">
+ <xsd:sequence maxOccurs="unbounded">
+ <xsd:element name="book" type="bookType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="bookType">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string"/>
+ <xsd:element name="author" type="authorName"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ </xsd:sequence>
+ <xsd:attribute name="genre" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="authorName">
+ <xsd:sequence>
+ <xsd:element name="first-name" type="xsd:string"/>
+ <xsd:element name="last-name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="bookstore" type="bookstoreType"/>
+
+</xsd:schema>
diff --git a/mcs/class/System.Data/Test/TestExecuteScalar.cs b/mcs/class/System.Data/Test/TestExecuteScalar.cs
new file mode 100644
index 00000000000..e350a3c61c5
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestExecuteScalar.cs
@@ -0,0 +1,149 @@
+//
+// Test/ExecuteScalar.cs
+//
+// Test the ExecuteScalar method in the
+// System.Data.SqlClient.SqlCommand class
+//
+// ExecuteScalar is meant to be lightweight
+// compared to ExecuteReader and only
+// returns one column and one row as one object.
+//
+// It is meant for SELECT SQL statements that
+// use an aggregate/group by function, such as,
+// count(), sum(), avg(), min(), max(), etc...
+//
+// The object that is returned you do an
+// explicit cast. For instance, to retrieve a
+// Count of rows in a PostgreSQL table, you
+// would use "SELECT COUNT(*) FROM SOMETABLE"
+// which returns a number of oid type 20 which is
+// a PostgreSQL int8 which maps to
+// the .NET type System.Int64. You
+// have to explicitly convert this returned object
+// to the type you are expecting, such as, an Int64
+// is returned for a COUNT().
+// would be:
+// Int64 myCount = (Int64) cmd.ExecuteScalar(selectStatement);
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C) 2002 Daniel Morgan
+//
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace TestSystemDataSqlClient
+{
+ class TestSqlDataReader
+ {
+
+ static void Test() {
+ SqlConnection con = null;
+ SqlCommand cmd = null;
+
+ String connectionString = null;
+ String sql = null;
+
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=postgres";
+
+ try {
+ string maxStrValue;
+
+ con = new SqlConnection(connectionString);
+ con.Open();
+
+ // test SQL Query for an aggregate count(*)
+ sql = "select count(*) " +
+ "from sometable";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ Int64 rowCount = (Int64) cmd.ExecuteScalar();
+ Console.WriteLine("Row Count: " + rowCount);
+
+ // test SQL Query for an aggregate min(text)
+ sql = "select max(tdesc) " +
+ "from sometable";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ string minValue = (string) cmd.ExecuteScalar();
+ Console.WriteLine("Max Value: " + minValue);
+
+ // test SQL Query for an aggregate max(text)
+ sql = "select min(tdesc) " +
+ "from sometable";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ maxStrValue = (string) cmd.ExecuteScalar();
+ Console.WriteLine("Max Value: " + maxStrValue);
+
+ // test SQL Query for an aggregate max(int)
+ sql = "select min(aint4) " +
+ "from sometable";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ int maxIntValue = (int) cmd.ExecuteScalar();
+ Console.WriteLine("Max Value: " + maxIntValue.ToString());
+
+ // test SQL Query for an aggregate avg(int)
+ sql = "select avg(aint4) " +
+ "from sometable";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ decimal avgDecValue = (decimal) cmd.ExecuteScalar();
+ Console.WriteLine("Max Value: " + avgDecValue.ToString());
+
+ // test SQL Query for an aggregate sum(int)
+ sql = "select sum(aint4) " +
+ "from sometable";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ Int64 summed = (Int64) cmd.ExecuteScalar();
+ Console.WriteLine("Max Value: " + summed);
+
+ // test a SQL Command is (INSERT, UPDATE, DELETE)
+ sql = "insert into sometable " +
+ "(tid,tdesc,aint4,atimestamp) " +
+ "values('qqq','www',234,NULL)";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ object objResult1 = cmd.ExecuteScalar();
+ if(objResult1 == null)
+ Console.WriteLine("Result is null. (correct)");
+ else
+ Console.WriteLine("Result is not null. (not correct)");
+
+ // test a SQL Command is not (INSERT, UPDATE, DELETE)
+ sql = "SET DATESTYLE TO 'ISO'";
+ cmd = new SqlCommand(sql,con);
+ Console.WriteLine("Executing: " + sql);
+ object objResult2 = cmd.ExecuteScalar();
+ if(objResult2 == null)
+ Console.WriteLine("Result is null. (correct)");
+ else
+ Console.WriteLine("Result is not null. (not correct)");
+
+ }
+ catch(Exception e) {
+ Console.WriteLine(e.ToString());
+ }
+ finally {
+ if(con != null)
+ if(con.State == ConnectionState.Open)
+ con.Close();
+ }
+ }
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Test();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/Test/TestSqlDataAdapter.cs b/mcs/class/System.Data/Test/TestSqlDataAdapter.cs
new file mode 100644
index 00000000000..37c5ff78bf5
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestSqlDataAdapter.cs
@@ -0,0 +1,66 @@
+//
+// TestPgSqlDataAdapter - tests PgSqlDataAdapter, DbDataAdapter, DataSet, DataTable,
+// DataRow, and DataRowCollection by retrieving data
+//
+// Authors:
+// Tim Coleman <tim@timcoleman.com>
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Tim Coleman
+// (c)copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.Data;
+using Mono.Data.PostgreSqlClient;
+
+namespace TestSystemDataPgSqlClient
+{
+ public class TestPgSqlDataAdapter
+ {
+ public static void Test()
+ {
+ string connectionString;
+ string sqlQuery;
+ PgSqlDataAdapter adapter;
+ DataSet dataSet = null;
+
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=postgres";
+
+ sqlQuery = "select * from pg_tables";
+
+ System.Console.WriteLine ("new PgSqlDataAdapter...");
+ adapter = new PgSqlDataAdapter (sqlQuery,
+ connectionString);
+
+ System.Console.WriteLine ("new DataSet...");
+ dataSet = new DataSet ();
+
+ try {
+ System.Console.WriteLine("Fill...");
+ adapter.Fill (dataSet);
+
+ }
+ catch (NotImplementedException e) {
+ Console.WriteLine("Exception Caught: " + e);
+ }
+
+ System.Console.WriteLine ("get row...");
+ if (dataSet != null) {
+ foreach (DataRow row in dataSet.Tables["Table"].Rows)
+ Console.WriteLine("tablename: " + row["tablename"]);
+ System.Console.WriteLine("Done.");
+ }
+
+ }
+
+ public static void Main()
+ {
+ Test();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/TestSqlDataReader.cs b/mcs/class/System.Data/Test/TestSqlDataReader.cs
new file mode 100644
index 00000000000..626fd23ef76
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestSqlDataReader.cs
@@ -0,0 +1,181 @@
+//
+// Test/SqlDataReader.cs - to test Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
+//
+// Test to do read a simple forward read only record set.
+// Using PgSqlCommand.ExecuteReader() to return a PgSqlDataReader
+// which can be used to Read a row
+// and Get a String or Int32.
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (C) 2002 Daniel Morgan
+//
+
+using System;
+using System.Data;
+using Mono.Data.PostgreSqlClient;
+
+namespace Test.Mono.Data.PostgreSqlClient {
+ class TestPgSqlDataReader {
+
+ static void Test(PgSqlConnection con, string sql,
+ CommandType cmdType, CommandBehavior behavior,
+ string testDesc)
+ {
+ PgSqlCommand cmd = null;
+ PgSqlDataReader rdr = null;
+
+ int c;
+ int results = 0;
+
+ Console.WriteLine("Test: " + testDesc);
+ Console.WriteLine("[BEGIN SQL]");
+ Console.WriteLine(sql);
+ Console.WriteLine("[END SQL]");
+
+ cmd = new PgSqlCommand(sql, con);
+ cmd.CommandType = cmdType;
+
+ Console.WriteLine("ExecuteReader...");
+ rdr = cmd.ExecuteReader(behavior);
+
+ if(rdr == null) {
+
+ Console.WriteLine("IDataReader has a Null Reference.");
+ }
+ else {
+
+ do {
+ // get the DataTable that holds
+ // the schema
+ DataTable dt = rdr.GetSchemaTable();
+
+ if(rdr.RecordsAffected != -1) {
+ // Results for
+ // SQL INSERT, UPDATE, DELETE Commands
+ // have RecordsAffected >= 0
+ Console.WriteLine("Result is from a SQL Command (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ }
+ else if (dt == null)
+ Console.WriteLine("Result is from a SQL Command not (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
+ else {
+ // Results for
+ // SQL not INSERT, UPDATE, nor DELETE
+ // have RecordsAffected = -1
+ Console.WriteLine("Result is from a SQL SELECT Query. Records Affected: " + rdr.RecordsAffected);
+
+ // Results for a SQL Command (CREATE TABLE, SET, etc)
+ // will have a null reference returned from GetSchemaTable()
+ //
+ // Results for a SQL SELECT Query
+ // will have a DataTable returned from GetSchemaTable()
+
+ results++;
+ Console.WriteLine("Result Set " + results + "...");
+
+ // number of columns in the table
+ Console.WriteLine(" Total Columns: " +
+ dt.Columns.Count);
+
+ // display the schema
+ foreach (DataRow schemaRow in dt.Rows) {
+ foreach (DataColumn schemaCol in dt.Columns)
+ Console.WriteLine(schemaCol.ColumnName +
+ " = " +
+ schemaRow[schemaCol]);
+ Console.WriteLine();
+ }
+
+ int nRows = 0;
+ string output, metadataValue, dataValue;
+ // Read and display the rows
+ Console.WriteLine("Gonna do a Read() now...");
+ while(rdr.Read()) {
+ Console.WriteLine(" Row " + nRows + ": ");
+
+ for(c = 0; c < rdr.FieldCount; c++) {
+ // column meta data
+ DataRow dr = dt.Rows[c];
+ metadataValue =
+ " Col " +
+ c + ": " +
+ dr["ColumnName"];
+
+ // column data
+ if(rdr.IsDBNull(c) == true)
+ dataValue = " is NULL";
+ else
+ dataValue =
+ ": " +
+ rdr.GetValue(c);
+
+ // display column meta data and data
+ output = metadataValue + dataValue;
+ Console.WriteLine(output);
+ }
+ nRows++;
+ }
+ Console.WriteLine(" Total Rows: " +
+ nRows);
+ }
+ } while(rdr.NextResult());
+ Console.WriteLine("Total Result sets: " + results);
+
+ rdr.Close();
+ }
+
+ }
+
+ [STAThread]
+ static void Main(string[] args) {
+ String connectionString = null;
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=postgres";
+
+ PgSqlConnection con;
+ con = new PgSqlConnection(connectionString);
+ con.Open();
+
+ string sql;
+
+ // Text - only has one query (single query behavior)
+ sql = "select * from pg_tables";
+ Test(con, sql, CommandType.Text,
+ CommandBehavior.SingleResult, "Text1");
+
+ // Text - only has one query (default behavior)
+ sql = "select * from pg_tables";
+ Test(con, sql, CommandType.Text,
+ CommandBehavior.Default, "Text2");
+
+ // Text - has three queries
+ sql =
+ "select * from pg_user;" +
+ "select * from pg_tables;" +
+ "select * from pg_database";
+ Test(con, sql, CommandType.Text,
+ CommandBehavior.Default, "Text3Queries");
+
+ // Table Direct
+ sql = "pg_tables";
+ Test(con, sql, CommandType.TableDirect,
+ CommandBehavior.Default, "TableDirect1");
+
+ // Stored Procedure
+ sql = "version";
+ Test(con, sql, CommandType.StoredProcedure,
+ CommandBehavior.Default, "SP1");
+
+ // Text - test a SQL Command (default behavior)
+ // Note: this not a SQL Query
+ sql = "SET DATESTYLE TO 'ISO'";
+ Test(con, sql, CommandType.Text,
+ CommandBehavior.Default, "TextCmd1");
+
+ con.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/TestSqlParameters.cs b/mcs/class/System.Data/Test/TestSqlParameters.cs
new file mode 100644
index 00000000000..92b680e4b65
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestSqlParameters.cs
@@ -0,0 +1,127 @@
+//
+// TestSqlParameters.cs - test parameters for the PostgreSQL .NET Data Provider in Mono
+// using PgSqlParameter and PgSqlParameterCollection
+//
+// Note: it currently only tests input parameters. Output is next on the list.
+// Then output/input and return parameters.
+//
+// Author:
+// Daniel Morgan <danmorg@sc.rr.com>
+//
+// (c)copyright 2002 Daniel Morgan
+//
+
+using System;
+using System.Collections;
+using System.Data;
+using Mono.Data.PostgreSqlClient;
+
+namespace TestSystemDataPgSqlClient {
+
+ public class TestParameters {
+ public static void Main() {
+ Console.WriteLine("** Start Test...");
+
+ String connectionString = null;
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=postgres";
+
+ PgSqlConnection con;
+ Console.WriteLine("** Creating connection...");
+ con = new PgSqlConnection(connectionString);
+ Console.WriteLine("** opening connection...");
+ con.Open();
+
+ string tableName = "pg_type";
+
+ string sql;
+ sql = "SELECT * FROM PG_TABLES WHERE TABLENAME = :inTableName";
+
+ Console.WriteLine("** Creating command...");
+ PgSqlCommand cmd = new PgSqlCommand(sql, con);
+
+ // add parameter for inTableName
+ Console.WriteLine("** Create parameter...");
+ PgSqlParameter parm = new PgSqlParameter("inTableName", DbType.String);
+
+ Console.WriteLine("** set dbtype of parameter to string");
+ parm.DbType = DbType.String;
+
+ Console.WriteLine("** set direction of parameter to input");
+ parm.Direction = ParameterDirection.Input;
+
+ Console.WriteLine("** set value to the tableName string...");
+ parm.Value = tableName;
+
+ Console.WriteLine("** add parameter to parameters collection in the command...");
+ cmd.Parameters.Add(parm);
+
+ PgSqlDataReader rdr;
+ Console.WriteLine("** ExecuteReader()...");
+
+ rdr = cmd.ExecuteReader();
+
+ Console.WriteLine("[][] And now we are going to our results [][]...");
+ int c;
+ int results = 0;
+ do {
+ results++;
+ Console.WriteLine("Result Set " + results + "...");
+
+ // get the DataTable that holds
+ // the schema
+ DataTable dt = rdr.GetSchemaTable();
+
+ // number of columns in the table
+ Console.WriteLine(" Total Columns: " +
+ dt.Columns.Count);
+
+ // display the schema
+ foreach (DataRow schemaRow in dt.Rows) {
+ foreach (DataColumn schemaCol in dt.Columns)
+ Console.WriteLine(schemaCol.ColumnName +
+ " = " +
+ schemaRow[schemaCol]);
+ Console.WriteLine();
+ }
+
+ string output, metadataValue, dataValue;
+ int nRows = 0;
+
+ // Read and display the rows
+ while(rdr.Read()) {
+ Console.WriteLine(" Row " + nRows + ": ");
+
+ for(c = 0; c < rdr.FieldCount; c++) {
+ // column meta data
+ DataRow dr = dt.Rows[c];
+ metadataValue =
+ " Col " +
+ c + ": " +
+ dr["ColumnName"];
+
+ // column data
+ if(rdr.IsDBNull(c) == true)
+ dataValue = " is NULL";
+ else
+ dataValue =
+ ": " +
+ rdr.GetValue(c);
+
+ // display column meta data and data
+ output = metadataValue + dataValue;
+ Console.WriteLine(output);
+ }
+ nRows++;
+ }
+ Console.WriteLine(" Total Rows: " +
+ nRows);
+ } while(rdr.NextResult());
+ Console.WriteLine("Total Result sets: " + results);
+
+ con.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/TheTests.cs b/mcs/class/System.Data/Test/TheTests.cs
new file mode 100644
index 00000000000..c69aedfe873
--- /dev/null
+++ b/mcs/class/System.Data/Test/TheTests.cs
@@ -0,0 +1,78 @@
+// Author: Tim Coleman (tim@timcoleman.com)
+// (C) Copyright 2002 Tim Coleman
+
+
+using NUnit.Framework;
+using System;
+using System.Data;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System.Data
+{
+ public class RunDataColumnTest : DataColumnTest
+ {
+ protected override void RunTest ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
+namespace MonoTests.System.Data.SqlTypes
+{
+ public class RunSqlInt32Test : SqlInt32Test
+ {
+ protected override void RunTest ()
+ {
+ TestCreate ();
+
+ // property tests
+
+ TestIsNullProperty ();
+
+ // method tests
+
+ TestAdd ();
+ TestBitwiseAnd ();
+ TestBitwiseOr ();
+ TestDivide ();
+ TestEquals ();
+ TestGreaterThan ();
+ TestGreaterThanOrEqual ();
+ TestLessThan ();
+ TestLessThanOrEqual ();
+ TestMod ();
+ TestMultiply ();
+ TestNotEquals ();
+ TestOnesComplement ();
+ TestSubtract ();
+ TestConversionMethods ();
+ TestXor ();
+ }
+ }
+}
+
+namespace MonoTests
+{
+ public class RunAllTests
+ {
+ public static void AddAllTests (TestSuite suite)
+ {
+ suite.AddTest (new MonoTests.System.Data.RunDataColumnTest ());
+ suite.AddTest (new MonoTests.System.Data.SqlTypes.RunSqlInt32Test ());
+ }
+ }
+}
+
+class MainApp
+{
+ public static void Main ()
+ {
+ TestResult result = new TestResult ();
+ TestSuite suite = new TestSuite ();
+ MonoTests.RunAllTests.AddAllTests (suite);
+ suite.Run (result);
+ MonoTests.MyTestRunner.Print (result);
+ }
+}
diff --git a/mcs/class/System.Data/Test/data_linux_test.args b/mcs/class/System.Data/Test/data_linux_test.args
new file mode 100644
index 00000000000..bc6b12ba4ae
--- /dev/null
+++ b/mcs/class/System.Data/Test/data_linux_test.args
@@ -0,0 +1,35 @@
+--target library
+-o data_linux_test.dll
+--noconfig
+-r ../../lib/System.Data.dll
+-r ../../lib/System.dll
+-r ../../../nunit/NUnitCore_mono.dll
+System.Data.SqlTypes/AllTests.cs
+System.Data.SqlTypes/SqlBinaryTest.cs
+System.Data.SqlTypes/SqlBooleanTest.cs
+System.Data.SqlTypes/SqlByteTest.cs
+System.Data.SqlTypes/SqlDoubleTest.cs
+System.Data.SqlTypes/SqlInt16Test.cs
+System.Data.SqlTypes/SqlInt32Test.cs
+System.Data.SqlTypes/SqlInt64Test.cs
+System.Data.SqlTypes/SqlSingleTest.cs
+System.Data.SqlTypes/SqlMoneyTest.cs
+System.Data.SqlTypes/SqlDateTimeTest.cs
+System.Data.SqlTypes/SqlGuidTest.cs
+System.Data.SqlTypes/SqlDecimalTest.cs
+System.Data.SqlTypes/SqlStringTest.cs
+System.Xml/AllTests.cs
+System.Xml/XmlDataDocumentTest.cs
+System.Data/AllTests.cs
+System.Data/DataColumnTest.cs
+System.Data/UniqueConstraintTest.cs
+System.Data/ConstraintTest.cs
+System.Data/ConstraintCollectionTest.cs
+System.Data/ForeignKeyConstraintTest.cs
+System.Data/DataTableTest.cs
+System.Data/DataRowCollectionTest.cs
+System.Data/DataRowTest.cs
+System.Data/DataColumnCollectionTest.cs
+System.Data/DataSetTest.cs
+System.Data/DataRelationTest.cs
+AllTests.cs
diff --git a/mcs/class/System.Data/Test/makefile.gnu b/mcs/class/System.Data/Test/makefile.gnu
new file mode 100644
index 00000000000..c8783d8fe7a
--- /dev/null
+++ b/mcs/class/System.Data/Test/makefile.gnu
@@ -0,0 +1,29 @@
+topdir = ../../..
+
+LIBRARY = data_linux_test.dll
+
+LIB_LIST = data_linux_test.args
+LIB_FLAGS = \
+ -r $(topdir)/class/lib/corlib.dll \
+ -r $(topdir)/class/lib/System.Data.dll \
+ -r $(topdir)/class/lib/System.Xml.dll \
+ -r $(topdir)/class/lib/System.dll \
+ -r $(topdir)/class/lib/NUnitCore_mono.dll
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=_DUMMY_
+
+include $(topdir)/class/library.make
+
+MCS_FLAGS = --target library --noconfig
+
+TEST_SUITE_PREFIX = MonoTests.
+TEST_SUITE = AllTests
+NUNITCONSOLE=$(topdir)/class/lib/NUnitConsole_mono.exe
+
+test: $(LIBRARY) run_test
+
+.PHONY: run_test
+
+run_test:
+ MONO_PATH=$(NUNIT_MONO_PATH) mono $(NUNITCONSOLE) $(TEST_SUITE_PREFIX)$(TEST_SUITE),data_linux_test.dll
diff --git a/mcs/class/System.Data/list b/mcs/class/System.Data/list
new file mode 100755
index 00000000000..50dfa1eec24
--- /dev/null
+++ b/mcs/class/System.Data/list
@@ -0,0 +1,192 @@
+System.Data/AcceptRejectRule.cs
+System.Data/CommandBehavior.cs
+System.Data/CommandType.cs
+System.Data/ConnectionState.cs
+System.Data/Constraint.cs
+System.Data/ConstraintCollection.cs
+System.Data/ConstraintException.cs
+System.Data/DataCategoryAttribute.cs
+System.Data/DataColumn.cs
+System.Data/DataColumnChangeEventArgs.cs
+System.Data/DataColumnChangeEventHandler.cs
+System.Data/DataColumnCollection.cs
+System.Data/DataColumnPropertyDescriptor.cs
+System.Data/DataException.cs
+System.Data/DataRelation.cs
+System.Data/DataRelationCollection.cs
+System.Data/DataRow.cs
+System.Data/DataRowAction.cs
+System.Data/DataRowBuilder.cs
+System.Data/DataRowChangeEventArgs.cs
+System.Data/DataRowChangeEventHandler.cs
+System.Data/DataRowCollection.cs
+System.Data/DataRowState.cs
+System.Data/DataRowVersion.cs
+System.Data/DataRowView.cs
+System.Data/DataSet.cs
+System.Data/DataSysDescriptionAttribute.cs
+System.Data/DataTable.cs
+System.Data/DataTableCollection.cs
+System.Data/DataTablePropertyDescriptor.cs
+System.Data/DataView.cs
+System.Data/DataViewManager.cs
+System.Data/DataViewManagerListItemTypeDescriptor.cs
+System.Data/DataViewRowState.cs
+System.Data/DataViewSetting.cs
+System.Data/DataViewSettingCollection.cs
+System.Data/DBConcurrencyException.cs
+System.Data/DbType.cs
+System.Data/DeletedRowInaccessibleException.cs
+System.Data/DuplicateNameException.cs
+System.Data/EvaluateException.cs
+System.Data/FillErrorEventArgs.cs
+System.Data/FillErrorEventHandler.cs
+System.Data/ForeignKeyConstraint.cs
+System.Data/IColumnMapping.cs
+System.Data/IColumnMappingCollection.cs
+System.Data/IDataAdapter.cs
+System.Data/IDataParameter.cs
+System.Data/IDataParameterCollection.cs
+System.Data/IDataReader.cs
+System.Data/IDataRecord.cs
+System.Data/IDbCommand.cs
+System.Data/IDbConnection.cs
+System.Data/IDbDataAdapter.cs
+System.Data/IDbDataParameter.cs
+System.Data/IDbTransaction.cs
+System.Data/InRowChangingEventException.cs
+System.Data/InternalDataCollectionBase.cs
+System.Data/InvalidConstraintException.cs
+System.Data/InvalidExpressionException.cs
+System.Data/IsolationLevel.cs
+System.Data/ITableMapping.cs
+System.Data/ITableMappingCollection.cs
+System.Data/Locale.cs
+System.Data/MappingType.cs
+System.Data/MergeFailedEventArgs.cs
+System.Data/MergeFailedEventHandler.cs
+System.Data/MissingMappingAction.cs
+System.Data/MissingPrimaryKeyException.cs
+System.Data/MissingSchemaAction.cs
+System.Data/NoNullAllowedException.cs
+System.Data/ParameterDirection.cs
+System.Data/PropertyAttributes.cs
+System.Data/PropertyCollection.cs
+System.Data/ReadOnlyException.cs
+System.Data/ResDescriptionAttribute.cs
+System.Data/RowNotInTableException.cs
+System.Data/Rule.cs
+System.Data/SchemaType.cs
+System.Data/SqlDbType.cs
+System.Data/StateChangeEventArgs.cs
+System.Data/StateChangeEventHandler.cs
+System.Data/StatementType.cs
+System.Data/StrongTypingException.cs
+System.Data/SyntaxErrorException.cs
+System.Data/TODOAttribute.cs
+System.Data/TypeDataSetGeneratorException.cs
+System.Data/UniqueConstraint.cs
+System.Data/UpdateRowSource.cs
+System.Data/UpdateStatus.cs
+System.Data/VersionNotFoundException.cs
+System.Data/XmlReadMode.cs
+System.Data/XmlWriteMode.cs
+System.Data/XmlConstants.cs
+System.Data/XmlDiffLoader.cs
+System.Data.Common/DataAdapter.cs
+System.Data.Common/DataColumnMapping.cs
+System.Data.Common/DataColumnMappingCollection.cs
+System.Data.Common/DataTableMapping.cs
+System.Data.Common/DataTableMappingCollection.cs
+System.Data.Common/DbDataAdapter.cs
+System.Data.Common/DbDataPermission.cs
+System.Data.Common/DbDataPermissionAttribute.cs
+System.Data.Common/DbDataRecord.cs
+System.Data.Common/DbEnumerator.cs
+System.Data.Common/FieldNameLookup.cs
+System.Data.Common/RowUpdatedEventArgs.cs
+System.Data.Common/RowUpdatingEventArgs.cs
+System.Data.Common/SchemaInfo.cs
+System.Data.OleDb/libgda.cs
+System.Data.OleDb/OleDbCommand.cs
+System.Data.OleDb/OleDbCommandBuilder.cs
+System.Data.OleDb/OleDbConnection.cs
+System.Data.OleDb/OleDbDataAdapter.cs
+System.Data.OleDb/OleDbDataReader.cs
+System.Data.OleDb/OleDbError.cs
+System.Data.OleDb/OleDbErrorCollection.cs
+System.Data.OleDb/OleDbException.cs
+System.Data.OleDb/OleDbInfoMessageEventArgs.cs
+System.Data.OleDb/OleDbInfoMessageEventHandler.cs
+System.Data.OleDb/OleDbLiteral.cs
+System.Data.OleDb/OleDbParameter.cs
+System.Data.OleDb/OleDbParameterCollection.cs
+System.Data.OleDb/OleDbPermission.cs
+System.Data.OleDb/OleDbPermissionAttribute.cs
+System.Data.OleDb/OleDbRowUpdatedEventArgs.cs
+System.Data.OleDb/OleDbRowUpdatedEventHandler.cs
+System.Data.OleDb/OleDbRowUpdatingEventArgs.cs
+System.Data.OleDb/OleDbRowUpdatingEventHandler.cs
+System.Data.OleDb/OleDbSchemaGuid.cs
+System.Data.OleDb/OleDbTransaction.cs
+System.Data.OleDb/OleDbType.cs
+System.Data.SqlTypes/INullable.cs
+System.Data.SqlTypes/SqlBinary.cs
+System.Data.SqlTypes/SqlBoolean.cs
+System.Data.SqlTypes/SqlByte.cs
+System.Data.SqlTypes/SqlCompareOptions.cs
+System.Data.SqlTypes/SqlDateTime.cs
+System.Data.SqlTypes/SqlDecimal.cs
+System.Data.SqlTypes/SqlDouble.cs
+System.Data.SqlTypes/SqlGuid.cs
+System.Data.SqlTypes/SqlInt16.cs
+System.Data.SqlTypes/SqlInt32.cs
+System.Data.SqlTypes/SqlInt64.cs
+System.Data.SqlTypes/SqlMoney.cs
+System.Data.SqlTypes/SqlNullValueException.cs
+System.Data.SqlTypes/SqlSingle.cs
+System.Data.SqlTypes/SqlString.cs
+System.Data.SqlTypes/SqlTruncateException.cs
+System.Data.SqlTypes/SqlTypeException.cs
+System.Data.Odbc/OdbcColumn.cs
+System.Data.Odbc/OdbcCommand.cs
+System.Data.Odbc/OdbcConnection.cs
+System.Data.Odbc/OdbcDataReader.cs
+System.Data.Odbc/OdbcError.cs
+System.Data.Odbc/OdbcErrorCollection.cs
+System.Data.Odbc/OdbcException.cs
+System.Data.Odbc/OdbcParameter.cs
+System.Data.Odbc/OdbcParameterCollection.cs
+System.Data.Odbc/OdbcTransaction.cs
+System.Data.Odbc/OdbcType.cs
+System.Data.Odbc/libodbc.cs
+System.Data.Odbc/OdbcDataAdapter.cs
+System.Data.Odbc/OdbcRowUpdatedEventArgs.cs
+System.Data.Odbc/OdbcRowUpdatedEventHandler.cs
+System.Data.Odbc/OdbcRowUpdatingEventArgs.cs
+System.Data.Odbc/OdbcRowUpdatingEventHandler.cs
+System.Data.SqlClient/SqlClientPermission.cs
+System.Data.SqlClient/SqlClientPermissionAttribute.cs
+System.Data.SqlClient/SqlCommand.cs
+System.Data.SqlClient/SqlCommandBuilder.cs
+System.Data.SqlClient/SqlConnection.cs
+System.Data.SqlClient/SqlConnectionPool.cs
+System.Data.SqlClient/SqlDataAdapter.cs
+System.Data.SqlClient/SqlDataReader.cs
+System.Data.SqlClient/SqlError.cs
+System.Data.SqlClient/SqlErrorCollection.cs
+System.Data.SqlClient/SqlException.cs
+System.Data.SqlClient/SqlInfoMessageEventArgs.cs
+System.Data.SqlClient/SqlInfoMessageEventHandler.cs
+System.Data.SqlClient/SqlParameter.cs
+System.Data.SqlClient/SqlParameterCollection.cs
+System.Data.SqlClient/SqlParameterConverter.cs
+System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
+System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
+System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
+System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
+System.Data.SqlClient/SqlTransaction.cs
+System.Data.SqlClient/SqlXmlTextReader.cs
+System.Data/XmlDataLoader.cs
+System.Data/XmlSchemaMapper.cs
+System.Xml/XmlDataDocument.cs
diff --git a/mcs/class/System.Data/makefile.gnu b/mcs/class/System.Data/makefile.gnu
new file mode 100644
index 00000000000..2f22bfe39c9
--- /dev/null
+++ b/mcs/class/System.Data/makefile.gnu
@@ -0,0 +1,17 @@
+topdir = ../..
+
+TEST_DIR= Test
+LIBRARY = $(topdir)/class/lib/System.Data.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Xml -r System.EnterpriseServices -r Mono.Data.Tds
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ *TestGDA.cs \
+ ./System.Xml*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Design/.cvsignore b/mcs/class/System.Design/.cvsignore
new file mode 100755
index 00000000000..b90080cd7a9
--- /dev/null
+++ b/mcs/class/System.Design/.cvsignore
@@ -0,0 +1,4 @@
+makefile
+*~
+.*~
+System.Design.Test.build
diff --git a/mcs/class/System.Design/ChangeLog b/mcs/class/System.Design/ChangeLog
new file mode 100755
index 00000000000..b5aa9581c45
--- /dev/null
+++ b/mcs/class/System.Design/ChangeLog
@@ -0,0 +1,26 @@
+2002-12-11 Jeroen Janssen <japj@darius.demon.nl>
+
+ * removed set for RootDesignerSerializerAttribute.TypeId
+ * fixed .build file to include reference to System.dll
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * System.Web.UI.Design : Added directory.
+
+2002-12-09 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * System.Design : Added directory.
+
+2002-12-04 Alejandro Sánchez Acosta <raciel@gnome.org>
+
+ * System.ComponentModel.Design.Serialization: Added directory
+
+
+2002-10-07 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * System.Design.build : Bug fix. Attribute is "basedir"
+ and not "bardir".
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * System.Web.UI.Design.WebControls : Added directory.
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/Changelog b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/Changelog
new file mode 100644
index 00000000000..399e659b6d1
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/Changelog
@@ -0,0 +1,20 @@
+2002-12-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * *.cs - Use proper namespace for MonoTODO.
+
+2002-12-05 Alejandro Sánchez Acosta <raciel@gnome.org>
+
+ * CodeDomSerializer.cs,
+ IDesignerLoaderService.cs,
+ INameCreationService.cs,
+ ContextStack.cs,
+ IDesignerSerializationManager.cs,
+ ResolveNameEventArgs.cs,
+ ICodeDomDesignerReload.cs,
+ IDesignerSerializationProvider.cs,
+ ResolveNameEventHandler.cs,
+ IDesignerLoaderHost.cs,
+ IDesignerSerializationService.cs,
+ RootDesignerSerializerAttribute.cs: Added
+
+
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/CodeDomSerializer.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/CodeDomSerializer.cs
new file mode 100644
index 00000000000..4579d15200b
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/CodeDomSerializer.cs
@@ -0,0 +1,86 @@
+// System.ComponentModel.Design.Serialization.CodeDomSerializer.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.CodeDom;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public abstract class CodeDomSerializer
+ {
+ [MonoTODO]
+ protected CodeDomSerializer() {
+ throw new NotImplementedException ();
+ }
+
+ public abstract object Deserialize (IDesignerSerializationManager manager, object codeObject);
+
+ [MonoTODO]
+ protected void DeserializePropertiesFromResources (IDesignerSerializationManager manager, object value, Attribute[] filter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected object DeserializeExpression (IDesignerSerializationManager manager, string name, CodeExpression expression)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void DeserializeStatement (IDesignerSerializationManager manager, CodeStatement statement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract object Serialize (IDesignerSerializationManager manager, object value);
+
+ [MonoTODO]
+ protected void SerializeEvents (IDesignerSerializationManager manager, CodeStatementCollection statements, object value, Attribute[] filter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void SerializeProperties (IDesignerSerializationManager manager, CodeStatementCollection statements, object value, Attribute[] filter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void SerializePropertiesToResources (IDesignerSerializationManager manager, CodeStatementCollection statements, object value, Attribute[] filter)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ protected void SerializeResource (IDesignerSerializationManager manager, string resourceName, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void SerializeResourceInvariant (IDesignerSerializationManager manager, string resourceName, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected CodeExpression SerializeToExpression (IDesignerSerializationManager manager, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected CodeExpression SerializeToReferenceExpression (IDesignerSerializationManager manager, object value)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ContextStack.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ContextStack.cs
new file mode 100644
index 00000000000..291123969e9
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ContextStack.cs
@@ -0,0 +1,45 @@
+// System.ComponentModel.Design.Serialization.ContextStack.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public sealed class ContextStack
+ {
+ public ArrayList list;
+
+ public ContextStack () {
+ list = new ArrayList ();
+ }
+
+ public object Current {
+ get {
+ if (list.Count == 0) return null;
+ return list [list.Count - 1];
+ }
+
+ set {
+ list.Add (value);
+ }
+ }
+
+ [MonoTODO]
+ public object this[Type type] {
+ get { throw new NotImplementedException ();}
+ set { throw new NotImplementedException ();}
+ }
+
+ [MonoTODO]
+ public object this[int level] {
+ get { throw new NotImplementedException ();}
+ set { throw new NotImplementedException ();}
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ICodeDomDesignerReload.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ICodeDomDesignerReload.cs
new file mode 100644
index 00000000000..e894992ec2b
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ICodeDomDesignerReload.cs
@@ -0,0 +1,18 @@
+// System.ComponentModel.Design.Serialization.ICodeDomDesignerReload.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.CodeDom;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface ICodeDomDesignerReload
+ {
+ bool ShouldReloadDesigner (CodeCompileUnit newTree);
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderHost.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderHost.cs
new file mode 100644
index 00000000000..148f4be1ab8
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderHost.cs
@@ -0,0 +1,20 @@
+// System.ComponentModel.Design.Serialization.IDesignerLoaderHost.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface IDesignerLoaderHost : IDesignerHost, IServiceContainer, IServiceProvider
+ {
+ void EndLoad (string baseClassName, bool successful, ICollection errorCollection);
+
+ void Reload();
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderService.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderService.cs
new file mode 100644
index 00000000000..907c0db563a
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerLoaderService.cs
@@ -0,0 +1,22 @@
+// System.ComponentModel.Design.Serialization.IDesignerLoaderService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface IDesignerLoaderService
+ {
+ void AddLoadDependency();
+
+ void DependentLoadComplete (bool successful, ICollection errorCollection);
+
+ bool Reload();
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationManager.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationManager.cs
new file mode 100644
index 00000000000..3244a2e234a
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationManager.cs
@@ -0,0 +1,42 @@
+// System.ComponentModel.Design.Serialization.IDesignerSerializationManager.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface IDesignerSerializationManager : IServiceProvider
+ {
+ ContextStack Context {get;}
+
+ PropertyDescriptorCollection Properties {get;}
+
+ void AddSerializationProvider (IDesignerSerializationProvider provider);
+
+ object CreateInstance (Type type, ICollection arguments, string name, bool addToContainer);
+
+ object GetInstance (string name);
+
+ string GetName (object value);
+
+ object GetSerializer (Type objectType, Type serializerType);
+
+ Type GetType (string typeName);
+
+ void RemoveSerializationProvider (IDesignerSerializationProvider provider);
+
+ void ReportError (object errorInformation);
+
+ void SetName (object instance, string name);
+
+ event ResolveNameEventHandler ResolveName;
+
+ event EventHandler SerializationComplete;
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationProvider.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationProvider.cs
new file mode 100644
index 00000000000..c793424a607
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationProvider.cs
@@ -0,0 +1,17 @@
+// System.ComponentModel.Design.Serialization.IDesignerSerializationProvider.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface IDesignerSerializationProvider
+ {
+ object GetSerializer (IDesignerSerializationManager manager, object currentSerializer, Type objectType, Type serializerType);
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationService.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationService.cs
new file mode 100644
index 00000000000..de6b25c7264
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/IDesignerSerializationService.cs
@@ -0,0 +1,20 @@
+// System.ComponentModel.Design.Serialization.IDesignerSerializationService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface IDesignerSerializationService
+ {
+ ICollection Deserialize (object serializationData);
+
+ object Serialize (ICollection objects);
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/INameCreationService.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/INameCreationService.cs
new file mode 100644
index 00000000000..6463d480c16
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/INameCreationService.cs
@@ -0,0 +1,22 @@
+// System.ComponentModel.Design.Serialization.INameCreationService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public interface INameCreationService
+ {
+ string CreateName (IContainer container, Type dataType);
+
+ bool IsValidName (string name);
+
+ void ValidateName (string name);
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventArgs.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventArgs.cs
new file mode 100644
index 00000000000..587787aa703
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventArgs.cs
@@ -0,0 +1,37 @@
+// System.ComponentModel.Design.Serialization.ResolveNameEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public class ResolveNameEventArgs : EventArgs
+ {
+ public string name;
+
+ public ResolveNameEventArgs (string name) {
+ this.name = name;
+ }
+
+ public string Name {
+ get {
+ return this.name;
+ }
+ }
+
+ public object Value {
+ get {
+ return this.name;
+ }
+
+ set {
+ name = (string) value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventHandler.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventHandler.cs
new file mode 100644
index 00000000000..c4f45283bee
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/ResolveNameEventHandler.cs
@@ -0,0 +1,15 @@
+// System.ComponentModel.Design.Serialization.ResolvedNameEventHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ [Serializable]
+ public delegate void ResolveNameEventHandler (object sender, ResolveNameEventArgs e);
+}
diff --git a/mcs/class/System.Design/System.ComponentModel.Design.Serialization/RootDesignerSerializerAttribute.cs b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/RootDesignerSerializerAttribute.cs
new file mode 100644
index 00000000000..eef6ade5b0c
--- /dev/null
+++ b/mcs/class/System.Design/System.ComponentModel.Design.Serialization/RootDesignerSerializerAttribute.cs
@@ -0,0 +1,75 @@
+// System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@gnome.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Web.UI.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
+ public sealed class RootDesignerSerializerAttribute : Attribute
+ {
+ private string serializer;
+ private string baseserializer;
+ private Type basetypeserializer;
+ private Type serializertype;
+ private bool reload;
+
+ public RootDesignerSerializerAttribute (string serializerTypeName, string baseSerializerTypeName, bool reloadable) {
+ this.serializer = serializerTypeName;
+ this.baseserializer = baseSerializerTypeName;
+ this.reload = reloadable;
+ }
+
+ public RootDesignerSerializerAttribute (string serializerTypeName, Type baseSerializerType, bool reloadable) {
+ this.serializer = serializerTypeName;
+ this.basetypeserializer = baseSerializerType;
+ this.reload = reloadable;
+ }
+
+ public RootDesignerSerializerAttribute (Type serializerType, Type baseSerializerType, bool reloadable) {
+ this.serializertype = serializerType;
+ this.basetypeserializer = baseSerializerType;
+ this.reload = reloadable;
+ }
+
+ public bool Reloadable {
+ get {
+ return this.reload;
+ }
+
+ set {
+ this.reload = value;
+ }
+ }
+
+ public string SerializerBaseTypeName {
+ get {
+ return this.baseserializer;
+ }
+
+ set {
+ this.baseserializer = value;
+ }
+ }
+
+ public string SerializerTypeName {
+ get {
+ return this.serializer;
+ }
+
+ set {
+ serializer = value;
+ }
+ }
+
+ [MonoTODO]
+ public override object TypeId {
+ get { throw new NotImplementedException ();}
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Design.build b/mcs/class/System.Design/System.Design.build
new file mode 100755
index 00000000000..d697392aea2
--- /dev/null
+++ b/mcs/class/System.Design/System.Design.build
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Design.dll -->
+
+<project name="System.Design" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Design.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/noconfig"/>
+ <arg value="/debug"/>
+ <arg value="/r:System.Web.dll"/>
+ <arg value="/r:System.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="System.Web.UI.Design.WebControls/**"/>
+ </sources>
+ </csc>
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset basedir="../lib">
+ <includes name="System.Design.dll"/>
+ </fileset>
+ </delete>
+ </target>
+</project>
diff --git a/mcs/class/System.Design/System.Design/ChangeLog b/mcs/class/System.Design/System.Design/ChangeLog
new file mode 100644
index 00000000000..88db17bbb75
--- /dev/null
+++ b/mcs/class/System.Design/System.Design/ChangeLog
@@ -0,0 +1,3 @@
+2002-12-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * TODOAttribute.cs : Added file.
diff --git a/mcs/class/System.Design/System.Design/TODOAttribute.cs b/mcs/class/System.Design/System.Design/TODOAttribute.cs
new file mode 100644
index 00000000000..5302fee4a7d
--- /dev/null
+++ b/mcs/class/System.Design/System.Design/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Web.UI.Design {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/AdRotatorDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/AdRotatorDesigner.cs
new file mode 100755
index 00000000000..5f6f67339c2
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/AdRotatorDesigner.cs
@@ -0,0 +1,54 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: AdRotatorDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.IO;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class AdRotatorDesigner : ControlDesigner
+ {
+ public AdRotatorDesigner() : base()
+ {
+ }
+
+ public override string GetDesignTimeHtml()
+ {
+ if(Component != null && Component is AdRotator)
+ {
+ AdRotator toDesign = (AdRotator)Component;
+ HtmlTextWriter writer = new HtmlTextWriter(new StringWriter());
+ HyperLink link = new HyperLink();
+ Image disp = new Image();
+
+ link.ID = toDesign.ID;
+ link.NavigateUrl = String.Empty;
+ link.Target = toDesign.Target;
+ link.AccessKey = toDesign.AccessKey;
+ link.Enabled = toDesign.Enabled;
+ link.TabIndex = toDesign.TabIndex;
+
+ disp.ApplyStyle(toDesign.ControlStyle);
+ disp.ImageUrl = String.Empty;
+ disp.AlternateText = toDesign.ID;
+ disp.ToolTip = toDesign.ToolTip;
+
+ link.RenderBeginTag(writer);
+ link.RenderControl(writer);
+ link.RenderEndTag(writer);
+
+ return writer.ToString();
+ }
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListComponentEditor.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListComponentEditor.cs
new file mode 100755
index 00000000000..8c41dbedb27
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListComponentEditor.cs
@@ -0,0 +1,57 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: BaseDataListComponentEditor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms;
+using System.Windows.Forms.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public abstract class BaseDataListComponentEditor : WindowsFormsComponentEditor
+ {
+ private int initialPage;
+
+ public BaseDataListComponentEditor(int initialPage) : base()
+ {
+ this.initialPage = initialPage;
+ }
+
+ public override bool EditComponent(ITypeDescriptorContext context,
+ object obj, IWin32Window parent)
+ {
+ IComponent comp = (IComponent) obj;
+ ISite site = comp.Site;
+ bool retVal = false;
+ bool inTemplateMode = false;
+
+ if(site != null)
+ {
+ IDesignerHost dh = (IDesignerHost)site.GetService(typeof(IDesignerHost));
+ inTemplateMode = ((TemplatedControlDesigner)dh.GetDesigner(comp)).InTemplateMode;
+ }
+ if(inTemplateMode)
+ {
+ throw new NotImplementedException();
+ } else
+ {
+ retVal = base.EditComponent(context, obj, parent);
+ }
+ return retVal;
+ }
+
+ protected override int GetInitialComponentEditorPageIndex()
+ {
+ return initialPage;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListDesigner.cs
new file mode 100755
index 00000000000..45b696cbc61
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListDesigner.cs
@@ -0,0 +1,231 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: BaseDataListDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Web.UI.Design;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Data;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public abstract class BaseDataListDesigner : TemplatedControlDesigner,
+ IDataSourceProvider
+ {
+ private BaseDataList baseDataList;
+ private DataTable desTimeDataTable;
+ private DataTable dummyDataTable;
+
+ private static readonly string[] validNames = new string[] {
+ "AlternatingItemStyle",
+ "BackColor",
+ "DataSource",
+ "DataMember",
+ "EditItemStyle",
+ "Font",
+ "ForeColor",
+ "HeaderStyle",
+ "FooterStyle",
+ "ItemStyle",
+ "SelectedItemStyle",
+ "SeparatorStyle"
+ };
+
+ public BaseDataListDesigner()
+ {
+ }
+
+ public string DataKeyField
+ {
+ get
+ {
+ return baseDataList.DataKeyField;
+ }
+ set
+ {
+ baseDataList.DataKeyField = value;
+ }
+ }
+
+ public string DataMember
+ {
+ get
+ {
+ return baseDataList.DataMember;
+ }
+ set
+ {
+ baseDataList.DataMember = value;
+ }
+ }
+
+ public string DataSource
+ {
+ get
+ {
+ DataBinding element = DataBindings["DataSource"];
+ if(element != null)
+ {
+ return element.Expression;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null && value.Length == 0)
+ {
+ DataBindings.Remove("DataSource");
+ } else
+ {
+ DataBinding element = DataBindings["DataSource"];
+ if(element == null)
+ {
+ element = new DataBinding("DataSource",
+ typeof(IEnumerable),
+ value);
+ } else
+ {
+ element.Expression = value;
+ }
+ DataBindings.Add(element);
+ }
+ OnDataSourceChanged();
+ OnBindingsCollectionChanged("DataSource");
+ }
+ }
+
+ protected internal virtual void OnDataSourceChanged()
+ {
+ desTimeDataTable = null;
+ }
+
+ public override bool DesignTimeHtmlRequiresLoadComplete
+ {
+ get
+ {
+ return (DataSource.Length > 0);
+ }
+ }
+
+ public override DesignerVerbCollection Verbs
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public object GetSelectedDataSource()
+ {
+ object retVal = null;
+ DataBinding element = DataBindings["DataSource"];
+ if(element != null)
+ {
+ retVal = DesignTimeData.GetSelectedDataSource(baseDataList,
+ element.Expression);
+ }
+ return retVal;
+ }
+
+ public IEnumerable GetResolvedSelectedDataSource()
+ {
+ IEnumerable retVal = null;
+ DataBinding element = DataBindings["DataSource"];
+ if(element != null)
+ {
+ retVal = DesignTimeData.GetSelectedDataSource(baseDataList,
+ element.Expression,
+ DataMember);
+ }
+ return retVal;
+ }
+
+ public override IEnumerable GetTemplateContainerDataSource(
+ string templateName)
+ {
+ return GetResolvedSelectedDataSource();
+ }
+
+ public override void Initialize(IComponent component)
+ {
+ baseDataList = (BaseDataList)component;
+ base.Initialize(component);
+ }
+
+ public override void OnComponentChanged(object sender,
+ ComponentChangedEventArgs e)
+ {
+ if(e.Member != null)
+ {
+ string name = e.Member.Name;
+ foreach(string current in validNames)
+ {
+ if(name == current)
+ {
+ OnStylesChanged();
+ break;
+ }
+ }
+ }
+ base.OnComponentChanged(sender, e);
+ }
+
+ protected internal void OnStylesChanged()
+ {
+ OnTemplateEditingVerbsChanged();
+ }
+
+ protected abstract void OnTemplateEditingVerbsChanged();
+
+ protected override void Dispose(bool disposing)
+ {
+ if(disposing)
+ baseDataList = null;
+ base.Dispose(disposing);
+ }
+
+ protected IEnumerable GetDesignTimeDataSource(int minimumRows,
+ out bool dummyDataSource)
+ {
+ return GetDesignTimeDataSource(GetResolvedSelectedDataSource(),
+ minimumRows,
+ out dummyDataSource);
+ }
+
+ protected IEnumerable GetDesignTimeDataSource(IEnumerable selectedDataSource,
+ int minimumRows,
+ out bool dummyDataSource)
+ {
+ DataTable toDeploy = desTimeDataTable;
+ dummyDataSource = false;
+ if(minimumRows == 0)
+ {
+ if(selectedDataSource != null)
+ {
+ desTimeDataTable = DesignTimeData.CreateSampleDataTable(
+ selectedDataSource);
+ toDeploy = desTimeDataTable;
+ }
+ if(toDeploy == null)
+ {
+ if(dummyDataTable == null)
+ dummyDataTable = DesignTimeData.CreateDummyDataTable();
+ toDeploy = dummyDataTable;
+ dummyDataSource = true;
+ }
+ }
+ return DesignTimeData.GetDesignTimeDataSource(toDeploy, minimumRows);
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListPageInternal.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListPageInternal.cs
new file mode 100755
index 00000000000..57f9e58afde
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseDataListPageInternal.cs
@@ -0,0 +1,79 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: BaseDataListPageInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms.Design;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.Design.WebControls
+{
+ abstract class BaseDataListPageInternal : ComponentEditorPage
+ {
+ private bool isDataGridMode;
+
+ public BaseDataListPageInternal()
+ {
+ }
+
+ protected abstract string HelpKeyword { get; }
+
+ protected bool IsDataGridMode
+ {
+ get
+ {
+ return isDataGridMode;
+ }
+ }
+
+ public override void ShowHelp()
+ {
+ ISite site = GetSelectedComponent().Site;
+ IHelpService service = (IHelpService)site.GetService(
+ typeof(IHelpService));
+ if(service != null)
+ {
+ service.ShowHelpFromKeyword(HelpKeyword);
+ }
+ }
+
+ public override bool SupportsHelp()
+ {
+ return true;
+ }
+
+ public override void SetComponent(IComponent component)
+ {
+ base.SetComponent(component);
+ isDataGridMode = (GetBaseControl() is DataGrid);
+ }
+
+ protected BaseDataList GetBaseControl()
+ {
+ return (BaseDataList)GetSelectedComponent();
+ }
+
+ protected BaseDataListDesigner GetBaseDesigner()
+ {
+ BaseDataListDesigner retVal = null;
+ ISite site = GetSelectedComponent().Site;
+ IDesignerHost designer = (IDesignerHost)site.GetService(
+ typeof(IDesignerHost));
+ if(designer != null)
+ {
+ retVal = (BaseDataListDesigner)designer.GetDesigner(
+ GetSelectedComponent());
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseValidatorDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseValidatorDesigner.cs
new file mode 100755
index 00000000000..0d3f25a4ceb
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BaseValidatorDesigner.cs
@@ -0,0 +1,49 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: BaseValidatorDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class BaseValidatorDesigner : ControlDesigner
+ {
+ public BaseValidatorDesigner()
+ {
+ }
+
+ public override string GetDesignTimeHtml()
+ {
+ BaseValidator validator = (BaseValidator)Component;
+ validator.IsValid = false;
+ string errMsg = validator.ErrorMessage;
+ ValidatorDisplay dispBeh = validator.Display;
+ bool toSetErrMesg = true;
+ if(dispBeh != ValidatorDisplay.None &&
+ (errMsg.Length > 0 || validator.Text.Trim().Length > 0))
+ {
+ toSetErrMesg = false;
+ }
+ if(toSetErrMesg)
+ {
+ validator.ErrorMessage = '[' + validator.ID + ']';
+ validator.Display = ValidatorDisplay.Static;
+ }
+ string retVal = base.GetDesignTimeHtml();
+ if(toSetErrMesg)
+ {
+ validator.ErrorMessage = errMsg;
+ validator.Display = dispBeh;
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/BordersPageInternal.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BordersPageInternal.cs
new file mode 100755
index 00000000000..982bee197e4
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/BordersPageInternal.cs
@@ -0,0 +1,90 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: BordersPageInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms.Design;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.Design.WebControls
+{
+ class BordersPageInternal : BaseDataListPageInternal
+ {
+ public BordersPageInternal()
+ {
+ }
+
+ [MonoTODO]
+ protected override void LoadComponent()
+ {
+ InitializePage();
+ BaseDataList baseCtrl = GetBaseControl();
+ int cellPadding = baseCtrl.CellPadding;
+ if(cellPadding >= 0)
+ {
+ throw new NotImplementedException();
+ }
+ int cellSpacing = baseCtrl.CellSpacing;
+ if(cellSpacing >= 0)
+ {
+ throw new NotImplementedException();
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ private void InitializePage()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override void SaveComponent()
+ {
+ throw new NotImplementedException();
+ }
+
+ private void OnBordersChanged(object source, EventArgs e)
+ {
+ if(!IsLoading())
+ {
+ SetDirty();
+ }
+ }
+
+ private void OnClickColorPicker(object source, EventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void SetComponent(IComponent component)
+ {
+ base.SetComponent(component);
+ InitializeForm();
+ }
+
+ [MonoTODO]
+ private void InitializeForm()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override string HelpKeyword
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/ButtonDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/ButtonDesigner.cs
new file mode 100755
index 00000000000..94563df89b5
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/ButtonDesigner.cs
@@ -0,0 +1,39 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: ButtonDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class ButtonDesigner : TextControlDesigner
+ {
+ public ButtonDesigner(): base()
+ {
+ }
+
+ public override string GetDesignTimeHtml()
+ {
+ if(Component != null && Component is Button)
+ {
+ Button btn = (Button)Component;
+ btn.Text = btn.Text.Trim();
+ if(btn.Text.Length == 0)
+ {
+ btn.Text = "[" + btn.ID + "]";
+ }
+ return base.GetDesignTimeHtml();
+ }
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarAutoFormatDialog.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarAutoFormatDialog.cs
new file mode 100755
index 00000000000..ee62d74717d
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarAutoFormatDialog.cs
@@ -0,0 +1,43 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: CalendarAutoFormatDialog
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Windows.Forms;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class CalendarAutoFormatDialog : Form
+ {
+ private Calendar calendar;
+ private bool activated;
+
+ public CalendarAutoFormatDialog(Calendar calendar) : base()
+ {
+ this.calendar = calendar;
+ this.activated = false;
+ this.InitializeCalendar();
+ }
+
+ [MonoTODO]
+ private void InitializeCalendar()
+ {
+ // Load various WC-schemes.
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected void OnActivated(object source, EventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarDesigner.cs
new file mode 100755
index 00000000000..3dc5d9b86b6
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/CalendarDesigner.cs
@@ -0,0 +1,57 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: CalendarDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class CalendarDesigner : ControlDesigner
+ {
+ private DesignerVerbCollection verbs;
+ private Calendar calendar;
+
+ public CalendarDesigner() : base()
+ {
+ }
+
+ public override DesignerVerbCollection Verbs
+ {
+ get
+ {
+ if(verbs == null)
+ {
+ verbs = new DesignerVerbCollection();
+ //verbs.Add(new DesignerVerb(OnAutoFormat:Event_Handler)
+ }
+ return verbs;
+ }
+ }
+
+ public override void Initialize(IComponent component)
+ {
+ if(component is Calendar)
+ {
+ base.Initialize(component);
+ this.calendar = (Calendar) component;
+ }
+ }
+
+ [MonoTODO]
+ protected void OnAutoFormat(object sender, EventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/ChangeLog b/mcs/class/System.Design/System.Web.UI.Design.WebControls/ChangeLog
new file mode 100755
index 00000000000..af0dc3d24fb
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/ChangeLog
@@ -0,0 +1,132 @@
+
+2002-12-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * ListControlDataBindingHandler.cs
+ : Initial implementation.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * RepeaterDesigner.CS : Initial implementation.
+ * XmlDesigner.cs : Minor bug fixes.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * XmlDesigner.cs : Initial implementation.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * TODO : Update for PanelDesigner.
+ * PanelDesigner.cs : Completed.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * TODO : Updates of what I am doing / have done.
+ * BaseValidatorDesigner.cs: Completed.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseDataListDesigner.cs : GetDesignTimeDataSource(IEnumerable, int, bool)
+ - Implemented.
+
+2002-10-07 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseDataListDesigner.cs : Dipose(bool) - Implemented.
+ : GetDesignTimeDataSource(IEnumerable, int, bool)
+ - Stubbed.
+ : GetDesignTimeDataSource(int, bool)
+ - Implemented.
+
+2002-10-07 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseDataListDesigner.cs : Initial implementation.
+
+2002-10-07 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * TableRowsCollectionEditor.cs
+ : Completed.
+ * TODO : Updated information.
+
+2002-10-07 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BordersPageInternal.cs : LoadComponent() - Initial implementation.
+ : OnClickColorPicker(object, EventArgs),
+ : InitializePage()
+ - Stubbed.
+ : OnBordersChanged(object, EventArgs)
+ - Implemented.
+
+2002-10-07 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseDataListPageInternal.cs
+ : ctor() - Removed call to base.
+ It's by default.
+ : HelpKeyword - Added abstract property.
+ : IsDataGridMode - Implemented.
+ : ShowHelp(),
+ : SupportsHelp(),
+ : SetComponent(IComponent),
+ : GetBaseControl(),
+ : GetBaseDesigner()
+ - Implemented.
+ * BordersPageInternal.cs : SetComponent(IComponent)
+ - Implemented.
+ : HelpKeyword { get; },
+ : InitializeForm()
+ - Stubbed.
+ * FormatPageInternal.cs : HelpKeyword { get; }
+ - Stubbed.
+ * GeneralPageDataListInternal.cs
+ : HelpKeyword { get; }
+ - Stubbed.
+
+2002-09-25 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * RegextEditorDialog.cs : Added a few more methods.
+ * BaseDataListComponentEditor.cs
+ : Completed.
+ * DataListComponentEditor.cs
+ : Completed
+ * BaseDataListPageInternal.cs,
+ * GeneralPageDataListInternal.cs,
+ * FormatPageInternal.cs,
+ * BordersPageInternal.cs : Added private classes. Initial implementation.
+
+2002-09-24 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * RegexTypeEditor.cs : Completed
+ * RegexEditorDialog.cs : Initial implementation.
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * AdRotatorDesigner.cs : GetDesignTimeHtml() - Removed "MonoTODO"
+ * ButtonDesigner.cs : Completed.
+ * CalendarAutoFormatDialog.cs
+ : Initial implementation.
+ * CalendarDesigner.cs : Initial implementation.
+ * CheckBoxDesigner.cs : Completed.
+ * HyperLinkDesigner.cs : Almost completed. See "FIXME".
+ * LabelDesigner.cs : Completed.
+ * LinkButtonDesigner.cs : Completed.
+ * TableCellsCollectionEditor.cs
+ : Completed
+ * TableDesigner.cs : Initial implementation.
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * TODO : TODO Updates. Found some undocumented
+ classes.
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * AdRotatorDesigner.cs : Damn those typo errors.
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * AdRotatorDesigner.cs : Completed.
+
+2002-09-16 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * AdRotatorDesigner.cs : Initial implementation.
+ * TODOAttribute.cs : The TODO-Attribute class.
+ * TODO : Added file
+ * ChangeLog : Added file \ No newline at end of file
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/CheckBoxDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/CheckBoxDesigner.cs
new file mode 100755
index 00000000000..6aef3c8c432
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/CheckBoxDesigner.cs
@@ -0,0 +1,39 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: CheckboxDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class CheckBoxDesigner : ControlDesigner
+ {
+ public CheckBoxDesigner() : base()
+ {
+ }
+
+ public override string GetDesignTimeHtml()
+ {
+ if(Component != null && Component is CheckBox)
+ {
+ CheckBox cbx = (CheckBox) Component;
+ cbx.Text = cbx.Text.Trim();
+ if(cbx.Text.Length == 0)
+ {
+ cbx.Text = "[" + cbx.ID + "]";
+ }
+ return base.GetDesignTimeHtml();
+ }
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/DataListComponentEditor.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/DataListComponentEditor.cs
new file mode 100755
index 00000000000..9fe084e6fe1
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/DataListComponentEditor.cs
@@ -0,0 +1,50 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: DataListComponentEditor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms.Design;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class DataListComponentEditor : BaseDataListComponentEditor
+ {
+ internal static int GENERAL = 0x00;
+ internal static int FORMAT = 0x01;
+ internal static int BORDERS = 0x02;
+
+ private static Type[] componentEditorPages;
+
+ static DataListComponentEditor()
+ {
+ componentEditorPages = new Type[] {
+ typeof(GeneralPageDataListInternal),
+ typeof(FormatPageInternal),
+ typeof(BordersPageInternal)
+ };
+ }
+
+ public DataListComponentEditor() : base(GENERAL)
+ {
+ }
+
+ public DataListComponentEditor(int initialPage) : base(initialPage)
+ {
+ }
+
+ protected override Type[] GetComponentEditorPages()
+ {
+ return componentEditorPages;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/FormatPageInternal.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/FormatPageInternal.cs
new file mode 100755
index 00000000000..d9633f4a316
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/FormatPageInternal.cs
@@ -0,0 +1,46 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: FormatPageInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms.Design;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.Design.WebControls
+{
+ class FormatPageInternal : BaseDataListPageInternal
+ {
+ public FormatPageInternal() : base()
+ {
+ }
+
+ [MonoTODO]
+ protected override void LoadComponent()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override void SaveComponent()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override string HelpKeyword
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/GeneralPageDataListInternal.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/GeneralPageDataListInternal.cs
new file mode 100755
index 00000000000..c8ff62968ee
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/GeneralPageDataListInternal.cs
@@ -0,0 +1,46 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: GeneralPageDataListInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms.Design;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.Design.WebControls
+{
+ class GeneralPageDataListInternal : BaseDataListPageInternal
+ {
+ public GeneralPageDataListInternal() : base()
+ {
+ }
+
+ [MonoTODO]
+ protected override void LoadComponent()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override void SaveComponent()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override string HelpKeyword
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/HyperLinkDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/HyperLinkDesigner.cs
new file mode 100755
index 00000000000..dbc9494e499
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/HyperLinkDesigner.cs
@@ -0,0 +1,55 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: HyperLinkDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class HyperLinkDesigner : TextControlDesigner
+ {
+ public HyperLinkDesigner() : base()
+ {
+ }
+
+ [MonoTODO]
+ public override string GetDesignTimeHtml()
+ {
+ if(Component != null && Component is HyperLink)
+ {
+ HyperLink link = (HyperLink) Component;
+ link.Text = link.Text.Trim();
+ link.ImageUrl = link.ImageUrl.Trim();
+ link.NavigateUrl = link.NavigateUrl.Trim();
+ bool textOrImage = (link.Text.Length > 0 ||
+ link.ImageUrl.Length > 0);
+ bool nav = link.NavigateUrl.Length > 0;
+ if(!textOrImage)
+ {
+ link.Text = "[" + link.ID + "]";
+ if(!nav)
+ {
+ link.NavigateUrl = "url";
+ }
+ }
+
+ // FIXME: Unable to get the essence of "Remarks"
+ // in the MSDN documentation. Need to write a program
+ // to test what's happening.
+ throw new NotImplementedException();
+
+ //return base.GetDesignTimeHtml();
+ }
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/LabelDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/LabelDesigner.cs
new file mode 100755
index 00000000000..7e0be6960f9
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/LabelDesigner.cs
@@ -0,0 +1,24 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: LabelDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class LabelDesigner : TextControlDesigner
+ {
+ public LabelDesigner(): base()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/LinkButtonDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/LinkButtonDesigner.cs
new file mode 100755
index 00000000000..e593839a9c1
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/LinkButtonDesigner.cs
@@ -0,0 +1,24 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: LinkButtonDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class LinkButtonDesigner : TextControlDesigner
+ {
+ public LinkButtonDesigner(): base()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/ListControlDataBindingHandler.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/ListControlDataBindingHandler.cs
new file mode 100644
index 00000000000..59a01864e3e
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/ListControlDataBindingHandler.cs
@@ -0,0 +1,39 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: ListControlDataBindingHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class ListControlDataBindingHandler : DataBindingHandler
+ {
+ public ListControlDataBindingHandler()
+ {
+ }
+
+ [MonoTODO]
+ public override void DataBindControl(IDesignerHost designerHost,
+ Control control)
+ {
+ DataBinding db = ((IDataBindingsAccessor)control).DataBindings["DataSource"];
+ if(db != null)
+ {
+ ListControl ctrl = (ListControl)designerHost;
+ ctrl.Items.Clear();
+ throw new NotImplementedException();
+ //ctrl.Items.Add("Sample_Databound_Text"???);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/PanelDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/PanelDesigner.cs
new file mode 100755
index 00000000000..9c4be060253
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/PanelDesigner.cs
@@ -0,0 +1,69 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: PanelDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class PanelDesigner : ReadWriteControlDesigner
+ {
+ public PanelDesigner()
+ {
+ }
+
+ protected override void MapPropertyToStyle(string propName,
+ object varPropValue)
+ {
+ if(propName != null)
+ {
+ try
+ {
+ bool hasBeenSet = false;
+ if(propName == "BackImageUrl")
+ {
+ string url = varPropValue.ToString();
+ if(url.Length > 0)
+ url = "url(" + url + ")";
+ // FIXME: CSS Specs read "background-image",
+ // while MS implementation puts "backgroundImage".
+ // Is it a MS implementation bug?
+ Behavior.SetStyleAttribute("backgroundImage",
+ true, url, true);
+ hasBeenSet = true;
+ } else if(propName == "HorizonalAlign")
+ {
+ HorizontalAlign alignment = (HorizontalAlign)varPropValue;
+ if(alignment != HorizontalAlign.NotSet)
+ {
+ string value = Enum.Format(typeof(HorizontalAlign),
+ varPropValue, "G");
+ Behavior.SetStyleAttribute("textAlign",
+ true, value, true);
+ hasBeenSet = true;
+ }
+ }
+ if(!hasBeenSet)
+ base.MapPropertyToStyle(propName, varPropValue);
+
+ } catch(Exception) { }
+ }
+ }
+
+ protected override void OnBehaviorAttached()
+ {
+ base.OnBehaviorAttached();
+ Panel toDesign = (Panel)Component;
+ MapPropertyToStyle("BackImageUrl", toDesign.BackImageUrl);
+ MapPropertyToStyle("HorizontalAlign", toDesign.HorizontalAlign);
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/RegexEditorDialog.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/RegexEditorDialog.cs
new file mode 100755
index 00000000000..464648af7c5
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/RegexEditorDialog.cs
@@ -0,0 +1,131 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: RegexEditorDialog
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Windows.Forms.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class RegexEditorDialog : Form
+ {
+ private ISite site;
+ private Container components;
+ private bool isActivated;
+ private bool sVal;
+ private string regularExpression = String.Empty;
+
+ private Button helpBtn;
+ private Button testValBtn;
+ private Button okBtn;
+ private Button cancelBtn;
+
+ private Label inputLabel;
+ private Label testResultsLabel;
+ private Label stdExprLabel;
+ private Label exprLabel;
+
+ private ListBox stdExprsList;
+
+ private TextBox exprText;
+ private TextBox sampleText;
+
+ private GroupBox exprGrp;
+
+ public RegexEditorDialog(ISite site) : base()
+ {
+ this.site = site;
+ this.isActivated = false;
+ this.sVal = false;
+
+ InitializeComponents();
+ }
+
+ [MonoTODO]
+ private void InitializeComponents()
+ {
+ components = new Container();
+
+ helpBtn = new Button();
+ testValBtn = new Button();
+ okBtn = new Button();
+ cancelBtn = new Button();
+
+ inputLabel = new Label();
+ testResultsLabel = new Label();
+ stdExprLabel = new Label();
+ exprLabel = new Label();
+
+ stdExprsList = new ListBox();
+
+ exprText = new TextBox();
+ sampleText = new TextBox();
+
+ exprGrp = new GroupBox();
+
+ System.Drawing.Font cFont = System.Windows.Forms.Control.DefaultFont;
+ IUIService service = (IUIService)site.GetService(typeof(IUIService));
+ if(service != null)
+ {
+ cFont = (Font)(service.Styles["DialogFont"]);
+ }
+ throw new NotImplementedException();
+ }
+
+ public string RegularExpression
+ {
+ get
+ {
+ return regularExpression;
+ }
+ set
+ {
+ regularExpression = value;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if(disposing)
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ [MonoTODO]
+ private object[] CannedExpressions
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ private class CannedExpression
+ {
+ public string Description;
+ public string Expression;
+
+ public CannedExpression(string description, string expression)
+ {
+ Description = description;
+ Expression = expression;
+ }
+
+ public override string ToString()
+ {
+ return Description;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/RegexTypeEditor.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/RegexTypeEditor.cs
new file mode 100755
index 00000000000..72e38c817e0
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/RegexTypeEditor.cs
@@ -0,0 +1,59 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: RegexTypeEditor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Drawing.Design;
+using System.Web.UI.Design;
+using System.Windows.Forms.Design;
+using System.Windows.Forms;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class RegexTypeEditor : UITypeEditor
+ {
+ public RegexTypeEditor() : base()
+ {
+ }
+
+ public override object EditValue(ITypeDescriptorContext context,
+ IServiceProvider provider, object value)
+ {
+ if(provider != null)
+ {
+ IWindowsFormsEditorService winEdit = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
+ ISite site = null;
+ if(winEdit != null)
+ {
+ if(context.Instance is IComponent)
+ {
+ site = ((IComponent)context.Instance).Site;
+ } else if(context.Instance is object[] &&
+ ((object[])context.Instance)[0] is IComponent)
+ {
+ site = ((IComponent)(((object[])context.Instance)[0])).Site;
+ }
+ RegexEditorDialog dlg = new RegexEditorDialog(site);
+ dlg.RegularExpression = value.ToString();
+ DialogResult res = dlg.ShowDialog();
+ if(res == DialogResult.OK)
+ value = dlg.RegularExpression;
+ }
+ }
+ return value;
+ }
+
+ public override UITypeEditorEditStyle GetEditStyle(
+ ITypeDescriptorContext context)
+ {
+ return UITypeEditorEditStyle.Modal;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/RepeaterDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/RepeaterDesigner.cs
new file mode 100755
index 00000000000..389bccfc005
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/RepeaterDesigner.cs
@@ -0,0 +1,140 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: RepeaterDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class RepeaterDesigner : ControlDesigner, IDataSourceProvider
+ {
+ private DataTable desTimeDataTable;
+ private DataTable dummyDataTable;
+ private Repeater repeater;
+
+ public RepeaterDesigner()
+ {
+ }
+
+ public string DataMember
+ {
+ get
+ {
+ return repeater.DataMember;
+ }
+ set
+ {
+ repeater.DataMember = value;
+ }
+ }
+
+ public string DataSource
+ {
+ get
+ {
+ DataBinding db = DataBindings["DataSource"];
+ if(db != null)
+ return db.Expression;
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null || value.Length == 0)
+ {
+ DataBindings.Remove("DataSource");
+ } else
+ {
+ DataBinding toSet = new DataBinding("DataSource",
+ typeof(IEnumerable), value);
+ toSet.Expression = value;
+ DataBindings.Add(toSet);
+ }
+ OnDataSourceChanged();
+ OnBindingsCollectionChanged("DataSource");
+ }
+ }
+
+ public virtual void OnDataSourceChanged()
+ {
+ desTimeDataTable = null;
+ }
+
+ protected bool TemplateExists
+ {
+ get
+ {
+ return (repeater.ItemTemplate != null ||
+ repeater.HeaderTemplate != null ||
+ repeater.FooterTemplate != null ||
+ repeater.AlternatingItemTemplate != null);
+ }
+ }
+
+ protected IEnumerable GetDesignTimeDataSource(int minimumRows)
+ {
+ return GetDesignTimeDataSource(GetResolvedSelectedDataSource(),
+ minimumRows);
+ }
+
+ protected IEnumerable GetDesignTimeDataSource(IEnumerable selectedDataSource,
+ int minimumRows)
+ {
+ DataTable toDeploy = desTimeDataTable;
+ if(toDeploy == null)
+ {
+ if(selectedDataSource != null)
+ {
+ desTimeDataTable = DesignTimeData.CreateSampleDataTable(
+ selectedDataSource);
+ toDeploy = desTimeDataTable;
+ } else
+ {
+ if(dummyDataTable == null)
+ dummyDataTable = DesignTimeData.CreateDummyDataTable();
+ toDeploy = dummyDataTable;
+ }
+ }
+ return DesignTimeData.GetDesignTimeDataSource(toDeploy,
+ minimumRows);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if(disposing)
+ repeater = null;
+ base.Dispose(disposing);
+ }
+
+ public object GetSelectedDataSource()
+ {
+ object retVal = null;
+ DataBinding db = DataBindings["DataSource"];
+ if(db != null)
+ {
+ retVal = DesignTimeData.GetSelectedDataSource(repeater, db.Expression);
+ }
+ return retVal;
+ }
+
+ public virtual IEnumerable GetResolvedSelectedDataSource()
+ {
+ IEnumerable retVal = null;
+ DataBinding db = DataBindings["DataSource"];
+ if(db != null)
+ {
+ retVal = DesignTimeData.GetSelectedDataSource(repeater, db.Expression, DataMember);
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/TODO b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TODO
new file mode 100755
index 00000000000..525d8ef1116
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TODO
@@ -0,0 +1,44 @@
+All Classes.
+Documented + Undocumented.
+
+<legends>
+*: Completed
+&: Work in progress. See <item-name>.cs file for maintainer's name
+</legends>
+
+--------------------
+ Documented Classes
+--------------------
+
+* AdRotatorDesigner
+* BaseDataListComponentEditor
+& BaseDataListDesigner
+* BaseValidatorDesigner
+* ButtonDesigner
+& CalendarAutoFormatDialog
+& CalendarDesigner
+* CheckBoxDesigner
+DataGridColumnCollectionEditor
+DataGridComponentEditor
+DataGridDesigner
+& DataListComponentEditor
+DataListDesigner
+* HyperLinkDesigner
+* LabelDesigner
+* LinkButtonDesigner
+* ListControlDataBindingHandler
+ListControlDesigner
+ListItemsCollectionEditor
+* PanelDesigner
+* RegexTypeEditor
+* TableCellsCollectionEditor
+& TableDesigner
+& TableRowsCollectionEditor
+
+------------------------------------------------------
+ Found new classes. Not documented in MSDN otherwise.
+------------------------------------------------------
+
+& RegexEditorDialog
+* RepeaterDesigner
+& XmlDesigner \ No newline at end of file
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/TODOAttribute.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TODOAttribute.cs
new file mode 100755
index 00000000000..1af03412ec9
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Web.UI.Design.WebControls {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableCellsCollectionEditor.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableCellsCollectionEditor.cs
new file mode 100755
index 00000000000..ba4c60dce32
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableCellsCollectionEditor.cs
@@ -0,0 +1,38 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: TableCellsCollectionEditor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class TableCellsCollectionEditor : CollectionEditor
+ {
+ public TableCellsCollectionEditor(Type type) : base(type)
+ {
+ }
+
+ protected override bool CanSelectMultipleInstances()
+ {
+ return false;
+ }
+
+ protected override object CreateInstance(Type itemType)
+ {
+ return Activator.CreateInstance(itemType, BindingFlags.Public |
+ BindingFlags.CreateInstance |
+ BindingFlags.Instance,
+ null, null, null);
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableDesigner.cs
new file mode 100755
index 00000000000..b36cb7eb995
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableDesigner.cs
@@ -0,0 +1,41 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: TableDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class TableDesigner : TextControlDesigner
+ {
+ public TableDesigner(): base()
+ {
+ }
+
+ [MonoTODO]
+ public override string GetDesignTimeHtml()
+ {
+ if(Component != null && Component is Table)
+ {
+ Table table = (Table) Component;
+ throw new NotImplementedException();
+ }
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ public override string GetPersistInnerHtml()
+ {
+ throw new NotImplementedException();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableRowsCollectionEditor.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableRowsCollectionEditor.cs
new file mode 100755
index 00000000000..05219466c5c
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/TableRowsCollectionEditor.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: TableRowsCollectionEditor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: mastergaurav AT users DOT sf DOT net
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel.Design;
+using System.Reflection;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class TableRowsCollectionEditor : CollectionEditor
+ {
+ public TableRowsCollectionEditor(Type type) : base(type)
+ {
+ }
+
+ protected override bool CanSelectMultipleInstances()
+ {
+ return false;
+ }
+
+ protected override object CreateInstance(Type itemType)
+ {
+ return Activator.CreateInstance(itemType,
+ BindingFlags.CreateInstance |
+ BindingFlags.Instance |
+ BindingFlags.Public,
+ null, null, null);
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design.WebControls/XmlDesigner.cs b/mcs/class/System.Design/System.Web.UI.Design.WebControls/XmlDesigner.cs
new file mode 100755
index 00000000000..c822edc786c
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design.WebControls/XmlDesigner.cs
@@ -0,0 +1,53 @@
+/**
+ * Namespace: System.Web.UI.Design.WebControls
+ * Class: XmlDesigner
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web.UI.WebControls;
+using System.Web.UI.Design;
+
+namespace System.Web.UI.Design.WebControls
+{
+ public class XmlDesigner : ControlDesigner
+ {
+ private System.Web.UI.WebControls.Xml xml;
+
+ public XmlDesigner()
+ {
+ }
+
+ public override void Initialize(IComponent component)
+ {
+ if(component is System.Web.UI.WebControls.Xml)
+ {
+ xml = (System.Web.UI.WebControls.Xml)component;
+ }
+ base.Initialize(component);
+ }
+
+ public override string GetDesignTimeHtml()
+ {
+ return GetEmptyDesignTimeHtml();
+ }
+
+ [MonoTODO]
+ protected override string GetEmptyDesignTimeHtml()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if(disposing)
+ xml = null;
+ base.Dispose(disposing);
+ }
+ }
+}
diff --git a/mcs/class/System.Design/System.Web.UI.Design/ChangeLog b/mcs/class/System.Design/System.Web.UI.Design/ChangeLog
new file mode 100644
index 00000000000..f37629a0276
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design/ChangeLog
@@ -0,0 +1,4 @@
+2003-01-07 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * DataBindingHandler.cs : Implemented.
+
diff --git a/mcs/class/System.Design/System.Web.UI.Design/DataBindingHandler.cs b/mcs/class/System.Design/System.Web.UI.Design/DataBindingHandler.cs
new file mode 100644
index 00000000000..bce242d6366
--- /dev/null
+++ b/mcs/class/System.Design/System.Web.UI.Design/DataBindingHandler.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.UI.Design
+ * Class: DataBindingHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel.Design;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.Design
+{
+ public abstract class DataBindingHandler
+ {
+ protected DataBindingHandler()
+ {
+ }
+
+ public abstract void DataBindControl(IDesignerHost designerHost,
+ Control control);
+ }
+}
diff --git a/mcs/class/System.Drawing/.cvsignore b/mcs/class/System.Drawing/.cvsignore
new file mode 100644
index 00000000000..8744e149aac
--- /dev/null
+++ b/mcs/class/System.Drawing/.cvsignore
@@ -0,0 +1,3 @@
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Drawing/ChangeLog b/mcs/class/System.Drawing/ChangeLog
new file mode 100644
index 00000000000..c640b28b995
--- /dev/null
+++ b/mcs/class/System.Drawing/ChangeLog
@@ -0,0 +1,11 @@
+2002-12-1 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * list.unix: Changed
+
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog: new file.
+
+ * System.Drawing.build: added System.dll dependency
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs b/mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs
new file mode 100644
index 00000000000..373f45a9a98
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs
@@ -0,0 +1,57 @@
+// System.Drawing.Design.CategoryNameCollection.cs
+//
+// Author:
+// Alejandro Sánchez Acosta
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+
+namespace System.Drawing.Design
+{
+ public sealed class CategoryNameCollection : ReadOnlyCollectionBase
+ {
+ private int index;
+
+ [MonoTODO]
+ public CategoryNameCollection (CategoryNameCollection value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public CategoryNameCollection(string[] value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Contains (string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ public void CopyTo (string[] array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf (string value)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog
new file mode 100644
index 00000000000..448a9f80a12
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ChangeLog
@@ -0,0 +1,26 @@
+2002-12-01 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * PaintValueEventArgs.cs,
+ ToolboxComponentsCreatingEventArgs.cs,
+ PropertyValueItem.cs,
+ ToolboxComponentsCreatingEventHandler.cs
+ IDesignerHost.cs,
+ ToolboxItemCreatorCallback.cs,
+ ToolboxItem.cs,
+ ToolboxComponentsCreatedEventArgs.cs
+ UITypeEditorEditStyle.cs,
+ IToolboxUser.cs
+ ToolboxComponentsCreatedEventHandler.cs
+ CategoryNameCollection.cs : Added
+
+2002-11-20 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * IPropertyValueUIService.cs: Added
+
+ * PropertyValueItem.cs: Added
+
+ * PropertyValueUIHandler.cs: Added
+
+ * PropertyValueUIItemInvokeHandler.cs: Added
+
+ * ChangeLog: new file.
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IDesignerHost.cs b/mcs/class/System.Drawing/System.Drawing.Design/IDesignerHost.cs
new file mode 100644
index 00000000000..eee18fd2e1c
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/IDesignerHost.cs
@@ -0,0 +1,47 @@
+// System.Drawing.Design.IDesignerHost.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Design
+{
+ [ComVisible(true)]
+ public interface IDesignerHost : IServiceContainer, IServiceProvider
+ {
+ IContainer Container {get;}
+
+ bool InTransaction {get;}
+
+ bool Loading {get;}
+
+ IComponent RootComponent {get;}
+
+ string RootComponentClassName {get;}
+
+ string TransactionDescription {get;}
+
+ void Activate();
+
+ IComponent CreateComponent (Type componentClass);
+
+ IComponent CreateComponent (Type componentClass, string name);
+
+ DesignerTransaction CreateTransaction ();
+
+ DesignerTransaction CreateTransaction (string description);
+
+ void DestroyComponent (IComponent component);
+
+ IDesigner GetDesigner (IComponent component);
+
+ Type GetType (string typeName);
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs b/mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs
new file mode 100644
index 00000000000..0f9a4a1d162
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs
@@ -0,0 +1,31 @@
+// System.Drawing.Design.IPropertyValueUIService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Drawing.Design
+{
+ public interface IPropertyValueUIService
+ {
+
+ #region Methods
+ void AddPropertyValueUIHandler (PropertyValueUIHandler newHandler);
+ PropertyValueUIItem[] GetPropertyUIValueItems (ITypeDescriptorContext context, PropertyDescriptor propDesc);
+
+ void NotifyPropertyValueUIItemsChanged ();
+
+ void RemovePropertyValueUIHandler (PropertyValueUIHandler newHandler);
+ #endregion Methods
+
+ #region Events
+ event EventHandler PropertyUIValueItemsChanged;
+ #endregion Events
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs
new file mode 100644
index 00000000000..1d68888aa1b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs
@@ -0,0 +1,64 @@
+// System.Drawing.Design.IToolboxService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Design
+{
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IToolboxService
+ {
+ CategoryNameCollection CategoryNames {get;}
+
+ string SelectedCategory {get; set;}
+
+ void AddCreator (ToolboxItemCreatorCallback creator, string format);
+
+ void AddCreator (ToolboxItemCreatorCallback creator, string format, IDesignerHost host);
+
+ void AddLinkedToolboxItem (ToolboxItem toolboxItem, IDesignerHost host);
+
+ void AddLinkedToolboxItem (ToolboxItem toolboxItem, string category, IDesignerHost host);
+
+ ToolboxItem DeserializeToolboxItem (object serializedObject);
+
+ ToolboxItem DeserializeToolboxItem (object serializedObject, IDesignerHost host);
+
+ ToolboxItem GetSelectedToolboxItem ();
+
+ ToolboxItem GetSelectedToolboxItem (IDesignerHost host);
+
+ bool IsSupported (object serializedObject, ICollection filterAttributes);
+
+ bool IsSupported (object serializedObject, IDesignerHost host);
+
+ bool IsToolboxItem (object serializedObject);
+
+ bool IsToolboxItem (object serializedObject, IDesignerHost host);
+
+ void Refresh();
+
+ void RemoveCreator (string format);
+
+ void RemoveCreator (string format, IDesignerHost host);
+
+ void RemoveToolboxItem (ToolboxItem toolboxItem);
+
+ void RemoveToolboxItem (ToolboxItem toolboxItem, string category);
+
+ void SelectedToolboxItemUsed ();
+
+ object SerializeToolboxItem (ToolboxItem toolboxItem);
+
+ bool SetCursor ();
+
+ void SetSelectedToolboxItem (ToolboxItem toolboxItem);
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs
new file mode 100644
index 00000000000..43c53b2174f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs
@@ -0,0 +1,17 @@
+// System.Drawing.Design.IToolboxUser.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.Drawing.Design
+{
+ public interface IToolboxUser
+ {
+ bool GetToolSupported (ToolboxItem tool);
+
+ void ToolPicked (ToolboxItem tool);
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs
new file mode 100644
index 00000000000..70b188a05cc
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs
@@ -0,0 +1,56 @@
+// System.Drawing.Design.PaintvalueEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.ComponentModel;
+
+namespace System.Drawing.Desing
+{
+ public class PaintValueEventArgs : EventArgs
+ {
+ private ITypeDescriptorContext context;
+ private object value;
+ private Graphics graphics;
+ private Rectangle bounds;
+
+ public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds) {
+ this.context = context;
+ this.value = value;
+ this.graphics = graphics;
+ this.bounds = bounds;
+ }
+
+ public Rectangle Bounds
+ {
+ get {
+ return bounds;
+ }
+ }
+
+ public ITypeDescriptorContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public Graphics Graphics
+ {
+ get {
+ return graphics;
+ }
+ }
+
+ public object Value
+ {
+ get {
+ return value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs
new file mode 100644
index 00000000000..b8bf6034cc3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs
@@ -0,0 +1,69 @@
+// System.Drawing.Design.PropertyValueItem.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Web.UI.WebControls;
+using System.ComponentModel;
+
+namespace System.Drawing.Design
+{
+ public class PropertyValueUIItem
+ {
+ [MonoTODO]
+ public PropertyValueUIItem (Image uiItemImage,
+ PropertyValueUIItemInvokeHandler handler,
+ string tooltip)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual Image Image
+ {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual PropertyValueUIItemInvokeHandler InvokeHandler
+ {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string ToolTip
+ {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual void Reset()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs
new file mode 100644
index 00000000000..68661595e9f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs
@@ -0,0 +1,19 @@
+// System.Drawing.Design.PropertyValueUIHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Drawing.Design
+{
+
+ [Serializable]
+ public delegate void PropertyValueUIHandler (ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList);
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs
new file mode 100644
index 00000000000..4d38b19319b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs
@@ -0,0 +1,19 @@
+// System.Drawing.Design.PropertyValueUIItemInvokeHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Drawing.Design
+{
+ [Serializable]
+ public delegate void PropertyValueUIItemInvokeHandler (
+ ITypeDescriptorContext context,
+ PropertyDescriptor descriptor,
+ PropertyValueUIItem invokedItem);
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
new file mode 100644
index 00000000000..4ebe93af54d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
@@ -0,0 +1,28 @@
+// System.Drawing.Design.ToolboxComponentsCreatedEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+//
+
+using System.ComponentModel;
+
+namespace System.Drawing.Design
+{
+ public class ToolboxComponentsCreatedEventArgs : EventArgs
+ {
+ private IComponent[] components;
+
+ public ToolboxComponentsCreatedEventArgs (IComponent[] components) {
+ this.components = components;
+ }
+
+ public IComponent[] Components {
+ get {
+ return components;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs
new file mode 100644
index 00000000000..292f1a7523f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs
@@ -0,0 +1,14 @@
+// System.Drawing.Design.IDesignerHost.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.Drawing.Design
+{
+ [Serializable]
+ public delegate void ToolboxComponentsCreatedEventHandler (object sender, ToolboxComponentsCreatedEventArgs e);
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
new file mode 100644
index 00000000000..1d7a03d8e61
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
@@ -0,0 +1,28 @@
+// System.Drawing.Design.ToolboxComponentsCreatingEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.Drawing.Design
+{
+ public class ToolboxComponentsCreatingEventArgs : EventArgs
+ {
+ private IDesignerHost host;
+
+ public ToolboxComponentsCreatingEventArgs (IDesignerHost host)
+ {
+ this.host = host;
+ }
+
+ public IDesignerHost DesignerHost {
+ get {
+ return host;
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs
new file mode 100644
index 00000000000..1896b9daa73
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs
@@ -0,0 +1,13 @@
+// System.Drawing.Design.ToolboxComponentsCreatingEventHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.Drawing.Design
+{
+ [Serializable]
+ public delegate void ToolboxComponentsCreatingEventHandler (object sender, ToolboxComponentsCreatingEventArgs e);
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs
new file mode 100644
index 00000000000..1e5227dad29
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItem.cs
@@ -0,0 +1,187 @@
+// System.Drawing.Design.ToolboxItem.cs
+//
+// Author:
+// Alejandro Sánchez Acosta
+//
+// (C) Alejandro Sánchez Acosta
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Drawing.Design
+{
+ [Serializable]
+ public class ToolboxItem : ISerializable
+ {
+
+ private AssemblyName assembly;
+ private Bitmap bitmap;
+ private ICollection filter;
+ private string displayname;
+ private bool locked;
+ private string name;
+
+ [MonoTODO]
+ public ToolboxItem() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ToolboxItem (Type toolType) {
+ throw new NotImplementedException ();
+ }
+
+ public AssemblyName AssemblyName {
+ get {
+ return assembly;
+ }
+
+ set {
+ assembly = value;
+ }
+ }
+
+ public Bitmap Bitmap {
+ get {
+ return bitmap;
+ }
+
+ set {
+ bitmap = value;
+ }
+ }
+
+ public string DisplayName {
+ get {
+ return displayname;
+ }
+
+ set {
+ displayname = value;
+ }
+ }
+
+ public ICollection Filter {
+ get {
+ return filter;
+ }
+
+ set {
+ filter = value;
+ }
+ }
+
+ protected bool Locked {
+ get {
+ return locked;
+ }
+
+ set {
+ locked = value;
+ }
+ }
+
+ public string TypeName {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ [MonoTODO]
+ protected void CheckUnlocked ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IComponent[] CreateComponents ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IComponent[] CreateComponents (IDesignerHost host)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual IComponent[] CreateComponentsCore (IDesignerHost host)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Deserialize (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual Type GetType (IDesignerHost host, AssemblyName assemblyName, string typeName, bool reference)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Initialize (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Lock ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnComponentsCreated (ToolboxComponentsCreatedEventArgs args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnComponentsCreating (ToolboxComponentsCreatingEventArgs args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Serialize (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs
new file mode 100644
index 00000000000..8dc04b04c8a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs
@@ -0,0 +1,15 @@
+// System.Drawing.Design.ToolboxItemCreatorCallback.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.Drawing.Design
+{
+ [Serializable]
+ public delegate ToolboxItem ToolboxItemCreatorCallback(
+ object serializedObject,
+ string format);
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs b/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs
new file mode 100644
index 00000000000..6a571cc7cc4
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Design.UITypeEditorEditStyle.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Design
+{
+ public enum UITypeEditorEditStyle{
+ DropDown=1,
+ Modal=2,
+ None=3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/AdjustableArrowCap.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/AdjustableArrowCap.cs
new file mode 100644
index 00000000000..6699a15126d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/AdjustableArrowCap.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.AdjustableArrowCap.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for AdjustableArrowCap.
+ /// </summary>
+ public class AdjustableArrowCap
+ {
+ public AdjustableArrowCap()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/Blend.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Blend.cs
new file mode 100644
index 00000000000..af2869c8527
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Blend.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.Blend.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for Blend.
+ /// </summary>
+ public class Blend
+ {
+ public Blend()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
new file mode 100644
index 00000000000..b9cbdedf27f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
@@ -0,0 +1,59 @@
+2002-10-13 DennisHayes <dennish@raytek.com>
+ * Changed namespace from *2d to *2D
+ * Changed comment header from system.Drawing to System.Drawing.Drawing2D
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * AdjustableArrowCap.cs
+ * Blend.cs
+ * ColorBlend.cs
+ * CombineMode.cs
+ * CompostingMode.cs
+ * CompostingQuality.cs
+ * CoordinateSpace.cs
+ * CustomLineCap.cs
+ * DashCap.cs
+ * DashStyle.cs
+ * FillMode.cs
+ * FlushIntention.cs
+ * GraphicsContainer.cs
+ * GraphicsPathIterator.cs
+ * GraphicsState.cs
+ * HatchBrush.cs
+ * HatchStyle.cs
+ * InterpolationMode.cs
+ * LinearGradientBrush.cs
+ * LinearGradientMode.cs
+ * LineCap.cs
+ * LineJoin.cs
+ * MatrixOrder.cs
+ * PathData.cs
+ * PathGradientBrush.cs
+ * PathPointType.cs
+ * PenAligment.cs
+ * PenType.cs
+ * PixelOffsetMode.cs
+ * QualityMode.cs
+ * RegionData.cs
+ * SmoothingMode.cs
+ * WarpMode.cs
+ * WrapMode.cs
+ * Added null classes for most/all classes, Many stubs, and some implmentation
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * Matrix.cs
+ * Added stubs, implmentation
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * GraphicsPath.cs
+ * added stub needed for system.windows.forms
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * ChangeLog : Add.
+
+ * Matrix.cs : MonoTODO everywhere.
+
+ * TODOAttribute.cs : Add here too. \ No newline at end of file
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ColorBlend.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ColorBlend.cs
new file mode 100644
index 00000000000..b970a5c5dc3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ColorBlend.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.ColorBlend.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for ColorBlend.
+ /// </summary>
+ public class ColorBlend
+ {
+ public ColorBlend()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs
new file mode 100644
index 00000000000..1c72b7a2a00
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.CombineMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for CombineMode.
+ /// </summary>
+ public enum CombineMode
+ {
+ Complement = 5,
+ Exclude = 4,
+ Intersect =4,
+ Replace = 0,
+ Union = 2,
+ Xor =3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs
new file mode 100644
index 00000000000..27baa9f1645
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Drawing2D.CompostingMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for CompostingMode.
+ /// </summary>
+ public enum CompositingMode {
+ SourceCopy,
+ SourceOver
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs
new file mode 100644
index 00000000000..0f24e2caab9
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs
@@ -0,0 +1,24 @@
+//
+// System.Drawing.CompostingQuality.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for CompostingQuality.
+ /// </summary>
+ public enum CompositingQuality {
+ AssumeLinear,
+ Default,
+ GammaCorrected,
+ HighQuality,
+ HighSpeed,
+ Invalid
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs
new file mode 100644
index 00000000000..bea5a6f10b3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Drawing2D.CoordinateSpace.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for CoordinateSpace.
+ /// </summary>
+ public enum CoordinateSpace {
+ Device,
+ Page,
+ World
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CustomLineCap.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CustomLineCap.cs
new file mode 100644
index 00000000000..0fca8daf19a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CustomLineCap.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.CustomLineCap.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for CustomLineCap.
+ /// </summary>
+ public class CustomLineCap
+ {
+ public CustomLineCap()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs
new file mode 100644
index 00000000000..9f2a4624563
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Drawing2D.DashCap.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for DashCap.
+ /// </summary>
+ public enum DashCap {
+ Flat,
+ Round,
+ Triangle
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs
new file mode 100644
index 00000000000..92bbaeba853
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs
@@ -0,0 +1,24 @@
+//
+// System.Drawing.Drawing2D.DashStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for DashStyle.
+ /// </summary>
+ public enum DashStyle {
+ Custom,
+ Dash,
+ DashDot,
+ DashDotDot,
+ Dot,
+ Solid
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs
new file mode 100644
index 00000000000..e5f8279eb36
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Drawing2D.FillMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for FillMode.
+ /// </summary>
+ public enum FillMode {
+ Alternate,
+ Winding
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs
new file mode 100644
index 00000000000..769b71c089f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.Drawing2D.FlushIntention.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for FlushIntention.
+ /// </summary>
+ public enum FlushIntention {
+ Flush,
+ Sync
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs
new file mode 100644
index 00000000000..1df69bcd704
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.GraphicsContainer.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for GraphicsContainer.
+ /// </summary>
+ public class GraphicsContainer
+ {
+ public GraphicsContainer()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
new file mode 100644
index 00000000000..5b2655316d6
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
@@ -0,0 +1,36 @@
+//
+// System.Drawing.Drawing2D.GraphicsPath.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for GraphicsPath.
+ /// </summary>
+ public sealed class GraphicsPath //: MarshalByRefObject, ICloneable, IDisposable
+ {
+ //[MonoTODO]
+ public GraphicsPath() {
+ }
+ //[MonoTODO]
+ //public GraphicsPath(FillMode fillMode) : this() {
+ //}
+ //[MonoTODO]
+ //public GraphicsPath(Point[] pts, byte[] types) : this() {
+ //}
+ //[MonoTODO]
+ //public GraphicsPath(PointF[] pts, byte[] types) : this() {
+ //}
+ //[MonoTODO]
+ //public GraphicsPath(Point[] pts, byte[] types, FillMode fillmode) : this(pts, types) {
+ //}
+ //[MonoTODO]
+ //public GraphicsPath(PointF[] pts, byte[] types, FillMode fillmode) : this(pts, types) {
+ //}
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs
new file mode 100644
index 00000000000..8525c9531c6
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.GraphicsPathIterator.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for GraphicsPathIterator.
+ /// </summary>
+ public class GraphicsPathIterator
+ {
+ public GraphicsPathIterator()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
new file mode 100644
index 00000000000..922144d272e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.GraphicsState.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for GraphicsState.
+ /// </summary>
+ public class GraphicsState
+ {
+ public GraphicsState()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs
new file mode 100644
index 00000000000..edb375793a9
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.HatchBrush.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for HatchBrush.
+ /// </summary>
+ public class HatchBrush
+ {
+ public HatchBrush()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs
new file mode 100644
index 00000000000..59c81e556c1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs
@@ -0,0 +1,75 @@
+//
+// System.Drawing.Drawing2D.HatchStyle.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for HatchStyle.
+ /// </summary>
+ public enum HatchStyle {
+ BackwardDiagonal,
+ Cross,
+ DarkDownwardDiagonal,
+ DarkHorizontal,
+ DarkUpwardDiagonal,
+ DarkVertical,
+ DashedDownwardDiagonal,
+ DashedHorizontal,
+ DashedUpwardDiagonal,
+ DashedVertical,
+ DiagonalBrick,
+ DiagonalCross,
+ Divot,
+ DottedDiamond,
+ DottedGrid,
+ ForwardDiagonal,
+ Horizontal,
+ HorizontalBrick,
+ LargeCheckerBoard,
+ LargeConfetti,
+ LargeGrid,
+ LightDownwardDiagonal,
+ LightHorizontal,
+ LightUpwardDiagonal,
+ LightVertical,
+ Max,
+ Min,
+ NarrowHorizontal,
+ NarrowVertical,
+ OutlinedDiamond,
+ Percent05,
+ Percent10,
+ Percent20,
+ Percent25,
+ Percent30,
+ Percent40,
+ Percent50,
+ Percent60,
+ Percent70,
+ Percent75,
+ Percent80,
+ Percent90,
+ Plaid,
+ Shingle,
+ SmallCheckerBoard,
+ SmallConfetti,
+ SmallGrid,
+ SolidDiamond,
+ Sphere,
+ Trellis,
+ Vertical,
+ Wave,
+ Weave,
+ WideDownwardDiagonal,
+ WideUpwardDiagonal,
+ ZigZag
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs
new file mode 100644
index 00000000000..9d7cebbf66a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs
@@ -0,0 +1,27 @@
+//
+// System.Drawing.Drawing2D.InterpolationMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for InterpolationMode.
+ /// </summary>
+ public enum InterpolationMode {
+ Bicubic,
+ Bilinear,
+ Default,
+ High,
+ HighQualityBicubic,
+ HighQualityBilinear,
+ Invalid,
+ Low,
+ NearestNeighbour
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs
new file mode 100644
index 00000000000..161c3b2fe85
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs
@@ -0,0 +1,29 @@
+//
+// System.Drawing.Drawing2D.LineCap.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for LineCap.
+ /// </summary>
+ public enum LineCap {
+ AnchorMask,
+ ArrowAnchor,
+ Custom,
+ DiamondAnchor,
+ Flat,
+ NoAnchor,
+ Round,
+ RoundAnchor,
+ Square,
+ SquareAnchor,
+ Triangle
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs
new file mode 100644
index 00000000000..4ced9b10d24
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.Drawing2D.LineJoin.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for LineJoin.
+ /// </summary>
+ public enum LineJoin {
+ Bevel,
+ Miter,
+ MiterClipped,
+ Round
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs
new file mode 100644
index 00000000000..9e4527fd75c
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.LinearGradientBrush.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for LinearGradientBrush.
+ /// </summary>
+ public class LinearGradientBrush
+ {
+ public LinearGradientBrush()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs
new file mode 100644
index 00000000000..e1f0cd91dd5
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.Drawing2D.LinearGradientMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for LinearGradientMode.
+ /// </summary>
+ public enum LinearGradientMode {
+ BackwardDiagonal,
+ ForwardDiagonal,
+ Horizontal,
+ Vertical
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
new file mode 100644
index 00000000000..a3b4ddccaec
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
@@ -0,0 +1,454 @@
+//
+// System.Drawing.Drawing2D.Matrix.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Drawing2D
+{
+ public sealed class Matrix : MarshalByRefObject, IDisposable
+ {
+ // initialize to identity
+ private float[] m = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};
+
+ // constructors
+ public Matrix() { }
+
+ /* TODO: depends on System.Drawing.Drawing2D.Rectangle
+ public Matrix(Rectangle rect , Point[] plgpts)
+ {
+ // TODO
+ }
+ */
+
+ /* TODO: depends on System.Drawing.Drawing2D.RectangleF
+ public Matrix(RectangleF rect , PointF[] pa)
+ {
+ // TODO
+ }
+ */
+ public Matrix(float m11, float m12,
+ float m21, float m22,
+ float dx, float dy)
+ {
+ m[0] = m11; m[1] = m12;
+ m[2] = m21; m[3] = m22;
+ m[4] = dx; m[5] = dy;
+ }
+
+ // properties
+ public float[] Elements
+ {
+ get { return m; }
+ }
+
+ public bool IsIdentity
+ {
+ get
+ {
+ if ( (m[0] == 1.0f) && (m[1] == 0.0f) &&
+ (m[2] == 0.0f) && (m[3] == 1.0f) &&
+ (m[4] == 0.0f) && (m[5] == 0.0f) )
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public bool IsInvertible
+ {
+ get
+ {
+ // matrix M is invertible if det(M) != 0
+ float det = m[0] * m[3] - m[2] * m[1];
+ if (det != 0.0f) return true;
+ else return false;
+ }
+ }
+
+ public float OffsetX
+ {
+ get { return m[4]; }
+ }
+
+ public float OffsetY
+ {
+ get { return m[5]; }
+ }
+
+ // methods
+ public Matrix Clone()
+ {
+ return new Matrix(m[0], m[1], m[2], m[3], m[4], m[5]);
+ }
+
+ public void Dispose() { }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Matrix)
+ {
+ float[] a = ((Matrix)obj).Elements;
+ if ( m[0] == a[0] && m[1] == a[1] &&
+ m[2] == a[2] && m[3] == a[3] &&
+ m[4] == a[4] && m[5] == a[5] )
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ~Matrix() {}
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct BitConverter
+ {
+ [FieldOffset(0)] public float f;
+ [FieldOffset(0)] public int i;
+ }
+
+ public override int GetHashCode()
+ {
+ BitConverter b;
+ // compiler is not smart
+ b.i = 0;
+ int h = 0;
+ for (int i = 0; i < 6; i++)
+ {
+ b.f = m[i];
+ h ^= b.i >> i;
+ }
+ return h;
+ }
+
+ public void Invert()
+ {
+ float det = m[0] * m[3] - m[2] * m[1];
+ if (det != 0.0f) // if invertible
+ {
+ float[] r =
+ {
+ m[3] / det,
+ -m[1] / det,
+ -m[2] / det,
+ m[0] / det,
+ (-m[3] * m[4] + m[1] * m[5]) / det,
+ (m[2] * m[4] - m[0] * m[5]) / det
+ };
+ m = r;
+ }
+ }
+
+ public void Multiply(Matrix matrix)
+ {
+ Multiply(matrix, MatrixOrder.Prepend);
+ }
+
+ public void Multiply(Matrix matrix, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = matrix * this
+ float[] p = matrix.Elements;
+ float[] r0 =
+ {
+ p[0] * m[0] + p[1] * m[2],
+ p[0] * m[1] + p[1] * m[3],
+ p[2] * m[0] + p[3] * m[2],
+ p[2] * m[1] + p[3] * m[3],
+ p[4] * m[0] + p[5] * m[2] + m[4],
+ p[4] * m[1] + p[5] * m[3] + m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * matrix
+ float[] a = matrix.Elements;
+ float[] r1 =
+ {
+ m[0] * a[0] + m[1] * a[2],
+ m[0] * a[1] + m[1] * a[3],
+ m[2] * a[0] + m[3] * a[2],
+ m[2] * a[1] + m[3] * a[3],
+ m[4] * a[0] + m[5] * a[2] + a[4],
+ m[4] * a[1] + m[5] * a[3] + a[5]
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void Reset()
+ {
+ m[0] = 1.0f; m[1] = 0.0f;
+ m[2] = 0.0f; m[3] = 1.0f;
+ m[4] = 0.0f; m[5] = 0.0f;
+ }
+
+ public void Rotate(float angle)
+ {
+ Rotate(angle, MatrixOrder.Prepend);
+ }
+
+ public void Rotate(float angle, MatrixOrder order)
+ {
+ angle *= (float)(Math.PI / 180.0); // degrees to randians
+ float cos = (float)Math.Cos(angle);
+ float sin = (float)Math.Sin(angle);
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = rotation * this
+ float[] r0 =
+ {
+ cos * m[0] + sin * m[2],
+ cos * m[1] + sin * m[3],
+ -sin * m[0] + cos * m[2],
+ -sin * m[1] + cos * m[3],
+ m[4],
+ m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * rotation
+ float[] r1 =
+ {
+ m[0] * cos + m[1] * -sin,
+ m[0] * sin + m[1] * cos,
+ m[2] * cos + m[3] * -sin,
+ m[2] * sin + m[3] * cos,
+ m[4] * cos + m[5] * -sin,
+ m[4] * sin + m[5] * cos
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void RotateAt(float angle, PointF point)
+ {
+ RotateAt(angle, point, MatrixOrder.Prepend);
+ }
+
+ public void RotateAt(float angle, PointF point, MatrixOrder order)
+ {
+ angle *= (float)(Math.PI / 180.0); // degrees to randians
+ float cos = (float)Math.Cos(angle);
+ float sin = (float)Math.Sin(angle);
+ float e4 = -point.X * cos + point.Y * sin + point.X;
+ float e5 = -point.X * sin - point.Y * cos + point.Y;
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = rotation * this
+ float[] r0 =
+ {
+ cos * m[0] + sin * m[2],
+ cos * m[1] + sin * m[3],
+ -sin * m[0] + cos * m[2],
+ -sin * m[1] + cos * m[3],
+ e4 * m[0] + e5 * m[2] + m[4],
+ e4 * m[1] + e5 * m[3] + m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * rotation
+ float[] r1 =
+ {
+ m[0] * cos + m[1] * -sin,
+ m[0] * sin + m[1] * cos,
+ m[2] * cos + m[3] * -sin,
+ m[2] * sin + m[3] * cos,
+ m[4] * cos + m[5] * -sin + e4,
+ m[4] * sin + m[5] * cos + e5
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void Scale(float scaleX, float scaleY)
+ {
+ Scale(scaleX, scaleY, MatrixOrder.Prepend);
+ }
+
+ public void Scale(float scaleX, float scaleY, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = scale * this
+ m[0] *= scaleX; m[1] *= scaleX;
+ m[2] *= scaleY; m[3] *= scaleY;
+ break;
+ case MatrixOrder.Append:
+ // this = this * scale
+ m[0] *= scaleX; m[1] *= scaleY;
+ m[2] *= scaleX; m[3] *= scaleY;
+ m[4] *= scaleX; m[5] *= scaleY;
+ break;
+ }
+ }
+
+ public void Shear(float shearX, float shearY)
+ {
+ Shear(shearX, shearY, MatrixOrder.Prepend);
+ }
+
+ // LAMESPEC: quote from beta 2 sdk docs: "[To be supplied!]"
+ //
+ // assuming transformation matrix:
+ //
+ // (1 shearY 0)
+ // (shearX 1 0)
+ // (0 0 1)
+ //
+ public void Shear(float shearX, float shearY, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = shear * this
+ float[] r0 =
+ {
+ m[0] + shearY * m[2],
+ m[1] + shearY * m[3],
+ shearX * m[0] + m[2],
+ shearX * m[1] + m[3],
+ m[4],
+ m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * shear
+ float[] r1 =
+ {
+ m[0] + m[1] * shearX,
+ m[0] * shearY + m[1],
+ m[2] + m[3] * shearX,
+ m[2] * shearY + m[3],
+ m[4] + m[5] * shearX ,
+ m[4] * shearY + m[5]
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void TransformPoints(Point[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = (float)pts[i].X;
+ float y = (float)pts[i].Y;
+ pts[i].X = (int)(x * m[0] + y * m[2] + m[4]);
+ pts[i].Y = (int)(x * m[1] + y * m[3] + m[5]);
+ }
+ }
+
+ public void TransformPoints(PointF[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = pts[i].X;
+ float y = pts[i].Y;
+ pts[i].X = x * m[0] + y * m[2] + m[4];
+ pts[i].Y = x * m[1] + y * m[3] + m[5];
+ }
+ }
+
+ public void TransformVectors(Point[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = (float)pts[i].X;
+ float y = (float)pts[i].Y;
+ pts[i].X = (int)(x * m[0] + y * m[2]);
+ pts[i].Y = (int)(x * m[1] + y * m[3]);
+ }
+ }
+
+ public void TransformVectors(PointF[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = pts[i].X;
+ float y = pts[i].Y;
+ pts[i].X = x * m[0] + y * m[2];
+ pts[i].Y = x * m[1] + y * m[3];
+ }
+ }
+
+ public void Translate(float offsetX, float offsetY)
+ {
+ Translate(offsetX, offsetY, MatrixOrder.Prepend);
+ }
+
+ public void Translate(float offsetX, float offsetY, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = translation * this
+ m[4] = offsetX * m[0] + offsetY * m[2] + m[4];
+ m[5] = offsetX * m[1] + offsetY * m[3] + m[5];
+ break;
+ case MatrixOrder.Append:
+ // this = this * translation
+ m[4] += offsetX;
+ m[5] += offsetY;
+ break;
+ }
+ }
+
+ // LAMESPEC: quote from beta 2 sdk docs: "[To be supplied!]"
+// [MonoTODO]
+ public void VectorTransformPoints(Point[] pts)
+ {
+ // TODO
+ }
+
+ // some simple test (TODO: remove)
+ /*
+ public static void Main()
+ {
+ PointF[] p = {new PointF(1.0f, 2.0f)};
+ Console.WriteLine("(" + p[0].X + " " + p[0].Y + ")");
+ Matrix m = new Matrix();
+
+ m.Translate(1.0f, 1.0f);
+ m.Scale(2.0f, 2.0f);
+ m.Rotate(180.0f);
+
+ m.TransformPoints(p);
+ Console.WriteLine("(" + p[0].X + " " + p[0].Y + ")");
+ m.Invert();
+ m.TransformPoints(p);
+ Console.WriteLine("(" + p[0].X + " " + p[0].Y + ")");
+
+ Matrix a = new Matrix(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
+ Matrix b = new Matrix(2.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f);
+
+ Console.WriteLine("h(a) = " + a.GetHashCode());
+ Console.WriteLine("h(b) = " + b.GetHashCode());
+ }
+ */
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs
new file mode 100644
index 00000000000..241b2842465
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.Drawing2D.MatrixOrder.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for MatrixOrder.
+ /// </summary>
+ public enum MatrixOrder {
+ Append,
+ Prepend
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs
new file mode 100644
index 00000000000..168cf90ba31
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathData.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.PathData.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for PathData.
+ /// </summary>
+ public class PathData
+ {
+ public PathData()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs
new file mode 100644
index 00000000000..f40b12f6ddb
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.PathGradientBrush.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for PathGradientBrush.
+ /// </summary>
+ public class PathGradientBrush
+ {
+ public PathGradientBrush()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs
new file mode 100644
index 00000000000..d7c7eaa1eb9
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs
@@ -0,0 +1,26 @@
+//
+// System.Drawing.Drawing2D.PathPointType.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for PathPointType.
+ /// </summary>
+ public enum PathPointType {
+ Bezier,
+ Bezier3,
+ CloseSubpath,
+ DashMode,
+ Line,
+ PathMarker,
+ PathTypeMask,
+ Start
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
new file mode 100755
index 00000000000..eac30272a8e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Drawing2D.PenAlignment.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing.Drawing2D {
+
+ public enum PenAlignment {
+ Center = 0,
+ Inset = 1,
+ Outset = 2,
+ Left = 3,
+ Right =4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs
new file mode 100644
index 00000000000..4a047f64cc0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs
@@ -0,0 +1,23 @@
+//
+// System.Drawing.Drawing2D.PenType.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for PenType.
+ /// </summary>
+ public enum PenType {
+ HatchFill,
+ LinearGradient,
+ PathGradient,
+ SolidColor,
+ TextureFill
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs
new file mode 100644
index 00000000000..ce39b1049d5
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.PixelOffsetMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for PixelOffsetMode.
+ /// </summary>
+ public enum PixelOffsetMode {
+ Default,
+ Half,
+ HighQuality,
+ HighSpeed,
+ Invalid,
+ None
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs
new file mode 100644
index 00000000000..b91df06140d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.Drawing2D.QualityMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for QualityMode.
+ /// </summary>
+ public enum QualityMode {
+ Default,
+ Hight,
+ Invalid,
+ Low
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/RegionData.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/RegionData.cs
new file mode 100644
index 00000000000..83dcafab301
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/RegionData.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Drawing2D.RegionData.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D
+{
+ /// <summary>
+ /// Summary description for RegionData.
+ /// </summary>
+ public class RegionData
+ {
+ public RegionData()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs
new file mode 100644
index 00000000000..0c9d0eadfeb
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs
@@ -0,0 +1,24 @@
+//
+// System.Drawing.Drawing2D.SmoothingMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for SmoothingMode.
+ /// </summary>
+ public enum SmoothingMode {
+ AntiAlias,
+ Default,
+ HighQuality,
+ HighSpeed,
+ Invalid,
+ None
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs
new file mode 100644
index 00000000000..0920ce8f92d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs
new file mode 100644
index 00000000000..89fec37a0b1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.Drawing2D.WarpMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for WarpMode.
+ /// </summary>
+ public enum WarpMode {
+ Bilinear,
+ Perspective
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs
new file mode 100644
index 00000000000..b76b166de71
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs
@@ -0,0 +1,23 @@
+//
+// System.Drawing.Drawing2D.WrapMode.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Drawing2D {
+ /// <summary>
+ /// Summary description for WrapMode.
+ /// </summary>
+ public enum WrapMode {
+ Clamp,
+ Tile,
+ TileFlipX,
+ TileFlipXY,
+ TileFlipY
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs
new file mode 100755
index 00000000000..d072cde7eb0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs
@@ -0,0 +1,79 @@
+//
+// System.Drawing.Imaging.BitmapData.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing.Imaging
+{
+ public sealed class BitmapData {
+ int width, height, stride, reserved;
+ PixelFormat pixel_format;
+ IntPtr address;
+
+ public int Height {
+ get {
+ return height;
+ }
+
+ set {
+ height = value;
+ }
+ }
+
+ public int Width {
+ get {
+ return width;
+ }
+
+ set {
+ width = value;
+ }
+ }
+
+ public PixelFormat PixelFormat {
+ get {
+ return pixel_format;
+ }
+
+ set {
+ pixel_format = value;
+ }
+ }
+
+ public int Reserved {
+ get {
+ return reserved;
+ }
+
+ set {
+ reserved = value;
+ }
+ }
+
+ public IntPtr Scan0 {
+ get {
+ return address;
+ }
+
+ set {
+ address = value;
+ }
+ }
+
+ public int Stride {
+ get {
+ return stride;
+ }
+
+ set {
+ stride = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
new file mode 100644
index 00000000000..e3ae2b6fd6e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
@@ -0,0 +1,66 @@
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+* PropertyItem.cs t
+* MetaHeader.cs t
+* MetafileHeader.cs t
+* Metafile.cs t
+* ImageFormat.cs t
+* ImageCodecInfo.cs t
+* ColorMatrix.cs t
+* ColorMap.cs t
+* WmfPlaceableFileHeader.cs t
+* Added todos back
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+ * checked in for Everaldo Canuto (everaldo.canuto@bol,com.br)
+ * BitmapData.cs
+ * ColorAdjustType.cs
+ * ColorChannelFlag.cs
+ * ColorMap.cs
+ * ColorMapType.cs
+ * ColorMatrix.cs
+ * ColorMatrixFlag.cs
+ * ColorMode.cs
+ * EmfPlusRecordType.cs
+ * EmfType.cs
+ * EncoderParameterValueType.cs
+ * EncoderValue.cs
+ * ImageCodecFlags.cs
+ * ImageCodecInfo.cs
+ * ImageFlags.cs
+ * ImageFormat.cs
+ * ImageLockMode.cs
+ * MetafileFrameUnit.cs
+ * MetafileHeader.cs
+ * MetaHeader.cs
+ * PaletteFlags.cs
+ * PixelFormat.cs
+ * PlayRecordCallback.cs
+ * PropertyItem.cs
+ * WmfPlaceableFileHeader.cs
+ * Added null classes for most/all classes, Many stubs, and some implmentation
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * ColorPalette.cs
+ * FrameDimension.cs
+ * Metafile.cs
+ * Added stubs, implmentation
+
+2002-05-03 Mike Kestner <mkestner@speakeasy.net>
+
+ * Metafile.cs : Use System.IO. Fix exception typos.
+
+2002-04-27 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Metafile.cs: Copyright now holds Ximian.
+
+2002-04-21 Dennis Hayes <dennish@raytek.com>
+
+ * corrected emum values.
+
+2002-04-14 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * ChangeLog: created.
+ * Metafile.cs: Added. Wrote some ctors. No impl done, yet.
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
new file mode 100644
index 00000000000..d445a9b5afe
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
@@ -0,0 +1,19 @@
+//
+// System.Drawing.Imaging.ColorAdjustType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorAdjustType {
+ Any = 6,
+ Bitmap = 1,
+ Brush = 2,
+ Count = 5,
+ Default = 0,
+ Pen = 3,
+ Text = 4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
new file mode 100644
index 00000000000..82f07834b68
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.Imaging.ColorChannelFlag.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorChannelFlag {
+ ColorChannelC = 0,
+ ColorChannelK = 3,
+ ColorChannelLast = 4,
+ ColorChannelM = 1,
+ ColorChannelY = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs
new file mode 100644
index 00000000000..14a2ccc77d5
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs
@@ -0,0 +1,37 @@
+//
+// System.Drawing.Imaging.ColorMap.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class ColorMap {
+
+ // constructors
+ [MonoTODO]
+ public ColorMap() {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public Color NewColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Color OldColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
new file mode 100644
index 00000000000..0943f290da2
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
@@ -0,0 +1,14 @@
+//
+// System.Drawing.Imaging.ColorMapType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorMapType{//check
+ Brush = 1,
+ Default = 0
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs
new file mode 100644
index 00000000000..c4948317c33
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs
@@ -0,0 +1,305 @@
+//
+// System.Drawing.Imaging.xxx.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class ColorMatrix {
+
+ // constructors
+ [MonoTODO]
+ public ColorMatrix() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ColorMatrix(float[][] newColorMatrix) {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public float this[int row, int column] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix00 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix01 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix02 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix03 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix04 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix05 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix06 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix07 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix08 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix09 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix10 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix11 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix12 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix13 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix14 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix15 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix16 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix17 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix18 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix19 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix20 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix21 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix22 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix23 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix24 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix25 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix26 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix27 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix28 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix29 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix30 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix31 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix32 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix33 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix34 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix35 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix36 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix37 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix38 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix39 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix40 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix41 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix42 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix43 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float Matrix44 {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs
new file mode 100644
index 00000000000..f244e02447f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Imaging.ColorMatrixFlag.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorMatrixFlag{
+ AltGrays = 2,
+ Default = 0,
+ SkipGrays = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
new file mode 100644
index 00000000000..91872fa6247
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
@@ -0,0 +1,14 @@
+//
+// System.Drawing.Imaging.ColorMode.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorMode {
+ Argb32Mode = 0,
+ Argb64Mode = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs
new file mode 100755
index 00000000000..f1ade643a8f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs
@@ -0,0 +1,44 @@
+//
+// System.Drawing.Imaging.ColorPalette.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com
+//
+
+using System;
+using System.Drawing;
+namespace System.Drawing.Imaging
+{
+ public sealed class ColorPalette {
+ // 0x1: the color values in the array contain alpha information
+ // 0x2: the color values are grayscale values.
+ // 0x4: the colors in the array are halftone values.
+
+ int flags;
+ Color [] entries;
+
+ //
+ // There is no public constructor, this will be used somewhere in the
+ // drawing code
+ //
+ internal ColorPalette ()
+ {
+ flags = 0;
+ entries = new Color [0];
+ }
+
+ public Color [] Entries {
+ get {
+ return entries;
+ }
+ }
+
+ public int Flags {
+ get {
+ return flags;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs
new file mode 100644
index 00000000000..052604968e7
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs
@@ -0,0 +1,262 @@
+//
+// System.Drawing.Imaging.EmfPlusRecordType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ 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,
+ 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,
+ EmfPolyPolygon16 = 86,
+ EmfPolyPolyline = 4,
+ EmfPolyline16 = 87,
+ EmfPolyPolygon = 8,
+ EmfPolyPolyline16 = 91,
+ 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,
+ 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,
+ EmfPolyLineTo = 6,
+ EmfPolylineTo16 = 89,
+ WmfDibStretchBlt = 68417,
+ WmfEllipse = 66584,
+ WmfEscape = 67110,
+ WmfExcludeClipRect = 66581,
+ WmfExtFloodFill = 66888,
+ WmfExtTextOut = 68146
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
new file mode 100644
index 00000000000..f02a42f4923
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Imaging.EmfType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum EmfType {
+ EmfOnly = 3,
+ EmfPlusDual = 5,
+ EmfPlusOnly = 4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
new file mode 100644
index 00000000000..6a0071ad20d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.Imaging.EncoderParameterValueType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum EncoderParameterValueType {
+ ValueTypeAscii = 2,
+ ValueTypeByte = 1,
+ ValueTypeLong = 4,
+ ValueTypeLongRange = 6,
+ ValueTypeRational = 5,
+ ValueTypeRationalRange = 8,
+ ValueTypeShort = 3,
+ ValueTypeUndefined = 7
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
new file mode 100644
index 00000000000..0e51a47031e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
@@ -0,0 +1,36 @@
+//
+// System.Drawing.Imaging.EncoderValue.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ 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
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
new file mode 100644
index 00000000000..fa6b51e311b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
@@ -0,0 +1,60 @@
+// created on 21.02.2002 at 17:06
+//
+// FrameDimension.cs
+//
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+// Dennis Hayes (dennish@raytek.com)
+//
+
+namespace System.Drawing.Imaging {
+
+using System;
+
+public sealed class FrameDimension {
+
+ // constructor
+ public FrameDimension (Guid guid) {}
+
+ //properties
+ public Guid Guid {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static FrameDimension Page {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static FrameDimension Resolution {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static FrameDimension Time {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //methods
+ public override bool Equals (object o) {
+ throw new NotImplementedException ();
+ }
+
+ public override int GetHashCode () {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ //destructor
+ ~FrameDimension () {}
+}
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs
new file mode 100644
index 00000000000..3fac6936c43
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs
@@ -0,0 +1,34 @@
+//
+// System.Windows.Forms.FormBorderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Drawing;
+
+namespace System.Drawing.Imaging
+{
+ /// <summary>
+ /// Summary description for ImageAttributes.
+ /// </summary>
+ public class ImageAttributes {
+ public ImageAttributes() {
+ }
+
+ //Clears the color keys for all GDI+ objects
+ public void ClearColorKey(){
+ }
+
+ //Sets the color keys for all GDI+ objects
+ public void SetColorKey(Color colorLow, Color colorHigh){
+
+ }
+
+ ~ImageAttributes() {
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
new file mode 100644
index 00000000000..235ebed2fc0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Imaging.ImageCodecFlags.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ImageCodecFlags {
+ BlockingDecode = 32,
+ Builtin = 65536,
+ Decoder = 2,
+ Encoder = 1,
+ SeekableEncode = 16,
+ SupportBitmap = 4,
+ SupportVector = 8,
+ System = 131072,
+ User = 262144
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs
new file mode 100644
index 00000000000..9180b01e44c
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs
@@ -0,0 +1,109 @@
+//
+// System.Drawing.Imaging.ImageCodecInfo.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ //[ComVisible(false)]
+ public sealed class ImageCodecInfo {
+
+ // methods
+ [MonoTODO]
+ //[ComVisible(false)]
+ public static ImageCodecInfo[] GetImageDecoders() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public static ImageCodecInfo[] GetImageEncoders() {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ //[ComVisible(false)]
+ public Guid Clsid {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public string CodecName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public string DllName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public string FilenameExtension {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public ImageCodecFlags Flags {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public string FormatDescription {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public Guid FormatID {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public string MimeType {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public byte[][] SignatureMasks {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public byte[][] SignaturePatterns {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ //[ComVisible(false)]
+ public int Version {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
new file mode 100644
index 00000000000..61e0ec878a1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
@@ -0,0 +1,26 @@
+//
+// System.Drawing.Imaging.ImageFlags.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ 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
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs
new file mode 100644
index 00000000000..72d8ea26e18
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs
@@ -0,0 +1,95 @@
+//
+// System.Drawing.Imaging.ImageFormat.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class ImageFormat {
+
+ // constructors
+ [MonoTODO]
+ public ImageFormat(Guid guid) {
+ throw new NotImplementedException ();
+ }
+
+ // methods
+ [MonoTODO]
+ public override bool Equals(object o) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public static ImageFormat Bmp {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Emf {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Exif {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Gif {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Guid Guid {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Icon {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Jpeg {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat MemoryBmp {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Png {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Tiff {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static ImageFormat Wmf {
+ get { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
new file mode 100644
index 00000000000..14b720acb2b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.Imaging.ImageLockMode.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ImageLockMode {
+ ReadOnly = 1,
+ ReadWrite = 3,
+ UserInputBuffer = 4,
+ WriteOnly = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs
new file mode 100644
index 00000000000..5089aa82573
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs
@@ -0,0 +1,66 @@
+//
+// System.Drawing.Imaging.MetaHeader.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class MetaHeader {
+
+ // constructors
+ [MonoTODO]
+ public MetaHeader() {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public short HeaderSize {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int MaxRecord {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short NoObjects {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short NoParameters {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Size {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short Type {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short Version {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
new file mode 100644
index 00000000000..20961536be2
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
@@ -0,0 +1,112 @@
+//
+// System.Drawing.Imaging.Metafile.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class Metafile {// : Image {
+
+ // constructors
+ [MonoTODO]
+ public Metafile (Stream stream) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (string filename) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr henhmetafile, bool deleteEmf) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHtc, EmfType emfType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHtc, Rectangle frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHtc, RectangleF frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ //[MonoTODO]
+ //public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) {
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHtc) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (String fileName, IntPtr referenceHtc) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHdc, EmfType emfType, string description) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) {
+ throw new NotImplementedException ();
+ }
+
+// [MonoTODO]
+// public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) {
+// throw new NotImplementedException ();
+// }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHdc, EmfType type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (string fileName, IntPtr referenceHdc, EmfType type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ // methods
+ // properties
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
new file mode 100644
index 00000000000..97d59c6c0c1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
@@ -0,0 +1,18 @@
+//
+// System.Drawing.Imaging.MetafileFrameUnit.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum MetafileFrameUnit {
+ Document = 5,
+ GdiCompatible = 7,
+ Inch = 4,
+ Millimeter = 6,
+ Pixel = 2,
+ Point = 3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs
new file mode 100644
index 00000000000..36ffa15d1ae
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs
@@ -0,0 +1,109 @@
+//
+// System.Drawing.Imaging.MetafileHeader.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class MetafileHeader {
+
+ // methods
+ [MonoTODO]
+ public bool IsDisplay() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsEmf() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsEmfOrEmfPlus() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsEmfPlus() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsEmfPlusDual() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsEmfPlusOnly() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsWmf() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsWmfPlaceable() {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public Rectangle Bounds {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float DpiX {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public float DpiY {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int EmfPlusHeaderSize {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int LogicalDpiX {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int LogicalDpiY {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int MetafileSize {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public MetafileType Type {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Version {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public MetaHeader WmfHeader {
+ get { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs
new file mode 100644
index 00000000000..7c234ce5259
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.Imaging.MetafileType
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Drawing.Imaging
+{
+ public enum MetafileType
+ {
+ Invalid = 0,
+ Wmf = 1,
+ WmfPlaceable = 2,
+ Emf = 3,
+ EmfPlusOnly = 4,
+ EmfPlusDual = 5
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
new file mode 100644
index 00000000000..007313d0622
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Imaging.PaletteFlags.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum PaletteFlags {
+ GrayScale = 2,
+ Halftone = 4,
+ HasAlpha = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
new file mode 100644
index 00000000000..abc675c4739
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
@@ -0,0 +1,39 @@
+// created on 20.02.2002 at 21:18
+//
+// Image.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+// Dennis Hayes
+// dennish@raytek.com
+//
+//
+namespace System.Drawing.Imaging {
+
+ 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 //shows up in enumcheck as second "dontcare".
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs
new file mode 100644
index 00000000000..ee39962c696
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs
@@ -0,0 +1,19 @@
+//
+// System.Drawing.Imaging.PlayRecordCallback.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ [Serializable]
+ public delegate void PlayRecordCallback(
+ EmfPlusRecordType recordType,
+ int flags,
+ int dataSize,
+ IntPtr recordData
+ );
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs
new file mode 100644
index 00000000000..d65c278f02e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs
@@ -0,0 +1,42 @@
+//
+// System.Drawing.Imaging.PropertyItem.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class PropertyItem {
+
+ // properties
+ [MonoTODO]
+ public int Id {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Len {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short Type {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public byte[] Value {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs
new file mode 100644
index 00000000000..06d644d1cbd
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs
@@ -0,0 +1,84 @@
+//
+// System.Drawing.Imaging.WmfPlaceableFileHeader.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto
+// eMail: everaldo.canuto@bol.com.br
+// Dennis Hayes (dennish@raytek.com)
+//
+using System;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class WmfPlaceableFileHeader {
+
+ // constructors
+ [MonoTODO]
+ public WmfPlaceableFileHeader() {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public short BboxBottom {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short BboxLeft {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short BboxRight {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short BboxTop {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short Checksum {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short Hmf {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public short Inch {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Key {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Reserved {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Id {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs b/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs
new file mode 100644
index 00000000000..a158382eea3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.Duplex.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum Duplex {
+ Default = -1,
+ Horizontal = 3,
+ Simplex = 1,
+ Vertical = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterExecption.cs b/mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterExecption.cs
new file mode 100644
index 00000000000..9538928d1e4
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterExecption.cs
@@ -0,0 +1,30 @@
+//
+// System.Drawing.InvalidPrinterExecption.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for InvalidPrinterExecption.
+ /// </summary>
+ public class InvalidPrinterExecption : SystemException {
+ private PrinterSettings settings;
+
+ public InvalidPrinterExecption(PrinterSettings settings) {
+ this.settings = settings;
+ }
+ protected InvalidPrinterExecption(SerializationInfo info, StreamingContext context) {
+ throw new NotImplementedException ();
+ }
+ public override void GetObjectData(SerializationInfo info, StreamingContext context) {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs b/mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs
new file mode 100644
index 00000000000..0e2f7e1d715
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs
@@ -0,0 +1,93 @@
+//
+// System.Drawing.Margins.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing {
+ /// <summary>
+ /// Summary description for Margins.
+ /// </summary>
+
+ public class Margins {// : IClonable {
+ /// <summary>
+ /// left margin in hundredths of an inch
+ /// </summary>
+ int left;
+ /// <summary>
+ /// right margin in hundredths of an inch
+ /// </summary>
+ int right;
+ /// <summary>
+ /// top margin in hundredths of an inch
+ /// </summary>
+ int top;
+ /// <summary>
+ /// bottom margin in hundredths of an inch
+ /// </summary>
+ int bottom;
+
+ public Margins() {
+ left = 100;
+ right = 100;
+ top = 100;
+ bottom = 100;
+ }
+ public Margins(int left, int right, int top, int bottom) {
+ //Verify parameters
+ if(left < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "left");
+ if(right < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "right");
+ if(top < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "top");
+ if(bottom < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "bottom");
+ //Set proprities
+ this.left = left;
+ this.right = right;
+ this.top = top;
+ this.bottom = bottom;
+ }
+
+ public int Left{
+ get{
+ return left;
+ }
+ set{
+ left = value;
+ }
+ }
+
+ public int Right{
+ get{
+ return right;
+ }
+ set{
+ right = value;
+ }
+ }
+
+ public int Top{
+ get{
+ return top;
+ }
+ set{
+ top = value;
+ }
+ }
+
+ public int Bottom{
+ get{
+ return bottom;
+ }
+ set{
+ bottom = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/MarginsConverter.cs b/mcs/class/System.Drawing/System.Drawing.Printing/MarginsConverter.cs
new file mode 100644
index 00000000000..515d64a7fee
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/MarginsConverter.cs
@@ -0,0 +1,50 @@
+//
+// System.Drawing.MarginsConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing {
+ /// <summary>
+ /// Summary description for MarginsConverter.
+ /// </summary>
+ public class MarginsConverter {//: ExpandableObjectConverter {
+ public MarginsConverter() {
+ }
+ #region Methods
+// [MonoTODO]
+// public override bool CanConvertFrom(ITypeDescriptorContext context,Type sourceType) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override bool CanConvertTo(ITypeDescriptorContext context,Type destinationType) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override object ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,object value) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override object ConvertTo(ITypeDescriptorContext context,CultureInfo culture,object value,Type destinationType) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override bool GetStandardValuesSupported(ITypeDescriptorContext context) {
+// throw new NotImplementedException ();
+// }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs
new file mode 100644
index 00000000000..ead02d0b5d2
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs
@@ -0,0 +1,122 @@
+//
+// System.Drawing.PageSettings.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PageSettings.
+ /// </summary>
+ public class PageSettings {//: IClonable
+ //[MonoTODO]
+ public PageSettings()
+ {
+ throw new NotImplementedException ();
+ }
+//props
+ //[MonoTODO]
+// public Rectangle Bounds{
+// get{
+// throw new NotImplementedException ();
+// }
+// set{
+// throw new NotImplementedException ();
+// }
+// }
+ [MonoTODO]
+ public bool Color{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Landscape {
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Margins Margins{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public PaperSize PaperSize{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public PaperSource PaperSource{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public PrinterResolution PrinterResolution{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ //[MonoTODO]
+// public PrinterSetting PrinterSetting{
+// get{
+// throw new NotImplementedException ();
+// }
+// set{
+// throw new NotImplementedException ();
+// }
+// }
+ //[ComVisible(false)]
+ [MonoTODO]
+ public object Clone(){
+ throw new NotImplementedException ();
+ }
+
+ //[ComVisible(false)]
+ [MonoTODO]
+ public void CopyToHdevmode(IntPtr hdevmode){
+ throw new NotImplementedException ();
+ }
+
+ //[ComVisible(false)]
+ [MonoTODO]
+ public void SetHdevmode(IntPtr hdevmode){
+ throw new NotImplementedException ();
+ }
+
+ //[ComVisible(false)]
+ [MonoTODO]
+ public override string ToString(){
+ //FIXME: //THIS is wrong! This method is to be overridden!
+ return base.ToString();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs
new file mode 100644
index 00000000000..137a0da4a9b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs
@@ -0,0 +1,125 @@
+//
+// System.Drawing.PaperKind.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ 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,
+ B5Extra,
+ B5JisRotated = 80,
+ B5Transverse = 61,
+ B6Envelope = 35,
+ B6Jis = 88,
+ B6JisRotated = 89,
+ BPlus = 58,
+ C3Envelope = 29,
+ C4Envelope = 30,
+ C5Envelope = 34,
+ C65Envelope = 32,
+ CSheet = 24,
+ Custom = 0,
+ DLEnvelope = 27,
+ DSheet = 25,
+ ESheet = 26,
+ Executive = 7,
+ Folio = 14,
+ GermanLegalFanfold = 41,
+ GermanStandardFanfold = 40,
+ InviteEnvelope = 47,
+ IsoB4 = 42,
+ JapaneseDoublePostcard = 69,
+ JapaneseDoublePostcardRotated = 81,
+ 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
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs
new file mode 100644
index 00000000000..c9d5d29dec2
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs
@@ -0,0 +1,65 @@
+//
+// System.Drawing.PaperSize.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PaperSize.
+ /// </summary>
+ public class PaperSize
+ {
+ string name;
+ int width;
+ int height;
+ //Kind kind;
+ public PaperSize(string name, int width, int height)
+ {
+ this.width = width;
+ this.height = height;
+ this.name = name;
+ }
+ public int Width{
+ get{
+ return width;
+ }set
+ {
+ width = value;
+ }
+ }
+ public int Height{
+ get{
+ return height;
+ }set
+ {
+ height = value;
+ }
+ }
+
+ public string PaperName{
+ get{
+ return name;
+ }
+ set{
+ name = value;
+ }
+ }
+
+// public PaperKind Kind{
+// get{
+// return kind;
+// }
+// }
+
+ [MonoTODO]
+ public override string ToString(){
+ return base.ToString();//FIXME: must override!
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs
new file mode 100644
index 00000000000..cef08c1345a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs
@@ -0,0 +1,33 @@
+//
+// System.Drawing.PaperSource.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PaperSource.
+ /// </summary>
+ public class PaperSource
+ {
+ [MonoTODO]
+ public PaperSourceKind Kind{
+ get {
+ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public string SourceName{
+ get {
+ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override string ToString(){
+ return SourceName;
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceCollection.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceCollection.cs
new file mode 100644
index 00000000000..2e5a541e427
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceCollection.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.PaperSourceCollection.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PaperSourceCollection.
+ /// </summary>
+ public class PaperSourceCollection
+ {
+ public PaperSourceCollection()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs
new file mode 100644
index 00000000000..a8cd9e0e68e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs
@@ -0,0 +1,26 @@
+//
+// System.Drawing.PaperSourceKind.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ 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
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperUnitConvert.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperUnitConvert.cs
new file mode 100644
index 00000000000..1511308f58c
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperUnitConvert.cs
@@ -0,0 +1,43 @@
+//
+// System.Drawing.PaperUnitConvert.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PaperUnitConvert.
+ /// </summary>
+ public sealed class PaperUnitConvert
+ {
+// [MonoTODO]
+// public static double Convert(double value, PrinterUint frmUnit, PrinterUnit toUnit){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static int Convert(int value, PrinterUint frmUnit, PrinterUnit toUnit){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static Margins Convert(Margins value, PrinterUint frmUnit, PrinterUnit toUnit){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static Point Convert(Point value, PrinterUint frmUnit, PrinterUnit toUnit){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static Rectangle Convert(Rectangle value, PrinterUint frmUnit, PrinterUnit toUnit){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static Size Convert(Size value, PrinterUint frmUnit, PrinterUnit toUnit){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs
new file mode 100644
index 00000000000..9f78619c3df
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs
@@ -0,0 +1,34 @@
+//
+// System.Drawing.PreviewPageInfo.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PreviewPageInfo.
+ /// </summary>
+ public sealed class PreviewPageInfo {
+ //Image image;
+ //Size physicalSize;
+ //public PreviewPageInfo(Image image, Size physicalSize) {
+ // this.image = image;
+ // this.physicalSize = physicalSize;
+ //}
+ //public Image Image {
+ // get{
+ // return image;
+ // }
+ //}
+ //public Size PhysicalSize{
+ // get{
+ // return physicalSize;
+ // }
+ //}
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPrintController.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPrintController.cs
new file mode 100644
index 00000000000..b67ca99df16
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPrintController.cs
@@ -0,0 +1,54 @@
+//
+// System.Drawing.PreviewPrintController.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PreviewPrintController.
+ /// </summary>
+ public class PreviewPrintController : PrintController
+ {
+ private bool useantialias;
+ public PreviewPrintController()
+ {
+ useantialias = false;
+ }
+// //[MonoTODO]
+// public override void OnEndPage(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+// //[MonoTODO]
+// public override void OnStartPrint(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+// //[MonoTODO]
+// public override void OnEndPrint(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+ //[MonoTODO]
+ //public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e){
+ // throw new NotImplementedException ();
+ //}
+
+ public bool UseAntiAlias {
+ get{
+ return useantialias;
+ }
+ set{
+ useantialias = value;
+ }
+ }
+ //[MonoTODO]
+ public PreviewPageInfo [] GetPreviewPageInfo(){
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintController.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintController.cs
new file mode 100644
index 00000000000..481f89a7574
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintController.cs
@@ -0,0 +1,42 @@
+//
+// System.Drawing.PrintController.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrintController.
+ /// </summary>
+ public abstract class PrintController
+ {
+ public PrintController()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ [MonoTODO]
+ public virtual void OnEndPage(PrintDocument document, PrintPageEventArgs e){
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void OnStartPrint(PrintDocument document, PrintEventArgs e){
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void OnEndPrint(PrintDocument document, PrintEventArgs e){
+ throw new NotImplementedException ();
+ }
+ //[MonoTODO]
+ public virtual Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e){
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintDocument.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintDocument.cs
new file mode 100644
index 00000000000..6c52983996e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintDocument.cs
@@ -0,0 +1,105 @@
+//
+// System.Drawing.PrintDocument.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing {
+ /// <summary>
+ /// Summary description for PrintDocument.
+ /// </summary>
+ public class PrintDocument{// : Component {
+ private PageSettings defaultpagesettings;
+ private string documentname;
+ private bool originAtMargins; // .NET V1.1 Beta
+
+ //[MonoTODO]
+ public PrintDocument() {
+ //FIXME: do we need to init defaultpagesetting, or does pagesettings do that?
+ documentname = "Document"; //offical default.
+ }
+ public PageSettings DefaultPageSettings{
+ get{
+ return defaultpagesettings;
+ }
+ set{
+ defaultpagesettings = value;
+ }
+ }
+ /// <summary>
+ /// Name of the document, not the file!
+ /// </summary>
+
+ public string DocumentName{
+ get{
+ return documentname;
+ }
+ set{
+ documentname = value;
+ }
+ }
+ [MonoTODO]
+ public PrintController PrintController{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public PrinterSettings PrinterSettings{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool OriginAtMargins{// .NET V1.1 Beta
+ get{
+ return originAtMargins;
+ }
+ set{
+ originAtMargins = value;
+ }
+ }
+ public void Print(){
+ throw new NotImplementedException ();
+ }
+ public override string ToString(){
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBeginPrint(PrintEventArgs e){
+ //fire the event
+ }
+ [MonoTODO]
+ protected virtual void OnEndPrint(PrintEventArgs e){
+ //fire the event
+ }
+ [MonoTODO]
+ protected virtual void OnPrintPage(PrintEventArgs e){
+ //fire the event
+ }
+ [MonoTODO]
+ protected virtual void OnQueryPageSettings(PrintEventArgs e){
+ //fire the event
+ }
+ [MonoTODO]
+ protected virtual void OnBeginPaint(PrintEventArgs e){
+ //fire the event
+ }
+ public event PrintEventHandler BeginPrint;
+ public event PrintEventHandler EndPrint;
+ public event PrintEventHandler PrintPage;
+ public event PrintEventHandler QuerypageSettings;
+
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventArgs.cs
new file mode 100644
index 00000000000..7f44827f79f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventArgs.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.PrintEventArgs.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+//NOTE: Complete! Aparently just a redifiniton of CancleEventArgs specific to Printing.
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrintEventArgs.
+ /// </summary>
+ public class PrintEventArgs //: CancelEventArgs
+ {
+ public PrintEventArgs()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs
new file mode 100644
index 00000000000..9f238f789ad
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.PrintEventHandler.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrintEventHandler.
+ /// </summary>
+ public delegate void PrintEventHandler(object sender);//, PrintEventHandlerArgs e);
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventArgs.cs
new file mode 100644
index 00000000000..558aa5b1153
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventArgs.cs
@@ -0,0 +1,75 @@
+//
+// System.Drawing.PrintPageEventArgs.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+using System.Drawing;
+namespace System.Drawing.Printing {
+ /// <summary>
+ /// Summary description for PrintPageEventArgs.
+ /// </summary>
+ public class PrintPageEventArgs : EventArgs {
+ bool cancel;
+ //Graphics graphics;
+ bool hasmorePages;
+ //Rectangle marginBounds;
+ //Rectangle pageBounds;
+ PageSettings pageSettings;
+
+// public PrintPageEventArgs(Graphics graphics, rectangle marginBounds,
+// Rectangle pageBounds, PageSettings pageSettings) {
+// }
+ public bool Cancel {
+ get{
+ return cancel;
+ }
+ set{
+ cancel = value;
+ }
+ }
+// public Graphics Graphics {
+// get{
+// return graphics;
+// }
+// set{
+// graphics = value;
+// }
+// }
+ public bool HasMorePages {
+ get{
+ return HasMorePages;
+ }
+ set{
+ HasMorePages = value;
+ }
+ }
+// public Rectangle MarginBounds {
+// get{
+// return marginBounds;
+// }
+// set{
+// marginBounds = value;
+// }
+// }
+// public Rectangle PageBounds {
+// get{
+// return pageBounds;
+// }
+// set{
+// pageBounds = value;
+// }
+// }
+ public PageSettings PageSettings {
+ get{
+ return pageSettings;
+ }
+ set{
+ pageSettings = value;
+ }
+ }
+}
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs
new file mode 100644
index 00000000000..48d71997f07
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.PrintPageEventHandler.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrintPageEventHandler.
+ /// </summary>
+ public delegate void PrintPageEventHandler(object sender, PrintPageEventArgs e);
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs
new file mode 100644
index 00000000000..a43f9e8bf88
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.PrintRange.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrintRange {
+ AllPages = 0,
+ Selection = 1,
+ SomePages = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs
new file mode 100644
index 00000000000..d0e399331a1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs
@@ -0,0 +1,40 @@
+//
+// System.Drawing.PrinterResolution.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing {
+ /// <summary>
+ /// Summary description for PrinterResolution.
+ /// </summary>
+ public class PrinterResolution {
+ public PrinterResolutionKind kind;
+ public int x;
+ public int y;
+ public PrinterResolution(){
+ x = -1;
+ y = -1;
+ }
+ public int X{
+ get{
+ return x;
+ }
+ }
+ public int Y{
+ get{
+ return y;
+ }
+ }
+// public int Kind{
+// get{
+// return kind;
+// }
+// }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs
new file mode 100644
index 00000000000..7580938c71a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.PrinterResolutionKind.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrinterResolutionKind {
+ Custom = 0,
+ Draft = -1,
+ High = -4,
+ Low = -2,
+ Medium = -3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs
new file mode 100644
index 00000000000..0c645757cf8
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs
@@ -0,0 +1,46 @@
+//
+// System.Drawing.PrinterSettings.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrinterSettings.
+ /// </summary>
+ ///
+ [Serializable]
+ //[ComVisible(false)]
+ public class PrinterSettings {//: IClonable
+ public PrinterSettings()
+ {
+ }
+ // SUBCLASS
+ /// <summary>
+ /// Summary description for PaperSourceCollection.
+ /// </summary>
+ public class PaperSourceCollection {
+ public PaperSourceCollection() {
+ }
+ }
+ /// <summary>
+ /// Summary description for PaperSizeCollection.
+ /// </summary>
+ public class PaperSizeCollection {
+ public PaperSizeCollection() {
+ }
+ }
+ /// <summary>
+ /// Summary description for PrinterResolutionCollection.
+ /// </summary>
+ public class PrinterResolutionCollection {
+ public PrinterResolutionCollection() {
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs
new file mode 100644
index 00000000000..ae4209301cc
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.PrinterUnit.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrinterUnit {
+ Display = 0,
+ HundredthsOfAMillimeter = 2,
+ TenthsOfAMillimeter = 3,
+ ThousandthsOfAnInch = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs
new file mode 100644
index 00000000000..6086d38c0cc
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs
@@ -0,0 +1,44 @@
+//
+// System.Drawing.PrintingPermission.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrintingPermission.
+ /// </summary>
+ ///
+ [Serializable]
+ public sealed class PrintingPermission //: CodeAccessPermission, IUnrestrictedPermission
+ {
+// [MonoTODO]
+// public PrintingPermission(PermissionState state) {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public PrintingPermission(PrintingPermissionLevel PrintingLevel) {
+// throw new NotImplementedException ();
+// }
+ //[MonoTODO]
+// [Serializable]
+// public PrintingPermissionlevel Level{
+// get{
+// throw new NotImplementedException ();
+// }
+// set{
+// throw new NotImplementedException ();
+// }
+// }
+ //[MonoTODO]
+// [Serializable]
+// public override IPermission Copy(){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs
new file mode 100644
index 00000000000..1c46f7d3752
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs
@@ -0,0 +1,42 @@
+//
+// System.Drawing.PrintingPermissionAttribute.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for PrintingPermissionAttribute.
+ /// </summary>
+ ///
+ //[AttributeUsage(AttributeTargets.All)]
+ public sealed class PrintingPermissionAttribute //: CodeAccessSecurityAttribute
+ {
+// [MonoTODO]
+// [AttributeUsage(AttributeTargets.All)]
+// public PrintingPermissionAttribute(SecurityAction action)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// [AttributeUsage(AttributeTargets.All)]
+// public PrintingPermissionLevel Level {
+// get{
+// throw new NotImplementedException ();
+// }
+// set{
+// throw new NotImplementedException ();
+// }
+// }
+// [MonoTODO]
+// [AttributeUsage(AttributeTargets.All)]
+// public override IPermission CreatePermission(){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs
new file mode 100644
index 00000000000..0f77f63bf6b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.PrintingPermissionLevel.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrintingPermissionLevel {
+ AllPrinting = 3,
+ DefaultPrinting = 2,
+ NoPrinting = 0,
+ SafePrinting = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs
new file mode 100644
index 00000000000..aba31dd6edd
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs
@@ -0,0 +1,34 @@
+//
+// System.Drawing.QueryPageSettingsEventArgs.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for QueryPageSettingEventArgs.
+ /// </summary>
+ public class QueryPageSettingsEventArgs : PrintEventArgs
+ {
+ private PageSettings pageSettings;
+
+ public QueryPageSettingsEventArgs(PageSettings pageSettings)
+ {
+ this.pageSettings = pageSettings;
+ }
+ public PageSettings PageSettings {
+ get{
+ return pageSettings;
+ }
+ set{
+ pageSettings = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs
new file mode 100644
index 00000000000..1f1e18c53b8
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.QueryPageSettingsEventHandler.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing
+{
+ /// <summary>
+ /// Summary description for QueryPageSettingsEventHandler.
+ /// </summary>
+ public delegate void QueryPageSettingsEventHandler(object sender, QueryPageSettingsEventArgs e);
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/StandardPrintController.cs b/mcs/class/System.Drawing/System.Drawing.Printing/StandardPrintController.cs
new file mode 100644
index 00000000000..d836f3f8824
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/StandardPrintController.cs
@@ -0,0 +1,37 @@
+//
+// System.Drawing.StandardPrintController.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing.Printing {
+ /// <summary>
+ /// Summary description for StandardPrintController.
+ /// </summary>
+ public class StandardPrintController : PrintController {
+// [MonoTODO]
+// public StandardPrintController() {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override void OnEndPage(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override void OnStartPrint(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override void OnEndPrint(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/changelog b/mcs/class/System.Drawing/System.Drawing.Printing/changelog
new file mode 100644
index 00000000000..fec6044ddbf
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/changelog
@@ -0,0 +1,53 @@
+2002-10-13 DennisHayes <dennish@raytek.com>
+ * PrintDocument
+ * Added OriginAtMargin for .NET V 1.1 compatablity.
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * PageSettings.cs
+ * PaperSize.cs
+ * PaperSource.cs
+ * PrintControler.cs
+ * PrintDocument.cs
+ * PrintingPermission.cs
+ * PrintPageEventHandler.cs
+ * QueryPageSettingEventArgs.cs
+ * QueryPageSettingsEventHandler.cs
+ * added todos back
+ * minor bug fixes
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * Duplex.cs
+ * InvalidPrinterExecption.cs
+ * Margins.cs
+ * MarginsConverter.cs
+ * PageSettings.cs
+ * PaperKind.cs
+ * PaperSize.cs
+ * PaperSource.cs
+ * PaperSourceCollection.cs
+ * PaperSourceKind.cs
+ * PaperUnitConvert.cs
+ * PreviewPageInfo.cs
+ * PreviewPrintControler.cs
+ * PrintControler.cs
+ * PrintDocument.cs
+ * PrinterResolution.cs
+ * PrinterResolutionKind.cs
+ * PrinterSettings.cs
+ * PrinterUnit.cs
+ * PrintEventArgs.cs
+ * PrintEventHandler.cs
+ * PrintingPermission.cs
+ * PrintingPermissionAttribute.cs
+ * PrintingPermissionLevel.cs
+ * PrintPageEventArgs.cs
+ * PrintPageEventHandler.cs
+ * PrintRange.cs
+ * QueryPageSettingEventArgs.cs
+ * QueryPageSettingsEventHandler.cs
+ * StandardPrintController.cs
+ * Added null classes for most/all classes, Many stubs, and some implmentation
+
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs b/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
new file mode 100644
index 00000000000..134ddf6298f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
@@ -0,0 +1,32 @@
+//
+// System.Drawing.Text.FontCollection.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto everaldo.canuto@bol.com.br
+//
+using System;
+
+namespace System.Drawing.Text {
+
+ public abstract class FontCollection : IDisposable {
+
+ // methods
+ [MonoTODO]
+ public void Dispose() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Dispose(bool disposing) {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ [MonoTODO]
+ public FontFamily[] Families {
+ get { throw new NotImplementedException (); }
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs b/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
new file mode 100644
index 00000000000..3b76c6b94b0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.GenericFontFamilies.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Text
+{
+ public enum GenericFontFamilies {
+ Monospace = 2,
+ SansSerif = 1,
+ Serif = 0
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs b/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
new file mode 100644
index 00000000000..df0418debc3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.HotkeyPrefix.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Text
+{
+ public enum HotkeyPrefix {
+ Hide = 2,
+ None = 0,
+ Show = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs b/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs
new file mode 100644
index 00000000000..23be4114414
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Text.InstalledFontCollection.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto everaldo.canuto@bol.com.br
+//
+using System;
+
+namespace System.Drawing.Text {
+
+ public sealed class InstalledFontCollection : FontCollection {
+
+ // constructors
+ [MonoTODO]
+ public InstalledFontCollection() {
+ throw new NotImplementedException ();
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs b/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
new file mode 100644
index 00000000000..a8639ee55c6
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
@@ -0,0 +1,36 @@
+//
+// System.Drawing.Text.PrivateFontCollection.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto everaldo.canuto@bol.com.br
+//
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Text {
+
+ [ComVisible(false)]
+ public sealed class PrivateFontCollection : FontCollection {
+
+ // constructors
+ [MonoTODO]
+ public PrivateFontCollection() {
+ throw new NotImplementedException ();
+ }
+
+ // methods
+ [MonoTODO]
+ [ComVisible(false)]
+ public void AddFontFile(string filename) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ [ComVisible(false)]
+ public void AddMemoryFont(IntPtr memory, int length) {
+ throw new NotImplementedException ();
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs b/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
new file mode 100644
index 00000000000..5f11cdcbb73
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
@@ -0,0 +1,18 @@
+//
+// System.Drawing.TextRenderingHint.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Text
+{
+ public enum TextRenderingHint {
+ AntiAlias = 4,
+ AntiAliasGridFit = 3,
+ ClearTypeGridFit = 5,
+ SingleBitPerPixel = 2,
+ SingleBitPerPixelGridFit = 1,
+ SystemDefault = 0
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/changelog b/mcs/class/System.Drawing/System.Drawing.Text/changelog
new file mode 100644
index 00000000000..840fad322e3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/changelog
@@ -0,0 +1,18 @@
+2002-09-16 Nick Drochak <ndrochak@gol.com>
+
+ * PrivateFontCollection.cs: Fix build error. Cannot put ComVisible on
+ constructors.
+
+2003-09-14 Piers Haken <piersh@friskit.com>
+
+ * PrivateFontCollection.cs: import interop for ComVisible attribute
+
+2002-09-13 Dennis Hayes (dennish@raytek.com)
+* checked in for Everaldo Canuto everaldo.canuto@bol.com.br
+
+* FontCollection.cs
+* GenericFontFamilies.cs
+* HotkeyPrefix.cs
+* InstalledFontCollection.cs
+* PrivateFontCollection.cs
+* TextRenderingHint.cs
diff --git a/mcs/class/System.Drawing/System.Drawing.build b/mcs/class/System.Drawing/System.Drawing.build
new file mode 100644
index 00000000000..729894ec2a4
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.build
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for SystemDrawing.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Drawing.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Drawing.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Drawing/System.Drawing/Bitmap.cs b/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
new file mode 100755
index 00000000000..634dee99836
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
@@ -0,0 +1,276 @@
+//
+// System.Drawing.Bitmap.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+//
+// No implementation has been done yet. I first want to write the method
+// headers of every System.Drawing.
+//
+//Buid warnings. Note add 6 to line numbers for these comments!
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(47,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbBlue' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(48,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbGreen' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(49,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbRed' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(50,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbReserved' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(54,20): warning CS0649: Field 'System.Drawing.BITMAPINFO.colorpalette' is never assigned to, and will always have its default value null
+// 2002-03-27 Christian Meyer <Christian.Meyer@cs.tum.edu>
+// I'll have a closer look at it next week.
+//
+using System;
+using System.IO;
+
+namespace System.Drawing {
+ struct BITMAPFILEHEADER { // File info header
+ public uint bfType; // Specifies the type of file. This member must be BM.
+ public uint bfSize; // Specifies the size of the file, in bytes.
+ public uint bfReserved1; // Reserved; must be set to zero.
+ public uint bfReserved2; // Reserved; must be set to zero.
+ public uint bfOffBits; // Specifies the byte offset from the BITMAPFILEHEADER
+ // structure to the actual bitmap data in the file.
+ }
+ struct BITMAPINFOHEADER { // bitmap info header
+ public uint biSize;
+ public int biWidth;
+ public int biHeight;
+ public ushort biPlanes;
+ public ushort biBitCount;
+ public uint biCompression;
+ public uint biSizeImage;
+ public int biXPelsPerMeter;
+ public int biYPelsPerMeter;
+ public uint biClrUsed;
+ public uint biClrImportant;
+ }
+
+ struct RGBQUAD {
+ public byte rgbBlue;
+ public byte rgbGreen;
+ public byte rgbRed;
+ public byte rgbReserved;
+ }
+ struct BITMAPINFO { // bitmap info
+ public BITMAPINFOHEADER bitmapinfoheader;
+ public RGBQUAD[] colorpalette;
+ }
+ // I do not think pinning is needed execpt for when locked
+ // Is layout packed attribute needed here?
+ struct bitmapstruct {
+ //placed in a struct to keep all 3 (4 including the color table) contugious in memory.)
+ public BITMAPFILEHEADER fileheader; //File info header
+ //bitmapinfo includes the color table
+ public BITMAPINFO info; //bitmap info
+ public byte[,] bits; //Actual bitmap bits
+ }
+ public sealed class Bitmap : Image {
+ // TODO: add following to an enum with BI_RLE4 and BI_RLE8
+ const int BI_RGB = 0; //? 0 is from example;
+ bitmapstruct bitmap = new bitmapstruct();
+ private void CommonInit (int width, int height) {
+ // Init BITMAPFILEHANDLE
+ // document I am working from says tyoe must allways be "BM",
+ // the example has this set to 19778.
+ // TODO: verify magic number 19778 for "BM" bfType
+ bitmap.fileheader.bfType = 19778;
+ // TODO: is this the correct file size?
+ bitmap.fileheader.bfSize = (uint)
+ //bitmap
+ (width * height * 4)
+ //add color table, 0 for now
+ + 0
+ // add header
+ + 60;
+ bitmap.fileheader.bfReserved1 = 0;
+ bitmap.fileheader.bfReserved2 = 0;
+ // bfOffBits is bytes offset between start of bitmap (bimapfileheader)
+ // and start of actual data bits.
+ // Example puts it at 118 including 64 bytes of color table.
+ // I count 124. What is right?
+ // Also I force 32 bit color for first pass, so for now there is no color table (24 bit or greater)
+ // TODO: verify magic number 124 for bfOffBits
+ // TODO: Could also be sizeof(fileheader and bitmapinfo)
+ bitmap.fileheader.bfOffBits = 60; //14 * 4 for ints + 2 * 2 for words.
+
+ // Init BITMAPINFO HEADER
+ // TODO: document on bitmaps shows only 1, 4, 8, 24 as valid pixel depths
+ // TODO; MS's document says 32ppARGB is 32 bits per pixle, the default.
+
+ bitmap.info.bitmapinfoheader.biBitCount = 32;
+ // biclrused is the number of colors in the bitmap that are actualy used
+ // in the bitmap. 0 means all. default to this.
+ // TODO: As far as I know, it is fine to leave this as 0, but
+ // TODO: that it would be better to do an actual count.
+ // TODO: If we open an already created bitmap, we could in a later
+ // TODO: version store that.
+ bitmap.info.bitmapinfoheader.biClrUsed = 0;
+ // biclrused is the number of colors in the bitmap that are importiant
+ // in the bitmap. 0 means all. default to this.
+ // TODO: As far as I know, it is fine to leave this as 0,
+ // TODO: If we open an already created bitmap, we could in a later
+ // TODO: version store that.
+ // In a new bitmap, I do not know how we would know which colors are importiant.
+ bitmap.info.bitmapinfoheader.biClrImportant = 0;
+ // Options are BI_RGB for none, BI_RLE8 for 8 bit color ,BI_RLE4 for 4 bit color
+ // Only supprt BI_RGB for now;
+ // TODO: add definition for BI_***
+ // TODO: correctly set biSizeImage before supporting compression.
+ bitmap.info.bitmapinfoheader.biCompression = BI_RGB;
+ bitmap.info.bitmapinfoheader.biHeight = height;
+ bitmap.info.bitmapinfoheader.biWidth = width;
+ // TODO: add support for more planes
+ bitmap.info.bitmapinfoheader.biPlanes = 1;
+ // TODO: replace 40 with a sizeof() call
+ bitmap.info.bitmapinfoheader.biSize = 40;// size of this structure.
+ // TODO: correctly set biSizeImage so compression can be supported.
+ bitmap.info.bitmapinfoheader.biSizeImage = 0; //0 is allowed for BI_RGB (no compression)
+ // The example uses 0 for pels per meter, so do I.
+ // TODO: support pels per meter
+ bitmap.info.bitmapinfoheader.biXPelsPerMeter = 0;
+ bitmap.info.bitmapinfoheader.biYPelsPerMeter = 0;
+ bitmap.bits = new byte[width*4, height];
+ }
+ #region constructors
+ // constructors
+ public Bitmap (int width, int height) {
+ CommonInit (width, height);
+ }
+
+ public Bitmap (int width, int height, Graphics g) {
+ //TODO: Error check X,Y
+ CommonInit (width,height);
+ //TODO: use graphics to set vertial and horzontal resolution.
+ //TODO: that is all the spec requires or desires
+ }
+
+// public Bitmap (int width, int heigth, PixelFormat format) {
+// if ((int)format != BI_RGB) {
+// throw new NotImplementedException ();
+// }
+// CommonInit (width, heigth);
+// }
+//
+// public Bitmap (Image origial) {
+// throw new NotImplementedException ();
+// //this.original = original;
+// }
+
+ public Bitmap (Stream stream) {
+ throw new NotImplementedException ();
+ //this.stream = stream;
+ }
+
+ public Bitmap (string filename) {
+ throw new NotImplementedException ();
+ //this.filename = filename;
+ }
+
+ public Bitmap (Image original, Size newSize) {
+ throw new NotImplementedException ();
+ //this.original = original;
+ //this.newSize = newSize;
+ }
+
+ public Bitmap (Stream stream, bool useIcm) {
+ throw new NotImplementedException ();
+ //this.stream = stream;
+ //this.useIcm = useIcm;
+ }
+
+ public Bitmap (string filename, bool useIcm) {
+ throw new NotImplementedException ();
+ //this.filename = filename;
+ //this.useIcm = useIcm;
+ }
+
+ public Bitmap (Type type, string resource) {
+ throw new NotImplementedException ();
+ //this.type = type;
+ //this.resource = resource;
+ }
+
+ public Bitmap (Image original, int width, int heigth) {
+ throw new NotImplementedException ();
+ //this.original = original;
+ //this.width = width;
+ //this.heigth = heigth;
+ }
+
+
+// public Bitmap (int width, int height, int stride,
+// PixelFormat format, IntPtr scan0) {
+// throw new NotImplementedException ();
+// //this.width = width;
+// //this.heigth = heigth;
+// //this.stride = stride;
+// //this.format = format;
+// //this.scan0 = scan0;
+// }
+ #endregion
+ // methods
+ public Color GetPixel (int x, int y) {
+ //TODO: Error check X,Y
+ return Color.FromArgb (bitmap.bits[x,y], bitmap.bits[x+1,y], bitmap.bits[x+2,y], bitmap.bits[x+3,y]);
+ }
+
+ public void SetPixel (int x, int y, Color color) {
+ //TODO: Error check X,Y
+ bitmap.bits[x, y] = color.A;
+ bitmap.bits[x + 1, y] = color.R;
+ bitmap.bits[x + 2, y] = color.G;
+ bitmap.bits[x + 2, y] = color.B;
+ }
+
+// public Bitmap Clone (Rectangle rect,PixelFormat format) {
+// throw new NotImplementedException ();
+// }
+//
+// public Bitmap Clone (RectangleF rect, PixelFormat format) {
+// throw new NotImplementedException ();
+// }
+
+ public static Bitmap FromHicon (IntPtr hicon) {
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromResource (IntPtr hinstance,
+ string bitmapName) {
+ throw new NotImplementedException ();
+ }
+
+ public IntPtr GetHbitmap () {
+ throw new NotImplementedException ();
+ }
+
+ public IntPtr GetHbitmap (Color background) {
+ throw new NotImplementedException ();
+ }
+
+ public IntPtr GetHicon () {
+ throw new NotImplementedException ();
+ }
+
+// public BitmapData LockBits (Rectangle rect, ImageLockMode flags,
+// PixelFormat format) {
+// throw new NotImplementedException ();
+// }
+
+ public void MakeTransparent () {
+ throw new NotImplementedException ();
+ }
+
+ public void MakeTransparent (Color transparentColor) {
+ throw new NotImplementedException ();
+ }
+
+ public void SetResolution (float xDpi, float yDpi) {
+ throw new NotImplementedException ();
+ }
+
+// public void UnlockBits (BitmapData bitmapdata) {
+// throw new NotImplementedException ();
+// }
+
+ // properties
+ // needs to be done ###FIXME###
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Brush.cs b/mcs/class/System.Drawing/System.Drawing/Brush.cs
new file mode 100755
index 00000000000..f11ae80cf99
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Brush.cs
@@ -0,0 +1,39 @@
+//
+// System.Drawing.Brush.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable {
+
+ abstract public object Clone ();
+
+ internal Brush()
+ {
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ // Nothing for now.
+ }
+
+ ~Brush ()
+ {
+ Dispose (false);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing/Brushes.cs b/mcs/class/System.Drawing/System.Drawing/Brushes.cs
new file mode 100644
index 00000000000..b9d7f77f580
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Brushes.cs
@@ -0,0 +1,865 @@
+//
+// System.Windows.Drawing.Brushes.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+// Suesan Chaney
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Drawing {
+ public sealed class Brushes {
+ private Brushes()
+ {
+ }
+
+ public static Brush AliceBlue{
+ get{
+ return new SolidBrush( Color.AliceBlue );
+ }
+ }
+
+ public static Brush AntiqueWhite{
+ get{
+ return new SolidBrush( Color.AntiqueWhite );
+ }
+ }
+
+ public static Brush Aqua{
+ get{
+ return new SolidBrush( Color.Aqua );
+ }
+ }
+
+ public static Brush Aquamarine{
+ get{
+ return new SolidBrush( Color.Aquamarine );
+ }
+ }
+
+ public static Brush Azure{
+ get{
+ return new SolidBrush( Color.Azure );
+ }
+ }
+
+ public static Brush Beige{
+ get{
+ return new SolidBrush( Color.Beige );
+ }
+ }
+
+ public static Brush Bisque{
+ get{
+ return new SolidBrush( Color.Bisque );
+ }
+ }
+
+ public static Brush Black{
+ get{
+ return new SolidBrush( Color.Black );
+ }
+ }
+
+ public static Brush BlanchedAlmond{
+ get{
+ return new SolidBrush( Color.BlanchedAlmond );
+ }
+ }
+
+ public static Brush Blue{
+ get{
+ return new SolidBrush( Color.Blue );
+ }
+ }
+
+ public static Brush BlueViolet{
+ get{
+ return new SolidBrush( Color.BlueViolet );
+ }
+ }
+
+ public static Brush Brown{
+ get{
+ return new SolidBrush( Color.Brown );
+ }
+ }
+
+ public static Brush BurlyWood{
+ get{
+ return new SolidBrush( Color.BurlyWood );
+ }
+ }
+
+ public static Brush CadetBlue{
+ get{
+ return new SolidBrush( Color.CadetBlue );
+ }
+ }
+
+ public static Brush Chartreuse{
+ get{
+ return new SolidBrush( Color.Chartreuse );
+ }
+ }
+
+ public static Brush Chocolate{
+ get{
+ return new SolidBrush( Color.Chocolate );
+ }
+ }
+
+ public static Brush Coral{
+ get{
+ return new SolidBrush( Color.Coral );
+ }
+ }
+
+ public static Brush CornflowerBlue{
+ get{
+ return new SolidBrush( Color.CornflowerBlue );
+ }
+ }
+
+ public static Brush Cornsilk{
+ get{
+ return new SolidBrush( Color.Cornsilk );
+ }
+ }
+
+ public static Brush Crimson{
+ get{
+ return new SolidBrush( Color.Crimson );
+ }
+ }
+
+ public static Brush Cyan{
+ get{
+ return new SolidBrush( Color.Cyan );
+ }
+ }
+
+ public static Brush DarkBlue{
+ get{
+ return new SolidBrush( Color.DarkBlue );
+ }
+ }
+
+ public static Brush DarkCyan{
+ get{
+ return new SolidBrush( Color.DarkCyan );
+ }
+ }
+
+ public static Brush DarkGoldenrod{
+ get{
+ return new SolidBrush( Color.DarkGoldenrod );
+ }
+ }
+
+ public static Brush DarkGray{
+ get{
+ return new SolidBrush( Color.DarkGray );
+ }
+ }
+
+ public static Brush DarkGreen{
+ get{
+ return new SolidBrush( Color.DarkGreen );
+ }
+ }
+
+ public static Brush DarkKhaki{
+ get{
+ return new SolidBrush( Color.DarkKhaki );
+ }
+ }
+
+ public static Brush DarkMagenta{
+ get{
+ return new SolidBrush( Color.DarkMagenta );
+ }
+ }
+
+ public static Brush DarkOliveGreen
+ {
+ get{
+ return new SolidBrush( Color.DarkOliveGreen );
+ }
+ }
+
+ public static Brush DarkOrange{
+ get{
+ return new SolidBrush( Color.DarkOrange );
+ }
+ }
+
+ public static Brush DarkOrchid{
+ get{
+ return new SolidBrush( Color.DarkOrchid );
+ }
+ }
+
+ public static Brush DarkRed{
+ get{
+ return new SolidBrush( Color.DarkRed );
+ }
+ }
+
+ public static Brush DarkSalmon{
+ get{
+ return new SolidBrush( Color.DarkSalmon );
+ }
+ }
+
+ public static Brush DarkSeaGreen{
+ get{
+ return new SolidBrush( Color.DarkSeaGreen );
+ }
+ }
+
+ public static Brush DarkSlateBlue{
+ get{
+ return new SolidBrush( Color.DarkSlateBlue );
+ }
+ }
+
+ public static Brush DarkSlateGray{
+ get{
+ return new SolidBrush( Color.DarkSlateGray );
+ }
+ }
+
+ public static Brush DarkTurquoise{
+ get{
+ return new SolidBrush( Color.DarkTurquoise );
+ }
+ }
+
+ public static Brush DarkViolet{
+ get{
+ return new SolidBrush( Color.DarkViolet );
+ }
+ }
+
+ public static Brush DeepPink{
+ get{
+ return new SolidBrush( Color.DeepPink );
+ }
+ }
+
+ public static Brush DeepSkyBlue{
+ get{
+ return new SolidBrush( Color.DeepSkyBlue );
+ }
+ }
+
+ public static Brush DimGray{
+ get{
+ return new SolidBrush( Color.DimGray );
+ }
+ }
+
+ public static Brush DodgerBlue{
+ get{
+ return new SolidBrush( Color.DodgerBlue );
+ }
+ }
+
+ public static Brush Firebrick{
+ get{
+ return new SolidBrush( Color.Firebrick );
+ }
+ }
+
+ public static Brush FloralWhite{
+ get{
+ return new SolidBrush( Color.FloralWhite );
+ }
+ }
+
+ public static Brush ForestGreen{
+ get{
+ return new SolidBrush( Color.ForestGreen );
+ }
+ }
+
+ public static Brush Fuchsia{
+ get{
+ return new SolidBrush( Color.Fuchsia );
+ }
+ }
+
+ public static Brush Gainsboro {
+ get{
+ return new SolidBrush( Color.Gainsboro );
+ }
+ }
+
+ public static Brush GhostWhite{
+ get{
+ return new SolidBrush( Color.GhostWhite );
+ }
+ }
+
+ public static Brush Gold{
+ get{
+ return new SolidBrush( Color.Gold );
+ }
+ }
+
+ public static Brush Goldenrod{
+ get{
+ return new SolidBrush( Color.Goldenrod );
+ }
+ }
+
+ public static Brush Gray{
+ get{
+ return new SolidBrush( Color.Gray );
+ }
+ }
+
+ public static Brush Green{
+ get{
+ return new SolidBrush( Color.Green );
+ }
+ }
+
+ public static Brush GreenYellow{
+ get{
+ return new SolidBrush( Color.GreenYellow );
+ }
+ }
+
+ public static Brush Honeydew{
+ get{
+ return new SolidBrush( Color.Honeydew );
+ }
+ }
+
+ public static Brush HotPink{
+ get{
+ return new SolidBrush( Color.HotPink );
+ }
+ }
+
+ public static Brush IndianRed{
+ get{
+ return new SolidBrush( Color.IndianRed );
+ }
+ }
+
+ public static Brush Indigo{
+ get{
+ return new SolidBrush( Color.Indigo );
+ }
+ }
+
+ public static Brush Ivory{
+ get{
+ return new SolidBrush( Color.Ivory );
+ }
+ }
+
+ public static Brush Khaki{
+ get{
+ return new SolidBrush( Color.Khaki );
+ }
+ }
+
+ public static Brush Lavender{
+ get{
+ return new SolidBrush( Color.Lavender );
+ }
+ }
+
+ public static Brush LavenderBlush{
+ get{
+ return new SolidBrush( Color.LavenderBlush );
+ }
+ }
+
+ public static Brush LawnGreen{
+ get{
+ return new SolidBrush( Color.LawnGreen );
+ }
+ }
+
+ public static Brush LemonChiffon{
+ get{
+ return new SolidBrush( Color.LemonChiffon );
+ }
+ }
+
+ public static Brush LightBlue{
+ get{
+ return new SolidBrush( Color.LightBlue );
+ }
+ }
+
+ public static Brush LightCoral{
+ get{
+ return new SolidBrush( Color.LightCoral );
+ }
+ }
+
+ public static Brush LightCyan{
+ get{
+ return new SolidBrush( Color.LightCyan );
+ }
+ }
+
+ public static Brush LightGoldenrodYellow{
+ get{
+ return new SolidBrush( Color.LightGoldenrodYellow );
+ }
+ }
+
+ public static Brush LightGray{
+ get{
+ return new SolidBrush( Color.LightGray );
+ }
+ }
+
+ public static Brush LightGreen{
+ get{
+ return new SolidBrush( Color.LightGreen );
+ }
+ }
+
+ public static Brush LightPink{
+ get{
+ return new SolidBrush( Color.LightPink );
+ }
+ }
+
+ public static Brush LightSalmon{
+ get{
+ return new SolidBrush( Color.LightSalmon );
+ }
+ }
+
+ public static Brush LightSeaGreen{
+ get{
+ return new SolidBrush( Color.LightSeaGreen );
+ }
+ }
+
+ public static Brush LightSkyBlue{
+ get{
+ return new SolidBrush( Color.LightSkyBlue );
+ }
+ }
+
+ public static Brush LightSlateGray{
+ get{
+ return new SolidBrush( Color.LightSlateGray );
+ }
+ }
+
+ public static Brush LightSteelBlue{
+ get{
+ return new SolidBrush( Color.LightSteelBlue );
+ }
+ }
+
+ public static Brush LightYellow{
+ get{
+ return new SolidBrush( Color.LightYellow );
+ }
+ }
+
+ public static Brush Lime{
+ get{
+ return new SolidBrush( Color.Lime );
+ }
+ }
+
+ public static Brush LimeGreen{
+ get{
+ return new SolidBrush( Color.LimeGreen );
+ }
+ }
+
+ public static Brush Linen{
+ get{
+ return new SolidBrush( Color.Linen );
+ }
+ }
+
+ public static Brush Magenta{
+ get{
+ return new SolidBrush( Color.Magenta );
+ }
+ }
+
+ public static Brush Maroon{
+ get{
+ return new SolidBrush( Color.Maroon );
+ }
+ }
+
+ public static Brush MediumAquamarine{
+ get{
+ return new SolidBrush( Color.MediumAquamarine );
+ }
+ }
+
+ public static Brush MediumBlue{
+ get{
+ return new SolidBrush( Color.MediumBlue );
+ }
+ }
+
+ public static Brush MediumOrchid{
+ get{
+ return new SolidBrush( Color.MediumOrchid );
+ }
+ }
+
+ public static Brush MediumPurple{
+ get{
+ return new SolidBrush( Color.MediumPurple );
+ }
+ }
+
+ public static Brush MediumSeaGreen{
+ get{
+ return new SolidBrush( Color.MediumSeaGreen );
+ }
+ }
+
+ public static Brush MediumSlateBlue{
+ get{
+ return new SolidBrush( Color.MediumSlateBlue );
+ }
+ }
+
+ public static Brush MediumSpringGreen{
+ get{
+ return new SolidBrush( Color.MediumSpringGreen );
+ }
+ }
+
+ public static Brush MediumTurquoise{
+ get{
+ return new SolidBrush( Color.MediumTurquoise );
+ }
+ }
+
+ public static Brush MediumVioletRed{
+ get{
+ return new SolidBrush( Color.MediumVioletRed );
+ }
+ }
+
+ public static Brush MidnightBlue{
+ get{
+ return new SolidBrush( Color.MidnightBlue );
+ }
+ }
+
+ public static Brush MintCream{
+ get{
+ return new SolidBrush( Color.MintCream );
+ }
+ }
+
+ public static Brush MistyRose{
+ get{
+ return new SolidBrush( Color.MistyRose );
+ }
+ }
+
+ public static Brush Moccasin{
+ get{
+ return new SolidBrush( Color.Moccasin );
+ }
+ }
+
+ public static Brush NavajoWhite{
+ get{
+ return new SolidBrush( Color.NavajoWhite );
+ }
+ }
+
+ public static Brush Navy{
+ get{
+ return new SolidBrush( Color.Navy );
+ }
+ }
+
+ public static Brush OldLace{
+ get{
+ return new SolidBrush( Color.OldLace );
+ }
+ }
+
+ public static Brush Olive{
+ get{
+ return new SolidBrush( Color.Olive );
+ }
+ }
+
+ public static Brush OliveDrab{
+ get{
+ return new SolidBrush( Color.OliveDrab );
+ }
+ }
+
+ public static Brush Orange{
+ get{
+ return new SolidBrush( Color.Orange );
+ }
+ }
+
+ public static Brush OrangeRed{
+ get{
+ return new SolidBrush( Color.OrangeRed );
+ }
+ }
+
+ public static Brush Orchid{
+ get{
+ return new SolidBrush( Color.Orchid );
+ }
+ }
+
+ public static Brush PaleGoldenrod{
+ get{
+ return new SolidBrush( Color.PaleGoldenrod );
+ }
+ }
+
+ public static Brush PaleGreen{
+ get{
+ return new SolidBrush( Color.PaleGreen );
+ }
+ }
+
+ public static Brush PaleTurquoise{
+ get{
+ return new SolidBrush( Color.PaleTurquoise );
+ }
+ }
+
+ public static Brush PaleVioletRed{
+ get{
+ return new SolidBrush( Color.PaleVioletRed );
+ }
+ }
+
+ public static Brush PapayaWhip{
+ get{
+ return new SolidBrush( Color.PapayaWhip );
+ }
+ }
+
+ public static Brush PeachPuff{
+ get{
+ return new SolidBrush( Color.PeachPuff );
+ }
+ }
+
+ public static Brush Peru{
+ get{
+ return new SolidBrush( Color.Peru );
+ }
+ }
+
+ public static Brush Pink{
+ get{
+ return new SolidBrush( Color.Pink );
+ }
+ }
+
+ public static Brush Plum{
+ get{
+ return new SolidBrush( Color.Plum );
+ }
+ }
+
+ public static Brush PowderBlue{
+ get{
+ return new SolidBrush( Color.PowderBlue );
+ }
+ }
+
+ public static Brush Purple{
+ get{
+ return new SolidBrush( Color.Purple );
+ }
+ }
+
+ public static Brush Red{
+ get{
+ return new SolidBrush( Color.Red );
+ }
+ }
+
+ public static Brush RosyBrown{
+ get{
+ return new SolidBrush( Color.RosyBrown );
+ }
+ }
+
+ public static Brush RoyalBlue{
+ get{
+ return new SolidBrush( Color.RoyalBlue );
+ }
+ }
+
+ public static Brush SaddleBrown{
+ get{
+ return new SolidBrush( Color.SaddleBrown );
+ }
+ }
+
+ public static Brush Salmon{
+ get{
+ return new SolidBrush( Color.Salmon );
+ }
+ }
+
+ public static Brush SandyBrown{
+ get{
+ return new SolidBrush( Color.SandyBrown );
+ }
+ }
+
+ public static Brush SeaGreen{
+ get{
+ return new SolidBrush( Color.SeaGreen );
+ }
+ }
+
+ public static Brush SeaShell{
+ get{
+ return new SolidBrush( Color.SeaShell );
+ }
+ }
+
+ public static Brush Sienna{
+ get{
+ return new SolidBrush( Color.Sienna );
+ }
+ }
+
+ public static Brush Silver{
+ get{
+ return new SolidBrush( Color.Silver );
+ }
+ }
+
+ public static Brush SkyBlue{
+ get{
+ return new SolidBrush( Color.SkyBlue );
+ }
+ }
+
+ public static Brush SlateBlue{
+ get{
+ return new SolidBrush( Color.SlateBlue );
+ }
+ }
+
+ public static Brush SlateGray{
+ get{
+ return new SolidBrush( Color.SlateGray );
+ }
+ }
+ public static Brush Snow{
+ get{
+ return new SolidBrush( Color.Snow );
+ }
+ }
+
+ public static Brush SpringGreen{
+ get{
+ return new SolidBrush( Color.SpringGreen );
+ }
+ }
+
+ public static Brush SteelBlue{
+ get{
+ return new SolidBrush( Color.SteelBlue );
+ }
+ }
+
+ public static Brush Tan{
+ get{
+ return new SolidBrush( Color.Tan );
+ }
+ }
+
+ public static Brush Teal{
+ get{
+ return new SolidBrush( Color.Teal );
+ }
+ }
+
+ public static Brush Thistle{
+ get{
+ return new SolidBrush( Color.Thistle );
+ }
+ }
+
+ public static Brush Tomato{
+ get{
+ return new SolidBrush( Color.Tomato );
+ }
+ }
+
+ public static Brush Transparent{
+ get{
+ return new SolidBrush( Color.Transparent );
+ }
+ }
+
+ public static Brush Turquoise{
+ get{
+ return new SolidBrush( Color.Turquoise );
+ }
+ }
+
+ public static Brush Violet{
+ get{
+ return new SolidBrush( Color.Violet );
+ }
+ }
+
+ public static Brush Wheat{
+ get{
+ return new SolidBrush( Color.Wheat );
+ }
+ }
+
+ public static Brush White{
+ get{
+ return new SolidBrush( Color.White );
+ }
+ }
+
+ public static Brush WhiteSmoke{
+ get{
+ return new SolidBrush( Color.WhiteSmoke );
+ }
+ }
+
+ public static Brush Yellow{
+ get{
+ return new SolidBrush( Color.Yellow );
+ }
+ }
+
+ public static Brush YellowGreen{
+ get{
+ return new SolidBrush( Color.YellowGreen );
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog
new file mode 100644
index 00000000000..c29bfb05e52
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog
@@ -0,0 +1,164 @@
+2002-11-21 Dennis Hayes (dennish@raytek.com)
+ * checkin for Matt Stump (mstump@swfo.arizona.edu)
+ * Pens.cs
+ * Added file
+
+2002-10-19 Rachel Hestilow <hestilow@ximian.com>
+
+ * ColorTranslator.cs (FromHtml): Implement.
+
+2002-10-14 Dennis Hayes (dennish@raytek.com)
+ * Region.cs
+ * changed using namespace from Drawing2d to Drawing2D
+
+ 2002-9-15 Asier Llano <asierllano@infonegocio.com>
+
+ * Fixes the enum values in the following enums
+ * ContentAlignment.cs:
+ * FontStyle.cs:
+ * GraphicsUnit.cs:
+ * KnownColor.cs:
+ * RotateFlipType.cs:
+ * StringAligment.cs:
+ * StringDigitSubstitute.cs:
+ * StringFormatFlags.cs:
+ * StringTrimming.cs:
+ * StringUnit.cs:
+ * SolidBrush.cs: Easy implementation
+ * Brushes.cs: Implementation based on SolidBrush and Color class.
+ * Brush.cs: Fixes based on the status web).
+ * CharacterRange.cs: Implemented the missing Lenth property.
+
+2002-9-14 Dennis Hayes (dennish@raytek.com)
+
+ * sample.cs
+ * removed personal template that should not have been checked in
+
+2002-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ColorConverter.cs: readded MonoTODOs and implemented a couple of
+ methods.
+
+2002-9-14 DennisHayes <dennish@raytek.com>
+
+ * FontConverter.cs
+ * FontFamily.cs
+ * Icon.cs
+ * IconConverter.cs
+ * ImageAnimator.cs
+ * ImageConverter.cs
+ * ImageFormatConverter.cs
+ * PointConverter.cs
+ * RectangleConverter.cs
+ * Sample.cs
+ * SizeConverter.cs
+ * SolidBrush.cs
+ * StringFormat.cs
+ * SystemBrushes.cs
+ * SystemIcons.cs
+ * SystemPens.cs
+ * TextureBrush.cs
+ * ToolboxBitmapAttribute.cs
+ * Added null classes for most/all classes, Many stubs, and some implmentation
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * Bitmap.cs
+ * Color.cs
+ * ColorConverter.cs
+ * Image.cs
+ * Pen.cs
+ * Added stubs, implmentation
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+ * Brushes.cs : stubbed, added colors. Not sure how to implement,
+ but this should at least save someone some typing.
+ * CharacterRange.cs :Implmented
+ * Region.cs : stub needed for system.windows.forms
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ColorTranslator.cs: use Color.Name.
+
+2002-07-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Color.cs: implemented SystemColors and NamedColors properties that
+ are used by ColorConverter, removed public constructor, use
+ SystemColors, and misc. fixes to make it behave as MS (ToString,
+ parsing names, FromKnownColor,...).
+
+ * ColorConverter.cs: use NamedColors and SystemColors from Color when
+ trying to get the color from its name.
+
+ * SystemColors.cs: new file.
+
+2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Color.cs: changed static properties to use FromArgbNamed. Also
+ modified the program included in comments that get the values for
+ static properties.
+
+ (FromArgbNamed): build named colors.
+ (FromKnownColor): fixed.
+ (FromName): use a hash to look up colors by name.
+ (FillColorNames): create the hash of colors.
+ (Equals): compare values and name.
+ (ToString): improved.
+
+ * ColorTranslator.cs: implemented ToHtml.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Color.cs: added TypeConverter attribute.
+
+ * ColorConverter.cs: added constructor.
+
+2002-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ColorConverter.cs: implemented minimal set of features needed by xsp.
+
+2002-05-03 Mike Kestner <mkestner@speakeasy.net>
+
+ * Bitmap.cs : using System.IO
+ * ColorTranslator.cs : Stubbed off build breakers.
+ * Image.cs : Stub off IDisposable and ICloneable.
+
+2002-04-27 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Bitmap.cs: Ximian is the new copyright holder now.
+ * Image.cs: ditto
+
+2002-04-05 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Uppercased several files.
+
+2002-04-05 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * color.cs: Fixed a typo in GetSaturation ().
+
+2002-02-26 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Bitmap.cs: Added method headers.
+
+2002-02-25 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Bitmap.cs: Added, no implementation's done, yet.
+
+2001-12-15 Mike Kestner <mkestner@speakeasy.net>
+
+ * Rectangle.cs : Add a doc comment.
+ * RectangleF.cs : New struct implementation.
+
+2001-12-15 Mike Kestner <mkestner@speakeasy.net>
+
+ * Rectangle.cs : New struct implementation.
+
+2001-08-17 Mike Kestner <mkestner@speakeasy.net>
+
+ * PointF.cs, Size.cs, SizeF.cs : New struct implementations.
+
+2001-08-16 Mike Kestner <mkestner@speakeasy.net>
+
+ * Point.cs : New. Implementation of System.Drawing.Point struct.
+
diff --git a/mcs/class/System.Drawing/System.Drawing/CharacterRange.cs b/mcs/class/System.Drawing/System.Drawing/CharacterRange.cs
new file mode 100644
index 00000000000..01ec2461554
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/CharacterRange.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Drawing.CharacterRange.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for CharacterRange.
+ /// </summary>
+ public struct CharacterRange
+ {
+ private int first;
+ private int length;
+ public CharacterRange(int First, int Length){
+ first = First;
+ length = Length;
+ }
+ public int First{
+ get{
+ return first;
+ }
+ set{
+ first = value;
+ }
+ }
+ public int Length{
+ get{
+ return length;
+ }
+ set{
+ length = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Color.cs b/mcs/class/System.Drawing/System.Drawing/Color.cs
new file mode 100644
index 00000000000..c8972e07908
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Color.cs
@@ -0,0 +1,1453 @@
+//
+// System.Drawing.Color.cs
+//
+// Authors:
+// Dennis Hayes (dennish@raytek.com)
+// Ben Houston (ben@exocortex.org)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Dennis Hayes
+// (c) 2002 Ximian, Inc. (http://www.ximiam.com)
+//
+// TODO: Are the static/non static functions declared correctly
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Drawing
+{
+ [TypeConverter(typeof(ColorConverter))]
+ [Serializable]
+ public struct Color
+ {
+ private static Hashtable namedColors;
+ private static Hashtable systemColors;
+ // Private transparancy (A) and R,G,B fields.
+ byte a;
+ byte r;
+ byte g;
+ byte b;
+ private static string creatingColorNames = "creatingColorNames";
+
+ // The specs also indicate that all three of these propities are true
+ // if created with FromKnownColor or FromNamedColor, false otherwise (FromARGB).
+ // Per Microsoft and ECMA specs these varibles are set by which constructor is used, not by their values.
+ bool isknowncolor;
+ bool isnamedcolor;
+ bool issystemcolor;
+ KnownColor knownColor;
+
+ string myname;
+
+ public string Name {
+ get{
+ return myname;
+ }
+ }
+
+ public bool IsKnownColor {
+ get{
+ return isknowncolor;
+ }
+ }
+
+ public bool IsSystemColor {
+ get{
+ return issystemcolor;
+ }
+ }
+
+ public bool IsNamedColor {
+ get{
+ if (!isnamedcolor)
+ return IsKnownColor;
+ return isnamedcolor;
+ }
+ }
+
+
+ public static Color FromArgb (int red, int green, int blue)
+ {
+ return FromArgb (255, red, green, blue);
+ }
+
+ public static Color FromArgb (int alpha, int red, int green, int blue)
+ {
+ CheckARGBValues (alpha, red, green, blue);
+ Color color = new Color ();
+ color.a = (byte) alpha;
+ color.r = (byte) red;
+ color.g = (byte) green;
+ color.b = (byte) blue;
+ color.myname = String.Empty;
+ return color;
+ }
+
+ private static Color FromArgbNamed (int alpha, int red, int green, int blue, string name)
+ {
+ Color color = FromArgb (alpha, red, green, blue);
+ color.isknowncolor = true;
+ color.isnamedcolor = true;
+ //color.issystemcolor = false; //???
+ color.myname = name;
+ color.knownColor = (KnownColor) Enum.Parse (typeof (KnownColor), name, false);
+ return color;
+ }
+
+ internal static Color FromArgbSystem (int alpha, int red, int green, int blue, string name)
+ {
+ Color color = FromArgbNamed (alpha, red, green, blue, name);
+ color.issystemcolor = true;
+ return color;
+ }
+
+ public int ToArgb()
+ {
+ return a << 24 | r << 16 | g << 8 | b;
+ }
+
+ public static Color FromArgb (int alpha, Color baseColor)
+ {
+ return FromArgb (alpha, baseColor.r, baseColor.g, baseColor.b);
+ }
+
+ public static Color FromArgb (int argb)
+ {
+ return FromArgb (argb >> 24, (argb >> 16) & 0x0FF, (argb >> 8) & 0x0FF, argb & 0x0FF);
+ }
+
+ public static Color FromKnownColor (KnownColor knownColorToConvert)
+ {
+ Color c = FromName (knownColorToConvert.ToString ());
+ c.knownColor = knownColorToConvert;
+ return c;
+ }
+
+ private static Hashtable GetColorHashtableFromType (Type type)
+ {
+ Hashtable colorHash = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+
+ PropertyInfo [] props = type.GetProperties ();
+ foreach (PropertyInfo prop in props){
+ if (prop.PropertyType != typeof (Color))
+ continue;
+
+ MethodInfo getget = prop.GetGetMethod ();
+ if (getget == null || getget.IsStatic == false)
+ continue;
+
+ colorHash.Add (prop.Name, prop.GetValue (null, null));
+ }
+ return colorHash;
+ }
+
+ private static void FillColorNames ()
+ {
+ if (systemColors != null)
+ return;
+
+ lock (creatingColorNames) {
+ if (systemColors != null)
+ return;
+
+ Hashtable colorHash = GetColorHashtableFromType (typeof (Color));
+ namedColors = colorHash;
+
+ colorHash = GetColorHashtableFromType (typeof (SystemColors));
+ systemColors = colorHash;
+ }
+ }
+
+ public static Color FromName (string colorName)
+ {
+ object c = NamedColors [colorName];
+ if (c == null) {
+ c = SystemColors [colorName];
+ if (c == null) {
+ // This is what it returns!
+ Color d = FromArgb (0, 0, 0, 0);
+ d.myname = colorName;
+ d.isnamedcolor = true;
+ c = d;
+ }
+ }
+
+ return (Color) c;
+ }
+
+ internal static Hashtable NamedColors
+ {
+ get {
+ FillColorNames ();
+ return namedColors;
+ }
+ }
+
+ internal static Hashtable SystemColors
+ {
+ get {
+ FillColorNames ();
+ return systemColors;
+ }
+ }
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Color Structure
+ /// </remarks>
+
+ public static readonly Color Empty;
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Color objects. The return value is
+ /// based on the equivalence of the A,R,G,B properties
+ /// of the two Colors.
+ /// </remarks>
+
+ public static bool operator == (Color colorA, Color colorB)
+ {
+ return ((colorA.a == colorB.a) && (colorA.r == colorB.r)
+ && (colorA.g == colorB.g) && (colorA.b == colorB.b));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Color objects. The return value is
+ /// based on the equivalence of the A,R,G,B properties
+ /// of the two colors.
+ /// </remarks>
+
+ public static bool operator != (Color colorA, Color colorB)
+ {
+ return ((colorA.a != colorB.a) || (colorA.r != colorB.r)
+ || (colorA.g != colorB.g) || (colorA.b != colorB.b));
+ }
+
+ public float GetBrightness (){
+ // Intensity is the normalized sum of the three RGB values.;
+ return ((float)(r + g + b))/(255*3);
+ }
+ public float GetSaturation (){
+ // S = 1 - I * Min(r,g,b)
+ return (255 -
+ (((float)(r + g +b))/3)*Math.Min(r,Math.Min(g,b))
+ )/255;
+ }
+
+ public float GetHue (){
+ float top = ((float)(2*r-g-b))/(2*255);
+ float bottom = (float)Math.Sqrt(((r-g)*(r-g) + (r-b)*(g-b))/255);
+ return (float)Math.Acos(top/bottom);
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// ToKnownColor method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns the KnownColor enum value for this color, 0 if is not known.
+ /// </remarks>
+ public KnownColor ToKnownColor ()
+ {
+ return knownColor;
+ }
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates transparent black. R,G,B = 0; A=0?
+ /// </remarks>
+
+ public bool IsEmpty
+ {
+ get {
+ return (a + r + g + b) == 0;
+ }
+ }
+
+ /// <summary>
+ /// A Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The transparancy of the Color.
+ /// </remarks>
+
+ public byte A
+ {
+ get {
+ return a;
+ }
+ }
+
+ /// <summary>
+ /// R Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The red value of the Color.
+ /// </remarks>
+
+ public byte R
+ {
+ get {
+ return r;
+ }
+ }
+
+ /// <summary>
+ /// G Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The green value of the Color.
+ /// </remarks>
+
+ public byte G
+ {
+ get {
+ return g;
+ }
+ }
+
+ /// <summary>
+ /// B Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The blue value of the Color.
+ /// </remarks>
+
+ public byte B
+ {
+ get {
+ return b;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Color and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Color))
+ return false;
+
+ Color c = (Color) o;
+ if (c.r == r && c.g == g && c.b == b) {
+ if (myname != null || c.myname != null)
+ return (myname == c.myname);
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Reference Equals Method
+ /// Is commented out because this is handled by the base class.
+ /// TODO: Is it correct to let the base class handel reference equals
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Color and another object.
+ /// </remarks>
+ //public bool ReferenceEquals (object o)
+ //{
+ // if (!(o is Color))return false;
+ // return (this == (Color) o);
+ //}
+
+
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return ToArgb().GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Color as a string in ARGB notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ if (myname != "")
+ return "Color [" + myname + "]";
+
+ return String.Format ("Color [A={0}, R={1}, G={2}, B={3}]", a, r, g, b);
+ }
+
+ private static void CheckRGBValues (int red,int green,int blue)
+ {
+ if( (red > 255) || (red < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("red",red,"Value must be in the range 0 - 255");
+ if( (green > 255) || (green < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("green",green,"Value must be in the range 0 - 255");
+ if( (blue > 255) || (blue < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("blue",blue,"Value must be in the range 0 - 255");
+ }
+
+ private static void CheckARGBValues (int alpha,int red,int green,int blue)
+ {
+ if( (alpha > 255) || (alpha < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("alpha",alpha,"Value must be in the range 0 - 255");
+ CheckRGBValues(red,green,blue);
+ }
+
+ //Documentation, do not remove!
+ //This is the program that was used to generate the C# source code below.
+ //using System;
+ //using System.Diagnostics;
+ //using System.Drawing;
+ //using System.Reflection;
+ //public class m {
+ //static void Main(string[] args)
+ //{
+ // Type cType = typeof (Color);
+ // PropertyInfo [] properties = cType.GetProperties ();
+ // foreach (PropertyInfo property in properties) {
+ // MethodInfo method = property.GetGetMethod();
+ // if (method != null && method.IsStatic && method.ReturnType == cType) {
+ // Color c = (Color) method.Invoke( null, new object[0] );
+ // Console.WriteLine("static public Color " + property.Name);
+ // Console.WriteLine("{\t\n\tget {");
+ // Console.WriteLine("\t\treturn Color.FromArgbNamed ({0}, {1}, {2}, {3}, \"{4}\");",
+ // c.A, c.R, c.G, c.B, property.Name);
+ // Console.WriteLine("\t}");
+ // Console.WriteLine("}\n");
+ // }
+ // }
+ //}
+ //}
+
+ static public Color Transparent
+ {
+ get {
+ return Color.FromArgbNamed (0, 255, 255, 255, "Transparent");
+ }
+ }
+
+ static public Color AliceBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 240, 248, 255, "AliceBlue");
+ }
+ }
+
+ static public Color AntiqueWhite
+ {
+ get {
+ return Color.FromArgbNamed (255, 250, 235, 215, "AntiqueWhite");
+ }
+ }
+
+ static public Color Aqua
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 255, 255, "Aqua");
+ }
+ }
+
+ static public Color Aquamarine
+ {
+ get {
+ return Color.FromArgbNamed (255, 127, 255, 212, "Aquamarine");
+ }
+ }
+
+ static public Color Azure
+ {
+ get {
+ return Color.FromArgbNamed (255, 240, 255, 255, "Azure");
+ }
+ }
+
+ static public Color Beige
+ {
+ get {
+ return Color.FromArgbNamed (255, 245, 245, 220, "Beige");
+ }
+ }
+
+ static public Color Bisque
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 228, 196, "Bisque");
+ }
+ }
+
+ static public Color Black
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 0, 0, "Black");
+ }
+ }
+
+ static public Color BlanchedAlmond
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 235, 205, "BlanchedAlmond");
+ }
+ }
+
+ static public Color Blue
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 0, 255, "Blue");
+ }
+ }
+
+ static public Color BlueViolet
+ {
+ get {
+ return Color.FromArgbNamed (255, 138, 43, 226, "BlueViolet");
+ }
+ }
+
+ static public Color Brown
+ {
+ get {
+ return Color.FromArgbNamed (255, 165, 42, 42, "Brown");
+ }
+ }
+
+ static public Color BurlyWood
+ {
+ get {
+ return Color.FromArgbNamed (255, 222, 184, 135, "BurlyWood");
+ }
+ }
+
+ static public Color CadetBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 95, 158, 160, "CadetBlue");
+ }
+ }
+
+ static public Color Chartreuse
+ {
+ get {
+ return Color.FromArgbNamed (255, 127, 255, 0, "Chartreuse");
+ }
+ }
+
+ static public Color Chocolate
+ {
+ get {
+ return Color.FromArgbNamed (255, 210, 105, 30, "Chocolate");
+ }
+ }
+
+ static public Color Coral
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 127, 80, "Coral");
+ }
+ }
+
+ static public Color CornflowerBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 100, 149, 237, "CornflowerBlue");
+ }
+ }
+
+ static public Color Cornsilk
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 248, 220, "Cornsilk");
+ }
+ }
+
+ static public Color Crimson
+ {
+ get {
+ return Color.FromArgbNamed (255, 220, 20, 60, "Crimson");
+ }
+ }
+
+ static public Color Cyan
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 255, 255, "Cyan");
+ }
+ }
+
+ static public Color DarkBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 0, 139, "DarkBlue");
+ }
+ }
+
+ static public Color DarkCyan
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 139, 139, "DarkCyan");
+ }
+ }
+
+ static public Color DarkGoldenrod
+ {
+ get {
+ return Color.FromArgbNamed (255, 184, 134, 11, "DarkGoldenrod");
+ }
+ }
+
+ static public Color DarkGray
+ {
+ get {
+ return Color.FromArgbNamed (255, 169, 169, 169, "DarkGray");
+ }
+ }
+
+ static public Color DarkGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 100, 0, "DarkGreen");
+ }
+ }
+
+ static public Color DarkKhaki
+ {
+ get {
+ return Color.FromArgbNamed (255, 189, 183, 107, "DarkKhaki");
+ }
+ }
+
+ static public Color DarkMagenta
+ {
+ get {
+ return Color.FromArgbNamed (255, 139, 0, 139, "DarkMagenta");
+ }
+ }
+
+ static public Color DarkOliveGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 85, 107, 47, "DarkOliveGreen");
+ }
+ }
+
+ static public Color DarkOrange
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 140, 0, "DarkOrange");
+ }
+ }
+
+ static public Color DarkOrchid
+ {
+ get {
+ return Color.FromArgbNamed (255, 153, 50, 204, "DarkOrchid");
+ }
+ }
+
+ static public Color DarkRed
+ {
+ get {
+ return Color.FromArgbNamed (255, 139, 0, 0, "DarkRed");
+ }
+ }
+
+ static public Color DarkSalmon
+ {
+ get {
+ return Color.FromArgbNamed (255, 233, 150, 122, "DarkSalmon");
+ }
+ }
+
+ static public Color DarkSeaGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 143, 188, 139, "DarkSeaGreen");
+ }
+ }
+
+ static public Color DarkSlateBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 72, 61, 139, "DarkSlateBlue");
+ }
+ }
+
+ static public Color DarkSlateGray
+ {
+ get {
+ return Color.FromArgbNamed (255, 47, 79, 79, "DarkSlateGray");
+ }
+ }
+
+ static public Color DarkTurquoise
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 206, 209, "DarkTurquoise");
+ }
+ }
+
+ static public Color DarkViolet
+ {
+ get {
+ return Color.FromArgbNamed (255, 148, 0, 211, "DarkViolet");
+ }
+ }
+
+ static public Color DeepPink
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 20, 147, "DeepPink");
+ }
+ }
+
+ static public Color DeepSkyBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 191, 255, "DeepSkyBlue");
+ }
+ }
+
+ static public Color DimGray
+ {
+ get {
+ return Color.FromArgbNamed (255, 105, 105, 105, "DimGray");
+ }
+ }
+
+ static public Color DodgerBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 30, 144, 255, "DodgerBlue");
+ }
+ }
+
+ static public Color Firebrick
+ {
+ get {
+ return Color.FromArgbNamed (255, 178, 34, 34, "Firebrick");
+ }
+ }
+
+ static public Color FloralWhite
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 250, 240, "FloralWhite");
+ }
+ }
+
+ static public Color ForestGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 34, 139, 34, "ForestGreen");
+ }
+ }
+
+ static public Color Fuchsia
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 0, 255, "Fuchsia");
+ }
+ }
+
+ static public Color Gainsboro
+ {
+ get {
+ return Color.FromArgbNamed (255, 220, 220, 220, "Gainsboro");
+ }
+ }
+
+ static public Color GhostWhite
+ {
+ get {
+ return Color.FromArgbNamed (255, 248, 248, 255, "GhostWhite");
+ }
+ }
+
+ static public Color Gold
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 215, 0, "Gold");
+ }
+ }
+
+ static public Color Goldenrod
+ {
+ get {
+ return Color.FromArgbNamed (255, 218, 165, 32, "Goldenrod");
+ }
+ }
+
+ static public Color Gray
+ {
+ get {
+ return Color.FromArgbNamed (255, 128, 128, 128, "Gray");
+ }
+ }
+
+ static public Color Green
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 128, 0, "Green");
+ }
+ }
+
+ static public Color GreenYellow
+ {
+ get {
+ return Color.FromArgbNamed (255, 173, 255, 47, "GreenYellow");
+ }
+ }
+
+ static public Color Honeydew
+ {
+ get {
+ return Color.FromArgbNamed (255, 240, 255, 240, "Honeydew");
+ }
+ }
+
+ static public Color HotPink
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 105, 180, "HotPink");
+ }
+ }
+
+ static public Color IndianRed
+ {
+ get {
+ return Color.FromArgbNamed (255, 205, 92, 92, "IndianRed");
+ }
+ }
+
+ static public Color Indigo
+ {
+ get {
+ return Color.FromArgbNamed (255, 75, 0, 130, "Indigo");
+ }
+ }
+
+ static public Color Ivory
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 255, 240, "Ivory");
+ }
+ }
+
+ static public Color Khaki
+ {
+ get {
+ return Color.FromArgbNamed (255, 240, 230, 140, "Khaki");
+ }
+ }
+
+ static public Color Lavender
+ {
+ get {
+ return Color.FromArgbNamed (255, 230, 230, 250, "Lavender");
+ }
+ }
+
+ static public Color LavenderBlush
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 240, 245, "LavenderBlush");
+ }
+ }
+
+ static public Color LawnGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 124, 252, 0, "LawnGreen");
+ }
+ }
+
+ static public Color LemonChiffon
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 250, 205, "LemonChiffon");
+ }
+ }
+
+ static public Color LightBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 173, 216, 230, "LightBlue");
+ }
+ }
+
+ static public Color LightCoral
+ {
+ get {
+ return Color.FromArgbNamed (255, 240, 128, 128, "LightCoral");
+ }
+ }
+
+ static public Color LightCyan
+ {
+ get {
+ return Color.FromArgbNamed (255, 224, 255, 255, "LightCyan");
+ }
+ }
+
+ static public Color LightGoldenrodYellow
+ {
+ get {
+ return Color.FromArgbNamed (255, 250, 250, 210, "LightGoldenrodYellow");
+ }
+ }
+
+ static public Color LightGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 144, 238, 144, "LightGreen");
+ }
+ }
+
+ static public Color LightGray
+ {
+ get {
+ return Color.FromArgbNamed (255, 211, 211, 211, "LightGray");
+ }
+ }
+
+ static public Color LightPink
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 182, 193, "LightPink");
+ }
+ }
+
+ static public Color LightSalmon
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 160, 122, "LightSalmon");
+ }
+ }
+
+ static public Color LightSeaGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 32, 178, 170, "LightSeaGreen");
+ }
+ }
+
+ static public Color LightSkyBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 135, 206, 250, "LightSkyBlue");
+ }
+ }
+
+ static public Color LightSlateGray
+ {
+ get {
+ return Color.FromArgbNamed (255, 119, 136, 153, "LightSlateGray");
+ }
+ }
+
+ static public Color LightSteelBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 176, 196, 222, "LightSteelBlue");
+ }
+ }
+
+ static public Color LightYellow
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 255, 224, "LightYellow");
+ }
+ }
+
+ static public Color Lime
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 255, 0, "Lime");
+ }
+ }
+
+ static public Color LimeGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 50, 205, 50, "LimeGreen");
+ }
+ }
+
+ static public Color Linen
+ {
+ get {
+ return Color.FromArgbNamed (255, 250, 240, 230, "Linen");
+ }
+ }
+
+ static public Color Magenta
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 0, 255, "Magenta");
+ }
+ }
+
+ static public Color Maroon
+ {
+ get {
+ return Color.FromArgbNamed (255, 128, 0, 0, "Maroon");
+ }
+ }
+
+ static public Color MediumAquamarine
+ {
+ get {
+ return Color.FromArgbNamed (255, 102, 205, 170, "MediumAquamarine");
+ }
+ }
+
+ static public Color MediumBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 0, 205, "MediumBlue");
+ }
+ }
+
+ static public Color MediumOrchid
+ {
+ get {
+ return Color.FromArgbNamed (255, 186, 85, 211, "MediumOrchid");
+ }
+ }
+
+ static public Color MediumPurple
+ {
+ get {
+ return Color.FromArgbNamed (255, 147, 112, 219, "MediumPurple");
+ }
+ }
+
+ static public Color MediumSeaGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 60, 179, 113, "MediumSeaGreen");
+ }
+ }
+
+ static public Color MediumSlateBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 123, 104, 238, "MediumSlateBlue");
+ }
+ }
+
+ static public Color MediumSpringGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 250, 154, "MediumSpringGreen");
+ }
+ }
+
+ static public Color MediumTurquoise
+ {
+ get {
+ return Color.FromArgbNamed (255, 72, 209, 204, "MediumTurquoise");
+ }
+ }
+
+ static public Color MediumVioletRed
+ {
+ get {
+ return Color.FromArgbNamed (255, 199, 21, 133, "MediumVioletRed");
+ }
+ }
+
+ static public Color MidnightBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 25, 25, 112, "MidnightBlue");
+ }
+ }
+
+ static public Color MintCream
+ {
+ get {
+ return Color.FromArgbNamed (255, 245, 255, 250, "MintCream");
+ }
+ }
+
+ static public Color MistyRose
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 228, 225, "MistyRose");
+ }
+ }
+
+ static public Color Moccasin
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 228, 181, "Moccasin");
+ }
+ }
+
+ static public Color NavajoWhite
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 222, 173, "NavajoWhite");
+ }
+ }
+
+ static public Color Navy
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 0, 128, "Navy");
+ }
+ }
+
+ static public Color OldLace
+ {
+ get {
+ return Color.FromArgbNamed (255, 253, 245, 230, "OldLace");
+ }
+ }
+
+ static public Color Olive
+ {
+ get {
+ return Color.FromArgbNamed (255, 128, 128, 0, "Olive");
+ }
+ }
+
+ static public Color OliveDrab
+ {
+ get {
+ return Color.FromArgbNamed (255, 107, 142, 35, "OliveDrab");
+ }
+ }
+
+ static public Color Orange
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 165, 0, "Orange");
+ }
+ }
+
+ static public Color OrangeRed
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 69, 0, "OrangeRed");
+ }
+ }
+
+ static public Color Orchid
+ {
+ get {
+ return Color.FromArgbNamed (255, 218, 112, 214, "Orchid");
+ }
+ }
+
+ static public Color PaleGoldenrod
+ {
+ get {
+ return Color.FromArgbNamed (255, 238, 232, 170, "PaleGoldenrod");
+ }
+ }
+
+ static public Color PaleGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 152, 251, 152, "PaleGreen");
+ }
+ }
+
+ static public Color PaleTurquoise
+ {
+ get {
+ return Color.FromArgbNamed (255, 175, 238, 238, "PaleTurquoise");
+ }
+ }
+
+ static public Color PaleVioletRed
+ {
+ get {
+ return Color.FromArgbNamed (255, 219, 112, 147, "PaleVioletRed");
+ }
+ }
+
+ static public Color PapayaWhip
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 239, 213, "PapayaWhip");
+ }
+ }
+
+ static public Color PeachPuff
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 218, 185, "PeachPuff");
+ }
+ }
+
+ static public Color Peru
+ {
+ get {
+ return Color.FromArgbNamed (255, 205, 133, 63, "Peru");
+ }
+ }
+
+ static public Color Pink
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 192, 203, "Pink");
+ }
+ }
+
+ static public Color Plum
+ {
+ get {
+ return Color.FromArgbNamed (255, 221, 160, 221, "Plum");
+ }
+ }
+
+ static public Color PowderBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 176, 224, 230, "PowderBlue");
+ }
+ }
+
+ static public Color Purple
+ {
+ get {
+ return Color.FromArgbNamed (255, 128, 0, 128, "Purple");
+ }
+ }
+
+ static public Color Red
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 0, 0, "Red");
+ }
+ }
+
+ static public Color RosyBrown
+ {
+ get {
+ return Color.FromArgbNamed (255, 188, 143, 143, "RosyBrown");
+ }
+ }
+
+ static public Color RoyalBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 65, 105, 225, "RoyalBlue");
+ }
+ }
+
+ static public Color SaddleBrown
+ {
+ get {
+ return Color.FromArgbNamed (255, 139, 69, 19, "SaddleBrown");
+ }
+ }
+
+ static public Color Salmon
+ {
+ get {
+ return Color.FromArgbNamed (255, 250, 128, 114, "Salmon");
+ }
+ }
+
+ static public Color SandyBrown
+ {
+ get {
+ return Color.FromArgbNamed (255, 244, 164, 96, "SandyBrown");
+ }
+ }
+
+ static public Color SeaGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 46, 139, 87, "SeaGreen");
+ }
+ }
+
+ static public Color SeaShell
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 245, 238, "SeaShell");
+ }
+ }
+
+ static public Color Sienna
+ {
+ get {
+ return Color.FromArgbNamed (255, 160, 82, 45, "Sienna");
+ }
+ }
+
+ static public Color Silver
+ {
+ get {
+ return Color.FromArgbNamed (255, 192, 192, 192, "Silver");
+ }
+ }
+
+ static public Color SkyBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 135, 206, 235, "SkyBlue");
+ }
+ }
+
+ static public Color SlateBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 106, 90, 205, "SlateBlue");
+ }
+ }
+
+ static public Color SlateGray
+ {
+ get {
+ return Color.FromArgbNamed (255, 112, 128, 144, "SlateGray");
+ }
+ }
+
+ static public Color Snow
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 250, 250, "Snow");
+ }
+ }
+
+ static public Color SpringGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 255, 127, "SpringGreen");
+ }
+ }
+
+ static public Color SteelBlue
+ {
+ get {
+ return Color.FromArgbNamed (255, 70, 130, 180, "SteelBlue");
+ }
+ }
+
+ static public Color Tan
+ {
+ get {
+ return Color.FromArgbNamed (255, 210, 180, 140, "Tan");
+ }
+ }
+
+ static public Color Teal
+ {
+ get {
+ return Color.FromArgbNamed (255, 0, 128, 128, "Teal");
+ }
+ }
+
+ static public Color Thistle
+ {
+ get {
+ return Color.FromArgbNamed (255, 216, 191, 216, "Thistle");
+ }
+ }
+
+ static public Color Tomato
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 99, 71, "Tomato");
+ }
+ }
+
+ static public Color Turquoise
+ {
+ get {
+ return Color.FromArgbNamed (255, 64, 224, 208, "Turquoise");
+ }
+ }
+
+ static public Color Violet
+ {
+ get {
+ return Color.FromArgbNamed (255, 238, 130, 238, "Violet");
+ }
+ }
+
+ static public Color Wheat
+ {
+ get {
+ return Color.FromArgbNamed (255, 245, 222, 179, "Wheat");
+ }
+ }
+
+ static public Color White
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 255, 255, "White");
+ }
+ }
+
+ static public Color WhiteSmoke
+ {
+ get {
+ return Color.FromArgbNamed (255, 245, 245, 245, "WhiteSmoke");
+ }
+ }
+
+ static public Color Yellow
+ {
+ get {
+ return Color.FromArgbNamed (255, 255, 255, 0, "Yellow");
+ }
+ }
+
+ static public Color YellowGreen
+ {
+ get {
+ return Color.FromArgbNamed (255, 154, 205, 50, "YellowGreen");
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ColorConverter.cs b/mcs/class/System.Drawing/System.Drawing/ColorConverter.cs
new file mode 100644
index 00000000000..12554e3ada2
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ColorConverter.cs
@@ -0,0 +1,111 @@
+//
+// System.Drawing.ColorConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Drawing {
+
+public class ColorConverter : TypeConverter
+{
+ static StandardValuesCollection cached;
+ static object creatingCached = new object ();
+
+ public ColorConverter ()
+ {
+ }
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof (string))
+ return true;
+
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ [MonoTODO]
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ string s = value as string;
+ if (s == null)
+ return base.ConvertFrom (context, culture, value);
+
+ object named = Color.NamedColors [s];
+ if (named != null)
+ return (Color) named;
+
+ named = Color.SystemColors [s];
+ if (named != null)
+ return (Color) named;
+
+ int i;
+ if (s [0] == '#')
+ i = Int32.Parse (s.Substring (1), NumberStyles.HexNumber);
+ else
+ i = Int32.Parse (s, NumberStyles.Integer);
+
+ int A = (int) (i & 0xFF000000) >> 24;
+ if (A == 0)
+ A = 255;
+ return Color.FromArgb (A, (i & 0x00FF0000) >> 16, (i & 0x00FF00) >> 8, (i & 0x0FF));
+ }
+
+ [MonoTODO]
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+ {
+ if (cached != null)
+ return cached;
+
+ lock (creatingCached) {
+ if (cached != null)
+ return cached;
+
+ ICollection named = (ICollection) Color.NamedColors;
+ ICollection system = (ICollection) Color.SystemColors;
+ Array colors = Array.CreateInstance (typeof (Color), named.Count + system.Count);
+ named.CopyTo (colors, 0);
+ system.CopyTo (colors, named.Count);
+ Array.Sort (colors, 0, colors.Length, new CompareColors ());
+ cached = new StandardValuesCollection (colors);
+ }
+
+ return cached;
+ }
+
+ public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ class CompareColors : IComparer
+ {
+ public int Compare (object x, object y)
+ {
+ return String.Compare (((Color) x).Name, ((Color) y).Name);
+ }
+ }
+}
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs b/mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs
new file mode 100644
index 00000000000..b41525f9ad1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs
@@ -0,0 +1,135 @@
+//
+// System.Drawing.ColorTranslator.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+// Dennis Hayes (dennish@raytek.com)
+// Inital Implimentation 3/25/2002
+// All conversions based on best guess, will improve over time
+//
+using System;
+namespace System.Drawing {
+ public class ColorTranslator{
+ // From converisons
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HtmlFromColor"></param>
+ /// <returns></returns>
+ public static Color FromHtml(string HtmlFromColor){
+ // If first char is "#"
+ //convert "#RRGGBB" to int and use Color.FromARGB(int) to create color
+ // else //it is a color name
+ //If there is a single digit at the end of the name, remove it.
+ // Call Color.FromKnownColor(HtmlFromColor)
+
+ //At least some Html strings match .NET Colors,
+ // so this should work for those colors.
+ // .NET colors, XWindows colors, and WWWC web colors
+ // are (according to Charles Pretziod) base the same
+ //colors, so many shouold work if any do.
+ if (HtmlFromColor[0] != '#')
+ {
+ int length = HtmlFromColor.Length;
+ for (int i = length - 1; i >= 0; i--)
+ {
+ if (!Char.IsDigit (HtmlFromColor[i]))
+ break;
+ length--;
+ }
+
+ return Color.FromName(HtmlFromColor.Substring (0, length));
+ }
+
+ int pos = 0, index = 0;
+ int[] rgb = new int[] {0, 0, 0};
+
+ string specifier = HtmlFromColor.Substring (1).ToLower ();
+ if (specifier.Length != 6)
+ return Color.Empty;
+
+ foreach (char c in specifier)
+ {
+ rgb[index] *= 16;
+
+ if (Char.IsDigit (c))
+ rgb[index] += Int32.Parse (c.ToString ());
+ else if (c <= 'f' && c >= 'a')
+ rgb[index] += 10 + (c - 'a');
+ else
+ return Color.Empty;
+
+ pos++;
+ if ((pos % 2) == 0)
+ index++;
+ }
+
+ return Color.FromArgb (rgb[0], rgb[1], rgb[2]);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="OLEFromColor"></param>
+ /// <returns></returns>
+ public static Color FromOle(int OLEFromColor){
+ //int newcolor;
+ //TODO: swap RB bytes i.e. AARRGGBB to AABBGGRR
+ //return Color.FromArgb(newcolor);
+ return Color.Empty;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="Win32FromColor"></param>
+ /// <returns></returns>
+ public static Color FromWin32(int Win32FromColor){
+ //int newcolor;
+ //TODO: swap RB bytes i.e. AARRGGBB to AABBGGRR
+ //return Color.FromArgb(newcolor);
+ return Color.Empty;
+ }
+
+ // To conversions
+ public static string ToHtml (Color c)
+ {
+ if (c.IsEmpty)
+ return "";
+
+ string result;
+
+ if (c.IsNamedColor)
+ result = c.Name;
+ else
+ result = String.Format ("#{0:X2}{1:X2}{2:X2}", c.R, c.G, c.B);
+
+ return result;
+ }
+ /// <summary>
+ /// converts from BGR to RGB
+ /// </summary>
+ /// <param name="OleToColor"></param>
+ /// <returns></returns>
+ public static int ToOle(Color FromColor){
+ // TODO: Swap red and blue(from argb), convert to int(toargb)
+ // Same as ToWin32
+ return (Color.FromArgb(FromColor.B,FromColor.G,FromColor.R)).ToArgb();
+ }
+
+ /// <summary>
+ /// converts from RGB to BGR
+ /// </summary>
+ /// <param name="Win32ToColor"></param>
+ /// <returns></returns>
+ public static int ToWin32(Color FromColor){
+ // TODO: Swap red and blue(from argb), convert to int(toargb)
+ // Same as ToOle
+ return (Color.FromArgb(FromColor.B,FromColor.G,FromColor.R)).ToArgb();
+ }
+ }
+}
+
+
+
+
diff --git a/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs b/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
new file mode 100644
index 00000000000..25dc8d25ce1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.ContentAlignment.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum ContentAlignment {
+ TopLeft = 0x001,
+ TopCenter = 0x002,
+ TopRight = 0x004,
+ MiddleLeft = 0x010,
+ MiddleCenter = 0x020,
+ MiddleRight = 0x040,
+ BottomLeft = 0x100,
+ BottomCenter = 0x200,
+ BottomRight = 0x400
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/FontConverter.cs b/mcs/class/System.Drawing/System.Drawing/FontConverter.cs
new file mode 100644
index 00000000000..8962ed1af57
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/FontConverter.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.FontConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for FontConverter.
+ /// </summary>
+ public class FontConverter
+ {
+ public FontConverter()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/FontFamily.cs b/mcs/class/System.Drawing/System.Drawing/FontFamily.cs
new file mode 100644
index 00000000000..6d87cf47cbf
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/FontFamily.cs
@@ -0,0 +1,19 @@
+//
+// System.Drawing.FontFamily.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing {
+ /// <summary>
+ /// Summary description for FontFamily.
+ /// </summary>
+ public class FontFamily {
+ public FontFamily() {
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/FontStyle.cs b/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
new file mode 100644
index 00000000000..ab019be9ee9
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.FontStyle.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ [Flags]
+ public enum FontStyle {
+ Regular = 0,
+ Bold = 1,
+ Italic = 2,
+ Underline = 4,
+ Strikeout = 8
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs
new file mode 100755
index 00000000000..1b08c2b006b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs
@@ -0,0 +1,23 @@
+//
+// System.Drawing.Bitmap.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+//
+// Just to get things to compile
+//
+namespace System.Drawing {
+
+ public sealed class Graphics : MarshalByRefObject, IDisposable {
+
+ public void Dispose ()
+ {
+ }
+
+ public void FillRectangle (Brush b, Rectangle r)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs b/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
new file mode 100644
index 00000000000..0b8f239ebcb
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.GraphicsUnit.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum GraphicsUnit {
+ World = 0,
+ Display = 1,
+ Pixel = 2,
+ Point = 3,
+ Inch = 4,
+ Document = 5,
+ Millimeter = 6
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Icon.cs b/mcs/class/System.Drawing/System.Drawing/Icon.cs
new file mode 100644
index 00000000000..d5855825026
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Icon.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Icon.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for Icon.
+ /// </summary>
+ public class Icon
+ {
+ public Icon()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/IconConverter.cs b/mcs/class/System.Drawing/System.Drawing/IconConverter.cs
new file mode 100644
index 00000000000..68d79cf2338
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/IconConverter.cs
@@ -0,0 +1,19 @@
+ //
+// System.Drawing.IconConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing {
+ /// <summary>
+ /// Summary description for IconConverter.
+ /// </summary>
+ public class IconConverter {
+ public IconConverter() {
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Image.cs b/mcs/class/System.Drawing/System.Drawing/Image.cs
new file mode 100644
index 00000000000..64d12ba762a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Image.cs
@@ -0,0 +1,198 @@
+//
+// System.Drawing.Image.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+//
+// Many methods are still commented. I'll care about them when all necessary
+// classes are implemented.
+//
+namespace System.Drawing {
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Serialization;
+
+//[Serializable]
+//[ComVisible(true)]
+
+public abstract class Image : MarshalByRefObject /*, ICloneable, IDisposable, ISerializable */ {
+
+ // constructor
+ public Image () {}
+
+ // public methods
+ // static
+ public static Image FromFile (string filename)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static Image FromFile (string filename, bool useEmbeddedColorManagement)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromHbitmap (IntPtr hbitmap)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromHbitmap (IntPtr hbitmap, IntPtr hpalette)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+// public static int GetPixelFormatSize (PixelFormat pixfmt)
+// {
+// // Fixme: implement me
+// throw new NotImplementedException ();
+// }
+//
+// public static bool IsAlphaPixelFormat (PixelFormat pixfmt)
+// {
+// // Fixme: implement me
+// throw new NotImplementedException ();
+// }
+//
+// public static bool IsCanonicalPixelFormat (PixelFormat pixfmt)
+// {
+// // Fixme: implement me
+// throw new NotImplementedException ();
+// }
+//
+// public static bool IsExtendedPixelFormat (PixelFormat pixfmt)
+// {
+// // Fixme: implement me
+// throw new NotImplementedException ();
+// }
+
+ // non-static
+ public RectangleF GetBounds (ref GraphicsUnit pageUnit)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ //public EncoderParameters GetEncoderParameterList(Guid encoder);
+ //public int GetFrameCount(FrameDimension dimension);
+ //public PropertyItem GetPropertyItem(int propid);
+ /*
+ public Image GetThumbnailImage(int thumbWidth, int thumbHeight,
+ Image.GetThumbnailImageAbort callback,
+ IntPtr callbackData);
+ */
+
+ public void RemovePropertyItem (int propid)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public void RotateFlip (RotateFlipType rotateFlipType)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public void Save (string filename)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ //public void Save(Stream stream, ImageFormat format);
+ //public void Save(string filename, ImageFormat format);
+ //public void Save(Stream stream, ImageCodecInfo encoder,
+ // EncoderParameters encoderParams);
+ //public void Save(string filename, ImageCodecInfo encoder,
+ // EncoderParameters encoderParams);
+ //public void SaveAdd(EncoderParameters_ encoderParams);
+ //public void SaveAdd(Image image, EncoderParameters_ encoderParams);
+ //public int SelectActiveFrame(FrameDimension dimension, int frameIndex);
+ //public void SetPropertyItem(PropertyItem propitem);
+
+ // destructor
+ ~Image() {}
+
+ // properties
+ public int Flags {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Guid[] FrameDimensionsList {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int Height {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public float HorizontalResolution {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+// public ColorPalette Palette {
+// get {
+// throw new NotImplementedException ();
+// }
+// set {
+// throw new NotImplementedException ();
+// }
+// }
+
+ public SizeF PhysicalDimension {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+// public PixelFormat PixelFormat {
+// get {
+// throw new NotImplementedException ();
+// }
+// }
+
+ public int[] PropertyIdList {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //public PropertyItem[] PropertyItems {get;}
+ //public ImageFormat RawFormat {get;}
+
+ public Size Size {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public float VerticalResolution {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int Width {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+}
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ImageAnimator.cs b/mcs/class/System.Drawing/System.Drawing/ImageAnimator.cs
new file mode 100644
index 00000000000..cd27fb008fc
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ImageAnimator.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.ImageAnimator.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for ImageAnimator.
+ /// </summary>
+ public class ImageAnimator
+ {
+ public ImageAnimator()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ImageConverter.cs b/mcs/class/System.Drawing/System.Drawing/ImageConverter.cs
new file mode 100644
index 00000000000..4a2e6cfe935
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ImageConverter.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.ImageConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for ImageConverter.
+ /// </summary>
+ public class ImageConverter
+ {
+ public ImageConverter()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ImageFormatConverter.cs b/mcs/class/System.Drawing/System.Drawing/ImageFormatConverter.cs
new file mode 100644
index 00000000000..ea71b0444aa
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ImageFormatConverter.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.FontConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for ImageFormatConverter.
+ /// </summary>
+ public class ImageFormatConverter
+ {
+ public ImageFormatConverter()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/KnownColor.cs b/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
new file mode 100644
index 00000000000..53d325c3943
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
@@ -0,0 +1,182 @@
+//
+// System.Drawing.Color.cs
+//
+// (C) 2002 Dennis Hayes
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Ben Houston (ben@exocortex.org)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum KnownColor {
+ ActiveBorder = 1,
+ ActiveCaption = 2,
+ ActiveCaptionText = 3,
+ AppWorkspace = 4,
+ Control = 5,
+ ControlDark = 6,
+ ControlDarkDark = 7,
+ ControlLight = 8,
+ ControlLightLight = 9,
+ ControlText = 10,
+ Desktop = 11,
+ GrayText = 12,
+ Highlight = 13,
+ HighlightText = 14,
+ HotTrack = 15,
+ InactiveBorder = 16,
+ InactiveCaption = 17,
+ InactiveCaptionText = 18,
+ Info = 19,
+ InfoText = 20,
+ Menu = 21,
+ MenuText = 22,
+ ScrollBar = 23,
+ Window = 24,
+ WindowFrame = 25,
+ WindowText = 26,
+ Transparent = 27,
+ AliceBlue = 28,
+ AntiqueWhite = 29,
+ Aqua = 30,
+ Aquamarine = 31,
+ Azure = 32,
+ Beige = 33,
+ Bisque = 34,
+ Black = 35,
+ BlanchedAlmond = 36,
+ Blue = 37,
+ BlueViolet = 38,
+ Brown = 39,
+ BurlyWood = 40,
+ CadetBlue = 41,
+ Chartreuse = 42,
+ Chocolate = 43,
+ 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,
+ DimGray = 68,
+ DodgerBlue = 69,
+ Firebrick = 70,
+ FloralWhite = 71,
+ ForestGreen = 72,
+ Fuchsia = 73,
+ Gainsboro = 74,
+ GhostWhite = 75,
+ Gold = 76,
+ Goldenrod = 77,
+ Gray = 78,
+ Green = 79,
+ GreenYellow = 80,
+ Honeydew = 81,
+ HotPink = 82,
+ IndianRed = 83,
+ Indigo = 84,
+ 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,
+ 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,
+ 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,
+ Turquoise = 161,
+ Violet = 162,
+ Wheat = 163,
+ White = 164,
+ WhiteSmoke = 165,
+ Yellow = 166,
+ YellowGreen = 167
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Pen.cs b/mcs/class/System.Drawing/System.Drawing/Pen.cs
new file mode 100755
index 00000000000..75b890476d6
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Pen.cs
@@ -0,0 +1,112 @@
+//
+// System.Drawing.Pen.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public sealed class Pen : MarshalByRefObject { //, ICloneable, IDisposable {
+ Brush brush;
+ Color color;
+ float width;
+ //PenAlignment alignment;
+
+ public Pen (Brush brush)
+ {
+ this.brush = brush;
+ width = 1;
+ }
+
+ public Pen (Color color)
+ {
+ this.color = color;
+ width = 1;
+ }
+
+ public Pen (Brush brush, float width)
+ {
+ this.width = width;
+ this.brush = brush;
+ }
+
+ public Pen (Color color, float width)
+ {
+ this.width = width;
+ this.color = color;
+ }
+
+ //
+ // Properties
+ //
+// public PenAlignment Alignment {
+// get {
+// return alignment;
+// }
+//
+// set {
+// alignment = value;
+// }
+// }
+
+ public Brush Brush {
+ get {
+ return brush;
+ }
+
+ set {
+ brush = value;
+ }
+ }
+
+ public Color Color {
+ get {
+ return color;
+ }
+
+ set {
+ color = value;
+ }
+ }
+
+ public float Width {
+ get {
+ return width;
+ }
+ set {
+ width = value;
+ }
+ }
+
+// public object Clone ()
+// {
+// Pen p = new Pen (brush, width);
+//
+// p.color = color;
+// p.alignment = alignment;
+//
+// return p;
+// }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
+ }
+
+ void Dispose (bool disposing)
+ {
+ // Nothing for now.
+ }
+
+ ~Pen ()
+ {
+ Dispose (false);
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Point.cs b/mcs/class/System.Drawing/System.Drawing/Point.cs
new file mode 100644
index 00000000000..fa0db9abc9b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Point.cs
@@ -0,0 +1,339 @@
+//
+// System.Drawing.Point.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct Point {
+
+ // Private x and y coordinate fields.
+ int cx, cy;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Point Structure.
+ /// </remarks>
+
+ public static readonly Point Empty;
+
+ /// <summary>
+ /// Ceiling Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Point structure from a PointF structure by
+ /// taking the ceiling of the X and Y properties.
+ /// </remarks>
+
+ public static Point Ceiling (PointF value)
+ {
+ int x, y;
+ checked {
+ x = (int) Math.Ceiling (value.X);
+ y = (int) Math.Ceiling (value.Y);
+ }
+
+ return new Point (x, y);
+ }
+
+ /// <summary>
+ /// Round Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Point structure from a PointF structure by
+ /// rounding the X and Y properties.
+ /// </remarks>
+
+ public static Point Round (PointF value)
+ {
+ int x, y;
+ checked {
+ x = (int) Math.Round (value.X);
+ y = (int) Math.Round (value.Y);
+ }
+
+ return new Point (x, y);
+ }
+
+ /// <summary>
+ /// Truncate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Point structure from a PointF structure by
+ /// truncating the X and Y properties.
+ /// </remarks>
+
+ // LAMESPEC: Should this be floor, or a pure cast to int?
+
+ public static Point Truncate (PointF value)
+ {
+ int x, y;
+ checked {
+ x = (int) value.X;
+ y = (int) value.Y;
+ }
+
+ return new Point (x, y);
+ }
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a Point using the Width and Height
+ /// properties of the given <typeref>Size</typeref>.
+ /// </remarks>
+
+ public static Point operator + (Point pt, Size sz)
+ {
+ return new Point (pt.X + sz.Width, pt.Y + sz.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Point objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator == (Point pt_a, Point pt_b)
+ {
+ return ((pt_a.X == pt_b.X) && (pt_a.Y == pt_b.Y));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Point objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator != (Point pt_a, Point pt_b)
+ {
+ return ((pt_a.X != pt_b.X) || (pt_a.Y != pt_b.Y));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a Point using the negation of the Width
+ /// and Height properties of the given Size.
+ /// </remarks>
+
+ public static Point operator - (Point pt, Size sz)
+ {
+ return new Point (pt.X - sz.Width, pt.Y - sz.Height);
+ }
+
+ /// <summary>
+ /// Point to Size Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns a Size based on the Coordinates of a given
+ /// Point. Requires explicit cast.
+ /// </remarks>
+
+ public static explicit operator Size (Point pt)
+ {
+ return new Size (pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// Point to PointF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a PointF based on the coordinates of a given
+ /// Point. No explicit cast is required.
+ /// </remarks>
+
+ public static implicit operator PointF (Point pt)
+ {
+ return new PointF (pt.X, pt.Y);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// Point Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Point from an integer which holds the X
+ /// coordinate in the high order 16 bits and the Y
+ /// coordinate in the low order 16 bits.
+ /// </remarks>
+
+ public Point (int dw)
+ {
+ cx = dw >> 16;
+ cy = dw & 0xffff;
+ }
+
+ /// <summary>
+ /// Point Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Point from a Size value.
+ /// </remarks>
+
+ public Point (Size sz)
+ {
+ cx = sz.Width;
+ cy = sz.Height;
+ }
+
+ /// <summary>
+ /// Point Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Point from a specified x,y coordinate pair.
+ /// </remarks>
+
+ public Point (int x, int y)
+ {
+ cx = x;
+ cy = y;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both X and Y are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((cx == 0) && (cy == 0));
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the Point.
+ /// </remarks>
+
+ public int X {
+ get {
+ return cx;
+ }
+ set {
+ cx = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the Point.
+ /// </remarks>
+
+ public int Y {
+ get {
+ return cy;
+ }
+ set {
+ cy = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Point and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Point))
+ return false;
+
+ return (this == (Point) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return cx^cy;
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the Point a specified distance.
+ /// </remarks>
+
+ public void Offset (int dx, int dy)
+ {
+ cx += dx;
+ cy += dy;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Point as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", cx, cy);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/PointConverter.cs b/mcs/class/System.Drawing/System.Drawing/PointConverter.cs
new file mode 100644
index 00000000000..f9258ae15b5
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/PointConverter.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.PointConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for PointConverter.
+ /// </summary>
+ public class PointConverter
+ {
+ public PointConverter()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/PointF.cs b/mcs/class/System.Drawing/System.Drawing/PointF.cs
new file mode 100644
index 00000000000..42895bdac4a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/PointF.cs
@@ -0,0 +1,204 @@
+//
+// System.Drawing.PointF.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct PointF {
+
+ // Private x and y coordinate fields.
+ float cx, cy;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized PointF Structure.
+ /// </remarks>
+
+ public static readonly PointF Empty;
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a PointF using the Width and Height
+ /// properties of the given Size.
+ /// </remarks>
+
+ public static PointF operator + (PointF pt, Size sz)
+ {
+ return new PointF (pt.X + sz.Width, pt.Y + sz.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PointF objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator == (PointF pt_a, PointF pt_b)
+ {
+ return ((pt_a.X == pt_b.X) && (pt_a.Y == pt_b.Y));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PointF objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator != (PointF pt_a, PointF pt_b)
+ {
+ return ((pt_a.X != pt_b.X) || (pt_a.Y != pt_b.Y));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a PointF using the negation of the Width
+ /// and Height properties of the given Size.
+ /// </remarks>
+
+ public static PointF operator - (PointF pt, Size sz)
+ {
+ return new PointF (pt.X - sz.Width, pt.Y - sz.Height);
+ }
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ /// PointF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a PointF from a specified x,y coordinate pair.
+ /// </remarks>
+
+ public PointF (float x, float y)
+ {
+ cx = x;
+ cy = y;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both X and Y are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((cx == 0.0) && (cy == 0.0));
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the PointF.
+ /// </remarks>
+
+ public float X {
+ get {
+ return cx;
+ }
+ set {
+ cx = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the PointF.
+ /// </remarks>
+
+ public float Y {
+ get {
+ return cy;
+ }
+ set {
+ cy = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this PointF and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is PointF))
+ return false;
+
+ return (this == (PointF) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return (int) cx ^ (int) cy;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the PointF as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", cx, cy);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Rectangle.cs b/mcs/class/System.Drawing/System.Drawing/Rectangle.cs
new file mode 100644
index 00000000000..45f28755102
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Rectangle.cs
@@ -0,0 +1,584 @@
+//
+// System.Drawing.Rectangle.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct Rectangle {
+
+ // Private position and size fields.
+ private Point loc;
+ private Size sz;
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Rectangle Structure.
+ /// </remarks>
+
+ public static readonly Rectangle Empty;
+
+ /// <summary>
+ /// Ceiling Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from a RectangleF
+ /// structure by taking the ceiling of the X, Y, Width,
+ /// and Height properties.
+ /// </remarks>
+
+ public static Rectangle Ceiling (RectangleF value)
+ {
+ int x, y, w, h;
+ checked {
+ x = (int) Math.Ceiling (value.X);
+ y = (int) Math.Ceiling (value.Y);
+ w = (int) Math.Ceiling (value.Width);
+ h = (int) Math.Ceiling (value.Height);
+ }
+
+ return new Rectangle (x, y, w, h);
+ }
+
+ /// <summary>
+ /// FromLTRB Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from left, top, right,
+ /// and bottom coordinates.
+ /// </remarks>
+
+ public static Rectangle FromLTRB (int left, int top,
+ int right, int bottom)
+ {
+ return new Rectangle (left, top, right - left,
+ bottom - top);
+ }
+
+ /// <summary>
+ /// Inflate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new Rectangle by inflating an existing
+ /// Rectangle by the specified coordinate values.
+ /// </remarks>
+
+ public static Rectangle Inflate (Rectangle rect, int x, int y)
+ {
+ Rectangle r = new Rectangle (rect.Location, rect.Size);
+ r.Inflate (x, y);
+ return r;
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the Rectangle by a specified width and height.
+ /// </remarks>
+
+ public void Inflate (int width, int height)
+ {
+ Inflate (new Size (width, height));
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the Rectangle by a specified Size.
+ /// </remarks>
+
+ public void Inflate (Size sz)
+ {
+ loc -= sz;
+ Size ds = new Size (sz.Width * 2, sz.Height * 2);
+ this.sz += ds;
+ }
+
+ /// <summary>
+ /// Intersect Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new Rectangle by intersecting 2 existing
+ /// Rectangles. Returns null if there is no intersection.
+ /// </remarks>
+
+ public static Rectangle Intersect (Rectangle r1, Rectangle r2)
+ {
+ Rectangle r = new Rectangle (r1.Location, r1.Size);
+ r.Intersect (r2);
+ return r;
+ }
+
+ /// <summary>
+ /// Intersect Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Replaces the Rectangle with the intersection of itself
+ /// and another Rectangle.
+ /// </remarks>
+
+ public void Intersect (Rectangle r)
+ {
+ if (!IntersectsWith (r)) {
+ loc = Point.Empty;
+ sz = Size.Empty;
+ }
+
+ X = Math.Max (Left, r.Left);
+ Y = Math.Max (Top, r.Top);
+ Width = Math.Min (Right, r.Right) - X;
+ Height = Math.Min (Bottom, r.Bottom) - Y;
+ }
+
+ /// <summary>
+ /// Round Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from a RectangleF by
+ /// rounding the X, Y, Width, and Height properties.
+ /// </remarks>
+
+ public static Rectangle Round (RectangleF value)
+ {
+ int x, y, w, h;
+ checked {
+ x = (int) Math.Round (value.X);
+ y = (int) Math.Round (value.Y);
+ w = (int) Math.Round (value.Width);
+ h = (int) Math.Round (value.Height);
+ }
+
+ return new Rectangle (x, y, w, h);
+ }
+
+ /// <summary>
+ /// Truncate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from a RectangleF by
+ /// truncating the X, Y, Width, and Height properties.
+ /// </remarks>
+
+ // LAMESPEC: Should this be floor, or a pure cast to int?
+
+ public static Rectangle Truncate (RectangleF value)
+ {
+ int x, y, w, h;
+ checked {
+ x = (int) value.X;
+ y = (int) value.Y;
+ w = (int) value.Width;
+ h = (int) value.Height;
+ }
+
+ return new Rectangle (x, y, w, h);
+ }
+
+ /// <summary>
+ /// Union Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new Rectangle from the union of 2 existing
+ /// Rectangles.
+ /// </remarks>
+
+ public static Rectangle Union (Rectangle r1, Rectangle r2)
+ {
+ return FromLTRB (Math.Min (r1.Left, r2.Left),
+ Math.Min (r1.Top, r2.Top),
+ Math.Max (r1.Right, r2.Right),
+ Math.Max (r1.Bottom, r2.Bottom));
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Rectangle objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two Rectangles.
+ /// </remarks>
+
+ public static bool operator == (Rectangle r1, Rectangle r2)
+ {
+ return ((r1.Location == r2.Location) &&
+ (r1.Size == r2.Size));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Rectangle objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two Rectangles.
+ /// </remarks>
+
+ public static bool operator != (Rectangle r1, Rectangle r2)
+ {
+ return ((r1.Location != r2.Location) ||
+ (r1.Size != r2.Size));
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// Rectangle Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Rectangle from Point and Size values.
+ /// </remarks>
+
+ public Rectangle (Point loc, Size sz)
+ {
+ this.loc = loc;
+ this.sz = sz;
+ }
+
+ /// <summary>
+ /// Rectangle Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Rectangle from a specified x,y location and
+ /// width and height values.
+ /// </remarks>
+
+ public Rectangle (int x, int y, int width, int height)
+ {
+ loc = new Point (x, y);
+ sz = new Size (width, height);
+ }
+
+
+
+ /// <summary>
+ /// Bottom Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the bottom edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Bottom {
+ get {
+ return Y + Height;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height of the Rectangle.
+ /// </remarks>
+
+ public int Height {
+ get {
+ return sz.Height;
+ }
+ set {
+ sz.Height = value;
+ }
+ }
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if the width or height are zero. Read only.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((sz.Width == 0) || (sz.Height == 0));
+ }
+ }
+
+ /// <summary>
+ /// Left Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the left edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Left {
+ get {
+ return X;
+ }
+ }
+
+ /// <summary>
+ /// Location Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Location of the top-left corner of the Rectangle.
+ /// </remarks>
+
+ public Point Location {
+ get {
+ return loc;
+ }
+ set {
+ loc = value;
+ }
+ }
+
+ /// <summary>
+ /// Right Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the right edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Right {
+ get {
+ return X + Width;
+ }
+ }
+
+ /// <summary>
+ /// Size Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Size of the Rectangle.
+ /// </remarks>
+
+ public Size Size {
+ get {
+ return sz;
+ }
+ set {
+ sz = value;
+ }
+ }
+
+ /// <summary>
+ /// Top Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the top edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Top {
+ get {
+ return Y;
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width of the Rectangle.
+ /// </remarks>
+
+ public int Width {
+ get {
+ return sz.Width;
+ }
+ set {
+ sz.Width = value;
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the Rectangle.
+ /// </remarks>
+
+ public int X {
+ get {
+ return loc.X;
+ }
+ set {
+ loc.X = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the Rectangle.
+ /// </remarks>
+
+ public int Y {
+ get {
+ return loc.Y;
+ }
+ set {
+ loc.Y = value;
+ }
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if an x,y coordinate lies within this Rectangle.
+ /// </remarks>
+
+ public bool Contains (int x, int y)
+ {
+ return ((x >= Left) && (x <= Right) &&
+ (y >= Top) && (y <= Bottom));
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Point lies within this Rectangle.
+ /// </remarks>
+
+ public bool Contains (Point pt)
+ {
+ return Contains (pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Rectangle lies entirely within this
+ /// Rectangle.
+ /// </remarks>
+
+ public bool Contains (Rectangle rect)
+ {
+ return (rect == Intersect (this, rect));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Rectangle and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Rectangle))
+ return false;
+
+ return (this == (Rectangle) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return loc.GetHashCode()^sz.GetHashCode();
+ }
+
+ /// <summary>
+ /// IntersectsWith Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Rectangle intersects with this one.
+ /// </remarks>
+
+ public bool IntersectsWith (Rectangle r)
+ {
+ return !((Left > r.Right) || (Right < r.Left) ||
+ (Top > r.Bottom) || (Bottom < r.Top));
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the Rectangle a specified distance.
+ /// </remarks>
+
+ public void Offset (int dx, int dy)
+ {
+ X += dx;
+ Y += dy;
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the Rectangle a specified distance.
+ /// </remarks>
+
+ public void Offset (Point pt)
+ {
+ loc.Offset(pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Rectangle as a string in (x,y,w,h) notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3}]",
+ X, Y, Width, Height);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs b/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs
new file mode 100644
index 00000000000..a6f60dcbe13
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.RectangleConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for RectangleConverter.
+ /// </summary>
+ public class RectangleConverter
+ {
+ public RectangleConverter()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/RectangleF.cs b/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
new file mode 100644
index 00000000000..cfe4a7313ed
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
@@ -0,0 +1,531 @@
+//
+// System.Drawing.RectangleF.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct RectangleF {
+
+ // Private position and size fields.
+ private PointF loc;
+ private SizeF sz;
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized RectangleF Structure.
+ /// </remarks>
+
+ public static readonly RectangleF Empty;
+
+
+ /// <summary>
+ /// FromLTRB Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a RectangleF structure from left, top, right,
+ /// and bottom coordinates.
+ /// </remarks>
+
+ public static RectangleF FromLTRB (float left, float top,
+ float right, float bottom)
+ {
+ return new RectangleF (left, top, right - left,
+ bottom - top);
+ }
+
+ /// <summary>
+ /// Inflate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new RectangleF by inflating an existing
+ /// RectangleF by the specified coordinate values.
+ /// </remarks>
+
+ public static RectangleF Inflate (RectangleF r,
+ float x, float y)
+ {
+ RectangleF ir = new RectangleF (r.Location, r.Size);
+ ir.Inflate (x, y);
+ return ir;
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the RectangleF by a specified width and height.
+ /// </remarks>
+
+ public void Inflate (float width, float height)
+ {
+ Inflate (new SizeF (width, height));
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the RectangleF by a specified Size.
+ /// </remarks>
+
+ public void Inflate (SizeF sz)
+ {
+ Offset(sz.Width, sz.Height);
+ SizeF ds = new SizeF (sz.Width * 2, sz.Height * 2);
+ this.sz += ds;
+ }
+
+ /// <summary>
+ /// Intersect Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new RectangleF by intersecting 2 existing
+ /// RectangleFs. Returns null if there is no intersection.
+ /// </remarks>
+
+ public static RectangleF Intersect (RectangleF r1,
+ RectangleF r2)
+ {
+ RectangleF r = new RectangleF (r1.Location, r1.Size);
+ r.Intersect (r2);
+ return r;
+ }
+
+ /// <summary>
+ /// Intersect Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Replaces the RectangleF with the intersection of itself
+ /// and another RectangleF.
+ /// </remarks>
+
+ public void Intersect (RectangleF r)
+ {
+ if (!IntersectsWith (r)) {
+ loc = PointF.Empty;
+ sz = SizeF.Empty;
+ }
+
+ X = Math.Max (Left, r.Left);
+ Y = Math.Max (Top, r.Top);
+ Width = Math.Min (Right, r.Right) - X;
+ Height = Math.Min (Bottom, r.Bottom) - Y;
+ }
+
+ /// <summary>
+ /// Union Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new RectangleF from the union of 2 existing
+ /// RectangleFs.
+ /// </remarks>
+
+ public static RectangleF Union (RectangleF r1, RectangleF r2)
+ {
+ return FromLTRB (Math.Min (r1.Left, r2.Left),
+ Math.Min (r1.Top, r2.Top),
+ Math.Max (r1.Right, r2.Right),
+ Math.Max (r1.Bottom, r2.Bottom));
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two RectangleF objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two RectangleFs.
+ /// </remarks>
+
+ public static bool operator == (RectangleF r1, RectangleF r2)
+ {
+ return ((r1.Location == r2.Location) &&
+ (r1.Size == r2.Size));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two RectangleF objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two RectangleFs.
+ /// </remarks>
+
+ public static bool operator != (RectangleF r1, RectangleF r2)
+ {
+ return ((r1.Location != r2.Location) ||
+ (r1.Size != r2.Size));
+ }
+
+ /// <summary>
+ /// Rectangle to RectangleF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Converts a Rectangle object to a RectangleF.
+ /// </remarks>
+
+ public static implicit operator RectangleF (Rectangle r)
+ {
+ return new RectangleF (r.Location, r.Size);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// RectangleF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a RectangleF from PointF and SizeF values.
+ /// </remarks>
+
+ public RectangleF (PointF loc, SizeF sz)
+ {
+ this.loc = loc;
+ this.sz = sz;
+ }
+
+ /// <summary>
+ /// RectangleF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a RectangleF from a specified x,y location and
+ /// width and height values.
+ /// </remarks>
+
+ public RectangleF (float x, float y, float width, float height)
+ {
+ loc = new PointF (x, y);
+ sz = new SizeF (width, height);
+ }
+
+
+
+ /// <summary>
+ /// Bottom Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the bottom edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Bottom {
+ get {
+ return Y + Height;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height of the RectangleF.
+ /// </remarks>
+
+ public float Height {
+ get {
+ return sz.Height;
+ }
+ set {
+ sz.Height = value;
+ }
+ }
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if the width or height are zero. Read only.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((sz.Width == 0) || (sz.Height == 0));
+ }
+ }
+
+ /// <summary>
+ /// Left Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the left edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Left {
+ get {
+ return X;
+ }
+ }
+
+ /// <summary>
+ /// Location Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Location of the top-left corner of the RectangleF.
+ /// </remarks>
+
+ public PointF Location {
+ get {
+ return loc;
+ }
+ set {
+ loc = value;
+ }
+ }
+
+ /// <summary>
+ /// Right Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the right edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Right {
+ get {
+ return X + Width;
+ }
+ }
+
+ /// <summary>
+ /// Size Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Size of the RectangleF.
+ /// </remarks>
+
+ public SizeF Size {
+ get {
+ return sz;
+ }
+ set {
+ sz = value;
+ }
+ }
+
+ /// <summary>
+ /// Top Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the top edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Top {
+ get {
+ return Y;
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width of the RectangleF.
+ /// </remarks>
+
+ public float Width {
+ get {
+ return sz.Width;
+ }
+ set {
+ sz.Width = value;
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the RectangleF.
+ /// </remarks>
+
+ public float X {
+ get {
+ return loc.X;
+ }
+ set {
+ loc.X = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the RectangleF.
+ /// </remarks>
+
+ public float Y {
+ get {
+ return loc.Y;
+ }
+ set {
+ loc.Y = value;
+ }
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if an x,y coordinate lies within this RectangleF.
+ /// </remarks>
+
+ public bool Contains (float x, float y)
+ {
+ return ((x >= Left) && (x <= Right) &&
+ (y >= Top) && (y <= Bottom));
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Point lies within this RectangleF.
+ /// </remarks>
+
+ public bool Contains (PointF pt)
+ {
+ return Contains (pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a RectangleF lies entirely within this
+ /// RectangleF.
+ /// </remarks>
+
+ public bool Contains (RectangleF rect)
+ {
+ return (rect == Intersect (this, rect));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this RectangleF and an object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is RectangleF))
+ return false;
+
+ return (this == (RectangleF) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return loc.GetHashCode()^sz.GetHashCode();
+ }
+
+ /// <summary>
+ /// IntersectsWith Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a RectangleF intersects with this one.
+ /// </remarks>
+
+ public bool IntersectsWith (RectangleF r)
+ {
+ return !((Left > r.Right) || (Right < r.Left) ||
+ (Top > r.Bottom) || (Bottom < r.Top));
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the RectangleF a specified distance.
+ /// </remarks>
+
+ public void Offset (float dx, float dy)
+ {
+ X += dx;
+ Y += dy;
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the RectangleF a specified distance.
+ /// </remarks>
+
+ public void Offset (PointF pt)
+ {
+ Offset(pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the RectangleF in (x,y,w,h) notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3}]",
+ X, Y, Width, Height);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Region.cs b/mcs/class/System.Drawing/System.Drawing/Region.cs
new file mode 100644
index 00000000000..bb0f9f96e3d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Region.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.Region.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System;
+using System.Drawing.Drawing2D;
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for Region.
+ /// </summary>
+ ///
+ //[ComVisible(false)]
+ public sealed class Region// : MarshalByRefObject, IDisposable
+ {
+ public Region() {
+ }
+ //[comVisible(false)]
+ //public Region(GraphicsPath path) {
+ //}
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
new file mode 100644
index 00000000000..8ef9db44284
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
@@ -0,0 +1,29 @@
+//
+// System.Drawing.RotateFlipType .cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum RotateFlipType {
+ RotateNoneFlipNone = 0,
+ Rotate180FlipXY = 0,
+ Rotate90FlipNone = 1,
+ Rotate270FlipXY = 1,
+ Rotate180FlipNone = 2,
+ RotateNoneFlipXY = 2,
+ Rotate270FlipNone = 3,
+ Rotate90FlipXY = 3,
+ RotateNoneFlipX = 4,
+ Rotate180FlipY = 4,
+ Rotate90FlipX = 5,
+ Rotate270FlipY = 5,
+ Rotate180FlipX = 6,
+ RotateNoneFlipY = 6,
+ Rotate270FlipX = 7,
+ Rotate90FlipY = 7,
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Size.cs b/mcs/class/System.Drawing/System.Drawing/Size.cs
new file mode 100644
index 00000000000..d5b56d3a453
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Size.cs
@@ -0,0 +1,309 @@
+//
+// System.Drawing.Size.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct Size {
+
+ // Private height and width fields.
+ int wd, ht;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Size Structure.
+ /// </remarks>
+
+ public static readonly Size Empty;
+
+ /// <summary>
+ /// Ceiling Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Size structure from a SizeF structure by
+ /// taking the ceiling of the Width and Height properties.
+ /// </remarks>
+
+ public static Size Ceiling (SizeF value)
+ {
+ int w, h;
+ checked {
+ w = (int) Math.Ceiling (value.Width);
+ h = (int) Math.Ceiling (value.Height);
+ }
+
+ return new Size (w, h);
+ }
+
+ /// <summary>
+ /// Round Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Size structure from a SizeF structure by
+ /// rounding the Width and Height properties.
+ /// </remarks>
+
+ public static Size Round (SizeF value)
+ {
+ int w, h;
+ checked {
+ w = (int) Math.Round (value.Width);
+ h = (int) Math.Round (value.Height);
+ }
+
+ return new Size (w, h);
+ }
+
+ /// <summary>
+ /// Truncate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Size structure from a SizeF structure by
+ /// truncating the Width and Height properties.
+ /// </remarks>
+
+ public static Size Truncate (SizeF value)
+ {
+ int w, h;
+ checked {
+ w = (int) value.Width;
+ h = (int) value.Height;
+ }
+
+ return new Size (w, h);
+ }
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Addition of two Size structures.
+ /// </remarks>
+
+ public static Size operator + (Size sz1, Size sz2)
+ {
+ return new Size (sz1.Width + sz2.Width,
+ sz1.Height + sz2.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Size objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator == (Size sz_a, Size sz_b)
+ {
+ return ((sz_a.Width == sz_b.Width) &&
+ (sz_a.Height == sz_b.Height));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Size objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator != (Size sz_a, Size sz_b)
+ {
+ return ((sz_a.Width != sz_b.Width) ||
+ (sz_a.Height != sz_b.Height));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Subtracts two Size structures.
+ /// </remarks>
+
+ public static Size operator - (Size sz1, Size sz2)
+ {
+ return new Size (sz1.Width - sz2.Width,
+ sz1.Height - sz2.Height);
+ }
+
+ /// <summary>
+ /// Size to Point Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns a Point based on the dimensions of a given
+ /// Size. Requires explicit cast.
+ /// </remarks>
+
+ public static explicit operator Point (Size sz)
+ {
+ return new Point (sz.Width, sz.Height);
+ }
+
+ /// <summary>
+ /// Size to SizeF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF based on the dimensions of a given
+ /// Size. No explicit cast is required.
+ /// </remarks>
+
+ public static implicit operator SizeF (Size sz)
+ {
+ return new SizeF (sz.Width, sz.Height);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// Size Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Size from a Point value.
+ /// </remarks>
+
+ public Size (Point pt)
+ {
+ wd = pt.X;
+ ht = pt.Y;
+ }
+
+ /// <summary>
+ /// Size Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Size from specified dimensions.
+ /// </remarks>
+
+ public Size (int width, int height)
+ {
+ wd = width;
+ ht = height;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both Width and Height are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((wd == 0) && (ht == 0));
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width coordinate of the Size.
+ /// </remarks>
+
+ public int Width {
+ get {
+ return wd;
+ }
+ set {
+ wd = value;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height coordinate of the Size.
+ /// </remarks>
+
+ public int Height {
+ get {
+ return ht;
+ }
+ set {
+ ht = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Size and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Size))
+ return false;
+
+ return (this == (Size) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return wd^ht;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Size as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", wd, ht);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SizeConverter.cs b/mcs/class/System.Drawing/System.Drawing/SizeConverter.cs
new file mode 100644
index 00000000000..b1fea07e3e0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SizeConverter.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.SizeConverter.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for SizeConverter.
+ /// </summary>
+ public class SizeConverter
+ {
+ public SizeConverter()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SizeF.cs b/mcs/class/System.Drawing/System.Drawing/SizeF.cs
new file mode 100644
index 00000000000..1aa0155c56d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SizeF.cs
@@ -0,0 +1,249 @@
+//
+// System.Drawing.SizeF.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct SizeF {
+
+ // Private height and width fields.
+ float wd, ht;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized SizeF Structure.
+ /// </remarks>
+
+ public static readonly SizeF Empty;
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Addition of two SizeF structures.
+ /// </remarks>
+
+ public static SizeF operator + (SizeF sz1, SizeF sz2)
+ {
+ return new SizeF (sz1.Width + sz2.Width,
+ sz1.Height + sz2.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SizeF objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator == (SizeF sz_a, SizeF sz_b)
+ {
+ return ((sz_a.Width == sz_b.Width) &&
+ (sz_a.Height == sz_b.Height));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SizeF objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator != (SizeF sz_a, SizeF sz_b)
+ {
+ return ((sz_a.Width != sz_b.Width) ||
+ (sz_a.Height != sz_b.Height));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Subtracts two SizeF structures.
+ /// </remarks>
+
+ public static SizeF operator - (SizeF sz1, SizeF sz2)
+ {
+ return new SizeF (sz1.Width - sz2.Width,
+ sz1.Height - sz2.Height);
+ }
+
+ /// <summary>
+ /// SizeF to PointF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns a PointF based on the dimensions of a given
+ /// SizeF. Requires explicit cast.
+ /// </remarks>
+
+ public static explicit operator PointF (SizeF sz)
+ {
+ return new PointF (sz.Width, sz.Height);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// SizeF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF from a PointF value.
+ /// </remarks>
+
+ public SizeF (PointF pt)
+ {
+ wd = pt.X;
+ ht = pt.Y;
+ }
+
+ /// <summary>
+ /// SizeF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF from an existing SizeF value.
+ /// </remarks>
+
+ public SizeF (SizeF sz)
+ {
+ wd = sz.Width;
+ ht = sz.Height;
+ }
+
+ /// <summary>
+ /// SizeF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF from specified dimensions.
+ /// </remarks>
+
+ public SizeF (float width, float height)
+ {
+ wd = width;
+ ht = height;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both Width and Height are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((wd == 0.0) && (ht == 0.0));
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width coordinate of the SizeF.
+ /// </remarks>
+
+ public float Width {
+ get {
+ return wd;
+ }
+ set {
+ wd = value;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height coordinate of the SizeF.
+ /// </remarks>
+
+ public float Height {
+ get {
+ return ht;
+ }
+ set {
+ ht = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this SizeF and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is SizeF))
+ return false;
+
+ return (this == (SizeF) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return (int) wd ^ (int) ht;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the SizeF as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", wd, ht);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs b/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs
new file mode 100644
index 00000000000..00fb0361ace
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs
@@ -0,0 +1,36 @@
+//
+// System.Drawing.SolidBrush.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ public class SolidBrush : Brush {
+
+ Color color;
+
+ public SolidBrush( Color color ) {
+ this.color = color;
+ }
+
+ public Color Color {
+ get {
+ return color;
+ }
+ set {
+ color = value;
+ }
+ }
+
+ public override object Clone()
+ {
+ return new SolidBrush( color );
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing/StringAligment.cs b/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
new file mode 100644
index 00000000000..a3e4695bf71
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.StringAligment.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringAlignment {
+ Center = 1,
+ Far = 2,
+ Near = 3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs b/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
new file mode 100644
index 00000000000..e15c748c8f7
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
@@ -0,0 +1,18 @@
+//
+// System.Drawing.StringDigitSubstitute.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringDigitSubstitute {
+ User = 0,
+ None = 1,
+ National = 2,
+ Traditional = 3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringFormat.cs b/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
new file mode 100644
index 00000000000..54ae658705d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.StringFormat.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for StringFormat.
+ /// </summary>
+ public class StringFormat
+ {
+ public StringFormat()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs b/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
new file mode 100644
index 00000000000..6a0f0adb711
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
@@ -0,0 +1,24 @@
+//
+// System.Drawing.StringFormatFlags.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ [Flags]
+ public enum StringFormatFlags {
+ DirectionRightToLeft = 0x0001,
+ DirectionVertical = 0x0002,
+ FitBlackBox = 0x0004,
+ DisplayFormatControl = 0x0020,
+ NoFontFallback = 0x0400,
+ MeasureTrailingSpaces = 0x0800,
+ NoWrap = 0x1000,
+ LineLimit = 0x2000,
+ NoClip = 0x4000
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs b/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
new file mode 100644
index 00000000000..24274401ca6
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.StringTrimming.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringTrimming {
+ None = 0,
+ Character = 1,
+ Word = 2,
+ EllipsisCharacter = 3,
+ EllipsisWord = 4,
+ EllipsisPath = 5
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringUnit.cs b/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
new file mode 100644
index 00000000000..2d5f95c98c5
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.StringUnit.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringUnit{
+ World = 0x00,
+ Display = 0x01,
+ Pixel = 0x02,
+ Point = 0x03,
+ Inch = 0x04,
+ Document = 0x05,
+ Millimeter = 0x06,
+ Em = 0x20
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs b/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs
new file mode 100644
index 00000000000..41f40148776
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.SystemBrushes.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for SystemBrushes.
+ /// </summary>
+ public class SystemBrushes
+ {
+ public SystemBrushes()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SystemColors.cs b/mcs/class/System.Drawing/System.Drawing/SystemColors.cs
new file mode 100644
index 00000000000..5ffc54e9cf0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SystemColors.cs
@@ -0,0 +1,200 @@
+//
+// System.Drawing.SystemColors
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+// Generated using a slightly modified version of the program listed inside comments
+// in Color.cs
+//
+
+namespace System.Drawing {
+
+ public sealed class SystemColors
+ {
+ static public Color ActiveBorder
+ {
+ get {
+ return Color.FromArgbSystem (255, 131, 153, 177, "ActiveBorder");
+ }
+ }
+
+ static public Color ActiveCaption
+ {
+ get {
+ return Color.FromArgbSystem (255, 79, 101, 125, "ActiveCaption");
+ }
+ }
+
+ static public Color ActiveCaptionText
+ {
+ get {
+ return Color.FromArgbSystem (255, 255, 255, 255, "ActiveCaptionText");
+ }
+ }
+
+ static public Color AppWorkspace
+ {
+ get {
+ return Color.FromArgbSystem (255, 128, 128, 128, "AppWorkspace");
+ }
+ }
+
+ static public Color Control
+ {
+ get {
+ return Color.FromArgbSystem (255, 131, 153, 177, "Control");
+ }
+ }
+
+ static public Color ControlDark
+ {
+ get {
+ return Color.FromArgbSystem (255, 79, 101, 125, "ControlDark");
+ }
+ }
+
+ static public Color ControlDarkDark
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "ControlDarkDark");
+ }
+ }
+
+ static public Color ControlLight
+ {
+ get {
+ return Color.FromArgbSystem (255, 131, 153, 177, "ControlLight");
+ }
+ }
+
+ static public Color ControlLightLight
+ {
+ get {
+ return Color.FromArgbSystem (255, 193, 204, 217, "ControlLightLight");
+ }
+ }
+
+ static public Color ControlText
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "ControlText");
+ }
+ }
+
+ static public Color Desktop
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "Desktop");
+ }
+ }
+
+ static public Color GrayText
+ {
+ get {
+ return Color.FromArgbSystem (255, 79, 101, 125, "GrayText");
+ }
+ }
+
+ static public Color Highlight
+ {
+ get {
+ return Color.FromArgbSystem (255, 79, 101, 125, "Highlight");
+ }
+ }
+
+ static public Color HighlightText
+ {
+ get {
+ return Color.FromArgbSystem (255, 255, 255, 255, "HighlightText");
+ }
+ }
+
+ static public Color HotTrack
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 255, "HotTrack");
+ }
+ }
+
+ static public Color InactiveBorder
+ {
+ get {
+ return Color.FromArgbSystem (255, 131, 153, 177, "InactiveBorder");
+ }
+ }
+
+ static public Color InactiveCaption
+ {
+ get {
+ return Color.FromArgbSystem (255, 128, 128, 128, "InactiveCaption");
+ }
+ }
+
+ static public Color InactiveCaptionText
+ {
+ get {
+ return Color.FromArgbSystem (255, 193, 204, 217, "InactiveCaptionText");
+ }
+ }
+
+ static public Color Info
+ {
+ get {
+ return Color.FromArgbSystem (255, 255, 255, 255, "Info");
+ }
+ }
+
+ static public Color InfoText
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "InfoText");
+ }
+ }
+
+ static public Color Menu
+ {
+ get {
+ return Color.FromArgbSystem (255, 131, 153, 177, "Menu");
+ }
+ }
+
+ static public Color MenuText
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "MenuText");
+ }
+ }
+
+ static public Color ScrollBar
+ {
+ get {
+ return Color.FromArgbSystem (255, 193, 204, 217, "ScrollBar");
+ }
+ }
+
+ static public Color Window
+ {
+ get {
+ return Color.FromArgbSystem (255, 255, 255, 255, "Window");
+ }
+ }
+
+ static public Color WindowFrame
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "WindowFrame");
+ }
+ }
+
+ static public Color WindowText
+ {
+ get {
+ return Color.FromArgbSystem (255, 0, 0, 0, "WindowText");
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/System.Drawing/SystemIcons.cs b/mcs/class/System.Drawing/System.Drawing/SystemIcons.cs
new file mode 100644
index 00000000000..fe66c145500
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SystemIcons.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.SystemIcons.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for SystemIcons.
+ /// </summary>
+ public class SystemIcons
+ {
+ public SystemIcons()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SystemPens.cs b/mcs/class/System.Drawing/System.Drawing/SystemPens.cs
new file mode 100644
index 00000000000..68ac8cf358a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SystemPens.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.SystemPens.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for SystemPens.
+ /// </summary>
+ public class SystemPens
+ {
+ public SystemPens()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs b/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs
new file mode 100644
index 00000000000..c12cb29b4ef
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.TextureBrush.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for TextureBrush.
+ /// </summary>
+ public class TextureBrush
+ {
+ public TextureBrush()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs b/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs
new file mode 100644
index 00000000000..8894fe50726
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Drawing.ToolboxBitmapAttribute.cs
+//
+// Author:
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System;
+
+namespace System.Drawing
+{
+ /// <summary>
+ /// Summary description for ToolboxBitmapAttribute.
+ /// </summary>
+ public class ToolboxBitmapAttribute
+ {
+ public ToolboxBitmapAttribute()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/pens.cs b/mcs/class/System.Drawing/System.Drawing/pens.cs
new file mode 100644
index 00000000000..2857275c86a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/pens.cs
@@ -0,0 +1,865 @@
+//
+// System.Drawing.Pens.cs
+//
+// Author:
+// Matt Stump (mstump@swfo.arizona.edu)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing {
+ public sealed class Pens {
+ private Pens()
+ {
+ }
+
+ public static Pen AliceBlue{
+ get{
+ return new Pen ( Color.AliceBlue );
+ }
+ }
+
+ public static Pen AntiqueWhite{
+ get{
+ return new Pen ( Color.AntiqueWhite );
+ }
+ }
+
+ public static Pen Aqua{
+ get{
+ return new Pen ( Color.Aqua );
+ }
+ }
+
+ public static Pen Aquamarine{
+ get{
+ return new Pen ( Color.Aquamarine );
+ }
+ }
+
+ public static Pen Azure{
+ get{
+ return new Pen ( Color.Azure );
+ }
+ }
+
+ public static Pen Beige{
+ get{
+ return new Pen ( Color.Beige );
+ }
+ }
+
+ public static Pen Bisque{
+ get{
+ return new Pen ( Color.Bisque );
+ }
+ }
+
+ public static Pen Black{
+ get{
+ return new Pen ( Color.Black );
+ }
+ }
+
+ public static Pen BlanchedAlmond{
+ get{
+ return new Pen ( Color.BlanchedAlmond );
+ }
+ }
+
+ public static Pen Blue{
+ get{
+ return new Pen ( Color.Blue );
+ }
+ }
+
+ public static Pen BlueViolet{
+ get{
+ return new Pen ( Color.BlueViolet );
+ }
+ }
+
+ public static Pen Brown{
+ get{
+ return new Pen ( Color.Brown );
+ }
+ }
+
+ public static Pen BurlyWood{
+ get{
+ return new Pen ( Color.BurlyWood );
+ }
+ }
+
+ public static Pen CadetBlue{
+ get{
+ return new Pen ( Color.CadetBlue );
+ }
+ }
+
+ public static Pen Chartreuse{
+ get{
+ return new Pen ( Color.Chartreuse );
+ }
+ }
+
+ public static Pen Chocolate{
+ get{
+ return new Pen ( Color.Chocolate );
+ }
+ }
+
+ public static Pen Coral{
+ get{
+ return new Pen ( Color.Coral );
+ }
+ }
+
+ public static Pen CornflowerBlue{
+ get{
+ return new Pen ( Color.CornflowerBlue );
+ }
+ }
+
+ public static Pen Cornsilk{
+ get{
+ return new Pen ( Color.Cornsilk );
+ }
+ }
+
+ public static Pen Crimson{
+ get{
+ return new Pen ( Color.Crimson );
+ }
+ }
+
+ public static Pen Cyan{
+ get{
+ return new Pen ( Color.Cyan );
+ }
+ }
+
+ public static Pen DarkBlue{
+ get{
+ return new Pen ( Color.DarkBlue );
+ }
+ }
+
+ public static Pen DarkCyan{
+ get{
+ return new Pen ( Color.DarkCyan );
+ }
+ }
+
+ public static Pen DarkGoldenrod{
+ get{
+ return new Pen ( Color.DarkGoldenrod );
+ }
+ }
+
+ public static Pen DarkGray{
+ get{
+ return new Pen ( Color.DarkGray );
+ }
+ }
+
+ public static Pen DarkGreen{
+ get{
+ return new Pen ( Color.DarkGreen );
+ }
+ }
+
+ public static Pen DarkKhaki{
+ get{
+ return new Pen ( Color.DarkKhaki );
+ }
+ }
+
+ public static Pen DarkMagenta{
+ get{
+ return new Pen ( Color.DarkMagenta );
+ }
+ }
+
+ public static Pen DarkOliveGreen
+ {
+ get{
+ return new Pen ( Color.DarkOliveGreen );
+ }
+ }
+
+ public static Pen DarkOrange{
+ get{
+ return new Pen ( Color.DarkOrange );
+ }
+ }
+
+ public static Pen DarkOrchid{
+ get{
+ return new Pen ( Color.DarkOrchid );
+ }
+ }
+
+ public static Pen DarkRed{
+ get{
+ return new Pen ( Color.DarkRed );
+ }
+ }
+
+ public static Pen DarkSalmon{
+ get{
+ return new Pen ( Color.DarkSalmon );
+ }
+ }
+
+ public static Pen DarkSeaGreen{
+ get{
+ return new Pen ( Color.DarkSeaGreen );
+ }
+ }
+
+ public static Pen DarkSlateBlue{
+ get{
+ return new Pen ( Color.DarkSlateBlue );
+ }
+ }
+
+ public static Pen DarkSlateGray{
+ get{
+ return new Pen ( Color.DarkSlateGray );
+ }
+ }
+
+ public static Pen DarkTurquoise{
+ get{
+ return new Pen ( Color.DarkTurquoise );
+ }
+ }
+
+ public static Pen DarkViolet{
+ get{
+ return new Pen ( Color.DarkViolet );
+ }
+ }
+
+ public static Pen DeepPink{
+ get{
+ return new Pen ( Color.DeepPink );
+ }
+ }
+
+ public static Pen DeepSkyBlue{
+ get{
+ return new Pen ( Color.DeepSkyBlue );
+ }
+ }
+
+ public static Pen DimGray{
+ get{
+ return new Pen ( Color.DimGray );
+ }
+ }
+
+ public static Pen DodgerBlue{
+ get{
+ return new Pen ( Color.DodgerBlue );
+ }
+ }
+
+ public static Pen Firebrick{
+ get{
+ return new Pen ( Color.Firebrick );
+ }
+ }
+
+ public static Pen FloralWhite{
+ get{
+ return new Pen ( Color.FloralWhite );
+ }
+ }
+
+ public static Pen ForestGreen{
+ get{
+ return new Pen ( Color.ForestGreen );
+ }
+ }
+
+ public static Pen Fuchsia{
+ get{
+ return new Pen ( Color.Fuchsia );
+ }
+ }
+
+ public static Pen Gainsboro {
+ get{
+ return new Pen ( Color.Gainsboro );
+ }
+ }
+
+ public static Pen GhostWhite{
+ get{
+ return new Pen ( Color.GhostWhite );
+ }
+ }
+
+ public static Pen Gold{
+ get{
+ return new Pen ( Color.Gold );
+ }
+ }
+
+ public static Pen Goldenrod{
+ get{
+ return new Pen ( Color.Goldenrod );
+ }
+ }
+
+ public static Pen Gray{
+ get{
+ return new Pen ( Color.Gray );
+ }
+ }
+
+ public static Pen Green{
+ get{
+ return new Pen ( Color.Green );
+ }
+ }
+
+ public static Pen GreenYellow{
+ get{
+ return new Pen ( Color.GreenYellow );
+ }
+ }
+
+ public static Pen Honeydew{
+ get{
+ return new Pen ( Color.Honeydew );
+ }
+ }
+
+ public static Pen HotPink{
+ get{
+ return new Pen ( Color.HotPink );
+ }
+ }
+
+ public static Pen IndianRed{
+ get{
+ return new Pen ( Color.IndianRed );
+ }
+ }
+
+ public static Pen Indigo{
+ get{
+ return new Pen ( Color.Indigo );
+ }
+ }
+
+ public static Pen Ivory{
+ get{
+ return new Pen ( Color.Ivory );
+ }
+ }
+
+ public static Pen Khaki{
+ get{
+ return new Pen ( Color.Khaki );
+ }
+ }
+
+ public static Pen Lavender{
+ get{
+ return new Pen ( Color.Lavender );
+ }
+ }
+
+ public static Pen LavenderBlush{
+ get{
+ return new Pen ( Color.LavenderBlush );
+ }
+ }
+
+ public static Pen LawnGreen{
+ get{
+ return new Pen ( Color.LawnGreen );
+ }
+ }
+
+ public static Pen LemonChiffon{
+ get{
+ return new Pen ( Color.LemonChiffon );
+ }
+ }
+
+ public static Pen LightBlue{
+ get{
+ return new Pen ( Color.LightBlue );
+ }
+ }
+
+ public static Pen LightCoral{
+ get{
+ return new Pen ( Color.LightCoral );
+ }
+ }
+
+ public static Pen LightCyan{
+ get{
+ return new Pen ( Color.LightCyan );
+ }
+ }
+
+ public static Pen LightGoldenrodYellow{
+ get{
+ return new Pen ( Color.LightGoldenrodYellow );
+ }
+ }
+
+ public static Pen LightGray{
+ get{
+ return new Pen ( Color.LightGray );
+ }
+ }
+
+ public static Pen LightGreen{
+ get{
+ return new Pen ( Color.LightGreen );
+ }
+ }
+
+ public static Pen LightPink{
+ get{
+ return new Pen ( Color.LightPink );
+ }
+ }
+
+ public static Pen LightSalmon{
+ get{
+ return new Pen ( Color.LightSalmon );
+ }
+ }
+
+ public static Pen LightSeaGreen{
+ get{
+ return new Pen ( Color.LightSeaGreen );
+ }
+ }
+
+ public static Pen LightSkyBlue{
+ get{
+ return new Pen ( Color.LightSkyBlue );
+ }
+ }
+
+ public static Pen LightSlateGray{
+ get{
+ return new Pen ( Color.LightSlateGray );
+ }
+ }
+
+ public static Pen LightSteelBlue{
+ get{
+ return new Pen ( Color.LightSteelBlue );
+ }
+ }
+
+ public static Pen LightYellow{
+ get{
+ return new Pen ( Color.LightYellow );
+ }
+ }
+
+ public static Pen Lime{
+ get{
+ return new Pen ( Color.Lime );
+ }
+ }
+
+ public static Pen LimeGreen{
+ get{
+ return new Pen ( Color.LimeGreen );
+ }
+ }
+
+ public static Pen Linen{
+ get{
+ return new Pen ( Color.Linen );
+ }
+ }
+
+ public static Pen Magenta{
+ get{
+ return new Pen ( Color.Magenta );
+ }
+ }
+
+ public static Pen Maroon{
+ get{
+ return new Pen ( Color.Maroon );
+ }
+ }
+
+ public static Pen MediumAquamarine{
+ get{
+ return new Pen ( Color.MediumAquamarine );
+ }
+ }
+
+ public static Pen MediumBlue{
+ get{
+ return new Pen ( Color.MediumBlue );
+ }
+ }
+
+ public static Pen MediumOrchid{
+ get{
+ return new Pen ( Color.MediumOrchid );
+ }
+ }
+
+ public static Pen MediumPurple{
+ get{
+ return new Pen ( Color.MediumPurple );
+ }
+ }
+
+ public static Pen MediumSeaGreen{
+ get{
+ return new Pen ( Color.MediumSeaGreen );
+ }
+ }
+
+ public static Pen MediumSlateBlue{
+ get{
+ return new Pen ( Color.MediumSlateBlue );
+ }
+ }
+
+ public static Pen MediumSpringGreen{
+ get{
+ return new Pen ( Color.MediumSpringGreen );
+ }
+ }
+
+ public static Pen MediumTurquoise{
+ get{
+ return new Pen ( Color.MediumTurquoise );
+ }
+ }
+
+ public static Pen MediumVioletRed{
+ get{
+ return new Pen ( Color.MediumVioletRed );
+ }
+ }
+
+ public static Pen MidnightBlue{
+ get{
+ return new Pen ( Color.MidnightBlue );
+ }
+ }
+
+ public static Pen MintCream{
+ get{
+ return new Pen ( Color.MintCream );
+ }
+ }
+
+ public static Pen MistyRose{
+ get{
+ return new Pen ( Color.MistyRose );
+ }
+ }
+
+ public static Pen Moccasin{
+ get{
+ return new Pen ( Color.Moccasin );
+ }
+ }
+
+ public static Pen NavajoWhite{
+ get{
+ return new Pen ( Color.NavajoWhite );
+ }
+ }
+
+ public static Pen Navy{
+ get{
+ return new Pen ( Color.Navy );
+ }
+ }
+
+ public static Pen OldLace{
+ get{
+ return new Pen ( Color.OldLace );
+ }
+ }
+
+ public static Pen Olive{
+ get{
+ return new Pen ( Color.Olive );
+ }
+ }
+
+ public static Pen OliveDrab{
+ get{
+ return new Pen ( Color.OliveDrab );
+ }
+ }
+
+ public static Pen Orange{
+ get{
+ return new Pen ( Color.Orange );
+ }
+ }
+
+ public static Pen OrangeRed{
+ get{
+ return new Pen ( Color.OrangeRed );
+ }
+ }
+
+ public static Pen Orchid{
+ get{
+ return new Pen ( Color.Orchid );
+ }
+ }
+
+ public static Pen PaleGoldenrod{
+ get{
+ return new Pen ( Color.PaleGoldenrod );
+ }
+ }
+
+ public static Pen PaleGreen{
+ get{
+ return new Pen ( Color.PaleGreen );
+ }
+ }
+
+ public static Pen PaleTurquoise{
+ get{
+ return new Pen ( Color.PaleTurquoise );
+ }
+ }
+
+ public static Pen PaleVioletRed{
+ get{
+ return new Pen ( Color.PaleVioletRed );
+ }
+ }
+
+ public static Pen PapayaWhip{
+ get{
+ return new Pen ( Color.PapayaWhip );
+ }
+ }
+
+ public static Pen PeachPuff{
+ get{
+ return new Pen ( Color.PeachPuff );
+ }
+ }
+
+ public static Pen Peru{
+ get{
+ return new Pen ( Color.Peru );
+ }
+ }
+
+ public static Pen Pink{
+ get{
+ return new Pen ( Color.Pink );
+ }
+ }
+
+ public static Pen Plum{
+ get{
+ return new Pen ( Color.Plum );
+ }
+ }
+
+ public static Pen PowderBlue{
+ get{
+ return new Pen ( Color.PowderBlue );
+ }
+ }
+
+ public static Pen Purple{
+ get{
+ return new Pen ( Color.Purple );
+ }
+ }
+
+ public static Pen Red{
+ get{
+ return new Pen ( Color.Red );
+ }
+ }
+
+ public static Pen RosyBrown{
+ get{
+ return new Pen ( Color.RosyBrown );
+ }
+ }
+
+ public static Pen RoyalBlue{
+ get{
+ return new Pen ( Color.RoyalBlue );
+ }
+ }
+
+ public static Pen SaddleBrown{
+ get{
+ return new Pen ( Color.SaddleBrown );
+ }
+ }
+
+ public static Pen Salmon{
+ get{
+ return new Pen ( Color.Salmon );
+ }
+ }
+
+ public static Pen SandyBrown{
+ get{
+ return new Pen ( Color.SandyBrown );
+ }
+ }
+
+ public static Pen SeaGreen{
+ get{
+ return new Pen ( Color.SeaGreen );
+ }
+ }
+
+ public static Pen SeaShell{
+ get{
+ return new Pen ( Color.SeaShell );
+ }
+ }
+
+ public static Pen Sienna{
+ get{
+ return new Pen ( Color.Sienna );
+ }
+ }
+
+ public static Pen Silver{
+ get{
+ return new Pen ( Color.Silver );
+ }
+ }
+
+ public static Pen SkyBlue{
+ get{
+ return new Pen ( Color.SkyBlue );
+ }
+ }
+
+ public static Pen SlateBlue{
+ get{
+ return new Pen ( Color.SlateBlue );
+ }
+ }
+
+ public static Pen SlateGray{
+ get{
+ return new Pen ( Color.SlateGray );
+ }
+ }
+ public static Pen Snow{
+ get{
+ return new Pen ( Color.Snow );
+ }
+ }
+
+ public static Pen SpringGreen{
+ get{
+ return new Pen ( Color.SpringGreen );
+ }
+ }
+
+ public static Pen SteelBlue{
+ get{
+ return new Pen ( Color.SteelBlue );
+ }
+ }
+
+ public static Pen Tan{
+ get{
+ return new Pen ( Color.Tan );
+ }
+ }
+
+ public static Pen Teal{
+ get{
+ return new Pen ( Color.Teal );
+ }
+ }
+
+ public static Pen Thistle{
+ get{
+ return new Pen ( Color.Thistle );
+ }
+ }
+
+ public static Pen Tomato{
+ get{
+ return new Pen ( Color.Tomato );
+ }
+ }
+
+ public static Pen Transparent{
+ get{
+ return new Pen ( Color.Transparent );
+ }
+ }
+
+ public static Pen Turquoise{
+ get{
+ return new Pen ( Color.Turquoise );
+ }
+ }
+
+ public static Pen Violet{
+ get{
+ return new Pen ( Color.Violet );
+ }
+ }
+
+ public static Pen Wheat{
+ get{
+ return new Pen ( Color.Wheat );
+ }
+ }
+
+ public static Pen White{
+ get{
+ return new Pen ( Color.White );
+ }
+ }
+
+ public static Pen WhiteSmoke{
+ get{
+ return new Pen ( Color.WhiteSmoke );
+ }
+ }
+
+ public static Pen Yellow{
+ get{
+ return new Pen ( Color.Yellow );
+ }
+ }
+
+ public static Pen YellowGreen{
+ get{
+ return new Pen ( Color.YellowGreen );
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
new file mode 100644
index 00000000000..62c04eb1808
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
@@ -0,0 +1,4 @@
+2001-10-31 Mike Kestner <mkestner@speakeasy.net>
+
+ * TestPoint.cs : Tests I've had in my node forever.
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
new file mode 100644
index 00000000000..01de794dc02
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
@@ -0,0 +1,159 @@
+// Tests for System.Drawing.Point.cs
+//
+// Author: Mike Kestner (mkestner@speakeasy.net)
+//
+// Copyright (c) 2001 Ximian, Inc.
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+
+public class PointTest : TestCase {
+ Point pt1_1;
+ Point pt1_0;
+ Point pt0_1;
+
+ protected override void SetUp ()
+ {
+ pt1_1 = new Point (1, 1);
+ pt1_0 = new Point (1, 0);
+ pt0_1 = new Point (0, 1);
+ }
+
+ public PointTest(String name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new PointTest ("EqualsTest"));
+ suite.AddTest (new PointTest ("EqualityOpTest"));
+ suite.AddTest (new PointTest ("InequalityOpTest"));
+ suite.AddTest (new PointTest ("CeilingTest"));
+ suite.AddTest (new PointTest ("RoundTest"));
+ suite.AddTest (new PointTest ("TruncateTest"));
+ suite.AddTest (new PointTest ("NullTest"));
+ suite.AddTest (new PointTest ("AdditionTest"));
+ suite.AddTest (new PointTest ("SubtractionTest"));
+ suite.AddTest (new PointTest ("Point2SizeTest"));
+ suite.AddTest (new PointTest ("Point2PointFTest"));
+ suite.AddTest (new PointTest ("ConstructorTest"));
+ suite.AddTest (new PointTest ("PropertyTest"));
+ suite.AddTest (new PointTest ("OffsetTest"));
+ return suite;
+ }
+ }
+
+ public void EqualsTest ()
+ {
+ AssertEquals (pt1_1, pt1_1);
+ AssertEquals (pt1_1, new Point (1, 1));
+ Assert (!pt1_1.Equals (pt1_0));
+ Assert (!pt1_1.Equals (pt0_1));
+ Assert (!pt1_0.Equals (pt0_1));
+ }
+
+ public void EqualityOpTest ()
+ {
+ Assert (pt1_1 == pt1_1);
+ Assert (pt1_1 == new Point (1, 1));
+ Assert (!(pt1_1 == pt1_0));
+ Assert (!(pt1_1 == pt0_1));
+ Assert (!(pt1_0 == pt0_1));
+ }
+
+ public void InequalityOpTest ()
+ {
+ Assert (!(pt1_1 != pt1_1));
+ Assert (!(pt1_1 != new Point (1, 1)));
+ Assert (pt1_1 != pt1_0);
+ Assert (pt1_1 != pt0_1);
+ Assert (pt1_0 != pt0_1);
+ }
+
+ public void CeilingTest ()
+ {
+ PointF ptf = new PointF (0.8f, 0.3f);
+ AssertEquals (pt1_1, Point.Ceiling (ptf));
+ }
+
+ public void RoundTest ()
+ {
+ PointF ptf = new PointF (0.8f, 1.3f);
+ AssertEquals (pt1_1, Point.Round (ptf));
+ }
+
+ public void TruncateTest ()
+ {
+ PointF ptf = new PointF (0.8f, 1.3f);
+ AssertEquals (pt0_1, Point.Truncate (ptf));
+ }
+
+ public void NullTest ()
+ {
+ Point pt = new Point (0, 0);
+ AssertEquals (pt, Point.Empty);
+ }
+
+ public void AdditionTest ()
+ {
+ AssertEquals (pt1_1, pt1_0 + new Size (0, 1));
+ AssertEquals (pt1_1, pt0_1 + new Size (1, 0));
+ }
+
+ public void SubtractionTest ()
+ {
+ AssertEquals (pt1_0, pt1_1 - new Size (0, 1));
+ AssertEquals (pt0_1, pt1_1 - new Size (1, 0));
+ }
+
+ public void Point2SizeTest ()
+ {
+ Size sz1 = new Size (1, 1);
+ Size sz2 = (Size) pt1_1;
+
+ AssertEquals (sz1, sz2);
+ }
+
+ public void Point2PointFTest ()
+ {
+ PointF ptf1 = new PointF (1, 1);
+ PointF ptf2 = pt1_1;
+
+ AssertEquals (ptf1, ptf2);
+ }
+
+ public void ConstructorTest ()
+ {
+ int i = (1 << 16) + 1;
+ Size sz = new Size (1, 1);
+ Point pt_i = new Point (i);
+ Point pt_sz = new Point (sz);
+
+ AssertEquals (pt_i, pt_sz);
+ AssertEquals (pt_i, pt1_1);
+ AssertEquals (pt_sz, pt1_1);
+ }
+
+ public void PropertyTest ()
+ {
+ Point pt = new Point (0, 0);
+
+ Assert (pt.IsEmpty);
+ Assert (!pt1_1.IsEmpty);
+ AssertEquals (1, pt1_0.X);
+ AssertEquals (1, pt0_1.Y);
+ }
+
+ public void OffsetTest ()
+ {
+ Point pt = new Point (0, 0);
+ pt.Offset (0, 1);
+ AssertEquals (pt, pt0_1);
+ pt.Offset (1, 0);
+ AssertEquals (pt, pt1_1);
+ pt.Offset (0, -1);
+ AssertEquals (pt, pt1_0);
+ }
+}
+
+
diff --git a/mcs/class/System.Drawing/list.unix b/mcs/class/System.Drawing/list.unix
new file mode 100755
index 00000000000..f42bd998510
--- /dev/null
+++ b/mcs/class/System.Drawing/list.unix
@@ -0,0 +1,160 @@
+-o System.Drawing.dll --target library
+System.Drawing/Bitmap.cs
+System.Drawing/Brush.cs
+System.Drawing/Brushes.cs
+System.Drawing/CharacterRange.cs
+System.Drawing/ColorConverter.cs
+System.Drawing/Color.cs
+System.Drawing/ColorTranslator.cs
+System.Drawing/ContentAlignment.cs
+System.Drawing.Design/UITypeEditorEditStyle.cs
+System.Drawing.Design/IPropertyValueUIService.cs
+System.Drawing.Design/PropertyValueItem.cs
+System.Drawing.Design/PropertyValueUIHandler.cs
+System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs
+System.Drawing.Design/CategoryNameCollection.cs
+System.Drawing.Design/IDesignerHost.cs
+System.Drawing.Design/IToolboxService.cs
+System.Drawing.Design/IToolboxUser.cs
+System.Drawing.Design/PaintValueEventArgs.cs
+System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
+System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs
+System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
+System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs
+System.Drawing.Design/ToolboxItemCreatorCallback.cs
+System.Drawing.Design/ToolboxItem.cs
+System.Drawing.Drawing2D/AdjustableArrowCap.cs
+System.Drawing.Drawing2D/Blend.cs
+System.Drawing.Drawing2D/ColorBlend.cs
+System.Drawing.Drawing2D/CombineMode.cs
+System.Drawing.Drawing2D/CompostingMode.cs
+System.Drawing.Drawing2D/CompostingQuality.cs
+System.Drawing.Drawing2D/CoordinateSpace.cs
+System.Drawing.Drawing2D/CustomLineCap.cs
+System.Drawing.Drawing2D/DashCap.cs
+System.Drawing.Drawing2D/DashStyle.cs
+System.Drawing.Drawing2D/FillMode.cs
+System.Drawing.Drawing2D/FlushIntention.cs
+System.Drawing.Drawing2D/GraphicsContainer.cs
+System.Drawing.Drawing2D/GraphicsPath.cs
+System.Drawing.Drawing2D/GraphicsPathIterator.cs
+System.Drawing.Drawing2D/GraphicsState.cs
+System.Drawing.Drawing2D/HatchBrush.cs
+System.Drawing.Drawing2D/HatchStyle.cs
+System.Drawing.Drawing2D/InterpolationMode.cs
+System.Drawing.Drawing2D/LinearGradientBrush.cs
+System.Drawing.Drawing2D/LinearGradientMode.cs
+System.Drawing.Drawing2D/LineCap.cs
+System.Drawing.Drawing2D/LineJoin.cs
+System.Drawing.Drawing2D/Matrix.cs
+System.Drawing.Drawing2D/MatrixOrder.cs
+System.Drawing.Drawing2D/PathData.cs
+System.Drawing.Drawing2D/PathGradientBrush.cs
+System.Drawing.Drawing2D/PathPointType.cs
+System.Drawing.Drawing2D/PenAlignment.cs
+System.Drawing.Drawing2D/PenType.cs
+System.Drawing.Drawing2D/PixelOffsetMode.cs
+System.Drawing.Drawing2D/QualityMode.cs
+System.Drawing.Drawing2D/RegionData.cs
+System.Drawing.Drawing2D/SmoothingMode.cs
+System.Drawing.Drawing2D/TODOAttribute.cs
+System.Drawing.Drawing2D/WarpMode.cs
+System.Drawing.Drawing2D/WrapMode.cs
+System.Drawing/FontConverter.cs
+System.Drawing/FontFamily.cs
+System.Drawing/FontStyle.cs
+System.Drawing/Graphics.cs
+System.Drawing/GraphicsUnit.cs
+System.Drawing/IconConverter.cs
+System.Drawing/Icon.cs
+System.Drawing/ImageAnimator.cs
+System.Drawing/ImageConverter.cs
+System.Drawing/Image.cs
+System.Drawing/ImageFormatConverter.cs
+System.Drawing.Imaging/BitmapData.cs
+System.Drawing.Imaging/ColorAdjustType.cs
+System.Drawing.Imaging/ColorChannelFlag.cs
+System.Drawing.Imaging/ColorMap.cs
+System.Drawing.Imaging/ColorMapType.cs
+System.Drawing.Imaging/ColorMatrix.cs
+System.Drawing.Imaging/ColorMatrixFlag.cs
+System.Drawing.Imaging/ColorMode.cs
+System.Drawing.Imaging/ColorPalette.cs
+System.Drawing.Imaging/EmfPlusRecordType.cs
+System.Drawing.Imaging/EmfType.cs
+System.Drawing.Imaging/EncoderParameterValueType.cs
+System.Drawing.Imaging/EncoderValue.cs
+System.Drawing.Imaging/FrameDimension.cs
+System.Drawing.Imaging/ImageCodecFlags.cs
+System.Drawing.Imaging/ImageCodecInfo.cs
+System.Drawing.Imaging/ImageFlags.cs
+System.Drawing.Imaging/ImageFormat.cs
+System.Drawing.Imaging/ImageLockMode.cs
+System.Drawing.Imaging/Metafile.cs
+System.Drawing.Imaging/MetafileFrameUnit.cs
+System.Drawing.Imaging/MetafileType.cs
+System.Drawing.Imaging/MetaHeader.cs
+System.Drawing.Imaging/PaletteFlags.cs
+System.Drawing.Imaging/PixelFormat.cs
+System.Drawing.Imaging/PlayRecordCallback.cs
+System.Drawing.Imaging/PropertyItem.cs
+System.Drawing.Imaging/WmfPlaceableFileHeader.cs
+System.Drawing/KnownColor.cs
+System.Drawing/Pen.cs
+System.Drawing/PointConverter.cs
+System.Drawing/Point.cs
+System.Drawing/PointF.cs
+System.Drawing.Printing/Duplex.cs
+System.Drawing.Printing/InvalidPrinterExecption.cs
+System.Drawing.Printing/MarginsConverter.cs
+System.Drawing.Printing/Margins.cs
+System.Drawing.Printing/PageSettings.cs
+System.Drawing.Printing/PaperKind.cs
+System.Drawing.Printing/PaperSize.cs
+System.Drawing.Printing/PaperSourceCollection.cs
+System.Drawing.Printing/PaperSource.cs
+System.Drawing.Printing/PaperSourceKind.cs
+System.Drawing.Printing/PaperUnitConvert.cs
+System.Drawing.Printing/PreviewPageInfo.cs
+System.Drawing.Printing/PreviewPrintController.cs
+System.Drawing.Printing/PrintController.cs
+System.Drawing.Printing/PrintDocument.cs
+System.Drawing.Printing/PrinterResolution.cs
+System.Drawing.Printing/PrinterResolutionKind.cs
+System.Drawing.Printing/PrinterSettings.cs
+System.Drawing.Printing/PrinterUnit.cs
+System.Drawing.Printing/PrintEventArgs.cs
+System.Drawing.Printing/PrintEventHandler.cs
+System.Drawing.Printing/PrintingPermissionAttribute.cs
+System.Drawing.Printing/PrintingPermission.cs
+System.Drawing.Printing/PrintingPermissionLevel.cs
+System.Drawing.Printing/PrintPageEventArgs.cs
+System.Drawing.Printing/PrintPageEventHandler.cs
+System.Drawing.Printing/PrintRange.cs
+System.Drawing.Printing/QueryPageSettingsEventArgs.cs
+System.Drawing.Printing/QueryPageSettingsEventHandler.cs
+System.Drawing.Printing/StandardPrintController.cs
+System.Drawing/RectangleConverter.cs
+System.Drawing/Rectangle.cs
+System.Drawing/RectangleF.cs
+System.Drawing/Region.cs
+System.Drawing/RotateFlipType.cs
+System.Drawing/SizeConverter.cs
+System.Drawing/Size.cs
+System.Drawing/SizeF.cs
+System.Drawing/SolidBrush.cs
+System.Drawing/StringAligment.cs
+System.Drawing/StringDigitSubstitute.cs
+System.Drawing/StringFormat.cs
+System.Drawing/StringFormatFlags.cs
+System.Drawing/StringTrimming.cs
+System.Drawing/StringUnit.cs
+System.Drawing/SystemBrushes.cs
+System.Drawing/SystemColors.cs
+System.Drawing/SystemIcons.cs
+System.Drawing/SystemPens.cs
+System.Drawing.Text/GenericFontFamilies.cs
+System.Drawing.Text/HotkeyPrefix.cs
+System.Drawing.Text/TextRenderingHint.cs
+System.Drawing/TextureBrush.cs
+System.Drawing/ToolboxBitmapAttribute.cs
diff --git a/mcs/class/System.Drawing/makefile.gnu b/mcs/class/System.Drawing/makefile.gnu
new file mode 100644
index 00000000000..cda4f830189
--- /dev/null
+++ b/mcs/class/System.Drawing/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.Drawing.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.EnterpriseServices/.cvsignore b/mcs/class/System.EnterpriseServices/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.EnterpriseServices/ChangeLog b/mcs/class/System.EnterpriseServices/ChangeLog
new file mode 100644
index 00000000000..53a6b70cbb9
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/ChangeLog
@@ -0,0 +1,28 @@
+2002-11-20 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+ * list: new files added to build
+
+2002-08-13 Tim Coleman <tim@timcoleman.com>
+ * list: new files added to build
+
+2002-08-08 Tim Coleman <tim@timcoleman.com>
+ * list: new files added to build.
+
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * list: new files added to build.
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * list: new files added to build.
+ * System.EnterpriseServices.CompensatingResourceManager:
+ New directory added
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * list: new files added to build list.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * makefile.gnu: added to build on linux
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * System.EnterpriseServices: New namespace created
+ to provide enum needed by Web Services
+ * System.EnterpriseServices.build: New file
+ * list: New file
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ApplicationCrmEnabledAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ApplicationCrmEnabledAttribute.cs
new file mode 100644
index 00000000000..5b572a3a3ad
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ApplicationCrmEnabledAttribute.cs
@@ -0,0 +1,39 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.ApplicationCrmEnabledAttribute.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+
+ /// <summary>
+ /// ApplicationCrmEnable Attribute for classes.
+ /// </summary>
+
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public sealed class ApplicationCrmEnabledAttribute : Attribute
+ {
+ public bool val;
+
+ public ApplicationCrmEnabledAttribute()
+ {
+ val = true;
+ }
+
+ public ApplicationCrmEnabledAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ public bool Value
+ {
+ get
+ {
+ return val;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ChangeLog b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ChangeLog
new file mode 100644
index 00000000000..28d12c6b9a9
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/ChangeLog
@@ -0,0 +1,23 @@
+2002-11-20 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * ApplicationCrmEnabledAttribute.cs added.
+
+2002-08-13 Tim Coleman <tim@timcoleman.com>
+ * Clerk.cs:
+ * Compensator.cs:
+ New stubs added.
+
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * CompensatorOptions.cs:
+ * LogRecordFlags.cs:
+ * TransactionState.cs:
+ Changed enum values to agree with .NET
+ * LogRecord.cs:
+ New stubs added
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog.cs:
+ * CompensatorOptions.cs:
+ * LogRecordFlags.cs:
+ * TransactionState.cs:
+ New stubs added
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Clerk.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Clerk.cs
new file mode 100644
index 00000000000..291ecdd0271
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Clerk.cs
@@ -0,0 +1,84 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.Clerk.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.EnterpriseServices;
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+ public sealed class Clerk {
+
+ #region Constructors
+
+ //internal Clerk (CrmLogControl logControl)
+ //{
+ //}
+
+ [MonoTODO]
+ public Clerk (string compensator, string description, CompensatorOptions flags)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Clerk (Type compensator, string description, CompensatorOptions flags)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int LogRecordCount {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string TransactionUOW {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ ~Clerk ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ForceLog ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ForceTransactionToAbort ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ForgetLogRecord ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void WriteLogRecord (object record)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Compensator.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Compensator.cs
new file mode 100644
index 00000000000..0d2a7028b51
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/Compensator.cs
@@ -0,0 +1,93 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.Compensator.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.EnterpriseServices;
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+ public class Compensator : ServicedComponent{
+
+ #region Constructors
+
+ [MonoTODO]
+ public Compensator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Clerk Clerk {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public virtual bool AbortRecord (LogRecord rec)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void BeginAbort (bool fRecovery)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void BeginCommit (bool fRecovery)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void BeginPrepare ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void CommitRecord (LogRecord rec)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void EndAbort ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void EndCommit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool EndPrepare ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool PrepareRecord (LogRecord rec)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/CompensatorOptions.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/CompensatorOptions.cs
new file mode 100644
index 00000000000..8a2466a8c8a
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/CompensatorOptions.cs
@@ -0,0 +1,22 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.CompensatorOptions.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+ [Flags]
+ [Serializable]
+ public enum CompensatorOptions {
+ PreparePhase = 0x1,
+ CommitPhase = 0x2,
+ AbortPhase = 0x4,
+ AllPhases = 0x7,
+ FailIfInDoubtsRemain = 0x10
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecord.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecord.cs
new file mode 100644
index 00000000000..3344f4ecf72
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecord.cs
@@ -0,0 +1,69 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.LogRecord.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.EnterpriseServices;
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+
+ public sealed class LogRecord {
+
+ #region Fields
+
+ LogRecordFlags flags;
+ object record;
+ int sequence;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ internal LogRecord ()
+ {
+ }
+
+ [MonoTODO]
+ internal LogRecord (_LogRecord logRecord)
+ {
+ flags = (LogRecordFlags) logRecord.dwCrmFlags;
+ sequence = logRecord.dwSequenceNumber;
+ record = logRecord.blobUserData;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public LogRecordFlags Flags {
+ get { return flags; }
+ }
+
+ public object Record {
+ get { return record; }
+ }
+
+ public int Sequence {
+ get { return sequence; }
+ }
+
+ #endregion // Properties
+ }
+
+ internal struct _LogRecord {
+
+ #region Fields
+
+ public int dwCrmFlags;
+ public int dwSequenceNumber;
+ public object blobUserData; // FIXME: This is not the correct type
+
+ #endregion // Fields
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecordFlags.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecordFlags.cs
new file mode 100644
index 00000000000..57b519e1dfa
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/LogRecordFlags.cs
@@ -0,0 +1,24 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.LogRecordFlags.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+ [Flags]
+ [Serializable]
+ public enum LogRecordFlags {
+ ForgetTarget = 0x1,
+ WrittenDuringPrepare = 0x2,
+ WrittenDuringCommit = 0x4,
+ WrittenDuringAbort = 0x8,
+ WrittenDurringRecovery = 0x10, // Typo present in .NET
+ WrittenDuringReplay = 0x20,
+ ReplayInProgress = 0x40
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/TransactionState.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/TransactionState.cs
new file mode 100644
index 00000000000..192bab59737
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.CompensatingResourceManager/TransactionState.cs
@@ -0,0 +1,20 @@
+//
+// System.EnterpriseServices.CompensatingResourceManager.TransactionState.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices.CompensatingResourceManager {
+ [Serializable]
+ public enum TransactionState {
+ Active = 0x0,
+ Committed = 0x1,
+ Aborted = 0x2,
+ Indoubt = 0x3
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/Changelog b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/Changelog
new file mode 100644
index 00000000000..6ad46b85d23
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/Changelog
@@ -0,0 +1,5 @@
+2002-11-20: Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * IClrObjectFactory.cs added.
+ * IComManagedImportUtil.cs added.
+ * IComSoapPublisher.cs added.
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IClrObjectFactory.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IClrObjectFactory.cs
new file mode 100644
index 00000000000..f082cdec8c0
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IClrObjectFactory.cs
@@ -0,0 +1,24 @@
+// System.EnterpriseServices.Internal.IClrObjectFactory.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices.Internal
+{
+ //[Guid("")]
+ public interface IClrObjectFactory
+ {
+ object CreateFromAssembly(string assembly, string type, string mode);
+
+ object CreateFromMailbox(string Mailbox, string Mode);
+
+ object CreateFromVroot(string VrootUrl, string Mode);
+
+ object CreateFromWsdl(string WsdlUrl, string Mode);
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComManagedImportUtil.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComManagedImportUtil.cs
new file mode 100644
index 00000000000..028ef2766b5
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComManagedImportUtil.cs
@@ -0,0 +1,21 @@
+// System.EnterpriseServices.Internal.IComManagedImportUtil.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+using System;
+
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices.Internal
+{
+ //[Guid("")]
+ public interface IComManagedImportUtil
+ {
+ void GetComponentInfo (string assemblyPath, out string numComponents, out string componentInfo);
+
+ void InstallAssembly (string filename, string parname, string appname);
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComSoapPublisher.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComSoapPublisher.cs
new file mode 100644
index 00000000000..65795815996
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.Internal/IComSoapPublisher.cs
@@ -0,0 +1,46 @@
+// System.EnterpriseServices.Internal.IComSoapPublisher.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+using System;
+
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices.Internal
+{
+ //[Guid("")]
+ public interface IComSoapPublisher
+ {
+ void CreateMailBox (string RootMailServer, string MailBox, out string SmtpName, out string Domain,
+ out string PhysicalPath, out string Error);
+
+ void CreateVirtualRoot (string Operation, string FullUrl, out string BaseUrl, out string VirtualRoot,
+ out string PhysicalPath, out string Error);
+
+ void DeleteMailBox (string RootMailServer, string MailBox, out string Error);
+
+ void DeleteVirtualRoot (string RootWebServer, string FullUrl, out string Error);
+
+ void GacInstall (string AssemblyPath);
+
+ void GacRemove (string AssemblyPath);
+
+ void GetAssemblyNameForCache (string TypeLibPath, out string CachePath);
+
+ string GetTypeNameFromProgId (string AssemblyPath, string ProgId);
+
+ void ProcessClientTlb (string ProgId, string SrcTlbPath, string PhysicalPath, string VRoot, string BaseUrl,
+ string Mode, string Transport, out string AssemblyName, out string TypeName,
+ out string Error);
+
+ void ProcessServerTlb (string ProgId, string SrcTlbPath, string PhysicalPath, string Operation,
+ out string AssemblyName, out string TypeName, out string Error);
+
+ void RegisterAssembly (string AssemblyPath);
+
+ void UnRegisterAssembly(string AssemblyPath);
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.build b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.build
new file mode 100644
index 00000000000..5df7cc6aaa6
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.build
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.EnterpriseServices.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.EnterpriseServices.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/debug"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.EnterpriseServices.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AccessChecksLevelOption.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AccessChecksLevelOption.cs
new file mode 100644
index 00000000000..453db008630
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AccessChecksLevelOption.cs
@@ -0,0 +1,16 @@
+//
+// System.EnterpriseServices.AccessChecksLevelOption.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum AccessChecksLevelOption {
+ Application,
+ ApplicationComponent
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ActivationOption.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ActivationOption.cs
new file mode 100644
index 00000000000..8149daaf458
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ActivationOption.cs
@@ -0,0 +1,16 @@
+//
+// System.EnterpriseServices.ActivationOption.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum ActivationOption {
+ Library,
+ Server
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationAccessControlAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationAccessControlAttribute.cs
new file mode 100644
index 00000000000..2c1262457da
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationAccessControlAttribute.cs
@@ -0,0 +1,63 @@
+//
+// System.EnterpriseServices.ApplicationAccessControlAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ApplicationAccessControlAttribute : Attribute {
+
+ #region Fields
+
+ AccessChecksLevelOption accessChecksLevel;
+ AuthenticationOption authentication;
+ ImpersonationLevelOption impersonation;
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ApplicationAccessControlAttribute ()
+ {
+ this.val = false;
+ }
+
+ public ApplicationAccessControlAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public AccessChecksLevelOption AccessChecksLevel {
+ get { return accessChecksLevel; }
+ set { accessChecksLevel = value; }
+ }
+
+ public AuthenticationOption Authentication {
+ get { return authentication; }
+ set { authentication = value; }
+ }
+
+ public ImpersonationLevelOption Impersonation {
+ get { return impersonation; }
+ set { impersonation = value; }
+ }
+
+ public bool Value {
+ get { return val; }
+ set { val = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationActivationAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationActivationAttribute.cs
new file mode 100644
index 00000000000..38fd3539732
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationActivationAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.EnterpriseServices.ApplicationActivationAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ApplicationActivationAttribute : Attribute {
+
+ #region Fields
+
+ ActivationOption opt;
+ string soapMailbox;
+ string soapVRoot;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ApplicationActivationAttribute (ActivationOption opt)
+ {
+ this.opt = opt;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string SoapMailbox {
+ get { return soapMailbox; }
+ set { soapMailbox = value; }
+ }
+
+ public string SoapVRoot {
+ get { return soapVRoot; }
+ set { soapVRoot = value; }
+ }
+
+ public ActivationOption Value {
+ get { return opt; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationIDAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationIDAttribute.cs
new file mode 100644
index 00000000000..332051c1fa2
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationIDAttribute.cs
@@ -0,0 +1,39 @@
+//
+// System.EnterpriseServices.ApplicationIDAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ApplicationIDAttribute : Attribute {
+
+ #region Fields
+
+ Guid guid;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ApplicationIDAttribute (string guid)
+ {
+ this.guid = new Guid (guid);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Guid Value {
+ get { return guid; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationNameAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationNameAttribute.cs
new file mode 100644
index 00000000000..65700494dce
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationNameAttribute.cs
@@ -0,0 +1,39 @@
+//
+// System.EnterpriseServices.ApplicationNameAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ApplicationNameAttribute : Attribute {
+
+ #region Fields
+
+ string name;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ApplicationNameAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Value {
+ get { return name; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationQueuingAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationQueuingAttribute.cs
new file mode 100644
index 00000000000..de0c7911e42
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ApplicationQueuingAttribute.cs
@@ -0,0 +1,54 @@
+//
+// System.EnterpriseServices.ApplicationQueuingAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ApplicationQueuingAttribute : Attribute {
+
+ #region Fields
+
+ bool enabled;
+ int maxListenerThreads;
+ bool queueListenerEnabled;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ApplicationQueuingAttribute ()
+ {
+ enabled = true;
+ queueListenerEnabled = false;
+ maxListenerThreads = 0;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public int MaxListenerThreads {
+ get { return maxListenerThreads; }
+ set { maxListenerThreads = value; }
+ }
+
+ public bool QueueListenerEnabled {
+ get { return queueListenerEnabled; }
+ set { queueListenerEnabled = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AuthenticationOption.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AuthenticationOption.cs
new file mode 100644
index 00000000000..52612f2a5c1
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AuthenticationOption.cs
@@ -0,0 +1,21 @@
+//
+// System.EnterpriseServices.AuthenticationOption.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum AuthenticationOption {
+ Call,
+ Connect,
+ Default,
+ Integrity,
+ None,
+ Packet,
+ Privacy
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AutoCompleteAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AutoCompleteAttribute.cs
new file mode 100644
index 00000000000..033f418f0e0
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/AutoCompleteAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.AutoCompleteAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class AutoCompleteAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public AutoCompleteAttribute ()
+ {
+ val = true;
+ }
+
+ public AutoCompleteAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/BOID.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/BOID.cs
new file mode 100644
index 00000000000..a1117a3a22e
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/BOID.cs
@@ -0,0 +1,21 @@
+//
+// System.EnterpriseServices.BOID.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ public struct BOID {
+
+ #region Fields
+
+ public byte[] rgb;
+
+ #endregion // Fields
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/BYOT.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/BYOT.cs
new file mode 100644
index 00000000000..a96c967b5f5
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/BYOT.cs
@@ -0,0 +1,31 @@
+//
+// System.EnterpriseServices.BYOT.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ public sealed class BYOT {
+
+ #region Methods
+
+ [MonoTODO]
+ public static object CreateWithTipTransaction (string url, Type t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object CreateWithTransaction (object transaction, Type t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/COMTIIntrinsicsAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/COMTIIntrinsicsAttribute.cs
new file mode 100644
index 00000000000..9b862db145a
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/COMTIIntrinsicsAttribute.cs
@@ -0,0 +1,45 @@
+//
+// System.EnterpriseServices.COMTIIntrinsicsAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class COMTIIntrinsicsAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public COMTIIntrinsicsAttribute ()
+ {
+ this.val = false;
+ }
+
+ public COMTIIntrinsicsAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ set { val = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ChangeLog b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ChangeLog
new file mode 100644
index 00000000000..8a993302e65
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ChangeLog
@@ -0,0 +1,99 @@
+2002-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RegistrationHelper.cs: fixed compilation.
+
+2002-08-09 Tim Coleman <tim@timcoleman.com>
+ * RegistrationHelperTx.cs:
+ Commit the add of RegistrationHelperTx.cs
+
+2002-08-08 Tim Coleman <tim@timcoleman.com>
+ * ISecurityCallContext.cs:
+ * ISecurityCallersColl.cs:
+ * ISecurityIdentityColl.cs:
+ * ISharedProperty.cs:
+ * ISharedPropertyGroup.cs:
+ * RegistrationHelperTx.cs:
+ * ResourcePool.cs:
+ * SecureMethodAttribute.cs:
+ * SecurityCallContext.cs:
+ * SecurityCallers.cs:
+ * SecurityIdentity.cs:
+ * SecurityRoleAttribute.cs:
+ * ServicedComponentException.cs:
+ * SharedProperty.cs:
+ * SharedPropertyGroup.cs:
+ * SharedPropertyGroupManager.cs:
+ * SynchronizationAttribute.cs:
+ * SynchronizationOption.cs:
+ * TransactionAttribute.cs:
+ * TransactionIsolationLevel.cs:
+ New files added.
+ * ContextUtil.cs:
+ New internal constructor added, methods added.
+ * IRemoteDispatch.cs:
+ AutoComplete attributes added to methods
+ * TODOAttribute.cs:
+ Namespace adjusted.
+
+
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * RegistrationErrorInfo.cs:
+ * RegistrationException.cs:
+ * RegistrationHelper.cs:
+ * ServicedComponent.cs:
+ New stubs added
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * IRegistrationHelper.cs:
+ * IRemoteDispatch.cs:
+ * IServicedComponentInfo.cs:
+ * ITransaction.cs:
+ Comment out Guid attribute for now
+ because it doesn't build with CSC unless
+ you supply a valid Guid.
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * DescriptionAttribute.cs:
+ * EventClassAttribute.cs:
+ * EventTrackingEnabledAttribute.cs:
+ * ExceptionClassAttribute.cs:
+ * IISIntrinsicsAttribute.cs:
+ * IRegistrationHelper.cs:
+ * IRemoteDispatch.cs:
+ * IServicedComponentInfo.cs:
+ * ITransaction.cs:
+ * InstallationFlags.cs:
+ * InterfaceQueuingAttribute.cs:
+ * JustInTimeActivationAttribute.cs:
+ * LoadBalancingSupportedAttribute.cs:
+ * MustRunInClientContextAttribute.cs:
+ * ObjectPoolingAttribute.cs:
+ * PrivateComponentAttribute.cs:
+ * PropertyLockMode.cs:
+ * PropertyReleaseMode.cs:
+ * XACTTRANSINFO.cs:
+ New stubs added.
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * AccessChecksLevelOption.cs:
+ * ActivationOption.cs:
+ * ApplicationAccessControlAttribute.cs:
+ * ApplicationActivationAttribute.cs:
+ * ApplicationIDAttribute.cs:
+ * ApplicationNameAttribute.cs:
+ * ApplicationQueuingAttribute.cs:
+ * AuthenticationOption.cs:
+ * AutoCompleteAttribute.cs:
+ * BOID.cs:
+ * BYOT.cs:
+ * COMTIIntrinsicsAttribute.cs:
+ * ComponentAccessControlAttribute.cs:
+ * ConstructionEnabledAttribute.cs:
+ * ContextUtil.cs:
+ * ImpersonationLevelOption.cs:
+ * TransactionVote.cs:
+ New stubs added
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * TransactionOption.cs: New enum added as
+ required by System.Web.Services
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ComponentAccessControlAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ComponentAccessControlAttribute.cs
new file mode 100644
index 00000000000..fa9aa286746
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ComponentAccessControlAttribute.cs
@@ -0,0 +1,45 @@
+//
+// System.EnterpriseServices.ComponentAccessControlAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ComponentAccessControlAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ComponentAccessControlAttribute ()
+ {
+ this.val = false;
+ }
+
+ public ComponentAccessControlAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ set { val = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ConstructionEnabledAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ConstructionEnabledAttribute.cs
new file mode 100644
index 00000000000..38a4345756c
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ConstructionEnabledAttribute.cs
@@ -0,0 +1,53 @@
+//
+// System.EnterpriseServices.ConstructionEnabledAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ConstructionEnabledAttribute : Attribute {
+
+ #region Fields
+
+ string def;
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ConstructionEnabledAttribute ()
+ {
+ def = String.Empty;
+ this.val = false;
+ }
+
+ public ConstructionEnabledAttribute (bool val)
+ {
+ def = String.Empty;
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Default {
+ get { return def; }
+ set { def = value; }
+ }
+
+ public bool Value {
+ get { return val; }
+ set { val = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ContextUtil.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ContextUtil.cs
new file mode 100644
index 00000000000..70136b421f4
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ContextUtil.cs
@@ -0,0 +1,130 @@
+//
+// System.EnterpriseServices.ContextUtil.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ public sealed class ContextUtil {
+
+ #region Fields
+
+ static bool deactivateOnReturn;
+ static TransactionVote myTransactionVote;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal ContextUtil ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public static Guid ActivityId {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static Guid ApplicationId {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static Guid ApplicationInstanceId {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static Guid ContextId {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static bool DeactivateOnReturn {
+ get { return deactivateOnReturn; }
+ set { deactivateOnReturn = value; }
+ }
+
+ public static bool IsInTransaction {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static bool IsSecurityEnabled {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static TransactionVote MyTransactionVote {
+ get { return myTransactionVote; }
+ set { myTransactionVote = value; }
+ }
+
+ public static Guid PartitionId {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static object Transaction {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static Guid TransactionId {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public static void DisableCommit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void EnableCommit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetNamedProperty ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsCallerInRole ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SetAbort ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SetComplete ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/DescriptionAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/DescriptionAttribute.cs
new file mode 100644
index 00000000000..11cb04b0196
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/DescriptionAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.EnterpriseServices.DescriptionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Interface)]
+ public sealed class DescriptionAttribute : Attribute {
+
+ #region Fields
+
+ string desc;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DescriptionAttribute (string desc)
+ {
+ this.desc = desc;
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventClassAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventClassAttribute.cs
new file mode 100644
index 00000000000..b3d6f464721
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventClassAttribute.cs
@@ -0,0 +1,54 @@
+//
+// System.EnterpriseServices.EventClassAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class EventClassAttribute : Attribute {
+
+ #region Fields
+
+ bool allowInProcSubscribers;
+ bool fireInParallel;
+ string publisherFilter;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public EventClassAttribute ()
+ {
+ allowInProcSubscribers = true;
+ fireInParallel = false;
+ publisherFilter = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowInProcSubscribers {
+ get { return allowInProcSubscribers; }
+ set { allowInProcSubscribers = value; }
+ }
+
+ public bool FireInParallel {
+ get { return fireInParallel; }
+ set { fireInParallel = value; }
+ }
+
+ public string PublisherFilter {
+ get { return publisherFilter; }
+ set { publisherFilter = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventTrackingEnabledAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventTrackingEnabledAttribute.cs
new file mode 100644
index 00000000000..774d534afb9
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/EventTrackingEnabledAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.EventTrackingEnabledAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class EventTrackingEnabledAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public EventTrackingEnabledAttribute ()
+ {
+ val = true;
+ }
+
+ public EventTrackingEnabledAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ExceptionClassAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ExceptionClassAttribute.cs
new file mode 100644
index 00000000000..fd128f38ce3
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ExceptionClassAttribute.cs
@@ -0,0 +1,39 @@
+//
+// System.EnterpriseServices.ExceptionClassAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ExceptionClassAttribute : Attribute {
+
+ #region Fields
+
+ string name;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ExceptionClassAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Value {
+ get { return name; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IISIntrinsicsAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IISIntrinsicsAttribute.cs
new file mode 100644
index 00000000000..37517855edd
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IISIntrinsicsAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.IISIntrinsicsAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class IISIntrinsicsAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public IISIntrinsicsAttribute ()
+ {
+ val = true;
+ }
+
+ public IISIntrinsicsAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRegistrationHelper.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRegistrationHelper.cs
new file mode 100644
index 00000000000..cd8c014a9ba
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRegistrationHelper.cs
@@ -0,0 +1,26 @@
+//
+// System.EnterpriseServices.IRegistrationHelper.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ //[Guid ("")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IRegistrationHelper {
+
+ #region Methods
+
+ void InstallAssembly (string assembly, out string application, out string tlb, InstallationFlags installFlags);
+ void UninstallAssembly (string assembly, string application);
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRemoteDispatch.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRemoteDispatch.cs
new file mode 100644
index 00000000000..663e8747c79
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRemoteDispatch.cs
@@ -0,0 +1,27 @@
+//
+// System.EnterpriseServices.IRemoteDispatch.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ //[Guid ("")]
+ public interface IRemoteDispatch {
+
+ #region Methods
+
+ [AutoComplete]
+ string RemoteDispatchAutoDone (string s);
+
+ [AutoComplete]
+ string RemoteDispatchNotAutoDone (string s);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallContext.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallContext.cs
new file mode 100644
index 00000000000..0b5a419caf0
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallContext.cs
@@ -0,0 +1,34 @@
+//
+// System.EnterpriseServices.ISecurityCallContext.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.EnterpriseServices {
+ internal interface ISecurityCallContext {
+
+ #region Properties
+
+ int Count {
+ get;
+ }
+
+ #endregion
+
+ #region Methods
+
+ void GetEnumerator (ref IEnumerator enumerator);
+ object GetItem (string user);
+ bool IsCallerInRole (string role);
+ bool IsSecurityEnabled ();
+ bool IsUserInRole (ref object user, string role);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallersColl.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallersColl.cs
new file mode 100644
index 00000000000..abea3422488
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityCallersColl.cs
@@ -0,0 +1,31 @@
+//
+// System.EnterpriseServices.ISecurityCallersColl.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.EnterpriseServices {
+ internal interface ISecurityCallersColl {
+
+ #region Properties
+
+ int Count {
+ get;
+ }
+
+ #endregion
+
+ #region Methods
+
+ void GetEnumerator (out IEnumerator enumerator);
+ ISecurityIdentityColl GetItem (int idx);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityIdentityColl.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityIdentityColl.cs
new file mode 100644
index 00000000000..09b5974ab07
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISecurityIdentityColl.cs
@@ -0,0 +1,31 @@
+//
+// System.EnterpriseServices.ISecurityIdentityColl.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.EnterpriseServices {
+ internal interface ISecurityIdentityColl {
+
+ #region Properties
+
+ int Count {
+ get;
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ void GetEnumerator (out IEnumerator enumerator);
+ SecurityIdentity GetItem (int idx);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IServicedComponentInfo.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IServicedComponentInfo.cs
new file mode 100644
index 00000000000..cc23e4eb53a
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IServicedComponentInfo.cs
@@ -0,0 +1,24 @@
+//
+// System.EnterpriseServices.IServicedComponentInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ //[Guid ("")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IServicedComponentInfo {
+
+ #region Methods
+
+ void GetComponentInfo (ref int infoMask, out string[] infoArray);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedProperty.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedProperty.cs
new file mode 100644
index 00000000000..ba5d3f03ca6
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedProperty.cs
@@ -0,0 +1,24 @@
+//
+// System.EnterpriseServices.SharedProperty.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ internal interface ISharedProperty {
+
+ #region Properties
+
+ object Value {
+ get;
+ set;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedPropertyGroup.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedPropertyGroup.cs
new file mode 100644
index 00000000000..ab8d4e4fb13
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ISharedPropertyGroup.cs
@@ -0,0 +1,24 @@
+//
+// System.EnterpriseServices.ISharedPropertyGroup.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ internal interface ISharedPropertyGroup {
+
+ #region Methods
+
+ ISharedProperty CreateProperty (string name, out bool fExists);
+ ISharedProperty CreatePropertyByPosition (int position, out bool fExists);
+ ISharedProperty Property (string name);
+ ISharedProperty PropertyByPosition (int position);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ITransaction.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ITransaction.cs
new file mode 100644
index 00000000000..34997509282
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ITransaction.cs
@@ -0,0 +1,26 @@
+//
+// System.EnterpriseServices.ITransaction.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ //[Guid ("")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITransaction {
+
+ #region Methods
+
+ void Abort (ref BOID pboidReason, int fRetaining, int fAsync);
+ void Commit (int fRetaining, int grfTC, int grfRM);
+ void GetTransactionInfo (out XACTTRANSINFO pinfo);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ImpersonationLevelOption.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ImpersonationLevelOption.cs
new file mode 100644
index 00000000000..f9a06ddb4f6
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ImpersonationLevelOption.cs
@@ -0,0 +1,19 @@
+//
+// System.EnterpriseServices.ImpersonationLevelOption.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum ImpersonationLevelOption {
+ Anonymous,
+ Default,
+ Delegate,
+ Identify,
+ Impersonate
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/InstallationFlags.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/InstallationFlags.cs
new file mode 100644
index 00000000000..bd11d1443f4
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/InstallationFlags.cs
@@ -0,0 +1,25 @@
+//
+// System.EnterpriseServices.InstallationFlags.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Flags]
+ [Serializable]
+ public enum InstallationFlags {
+ Configure,
+ ConfigureComponentsOnly,
+ CreateTargetApplication,
+ Default,
+ ExpectExistingTypeLib,
+ FindOrCreateTargetApplication,
+ Install,
+ ReconfigureExistingApplication,
+ Register,
+ ReportWarningsToConsole
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/InterfaceQueuingAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/InterfaceQueuingAttribute.cs
new file mode 100644
index 00000000000..d999c6ebd57
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/InterfaceQueuingAttribute.cs
@@ -0,0 +1,52 @@
+//
+// System.EnterpriseServices.InterfaceQueuingAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)]
+ public sealed class InterfaceQueuingAttribute : Attribute {
+
+ #region Fields
+
+ bool enabled;
+ string interfaceName;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public InterfaceQueuingAttribute ()
+ : this (true)
+ {
+ }
+
+ public InterfaceQueuingAttribute (bool enabled)
+ {
+ this.enabled = enabled;
+ interfaceName = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public string Interface {
+ get { return interfaceName; }
+ set { interfaceName = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/JustInTimeActivationAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/JustInTimeActivationAttribute.cs
new file mode 100644
index 00000000000..b5a991a23fb
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/JustInTimeActivationAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.JustInTimeActivationAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class JustInTimeActivationAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public JustInTimeActivationAttribute ()
+ : this (true)
+ {
+ }
+
+ public JustInTimeActivationAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/LoadBalancingSupportedAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/LoadBalancingSupportedAttribute.cs
new file mode 100644
index 00000000000..1dfefc49d42
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/LoadBalancingSupportedAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.LoadBalancingSupportedAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class LoadBalancingSupportedAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public LoadBalancingSupportedAttribute ()
+ : this (true)
+ {
+ }
+
+ public LoadBalancingSupportedAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/MustRunInClientContextAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/MustRunInClientContextAttribute.cs
new file mode 100644
index 00000000000..7d1bbdf8ecf
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/MustRunInClientContextAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.MustRunInClientContextAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class MustRunInClientContextAttribute : Attribute {
+
+ #region Fields
+
+ bool val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MustRunInClientContextAttribute ()
+ : this (true)
+ {
+ }
+
+ public MustRunInClientContextAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ObjectPoolingAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ObjectPoolingAttribute.cs
new file mode 100644
index 00000000000..3d03f4f8b27
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ObjectPoolingAttribute.cs
@@ -0,0 +1,98 @@
+//
+// System.EnterpriseServices.ObjectPoolingAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ObjectPoolingAttribute : Attribute {
+
+ #region Fields
+
+ int creationTimeout;
+ bool enabled;
+ int minPoolSize;
+ int maxPoolSize;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ObjectPoolingAttribute ()
+ : this (true)
+ {
+ }
+
+ public ObjectPoolingAttribute (bool enable)
+ {
+ this.enabled = enable;
+ }
+
+ public ObjectPoolingAttribute (int minPoolSize, int maxPoolSize)
+ : this (true, minPoolSize, maxPoolSize)
+ {
+ }
+
+ public ObjectPoolingAttribute (bool enable, int minPoolSize, int maxPoolSize)
+ {
+ this.enabled = enable;
+ this.minPoolSize = minPoolSize;
+ this.maxPoolSize = maxPoolSize;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int CreationTimeout {
+ get { return creationTimeout; }
+ set { creationTimeout = value; }
+ }
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public int MaxPoolSize {
+ get { return maxPoolSize; }
+ set { maxPoolSize = value; }
+ }
+
+ public int MinPoolSize {
+ get { return minPoolSize; }
+ set { minPoolSize = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public bool AfterSaveChanges (Hashtable info)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Apply (Hashtable info)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsValidTarget (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PrivateComponentAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PrivateComponentAttribute.cs
new file mode 100644
index 00000000000..75b455239a9
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PrivateComponentAttribute.cs
@@ -0,0 +1,24 @@
+//
+// System.EnterpriseServices.PrivateComponentAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class PrivateComponentAttribute : Attribute {
+
+ #region Constructors
+
+ public PrivateComponentAttribute ()
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyLockMode.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyLockMode.cs
new file mode 100644
index 00000000000..d84f25bb642
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyLockMode.cs
@@ -0,0 +1,20 @@
+//
+// System.EnterpriseServices.PropertyLockMode.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ [ComVisible (false)]
+ public enum PropertyLockMode {
+ Method,
+ SetGet
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyReleaseMode.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyReleaseMode.cs
new file mode 100644
index 00000000000..23da41d9f62
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/PropertyReleaseMode.cs
@@ -0,0 +1,20 @@
+//
+// System.EnterpriseServices.PropertyReleaseMode.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ [ComVisible (false)]
+ public enum PropertyReleaseMode {
+ Process,
+ Standard
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationErrorInfo.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationErrorInfo.cs
new file mode 100644
index 00000000000..583ae677431
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationErrorInfo.cs
@@ -0,0 +1,63 @@
+//
+// System.EnterpriseServices.RegistrationErrorInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public sealed class RegistrationErrorInfo {
+
+ #region Fields
+
+ int errorCode;
+ string errorString;
+ string majorRef;
+ string minorRef;
+ string name;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public RegistrationErrorInfo (string name, string majorRef, string minorRef, int errorCode)
+ {
+ this.name = name;
+ this.majorRef = majorRef;
+ this.minorRef = minorRef;
+ this.errorCode = errorCode;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int ErrorCode {
+ get { return errorCode; }
+ }
+
+ public string ErrorString {
+ get { return errorString; }
+ }
+
+ public string MajorRef {
+ get { return majorRef; }
+ }
+
+ public string MinorRef {
+ get { return minorRef; }
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationException.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationException.cs
new file mode 100644
index 00000000000..41518811686
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationException.cs
@@ -0,0 +1,51 @@
+//
+// System.EnterpriseServices.RegistrationException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public sealed class RegistrationException : SystemException {
+
+ #region Fields
+
+ RegistrationErrorInfo[] errorInfo;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public RegistrationException (string msg)
+ : base (msg)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public RegistrationErrorInfo[] ErrorInfo {
+ get { return errorInfo; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo info, StreamingContext ctx)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelper.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelper.cs
new file mode 100644
index 00000000000..79d0db9b386
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelper.cs
@@ -0,0 +1,54 @@
+//
+// System.EnterpriseServices.RegistrationHelper.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ //[Guid ("")]
+ public sealed class RegistrationHelper : MarshalByRefObject, IRegistrationHelper {
+
+ #region Constructors
+
+ public RegistrationHelper ()
+ {
+ }
+
+ #endregion
+
+ #region Methods
+
+ public void InstallAssembly (string assembly, out string application, out string tlb, InstallationFlags installFlags)
+ {
+ application = String.Empty;
+ tlb = String.Empty;
+
+ InstallAssembly (assembly, ref application, null, ref tlb, installFlags);
+ }
+
+ [MonoTODO]
+ public void InstallAssembly (string assembly, ref string application, string partition, ref string tlb, InstallationFlags installFlags)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UninstallAssembly (string assembly, string application)
+ {
+ UninstallAssembly (assembly, application, null);
+ }
+
+ [MonoTODO]
+ public void UninstallAssembly (string assembly, string application, string partition)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelperTx.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelperTx.cs
new file mode 100644
index 00000000000..a8ac859edca
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/RegistrationHelperTx.cs
@@ -0,0 +1,69 @@
+//
+// System.EnterpriseServices.RegistrationHelperTx.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ public sealed class RegistrationHelperTx : ServicedComponent {
+
+ #region Constructors
+
+ [MonoTODO]
+ public RegistrationHelperTx ()
+ {
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ protected internal override void Activate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void Deactivate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void InstallAssembly (string assembly, ref string application, ref string tlb, InstallationFlags installFlags, object sync)
+ {
+ InstallAssembly (assembly, ref application, null, ref tlb, installFlags, sync);
+ }
+
+ [MonoTODO]
+ public void InstallAssembly (string assembly, ref string application, string partition, ref string tlb, InstallationFlags installFlags, object sync)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsInTransaction ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UninstallAssembly (string assembly, string application, object sync)
+ {
+ UninstallAssembly (assembly, application, null, sync);
+ }
+
+ [MonoTODO]
+ public void UninstallAssembly (string assembly, string application, string partition, object sync)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ResourcePool.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ResourcePool.cs
new file mode 100644
index 00000000000..63e9666ca70
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ResourcePool.cs
@@ -0,0 +1,54 @@
+//
+// System.EnterpriseServices.ResourcePool.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ public sealed class ResourcePool {
+
+ #region Fields
+
+ ResourcePool.TransactionEndDelegate cb;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public ResourcePool (ResourcePool.TransactionEndDelegate cb)
+ {
+ this.cb = cb;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public object GetResource ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool PutResource (object resource)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Delegates
+
+ public delegate void TransactionEndDelegate (object resource);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecureMethodAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecureMethodAttribute.cs
new file mode 100644
index 00000000000..5d27bd16c5d
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecureMethodAttribute.cs
@@ -0,0 +1,24 @@
+//
+// System.EnterpriseServices.SecureMethodAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
+ public sealed class SecureMethodAttribute : Attribute {
+
+ #region Constructors
+
+ public SecureMethodAttribute ()
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallContext.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallContext.cs
new file mode 100644
index 00000000000..10d116a7616
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallContext.cs
@@ -0,0 +1,86 @@
+//
+// System.EnterpriseServices.SecurityCallContext.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ public sealed class SecurityCallContext {
+
+ #region Fields
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SecurityCallContext ()
+ {
+ }
+
+ internal SecurityCallContext (ISecurityCallContext context)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SecurityCallers Callers {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public static SecurityCallContext CurrentCall {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public SecurityIdentity DirectCaller {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsSecurityEnabled {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public int MinAuthenticationLevel {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public int NumCallers {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public SecurityIdentity OriginalCaller {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public bool IsCallerInRole (string role)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsUserInRole (string user, string role)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallers.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallers.cs
new file mode 100644
index 00000000000..ba6f8c7bb53
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityCallers.cs
@@ -0,0 +1,52 @@
+//
+// System.EnterpriseServices.SecurityCallers.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.EnterpriseServices {
+ public sealed class SecurityCallers : IEnumerable {
+
+ #region Constructors
+
+ internal SecurityCallers ()
+ {
+ }
+
+ internal SecurityCallers (ISecurityCallersColl collection)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Count {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public SecurityIdentity this [int idx] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityIdentity.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityIdentity.cs
new file mode 100644
index 00000000000..81fab4afec1
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityIdentity.cs
@@ -0,0 +1,54 @@
+//
+// System.EnterpriseServices.SecurityIdentity.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.EnterpriseServices {
+ public sealed class SecurityIdentity {
+
+ #region Constructors
+
+ [MonoTODO]
+ internal SecurityIdentity ()
+ {
+ }
+
+ [MonoTODO]
+ internal SecurityIdentity (ISecurityIdentityColl collection)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string AccountName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public AuthenticationOption AuthenticationLevel {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public int AuthenticationService {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ImpersonationLevelOption ImpersonationLevel {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityRoleAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityRoleAttribute.cs
new file mode 100644
index 00000000000..4a28fd021df
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SecurityRoleAttribute.cs
@@ -0,0 +1,59 @@
+//
+// System.EnterpriseServices.SecurityRoleAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Interface)]
+ public sealed class SecurityRoleAttribute : Attribute {
+
+ #region Fields
+
+ string description;
+ bool everyone;
+ string role;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SecurityRoleAttribute (string role)
+ : this (role, false)
+ {
+ }
+
+ public SecurityRoleAttribute (string role, bool everyone)
+ {
+ this.description = String.Empty;
+ this.everyone = everyone;
+ this.role = role;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public string Role {
+ get { return role; }
+ set { role = value; }
+ }
+
+ public bool SetEveryoneAccess {
+ get { return everyone; }
+ set { everyone = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponent.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponent.cs
new file mode 100644
index 00000000000..558e343207b
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponent.cs
@@ -0,0 +1,88 @@
+//
+// System.EnterpriseServices.ServicedComponent.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public abstract class ServicedComponent : ContextBoundObject, IDisposable, IRemoteDispatch, IServicedComponentInfo {
+
+ #region Constructors
+
+ public ServicedComponent ()
+ {
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ protected internal virtual void Activate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual bool CanBePooled ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual void Construct (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual void Deactivate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void DisposeObject (ServicedComponent sc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ string IRemoteDispatch.RemoteDispatchAutoDone (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ string IRemoteDispatch.RemoteDispatchNotAutoDone (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IServicedComponentInfo.GetComponentInfo (ref int infoMask, out string[] infoArray)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponentException.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponentException.cs
new file mode 100644
index 00000000000..582be988add
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/ServicedComponentException.cs
@@ -0,0 +1,35 @@
+//
+// System.EnterpriseServices.ServicedComponentException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public sealed class ServicedComponentException : SystemException {
+
+ #region Constructors
+
+ public ServicedComponentException ()
+ : base ()
+ {
+ }
+
+ public ServicedComponentException (string message)
+ : base (message)
+ {
+ }
+
+ public ServicedComponentException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedProperty.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedProperty.cs
new file mode 100644
index 00000000000..502e3bcefd2
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedProperty.cs
@@ -0,0 +1,41 @@
+//
+// System.EnterpriseServices.SharedProperty.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ [ComVisible (false)]
+ public sealed class SharedProperty {
+
+ #region Fields
+
+ ISharedProperty property;
+
+ #endregion
+
+ #region Constructors
+
+ internal SharedProperty (ISharedProperty property)
+ {
+ this.property = property;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public object Value {
+ get { return property.Value; }
+ set { property.Value = value; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroup.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroup.cs
new file mode 100644
index 00000000000..18b15e69731
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroup.cs
@@ -0,0 +1,56 @@
+//
+// System.EnterpriseServices.SharedPropertyGroup.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ [ComVisible (false)]
+ public sealed class SharedPropertyGroup {
+
+ #region Fields
+
+ ISharedPropertyGroup propertyGroup;
+
+ #endregion
+
+ #region Constructors
+
+ internal SharedPropertyGroup (ISharedPropertyGroup propertyGroup)
+ {
+ this.propertyGroup = propertyGroup;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public SharedProperty CreateProperty (string name, out bool fExists)
+ {
+ return new SharedProperty (propertyGroup.CreateProperty (name, out fExists));
+ }
+
+ public SharedProperty CreatePropertyByPosition (int position, out bool fExists)
+ {
+ return new SharedProperty (propertyGroup.CreatePropertyByPosition (position, out fExists));
+ }
+
+ public SharedProperty Property (string name)
+ {
+ return new SharedProperty (propertyGroup.Property (name));
+ }
+
+ public SharedProperty PropertyByPosition (int position)
+ {
+ return new SharedProperty (propertyGroup.PropertyByPosition (position));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroupManager.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroupManager.cs
new file mode 100644
index 00000000000..1125b64846a
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SharedPropertyGroupManager.cs
@@ -0,0 +1,48 @@
+//
+// System.EnterpriseServices.SharedPropertyGroupManager.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ [ComVisible (false)]
+ public sealed class SharedPropertyGroupManager : IEnumerable {
+
+ #region Constructors
+
+ public SharedPropertyGroupManager ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public SharedPropertyGroup CreatePropertyGroup (string name, ref PropertyLockMode dwIsoMode, ref PropertyReleaseMode dwRelMode, out bool fExist)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SharedPropertyGroup Group (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationAttribute.cs
new file mode 100644
index 00000000000..2add45b81b5
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.EnterpriseServices.SynchronizationAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class SynchronizationAttribute : Attribute {
+
+ #region Fields
+
+ SynchronizationOption val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SynchronizationAttribute ()
+ : this (SynchronizationOption.Required)
+ {
+ }
+
+ public SynchronizationAttribute (SynchronizationOption val)
+ {
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SynchronizationOption Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationOption.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationOption.cs
new file mode 100644
index 00000000000..2186e63875b
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/SynchronizationOption.cs
@@ -0,0 +1,21 @@
+//
+// System.EnterpriseServices.SynchronizationOption.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum SynchronizationOption {
+ Disabled,
+ NotSupported,
+ Required,
+ RequiresNew,
+ Supported
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TODOAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TODOAttribute.cs
new file mode 100755
index 00000000000..d134ddcff7c
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.EnterpriseServices {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionAttribute.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionAttribute.cs
new file mode 100644
index 00000000000..d308b1fa839
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionAttribute.cs
@@ -0,0 +1,58 @@
+//
+// System.EnterpriseServices.TransactionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class TransactionAttribute : Attribute {
+
+ #region Fields
+
+ TransactionIsolationLevel isolation;
+ int timeout;
+ TransactionOption val;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public TransactionAttribute ()
+ : this (TransactionOption.Required)
+ {
+ }
+
+ public TransactionAttribute (TransactionOption val)
+ {
+ this.isolation = TransactionIsolationLevel.Serializable;
+ this.timeout = -1;
+ this.val = val;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public TransactionIsolationLevel Isolation {
+ get { return isolation; }
+ set { isolation = value; }
+ }
+
+ public int Timeout {
+ get { return timeout; }
+ set { timeout = value; }
+ }
+
+ public TransactionOption Value {
+ get { return val; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionIsolationLevel.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionIsolationLevel.cs
new file mode 100644
index 00000000000..d350b4e1951
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionIsolationLevel.cs
@@ -0,0 +1,19 @@
+//
+// System.EnterpriseServices.TransactionIsolationLevel.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum TransactionIsolationLevel {
+ Any,
+ ReadCommitted,
+ ReadUncommitted,
+ RepeatableRead,
+ Serializable
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionOption.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionOption.cs
new file mode 100644
index 00000000000..96e104f5fe4
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionOption.cs
@@ -0,0 +1,19 @@
+//
+// System.EnterpriseServices.TransactionOption.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ public enum TransactionOption {
+ Disabled,
+ NotSupported,
+ Required,
+ RequiresNew,
+ Supported
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionVote.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionVote.cs
new file mode 100644
index 00000000000..4811fdcd850
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/TransactionVote.cs
@@ -0,0 +1,20 @@
+//
+// System.EnterpriseServices.TransactionVote.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.EnterpriseServices {
+ [Serializable]
+ [ComVisible (false)]
+ public enum TransactionVote {
+ Abort,
+ Commit
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices/XACTTRANSINFO.cs b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/XACTTRANSINFO.cs
new file mode 100644
index 00000000000..e0a520b9ebc
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices/XACTTRANSINFO.cs
@@ -0,0 +1,27 @@
+//
+// System.EnterpriseServices.XACTTRANSINFO.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.EnterpriseServices {
+ public struct XACTTRANSINFO {
+
+ #region Fields
+
+ public int grfRMSupported;
+ public int grfRMSupportedRetaining;
+ public int grfTCSupported;
+ public int grfTCSupportedRetaining;
+ public int isoFlags;
+ public int isoLevel;
+ public BOID uow;
+
+ #endregion // Fields
+ }
+}
diff --git a/mcs/class/System.EnterpriseServices/list b/mcs/class/System.EnterpriseServices/list
new file mode 100644
index 00000000000..8eb34f2dc54
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/list
@@ -0,0 +1,69 @@
+./System.EnterpriseServices/AccessChecksLevelOption.cs
+./System.EnterpriseServices/ActivationOption.cs
+./System.EnterpriseServices/ApplicationAccessControlAttribute.cs
+./System.EnterpriseServices/ApplicationActivationAttribute.cs
+./System.EnterpriseServices/ApplicationIDAttribute.cs
+./System.EnterpriseServices/ApplicationNameAttribute.cs
+./System.EnterpriseServices/ApplicationQueuingAttribute.cs
+./System.EnterpriseServices/AuthenticationOption.cs
+./System.EnterpriseServices/AutoCompleteAttribute.cs
+./System.EnterpriseServices/BOID.cs
+./System.EnterpriseServices/BYOT.cs
+./System.EnterpriseServices/COMTIIntrinsicsAttribute.cs
+./System.EnterpriseServices/ComponentAccessControlAttribute.cs
+./System.EnterpriseServices/ConstructionEnabledAttribute.cs
+./System.EnterpriseServices/ContextUtil.cs
+./System.EnterpriseServices/DescriptionAttribute.cs
+./System.EnterpriseServices/EventClassAttribute.cs
+./System.EnterpriseServices/EventTrackingEnabledAttribute.cs
+./System.EnterpriseServices/ExceptionClassAttribute.cs
+./System.EnterpriseServices/IISIntrinsicsAttribute.cs
+./System.EnterpriseServices/ImpersonationLevelOption.cs
+./System.EnterpriseServices/InstallationFlags.cs
+./System.EnterpriseServices/InterfaceQueuingAttribute.cs
+./System.EnterpriseServices/IRegistrationHelper.cs
+./System.EnterpriseServices/IRemoteDispatch.cs
+./System.EnterpriseServices/ISecurityCallContext.cs
+./System.EnterpriseServices/ISecurityCallersColl.cs
+./System.EnterpriseServices/ISecurityIdentityColl.cs
+./System.EnterpriseServices/IServicedComponentInfo.cs
+./System.EnterpriseServices/ISharedProperty.cs
+./System.EnterpriseServices/ISharedPropertyGroup.cs
+./System.EnterpriseServices/ITransaction.cs
+./System.EnterpriseServices/JustInTimeActivationAttribute.cs
+./System.EnterpriseServices/LoadBalancingSupportedAttribute.cs
+./System.EnterpriseServices/MustRunInClientContextAttribute.cs
+./System.EnterpriseServices/ObjectPoolingAttribute.cs
+./System.EnterpriseServices/PrivateComponentAttribute.cs
+./System.EnterpriseServices/PropertyLockMode.cs
+./System.EnterpriseServices/PropertyReleaseMode.cs
+./System.EnterpriseServices/RegistrationErrorInfo.cs
+./System.EnterpriseServices/RegistrationException.cs
+./System.EnterpriseServices/RegistrationHelper.cs
+./System.EnterpriseServices/RegistrationHelperTx.cs
+./System.EnterpriseServices/ResourcePool.cs
+./System.EnterpriseServices/SecureMethodAttribute.cs
+./System.EnterpriseServices/SecurityCallContext.cs
+./System.EnterpriseServices/SecurityCallers.cs
+./System.EnterpriseServices/SecurityIdentity.cs
+./System.EnterpriseServices/SecurityRoleAttribute.cs
+./System.EnterpriseServices/ServicedComponent.cs
+./System.EnterpriseServices/ServicedComponentException.cs
+./System.EnterpriseServices/SharedProperty.cs
+./System.EnterpriseServices/SharedPropertyGroup.cs
+./System.EnterpriseServices/SharedPropertyGroupManager.cs
+./System.EnterpriseServices/SynchronizationAttribute.cs
+./System.EnterpriseServices/SynchronizationOption.cs
+./System.EnterpriseServices/TODOAttribute.cs
+./System.EnterpriseServices/TransactionAttribute.cs
+./System.EnterpriseServices/TransactionIsolationLevel.cs
+./System.EnterpriseServices/TransactionOption.cs
+./System.EnterpriseServices/TransactionVote.cs
+./System.EnterpriseServices/XACTTRANSINFO.cs
+./System.EnterpriseServices.CompensatingResourceManager/ApplicationCrmEnabledAttribute.cs
+./System.EnterpriseServices.CompensatingResourceManager/Clerk.cs
+./System.EnterpriseServices.CompensatingResourceManager/Compensator.cs
+./System.EnterpriseServices.CompensatingResourceManager/CompensatorOptions.cs
+./System.EnterpriseServices.CompensatingResourceManager/LogRecord.cs
+./System.EnterpriseServices.CompensatingResourceManager/LogRecordFlags.cs
+./System.EnterpriseServices.CompensatingResourceManager/TransactionState.cs
diff --git a/mcs/class/System.EnterpriseServices/makefile.gnu b/mcs/class/System.EnterpriseServices/makefile.gnu
new file mode 100644
index 00000000000..51518c5420f
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.EnterpriseServices.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Runtime.Remoting/.cvsignore b/mcs/class/System.Runtime.Remoting/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Runtime.Remoting/ChangeLog b/mcs/class/System.Runtime.Remoting/ChangeLog
new file mode 100644
index 00000000000..247c93721ca
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/ChangeLog
@@ -0,0 +1,35 @@
+2002-12-29 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * CommonTransportKeys.cs: Implemented and added to CVS
+ * TcpChannel.cs: Added. It is a more ore less complete implementation
+ of the tcp channel, although not yet compatible with MS TcpChannel.
+ * TcpClientChannel.cs: Added
+ * TcpClientTransportSink.cs: Added
+ * TcpClientTransportSinkProvider.cs: Added
+ * TcpConnectionPool.cs: Added
+ * TcpMessageIO.cs: Added
+ * TcpServerChannel.cs: Added
+ * TcpServerTransportSink.cs: Added
+ * SimpleWireFormat.cs: Corrected a bug in method SerializeObject
+ * SimpleServerFormatterSink.cs: Some small corrections
+ * SimpleClientFormatterSink.cs: Some small corrections
+
+2002-09-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs:
+ impl. the channel wrapper.
+
+ * System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs:
+ impl. the channel wrapper.
+
+ * System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
+ (GetUrlsForUri): use all available channel uris.
+
+2002-08-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs: add
+ more types.
+
+2002-08-14 Rodrigo Moya <rodrigo@ximian.com>
+
+ * TcpChannel.cs: new classes. \ No newline at end of file
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CDRFormatter.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CDRFormatter.cs
new file mode 100755
index 00000000000..fb936050e21
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CDRFormatter.cs
@@ -0,0 +1,299 @@
+// System.Runtime.Remoting.Channels.CORBA.CDRFormatter.cs
+//
+// Author:
+// DietmarMaurer (dietmar@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+
+
+// this is only a dummy, not CDR compatible
+
+using System.Runtime.Serialization.Formatters;
+using System.Runtime.Serialization;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels.CORBA {
+
+ public sealed class CDRFormatter
+ {
+ enum TypeId : byte {
+ Boolean,
+ Byte,
+ Char,
+ Decimal,
+ Double,
+ Int16,
+ Int32,
+ Int64,
+ SByte,
+ String,
+ Single,
+ UInt16,
+ UInt32,
+ UInt64,
+ NULL
+ }
+
+ public CDRFormatter ()
+ {
+ }
+
+ void SerializeObject (BinaryWriter writer, object obj)
+ {
+ Type type = obj.GetType ();
+
+ if (obj == null) {
+ writer.Write ((byte)TypeId.NULL);
+ return;
+ }
+
+ if (type == typeof (String)) {
+ writer.Write ((byte)TypeId.String);
+ writer.Write ((String)obj);
+ return;
+ }
+
+ if (type == typeof (int)) {
+ writer.Write ((byte)TypeId.Int32);
+ writer.Write ((int)obj);
+ return;
+ }
+
+ if (type == typeof (long)) {
+ writer.Write ((byte)TypeId.Int64);
+ writer.Write ((long)obj);
+ return;
+ }
+
+ if (type == typeof (uint)) {
+ writer.Write ((byte)TypeId.UInt32);
+ writer.Write ((uint)obj);
+ return;
+ }
+
+ if (type == typeof (ulong)) {
+ writer.Write ((byte)TypeId.UInt64);
+ writer.Write ((ulong)obj);
+ return;
+ }
+
+ if (type == typeof (bool)) {
+ writer.Write ((byte)TypeId.Boolean);
+ writer.Write ((bool)obj);
+ return;
+ }
+
+ if (type == typeof (byte)) {
+ writer.Write ((byte)TypeId.Byte);
+ writer.Write ((byte)obj);
+ return;
+ }
+
+ if (type == typeof (sbyte)) {
+ writer.Write ((byte)TypeId.SByte);
+ writer.Write ((sbyte)obj);
+ return;
+ }
+
+ if (type == typeof (char)) {
+ writer.Write ((byte)TypeId.Char);
+ writer.Write ((char)obj);
+ return;
+ }
+
+ if (type == typeof (double)) {
+ writer.Write ((byte)TypeId.Double);
+ writer.Write ((double)obj);
+ return;
+ }
+
+ if (type == typeof (Single)) {
+ writer.Write ((byte)TypeId.Single);
+ writer.Write ((Single)obj);
+ return;
+ }
+
+ if (type == typeof (Int16)) {
+ writer.Write ((byte)TypeId.Int16);
+ writer.Write ((Int16)obj);
+ return;
+ }
+
+ if (type == typeof (UInt16)) {
+ writer.Write ((byte)TypeId.UInt16);
+ writer.Write ((UInt16)obj);
+ return;
+ }
+
+ if (type == typeof (Decimal)) {
+ writer.Write ((byte)TypeId.Decimal);
+ writer.Write ((Decimal)obj);
+ return;
+ }
+
+ throw new NotSupportedException ();
+ }
+
+ object DeserializeObject (BinaryReader reader)
+ {
+ TypeId tid = (TypeId)reader.ReadByte ();
+
+ if (tid == TypeId.NULL)
+ return null;
+
+ if (tid == TypeId.String) {
+ return reader.ReadString ();
+ }
+
+ if (tid == TypeId.Int32) {
+ return reader.ReadInt32 ();
+ }
+
+ if (tid == TypeId.Int64) {
+ return reader.ReadInt64 ();
+ }
+
+ if (tid == TypeId.UInt32) {
+ return reader.ReadUInt32 ();
+ }
+
+ if (tid == TypeId.UInt64) {
+ return reader.ReadUInt64 ();
+ }
+
+ if (tid == TypeId.Boolean) {
+ return reader.ReadBoolean ();
+ }
+
+ if (tid == TypeId.Byte) {
+ return reader.ReadByte ();
+ }
+
+ if (tid == TypeId.SByte) {
+ return reader.ReadSByte ();
+ }
+
+ if (tid == TypeId.Char) {
+ return reader.ReadChar ();
+ }
+
+ if (tid == TypeId.Double) {
+ return reader.ReadDouble ();
+ }
+
+ if (tid == TypeId.Single) {
+ return reader.ReadSingle ();
+ }
+
+ if (tid == TypeId.Byte) {
+ return reader.ReadByte ();
+ }
+
+ if (tid == TypeId.Int16) {
+ return reader.ReadInt16 ();
+ }
+
+ if (tid == TypeId.UInt16) {
+ return reader.ReadUInt16 ();
+ }
+
+ if (tid == TypeId.Decimal) {
+ return reader.ReadDecimal ();
+ }
+
+ throw new NotSupportedException ();
+ }
+
+ public IMethodCallMessage DeserializeRequest (Stream serializationStream, string uri)
+ {
+ if (serializationStream == null) {
+ throw new ArgumentNullException ("serializationStream is null");
+ }
+
+ Type svr_type = RemotingServices.GetServerTypeForUri (uri);
+ if (svr_type == null)
+ throw new RemotingException ("no registered server for uri " + uri);
+
+ BinaryReader reader = new BinaryReader (serializationStream);
+
+ string method_name = reader.ReadString ();
+ int arg_count = reader.ReadInt32 ();
+
+ object [] args = new object [arg_count];
+ for (int i = 0; i < arg_count; i++) {
+ args [i] = DeserializeObject (reader);
+ }
+
+ MonoMethodMessage msg = new MonoMethodMessage (svr_type, method_name, args);
+
+ return msg;
+ }
+
+ public IMethodReturnMessage DeserializeResponse (Stream serializationStream,
+ IMethodCallMessage request)
+ {
+
+ BinaryReader reader = new BinaryReader (serializationStream);
+
+ object return_value = DeserializeObject (reader);
+
+ int arg_count = reader.ReadInt32 ();
+ object [] out_args = new object [arg_count];
+ for (int i = 0; i < arg_count; i++)
+ out_args [i] = DeserializeObject (reader);
+
+ return new ReturnMessage (return_value, out_args, arg_count, null, request);
+ }
+
+ public void SerializeRequest (Stream serializationStream, object graph)
+ {
+ if (serializationStream == null) {
+ throw new ArgumentNullException ("serializationStream is null");
+ }
+
+ BinaryWriter writer = new BinaryWriter (serializationStream);
+
+ IMethodCallMessage msg = graph as IMethodCallMessage;
+ if (msg != null) {
+ writer.Write (msg.MethodName);
+ writer.Write ((int)msg.InArgCount);
+ for (int i = 0; i < msg.InArgCount; i++)
+ SerializeObject (writer, msg.GetInArg (i));
+ return;
+ }
+
+ throw new NotSupportedException ();
+ }
+
+ public void SerializeResponse (Stream serializationStream, object graph)
+ {
+ if (serializationStream == null) {
+ throw new ArgumentNullException ("serializationStream is null");
+ }
+
+ BinaryWriter writer = new BinaryWriter (serializationStream);
+
+ IMethodReturnMessage res = graph as IMethodReturnMessage;
+ if (res != null) {
+
+ // this channel does not support serialization of exception,
+ // so we simply let the transport decide what to do
+ if (res.Exception != null)
+ return;
+
+ SerializeObject (writer, res.ReturnValue);
+ writer.Write (res.OutArgCount);
+
+ for (int i = 0; i < res.OutArgCount; i++)
+ SerializeObject (writer, res.GetOutArg (i));
+
+ return;
+ }
+
+ throw new NotSupportedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs
new file mode 100644
index 00000000000..abaad39c77c
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs
@@ -0,0 +1,111 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAChannel : IChannelReceiver, IChannel,
+ IChannelSender
+ {
+ CORBAServerChannel svr_chnl;
+ CORBAClientChannel cnt_chnl;
+
+ string name = "corba";
+
+ public CORBAChannel ()
+ {
+ svr_chnl = new CORBAServerChannel (0);
+ cnt_chnl = new CORBAClientChannel ();
+ }
+
+ public CORBAChannel (int port)
+ {
+ svr_chnl = new CORBAServerChannel (port);
+ cnt_chnl = new CORBAClientChannel ();
+ }
+
+ [MonoTODO]
+ public CORBAChannel (IDictionary properties,
+ IClientChannelSinkProvider clientSinkProvider,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object ChannelData
+ {
+ get {
+ return svr_chnl.ChannelData;
+ }
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return svr_chnl.ChannelPriority;
+ }
+ }
+
+ public IMessageSink CreateMessageSink (string url,
+ object remoteChannelData,
+ out string objectURI)
+ {
+ return cnt_chnl.CreateMessageSink (url, remoteChannelData, out objectURI);
+ }
+
+ public string[] GetUrlsForUri (string objectURI)
+ {
+ return svr_chnl.GetUrlsForUri (objectURI);
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ return svr_chnl.Parse (url, out objectURI);
+ }
+
+ public void StartListening (object data)
+ {
+ svr_chnl.StartListening (data);
+ }
+
+ public void StopListening (object data)
+ {
+ svr_chnl.StopListening (data);
+ }
+
+ internal static string ParseCORBAURL (string url, out string objectURI, out int port)
+ {
+ // format: "corba://host:port/path/to/object"
+
+ objectURI = null;
+ port = 0;
+
+ Match m = Regex.Match (url, "corba://([^:]+):([0-9]+)(/.*)");
+
+ if (!m.Success)
+ return null;
+
+ string host = m.Groups[1].Value;
+ string port_str = m.Groups[2].Value;
+ objectURI = m.Groups[3].Value;
+ port = Convert.ToInt32 (port_str);
+
+ return host;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientChannel.cs
new file mode 100644
index 00000000000..6aaddb4b927
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientChannel.cs
@@ -0,0 +1,102 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAClientChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAClientChannel : IChannelSender, IChannel
+ {
+ int priority = 1;
+ string name = "corba";
+ IClientChannelSinkProvider sink_provider;
+
+ public CORBAClientChannel ()
+ {
+ sink_provider = new CORBAClientFormatterSinkProvider ();
+ sink_provider.Next = new CORBAClientTransportSinkProvider ();
+ }
+
+ public CORBAClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
+ {
+ priority = 1;
+ sink_provider = sinkProvider;
+
+ // add the tcp provider at the end of the chain
+ IClientChannelSinkProvider prov = sinkProvider;
+ while (prov.Next != null) prov = prov.Next;
+ prov.Next = new CORBAClientTransportSinkProvider ();
+ }
+
+ public CORBAClientChannel (string name, IClientChannelSinkProvider sinkProvider)
+ {
+ priority = 1;
+ this.name = name;
+ sink_provider = sinkProvider;
+
+ // add the tcp provider at the end of the chain
+ IClientChannelSinkProvider prov = sinkProvider;
+ while (prov.Next != null) prov = prov.Next;
+ prov.Next = new CORBAClientTransportSinkProvider ();
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return priority;
+ }
+ }
+
+ public IMessageSink CreateMessageSink (string url,
+ object remoteChannelData,
+ out string objectURI)
+ {
+ objectURI = null;
+
+ if (url != null) {
+ if (Parse (url, out objectURI) != null)
+ return (IMessageSink) sink_provider.CreateSink (this, url,
+ remoteChannelData);
+ }
+
+ if (remoteChannelData != null) {
+ IChannelDataStore ds = remoteChannelData as IChannelDataStore;
+ if (ds != null) {
+ foreach (string chnl_uri in ds.ChannelUris) {
+ if (Parse (chnl_uri, out objectURI) == null)
+ continue;
+ return (IMessageSink) sink_provider.CreateSink (this, chnl_uri,
+ remoteChannelData);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ int port;
+
+ string host = CORBAChannel.ParseCORBAURL (url, out objectURI, out port);
+
+ return "corba://" + host + ":" + port;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSink.cs
new file mode 100644
index 00000000000..1216fed1851
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSink.cs
@@ -0,0 +1,126 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAClientFormatterSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAClientFormatterSink : IClientFormatterSink,
+ IMessageSink, IClientChannelSink, IChannelSinkBase
+ {
+ IClientChannelSink nextInChain;
+ CDRFormatter format = new CDRFormatter ();
+
+ public CORBAClientFormatterSink (IClientChannelSink nextSink)
+ {
+ nextInChain = nextSink;
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get {
+ return nextInChain;
+ }
+ }
+
+ public IMessageSink NextSink
+ {
+ get {
+ return (IMessageSink) nextInChain;
+ }
+ }
+
+ public IDictionary Properties
+ {
+ get {
+ return null;
+ }
+ }
+
+ public IMessageCtrl AsyncProcessMessage (IMessage msg,
+ IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack,
+ IMessage msg,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ // never called because the formatter sink is
+ // always the first in the chain
+ throw new NotSupportedException ();
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetRequestStream (IMessage msg,
+ ITransportHeaders headers)
+ {
+ // never called
+ throw new NotSupportedException ();
+ }
+
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // never called because the formatter sink is
+ // always the first in the chain
+ throw new NotSupportedException ();
+ }
+
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ IMethodCallMessage call = (IMethodCallMessage)msg;
+
+ // we catch all exceptions to return them as message
+ try {
+ // create a new header
+ TransportHeaders req_headers = new TransportHeaders ();
+
+ //fixme: set some header values
+
+ Stream out_stream = new MemoryStream ();
+
+ // serialize msg to the stream
+ format.SerializeRequest (out_stream, msg);
+
+ // call the next sink
+ ITransportHeaders resp_headers;
+ Stream resp_stream;
+ nextInChain.ProcessMessage (msg, req_headers, out_stream, out resp_headers,
+ out resp_stream);
+
+ // deserialize resp_stream
+ IMessage result = (IMessage) format.DeserializeResponse (resp_stream, call);
+
+ // it's save to close the stream now
+ resp_stream.Close ();
+
+ return result;
+
+ } catch (Exception e) {
+ return new ReturnMessage (e, call);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSinkProvider.cs
new file mode 100644
index 00000000000..b8a316d7827
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientFormatterSinkProvider.cs
@@ -0,0 +1,61 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAClientFormatterSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAClientFormatterSinkProvider :
+ IClientFormatterSinkProvider, IClientChannelSinkProvider
+ {
+ IClientChannelSinkProvider next = null;
+
+ // add any sink properties here (private fields)
+
+ public CORBAClientFormatterSinkProvider ()
+ {
+ // nothing to do
+ }
+
+ public CORBAClientFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ // copy the contained properties to private fields
+
+ // add a check that there is no providerData
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get {
+ return next;
+ }
+
+ set {
+ next = value;
+ }
+ }
+
+ public IClientChannelSink CreateSink (IChannelSender channel,
+ string url,
+ object remoteChannelData)
+ {
+ IClientChannelSink next_sink = null;
+ CORBAClientFormatterSink result;
+
+ if (next != null)
+ next_sink = next.CreateSink (channel, url, remoteChannelData);
+
+ result = new CORBAClientFormatterSink (next_sink);
+
+ // set properties on the newly creates sink
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSink.cs
new file mode 100644
index 00000000000..132a648eff5
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSink.cs
@@ -0,0 +1,104 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAClientTransportSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+
+ internal class CORBAClientTransportSink : IClientChannelSink
+ {
+ string host;
+ string object_uri;
+ int port;
+
+ TcpClient tcpclient;
+
+ public CORBAClientTransportSink (string url)
+ {
+ host = CORBAChannel.ParseCORBAURL (url, out object_uri, out port);
+ tcpclient = new TcpClient ();
+ }
+
+ public IDictionary Properties
+ {
+ get {
+ return null;
+ }
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get {
+ // we are the last one
+ return null;
+ }
+ }
+
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack, IMessage msg,
+ ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state, ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetRequestStream (IMessage msg, ITransportHeaders headers)
+ {
+ // no direct access to the stream
+ return null;
+ }
+
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // get a network stream
+ tcpclient.Connect (host, port);
+ Stream network_stream = tcpclient.GetStream ();
+
+ // send the message
+ IIOPMessage.SendMessageStream (network_stream, (MemoryStream)requestStream,
+ IIOPMessage.MessageType.Request,
+ object_uri);
+
+ // read the response fro the network an copy it to a memory stream
+ IIOPMessage.MessageType msg_type;
+ string uri;
+ MemoryStream mem_stream =
+ IIOPMessage.ReceiveMessageStream (network_stream, out msg_type, out uri);
+
+ // close the stream
+ tcpclient.Close ();
+
+ switch (msg_type) {
+ case IIOPMessage.MessageType.Response:
+ //fixme: read response message
+ responseHeaders = null;
+
+ responseStream = mem_stream;
+
+ break;
+ default:
+ throw new Exception ("unknown response mesage header");
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSinkProvider.cs
new file mode 100644
index 00000000000..22d6b9cb499
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAClientTransportSinkProvider.cs
@@ -0,0 +1,41 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAClientTransportSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAClientTransportSinkProvider : IClientChannelSinkProvider
+ {
+ public CORBAClientTransportSinkProvider ()
+ {
+ // what should we do here ?
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get {
+ return null;
+ }
+
+ set {
+ // ignore, we are always the last in the chain
+ }
+ }
+
+ public IClientChannelSink CreateSink (IChannelSender channel, string url,
+ object remoteChannelData)
+ {
+ return new CORBAClientTransportSink (url);
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerChannel.cs
new file mode 100644
index 00000000000..080af738a53
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerChannel.cs
@@ -0,0 +1,168 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAServerChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+using System.Net.Sockets;
+using System.Net;
+using System.Threading;
+using System.IO;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAServerChannel : IChannelReceiver, IChannel
+ {
+ int port = 0;
+ string name = "simple";
+ string host;
+ int priority = 1;
+ Thread server_thread = null;
+ TcpListener listener;
+ CORBAServerTransportSink sink;
+ ChannelDataStore channel_data;
+
+ void Init (IServerChannelSinkProvider provider) {
+ if (provider == null) {
+ provider = new CORBAServerFormatterSinkProvider ();
+ }
+
+ IServerChannelSink next_sink = ChannelServices.CreateServerChannelSinkChain (provider, this);
+
+ host = Dns.GetHostByName(Dns.GetHostName()).HostName;
+
+ string [] uris = null;
+
+ if (port != 0) {
+ uris = new String [1];
+ uris [0] = GetChannelUri ();
+ }
+
+ channel_data = new ChannelDataStore (uris);;
+
+ sink = new CORBAServerTransportSink (next_sink);
+
+ listener = new TcpListener (port);
+ StartListening (null);
+ }
+
+ public CORBAServerChannel (int port)
+ {
+ this.port = port;
+ Init (null);
+ }
+
+ public CORBAServerChannel (IDictionary properties,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ port = (int)properties ["port"];
+ Init (serverSinkProvider);
+ }
+
+ public CORBAServerChannel (string name, int port,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ name = name;
+ this.port = port;
+ Init (serverSinkProvider);
+ }
+
+ public CORBAServerChannel (string name, int port)
+ {
+ name = name;
+ this.port = port;
+ Init (null);
+ }
+
+ public object ChannelData
+ {
+ get {
+ return channel_data;
+ }
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return priority;
+ }
+ }
+
+ string GetChannelUri ()
+ {
+ return "corba://" + host + ":" + port;
+ }
+
+ public string[] GetUrlsForUri (string uri)
+ {
+ string [] chnl_uris = channel_data.ChannelUris;
+
+ if (uri.IndexOf ('/') != 0)
+ uri = "/" + uri;
+
+ string [] result = new String [chnl_uris.Length];
+
+ for (int i = 0; i < chnl_uris.Length; i++) {
+ result [i] = chnl_uris [i] + uri;
+ }
+
+ return result;
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ int port;
+
+ string host = CORBAChannel.ParseCORBAURL (url, out objectURI, out port);
+
+ return GetChannelUri ();
+ }
+
+ void WaitForConnections ()
+ {
+ while (true) {
+ TcpClient client = listener.AcceptTcpClient ();
+
+ sink.InternalProcessMessage (client.GetStream ());
+
+ client.Close ();
+ }
+ }
+
+ public void StartListening (object data)
+ {
+ if (server_thread == null) {
+ listener.Start ();
+ if (port == 0) {
+ port = ((IPEndPoint)listener.LocalEndpoint).Port;
+ channel_data.ChannelUris = new String [1];
+ channel_data.ChannelUris [0] = GetChannelUri ();
+ }
+
+ server_thread = new Thread (new ThreadStart (WaitForConnections));
+ server_thread.Start ();
+ }
+ }
+
+ public void StopListening (object data)
+ {
+ if (server_thread != null) {
+ server_thread.Abort ();
+ server_thread = null;
+ listener.Stop ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSink.cs
new file mode 100644
index 00000000000..bf30a7a5161
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSink.cs
@@ -0,0 +1,79 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAServerFormatterSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels.CORBA {
+
+ public class CORBAServerFormatterSink : IServerChannelSink, IChannelSinkBase
+ {
+ IServerChannelSink next_sink;
+ CDRFormatter format = new CDRFormatter ();
+
+ public CORBAServerFormatterSink (IServerChannelSink nextSink)
+ {
+ next_sink = nextSink;
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return next_sink;
+ }
+ }
+
+ public IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ // never called
+ throw new NotSupportedException ();
+ }
+
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ IMessage call;
+
+ string uri = (string)requestHeaders ["_requestUri"];
+
+ if (requestMsg == null) {
+ call = (IMessage)format.DeserializeRequest (requestStream, uri);
+ } else {
+ call = requestMsg;
+ }
+
+ next_sink.ProcessMessage (sinkStack, call, requestHeaders, null,
+ out responseMsg, out responseHeaders, out responseStream);
+
+ responseStream = new MemoryStream ();
+
+ format.SerializeResponse (responseStream, responseMsg);
+
+ return ServerProcessing.Complete;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSinkProvider.cs
new file mode 100644
index 00000000000..2ee5e789d4c
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerFormatterSinkProvider.cs
@@ -0,0 +1,60 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAServerFormatterSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ public class CORBAServerFormatterSinkProvider :
+ IServerFormatterSinkProvider, IServerChannelSinkProvider
+ {
+ IServerChannelSinkProvider next = null;
+
+ public CORBAServerFormatterSinkProvider ()
+ {
+ }
+
+ [MonoTODO]
+ public CORBAServerFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IServerChannelSinkProvider Next
+ {
+ get {
+ return next;
+ }
+
+ set {
+ next = value;
+ }
+ }
+
+ public IServerChannelSink CreateSink (IChannelReceiver channel)
+ {
+ IServerChannelSink next_sink = null;
+ CORBAServerFormatterSink result;
+
+ if (next != null)
+ next_sink = next.CreateSink (channel);
+
+ result = new CORBAServerFormatterSink (next_sink);
+
+ // set properties on result
+
+ return result;
+ }
+
+ public void GetChannelData (IChannelDataStore channelData)
+ {
+ // no idea why we need this
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerTransportSink.cs
new file mode 100644
index 00000000000..9e371bb0d9c
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerTransportSink.cs
@@ -0,0 +1,114 @@
+//
+// System.Runtime.Remoting.Channels.CORBA.CORBAServerTransportSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+using System.Net.Sockets;
+using System.Net;
+using System.Threading;
+using System.IO;
+
+namespace System.Runtime.Remoting.Channels.CORBA
+{
+ internal class CORBAServerTransportSink : IServerChannelSink, IChannelSinkBase
+ {
+ IServerChannelSink next_sink;
+
+ public CORBAServerTransportSink (IServerChannelSink next)
+ {
+ next_sink = next;
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return next_sink;
+ }
+ }
+
+ [MonoTODO]
+ public IDictionary Properties {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // this is the first sink, and CORBAServerChannel does not call it.
+ throw new NotSupportedException ();
+ }
+
+ internal void InternalProcessMessage (Stream network_stream)
+ {
+ try {
+ string uri;
+ IIOPMessage.MessageType msg_type;
+ MemoryStream msg_stream;
+
+ msg_stream = IIOPMessage.ReceiveMessageStream (network_stream,
+ out msg_type, out uri);
+ if (msg_type != IIOPMessage.MessageType.Request)
+ throw new RemotingException ("received wrong message type");
+
+ TransportHeaders headers = new TransportHeaders ();
+ headers ["_requestUri"] = uri;
+
+ IMessage resp_message;
+ ITransportHeaders resp_headers;
+ Stream resp_stream;
+ ServerProcessing res = next_sink.ProcessMessage (null, null, headers, msg_stream,
+ out resp_message, out resp_headers,
+ out resp_stream);
+
+ switch (res) {
+ case ServerProcessing.Complete:
+
+ Exception e = ((IMethodReturnMessage)resp_message).Exception;
+ if (e != null) {
+ // we handle exceptions in the transport channel
+ IIOPMessage.SendExceptionMessage (network_stream, e.ToString ());
+ } else {
+ // send the response
+ IIOPMessage.SendMessageStream (network_stream,
+ (MemoryStream)resp_stream,
+ IIOPMessage.MessageType.Response,
+ null);
+ }
+ break;
+ case ServerProcessing.Async:
+ case ServerProcessing.OneWay:
+ throw new NotImplementedException ();
+ }
+
+ } catch (Exception e) {
+ IIOPMessage.SendExceptionMessage (network_stream, e.ToString ());
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/IIOPMessage.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/IIOPMessage.cs
new file mode 100755
index 00000000000..a3a28d6d23d
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/IIOPMessage.cs
@@ -0,0 +1,149 @@
+// System.Runtime.Remoting.Channels.CORBA.IIOPMessage.cs
+//
+// Author:
+// DietmarMaurer (dietmar@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+
+using System.Runtime.Serialization.Formatters;
+using System.Runtime.Serialization;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels.CORBA {
+
+ public sealed class IIOPMessage
+ {
+ public enum MessageType : byte {
+ Request = 0,
+ Response = 1,
+ Exception = 2,
+ Unknown = 3
+ }
+
+ public IIOPMessage ()
+ {
+ }
+
+ public static void SendExceptionMessage (Stream network_stream, string message)
+ {
+ // we use the uri field to encode the message text
+ SendMessageStream (network_stream, null, MessageType.Exception, message);
+ }
+
+ public static void SendMessageStream (Stream network_stream, MemoryStream data,
+ MessageType msg_type, string uri)
+ {
+ int data_len = 0;
+
+ if (data != null)
+ data_len = (int)data.Length;
+
+ int uri_len = 0;
+
+ if (uri != null)
+ uri_len = uri.Length;
+
+ int header_len = 12 + uri_len * 2;
+ int msg_len = data_len + header_len;
+
+ byte [] buffer = new byte [msg_len];
+
+ // magic header signature
+ buffer [0] = 255;
+ buffer [1] = 0;
+ buffer [2] = 255;
+ buffer [3] = (byte) msg_type;
+
+ // data length
+ buffer [4] = (byte) data_len;
+ buffer [5] = (byte) (data_len >> 8);
+ buffer [6] = (byte) (data_len >> 16);
+ buffer [7] = (byte) (data_len >> 24);
+
+ // uri length
+ buffer [8] = (byte) uri_len;
+ buffer [9] = (byte) (uri_len >> 8);
+ buffer [10] = (byte) (uri_len >> 16);
+ buffer [11] = (byte) (uri_len >> 24);
+
+ // uri
+ for (int i = 0; i < uri_len; i++) {
+ buffer [12 + i*2] = (byte) uri [i];
+ buffer [13 + i*2] = (byte) (uri [i] >> 8);
+ }
+
+ if (data_len > 0) {
+ byte [] data_buffer = data.GetBuffer ();
+ for (int i = 0; i < data_len; i++)
+ buffer [i + header_len] = data_buffer [i];
+ }
+
+ network_stream.Write (buffer, 0, msg_len);
+ }
+
+ public static MemoryStream ReceiveMessageStream (Stream network_stream,
+ out MessageType msg_type,
+ out string uri)
+ {
+ int data_len = 0;
+ int uri_len = 0;
+ msg_type = MessageType.Unknown;
+ uri = null;
+
+ // search for message header (255, 0, 255, msg_type, msg_len)
+ while (true) {
+ while (true) {
+ int x = network_stream.ReadByte ();
+ if (x != 255)
+ continue;
+ x = network_stream.ReadByte ();
+ if (x != 0)
+ continue;
+ x = network_stream.ReadByte ();
+ if (x != 255)
+ continue;
+ break;
+ }
+
+ msg_type = (MessageType)network_stream.ReadByte ();
+
+ byte [] buffer = new byte [8];
+
+ int bytes_read = network_stream.Read (buffer, 0, 8);
+ if (bytes_read != 8)
+ continue;
+
+ data_len = (buffer [0] | (buffer [1] << 8) |
+ (buffer [2] << 16) | (buffer [3] << 24));
+
+ uri_len = (buffer [4] | (buffer [5] << 8) |
+ (buffer [6] << 16) | (buffer [7] << 24));
+
+ if (uri_len > 0) {
+ byte [] uri_buffer = new byte [uri_len * 2];
+ bytes_read = network_stream.Read (uri_buffer, 0, uri_len * 2);
+ if (bytes_read != (uri_len * 2))
+ continue;
+ char [] uri_array = new char [uri_len];
+ for (int i = 0; i < uri_len; i++) {
+ uri_array [i] = (char) (uri_buffer [i * 2] | (uri_buffer [(i * 2) + 1] << 8));
+ }
+ uri = new string (uri_array);
+ }
+ break;
+ }
+
+ if (msg_type == MessageType.Exception)
+ throw new RemotingException ("\n" + uri + "\n" + "Rethrown at:\n");
+
+ byte [] stream_buffer = new byte [data_len];
+ if ((network_stream.Read (stream_buffer, 0, data_len)) != data_len)
+ throw new Exception ("packet size error");
+
+ return new MemoryStream (stream_buffer, false);
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/README b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/README
new file mode 100644
index 00000000000..a0aa8f71ea0
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/README
@@ -0,0 +1,5 @@
+Warning: This is more or less a stub for a CORBA channel, its not CORBA
+compatible at all!
+
+We recently detected a runtime GC bug, so maybe you have to turn of GC in the
+runtime to run the examples in Test/* \ No newline at end of file
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/README b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/README
new file mode 100644
index 00000000000..2bc00abfb04
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/README
@@ -0,0 +1,38 @@
+Example Channel Implementation:
+===============================
+
+This Channel is just used as example to show people how to implement remoting
+Channels for mono. I tried to keep it as simple as possible, so it is not
+feature complete.
+
+Data Types:
+===========
+
+The channel wire format supports all basic data type. The formatter does not
+handle exceptions itself, instead it passes them to the transport sink.
+
+Overview
+========
+
+SimpleMessageFormat.cs: Contains routines to read/write messages transfered on
+the network (low level message format)
+
+SimpleWireFormat.cs: This is the data formatter.
+
+SimpleClientChannel.cs: The client side of the channel.
+
+ SimpleClientFormatterSink.cs: client side formatter sink
+ SimpleClientFormatterSinkProvider.cs: and the formatter sink provider
+
+ SimpleClientTransportSink.cs: client side transport sink
+ SimpleClientTransportSinkProvider.cs: and the transport sink provider
+
+SimpleServerChannel.cs: The server side of the channel.
+
+ SimpleServerFormatterSink.cs: server side formatter sink
+ SimpleServerFormatterSinkProvider.cs: and the formatter sink provider
+
+ SimpleServerTransportSink.cs: server side transport sink.
+
+SimpleChannel.cs: combines SimpleClientChannel with SimpleServerChannel.
+
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs
new file mode 100644
index 00000000000..1151048cbe8
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs
@@ -0,0 +1,111 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleChannel : IChannelReceiver, IChannel,
+ IChannelSender
+ {
+ SimpleServerChannel svr_chnl;
+ SimpleClientChannel cnt_chnl;
+
+ string name = "simple";
+
+ public SimpleChannel ()
+ {
+ svr_chnl = new SimpleServerChannel (0);
+ cnt_chnl = new SimpleClientChannel ();
+ }
+
+ public SimpleChannel (int port)
+ {
+ svr_chnl = new SimpleServerChannel (port);
+ cnt_chnl = new SimpleClientChannel ();
+ }
+
+ [MonoTODO]
+ public SimpleChannel (IDictionary properties,
+ IClientChannelSinkProvider clientSinkProvider,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object ChannelData
+ {
+ get {
+ return svr_chnl.ChannelData;
+ }
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return svr_chnl.ChannelPriority;
+ }
+ }
+
+ public IMessageSink CreateMessageSink (string url,
+ object remoteChannelData,
+ out string objectURI)
+ {
+ return cnt_chnl.CreateMessageSink (url, remoteChannelData, out objectURI);
+ }
+
+ public string[] GetUrlsForUri (string objectURI)
+ {
+ return svr_chnl.GetUrlsForUri (objectURI);
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ return svr_chnl.Parse (url, out objectURI);
+ }
+
+ public void StartListening (object data)
+ {
+ svr_chnl.StartListening (data);
+ }
+
+ public void StopListening (object data)
+ {
+ svr_chnl.StopListening (data);
+ }
+
+ internal static string ParseSimpleURL (string url, out string objectURI, out int port)
+ {
+ // format: "simple://host:port/path/to/object"
+
+ objectURI = null;
+ port = 0;
+
+ Match m = Regex.Match (url, "simple://([^:]+):([0-9]+)(/.*)");
+
+ if (!m.Success)
+ return null;
+
+ string host = m.Groups[1].Value;
+ string port_str = m.Groups[2].Value;
+ objectURI = m.Groups[3].Value;
+ port = Convert.ToInt32 (port_str);
+
+ return host;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientChannel.cs
new file mode 100644
index 00000000000..6bdd1ab6058
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientChannel.cs
@@ -0,0 +1,102 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleClientChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleClientChannel : IChannelSender, IChannel
+ {
+ int priority = 1;
+ string name = "simple";
+ IClientChannelSinkProvider sink_provider;
+
+ public SimpleClientChannel ()
+ {
+ sink_provider = new SimpleClientFormatterSinkProvider ();
+ sink_provider.Next = new SimpleClientTransportSinkProvider ();
+ }
+
+ public SimpleClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
+ {
+ priority = 1;
+ sink_provider = sinkProvider;
+
+ // add the tcp provider at the end of the chain
+ IClientChannelSinkProvider prov = sinkProvider;
+ while (prov.Next != null) prov = prov.Next;
+ prov.Next = new SimpleClientTransportSinkProvider ();
+ }
+
+ public SimpleClientChannel (string name, IClientChannelSinkProvider sinkProvider)
+ {
+ priority = 1;
+ this.name = name;
+ sink_provider = sinkProvider;
+
+ // add the tcp provider at the end of the chain
+ IClientChannelSinkProvider prov = sinkProvider;
+ while (prov.Next != null) prov = prov.Next;
+ prov.Next = new SimpleClientTransportSinkProvider ();
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return priority;
+ }
+ }
+
+ public IMessageSink CreateMessageSink (string url,
+ object remoteChannelData,
+ out string objectURI)
+ {
+ objectURI = null;
+
+ if (url != null) {
+ if (Parse (url, out objectURI) != null)
+ return (IMessageSink) sink_provider.CreateSink (this, url,
+ remoteChannelData);
+ }
+
+ if (remoteChannelData != null) {
+ IChannelDataStore ds = remoteChannelData as IChannelDataStore;
+ if (ds != null) {
+ foreach (string chnl_uri in ds.ChannelUris) {
+ if (Parse (chnl_uri, out objectURI) == null)
+ continue;
+ return (IMessageSink) sink_provider.CreateSink (this, chnl_uri,
+ remoteChannelData);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ int port;
+
+ string host = SimpleChannel.ParseSimpleURL (url, out objectURI, out port);
+
+ return "simple://" + host + ":" + port;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSink.cs
new file mode 100644
index 00000000000..7779c11a086
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSink.cs
@@ -0,0 +1,127 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleClientFormatterSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleClientFormatterSink : IClientFormatterSink,
+ IMessageSink, IClientChannelSink, IChannelSinkBase
+ {
+ IClientChannelSink nextInChain;
+ SimpleWireFormat format = new SimpleWireFormat ();
+
+ public SimpleClientFormatterSink (IClientChannelSink nextSink)
+ {
+ nextInChain = nextSink;
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get {
+ return nextInChain;
+ }
+ }
+
+ public IMessageSink NextSink
+ {
+ get {
+ return (IMessageSink) nextInChain;
+ }
+ }
+
+ public IDictionary Properties
+ {
+ get {
+ return null;
+ }
+ }
+
+ public IMessageCtrl AsyncProcessMessage (IMessage msg,
+ IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack,
+ IMessage msg,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ // never called because the formatter sink is
+ // always the first in the chain
+ throw new NotSupportedException ();
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetRequestStream (IMessage msg,
+ ITransportHeaders headers)
+ {
+ // never called
+ throw new NotSupportedException ();
+ }
+
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // never called because the formatter sink is
+ // always the first in the chain
+ throw new NotSupportedException ();
+ }
+
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ IMethodCallMessage call = (IMethodCallMessage)msg;
+
+ // we catch all exceptions to return them as message
+ try {
+ // create a new header
+ TransportHeaders req_headers = new TransportHeaders ();
+ req_headers[CommonTransportKeys.RequestUri] = call.Uri;
+
+ //fixme: set some header values
+
+ Stream out_stream = new MemoryStream ();
+
+ // serialize msg to the stream
+ format.SerializeRequest (out_stream, msg);
+
+ // call the next sink
+ ITransportHeaders resp_headers;
+ Stream resp_stream;
+ nextInChain.ProcessMessage (msg, req_headers, out_stream, out resp_headers,
+ out resp_stream);
+
+ // deserialize resp_stream
+ IMessage result = (IMessage) format.DeserializeResponse (resp_stream, call);
+
+ // it's save to close the stream now
+ resp_stream.Close ();
+
+ return result;
+
+ } catch (Exception e) {
+ return new ReturnMessage (e, call);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSinkProvider.cs
new file mode 100644
index 00000000000..da8541e28bc
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSinkProvider.cs
@@ -0,0 +1,61 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleClientFormatterSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleClientFormatterSinkProvider :
+ IClientFormatterSinkProvider, IClientChannelSinkProvider
+ {
+ IClientChannelSinkProvider next = null;
+
+ // add any sink properties here (private fields)
+
+ public SimpleClientFormatterSinkProvider ()
+ {
+ // nothing to do
+ }
+
+ public SimpleClientFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ // copy the contained properties to private fields
+
+ // add a check that there is no providerData
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get {
+ return next;
+ }
+
+ set {
+ next = value;
+ }
+ }
+
+ public IClientChannelSink CreateSink (IChannelSender channel,
+ string url,
+ object remoteChannelData)
+ {
+ IClientChannelSink next_sink = null;
+ SimpleClientFormatterSink result;
+
+ if (next != null)
+ next_sink = next.CreateSink (channel, url, remoteChannelData);
+
+ result = new SimpleClientFormatterSink (next_sink);
+
+ // set properties on the newly creates sink
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSink.cs
new file mode 100644
index 00000000000..4f5cdee6b8d
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSink.cs
@@ -0,0 +1,106 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleClientTransportSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+
+ internal class SimpleClientTransportSink : IClientChannelSink
+ {
+ string host;
+ string object_uri;
+ int port;
+
+ TcpClient tcpclient;
+ Stream network_stream;
+
+ public SimpleClientTransportSink (string url)
+ {
+ host = SimpleChannel.ParseSimpleURL (url, out object_uri, out port);
+ tcpclient = new TcpClient ();
+ }
+
+ public IDictionary Properties
+ {
+ get {
+ return null;
+ }
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get {
+ // we are the last one
+ return null;
+ }
+ }
+
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack, IMessage msg,
+ ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state, ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetRequestStream (IMessage msg, ITransportHeaders headers)
+ {
+ // no direct access to the stream
+ return null;
+ }
+
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // get a network stream
+ if (network_stream == null) {
+ tcpclient.Connect (host, port);
+ network_stream = tcpclient.GetStream ();
+ }
+
+ // send the message
+ SimpleMessageFormat.SendMessageStream (network_stream, (MemoryStream)requestStream,
+ SimpleMessageFormat.MessageType.Request,
+ object_uri);
+
+ // read the response fro the network an copy it to a memory stream
+ SimpleMessageFormat.MessageType msg_type;
+ string uri;
+ MemoryStream mem_stream = SimpleMessageFormat.ReceiveMessageStream (network_stream, out msg_type, out uri);
+
+ // close the stream
+ //tcpclient.Close ();
+
+ switch (msg_type) {
+ case SimpleMessageFormat.MessageType.Response:
+ //fixme: read response message
+ responseHeaders = null;
+
+ responseStream = mem_stream;
+
+ break;
+ default:
+ throw new Exception ("unknown response mesage header");
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSinkProvider.cs
new file mode 100644
index 00000000000..ead74726f8c
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSinkProvider.cs
@@ -0,0 +1,41 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleClientTransportSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleClientTransportSinkProvider : IClientChannelSinkProvider
+ {
+ public SimpleClientTransportSinkProvider ()
+ {
+ // what should we do here ?
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get {
+ return null;
+ }
+
+ set {
+ // ignore, we are always the last in the chain
+ }
+ }
+
+ public IClientChannelSink CreateSink (IChannelSender channel, string url,
+ object remoteChannelData)
+ {
+ return new SimpleClientTransportSink (url);
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleMessageFormat.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleMessageFormat.cs
new file mode 100755
index 00000000000..c25194fe087
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleMessageFormat.cs
@@ -0,0 +1,149 @@
+// System.Runtime.Remoting.Channels.Simple.SimpleMessageFormat.cs
+//
+// Author:
+// DietmarMaurer (dietmar@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+
+using System.Runtime.Serialization.Formatters;
+using System.Runtime.Serialization;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels.Simple {
+
+ public sealed class SimpleMessageFormat
+ {
+ public enum MessageType : byte {
+ Request = 0,
+ Response = 1,
+ Exception = 2,
+ Unknown = 3
+ }
+
+ public SimpleMessageFormat ()
+ {
+ }
+
+ public static void SendExceptionMessage (Stream network_stream, string message)
+ {
+ // we use the uri field to encode the message text
+ SendMessageStream (network_stream, null, MessageType.Exception, message);
+ }
+
+ public static void SendMessageStream (Stream network_stream, MemoryStream data,
+ MessageType msg_type, string uri)
+ {
+ int data_len = 0;
+
+ if (data != null)
+ data_len = (int)data.Length;
+
+ int uri_len = 0;
+
+ if (uri != null)
+ uri_len = uri.Length;
+
+ int header_len = 12 + uri_len * 2;
+ int msg_len = data_len + header_len;
+
+ byte [] buffer = new byte [msg_len];
+
+ // magic header signature
+ buffer [0] = 255;
+ buffer [1] = 0;
+ buffer [2] = 255;
+ buffer [3] = (byte) msg_type;
+
+ // data length
+ buffer [4] = (byte) data_len;
+ buffer [5] = (byte) (data_len >> 8);
+ buffer [6] = (byte) (data_len >> 16);
+ buffer [7] = (byte) (data_len >> 24);
+
+ // uri length
+ buffer [8] = (byte) uri_len;
+ buffer [9] = (byte) (uri_len >> 8);
+ buffer [10] = (byte) (uri_len >> 16);
+ buffer [11] = (byte) (uri_len >> 24);
+
+ // uri
+ for (int i = 0; i < uri_len; i++) {
+ buffer [12 + i*2] = (byte) uri [i];
+ buffer [13 + i*2] = (byte) (uri [i] >> 8);
+ }
+
+ if (data_len > 0) {
+ byte [] data_buffer = data.GetBuffer ();
+ for (int i = 0; i < data_len; i++)
+ buffer [i + header_len] = data_buffer [i];
+ }
+
+ network_stream.Write (buffer, 0, msg_len);
+ }
+
+ public static MemoryStream ReceiveMessageStream (Stream network_stream,
+ out MessageType msg_type,
+ out string uri)
+ {
+ int data_len = 0;
+ int uri_len = 0;
+ msg_type = MessageType.Unknown;
+ uri = null;
+
+ // search for message header (255, 0, 255, msg_type, msg_len)
+ while (true) {
+ while (true) {
+ int x = network_stream.ReadByte ();
+ if (x != 255)
+ continue;
+ x = network_stream.ReadByte ();
+ if (x != 0)
+ continue;
+ x = network_stream.ReadByte ();
+ if (x != 255)
+ continue;
+ break;
+ }
+
+ msg_type = (MessageType)network_stream.ReadByte ();
+
+ byte [] buffer = new byte [8];
+
+ int bytes_read = network_stream.Read (buffer, 0, 8);
+ if (bytes_read != 8)
+ continue;
+
+ data_len = (buffer [0] | (buffer [1] << 8) |
+ (buffer [2] << 16) | (buffer [3] << 24));
+
+ uri_len = (buffer [4] | (buffer [5] << 8) |
+ (buffer [6] << 16) | (buffer [7] << 24));
+
+ if (uri_len > 0) {
+ byte [] uri_buffer = new byte [uri_len * 2];
+ bytes_read = network_stream.Read (uri_buffer, 0, uri_len * 2);
+ if (bytes_read != (uri_len * 2))
+ continue;
+ char [] uri_array = new char [uri_len];
+ for (int i = 0; i < uri_len; i++) {
+ uri_array [i] = (char) (uri_buffer [i * 2] | (uri_buffer [(i * 2) + 1] << 8));
+ }
+ uri = new string (uri_array);
+ }
+ break;
+ }
+
+ if (msg_type == MessageType.Exception)
+ throw new RemotingException ("\n" + uri + "\n" + "Rethrown at:\n");
+
+ byte [] stream_buffer = new byte [data_len];
+ if ((network_stream.Read (stream_buffer, 0, data_len)) != data_len)
+ throw new Exception ("packet size error");
+
+ return new MemoryStream (stream_buffer, false);
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
new file mode 100644
index 00000000000..d5a6ad4d530
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
@@ -0,0 +1,169 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleServerChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+using System.Net.Sockets;
+using System.Net;
+using System.Threading;
+using System.IO;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleServerChannel : IChannelReceiver, IChannel
+ {
+ int port = 0;
+ string name = "simple";
+ string host;
+ int priority = 1;
+ Thread server_thread = null;
+ TcpListener listener;
+ SimpleServerTransportSink sink;
+ ChannelDataStore channel_data;
+
+ void Init (IServerChannelSinkProvider provider) {
+ if (provider == null) {
+ provider = new SimpleServerFormatterSinkProvider ();
+ }
+
+ IServerChannelSink next_sink = ChannelServices.CreateServerChannelSinkChain (provider, this);
+
+ host = Dns.GetHostByName(Dns.GetHostName()).HostName;
+
+ string [] uris = null;
+
+ if (port != 0) {
+ uris = new String [1];
+ uris [0] = GetChannelUri ();
+ }
+
+ channel_data = new ChannelDataStore (uris);;
+
+ sink = new SimpleServerTransportSink (next_sink);
+
+ listener = new TcpListener (port);
+ StartListening (null);
+ }
+
+ public SimpleServerChannel (int port)
+ {
+ this.port = port;
+ Init (null);
+ }
+
+ public SimpleServerChannel (IDictionary properties,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ port = (int)properties ["port"];
+ Init (serverSinkProvider);
+ }
+
+ public SimpleServerChannel (string name, int port,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ name = name;
+ this.port = port;
+ Init (serverSinkProvider);
+ }
+
+ public SimpleServerChannel (string name, int port)
+ {
+ name = name;
+ this.port = port;
+ Init (null);
+ }
+
+ public object ChannelData
+ {
+ get {
+ return channel_data;
+ }
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return priority;
+ }
+ }
+
+ string GetChannelUri ()
+ {
+ return "simple://" + host + ":" + port;
+ }
+
+ public string[] GetUrlsForUri (string uri)
+ {
+ string [] chnl_uris = channel_data.ChannelUris;
+
+ if (uri.IndexOf ('/') != 0)
+ uri = "/" + uri;
+
+ string [] result = new String [chnl_uris.Length];
+
+ for (int i = 0; i < chnl_uris.Length; i++) {
+ result [i] = chnl_uris [i] + uri;
+ }
+
+ return result;
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ int port;
+
+ string host = SimpleChannel.ParseSimpleURL (url, out objectURI, out port);
+
+ return GetChannelUri ();
+ }
+
+ void WaitForConnections ()
+ {
+ TcpClient client = listener.AcceptTcpClient ();
+ Stream network_stream = client.GetStream ();
+
+ while (true) {
+
+ sink.InternalProcessMessage (network_stream);
+
+ }
+ }
+
+ public void StartListening (object data)
+ {
+ if (server_thread == null) {
+ listener.Start ();
+ if (port == 0) {
+ port = ((IPEndPoint)listener.LocalEndpoint).Port;
+ channel_data.ChannelUris = new String [1];
+ channel_data.ChannelUris [0] = GetChannelUri ();
+ }
+
+ server_thread = new Thread (new ThreadStart (WaitForConnections));
+ server_thread.Start ();
+ }
+ }
+
+ public void StopListening (object data)
+ {
+ if (server_thread != null) {
+ server_thread.Abort ();
+ server_thread = null;
+ listener.Stop ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSink.cs
new file mode 100644
index 00000000000..aaea4fa3d34
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSink.cs
@@ -0,0 +1,79 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleServerFormatterSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels.Simple {
+
+ public class SimpleServerFormatterSink : IServerChannelSink, IChannelSinkBase
+ {
+ IServerChannelSink next_sink;
+ SimpleWireFormat format = new SimpleWireFormat ();
+
+ public SimpleServerFormatterSink (IServerChannelSink nextSink)
+ {
+ next_sink = nextSink;
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return next_sink;
+ }
+ }
+
+ public IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ // never called
+ throw new NotSupportedException ();
+ }
+
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ IMessage call;
+
+ string uri = (string)requestHeaders [CommonTransportKeys.RequestUri];
+
+ if (requestMsg == null) {
+ call = (IMessage)format.DeserializeRequest (requestStream, uri);
+ } else {
+ call = requestMsg;
+ }
+
+ next_sink.ProcessMessage (sinkStack, call, requestHeaders, null,
+ out responseMsg, out responseHeaders, out responseStream);
+
+ responseStream = new MemoryStream ();
+
+ format.SerializeResponse (responseStream, responseMsg);
+
+ return ServerProcessing.Complete;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSinkProvider.cs
new file mode 100644
index 00000000000..2b1bf0bbba9
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSinkProvider.cs
@@ -0,0 +1,60 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleServerFormatterSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ public class SimpleServerFormatterSinkProvider :
+ IServerFormatterSinkProvider, IServerChannelSinkProvider
+ {
+ IServerChannelSinkProvider next = null;
+
+ public SimpleServerFormatterSinkProvider ()
+ {
+ }
+
+ [MonoTODO]
+ public SimpleServerFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IServerChannelSinkProvider Next
+ {
+ get {
+ return next;
+ }
+
+ set {
+ next = value;
+ }
+ }
+
+ public IServerChannelSink CreateSink (IChannelReceiver channel)
+ {
+ IServerChannelSink next_sink = null;
+ SimpleServerFormatterSink result;
+
+ if (next != null)
+ next_sink = next.CreateSink (channel);
+
+ result = new SimpleServerFormatterSink (next_sink);
+
+ // set properties on result
+
+ return result;
+ }
+
+ public void GetChannelData (IChannelDataStore channelData)
+ {
+ // no idea why we need this
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerTransportSink.cs
new file mode 100644
index 00000000000..4e9c86f3acc
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerTransportSink.cs
@@ -0,0 +1,114 @@
+//
+// System.Runtime.Remoting.Channels.Simple.SimpleServerTransportSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+using System.Net.Sockets;
+using System.Net;
+using System.Threading;
+using System.IO;
+
+namespace System.Runtime.Remoting.Channels.Simple
+{
+ internal class SimpleServerTransportSink : IServerChannelSink, IChannelSinkBase
+ {
+ IServerChannelSink next_sink;
+
+ public SimpleServerTransportSink (IServerChannelSink next)
+ {
+ next_sink = next;
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return next_sink;
+ }
+ }
+
+ [MonoTODO]
+ public IDictionary Properties {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // this is the first sink, and SimpleServerChannel does not call it.
+ throw new NotSupportedException ();
+ }
+
+ internal void InternalProcessMessage (Stream network_stream)
+ {
+ try {
+ string uri;
+ SimpleMessageFormat.MessageType msg_type;
+ MemoryStream msg_stream;
+
+ msg_stream = SimpleMessageFormat.ReceiveMessageStream (network_stream,
+ out msg_type, out uri);
+ if (msg_type != SimpleMessageFormat.MessageType.Request)
+ throw new RemotingException ("received wrong message type");
+
+ TransportHeaders headers = new TransportHeaders ();
+ headers ["_requestUri"] = uri;
+
+ IMessage resp_message;
+ ITransportHeaders resp_headers;
+ Stream resp_stream;
+ ServerProcessing res = next_sink.ProcessMessage (null, null, headers, msg_stream,
+ out resp_message, out resp_headers,
+ out resp_stream);
+
+ switch (res) {
+ case ServerProcessing.Complete:
+
+ Exception e = ((IMethodReturnMessage)resp_message).Exception;
+ if (e != null) {
+ // we handle exceptions in the transport channel
+ SimpleMessageFormat.SendExceptionMessage (network_stream, e.ToString ());
+ } else {
+ // send the response
+ SimpleMessageFormat.SendMessageStream (network_stream,
+ (MemoryStream)resp_stream,
+ SimpleMessageFormat.MessageType.Response,
+ null);
+ }
+ break;
+ case ServerProcessing.Async:
+ case ServerProcessing.OneWay:
+ throw new NotImplementedException ();
+ }
+
+ } catch (Exception e) {
+ SimpleMessageFormat.SendExceptionMessage (network_stream, e.ToString ());
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs
new file mode 100755
index 00000000000..33ffc5ad0fe
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs
@@ -0,0 +1,298 @@
+// System.Runtime.Remoting.Channels.Simple.SimpleWireFormat.cs
+//
+// Author:
+// DietmarMaurer (dietmar@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+
+using System.Runtime.Serialization.Formatters;
+using System.Runtime.Serialization;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels.Simple {
+
+ public sealed class SimpleWireFormat
+ {
+ enum TypeId : byte {
+ Boolean,
+ Byte,
+ Char,
+ Decimal,
+ Double,
+ Int16,
+ Int32,
+ Int64,
+ SByte,
+ String,
+ Single,
+ UInt16,
+ UInt32,
+ UInt64,
+ NULL
+ }
+
+ public SimpleWireFormat ()
+ {
+ }
+
+ void SerializeObject (BinaryWriter writer, object obj)
+ {
+ if (obj == null) {
+ writer.Write ((byte)TypeId.NULL);
+ return;
+ }
+
+ Type type = obj.GetType ();
+
+ if (type == typeof (String))
+ {
+ writer.Write ((byte)TypeId.String);
+ writer.Write ((String)obj);
+ return;
+ }
+
+ if (type == typeof (int)) {
+ writer.Write ((byte)TypeId.Int32);
+ writer.Write ((int)obj);
+ return;
+ }
+
+ if (type == typeof (long)) {
+ writer.Write ((byte)TypeId.Int64);
+ writer.Write ((long)obj);
+ return;
+ }
+
+ if (type == typeof (uint)) {
+ writer.Write ((byte)TypeId.UInt32);
+ writer.Write ((uint)obj);
+ return;
+ }
+
+ if (type == typeof (ulong)) {
+ writer.Write ((byte)TypeId.UInt64);
+ writer.Write ((ulong)obj);
+ return;
+ }
+
+ if (type == typeof (bool)) {
+ writer.Write ((byte)TypeId.Boolean);
+ writer.Write ((bool)obj);
+ return;
+ }
+
+ if (type == typeof (byte)) {
+ writer.Write ((byte)TypeId.Byte);
+ writer.Write ((byte)obj);
+ return;
+ }
+
+ if (type == typeof (sbyte)) {
+ writer.Write ((byte)TypeId.SByte);
+ writer.Write ((sbyte)obj);
+ return;
+ }
+
+ if (type == typeof (char)) {
+ writer.Write ((byte)TypeId.Char);
+ writer.Write ((char)obj);
+ return;
+ }
+
+ if (type == typeof (double)) {
+ writer.Write ((byte)TypeId.Double);
+ writer.Write ((double)obj);
+ return;
+ }
+
+ if (type == typeof (Single)) {
+ writer.Write ((byte)TypeId.Single);
+ writer.Write ((Single)obj);
+ return;
+ }
+
+ if (type == typeof (Int16)) {
+ writer.Write ((byte)TypeId.Int16);
+ writer.Write ((Int16)obj);
+ return;
+ }
+
+ if (type == typeof (UInt16)) {
+ writer.Write ((byte)TypeId.UInt16);
+ writer.Write ((UInt16)obj);
+ return;
+ }
+
+ if (type == typeof (Decimal)) {
+ writer.Write ((byte)TypeId.Decimal);
+ writer.Write ((Decimal)obj);
+ return;
+ }
+
+ throw new NotSupportedException ();
+ }
+
+ object DeserializeObject (BinaryReader reader)
+ {
+ TypeId tid = (TypeId)reader.ReadByte ();
+
+ if (tid == TypeId.NULL)
+ return null;
+
+ if (tid == TypeId.String) {
+ return reader.ReadString ();
+ }
+
+ if (tid == TypeId.Int32) {
+ return reader.ReadInt32 ();
+ }
+
+ if (tid == TypeId.Int64) {
+ return reader.ReadInt64 ();
+ }
+
+ if (tid == TypeId.UInt32) {
+ return reader.ReadUInt32 ();
+ }
+
+ if (tid == TypeId.UInt64) {
+ return reader.ReadUInt64 ();
+ }
+
+ if (tid == TypeId.Boolean) {
+ return reader.ReadBoolean ();
+ }
+
+ if (tid == TypeId.Byte) {
+ return reader.ReadByte ();
+ }
+
+ if (tid == TypeId.SByte) {
+ return reader.ReadSByte ();
+ }
+
+ if (tid == TypeId.Char) {
+ return reader.ReadChar ();
+ }
+
+ if (tid == TypeId.Double) {
+ return reader.ReadDouble ();
+ }
+
+ if (tid == TypeId.Single) {
+ return reader.ReadSingle ();
+ }
+
+ if (tid == TypeId.Byte) {
+ return reader.ReadByte ();
+ }
+
+ if (tid == TypeId.Int16) {
+ return reader.ReadInt16 ();
+ }
+
+ if (tid == TypeId.UInt16) {
+ return reader.ReadUInt16 ();
+ }
+
+ if (tid == TypeId.Decimal) {
+ return reader.ReadDecimal ();
+ }
+
+ throw new NotSupportedException ();
+ }
+
+ public IMethodCallMessage DeserializeRequest (Stream serializationStream, string uri)
+ {
+ if (serializationStream == null) {
+ throw new ArgumentNullException ("serializationStream is null");
+ }
+
+ Type svr_type = RemotingServices.GetServerTypeForUri (uri);
+ if (svr_type == null)
+ throw new RemotingException ("no registered server for uri " + uri);
+
+ BinaryReader reader = new BinaryReader (serializationStream);
+
+ string method_name = reader.ReadString ();
+ int arg_count = reader.ReadInt32 ();
+
+ object [] args = new object [arg_count];
+ for (int i = 0; i < arg_count; i++) {
+ args [i] = DeserializeObject (reader);
+ }
+
+ MonoMethodMessage msg = new MonoMethodMessage (svr_type, method_name, args);
+ msg.Uri = uri;
+
+ return msg;
+ }
+
+ public IMethodReturnMessage DeserializeResponse (Stream serializationStream,
+ IMethodCallMessage request)
+ {
+
+ BinaryReader reader = new BinaryReader (serializationStream);
+
+ object return_value = DeserializeObject (reader);
+
+ int arg_count = reader.ReadInt32 ();
+ object [] out_args = new object [arg_count];
+ for (int i = 0; i < arg_count; i++)
+ out_args [i] = DeserializeObject (reader);
+
+ return new ReturnMessage (return_value, out_args, arg_count, null, request);
+ }
+
+ public void SerializeRequest (Stream serializationStream, object graph)
+ {
+ if (serializationStream == null) {
+ throw new ArgumentNullException ("serializationStream is null");
+ }
+
+ BinaryWriter writer = new BinaryWriter (serializationStream);
+
+ IMethodCallMessage msg = graph as IMethodCallMessage;
+ if (msg != null) {
+ writer.Write (msg.MethodName);
+ writer.Write ((int)msg.InArgCount);
+ for (int i = 0; i < msg.InArgCount; i++)
+ SerializeObject (writer, msg.GetInArg (i));
+ return;
+ }
+
+ throw new NotSupportedException ();
+ }
+
+ public void SerializeResponse (Stream serializationStream, object graph)
+ {
+ if (serializationStream == null) {
+ throw new ArgumentNullException ("serializationStream is null");
+ }
+
+ BinaryWriter writer = new BinaryWriter (serializationStream);
+
+ IMethodReturnMessage res = graph as IMethodReturnMessage;
+ if (res != null) {
+
+ // this channel does not support serialization of exception,
+ // so we simply let the transport decide what to do
+ if (res.Exception != null)
+ return;
+
+ SerializeObject (writer, res.ReturnValue);
+ writer.Write (res.OutArgCount);
+
+ for (int i = 0; i < res.OutArgCount; i++)
+ SerializeObject (writer, res.GetOutArg (i));
+
+ return;
+ }
+
+ throw new NotSupportedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs
new file mode 100644
index 00000000000..1b169d51250
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs
@@ -0,0 +1,130 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpChannel.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ public class TcpChannel : IChannelReceiver, IChannel, IChannelSender
+ {
+ private TcpClientChannel _clientChannel;
+ private TcpServerChannel _serverChannel = null;
+ private string _name;
+
+ public TcpChannel (): this (0)
+ {
+ }
+
+ public TcpChannel (int port)
+ {
+ Hashtable ht = new Hashtable();
+ ht["port"] = port.ToString();
+ Init(ht, null, null);
+ }
+
+ public void Init(IDictionary properties, IClientChannelSinkProvider clientSink, IServerChannelSinkProvider serverSink)
+ {
+ _clientChannel = new TcpClientChannel(properties,clientSink);
+
+ string port = properties["port"] as string;
+ if (port != null && port != string.Empty)
+ {
+ _serverChannel = new TcpServerChannel(properties, serverSink);
+ }
+
+ _name = properties["name"] as string;
+ }
+
+
+ public TcpChannel (IDictionary properties,
+ IClientChannelSinkProvider clientSinkProvider,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ Init (properties, clientSinkProvider, serverSinkProvider);
+ }
+
+ public IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI)
+ {
+ return _clientChannel.CreateMessageSink(url, remoteChannelData, out objectURI);
+ }
+
+ public string ChannelName
+ {
+ get { return _name; }
+ }
+
+ public int ChannelPriority
+ {
+ get { return 1; }
+ }
+
+ public void StartListening (object data)
+ {
+ if (_serverChannel != null) _serverChannel.StartListening(data);
+ }
+
+ public void StopListening (object data)
+ {
+ if (_serverChannel != null) _serverChannel.StopListening(data);
+ }
+
+ public string[] GetUrlsForUri (string uri)
+ {
+ if (_serverChannel != null) return _serverChannel.GetUrlsForUri(uri);
+ else return null;
+ }
+
+ public object ChannelData
+ {
+ get
+ {
+ if (_serverChannel != null) return _serverChannel.ChannelData;
+ else return null;
+ }
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ return TcpChannel.ParseChannelUrl (url, out objectURI);
+ }
+
+ internal static string ParseChannelUrl (string url, out string objectURI)
+ {
+ int port;
+
+ string host = ParseTcpURL (url, out objectURI, out port);
+ if (host != null)
+ return "tcp://" + host + ":" + port;
+ else
+ return null;
+ }
+
+ internal static string ParseTcpURL (string url, out string objectURI, out int port)
+ {
+ // format: "tcp://host:port/path/to/object"
+
+ objectURI = null;
+ port = 0;
+
+ Match m = Regex.Match (url, "tcp://([^:]+):([0-9]+)[/](.*)");
+
+ if (!m.Success)
+ return null;
+
+ string host = m.Groups[1].Value;
+ string port_str = m.Groups[2].Value;
+ objectURI = m.Groups[3].Value;
+ port = Convert.ToInt32 (port_str);
+
+ return host;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs
new file mode 100644
index 00000000000..7e78a9d95dd
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs
@@ -0,0 +1,102 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpClientChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Simple;
+using System.Threading;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ public class TcpClientChannel : IChannelSender, IChannel
+ {
+ int priority = 1;
+ string name = "tcp";
+ IClientChannelSinkProvider _sinkProvider;
+
+ public TcpClientChannel ()
+ {
+ }
+
+ public TcpClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
+ {
+ priority = 1;
+
+ if (_sinkProvider != null)
+ {
+ _sinkProvider = sinkProvider;
+
+ // add the tcp provider at the end of the chain
+ IClientChannelSinkProvider prov = sinkProvider;
+ while (prov.Next != null) prov = prov.Next;
+ prov.Next = new TcpClientTransportSinkProvider ();
+
+ // Note: a default formatter is added only when
+ // no sink providers are specified in the config file.
+ }
+ else
+ {
+ // FIXME: change soap to binary
+ _sinkProvider = new SimpleClientFormatterSinkProvider ();
+ _sinkProvider.Next = new TcpClientTransportSinkProvider ();
+ }
+
+ }
+
+ public TcpClientChannel (string name, IClientChannelSinkProvider sinkProvider)
+ {
+ priority = 1;
+ this.name = name;
+ _sinkProvider = sinkProvider;
+
+ // add the tcp provider at the end of the chain
+ IClientChannelSinkProvider prov = sinkProvider;
+ while (prov.Next != null) prov = prov.Next;
+ prov.Next = new TcpClientTransportSinkProvider ();
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return priority;
+ }
+ }
+
+ public IMessageSink CreateMessageSink (string url,
+ object remoteChannelData,
+ out string objectURI)
+ {
+ if (url == null && remoteChannelData != null) {
+ IChannelDataStore ds = remoteChannelData as IChannelDataStore;
+ if (ds != null)
+ url = ds.ChannelUris [0];
+ }
+
+ if (Parse (url, out objectURI) == null)
+ return null;
+
+ return (IMessageSink) _sinkProvider.CreateSink (this, url, remoteChannelData);
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ return TcpChannel.ParseChannelUrl (url, out objectURI);
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs
new file mode 100644
index 00000000000..ad26ec4371f
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs
@@ -0,0 +1,152 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Messaging;
+using System.Collections;
+using System.IO;
+using System.Threading;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ public class TcpClientTransportSink : IClientChannelSink
+ {
+ string _host;
+ string _objectUri;
+ int _port;
+
+ public TcpClientTransportSink (string url)
+ {
+ _host = TcpChannel.ParseTcpURL (url, out _objectUri, out _port);
+ }
+
+ public IDictionary Properties
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get
+ {
+ // we are the last one
+ return null;
+ }
+ }
+
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack, IMessage msg,
+ ITransportHeaders headers, Stream requestStream)
+ {
+ TcpConnection connection = null;
+ try
+ {
+ // Sends the stream using a connection from the pool
+ // and creates a WorkItem that will wait for the
+ // response of the server
+
+ connection = TcpConnectionPool.GetConnection (_host, _port);
+ TcpMessageIO.SendMessageStream (connection.Stream, requestStream, headers, connection.Buffer);
+ sinkStack.Push (this, connection);
+ ThreadPool.QueueUserWorkItem (new WaitCallback(ReadAsyncTcpMessage), sinkStack);
+ }
+ catch
+ {
+ if (connection != null) connection.Release();
+ throw;
+ }
+ }
+
+ private void ReadAsyncTcpMessage(object data)
+ {
+ // This method is called by a new thread to asynchronously
+ // read the response to a request
+
+ // The stack was provided as state data in QueueUserWorkItem
+ IClientChannelSinkStack stack = (IClientChannelSinkStack)data;
+
+ // The first sink in the stack is this sink. Pop it and
+ // get the status data, which is the TcpConnection used to send
+ // the request
+ TcpConnection connection = (TcpConnection)stack.Pop(this);
+
+ try
+ {
+ ITransportHeaders responseHeaders;
+
+ // Read the response, blocking if necessary
+ MessageType type = TcpMessageIO.ReceiveMessageType (connection.Stream);
+
+ if (type != MessageType.MethodMessage)
+ throw new RemotingException ("Unknown response message from server");
+
+ Stream responseStream = TcpMessageIO.ReceiveMessageStream (connection.Stream, out responseHeaders, connection.Buffer);
+
+ // Free the connection, so it can be reused
+ connection.Release();
+ connection = null;
+
+ // Ok, proceed with the other sinks
+ stack.AsyncProcessResponse (responseHeaders, responseStream);
+ }
+ catch
+ {
+ if (connection != null) connection.Release();
+ throw;
+ }
+ }
+
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state, ITransportHeaders headers,
+ Stream stream)
+ {
+ // Should never be called
+ throw new NotSupportedException();
+ }
+
+ public Stream GetRequestStream (IMessage msg, ITransportHeaders headers)
+ {
+ return null;
+ }
+
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ TcpConnection connection = null;
+ try
+ {
+ // Sends the message
+ connection = TcpConnectionPool.GetConnection (_host, _port);
+ TcpMessageIO.SendMessageStream (connection.Stream, requestStream, requestHeaders, connection.Buffer);
+
+ // Reads the response
+ MessageType type = TcpMessageIO.ReceiveMessageType (connection.Stream);
+
+ if (type != MessageType.MethodMessage)
+ throw new RemotingException ("Unknown response message from server");
+
+ responseStream = TcpMessageIO.ReceiveMessageStream (connection.Stream, out responseHeaders, connection.Buffer);
+ }
+ finally
+ {
+ if (connection != null)
+ connection.Release();
+ }
+ }
+
+ }
+
+
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSinkProvider.cs
new file mode 100644
index 00000000000..bacdfd5576a
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSinkProvider.cs
@@ -0,0 +1,41 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ public class TcpClientTransportSinkProvider : IClientChannelSinkProvider
+ {
+ public TcpClientTransportSinkProvider ()
+ {
+ // what should we do here ?
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get
+ {
+ return null;
+ }
+
+ set
+ {
+ // ignore, we are always the last in the chain
+ }
+ }
+
+ public IClientChannelSink CreateSink (IChannelSender channel, string url,
+ object remoteChannelData)
+ {
+ return new TcpClientTransportSink (url);
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs
new file mode 100644
index 00000000000..26a567dbcfb
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs
@@ -0,0 +1,246 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpConnectionPool.cs
+//
+// Author: Lluis Sanchez (lsg@ctv.es)
+//
+// 2002 (C) Lluis Sanchez Gual
+//
+
+using System;
+using System.Collections;
+using System.Threading;
+using System.IO;
+using System.Net.Sockets;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ // This is a pool of Tcp connections. Connections requested
+ // by the TCP channel are pooled after their use, and can
+ // be reused later. Connections are automaticaly closed
+ // if not used after some time, specified in KeepAliveSeconds.
+ // The number of allowed open connections can also be specified
+ // in MaxOpenConnections. The limit is per host.
+ // If a thread requests a connection and the limit has been
+ // reached, the thread is suspended until one is released.
+
+ internal class TcpConnectionPool
+ {
+ // Table of pools. There is a HostConnectionPool
+ // instance for each host
+ static Hashtable _pools = new Hashtable();
+
+ static int _maxOpenConnections = 2;
+ static int _keepAliveSeconds = 15;
+
+ static TcpConnectionPool()
+ {
+ // This thread will close unused connections
+ Thread t = new Thread (new ThreadStart (ConnectionCollector));
+ t.Start();
+ t.IsBackground = true;
+ }
+
+ public static int MaxOpenConnections
+ {
+ get { return _maxOpenConnections; }
+ set
+ {
+ if (value < 1) throw new RemotingException ("MaxOpenConnections must be greater than zero");
+ _maxOpenConnections = value;
+ }
+ }
+
+ public static int KeepAliveSeconds
+ {
+ get { return _keepAliveSeconds; }
+ set { _keepAliveSeconds = value; }
+ }
+
+ public static TcpConnection GetConnection (string host, int port)
+ {
+ HostConnectionPool hostPool;
+
+ lock (_pools)
+ {
+ string key = host + ":" + port;
+ hostPool = (HostConnectionPool) _pools[key];
+ if (hostPool == null)
+ {
+ hostPool = new HostConnectionPool(host, port);
+ _pools[key] = hostPool;
+ }
+ }
+
+ return hostPool.GetConnection();
+ }
+
+ private static void ConnectionCollector ()
+ {
+ while (true)
+ {
+ Thread.Sleep(3000);
+ lock (_pools)
+ {
+ ICollection values = _pools.Values;
+ foreach (HostConnectionPool pool in values)
+ pool.PurgeConnections();
+ }
+ }
+ }
+ }
+
+ internal class TcpConnection
+ {
+ DateTime _controlTime;
+ Stream _stream;
+ TcpClient _client;
+ HostConnectionPool _pool;
+ byte[] _buffer;
+
+ public TcpConnection (HostConnectionPool pool, TcpClient client)
+ {
+ _pool = pool;
+ _client = client;
+ _stream = client.GetStream();
+ _controlTime = DateTime.Now;
+ _buffer = new byte[TcpMessageIO.DefaultStreamBufferSize];
+ }
+
+ public Stream Stream
+ {
+ get { return _stream; }
+ }
+
+ public DateTime ControlTime
+ {
+ get { return _controlTime; }
+ set { _controlTime = value; }
+ }
+
+ // This is a "thread safe" buffer that can be used by
+ // TcpClientTransportSink to read or send data to the stream.
+ // The buffer is "thread safe" since only one thread can
+ // use a connection at a given time.
+ public byte[] Buffer
+ {
+ get { return _buffer; }
+ }
+
+ // Returns the connection to the pool
+ public void Release()
+ {
+ _pool.ReleaseConnection (this);
+ }
+
+ public void Close()
+ {
+ _client.Close();
+ }
+ }
+
+ internal class HostConnectionPool
+ {
+ ArrayList _pool = new ArrayList();
+ int _activeConnections = 0;
+
+ string _host;
+ int _port;
+
+ public HostConnectionPool (string host, int port)
+ {
+ _host = host;
+ _port = port;
+ }
+
+ public TcpConnection GetConnection ()
+ {
+ lock (_pool)
+ {
+ TcpConnection connection = null;
+
+ do
+ {
+ if (_pool.Count > 0)
+ {
+ // There are available connections
+ connection = (TcpConnection)_pool[_pool.Count - 1];
+ _pool.RemoveAt(_pool.Count - 1);
+ }
+
+ if (connection == null && _activeConnections < TcpConnectionPool.MaxOpenConnections)
+ {
+ // No connections available, but the max connections
+ // has not been reached yet, so a new one can be created
+ connection = CreateConnection();
+ }
+
+ // No available connections in the pool
+ // Wait for somewone to release one.
+
+ if (connection == null)
+ Monitor.Wait(_pool);
+ }
+ while (connection == null);
+
+ return connection;
+ }
+ }
+
+ private TcpConnection CreateConnection()
+ {
+ try
+ {
+ TcpClient client = new TcpClient(_host, _port);
+ TcpConnection entry = new TcpConnection(this, client);
+ _activeConnections++;
+ return entry;
+ }
+ catch (Exception ex)
+ {
+ throw new RemotingException (ex.Message);
+ }
+ }
+
+ public void ReleaseConnection (TcpConnection entry)
+ {
+ lock (_pool)
+ {
+ entry.ControlTime = DateTime.Now; // Initialize timeout
+ _pool.Add (entry);
+ Monitor.Pulse (_pool);
+ }
+ }
+
+ private void CancelConnection(TcpConnection entry)
+ {
+ try
+ {
+ entry.Stream.Close();
+ _activeConnections--;
+ }
+ catch
+ {
+ }
+ }
+
+ public void PurgeConnections()
+ {
+ lock (_pool)
+ {
+ for (int n=0; n < _pool.Count; n++)
+ {
+ TcpConnection entry = (TcpConnection)_pool[n];
+ if ( (DateTime.Now - entry.ControlTime).TotalSeconds > TcpConnectionPool.KeepAliveSeconds)
+ {
+ CancelConnection (entry);
+ _pool.RemoveAt(n);
+ n--;
+ }
+ }
+ }
+ }
+
+ }
+
+
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs
new file mode 100644
index 00000000000..c167f7e2f40
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs
@@ -0,0 +1,205 @@
+// System.Runtime.Remoting.Channels.Tcp.TcpMessageIO.cs
+//
+// Author: Lluis Sanchez (lsg@ctv.es)
+//
+// (C) 2002 Lluis Sanchez Gual
+
+using System.Runtime.Serialization;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Net.Sockets;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ enum MessageType { MethodMessage = 0, CancelSignal = 1, Unknown = 10}
+
+ internal class TcpMessageIO
+ {
+ static byte[][] _msgHeaders =
+ {
+ new byte[] { (byte)'.', (byte)'N', (byte)'E', (byte)'T', 0 },
+ new byte[] { 255, 255, 255, 255, 255 }
+ };
+
+ public static int DefaultStreamBufferSize = 1000;
+
+ // Identifies an incoming message
+ public static MessageType ReceiveMessageType (Stream networkStream)
+ {
+ try
+ {
+ bool[] isOnTrack = new bool[_msgHeaders.Length];
+ bool atLeastOneOnTrack = true;
+ int i = 0;
+
+ while (atLeastOneOnTrack)
+ {
+ atLeastOneOnTrack = false;
+ byte c = (byte)networkStream.ReadByte();
+ for (int n = 0; n<_msgHeaders.Length; n++)
+ {
+ if (i > 0 && !isOnTrack[n]) continue;
+
+ isOnTrack[n] = (c == _msgHeaders[n][i]);
+ if (isOnTrack[n] && (i == _msgHeaders[n].Length-1)) return (MessageType)n;
+ atLeastOneOnTrack = atLeastOneOnTrack || isOnTrack[n];
+ }
+ i++;
+ }
+ return MessageType.Unknown;
+ }
+ catch (IOException ex)
+ {
+ // Stream closed
+ return MessageType.CancelSignal;
+ }
+ }
+
+ public static void SendMessageStream (Stream networkStream, Stream data, ITransportHeaders requestHeaders, byte[] buffer)
+ {
+ if (buffer == null) buffer = new byte[DefaultStreamBufferSize];
+
+ // Writes the message start header
+ byte[] dotnetHeader = _msgHeaders[(int)MessageType.MethodMessage];
+ networkStream.Write(dotnetHeader, 0, dotnetHeader.Length);
+
+ // Writes the length of the stream being sent (not including the headers)
+ int num = (int)data.Length;
+ buffer [0] = (byte) num;
+ buffer [1] = (byte) (num >> 8);
+ buffer [2] = (byte) (num >> 16);
+ buffer [3] = (byte) (num >> 24);
+ networkStream.Write(buffer, 0, 4);
+
+ // Writes the message headers
+ SendHeaders (networkStream, requestHeaders, buffer);
+
+ // Writes the stream
+ if (data is MemoryStream)
+ {
+ // The copy of the stream can be optimized. The internal
+ // buffer of MemoryStream can be used.
+ MemoryStream memStream = (MemoryStream)data;
+ networkStream.Write (memStream.GetBuffer(), 0, (int)memStream.Length);
+ }
+ else
+ {
+ int nread = data.Read (buffer, 0, buffer.Length);
+ while (nread > 0)
+ {
+ networkStream.Write (buffer, 0, nread);
+ nread = data.Read (buffer, 0, buffer.Length);
+ }
+ }
+ }
+
+ private static void SendHeaders(Stream networkStream, ITransportHeaders requestHeaders, byte[] buffer)
+ {
+ if (requestHeaders == null)
+ SendString (networkStream, "", buffer);
+ else
+ {
+ // Writes the headers as a sequence of strings
+ IEnumerator e = requestHeaders.GetEnumerator();
+ while (e.MoveNext())
+ {
+ DictionaryEntry hdr = (DictionaryEntry)e.Current;
+ SendString (networkStream, hdr.Key.ToString(), buffer);
+ SendString (networkStream, hdr.Value.ToString(), buffer);
+ }
+ SendString (networkStream, "", buffer);
+ }
+ }
+
+ public static ITransportHeaders ReceiveHeaders (Stream networkStream, byte[] buffer)
+ {
+ TransportHeaders headers = new TransportHeaders();
+
+ string key = ReceiveString (networkStream, buffer);
+ while (key != string.Empty)
+ {
+ headers[key] = ReceiveString (networkStream, buffer);
+ key = ReceiveString (networkStream, buffer);
+ }
+ return headers;
+ }
+
+ public static Stream ReceiveMessageStream (Stream networkStream, out ITransportHeaders headers, byte[] buffer)
+ {
+ if (buffer == null) buffer = new byte[DefaultStreamBufferSize];
+
+ // Gets the length of the data stream
+ int nr = 0;
+ while (nr < 4)
+ nr += networkStream.Read (buffer, nr, 4 - nr);
+
+ int byteCount = (buffer [0] | (buffer [1] << 8) |
+ (buffer [2] << 16) | (buffer [3] << 24));
+
+ // Reads the headers
+
+ headers = ReceiveHeaders (networkStream, buffer);
+
+ byte[] resultBuffer = new byte[byteCount];
+
+ nr = 0;
+ while (nr < byteCount)
+ nr += networkStream.Read (resultBuffer, nr, byteCount - nr);
+
+ return new MemoryStream(resultBuffer);
+ }
+
+ private static void SendString (Stream networkStream, string str, byte[] buffer)
+ {
+ // Allocates a buffer. Use the internal buffer if it is
+ // big enough. If not, create a new one.
+
+ int maxBytes = Encoding.UTF8.GetMaxByteCount(str.Length)+4; //+4 bytes for storing the string length
+ if (maxBytes > buffer.Length)
+ buffer = new byte[maxBytes];
+
+ int num = Encoding.UTF8.GetBytes (str, 0, str.Length, buffer, 4);
+
+ // store number of bytes (not number of chars!)
+
+ buffer [0] = (byte) num;
+ buffer [1] = (byte) (num >> 8);
+ buffer [2] = (byte) (num >> 16);
+ buffer [3] = (byte) (num >> 24);
+
+ // Write the string bytes
+ networkStream.Write (buffer, 0, num + 4);
+ }
+
+ private static string ReceiveString (Stream networkStream, byte[] buffer)
+ {
+ int nr = 0;
+ while (nr < 4)
+ nr += networkStream.Read (buffer, nr, 4 - nr);
+
+ // Reads the number of bytes (not chars!)
+
+ int byteCount = (buffer [0] | (buffer [1] << 8) |
+ (buffer [2] << 16) | (buffer [3] << 24));
+
+ if (byteCount == 0) return string.Empty;
+
+ // Allocates a buffer of the correct size. Use the
+ // internal buffer if it is big enough
+
+ if (byteCount > buffer.Length)
+ buffer = new byte[byteCount];
+
+ // Reads the string
+
+ nr = 0;
+ while (nr < byteCount)
+ nr += networkStream.Read (buffer, nr, byteCount - nr);
+
+ char[] chars = Encoding.UTF8.GetChars(buffer, 0, byteCount);
+ return new string(chars);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs
new file mode 100644
index 00000000000..7b491bdf3ec
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs
@@ -0,0 +1,224 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Text.RegularExpressions;
+using System.Net.Sockets;
+using System.Net;
+using System.Threading;
+using System.IO;
+using System.Runtime.Remoting.Channels.Simple;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ public class TcpServerChannel : IChannelReceiver, IChannel
+ {
+ int port = 0;
+ string name = "tcp";
+ string host;
+ int priority = 1;
+ Thread server_thread = null;
+ TcpListener listener;
+ TcpServerTransportSink sink;
+ ChannelDataStore channel_data;
+
+ void Init (IServerChannelSinkProvider serverSinkProvider)
+ {
+ if (serverSinkProvider == null) {
+ // FIXME: change soap for binary
+ serverSinkProvider = new SimpleServerFormatterSinkProvider ();
+ }
+
+ host = Dns.GetHostByName(Dns.GetHostName()).HostName;
+
+ string [] uris = null;
+
+ if (port != 0) {
+ uris = new String [1];
+ uris [0] = GetChannelUri ();
+ }
+
+ // Gets channel data from the chain of channel providers
+
+ channel_data = new ChannelDataStore (uris);
+ IServerChannelSinkProvider provider = serverSinkProvider;
+ while (provider != null)
+ {
+ provider.GetChannelData(channel_data);
+ provider = provider.Next;
+ }
+
+ // Creates the sink chain that will process all incoming messages
+
+ IServerChannelSink next_sink = ChannelServices.CreateServerChannelSinkChain (serverSinkProvider, this);
+ sink = new TcpServerTransportSink (next_sink);
+
+ listener = new TcpListener (port);
+ StartListening (null);
+ }
+
+ public TcpServerChannel (int port)
+ {
+ this.port = port;
+ Init (null);
+ }
+
+ public TcpServerChannel (IDictionary properties,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ port = Int32.Parse ((string)properties ["port"]);
+ Init (serverSinkProvider);
+ }
+
+ public TcpServerChannel (string name, int port,
+ IServerChannelSinkProvider serverSinkProvider)
+ {
+ this.name = name;
+ this.port = port;
+ Init (serverSinkProvider);
+ }
+
+ public TcpServerChannel (string name, int port)
+ {
+ this.name = name;
+ this.port = port;
+ Init (null);
+ }
+
+ public object ChannelData
+ {
+ get {
+ return channel_data;
+ }
+ }
+
+ public string ChannelName
+ {
+ get {
+ return name;
+ }
+ }
+
+ public int ChannelPriority
+ {
+ get {
+ return priority;
+ }
+ }
+
+ public string GetChannelUri ()
+ {
+ return "tcp://" + host + ":" + port;
+ }
+
+ public string[] GetUrlsForUri (string uri)
+ {
+ if (!uri.StartsWith ("/")) uri = "/" + uri;
+
+ string [] chnl_uris = channel_data.ChannelUris;
+ string [] result = new String [chnl_uris.Length];
+
+ for (int i = 0; i < chnl_uris.Length; i++)
+ result [i] = chnl_uris [i] + uri;
+
+ return result;
+ }
+
+ public string Parse (string url, out string objectURI)
+ {
+ return TcpChannel.ParseChannelUrl (url, out objectURI);
+ }
+
+ void WaitForConnections ()
+ {
+ while (true)
+ {
+ TcpClient client = listener.AcceptTcpClient ();
+
+ ClientConnection reader = new ClientConnection (client, sink);
+ ThreadPool.QueueUserWorkItem ( new WaitCallback( reader.ProcessMessages));
+ }
+ }
+
+ public void StartListening (object data)
+ {
+ if (server_thread == null) {
+ listener.Start ();
+ if (port == 0) {
+ port = ((IPEndPoint)listener.LocalEndpoint).Port;
+ channel_data.ChannelUris = new String [1];
+ channel_data.ChannelUris [0] = GetChannelUri ();
+ }
+
+ server_thread = new Thread (new ThreadStart (WaitForConnections));
+ server_thread.IsBackground = true;
+ server_thread.Start ();
+ }
+ }
+
+ public void StopListening (object data)
+ {
+ if (server_thread != null) {
+ server_thread.Abort ();
+ server_thread = null;
+ listener.Stop ();
+ }
+ }
+ }
+
+ class ClientConnection
+ {
+ TcpClient _client;
+ TcpServerTransportSink _sink;
+ Stream _stream;
+
+ byte[] _buffer = new byte[TcpMessageIO.DefaultStreamBufferSize];
+
+ public ClientConnection (TcpClient client, TcpServerTransportSink sink)
+ {
+ _client = client;
+ _sink = sink;
+ }
+
+ public Stream Stream
+ {
+ get { return _stream; }
+ }
+
+ public byte[] Buffer
+ {
+ get { return _buffer; }
+ }
+
+ public void ProcessMessages(object data)
+ {
+ _stream = _client.GetStream();
+
+ bool end = false;
+ while (!end)
+ {
+ MessageType type = TcpMessageIO.ReceiveMessageType (_stream);
+
+ switch (type)
+ {
+ case MessageType.MethodMessage:
+ _sink.InternalProcessMessage (this);
+ break;
+
+ case MessageType.CancelSignal:
+ end = true;
+ break;
+ }
+ }
+
+ _stream.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerTransportSink.cs
new file mode 100644
index 00000000000..409ecc81a71
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerTransportSink.cs
@@ -0,0 +1,102 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpServerTransportSink.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.IO;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+ public class TcpServerTransportSink : IServerChannelSink, IChannelSinkBase
+ {
+ IServerChannelSink next_sink;
+
+ public TcpServerTransportSink (IServerChannelSink next)
+ {
+ next_sink = next;
+ }
+
+ public IServerChannelSink NextChannelSink
+ {
+ get
+ {
+ return next_sink;
+ }
+ }
+
+ public IDictionary Properties
+ {
+ get
+ {
+ if (next_sink != null) return next_sink.Properties;
+ else return null;
+ }
+ }
+
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream responseStream)
+ {
+ ClientConnection connection = (ClientConnection)state;
+ TcpMessageIO.SendMessageStream (connection.Stream, responseStream, headers, connection.Buffer);
+ }
+
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ return null;
+ }
+
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // this is the first sink, and TcpServerChannel does not call it.
+ throw new NotSupportedException ();
+ }
+
+ internal void InternalProcessMessage (ClientConnection connection)
+ {
+ // Reads the headers and the request stream
+
+ Stream requestStream;
+ ITransportHeaders requestHeaders;
+
+ requestStream = TcpMessageIO.ReceiveMessageStream (connection.Stream, out requestHeaders, connection.Buffer);
+
+ // Pushes the connection object together with the sink. This information
+ // will be used for sending the response in an async call.
+
+ ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();
+ sinkStack.Push(this, connection);
+
+ ITransportHeaders responseHeaders;
+ Stream responseStream;
+ IMessage responseMsg;
+
+ ServerProcessing proc = next_sink.ProcessMessage(sinkStack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream);
+
+ switch (proc)
+ {
+ case ServerProcessing.Complete:
+ TcpMessageIO.SendMessageStream (connection.Stream, responseStream, responseHeaders, connection.Buffer);
+ break;
+
+ case ServerProcessing.Async:
+ case ServerProcessing.OneWay:
+ break;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSink.cs
new file mode 100644
index 00000000000..54048a0ce47
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSink.cs
@@ -0,0 +1,124 @@
+//
+// System.Runtime.Remoting.Channels.BinaryClientFormatterSink.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class BinaryClientFormatterSink : IClientFormatterSink,
+ IMessageSink, IClientChannelSink, IChannelSinkBase
+ {
+ IClientChannelSink nextInChain;
+ IRemotingFormatter formatter = new BinaryFormatter ();
+
+ public BinaryClientFormatterSink (IClientChannelSink nextSink)
+ {
+ nextInChain = nextSink;
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get {
+ return nextInChain;
+ }
+ }
+
+ public IMessageSink NextSink
+ {
+ get {
+ return (IMessageSink) nextInChain;
+ }
+ }
+
+ public IDictionary Properties
+ {
+ get {
+ return null;
+ }
+ }
+
+ public IMessageCtrl AsyncProcessMessage (IMessage msg,
+ IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack,
+ IMessage msg,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ // never called because the formatter sink is
+ // always the first in the chain
+ throw new NotSupportedException ();
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetRequestStream (IMessage msg,
+ ITransportHeaders headers)
+ {
+ // never called
+ throw new NotSupportedException ();
+ }
+
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ // never called because the formatter sink is
+ // always the first in the chain
+ throw new NotSupportedException ();
+ }
+
+ [MonoTODO]
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ try {
+
+ ITransportHeaders response_headers;
+ Stream response_stream;
+
+ // fixme: use nextInChain.GetRequestStream() ??
+ Stream out_stream = new MemoryStream ();
+ //Stream out_stream = File.Open ("test.bin", FileMode.Create);
+
+ // serialize msg to the stream
+ //formatter.Serialize (out_stream, msg, null);
+ //formatter.Serialize (out_stream, new Exception ("TEST"), null);
+ //out_stream.Position = 0;
+ nextInChain.ProcessMessage (msg, null, out_stream, out response_headers,
+ out response_stream);
+
+ out_stream.Close ();
+
+ // deserialize response_stream
+ //IMessage result = (IMessage) formatter.Deserialize (response_stream, null);
+ throw new NotImplementedException ();
+
+ return null;
+
+ } catch (Exception e) {
+ return new ReturnMessage (e, (IMethodCallMessage)msg);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSinkProvider.cs
new file mode 100644
index 00000000000..be81cab2e41
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryClientFormatterSinkProvider.cs
@@ -0,0 +1,61 @@
+//
+// System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class BinaryClientFormatterSinkProvider :
+ IClientFormatterSinkProvider, IClientChannelSinkProvider
+ {
+ IClientChannelSinkProvider next = null;
+
+ // add any sink properties here (private fields)
+
+ public BinaryClientFormatterSinkProvider ()
+ {
+ // nothing to do
+ }
+
+ public BinaryClientFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ // copy the contained properties to private fields
+
+ // add a check that there is no providerData
+ }
+
+ public IClientChannelSinkProvider Next
+ {
+ get {
+ return next;
+ }
+
+ set {
+ next = value;
+ }
+ }
+
+ public IClientChannelSink CreateSink (IChannelSender channel,
+ string url,
+ object remoteChannelData)
+ {
+ IClientChannelSink next_sink = null;
+ BinaryClientFormatterSink result;
+
+ if (next != null)
+ next_sink = next.CreateSink (channel, url, remoteChannelData);
+
+ result = new BinaryClientFormatterSink (next_sink);
+
+ // set properties on the newly creates sink
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSink.cs
new file mode 100644
index 00000000000..a4067770eb6
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSink.cs
@@ -0,0 +1,71 @@
+//
+// System.Runtime.Remoting.Channels.BinaryServerFormatterSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public class BinaryServerFormatterSink : IServerChannelSink, IChannelSinkBase
+ {
+ [Serializable]
+ public enum Protocol
+ {
+ Http = 0,
+ Other = 1,
+ }
+
+ IServerChannelSink next_sink;
+ Protocol protocol;
+ IChannelReceiver receiver;
+
+ public BinaryServerFormatterSink (BinaryServerFormatterSink.Protocol protocol,
+ IServerChannelSink nextSink,
+ IChannelReceiver receiver)
+ {
+ this.protocol = protocol;
+ this.next_sink = nextSink;
+ this.receiver = receiver;
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return next_sink;
+ }
+ }
+
+ public IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ // never called
+ throw new NotSupportedException ();
+ }
+
+ [MonoTODO]
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream,
+ out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSinkProvider.cs
new file mode 100644
index 00000000000..ccbc3fcb2ca
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSinkProvider.cs
@@ -0,0 +1,61 @@
+//
+// System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class BinaryServerFormatterSinkProvider :
+ IServerFormatterSinkProvider, IServerChannelSinkProvider
+ {
+ IServerChannelSinkProvider next = null;
+
+ public BinaryServerFormatterSinkProvider ()
+ {
+ }
+
+ [MonoTODO]
+ public BinaryServerFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IServerChannelSinkProvider Next
+ {
+ get {
+ return next;
+ }
+
+ set {
+ next = value;
+ }
+ }
+
+ public IServerChannelSink CreateSink (IChannelReceiver channel)
+ {
+ IServerChannelSink next_sink = null;
+ BinaryServerFormatterSink result;
+
+ if (next != null)
+ next_sink = next.CreateSink (channel);
+
+ result = new BinaryServerFormatterSink (BinaryServerFormatterSink.Protocol.Other,
+ next_sink, channel);
+
+ // set properties on result
+
+ return result;
+ }
+
+ public void GetChannelData (IChannelDataStore channelData)
+ {
+ // no idea why we need this
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/CommonTransportKeys.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/CommonTransportKeys.cs
new file mode 100644
index 00000000000..f2b2945911e
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/CommonTransportKeys.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Remoting.Channels.CommonTransportKeys.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class CommonTransportKeys
+ {
+ public const string ConnectionId = "__ConnectionId";
+ public const string IPAddress = "__IPAddress";
+ public const string RequestUri = "__RequestUri";
+
+ public CommonTransportKeys ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs
new file mode 100644
index 00000000000..b0a2cb80f9e
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs
@@ -0,0 +1,96 @@
+//
+// System.Runtime.Remoting.Channels.SoapClientFormatterSink.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class SoapClientFormatterSink : IClientFormatterSink,
+ IMessageSink, IClientChannelSink, IChannelSinkBase
+ {
+ private IClientChannelSink nextClientSink;
+
+ public SoapClientFormatterSink (IClientChannelSink sink)
+ {
+ nextClientSink = sink;
+ }
+
+ public IClientChannelSink NextChannelSink
+ {
+ get {
+ return nextClientSink;
+ }
+ }
+
+ public IMessageSink NextSink
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public IDictionary Properties
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IMessageCtrl AsyncProcessMessage (IMessage msg,
+ IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AsyncProcessRequest (IClientChannelSinkStack sinkStack,
+ IMessage msg,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
+ object state,
+ ITransportHeaders headers,
+ Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream GetRequestStream (IMessage msg,
+ ITransportHeaders headers)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ProcessMessage (IMessage msg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs
new file mode 100644
index 00000000000..cad836280a2
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs
@@ -0,0 +1,70 @@
+//
+// System.Runtime.Remoting.Channels.SoapServerFormatterSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public class SoapServerFormatterSink : IServerChannelSink, IChannelSinkBase
+ {
+ IServerChannelSink next_sink;
+
+ [MonoTODO]
+ public SoapServerFormatterSink (SoapServerFormatterSink.Protocol protocol,
+ IServerChannelSink nextSink,
+ IChannelReceiver receiver)
+ {
+ this.next_sink = nextSink;
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return next_sink;
+ }
+ }
+
+ [MonoTODO]
+ public IDictionary Properties {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream,
+ out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [Serializable]
+ public enum Protocol
+ {
+ Http = 0,
+ Other = 1,
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSinkProvider.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSinkProvider.cs
new file mode 100644
index 00000000000..0dfa9a3b08d
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSinkProvider.cs
@@ -0,0 +1,54 @@
+//
+// System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class SoapServerFormatterSinkProvider :
+ IServerFormatterSinkProvider, IServerChannelSinkProvider
+ {
+ [MonoTODO]
+ public SoapServerFormatterSinkProvider ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SoapServerFormatterSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IServerChannelSinkProvider Next
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IServerChannelSink CreateSink (IChannelReceiver channel)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void GetChannelData (IChannelDataStore channelData)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build
new file mode 100644
index 00000000000..a7faf3fdbf1
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Runtime.Remoting.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Runtime.Remoting.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:corlib.dll"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Runtime.Serialization.Formatters.Soap.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Runtime.Remoting.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs
new file mode 100644
index 00000000000..0920ce8f92d
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/Test/corba-example.cs b/mcs/class/System.Runtime.Remoting/Test/corba-example.cs
new file mode 100644
index 00000000000..86bffdf7f6f
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/Test/corba-example.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.CORBA;
+using System.IO;
+
+
+// compile with:
+// csc -r:../../lib/System.Runtime.Remoting.dll corba-example.cs
+
+class Test : MarshalByRefObject {
+
+ public int test_function (int a, bool b)
+ {
+ Console.WriteLine ("test function called: " + b);
+ return a + 1;
+ }
+
+ static int Main () {
+
+ Test t1 = new Test ();
+ ObjRef myref = RemotingServices.Marshal (t1, "/test");
+ Console.WriteLine ("OBJREF: " + myref.URI);
+
+ string url = "corba://localhost:8000/test";
+ string uri;
+
+ CORBAChannel chnl = new CORBAChannel (8000);
+ ChannelServices.RegisterChannel (chnl);
+
+ Console.WriteLine ("Channel name: " + chnl.ChannelName);
+ Console.WriteLine ("Channel priority: " + chnl.ChannelPriority);
+ Console.WriteLine ("URI: " + chnl.Parse (url, out uri));
+ Console.WriteLine ("URI: " + uri);
+
+ Test tp = (Test)RemotingServices.Connect (typeof (Test), url);
+
+ int res = tp.test_function (4, true);
+
+ Console.WriteLine ("RESULT: " + res);
+
+ chnl.StopListening (null);
+
+ return 0;
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/Test/simple-example.cs b/mcs/class/System.Runtime.Remoting/Test/simple-example.cs
new file mode 100644
index 00000000000..0923050ce86
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/Test/simple-example.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Simple;
+using System.IO;
+
+
+// compile with:
+// csc -r:../../lib/System.Runtime.Remoting.dll simple-example.cs
+
+class Test : MarshalByRefObject {
+
+ public int test_function (int a, bool b)
+ {
+ Console.WriteLine ("test function called: " + b);
+ return a + 1;
+ }
+
+ static int Main () {
+
+ Test t1 = new Test ();
+ ObjRef myref = RemotingServices.Marshal (t1, "/test");
+ Console.WriteLine ("OBJREF: " + myref.URI);
+
+ string url = "simple://localhost:8000/test";
+ string uri;
+
+ SimpleChannel chnl = new SimpleChannel (8000);
+ ChannelServices.RegisterChannel (chnl);
+
+ Console.WriteLine ("Channel name: " + chnl.ChannelName);
+ Console.WriteLine ("Channel priority: " + chnl.ChannelPriority);
+ Console.WriteLine ("URI: " + chnl.Parse (url, out uri));
+ Console.WriteLine ("URI: " + uri);
+
+
+ Test tp = (Test)RemotingServices.Connect (typeof (Test), url);
+
+ int res = tp.test_function (4, true);
+
+ Console.WriteLine ("RESULT: " + res);
+
+ chnl.StopListening (null);
+
+ return 0;
+ }
+}
diff --git a/mcs/class/System.Runtime.Remoting/makefile.gnu b/mcs/class/System.Runtime.Remoting/makefile.gnu
new file mode 100644
index 00000000000..9e7997f1691
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.Runtime.Remoting.dll
+
+LIB_LIST = unix.args
+LIB_FLAGS = -r corlib -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Runtime.Remoting/unix.args b/mcs/class/System.Runtime.Remoting/unix.args
new file mode 100644
index 00000000000..57728586fce
--- /dev/null
+++ b/mcs/class/System.Runtime.Remoting/unix.args
@@ -0,0 +1,30 @@
+./System.Runtime.Remoting/TODOAttribute.cs
+./System.Runtime.Remoting.Channels/BinaryClientFormatterSink.cs
+./System.Runtime.Remoting.Channels/BinaryClientFormatterSinkProvider.cs
+./System.Runtime.Remoting.Channels/BinaryServerFormatterSink.cs
+./System.Runtime.Remoting.Channels/BinaryServerFormatterSinkProvider.cs
+./System.Runtime.Remoting.Channels/CommonTransportKeys.cs
+./System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs
+./System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs
+./System.Runtime.Remoting.Channels/SoapServerFormatterSinkProvider.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpMessageIO.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpServerTransportSink.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSinkProvider.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpClientTransportSink.cs
+./System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSinkProvider.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSinkProvider.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSinkProvider.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSink.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleClientFormatterSink.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleServerFormatterSink.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleMessageFormat.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleClientChannel.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
+./System.Runtime.Remoting.Channels.Simple/SimpleServerTransportSink.cs
+
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore b/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog b/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog
new file mode 100644
index 00000000000..e68710bdec0
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog
@@ -0,0 +1,6 @@
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog:
+ New changelog added
+ * list:
+ * makefile.gnu:
+ Added so we can build this assembly on linux now.
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/README b/mcs/class/System.Runtime.Serialization.Formatters.Soap/README
new file mode 100755
index 00000000000..d4127cf1289
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/README
@@ -0,0 +1,4 @@
+The SOAP Serialization Formatter is maintained by
+Jesus Suarez <gsus@brujula.net>
+
+Contact him regarding questions about this module.
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/Sample.txt b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Sample.txt
new file mode 100755
index 00000000000..dfa9e52a62b
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Sample.txt
@@ -0,0 +1,179 @@
+namespace WindowsApplicationProve
+{
+ namespace Cxxx
+ {
+ [Serializable]
+ public struct OtherStruct
+ {
+ public int FInt;
+ }
+
+ [Serializable]
+ public struct StructSample
+ {
+ public int FInt;
+ public char FChar;
+ public object FObj;
+ }
+ [Serializable]
+ public enum EnumSample
+ {
+ aa,
+ bb,
+ cc
+ }
+
+ [Serializable]
+ public delegate int DelegateProve(int i);
+
+ [Serializable]
+ public delegate void OtherDelegate();
+
+ public interface ISample
+ {
+ int FirstMethod(char charParam);
+ }
+
+
+ [Serializable]
+ public class cIntProve: ISample
+ {
+ public long FLongField;
+ public int FirstMethod(char charParam)
+ {
+ return 6;
+ }
+ }
+
+ public delegate string DlgProve(int i);
+
+ [Serializable]
+ public class cAgregationClass:BaseClass
+ {
+ public Char FCharField;
+ public string FStr;
+ public cSerializableProve Fobj;
+ public ISample Fintf;
+ //public int[][] FIntList;
+ public string DlgCatcher(int i)
+ {
+ return "Hello";
+ }
+ }
+
+ [Serializable]
+ public class BaseClass
+ {
+ public int FBaseint;
+ public cIntProve FIntObj;
+ }
+ [Serializable]
+ public class cXXX
+ {
+ public int FI;
+ }
+
+ [Serializable]
+ public class cSerializableProve
+ {
+ public object[] FArrayProve;
+ public object[] FNullArray;
+ //public ClassProve FOtherAssObj;
+ public cAgregationClass FAggField;
+ //value types
+ public DelegateProve FDelegateProve;
+ public event OtherDelegate FEventField;
+ public ISample FInterfaceField;
+ public string FStrField;
+ private int FPintField;
+ public int FIntField;
+ public uint FUintField;
+ public short FShortField;
+ public ushort FUShortField;
+ public long FLongField;
+ public ulong FULongField;
+ public bool FBoolField;
+ public double FDoubleField;
+ public decimal FDecimalField;
+ public char FCharField;
+ public StructSample FStructField;
+ public EnumSample FEnumField;
+
+ public cSerializableProve()
+ {
+ InitReferences();
+ InitSimpleTypes();
+ InitStructs();
+ InitArray();
+ }
+
+ private void InitReferences()
+ {
+ FAggField = new cAgregationClass();
+ FAggField.FCharField = 'a';
+ FAggField.FBaseint = 10;
+ FAggField.Fobj= this;
+ FAggField.FStr= "Hhhh";
+ FStrField= FAggField.FStr;
+ FAggField.FIntObj= new cIntProve ();
+ FInterfaceField= FAggField.FIntObj;
+ FAggField.Fintf= FInterfaceField;
+ }
+
+ private void InitSimpleTypes()
+ {
+ FArrayProve= new Object[20];
+ FPintField= 10;
+ FIntField = 6;
+ FUintField = 6;
+ FShortField = 6;
+ FUShortField = 6;
+ FLongField = 6;
+ FULongField = 6;
+ FDoubleField = 6;
+ FDecimalField = 5;
+ FBoolField = true;
+ FCharField = 'a';
+ FEnumField = EnumSample.aa;
+ }
+
+ private void InitStructs()
+ {
+ FStructField= new StructSample();
+ FStructField.FChar= 'a';
+ FStructField.FInt= 10;
+ FStructField.FObj= this.FAggField;
+ }
+
+ private void InitArray()
+ {
+ FArrayProve[0]= new cAgregationClass();
+ ((cAgregationClass)FArrayProve[0]).FStr= "Hello";
+ FArrayProve[1]= new cAgregationClass[2];
+ ((cAgregationClass[])FArrayProve[1])[0]= this.FAggField;
+ FArrayProve[2]= new int[][][]{new int[][]{new int[3], new int[3], new int[3]}, new int[][]{new int[3], new int[3], new int[3]}};
+ /*Fill the integer array*/
+ ((int[][][])FArrayProve[2])[1][1][1]= 10;
+ ((int[][][])FArrayProve[2])[1][1][2]= 10;
+ ((int[][][])FArrayProve[2])[1][1][0]= 10;
+ FArrayProve[3]= new OtherStruct();
+ FArrayProve[4]= 6;
+ FArrayProve[5]= true;
+ FArrayProve[6]= 2.5;
+ FArrayProve[7]= EnumSample.bb;
+ FArrayProve[8]= this.FInterfaceField;
+ FArrayProve[9]= "Hello";
+ FArrayProve[10]= new UInt32();
+ FArrayProve[11]= new short();
+ FArrayProve[12]= new UInt16();
+ FArrayProve[13]= new decimal();
+ FArrayProve[15]= new ulong();
+ FArrayProve[16]= new char();
+ FArrayProve[18]= null;
+ }
+
+ public void InitDelegates()
+ {
+ FDelegateProve= new DelegateProve(SIntProve);
+ FEventField= new OtherDelegate(OtherProve);
+ } \ No newline at end of file
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap.build b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap.build
new file mode 100755
index 00000000000..8e6cbad2525
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap.build
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Runtime.Serialization.Formatters.Soap.dll -->
+
+<project name="System.Runtime.Serialization.Formatters.Soap" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Runtime.Serialization.Formatters.Soap.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+
+ <!-- cor compare dies with these currently -->
+ <!--arg value="/nostdlib"/--> <!-- don't reference mscorlib -->
+ <!--arg value="/r:corlib.dll"/-->
+ <arg value="/r:System.Xml.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ </csc>
+ <copy file="../lib/System.Runtime.Serialization.Formatters.Soap.dll" tofile="Test/System.Runtime.Serialization.Formatters.Soap.dll"/>
+ <!--nant basedir="Test" target="build"/-->
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.Runtime.Serialization.Formatters.Soap.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ChangeLog b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ChangeLog
new file mode 100644
index 00000000000..2b92835cd3e
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ChangeLog
@@ -0,0 +1,10 @@
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * SoapFormatter.cs:
+ That should be IRemotingFormatter, not IRemoteFormatter.
+ Some stubs to make it compile on linux.
+ * TODOAttribute.cs:
+ Added this class to this assembly.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * SoapFormatter.cs: This implements IFormatter and IRemoteFormatter.
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectDeserializer.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectDeserializer.cs
new file mode 100755
index 00000000000..a49dd912b5f
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectDeserializer.cs
@@ -0,0 +1,453 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+
+namespace System.Runtime.Serialization.Formatters.Soap
+{
+ internal class ObjectDeserializer
+ {
+ /**const section**/
+ const string cStringType = "System.String";
+ const string basicassembly = "mscorlib";
+ const string xmlnsassem = "http://schemas.microsoft.com/clr/nsassem/";
+ const string xmlns = "http://schemas.microsoft.com/clr/ns/";
+ const string xmlns_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
+ const string xmlns_SOAP_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
+
+ const string cTarget = "Target";
+ const string cDelegatesClass = "System.MulticastDelegate";
+ const string cMethodName = "MethodName";
+ const string cSoapEncArray = "SOAP-ENC:Array";
+ const string cId = "id";
+
+ private ArrayList FObjectList;
+ private int FObjectNumber;
+ private SoapReader ObjectRdr;
+
+ public XmlDocument FXmlDoc;
+
+ private int AddObject(object graph, out bool AlreadyExists, int ObjectIndex, out object ResultObject)
+ {
+ AlreadyExists= true;
+ ResultObject= null;
+ if((FObjectList.Count< ObjectIndex)||(FObjectList[ObjectIndex - 1]==null))//the object not exits
+ {
+ if(FObjectList.Count< ObjectIndex)
+ {
+ int Capacity= FObjectList.Capacity;
+ int Start= FObjectList.Count;
+ for(int i= Start; i<= Capacity; i++)
+ {FObjectList.Add(null);}
+ }
+ if(FObjectList[ObjectIndex - 1]==null)
+ {
+ FObjectList.Insert(ObjectIndex - 1, graph);
+ AlreadyExists= false;
+ ResultObject= graph;
+ FObjectNumber++;
+ }
+ }
+ else
+ ResultObject= FObjectList[ObjectIndex - 1];
+ return ObjectIndex;
+ }
+
+ private string GetAssemblyIndex(string SoapNamespace, string ReferenceName)
+ {
+ XmlAttributeCollection XmlAttrCollection= FXmlDoc.DocumentElement.Attributes;
+ bool Continue= true;
+ int i= 0;
+ string ItemName= "";
+ while((Continue)&&(i<= XmlAttrCollection.Count - 1))
+ {
+ string AttrValue= XmlAttrCollection.Item(i).Value;
+ if(AttrValue==SoapNamespace)
+ {
+ ItemName= XmlAttrCollection.Item(i).Name;
+ ItemName= ItemName.Substring(ItemName.IndexOf(":") + 1, ItemName.Length - ItemName.IndexOf(":") - 1);
+ Continue= false;
+ }
+ i++;
+ }
+ return ItemName + ":" + ReferenceName;
+ }
+
+ public void ClearLits()
+ {
+ FObjectList.Clear();
+ }
+
+ public ObjectDeserializer(Stream serializationStream)
+ {
+ FXmlDoc= new XmlDocument();
+ FXmlDoc.Load(serializationStream);
+ FObjectList= new ArrayList();
+ ObjectRdr= new SoapReader();
+ ObjectRdr.FXmlDoc= FXmlDoc;
+ }
+ /**simple types deserialization**/
+ private void DeserialiazeValueType(FieldInfo objectfield, XmlElement ParentElement/*string XmlParentElement*/, object ActualObject/*, string XmlParentElementId*/)
+ {
+ if((objectfield.FieldType.Assembly.GetName().Name == basicassembly)||(objectfield.FieldType.IsEnum))
+ {
+ string fieldvalue= ObjectRdr.ReadValueTypeFromXml(objectfield.Name, ParentElement);
+ ValueType objvalue= ObjectRdr.GetValueTypeFromString(objectfield.FieldType.UnderlyingSystemType.Name, fieldvalue);
+ objectfield.SetValue(ActualObject, objvalue);
+ }
+ else //is an struct
+ DeserializeStruct(objectfield, ParentElement, ActualObject, false);
+ }
+ /**Structs deserialization**/
+ private void DeserializeStructValueType(FieldInfo structfield, XmlElement ParentElement/*string XmlParentElement*/, object ActualObject/*, string XmlParentElementId*/, string StructName, object StructObject, bool NestedStruct)
+ {
+ if(structfield.FieldType.Assembly.GetName().Name == basicassembly)
+ {
+ string fieldvalue= ObjectRdr.ReadStructValueFieldFromXml(structfield.Name, ParentElement, StructName, false);
+ ValueType objValue= ObjectRdr.GetValueTypeFromString(structfield.FieldType.UnderlyingSystemType.Name, fieldvalue);
+ structfield.SetValue(StructObject, objValue);
+ }
+ else //is a nested struct
+ {
+ XmlElement StructElement= (XmlElement)ParentElement.GetElementsByTagName(structfield.Name).Item(0);
+ DeserializeStruct(structfield, StructElement, StructObject, true);
+ }
+ }
+
+ private void DeserializeStructReferenceType(FieldInfo structfield, XmlElement ParentElement, object ActualObject, bool NestedStruct, int FieldIndex)
+ {
+ DeserializeReferenceType(structfield, ParentElement, ActualObject, FieldIndex);
+ }
+
+ private void DeserializeStruct(FieldInfo objectfield, XmlElement ParentElement, /*, string XmlParentElement*/ object ActualObject/*, string XmlParentElementId*/, bool NestedStruct)
+ {
+ object StructValue= Assembly.Load(objectfield.FieldType.Assembly.GetName().Name).CreateInstance(objectfield.FieldType.FullName);
+ if(StructValue != null)
+ {
+ FieldInfo[] structfields= objectfield.FieldType.GetFields();
+ for(int index= 0; index <= structfields.Length - 1; index++)
+ {
+ if(!structfields[index].IsNotSerialized)
+ {
+ if(structfields[index].FieldType.IsValueType)
+ DeserializeStructValueType(structfields[index], ParentElement, ActualObject, objectfield.Name, StructValue, NestedStruct);
+ else //is a reference type
+ DeserializeStructReferenceType(structfields[index], ParentElement, StructValue, NestedStruct, index);
+
+ }
+ }
+ objectfield.SetValue(ActualObject, StructValue);
+ }
+ else
+ objectfield.SetValue(ActualObject, null);
+ }
+
+ private void DeserializeStruct(ref Array ArrayValue, int ItemIndex, XmlElement ParentElement, object ActualObject, bool NestedStruct)
+ {
+ string XsdType= ((XmlElement)ParentElement.ChildNodes.Item(ItemIndex)).GetAttribute("xsi:type");
+ string NsName;
+ string AssemblyName= ObjectRdr.GetFullObjectLocation(XsdType, out NsName);
+ object StructValue= Assembly.Load(AssemblyName).CreateInstance(NsName);
+ if(StructValue != null)
+ {
+ FieldInfo[] structfields= StructValue.GetType().GetFields();
+ for(int index= 0; index <= structfields.Length - 1; index++)
+ {
+ if(!structfields[index].IsNotSerialized)
+ {
+ if(structfields[index].FieldType.IsValueType)
+ DeserializeStructValueType(structfields[index], ParentElement, ActualObject, "", StructValue, NestedStruct);
+ else //is a reference type
+ DeserializeStructReferenceType(structfields[index], ParentElement, StructValue, NestedStruct, index);
+
+ }
+ }
+ ArrayValue.SetValue(StructValue, ItemIndex);
+ }
+ else
+ ArrayValue.SetValue(null, ItemIndex);
+ }
+
+ /**Reference types deserialization**/
+ private void DeserializeReferenceType(FieldInfo objectfield, XmlElement ParentElement, object ActualObject, int FieldIndex)
+ {
+ XmlElement RefElement= null;
+ ReferenceTypes RefType= ObjectRdr.GetReferenceType(objectfield.Name, ParentElement, ref RefElement);
+ switch(RefType)
+ {
+ case ReferenceTypes.String_Type : DeserializeString(objectfield, ParentElement, ActualObject);
+ break;
+ case ReferenceTypes.Object_Type : DeserializeInterfacedObjectField(objectfield, ParentElement, ActualObject);
+ break;
+ case ReferenceTypes.Delegate_Type : DeserializeDelegates(objectfield, ParentElement, ActualObject);
+ break;
+ case ReferenceTypes.Array_Type : DeserializeArray(objectfield, ParentElement, ActualObject);
+ break;
+ }
+ }
+
+ private void DeseralizeArrayItemReferenceType(ref Array ArrayValue, int index, XmlElement ArrayElement, object ActualObject)
+ {
+ XmlElement RefElement= null;
+ ReferenceTypes RefType= ObjectRdr.GetReferenceType(index, ArrayElement, ref RefElement);
+ switch(RefType)
+ {
+ case ReferenceTypes.String_Type : DeserializeString(ref ArrayValue, index, ArrayElement, ActualObject);
+ break;
+ case ReferenceTypes.Object_Type : DeserializeInterfacedObjectField(ref ArrayValue, index, ArrayElement, ActualObject);
+ break;
+ case ReferenceTypes.Delegate_Type : DeserializeDelegates(ref ArrayValue, index, ArrayElement, ActualObject);
+ break;
+ case ReferenceTypes.Array_Type : DeserializeArray(ref ArrayValue, index, ArrayElement, ActualObject);
+ break;
+ }
+ }
+
+ /**Strings deseralization**/
+ private void DeserializeString(ref Array ArrayValue, int ItemIndex, XmlElement ParentElement, object ActualObject)
+ {
+ int ReferenceIndex= ObjectRdr.ReadStringIdFromXml(ItemIndex, ParentElement);//the reference index
+ string StringObj;
+ if(ReferenceIndex == -1)
+ StringObj= null;
+ else
+ StringObj= ObjectRdr.ReadStringTypeFromXml(ItemIndex, ParentElement);
+ object ResultObject;
+ bool AlreadyExist;
+ AddObject(StringObj, out AlreadyExist, ReferenceIndex, out ResultObject);
+ ((Array)ArrayValue).SetValue((string)ResultObject, ItemIndex);
+ }
+
+ private void DeserializeString(FieldInfo objectfield, XmlElement ParentElement, object ActualObject)
+ {
+ int ReferenceIndex= ObjectRdr.ReadStringIdFromXml(objectfield.Name, ParentElement);//the reference index
+ string StringObj;
+ if(ReferenceIndex == -1)
+ StringObj= null;
+ else
+ StringObj= ObjectRdr.ReadStringTypeFromXml(objectfield.Name, ParentElement);
+ object ResultObject;
+ bool AlreadyExist;
+ AddObject(StringObj, out AlreadyExist, ReferenceIndex, out ResultObject);
+ objectfield.SetValue(ActualObject, (string)ResultObject);
+ }
+ /**interfaces deserialization**/
+ //object's interfaces fields serialization
+ private void DeserializeInterfacedObjectField(FieldInfo objectfield, XmlElement ParentElement, object ActualObject)
+ {
+ int ReferenceIndex= ObjectRdr.ReadReferenceIndexFromXml(objectfield.Name, ParentElement);//the reference index
+ string ReferenceFullName= ObjectRdr.ReadReferenceFullNameFromXml(ReferenceIndex.ToString());//objectfield.FieldType.FullName;
+ if(ReferenceIndex != -1) //not null
+ {
+ object ItemValue= CommonIntObjectDeserialization(ReferenceIndex, ReferenceFullName, ParentElement);
+ objectfield.SetValue(ActualObject, ItemValue);
+ }
+ else
+ objectfield.SetValue(ActualObject, null);
+ }
+
+ //Array's items interfaces serialization
+ private void DeserializeInterfacedObjectField(ref Array ArrayValue, int ItemIndex, XmlElement ParentElement, object ActualObject)
+ {
+ int ReferenceIndex= ObjectRdr.ReadReferenceIndexFromXml(ItemIndex, ParentElement);//the reference index
+ string ReferenceFullName= ObjectRdr.ReadReferenceFullNameFromXml(ReferenceIndex.ToString());//objectfield.FieldType.FullName;
+ if(ReferenceIndex != -1) //not null
+ {
+ object ItemValue= CommonIntObjectDeserialization(ReferenceIndex, ReferenceFullName, ParentElement);
+ ((Array)ArrayValue).SetValue(ItemValue, ItemIndex);
+ }
+ else
+ ((Array)ArrayValue).SetValue(null, ItemIndex);
+
+ }
+
+ private object CommonIntObjectDeserialization(int ReferenceIndex, string ReferenceFullName, XmlElement ParentElement)
+ {
+ bool AlreadyExists;
+ string AssemblyName= ObjectRdr.GetAssemblyNameFromId(ReferenceIndex);//ReadAssemblyNameFromXml(/*objectfield.Name, */ParentElement);
+ object ItemValue= Assembly.Load(AssemblyName).CreateInstance(ReferenceFullName);
+ DeserializeObject(ref ItemValue, ReferenceIndex);
+ return ItemValue;
+ }
+ /**Delegates Deserialization**/
+ //object's delegates fields serialization
+ private void DeserializeDelegates(FieldInfo Delegatefield, XmlElement ParentElement, object ActualObject)
+ {
+ int ReferenceIndex= ObjectRdr.ReadReferenceIndexFromXml(Delegatefield.Name, ParentElement);//the reference index
+ string DelegateElementName= ObjectRdr.GetDelegateElementName(ReferenceIndex);
+ XmlElement CurrentElement= ObjectRdr.GetCurrentElement(DelegateElementName, ReferenceIndex.ToString());
+ if(ReferenceIndex != -1) //not null
+ {
+ object DelegateValue= CommonDelegateDeserialization(CurrentElement, Delegatefield.FieldType);
+ Delegatefield.SetValue(ActualObject, DelegateValue);
+ }
+ }
+
+ //Array's delegates items serialization
+ private void DeserializeDelegates(ref Array ArrayValue, int ItemIndex, XmlElement ParentElement, object ActualObject)
+ {
+ int ReferenceIndex= ObjectRdr.ReadReferenceIndexFromXml(ItemIndex, ParentElement);//the reference index
+ string DelegateElementName= ObjectRdr.GetDelegateElementName(ReferenceIndex);
+ XmlElement CurrentElement= ObjectRdr.GetCurrentElement(DelegateElementName, ReferenceIndex.ToString());
+ if(ReferenceIndex != -1) //not null
+ {
+ Type DlgType= ObjectRdr.GetDelegateTypeFromXml(CurrentElement);
+ object DelegateValue= CommonDelegateDeserialization(CurrentElement, DlgType);
+ ((Array)ArrayValue).SetValue(DelegateValue, ItemIndex);
+ }
+ }
+
+ private object CommonDelegateDeserialization(XmlElement CurrentElement, Type DlgType)
+ {
+ int TargetIndex= ObjectRdr.ReadReferenceIndexFromXml(cTarget, CurrentElement);//the reference index
+ string AssemblyName= ObjectRdr.GetAssemblyNameFromId(TargetIndex);
+ string TargetFullName= ObjectRdr.ReadReferenceFullNameFromXml(TargetIndex.ToString());
+ object Target= Assembly.Load(AssemblyName).CreateInstance(TargetFullName);
+ DeserializeObject(ref Target, TargetIndex);
+ string MethodName= ObjectRdr.ReadStringTypeFromXml(cMethodName ,CurrentElement);
+ Delegate DelegateValue= MulticastDelegate.CreateDelegate(DlgType, Target, MethodName);
+ return DelegateValue;
+ }
+
+ /**Arrays Deserialization**/
+ //Object's fields desearialization
+ private void DeserializeArray(FieldInfo ArrayField, XmlElement ParentElement, object ActualObject)
+ {
+ int ArrayIndex= ObjectRdr.ReadReferenceIndexFromXml(ArrayField.Name, ParentElement);
+ XmlElement ArrayElement;
+ string ArrayTypeName;
+ Array ArrayValue= CommonArrayDeserialization(ArrayIndex, out ArrayTypeName, out ArrayElement);
+ object ResultObject;
+ bool AlreadyExists;
+ AddObject(ArrayValue, out AlreadyExists, ArrayIndex, out ResultObject);//add the array
+ ArrayField.SetValue(ActualObject, ResultObject);
+ if(!AlreadyExists)
+ DeserializeArrayItems(ArrayValue, ArrayElement, ActualObject, ArrayTypeName);
+ }
+ //Array's items deserialization
+ private void DeserializeArray(ref Array ArrayValue, int ItemIndex, XmlElement ParentElement, object ActualObject)
+ {
+ int ArrayIndex= ObjectRdr.ReadReferenceIndexFromXml(ItemIndex, ParentElement);
+ XmlElement ArrayElement;
+ string ArrayTypeName;
+ Array ArrayActualValue= CommonArrayDeserialization(ArrayIndex, out ArrayTypeName, out ArrayElement);
+ ((Array)ArrayValue).SetValue(ArrayActualValue, ItemIndex);
+ bool AlreadyExists;
+ object ResultObject;
+ AddObject(ArrayActualValue, out AlreadyExists, ArrayIndex, out ResultObject);
+ if(!AlreadyExists)
+ DeserializeArrayItems(ArrayActualValue, ArrayElement, ActualObject, ArrayTypeName);
+ }
+
+
+ private Array CommonArrayDeserialization(int ArrayIndex, out string ArrTypeName, out XmlElement ArrayElement)
+ {
+ ArrayElement= ObjectRdr.GetCurrentElement(cSoapEncArray, ArrayIndex.ToString());
+ string AssemblyName;
+ string ArrayTypeName= ObjectRdr.ReadArrayTypeFromXml(ArrayElement, out AssemblyName);
+ int StartIndex= ArrayTypeName.LastIndexOf("[");
+ string ArrayLength= ArrayTypeName.Substring(StartIndex + 1, ArrayTypeName.Length - 2 - StartIndex);
+ ArrayTypeName= ArrayTypeName.Substring(0, ArrayTypeName.LastIndexOf("["));
+ Assembly.Load(AssemblyName);
+ Type ArrayType= Type.GetType(ArrayTypeName);
+ ArrTypeName= ArrayType.Name;
+ Array ArrayActualValue= Array.CreateInstance(ArrayType, Convert.ToInt32(ArrayLength));
+ return ArrayActualValue;
+ }
+
+ private void DeserializeArrayItems(Array ArrayValue, XmlElement ArrayElement, object ActualObject, string ArrayTypeName)
+ {
+ bool IsStruct= false;
+ bool IsNull= false;
+ for(int index= 0; index<= ((Array)ArrayValue).Length - 1; index++)
+ {
+ bool IsValueType= ObjectRdr.IsArrayItemValueType(ArrayElement, index, ref IsNull, ref IsStruct);
+ if(IsNull)
+ ((Array)ArrayValue).SetValue(null, index);
+ else
+ if(IsValueType)
+ DeserializeArrayItemValueType(ref ArrayValue, index, ArrayElement, ArrayTypeName, IsStruct, ActualObject);
+ else //is a reference type
+ DeseralizeArrayItemReferenceType(ref ArrayValue, index, ArrayElement, ActualObject);
+ }
+ }
+
+ private void DeserializeArrayItemValueType(ref Array ArrayValue, int index, XmlElement ArrayElement, string ItemTypeName, bool IsStruct, object ActualObject)
+ {
+ if(!IsStruct)
+ {
+ ValueType ItemValue= ObjectRdr.ReadArrayItemSimpleTypeFromXml(ArrayElement, index, ItemTypeName);
+ ((Array)ArrayValue).SetValue(ItemValue, index);
+ }
+ else
+ DeserializeStruct(ref ArrayValue, index, ArrayElement, ActualObject, false);
+ }
+
+ /**objects desrialization**/
+ private int DeserializeObject(ref object graph, int ObjectIndex)
+ {
+ bool AlreadyExits;
+ string XmlElemtName= GetAssemblyIndex(GetXmlNamespace(graph.GetType().Namespace, graph.GetType().Assembly.GetName().Name), graph.GetType().Name);
+ /**this is temporal**/
+ XmlElement ObjectElement= ObjectRdr.GetCurrentElement(XmlElemtName, ObjectIndex.ToString());
+ object ResultObject;
+ ObjectIndex= AddObject(graph, out AlreadyExits, ObjectIndex, out ResultObject);
+ if(!AlreadyExits)//new object
+ {
+ FieldInfo[]objectfields= ResultObject.GetType().GetFields(BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance);
+ for(int index= 0; index<= objectfields.Length - 1; index++)
+ {
+ if(!objectfields[index].IsNotSerialized)
+ {
+ if(objectfields[index].FieldType.IsValueType)// the field is a value type
+ DeserialiazeValueType(objectfields[index], ObjectElement, /*XmlElemtName,*/ ResultObject/*, ObjectIndex.ToString()*/);
+ else
+ DeserializeReferenceType(objectfields[index], ObjectElement, ResultObject, index);
+ }
+ }
+ }
+ graph= ResultObject;
+ return ObjectIndex;
+ }
+
+ private string GetMainAssemblyFullNameFromXml(out string AssemblyName)
+ {
+ XmlNode SoapEnvNode= FXmlDoc.DocumentElement.GetElementsByTagName("Body", xmlns_SOAP_ENV).Item(0);
+ XmlNode MainObjectNode= SoapEnvNode.ChildNodes.Item(0);
+ int StartIndex= MainObjectNode.Name.IndexOf(":");
+ string ClassName= MainObjectNode.Name.Substring(StartIndex + 1, MainObjectNode.Name.Length - StartIndex - 1);
+ string AttributeName= FXmlDoc.DocumentElement.Attributes.GetNamedItem("xmlns:" + MainObjectNode.Name.Substring(0, 2)).Value;
+ StartIndex= AttributeName.LastIndexOf("/");
+ AssemblyName= AttributeName.Substring(StartIndex + 1, AttributeName.Length - StartIndex - 1);
+ string TempStr= AttributeName.Substring(0, StartIndex);
+ StartIndex= TempStr.LastIndexOf("/");
+ string ReferenceFullName= TempStr.Substring(StartIndex + 1, TempStr.Length - StartIndex - 1);
+ return ReferenceFullName + "." + ClassName;
+ }
+
+ private object GetMainObjectFromXml()
+ {
+ string AssName;
+ string ReferenceFullName= GetMainAssemblyFullNameFromXml(out AssName);
+ return Assembly.Load(AssName).CreateInstance(ReferenceFullName);
+ }
+
+ public string GetXmlNamespace(string NamepaceName, string AssemblyName)
+ {
+ string XmlAssNs;
+ if(AssemblyName == basicassembly)
+ XmlAssNs= xmlns + NamepaceName;
+ else
+ XmlAssNs= xmlnsassem + NamepaceName + '/' + AssemblyName;
+ return XmlAssNs;
+ }
+
+ public object Deserialize(Stream serializationStream)
+ {
+ object MainObject= GetMainObjectFromXml();
+ DeserializeObject(ref MainObject, 1);
+ return MainObject;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectSerializer.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectSerializer.cs
new file mode 100755
index 00000000000..05906c8ffce
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/ObjectSerializer.cs
@@ -0,0 +1,388 @@
+/****************************************************/
+/*ObjectSerializer class implementation */
+/*Author: Jes·s M. Rodr­guez de la Vega */
+/*gsus@brujula.net */
+/****************************************************/
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+using System.Text;
+
+namespace System.Runtime.Serialization.Formatters.Soap
+{
+ internal class ObjectSerializer
+ {
+ /*******const's section******/
+ const string cStringType = "System.String";
+ const string startxmlns = "xmlns:a";
+ const string startdoc_start = "<SOAP-ENV:Envelope " +
+ "xmlns:xsi= \"http://www.w3.org/2001/XMLSchema-instance\"" + " " +
+ "xmlns:xsd= \"http://www.w3.org/2001/XMLSchema\"" + " " +
+ "xmlns:SOAP-ENC= \"http://schemas.xmlsoap.org/soap/encoding/\"" + " " +
+ "xmlns:SOAP-ENV= \"http://schemas.xmlsoap.org/soap/envelope/\"" + " " +
+ "SOAP-ENV:encodingStyle= \"http://schemas.xmlsoap.org/soap/encoding/\"" + " ";
+ const string startdoc_middle = ">" + " " +
+ "<SOAP-ENV:Body>";
+ const string startdoc_end = "</SOAP-ENV:Body>" + " " +
+ "</SOAP-ENV:Envelope>";
+ const string xmlns_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
+ const string xmlns_SOAP_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
+ const string xmlnsassem = "http://schemas.microsoft.com/clr/nsassem/";
+ const string xmlns = "http://schemas.microsoft.com/clr/ns/";
+ const string basicassembly = "mscorlib";
+ /*****Delegates const******/
+ const string cDelegatesClass = "System.MulticastDelegate";
+ const string cDelegateSerClass = "DelegateSerializationHolder";
+ const string cDelegateType = "DelegateType";
+ const string cDelegateAssembly = "DelegateAssembly";
+ const string cTarget = "Target";
+ const string cTargetTypAssem = "TargetTypeAssembly";
+ const string cTargetTypName = "TargetTypeName";
+ const string cMethodName = "MethodName";
+ const string cDefaultValue = "_0x00_";
+ /******field's sections******/
+ private Stream FCurrentStream;
+ private ArrayList AssemblyList; //the assemblies's been serialized
+ public ArrayList XmlObjectList; //the list of the xml representation of all objects
+ private ArrayList FObjectList; //the listof the object been seralized
+ private SoapWriter ObjectWrt;
+ /******method's section******/
+ private string ConcatAssembliesToXml()
+ {
+ StringBuilder bld = new StringBuilder ();
+ for (int inx = 1; inx <= AssemblyList.Count; inx++)
+ {
+ string xmlns = startxmlns + inx.ToString();
+ string assemns = AssemblyList[inx - 1] as string;
+
+ bld.Append (xmlns);
+ bld.Append ("='");
+ bld.Append (assemns);
+ bld.Append ("'");
+ }
+ return bld.ToString();
+ }
+
+ private int AddAssembly(string assname, string nespname)
+ {
+ string XmlAssNs;
+
+ if(assname == basicassembly)
+ XmlAssNs= xmlns + nespname;
+ else
+ XmlAssNs= xmlnsassem + nespname + '/' + assname;
+ int Result= AssemblyList.IndexOf(XmlAssNs);
+ if(Result< 0)
+ {
+ Result= AssemblyList.Add(XmlAssNs);
+ }
+ return Result;
+ }
+
+ private int AddObject(object graph, out bool AlreadyExists)
+ {
+ int index= FObjectList.IndexOf(graph);
+ AlreadyExists= true;
+ if(index < 0) //is a new object
+ {
+ AlreadyExists= false;
+ index= FObjectList.Add(graph);
+ }
+ return index;
+ }
+
+ private int AddString(object StrObject, out bool AlreadyExists)
+ {
+ int index= FObjectList.IndexOf(StrObject);
+ AlreadyExists= true;
+ if(index < 0) //is a new object
+ {
+ AlreadyExists= false;
+ index= FObjectList.Add(StrObject);
+ }
+ return index;
+ }
+ /******Xml Writer Methods******/
+ private void AddObjectTagToXml(object ObjectField, int ParentIndex, string ObjectName)
+ {
+ }
+ private void AddSimpleTagToXml()
+ {
+ }
+ private int AddAssemblytoXml(Type ObjectType)
+ {
+ string assname, nespname;
+ assname = ObjectType.Assembly.GetName().Name;
+ nespname = ObjectType.Namespace;
+ return AddAssembly(assname, nespname);
+ }
+ /******Serialization Methods******/
+ private void SerializeEnum(object ActualObject, FieldInfo field, int ObjectIndex)
+ {
+ string FieldName= field.Name;
+ string FieldValue= field.GetValue(ActualObject).ToString();
+ ObjectWrt.WriteValueTypeToXml(FieldName, FieldValue, ObjectIndex);
+ }
+
+ private void SerializeStruct(object StructValue, string FieldName, int ObjectIndex, bool IsArrayItem)
+ {
+ int AssemblyIndex= AddAssemblytoXml(StructValue.GetType()) + 1;
+ string StructTypeName= StructValue.GetType().Name;
+ ObjectWrt.WriteStructInitTagToXml(FieldName, ObjectIndex, IsArrayItem, AssemblyIndex, StructTypeName);
+ FieldInfo[] fieldtypes = StructValue.GetType().GetFields(BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance); //get the fields
+ for(int index = 0; index<= fieldtypes.Length - 1; index++)
+ {
+ if(!fieldtypes[index].IsNotSerialized)
+ {
+ AssemblyIndex= AddAssemblytoXml(fieldtypes[index].FieldType);
+ if(fieldtypes[index].FieldType.IsValueType)//if the field is a value type
+ SerializeValueTypes(StructValue, fieldtypes[index], ObjectIndex);
+ else
+ SerializeReferenceTypes(ObjectIndex, fieldtypes[index].GetValue(StructValue), fieldtypes[index].FieldType, fieldtypes[index].Name);
+
+ }
+ }
+ ObjectWrt.WriteStructEndTagToXml(FieldName, ObjectIndex);
+ }
+
+ private void SerializeValueTypes(object ActualObject, FieldInfo field, int ObjectIndex) //Serialize the value types
+ {
+ if(field.FieldType.IsEnum)
+ SerializeEnum(ActualObject, field, ObjectIndex);
+ else
+ {
+ if(field.FieldType.Assembly.GetName().Name == basicassembly)//is a simple field
+ {
+ string FieldName= field.Name;
+ string FieldValue= field.GetValue(ActualObject).ToString();
+ if(FieldValue.ToString().CompareTo("")==0)
+ FieldValue= cDefaultValue;
+ ObjectWrt.WriteValueTypeToXml(FieldName, FieldValue, ObjectIndex);
+ }
+ else //is a struct field
+ {
+ object StructValue= field.GetValue(ActualObject);
+ SerializeStruct(StructValue, field.Name, ObjectIndex, false);
+ }
+ }
+ }
+
+ private void SerializeArrayItemValueType(object ArrayItem, int ArrayIndex, int AssemblyIndex, string ArrayItemsType)
+ {
+ if((ArrayItem.GetType().IsEnum)|(ArrayItem.GetType().Assembly.GetName().Name== basicassembly))
+ {
+ int ItemAssemblyIndex= AddAssemblytoXml(ArrayItem.GetType()) + 1;
+ string ItemValue= ArrayItem.ToString();
+ if(ArrayItem.ToString().CompareTo("")==0)
+ ItemValue= cDefaultValue;
+ ObjectWrt.WriteArrayValueItemToXml(ArrayItem.GetType().Name, ItemValue, ArrayIndex, ArrayItemsType, ItemAssemblyIndex);
+ }
+ else //is an struct
+ SerializeStruct(ArrayItem, "item", ArrayIndex, true);
+ }
+
+ private void SerializeReferenceTypes(int ObjectIndex, object Instance, Type InstanceType, string InstanceName)
+ {
+ if(InstanceType.IsArray)
+ {
+ Array ArrayField= (Array)Instance;
+ if(ArrayField!= null)
+ {
+ int ArrayIndex= SerializeArray(ArrayField);
+ ObjectWrt.WriteObjectFieldToXml(InstanceName, ObjectIndex, ArrayIndex);
+ }
+ else
+ ObjectWrt.WriteNullObjectFieldToXml(InstanceName, ObjectIndex);
+ }
+ else
+ {
+ if(InstanceType.FullName == cStringType)
+ SerializeString(Instance, ObjectIndex, InstanceName);
+ else
+ {
+ if((InstanceType.BaseType != null)&&(InstanceType.BaseType.ToString() == cDelegatesClass))//is a delegate's field
+ {
+ if(Instance!= null)
+ {
+ int DlgIndex= SerialializedDelegates(Instance, ObjectIndex);
+ ObjectWrt.WriteObjectFieldToXml(InstanceName, ObjectIndex, DlgIndex);
+ }
+ else
+ ObjectWrt.WriteNullObjectFieldToXml(InstanceName, ObjectIndex);
+ }
+ else
+ {
+ if((InstanceType.IsClass)||(InstanceType.IsInterface)) //if the field is a class's instance or an interface
+ {
+ if(Instance != null)
+ {
+ int FieldIndex= SerializeObject(Instance, ObjectIndex);
+ ObjectWrt.WriteObjectFieldToXml(InstanceName, ObjectIndex, FieldIndex);
+ }
+ else
+ ObjectWrt.WriteNullObjectFieldToXml(InstanceName, ObjectIndex);
+ }
+ }
+ }
+ }
+ }
+
+ private int SerializeArray(Array ArrayField)
+ {
+ int Length= ArrayField.Length;
+ int AssemblyIndex= AddAssemblytoXml(ArrayField.GetType()) + 1;
+ bool AlreadyExist;
+ int ArrayIndex= AddObject(ArrayField, out AlreadyExist) + 1;
+ if(!AlreadyExist)
+ {
+ string ArrayType= ArrayField.GetType().Name;
+ string ArrayItemsType= ArrayField.GetType().Name.Substring(0, ArrayField.GetType().Name.IndexOf("["));
+ string XmlSchemaArrayType= ObjectWrt.GenerateSchemaArrayType(ArrayType, Length, AssemblyIndex);
+ ObjectWrt.WriteArrayToXml(XmlSchemaArrayType, ArrayIndex);
+ object ItemValue;
+ for(int index= 0; index<= Length - 1; index++)
+ {
+ ItemValue= ArrayField.GetValue(index);
+ if(ItemValue== null)
+ ObjectWrt.WriteNullObjectFieldToXml("item", ArrayIndex);
+ else
+ {
+ if(ItemValue.GetType().IsValueType)
+ {
+ SerializeArrayItemValueType(ItemValue, ArrayIndex, AssemblyIndex, ArrayItemsType);
+ }
+ else//is a reference type
+ {
+ SerializeReferenceTypes(ArrayIndex, ItemValue, ItemValue.GetType(), "item");
+ }
+ }
+ }
+ }
+ return ArrayIndex;
+ }
+
+ private void SerializeString(object StringObject, int ObjectIndex, string StringName)
+ {
+ bool AlreadyExits;
+ int StringIndex= AddString(StringObject, out AlreadyExits) + 1;
+ if(!AlreadyExits)
+ {
+ ObjectWrt.WriteStringTypeToXml(StringName, StringObject.ToString(), ObjectIndex, StringIndex);
+ XmlObjectList.Add("");
+ }
+ else
+ ObjectWrt.WriteObjectFieldToXml(StringName, ObjectIndex, StringIndex);
+ }
+
+ private void SerializeStringField(string StringName, string StringValue, int ObjectIndex)
+ {
+ bool AlreadyExits;
+ int StringIndex= AddString(StringValue, out AlreadyExits) + 1;
+ if(!AlreadyExits)
+ {
+ ObjectWrt.WriteStringTypeToXml(StringName, StringValue, ObjectIndex, StringIndex);
+ XmlObjectList.Add("");
+ }
+ else
+ ObjectWrt.WriteObjectFieldToXml(StringName, ObjectIndex, StringIndex);
+ }
+
+
+ private int SerialializedDelegates(object DelegateObject, int ParentObjectIndex)
+ {
+ bool AlreadyExits;
+ int AssemblyIndex= AddAssembly(basicassembly, "System") + 1;
+ int DelegatesIndex= AddObject(DelegateObject, out AlreadyExits) + 1;
+ if(!AlreadyExits)
+ {
+ MulticastDelegate DelegateObj= (MulticastDelegate)DelegateObject;
+ if(DelegateObj != null)
+ {
+ ObjectWrt.WriteObjectToXml(AssemblyIndex, DelegatesIndex, cDelegateSerClass); //write the delegates's init
+ SerializeStringField(cDelegateType, DelegateObj.GetType().FullName, DelegatesIndex); //the delegate type
+ SerializeStringField(cDelegateAssembly, DelegateObj.GetType().Assembly.FullName, DelegatesIndex); //the delegate assembly
+ int FieldIndex= SerializeObject(DelegateObj.Target, DelegatesIndex); //Serialize the target
+ ObjectWrt.WriteObjectFieldToXml(cTarget, DelegatesIndex, FieldIndex);
+ SerializeStringField(cTargetTypAssem, DelegateObj.Target.GetType().Assembly.FullName, DelegatesIndex);
+ SerializeStringField(cTargetTypName, DelegateObj.Target.GetType().FullName, DelegatesIndex);
+ SerializeStringField(cMethodName, DelegateObj.Method.Name, DelegatesIndex);
+ }
+ }
+ return DelegatesIndex;
+ }
+
+ private int SerializeObject(object graph, int ParentIndex)
+ {
+ string ClassName;
+ int AssemblyIndex, ObjectIndex;
+ bool AlreadyExits;
+ if(graph.GetType().IsSerializable)
+ {
+ object ActualObject= graph;
+ ObjectIndex= AddObject(ActualObject, out AlreadyExits) + 1; //add the object to the object's list
+ if(!AlreadyExits)
+ {
+ AssemblyIndex= AddAssemblytoXml(ActualObject.GetType()) + 1;//add the assembly to the assemblies's list
+ ClassName= graph.GetType().Name; //the class's name
+ ObjectWrt.WriteObjectToXml(AssemblyIndex, ObjectIndex, ClassName); //write the object to the xml list
+ FieldInfo[] fieldtypes = ActualObject.GetType().GetFields(BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance); //get the fields
+ for(int index = 0; index<= fieldtypes.Length - 1; index++)
+ {
+ if(!fieldtypes[index].IsNotSerialized)
+ {
+ AssemblyIndex= AddAssemblytoXml(fieldtypes[index].FieldType);
+ if(fieldtypes[index].FieldType.IsValueType)//if the field is a value type
+ SerializeValueTypes(ActualObject, fieldtypes[index], ObjectIndex);
+ else
+ SerializeReferenceTypes(ObjectIndex, fieldtypes[index].GetValue(ActualObject), fieldtypes[index].FieldType, fieldtypes[index].Name);
+ }
+ }
+ }
+ return ObjectIndex;
+ }
+ else
+ return -15000;
+ }
+
+ public void BeginWrite() //writes the basic elements of a soap message
+ {
+ }
+
+ public ObjectSerializer(Stream store) //assign the current stream
+ {
+ FCurrentStream = store;
+ AssemblyList = new ArrayList(); //Init the lists
+ XmlObjectList = new ArrayList();
+ FObjectList = new ArrayList();
+ ObjectWrt = new SoapWriter();
+ ObjectWrt.FXmlObjectList= XmlObjectList;
+ }
+
+ public void CleatLists()
+ {
+ AssemblyList.Clear();
+ XmlObjectList.Clear();
+ FObjectList.Clear();
+ }
+
+ public void Serialize(object graph)
+ {
+ SerializeObject(graph, 0);
+ String FCurrentXml =
+ startdoc_start +
+ ConcatAssembliesToXml() +
+ startdoc_middle +
+ ObjectWrt.ConcatenateObjectList () +
+ startdoc_end;
+ XmlDocument XmlDoc = new XmlDocument();
+ XmlDoc.LoadXml (FCurrentXml);
+ UTF8Encoding enc = new UTF8Encoding (false, true);
+ byte [] bytes = enc.GetBytes (XmlDoc.InnerXml);
+ FCurrentStream.Write (bytes, 0, bytes.Length);
+ CleatLists();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs
new file mode 100755
index 00000000000..285c8ffe8d9
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs
@@ -0,0 +1,91 @@
+/****************************************************/
+/*Soapformatter class implementation */
+/*Author: Jesús M. Rodríguez de la Vega */
+/*gsus@brujula.net */
+/****************************************************/
+
+using System;
+using System.Reflection;
+using System.Xml;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters;
+
+
+namespace System.Runtime.Serialization.Formatters.Soap
+{
+ public class SoapFormatter : IRemotingFormatter, IFormatter
+ {
+ private ObjectSerializer ObjSerializer;
+ private ObjectDeserializer ObjDeserializer;
+ /*this is the soapformater's properties
+ the Binder, Context and SurrogateSelector properties
+ have not been declared yet*/
+
+ public FormatterAssemblyStyle AssemblyFormat
+ {
+ get{return AssemblyFormat;}
+ set{AssemblyFormat= value;}
+ }
+
+ [MonoTODO]
+ public SerializationBinder Binder {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public StreamingContext Context {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public ISurrogateSelector SurrogateSelector {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public ISoapMessage TopObject
+ {
+ get{return TopObject;}
+ set{TopObject= value;}
+ }
+
+ public FormatterTypeStyle TypeFormat
+ {
+ get{return TypeFormat;}
+ set{TypeFormat= value;}
+ }
+
+ //the other constructor are not supplied yet
+ public SoapFormatter()
+ {
+ }
+
+ public void Serialize(Stream serializationStream, object graph)
+ {
+ Serialize (serializationStream, graph, null);
+ }
+
+ public void Serialize(Stream serializationStream, object graph, Header[] headers)
+ {
+ ObjSerializer= new ObjectSerializer(serializationStream);
+ ObjSerializer.BeginWrite();
+ ObjSerializer.Serialize(graph);
+ }
+
+ public object Deserialize(Stream serializationStream)
+ {
+ return Deserialize (serializationStream, null);
+ }
+
+ public object Deserialize(Stream serializationStream, HeaderHandler handler)
+ {
+ ObjDeserializer= new ObjectDeserializer(serializationStream);
+ return ObjDeserializer.Deserialize(serializationStream);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs
new file mode 100755
index 00000000000..e5a90883198
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapReader.cs
@@ -0,0 +1,586 @@
+using System;
+using System.Xml;
+using System.Reflection;
+
+namespace System.Runtime.Serialization.Formatters.Soap
+{
+
+ public enum ReferenceTypes {Array_Type, Object_Type, Interface_Type, Delegate_Type, String_Type};
+
+ internal class SoapReader
+ {
+ /******const section******/
+ const string xmlns_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
+ const string xmlns_SOAP_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
+
+ const string cSoapRef = "href";
+ const string cObjectRef = "ref-";
+ const string cId = "id";
+ const string cXsiNull = "xsi:null";
+ const string basicassembly = "mscorlib";
+ const string startxmlns = "xmlns:a";
+ const string Systemns = "http://schemas.microsoft.com/clr/ns/System";
+ const string cDefaultValue = "_0x00_";
+ /******Array's serialization section******/
+ const string cItem = "item";
+ const string cSoapEncArray = "SOAP-ENC:Array";
+ const string cSoapArrayType = "SOAP-ENC:arrayType";
+ const string cXsiType = "xsi:type";
+ const string cNullObject = "xsi:null=\"1\"/";
+ /******Delegate's serialization section******/
+ const string cDelegateSerClass = "DelegateSerializationHolder";
+ const string cDelegateType = "DelegateType";
+ const string cDelegateAssembly = "DelegateAssembly";
+ /******fields's section******/
+ public XmlDocument FXmlDoc;
+ public XmlElement DeepElement; //the current Xml Struct Element
+ //public Utils FUtils;
+
+ public SoapReader()
+ {
+ //FUtils= new Utils();
+ }
+
+ /**Reference Types reader**/
+ public int ReadObjectIndexFromXml(string ObjectElemt)
+ {
+ XmlNodeList ObjectElement= FXmlDoc.DocumentElement.GetElementsByTagName(ObjectElemt);
+ XmlElement FCurrentElement= (XmlElement)ObjectElement.Item(0);
+ string refid= (FCurrentElement).GetAttribute(cId);
+ int startindex= refid.IndexOf("-");
+ refid= refid.Substring(startindex + 1, refid.Length - startindex - 1);
+ return Convert.ToInt32(refid);
+ }
+
+ private string ReadReferenceFullNameFromXmlNode(XmlNode ReferenceNode)
+ {
+ int StartIndex= ReferenceNode.Name.IndexOf(":");
+ string ClassName= ReferenceNode.Name.Substring(StartIndex + 1, ReferenceNode.Name.Length - StartIndex - 1);
+ string AttributeName= FXmlDoc.DocumentElement.Attributes.GetNamedItem("xmlns:" + ReferenceNode.Name.Substring(0, StartIndex)).Value;
+ StartIndex= AttributeName.LastIndexOf("/");
+ string TempStr= AttributeName.Substring(0, StartIndex);
+ StartIndex= TempStr.LastIndexOf("/");
+ string ReferenceFullName= TempStr.Substring(StartIndex + 1, TempStr.Length - StartIndex - 1);
+ return ReferenceFullName + "." + ClassName;
+ }
+
+ public string ReadReferenceFullNameFromXml(string RefereneId)
+ {
+ string RefId= cObjectRef + RefereneId;
+ XmlNodeList NodeList = FXmlDoc.DocumentElement.GetElementsByTagName("Body", xmlns_SOAP_ENV).Item(0).ChildNodes;
+ bool Continue= true;
+ int index= 0;
+ string Result= "";
+ while((Continue)&&(index <= NodeList.Count - 1))
+ {
+ XmlElement ActElement= (XmlElement)NodeList.Item(index);
+ if(ActElement.GetAttribute("id")== RefId)//the attributes match
+ {
+ Result= ReadReferenceFullNameFromXmlNode(ActElement);
+ Continue= false;
+ }
+ else
+ index++;
+ }
+ return Result;
+ }
+
+ /**ReadReferenceIndexFromXml**/
+ public int ReadReferenceIndexFromXml(string FieldName, XmlElement ParentElement)
+ {
+ XmlElement FieldElement= (XmlElement)ParentElement.GetElementsByTagName(FieldName).Item(0);
+ if(FieldElement.GetAttribute(cXsiNull)== "") //if it is not a null field
+ {
+ string hrefvalue= FieldElement.GetAttribute(cSoapRef);
+ int StartIndex= hrefvalue.IndexOf("-");
+ return Convert.ToInt32(hrefvalue.Substring(StartIndex + 1, hrefvalue.Length - 1 - StartIndex));
+ }
+ else
+ return -1;
+ }
+
+ public int ReadReferenceIndexFromXml(int ItemIndex, XmlElement ParentElement)
+ {
+ XmlElement FieldElement= (XmlElement)ParentElement.ChildNodes.Item(ItemIndex);
+ if(FieldElement.GetAttribute(cXsiNull)== "") //if it is not a null field
+ {
+ string hrefvalue= FieldElement.GetAttribute(cSoapRef);
+ int StartIndex= hrefvalue.IndexOf("-");
+ return Convert.ToInt32(hrefvalue.Substring(StartIndex + 1, hrefvalue.Length - 1 - StartIndex));
+ }
+ else
+ return -1;
+ }
+
+
+
+ /**String reader**/
+ public int ReadStringIdFromXml(/*string XmlParentElement, */string FieldName,/* string XmlParentElementId, */XmlElement ParentElement)
+ {
+ XmlElement FieldElement= (XmlElement)ParentElement.GetElementsByTagName(FieldName).Item(0);//(XmlElement)GetCurrentElement(XmlParentElement, XmlParentElementId).GetElementsByTagName(FieldName).Item(0);
+ if(FieldElement.GetAttribute(cId)== "")
+ return ReadReferenceIndexFromXml(FieldName, ParentElement);
+ else
+ return ReadFieldIdValueFromXml(FieldName, ParentElement);
+ }
+
+ public int ReadStringIdFromXml(int ItemIndex, XmlElement ParentElement)
+ {
+ XmlElement FieldElement= (XmlElement)ParentElement.ChildNodes.Item(ItemIndex);
+ string StrId= FieldElement.GetAttribute(cId);
+ if(StrId == "")
+ return ReadReferenceIndexFromXml(ItemIndex, ParentElement);
+ else
+ return ReadFieldIdValueFromXml(ItemIndex, ParentElement);
+ }
+
+ public string ReadStringTypeFromXml(string FieldName, XmlElement ParentElement)
+ {
+ XmlNode XmlField= ParentElement.GetElementsByTagName(FieldName).Item(0);
+ if(XmlField!= null)
+ return XmlField.InnerXml;
+ else
+ return null;
+ }
+
+ public string ReadStringTypeFromXml(int ItemIndex, XmlElement ParentElement)
+ {
+ XmlNode XmlField= ParentElement.ChildNodes.Item(ItemIndex);
+ if(XmlField!= null)
+ return XmlField.InnerXml;
+ else
+ return null;
+ }
+
+ /**Delegates reader**/
+ public string GetDelegateElementName(int DelegateId)
+ {
+ XmlAttributeCollection XmlAttrCollection= FXmlDoc.DocumentElement.Attributes;
+ bool Continue= true;
+ int i= 0;
+ string ItemName= "";
+ while((Continue)&&(i<= XmlAttrCollection.Count - 1))
+ {
+ string AttrValue= XmlAttrCollection.Item(i).Value;
+ if(AttrValue == Systemns)
+ {
+ ItemName= XmlAttrCollection.Item(i).Name;
+ ItemName= ItemName.Substring(ItemName.LastIndexOf(":") + 1, ItemName.Length - 1 - ItemName.LastIndexOf(":"));
+ Continue= false;
+ }
+ i++;
+ }
+ return ItemName + ":" + cDelegateSerClass;
+ }
+
+ public Type GetDelegateTypeFromXml(XmlElement ParentElement)
+ {
+ string DelegateAssembly= ParentElement.GetElementsByTagName(cDelegateAssembly).Item(0).InnerXml;
+ DelegateAssembly= DelegateAssembly.Substring(0, DelegateAssembly.IndexOf(","));
+ string DelegateType= ParentElement.GetElementsByTagName(cDelegateType).Item(0).InnerXml;
+ return Assembly.Load(DelegateAssembly).GetType(DelegateType);
+ }
+
+ /**Arrays reader**/
+ public string ReadArrayTypeFromXml(XmlElement ArrayElement, out string AssemblyName)
+ {
+ string ArrayTypeAttr= ArrayElement.GetAttribute(cSoapArrayType);
+ int StartIndex= ArrayTypeAttr.LastIndexOf(":");
+ string Result;
+ if(ArrayTypeAttr.Substring(0, 4) == "xsd:")
+ {
+ Result= "System";
+ string CLRType= GetCLRTypeFromXsdType(ArrayTypeAttr.Substring(0, ArrayTypeAttr.IndexOf("[")));
+ StartIndex= ArrayTypeAttr.IndexOf("[");
+ Result= "System." + CLRType + ArrayTypeAttr.Substring(StartIndex, ArrayTypeAttr.Length - StartIndex);
+ AssemblyName= basicassembly;
+ }
+ else
+ {
+ AssemblyName= ReadAssemblyNameFromXml(ArrayTypeAttr);
+ string NsIndex= ArrayTypeAttr.Substring(1, StartIndex - 1);
+ Result= ReadNamespaceFromXml(NsIndex);
+ Result= Result + "." + ArrayTypeAttr.Substring(StartIndex + 1, ArrayTypeAttr.Length - StartIndex - 1);
+ }
+ return Result;
+ }
+
+
+ public bool IsArrayItemValueType(XmlElement ParentElement, int ItemIndex, ref bool IsNull, ref bool IsStruct)
+ {
+ XmlElement ArrayItem= (XmlElement)ParentElement.ChildNodes.Item(ItemIndex);
+ bool Result= false;
+ if(ArrayItem.GetAttribute(cXsiNull)== "")//is not null
+ {
+ IsNull= false;
+ if((ArrayItem.InnerXml != "")&&(ArrayItem.GetAttribute(cId) == ""))
+ {
+ Result= true;
+ if(ArrayItem.InnerXml.Substring(0, 1)== "<") //is an atruct
+ IsStruct= true;
+ }
+ }
+ else
+ IsNull= true;
+ return Result;
+ }
+
+ public ValueType ReadArrayItemSimpleTypeFromXml(XmlElement ParentElement, int ItemIndex, string ItemTypeName)
+ {
+ XmlElement ArrayItem= (XmlElement)ParentElement.ChildNodes.Item(ItemIndex);//at this moment you know that this field is a value type
+ string ItemValue= ArrayItem.InnerXml;
+ string XsiType= ((XmlElement)ArrayItem).GetAttribute(cXsiType);
+ if(XsiType != "")
+ return GetValueTypeFromXsdType(XsiType, ItemValue);
+ else
+ return GetValueTypeFromString(ItemTypeName, ItemValue);
+ }
+
+ public ReferenceTypes GetReferenceType(string FieldName, XmlElement ParentElement, ref XmlElement RefElement)
+ {
+ XmlElement ArrayItem= (XmlElement)ParentElement.GetElementsByTagName(FieldName).Item(0);
+ RefElement= ArrayItem;
+ ReferenceTypes Result= ReferenceTypes.Object_Type;
+ if(ArrayItem.GetAttribute(cId) != "") //is an string
+ Result= ReferenceTypes.String_Type;
+ else
+ {
+ string RefIndex= ArrayItem.GetAttribute(cSoapRef);
+ if(RefIndex != "") //is a other reference
+ {
+ int Id= RefIndex.IndexOf("-");
+ Id= Convert.ToInt32(RefIndex.Substring(Id + 1, RefIndex.Length - 1 - Id));
+ string RefName= GetReferenceNameFromId(Convert.ToInt32(Id), ref RefElement);
+ if(RefName== cSoapEncArray) //is an array
+ Result= ReferenceTypes.Array_Type;
+ else
+ if(RefName == "")
+ Result= ReferenceTypes.String_Type;
+ else
+ {
+ if((RefName.IndexOf(cDelegateSerClass) != -1)&&(RefElement.ChildNodes.Item(0).Name== cDelegateType)) //is a delegates
+ Result= ReferenceTypes.Delegate_Type;
+ else
+ Result= ReferenceTypes.Object_Type;
+ }
+ }
+ }
+ return Result;
+ }
+
+ public ReferenceTypes GetReferenceType(int index, XmlElement ParentElement, ref XmlElement RefElement)
+ {
+ XmlElement ArrayItem= (XmlElement)ParentElement.ChildNodes.Item(index);
+ RefElement= ArrayItem;
+ ReferenceTypes Result= ReferenceTypes.Object_Type;
+ if(ArrayItem.GetAttribute(cId) != "") //is an string
+ Result= ReferenceTypes.String_Type;
+ else
+ {
+ string RefIndex= ArrayItem.GetAttribute(cSoapRef);
+ if(RefIndex != "") //is a other reference
+ {
+ int Id= RefIndex.IndexOf("-");
+ Id= Convert.ToInt32(RefIndex.Substring(Id + 1, RefIndex.Length - 1 - Id));
+ string RefName= GetReferenceNameFromId(Convert.ToInt32(Id), ref RefElement);
+ if(RefName== cSoapEncArray) //is an array
+ Result= ReferenceTypes.Array_Type;
+ else
+ if(RefName == "")
+ Result= ReferenceTypes.String_Type;
+ else
+ {
+ if((RefName.IndexOf(cDelegateSerClass) != -1)&&(RefElement.ChildNodes.Item(0).Name== cDelegateType)) //is a delegates
+ Result= ReferenceTypes.Delegate_Type;
+ else
+ Result= ReferenceTypes.Object_Type;
+ }
+ }
+ }
+ return Result;
+ }
+
+ public string GetFullObjectLocation(string XsdType, out string NsName)
+ {
+ string AssemblyName= ReadAssemblyNameFromXml(XsdType);
+ int StartIndex= XsdType.LastIndexOf(":");
+ string NsIndex= XsdType.Substring(1, StartIndex - 1);
+ NsName= ReadNamespaceFromXml(NsIndex);
+ NsName= NsName + "." + XsdType.Substring(StartIndex + 1, XsdType.Length - StartIndex - 1);
+ return AssemblyName;
+ }
+
+ private ValueType GetValueTypeFromNotSimpleType(string XsdType, string ItemValue)
+ {
+ string NsName;
+ string AssemblyName= GetFullObjectLocation(XsdType, out NsName);
+ Type ItemType= Assembly.Load(AssemblyName).GetType(NsName);
+ object Result;
+ if(ItemType.IsEnum)//is an enum
+ Result= Enum.Parse(ItemType, ItemValue);
+ else //is a char
+ {
+ if(ItemValue == cDefaultValue)
+ Result= new char();
+ else
+ Result= Char.Parse(ItemValue);
+ }
+ return (ValueType)Result;
+ }
+
+ private string GetCLRTypeFromXsdType(string XsdType)
+ {
+ string Result= "";
+ switch(XsdType)
+ {
+ case "xsd:int" :Result= "Int32";
+ break;
+ case "xsd:short" :Result= "Int16";
+ break;
+ case "xsd:long" :Result= "Int64";
+ break;
+ case "xsd:unsignedInt" :Result= "UInt32";
+ break;
+ case "xsd:unsignedShort":Result= "UInt16";
+ break;
+ case "xsd:unsignedLong" :Result= "UInt64";
+ break;
+ case "xsd:byte" :Result= "Byte";
+ break;
+ case "xsd:decimal" :Result= "Decimal";
+ break;
+ case "xsd:double" :Result= "Double";
+ break;
+ case "xsd:boolean" :Result= "Boolean";
+ break;
+ case "xsd:dateTime" :Result= "DateTime";
+ break;
+ case "xsd:string" :Result= "String";
+ break;
+ }
+ return Result;
+ }
+
+ public ValueType GetValueTypeFromXsdType(string XsdType, string ItemValue)
+ {
+ ValueType Result= null;
+ switch(XsdType)
+ {
+ case "xsd:int" : Result= Convert.ToInt32(ItemValue);
+ break;
+ case "xsd:short" :Result= Convert.ToInt16(ItemValue);
+ break;
+ case "xsd:long" :Result= Convert.ToInt64(ItemValue);
+ break;
+ case "xsd:unsignedInt" :Result= Convert.ToUInt32(ItemValue);
+ break;
+ case "xsd:unsignedShort":Result= Convert.ToUInt16(ItemValue);
+ break;
+ case "xsd:unsignedLong" :Result= Convert.ToUInt64(ItemValue);
+ break;
+ case "xsd:byte" :Result= Convert.ToByte(ItemValue);
+ break;
+ case "xsd:decimal" :Result= Convert.ToDecimal(ItemValue);
+ break;
+ case "xsd:double" :Result= Convert.ToDouble(ItemValue);
+ break;
+ case "xsd:boolean" :Result= Convert.ToBoolean(ItemValue);
+ break;
+ case "xsd:dateTime" :Result= Convert.ToDateTime(ItemValue);
+ break;
+ default :Result= GetValueTypeFromNotSimpleType(XsdType, ItemValue);
+ break;
+ }
+ return Result;
+ }
+
+ /**Value types reader**/
+ public string ReadValueTypeFromXml(string FieldName, XmlElement ParentElement/*string ParentElement, string ParentElementId*/)
+ {
+ XmlNode XmlField= ParentElement.GetElementsByTagName(FieldName).Item(0);///*FCurrentElement*/GetCurrentElement(ParentElement, ParentElementId).GetElementsByTagName(FieldName).Item(0);
+ if(XmlField!= null)
+ return XmlField.InnerXml;
+ else
+ return null;
+ }
+
+ public ValueType GetValueTypeFromString(string fieldtype, string fieldvalue)
+ {
+ ValueType result= null;
+ switch(fieldtype)
+ {
+ case "Int32" : result= Convert.ToInt32(fieldvalue);
+ break;
+ case "Int16" : result= Convert.ToInt16(fieldvalue);
+ break;
+ case "Int64" : result= Convert.ToInt64(fieldvalue);
+ break;
+ case "UInt32" : result= Convert.ToUInt32(fieldvalue);
+ break;
+ case "UInt16" : result= Convert.ToUInt16(fieldvalue);
+ break;
+ case "UInt64" : result= Convert.ToUInt64(fieldvalue);
+ break;
+ case "Byte" : result= Convert.ToByte(fieldvalue);
+ break;
+ case "Decimal" : result= Convert.ToDecimal(fieldvalue);
+ break;
+ case "Double" : result= Convert.ToDouble(fieldvalue);
+ break;
+ case "Boolean" : result= Convert.ToBoolean(fieldvalue);
+ break;
+ case "DateTime" : result= Convert.ToDateTime(fieldvalue);
+ break;
+ case "Char" : result= Convert.ToChar(fieldvalue);
+ break;
+ }
+ return result;
+ }
+
+ /**Structs reader**/
+ public string ReadStructValueFieldFromXml(/*string XmlParentElement, */string FieldName, XmlElement ParentElement/*string XmlParentElementId, */, string StructName, bool NestedStruct)
+ {
+ XmlElement FieldElement;
+ FieldElement= (XmlElement)ParentElement.GetElementsByTagName(FieldName).Item(0);
+ if(FieldElement != null)
+ return FieldElement.InnerXml;
+ else
+ return null;
+ }
+
+ public void ReadStructParentElementFromXml(string StructName, XmlElement ParentElement, bool NestedStruct)
+ {
+ if(!NestedStruct)//is not a nested struct
+ DeepElement= (XmlElement)ParentElement.GetElementsByTagName(StructName).Item(0);//GetCurrentElement(XmlParentElement, XmlParentElementId).GetElementsByTagName(StructName).Item(0);
+ else
+ DeepElement= (XmlElement)DeepElement.GetElementsByTagName(StructName).Item(0);
+ }
+
+ /**Assemblies reader**/
+ public string GetAssemblyNameFromId(int id)
+ {
+ XmlNodeList ObjList= ((XmlElement)FXmlDoc.DocumentElement.GetElementsByTagName("Body", xmlns_SOAP_ENV).Item(0)).ChildNodes;
+ bool Continue= true;
+ int index= 0;
+ string AssemblyName= "";
+ while((Continue)&&(index<= ObjList.Count - 1))
+ {
+ string refid= ((XmlElement)ObjList.Item(index)).GetAttribute(cId);
+ int StartIndex= refid.IndexOf("-");
+ refid= refid.Substring(StartIndex + 1, refid.Length - 1 - StartIndex);
+ if(refid== id.ToString())
+ {
+ Continue= false;
+ AssemblyName= ReadAssemblyNameFromXml(((XmlElement)ObjList.Item(index)).Name);
+ }
+ else
+ index++;
+ }
+ return AssemblyName;
+ }
+
+ private string GetReferenceNameFromId(int id, ref XmlElement RefElement)
+ {
+ XmlNodeList ObjList= ((XmlElement)FXmlDoc.DocumentElement.GetElementsByTagName("Body", xmlns_SOAP_ENV).Item(0)).ChildNodes;
+ bool Continue= true;
+ int index= 0;
+ string Result= "";
+ while((Continue)&&(index<= ObjList.Count - 1))
+ {
+ string refid= ((XmlElement)ObjList.Item(index)).GetAttribute(cId);
+ int StartIndex= refid.IndexOf("-");
+ refid= refid.Substring(StartIndex + 1, refid.Length - 1 - StartIndex);
+ if(refid== id.ToString())
+ {
+ Continue= false;
+ Result= ((XmlElement)ObjList.Item(index)).Name;
+ RefElement= (XmlElement)ObjList.Item(index);
+ }
+ else
+ index++;
+ }
+ return Result;
+ }
+
+ public string ReadAssemblyNameFromXml(string ParentElementName)
+ {
+ string RefName= ParentElementName.Substring(1, ParentElementName.LastIndexOf(":") - 1);
+ string XmlNamespaceName= startxmlns + RefName;
+ string AttributeName= FXmlDoc.DocumentElement.Attributes.GetNamedItem(XmlNamespaceName).Value;
+ int StartIndex= AttributeName.LastIndexOf("/");
+ string AssemblyName= AttributeName.Substring(StartIndex + 1, AttributeName.Length - StartIndex - 1);
+ if(AssemblyName == "System")
+ AssemblyName= basicassembly;
+ return AssemblyName;
+ }
+
+ /**Namespace reader**/
+ public string ReadNamespaceFromXml(string ReferenceName)
+ {
+ string XmlNamespaceName= startxmlns + ReferenceName;
+ string AttributeName= FXmlDoc.DocumentElement.Attributes.GetNamedItem(XmlNamespaceName).Value;
+ int StartIndex= AttributeName.LastIndexOf("/");
+ string Result= "";
+ string NsName= AttributeName.Substring(StartIndex + 1, AttributeName.Length - StartIndex - 1);
+ if(NsName == "System")
+ Result= NsName;
+ else
+ {
+ string TmpStr= AttributeName.Substring(0, StartIndex);
+ StartIndex= TmpStr.LastIndexOf("/");
+ Result= TmpStr.Substring(StartIndex + 1, TmpStr.Length - StartIndex - 1);
+ }
+ return Result;
+
+ }
+
+ /**Utils**/
+ public XmlElement GetCurrentElement(string ElementName, string ElementId)
+ {
+ string RefId= cObjectRef + ElementId;
+ XmlNodeList NodeList = ((XmlElement)FXmlDoc.DocumentElement.GetElementsByTagName("Body", xmlns_SOAP_ENV).Item(0)).GetElementsByTagName(ElementName);
+ bool Continue= true;
+ int index= 0;
+ string Result= "";
+ XmlElement ActElement = null;
+ while((Continue)&&(index <= NodeList.Count - 1))
+ {
+ ActElement= (XmlElement)NodeList.Item(index);
+ if(ActElement.GetAttribute("id")== RefId)//the attributes match
+ Continue= false;
+ else
+ index++;
+ }
+ if(!Continue)
+ return ActElement;
+ else
+ return null;
+ }
+
+ private int ReadFieldIdValueFromXml(string FieldName, XmlElement ParentElement)
+ {
+ XmlElement FieldElement= (XmlElement)ParentElement.GetElementsByTagName(FieldName).Item(0);//(XmlElement)GetCurrentElement(XmlParentElement, XmlParentElementId).GetElementsByTagName(FieldName).Item(0);
+ if(FieldElement.GetAttribute(cXsiNull)== "") //if it is not a null field
+ {
+ string refvalue= FieldElement.GetAttribute(cId);
+ int StartIndex= refvalue.IndexOf("-");
+ return Convert.ToInt32(refvalue.Substring(StartIndex + 1, refvalue.Length - 1 - StartIndex));
+ }
+ else
+ return -1;
+ }
+
+ private int ReadFieldIdValueFromXml(int ItemIndex, XmlElement ParentElement)
+ {
+ XmlElement FieldElement= (XmlElement)ParentElement.ChildNodes.Item(ItemIndex);
+ if(FieldElement.GetAttribute(cXsiNull)== "") //if it is not a null field
+ {
+ string refvalue= FieldElement.GetAttribute(cId);
+ int StartIndex= refvalue.IndexOf("-");
+ return Convert.ToInt32(refvalue.Substring(StartIndex + 1, refvalue.Length - 1 - StartIndex));
+ }
+ else
+ return -1;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs
new file mode 100755
index 00000000000..b93ef9d9990
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs
@@ -0,0 +1,213 @@
+/****************************************************/
+/*SoapWritter class implementation */
+/*Author: Jes·s M. Rodr­guez de la Vega */
+/*gsus@brujula.net */
+/****************************************************/
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Xml;
+using System.IO;
+
+namespace System.Runtime.Serialization.Formatters.Soap
+{
+
+ internal class SoapWriter
+ {
+ /******const section******/
+ const string cNullObject = "xsi:null=\"1\"/";
+ const string cSoapEnv = "Body";
+ const string xmlns_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
+ const string xmlns_SOAP_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
+
+ const string cStartTag = "<";
+ const string cEndTag = ">";
+ const string cNumber = "#";
+ const string cEqual = "=";
+ const string cTwoColon = ":";
+ const string cAssId = "a";
+ const string cslash = "/";
+ const string cSoapRef = "href";
+ const string cObjectRef = "ref-";
+ const string cId = "id";
+ /******Array's serialization section******/
+ const string cItem = "item";
+ const string cSoapEncArray = "SOAP-ENC:Array";
+ const string cSoapArrayType = "SOAP-ENC:arrayType";
+ const string cXsiType = "xsi:type";
+ /******field's section******/
+ public ArrayList FXmlObjectList;
+ public int FReferenceNumber;
+ /******method's section******/
+ public string ConcatenateObjectList()
+ {
+ string XmlResult= "";
+ object[] XmlList= FXmlObjectList.ToArray();
+ for(int index= 0; index<= FXmlObjectList.Count - 1; index++)
+ XmlResult= XmlResult + XmlList[index].ToString();
+ return XmlResult;
+ }
+
+ private StringBuilder GetXmlObject(int ObjectIndex)
+ {
+ object[] XmlList= FXmlObjectList.ToArray();
+ string Actstring= XmlList[ObjectIndex - 1].ToString();
+ return new StringBuilder(Actstring);
+ }
+
+ public void WriteObjectToXml(int AssemblyIndex, int ReferenceIndex, string ClassName)
+ {
+ StringBuilder ObjWriter= new StringBuilder();
+ string XmlStartTag= cStartTag + cAssId + AssemblyIndex.ToString() + cTwoColon + ClassName +
+ ' ' + cId + cEqual + '"' + cObjectRef + ReferenceIndex + '"' + cEndTag;
+ string XmlEndTag= cStartTag + cslash + cAssId + AssemblyIndex.ToString() + cTwoColon + ClassName + cEndTag;
+ ObjWriter.Append(XmlStartTag);
+ ObjWriter.Append(XmlEndTag);
+ FXmlObjectList.Add(ObjWriter.ToString());
+ }
+
+ public void WriteArrayToXml(string XmlSchemaArrayType, int ArrayIndex)
+ {
+ StringBuilder ObjWriter= new StringBuilder();
+ string XmlStartTag= cStartTag + cSoapEncArray + ' ' + cId + cEqual + '"' +
+ cObjectRef + ArrayIndex + '"' + ' ' + cSoapArrayType +
+ cEqual + XmlSchemaArrayType + cEndTag;
+ string XmlEndTag= cStartTag + cslash + cSoapEncArray + cEndTag;
+ ObjWriter.Append(XmlStartTag);
+ ObjWriter.Append(XmlEndTag);
+ FXmlObjectList.Add(ObjWriter.ToString());
+ }
+
+ public void WriteStringTypeToXml(string StringName, string StringValue, int ParentObjectIndex, int StringIndex)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ParentObjectIndex);
+ string StrFieldStartTag= cStartTag + StringName + ' ' + cId + cEqual + '"' + cObjectRef + StringIndex + '"' + cEndTag;
+ string StrFieldEndTag = cStartTag + cslash + StringName + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, StrFieldStartTag + StringValue + StrFieldEndTag);
+ FXmlObjectList.RemoveAt(ParentObjectIndex - 1);
+ FXmlObjectList.Insert(ParentObjectIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteObjectFieldToXml(string FieldName, int ParentObjectIndex, int ObjectIndex)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ParentObjectIndex);
+ string XmlField= cStartTag + FieldName + ' ' + cSoapRef + cEqual
+ + '"' + cNumber + cObjectRef + ObjectIndex.ToString() + '"'+ cslash + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, XmlField);
+ FXmlObjectList.RemoveAt(ParentObjectIndex - 1);
+ FXmlObjectList.Insert(ParentObjectIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteNullObjectFieldToXml(string FieldName, int ParentObjectIndex)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ParentObjectIndex);
+ string XmlField= cStartTag + FieldName + ' ' + cNullObject + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, XmlField);
+ FXmlObjectList.RemoveAt(ParentObjectIndex - 1);
+ FXmlObjectList.Insert(ParentObjectIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteValueTypeToXml(string FieldName, string FieldValue, int ObjectIndex)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ObjectIndex);
+ string XmlField= cStartTag + FieldName + cEndTag + FieldValue +
+ cStartTag + cslash + FieldName + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, XmlField);
+ FXmlObjectList.RemoveAt(ObjectIndex - 1);
+ FXmlObjectList.Insert(ObjectIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteStructInitTagToXml(string StructName, int ObjectIndex, bool XsiType, int AssemblyIndex, string StructType)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ObjectIndex);
+ string StructInitTag= cStartTag + StructName;
+ if(XsiType)
+ StructInitTag= StructInitTag + ' ' + cXsiType + cEqual + '"' + "a" + AssemblyIndex + cTwoColon + StructType + '"';
+ StructInitTag= StructInitTag + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, StructInitTag);
+ FXmlObjectList.RemoveAt(ObjectIndex - 1);
+ FXmlObjectList.Insert(ObjectIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteStructEndTagToXml(string StructName, int ObjectIndex)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ObjectIndex);
+ string StructInitTag= cStartTag + cslash + StructName + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, StructInitTag);
+ FXmlObjectList.RemoveAt(ObjectIndex - 1);
+ FXmlObjectList.Insert(ObjectIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteArrayValueItemToXml(string ItemType, string ItemValue, int ArrayIndex, string ArrayItemsType, int AssemblyIndex)
+ {
+ StringBuilder ObjWriter= GetXmlObject(ArrayIndex);
+ string ItemInitTag= cStartTag + cItem;
+ if(ArrayItemsType== "Object")
+ {
+ ItemInitTag= ItemInitTag + ' ' + cXsiType + cEqual + '"' + GenerateXmlSchemaType(ItemType, AssemblyIndex) + '"';
+ }
+ ItemInitTag= ItemInitTag + cEndTag + ItemValue + cStartTag + cslash + cItem + cEndTag;
+ int index= ObjWriter.ToString().LastIndexOf(cStartTag);
+ ObjWriter.Insert(index, ItemInitTag);
+ FXmlObjectList.RemoveAt(ArrayIndex - 1);
+ FXmlObjectList.Insert(ArrayIndex - 1, ObjWriter.ToString());
+ }
+
+ public void WriteStructTypeToXml(string StructName)
+ {
+ }
+
+ public string GenerateSchemaArrayType(string ArrayType, int ArrayLength, int AssemblyIndex)
+ {
+ string StrResult= ArrayType;
+ string ArrayItems= ArrayType.Substring(0, ArrayType.IndexOf("["));
+ string XmlSchType= GenerateXmlSchemaType(ArrayItems, AssemblyIndex);
+ StrResult=StrResult.Replace(ArrayItems, XmlSchType);
+ StrResult= StrResult.Insert(StrResult.LastIndexOf(']'), ArrayLength.ToString());
+ StrResult= '"' + StrResult + '"';
+ return StrResult;
+ }
+
+ public string GenerateXmlSchemaType(string TypeName, int AssemblyIndex)
+ {
+ string XmlSchType;
+ switch(TypeName)
+ {
+ case "Int32" : XmlSchType= "xsd:int";
+ break;
+ case "Int16" : XmlSchType= "xsd:short";
+ break;
+ case "Int64" : XmlSchType= "xsd:long";
+ break;
+ case "UInt32" : XmlSchType= "xsd:unsignedInt";
+ break;
+ case "UInt16" : XmlSchType= "xsd:unsignedShort";
+ break;
+ case "UInt64" : XmlSchType= "xsd:unsignedLong";
+ break;
+ case "Byte" : XmlSchType= "xsd:byte";
+ break;
+ case "Decimal" : XmlSchType= "xsd:decimal";
+ break;
+ case "Double" : XmlSchType= "xsd:double";
+ break;
+ case "String" : XmlSchType= "xsd:string";
+ break;
+ case "Boolean" : XmlSchType= "xsd:boolean";
+ break;
+ case "DateTime" : XmlSchType= "xsd:dateTime";
+ break;
+ default : XmlSchType= "a" + AssemblyIndex + cTwoColon + TypeName;
+ break;
+ }
+ return XmlSchType;
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/TODOAttribute.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/TODOAttribute.cs
new file mode 100755
index 00000000000..0b89c8b0a77
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization.Formatters.Soap {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/SoapSerializerTest.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/SoapSerializerTest.cs
new file mode 100644
index 00000000000..30e8904c2d8
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/SoapSerializerTest.cs
@@ -0,0 +1,38 @@
+using System;
+using System.IO;
+
+namespace testit
+{
+ [Serializable] public class SPoint
+ {
+ public Double x = 1;
+ public Double y = 2;
+ public SPoint () {;}
+ }
+ class Class1
+ {
+
+ static void serialize()
+ {
+ System.Runtime.Serialization.IFormatter xx =
+ new System.Runtime.Serialization.Formatters.Soap.SoapFormatter ();
+ FileStream _out = new FileStream ("out.xml", FileMode.Create, FileAccess.Write, FileShare.None);
+ xx.Serialize (_out, new SPoint());
+ }
+ static void deserialize()
+ {
+ System.Runtime.Serialization.IFormatter xx =
+ new System.Runtime.Serialization.Formatters.Soap.SoapFormatter ();
+ FileStream _out = new FileStream ("out.xml", FileMode.Open, FileAccess.Read, FileShare.Read);
+ SPoint ob = xx.Deserialize (_out) as SPoint;
+ Console.WriteLine (ob.x);
+ }
+ public static void Main (String [] args)
+ {
+ if (args.Length > 0)
+ deserialize();
+ else
+ serialize();
+ }
+ }
+}
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/list b/mcs/class/System.Runtime.Serialization.Formatters.Soap/list
new file mode 100644
index 00000000000..1584dbacbfb
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/list
@@ -0,0 +1,6 @@
+System.Runtime.Serialization.Formatters.Soap/ObjectDeserializer.cs
+System.Runtime.Serialization.Formatters.Soap/ObjectSerializer.cs
+System.Runtime.Serialization.Formatters.Soap/SoapFormatter.cs
+System.Runtime.Serialization.Formatters.Soap/SoapReader.cs
+System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs
+System.Runtime.Serialization.Formatters.Soap/TODOAttribute.cs
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.gnu b/mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.gnu
new file mode 100644
index 00000000000..20dca3bd6ff
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.Runtime.Serialization.Formatters.Soap.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System.Xml
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Security/ChangeLog b/mcs/class/System.Security/ChangeLog
new file mode 100644
index 00000000000..699b342991e
--- /dev/null
+++ b/mcs/class/System.Security/ChangeLog
@@ -0,0 +1,7 @@
+2003-01-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * System.Security.build: Simplified and fixed some issues.
+
+2002-11-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * System.Security.build: New. Nant build file for Windows.
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
new file mode 100644
index 00000000000..8b7882eea4d
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
@@ -0,0 +1,48 @@
+2003-01-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * KeyInfo.cs: Changed some protected declaration to private.
+ * KeyInfoName.cs: Changed some protected declaration to private.
+ * KeyInfoNode.cs: Changed some protected declaration to private.
+ * KeyInfoRetrievalMethod.cs: Changed some protected declaration to private.
+ * KeyInfoX509Data.cs: Changed some protected declaration to private.
+ * Transform.cs: Changed some protected declaration to private.
+ * XmlDsigBase64Transform.cs: Changed some protected declaration to private.
+ * XmlDsigC14NTransform.cs: Changed some protected declaration to private.
+ * XmlDsigC14NWithCommentsTransform.cs: Changed some protected declaration to private.
+ * XmlDsigEnvelopedSignatureTransform.cs: Changed some protected declaration to private.
+ * XmlDsigXPathTransform.cs: Changed some protected declaration to private.
+ * XmlDsigXsltTransform.cs: Changed some protected declaration to private.
+
+2002-11-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * TODOAttribute.cs: New. Still much to do ;-)
+ * XmlDsigXPathTransform.cs: Corrected to compile. Transform is non-
+ functionnal.
+ * XmlDsigXsltTransform.cs: Corrected to compile. Transform is non-
+ functionnal.
+
+2002-11-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DataObject.cs: New. Complete implementation.
+ * DSAKeyValue.cs: New. Complete implementation.
+ * KeyInfo.cs: New. Complete implementation.
+ * KeyInfoClause.cs: New. Abstract class (complete).
+ * KeyInfoName.cs: New. Complete implementation.
+ * KeyInfoNode.cs: New. Complete implementation.
+ * KeyInfoRetrievalMethod.cs: New. Complete implementation.
+ * KeyInfoX509Data.cs: New. Complete implementation.
+ * Reference.cs: New. Incomplete implementation.
+ * RSAKeyValue.cs: New. Complete implementation.
+ * Signature.cs: New. Almost complete implementation - returned
+ XML isn't exactly like the MS implementation.
+ * SignedInfo.cs: New. Complete except SignatureLength.
+ * SignedXml.cs: New. Minimal implementation (only enveloped signatures).
+ Still many TODO!
+ * Transform.cs: New. Abstract class (complete).
+ * TransformChain.cs: New. Complete implementation.
+ * XmlDsigBase64Transform.cs: New. Stub + basic logic.
+ * XmlDsigC14NTransform.cs: New. Stub + basic logic.
+ * XmlDsigC14NWithCommentsTransform.cs: New. Stub + basic logic.
+ * XmlDsigEnvelopedSignatureTransform.cs: New. Stub + basic logic.
+ * XmlDsigXPathTransform.cs: New. Stub + basic logic.
+ * XmlDsigXsltTransform.cs: New. Stub + basic logic.
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/DSAKeyValue.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/DSAKeyValue.cs
new file mode 100644
index 00000000000..e451cd16596
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/DSAKeyValue.cs
@@ -0,0 +1,60 @@
+//
+// DSAKeyValue.cs - DSAKeyInfo implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class DSAKeyValue : KeyInfoClause {
+
+ private DSA dsa;
+
+ public DSAKeyValue ()
+ {
+ dsa = DSA.Create ();
+ }
+
+ public DSAKeyValue (DSA key)
+ {
+ dsa = key;
+ }
+
+ public DSA Key
+ {
+ get { return dsa; }
+ set { dsa = value; }
+ }
+
+ public override XmlElement GetXml ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\">");
+ sb.Append (dsa.ToXmlString (false));
+ sb.Append ("</KeyValue>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml(sb.ToString ());
+ return doc.DocumentElement;
+ }
+
+ public override void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if ((value.LocalName == "KeyValue") && (value.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#"))
+ dsa.FromXmlString (value.InnerXml);
+ else
+ throw new CryptographicException ("value");
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs
new file mode 100644
index 00000000000..609bd452a23
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs
@@ -0,0 +1,162 @@
+//
+// DataObject.cs - DataObject implementation for XML Signature
+// http://www.w3.org/2000/09/xmldsig#Object
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+// XmlElement part of the signature
+// Note: Looks like KeyInfoNode (but the later is XmlElement inside KeyInfo)
+// required for "enveloping signatures"
+public class DataObject {
+
+ private string id;
+ private string mimeType;
+ private string encoding;
+ private string data;
+ private XmlDocument doc;
+
+ static private string xmldsig = "http://www.w3.org/2000/09/xmldsig#";
+
+ public DataObject ()
+ {
+ Build (null, null, null, null);
+ }
+
+ public DataObject (string id, string mimeType, string encoding, XmlElement data)
+ {
+ if (data == null)
+ throw new ArgumentNullException ("data");
+
+ Build (id, mimeType, encoding, data);
+ }
+
+ private void Build (string id, string mimeType, string encoding, XmlElement data)
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<Object ");
+ if (id != null) {
+ this.id = id;
+ sb.Append ("Id=\"");
+ sb.Append (id);
+ sb.Append ("\" ");
+ }
+ if (mimeType != null) {
+ this.mimeType = mimeType;
+ sb.Append ("MimeType=\"");
+ sb.Append (mimeType);
+ sb.Append ("\" ");
+ }
+ if (encoding != null) {
+ this.encoding = encoding;
+ sb.Append ("Encoding=\"");
+ sb.Append (encoding);
+ sb.Append ("\" ");
+ }
+ sb.Append ("xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
+
+ doc = new XmlDocument ();
+ doc.LoadXml (sb.ToString ());
+ if (data != null) {
+ XmlNodeList xnl = doc.GetElementsByTagName ("Object");
+ XmlNode newNode = doc.ImportNode (data, true);
+ xnl[0].AppendChild (newNode);
+ }
+ }
+
+ // why is data a XmlNodeList instead of a XmlElement ?
+ public XmlNodeList Data {
+ get {
+ XmlNodeList xnl = doc.GetElementsByTagName ("Object");
+ return xnl[0].ChildNodes;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ Build (id, mimeType, encoding, null);
+ XmlNodeList xnl = doc.GetElementsByTagName ("Object");
+ if ((xnl != null) && (xnl.Count > 0)) {
+ foreach (XmlNode xn in value) {
+ XmlNode newNode = doc.ImportNode (xn, true);
+ xnl[0].AppendChild (newNode);
+ }
+ }
+ }
+ }
+
+ // default to null - no encoding
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ // default to null
+ public string Id {
+ get { return id; }
+ set { id = value; }
+ }
+
+ // default to null
+ public string MimeType {
+ get { return mimeType; }
+ set { mimeType = value; }
+ }
+
+ public XmlElement GetXml ()
+ {
+ if ((doc.DocumentElement.LocalName == "Object") && (doc.DocumentElement.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#")) {
+ // recreate all attributes in order
+ XmlAttribute xa = null;
+ doc.DocumentElement.Attributes.RemoveAll ();
+ if (id != null) {
+ xa = doc.CreateAttribute ("Id");
+ xa.Value = id;
+ doc.DocumentElement.Attributes.Append (xa);
+ }
+ if (mimeType != null) {
+ xa = doc.CreateAttribute ("MimeType");
+ xa.Value = mimeType;
+ doc.DocumentElement.Attributes.Append (xa);
+ }
+ if (encoding != null) {
+ xa = doc.CreateAttribute ("Encoding");
+ xa.Value = encoding;
+ doc.DocumentElement.Attributes.Append (xa);
+ }
+ xa = doc.CreateAttribute ("xmlns");
+ xa.Value = xmldsig;
+ doc.DocumentElement.Attributes.Append (xa);
+ }
+ return doc.DocumentElement;
+ }
+
+ public void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if ((value.LocalName == "Object") && (value.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#")) {
+ doc.LoadXml (value.OuterXml);
+ XmlAttribute xa = value.Attributes ["Id"];
+ id = ((xa != null) ? xa.InnerText : null);
+ xa = value.Attributes ["MimeType"];
+ mimeType = ((xa != null) ? xa.InnerText : null);
+ xa = value.Attributes ["Encoding"];
+ encoding = ((xa != null) ? xa.InnerText : null);
+ }
+ else
+ doc.LoadXml (value.OuterXml);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfo.cs
new file mode 100644
index 00000000000..9ce4bc4162f
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfo.cs
@@ -0,0 +1,136 @@
+//
+// KeyInfo.cs - Xml Signature KeyInfo implementation
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class KeyInfo : IEnumerable {
+
+ static private string xmldsig = "http://www.w3.org/2000/09/xmldsig#";
+
+ private ArrayList Info;
+ private string id;
+
+ public KeyInfo()
+ {
+ Info = new ArrayList ();
+ }
+
+ public int Count {
+ get { return Info.Count; }
+ }
+
+ public string Id {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public void AddClause (KeyInfoClause clause)
+ {
+ Info.Add (clause);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return Info.GetEnumerator ();
+ }
+
+ public IEnumerator GetEnumerator (Type requestedObjectType)
+ {
+ // Build a new ArrayList...
+ ArrayList TypeList = new ArrayList ();
+ IEnumerator e = Info.GetEnumerator ();
+ while (true) {
+ // ...with all object of specified type...
+ if ((e.Current).GetType().Equals (requestedObjectType))
+ TypeList.Add (e.Current);
+ if (!e.MoveNext ())
+ break;
+ }
+ // ...and return its enumerator
+ return TypeList.GetEnumerator ();
+ }
+
+ public XmlElement GetXml ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<KeyInfo xmlns=\"");
+ sb.Append (xmldsig);
+ sb.Append ("\" />");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (sb.ToString ());
+ // we add References afterward so we don't end up with extraneous
+ // xmlns="..." in each reference elements.
+ foreach (KeyInfoClause kic in Info) {
+ XmlNode xn = kic.GetXml ();
+ XmlNode newNode = doc.ImportNode (xn, true);
+ doc.DocumentElement.AppendChild (newNode);
+ }
+ return doc.DocumentElement;
+ }
+
+ public void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if ((value.LocalName == "KeyInfo") && (value.NamespaceURI == xmldsig)) {
+ foreach (XmlNode n in value.ChildNodes) {
+ KeyInfoClause kic = null;
+ if (n is XmlWhitespace)
+ continue;
+
+ switch (n.LocalName) {
+ case "KeyValue":
+ XmlNodeList xnl = n.ChildNodes;
+ if (xnl.Count > 0) {
+ // we must now treat the whitespace !
+ foreach (XmlNode m in xnl) {
+ switch (m.LocalName) {
+ case "DSAKeyValue":
+ kic = (KeyInfoClause) new DSAKeyValue ();
+ break;
+ case "RSAKeyValue":
+ kic = (KeyInfoClause) new RSAKeyValue ();
+ break;
+ }
+ }
+ }
+ break;
+ case "KeyName":
+ kic = (KeyInfoClause) new KeyInfoName ();
+ break;
+ case "RetrievalMethod":
+ kic = (KeyInfoClause) new KeyInfoRetrievalMethod ();
+ break;
+ case "X509Data":
+ kic = (KeyInfoClause) new KeyInfoX509Data ();
+ break;
+ case "RSAKeyValue":
+ kic = (KeyInfoClause) new RSAKeyValue ();
+ break;
+ default:
+ kic = (KeyInfoClause) new KeyInfoNode ();
+ break;
+ }
+
+ if (kic != null) {
+ kic.LoadXml ((XmlElement) n);
+ AddClause (kic);
+ }
+ }
+ }
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoClause.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoClause.cs
new file mode 100644
index 00000000000..a4851412e5f
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoClause.cs
@@ -0,0 +1,23 @@
+//
+// KeyInfoClause.cs - Abstract KeyInfoClause implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public abstract class KeyInfoClause {
+
+ public KeyInfoClause () {}
+
+ public abstract XmlElement GetXml ();
+
+ public abstract void LoadXml (XmlElement element);
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoName.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoName.cs
new file mode 100644
index 00000000000..4537e3dc631
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoName.cs
@@ -0,0 +1,50 @@
+//
+// KeyInfoName.cs - KeyInfoName implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class KeyInfoName : KeyInfoClause {
+
+ private string Name;
+
+ public KeyInfoName() {}
+
+ public string Value {
+ get { return Name; }
+ set { Name = value; }
+ }
+
+ public override XmlElement GetXml ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\">");
+ sb.Append (Name);
+ sb.Append ("</KeyName>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml(sb.ToString ());
+ return doc.DocumentElement;
+ }
+
+ public override void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if ((value.LocalName == "KeyName") && (value.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#"))
+ Name = value.InnerXml;
+ else
+ Name = null;
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoNode.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoNode.cs
new file mode 100644
index 00000000000..4e0eef0199f
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoNode.cs
@@ -0,0 +1,43 @@
+//
+// KeyInfoNode.cs - KeyInfoNode implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class KeyInfoNode : KeyInfoClause {
+
+ private XmlElement Node;
+
+ public KeyInfoNode () {}
+
+ public KeyInfoNode (XmlElement node)
+ {
+ LoadXml (node);
+ }
+
+ public XmlElement Value {
+ get { return Node; }
+ set { Node = value; }
+ }
+
+ public override XmlElement GetXml ()
+ {
+ return Node;
+ }
+
+ // LAMESPEC: No ArgumentNullException is thrown if value == null
+ public override void LoadXml (XmlElement value)
+ {
+ Node = value;
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
new file mode 100644
index 00000000000..ae7c2aa268c
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
@@ -0,0 +1,60 @@
+//
+// KeyInfoRetrievalMethod.cs - KeyInfoRetrievalMethod implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class KeyInfoRetrievalMethod : KeyInfoClause {
+
+ private string URI;
+
+ public KeyInfoRetrievalMethod () {}
+
+ public KeyInfoRetrievalMethod (string strUri)
+ {
+ URI = strUri;
+ }
+
+ public string Uri {
+ get { return URI; }
+ set { URI = value; }
+ }
+
+ public override XmlElement GetXml ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<RetrievalElement ");
+ if (URI != null) {
+ sb.Append ("URI=\"");
+ sb.Append (URI);
+ sb.Append ("\" ");
+ }
+ sb.Append ("xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml(sb.ToString ());
+ return doc.DocumentElement;
+ }
+
+ public override void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if ((value.LocalName == "RetrievalElement") && (value.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#")) {
+ URI = value.Attributes["URI"].Value;
+ }
+ else
+ URI = ""; // not null - so we return URI="" as attribute !!!
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs
new file mode 100644
index 00000000000..09a742fe739
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs
@@ -0,0 +1,214 @@
+//
+// KeyInfoX509Data.cs - KeyInfoX509Data implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+// FIXME: framework class isn't documented so compatibility isn't assured!
+internal class IssuerSerial {
+ public string Issuer;
+ public string Serial;
+
+ public IssuerSerial (string issuer, string serial)
+ {
+ Issuer = issuer;
+ Serial = serial;
+ }
+}
+
+public class KeyInfoX509Data : KeyInfoClause {
+
+ private byte[] x509crl;
+ private ArrayList IssuerSerialList;
+ private ArrayList SubjectKeyIdList;
+ private ArrayList SubjectNameList;
+ private ArrayList X509CertificateList;
+
+ public KeyInfoX509Data ()
+ {
+ IssuerSerialList = new ArrayList ();
+ SubjectKeyIdList = new ArrayList ();
+ SubjectNameList = new ArrayList ();
+ X509CertificateList = new ArrayList ();
+ }
+
+ public KeyInfoX509Data (byte[] rgbCert) : this ()
+ {
+ AddCertificate (new X509Certificate (rgbCert));
+ }
+
+ public KeyInfoX509Data (X509Certificate cert) : this ()
+ {
+ AddCertificate (cert);
+ }
+
+ public ArrayList Certificates {
+ get { return X509CertificateList; }
+ }
+
+ public byte[] CRL {
+ get { return x509crl; }
+ set { x509crl = value; }
+ }
+
+ public ArrayList IssuerSerials {
+ get { return IssuerSerialList; }
+ }
+
+ public ArrayList SubjectKeyIds {
+ get { return SubjectKeyIdList; }
+ }
+
+ public ArrayList SubjectNames {
+ get { return SubjectNameList; }
+ }
+
+ public void AddCertificate (X509Certificate certificate)
+ {
+ X509CertificateList.Add (certificate);
+ }
+
+ public void AddIssuerSerial (string issuerName, string serialNumber)
+ {
+ IssuerSerial isser = new IssuerSerial (issuerName, serialNumber);
+ IssuerSerialList.Add (isser);
+ }
+
+ public void AddSubjectKeyId (byte[] subjectKeyId)
+ {
+ SubjectKeyIdList.Add (subjectKeyId);
+ }
+
+ public void AddSubjectName (string subjectName)
+ {
+ SubjectNameList.Add (subjectName);
+ }
+
+ public override XmlElement GetXml ()
+ {
+ // sanity check
+ int count = IssuerSerialList.Count + SubjectKeyIdList.Count + SubjectNameList.Count + X509CertificateList.Count;
+ if ((x509crl == null) && (count == 0))
+ throw new CryptographicException ("value");
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">");
+ // <X509IssuerSerial>
+ if (IssuerSerialList.Count > 0) {
+ sb.Append ("<X509IssuerSerial>");
+ foreach (IssuerSerial iser in IssuerSerialList) {
+ sb.Append ("<X509IssuerName>");
+ sb.Append (iser.Issuer);
+ sb.Append ("</X509IssuerName>");
+ sb.Append ("<X509SerialNumber>");
+ sb.Append (iser.Serial);
+ sb.Append ("</X509SerialNumber>");
+ }
+ sb.Append ("</X509IssuerSerial>");
+ }
+ // <X509SKI>
+ if (SubjectKeyIdList.Count > 0) {
+ foreach (byte[] skid in SubjectKeyIdList) {
+ sb.Append ("<X509SKI>");
+ sb.Append (Convert.ToBase64String (skid));
+ sb.Append ("</X509SKI>");
+ }
+ }
+ // <X509SubjectName>
+ if (SubjectNameList.Count > 0) {
+ foreach (string subject in SubjectNameList) {
+ sb.Append ("<X509SubjectName>");
+ sb.Append (subject);
+ sb.Append ("</X509SubjectName>");
+ }
+ }
+ // <X509Certificate>
+ if (X509CertificateList.Count > 0) {
+ foreach (X509Certificate x509 in X509CertificateList) {
+ sb.Append ("<X509Certificate>");
+ sb.Append (Convert.ToBase64String (x509.GetRawCertData ()));
+ sb.Append ("</X509Certificate>");
+ }
+ }
+ // only one <X509CRL>
+ if (x509crl != null) {
+ sb.Append ("<X509CRL>");
+ sb.Append (Convert.ToBase64String (x509crl));
+ sb.Append ("</X509CRL>");
+ }
+ sb.Append ("</X509Data>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml(sb.ToString ());
+ return doc.DocumentElement;
+ }
+
+ public override void LoadXml (XmlElement element)
+ {
+ if (element == null)
+ throw new ArgumentNullException ("element");
+
+ IssuerSerialList.Clear ();
+ SubjectKeyIdList.Clear ();
+ SubjectNameList.Clear ();
+ X509CertificateList.Clear ();
+ x509crl = null;
+
+ string ns = "http://www.w3.org/2000/09/xmldsig#";
+ if ((element.LocalName == "X509Data") && (element.NamespaceURI == ns)) {
+ XmlNodeList xnl = null;
+ // <X509IssuerSerial>
+ xnl = element.GetElementsByTagName ("X509IssuerSerial", ns);
+ if (xnl != null) {
+ for (int i=0; i < xnl.Count; i++) {
+ XmlElement xel = (XmlElement) xnl[i];
+ XmlNodeList issuer = xel.GetElementsByTagName ("X509IssuerName", ns);
+ XmlNodeList serial = xel.GetElementsByTagName ("X509SerialNumber", ns);
+ AddIssuerSerial (issuer[0].InnerText, serial[0].InnerText);
+ }
+ }
+ // <X509SKI>
+ xnl = element.GetElementsByTagName ("X509SKI", ns);
+ if (xnl != null) {
+ for (int i=0; i < xnl.Count; i++) {
+ byte[] skid = Convert.FromBase64String (xnl[i].InnerXml);
+ AddSubjectKeyId (skid);
+ }
+ }
+ // <X509SubjectName>
+ xnl = element.GetElementsByTagName ("X509SubjectName", ns);
+ if (xnl != null) {
+ for (int i=0; i < xnl.Count; i++) {
+ AddSubjectName (xnl[i].InnerXml);
+ }
+ }
+ // <X509Certificate>
+ xnl = element.GetElementsByTagName ("X509Certificate", ns);
+ if (xnl != null) {
+ for (int i=0; i < xnl.Count; i++) {
+ byte[] cert = Convert.FromBase64String (xnl[i].InnerXml);
+ AddCertificate (new X509Certificate (cert));
+ }
+ }
+ // only one <X509CRL>
+ xnl = element.GetElementsByTagName ("X509CRL", ns);
+ if ((xnl != null) && (xnl.Count > 0)) {
+ x509crl = Convert.FromBase64String (xnl[0].InnerXml);
+ }
+ }
+ else
+ throw new CryptographicException ("element");
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/RSAKeyValue.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/RSAKeyValue.cs
new file mode 100644
index 00000000000..20c40c8506a
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/RSAKeyValue.cs
@@ -0,0 +1,58 @@
+//
+// RSAKeyValue.cs - RSAKeyValue implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class RSAKeyValue : KeyInfoClause {
+
+ private RSA rsa;
+
+ public RSAKeyValue ()
+ {
+ rsa = RSA.Create ();
+ }
+
+ public RSAKeyValue (RSA key)
+ {
+ rsa = key;
+ }
+
+ public RSA Key {
+ get { return rsa; }
+ set { rsa = value; }
+ }
+
+ public override XmlElement GetXml ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\">");
+ sb.Append (rsa.ToXmlString (false));
+ sb.Append ("</KeyValue>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml(sb.ToString ());
+ return doc.DocumentElement;
+ }
+
+ public override void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if ((value.LocalName == "KeyValue") && (value.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#"))
+ rsa.FromXmlString (value.InnerXml);
+ else
+ throw new CryptographicException ("value");
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Reference.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Reference.cs
new file mode 100644
index 00000000000..4dde3c48a0f
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/Reference.cs
@@ -0,0 +1,209 @@
+//
+// Reference.cs - Reference implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+// http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/Overview.html#sec-Reference
+public class Reference {
+
+ private TransformChain chain;
+ private string digestMethod;
+ private byte[] digestValue;
+ private string id;
+ private string uri;
+ private string type;
+ private HashAlgorithm hash;
+
+ static private string xmldsig = "http://www.w3.org/2000/09/xmldsig#";
+ static private string sha1 = xmldsig + "sha1";
+
+ public Reference ()
+ {
+ chain = new TransformChain ();
+ digestMethod = sha1;
+ }
+
+ public Reference (Stream stream) : this ()
+ {
+ }
+
+ public Reference (string uri) : this ()
+ {
+ this.uri = uri;
+ }
+
+ // default to SHA1
+ public string DigestMethod {
+ get { return digestMethod; }
+ set { digestMethod = value; }
+ }
+
+ public byte[] DigestValue {
+ get { return digestValue; }
+ set { digestValue = value; }
+ }
+
+ public string Id {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public TransformChain TransformChain {
+ get { return chain; }
+ }
+
+ public string Type {
+ get { return type; }
+ set { type = value; }
+ }
+
+ public string Uri {
+ get { return uri; }
+ set { uri = value; }
+ }
+
+ public void AddTransform (Transform transform)
+ {
+ chain.Add (transform);
+ }
+
+ public XmlElement GetXml ()
+ {
+ if (digestMethod == null)
+ throw new CryptographicException ("DigestMethod");
+ if (digestValue == null)
+ throw new NullReferenceException ("DigestValue");
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<Reference");
+ if (id != null) {
+ sb.Append (" Id=\"");
+ sb.Append (id);
+ sb.Append ("\"");
+ }
+ if (uri != null) {
+ sb.Append (" URI=\"");
+ sb.Append (uri);
+ sb.Append ("\"");
+ }
+ if (type != null) {
+ sb.Append (" Type=\"");
+ sb.Append (type);
+ sb.Append ("\"");
+ }
+ sb.Append (" xmlns=\"");
+ sb.Append (xmldsig);
+ sb.Append ("\" >");
+
+ if (chain.Count > 0) {
+ sb.Append ("<Transforms>");
+ sb.Append ("</Transforms>");
+ }
+
+ sb.Append ("<DigestMethod Algorithm=\"");
+ sb.Append (digestMethod);
+ sb.Append ("\" />");
+ sb.Append ("<DigestValue>");
+ sb.Append (Convert.ToBase64String (digestValue));
+ sb.Append ("</DigestValue>");
+ sb.Append ("</Reference>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (sb.ToString ());
+
+ if (chain.Count > 0) {
+ XmlNodeList xnl = doc.GetElementsByTagName ("Transforms");
+ foreach (Transform t in chain) {
+ XmlNode xn = t.GetXml ();
+ XmlNode newNode = doc.ImportNode (xn, true);
+ xnl[0].AppendChild (newNode);
+ }
+ }
+
+ return doc.DocumentElement;
+ }
+
+ private string GetAttributeFromElement (XmlElement xel, string attribute, string element)
+ {
+ string result = null;
+ XmlNodeList xnl = xel.GetElementsByTagName (element);
+ if ((xnl != null) && (xnl.Count > 0)) {
+ XmlAttribute xa = xnl[0].Attributes [attribute];
+ if (xa != null)
+ result = xa.InnerText;
+ }
+ return result;
+ }
+
+ // note: we do NOT return null -on purpose- if attribute isn't found
+ private string GetAttribute (XmlElement xel, string attribute)
+ {
+ XmlAttribute xa = xel.Attributes [attribute];
+ return ((xa != null) ? xa.InnerText : null);
+ }
+
+ public void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if ((value.LocalName == "Reference") && (value.NamespaceURI == xmldsig)) {
+ id = GetAttribute (value, "Id");
+ uri = GetAttribute (value, "URI");
+ type = GetAttribute (value, "Type");
+ // Note: order is important for validations
+ XmlNodeList xnl = value.GetElementsByTagName ("Transform");
+ if ((xnl != null) && (xnl.Count > 0)) {
+ Transform t = null;
+ foreach (XmlNode xn in xnl) {
+ string a = GetAttribute ((XmlElement)xn, "Algorithm");
+ switch (a) {
+ case "http://www.w3.org/2000/09/xmldsig#base64":
+ t = new XmlDsigBase64Transform ();
+ break;
+ case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315":
+ t = new XmlDsigC14NTransform ();
+ break;
+ case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":
+ t = new XmlDsigC14NWithCommentsTransform ();
+ break;
+ case "http://www.w3.org/2000/09/xmldsig#enveloped-signature":
+ t = new XmlDsigEnvelopedSignatureTransform ();
+ break;
+ case "http://www.w3.org/TR/1999/REC-xpath-19991116":
+ t = new XmlDsigXPathTransform ();
+ break;
+ case "http://www.w3.org/TR/1999/REC-xslt-19991116":
+ t = new XmlDsigXsltTransform ();
+ break;
+ default:
+ throw new NotSupportedException ();
+ }
+ AddTransform (t);
+ }
+ }
+ // get DigestMethod
+ DigestMethod = GetAttributeFromElement (value, "Algorithm", "DigestMethod");
+ // get DigestValue
+ xnl = value.GetElementsByTagName ("DigestValue");
+ if ((xnl != null) && (xnl.Count > 0)) {
+ DigestValue = Convert.FromBase64String (xnl[0].InnerText);
+ }
+ }
+ else
+ throw new CryptographicException ();
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs
new file mode 100644
index 00000000000..1712a31f5b1
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs
@@ -0,0 +1,171 @@
+//
+// Signature.cs - Signature implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class Signature {
+
+ private ArrayList list;
+ private SignedInfo info;
+ private KeyInfo key;
+ private string id;
+ private byte[] signature;
+
+ static private string xmldsig = "http://www.w3.org/2000/09/xmldsig#";
+
+ public Signature()
+ {
+ list = new ArrayList ();
+ }
+
+ public string Id {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public KeyInfo KeyInfo {
+ get { return key; }
+ set { key = value; }
+ }
+
+ public IList ObjectList {
+ get { return list; }
+ set { list = ArrayList.Adapter (value); }
+ }
+
+ public byte[] SignatureValue {
+ get { return signature; }
+ set { signature = value; }
+ }
+
+ public SignedInfo SignedInfo {
+ get { return info; }
+ set { info = value; }
+ }
+
+ public void AddObject (DataObject dataObject)
+ {
+ list.Add (dataObject);
+ }
+
+ public XmlElement GetXml ()
+ {
+ if (info == null)
+ throw new CryptographicException ("SignedInfo");
+ if (signature == null)
+ throw new CryptographicException ("SignatureValue");
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<Signature");
+ if (id != null) {
+ sb.Append (" Id = \"");
+ sb.Append (id);
+ sb.Append ("\"");
+ }
+ sb.Append (" xmlns=\"");
+ sb.Append (xmldsig);
+/* if (info != null) {
+ sb.Append ("\">");
+ sb.Append (info.GetXml ().OuterXml);
+ sb.Append ("</Signature>");
+ }
+ else*/
+ sb.Append ("\" />");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (sb.ToString ());
+
+ XmlNode xn = null;
+ XmlNode newNode = null;
+
+ if (info != null) {
+ // this adds the xmlns=xmldsig
+ xn = info.GetXml ();
+ newNode = doc.ImportNode (xn, true);
+ doc.DocumentElement.AppendChild (newNode);
+ }
+
+ if (signature != null) {
+ XmlElement sv = doc.CreateElement ("SignatureValue", xmldsig);
+ sv.InnerText = Convert.ToBase64String (signature);
+ doc.DocumentElement.AppendChild (sv);
+ }
+
+ if (key != null) {
+ xn = key.GetXml ();
+ newNode = doc.ImportNode (xn, true);
+ doc.DocumentElement.AppendChild (newNode);
+ }
+
+ if (list.Count > 0) {
+ foreach (DataObject obj in list) {
+ xn = obj.GetXml ();
+ newNode = doc.ImportNode (xn, true);
+ doc.DocumentElement.AppendChild (newNode);
+ }
+ }
+
+ return doc.DocumentElement;
+ }
+
+ private string GetAttribute (XmlElement xel, string attribute)
+ {
+ XmlAttribute xa = xel.Attributes [attribute];
+ return ((xa != null) ? xa.InnerText : null);
+ }
+
+ public void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if ((value.LocalName == "Signature") && (value.NamespaceURI == xmldsig)) {
+ id = GetAttribute (value, "Id");
+
+ XmlNodeList xnl = value.GetElementsByTagName ("SignedInfo");
+ if ((xnl != null) && (xnl.Count == 1)) {
+ info = new SignedInfo ();
+ info.LoadXml ((XmlElement) xnl[0]);
+ }
+
+ xnl = value.GetElementsByTagName ("SignatureValue");
+ if ((xnl != null) && (xnl.Count == 1)) {
+ signature = Convert.FromBase64String (xnl[0].InnerText);
+ }
+
+ xnl = value.GetElementsByTagName ("KeyInfo");
+ if ((xnl != null) && (xnl.Count == 1)) {
+ key = new KeyInfo ();
+ key.LoadXml ((XmlElement) xnl[0]);
+ }
+
+ xnl = value.GetElementsByTagName ("Object");
+ if ((xnl != null) && (xnl.Count > 0)) {
+ foreach (XmlNode xn in xnl) {
+ DataObject obj = new DataObject ();
+ obj.LoadXml ((XmlElement) xn);
+ AddObject (obj);
+ }
+ }
+ }
+
+ // if invalid
+ if (info == null)
+ throw new CryptographicException ("SignedInfo");
+ if (signature == null)
+ throw new CryptographicException ("SignatureValue");
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs
new file mode 100644
index 00000000000..a5d4b2b4e91
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs
@@ -0,0 +1,182 @@
+//
+// SignedInfo.cs - SignedInfo implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class SignedInfo : ICollection, IEnumerable {
+
+ private ArrayList references;
+ private string c14nMethod;
+ private string id;
+ private string signatureMethod;
+ private string signatureLength;
+
+ static private string xmldsig = "http://www.w3.org/2000/09/xmldsig#";
+
+ public SignedInfo()
+ {
+ references = new ArrayList ();
+ c14nMethod = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+ }
+
+ public string CanonicalizationMethod {
+ get { return c14nMethod; }
+ set { c14nMethod = value; }
+ }
+
+ // documented as not supported (and throwing exception)
+ public int Count {
+ get { throw new NotSupportedException (); }
+ }
+
+ public string Id {
+ get { return id; }
+ set { id = value; }
+ }
+
+ // documented as not supported (and throwing exception)
+ public bool IsReadOnly {
+ get { throw new NotSupportedException (); }
+ }
+
+ // documented as not supported (and throwing exception)
+ public bool IsSynchronized {
+ get { throw new NotSupportedException (); }
+ }
+
+ public ArrayList References {
+ get { return references; }
+ }
+
+ public string SignatureLength {
+ get { return signatureLength; }
+ set { signatureLength = value; }
+ }
+
+ public string SignatureMethod {
+ get { return signatureMethod; }
+ set { signatureMethod = value; }
+ }
+
+ // documented as not supported (and throwing exception)
+ public object SyncRoot {
+ get { throw new NotSupportedException (); }
+ }
+
+ public void AddReference (Reference reference)
+ {
+ references.Add (reference);
+ }
+
+ // documented as not supported (and throwing exception)
+ public void CopyTo (Array array, int index)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return references.GetEnumerator ();
+ }
+
+ public XmlElement GetXml()
+ {
+ if (signatureMethod == null)
+ throw new CryptographicException ("SignatureMethod");
+ if (references.Count == 0)
+ throw new CryptographicException ("References empty");
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<SignedInfo");
+ if (id != null) {
+ sb.Append (" Id=\"");
+ sb.Append (id);
+ sb.Append ("\"");
+ }
+ sb.Append (" xmlns=\"");
+ sb.Append (xmldsig);
+ sb.Append ("\">");
+ if (c14nMethod != null) {
+ sb.Append ("<CanonicalizationMethod Algorithm=\"");
+ sb.Append (c14nMethod);
+ sb.Append ("\" />");
+ }
+ if (signatureMethod != null) {
+ sb.Append ("<SignatureMethod Algorithm=\"");
+ sb.Append (signatureMethod);
+ if (signatureLength != null) {
+ sb.Append ("\">");
+ sb.Append ("<HMACOutputLength>");
+ sb.Append (signatureLength);
+ sb.Append ("</HMACOutputLength>");
+ sb.Append ("</SignatureMethod>");
+ }
+ else
+ sb.Append ("\" />");
+ }
+ sb.Append ("</SignedInfo>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (sb.ToString ());
+ // we add References afterward so we don't end up with extraneous
+ // xmlns="..." in each reference elements.
+ foreach (Reference r in references) {
+ XmlNode xn = r.GetXml ();
+ XmlNode newNode = doc.ImportNode (xn, true);
+ doc.DocumentElement.AppendChild (newNode);
+ }
+
+ return doc.DocumentElement;
+ }
+
+ private string GetAttributeFromElement (XmlElement xel, string attribute, string element)
+ {
+ string result = null;
+ XmlNodeList xnl = xel.GetElementsByTagName (element);
+ if ((xnl != null) && (xnl.Count > 0)) {
+ XmlAttribute xa = xnl[0].Attributes [attribute];
+ if (xa != null)
+ result = xa.InnerText;
+ }
+ return result;
+ }
+
+ private string GetAttribute (XmlElement xel, string attribute)
+ {
+ XmlAttribute xa = xel.Attributes [attribute];
+ return ((xa != null) ? xa.InnerText : null);
+ }
+
+ public void LoadXml (XmlElement value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if ((value.LocalName == "SignedInfo") && (value.NamespaceURI == xmldsig)) {
+ id = GetAttribute (value, "Id");
+ c14nMethod = GetAttributeFromElement (value, "Algorithm", "CanonicalizationMethod");
+ signatureMethod = GetAttributeFromElement (value, "Algorithm", "SignatureMethod");
+ // signatureLength for HMAC
+ XmlNodeList xnl = value.GetElementsByTagName ("Reference");
+ foreach (XmlNode xn in xnl) {
+ Reference r = new Reference ();
+ r.LoadXml ((XmlElement) xn);
+ AddReference (r);
+ }
+ }
+ else
+ throw new CryptographicException ();
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
new file mode 100644
index 00000000000..fa054bc0b56
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
@@ -0,0 +1,354 @@
+//
+// SignedXml.cs - SignedXml implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class SignedXml {
+
+ private Signature signature;
+ private AsymmetricAlgorithm key;
+ private string keyName;
+ private XmlDocument envdoc;
+
+ public SignedXml ()
+ {
+ signature = new Signature ();
+ signature.SignedInfo = new SignedInfo ();
+ }
+
+ public SignedXml (XmlDocument document)
+ {
+ signature = new Signature ();
+ signature.SignedInfo = new SignedInfo ();
+ envdoc = document;
+ }
+
+ public SignedXml (XmlElement elem) : this ()
+ {
+ if (elem == null)
+ throw new ArgumentNullException ("elem");
+ signature = new Signature ();
+ signature.SignedInfo = new SignedInfo ();
+ }
+
+ public const string XmlDsigCanonicalizationUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+ public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigCanonicalizationUrl + "#WithComments";
+ public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#";
+ public const string XmlDsigDSAUrl = XmlDsigNamespaceUrl + "dsa-sha1";
+ public const string XmlDsigHMACSHA1Url = XmlDsigNamespaceUrl + "hmac-sha1";
+ public const string XmlDsigMinimalCanonicalizationUrl = XmlDsigNamespaceUrl + "minimal";
+ public const string XmlDsigRSASHA1Url = XmlDsigNamespaceUrl + "rsa-sha1";
+ public const string XmlDsigSHA1Url = XmlDsigNamespaceUrl + "sha1";
+
+ public KeyInfo KeyInfo {
+ get { return signature.KeyInfo; }
+ set { signature.KeyInfo = value; }
+ }
+
+ public Signature Signature {
+ get { return signature; }
+ }
+
+ public string SignatureLength {
+ get { return signature.SignedInfo.SignatureLength; }
+ }
+
+ public string SignatureMethod {
+ get { return signature.SignedInfo.SignatureMethod; }
+ }
+
+ public byte[] SignatureValue {
+ get { return signature.SignatureValue; }
+ }
+
+ public SignedInfo SignedInfo {
+ get { return signature.SignedInfo; }
+ }
+
+ public AsymmetricAlgorithm SigningKey {
+ get { return key; }
+ set { key = value; }
+ }
+
+ public string SigningKeyName {
+ get { return keyName; }
+ set { keyName = value; }
+ }
+
+ public void AddObject (DataObject dataObject)
+ {
+ signature.AddObject (dataObject);
+ }
+
+ public void AddReference (Reference reference)
+ {
+ signature.SignedInfo.AddReference (reference);
+ }
+
+ private Stream ApplyTransform (Transform t, XmlDocument doc)
+ {
+ t.LoadInput (doc);
+ if (t is XmlDsigEnvelopedSignatureTransform) {
+ XmlDocument d = (XmlDocument) t.GetOutput ();
+ MemoryStream ms = new MemoryStream ();
+ d.Save (ms);
+ return ms;
+ }
+ else
+ return (Stream) t.GetOutput ();
+ }
+
+ private Stream ApplyTransform (Transform t, Stream s)
+ {
+ try {
+ t.LoadInput (s);
+ s = (Stream) t.GetOutput ();
+ }
+ catch (Exception e) {
+ string temp = e.ToString (); // stop debugger
+ }
+ return s;
+ }
+
+ [MonoTODO("incomplete")]
+ private byte[] GetReferenceHash (Reference r)
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.PreserveWhitespace = true;
+ if (r.Uri == "")
+ doc = envdoc;
+ else {
+ foreach (DataObject obj in signature.ObjectList) {
+ if ("#" + obj.Id == r.Uri) {
+ doc.LoadXml (obj.GetXml ().OuterXml);
+ break;
+ }
+ }
+ }
+
+ Stream s = null;
+ if (r.TransformChain.Count > 0) {
+ foreach (Transform t in r.TransformChain) {
+ if (s == null)
+ s = ApplyTransform (t, doc);
+ else
+ s = ApplyTransform (t, s);
+ }
+ }
+ else
+ s = ApplyTransform (new XmlDsigC14NTransform (), doc);
+
+ // TODO: We should reuse the same hash object (when possible)
+ HashAlgorithm hash = (HashAlgorithm) CryptoConfig.CreateFromName (r.DigestMethod);
+ return hash.ComputeHash (s);
+ }
+
+ private void DigestReferences ()
+ {
+ // we must tell each reference which hash algorithm to use
+ // before asking for the SignedInfo XML !
+ foreach (Reference r in signature.SignedInfo.References) {
+ // assume SHA-1 if nothing is specified
+ if (r.DigestMethod == null)
+ r.DigestMethod = "http://www.w3.org/2000/09/xmldsig#sha1";
+ r.DigestValue = GetReferenceHash (r);
+ }
+ }
+
+ private Stream SignedInfoTransformed ()
+ {
+ Transform t = (Transform) CryptoConfig.CreateFromName (signature.SignedInfo.CanonicalizationMethod);
+ if (t == null)
+ return null;
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (signature.SignedInfo.GetXml ().OuterXml);
+ return ApplyTransform (t, doc);
+ }
+
+ [MonoTODO("Become hash algorithm independant")]
+ private byte[] Hash ()
+ {
+ // we must select the hash using ??? SignatureMethod (yuck)
+ // FIXME: Hardcoded to SHA1 - which is, right now, the only digest defined in XMLDSIG
+ SHA1 sha = SHA1.Create ();
+ // get the hash of the C14N SignedInfo element
+ return sha.ComputeHash (SignedInfoTransformed ());
+ }
+
+ public bool CheckSignature ()
+ {
+ // CryptographicException
+ if (key == null)
+ key = GetPublicKey ();
+ return CheckSignature (key);
+ }
+
+ private bool CheckReferenceIntegrity ()
+ {
+ // check digest (hash) for every reference
+ foreach (Reference r in signature.SignedInfo.References) {
+ // stop at first broken reference
+ if (! Compare (r.DigestValue, GetReferenceHash (r)))
+ return false;
+ }
+ return true;
+ }
+
+ public bool CheckSignature (AsymmetricAlgorithm key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+
+ // Part 1: Are all references digest valid ?
+ bool result = CheckReferenceIntegrity ();
+ if (result) {
+ // Part 2: Is the signature (over SignedInfo) valid ?
+ byte[] hash = Hash ();
+ AsymmetricSignatureDeformatter verifier = null;
+
+ if (key is DSA)
+ verifier = new DSASignatureDeformatter (key);
+ else if (key is RSA)
+ verifier = new RSAPKCS1SignatureDeformatter (key);
+ else
+ result = false;
+
+ if (verifier != null) {
+ verifier.SetHashAlgorithm ("SHA1");
+ result = verifier.VerifySignature (hash, signature.SignatureValue);
+ }
+ }
+
+ return result;
+ }
+
+ private bool Compare (byte[] expected, byte[] actual)
+ {
+ bool result = ((expected != null) && (actual != null));
+ if (result) {
+ int l = expected.Length;
+ result = (l == actual.Length);
+ if (result) {
+ for (int i=0; i < l; i++) {
+ if (expected[i] != actual[i])
+ return false;
+ }
+ }
+ }
+ return result;
+ }
+
+ public bool CheckSignature (KeyedHashAlgorithm macAlg)
+ {
+ if (macAlg == null)
+ throw new ArgumentNullException ("macAlg");
+
+ // Part 1: Are all references digest valid ?
+ bool result = CheckReferenceIntegrity ();
+ if (result) {
+ // Part 2: Is the signature (over SignedInfo) valid ?
+ byte[] actual = macAlg.ComputeHash (SignedInfoTransformed ());
+ result = Compare (signature.SignatureValue, actual);
+ }
+ return result;
+ }
+
+ public bool CheckSignatureReturningKey (out AsymmetricAlgorithm signingKey)
+ {
+ // here's the key used for verifying the signature
+ if (key == null)
+ key = GetPublicKey ();
+ signingKey = key;
+ // we'll find the key if we haven't already
+ return CheckSignature (key);
+ }
+
+ public void ComputeSignature ()
+ {
+ if (key != null) {
+ // required before hashing
+ signature.SignedInfo.SignatureMethod = key.SignatureAlgorithm;
+ DigestReferences ();
+
+ // the hard part - C14Ning the KeyInfo
+ byte[] hash = Hash ();
+ AsymmetricSignatureFormatter signer = null;
+
+ // in need for a CryptoConfig factory
+ if (key is DSA)
+ signer = new DSASignatureFormatter (key);
+ else if (key is RSA)
+ signer = new RSAPKCS1SignatureFormatter (key);
+
+ if (signer != null) {
+ signer.SetHashAlgorithm ("SHA1");
+ signature.SignatureValue = signer.CreateSignature (hash);
+ }
+ }
+ }
+
+ public void ComputeSignature (KeyedHashAlgorithm macAlg)
+ {
+ if (macAlg == null)
+ throw new ArgumentNullException ("macAlg");
+
+ if (macAlg is HMACSHA1) {
+ DigestReferences ();
+
+ signature.SignedInfo.SignatureMethod = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
+ signature.SignatureValue = macAlg.ComputeHash (SignedInfoTransformed ());
+ }
+ else
+ throw new CryptographicException ("unsupported algorithm");
+ }
+
+ // is that all ?
+ public virtual XmlElement GetIdElement (XmlDocument document, string idValue)
+ {
+ return document.GetElementById (idValue);
+ }
+
+ protected virtual AsymmetricAlgorithm GetPublicKey ()
+ {
+ AsymmetricAlgorithm key = null;
+ if (signature.KeyInfo != null) {
+ foreach (KeyInfoClause kic in signature.KeyInfo) {
+ if (kic is DSAKeyValue)
+ key = DSA.Create ();
+ else if (kic is RSAKeyValue)
+ key = RSA.Create ();
+
+ if (key != null) {
+ key.FromXmlString (kic.GetXml ().InnerXml);
+ break;
+ }
+ }
+ }
+ return key;
+ }
+
+ public XmlElement GetXml ()
+ {
+ return signature.GetXml ();
+ }
+
+ public void LoadXml (XmlElement value)
+ {
+ signature.LoadXml (value);
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/TODOAttribute.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/TODOAttribute.cs
new file mode 100644
index 00000000000..0920ce8f92d
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
new file mode 100644
index 00000000000..32375dd6716
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
@@ -0,0 +1,57 @@
+//
+// Transform.cs - Transform implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public abstract class Transform {
+
+ private string algo;
+
+ public Transform () {}
+
+ public string Algorithm {
+ get { return algo; }
+ set { algo = value; }
+ }
+
+ public abstract Type[] InputTypes {
+ get;
+ }
+
+ public abstract Type[] OutputTypes {
+ get;
+ }
+
+ protected abstract XmlNodeList GetInnerXml ();
+
+ public abstract object GetOutput ();
+
+ public abstract object GetOutput (Type type);
+
+ public XmlElement GetXml ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<Transform Algorithm=\"");
+ sb.Append (algo);
+ sb.Append ("\"/>");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (sb.ToString ());
+ return doc.DocumentElement;
+ }
+
+ public abstract void LoadInnerXml (XmlNodeList nodeList);
+
+ public abstract void LoadInput (object obj);
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/TransformChain.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/TransformChain.cs
new file mode 100644
index 00000000000..04e8696ecdb
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/TransformChain.cs
@@ -0,0 +1,42 @@
+//
+// TransformChain.cs - TransformChain implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Collections;
+
+namespace System.Security.Cryptography.Xml {
+
+public class TransformChain {
+
+ private ArrayList chain;
+
+ public TransformChain()
+ {
+ chain = new ArrayList ();
+ }
+
+ public int Count {
+ get { return chain.Count; }
+ }
+
+ public Transform this [int index] {
+ get { return (Transform) chain [index]; }
+ }
+
+ public void Add (Transform transform)
+ {
+ chain.Add (transform);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return chain.GetEnumerator ();
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
new file mode 100644
index 00000000000..22fde9fd873
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
@@ -0,0 +1,107 @@
+//
+// XmlDsigBase64Transform.cs - Base64 Transform implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+// http://www.w3.org/2000/09/xmldsig#base64
+public class XmlDsigBase64Transform : Transform {
+
+ private Type[] input;
+ private Type[] output;
+ private CryptoStream cs;
+
+ public XmlDsigBase64Transform ()
+ {
+ Algorithm = "http://www.w3.org/2000/09/xmldsig#base64";
+ }
+
+ public override Type[] InputTypes {
+ get {
+ if (input == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ input = new Type [3];
+ input[0] = typeof (System.IO.Stream);
+ input[1] = typeof (System.Xml.XmlDocument);
+ input[2] = typeof (System.Xml.XmlNodeList);
+ }
+ }
+ return input;
+ }
+ }
+
+ public override Type[] OutputTypes {
+ get {
+ if (output == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ output = new Type [1];
+ output[0] = typeof (System.IO.Stream);
+ }
+ }
+ return output;
+ }
+ }
+
+ protected override XmlNodeList GetInnerXml ()
+ {
+ return null; // THIS IS DOCUMENTED AS SUCH
+ }
+
+ public override object GetOutput ()
+ {
+ return (object) cs;
+ }
+
+ public override object GetOutput (Type type)
+ {
+ if (type != Type.GetType ("System.IO.Stream"))
+ throw new ArgumentException ("type");
+ return GetOutput ();
+ }
+
+ public override void LoadInnerXml (XmlNodeList nodeList)
+ {
+ // documented as not changing the state of the transform
+ }
+
+ public override void LoadInput (object obj)
+ {
+ XmlNodeList xnl = null;
+ Stream stream = null;
+
+ if (obj is Stream)
+ stream = (obj as Stream);
+ else if (obj is XmlDocument)
+ xnl = (obj as XmlDocument).ChildNodes;
+ else if (obj is XmlNodeList)
+ xnl = (XmlNodeList) obj;
+
+ if (xnl != null) {
+ StringBuilder sb = new StringBuilder ();
+ foreach (XmlNode xn in xnl)
+ sb.Append (xn.InnerText);
+
+ UTF8Encoding utf8 = new UTF8Encoding ();
+ byte[] data = utf8.GetBytes (sb.ToString ());
+ stream = new MemoryStream (data);
+ }
+
+ if (stream != null)
+ cs = new CryptoStream (stream, new FromBase64Transform (), CryptoStreamMode.Read);
+ // note: there is no default are other types won't throw an exception
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
new file mode 100644
index 00000000000..a689f0f118b
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
@@ -0,0 +1,110 @@
+//
+// XmlDsigC14NTransform.cs - C14N Transform implementation for XML Signature
+// http://www.w3.org/TR/xml-c14n
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class XmlDsigC14NTransform : Transform {
+
+ private Type[] input;
+ private Type[] output;
+ private bool comments;
+ private Stream s;
+
+ public XmlDsigC14NTransform ()
+ {
+ Algorithm = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+ comments = false;
+ }
+
+ public XmlDsigC14NTransform (bool includeComments)
+ {
+ comments = includeComments;
+ }
+
+ public override Type[] InputTypes {
+ get {
+ if (input == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ input = new Type [3];
+ input[0] = typeof (System.IO.Stream);
+ input[1] = typeof (System.Xml.XmlDocument);
+ input[2] = typeof (System.Xml.XmlNodeList);
+ }
+ }
+ return input;
+ }
+ }
+
+ public override Type[] OutputTypes {
+ get {
+ if (output == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ output = new Type [1];
+ output[0] = typeof (System.IO.Stream);
+ }
+ }
+ return output;
+ }
+ }
+
+ protected override XmlNodeList GetInnerXml ()
+ {
+ return null; // THIS IS DOCUMENTED AS SUCH
+ }
+
+ public override object GetOutput ()
+ {
+ return (object) s;
+ }
+
+ public override object GetOutput (Type type)
+ {
+ if (type == Type.GetType ("Stream"))
+ return GetOutput ();
+ throw new ArgumentException ("type");
+ }
+
+ public override void LoadInnerXml (XmlNodeList nodeList)
+ {
+ // documented as not changing the state of the transform
+ }
+
+ public override void LoadInput (object obj)
+ {
+ XmlNodeList xnl = null;
+
+ if (obj is Stream)
+ s = (obj as Stream);
+ else if (obj is XmlDocument)
+ xnl = (obj as XmlDocument).ChildNodes;
+ else if (obj is XmlNodeList)
+ xnl = (XmlNodeList) obj;
+
+ if (xnl != null) {
+ StringBuilder sb = new StringBuilder ();
+ foreach (XmlNode xn in xnl)
+ sb.Append (xn.InnerText);
+
+ UTF8Encoding utf8 = new UTF8Encoding ();
+ byte[] data = utf8.GetBytes (sb.ToString ());
+ s = new MemoryStream (data);
+ }
+
+ // note: there is no default are other types won't throw an exception
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs
new file mode 100644
index 00000000000..cc32ecf6152
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs
@@ -0,0 +1,21 @@
+//
+// XmlDsigC14NWithCommentsTransform.cs -
+// C14N with comments Transform implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class XmlDsigC14NWithCommentsTransform : XmlDsigC14NTransform {
+
+ public XmlDsigC14NWithCommentsTransform() : base (true) {}
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
new file mode 100644
index 00000000000..f67a8579d79
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
@@ -0,0 +1,90 @@
+//
+// XmlDsigEnvelopedSignatureTransform.cs -
+// Enveloped Signature Transform implementation for XML Signature
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+public class XmlDsigEnvelopedSignatureTransform : Transform {
+
+ private Type[] input;
+ private Type[] output;
+ private bool comments;
+
+ public XmlDsigEnvelopedSignatureTransform ()
+ {
+ comments = false;
+ }
+
+ public XmlDsigEnvelopedSignatureTransform (bool includeComments)
+ {
+ comments = includeComments;
+ }
+
+ public override Type[] InputTypes {
+ get {
+ if (input == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ input = new Type [3];
+ input[0] = typeof (System.IO.Stream);
+ input[1] = typeof (System.Xml.XmlDocument);
+ input[2] = typeof (System.Xml.XmlNodeList);
+ }
+ }
+ return input;
+ }
+ }
+
+ public override Type[] OutputTypes {
+ get {
+ if (output == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ output = new Type [2];
+ input[0] = typeof (System.Xml.XmlDocument);
+ input[1] = typeof (System.Xml.XmlNodeList);
+ }
+ }
+ return output;
+ }
+ }
+
+ protected override XmlNodeList GetInnerXml ()
+ {
+ return null; // THIS IS DOCUMENTED AS SUCH
+ }
+
+ public override object GetOutput()
+ {
+// return (object) new XmlNodeList ();
+ return null;
+ }
+
+ public override object GetOutput (Type type)
+ {
+ if (type == Type.GetType ("Stream"))
+ return GetOutput ();
+ throw new ArgumentException ("type");
+ }
+
+ public override void LoadInnerXml (XmlNodeList nodeList)
+ {
+ // NO CHANGE
+ }
+
+ public override void LoadInput (object obj)
+ {
+ // if (type.Equals (Stream.GetType ())
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
new file mode 100644
index 00000000000..5c5fd963b8b
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
@@ -0,0 +1,108 @@
+//
+// XmlDsigXPathTransform.cs -
+// XmlDsigXPathTransform implementation for XML Signature
+// http://www.w3.org/TR/1999/REC-xpath-19991116
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace System.Security.Cryptography.Xml {
+
+// www.w3.org/TR/xmldsig-core/
+// see Section 6.6.3 of the XMLDSIG specification
+public class XmlDsigXPathTransform : Transform {
+
+ private Type[] input;
+ private Type[] output;
+ private XmlNodeList xnl;
+ private XmlNodeList xpathNodes;
+
+ public XmlDsigXPathTransform ()
+ {
+ }
+
+ public override Type[] InputTypes {
+ get {
+ if (input == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ input = new Type [3];
+ input[0] = typeof (System.IO.Stream);
+ input[1] = typeof (System.Xml.XmlDocument);
+ input[2] = typeof (System.Xml.XmlNodeList);
+ }
+ }
+ return input;
+ }
+ }
+
+ public override Type[] OutputTypes {
+ get {
+ if (output == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ output = new Type [1];
+ output[0] = typeof (System.IO.Stream);
+ }
+ }
+ return output;
+ }
+ }
+
+ protected override XmlNodeList GetInnerXml ()
+ {
+ return xnl;
+ }
+
+ public override object GetOutput ()
+ {
+ return xpathNodes;
+ }
+
+ public override object GetOutput (Type type)
+ {
+ if (type != typeof (XmlNodeList))
+ throw new ArgumentException ("type");
+ return GetOutput ();
+ }
+
+ public override void LoadInnerXml (XmlNodeList nodeList)
+ {
+ if (nodeList == null)
+ throw new CryptographicException ("nodeList");
+ xnl = nodeList;
+ }
+
+ public override void LoadInput (object obj)
+ {
+ XmlNode xn = null;
+ // possible input: Stream, XmlDocument, and XmlNodeList
+ if (obj is Stream) {
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (obj as Stream);
+ }
+ else if (obj is XmlDocument) {
+ }
+ else if (obj is XmlNodeList) {
+ xnl = (XmlNodeList) obj;
+ }
+
+ if (xn != null) {
+ string xpath = xn.InnerXml;
+ // only possible output: XmlNodeList
+ xpathNodes = xnl[0].SelectNodes (xpath);
+ }
+ else
+ xpathNodes = null;
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs
new file mode 100644
index 00000000000..524541ea67c
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs
@@ -0,0 +1,121 @@
+//
+// XmlDsigEnvelopedSignatureTransform.cs -
+// Enveloped Signature Transform implementation for XML Signature
+// http://www.w3.org/TR/1999/REC-xslt-19991116
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+using System.Security.Cryptography;
+using System.Xml;
+using System.Xml.Xsl;
+
+namespace System.Security.Cryptography.Xml {
+
+public class XmlDsigXsltTransform : Transform {
+
+ private Type[] input;
+ private Type[] output;
+ private bool comments;
+ private XmlNodeList xnl;
+ private CryptoStream cs;
+
+ public XmlDsigXsltTransform () : this (false) {}
+
+ public XmlDsigXsltTransform (bool includeComments)
+ {
+ comments = includeComments;
+ Algorithm = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+ }
+
+ public override Type[] InputTypes {
+ get {
+ if (input == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ input = new Type [3];
+ input[0] = typeof (System.IO.Stream);
+ input[1] = typeof (System.Xml.XmlDocument);
+ input[2] = typeof (System.Xml.XmlNodeList);
+ }
+ }
+ return input;
+ }
+ }
+
+ public override Type[] OutputTypes {
+ get {
+ if (output == null) {
+ lock (this) {
+ // this way the result is cached if called multiple time
+ output = new Type [1];
+ output[0] = typeof (System.IO.Stream);
+ }
+ }
+ return output;
+ }
+ }
+
+ protected override XmlNodeList GetInnerXml ()
+ {
+ return xnl;
+ }
+
+ public override object GetOutput ()
+ {
+ return (object) cs;
+ }
+
+ public override object GetOutput (Type type)
+ {
+ if (type != Type.GetType ("System.IO.Stream"))
+ throw new ArgumentException ("type");
+ return GetOutput ();
+ }
+
+ public override void LoadInnerXml (XmlNodeList nodeList)
+ {
+ if (nodeList == null)
+ throw new CryptographicException ("nodeList");
+ xnl = nodeList;
+ }
+
+ [MonoTODO()]
+ public override void LoadInput (object obj)
+ {
+ XslTransform xsl = new XslTransform ();
+ XmlDocument doc = new XmlDocument ();
+ Stream stream = null;
+
+ // possible input: Stream, XmlDocument, and XmlNodeList
+ if (obj is Stream) {
+ doc.Load (obj as Stream);
+ xsl.Load (doc);
+ }
+ else if (obj is XmlDocument) {
+ xsl.Load (obj as XmlDocument);
+ }
+ else if (obj is XmlNodeList) {
+// xnl = (XmlNodeList) obj;
+// xsl.Load (obj a);
+ }
+
+ if (xnl != null) {
+ stream = new MemoryStream ();
+ // only possible output: Stream
+ xsl.Transform (doc, null, stream);
+ }
+
+ if (stream != null)
+ cs = new CryptoStream (stream, new FromBase64Transform (), CryptoStreamMode.Read);
+ else
+ cs = null;
+ // note: there is no default are other types won't throw an exception
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/System.Security.build b/mcs/class/System.Security/System.Security.build
new file mode 100644
index 00000000000..a2c4b72ca53
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.build
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Security.dll -->
+
+<project name="System.Security" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Security.dll" debug="${debug}">
+ <arg value="/nowarn:0169"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:..\lib\System.XML.dll"/>
+ <sources basedir=".">
+ <includes name="System.Security.Cryptography.Xml/*.cs"/>
+ </sources>
+ </csc>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <delete file="../lib/System.Security.dll" failonerror="false"/>
+ <nant basedir="Test" target="clean"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Security/Test/AllTests.cs b/mcs/class/System.Security/Test/AllTests.cs
new file mode 100644
index 00000000000..a469555a313
--- /dev/null
+++ b/mcs/class/System.Security/Test/AllTests.cs
@@ -0,0 +1,28 @@
+//
+// MonoTests.System.Security.AllTests.cs
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security {
+
+public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (System.Security.Cryptography.Xml.AllTests.Suite);
+ return suite;
+ }
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/Test/ChangeLog b/mcs/class/System.Security/Test/ChangeLog
new file mode 100644
index 00000000000..8051ae7fb8f
--- /dev/null
+++ b/mcs/class/System.Security/Test/ChangeLog
@@ -0,0 +1,10 @@
+2003-01-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Removed System.Security.Cryptography from using.
+ * System.Security_test.build: Simplified and fixed some issues.
+
+2002-11-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: New. Include System.Security.Cryptography.Xml
+ test suites.
+ * System.Security_test.build: New. Nant build file for Windows.
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/AllTests.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/AllTests.cs
new file mode 100644
index 00000000000..45ff7bd5a74
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/AllTests.cs
@@ -0,0 +1,66 @@
+//
+// TestSuite.System.Security.Cryptography.Xml.AllTests.cs
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ // because most crypto stuff works with byte[] buffers
+ static public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ if ((array1 == null) && (array2 == null))
+ return;
+ if (array1 == null)
+ Fail (msg + " -> First array is NULL");
+ if (array2 == null)
+ Fail (msg + " -> Second array is NULL");
+
+ bool a = (array1.Length == array2.Length);
+ if (a) {
+ for (int i = 0; i < array1.Length; i++) {
+ if (array1 [i] != array2 [i]) {
+ a = false;
+ break;
+ }
+ }
+ }
+ msg += " -> Expected " + BitConverter.ToString (array1, 0);
+ msg += " is different than " + BitConverter.ToString (array2, 0);
+ Assert (msg, a);
+ }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (DataObjectTest.Suite);
+ suite.AddTest (DSAKeyValueTest.Suite);
+ suite.AddTest (KeyInfoNameTest.Suite);
+ suite.AddTest (KeyInfoNodeTest.Suite);
+ suite.AddTest (KeyInfoRetrievalMethodTest.Suite);
+ suite.AddTest (KeyInfoTest.Suite);
+ suite.AddTest (KeyInfoX509DataTest.Suite);
+ suite.AddTest (ReferenceTest.Suite);
+ suite.AddTest (RSAKeyValueTest.Suite);
+ suite.AddTest (SignatureTest.Suite);
+ suite.AddTest (SignedInfoTest.Suite);
+ suite.AddTest (SignedXmlTest.Suite);
+ suite.AddTest (TransformChainTest.Suite);
+ suite.AddTest (XmlDsigBase64TransformTest.Suite);
+ suite.AddTest (XmlDsigXsltTransformTest.Suite);
+ return suite;
+ }
+ }
+}
+}
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
new file mode 100644
index 00000000000..0f0b86331d4
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ChangeLog
@@ -0,0 +1,24 @@
+2002-11-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added missing test suites.
+
+2002-11-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: New. Added suites for very listed files.
+ * DataObjectTest.cs: New. Test suite for DataObject.
+ * DSAKeyValueTest.cs: New. Test suite for DSAKeyValue.
+ * KeyInfoNameTest.cs: New. Test suite for KeyInfoName.
+ * KeyInfoNodeTest.cs: New. Test suite for KeyInfoNode.
+ * KeyInfoRetrievalMethodTest.cs: New. Test suite for DSAKeyValue.
+ * KeyInfoTest.cs: New. Test suite for KeyInfo.
+ * KeyInfoX509DataTest.cs: New. Test suite for KeyInfoX509Data.
+ * ReferenceTest.cs: New. Incomplete test suite for Reference.
+ * RSAKeyValueTest.cs: New. Test suite for RSAKeyValue.
+ * SignatureTest.cs: New. Partial test suite for Signature.
+ * SignedInfoTest.cs: New. Partial test suite for SignedInfo.
+ * SignedXmlTest.cs: New. Partial test suite for SignedXml.
+ * TransformChainTest.cs: New. Test suite for TransformChain.
+ * XmlDsigBase64TransformTest.cs: New. Partial test suite for
+ XmlDsigBase64Transform
+ * XmlDsigXsltTransformTest.cs: New. Partial test suite for
+ XmlDsigXsltTransform.
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DSAKeyValueTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DSAKeyValueTest.cs
new file mode 100644
index 00000000000..28c9b185af2
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DSAKeyValueTest.cs
@@ -0,0 +1,95 @@
+//
+// DSAKeyValueTest.cs - NUnit Test Cases for DSAKeyValue
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class DSAKeyValueTest : TestCase {
+
+ public DSAKeyValueTest () : base ("System.Security.Cryptography.Xml.DSAKeyValue testsuite") {}
+ public DSAKeyValueTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (DSAKeyValueTest));
+ }
+ }
+
+ public void TestGeneratedKey ()
+ {
+ DSAKeyValue dsa1 = new DSAKeyValue ();
+ AssertNotNull ("Key", dsa1.Key);
+ XmlElement xmlkey = dsa1.GetXml ();
+
+ DSAKeyValue dsa2 = new DSAKeyValue ();
+ dsa2.LoadXml (xmlkey);
+
+ Assert ("dsa1==dsa2", (dsa1.GetXml ().OuterXml) == (dsa2.GetXml ().OuterXml));
+
+ DSA key = dsa1.Key;
+ DSAKeyValue dsa3 = new DSAKeyValue (key);
+ Assert ("dsa3==dsa1", (dsa3.GetXml ().OuterXml) == (dsa1.GetXml ().OuterXml));
+ Assert ("dsa3==dsa2", (dsa3.GetXml ().OuterXml) == (dsa2.GetXml ().OuterXml));
+ }
+
+ public void TestImportKey ()
+ {
+ string dsaKey = "<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><DSAKeyValue><P>xc+QZRWTgr390gzwNXF+WzoepZkvAQvCzfCm+YyXj0KPoeHHeSc5ORzXQw81V+7XJR3gupvlI4F7lW9YC538l+3eqGm8IQlCIS+U+7ICTDOFFKevqsYX0BnjO0vvE4aAtDyxfSOTCOAo1cJ+6G6xgcC1JGIBEYCtg1tH8wUewDE=</P><Q>yyfZb0S/rimXl9ScJ3zIba2oGl8=</Q><G>crLazMg+vgI7u6+Idgi9iTLdRa4fptat3gdY97zcc857+OVdmT+lVRpK3okWpmBbw2wSffU8QltwFf42BVs+/HGUOUo2hNqSSXgzl1i+1frO7/cqooHVcy5WX0xxaIPsKcREPI5pNPj/3g8apTgErLMGsHkFdngwbMed9DArTks=</G><Y>FlAozo17wV/LCMRrtnmMKxVQNpidJVkZNM1/0eR65x8giwPs6yXzJmFT8f2tmPJY2FIOAtp5JYin4xUhwIHF452Gg50wUrjV6WTGkiC+gzLC2fVIyGlVsFecLj6ue7J+MACG+b3NQnxFuT5maQnPnEeuGgjLXfwYsAR1vfU0Gas=</Y><J>+UPMvUPq9Fo6Q1fr2oEYDxfGMMtfdoQmVBxI+TkUYQsReodRzBbnvGV1uPLWTpKKd/uJNUHO/QGb05Cvc6u49/AToDJIyi4e01hTLNCzeQk/Hj19gowb5wkTIjyaH04VyPE5zYoTYfuu3Y3Q</J><Seed>+cvoO7bzdpAwAjnDDApPzBCl6zg=</Seed><PgenCounter>ATM=</PgenCounter></DSAKeyValue></KeyValue>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (dsaKey);
+
+ DSAKeyValue dsa1 = new DSAKeyValue ();
+ dsa1.LoadXml (doc.DocumentElement);
+
+ string s = (dsa1.GetXml ().OuterXml);
+ AssertEquals ("DSA Key", dsaKey, s);
+ }
+
+ public void TestInvalidValue ()
+ {
+ string badKey = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (badKey);
+
+ DSAKeyValue dsa1 = new DSAKeyValue ();
+
+ try {
+ dsa1.LoadXml (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ try {
+ dsa1.LoadXml (doc.DocumentElement);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DataObjectTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DataObjectTest.cs
new file mode 100644
index 00000000000..362fa0c7c9e
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/DataObjectTest.cs
@@ -0,0 +1,139 @@
+//
+// DataObjectTest.cs - NUnit Test Cases for DataObject
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class DataObjectTest : TestCase {
+
+ public DataObjectTest () : base ("System.Security.Cryptography.Xml.DataObject testsuite") {}
+ public DataObjectTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (DataObjectTest));
+ }
+ }
+
+ public void TestNewDataObject ()
+ {
+ string test = "<Test>DataObject</Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (test);
+
+ DataObject obj1 = new DataObject ();
+ Assert ("Data.Count==0", (obj1.Data.Count == 0));
+
+ obj1.Id = "id";
+ obj1.MimeType = "mime";
+ obj1.Encoding = "encoding";
+ AssertEquals ("Only attributes", "<Object Id=\"id\" MimeType=\"mime\" Encoding=\"encoding\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (obj1.GetXml ().OuterXml));
+
+ obj1.Data = doc.ChildNodes;
+ Assert ("Data.Count==1", (obj1.Data.Count == 1));
+
+ XmlElement xel = obj1.GetXml ();
+
+ DataObject obj2 = new DataObject ();
+ obj2.LoadXml (xel);
+ AssertEquals ("obj1==obj2", (obj1.GetXml ().OuterXml), (obj2.GetXml ().OuterXml));
+
+ DataObject obj3 = new DataObject (obj1.Id, obj1.MimeType, obj1.Encoding, doc.DocumentElement);
+ AssertEquals ("obj2==obj3", (obj2.GetXml ().OuterXml), (obj3.GetXml ().OuterXml));
+ }
+
+ public void TestImportDataObject ()
+ {
+ string value1 = "<Object Id=\"id\" MimeType=\"mime\" Encoding=\"encoding\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Test xmlns=\"\">DataObject1</Test><Test xmlns=\"\">DataObject2</Test></Object>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value1);
+
+ DataObject obj1 = new DataObject ();
+ obj1.LoadXml (doc.DocumentElement);
+ Assert ("Data.Count==2", (obj1.Data.Count == 2));
+
+ string s = (obj1.GetXml ().OuterXml);
+ AssertEquals ("DataObject 1", value1, s);
+
+ string value2 = "<Object xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Test xmlns=\"\" /></Object>";
+ doc = new XmlDocument ();
+ doc.LoadXml (value2);
+
+ DataObject obj2 = new DataObject ();
+ obj2.LoadXml (doc.DocumentElement);
+
+ s = (obj2.GetXml ().OuterXml);
+ AssertEquals ("DataObject 2", value2, s);
+
+ string value3 = "<Object Id=\"id\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Test xmlns=\"\" /></Object>";
+ doc = new XmlDocument ();
+ doc.LoadXml (value3);
+
+ DataObject obj3 = new DataObject ();
+ obj3.LoadXml (doc.DocumentElement);
+
+ s = (obj3.GetXml ().OuterXml);
+ AssertEquals ("DataObject 3", value3, s);
+
+ string value4 = "<Object MimeType=\"mime\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Test xmlns=\"\" /></Object>";
+ doc = new XmlDocument ();
+ doc.LoadXml (value4);
+
+ DataObject obj4 = new DataObject ();
+ obj4.LoadXml (doc.DocumentElement);
+
+ s = (obj4.GetXml ().OuterXml);
+ AssertEquals ("DataObject 4", value4, s);
+ }
+
+ public void TestInvalidDataObject ()
+ {
+ DataObject obj1 = new DataObject ();
+ try {
+ obj1.Data = null;
+ Fail ("Expected ArgumentNullException but none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ try {
+ obj1.LoadXml (null);
+ Fail ("Expected ArgumentNullException but none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ // seems this isn't invalid !?!
+ string value = "<Test>Bad</Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ obj1.LoadXml (doc.DocumentElement);
+ string s = (obj1.GetXml ().OuterXml);
+ AssertEquals ("DataObject Bad", value, s);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNameTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNameTest.cs
new file mode 100644
index 00000000000..4280d1588ee
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNameTest.cs
@@ -0,0 +1,82 @@
+//
+// KeyInfoNameTest.cs - NUnit Test Cases for KeyInfoName
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class KeyInfoNameTest : TestCase {
+
+ public KeyInfoNameTest () : base ("System.Security.Cryptography.Xml.KeyInfoName testsuite") {}
+ public KeyInfoNameTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (KeyInfoNameTest));
+ }
+ }
+
+ public void TestNewKeyValue ()
+ {
+ string newKeyValue = "Mono::";
+ KeyInfoName name1 = new KeyInfoName ();
+ name1.Value = newKeyValue;
+ XmlElement xel = name1.GetXml ();
+
+ KeyInfoName name2 = new KeyInfoName ();
+ name2.LoadXml (xel);
+
+ AssertEquals ("name1==name2", (name1.GetXml ().OuterXml), (name2.GetXml ().OuterXml));
+ AssertEquals ("newKeyValue==value", newKeyValue, name1.Value);
+ }
+
+ public void TestImportKeyValue ()
+ {
+ string value = "<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\">Mono::</KeyName>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ KeyInfoName name1 = new KeyInfoName ();
+ name1.LoadXml (doc.DocumentElement);
+
+ string s = (name1.GetXml ().OuterXml);
+ AssertEquals ("Name", value, s);
+ }
+
+ public void TestInvalidValue ()
+ {
+ string bad = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (bad);
+
+ KeyInfoName name1 = new KeyInfoName ();
+ try {
+ name1.LoadXml (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ name1.LoadXml (doc.DocumentElement);
+ AssertEquals("invalid", "<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\"></KeyName>", (name1.GetXml ().OuterXml));
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNodeTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNodeTest.cs
new file mode 100644
index 00000000000..3a1a94f4f2d
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoNodeTest.cs
@@ -0,0 +1,77 @@
+//
+// KeyInfoNodeTest.cs - NUnit Test Cases for KeyInfoNode
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class KeyInfoNodeTest : TestCase {
+
+ public KeyInfoNodeTest () : base ("System.Security.Cryptography.Xml.KeyInfoNode testsuite") {}
+ public KeyInfoNodeTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (KeyInfoNodeTest));
+ }
+ }
+
+ public void TestNewKeyNode ()
+ {
+ string test = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (test);
+
+ KeyInfoNode node1 = new KeyInfoNode ();
+ node1.Value = doc.DocumentElement;
+ XmlElement xel = node1.GetXml ();
+
+ KeyInfoNode node2 = new KeyInfoNode (node1.Value);
+ node2.LoadXml (xel);
+
+ AssertEquals ("node1==node2", (node1.GetXml ().OuterXml), (node2.GetXml ().OuterXml));
+ }
+
+ public void TestImportKeyNode ()
+ {
+ // Note: KeyValue is a valid KeyNode
+ string value = "<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\">Mono::</KeyName>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ KeyInfoNode node1 = new KeyInfoNode ();
+ node1.LoadXml (doc.DocumentElement);
+
+ string s = (node1.GetXml ().OuterXml);
+ AssertEquals ("Node", value, s);
+ }
+
+ // well there's no invalid value - unless you read the doc ;-)
+ public void TestInvalidKeyNode ()
+ {
+ string bad = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (bad);
+
+ KeyInfoNode node1 = new KeyInfoNode ();
+ // LAMESPEC: No ArgumentNullException is thrown if value == null
+ node1.LoadXml (null);
+ AssertNull ("Value==null", node1.Value);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoRetrievalMethodTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoRetrievalMethodTest.cs
new file mode 100644
index 00000000000..40625904de0
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoRetrievalMethodTest.cs
@@ -0,0 +1,92 @@
+//
+// KeyInfoRetrievalMethodTest.cs - NUnit Test Cases for KeyInfoRetrievalMethod
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class KeyInfoRetrievalMethodTest : TestCase {
+
+ public KeyInfoRetrievalMethodTest () : base ("System.Security.Cryptography.Xml.KeyInfoRetrievalMethod testsuite") {}
+ public KeyInfoRetrievalMethodTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (KeyInfoRetrievalMethodTest));
+ }
+ }
+
+ public void TestNewKeyNode ()
+ {
+ string uri = "http://www.go-mono.com/";
+ KeyInfoRetrievalMethod uri1 = new KeyInfoRetrievalMethod ();
+
+ // verify empty XML
+ AssertEquals ("Empty", "<RetrievalElement xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml));
+
+ uri1.Uri = uri;
+ XmlElement xel = uri1.GetXml ();
+
+ KeyInfoRetrievalMethod uri2 = new KeyInfoRetrievalMethod (uri1.Uri);
+ uri2.LoadXml (xel);
+
+ AssertEquals ("uri1==uri2", (uri1.GetXml ().OuterXml), (uri2.GetXml ().OuterXml));
+ AssertEquals ("uri==Uri", uri, uri1.Uri);
+ }
+
+ public void TestImportKeyNode ()
+ {
+ string value = "<RetrievalElement URI=\"http://www.go-mono.com/\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ KeyInfoRetrievalMethod uri1 = new KeyInfoRetrievalMethod ();
+ uri1.LoadXml (doc.DocumentElement);
+
+ // verify that proper XML is generated (equals to original)
+ string s = (uri1.GetXml ().OuterXml);
+ AssertEquals ("Xml", value, s);
+
+ // verify that property is parsed correctly
+ AssertEquals ("Uri", "http://www.go-mono.com/", uri1.Uri);
+ }
+
+ public void TestInvalidKeyNode ()
+ {
+ KeyInfoRetrievalMethod uri1 = new KeyInfoRetrievalMethod ();
+ try {
+ uri1.LoadXml (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ string bad = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (bad);
+ // no exception is thrown
+ uri1.LoadXml (doc.DocumentElement);
+ // note that URI="" is present (unlike a empty Uri)
+ AssertEquals("invalid", "<RetrievalElement URI=\"\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (uri1.GetXml ().OuterXml));
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoTest.cs
new file mode 100644
index 00000000000..47949ea062b
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoTest.cs
@@ -0,0 +1,205 @@
+//
+// KeyInfoTest.cs - NUnit Test Cases for KeyInfo
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class KeyInfoTest : TestCase {
+
+ public KeyInfoTest () : base ("System.Security.Cryptography.Xml.KeyInfo testsuite") {}
+ public KeyInfoTest (string name) : base (name) {}
+
+ private KeyInfo info;
+
+
+ protected override void SetUp ()
+ {
+ info = new KeyInfo ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (KeyInfoTest));
+ }
+ }
+
+ public void TestEmptyKeyInfo ()
+ {
+ AssertEquals ("empty", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (info.GetXml ().OuterXml));
+ AssertEquals ("empty count", 0, info.Count);
+ }
+
+ public void TestKeyInfoName ()
+ {
+ KeyInfoName name = new KeyInfoName ();
+ name.Value = "Mono::";
+ info.AddClause (name);
+ AssertEquals ("name", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><KeyName>Mono::</KeyName></KeyInfo>", (info.GetXml ().OuterXml));
+ AssertEquals ("name count", 1, info.Count);
+ }
+
+ public void TestKeyInfoNode ()
+ {
+ string test = "<Test>KeyInfoNode</Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (test);
+
+ KeyInfoNode node = new KeyInfoNode (doc.DocumentElement);
+ info.AddClause (node);
+ AssertEquals ("node", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Test xmlns=\"\">KeyInfoNode</Test></KeyInfo>", (info.GetXml ().OuterXml));
+ AssertEquals ("node count", 1, info.Count);
+ }
+
+ string xmlDSA = "<DSAKeyValue><P>rjxsMU368YOCTQejWkiuO9e/vUVwkLtq1jKiU3TtJ53hBJqjFRuTa228vZe+BH2su9RPn/vYFWfQDv6zgBYe3eNdu4Afw+Ny0FatX6dl3E77Ra6Tsd3MmLXBiGSQ1mMNd5G2XQGpbt9zsGlUaexXekeMLxIufgfZLwYp67M+2WM=</P><Q>tf0K9rMyvUrU4cIkwbCrDRhQAJk=</Q><G>S8Z+1pGCed00w6DtVcqZLKjfqlCJ7JsugEFIgSy/Vxtu9YGCMclV4ijGEbPo/jU8YOSMuD7E9M7UaopMRcmKQjoKZzoJjkgVFP48Ohxl1f08lERnButsxanx3+OstFwUGQ8XNaGg3KrIoZt1FUnfxN3RHHTvVhjzNSHxMGULGaU=</G><Y>LnrxxRGLYeV2XLtK3SYz8RQHlHFZYrtznDZyMotuRfO5uC5YODhSFyLXvb1qB3WeGtF4h3Eo4KzHgMgfN2ZMlffxFRhJgTtH3ctbL8lfQoDkjeiPPnYGhspdJxr0tyZmiy0gkjJG3vwHYrLnvZWx9Wm/unqiOlGBPNuxJ+hOeP8=</Y><J>9RhE5TycDtdEIXxS3HfxFyXYgpy81zY5lVjwD6E9JP37MWEi80BlX6ab1YPm6xYSEoqReMPP9RgGiW6DuACpgI7+8vgCr4i/7VhzModJAA56PwvTu6UMt9xxKU/fT672v8ucREkMWoc7lEey</J><Seed>HxW3N4RHWVgqDQKuGg7iJTUTiCs=</Seed><PgenCounter>Asw=</PgenCounter></DSAKeyValue>";
+
+ public void TestDSAKeyValue ()
+ {
+ DSA key = DSA.Create ();
+ key.FromXmlString (xmlDSA);
+ DSAKeyValue dsa = new DSAKeyValue (key);
+ info.AddClause (dsa);
+ AssertEquals ("dsa", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\">" + xmlDSA + "</KeyValue></KeyInfo>", (info.GetXml ().OuterXml));
+ AssertEquals ("dsa count", 1, info.Count);
+ }
+
+ static string xmlRSA = "<RSAKeyValue><Modulus>9DC4XNdQJwMRnz5pP2a6U51MHCODRilaIoVXqUPhCUb0lJdGroeqVYT84ZyIVrcarzD7Tqs3aEOIa3rKox0N1bxQpZPqayVQeLAkjLLtzJW/ScRJx3uEDJdgT1JnM1FH0GZTinmEdCUXdLc7+Y/c/qqIkTfbwHbRZjW0bBJyExM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue>";
+
+ public void TestRSAKeyValue ()
+ {
+ RSA key = RSA.Create ();
+ key.FromXmlString (xmlRSA);
+ RSAKeyValue rsa = new RSAKeyValue (key);
+ info.AddClause (rsa);
+ AssertEquals ("rsa", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\">" + xmlRSA + "</KeyInfo>", (info.GetXml ().OuterXml));
+ AssertEquals ("rsa count", 1, info.Count);
+ }
+
+ public void TestRetrievalMethod ()
+ {
+ KeyInfoRetrievalMethod retrieval = new KeyInfoRetrievalMethod ();
+ retrieval.Uri = "http://www.go-mono.org/";
+ info.AddClause (retrieval);
+ AssertEquals ("RetrievalMethod", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RetrievalElement URI=\"http://www.go-mono.org/\" /></KeyInfo>", (info.GetXml ().OuterXml));
+ AssertEquals ("RetrievalMethod count", 1, info.Count);
+ }
+
+ static byte[] cert = { 0x30,0x82,0x02,0x1D,0x30,0x82,0x01,0x86,0x02,0x01,0x14,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,
+ 0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x39,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,
+ 0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,0x02,0x81,0x81,0x00,0xCD,0x23,0xFA,0x2A,0xE1,0xED,0x98,0xF4,0xE9,0xD0,0x93,0x3E,0xD7,0x7A,0x80,0x02,0x4C,0xCC,0xC1,0x02,0xAF,0x5C,0xB6,0x1F,0x7F,0xFA,0x57,0x42,0x6F,0x30,0xD1,0x20,0xC5,0xB5,
+ 0x21,0x07,0x40,0x2C,0xA9,0x86,0xC2,0xF3,0x64,0x84,0xAE,0x3D,0x85,0x2E,0xED,0x85,0xBD,0x54,0xB0,0x18,0x28,0xEF,0x6A,0xF8,0x1B,0xE7,0x0B,0x16,0x1F,0x93,0x25,0x4F,0xC7,0xF8,0x8E,0xC3,0xB9,0xCA,0x98,0x84,0x0E,0x55,0xD0,0x2F,0xEF,0x78,0x77,0xC5,0x72,0x28,0x5F,0x60,0xBF,0x19,0x2B,0xD1,0x72,0xA2,0xB7,0xD8,0x3F,0xE0,0x97,0x34,0x5A,0x01,0xBD,0x04,0x9C,0xC8,0x78,0x45,0xCD,0x93,0x8D,0x15,0xF2,0x76,0x10,0x11,0xAB,0xB8,0x5B,0x2E,0x9E,0x52,0xDD,0x81,0x3E,0x9C,0x64,0xC8,0x29,0x93,0x02,0x01,0x03,0x30,0x0D,0x06,
+ 0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x32,0x1A,0x35,0xBA,0xBF,0x43,0x27,0xD6,0xB4,0xD4,0xB8,0x76,0xE5,0xE3,0x9B,0x4D,0x6C,0xC0,0x86,0xC9,0x77,0x35,0xBA,0x6B,0x16,0x2D,0x13,0x46,0x4A,0xB0,0x32,0x53,0xA1,0x5B,0x5A,0xE9,0x99,0xE2,0x0C,0x86,0x88,0x17,0x4E,0x0D,0xFE,0x82,0xAC,0x4E,0x47,0xEF,0xFB,0xFF,0x39,0xAC,0xEE,0x35,0xC8,0xFA,0x52,0x37,0x0A,0x49,0xAD,0x59,0xAD,0xE2,0x8A,0xA9,0x1C,0xC6,0x5F,0x1F,0xF8,0x6F,0x73,0x7E,0xCD,0xA0,0x31,0xE8,0x0C,0xBE,0xF5,0x4D,
+ 0xD9,0xB2,0xAB,0x8A,0x12,0xB6,0x30,0x78,0x68,0x11,0x7C,0x0D,0xF1,0x49,0x4D,0xA3,0xFD,0xB2,0xE9,0xFF,0x1D,0xF0,0x91,0xFA,0x54,0x85,0xFF,0x33,0x90,0xE8,0xC1,0xBF,0xA4,0x9B,0xA4,0x62,0x46,0xBD,0x61,0x12,0x59,0x98,0x41,0x89 };
+
+ public void TestX509Data ()
+ {
+ X509Certificate x509 = new X509Certificate (cert);
+ KeyInfoX509Data x509data = new KeyInfoX509Data (x509);
+ info.AddClause (x509data);
+ AssertEquals ("X509Data", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><X509Certificate>MIICHTCCAYYCARQwDQYJKoZIhvcNAQEEBQAwWDELMAkGA1UEBhMCQ0ExHzAdBgNVBAMTFktleXdpdG5lc3MgQ2FuYWRhIEluYy4xKDAmBgorBgEEASoCCwIBExhrZXl3aXRuZXNzQGtleXdpdG5lc3MuY2EwHhcNOTYwNTA3MDAwMDAwWhcNOTkwNTA3MDAwMDAwWjBYMQswCQYDVQQGEwJDQTEfMB0GA1UEAxMWS2V5d2l0bmVzcyBDYW5hZGEgSW5jLjEoMCYGCisGAQQBKgILAgETGGtleXdpdG5lc3NAa2V5d2l0bmVzcy5jYTCBnTANBgkqhkiG9w0BAQEFAAOBiwAwgYcCgYEAzSP6KuHtmPTp0JM+13qAAkzMwQKvXLYff/pXQm8w0SDFtSEHQCyphsLzZISuPYUu7YW9VLAYKO9q+BvnCxYfkyVPx/iOw7nKmIQOVdAv73h3xXIoX2C/GSvRcqK32D/glzRaAb0EnMh4Rc2TjRXydhARq7hbLp5S3YE+nGTIKZMCAQMwDQYJKoZIhvcNAQEEBQADgYEAMho1ur9DJ9a01Lh25eObTWzAhsl3NbprFi0TRkqwMlOhW1rpmeIMhogXTg3+gqxOR+/7/zms7jXI+lI3CkmtWa3iiqkcxl8f+G9zfs2gMegMvvVN2bKrihK2MHhoEXwN8UlNo/2y6f8d8JH6VIX/M5Dowb+km6RiRr1hElmYQYk=</X509Certificate></X509Data></KeyInfo>", (info.GetXml ().OuterXml));
+ AssertEquals ("X509Data count", 1, info.Count);
+ }
+
+ public void TestComplex ()
+ {
+ KeyInfoName name = new KeyInfoName ();
+ name.Value = "Mono::";
+ info.AddClause (name);
+
+ DSA keyDSA = DSA.Create ();
+ keyDSA.FromXmlString (xmlDSA);
+ DSAKeyValue dsa = new DSAKeyValue (keyDSA);
+ info.AddClause (dsa);
+
+ RSA keyRSA = RSA.Create ();
+ keyRSA.FromXmlString (xmlRSA);
+ RSAKeyValue rsa = new RSAKeyValue (keyRSA);
+ info.AddClause (rsa);
+
+ KeyInfoRetrievalMethod retrieval = new KeyInfoRetrievalMethod ();
+ retrieval.Uri = "http://www.go-mono.org/";
+ info.AddClause (retrieval);
+
+ X509Certificate x509 = new X509Certificate (cert);
+ KeyInfoX509Data x509data = new KeyInfoX509Data (x509);
+ info.AddClause (x509data);
+
+ string s = "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><KeyName>Mono::</KeyName><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><DSAKeyValue><P>rjxsMU368YOCTQejWkiuO9e/vUVwkLtq1jKiU3TtJ53hBJqjFRuTa228vZe+BH2su9RPn/vYFWfQDv6zgBYe3eNdu4Afw+Ny0FatX6dl3E77Ra6Tsd3MmLXBiGSQ1mMNd5G2XQGpbt9zsGlUaexXekeMLxIufgfZLwYp67M+2WM=</P><Q>tf0K9rMyvUrU4cIkwbCrDRhQAJk=</Q><G>S8Z+1pGCed00w6DtVcqZLKjfqlCJ7JsugEFIgSy/Vxtu9YGCMclV4ijGEbPo/jU8YOSMuD7E9M7UaopMRcmKQjoKZzoJjkgVFP48Ohxl1f08lERnButsxanx3+OstFwUGQ8XNaGg3KrIoZt1FUnfxN3RHHTvVhjzNSHxMGULGaU=</G><Y>LnrxxRGLYeV2XLtK3SYz8RQHlHFZYrtznDZyMotuRfO5uC5YODhSFyLXvb1qB3WeGtF4h3Eo4KzHgMgfN2ZMlffxFRhJgTtH3ctbL8lfQoDkjeiPPnYGhspdJxr0tyZmiy0gkjJG3vwHYrLnvZWx9Wm/unqiOlGBPNuxJ+hOeP8=</Y><J>9RhE5TycDtdEIXxS3HfxFyXYgpy81zY5lVjwD6E9JP37MWEi80BlX6ab1YPm6xYSEoqReMPP9RgGiW6DuACpgI7+8vgCr4i/7VhzModJAA56PwvTu6UMt9xxKU/fT672v8ucREkMWoc7lEey</J><Seed>HxW3N4RHWVgqDQKuGg7iJTUTiCs=</Seed><PgenCounter>Asw=</PgenCounter></DSAKeyValue></KeyValue>";
+ s += "<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>9DC4XNdQJwMRnz5pP2a6U51MHCODRilaIoVXqUPhCUb0lJdGroeqVYT84ZyIVrcarzD7Tqs3aEOIa3rKox0N1bxQpZPqayVQeLAkjLLtzJW/ScRJx3uEDJdgT1JnM1FH0GZTinmEdCUXdLc7+Y/c/qqIkTfbwHbRZjW0bBJyExM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><RetrievalElement URI=\"http://www.go-mono.org/\" /><X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">";
+ s += "<X509Certificate>MIICHTCCAYYCARQwDQYJKoZIhvcNAQEEBQAwWDELMAkGA1UEBhMCQ0ExHzAdBgNVBAMTFktleXdpdG5lc3MgQ2FuYWRhIEluYy4xKDAmBgorBgEEASoCCwIBExhrZXl3aXRuZXNzQGtleXdpdG5lc3MuY2EwHhcNOTYwNTA3MDAwMDAwWhcNOTkwNTA3MDAwMDAwWjBYMQswCQYDVQQGEwJDQTEfMB0GA1UEAxMWS2V5d2l0bmVzcyBDYW5hZGEgSW5jLjEoMCYGCisGAQQBKgILAgETGGtleXdpdG5lc3NAa2V5d2l0bmVzcy5jYTCBnTANBgkqhkiG9w0BAQEFAAOBiwAwgYcCgYEAzSP6KuHtmPTp0JM+13qAAkzMwQKvXLYff/pXQm8w0SDFtSEHQCyphsLzZISuPYUu7YW9VLAYKO9q+BvnCxYfkyVPx/iOw7nKmIQOVdAv73h3xXIoX2C/GSvRcqK32D/glzRaAb0EnMh4Rc2TjRXydhARq7hbLp5S3YE+nGTIKZMCAQMwDQYJKoZIhvcNAQEEBQADgYEAMho1ur9DJ9a01Lh25eObTWzAhsl3NbprFi0TRkqwMlOhW1rpmeIMhogXTg3+gqxOR+/7/zms7jXI+lI3CkmtWa3iiqkcxl8f+G9zfs2gMegMvvVN2bKrihK2MHhoEXwN8UlNo/2y6f8d8JH6VIX/M5Dowb+km6RiRr1hElmYQYk=</X509Certificate></X509Data></KeyInfo>";
+ AssertEquals ("Complex", s, (info.GetXml ().OuterXml));
+ AssertEquals ("RetrievalMethod count", 5, info.Count);
+ }
+
+ public void TestImportKeyNode ()
+ {
+ string value = "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><KeyName>Mono::</KeyName><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><DSAKeyValue><P>rjxsMU368YOCTQejWkiuO9e/vUVwkLtq1jKiU3TtJ53hBJqjFRuTa228vZe+BH2su9RPn/vYFWfQDv6zgBYe3eNdu4Afw+Ny0FatX6dl3E77Ra6Tsd3MmLXBiGSQ1mMNd5G2XQGpbt9zsGlUaexXekeMLxIufgfZLwYp67M+2WM=</P><Q>tf0K9rMyvUrU4cIkwbCrDRhQAJk=</Q><G>S8Z+1pGCed00w6DtVcqZLKjfqlCJ7JsugEFIgSy/Vxtu9YGCMclV4ijGEbPo/jU8YOSMuD7E9M7UaopMRcmKQjoKZzoJjkgVFP48Ohxl1f08lERnButsxanx3+OstFwUGQ8XNaGg3KrIoZt1FUnfxN3RHHTvVhjzNSHxMGULGaU=</G><Y>LnrxxRGLYeV2XLtK3SYz8RQHlHFZYrtznDZyMotuRfO5uC5YODhSFyLXvb1qB3WeGtF4h3Eo4KzHgMgfN2ZMlffxFRhJgTtH3ctbL8lfQoDkjeiPPnYGhspdJxr0tyZmiy0gkjJG3vwHYrLnvZWx9Wm/unqiOlGBPNuxJ+hOeP8=</Y><J>9RhE5TycDtdEIXxS3HfxFyXYgpy81zY5lVjwD6E9JP37MWEi80BlX6ab1YPm6xYSEoqReMPP9RgGiW6DuACpgI7+8vgCr4i/7VhzModJAA56PwvTu6UMt9xxKU/fT672v8ucREkMWoc7lEey</J><Seed>HxW3N4RHWVgqDQKuGg7iJTUTiCs=</Seed><PgenCounter>Asw=</PgenCounter></DSAKeyValue></KeyValue>";
+ value += "<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>9DC4XNdQJwMRnz5pP2a6U51MHCODRilaIoVXqUPhCUb0lJdGroeqVYT84ZyIVrcarzD7Tqs3aEOIa3rKox0N1bxQpZPqayVQeLAkjLLtzJW/ScRJx3uEDJdgT1JnM1FH0GZTinmEdCUXdLc7+Y/c/qqIkTfbwHbRZjW0bBJyExM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><RetrievalElement URI=\"http://www.go-mono.org/\" /><X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\">";
+ value += "<X509Certificate>MIICHTCCAYYCARQwDQYJKoZIhvcNAQEEBQAwWDELMAkGA1UEBhMCQ0ExHzAdBgNVBAMTFktleXdpdG5lc3MgQ2FuYWRhIEluYy4xKDAmBgorBgEEASoCCwIBExhrZXl3aXRuZXNzQGtleXdpdG5lc3MuY2EwHhcNOTYwNTA3MDAwMDAwWhcNOTkwNTA3MDAwMDAwWjBYMQswCQYDVQQGEwJDQTEfMB0GA1UEAxMWS2V5d2l0bmVzcyBDYW5hZGEgSW5jLjEoMCYGCisGAQQBKgILAgETGGtleXdpdG5lc3NAa2V5d2l0bmVzcy5jYTCBnTANBgkqhkiG9w0BAQEFAAOBiwAwgYcCgYEAzSP6KuHtmPTp0JM+13qAAkzMwQKvXLYff/pXQm8w0SDFtSEHQCyphsLzZISuPYUu7YW9VLAYKO9q+BvnCxYfkyVPx/iOw7nKmIQOVdAv73h3xXIoX2C/GSvRcqK32D/glzRaAb0EnMh4Rc2TjRXydhARq7hbLp5S3YE+nGTIKZMCAQMwDQYJKoZIhvcNAQEEBQADgYEAMho1ur9DJ9a01Lh25eObTWzAhsl3NbprFi0TRkqwMlOhW1rpmeIMhogXTg3+gqxOR+/7/zms7jXI+lI3CkmtWa3iiqkcxl8f+G9zfs2gMegMvvVN2bKrihK2MHhoEXwN8UlNo/2y6f8d8JH6VIX/M5Dowb+km6RiRr1hElmYQYk=</X509Certificate></X509Data></KeyInfo>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ info.LoadXml (doc.DocumentElement);
+
+ AssertEquals ("Import", value, (info.GetXml ().OuterXml));
+ AssertEquals ("Import count", 5, info.Count);
+ }
+
+ public void TestNullClause ()
+ {
+ AssertEquals ("empty count", 0, info.Count);
+ // null is accepted...
+ info.AddClause (null);
+ AssertEquals ("null count", 1, info.Count);
+ // but can't get XML out if it!
+ try {
+ XmlElement xel = info.GetXml ();
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestNullXml ()
+ {
+ try {
+ info.LoadXml (null);
+ Fail ("Expected ArgumentNullException but none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestInvalid ()
+ {
+ string bad = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (bad);
+ info.LoadXml (doc.DocumentElement);
+ // LAMESPEC: no expection but Xml isn't loaded
+ AssertEquals ("invalid", "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", (info.GetXml ().OuterXml));
+ AssertEquals ("invalid count", 0, info.Count);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoX509DataTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoX509DataTest.cs
new file mode 100644
index 00000000000..36ce73ad0ab
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/KeyInfoX509DataTest.cs
@@ -0,0 +1,234 @@
+//
+// KeyInfoX509DataTest.cs - NUnit Test Cases for KeyInfoX509Data
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class KeyInfoX509DataTest : TestCase {
+
+ static byte[] cert = { 0x30,0x82,0x09,0xB9,0x30,0x82,0x09,0x22,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x20,0x0B,0x35,0x5E,0xCE,0xC4,0xB0,0x63,0xB7,0xDE,0xC6,0x34,0xB9,0x70,0x34,0x44,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x62,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,
+ 0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x37,0x30,0x38,0x32,0x30,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x82,0x01,0x0A,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,
+ 0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x31,0x46,0x30,0x44,0x06,0x03,0x55,0x04,0x0B,0x13,0x3D,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,
+ 0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03,
+ 0x13,0x0D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x31,0x1E,0x30,0x1C,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01,0x16,0x0F,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,
+ 0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x07,0x08,0x30,0x82,0x07,0x04,0x30,0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x82,0x02,0x1F,0x06,0x03,0x55,0x1D,0x03,0x04,0x82,0x02,0x16,0x30,0x82,0x02,0x12,0x30,0x82,0x02,0x0E,0x30,0x82,0x02,0x0A,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x82,
+ 0x01,0xF9,0x16,0x82,0x01,0xA7,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,
+ 0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x20,0x61,0x74,0x3A,0x20,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x43,0x50,0x53,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x43,0x50,0x53,0x2D,
+ 0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x20,0x54,0x65,
+ 0x6C,0x2E,0x20,0x2B,0x31,0x20,0x28,0x34,0x31,0x35,0x29,0x20,0x39,0x36,0x31,0x2D,0x38,0x38,0x33,0x30,0x20,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
+ 0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x61,0x6E,0x64,0x20,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0xA0,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x01,0xA1,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x02,0x30,0x2C,0x30,0x2A,0x16,0x28,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,
+ 0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x36,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08,0x04,0x29,0x16,0x27,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x30,0x82,0x04,0x87,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D,0x04,0x82,0x04,
+ 0x78,0x16,0x82,0x04,0x74,0x43,0x41,0x55,0x54,0x49,0x4F,0x4E,0x3A,0x20,0x54,0x68,0x65,0x20,0x43,0x6F,0x6D,0x6D,0x6F,0x6E,0x20,0x4E,0x61,0x6D,0x65,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x0A,0x49,0x44,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2E,0x20,0x49,0x74,0x20,0x6D,0x61,0x79,0x20,0x62,
+ 0x65,0x20,0x74,0x68,0x65,0x0A,0x68,0x6F,0x6C,0x64,0x65,0x72,0x27,0x73,0x20,0x72,0x65,0x61,0x6C,0x20,0x6E,0x61,0x6D,0x65,0x20,0x6F,0x72,0x20,0x61,0x6E,0x20,0x61,0x6C,0x69,0x61,0x73,0x2E,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x64,0x6F,0x65,0x73,0x20,0x61,0x75,0x74,0x68,0x2D,0x0A,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x20,0x74,0x68,0x65,0x20,0x65,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x64,0x64,0x72,0x65,0x73,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x68,0x6F,0x6C,0x64,0x65,0x72,0x2E,
+ 0x0A,0x0A,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x0A,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x0A,0x43,0x65,0x72,
+ 0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x0A,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x20,0x61,0x74,0x3A,0x20,0x0A,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,
+ 0x63,0x6F,0x6D,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x0A,0x43,0x50,0x53,0x2D,0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x0A,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,
+ 0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x0A,0x0A,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x0A,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
+ 0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x0A,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0x0A,0x0A,0x57,0x41,0x52,0x4E,0x49,0x4E,0x47,0x3A,0x20,0x54,0x48,0x45,0x20,0x55,0x53,0x45,0x20,0x4F,0x46,0x20,0x54,0x48,0x49,0x53,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x20,0x49,0x53,0x20,0x53,0x54,0x52,0x49,0x43,0x54,0x4C,0x59,0x0A,0x53,0x55,0x42,0x4A,0x45,0x43,0x54,0x20,0x54,0x4F,0x20,0x54,0x48,0x45,0x20,0x56,0x45,0x52,0x49,
+ 0x53,0x49,0x47,0x4E,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4F,0x4E,0x20,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x0A,0x53,0x54,0x41,0x54,0x45,0x4D,0x45,0x4E,0x54,0x2E,0x20,0x20,0x54,0x48,0x45,0x20,0x49,0x53,0x53,0x55,0x49,0x4E,0x47,0x20,0x41,0x55,0x54,0x48,0x4F,0x52,0x49,0x54,0x59,0x20,0x44,0x49,0x53,0x43,0x4C,0x41,0x49,0x4D,0x53,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x0A,0x49,0x4D,0x50,0x4C,0x49,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x45,0x58,0x50,0x52,0x45,0x53,0x53,0x20,
+ 0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x2C,0x20,0x49,0x4E,0x43,0x4C,0x55,0x44,0x49,0x4E,0x47,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x0A,0x4F,0x46,0x20,0x4D,0x45,0x52,0x43,0x48,0x41,0x4E,0x54,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4F,0x52,0x20,0x46,0x49,0x54,0x4E,0x45,0x53,0x53,0x20,0x46,0x4F,0x52,0x20,0x41,0x20,0x50,0x41,0x52,0x54,0x49,0x43,0x55,0x4C,0x41,0x52,0x0A,0x50,0x55,0x52,0x50,0x4F,0x53,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x57,0x49,0x4C,0x4C,0x20,0x4E,0x4F,
+ 0x54,0x20,0x42,0x45,0x20,0x4C,0x49,0x41,0x42,0x4C,0x45,0x20,0x46,0x4F,0x52,0x20,0x43,0x4F,0x4E,0x53,0x45,0x51,0x55,0x45,0x4E,0x54,0x49,0x41,0x4C,0x2C,0x0A,0x50,0x55,0x4E,0x49,0x54,0x49,0x56,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x4F,0x54,0x48,0x45,0x52,0x20,0x44,0x41,0x4D,0x41,0x47,0x45,0x53,0x2E,0x20,0x53,0x45,0x45,0x20,0x54,0x48,0x45,0x20,0x43,0x50,0x53,0x0A,0x46,0x4F,0x52,0x20,0x44,0x45,0x54,0x41,0x49,0x4C,0x53,0x2E,0x0A,0x0A,0x43,0x6F,0x6E,0x74,0x65,0x6E,
+ 0x74,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x65,0x64,0x0A,0x6E,0x6F,0x6E,0x76,0x65,0x72,0x69,0x66,0x69,0x65,0x64,0x53,0x75,0x62,0x6A,0x65,0x63,0x74,0x41,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x73,0x20,0x65,0x78,0x74,0x65,0x6E,0x73,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x75,0x65,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x0A,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x63,0x6F,0x6E,0x73,0x69,0x64,0x65,0x72,0x65,0x64,0x20,
+ 0x61,0x73,0x20,0x61,0x63,0x63,0x75,0x72,0x61,0x74,0x65,0x20,0x69,0x6E,0x66,0x6F,0x72,0x6D,0x61,0x74,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x69,0x64,0x61,0x74,0x65,0x64,0x20,0x0A,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x49,0x41,0x2E,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x2B,0x3D,0x44,0xC7,0x32,0x59,0xAE,0xF1,0x5F,0x8F,0x3F,0x87,0xE3,0x3E,0xEB,0x81,0x30,0xF8,0xA9,0x96,0xDB,0x01,0x42,0x0B,0x04,0xEF,0x37,0x02,0x3F,0xD4,0x20,0x61,0x58,0xC4,0x4A,0x3A,
+ 0x39,0xB3,0xFB,0xD9,0xF8,0xA5,0xC4,0x5E,0x33,0x5A,0x0E,0xFA,0x93,0x56,0x2F,0x6F,0xD6,0x61,0xA2,0xAF,0xA5,0x0C,0x1D,0xE2,0x41,0x65,0xF3,0x40,0x75,0x66,0x83,0xD2,0x5A,0xB4,0xB7,0x56,0x0B,0x8E,0x0D,0xA1,0x33,0x13,0x7D,0x49,0xC3,0xB1,0x00,0x68,0x83,0x7F,0xB5,0x66,0xD4,0x32,0x32,0xFE,0x8B,0x9A,0x5A,0xD6,0x01,0x72,0x31,0x5D,0x85,0x91,0xBC,0x93,0x9B,0x65,0x60,0x25,0xC6,0x1F,0xBC,0xDD,0x69,0x44,0x62,0xC2,0xB2,0x6F,0x46,0xAB,0x2F,0x20,0xA5,0x6F,0xDA,0x48,0x6C,0x9C };
+
+ static byte[] cert2 = { 0x30,0x82,0x02,0x1D,0x30,0x82,0x01,0x86,0x02,0x01,0x14,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,
+ 0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x39,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,
+ 0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,0x02,0x81,0x81,0x00,0xCD,0x23,0xFA,0x2A,0xE1,0xED,0x98,0xF4,0xE9,0xD0,0x93,0x3E,0xD7,0x7A,0x80,0x02,0x4C,0xCC,0xC1,0x02,0xAF,0x5C,0xB6,0x1F,0x7F,0xFA,0x57,0x42,0x6F,0x30,0xD1,0x20,0xC5,0xB5,
+ 0x21,0x07,0x40,0x2C,0xA9,0x86,0xC2,0xF3,0x64,0x84,0xAE,0x3D,0x85,0x2E,0xED,0x85,0xBD,0x54,0xB0,0x18,0x28,0xEF,0x6A,0xF8,0x1B,0xE7,0x0B,0x16,0x1F,0x93,0x25,0x4F,0xC7,0xF8,0x8E,0xC3,0xB9,0xCA,0x98,0x84,0x0E,0x55,0xD0,0x2F,0xEF,0x78,0x77,0xC5,0x72,0x28,0x5F,0x60,0xBF,0x19,0x2B,0xD1,0x72,0xA2,0xB7,0xD8,0x3F,0xE0,0x97,0x34,0x5A,0x01,0xBD,0x04,0x9C,0xC8,0x78,0x45,0xCD,0x93,0x8D,0x15,0xF2,0x76,0x10,0x11,0xAB,0xB8,0x5B,0x2E,0x9E,0x52,0xDD,0x81,0x3E,0x9C,0x64,0xC8,0x29,0x93,0x02,0x01,0x03,0x30,0x0D,0x06,
+ 0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x32,0x1A,0x35,0xBA,0xBF,0x43,0x27,0xD6,0xB4,0xD4,0xB8,0x76,0xE5,0xE3,0x9B,0x4D,0x6C,0xC0,0x86,0xC9,0x77,0x35,0xBA,0x6B,0x16,0x2D,0x13,0x46,0x4A,0xB0,0x32,0x53,0xA1,0x5B,0x5A,0xE9,0x99,0xE2,0x0C,0x86,0x88,0x17,0x4E,0x0D,0xFE,0x82,0xAC,0x4E,0x47,0xEF,0xFB,0xFF,0x39,0xAC,0xEE,0x35,0xC8,0xFA,0x52,0x37,0x0A,0x49,0xAD,0x59,0xAD,0xE2,0x8A,0xA9,0x1C,0xC6,0x5F,0x1F,0xF8,0x6F,0x73,0x7E,0xCD,0xA0,0x31,0xE8,0x0C,0xBE,0xF5,0x4D,
+ 0xD9,0xB2,0xAB,0x8A,0x12,0xB6,0x30,0x78,0x68,0x11,0x7C,0x0D,0xF1,0x49,0x4D,0xA3,0xFD,0xB2,0xE9,0xFF,0x1D,0xF0,0x91,0xFA,0x54,0x85,0xFF,0x33,0x90,0xE8,0xC1,0xBF,0xA4,0x9B,0xA4,0x62,0x46,0xBD,0x61,0x12,0x59,0x98,0x41,0x89 };
+
+ static byte[] cert3 = { 0x30,0x82,0x03,0x04,0x30,0x82,0x02,0xC4,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x03,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,
+ 0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x31,0x30,0x32,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x33,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,
+ 0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0xB6,0x30,0x82,0x01,0x2B,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,0x30,0x82,0x01,0x1E,0x02,0x81,0x81,0x00,0x90,0x89,0x3E,0x18,0x1B,0xFE,0xA3,0x1D,0x16,0x89,0x00,0xB4,0xD5,0x40,0x82,0x4C,0x2E,0xEC,0x3D,0x66,0x0D,0x0D,0xB9,0x17,0x40,0x6E,0x3A,0x5C,0x03,0x7B,0x1B,0x93,0x28,0x0C,0xEF,0xB9,0x97,0xE3,0xA1,0xEB,0xE2,0xA3,0x7C,0x61,0xDD,0x6F,0xD5,0xAD,0x15,0x69,0x00,
+ 0x16,0xB2,0xC3,0x08,0x3D,0xC4,0x59,0xC6,0xF2,0x70,0xA5,0xB0,0xF5,0x1F,0x1D,0xF4,0xB0,0x15,0xDA,0x7E,0x28,0x39,0x24,0x99,0x36,0x5B,0xEC,0x39,0x25,0xFA,0x92,0x49,0x65,0xD2,0x43,0x05,0x6A,0x9E,0xA3,0x7B,0xF0,0xDE,0xA3,0x2F,0xD3,0x6F,0x3A,0xF9,0x35,0xC3,0x29,0xD4,0x45,0x6C,0x56,0x9A,0xDE,0x36,0x6E,0xFE,0x12,0x68,0x96,0x7B,0x45,0x1D,0x2C,0xFF,0xB9,0x2D,0xF5,0x52,0x8C,0xDF,0x3E,0x2F,0x63,0x02,0x15,0x00,0x81,0xA9,0xB5,0xD0,0x04,0xF2,0x9B,0xA7,0xD8,0x55,0x4C,0x3B,0x32,0xA1,0x45,0x32,0x4F,0xF5,0x51,0xDD,
+ 0x02,0x81,0x80,0x64,0x7A,0x88,0x0B,0xF2,0x3E,0x91,0x81,0x59,0x9C,0xF4,0xEA,0xC6,0x7B,0x0E,0xBE,0xEA,0x05,0xE8,0x77,0xFD,0x20,0x34,0x87,0xA1,0xC4,0x69,0xF6,0xC8,0x8B,0x19,0xDA,0xCD,0xFA,0x21,0x8A,0x57,0xA9,0x7A,0x26,0x0A,0x56,0xD4,0xED,0x4B,0x1B,0x7C,0x70,0xED,0xB4,0xE6,0x7A,0x6A,0xDE,0xD3,0x29,0xE2,0xE9,0x9A,0x33,0xED,0x09,0x8D,0x9E,0xDF,0xDA,0x2E,0x4A,0xC1,0x50,0x92,0xEE,0x2F,0xE5,0x5A,0xF3,0x85,0x62,0x6A,0x48,0xDC,0x1B,0x02,0x98,0xA6,0xB0,0xD1,0x09,0x4B,0x10,0xD1,0xF0,0xFA,0xE0,0xB1,0x1D,0x13,
+ 0x54,0x4B,0xC0,0xA8,0x40,0xEF,0x71,0xE8,0x56,0x6B,0xA2,0x29,0xCB,0x1E,0x09,0x7D,0x27,0x39,0x91,0x3B,0x20,0x4F,0x98,0x39,0xE8,0x39,0xCA,0x98,0xC5,0xAF,0x54,0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x54,0xA8,0x88,0xB5,0x8F,0x01,0x56,0xCE,0x18,0x8F,0xA6,0xD6,0x7C,0x29,0x29,0x75,0x45,0xE8,0x31,0xA4,0x07,0x17,0xED,0x1E,0x5D,0xB2,0x7B,0xBB,0xCE,0x3C,0x97,0x67,0x1E,0x88,0x0A,0xFE,0x7D,0x00,0x22,0x27,0x1D,0x66,0xEE,0xF6,0x1B,0xB6,0x95,0x7F,0x5A,0xFF,0x06,0x34,0x02,0x43,0xC3,0x83,0xC4,0x66,0x2C,0xA1,0x05,0x0E,
+ 0x68,0xB3,0xCA,0xDC,0xD3,0xF9,0x0C,0xC0,0x66,0xDF,0x85,0x84,0x4B,0x20,0x5D,0x41,0xAC,0xC0,0xEC,0x37,0x92,0x0E,0x97,0x19,0xBF,0x53,0x35,0x63,0x27,0x18,0x33,0x35,0x42,0x4D,0xF0,0x2D,0x6D,0xA7,0xA4,0x98,0xAA,0x57,0xF3,0xD2,0xB8,0x6E,0x4E,0x8F,0xFF,0xBE,0x6F,0x4E,0x0F,0x0B,0x44,0x24,0xEE,0xDF,0x4C,0x22,0x5B,0x44,0x98,0x94,0xCB,0xB8,0xA3,0x2F,0x30,0x2D,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9D,0x2D,0x73,0xC3,0xB8,0xE3,0x4D,0x29,0x28,0xC3,0x65,0xBE,0xA9,0x98,0xCB,0xD6,0x8A,0x06,0x68,
+ 0x9C,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x03,0x2F,0x00,0x30,0x2C,0x02,0x14,0x5A,0x1B,0x2D,0x08,0x0E,0xE6,0x99,0x38,0x8F,0xB5,0x09,0xC9,0x89,0x79,0x7E,0x01,0x30,0xBD,0xCE,0xF0,0x02,0x14,0x71,0x7B,0x08,0x51,0x97,0xCE,0x4D,0x1F,0x6A,0x84,0x47,0x3A,0xC0,0xBD,0x13,0x89,0x81,0xB9,0x01,0x97 };
+
+ static byte[] x509crl = { 0x30, 0x82, 0x01, 0x05, 0x30, 0x72, 0x02, 0x01, 0x01, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x30, 0x51, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0F, 0x55, 0x2E, 0x53, 0x2E, 0x20, 0x47, 0x6F, 0x76, 0x65, 0x72, 0x6E, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x0C, 0x30, 0x0A, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x03, 0x44, 0x6F, 0x44, 0x31, 0x1A, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x11, 0x41, 0x72, 0x6D, 0x65, 0x64, 0x20, 0x46, 0x6F, 0x72, 0x63, 0x65, 0x73, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x17, 0x0D, 0x30, 0x32, 0x31, 0x30, 0x31, 0x31, 0x31, 0x33, 0x31, 0x32, 0x35, 0x30, 0x5A, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x03, 0x81, 0x81, 0x00, 0x7D, 0xA2, 0xD1, 0x19, 0x6D, 0x0F, 0x0F, 0xCB, 0xE4, 0xA3, 0xBE, 0xE0, 0x36, 0x0A, 0xF3, 0x4C, 0x9B, 0xAF, 0xE6, 0x4F, 0xF6, 0xE3, 0xAF, 0xCF, 0x55, 0xF3, 0xC6, 0xDB, 0xAB, 0x4C, 0x16, 0x32, 0xAA, 0x73, 0xAD, 0xCC, 0xDC, 0x32, 0x33, 0x60, 0xDF, 0x8B, 0xCC, 0x93, 0xB5, 0x4F, 0x6A, 0xEC, 0x70, 0x53, 0xAF, 0xCF, 0x07, 0x0F, 0xA0, 0xCD, 0x66, 0xAC, 0x00, 0x57, 0xC6, 0x5C, 0x5D, 0x21, 0xB1, 0xBD, 0x30, 0x89, 0x8E, 0x77, 0x8D, 0xD4, 0x69, 0x7E, 0xC0, 0x36, 0x7E, 0xD2, 0xD8, 0x20, 0x71, 0x08, 0x80, 0xD2, 0xCB, 0x74, 0x8B, 0xD8, 0x42, 0x17, 0x04, 0x99, 0x80, 0xA4, 0x52, 0x70, 0x2E, 0xC0, 0xE3, 0x8C, 0x0B, 0xFF, 0x79, 0xB7, 0x45, 0x77, 0xDC, 0xC5, 0xCF, 0x43, 0x98, 0x91, 0x7D, 0xF1, 0x01, 0xF7, 0x53, 0xD7, 0xC6, 0x51, 0x35, 0xF0, 0x89, 0xCC, 0xC1, 0xFF, 0xE2, 0x89 };
+
+ public KeyInfoX509DataTest () : base ("System.Security.Cryptography.Xml.KeyInfoX509Data testsuite") {}
+ public KeyInfoX509DataTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (KeyInfoX509DataTest));
+ }
+ }
+
+ public void TestConstructors ()
+ {
+ KeyInfoX509Data data1 = new KeyInfoX509Data ();
+ try {
+ XmlElement invalid = data1.GetXml ();
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // can't compare at this stage - so empty test is impossible
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+
+ KeyInfoX509Data data2 = new KeyInfoX509Data (cert);
+
+ XmlElement xel = data2.GetXml ();
+ string s = "<X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><X509Certificate>MIIJuTCCCSKgAwIBAgIQIAs1Xs7EsGO33sY0uXA0RDANBgkqhkiG9w0BAQQFADBiMREwDwYDVQQHEwhJbnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlTaWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXIwHhcNOTYwODIxMDAwMDAwWhcNOTcwODIwMjM1OTU5WjCCAQoxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjFGMEQGA1UECxM9d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUyBJbmNvcnAuIGJ5IFJlZi4sTElBQi5MVEQoYyk5NjEmMCQGA1UECxMdRGlnaXRhbCBJRCBDbGFzcyAxIC0gTmV0c2NhcGUxFjAUBgNVBAMTDURhdmlkIFQuIEdyYXkxHjAcBgkqhkiG9w0BCQEWD2RhdmlkQGZvcm1hbC5pZTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDFgQei6w+4//j4HO4y/78SNWr5a8i+L/s+rwRRSqzdECmozUBbZh6Y7/JMd/qPhtEhZ5JESsSJyYPPiJ9v4jI1AgMBAAGjggcIMIIHBDAJBgNVHRMEAjAAMIICHwYDVR0DBIICFjCCAhIwggIOMIICCgYLYIZIAYb4RQEHAQEwggH5FoIBp1RoaXMgY2VydGlmaWNhdGUgaW5jb3Jwb3JhdGVzIGJ5IHJlZmVyZW5jZSwgYW5kIGl0cyB1c2UgaXMgc3RyaWN0bHkgc3ViamVjdCB0bywgdGhlIFZlcmlTaWduIENlcnRpZmljYXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUgYXQ6IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9DUFM7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMwIENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBSZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJTElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMCwwKhYoaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTIDARBglghkgBhvhCAQEEBAMCB4AwNgYJYIZIAYb4QgEIBCkWJ2h0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUzCCBIcGCWCGSAGG+EIBDQSCBHgWggR0Q0FVVElPTjogV";
+ s += "GhlIENvbW1vbiBOYW1lIGluIHRoaXMgQ2xhc3MgMSBEaWdpdGFsIApJRCBpcyBub3QgYXV0aGVudGljYXRlZCBieSBWZXJpU2lnbi4gSXQgbWF5IGJlIHRoZQpob2xkZXIncyByZWFsIG5hbWUgb3IgYW4gYWxpYXMuIFZlcmlTaWduIGRvZXMgYXV0aC0KZW50aWNhdGUgdGhlIGUtbWFpbCBhZGRyZXNzIG9mIHRoZSBob2xkZXIuCgpUaGlzIGNlcnRpZmljYXRlIGluY29ycG9yYXRlcyBieSByZWZlcmVuY2UsIGFuZCAKaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRvLCB0aGUgVmVyaVNpZ24gCkNlcnRpZmljYXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUKaW4gdGhlIFZlcmlTaWduIHJlcG9zaXRvcnkgYXQ6IApodHRwczovL3d3dy52ZXJpc2lnbi5jb207IGJ5IEUtbWFpbCBhdApDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLApJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQQoKQ29weXJpZ2h0IChjKTE5OTYgVmVyaVNpZ24sIEluYy4gIEFsbCBSaWdodHMgClJlc2VydmVkLiBDRVJUQUlOIFdBUlJBTlRJRVMgRElTQ0xBSU1FRCBBTkQgCkxJQUJJTElUWSBMSU1JVEVELgoKV0FSTklORzogVEhFIFVTRSBPRiBUSElTIENFUlRJRklDQVRFIElTIFNUUklDVExZClNVQkpFQ1QgVE8gVEhFIFZFUklTSUdOIENFUlRJRklDQVRJT04gUFJBQ1RJQ0UKU1RBVEVNRU5ULiAgVEhFIElTU1VJTkcgQVVUSE9SSVRZIERJU0NMQUlNUyBDRVJUQUlOCklNUExJRUQgQU5EIEVYUFJFU1MgV0FSUkFOVElFUywgSU5DTFVESU5HIFdBUlJBTlRJRVMKT0YgTUVSQ0hBTlRBQklMSVRZIE9SIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUgpQVVJQT1NFLCBBTkQgV0lMTCBOT1QgQkUgTElBQkxFIEZPUiBDT05TRVFVRU5USUFMLApQVU5JVElWRSwgQU5EIENFUlRBSU4gT1RIRVIgREFNQUdFUy4gU0VFIFRIRSBDUFMKRk9SIERFVEFJTFMuCgpDb250ZW50cyBvZiB0aGUgVmVyaVNpZ24gcmVnaXN0ZXJlZApub252ZXJpZmllZFN1YmplY3RBdHRyaWJ1dGVzIGV4dGVuc2lvbiB2YWx1ZSBzaGFsbCAKbm90IGJlIGNvbnNpZGVyZWQgYXMgYWNjdXJhdGUgaW5mb3JtYXRpb24gdmFsaWRhdGVkIApieSB0aGUgSUEuMA0GCSqGSIb3DQEBBAUAA4GBACs9RMcyWa7xX48/h+M+64Ew+KmW2wFCCwTvNwI/1CBhWMRKOjmz+9n4pcReM1oO+pNWL2/WYaKvpQwd4kFl80B1ZoPSWrS3VguODaEzE31Jw7EAaIN/tWbUMjL+i5pa1gFyMV2FkbyTm2VgJcYfvN1pRGLCsm9Gqy8gpW/aSGyc</X509Certificate></X509Data>";
+ AssertEquals ("1 cert", s, (data2.GetXml ().OuterXml));
+
+ data1.LoadXml (xel);
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+
+ X509Certificate x509 = new X509Certificate (cert);
+ KeyInfoX509Data data3 = new KeyInfoX509Data (x509);
+ AssertEquals ("data2==data3", (data2.GetXml ().OuterXml), (data3.GetXml ().OuterXml));
+ }
+
+ public void TestComplex ()
+ {
+ KeyInfoX509Data data1 = new KeyInfoX509Data (cert);
+ KeyInfoX509Data data2 = new KeyInfoX509Data ();
+
+ XmlElement xel = data1.GetXml ();
+ data2.LoadXml (xel);
+
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+ byte[] c = (data1.Certificates[0] as X509Certificate).GetRawCertData();
+ AllTests.AssertEquals ("Certificate[0]", cert, c);
+
+ // add a second X.509 certificate
+ X509Certificate x509 = new X509Certificate (cert2);
+ data1.AddCertificate (x509);
+ xel = data1.GetXml ();
+ data2.LoadXml (xel);
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+ c = (data1.Certificates [1] as X509Certificate).GetRawCertData();
+ AllTests.AssertEquals ("Certificate[1]", cert2, c);
+
+ // add properties from a third X.509 certificate
+ x509 = new X509Certificate (cert3);
+ data1.AddIssuerSerial (x509.GetIssuerName (), x509.GetSerialNumberString ());
+ xel = data1.GetXml ();
+ data2.LoadXml (xel);
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+ // TODO: The type of IssuerSerial isn't documented
+
+ // X509Certificate doesn't export SubjectKeyId so we must improvise
+ byte[] skid = { 0xDE, 0xAD, 0xC0, 0xDE };
+ data1.AddSubjectKeyId (skid);
+ xel = data1.GetXml ();
+ data2.LoadXml (xel);
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+ AllTests.AssertEquals ("SubjectKeyId", skid, data1.SubjectKeyIds[0]);
+
+ data1.AddSubjectName (x509.GetName ());
+ xel = data1.GetXml ();
+ data2.LoadXml (xel);
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+ string s = (string) data1.SubjectNames [0];
+ AllTests.AssertEquals ("SubjectName", x509.GetName (), s);
+ }
+
+ // There's a bug in the framework 1.0 where a CRL entry cannot be included
+ // in a same X509Data entry. This is not per XMLDSIG spec so Mono will accept
+ // this (anyway the bug should be fixed by Microsoft in future release).
+ public void TestCRL ()
+ {
+ KeyInfoX509Data data1 = new KeyInfoX509Data ();
+ data1.CRL = x509crl;
+ XmlElement xel = data1.GetXml ();
+
+ KeyInfoX509Data data2 = new KeyInfoX509Data ();
+ data2.LoadXml (xel);
+
+ AssertEquals ("data1==data2", (data1.GetXml ().OuterXml), (data2.GetXml ().OuterXml));
+ AllTests.AssertEquals ("crl1==crl2", data1.CRL, data2.CRL);
+ }
+
+ public void TestImportX509Data ()
+ {
+ string simple = "<X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><X509Certificate>MIIJuTCCCSKgAwIBAgIQIAs1Xs7EsGO33sY0uXA0RDANBgkqhkiG9w0BAQQFADBiMREwDwYDVQQHEwhJbnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlTaWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXIwHhcNOTYwODIxMDAwMDAwWhcNOTcwODIwMjM1OTU5WjCCAQoxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjFGMEQGA1UECxM9d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUyBJbmNvcnAuIGJ5IFJlZi4sTElBQi5MVEQoYyk5NjEmMCQGA1UECxMdRGlnaXRhbCBJRCBDbGFzcyAxIC0gTmV0c2NhcGUxFjAUBgNVBAMTDURhdmlkIFQuIEdyYXkxHjAcBgkqhkiG9w0BCQEWD2RhdmlkQGZvcm1hbC5pZTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDFgQei6w+4//j4HO4y/78SNWr5a8i+L/s+rwRRSqzdECmozUBbZh6Y7/JMd/qPhtEhZ5JESsSJyYPPiJ9v4jI1AgMBAAGjggcIMIIHBDAJBgNVHRMEAjAAMIICHwYDVR0DBIICFjCCAhIwggIOMIICCgYLYIZIAYb4RQEHAQEwggH5FoIBp1RoaXMgY2VydGlmaWNhdGUgaW5jb3Jwb3JhdGVzIGJ5IHJlZmVyZW5jZSwgYW5kIGl0cyB1c2UgaXMgc3RyaWN0bHkgc3ViamVjdCB0bywgdGhlIFZlcmlTaWduIENlcnRpZmljYXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUgYXQ6IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9DUFM7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMwIENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBSZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJTElUWSBMSU1JVEVELqAOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMCwwKhYoaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTIDARBglghkgBhvhCAQEEBAMCB4AwNgYJYIZIAYb4QgEIBCkWJ2h0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUzCCBIcGCWCGSAGG+EIBDQSCBHgWggR0Q0FVVElPTjogV";
+ simple += "GhlIENvbW1vbiBOYW1lIGluIHRoaXMgQ2xhc3MgMSBEaWdpdGFsIApJRCBpcyBub3QgYXV0aGVudGljYXRlZCBieSBWZXJpU2lnbi4gSXQgbWF5IGJlIHRoZQpob2xkZXIncyByZWFsIG5hbWUgb3IgYW4gYWxpYXMuIFZlcmlTaWduIGRvZXMgYXV0aC0KZW50aWNhdGUgdGhlIGUtbWFpbCBhZGRyZXNzIG9mIHRoZSBob2xkZXIuCgpUaGlzIGNlcnRpZmljYXRlIGluY29ycG9yYXRlcyBieSByZWZlcmVuY2UsIGFuZCAKaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRvLCB0aGUgVmVyaVNpZ24gCkNlcnRpZmljYXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUKaW4gdGhlIFZlcmlTaWduIHJlcG9zaXRvcnkgYXQ6IApodHRwczovL3d3dy52ZXJpc2lnbi5jb207IGJ5IEUtbWFpbCBhdApDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLApJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQQoKQ29weXJpZ2h0IChjKTE5OTYgVmVyaVNpZ24sIEluYy4gIEFsbCBSaWdodHMgClJlc2VydmVkLiBDRVJUQUlOIFdBUlJBTlRJRVMgRElTQ0xBSU1FRCBBTkQgCkxJQUJJTElUWSBMSU1JVEVELgoKV0FSTklORzogVEhFIFVTRSBPRiBUSElTIENFUlRJRklDQVRFIElTIFNUUklDVExZClNVQkpFQ1QgVE8gVEhFIFZFUklTSUdOIENFUlRJRklDQVRJT04gUFJBQ1RJQ0UKU1RBVEVNRU5ULiAgVEhFIElTU1VJTkcgQVVUSE9SSVRZIERJU0NMQUlNUyBDRVJUQUlOCklNUExJRUQgQU5EIEVYUFJFU1MgV0FSUkFOVElFUywgSU5DTFVESU5HIFdBUlJBTlRJRVMKT0YgTUVSQ0hBTlRBQklMSVRZIE9SIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUgpQVVJQT1NFLCBBTkQgV0lMTCBOT1QgQkUgTElBQkxFIEZPUiBDT05TRVFVRU5USUFMLApQVU5JVElWRSwgQU5EIENFUlRBSU4gT1RIRVIgREFNQUdFUy4gU0VFIFRIRSBDUFMKRk9SIERFVEFJTFMuCgpDb250ZW50cyBvZiB0aGUgVmVyaVNpZ24gcmVnaXN0ZXJlZApub252ZXJpZmllZFN1YmplY3RBdHRyaWJ1dGVzIGV4dGVuc2lvbiB2YWx1ZSBzaGFsbCAKbm90IGJlIGNvbnNpZGVyZWQgYXMgYWNjdXJhdGUgaW5mb3JtYXRpb24gdmFsaWRhdGVkIApieSB0aGUgSUEuMA0GCSqGSIb3DQEBBAUAA4GBACs9RMcyWa7xX48/h+M+64Ew+KmW2wFCCwTvNwI/1CBhWMRKOjmz+9n4pcReM1oO+pNWL2/WYaKvpQwd4kFl80B1ZoPSWrS3VguODaEzE31Jw7EAaIN/tWbUMjL+i5pa1gFyMV2FkbyTm2VgJcYfvN1pRGLCsm9Gqy8gpW/aSGyc</X509Certificate></X509Data>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (simple);
+
+ KeyInfoX509Data data1 = new KeyInfoX509Data ();
+ data1.LoadXml (doc.DocumentElement);
+
+ // verify that proper XML is generated (equals to original)
+ string s = (data1.GetXml ().OuterXml);
+ AssertEquals ("Xml-Simple", simple, s);
+
+ // verify that property is parsed correctly
+ byte[] c = (data1.Certificates[0] as X509Certificate).GetRawCertData();
+ AllTests.AssertEquals ("Certificate[0]", cert, c);
+
+ string complex = "<X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><X509IssuerSerial><X509IssuerName>C=US, O=U.S. Government, OU=DoD, CN=Armed Forces Root</X509IssuerName><X509SerialNumber>03</X509SerialNumber></X509IssuerSerial><X509SKI>3q3A3g==</X509SKI><X509SubjectName>C=US, O=U.S. Government, OU=DoD, CN=Armed Forces Root</X509SubjectName><X509Certificate>MIIJuTCCCSKgAwIBAgIQIAs1Xs7EsGO33sY0uXA0RDANBgkqhkiG9w0BAQQFADBiMREwDwYDVQQHEwhJbnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlTaWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXIwHhcNOTYwODIxMDAwMDAwWhcNOTcwODIwMjM1OTU5WjCCAQoxETAPBgNVBAcTCEludGVybmV0MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE0MDIGA1UECxMrVmVyaVNpZ24gQ2xhc3MgMSBDQSAtIEluZGl2aWR1YWwgU3Vic2NyaWJlcjFGMEQGA1UECxM9d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUyBJbmNvcnAuIGJ5IFJlZi4sTElBQi5MVEQoYyk5NjEmMCQGA1UECxMdRGlnaXRhbCBJRCBDbGFzcyAxIC0gTmV0c2NhcGUxFjAUBgNVBAMTDURhdmlkIFQuIEdyYXkxHjAcBgkqhkiG9w0BCQEWD2RhdmlkQGZvcm1hbC5pZTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDFgQei6w+4//j4HO4y/78SNWr5a8i+L/s+rwRRSqzdECmozUBbZh6Y7/JMd/qPhtEhZ5JESsSJyYPPiJ9v4jI1AgMBAAGjggcIMIIHBDAJBgNVHRMEAjAAMIICHwYDVR0DBIICFjCCAhIwggIOMIICCgYLYIZIAYb4RQEHAQEwggH5FoIBp1RoaXMgY2VydGlmaWNhdGUgaW5jb3Jwb3JhdGVzIGJ5IHJlZmVyZW5jZSwgYW5kIGl0cyB1c2UgaXMgc3RyaWN0bHkgc3ViamVjdCB0bywgdGhlIFZlcmlTaWduIENlcnRpZmljYXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUgYXQ6IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9DUFM7IGJ5IEUtbWFpbCBhdCBDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLCBJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQSBUZWwuICsxICg0MTUpIDk2MS04ODMwIENvcHlyaWdodCAoYykgMTk5NiBWZXJpU2lnbiwgSW5jLiAgQWxsIFJpZ2h0cyBSZXNlcnZlZC4gQ0VSVEFJTiBXQVJSQU5USUVTIERJU0NMQUlNRUQgYW5kIExJQUJJTElUWSBMSU1JVEVELq";
+ complex += "AOBgxghkgBhvhFAQcBAQGhDgYMYIZIAYb4RQEHAQECMCwwKhYoaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTIDARBglghkgBhvhCAQEEBAMCB4AwNgYJYIZIAYb4QgEIBCkWJ2h0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L0NQUzCCBIcGCWCGSAGG+EIBDQSCBHgWggR0Q0FVVElPTjogVGhlIENvbW1vbiBOYW1lIGluIHRoaXMgQ2xhc3MgMSBEaWdpdGFsIApJRCBpcyBub3QgYXV0aGVudGljYXRlZCBieSBWZXJpU2lnbi4gSXQgbWF5IGJlIHRoZQpob2xkZXIncyByZWFsIG5hbWUgb3IgYW4gYWxpYXMuIFZlcmlTaWduIGRvZXMgYXV0aC0KZW50aWNhdGUgdGhlIGUtbWFpbCBhZGRyZXNzIG9mIHRoZSBob2xkZXIuCgpUaGlzIGNlcnRpZmljYXRlIGluY29ycG9yYXRlcyBieSByZWZlcmVuY2UsIGFuZCAKaXRzIHVzZSBpcyBzdHJpY3RseSBzdWJqZWN0IHRvLCB0aGUgVmVyaVNpZ24gCkNlcnRpZmljYXRpb24gUHJhY3RpY2UgU3RhdGVtZW50IChDUFMpLCBhdmFpbGFibGUKaW4gdGhlIFZlcmlTaWduIHJlcG9zaXRvcnkgYXQ6IApodHRwczovL3d3dy52ZXJpc2lnbi5jb207IGJ5IEUtbWFpbCBhdApDUFMtcmVxdWVzdHNAdmVyaXNpZ24uY29tOyBvciBieSBtYWlsIGF0IFZlcmlTaWduLApJbmMuLCAyNTkzIENvYXN0IEF2ZS4sIE1vdW50YWluIFZpZXcsIENBIDk0MDQzIFVTQQoKQ29weXJpZ2h0IChjKTE5OTYgVmVyaVNpZ24sIEluYy4gIEFsbCBSaWdodHMgClJlc2VydmVkLiBDRVJUQUlOIFdBUlJBTlRJRVMgRElTQ0xBSU1FRCBBTkQgCkxJQUJJTElUWSBMSU1JVEVELgoKV0FSTklORzogVEhFIFVTRSBPRiBUSElTIENFUlRJRklDQVRFIElTIFNUUklDVExZClNVQkpFQ1QgVE8gVEhFIFZFUklTSUdOIENFUlRJRklDQVRJT04gUFJBQ1RJQ0UKU1RBVEVNRU5ULiAgVEhFIElTU1VJTkcgQVVUSE9SSVRZIERJU0NMQUlNUyBDRVJUQUlOCklNUExJRUQgQU5EIEVYUFJFU1MgV0FSUkFOVElFUywgSU5DTFVESU5HIFdBUlJBTlRJRVMKT0YgTUVSQ0hBTlRBQklMSVRZIE9SIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUgpQVVJQT1NFLCBBTkQgV0lMTCBOT1QgQkUgTElBQkxFIEZPUiBDT05TRVFVRU5USUFMLApQVU5JVElWRSwgQU5EIENFUlRBSU4gT1RIRVIgREFNQUdFUy4gU0VFIFRIRSBDUFMKRk9SIERFVEFJTFMuCgpDb250ZW50cyBvZiB0aGUgVmVyaVNpZ24gcmVnaXN0ZXJlZApub252ZXJpZmllZFN1YmplY3RBdHRyaWJ1dGVzIGV4dGVuc2lvbiB2YWx1ZSBzaGFsbCAKbm90IGJlIGNvbnNpZGVyZWQgYXMgYWNjdXJhdGUgaW5mb3JtYXRpb24gdmF";
+ complex += "saWRhdGVkIApieSB0aGUgSUEuMA0GCSqGSIb3DQEBBAUAA4GBACs9RMcyWa7xX48/h+M+64Ew+KmW2wFCCwTvNwI/1CBhWMRKOjmz+9n4pcReM1oO+pNWL2/WYaKvpQwd4kFl80B1ZoPSWrS3VguODaEzE31Jw7EAaIN/tWbUMjL+i5pa1gFyMV2FkbyTm2VgJcYfvN1pRGLCsm9Gqy8gpW/aSGyc</X509Certificate><X509Certificate>MIICHTCCAYYCARQwDQYJKoZIhvcNAQEEBQAwWDELMAkGA1UEBhMCQ0ExHzAdBgNVBAMTFktleXdpdG5lc3MgQ2FuYWRhIEluYy4xKDAmBgorBgEEASoCCwIBExhrZXl3aXRuZXNzQGtleXdpdG5lc3MuY2EwHhcNOTYwNTA3MDAwMDAwWhcNOTkwNTA3MDAwMDAwWjBYMQswCQYDVQQGEwJDQTEfMB0GA1UEAxMWS2V5d2l0bmVzcyBDYW5hZGEgSW5jLjEoMCYGCisGAQQBKgILAgETGGtleXdpdG5lc3NAa2V5d2l0bmVzcy5jYTCBnTANBgkqhkiG9w0BAQEFAAOBiwAwgYcCgYEAzSP6KuHtmPTp0JM+13qAAkzMwQKvXLYff/pXQm8w0SDFtSEHQCyphsLzZISuPYUu7YW9VLAYKO9q+BvnCxYfkyVPx/iOw7nKmIQOVdAv73h3xXIoX2C/GSvRcqK32D/glzRaAb0EnMh4Rc2TjRXydhARq7hbLp5S3YE+nGTIKZMCAQMwDQYJKoZIhvcNAQEEBQADgYEAMho1ur9DJ9a01Lh25eObTWzAhsl3NbprFi0TRkqwMlOhW1rpmeIMhogXTg3+gqxOR+/7/zms7jXI+lI3CkmtWa3iiqkcxl8f+G9zfs2gMegMvvVN2bKrihK2MHhoEXwN8UlNo/2y6f8d8JH6VIX/M5Dowb+km6RiRr1hElmYQYk=</X509Certificate></X509Data>";
+ doc.LoadXml (complex);
+ KeyInfoX509Data data2 = new KeyInfoX509Data ();
+ data2.LoadXml (doc.DocumentElement);
+ s = (data2.GetXml ().OuterXml);
+ AssertEquals ("Xml-Complex", complex, s);
+
+ string crl = "<X509Data xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><X509CRL>HoIBBTByAgEBMAsGCSqGSIb3DQEBBTBRMQswCQYDVQQGEwJVUzEYMBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNEb0QxGjAYBgNVBAMTEUFybWVkIEZvcmNlcyBSb290Fw0wMjEwMTExMzEyNTBaMAsGCSqGSIb3DQEBBQOBgQB9otEZbQ8Py+SjvuA2CvNMm6/mT/bjr89V88bbq0wWMqpzrczcMjNg34vMk7VPauxwU6/PBw+gzWasAFfGXF0hsb0wiY53jdRpfsA2ftLYIHEIgNLLdIvYQhcEmYCkUnAuwOOMC/95t0V33MXPQ5iRffEB91PXxlE18InMwf/iiQ==</X509CRL></X509Data>";
+ doc.LoadXml (crl);
+ KeyInfoX509Data data3 = new KeyInfoX509Data ();
+ data3.LoadXml (doc.DocumentElement);
+ s = (data3.GetXml ().OuterXml);
+ AssertEquals ("Xml-Crl", crl, s);
+ }
+
+ public void TestInvalidKeyNode ()
+ {
+ KeyInfoX509Data data1 = new KeyInfoX509Data ();
+ try {
+ data1.LoadXml (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ string bad = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (bad);
+ try {
+ data1.LoadXml (doc.DocumentElement);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // malformed certificate (none)
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/RSAKeyValueTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/RSAKeyValueTest.cs
new file mode 100644
index 00000000000..b346a010580
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/RSAKeyValueTest.cs
@@ -0,0 +1,95 @@
+//
+// RSAKeyValueTest.cs - NUnit Test Cases for RSAKeyValue
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class RSAKeyValueTest : TestCase {
+
+ public RSAKeyValueTest () : base ("System.Security.Cryptography.Xml.RSAKeyValue testsuite") {}
+ public RSAKeyValueTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (RSAKeyValueTest));
+ }
+ }
+
+ public void TestGeneratedKey ()
+ {
+ RSAKeyValue rsa1 = new RSAKeyValue ();
+ AssertNotNull ("Key", rsa1.Key);
+ XmlElement xmlkey = rsa1.GetXml ();
+
+ RSAKeyValue rsa2 = new RSAKeyValue ();
+ rsa2.LoadXml (xmlkey);
+
+ Assert ("rsa1==rsa2", (rsa1.GetXml ().OuterXml) == (rsa2.GetXml ().OuterXml));
+
+ RSA key = rsa1.Key;
+ RSAKeyValue rsa3 = new RSAKeyValue (key);
+ Assert ("rsa3==rsa1", (rsa3.GetXml ().OuterXml) == (rsa1.GetXml ().OuterXml));
+ Assert ("rsa3==rsa2", (rsa3.GetXml ().OuterXml) == (rsa2.GetXml ().OuterXml));
+ }
+
+ public void TestImportKey ()
+ {
+ string rsaKey = "<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>ogZ1/O7iks9ncETqNxLDKoPvgrT4nFx1a3lOmpywEmgbc5+8vI5dSzReH4v0YrflY75rIJx13CYWMsaHfQ78GtXvaeshHlQ3lLTuSdYEJceKll/URlBoKQtOj5qYIVSFOIVGHv4Y/0lnLftOzIydem29KKH6lJQlJawBBssR12s=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (rsaKey);
+
+ RSAKeyValue rsa1 = new RSAKeyValue ();
+ rsa1.LoadXml (doc.DocumentElement);
+
+ string s = (rsa1.GetXml ().OuterXml);
+ AssertEquals ("RSA Key", rsaKey, s);
+ }
+
+ public void TestInvalidValue ()
+ {
+ string badKey = "<Test></Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (badKey);
+
+ RSAKeyValue rsa1 = new RSAKeyValue ();
+
+ try {
+ rsa1.LoadXml (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ try {
+ rsa1.LoadXml (doc.DocumentElement);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ReferenceTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ReferenceTest.cs
new file mode 100644
index 00000000000..60368601066
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/ReferenceTest.cs
@@ -0,0 +1,199 @@
+//
+// ReferenceTest.cs - NUnit Test Cases for Reference
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class ReferenceTest : TestCase {
+
+ public ReferenceTest () : base ("System.Security.Cryptography.Xml.Reference testsuite") {}
+ public ReferenceTest (string name) : base (name) {}
+
+ private Reference reference;
+
+ protected override void SetUp ()
+ {
+ reference = new Reference ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (ReferenceTest));
+ }
+ }
+
+ public void TestProperties ()
+ {
+ AssertNull ("Uri (null)", reference.Uri);
+ AssertNotNull ("TransformChain", reference.TransformChain);
+ AssertEquals ("ToString()", "System.Security.Cryptography.Xml.Reference", reference.ToString ());
+ // test uri constructor
+ string uri = "uri";
+ reference = new Reference (uri);
+ AssertEquals ("DigestMethod", "http://www.w3.org/2000/09/xmldsig#sha1", reference.DigestMethod);
+ AssertNull ("DigestValue", reference.DigestValue);
+ AssertNull ("Id", reference.Id);
+ AssertNull ("Type", reference.Type);
+ AssertEquals ("Uri", uri, reference.Uri);
+ }
+
+ public void TestLoadNoTransform ()
+ {
+ string value = "<Reference URI=\"#MyObjectId\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>/Vvq6sXEVbtZC8GwNtLQnGOy/VI=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-Xml", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-URI", "#MyObjectId", reference.Uri);
+ byte[] hash = { 0xFD, 0x5B, 0xEA, 0xEA, 0xC5, 0xC4, 0x55, 0xBB, 0x59, 0x0B, 0xC1, 0xB0, 0x36, 0xD2, 0xD0, 0x9C, 0x63, 0xB2, 0xFD, 0x52 };
+ AllTests.AssertEquals("Load-Digest", hash, reference.DigestValue);
+ AssertEquals ("Load-#Transform", 0, reference.TransformChain.Count);
+ }
+
+ public void TestLoadBase64Transform ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-Base64", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 1, reference.TransformChain.Count);
+ }
+
+ public void TestLoadC14NTransform ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-C14N", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 1, reference.TransformChain.Count);
+ }
+
+ public void TestLoadC14NWithCommentsTransforms ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-C14NWithComments", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 1, reference.TransformChain.Count);
+ }
+
+ public void TestLoadEnvelopedSignatureTransforms ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-Enveloped", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 1, reference.TransformChain.Count);
+ }
+
+ public void TestLoadXPathTransforms ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath></XPath></Transform></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-XPath", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 1, reference.TransformChain.Count);
+ }
+
+ public void TestLoadXsltTransforms ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ try {
+ reference.LoadXml (doc.DocumentElement);
+ }
+ catch (Exception e) {
+ Fail (e.ToString ());
+ }
+ AssertEquals ("Load-Xslt", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 1, reference.TransformChain.Count);
+ }
+
+ public void TestLoadAllTransforms ()
+ {
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath></XPath></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ reference.LoadXml (doc.DocumentElement);
+ AssertEquals ("Load-Xml", value, (reference.GetXml().OuterXml));
+ AssertEquals ("Load-#Transform", 6, reference.TransformChain.Count);
+ }
+
+ public void TestAllTransform ()
+ {
+ // adding an empty hash value
+ byte[] hash = new byte [20];
+ reference.DigestValue = hash;
+ XmlElement xel = reference.GetXml ();
+ // this is the minimal Reference (DisestValue)!
+ AssertNotNull ("GetXml", xel);
+
+ reference.AddTransform (new XmlDsigBase64Transform ());
+ reference.AddTransform (new XmlDsigC14NTransform ());
+ reference.AddTransform (new XmlDsigC14NWithCommentsTransform ());
+ reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+ reference.AddTransform (new XmlDsigXPathTransform ());
+ reference.AddTransform (new XmlDsigXsltTransform ());
+
+ string value = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath></XPath></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ AssertEquals("Get-Xml", value, (reference.GetXml().OuterXml));
+ // however this value cannot be loaded as it's missing some transform (xslt) parameters
+
+ // can we add them again ?
+ reference.AddTransform (new XmlDsigBase64Transform ());
+ reference.AddTransform (new XmlDsigC14NTransform ());
+ reference.AddTransform (new XmlDsigC14NWithCommentsTransform ());
+ reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+ reference.AddTransform (new XmlDsigXPathTransform ());
+ reference.AddTransform (new XmlDsigXsltTransform ());
+
+ // seems so ;-)
+ AssertEquals ("# Transforms", 12, reference.TransformChain.Count);
+ }
+
+ public void TestNull ()
+ {
+ // null DigestMethod -> "" DigestMethod !!!
+ reference.DigestMethod = null;
+ AssertNull ("DigestMethod null", reference.DigestMethod);
+ }
+
+ public void TestBadness ()
+ {
+ Reference reference = new Reference ();
+ reference.Uri = "#MyObjectId";
+ // not enough info
+ try {
+ XmlElement bad = reference.GetXml ();
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got: " + e.ToString ());
+ }
+ // bad hash - there's no validation!
+ reference.DigestMethod = "http://www.w3.org/2000/09/xmldsig#mono";
+ }
+}
+}
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignatureTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignatureTest.cs
new file mode 100644
index 00000000000..54bcdbd2bd9
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignatureTest.cs
@@ -0,0 +1,76 @@
+//
+// SignatureTest.cs - NUnit Test Cases for SignedXml
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class SignatureTest : TestCase {
+
+ public SignatureTest () : base ("System.Security.Cryptography.Xml.Signature testsuite") {}
+ public SignatureTest (string name) : base (name) {}
+
+ protected Signature signature;
+
+ protected override void SetUp ()
+ {
+ signature = new Signature ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (SignatureTest));
+ }
+ }
+
+ public void TestSignature ()
+ {
+ XmlElement xel = null;
+ // empty - missing SignedInfo
+ try {
+ xel = signature.GetXml ();
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got :" + e.ToString ());
+ }
+
+ SignedInfo info = new SignedInfo ();
+ signature.SignedInfo = info;
+ info.SignatureMethod = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
+ signature.SignatureValue = new byte [128];
+ try {
+ xel = signature.GetXml ();
+ }
+ catch (Exception e) {
+ Fail ("Expected ... but got :" + e.ToString ());
+ }
+ }
+
+ public void TestLoad ()
+ {
+ string value = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>/Vvq6sXEVbtZC8GwNtLQnGOy/VI=</DigestValue></Reference></SignedInfo><SignatureValue>A6XuE8Cy9iOffRXaW9b0+dUcMUJQnlmwLsiqtQnADbCtZXnXAaeJ6nGnQ4Mm0IGi0AJc7/2CoJReXl7iW4hltmFguG1e3nl0VxCyCTHKGOCo1u8R3K+B1rTaenFbSxs42EM7/D9KETsPlzfYfis36yM3PqatiCUOsoMsAiMGzlc=</SignatureValue><KeyInfo><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>tI8QYIpbG/m6JLyvP+S3X8mzcaAIayxomyTimSh9UCpEucRnGvLw0P73uStNpiF7wltTZA1HEsv+Ha39dY/0j/Wiy3RAodGDRNuKQao1wu34aNybZ673brbsbHFUfw/o7nlKD2xO84fbajBZmKtBBDy63NHt+QL+grSrREPfCTM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\"><MyElement xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+ signature.LoadXml (doc.DocumentElement);
+ string s = signature.GetXml ().OuterXml;
+ AssertEquals ("Load", value, s);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedInfoTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedInfoTest.cs
new file mode 100644
index 00000000000..d3e6209dc64
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedInfoTest.cs
@@ -0,0 +1,156 @@
+//
+// SignedInfoTest.cs - NUnit Test Cases for SignedInfo
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class SignedInfoTest : TestCase {
+
+ public SignedInfoTest () : base ("System.Security.Cryptography.Xml.SignedInfo testsuite") {}
+ public SignedInfoTest (string name) : base (name) {}
+
+ protected SignedInfo info;
+
+ protected override void SetUp ()
+ {
+ info = new SignedInfo ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (SignedInfoTest));
+ }
+ }
+
+ public void TestEmpty ()
+ {
+ AssertEquals ("CanonicalizationMethod", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", info.CanonicalizationMethod);
+ // NON-WORKING ??? AssertEquals ("Id", "", info.Id);
+ AssertNotNull ("References", info.References);
+ AssertEquals ("References.Count", 0, info.References.Count);
+ // NON-WORKING ??? AssertEquals ("SignatureLength", "", info.SignatureLength);
+ // NON-WORKING ??? AssertEquals ("SignatureMethod", "", info.SignatureMethod);
+ AssertEquals ("ToString()", "System.Security.Cryptography.Xml.SignedInfo", info.ToString ());
+
+ try {
+ string xml = info.GetXml().OuterXml;
+ Fail ("Empty Xml: Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Empty Xml: Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestProperties ()
+ {
+ info.CanonicalizationMethod = "http://www.go-mono.com/";
+ AssertEquals ("CanonicalizationMethod", "http://www.go-mono.com/", info.CanonicalizationMethod);
+ info.Id = "Mono::";
+ AssertEquals ("Id", "Mono::", info.Id);
+ }
+
+ public void TestReferences ()
+ {
+ Reference r1 = new Reference ();
+ r1.Uri = "http://www.go-mono.com/";
+ r1.AddTransform (new XmlDsigBase64Transform ());
+ info.AddReference (r1);
+ AssertEquals ("References.Count 1", 1, info.References.Count);
+
+ Reference r2 = new Reference ("http://www.motus.com/");
+ r2.AddTransform (new XmlDsigBase64Transform ());
+ info.AddReference (r2);
+ AssertEquals ("References.Count 2", 2, info.References.Count);
+
+ info.SignatureMethod = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
+ }
+
+ public void TestLoad ()
+ {
+ string xml = "<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>/Vvq6sXEVbtZC8GwNtLQnGOy/VI=</DigestValue></Reference></SignedInfo>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (xml);
+ info.LoadXml (doc.DocumentElement);
+ AssertEquals ("LoadXml", xml, (info.GetXml ().OuterXml));
+ AssertEquals ("LoadXml-C14N", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", info.CanonicalizationMethod);
+ AssertEquals ("LoadXml-Algo", "http://www.w3.org/2000/09/xmldsig#rsa-sha1", info.SignatureMethod);
+ AssertEquals ("LoadXml-Ref1", 1, info.References.Count);
+ }
+
+ // there are many (documented) not supported methods in SignedInfo
+ public void TestNotSupported ()
+ {
+ try {
+ int n = info.Count;
+ Fail ("Count: Expected NotSupportedException but got none");
+ }
+ catch (NotSupportedException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Count: Expected NotSupportedException but got: " + e.ToString ());
+ }
+
+ try {
+ bool b = info.IsReadOnly;
+ Fail ("IsReadOnly: Expected NotSupportedException but got none");
+ }
+ catch (NotSupportedException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("IsReadOnly: Expected NotSupportedException but got: " + e.ToString ());
+ }
+
+ try {
+ bool b = info.IsSynchronized;
+ Fail ("IsSynchronized: Expected NotSupportedException but got none");
+ }
+ catch (NotSupportedException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("IsSynchronized: Expected NotSupportedException but got: " + e.ToString ());
+ }
+
+ try {
+ object o = info.SyncRoot;
+ Fail ("SyncRoot: Expected NotSupportedException but got none");
+ }
+ catch (NotSupportedException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("SyncRoot: Expected NotSupportedException but got: " + e.ToString ());
+ }
+
+ try {
+ info.CopyTo (null, 0);
+ Fail ("CopyTo: Expected NotSupportedException but got none");
+ }
+ catch (NotSupportedException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("CopyTo: Expected NotSupportedException but got: " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
new file mode 100644
index 00000000000..aa764314498
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
@@ -0,0 +1,233 @@
+//
+// SignedXmlTest.cs - NUnit Test Cases for SignedXml
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class SignedXmlTest : TestCase {
+
+ public SignedXmlTest () : base ("System.Security.Cryptography.Xml.SignedXml testsuite") {}
+ public SignedXmlTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (SignedXmlTest));
+ }
+ }
+
+ public void TestStatic ()
+ {
+ AssertEquals ("XmlDsigCanonicalizationUrl", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", SignedXml.XmlDsigCanonicalizationUrl);
+ AssertEquals ("XmlDsigCanonicalizationWithCommentsUrl", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", SignedXml.XmlDsigCanonicalizationWithCommentsUrl);
+ AssertEquals ("XmlDsigDSAUrl", "http://www.w3.org/2000/09/xmldsig#dsa-sha1", SignedXml.XmlDsigDSAUrl);
+ AssertEquals ("XmlDsigHMACSHA1Url", "http://www.w3.org/2000/09/xmldsig#hmac-sha1", SignedXml.XmlDsigHMACSHA1Url);
+ AssertEquals ("XmlDsigMinimalCanonicalizationUrl", "http://www.w3.org/2000/09/xmldsig#minimal", SignedXml.XmlDsigMinimalCanonicalizationUrl);
+ AssertEquals ("XmlDsigNamespaceUrl", "http://www.w3.org/2000/09/xmldsig#", SignedXml.XmlDsigNamespaceUrl);
+ AssertEquals ("XmlDsigRSASHA1Url", "http://www.w3.org/2000/09/xmldsig#rsa-sha1", SignedXml.XmlDsigRSASHA1Url);
+ AssertEquals ("XmlDsigSHA1Url", "http://www.w3.org/2000/09/xmldsig#sha1", SignedXml.XmlDsigSHA1Url);
+ }
+
+ // sample from MSDN (url)
+ public SignedXml MSDNSample ()
+ {
+ // Create example data to sign.
+ XmlDocument document = new XmlDocument ();
+ XmlNode node = document.CreateNode (XmlNodeType.Element, "", "MyElement", "samples");
+ node.InnerText = "This is some text";
+ document.AppendChild (node);
+
+ // Create the SignedXml message.
+ SignedXml signedXml = new SignedXml ();
+
+ // Create a data object to hold the data to sign.
+ DataObject dataObject = new DataObject ();
+ dataObject.Data = document.ChildNodes;
+ dataObject.Id = "MyObjectId";
+
+ // Add the data object to the signature.
+ signedXml.AddObject (dataObject);
+
+ // Create a reference to be able to package everything into the
+ // message.
+ Reference reference = new Reference ();
+ reference.Uri = "#MyObjectId";
+
+ // Add it to the message.
+ signedXml.AddReference (reference);
+
+ return signedXml;
+ }
+
+ public void TestAsymmetricRSASignature ()
+ {
+ SignedXml signedXml = MSDNSample ();
+
+ RSA key = RSA.Create ();
+ signedXml.SigningKey = key;
+
+ // Add a KeyInfo.
+ KeyInfo keyInfo = new KeyInfo ();
+ keyInfo.AddClause (new RSAKeyValue (key));
+ signedXml.KeyInfo = keyInfo;
+
+ // Compute the signature.
+ signedXml.ComputeSignature ();
+
+ // Get the XML representation of the signature.
+ XmlElement xmlSignature = signedXml.GetXml ();
+
+ // LAMESPEC: we must reload the signature or it won't work
+ // MS framework throw a "malformed element"
+ SignedXml vrfy = new SignedXml ();
+ vrfy.LoadXml (xmlSignature);
+
+ // assert that we can verify our own signature
+ Assert ("RSA-Compute/Verify", vrfy.CheckSignature ());
+ }
+
+ public void TestAsymmetricDSASignature ()
+ {
+ SignedXml signedXml = MSDNSample ();
+
+ DSA key = DSA.Create ();
+ signedXml.SigningKey = key;
+
+ // Add a KeyInfo.
+ KeyInfo keyInfo = new KeyInfo ();
+ keyInfo.AddClause (new DSAKeyValue (key));
+ signedXml.KeyInfo = keyInfo;
+
+ // Compute the signature.
+ signedXml.ComputeSignature ();
+
+ // Get the XML representation of the signature.
+ XmlElement xmlSignature = signedXml.GetXml ();
+
+ // LAMESPEC: we must reload the signature or it won't work
+ // MS framework throw a "malformed element"
+ SignedXml vrfy = new SignedXml ();
+ vrfy.LoadXml (xmlSignature);
+
+ // assert that we can verify our own signature
+ Assert ("DSA-Compute/Verify", vrfy.CheckSignature ());
+ }
+
+ public void TestSymmetricHMACSHA1Signature ()
+ {
+ SignedXml signedXml = MSDNSample ();
+
+ // Compute the signature.
+ byte[] secretkey = Encoding.Default.GetBytes ("password");
+ HMACSHA1 hmac = new HMACSHA1 (secretkey);
+ signedXml.ComputeSignature (hmac);
+
+ // Get the XML representation of the signature.
+ XmlElement xmlSignature = signedXml.GetXml ();
+
+ // LAMESPEC: we must reload the signature or it won't work
+ // MS framework throw a "malformed element"
+ SignedXml vrfy = new SignedXml ();
+ vrfy.LoadXml (xmlSignature);
+
+ // assert that we can verify our own signature
+ Assert ("HMACSHA1-Compute/Verify", vrfy.CheckSignature (hmac));
+ }
+
+ public void TestSymmetricMACTripleDESSignature ()
+ {
+ SignedXml signedXml = MSDNSample ();
+
+ // Compute the signature.
+ byte[] secretkey = Encoding.Default.GetBytes ("password");
+ MACTripleDES hmac = new MACTripleDES (secretkey);
+ try {
+ signedXml.ComputeSignature (hmac);
+ Fail ("Expected CryptographicException but none");
+ }
+ catch (CryptographicException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+
+ // Using empty constructor
+ // LAMESPEC: The two other constructors don't seems to apply in verifying signatures
+ public void TestAsymmetricRSAVerify ()
+ {
+ string value = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>/Vvq6sXEVbtZC8GwNtLQnGOy/VI=</DigestValue></Reference></SignedInfo><SignatureValue>A6XuE8Cy9iOffRXaW9b0+dUcMUJQnlmwLsiqtQnADbCtZXnXAaeJ6nGnQ4Mm0IGi0AJc7/2CoJReXl7iW4hltmFguG1e3nl0VxCyCTHKGOCo1u8R3K+B1rTaenFbSxs42EM7/D9KETsPlzfYfis36yM3PqatiCUOsoMsAiMGzlc=</SignatureValue><KeyInfo><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>tI8QYIpbG/m6JLyvP+S3X8mzcaAIayxomyTimSh9UCpEucRnGvLw0P73uStNpiF7wltTZA1HEsv+Ha39dY/0j/Wiy3RAodGDRNuKQao1wu34aNybZ673brbsbHFUfw/o7nlKD2xO84fbajBZmKtBBDy63NHt+QL+grSrREPfCTM=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\"><MyElement xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ SignedXml v1 = new SignedXml ();
+ v1.LoadXml (doc.DocumentElement);
+ Assert ("RSA-CheckSignature()", v1.CheckSignature ());
+
+ SignedXml v2 = new SignedXml ();
+ v2.LoadXml (doc.DocumentElement);
+ AsymmetricAlgorithm key = null;
+ bool vrfy = v2.CheckSignatureReturningKey (out key);
+ Assert ("RSA-CheckSignatureReturningKey()", vrfy);
+
+ SignedXml v3 = new SignedXml ();
+ v3.LoadXml (doc.DocumentElement);
+ Assert ("RSA-CheckSignature(key)", v3.CheckSignature (key));
+ }
+
+ // Using empty constructor
+ // LAMESPEC: The two other constructors don't seems to apply in verifying signatures
+ public void TestAsymmetricDSAVerify ()
+ {
+ string value = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#dsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>/Vvq6sXEVbtZC8GwNtLQnGOy/VI=</DigestValue></Reference></SignedInfo><SignatureValue>BYz/qRGjGsN1yMFPxWa3awUZm1y4I/IxOQroMxkOteRGgk1HIwhRYw==</SignatureValue><KeyInfo><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><DSAKeyValue><P>iglVaZ+LsSL8Y0aDXmFMBwva3xHqIypr3l/LtqBH9ziV2Sh1M4JVasAiKqytWIWt/s/Uk8Ckf2tO2Ww1vsNi1NL+Kg9T7FE52sn380/rF0miwGkZeidzm74OWhykb3J+wCTXaIwOzAWI1yN7FoeoN7wzF12jjlSXAXeqPMlViqk=</P><Q>u4sowiJMHilNRojtdmIuQY2YnB8=</Q><G>SdnN7d+wn1n+HH4Hr8MIryIRYgcXdbZ5TH7jAnuWc1koqRc1AZfcYAZ6RDf+orx6Lzn055FTFiN+1NHQfGUtXJCWW0zz0FVV1NJux7WRj8vGTldjJ5ef0oCenkpwDjcIxWsZgVobve4GPoyN1sAc1scnkJB59oupibklmF4y72A=</G><Y>XejzS8Z51yfl0zbYnxSYYbHqreSLjNCoGPB/KjM1TOyV5sMjz0StKtGrFWryTWc7EgvFY7kUth4e04VKf9HbK8z/FifHTXj8+Tszbjzw8GfInnBwLN+vJgbpnjtypmiI5Bm2nLiRbfkdAHP+OrKtr/EauM9GQfYuaxm3/Vj8B84=</Y><J>vGwGg9wqwwWP9xsoPoXu6kHArJtadiNKe9azBiUx5Ob883gd5wlKfEcGuKkBmBySGbgwxyOsIBovd9Kk48hF01ymfQzAAuHR0EdJECSsTsTTKVTLQNBU32O+PRbLYpv4E8kt6rNL83JLJCBY</J><Seed>sqzn8J6fd2gtEyq6YOqiUSHgPE8=</Seed><PgenCounter>sQ==</PgenCounter></DSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\"><MyElement xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ SignedXml v1 = new SignedXml ();
+ v1.LoadXml (doc.DocumentElement);
+ Assert ("DSA-CheckSignature()", v1.CheckSignature ());
+
+ SignedXml v2 = new SignedXml ();
+ v2.LoadXml (doc.DocumentElement);
+ AsymmetricAlgorithm key = null;
+ bool vrfy = v2.CheckSignatureReturningKey (out key);
+ Assert ("DSA-CheckSignatureReturningKey()", vrfy);
+
+ SignedXml v3 = new SignedXml ();
+ v3.LoadXml (doc.DocumentElement);
+ Assert ("DSA-CheckSignature(key)", v3.CheckSignature (key));
+ }
+
+ public void TestSymmetricHMACSHA1Verify ()
+ {
+ string value = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#hmac-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>/Vvq6sXEVbtZC8GwNtLQnGOy/VI=</DigestValue></Reference></SignedInfo><SignatureValue>e2RxYr5yGbvTqZLCFcgA2RAC0yE=</SignatureValue><Object Id=\"MyObjectId\"><MyElement xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ SignedXml v1 = new SignedXml ();
+ v1.LoadXml (doc.DocumentElement);
+
+ byte[] secretkey = Encoding.Default.GetBytes ("password");
+ HMACSHA1 hmac = new HMACSHA1 (secretkey);
+
+ Assert ("HMACSHA1-CheckSignature(key)", v1.CheckSignature (hmac));
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/TransformChainTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/TransformChainTest.cs
new file mode 100644
index 00000000000..fb1d025fcd6
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/TransformChainTest.cs
@@ -0,0 +1,80 @@
+//
+// TransformChainTest.cs - NUnit Test Cases for TransformChain
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class TransformChainTest : TestCase {
+
+ public TransformChainTest () : base ("System.Security.Cryptography.Xml.TransformChain testsuite") {}
+ public TransformChainTest (string name) : base (name) {}
+
+ protected TransformChain chain;
+
+ protected override void SetUp ()
+ {
+ chain = new TransformChain ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (TransformChainTest));
+ }
+ }
+
+ public void TestEmpty ()
+ {
+ AssertEquals ("empty count", 0, chain.Count);
+ AssertNotNull ("IEnumerator", chain.GetEnumerator ());
+ AssertEquals ("ToString()", "System.Security.Cryptography.Xml.TransformChain", chain.ToString ());
+ }
+
+ public void TestChain ()
+ {
+ XmlDsigBase64Transform base64 = new XmlDsigBase64Transform ();
+ chain.Add (base64);
+ AssertEquals ("XmlDsigBase64Transform", base64, chain[0]);
+ AssertEquals ("count 1", 1, chain.Count);
+
+ XmlDsigC14NTransform c14n = new XmlDsigC14NTransform ();
+ chain.Add (c14n);
+ AssertEquals ("XmlDsigC14NTransform", c14n, chain[1]);
+ AssertEquals ("count 2", 2, chain.Count);
+
+ XmlDsigC14NWithCommentsTransform c14nc = new XmlDsigC14NWithCommentsTransform ();
+ chain.Add (c14nc);
+ AssertEquals ("XmlDsigC14NWithCommentsTransform", c14nc, chain[2]);
+ AssertEquals ("count 3", 3, chain.Count);
+
+ XmlDsigEnvelopedSignatureTransform esign = new XmlDsigEnvelopedSignatureTransform ();
+ chain.Add (esign);
+ AssertEquals ("XmlDsigEnvelopedSignatureTransform", esign, chain[3]);
+ AssertEquals ("count 4", 4, chain.Count);
+
+ XmlDsigXPathTransform xpath = new XmlDsigXPathTransform ();
+ chain.Add (xpath);
+ AssertEquals ("XmlDsigXPathTransform", xpath, chain[4]);
+ AssertEquals ("count 5", 5, chain.Count);
+
+ XmlDsigXsltTransform xslt = new XmlDsigXsltTransform ();
+ chain.Add (xslt);
+ AssertEquals ("XmlDsigXsltTransform", xslt, chain[5]);
+ AssertEquals ("count 6", 6, chain.Count);
+ }
+
+}
+
+}
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigBase64TransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigBase64TransformTest.cs
new file mode 100644
index 00000000000..89941a5b9e3
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigBase64TransformTest.cs
@@ -0,0 +1,159 @@
+//
+// XmlDsigBase64TransformTest.cs - NUnit Test Cases for XmlDsigBase64Transform
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class XmlDsigBase64TransformTest : TestCase {
+
+ public XmlDsigBase64TransformTest () : base ("System.Security.Cryptography.Xml.XmlDsigBase64Transform testsuite") {}
+ public XmlDsigBase64TransformTest (string name) : base (name) {}
+
+ protected XmlDsigBase64Transform transform;
+
+ protected override void SetUp ()
+ {
+ transform = new XmlDsigBase64Transform ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (XmlDsigBase64TransformTest));
+ }
+ }
+
+ public void TestProperties ()
+ {
+ AssertEquals ("Algorithm", "http://www.w3.org/2000/09/xmldsig#base64", transform.Algorithm);
+
+ Type[] input = transform.InputTypes;
+ Assert ("Input #", (input.Length == 3));
+ // check presence of every supported input types
+ bool istream = false;
+ bool ixmldoc = false;
+ bool ixmlnl = false;
+ foreach (Type t in input) {
+ if (t.ToString () == "System.IO.Stream")
+ istream = true;
+ if (t.ToString () == "System.Xml.XmlDocument")
+ ixmldoc = true;
+ if (t.ToString () == "System.Xml.XmlNodeList")
+ ixmlnl = true;
+ }
+ Assert ("Input Stream", istream);
+ Assert ("Input XmlDocument", ixmldoc);
+ Assert ("Input XmlNodeList", ixmlnl);
+
+ Type[] output = transform.OutputTypes;
+ Assert ("Output #", (output.Length == 1));
+ // check presence of every supported output types
+ bool ostream = false;
+ foreach (Type t in input) {
+ if (t.ToString () == "System.IO.Stream")
+ ostream = true;
+ }
+ Assert ("Output Stream", ostream);
+ }
+
+ private string Stream2String (Stream s)
+ {
+ StringBuilder sb = new StringBuilder ();
+ int b = s.ReadByte ();
+ while (b != -1) {
+ sb.Append (b.ToString("X2"));
+ b = s.ReadByte ();
+ }
+ return sb.ToString ();
+ }
+
+ private byte[] Stream2Array (Stream s)
+ {
+ string st = Stream2String (s);
+ byte[] array = new byte [st.Length / 2];
+ for (int i=0; i < array.Length; i++) {
+ string hex = st.Substring (i*2, 2);
+ array [i] = Convert.ToByte(hex, 16);
+ }
+ return array;
+ }
+
+ public void TestLoadInput ()
+ {
+ string base64 = "XmlDsigBase64Transform";
+ UTF8Encoding utf8 = new UTF8Encoding ();
+ byte[] base64array = utf8.GetBytes (base64);
+ string xml = "<Test>" + Convert.ToBase64String (base64array) + "</Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (xml);
+
+ // load as XmlDocument
+ transform.LoadInput (doc);
+ Stream s = (Stream) transform.GetOutput ();
+ byte[] output = Stream2Array (s);
+ AssertEquals("XmlDocument", base64, utf8.GetString (output));
+
+ // load as XmlNodeList
+ XmlNodeList xpath = doc.SelectNodes ("//.");
+ transform.LoadInput (xpath);
+ s = (Stream) transform.GetOutput ();
+ output = Stream2Array (s);
+ // works with MS ??? why does xpath return 3 nodes ???
+ // AssertEquals("XPathNodeList", base64, utf8.GetString (output));
+
+ // load as XmlNodeList
+ transform.LoadInput (doc.ChildNodes);
+ s = (Stream) transform.GetOutput ();
+ output = Stream2Array (s);
+ // FIXME: works with Mono ??? why doesn't this works with MS ???
+ AssertEquals("XmlChildNodes", base64, utf8.GetString (output));
+
+ // load as Stream
+ MemoryStream ms = new MemoryStream ();
+ byte[] x = utf8.GetBytes (Convert.ToBase64String (base64array));
+ ms.Write (x, 0, x.Length);
+ ms.Position = 0;
+ transform.LoadInput (ms);
+ s = (Stream) transform.GetOutput ();
+ output = Stream2Array (s);
+ AssertEquals("MemoryStream", base64, utf8.GetString (output));
+ }
+
+ public void TestUnsupportedInput ()
+ {
+ byte[] bad = { 0xBA, 0xD };
+ // LAMESPEC: input MUST be one of InputType - but no exception is thrown (not documented)
+ transform.LoadInput (bad);
+ }
+
+ public void TestUnsupportedOutput ()
+ {
+ try {
+ XmlDocument doc = new XmlDocument();
+ object o = transform.GetOutput (doc.GetType ());
+ Fail ("Expected ArgumentException but got none");
+ }
+ catch (ArgumentException) {
+ // this is what we expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentException but got: " + e.ToString ());
+ }
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
new file mode 100644
index 00000000000..aee7a08359b
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
@@ -0,0 +1,156 @@
+//
+// XmlDsigXsltTransformTest.cs - NUnit Test Cases for XmlDsigXsltTransform
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Xml {
+
+public class XmlDsigXsltTransformTest : TestCase {
+
+ public XmlDsigXsltTransformTest () : base ("System.Security.Cryptography.Xml.XmlDsigXsltTransform testsuite") {}
+ public XmlDsigXsltTransformTest (string name) : base (name) {}
+
+ protected XmlDsigXsltTransform transform;
+
+ protected override void SetUp ()
+ {
+ transform = new XmlDsigXsltTransform ();
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (XmlDsigXsltTransformTest));
+ }
+ }
+
+ public void TestProperties ()
+ {
+ AssertEquals ("Algorithm", "http://www.w3.org/TR/1999/REC-xslt-19991116", transform.Algorithm);
+
+ Type[] input = transform.InputTypes;
+ Assert ("Input #", (input.Length == 3));
+ // check presence of every supported input types
+ bool istream = false;
+ bool ixmldoc = false;
+ bool ixmlnl = false;
+ foreach (Type t in input) {
+ if (t.ToString () == "System.IO.Stream")
+ istream = true;
+ if (t.ToString () == "System.Xml.XmlDocument")
+ ixmldoc = true;
+ if (t.ToString () == "System.Xml.XmlNodeList")
+ ixmlnl = true;
+ }
+ Assert ("Input Stream", istream);
+ Assert ("Input XmlDocument", ixmldoc);
+ Assert ("Input XmlNodeList", ixmlnl);
+
+ Type[] output = transform.OutputTypes;
+ Assert ("Output #", (output.Length == 1));
+ // check presence of every supported output types
+ bool ostream = false;
+ foreach (Type t in input) {
+ if (t.ToString () == "System.IO.Stream")
+ ostream = true;
+ }
+ Assert ("Output Stream", ostream);
+ }
+
+ private string Stream2Array (Stream s)
+ {
+ StringBuilder sb = new StringBuilder ();
+ int b = s.ReadByte ();
+ while (b != -1) {
+ sb.Append (b.ToString("X2"));
+ b = s.ReadByte ();
+ }
+ return sb.ToString ();
+ }
+
+ public void Test ()
+ {
+ string test = "<Test>XmlDsigXsltTransform</Test>";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (test);
+
+ transform.LoadInnerXml (doc.ChildNodes);
+ Stream s = (Stream) transform.GetOutput ();
+ string output = Stream2Array (s);
+
+ // load as XmlDocument
+ transform.LoadInput (doc);
+ s = (Stream) transform.GetOutput ();
+ output = Stream2Array (s);
+
+ // load as XmlNodeList
+ transform.LoadInput (doc.ChildNodes);
+ s = (Stream) transform.GetOutput ();
+ output = Stream2Array (s);
+
+ // load as Stream
+ MemoryStream ms = new MemoryStream ();
+ doc.Save (ms);
+ ms.Position = 0;
+ transform.LoadInput (ms);
+ s = (Stream) transform.GetOutput ();
+ output = Stream2Array (s);
+ }
+
+ protected void AssertEquals (string msg, XmlNodeList expected, XmlNodeList actual)
+ {
+ for (int i=0; i < expected.Count; i++) {
+ if (expected[i].OuterXml != actual[i].OuterXml) {
+ Fail (msg + " [" + i + "] expected " + expected[i].OuterXml + " bug got " + actual[i].OuterXml);
+ }
+ }
+ }
+
+ public void TestLoadInnerXml ()
+ {
+ string value = "<Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" />";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml (value);
+
+ transform.LoadInnerXml (doc.ChildNodes);
+ // note: GetInnerXml is protected so we can't AssertEquals :-(
+ // unless we use reflection (making ti a lot more complicated)
+ }
+
+ public void TestUnsupportedInput ()
+ {
+ byte[] bad = { 0xBA, 0xD };
+ // LAMESPEC: input MUST be one of InputType - but no exception is thrown (not documented)
+ transform.LoadInput (bad);
+ }
+
+ public void TestUnsupportedOutput ()
+ {
+ try {
+ XmlDocument doc = new XmlDocument();
+ object o = transform.GetOutput (doc.GetType ());
+ Fail ("Expected ArgumentException but got none");
+ }
+ catch (ArgumentException) {
+ // this is what we expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentException but got: " + e.ToString ());
+ }
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Security/Test/System.Security_test.build b/mcs/class/System.Security/Test/System.Security_test.build
new file mode 100644
index 00000000000..9d0910d5c40
--- /dev/null
+++ b/mcs/class/System.Security/Test/System.Security_test.build
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Security_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System.Security_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System.Security_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ <includes name="..\class\lib\corlib.dll"/>
+ <includes name="..\class\lib\System.XML.dll"/>
+ <includes name="..\class\lib\System.Security.dll"/>
+ </references>
+ </csc>
+ <copy file="../../lib/System.Security.dll" tofile="System.Security.dll"/>
+ <copy file="../../lib/System.XML.dll" tofile="System.XML.dll"/>
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.System.Security.AllTests,System.Security_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System.Security_test.dll" failonerror="false"/>
+ <delete file="System.Security.dll" failonerror="false"/>
+ <delete file="System.XML.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.ServiceProcess/ChangeLog b/mcs/class/System.ServiceProcess/ChangeLog
new file mode 100644
index 00000000000..12295d5b7b7
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/ChangeLog
@@ -0,0 +1,4 @@
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * added System.ServiceProcess.build file
+ * added ChangeLog file \ No newline at end of file
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess.build b/mcs/class/System.ServiceProcess/System.ServiceProcess.build
new file mode 100644
index 00000000000..809846bc92b
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess.build
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.ServiceProcess.dll -->
+
+<project name="System.ServiceProcess" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.ServiceProcess.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/nowarn:0109"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0679"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+<!-- TODO: check values
+ <arg value="/r:System.Xml.dll"/>
+-->
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+<!-- TODO: check references
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ </references>
+-->
+ </csc>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.ServiceProcess.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/PowerBroadcastStatus.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/PowerBroadcastStatus.cs
new file mode 100644
index 00000000000..c1804b63ae8
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/PowerBroadcastStatus.cs
@@ -0,0 +1,22 @@
+//
+// System.ServiceProcess.PowerBroadcastStatus
+//
+// Author: Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2002, Cesar Octavio Lopez Nataren
+
+namespace System.ServiceProcess
+{
+ [Serializable]
+ public enum PowerBroadcastStatus {
+ QuerySuspend = 0,
+ QuerySuspendFailed = 2,
+ Suspend = 4,
+ ResumeCritical = 6,
+ ResumeSuspend = 7,
+ BatteryLow = 9,
+ PowerStatusChange = 10,
+ OemEvent = 11,
+ ResumeAutomatic = 18
+ }
+}
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceAccount.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceAccount.cs
new file mode 100644
index 00000000000..ada5097dfbd
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceAccount.cs
@@ -0,0 +1,17 @@
+//
+// System.ServiceProcess.ServiceAccount
+//
+// Author: Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2002, Cesar Octavio Lopez Nataren
+
+namespace System.ServiceProcess
+{
+ [Serializable]
+ public enum ServiceAccount {
+ LocalService = 0,
+ NetworkService = 1,
+ LocalSystem = 2,
+ User = 3
+ }
+}
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAccess.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAccess.cs
new file mode 100644
index 00000000000..95f3becb858
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAccess.cs
@@ -0,0 +1,19 @@
+//
+// System.ServiceProcess.ServiceControllerPermissionAccess
+//
+// Author: Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2002, Cesar Octavio Lopez Nataren
+//
+
+namespace System.ServiceProcess
+{
+ [Flags]
+ [Serializable]
+ public enum ServiceControllerPermissionAccess {
+ None = 0,
+ Browse = 2,
+ Control = 6,
+
+ }
+}
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerStatus.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerStatus.cs
new file mode 100644
index 00000000000..fbfa511a770
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerStatus.cs
@@ -0,0 +1,22 @@
+//
+// System.ServiceProcess.ServiceControllerStatus
+//
+// Author: Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2002, Cesar Octavio Lopez Nataren
+//
+
+namespace System.ServiceProcess
+{
+ [Serializable]
+ public enum ServiceControllerStatus {
+ Stopped = 1,
+ StartPending = 2,
+ StopPending = 3,
+ Running = 4,
+ ContinuePending = 5,
+ PausePending = 6,
+ Paused = 7
+ }
+}
+
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceStartMode.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceStartMode.cs
new file mode 100644
index 00000000000..89a973ee1ba
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceStartMode.cs
@@ -0,0 +1,17 @@
+//
+// System.ServiceProcess.ServiceStartMode
+//
+// Author: Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2002, Cesar Octavio Lopez Nataren
+//
+
+namespace System.ServiceProcess
+{
+ [Serializable]
+ public enum ServiceStartMode {
+ Automatic = 2,
+ Manual = 3,
+ Disabled = 4
+ }
+}
diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceType.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceType.cs
new file mode 100644
index 00000000000..617f2e156e7
--- /dev/null
+++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceType.cs
@@ -0,0 +1,22 @@
+//
+// System.ServiceProcess.ServiceType
+//
+// Author: Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2002, Cesar Octavio Lopez Nataren
+//
+
+namespace System.ServiceProcess
+{
+ [Flags]
+ [Serializable]
+ public enum ServiceType {
+ KernelDriver = 1,
+ FileSystemDriver = 2,
+ Adapter = 4,
+ RecognizerDriver = 8,
+ Win32OwnProcess = 16,
+ Win32ShareProcess = 32,
+ InteractiveProcess = 256
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/.cvsignore b/mcs/class/System.Web.Mobile/.cvsignore
new file mode 100644
index 00000000000..e4125b605c0
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/.cvsignore
@@ -0,0 +1,2 @@
+makefile
+Makefile
diff --git a/mcs/class/System.Web.Mobile/ChangeLog b/mcs/class/System.Web.Mobile/ChangeLog
new file mode 100644
index 00000000000..e09958c0b07
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/ChangeLog
@@ -0,0 +1,16 @@
+
+2003-01-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * System.Web.Mobile.build : Also remove the pdb file.
+
+2003-01-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * .cvsignore : Ignores local files
+ * System.Web.Mobile.build : The build file
+
+2003-01-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * System.Web.Mobile,
+ * System.Web.UI.MobileControls,
+ * System.Web.UI.MobileControls.Adapters : Added directories
+
diff --git a/mcs/class/System.Web.Mobile/System.Web.Mobile.build b/mcs/class/System.Web.Mobile/System.Web.Mobile.build
new file mode 100644
index 00000000000..7ae204f08a4
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.Mobile.build
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Web.Mobile.dll -->
+
+<project name="System.Web.Mobile" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Web.Mobile.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <!--<arg value="/noconfig"/>-->
+ <arg value="/debug"/>
+ <!--<arg value="/r:System.Web.dll"/>-->
+ <!--<arg value="/r:System.dll"/>-->
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset basedir="../lib">
+ <includes name="System.Web.Mobile.dll"/>
+ <includes name="System.Web.Mobile.pdb"/>
+ </fileset>
+ </delete>
+ </target>
+</project>
diff --git a/mcs/class/System.Web.Mobile/System.Web.Mobile/ChangeLog b/mcs/class/System.Web.Mobile/System.Web.Mobile/ChangeLog
new file mode 100644
index 00000000000..d6f576e1ccb
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.Mobile/ChangeLog
@@ -0,0 +1,5 @@
+
+2003-01-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * TODOAttribute.cs : Added MonoTODO Attribute
+
diff --git a/mcs/class/System.Web.Mobile/System.Web.Mobile/TODOAttribute.cs b/mcs/class/System.Web.Mobile/System.Web.Mobile/TODOAttribute.cs
new file mode 100644
index 00000000000..e58f01a053d
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.Mobile/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Web.Mobile {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Alignment.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Alignment.cs
new file mode 100644
index 00000000000..fb5c7602c5c
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Alignment.cs
@@ -0,0 +1,20 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Alignment
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum Alignment
+ {
+ NotSet,
+ Left,
+ Center,
+ Right
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ArrayListCollectionBase.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ArrayListCollectionBase.cs
new file mode 100644
index 00000000000..6268d64747e
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ArrayListCollectionBase.cs
@@ -0,0 +1,83 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ArrayListCollectionBase
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Collections;
+
+namespace System.Web.UI.MobileControls
+{
+ public class ArrayListCollectionBase : ICollection, IEnumerable
+ {
+ private ArrayList items;
+ internal ArrayListCollectionBase()
+ {
+ }
+
+ internal ArrayListCollectionBase(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return (items == null ? 0 : items.Count);
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return (items == null ? false : items.IsReadOnly);
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ protected ArrayList Items
+ {
+ get
+ {
+ if(items == null)
+ items = new ArrayList();
+ return items;
+ }
+ set
+ {
+ items = value;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ Items.CopyTo(array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return Items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/BooleanOption.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/BooleanOption.cs
new file mode 100644
index 00000000000..30bca9211e3
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/BooleanOption.cs
@@ -0,0 +1,19 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : BooleanOption
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum BooleanOption
+ {
+ NotSet = -1,
+ False = 0,
+ True,
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog
new file mode 100644
index 00000000000..8c541cd28dc
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog
@@ -0,0 +1,87 @@
+
+2003-01-19 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * Command.cs : Initial implementation.
+ * IObjectListFieldCollection.cs
+ : F*** the docs. Use only reflection
+ to get the correct methods / properties.
+ * TextControl.cs : Implemented.
+ * ObjectListCommandEventArgs/Handler.cs
+ : Implemented.
+ * MobileListItem.cs : Initial Implementation.
+ * ObjectListItem.cs : Initial Implementation.
+ * ObjectList.cs : Initial Implementation.
+ * TemplateContainer.cs : Initial Implementation.
+
+2003-01-18 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * Constants.cs : Undocumented class. Reflection revealed.
+ Implemented.
+
+2003-01-18 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * ArrayListCollectionBase.cs
+ : Implemented.
+
+2003-01-14 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * *.cs : Update the year in copyright notice.
+
+2003-01-13 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * Label.cs : The smallest class on this earth.
+
+2003-01-12 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * MobileControl.cs : Stub-ing completed. ;-)
+ * ControlPager.cs : Dummy implementation.
+
+2003-01-12 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * FontInfo.cs : Implemented.
+ * Form.cs : Initial implementation.
+ * Panel.cs : Initial implementation.
+ * MobileControl.cs : Stubbed all properties.
+
+2003-01-10 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * DeviceSpecific.cs : Dummy implementation.
+ * MobilePage.cs : GetControlAdapter(MobileControl) - Stubbed.
+ * MobileControl.cs : Adapter { get; } - Implemented
+ : BreakAfter { get; set; } - Stubbed.
+ : DeviceSpecific { get; set; } - Stubbed.
+ : MobilePage { get; } - Stubbed.
+
+2003-01-10 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * IObjectListFieldCollection.cs,
+ * IPageAdapter.cs,
+ * ITemplateable.cs : Added interface.
+ * ObjectListField.cs : Dummy implementation.
+
+2003-01-10 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * MobileListItemType.cs,
+ * ObjectListViewMode.cs,
+ * WmlListFieldType.cs, // Failed to locate enumeration!
+ * Wrapping.cs
+ : Added enumerations.
+
+2003-01-09 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * MobileControl.cs : Added some more properties (dummies).
+ * Alignment.cs,
+ * BooleanOption.cs,
+ * CommandFormat.cs,
+ * FontSize.cs,
+ * FormMethod.cs,
+ * ListDecoration.cs,
+ * ListSelectType.cs,
+ : Added enumerations.
+
+2003-01-08 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * IControlAdapter.cs : Completed interface.
+ * MobileControl.cs : Initial implementation.
+ * MobilePage.cs : Dummy implementation.
+
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs
new file mode 100644
index 00000000000..33bc613d8e2
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs
@@ -0,0 +1,53 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Command
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class Command : TextControl, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+
+ public Command()
+ {
+ }
+
+ public event EventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ public event ObjectListCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/CommandFormat.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/CommandFormat.cs
new file mode 100644
index 00000000000..af5eea62ab1
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/CommandFormat.cs
@@ -0,0 +1,18 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : CommandFormat
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum CommandFormat
+ {
+ Button,
+ Link
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Constants.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Constants.cs
new file mode 100644
index 00000000000..88851a213ee
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Constants.cs
@@ -0,0 +1,44 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Constants
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public class Constants
+ {
+ public const string AlternatingItemTemplateTag =
+ "AlternatingItemTemplate";
+ public const string ContentTemplateTag = "ContentTemplate";
+ public const int DefaultSessionsStateHistorySize = 5;
+ public const string EventArgumentID = "__EA";
+ public const string EventSourceID = "__ET";
+ public const string FooterTemplateTag = "FooterTemplate";
+ public const string FormIDPrefix = "#";
+ public const string HeaderTemplateTag = "HeaderTemplate";
+ public const string ItemDetailsTemplateTag =
+ "ItemDetailsTemplate";
+ public const string ItemTemplateTag = "ItemTemplate";
+ public const string LabelTemplateTag = "LabelTemplate";
+ public const string OptimumPageWeightParameter =
+ "optimumPageWeight";
+ public const string PagePrefix = "__PG_";
+ public const string ScreenCharactersHeightParameter =
+ "screenCharactersHeight";
+ public const string ScriptTemplateTag = "ScriptTemplate";
+ public const char SelectionListSpecialCharacter = '*';
+ public const string SeparatorTempalteTag =
+ "SeparatorTemplate";
+ public const string SymbolProtocol = "symbol:";
+ public const string UniqueFilePathSuffixVariable = "__ufps=";
+ public const string UniqueFilePathSuffixVariableWithoutEqual =
+ "__ufps";
+
+ internal const string ErrorStyle = "error";
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ControlPager.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ControlPager.cs
new file mode 100644
index 00000000000..2690a065f83
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ControlPager.cs
@@ -0,0 +1,22 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ControlPager
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class ControlPager
+ {
+ public ControlPager(Form form, int pageWeight)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/DeviceSpecific.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/DeviceSpecific.cs
new file mode 100644
index 00000000000..f759a454d87
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/DeviceSpecific.cs
@@ -0,0 +1,21 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : DeviceSpecific
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class DeviceSpecific : Control
+ {
+ public DeviceSpecific()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontInfo.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontInfo.cs
new file mode 100644
index 00000000000..904248a7b61
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontInfo.cs
@@ -0,0 +1,91 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : FontInfo
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class FontInfo
+ {
+ private Style style;
+
+ internal FontInfo(Style style)
+ {
+ this.style = style;
+ }
+
+ public BooleanOption Bold
+ {
+ get
+ {
+ if(style != null)
+ return style.Bold;
+ return BooleanOption.False;
+ }
+ set
+ {
+ if(style != null)
+ style.Bold = value;
+ }
+ }
+
+ public BooleanOption Italic
+ {
+ get
+ {
+ if(style != null)
+ return style.Italic;
+ return BooleanOption.False;
+ }
+ set
+ {
+ if(style != null)
+ style.Italic = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ if(style != null)
+ return style.FontName;
+ return String.Empty;
+ }
+ set
+ {
+ if(style != null)
+ style.FontName = value;
+ }
+ }
+
+ public FontSize Size
+ {
+ get
+ {
+ if(style != null)
+ return style.FontSize;
+ return FontSize.Normal;
+ }
+ set
+ {
+ if(style != null)
+ style.FontSize = value;
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ //string retVal = String.Empty;
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontSize.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontSize.cs
new file mode 100644
index 00000000000..1bab298aa83
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FontSize.cs
@@ -0,0 +1,20 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : FontSize
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum FontSize
+ {
+ NotSet,
+ Normal,
+ Small,
+ Large
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Form.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Form.cs
new file mode 100644
index 00000000000..827a7916fcb
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Form.cs
@@ -0,0 +1,40 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Form
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class Form : Panel, IPostBackEventHandler
+ {
+ public Form()
+ {
+ }
+
+ public string Action
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FormMethod.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FormMethod.cs
new file mode 100644
index 00000000000..2ca8a764ccf
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/FormMethod.cs
@@ -0,0 +1,18 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : FormMethod
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum FormMethod
+ {
+ Get,
+ Post
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IControlAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IControlAdapter.cs
new file mode 100644
index 00000000000..7a17c570622
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IControlAdapter.cs
@@ -0,0 +1,38 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : IControlAdapter
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Collections.Specialized;
+using System.Web.UI;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public interface IControlAdapter
+ {
+ MobileControl Control { get; set; }
+ int ItemWeight { get; }
+ MobilePage Page { get; }
+ int VisibleWeight { get; }
+
+ void CreateTemplatedUI(bool doDataBind);
+ bool HandlePostBackEvent(string eventArguments);
+ void LoadAdapterState(object state);
+ bool LoadPostData(string postKey, NameValueCollection postCollection,
+ object privateControlData, out bool dataChanged);
+ void OnInit(EventArgs e);
+ // Strange! Docs read "public virtual void OnLoad(...);"
+ void OnLoad(EventArgs e);
+ void OnPreRender(EventArgs e);
+ void OnUnload(EventArgs e);
+ // Strange! Docs read "Render(...);"
+ void Render(HtmlTextWriter writer);
+ object SaveAdapterState();
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IObjectListFieldCollection.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IObjectListFieldCollection.cs
new file mode 100644
index 00000000000..c84d3946b4c
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IObjectListFieldCollection.cs
@@ -0,0 +1,23 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : IObjectListFieldCollection
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Collections;
+
+namespace System.Web.UI.MobileControls
+{
+ public interface IObjectListFieldCollection : ICollection
+ {
+ ObjectListField this[int index] { get; }
+
+ ObjectListField[] GetAll();
+ int IndexOf(ObjectListField field);
+ int IndexOf(string fieldID);
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IPageAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IPageAdapter.cs
new file mode 100644
index 00000000000..6c889d3e615
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IPageAdapter.cs
@@ -0,0 +1,36 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : IPageAdapter
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Web.UI;
+using System.Web;
+
+namespace System.Web.UI.MobileControls
+{
+ public interface IPageAdapter : IControlAdapter
+ {
+ IList CacheVaryByHeaders { get; }
+ IDictionary CookielessDataDictionary { get; set; }
+ int OptimumPageWeight { get; }
+ new MobilePage Page { get; set; }
+ bool PersistCookielessData { get; set; }
+
+ HtmlTextWriter CreateTextWriter(TextWriter writer);
+ NameValueCollection DeterminePostBackMode(HttpRequest request,
+ string postEventSourceID,
+ string postEventArgumentID,
+ NameValueCollection baseCollection);
+ bool HandleError(Exception e, HtmlTextWriter writer);
+ bool HandlePagePostBackEvent(string eventSource,
+ string eventArgument);
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ITemplateable.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ITemplateable.cs
new file mode 100644
index 00000000000..1f6b06ee779
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ITemplateable.cs
@@ -0,0 +1,16 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ITemplateable
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public interface ITemplateable
+ {
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Label.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Label.cs
new file mode 100644
index 00000000000..510651966c5
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Label.cs
@@ -0,0 +1,21 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Label
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class Label : MobileControl
+ {
+ public Label()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListDecoration.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListDecoration.cs
new file mode 100644
index 00000000000..9942d29c23a
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListDecoration.cs
@@ -0,0 +1,19 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ListDecoration
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum ListDecoration
+ {
+ None,
+ Bulleted,
+ Numbered
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListSelectType.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListSelectType.cs
new file mode 100644
index 00000000000..70baf041e49
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ListSelectType.cs
@@ -0,0 +1,21 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ListSelectType
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum ListSelectType
+ {
+ DropDown,
+ ListBox,
+ Radio,
+ MultiSelectListBox,
+ CheckBox
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileControl.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileControl.cs
new file mode 100644
index 00000000000..10a40712b6c
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileControl.cs
@@ -0,0 +1,282 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : MobileControl
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Drawing;
+using System.Collections;
+using System.Web.UI;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public abstract class MobileControl : Control
+ {
+ private Style style;
+ private IControlAdapter adapter;
+
+ protected MobileControl()
+ {
+ }
+
+ public IControlAdapter Adapter
+ {
+ get
+ {
+ IControlAdapter retVal = null;
+ if(adapter != null)
+ retVal = adapter;
+ else if(MobilePage != null)
+ retVal = MobilePage.GetControlAdapter(this);
+ return retVal;
+ }
+ }
+
+ public Alignment Alignment
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual Color BackColor
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual bool BreakAfter
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public DeviceSpecific DeviceSpecific
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public int FirstPage
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual FontInfo Font
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual Color ForeColor
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public Form Form
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual bool IsTemplated
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public int LastPage
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public MobilePage MobilePage
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual string StyleReference
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual int VisibleWeight
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual Wrapping Wrapping
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ protected string InnerText
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ protected virtual bool PaginateChildren
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual void AddLinkedForms(IList linkedForms)
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual void CreateDefaultTemplatedUI(bool doDataBind)
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual void EnsureTemplatedUI()
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual ITemplate GetTemplate(string templateName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool IsVisibleOnPage(int pageNumber)
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual void PaginateRecursive(ControlPager pager)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Form ResolveFormReference(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual Style CreateStyle()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void CreatedTempaltedUI(bool doDataBind)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool isFormSubmitControl()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void LoadPrivateViewState(object state)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void OnPageChange(int oldIndex, int newIndex)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void OnRender(HtmlTextWriter writer)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual object SavePrivateViewState()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs
new file mode 100644
index 00000000000..d7f9ada1b55
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs
@@ -0,0 +1,66 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : MobileListItem
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class MobileListItem : TemplateContainer//, IStateManager
+ {
+ public MobileListItem()
+ {
+ }
+
+ public MobileListItem(MobileListItemType type)
+ {
+ throw new NotImplementedException();
+ }
+
+ public MobileListItem(string text)
+ {
+ throw new NotImplementedException();
+ }
+
+ public MobileListItem(string text, string value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public MobileListItem(object dataItem, string text, string value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public string Text
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public string Value
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItemType.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItemType.cs
new file mode 100644
index 00000000000..3c0f598b50e
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItemType.cs
@@ -0,0 +1,20 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : MobileListItemType
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum MobileListItemType
+ {
+ HeaderItem,
+ ListItem,
+ FooterItem,
+ SeparatorItem
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobilePage.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobilePage.cs
new file mode 100644
index 00000000000..1f20c7b53f6
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobilePage.cs
@@ -0,0 +1,27 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : MobilePage
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class MobilePage : Page
+ {
+ public MobilePage()
+ {
+ }
+
+ public virtual IControlAdapter GetControlAdapter(MobileControl control)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs
new file mode 100644
index 00000000000..4bb4b462cff
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs
@@ -0,0 +1,31 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ObjectList
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class ObjectList // : PagedControl, INamingContainer,
+ // ITemplateable, IPostBackEventHander
+ {
+ public ObjectList()
+ {
+ }
+
+ public IObjectListFieldCollection AllFields
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs
new file mode 100644
index 00000000000..5e9d873f011
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs
@@ -0,0 +1,55 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ObjectListCommandEventHandler
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.MobileControls
+{
+ public class ObjectListCommandEventArgs : CommandEventArgs
+ {
+ private ObjectListItem item;
+ private object commandSource;
+
+ public ObjectListCommandEventArgs(ObjectListItem item,
+ object source, CommandEventArgs e)
+ : base(e)
+ {
+ this.item = item;
+ this.commandSource = source;
+ }
+
+ public ObjectListCommandEventArgs(ObjectListItem item,
+ string commandName)
+ : base(commandName, item)
+ {
+ this.item = item;
+ this.commandSource = null;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return this.commandSource;
+ }
+ }
+
+ public ObjectListItem ListItem
+ {
+ get
+ {
+ return this.item;
+ }
+ }
+
+ protected static readonly string DefaultCommand = "Default";
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs
new file mode 100644
index 00000000000..7817fe83742
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs
@@ -0,0 +1,15 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ObjectListCommandEventHandler
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public delegate void ObjectListCommandEventHandler(object sender,
+ ObjectListCommandEventArgs e);
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListField.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListField.cs
new file mode 100644
index 00000000000..ecf49b153fc
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListField.cs
@@ -0,0 +1,21 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ObjectListField
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class ObjectListField //: IStateManager
+ {
+ public ObjectListField()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs
new file mode 100644
index 00000000000..bf80eb8d804
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs
@@ -0,0 +1,119 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ObjectListCommandEventHandler
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class ObjectListItem : MobileListItem
+ {
+ private ObjectList owner;
+ private string[] fields;
+ private bool dirty = false;
+
+ internal ObjectListItem(ObjectList owner, object dataItem)
+ : base(dataItem, null, null)
+ {
+ this.owner = owner;
+ this.fields = new string[owner.AllFields.Count];
+ }
+
+ internal ObjectListItem(ObjectList owner)
+ : this(owner, null)
+ {
+ }
+
+ public string this[int key]
+ {
+ get
+ {
+ if(fields != null && fields.Length >= key - 1
+ && fields[key] != null)
+ return fields[key];
+ return String.Empty;
+ }
+ set
+ {
+ if(fields != null && fields.Length >= key - 1)
+ fields[key] = value;
+ if(IsTrackingViewState)
+ dirty = true;
+ }
+ }
+
+ internal bool Dirty
+ {
+ get
+ {
+ return dirty;
+ }
+ set
+ {
+ dirty = value;
+ }
+ }
+
+ public string this[string fieldName]
+ {
+ get
+ {
+ return this[IndexOf(fieldName)];
+ }
+ set
+ {
+ this[IndexOf(fieldName)] = value;
+ }
+ }
+
+ [MonoTODO("Exception_Details_Not_Exact")]
+ private int IndexOf(string fieldName)
+ {
+ int index = owner.AllFields.IndexOf(fieldName);
+ if(index < 0)
+ {
+ throw new ArgumentException("ObjectList_FieldNotFound");
+ }
+ return index;
+ }
+
+ public override bool Equals(object obj)
+ {
+ bool retVal = false;
+ if(obj is ObjectListItem)
+ {
+ ObjectListItem oli = (ObjectListItem) obj;
+ if(oli.fields != null && this.fields != null)
+ {
+ if(this.fields.Length == oli.fields.Length)
+ {
+ int i;
+ for(i = 0; i < fields.Length; i++)
+ {
+ if(fields[i] != oli.fields[i])
+ break;
+ }
+ if(i == fields.Length)
+ retVal = true;
+ }
+ }
+ retVal &= (Value == oli.Value);
+ retVal &= (Text == oli.Text);
+ }
+ return retVal;
+ }
+
+ public override int GetHashCode()
+ {
+ return (fields == null ? Value.GetHashCode() :
+ fields[0].GetHashCode());
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListViewMode.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListViewMode.cs
new file mode 100644
index 00000000000..c4b66f21745
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListViewMode.cs
@@ -0,0 +1,19 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : ObjectListViewMode
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum ObjectListViewMode
+ {
+ List,
+ Commands,
+ Details
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Panel.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Panel.cs
new file mode 100644
index 00000000000..fde43ea95cf
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Panel.cs
@@ -0,0 +1,22 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Panel
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class Panel : MobileControl, ITemplateable
+ {
+ public Panel()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Style.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Style.cs
new file mode 100644
index 00000000000..404d15a39d1
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Style.cs
@@ -0,0 +1,74 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Style
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+ public class Style //: IParserAttribute, ITemplateable, IStateManager,
+ // ICloneable
+ {
+ public Style()
+ {
+ }
+
+ [MonoTODO]
+ internal BooleanOption Bold
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ internal BooleanOption Italic
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ internal string FontName
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ internal FontSize FontSize
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs
new file mode 100644
index 00000000000..2bbef3f910b
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs
@@ -0,0 +1,22 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : TemplateContainer
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class TemplateContainer : Panel, INamingContainer
+ {
+ public TemplateContainer()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs
new file mode 100644
index 00000000000..055ba9f2b10
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs
@@ -0,0 +1,40 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : TextControl
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+ public class TextControl : MobileControl
+ {
+ public TextControl()
+ {
+ }
+
+ /*
+ * Document speaks of
+ * public IControlAdapter Adapter { get; }
+ * but this is not available (no such property).
+ * So, I am not keeping it.
+ */
+
+ public string Text
+ {
+ get
+ {
+ return InnerText;
+ }
+ set
+ {
+ InnerText = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/WmlListFieldType.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/WmlListFieldType.cs
new file mode 100644
index 00000000000..1d8c4ed25e4
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/WmlListFieldType.cs
@@ -0,0 +1,22 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : WmlListFieldType
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2002 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+/// <summary>
+/// The enumeration exists only in the documentation.
+/// I failed to locate it in the assembly (.dll).
+/// </summary>
+/*
+namespace System.Web.UI.MobileControls
+{
+ public enum WmlListFieldType
+ {
+ }
+}
+*/
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Wrapping.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Wrapping.cs
new file mode 100644
index 00000000000..c774fc2f379
--- /dev/null
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Wrapping.cs
@@ -0,0 +1,19 @@
+/**
+ * Project : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class : Wrapping
+ * Author : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ * Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+ public enum Wrapping
+ {
+ NotSet,
+ Wrap,
+ NoWrap
+ }
+}
diff --git a/mcs/class/System.Web.Services/.cvsignore b/mcs/class/System.Web.Services/.cvsignore
new file mode 100755
index 00000000000..3145502e989
--- /dev/null
+++ b/mcs/class/System.Web.Services/.cvsignore
@@ -0,0 +1,8 @@
+*.dll
+*.suo
+*.csproj.user
+bin
+obj
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Web.Services/ChangeLog b/mcs/class/System.Web.Services/ChangeLog
new file mode 100644
index 00000000000..e46ae007acf
--- /dev/null
+++ b/mcs/class/System.Web.Services/ChangeLog
@@ -0,0 +1,53 @@
+2002-08-24 Tim Coleman <tim@timcoleman.com>
+ * list:
+ New files added to build.
+
+2002-08-23 Tim Coleman <tim@timcoleman.com>
+ * list:
+ New files added to build.
+
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * System.Web.Services.build:
+ Added "test" target to build.
+ Added "clean" target to build.
+ * Test:
+ New test suites added.
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * list: Added System.Web.Services.Protocols/ServerProtocol.cs
+
+2002-07-29 Dave Bettin <javabettin@yahoo.com>
+ * list: added new Discovery classes
+ * System.Web.Services.Discovery: added stubs
+ * .cvsignore: added
+ * Mono.System.Web.Services: added VS.net project for assembly
+
+2002-07-25 Tim Coleman <tim@timcoleman.com>
+ * list: add new classes
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Added System.Web.Services.Description/SoapProtocolReflector.cs
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * makefile.gnu:
+ * list:
+ Modifications to make this library buildable on
+ linux.
+
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list: Added new files from System.Web.Services.Protocols
+ and System.Web.Services.Configuration
+
+2002-07-19 Tim Coleman <tim@timcoleman.com>
+ * list: Added
+
+2002-07-19 Tim Coleman <tim@timcoleman.com>
+ * System.Web.Services.build: added
+ * System.Web.Services:
+ * System.Web.Services.Configuration:
+ * System.Web.Services.Description:
+ * System.Web.Services.Discovery:
+ * System.Web.Services.Protocols:
+ New directories added
diff --git a/mcs/class/System.Web.Services/Mono.System.Web.Services.csproj b/mcs/class/System.Web.Services/Mono.System.Web.Services.csproj
new file mode 100755
index 00000000000..bc69dceffd2
--- /dev/null
+++ b/mcs/class/System.Web.Services/Mono.System.Web.Services.csproj
@@ -0,0 +1,869 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{1E24995F-861C-4FCB-BE59-C7B518F02F64}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.Web.Services"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "System.Web.Servces"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System.Web"
+ AssemblyName = "System.Web"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Web.dll"
+ />
+ <Reference
+ Name = "System.EnterpriseServices"
+ AssemblyName = "System.EnterpriseServices"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.EnterpriseServices.dll"
+ />
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "list"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "makefile.gnu"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services.build"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services\TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services\WebMethodAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services\WebService.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services\WebService.resx"
+ DependentUpon = "WebService.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "System.Web.Services\WebServiceAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services\WebServiceBindingAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services\WebServicesDescriptionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Configuration\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services.Configuration\XmlFormatExtensionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Configuration\XmlFormatExtensionPointAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Configuration\XmlFormatExtensionPrefixAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Binding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\BindingCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\DocumentableItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\FaultBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\FaultBindingCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\HttpAddressBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\HttpBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\HttpOperationBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\HttpUrlEncodedBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\HttpUrlReplacementBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Import.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ImportCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\InputBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Message.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MessageBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MessageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MessagePart.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MessagePartCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimeContentBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimeMultipartRelatedBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimePart.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimePartCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimeTextBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimeTextMatch.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimeTextMatchCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\MimeXmlBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Operation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationBindingCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationFault.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationFaultCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationFlow.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationInput.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationMessage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationMessageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OperationOutput.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\OutputBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Port.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\PortCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\PortType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\PortTypeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ProtocolImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ProtocolReflector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Service.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescription.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionBaseCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionFormatExtension.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionFormatExtensionCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionImportStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionImportWarnings.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\ServiceDescriptionReflector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapAddressBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapBindingStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapBindingUse.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapBodyBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapExtensionImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapExtensionReflector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapFaultBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapHeaderBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapHeaderFaultBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapOperationBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapProtocolImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapProtocolReflector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\SoapTransportImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Description\Types.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\ContractReference.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\ContractSearchPattern.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryClientDocumentCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryClientReferenceCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryClientResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryClientResultCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryDocument.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryDocumentLinksPattern.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryDocumentReference.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryDocumentSearchPattern.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryExceptionDictionary.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryReference.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryReferenceCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoveryRequestHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DiscoverySearchPattern.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\DynamicDiscoveryDocument.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\ExcludePathInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\SchemaReference.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\SoapBinding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Discovery\XmlSchemaSearchPattern.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\AnyReturnReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HtmlFormParameterReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HtmlFormParameterWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HttpGetClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HttpMethodAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HttpPostClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HttpSimpleClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\HttpWebClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\LogicalMethodInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\LogicalMethodTypes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\MatchAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\MimeFormatter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\MimeParameterReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\MimeParameterWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\MimeReturnReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\NopReturnReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\PatternMatcher.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapClientMessage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapClientMethod.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapDocumentMethodAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapDocumentServiceAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapExtension.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapExtensionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapHeader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapHeaderAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapHeaderCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapHeaderDirection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapHeaderException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapHttpClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapMessage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapMessageStage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapParameterStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapRpcMethodAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapRpcServiceAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapServerMessage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapServerProtocol.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapServiceRoutingStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\SoapUnknownHeader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\TextReturnReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\UrlEncodedParameterWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\UrlParameterReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\UrlParameterWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\ValueCollectionParameterReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\WebClientAsyncResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\WebClientProtocol.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\WebServiceHandlerFactory.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Web.Services.Protocols\XmlReturnReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog
new file mode 100644
index 00000000000..b91825974fc
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog
@@ -0,0 +1,6 @@
+2002-07-21 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog:
+ * XmlFormatExtensionAttribute.cs:
+ * XmlFormatExtensionPointAttribute.cs:
+ * XmlFormatExtensionPrefixAttribute.cs:
+ New files added
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionAttribute.cs
new file mode 100644
index 00000000000..eda21c22cec
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionAttribute.cs
@@ -0,0 +1,77 @@
+ //
+// System.Web.Services.Configuration.XmlFormatExtensionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Configuration {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class XmlFormatExtensionAttribute : Attribute {
+
+ #region Fields
+
+ string elementName;
+ string ns;
+ Type[] extensionPoints;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public XmlFormatExtensionAttribute ()
+ {
+ }
+
+ public XmlFormatExtensionAttribute (string elementName, string ns, Type extensionPoint1)
+ : this (elementName, ns, new Type[1] {extensionPoint1})
+ {
+ }
+
+ public XmlFormatExtensionAttribute (string elementName, string ns, Type[] extensionPoints)
+ : this ()
+ {
+ this.elementName = elementName;
+ this.ns = ns;
+ this.extensionPoints = extensionPoints;
+ }
+
+ public XmlFormatExtensionAttribute (string elementName, string ns, Type extensionPoint1, Type extensionPoint2)
+ : this (elementName, ns, new Type[2] {extensionPoint1, extensionPoint2})
+ {
+ }
+
+ public XmlFormatExtensionAttribute (string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3)
+ : this (elementName, ns, new Type[3] {extensionPoint1, extensionPoint2, extensionPoint3})
+ {
+ }
+
+ public XmlFormatExtensionAttribute (string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3, Type extensionPoint4)
+ : this (elementName, ns, new Type[4] {extensionPoint1, extensionPoint2, extensionPoint3, extensionPoint4})
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string ElementName {
+ get { return elementName; }
+ set { elementName = value; }
+ }
+
+ public Type[] ExtensionPoints {
+ get { return extensionPoints; }
+ set { extensionPoints = value; }
+ }
+
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs
new file mode 100644
index 00000000000..f7cac2e032f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs
@@ -0,0 +1,44 @@
+ //
+// System.Web.Services.Configuration.XmlFormatExtensionPointAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Configuration {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class XmlFormatExtensionPointAttribute : Attribute {
+
+ #region Fields
+
+ bool allowElements;
+ string memberName;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public XmlFormatExtensionPointAttribute (string memberName)
+ {
+ allowElements = false; // FIXME
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool AllowElements {
+ get { return allowElements; }
+ set { allowElements = value; }
+ }
+
+ public string MemberName {
+ get { return memberName; }
+ set { memberName = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
new file mode 100644
index 00000000000..91ed4038e60
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
@@ -0,0 +1,50 @@
+ //
+// System.Web.Services.Configuration.XmlFormatExtensionPrefixAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Configuration {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class XmlFormatExtensionPrefixAttribute : Attribute {
+
+ #region Fields
+
+ string prefix;
+ string ns;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public XmlFormatExtensionPrefixAttribute ()
+ {
+ }
+
+ public XmlFormatExtensionPrefixAttribute (string prefix, string ns)
+ : this ()
+ {
+ this.prefix = prefix;
+ this.ns = ns;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Prefix {
+ get { return prefix; }
+ set { prefix = value; }
+ }
+
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Binding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Binding.cs
new file mode 100644
index 00000000000..9b7206f596e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Binding.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.Services.Description.Binding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class Binding : DocumentableItem {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+ string name;
+ OperationBindingCollection operations;
+ ServiceDescription serviceDescription;
+ XmlQualifiedName type;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Binding ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ name = String.Empty;
+ operations = new OperationBindingCollection (this);
+ serviceDescription = null;
+ type = XmlQualifiedName.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlElement ("operation")]
+ public OperationBindingCollection Operations {
+ get { return operations; }
+ }
+
+ public ServiceDescription ServiceDescription {
+ get { return serviceDescription; }
+ }
+
+ [XmlAttribute ("type")]
+ public XmlQualifiedName Type {
+ get { return type; }
+ set { type = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/BindingCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/BindingCollection.cs
new file mode 100644
index 00000000000..257bda99c6a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/BindingCollection.cs
@@ -0,0 +1,92 @@
+//
+// System.Web.Services.Description.BindingCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class BindingCollection : ServiceDescriptionBaseCollection {
+
+ #region Fields
+
+ ServiceDescription serviceDescription;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal BindingCollection (ServiceDescription serviceDescription)
+ : base (serviceDescription)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Binding this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (Binding) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public Binding this [string name] {
+ get { return this[IndexOf ((Binding) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (Binding binding)
+ {
+ Insert (Count, binding);
+ return (Count - 1);
+ }
+
+ public bool Contains (Binding binding)
+ {
+ return List.Contains (binding);
+ }
+
+ public void CopyTo (Binding[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is Binding))
+ throw new InvalidCastException ();
+ return ((Binding) value).Name;
+ }
+
+ public int IndexOf (Binding binding)
+ {
+ return List.IndexOf (binding);
+ }
+
+ public void Insert (int index, Binding binding)
+ {
+ List.Insert (index, binding);
+ }
+
+ public void Remove (Binding binding)
+ {
+ List.Remove (binding);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((Binding) value).SetParent ((ServiceDescription) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
new file mode 100644
index 00000000000..779d19a55c9
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
@@ -0,0 +1,289 @@
+2002-08-20 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescription.cs:
+ Add ServiceDescription.ServiceDescriptionSerializer
+ class.
+ * ServiceDescriptionFormatExtensionCollection.cs:
+ Remove reference to "parent".
+
+2002-08-19 Tim Coleman <tim@timcoleman.com>
+ * BindingCollection.cs:
+ Use base constructor, remove SetParent call
+ * FaultBindingCollection.cs:
+ * ImportCollection.cs:
+ * MessageCollection.cs:
+ * MessagePartCollection.cs:
+ * OperationBindingCollection.cs:
+ * OperationCollection.cs:
+ * OperationFaultCollection.cs:
+ * PortCollection.cs:
+ * PortTypeCollection.cs:
+ * ServiceCollection.cs:
+ * ServiceDescriptionFormatExtensionCollection.cs:
+ Use base constructor
+ * ServiceDescriptionCollection.cs:
+ Use base constructor, Remove SetParent method
+ * ServiceDescriptionBaseCollection.cs:
+ Make parent object private as according to
+ class status page.
+ * OperationMessageCollection.cs:
+ Use base constructor
+ Remove excess break's to avoid compiler warning
+ Remove TODO attribute (confirmed default retval)
+
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * FaultBindingCollection.cs:
+ * ImportCollection.cs:
+ * MessageCollection.cs:
+ * MessagePartCollection.cs:
+ * OperationBindingCollection.cs:
+ * OperationCollection.cs:
+ * OperationFaultCollection.cs:
+ * OperationMessageCollection.cs:
+ * PortCollection.cs:
+ * PortTypeCollection.cs:
+ * ServiceCollection.cs:
+ * ServiceDescriptionFormatExtensionCollection.cs:
+ Use parent from ServiceDescriptionBaseCollection
+ * ServiceDescriptionCollection.cs:
+ Use parent from ServiceDescriptionBaseCollection
+ Implement SetParent () method
+ * ServiceDescriptionBaseCollection.cs:
+ Add "parent" object.
+ Add SetParent call to OnSet() and OnInsert ()
+
+2002-08-12 Tim Coleman <tim@timcoleman.com>
+ * Operation.cs:
+ Fix ParameterOrderString in case ParameterOrder is
+ null.
+ * BindingCollection.cs:
+ Remove Table handling on insert/delete/indexer
+ because it is handled in base class.
+ * ServiceDescriptionBaseCollection.cs:
+ Only add an element to the hashtable if its GetKey ()
+ method does not return null.
+
+2002-08-09 Tim Coleman <tim@timcoleman.com>
+ * BindingCollection.cs:
+ * ServiceDescriptionCollection.cs:
+ Implement Set indexer
+ * FaultBindingCollection.cs:
+ * MessageCollection.cs:
+ * MessagePartCollection.cs:
+ * OperationFaultCollection.cs:
+ * PortCollection.cs:
+ * PortTypeCollection.cs:
+ * ServiceCollection.cs:
+ Implement Set indexer, code cleanup
+ * Message.cs:
+ Implement FindPartByName ()
+ * OperationMessageCollection.cs:
+ Alter OnSet () method
+ * ServiceDescriptionBaseCollection.cs:
+ Implement some methods.
+ * ServiceDescriptionFormatExtensionCollection.cs:
+ Implement Find (), FindAll (), OnValidate () methods
+
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescription.cs:
+ Add namespace definitions when serializing.
+ * HttpBinding.cs:
+ Change namespace definition (wsdl was spelt wsld)
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescription.cs:
+ Change the XmlElement name from "type" to "types" for
+ the Types object
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * ServerProtocol.cs:
+ Add new class as implied by class statuc page.
+ SoapServerProtocol is derived from this.
+ * SoapServerProtocol.cs:
+ Change base class to ServerProtocol.
+ * SoapClientMethod.cs:
+ This class should not be sealed.
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * SoapProtocolReflector.cs:
+ Removed SoapBinding property and made the class
+ not sealed to agree with class reference page.
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescriptionBaseCollection.cs:
+ Removed some NotImplementedException()'s so that
+ it runs.
+
+2002-07-26 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescription.cs:
+ Changed the creation of the XmlSerializer after
+ consulting the System.Xml.Serialization namespace
+ and trying to serialize a document. Now works somewhat!
+
+2002-07-25 Tim Coleman <tim@timcoleman.com>
+ * OperationMessageCollection.cs:
+ Some implementation of this class after consulting a
+ WSDL reference. Now validates the inputs.
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * ProtocolImporter.cs:
+ * ProtocolReflector.cs:
+ Some implementation of these classes. MonoTODO's begone!
+ * SoapProtocolImporter.cs:
+ Changed description to literal string "Soap"
+ * SoapProtocolReflector.cs:
+ Added a new class based on guesswork and conjecture.
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescription.cs:
+ Implement Read/Write methods for serialization/
+ deserialization.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * ServiceDescription.cs:
+ Add XmlIgnore attribute to ServiceDescriptions property
+ * OperationFlow.cs:
+ * ServiceDescriptionImportWarnings.cs:
+ Explicitly set values in enumeration to match
+ .NET.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * Binding.cs:
+ * BindingCollection.cs:
+ * DocumentableItem.cs:
+ * FaultBinding.cs:
+ * FaultBindingCollection.cs:
+ * HttpAddressBinding.cs:
+ * HttpBinding.cs:
+ * HttpOperationBinding.cs:
+ * HttpUrlEncodedBinding.cs:
+ * HttpUrlReplacementBinding.cs:
+ * Import.cs:
+ * ImportCollection.cs:
+ * InputBinding.cs:
+ * Message.cs:
+ * MessageBinding.cs:
+ * MessageCollection.cs:
+ * MessagePart.cs:
+ * MessagePartCollection.cs:
+ * MimeContentBinding.cs:
+ * MimeMultipartRelatedBinding.cs:
+ * MimePart.cs:
+ * MimePartCollection.cs:
+ * MimeTextBinding.cs:
+ * MimeTextMatch.cs:
+ * MimeTextMatchCollection.cs:
+ * MimeXmlBinding.cs:
+ * Operation.cs:
+ * OperationBinding.cs:
+ * OperationBindingCollection.cs:
+ * OperationCollection.cs:
+ * OperationFaultCollection.cs:
+ * OperationFlow.cs:
+ * OperationMessage.cs:
+ * OperationMessageCollection.cs:
+ * OutputBinding.cs:
+ * Port.cs:
+ * PortCollection.cs:
+ * PortType.cs:
+ * PortTypeCollection.cs:
+ * ProtocolImporter.cs:
+ * Service.cs:
+ * ServiceCollection.cs:
+ * ServiceDescription.cs:
+ * ServiceDescriptionBaseCollection.cs:
+ * ServiceDescriptionCollection.cs:
+ * ServiceDescriptionFormatExtension.cs:
+ * ServiceDescriptionFormatExtensionCollection.cs:
+ * ServiceDescriptionImportWarnings.cs:
+ * SoapAddressBinding.cs:
+ * SoapBinding.cs:
+ * SoapBindingStyle.cs:
+ * SoapBindingUse.cs:
+ * SoapBodyBinding.cs:
+ * SoapExtensionImporter.cs:
+ * SoapExtensionReflector.cs:
+ * SoapFaultBinding.cs:
+ * SoapHeaderBinding.cs:
+ * SoapHeaderFaultBinding.cs:
+ * SoapOperationBinding.cs:
+ * SoapTransportImporter.cs:
+ * Types.cs:
+ 1. Add missing attributes as determined by reflection
+ 2. Fix protection levels where appropriate
+ 3. Add missing items where appropriate
+ Basically, this was a change to remove all the X's from
+ the project status page for this namespace :)
+
+2002-07-19 Tim Coleman <tim@timcoleman.com>
+ * Binding.cs:
+ * BindingCollection.cs:
+ * ChangeLog:
+ * DocumentableItem.cs:
+ * FaultBinding.cs:
+ * FaultBindingCollection.cs:
+ * HttpAddressBinding.cs:
+ * HttpBinding.cs:
+ * HttpOperationBinding.cs:
+ * HttpUrlEncodedBinding.cs:
+ * HttpUrlReplacementBinding.cs:
+ * Import.cs:
+ * ImportCollection.cs:
+ * InputBinding.cs:
+ * Message.cs:
+ * MessageBinding.cs:
+ * MessageCollection.cs:
+ * MessagePart.cs:
+ * MessagePartCollection.cs:
+ * MimeContentBinding.cs:
+ * MimeMultipartRelatedBinding.cs:
+ * MimePart.cs:
+ * MimePartCollection.cs:
+ * MimeTextBinding.cs:
+ * MimeTextMatch.cs:
+ * MimeTextMatchCollection.cs:
+ * MimeXmlBinding.cs:
+ * Operation.cs:
+ * OperationBinding.cs:
+ * OperationBindingCollection.cs:
+ * OperationCollection.cs:
+ * OperationFault.cs:
+ * OperationFaultCollection.cs:
+ * OperationFlow.cs:
+ * OperationInput.cs:
+ * OperationMessage.cs:
+ * OperationMessageCollection.cs:
+ * OperationOutput.cs:
+ * OutputBinding.cs:
+ * Port.cs:
+ * PortCollection.cs:
+ * PortType.cs:
+ * PortTypeCollection.cs:
+ * ProtocolImporter.cs:
+ * ProtocolReflector.cs:
+ * Service.cs:
+ * ServiceCollection.cs:
+ * ServiceDescription.cs:
+ * ServiceDescriptionBaseCollection.cs:
+ * ServiceDescriptionCollection.cs:
+ * ServiceDescriptionFormatExtension.cs:
+ * ServiceDescriptionFormatExtensionCollection.cs:
+ * ServiceDescriptionImportStyle.cs:
+ * ServiceDescriptionImportWarnings.cs:
+ * ServiceDescriptionImporter.cs:
+ * ServiceDescriptionReflector.cs:
+ * SoapAddressBinding.cs:
+ * SoapBinding.cs:
+ * SoapBindingStyle.cs:
+ * SoapBindingUse.cs:
+ * SoapBodyBinding.cs:
+ * SoapExtensionImporter.cs:
+ * SoapExtensionReflector.cs:
+ * SoapFaultBinding.cs:
+ * SoapHeaderBinding.cs:
+ * SoapHeaderFaultBinding.cs:
+ * SoapOperationBinding.cs:
+ * SoapProtocolImporter.cs:
+ * SoapTransportImporter.cs:
+ * Types.cs:
+ Initial implementation
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/DocumentableItem.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/DocumentableItem.cs
new file mode 100644
index 00000000000..8c4e2a78f3c
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/DocumentableItem.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Services.Description.DocumentableItem.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public abstract class DocumentableItem {
+
+ #region Fields
+
+ string documentation;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected DocumentableItem ()
+ {
+ documentation = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlElement ("documentation")]
+ [DefaultValue ("")]
+ public string Documentation {
+ get { return documentation; }
+ set { documentation = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/FaultBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/FaultBinding.cs
new file mode 100644
index 00000000000..423a08060b2
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/FaultBinding.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.Services.Description.FaultBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class FaultBinding : MessageBinding {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+ OperationBinding operationBinding;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public FaultBinding ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ operationBinding = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public override ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (OperationBinding operationBinding)
+ {
+ this.operationBinding = operationBinding;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/FaultBindingCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/FaultBindingCollection.cs
new file mode 100644
index 00000000000..fe885c1bd4e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/FaultBindingCollection.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.Services.Description.FaultBindingCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class FaultBindingCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal FaultBindingCollection (OperationBinding operationBinding)
+ : base (operationBinding)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public FaultBinding this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (FaultBinding) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public FaultBinding this [string name] {
+ get { return this [IndexOf ((FaultBinding) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (FaultBinding bindingOperationFault)
+ {
+ Insert (Count, bindingOperationFault);
+ return (Count - 1);
+ }
+
+ public bool Contains (FaultBinding bindingOperationFault)
+ {
+ return List.Contains (bindingOperationFault);
+ }
+
+ public void CopyTo (FaultBinding[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is FaultBinding))
+ throw new InvalidCastException ();
+
+ return ((FaultBinding) value).Name;
+ }
+
+ public int IndexOf (FaultBinding bindingOperationFault)
+ {
+ return List.IndexOf (bindingOperationFault);
+ }
+
+ public void Insert (int index, FaultBinding bindingOperationFault)
+ {
+ List.Insert (index, bindingOperationFault);
+ }
+
+ public void Remove (FaultBinding bindingOperationFault)
+ {
+ List.Remove (bindingOperationFault);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((FaultBinding) value).SetParent ((OperationBinding) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpAddressBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpAddressBinding.cs
new file mode 100644
index 00000000000..b35eb111bf8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpAddressBinding.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Services.Description.HttpAddressBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("address", "http://schemas.xmlsoap.org/wsdl/http/", typeof (Port))]
+ public sealed class HttpAddressBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string location;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public HttpAddressBinding ()
+ {
+ location = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("location")]
+ public string Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpBinding.cs
new file mode 100644
index 00000000000..fe5adf056a9
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpBinding.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.Services.Description.HttpBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("binding", "http://schemas.xmlsoap.org/wsdl/http/", typeof (Binding))]
+ [XmlFormatExtensionPrefix ("http", "http://schemas.xmlsoap.org/wsdl/http/")]
+ public sealed class HttpBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ public const string Namespace = "http://schemas.xmlsoap.org/wsdl/http/";
+ string verb;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public HttpBinding ()
+ {
+ verb = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("verb", DataType = "NMTOKEN")]
+ public string Verb {
+ get { return verb; }
+ set { verb = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpOperationBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpOperationBinding.cs
new file mode 100644
index 00000000000..0115dbb0b61
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpOperationBinding.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Services.Description.HttpOperationBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("operation", "http://schemas.xmlsoap.org/wsdl/http/", typeof (OperationBinding))]
+ public sealed class HttpOperationBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string location;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public HttpOperationBinding ()
+ {
+ location = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("location")]
+ public string Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlEncodedBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlEncodedBinding.cs
new file mode 100644
index 00000000000..4ce0e0fe4f9
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlEncodedBinding.cs
@@ -0,0 +1,24 @@
+//
+// System.Web.Services.Description.HttpUrlEncodedBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("urlEncoded", "http://schemas.xmlsoap.org/wsdl/http/", typeof (InputBinding))]
+ public sealed class HttpUrlEncodedBinding : ServiceDescriptionFormatExtension {
+
+ #region Constructors
+
+ public HttpUrlEncodedBinding ()
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlReplacementBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlReplacementBinding.cs
new file mode 100644
index 00000000000..9414c8cbd46
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpUrlReplacementBinding.cs
@@ -0,0 +1,24 @@
+//
+// System.Web.Services.Description.HttpUrlReplacementBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("urlReplacement", "http://schemas.xmlsoap.org/wsdl/http/", typeof (InputBinding))]
+ public sealed class HttpUrlReplacementBinding : ServiceDescriptionFormatExtension {
+
+ #region Constructors
+
+ public HttpUrlReplacementBinding ()
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Import.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Import.cs
new file mode 100644
index 00000000000..8c36325bf19
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Import.cs
@@ -0,0 +1,63 @@
+//
+// System.Web.Services.Description.Import.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class Import : DocumentableItem {
+
+ #region Fields
+
+ string location;
+ string ns;
+ ServiceDescription serviceDescription;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Import ()
+ {
+ location = String.Empty;
+ ns = String.Empty;
+ serviceDescription = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("location")]
+ public string Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ [XmlAttribute ("namespace")]
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ public ServiceDescription ServiceDescription {
+ get { return serviceDescription; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ImportCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ImportCollection.cs
new file mode 100644
index 00000000000..a1cfd6eb14f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ImportCollection.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Services.Description.ImportCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class ImportCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal ImportCollection (ServiceDescription serviceDescription)
+ : base (serviceDescription)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public Import this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (Import) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (Import import)
+ {
+ Insert (Count, import);
+ return (Count - 1);
+ }
+
+ public bool Contains (Import import)
+ {
+ return List.Contains (import);
+ }
+
+ public void CopyTo (Import[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (Import import)
+ {
+ return List.IndexOf (import);
+ }
+
+ public void Insert (int index, Import import)
+ {
+ List.Insert (index, import);
+ }
+
+ public void Remove (Import import)
+ {
+ List.Remove (import);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((Import) value).SetParent ((ServiceDescription) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/InputBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/InputBinding.cs
new file mode 100644
index 00000000000..d8b9483b2b1
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/InputBinding.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Services.Description.InputBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class InputBinding : MessageBinding {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public InputBinding ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public override ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Message.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Message.cs
new file mode 100644
index 00000000000..3d812ee2c8d
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Message.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.Services.Description.Message.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Web.Services;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class Message : DocumentableItem {
+
+ #region Fields
+
+ string name;
+ MessagePartCollection parts;
+ ServiceDescription serviceDescription;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Message ()
+ {
+ name = String.Empty;
+ parts = new MessagePartCollection (this);
+ serviceDescription = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlElement ("part")]
+ public MessagePartCollection Parts {
+ get { return parts; }
+ }
+
+ public ServiceDescription ServiceDescription {
+ get { return serviceDescription; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public MessagePart FindPartByName (string partName)
+ {
+ return parts [partName];
+ }
+
+ public MessagePart[] FindPartsByName (string[] partNames)
+ {
+ ArrayList searchResults = new ArrayList ();
+
+ foreach (string partName in partNames)
+ searchResults.Add (FindPartByName (partName));
+
+ int count = searchResults.Count;
+
+ if (count == 0)
+ throw new ArgumentException ();
+
+ MessagePart[] returnValue = new MessagePart[count];
+ searchResults.CopyTo (returnValue);
+ return returnValue;
+ }
+
+ internal void SetParent (ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs
new file mode 100644
index 00000000000..6488901d9ff
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.Services.Description.MessageBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public abstract class MessageBinding : DocumentableItem {
+
+ #region Fields
+
+ string name;
+ OperationBinding operationBinding;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected MessageBinding ()
+ {
+ name = String.Empty;
+ operationBinding = new OperationBinding ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public abstract ServiceDescriptionFormatExtensionCollection Extensions {
+ get;
+ }
+
+ [XmlAttribute ("name", DataType = "NMTOKEN")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public OperationBinding OperationBinding {
+ get { return operationBinding; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MessageCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MessageCollection.cs
new file mode 100644
index 00000000000..1ba2bcf0afc
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MessageCollection.cs
@@ -0,0 +1,88 @@
+//
+// System.Web.Services.Description.MessageCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class MessageCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal MessageCollection (ServiceDescription serviceDescription)
+ : base (serviceDescription)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public Message this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (Message) List [index];
+ }
+ set { List [index] = value; }
+ }
+
+ public Message this [string name] {
+ get { return this [IndexOf ((Message) Table [name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (Message message)
+ {
+ Insert (Count, message);
+ return (Count - 1);
+ }
+
+ public bool Contains (Message message)
+ {
+ return List.Contains (message);
+ }
+
+ public void CopyTo (Message[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is Message))
+ throw new InvalidCastException ();
+
+ return ((Message) value).Name;
+ }
+
+ public int IndexOf (Message message)
+ {
+ return List.IndexOf (message);
+ }
+
+ public void Insert (int index, Message message)
+ {
+ List.Insert (index, message);
+ }
+
+ public void Remove (Message message)
+ {
+ List.Remove (message);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((Message) value).SetParent ((ServiceDescription) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MessagePart.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MessagePart.cs
new file mode 100644
index 00000000000..8b6923807f3
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MessagePart.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.Services.Description.MessagePart.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class MessagePart : DocumentableItem {
+
+ #region Fields
+
+ XmlQualifiedName element;
+ Message message;
+ string name;
+ XmlQualifiedName type;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MessagePart ()
+ {
+ element = XmlQualifiedName.Empty;
+ message = null;
+ name = String.Empty;
+ type = XmlQualifiedName.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("element")]
+ public XmlQualifiedName Element {
+ get { return element; }
+ set { element = value; }
+ }
+
+ public Message Message {
+ get { return message; }
+ }
+
+ [XmlAttribute ("name", DataType = "NMTOKEN")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlAttribute ("type")]
+ public XmlQualifiedName Type {
+ get { return type; }
+ set { type = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (Message message)
+ {
+ this.message = message;
+ }
+
+ #endregion // Methods
+
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MessagePartCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MessagePartCollection.cs
new file mode 100644
index 00000000000..6f35c6d9ef4
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MessagePartCollection.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.Services.Description.MessagePartCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class MessagePartCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal MessagePartCollection (Message message)
+ : base (message)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public MessagePart this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (MessagePart) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public MessagePart this [string name] {
+ get { return this [IndexOf ((MessagePart) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (MessagePart messagePart)
+ {
+ Insert (Count, messagePart);
+ return (Count - 1);
+ }
+
+ public bool Contains (MessagePart messagePart)
+ {
+ return List.Contains (messagePart);
+ }
+
+ public void CopyTo (MessagePart[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is MessagePart))
+ throw new InvalidCastException ();
+ return ((MessagePart) value).Name;
+ }
+
+ public int IndexOf (MessagePart messagePart)
+ {
+ return List.IndexOf (messagePart);
+ }
+
+ public void Insert (int index, MessagePart messagePart)
+ {
+ List.Insert (index, messagePart);
+ }
+
+ public void Remove (MessagePart messagePart)
+ {
+ List.Remove (messagePart);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((MessagePart) value).SetParent ((Message) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimeContentBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeContentBinding.cs
new file mode 100644
index 00000000000..6c1871f0002
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeContentBinding.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.Services.Description.MimeContentBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPrefix ("mime", "http://schemas.xmlsoap.org/wsdl/mime/")]
+ [XmlFormatExtension ("content", "http://schemas.xmlsoap.org/wsdl/mime/", typeof (InputBinding), typeof (OutputBinding))]
+ public sealed class MimeContentBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ public const string Namespace = "http://schemas.xmlsoap.org/wsdl/mime/";
+ string part;
+ string type;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MimeContentBinding ()
+ {
+ part = String.Empty;
+ type = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("part", DataType = "NMTOKEN")]
+ public string Part {
+ get { return part; }
+ set { part = value; }
+ }
+
+ [XmlAttribute ("type")]
+ public string Type {
+ get { return type; }
+ set { type = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimeMultipartRelatedBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeMultipartRelatedBinding.cs
new file mode 100644
index 00000000000..625638a4e7f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeMultipartRelatedBinding.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Services.Description.MimeMultipartRelatedBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("multipartRelated", "http://schemas.xmlsoap.org/wsdl/mime/", typeof (InputBinding), typeof (OutputBinding))]
+ public sealed class MimeMultipartRelatedBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ MimePartCollection parts;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MimeMultipartRelatedBinding ()
+ {
+ parts = new MimePartCollection ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlElement ("parts")]
+ public MimePartCollection Parts {
+ get { return parts; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimePart.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimePart.cs
new file mode 100644
index 00000000000..9723912f4a3
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimePart.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Services.Description.MimePart.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class MimePart : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MimePart ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimePartCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimePartCollection.cs
new file mode 100644
index 00000000000..fefe85c9304
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimePartCollection.cs
@@ -0,0 +1,64 @@
+//
+// System.Web.Services.Description.MimePartCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Description {
+ public sealed class MimePartCollection : CollectionBase {
+
+ #region Properties
+
+ public MimePart this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (MimePart) List[index];
+ }
+ set { List[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (MimePart mimePart)
+ {
+ Insert (Count, mimePart);
+ return (Count - 1);
+ }
+
+ public bool Contains (MimePart mimePart)
+ {
+ return List.Contains (mimePart);
+ }
+
+ public void CopyTo (MimePart[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (MimePart mimePart)
+ {
+ return List.IndexOf (mimePart);
+ }
+
+ public void Insert (int index, MimePart mimePart)
+ {
+ List.Insert (index, mimePart);
+ }
+
+ public void Remove (MimePart mimePart)
+ {
+ List.Remove (mimePart);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextBinding.cs
new file mode 100644
index 00000000000..9ce4fd4945d
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextBinding.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Services.Description.MimeTextBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("text", "http://microsoft.com/wsdl/mime/textMatching/", typeof (InputBinding), typeof (OutputBinding), typeof (MimePart))]
+ [XmlFormatExtensionPrefix ("tm", "http://microsoft.com/wsdl/mime/textMatching/")]
+ public sealed class MimeTextBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ public const string Namespace = "http://microsoft.com/wsdl/mime/textMatching/";
+ MimeTextMatchCollection matches;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MimeTextBinding ()
+ {
+ matches = new MimeTextMatchCollection ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlElement ("match", typeof (MimeTextMatch))]
+ public MimeTextMatchCollection Matches {
+ get { return matches; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatch.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatch.cs
new file mode 100644
index 00000000000..87c9b20122d
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatch.cs
@@ -0,0 +1,126 @@
+//
+// System.Web.Services.Description.MimeTextMatch.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class MimeTextMatch {
+
+ #region Fields
+
+ int capture;
+ int group;
+ bool ignoreCase;
+ MimeTextMatchCollection matches;
+ string name;
+ string pattern;
+ int repeats;
+ string type;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MimeTextMatch ()
+ {
+ capture = 0;
+ group = 1;
+ ignoreCase = false;
+ matches = null;
+ name = String.Empty;
+ pattern = String.Empty;
+ repeats = 1;
+ type = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue (0)]
+ [XmlAttribute ("capture")]
+ public int Capture {
+ get { return capture; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ();
+ capture = value;
+ }
+ }
+
+ [DefaultValue (1)]
+ [XmlAttribute ("group")]
+ public int Group {
+ get { return group; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ();
+ group = value;
+ }
+ }
+
+ [XmlAttribute ("ignoreCase")]
+ public bool IgnoreCase {
+ get { return ignoreCase; }
+ set { ignoreCase = value; }
+ }
+
+ [XmlElement ("match")]
+ public MimeTextMatchCollection Matches {
+ get { return matches; }
+ }
+
+ [XmlAttribute ("name")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlAttribute ("pattern")]
+ public string Pattern {
+ get { return pattern; }
+ set { pattern = value; }
+ }
+
+ [XmlIgnore]
+ public int Repeats {
+ get { return repeats; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ();
+ repeats = value;
+ }
+ }
+
+ [DefaultValue ("1")]
+ [XmlAttribute ("repeats")]
+ public string RepeatsString {
+ get { return Repeats.ToString (); }
+ set { Repeats = Int32.Parse (value); }
+ }
+
+ [XmlAttribute ("type")]
+ public string Type {
+ get { return type; }
+ set { type = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (MimeTextMatchCollection matches)
+ {
+ this.matches = matches;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatchCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatchCollection.cs
new file mode 100644
index 00000000000..59dd634a017
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeTextMatchCollection.cs
@@ -0,0 +1,70 @@
+//
+// System.Web.Services.Description.MimeTextMatchCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Description {
+ public sealed class MimeTextMatchCollection : CollectionBase {
+
+ #region Properties
+
+ public MimeTextMatch this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (MimeTextMatch) List [index];
+ }
+ set { List[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (MimeTextMatch match)
+ {
+ Insert (Count, match);
+ return (Count - 1);
+ }
+
+ public bool Contains (MimeTextMatch match)
+ {
+ return List.Contains (match);
+ }
+
+ public void CopyTo (MimeTextMatch[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (MimeTextMatch match)
+ {
+ return List.IndexOf (match);
+ }
+
+ public void Insert (int index, MimeTextMatch match)
+ {
+ SetParent (match, this);
+ List.Insert (index, match);
+ }
+
+ public void Remove (MimeTextMatch match)
+ {
+ List.Remove (match);
+ }
+
+ private void SetParent (object value, object parent)
+ {
+ ((MimeTextMatch) value).SetParent ((MimeTextMatchCollection) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MimeXmlBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeXmlBinding.cs
new file mode 100644
index 00000000000..93859fdaa1f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MimeXmlBinding.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Services.Description.MimeXmlBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("mimeXml", "http://schemas.xmlsoap.org/wsdl/mime/", typeof (MimePart), typeof (InputBinding), typeof (OutputBinding))]
+ public sealed class MimeXmlBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string part;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MimeXmlBinding ()
+ {
+ part = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("part", DataType = "NMTOKEN")]
+ public string Part {
+ get { return part; }
+ set { part = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Operation.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Operation.cs
new file mode 100644
index 00000000000..2823503f126
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Operation.cs
@@ -0,0 +1,96 @@
+//
+// System.Web.Services.Description.Operation.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class Operation : DocumentableItem {
+
+ #region Fields
+
+ OperationFaultCollection faults;
+ OperationMessageCollection messages;
+ string name;
+ string[] parameterOrder;
+ PortType portType;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Operation ()
+ {
+ faults = new OperationFaultCollection (this);
+ messages = new OperationMessageCollection (this);
+ name = String.Empty;
+ parameterOrder = null;
+ portType = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlElement ("fault")]
+ public OperationFaultCollection Faults {
+ get { return faults; }
+ }
+
+ [XmlElement ("output", typeof (OperationOutput))]
+ [XmlElement ("input", typeof (OperationInput))]
+ public OperationMessageCollection Messages {
+ get { return messages; }
+ }
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlIgnore]
+ public string[] ParameterOrder {
+ get { return parameterOrder; }
+ set { parameterOrder = value; }
+ }
+
+ [DefaultValue ("")]
+ [XmlAttribute ("parameterOrder")]
+ public string ParameterOrderString {
+ get {
+ if (parameterOrder == null)
+ return String.Empty;
+ return String.Join (" ", parameterOrder);
+ }
+ set { ParameterOrder = value.Split (' '); }
+ }
+
+ public PortType PortType {
+ get { return portType; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public bool IsBoundBy (OperationBinding operationBinding)
+ {
+ return (operationBinding.Name == Name);
+ }
+
+ internal void SetParent (PortType portType)
+ {
+ this.portType = portType;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationBinding.cs
new file mode 100644
index 00000000000..0bdb5e9579a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationBinding.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.Services.Description.OperationBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class OperationBinding : DocumentableItem {
+
+ #region Fields
+
+ Binding binding;
+ ServiceDescriptionFormatExtensionCollection extensions;
+ FaultBindingCollection faults;
+ InputBinding input;
+ string name;
+ OutputBinding output;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public OperationBinding ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ faults = new FaultBindingCollection (this);
+ input = null;
+ name = String.Empty;
+ output = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Binding Binding {
+ get { return binding; }
+ }
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ [XmlElement ("fault")]
+ public FaultBindingCollection Faults {
+ get { return faults; }
+ }
+
+ [XmlElement ("input")]
+ public InputBinding Input {
+ get { return input; }
+ set { input = value; }
+ }
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlElement ("output")]
+ public OutputBinding Output {
+ get { return output; }
+ set { output= value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (Binding binding)
+ {
+ this.binding = binding;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationBindingCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationBindingCollection.cs
new file mode 100644
index 00000000000..f81a409a6a9
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationBindingCollection.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Services.Description.OperationBindingCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class OperationBindingCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal OperationBindingCollection (Binding binding)
+ : base (binding)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public OperationBinding this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (OperationBinding) List[index];
+ }
+ set { List[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (OperationBinding bindingOperation)
+ {
+ Insert (Count, bindingOperation);
+ return (Count - 1);
+ }
+
+ public bool Contains (OperationBinding bindingOperation)
+ {
+ return List.Contains (bindingOperation);
+ }
+
+ public void CopyTo (OperationBinding[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (OperationBinding bindingOperation)
+ {
+ return List.IndexOf (bindingOperation);
+ }
+
+ public void Insert (int index, OperationBinding bindingOperation)
+ {
+ List.Insert (index, bindingOperation);
+ }
+
+ public void Remove (OperationBinding bindingOperation)
+ {
+ List.Remove (bindingOperation);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((OperationBinding) value).SetParent ((Binding) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationCollection.cs
new file mode 100644
index 00000000000..a92cf343db5
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationCollection.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Services.Description.OperationCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class OperationCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal OperationCollection (PortType portType)
+ : base (portType)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Operation this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (Operation) List[index];
+ }
+ set { List[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (Operation operation)
+ {
+ Insert (Count, operation);
+ return (Count - 1);
+ }
+
+ public bool Contains (Operation operation)
+ {
+ return List.Contains (operation);
+ }
+
+ public void CopyTo (Operation[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (Operation operation)
+ {
+ return List.IndexOf (operation);
+ }
+
+ public void Insert (int index, Operation operation)
+ {
+ List.Insert (index, operation);
+ }
+
+ public void Remove (Operation operation)
+ {
+ List.Remove (operation);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((Operation) value).SetParent ((PortType) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFault.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFault.cs
new file mode 100644
index 00000000000..f4055dbf5a4
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFault.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.Services.Description.OperationFault.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Description {
+ public sealed class OperationFault : OperationMessage {
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFaultCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFaultCollection.cs
new file mode 100644
index 00000000000..492c1d1caf6
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFaultCollection.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.Services.Description.OperationFaultCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class OperationFaultCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal OperationFaultCollection (Operation operation)
+ : base (operation)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public OperationFault this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ return (OperationFault) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public OperationFault this [string name] {
+ get { return this [IndexOf ((OperationFault) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (OperationFault operationFaultMessage)
+ {
+ Insert (Count, operationFaultMessage);
+ return (Count - 1);
+ }
+
+ public bool Contains (OperationFault operationFaultMessage)
+ {
+ return List.Contains (operationFaultMessage);
+ }
+
+ public void CopyTo (OperationFault[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is OperationFault))
+ throw new InvalidCastException ();
+
+ return ((OperationFault) value).Name;
+ }
+
+ public int IndexOf (OperationFault operationFaultMessage)
+ {
+ return List.IndexOf (operationFaultMessage);
+ }
+
+ public void Insert (int index, OperationFault operationFaultMessage)
+ {
+ List.Insert (index, operationFaultMessage);
+ }
+
+ public void Remove (OperationFault operationFaultMessage)
+ {
+ List.Remove (operationFaultMessage);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((OperationFault) value).SetParent ((Operation) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFlow.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFlow.cs
new file mode 100644
index 00000000000..a3c517aa24b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationFlow.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.Services.Description.OperationFlow.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ [Serializable]
+ public enum OperationFlow {
+ None = 0x0,
+ Notification = 0x2,
+ OneWay = 0x1,
+ RequestResponse = 0x3,
+ SolicitResponse = 0x4
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationInput.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationInput.cs
new file mode 100644
index 00000000000..4df8f046678
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationInput.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.Services.Description.OperationInput.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Xml;
+
+namespace System.Web.Services.Description {
+ public sealed class OperationInput : OperationMessage {
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs
new file mode 100644
index 00000000000..e24f045131a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs
@@ -0,0 +1,65 @@
+//
+// System.Web.Services.Description.OperationMessage.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public abstract class OperationMessage : DocumentableItem {
+
+ #region Fields
+
+ XmlQualifiedName message;
+ string name;
+ Operation operation;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected OperationMessage ()
+ {
+ message = null;
+ name = String.Empty;
+ operation = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("message")]
+ public XmlQualifiedName Message {
+ get { return message; }
+ set { message = value; }
+ }
+
+ [XmlAttribute ("name", DataType = "NMTOKEN")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public Operation Operation {
+ get { return operation; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (Operation operation)
+ {
+ this.operation = operation;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessageCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessageCollection.cs
new file mode 100644
index 00000000000..86aefe85c2e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessageCollection.cs
@@ -0,0 +1,130 @@
+//
+// System.Web.Services.Description.OperationMessageCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Description {
+ public sealed class OperationMessageCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal OperationMessageCollection (Operation operation)
+ : base (operation)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public OperationFlow Flow {
+ get {
+ switch (Count) {
+ case 1:
+ if (this[0] is OperationInput)
+ return OperationFlow.OneWay;
+ else
+ return OperationFlow.Notification;
+ case 2:
+ if (this[0] is OperationInput)
+ return OperationFlow.RequestResponse;
+ else
+ return OperationFlow.SolicitResponse;
+ }
+ return OperationFlow.None;
+ }
+ }
+
+ public OperationInput Input {
+ get {
+ foreach (object message in List)
+ if (message is OperationInput)
+ return (OperationInput) message;
+ return null;
+ }
+ }
+
+ public OperationMessage this [int index] {
+ get { return (OperationMessage) List[index]; }
+ set { List[index] = value; }
+ }
+
+ public OperationOutput Output {
+ get {
+ foreach (object message in List)
+ if (message is OperationOutput)
+ return (OperationOutput) message;
+ return null;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (OperationMessage operationMessage)
+ {
+ Insert (Count, operationMessage);
+ return (Count - 1);
+ }
+
+ public bool Contains (OperationMessage operationMessage)
+ {
+ return List.Contains (operationMessage);
+ }
+
+ public void CopyTo (OperationMessage[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (OperationMessage operationMessage)
+ {
+ return List.IndexOf (operationMessage);
+ }
+
+ public void Insert (int index, OperationMessage operationMessage)
+ {
+ List.Insert (index, operationMessage);
+ }
+
+ protected override void OnInsert (int index, object value)
+ {
+ if (Count > 2 || value.GetType () == this [0].GetType ())
+ throw new InvalidOperationException ("The operation object can only contain one input and one output message.");
+ }
+
+ protected override void OnSet (int index, object oldValue, object newValue)
+ {
+ if (oldValue.GetType () != newValue.GetType ())
+ throw new InvalidOperationException ("The message types of the old and new value are not the same.");
+ base.OnSet (index, oldValue, newValue);
+ }
+
+ protected override void OnValidate (object value)
+ {
+ if (value == null)
+ throw new NullReferenceException ("The message object is a null reference.");
+ if (!(value is OperationInput || value is OperationOutput))
+ throw new ArgumentException ("The message object is not an input or an output message.");
+ }
+
+ public void Remove (OperationMessage operationMessage)
+ {
+ List.Remove (operationMessage);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((OperationMessage) value).SetParent ((Operation) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationOutput.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationOutput.cs
new file mode 100644
index 00000000000..7c7ac0f9acc
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationOutput.cs
@@ -0,0 +1,13 @@
+//
+// System.Web.Services.Description.OperationOutput.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class OperationOutput : OperationMessage {
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OutputBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OutputBinding.cs
new file mode 100644
index 00000000000..d1dacc2cbd2
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OutputBinding.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Services.Description.OutputBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class OutputBinding : MessageBinding {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public OutputBinding ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public override ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Port.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Port.cs
new file mode 100644
index 00000000000..cdd86d9885e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Port.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.Services.Description.Port.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class Port : DocumentableItem {
+
+ #region Fields
+
+ XmlQualifiedName binding;
+ ServiceDescriptionFormatExtensionCollection extensions;
+ string name;
+ Service service;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Port ()
+ {
+ binding = null;
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ name = String.Empty;
+ service = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("binding")]
+ public XmlQualifiedName Binding {
+ get { return binding; }
+ set { binding = value; }
+ }
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public Service Service {
+ get { return service; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (Service service)
+ {
+ this.service = service;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/PortCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/PortCollection.cs
new file mode 100644
index 00000000000..b7061c8430b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/PortCollection.cs
@@ -0,0 +1,88 @@
+//
+// System.Web.Services.Description.PortCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class PortCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal PortCollection (Service service)
+ : base (service)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public Port this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (Port) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public Port this [string name] {
+ get { return this [IndexOf ((Port) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (Port port)
+ {
+ Insert (Count, port);
+ return (Count - 1);
+ }
+
+ public bool Contains (Port port)
+ {
+ return List.Contains (port);
+ }
+
+ public void CopyTo (Port[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is Port))
+ throw new InvalidCastException ();
+
+ return ((Port) value).Name;
+ }
+
+ public int IndexOf (Port port)
+ {
+ return List.IndexOf (port);
+ }
+
+ public void Insert (int index, Port port)
+ {
+ List.Insert (index, port);
+ }
+
+ public void Remove (Port port)
+ {
+ List.Remove (port);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((Port) value).SetParent ((Service) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/PortType.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/PortType.cs
new file mode 100644
index 00000000000..c5f9205484c
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/PortType.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Services.Description.PortType.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class PortType : DocumentableItem {
+
+ #region Fields
+
+ string name;
+ OperationCollection operations;
+ ServiceDescription serviceDescription;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public PortType ()
+ {
+ name = String.Empty;
+ operations = new OperationCollection (this);
+ serviceDescription = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlElement ("operation")]
+ public OperationCollection Operations {
+ get { return operations; }
+ }
+
+ public ServiceDescription ServiceDescription {
+ get { return serviceDescription; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/PortTypeCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/PortTypeCollection.cs
new file mode 100644
index 00000000000..427a72e215d
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/PortTypeCollection.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.Services.Description.PortTypeCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public sealed class PortTypeCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal PortTypeCollection (ServiceDescription serviceDescription)
+ : base (serviceDescription)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public PortType this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (PortType) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public PortType this [string name] {
+ get { return this [IndexOf ((PortType) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (PortType portType)
+ {
+ Insert (Count, portType);
+ return (Count - 1);
+ }
+
+ public bool Contains (PortType portType)
+ {
+ return List.Contains (portType);
+ }
+
+ public void CopyTo (PortType[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is PortType))
+ throw new InvalidCastException ();
+ return ((PortType) value).Name;
+ }
+
+ public int IndexOf (PortType portType)
+ {
+ return List.IndexOf (portType);
+ }
+
+ public void Insert (int index, PortType portType)
+ {
+ List.Insert (index, portType);
+ }
+
+ public void Remove (PortType portType)
+ {
+ List.Remove (portType);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((PortType) value).SetParent ((ServiceDescription) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs
new file mode 100644
index 00000000000..f37547f788b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs
@@ -0,0 +1,201 @@
+//
+// System.Web.Services.Description.ProtocolImporter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom;
+using System.Web.Services;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public abstract class ProtocolImporter {
+
+ #region Fields
+
+ XmlSchemas abstractSchemas;
+ Binding binding;
+ string className;
+ CodeIdentifiers classNames;
+ CodeNamespace codeNamespace;
+ CodeTypeDeclaration codeTypeDeclaration;
+ XmlSchemas concreteSchemas;
+ Message inputMessage;
+ string methodName;
+ Operation operation;
+ OperationBinding operationBinding;
+ Message outputMessage;
+ Port port;
+ PortType portType;
+ string protocolName;
+ XmlSchemas schemas;
+ Service service;
+ ServiceDescriptionCollection serviceDescriptions;
+ ServiceDescriptionImportStyle style;
+ ServiceDescriptionImportWarnings warnings;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ protected ProtocolImporter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public XmlSchemas AbstractSchemas {
+ get { return abstractSchemas; }
+ }
+
+ public Binding Binding {
+ get { return binding; }
+ }
+
+ public string ClassName {
+ get { return className; }
+ }
+
+ public CodeIdentifiers ClassNames {
+ get { return classNames; }
+ }
+
+ public CodeNamespace CodeNamespace {
+ get { return codeNamespace; }
+ }
+
+ public CodeTypeDeclaration CodeTypeDeclaration {
+ get { return codeTypeDeclaration; }
+ }
+
+ public XmlSchemas ConcreteSchemas {
+ get { return concreteSchemas; }
+ }
+
+ public Message InputMessage {
+ get { return inputMessage; }
+ }
+
+ public string MethodName {
+ get { return methodName; }
+ }
+
+ public Operation Operation {
+ get { return operation; }
+ }
+
+ public OperationBinding OperationBinding {
+ get { return operationBinding; }
+ }
+
+ public Message OutputMessage {
+ get { return outputMessage; }
+ }
+
+ public Port Port {
+ get { return port; }
+ }
+
+ public PortType PortType {
+ get { return portType; }
+ }
+
+ public abstract string ProtocolName {
+ get;
+ }
+
+ public XmlSchemas Schemas {
+ get { return schemas; }
+ }
+
+ public Service Service {
+ get { return service; }
+ }
+
+ public ServiceDescriptionCollection ServiceDescriptions {
+ get { return serviceDescriptions; }
+ }
+
+ public ServiceDescriptionImportStyle Style {
+ get { return style; }
+ }
+
+ public ServiceDescriptionImportWarnings Warnings {
+ get { return warnings; }
+ set { warnings = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void AddExtensionWarningComments (CodeCommentStatementCollection comments, ServiceDescriptionFormatExtensionCollection extensions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract CodeTypeDeclaration BeginClass ();
+
+ [MonoTODO]
+ protected virtual void BeginNamespace ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void EndClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void EndNamespace ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract CodeMemberMethod GenerateMethod ();
+ protected abstract bool IsBindingSupported ();
+ protected abstract bool IsOperationFlowSupported (OperationFlow flow);
+
+ [MonoTODO]
+ public Exception OperationBindingSyntaxException (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Exception OperationSyntaxException (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void UnsupportedBindingWarning (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void UnsupportedOperationBindingWarning (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void UnsupportedOperationWarning (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
new file mode 100644
index 00000000000..ad7b209387b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
@@ -0,0 +1,170 @@
+//
+// System.Web.Services.Description.ProtocolReflector.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public abstract class ProtocolReflector {
+
+ #region Fields
+
+ Binding binding;
+ string defaultNamespace;
+ MessageCollection headerMessages;
+ Message inputMessage;
+ LogicalMethodInfo method;
+ WebMethodAttribute methodAttribute;
+ LogicalMethodInfo[] methods;
+ Operation operation;
+ OperationBinding operationBinding;
+ Message outputMessage;
+ Port port;
+ PortType portType;
+ string protocolName;
+ XmlReflectionImporter reflectionImporter;
+ XmlSchemaExporter schemaExporter;
+ XmlSchemas schemas;
+ Service service;
+ ServiceDescription serviceDescription;
+ ServiceDescriptionCollection serviceDescriptions;
+ Type serviceType;
+ string serviceUrl;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ protected ProtocolReflector ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Binding Binding {
+ get { return binding; }
+ }
+
+ public string DefaultNamespace {
+ get { return defaultNamespace; }
+ }
+
+ public MessageCollection HeaderMessages {
+ get { return headerMessages; }
+ }
+
+ public Message InputMessage {
+ get { return inputMessage; }
+ }
+
+ public LogicalMethodInfo Method {
+ get { return method; }
+ }
+
+ public WebMethodAttribute MethodAttribute {
+ get { return methodAttribute; }
+ }
+
+ public LogicalMethodInfo[] Methods {
+ get { return methods; }
+ }
+
+ public Operation Operation {
+ get { return operation; }
+ }
+
+ public OperationBinding OperationBinding {
+ get { return operationBinding; }
+ }
+
+ public Message OutputMessage {
+ get { return outputMessage; }
+ }
+
+ public Port Port {
+ get { return port; }
+ }
+
+ public PortType PortType {
+ get { return portType; }
+ }
+
+ public abstract string ProtocolName {
+ get;
+ }
+
+ public XmlReflectionImporter ReflectionImporter {
+ get { return reflectionImporter; }
+ }
+
+ public XmlSchemaExporter SchemaExporter {
+ get { return schemaExporter; }
+ }
+
+ public XmlSchemas Schemas {
+ get { return schemas; }
+ }
+
+ public Service Service {
+ get { return service; }
+ }
+
+ public ServiceDescription ServiceDescription {
+ get { return serviceDescription; }
+ }
+
+ public ServiceDescriptionCollection ServiceDescriptions {
+ get { return serviceDescriptions; }
+ }
+
+ public Type ServiceType {
+ get { return serviceType; }
+ }
+
+ public string ServiceUrl {
+ get { return serviceUrl; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected virtual void BeginClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void EndClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ServiceDescription GetServiceDescription (string ns)
+ {
+ return serviceDescriptions [ns];
+ }
+
+ protected abstract bool ReflectMethod ();
+
+ [MonoTODO]
+ protected virtual string ReflectMethodBinding ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Service.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Service.cs
new file mode 100644
index 00000000000..a214bd0531a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Service.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.Services.Description.Service.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class Service : DocumentableItem {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+ string name;
+ PortCollection ports;
+ ServiceDescription serviceDescription;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Service ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ name = String.Empty;
+ ports = new PortCollection (this);
+ serviceDescription = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ [XmlAttribute ("name", DataType = "NCName")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlElement ("port")]
+ public PortCollection Ports {
+ get { return ports; }
+ }
+
+ public ServiceDescription ServiceDescription {
+ get { return serviceDescription; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceCollection.cs
new file mode 100644
index 00000000000..fa781e6ce8b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceCollection.cs
@@ -0,0 +1,90 @@
+//
+// System.Web.Services.Description.ServiceCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Description {
+ public sealed class ServiceCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ internal ServiceCollection (ServiceDescription serviceDescription)
+ : base (serviceDescription)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Service this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (Service) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public Service this [string name] {
+ get { return this [IndexOf ((Service) Table[name])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (Service service)
+ {
+ Insert (Count, service);
+ return (Count - 1);
+ }
+
+ public bool Contains (Service service)
+ {
+ return List.Contains (service);
+ }
+
+ public void CopyTo (Service[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is Service))
+ throw new InvalidCastException ();
+
+ return ((Service) value).Name;
+ }
+
+ public int IndexOf (Service service)
+ {
+ return List.IndexOf (service);
+ }
+
+ public void Insert (int index, Service service)
+ {
+ List.Insert (index, service);
+ }
+
+ public void Remove (Service service)
+ {
+ List.Remove (service);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((Service) value).SetParent ((ServiceDescription) parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
new file mode 100644
index 00000000000..737324c5acd
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
@@ -0,0 +1,260 @@
+//
+// System.Web.Services.Description.ServiceDescription.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web.Services;
+using System.Web.Services.Configuration;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ [XmlRoot ("definitions", Namespace = "http://schemas.xmlsoap.org/wsdl/")]
+ public sealed class ServiceDescription : DocumentableItem {
+
+ #region Fields
+
+ public const string Namespace = "http://schemas.xmlsoap.org/wsdl/";
+
+ BindingCollection bindings;
+ ServiceDescriptionFormatExtensionCollection extensions;
+ ImportCollection imports;
+ MessageCollection messages;
+ string name;
+ PortTypeCollection portTypes;
+ string retrievalUrl;
+ ServiceDescriptionCollection serviceDescriptions;
+ ServiceCollection services;
+ string targetNamespace;
+ Types types;
+ static ServiceDescriptionSerializer serializer;
+ XmlSerializerNamespaces ns;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ static ServiceDescription ()
+ {
+ serializer = new ServiceDescriptionSerializer ();
+ }
+
+ [MonoTODO ("Move namespaces to subtype, use ServiceDescriptionSerializer")]
+ public ServiceDescription ()
+ {
+ bindings = new BindingCollection (this);
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ imports = new ImportCollection (this);
+ messages = new MessageCollection (this);
+ name = String.Empty;
+ portTypes = new PortTypeCollection (this);
+
+ serviceDescriptions = null;
+ services = new ServiceCollection (this);
+ targetNamespace = String.Empty;
+ types = null;
+
+ ns = new XmlSerializerNamespaces ();
+ ns.Add ("soap", SoapBinding.Namespace);
+ ns.Add ("s", XmlSchema.Namespace);
+ ns.Add ("http", HttpBinding.Namespace);
+ ns.Add ("mime", MimeContentBinding.Namespace);
+ ns.Add ("tm", MimeTextBinding.Namespace);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlElement ("binding")]
+ public BindingCollection Bindings {
+ get { return bindings; }
+ }
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ [XmlElement ("import")]
+ public ImportCollection Imports {
+ get { return imports; }
+ }
+
+ [XmlElement ("message")]
+ public MessageCollection Messages {
+ get { return messages; }
+ }
+
+ [XmlAttribute ("name", DataType = "NMTOKEN")]
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [XmlElement ("portType")]
+ public PortTypeCollection PortTypes {
+ get { return portTypes; }
+ }
+
+ [XmlIgnore]
+ public string RetrievalUrl {
+ get { return retrievalUrl; }
+ set { retrievalUrl = value; }
+ }
+
+ [XmlIgnore]
+ public static XmlSerializer Serializer {
+ get { return serializer; }
+ }
+
+ [XmlIgnore]
+ public ServiceDescriptionCollection ServiceDescriptions {
+ get {
+ if (serviceDescriptions == null)
+ throw new NullReferenceException ();
+ return serviceDescriptions;
+ }
+ }
+
+ [XmlElement ("service")]
+ public ServiceCollection Services {
+ get { return services; }
+ }
+
+ [XmlAttribute ("targetNamespace")]
+ public string TargetNamespace {
+ get { return targetNamespace; }
+ set { targetNamespace = value; }
+ }
+
+ [XmlElement ("types")]
+ public Types Types {
+ get { return types; }
+ set { types = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public static bool CanRead (XmlReader reader)
+ {
+ return serializer.CanDeserialize (reader);
+ }
+
+ public static ServiceDescription Read (Stream stream)
+ {
+ return (ServiceDescription) serializer.Deserialize (stream);
+ }
+
+ public static ServiceDescription Read (string fileName)
+ {
+ return Read (new FileStream (fileName, FileMode.Open));
+ }
+
+ public static ServiceDescription Read (TextReader textReader)
+ {
+ return (ServiceDescription) serializer.Deserialize (textReader);
+ }
+
+ public static ServiceDescription Read (XmlReader reader)
+ {
+ return (ServiceDescription) serializer.Deserialize (reader);
+ }
+
+ public void Write (Stream stream)
+ {
+
+ serializer.Serialize (stream, this, ns);
+ }
+
+ public void Write (string fileName)
+ {
+ Write (new FileStream (fileName, FileMode.Create));
+ }
+
+ public void Write (TextWriter writer)
+ {
+ serializer.Serialize (writer, this, ns);
+ }
+
+ public void Write (XmlWriter writer)
+ {
+ serializer.Serialize (writer, this, ns);
+ }
+
+ internal void SetParent (ServiceDescriptionCollection serviceDescriptions)
+ {
+ this.serviceDescriptions = serviceDescriptions;
+ }
+
+ #endregion
+
+ internal class ServiceDescriptionSerializer : XmlSerializer {
+
+ #region Fields
+
+ XmlSerializerNamespaces ns;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO]
+ public ServiceDescriptionSerializer ()
+ : base (typeof (ServiceDescription), ServiceDescription.Namespace)
+ {
+ ns = new XmlSerializerNamespaces ();
+ ns.Add ("soap", SoapBinding.Namespace);
+ ns.Add ("s", XmlSchema.Namespace);
+ ns.Add ("http", HttpBinding.Namespace);
+ ns.Add ("mime", MimeContentBinding.Namespace);
+ ns.Add ("tm", MimeTextBinding.Namespace);
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override bool CanDeserialize (XmlReader reader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override XmlSerializationReader CreateReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override XmlSerializationWriter CreateWriter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override object Deserialize (XmlSerializationReader reader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Serialize (object serviceDescription, XmlSerializationWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionBaseCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionBaseCollection.cs
new file mode 100644
index 00000000000..187bb762c5c
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionBaseCollection.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.Services.Description.ServiceDescriptionBaseCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Web.Services;
+
+namespace System.Web.Services.Description {
+ public abstract class ServiceDescriptionBaseCollection : CollectionBase {
+
+ #region Fields
+
+ Hashtable table = new Hashtable ();
+ object parent;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal ServiceDescriptionBaseCollection (object parent)
+ {
+ this.parent = parent;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ protected virtual IDictionary Table {
+ get { return table; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected virtual string GetKey (object value)
+ {
+ return null;
+ }
+
+ protected override void OnClear ()
+ {
+ Table.Clear ();
+ }
+
+ protected override void OnInsertComplete (int index, object value)
+ {
+ if (GetKey (value) != null)
+ Table [GetKey (value)] = value;
+ SetParent (value, parent);
+ }
+
+ protected override void OnRemove (int index, object value)
+ {
+ if (GetKey (value) != null)
+ Table.Remove (GetKey (value));
+ }
+
+ protected override void OnSet (int index, object oldValue, object newValue)
+ {
+ if (GetKey (oldValue) != null)
+ Table.Remove (GetKey (oldValue));
+ if (GetKey (newValue) != null)
+ Table [GetKey (newValue)] = newValue;
+ SetParent (newValue, parent);
+ }
+
+ protected virtual void SetParent (object value, object parent)
+ {
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionCollection.cs
new file mode 100644
index 00000000000..d152d5f8167
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionCollection.cs
@@ -0,0 +1,121 @@
+//
+// System.Web.Services.Description.ServiceDescriptionCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Xml;
+
+namespace System.Web.Services.Description {
+ public sealed class ServiceDescriptionCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ public ServiceDescriptionCollection ()
+ : base (null)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ServiceDescription this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (ServiceDescription) List[index];
+ }
+ set { List [index] = value; }
+ }
+
+ public ServiceDescription this [string ns] {
+ get { return this[IndexOf ((ServiceDescription) Table[ns])]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (ServiceDescription serviceDescription)
+ {
+ Insert (Count, serviceDescription);
+ return (Count - 1);
+ }
+
+ public bool Contains (ServiceDescription serviceDescription)
+ {
+ return List.Contains (serviceDescription);
+ }
+
+ public void CopyTo (ServiceDescription[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public Binding GetBinding (XmlQualifiedName name)
+ {
+ foreach (object value in List)
+ foreach (Binding binding in ((ServiceDescription) value).Bindings)
+ if (binding.Name == name.Name)
+ return binding;
+ throw new Exception ();
+ }
+
+ protected override string GetKey (object value)
+ {
+ if (!(value is ServiceDescription))
+ throw new InvalidCastException ();
+ return ((ServiceDescription) value).TargetNamespace;
+ }
+
+ public Message GetMessage (XmlQualifiedName name)
+ {
+ foreach (object value in List)
+ foreach (Message message in ((ServiceDescription) value).Messages)
+ if (message.Name == name.Name)
+ return message;
+ throw new Exception ();
+ }
+
+ public PortType GetPortType (XmlQualifiedName name)
+ {
+ foreach (object value in List)
+ foreach (PortType portType in ((ServiceDescription) value).PortTypes)
+ if (portType.Name == name.Name)
+ return portType;
+ throw new Exception ();
+ }
+
+ public Service GetService (XmlQualifiedName name)
+ {
+ foreach (object value in List)
+ foreach (Service service in ((ServiceDescription) value).Services)
+ if (service.Name == name.Name)
+ return service;
+ throw new Exception ();
+ }
+
+ public int IndexOf (ServiceDescription serviceDescription)
+ {
+ return List.IndexOf (serviceDescription);
+ }
+
+ public void Insert (int index, ServiceDescription serviceDescription)
+ {
+ List.Insert (index, serviceDescription);
+ }
+
+ public void Remove (ServiceDescription serviceDescription)
+ {
+ List.Remove (serviceDescription);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtension.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtension.cs
new file mode 100644
index 00000000000..e8d51b50b67
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtension.cs
@@ -0,0 +1,65 @@
+//
+// System.Web.Services.Description.ServiceDescriptionFormatExtension.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public abstract class ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ bool handled;
+ object parent;
+ bool required;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected ServiceDescriptionFormatExtension ()
+ {
+ handled = false;
+ parent = null;
+ required = false;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public bool Handled {
+ get { return handled; }
+ set { handled = value; }
+ }
+
+ public object Parent {
+ get { return parent; }
+ }
+
+ [DefaultValue (false)]
+ [XmlAttribute ("required", Namespace = "http://schemas.xmlsoap.org/wsdl/")]
+ public bool Required {
+ get { return required; }
+ set { required = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ internal void SetParent (object value)
+ {
+ parent = value;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtensionCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtensionCollection.cs
new file mode 100644
index 00000000000..6363c90891f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionFormatExtensionCollection.cs
@@ -0,0 +1,154 @@
+//
+// System.Web.Services.Description.ServiceDescriptionFormatExtensionCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Web.Services;
+using System.Xml;
+
+namespace System.Web.Services.Description {
+ public sealed class ServiceDescriptionFormatExtensionCollection : ServiceDescriptionBaseCollection {
+
+ #region Constructors
+
+ public ServiceDescriptionFormatExtensionCollection (object parent)
+ : base (parent)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public object this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return List[index];
+ }
+ set { List[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object extension)
+ {
+ Insert (Count, extension);
+ return (Count - 1);
+ }
+
+ public bool Contains (object extension)
+ {
+ return List.Contains (extension);
+ }
+
+ public void CopyTo (object[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public object Find (Type type)
+ {
+ foreach (object value in List)
+ if (value.GetType () == type)
+ return value;
+ return null;
+ }
+
+ public XmlElement Find (string name, string ns)
+ {
+ XmlElement xmlElement;
+ foreach (object value in List)
+ if (value is XmlElement) {
+ xmlElement = (value as XmlElement);
+ if (xmlElement.Name == name && xmlElement.NamespaceURI == ns)
+ return xmlElement;
+ }
+ return null;
+ }
+
+ public object[] FindAll (Type type)
+ {
+ ArrayList searchResults = new ArrayList ();
+ foreach (object value in List)
+ if (value.GetType () == type)
+ searchResults.Add (value);
+ object[] returnValue = new object [searchResults.Count];
+
+ if (searchResults.Count > 0)
+ searchResults.CopyTo (returnValue);
+
+ return returnValue;
+ }
+
+ public XmlElement[] FindAll (string name, string ns)
+ {
+ ArrayList searchResults = new ArrayList ();
+ XmlElement xmlElement;
+
+ foreach (object value in List)
+ if (value is XmlElement) {
+ xmlElement = (value as XmlElement);
+ if (xmlElement.Name == name && xmlElement.NamespaceURI == ns)
+ searchResults.Add (xmlElement);
+ }
+
+ XmlElement[] returnValue = new XmlElement [searchResults.Count];
+
+ if (searchResults.Count > 0)
+ searchResults.CopyTo (returnValue);
+
+ return returnValue;
+ }
+
+ public int IndexOf (object extension)
+ {
+ return List.IndexOf (extension);
+ }
+
+ public void Insert (int index, object extension)
+ {
+ List.Insert (index, extension);
+ }
+
+ [MonoTODO]
+ public bool IsHandled (object item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsRequired (object item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnValidate (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (!(value is XmlElement || value is ServiceDescriptionFormatExtension))
+ throw new ArgumentException ();
+ }
+
+ public void Remove (object extension)
+ {
+ List.Remove (extension);
+ }
+
+ protected override void SetParent (object value, object parent)
+ {
+ ((ServiceDescriptionFormatExtension) value).SetParent (parent);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportStyle.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportStyle.cs
new file mode 100644
index 00000000000..5bcb9026908
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportStyle.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.Services.Description.ServiceDescriptionImportStyle.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public enum ServiceDescriptionImportStyle {
+ Client,
+ Server
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportWarnings.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportWarnings.cs
new file mode 100644
index 00000000000..5e4c329724a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImportWarnings.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.Services.Description.ServiceDescriptionImportWarnings.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ [Serializable]
+ public enum ServiceDescriptionImportWarnings {
+ NoCodeGenerated = 0x1,
+ NoMethodsGenerated = 0x20,
+ OptionalExtensionsIgnored = 0x2,
+ RequiredExtensionsIgnored = 0x4,
+ UnsupportedBindingsIgnored = 0x10,
+ UnsupportedOperationsIgnored = 0x8
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs
new file mode 100644
index 00000000000..491fb3a85a8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.Services.Description.ServiceDescriptionImporter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom;
+using System.Web.Services;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public class ServiceDescriptionImporter {
+
+ #region Fields
+
+ string protocolName;
+ XmlSchemas schemas;
+ ServiceDescriptionCollection serviceDescriptions;
+ ServiceDescriptionImportStyle style;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ServiceDescriptionImporter ()
+ {
+ protocolName = String.Empty;
+ schemas = new XmlSchemas ();
+ serviceDescriptions = new ServiceDescriptionCollection ();
+ style = ServiceDescriptionImportStyle.Client;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string ProtocolName {
+ get { return protocolName; }
+ set { protocolName = value; }
+ }
+
+ public XmlSchemas Schemas {
+ get { return schemas; }
+ }
+
+ public ServiceDescriptionCollection ServiceDescriptions {
+ get { return serviceDescriptions; }
+ }
+
+ public ServiceDescriptionImportStyle Style {
+ get { return style; }
+ set { style = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void AddServiceDescription (ServiceDescription serviceDescription, string appSettingUrlKey, string appSettingBaseUrl)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ServiceDescriptionImportWarnings Import (CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs
new file mode 100644
index 00000000000..d270f209823
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.Services.Description.ServiceDescriptionReflector.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public class ServiceDescriptionReflector {
+
+ #region Fields
+
+ XmlSchemas schemas;
+ ServiceDescriptionCollection serviceDescriptions;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ServiceDescriptionReflector ()
+ {
+ schemas = new XmlSchemas ();
+ serviceDescriptions = new ServiceDescriptionCollection ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public XmlSchemas Schemas {
+ get { return schemas; }
+ }
+
+ public ServiceDescriptionCollection ServiceDescriptions {
+ get { return serviceDescriptions; }
+ }
+
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void Reflect (Type type, string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs
new file mode 100644
index 00000000000..82a3a3dca0e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Services.Description.SoapAddressBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("address", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (Port))]
+ public sealed class SoapAddressBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string location;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapAddressBinding ()
+ {
+ location = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("location")]
+ public string Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs
new file mode 100644
index 00000000000..05f24f0c741
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.Services.Description.SoapBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPrefix ("soap", "http://schemas.xmlsoap.org/wsdl/soap/")]
+ [XmlFormatExtension ("binding", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (Binding))]
+ // FIXME: this won't compile!
+ // [XmlFormatExtensionPrefix ("soapenc", "http://schemas.xmlsoap.org/soap/encoding/")]
+ public sealed class SoapBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ public const string HttpTransport = "http://schemas.xmlsoap.org/soap/http/";
+ public const string Namespace = "http://schemas.xmlsoap.org/wsdl/soap/";
+
+ SoapBindingStyle style;
+ string transport;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapBinding ()
+ {
+ style = SoapBindingStyle.Document;
+ transport = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ // LAMESPEC: .NET says that the default value is SoapBindingStyle.Document but
+ // reflection shows this attribute is SoapBindingStyle.Default
+
+ [DefaultValue (SoapBindingStyle.Default)]
+ [XmlAttribute ("style")]
+ public SoapBindingStyle Style {
+ get { return style; }
+ set { style = value; }
+ }
+
+ [XmlAttribute ("transport")]
+ public string Transport {
+ get { return transport; }
+ set { transport = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingStyle.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingStyle.cs
new file mode 100644
index 00000000000..3812cd8622e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingStyle.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.Services.Description.SoapBindingStyle.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public enum SoapBindingStyle {
+ [XmlIgnore]
+ Default,
+ [XmlEnum ("document")]
+ Document,
+ [XmlEnum ("rpc")]
+ Rpc
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingUse.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingUse.cs
new file mode 100644
index 00000000000..d04bd50414f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBindingUse.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.Services.Description.SoapBindingUse.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public enum SoapBindingUse {
+ [XmlIgnore]
+ Default,
+ [XmlEnum ("encoded")]
+ Encoded,
+ [XmlEnum ("literal")]
+ Literal
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs
new file mode 100644
index 00000000000..963f9d2e4de
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.Services.Description.SoapBodyBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("body", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (InputBinding), typeof (OutputBinding), typeof (MimePart))]
+ public sealed class SoapBodyBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string encoding;
+ string ns;
+ string[] parts;
+ SoapBindingUse use;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapBodyBinding ()
+ {
+ encoding = String.Empty;
+ ns = String.Empty;
+ parts = null;
+ use = SoapBindingUse.Default;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue ("")]
+ [XmlAttribute ("encodingStyle")]
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ [DefaultValue ("")]
+ [XmlAttribute ("namespace")]
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ [XmlIgnore]
+ public string[] Parts {
+ get { return parts; }
+ set { parts = value; }
+ }
+
+ [XmlAttribute ("parts", DataType = "NMTOKENS")]
+ public string PartsString {
+ get { return String.Join (" ", Parts); }
+ set { Parts = value.Split (' '); }
+ }
+
+ [DefaultValue (SoapBindingUse.Default)]
+ [XmlAttribute ("use")]
+ public SoapBindingUse Use {
+ get { return use; }
+ set { use = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionImporter.cs
new file mode 100644
index 00000000000..ce33bc68906
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionImporter.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.Services.Description.SoapExtensionImporter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom;
+
+namespace System.Web.Services.Description {
+ public abstract class SoapExtensionImporter {
+
+ #region Fields
+
+ SoapProtocolImporter importContext;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected SoapExtensionImporter ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SoapProtocolImporter ImportContext {
+ get { return importContext; }
+ set { importContext = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public abstract void ImportMethod (CodeAttributeDeclarationCollection metadata);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionReflector.cs
new file mode 100644
index 00000000000..9eb0e34af41
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapExtensionReflector.cs
@@ -0,0 +1,42 @@
+//
+// System.Web.Services.Description.SoapExtensionReflector.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public abstract class SoapExtensionReflector {
+
+ #region Fields
+
+ ProtocolReflector reflectionContext;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected SoapExtensionReflector ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ProtocolReflector ReflectionContext {
+ get { return reflectionContext; }
+ set { reflectionContext = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public abstract void ReflectMethod ();
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs
new file mode 100644
index 00000000000..a67e4219de8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.Services.Description.SoapFaultBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("fault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (FaultBinding))]
+ public sealed class SoapFaultBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string encoding;
+ string ns;
+ SoapBindingUse use;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapFaultBinding ()
+ {
+ encoding = String.Empty;
+ ns = String.Empty;
+ use = SoapBindingUse.Default;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("encodingStyle")]
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ [XmlAttribute ("namespace")]
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ [DefaultValue (SoapBindingUse.Default)]
+ [XmlAttribute ("use")]
+ public SoapBindingUse Use {
+ get { return use; }
+ set { use = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs
new file mode 100644
index 00000000000..74bfd6c90eb
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs
@@ -0,0 +1,89 @@
+//
+// System.Web.Services.Description.SoapHeaderBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Web.Services;
+using System.Web.Services.Configuration;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (InputBinding), typeof (OutputBinding))]
+ public sealed class SoapHeaderBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string encoding;
+ bool mapToProperty;
+ XmlQualifiedName message;
+ string ns;
+ string part;
+ SoapBindingUse use;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SoapHeaderBinding ()
+ {
+ encoding = String.Empty;
+ mapToProperty = false; // FIXME: is this right?
+ message = XmlQualifiedName.Empty;
+ ns = String.Empty;
+ part = String.Empty;
+ use = SoapBindingUse.Default;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue ("")]
+ [XmlAttribute ("encodingStyle")]
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ [XmlIgnore]
+ public bool MapToProperty {
+ get { return mapToProperty; }
+ set { mapToProperty = value; }
+ }
+
+ [XmlAttribute ("message")]
+ public XmlQualifiedName Message {
+ get { return message; }
+ set { message = value; }
+ }
+
+ [DefaultValue ("")]
+ [XmlAttribute ("namespace")]
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ [XmlAttribute ("part", DataType = "NMTOKEN")]
+ public string Part {
+ get { return part; }
+ set { part = value; }
+ }
+
+ [DefaultValue (SoapBindingUse.Default)]
+ [XmlAttribute ("use")]
+ public SoapBindingUse Use {
+ get { return use; }
+ set { use = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs
new file mode 100644
index 00000000000..e33bcc685c0
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.Services.Description.SoapHeaderFaultBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Web.Services.Configuration;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("headerfault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (InputBinding), typeof (OutputBinding))]
+ public sealed class SoapHeaderFaultBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string encoding;
+ bool mapToProperty;
+ XmlQualifiedName message;
+ string ns;
+ string part;
+ SoapBindingUse use;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SoapHeaderFaultBinding ()
+ {
+ encoding = String.Empty;
+ mapToProperty = false; // FIXME: is this right?
+ message = XmlQualifiedName.Empty;
+ ns = String.Empty;
+ part = String.Empty;
+ use = SoapBindingUse.Default;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue ("")]
+ [XmlAttribute ("encodingStyle")]
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ [XmlAttribute ("message")]
+ public XmlQualifiedName Message {
+ get { return message; }
+ set { message = value; }
+ }
+
+ [DefaultValue ("")]
+ [XmlAttribute ("namespace")]
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ [XmlAttribute ("part", DataType = "NMTOKEN")]
+ public string Part {
+ get { return part; }
+ set { part = value; }
+ }
+
+ [DefaultValue (SoapBindingUse.Default)]
+ [XmlAttribute ("use")]
+ public SoapBindingUse Use {
+ get { return use; }
+ set { use = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs
new file mode 100644
index 00000000000..81492c78049
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.Services.Description.SoapOperationBinding.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Web.Services.Configuration;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtension ("operation", "http://schema.xmlsoap.org/wsdl/soap/", typeof (OperationBinding))]
+ public sealed class SoapOperationBinding : ServiceDescriptionFormatExtension {
+
+ #region Fields
+
+ string soapAction;
+ SoapBindingStyle style;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapOperationBinding ()
+ {
+ soapAction = String.Empty;
+ style = SoapBindingStyle.Document;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute ("soapAction")]
+ public string SoapAction {
+ get { return soapAction; }
+ set { soapAction = value; }
+ }
+
+ // LAMESPEC: .NET Documentation says that the default value for this property is
+ // SoapBindingStyle.Document (see constructor), but reflection shows that this
+ // attribute value is SoapBindingStyle.Default
+
+ [DefaultValue (SoapBindingStyle.Default)]
+ [XmlAttribute ("style")]
+ public SoapBindingStyle Style {
+ get { return style; }
+ set { style = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs
new file mode 100644
index 00000000000..f9982eeed20
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs
@@ -0,0 +1,111 @@
+//
+// System.Web.Services.Description.SoapProtocolImporter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom;
+using System.Web.Services;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ public sealed class SoapProtocolImporter : ProtocolImporter {
+
+ #region Fields
+
+ SoapBinding soapBinding;
+ SoapCodeExporter soapExporter;
+ SoapSchemaImporter soapImporter;
+ XmlCodeExporter xmlExporter;
+ XmlSchemaImporter xmlImporter;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SoapProtocolImporter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string ProtocolName {
+ get { return "Soap"; }
+ }
+
+ public SoapBinding SoapBinding {
+ get { return soapBinding; }
+ }
+
+ public SoapCodeExporter SoapExporter {
+ get { return soapExporter; }
+ }
+
+ public SoapSchemaImporter SoapImporter {
+ get { return soapImporter; }
+ }
+
+ public XmlCodeExporter XmlExporter {
+ get { return xmlExporter; }
+ }
+
+ public XmlSchemaImporter XmlImporter {
+ get { return xmlImporter; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected override CodeTypeDeclaration BeginClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void BeginNamespace ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void EndClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void EndNamespace ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override CodeMemberMethod GenerateMethod ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool IsBindingSupported ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool IsOperationFlowSupported (OperationFlow flow)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs
new file mode 100644
index 00000000000..cc7fbe03af7
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs
@@ -0,0 +1,70 @@
+//
+// System.Web.Services.Description.SoapProtocolReflector.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [MonoTODO ("This class is based on conjecture and guesswork.")]
+ internal class SoapProtocolReflector : ProtocolReflector {
+
+ #region Fields
+
+ SoapBinding soapBinding;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SoapProtocolReflector ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string ProtocolName {
+ get { return "Soap"; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected override void BeginClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void EndClass ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ReflectMethod ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override string ReflectMethodBinding ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapTransportImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapTransportImporter.cs
new file mode 100644
index 00000000000..22d76ed9978
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapTransportImporter.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.Services.Description.SoapTransportImporter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Description {
+ public abstract class SoapTransportImporter {
+
+ #region Fields
+
+ SoapProtocolImporter importContext;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected SoapTransportImporter ()
+ {
+ importContext = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SoapProtocolImporter ImportContext {
+ get { return importContext; }
+ set { importContext = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public abstract void ImportClass ();
+ public abstract bool IsSupportedTransport (string transport);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/Types.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/Types.cs
new file mode 100644
index 00000000000..6f19742f9f6
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/Types.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.Services.Description.Types.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Configuration;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Description {
+ [XmlFormatExtensionPoint ("Extensions")]
+ public sealed class Types : DocumentableItem {
+
+ #region Fields
+
+ ServiceDescriptionFormatExtensionCollection extensions;
+ XmlSchemas schemas;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public Types ()
+ {
+ extensions = new ServiceDescriptionFormatExtensionCollection (this);
+ schemas = new XmlSchemas ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public ServiceDescriptionFormatExtensionCollection Extensions {
+ get { return extensions; }
+ }
+
+ [XmlElement ("schema", typeof (XmlSchema), Namespace = "http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemas Schemas {
+ get { return schemas; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog
new file mode 100755
index 00000000000..5f4f2cbda07
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog
@@ -0,0 +1,61 @@
+2002-08-19 Tim Coleman <tim@timcoleman.com>
+ * DiscoveryClientProtocol.cs:
+ Added ResolveAll () stub.
+ * DiscoveryDocument.cs:
+ Added XmlRoot attribute to class.
+ * DiscoveryClientDocumentCollection.cs:
+ * DiscoveryClientReferenceCollection.cs:
+ * DiscoveryClientResultCollection.cs:
+ * DiscoveryReferenceCollection.cs:
+ Implementation of these classes.
+
+2002-08-04 Dave Bettin <javabettin@yahoo.com>
+ * ContractSearchPattern.cs
+ * DiscoveryClientDocumentCollection.cs
+ * DiscoveryClientProtocol.cs
+ * DiscoveryClientResult.cs
+ * DiscoveryDocument.cs
+ * DiscoveryDocumentLinksPattern.cs
+ * DiscoveryDocumentReference.cs
+ * DiscoveryDocumentSearchPattern.cs
+ * DiscoveryReference.cs
+ * DiscoveryRequestHandler.cs
+ * DiscoverySearchPattern.cs
+ * DynamicDiscoveryDocument.cs
+ * SchemaReference.cs
+ * SoapBinding.cs
+ * XmlSchemaSearchPattern.cs
+ [ Added attributes and some basic implementation]
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * DiscoveryDocument.cs:
+ Added XmlIgnore attribute to References property
+ * DiscoveryDocumentReference.cs:
+ Implemented Ref/Url properties and added XmlIgnore
+ attributes.
+
+2002-07-28 Dave Bettin <javabettin@yahoo.com>
+ * ContractReference.cs
+ * ContractSearchPattern.cs
+ * DiscoveryClientDocumentCollection.cs
+ * DiscoveryClientProtocol.cs
+ * DiscoveryClientReferenceCollection.cs
+ * DiscoveryClientResultCollection.cs
+ * DiscoveryClientResult.cs
+ * DiscoveryDocument.cs
+ * DiscoveryDocumentLinksPattern.cs
+ * DiscoveryDocumentReference.cs
+ * DiscoveryDocumentSearchPattern.cs
+ * DiscoveryExceptionDictionary.cs
+ * DiscoveryReferenceCollection.cs
+ * DiscoveryReference.cs
+ * DiscoveryRequestHandler.cs
+ * DiscoverySearchPattern.cs
+ * DynamicDiscoveryDocument.cs
+ * ExcludePathInfo.cs
+ * SchemaReference.cs
+ * SoapBinding.cs
+ * XmlSchemaSearchPattern.cs
+ [ Added stubs]
+
+
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs
new file mode 100755
index 00000000000..39cfbc54397
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs
@@ -0,0 +1,107 @@
+//
+// System.Web.Services.Discovery.ContractReference.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.IO;
+using System.Web.Services.Description;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+
+ [XmlRootAttribute("contractRef", Namespace="https://schemas.xmlsoap.org/disco/scl/", IsNullable=true)]
+ public class ContractReference : DiscoveryReference {
+
+ #region Fields
+
+ public const string Namespace = "http://schemas.xmlsoap.org/disco/scl/";
+
+ private ServiceDescription contract;
+ private string defaultFilename;
+ private string docRef;
+ private string href;
+ private string url;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public ContractReference ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ContractReference (string href) : this()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ContractReference (string href, string docRef) : this(href)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public ServiceDescription Contract {
+ get { return contract; }
+ }
+
+ [XmlIgnore]
+ public override string DefaultFilename {
+ get { return defaultFilename; }
+ }
+
+ [XmlAttribute("docRef")]
+ public string DocRef {
+ get { return docRef; }
+ set { docRef = value; }
+ }
+
+ [XmlAttribute("ref")]
+ public string Ref {
+ get { return href; }
+ set { href = value; }
+ }
+
+ [XmlIgnore]
+ public override string Url {
+ get { return url;}
+ set { url = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override object ReadDocument (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void Resolve (string contentType, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteDocument (object document, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractSearchPattern.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractSearchPattern.cs
new file mode 100755
index 00000000000..87a5d25a927
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractSearchPattern.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Services.Protocols.ContractSearchPattern.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+namespace System.Web.Services.Discovery {
+ public sealed class ContractSearchPattern : DiscoverySearchPattern {
+
+ #region Fields
+
+ private string pattern = "*.asmx";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public ContractSearchPattern ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Pattern {
+ get { return pattern; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override DiscoveryReference GetDiscoveryReference (string filename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientDocumentCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientDocumentCollection.cs
new file mode 100755
index 00000000000..3d4e77ee2c4
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientDocumentCollection.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.Services.Discovery.DiscoveryClientDocumentCollection.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Dave Bettin, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryClientDocumentCollection : DictionaryBase {
+
+ #region Constructors
+
+ public DiscoveryClientDocumentCollection ()
+ : base ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public object this [string url] {
+ get { return InnerHashtable [url]; }
+ set {
+ if (url == null)
+ throw new ArgumentNullException ();
+ InnerHashtable [url] = value;
+ }
+ }
+
+ public ICollection Keys {
+ get { return InnerHashtable.Keys; }
+ }
+
+ public ICollection Values {
+ get { return InnerHashtable.Values; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Add (string url, object value)
+ {
+ InnerHashtable [url] = value;
+ }
+
+ public bool Contains (string url)
+ {
+ return InnerHashtable.Contains (url);
+ }
+
+ public void Remove (string url)
+ {
+ InnerHashtable.Remove (url);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs
new file mode 100755
index 00000000000..622222c19d8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs
@@ -0,0 +1,138 @@
+//
+// System.Web.Services.Protocols.DiscoveryClientProtocol.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.Collections;
+using System.IO;
+using System.Web.Services.Protocols;
+
+namespace System.Web.Services.Discovery {
+ public class DiscoveryClientProtocol : HttpWebClientProtocol {
+
+ #region Fields
+
+ private IList additionalInformation;
+ private DiscoveryClientDocumentCollection documents;
+ private DiscoveryExceptionDictionary errors;
+ private DiscoveryClientReferenceCollection references;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryClientProtocol ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public IList AdditionalInformation {
+ get { return additionalInformation; }
+ }
+
+ public DiscoveryClientDocumentCollection Documents {
+ get { return documents; }
+ }
+
+ public DiscoveryExceptionDictionary Errors {
+ get { return errors; }
+ }
+
+ public DiscoveryClientReferenceCollection References {
+ get { return references; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public DiscoveryDocument Discover (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DiscoveryDocument DiscoverAny (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream Download (ref string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream Download (ref string url, ref string contentType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DiscoveryClientResultCollection ReadAll (string topLevelFilename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResolveAll ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResolveOneLevel ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DiscoveryClientResultCollection WriteAll (string directory, string topLevelFilename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Classes
+
+ public sealed class DiscoveryClientResultsFile {
+
+ #region Fields
+
+ private DiscoveryClientResultCollection results;
+
+ #endregion // Fields
+
+ #region Contructors
+
+ [MonoTODO]
+ public DiscoveryClientResultsFile ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public DiscoveryClientResultCollection Results {
+ get { return results; }
+ }
+
+ #endregion // Properties
+ }
+ #endregion // Classes
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientReferenceCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientReferenceCollection.cs
new file mode 100755
index 00000000000..a98ec112022
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientReferenceCollection.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.Services.Protocols.DiscoveryClientReferenceCollection.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Dave Bettin, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryClientReferenceCollection : DictionaryBase {
+
+ #region Constructors
+
+ public DiscoveryClientReferenceCollection ()
+ : base ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public DiscoveryReference this [string url] {
+ get { return (DiscoveryReference) InnerHashtable [url]; }
+ set { InnerHashtable [url] = value; }
+ }
+
+ public ICollection Keys {
+ get { return InnerHashtable.Keys; }
+ }
+
+ public ICollection Values {
+ get { return InnerHashtable.Values; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Add (DiscoveryReference value)
+ {
+ Add (value.Url, value);
+ }
+
+ public void Add (string url, DiscoveryReference value)
+ {
+ InnerHashtable [url] = value;
+ }
+
+ public bool Contains (string url)
+ {
+ return InnerHashtable.Contains (url);
+ }
+
+ public void Remove (string url)
+ {
+ InnerHashtable.Remove (url);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResult.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResult.cs
new file mode 100755
index 00000000000..77aa4b0cd3a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResult.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Services.Disocvery.DiscoveryClientResult.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryClientResult {
+
+ #region Fields
+
+ private string filename;
+ private string referenceTypeName;
+ private string url;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryClientResult ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DiscoveryClientResult (Type referenceType, string url, string filename) : this()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute("filename")]
+ public string Filename {
+ get { return filename; }
+ set { filename = value; }
+ }
+
+ [XmlAttribute("referenceType")]
+ public string ReferenceTypeName {
+ get { return referenceTypeName; }
+ set { referenceTypeName = value; }
+ }
+
+ [XmlAttribute("url")]
+ public string Url {
+ get { return url; }
+ set { url = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResultCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResultCollection.cs
new file mode 100755
index 00000000000..8f93bb0d24b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientResultCollection.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Services.Protocols.DiscoveryClientResultCollection.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Dave Bettin, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryClientResultCollection : CollectionBase {
+
+ #region Constructors
+
+ public DiscoveryClientResultCollection ()
+ : base ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public DiscoveryClientResult this [int i] {
+ get {
+ if (i < 0 || i >= Count)
+ throw new ArgumentOutOfRangeException ();
+ return (DiscoveryClientResult) InnerList [i];
+ }
+ set {
+ if (i < 0 || i >= Count)
+ throw new ArgumentOutOfRangeException ();
+ InnerList [i] = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (DiscoveryClientResult value)
+ {
+ return InnerList.Add (value);
+ }
+
+ public bool Contains (DiscoveryClientResult value)
+ {
+ return InnerList.Contains (value);
+ }
+
+ public void Remove (DiscoveryClientResult value)
+ {
+ InnerList.Remove (value);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocument.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocument.cs
new file mode 100755
index 00000000000..35a7010b08f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocument.cs
@@ -0,0 +1,93 @@
+//
+// System.Web.Services.Protocols.DiscoveryDocument.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Dave Bettin, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+ [XmlRoot ("discovery", Namespace = "http://schemas.xmlsoap.org/disco/")]
+ public sealed class DiscoveryDocument {
+
+ #region Fields
+
+ public const string Namespace = "http://schema.xmlsoap.org/disco/";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryDocument ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public IList References {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public static bool CanRead (XmlReader xmlReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static DiscoveryDocument Read (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static DiscoveryDocument Read (TextReader textReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static DiscoveryDocument Read (XmlReader xmlReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Write (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Write (TextWriter textWriter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Write (XmlWriter xmlWriter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentLinksPattern.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentLinksPattern.cs
new file mode 100755
index 00000000000..19621b26d4b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentLinksPattern.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Services.Protocols.DiscoveryDocumentLinksPattern.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+namespace System.Web.Services.Discovery {
+ public class DiscoveryDocumentLinksPattern : DiscoverySearchPattern {
+
+ #region Fields
+
+ private string pattern = "*.disco";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryDocumentLinksPattern ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Pattern {
+ get { return pattern; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override DiscoveryReference GetDiscoveryReference (string filename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs
new file mode 100755
index 00000000000..9d18e39118d
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs
@@ -0,0 +1,99 @@
+//
+// System.Web.Services.Discovery.DiscoveryDocumentReference.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Dave Bettin, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web.Services.Description;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+
+ [XmlRootAttribute("discoveryRef", Namespace="http://schemas.xmlsoap.org/disco/", IsNullable=true)]
+ public sealed class DiscoveryDocumentReference : DiscoveryReference {
+
+ #region Fields
+
+ private DiscoveryDocument document;
+ private string defaultFilename;
+ private string href;
+ private string url;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryDocumentReference ()
+ {
+ href = String.Empty;
+ }
+
+ public DiscoveryDocumentReference (string href) : this ()
+ {
+ this.href = href;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public DiscoveryDocument Document {
+ get { return Document; }
+ }
+
+ [XmlIgnore]
+ public override string DefaultFilename {
+ get { return defaultFilename; }
+ }
+
+ [XmlAttribute("ref")]
+ public string Ref {
+ get { return href; }
+ set { href = value; }
+ }
+
+ [XmlIgnore]
+ public override string Url {
+ get { return url; }
+ set { url = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override object ReadDocument (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void Resolve (string contentType, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResolveAll ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteDocument (object document, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentSearchPattern.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentSearchPattern.cs
new file mode 100755
index 00000000000..97024add9d2
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentSearchPattern.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Services.Discovery.DiscoveryDocumentSearchPattern.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryDocumentSearchPattern : DiscoverySearchPattern {
+
+ #region Fields
+
+ private string pattern = "*.vsdisco";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryDocumentSearchPattern ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Pattern {
+ get { return pattern; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override DiscoveryReference GetDiscoveryReference (string filename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryExceptionDictionary.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryExceptionDictionary.cs
new file mode 100755
index 00000000000..5e2cc93237a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryExceptionDictionary.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.Services.Protocols.DiscoveryExceptionDictionary.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryExceptionDictionary : DictionaryBase {
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryExceptionDictionary ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Exception this[string url] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ public ICollection Keys {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ICollection Values {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void Add (string url, Exception value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReference.cs
new file mode 100755
index 00000000000..e68d9fa6cf8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReference.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.Services.Discovery.DiscoveryReference.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.IO;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+ public abstract class DiscoveryReference {
+
+ #region Fields
+
+ private string defaultFilename;
+ private DiscoveryClientProtocol clientProtocol;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ protected DiscoveryReference ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public DiscoveryClientProtocol ClientProtocol {
+ get { return clientProtocol; }
+ set { clientProtocol = value; }
+
+ }
+
+ [XmlIgnore]
+ public virtual string DefaultFilename {
+ get { return defaultFilename; }
+ }
+
+ [XmlIgnore]
+ public abstract string Url {
+ get;
+ set;
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected static string FilenameFromUrl (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract object ReadDocument (Stream stream);
+
+ [MonoTODO]
+ public void Resolve ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected internal abstract void Resolve (string contentType, Stream stream);
+
+ public abstract void WriteDocument (object document, Stream stream);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReferenceCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReferenceCollection.cs
new file mode 100755
index 00000000000..ec81f3dadfc
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryReferenceCollection.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Services.Protocols.DiscoveryReferenceCollection.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Dave Bettin, 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryReferenceCollection : CollectionBase {
+
+ #region Constructors
+
+ public DiscoveryReferenceCollection ()
+ : base ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public DiscoveryReference this [int i] {
+ get {
+ if (i < 0 || i >= Count)
+ throw new ArgumentOutOfRangeException ();
+ return (DiscoveryReference) InnerList [i];
+ }
+ set {
+ if (i < 0 || i >= Count)
+ throw new ArgumentOutOfRangeException ();
+ InnerList [i] = value;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (DiscoveryReference value)
+ {
+ return InnerList.Add (value);
+ }
+
+ public bool Contains (DiscoveryReference value)
+ {
+ return InnerList.Contains (value);
+ }
+
+ public void Remove (DiscoveryReference value)
+ {
+ InnerList.Remove (value);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryRequestHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryRequestHandler.cs
new file mode 100755
index 00000000000..564a3b3ae8c
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryRequestHandler.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.Services.Discovery.DiscoveryRequestHandler.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.Web;
+
+namespace System.Web.Services.Discovery {
+ public sealed class DiscoveryRequestHandler : IHttpHandler {
+
+ #region Fields
+
+ private bool isReusable = true;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DiscoveryRequestHandler ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool IsReusable {
+ get { return isReusable; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void ProcessRequest (HttpContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoverySearchPattern.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoverySearchPattern.cs
new file mode 100755
index 00000000000..d2ae0944ea6
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoverySearchPattern.cs
@@ -0,0 +1,33 @@
+//
+// System.Web.Services.Discovery.DiscoverySearchPattern.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+namespace System.Web.Services.Discovery {
+ public abstract class DiscoverySearchPattern {
+
+ #region Constructors
+
+ protected DiscoverySearchPattern () {}
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public abstract string Pattern {
+ get;
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public abstract DiscoveryReference GetDiscoveryReference (string filename);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DynamicDiscoveryDocument.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DynamicDiscoveryDocument.cs
new file mode 100755
index 00000000000..e16e251d06e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DynamicDiscoveryDocument.cs
@@ -0,0 +1,62 @@
+//
+// System.Web.Services.Discovery.DynamicDiscoveryDocument.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.IO;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+
+ [XmlRootAttribute("dynamicDiscovery", Namespace="urn:schemas-dynamicdiscovery:disco.2000-03-17", IsNullable=true)]
+ public sealed class DynamicDiscoveryDocument {
+
+ #region Fields
+
+ public const string Namespace = "urn:schemas-dynamicdiscovery:disco.2000-03-17";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public DynamicDiscoveryDocument ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlElement("exclude", typeof(ExcludePathInfo))]
+ public ExcludePathInfo[] ExcludePaths {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public static DynamicDiscoveryDocument Load (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Write (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ExcludePathInfo.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ExcludePathInfo.cs
new file mode 100755
index 00000000000..e86bdd09b4e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ExcludePathInfo.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Services.Discovery.ExcludePathInfo.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+ public sealed class ExcludePathInfo {
+
+ #region Fields
+
+ private string path;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public ExcludePathInfo ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ExcludePathInfo (string path) : this()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute("path")]
+ public string Path {
+ get { return path; }
+ set { path = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/SchemaReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/SchemaReference.cs
new file mode 100755
index 00000000000..e5109ceaa19
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/SchemaReference.cs
@@ -0,0 +1,105 @@
+//
+// System.Web.Services.Discovery.SchemaReference.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+
+using System.ComponentModel;
+using System.IO;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+
+ [XmlRootAttribute("schemaRef", Namespace="http://schemas/xmlsoap.org/disco/schema/", IsNullable=true)]
+ public sealed class SchemaReference : DiscoveryReference {
+
+ #region Fields
+
+ public const string Namespace = "http://schemas/xmlsoap.org/disco/schema/";
+
+ private string defaultFilename;
+ private string href;
+ private string url;
+ private string targetNamespace;
+ private XmlSchema schema;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SchemaReference ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SchemaReference (string href) : this()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public override string DefaultFilename {
+ get { return defaultFilename; }
+ }
+
+ [XmlAttribute("ref")]
+ public string Ref {
+ get { return href; }
+ set { href = value; }
+ }
+
+ [XmlIgnore]
+ public override string Url {
+ get { return url; }
+ set { url = value; }
+ }
+
+ [DefaultValue("")]
+ [XmlAttribute("targetNamespace")]
+ public string TargetNamespace {
+ get { return targetNamespace; }
+ set { targetNamespace = targetNamespace; }
+ }
+
+ [XmlIgnore]
+ public XmlSchema Schema {
+ get { return schema; }
+
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override object ReadDocument (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void Resolve (string contentType, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteDocument (object document, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/SoapBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/SoapBinding.cs
new file mode 100755
index 00000000000..c91e356e3e6
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/SoapBinding.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Services.Discovery.SoapBinding.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Discovery {
+
+ [XmlRootAttribute("soap", Namespace="http://schemas/xmlsoap.org/disco/schema/soap/", IsNullable=true)]
+ public sealed class SoapBinding {
+
+ #region Fields
+
+ public const string Namespace = "http://schemas/xmlsoap.org/disco/schema/soap/";
+
+ private string address;
+ private XmlQualifiedName binding;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SoapBinding ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlAttribute("address")]
+ public string Address {
+ get { return address; }
+ set { address = value; }
+ }
+
+ [XmlAttribute("binding")]
+ public XmlQualifiedName Binding {
+ get { return binding; }
+ set { binding = value; }
+ }
+
+ #endregion // Properties
+
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/XmlSchemaSearchPattern.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/XmlSchemaSearchPattern.cs
new file mode 100755
index 00000000000..f597a6d478a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/XmlSchemaSearchPattern.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.Services.Discovery.XmlSchemaSearchPattern.cs
+//
+// Author:
+// Dave Bettin (javabettin@yahoo.com)
+//
+// Copyright (C) Dave Bettin, 2002
+//
+
+namespace System.Web.Services.Discovery {
+ public sealed class XmlSchemaSearchPattern : DiscoverySearchPattern {
+
+ #region Fields
+
+ private string pattern = "*.xsd";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public XmlSchemaSearchPattern ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Pattern {
+ get { return pattern; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override DiscoveryReference GetDiscoveryReference (string filename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/AnyReturnReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/AnyReturnReader.cs
new file mode 100644
index 00000000000..698e60ea252
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/AnyReturnReader.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.Services.Protocols.AnyReturnReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class AnyReturnReader : MimeReturnReader {
+
+ #region Constructors
+
+ [MonoTODO]
+ public AnyReturnReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object Read (WebResponse response, Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
new file mode 100644
index 00000000000..a4470557837
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
@@ -0,0 +1,202 @@
+2002-08-24 Tim Coleman <tim@timcoleman.com>
+ * HttpServerProtocol.cs:
+ * WebServiceHandler.cs:
+ Some commented code added, from analysing
+ an exception trace.
+ * MimeReturnWriter.cs:
+ * XmlReturnWriter.cs:
+ New stubs added.
+
+2002-08-23 Tim Coleman <tim@timcoleman.com>
+ * ServerProtocol.cs:
+ * SoapServerProtocol.cs:
+ More cleanup, comparison with class status.
+ * WebServiceHandler.cs:
+ * HttpServerProtocol.cs:
+ New stubs added.
+
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * ServerProtocol.cs:
+ * SoapServerProtocol.cs:
+ Some more implementation.
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * ServerProtocol.cs:
+ Add new class as implied by class statuc page.
+ SoapServerProtocol is derived from this.
+ * SoapServerProtocol.cs:
+ Change base class to ServerProtocol. Add some
+ properties shown by class status page.
+ * SoapClientMethod.cs:
+ This class should not be sealed. Add some
+ fields shown by the class status page.
+
+2002-07-25 Tim Coleman <tim@timcoleman.com>
+ * SoapClientMethod.cs:
+ * SoapServerProtocol.cs:
+ Add new internal classes as discovered.
+ * SoapClientMessage.cs:
+ * SoapMessage.cs:
+ * SoapServerMessage.cs:
+ * WebClientAsyncResult.cs:
+ Add internal constructor, as found on class
+ status page; modify some properties.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * SoapException.cs: modified constructors to
+ call base class correctly.
+ * WebClientAsyncResult: some implementation
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * HttpGetClientProtocol.cs:
+ * HttpPostClientProtocol.cs
+ Implemented the GetWebRequest method
+ * HttpSimpleClientProtocol:
+ Some implementation of the EndInvoke method
+ * HttpWebClientProtocol.cs:
+ Set the UserAgent string appropriately
+ Implemented the GetWebRequest method
+ Implemented the GetWebResponse methods
+ * SoapHttpClientProtocol.cs:
+ Removed unused fields
+ Implemented the GetWebRequest method
+ * SoapMessage.cs:
+ Implemented the EnsureStage method
+ * WebClientProtocol.cs:
+ Added a static constructor to construct the cache
+ Implemented the Abort method
+ Implemented the AddToCache, GetFromCache methods
+ Implemented the GetWebRequest method
+ Implemented the GetWebResponse methods
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * LogicalMethodTypes.cs:
+ * SoapHeaderDirection.cs:
+ * SoapMessageStage.cs:
+ * SoapParameterStyle.cs:
+ * SoapServiceRoutingStyle.cs:
+ Explicitly define values in enum to match
+ .NET.
+ * SoapMessage.cs:
+ Removed constructor which should not be present.
+ * SoapException.cs:
+ Made protected fields private as they should
+ be.
+ * SoapHeaderException.cs:
+ Modifications to constructors to propertly
+ call base class constructor
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * SoapHeaderException.cs:
+ Fixed name error in constructor
+ * SoapUnknownHeader.cs:
+ Added reference to System.Xml.Serialization
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * SoapHeaderException.cs:
+ New file added
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * AnyReturnReader.cs:
+ * HtmlFormParameterReader.cs :
+ * HtmlFormParameterWriter.cs :
+ * HttpGetClientProtocol.cs :
+ * HttpMethodAttribute.cs :
+ * HttpPostClientProtocol.cs :
+ * HttpSimpleClientProtocol.cs :
+ * HttpWebClientProtocol.cs :
+ * LogicalMethodInfo.cs :
+ * LogicalMethodTypes.cs :
+ * MatchAttribute.cs :
+ * MimeFormatter.cs :
+ * MimeParameterReader.cs :
+ * MimeParameterWriter.cs :
+ * MimeReturnReader.cs :
+ * NopReturnReader.cs :
+ * PatternMatcher.cs :
+ * SoapClientMessage.cs :
+ * SoapDocumentMethodAttribute.cs :
+ * SoapDocumentServiceAttribute.cs :
+ * SoapException.cs :
+ * SoapExtension.cs :
+ * SoapExtensionAttribute.cs :
+ * SoapHeader.cs :
+ * SoapHeaderAttribute.cs :
+ * SoapHeaderCollection.cs :
+ * SoapHeaderDirection.cs :
+ * SoapHttpClientProtocol.cs :
+ * SoapMessage.cs :
+ * SoapMessageStage.cs :
+ * SoapParameterStyle.cs :
+ * SoapRpcMethodAttribute.cs :
+ * SoapRpcServiceAttribute.cs :
+ * SoapServerMessage.cs :
+ * SoapServiceRoutingStyle.cs :
+ * SoapUnknownHeader.cs :
+ * TextReturnReader.cs :
+ * UrlEncodedParameterWriter.cs :
+ * UrlParameterReader.cs :
+ * UrlParameterWriter.cs :
+ * ValueCollectionParameterReader.cs :
+ * WebClientAsyncResult.cs :
+ * WebClientProtocol.cs :
+ * WebServiceHandlerFactory.cs :
+ * XmlReturnReader.cs :
+ Add missing methods and attributes to make as few missing
+ things as possible in this namespace. This is from the
+ project status page.
+
+2002-07-20 Tim Coleman <tim@timcoleman.com>
+ * AnyReturnReader.cs:
+ * HtmlFormParameterReader.cs:
+ * HtmlFormParameterWriter.cs:
+ * HttpGetClientProtocol.cs:
+ * HttpMethodAttribute.cs:
+ * HttpPostClientProtocol.cs:
+ * HttpSimpleClientProtocol.cs:
+ * HttpWebClientProtocol.cs:
+ * MatchAttribute.cs:
+ * MimeFormatter.cs:
+ * MimeParameterReader.cs:
+ * MimeParameterWriter.cs:
+ * MimeReturnReader.cs:
+ * NopReturnReader.cs:
+ * PatternMatcher.cs:
+ * SoapClientMessage.cs:
+ * SoapDocumentMethodAttribute.cs:
+ * SoapDocumentServiceAttribute.cs:
+ * SoapException.cs:
+ * SoapExtensionAttribute.cs:
+ * SoapExtension.cs:
+ * SoapHeaderAttribute.cs:
+ * SoapHeaderCollection.cs:
+ * SoapHeader.cs:
+ * SoapHeaderDirection.cs:
+ * SoapHttpClientProtocol.cs:
+ * SoapMessage.cs:
+ * SoapMessageStage.cs:
+ * SoapParameterStyle.cs:
+ * SoapRpcMethodAttribute.cs:
+ * SoapRpcServiceAttribute.cs:
+ * SoapServerMessage.cs:
+ * SoapServiceRoutingStyle.cs:
+ * SoapUnknownHeader.cs:
+ * TextReturnReader.cs:
+ * UrlEncodedParameterWriter.cs:
+ * UrlParameterReader.cs:
+ * UrlParameterWriter.cs:
+ * ValueCollectionParameterReader.cs:
+ * WebClientAsyncResult.cs:
+ * WebClientProtocol.cs:
+ * WebServiceHandlerFactory.cs:
+ * XmlReturnReader.cs:
+ Added new stubbs and some implementation
+ * LogicalMethodTypes.cs:
+ Added [Serializable] attribute which was missing.
+
+2002-07-19 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog:
+ * LogicalMethodInfo.cs:
+ * LogicalMethodTypes.cs:
+ Add required classes to maek System.Web.Services.Description
+ buildable.
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterReader.cs
new file mode 100644
index 00000000000..883b85f6924
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterReader.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Services.Protocols.HtmlFormParameterReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class HtmlFormParameterReader : ValueCollectionParameterReader {
+
+ #region Constructors
+
+ [MonoTODO]
+ public HtmlFormParameterReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object[] Read (HttpRequest request)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterWriter.cs
new file mode 100644
index 00000000000..f463a2325d7
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HtmlFormParameterWriter.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.Services.Protocols.HtmlFormParameterWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class HtmlFormParameterWriter : UrlEncodedParameterWriter {
+
+ #region Constructors
+
+ [MonoTODO]
+ public HtmlFormParameterWriter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override bool UsesWriteRequest {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void InitializeRequest (WebRequest request, object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteRequest (Stream requestStream, object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpGetClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpGetClientProtocol.cs
new file mode 100644
index 00000000000..554201746ec
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpGetClientProtocol.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.Services.Protocols.HttpGetClientProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Net;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class HttpGetClientProtocol : HttpSimpleClientProtocol {
+
+ #region Constructors
+
+ public HttpGetClientProtocol ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ protected override WebRequest GetWebRequest (Uri uri)
+ {
+ if (uri == null)
+ throw new InvalidOperationException ("The uri parameter is null.");
+ if (uri.ToString () == String.Empty)
+ throw new InvalidOperationException ("The uri parameter has a length of zero.");
+ return WebRequest.Create (uri);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpMethodAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpMethodAttribute.cs
new file mode 100644
index 00000000000..824d9d18803
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpMethodAttribute.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.Services.Protocols.HttpMethodAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class HttpMethodAttribute : Attribute {
+
+ #region Fields
+
+ Type parameterFormatter;
+ Type returnFormatter;
+
+ #endregion
+
+ #region Constructors
+
+ public HttpMethodAttribute ()
+ {
+ }
+
+ public HttpMethodAttribute (Type returnFormatter, Type parameterFormatter)
+ : this ()
+ {
+ this.parameterFormatter = parameterFormatter;
+ this.returnFormatter = returnFormatter;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public Type ParameterFormatter {
+ get { return parameterFormatter; }
+ set { parameterFormatter = value; }
+ }
+
+ public Type ReturnFormatter {
+ get { return returnFormatter; }
+ set { returnFormatter = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpPostClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpPostClientProtocol.cs
new file mode 100644
index 00000000000..ebdc3cdf9a1
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpPostClientProtocol.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.Services.Protocols.HttpPostClientProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Net;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class HttpPostClientProtocol : HttpSimpleClientProtocol {
+
+ #region Constructors
+
+ public HttpPostClientProtocol ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ protected override WebRequest GetWebRequest (Uri uri)
+ {
+ if (null == uri)
+ throw new InvalidOperationException ("The uri parameter is a null reference.");
+ if (String.Empty == uri.ToString ())
+ throw new InvalidOperationException ("The uri parameter has a length of zero.");
+ return WebRequest.Create (uri);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpServerProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpServerProtocol.cs
new file mode 100644
index 00000000000..2ae6e5ab395
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpServerProtocol.cs
@@ -0,0 +1,76 @@
+//
+// System.Web.Services.Protocols.HttpServerProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ [MonoTODO ("Figure out what this class does.")]
+ internal abstract class HttpServerProtocol : ServerProtocol {
+
+ #region Constructors
+
+ [MonoTODO ("Is the bool parameter the one way?")]
+ protected HttpServerProtocol (bool isOneWay)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [MonoTODO]
+ public override bool IsOneWay {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override LogicalMethodInfo MethodInfo {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public static bool AreUrlParametersSupported (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Initialize ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object[] ReadParameters ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool WriteException (Exception e, Stream outputStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteReturns (object[] returnValues, Stream outputStream)
+ {
+ //xmlReturnWriter.Write (Response, outputStream, returnValue);
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
new file mode 100644
index 00000000000..282739ec4c1
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Services.Protocols.HttpSimpleClientProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class HttpSimpleClientProtocol : HttpWebClientProtocol {
+
+ #region Fields
+
+ IAsyncResult result;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected HttpSimpleClientProtocol ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ protected IAsyncResult BeginInvoke (string methodName, string requestUrl, object[] parameters, AsyncCallback callback, object asyncState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected object EndInvoke (IAsyncResult asyncResult)
+ {
+ if (asyncResult != result)
+ throw new ArgumentException ("asyncResult is not the return value from BeginInvoke");
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected object Invoke (string methodName, string requestUrl, object[] parameters)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
new file mode 100644
index 00000000000..a47c7a19694
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.Services.Protocols.HttpWebClientProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Net;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class HttpWebClientProtocol : WebClientProtocol {
+
+ #region Fields
+
+ bool allowAutoRedirect;
+ X509CertificateCollection clientCertificates;
+ CookieContainer cookieContainer;
+ IWebProxy proxy;
+ string userAgent;
+
+ #endregion
+
+ #region Constructors
+
+ protected HttpWebClientProtocol ()
+ {
+ allowAutoRedirect = false;
+ clientCertificates = new X509CertificateCollection ();
+ cookieContainer = null;
+ proxy = null; // FIXME
+ userAgent = String.Format ("Mono Web Services Client Protocol {0}", Environment.Version);
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue (false)]
+ [WebServicesDescription ("Enable automatic handling of server redirects.")]
+ public bool AllowAutoRedirect {
+ get { return allowAutoRedirect; }
+ set { allowAutoRedirect = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebServicesDescription ("The client certificates that will be sent to the server, if the server requests them.")]
+ public X509CertificateCollection ClientCertificates {
+ get { return clientCertificates; }
+ }
+
+ [DefaultValue (null)]
+ [WebServicesDescription ("A container for all cookies received from servers in the current session.")]
+ public CookieContainer CookieContainer {
+ get { return cookieContainer; }
+ set { cookieContainer = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public IWebProxy Proxy {
+ get { return proxy; }
+ set { proxy = value; }
+ }
+
+ [WebServicesDescription ("Sets the user agent http header for the request.")]
+ public string UserAgent {
+ get { return userAgent; }
+ set { userAgent = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override WebRequest GetWebRequest (Uri uri)
+ {
+ if (null == uri)
+ throw new InvalidOperationException ("The uri parameter is a null reference.");
+ return WebRequest.Create (uri);
+ }
+
+ protected override WebResponse GetWebResponse (WebRequest request)
+ {
+ return request.GetResponse ();
+ }
+
+ protected override WebResponse GetWebResponse (WebRequest request, IAsyncResult result)
+ {
+ IAsyncResult ar = request.BeginGetResponse (null, null);
+ ar.AsyncWaitHandle.WaitOne ();
+ return request.EndGetResponse (result);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodInfo.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodInfo.cs
new file mode 100644
index 00000000000..471b925d6e5
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodInfo.cs
@@ -0,0 +1,176 @@
+//
+// System.Web.Services.Protocols.LogicalMethodInfo.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Reflection;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public sealed class LogicalMethodInfo {
+
+ #region Fields
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public LogicalMethodInfo (MethodInfo methodInfo)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ParameterInfo AsyncCallbackParameter {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ParameterInfo AsyncResultParameter {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ParameterInfo AsyncStateParameter {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public MethodInfo BeginMethodInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ICustomAttributeProvider CustomAttributeProvider {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public Type DeclaringType {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public MethodInfo EndMethodInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ParameterInfo[] InParameters {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsAsync {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsVoid {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public MethodInfo MethodInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Name {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ParameterInfo[] OutParameters {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ParameterInfo[] Parameters {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public Type ReturnType {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ICustomAttributeProvider ReturnTypeCustomAttributeProvider {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public IAsyncResult BeginInvoke (object target, object[] values, AsyncCallback callback, object asyncState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static LogicalMethodInfo[] Create (MethodInfo[] methodInfos)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static LogicalMethodInfo[] Create (MethodInfo[] methodInfos, LogicalMethodTypes types)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object[] EndInvoke (object target, IAsyncResult asyncResult)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetCustomAttribute (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object[] GetCustomAttributes (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object[] Invoke (object target, object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsBeginMethod (MethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsEndMethod (MethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodTypes.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodTypes.cs
new file mode 100644
index 00000000000..c2347a4f487
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/LogicalMethodTypes.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.Services.Protocols.LogicalMethodTypes.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [Serializable]
+ public enum LogicalMethodTypes {
+ Async = 0x2,
+ Sync = 0x1
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/MatchAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MatchAttribute.cs
new file mode 100644
index 00000000000..95c985c5900
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MatchAttribute.cs
@@ -0,0 +1,64 @@
+//
+// System.Web.Services.Protocols.MatchAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class MatchAttribute : Attribute {
+
+ #region Fields
+
+ int capture;
+ int group;
+ bool ignoreCase;
+ int maxRepeats;
+ string pattern;
+
+ #endregion
+
+ #region Constructors
+
+ public MatchAttribute (string pattern)
+ {
+ ignoreCase = false;
+ maxRepeats = -1;
+ this.pattern = pattern;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public int Capture {
+ get { return capture; }
+ set { capture = value; }
+ }
+
+ public int Group {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignoreCase; }
+ set { ignoreCase = value; }
+ }
+
+ public int MaxRepeats {
+ get { return maxRepeats; }
+ set { maxRepeats = value; }
+ }
+
+ public string Pattern {
+ get { return pattern; }
+ set { pattern = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeFormatter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeFormatter.cs
new file mode 100644
index 00000000000..2bc4e93239b
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeFormatter.cs
@@ -0,0 +1,57 @@
+//
+// System.Web.Services.Protocols.MimeFormatter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class MimeFormatter {
+
+ #region Constructors
+
+ [MonoTODO]
+ protected MimeFormatter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public static MimeFormatter CreateInstance (Type type, object initializer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract object GetInitializer (LogicalMethodInfo methodInfo);
+
+ [MonoTODO]
+ public static object GetInitializer (Type type, LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object[] GetInitializers (LogicalMethodInfo[] methodInfos)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object[] GetInitializers (Type type, LogicalMethodInfo[] methodInfos)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void Initialize (object initializer);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterReader.cs
new file mode 100644
index 00000000000..3b9f5a59c74
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterReader.cs
@@ -0,0 +1,29 @@
+//
+// System.Web.Services.Protocols.MimeParameterReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web;
+
+namespace System.Web.Services.Protocols {
+ public abstract class MimeParameterReader : MimeFormatter {
+
+ #region Constructors
+
+ protected MimeParameterReader ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public abstract object[] Read (HttpRequest request);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterWriter.cs
new file mode 100644
index 00000000000..c152c4b3456
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeParameterWriter.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.Services.Protocols.MimeParameterWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class MimeParameterWriter : MimeFormatter {
+
+ #region Constructors
+
+ [MonoTODO]
+ protected MimeParameterWriter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public virtual Encoding RequestEncoding {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ public virtual bool UsesWriteRequest {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public virtual string GetRequestUrl (string url, object[] parameters)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void InitializeRequest (WebRequest request, object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void WriteRequest (Stream requestStream, object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnReader.cs
new file mode 100644
index 00000000000..29e645554e9
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnReader.cs
@@ -0,0 +1,30 @@
+//
+// System.Web.Services.Protocols.MimeReturnReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+
+namespace System.Web.Services.Protocols {
+ public abstract class MimeReturnReader : MimeFormatter {
+
+ #region Constructors
+
+ protected MimeReturnReader ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public abstract object Read (WebResponse response, Stream responseStream);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnWriter.cs
new file mode 100644
index 00000000000..06921886ba8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/MimeReturnWriter.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.Services.Protocols.MimeReturnWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web;
+
+namespace System.Web.Services.Protocols {
+ internal abstract class MimeReturnWriter : MimeFormatter {
+
+ #region Methods
+
+ public abstract void Write (HttpResponse response, Stream outputStream, object returnValue);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/NopReturnReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/NopReturnReader.cs
new file mode 100644
index 00000000000..2786fc75ae2
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/NopReturnReader.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.Services.Protocols.NopReturnReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class NopReturnReader : MimeReturnReader {
+
+ #region Constructors
+
+ [MonoTODO]
+ public NopReturnReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object initializer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object Read (WebResponse response, Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/PatternMatcher.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/PatternMatcher.cs
new file mode 100644
index 00000000000..4d60f517285
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/PatternMatcher.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.Services.Protocols.PatternMatcher.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public sealed class PatternMatcher {
+
+ #region Constructors
+
+ [MonoTODO]
+ public PatternMatcher (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public object Match (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerProtocol.cs
new file mode 100644
index 00000000000..5c778125aff
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerProtocol.cs
@@ -0,0 +1,110 @@
+//
+// System.Web.Services.Protocols.ServerProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ [MonoTODO ("Figure out what this class does.")]
+ internal abstract class ServerProtocol {
+
+ #region Constructors
+
+ protected ServerProtocol ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public HttpContext Context {
+ get { throw new NotImplementedException (); }
+ }
+
+ public abstract bool IsOneWay {
+ get;
+ }
+
+ public abstract LogicalMethodInfo MethodInfo {
+ get;
+ }
+
+ [MonoTODO]
+ public virtual Exception OnewayInitException {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public HttpRequest Request {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public HttpResponse Response {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ protected void AddToCache (Type t1, Type t2, object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void CreateServerInstance ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void DisposeServerInstance ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GenerateFaultString (Exception exception)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected object GetFromCache (Type t1, Type t2)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract bool Initialize ();
+ public abstract object[] ReadParameters ();
+
+ [MonoTODO]
+ public virtual bool WriteException (Exception e, Stream outputStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void WriteOneWayResponse ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void WriteReturns (object[] returnValues, Stream outputStream);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMessage.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMessage.cs
new file mode 100644
index 00000000000..a09077b146f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMessage.cs
@@ -0,0 +1,78 @@
+//
+// System.Web.Services.Protocols.SoapClientMessage.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public sealed class SoapClientMessage : SoapMessage {
+
+ #region Fields
+
+ SoapHttpClientProtocol client;
+ SoapClientMethod clientMethod;
+ string url;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO ("Determine what calls this constructor.")]
+ internal SoapClientMessage (SoapHttpClientProtocol client, SoapClientMethod clientMethod, string url)
+ {
+ this.client = client;
+ this.url = url;
+ this.clientMethod = clientMethod;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string Action {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public SoapHttpClientProtocol Client {
+ get { return client; }
+ }
+
+ public override LogicalMethodInfo MethodInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool OneWay {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string Url {
+ get { return url; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected override void EnsureInStage ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void EnsureOutStage ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMethod.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMethod.cs
new file mode 100644
index 00000000000..9bc959b3997
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMethod.cs
@@ -0,0 +1,27 @@
+//
+// System.Web.Services.Protocols.SoapClientMethod.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+using System.Web.Services.Description;
+
+namespace System.Web.Services.Protocols {
+ [MonoTODO ("Determine what this class does.")]
+ internal class SoapClientMethod {
+
+ #region Fields
+
+ public string action;
+ public LogicalMethodInfo methodInfo;
+ public bool oneWay;
+ public bool rpc;
+ public SoapBindingUse use;
+
+ #endregion // Fields
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs
new file mode 100644
index 00000000000..d927eb37acf
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs
@@ -0,0 +1,102 @@
+//
+// System.Web.Services.Protocols.SoapDocumentMethodAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Description;
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class SoapDocumentMethodAttribute : Attribute {
+
+ #region Fields
+
+ string action;
+ string binding;
+ bool oneWay;
+ SoapParameterStyle parameterStyle;
+ string requestElementName;
+ string requestNamespace;
+ string responseElementName;
+ string responseNamespace;
+ SoapBindingUse use;
+
+ #endregion
+
+ #region Constructors
+
+ public SoapDocumentMethodAttribute ()
+ {
+ action = "http://tempuri.org/MethodName"; // FIXME
+ binding = String.Empty; // FIXME
+ oneWay = false;
+ parameterStyle = SoapParameterStyle.Wrapped;
+ requestElementName = String.Empty; // FIXME
+ requestNamespace = "http://tempuri.org/";
+ responseElementName = "WebServiceNameResult"; // FIXME
+ responseNamespace = "http://tempuri.org/";
+ use = SoapBindingUse.Literal;
+ }
+
+ public SoapDocumentMethodAttribute (string action)
+ : this ()
+ {
+ this.action = action;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Action {
+ get { return action; }
+ set { action = value; }
+ }
+
+ public string Binding {
+ get { return binding; }
+ set { binding = value; }
+ }
+
+ public bool OneWay {
+ get { return oneWay; }
+ set { oneWay = value; }
+ }
+
+ public SoapParameterStyle ParameterStyle {
+ get { return parameterStyle; }
+ set { parameterStyle = value; }
+ }
+
+ public string RequestElementName {
+ get { return requestElementName; }
+ set { requestElementName = value; }
+ }
+
+ public string RequestNamespace {
+ get { return requestNamespace; }
+ set { requestNamespace = value; }
+ }
+
+ public string ResponseElementName {
+ get { return responseElementName; }
+ set { responseElementName = value; }
+ }
+
+ public string ResponseNamespace {
+ get { return responseNamespace; }
+ set { responseNamespace = value; }
+ }
+
+ public SoapBindingUse Use {
+ get { return use; }
+ set { use = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentServiceAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentServiceAttribute.cs
new file mode 100644
index 00000000000..6593a87609e
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentServiceAttribute.cs
@@ -0,0 +1,67 @@
+//
+// System.Web.Services.Protocols.SoapDocumentServiceAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services.Description;
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class SoapDocumentServiceAttribute : Attribute {
+
+ #region Fields
+
+ SoapParameterStyle paramStyle;
+ SoapServiceRoutingStyle routingStyle;
+ SoapBindingUse use;
+
+ #endregion
+
+ #region Constructors
+
+ public SoapDocumentServiceAttribute ()
+ {
+ paramStyle = SoapParameterStyle.Wrapped;
+ routingStyle = SoapServiceRoutingStyle.SoapAction;
+ use = SoapBindingUse.Literal;
+ }
+
+ public SoapDocumentServiceAttribute (SoapBindingUse use)
+ : this ()
+ {
+ this.use = use;
+ }
+
+ public SoapDocumentServiceAttribute (SoapBindingUse use, SoapParameterStyle paramStyle)
+ : this ()
+ {
+ this.use = use;
+ this.paramStyle = paramStyle;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SoapParameterStyle ParameterStyle {
+ get { return paramStyle; }
+ set { paramStyle = value; }
+ }
+
+ public SoapServiceRoutingStyle RoutingStyle {
+ get { return routingStyle; }
+ set { routingStyle = value; }
+ }
+
+ public SoapBindingUse Use {
+ get { return use; }
+ set { use = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs
new file mode 100644
index 00000000000..e28c88d06b7
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs
@@ -0,0 +1,91 @@
+//
+// System.Web.Services.Protocols.SoapException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+
+namespace System.Web.Services.Protocols {
+ public class SoapException : SystemException {
+
+ #region Fields
+
+ public static readonly XmlQualifiedName ClientFaultCode = new XmlQualifiedName ("Client", "http://schemas.xmlsoap.org/soap/envelope/");
+ public static readonly XmlQualifiedName DetailElementName = new XmlQualifiedName ("detail");
+ public static readonly XmlQualifiedName MustUnderstandFaultCode = new XmlQualifiedName ("MustUnderstand", "http://schemas.xmlsoap.org/soap/envelope/");
+ public static readonly XmlQualifiedName ServerFaultCode = new XmlQualifiedName ("Server", "http://schemas.xmlsoap.org/soap/envelope/");
+ public static readonly XmlQualifiedName VersionMismatchFaultCode = new XmlQualifiedName ("VersionMismatch", "http://schemas.xmlsoap.org/soap/envelope/");
+
+ string actor;
+ XmlQualifiedName code;
+ XmlNode detail;
+
+ #endregion
+
+ #region Constructors
+
+ public SoapException (string message, XmlQualifiedName code)
+ : base (message)
+ {
+ this.code = code;
+ }
+
+ public SoapException (string message, XmlQualifiedName code, Exception innerException)
+ : base (message, innerException)
+ {
+ this.code = code;
+ }
+
+ public SoapException (string message, XmlQualifiedName code, string actor)
+ : base (message)
+ {
+ this.code = code;
+ this.actor = actor;
+ }
+
+ public SoapException (string message, XmlQualifiedName code, string actor, Exception innerException)
+ : base (message, innerException)
+ {
+ this.code = code;
+ this.actor = actor;
+ }
+
+ public SoapException (string message, XmlQualifiedName code, string actor, XmlNode detail)
+ : base (message)
+ {
+ this.code = code;
+ this.actor = actor;
+ this.detail = detail;
+ }
+
+ public SoapException (string message, XmlQualifiedName code, string actor, XmlNode detail, Exception innerException)
+ : base (message, innerException)
+ {
+ this.code = code;
+ this.actor = actor;
+ this.detail = detail;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Actor {
+ get { return actor; }
+ }
+
+ public XmlQualifiedName Code {
+ get { return code; }
+ }
+
+ public XmlNode Detail {
+ get { return detail; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs
new file mode 100644
index 00000000000..48f91cd38db
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Services.Protocols.SoapExtension.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+
+namespace System.Web.Services.Protocols {
+ public abstract class SoapExtension {
+
+ #region Fields
+
+ Stream stream;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO]
+ protected SoapExtension ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public virtual Stream ChainStream (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract object GetInitializer (Type serviceType);
+ public abstract object GetInitializer (LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute);
+ public abstract void Initialize (object initializer);
+ public abstract void ProcessMessage (SoapMessage message);
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtensionAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtensionAttribute.cs
new file mode 100644
index 00000000000..c90f6b9bc94
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtensionAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.Services.Protocols.SoapExtensionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ public abstract class SoapExtensionAttribute : Attribute {
+
+ #region Constructors
+
+ protected SoapExtensionAttribute ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public abstract Type ExtensionType {
+ get;
+ }
+
+ public abstract int Priority {
+ get;
+ set;
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeader.cs
new file mode 100644
index 00000000000..eecfa6b0282
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeader.cs
@@ -0,0 +1,78 @@
+//
+// System.Web.Services.Protocols.SoapHeader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Protocols {
+ [SoapType (IncludeInSchema = false)]
+ [XmlType (IncludeInSchema = false)]
+ public abstract class SoapHeader {
+
+ #region Fields
+
+ string actor;
+ bool didUnderstand;
+ bool mustUnderstand;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected SoapHeader ()
+ {
+ actor = String.Empty;
+ didUnderstand = false;
+ mustUnderstand = false;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue ("")]
+ [SoapAttribute ("actor", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
+ [XmlAttribute ("actor", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
+ public string Actor {
+ get { return actor; }
+ set { actor = value; }
+ }
+
+ [SoapIgnore]
+ [XmlIgnore]
+ public bool DidUnderstand {
+ get { return didUnderstand; }
+ set { didUnderstand = value; }
+ }
+
+ [DefaultValue ("0")]
+ [SoapAttribute ("mustUnderstand", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
+ [XmlAttribute ("mustUnderstand", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
+ public string EncodedMustUnderstand {
+ get { return (MustUnderstand ? "1" : "0"); }
+ set {
+ if (value == "true" || value == "1")
+ MustUnderstand = true;
+ else if (value == "false" || value == "0")
+ MustUnderstand = false;
+ else
+ throw new ArgumentException ();
+ }
+ }
+
+ [SoapIgnore]
+ [XmlIgnore]
+ public bool MustUnderstand {
+ get { return mustUnderstand; }
+ set { mustUnderstand = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderAttribute.cs
new file mode 100644
index 00000000000..f933c62d2d8
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderAttribute.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.Services.Protocols.SoapHeaderAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class SoapHeaderAttribute : Attribute {
+
+ #region Fields
+
+ SoapHeaderDirection direction;
+ string memberName;
+ bool required;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapHeaderAttribute (string memberName)
+ {
+ direction = SoapHeaderDirection.In;
+ this.memberName = memberName;
+ required = true;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SoapHeaderDirection Direction {
+ get { return direction; }
+ set { direction = value; }
+ }
+
+ public string MemberName {
+ get { return memberName; }
+ set { memberName = value; }
+ }
+
+ public bool Required {
+ get { return required; }
+ set { required = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderCollection.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderCollection.cs
new file mode 100644
index 00000000000..017b0346beb
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderCollection.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.Services.Protocols.SoapHeaderCollection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+
+namespace System.Web.Services.Protocols {
+ public class SoapHeaderCollection : CollectionBase {
+
+ #region Constructors
+
+ public SoapHeaderCollection ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public SoapHeader this [int index] {
+ get { return (SoapHeader) List[index]; }
+ set { List[index] = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (SoapHeader header)
+ {
+ Insert (Count, header);
+ return (Count - 1);
+ }
+
+ public bool Contains (SoapHeader header)
+ {
+ return List.Contains (header);
+ }
+
+ public void CopyTo (SoapHeader[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public int IndexOf (SoapHeader header)
+ {
+ return List.IndexOf (header);
+ }
+
+ public void Insert (int index, SoapHeader header)
+ {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ List.Insert (index, header);
+ }
+
+ public void Remove (SoapHeader header)
+ {
+ List.Remove (header);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs
new file mode 100644
index 00000000000..14c60ee3119
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.Services.Protocols.SoapHeaderDirection.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [Flags]
+ [Serializable]
+ public enum SoapHeaderDirection {
+ In = 0x1,
+ InOut = 0x3,
+ Out = 0x2
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderException.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderException.cs
new file mode 100644
index 00000000000..3e2bde7b2b7
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderException.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.Services.Protocols.SoapHeaderException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+
+namespace System.Web.Services.Protocols {
+ public class SoapHeaderException : SoapException {
+
+ #region Constructors
+
+ public SoapHeaderException (string message, XmlQualifiedName code)
+ : base (message, code)
+ {
+ }
+
+ public SoapHeaderException (string message, XmlQualifiedName code, Exception innerException)
+ : base (message, code, innerException)
+ {
+ }
+
+ public SoapHeaderException (string message, XmlQualifiedName code, string actor)
+ : base (message, code, actor)
+ {
+ }
+
+ public SoapHeaderException (string message, XmlQualifiedName code, string actor, Exception innerException)
+ : base (message, code, actor, innerException)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
new file mode 100644
index 00000000000..2b17b469e70
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
@@ -0,0 +1,58 @@
+//
+// System.Web.Services.Protocols.SoapHttpClientProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Net;
+using System.Web;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class SoapHttpClientProtocol : HttpWebClientProtocol {
+
+ #region Constructors
+
+ public SoapHttpClientProtocol ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ protected IAsyncResult BeginInvoke (string methodName, object[] parameters, AsyncCallback callback, object asyncState)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Discover ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected object[] EndInvoke (IAsyncResult asyncResult)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override WebRequest GetWebRequest (Uri uri)
+ {
+ return WebRequest.Create (uri);
+ }
+
+ [MonoTODO]
+ protected object[] Invoke (string methodName, object[] parameters)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs
new file mode 100644
index 00000000000..8dea7f5140a
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs
@@ -0,0 +1,106 @@
+//
+// System.Web.Services.Protocols.SoapMessage.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class SoapMessage {
+
+ #region Fields
+
+ string contentType = "text/xml";
+ SoapException exception = null;
+ SoapHeaderCollection headers = null;
+ SoapMessageStage stage;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal SoapMessage ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract string Action {
+ get;
+ }
+
+ public string ContentType {
+ get { return contentType; }
+ set { contentType = value; }
+ }
+
+ public SoapException Exception {
+ get { return exception; }
+ }
+
+ public SoapHeaderCollection Headers {
+ get { return headers; }
+ }
+
+ public abstract LogicalMethodInfo MethodInfo {
+ get;
+ }
+
+ public abstract bool OneWay {
+ get;
+ }
+
+ public SoapMessageStage Stage {
+ get { return stage; }
+ }
+
+ public Stream Stream {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public abstract string Url {
+ get;
+ }
+
+ #endregion Properties
+
+ #region Methods
+
+ protected abstract void EnsureInStage ();
+ protected abstract void EnsureOutStage ();
+
+ protected void EnsureStage (SoapMessageStage stage)
+ {
+ if ((((int) stage) & ((int) Stage)) == 0)
+ throw new InvalidOperationException ("The current SoapMessageStage is not the asserted stage or stages.");
+ }
+
+ [MonoTODO]
+ public object GetInParameterValue (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetOutParameterValue (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetReturnValue ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessageStage.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessageStage.cs
new file mode 100644
index 00000000000..c4c4b1c3433
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessageStage.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.Services.Protocols.SoapMessageStage.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [Serializable]
+ public enum SoapMessageStage {
+ AfterDeserialize = 0x8,
+ AfterSerialize = 0x2,
+ BeforeDeserialize = 0x4,
+ BeforeSerialize = 0x1
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapParameterStyle.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapParameterStyle.cs
new file mode 100644
index 00000000000..e03ced756e9
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapParameterStyle.cs
@@ -0,0 +1,17 @@
+//
+// System.Web.Services.Protocols.SoapParameterStyle.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [Serializable]
+ public enum SoapParameterStyle {
+ Default = 0x0,
+ Bare = 0x1,
+ Wrapped = 0x2
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs
new file mode 100644
index 00000000000..9e375d1c9f4
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.Services.Protocols.SoapRpcMethodAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class SoapRpcMethodAttribute : Attribute {
+
+ #region Fields
+
+ string action;
+ string binding;
+ bool oneWay;
+ string requestElementName;
+ string requestNamespace;
+ string responseElementName;
+ string responseNamespace;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapRpcMethodAttribute ()
+ {
+ action = "http://tempuri.org/MethodName"; // FIXME
+ binding = ""; // FIXME
+ oneWay = false;
+ requestElementName = ""; // FIXME
+ requestNamespace = "http://tempuri.org/";
+ responseElementName = "WebServiceNameResult"; // FIXME
+ responseNamespace = "http://tempuri.org/";
+ }
+
+ public SoapRpcMethodAttribute (string action)
+ : this ()
+ {
+ this.action = action;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Action {
+ get { return action; }
+ set { action = value; }
+ }
+
+ public string Binding {
+ get { return binding; }
+ set { binding = value; }
+ }
+
+ public bool OneWay {
+ get { return oneWay; }
+ set { oneWay = value; }
+ }
+
+ public string RequestElementName {
+ get { return requestElementName; }
+ set { requestElementName = value; }
+ }
+
+ public string RequestNamespace {
+ get { return requestNamespace; }
+ set { requestNamespace = value; }
+ }
+
+ public string ResponseElementName {
+ get { return responseElementName; }
+ set { responseElementName = value; }
+ }
+
+ public string ResponseNamespace {
+ get { return responseNamespace; }
+ set { responseNamespace = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcServiceAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcServiceAttribute.cs
new file mode 100644
index 00000000000..aa475f5e1d3
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcServiceAttribute.cs
@@ -0,0 +1,38 @@
+//
+// System.Web.Services.Protocols.SoapRpcServiceAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class SoapRpcServiceAttribute : Attribute {
+
+ #region Fields
+
+ SoapServiceRoutingStyle routingStyle;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapRpcServiceAttribute ()
+ {
+ routingStyle = SoapServiceRoutingStyle.SoapAction;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public SoapServiceRoutingStyle RoutingStyle {
+ get { return routingStyle; }
+ set { routingStyle = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerMessage.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerMessage.cs
new file mode 100644
index 00000000000..c36f79802ee
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerMessage.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.Services.Protocols.SoapServerMessage.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public sealed class SoapServerMessage : SoapMessage {
+
+ #region Fields
+
+ string action;
+ LogicalMethodInfo methodInfo;
+ bool oneWay;
+ object server;
+ string url;
+ SoapServerProtocol protocol;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO ("Determine what this constructor does.")]
+ internal SoapServerMessage (SoapServerProtocol protocol)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string Action {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override LogicalMethodInfo MethodInfo {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool OneWay {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public object Server {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string Url {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected override void EnsureInStage ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void EnsureOutStage ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerProtocol.cs
new file mode 100644
index 00000000000..2e48fef7243
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServerProtocol.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.Services.Protocols.SoapServerProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ [MonoTODO ("Figure out what this class does.")]
+ internal class SoapServerProtocol : ServerProtocol {
+
+ #region Fields
+
+ bool isOneWay;
+
+ #endregion // Fields
+
+ #region Properties
+
+ public override bool IsOneWay {
+ get { return isOneWay; }
+ }
+
+ [MonoTODO]
+ public override LogicalMethodInfo MethodInfo {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Exception OnewayInitException {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override bool Initialize ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object[] ReadParameters ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool WriteException (Exception e, Stream outputStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteReturns (object[] returnValues, Stream outputStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServiceRoutingStyle.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServiceRoutingStyle.cs
new file mode 100644
index 00000000000..47a1762d1a6
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapServiceRoutingStyle.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.Services.Protocols.SoapServiceRoutingStyle.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services.Protocols {
+ [Serializable]
+ public enum SoapServiceRoutingStyle {
+ SoapAction = 0x0,
+ RequestElement = 0x1
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapUnknownHeader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapUnknownHeader.cs
new file mode 100644
index 00000000000..4b46412c1cf
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapUnknownHeader.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Services.Protocols.SoapUnknownHeader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Web.Services.Protocols {
+ public sealed class SoapUnknownHeader : SoapHeader {
+
+ #region Fields
+
+ XmlElement element;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SoapUnknownHeader ()
+ {
+ element = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [XmlIgnore]
+ public XmlElement Element {
+ get { return element; }
+ set { element = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/TextReturnReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/TextReturnReader.cs
new file mode 100644
index 00000000000..3c42b93ec3f
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/TextReturnReader.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Services.Protocols.TextReturnReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+
+namespace System.Web.Services.Protocols {
+ public class TextReturnReader : MimeReturnReader {
+
+ #region Constructors
+
+ public TextReturnReader ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object Read (WebResponse response, Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlEncodedParameterWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlEncodedParameterWriter.cs
new file mode 100644
index 00000000000..2f35bd155b3
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlEncodedParameterWriter.cs
@@ -0,0 +1,66 @@
+//
+// System.Web.Services.Protocols.UrlEncodedParameterWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Text;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class UrlEncodedParameterWriter : MimeParameterWriter {
+
+ #region Constructors
+
+ [MonoTODO]
+ protected UrlEncodedParameterWriter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override Encoding RequestEncoding {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ protected void Encode (TextWriter writer, object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void Encode (TextWriter writer, string name, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object initializer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterReader.cs
new file mode 100644
index 00000000000..09012b0a353
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterReader.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.Services.Protocols.UrlParameterReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class UrlParameterReader : ValueCollectionParameterReader {
+
+ #region Constructors
+
+ [MonoTODO]
+ public UrlParameterReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object[] Read (HttpRequest request)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterWriter.cs
new file mode 100644
index 00000000000..a5575c97b48
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/UrlParameterWriter.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.Services.Protocols.UrlParameterWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class UrlParameterWriter : UrlEncodedParameterWriter {
+
+ #region Constructors
+
+ [MonoTODO]
+ public UrlParameterWriter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override string GetRequestUrl (string url, object[] parameters)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs
new file mode 100644
index 00000000000..e01e11f01b0
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs
@@ -0,0 +1,61 @@
+//
+// System.Web.Services.Protocols.ValueCollectionParameterReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections.Specialized;
+using System.Reflection;
+using System.Web;
+
+namespace System.Web.Services.Protocols {
+ public abstract class ValueCollectionParameterReader : MimeParameterReader {
+
+ #region Constructors
+
+ [MonoTODO]
+ protected ValueCollectionParameterReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsSupported (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsSupported (ParameterInfo paramInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected object[] Read (NameValueCollection collection)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs
new file mode 100644
index 00000000000..0102fb93ce5
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientAsyncResult.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.Services.Protocols.WebClientAsyncResult.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Net;
+using System.Threading;
+
+namespace System.Web.Services.Protocols {
+ public class WebClientAsyncResult : IAsyncResult {
+
+ #region Fields
+
+ WaitHandle waitHandle;
+
+ WebClientProtocol protocol;
+ WebRequest request;
+ AsyncCallback callback;
+ object asyncState;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO ("Figure out what this does.")]
+ internal WebClientAsyncResult (WebClientProtocol protocol, object x, WebRequest request, AsyncCallback callback, object asyncState, int y)
+ {
+ this.protocol = protocol;
+ this.request = request;
+ this.callback = callback;
+ this.asyncState = asyncState;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public object AsyncState {
+ get { return asyncState; }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ get { return waitHandle; }
+ }
+
+ public bool CompletedSynchronously {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsCompleted {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Abort ()
+ {
+ request.Abort ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientProtocol.cs
new file mode 100644
index 00000000000..6a861ee790c
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientProtocol.cs
@@ -0,0 +1,140 @@
+//
+// System.Web.Services.Protocols.WebClientProtocol.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Net;
+using System.Text;
+using System.Threading;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public abstract class WebClientProtocol : Component {
+
+ #region Fields
+
+ string connectionGroupName;
+ ICredentials credentials;
+ bool preAuthenticate;
+ Encoding requestEncoding;
+ int timeout;
+ string url;
+ bool abort;
+ static HybridDictionary cache;
+
+ #endregion
+
+ #region Constructors
+
+ static WebClientProtocol ()
+ {
+ cache = new HybridDictionary ();
+ }
+
+ protected WebClientProtocol ()
+ {
+ connectionGroupName = String.Empty;
+ credentials = null;
+ preAuthenticate = false;
+ requestEncoding = null;
+ timeout = 100000;
+ url = String.Empty;
+ abort = false;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [DefaultValue ("")]
+ public string ConnectionGroupName {
+ get { return connectionGroupName; }
+ set { connectionGroupName = value; }
+ }
+
+ public ICredentials Credentials {
+ get { return credentials; }
+ set { credentials = value; }
+ }
+
+ [DefaultValue (false)]
+ [WebServicesDescription ("Enables pre authentication of the request.")]
+ public bool PreAuthenticate {
+ get { return preAuthenticate; }
+ set { preAuthenticate = value; }
+ }
+
+ [DefaultValue ("")]
+ [RecommendedAsConfigurable (true)]
+ [WebServicesDescription ("The encoding to use for requests.")]
+ public Encoding RequestEncoding {
+ get { return requestEncoding; }
+ set { requestEncoding = value; }
+ }
+
+ [DefaultValue (100000)]
+ [RecommendedAsConfigurable (true)]
+ [WebServicesDescription ("Sets the timeout in milliseconds to be used for synchronous calls. The default of -1 means infinite.")]
+ public int Timeout {
+ get { return timeout; }
+ set { timeout = value; }
+ }
+
+ [DefaultValue ("")]
+ [RecommendedAsConfigurable (true)]
+ [WebServicesDescription ("The base URL to the server to use for requests.")]
+ public string Url {
+ get { return url; }
+ set { url = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public virtual void Abort ()
+ {
+ abort = true;
+ }
+
+ protected static void AddToCache (Type type, object value)
+ {
+ cache [type] = value;
+ }
+
+ protected static object GetFromCache (Type type)
+ {
+ return cache [type];
+ }
+
+ protected virtual WebRequest GetWebRequest (Uri uri)
+ {
+ return WebRequest.Create (uri);
+ }
+
+ protected virtual WebResponse GetWebResponse (WebRequest request)
+ {
+ if (abort)
+ throw new WebException ("The operation has been aborted.", WebExceptionStatus.RequestCanceled);
+ return request.GetResponse ();
+ }
+
+ protected virtual WebResponse GetWebResponse (WebRequest request, IAsyncResult result)
+ {
+ if (abort)
+ throw new WebException ("The operation has been aborted.", WebExceptionStatus.RequestCanceled);
+
+ IAsyncResult ar = request.BeginGetResponse (null, null);
+ ar.AsyncWaitHandle.WaitOne ();
+ return request.EndGetResponse (result);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs
new file mode 100644
index 00000000000..43357a41155
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.Services.Protocols.WebServiceHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ internal class WebServiceHandler {
+
+ #region Fields
+
+ ServerProtocol protocol;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public WebServiceHandler (ServerProtocol protocol)
+ {
+ this.protocol = protocol;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ protected IAsyncResult BeginCoreProcessRequest (AsyncCallback callback, object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void CoreProcessRequest ()
+ {
+ Invoke ();
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void EndCoreProcessRequest (IAsyncResult result)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ private void Invoke ()
+ {
+ //WriteReturns (returnValues);
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ private void WriteReturns (object[] returnValues)
+ {
+ //protocol.WriteReturns (returnValues, outputStream);
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs
new file mode 100644
index 00000000000..9e77e56dcc3
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs
@@ -0,0 +1,41 @@
+//
+// System.Web.Services.Protocols.WebServiceHandlerFactory.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class WebServiceHandlerFactory : IHttpHandlerFactory {
+
+ #region Constructors
+
+ [MonoTODO]
+ public WebServiceHandlerFactory ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public IHttpHandler GetHandler (HttpContext context, string verb, string url, string filePath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ReleaseHandler (IHttpHandler handler)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs
new file mode 100644
index 00000000000..adf27eafa98
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Services.Protocols.XmlReturnReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Net;
+using System.Web.Services;
+
+namespace System.Web.Services.Protocols {
+ public class XmlReturnReader : MimeReturnReader {
+
+ #region Constructors
+
+ public XmlReturnReader ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object[] GetInitializers (LogicalMethodInfo[] methodInfos)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object Read (WebResponse response, Stream responseStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs
new file mode 100644
index 00000000000..35cb22b16cd
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.Services.Protocols.XmlReturnWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Web;
+
+namespace System.Web.Services.Protocols {
+ internal class XmlReturnWriter : MimeReturnWriter {
+
+ #region Methods
+
+ [MonoTODO]
+ public override object GetInitializer (LogicalMethodInfo methodInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object[] GetInitializers (LogicalMethodInfo[] methodInfos)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Initialize (object initializer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Write (HttpResponse response, Stream outputStream, object returnValue)
+ {
+ //serializer.Serialize (textWriter, o)
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.build b/mcs/class/System.Web.Services/System.Web.Services.build
new file mode 100644
index 00000000000..f6d40dbc008
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services.build
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Web.Services.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Web.Services.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/debug"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.EnterpriseServices.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <arg value="/r:System.Web.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.Web.Services.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Web.Services/System.Web.Services/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services/ChangeLog
new file mode 100644
index 00000000000..d4b9db79fc3
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/ChangeLog
@@ -0,0 +1,67 @@
+2002-08-19 Tim Coleman <tim@timcoleman.com>
+ * WebService.cs:
+ Change the attribute on Application to Description
+ instead of WebServicesDescription.2002-08-19 Tim Coleman
+
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * WebServicesDescriptionAttribute:
+ Added Description property. Should've known I spoke
+ too soon about being complete. :-)
+
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * WebMethodAttribute.cs:
+ Remove FIXME and reorganize constructors to all
+ call this () with the big constructor.
+ * WebServiceAttribute.cs:
+ Remove FIXME.
+ * WebServiceBindingAttribute.cs:
+ Remove FIXME, and change ns to be String.Empty by
+ default (this is the MS implementation). Reorganize
+ constructors.
+ * WebServicesDescriptionAttribute.cs:
+ Code reformat.
+ * TODOAttribute.cs:
+ Changed namespace.
+
+ *** This namespace should now be complete. ***
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * WebService.cs:
+ Change Description to WebServicesDescription
+ * WebServicesDescriptionAttribute.cs:
+ Add back constructor as MS build doesn't
+ seem to like it missing. Now calls base()
+ with the string. Also remove the sealed
+ modifier and change the attribute targets.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * WebServicesDescriptionAttribute.cs:
+ Removed the "guts" because they are defined in
+ System.ComponentModel.DescriptionAttribute.
+ * WebService.cs:
+ Added attributes which were missing based on the
+ class status page. Also added an HttpApplication
+ object and modified the properties to use that
+ object.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * WebServicesDescriptionAttribute.cs:
+ Added for build in System.Web.Services.Protocols
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * WebMethodAttribute.cs:
+ Remove comments around TransactionOption bits
+ because I added that enum.
+ * WebServiceAttribute.cs:
+ * WebServiceBindingAttribute.cs:
+ Added "sealed" to protection level, which I missed
+ before.
+
+2002-07-19 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog:
+ * TODOAttribute.cs:
+ * WebMethodAttribute.cs:
+ * WebService.cs:
+ * WebServiceAttribute.cs:
+ * WebServiceBindingAttribute.cs:
+ Initial implementation
diff --git a/mcs/class/System.Web.Services/System.Web.Services/TODOAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services/TODOAttribute.cs
new file mode 100644
index 00000000000..88348c96610
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Web.Services {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebMethodAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services/WebMethodAttribute.cs
new file mode 100644
index 00000000000..c216715dcec
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/WebMethodAttribute.cs
@@ -0,0 +1,96 @@
+ //
+// System.Web.Services.WebMethodAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.EnterpriseServices;
+
+namespace System.Web.Services {
+ [AttributeUsage(AttributeTargets.Method)]
+ public sealed class WebMethodAttribute : Attribute {
+
+ #region Fields
+
+ bool bufferResponse;
+ int cacheDuration;
+ string description;
+ bool enableSession;
+ string messageName;
+ TransactionOption transactionOption;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public WebMethodAttribute ()
+ : this (false, TransactionOption.Disabled, 0, true)
+ {
+ }
+
+ public WebMethodAttribute (bool enableSession)
+ : this (enableSession, TransactionOption.Disabled, 0, true)
+ {
+ }
+
+ public WebMethodAttribute (bool enableSession, TransactionOption transactionOption)
+ : this (enableSession, transactionOption, 0, true)
+ {
+ }
+
+ public WebMethodAttribute (bool enableSession, TransactionOption transactionOption, int cacheDuration)
+ : this (enableSession, transactionOption, cacheDuration, true)
+ {
+ }
+
+ public WebMethodAttribute (bool enableSession, TransactionOption transactionOption, int cacheDuration, bool bufferResponse)
+ {
+ this.bufferResponse = bufferResponse;
+ this.cacheDuration = cacheDuration;
+ this.enableSession = enableSession;
+ this.transactionOption = transactionOption;
+
+ this.description = String.Empty;
+ this.messageName = String.Empty;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool BufferResponse {
+ get { return bufferResponse; }
+ set { bufferResponse = value; }
+ }
+
+ public int CacheDuration {
+ get { return cacheDuration; }
+ set { cacheDuration = value; }
+ }
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public bool EnableSession {
+ get { return enableSession; }
+ set { enableSession = value; }
+ }
+
+ public string MessageName {
+ get { return messageName; }
+ set { messageName = value; }
+ }
+
+ public TransactionOption TransactionOption {
+ get { return transactionOption; }
+ set { transactionOption = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebService.cs b/mcs/class/System.Web.Services/System.Web.Services/WebService.cs
new file mode 100644
index 00000000000..bd2c5598d63
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/WebService.cs
@@ -0,0 +1,72 @@
+ //
+// System.Web.Services.WebService.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+using System.Security.Principal;
+using System.Web;
+using System.Web.SessionState;
+
+namespace System.Web.Services {
+ public class WebService : MarshalByValueComponent {
+
+ #region Fields
+
+ HttpApplication application;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public WebService ()
+ {
+ application = new HttpApplication ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ [Browsable (false)]
+ [Description ("The ASP.NET application object for the current request.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpApplicationState Application {
+ get { return application.Application; }
+ }
+
+ [Browsable (false)]
+ [WebServicesDescription ("The ASP.NET context object for the current request.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpContext Context {
+ get { return application.Context; }
+ }
+
+ [Browsable (false)]
+ [WebServicesDescription ("The ASP.NET utility object for the current request.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpServerUtility Server {
+ get { return application.Server; }
+ }
+
+ [Browsable (false)]
+ [WebServicesDescription ("The ASP.NET session object for the current request.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpSessionState Session {
+ get { return application.Session; }
+ }
+
+ [Browsable (false)]
+ [WebServicesDescription ("The ASP.NET user object for the current request. The object is used for authorization.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public IPrincipal User {
+ get { return application.User; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebServiceAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services/WebServiceAttribute.cs
new file mode 100644
index 00000000000..eb50b0c6116
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/WebServiceAttribute.cs
@@ -0,0 +1,54 @@
+ //
+// System.Web.Services.WebServiceAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class WebServiceAttribute : Attribute {
+
+ #region Fields
+
+ public const string DefaultNamespace = "http://tempuri.org/";
+ string description;
+ string name;
+ string ns;
+
+ #endregion // Fields
+
+ #region Constructors
+
+
+ public WebServiceAttribute ()
+ {
+ description = String.Empty;
+ name = String.Empty;
+ ns = DefaultNamespace;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebServiceBindingAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services/WebServiceBindingAttribute.cs
new file mode 100644
index 00000000000..6ea242eb3de
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/WebServiceBindingAttribute.cs
@@ -0,0 +1,67 @@
+ //
+// System.Web.Services.WebServiceBindingAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web.Services {
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class WebServiceBindingAttribute : Attribute {
+
+ #region Fields
+
+ string location;
+ string name;
+ string ns;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public WebServiceBindingAttribute ()
+ : this (String.Empty, String.Empty, String.Empty)
+ {
+ }
+
+ public WebServiceBindingAttribute (string name)
+ : this (name, String.Empty, String.Empty)
+ {
+ }
+
+ public WebServiceBindingAttribute (string name, string ns)
+ : this (name, ns, String.Empty)
+ {
+ }
+
+ public WebServiceBindingAttribute (string name, string ns, string location)
+ {
+ this.name = name;
+ this.ns = ns;
+ this.location = location;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebServicesDescriptionAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services/WebServicesDescriptionAttribute.cs
new file mode 100644
index 00000000000..84905edc486
--- /dev/null
+++ b/mcs/class/System.Web.Services/System.Web.Services/WebServicesDescriptionAttribute.cs
@@ -0,0 +1,33 @@
+//
+// System.Web.Services.WebServicesDescriptionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.ComponentModel;
+
+namespace System.Web.Services {
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ internal class WebServicesDescriptionAttribute : DescriptionAttribute {
+
+ #region Constructors
+
+ public WebServicesDescriptionAttribute (string description)
+ : base (description)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string Description {
+ get { return DescriptionValue; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/.cvsignore b/mcs/class/System.Web.Services/Test/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/System.Web.Services/Test/AllTests.cs b/mcs/class/System.Web.Services/Test/AllTests.cs
new file mode 100644
index 00000000000..9a3c8081da6
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/AllTests.cs
@@ -0,0 +1,24 @@
+// MonoTests.AllTests, System.Web.Services.dll
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using NUnit.Framework;
+
+namespace MonoTests {
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (System.Web.Services.AllTests.Suite);
+ suite.AddTest (System.Web.Services.Configuration.AllTests.Suite);
+ suite.AddTest (System.Web.Services.Discovery.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/ChangeLog b/mcs/class/System.Web.Services/Test/ChangeLog
new file mode 100644
index 00000000000..b4524c71d10
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/ChangeLog
@@ -0,0 +1,10 @@
+2002-08-09 Tim Coleman <tim@timcoleman.com>
+ * AllTests.cs:
+ New test suites added.
+
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * AllTests.cs:
+ * ChangeLog:
+ * System.Web.Services:
+ * System.Web.Services_test.build:
+ New files and directories added for test suite.
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/AllTests.cs b/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/AllTests.cs
new file mode 100644
index 00000000000..f3446f66ed1
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/AllTests.cs
@@ -0,0 +1,22 @@
+// MonoTests.System.Web.Services.Configuration.AllTests, System.Web.Services.dll
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.Services.Configuration {
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (XmlFormatExtensionAttributeTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/ChangeLog b/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/ChangeLog
new file mode 100644
index 00000000000..d5a0ded96ed
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/ChangeLog
@@ -0,0 +1,5 @@
+2002-08-09 Tim Coleman <tim@timcoleman.com>
+ * AllTests.cs:
+ * ChangeLog:
+ * XmlFormatExtensionAttributeTest.cs:
+ New files added for test suite.
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs b/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
new file mode 100644
index 00000000000..f0abcb24ad5
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
@@ -0,0 +1,80 @@
+//
+// MonoTests.System.Web.Services.Configuration.XmlFormatExtensionAttributeTest.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Web.Services.Configuration;
+using System.Web.Services.Description;
+
+namespace MonoTests.System.Web.Services.Configuration {
+
+ public class XmlFormatExtensionAttributeTest : TestCase {
+
+ public XmlFormatExtensionAttributeTest () :
+ base ("[MonoTests.System.Web.Services.Configuration.XmlFormatExtensionAttributeTest]")
+ {
+ }
+
+ public XmlFormatExtensionAttributeTest (string name) :
+ base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite {
+ get { return new TestSuite (typeof (XmlFormatExtensionAttributeTest)); }
+ }
+
+ public void TestConstructors ()
+ {
+ XmlFormatExtensionAttribute attribute;
+
+ attribute = new XmlFormatExtensionAttribute ();
+ AssertEquals (String.Empty, attribute.ElementName);
+ AssertEquals (null, attribute.ExtensionPoints);
+ AssertEquals (String.Empty, attribute.Namespace);
+
+ string elementName = "binding";
+ string ns = "http://schemas.xmlsoap.org/wsdl/http/";
+ Type[] types = new Type[4] {typeof (Binding), typeof (Binding), typeof (Binding), typeof (Binding)};
+
+ attribute = new XmlFormatExtensionAttribute (elementName, ns, types[0]);
+ AssertEquals (elementName, attribute.ElementName);
+ AssertEquals (new Type[1] {types[0]}, attribute.ExtensionPoints);
+ AssertEquals (ns, attribute.Namespace);
+
+ attribute = new XmlFormatExtensionAttribute (elementName, ns, types[0], types[1]);
+ AssertEquals (elementName, attribute.ElementName);
+ AssertEquals (new Type[2] {types[0], types[1]}, attribute.ExtensionPoints);
+ AssertEquals (ns, attribute.Namespace);
+
+ attribute = new XmlFormatExtensionAttribute (elementName, ns, types[0], types[1], types[2]);
+ AssertEquals (elementName, attribute.ElementName);
+ AssertEquals (new Type[3] {types[0], types[1], types[2]}, attribute.ExtensionPoints);
+ AssertEquals (ns, attribute.Namespace);
+
+ attribute = new XmlFormatExtensionAttribute (elementName, ns, types[0], types[1], types[2], types[3]);
+ AssertEquals (elementName, attribute.ElementName);
+ AssertEquals (new Type[4] {types[0], types[1], types[2], types[3]}, attribute.ExtensionPoints);
+ AssertEquals (ns, attribute.Namespace);
+
+ attribute = new XmlFormatExtensionAttribute (elementName, ns, types);
+ AssertEquals (elementName, attribute.ElementName);
+ AssertEquals (types, attribute.ExtensionPoints);
+ AssertEquals (ns, attribute.Namespace);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/AllTests.cs b/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/AllTests.cs
new file mode 100644
index 00000000000..40f2594a838
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/AllTests.cs
@@ -0,0 +1,22 @@
+// MonoTests.System.Web.Services.Discovery.AllTests, System.Web.Services.dll
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.Services.Discovery {
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (ContractReferenceTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ChangeLog b/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ChangeLog
new file mode 100644
index 00000000000..2f04b932891
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ChangeLog
@@ -0,0 +1,5 @@
+2002-08-09 Tim Coleman <tim@timcoleman.com>
+ * AllTests.cs:
+ * ChangeLog:
+ * ContractReferenceTest.cs:
+ New files added for test suite.
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ContractReferenceTest.cs b/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ContractReferenceTest.cs
new file mode 100644
index 00000000000..b45b89f7578
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Discovery/ContractReferenceTest.cs
@@ -0,0 +1,55 @@
+//
+// MonoTests.System.Web.Services.Discovery.ContractReferenceTest.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Web.Services.Discovery;
+
+namespace MonoTests.System.Web.Services.Discovery {
+
+ public class ContractReferenceTest : TestCase {
+
+ public ContractReferenceTest () :
+ base ("[MonoTests.System.Web.Services.Discovery.ContractReferenceTest]")
+ {
+ }
+
+ public ContractReferenceTest (string name) :
+ base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite {
+ get { return new TestSuite (typeof (ContractReferenceTest)); }
+ }
+
+ public void TestConstructors ()
+ {
+ ContractReference contractReference;
+
+ contractReference = new ContractReference ();
+ AssertEquals (String.Empty, contractReference.DocRef);
+ AssertEquals (String.Empty, contractReference.Ref);
+ AssertEquals (String.Empty, contractReference.Url);
+ }
+
+ public void TestConstants ()
+ {
+ AssertEquals ("http://schemas.xmlsoap.org/disco/scl/", ContractReference.Namespace);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services/AllTests.cs b/mcs/class/System.Web.Services/Test/System.Web.Services/AllTests.cs
new file mode 100644
index 00000000000..625b6e62818
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services/AllTests.cs
@@ -0,0 +1,23 @@
+// MonoTests.System.Web.Services.AllTests, System.Web.Services.dll
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.Services {
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (WebMethodAttributeTest.Suite);
+ suite.AddTest (WebServiceAttributeTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services/ChangeLog b/mcs/class/System.Web.Services/Test/System.Web.Services/ChangeLog
new file mode 100644
index 00000000000..17f6b9b74fd
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services/ChangeLog
@@ -0,0 +1,6 @@
+2002-08-07 Tim Coleman <tim@timcoleman.com>
+ * AllTests.cs:
+ * ChangeLog:
+ * WebMethodAttributeTest.cs:
+ * WebServiceAttributeTest.cs:
+ New files and directories added for test suite.
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services/WebMethodAttributeTest.cs b/mcs/class/System.Web.Services/Test/System.Web.Services/WebMethodAttributeTest.cs
new file mode 100644
index 00000000000..ad9dddad912
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services/WebMethodAttributeTest.cs
@@ -0,0 +1,54 @@
+//
+// MonoTests.System.Web.Services.WebMethodAttributeTest.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Web.Services;
+using System.EnterpriseServices;
+
+namespace MonoTests.System.Web.Services {
+
+ public class WebMethodAttributeTest : TestCase {
+
+ public WebMethodAttributeTest () :
+ base ("[MonoTests.System.Web.Services.WebMethodAttributeTest]")
+ {
+ }
+
+ public WebMethodAttributeTest (string name) :
+ base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite {
+ get { return new TestSuite (typeof (WebMethodAttributeTest)); }
+ }
+
+ public void TestConstructors ()
+ {
+ WebMethodAttribute attribute;
+
+ attribute = new WebMethodAttribute ();
+ AssertEquals (true, attribute.BufferResponse);
+ AssertEquals (0, attribute.CacheDuration);
+ AssertEquals (String.Empty, attribute.Description);
+ AssertEquals (false, attribute.EnableSession);
+ AssertEquals (String.Empty, attribute.MessageName);
+ AssertEquals (TransactionOption.Disabled, attribute.TransactionOption);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services/WebServiceAttributeTest.cs b/mcs/class/System.Web.Services/Test/System.Web.Services/WebServiceAttributeTest.cs
new file mode 100644
index 00000000000..6979fae6214
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services/WebServiceAttributeTest.cs
@@ -0,0 +1,50 @@
+//
+// MonoTests.System.Web.Services.WebServiceAttributeTest.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using NUnit.Framework;
+using System;
+using System.Web.Services;
+
+namespace MonoTests.System.Web.Services {
+
+ public class WebServiceAttributeTest : TestCase {
+
+ public WebServiceAttributeTest () :
+ base ("[MonoTests.System.Web.Services.WebServiceAttributeTest]")
+ {
+ }
+
+ public WebServiceAttributeTest (string name) :
+ base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite {
+ get { return new TestSuite (typeof (WebServiceAttributeTest)); }
+ }
+
+ public void TestConstructors ()
+ {
+ WebServiceAttribute attribute;
+
+ attribute = new WebServiceAttribute ();
+ AssertEquals (String.Empty, attribute.Description);
+ AssertEquals (String.Empty, attribute.Name);
+ AssertEquals ("http://tempuri.org/", attribute.Namespace);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services_test.build b/mcs/class/System.Web.Services/Test/System.Web.Services_test.build
new file mode 100644
index 00000000000..caffa2b496d
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services_test.build
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Web.Services_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System.Web.Services_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System.Web.Services_test.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/r:..\..\lib\System.Web.Services.dll"/>
+ </csc>
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.System.Web.Services.AllTests,System.Web.Services_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System.Web.Services.dll" failonerror="false"/>
+ <delete file="System.Web.Services_test.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Web.Services/list b/mcs/class/System.Web.Services/list
new file mode 100644
index 00000000000..5371d9fc94c
--- /dev/null
+++ b/mcs/class/System.Web.Services/list
@@ -0,0 +1,153 @@
+System.Web.Services/TODOAttribute.cs
+System.Web.Services/WebMethodAttribute.cs
+System.Web.Services/WebService.cs
+System.Web.Services/WebServiceAttribute.cs
+System.Web.Services/WebServiceBindingAttribute.cs
+System.Web.Services/WebServicesDescriptionAttribute.cs
+System.Web.Services.Configuration/XmlFormatExtensionAttribute.cs
+System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs
+System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
+System.Web.Services.Description/Binding.cs
+System.Web.Services.Description/BindingCollection.cs
+System.Web.Services.Description/DocumentableItem.cs
+System.Web.Services.Description/FaultBinding.cs
+System.Web.Services.Description/FaultBindingCollection.cs
+System.Web.Services.Description/HttpAddressBinding.cs
+System.Web.Services.Description/HttpBinding.cs
+System.Web.Services.Description/HttpOperationBinding.cs
+System.Web.Services.Description/HttpUrlEncodedBinding.cs
+System.Web.Services.Description/HttpUrlReplacementBinding.cs
+System.Web.Services.Description/Import.cs
+System.Web.Services.Description/ImportCollection.cs
+System.Web.Services.Description/InputBinding.cs
+System.Web.Services.Description/Message.cs
+System.Web.Services.Description/MessageBinding.cs
+System.Web.Services.Description/MessageCollection.cs
+System.Web.Services.Description/MessagePart.cs
+System.Web.Services.Description/MessagePartCollection.cs
+System.Web.Services.Description/MimeContentBinding.cs
+System.Web.Services.Description/MimeMultipartRelatedBinding.cs
+System.Web.Services.Description/MimePart.cs
+System.Web.Services.Description/MimePartCollection.cs
+System.Web.Services.Description/MimeTextBinding.cs
+System.Web.Services.Description/MimeTextMatch.cs
+System.Web.Services.Description/MimeTextMatchCollection.cs
+System.Web.Services.Description/MimeXmlBinding.cs
+System.Web.Services.Description/Operation.cs
+System.Web.Services.Description/OperationBinding.cs
+System.Web.Services.Description/OperationBindingCollection.cs
+System.Web.Services.Description/OperationCollection.cs
+System.Web.Services.Description/OperationFault.cs
+System.Web.Services.Description/OperationFaultCollection.cs
+System.Web.Services.Description/OperationFlow.cs
+System.Web.Services.Description/OperationInput.cs
+System.Web.Services.Description/OperationMessage.cs
+System.Web.Services.Description/OperationMessageCollection.cs
+System.Web.Services.Description/OperationOutput.cs
+System.Web.Services.Description/OutputBinding.cs
+System.Web.Services.Description/Port.cs
+System.Web.Services.Description/PortCollection.cs
+System.Web.Services.Description/PortType.cs
+System.Web.Services.Description/PortTypeCollection.cs
+System.Web.Services.Description/ProtocolImporter.cs
+System.Web.Services.Description/ProtocolReflector.cs
+System.Web.Services.Description/Service.cs
+System.Web.Services.Description/ServiceCollection.cs
+System.Web.Services.Description/ServiceDescription.cs
+System.Web.Services.Description/ServiceDescriptionBaseCollection.cs
+System.Web.Services.Description/ServiceDescriptionCollection.cs
+System.Web.Services.Description/ServiceDescriptionFormatExtension.cs
+System.Web.Services.Description/ServiceDescriptionFormatExtensionCollection.cs
+System.Web.Services.Description/ServiceDescriptionImportStyle.cs
+System.Web.Services.Description/ServiceDescriptionImportWarnings.cs
+System.Web.Services.Description/ServiceDescriptionImporter.cs
+System.Web.Services.Description/ServiceDescriptionReflector.cs
+System.Web.Services.Description/SoapAddressBinding.cs
+System.Web.Services.Description/SoapBinding.cs
+System.Web.Services.Description/SoapBindingStyle.cs
+System.Web.Services.Description/SoapBindingUse.cs
+System.Web.Services.Description/SoapBodyBinding.cs
+System.Web.Services.Description/SoapExtensionImporter.cs
+System.Web.Services.Description/SoapExtensionReflector.cs
+System.Web.Services.Description/SoapFaultBinding.cs
+System.Web.Services.Description/SoapHeaderBinding.cs
+System.Web.Services.Description/SoapOperationBinding.cs
+System.Web.Services.Description/SoapHeaderFaultBinding.cs
+System.Web.Services.Description/SoapProtocolImporter.cs
+System.Web.Services.Description/SoapProtocolReflector.cs
+System.Web.Services.Description/SoapTransportImporter.cs
+System.Web.Services.Description/Types.cs
+System.Web.Services.Protocols/AnyReturnReader.cs
+System.Web.Services.Protocols/HtmlFormParameterReader.cs
+System.Web.Services.Protocols/HtmlFormParameterWriter.cs
+System.Web.Services.Protocols/HttpGetClientProtocol.cs
+System.Web.Services.Protocols/HttpMethodAttribute.cs
+System.Web.Services.Protocols/HttpPostClientProtocol.cs
+System.Web.Services.Protocols/HttpServerProtocol.cs
+System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
+System.Web.Services.Protocols/HttpWebClientProtocol.cs
+System.Web.Services.Protocols/LogicalMethodInfo.cs
+System.Web.Services.Protocols/LogicalMethodTypes.cs
+System.Web.Services.Protocols/MatchAttribute.cs
+System.Web.Services.Protocols/MimeFormatter.cs
+System.Web.Services.Protocols/MimeParameterReader.cs
+System.Web.Services.Protocols/MimeParameterWriter.cs
+System.Web.Services.Protocols/MimeReturnReader.cs
+System.Web.Services.Protocols/MimeReturnWriter.cs
+System.Web.Services.Protocols/NopReturnReader.cs
+System.Web.Services.Protocols/PatternMatcher.cs
+System.Web.Services.Protocols/ServerProtocol.cs
+System.Web.Services.Protocols/SoapClientMessage.cs
+System.Web.Services.Protocols/SoapClientMethod.cs
+System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs
+System.Web.Services.Protocols/SoapDocumentServiceAttribute.cs
+System.Web.Services.Protocols/SoapException.cs
+System.Web.Services.Protocols/SoapExtension.cs
+System.Web.Services.Protocols/SoapExtensionAttribute.cs
+System.Web.Services.Protocols/SoapHeader.cs
+System.Web.Services.Protocols/SoapHeaderAttribute.cs
+System.Web.Services.Protocols/SoapHeaderCollection.cs
+System.Web.Services.Protocols/SoapHeaderDirection.cs
+System.Web.Services.Protocols/SoapHeaderException.cs
+System.Web.Services.Protocols/SoapHttpClientProtocol.cs
+System.Web.Services.Protocols/SoapMessage.cs
+System.Web.Services.Protocols/SoapMessageStage.cs
+System.Web.Services.Protocols/SoapParameterStyle.cs
+System.Web.Services.Protocols/SoapRpcMethodAttribute.cs
+System.Web.Services.Protocols/SoapRpcServiceAttribute.cs
+System.Web.Services.Protocols/SoapServerMessage.cs
+System.Web.Services.Protocols/SoapServerProtocol.cs
+System.Web.Services.Protocols/SoapServiceRoutingStyle.cs
+System.Web.Services.Protocols/SoapUnknownHeader.cs
+System.Web.Services.Protocols/TextReturnReader.cs
+System.Web.Services.Protocols/UrlEncodedParameterWriter.cs
+System.Web.Services.Protocols/UrlParameterReader.cs
+System.Web.Services.Protocols/UrlParameterWriter.cs
+System.Web.Services.Protocols/ValueCollectionParameterReader.cs
+System.Web.Services.Protocols/WebClientAsyncResult.cs
+System.Web.Services.Protocols/WebClientProtocol.cs
+System.Web.Services.Protocols/WebServiceHandler.cs
+System.Web.Services.Protocols/WebServiceHandlerFactory.cs
+System.Web.Services.Protocols/XmlReturnReader.cs
+System.Web.Services.Protocols/XmlReturnWriter.cs
+System.Web.Services.Discovery/ContractReference.cs
+System.Web.Services.Discovery/ContractSearchPattern.cs
+System.Web.Services.Discovery/DiscoveryClientDocumentCollection.cs
+System.Web.Services.Discovery/DiscoveryClientProtocol.cs
+System.Web.Services.Discovery/DiscoveryClientReferenceCollection.cs
+System.Web.Services.Discovery/DiscoveryClientResultCollection.cs
+System.Web.Services.Discovery/DiscoveryClientResult.cs
+System.Web.Services.Discovery/DiscoveryDocument.cs
+System.Web.Services.Discovery/DiscoveryDocumentLinksPattern.cs
+System.Web.Services.Discovery/DiscoveryDocumentReference.cs
+System.Web.Services.Discovery/DiscoveryDocumentSearchPattern.cs
+System.Web.Services.Discovery/DiscoveryExceptionDictionary.cs
+System.Web.Services.Discovery/DiscoveryReferenceCollection.cs
+System.Web.Services.Discovery/DiscoveryReference.cs
+System.Web.Services.Discovery/DiscoveryRequestHandler.cs
+System.Web.Services.Discovery/DiscoverySearchPattern.cs
+System.Web.Services.Discovery/DynamicDiscoveryDocument.cs
+System.Web.Services.Discovery/ExcludePathInfo.cs
+System.Web.Services.Discovery/SchemaReference.cs
+System.Web.Services.Discovery/SoapBinding.cs
+System.Web.Services.Discovery/XmlSchemaSearchPattern.cs
diff --git a/mcs/class/System.Web.Services/makefile.gnu b/mcs/class/System.Web.Services/makefile.gnu
new file mode 100644
index 00000000000..bd938f6a722
--- /dev/null
+++ b/mcs/class/System.Web.Services/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.Web.Services.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System.Xml -r System.EnterpriseServices -r System.Web -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Web/.cvsignore b/mcs/class/System.Web/.cvsignore
new file mode 100644
index 00000000000..9a1d05f6953
--- /dev/null
+++ b/mcs/class/System.Web/.cvsignore
@@ -0,0 +1,7 @@
+Temp.build
+*.dll
+lib
+makefile
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Web/ChangeLog b/mcs/class/System.Web/ChangeLog
new file mode 100644
index 00000000000..e36cf5f3244
--- /dev/null
+++ b/mcs/class/System.Web/ChangeLog
@@ -0,0 +1,193 @@
+2002-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new file.
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added/removed files.
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * makefile.gnu: s/MONO_PATH_PREFIX/MONO_PATH/
+
+2002-10-28 Duncan Mak <duncan@ximian.com>
+
+ * list: added DataGridLinkButton.cs.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added WebEncoding.cs
+
+2002-10-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * makefile.trace: used to build System.Web.dll with trace enabled.
+ * System.Web.build: added trace and clean targets.
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.build: added options (commented out) to activate tracing.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new file in System.Web.Handlers.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files in System.Web.Configuration.
+
+2002-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files in System.Web.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added PageHandlerFactory.
+
+2002-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added 2 new files (DataGrid*Internal.cs).
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added new files in System.Web.Security
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added HorizontalAlignConverter and VerticalAlignConverter.
+
+2002-08-05 Patrik Torstensson <ptorsten@hotmail.com>
+ * list:
+ Add System.Web/ApplicationFactory.cs
+ Add System.Web/HttpAsyncResult.cs
+ Add System.Web.Configuration/GlobalizationConfiguration.cs
+ Add System.Web.Configuration/HandlerFactoryConfiguration.cs
+ Add System.Web.Configuration/HandlerFactoryProxy.cs
+ Add System.Web.Configuration/HandlerItem.cs
+ Add System.Web.Configuration/ModuleItem.cs
+ Add System.Web.Configuration/ModulesConfiguration.cs
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * list:
+ Add System.Web/ProcessInfo.cs
+ Add System.Web/HttpCompileException.cs
+ Add System.Web/HttpParseException.cs
+ Add System.Web/HttpUnhandledException.cs
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: added some more files from System.Web.Hosting.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.build: removed some more excludes.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: updated. Currently mcs cannot compile System.Web because it
+ cannot find NameObjectCollectionBase.KeysCollection.
+
+ * System.Web.build: don't display unused event nor always default value
+ warnings by now.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list: updated and reformatted.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.build: added /debug flag. I wanna see line numbers in
+ exceptions thrown.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Security:
+ * System.Web.SessionState: new directories.
+
+2002-05-17 Duncan Mak <duncan@ximian.com>
+
+ * System.Web.build: Added new arguments: "/noconfig",
+ "/r:System.Drawing.dll" and "/r:System.Xml.dll".
+
+2002-05-10 Duncan Mak <duncan@ximian.com>
+
+ * System.Web.build: Include the System.Web.UI.HtmlControls namespace.
+
+ * Page.cs:
+ * ValidatorCollection.cs: Stubs to make things compile for
+ now. Added one dummy method (RegisterClientScriptFile) that's used
+ in the existing codebase, but not in MS docs.
+
+2002-04-26 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added directory: System.Web.Mail
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * System.Web -- Assembly build.
+
+ The basic runtime support is now working, we can now start working
+ on the runtime flow system (thread pool etc) and also start testing
+ the parser and control framework. (224 files are compiled)
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.Security: Removed all files. Will do it later.
+ May be someone else like to do it for the time being.
+
+2002-03-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web -- Assembly build.
+ Another milestone reached. Compiled 195 classes successfully.
+ Build includes System.Web.UI.WebControls and all the dependencies
+ for the namespace.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.Security: Added directory.
+
+2002-03-04 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.UI.WebContorls: Virtually complete. See
+ System.Web.UI.WebControls/ChangeLog for a comprehensensive
+ description of what's left and where. But, don't go for
+ a build at this stage. There are a few classes left in
+ System.Web namespace that need to be filled-up, though
+ I will try to fix up the current state to be able to make
+ a build.
+
+2001-12-20 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Did first successful build of System.Web.dll that included
+ System.Web.UI.WebControls namespace. Though, not updating
+ the System.Web.build file, since with the changes that
+ followed, the build again fails :(
+
+2001-11-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.WebUtils: Removed
+ * System.Web.Utils : Added --- replacement of WebUtils
+
+2001-11-08 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.WebUtils: Added directory
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web.UI.HtmlControls
+ * Added directory: Test
+
+2001-08-17 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web.UI
+
+2001-08-09 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web
+
+2001-07-20 Patrik Torstensson (Patrik.Torstensson@labs2.com)
+
+ * Added directory: System.Web.Caching
diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs
new file mode 100644
index 00000000000..4e13b80abab
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs
@@ -0,0 +1,533 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Changes:
+// Daniel Cazzulino [DHC] (dcazzulino@users.sf.net)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Implements a cache for Web applications and other. The difference from the MS.NET implementation is that we
+ /// support to use the Cache object as cache in our applications.
+ /// </summary>
+ /// <remarks>
+ /// The Singleton cache is created per application domain, and it remains valid as long as the application domain remains active.
+ /// </remarks>
+ /// <example>
+ /// Usage of the singleton cache:
+ ///
+ /// Cache objManager = Cache.SingletonCache;
+ ///
+ /// String obj = "tobecached";
+ /// objManager.Add("kalle", obj);
+ /// </example>
+ public class Cache : System.Collections.IEnumerable, System.IDisposable
+ {
+ // Declarations
+
+ // MS.NET Does only have the cache connected to the HttpRuntime and we don't have the HttpRuntime (yet)
+ // HACK: [DHC] Don't construct a new cache unless it's actually used.
+ //static Cache objSingletonCache = new Cache();
+ static Cache objSingletonCache;
+
+ private bool _boolDisposed;
+
+ // Helper objects
+ private CacheExpires _objExpires;
+
+ // The data storage
+ // Todo: Make a specialized storage for the cache entries?
+ // todo: allow system to replace the storage?
+ private System.Collections.Hashtable _arrEntries;
+ private System.Threading.ReaderWriterLock _lockEntries;
+
+ static private System.TimeSpan _datetimeOneYear = System.TimeSpan.FromDays(365);
+
+ // Number of items in the cache
+ private long _longItems;
+
+ // Constructor
+ public Cache()
+ {
+ _boolDisposed = false;
+ _longItems = 0;
+
+ _lockEntries = new System.Threading.ReaderWriterLock();
+ _arrEntries = new System.Collections.Hashtable();
+
+ _objExpires = new CacheExpires(this);
+ }
+
+ // Public methods and properties
+
+ //
+ /// <summary>
+ /// Returns a static version of the cache. In MS.NET the cache is stored in the System.Web.HttpRuntime
+ /// but we keep it here as a singleton (right now anyway).
+ /// </summary>
+ public static Cache SingletonCache
+ {
+ get
+ {
+ if (objSingletonCache == null)
+ {
+ // HACK: [DHC] Create the cache here instead of throwing.
+ //throw new System.InvalidOperationException();
+ objSingletonCache = new Cache();
+ }
+
+ return objSingletonCache;
+ }
+ }
+
+ /// <summary>
+ /// Used in the absoluteExpiration parameter in an Insert method call to indicate the item should never expire. This field is read-only.
+ /// </summary>
+ public static readonly System.DateTime NoAbsoluteExpiration = System.DateTime.MaxValue;
+
+ /// <summary>
+ /// Used as the slidingExpiration parameter in an Insert method call to disable sliding expirations. This field is read-only.
+ /// </summary>
+ public static readonly System.TimeSpan NoSlidingExpiration = System.TimeSpan.Zero;
+
+ /// <summary>
+ /// Internal method to create a enumerator and over all public items in the cache and is used by GetEnumerator method.
+ /// </summary>
+ /// <returns>Returns IDictionaryEnumerator that contains all public items in the cache</returns>
+ private System.Collections.IDictionaryEnumerator CreateEnumerator()
+ {
+ System.Collections.Hashtable objTable;
+
+ //Locking with 0 provides a non-expiring lock.
+ _lockEntries.AcquireReaderLock(0);
+ try
+ {
+ // Create a new hashtable to return as collection of public items
+ objTable = new System.Collections.Hashtable(_arrEntries.Count);
+
+ foreach(System.Collections.DictionaryEntry objEntry in _arrEntries)
+ {
+ if (objEntry.Key != null)
+ {
+ // Check if this is a public entry
+ if (((CacheEntry) objEntry.Value).TestFlag(CacheEntry.Flags.Public))
+ {
+ // Add to the collection
+ objTable.Add(objEntry.Key, ((CacheEntry) objEntry.Value).Item);
+ }
+ }
+ }
+ }
+ finally
+ {
+ _lockEntries.ReleaseReaderLock();
+ }
+
+ return objTable.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Implementation of IEnumerable interface and calls the GetEnumerator that returns
+ /// IDictionaryEnumerator.
+ /// </summary>
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// <summary>
+ /// Virtual override of the IEnumerable.GetEnumerator() method, returns a specialized enumerator.
+ /// </summary>
+ public System.Collections.IDictionaryEnumerator GetEnumerator()
+ {
+ return CreateEnumerator();
+ }
+
+ /// <summary>
+ /// Touches a object in the cache. Used to update expire time and hit count.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to retrieve.</param>
+ public void Touch(string strKey)
+ {
+ // Just touch the object
+ Get(strKey);
+ }
+
+ /// <summary>
+ /// Adds the specified item to the Cache object with dependencies, expiration and priority policies, and a
+ /// delegate you can use to notify your application when the inserted item is removed from the Cache.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="absolutExpiration">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="slidingExpiration">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ /// <param name="enumPriorityDecay">The rate at which an object in the cache decays in importance. Objects that decay quickly are more likely to be removed.</param>
+ /// <param name="eventRemoveCallback">A delegate that, if provided, is called when an object is removed from the cache. You can use this to notify applications when their objects are deleted from the cache.</param>
+ /// <returns>The Object item added to the Cache.</returns>
+ public object Add(string strKey, object objItem, CacheDependency objDependency, System.DateTime absolutExpiration, System.TimeSpan slidingExpiration, CacheItemPriority enumPriority, CacheItemPriorityDecay enumPriorityDecay, CacheItemRemovedCallback eventRemoveCallback)
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.Cache");
+ }
+
+ if (strKey == null)
+ {
+ throw new System.ArgumentNullException("strKey");
+ }
+
+ if (objItem == null)
+ {
+ throw new System.ArgumentNullException("objItem");
+ }
+
+ if (slidingExpiration > _datetimeOneYear)
+ {
+ throw new System.ArgumentOutOfRangeException("slidingExpiration");
+ }
+
+ CacheEntry objEntry;
+ CacheEntry objNewEntry;
+
+ long longHitRange = 10000;
+
+ // todo: check decay and make up the minHit range
+
+ objEntry = new CacheEntry(this, strKey, objItem, objDependency, eventRemoveCallback, absolutExpiration, slidingExpiration, longHitRange, true, enumPriority);
+
+ System.Threading.Interlocked.Increment(ref _longItems);
+
+ // If we have any kind of expiration add into the CacheExpires class
+ if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration)
+ {
+ // Add it to CacheExpires
+ _objExpires.Add(objEntry);
+ }
+
+ // Check and get the new item..
+ objNewEntry = UpdateCache(strKey, objEntry, true, CacheItemRemovedReason.Removed);
+
+ if (objNewEntry != null)
+ {
+ // Return added item
+ return objEntry.Item;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Inserts an item into the Cache object with a cache key to reference its location and using default values
+ /// provided by the CacheItemPriority and CacheItemPriorityDecay enumerations.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ public void Insert(string strKey, object objItem)
+ {
+ //HACK: [DHC] Use constants defined in Cache.
+ //Add(strKey, objItem, null, System.DateTime.MaxValue, System.TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ Add(strKey, objItem, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache that has file or key dependencies.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ public void Insert(string strKey, object objItem, CacheDependency objDependency)
+ {
+ //HACK: [DHC] Use constants defined in Cache.
+ //Add(strKey, objItem, objDependency, System.DateTime.MaxValue, System.TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ Add(strKey, objItem, objDependency, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache with dependencies and expiration policies.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="absolutExpiration">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="slidingExpiration">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ public void Insert(string strKey, object objItem, CacheDependency objDependency, System.DateTime absolutExpiration, System.TimeSpan slidingExpiration)
+ {
+ Add(strKey, objItem, objDependency, absolutExpiration, slidingExpiration, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache object with dependencies, expiration and priority policies, and a delegate
+ /// you can use to notify your application when the inserted item is removed from the Cache.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="absolutExpiration">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="slidingExpiration">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ /// <param name="enumPriorityDecay">The rate at which an object in the cache decays in importance. Objects that decay quickly are more likely to be removed.</param>
+ /// <param name="eventRemoveCallback">A delegate that, if provided, is called when an object is removed from the cache. You can use this to notify applications when their objects are deleted from the cache.</param>
+ public void Insert(string strKey, object objItem, CacheDependency objDependency, System.DateTime absolutExpiration, System.TimeSpan slidingExpiration, CacheItemPriority enumPriority, CacheItemPriorityDecay enumPriorityDecay, CacheItemRemovedCallback eventRemoveCallback)
+ {
+ Add(strKey, objItem, objDependency, absolutExpiration, slidingExpiration, enumPriority, enumPriorityDecay, eventRemoveCallback);
+ }
+
+ /// <summary>
+ /// Removes the specified item from the Cache object.
+ /// </summary>
+ /// <param name="strKey">The cache key for the cache item to remove.</param>
+ /// <returns>The item removed from the Cache. If the value in the key parameter is not found, returns a null reference.</returns>
+ public object Remove(string strKey)
+ {
+ return Remove(strKey, CacheItemRemovedReason.Removed);
+ }
+
+ /// <summary>
+ /// Internal method that updates the cache, decremenents the number of existing items and call close on the cache entry. This method
+ /// is also used from the ExpiresBuckets class to remove an item during GC flush.
+ /// </summary>
+ /// <param name="strKey">The cache key for the cache item to remove.</param>
+ /// <param name="enumReason">Reason why the item is removed.</param>
+ /// <returns>The item removed from the Cache. If the value in the key parameter is not found, returns a null reference.</returns>
+ internal object Remove(string strKey, CacheItemRemovedReason enumReason)
+ {
+ CacheEntry objEntry = UpdateCache(strKey, null, true, enumReason);
+
+ if (objEntry != null)
+ {
+ System.Threading.Interlocked.Decrement(ref _longItems);
+
+ // Close the cache entry (calls the remove delegate)
+ objEntry.Close(enumReason);
+
+ return objEntry.Item;
+ } else
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the specified item from the Cache object.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to retrieve.</param>
+ /// <returns>The retrieved cache item, or a null reference.</returns>
+ public object Get(string strKey)
+ {
+ CacheEntry objEntry = UpdateCache(strKey, null, false, CacheItemRemovedReason.Expired);
+
+ if (objEntry == null)
+ {
+ return null;
+ } else
+ {
+ return objEntry.Item;
+ }
+ }
+
+ /// <summary>
+ /// Internal method used for removing, updating and adding CacheEntries into the cache.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to modify</param>
+ /// <param name="objEntry">CacheEntry to use for overwrite operation, if this parameter is null and overwrite true the item is going to be removed</param>
+ /// <param name="boolOverwrite">If true the objEntry parameter is used to overwrite the strKey entry</param>
+ /// <param name="enumReason">Reason why an item was removed</param>
+ /// <returns></returns>
+ private CacheEntry UpdateCache(string strKey, CacheEntry objEntry, bool boolOverwrite, CacheItemRemovedReason enumReason)
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.Cache", "Can't update item(s) in a disposed cache");
+ }
+
+ if (strKey == null)
+ {
+ throw new System.ArgumentNullException("System.Web.Cache");
+ }
+
+ long ticksNow = System.DateTime.Now.Ticks;
+ long ticksExpires = long.MaxValue;
+
+ bool boolGetItem = false;
+ bool boolExpiried = false;
+ bool boolWrite = false;
+ bool boolRemoved = false;
+
+ // Are we getting the item from the hashtable
+ if (boolOverwrite == false && strKey.Length > 0 && objEntry == null)
+ {
+ boolGetItem = true;
+ }
+
+ // TODO: Optimize this method, move out functionality outside the lock
+ _lockEntries.AcquireReaderLock(0);
+ try
+ {
+ if (boolGetItem)
+ {
+ objEntry = (CacheEntry) _arrEntries[strKey];
+ if (objEntry == null)
+ {
+ return null;
+ }
+ }
+
+ if (objEntry != null)
+ {
+ // Check if we have expired
+ if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration)
+ {
+ if (objEntry.Expires < ticksNow)
+ {
+ // We have expired, remove the item from the cache
+ boolWrite = true;
+ boolExpiried = true;
+ }
+ }
+ }
+
+ // Check if we going to modify the hashtable
+ if (boolWrite || (boolOverwrite && !boolExpiried))
+ {
+ // Upgrade our lock to write
+ System.Threading.LockCookie objCookie = _lockEntries.UpgradeToWriterLock(0);
+ try
+ {
+ // Check if we going to just modify an existing entry (or add)
+ if (boolOverwrite && objEntry != null)
+ {
+ _arrEntries[strKey] = objEntry;
+ }
+ else
+ {
+ // We need to remove the item, fetch the item first
+ objEntry = (CacheEntry) _arrEntries[strKey];
+ if (objEntry != null)
+ {
+ _arrEntries.Remove(strKey);
+ }
+
+ boolRemoved = true;
+ }
+ }
+ finally
+ {
+ _lockEntries.DowngradeFromWriterLock(ref objCookie);
+ }
+ }
+
+ // If the entry haven't expired or been removed update the info
+ if (!boolExpiried && !boolRemoved)
+ {
+ // Update that we got a hit
+ objEntry.Hits++;
+ if (objEntry.HasSlidingExpiration)
+ {
+ ticksExpires = ticksNow + objEntry.SlidingExpiration;
+ }
+ }
+ }
+ finally
+ {
+ _lockEntries.ReleaseLock();
+
+ }
+
+ // If the item was removed we need to remove it from the CacheExpired class also
+ if (boolRemoved)
+ {
+ if (objEntry != null)
+ {
+ if (objEntry.HasAbsoluteExpiration || objEntry.HasSlidingExpiration)
+ {
+ _objExpires.Remove(objEntry);
+ }
+ }
+
+ // Return the entry, it's not up to the UpdateCache to call Close on the entry
+ return objEntry;
+ }
+
+ // If we have sliding expiration and we have a correct hit, update the expiration manager
+ if (objEntry.HasSlidingExpiration)
+ {
+ _objExpires.Update(objEntry, ticksExpires);
+ }
+
+ // Return the cache entry
+ return objEntry;
+ }
+
+ /// <summary>
+ /// Gets the number of items stored in the cache.
+ /// </summary>
+ public long Count
+ {
+ get
+ {
+ return _longItems;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the cache item at the specified key.
+ /// </summary>
+ public object this[string strKey]
+ {
+ get
+ {
+ return Get(strKey);
+ }
+
+ set
+ {
+ Insert(strKey, value);
+ }
+ }
+
+ /// <summary>
+ /// Called to close the cache when the AppDomain is closing down or the GC has decided it's time to destroy the object.
+ /// </summary>
+ public void Dispose()
+ {
+ _boolDisposed = true;
+
+ _lockEntries.AcquireReaderLock(0);
+ try
+ {
+ foreach(System.Collections.DictionaryEntry objEntry in _arrEntries)
+ {
+ if (objEntry.Key != null)
+ {
+ // Check if this is active
+ if ( ((CacheEntry) objEntry.Value).TestFlag(CacheEntry.Flags.Removed) )
+ {
+ try
+ {
+ ((CacheEntry) objEntry.Value).Close(CacheItemRemovedReason.Removed);
+ }
+ catch (System.Exception objException)
+ {
+ System.Diagnostics.Debug.Fail("System.Web.Cache.Dispose() Exception when closing cache entry", "Message: " + objException.Message + " Stack: " + objException.StackTrace + " Source:" + objException.Source);
+ }
+ }
+ }
+ }
+ //HACK: dispose the expiring helper.
+ _objExpires.Dispose();
+ }
+ finally
+ {
+ _lockEntries.ReleaseReaderLock();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs b/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs
new file mode 100644
index 00000000000..bde614987ae
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Specifies the relative priority of items stored in the Cache.
+ /// </summary>
+ public enum CacheItemPriority {
+ Low = 1,
+ BelowNormal = 2,
+ Normal = 3,
+ Default = 3,
+ AboveNormal = 4,
+ High = 5,
+ NotRemovable
+ }
+
+ /// <summary>
+ /// Specifies the rate at which the priority of items stored in the Cache are downgraded when not accessed frequently.
+ /// </summary>
+ public enum CacheItemPriorityDecay {
+ Default,
+ Fast,
+ Medium,
+ Never,
+ Slow
+ }
+
+ /// <summary>
+ /// Specifies the reason an item was removed from the Cache.
+ /// </summary>
+ public enum CacheItemRemovedReason {
+ Expired = 1,
+ Removed = 2,
+ Underused = 3,
+ DependencyChanged = 4
+ }
+
+ /// <summary>
+ /// Defines a callback method for notifying applications when a cached item is removed from the Cache.
+ /// </summary>
+ /// <param name="key">The index location for the item removed from the cache. </param>
+ /// <param name="value">The Object item removed from the cache. </param>
+ /// <param name="reason">The reason the item was removed from the cache, as specified by the CacheItemRemovedReason enumeration.</param>
+ public delegate void CacheItemRemovedCallback(string key, object value, CacheItemRemovedReason reason);
+
+ }
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
new file mode 100644
index 00000000000..68c1a39e623
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
@@ -0,0 +1,95 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Class to handle cache dependency, right now this class is only a mookup
+ /// </summary>
+ public sealed class CacheDependency : System.IDisposable
+ {
+ private bool _boolDisposed;
+
+ public CacheDependency()
+ {
+ _boolDisposed = false;
+ }
+
+ /// <remarks>
+ /// Added by gvaish@iitk.ac.in
+ /// </remarks>
+ [MonoTODO("Constructor")]
+ public CacheDependency(string filename)
+ {
+ }
+
+ /// <remarks>
+ /// Added by gvaish@iitk.ac.in
+ /// </remarks>
+ [MonoTODO("Constructor")]
+ public CacheDependency(string[] filenames, string[] cachekeys)
+ {
+ }
+
+ public delegate void CacheDependencyCallback(CacheDependency objDependency);
+
+ public event CacheDependencyCallback Changed;
+
+ public void OnChanged()
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.CacheDependency");
+ }
+
+ if (Changed != null)
+ {
+ Changed(this);
+ }
+ }
+
+ public bool IsDisposed
+ {
+ get
+ {
+ return _boolDisposed;
+ }
+ }
+
+ public bool HasEvents
+ {
+ get
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.CacheDependency");
+ }
+
+ if (Changed != null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public void Dispose()
+ {
+ _boolDisposed = true;
+ }
+
+ /// <summary>
+ /// Used in testing.
+ /// </summary>
+ public void Signal()
+ {
+ OnChanged();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs
new file mode 100644
index 00000000000..80d56c8ad74
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs
@@ -0,0 +1,445 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Changes:
+// Daniel Cazzulino [DHC] (dcazzulino@users.sf.net)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Class responsible for representing a cache entry.
+ /// </summary>
+ public class CacheEntry
+ {
+ /// <summary>
+ /// Defines the status of the current cache entry
+ /// </summary>
+ public enum Flags
+ {
+ Removed = 0,
+ Public = 1
+ }
+
+ private CacheItemPriority _enumPriority;
+
+ private long _longHits;
+
+ private byte _byteExpiresBucket;
+ private int _intExpiresIndex;
+
+ private long _ticksExpires;
+ private long _ticksSlidingExpiration;
+
+ private string _strKey;
+ private object _objItem;
+
+ private long _longMinHits;
+
+ private Flags _enumFlags;
+
+ private CacheDependency _objDependency;
+ private Cache _objCache;
+
+ /// <summary>
+ /// The item is not placed in a bucket. [DHC]
+ /// </summary>
+ public static readonly byte NoBucketHash = byte.MaxValue;
+
+ /// <summary>
+ /// The item is not placed in a bucket. [DHC]
+ /// </summary>
+ public static readonly int NoIndexInBucket = int.MaxValue;
+
+ /// <summary>
+ /// Lock for syncronized operations. [DHC]
+ /// </summary>
+ System.Threading.ReaderWriterLock _lock = new System.Threading.ReaderWriterLock();
+
+ /// <summary>
+ /// Constructs a new cache entry
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="dtExpires">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="tsSpan">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="longMinHits">Used to detect and control if the item should be flushed due to under usage</param>
+ /// <param name="boolPublic">Defines if the item is public or not</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ public CacheEntry( Cache objManager, string strKey, object objItem, CacheDependency objDependency, CacheItemRemovedCallback eventRemove,
+ System.DateTime dtExpires, System.TimeSpan tsSpan, long longMinHits, bool boolPublic, CacheItemPriority enumPriority )
+ {
+ if (boolPublic)
+ {
+ SetFlag(Flags.Public);
+ }
+
+ _strKey = strKey;
+ _objItem = objItem;
+ _objCache = objManager;
+
+ _onRemoved += eventRemove;
+
+ _enumPriority = enumPriority;
+
+ _ticksExpires = dtExpires.Ticks;
+
+ _ticksSlidingExpiration = tsSpan.Ticks;
+
+ // If we have a sliding expiration it overrides the absolute expiration (MS behavior)
+ // This is because sliding expiration causes the absolute expiration to be
+ // moved after each period, and the absolute expiration is the value used
+ // for all expiration calculations.
+ //HACK: [DHC] Use constants defined in Cache.
+ //if (tsSpan.Ticks != System.TimeSpan.Zero.Ticks)
+ if (tsSpan.Ticks != Cache.NoSlidingExpiration.Ticks)
+ {
+ _ticksExpires = System.DateTime.Now.AddTicks(_ticksSlidingExpiration).Ticks;
+ }
+
+ _objDependency = objDependency;
+ if (_objDependency != null)
+ {
+ if (_objDependency.IsDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.CacheDependency");
+ }
+
+ // Add the entry to the cache dependency handler (we support multiple entries per handler)
+ _objDependency.Changed += new CacheDependency.CacheDependencyCallback(OnChanged);
+ }
+
+ _longMinHits = longMinHits;
+ }
+
+ private event CacheItemRemovedCallback _onRemoved;
+
+ public void OnChanged(CacheDependency objDependency)
+ {
+ _objCache.Remove(_strKey, CacheItemRemovedReason.DependencyChanged);
+ }
+
+ /// <summary>
+ /// Cleans up the cache entry, removes the cache dependency and calls the remove delegate.
+ /// </summary>
+ /// <param name="enumReason">The reason why the cache entry are going to be removed</param>
+ public void Close(CacheItemRemovedReason enumReason)
+ {
+ //HACK: optimized locks. [DHC]
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ // Check if the item already is removed
+ if (TestFlag(Flags.Removed))
+ {
+ return;
+ }
+
+ SetFlag(Flags.Removed);
+
+ if (_onRemoved != null)
+ {
+ // Call the delegate to tell that we are now removing the entry
+ try
+ {
+ _onRemoved(_strKey, _objItem, enumReason);
+ }
+ catch (System.Exception objException)
+ {
+ System.Diagnostics.Debug.Fail("System.Web.CacheEntry.Close() Exception when calling remove delegate", "Message: " + objException.Message + " Stack: " + objException.StackTrace + " Source:" + objException.Source);
+ }
+ }
+
+ // If we have a dependency, remove the entry
+ if (_objDependency != null)
+ {
+ _objDependency.Changed -= new CacheDependency.CacheDependencyCallback(OnChanged);
+ if (!_objDependency.HasEvents)
+ {
+ _objDependency.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock();
+ }
+ }
+
+ /// <summary>
+ /// Tests a specific flag is set or not.
+ /// </summary>
+ /// <param name="oFlag">Flag to test agains</param>
+ /// <returns>Returns true if the flag is set.</returns>
+ public bool TestFlag(Flags oFlag)
+ {
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ if ((_enumFlags & oFlag) != 0)
+ {
+ return true;
+ }
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Sets a specific flag.
+ /// </summary>
+ /// <param name="oFlag">Flag to set.</param>
+ public void SetFlag(Flags oFlag)
+ {
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ _enumFlags |= oFlag;
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock ();
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the object has minimum hit usage flushing enabled.
+ /// </summary>
+ public bool HasUsage
+ {
+ get {
+ if (_longMinHits == System.Int64.MaxValue)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the entry has absolute expiration.
+ /// </summary>
+ public bool HasAbsoluteExpiration
+ {
+ get
+ {
+ //HACK: [DHC] Use constant defined in Cache.
+ //if (_ticksExpires == System.DateTime.MaxValue.Ticks)
+ if (_ticksExpires == Cache.NoAbsoluteExpiration.Ticks)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the entry has sliding expiration enabled.
+ /// </summary>
+ public bool HasSlidingExpiration
+ {
+ get
+ {
+ //HACK: [DHC] Use constants defined in Cache.
+ //if (_ticksSlidingExpiration == System.TimeSpan.Zero.Ticks)
+ if (_ticksSlidingExpiration == Cache.NoSlidingExpiration.Ticks)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the current expires bucket the entry is active in.
+ /// </summary>
+ public byte ExpiresBucket
+ {
+ get
+ {
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ return _byteExpiresBucket;
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+ }
+ set
+ {
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ _byteExpiresBucket = value;
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock ();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the current index in the expires bucket of the current cache entry.
+ /// </summary>
+ public int ExpiresIndex
+ {
+ get
+ {
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ return _intExpiresIndex;
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+ }
+
+ set
+ {
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ _intExpiresIndex = value;
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the expiration of the cache entry.
+ /// </summary>
+ public long Expires
+ {
+ get
+ {
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ return _ticksExpires;
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+ }
+ set
+ {
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ _ticksExpires = value;
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the sliding expiration value. The return value is in ticks (since 0/0-01 in 100nanosec)
+ /// </summary>
+ public long SlidingExpiration
+ {
+ get
+ {
+ return _ticksSlidingExpiration;
+ }
+ }
+
+ /// <summary>
+ /// Returns the current cached item.
+ /// </summary>
+ public object Item
+ {
+ get
+ {
+ return _objItem;
+ }
+ }
+
+ /// <summary>
+ /// Returns the current cache identifier.
+ /// </summary>
+ public string Key
+ {
+ get
+ {
+ return _strKey;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the current number of hits on the cache entry.
+ /// </summary>
+ public long Hits
+ {
+ // todo: Could be optimized by using interlocked methods..
+ get
+ {
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ return _longHits;
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+ }
+ set
+ {
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ _longHits = value;
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns minimum hits for the usage flushing rutine.
+ /// </summary>
+ public long MinimumHits
+ {
+ get
+ {
+ return _longMinHits;
+ }
+ }
+
+ /// <summary>
+ /// Returns the priority of the cache entry.
+ /// </summary>
+ public CacheItemPriority Priority
+ {
+ get
+ {
+ return _enumPriority;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs
new file mode 100644
index 00000000000..cad44c36af1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs
@@ -0,0 +1,147 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Changes:
+// Daniel Cazzulino [DHC] (dcazzulino@users.sf.net)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Class responsible for handling time based flushing of entries in the cache. The class creates
+ /// and manages 60 buckets each holding every item that expires that minute. The bucket calculated
+ /// for an entry is one minute more than the timeout just to make sure that the item end up in the
+ /// bucket where it should be flushed.
+ /// </summary>
+ public class CacheExpires : System.IDisposable
+ {
+ static int _intFlush;
+ /// <summary>
+ /// 1 bucket == 1 minute == 10M ticks (1 second) * 60
+ /// </summary>
+ static long _ticksPerBucket = 600000000;
+ /// <summary>
+ /// 1 cycle == 1 hour
+ /// </summary>
+ static long _ticksPerCycle = _ticksPerBucket * 60;
+
+ private ExpiresBucket[] _arrBuckets;
+ private System.Threading.Timer _objTimer;
+ private Cache _objManager;
+
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ /// <param name="objManager">The cache manager, used when flushing items in a bucket.</param>
+ public CacheExpires(Cache objManager)
+ {
+ _objManager = objManager;
+ Initialize();
+ }
+
+ /// <summary>
+ /// Initializes the class.
+ /// </summary>
+ private void Initialize()
+ {
+ // Create one bucket per minute
+ _arrBuckets = new ExpiresBucket[60];
+
+ byte bytePos = 0;
+ do
+ {
+ _arrBuckets[bytePos] = new ExpiresBucket(bytePos, _objManager);
+ bytePos++;
+ } while (bytePos < 60);
+
+ // GC Bucket controller
+ _intFlush = System.DateTime.Now.Minute - 1;
+ _objTimer = new System.Threading.Timer(new System.Threading.TimerCallback(GarbageCleanup), null, 10000, 60000);
+ }
+
+ /// <summary>
+ /// Adds a Cache entry to the correct flush bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to add.</param>
+ public void Add(CacheEntry objEntry)
+ {
+ lock(this)
+ {
+ // If the entry doesn't have a expires time we assume that the entry is due to expire now.
+ if (objEntry.Expires == 0)
+ {
+ objEntry.Expires = System.DateTime.Now.Ticks;
+ }
+
+ _arrBuckets[GetHashBucket(objEntry.Expires)].Add(objEntry);
+ }
+ }
+
+ public void Remove(CacheEntry objEntry)
+ {
+ lock(this)
+ {
+ // If the entry doesn't have a expires time we assume that the entry is due to expire now.
+ if (objEntry.Expires == 0)
+ {
+ objEntry.Expires = System.DateTime.Now.Ticks;
+ }
+
+ _arrBuckets[GetHashBucket(objEntry.Expires)].Remove(objEntry);
+ }
+ }
+
+ public void Update(CacheEntry objEntry, long ticksExpires)
+ {
+ lock(this)
+ {
+ // If the entry doesn't have a expires time we assume that the entry is due to expire now.
+ if (objEntry.Expires == 0)
+ {
+ objEntry.Expires = System.DateTime.Now.Ticks;
+ }
+
+ _arrBuckets[GetHashBucket(objEntry.Expires)].Update(objEntry, ticksExpires);
+ }
+ }
+
+ public void GarbageCleanup(object State)
+ {
+ ExpiresBucket objBucket;
+
+ lock(this)
+ {
+ // Do cleanup of the bucket
+ objBucket = _arrBuckets[(++_intFlush) % 60];
+ }
+
+ // Flush expired items in the current bucket (defined by _intFlush)
+ objBucket.FlushExpiredItems();
+ }
+
+ private int GetHashBucket(long ticks)
+ {
+ // Get bucket to add expire item into, add one minute to the bucket just to make sure that we get it in the bucket gc
+ return (int) (((((ticks + 60000) % _ticksPerCycle) / _ticksPerBucket) + 1) % 60);
+ }
+
+ /// <summary>
+ /// Called by the cache for cleanup.
+ /// </summary>
+ public void Dispose()
+ {
+ lock(this)
+ {
+ // Cleanup the internal timer
+ if (_objTimer != null)
+ {
+ _objTimer.Dispose();
+ _objTimer = null;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog
new file mode 100644
index 00000000000..6e5b8f166e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog
@@ -0,0 +1,45 @@
+2002-12-27 Daniel Cazzulino <dcazzulino@users.sf.net>
+
+ * CacheEntry.cs: several changes. New constants, use of constants
+ defined in Cache.cs, modified locks to optimize perf. Fixed property
+ sets which weren't using the keyword value to set the new values
+ (don't know how this worked before!).
+
+ * Cache.cs: changed singleton implementation to only create the object
+ when actually used. Changed Insert overloads to use constants
+ defined instead of hard values.
+
+ * ExpiresBuchets: major changes. All locking now uses ReaderWriterLock
+ class. Bucket now efectively reuses free indexes from removed items
+ to avoid unnecessary expansions. Expansion now uses Array.CopyTo to
+ add elements to the new list. Added private Int32Collection to
+ handle int indexes efficiently (thanks Shawn Van Ness). See comments
+ there.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Cache.cs: little fixes.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheDefinitions.cs: fixed a couple of enums.
+
+ * CacheDependency.cs: the class is sealed.
+
+2002-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CacheDependency.cs: fixed a couple of typos and don't throw
+ NotImplementedException in constructors.
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * CacheDependency.cs: Some unimplemented methods to make build
+
+2001-07-20 Patrik Torstensson (Patrik.Torstensson@labs2.com)
+
+ * Cache.cs: Implemented. (90% ready)
+ * CacheDefinitions.cs: Implemented.
+ * CacheDependency.cs: Added. (20% ready)
+ * CacheExpires: Implemented.
+ * CacheEntry.cs: Implemented. (95% ready, going to be changed due to CacheDependecy support)
+ * ExpiresBuckets.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
new file mode 100644
index 00000000000..12d06ae8894
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
@@ -0,0 +1,787 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Changes:
+// Daniel Cazzulino [DHC] (dcazzulino@users.sf.net)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Responsible for holding a cache entry in the linked list bucket.
+ /// </summary>
+ public struct ExpiresEntry
+ {
+ public CacheEntry _objEntry;
+ public long _ticksExpires;
+ public int _intNext;
+ }
+
+ /// <summary>
+ /// Holds cache entries that has a expiration in a bucket list.
+ /// </summary>
+ public class ExpiresBucket
+ {
+ private static int MIN_ENTRIES = 16;
+
+ private byte _byteID;
+ private int _intSize;
+ private int _intCount;
+ private int _intNext;
+
+ private Cache _objManager;
+
+ private ExpiresEntry [] _arrEntries;
+
+ /// <summary>
+ /// A lock to use for syncronized operations. [DHC]
+ /// </summary>
+ private System.Threading.ReaderWriterLock _lock = new System.Threading.ReaderWriterLock();
+
+ /// <summary>
+ /// Keeps a list of indexes in the list which are available to place new items. [DHC]
+ /// </summary>
+ Int32Collection _freeidx = new Int32Collection();
+
+ /// <summary>
+ /// Constructs a new bucket.
+ /// </summary>
+ /// <param name="bucket">Current bucket ID.</param>
+ /// <param name="objManager">Cache manager reponsible for the item(s) in the expires bucket.</param>
+ public ExpiresBucket(byte bucket, Cache objManager)
+ {
+ _objManager = objManager;
+ Initialize(bucket);
+ }
+
+ /// <summary>
+ /// Initializes the expires bucket, creates a linked list of MIN_ENTRIES.
+ /// </summary>
+ /// <param name="bucket">Bucket ID.</param>
+ private void Initialize(byte bucket)
+ {
+ _byteID = bucket;
+ _intNext = 0;
+ _intCount = 0;
+
+ _arrEntries = new ExpiresEntry[MIN_ENTRIES];
+ _intSize = MIN_ENTRIES;
+
+ int intPos = 0;
+ do
+ {
+ _arrEntries[intPos]._intNext = intPos + 1;
+ //HACK: [DHC] Use constant defined in Cache.
+ //_arrEntries[intPos]._ticksExpires = System.DateTime.MaxValue.Ticks;
+ _arrEntries[intPos]._ticksExpires = Cache.NoAbsoluteExpiration.Ticks;
+
+ intPos++;
+ } while (intPos < _intSize);
+
+ _arrEntries[_intSize - 1]._intNext = -1;
+ }
+
+ /// <summary>
+ /// Expands the bucket linked array list.
+ /// </summary>
+ private void Expand()
+ {
+ //HACK: [DHC] MAJOR performance improvement by using Array.CopyTo method. Better locking added.
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ int oldsize = _intSize;
+ _intSize *= 2;
+
+ // Copy items to the new list.
+ ExpiresEntry[] newlist = new ExpiresEntry[_intSize];
+ _arrEntries.CopyTo(newlist, 0);
+
+ // Set last element to point to the next new empty element
+ newlist[oldsize - 1]._intNext = oldsize;
+
+ // Initialize positions for the rest of new elements.
+ for (int i = oldsize; i < _intSize; i++)
+ {
+ newlist[i]._intNext = i + 1;
+ newlist[i]._ticksExpires = Cache.NoAbsoluteExpiration.Ticks;
+ }
+
+ // Last item signals the expansion of the list.
+ newlist[_intSize - 1]._intNext = -1;
+
+ // Replace the existing list.
+ _lock.UpgradeToWriterLock(0);
+ _arrEntries = newlist;
+ }
+ finally
+ {
+ //Releases both reader & writer locks.
+ _lock.ReleaseReaderLock();
+ }
+
+ /* ORIGINAL CODE *
+ ExpiresEntry [] arrData;
+ int intPos = 0;
+ int intOldSize;
+
+ lock(this)
+ {
+ intOldSize = _intSize;
+ _intSize *= 2;
+
+ // Create a new array and copy the old data into the new array
+ arrData = new ExpiresEntry[_intSize];
+
+ do
+ {
+ arrData[intPos] = _arrEntries[intPos];
+ intPos++;
+ } while (intPos < intOldSize);
+
+ _intNext = intPos;
+
+ // Initialize the "new" positions.
+ do
+ {
+ arrData[intPos]._intNext = intPos + 1;
+ intPos++;
+ } while (intPos < _intSize);
+
+ arrData[_intSize - 1]._intNext = -1;
+
+ _arrEntries = arrData;
+ }
+ */
+ }
+
+ /// <summary>
+ /// Adds a cache entry into the expires bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache Entry object to be added.</param>
+ public void Add(CacheEntry objEntry)
+ {
+ bool dogrow = false;
+
+ // Check the need for expansion or reuse free index.
+ if (_intNext == -1)
+ {
+ if (_freeidx.Count == 0)
+ {
+ dogrow = true;
+ }
+ else
+ {
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ // Elements may have been removed before the lock statement.
+ if (_freeidx.Count == 0)
+ {
+ dogrow = true;
+ }
+ else
+ {
+ _intNext = _freeidx[0];
+ _freeidx.Remove(_intNext);
+ }
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+ }
+ }
+
+ if (dogrow) Expand();
+
+ _lock.AcquireWriterLock(0);
+ try
+ {
+ _arrEntries[_intNext]._ticksExpires = objEntry.Expires;
+ _arrEntries[_intNext]._objEntry = objEntry;
+ // If there are free indexes in the list, reuse them for the _next value.
+ if (_freeidx.Count != 0)
+ {
+ _intNext = _freeidx[0];
+ _freeidx.Remove(_intNext);
+ }
+ else
+ {
+ _intNext = _arrEntries[_intNext]._intNext;
+ }
+
+ _intCount++;
+ }
+ finally
+ {
+ _lock.ReleaseWriterLock();
+ }
+
+ /* ORIGINAL CODE *
+ if (_intNext == -1)
+ {
+ Expand();
+ }
+
+ lock(this)
+ {
+ _arrEntries[_intNext]._ticksExpires = objEntry.Expires;
+ _arrEntries[_intNext]._objEntry = objEntry;
+
+ _intNext = _arrEntries[_intNext]._intNext;
+
+ _intCount++;
+ }
+ */
+ }
+
+ /// <summary>
+ /// Removes a cache entry from the expires bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to be removed.</param>
+ public void Remove(CacheEntry objEntry)
+ {
+ //HACK: optimized locks. [DHC]
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ // Check if this is our bucket
+ if (objEntry.ExpiresIndex != _byteID) return;
+ if (objEntry.ExpiresIndex == CacheEntry.NoIndexInBucket) return;
+ if (_arrEntries.Length < objEntry.ExpiresIndex) return;
+
+ // Proceed to removal.
+ _lock.UpgradeToWriterLock(0);
+ _intCount--;
+
+ // Push the index as a free one.
+ _freeidx.Add(objEntry.ExpiresIndex);
+
+ _arrEntries[objEntry.ExpiresIndex]._objEntry = null;
+ // Clear bucket-related values from the item.
+ objEntry.ExpiresBucket = CacheEntry.NoBucketHash;
+ objEntry.ExpiresIndex = CacheEntry.NoIndexInBucket;
+ }
+ finally
+ {
+ //Releases both reader & writer locks
+ _lock.ReleaseReaderLock();
+ }
+ }
+
+ /// <summary>
+ /// Updates a cache entry in the expires bucket, this is called during a hit of an item if the
+ /// cache item has a sliding expiration. The function is responsible for updating the cache
+ /// entry.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to update.</param>
+ /// <param name="ticksExpires">New expiration value for the cache entry.</param>
+ public void Update(CacheEntry objEntry, long ticksExpires)
+ {
+ //HACK: optimized locks. [DHC]
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ // Check if this is our bucket
+ if (objEntry.ExpiresIndex != _byteID) return;
+ if (objEntry.ExpiresIndex == CacheEntry.NoIndexInBucket) return;
+ if (_arrEntries.Length < objEntry.ExpiresIndex) return;
+
+ _arrEntries[objEntry.ExpiresIndex]._ticksExpires = ticksExpires;
+ _arrEntries[objEntry.ExpiresIndex]._objEntry.Expires = ticksExpires;
+
+ // Proceed to update.
+ _lock.UpgradeToWriterLock(0);
+ _arrEntries[objEntry.ExpiresIndex]._ticksExpires = ticksExpires;
+ _arrEntries[objEntry.ExpiresIndex]._objEntry.Expires = ticksExpires;
+ }
+ finally
+ {
+ //Releases both read & write locks
+ _lock.ReleaseReaderLock();
+ }
+ }
+
+ /// <summary>
+ /// Flushes all cache entries that has expired and removes them from the cache manager.
+ /// </summary>
+ public void FlushExpiredItems()
+ {
+ ExpiresEntry objEntry;
+ CacheEntry [] arrCacheEntries;
+
+ int intCachePos;
+ int intPos;
+ long ticksNow;
+
+ ticksNow = System.DateTime.Now.Ticks;
+
+ intCachePos = 0;
+
+ // Lookup all items that needs to be removed, this is done in a two part
+ // operation to minimize the locking time.
+ _lock.AcquireReaderLock(0);
+ try
+ {
+ arrCacheEntries = new CacheEntry[_intSize];
+
+ intPos = 0;
+ do
+ {
+ objEntry = _arrEntries[intPos];
+ if (objEntry._objEntry != null)
+ {
+ if (objEntry._ticksExpires < ticksNow)
+ {
+ System.Threading.LockCookie ck = _lock.UpgradeToWriterLock(0);
+ try
+ {
+ //push the index for reuse
+ _freeidx.Add(intPos);
+ arrCacheEntries[intCachePos++] = objEntry._objEntry;
+
+ objEntry._objEntry.ExpiresBucket = CacheEntry.NoBucketHash;
+ objEntry._objEntry.ExpiresIndex = CacheEntry.NoIndexInBucket;
+ objEntry._objEntry = null;
+ }
+ finally
+ {
+ _lock.DowngradeFromWriterLock(ref ck);
+ }
+ }
+ }
+
+ intPos++;
+ } while (intPos < _intSize);
+ }
+ finally
+ {
+ _lock.ReleaseReaderLock();
+ }
+
+ // If we have any entries to remove, go ahead and call the cache manager remove.
+ if (intCachePos > 0)
+ {
+ intPos = 0;
+ do
+ {
+ _objManager.Remove(arrCacheEntries[intPos].Key, CacheItemRemovedReason.Expired);
+
+ intPos++;
+ } while (intPos < intCachePos);
+ }
+ }
+
+ /// <summary>
+ /// Returns the current size of the expires bucket.
+ /// </summary>
+ public int Size
+ {
+ get
+ {
+ //HACK: reuse the _intSize field!!! [DHC]
+ return _intSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns number of items in the bucket.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return _intCount;
+ }
+ }
+
+ #region Private Int32Collection
+ /* This file has been automatically generated by TextBox -- DO NOT EDIT! */
+ /*
+ Int32Collection
+ Int32Collection.Enumerator
+
+ These C# classes implement a strongly-typed collection of
+ Int32 objects.
+
+ The internal representation is an array of Int32, so the performance
+ characteristics will be more like a vector than a list, to use STL terminology.
+
+ The implementation is optimized for value-types, as it goes to great length to
+ avoid the overhead of boxing and unboxing. But it should also work well for
+ reference types.
+
+ Mad props to Nick Wienholt <sheyenne@bigpond.com> for assisting me in
+ this research, and the testing, the benchmarking, and of course, the
+ implementation!
+
+ Last but not least, a quick shout out to Kit George, for his generous
+ contribution to the dotnet mailing list -- a code-generator for
+ CollectionBase-derived classes:
+ http://discuss.develop.com/archives/wa.exe?A2=ind0107C&L=DOTNET&P=R35911
+ This was the original inspiration for the fine code you are now enjoying.
+
+ - Shawn Van Ness
+
+ Other folks who've contributed:
+ Ethan Smith <ethan.smith@pobox.com> (minor perf. improvements)
+ Joel Mueller <jmueller@swiftk.com> (major perf. improvements)
+ Chris Sells <csells@sellsbrothers.com> (generative programming guru)
+ Patrice Lafond <plafond@hemisphere.bm> (a bug fix -- yikes!)
+ */
+
+ /// <summary>
+ /// An optimized collection for holding <see cref="Int32"/> values.
+ /// </summary>
+ [System.Serializable]
+ private class Int32Collection : System.Collections.ICollection, System.Collections.IList, System.Collections.IEnumerable
+ {
+ #region Private vars & ctors
+ private const int DefaultMinimumCapacity = 16;
+
+ private System.Int32[] m_array = new System.Int32[DefaultMinimumCapacity];
+ private int m_count = 0;
+ private int m_version = 0;
+
+ /// <summary />
+ public Int32Collection()
+ { }
+
+ /// <summary />
+ public Int32Collection(Int32Collection collection)
+ { AddRange(collection); }
+
+ /// <summary />
+ public Int32Collection(System.Int32[] array)
+ { AddRange(array); }
+ #endregion
+
+ #region Public members
+
+ /// <summary />
+ public int Count
+ {
+ get
+ { return m_count; }
+ }
+
+ /// <summary />
+ public void CopyTo(System.Int32[] array)
+ {
+ this.CopyTo(array, 0);
+ }
+
+ /// <summary />
+ public void CopyTo(System.Int32[] array, int start)
+ {
+ if (m_count > array.GetUpperBound(0)+1-start)
+ throw new System.ArgumentException("Destination array was not long enough.");
+
+ // for (int i=0; i < m_count; ++i) array[start+i] = m_array[i];
+ System.Array.Copy(m_array, 0, array, start, m_count);
+ }
+
+ /// <summary />
+ public System.Int32 this[int index]
+ {
+ get
+ {
+ ValidateIndex(index); // throws
+ return m_array[index];
+ }
+ set
+ {
+ ValidateIndex(index); // throws
+
+ ++m_version;
+ m_array[index] = value;
+ }
+ }
+
+ /// <summary />
+ public int Add(System.Int32 item)
+ {
+ if (NeedsGrowth())
+ Grow();
+
+ ++m_version;
+ m_array[m_count] = item;
+
+ return m_count++;
+ }
+
+ /// <summary />
+ public void Clear()
+ {
+ ++m_version;
+ m_array = new System.Int32[DefaultMinimumCapacity];
+ m_count = 0;
+ }
+
+ /// <summary />
+ public bool Contains(System.Int32 item)
+ {
+ return ((IndexOf(item) == -1)?false:true);
+ }
+
+ /// <summary />
+ public int IndexOf(System.Int32 item)
+ {
+ for (int i=0; i < m_count; ++i)
+ if (m_array[i].Equals(item))
+ return i;
+ return -1;
+ }
+
+ /// <summary />
+ public void Insert(int position, System.Int32 item)
+ {
+ ValidateIndex(position,true); // throws
+
+ if (NeedsGrowth())
+ Grow();
+
+ ++m_version;
+ System.Array.Copy(m_array, position, m_array, position+1, m_count-position);
+
+ m_array[position] = item;
+ m_count++;
+ }
+
+ /// <summary />
+ public void Remove(System.Int32 item)
+ {
+ int index = IndexOf(item);
+ if (index < 0)
+ throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
+
+ RemoveAt(index);
+ }
+
+ /// <summary />
+ public void RemoveAt(int index)
+ {
+ ValidateIndex(index); // throws
+
+ ++m_version;
+ m_count--;
+ System.Array.Copy(m_array, index+1, m_array, index, m_count-index);
+
+ if (NeedsTrimming())
+ Trim();
+ }
+
+ // Public helpers (just to mimic some nice features of ArrayList)
+
+ /// <summary />
+ public int Capacity
+ {
+ get
+ { return m_array.Length; }
+ set
+ {
+ if (value < m_count) value = m_count;
+ if (value < DefaultMinimumCapacity) value = DefaultMinimumCapacity;
+
+ if (m_array.Length == value) return;
+
+ ++m_version;
+
+ System.Int32[] temp = new System.Int32[value];
+ System.Array.Copy(m_array, 0, temp, 0, m_count);
+ m_array = temp;
+ }
+ }
+
+ /// <summary />
+ public void AddRange(Int32Collection collection)
+ {
+ ++m_version;
+
+ Capacity += collection.Count;
+ System.Array.Copy(collection.m_array, 0, this.m_array, m_count, collection.m_count);
+ m_count += collection.Count;
+ }
+
+ /// <summary />
+ public void AddRange(System.Int32[] array)
+ {
+ ++m_version;
+
+ Capacity += array.Length;
+ System.Array.Copy(array, 0, this.m_array, m_count, array.Length);
+ m_count += array.Length;
+ }
+ #endregion
+
+ #region Private helper methods
+ private void ValidateIndex(int index)
+ {
+ ValidateIndex(index,false);
+ }
+
+ private void ValidateIndex(int index, bool allowEqualEnd)
+ {
+ int max = (allowEqualEnd)?(m_count):(m_count-1);
+ if (index < 0 || index > max)
+ throw new System.ArgumentOutOfRangeException("Index was out of range. Must be non-negative and less than the size of the collection.", (object)index, "Specified argument was out of the range of valid values.");
+ }
+
+ private bool NeedsGrowth()
+ {
+ return (m_count >= Capacity);
+ }
+
+ private void Grow()
+ {
+ if (NeedsGrowth())
+ Capacity = m_count*2;
+ }
+
+ private bool NeedsTrimming()
+ {
+ return (m_count <= Capacity/2);
+ }
+
+ private void Trim()
+ {
+ if (NeedsTrimming())
+ Capacity = m_count;
+ }
+ #endregion
+
+ #region System.Collections.ICollection implementation
+ bool System.Collections.ICollection.IsSynchronized
+ {
+ get
+ { return m_array.IsSynchronized; }
+ }
+
+ object System.Collections.ICollection.SyncRoot
+ {
+ get
+ { return m_array.SyncRoot; }
+ }
+
+ void System.Collections.ICollection.CopyTo(System.Array array, int start)
+ {
+ this.CopyTo((System.Int32[])array, start);
+ }
+ #endregion
+
+ #region System.Collections.IList implementation
+ bool System.Collections.IList.IsFixedSize
+ {
+ get
+ { return false; }
+ }
+
+ bool System.Collections.IList.IsReadOnly
+ {
+ get
+ { return false; }
+ }
+
+ object System.Collections.IList.this[int index]
+ {
+ get { return (object)this[index]; }
+ set { this[index] = (System.Int32)value; }
+ }
+
+ int System.Collections.IList.Add(object item)
+ {
+ return this.Add((System.Int32)item);
+ }
+
+ bool System.Collections.IList.Contains(object item)
+ {
+ return this.Contains((System.Int32)item);
+ }
+
+ int System.Collections.IList.IndexOf(object item)
+ {
+ return this.IndexOf((System.Int32)item);
+ }
+
+ void System.Collections.IList.Insert(int position, object item)
+ {
+ this.Insert(position, (System.Int32)item);
+ }
+
+ void System.Collections.IList.Remove(object item)
+ {
+ this.Remove((System.Int32)item);
+ }
+ #endregion
+
+ #region System.Collections.IEnumerable and enumerator implementation
+ /// <summary />
+ public Enumerator GetEnumerator()
+ {
+ return new Enumerator(this);
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ // Nested enumerator class
+ /// <summary />
+ public class Enumerator : System.Collections.IEnumerator
+ {
+ private Int32Collection m_collection;
+ private int m_index;
+ private int m_version;
+
+ // Construction
+
+ /// <summary />
+ public Enumerator(Int32Collection tc)
+ {
+ m_collection = tc;
+ m_index = -1;
+ m_version = tc.m_version;
+ }
+
+ /// <summary />
+ public System.Int32 Current
+ {
+ get
+ { return m_collection[m_index]; }
+ }
+
+ /// <summary />
+ public bool MoveNext()
+ {
+ if (m_version != m_collection.m_version)
+ throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+
+ ++m_index;
+ return (m_index < m_collection.Count)?true:false;
+ }
+
+ /// <summary />
+ public void Reset()
+ {
+ if (m_version != m_collection.m_version)
+ throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+
+ m_index = -1;
+ }
+
+ object System.Collections.IEnumerator.Current
+ {
+ get
+ { return (object)(this.Current); }
+ }
+ }
+ #endregion
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs b/mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs
new file mode 100644
index 00000000000..e8e394074b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs
@@ -0,0 +1,216 @@
+//
+// System.Web.Compilation.AspComponentFoundry
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+
+namespace System.Web.Compilation
+{
+ internal class AspComponentFoundry
+ {
+ private Hashtable foundries;
+
+ public AspComponentFoundry ()
+ {
+ foundries = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+
+ RegisterFoundry ("asp", "System.Web", "System.Web.UI.WebControls");
+ }
+
+ public AspComponent MakeAspComponent (string foundryName, string componentName, Tag tag)
+ {
+ Foundry foundry = foundries [foundryName] as Foundry;
+ if (foundry == null)
+ throw new ApplicationException ("Foundry not found: " + foundryName);
+
+ return new AspComponent (tag, foundry.GetType (componentName));
+ }
+
+ public void RegisterFoundry (string foundryName,
+ string assemblyName,
+ string nameSpace)
+ {
+ AssemblyFoundry foundry = new AssemblyFoundry (assemblyName, nameSpace);
+ InternalRegister (foundryName, foundry);
+ }
+
+ public void RegisterFoundry (string foundryName,
+ string tagName,
+ string assemblyName,
+ string nameSpace,
+ string typeName)
+ {
+ TagNameFoundry foundry = new TagNameFoundry (assemblyName, tagName, nameSpace, typeName);
+ InternalRegister (foundryName, foundry);
+ }
+
+ void InternalRegister (string foundryName, Foundry foundry)
+ {
+ object f = foundries [foundryName];
+ if (f is CompoundFoundry) {
+ ((CompoundFoundry) f).Add (foundry);
+ } else if (f == null || (f is AssemblyFoundry && foundry is AssemblyFoundry)) {
+ // If more than 1 namespace/assembly specified, the last one is used.
+ foundries [foundryName] = foundry;
+ } else if (f != null) {
+ CompoundFoundry compound = new CompoundFoundry (foundryName);
+ compound.Add ((Foundry) f);
+ compound.Add (foundry);
+ foundries [foundryName] = compound;
+ }
+ }
+
+ public bool LookupFoundry (string foundryName)
+ {
+ return foundries.Contains (foundryName);
+ }
+
+ abstract class Foundry
+ {
+ public abstract Type GetType (string componentName);
+
+ public Assembly LoadAssembly (string assemblyName)
+ {
+ Assembly assembly = null;
+ try {
+ assembly = Assembly.LoadFrom (Path.GetFullPath (assemblyName));
+ } catch {
+ string partialName = assemblyName;
+ if (String.Compare (Path.GetExtension (partialName), ".dll", true) == 0)
+ partialName = Path.GetFileNameWithoutExtension (assemblyName);
+
+ assembly = Assembly.LoadWithPartialName (partialName);
+ }
+
+ if (assembly == null)
+ throw new ApplicationException ("Assembly not found:" + assemblyName);
+
+ return assembly;
+ }
+ }
+
+
+ class TagNameFoundry : Foundry
+ {
+ string assemblyName;
+ string tagName;
+ string nameSpace;
+ string typeName;
+ Type type;
+
+ public TagNameFoundry (string assemblyName, string tagName, string nameSpace, string typeName)
+ {
+ this.assemblyName = assemblyName;
+ this.tagName = tagName;
+ this.nameSpace = nameSpace;
+ this.typeName = typeName;
+ }
+
+ public override Type GetType (string componentName)
+ {
+ if (0 != String.Compare (componentName, tagName, true))
+ throw new ArgumentException (componentName + " != " + tagName);
+
+ if (type != null)
+ return type;
+
+ Assembly assembly = LoadAssembly (assemblyName);
+ type = assembly.GetType (nameSpace + "." + typeName, true, true);
+ return type;
+ }
+
+ public string TagName {
+ get { return tagName; }
+ }
+ }
+
+ class AssemblyFoundry : Foundry
+ {
+ string nameSpace;
+ string assemblyName;
+ Assembly assembly;
+
+ public AssemblyFoundry (string assemblyName, string nameSpace)
+ {
+ this.assemblyName = assemblyName;
+ this.nameSpace = nameSpace;
+ assembly = null;
+ }
+
+ public override Type GetType (string componentName)
+ {
+ Assembly ass = EnsureAssembly (componentName);
+
+ return ass.GetType (nameSpace + "." + componentName, true, true);
+ }
+
+ Assembly EnsureAssembly (string componentName)
+ {
+ if (assembly != null)
+ return assembly;
+
+ assembly = LoadAssembly (assemblyName);
+ return assembly;
+ }
+ }
+
+ class CompoundFoundry : Foundry
+ {
+ AssemblyFoundry assemblyFoundry;
+ Hashtable tagnames;
+ string tagPrefix;
+
+ public CompoundFoundry (string tagPrefix)
+ {
+ this.tagPrefix = tagPrefix;
+ tagnames = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ }
+
+ public void Add (Foundry foundry)
+ {
+ if (foundry is AssemblyFoundry) {
+ assemblyFoundry = (AssemblyFoundry) foundry;
+ return;
+ }
+
+ TagNameFoundry tn = (TagNameFoundry) foundry;
+ string tagName = tn.TagName;
+ if (tagnames.Contains (tagName)) {
+ string msg = String.Format ("{0}:{1} already registered.", tagPrefix, tagName);
+ throw new ApplicationException (msg);
+ }
+ tagnames.Add (tagName, foundry);
+ }
+
+ public override Type GetType (string componentName)
+ {
+ Type type = null;
+ if (assemblyFoundry != null) {
+ try {
+ type = assemblyFoundry.GetType (componentName);
+ return type;
+ } catch { }
+ }
+
+ Foundry foundry = tagnames [componentName] as Foundry;
+ if (foundry == null) {
+ string msg = String.Format ("Type {0} not registered for prefix {1}",
+ componentName, tagPrefix);
+ throw new ApplicationException (msg);
+ }
+
+ return foundry.GetType (componentName);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspElements.cs b/mcs/class/System.Web/System.Web.Compilation/AspElements.cs
new file mode 100644
index 00000000000..0655c232959
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspElements.cs
@@ -0,0 +1,863 @@
+//
+// System.Web.Compilation.AspElements
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+
+ enum ElementType
+ {
+ TAG,
+ PLAINTEXT
+ }
+
+ abstract class Element
+ {
+ private ElementType elementType;
+
+ public Element (ElementType type)
+ {
+ elementType = type;
+ }
+
+ public ElementType GetElementType
+ {
+ get { return elementType; }
+ }
+ } // class Element
+
+ class PlainText : Element
+ {
+ private StringBuilder text;
+
+ public PlainText () : base (ElementType.PLAINTEXT)
+ {
+ text = new StringBuilder ();
+ }
+
+ public PlainText (StringBuilder text) : base (ElementType.PLAINTEXT)
+ {
+ this.text = text;
+ }
+
+ public PlainText (string text) : this ()
+ {
+ this.text.Append (text);
+ }
+
+ public void Append (string more)
+ {
+ text.Append (more);
+ }
+
+ public string Text
+ {
+ get { return text.ToString (); }
+ }
+
+ public override string ToString ()
+ {
+ return "PlainText: " + Text;
+ }
+ }
+
+ enum TagType
+ {
+ DIRECTIVE,
+ HTML,
+ HTMLCONTROL,
+ SERVERCONTROL,
+ INLINEVAR,
+ INLINECODE,
+ CLOSING,
+ SERVEROBJECT,
+ PROPERTYTAG,
+ CODERENDER,
+ DATABINDING,
+ SERVERCOMMENT,
+ NOTYET
+ }
+
+ /*
+ * Attributes and values are stored in a couple of ArrayList in Add ().
+ * When MakeHash () is called, they are converted to a Hashtable. If there are any
+ * attributes duplicated it throws an ArgumentException.
+ *
+ * The [] operator works with the Hashtable if the values are in it, otherwise
+ * it uses the ArrayList's.
+ *
+ * Why? You can have a tag in HTML like <a att="value" att="xxx">, but not in tags
+ * marked runat=server and Hashtable requires the key to be unique.
+ *
+ */
+ class TagAttributes
+ {
+ private Hashtable atts_hash;
+ private ArrayList keys;
+ private ArrayList values;
+ private bool got_hashed;
+
+ public TagAttributes ()
+ {
+ got_hashed = false;
+ keys = new ArrayList ();
+ values = new ArrayList ();
+ }
+
+ private void MakeHash ()
+ {
+ atts_hash = new Hashtable (new CaseInsensitiveHashCodeProvider (),
+ new CaseInsensitiveComparer ());
+ for (int i = 0; i < keys.Count; i++)
+ atts_hash.Add (keys [i], values [i]);
+ got_hashed = true;
+ keys = null;
+ values = null;
+ }
+
+ public bool IsRunAtServer ()
+ {
+ return got_hashed;
+ }
+
+ public void Add (object key, object value)
+ {
+ if (key != null && value != null &&
+ 0 == String.Compare ((string) key, "runat", true) &&
+ 0 == String.Compare ((string) value, "server", true))
+ MakeHash ();
+
+ if (got_hashed)
+ atts_hash.Add (key, value);
+ else {
+ keys.Add (key);
+ values.Add (value);
+ }
+ }
+
+ public ICollection Keys
+ {
+ get { return (got_hashed ? atts_hash.Keys : keys); }
+ }
+
+ private int CaseInsensitiveSearch (string key)
+ {
+ // Hope not to have many attributes when the tag is not a server tag...
+ for (int i = 0; i < keys.Count; i++){
+ if (0 == String.Compare ((string) keys [i], key, true))
+ return i;
+ }
+ return -1;
+ }
+
+ public object this [object key]
+ {
+ get {
+ if (got_hashed)
+ return atts_hash [key];
+
+ int idx = CaseInsensitiveSearch ((string) key);
+ if (idx == -1)
+ return null;
+
+ return values [idx];
+ }
+
+ set {
+ if (got_hashed)
+ atts_hash [key] = value;
+ else {
+ int idx = CaseInsensitiveSearch ((string) key);
+ keys [idx] = value;
+ }
+ }
+ }
+
+ public int Count
+ {
+ get { return (got_hashed ? atts_hash.Count : keys.Count);}
+ }
+
+ public bool IsDataBound (string att)
+ {
+ if (att == null || !got_hashed)
+ return false;
+
+ return (att.StartsWith ("<%#") && att.EndsWith ("%>"));
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder result = new StringBuilder ();
+ string value;
+ foreach (string key in Keys){
+ result.Append (key);
+ value = this [key] as string;
+ if (value != null)
+ result.AppendFormat ("=\"{0}\"", value);
+
+ result.Append (' ');
+ }
+
+ if (result.Length > 0 && result [result.Length - 1] == ' ')
+ result.Length--;
+
+ return result.ToString ();
+ }
+ }
+
+ class Tag : Element
+ {
+ protected string tag;
+ protected TagType tagType;
+ protected TagAttributes attributes;
+ protected bool self_closing;
+ protected bool hasDefaultID;
+ private static int ctrlNumber = 1;
+
+ internal Tag (ElementType etype) : base (etype) { }
+
+ internal Tag (Tag other) :
+ this (other.tag, other.attributes, other.self_closing)
+ {
+ this.tagType = other.tagType;
+ }
+
+ public Tag (string tag, TagAttributes attributes, bool self_closing) :
+ base (ElementType.TAG)
+ {
+ if (tag == null)
+ throw new ArgumentNullException ();
+
+ this.tag = tag;
+ this.attributes = attributes;
+ this.tagType = TagType.NOTYET;
+ this.self_closing = self_closing;
+ this.hasDefaultID = false;
+ }
+
+ public ArrayList GetElements ()
+ {
+ string text = this.PlainHtml;
+ string inner = text.Substring (1, text.Length - 2);
+ byte [] bytes = WebEncoding.Encoding.GetBytes (inner);
+ AspTokenizer tok = new AspTokenizer ("@@inner_string", new MemoryStream (bytes));
+ AspParser parser = new AspParser (tok);
+ parser.Parse ();
+ ArrayList elements = parser.Elements;
+ elements.Insert (0, new PlainText ("<"));
+ elements.Add (new PlainText (">"));
+
+ return elements;
+ }
+ public string TagID
+ {
+ get { return tag; }
+ }
+
+ public TagType TagType
+ {
+ get { return tagType; }
+ }
+
+ public bool SelfClosing
+ {
+ get { return self_closing; }
+ }
+
+ public TagAttributes Attributes
+ {
+ get { return attributes; }
+ }
+
+ public string PlainHtml
+ {
+ get {
+ StringBuilder plain = new StringBuilder ();
+ plain.Append ('<');
+ if (tagType == TagType.CLOSING)
+ plain.Append ('/');
+ plain.Append (tag);
+ if (attributes != null){
+ plain.Append (' ');
+ plain.Append (attributes.ToString ());
+ }
+
+ if (self_closing)
+ plain.Append ('/');
+
+ plain.Append ('>');
+ return plain.ToString ();
+ }
+ }
+
+ public override string ToString ()
+ {
+ return TagID + " " + Attributes + " " + self_closing;
+ }
+
+ public bool HasDefaultID
+ {
+ get { return hasDefaultID; }
+ }
+
+ protected virtual void SetNewID ()
+ {
+ if (attributes == null)
+ attributes = new TagAttributes ();
+ attributes.Add ("ID", GetDefaultID ());
+ hasDefaultID = true;
+ }
+
+ public static string GetDefaultID ()
+ {
+ return "_control" + ctrlNumber++;
+ }
+ }
+
+ class CloseTag : Tag
+ {
+ public CloseTag (string tag) : base (tag, null, false)
+ {
+ tagType = TagType.CLOSING;
+ }
+ }
+
+ class Directive : Tag
+ {
+ // 'codebehind' is just ignored for Page, Application and Control
+ private static Hashtable directivesHash;
+ private static string [] page_atts = { "AspCompat", "AutoEventWireup", "Buffer",
+ "ClassName", "ClientTarget", "CodePage",
+ "CompilerOptions", "ContentType", "Culture", "Debug",
+ "Description", "EnableSessionState", "EnableViewState",
+ "EnableViewStateMac", "ErrorPage", "Explicit",
+ "Inherits", "Language", "LCID", "ResponseEncoding",
+ "Src", "SmartNavigation", "Strict", "Trace",
+ "TraceMode", "Transaction", "UICulture",
+ "WarningLevel", "CodeBehind" };
+
+ private static string [] control_atts = { "AutoEventWireup", "ClassName", "CompilerOptions",
+ "Debug", "Description", "EnableViewState",
+ "Explicit", "Inherits", "Language", "Strict", "Src",
+ "WarningLevel", "CodeBehind" };
+
+ private static string [] import_atts = { "namespace" };
+ private static string [] implements_atts = { "interface" };
+ private static string [] assembly_atts = { "name", "src" };
+ private static string [] register_atts = { "tagprefix", "tagname", "Namespace",
+ "Src", "Assembly" };
+
+ private static string [] outputcache_atts = { "Duration", "Location", "VaryByControl",
+ "VaryByCustom", "VaryByHeader", "VaryByParam" };
+ private static string [] reference_atts = { "page", "control" };
+
+ private static string [] webservice_atts = { "class", "codebehind", "debug", "language" };
+
+ private static string [] application_atts = { "description", "inherits", "codebehind" };
+
+ static Directive ()
+ {
+ InitHash ();
+ }
+
+ private static void InitHash ()
+ {
+ CaseInsensitiveHashCodeProvider provider = new CaseInsensitiveHashCodeProvider ();
+ CaseInsensitiveComparer comparer = new CaseInsensitiveComparer ();
+
+ directivesHash = new Hashtable (provider, comparer);
+
+ // Use Hashtable 'cause is O(1) in Contains (ArrayList is O(n))
+ Hashtable valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in page_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("PAGE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in control_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("CONTROL", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in import_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("IMPORT", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in implements_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("IMPLEMENTS", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in register_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("REGISTER", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in assembly_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("ASSEMBLY", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in outputcache_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("OUTPUTCACHE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in reference_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("REFERENCE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in webservice_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("WEBSERVICE", valid_attributes);
+
+ valid_attributes = new Hashtable (provider, comparer);
+ foreach (string att in application_atts) valid_attributes.Add (att, null);
+ directivesHash.Add ("APPLICATION", valid_attributes);
+ }
+
+ public Directive (string tag, TagAttributes attributes) :
+ base (tag, attributes, true)
+ {
+ CheckAttributes ();
+ tagType = TagType.DIRECTIVE;
+ }
+
+ private void CheckAttributes ()
+ {
+ Hashtable atts;
+ if (!(directivesHash [tag] is Hashtable))
+ throw new ApplicationException ("Unknown directive: " + tag);
+
+ if (attributes == null || attributes.Count == 0)
+ return;
+
+ atts = (Hashtable) directivesHash [tag];
+ foreach (string att in attributes.Keys){
+ if (!atts.Contains (att))
+ throw new ApplicationException ("Attribute " + att +
+ " not valid for tag " + tag);
+ }
+ }
+
+ public static bool IsDirectiveID (string id)
+ {
+ return directivesHash.Contains (id);
+ }
+
+ public override string ToString ()
+ {
+ return "Directive: " + tag;
+ }
+ }
+
+ class ServerObjectTag : Tag
+ {
+ public ServerObjectTag (Tag tag) :
+ base (tag.TagID, tag.Attributes, tag.SelfClosing)
+ {
+ tagType = TagType.SERVEROBJECT;
+ if (!attributes.IsRunAtServer ())
+ throw new ApplicationException ("<object> without runat=server");
+
+ if (attributes.Count != 3 || !SelfClosing || ObjectID == null || ObjectClass == null)
+ throw new ApplicationException ("Incorrect syntax: <object id=\"name\" " +
+ "class=\"full.class.name\" runat=\"server\" />");
+ }
+
+ public string ObjectID
+ {
+ get { return (string) attributes ["id"]; }
+ }
+
+ public string ObjectClass
+ {
+ get { return (string) attributes ["class"]; }
+ }
+ }
+
+ class HtmlControlTag : Tag
+ {
+ private Type control_type;
+ private bool is_container;
+ private string parse_children;
+ private bool got_parse_children;
+
+ private static Hashtable controls;
+ private static Hashtable inputTypes;
+
+ private static void InitHash ()
+ {
+ controls = new Hashtable (new CaseInsensitiveHashCodeProvider (),
+ new CaseInsensitiveComparer ());
+
+ controls.Add ("A", typeof (HtmlAnchor));
+ controls.Add ("BUTTON", typeof (HtmlButton));
+ controls.Add ("FORM", typeof (HtmlForm));
+ controls.Add ("IMG", typeof (HtmlImage));
+ controls.Add ("INPUT", "INPUT");
+ controls.Add ("SELECT", typeof (HtmlSelect));
+ controls.Add ("TABLE", typeof (HtmlTable));
+ controls.Add ("TD", typeof (HtmlTableCell));
+ controls.Add ("TH", typeof (HtmlTableCell));
+ controls.Add ("TR", typeof (HtmlTableRow));
+ controls.Add ("TEXTAREA", typeof (HtmlTextArea));
+
+ inputTypes = new Hashtable (new CaseInsensitiveHashCodeProvider (),
+ new CaseInsensitiveComparer ());
+
+ inputTypes.Add ("BUTTON", typeof (HtmlInputButton));
+ inputTypes.Add ("SUBMIT", typeof (HtmlInputButton));
+ inputTypes.Add ("RESET", typeof (HtmlInputButton));
+ inputTypes.Add ("CHECKBOX", typeof (HtmlInputCheckBox));
+ inputTypes.Add ("FILE", typeof (HtmlInputFile));
+ inputTypes.Add ("HIDDEN", typeof (HtmlInputHidden));
+ inputTypes.Add ("IMAGE", typeof (HtmlInputImage));
+ inputTypes.Add ("RADIO", typeof (HtmlInputRadioButton));
+ inputTypes.Add ("TEXT", typeof (HtmlInputText));
+ inputTypes.Add ("PASSWORD", typeof (HtmlInputText));
+ }
+
+ static HtmlControlTag ()
+ {
+ InitHash ();
+ }
+
+ public HtmlControlTag (string tag, TagAttributes attributes, bool self_closing) :
+ base (tag, attributes, self_closing)
+ {
+ SetData ();
+ if (attributes == null || attributes ["ID"] == null)
+ SetNewID ();
+ }
+
+ public HtmlControlTag (Tag source_tag) :
+ this (source_tag.TagID, source_tag.Attributes, source_tag.SelfClosing)
+ {
+ }
+
+ private void SetData ()
+ {
+ tagType = TagType.HTMLCONTROL;
+ if (!(controls [tag] is string)){
+ control_type = (Type) controls [tag];
+ if (control_type == null)
+ control_type = typeof (HtmlGenericControl);
+ is_container = (0 != String.Compare (tag, "img", true));
+ } else {
+ string type_value = (string) attributes ["TYPE"];
+ if (type_value== null)
+ throw new ArgumentException ("INPUT tag without TYPE attribute!!!");
+
+ control_type = (Type) inputTypes [type_value];
+ //TODO: what does MS with this one?
+ if (control_type == null)
+ throw new ArgumentException ("Unknown input type -> " + type_value);
+ is_container = false;
+ self_closing = true; // All <input ...> are self-closing
+ }
+ }
+
+ public Type ControlType
+ {
+ get { return control_type; }
+ }
+
+ public string ControlID
+ {
+ get { return (string) attributes ["ID"]; }
+ }
+
+ public bool IsContainer
+ {
+ get { return is_container; }
+ }
+
+ public string ParseChildren {
+ get {
+ if (got_parse_children)
+ return parse_children;
+
+ got_parse_children = true;
+ object [] custom_atts = control_type.GetCustomAttributes (true);
+ foreach (object att in custom_atts) {
+ if (!(att is ParseChildrenAttribute))
+ continue;
+
+ ParseChildrenAttribute pc = (ParseChildrenAttribute) att;
+ if (pc.ChildrenAsProperties == true)
+ parse_children = pc.DefaultProperty;
+
+ return parse_children;
+ }
+
+ return parse_children;
+ }
+ }
+
+ public override string ToString ()
+ {
+ string ret = "HtmlControlTag: " + tag + " Name: " + ControlID + "Type:" +
+ control_type.ToString () + "\n\tAttributes:\n";
+
+ foreach (string key in attributes.Keys){
+ ret += "\t" + key + "=" + attributes [key];
+ }
+ return ret;
+ }
+ }
+
+ enum ChildrenKind
+ {
+ NONE,
+ /*
+ * Children must be ASP.NET server controls. Literal text is passed as LiteralControl.
+ * Child controls and text are added using AddParsedSubObject ().
+ */
+ CONTROLS,
+ /*
+ * Children must correspond to properties of the parent control. No literal text allowed.
+ */
+ PROPERTIES,
+ /*
+ * Special case used inside <columns>...</columns>
+ * Only allow DataGridColumn and derived classes.
+ */
+ DBCOLUMNS,
+ /*
+ * Special case for list controls (ListBox, DropDownList...)
+ */
+ LISTITEM,
+ /* For HtmlSelect children. They are <option> tags that must
+ * be treated as ListItem
+ */
+ OPTION,
+ /* Childs of HtmlTable */
+ HTMLROW,
+ /* Childs of HtmlTableRow */
+ HTMLCELL
+ }
+
+ // TODO: support for ControlBuilderAttribute that may be used in custom controls
+ class AspComponent : Tag
+ {
+ private Type type;
+ private string alias;
+ private string control_type;
+ private bool is_close_tag;
+ private bool allow_children;
+ private ChildrenKind children_kind;
+ private string defaultPropertyName;
+
+ private ChildrenKind GuessChildrenKind (Type type)
+ {
+ object [] custom_atts = type.GetCustomAttributes (true);
+ foreach (object custom_att in custom_atts){
+ if (custom_att is ParseChildrenAttribute){
+ /* FIXME
+ * When adding full support for custom controls, we gotta
+ * bear in mind the pca.DefaultProperty value
+ */
+ ParseChildrenAttribute pca = custom_att as ParseChildrenAttribute;
+ defaultPropertyName = pca.DefaultProperty;
+ /* this property will be true for all controls derived from
+ * WebControls. */
+ if (pca.ChildrenAsProperties == false)
+ return ChildrenKind.CONTROLS;
+ else if (defaultPropertyName == "")
+ return ChildrenKind.PROPERTIES;
+ else
+ return ChildrenKind.LISTITEM;
+ }
+ }
+
+ return ChildrenKind.NONE;
+ }
+
+ private static bool GuessAllowChildren (Type type)
+ {
+ PropertyInfo controls = type.GetProperty ("Controls");
+ if (controls == null)
+ return false;
+ MethodInfo getm = controls.GetGetMethod ();
+ object control_instance = Activator.CreateInstance (type);
+ object control_collection = getm.Invoke (control_instance, null);
+ return (!(control_collection is System.Web.UI.EmptyControlCollection));
+ }
+
+ public AspComponent (Tag input_tag, Type type) :
+ base (input_tag)
+ {
+ tagType = TagType.SERVERCONTROL;
+ this.is_close_tag = input_tag is CloseTag;
+ this.type = type;
+ this.defaultPropertyName = "";
+ this.allow_children = GuessAllowChildren (type);
+ if (input_tag.SelfClosing)
+ this.children_kind = ChildrenKind.NONE;
+ else if (type == typeof (System.Web.UI.WebControls.DataGridColumn) ||
+ type.IsSubclassOf (typeof (System.Web.UI.WebControls.DataGridColumn)))
+ this.children_kind = ChildrenKind.PROPERTIES;
+ else if (type == typeof (System.Web.UI.WebControls.ListItem))
+ this.children_kind = ChildrenKind.CONTROLS;
+ else
+ this.children_kind = GuessChildrenKind (type);
+
+ int pos = input_tag.TagID.IndexOf (':');
+ alias = tag.Substring (0, pos);
+ control_type = tag.Substring (pos + 1);
+ if (attributes == null || attributes ["ID"] == null)
+ SetNewID ();
+ }
+
+ public Type ComponentType
+ {
+ get { return type; }
+ }
+
+ public string ControlID
+ {
+ get { return (string) attributes ["ID"]; }
+ }
+
+ public bool IsCloseTag
+ {
+ get { return is_close_tag; }
+ }
+
+ public bool AllowChildren
+ {
+ get { return allow_children; }
+ }
+
+ public ChildrenKind ChildrenKind
+ {
+ get { return children_kind; }
+ }
+
+ public string DefaultPropertyName
+ {
+ get { return defaultPropertyName; }
+ }
+
+
+ public override string ToString ()
+ {
+ return type.ToString () + " Alias: " + alias + " ID: " + (string) attributes ["id"];
+ }
+ }
+
+ class PropertyTag : Tag
+ {
+ private Type type;
+ private string name;
+
+ public PropertyTag (Tag tag, Type type, string name)
+ : base (tag)
+ {
+ tagType = TagType.PROPERTYTAG;
+ SetNewID ();
+ this.name = name;
+ this.type = type;
+ }
+
+ public Type PropertyType
+ {
+ get { return type; }
+ }
+
+ public string PropertyID
+ {
+ get { return (string) attributes ["ID"]; }
+ }
+
+ public string PropertyName
+ {
+ get { return name; }
+ }
+ }
+
+ class CodeRenderTag : Tag
+ {
+ private string code;
+ private bool isVarName;
+
+ public CodeRenderTag (bool isVarName, string code) : base ("", null, false)
+ {
+ tagType = TagType.CODERENDER;
+ this.isVarName = isVarName;
+ this.code = code.Trim ();
+ }
+
+ public string Code
+ {
+ get { return code; }
+ }
+
+ public bool IsVarName
+ {
+ get { return isVarName; }
+ }
+
+ public string AsText
+ {
+ get { return "<%" + (IsVarName ? "=" : "") + Code + "%>"; }
+ }
+ }
+
+ class DataBindingTag : Tag
+ {
+ private string data;
+
+ public DataBindingTag (string data) : base ("", null, false)
+ {
+ tagType = TagType.DATABINDING;
+ this.data = data.Trim ();
+ }
+
+ public string Data
+ {
+ get { return data; }
+ }
+
+ public string AsText
+ {
+ get { return "<%#" + Data + "%>"; }
+ }
+ }
+
+ class ServerComment : Tag
+ {
+ public ServerComment (string tag)
+ : base (ElementType.TAG)
+ {
+ if (tag == null)
+ throw new ArgumentNullException ();
+
+ this.tag = tag;
+ this.attributes = null;
+ this.tagType = TagType.SERVERCOMMENT;
+ this.self_closing = true;
+ this.hasDefaultID = false;
+ }
+
+ public override string ToString ()
+ {
+ return TagID;
+ }
+
+ protected override void SetNewID ()
+ {
+ throw new NotSupportedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
new file mode 100644
index 00000000000..d094459b001
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
@@ -0,0 +1,2021 @@
+//
+// System.Web.Compilation.AspGenerator
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+
+class ControlStack
+{
+ private Stack controls;
+ private ControlStackData top;
+ private bool space_between_tags;
+ private bool sbt_valid;
+
+ class ControlStackData
+ {
+ public Type controlType;
+ public string controlID;
+ public string tagID;
+ public ChildrenKind childKind;
+ public string defaultPropertyName;
+ public int childrenNumber;
+ public Type container;
+ public StringBuilder dataBindFunction;
+ public StringBuilder codeRenderFunction;
+ public bool useCodeRender;
+ public int codeRenderIndex;
+
+ public ControlStackData (Type controlType,
+ string controlID,
+ string tagID,
+ ChildrenKind childKind,
+ string defaultPropertyName,
+ Type container)
+ {
+ this.controlType = controlType;
+ this.controlID = controlID;
+ this.tagID = tagID;
+ this.childKind = childKind;
+ this.defaultPropertyName = defaultPropertyName;
+ this.container = container;
+ childrenNumber = 0;
+ }
+
+ public override string ToString ()
+ {
+ return controlType + " " + controlID + " " + tagID + " " + childKind + " " + childrenNumber;
+ }
+ }
+
+ public ControlStack ()
+ {
+ controls = new Stack ();
+ }
+
+ private Type GetContainerType (Type type)
+ {
+ if (type != typeof (System.Web.UI.Control) &&
+ !type.IsSubclassOf (typeof (System.Web.UI.Control)))
+ return null;
+
+ Type container_type;
+ if (type == typeof (System.Web.UI.WebControls.DataList))
+ container_type = typeof (System.Web.UI.WebControls.DataListItem);
+ else if (type == typeof (System.Web.UI.WebControls.DataGrid))
+ container_type = typeof (System.Web.UI.WebControls.DataGridItem);
+ else if (type == typeof (System.Web.UI.WebControls.Repeater))
+ container_type = typeof (System.Web.UI.WebControls.RepeaterItem);
+ else if (type == typeof (ListControl) || type.IsSubclassOf (typeof (ListControl)))
+ container_type = type;
+ else
+ container_type = Container;
+
+ return container_type;
+ }
+
+ public void Push (object o)
+ {
+ if (!(o is ControlStackData))
+ return;
+
+ controls.Push (o);
+ top = (ControlStackData) o;
+ sbt_valid = false;
+ }
+
+ public void Push (Type controlType,
+ string controlID,
+ string tagID,
+ ChildrenKind childKind,
+ string defaultPropertyName)
+ {
+ Type container_type = null;
+ if (controlType != null){
+ AddChild ();
+ container_type = GetContainerType (controlType);
+ if (container_type == null)
+ container_type = this.Container;
+ }
+
+ top = new ControlStackData (controlType,
+ controlID,
+ tagID,
+ childKind,
+ defaultPropertyName,
+ container_type);
+ sbt_valid = false;
+ controls.Push (top);
+ }
+
+ public object Pop ()
+ {
+ object item = controls.Pop ();
+ if (controls.Count != 0)
+ top = (ControlStackData) controls.Peek ();
+ sbt_valid = false;
+ return item;
+ }
+
+ public Type PeekType ()
+ {
+ return top.controlType;
+ }
+
+ public string PeekControlID ()
+ {
+ return top.controlID;
+ }
+
+ public string PeekTagID ()
+ {
+ return top.tagID;
+ }
+
+ public ChildrenKind PeekChildKind ()
+ {
+ return top.childKind;
+ }
+
+ public string PeekDefaultPropertyName ()
+ {
+ return top.defaultPropertyName;
+ }
+
+ public void AddChild ()
+ {
+ if (top != null)
+ top.childrenNumber++;
+ }
+
+ public bool HasDataBindFunction ()
+ {
+ if (top.dataBindFunction == null || top.dataBindFunction.Length == 0)
+ return false;
+ return true;
+ }
+
+ public bool UseCodeRender
+ {
+ get {
+ if (top.codeRenderFunction == null || top.codeRenderFunction.Length == 0)
+ return false;
+ return top.useCodeRender;
+ }
+
+ set { top.useCodeRender= value; }
+ }
+
+ public bool SpaceBetweenTags
+ {
+ get {
+ if (!sbt_valid){
+ sbt_valid = true;
+ Type type = top.controlType;
+ if (type.Namespace == "System.Web.UI.WebControls")
+ space_between_tags = true;
+ else if (type.IsSubclassOf (typeof (System.Web.UI.WebControls.WebControl)))
+ space_between_tags = true;
+ else if (type == typeof (System.Web.UI.HtmlControls.HtmlSelect))
+ space_between_tags = true;
+ else if (type == typeof (System.Web.UI.HtmlControls.HtmlTable))
+ space_between_tags = true;
+ else if (type == typeof (System.Web.UI.HtmlControls.HtmlTableRow))
+ space_between_tags = true;
+ else if (type == typeof (System.Web.UI.HtmlControls.HtmlTableCell))
+ space_between_tags = true;
+ else
+ space_between_tags = false;
+ }
+ return space_between_tags;
+ }
+ }
+
+ public Type Container {
+ get {
+ if (top == null)
+ return null;
+
+ return top.container;
+ }
+ }
+
+ public StringBuilder DataBindFunction
+ {
+ get {
+ if (top.dataBindFunction == null)
+ top.dataBindFunction = new StringBuilder ();
+ return top.dataBindFunction;
+ }
+ }
+
+ public int CodeRenderIndex {
+ get {
+ return top.codeRenderIndex++;
+ }
+ }
+
+ public StringBuilder CodeRenderFunction
+ {
+ get {
+ if (top.codeRenderFunction == null)
+ top.codeRenderFunction = new StringBuilder ();
+ return top.codeRenderFunction;
+ }
+ }
+
+ public int ChildIndex
+ {
+ get { return top.childrenNumber - 1; }
+ }
+
+ public int Count
+ {
+ get { return controls.Count; }
+ }
+
+ public override string ToString ()
+ {
+ return top.ToString () + " " + top.useCodeRender;
+ }
+
+}
+
+class ArrayListWrapper
+{
+ private ArrayList list;
+ private int index;
+
+ public ArrayListWrapper (ArrayList list)
+ {
+ this.list = list;
+ index = -1;
+ }
+
+ private void CheckIndex ()
+ {
+ if (index == -1 || index == list.Count)
+ throw new InvalidOperationException ();
+ }
+
+ public object Current
+ {
+ get {
+ CheckIndex ();
+ return list [index];
+ }
+
+ set {
+ CheckIndex ();
+ list [index] = value;
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (index < list.Count)
+ index++;
+
+ return index < list.Count;
+ }
+}
+
+class AspGenerator
+{
+ private object [] parts;
+ private ArrayListWrapper elements;
+ private StringBuilder prolog;
+ private StringBuilder declarations;
+ private StringBuilder script;
+ private StringBuilder constructor;
+ private StringBuilder init_funcs;
+ private StringBuilder epilog;
+ private StringBuilder current_function;
+ private Stack functions;
+ private ControlStack controls;
+ private bool parse_ok;
+ private bool has_form_tag;
+ private AspComponentFoundry aspFoundry;
+
+ private string classDecl;
+ private string className;
+ private string interfaces;
+ private string basetype;
+ private string parent;
+ private Type parentType;
+ private string fullPath;
+
+ Hashtable options;
+ string privateBinPath;
+ string main_directive;
+ static string app_file_wrong = "The content in the application file is not valid.";
+
+ bool isPage;
+ bool isUserControl;
+ bool isApplication;
+
+ HttpContext context;
+
+ SessionState sessionState = SessionState.Enabled;
+
+ static Type styleType = typeof (System.Web.UI.WebControls.Style);
+ static Type fontinfoType = typeof (System.Web.UI.WebControls.FontInfo);
+
+ enum UserControlResult
+ {
+ OK = 0,
+ FileNotFound = 1,
+ CompilationFailed = 2
+ }
+
+ enum SessionState
+ {
+ Enabled,
+ ReadOnly,
+ Disabled
+ }
+
+ public AspGenerator (string pathToFile, ArrayList elements)
+ {
+ if (elements == null)
+ throw new ArgumentNullException ();
+
+ this.elements = new ArrayListWrapper (elements);
+ string filename = Path.GetFileName (pathToFile);
+ this.className = filename.Replace ('.', '_'); // Overridden by @ Page classname
+ this.className = className.Replace ('-', '_');
+ this.className = className.Replace (' ', '_');
+ Options ["ClassName"] = this.className;
+ this.fullPath = Path.GetFullPath (pathToFile);
+
+ this.has_form_tag = false;
+ AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
+ privateBinPath = setup.PrivateBinPath;
+ // This is a hack until we can run stuff in different domains
+ if (privateBinPath == null || privateBinPath.Length == 0)
+ privateBinPath = "bin";
+
+ if (!Path.IsPathRooted (privateBinPath))
+ privateBinPath = Path.Combine (setup.ApplicationBase, privateBinPath);
+
+ Init ();
+ }
+
+ public string BaseType {
+ get { return basetype; }
+
+ set {
+ if (parent == null)
+ parent = value;
+
+ basetype = value;
+ isUserControl = (basetype == "System.Web.UI.UserControl");
+ isPage = (basetype == "System.Web.UI.Page");
+ isApplication = (basetype == "System.Web.HttpApplication");
+ }
+ }
+
+ public bool IsUserControl {
+ get { return isUserControl; }
+ }
+
+ public bool IsPage {
+ get { return isPage; }
+ }
+
+ public bool IsApplication {
+ get { return isApplication; }
+ }
+
+ public string Interfaces {
+ get { return interfaces; }
+ }
+
+ public Hashtable Options {
+ get {
+ if (options == null)
+ options = new Hashtable ();
+
+ return options;
+ }
+ }
+
+ internal HttpContext Context {
+ get { return context; }
+ set { context = value; }
+ }
+
+ bool AddUsing (string nspace)
+ {
+ string _using = "using " + nspace + ";";
+ if (prolog.ToString ().IndexOf (_using) == -1) {
+ prolog.AppendFormat ("\t{0}\n", _using);
+ return true;
+ }
+
+ return false;
+ }
+
+ void AddInterface (Type type)
+ {
+ AddInterface (type.ToString ());
+ }
+
+ public void AddInterface (string iface)
+ {
+ if (interfaces == null) {
+ interfaces = ", " + iface;
+ } else {
+ string s = ", " + iface;
+ if (interfaces.IndexOf (s) == -1)
+ interfaces += s;
+ }
+ }
+
+ private AspComponentFoundry Foundry
+ {
+ get {
+ if (aspFoundry == null)
+ aspFoundry = new AspComponentFoundry ();
+
+ return aspFoundry;
+ }
+ }
+
+ private void Init ()
+ {
+ controls = new ControlStack ();
+ controls.Push (typeof (System.Web.UI.Control), "Root", null, ChildrenKind.CONTROLS, null);
+ prolog = new StringBuilder ();
+ declarations = new StringBuilder ();
+ script = new StringBuilder ();
+ constructor = new StringBuilder ();
+ init_funcs = new StringBuilder ();
+ epilog = new StringBuilder ();
+
+ current_function = new StringBuilder ();
+ functions = new Stack ();
+ functions.Push (current_function);
+
+ parts = new Object [6];
+ parts [0] = prolog;
+ parts [1] = declarations;
+ parts [2] = script;
+ parts [3] = constructor;
+ parts [4] = init_funcs;
+ parts [5] = epilog;
+
+ prolog.Append ("namespace ASP {\n" +
+ "\tusing System;\n" +
+ "\tusing System.Collections;\n" +
+ "\tusing System.Collections.Specialized;\n" +
+ "\tusing System.Configuration;\n" +
+ "\tusing System.IO;\n" +
+ "\tusing System.Text;\n" +
+ "\tusing System.Text.RegularExpressions;\n" +
+ "\tusing System.Web;\n" +
+ "\tusing System.Web.Caching;\n" +
+ "\tusing System.Web.Security;\n" +
+ "\tusing System.Web.SessionState;\n" +
+ "\tusing System.Web.UI;\n" +
+ "\tusing System.Web.UI.WebControls;\n" +
+ "\tusing System.Web.UI.HtmlControls;\n");
+
+ declarations.Append ("\t\tprivate static int __autoHandlers;\n");
+
+ current_function.Append ("\t\tprivate void __BuildControlTree (System.Web.UI.Control __ctrl)\n\t\t{\n");
+ if (!IsUserControl)
+ current_function.Append ("\t\t\tSystem.Web.UI.IParserAccessor __parser = " +
+ "(System.Web.UI.IParserAccessor) __ctrl;\n\n");
+ else
+ controls.UseCodeRender = true;
+ }
+
+ public StringReader GetCode ()
+ {
+ if (!parse_ok)
+ throw new ApplicationException ("You gotta call ProcessElements () first!");
+
+ StringBuilder code = new StringBuilder ();
+ for (int i = 0; i < parts.Length; i++)
+ code.Append ((StringBuilder) parts [i]);
+
+ return new StringReader (code.ToString ());
+ }
+
+ public void Print ()
+ {
+ if (!parse_ok){
+ Console.WriteLine ("//Warning!!!: Elements not correctly parsed.");
+ }
+
+ Console.Write (GetCode ().ReadToEnd ());
+ }
+
+ // Regex.Escape () make some illegal escape sequences for a C# source.
+ private string Escape (string input)
+ {
+ if (input == null)
+ return String.Empty;
+
+ string output = input.Replace ("\\", "\\\\");
+ output = output.Replace ("\"", "\\\"");
+ output = output.Replace ("\t", "\\t");
+ output = output.Replace ("\r", "\\r");
+ output = output.Replace ("\n", "\\n");
+ output = output.Replace ("\n", "\\n");
+ return output;
+ }
+
+ bool AddProtectedField (Type type, string fieldName)
+ {
+ if (parentType == null) {
+ declarations.AppendFormat ("\t\tprotected {0} {1};\n", type.ToString (), fieldName);
+ return true;
+ }
+
+ FieldInfo field = parentType.GetField (fieldName, BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance |
+ BindingFlags.Static);
+
+ if (field == null || (!field.IsPublic && !field.IsFamily)) {
+ declarations.AppendFormat ("\t\tprotected {0} {1};\n", type.ToString (), fieldName);
+ return true;
+ }
+
+ if (!field.FieldType.IsAssignableFrom (type)) {
+ string message = String.Format ("The base class includes the field '{0}', but its " +
+ "type '{1}' is not compatible with {2}",
+ fieldName, field.FieldType, type);
+
+ throw new ApplicationException (message);
+ }
+
+ return false;
+ }
+
+ private Type LoadParentType (string typeName)
+ {
+ // First try loaded assemblies, then try assemblies in Bin directory.
+ // By now i do this 'by hand' but may be this is a runtime/gac task.
+ Type type = null;
+ Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
+ foreach (Assembly ass in assemblies) {
+ type = ass.GetType (typeName);
+ if (type != null)
+ return type;
+ }
+
+ Assembly assembly;
+ string [] binDlls = Directory.GetFiles (privateBinPath, "*.dll");
+ foreach (string dll in binDlls) {
+ string dllPath = Path.Combine (privateBinPath, dll);
+ assembly = null;
+ try {
+ assembly = Assembly.LoadFrom (dllPath);
+ type = assembly.GetType (typeName);
+ } catch (Exception e) {
+ if (assembly != null) {
+ Console.WriteLine ("ASP.NET Warning: assembly {0} loaded", dllPath);
+ Console.WriteLine ("ASP.NET Warning: but type {0} not found", typeName);
+ } else {
+ Console.WriteLine ("ASP.NET Warning: unable to load type {0} from {1}",
+ typeName, dllPath);
+ }
+ Console.WriteLine ("ASP.NET Warning: error was: {0}", e.Message);
+ }
+
+ if (type != null)
+ return type;
+ }
+
+ return null;
+ }
+
+ private void PageDirective (TagAttributes att)
+ {
+ if (att ["ClassName"] != null){
+ this.className = (string) att ["ClassName"];
+ Options ["ClassName"] = className;
+ }
+
+ if (att ["EnableSessionState"] != null){
+ if (!IsPage)
+ throw new ApplicationException ("EnableSessionState not allowed here.");
+
+ string est = (string) att ["EnableSessionState"];
+ if (0 == String.Compare (est, "false", true))
+ sessionState = SessionState.Disabled;
+ else if (0 == String.Compare (est, "true", true))
+ sessionState = SessionState.Enabled;
+ else if (0 == String.Compare (est, "readonly", true))
+ sessionState = SessionState.ReadOnly;
+ else
+ throw new ApplicationException ("EnableSessionState in Page directive not set to " +
+ "a correct value: " + est);
+ }
+
+ if (att ["Inherits"] != null) {
+ parent = (string) att ["Inherits"];
+ parentType = LoadParentType (parent);
+ if (parentType == null)
+ throw new ApplicationException ("The class " + parent + " cannot be found.");
+ }
+
+ if (att ["CompilerOptions"] != null)
+ Options ["CompilerOptions"] = (string) att ["CompilerOptions"];
+
+ if (att ["AutoEventWireup"] != null) {
+ if (options ["AutoEventWireup"] != null)
+ throw new ApplicationException ("Already have an AutoEventWireup attribute");
+
+ bool autoevent = true;
+ string v = att ["AutoEventWireup"] as string;
+ try {
+ autoevent = Convert.ToBoolean (v);
+ } catch (Exception) {
+ throw new ApplicationException ("'" + v + "' is not a valid value for AutoEventWireup");
+ }
+ options ["AutoEventWireup"] = autoevent;
+ }
+
+ //FIXME: add support for more attributes.
+ }
+
+ void AddReference (string dll)
+ {
+ string references = Options ["References"] as string;
+ if (references == null)
+ references = dll;
+ else
+ references = references + " " + dll;
+
+ Options ["References"] = references;
+ }
+
+ private void RegisterDirective (TagAttributes att)
+ {
+ string tag_prefix = (string) (att ["tagprefix"] == null ? "" : att ["tagprefix"]);
+ string name_space = (string) (att ["namespace"] == null ? "" : att ["namespace"]);
+ string assembly_name = (string) (att ["assembly"] == null ? "" : att ["assembly"]);
+ string tag_name = (string) (att ["tagname"] == null ? "" : att ["tagname"]);
+ string src = (string) (att ["src"] == null ? "" : att ["src"]);
+
+ if (tag_prefix != "" && name_space != "" && assembly_name != ""){
+ if (tag_name != "" || src != "")
+ throw new ApplicationException ("Invalid attributes for @ Register: " +
+ att.ToString ());
+
+ AddUsing (name_space);
+ string dll = privateBinPath + Path.DirectorySeparatorChar + assembly_name + ".dll";
+ // Hack: it should use assembly.load semantics...
+ // may be when we don't run mcs as a external program...
+ if (!File.Exists (dll))
+ dll = assembly_name;
+
+ Foundry.RegisterFoundry (tag_prefix, dll, name_space);
+ AddReference (dll);
+ return;
+ }
+
+ if (tag_prefix != "" && tag_name != "" && src != ""){
+ if (name_space != "" && assembly_name != "")
+ throw new ApplicationException ("Invalid attributes for @ Register: " +
+ att.ToString ());
+
+ if (!src.EndsWith (".ascx"))
+ throw new ApplicationException ("Source file extension for controls " +
+ "must be .ascx");
+
+ UserControlData data = GenerateUserControl (src, Context);
+ switch (data.result) {
+ case UserControlResult.OK:
+ AddUsing ("ASP");
+ string dll = "output" + Path.DirectorySeparatorChar + data.assemblyName + ".dll";
+ Foundry.RegisterFoundry (tag_prefix, tag_name, data.assemblyName, "ASP", data.className);
+ AddReference (data.assemblyName);
+ break;
+ case UserControlResult.FileNotFound:
+ throw new ApplicationException ("File '" + src + "' not found.");
+ case UserControlResult.CompilationFailed:
+ //TODO: should say where the generated .cs file is for the server to
+ //show the source and the compiler error
+ throw new NotImplementedException ();
+ }
+ return;
+ }
+
+ throw new ApplicationException ("Invalid combination of attributes in " +
+ "@ Register: " + att.ToString ());
+ }
+
+ private void ProcessDirective ()
+ {
+ Directive directive = (Directive) elements.Current;
+ TagAttributes att = directive.Attributes;
+ if (att == null)
+ return;
+
+ string value;
+ string id = directive.TagID.ToUpper ();
+ switch (id){
+ case "APPLICATION":
+ if (main_directive != null)
+ throw new ApplicationException (id + " not allowed after " + main_directive);
+
+ if (!IsApplication)
+ throw new ApplicationException ("@Application not allowed.");
+
+ string inherits = att ["inherits"] as string;
+ if (inherits != null)
+ Options ["Inherits"] = inherits;
+
+ main_directive = directive.TagID;
+ break;
+ case "PAGE":
+ case "CONTROL":
+ if (main_directive != null)
+ throw new ApplicationException (id + " not allowed after " + main_directive);
+
+ if (IsUserControl && id != "CONTROL")
+ throw new ApplicationException ("@Page not allowed for user controls.");
+ else if (IsPage && id != "PAGE")
+ throw new ApplicationException ("@Control not allowed here. This is a page!");
+
+ PageDirective (att);
+ main_directive = directive.TagID;
+ break;
+ case "IMPORT":
+ value = att ["namespace"] as string;
+ if (value == null || att.Count > 1)
+ throw new ApplicationException ("Wrong syntax in Import directive.");
+
+ string _using = "using " + value + ";";
+ if (AddUsing (value) == true) {
+ string imports = Options ["Import"] as string;
+ if (imports == null) {
+ imports = value;
+ } else {
+ imports += "," + value;
+ }
+
+ Options ["Import"] = imports;
+ }
+ break;
+ case "IMPLEMENTS":
+ if (IsApplication)
+ throw new ApplicationException ("@ Implements not allowed in an application file.");
+
+ string iface = (string) att ["interface"];
+ AddInterface (iface);
+ break;
+ case "REGISTER":
+ if (IsApplication)
+ throw new ApplicationException ("@ Register not allowed in an application file.");
+
+ RegisterDirective (att);
+ break;
+ case "ASSEMBLY":
+ if (att.Count > 1)
+ throw new ApplicationException ("Wrong syntax in Assembly directive.");
+
+ string name = att ["name"] as string;
+ string src = att ["src"] as string;
+
+ if (name == null && src == null)
+ throw new ApplicationException ("Wrong syntax in Assembly directive.");
+
+ if (IsApplication && src != null)
+ throw new ApplicationException ("'name' attribute expected.");
+
+ value = (name == null) ? src : name;
+ string assemblies = Options ["Assembly"] as string;
+ if (assemblies == null) {
+ assemblies = value;
+ } else {
+ assemblies += "," + value;
+ }
+
+ Options ["Assembly"] = assemblies;
+ break;
+ }
+ }
+
+ private void ProcessPlainText ()
+ {
+ PlainText asis = (PlainText) elements.Current;
+ string trimmed = asis.Text.Trim ();
+ if (trimmed == String.Empty && controls.SpaceBetweenTags == true)
+ return;
+
+ if (IsApplication) {
+ if (trimmed != String.Empty)
+ throw new ApplicationException (app_file_wrong);
+ return;
+ }
+
+ if (trimmed != String.Empty && controls.PeekChildKind () != ChildrenKind.CONTROLS){
+ string tag_id = controls.PeekTagID ();
+ throw new ApplicationException ("Literal content not allowed for " + tag_id);
+ }
+
+ string escaped_text = Escape (asis.Text);
+ current_function.AppendFormat ("\t\t\t__parser.AddParsedSubObject (" +
+ "new System.Web.UI.LiteralControl (\"{0}\"));\n",
+ escaped_text);
+ StringBuilder codeRenderFunction = controls.CodeRenderFunction;
+ codeRenderFunction.AppendFormat ("\t\t\t__output.Write (\"{0}\");\n", escaped_text);
+ }
+
+ private string EnumValueNameToString (Type enum_type, string value_name)
+ {
+ if (value_name.EndsWith ("*"))
+ throw new ApplicationException ("Invalid property value: '" + value_name +
+ ". It must be a valid " + enum_type.ToString () + " value.");
+
+ MemberInfo [] nested_types = enum_type.FindMembers (MemberTypes.Field,
+ BindingFlags.Public | BindingFlags.Static,
+ Type.FilterNameIgnoreCase,
+ value_name);
+
+ if (nested_types.Length == 0)
+ throw new ApplicationException ("Value " + value_name + " not found in enumeration " +
+ enum_type.ToString ());
+ if (nested_types.Length > 1)
+ throw new ApplicationException ("Value " + value_name + " found " +
+ nested_types.Length + " in enumeration " +
+ enum_type.ToString ());
+
+ return enum_type.ToString () + "." + nested_types [0].Name;
+ }
+
+ private void NewControlFunction (string tag_id,
+ string control_id,
+ Type control_type,
+ ChildrenKind children_kind,
+ string defaultPropertyName)
+ {
+ ChildrenKind prev_children_kind = controls.PeekChildKind ();
+ if (prev_children_kind == ChildrenKind.NONE ||
+ prev_children_kind == ChildrenKind.PROPERTIES){
+ string prev_tag_id = controls.PeekTagID ();
+ throw new ApplicationException ("Child controls not allowed for " + prev_tag_id);
+ }
+
+ if (prev_children_kind == ChildrenKind.DBCOLUMNS &&
+ control_type != typeof (System.Web.UI.WebControls.DataGridColumn) &&
+ !control_type.IsSubclassOf (typeof (System.Web.UI.WebControls.DataGridColumn)))
+ throw new ApplicationException ("Inside " + controls.PeekTagID () + " only " +
+ "System.Web.UI.WebControls.DataGridColum " +
+ "objects are allowed");
+ else if (prev_children_kind == ChildrenKind.LISTITEM &&
+ control_type != typeof (System.Web.UI.WebControls.ListItem))
+ throw new ApplicationException ("Inside " + controls.PeekTagID () + " only " +
+ "System.Web.UI.WebControls.ListItem " +
+ "objects are allowed");
+ else if (prev_children_kind == ChildrenKind.HTMLROW &&
+ control_type != typeof (System.Web.UI.HtmlControls.HtmlTableRow))
+ throw new ApplicationException ("Inside " + controls.PeekTagID () + " only " +
+ "System.Web.UI.HtmlControls.HtmlTableRow " +
+ "objects are allowed");
+ else if (prev_children_kind == ChildrenKind.HTMLCELL &&
+ control_type != typeof (System.Web.UI.HtmlControls.HtmlTableCell))
+ throw new ApplicationException ("Inside " + controls.PeekTagID () + " only " +
+ "System.Web.UI.HtmlControls.HtmlTableCell " +
+ "objects are allowed");
+
+
+ StringBuilder func_code = new StringBuilder ();
+ current_function = func_code;
+ if (0 == String.Compare (tag_id, "form", true)){
+ if (has_form_tag)
+ throw new ApplicationException ("Only one form server tag allowed.");
+ has_form_tag = true;
+ }
+
+ controls.Push (control_type, control_id, tag_id, children_kind, defaultPropertyName);
+ bool is_generic = control_type == typeof (System.Web.UI.HtmlControls.HtmlGenericControl);
+ functions.Push (current_function);
+ if (control_type != typeof (System.Web.UI.WebControls.ListItem) &&
+ prev_children_kind != ChildrenKind.DBCOLUMNS) {
+ current_function.AppendFormat ("\t\tprivate System.Web.UI.Control __BuildControl_" +
+ "{0} ()\n\t\t{{\n\t\t\t{1} __ctrl;\n\n\t\t\t__ctrl" +
+ " = new {1} ({2});\n\t\t\tthis.{0} = __ctrl;\n",
+ control_id, control_type,
+ (is_generic? "\"" + tag_id + "\"" : ""));
+ } else {
+ current_function.AppendFormat ("\t\tprivate void __BuildControl_{0} ()\n\t\t{{" +
+ "\n\t\t\t{1} __ctrl;\n\t\t\t__ctrl = new {1} ();" +
+ "\n\t\t\tthis.{0} = __ctrl;\n",
+ control_id, control_type);
+ }
+
+ if (children_kind == ChildrenKind.CONTROLS || children_kind == ChildrenKind.OPTION)
+ current_function.Append ("\t\t\tSystem.Web.UI.IParserAccessor __parser = " +
+ "(System.Web.UI.IParserAccessor) __ctrl;\n");
+ }
+
+ private void DataBoundProperty (Type target, string varName, string value)
+ {
+ if (value == "")
+ throw new ApplicationException ("Empty data binding tag.");
+
+ string control_id = controls.PeekControlID ();
+ string control_type_string = controls.PeekType ().ToString ();
+ StringBuilder db_function = controls.DataBindFunction;
+ string container;
+ if (controls.Container == null || !typeof (INamingContainer).IsAssignableFrom (controls.Container))
+ container = "System.Web.UI.Control";
+ else {
+ container = controls.Container.ToString ();
+ }
+
+ if (db_function.Length == 0)
+ db_function.AppendFormat ("\t\tpublic void __DataBind_{0} (object sender, " +
+ "System.EventArgs e) {{\n" +
+ "\t\t\t{1} Container;\n" +
+ "\t\t\t{2} target;\n" +
+ "\t\t\ttarget = ({2}) sender;\n" +
+ "\t\t\tContainer = ({1}) target.BindingContainer;\n",
+ control_id, container, control_type_string);
+
+ /* Removes '<%#' and '%>' */
+ string real_value = value.Remove (0,3);
+ real_value = real_value.Remove (real_value.Length - 2, 2);
+ real_value = real_value.Trim ();
+
+ if (target == typeof (string))
+ db_function.AppendFormat ("\t\t\ttarget.{0} = System.Convert.ToString ({1});\n",
+ varName, real_value);
+ else
+ db_function.AppendFormat ("\t\t\ttarget.{0} = ({1}) ({2});\n",
+ varName, target, real_value);
+ }
+
+ /*
+ * Returns true if it generates some code for the specified property
+ */
+ private void AddCodeForPropertyOrField (Type type, string var_name, string att, bool isDataBound)
+ {
+ /* FIXME: should i check for this or let the compiler fail?
+ * if (!prop.CanWrite)
+ * ....
+ */
+ if (isDataBound) {
+ DataBoundProperty (type, var_name, att);
+ }
+ else if (type == typeof (string)){
+ if (att == null)
+ throw new ApplicationException ("null value for attribute " + var_name );
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = \"{1}\";\n", var_name,
+ Escape (att)); // FIXME: really Escape this?
+ }
+ else if (type.IsEnum){
+ if (att == null)
+ throw new ApplicationException ("null value for attribute " + var_name );
+
+ string enum_value = EnumValueNameToString (type, att);
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = {1};\n", var_name, enum_value);
+ }
+ else if (type == typeof (bool)){
+ string value;
+ if (att == null)
+ value = "true"; //FIXME: is this ok for non Style properties?
+ else if (0 == String.Compare (att, "true", true))
+ value = "true";
+ else if (0 == String.Compare (att, "false", true))
+ value = "false";
+ else
+ throw new ApplicationException ("Value '" + att + "' is not a valid boolean.");
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = {1};\n", var_name, value);
+ }
+ else if (type == typeof (System.Web.UI.WebControls.Unit)){
+ //FIXME: should use the culture specified in Page
+ try {
+ Unit value = Unit.Parse (att, System.Globalization.CultureInfo.InvariantCulture);
+ } catch (Exception) {
+ throw new ApplicationException ("'" + att + "' cannot be parsed as a unit.");
+ }
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = " +
+ "System.Web.UI.WebControls.Unit.Parse (\"{1}\", " +
+ "System.Globalization.CultureInfo.InvariantCulture);\n",
+ var_name, att);
+ }
+ else if (type == typeof (System.Web.UI.WebControls.FontUnit)){
+ //FIXME: should use the culture specified in Page
+ try {
+ FontUnit value = FontUnit.Parse (att, System.Globalization.CultureInfo.InvariantCulture);
+ } catch (Exception) {
+ throw new ApplicationException ("'" + att + "' cannot be parsed as a unit.");
+ }
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = " +
+ "System.Web.UI.WebControls.FontUnit.Parse (\"{1}\", " +
+ "System.Globalization.CultureInfo.InvariantCulture);\n",
+ var_name, att);
+ }
+ else if (type == typeof (Int16) || type == typeof (Int32) || type == typeof (Int64)) {
+ long value;
+ try {
+ value = Int64.Parse (att); //FIXME: should use the culture specified in Page
+ } catch (Exception){
+ throw new ApplicationException (att + " is not a valid signed number " +
+ "or is out of range.");
+ }
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = {1};\n", var_name, value);
+ }
+ else if (type == typeof (UInt16) || type == typeof (UInt32) || type == typeof (UInt64)) {
+ ulong value;
+ try {
+ value = UInt64.Parse (att); //FIXME: should use the culture specified in Page
+ } catch (Exception){
+ throw new ApplicationException (att + " is not a valid unsigned number " +
+ "or is out of range.");
+ }
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = {1};\n", var_name, value);
+ }
+ else if (type == typeof (float)) {
+ float value;
+ try {
+ value = Single.Parse (att);
+ } catch (Exception){
+ throw new ApplicationException (att + " is not avalid float number or " +
+ "is out of range.");
+ }
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = {1};\n", var_name, value);
+ }
+ else if (type == typeof (double)){
+ double value;
+ try {
+ value = Double.Parse (att);
+ } catch (Exception){
+ throw new ApplicationException (att + " is not avalid double number or " +
+ "is out of range.");
+ }
+
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = {1};\n", var_name, value);
+ }
+ else if (type == typeof (System.Drawing.Color)){
+ Color c;
+ try {
+ c = (Color) TypeDescriptor.GetConverter (typeof (Color)).ConvertFromString (att);
+ } catch (Exception e){
+ throw new ApplicationException ("Color " + att + " is not a valid color.", e);
+ }
+
+ // Should i also test for IsSystemColor?
+ // Are KnownColor members in System.Drawing.Color?
+ if (c.IsKnownColor){
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = System.Drawing.Color." +
+ "{1};\n", var_name, c.Name);
+ }
+ else {
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = System.Drawing.Color." +
+ "FromArgb ({1}, {2}, {3}, {4});\n",
+ var_name, c.A, c.R, c.G, c.B);
+ }
+ }
+ else {
+ throw new ApplicationException ("Unsupported type in property: " +
+ type.ToString ());
+ }
+ }
+
+ private bool ProcessPropertiesAndFields (MemberInfo member, string id, TagAttributes att)
+ {
+ int hyphen = id.IndexOf ('-');
+
+ bool isPropertyInfo = (member is PropertyInfo);
+
+ bool is_processed = false;
+ bool isDataBound = att.IsDataBound ((string) att [id]);
+ Type type;
+ if (isPropertyInfo) {
+ type = ((PropertyInfo) member).PropertyType;
+ if (hyphen == -1 && ((PropertyInfo) member).CanWrite == false)
+ return false;
+ } else {
+ type = ((FieldInfo) member).FieldType;
+ }
+
+ if (0 == String.Compare (member.Name, id, true)){
+ AddCodeForPropertyOrField (type, member.Name, (string) att [id], isDataBound);
+ is_processed = true;
+ } else if (hyphen != -1 && (type == fontinfoType || type == styleType || type.IsSubclassOf (styleType))){
+ string prop_field = id.Replace ("-", ".");
+ string [] parts = prop_field.Split (new char [] {'.'});
+ if (parts.Length != 2 || 0 != String.Compare (member.Name, parts [0], true))
+ return false;
+
+ PropertyInfo [] subprops = type.GetProperties ();
+ foreach (PropertyInfo subprop in subprops){
+ if (0 != String.Compare (subprop.Name, parts [1], true))
+ continue;
+
+ if (subprop.CanWrite == false)
+ return false;
+
+ bool is_bool = subprop.PropertyType == typeof (bool);
+ if (!is_bool && att [id] == null){
+ att [id] = ""; // Font-Size -> Font-Size="" as html
+ return false;
+ }
+
+ string value;
+ if (att [id] == null && is_bool)
+ value = "true"; // Font-Bold <=> Font-Bold="true"
+ else
+ value = (string) att [id];
+
+ AddCodeForPropertyOrField (subprop.PropertyType,
+ member.Name + "." + subprop.Name,
+ value, isDataBound);
+ is_processed = true;
+ }
+ }
+
+ return is_processed;
+ }
+
+ private void AddCodeForAttributes (Type type, TagAttributes att)
+ {
+ EventInfo [] ev_info = type.GetEvents ();
+ PropertyInfo [] prop_info = type.GetProperties ();
+ FieldInfo [] field_info = type.GetFields ();
+ bool is_processed = false;
+ ArrayList processed = new ArrayList ();
+
+ foreach (string id in att.Keys){
+ if (0 == String.Compare (id, "runat", true) || 0 == String.Compare (id, "id", true))
+ continue;
+
+ if (id.Length > 2 && id.Substring (0, 2).ToUpper () == "ON"){
+ string id_as_event = id.Substring (2);
+ foreach (EventInfo ev in ev_info){
+ if (0 == String.Compare (ev.Name, id_as_event, true)){
+ current_function.AppendFormat (
+ "\t\t\t__ctrl.{0} += " +
+ "new {1} (this.{2});\n",
+ ev.Name, ev.EventHandlerType, att [id]);
+ is_processed = true;
+ break;
+ }
+ }
+ if (is_processed){
+ is_processed = false;
+ continue;
+ }
+ }
+
+ foreach (PropertyInfo prop in prop_info){
+ is_processed = ProcessPropertiesAndFields (prop, id, att);
+ if (is_processed)
+ break;
+ }
+
+ if (!is_processed) {
+ foreach (FieldInfo field in field_info){
+ is_processed = ProcessPropertiesAndFields (field, id, att);
+ if (is_processed)
+ break;
+ }
+ }
+
+ if (is_processed){
+ is_processed = false;
+ continue;
+ }
+
+ current_function.AppendFormat ("\t\t\t((System.Web.UI.IAttributeAccessor) __ctrl)." +
+ "SetAttribute (\"{0}\", \"{1}\");\n",
+ id, Escape ((string) att [id]));
+ }
+ }
+
+ private void AddCodeRenderControl (StringBuilder function)
+ {
+ AddCodeRenderControl (function, controls.CodeRenderIndex);
+ }
+
+ private void AddCodeRenderControl (StringBuilder function, int index)
+ {
+ function.AppendFormat ("\t\t\tparameterContainer.Controls [{0}]." +
+ "RenderControl (__output);\n", index);
+ }
+
+ private void AddRenderMethodDelegate (StringBuilder function, string control_id)
+ {
+ function.AppendFormat ("\t\t\t__ctrl.SetRenderMethodDelegate (new System.Web." +
+ "UI.RenderMethod (this.__Render_{0}));\n", control_id);
+ }
+
+ private void AddCodeRenderFunction (string codeRender, string control_id)
+ {
+ StringBuilder codeRenderFunction = new StringBuilder ();
+ codeRenderFunction.AppendFormat ("\t\tprivate void __Render_{0} " +
+ "(System.Web.UI.HtmlTextWriter __output, " +
+ "System.Web.UI.Control parameterContainer)\n" +
+ "\t\t{{\n", control_id);
+ codeRenderFunction.Append (codeRender);
+ codeRenderFunction.Append ("\t\t}\n\n");
+ init_funcs.Append (codeRenderFunction);
+ }
+
+ private void RemoveLiterals (StringBuilder function)
+ {
+ string no_literals = Regex.Replace (function.ToString (),
+ @"\t\t\t__parser.AddParsedSubObject \(" +
+ @"new System.Web.UI.LiteralControl \(.+\);\n", "");
+ function.Length = 0;
+ function.Append (no_literals);
+ }
+
+ private bool FinishControlFunction (string tag_id)
+ {
+ if (functions.Count == 0)
+ throw new ApplicationException ("Unbalanced open/close tags");
+
+ if (controls.Count == 0)
+ return false;
+
+ string saved_id = controls.PeekTagID ();
+ if (0 != String.Compare (saved_id, tag_id, true))
+ return false;
+
+ StringBuilder old_function = (StringBuilder) functions.Pop ();
+ current_function = (StringBuilder) functions.Peek ();
+
+ string control_id = controls.PeekControlID ();
+ Type control_type = controls.PeekType ();
+ ChildrenKind child_kind = controls.PeekChildKind ();
+
+ bool hasDataBindFunction = controls.HasDataBindFunction ();
+ if (hasDataBindFunction)
+ old_function.AppendFormat ("\t\t\t__ctrl.DataBinding += new System.EventHandler " +
+ "(this.__DataBind_{0});\n", control_id);
+
+ bool useCodeRender = controls.UseCodeRender;
+ if (useCodeRender)
+ AddRenderMethodDelegate (old_function, control_id);
+
+ if (control_type == typeof (System.Web.UI.ITemplate)){
+ old_function.Append ("\n\t\t}\n\n");
+ current_function.AppendFormat ("\t\t\t__ctrl.{0} = new System.Web.UI." +
+ "CompiledTemplateBuilder (new System.Web.UI." +
+ "BuildTemplateMethod (this.__BuildControl_{1}));\n",
+ saved_id, control_id);
+ }
+ else if (control_type == typeof (System.Web.UI.WebControls.DataGridColumnCollection)){
+ old_function.Append ("\n\t\t}\n\n");
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} (__ctrl.{1});\n",
+ control_id, saved_id);
+ }
+ else if (control_type == typeof (System.Web.UI.WebControls.DataGridColumn) ||
+ control_type.IsSubclassOf (typeof (System.Web.UI.WebControls.DataGridColumn)) ||
+ control_type == typeof (System.Web.UI.WebControls.ListItem)){
+ old_function.Append ("\n\t\t}\n\n");
+ string parsed = "";
+ string ctrl_name = "ctrl";
+ Type cont = controls.Container;
+ if (cont == null || cont == typeof (System.Web.UI.HtmlControls.HtmlSelect)){
+ parsed = "ParsedSubObject";
+ ctrl_name = "parser";
+ }
+
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} ();\n" +
+ "\t\t\t__{1}.Add{2} (this.{0});\n\n",
+ control_id, ctrl_name, parsed);
+ }
+ else if (child_kind == ChildrenKind.LISTITEM){
+ old_function.Append ("\n\t\t}\n\n");
+ init_funcs.Append (old_function); // Closes the BuildList function
+ old_function = (StringBuilder) functions.Pop ();
+ current_function = (StringBuilder) functions.Peek ();
+ old_function.AppendFormat ("\n\t\t\tthis.__BuildControl_{0} (__ctrl.{1});\n\t\t\t" +
+ "return __ctrl;\n\t\t}}\n\n",
+ control_id, controls.PeekDefaultPropertyName ());
+
+ controls.Pop ();
+ control_id = controls.PeekControlID ();
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} ();\n\t\t\t__parser." +
+ "AddParsedSubObject (this.{0});\n\n", control_id);
+ } else if (control_type == typeof (HtmlTableCell)) {
+ old_function.Append ("\n\t\t\treturn __ctrl;\n\t\t}\n\n");
+ object top = controls.Pop ();
+ Type t = controls.PeekType ();
+ controls.Push (top);
+ string parsed = "";
+ string ctrl_name = "ctrl";
+ if (t != typeof (HtmlTableRow)) {
+ parsed = "ParsedSubObject";
+ ctrl_name = "parser";
+ }
+
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} ();\n" +
+ "\t\t\t__{1}.Add{2} (this.{0});\n\n",
+ control_id, ctrl_name, parsed);
+ } else if (child_kind == ChildrenKind.HTMLROW || child_kind == ChildrenKind.HTMLCELL) {
+ old_function.Append ("\n\t\t}\n\n");
+ init_funcs.Append (old_function);
+ old_function = (StringBuilder) functions.Pop ();
+ current_function = (StringBuilder) functions.Peek ();
+ old_function.AppendFormat ("\n\t\t\tthis.__BuildControl_{0} (__ctrl.{1});\n\t\t\t" +
+ "return __ctrl;\n\t\t}}\n\n",
+ control_id, controls.PeekDefaultPropertyName ());
+
+ controls.Pop ();
+ control_id = controls.PeekControlID ();
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} ();\n", control_id);
+ if (child_kind == ChildrenKind.HTMLROW) {
+ current_function.AppendFormat ("\t\t\t__parser.AddParsedSubObject ({0});\n",
+ control_id);
+ } else {
+ current_function.AppendFormat ("\t\t\t__ctrl.Add (this.{0});\n", control_id);
+ }
+ } else {
+ old_function.Append ("\n\t\t\treturn __ctrl;\n\t\t}\n\n");
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} ();\n\t\t\t__parser." +
+ "AddParsedSubObject (this.{0});\n\n", control_id);
+ }
+
+ if (useCodeRender)
+ RemoveLiterals (old_function);
+
+ init_funcs.Append (old_function);
+ if (useCodeRender)
+ AddCodeRenderFunction (controls.CodeRenderFunction.ToString (), control_id);
+
+ if (hasDataBindFunction){
+ StringBuilder db_function = controls.DataBindFunction;
+ db_function.Append ("\t\t}\n\n");
+ init_funcs.Append (db_function);
+ }
+
+ // Avoid getting empty stacks for unbalanced open/close tags
+ if (controls.Count > 1){
+ controls.Pop ();
+ AddCodeRenderControl (controls.CodeRenderFunction, controls.ChildIndex);
+ }
+
+ return true;
+ }
+
+ private void NewTableElementFunction (HtmlControlTag ctrl)
+ {
+ string control_id = Tag.GetDefaultID ();
+ ChildrenKind child_kind;
+
+ Type t;
+ if (ctrl.ControlType == typeof (HtmlTable)) {
+ t = typeof (HtmlTableRowCollection);
+ child_kind = ChildrenKind.HTMLROW;
+ } else {
+ t = typeof (HtmlTableCellCollection);
+ child_kind = ChildrenKind.HTMLCELL;
+ }
+
+ controls.Push (ctrl.ControlType,
+ control_id,
+ ctrl.TagID,
+ child_kind,
+ ctrl.ParseChildren);
+
+
+ current_function = new StringBuilder ();
+ functions.Push (current_function);
+ current_function.AppendFormat ("\t\tprivate void __BuildControl_{0} ({1} __ctrl)\n" +
+ "\t\t{{\n", control_id, t);
+ }
+
+ private void ProcessHtmlControlTag ()
+ {
+ HtmlControlTag html_ctrl = (HtmlControlTag) elements.Current;
+ if (html_ctrl.TagID.ToUpper () == "SCRIPT"){
+ //FIXME: if the is script is to be read from disk, do it!
+ if (html_ctrl.SelfClosing)
+ throw new ApplicationException ("Read script from file not supported yet.");
+
+ if (elements.MoveNext () == false)
+ throw new ApplicationException ("Error after " + html_ctrl.ToString ());
+
+ if (elements.Current is PlainText){
+ script.Append (((PlainText) elements.Current).Text);
+ if (!elements.MoveNext ())
+ throw new ApplicationException ("Error after " +
+ elements.Current.ToString ());
+ }
+
+ if (elements.Current is CloseTag)
+ elements.MoveNext ();
+ return;
+ } else if (IsApplication) {
+ throw new ApplicationException (app_file_wrong);
+ }
+
+ Type controlType = html_ctrl.ControlType;
+ AddProtectedField (controlType, html_ctrl.ControlID);
+
+ ChildrenKind children_kind;
+ if (0 == String.Compare (html_ctrl.TagID, "table", true))
+ children_kind = ChildrenKind.HTMLROW;
+ else if (0 == String.Compare (html_ctrl.TagID, "tr", true))
+ children_kind = ChildrenKind.HTMLCELL;
+ else if (0 != String.Compare (html_ctrl.TagID, "select", true))
+ children_kind = html_ctrl.IsContainer ? ChildrenKind.CONTROLS :
+ ChildrenKind.NONE;
+ else
+ children_kind = ChildrenKind.OPTION;
+
+ NewControlFunction (html_ctrl.TagID, html_ctrl.ControlID, controlType, children_kind, html_ctrl.ParseChildren);
+
+ current_function.AppendFormat ("\t\t\t__ctrl.ID = \"{0}\";\n", html_ctrl.ControlID);
+ AddCodeForAttributes (html_ctrl.ControlType, html_ctrl.Attributes);
+
+ if (children_kind == ChildrenKind.HTMLROW || children_kind == ChildrenKind.HTMLCELL)
+ NewTableElementFunction (html_ctrl);
+
+ if (!html_ctrl.SelfClosing)
+ JustDoIt ();
+ else
+ FinishControlFunction (html_ctrl.TagID);
+ }
+
+ // Closing is performed in FinishControlFunction ()
+ private void NewBuildListFunction (AspComponent component)
+ {
+ string control_id = Tag.GetDefaultID ();
+
+ controls.Push (component.ComponentType,
+ control_id,
+ component.TagID,
+ ChildrenKind.LISTITEM,
+ component.DefaultPropertyName);
+
+ current_function = new StringBuilder ();
+ functions.Push (current_function);
+ current_function.AppendFormat ("\t\tprivate void __BuildControl_{0} " +
+ "(System.Web.UI.WebControls.ListItemCollection __ctrl)\n" +
+ "\t\t{{\n", control_id);
+ }
+
+ private void ProcessComponent ()
+ {
+ AspComponent component = (AspComponent) elements.Current;
+ Type component_type = component.ComponentType;
+ AddProtectedField (component_type, component.ControlID);
+
+ NewControlFunction (component.TagID, component.ControlID, component_type,
+ component.ChildrenKind, component.DefaultPropertyName);
+
+ if (component_type == typeof (UserControl) ||
+ component_type.IsSubclassOf (typeof (System.Web.UI.UserControl)))
+ current_function.Append ("\t\t\t__ctrl.InitializeAsUserControl (Page);\n");
+
+ if (component_type == typeof (Control) ||
+ component_type.IsSubclassOf (typeof (System.Web.UI.Control)))
+ current_function.AppendFormat ("\t\t\t__ctrl.ID = \"{0}\";\n", component.ControlID);
+
+ AddCodeForAttributes (component.ComponentType, component.Attributes);
+ if (component.ChildrenKind == ChildrenKind.LISTITEM)
+ NewBuildListFunction (component);
+
+ if (!component.SelfClosing)
+ JustDoIt ();
+ else
+ FinishControlFunction (component.TagID);
+ }
+
+ private void ProcessServerObjectTag ()
+ {
+ ServerObjectTag obj = (ServerObjectTag) elements.Current;
+ declarations.AppendFormat ("\t\tprivate {0} cached{1};\n", obj.ObjectClass, obj.ObjectID);
+ constructor.AppendFormat ("\n\t\tprivate {0} {1}\n\t\t{{\n\t\t\tget {{\n\t\t\t\t" +
+ "if (this.cached{1} == null)\n\t\t\t\t\tthis.cached{1} = " +
+ "new {0} ();\n\t\t\t\treturn cached{1};\n\t\t\t}}\n\t\t}}\n\n",
+ obj.ObjectClass, obj.ObjectID);
+ }
+
+ // Creates a new function that sets the values of subproperties.
+ private void NewStyleFunction (PropertyTag tag)
+ {
+ current_function = new StringBuilder ();
+
+ string prop_id = tag.PropertyID;
+ Type prop_type = tag.PropertyType;
+ // begin function
+ current_function.AppendFormat ("\t\tprivate void __BuildControl_{0} ({1} __ctrl)\n" +
+ "\t\t{{\n", prop_id, prop_type);
+
+ // Add property initialization code
+ PropertyInfo [] subprop_info = prop_type.GetProperties ();
+ TagAttributes att = tag.Attributes;
+
+ string subprop_name = null;
+ foreach (string id in att.Keys){
+ if (0 == String.Compare (id, "runat", true) || 0 == String.Compare (id, "id", true))
+ continue;
+
+ bool is_processed = false;
+ foreach (PropertyInfo subprop in subprop_info){
+ is_processed = ProcessPropertiesAndFields (subprop, id, att);
+ if (is_processed){
+ subprop_name = subprop.Name;
+ break;
+ }
+ }
+
+ if (subprop_name == null)
+ throw new ApplicationException ("Property " + tag.TagID + " does not have " +
+ "a " + id + " subproperty.");
+ }
+
+ // Finish function
+ current_function.Append ("\n\t\t}\n\n");
+ init_funcs.Append (current_function);
+ current_function = (StringBuilder) functions.Peek ();
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} (__ctrl.{1});\n",
+ prop_id, tag.PropertyName);
+
+ if (!tag.SelfClosing){
+ // Next tag should be the closing tag
+ controls.Push (null, null, null, ChildrenKind.NONE, null);
+ bool closing_tag_found = false;
+ Element elem;
+ while (!closing_tag_found && elements.MoveNext ()){
+ elem = (Element) elements.Current;
+ if (elem is PlainText)
+ ProcessPlainText ();
+ else if (!(elem is CloseTag))
+ throw new ApplicationException ("Tag " + tag.TagID +
+ " not properly closed.");
+ else
+ closing_tag_found = true;
+ }
+
+ if (!closing_tag_found)
+ throw new ApplicationException ("Tag " + tag.TagID + " not properly closed.");
+
+ controls.Pop ();
+ }
+ }
+
+ // This one just opens the function. Closing is performed in FinishControlFunction ()
+ private void NewTemplateFunction (PropertyTag tag)
+ {
+ /*
+ * FIXME
+ * This function does almost the same as NewControlFunction.
+ * Consider merging.
+ */
+ string prop_id = tag.PropertyID;
+ Type prop_type = tag.PropertyType;
+ string tag_id = tag.PropertyName; // Real property name used in FinishControlFunction
+
+ controls.Push (prop_type, prop_id, tag_id, ChildrenKind.CONTROLS, null);
+ current_function = new StringBuilder ();
+ functions.Push (current_function);
+ current_function.AppendFormat ("\t\tprivate void __BuildControl_{0} " +
+ "(System.Web.UI.Control __ctrl)\n" +
+ "\t\t{{\n" +
+ "\t\t\tSystem.Web.UI.IParserAccessor __parser " +
+ "= (System.Web.UI.IParserAccessor) __ctrl;\n" , prop_id);
+ }
+
+ // Closing is performed in FinishControlFunction ()
+ private void NewDBColumnFunction (PropertyTag tag)
+ {
+ /*
+ * FIXME
+ * This function also does almost the same as NewControlFunction.
+ * Consider merging.
+ */
+ string prop_id = tag.PropertyID;
+ Type prop_type = tag.PropertyType;
+ string tag_id = tag.PropertyName; // Real property name used in FinishControlFunction
+
+ controls.Push (prop_type, prop_id, tag_id, ChildrenKind.DBCOLUMNS, null);
+ current_function = new StringBuilder ();
+ functions.Push (current_function);
+ current_function.AppendFormat ("\t\tprivate void __BuildControl_{0} " +
+ "(System.Web.UI.WebControls.DataGridColumnCollection __ctrl)\n" +
+ "\t\t{{\n", prop_id);
+ }
+
+ private void NewPropertyFunction (PropertyTag tag)
+ {
+ if (tag.PropertyType == typeof (System.Web.UI.WebControls.Style) ||
+ tag.PropertyType.IsSubclassOf (typeof (System.Web.UI.WebControls.Style)))
+ NewStyleFunction (tag);
+ else if (tag.PropertyType == typeof (System.Web.UI.ITemplate))
+ NewTemplateFunction (tag);
+ else if (tag.PropertyType == typeof (System.Web.UI.WebControls.DataGridColumnCollection))
+ NewDBColumnFunction (tag);
+ else
+ throw new ApplicationException ("Other than Style and ITemplate not supported yet. " +
+ tag.PropertyType);
+ }
+
+ private void ProcessHtmlTag ()
+ {
+ Tag tag = (Tag) elements.Current;
+ ChildrenKind child_kind = controls.PeekChildKind ();
+ if (child_kind == ChildrenKind.NONE){
+ string tag_id = controls.PeekTagID ();
+ throw new ApplicationException (tag + " not allowed inside " + tag_id);
+ }
+
+ if (child_kind == ChildrenKind.OPTION){
+ if (0 != String.Compare (tag.TagID, "option", true))
+ throw new ApplicationException ("Only <option> tags allowed inside <select>.");
+
+ string default_id = Tag.GetDefaultID ();
+ Type type = typeof (System.Web.UI.WebControls.ListItem);
+ AddProtectedField (type, default_id);
+ NewControlFunction (tag.TagID, default_id, type, ChildrenKind.CONTROLS, null);
+ return;
+ }
+
+ if (child_kind == ChildrenKind.CONTROLS) {
+ ArrayList tag_elements = tag.GetElements ();
+ foreach (Element e in tag_elements) {
+ if (e is PlainText) {
+ elements.Current = e;
+ ProcessPlainText ();
+ } else if (e is CodeRenderTag) {
+ elements.Current = e;
+ ProcessCodeRenderTag ();
+ } else if (e is DataBindingTag) {
+ elements.Current = e;
+ ProcessDataBindingLiteral ();
+ } else {
+ throw new ApplicationException (fullPath + ": unexpected tag type " + e.GetType ());
+ }
+ }
+ return;
+ }
+
+ if (child_kind == ChildrenKind.HTMLROW) {
+ if (0 == String.Compare (tag.TagID, "tr", true)) {
+ elements.Current = new HtmlControlTag (tag);
+ ProcessHtmlControlTag ();
+ return;
+ }
+ }
+
+ if (child_kind == ChildrenKind.HTMLCELL) {
+ if (0 == String.Compare (tag.TagID, "td", true)) {
+ elements.Current = new HtmlControlTag (tag);
+ ProcessHtmlControlTag ();
+ return;
+ }
+ }
+
+ // Now child_kind should be PROPERTIES, so only allow tag_id == property
+ Type control_type = controls.PeekType ();
+ PropertyInfo [] prop_info = control_type.GetProperties ();
+ bool is_processed = false;
+ foreach (PropertyInfo prop in prop_info){
+ if (0 == String.Compare (prop.Name, tag.TagID, true)){
+ PropertyTag prop_tag = new PropertyTag (tag, prop.PropertyType, prop.Name);
+ NewPropertyFunction (prop_tag);
+ is_processed = true;
+ break;
+ }
+ }
+
+ if (!is_processed){
+ string tag_id = controls.PeekTagID ();
+ throw new ApplicationException (tag.TagID + " is not a property of " + control_type);
+ }
+ }
+
+ private Tag Map (Tag tag)
+ {
+ int pos = tag.TagID.IndexOf (":");
+ if (pos == -1) {
+ ChildrenKind child_kind = controls.PeekChildKind ();
+ if (child_kind == ChildrenKind.HTMLROW && 0 == String.Compare (tag.TagID, "tr", true)) {
+ tag.Attributes.Add ("runat", "server");
+ return new HtmlControlTag (tag);
+ } else if (child_kind == ChildrenKind.HTMLROW && 0 == String.Compare (tag.TagID, "tr", true)) {
+ tag.Attributes.Add ("runat", "server");
+ return new HtmlControlTag (tag);
+ }
+ }
+
+ if (tag is CloseTag ||
+ ((tag.Attributes == null ||
+ !tag.Attributes.IsRunAtServer ()) && pos == -1))
+ return tag;
+
+ if (pos == -1){
+ if (0 == String.Compare (tag.TagID, "object", true))
+ return new ServerObjectTag (tag);
+
+ return new HtmlControlTag (tag);
+ }
+
+ string foundry_name = tag.TagID.Substring (0, pos);
+ string component_name = tag.TagID.Substring (pos + 1);
+
+ if (Foundry.LookupFoundry (foundry_name) == false)
+ throw new ApplicationException ("Cannot find foundry for alias'" + foundry_name + "'");
+
+ AspComponent component = Foundry.MakeAspComponent (foundry_name, component_name, tag);
+ if (component == null)
+ throw new ApplicationException ("Cannot find component '" + component_name +
+ "' for alias '" + foundry_name + "'");
+
+ return component;
+ }
+
+ private void ProcessCloseTag ()
+ {
+ CloseTag close_tag = (CloseTag) elements.Current;
+ if (FinishControlFunction (close_tag.TagID))
+ return;
+
+ elements.Current = new PlainText (close_tag.PlainHtml);
+ ProcessPlainText ();
+ }
+
+ private void ProcessDataBindingLiteral ()
+ {
+ DataBindingTag dataBinding = (DataBindingTag) elements.Current;
+ string actual_value = dataBinding.Data;
+ if (actual_value == "")
+ throw new ApplicationException ("Empty data binding tag.");
+
+ if (controls.PeekChildKind () != ChildrenKind.CONTROLS)
+ throw new ApplicationException ("Data bound content not allowed for " +
+ controls.PeekTagID ());
+
+ StringBuilder db_function = new StringBuilder ();
+ string control_id = Tag.GetDefaultID ();
+ string control_type_string = "System.Web.UI.DataBoundLiteralControl";
+ AddProtectedField (typeof (System.Web.UI.DataBoundLiteralControl), control_id);
+ // Build the control
+ db_function.AppendFormat ("\t\tprivate System.Web.UI.Control __BuildControl_{0} ()\n" +
+ "\t\t{{\n\t\t\t{1} __ctrl;\n\n" +
+ "\t\t\t__ctrl = new {1} (0, 1);\n" +
+ "\t\t\tthis.{0} = __ctrl;\n" +
+ "\t\t\t__ctrl.DataBinding += new System.EventHandler " +
+ "(this.__DataBind_{0});\n" +
+ "\t\t\treturn __ctrl;\n"+
+ "\t\t}}\n\n",
+ control_id, control_type_string);
+ // DataBinding handler
+ db_function.AppendFormat ("\t\tpublic void __DataBind_{0} (object sender, " +
+ "System.EventArgs e) {{\n" +
+ "\t\t\t{1} Container;\n" +
+ "\t\t\t{2} target;\n" +
+ "\t\t\ttarget = ({2}) sender;\n" +
+ "\t\t\tContainer = ({1}) target.BindingContainer;\n" +
+ "\t\t\ttarget.SetDataBoundString (0, System.Convert." +
+ "ToString ({3}));\n" +
+ "\t\t}}\n\n",
+ control_id, controls.Container, control_type_string,
+ actual_value);
+
+ init_funcs.Append (db_function);
+ current_function.AppendFormat ("\t\t\tthis.__BuildControl_{0} ();\n\t\t\t__parser." +
+ "AddParsedSubObject (this.{0});\n\n", control_id);
+
+ AddCodeRenderControl (controls.CodeRenderFunction);
+ }
+
+ private void ProcessCodeRenderTag ()
+ {
+ CodeRenderTag code_tag = (CodeRenderTag) elements.Current;
+
+ controls.UseCodeRender = true;
+ if (code_tag.IsVarName)
+ controls.CodeRenderFunction.AppendFormat ("\t\t\t__output.Write ({0});\n",
+ code_tag.Code);
+ else
+ controls.CodeRenderFunction.AppendFormat ("\t\t\t{0}\n", code_tag.Code);
+ }
+
+ public void ProcessElements ()
+ {
+ JustDoIt ();
+ End ();
+ parse_ok = true;
+ }
+
+ private void JustDoIt ()
+ {
+ Element element;
+
+ while (elements.MoveNext ()){
+ element = (Element) elements.Current;
+ if (element is Directive){
+ ProcessDirective ();
+ } else if (element is PlainText){
+ ProcessPlainText ();
+ } else if (element is DataBindingTag){
+ if (IsApplication)
+ throw new ApplicationException (app_file_wrong);
+ ProcessDataBindingLiteral ();
+ } else if (element is CodeRenderTag){
+ if (IsApplication)
+ throw new ApplicationException (app_file_wrong);
+ ProcessCodeRenderTag ();
+ } else {
+ elements.Current = Map ((Tag) element);
+ if (elements.Current is ServerObjectTag) {
+ ProcessServerObjectTag ();
+ continue;
+ }
+
+ if (elements.Current is HtmlControlTag) {
+ ProcessHtmlControlTag ();
+ continue;
+ }
+
+ if (IsApplication)
+ throw new ApplicationException (app_file_wrong);
+
+ else if (elements.Current is AspComponent)
+ ProcessComponent ();
+ else if (elements.Current is CloseTag)
+ ProcessCloseTag ();
+ else if (elements.Current is Tag)
+ ProcessHtmlTag ();
+ else
+ throw new ApplicationException ("This place should not be reached.");
+ }
+ }
+ }
+
+ private string GetTemplateDirectory ()
+ {
+ string templatePath = Path.GetDirectoryName (fullPath);
+ string appPath = Path.GetDirectoryName (HttpRuntime.AppDomainAppPath);
+
+ if (templatePath == appPath)
+ return "/";
+
+ templatePath = templatePath.Substring (appPath.Length);
+ if (Path.DirectorySeparatorChar != '/')
+ templatePath = templatePath.Replace (Path.DirectorySeparatorChar, '/');
+
+ return templatePath;
+ }
+
+ private void End ()
+ {
+ if (isPage) {
+ if (sessionState == SessionState.Enabled || sessionState == SessionState.ReadOnly)
+ AddInterface (typeof (System.Web.SessionState.IRequiresSessionState));
+
+ if (sessionState == SessionState.ReadOnly)
+ AddInterface (typeof (System.Web.SessionState.IReadOnlySessionState));
+ }
+
+ classDecl = "\tpublic class " + className + " : " + parent + interfaces + " {\n";
+ prolog.Append ("\n" + classDecl);
+ declarations.Append ("\t\tprivate static bool __intialized = false;\n\n");
+ if (IsPage)
+ declarations.Append ("\t\tprivate static ArrayList __fileDependencies;\n\n");
+
+ // adds the constructor
+ constructor.AppendFormat ("\t\tpublic {0} ()\n\t\t{{\n", className);
+ if (!IsApplication)
+ constructor.Append ("\t\t\tSystem.Collections.ArrayList dependencies;\n\n");
+
+ constructor.AppendFormat ("\t\t\tif (ASP.{0}.__intialized == false){{\n", className);
+
+ if (IsPage) {
+ constructor.AppendFormat ("\t\t\t\tdependencies = new System.Collections.ArrayList ();\n" +
+ "\t\t\t\tdependencies.Add (@\"{1}\");\n" +
+ "\t\t\t\tASP.{0}.__fileDependencies = dependencies;\n",
+ className, fullPath);
+ }
+
+ constructor.AppendFormat ("\t\t\t\tASP.{0}.__intialized = true;\n\t\t\t}}\n\t\t}}\n\n",
+ className);
+
+ if (!IsApplication) {
+ //FIXME: add AutoHandlers: don't know what for...yet!
+ constructor.AppendFormat (
+ "\t\tprotected override int AutoHandlers\n\t\t{{\n" +
+ "\t\t\tget {{ return ASP.{0}.__autoHandlers; }}\n" +
+ "\t\t\tset {{ ASP.{0}.__autoHandlers = value; }}\n" +
+ "\t\t}}\n\n", className);
+
+ constructor.Append (
+ "\t\tprotected System.Web.HttpApplication ApplicationInstance\n\t\t{\n" +
+ "\t\t\tget { return (System.Web.HttpApplication) this.Context.ApplicationInstance; }\n" +
+ "\t\t}\n\n");
+
+ constructor.AppendFormat (
+ "\t\tpublic override string TemplateSourceDirectory\n\t\t{{\n" +
+ "\t\t\tget {{ return \"{0}\"; }}\n" +
+ "\t\t}}\n\n", GetTemplateDirectory ());
+
+ epilog.Append ("\n\t\tprotected override void FrameworkInitialize ()\n\t\t{\n" +
+ "\t\t\tthis.__BuildControlTree (this);\n");
+
+ if (IsPage) {
+ epilog.AppendFormat ("\t\t\tthis.FileDependencies = ASP.{0}.__fileDependencies;\n" +
+ "\t\t\tthis.EnableViewStateMac = true;\n", className);
+ }
+
+ epilog.Append ("\t\t}\n\n");
+ }
+
+ if (IsPage) {
+ Random rnd = new Random ();
+ epilog.AppendFormat ("\t\tpublic override int GetTypeHashCode ()\n\t\t{{\n" +
+ "\t\t\treturn {0};\n" +
+ "\t\t}}\n", rnd.Next ());
+ }
+
+ epilog.Append ("\t}\n}\n");
+
+ // Closes the currently opened tags
+ StringBuilder old_function = current_function;
+ string control_id;
+ while (functions.Count > 1){
+ old_function.Append ("\n\t\t\treturn __ctrl;\n\t\t}\n\n");
+ init_funcs.Append (old_function);
+ control_id = controls.PeekControlID ();
+ FinishControlFunction (control_id);
+ controls.AddChild ();
+ old_function = (StringBuilder) functions.Pop ();
+ current_function = (StringBuilder) functions.Peek ();
+ controls.Pop ();
+ }
+
+ bool useCodeRender = controls.UseCodeRender;
+ if (useCodeRender){
+ RemoveLiterals (current_function);
+ AddRenderMethodDelegate (current_function, controls.PeekControlID ());
+ }
+
+ current_function.Append ("\t\t}\n\n");
+ init_funcs.Append (current_function);
+ if (useCodeRender)
+ AddCodeRenderFunction (controls.CodeRenderFunction.ToString (), controls.PeekControlID ());
+
+ functions.Pop ();
+ }
+
+ //
+ // Functions related to compilation of user controls
+ //
+
+ private static char dirSeparator = Path.DirectorySeparatorChar;
+ struct UserControlData
+ {
+ public UserControlResult result;
+ public string className;
+ public string assemblyName;
+ }
+
+ private static UserControlData GenerateUserControl (string src, HttpContext context)
+ {
+ UserControlData data = new UserControlData ();
+ data.result = UserControlResult.OK;
+
+ UserControlCompiler compiler = new UserControlCompiler (new UserControlParser (src, context));
+ Type t = compiler.GetCompiledType ();
+ if (t == null) {
+ data.result = UserControlResult.CompilationFailed;
+ return data;
+ }
+
+ data.className = t.Name;
+ data.assemblyName = compiler.TargetFile;
+
+ return data;
+ }
+}
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
new file mode 100644
index 00000000000..f35ddfc52c9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
@@ -0,0 +1,277 @@
+//
+// System.Web.Compilation.AspParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Compilation
+{
+ class AspParser {
+ private AspTokenizer tokenizer;
+ private ArrayList elements; // List of processed elements in the HTML page.
+
+ private void error ()
+ {
+ throw new HttpException ("Error parsing: " + tokenizer.location);
+ }
+
+ private void error (string msg)
+ {
+ throw new Exception ("Error: "+ msg + "\n" + tokenizer.location);
+ }
+
+ public AspParser (AspTokenizer tokenizer)
+ {
+ this.tokenizer = tokenizer;
+ elements = new ArrayList ();
+ }
+
+ public AspParser (string filename, Stream input) :
+ this (new AspTokenizer (filename, input))
+ {
+ }
+
+ public ArrayList Elements
+ {
+ get { return elements; }
+ }
+
+ private bool Eat (int expected_token)
+ {
+ if (tokenizer.get_token () != expected_token) {
+ tokenizer.put_back ();
+ return false;
+ }
+ return true;
+ }
+
+ private void AddPlainText (string newText)
+ {
+ if (elements.Count > 0){
+ Element element = (Element) elements [elements.Count - 1];
+ if (element is PlainText){
+ ((PlainText) element).Append (newText);
+ return;
+ }
+ }
+ elements.Add (new PlainText (newText));
+ }
+
+ public void Parse ()
+ {
+ int token;
+ Element element;
+ Tag tag_element;
+ string tag = "";
+
+ while ((token = tokenizer.get_token ()) != Token.EOF){
+ if (tokenizer.Verbatim){
+ string end_verbatim = "</" + tag + ">";
+ string verbatim_text = GetVerbatim (token, end_verbatim);
+
+ if (verbatim_text == null)
+ error ("Unexpected EOF processing " + tag);
+
+ AddPlainText (verbatim_text);
+ elements.Add (new CloseTag (tag));
+ tokenizer.Verbatim = false;
+ }
+ else if (token == '<') {
+ element = GetTag ();
+ if (element == null)
+ error ();
+
+ if (element is ServerComment)
+ continue;
+
+ if (!(element is Tag)){
+ AddPlainText (((PlainText) element).Text);
+ continue;
+ }
+
+ elements.Add (element);
+
+ tag_element = element as Tag;
+ tag = tag_element.TagID.ToUpper ();
+ if (!tag_element.SelfClosing && (tag == "SCRIPT" || tag == "PRE"))
+ tokenizer.Verbatim = true;
+ }
+ else {
+ StringBuilder text = new StringBuilder ();
+ do {
+ text.Append (tokenizer.value);
+ token = tokenizer.get_token ();
+ } while (token != '<' && token != Token.EOF);
+ tokenizer.put_back ();
+ AddPlainText (text.ToString ());
+ }
+ }
+ }
+
+ private Element GetTag ()
+ {
+ int token = tokenizer.get_token ();
+ string id;
+
+ switch (token){
+ case '%':
+ return GetServerTag ();
+ case '/':
+ if (!Eat (Token.IDENTIFIER))
+ error ("expecting TAGNAME");
+ id = tokenizer.value;
+ if (!Eat ('>'))
+ error ("expecting '>'");
+ return new CloseTag (id);
+ case '!':
+ bool double_dash = Eat (Token.DOUBLEDASH);
+ if (double_dash)
+ tokenizer.put_back ();
+
+ tokenizer.Verbatim = true;
+ string end = double_dash ? "-->" : ">";
+ string comment = GetVerbatim (tokenizer.get_token (), end);
+ tokenizer.Verbatim = false;
+ if (comment == null)
+ error ("Unfinished HTML comment/DTD");
+
+ return new PlainText ("<!" + comment + end);
+ case Token.IDENTIFIER:
+ id = tokenizer.value;
+ Tag tag = new Tag (id, GetAttributes (), Eat ('/'));
+ if (!Eat ('>'))
+ error ("expecting '>'");
+ return tag;
+ default:
+ return null;
+ }
+ }
+
+ private TagAttributes GetAttributes ()
+ {
+ int token;
+ TagAttributes attributes;
+ string id;
+
+ attributes = new TagAttributes ();
+ while ((token = tokenizer.get_token ()) != Token.EOF){
+ if (token != Token.IDENTIFIER)
+ break;
+ id = tokenizer.value;
+ if (Eat ('=')){
+ if (Eat (Token.ATTVALUE)){
+ attributes.Add (id, tokenizer.value);
+ } else {
+ //TODO: support data binding syntax without quotes
+ error ("expected ATTVALUE");
+ return null;
+ }
+
+ } else {
+ attributes.Add (id, null);
+ }
+ }
+
+ tokenizer.put_back ();
+ if (attributes.Count == 0)
+ return null;
+
+ return attributes;
+ }
+
+ private string GetVerbatim (int token, string end)
+ {
+ StringBuilder vb_text = new StringBuilder ();
+ int i = 0;
+
+ if (tokenizer.value.Length > 1){
+ // May be we have a put_back token that is not a single character
+ vb_text.Append (tokenizer.value);
+ token = tokenizer.get_token ();
+ }
+
+ while (token != Token.EOF){
+ if (Char.ToUpper ((char) token) == end [i]){
+ if (++i >= end.Length)
+ break;
+ token = tokenizer.get_token ();
+ continue;
+ }
+ else {
+ for (int j = 0; j < i; j++)
+ vb_text.Append (end [j]);
+ }
+
+ i = 0;
+ vb_text.Append ((char) token);
+ token = tokenizer.get_token ();
+ }
+
+ if (token == Token.EOF)
+ return null;
+
+ return RemoveComments (vb_text.ToString ());
+ }
+
+ private string RemoveComments (string text)
+ {
+ int end;
+ int start = text.IndexOf ("<%--");
+
+ while (start != -1) {
+ end = text.IndexOf ("--%>");
+ if (end == -1 || end <= start + 1)
+ break;
+
+ text = text.Remove (start, end - start + 4);
+ start = text.IndexOf ("<%--");
+ }
+
+ return text;
+ }
+
+ private Element GetServerTag ()
+ {
+ string id;
+ string inside_tags;
+ TagAttributes attributes;
+
+ if (Eat ('@')){
+ id = (Eat (Token.DIRECTIVE) ? tokenizer.value : "Page");
+ attributes = GetAttributes ();
+ if (!Eat ('%') || !Eat ('>'))
+ error ("expecting '%>'");
+
+ return new Directive (id, attributes);
+ } else if (Eat (Token.DOUBLEDASH)) {
+ tokenizer.Verbatim = true;
+ inside_tags = GetVerbatim (tokenizer.get_token (), "--%>");
+ tokenizer.Verbatim = false;
+ return new ServerComment ("<%--" + inside_tags + "--%>");
+ }
+
+ bool varname;
+ bool databinding;
+ varname = Eat ('=');
+ databinding = !varname && Eat ('#');
+
+ tokenizer.Verbatim = true;
+ inside_tags = GetVerbatim (tokenizer.get_token (), "%>");
+ tokenizer.Verbatim = false;
+ if (databinding)
+ return new DataBindingTag (inside_tags);
+
+ return new CodeRenderTag (varname, inside_tags);
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
new file mode 100644
index 00000000000..0b72bef93dd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
@@ -0,0 +1,215 @@
+//
+// System.Web.Compilation.AspTokenizer
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Compilation {
+
+ class Token
+ {
+ public const int EOF = 0;
+ public const int IDENTIFIER = 1000;
+ public const int DIRECTIVE = 1001;
+ public const int ATTVALUE = 1002;
+ public const int TEXT = 1003;
+ public const int DOUBLEDASH = 1004;
+ public const int CLOSING = 1005;
+ }
+
+ class AspTokenizer {
+ private StreamReader sr;
+ private int current_token;
+ private StringBuilder sb;
+ private int col, line;
+ private bool inTag;
+ private bool hasPutBack;
+ private bool verbatim;
+ private string filename;
+
+ public AspTokenizer (string filename, Stream stream)
+ {
+ if (filename == null || stream == null)
+ throw new ArgumentNullException ();
+
+ this.sr = new StreamReader (stream);
+ this.filename = filename;
+ sb = new StringBuilder ();
+ col = line = 1;
+ hasPutBack = inTag = false;
+ }
+
+ public bool Verbatim
+ {
+ get { return verbatim; }
+ set { verbatim = value; }
+ }
+
+ public void put_back ()
+ {
+ if (hasPutBack)
+ throw new ApplicationException ("put_back called twice!");
+
+ hasPutBack = true;
+ }
+
+ public int get_token ()
+ {
+ if (hasPutBack){
+ hasPutBack = false;
+ return current_token;
+ }
+
+ current_token = NextToken ();
+ return current_token;
+ }
+
+ bool is_identifier_start_character (char c)
+ {
+ return (Char.IsLetter (c) || c == '_' );
+ }
+
+ bool is_identifier_part_character (char c)
+ {
+ return (Char.IsLetterOrDigit (c) || c == '_' || c == '-');
+ }
+
+ private int read_char ()
+ {
+ int c = sr.Read ();
+
+ if (c == '\r' && sr.Peek () == '\n')
+ c = sr.Read ();
+
+ if (c == '\n'){
+ col = 0;
+ line++;
+ }
+ else if (c != -1)
+ col++;
+
+ return c;
+ }
+
+ private int NextToken ()
+ {
+ int c;
+
+ sb.Length = 0;
+ while ((c = read_char ()) != -1){
+ if (verbatim){
+ inTag = false;
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (inTag && (c == '"' || c == '\'')){
+ int previous;
+ int start = c;
+
+ previous = 0;
+ while ((c = sr.Peek ()) != -1) {
+ if (c == start && previous != '\\'){
+ read_char ();
+ break;
+ }
+ sb.Append ((char) read_char ());
+ previous = c;
+ }
+
+ return Token.ATTVALUE;
+ }
+
+ if (c == '<'){
+ inTag = true;
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (c == '>'){
+ inTag = false;
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (current_token == '<' && "%/!".IndexOf ((char) c) != -1){
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (inTag && current_token == '%' && "@#=".IndexOf ((char) c) != -1){
+ sb.Append ((char) c);
+ return c;
+ }
+
+ if (inTag && c == '-' && sr.Peek () == '-'){
+ sb.Append ("--");
+ read_char ();
+ return Token.DOUBLEDASH;
+ }
+
+ if (!inTag){
+ sb.Append ((char) c);
+ while ((c = sr.Peek ()) != -1 && c != '<')
+ sb.Append ((char) read_char ());
+
+ return (c != -1 || sb.Length > 0) ? Token.TEXT : Token.EOF;
+ }
+
+ if (inTag && current_token == '=' && !Char.IsWhiteSpace ((char) c)){
+ sb.Append ((char) c);
+ while ((c = sr.Peek ()) != -1) {
+ if (Char.IsWhiteSpace ((char) c) || c == '/' || c == '>')
+ break;
+ sb.Append ((char) read_char ());
+ }
+
+ return Token.ATTVALUE;
+ }
+
+ if (inTag && is_identifier_start_character ((char) c)){
+ sb.Append ((char) c);
+ while ((c = sr.Peek ()) != -1) {
+ if (!is_identifier_part_character ((char) c) && c != ':')
+ break;
+ sb.Append ((char) read_char ());
+ }
+
+ if (current_token == '@' && Directive.IsDirectiveID (sb.ToString ()))
+ return Token.DIRECTIVE;
+
+ return Token.IDENTIFIER;
+ }
+
+ if (!Char.IsWhiteSpace ((char) c))
+ return c;
+ }
+
+ return Token.EOF;
+ }
+
+ public string value
+ {
+ get { return sb.ToString (); }
+ }
+
+ public string location
+ {
+ get {
+ string msg = filename;
+ msg += " (" + line + ", " + col + "): " + sb.ToString ();
+ return msg;
+ }
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
new file mode 100644
index 00000000000..81535529e51
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
@@ -0,0 +1,114 @@
+//
+// System.Web.Compilation.BaseCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Compilation
+{
+ abstract class BaseCompiler
+ {
+ //FIXME: configurable?
+ static string default_assemblies = "System.Web.dll, System.Data.dll, System.Drawing.dll";
+ static Random rnd = new Random ((int) DateTime.Now.Ticks);
+ string randomName;
+ protected Hashtable options;
+
+ protected BaseCompiler ()
+ {
+ }
+
+ public virtual Type GetCompiledType ()
+ {
+ return null;
+ }
+
+ public virtual string Key {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string SourceFile {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string [] Dependencies {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string CompilerOptions {
+ get {
+ string assemblies = default_assemblies;
+ string privatePath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
+ //FIXME: remove the next line once multiple appdomains can work together
+ if (privatePath == null) privatePath = "bin";
+ //
+ if (privatePath != null && Directory.Exists (privatePath)) {
+ StringBuilder sb = new StringBuilder (assemblies);
+ foreach (string fileName in Directory.GetFiles (privatePath, "*.dll"))
+ sb.AppendFormat (", {0}", fileName);
+ assemblies = sb.ToString ();
+ sb = null;
+ }
+
+ string [] split = assemblies.Split (',');
+ StringBuilder result = new StringBuilder ();
+ foreach (string assembly in split)
+ result.AppendFormat ("/r:{0} ", assembly.TrimStart ());
+
+ if (options == null)
+ return result.ToString ();
+
+ string compilerOptions = options ["CompilerOptions"] as string;
+ if (compilerOptions != null) {
+ result.Append (' ');
+ result.Append (compilerOptions);
+ }
+
+ string references = options ["References"] as string;
+ if (references == null)
+ return result.ToString ();
+
+ split = references.Split (' ');
+ foreach (string s in split)
+ result.AppendFormat (" /r:{0}", s);
+
+ return result.ToString ();
+ }
+ }
+
+ static string GetRandomFileName ()
+ {
+ string output;
+
+ do {
+ output = "tmp" + rnd.Next () + ".dll";
+ } while (File.Exists (output));
+
+ return output;
+ }
+
+ public virtual string TargetFile {
+ get {
+ if (randomName == null)
+ randomName = GetRandomFileName ();
+
+ return randomName;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
new file mode 100644
index 00000000000..14708e4d469
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
@@ -0,0 +1,156 @@
+//
+// System.Web.Compilation.CachingCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+ //TODO: caching should be done using System.Web.Caching, but that namespace still need some work.
+ internal class CompilationCacheItem
+ {
+ CompilationResult result;
+ DateTime time;
+
+ public CompilationCacheItem (CompilationResult result, DateTime time)
+ {
+ this.result = result;
+ this.time = time;
+ }
+
+ public bool CheckDependencies (string [] newDependencies, DateTime time)
+ {
+ // FIXME
+ return true;
+ }
+
+ public CompilationResult Result
+ {
+ get { return result; }
+ }
+ }
+
+ internal class CompilationCache
+ {
+ static Hashtable cache;
+ static CompilationCache instance = new CompilationCache ();
+
+ private CompilationCache ()
+ {
+ }
+
+ static CompilationCache ()
+ {
+ cache = new Hashtable ();
+ }
+
+ public static CompilationCache GetInstance ()
+ {
+ return instance;
+ }
+
+ public CompilationCacheItem this [string key]
+ {
+ get {
+ return cache [key] as CompilationCacheItem;
+ }
+
+ set {
+ cache [key] = value;
+ }
+ }
+ }
+
+ internal class CachingCompiler
+ {
+ static CompilationCache cache = CompilationCache.GetInstance ();
+ string key;
+ BaseCompiler compiler;
+
+ public CachingCompiler (BaseCompiler compiler)
+ {
+ this.compiler = compiler;
+ this.key = compiler.Key;
+ }
+
+ public static CompilationCacheItem GetCached (string key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+
+ CompilationCacheItem item = cache [key];
+ return item;
+ }
+
+ static object compilationLock = new object ();
+ public bool Compile (CompilationResult result)
+ {
+ if (compiler.SourceFile == null)
+ throw new ArgumentException ("No source to compile!");
+
+ result.Reset ();
+ CompilationCacheItem item;
+
+ item = GetCached (key);
+ if (item != null) {
+ if (item.CheckDependencies (compiler.Dependencies, DateTime.Now) == true) {
+ result.CopyFrom (item.Result);
+ return true;
+ }
+ }
+
+ lock (compilationLock) {
+ item = GetCached (key);
+ if (item != null) {
+ if (item.CheckDependencies (compiler.Dependencies, DateTime.Now) == true) {
+ result.CopyFrom (item.Result);
+ return true;
+ }
+ }
+
+ RealCompile (result);
+ cache [key] = new CompilationCacheItem (result, DateTime.Now);
+ }
+
+ return (result.ExitCode == 0);
+ }
+
+ void RealCompile (CompilationResult result)
+ {
+ StringBuilder options = new StringBuilder ("/target:library ");
+ if (compiler.CompilerOptions != null)
+ options.Append (compiler.CompilerOptions + ' ');
+
+ options.AppendFormat ("/out:{0} ", compiler.TargetFile);
+ options.Append (compiler.SourceFile);
+
+ Process proc = new Process ();
+ proc.StartInfo.FileName = "mcs";
+ proc.StartInfo.Arguments = options.ToString ();
+ proc.StartInfo.UseShellExecute = false;
+ proc.StartInfo.RedirectStandardOutput = true;
+
+ WebTrace.WriteLine ("{0} {1}", proc.StartInfo.FileName, options.ToString ());
+ proc.Start ();
+ string poutput = proc.StandardOutput.ReadToEnd();
+ proc.WaitForExit ();
+ result.ExitCode = proc.ExitCode;
+ proc.Close ();
+ proc = null;
+
+ result.CompilerOutput = poutput;
+ result.OutputFile = compiler.TargetFile;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
new file mode 100644
index 00000000000..47cad3355a4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
@@ -0,0 +1,231 @@
+
+2003-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: modified loading of the parent type now that
+ Type.GetType is fixed.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: cast to Control if the container does not implement
+ INamingContainer.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed a couple of thinkos related to IsSubclassOf.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: attributes without value lacked a space afterwards.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: functions for columns don't return anything. Fixed
+ typo.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: add data bound controls to code render function.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: reworked to allow same prefix for multiple
+ controls. You can register 1 assembly plus any number of user controls
+ under the same prefix.
+
+ * AspGenerator.cs: don't add duplicate 'using' for the same namespace.
+ Hack to allow @Register access to assemblies in other places than bin
+ directory.
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added 'codebehind' attribute for page, control and
+ application. It's ignored by MS, but allowed. Fixed typo.
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed EnableSesssionState handling.
+
+2003-01-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: don't generate instance fields for pages/controls
+ when the base class specified in the Inherits attribute already has
+ them. Closes bug #36262.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: generate code like 'control.XXX = value' also for
+ public fields (properties were being handled in that way too).
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: now it uses the current HttpContext when creating
+ user controls. TemplateSourceDirectory is no longer a dummy value.
+
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: set the context which will be used to locate
+ the files.
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: added support for AutoEventWireup attribute in
+ @Page and @Control.
+
+ * CompilationResult.cs:
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: store the options.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: new method Tag.GetElements
+ used to parse the inner contents of a tag looking for data binding or
+ code render tags.
+
+ New property HtmlControlTag.ParseChildren allows
+ differentiation of a couple of HtmlControls that has children as
+ properties (namely HtmlTable and HtmlTableRow).
+
+ * AspGenerator.cs: fixed container semantics to
+ match BindingContainer one. Implemented Inherits attribute for page and
+ control.
+
+ Support HtmlControls that has ChildrenAsProperties.
+
+ Generate code for data binding functions that matches the semantic of
+ Container.
+
+ Handle data bound and code render attribute values.
+
+ Set proper value return for TemplateSourceDirectory. Should be relative
+ to appPath.
+
+ * BaseCompiler.cs: moved CompilerOptions and
+ References handling here.
+
+ * CachingCompiler.cs: copy result of compilation.
+
+ * CompilationException.cs: simple ToString () implementation.
+
+ * CompilationResult.cs: implemented CopyFrom and ToString.
+
+ * GlobalAsaxCompiler.cs:
+ * PageCompiler.cs:
+ * UserControlCompiler.cs: removed CompilerOptions as it's now handled
+ in the base class. Get all the types in the generated assembly and
+ look for one that derives from the correct Type.
+
+2002-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added @Application directive.
+
+ * AspGenerator.cs: make it work also with application files. We
+ currently generate an extra private function.
+
+2002-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GlobalAsaxCompiler.cs: compiler for global.asax file. If the file
+ exists, it will be compiled into an HttpApplication derived class
+ (directly or through a user-provided class).
+
+2002-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: fixed target file name and generated class name.
+ * BaseCompiler.cs: reference assemblies in PrivateBinPath.
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: reworked user control
+ compilation. Provide the options as a Hashtable for use in compilation.
+ Create the user controls in the private bin path of the domain.
+
+ * BaseCompiler.cs: base class for the various compiler types.
+
+ * CachingCompiler.cs: actually executes mcs and do some poor caching
+ (it will use Cache when finished).
+
+ * CompilationException.cs: this exception has enough information to
+ generate a nice error page.
+ * CompilationResult.cs: used in caching.
+
+ * PageCompiler.cs: now derives from BaseCompiler
+
+ * TemplateFactory.cs: no longer needed.
+
+ * UserControlCompiler.cs: new class used when compiling user controls.
+ * WebServiceCompiler.cs: derives from BaseCompiler.
+
+2002-11-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added ServerComment class.
+ * AspParser.cs: ignore ServerComments tags. Remove server comments when
+ in verbatim mode.
+
+ Fixes #33482.
+
+ * PageCompiler.cs: check if the type is already cached before generating
+ the C# file.
+ * TemplateFactory.cs: if csFile parameter is null, only checks if we
+ already have the page compiled.
+
+2002-11-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: undo one-liner change.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: removed a few hacks no longer needed.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: tracing.
+ * TemplateFactory.cs: cache compiled types and tracing.
+ * WebServiceCompiler.cs: new parameter in GetTypeFromsource,
+
+2002-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: fixed typo.
+ * TemplateFactory.cs: use csc style options.
+ * AspGenerator.cs: don't use FileDependencies property of base class.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Compilation/AspElements.cs:
+ * System.Web.Compilation/AspGenerator.cs:
+ * System.Web.Compilation/AspParser.cs:
+ * System.Web.Compilation/PageCompiler.cs:
+ * System.Web.Compilation/TemplateFactory.cs: we are now able to compile
+ pages and use HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs: added WebService directive.
+ * WebServiceCompiler.cs: New file.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: fixed compilation.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: generate C# file using AspGenerator.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: LookupFoundry now returns bool.
+ * AspGenerator.cs: New file.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspComponentFoundry.cs: New file.
+ * AspElements.cs: renamed Component to Aspcomponent.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspElements.cs:
+ * AspParser.cs:
+ * AspTokenizer.cs:
+ * ChangeLog:
+ * PageCompiler.cs:
+ * TemplateFactory.cs: first steps to move xsp into System.Web.
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs b/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
new file mode 100644
index 00000000000..8a4caf8177e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
@@ -0,0 +1,40 @@
+//
+// System.Web.Compilation.CompilationException
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Web.Compilation
+{
+ internal class CompilationException : Exception
+ {
+ CompilationResult result;
+
+ public CompilationException (CompilationResult result)
+ {
+ this.result = result;
+ }
+
+ public CompilationException (string msg, CompilationResult result)
+ {
+ this.result = result;
+ }
+
+ public CompilationException (CompilationCacheItem item)
+ {
+ this.result = item.Result;
+ }
+
+ public override string Message {
+ get {
+ return result.ToString ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/CompilationResult.cs b/mcs/class/System.Web/System.Web.Compilation/CompilationResult.cs
new file mode 100644
index 00000000000..df04ecba110
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/CompilationResult.cs
@@ -0,0 +1,71 @@
+//
+// System.Web.Compilation.CompilationResult
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+
+namespace System.Web.Compilation
+{
+ internal class CompilationResult
+ {
+ int exitCode;
+ string output;
+ string outputFile;
+ object data;
+ Hashtable options;
+
+ public CompilationResult ()
+ {
+ }
+
+ public void Reset ()
+ {
+ exitCode = 0;
+ output = null;
+ }
+
+ public void CopyFrom (CompilationResult other)
+ {
+ exitCode = other.ExitCode;
+ output = other.output;
+ outputFile = other.outputFile;
+ data = other.data;
+ }
+
+ public int ExitCode {
+ get { return exitCode; }
+ set { exitCode = exitCode; }
+ }
+
+ public string CompilerOutput {
+ get { return output; }
+ set { output = value; }
+ }
+
+ public string OutputFile {
+ get { return outputFile; }
+ set { outputFile = value; }
+ }
+
+ public object Data {
+ get { return data; }
+ set { data = value; }
+ }
+
+ public Hashtable Options {
+ get { return options; }
+ set { options = value; }
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("CompilationResult: {0} {1} {2} {3}", exitCode, output, outputFile, data);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
new file mode 100644
index 00000000000..718f679ee61
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
@@ -0,0 +1,101 @@
+//
+// System.Web.Compilation.GlobalAsaxCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Web;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+ class GlobalAsaxCompiler : BaseCompiler
+ {
+ string filename;
+ string sourceFile;
+ HttpContext context;
+
+ private GlobalAsaxCompiler (string filename)
+ {
+ this.filename = filename;
+ }
+
+ public override Type GetCompiledType ()
+ {
+ sourceFile = GenerateSourceFile ();
+
+ CachingCompiler compiler = new CachingCompiler (this);
+ CompilationResult result = new CompilationResult ();
+ result.Options = options;
+ if (compiler.Compile (result) == false)
+ throw new CompilationException (result);
+
+ Assembly assembly = Assembly.LoadFrom (result.OutputFile);
+ Type [] types = assembly.GetTypes ();
+ foreach (Type t in types) {
+ if (t.IsSubclassOf (typeof (HttpApplication))) {
+ if (result.Data != null)
+ throw new CompilationException ("More that 1 app!!!", result);
+ result.Data = t;
+ }
+ }
+
+ return result.Data as Type;
+ }
+
+ public override string Key {
+ get {
+ return filename;
+ }
+ }
+
+ public override string SourceFile {
+ get {
+ return sourceFile;
+ }
+ }
+
+ public static Type CompileApplicationType (string filename, HttpContext context)
+ {
+ CompilationCacheItem item = CachingCompiler.GetCached (filename);
+ if (item != null && item.Result != null) {
+ if (item.Result != null)
+ return item.Result.Data as Type;
+
+ throw new CompilationException (item.Result);
+ }
+
+ GlobalAsaxCompiler gac = new GlobalAsaxCompiler (filename);
+ gac.context = context;
+ return gac.GetCompiledType ();
+ }
+
+ string GenerateSourceFile ()
+ {
+ Stream input = File.OpenRead (filename);
+ AspParser parser = new AspParser (filename, input);
+ parser.Parse ();
+ AspGenerator generator = new AspGenerator (filename, parser.Elements);
+ generator.Context = context;
+ generator.BaseType = typeof (HttpApplication).ToString ();
+ generator.ProcessElements ();
+ string generated = generator.GetCode ().ReadToEnd ();
+ options = generator.Options;
+
+ //FIXME: should get Tmp dir for this application
+ string csName = Path.GetTempFileName () + ".cs";
+ WebTrace.WriteLine ("Writing {0}", csName);
+ StreamWriter output = new StreamWriter (File.OpenWrite (csName));
+ output.Write (generated);
+ output.Close ();
+ return csName;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
new file mode 100644
index 00000000000..2fe1261e948
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
@@ -0,0 +1,104 @@
+//
+// System.Web.Compilation.PageCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+ class PageCompiler : BaseCompiler
+ {
+ PageParser pageParser;
+ string sourceFile;
+
+ private PageCompiler (PageParser pageParser)
+ {
+ this.pageParser = pageParser;
+ }
+
+ public override Type GetCompiledType ()
+ {
+ string inputFile = pageParser.InputFile;
+ sourceFile = GenerateSourceFile ();
+
+ CachingCompiler compiler = new CachingCompiler (this);
+ CompilationResult result = new CompilationResult ();
+ result.Options = options;
+ if (compiler.Compile (result) == false)
+ throw new CompilationException (result);
+
+ Assembly assembly = Assembly.LoadFrom (result.OutputFile);
+ Type [] types = assembly.GetTypes ();
+ foreach (Type t in types) {
+ if (t.IsSubclassOf (typeof (Page))) {
+ if (result.Data != null)
+ throw new CompilationException ("More that 1 page!!!", result);
+ result.Data = t;
+ }
+ }
+
+ return result.Data as Type;
+ }
+
+ public override string Key {
+ get {
+ return pageParser.InputFile;
+ }
+ }
+
+ public override string SourceFile {
+ get {
+ return sourceFile;
+ }
+ }
+
+ public static Type CompilePageType (PageParser pageParser)
+ {
+ CompilationCacheItem item = CachingCompiler.GetCached (pageParser.InputFile);
+ if (item != null && item.Result != null) {
+ if (item.Result != null) {
+ pageParser.Options = item.Result.Options;
+ return item.Result.Data as Type;
+ }
+
+ throw new CompilationException (item.Result);
+ }
+
+ PageCompiler pc = new PageCompiler (pageParser);
+ return pc.GetCompiledType ();
+ }
+
+ string GenerateSourceFile ()
+ {
+ string inputFile = pageParser.InputFile;
+
+ Stream input = File.OpenRead (inputFile);
+ AspParser parser = new AspParser (inputFile, input);
+ parser.Parse ();
+ AspGenerator generator = new AspGenerator (inputFile, parser.Elements);
+ generator.Context = pageParser.Context;
+ generator.BaseType = pageParser.BaseType.ToString ();
+ generator.ProcessElements ();
+ pageParser.Text = generator.GetCode ().ReadToEnd ();
+ options = generator.Options;
+
+ //FIXME: should get Tmp dir for this application
+ string csName = Path.GetTempFileName () + ".cs";
+ WebTrace.WriteLine ("Writing {0}", csName);
+ StreamWriter output = new StreamWriter (File.OpenWrite (csName));
+ output.Write (pageParser.Text);
+ output.Close ();
+ return csName;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
new file mode 100644
index 00000000000..c31d9fdf768
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
@@ -0,0 +1,118 @@
+//
+// System.Web.Compilation.UserControlCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.IO;
+using System.Reflection;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.Compilation
+{
+ class UserControlCompiler : BaseCompiler
+ {
+ UserControlParser userControlParser;
+ string sourceFile;
+ string targetFile;
+
+ internal UserControlCompiler (UserControlParser userControlParser)
+ {
+ this.userControlParser = userControlParser;
+ }
+
+ public override Type GetCompiledType ()
+ {
+ string inputFile = userControlParser.InputFile;
+ sourceFile = GenerateSourceFile (userControlParser);
+
+ CachingCompiler compiler = new CachingCompiler (this);
+ CompilationResult result = new CompilationResult ();
+ result.Options = options;
+ if (compiler.Compile (result) == false)
+ throw new CompilationException (result);
+
+ if (result.Data is Type) {
+ targetFile = result.OutputFile;
+ return (Type) result.Data;
+ }
+
+ Assembly assembly = Assembly.LoadFrom (result.OutputFile);
+ Type [] types = assembly.GetTypes ();
+ foreach (Type t in types) {
+ if (t.IsSubclassOf (typeof (UserControl))) {
+ if (result.Data != null)
+ throw new CompilationException ("More that 1 user control!!!", result);
+ result.Data = t;
+ }
+ }
+
+ return result.Data as Type;
+ }
+
+ public override string Key {
+ get {
+ return userControlParser.InputFile;
+ }
+ }
+
+ public override string SourceFile {
+ get {
+ return sourceFile;
+ }
+ }
+
+ public override string TargetFile {
+ get {
+ if (targetFile == null)
+ targetFile = Path.ChangeExtension (sourceFile, ".dll");
+
+ return targetFile;
+ }
+ }
+
+ public static Type CompileUserControlType (UserControlParser userControlParser)
+ {
+ CompilationCacheItem item = CachingCompiler.GetCached (userControlParser.InputFile);
+ if (item != null && item.Result != null) {
+ if (item.Result != null) {
+ userControlParser.Options = item.Result.Options;
+ return item.Result.Data as Type;
+ }
+
+ throw new CompilationException (item.Result);
+ }
+
+ UserControlCompiler pc = new UserControlCompiler (userControlParser);
+ return pc.GetCompiledType ();
+ }
+
+ string GenerateSourceFile (UserControlParser userControlParser)
+ {
+ string inputFile = userControlParser.InputFile;
+
+ Stream input = File.OpenRead (inputFile);
+ AspParser parser = new AspParser (inputFile, input);
+ parser.Parse ();
+ AspGenerator generator = new AspGenerator (inputFile, parser.Elements);
+ generator.Context = userControlParser.Context;
+ generator.BaseType = userControlParser.BaseType.ToString ();
+ generator.ProcessElements ();
+ userControlParser.Text = generator.GetCode ().ReadToEnd ();
+ options = generator.Options;
+
+ //FIXME: should get Tmp dir for this application
+ string csName = Path.GetTempFileName () + ".cs";
+ WebTrace.WriteLine ("Writing {0}", csName);
+ StreamWriter output = new StreamWriter (File.OpenWrite (csName));
+ output.Write (userControlParser.Text);
+ output.Close ();
+ return csName;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
new file mode 100644
index 00000000000..50e9962fb2f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Compilation/WebServiceCompiler.cs
@@ -0,0 +1,85 @@
+//
+// System.Web.Compilation.WebServiceCompiler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.IO;
+using System.Reflection;
+using System.Web.UI;
+
+namespace System.Web.Compilation
+{
+ class WebServiceCompiler : BaseCompiler
+ {
+ SimpleWebHandlerParser wService;
+ string sourceFile;
+
+ private WebServiceCompiler (SimpleWebHandlerParser wService)
+ {
+ this.wService = wService;
+ }
+
+ public static Type CompileIntoType (SimpleWebHandlerParser wService)
+ {
+ CompilationCacheItem item = CachingCompiler.GetCached (wService.PhysicalPath);
+ if (item != null && item.Result != null) {
+ if (item.Result != null)
+ return item.Result.Data as Type;
+
+ throw new CompilationException (item.Result);
+ }
+
+ WebServiceCompiler wsc = new WebServiceCompiler (wService);
+ return wsc.GetCompiledType ();
+ }
+
+ static string GenerateSourceFile (SimpleWebHandlerParser wService)
+ {
+ //FIXME: should get Tmp dir for this application
+ string csName = Path.GetTempFileName ();
+ StreamWriter output = new StreamWriter (File.OpenWrite (csName));
+ output.Write (wService.Program);
+ output.Close ();
+ return csName;
+ }
+
+ public override Type GetCompiledType ()
+ {
+ sourceFile = GenerateSourceFile (wService);
+
+ CachingCompiler compiler = new CachingCompiler (this);
+ CompilationResult result = new CompilationResult ();
+ if (compiler.Compile (result) == false)
+ throw new CompilationException (result);
+
+ Assembly assembly = Assembly.LoadFrom (result.OutputFile);
+ Type [] types = assembly.GetTypes ();
+ Type type = types [0];
+ if (type.FullName != wService.ClassName)
+ throw new ApplicationException (String.Format (
+ "Class={0}, but the class compiled is {1}",
+ wService.ClassName,
+ type.FullName));
+
+ result.Data = type;
+ return type;
+ }
+
+ public override string Key {
+ get {
+ return wService.PhysicalPath;
+ }
+ }
+
+ public override string SourceFile {
+ get {
+ return sourceFile;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs b/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
new file mode 100755
index 00000000000..f8b8f13ccf4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
@@ -0,0 +1,175 @@
+//
+// System.Web.Configuration.AuthConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class AuthConfig
+ {
+ AuthenticationMode mode;
+ string cookieName;
+ string cookiePath;
+ string loginUrl;
+ FormsProtectionEnum protection;
+ int timeout;
+ FormsAuthPasswordFormat pwdFormat;
+ Hashtable credentialUsers;
+ bool has_parent;
+
+ internal AuthConfig (object parent)
+ {
+ if (parent is AuthConfig) {
+ has_parent = true;
+ AuthConfig p = (AuthConfig) parent;
+ mode = p.mode;
+ cookieName = p.cookieName;
+ cookiePath = p.cookiePath;
+ loginUrl = p.loginUrl;
+ protection = p.protection;
+ timeout = p.timeout;
+ pwdFormat = p.pwdFormat;
+ credentialUsers = new Hashtable (p.CredentialUsers);
+ }
+ }
+
+ internal void SetMode (string m)
+ {
+ if (m == null) {
+ // we default to Forms authentication mode, MS defaults to Windows
+ if (!has_parent)
+ Mode = AuthenticationMode.Forms;
+ return;
+ }
+
+ Mode = (AuthenticationMode) Enum.Parse (typeof (AuthenticationMode), m, true);
+ }
+
+ internal void SetProtection (string prot)
+ {
+ if (prot == null) {
+ if (!has_parent)
+ Protection = FormsProtectionEnum.All;
+ return;
+ }
+
+ Protection = (FormsProtectionEnum) Enum.Parse (typeof (FormsProtectionEnum),
+ prot,
+ true);
+ }
+
+ internal void SetTimeout (string minutes)
+ {
+ if (minutes != null) {
+ Timeout = Int32.Parse (minutes);
+ return;
+ }
+
+ if (!has_parent)
+ Timeout = 30;
+ }
+
+ internal void SetPasswordFormat (string pwdFormat)
+ {
+ if (pwdFormat == null) {
+ if (!has_parent)
+ PasswordFormat = FormsAuthPasswordFormat.Clear;
+ return;
+ }
+
+ PasswordFormat =
+ (FormsAuthPasswordFormat) Enum.Parse (typeof (FormsAuthPasswordFormat),
+ pwdFormat,
+ true);
+ }
+
+ internal AuthenticationMode Mode {
+ get { return mode; }
+ set { mode = value; }
+ }
+
+ internal string CookieName {
+ get {
+ if (cookieName == null)
+ cookieName = ".ASPXAUTH";
+
+ return cookieName;
+ }
+ set {
+ if (value == null)
+ return;
+
+ cookieName = value;
+ }
+ }
+
+ internal string CookiePath {
+ get {
+ if (cookiePath == null)
+ cookiePath = "/";
+
+ return cookiePath;
+ }
+ set {
+ if (value == null)
+ return;
+
+ cookiePath = value;
+ }
+ }
+
+ internal string LoginUrl {
+ get {
+ if (loginUrl == null)
+ loginUrl = "login.aspx";
+
+ return loginUrl;
+ }
+ set {
+ if (value == null)
+ return;
+
+ loginUrl = value;
+ }
+ }
+
+ internal FormsProtectionEnum Protection {
+ get { return protection; }
+ set { protection = value; }
+ }
+
+ internal int Timeout {
+ get { return timeout; }
+ set {
+ if (value <= 0)
+ throw new ArgumentException ("Timeout must be > 0", "value");
+
+ timeout = value;
+ }
+ }
+
+ internal FormsAuthPasswordFormat PasswordFormat {
+ get { return pwdFormat; }
+ set { pwdFormat = value; }
+ }
+
+ internal Hashtable CredentialUsers {
+ get {
+ if (credentialUsers == null)
+ credentialUsers = new Hashtable ();
+
+ return credentialUsers;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
new file mode 100755
index 00000000000..7abb573b01c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
@@ -0,0 +1,112 @@
+//
+// System.Web.Configuration.AuthenticationSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class AuthenticationConfigHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object context, XmlNode section)
+ {
+ //TODO: context?
+ AuthConfig config = new AuthConfig (parent);
+
+ string mode = AttValue ("mode", section);
+ if (mode != null)
+ config.SetMode (mode);
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList authNodes = section.ChildNodes;
+ foreach (XmlNode child in authNodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name == "forms") {
+ config.CookieName = AttValue ("name", child, false);
+ config.CookiePath = AttValue ("path", child);
+ config.LoginUrl = AttValue ("loginUrl", child);
+ config.SetProtection (AttValue ("protection", child));
+ config.SetTimeout (AttValue ("timeout", child));
+ ReadCredentials (child.ChildNodes, config);
+ continue;
+ }
+
+ if (child.Name == "passport") {
+ Console.WriteLine ("**WARNING**: Passport not supported! Ignoring section.");
+ continue;
+ }
+
+ HandlersUtil.ThrowException ("Unexpected element", child);
+ }
+
+ return config;
+ }
+
+ static void ReadCredentials (XmlNodeList nodes, AuthConfig config)
+ {
+ foreach (XmlNode child in nodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name != "credentials")
+ HandlersUtil.ThrowException ("Unexpected element", child);
+
+ config.SetPasswordFormat (AttValue ("passwordFormat", child));
+ ReadUsers (child.ChildNodes, config.CredentialUsers);
+ }
+ }
+
+ static void ReadUsers (XmlNodeList nodes, Hashtable users)
+ {
+ foreach (XmlNode child in nodes) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype != XmlNodeType.Element)
+ continue;
+
+ if (child.Name != "user")
+ HandlersUtil.ThrowException ("Unexpected element", child);
+
+ string name = AttValue ("name", child, false);
+ string password = AttValue ("password", child);
+ if (users.ContainsKey (name))
+ ThrowException ("User '" + name + "' already added.", child);
+
+ users [name] = password;
+ if (child.HasChildNodes)
+ ThrowException ("Child nodes not allowed here", child.FirstChild);
+ }
+ }
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs
new file mode 100755
index 00000000000..6618e02ddc6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs
@@ -0,0 +1,19 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the AuthenticationMode for a Web Application.
+ /// </summary>
+ public enum AuthenticationMode{
+ None,
+ Windows,
+ Passport,
+ Forms
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
new file mode 100644
index 00000000000..0e59da70f83
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
@@ -0,0 +1,78 @@
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpModulesConfigurationHandler.cs: add a default authentication
+ module at the end of the list.
+
+ * ModuleItem.cs: new constructor.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthConfig.cs: LoginUrl defaults to login.aspx.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthConfig.cs:
+ * AuthenticationConfigHandler.cs: handler and helper class for
+ system.web/authentication configuration section.
+
+ * HttpHandlersSectionHandler.cs: check for null in attributes.
+
+ * MachineKeyConfig.cs:
+ * MachineKeyConfigHandler.cs: handler and helper class for
+ system.web/machineKey tag.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlersSectionHandler.cs: more null checks.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlersSectionHandler.cs: made a couple of static methods be
+ part of a class used in other handlers.
+ * HttpModulesConfigurationHandler.cs: handler for modules.
+ * ModuleItem.cs: added IsMatch method.
+ * ModulesConfiguration.cs: made it similar to the handlers class: added Clear, Remove.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpHandlerTypeMapper.cs: removed.
+ * HandlerFactoryConfiguration.cs: readded. I removed it by mistake.
+ * HandlerItem.cs: only load the type if we gotta validate it.
+ Implemented initial IsMatch.
+ * HttpConfigurationContext.cs: New file.
+ * HttpHandlersSectionHandler.cs: validate is optional (default true).
+ Use HttpHandlerTypeMapper.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Configuration/HandlerFactoryConfiguration.cs: removed.
+
+ * System.Web.Configuration/HandlerItem.cs: added validation field.
+
+ * System.Web.Configuration/HttpHandlerTypeMapper.cs: holds mappings
+ between verbs and wilcards and their associated HandlerItem.
+
+ * System.Web.Configuration/HttpHandlersSectionHandler.cs: this one
+ processes system.web/httpHandlers section of machine.config file.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthenticationMode.cs:
+ * ClientTargetSectionHandler.cs:
+ * FormsAuthPasswordFormat.cs:
+ * FormsProtectionEnum.cs:
+ * HttpCapabilitiesBase.cs: fixes base on class status page.
+
+2002-08-05 Patrik Torstensson <ptorsten@hotmail.com>
+
+ * HandlerFactoryConfiguration.cs,
+ HandlerFactoryProxy.cs,
+ HandlerItem.cs : New files to emulate HttpHandler configuration
+
+ * ModuleItem.cs,
+ ModulesConfiguration.cs : New files to emulate HttpModule configuration
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Configuration/HttpCapabilitiesBase.cs: New file.
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs
new file mode 100644
index 00000000000..7f779a2e7df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs
@@ -0,0 +1,44 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ /// <summary>
+ /// Summary description for ClientTargetSectionHandler.
+ /// </summary>
+ class ClientTargetSectionHandler: NameValueSectionHandler
+ {
+ /// <summary>
+ /// ClientTargetSectionHandler Constructor
+ /// </summary>
+ public ClientTargetSectionHandler(){}
+
+ /// <summary>
+ /// Gets the name of the key in the key-value pair.
+ /// </summary>
+ protected override string KeyAttributeName
+ {
+ get
+ {
+ return "alias";
+ }
+ }
+
+ /// <summary>
+ /// Gets the value for the key in the key-value pair.
+ /// </summary>
+ protected override string ValueAttributeName
+ {
+ get
+ {
+ return "userAgent";
+ }
+ }
+
+ }
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs b/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs
new file mode 100755
index 00000000000..9cc5e7e7087
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs
@@ -0,0 +1,18 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the password encryption format.
+ /// </summary>
+ public enum FormsAuthPasswordFormat{
+ Clear,
+ SHA1,
+ MD5
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs b/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs
new file mode 100755
index 00000000000..db74e2d421d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs
@@ -0,0 +1,19 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the method used for securing web forms.
+ /// </summary>
+ public enum FormsProtectionEnum{
+ All,
+ None,
+ Encryption,
+ Validation
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
new file mode 100644
index 00000000000..f60e6c65b60
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
@@ -0,0 +1,29 @@
+//
+// System.Web.Configuration.GlobalizationConfiguration
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+//
+using System.Globalization;
+
+namespace System.Web.Configuration {
+ [MonoTODO]
+ public class GlobalizationConfiguration {
+ public GlobalizationConfiguration() {
+ }
+
+ [MonoTODO("")]
+ public CultureInfo Culture {
+ get {
+ return null;
+ }
+ }
+
+ [MonoTODO("")]
+ public CultureInfo UICulture {
+ get {
+ return null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
new file mode 100644
index 00000000000..c80ac692670
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Configuration.HandlerFactoryConfiguration
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Collections;
+
+namespace System.Web.Configuration
+{
+ class HandlerFactoryConfiguration
+ {
+ ArrayList mappings;
+
+ public HandlerFactoryConfiguration () : this (null)
+ {
+ }
+
+ public HandlerFactoryConfiguration (HandlerFactoryConfiguration parent)
+ {
+ if (parent != null)
+ mappings = new ArrayList (parent.mappings);
+ else
+ mappings = new ArrayList ();
+ }
+
+ public void Add (HandlerItem mapping)
+ {
+ mappings.Add (mapping);
+ }
+
+ public HandlerItem Remove (string verb, string path)
+ {
+ int i = GetIndex (verb, path);
+ if (i == -1)
+ return null;
+
+ HandlerItem item = (HandlerItem) mappings [i];
+ mappings.RemoveAt (i);
+ return item;
+ }
+
+ public void Clear ()
+ {
+ mappings.Clear ();
+ }
+
+ public HandlerItem FindHandler (string verb, string path)
+ {
+ int i = GetIndex (verb, path);
+ if (i == -1)
+ return null;
+
+ return (HandlerItem) mappings [i];
+ }
+
+ int GetIndex (string verb, string path)
+ {
+ int end = mappings.Count;
+
+ for (int i = 0; i < end; i++) {
+ HandlerItem item = (HandlerItem) mappings [i];
+ if (item.IsMatch (verb, path))
+ return i;
+ }
+
+ return -1;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
new file mode 100644
index 00000000000..e152a35041c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.Configuration.HandlerFactoryProxy
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+//
+using System;
+
+namespace System.Web.Configuration {
+ [MonoTODO]
+ public class HandlerFactoryProxy {
+ public HandlerFactoryProxy() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
new file mode 100644
index 00000000000..ae134b3883f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
@@ -0,0 +1,120 @@
+//
+// System.Web.Configuration.HandlerItem
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace System.Web.Configuration
+{
+ public class HandlerItem
+ {
+ private Type _type;
+ private string _typeName;
+ private string _path;
+ private string _requestType;
+ private Regex requestRegex;
+ private Regex pathRegex;
+ static Hashtable regexCache;
+
+ public HandlerItem (string requestType, string path, string type, bool validate)
+ {
+ _typeName = type;
+ _path = path;
+ _requestType = requestType.Replace (" ", "");
+ requestRegex = GetRegex (_requestType);
+ pathRegex = GetRegex (_path);
+ if (validate)
+ DoValidation ();
+ }
+
+ public object Create ()
+ {
+ if (_type == null)
+ DoValidation ();
+
+ return HttpRuntime.CreateInternalObject (_type);
+ }
+
+ public Type Type
+ {
+ get {
+ if (_type == null)
+ DoValidation ();
+ return _type;
+ }
+ }
+
+ public bool IsMatch (string type, string path)
+ {
+ return (MatchVerb (type) && MatchPath (path));
+ }
+
+ bool MatchVerb (string verb)
+ {
+ return requestRegex.IsMatch (verb);
+ }
+
+ bool MatchPath (string path)
+ {
+ return pathRegex.IsMatch (path);
+ }
+
+ void DoValidation ()
+ {
+ _type = Type.GetType (_typeName, true);
+ if (typeof (IHttpHandler).IsAssignableFrom (_type))
+ return;
+
+ if (typeof (IHttpHandlerFactory).IsAssignableFrom (_type))
+ return;
+
+ throw new HttpException (HttpRuntime.FormatResourceString ("type_not_factory_or_handler"));
+ }
+
+ static string ToRegexPattern (string dosPattern)
+ {
+ string result = dosPattern.Replace (".", "\\.");
+ result = result.Replace ("*", ".*");
+ result = result.Replace ('?', '.');
+ return result;
+ }
+
+ static Regex GetRegex (string verb)
+ {
+ EnsureCache ();
+ if (regexCache.ContainsKey (verb))
+ return (Regex) regexCache [verb];
+
+ StringBuilder result = new StringBuilder ("\\A");
+ string [] expressions = verb.Split (',');
+ int end = expressions.Length;
+ for (int i = 0; i < end; i++) {
+ string regex = ToRegexPattern (expressions [i]);
+ if (i + 1 < end) {
+ result.AppendFormat ("{0}\\z|\\A", regex);
+ } else {
+ result.AppendFormat ("({0})\\z", regex);
+ }
+ }
+
+ Regex r = new Regex (result.ToString ());
+ regexCache [verb] = r;
+ return r;
+ }
+
+ static void EnsureCache ()
+ {
+ if (regexCache == null)
+ regexCache = new Hashtable ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs b/mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs
new file mode 100644
index 00000000000..3143893c351
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpCapabilitiesBase.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.Configuration.HttpCapabilitiesBase
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Configuration {
+ using System;
+ using System.Collections;
+ using System.Web;
+
+public class HttpCapabilitiesBase
+{
+ Hashtable capabilities;
+
+ public HttpCapabilitiesBase ()
+ {
+ capabilities = new Hashtable ();
+ }
+
+ public virtual string this [string key]
+ {
+ get { return capabilities [key] as string; }
+ }
+
+ public static HttpCapabilitiesBase GetConfigCapabilities (string configKey, HttpRequest request)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal void SetCapabilities (Hashtable tbl)
+ {
+ capabilities = tbl;
+ Init ();
+ }
+
+ protected virtual void Init ()
+ {
+ }
+
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs b/mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs
new file mode 100644
index 00000000000..192b3ad4e24
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpConfigurationContext.cs
@@ -0,0 +1,29 @@
+//
+// System.Web.Configuration.HttpConfigurationContext
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Configuration
+{
+ public class HttpConfigurationContext
+ {
+ private string virtualPath;
+
+ internal HttpConfigurationContext (string virtualPath)
+ {
+ this.virtualPath = virtualPath;
+ }
+
+ public string VirtualPath
+ {
+ get {
+ return virtualPath;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs
new file mode 100644
index 00000000000..85f573f47ee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpHandlersSectionHandler.cs
@@ -0,0 +1,131 @@
+//
+// System.Web.Configuration.HttpHandlersSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class HttpHandlersSectionHandler : IConfigurationSectionHandler
+ {
+ public virtual object Create (object parent, object configContext, XmlNode section)
+ {
+ HandlerFactoryConfiguration mapper;
+
+ if (parent is HandlerFactoryConfiguration)
+ mapper = new HandlerFactoryConfiguration ((HandlerFactoryConfiguration) parent);
+ else
+ mapper = new HandlerFactoryConfiguration ();
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList httpHandlers = section.ChildNodes;
+ foreach (XmlNode child in httpHandlers) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
+ continue;
+
+ if (ntype != XmlNodeType.Element)
+ HandlersUtil.ThrowException ("Only elements allowed", child);
+
+ string name = child.Name;
+ if (name == "clear") {
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ mapper.Clear ();
+ continue;
+ }
+
+ string verb = HandlersUtil.ExtractAttributeValue ("verb", child);
+ string path = HandlersUtil.ExtractAttributeValue ("path", child);
+ string validateStr = HandlersUtil.ExtractAttributeValue ("validate", child, true);
+ bool validate;
+ if (validateStr == null) {
+ validate = true;
+ } else {
+ validate = validateStr == "true";
+ if (!validate && validateStr != "false")
+ HandlersUtil.ThrowException (
+ "Invalid value for validate attribute.", child);
+ }
+
+ if (name == "add") {
+ string type = HandlersUtil.ExtractAttributeValue ("type", child);
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ HandlerItem item = new HandlerItem (verb, path, type, validate);
+ mapper.Add (item);
+ continue;
+ }
+
+ if (name == "remove") {
+ if (child.Attributes != null && child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ if (validate && mapper.Remove (verb, path) == null)
+ HandlersUtil.ThrowException ("There's no mapping to remove", child);
+
+ continue;
+ }
+ HandlersUtil.ThrowException ("Unexpected element", child);
+ }
+
+ return mapper;
+ }
+ }
+
+ internal class HandlersUtil
+ {
+ private HandlersUtil ()
+ {
+ }
+
+ static internal string ExtractAttributeValue (string attKey, XmlNode node)
+ {
+ return ExtractAttributeValue (attKey, node, false);
+ }
+
+ static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional)
+ {
+ if (node.Attributes == null) {
+ if (optional)
+ return null;
+
+ ThrowException ("Required attribute not found: " + attKey, node);
+ }
+
+ XmlNode att = node.Attributes.RemoveNamedItem (attKey);
+ if (att == null) {
+ if (optional)
+ return null;
+ ThrowException ("Required attribute not found: " + attKey, node);
+ }
+
+ string value = att.Value;
+ if (value == String.Empty) {
+ string opt = optional ? "Optional" : "Required";
+ ThrowException (opt + " attribute is empty: " + attKey, node);
+ }
+
+ return value;
+ }
+
+ static internal void ThrowException (string msg, XmlNode node)
+ {
+ if (node != null && node.Name != String.Empty)
+ msg = msg + " (node name: " + node.Name + ") ";
+ throw new ConfigurationException (msg, node);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs
new file mode 100644
index 00000000000..44776eb3a44
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/HttpModulesConfigurationHandler.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.Configuration.HttpModulesConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Configuration;
+using System.Xml;
+using System.Web.Security;
+
+namespace System.Web.Configuration
+{
+ class HttpModulesConfigurationHandler : IConfigurationSectionHandler
+ {
+ public virtual object Create (object parent, object configContext, XmlNode section)
+ {
+ ModulesConfiguration mapper;
+
+ if (parent is ModulesConfiguration)
+ mapper = new ModulesConfiguration ((ModulesConfiguration) parent);
+ else
+ mapper = new ModulesConfiguration ();
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", section);
+
+ XmlNodeList httpModules = section.ChildNodes;
+
+ foreach (XmlNode child in httpModules) {
+ XmlNodeType ntype = child.NodeType;
+ if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
+ continue;
+
+ if (ntype != XmlNodeType.Element)
+ HandlersUtil.ThrowException ("Only elements allowed", child);
+
+ string name = child.Name;
+ if (name == "clear") {
+ if (child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ mapper.Clear ();
+ continue;
+ }
+
+ string nameAtt = HandlersUtil.ExtractAttributeValue ("name", child);
+ if (name == "add") {
+ string type = HandlersUtil.ExtractAttributeValue ("type", child);
+ if (child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ // FIXME: gotta remove this. Just here to make it work with my local config
+ if (type.StartsWith ("System.Web.Mobile"))
+ continue;
+
+ ModuleItem item = new ModuleItem (nameAtt, type);
+ mapper.Add (item);
+ continue;
+ }
+
+ if (name == "remove") {
+ if (child.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unrecognized attribute", child);
+
+ if (mapper.Remove (nameAtt) == null)
+ HandlersUtil.ThrowException ("Module not loaded", child);
+ continue;
+ }
+
+ HandlersUtil.ThrowException ("Unrecognized element", child);
+ }
+
+ mapper.Add (new ModuleItem ("DefaultAuthentication", typeof (DefaultAuthenticationModule)));
+ return mapper;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs
new file mode 100644
index 00000000000..56f1ec80832
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfig.cs
@@ -0,0 +1,65 @@
+//
+// System.Web.Configuration.MachineKeyConfig
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class MachineKeyConfig
+ {
+ static MachineKeyConfig machineKey;
+ byte [] validationKey;
+ byte [] decryptionKey;
+ string validationType;
+
+ internal MachineKeyConfig (object parent)
+ {
+ if (parent is MachineKeyConfig) {
+ MachineKeyConfig p = (MachineKeyConfig) parent;
+ validationKey = p.validationKey;
+ decryptionKey = p.decryptionKey;
+ validationType = p.validationType;
+ }
+ }
+
+ internal byte [] ValidationKey {
+ get { return validationKey; }
+ set { validationKey = value; }
+ }
+
+ internal byte [] DecryptionKey {
+ get { return decryptionKey; }
+ set { decryptionKey = value; }
+ }
+
+ internal string ValidationType {
+ get {
+ if (validationType == null)
+ validationType = "SHA1";
+
+ return validationType;
+ }
+ set {
+ if (value == null)
+ return;
+
+ validationType = value;
+ }
+ }
+
+ internal static MachineKeyConfig MachineKey {
+ get { return machineKey; }
+ set { machineKey = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs
new file mode 100644
index 00000000000..23971e93e89
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/MachineKeyConfigHandler.cs
@@ -0,0 +1,116 @@
+//
+// System.Web.Configuration.MachineKeyConfigHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Security.Cryptography;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class MachineKeyConfigHandler : IConfigurationSectionHandler
+ {
+ static byte [] autogenerated;
+ static MachineKeyConfigHandler ()
+ {
+ autogenerated = new byte [64];
+ RNGCryptoServiceProvider cp = new RNGCryptoServiceProvider ();
+ cp.GetBytes (autogenerated);
+ }
+
+ static byte ToHexValue (char c, bool high)
+ {
+ byte v;
+ if (c >= '0' && c <= '9')
+ v = (byte) (c - '0');
+ else if (c >= 'a' && c <= 'f')
+ v = (byte) (c - 'a' + 10);
+ else if (c >= 'A' && c <= 'F')
+ v = (byte) (c - 'A' + 10);
+ else
+ throw new ArgumentException ("Invalid hex character");
+
+ if (high)
+ v <<= 4;
+
+ return v;
+ }
+
+ internal static byte [] GetBytes (string key, int len)
+ {
+ byte [] result = new byte [len / 2];
+ for (int i = 0; i < len; i += 2)
+ result [i / 2] = (byte) (ToHexValue (key [i], true) + ToHexValue (key [i + 1], false));
+
+ return result;
+ }
+
+ static byte [] MakeKey (string key)
+ {
+ if (key == null || key == "AutoGenerated")
+ return autogenerated;
+
+ int len = key.Length;
+ if (len < 40 || len > 128 || (len % 2) == 1)
+ throw new ArgumentException ("Invalid key length");
+
+ return GetBytes (key, len);
+ }
+
+ public object Create (object parent, object context, XmlNode section)
+ {
+ if (section.HasChildNodes)
+ ThrowException ("Child nodes not allowed here", section.FirstChild);
+
+ //TODO: context?
+ MachineKeyConfig config = new MachineKeyConfig (parent);
+
+ string validationKey = AttValue ("validationKey", section);
+ try {
+ config.ValidationKey = MakeKey (validationKey);
+ } catch (ArgumentException e) {
+ ThrowException (e.Message, section);
+ }
+
+ string decryptionKey = AttValue ("decryptionKey", section);
+ try {
+ config.DecryptionKey = MakeKey (decryptionKey);
+ } catch (ArgumentException e) {
+ ThrowException (e.Message, section);
+ }
+
+ string validation = AttValue ("validation", section);
+ if (validation != "SHA1" && validation != "MD5" && validation != "3DES")
+ ThrowException ("Invalid 'validation' value", section);
+
+ config.ValidationType = validation;
+
+ if (section.Attributes != null && section.Attributes.Count != 0)
+ ThrowException ("Unrecognized attribute", section);
+
+ MachineKeyConfig.MachineKey = config;
+ return config;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ //
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs b/mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs
new file mode 100644
index 00000000000..3db4bce3eda
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ModuleItem.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Configuration.ModuleItem
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+//
+using System;
+
+namespace System.Web.Configuration {
+ public class ModuleItem {
+ private Type _type;
+ private string _typeName;
+ private string _name;
+
+ public ModuleItem(string name, string type) {
+ _typeName = type;
+ _name = name;
+
+ _type = Type.GetType (type, true);
+ if (!typeof(IHttpModule).IsAssignableFrom(_type))
+ throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
+ }
+
+ public ModuleItem(string name, Type type) {
+ _typeName = type.ToString ();
+ _name = name;
+ _type = type;
+ if (!typeof(IHttpModule).IsAssignableFrom(_type))
+ throw new HttpException(HttpRuntime.FormatResourceString("type_not_module"));
+ }
+
+ public IHttpModule Create() {
+ return (IHttpModule) HttpRuntime.CreateInternalObject(_type);
+ }
+
+ public Type Type {
+ get {
+ return _type;
+ }
+ }
+
+ public bool IsMatch (string name)
+ {
+ return (_type.Name == name || _type.FullName == name);
+ }
+
+ public string ModuleName {
+ get {
+ return _name;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs
new file mode 100644
index 00000000000..d0b4ab1fda8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ModulesConfiguration.cs
@@ -0,0 +1,75 @@
+//
+// System.Web.Configuration.ModulesConfiguration
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+
+namespace System.Web.Configuration
+{
+ public class ModulesConfiguration
+ {
+ ArrayList modules;
+
+ public ModulesConfiguration () : this (null)
+ {
+ }
+
+ public ModulesConfiguration (ModulesConfiguration parent)
+ {
+ if (parent != null)
+ modules = new ArrayList (parent.modules);
+ else
+ modules = new ArrayList ();
+ }
+
+ public void Add (ModuleItem item)
+ {
+ modules.Add (item);
+ }
+
+ public ModuleItem Remove (string name)
+ {
+ int i = GetIndex (name);
+ if (i == -1)
+ return null;
+
+ ModuleItem item = (ModuleItem) modules [i];
+ modules.RemoveAt (i);
+ return item;
+ }
+
+ public void Clear ()
+ {
+ modules.Clear ();
+ }
+
+ public HttpModuleCollection CreateCollection ()
+ {
+ HttpModuleCollection items = new HttpModuleCollection ();
+ foreach (ModuleItem item in modules)
+ items.AddModule (item.ModuleName, item.Create ());
+
+ return items;
+ }
+
+ int GetIndex (string name)
+ {
+ int end = modules.Count;
+
+ for (int i = 0; i < end; i++) {
+ ModuleItem item = (ModuleItem) modules [i];
+ if (item.IsMatch (name))
+ return i;
+ }
+
+ return -1;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
new file mode 100644
index 00000000000..63df449a29c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
@@ -0,0 +1,6 @@
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog: New file.
+ * TraceHandler.cs: stubbed out. This should generate the trace page
+ when tracing is enabled.
+
diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
new file mode 100644
index 00000000000..1ee16a6c9e5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.Handlers.TraceHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.Handlers
+{
+ public class TraceHandler : IHttpHandler
+ {
+ [MonoTODO]
+ void IHttpHandler.ProcessRequest (HttpContext context)
+ {
+ //TODO: This should generate the trace page.
+ throw new NotImplementedException ();
+ }
+
+ bool IHttpHandler.IsReusable
+ {
+ get {
+ return false;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
new file mode 100644
index 00000000000..b46e7812906
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
@@ -0,0 +1,122 @@
+//
+// System.Web.Hosting.AppDomainFactory.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Security;
+using System.Security.Policy;
+using System.Text;
+
+namespace System.Web.Hosting
+{
+ public sealed class AppDomainFactory : IAppDomainFactory
+ {
+ static int nDomain = 0;
+ static string [] domainData = { ".appDomain",
+ ".appId",
+ ".appPath",
+ ".appVPath",
+ ".appName",
+ ".domainId"
+ };
+
+ public object Create (string module,
+ string typeName,
+ string appId,
+ string appPath,
+ string strUrlOfAppOrigin,
+ int iZone)
+ {
+ appPath = Path.GetFullPath (appPath);
+ if (appPath [appPath.Length - 1] == '\\')
+ appPath += '\\';
+
+ StringBuilder sb = new StringBuilder (appId);
+ sb.Append ('-');
+ lock (domainData){
+ sb.Append (nDomain.ToString ());
+ nDomain++;
+ }
+
+ sb.Append ('-' + DateTime.Now.ToString ());
+ string domainId = sb.ToString ();
+ sb = null;
+
+ int slash = appId.IndexOf ('/');
+ string vPath;
+ if (slash == -1)
+ vPath = "/";
+ else
+ vPath = appId.Substring (slash + 1);
+
+ string appName = (appId.GetHashCode () + appPath.GetHashCode ()).ToString ("x");
+ AppDomainSetup domainSetup = new AppDomainSetup ();
+
+ PopulateDomainBindings (domainId,
+ appId,
+ appName,
+ appPath,
+ vPath,
+ domainSetup,
+ null);
+
+ // May be adding more assemblies and such to Evidence?
+ AppDomain domain = AppDomain.CreateDomain (domainId,
+ AppDomain.CurrentDomain.Evidence,
+ domainSetup);
+
+ string [] settings = new string [6];
+ settings [0] = "*";
+ settings [1] = appId;
+ settings [2] = appPath;
+ settings [3] = vPath;
+ settings [4] = appName;
+ settings [5] = domainId;
+ for (int i = 0; i < 6; i++)
+ domain.SetData (domainData [i], settings [i]);
+
+ object o = null;
+ try {
+ o = domain.CreateInstance (module, typeName);
+ } catch {
+ AppDomain.Unload (domain);
+ o = null;
+ }
+
+ return o;
+ }
+
+ internal static void PopulateDomainBindings (string domainId,
+ string appId,
+ string appName,
+ string appPath,
+ string appVPath,
+ AppDomainSetup setup,
+ IDictionary dict)
+ {
+ setup.PrivateBinPath = "bin";
+ setup.PrivateBinPathProbe = "*";
+ setup.ShadowCopyFiles = "true";
+ setup.ApplicationBase = new Uri (appPath, true).ToString ();
+ setup.ApplicationName = appName;
+ setup.ConfigurationFile = "web.config";
+ if (dict != null) {
+ dict.Add (domainData [0], "*");
+ dict.Add (domainData [1], appId);
+ dict.Add (domainData [2], appPath);
+ dict.Add (domainData [3], appVPath);
+ dict.Add (domainData [4], appName);
+ dict.Add (domainData [5], domainId);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
new file mode 100644
index 00000000000..86eea5703fe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.Hosting.ApplicationHost
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (class signature from Bob Smith <bob@thestuff.net> (C) )
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting;
+
+namespace System.Web.Hosting
+{
+ public sealed class ApplicationHost
+ {
+ internal class ConfigInitHelper : MarshalByRefObject
+ {
+ internal void InitConfig ()
+ {
+ }
+ }
+
+ private ApplicationHost ()
+ {
+ }
+
+ public static object CreateApplicationHost (Type hostType,
+ string virtualDir,
+ string physicalDir)
+ {
+ if (hostType == null)
+ throw new ArgumentException ("hostType");
+
+ if (virtualDir == null || virtualDir.Length == 0)
+ throw new ArgumentException ("virtualDir");
+
+ if (physicalDir == null || physicalDir.Length == 0)
+ throw new ArgumentException ("physicalDir");
+
+ if (physicalDir [physicalDir.Length - 1] != Path.DirectorySeparatorChar)
+ physicalDir += Path.DirectorySeparatorChar;
+
+ int nowInt = DateTime.Now.ToString ().GetHashCode ();
+ string nowHash = nowInt.ToString ("x");
+ nowInt += physicalDir.GetHashCode ();
+ string sum = nowInt.ToString ("x");
+ Hashtable hTable = new Hashtable ();
+ AppDomainSetup domainSetup = new AppDomainSetup();
+
+ AppDomainFactory.PopulateDomainBindings (nowHash,
+ sum,
+ sum,
+ physicalDir,
+ virtualDir,
+ domainSetup,
+ hTable);
+
+ AppDomain domain = AppDomain.CreateDomain (nowHash, null, domainSetup);
+ foreach (string key in hTable.Keys) {
+ domain.SetData (key, (string) hTable [key]);
+ // [1] REMOVE THIS once bug #31245 is fixed
+ AppDomain.CurrentDomain.SetData (key, (string) hTable [key]);
+ }
+
+ domain.SetData (".hostingVirtualPath", virtualDir);
+ AppDomain.CurrentDomain.SetData (".hostingVirtualPath", virtualDir); // [1]
+ //FIXME: this should be the directory where dlls reside.
+ domain.SetData(".hostingInstallDir", "FIXME hostingInstallDir");
+ AppDomain.CurrentDomain.SetData (".hostingInstallDir", "FIXME hostingInstallDir"); // [1]
+ InitConfigInNewAppDomain (domain);
+ ObjectHandle o = domain.CreateInstance (hostType.Assembly.FullName,
+ hostType.FullName);
+ return o.Unwrap();
+ }
+
+ private static void InitConfigInNewAppDomain (AppDomain appDomain)
+ {
+ Type t = typeof (ConfigInitHelper);
+ ObjectHandle o = appDomain.CreateInstance (t.Assembly.FullName, t.FullName);
+ ConfigInitHelper helper = (ConfigInitHelper) o.Unwrap();
+ helper.InitConfig ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/ChangeLog b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
new file mode 100644
index 00000000000..802ae221c22
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
@@ -0,0 +1,45 @@
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Hosting/SimpleWorkerRequest.cs: we are now able to compile
+ pages and use HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs:
+ * SimpleWorkerRequest.cs: workaround for bug #31245.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs: little fixes.
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationHost.cs: use Assembly instead of Module.
+
+2002-08-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs: implemented.
+ * ApplicationHost.cs: implemented.
+ * SimpleWorkerRequest.cs: a few little fixes and reformatted. It's now
+ fully implemented.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainFactory.cs:
+ * IAppDomainFactory.cs:
+ * IISAPIRuntime.cs:
+ * ISAPIRuntime.cs: make them compile.
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * ApplicationHost.cs: Test implementation to support testing.
+ * SimpleWorkerRequest.cs: Rewrite and a almost full implementation.
+
+2001-08-30 Bob Smith <bob@thestuff.net>
+
+ * AppDomainFactory.cs: Stubbed.
+ * ApplicationHost.cs: Stubbed.
+ * IAppDomainFactory.cs: Stubbed.
+ * IISAPIRuntime.cs: Stubbed.
+ * ISAPIRuntime.cs: Implemented.
+ * SimpleWorkerRequest.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
new file mode 100644
index 00000000000..2067260c4f4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
@@ -0,0 +1,24 @@
+//
+// System.Web.Hosting.IAppDomainFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public interface IAppDomainFactory
+ {
+ object Create (string module,
+ string typeName,
+ string appId,
+ string appPath,
+ string strUrlOfAppOrigin,
+ int iZone);
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
new file mode 100644
index 00000000000..cf4d7bf6937
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.Hosting.IISAPIRuntime.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public interface IISAPIRuntime
+ {
+ void DoGCCollect ();
+ int ProcessRequest (IntPtr ecb, int useProcessModel);
+ void StartProcessing ();
+ void StopProcessing ();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs b/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
new file mode 100644
index 00000000000..ac43100c95c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.Hosting.ISAPIRuntime.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public sealed class ISAPIRuntime : IISAPIRuntime
+ {
+ [MonoTODO]
+ public ISAPIRuntime ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DoGCCollect ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ProcessRequest (IntPtr ecb, int iWRType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void StartProcessing ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void StopProcessing ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
new file mode 100644
index 00000000000..764aa417a18
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
@@ -0,0 +1,273 @@
+//
+// System.Web.Hosting
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (class signature from Bob Smith <bob@thestuff.net> (C) )
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+using System;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Hosting
+{
+ [MonoTODO("Implement security demands on the path usage functions (and review)")]
+ public class SimpleWorkerRequest : HttpWorkerRequest
+ {
+ private string _Page;
+ private string _Query;
+ private string _PathInfo;
+ private string _AppVirtualPath;
+ private string _AppPhysicalPath;
+ private string _AppInstallPath;
+ private TextWriter _Output;
+ private bool _HasInstallInfo;
+
+ private SimpleWorkerRequest ()
+ {
+ }
+
+ public SimpleWorkerRequest (string Page, string Query, TextWriter Output)
+ {
+ _Page = Page;
+ ParsePathInfo ();
+
+ _Query = Query;
+ AppDomain current = AppDomain.CurrentDomain;
+ object o = current.GetData (".appPath");
+ if (o == null)
+ throw new HttpException ("Cannot get .appPath");
+ _AppPhysicalPath = o.ToString ();
+
+ o = current.GetData (".hostingVirtualPath");
+ if (o == null)
+ throw new HttpException ("Cannot get .hostingVirtualPath");
+ _AppInstallPath = o.ToString ();
+
+ o = current.GetData (".hostingInstallDir");
+ if (o == null)
+ throw new HttpException ("Cannot get .hostingInstallDir");
+ _AppVirtualPath = CheckAndAddSlash (o.ToString ());
+ _Output = Output;
+
+ if (_AppPhysicalPath == null)
+ throw new HttpException ("Invalid app domain");
+
+ _HasInstallInfo = true;
+ }
+
+ public SimpleWorkerRequest (string AppVirtualPath,
+ string AppPhysicalPath,
+ string Page,
+ string Query,
+ TextWriter Output)
+ {
+ if (AppDomain.CurrentDomain.GetData (".appPath") == null)
+ throw new HttpException ("Invalid app domain");
+
+ _Page = Page;
+ ParsePathInfo ();
+ _Query = Query;
+ _AppVirtualPath = AppVirtualPath;
+ _AppPhysicalPath = CheckAndAddSlash (AppPhysicalPath);
+ _Output = Output;
+ _HasInstallInfo = false;
+ }
+
+ [MonoTODO("Implement security")]
+ public override string MachineInstallDirectory
+ {
+ get {
+ if (_HasInstallInfo)
+ return _AppInstallPath;
+
+ return null;
+ }
+ }
+
+ [MonoTODO("Get config path from Web.Config class")]
+ public override string MachineConfigPath
+ {
+ get {
+ return "MachineConfigPath"; //FIXME
+ }
+ }
+
+ public override void EndOfRequest ()
+ {
+ }
+
+ public override void FlushResponse (bool finalFlush)
+ {
+ }
+
+ public override string GetAppPath ()
+ {
+ return _AppVirtualPath;
+ }
+
+ public override string GetAppPathTranslated ()
+ {
+ return _AppPhysicalPath;
+ }
+
+ public override string GetFilePath ()
+ {
+ return CreatePath (false);
+ }
+
+ public override string GetFilePathTranslated ()
+ {
+ if (Path.DirectorySeparatorChar != '/')
+ return _AppPhysicalPath + _Page.Replace ('/', Path.DirectorySeparatorChar);
+
+ return _AppPhysicalPath + _Page;
+ }
+
+ public override string GetHttpVerbName ()
+ {
+ return "GET";
+ }
+
+ public override string GetHttpVersion ()
+ {
+ return "HTTP/1.0";
+ }
+
+ public override string GetLocalAddress ()
+ {
+ return "127.0.0.1";
+ }
+
+ public override int GetLocalPort ()
+ {
+ return 80;
+ }
+
+ public override string GetPathInfo ()
+ {
+ return (null != _PathInfo) ? _PathInfo : String.Empty;
+ }
+
+ public override string GetQueryString ()
+ {
+ return _Query;
+ }
+
+ public override string GetRawUrl ()
+ {
+ string path = CreatePath (true);
+ if (null != _Query && _Query.Length > 0)
+ return path + "?" + _Query;
+
+ return path;
+ }
+
+ public override string GetRemoteAddress()
+ {
+ return "127.0.0.1";
+ }
+
+ public override int GetRemotePort()
+ {
+ return 0;
+ }
+
+ public override string GetServerVariable(string name)
+ {
+ return String.Empty;
+ }
+
+ public override string GetUriPath()
+ {
+ return CreatePath (true);
+ }
+
+ public override IntPtr GetUserToken()
+ {
+ return IntPtr.Zero;
+ }
+
+ public override string MapPath (string path)
+ {
+ string sPath = _AppPhysicalPath.Substring (0, _AppPhysicalPath.Length - 1);
+ if (path != null && path.Length > 0 && path [0] != '/')
+ return sPath;
+
+ char sep = Path.DirectorySeparatorChar;
+ if (path.StartsWith(_AppVirtualPath)) {
+ if (sep == '/')
+ return sPath + path.Substring (_AppVirtualPath.Length);
+ else
+ return sPath + path.Substring (_AppVirtualPath.Length).Replace ('/', '\\');
+ }
+
+ return null;
+ }
+
+ public override void SendKnownResponseHeader (int index, string value)
+ {
+ }
+
+ public override void SendResponseFromFile (IntPtr handle, long offset, long length)
+ {
+ }
+
+ public override void SendResponseFromFile (string filename, long offset, long length)
+ {
+ }
+
+ public override void SendResponseFromMemory (byte [] data, int length)
+ {
+ _Output.Write (Encoding.Default.GetChars (data, 0, length));
+ }
+
+ public override void SendStatus(int statusCode, string statusDescription)
+ {
+ }
+
+ public override void SendUnknownResponseHeader(string name, string value)
+ {
+ }
+
+ // Create's a path string
+ private string CheckAndAddSlash(string sPath)
+ {
+ if (null == sPath)
+ return null;
+
+ if (!sPath.EndsWith ("" + Path.DirectorySeparatorChar))
+ return sPath + Path.DirectorySeparatorChar;
+
+ return sPath;
+ }
+
+ // Create's a path string
+ private string CreatePath (bool bIncludePathInfo)
+ {
+ string sPath;
+
+ if ("/" != _AppVirtualPath)
+ sPath = "/" + _Page;
+ else
+ sPath = String.Empty;
+
+ if (bIncludePathInfo && null != _PathInfo)
+ return sPath + _PathInfo;
+
+ return sPath;
+ }
+
+ // Parses out the string after / known as the "path info"
+ private void ParsePathInfo ()
+ {
+ /* int iPos = _Page.LastIndexOf("/");
+ if (iPos >= 0) {
+ _PathInfo = _Page.Substring (iPos);
+ _Page = _Page.Substring (0, iPos);
+ }*/
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Mail/ChangeLog b/mcs/class/System.Web/System.Web.Mail/ChangeLog
new file mode 100644
index 00000000000..b2e226261e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/ChangeLog
@@ -0,0 +1,12 @@
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SmtpMail.cs: i don't wanna see that warning :-).
+
+2002-04-26 Lawrence Pit <loz@cable.a2000.nl>
+
+ * MailAttachment.cs: Implemented
+ * MailEncoding.cs: Implemented
+ * MailFormat.cs: Implemented
+ * MailMessage.cs: Implemented
+ * MailPriority.cs: Implemented
+ * SmtpMail.cs: Stubbed
diff --git a/mcs/class/System.Web/System.Web.Mail/MailAttachment.cs b/mcs/class/System.Web/System.Web.Mail/MailAttachment.cs
new file mode 100644
index 00000000000..b0f5dfcc3a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailAttachment.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.Mail.MailAttachment.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+namespace System.Web.Mail
+{
+ public class MailAttachment
+ {
+ private string filename;
+ private MailEncoding encoding;
+
+ public MailAttachment (string filename) :
+ this (filename, MailEncoding.Base64)
+ {
+ }
+
+ public MailAttachment (string filename, MailEncoding encoding)
+ {
+ this.filename = filename;
+ this.encoding = encoding;
+ try {
+ System.IO.File.OpenRead (filename).Close ();
+ } catch (Exception) {
+ throw new System.Web.HttpException ("Cannot find file: " + filename);
+ }
+ }
+
+ // Properties
+ public string Filename
+ {
+ get { return filename; }
+ }
+
+ public MailEncoding Encoding
+ {
+ get { return encoding; }
+ }
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailEncoding.cs b/mcs/class/System.Web/System.Web.Mail/MailEncoding.cs
new file mode 100644
index 00000000000..16b1b341a91
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailEncoding.cs
@@ -0,0 +1,26 @@
+//
+// System.Web.Mail.MailEncoding.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+namespace System.Web.Mail
+{
+
+ /// <summary>
+ /// </summary>
+ public enum MailEncoding
+ {
+
+ /// <summary>
+ /// </summary>
+ UUEncode = 0,
+
+ /// <summary>
+ /// </summary>
+ Base64 = 1
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailFormat.cs b/mcs/class/System.Web/System.Web.Mail/MailFormat.cs
new file mode 100644
index 00000000000..e1050d78549
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailFormat.cs
@@ -0,0 +1,26 @@
+//
+// System.Web.Mail.MailFormat.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+namespace System.Web.Mail
+{
+
+ /// <summary>
+ /// </summary>
+ public enum MailFormat
+ {
+
+ /// <summary>
+ /// </summary>
+ Text = 0,
+
+ /// <summary>
+ /// </summary>
+ Html = 1
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailMessage.cs b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs
new file mode 100644
index 00000000000..11d85b9c04c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailMessage.cs
@@ -0,0 +1,106 @@
+//
+// System.Web.Mail.MailMessage.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+namespace System.Web.Mail
+{
+ /// <remarks>
+ /// </remarks>
+ public class MailMessage
+ {
+ private ArrayList attachments;
+ private string bcc;
+ private string body;
+ private Encoding bodyEncoding;
+ private MailFormat bodyFormat;
+ private string cc;
+ private string from;
+ private ListDictionary headers;
+ private MailPriority priority;
+ private string subject;
+ private string to;
+ private string urlContentBase;
+ private string urlContentLocation;
+
+ // Constructor
+ public MailMessage ()
+ {
+ attachments = new ArrayList (8);
+ headers = new ListDictionary ();
+ }
+
+ // Properties
+ public IList Attachments {
+ get { return (IList) attachments; }
+ }
+
+ public string Bcc {
+ get { return bcc; }
+ set { bcc = value; }
+ }
+
+ public string Body {
+ get { return body; }
+ set { body = value; }
+ }
+
+ public Encoding BodyEncoding {
+ get { return bodyEncoding; }
+ set { bodyEncoding = value; }
+ }
+
+ public MailFormat BodyFormat {
+ get { return bodyFormat; }
+ set { bodyFormat = value; }
+ }
+
+ public string Cc {
+ get { return cc; }
+ set { cc = value; }
+ }
+
+ public string From {
+ get { return from; }
+ set { from = value; }
+ }
+
+ public IDictionary Headers {
+ get { return (IDictionary) headers; }
+ }
+
+ public MailPriority Priority {
+ get { return priority; }
+ set { priority = value; }
+ }
+
+ public string Subject {
+ get { return subject; }
+ set { subject = value; }
+ }
+
+ public string To {
+ get { return to; }
+ set { to = value; }
+ }
+
+ public string UrlContentBase {
+ get { return urlContentBase; }
+ set { urlContentBase = value; }
+ }
+
+ public string UrlContentLocation {
+ get { return urlContentLocation; }
+ set { urlContentLocation = value; }
+ }
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/MailPriority.cs b/mcs/class/System.Web/System.Web.Mail/MailPriority.cs
new file mode 100644
index 00000000000..6b6c638edf2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/MailPriority.cs
@@ -0,0 +1,30 @@
+//
+// System.Web.Mail.MailPriority.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+namespace System.Web.Mail
+{
+
+ /// <summary>
+ /// </summary>
+ public enum MailPriority
+ {
+
+ /// <summary>
+ /// </summary>
+ Normal = 0,
+
+ /// <summary>
+ /// </summary>
+ Low = 1,
+
+ /// <summary>
+ /// </summary>
+ High = 2
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpMail.cs b/mcs/class/System.Web/System.Web.Mail/SmtpMail.cs
new file mode 100644
index 00000000000..3fb1d2d8135
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Mail/SmtpMail.cs
@@ -0,0 +1,77 @@
+//
+// System.Web.Mail.SmtpMail.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+//
+
+using System;
+using System.Net;
+using System.Reflection;
+
+namespace System.Web.Mail
+{
+ /// <remarks>
+ /// </remarks>
+ public class SmtpMail
+ {
+ private static string smtpServer;
+
+ // Constructor
+ private SmtpMail ()
+ {
+ /* empty */
+ }
+
+ // Properties
+ public static string SmtpServer {
+ get { return smtpServer; }
+ set { smtpServer = value; }
+ }
+
+ [MonoTODO]
+ public static void Send (MailMessage message)
+ {
+ // delegate work to loosly coupled component Mono.Mail
+
+ // Mono.Mail.Smtp.SmtpSender.Send (smtpServer, message);
+
+ // NOTE: Mono.Mail is work in progress, and could be replaced by
+ // another component. For now:
+
+ throw new NotImplementedException("Mono.Mail component is work in progress");
+
+ /*
+ try {
+ // TODO: possibly cache ctor info object..
+ Type stype = Type.GetType ("Mono.Mail.Smtp.SmtpSender");
+ if (stype == null) {
+ throw new Exception ("You must have Mono.Mail installed to send mail.");
+ }
+ Type[] types = new Type[2];
+ types[0] = typeof (string);
+ types[1] = message.GetType ();
+ ConstructorInfo cinfo =
+ stype.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null,
+ CallingConventions.HasThis, types, null);
+ cinfo.Invoke (new object[] {smtpServer, message});
+ } catch (Exception) {
+ throw new Exception ("Unable to call Mono.Mail.Smtp.SmtpSender");
+ }
+ */
+ }
+
+ public static void Send (string from, string to, string subject, string messageText)
+ {
+ MailMessage message = new MailMessage ();
+ message.From = from;
+ message.To = to;
+ message.Subject = subject;
+ message.Body = messageText;
+ Send (message);
+ }
+
+ }
+
+} //namespace System.Web.Mail
diff --git a/mcs/class/System.Web/System.Web.Security/ChangeLog b/mcs/class/System.Web/System.Web.Security/ChangeLog
new file mode 100644
index 00000000000..68177fddc55
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/ChangeLog
@@ -0,0 +1,59 @@
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationModule.cs: implemented. It just create a default
+ unauthenticated user when no one else provided one.
+
+ * FormsAuthenticationModule.cs: removed debug output.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthenticationModule.cs: remove debug lines.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: return a null ticket when an exception is
+ thrown creating it. Implemented RenewTicketIfOld.
+
+ * FormsAuthenticationModule.cs: implemented event handlers for
+ AuthenticateRequest and EndRequest.
+
+ * FormsAuthenticationTicket.cs: implemented SetDates and Clone methods.
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: implemented GetAuthCookie, SetAuthCookie,
+ SignOut, FormsCookieName and FormsCookiePath.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: implemented Authenticate, unencrypted Encrypt
+ and Decrypt, HashPasswordForStoringInConfigFile and Initialize.
+
+ * FormsAuthenticationTicket.cs: set cookiePath to the default when no
+ other provided.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationEventHandler.cs:
+ * DefaultAuthenticationModule.cs:
+ * FileAuthorizationModule.cs:
+ * FormsAuthentication.cs:
+ * FormsAuthenticationEventArgs.cs:
+ * FormsAuthenticationEventHandler.cs:
+ * FormsAuthenticationModule.cs:
+ * FormsAuthenticationTicket.cs:
+ * FormsIdentity.cs:
+ * PassportAuthenticationEventArgs.cs:
+ * PassportAuthenticationEventHandler.cs:
+ * PassportAuthenticationModule.cs:
+ * PassportIdentity.cs:
+ * UrlAuthorizationModule.cs:
+ * WindowsAuthenticationEventArgs.cs:
+ * WindowsAuthenticationEventHandler.cs:
+ * WindowsAuthenticationModule.cs: new files. Some of them implemented,
+ some others stubbed out.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultAuthenticationEventArgs.cs: added file.
+
diff --git a/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..2031b829d9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventArgs.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.Security.DefaultAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Security {
+ using System;
+ using System.Web;
+
+public sealed class DefaultAuthenticationEventArgs : EventArgs
+{
+ private HttpContext _context;
+
+ public DefaultAuthenticationEventArgs (HttpContext context)
+ {
+ if (context == null)
+ throw new ArgumentNullException ("context");
+
+ _context = context;
+ }
+
+ public HttpContext Context
+ {
+ get { return _context; }
+ }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..1b9ab56cd79
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.Security.DefaultAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Security
+{
+ public delegate void DefaultAuthenticationEventHandler (object sender,
+ DefaultAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
new file mode 100644
index 00000000000..d9b56142143
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/DefaultAuthenticationModule.cs
@@ -0,0 +1,43 @@
+//
+// System.Web.Security.DefaultAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ public sealed class DefaultAuthenticationModule : IHttpModule
+ {
+ static GenericIdentity defaultIdentity = new GenericIdentity ("", "");
+
+ public event DefaultAuthenticationEventHandler Authenticate;
+
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.DefaultAuthentication += new EventHandler (OnDefaultAuthentication);
+ }
+
+ void OnDefaultAuthentication (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+
+ if (context.User == null && Authenticate != null)
+ Authenticate (this, new DefaultAuthenticationEventArgs (context));
+
+ if (context.User == null)
+ context.User = new GenericPrincipal (defaultIdentity, new string [0]);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs b/mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs
new file mode 100644
index 00000000000..af70f6f4248
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FileAuthorizationModule.cs
@@ -0,0 +1,27 @@
+//
+// System.Web.Security.FileAuthorizationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class FileAuthorizationModule : IHttpModule
+ {
+ public void Dispose ()
+ {
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
new file mode 100644
index 00000000000..4bba86d5c1b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
@@ -0,0 +1,300 @@
+//
+// System.Web.Security.FormsAuthentication
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.Security
+{
+ public sealed class FormsAuthentication
+ {
+ static string authConfigPath = "system.web/authentication";
+ static bool initialized;
+ static string cookieName;
+ static string cookiePath;
+ static int timeout;
+ static FormsProtectionEnum protection;
+
+ public static bool Authenticate (string name, string password)
+ {
+ if (name == null || password == null)
+ return false;
+
+ Initialize ();
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ AuthConfig config = context.GetConfig (authConfigPath) as AuthConfig;
+ Hashtable users = config.CredentialUsers;
+ string stored = users [name] as string;
+ if (stored == null)
+ return false;
+
+ switch (config.PasswordFormat) {
+ case FormsAuthPasswordFormat.Clear:
+ /* Do nothing */
+ break;
+ case FormsAuthPasswordFormat.MD5:
+ stored = HashPasswordForStoringInConfigFile (stored, "MD5");
+ break;
+ case FormsAuthPasswordFormat.SHA1:
+ stored = HashPasswordForStoringInConfigFile (stored, "SHA1");
+ break;
+ }
+
+ return (password == stored);
+ }
+
+ public static FormsAuthenticationTicket Decrypt (string encryptedTicket)
+ {
+ if (encryptedTicket == null || encryptedTicket == String.Empty)
+ throw new ArgumentException ("Invalid encrypted ticket", "encryptedTicket");
+
+ Initialize ();
+ byte [] bytes = MachineKeyConfigHandler.GetBytes (encryptedTicket, encryptedTicket.Length);
+ //TODO: decrypt
+ string decrypted = WebEncoding.Encoding.GetString (bytes);
+ FormsAuthenticationTicket ticket = null;
+ try {
+ string [] values = decrypted.Split ((char) 1, (char) 2, (char) 3, (char) 4, (char) 5, (char) 6, (char) 7);
+ if (values.Length != 8)
+ throw new Exception (values.Length + " " + encryptedTicket);
+
+
+ ticket = new FormsAuthenticationTicket (Int32.Parse (values [0]),
+ values [1],
+ new DateTime (Int64.Parse (values [2])),
+ new DateTime (Int64.Parse (values [3])),
+ (values [4] == "1"),
+ values [5],
+ values [6]);
+ } catch (Exception e) {
+ ticket = null;
+ }
+
+ return ticket;
+ }
+
+ public static string Encrypt (FormsAuthenticationTicket ticket)
+ {
+ if (ticket == null)
+ throw new ArgumentNullException ("ticket");
+
+ Initialize ();
+ StringBuilder allTicket = new StringBuilder ();
+ allTicket.Append (ticket.Version);
+ allTicket.Append ('\u0001');
+ allTicket.Append (ticket.Name);
+ allTicket.Append ('\u0002');
+ allTicket.Append (ticket.IssueDate.Ticks);
+ allTicket.Append ('\u0003');
+ allTicket.Append (ticket.Expiration.Ticks);
+ allTicket.Append ('\u0004');
+ allTicket.Append (ticket.IsPersistent ? '1' : '0');
+ allTicket.Append ('\u0005');
+ allTicket.Append (ticket.UserData);
+ allTicket.Append ('\u0006');
+ allTicket.Append (ticket.CookiePath);
+ allTicket.Append ('\u0007');
+ //if (protection == FormsProtectionEnum.None)
+ return GetHexString (allTicket.ToString ());
+ //TODO: encrypt and validate
+ }
+
+ public static HttpCookie GetAuthCookie (string userName, bool createPersistentCookie)
+ {
+ return GetAuthCookie (userName, createPersistentCookie, cookiePath);
+ }
+
+ public static HttpCookie GetAuthCookie (string userName, bool createPersistentCookie, string strCookiePath)
+ {
+ Initialize ();
+
+ if (userName == null)
+ userName = String.Empty;
+
+ if (strCookiePath == null || strCookiePath.Length == 0)
+ strCookiePath = cookiePath;
+
+ DateTime now = DateTime.Now;
+ DateTime then;
+ if (createPersistentCookie)
+ then = now.AddYears (50);
+ else
+ then = now.AddMinutes (timeout);
+
+ FormsAuthenticationTicket ticket = new FormsAuthenticationTicket (1,
+ userName,
+ now,
+ then,
+ createPersistentCookie,
+ String.Empty,
+ cookiePath);
+
+ if (!createPersistentCookie)
+ then = DateTime.MinValue;
+
+ return new HttpCookie (cookieName, Encrypt (ticket), strCookiePath, then);
+ }
+
+ [MonoTODO]
+ public static string GetRedirectUrl (string userName, bool createPersistentCookie)
+ {
+ throw new NotImplementedException ();
+ }
+
+ static string GetHexString (string str)
+ {
+ return GetHexString (WebEncoding.Encoding.GetBytes (str));
+ }
+
+ static string GetHexString (byte [] bytes)
+ {
+ StringBuilder result = new StringBuilder (bytes.Length * 2);
+ foreach (byte b in bytes)
+ result.AppendFormat ("{0:x2}", (int) b);
+
+ return result.ToString ();
+ }
+
+ public static string HashPasswordForStoringInConfigFile (string password, string passwordFormat)
+ {
+ if (password == null)
+ throw new ArgumentNullException ("password");
+
+ if (passwordFormat == null)
+ throw new ArgumentNullException ("passwordFormat");
+
+ byte [] bytes;
+ if (String.Compare (passwordFormat, "MD5", true) == 0) {
+ bytes = MD5.Create ().ComputeHash (WebEncoding.Encoding.GetBytes (password));
+ } else if (String.Compare (passwordFormat, "SHA1", true) == 0) {
+ bytes = SHA1.Create ().ComputeHash (WebEncoding.Encoding.GetBytes (password));
+ } else {
+ throw new ArgumentException ("The format must be either MD5 or SHA1", "passwordFormat");
+ }
+
+ return GetHexString (bytes);
+ }
+
+ public static void Initialize ()
+ {
+ if (initialized)
+ return;
+
+ lock (typeof (FormsAuthentication)) {
+ if (initialized)
+ return;
+
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ AuthConfig authConfig = context.GetConfig (authConfigPath) as AuthConfig;
+ if (authConfig != null) {
+ cookieName = authConfig.CookieName;
+ timeout = authConfig.Timeout;
+ cookiePath = authConfig.CookiePath;
+ protection = authConfig.Protection;
+ } else {
+ cookieName = ".MONOAUTH";
+ timeout = 30;
+ cookiePath = "/";
+ protection = FormsProtectionEnum.All;
+ }
+
+ initialized = true;
+ }
+ }
+
+ [MonoTODO]
+ public static void RedirectFromLoginPage (string userName, bool createPersistentCookie)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void RedirectFromLoginPage (string userName, bool createPersistentCookie, string strCookiePath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static FormsAuthenticationTicket RenewTicketIfOld (FormsAuthenticationTicket tOld)
+ {
+ if (tOld == null)
+ return null;
+
+ DateTime now = DateTime.Now;
+ TimeSpan toIssue = now - tOld.IssueDate;
+ TimeSpan toExpiration = tOld.Expiration - now;
+ if (toExpiration > toIssue)
+ return tOld;
+
+ FormsAuthenticationTicket tNew = tOld.Clone ();
+ tNew.SetDates (now, now - toExpiration + toIssue);
+ return tNew;
+ }
+
+ public static void SetAuthCookie (string userName, bool createPersistentCookie)
+ {
+ SetAuthCookie (userName, createPersistentCookie, cookiePath);
+ }
+
+ public static void SetAuthCookie (string userName, bool createPersistentCookie, string strCookiePath)
+ {
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ HttpResponse response = context.Response;
+ if (response == null)
+ throw new HttpException ("Response is null!");
+
+ response.Cookies.Add (GetAuthCookie (userName, createPersistentCookie, strCookiePath));
+ }
+
+ public static void SignOut ()
+ {
+ Initialize ();
+
+ HttpContext context = HttpContext.Current;
+ if (context == null)
+ throw new HttpException ("Context is null!");
+
+ HttpResponse response = context.Response;
+ if (response == null)
+ throw new HttpException ("Response is null!");
+
+ response.Cookies.MakeCookieExpire (cookieName, cookiePath);
+ }
+
+ public static string FormsCookieName
+ {
+ get {
+ Initialize ();
+ return cookieName;
+ }
+ }
+
+ public static string FormsCookiePath
+ {
+ get {
+ Initialize ();
+ return cookiePath;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..bbc61068513
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventArgs.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.Security.FormsAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Security.Principal;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class FormsAuthenticationEventArgs : EventArgs
+ {
+ IPrincipal user;
+ HttpContext context;
+
+ public FormsAuthenticationEventArgs (HttpContext context)
+ {
+ this.context = context;
+ }
+
+ public HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return user;
+ }
+
+ set {
+ user = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..ae47ed31206
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.Web.Security.FormsAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Security
+{
+ public delegate void FormsAuthenticationEventHandler (object sender, FormsAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
new file mode 100644
index 00000000000..21fc124de0d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
@@ -0,0 +1,91 @@
+//
+// System.Web.Security.FormsAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Security.Principal;
+using System.Web;
+using System.Web.Configuration;
+
+namespace System.Web.Security
+{
+ public sealed class FormsAuthenticationModule : IHttpModule
+ {
+ bool noForms;
+
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.AuthenticateRequest += new EventHandler (OnAuthenticateRequest);
+ app.EndRequest += new EventHandler (OnEndRequest);
+ }
+
+ void OnAuthenticateRequest (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+ AuthConfig config = (AuthConfig) context.GetConfig ("system.web/authentication");
+ if (config.Mode != AuthenticationMode.Forms) {
+ noForms = true;
+ return;
+ }
+
+ string cookieName = config.CookieName;
+ string cookiePath = config.CookiePath;
+ string loginPage = config.LoginUrl;
+
+ FormsAuthenticationEventArgs formArgs = new FormsAuthenticationEventArgs (context);
+ if (Authenticate != null)
+ Authenticate (this, formArgs);
+
+ bool contextUserNull = (context.User == null);
+ if (formArgs.User != null || !contextUserNull) {
+ if (contextUserNull)
+ context.User = formArgs.User;
+ return;
+ }
+
+ HttpCookie cookie = context.Request.Cookies [cookieName];
+ if (cookie == null || (cookie.Expires != DateTime.MinValue && cookie.Expires < DateTime.Now)) {
+ return;
+ }
+
+ FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt (cookie.Value);
+ FormsAuthentication.RenewTicketIfOld (ticket);
+ context.User = new GenericPrincipal (new FormsIdentity (ticket), new string [0]);
+
+ cookie.Value = FormsAuthentication.Encrypt (ticket);
+ cookie.Path = cookiePath;
+ if (ticket.IsPersistent)
+ cookie.Expires = ticket.Expiration;
+
+ context.Response.Cookies.Add (cookie);
+ context.SkipAuthorization = (context.Request.Path == loginPage);
+ }
+
+ void OnEndRequest (object sender, EventArgs args)
+ {
+ if (noForms)
+ return;
+
+ HttpApplication app = (HttpApplication) sender;
+ HttpContext context = app.Context;
+ if (context.Response.StatusCode != 401)
+ return;
+
+ AuthConfig config = (AuthConfig) context.GetConfig ("system.web/authentication");
+ context.Response.Redirect (config.LoginUrl);
+ }
+
+ public event FormsAuthenticationEventHandler Authenticate;
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
new file mode 100644
index 00000000000..d867c7783fc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
@@ -0,0 +1,147 @@
+//
+// System.Web.Security.FormsAuthenticationTicket
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Web.Security
+{
+ [Serializable]
+ public sealed class FormsAuthenticationTicket
+ {
+ int version;
+ string name;
+ DateTime issueDate;
+ DateTime expiration;
+ bool isPersistent;
+ string userData;
+ string cookiePath;
+
+ public FormsAuthenticationTicket (int version,
+ string name,
+ DateTime issueDate,
+ DateTime expiration,
+ bool isPersistent,
+ string userData)
+ {
+ this.version = version;
+ this.name = name;
+ this.issueDate = issueDate;
+ this.expiration = expiration;
+ this.isPersistent = isPersistent;
+ this.userData = userData;
+ this.cookiePath = "/";
+ }
+
+ public FormsAuthenticationTicket (int version,
+ string name,
+ DateTime issueDate,
+ DateTime expiration,
+ bool isPersistent,
+ string userData,
+ string cookiePath)
+ {
+ this.version = version;
+ this.name = name;
+ this.issueDate = issueDate;
+ this.expiration = expiration;
+ this.isPersistent = isPersistent;
+ this.userData = userData;
+ this.cookiePath = cookiePath;
+ }
+
+ public FormsAuthenticationTicket (string name, bool isPersistent, int timeout)
+ {
+ this.version = 1;
+ this.name = name;
+ this.issueDate = DateTime.Now;
+ this.isPersistent = isPersistent;
+ if (isPersistent)
+ expiration = issueDate.AddYears (50);
+ else
+ expiration = issueDate.AddMinutes ((double) timeout);
+
+ this.userData = String.Empty;
+ this.cookiePath = "/";
+ }
+
+ internal void SetDates (DateTime issueDate, DateTime expiration)
+ {
+ this.issueDate = issueDate;
+ this.expiration = expiration;
+ }
+
+ internal FormsAuthenticationTicket Clone ()
+ {
+ return new FormsAuthenticationTicket (version,
+ name,
+ issueDate,
+ expiration,
+ isPersistent,
+ userData,
+ cookiePath);
+ }
+
+ public string CookiePath
+ {
+ get {
+ return cookiePath;
+ }
+ }
+
+ public DateTime Expiration
+ {
+ get {
+ return expiration;
+ }
+ }
+
+ public bool Expired
+ {
+ get {
+ return DateTime.Now > expiration;
+ }
+ }
+
+ public bool IsPersistent
+ {
+ get {
+ return isPersistent;
+ }
+ }
+
+ public DateTime IssueDate
+ {
+ get {
+ return issueDate;
+ }
+ }
+
+ public string Name
+ {
+ get {
+ return name;
+ }
+ }
+
+ public string UserData
+ {
+ get {
+ return userData;
+ }
+ }
+
+ public int Version
+ {
+ get {
+ return version;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/FormsIdentity.cs b/mcs/class/System.Web/System.Web.Security/FormsIdentity.cs
new file mode 100644
index 00000000000..98fedabdcae
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/FormsIdentity.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Security.FormsIdentity
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ [Serializable]
+ public sealed class FormsIdentity : IIdentity
+ {
+ FormsAuthenticationTicket ticket;
+
+ public FormsIdentity (FormsAuthenticationTicket ticket)
+ {
+ this.ticket = ticket;
+ }
+
+ public string AuthenticationType
+ {
+ get {
+ return "Forms";
+ }
+ }
+
+ public bool IsAuthenticated
+ {
+ get {
+ return true;
+ }
+ }
+
+ public string Name
+ {
+ get {
+ return ticket.Name;
+ }
+ }
+
+ public FormsAuthenticationTicket Ticket
+ {
+ get {
+ return ticket;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..589b81fbf93
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventArgs.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Security.PassportAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Security.Principal;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class PassportAuthenticationEventArgs : EventArgs
+ {
+ PassportIdentity identity;
+ HttpContext context;
+ IPrincipal user;
+
+ public PassportAuthenticationEventArgs (PassportIdentity identity, HttpContext context)
+ {
+ this.identity = identity;
+ this.context = context;
+ }
+
+ public HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public PassportIdentity Identity
+ {
+ get {
+ return identity;
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return user;
+ }
+
+ set {
+ user = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..20181ae7098
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.Security.PassportAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Security
+{
+ public delegate void PassportAuthenticationEventHandler (object sender,
+ PassportAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs
new file mode 100644
index 00000000000..e5f1c422f8f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportAuthenticationModule.cs
@@ -0,0 +1,29 @@
+//
+// System.Web.Security.PassportAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class PassportAuthenticationModule : IHttpModule
+ {
+ public event PassportAuthenticationEventHandler Authenticate;
+
+ public void Dispose ()
+ {
+ }
+
+ [MonoTODO("Will we ever implement this? :-)")]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs b/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
new file mode 100644
index 00000000000..937e825eecc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
@@ -0,0 +1,438 @@
+//
+// System.Web.Security.PassportIdentity
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ public sealed class PassportIdentity : IIdentity
+ {
+ [MonoTODO]
+ public PassportIdentity ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ ~PassportIdentity ()
+ {
+ }
+
+ [MonoTODO]
+ public string AuthUrl ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthUrl (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthUrl (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthUrl2 ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthUrl2 (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthUrl2 (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Compress (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool CryptIsValid ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int CryptPutHost (string strHost)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int CryptPutSite (string strSite)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Decompress (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Decrypt (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string Encrypt (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetCurrentConfig (string strAttribute)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDomainAttribute (string strAttribute, int iLCID, string strDomain)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDomainFromMemberName (string strMemberName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetIsAuthenticated (int iTimeWindow, bool bForceLogin, bool bCheckSecure)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetIsAuthenticated (int iTimeWindow, int iForceLogin, int iCheckSecure)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetLoginChallenge ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetLoginChallenge (string szRetURL,
+ int iTimeWindow,
+ int fForceLogin,
+ string szCOBrandArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth,
+ object oExtraParams)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetOption (string strOpt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetProfileObject (string strProfileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasFlag (int iFlagMask)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasProfile (string strProfile)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HaveConsent (bool bNeedFullConsent, bool bNeedBirthdate)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int LoginUser ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int LoginUser (string szRetURL,
+ int iTimeWindow,
+ bool fForceLogin,
+ string szCOBrandArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ bool fUseSecureAuth,
+ object oExtraParams)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int LoginUser (string szRetURL,
+ int iTimeWindow,
+ int fForceLogin,
+ string szCOBrandArgs,
+ int iLangID,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth,
+ object oExtraParams)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoTag ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoTag (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ bool fSecure,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoTag (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ int iSecure,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoTag2 ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoTag2 (string strReturnUrl,
+ int iTimeWindow,
+ bool fForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ bool fSecure,
+ string strNameSpace,
+ int iKPP,
+ bool bUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoTag2 (string strReturnUrl,
+ int iTimeWindow,
+ int iForceLogin,
+ string strCoBrandedArgs,
+ int iLangID,
+ int iSecure,
+ string strNameSpace,
+ int iKPP,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoutURL ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string LogoutURL (string szReturnURL,
+ string szCOBrandArgs,
+ int iLangID,
+ string strDomain,
+ int iUseSecureAuth)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetOption (string strOpt, object vOpt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SignOut (string strSignOutDotGifFileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object Ticket (string strAttribute)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string AuthenticationType
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Error
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool GetFromNetworkServer
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HasSavedPassword
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HasTicket
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string HexPUID
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsAuthenticated
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string this [string strProfileName]
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Name
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int TicketAge
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int TimeSinceSignIn
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs b/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs
new file mode 100644
index 00000000000..d648b3331cd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs
@@ -0,0 +1,33 @@
+//
+// System.Web.Security.UrlAuthorizationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Web;
+using System.Security.Principal;
+
+namespace System.Web.Security
+{
+ public sealed class UrlAuthorizationModule : IHttpModule
+ {
+ public UrlAuthorizationModule ()
+ {
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs
new file mode 100644
index 00000000000..b09de1c5d60
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventArgs.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Security.WindowsAuthenticationEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Security.Principal;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class WindowsAuthenticationEventArgs : EventArgs
+ {
+ WindowsIdentity identity;
+ HttpContext context;
+ IPrincipal user;
+
+ public WindowsAuthenticationEventArgs (WindowsIdentity identity, HttpContext context)
+ {
+ this.identity = identity;
+ this.context = context;
+ }
+
+ public System.Web.HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ public WindowsIdentity Identity
+ {
+ get {
+ return identity;
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return user;
+ }
+
+ set {
+ user = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs
new file mode 100644
index 00000000000..f1c0b47313e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.Security.WindowsAuthenticationEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.Security
+{
+ public delegate void WindowsAuthenticationEventHandler (object sender,
+ WindowsAuthenticationEventArgs e);
+}
+
diff --git a/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs
new file mode 100644
index 00000000000..419040e40a9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/WindowsAuthenticationModule.cs
@@ -0,0 +1,34 @@
+//
+// System.Web.Security.WindowsAuthenticationModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.Security
+{
+ public sealed class WindowsAuthenticationModule : IHttpModule
+ {
+ public event WindowsAuthenticationEventHandler Authenticate;
+
+ public WindowsAuthenticationModule ()
+ {
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ [MonoTODO]
+ public void Init (HttpApplication app)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/System.Web.SessionState/ChangeLog
new file mode 100644
index 00000000000..354c91f51d9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/ChangeLog
@@ -0,0 +1,39 @@
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SessionStateModule.cs: don't throw exception. Just for testing the
+ configuration stuff until we implement this.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: IsAbandoned is internal.
+ * SessionDictionary.cs: scope fixes.
+ * SessionStateModule.cs: added events.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.SessionState/HttpSessionState.cs:
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs: implemented more methods/properties.
+ * SessionDictionary.cs: New file.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.SessionState/HttpSessionState.cs:
+ * System.Web.SessionState/SessionStateModule.cs: new files with some
+ implementation and the rest stubbed.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IReadOnlySessionState.cs:
+ * IRequiresSessionState.cs:
+ * SessionStateMode.cs: new files.
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
new file mode 100644
index 00000000000..324470a97cc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
@@ -0,0 +1,199 @@
+//
+// System.Web.SessionState.HttpSessionState
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Threading;
+
+namespace System.Web.SessionState {
+public sealed class HttpSessionState : ICollection, IEnumerable
+{
+ private NameValueCollection _state; //FIXME: it should be a ManagementNamedValueCollection
+ private string _id;
+ private SessionDictionary _dict;
+ private HttpStaticObjectsCollection _staticObjects;
+ private int _timeout;
+ private bool _newSession;
+ private bool _isCookieless;
+ private SessionStateMode _mode;
+ private bool _isReadonly;
+ private bool _abandoned;
+
+ internal HttpSessionState (string id,
+ SessionDictionary dict,
+ HttpStaticObjectsCollection staticObjects,
+ int timeout,
+ bool newSession,
+ bool isCookieless,
+ SessionStateMode mode,
+ bool isReadonly)
+ {
+ _id = id;
+ _dict = dict;
+ _staticObjects = staticObjects;
+ _timeout = timeout;
+ _newSession = newSession;
+ _isCookieless = isCookieless;
+ _mode = mode;
+ _isReadonly = isReadonly;
+ }
+
+ // Compatibility with ASP
+ public int CodePage
+ {
+ get { return 0; }
+ set { }
+ }
+
+ public HttpSessionState Contents
+ {
+ get { return this; }
+ }
+
+ public int Count
+ {
+ get { return _state.Count; }
+ }
+
+ internal bool IsAbandoned
+ {
+ get { return _abandoned; }
+ }
+
+ public bool IsCookieless
+ {
+ get { return _isCookieless; }
+ }
+
+ public bool IsNewSession
+ {
+ get { return _newSession; }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return _isReadonly; }
+ }
+
+ public bool IsSynchronized
+ {
+ get { return false; }
+ }
+
+ public object this [string key]
+ {
+ get { return _state [key]; }
+ set { _state [key] = (string) value; }
+ }
+
+ public object this [int index]
+ {
+ get { return _state [index]; }
+ set {
+ string key = _state.Keys [index];
+ _state [key] = (string) value;
+ }
+ }
+
+ public NameObjectCollectionBase.KeysCollection Keys
+ {
+ get { return _state.Keys; }
+ }
+
+ public int LCID
+ {
+ get { return Thread.CurrentThread.CurrentCulture.LCID; }
+ set { Thread.CurrentThread.CurrentCulture = new CultureInfo(value); }
+ }
+
+ public SessionStateMode Mode
+ {
+ get { return _mode; }
+ }
+
+ public string SessionID
+ {
+ get { return _id; }
+ }
+
+ public HttpStaticObjectsCollection StaticObjects
+ {
+ get { return _staticObjects; }
+ }
+
+ public object SyncRoot
+ {
+ get { return this; }
+ }
+
+ public int Timeout
+ {
+ get { return _timeout; }
+ set { _timeout = value; }
+ }
+
+ public void Abandon ()
+ {
+ _abandoned = true;
+ }
+
+ public void Add (string name, object value)
+ {
+ if (_state == null)
+ _state = new NameValueCollection ();
+
+ _state.Add (name, (string) value);
+ }
+
+ public void Clear ()
+ {
+ if (_state != null)
+ _state.Clear ();
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ if (_state == null)
+ _state = new NameValueCollection ();
+
+ _state.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ if (_state == null)
+ _state = new NameValueCollection ();
+
+ return _state.GetEnumerator ();
+ }
+
+ public void Remove (string name)
+ {
+ if (_state != null)
+ _state.Remove (name);
+ }
+
+ public void RemoveAll ()
+ {
+ if (_state != null)
+ foreach (string key in _state.AllKeys)
+ _state.Remove (key);
+ }
+
+ [MonoTODO("Implement ManagementNameValueCollection")]
+ public void RemoveAt (int index)
+ {
+ throw new NotImplementedException ();
+ //if (_state != null)
+ // _state.RemoveAt (index);
+ }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs b/mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs
new file mode 100644
index 00000000000..d9eb664a484
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/IReadOnlySessionState.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.SessionState.IReadOnlySessionState
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.SessionState {
+public interface IReadOnlySessionState : IRequiresSessionState
+{
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs
new file mode 100644
index 00000000000..dd9a40b732b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/IRequiresSessionState.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.SessionState.IRequiresSessionState
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.SessionState {
+public interface IRequiresSessionState
+{
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
new file mode 100644
index 00000000000..a389125e1dd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
@@ -0,0 +1,93 @@
+//
+// System.Web.SessionState.SessionDictionary
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.IO;
+using System.Collections.Specialized;
+
+namespace System.Web.SessionState {
+internal class SessionDictionary : NameObjectCollectionBase
+{
+ private bool _dirty;
+
+ static SessionDictionary ()
+ {
+ }
+
+ public SessionDictionary ()
+ {
+ }
+
+ void Clear ()
+ {
+ _dirty = true;
+ BaseClear ();
+ }
+
+ [MonoTODO]
+ static SessionDictionary Deserialize (BinaryReader r)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetKey (int index)
+ {
+ return BaseGetKey (index);
+ }
+
+ [MonoTODO]
+ static bool IsInmutable (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ void Remove (string s)
+ {
+ BaseRemove (s);
+ _dirty = true;
+ }
+
+ void RemoveAt (int index)
+ {
+ BaseRemoveAt (index);
+ _dirty = true;
+ }
+
+ [MonoTODO]
+ void Serialize(BinaryWriter w)
+ {
+ throw new NotImplementedException ();
+ }
+
+ bool Dirty
+ {
+ get { return _dirty; }
+ set { _dirty = value; }
+ }
+
+ internal object this [string s]
+ {
+ get { return BaseGet (s); }
+ set {
+ BaseSet (s, value);
+ _dirty = true;
+ }
+ }
+
+ public object this [int index]
+ {
+ get { return BaseGet (index); }
+ set {
+ BaseSet (index, value);
+ _dirty = true;
+ }
+ }
+}
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs
new file mode 100644
index 00000000000..1a5fcc290c3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateMode.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.SessionState.SessionStateMode
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web.SessionState {
+public enum SessionStateMode
+{
+ Off = 0,
+ InProc = 1,
+ StateServer = 2,
+ SQLServer = 3
+}
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
new file mode 100644
index 00000000000..c3bf13d8baf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
@@ -0,0 +1,35 @@
+//
+// System.Web.SessionState.SesionStateModule
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System.Web;
+
+namespace System.Web.SessionState
+{
+ public sealed class SessionStateModule : IHttpModule
+ {
+ public SessionStateModule ()
+ {
+ }
+
+ [MonoTODO()]
+ public void Dispose ()
+ {
+ //throw new NotImplementedException ();
+ }
+
+ [MonoTODO()]
+ public void Init (HttpApplication app)
+ {
+ //throw new NotImplementedException ();
+ }
+
+ public event EventHandler Start;
+ public event EventHandler End;
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
new file mode 100644
index 00000000000..0c3d8e41974
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
@@ -0,0 +1,254 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.HtmlControls/HtmlForm.cs: render 'action' attribute.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputButton.cs: fixed bug #35677.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputControl.cs: fixed bug #35673.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputText.cs: fixed bug #35670.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs: fixed LoadViewstate.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlButton.cs: make it do a POST if the button has any ServerClick
+ events.
+
+2002-09-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlAnchor.cs:
+ * HtmlButton.cs:
+ * HtmlContainerControl.cs:
+ * HtmlControl.cs:
+ * HtmlForm.cs:
+ * HtmlGenericControl.cs:
+ * HtmlImage.cs:
+ * HtmlInputButton.cs:
+ * HtmlInputCheckBox.cs:
+ * HtmlInputControl.cs:
+ * HtmlInputFile.cs:
+ * HtmlInputHidden.cs:
+ * HtmlInputImage.cs:
+ * HtmlInputRadioButton.cs:
+ * HtmlInputText.cs:
+ * HtmlSelect.cs:
+ * HtmlTable.cs:
+ * HtmlTableCell.cs:
+ * HtmlTableRow.cs:
+ * HtmlTextArea.cs: added almost all missing attributes.
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlControl.cs: the attributes must use ViewState as its StateBag,
+ if not style values are lost between postbacks.
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlAnchor.cs:
+ * HtmlButton.cs:
+ * HtmlInputButton.cs:
+ * HtmlInputCheckBox.cs:
+ * HtmlInputHidden.cs:
+ * HtmlInputImage.cs:
+ * HtmlInputText.cs:
+ * HtmlTextArea.cs: Initialize EventHandlerList indexer.
+
+ * HtmlContainerControl.cs: almost rewritten to use a LiteralControl
+ instead of maintaining some flags and strings. Implemented
+ LoadViewState.
+
+ * HtmlControl.cs: fixed constructor and added ViewStateIgnoreCase.
+
+ * HtmlSelect.cs: fixed TrackViewState, SaveViewState, SelectedIndices
+ and Value.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlGenericControl.cs: fixed TagName signature and get/set.
+ * HtmlInputImage.cs: added attribute and fixed signature of ServerClick.
+ * HtmlInputText.cs: added attribute.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: don't render action attribute.
+
+2002-07-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlContainerControl.cs:
+ (CreateControlCollection): added. All containers must have a non-empty
+ control collection.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.HtmlControls/HtmlAnchor.cs:
+ * System.Web.UI.HtmlControls/HtmlButton.cs:
+ * System.Web.UI.HtmlControls/HtmlControl.cs:
+ * System.Web.UI.HtmlControls/HtmlForm.cs:
+ * System.Web.UI.HtmlControls/HtmlGenericControl.cs:
+ * System.Web.UI.HtmlControls/HtmlInputButton.cs:
+ * System.Web.UI.HtmlControls/HtmlInputCheckBox.cs:
+ * System.Web.UI.HtmlControls/HtmlInputControl.cs:
+ * System.Web.UI.HtmlControls/HtmlInputFile.cs:
+ * System.Web.UI.HtmlControls/HtmlInputHidden.cs:
+ * System.Web.UI.HtmlControls/HtmlInputImage.cs:
+ * System.Web.UI.HtmlControls/HtmlInputRadioButton.cs:
+ * System.Web.UI.HtmlControls/HtmlInputText.cs:
+ * System.Web.UI.HtmlControls/HtmlSelect.cs:
+ * System.Web.UI.HtmlControls/HtmlTable.cs:
+ * System.Web.UI.HtmlControls/HtmlTableCell.cs:
+ * System.Web.UI.HtmlControls/HtmlTableRow.cs:
+ * System.Web.UI.HtmlControls/HtmlTextArea.cs:
+
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs:
+ (RenderChildren): use OnFormRender and OnFormPostRender.
+
+2002-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlSelect.cs:
+ (RenderAttributes): new -> override and fixes stack overflow.
+ (RenderChildren): only 1 option can be selected at any given time
+ except when Multiple property is true.
+ (Multiple): the attribute value is either "true" or "false", not
+ "multiple".
+
+ * HtmlTable.cs:
+ (Add):
+ (AddAt): allow HtmlTableRow as children, not HtmlTableCell.
+
+ * HtmlTableCell.cs:
+ (RenderEndTag): new -> override.
+
+ * HtmlTableRow.cs:
+ (RenderChildren): fixed another stack overflow.
+ (RenderEndTag): new -> override.
+
+ * HtmlTextArea.cs:
+ (RenderAttributes): new -> override.
+
+
+2002-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlInputHidden.cs: fixed constructor.
+
+ * HtmlInputRadioButton.cs:
+ (RenderAttributes): fixed stack overflow.
+
+ (Name):
+ (RenderedName): new -> override.
+
+ (Value): new property.
+
+ * HtmlInputText.cs:
+ (RenderAttributes): fixed the same kind of stack overflow and make
+ string comparison case insensitive.
+
+2002-06-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlForm.cs: fixed name of Enctype property and render enctype
+ enctype attribute.
+
+ * HtmlInputControl.cs: tag type is "input", not "type".
+
+2002-06-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlControl.cs: Render contents moved to new RenderBeginTag method,
+ defined in MS docs.
+
+ * HtmlForm.cs: Render output when no IE browser.
+
+ * HtmlInputButton.cs: added constructor without arguments. Xsp used it,
+ though now it always use the other .ctor.
+
+ * HtmlInputControl.cs: cosmetic changes and implemented set_Name.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlButton.cs: RenderAttributes is an override, not new.
+
+ * HtmlContainerControl.cs: use the new Render method in HtmlControl.
+
+ * HtmlControl.cs: added Render method to render the tag and its
+ attributes. Works for container and non-containers.
+
+ * HtmlImage.cs: RenderAttributes don't need to be new. Implemented
+ Height property.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlContainerControl.cs: some formatting and use HttpUtility.Encode
+ instead of Page.Server to encode InnerText.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlAnchor.cs:
+ (RenderAttributes): new -> override and fixed little bug that made
+ it cause an stack overflow.
+
+ * HtmlContainerControl.cs: reformatted and added tag and attributes
+ rendering.
+
+ * HtmlGenericControl.cs: removed TagName, which is already in
+ HtmlControl.
+
+ * HtmlTable.cs:
+ (RenderEndTag): new -> override.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.HtmlControls/HtmlForm.cs:
+ (RenderAttributes): changed new by override.
+ (Name): allow setting the property.
+
+2002-05-10 Duncan Mak <duncan@ximian.com>
+
+ * HtmlTableCellCollection.cs (this): Updated the indexer to return
+ the right type, HtmlTableCell instead of HtmlTableRow.
+
+ * HtmlInputImage.cs (OnServerClick): Commented out parts that
+ won't compile.
+
+ * HtmlForm.cs (RenderAttributes):
+ (RenderChildren): Commented out code that doesn't compile.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * HtmlSelect.cs (TrackViewState): Added 'new' keyword to avoid
+ clashing with the method defined in the parent class.
+ (OnDataBinding): Added missing casts.
+
+ * HtmlForm.cs (Render): Fixed call too SetAttribute, need to cast
+ 'this' to IAttributeAccessor before calling interface method.
+ Also renamed some calls to reflect changes in the API.
+
+ * HtmlControl.cs (WriteOnClickAttribute): Made it not static and
+ fixed a typo.
+
+2001-09-03 Leen Toelen <toelen@hotmail.com>
+
+ * HtmlAnchor.cs: Initial implementation.
+ * HtmlTextArea.cs: Initial implementation.
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * HtmlContainerControl.cs: Initial implementation.
+ * HtmlControl.cs: Initial implementation.
+ * HtmlGenericControl.cs: Initial implementation.
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
new file mode 100644
index 00000000000..010312f848c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
@@ -0,0 +1,118 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick = new object ();
+
+ public HtmlAnchor(): base("a"){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && Events [EventServerClick] != null)
+ Page.RequiresPostBackScript ();
+ }
+
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if(handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ if ( Events[EventServerClick] != null){
+ Attributes.Remove("href");
+ base.RenderAttributes(writer);
+ writer.WriteAttribute("href", Page.GetPostBackClientHyperlink(this,String.Empty));
+ }
+ else{
+ PreProcessRelativeReference(writer,"href");
+ base.RenderAttributes(writer);
+ }
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ OnServerClick(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the control is clicked.")]
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Action")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string HRef{
+ get{
+ string attr = Attributes["href"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["href"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Navigation")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["name"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Navigation")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Title{
+ get{
+ string attr = Attributes["title"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["title"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlAnchor
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
new file mode 100644
index 00000000000..1bc75655859
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
@@ -0,0 +1,92 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick = new object ();
+
+ //Checked
+ public HtmlButton(): base("button"){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && Events [EventServerClick] != null)
+ Page.RequiresPostBackScript ();
+ }
+
+ //Checked
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if(handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ if (Page != null && Events [EventServerClick] != null) {
+ string script = Page.GetPostBackClientEvent (this, String.Empty);
+ AttributeCollection coll = Attributes;
+ if (coll ["language"] != null)
+ coll.Remove ("language");
+ writer.WriteAttribute ("language", "javascript");
+
+ string onclick;
+ if ((onclick = coll ["onclick"]) != null) {
+ script = onclick + " " + script;
+ coll.Remove ("onclick");
+ }
+
+ writer.WriteAttribute ("onclick", script);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the control is clicked.")]
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue(true)]
+ [WebCategory("Behavior")]
+ public bool CausesValidation{
+ get{
+ object attr = ViewState["CausesValidation"];
+ if (attr != null){
+ return (Boolean) attr;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // class HtmlButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
new file mode 100644
index 00000000000..79299fe1c06
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
@@ -0,0 +1,122 @@
+//
+// System.Web.UI.HtmlControls.HtmlContainerControl.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+
+//LAMESPEC: The dox talk about HttpException but are very ambigious.
+//TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
+//case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
+//to do anything with children.
+// a doc references this. add? protected override ControlCollection CreateControlCollection();
+
+//TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
+// Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
+//[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
+// System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
+// ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
+// System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
+// System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
+// System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
+// System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
+// System.Web.UI.Page.ProcessRequestMain() +660
+
+
+namespace System.Web.UI.HtmlControls
+{
+ public abstract class HtmlContainerControl : HtmlControl{
+
+ public HtmlContainerControl () : this ("span") {}
+
+ public HtmlContainerControl (string tag) : base(tag) {}
+
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public virtual string InnerHtml
+ {
+ get {
+ if (Controls.Count == 0)
+ return String.Empty;
+
+ bool is_literal = true;
+ StringBuilder text = new StringBuilder ();
+ foreach (Control ctrl in Controls) {
+ LiteralControl lc = ctrl as LiteralControl;
+ if (lc == null) {
+ is_literal = false;
+ break;
+ }
+ text.Append (lc.Text);
+ }
+
+ if (!is_literal)
+ throw new HttpException ("There is no literal content!");
+
+ return text.ToString ();
+ }
+
+ set {
+ Controls.Clear ();
+ Controls.Add (new LiteralControl (value));
+ ViewState ["innerhtml"] = value;
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public virtual string InnerText
+ {
+ get {
+ return InnerHtml; //FIXME: decode it
+ }
+
+ set {
+ InnerHtml = value; //FIXME: encode it
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ RenderBeginTag (writer);
+ RenderChildren (writer);
+ RenderEndTag (writer);
+ }
+
+ protected virtual void RenderEndTag (HtmlTextWriter writer)
+ {
+ writer.WriteEndTag (TagName);
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ ViewState.Remove ("innerhtml");
+ base.RenderAttributes (writer);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new ControlCollection (this);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ base.LoadViewState (savedState);
+ string inner = ViewState ["innerhtml"] as string;
+ if (inner != null)
+ InnerHtml = inner;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
new file mode 100644
index 00000000000..52893ecbcf7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
@@ -0,0 +1,133 @@
+//
+// System.Web.UI.HtmlControls.HtmlControl.cs
+//
+// Author
+// Bob Smith <bob@thestuff.net>
+//
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ToolboxItem(false)]
+ public abstract class HtmlControl : Control, IAttributeAccessor
+ {
+ private string _tagName = "span";
+ private AttributeCollection _attributes;
+ private bool _disabled = false;
+
+ public HtmlControl() : this ("span") {}
+
+ public HtmlControl(string tag)
+ {
+ _tagName = tag;
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ internal static string AttributeToString(int n){
+ if (n != -1)return n.ToString(NumberFormatInfo.InvariantInfo);
+ return null;
+ }
+
+ internal static string AttributeToString(string s){
+ if (s != null && s.Length != 0) return s;
+ return null;
+ }
+
+ internal void PreProcessRelativeReference(HtmlTextWriter writer, string attribName){
+ string attr = Attributes[attribName];
+ if (attr != null){
+ if (attr.Length != 0){
+ try{
+ attr = ResolveUrl(attr);
+ }
+ catch (Exception e) {
+ throw new HttpException(attribName + " property had malformed url");
+ }
+ writer.WriteAttribute(attribName, attr);
+ Attributes.Remove(attribName);
+ }
+ }
+ }
+
+ string System.Web.UI.IAttributeAccessor.GetAttribute(string name){
+ return Attributes[name];
+ }
+
+ void System.Web.UI.IAttributeAccessor.SetAttribute(string name, string value){
+ Attributes[name] = value;
+ }
+
+ protected virtual void RenderBeginTag (HtmlTextWriter writer)
+ {
+ writer.WriteBeginTag (TagName);
+ RenderAttributes (writer);
+ writer.Write ('>');
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ RenderBeginTag (writer);
+ }
+
+ protected virtual void RenderAttributes(HtmlTextWriter writer){
+ if (ID != null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ Attributes.Render(writer);
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection Attributes
+ {
+ get {
+ if (_attributes == null)
+ _attributes = new AttributeCollection (ViewState);
+ return _attributes;
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public bool Disabled
+ {
+ get { return _disabled; }
+ set { _disabled = value; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public CssStyleCollection Style
+ {
+ get { return Attributes.CssStyle; }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public virtual string TagName
+ {
+ get { return _tagName; }
+ }
+
+ protected override bool ViewStateIgnoresCase
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
new file mode 100644
index 00000000000..4f0b4f1f33e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
@@ -0,0 +1,176 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlForm : HtmlContainerControl{
+
+ private static string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
+
+ public HtmlForm(): base("form"){}
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", RenderedName);
+ Attributes.Remove("name");
+ writer.WriteAttribute("method", Method);
+ Attributes.Remove("method");
+ writer.WriteAttribute("action", Action, true);
+ Attributes.Remove("action");
+ if (Enctype != null){
+ writer.WriteAttribute ("enctype", Enctype);
+ Attributes.Remove ("enctype");
+ }
+
+
+// string clientOnSubmit = Page.ClientOnSubmitEvent;
+// if (clientOnSubmit != null && clientOnSubmit.Length > 0){
+// if (Attributes["onsubmit"] != null){
+// clientOnSubmit = String.Concat(clientOnSubmit,Attributes["onsubmit"]);
+// Attributes.Remove("onsubmit");
+// }
+// writer.WriteAttribute("language","javascript");
+// writer.WriteAttribute("onsubmit",clientOnSubmit);
+// }
+ if (ID == null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ protected override void Render(HtmlTextWriter output){
+ if (Page.SmartNavigation == false){
+ base.Render (output);
+ return;
+ }
+
+ ((IAttributeAccessor) this).SetAttribute("_smartNavigation","true");
+ HttpBrowserCapabilities browserCap = Context.Request.Browser;
+ if (browserCap.Browser.ToLower() != "ie" && browserCap.MajorVersion < 5){
+ base.Render(output);
+ return;
+ }
+ output.WriteLine("<IFRAME ID=_hifSmartNav NAME=_hifSmartNav STYLE=display:none ></IFRAME>");
+
+ if (browserCap.MinorVersion < 0.5 && browserCap.MajorVersion != 5)
+ Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNavIE5.js");
+ else if (Page.IsPostBack) Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNav.js");
+ base.Render(output);
+ }
+
+ protected override void RenderChildren (HtmlTextWriter writer)
+ {
+ Page.OnFormRender (writer,ClientID);
+ base.RenderChildren (writer);
+ Page.OnFormPostRender (writer,ClientID);
+ }
+
+ protected override void OnInit(EventArgs e){
+ base.OnInit(e);
+ Page.RegisterViewStateHandler();
+ }
+
+ internal string Action{
+ get{
+ string executionFilePath = Context.Request.CurrentExecutionFilePath;
+ string filePath = Context.Request.FilePath;
+ string attr;
+ if (String.ReferenceEquals(executionFilePath, filePath) == true){
+ attr = filePath;
+ int lastSlash = attr.LastIndexOf('/');
+ if (lastSlash >= 0)
+ attr = attr.Substring(lastSlash + 1);
+ }
+ else{
+ attr = System.Web.Util.UrlUtils.MakeRelative(filePath,executionFilePath);
+ }
+ string queryString = Context.Request.QueryStringRaw;
+ if (queryString != null && queryString.Length > 0)
+ attr = String.Concat(attr, '?', queryString);
+ return attr;
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Enctype{
+ get{
+ string attr = Attributes["enctype"];
+ if (attr != null){
+ return attr;
+ }
+ return null;
+ }
+ set{
+ Attributes["enctype"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Method{
+ get{
+ string attr = Attributes["method"];
+ if (attr != null){
+ return attr;
+ }
+ return "post";
+ }
+ set{
+ Attributes["method"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public virtual string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set {
+ Attributes ["Name"] = value;
+ }
+ }
+
+ internal string RenderedName{
+ get{
+ string attr = Name;
+ if (attr.Length > 0){
+ return attr;
+ }
+ return UniqueID;
+ }
+ }
+
+ } // class HtmlForm
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
new file mode 100644
index 00000000000..a7c4b2300e5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.HtmlControls.HtmlGenericControl.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ConstructorNeedsTag]
+ public class HtmlGenericControl : HtmlContainerControl {
+ private string tagName;
+
+ public HtmlGenericControl() :
+ this ("span")
+ {
+ }
+
+ public HtmlGenericControl (string tag) :
+ base ()
+ {
+ if (tag == null)
+ tag = "";
+ tagName = tag;
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public new string TagName
+ {
+ get { return tagName; }
+ set { tagName = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
new file mode 100755
index 00000000000..5cf3ce795d8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
@@ -0,0 +1,121 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+ public class HtmlImage : HtmlControl{
+
+ public HtmlImage(): base("img"){}
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
+ base.RenderAttributes(writer);
+ writer.Write(" /");
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Layout")]
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(0)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Appearance")]
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(100)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Layout")]
+ public int Height
+ {
+ get {
+ string attr = Attributes ["height"];
+ if (attr != null)
+ return Int32.Parse (attr, CultureInfo.InvariantCulture);
+
+ return -1;
+ }
+
+ set { Attributes["height"] = AttributeToString (value); }
+ }
+
+ [DefaultValue("")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Behavior")]
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(100)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Layout")]
+ public int Width{
+ get{
+ string attr = Attributes["width"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
new file mode 100755
index 00000000000..6940df113e2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
@@ -0,0 +1,99 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick = new object ();
+
+ public HtmlInputButton(): base ("button")
+ {
+ }
+
+ public HtmlInputButton(string type): base(type){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender(e);
+ if (Page != null && Events [EventServerClick] != null)
+ Page.RequiresPostBackScript ();
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ if (Page != null && CausesValidation) {
+ string type = Type;
+ if (String.Compare (type, "button", true) == 0 || String.Compare (type, "submit", true) == 0) {
+ string script = Page.GetPostBackClientEvent (this, String.Empty);
+ AttributeCollection coll = Attributes;
+ if (coll ["language"] != null)
+ coll.Remove ("language");
+ writer.WriteAttribute ("language", "javascript");
+
+ string onclick;
+ if ((onclick = coll ["onclick"]) != null) {
+ script = onclick + " " + script;
+ coll.Remove ("onclick");
+ }
+
+ writer.WriteAttribute ("onclick", script);
+ }
+ }
+
+ base.RenderAttributes (writer);
+ }
+
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerClick];
+ if (handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if(CausesValidation == true){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the control is clicked.")]
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue(true)]
+ [WebCategory("Behavior")]
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null){
+ return (Boolean) causesVal;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlInputButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
new file mode 100755
index 00000000000..26b7e204cd8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
@@ -0,0 +1,85 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputCheckBox(): base("checkbox"){}
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [postDataKey];
+ bool postChecked = false;
+ bool retval = false;
+
+ if (postValue != null)
+ postChecked = postValue.Length > 0;
+
+ if (Checked != postChecked){
+ retval = true;
+ Checked = postChecked;
+ }
+
+ return retval;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled)
+ Page.RegisterRequiresPostBack(this);
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("checkbox",false);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the checked satte of the control is changed.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Misc")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null)
+ return attr.Equals("checked");
+ return false;
+ }
+ set{
+ Attributes["checked"] = (value == true)? "checked": null;
+ }
+ }
+
+ } // class HtmlInputCheckBox
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
new file mode 100755
index 00000000000..ee23654859f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
@@ -0,0 +1,70 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls
+{
+
+ public abstract class HtmlInputControl : HtmlControl
+ {
+
+ public HtmlInputControl (string type) : base ("input")
+ {
+ Attributes ["type"] = type;
+ }
+
+ protected override void RenderAttributes (HtmlTextWriter writer)
+ {
+ writer.WriteAttribute ("name",RenderedName);
+ Attributes.Remove ("name");
+ base.RenderAttributes (writer);
+ writer.Write (" /");
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string Name
+ {
+ get { return UniqueID; }
+ set { }
+ }
+
+ protected virtual string RenderedName
+ {
+ get { return Name; }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Type
+ {
+ get {
+ string _type = Attributes ["type"];
+ return ((_type != null) ? _type : String.Empty);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string Value
+ {
+ get {
+ string attr = Attributes ["value"];
+ return ((attr != null) ? attr : String.Empty);
+ }
+
+ set { Attributes["value"] = value; }
+ }
+ } // class HtmlInputControl
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
new file mode 100755
index 00000000000..75d2d033a01
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
@@ -0,0 +1,88 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+ [ValidationProperty("Value")]
+ public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
+
+ public HtmlInputFile():base("file"){}
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Accept{
+ get{
+ string attr = Attributes["accept"];
+ if (attr != null)
+ return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int MaxLength{
+ get{
+ string attr = Attributes["maxlength"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Misc")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public HttpPostedFile PostedFile{
+ get{
+ return Context.Request.Files[RenderedName];
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
new file mode 100755
index 00000000000..16229466344
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
@@ -0,0 +1,62 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputHidden () : base ("hidden")
+ {
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ // don't need anything. LoadPostData always returns false.
+ }
+
+ protected virtual void OnServerChange (EventArgs e)
+ {
+ EventHandler handler = (EventHandler) Events [EventServerChange];
+ if (handler != null) handler.Invoke (this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("value",false);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the value of the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
new file mode 100755
index 00000000000..fc690e4f990
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
@@ -0,0 +1,145 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerClick")]
+ public class HtmlInputImage : HtmlInputControl, IPostBackEventHandler, IPostBackDataHandler{
+
+ private static readonly object EventServerClick = new object ();
+ private int _x, _y;
+
+ public HtmlInputImage(): base("image"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer)
+ {
+ base.RenderAttributes (writer);
+ // Anything else?
+ }
+
+ protected virtual void OnServerClick(ImageClickEventArgs e){
+ ImageClickEventHandler handler = (ImageClickEventHandler) Events[EventServerClick];
+ if (handler != null) handler (this, e);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postX = postCollection[String.Concat(RenderedName,".x")];
+ string postY = postCollection[String.Concat(RenderedName,".y")];
+ if (postX != null && postY != null && postX.Length >= 0 && postY.Length >= 0){
+ _x = Int32.Parse(postX, CultureInfo.InvariantCulture);
+ _y = Int32.Parse(postY, CultureInfo.InvariantCulture);
+ Page.RegisterRequiresRaiseEvent(this);
+ }
+ return false;
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate();
+ OnServerClick (new ImageClickEventArgs(_x, _y));
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the image is clicked.")]
+ public event ImageClickEventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(true)]
+ [WebCategory("Behavior")]
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null) return (Boolean) causesVal;
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+ } // class HtmlInputImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
new file mode 100755
index 00000000000..d8ba51d79f7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
@@ -0,0 +1,134 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ public class HtmlInputRadioButton : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputRadioButton(): base("radio"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ if (Events[EventServerChange] != null && !Disabled){
+ ViewState.SetItemDirty("checked", false);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("value", Value);
+ Attributes.Remove("value");
+ base.RenderAttributes(writer);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string postValue = postCollection [postDataKey];
+ bool myBool = false;
+ if (postValue != null && postValue.Equals (Value)) {
+ if (!Checked) {
+ Checked = true;
+ myBool = true;
+ }
+ } else {
+ if (Checked) {
+ Checked = false;
+ myBool = false;
+ }
+ }
+ return myBool;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the checked state of the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Misc")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null){
+ return attr.Equals("checked");
+ }
+ return false;
+ }
+ set{
+ if (value != true){
+ Attributes["checked"] = null;
+ }
+ Attributes["checked"] = "checked";
+ }
+ }
+ public override string Name
+ {
+ get {
+ string attr = Attributes ["name"]; // Gotta use "name" to group radio buttons
+ return (attr == null) ? String.Empty : attr;
+ }
+ set { Attributes ["name"] = value; }
+ }
+
+ protected override string RenderedName{
+ get{
+ string attr = base.RenderedName;
+ string id = UniqueID;
+ int indexOfX = id.LastIndexOf('X');
+ if (indexOfX != 0 && indexOfX >= 0){
+ attr = String.Concat(attr, id.Substring(0,indexOfX+1));
+ }
+ return attr;
+ }
+ }
+
+ public override string Value
+ {
+ get {
+ string v = Attributes ["value"];
+ if (v != null && v != "")
+ return v;
+ v = ID;
+ Attributes ["value"] = v;
+ return v;
+ }
+
+ set { Attributes ["value"] = value; }
+ }
+
+ } // class HtmlInputRadioButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
new file mode 100755
index 00000000000..cbbbb33e5b9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
@@ -0,0 +1,113 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ [ValidationProperty("Value")]
+ public class HtmlInputText : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlInputText(string type):base(type){}
+ public HtmlInputText():base("text"){}
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ if (Events [EventServerChange] == null && !Disabled)
+ ViewState.SetItemDirty("value",false);
+ }
+
+ protected virtual void OnServerChange (EventArgs e)
+ {
+ EventHandler handler = (EventHandler) Events [EventServerChange];
+ if (handler != null) handler (this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ //hide value when password box
+ if (String.Compare (Type, "password",true) == 0)
+ ViewState.Remove ("value");
+
+ base.RenderAttributes(writer);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string currentValue = Value;
+ string[] postedValue = postCollection.GetValues (postDataKey);
+ if (!currentValue.Equals (postedValue)){
+ Value = postedValue [0];
+ return true;
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the the text within the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int MaxLength{
+ get{
+ string attr = (String) ViewState["maxlength"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["maxlength"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Size{
+ get{
+ string attr = (String) ViewState["size"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public override string Value{
+ get{
+ string attr = Attributes["value"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["value"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlInputText
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
new file mode 100755
index 00000000000..9ace6eab302
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
@@ -0,0 +1,463 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Globalization;
+using System.ComponentModel;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ [ValidationProperty("Value")]
+ public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler{
+
+
+ private int _cachedSelectedIndex;
+ private object _dataSource;
+ private static readonly object EventServerChange = new object ();
+ private ListItemCollection _items;
+
+ public HtmlSelect():base("select"){
+ _cachedSelectedIndex = -1;
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj as ListItem != null) {
+ this.Items.Add((ListItem) obj);
+ return;
+ }
+ throw new HttpException("HtmlSelect cannot have children of Type " + obj.GetType().Name);
+ }
+
+ protected virtual void ClearSelection()
+ {
+ foreach (ListItem item in Items)
+ item.Selected = false;
+ }
+
+ protected override ControlCollection CreateControlCollection(){
+ return new EmptyControlCollection(this);
+ }
+
+ /*
+ * Helper method for LoadViewState. Any change to Select (int [])
+ * should be done here too.
+ */
+ void Select (object [] selectedIndices)
+ {
+ ClearSelection();
+ int count = Items.Count;
+ foreach (int current in selectedIndices) {
+ if (current >= 0 && current < count)
+ Items [current].Selected = true;
+ }
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if (savedState != null) {
+ Triplet state = (Triplet) savedState;
+ base.LoadViewState (state.First);
+ Items.LoadViewState (state.Second);
+ object indices = state.Third;
+ if (indices != null)
+ Select ((object []) indices);
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e){
+ base.OnDataBinding(e);
+ IEnumerable resolvedDataSource = System.Web.Util.DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
+ if ( resolvedDataSource != null){
+ string text = DataTextField;
+ string value = DataValueField;
+ Items.Clear();
+ ICollection rdsCollection = resolvedDataSource as ICollection;
+ if (rdsCollection != null){
+ Items.Capacity = rdsCollection.Count;
+ }
+ bool valid = false;
+ if (text.Length >= 0 && value.Length >= 0)
+ valid = true;
+ ListItem li = new ListItem();
+ IEnumerator current = resolvedDataSource.GetEnumerator();
+ while(current.MoveNext()){
+ if (valid == true){
+ if (text.Length >= 0)
+ li.Text = DataBinder.GetPropertyValue(current, text) as string;
+ if (value.Length >= 0)
+ li.Value = DataBinder.GetPropertyValue(current, value) as string;
+ }
+ else{
+ li.Value = li.Text = current.ToString();
+ }
+ }
+ Items.Add(li);
+ }
+ if ( _cachedSelectedIndex != -1){
+ SelectedIndex = _cachedSelectedIndex;
+ _cachedSelectedIndex = -1;
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && Size >= 0 && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null)
+ handler.Invoke(this,e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ Attributes.Remove("DataValueField");
+ Attributes.Remove("DataTextField");
+ Attributes.Remove("DataMember");
+ base.RenderAttributes(writer);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ //flush output
+ writer.WriteLine();
+ // increase indent level, improves readability
+ writer.Indent = writer.Indent + 1;
+ if (Items.Count >= 0){
+ // display all options, and set the selected option
+ bool rendered_selected = false;
+ foreach (ListItem option in Items){
+ //write begin tag with attributes
+ writer.WriteBeginTag("option");
+ if (!rendered_selected && option.Selected){
+ writer.WriteAttribute("selected","selected");
+ if (!Multiple)
+ rendered_selected = true;
+ }
+ else if (option.Selected){
+ option.Selected = false;
+ }
+
+ writer.WriteAttribute("value",option.Value,true);
+ option.Attributes.Remove("text");
+ option.Attributes.Remove("value");
+ option.Attributes.Remove("selected");
+ option.Attributes.Render(writer);
+ writer.Write('>');
+ //write the option text
+ HttpUtility.HtmlEncode(option.Text, writer);
+ //close the current option tag
+ writer.WriteEndTag("option");
+ //flush output
+ writer.WriteLine();
+ }
+ }
+ // set the indent level back to normal
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override object SaveViewState ()
+ {
+ object baseViewState = base.SaveViewState ();
+ object itemsViewState = Items.SaveViewState ();
+ object indices = null;
+
+ if (Events[EventServerChange] != null || !Disabled || Visible)
+ indices = SelectedIndices;
+
+ if (indices != null || baseViewState != null || itemsViewState != null)
+ return new Triplet (baseViewState, itemsViewState, indices);
+
+ return null;
+ }
+
+ /* Any change here should also be done to Select (object []) */
+ protected virtual void Select(int[] selectedIndices){
+ // unselect all options
+ ClearSelection();
+ // iterate through options, and set when selected
+ foreach (int current in selectedIndices){
+ if (current >= 0 && current < Items.Count){
+ Items[current].Selected = true;
+ }
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ //get the posted selectedIndices[]
+ string [] postedValueColl = postCollection.GetValues(postDataKey);
+ bool changed = false;
+ if (postedValueColl != null){
+ if (!Multiple){
+ //single selection
+ //int postedValue = Items.FindIndexByValue(postedValueColl[0]);
+ int postedValue = Items.IndexOf(Items.FindByValue(postedValueColl[0]));
+ if (postedValue != SelectedIndex){
+ //set the SelectedIndex
+ SelectedIndex = postedValue;
+ changed = true;
+ }
+ }
+ else{
+ //multiple selection
+ int postedValueCount = postedValueColl.Length;
+ int[] arr= new int[postedValueCount];
+ //fill an array with the posted Values
+ for (int i = 0; i <= postedValueCount; i++)
+ arr[i] = Items.IndexOf(Items.FindByValue(postedValueColl[i]));
+ //test if everything went fine
+ if( postedValueCount == SelectedIndices.Length)
+ for (int i = 0; i <= postedValueCount; i++)
+ if(arr[i] == SelectedIndices[i])
+ changed = true;
+ else
+ changed = true;
+ //commit the posted Values
+ if(changed)
+ Select(arr);
+ }
+ }
+ else if (SelectedIndex != -1){
+ SelectedIndex = -1;
+ changed = true;
+ }
+ return changed;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ //starts tracking changes to the viewstate
+ protected override void TrackViewState(){
+ base.TrackViewState();
+ Items.TrackViewState();
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the selection changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("The data member of the select.")]
+ public virtual string DataMember{
+ get{
+ object viewStateDataMember = ViewState["DataMember"];
+ if ( viewStateDataMember != null) return (String) viewStateDataMember;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataMember"] = HtmlControl.AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(null)]
+ [WebCategory("Data")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("The data source used to populate the list with data.")]
+ public virtual object DataSource{
+ get{
+ return _dataSource;
+ }
+ set{
+ if (value != null && value is IListSource){
+ if (value is IEnumerable){
+ _dataSource = value;
+ }
+ else{
+ throw new ArgumentException("Invalid dataSource type");
+ }
+ }
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("The field in the data source that provides the item value.")]
+ public virtual string DataTextField{
+ get{
+ string attr = Attributes["DataTextField"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["DataTextField"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("The field in the data source that provides the item value.")]
+ public virtual string DataValueField{
+ get{
+ string attr = Attributes["DataValueField"];
+ if (attr != null)return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataValueField"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml{
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ }
+
+ public override string InnerText{
+ get{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public ListItemCollection Items{
+ get{
+ if (_items == null){
+ _items = new ListItemCollection();
+ if (IsTrackingViewState) _items.TrackViewState();
+ }
+ return _items;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Multiple{
+ get{
+ string attr = Attributes["multiple"];
+ if (attr != null) return (0 == String.Compare (attr, "true", true));
+ return false;
+ }
+ set{
+ Attributes["multiple"] = value.ToString ();
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Name{
+ get{
+ return UniqueID;
+ }
+ set{
+ //LAMESPEC
+ return;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual int SelectedIndex {
+ get{
+ for (int i=0; i<Items.Count; i++){
+ if (Items[i].Selected == true) return i;
+ }
+ if (Size<=1 && !Multiple){
+ if(Items.Count > 0) Items[0].Selected = true;
+ return 0;
+ }
+ return -1;
+ }
+ set{
+ if(Items.Count == 0){
+ _cachedSelectedIndex = value;
+ return;
+ }
+
+ if (value < -1 || value >= Items.Count)
+ throw new ArgumentOutOfRangeException();
+
+ ClearSelection();
+ if (value >= 0)
+ Items[value].Selected = true;
+ }
+ }
+
+ protected virtual int[] SelectedIndices {
+ get{
+ int[] indices = new int[3];
+ int indicesCount = 0;
+ for(int i=0; i < Items.Count; i++){
+ if (Items[i].Selected){
+ if( indicesCount == (int) indices.Length){
+ int[] temp = new int[indicesCount + indicesCount];
+ indices.CopyTo(temp,0);
+ indices = temp;
+ }
+ indices[indicesCount] = i;
+ indicesCount++;
+ }
+ }
+ int[] arr = new int[indicesCount];
+ System.Array.Copy(indices,0,arr,0,indicesCount);
+ return arr;
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
+ }
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Value {
+ get{
+ int selectedIndex = SelectedIndex;
+ if (selectedIndex >=0 && selectedIndex < Items.Count){
+ return Items[selectedIndex].Value;
+ }
+ return String.Empty;
+ }
+ set{
+ int findValue = Items.IndexOf(Items.FindByValue(value));
+ if (findValue >= 0) SelectedIndex = findValue;
+ }
+ }
+
+ } // class HtmlSelect
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
new file mode 100755
index 00000000000..00a00ad0429
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
@@ -0,0 +1,199 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ [ParseChildren(true, "Rows")]
+ public class HtmlTable : HtmlContainerControl {
+ private HtmlTableRowCollection _rows;
+
+ public HtmlTable():base("table"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableRowControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ base.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue(-1)]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Border {
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int CellPadding {
+ get{
+ string attr = Attributes["cellpadding"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellpadding"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int CellSpacing {
+ get{
+ string attr = Attributes["cellspacing"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellspacing"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual HtmlTableRowCollection Rows {
+ get{
+ if (_rows == null) _rows = new HtmlTableRowCollection(this);
+ return _rows;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ protected class HtmlTableRowControlCollection : ControlCollection {
+
+ internal HtmlTableRowControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if ((child as HtmlTableRow) != null){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type " + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if ((child as HtmlTableRow) != null){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type " + child.GetType().Name);
+ }
+ }
+ } // end of HtmlTableRowControlCollection
+ }
+ // end of System.Web.UI.HtmlControl
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
new file mode 100755
index 00000000000..6d12c9b00bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
@@ -0,0 +1,158 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+ [ConstructorNeedsTag]
+ public class HtmlTableCell : HtmlContainerControl {
+ public HtmlTableCell(): base("td"){}
+
+ public HtmlTableCell(string tagName): base(tagName){}
+
+ protected override void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int ColSpan {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["colspan"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool NoWrap {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return attr.Equals("nowrap");
+ return false;
+ }
+ set{
+ if (value == true){
+ Attributes["nowrap"] = "nowrap";
+ }
+ else{
+ Attributes["nowrap"] = null;
+ }
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int RowSpan {
+ get{
+ string attr = Attributes["rowspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["rowspan"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ }
+ // System.Web.UI.HtmlControls.HtmlTableCell
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
new file mode 100755
index 00000000000..e6926f10eb7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
@@ -0,0 +1,84 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableCellCollection : ICollection {
+ private HtmlTableRow _owner;
+
+ internal HtmlTableCellCollection(HtmlTableRow owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableCell cell){
+ Insert(-1, cell);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablecell = this.GetEnumerator();
+ while(tablecell.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablecell.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableCell cell){
+ _owner.Controls.AddAt(index,cell);
+ }
+
+ public void Remove(HtmlTableCell cell){
+ _owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableCell this[int index] {
+ get{
+ return _owner.Controls[index] as HtmlTableCell;
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return null;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
new file mode 100755
index 00000000000..d282a7039bf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
@@ -0,0 +1,156 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+ [ParseChildren(true, "Cells")]
+ public class HtmlTableRow : HtmlContainerControl {
+ private HtmlTableCellCollection _cells;
+ public HtmlTableRow():base("tr"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableCellControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ base.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual HtmlTableCellCollection Cells {
+ get{
+ if (_cells == null) _cells = new HtmlTableCellCollection(this);
+ return _cells;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Layout")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+
+
+ protected class HtmlTableCellControlCollection : ControlCollection {
+
+ internal HtmlTableCellControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if (child is HtmlTableCell){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if (child is HtmlTableCell){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+ }
+ } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
+ // end of System.Web.UI.HtmlControls.HtmlTableRow
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
new file mode 100755
index 00000000000..987c8aed674
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
@@ -0,0 +1,83 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableRowCollection : ICollection {
+
+ private HtmlTable _owner;
+
+ internal HtmlTableRowCollection(HtmlTable owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableRow row){
+ Insert(-1, row);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablerow = this.GetEnumerator();
+ while (tablerow.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablerow.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableRow row){
+ _owner.Controls.AddAt(index,row);
+ }
+
+ public void Remove(HtmlTableRow row){
+ _owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableRow this[int index] {
+ get{
+ return (HtmlTableRow) _owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return this;
+ }
+ }
+ }//System.Web.UI.HtmlControls.HtmlTableRowCollection
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
new file mode 100644
index 00000000000..87a46774449
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
@@ -0,0 +1,137 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ [DefaultEvent("ServerChange")]
+ [ValidationProperty("Value")]
+ public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange = new object ();
+
+ public HtmlTextArea(): base("textarea"){}
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Cols{
+ get{
+ string attr = Attributes["cols"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["cols"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Rows{
+ get{
+ string attr = Attributes["rows"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
+ }
+ return -1;
+ }
+ set{
+ Attributes["rows"] = AttributeToString(value);
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Appearance")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Value{
+ get{
+ return InnerHtml;
+ }
+ set{
+ InnerHtml = value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Behavior")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string Name{
+ get{
+ if (UniqueID != null){
+ return UniqueID;
+ }
+ return String.Empty;
+ }
+ set{}
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("Fires when the text within the control changes.")]
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerChange];
+ if(handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string currentValue = Value;
+ string postedValue = postCollection[postDataKey];
+ if (!currentValue.Equals(postedValue) && currentValue != null){
+ Value = HttpUtility.HtmlEncode(postedValue);
+ return true;
+ }
+ return false;
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ base.RenderAttributes(writer);
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnServerChange (EventArgs.Empty);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if(Events[EventServerChange]==null || Disabled){
+ ViewState.SetItemDirty("value",false);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj is LiteralControl || obj is DataBoundLiteralControl)
+ AddParsedSubObject(obj);
+ else
+ throw new NotSupportedException("HtmlTextArea cannot have children of Type " + obj.GetType().Name);
+ }
+
+ } // class HtmlTextArea
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore b/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore
new file mode 100644
index 00000000000..13fc1fc7660
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore
@@ -0,0 +1,2 @@
+*.exe
+*.xml
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs
new file mode 100755
index 00000000000..d0e94b87f88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs
@@ -0,0 +1,92 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: AdCreatedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class AdCreatedEventArgs: EventArgs
+ {
+
+ private IDictionary adProperties;
+ private string alternateText;
+ private string imageUrl;
+ private string navigateUrl;
+
+ public AdCreatedEventArgs(IDictionary adProperties): base()
+ {
+ Initialize();
+ this.adProperties = adProperties;
+ if(adProperties!=null)
+ {
+ imageUrl = (string)adProperties["ImageUrl"];
+ navigateUrl = (string)adProperties["NavigateUrl"];
+ alternateText = (string)adProperties["AlternateText"];
+ }
+ }
+
+ private void Initialize()
+ {
+ alternateText = string.Empty;
+ imageUrl = string.Empty;
+ navigateUrl = string.Empty;
+ }
+
+ public IDictionary AdProperties
+ {
+ get
+ {
+ return adProperties;
+ }
+ }
+
+ public string AlternateText
+ {
+ get
+ {
+ return alternateText;
+ }
+ set
+ {
+ alternateText = value;
+ }
+ }
+
+ public string ImageUrl
+ {
+ get
+ {
+ return imageUrl;
+ }
+ set
+ {
+ imageUrl = value;
+ }
+ }
+
+ public string NavigateUrl
+ {
+ get
+ {
+ return navigateUrl;
+ }
+ set
+ {
+ navigateUrl = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
new file mode 100755
index 00000000000..57359aa5b30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: AdCreatedEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void AdCreatedEventHandler(object sender, AdCreatedEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
new file mode 100755
index 00000000000..7b1e4bb91c4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
@@ -0,0 +1,364 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: AdRotator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.Caching;
+using System.Web.UI;
+using System.Xml;
+using System.Web.Util;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("AdCreated")]
+ [DefaultProperty("AdvertisementFile")]
+ //TODO: [Designer("??")]
+ [ToolboxData("<{0}:AdRotator runat=\"server\" Height=\"60px\" "
+ + "Width=\"468\"></{0}:AdRotator>")]
+ public class AdRotator: WebControl
+ {
+
+ private string advertisementFile;
+ private static readonly object AdCreatedEvent = new object();
+
+ // Will be set values during (On)PreRender-ing
+ private string alternateText;
+ private string imageUrl;
+ private string navigateUrl;
+
+ private string fileDirectory;
+
+ class AdRecord
+ {
+ public IDictionary adProps;
+ public int hits; // or impressions or clicks
+ public string keyword;
+
+ public AdRecord(IDictionary adProps)
+ {
+ this.adProps = adProps;
+ hits = 0;
+ keyword = String.Empty;
+ }
+ }
+
+/*
+ * Loading / Saving data from/to ad file and all the manipulations wrt to the URL...
+ * are incorporated by the following functions.
+ * GetData(string)
+ * LoadAdFile(string)
+ * IsAdMatching(AdRecord)
+ * ResolveAdUrl(string)
+ * SelectAd()
+ * The exact control flow will be detailed. Let me first write the functions
+ */
+
+ private AdRecord[] LoadAdFile(string file)
+ {
+ Stream fStream;
+ ArrayList list;
+ XmlReader reader;
+ XmlDocument document;
+ XmlNode topNode, innerNode;
+ IDictionary hybridDict = null;
+ AdRecord[] adsArray = null;
+ try
+ {
+ fStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read);
+ } catch(Exception e)
+ {
+ throw new HttpException("AdRotator: Unable to open file");
+ }
+ try
+ {
+ list = new ArrayList();
+ reader = new XmlTextReader(fStream);
+ document = new XmlDocument();
+ document.Load(reader);
+ if(document.DocumentElement!=null)
+ {
+ if(document.DocumentElement.LocalName=="Advertisements")
+ {
+ topNode = document.DocumentElement.FirstChild;
+ while(topNode!=null)
+ {
+ if(topNode.LocalName=="Ad")
+ {
+ innerNode = topNode.FirstChild;
+ while(innerNode!=null)
+ {
+ if(innerNode.NodeType==XmlNodeType.Element)
+ {
+ if(hybridDict==null)
+ {
+ hybridDict = new HybridDictionary();
+ }
+ hybridDict.Add(innerNode.LocalName, innerNode.InnerText);
+ }
+ innerNode = innerNode.NextSibling;
+ }
+ if (hybridDict!=null) {
+ list.Add (hybridDict);
+ hybridDict = null;
+ }
+ }
+ topNode = topNode.NextSibling;
+ }
+ }
+ }
+ if(list.Count>0)
+ {
+ adsArray = new AdRecord[list.Count];
+ for(int i=0; i < list.Count; i++)
+ {
+ adsArray[i] = new AdRecord((IDictionary)list[i]);
+ }
+ }
+ } catch(Exception e)
+ {
+ throw new HttpException("AdRotator_Parse_Error" + file);
+ } finally
+ {
+ fStream.Close();
+ }
+ if(adsArray == null)
+ {
+ throw new HttpException("AdRotator_No_Advertisements_Found");
+ }
+ return adsArray;
+ }
+
+ [MonoTODO("CacheDependency does nothing")]
+ private AdRecord[] GetData(string file)
+ {
+ string physPath = MapPathSecure(file);
+ string AdKey = "AdRotatorCache: " + physPath;
+ fileDirectory = UrlUtils.GetDirectory(UrlUtils.Combine(TemplateSourceDirectory, file));
+ Cache cache = HttpRuntime.Cache;
+ AdRecord[] records = (AdRecord[])cache[AdKey];
+ if(records==null)
+ {
+ records = LoadAdFile(physPath);
+ if(records==null)
+ {
+ return null;
+ }
+ cache.Insert(AdKey, records, new CacheDependency(physPath));
+ }
+ return records;
+ }
+
+ private IDictionary SelectAd()
+ {
+ AdRecord[] records = GetData(AdvertisementFile);
+ if(records!=null && records.Length!=0)
+ {
+ int impressions = 0;
+ for(int i=0 ; i < records.Length; i++)
+ {
+ if(IsAdMatching(records[i]))
+ impressions += records[i].hits;
+ }
+ if(impressions!=0)
+ {
+ int rnd = (new Random()).Next(impressions) + 1;
+ int counter = 0;
+ int index = 0;
+ for(int i=0; i < records.Length; i++)
+ {
+ if(IsAdMatching(records[i]))
+ {
+ if(rnd <= (counter + records[i].hits))
+ {
+ index = i;
+ break;
+ }
+ counter += records[i].hits;
+ }
+ }
+ return records[index].adProps;
+ }
+ //FIXME: the line below added. Where should i init hits to make
+ //impressions not be 0?
+ return records [0].adProps;
+ }
+ return null;
+ }
+
+ private bool IsAdMatching(AdRecord currAd)
+ {
+ if (KeywordFilter != String.Empty)
+ return (0 == String.Compare (currAd.keyword, KeywordFilter, true));
+
+ return true;
+ }
+
+ private string ResolveAdUrl(string relativeUrl)
+ {
+ if(relativeUrl.Length==0 || !UrlUtils.IsRelativeUrl(relativeUrl))
+ return relativeUrl;
+ string fullUrl = String.Empty;
+ if(fileDirectory != null)
+ fullUrl = fileDirectory;
+ if(fullUrl.Length == 0)
+ fullUrl = TemplateSourceDirectory;
+ if(fullUrl.Length == 0)
+ return relativeUrl;
+ return (fullUrl + relativeUrl);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("AdRotator_OnAdCreated")]
+ public event AdCreatedEventHandler AdCreated
+ {
+ add
+ {
+ Events.AddHandler(AdCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(AdCreatedEvent, value);
+ }
+ }
+
+ public AdRotator(): base()
+ {
+ advertisementFile = string.Empty;
+ fileDirectory = null;
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ //[Editor("??")]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("AdRotator_AdvertisementFile")]
+ public string AdvertisementFile
+ {
+ get
+ {
+ return advertisementFile;
+ }
+ set
+ {
+ advertisementFile = value;
+ }
+ }
+
+ public override FontInfo Font
+ {
+ get
+ {
+ return Font;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("AdRotator_KeywordFilter")]
+ public string KeywordFilter
+ {
+ get
+ {
+ object o = ViewState["KeywordFilter"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ if(value!=null)
+ ViewState["KeywordFilter"] = value.Trim();
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [TypeConverter(typeof(TargetConverter))]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("AdRotator_Target")]
+ public string Target
+ {
+ get
+ {
+ object o = ViewState["Target"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Target"] = value;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected virtual void OnAdCreated(AdCreatedEventArgs e)
+ {
+ if(Events!=null)
+ {
+ AdCreatedEventHandler aceh = (AdCreatedEventHandler)(Events[AdCreatedEvent]);
+ if(aceh!=null)
+ aceh(this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if(AdvertisementFile!=String.Empty)
+ {
+ AdCreatedEventArgs acea = new AdCreatedEventArgs(SelectAd());
+ imageUrl = acea.ImageUrl;
+ navigateUrl = acea.NavigateUrl;
+ alternateText = acea.AlternateText;
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ HyperLink hLink = new HyperLink();
+ Image adImage = new Image();
+ foreach(IEnumerable current in Attributes.Keys)
+ {
+ hLink.Attributes[(string)current] = Attributes[(string)current];
+ }
+ if(ID != null && ID.Length > 0)
+ hLink.ID = ID;
+ hLink.Target = Target;
+ hLink.AccessKey = AccessKey;
+ hLink.Enabled = Enabled;
+ hLink.TabIndex = TabIndex;
+ if (navigateUrl != null && navigateUrl.Length != 0)
+ hLink.NavigateUrl = ResolveAdUrl (navigateUrl);
+ hLink.RenderBeginTag(writer);
+ if(ControlStyleCreated)
+ {
+ adImage.ApplyStyle(ControlStyle);
+ }
+ if(imageUrl!=null && imageUrl.Length > 0)
+ adImage.ImageUrl = ResolveAdUrl(imageUrl);
+ adImage.AlternateText = alternateText;
+ adImage.ToolTip = ToolTip;
+ adImage.RenderControl(writer);
+ hLink.RenderEndTag(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs
new file mode 100755
index 00000000000..5509eca53e8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs
@@ -0,0 +1,311 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseCompareValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public abstract class BaseCompareValidator: BaseValidator
+ {
+ protected BaseCompareValidator(): base()
+ {
+ }
+
+ public static bool CanConvert(string text, ValidationDataType type)
+ {
+ object o = null;
+ return Convert(text, type, out o);
+ }
+
+ [DefaultValue(ValidationDataType.String)]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("RangeValidator_Type")]
+ public ValidationDataType Type
+ {
+ get
+ {
+ object o = ViewState["Type"];
+ if(o!=null)
+ return (ValidationDataType)o;
+ return ValidationDataType.String;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ValidationDataType), value))
+ throw new ArgumentException();
+ ViewState["Type"] = value;
+ }
+ }
+
+ protected static int CutoffYear
+ {
+ get
+ {
+ return DateTimeFormatInfo.CurrentInfo.Calendar.TwoDigitYearMax;
+ }
+ }
+
+ protected static int GetFullYear(int shortYear)
+ {
+ int century = DateTime.Today.Year - (DateTime.Today.Year % 100);
+ if(century < CutoffYear)
+ {
+ return (shortYear + century);
+ }
+ return (shortYear + century - 100);
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("type", PropertyConverter.EnumToString(typeof(ValidationDataType), Type));
+ NumberFormatInfo currInfo = NumberFormatInfo.CurrentInfo;
+ if(Type == ValidationDataType.Double)
+ {
+ writer.AddAttribute("decimalchar", currInfo.NumberDecimalSeparator);
+ return;
+ }
+ if(Type == ValidationDataType.Currency)
+ {
+ writer.AddAttribute("decimalchar", currInfo.CurrencyDecimalSeparator);
+ string grpSep = currInfo.CurrencyGroupSeparator;
+ if(grpSep[0] == 0xA0)
+ {
+ grpSep = " ";
+ }
+ writer.AddAttribute("groupchar", grpSep);
+ writer.AddAttribute("digits", currInfo.CurrencyDecimalDigits.ToString(NumberFormatInfo.InvariantInfo));
+ return;
+ }
+ if(Type == ValidationDataType.Date)
+ {
+ writer.AddAttribute("cutoffyear", CutoffYear.ToString());
+ writer.AddAttribute("century", ( DateTime.Today.Year - (DateTime.Today.Year % 100) ).ToString());
+ return;
+ }
+ }
+ }
+
+ protected override bool DetermineRenderUplevel()
+ {
+ if(Type == ValidationDataType.Date && DateTimeFormatInfo.CurrentInfo.Calendar.GetType() != typeof(GregorianCalendar))
+ {
+ return false;
+ }
+ return base.DetermineRenderUplevel();
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static bool Compare(string leftText, string rightText, ValidationCompareOperator op, ValidationDataType type)
+ {
+ object left = null, right = null;
+ if(!Convert(leftText, type, out left))
+ {
+ return false;
+ }
+ if(op == ValidationCompareOperator.DataTypeCheck)
+ {
+ return true;
+ }
+ if(!Convert(rightText, type, out right))
+ {
+ return true;
+ }
+ int compareResult = 0;
+ switch(type)
+ {
+ case ValidationDataType.String:
+ compareResult = ((String)left).CompareTo(right);
+ break;
+ case ValidationDataType.Integer:
+ compareResult = ((int)left).CompareTo(right);
+ break;
+ case ValidationDataType.Double:
+ compareResult = ((Double)left).CompareTo(right);
+ break;
+ case ValidationDataType.Date:
+ compareResult = ((DateTime)left).CompareTo(right);
+ break;
+ case ValidationDataType.Currency:
+ compareResult = ((Decimal)left).CompareTo(right);
+ break;
+ }
+ switch(op)
+ {
+ case ValidationCompareOperator.Equal:
+ return (compareResult == 0);
+ case ValidationCompareOperator.NotEqual:
+ return (compareResult != 0);
+ case ValidationCompareOperator.GreaterThan:
+ return (compareResult > 0);
+ case ValidationCompareOperator.GreaterThanEqual:
+ return (compareResult >= 0);
+ case ValidationCompareOperator.LessThan:
+ return (compareResult < 0);
+ case ValidationCompareOperator.LessThanEqual:
+ return (compareResult <= 0);
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static string GetDateElementOrder()
+ {
+ string pattern = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
+
+ //TODO: What are the various possibilities?
+ // I can think of only y*/M*/d*, d*/M*/y*, M*/d*/y*
+ if(pattern.IndexOf('y') < pattern.IndexOf('M'))
+ {
+ return "ymd";
+ }
+ if(pattern.IndexOf('M') < pattern.IndexOf('d'))
+ {
+ return "mdy";
+ }
+ return "dmy";
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static bool Convert(string text, ValidationDataType type, out object convertedValue)
+ {
+ convertedValue = null;
+ try
+ {
+ switch(type)
+ {
+ case ValidationDataType.String: convertedValue = text;
+ break;
+ case ValidationDataType.Integer: convertedValue = Int32.Parse(text, CultureInfo.InvariantCulture);
+ break;
+ case ValidationDataType.Double:
+ Match matchDouble = Regex.Match(text, @"^\s*([-\+])?(\d+)?(\"
+ + NumberFormatInfo.CurrentInfo.NumberDecimalSeparator
+ + @"(\d+))?\s*$");
+ if(matchDouble.Success)
+ {
+ string sign = (matchDouble.Groups[1].Success ? matchDouble.Groups[1].Value : "+");
+ string decPart = (matchDouble.Groups[2].Success ? matchDouble.Groups[2].Value : "0");
+ string mantissa = (matchDouble.Groups[4].Success ? matchDouble.Groups[4].Value : "0");
+ convertedValue = Double.Parse(sign + decPart + "." + mantissa, CultureInfo.InvariantCulture);
+ }
+ break;
+ case ValidationDataType.Date:
+ if(DateTimeFormatInfo.CurrentInfo.Calendar.GetType() != typeof(GregorianCalendar))
+ {
+ convertedValue = DateTime.Parse(text);
+ break;
+ }
+ string order = GetDateElementOrder();
+ int date = 0, mth = 0, year = 0;
+ Match matchDate = Regex.Match(text, @"^\s*((\d{4})|(\d{2}))([\.\/-])(\d{1,2})\4(\d{1,2})\s*$");
+ if(matchDate.Success && order == "ymd")
+ {
+ date = Int32.Parse(matchDate.Groups[6].Value, CultureInfo.InvariantCulture);
+ mth = Int32.Parse(matchDate.Groups[5].Value, CultureInfo.InvariantCulture);
+ year = Int32.Parse((matchDate.Groups[2].Success ? matchDate.Groups[2].Value : matchDate.Groups[3].Value), CultureInfo.InvariantCulture);
+ } else
+ {
+ matchDate = Regex.Match(text, @"^\s*(\d{1,2})([\.\/-])(\d{1,2})\2((\d{4}|\d{2}))\s*$");
+ if(matchDate.Success)
+ {
+ if(order == "dmy")
+ {
+ date = Int32.Parse(matchDate.Groups[1].Value, CultureInfo.InvariantCulture);
+ mth = Int32.Parse(matchDate.Groups[3].Value, CultureInfo.InvariantCulture);
+ year = Int32.Parse((matchDate.Groups[5].Success ? matchDate.Groups[5].Value : matchDate.Groups[6].Value), CultureInfo.InvariantCulture);
+ }
+ if(order == "mdy")
+ {
+ date = Int32.Parse(matchDate.Groups[3].Value, CultureInfo.InvariantCulture);
+ mth = Int32.Parse(matchDate.Groups[1].Value, CultureInfo.InvariantCulture);
+ year = Int32.Parse((matchDate.Groups[5].Success ? matchDate.Groups[5].Value : matchDate.Groups[6].Value), CultureInfo.InvariantCulture);
+ }
+ }
+ }
+ year = (year < 100 ? GetFullYear(year) : year);
+ if(matchDate.Success && date!=0 && mth!=0 && year!=0)
+ {
+ convertedValue = new DateTime(year, mth, date);
+ }
+ break;
+ case ValidationDataType.Currency:
+ string decSep = NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator;
+ string grpSep = NumberFormatInfo.CurrentInfo.CurrencyGroupSeparator;
+ int decDig = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits;
+ if(grpSep[0] == 0xA0)
+ {
+ grpSep = " ";
+ }
+ string[] patternArray = new string[5];
+ patternArray[0] = "^\\s*([-\\+])?(((\\d+)\\";
+ patternArray[1] = grpSep;
+ patternArray[2] = @")*)(\d+)";
+ if(decDig > 0)
+ {
+ string[] decPattern = new string[5];
+ decPattern[0] = "(\\";
+ decPattern[1] = decSep;
+ decPattern[2] = @"(\d{1,";
+ decPattern[3] = decDig.ToString(NumberFormatInfo.InvariantInfo);
+ decPattern[4] = @"}))";
+ patternArray[3] = String.Concat(decPattern);
+
+ } else
+ {
+ patternArray[3] = String.Empty;
+ }
+ patternArray[4] = @"?\s*$";
+ Match matchCurrency = Regex.Match(text, String.Concat(patternArray));
+ if(matchCurrency.Success)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(matchCurrency.Groups[1]);
+ CaptureCollection cc = matchCurrency.Groups[4].Captures;
+ foreach(IEnumerable current in cc)
+ {
+ sb.Append((Capture)current);
+ }
+ sb.Append(matchCurrency.Groups[5]);
+ if(decDig > 0)
+ {
+ sb.Append(".");
+ sb.Append(matchCurrency.Groups[7]);
+ }
+ convertedValue = Decimal.Parse(sb.ToString(), CultureInfo.InvariantCulture);
+ }
+ break;
+ }
+ } catch(Exception e)
+ {
+ convertedValue = null;
+ }
+ return (convertedValue != null);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
new file mode 100755
index 00000000000..aabd78d585e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
@@ -0,0 +1,277 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseDataList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("DataSource")]
+ [ParseChildren(true)]
+ [PersistChildren(false)]
+ //TODO: [Designer("??")]
+ public abstract class BaseDataList: WebControl
+ {
+ private static readonly object SelectedIndexChangedEvent = new object();
+ internal static string ItemCountViewStateKey = "_!ItemCount";
+
+ private DataKeyCollection dataKeys;
+ private object dataSource;
+
+ public BaseDataList() : base()
+ {
+ }
+
+ public static bool IsBindableType(Type type)
+ {
+ if(type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Decimal))
+ return true;
+ return false;
+ }
+
+ public override ControlCollection Controls
+ {
+ get
+ {
+ EnsureChildControls();
+ return base.Controls;
+ }
+ }
+
+ public override void DataBind()
+ {
+ OnDataBinding(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("BaseDataList_OnSelectedIndexChanged")]
+ public event EventHandler SelectedIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectedIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectedIndexChangedEvent, value);
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(-1)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_CellPadding")]
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(!ControlStyleCreated)
+ return -1;
+ return ((TableStyle)ControlStyle).CellPadding;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(-1)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_CellSpacing")]
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(!ControlStyleCreated)
+ return -1;
+ return ((TableStyle)ControlStyle).CellSpacing;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataKeyField")]
+ public virtual string DataKeyField
+ {
+ get
+ {
+ object o = ViewState["DataKeyField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataKeyField"] = value;
+ }
+ }
+
+ [Browsable(true)]
+ //[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("BaseDataList_DataKeys")]
+ public DataKeyCollection DataKeys
+ {
+ get
+ {
+ if( dataKeys==null )
+ dataKeys = new DataKeyCollection(DataKeysArray);
+ return dataKeys;
+
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataMember")]
+ public string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ [Bindable(true)]
+ //[DefaultValue(null)]
+ //[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataSource")]
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ if( (value!=null) && (value is IListSource || value is IEnumerable) )
+ {
+ dataSource = value;
+ } else
+ {
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Invalid_DataSource_Type", ID));
+ }
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(GridLines.Both)]
+ [WebCategory("Appearance")]
+ [WebSysDescription("BaseDataList_GridLines")]
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableStyle)ControlStyle).GridLines;
+ return GridLines.Both;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).GridLines = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(HorizontalAlign.NotSet)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_HorizontalAlign")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableStyle)ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).HorizontalAlign = value;
+ }
+ }
+
+ protected ArrayList DataKeysArray
+ {
+ get
+ {
+ object o = ViewState["DataKeys"];
+ if(o == null)
+ {
+ o = new ArrayList();
+ ViewState["DataKeys"] = o;
+ }
+ return (ArrayList)o;
+ }
+ }
+
+ protected override void AddParsedSubObject(object o)
+ {
+ // Preventing literal controls from being added as children.
+ }
+
+ protected override void CreateChildControls()
+ {
+ Controls.Clear();
+ if(ViewState[ItemCountViewStateKey]!=null)
+ {
+ CreateControlHierarchy(false);
+ ClearChildViewState();
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ Controls.Clear();
+ ClearChildViewState();
+ CreateControlHierarchy(true);
+ ChildControlsCreated = true;
+ TrackViewState();
+ }
+
+ protected virtual void OnSelectedIndexChanged(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ PrepareControlHierarchy();
+ RenderContents(writer);
+ }
+
+ protected abstract void PrepareControlHierarchy();
+ protected abstract void CreateControlHierarchy(bool useDataSource);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
new file mode 100755
index 00000000000..76db43afad9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
@@ -0,0 +1,414 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseValidator
+ *
+ * Authors: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 80%
+ *
+ * (C) Gaurav Vaish (2001)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("ErrorMessage")]
+ //TODO: [Designer("??")]
+ public abstract class BaseValidator: Label, IValidator
+ {
+ private bool isValid;
+ private bool isPreRenderCalled;
+ private bool isPropertiesChecked;
+ private bool propertiesValid;
+ private bool renderUplevel;
+
+ protected BaseValidator() : base()
+ {
+ isValid = true;
+ ForeColor = Color.Red;
+ propertiesValid = true;
+ isPropertiesChecked = false;
+ renderUplevel = false;
+ }
+
+ public string ControlToValidate
+ {
+ get
+ {
+ object o = ViewState["ControlToValidate"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ControlToValidate"] = value;
+ }
+ }
+
+ public ValidatorDisplay Display
+ {
+ get
+ {
+ object o = ViewState["Display"];
+ if(o != null)
+ {
+ return (ValidatorDisplay)o;
+ }
+ return ValidatorDisplay.Static;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ValidatorDisplay), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["ValidatorDisplay"] = value;
+ }
+ }
+
+ public bool EnableClientScript
+ {
+ get
+ {
+ object o = ViewState["EnableClientScript"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ public override bool Enabled
+ {
+ get
+ {
+ return base.Enabled;
+ }
+ set
+ {
+ if (value == false)
+ isValid = true;
+ base.Enabled = value;
+ }
+ }
+
+ public string ErrorMessage
+ {
+ get
+ {
+ object o = ViewState["ErrorMessage"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ErrorMessage"] = value;
+ }
+ }
+
+ public override Color ForeColor
+ {
+ get
+ {
+ return base.ForeColor;
+ }
+ set
+ {
+ base.ForeColor = value;
+ }
+ }
+
+ public bool IsValid
+ {
+ get { return isValid; }
+ set { isValid = value; }
+ }
+
+ public static PropertyDescriptor GetValidationProperty(object component)
+ {
+ System.ComponentModel.AttributeCollection coll = TypeDescriptor.GetAttributes (component);
+ Type type = typeof (ValidationPropertyAttribute);
+ ValidationPropertyAttribute attrib = (ValidationPropertyAttribute) coll [type];
+ if (attrib != null && attrib.Name != null)
+ return (TypeDescriptor.GetProperties (component)) [attrib.Name];
+ return null;
+ }
+
+ public void Validate()
+ {
+ if(!Visible || (Visible && !Enabled))
+ {
+ IsValid = true;
+ }
+ Control ctrl = Parent;
+ while(ctrl != null)
+ {
+ if(!ctrl.Visible)
+ {
+ IsValid = true;
+ return;
+ }
+ ctrl = ctrl.Parent;
+ }
+ isPropertiesChecked = false;
+ if(!PropertiesValid)
+ {
+ IsValid = true;
+ return;
+ }
+ IsValid = EvaluateIsValid();
+ }
+
+ protected bool PropertiesValid
+ {
+ get
+ {
+ if(!isPropertiesChecked)
+ {
+ propertiesValid = ControlPropertiesValid();
+ isPropertiesChecked = true;
+ }
+ return propertiesValid;
+ }
+ }
+
+ protected bool RenderUplevel
+ {
+ get
+ {
+ return renderUplevel;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ bool enabled = base.Enabled;
+ if (enabled)
+ Enabled = true;
+
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ if(ID == null)
+ {
+ writer.AddAttribute("id", ClientID);
+ }
+ if(ControlToValidate.Length > 0)
+ {
+ writer.AddAttribute("controltovalidate", GetControlRenderID(ControlToValidate));
+ }
+ if(ErrorMessage.Length > 0)
+ {
+ writer.AddAttribute("errormessage", ErrorMessage, true);
+ }
+ if(Display == ValidatorDisplay.Static)
+ {
+ writer.AddAttribute("display", Enum.Format(typeof(ValidatorDisplay), Display, "G").Replace('_','-'));
+ //writer.AddAttribute("display", PropertyConverter.EnumToString(typeof(ValidatorDisplay), Display));
+ }
+ if(!IsValid)
+ {
+ writer.AddAttribute("isvalid", "False");
+ }
+
+ ControlStyle.AddAttributesToRender (writer, this);
+ if(!enabled)
+ {
+ writer.AddAttribute("enabled", "False");
+ }
+ }
+
+ if(enabled)
+ {
+ Enabled = false;
+ }
+ }
+
+ protected void CheckControlValidationProperty(string name, string propertyName)
+ {
+ Control ctrl = NamingContainer.FindControl(name);
+ if(ctrl == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_control_not_found",
+ name, propertyName/*, ID*/));
+ }
+ PropertyDescriptor pd = GetValidationProperty(ctrl);
+ if(pd == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_bad_control_type",
+ name, propertyName/*, ID*/));
+ }
+ }
+
+ protected virtual bool ControlPropertiesValid()
+ {
+ if(ControlToValidate.Length == 0)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_control_blank", ID));
+ }
+ CheckControlValidationProperty(ControlToValidate, "ControlToValidate");
+ return true;
+ }
+
+ [MonoTODO]
+ protected virtual bool DetermineRenderUplevel()
+ {
+ Page page = Page;
+ if(page == null || page.Request == null)
+ {
+ return false;
+ }
+
+ if(EnableClientScript)
+ {
+ // By now, return false
+ return false;
+ //throw new NotImplementedException();
+ ////TODO: I need to get the (Browser->Dom_version_major >= 4 &&
+ //// Brower->Ecma_script_version >= 1.2)
+ }
+ return false;
+ }
+
+ protected string GetControlRenderID(string name)
+ {
+ Control ctrl = FindControl(name);
+ if(ctrl != null)
+ {
+ return ctrl.ClientID;
+ }
+ return String.Empty;
+ }
+
+ protected string GetControlValidationValue(string name)
+ {
+ Control ctrl = NamingContainer.FindControl(name);
+ if(ctrl != null)
+ {
+ PropertyDescriptor pd = GetValidationProperty(ctrl);
+ if(pd != null)
+ {
+ object item = pd.GetValue (ctrl);
+ if (item is ListItem)
+ return ((ListItem) item).Value;
+
+ if (item == null)
+ return String.Empty;
+
+ return item.ToString ();
+ }
+ }
+ return null;
+ }
+
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+ Page.Validators.Add(this);
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ base.OnPreRender(e);
+ isPreRenderCalled = true;
+ isPropertiesChecked = false;
+ renderUplevel = DetermineRenderUplevel();
+ if(renderUplevel)
+ {
+ RegisterValidatorCommonScript();
+ }
+ }
+
+ protected override void OnUnload(EventArgs e)
+ {
+ if(Page != null)
+ {
+ Page.Validators.Remove(this);
+ }
+ base.OnUnload(e);
+ }
+
+ [MonoTODO("Damn_This_Is_Really_Frustrating___by_Gaurav")]
+ protected void RegisterValidatorCommonScript()
+ {
+ if(Page.IsClientScriptBlockRegistered("ValidatorIncludeScript"))
+ return;
+
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("I_have_to_know_javascript_for_this_I_know_it_but_for_ALL_browsers_NO")]
+ protected virtual void RegisterValidatorDeclaration()
+ {
+ throw new NotImplementedException();
+ //TODO: Since I have to access document.<ClientID> and register
+ // as page validator. Now this is Browser dependent :((
+
+ // This does not render anything on Mozilla, and does on IE
+ }
+
+ [MonoTODO("Render_ing_always_left")]
+ protected override void Render (HtmlTextWriter writer)
+ {
+ bool valid;
+
+ if (!Enabled)
+ return;
+
+ if (isPreRenderCalled) {
+ valid = IsValid;
+ } else {
+ isPropertiesChecked = true;
+ propertiesValid = true;
+ renderUplevel = false;
+ valid = true;
+ }
+
+ if (PropertiesValid) {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ ValidatorDisplay dis = Display;
+ if (RenderUplevel) {
+ //FIXME: as of now, don't do client-side validation
+ throw new NotImplementedException();
+ }
+
+ if (!valid) {
+ RenderBeginTag (writer);
+ if (Text.Trim ().Length > 0 || HasControls ()) {
+ RenderContents (writer);
+ RenderEndTag (writer);
+ } else {
+ writer.Write (ErrorMessage);
+ }
+ RenderEndTag (writer);
+ return;
+ }
+ } else {
+ writer.Write ("&nbsp;");
+ }
+ }
+
+ protected abstract bool EvaluateIsValid();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs
new file mode 100755
index 00000000000..93c04f1f213
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: BorderStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum BorderStyle
+ {
+ NotSet,
+ None,
+ Dotted,
+ Dashed,
+ Solid,
+ Double,
+ Groove,
+ Ridge,
+ Inset,
+ Outset
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
new file mode 100755
index 00000000000..abc63c2b9a0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
@@ -0,0 +1,179 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BoundColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 60%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class BoundColumn : DataGridColumn
+ {
+ public static readonly string thisExpr = "!";
+
+ private bool boundFieldDescriptionValid;
+ private string boundField;
+ private string formatting;
+
+ private PropertyDescriptor desc;
+
+ public BoundColumn(): base()
+ {
+ }
+
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ desc = null;
+ boundField = DataField;
+ formatting = DataFormatString;
+ boundFieldDescriptionValid = false;
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+
+ Control bindCtrl = null;
+ Control toAdd = null;
+ switch(itemType)
+ {
+ case ListItemType.Item : goto case ListItemType.SelectedItem;
+ case ListItemType.AlternatingItem
+ : goto case ListItemType.SelectedItem;
+ case ListItemType.SelectedItem
+ : if(DataField.Length != 0)
+ bindCtrl = cell;
+ break;
+ case ListItemType.EditItem
+ : if(!ReadOnly)
+ {
+ TextBox box = new TextBox();
+ toAdd = box;
+ if(DataField.Length != 0)
+ bindCtrl = box;
+ }
+ break;
+ }
+ if(toAdd != null)
+ cell.Controls.Add(toAdd);
+ if(bindCtrl != null)
+ bindCtrl.DataBinding += new EventHandler(OnDataBindColumn);
+ //throw new NotImplementedException();
+ }
+
+ private void OnDataBindColumn(object sender, EventArgs e)
+ {
+ Control senderCtrl = (Control)sender;
+ DataGridItem item = (DataGridItem)senderCtrl.NamingContainer;
+ object data = item.DataItem;
+
+ if(!boundFieldDescriptionValid)
+ {
+ if(boundField != BoundColumn.thisExpr)
+ {
+ desc = TypeDescriptor.GetProperties(data).Find(boundField, true);
+ if(desc == null && !DesignMode)
+ {
+ throw new HttpException(
+ HttpRuntime.FormatResourceString("File_Not_Found",
+ boundField));
+ }
+ boundFieldDescriptionValid = true;
+ }
+ }
+ object value = data;
+ string val = String.Empty;
+ if(desc == null && DesignMode)
+ {
+ throw new NotImplementedException();
+ } else
+ {
+ if(desc != null)
+ value = desc.GetValue(data);
+ val = FormatDataValue(value);
+ }
+ if(senderCtrl is TableCell)
+ {
+ if(val.Length == 0)
+ val = "&nbsp;";
+ ((TableCell)senderCtrl).Text = val;
+ } else
+ {
+ ((TextBox)senderCtrl).Text = val;
+ }
+ }
+
+ public virtual string DataField
+ {
+ get
+ {
+ object o = ViewState["DataField"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataField"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string DataFormatString
+ {
+ get
+ {
+ object o = ViewState["DataFormatString"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataFormatString"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual bool ReadOnly
+ {
+ get
+ {
+ object o = ViewState["ReadOnly"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ReadOnly"] = value;
+ }
+ }
+
+ protected virtual string FormatDataValue(Object dataValue)
+ {
+ string retVal = String.Empty;
+ if(dataValue != null)
+ {
+ if(formatting.Length == 0)
+ retVal = dataValue.ToString();
+ else
+ retVal = String.Format(formatting, dataValue);
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
new file mode 100755
index 00000000000..9410807bae7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
@@ -0,0 +1,172 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Button
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ //TODO: [Designer("??")]
+ //TODO: [DataBindingHandler("??UI.Design.TextDataBindingHandler??")]
+ [ToolboxData("<{0}:Button runat=\"server\" Text=\"Button\"></{0}:Button>")]
+ public class Button : WebControl, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ //private EventHandlerList ehList;
+
+ public Button(): base (HtmlTextWriterTag.Input)
+ {
+ }
+
+ public bool CausesValidation
+ {
+ get
+ {
+ Object cv = ViewState["CausesValidation"];
+ if(cv!=null)
+ return (Boolean)cv;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ public string CommandArgument
+ {
+ get
+ {
+ string ca = (string) ViewState["CommandArgument"];
+ if(ca!=null)
+ return ca;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ string cn = (string)ViewState["CommandName"];
+ if(cn!=null)
+ return cn;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ string text = (string)ViewState["Text"];
+ if(text!=null)
+ return text;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ public event EventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+ protected virtual void OnClick(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[ClickEvent]);
+ if(eh!= null)
+ eh(this,e);
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ CommandEventHandler eh = (CommandEventHandler)(Events[CommandEvent]);
+ if(eh!= null)
+ eh(this,e);
+ }
+ RaiseBubbleEvent(this, e);
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate ();
+
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, base.UniqueID);
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+ if (Page != null && CausesValidation && Page.Validators.Count > 0) {
+ writer.AddAttribute (System.Web.UI.HtmlTextWriterAttribute.Onclick,
+ Utils.GetClientValidatedEvent (Page));
+ writer.AddAttribute ("language", "javascript");
+ }
+ base.AddAttributesToRender (writer);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ // Preventing base classes to do anything
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs
new file mode 100755
index 00000000000..23db52724d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs
@@ -0,0 +1,186 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ButtonColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ButtonColumn : DataGridColumn
+ {
+ private PropertyDescriptor textFieldDescriptor;
+
+ public ButtonColumn(): base()
+ {
+ }
+
+ public override void Initialize()
+ {
+ Initialize();
+ textFieldDescriptor = null;
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ InitializeCell(cell, columnIndex, itemType);
+ if(Enum.IsDefined(typeof(ListItemType), itemType) && itemType != ListItemType.Footer)
+ {
+ WebControl toDisplay = null;
+ if(ButtonType == ButtonColumnType.PushButton)
+ {
+ Button b = new Button();
+ b.Text = Text;
+ b.CommandName = CommandName;
+ b.CausesValidation = false;
+ toDisplay = b;
+ } else
+ {
+ LinkButton lb = new LinkButton();
+ lb.Text = Text;
+ lb.CommandName = CommandName;
+ lb.CausesValidation = false;
+ toDisplay = lb;
+ }
+ if(DataTextField.Length > 0)
+ {
+ toDisplay.DataBinding += new EventHandler(OnDataBindButtonColumn);
+ }
+ cell.Controls.Add(toDisplay);
+ }
+ }
+
+ private void OnDataBindButtonColumn(object sender, EventArgs e)
+ {
+ Control ctrl = (Control)sender;
+ object item = ((DataGridItem)ctrl.NamingContainer).DataItem;
+ if(textFieldDescriptor == null)
+ {
+ textFieldDescriptor = TypeDescriptor.GetProperties(item).Find(DataTextField, true);
+ if(textFieldDescriptor == null && !DesignMode)
+ throw new HttpException(HttpRuntime.FormatResourceString("Field_Not_Found", DataTextField));
+ }
+ string text;
+ if(textFieldDescriptor != null)
+ {
+ text = FormatDataTextValue(textFieldDescriptor.GetValue(item));
+ } else
+ {
+ text = "Sample_DataBound_Text";
+ }
+ if(ctrl is LinkButton)
+ {
+ ((LinkButton)ctrl).Text = text;
+ }
+ else
+ {
+ ((Button)ctrl).Text = text;
+ }
+ }
+
+ protected virtual string FormatDataTextValue(object dataTextValue)
+ {
+ string retVal = null;
+ if(dataTextValue != null)
+ {
+ if(DataTextFormatString.Length > 0)
+ {
+ retVal = String.Format((string)dataTextValue, DataTextFormatString);
+ }
+ else
+ {
+ retVal = dataTextValue.ToString();
+ }
+ }
+ return retVal;
+ }
+
+ public virtual ButtonColumnType ButtonType
+ {
+ get
+ {
+ object o = ViewState["ButtonType"];
+ if(o!=null)
+ return (ButtonColumnType)o;
+ return ButtonColumnType.LinkButton;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ButtonColumnType), value))
+ throw new ArgumentException();
+ ViewState["ButtonType"] = value;
+ }
+ }
+
+ public virtual string CommandName
+ {
+ get
+ {
+ string cn = (string)ViewState["CommandName"];
+ if(cn!=null)
+ return cn;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ public virtual string DataTextField
+ {
+ get
+ {
+ string dtf = (string)ViewState["DataTextField"];
+ if(dtf!=null)
+ return dtf;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ string dtfs = (string)ViewState["DataTextFormatString"];
+ if(dtfs!=null)
+ return dtfs;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ string text = (string)ViewState["Text"];
+ if(text!=null)
+ return text;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs
new file mode 100755
index 00000000000..ed59eba315b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ButtonColumnType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ButtonColumnType
+ {
+ LinkButton,
+ PushButton
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
new file mode 100755
index 00000000000..36d4bc1f446
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
@@ -0,0 +1,1161 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Calendar
+ *
+ * Authors: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 98%
+ *
+ * (C) Gaurav Vaish (2001)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectionChanged")]
+ [DefaultProperty("SelectedDate")]
+ //TODO: [Designer("??")]
+ //[DataBindingHandler("??")]
+ public class Calendar : WebControl, IPostBackEventHandler
+ {
+ //
+ private TableItemStyle dayHeaderStyle;
+ private TableItemStyle dayStyle;
+ private TableItemStyle nextPrevStyle;
+ private TableItemStyle otherMonthDayStyle;
+ private SelectedDatesCollection selectedDates;
+ private ArrayList selectedDatesList;
+ private TableItemStyle selectedDayStyle;
+ private TableItemStyle selectorStyle;
+ private TableItemStyle titleStyle;
+ private TableItemStyle todayDayStyle;
+ private TableItemStyle weekendDayStyle;
+
+ private static readonly object DayRenderEvent = new object();
+ private static readonly object SelectionChangedEvent = new object();
+ private static readonly object VisibleMonthChangedEvent = new object();
+
+ private Color defaultTextColor;
+ private System.Globalization.Calendar globCal;
+ private DateTimeFormatInfo infoCal = DateTimeFormatInfo.CurrentInfo;
+
+ private static int MASK_WEEKEND = (0x01 << 0);
+ private static int MASK_OMONTH = (0x01 << 1);
+ private static int MASK_TODAY = (0x01 << 2);
+ private static int MASK_SELECTED = (0x01 << 3);
+ private static int MASK_DAY = (0x01 << 4);
+ private static int MASK_UNIQUE = MASK_WEEKEND | MASK_OMONTH | MASK_TODAY | MASK_SELECTED;
+
+ public Calendar(): base()
+ {
+ //TODO: Initialization
+ }
+
+ public int CellPadding
+ {
+ get
+ {
+ object o = ViewState["CellPadding"];
+ if(o!=null)
+ return (int)o;
+ return 2;
+ }
+ set
+ {
+ ViewState["CellPadding"] = value;
+ }
+ }
+
+ public int CellSpacing
+ {
+ get
+ {
+ object o = ViewState["CellSpacing"];
+ if(o!=null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value<-1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["CellSpacing"] = value;
+ }
+ }
+
+ public TableItemStyle DayHeaderStyle
+ {
+ get
+ {
+ if(dayHeaderStyle==null)
+ dayHeaderStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ dayHeaderStyle.TrackViewState();
+ return dayHeaderStyle;
+ }
+ }
+
+ public DayNameFormat DayNameFormat
+ {
+ get
+ {
+ object o = ViewState["DayNameFormat"];
+ if(o!=null)
+ return (DayNameFormat)o;
+ return DayNameFormat.Short;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(DayNameFormat),value))
+ throw new ArgumentException();
+ ViewState["DayNameFormat"] = value;
+ }
+ }
+
+ public TableItemStyle DayStyle
+ {
+ get
+ {
+ if(dayStyle==null)
+ dayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ dayStyle.TrackViewState();
+ return dayStyle;
+ }
+ }
+
+ public FirstDayOfWeek FirstDayOfWeek
+ {
+ get
+ {
+ object o = ViewState["FirstDayOfWeek"];
+ if(o!=null)
+ return (FirstDayOfWeek)o;
+ return FirstDayOfWeek.Default;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(FirstDayOfWeek), value))
+ throw new ArgumentException();
+ ViewState["FirstDayOfWeek"] = value;
+ }
+ }
+
+ public string NextMonthText
+ {
+ get
+ {
+ object o = ViewState["NextMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["NextMonthText"] = value;
+ }
+ }
+
+ public NextPrevFormat NextPrevFormat
+ {
+ get
+ {
+ object o = ViewState["NextPrevFormat"];
+ if(o!=null)
+ return (NextPrevFormat)o;
+ return NextPrevFormat.CustomText;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(NextPrevFormat), value))
+ throw new ArgumentException();
+ ViewState["NextPrevFormat"] = value;
+ }
+ }
+
+ public TableItemStyle NextPrevStyle
+ {
+ get
+ {
+ if(nextPrevStyle == null)
+ nextPrevStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ nextPrevStyle.TrackViewState();
+ return nextPrevStyle;
+ }
+ }
+
+ public TableItemStyle OtherMonthDayStyle
+ {
+ get
+ {
+ if(otherMonthDayStyle == null)
+ otherMonthDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ otherMonthDayStyle.TrackViewState();
+ return otherMonthDayStyle;
+ }
+ }
+
+ public string PrevMonthText
+ {
+ get
+ {
+ object o = ViewState["PrevMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&lt;";
+ }
+ set
+ {
+ ViewState["PrevMonthText"] = value;
+ }
+ }
+
+ public DateTime SelectedDate
+ {
+ get
+ {
+ if(SelectedDates.Count > 0)
+ {
+ return SelectedDates[0];
+ }
+ return DateTime.MinValue;
+ }
+ set
+ {
+ if(value == DateTime.MinValue)
+ {
+ SelectedDates.Clear();
+ } else
+ {
+ SelectedDates.SelectRange(value, value);
+ }
+ }
+ }
+
+ public SelectedDatesCollection SelectedDates
+ {
+ get
+ {
+ if(selectedDates==null)
+ {
+ if(selectedDatesList == null)
+ selectedDatesList = new ArrayList();
+ selectedDates = new SelectedDatesCollection(selectedDatesList);
+ }
+ return selectedDates;
+ }
+ }
+
+ public TableItemStyle SelectedDayStyle
+ {
+ get
+ {
+ if(selectedDayStyle==null)
+ selectedDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ selectedDayStyle.TrackViewState();
+ return selectedDayStyle;
+ }
+ }
+
+ public CalendarSelectionMode SelectionMode
+ {
+ get
+ {
+ object o = ViewState["SelectionMode"];
+ if(o!=null)
+ return (CalendarSelectionMode)o;
+ return CalendarSelectionMode.Day;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(CalendarSelectionMode), value))
+ throw new ArgumentException();
+ ViewState["SelectionMode"] = value;
+ }
+ }
+
+ public string SelectMonthText
+ {
+ get
+ {
+ object o = ViewState["SelectMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;&gt;";
+ }
+ set
+ {
+ ViewState["SelectMonthText"] = value;
+ }
+ }
+
+ public TableItemStyle SelectorStyle
+ {
+ get
+ {
+ if(selectorStyle==null)
+ selectorStyle = new TableItemStyle();
+ return selectorStyle;
+ }
+ }
+
+ public string SelectWeekText
+ {
+ get
+ {
+ object o = ViewState["SelectWeekText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["SelectWeekText"] = value;
+ }
+ }
+
+ public bool ShowDayHeader
+ {
+ get
+ {
+ object o = ViewState["ShowDayHeader"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowDayHeader"] = value;
+ }
+ }
+
+ public bool ShowGridLines
+ {
+ get
+ {
+ object o = ViewState["ShowGridLines"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowGridLines"] = value;
+ }
+ }
+
+ public bool ShowNextPrevMonth
+ {
+ get
+ {
+ object o = ViewState["ShowNextPrevMonth"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowNextPrevMonth"] = value;
+ }
+ }
+
+ public bool ShowTitle
+ {
+ get
+ {
+ object o = ViewState["ShowTitle"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowTitle"] = value;
+ }
+ }
+
+ public TitleFormat TitleFormat
+ {
+ get
+ {
+ object o = ViewState["TitleFormat"];
+ if(o!=null)
+ return (TitleFormat)o;
+ return TitleFormat.MonthYear;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(TitleFormat), value))
+ throw new ArgumentException();
+ ViewState["TitleFormat"] = value;
+ }
+ }
+
+ public TableItemStyle TitleStyle
+ {
+ get
+ {
+ if(titleStyle==null)
+ titleStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ titleStyle.TrackViewState();
+ return titleStyle;
+ }
+ }
+
+ public TableItemStyle TodayDayStyle
+ {
+ get
+ {
+ if(todayDayStyle==null)
+ todayDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ todayDayStyle.TrackViewState();
+ return todayDayStyle;
+ }
+ }
+
+ public DateTime TodaysDate
+ {
+ get
+ {
+ object o = ViewState["TodaysDate"];
+ if(o!=null)
+ return (DateTime)o;
+ return DateTime.Today;
+ }
+ set
+ {
+ ViewState["TodaysDate"] = value.Date;
+ }
+ }
+
+ public DateTime VisibleDate
+ {
+ get
+ {
+ object o = ViewState["VisibleDate"];
+ if(o!=null)
+ return (DateTime)o;
+ return DateTime.MinValue;
+ }
+ set
+ {
+ ViewState["VisibleDate"] = value.Date;
+ }
+ }
+
+ public TableItemStyle WeekendDayStyle
+ {
+ get
+ {
+ if(weekendDayStyle == null)
+ weekendDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ weekendDayStyle.TrackViewState();
+ }
+ return weekendDayStyle;
+ }
+ }
+
+ public event DayRenderEventHandler DayRender
+ {
+ add
+ {
+ Events.AddHandler(DayRenderEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DayRenderEvent, value);
+ }
+ }
+
+ public event EventHandler SelectionChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectionChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectionChangedEvent, value);
+ }
+ }
+
+ public event MonthChangedEventHandler VisibleMonthChanged
+ {
+ add
+ {
+ Events.AddHandler(VisibleMonthChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(VisibleMonthChangedEvent, value);
+ }
+ }
+
+ protected virtual void OnDayRender(TableCell cell, CalendarDay day)
+ {
+ if(Events!=null)
+ {
+ DayRenderEventHandler dreh = (DayRenderEventHandler)(Events[DayRenderEvent]);
+ if(dreh!=null)
+ dreh(this, new DayRenderEventArgs(cell, day));
+ }
+ }
+
+ protected virtual void OnSelectionChanged()
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectionChangedEvent]);
+ if(eh!=null)
+ eh(this, new EventArgs());
+ }
+ }
+
+ protected virtual void OnVisibleMonthChanged(DateTime newDate, DateTime prevDate)
+ {
+ if(Events!=null)
+ {
+ MonthChangedEventHandler mceh = (MonthChangedEventHandler)(Events[VisibleMonthChangedEvent]);
+ if(mceh!=null)
+ mceh(this, new MonthChangedEventArgs(newDate, prevDate));
+ }
+ }
+
+ /// <remarks>
+ /// See test6.aspx in Tests directory for verification
+ /// </remarks>
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
+ DateTime visDate = GetEffectiveVisibleDate();
+ if(eventArgument == "nextMonth")
+ {
+ VisibleDate = globCal.AddMonths(visDate, 1);
+ OnVisibleMonthChanged(VisibleDate, visDate);
+ return;
+ }
+ if(eventArgument == "prevMonth")
+ {
+ VisibleDate = globCal.AddMonths(visDate, -1);
+ OnVisibleMonthChanged(VisibleDate, visDate);
+ return;
+ }
+ if(eventArgument == "selectMonth")
+ {
+ DateTime oldDate = new DateTime(globCal.GetYear(visDate), globCal.GetMonth(visDate), 1, globCal);
+ SelectRangeInternal(oldDate, globCal.AddDays(globCal.AddMonths(oldDate, 1), -1), visDate);
+ return;
+ }
+ if(String.Compare(eventArgument, 0, "selectWeek", 0, "selectWeek".Length)==0)
+ {
+ int week = -1;
+ try
+ {
+ week = Int32.Parse(eventArgument.Substring("selectWeek".Length));
+ } catch(Exception e)
+ {
+ }
+ if(week >= 0 && week <= 5)
+ {
+ DateTime weekStart = globCal.AddDays(GetFirstCalendarDay(visDate), week * 7);
+ SelectRangeInternal(weekStart, globCal.AddDays(weekStart, 6), visDate);
+ }
+ return;
+ }
+ if(String.Compare(eventArgument, 0, "selectDay", 0, "selectDay".Length)==0)
+ {
+ int day = -1;
+ try
+ {
+ day = Int32.Parse(eventArgument.Substring("selectDay".Length));
+ } catch(Exception e)
+ {
+ }
+ if(day >= 0 && day <= 42)
+ {
+ DateTime dayStart = globCal.AddDays(GetFirstCalendarDay(visDate), day);
+ SelectRangeInternal(dayStart, dayStart, visDate);
+ }
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ //TODO: Implement me
+ globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
+ DateTime visDate = GetEffectiveVisibleDate();
+ DateTime firstDate = GetFirstCalendarDay(visDate);
+
+ bool isEnabled;
+ bool isHtmlTextWriter;
+ //FIXME: when Control.Site works, reactivate this
+ //if (Page == null || Site == null) {
+ // isEnabled = false;
+ // isHtmlTextWriter = false;
+ //} else {
+ isEnabled = Enabled;
+ isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
+ //}
+ defaultTextColor = ForeColor;
+ if(defaultTextColor == Color.Empty)
+ defaultTextColor = Color.Black;
+
+ Table calTable = new Table ();
+ calTable.ID = ID;
+ calTable.CopyBaseAttributes(this);
+ if(ControlStyleCreated)
+ ApplyStyle(ControlStyle);
+ calTable.Width = Width;
+ calTable.Height = Height;
+ calTable.CellSpacing = CellSpacing;
+ calTable.CellPadding = CellPadding;
+
+ if (ControlStyleCreated &&
+ ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) &&
+ BorderWidth != Unit.Empty)
+ calTable.BorderWidth = BorderWidth;
+ else
+ calTable.BorderWidth = Unit.Pixel(1);
+
+ if (ShowGridLines)
+ calTable.GridLines = GridLines.Both;
+ else
+ calTable.GridLines = GridLines.None;
+
+ calTable.RenderBeginTag (writer);
+
+ if (ShowTitle)
+ RenderTitle (writer, visDate, SelectionMode, isEnabled);
+
+ if (ShowDayHeader)
+ RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);
+
+ RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);
+
+ calTable.RenderEndTag(writer);
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if (savedState!=null) {
+ object[] states = (object[]) savedState;
+ if(states[0] != null)
+ base.LoadViewState(states[0]);
+ if(states[1] != null)
+ DayHeaderStyle.LoadViewState(states[1]);
+ if(states[2] != null)
+ DayStyle.LoadViewState(states[2]);
+ if(states[3] != null)
+ NextPrevStyle.LoadViewState(states[3]);
+ if(states[4] != null)
+ OtherMonthDayStyle.LoadViewState(states[4]);
+ if(states[5] != null)
+ SelectedDayStyle.LoadViewState(states[5]);
+ if(states[6] != null)
+ SelectorStyle.LoadViewState(states[6]);
+ if(states[7] != null)
+ TitleStyle.LoadViewState(states[7]);
+ if(states[8] != null)
+ TodayDayStyle.LoadViewState(states[8]);
+ if(states[9] != null)
+ WeekendDayStyle.LoadViewState(states[9]);
+
+ ArrayList dateList = ViewState ["_CalendarSelectedDates"] as ArrayList;
+ if (dateList != null)
+ selectedDates = new SelectedDatesCollection (dateList);
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ ViewState["_CalendarSelectedDates"] = (SelectedDates.Count > 0 ? selectedDates.GetDateList () : null);
+ object[] states = new object[11];
+ states[0] = base.SaveViewState();
+ states[1] = (dayHeaderStyle == null ? null : dayHeaderStyle.SaveViewState());
+ states[2] = (dayStyle == null ? null : dayStyle.SaveViewState());
+ states[3] = (nextPrevStyle == null ? null : nextPrevStyle.SaveViewState());
+ states[4] = (otherMonthDayStyle == null ? null : otherMonthDayStyle.SaveViewState());
+ states[5] = (selectedDayStyle == null ? null : selectedDayStyle.SaveViewState());
+ states[6] = (selectorStyle == null ? null : selectorStyle.SaveViewState());
+ states[7] = (titleStyle == null ? null : titleStyle.SaveViewState());
+ states[8] = (todayDayStyle == null ? null : todayDayStyle.SaveViewState());
+ states[9] = (weekendDayStyle == null ? null : weekendDayStyle.SaveViewState());
+ for(int i=0; i < states.Length; i++)
+ {
+ if(states[i]!=null)
+ return states;
+ }
+ return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if(titleStyle!=null)
+ {
+ titleStyle.TrackViewState();
+ }
+ if(nextPrevStyle!=null)
+ {
+ nextPrevStyle.TrackViewState();
+ }
+ if(dayStyle!=null)
+ {
+ dayStyle.TrackViewState();
+ }
+ if(dayHeaderStyle!=null)
+ {
+ dayHeaderStyle.TrackViewState();
+ }
+ if(todayDayStyle!=null)
+ {
+ todayDayStyle.TrackViewState();
+ }
+ if(weekendDayStyle!=null)
+ {
+ weekendDayStyle.TrackViewState();
+ }
+ if(otherMonthDayStyle!=null)
+ {
+ otherMonthDayStyle.TrackViewState();
+ }
+ if(selectedDayStyle!=null)
+ {
+ selectedDayStyle.TrackViewState();
+ }
+ if(selectorStyle!=null)
+ {
+ selectorStyle.TrackViewState();
+ }
+ }
+
+ private void RenderAllDays (HtmlTextWriter writer,
+ DateTime firstDay,
+ DateTime activeDate,
+ CalendarSelectionMode mode,
+ bool isActive,
+ bool isDownLevel)
+ {
+ TableItemStyle weeksStyle;
+ TableCell weeksCell = new TableCell ();
+ TableItemStyle weekendStyle = WeekendDayStyle;
+ TableItemStyle otherMonthStyle = OtherMonthDayStyle;
+ Unit size;
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
+ mode == CalendarSelectionMode.DayWeekMonth);
+
+ if (isWeekMode) {
+ weeksStyle = new TableItemStyle ();
+ weeksStyle.Width = Unit.Percentage (12);
+ weeksStyle.HorizontalAlign = HorizontalAlign.Center;
+ weeksStyle.CopyFrom (SelectorStyle);
+ size = Unit.Percentage (12);
+ } else {
+ size = Unit.Percentage (14);
+ }
+
+ TableItemStyle [] styles = new TableItemStyle [16];
+ int definedStyles = MASK_SELECTED;
+ if (weekendStyle != null && !weekendStyle.IsEmpty)
+ definedStyles |= MASK_WEEKEND;
+ if (otherMonthStyle != null && !otherMonthStyle.IsEmpty)
+ definedStyles |= MASK_OMONTH;
+ if (todayDayStyle != null && !todayDayStyle.IsEmpty)
+ definedStyles |= MASK_TODAY;
+ if (dayStyle != null && !dayStyle.IsEmpty)
+ definedStyles |= MASK_DAY;
+
+ bool isCalendar = GetType () == typeof (Calendar);
+ int month = globCal.GetMonth (activeDate);
+ DateTime currentDay = firstDay;
+ for (int crr = 0; crr < 6; crr++) {
+ writer.Write ("<tr>");
+ if (isWeekMode) {
+ string cellText = GetCalendarLinkText (
+ "selectWeek" + crr.ToString (),
+ SelectWeekText,
+ weeksCell.ForeColor,
+ isActive);
+
+ weeksCell.Text = cellText;
+ RenderCalendarCell (writer, weeksCell, cellText);
+ }
+
+ for (int weekDay = 0; weekDay < 7; weekDay++) {
+ string dayString = currentDay.Day.ToString ();
+ CalendarDay calDay =
+ new CalendarDay (
+ currentDay,
+ weekDay < 2,
+ currentDay == TodaysDate,
+ selectedDates.Contains (currentDay),
+ globCal.GetMonth (currentDay) != month,
+ dayString
+ );
+
+
+ int dayStyles = GetMask (calDay) & definedStyles;
+ TableItemStyle currentDayStyle = styles [dayStyles];
+ if (currentDayStyle == null) {
+ currentDayStyle = new TableItemStyle ();
+ if ((dayStyles & MASK_DAY) != 0)
+ currentDayStyle.CopyFrom (DayStyle);
+
+ if ((dayStyles & MASK_WEEKEND) != 0)
+ currentDayStyle.CopyFrom (WeekendDayStyle);
+
+ if ((dayStyles & MASK_TODAY) != 0)
+ currentDayStyle.CopyFrom (TodayDayStyle);
+
+ if ((dayStyles & MASK_OMONTH) != 0)
+ currentDayStyle.CopyFrom (OtherMonthDayStyle);
+
+ if ((dayStyles & MASK_SELECTED) != 0) {
+ currentDayStyle.ForeColor = Color.White;
+ currentDayStyle.BackColor = Color.Silver;
+ currentDayStyle.CopyFrom (SelectedDayStyle);
+ }
+
+ currentDayStyle.Width = size;
+ currentDayStyle.HorizontalAlign = HorizontalAlign.Center;
+ }
+
+ TableCell dayCell = new TableCell ();
+ dayCell.ApplyStyle (currentDayStyle);
+ calDay.IsSelectable = isActive;
+ OnDayRender (dayCell, calDay);
+ if (isActive)
+ dayCell.Text = GetCalendarLinkText (
+ "selectDay" + (crr * 7 + weekDay),
+ dayString,
+ dayCell.ForeColor,
+ true);
+ else
+ dayCell.Text = dayString;
+
+ dayCell.RenderControl (writer);
+
+ currentDay = globCal.AddDays (currentDay, 1);
+ }
+ writer.Write("</tr>");
+ }
+ }
+
+ private int GetMask (CalendarDay day)
+ {
+ int retVal = MASK_DAY;
+ if(day.IsSelected)
+ retVal |= MASK_SELECTED;
+ if(day.IsToday)
+ retVal |= MASK_TODAY;
+ if(day.IsOtherMonth)
+ retVal |= MASK_OMONTH;
+ if(day.IsWeekend)
+ retVal |= MASK_WEEKEND;
+ return retVal;
+ }
+
+ /// <remarks>
+ /// Refers to the second line of the calendar, that contains a link
+ /// to select whole month, and weekdays as defined by DayNameFormat
+ /// </remarks>
+ private void RenderHeader (HtmlTextWriter writer,
+ DateTime firstDay,
+ CalendarSelectionMode mode,
+ bool isActive,
+ bool isDownLevel)
+ {
+ writer.Write("<tr>");
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
+ mode == CalendarSelectionMode.DayWeekMonth);
+
+ TableCell headerCell = new TableCell ();
+ headerCell.HorizontalAlign = HorizontalAlign.Center;
+ string selMthText = String.Empty;
+ if (isWeekMode) {
+ if (mode == CalendarSelectionMode.DayWeekMonth) {
+ headerCell.ApplyStyle (SelectorStyle);
+ selMthText = GetCalendarLinkText ("selectMonth",
+ SelectMonthText,
+ SelectorStyle.ForeColor,
+ isActive);
+ } else {
+ headerCell.ApplyStyle (DayHeaderStyle);
+ selMthText = String.Empty;
+ }
+ RenderCalendarCell (writer, headerCell, selMthText);
+ }
+
+ TableCell dayHeaderCell = new TableCell ();
+ dayHeaderCell.HorizontalAlign = HorizontalAlign.Center;
+
+ int dayOfWeek = (int) globCal.GetDayOfWeek (firstDay);
+ DateTimeFormatInfo currDTInfo = DateTimeFormatInfo.CurrentInfo;
+ for(int currDay = dayOfWeek; currDay < dayOfWeek + 7; currDay++) {
+ DayOfWeek effDay = (DayOfWeek) Enum.ToObject (typeof (DayOfWeek), currDay % 7);
+ string currDayContent;
+ switch(DayNameFormat) {
+ case DayNameFormat.Full:
+ currDayContent = currDTInfo.GetDayName (effDay);
+ break;
+ case DayNameFormat.FirstLetter:
+ currDayContent = currDTInfo.GetDayName (effDay).Substring (0,1);
+ break;
+ case DayNameFormat.FirstTwoLetters:
+ currDayContent = currDTInfo.GetDayName (effDay).Substring (0,2);
+ break;
+ case DayNameFormat.Short:
+ goto default;
+ default:
+ currDayContent = currDTInfo.GetAbbreviatedDayName (effDay);
+ break;
+ }
+
+ RenderCalendarCell(writer, dayHeaderCell, currDayContent);
+ }
+ writer.Write ("</tr>");
+ }
+
+ private void RenderTitle (HtmlTextWriter writer,
+ DateTime visibleDate,
+ CalendarSelectionMode mode,
+ bool isActive)
+ {
+ writer.Write("<tr>");
+ Table innerTable = new Table ();
+ TableCell titleCell = new TableCell();
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
+ mode == CalendarSelectionMode.DayWeekMonth);
+
+ titleCell.ColumnSpan = (isWeekMode ? 8 : 7);
+ titleCell.BackColor = Color.Silver;
+
+ innerTable.GridLines = GridLines.None;
+ innerTable.Width = Unit.Percentage (100);
+ innerTable.CellSpacing = 0;
+ ApplyTitleStyle (innerTable, titleCell, TitleStyle);
+
+ titleCell.RenderBeginTag (writer);
+ innerTable.RenderBeginTag (writer);
+
+ writer.Write ("<tr>");
+ string prevContent = String.Empty;
+ if (ShowNextPrevMonth) {
+ TableCell prevCell = new TableCell ();
+ prevCell.Width = Unit.Percentage (15);
+ prevCell.HorizontalAlign = HorizontalAlign.Left;
+ if (NextPrevFormat == NextPrevFormat.CustomText) {
+ prevContent = PrevMonthText;
+ } else {
+ int pMthInt = globCal.GetMonth(globCal.AddMonths (visibleDate, -1));
+ if (NextPrevFormat == NextPrevFormat.FullMonth)
+ prevContent = infoCal.GetMonthName (pMthInt);
+ else
+ prevContent = infoCal.GetAbbreviatedMonthName (pMthInt);
+ }
+ prevCell.ApplyStyle (NextPrevStyle);
+ RenderCalendarCell (writer,
+ prevCell,
+ GetCalendarLinkText ("prevMonth",
+ prevContent,
+ NextPrevStyle.ForeColor,
+ isActive)
+ );
+ }
+
+ TableCell currCell = new TableCell ();
+ currCell.Width = Unit.Percentage (70);
+ if (TitleStyle.HorizontalAlign == HorizontalAlign.NotSet)
+ currCell.HorizontalAlign = HorizontalAlign.Center;
+ else
+ currCell.HorizontalAlign = TitleStyle.HorizontalAlign;
+
+ currCell.Wrap = TitleStyle.Wrap;
+ string currMonthContent = String.Empty;
+ if (TitleFormat == TitleFormat.Month) {
+ currMonthContent = visibleDate.ToString ("MMMM");
+ } else {
+ string cmcFmt = infoCal.YearMonthPattern;
+ if (cmcFmt.IndexOf (',') >= 0)
+ cmcFmt = "MMMM yyyy";
+
+ currMonthContent = visibleDate.ToString (cmcFmt);
+ }
+
+ RenderCalendarCell (writer, currCell, currMonthContent);
+
+ string nextContent = String.Empty;
+ if (ShowNextPrevMonth) {
+ TableCell nextCell = new TableCell ();
+ nextCell.Width = Unit.Percentage(15);
+ nextCell.HorizontalAlign = HorizontalAlign.Left;
+ if (NextPrevFormat == NextPrevFormat.CustomText) {
+ nextContent = NextMonthText;
+ } else {
+ int nMthInt = globCal.GetMonth (globCal.AddMonths (visibleDate, 1));
+ if(NextPrevFormat == NextPrevFormat.FullMonth)
+ nextContent = infoCal.GetMonthName(nMthInt);
+ else
+ nextContent = infoCal.GetAbbreviatedMonthName(nMthInt);
+ }
+ nextCell.ApplyStyle(NextPrevStyle);
+ RenderCalendarCell (writer,
+ nextCell,
+ GetCalendarLinkText ("nextMonth",
+ nextContent,
+ NextPrevStyle.ForeColor,
+ isActive)
+ );
+ }
+
+ writer.Write("</tr>");
+ innerTable.RenderEndTag(writer);
+ titleCell.RenderEndTag(writer);
+
+ writer.Write("</tr>");
+ }
+
+ private void ApplyTitleStyle(Table table, TableCell cell, TableItemStyle style)
+ {
+ if(style.BackColor != Color.Empty)
+ {
+ cell.BackColor = style.BackColor;
+ }
+ if(style.BorderStyle != BorderStyle.NotSet)
+ {
+ cell.BorderStyle = style.BorderStyle;
+ }
+ if(style.BorderColor != Color.Empty)
+ {
+ cell.BorderColor = style.BorderColor;
+ }
+ if(style.BorderWidth != Unit.Empty)
+ {
+ cell.BorderWidth = style.BorderWidth;
+ }
+ if(style.Height != Unit.Empty)
+ {
+ cell.Height = style.Height;
+ }
+ if(style.VerticalAlign != VerticalAlign.NotSet)
+ {
+ cell.VerticalAlign = style.VerticalAlign;
+ }
+
+ if(style.ForeColor != Color.Empty)
+ {
+ table.ForeColor = style.ForeColor;
+ } else if(ForeColor != Color.Empty)
+ {
+ table.ForeColor = ForeColor;
+ }
+
+ table.Font.CopyFrom(style.Font);
+ table.Font.MergeWith(Font);
+ }
+
+ private void RenderCalendarCell (HtmlTextWriter writer, TableCell cell, string text)
+ {
+ cell.RenderBeginTag(writer);
+ writer.Write(text);
+ cell.RenderEndTag(writer);
+ }
+
+ private DateTime GetFirstCalendarDay(DateTime visibleDate)
+ {
+ int fow = (int) FirstDayOfWeek;
+ if (fow == 7)
+ fow = (int) infoCal.FirstDayOfWeek;
+
+ int days = (int) globCal.GetDayOfWeek (visibleDate) - fow;
+ if (days <= 0)
+ days += 7;
+ return globCal.AddDays (visibleDate, -days);
+ }
+
+ private DateTime GetEffectiveVisibleDate()
+ {
+ DateTime dt = VisibleDate;
+ if (VisibleDate == DateTime.MinValue)
+ dt = TodaysDate;
+
+ return globCal.AddDays (dt, 1 - globCal.GetDayOfMonth (dt));
+ }
+
+ /// <summary>
+ /// Creates text to be displayed, with all attributes if to be
+ /// shown as a hyperlink
+ /// </summary>
+ private string GetCalendarLinkText (string eventArg,
+ string text,
+ Color foreground,
+ bool isLink)
+ {
+ if (isLink) {
+ StringBuilder dispVal = new StringBuilder ();
+ dispVal.Append ("<a href=\"");
+ dispVal.Append (Page.GetPostBackClientHyperlink (this, eventArg));
+ dispVal.Append ("\" style=\"color: ");
+ if (foreground.IsEmpty) {
+ dispVal.Append (ColorTranslator.ToHtml (defaultTextColor));
+ } else {
+ dispVal.Append (ColorTranslator.ToHtml (foreground));
+ }
+ dispVal.Append ("\">");
+ dispVal.Append (text);
+ dispVal.Append ("</a>");
+ return dispVal.ToString ();
+ }
+ return text;
+ }
+
+ private string GetHtmlForCell (TableCell cell, bool showLinks)
+ {
+ StringWriter sw = new StringWriter ();
+ HtmlTextWriter htw = new HtmlTextWriter (sw);
+ cell.RenderBeginTag (htw);
+ if(showLinks) {
+ htw.Write (GetCalendarLinkText ("{0}", "{1}", cell.ForeColor, showLinks));
+ } else {
+ htw.Write ("{0}");
+ }
+ cell.RenderEndTag (htw);
+ return sw.ToString();
+ }
+
+ internal void SelectRangeInternal (DateTime fromDate, DateTime toDate, DateTime visibleDate)
+ {
+ TimeSpan span = toDate - fromDate;
+ if (SelectedDates.Count != span.Days + 1 ||
+ SelectedDates [0] != fromDate ||
+ SelectedDates [SelectedDates.Count - 1] != toDate) {
+ SelectedDates.SelectRange (fromDate, toDate);
+ OnSelectionChanged ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs
new file mode 100644
index 00000000000..bcd835c45e3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs
@@ -0,0 +1,100 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CalendarDay
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CalendarDay
+ {
+ private DateTime date;
+ private bool isWeekend;
+ private bool isToday;
+ private bool isSelected;
+ private bool isOtherMonth;
+ private bool isSelectable;
+ private string dayNumberText;
+
+ public CalendarDay(DateTime date, bool isWeekend, bool isToday, bool isSelected, bool isOtherMonth, string dayNumberText)
+ {
+ this.date = date;
+ this.isWeekend = isWeekend;
+ this.isToday = isToday;
+ this.isSelected = isSelected;
+ this.isOtherMonth = isOtherMonth;
+ this.dayNumberText = dayNumberText;
+ }
+
+ public DateTime Date
+ {
+ get
+ {
+ return date;
+ }
+ }
+
+ public string DayNumberText
+ {
+ get
+ {
+ return dayNumberText;
+ }
+ }
+
+ public bool IsOtherMonth
+ {
+ get
+ {
+ return isOtherMonth;
+ }
+ }
+
+ public bool IsSelectable
+ {
+ get
+ {
+ return isSelectable;
+ }
+ set
+ {
+ isSelectable = value;
+ }
+ }
+
+ public bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ }
+
+ public bool IsToday
+ {
+ get
+ {
+ return isToday;
+ }
+ }
+
+ public bool IsWeekend
+ {
+ get
+ {
+ return isWeekend;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs
new file mode 100755
index 00000000000..54dd298f2e4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: CalendarSelectionMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum CalendarSelectionMode
+ {
+ None,
+ Day,
+ DayWeek,
+ DayWeekMonth
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
new file mode 100644
index 00000000000..51dc36cedf5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
@@ -0,0 +1,977 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs: what can I say for this one? I spent so many time
+ until I finally found this that I'm gonna miss this f....g bug... ;-).
+ Farewell. Now we can get events from image buttons inside Data*.
+
+ * DataList.cs: now the value stored in ViewState for item count is
+ correct.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: default value for ShowHeaders is true. Fixed style for
+ Header and Footer.
+ * DataGridColumn.cs: added SetOwner method.
+ * DataGridColumnCollection.cs: set the owner of the column when added.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BoundColumn.cs: typo.
+ * DataGrid.cs: use 'as' instead of casting. Typo.
+ * HyperLinkColumn.cs: call OnColumnChanged when any property change.
+ Mono-stylized.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HyperLink.cs: fixes bug #36336.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: fixed IRepeatInfoUser.GetItemStyle.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseValidator.cs: return an empty string in GetControlValidationValue
+ when GetValue returned null.
+
+ * CompareValidator.cs: fixed EvaluateIsValid.
+
+ * RegularExpressionValidator.cs: fixed EvaluateIsValid.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: use MapPathSecure to get the path of the document.
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: fixed header & footer.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: for header and footer don't use data source.
+ Instantiate in the DataListItem, not in the DataList.
+ databind-template.aspx works now.
+
+2002-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs:
+ (Render): call RenderContents (), not base.RenderContents ().
+
+ * DataList.cs: style.
+
+ But I still haven't found what i'm looking for....
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: fixed loading/saving selected dates.
+ * SelectedDatesCollection.cs: added internal function to get the
+ underlying ArrayList.
+
+ Calendar navigation works again. Selecting dates too.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataList.cs: added a few attributes and fixed infinite recursion.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListItemCollection.cs: fixed LoadViewState.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TableItemStyle.cs: TypeDescriptor.GetConverter seems to fail.
+ Commented out some code until it works.
+
+2002-10-29 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseCompareValidator.cs - Fixed operator bug in
+ Compare(string, string, ...)
+ * CompareValidator.cs - EvaluateIsValid() : Implemented.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BoundColumn.cs - InitializeCell(TableCell, int, ListItemType)
+ : Implemented.
+ - All Properties : Now make use of ViewState.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseValidator.cs - Uncomment NotImplementedException.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseValidator.cs - Minor changes in TODO comments.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * BaseValidator.cs - DetermineRenderUpLevel() : Uncomment
+ the NotImplementedException being thrown.
+ * DataGridPagerStyle.cs - Mode { set; } : Implemented.
+ * DataGridLinkButton.cs - Added new class (private) : Implemented.
+ * DataGrid.cs - InitializePager(DataGridItem, int,
+ PagedDataSource) : Implemented.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataList.cs - PrepareControlHierarchy() : Implemented.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataList.cs - RenderContents(HtmlTextWriter) : Implemented.
+ - GetItem(ListItemType, int) : Removed TODO.
+ - CreateControlHierarchy(bool) : Implemented.
+ - CreateItem(int, ListItemType) : Implemented.
+ - CreateItem(int, ListItemType,
+ bool, object) : Implemented.
+ - InitializeItem(DataItem) : Implemented.
+ * DataGrid.cs - CreateControlHierarchy(bool) : Bug fix.
+ The ViewState["_!ItemCount"],
+ ViewState["_!DataSource_ItemCount"]
+ are shared by DataList and DataGrid, and hence
+ should share the same name.
+ - ResolveDataSource(object, string)
+ : Removed. Use System.Web.UI.Utils.DataSourceHelper
+ ::GetResolvedDataSource(object, string).
+
+
+2002-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed compilation
+
+2002-09-12 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * PagedDataSource.cs - FirstIndexInPage : Fixed bug.
+ * DataGrid.cs - CreateControlHierarchy(bool)
+ : working towards completion.
+ - ResolveDataSource(object, string)
+ : stubbed new method
+ - CreateItem(....)
+ : stubbed new method
+ Well. It's almost done.
+ * DataGridTableInternal.cs
+ - Added new internal class.
+
+2002-08-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataSourceInternal.cs - Added new class (internal).
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FontUnit.cs:
+ * HorizontalAlign.cs:
+ * Unit.cs:
+ * VerticalAlign.cs: fixes based on class status page.
+
+ * HorizontalAlignConverter.cs: implemented.
+ * VerticalAlignConverter.cs: implemented.
+
+ * FontUnitConverter.cs: implemented GetStandardValues ().
+
+ * WebColorConverter.cs: implemented ConvertFrom () and ConvertTo ().
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - AutoCreateColumns: Bug fixes.
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - AutoCreateColumns: completed, hopefully!
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Working on the undocumented protected
+ method CreateColumnSet. AutoCreateColumns method
+ stubbed. Left CreateControlHierarchy for the time
+ being, looks like I'm going insane. ;-)
+
+2002-08-19 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * Button.cs - Steffen's OnCommand bug fix.
+
+2002-08-12 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Added protected method (skeleton)
+ CreateColumnSet(PagedDataSource, bool)
+ Still trying to know how will it be used
+ and what for...
+
+2002-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PagedDataSource.cs: fixed compilation.
+
+2002-08-08 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Added private method
+ CreatePagedDataSource
+ - Started work on
+ CreateControlHierarchy(bool)
+ * PagedDataSource.cs - Bug fixed.
+ CurrentPageIndex is writable.
+
+2002-08-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGrid.cs: fixed typo.
+ * DataGridPagerStyle.cs: added IsPagerOnTop and IsPagerOnBottom.
+
+2002-08-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGridColumn.cs - Added internal methods to get the
+ various styles (needed in DataGrid.cs)
+ * DataGrid.cs - Completed the method
+ PrepareControlHierarchy()
+
+2002-08-06 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Wokring on PrepareControlHierarchy()
+ - Added private method
+ PrepareControlHierarchyForItem()
+
+2002-08-05 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataGrid.cs - Completed method
+ OnBubbleEvent(object, EventArgs)
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: implemented document/transform load.
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: added myself to the list of authors.
+ * DropDownList.cs: fixed a few properties.
+ * ListControl.cs: fixed SelectedIndex.
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: lots of fixes. Render days. Still left to persist
+ selected days when changing month.
+
+ * Unit.cs: fixed Percentage and Pixel.
+
+ * WebControl.cs: a few properties are now using ControlStyle instead
+ of ViewState to persist.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseValidator.cs: it works now.
+ * DataGridColumn.cs: added attribute and made it abstract.
+ * RequiredFieldValidator.cs: fixed return value in EvaluateIsValid.
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TextBox.cs: default for Wrap is true.
+ (OnPreRender): don't save Text if there are no listeners on TextChanged.
+
+2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DropDownList.cs:
+ (ToolTip): fixed.
+
+ * ListItem.cs:
+ (LoadViewState): fixed.
+
+ * ListItemCollection.cs:
+ (TrackViewState): use items instead of 'this' in foreach.
+
+ * Style.cs:
+ (LoadViewState): more checking of parameters.
+
+ * WebControl.cs: implemented LoadViewState and SaveViewState.
+
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListItem.cs: there was no code to unset the flags!!!
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FontUnit.cs: use a hashtable for mapping size name to value.
+ * HyperLink.cs: fixed a bug and a typo.
+ * Unit.cs: some fixes to internal constructor.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListControl.cs: fixed a couple of range checks.
+ * WebControl.cs: MS lies! Not all WebControls must be rendered inside
+ an HtmlForm (p.e., Label).
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs:
+ * Button.cs:
+ * Calendar.cs:
+ * CheckBox.cs:
+ * CheckBoxList.cs:
+ * DataList.cs:
+ * DropDownList.cs:
+ * HyperLink.cs:
+ * HyperLinkColumn.cs:
+ * Image.cs:
+ * ImageButton.cs:
+ * Label.cs:
+ * LinkButton.cs:
+ * ListBox.cs:
+ * Panel.cs:
+ * PlaceHolder.cs:
+ * RadioButton.cs:
+ * RadioButtonList.cs:
+ * Table.cs:
+ * TableRow.cs:
+ * TextBox.cs:
+ * WebControl.cs: removed attributes added by mistake (i used
+ GetCustomAttributes (true), d'oh!).
+
+ * DataListItem.cs: implemented RenderItem.
+
+ * Repeater.cs: implemented CreateItem and InitializeItem.
+
+2002-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseDataList.cs: a couple of fiex and added attributes.
+ * DataGrid.cs: little fixes.
+
+2002-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckBoxList.cs:
+ * DataGrid.cs:
+ * DataList.cs:
+ * DropDownList.cs:
+ * ListBox.cs:
+ * PlaceHolder.cs:
+ * RadioButton.cs:
+ * RadioButtonList.cs:
+ * TableRow.cs:
+ * WebControl.cs:
+ * Xml.cs: forgot to add using System.ComponentModel.
+
+ * BaseValidator.cs: use explicitly
+ System.ComponentModel.AttributeCollection as there is another class
+ with the same name under System.Web.UI.
+
+2002-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs:
+ * Button.cs:
+ * Calendar.cs:
+ * CheckBox.cs:
+ * CheckBoxList.cs:
+ * DataGrid.cs:
+ * DataList.cs:
+ * DropDownList.cs:
+ * HyperLink.cs:
+ * Image.cs:
+ * ImageButton.cs:
+ * Label.cs:
+ * LinkButton.cs:
+ * ListBox.cs:
+ * Panel.cs:
+ * PlaceHolder.cs:
+ * RadioButton.cs:
+ * RadioButtonList.cs:
+ * Table.cs:
+ * TableRow.cs:
+ * TextBox.cs:
+ * WebControl.cs:
+ * Xml.cs: added/fixed all attributes used by xsp.
+
+ * BaseValidator.cs: some fixes.
+
+2002-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Table.cs:
+ (AddAttributesToRender): correctly default to border=1.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs:
+ (LoadAdFile): make the dictionary null after every iteration.
+
+ * LinkButton.cs:
+ * ListControl.cs:
+ * ListItem.cs: fixed warnings.
+
+Mon Jul 1 16:23:15 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Style.cs, TableRow.cs, DataListItem.cs: fix compilation.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataGridColumn.cs:
+ * DataGridPagerStyle.cs:
+ * DataList.cs:
+ * DataListItem.cs:
+ * Image.cs:
+ * LinkButton.cs:
+ * ListControl.cs:
+ * ListItem.cs:
+ * ListItemCollection.cs:
+ * Repeater.cs:
+ * ServerValidateEventArgs.cs:
+ * Style.cs:
+ * TableRow.cs:
+ * WebControl.cs:
+ * Xml.cs: more class status page based changes.
+
+2002-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Button.cs:
+ (.ctor): fixed to render the correct tag.
+ (IPostBAckEventHandler.RaisePostBackEvent): fixed.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs:
+ (AddAttributesToRender): call Page.VerifyRenderingInServerForm. All
+ WebControl derived classes should be rendered inside a HtmlForm.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Repeater.cs: implemented CreateControlHierarchy. Fixed some event
+ processing methods.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: implemented IRepeatInfoUser.RenderItem.
+ * RepeatInfo.cs: implemented DoHorizontalRendering.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI.WebControls/Repeater.cs:
+ (Controls):
+ (OnDataBinding): fixed stack overflow.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButtonList.cs: implemented IRepeatInfoUser.RenderItem.
+ * RepeatInfo.cs: implemented DoHorizontalRendering.
+
+2002-06-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs:
+ (CopyBaseAttributes): copy Attributes and don't throw exception.
+
+2002-06-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListBox.cs: mono-stylized.
+ (AddAttributesToRender): call parent class method.
+
+2002-06-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Style.cs: fixed IsEmpty and Width.
+
+ * Table.cs: mono-stylized.
+ (TableRowControlCollection.AddAt): fixed.
+ (AddAttributesToRender): fixed.
+
+ * TableCell.cs: mono-stylized.
+ (.ctor): use PreventAutoID.
+ (AddAttributesToRender): fixed.
+ (AddParsedSubObject): fixed.
+
+ * TableRow.cs: mono-stylized. Added
+ ParseChildren attribute.
+
+ * TableStyle.cs:
+ (get_GridLine): fixed.
+
+2002-06-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Panel.cs: fixed stack overflow.
+ * Unit.cs: use Int32.Parse and Single.Parse instead of Int32Converter
+ and SingleConverter.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RadioButton.cs: mono-stylized and some little fixes.
+
+ * TextBox.cs: mono-stylized.
+ (MaxLength): fixed typo.
+
+ (AddAttributesToRender): don't render the text between the tags for
+ SingleLine, use value attribute for it. Don't render the text for
+ Password.
+
+ (OnPreRender): don't throw exception and call base.OnPreRender.
+
+ (Render): for MultiLine, render the text between the opening and
+ closing tags encoded as HTML.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ImageButton.cs:
+ (AddAttributesToRender): fixer another stack overflow.
+
+ * WebControl.cs:
+ (TagName): modified to use TagKey instead of tagKey as the property
+ can be overriden.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LinkButton.cs: mono-stylized.
+ (AddParsedSubObject):
+ (RenderControls): little fixes.
+
+ * WebControl.cs:
+ (AddAttributesToRender): fixed usage of IEnumerator.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Literal.cs: beautified.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Label.cs: beautified and fixed a couple of 'classic' bugs.
+
+ * WebControl.cs: use Span as default tag when no other provided in
+ constructor. That is what MS renders.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Button.cs:
+ (AddAttributesToRender): fixed (classic) stack overflow.
+
+ * CheckBox.cs: mono-stylized.
+ (AutoPostBack): fixed stack overflow.
+ (Render): fixed alignment issues. Also set the For attribute always
+ for the label.
+
+2002-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AdRotator.cs: GetData does not work as it should, but now it returns
+ useful data (only the first ad in the file). Set the NavigateUrl
+ property in the hyperlink if available.
+
+ * HyperLink.cs: fixed constructor and a couple of stack overflows.
+
+ * Image.cs: added an attribute and fixed stack overflow.
+
+ * WebControl.cs:
+ (RenderBeginTag): fixed.
+ (TagName): don't call Enum.IsDefined twice.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebControl.cs: added attributes PersistChildrenAttribute and
+ ParseChildrenAttribute.
+
+2002-05-24 Duncan Mak <duncan@ximian.com>
+
+ * DataGridItem.cs (SetItemType): Changed function signature to
+ match 1.0 spec.
+
+ * ListItemCollection.cs (this): Changes the visibility level of
+ the indexer.
+
+ * Repeater.cs (OnItemCommand):
+ (OnItemCreated):
+ (OnItemDataBound): Added necessary casts.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * Button.cs (AddAttributesToRender):
+ * ImageButton.cs (AddAttributesToRender): Added a missing argument to the
+ GetClientValidatedEvent method.
+
+2002-03-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Removed extra methods, corrected access modifiers to several
+ methods.
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * <SeveralFiles>.cs - Added some attributes
+ * FontUnitConverter.cs - Added stubs for GetStandardValues*(..)
+ methods. Will complete them later. Right now, busy with
+ the attributes part.
+ * RepeaterItem.cs - Completed.
+
+ Oh God! Mercy! I will die applying attributes. I look at the missing
+ part in the class-status - daemon! Kyrie eleison!
+
+2002-03-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Some bug fixes
+
+ * AdRotator.cs - Added definition for Font.
+ * BaseCompareValidator.cs - Added definition for Controls.
+ * Calendar.cs - SelectMonthText definition corrected.
+ * DataList.cs - Added definition for SeparatorTemplate.
+ * BorderStyle.cs - Namespace correction. It belongs not to UI,
+ but to UI.WebControls.
+
+2002-03-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Finally, I have made it. Today I did a second build for the
+ System.Web assembly. It compiled 195 classes today.
+ I am waiting eagerly for the runtime to come up so that the objects
+ may be tested to their last levels. Several of the methods are still
+ under the tag of "TODO" throwing NotImplementedException. Well, I
+ hope to remove them soon, but how far is this soon - even I don't
+ know, though I am happy to make the build a success even before
+ the vacations to come.
+
+2002-03-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Yesterday and today I tried to do some building of the aseembly,
+ but was dumped with uncoutably infinite errors. ;-)
+ I have put the copies of the recent errors on my home page, want
+ to have a look at them? See:
+ http://mastergaurav.virtualave.net/mono/
+ I don't know what to do with these errors. Oh! The buggy me! How
+ will I overcome myself. Hopefully, by when my vacations over, I
+ should have made a repository where the build will not fail.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ I am now going to do a build that will include the
+ System.Web.UI.WebControls namespace. Hoping that I will make it
+ soon. My exams are coming near and I have to pack up soon.
+
+
+2002-03-04 Gaurav Vaish <gvaish@iitk.ac.in>
+
+Comments:
+ And with this, ie, today's work, all the objects mentioned in the
+ namespace appear in the implementation. But it may not be worth
+ trying to go for a build because of dependence of several of the
+ internal methods that may clash with already available assembly
+ System.Web.
+
+ Also, the classes lack possible attributes, like those informing
+ about child-controls etc. But I have to first create the attribute
+ classes before I attach the attributes to the classes.
+
+ * CustomValidator.cs - Completed. In process realized that
+ I have to complete / rejuvinate BaseValidator class.
+ * BaseValidator.cs - Complete rejuvination. Completed 80%
+ of the job. All that is left is Render(HtmlTextWriter),
+ DetermineRenderUplevel(), RegisterValidatorCommonScript()
+ RegisterValidatorDeclaration()
+ * DataGridPagerStyle.cs - Completed. That adds one more missle
+ in my artillery.
+ * DataKeyCollection.cs - Completed. Petty small.
+ * Repeater.cs - Work started off. This is a quite
+ heavy class. Hooh!
+ * DataGridItemEventArgs.cs,
+ * DataGridShortCommandEventArgs.cs,
+ * DataListItemEventArgs.cs,
+ * MonthChangedEventArgs.cs,
+ * RepeaterItemEventArgs.cs,
+ * ServerValidateEventArgs.cs,
+ * DataGridPageChangedEventArgs.cs
+ - Damn, I marked them "*", while they
+ did not exist.
+ * Repeater.cs - Done all except for an undocumented
+ method CreateControlHierarchy(bool). Though the method
+ is quite clear by its name, but it will take some time
+ for me to come with some material to flush in.
+
+2002-03-03 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * SelectedDatesCollection.cs - Completed.
+ * PagedDataSource.cs - Completed. Pathetically nice class.
+ * RegularExpressionValidator.cs
+ - Completed. Ridiculously small and
+ annoyinglyc crazy-driving class, basically the method
+ EvaluateIsValid().
+ * RangeValidator.cs - Completed.
+ * DataGridColumn.cs - Completed.
+ * EditCommandColumn.cs - All is complete except for the
+ InitializeCell(TableCell, int, ListItemType) method.
+ * DataListItem.cs - All done except for a longish method
+ RenderItem(HtmlTextWriter, bool, bool)
+
+2002-03-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RepeaterItemCollection.cs - Completed.
+ I love *Collection classes. I am planning to make a
+ program that will generate a *Collection class. It's so
+ simple and the same. ;-)
+ * DataGridColumnCollection.cs - Completed.
+ ... except probably for *ColumnCollection classes, where
+ you have to put in some more effort. Still, these class
+ generation can be automated.
+ * DataListItemCollection.cs - Completed.
+ See, how easily, in less than a quarter of a minute, I
+ completed this class - manually. Copy-Paste/Cut-Replace.
+
+2002-02-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataGrid.cs - Following methods implemented:
+ TrackViewState(), LoadViewState(object), SaveViewState(),
+ On* -- The event raisers.
+ OnBubbleEvent(object, EventArgs) is still incomplete.
+ * DataGridItem.cs - Initial Implementation
+ * DataGridItemCollection.cs - Completed.
+
+2002-02-08 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataGrid.cs - Initial Implementation. Worked
+ primarily with some properties.
+
+2002-02-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Completed. Implemented
+ LoadPostData(string, NameValueCollection)
+ * RequiredFieldValidator.cs - Completed. Pretty simple class.
+
+2002-02-06 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Implemented the following:
+ RaisePostDataChangedEvent()
+
+2002-02-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Supports the following properties:
+ BorderColor, BorderStyle, BorderWidth, Rows, SelectionMode,
+ ToolTip.
+ Methods:
+ AddAttributesToRender(HtmlTextWriter), OnPreRender(EventArgs),
+ RenderContents(HtmlTextWriter)
+
+
+2002-02-01 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TargetConverter.cs - Completed
+ * TemplateColumn.cs - Completed
+ * DataList.cs - Corrected the get-er methods for the
+ *Style objects. Corrected the get/set-er methods for ViewState
+ related objects.
+ Addded support for properties:
+ GridLines, HeaderStyle, HeaderTemplate, ItemStyle, ItemTemplate,
+ RepeatColumns, RepeatDirection, RepeatLayout, SelectedIndex,
+ SelectedItem, SelectedItemStyle, SelectedItemTemplate,
+ SeparatorStyle, SeparatorItemTemplate.
+ Events:
+ CancelCommand, DeleteCommand, EditCommand, ItemCommand,
+ ItemCreated, ItemDataBound, UpdateCommand.
+ Methods:
+ CreateControlStyle(), LoadViewState(object),
+ SaveViewState(), TrackViewState
+ Event handlers:
+ OnBubbleEvent, OnCancelCommand, OnDeleteCommand,
+ OnEditCommand, OnItemCommand, OnItemCreated,
+ OnItemDataBound, OnUpdateCommand
+ Added dummy methods for some undocumented methods:
+ CreateControlHierarchy(bool), CreateItem(int, ListItemType),
+ CreateItem(int, ListItemType, bool, object),
+ PrepareControlHierarchy(), InitializeItem(DataListItem)
+ * ListBox.cs - Started working.
+
+
+
+2002-01-31 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RepeaterInfo.cs - Initial Implementation. Done all
+ except for RepeatDirection.Vertical
+ * TableStyle.cs - Completed
+
+2002-01-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DropDownList.cs - Completed
+ * ListItemCollection.cs - Added method FindByValueInternal to
+ assist in the derived classes.
+ Discovered bug in FindByValue. Removed
+ * UnitConverter.cs - Completed
+ * PlaceHolder.cs - What can be simpler than this?
+ * PlaceHolderControlBuilder.cs
+ - Uh! Damn cool one.
+ * RadioButtonList.cs - Initial Implementation. All is done
+ except for the implementation of
+ method IRepeatInfoUser.RenderItem(...)
+ * ValidatedControlConverter.cs
+ ^^^^^^^^^^^^^^^^^^^^^^^^^ - Looks complete. Doubtful though !!
+ * ValidationSummary.cs - Initial Implementation.
+ * WebColorConverter.cs - Initial Implementation
+
+2002-01-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * FontNamesConverter.cs - Completed
+ * FontUnitConverter.cs - Partial Implementation
+ * ListItemControlBuilder.cs - Completed
+
+2002-01-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TextBox.cs - All done except *Render* methods
+ * TextBoxControlBuilder.cs - Completed
+ * Xml.cs - Partial Implementation
+
+2002-01-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RadioButton.cs - Completed
+ * TextBox.cs - Partial Implementation
+
+2002-01-25 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Panel.cs - Completed
+ * TableItemStyle.cs - Completed
+
+2002-01-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TableCellCollection.cs - Completed
+ * TableRowCollection.cs - Completed
+ * TableHeaderCell.cs - Completed
+ * TableRow.cs - Completed
+
+2002-01-09 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TableCellControlBuilder.cs - Completed
+ * Table.cs - Completed
+ * TableCell.cs - Completed
+
+2002-01-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * CheckBoxList.cs - Completed
+ * ButtonColumn.cs - Completed
+ * Button.cs - Completed
+
+2001-12-28 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * HyperLink.cs - Completed
+ * Image.cs - Completed
+ * ImageButton.cs - Completed
+ * Label.cs - Completed
+ * LabelControlBuilder.cs - Completed
+ * LinkButton.cs - Completed
+ * LinkButtonControlBuilder.cs - Completed
+ * Literal.cs - Completed
+ * LieteralControlBuilder.cs - Completed
+ * FontUnit.cs - Completed
+
+
+2001-12-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Calendar.cs - Completed the functions of Render*,
+ ViewStates (Track/View/Save),
+ RaisePostBackEvent.
+ Left: RenderAllDays (partially)
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Calendar.cs - Added some more functions
+ * Style.cs - Completed
+ * ListItem.cs - Completed
+ * ListItemCollection.cs - Completed
+
+ Made the first successful build of System.Web.dll that included
+ System.Web.UI.WebControls!
+
+2001-12-20 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ FontInfo.cs - Complete revamp. Completed
+
+2001-12-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ ListItemCollection.cs - Completed
+ ListItem.cs - Initial Implementation
+ Style.cs - Initial Implementation
+
+ Right now I am in a total mood to do a successful build. Creating so many
+ classes, completing classes in System.Web System.Web.UI namespaces.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ TODO - Properly added
+ CheckBox.cs - Completed
+ BaseDataList.cs - Completed
+ DayRenderEventArgs.cs - Completed
+ RepeaterItem.cs - Initial implementation
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ BaseCompareValidator.cs - Completed
+ AdRotator.cs - Completed
+
+2001-12-15 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CommandEventArgs.cs - Completed
+ DataGridCommandEventArgs.cs - Completed
+ RepeaterCommandEventArgs.cs - Completed
+ DataListCommandEventArgs.cs - Completed
+ CompareValidator.cs - Partial Implementation
+
+2001-12-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CheckBoxList.cs - Partial Implementation.
+ All except "Render"
+
+2001-12-01 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ ListControl.cs - Completed
+
+2001-11-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CheckBox.cs - Completed
+ ListControl.cs - Initial Implementation
+ CheckBoxList.cs - Started with it, but first needed
+ ListControl. Left it.
+
+2001-11-29 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CalendarDay.cs - Making a note that this
+ has been implemented
+ Calendar.cs - Making a note that have made some changes.
+ Unimplmented functions throw
+ NotImplementedException
+ CheckBox.cs - Can now "Render" and "LoadPostData"
+
+
+2001-11-08 Gaurav Vaish <gvaish@iitk.ac.in>
+ WebControl.cs - Total Revamp, Partial Implementation
+ AdRotator.cs - Able to load files
+ AdCreatedEventArgs.cs - Implemented
+
+2001-11-05 Gaurav Vaish <gvaish@iitk.ac.in>
+ Calendar.cs - Initial Implementation
+ ButtonColumn.cs - Initial Implementation
+ Button.cs - Initial Implementation
+ BoundColumn.cs - Initial Implementation
+ BaseCompareValidator.cs - Minor Changes
+ DataList.cs, BaseValidator.cs, BaseDataList.cs
+ - Added more functions, other changes
+
+2001-10-28 Gaurav Vaish <gvaish@iitk.ac.in>
+ WebControl.cs - Initial Implementation
+ DataList.cs - Initial Implementation
+ BaseValidator.cs - Initial Implementation
+ BaseDataList.cs - Initial Implementation
+
+2001-10-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ AdCreatedEventArgs.cs - Initial Implementation
+ AdCratedEventHandler.cs - Implemented
+ AdRotator.cs - Initial Implementation
+ BorderStyle.cs - Implemented
+ ButtonColumnStyle.cs - Implemented
+ CalendarSelectionMode.cs - Implemented
+ DayNameFormat.cs - Implemented
+ FirstDayOfWeek - Implemented
+ FontInfo.cs - Partial Implementation
+ FontSize.cs - Implemented
+ GridLines.cs - Implemented
+ HorizontalAlign.cs - Implemented
+ HyperLink.cs - Initial Implementation
+ ImageAlign.cs - Implemented
+ IRepeatInfoUser.cs - Implemented
+ ListItemType.cs - Implemented
+ ListSelectionMode.cs - Implemented
+ NextPrevFormat.cs - Implemented
+ PagerMode.cs - Implemented
+ PagerPosition.cs - Implemented
+ RepeatDirection.cs - Implemented
+ RepeatLayout.cs - Implemented
+ TextAlign.cs - Implemented
+ TextBoxMode.cs - Implemented
+ TitleFormat.cs - Implemented
+ UnitType.cs - Implemented
+ ValidationCompareOperator.cs
+ - Implemented
+ ValidationDataType.cs - Implemented
+ ValidationSummaryDisplayMode.cs
+ - Implemented
+ ValidatorDisplay.cs - Implemented
+ VerticalAlign.cs - Implemented
+
+
+
+// File Created 2001-11-13
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
new file mode 100644
index 00000000000..70931a89d88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
@@ -0,0 +1,215 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CheckBox
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ * Thanks to Leen Toelen (toelen@hotmail.com)'s classes that helped me
+ * to write the contents of the function LoadPostData(...)
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("CheckedChanged")]
+ [DefaultProperty("Text")]
+ //[DataBindingHanlder("??")]
+ //[Designer("??")]
+ public class CheckBox : WebControl, IPostBackDataHandler
+ {
+ private static readonly object CheckedChangedEvent = new object();
+
+ public CheckBox(): base(HtmlTextWriterTag.Input)
+ {
+ }
+
+ public virtual bool AutoPostBack
+ {
+ get {
+ object o = ViewState ["AutoPostBack"];
+ return (o == null) ? false : (bool) o;
+ }
+
+ set { ViewState ["AutoPostBack"] = value; }
+ }
+
+ public virtual bool Checked
+ {
+ get {
+ object o = ViewState ["Checked"];
+ return (o == null) ? false : (bool) o;
+ }
+
+ set { ViewState ["Checked"] = value; }
+ }
+
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ private bool SaveCheckedViewState
+ {
+ get {
+ if (Events [CheckedChangedEvent] != null){
+ if (!Enabled)
+ return true;
+
+ Type type = GetType ();
+ if (type == typeof (CheckBox))
+ return false;
+
+ if (type == typeof (RadioButton))
+ return false;
+ }
+ return true;
+ }
+ }
+
+ public virtual TextAlign TextAlign
+ {
+ get {
+ object o = ViewState ["TextAlign"];
+ return (o == null) ? TextAlign.Right : (TextAlign) o;
+ }
+
+ set {
+ if (!System.Enum.IsDefined (typeof (TextAlign), value))
+ throw new ArgumentException ();
+ ViewState ["TextAlign"] = value;
+ }
+ }
+
+ public event EventHandler CheckedChanged
+ {
+ add { Events.AddHandler (CheckedChangedEvent, value); }
+ remove { Events.RemoveHandler (CheckedChangedEvent, value); }
+ }
+
+ protected virtual void OnCheckedChanged(EventArgs e)
+ {
+ if(Events != null){
+ EventHandler eh = (EventHandler) (Events [CheckedChangedEvent]);
+ if(eh != null)
+ eh (this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if (Page != null && Enabled)
+ Page.RegisterRequiresPostBack (this);
+
+ if (SaveCheckedViewState)
+ ViewState.SetItemDirty ("checked", false);
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ bool hasBeginRendering = false;
+ if(ControlStyleCreated && !ControlStyle.IsEmpty){
+ hasBeginRendering = true;
+ ControlStyle.AddAttributesToRender (writer, this);
+ }
+
+ if (!Enabled){
+ hasBeginRendering = true;
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ }
+
+ if (ToolTip.Length > 0){
+ hasBeginRendering = true;
+ writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);
+ }
+
+ if (Attributes.Count > 0){
+ string val = Attributes ["value"];
+ Attributes.Remove ("value");
+ if (Attributes.Count > 0){
+ hasBeginRendering = true;
+ Attributes.AddAttributes (writer);
+ }
+
+ if (val != null)
+ Attributes ["value"] = val;
+ }
+
+ if (hasBeginRendering)
+ writer.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ if (Text.Length > 0){
+ TextAlign ta = TextAlign;
+ if(ta == TextAlign.Right)
+ RenderInputTag (writer, ClientID);
+ writer.AddAttribute (HtmlTextWriterAttribute.For, ClientID);
+ writer.RenderBeginTag (HtmlTextWriterTag.Label);
+ writer.Write (Text);
+ writer.RenderEndTag ();
+ if(ta == TextAlign.Left)
+ RenderInputTag (writer, ClientID);
+ }
+ else
+ RenderInputTag (writer, ClientID);
+
+ if (hasBeginRendering)
+ writer.RenderEndTag ();
+ }
+
+ internal virtual void RenderInputTag (HtmlTextWriter writer, string clientId)
+ {
+ writer.AddAttribute (HtmlTextWriterAttribute.Id, clientId);
+ writer.AddAttribute( HtmlTextWriterAttribute.Type, "checkbox");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ if (Checked)
+ writer.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+
+ if (AutoPostBack){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick,
+ Page.GetPostBackClientEvent (this, String.Empty));
+ writer.AddAttribute ("language", "javascript");
+ }
+
+ if (AccessKey.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
+
+ if (TabIndex != 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Tabindex,
+ TabIndex.ToString (NumberFormatInfo.InvariantInfo));
+
+ writer.RenderBeginTag (HtmlTextWriterTag.Input);
+ writer.RenderEndTag ();
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
+ {
+ string postedVal = postCollection [postDataKey];
+ bool postChecked = false;
+ if(postedVal != null)
+ postChecked = postedVal.Length > 0;
+ Checked = postChecked;
+ return (postChecked == false);
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnCheckedChanged (EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
new file mode 100644
index 00000000000..7c2af02c758
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
@@ -0,0 +1,252 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CheckBoxList
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Contact: <gvaish@iitk.ac.in>
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CheckBoxList: ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
+ CheckBox checkBoxRepeater;
+ bool isChangeNotified;
+
+ public CheckBoxList()
+ {
+ checkBoxRepeater = new CheckBox();
+ checkBoxRepeater.ID = "0";
+ checkBoxRepeater.EnableViewState = false;
+ checkBoxRepeater.Controls.Add(this);
+ isChangeNotified = false;
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ return (ControlStyleCreated ? ((TableStyle)ControlStyle).CellPadding : -1);
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ return (ControlStyleCreated ? ((TableStyle)ControlStyle).CellSpacing : -1);
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o!=null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o!=null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(RepeatDirection),value))
+ throw new ArgumentException();
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o!=null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o!=null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentException();
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override Control FindControl(string id, int pathOffset)
+ {
+ return this;
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ checkBoxRepeater.AutoPostBack = AutoPostBack;
+ if(Page!=null)
+ {
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Selected)
+ {
+ checkBoxRepeater.ID = i.ToString(NumberFormatInfo.InvariantInfo);
+ Page.RegisterRequiresPostBack(checkBoxRepeater);
+ }
+ }
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RepeatInfo ri = new RepeatInfo();
+ checkBoxRepeater.TabIndex = TabIndex;
+ bool dirtyFlag = false;
+ short tTabIndex = TabIndex;
+ Style s = (ControlStyleCreated ? ControlStyle : null);
+ if(TabIndex > 0)
+ {
+ if(!ViewState.IsItemDirty("TabIndex"))
+ dirtyFlag = true;
+ TabIndex = 0;
+ }
+ ri.RepeatColumns = RepeatColumns;
+ ri.RepeatLayout = RepeatLayout;
+ ri.RepeatDirection = RepeatDirection;
+ ri.RenderRepeater(writer, this, s, this);
+ if(tTabIndex > 0)
+ {
+ TabIndex = tTabIndex;
+ }
+ if(dirtyFlag)
+ {
+ ViewState.SetItemDirty("TabIndex", false);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ int index = Int32.Parse(postDataKey.Substring(UniqueID.Length + 1));
+ if(index >= 0 && index < Items.Count)
+ {
+ bool exists = (postCollection[postDataKey]!=null);
+ if(Items[index].Selected != exists)
+ {
+ Items[index].Selected = exists;
+ if(!isChangeNotified)
+ {
+ isChangeNotified = true;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+
+ bool IRepeatInfoUser.HasFooter
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasHeader
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasSeparators
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount
+ {
+ get
+ {
+ return Items.Count;
+ }
+ }
+
+ Style IRepeatInfoUser.GetItemStyle(ListItemType itemType, int repeatIndex)
+ {
+ return null;
+ }
+
+ void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ {
+ checkBoxRepeater.ID = repeatIndex.ToString(NumberFormatInfo.InvariantInfo);
+ checkBoxRepeater.Text = Items[repeatIndex].Text;
+ checkBoxRepeater.TextAlign = TextAlign;
+ checkBoxRepeater.Checked = Items[repeatIndex].Selected;
+ checkBoxRepeater.RenderControl(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs
new file mode 100644
index 00000000000..145280eb7e3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs
@@ -0,0 +1,50 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CommandEventArgs : EventArgs
+ {
+ private string cmdName;
+ private object cmdArg;
+
+ public CommandEventArgs(CommandEventArgs e) : this(e.CommandName, e.CommandArgument)
+ {
+ }
+
+ public CommandEventArgs(string commandName, object argument)
+ {
+ cmdName = commandName;
+ cmdArg = argument;
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ return cmdName;
+ }
+ }
+
+ public object CommandArgument
+ {
+ get
+ {
+ return cmdArg;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs
new file mode 100644
index 00000000000..e806b1e952c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: CommandEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void CommandEventHandler(object sender, CommandEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
new file mode 100644
index 00000000000..c6d19b53fb1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
@@ -0,0 +1,92 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CompareValidator
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 80%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:CompareValidator runat=\"server\""
+ + "ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
+ public class CompareValidator: BaseCompareValidator
+ {
+ public CompareValidator()
+ {
+ // Intitalize();
+ }
+
+ public string ControlToCompare
+ {
+ get
+ {
+ object o = ViewState["ControlToCompare"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+
+ set
+ {
+ ViewState["ControlToCompare"] = value;
+ }
+ }
+
+ public ValidationCompareOperator Operator
+ {
+ get
+ {
+ object o = ViewState["Operator"];
+ if(o!=null)
+ return (ValidationCompareOperator)o;
+ return ValidationCompareOperator.Equal;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ValidationCompareOperator), value))
+ throw new ArgumentException();
+ ViewState["Operator"] = value;
+ }
+ }
+
+ public string ValueToCompare
+ {
+ get
+ {
+ object o = ViewState["ValueToCompare"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ValueToCompare"] = value;
+ }
+ }
+
+ protected override bool EvaluateIsValid ()
+ {
+ string ctrl = GetControlValidationValue (ControlToValidate);
+ if (ctrl == null || ctrl.Length == 0)
+ return true;
+
+ string cmp;
+ if (ControlToCompare.Length > 0) {
+ cmp = GetControlValidationValue (ControlToCompare);
+ } else {
+ cmp = ValueToCompare;
+ }
+
+ return Compare (ctrl, cmp, Operator, Type);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
new file mode 100644
index 00000000000..192cab3bcad
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
@@ -0,0 +1,113 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CustomValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("ServerValidate")]
+ [ToolboxData("<{0}:CustomValidator runat=\"server\""
+ + "ErrorMessage=\"CustomValidator\">"
+ + "</{0}:CustomValidator>")]
+ public class CustomValidator : BaseValidator
+ {
+ private static readonly object ServerValidateEvent = new object();
+
+ public CustomValidator()
+ {
+ }
+
+ public string ClientValidationFunction
+ {
+ get
+ {
+ object o = ViewState["ClientValidationFunction"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ClientValidationFunction"] = value;
+ }
+ }
+
+ public event ServerValidateEventHandler ServerValidate
+ {
+ add
+ {
+ Events.AddHandler(ServerValidateEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ServerValidateEvent, value);
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "CustomValidatorEvaluateIsValid");
+ if(ClientValidationFunction.Length > 0)
+ {
+ writer.AddAttribute("clientvalidationfunction", ClientValidationFunction);
+ }
+ }
+ }
+
+ protected override bool ControlPropertiesValid()
+ {
+ if(ControlToValidate.Length > 0)
+ {
+ CheckControlValidationProperty(ControlToValidate, "ControlToValidate");
+ }
+ return true;
+ }
+
+ protected virtual bool OnServerValidate(string value)
+ {
+ if(Events != null)
+ {
+ ServerValidateEventHandler sveh = (ServerValidateEventHandler)(Events[ServerValidateEvent]);
+ if(sveh != null)
+ {
+ ServerValidateEventArgs args = new ServerValidateEventArgs(value, true);
+ sveh(this, args);
+ return args.IsValid;
+ }
+ }
+ return true;
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = ControlToValidate;
+ if(ctrl.Length > 0)
+ {
+ ctrl = GetControlValidationValue(ctrl);
+ if(ctrl== null || ctrl.Length == 0)
+ {
+ return true;
+ }
+ }
+ return OnServerValidate(ctrl);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
new file mode 100644
index 00000000000..63e4841bb97
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
@@ -0,0 +1,1445 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGrid
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ //TODO: [Designer("??")]
+ //TODO: [Editor("??")]
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("DataSource")]
+ [ParseChildren(true)]
+ [PersistChildren(false)]
+ public class DataGrid : BaseDataList, INamingContainer
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string NextPageCommandArgument = "Next";
+ public const string PageCommandName = "Page";
+ public const string PrevPageCommandArgument = "Prev";
+ public const string SelectCommandName = "Select";
+ public const string SortCommandName = "Sort";
+ public const string UpdateCommandName = "Update";
+
+ private TableItemStyle alternatingItemStyle;
+ private TableItemStyle editItemStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle footerStyle;
+ private TableItemStyle itemStyle;
+ private TableItemStyle selectedItemStyle;
+ private DataGridPagerStyle pagerStyle;
+
+ private DataGridColumnCollection columns;
+ private ArrayList columnsArrayList;
+ private DataGridItemCollection items;
+ private ArrayList itemsArrayList;
+ private PagedDataSource pagedDataSource;
+
+ private ArrayList autoGenColsArrayList;
+ private IEnumerator storedData;
+ private object storedDataFirst;
+ private bool storedDataValid;
+
+ private static readonly object CancelCommandEvent = new object();
+ private static readonly object DeleteCommandEvent = new object();
+ private static readonly object EditCommandEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+ private static readonly object PageIndexChangedEvent = new object();
+ private static readonly object SortCommandEvent = new object();
+ private static readonly object UpdateCommandEvent = new object();
+
+ public DataGrid(): base()
+ {
+ }
+
+ public virtual bool AllowCustomPaging
+ {
+ get
+ {
+ object o = ViewState["AllowCustomPaging"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowCustomPaging"] = value;
+ }
+ }
+
+ public virtual bool AllowPaging
+ {
+ get
+ {
+ object o = ViewState["AllowPaging"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowPaging"] = value;
+ }
+ }
+
+ public virtual bool AllowSorting
+ {
+ get
+ {
+ object o = ViewState["AllowSorting"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowSorting"] = value;
+ }
+ }
+
+ public virtual TableItemStyle AlternatingItemStyle
+ {
+ get
+ {
+ if(alternatingItemStyle == null)
+ {
+ alternatingItemStyle = new TableItemStyle();
+ }
+ if(IsTrackingViewState)
+ {
+ alternatingItemStyle.TrackViewState();
+ }
+ return alternatingItemStyle;
+ }
+ }
+
+ public virtual bool AutoGenerateColumns
+ {
+ get
+ {
+ object o = ViewState["AutoGenerateColumns"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoGenerateColumns"] = value;
+ }
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ object o = ViewState["BackImageUrl"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["BackImageUrl"] = value;
+ }
+ }
+
+ public virtual DataGridColumnCollection Columns
+ {
+ get
+ {
+ if(columns == null)
+ {
+ columnsArrayList = new ArrayList();
+ columns = new DataGridColumnCollection(this, columnsArrayList);
+ if(IsTrackingViewState)
+ {
+ ((IStateManager)columns).TrackViewState();
+ }
+ }
+ return columns;
+ }
+ }
+
+ public int CurrentPageIndex
+ {
+ get
+ {
+ object o = ViewState["CurrentPageIndex"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["CurrentPageIndex"] = value;
+ }
+ }
+
+ public virtual int EditItemIndex
+ {
+ get
+ {
+ object o = ViewState["EditItemIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["EditItemIndex"] = value;
+ }
+ }
+
+ public virtual TableItemStyle EditItemStyle
+ {
+ get
+ {
+ if(editItemStyle == null)
+ {
+ editItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ editItemStyle.TrackViewState();
+ }
+ }
+ return editItemStyle;
+ }
+ }
+
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ footerStyle.TrackViewState();
+ }
+ }
+ return footerStyle;
+ }
+ }
+
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ headerStyle.TrackViewState();
+ }
+ }
+ return headerStyle;
+ }
+ }
+
+ public virtual DataGridItemCollection Items
+ {
+ get
+ {
+ if(items == null)
+ {
+ if(itemsArrayList == null)
+ EnsureChildControls();
+ if(itemsArrayList == null)
+ {
+ itemsArrayList = new ArrayList();
+ }
+ items = new DataGridItemCollection(itemsArrayList);
+ }
+ return items;
+ }
+ }
+
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+ return itemStyle;
+ }
+ }
+
+ public int PageCount
+ {
+ get
+ {
+ if(pagedDataSource != null)
+ {
+ return pagedDataSource.PageCount;
+ }
+ object o = ViewState["PageCount"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ }
+
+ public virtual DataGridPagerStyle PagerStyle
+ {
+ get
+ {
+ if(pagerStyle == null)
+ {
+ pagerStyle = new DataGridPagerStyle(this);
+ if(IsTrackingViewState)
+ {
+ pagerStyle.TrackViewState();
+ }
+ }
+ return pagerStyle;
+ }
+ }
+
+ public virtual int PageSize
+ {
+ get
+ {
+ object o = ViewState["PageSize"];
+ if(o != null)
+ return (int)o;
+ return 10;
+ }
+ set
+ {
+ if(value < 1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["PageSize"] = value;
+ }
+ }
+
+ public virtual int SelectedIndex
+ {
+ get
+ {
+ object o = ViewState["SelectedIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException();
+ int prevVal = SelectedIndex;
+ ViewState["SelectedIndex"] = value;
+ if(items != null)
+ {
+ if(prevVal !=-1 && prevVal < items.Count)
+ {
+ DataGridItem prev = (DataGridItem)items[prevVal];
+ if(prev.ItemType != ListItemType.EditItem)
+ {
+ ListItemType newType = ListItemType.Item;
+ if( (prevVal % 2) != 0)
+ {
+ newType = ListItemType.AlternatingItem;
+ }
+ prev.SetItemType(newType);
+ }
+ }
+ }
+ }
+ }
+
+ public virtual DataGridItem SelectedItem
+ {
+ get
+ {
+ if(SelectedIndex == -1)
+ return null;
+ return Items[SelectedIndex];
+ }
+ }
+
+ public virtual TableItemStyle SelectedItemStyle
+ {
+ get
+ {
+ if(selectedItemStyle == null)
+ {
+ selectedItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ selectedItemStyle.TrackViewState();
+ }
+ }
+ return selectedItemStyle;
+ }
+ }
+
+ public virtual bool ShowFooter
+ {
+ get
+ {
+ object o = ViewState["ShowFooter"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowFooter"] = value;
+ }
+ }
+
+ public virtual bool ShowHeader
+ {
+ get
+ {
+ object o = ViewState["ShowHeader"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowHeader"] = value;
+ }
+ }
+
+ public virtual int VirtualItemCount
+ {
+ get
+ {
+ object o = ViewState["VirtualItemCount"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["VirtualItemCount"] = value;
+ }
+ }
+
+ public event DataGridCommandEventHandler CancelCommand
+ {
+ add
+ {
+ Events.AddHandler(CancelCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CancelCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler DeleteCommand
+ {
+ add
+ {
+ Events.AddHandler(DeleteCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DeleteCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler EditCommand
+ {
+ add
+ {
+ Events.AddHandler(EditCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(EditCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler PageIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(PageIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(PageIndexChangedEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler SortCommand
+ {
+ add
+ {
+ Events.AddHandler(SortCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SortCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler UpdateCommand
+ {
+ add
+ {
+ Events.AddHandler(UpdateCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UpdateCommandEvent, value);
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ TableStyle style = new TableStyle(ViewState);
+ style.GridLines = GridLines.Both;
+ style.CellSpacing = 0;
+ return style;
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ object[] states = (object[])savedState;
+ if(states != null)
+ {
+ base.LoadViewState(states[0]);
+ if(columns != null)
+ ((IStateManager)columns).LoadViewState(states[1]);
+ if(pagerStyle != null)
+ pagerStyle.LoadViewState(states[2]);
+ if(headerStyle != null)
+ headerStyle.LoadViewState(states[3]);
+ if(footerStyle != null)
+ footerStyle.LoadViewState(states[4]);
+ if(itemStyle != null)
+ itemStyle.LoadViewState(states[5]);
+ if(alternatingItemStyle != null)
+ alternatingItemStyle.LoadViewState(states[6]);
+ if(selectedItemStyle != null)
+ selectedItemStyle.LoadViewState(states[7]);
+ if(editItemStyle != null)
+ editItemStyle.LoadViewState(states[8]);
+ }
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object[9];
+ states[0] = SaveViewState();
+ states[1] = (columns == null ? null : ((IStateManager)columns).SaveViewState());
+ states[2] = (pagerStyle == null ? null : pagerStyle.SaveViewState());
+ states[3] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[4] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[5] = (itemStyle == null ? null : itemStyle.SaveViewState());
+ states[6] = (alternatingItemStyle == null ? null : alternatingItemStyle.SaveViewState());
+ states[7] = (selectedItemStyle == null ? null : selectedItemStyle.SaveViewState());
+ states[8] = (editItemStyle == null ? null : editItemStyle.SaveViewState());
+ return states;
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if(alternatingItemStyle != null)
+ {
+ alternatingItemStyle.TrackViewState();
+ }
+ if(editItemStyle != null)
+ {
+ editItemStyle.TrackViewState();
+ }
+ if(headerStyle != null)
+ {
+ headerStyle.TrackViewState();
+ }
+ if(footerStyle != null)
+ {
+ footerStyle.TrackViewState();
+ }
+ if(itemStyle != null)
+ {
+ itemStyle.TrackViewState();
+ }
+ if(selectedItemStyle != null)
+ {
+ selectedItemStyle.TrackViewState();
+ }
+ if(pagerStyle != null)
+ {
+ pagerStyle.TrackViewState();
+ }
+
+ if(columns != null)
+ {
+ ((IStateManager)columns).TrackViewState();
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ bool retVal = false;
+ if(e is DataGridCommandEventArgs)
+ {
+ DataGridCommandEventArgs ea = (DataGridCommandEventArgs)e;
+ retVal = true;
+ OnItemCommand(ea);
+ string cmd = ea.CommandName;
+ if(String.Compare(cmd, "select", true) == 0)
+ {
+ SelectedIndex = ea.Item.ItemIndex;
+ OnSelectedIndexChanged(EventArgs.Empty);
+ } else if(String.Compare(cmd,"page", true) == 0)
+ {
+ int cIndex = CurrentPageIndex;
+ string cea = (string) ea.CommandArgument;
+ if(String.Compare(cea, "prev", true) == 0)
+ {
+ cIndex--;
+ } else if(String.Compare(cea, "next", true) == 0)
+ {
+ cIndex++;
+ }
+ OnPageIndexChanged(new DataGridPageChangedEventArgs(source, cIndex));
+ } else if(String.Compare(cmd, "sort", true) == 0)
+ {
+ OnSortCommand(new DataGridSortCommandEventArgs(source, ea));
+ } else if(String.Compare(cmd, "edit", true) == 0)
+ {
+ OnEditCommand(ea);
+ } else if(String.Compare(cmd, "update", true) == 0)
+ {
+ OnUpdateCommand(ea);
+ } else if(String.Compare(cmd, "cancel", true) == 0)
+ {
+ OnCancelCommand(ea);
+ } else if(String.Compare(cmd, "delete", true) == 0)
+ {
+ OnDeleteCommand(ea);
+ }
+ }
+ return retVal;
+ }
+
+ protected virtual void OnCancelCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[CancelCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnDeleteCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[DeleteCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnEditCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[EditCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[ItemCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCreated(DataGridItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridItemEventHandler dceh = (DataGridItemEventHandler)(Events[ItemCreatedEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemDataBound(DataGridItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridItemEventHandler dceh = (DataGridItemEventHandler)(Events[ItemDataBoundEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnPageIndexChanged(DataGridPageChangedEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridPageChangedEventHandler dceh = (DataGridPageChangedEventHandler)(Events[PageIndexChangedEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnSortCommand(DataGridSortCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridSortCommandEventHandler dceh = (DataGridSortCommandEventHandler)(Events[SortCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnUpdateCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[UpdateCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected override void PrepareControlHierarchy()
+ {
+ if(Controls.Count > 0)
+ {
+ Table display = (Table)Controls[0];
+ display.CopyBaseAttributes(this);
+ if(ControlStyleCreated)
+ {
+ display.ApplyStyle(ControlStyle);
+ } else
+ {
+ display.GridLines = GridLines.Both;
+ display.CellSpacing = 0;
+ }
+ TableRowCollection rows = display.Rows;
+ if(rows.Count > 0)
+ {
+ int nCols = Columns.Count;
+ DataGridColumn[] cols = new DataGridColumn[nCols];
+ Style deployStyle;
+ int counter;
+ if(nCols > 0)
+ {
+ Columns.CopyTo(cols, 0);
+ }
+ deployStyle = null;
+ if(alternatingItemStyle != null)
+ {
+ deployStyle = new TableItemStyle();
+ deployStyle.CopyFrom(itemStyle);
+ deployStyle.CopyFrom(alternatingItemStyle);
+ } else
+ {
+ deployStyle = itemStyle;
+ }
+ for(counter = 0; counter < rows.Count; counter++)
+ {
+ PrepareControlHierarchyForItem(cols, (DataGridItem) rows[counter], counter, deployStyle);
+ }
+ }
+ }
+ }
+
+ private void PrepareControlHierarchyForItem(DataGridColumn[] cols, DataGridItem item, int index, Style deployStyle)
+ {
+ switch(item.ItemType)
+ {
+ case ListItemType.Header: if(!ShowHeader)
+ {
+ item.Visible = false;
+ break;
+ }
+ if(headerStyle != null)
+ {
+ item.MergeStyle(headerStyle);
+ }
+ goto case ListItemType.Separator;
+ case ListItemType.Footer: if(!ShowFooter)
+ {
+ item.Visible = false;
+ break;
+ }
+ if(footerStyle != null)
+ {
+ item.MergeStyle(footerStyle);
+ }
+ goto case ListItemType.Separator;
+ case ListItemType.Item : item.MergeStyle(itemStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.AlternatingItem:
+ item.MergeStyle(deployStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.SelectedItem:
+ Style selStyle = new TableItemStyle();
+ if( (item.ItemIndex % 2) == 0)
+ {
+ selStyle.CopyFrom(itemStyle);
+ } else
+ {
+ selStyle.CopyFrom(deployStyle);
+ }
+ selStyle.CopyFrom(selectedItemStyle);
+ item.MergeStyle(selStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.EditItem:
+ Style edStyle = new TableItemStyle();
+ if( (item.ItemIndex % 2) == 0)
+ {
+ edStyle.CopyFrom(itemStyle);
+ } else
+ {
+ edStyle.CopyFrom(deployStyle);
+ }
+ edStyle.CopyFrom(editItemStyle);
+ item.MergeStyle(edStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.Pager : if(pagerStyle == null)
+ {
+ break;
+ }
+ if(!pagerStyle.Visible)
+ {
+ item.Visible = false;
+ }
+ if(index == 0)
+ {
+ if(!pagerStyle.IsPagerOnTop)
+ {
+ item.Visible = false;
+ break;
+ }
+ } else
+ {
+ if(!pagerStyle.IsPagerOnBottom)
+ {
+ item.Visible = false;
+ break;
+ }
+ }
+ item.MergeStyle(pagerStyle);
+ goto case ListItemType.Separator;
+ case ListItemType.Separator:
+ TableCellCollection cells = item.Cells;
+ int cellCount = cells.Count;
+ if(cellCount > 0 && item.ItemType != ListItemType.Pager)
+ {
+ for(int i = 0; i < cellCount; i++)
+ {
+ Style colStyle = null;
+ if(cols[i].Visible)
+ {
+ switch (item.ItemType)
+ {
+ case ListItemType.Header : colStyle = cols[i].HeaderStyleInternal;
+ break;
+ case ListItemType.Footer : colStyle = cols[i].FooterStyleInternal;
+ break;
+ default : colStyle = cols[i].ItemStyleInternal;
+ break;
+ }
+ item.MergeStyle(colStyle);
+ } else
+ {
+ cells[i].Visible = false;
+ }
+ }
+ }
+ break;
+ default : goto case ListItemType.Separator;
+ }
+ }
+
+ protected override void CreateControlHierarchy(bool useDataSource)
+ {
+ IEnumerator pageSourceEnumerator;
+ int itemCount;
+ ArrayList dataKeys;
+ ArrayList columns;
+ IEnumerable resolvedDS;
+ ICollection collResolvedDS;
+ int pageDSCount;
+ int colCount;
+ DataGridColumn[] cols;
+ Table deployTable;
+ TableRowCollection deployRows;
+ ListItemType deployType;
+ int indexCounter;
+ string dkField;
+ bool dsUse;
+ bool pgEnabled;
+ int editIndex;
+ int selIndex;
+
+ pagedDataSource = CreatePagedDataSource();
+ pageSourceEnumerator = null;
+ itemCount = -1;
+ dataKeys = DataKeysArray;
+ columns = null;
+ if(itemsArrayList != null)
+ {
+ itemsArrayList.Clear();
+ } else
+ {
+ itemsArrayList = new ArrayList();
+ }
+ if(!useDataSource)
+ {
+ itemCount = (int) ViewState["_!ItemCount"];
+ pageDSCount = (int) ViewState["_!DataSource_ItemCount"];
+ if(itemCount != -1)
+ {
+ if(pagedDataSource.IsCustomPagingEnabled)
+ {
+ pagedDataSource.DataSource = new DataSourceInternal(itemCount);
+ } else
+ {
+ pagedDataSource.DataSource = new DataSourceInternal(pageDSCount);
+ }
+ pageSourceEnumerator = pagedDataSource.GetEnumerator();
+ columns = CreateColumnSet(null, false);
+ itemsArrayList.Capacity = itemCount;
+ }
+ } else
+ {
+ dataKeys.Clear();
+ resolvedDS = DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
+ if(resolvedDS != null)
+ {
+ collResolvedDS = resolvedDS as ICollection;
+ if(pagedDataSource.IsPagingEnabled && !pagedDataSource.IsCustomPagingEnabled
+ && collResolvedDS == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("DataGrid_Missing_VirtualItemCount", ID));
+ }
+ pagedDataSource.DataSource = resolvedDS;
+ if(pagedDataSource.IsPagingEnabled && (pagedDataSource.CurrentPageIndex < 0 ||
+ pagedDataSource.CurrentPageIndex >= pagedDataSource.PageCount))
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("DataGrid_Invalid_Current_PageIndex", ID));
+ }
+ columns = CreateColumnSet(pagedDataSource, useDataSource);
+ if(storedDataValid)
+ {
+ pageSourceEnumerator = storedData;
+ } else
+ {
+ pageSourceEnumerator = pagedDataSource.GetEnumerator();
+ }
+ if(collResolvedDS != null)
+ {
+ pageDSCount = pagedDataSource.Count;
+ dataKeys.Capacity = pageDSCount;
+ itemsArrayList.Capacity = pageDSCount;
+ }
+ }
+ colCount = 0;
+ if(columns != null)
+ colCount = columns.Count;
+ int currentSourceIndex;
+ if(colCount > 0)
+ {
+ cols = (DataGridColumn []) columns.ToArray (typeof (DataGridColumn));
+ foreach(DataGridColumn current in cols)
+ {
+ current.Initialize();
+ }
+ deployTable = new DataGridTableInternal();
+ Controls.Add(deployTable);
+ deployRows = deployTable.Rows;
+
+ indexCounter = 0;
+ currentSourceIndex = 0;
+ dkField = DataKeyField;
+
+ dsUse = (useDataSource) ? (dkField.Length > 0) : false;
+ pgEnabled = pagedDataSource.IsPagingEnabled;
+ editIndex = EditItemIndex;
+ selIndex = SelectedIndex;
+ if(pgEnabled)
+ {
+ currentSourceIndex = pagedDataSource.FirstIndexInPage;
+ CreateItem(-1, -1, ListItemType.Pager, false, null,
+ cols, deployRows, pagedDataSource);
+ }
+ itemCount = 0;
+ CreateItem(-1, -1, ListItemType.Header, useDataSource, null,
+ cols, deployRows, null);
+
+ if(storedDataValid && storedDataFirst != null)
+ {
+ if(dsUse)
+ {
+ dataKeys.Add(DataBinder.GetPropertyValue(storedDataFirst, dkField));
+ }
+ deployType = ListItemType.Item;
+ if(indexCounter == editIndex)
+ {
+ deployType = ListItemType.EditItem;
+ } else if(indexCounter == selIndex)
+ {
+ deployType = ListItemType.SelectedItem;
+ }
+ itemsArrayList.Add(CreateItem(0, currentSourceIndex, deployType,
+ useDataSource, storedDataFirst,
+ cols, deployRows, null));
+ itemCount++;
+ indexCounter++;
+ currentSourceIndex++;
+ storedDataValid = false;
+ storedDataFirst = null;
+ }
+
+ while(pageSourceEnumerator.MoveNext())
+ {
+ object current = pageSourceEnumerator.Current;
+ if(dsUse)
+ {
+ dataKeys.Add(DataBinder.GetPropertyValue(current, dkField));
+ }
+ deployType = ListItemType.Item;
+ if(indexCounter == editIndex)
+ {
+ deployType = ListItemType.EditItem;
+ } else if(indexCounter == selIndex)
+ {
+ deployType = ListItemType.SelectedItem;
+ }
+ itemsArrayList.Add(CreateItem(indexCounter, currentSourceIndex,
+ deployType, useDataSource, current,
+ cols, deployRows, null));
+ itemCount++;
+ indexCounter++;
+ currentSourceIndex++;
+ }
+
+ CreateItem(-1, -1, ListItemType.Footer, useDataSource, null,
+ cols, deployRows, null);
+
+ if(pgEnabled)
+ {
+ CreateItem(-1, -1, ListItemType.Pager, false, null, cols, deployRows,
+ pagedDataSource);
+ }
+ }
+
+ if(useDataSource)
+ {
+ if(pageSourceEnumerator != null)
+ {
+ ViewState["_!ItemCount"] = itemCount;
+ if(pagedDataSource.IsPagingEnabled)
+ {
+ ViewState["PageCount"] = pagedDataSource.PageCount;
+ ViewState["_!DataSource_ItemCount"] = pagedDataSource.DataSourceCount;
+ } else
+ {
+ ViewState["PageCount"] = 1;
+ ViewState["_!DataSource_ItemCount"] = itemCount;
+ }
+ } else
+ {
+ ViewState["_!ItemCount"] = -1;
+ ViewState["_!DataSource_ItemCount"] = -1;
+ ViewState["PageCount"] = 0;
+ }
+ }
+ }
+ pagedDataSource = null;
+ }
+
+ private DataGridItem CreateItem(int itemIndex, int dsIndex, ListItemType type,
+ bool bind, object item, DataGridColumn[] columns,
+ TableRowCollection rows, PagedDataSource dataSrc)
+
+ {
+ DataGridItem retVal;
+ DataGridItemEventArgs args;
+
+ retVal = CreateItem(itemIndex, dsIndex, type);
+ args = new DataGridItemEventArgs(retVal);
+
+ if(type != ListItemType.Pager)
+ {
+ InitializeItem(retVal, columns);
+ if(bind)
+ {
+ retVal.DataItem = item;
+ }
+ OnItemCreated(args);
+ rows.Add(retVal);
+ if(bind)
+ {
+ retVal.DataBind();
+ OnItemDataBound(args);
+ retVal.DataItem = null;
+ }
+ } else
+ {
+ InitializePager(retVal, columns.Length, dataSrc);
+ OnItemCreated(args);
+ rows.Add(retVal);
+ }
+ return retVal;
+ }
+
+ protected virtual DataGridItem CreateItem(int itemIndex, int dataSourceIndex, ListItemType itemType)
+ {
+ return new DataGridItem(itemIndex, dataSourceIndex, itemType);
+ }
+
+ protected virtual void InitializeItem(DataGridItem item, DataGridColumn[] columns)
+ {
+ TableCellCollection cells = item.Cells;
+ TableCell cCell;
+
+ for(int i = 0; i < columns.Length; i++)
+ {
+ cCell = new TableCell();
+ columns[i].InitializeCell(cCell, i, item.ItemType);
+ cells.Add(cCell);
+ }
+ }
+
+ protected virtual void InitializePager(DataGridItem item,
+ int columnSpan, PagedDataSource pagedDataSource)
+ {
+ TableCell toAdd = new TableCell();
+ toAdd.ColumnSpan = columnSpan;
+
+ if(PagerStyle.Mode == PagerMode.NextPrev)
+ {
+ if(!pagedDataSource.IsFirstPage)
+ {
+ LinkButton link = new DataGridLinkButton();
+ link.Text = PagerStyle.PrevPageText;
+ link.CommandName = "Page";
+ link.CommandArgument = "Prev";
+ link.CausesValidation = false;
+ toAdd.Controls.Add(link);
+ } else
+ {
+ Label label = new Label();
+ label.Text = PagerStyle.PrevPageText;
+ toAdd.Controls.Add(label);
+ }
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ if(!pagedDataSource.IsLastPage)
+ {
+ LinkButton link = new DataGridLinkButton();
+ link.Text = PagerStyle.NextPageText;
+ link.CommandName = "Page";
+ link.CommandArgument = "Next";
+ link.CausesValidation = false;
+ toAdd.Controls.Add(link);
+ } else
+ {
+ Label label = new Label();
+ label.Text = PagerStyle.NextPageText;
+ toAdd.Controls.Add(label);
+ }
+ } else
+ {
+ int pageCount = pagedDataSource.PageCount;
+ int currPage = pagedDataSource.CurrentPageIndex + 1;
+ int btnCount = PagerStyle.PageButtonCount;
+ int numberOfPages = btnCount;
+ if(numberOfPages > pageCount)
+ numberOfPages = pageCount;
+ int firstPageNumber = 1; // 10
+ int lastPageNumber = numberOfPages; // 11
+ if(currPage > lastPageNumber)
+ {
+ firstPageNumber = (pagedDataSource.CurrentPageIndex / btnCount) * btnCount + 1;
+ lastPageNumber = firstPageNumber + btnCount - 1;
+ if(lastPageNumber > pageCount)
+ lastPageNumber = pageCount;
+ if((lastPageNumber - firstPageNumber + 1) < btnCount)
+ firstPageNumber = Math.Max(1, lastPageNumber - btnCount + 1);
+ }
+ if(firstPageNumber != 1)
+ {
+ LinkButton toAddBtn = new DataGridLinkButton();
+ toAddBtn.Text = "...";
+ toAddBtn.CommandName = "Page";
+ toAddBtn.CommandArgument = (lastPageNumber - 1).ToString(NumberFormatInfo.InvariantInfo);
+ toAddBtn.CausesValidation = false;
+ toAdd.Controls.Add(toAddBtn);
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ }
+ for(int i = firstPageNumber; i <= lastPageNumber; i++)
+ {
+ string argText = i.ToString(NumberFormatInfo.InvariantInfo);
+ if(i == currPage)
+ {
+ Label cPageLabel = new Label();
+ cPageLabel.Text = argText;
+ toAdd.Controls.Add(cPageLabel);
+ } else
+ {
+ LinkButton indexButton = new DataGridLinkButton();
+ indexButton.Text = argText;
+ indexButton.CommandName = "Page";
+ indexButton.CommandArgument = argText;
+ indexButton.CausesValidation = false;
+ toAdd.Controls.Add(indexButton);
+ }
+ if(i < lastPageNumber)
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ }
+ if(pageCount > lastPageNumber)
+ {
+ toAdd.Controls.Add(new LiteralControl("&nbsp;"));
+ LinkButton contLink = new DataGridLinkButton();
+ contLink.Text = "...";
+ contLink.CommandName = "Page";
+ contLink.CommandArgument = (lastPageNumber + 1).ToString(NumberFormatInfo.InvariantInfo);
+ contLink.CausesValidation = false;
+ toAdd.Controls.Add(contLink);
+ }
+ }
+ item.Cells.Add(toAdd);
+ }
+
+ private PagedDataSource CreatePagedDataSource()
+ {
+ PagedDataSource retVal;
+
+ retVal = new PagedDataSource();
+ retVal.CurrentPageIndex = CurrentPageIndex;
+ retVal.PageSize = PageSize;
+ retVal.AllowPaging = AllowPaging;
+ retVal.AllowCustomPaging = AllowCustomPaging;
+ retVal.VirtualCount = VirtualItemCount;
+
+ return retVal;
+ }
+
+ ///<summary>
+ /// UnDocumented method
+ /// </summary>
+ protected ArrayList CreateColumnSet(PagedDataSource source, bool useDataSource)
+ {
+ DataGridColumn[] cols = new DataGridColumn[Columns.Count];
+ Columns.CopyTo(cols, 0);
+ ArrayList l_columns = new ArrayList();
+ ArrayList auto_columns = null;
+
+ foreach(DataGridColumn current in cols)
+ {
+ l_columns.Add(current);
+ }
+ if(AutoGenerateColumns)
+ {
+ l_columns = null;
+ if(useDataSource)
+ {
+ auto_columns = AutoCreateColumns(source);
+ autoGenColsArrayList = auto_columns;
+ } else
+ {
+ auto_columns = autoGenColsArrayList;
+ }
+ if(auto_columns != null)
+ {
+ foreach(object current in auto_columns)
+ {
+ l_columns.Add(current);
+ }
+ }
+ }
+ return l_columns;
+ }
+
+ /// <summary>
+ /// Generates the columns when AutoGenerateColumns is true.
+ /// This method is called by CreateColumnSet when dataSource
+ /// is to be used and columns need to be generated automatically.
+ /// </summary>
+ private ArrayList AutoCreateColumns(PagedDataSource source)
+ {
+ if(source != null)
+ {
+ ArrayList retVal = new ArrayList();
+ PropertyDescriptorCollection props = source.GetItemProperties(new PropertyDescriptor[0]);
+ Type prop_type;
+ BoundColumn b_col;
+ if(props == null)
+ {
+ prop_type = null;
+ PropertyInfo prop_item = source.DataSource.GetType().GetProperty("Item",
+ BindingFlags.Instance | BindingFlags.Static |
+ BindingFlags.Public, null, null,
+ new Type[] { typeof(int) }, null);
+ if(prop_item != null)
+ {
+ prop_type = prop_item.GetType();
+ }
+ if(prop_type != null && prop_type == typeof(object))
+ {
+ object fitem = null;
+ IEnumerator en = source.GetEnumerator();
+ if(en.MoveNext())
+ fitem = en.Current;
+ if(fitem != null)
+ {
+ prop_type = fitem.GetType();
+ }
+ StoreEnumerator(en, fitem);
+ if(fitem != null && fitem is ICustomTypeDescriptor)
+ {
+ props = TypeDescriptor.GetProperties(fitem);
+ } else if(prop_type != null)
+ {
+ if(IsBindableType(prop_type))
+ {
+ b_col = new BoundColumn();
+ // b_col.TrackViewState();
+ b_col.HeaderText = "Item";
+ b_col.SortExpression = "Item";
+ b_col.DataField = BoundColumn.thisExpr;
+ //b_col.SetOwner(this);
+ retVal.Add(b_col);
+ } else
+ {
+ props = TypeDescriptor.GetProperties(prop_type);
+ }
+ }
+ }
+ }
+ if(props != null && props.Count > 0)
+ {
+ //IEnumerable p_en = props.GetEnumerator();
+ try
+ {
+ foreach(PropertyDescriptor current in props)
+ {
+ if(IsBindableType(current.PropertyType))
+ {
+ b_col = new BoundColumn();
+ // b_col.TrackViewState();
+ b_col.HeaderText = current.Name;
+ b_col.SortExpression = current.Name;
+ b_col.DataField = current.Name;
+ // b_col.IsReadOnly = current.IsReadOnly;
+ // b_col.SetOwner(this);
+ retVal.Add(b_col);
+ }
+ }
+ } finally
+ {
+ if(props is IDisposable)
+ ((IDisposable)props).Dispose();
+ }
+ }
+ if(retVal.Count > 0)
+ {
+ return retVal;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("DataGrid_NoAutoGenColumns", ID));
+ }
+ return null;
+ }
+
+ internal void StoreEnumerator(IEnumerator source, object firstItem)
+ {
+ storedData = source;
+ storedDataFirst = firstItem;
+ storedDataValid = true;
+ }
+
+ internal void OnColumnsChanged()
+ {
+ }
+
+ internal void OnPagerChanged()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
new file mode 100644
index 00000000000..8c210eac4ad
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
@@ -0,0 +1,408 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public abstract class DataGridColumn : IStateManager
+ {
+ private StateBag viewState;
+ private bool marked;
+ private TableItemStyle footerStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle itemStyle;
+
+ private DataGrid owner;
+ private bool designMode;
+
+ public DataGridColumn()
+ {
+ viewState = new StateBag();
+ }
+
+ internal TableItemStyle FooterStyleInternal
+ {
+ get
+ {
+ return footerStyle;
+ }
+ }
+
+ internal TableItemStyle HeaderStyleInternal
+ {
+ get
+ {
+ return headerStyle;
+ }
+ }
+
+ internal TableItemStyle ItemStyleInternal
+ {
+ get
+ {
+ return itemStyle;
+ }
+ }
+
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ footerStyle.TrackViewState();
+ }
+ }
+ return footerStyle;
+ }
+ }
+
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle= new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ headerStyle.TrackViewState();
+ }
+ }
+ return headerStyle;
+ }
+ }
+
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+ return itemStyle;
+ }
+ }
+
+ public virtual string FooterText
+ {
+ get
+ {
+ object o = ViewState["FooterText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["FooterText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string HeaderImageUrl
+ {
+ get
+ {
+ object o = ViewState["HeaderImageUrl"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderImageUrl"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string HeaderText
+ {
+ get
+ {
+ object o = ViewState["HeaderText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string SortExpression
+ {
+ get
+ {
+ object o = ViewState["SortExpression"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["SortExpression"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ object o = ViewState["Visible"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["Visible"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual void Initialize()
+ {
+ if(owner != null && owner.Site != null)
+ {
+ designMode = owner.Site.DesignMode;
+ }
+ }
+
+ public virtual void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ switch(itemType)
+ {
+ case ListItemType.Header : InitializeCellHeader(cell, columnIndex);
+ break;
+ case ListItemType.Footer : InitializeCellFooter(cell, columnIndex);
+ break;
+ default : return;
+ }
+ }
+
+ private void InitializeCellHeader(TableCell cell, int columnIndex)
+ {
+ WebControl ctrl = null;
+ bool sort = true;
+ string sortExpr = "";
+ ImageButton headButton;
+ Image headImage;
+ LinkButtonInternal link;
+
+ if(owner != null)
+ {
+ sort = owner.AllowSorting;
+ }
+ if(sort)
+ {
+ sortExpr = SortExpression;
+ if(sortExpr.Length == 0)
+ {
+ sort = false;
+ }
+ }
+ if(HeaderImageUrl.Length > 0)
+ {
+ if(sort)
+ {
+ headButton = new ImageButton();
+ headButton.ImageUrl = HeaderImageUrl;
+ headButton.CommandName = "Sort";
+ headButton.CommandArgument = sortExpr;
+ headButton.CausesValidation = false;
+ ctrl = headButton;
+ } else
+ {
+ headImage = new Image();
+ headImage.ImageUrl = HeaderImageUrl;
+ ctrl = headImage;
+ }
+ } else
+ {
+ if(sort)
+ {
+ link = new LinkButtonInternal();
+ link.Text = HeaderText;
+ link.CommandName = "Sort";
+ link.CommandArgument = sortExpr;
+ link.CausesValidation = false;
+ ctrl = link;
+ } else
+ {
+ if(HeaderText.Length > 0)
+ {
+ cell.Text = HeaderText;
+ } else
+ {
+ cell.Text = "&nbsp;";
+ }
+ }
+ }
+ if(ctrl != null)
+ {
+ cell.Controls.Add(ctrl);
+ }
+ }
+
+ private void InitializeCellFooter(TableCell cell, int columnIndex)
+ {
+ cell.Text = (FooterText.Length > 0 ? FooterText : "&nbsp;");
+ }
+
+ public override string ToString()
+ {
+ return String.Empty;
+ }
+
+ protected bool DesignMode
+ {
+ get
+ {
+ return designMode;
+ }
+ }
+
+ protected DataGrid Owner
+ {
+ get
+ {
+ return owner;
+ }
+ }
+
+ protected StateBag ViewState
+ {
+ get
+ {
+ return viewState;
+ }
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected virtual void OnColumnChanged()
+ {
+ if(owner != null)
+ {
+ owner.OnColumnsChanged();
+ }
+ }
+
+ internal void SetOwner (DataGrid datagrid)
+ {
+ owner = datagrid;
+ }
+
+ protected virtual object SaveViewState()
+ {
+ object[] states = new object[4];
+ states[0] = ViewState.SaveViewState();
+ states[1] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[2] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[3] = (itemStyle == null ? null : itemStyle.SaveViewState());
+ return states;
+ }
+
+ protected virtual void LoadViewState(object savedState)
+ {
+ if(savedState!= null)
+ {
+ object[] states = (object[]) savedState;
+ if(states != null)
+ {
+ ViewState.LoadViewState(states[0]);
+ FooterStyle.LoadViewState(states[1]);
+ HeaderStyle.LoadViewState(states[2]);
+ ItemStyle.LoadViewState(states[3]);
+ }
+ }
+ }
+
+ protected virtual void TrackViewState()
+ {
+ marked = true;
+ ViewState.TrackViewState();
+ if(footerStyle != null)
+ {
+ footerStyle.TrackViewState();
+ }
+ if(headerStyle != null)
+ {
+ headerStyle.TrackViewState();
+ }
+ if(itemStyle != null)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+
+ protected bool IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ LoadViewState(savedState);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
new file mode 100644
index 00000000000..3e27ed35764
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
@@ -0,0 +1,186 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridColumnCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridColumnCollection : ICollection, IEnumerable, IStateManager
+ {
+ private DataGrid owner;
+ private ArrayList columns;
+ private bool trackViewState = false;
+
+ public DataGridColumnCollection(DataGrid owner, ArrayList columns)
+ {
+ this.owner = owner;
+ this.columns = columns;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return columns.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataGridColumn this[int index]
+ {
+ get
+ {
+ return (DataGridColumn)(columns[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(DataGridColumn column)
+ {
+ AddAt(-1, column);
+ }
+
+ public void AddAt(int index, DataGridColumn column)
+ {
+ if(index == -1)
+ {
+ columns.Add(column);
+ } else
+ {
+ columns.Insert(index, column);
+ }
+
+ column.SetOwner (owner);
+ if(trackViewState)
+ {
+ ((IStateManager)column).TrackViewState();
+ }
+ OnColumnsChanged();
+ }
+
+ internal void OnColumnsChanged()
+ {
+ if(owner != null)
+ {
+ owner.OnColumnsChanged();
+ }
+ }
+
+ public void Clear()
+ {
+ columns.Clear();
+ OnColumnsChanged();
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataGridColumn current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return columns.GetEnumerator();
+ }
+
+ public int IndexOf(DataGridColumn column)
+ {
+ if(column != null)
+ {
+ return columns.IndexOf(column);
+ }
+ return -1;
+ }
+
+ public void Remove(DataGridColumn column)
+ {
+ if(column != null)
+ {
+ RemoveAt(IndexOf(column));
+ }
+ }
+
+ public void RemoveAt(int index)
+ {
+ if(index >= 0 && index < columns.Count)
+ {
+ columns.RemoveAt(index);
+ OnColumnsChanged();
+ }
+ //This exception is not documented, but thrown
+ throw new ArgumentOutOfRangeException("string");
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ ArrayList retVal = new ArrayList(columns.Count);
+ foreach(DataGridColumn current in this)
+ {
+ retVal.Add(((IStateManager)current).SaveViewState());
+ }
+ return retVal;
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ if(savedState != null && savedState is ArrayList)
+ {
+ int currentIndex = 0;
+ foreach(DataGridColumn current in (ArrayList)savedState)
+ {
+ ((IStateManager)columns[currentIndex ++]).LoadViewState(current);
+ }
+ }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ trackViewState = true;
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return trackViewState;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs
new file mode 100644
index 00000000000..e5850371123
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs
@@ -0,0 +1,46 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: DataGridCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridCommandEventArgs : CommandEventArgs
+ {
+ DataGridItem dgItem;
+ object cmdSrc;
+
+ public DataGridCommandEventArgs(DataGridItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ dgItem = item;
+ cmdSrc = originalArgs;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public DataGridItem Item
+ {
+ get
+ {
+ return dgItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs
new file mode 100644
index 00000000000..bd06eed39f4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DataGridCommandEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridCommandEventHandler(object sender, DataGridCommandEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs
new file mode 100644
index 00000000000..5833b0f5b3b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs
@@ -0,0 +1,86 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItem
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItem : TableRow, INamingContainer
+ {
+ private int itemIndex;
+ private int dataSetIndex;
+ private ListItemType itemType;
+ private object dataItem;
+
+ public DataGridItem(int itemIndex, int dataSetIndex, ListItemType itemType): base()
+ {
+ this.itemIndex = itemIndex;
+ this.dataSetIndex = dataSetIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int DataSetIndex
+ {
+ get
+ {
+ return dataSetIndex;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ DataGridCommandEventArgs args = new DataGridCommandEventArgs(this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent(this, args);
+ return true;
+ }
+ return false;
+ }
+
+ protected internal virtual void SetItemType(ListItemType itemType)
+ {
+ this.itemType = itemType;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs
new file mode 100644
index 00000000000..8f73b541336
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public DataGridItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataGridItem this[int index]
+ {
+ get
+ {
+ return (DataGridItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataGridItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs
new file mode 100644
index 00000000000..4418b4cf00a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItemEventArgs : EventArgs
+ {
+ DataGridItem item;
+
+ public DataGridItemEventArgs(DataGridItem item)
+ {
+ this.item = item;
+ }
+
+ public DataGridItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs
new file mode 100644
index 00000000000..de0f92cfa30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DataGridItemEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridItemEventHandler(object sender, DataGridItemEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs
new file mode 100755
index 00000000000..dab62d84d63
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridLinkButton.cs
@@ -0,0 +1,54 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridLinkButton
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ * Contact: <gvaish_mono@lycos.com>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ class DataGridLinkButton : LinkButton
+ {
+ public DataGridLinkButton() : base()
+ {
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ SetForeColor();
+ base.Render(writer);
+ }
+
+ private void SetForeColor()
+ {
+ if(!ControlStyle.IsSet(System.Web.UI.WebControls.Style.FORECOLOR))
+ {
+ Control ctrl = this;
+ int level = 0;
+ while(level < 3)
+ {
+ ctrl = ctrl.Parent;
+ Color foreColor = ((WebControl)ctrl).ForeColor;
+ if(foreColor != Color.Empty)
+ {
+ ForeColor = foreColor;
+ return;
+ }
+ level++;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
new file mode 100644
index 00000000000..d63ac4940f9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridPageChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridPageChangedEventArgs : EventArgs
+ {
+ private object source;
+ private int npIndex;
+
+ public DataGridPageChangedEventArgs(object commandSource, int newPageIndex)
+ {
+ source = commandSource;
+ npIndex = newPageIndex;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public int NewPageIndex
+ {
+ get
+ {
+ return npIndex;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
new file mode 100644
index 00000000000..83dfc6d0dde
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridPageChangedEventHandler(object sender, DataGridPageChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
new file mode 100644
index 00000000000..ea602ef5166
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
@@ -0,0 +1,257 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridPagerStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridPagerStyle : TableItemStyle
+ {
+ DataGrid owner;
+
+ private static int MODE = (0x01 << 19);
+ private static int NEXT_PG_TEXT = (0x01 << 20);
+ private static int PG_BTN_COUNT = (0x01 << 21);
+ private static int POSITION = (0x01 << 22);
+ private static int VISIBLE = (0x01 << 23);
+ private static int PREV_PG_TEXT = (0x01 << 24);
+
+ internal DataGridPagerStyle(DataGrid owner): base()
+ {
+ this.owner = owner;
+ }
+
+ internal bool IsPagerOnTop
+ {
+ get {
+ PagerPosition p = Position;
+ return (p == PagerPosition.Top || p == PagerPosition.TopAndBottom);
+ }
+ }
+
+ internal bool IsPagerOnBottom
+ {
+ get {
+ PagerPosition p = Position;
+ return (p == PagerPosition.Bottom || p == PagerPosition.TopAndBottom);
+ }
+ }
+
+ public PagerMode Mode
+ {
+ get
+ {
+ if(IsSet(MODE))
+ {
+ return (PagerMode)ViewState["Mode"];
+ }
+ return PagerMode.NextPrev;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(PagerMode), value))
+ {
+ throw new ArgumentOutOfRangeException("value");
+ }
+ ViewState["Mode"] = value;
+ Set(MODE);
+ }
+ }
+
+ public string NextPageText
+ {
+ get
+ {
+ if(IsSet(NEXT_PG_TEXT))
+ {
+ return (string)ViewState["NextPageText"];
+ }
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["NextPageText"] = value;
+ Set(NEXT_PG_TEXT);
+ }
+ }
+
+ public string PrevPageText
+ {
+ get
+ {
+ if(IsSet(PREV_PG_TEXT))
+ {
+ return (string)ViewState["PrevPageText"];
+ }
+ return "&lt;";
+ }
+ set
+ {
+ ViewState["PrevPageText"] = value;
+ Set(PREV_PG_TEXT);
+ }
+ }
+
+ public int PageButtonCount
+ {
+ get
+ {
+ if(IsSet(PG_BTN_COUNT))
+ {
+ return (int)ViewState["PageButtonCount"];
+ }
+ return 10;
+ }
+ set
+ {
+ ViewState["PageButtonCount"] = value;
+ Set(PG_BTN_COUNT);
+ }
+ }
+
+ public PagerPosition Position
+ {
+ get
+ {
+ if(IsSet(POSITION))
+ {
+ return (PagerPosition)ViewState["Position"];
+ }
+ return PagerPosition.Bottom;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(PagerPosition), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["Position"] = value;
+ Set(POSITION);
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ if(IsSet(VISIBLE))
+ {
+ return (bool)ViewState["Visible"];
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["Visible"] = value;
+ Set(PG_BTN_COUNT);
+ }
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s != null && !s.IsEmpty && s is DataGridPagerStyle)
+ {
+ base.CopyFrom(s);
+ DataGridPagerStyle from = (DataGridPagerStyle)s;
+ if(from.IsSet(MODE))
+ {
+ Mode = from.Mode;
+ }
+ if(from.IsSet(NEXT_PG_TEXT))
+ {
+ NextPageText = from.NextPageText;
+ }
+ if(from.IsSet(PG_BTN_COUNT))
+ {
+ PageButtonCount = from.PageButtonCount;
+ }
+ if(from.IsSet(POSITION))
+ {
+ Position = from.Position;
+ }
+ if(from.IsSet(VISIBLE))
+ {
+ Visible = from.Visible;
+ }
+ if(from.IsSet(PREV_PG_TEXT))
+ {
+ PrevPageText = from.PrevPageText;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty && s is DataGridPagerStyle)
+ {
+ base.MergeWith(s);
+ DataGridPagerStyle with = (DataGridPagerStyle)s;
+ if(with.IsSet(MODE) && !IsSet(MODE))
+ {
+ Mode = with.Mode;
+ }
+ if(with.IsSet(NEXT_PG_TEXT) && !IsSet(NEXT_PG_TEXT))
+ {
+ NextPageText = with.NextPageText;
+ }
+ if(with.IsSet(PG_BTN_COUNT) && !IsSet(PG_BTN_COUNT))
+ {
+ PageButtonCount = with.PageButtonCount;
+ }
+ if(with.IsSet(POSITION) && !IsSet(POSITION))
+ {
+ Position = with.Position;
+ }
+ if(with.IsSet(VISIBLE) && !IsSet(VISIBLE))
+ {
+ Visible = with.Visible;
+ }
+ if(with.IsSet(PREV_PG_TEXT) && !IsSet(PREV_PG_TEXT))
+ {
+ PrevPageText = with.PrevPageText;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(MODE))
+ {
+ ViewState.Remove("Mode");
+ }
+ if(IsSet(NEXT_PG_TEXT))
+ {
+ ViewState.Remove("NextPageText");
+ }
+ if(IsSet(PG_BTN_COUNT))
+ {
+ ViewState.Remove("PageButtonCount");
+ }
+ if(IsSet(POSITION))
+ {
+ ViewState.Remove("Position");
+ }
+ if(IsSet(VISIBLE))
+ {
+ ViewState.Remove("Visible");
+ }
+ if(IsSet(PREV_PG_TEXT))
+ {
+ ViewState.Remove("PrevPageText");
+ }
+ base.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
new file mode 100644
index 00000000000..564451fbb7a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridSortCommandEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridSortCommandEventArgs : EventArgs
+ {
+ private object source;
+ private string sortExpr;
+
+ public DataGridSortCommandEventArgs(object commandSource, DataGridCommandEventArgs dce)
+ {
+ source = commandSource;
+ sortExpr = (string)dce.CommandArgument;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public string SortExpression
+ {
+ get
+ {
+ return sortExpr;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
new file mode 100644
index 00000000000..b9a1d2653b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridSortCommandEventHandler(object sender, DataGridSortCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs
new file mode 100755
index 00000000000..e5d29f97570
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridTableInternal.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridTableInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridTableInternal : Table
+ {
+ public DataGridTableInternal() : base()
+ {
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(ID == null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, Parent.ClientID);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs
new file mode 100644
index 00000000000..f4a010ac49b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataKeyCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataKeyCollection : ICollection, IEnumerable
+ {
+ private ArrayList keys;
+
+ public DataKeyCollection(ArrayList keys)
+ {
+ this.keys = keys;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return keys.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object this[int index]
+ {
+ get
+ {
+ return keys[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return keys.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
new file mode 100755
index 00000000000..3e78627f0c4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
@@ -0,0 +1,876 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 98%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls
+{
+ //TODO: [Designer("??")]
+ //TODO: [Editor("??")]
+ public class DataList: BaseDataList, INamingContainer, IRepeatInfoUser
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string SelectCommandName = "Select";
+ public const string UpdateCommandName = "Update";
+
+ static readonly object CancelCommandEvent = new object ();
+ static readonly object DeleteCommandEvent = new object ();
+ static readonly object EditCommandEvent = new object ();
+ static readonly object ItemCommandEvent = new object ();
+ static readonly object ItemCreatedEvent = new object ();
+ static readonly object ItemDataBoundEvent = new object ();
+ static readonly object UpdateCommandEvent = new object ();
+
+ TableItemStyle alternatingItemStyle;
+ TableItemStyle editItemStyle;
+ TableItemStyle footerStyle;
+ TableItemStyle headerStyle;
+ TableItemStyle itemStyle;
+ TableItemStyle selectedItemStyle;
+ TableItemStyle separatorStyle;
+
+ ITemplate alternatingItemTemplate;
+ ITemplate editItemTemplate;
+ ITemplate footerTemplate;
+ ITemplate headerTemplate;
+ ITemplate itemTemplate;
+ ITemplate selectedItemTemplate;
+ ITemplate separatorTemplate;
+ ITemplate separatorItemTemplate;
+
+ ArrayList itemsArray;
+ DataListItemCollection items;
+
+ bool extractTemplateRows;
+
+ public DataList ()
+ {
+ }
+
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Style")]
+ [WebSysDescription("The style applied to alternating items.")]
+ public virtual TableItemStyle AlternatingItemStyle {
+ get {
+ if (alternatingItemStyle == null) {
+ alternatingItemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ alternatingItemStyle.TrackViewState ();
+ }
+
+ return alternatingItemStyle;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [TemplateContainer(typeof(DataListItem))]
+ [WebSysDescription("The template used for alternating items.")]
+ public virtual ITemplate AlternatingItemTemplate {
+ get { return alternatingItemTemplate; }
+ set { alternatingItemTemplate = value; }
+ }
+
+ [DefaultValue(-1)]
+ [WebCategory("Misc")]
+ [WebSysDescription("The index of the item shown in edit mode.")]
+ public virtual int EditItemIndex {
+ get {
+ object o = ViewState ["EditItemIndex"];
+ if (o != null)
+ return (int) o;
+
+ return -1;
+ }
+
+ set { ViewState ["EditItemIndex"] = value; }
+ }
+
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Style")]
+ [WebSysDescription("The style applied to items in edit mode.")]
+ public virtual TableItemStyle EditItemStyle {
+ get {
+ if (editItemStyle == null) {
+ editItemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ editItemStyle.TrackViewState ();
+ }
+
+ return editItemStyle;
+ }
+ }
+
+ public virtual ITemplate EditItemTemplate {
+ get { return editItemTemplate; }
+ set { editItemTemplate = value; }
+ }
+
+ public virtual bool ExtractTemplateRows {
+ get {
+ object o = ViewState ["ExtractTemplateRows"];
+ if (o != null)
+ return (bool) o;
+
+ return false;
+ }
+
+ set { ViewState ["ExtractTemplateRows"] = value; }
+ }
+
+ public virtual TableItemStyle FooterStyle {
+ get {
+ if (footerStyle == null) {
+ footerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ footerStyle.TrackViewState ();
+ }
+
+ return footerStyle;
+ }
+ }
+
+ public virtual ITemplate FooterTemplate {
+ get { return footerTemplate; }
+ set { footerTemplate = value; }
+ }
+
+ public override GridLines GridLines {
+ get { return base.GridLines; }
+ set { base.GridLines = value; }
+ }
+
+ public virtual TableItemStyle HeaderStyle {
+ get {
+ if (headerStyle == null) {
+ headerStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ headerStyle.TrackViewState ();
+ }
+
+ return headerStyle;
+ }
+ }
+
+ public virtual ITemplate HeaderTemplate {
+ get { return headerTemplate; }
+ set { headerTemplate = value; }
+ }
+
+ public virtual DataListItemCollection Items {
+ get {
+ if (items == null) {
+ if (itemsArray == null) {
+ EnsureChildControls ();
+ itemsArray = new ArrayList ();
+ }
+ items = new DataListItemCollection (itemsArray);
+ }
+
+ return items;
+ }
+ }
+
+ public virtual TableItemStyle ItemStyle {
+ get {
+ if (itemStyle == null) {
+ itemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ itemStyle.TrackViewState ();
+ }
+
+ return itemStyle;
+ }
+ }
+
+ public virtual ITemplate ItemTemplate {
+ get { return itemTemplate; }
+ set { itemTemplate = value; }
+ }
+
+ public virtual int RepeatColumns {
+ get {
+ object o = ViewState ["RepeatColumns"];
+ if (o != null)
+ return (int) o;
+
+ return 0;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value");
+
+ ViewState ["RepeatColumns"] = value;
+ }
+ }
+
+ public virtual RepeatDirection RepeatDirection {
+ get {
+ object o = ViewState ["RepeatDirection"];
+ if (o != null)
+ return (RepeatDirection) o;
+
+ return RepeatDirection.Vertical;
+ }
+ set {
+ if (!Enum.IsDefined (typeof (RepeatDirection), value))
+ throw new ArgumentException ("value");
+
+ ViewState ["RepeatDirection"] = value;
+ }
+ }
+
+ public virtual RepeatLayout RepeatLayout {
+ get {
+ object o = ViewState ["RepeatLayout"];
+ if (o != null)
+ return (RepeatLayout) o;
+
+ return RepeatLayout.Table;
+ }
+ set {
+ if (!Enum.IsDefined (typeof (RepeatLayout), value))
+ throw new ArgumentException ("value");
+
+ ViewState ["RepeatLayout"] = value;
+ }
+ }
+
+ public virtual int SelectedIndex {
+ get {
+ object o = ViewState ["SelectedIndex"];
+ if (o != null)
+ return (int) o;
+
+ return -1;
+ }
+ set {
+ //FIXME: Looks like a bug in Microsoft's specs.
+ // Exception is missing in document. I haven't tested the case
+ // But I think exception should follow
+ if (value < -1)
+ throw new ArgumentOutOfRangeException("value");
+
+ int prevSel = SelectedIndex;
+ ViewState ["SelectedIndex"] = value;
+ DataListItem prevSelItem;
+ ListItemType liType;
+
+ if (itemsArray != null) {
+ if (prevSel >= 0 && prevSel < itemsArray.Count) {
+ prevSelItem = (DataListItem) itemsArray [prevSel];
+ if (prevSelItem.ItemType != ListItemType.EditItem) {
+ liType = ((prevSel % 2) == 0 ? ListItemType.AlternatingItem :
+ ListItemType.Item);
+
+ prevSelItem.SetItemType (liType);
+ }
+ }
+
+ if (value >= 0 && value < itemsArray.Count) {
+ prevSelItem = (DataListItem) itemsArray [value];
+ if (prevSelItem.ItemType != ListItemType.EditItem) {
+ prevSelItem.SetItemType (ListItemType.SelectedItem);
+ }
+ }
+ }
+ }
+ }
+
+ public virtual DataListItem SelectedItem {
+ get {
+ if (SelectedIndex == -1)
+ return null;
+
+ return Items [SelectedIndex];
+ }
+ }
+
+ public virtual TableItemStyle SelectedItemStyle {
+ get {
+ if (selectedItemStyle == null) {
+ selectedItemStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ selectedItemStyle.TrackViewState ();
+ }
+
+ return selectedItemStyle;
+ }
+ }
+
+ public virtual ITemplate SelectedItemTemplate {
+ get { return selectedItemTemplate; }
+ set { selectedItemTemplate = value; }
+ }
+
+ public virtual TableItemStyle SeparatorStyle {
+ get {
+ if (separatorStyle == null) {
+ separatorStyle = new TableItemStyle ();
+ if (IsTrackingViewState)
+ separatorStyle.TrackViewState ();
+ }
+
+ return separatorStyle;
+ }
+ }
+
+ public virtual ITemplate SeparatorTemplate {
+ get { return separatorTemplate; }
+ set { separatorTemplate = value; }
+ }
+
+ public virtual ITemplate SeparatorItemTemplate {
+ get { return separatorItemTemplate; }
+ set { separatorItemTemplate = value; }
+ }
+
+ public virtual bool ShowHeader {
+ get {
+ object o = ViewState ["ShowHeader"];
+ if (o != null)
+ return (bool) o;
+
+ return true;
+ }
+ set { ViewState ["ShowHeader"] = value; }
+ }
+
+ public virtual bool ShowFooter {
+ get {
+ object o = ViewState ["ShowFooter"];
+ if (o != null)
+ return (bool) o;
+
+ return true;
+ }
+ set
+ {
+ ViewState["ShowFooter"] = value;
+ }
+ }
+
+ public event DataListCommandEventHandler CancelCommand {
+ add { Events.AddHandler (CancelCommandEvent, value); }
+ remove { Events.RemoveHandler (CancelCommandEvent, value); }
+ }
+
+ public event DataListCommandEventHandler DeleteCommand {
+ add { Events.AddHandler (DeleteCommandEvent, value); }
+ remove { Events.RemoveHandler (DeleteCommandEvent, value); }
+ }
+
+ public event DataListCommandEventHandler EditCommand {
+ add { Events.AddHandler (EditCommandEvent, value); }
+ remove { Events.RemoveHandler (EditCommandEvent, value); }
+ }
+
+ public event DataListCommandEventHandler ItemCommand {
+ add { Events.AddHandler (ItemCommandEvent, value); }
+ remove { Events.RemoveHandler (ItemCommandEvent, value); }
+ }
+
+ public event DataListCommandEventHandler ItemCreated {
+ add { Events.AddHandler (ItemCreatedEvent, value); }
+ remove { Events.RemoveHandler (ItemCreatedEvent, value); }
+ }
+
+ public event DataListCommandEventHandler ItemDataBound {
+ add { Events.AddHandler (ItemDataBoundEvent, value); }
+ remove { Events.RemoveHandler (ItemDataBoundEvent, value); }
+ }
+
+ public event DataListCommandEventHandler UpdateCommand {
+ add { Events.AddHandler (UpdateCommandEvent, value); }
+ remove { Events.RemoveHandler (UpdateCommandEvent, value); }
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ TableStyle retVal = new TableStyle (ViewState);
+ retVal.CellSpacing = 0;
+ return retVal;
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ object [] states = (object []) savedState;
+
+ if (states [0] != null)
+ base.LoadViewState (states [0]);
+ if (states [1] != null)
+ alternatingItemStyle.LoadViewState (states [1]);
+ if (states [2] != null)
+ editItemStyle.LoadViewState (states [2]);
+ if (states [3] != null)
+ footerStyle.LoadViewState (states [3]);
+ if (states [4] != null)
+ headerStyle.LoadViewState (states [4]);
+ if (states [5] != null)
+ itemStyle.LoadViewState (states [5]);
+ if (states [6] != null)
+ selectedItemStyle.LoadViewState (states [6]);
+ if (states [7] != null)
+ separatorStyle.LoadViewState (states [7]);
+ }
+
+ protected override object SaveViewState()
+ {
+ object [] states = new object [8];
+ states [0] = base.SaveViewState ();
+ states [1] = (alternatingItemStyle == null ? null : alternatingItemStyle.SaveViewState ());
+ states [2] = (editItemStyle == null ? null : editItemStyle.SaveViewState ());
+ states [3] = (footerStyle == null ? null : footerStyle.SaveViewState ());
+ states [4] = (headerStyle == null ? null : headerStyle.SaveViewState ());
+ states [5] = (itemStyle == null ? null : itemStyle.SaveViewState ());
+ states [6] = (selectedItemStyle == null ? null : selectedItemStyle.SaveViewState ());
+ states [7] = (separatorStyle == null ? null : separatorStyle.SaveViewState ());
+ return states;
+ }
+
+ protected override void TrackViewState ()
+ {
+ base.TrackViewState ();
+ if (alternatingItemStyle != null)
+ alternatingItemStyle.TrackViewState ();
+ if (editItemStyle != null)
+ editItemStyle.TrackViewState ();
+ if (footerStyle != null)
+ footerStyle.TrackViewState ();
+ if (headerStyle != null)
+ headerStyle.TrackViewState ();
+ if (itemStyle != null)
+ itemStyle.TrackViewState ();
+ if (selectedItemStyle != null)
+ selectedItemStyle.TrackViewState ();
+ if (separatorStyle != null)
+ separatorStyle.TrackViewState ();
+ }
+
+ protected override bool OnBubbleEvent (object source, EventArgs e)
+ {
+ if (!(e is DataListCommandEventArgs))
+ return false;
+
+ DataListCommandEventArgs args = (DataListCommandEventArgs) e;
+ OnItemCommand (args);
+ string cmdName = args.CommandName.ToLower ();
+
+ if (cmdName == "cancel") {
+ OnCancelCommand (args);
+ } else if (cmdName == "delete") {
+ OnDeleteCommand (args);
+ } else if (cmdName == "edit") {
+ OnEditCommand (args);
+ } else if (cmdName == "select") {
+ SelectedIndex = args.Item.ItemIndex;
+ OnSelectedIndexChanged (EventArgs.Empty);
+ } else if (cmdName == "update") {
+ OnUpdateCommand (args);
+ }
+
+ return true;
+ }
+
+ void InvokeCommandEvent (DataListCommandEventArgs args, object key)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler) Events [key];
+ if (dlceh != null)
+ dlceh (this, args);
+ }
+
+ void InvokeItemEvent (DataListItemEventArgs args, object key)
+ {
+ DataListItemEventHandler dlieh = (DataListItemEventHandler) Events [key];
+ if (dlieh != null)
+ dlieh (this, args);
+ }
+
+ protected virtual void OnCancelCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, CancelCommandEvent);
+ }
+
+ protected virtual void OnDeleteCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, DeleteCommandEvent);
+ }
+
+ protected virtual void OnEditCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, EditCommandEvent);
+ }
+
+ protected virtual void OnItemCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, ItemCommandEvent);
+ }
+
+ protected virtual void OnItemCreated (DataListItemEventArgs e)
+ {
+ InvokeItemEvent (e, ItemCreatedEvent);
+ }
+
+ protected virtual void OnItemDataBound (DataListItemEventArgs e)
+ {
+ InvokeItemEvent (e, ItemDataBoundEvent);
+ }
+
+ protected virtual void OnUpdateCommand (DataListCommandEventArgs e)
+ {
+ InvokeCommandEvent (e, UpdateCommandEvent);
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if (Controls.Count == 0)
+ return;
+
+ RepeatInfo repeater = new RepeatInfo ();
+ Table templateTable = null;
+ if (extractTemplateRows) {
+ repeater.RepeatDirection = RepeatDirection.Vertical;
+ repeater.RepeatLayout = RepeatLayout.Flow;
+ repeater.RepeatColumns = 1;
+ repeater.OuterTableImplied = true;
+
+ templateTable = new Table ();
+ templateTable.ID = ClientID;
+ templateTable.CopyBaseAttributes (this);
+ templateTable.ApplyStyle (ControlStyle);
+ templateTable.RenderBeginTag (writer);
+ } else {
+ repeater.RepeatDirection = RepeatDirection;
+ repeater.RepeatLayout = RepeatLayout;
+ repeater.RepeatColumns = RepeatColumns;
+ }
+
+ repeater.RenderRepeater (writer, this, ControlStyle, this);
+ if (templateTable != null) {
+ templateTable.RenderEndTag (writer);
+ }
+ }
+
+ private DataListItem GetItem (ListItemType itemType, int repeatIndex)
+ {
+ DataListItem retVal = null;
+ switch (itemType) {
+ case ListItemType.Header:
+ retVal = (DataListItem) Controls [0];
+ break;
+ case ListItemType.Footer:
+ retVal = (DataListItem) Controls [Controls.Count - 1];
+ break;
+ case ListItemType.Item:
+ goto case ListItemType.EditItem;
+ case ListItemType.AlternatingItem:
+ goto case ListItemType.EditItem;
+ case ListItemType.SelectedItem:
+ goto case ListItemType.EditItem;
+ case ListItemType.EditItem:
+ retVal = (DataListItem) Controls [repeatIndex];
+ break;
+ case ListItemType.Separator:
+ int index = 2 * repeatIndex + 1;
+ if (headerTemplate != null)
+ index ++;
+ retVal = (DataListItem) Controls [index];
+ break;
+ }
+ return retVal;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected override void CreateControlHierarchy (bool useDataSource)
+ {
+ IEnumerable source = null;
+ ArrayList dkeys = DataKeysArray;
+
+ if (itemsArray != null) {
+ itemsArray.Clear ();
+ } else {
+ itemsArray = new ArrayList ();
+ }
+
+ extractTemplateRows = ExtractTemplateRows;
+ if (!useDataSource) {
+ int count = (int) ViewState ["_!ItemCount"];
+ if (count != -1) {
+ source = new DataSourceInternal (count);
+ itemsArray.Capacity = count;
+ }
+ } else {
+ dkeys.Clear ();
+ source = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+ if (source is ICollection) {
+ dkeys.Capacity = ((ICollection) source).Count;
+ itemsArray.Capacity = ((ICollection) source).Count;
+ }
+ }
+
+ int itemCount = 0;
+ if (source != null) {
+ int index = 0;
+ int editIndex = EditItemIndex;
+ int selIndex = SelectedIndex;
+ string dataKey = DataKeyField;
+
+ if (headerTemplate != null)
+ CreateItem (-1, ListItemType.Header, useDataSource, null);
+
+ foreach (object current in source) {
+ if (!useDataSource)
+ dkeys.Add (DataBinder.GetPropertyValue (current, dataKey));
+
+ ListItemType type = ListItemType.Item;
+ if (index == editIndex) {
+ type = ListItemType.EditItem;
+ } else if (index == selIndex) {
+ type = ListItemType.SelectedItem;
+ } else if ((index % 2) != 0) {
+ type = ListItemType.AlternatingItem;
+ }
+
+ itemsArray.Add (CreateItem (index, type, useDataSource, current));
+ if (separatorTemplate != null)
+ CreateItem (index, ListItemType.Separator, useDataSource, null);
+ itemCount++;
+ index++;
+ }
+
+ if (footerTemplate != null)
+ CreateItem (-1, ListItemType.Footer, useDataSource, null);
+ }
+
+ if (useDataSource)
+ ViewState ["_!ItemCount"] = (source != null ? itemCount : -1);
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected virtual DataListItem CreateItem (int itemIndex, ListItemType itemType)
+ {
+ return new DataListItem (itemIndex, itemType);
+ }
+
+ private DataListItem CreateItem (int itemIndex, ListItemType itemType, bool dataBind, object dataItem)
+ {
+ DataListItem retVal = CreateItem (itemIndex, itemType);
+ DataListItemEventArgs e = new DataListItemEventArgs (retVal);
+ InitializeItem (retVal);
+ if (dataBind)
+ retVal.DataItem = dataItem;
+
+ OnItemCreated (e);
+ Controls.Add (retVal);
+
+ if (dataBind) {
+ retVal.DataBind ();
+ OnItemDataBound (e);
+ retVal.DataItem = null;
+ }
+
+ return retVal;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected override void PrepareControlHierarchy ()
+ {
+ if (Controls.Count == 0)
+ return;
+
+ Style defaultStyle = null;
+ Style rowStyle = null;
+
+ if (alternatingItemStyle != null) {
+ defaultStyle = new TableItemStyle ();
+ defaultStyle.CopyFrom (itemStyle);
+ defaultStyle.CopyFrom (alternatingItemStyle);
+ } else {
+ defaultStyle = itemStyle;
+ }
+
+ foreach (DataListItem current in Controls) {
+ rowStyle = null;
+ switch (current.ItemType) {
+ case ListItemType.Header:
+ if (headerStyle != null)
+ rowStyle = headerStyle;
+ break;
+ case ListItemType.Footer:
+ if (footerStyle != null)
+ rowStyle = footerStyle;
+ break;
+ case ListItemType.Separator:
+ rowStyle = separatorStyle;
+ break;
+ case ListItemType.Item:
+ rowStyle = itemStyle;
+ break;
+ case ListItemType.AlternatingItem:
+ rowStyle = defaultStyle;
+ break;
+ case ListItemType.SelectedItem:
+ rowStyle = new TableItemStyle ();
+ if ((current.ItemIndex % 2) == 0) {
+ rowStyle.CopyFrom (itemStyle);
+ } else {
+ rowStyle.CopyFrom (defaultStyle);
+ }
+ rowStyle.CopyFrom (selectedItemStyle);
+ break;
+ case ListItemType.EditItem:
+ rowStyle = new TableItemStyle ();
+ if ((current.ItemIndex % 2) == 0) {
+ rowStyle.CopyFrom (itemStyle);
+ } else {
+ rowStyle.CopyFrom (defaultStyle);
+ }
+
+ if (current.ItemIndex == SelectedIndex)
+ rowStyle.CopyFrom (selectedItemStyle);
+
+ rowStyle.CopyFrom (editItemStyle);
+ break;
+ }
+
+ if (rowStyle == null)
+ continue;
+
+ if (!extractTemplateRows) {
+ current.MergeStyle (rowStyle);
+ continue;
+ }
+
+ foreach (Control currentCtrl in current.Controls) {
+ if (!(currentCtrl is Table))
+ continue;
+
+ foreach (TableRow cRow in ((Table) currentCtrl).Rows)
+ cRow.MergeStyle (rowStyle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected virtual void InitializeItem (DataListItem item)
+ {
+ ListItemType type = item.ItemType;
+ ITemplate template = itemTemplate;
+
+ switch (type) {
+ case ListItemType.Header:
+ template = headerTemplate;
+ break;
+ case ListItemType.Footer:
+ template = footerTemplate;
+ break;
+ case ListItemType.AlternatingItem:
+ if (alternatingItemTemplate != null)
+ template = alternatingItemTemplate;
+ break;
+ case ListItemType.SelectedItem:
+ if (selectedItemTemplate != null) {
+ template = selectedItemTemplate;
+ break;
+ }
+
+ if ((item.ItemIndex % 2) != 0)
+ goto case ListItemType.AlternatingItem;
+ break;
+ case ListItemType.EditItem:
+ if (editItemTemplate != null) {
+ template = editItemTemplate;
+ break;
+ }
+
+ if (item.ItemIndex == SelectedIndex)
+ goto case ListItemType.SelectedItem;
+
+ if ((item.ItemIndex % 2) != 0)
+ goto case ListItemType.AlternatingItem;
+ break;
+ case ListItemType.Separator:
+ template = separatorTemplate;
+ break;
+ }
+
+ if (template != null)
+ template.InstantiateIn (item);
+ }
+
+ bool IRepeatInfoUser.HasFooter {
+ get { return (ShowFooter && footerTemplate != null); }
+ }
+
+ bool IRepeatInfoUser.HasHeader {
+ get { return (ShowHeader && headerTemplate != null); }
+ }
+
+ bool IRepeatInfoUser.HasSeparators {
+ get { return (separatorItemTemplate != null); }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount {
+ get {
+ if (itemsArray != null)
+ return itemsArray.Count;
+
+ return 0;
+ }
+ }
+
+ void IRepeatInfoUser.RenderItem (ListItemType itemType,
+ int repeatIndex,
+ RepeatInfo repeatInfo,
+ HtmlTextWriter writer)
+ {
+ DataListItem item = GetItem (itemType, repeatIndex);
+ if (item != null)
+ item.RenderItem (writer,
+ extractTemplateRows,
+ (repeatInfo.RepeatLayout == RepeatLayout.Table));
+ }
+
+ Style IRepeatInfoUser.GetItemStyle (ListItemType itemType, int repeatIndex)
+ {
+ DataListItem item = GetItem (itemType, repeatIndex);
+ if (item == null || !item.ControlStyleCreated)
+ return null;
+
+ return item.ControlStyle;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs
new file mode 100644
index 00000000000..93511a27730
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs
@@ -0,0 +1,46 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: DataListCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListCommandEventArgs: CommandEventArgs
+ {
+ private DataListItem dlItem;
+ private object cmdSrc;
+
+ public DataListCommandEventArgs(DataListItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ dlItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public DataListItem Item
+ {
+ get
+ {
+ return dlItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs
new file mode 100644
index 00000000000..59df1b2fe50
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataListCommandEventHandler(object sender, DataListCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs
new file mode 100644
index 00000000000..8c820047a8a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs
@@ -0,0 +1,112 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItem
+ *
+ * Authors: Gaurav Vaish, Gonzalo Paniagua (gonzalo@ximian.com)
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ public class DataListItem : WebControl, INamingContainer
+ {
+ int itemIndex;
+ ListItemType itemType;
+ object dataItem;
+
+ public DataListItem(int itemIndex, ListItemType itemType)
+ {
+ this.itemIndex = itemIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ public virtual void RenderItem (HtmlTextWriter writer, bool extractRows, bool tableLayout)
+ {
+ if (extractRows){
+ Table tbl = null;
+ foreach (Control ctrl in Controls){
+ if (ctrl is Table){
+ tbl = (Table) ctrl;
+ break;
+ }
+ }
+
+ if (tbl == null)
+ throw new HttpException ("Template table not found!");
+
+ foreach (TableRow row in tbl.Rows)
+ row.RenderControl (writer);
+ } else {
+ if (tableLayout)
+ RenderContents (writer);
+ else
+ RenderControl (writer);
+ }
+
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableItemStyle();
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ RaiseBubbleEvent(this, new DataListCommandEventArgs(this, source, (CommandEventArgs)e));
+ return true;
+ }
+ return false;
+ }
+
+ protected internal virtual void SetItemType(ListItemType itemType)
+ {
+ if(Enum.IsDefined(typeof(ListItemType), itemType))
+ {
+ this.itemType = itemType;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs
new file mode 100644
index 00000000000..b98df0906d1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public DataListItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataListItem this[int index]
+ {
+ get
+ {
+ return (DataListItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataListItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs
new file mode 100644
index 00000000000..f9488bea1a6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListItemEventArgs : EventArgs
+ {
+ private DataListItem item;
+
+ public DataListItemEventArgs(DataListItem item)
+ {
+ this.item = item;
+ }
+
+ public DataListItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs
new file mode 100644
index 00000000000..3310857658d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataListItemEventHandler(object sender, DataListItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs
new file mode 100755
index 00000000000..aa0d2885777
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataSourceInternal.cs
@@ -0,0 +1,108 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataSourceInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish_mono@lycos.com
+ * Contact: gvaish_mono@lycos.com
+ * Implementation: Yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ internal class DataSourceInternal : ICollection, IEnumerable
+ {
+ private int itemCount;
+
+ public DataSourceInternal(int itemCount)
+ {
+ this.itemCount = itemCount;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return itemCount;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ IEnumerator e = GetEnumerator();
+ while(e.MoveNext())
+ {
+ array.SetValue(e.Current, index);
+ index++;
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return new DataSourceEnumeratorInternal(itemCount);
+ }
+
+ private class DataSourceEnumeratorInternal : IEnumerator
+ {
+ private int count;
+ private int index;
+
+ public DataSourceEnumeratorInternal(int count)
+ {
+ this.count = count;
+ this.index = -1;
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index < count);
+ }
+
+ public object Current
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public void Reset()
+ {
+ this.index = -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs
new file mode 100755
index 00000000000..39aaffb4b83
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: DayNameFormat
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum DayNameFormat
+ {
+ Full,
+ Short,
+ FirstLetter,
+ FirstTwoLetters
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs
new file mode 100644
index 00000000000..a7e50cf9cdd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs
@@ -0,0 +1,43 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DayRenderEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DayRenderEventArgs
+ {
+ private TableCell cell;
+ private CalendarDay day;
+
+ public DayRenderEventArgs(TableCell cell, CalendarDay day)
+ {
+ this.cell = cell;
+ this.day = day;
+ }
+
+ public TableCell Cell
+ {
+ get
+ {
+ return cell;
+ }
+ }
+
+ public CalendarDay Day
+ {
+ get
+ {
+ return day;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs
new file mode 100644
index 00000000000..1501321ffb9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DayRenderEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DayRenderEventHandler(object sender, DayRenderEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
new file mode 100644
index 00000000000..6f05c7eab35
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
@@ -0,0 +1,160 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DropDownList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class DropDownList : ListControl, IPostBackDataHandler
+ {
+ public DropDownList(): base()
+ {
+ }
+
+ public override Color BorderColor
+ {
+ get
+ {
+ return base.BorderColor;
+ }
+ set
+ {
+ base.BorderColor = value;
+ }
+ }
+
+ public override BorderStyle BorderStyle
+ {
+ get
+ {
+ return base.BorderStyle;
+ }
+ set
+ {
+ base.BorderStyle = value;
+ }
+ }
+
+ public override Unit BorderWidth
+ {
+ get
+ {
+ return base.BorderWidth;
+ }
+ set
+ {
+ base.BorderWidth = value;
+ }
+ }
+
+ public override int SelectedIndex
+ {
+ get
+ {
+ int index = base.SelectedIndex;
+ if (index < 0 && Items.Count > 0) {
+ index = 0;
+ Items [0].Selected = true;
+ }
+ return index;
+ }
+ set
+ {
+ base.SelectedIndex = value;
+ }
+ }
+
+ public override string ToolTip
+ {
+ // MS ignores the tooltip for this one
+ get {
+ return String.Empty;
+ }
+ set {
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(Page != null)
+ {
+ Page.VerifyRenderingInServerForm(this);
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ base.AddAttributesToRender(writer);
+
+ if(AutoPostBack && Page != null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onchange, Page.GetPostBackClientEvent(this,""));
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(Items != null)
+ {
+ bool selected = false;
+ foreach(ListItem current in Items)
+ {
+ writer.WriteBeginTag("option");
+ if(current.Selected)
+ {
+ if(selected)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Multiselect_In_DropDownList"));
+ }
+ selected = true;
+ writer.WriteAttribute("selected", "selected", false);
+ }
+ writer.WriteAttribute("value", current.Value, true);
+ writer.Write('>');
+ HttpUtility.HtmlEncode(current.Text, writer);
+ writer.WriteEndTag("option");
+ writer.WriteLine();
+ }
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string[] vals = postCollection.GetValues(postDataKey);
+ if(vals != null)
+ {
+ int index = Items.FindByValueInternal(vals[0]);
+ if(index != SelectedIndex)
+ {
+ SelectedIndex = index;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs
new file mode 100644
index 00000000000..7779f07ce11
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs
@@ -0,0 +1,109 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: EditCommandColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class EditCommandColumn : DataGridColumn
+ {
+ public EditCommandColumn(): base()
+ {
+ }
+
+ public virtual ButtonColumnType ButtonType
+ {
+ get
+ {
+ object o = ViewState["ButtonType"];
+ if(o != null)
+ {
+ return (ButtonColumnType)o;
+ }
+ return ButtonColumnType.LinkButton;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ButtonColumnType), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["ButtonType"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string CancelText
+ {
+ get
+ {
+ object o = ViewState["CancelText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CancelText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string EditText
+ {
+ get
+ {
+ object o = ViewState["EditText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["EditText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string UpdateText
+ {
+ get
+ {
+ object o = ViewState["UpdateText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["UpdateText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [MonoTODO]
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+ //TODO: I have to read some documents.
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs
new file mode 100755
index 00000000000..3b618c7acbf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: FirstDayOfWeek
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum FirstDayOfWeek
+ {
+ Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Default
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
new file mode 100755
index 00000000000..1dcf22b9c7a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
@@ -0,0 +1,253 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Text;
+using System.Reflection;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public sealed class FontInfo
+ {
+ private Style infoOwner;
+
+ internal FontInfo(Style owner)
+ {
+ infoOwner = owner;
+ }
+
+ /// <summary>
+ /// Default constructor
+ /// <remarks>
+ /// The default constructor is made private to prevent any instances being made.
+ /// </remarks>
+ /// </summary>
+ private FontInfo()
+ {
+ }
+
+ public bool Bold
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_BOLD))
+ return (bool)(infoOwner.ViewState["FontInfoBold"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoBold"] = value;
+ infoOwner.Set(Style.FONT_BOLD);
+ }
+ }
+
+ public bool Italic
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_ITALIC))
+ return (bool)(infoOwner.ViewState["FontInfoItalic"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoItalic"] = value;
+ infoOwner.Set(Style.FONT_ITALIC);
+ }
+ }
+
+ public bool Overline
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_OLINE))
+ return (bool)(infoOwner.ViewState["FontInfoOverline"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoOverline"] = value;
+ infoOwner.Set(Style.FONT_OLINE);
+ }
+ }
+
+ public bool Strikeout
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_STRIKE))
+ return (bool)(infoOwner.ViewState["FontInfoStrikeout"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoStrikeout"] = value;
+ infoOwner.Set(Style.FONT_STRIKE);
+ }
+ }
+
+ public bool Underline
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_ULINE))
+ return (bool)(infoOwner.ViewState["FontInfoUnderline"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoUnderline"] = value;
+ infoOwner.Set(Style.FONT_ULINE);
+ }
+ }
+
+ //TODO: How do I check if the value is negative. FontUnit is struct not enum
+ public FontUnit Size
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_SIZE))
+ return (FontUnit)(infoOwner.ViewState["FontInfoSize"]);
+ return FontUnit.Empty;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoSize"] = value;
+ infoOwner.Set(Style.FONT_SIZE);
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ if(Names!=null)
+ return Names[0];
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null)
+ throw new ArgumentException();
+ string[] strArray = null;
+ if(value.Length > 0)
+ {
+ strArray = new string[1];
+ strArray[0] = value;
+ }
+ Names = strArray;
+ }
+ }
+
+ public string[] Names
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_NAMES))
+ return (string[])(infoOwner.ViewState["FontInfoNames"]);
+ return (new string[0]);
+ }
+ set
+ {
+ if(value!=null)
+ {
+ infoOwner.ViewState["FontInfoNames"] = value;
+ infoOwner.Set(Style.FONT_NAMES);
+ }
+ }
+ }
+
+ internal void Reset()
+ {
+ if(infoOwner.IsSet(Style.FONT_NAMES))
+ infoOwner.ViewState.Remove("FontInfoNames");
+ if(infoOwner.IsSet(Style.FONT_BOLD))
+ infoOwner.ViewState.Remove("FontInfoBold");
+ if(infoOwner.IsSet(Style.FONT_ITALIC))
+ infoOwner.ViewState.Remove("FontInfoItalic");
+ if(infoOwner.IsSet(Style.FONT_STRIKE))
+ infoOwner.ViewState.Remove("FontInfoStrikeout");
+ if(infoOwner.IsSet(Style.FONT_OLINE))
+ infoOwner.ViewState.Remove("FontInfoOverline");
+ if(infoOwner.IsSet(Style.FONT_ULINE))
+ infoOwner.ViewState.Remove("FontInfoUnderline");
+ if(infoOwner.IsSet(Style.FONT_SIZE) && infoOwner.Font.Size != FontUnit.Empty)
+ infoOwner.ViewState.Remove("FontInfoSize");
+ }
+
+ internal Style Owner
+ {
+ get
+ {
+ return infoOwner;
+ }
+ }
+
+ public void CopyFrom(FontInfo source)
+ {
+ if(source!=null)
+ {
+ if(source.Owner.IsSet(Style.FONT_NAMES))
+ Names = source.Names;
+ if(source.Owner.IsSet(Style.FONT_BOLD))
+ Bold = source.Bold;
+ if(source.Owner.IsSet(Style.FONT_ITALIC))
+ Italic = source.Italic;
+ if(source.Owner.IsSet(Style.FONT_STRIKE))
+ Strikeout = source.Strikeout;
+ if(source.Owner.IsSet(Style.FONT_OLINE))
+ Overline = source.Overline;
+ if(source.Owner.IsSet(Style.FONT_ULINE))
+ Underline = source.Underline;
+ if(source.Owner.IsSet(Style.FONT_SIZE) && source.Size != FontUnit.Empty)
+ Size = source.Size;
+ }
+ }
+
+ public void MergeWith(FontInfo with)
+ {
+ if(with!=null)
+ {
+ if(with.Owner.IsSet(Style.FONT_NAMES) && !infoOwner.IsSet(Style.FONT_NAMES))
+ Names = with.Names;
+ if(with.Owner.IsSet(Style.FONT_BOLD) && !infoOwner.IsSet(Style.FONT_BOLD))
+ Bold = with.Bold;
+ if(with.Owner.IsSet(Style.FONT_ITALIC) && !infoOwner.IsSet(Style.FONT_ITALIC))
+ Italic = with.Italic;
+ if(with.Owner.IsSet(Style.FONT_STRIKE) && !infoOwner.IsSet(Style.FONT_STRIKE))
+ Strikeout = with.Strikeout;
+ if(with.Owner.IsSet(Style.FONT_OLINE) && !infoOwner.IsSet(Style.FONT_OLINE))
+ Overline = with.Overline;
+ if(with.Owner.IsSet(Style.FONT_ULINE) && !infoOwner.IsSet(Style.FONT_ULINE))
+ Underline = with.Underline;
+ if(with.Owner.IsSet(Style.FONT_SIZE) && with.Size != FontUnit.Empty && !infoOwner.IsSet(Style.FONT_SIZE))
+ Size = with.Size;
+ }
+ }
+
+ public bool ShouldSerializeNames()
+ {
+ return (Names.Length > 0);
+ }
+
+ public override string ToString()
+ {
+ return ( (Name.Length > 0) ? (Name.ToString() + ", " + Size.ToString()) : Size.ToString() );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs
new file mode 100644
index 00000000000..3a04e327a56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs
@@ -0,0 +1,63 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontNamesConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class FontNamesConverter : TypeConverter
+ {
+ public FontNamesConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ return (sourceType == typeof(string));
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value is string)
+ {
+ string fontNames = (string)value;
+ if(fontNames.Length == 0)
+ {
+ return (new string[0]);
+ }
+ string[] names = fontNames.Split(new char[] { ','});
+ for(int i=0; i < names.Length; i++)
+ {
+ names[i] = names[i].Trim();
+ }
+ return names;
+ }
+ throw GetConvertFromException(value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof(string))
+ {
+ if(value == null || ((string[])value) == null)
+ return String.Empty;
+ return String.Join(",", (string[])value);
+ }
+ throw GetConvertToException(value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs
new file mode 100755
index 00000000000..f72e3d455aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs
@@ -0,0 +1,30 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: FontSize
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum FontSize
+ {
+ NotSet,
+ AsUnit,
+ Smaller,
+ Larger,
+ XXSmall,
+ XSmall,
+ Small,
+ Medium,
+ Large,
+ XLarge,
+ XXLarge
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
new file mode 100644
index 00000000000..b89207207b2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
@@ -0,0 +1,215 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Struct: FontUnit
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(FontUnitConverter))]
+ public struct FontUnit
+ {
+ public static readonly FontUnit Empty = new FontUnit();
+ public static readonly FontUnit Large = new FontUnit(FontSize.Large);
+ public static readonly FontUnit Larger = new FontUnit(FontSize.Larger);
+ public static readonly FontUnit Medium = new FontUnit(FontSize.Medium);
+ public static readonly FontUnit Small = new FontUnit(FontSize.Small);
+ public static readonly FontUnit Smaller = new FontUnit(FontSize.Smaller);
+ public static readonly FontUnit XLarge = new FontUnit(FontSize.XLarge);
+ public static readonly FontUnit XSmall = new FontUnit(FontSize.XSmall);
+ public static readonly FontUnit XXLarge = new FontUnit(FontSize.XXLarge);
+ public static readonly FontUnit XXSmall = new FontUnit(FontSize.XXSmall);
+
+ private FontSize type;
+ private Unit val;
+
+ private static Hashtable sizeTable;
+
+ static FontUnit ()
+ {
+ sizeTable = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ sizeTable.Add ("smaller", 2);
+ sizeTable.Add ("larger", 3);
+ sizeTable.Add ("xx-small", 4);
+ sizeTable.Add ("xxsmall", 4);
+ sizeTable.Add ("x-small", 5);
+ sizeTable.Add ("xsmall", 5);
+ sizeTable.Add ("small", 6);
+ sizeTable.Add ("medium", 7);
+ sizeTable.Add ("large", 8);
+ sizeTable.Add ("xlarge", 9);
+ sizeTable.Add ("x-large", 9);
+ sizeTable.Add ("xxlarge", 10);
+ sizeTable.Add ("xx-large", 10);
+ }
+
+ public FontUnit(FontSize type)
+ {
+ if(!Enum.IsDefined(typeof(FontSize), type))
+ throw new ArgumentException();
+ this.type = type;
+ if(this.type == FontSize.AsUnit)
+ {
+ val = Unit.Point(10);
+ } else
+ {
+ val = Unit.Empty;
+ }
+ }
+
+ public FontUnit(int value)
+ {
+ type = FontSize.AsUnit;
+ val = Unit.Point(value);
+ }
+
+ public FontUnit(string value): this(value, CultureInfo.CurrentCulture)
+ {
+ }
+
+ public FontUnit(Unit value)
+ {
+ if(value.IsEmpty)
+ {
+ type = FontSize.NotSet;
+ val = Unit.Empty;
+ } else
+ {
+ type = FontSize.AsUnit;
+ val = value;
+ }
+ }
+
+ public FontUnit(string value, CultureInfo culture)
+ {
+ type = FontSize.NotSet;
+ val = Unit.Empty;
+ if(value != null && value != String.Empty)
+ {
+ string low = value.ToLower(culture);
+ int size = GetTypeFromString(low);
+ if (size != -1)
+ {
+ type = (FontSize)size;
+ } else {
+ val = new Unit(value, culture, UnitType.Point);
+ type = FontSize.AsUnit;
+ }
+ }
+ }
+
+ private static int GetTypeFromString(string strVal)
+ {
+ if (!(sizeTable.ContainsKey (strVal)))
+ return -1;
+ return (int) sizeTable [strVal];
+ }
+
+ public static FontUnit Parse(string s)
+ {
+ return Parse(s, CultureInfo.CurrentCulture);
+ }
+
+ public static FontUnit Parse(string s, CultureInfo culture)
+ {
+ return new FontUnit(s, culture);
+ }
+
+ public static FontUnit Point(int n)
+ {
+ return new FontUnit(n);
+ }
+
+ public static bool operator ==(FontUnit left, FontUnit right)
+ {
+ return (left.type == right.type && left.val == right.val);
+ }
+
+ public static bool operator !=(FontUnit left, FontUnit right)
+ {
+ return !(left == right);
+ }
+
+ public static implicit operator FontUnit(int n)
+ {
+ return FontUnit.Point(n);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj!= null && obj is FontUnit)
+ {
+ FontUnit that = (FontUnit)obj;
+ return (this.type == that.type && this.val == that.val);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return ( (type.GetHashCode() << 2) | val.GetHashCode() );
+ }
+
+ public override string ToString()
+ {
+ return ToString(CultureInfo.CurrentCulture);
+ }
+
+ public string ToString(CultureInfo culture)
+ {
+ if(IsEmpty)
+ {
+ return String.Empty;
+ }
+ //string strRepr = String.Empty;
+ switch(type)
+ {
+ case FontSize.AsUnit: return val.ToString(culture);
+ case FontSize.XXSmall: return "XX-Small";
+ case FontSize.XSmall: return "X-Small";
+ case FontSize.XLarge: return "X-Large";
+ case FontSize.XXLarge: return "XX-Large";
+ default: return PropertyConverter.EnumToString(typeof(FontSize), type);
+ }
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return (type == FontSize.NotSet);
+ }
+ }
+
+ public FontSize Type
+ {
+ get
+ {
+ return type;
+ }
+ }
+
+ public Unit Unit
+ {
+ get
+ {
+ return val;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
new file mode 100644
index 00000000000..e4a92b2e207
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
@@ -0,0 +1,92 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontUnitConverter
+ *
+ * Author: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class FontUnitConverter : TypeConverter
+ {
+ static StandardValuesCollection valuesCollection;
+ static string creatingValues = "creating value collection";
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value == null)
+ return null;
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val.Length == 0)
+ {
+ return FontUnit.Empty;
+ }
+ return FontUnit.Parse(val, culture);
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(value != null && value is FontUnit)
+ {
+ FontUnit val = (FontUnit)value;
+ if(val.Type == FontSize.NotSet)
+ {
+ return String.Empty;
+ }
+ return val.ToString(culture);
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if (valuesCollection != null)
+ return valuesCollection;
+
+ lock (creatingValues) {
+ if (valuesCollection != null)
+ return valuesCollection;
+
+ Array values = Enum.GetValues (typeof (FontUnit));
+ Array.Sort (values);
+ valuesCollection = new StandardValuesCollection (values);
+ }
+
+ return valuesCollection;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs
new file mode 100755
index 00000000000..b013b5a1779
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: GridLines
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum GridLines
+ {
+ None,
+ Horizontal,
+ Vertical,
+ Both
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs
new file mode 100755
index 00000000000..4440f296d71
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: HorizontalAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(HorizontalAlignConverter))]
+ public enum HorizontalAlign
+ {
+ NotSet,
+ Left,
+ Center,
+ Right,
+ Justify
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs
new file mode 100644
index 00000000000..27ff78ba4e2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlignConverter.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.HorizontalAlignConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Web.UI.WebControls
+{
+ class HorizontalAlignConverter : EnumConverter
+ {
+ public HorizontalAlignConverter () : base (typeof(HorizontalAlign))
+ {
+ }
+
+ // The base class is enough to handle everything.
+ // The methods are here just to make the class status page happy.
+ // Add some optimizations?
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
new file mode 100755
index 00000000000..62c8dc83b09
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
@@ -0,0 +1,176 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLink
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: gvaish@iitk.ac.in, myscripts_2001@yahoo.com
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ //[Designer(??)]
+ [ControlBuilder(typeof(HyperLinkControlBuilder))]
+ //[DataBindingHandler("??")]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:HyperLink runat=\"server\">HyperLink</{0}:HyperLink>")]
+ public class HyperLink: WebControl
+ {
+ bool textSet;
+
+ public HyperLink(): base(HtmlTextWriterTag.A)
+ {
+ }
+
+ public virtual string ImageUrl
+ {
+ get
+ {
+ object o = ViewState["ImageUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ImageUrl"] = value;
+ }
+ }
+
+ public string NavigateUrl
+ {
+ get
+ {
+ object o = ViewState["NavigateUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["NavigateUrl"] = value;
+ }
+ }
+
+ public string Target
+ {
+ get
+ {
+ object o = ViewState["Target"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Target"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ if (o != null)
+ return (string) o;
+
+ return String.Empty;
+ }
+ set {
+ ViewState["Text"] = value;
+ textSet = true;
+ }
+ }
+
+ string InternalText
+ {
+ get { return Text; }
+ set { ViewState["Text"] = value; }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(NavigateUrl.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Href, NavigateUrl);
+ }
+ if(Target.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Target, Target);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(HasControls())
+ {
+ base.AddParsedSubObject(obj);
+ return;
+ }
+ if(obj is LiteralControl)
+ {
+ // This is a hack to workaround the behaviour of the code generator, which
+ // may split a text in several LiteralControls if there's a special character
+ // such as '<' in it.
+ if (textSet) {
+ Text = ((LiteralControl)obj).Text;
+ textSet = false;
+ } else {
+ InternalText += ((LiteralControl)obj).Text;
+ }
+ //
+
+ return;
+ }
+ if(Text.Length > 0)
+ {
+ base.AddParsedSubObject(new LiteralControl (Text));
+ Text = String.Empty;
+ }
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ base.LoadViewState(savedState);
+ object o = ViewState["Text"];
+ if(o!=null)
+ Text = (string)o;
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(ImageUrl.Length > 0)
+ {
+ Image img = new Image();
+ img.ImageUrl = ResolveUrl(ImageUrl);
+ if(ToolTip.Length > 0)
+ img.ToolTip = ToolTip;
+ if(Text.Length > 0)
+ img.AlternateText = Text;
+ img.RenderControl(writer);
+ return;
+ }
+ if(HasControls())
+ {
+ base.RenderContents(writer);
+ return;
+ }
+ writer.Write(Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
new file mode 100644
index 00000000000..9f636c97c58
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
@@ -0,0 +1,213 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLinkColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class HyperLinkColumn: DataGridColumn
+ {
+ PropertyDescriptor textFieldDescriptor;
+ PropertyDescriptor urlFieldDescriptor;
+
+ public HyperLinkColumn ()
+ {
+ }
+
+ public virtual string DataNavigateUrlField {
+ get {
+ object o = ViewState ["DataNavigateUrlField"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["DataNavigateUrlField"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public virtual string DataNavigateUrlFormatString {
+ get {
+ object o = ViewState ["DataNavigateUrlFormatString"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["DataNavigateUrlFormatString"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public virtual string DataTextField {
+ get {
+ object o = ViewState ["DataTextField"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+ set {
+ ViewState ["DataTextField"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public virtual string DataTextFormatString {
+ get {
+ object o = ViewState ["DataTextFormatString"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["DataTextFormatString"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public virtual string NavigateUrl {
+ get {
+ object o = ViewState ["NavigateUrl"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["NavigateUrl"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public virtual string Target {
+ get {
+ object o = ViewState ["Target"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["Target"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public virtual string Text {
+ get {
+ object o = ViewState ["Text"];
+ if (o != null)
+ return (string) o;
+ return String.Empty;
+ }
+
+ set {
+ ViewState ["Text"] = value;
+ OnColumnChanged ();
+ }
+ }
+
+ public override void Initialize ()
+ {
+ textFieldDescriptor = null;
+ urlFieldDescriptor = null;
+ base.Initialize ();
+ }
+
+ public override void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell (cell, columnIndex, itemType);
+
+ if (itemType != ListItemType.Header && itemType != ListItemType.Footer) {
+ HyperLink toDisplay = new HyperLink ();
+ toDisplay.Text = Text;
+ toDisplay.NavigateUrl = NavigateUrl;
+ toDisplay.Target = Target;
+
+ if (DataTextField.Length > 0 || DataNavigateUrlField.Length > 0)
+ toDisplay.DataBinding += new EventHandler (OnDataBindHyperLinkColumn);
+
+ cell.Controls.Add (toDisplay);
+ }
+ }
+
+ private void OnDataBindHyperLinkColumn (object sender, EventArgs e)
+ {
+ HyperLink link = (HyperLink) sender;
+ object item = ((DataGridItem) link.NamingContainer).DataItem;
+
+ if (textFieldDescriptor == null && urlFieldDescriptor == null) {
+ PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (item);
+ textFieldDescriptor = properties.Find (DataTextField, true);
+ if (textFieldDescriptor == null && !DesignMode)
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Field_Not_Found", DataTextField));
+
+ urlFieldDescriptor = properties.Find (DataNavigateUrlField, true);
+ if (urlFieldDescriptor == null && !DesignMode)
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Field_Not_Found", DataNavigateUrlField));
+ }
+
+ if (textFieldDescriptor != null) {
+ link.Text = FormatDataTextValue (textFieldDescriptor.GetValue (item));
+ } else {
+ link.Text = "Sample_DataBound_Text";
+ }
+
+ if (urlFieldDescriptor != null) {
+ link.NavigateUrl = FormatDataNavigateUrlValue (urlFieldDescriptor.GetValue (item));
+ } else {
+ link.NavigateUrl = "url";
+ }
+ }
+
+ protected virtual string FormatDataNavigateUrlValue (object dataUrlValue)
+ {
+ if (dataUrlValue == null)
+ return String.Empty;
+
+ string retVal;
+ if (DataNavigateUrlFormatString.Length > 0) {
+ retVal = String.Format (DataNavigateUrlFormatString, dataUrlValue);
+ } else {
+ retVal = dataUrlValue.ToString ();
+ }
+
+ return retVal;
+ }
+
+ protected virtual string FormatDataTextValue (object dataTextValue)
+ {
+ if (dataTextValue == null)
+ return String.Empty;
+
+ string retVal;
+ if (DataTextFormatString.Length > 0) {
+ retVal = String.Format (DataTextFormatString, dataTextValue);
+ } else {
+ retVal = dataTextValue.ToString ();
+ }
+
+ return retVal;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
new file mode 100644
index 00000000000..cca04d06622
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLinkControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public class HyperLinkControlBuilder : ControlBuilder
+ {
+ public HyperLinkControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
new file mode 100755
index 00000000000..47526f80d8e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Interface: IRepeatInfoUser
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public interface IRepeatInfoUser
+ {
+ bool HasFooter { get; }
+ bool HasHeader { get; }
+ bool HasSeparators { get; }
+ int RepeatedItemCount { get; }
+ void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer);
+ Style GetItemStyle(ListItemType itemType, int repeatIndex);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
new file mode 100644
index 00000000000..f3182ec9ce4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
@@ -0,0 +1,118 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Image
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("ImageUrl")]
+ public class Image : WebControl
+ {
+ public Image(): base(HtmlTextWriterTag.Img)
+ {
+ }
+
+ public virtual string AlternateText
+ {
+ get
+ {
+ object o = ViewState["AlternateText"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["AlternateText"] = value;
+ }
+ }
+
+ public override bool Enabled
+ {
+ get
+ {
+ return base.Enabled;
+ }
+ set
+ {
+ base.Enabled = value;
+ }
+ }
+
+ public override FontInfo Font
+ {
+ get
+ {
+ return base.Font;
+ }
+ }
+
+ public virtual ImageAlign ImageAlign
+ {
+ get
+ {
+ object o = ViewState["ImageAlign"];
+ if(o!=null)
+ return (ImageAlign)o;
+ return ImageAlign.NotSet;
+ }
+ set
+ {
+ ViewState["ImageAlign"] = value;
+ }
+ }
+
+ public virtual string ImageUrl
+ {
+ get
+ {
+ object o = ViewState["ImageUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ImageUrl"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(ImageUrl.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Src, ResolveUrl(ImageUrl));
+ }
+ if(AlternateText.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Alt, AlternateText);
+ }
+ if(BorderWidth.IsEmpty)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
+ }
+ if(ImageAlign != ImageAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(ImageAlign), ImageAlign, "G"));
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs
new file mode 100755
index 00000000000..5a5fa02db58
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ImageAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ImageAlign
+ {
+ NotSet,
+ Left,
+ Right,
+ Baseline,
+ Top,
+ Middle,
+ Bottom,
+ AbsBottom,
+ AbsMiddle,
+ TextTop
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
new file mode 100644
index 00000000000..c318dd3c002
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
@@ -0,0 +1,181 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ImageButton
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ public class ImageButton: Image, IPostBackDataHandler, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ private int x, y;
+
+ public ImageButton(): base()
+ {
+ }
+
+ public bool CausesValidation
+ {
+ get
+ {
+ object o = ViewState["CausesValidation"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ public string CommandArgument
+ {
+ get
+ {
+ object o = ViewState["CommandArgument"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ object o = ViewState["CommandName"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ protected override HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ return HtmlTextWriterTag.Input;
+ }
+ }
+
+ public event ImageClickEventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "image");
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ if(Page != null && CausesValidation)
+ {
+ if(Page.Validators.Count > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Utils.GetClientValidatedEvent(Page));
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+ base.AddAttributesToRender(writer);
+ }
+
+ protected virtual void OnClick(ImageClickEventArgs e)
+ {
+ if(Events != null)
+ {
+ ImageClickEventHandler iceh = (ImageClickEventHandler)(Events[ClickEvent]);
+ if(iceh != null)
+ iceh(this, e);
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ CommandEventHandler ceh = (CommandEventHandler)(Events[CommandEvent]);
+ if(ceh != null)
+ ceh(this, e);
+ RaiseBubbleEvent(this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if(Page != null)
+ {
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string xCoord = postCollection[UniqueID + ".x"];
+ string yCoord = postCollection[UniqueID + ".y"];
+ if(xCoord != null && yCoord != null && xCoord.Length > 0 && yCoord.Length > 0)
+ {
+ x = Int32.Parse(xCoord);
+ y = Int32.Parse(yCoord);
+ Page.RegisterRequiresRaiseEvent(this);
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ if(CausesValidation)
+ Page.Validate();
+ OnClick(new ImageClickEventArgs(x, y));
+ OnCommand(new CommandEventArgs(CommandName, CommandArgument));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs
new file mode 100644
index 00000000000..f28f6e46db3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs
@@ -0,0 +1,86 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Label
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ //[Designer("??")]
+ //Currently mono does not handle Type in attributes
+ //[ControlBuilder(typeof(LabelControlBuilder))]
+ //[DataBindingHandler("??")]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:Label runat=\"server\">Label</{0}:Label>")]
+ public class Label : WebControl
+ {
+ public Label (): base ()
+ {
+ }
+
+ internal Label (HtmlTextWriterTag tagKey) : base (tagKey)
+ {
+ }
+
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if(HasControls ()){
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ if(obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ if(Text.Length > 0){
+ base.AddParsedSubObject (new LiteralControl (Text));
+ Text = String.Empty;
+ }
+
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if(savedState != null) {
+ base.LoadViewState (savedState);
+ string savedText = ViewState ["Text"] as string;
+ if(savedText != null)
+ Text = savedText;
+ }
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if(HasControls ())
+ base.RenderContents (writer);
+ else
+ writer.Write (Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
new file mode 100644
index 00000000000..5ef512cd092
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LabelControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public class LabelControlBuilder : ControlBuilder
+ {
+ public LabelControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
new file mode 100644
index 00000000000..89d6dea68d9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
@@ -0,0 +1,174 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButton
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ //[Designer("??")]
+ [ControlBuilder(typeof(LinkButtonControlBuilder))]
+ //[DataBindingHandler("??")]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:LinkButton runat=\"server\">LinkButton</{0}:LinkButton>")]
+ public class LinkButton : WebControl, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ public LinkButton () : base (HtmlTextWriterTag.A)
+ {
+ }
+
+ public bool CausesValidation
+ {
+ get {
+ object o = ViewState ["CausesValidation"];
+ return (o == null) ? true : (bool) o;
+ }
+
+ set { ViewState ["CausesValidation"] = value; }
+ }
+
+ public string CommandArgument
+ {
+ get {
+ object o = ViewState ["CommandArgument"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["CommandArgument"] = value; }
+ }
+
+ public string CommandName
+ {
+ get {
+ object o = ViewState ["CommandName"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["CommandName"] = value; }
+ }
+
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ public event EventHandler Click
+ {
+ add { Events.AddHandler(ClickEvent, value); }
+ remove { Events.RemoveHandler(ClickEvent, value); }
+ }
+
+ public event CommandEventHandler Command
+ {
+ add { Events.AddHandler(CommandEvent, value); }
+ remove { Events.RemoveHandler(CommandEvent, value); }
+ }
+
+ protected virtual void OnClick (EventArgs e)
+ {
+ if(Events != null){
+ EventHandler eh = (EventHandler) (Events [ClickEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+ }
+
+ protected virtual void OnCommand (CommandEventArgs e)
+ {
+ if(Events != null){
+ CommandEventHandler ceh = (CommandEventHandler) (Events [CommandEvent]);
+ if (ceh != null)
+ ceh (this, e);
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender(e);
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
+ {
+ if (CausesValidation)
+ Page.Validate ();
+ OnClick (EventArgs.Empty);
+ OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ if (Enabled && Page != null){
+ if (CausesValidation && Page.Validators.Count > 0){
+ writer.AddAttribute (HtmlTextWriterAttribute.Href,
+ "javascript:" +
+ Utils.GetClientValidatedPostBack (this));
+ return;
+ }
+ writer.AddAttribute (HtmlTextWriterAttribute.Href,
+ Page.GetPostBackClientHyperlink (this, ""));
+ }
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (HasControls ()){
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ if (obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ if (Text.Length > 0){
+ base.AddParsedSubObject (new LiteralControl (Text));
+ Text = String.Empty;
+ }
+
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null){
+ base.LoadViewState (savedState);
+ string savedText = (string) ViewState ["Text"];
+ if (savedText != null)
+ Text = savedText;
+ }
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if (HasControls ()){
+ base.RenderContents (writer);
+ return;
+ }
+ writer.Write (Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
new file mode 100644
index 00000000000..cfb8a69b986
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButtonControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class LinkButtonControlBuilder : ControlBuilder
+ {
+ public LinkButtonControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs
new file mode 100644
index 00000000000..215d5efd082
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs
@@ -0,0 +1,55 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButtonInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ internal class LinkButtonInternal : LinkButton
+ {
+ public LinkButtonInternal() : base()
+ {
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ SetForeColor();
+ Render(writer);
+ }
+
+ private void SetForeColor()
+ {
+ if(!ControlStyle.IsSet(System.Web.UI.WebControls.Style.FORECOLOR))
+ {
+ Control ctrl = this;
+ Color foreCol;
+ int ctr = 0;
+ //FIXME: this-> LinkButton-> WebControl
+ while(ctr < 2)
+ {
+ ctrl = ctrl.Parent;
+ foreCol = ((WebControl)ctrl).ForeColor;
+ if(foreCol != Color.Empty)
+ {
+ ForeColor = foreCol;
+ return;
+ }
+ ctr++;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
new file mode 100644
index 00000000000..5548f0da083
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
@@ -0,0 +1,177 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListBox
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class ListBox : ListControl, IPostBackDataHandler
+ {
+ public ListBox () : base ()
+ {
+ }
+
+ public override Color BorderColor
+ {
+ get { return base.BorderColor; }
+ set { base.BorderColor = value; }
+ }
+
+ public override BorderStyle BorderStyle
+ {
+ get { return base.BorderStyle; }
+ set { base.BorderStyle = value; }
+ }
+
+ public override Unit BorderWidth
+ {
+ get { return base.BorderWidth; }
+ set { base.BorderWidth = value; }
+ }
+
+ public virtual int Rows
+ {
+ get {
+ object o = ViewState ["Rows"];
+ return (o == null) ? 4 : (int) o;
+ }
+
+ set {
+ if (value < 1 || value > 2000)
+ throw new ArgumentOutOfRangeException ();
+
+ ViewState ["Rows"] = value;
+ }
+ }
+
+ public virtual ListSelectionMode SelectionMode
+ {
+ get
+ {
+ object o = ViewState ["SelectionMode"];
+ return (o == null) ? ListSelectionMode.Single : (ListSelectionMode) o;
+ }
+ set
+ {
+ if (!Enum.IsDefined (typeof (ListSelectionMode), value))
+ throw new ArgumentException ();
+ ViewState ["SelectionMode"] = value;
+ }
+ }
+
+ public override string ToolTip
+ {
+ get { return String.Empty; }
+ set { /* Don't do anything. */ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if (Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ base.AddAttributesToRender (writer);
+ writer.AddAttribute (HtmlTextWriterAttribute.Size,
+ Rows.ToString (NumberFormatInfo.InvariantInfo));
+
+ if (SelectionMode == ListSelectionMode.Multiple)
+ writer.AddAttribute (HtmlTextWriterAttribute.Multiple, "multiple");
+
+ if (AutoPostBack && Page != null){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onchange,
+ Page.GetPostBackClientEvent (this, ""));
+ writer.AddAttribute ("language", "javascript");
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && SelectionMode == ListSelectionMode.Multiple && Enabled)
+ Page.RegisterRequiresPostBack(this);
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ bool isMultAllowed = (SelectionMode == ListSelectionMode.Multiple);
+ bool selMade = false;
+ foreach (ListItem current in Items){
+ writer.WriteBeginTag ("option");
+ if (current.Selected){
+ if (!isMultAllowed && selMade)
+ throw new HttpException ("Cannot_MultiSelect_In_Single_Mode");
+ selMade = true;
+ writer.WriteAttribute ("selected", "selected");
+ }
+ writer.WriteAttribute ("value", current.Value, true);
+ writer.Write ('>');
+ writer.Write (HttpUtility.HtmlEncode (current.Text));
+ writer.WriteEndTag ("option");
+ writer.WriteLine ();
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ string[] vals = postCollection.GetValues (postDataKey);
+ bool updated = false;
+ ArrayList selected = SelectedIndices;
+ ArrayList final = new ArrayList (vals.Length);
+ if (vals != null){
+ if (SelectionMode == ListSelectionMode.Single){
+ int index = Items.FindByValueInternal (vals [0]);
+ if (SelectedIndex != index){
+ SelectedIndex = index;
+ updated = true;
+ }
+ } else {
+ foreach (string current in vals)
+ final.Add (Items.FindByValueInternal (current));
+
+ if (selected != null && selected.Count == vals.Length){
+ for (int ctr = 0; ctr < vals.Length; ctr++){
+ if (((int) final [ctr]) != ((int) selected [ctr])){
+ updated = true;
+ break;
+ }
+ }
+ } else {
+ updated = true;
+ }
+ }
+ if (!updated)
+ Select (final);
+ } else {
+ if (SelectedIndex != -1)
+ SelectedIndex = -1;
+ updated = true;
+ }
+ return updated;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnSelectedIndexChanged (EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
new file mode 100644
index 00000000000..71d3c276c14
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
@@ -0,0 +1,343 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListControl
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("DataSource")]
+ //[Designer("??")]
+ //[DataBindingHandler("??")]
+ [ParseChildren(true, "Items")]
+ public abstract class ListControl: WebControl
+ {
+ private static readonly object SelectedIndexChangedEvent = new object();
+
+ private object dataSource;
+ private ListItemCollection items;
+
+ private int cachedSelectedIndex = -1;
+
+ public ListControl(): base(HtmlTextWriterTag.Select)
+ {
+ }
+
+ public event EventHandler SelectedIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectedIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectedIndexChangedEvent, value);
+ }
+ }
+
+ public virtual bool AutoPostBack
+ {
+ get
+ {
+ object o = ViewState["AutoPostBack"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoPostBack"] = value;
+ }
+ }
+
+ public virtual string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ if(value != null)
+ {
+ if(value is IListSource || value is IEnumerable)
+ {
+ dataSource = value;
+ return;
+ }
+ }
+ throw new ArgumentException(HttpRuntime.FormatResourceString(ID, "Invalid DataSource Type"));
+ }
+ }
+
+ public virtual string DataTextField
+ {
+ get
+ {
+ object o = ViewState["DataTextField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ object o = ViewState["DataTextFormatString"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+ public virtual string DataValueField
+ {
+ get
+ {
+ object o = ViewState["DataValueField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataValueField"] = value;
+ }
+ }
+
+ public virtual ListItemCollection Items
+ {
+ get
+ {
+ if(items==null)
+ {
+ items = new ListItemCollection();
+ if(IsTrackingViewState)
+ {
+ items.TrackViewState();
+ }
+ }
+ return items;
+ }
+ }
+
+ public virtual int SelectedIndex
+ {
+ get {
+ ListItemCollection items = Items;
+ int last = items.Count;
+ for (int i = 0; i < last; i++) {
+ if (items [i].Selected)
+ return i;
+ }
+ return -1;
+ }
+ set {
+ if (value < -1 || value > Items.Count)
+ throw new ArgumentOutOfRangeException ();
+
+ ClearSelection ();
+ if (value != -1)
+ Items [value].Selected = true;
+ }
+ }
+
+ public virtual ListItem SelectedItem
+ {
+ get
+ {
+ int idx = SelectedIndex;
+ if (idx < 0)
+ return null;
+
+ return Items [idx];
+ }
+ }
+
+ internal virtual ArrayList SelectedIndices
+ {
+ get
+ {
+ ArrayList si = new ArrayList();
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Selected)
+ si.Add(i);
+ }
+ return si;
+ }
+ }
+
+ internal void Select(ArrayList indices)
+ {
+ ClearSelection();
+ foreach(object intObj in indices)
+ {
+ int index = (int)intObj;
+ if(index >= 0 && index < Items.Count)
+ Items[index].Selected = true;
+ }
+ }
+
+ public virtual void ClearSelection()
+ {
+ for(int i=0; i < Items.Count; i++)
+ {
+ Items[i].Selected = false;
+ }
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ if(savedState != null && savedState is Triplet)
+ {
+ Triplet state = (Triplet)savedState;
+ base.LoadViewState(state.First);
+ Items.LoadViewState(state.Second);
+ object indices = state.Third;
+ if(indices != null)
+ {
+ Select((ArrayList)indices);
+ }
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ IEnumerable ds = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+
+ if(ds != null) {
+ string dtf = DataTextField;
+ string dvf = DataValueField;
+ string dtfs = DataTextFormatString;
+ if (dtfs.Length == 0)
+ dtfs = "{0}";
+
+ Items.Clear();
+
+ bool useProperties = (dtf.Length > 0 && dvf.Length > 0);
+
+ foreach (object current in ds) {
+ ListItem li = new ListItem();
+ if (!useProperties){
+ li.Text = String.Format (dtfs, current);
+ li.Value = current.ToString ();
+ Items.Add (li);
+ continue;
+ }
+
+ object o;
+ if (dtf.Length > 0) {
+ o = DataBinder.GetPropertyValue (current, dtf, null);
+ li.Text = o.ToString ();
+ }
+
+ if (dvf.Length > 0) {
+ o = DataBinder.GetPropertyValue (current, dvf, null);
+ li.Value = o.ToString ();
+ }
+
+ Items.Add(li);
+ }
+ }
+
+ if (cachedSelectedIndex != -1) {
+ SelectedIndex = cachedSelectedIndex;
+ cachedSelectedIndex = -1;
+ }
+ }
+
+ protected virtual void OnSelectedIndexChanged(EventArgs e)
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender(e);
+ }
+
+ protected override object SaveViewState()
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ object vs = base.SaveViewState();
+ object itemSvs = Items.SaveViewState();
+ object indices = null;
+ if(SaveSelectedIndicesViewState)
+ indices = SelectedIndices;
+ if(vs!= null && itemSvs != null && indices != null)
+ {
+ return new Triplet(vs, itemSvs, indices);
+ }
+ return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ Items.TrackViewState();
+ }
+
+ private bool SaveSelectedIndicesViewState
+ {
+ get
+ {
+ if( Events[SelectedIndexChangedEvent] != null && Enabled && Visible)
+ {
+ Type t = GetType();
+ // If I am a derivative, let it take of storing the selected indices.
+ if(t == typeof(DropDownList) || t == typeof(ListBox) || t == typeof(CheckBoxList) || t == typeof(RadioButtonList))
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
new file mode 100644
index 00000000000..44bbe9cbf1c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
@@ -0,0 +1,241 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItem
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ [ControlBuilder(typeof(ListItemControlBuilder))]
+ public sealed class ListItem : IStateManager, IParserAccessor, IAttributeAccessor
+ {
+ private AttributeCollection attributes;
+ private string text;
+ private string val;
+ private bool marked;
+ private bool selected;
+ private bool dirty_t;
+ private bool dirty_v;
+
+ public ListItem(string text, string value)
+ {
+ this.text = text;
+ this.val = value;
+ attributes = null;
+ }
+
+ public ListItem(string text): this(text, null)
+ {
+ }
+
+ public ListItem(): this(null, null)
+ {
+ }
+
+ public static ListItem FromString(string text)
+ {
+ return new ListItem(text);
+ }
+
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ if(attributes == null)
+ attributes = new AttributeCollection(new StateBag(true));
+ return attributes;
+ }
+ }
+
+ public bool Selected
+ {
+ get {
+ return selected;
+ }
+
+ set {
+ selected = value;
+ }
+ }
+
+ internal bool Dirty
+ {
+ get {
+ return (dirty_t && dirty_v);
+ }
+
+ set {
+ dirty_t = value;
+ dirty_v = value;
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ if(text!=null)
+ {
+ return text;
+ }
+ if(val!=null)
+ {
+ return val;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ text = value;
+ if (IsTrackingViewState)
+ dirty_t = true;
+ }
+ }
+
+ public string Value
+ {
+ get {
+ if (val != null)
+ return val;
+
+ if (text != null)
+ return text;
+
+ return String.Empty;
+ }
+ set
+ {
+ val = value;
+ if(IsTrackingViewState)
+ dirty_v = true;
+ }
+ }
+
+ string IAttributeAccessor.GetAttribute(string key)
+ {
+ return attributes[key];
+ }
+
+ void IAttributeAccessor.SetAttribute(string key, string value)
+ {
+ attributes[key] = value;
+ }
+
+ /// <remarks>
+ /// The data is parsed - object must be of type LiteralControl or DataBoundLiteralControl.
+ /// In latter case, throw an exception telling that the data cannot be bind-ed.
+ /// </remarks>
+ void IParserAccessor.AddParsedSubObject(object obj)
+ {
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ if(obj is DataBoundLiteralControl)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Control_Cannot_DataBind","ListItem"));
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "ListItem", obj.GetType().ToString()));
+ }
+
+ bool IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ }
+
+ internal void LoadViewState(object state)
+ {
+ if(state is Pair)
+ {
+ Pair tv = (Pair)state;
+ if(tv.First!=null)
+ {
+ Text = (string)tv.First;
+ }
+ if(tv.Second!=null)
+ {
+ Value = (string)tv.Second;
+ }
+ }
+ }
+
+ internal object SaveViewState()
+ {
+ if (dirty_t && dirty_v)
+ return new Pair(Text, Value);
+
+ if (dirty_t)
+ return new Pair (Text, null);
+
+ if (dirty_v)
+ return new Pair(null, Value);
+
+ return null;
+ }
+
+ public override bool Equals (object o)
+ {
+ ListItem li = o as ListItem;
+ if (li == null)
+ return false;
+
+ return (Text == li.Text && Value == li.Value);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return Text;
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
new file mode 100644
index 00000000000..a43de11e8d7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
@@ -0,0 +1,362 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ //[Editor("??", typeof(Design.WebControls.ListItemCollectionEditor))]
+ public sealed class ListItemCollection : IList, ICollection, IEnumerable, IStateManager
+ {
+ private ArrayList items;
+ private bool saveAll;
+ private bool marked;
+
+ public ListItemCollection()
+ {
+ items = new ArrayList();
+ saveAll = false;
+ marked = false;
+ }
+
+ public int Capacity
+ {
+ get
+ {
+ return items.Capacity;
+ }
+ set
+ {
+ items.Capacity = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return items.IsReadOnly;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return items.IsSynchronized;
+ }
+ }
+
+ public ListItem this[int index]
+ {
+ get
+ {
+ if(index < 0 || index >= Count)
+ return null;
+ return (ListItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(ListItem item)
+ {
+ items.Add(item);
+ if(marked)
+ item.Dirty = true;
+ }
+
+ public void Add(string item)
+ {
+ Add(new ListItem(item));
+ }
+
+ public void AddRange(ListItem[] items)
+ {
+ foreach(ListItem item in items)
+ {
+ if(item!=null)
+ Add(item);
+ }
+ }
+
+ public void Clear()
+ {
+ items.Clear();
+ if(marked)
+ saveAll = true;
+ }
+
+ public bool Contains(ListItem item)
+ {
+ return items.Contains(item);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ items.CopyTo(array, index);
+ }
+
+ public ListItem FindByText(string text)
+ {
+ int i=-1;
+ foreach(object current in items)
+ {
+ i++;
+ if(((ListItem)current).Text == text)
+ break;
+ }
+ return (i==-1 ? null : (ListItem)items[i]);
+ }
+
+ public ListItem FindByValue(string value)
+ {
+ foreach(ListItem current in items)
+ {
+ if(current.Value == value)
+ {
+ return current;
+ }
+ }
+ return null;
+ }
+
+ internal int FindByValueInternal(string value)
+ {
+ int i = -1;
+ foreach(ListItem current in items)
+ {
+ i++;
+ if(current.Value == value)
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+
+ public int IndexOf(ListItem item)
+ {
+ return items.IndexOf(item);
+ }
+
+ public void Insert(int index, ListItem item)
+ {
+ items.Insert(index, item);
+ if(marked)
+ saveAll = true;
+ }
+
+ public void Insert(int index, string item)
+ {
+ Insert(index, new ListItem(item));
+ }
+
+ public void RemoveAt(int index)
+ {
+ if(index < 0 || index >= items.Count)
+ return;
+ items.RemoveAt(index);
+ if(marked)
+ saveAll = true;
+ }
+
+ public void Remove(ListItem item)
+ {
+ RemoveAt(IndexOf(item));
+ }
+
+ public void Remove(string item)
+ {
+ RemoveAt(IndexOf(ListItem.FromString(item)));
+ }
+
+ internal object SaveViewState ()
+ {
+ int count = Count;
+ if (saveAll) {
+ string [] keys = new string [count];
+ string [] vals = new string [count];
+ for(int i = 0; i < count; i++) {
+ keys[i] = this [i].Text;
+ vals[i] = this [i].Value;
+ }
+
+ return new Triplet (count, keys, vals);
+ }
+
+ ArrayList indices = new ArrayList ();
+ ArrayList states = new ArrayList ();
+ object o;
+ for(int i = 0; i < count; i++) {
+ o = this [i].SaveViewState ();
+ if (o == null)
+ continue;
+
+ indices.Add (i);
+ states.Add (o);
+ }
+
+ if (indices.Count > 0)
+ return new Pair (indices, states);
+
+ return null;
+ }
+
+ internal void LoadViewState (object savedState)
+ {
+ if (savedState == null)
+ return;
+
+ int i, end;
+ if (savedState is Pair) {
+ Pair pair = (Pair) savedState;
+ ArrayList indices = (ArrayList) pair.First;
+ ArrayList states = (ArrayList) pair.Second;
+
+ end = indices.Count;
+ for (i = 0; i < end; i++) {
+ if ((int) indices [i] < Count ) {
+ this [i].LoadViewState (states [i]);
+ } else {
+ ListItem temp = new ListItem ();
+ temp.LoadViewState (states [i]);
+ Add (temp);
+ }
+ }
+ } else if (savedState is Triplet) {
+ Triplet t = (Triplet) savedState;
+ items = new ArrayList ((int) t.First);
+ saveAll = true;
+ object [] text = (object []) t.Second;
+ object [] vals = (object []) t.Third;
+ end = text.Length;
+ for(i = 0; i < end; i++)
+ items.Add (new ListItem (text[i].ToString (), vals[i].ToString ()));
+ }
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ foreach(ListItem current in items)
+ current.TrackViewState();
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+
+ set
+ {
+ if(index >= 0 && index < Count)
+ if(value is ListItem)
+ items[index] = (ListItem) value;
+ }
+ }
+
+ int IList.Add(object item)
+ {
+ int index = (item is ListItem ? items.Add((ListItem)item) : -1);
+ if(index!=-1 && marked)
+ ((ListItem)item).Dirty = true;
+ return index;
+ }
+
+ bool IList.Contains(object item)
+ {
+ if(item is ListItem)
+ return Contains((ListItem)item);
+ return false;
+ }
+
+ int IList.IndexOf(object item)
+ {
+ if(item is ListItem)
+ return IndexOf((ListItem)item);
+ return -1;
+ }
+
+ void IList.Insert(int index, object item)
+ {
+ if(item is ListItem)
+ Insert(index, (ListItem)item);
+ }
+
+ void IList.Remove(object item)
+ {
+ if(item is string)
+ Remove((string)item);
+ if(item is ListItem)
+ Remove((ListItem)item);
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
new file mode 100644
index 00000000000..16c60a196a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItemControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ListItemControlBuilder : ControlBuilder
+ {
+ public ListItemControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals()
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs
new file mode 100755
index 00000000000..3d45e73693a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ListItemType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ListItemType
+ {
+ Header,
+ Footer,
+ Item,
+ AlternatingItem,
+ SelectedItem,
+ EditItem,
+ Separator,
+ Pager
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs
new file mode 100755
index 00000000000..f7c7967356c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ListSelectionMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ListSelectionMode
+ {
+ Single,
+ Multiple
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
new file mode 100644
index 00000000000..a2d4db5cc9e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
@@ -0,0 +1,62 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Literal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ [ControlBuilder(typeof(LiteralControlBuilder))]
+ //[DataBindingHandler("??")]
+ public class Literal : Control
+ {
+ public Literal () : base ()
+ {
+ }
+
+ public string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (!(obj is LiteralControl))
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type", "Literal",
+ obj.GetType ().Name.ToString ()));
+
+ Text = ((LiteralControl) obj).Text;
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ if (Text.Length > 0)
+ writer.Write (Text);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
new file mode 100644
index 00000000000..75dcb77192a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LiteralControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class LiteralControlBuilder : ControlBuilder
+ {
+ public LiteralControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override void AppendSubBuilder(ControlBuilder subBuilder)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Control_does_not_allow_children",(typeof(Literal)).ToString()));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs
new file mode 100644
index 00000000000..8de0d910c4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: MonthChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MonthChangedEventArgs
+ {
+ private DateTime nDate;
+ private DateTime pDate;
+
+ public MonthChangedEventArgs(DateTime newDate, DateTime previousDate)
+ {
+ nDate = newDate;
+ pDate = previousDate;
+ }
+
+ public DateTime NewDate
+ {
+ get
+ {
+ return nDate;
+ }
+ }
+
+ public DateTime PreviousDate
+ {
+ get
+ {
+ return pDate;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs
new file mode 100644
index 00000000000..99a7a27157e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void MonthChangedEventHandler(object sender, MonthChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs
new file mode 100755
index 00000000000..91d6cf3003b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: NextPrevFormat
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum NextPrevFormat
+ {
+ CustomText,
+ ShortMonth,
+ FullMonth
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
new file mode 100644
index 00000000000..407d76a1a84
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
@@ -0,0 +1,475 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PagedDataSource
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class PagedDataSource : ICollection, IEnumerable, ITypedList
+ {
+ private int pageSize;
+ private bool allowPaging;
+ private int currentPageIndex;
+ private bool allowCustomPaging;
+ private int virtualCount;
+
+ private IEnumerable dataSource;
+
+ public PagedDataSource()
+ {
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ pageSize = 10;
+ allowPaging = false;
+ currentPageIndex = 0;
+ allowCustomPaging = false;
+ virtualCount = 0;
+ }
+
+ public bool AllowCustomPaging
+ {
+ get
+ {
+ return allowCustomPaging;
+ }
+ set
+ {
+ allowCustomPaging = value;
+ }
+ }
+
+ public bool AllowPaging
+ {
+ get
+ {
+ return allowPaging;
+ }
+ set
+ {
+ allowPaging = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ if(IsPagingEnabled)
+ {
+ return DataSourceCount;
+ }
+ if(IsCustomPagingEnabled)
+ {
+ return pageSize;
+ }
+ if(IsLastPage)
+ {
+ return (DataSourceCount - FirstIndexInPage);
+ }
+ return pageSize;
+ }
+ return 0;
+ }
+ }
+
+ public int CurrentPageIndex
+ {
+ get
+ {
+ return currentPageIndex;
+ }
+
+ set
+ {
+ currentPageIndex = value;
+ }
+ }
+
+ public IEnumerable DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ dataSource = value;
+ }
+ }
+
+ public int DataSourceCount
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ if(IsCustomPagingEnabled)
+ {
+ return virtualCount;
+ }
+ if(dataSource is ICollection)
+ {
+ return ((ICollection)dataSource).Count;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("PagedDataSource_Cannot_Get_Count"));
+ }
+ return 0;
+ }
+ }
+
+ public int FirstIndexInPage
+ {
+ get
+ {
+ if(dataSource != null && IsPagingEnabled && !IsCustomPagingEnabled)
+ {
+ return (currentPageIndex * pageSize);
+ }
+ return 0;
+ }
+ }
+
+ public bool IsCustomPagingEnabled
+ {
+ get
+ {
+ return (IsPagingEnabled && allowCustomPaging);
+ }
+ }
+
+ public bool IsFirstPage
+ {
+ get
+ {
+ return (!IsPagingEnabled || (CurrentPageIndex == 0));
+ }
+ }
+
+ public bool IsLastPage
+ {
+ get
+ {
+ return (!IsPagingEnabled || (CurrentPageIndex == PageCount));
+ }
+ }
+
+ public bool IsPagingEnabled
+ {
+ get
+ {
+ return (allowPaging && pageSize != 0);
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public int PageCount
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ int total = DataSourceCount;
+ if(!IsPagingEnabled)
+ {
+ return total;
+ }
+ return (total + pageSize - 1)/pageSize;
+ }
+ return 0;
+ }
+ }
+
+ public int PageSize
+ {
+ get
+ {
+ return pageSize;
+ }
+ set
+ {
+ pageSize = value;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int VirtualCount
+ {
+ get
+ {
+ return virtualCount;
+ }
+ set
+ {
+ virtualCount = value;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(array, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ int fInd = FirstIndexInPage;
+ int count = -1;
+ if(dataSource is ICollection)
+ {
+ count = Count;
+ }
+
+ if(dataSource is IList)
+ {
+ return (new PrivateListEnumerator((IList)dataSource, fInd, count));
+ }
+ if(dataSource is Array)
+ {
+ return (new PrivateArrayEnumerator((object[])dataSource, fInd, count));
+ }
+ if(dataSource is ICollection)
+ {
+ return (new PrivateICollectionEnumerator((ICollection)dataSource, fInd, count));
+ }
+ if(allowCustomPaging)
+ {
+ return (new PrivateIEnumeratorEnumerator(dataSource.GetEnumerator(), Count));
+ }
+ return dataSource.GetEnumerator();
+ }
+
+ class PrivateIEnumeratorEnumerator : IEnumerator
+ {
+ private int index;
+ private int max;
+
+ private IEnumerator enumerator;
+
+ public PrivateIEnumeratorEnumerator(IEnumerator enumerator, int count)
+ {
+ this.enumerator = enumerator;
+ index = -1;
+ max = count;
+ }
+
+ public bool MoveNext()
+ {
+ enumerator.MoveNext();
+ index++;
+ return (index < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ enumerator.Reset();
+ }
+
+ public object Current
+ {
+ get
+ {
+ return enumerator.Current;
+ }
+ }
+ }
+
+ class PrivateICollectionEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+
+ private ICollection collection;
+ private IEnumerator collEnum;
+
+ public PrivateICollectionEnumerator(ICollection collection, int start, int count)
+ {
+ this.collection = collection;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > collection.Count)
+ {
+ max = collection.Count;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ if(collEnum == null)
+ {
+ int cIndex = 0;
+ collEnum = collection.GetEnumerator();
+ while(cIndex < start)
+ {
+ collEnum.MoveNext();
+ }
+ }
+ collEnum.MoveNext();
+ index++;
+ return (start + index < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ collEnum = null;
+ }
+
+ public object Current
+ {
+ get
+ {
+ return collEnum.Current;
+ }
+ }
+ }
+
+ class PrivateArrayEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+ private object[] values;
+
+ public PrivateArrayEnumerator(object[] values, int start, int count)
+ {
+ this.values = values;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > this.values.Length)
+ {
+ max = this.values.Length;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index + start < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if(index >= 0)
+ {
+ return values[index + start];
+ }
+ throw new InvalidOperationException("Enumerator_MoveNext_Not_Called");
+ }
+ }
+ }
+
+ class PrivateListEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+ private IList collection;
+
+ public PrivateListEnumerator(IList list, int start, int count)
+ {
+ collection = list;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > list.Count)
+ {
+ max = list.Count;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index + start < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if(index >= 0)
+ {
+ return collection[index + start];
+ }
+ throw new InvalidOperationException("Enumerator_MoveNext_Not_Called");
+ }
+ }
+ }
+
+ public string GetListName(PropertyDescriptor[] listAccessors)
+ {
+ return String.Empty;
+ }
+
+ public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
+ {
+ if(dataSource != null)
+ {
+ if(dataSource is ITypedList)
+ {
+ return ((ITypedList)dataSource).GetItemProperties(listAccessors);
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs
new file mode 100755
index 00000000000..5f99cee5773
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: PagerMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum PagerMode
+ {
+ NextPrev,
+ NumericPages
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs
new file mode 100755
index 00000000000..2ad9b466413
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: PagerPosition
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum PagerPosition
+ {
+ Bottom,
+ Top,
+ TopAndBottom
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
new file mode 100644
index 00000000000..82c7ea11d37
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
@@ -0,0 +1,97 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Panel
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ //[Designer("??")]
+ [ParseChildren(false)]
+ [PersistChildren(true)]
+ [ToolboxData("<{0}:Panel runat=\"server\">Panel</{0}:Panel>")]
+ public class Panel: WebControl
+ {
+ public Panel(): base(HtmlTextWriterTag.Div)
+ {
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ object o = ViewState["BackImageUrl"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["BackImageUrl"] = value;
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ object o = ViewState["HorizontalAlign"];
+ if(o != null)
+ return (HorizontalAlign)o;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["HorizontalAlign"] = value;
+ }
+ }
+
+ public virtual bool Wrap
+ {
+ get
+ {
+ object o = ViewState["Wrap"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(BackImageUrl.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + ResolveUrl(BackImageUrl) + ")");
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
+ }
+ if(Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
new file mode 100644
index 00000000000..19cc57bfd2e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
@@ -0,0 +1,28 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PlaceHolder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ControlBuilder(typeof(PlaceHolderControlBuilder))]
+ public class PlaceHolder : Control
+ {
+ public PlaceHolder(): base()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
new file mode 100644
index 00000000000..3bbd68c6d22
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PlaceHolderControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class PlaceHolderControlBuilder : ControlBuilder
+ {
+ public PlaceHolderControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
new file mode 100644
index 00000000000..c999695a8aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
@@ -0,0 +1,125 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RadioButton
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ //[Designer("??")]
+ public class RadioButton : CheckBox, IPostBackDataHandler
+ {
+ public RadioButton () : base ()
+ {
+ }
+
+ public virtual string GroupName
+ {
+ get {
+ object o = ViewState ["GroupName"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["GroupName"] = value; }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Page != null && Enabled && !Checked)
+ Page.RegisterRequiresPostBack (this);
+
+ if(GroupName.Length == 0)
+ GroupName = UniqueID;
+ }
+
+ internal override void RenderInputTag (HtmlTextWriter writer, string id)
+ {
+ writer.AddAttribute (HtmlTextWriterAttribute.Id, id);
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "radio");
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueGroupNamePrivate);
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, ValueAttributePrivate);
+
+ if (Checked)
+ writer.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+
+ if (AutoPostBack){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onclick,
+ Page.GetPostBackClientEvent (this, ""));
+ writer.AddAttribute ("language", "javascript");
+ }
+
+ if (AccessKey.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
+
+ if (TabIndex > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Tabindex,
+ TabIndex.ToString (NumberFormatInfo.InvariantInfo));
+
+ writer.RenderBeginTag (System.Web.UI.HtmlTextWriterTag.Input);
+ writer.RenderEndTag ();
+ }
+
+ private string UniqueGroupNamePrivate
+ {
+ get {
+ string retVal = GroupName;
+ int unique = UniqueID.LastIndexOf (':');
+ if (unique >= 0)
+ retVal += UniqueID.Substring (unique + 1);
+
+ return retVal;
+ }
+ }
+
+ private string ValueAttributePrivate
+ {
+ get {
+ string retVal = Attributes ["value"];
+ if (retVal != null)
+ return retVal;
+
+ if (ID != null)
+ return ID;
+
+ return UniqueID;
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ bool _checked = Checked;
+ if (postCollection [UniqueGroupNamePrivate] == ValueAttributePrivate){
+ if (_checked)
+ return false;
+ Checked = true;
+ return true;
+ }
+
+ if (_checked)
+ Checked = false;
+ return true;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnCheckedChanged (EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
new file mode 100644
index 00000000000..c1f0ece4094
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
@@ -0,0 +1,244 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RadioButtonList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class RadioButtonList : ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
+ private bool selectionIndexChanged;
+ private short tabIndex;
+
+ public RadioButtonList(): base()
+ {
+ selectionIndexChanged = false;
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return (int)(((TableStyle)ControlStyle).CellPadding);
+ }
+ return -1;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return (int)(((TableStyle)ControlStyle).CellSpacing);
+ }
+ return -1;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException("value");
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o != null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentException();
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o != null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o != null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentException();
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RepeatInfo info = new RepeatInfo();
+ Style cStyle = (ControlStyleCreated ? ControlStyle : null);
+ bool dirty = false;
+ tabIndex = TabIndex;
+ if(tabIndex != 0)
+ {
+ dirty = !ViewState.IsItemDirty("TabIndex");
+ TabIndex = 0;
+ }
+ info.RepeatColumns = RepeatColumns;
+ info.RepeatDirection = RepeatDirection;
+ info.RenderRepeater(writer, this, cStyle, this);
+ if(tabIndex != 0)
+ {
+ TabIndex = tabIndex;
+ }
+ if(dirty)
+ {
+ ViewState.SetItemDirty("TabIndex", false);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string value = postCollection[postDataKey];
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Value == value)
+ {
+ if(i != SelectedIndex)
+ {
+ SelectedIndex = i;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ if(selectionIndexChanged)
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+
+ Style IRepeatInfoUser.GetItemStyle(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex)
+ {
+ return null;
+ }
+
+ void IRepeatInfoUser.RenderItem (System.Web.UI.WebControls.ListItemType itemType,
+ int repeatIndex,
+ RepeatInfo repeatInfo,
+ HtmlTextWriter writer)
+ {
+ /* Create a new RadioButton as if it was defined in the page and render it */
+ RadioButton button = new RadioButton ();
+ button.GroupName = UniqueID;
+ button.TextAlign = TextAlign;
+ button.AutoPostBack = AutoPostBack;
+ button.ID = ClientID + "_" + repeatIndex.ToString (NumberFormatInfo.InvariantInfo);;
+ object view_state = ViewState ["TabIndex"];
+ if (view_state != null)
+ button.TabIndex = (short) view_state;
+ ListItem current = Items [repeatIndex];
+ button.Text = current.Text;
+ button.Attributes ["value"] = current.Value;
+ button.Checked = current.Selected;
+ button.RenderControl (writer);
+ }
+
+ bool IRepeatInfoUser.HasFooter
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasHeader
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasSeparators
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount
+ {
+ get
+ {
+ return Items.Count;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
new file mode 100644
index 00000000000..43a496023b5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
@@ -0,0 +1,125 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RangeValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Xml;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RangeValidator runat=\"server\" "
+ + "ErrorMessage=\"RangeValidator\"></{0}:RangeValidator>")]
+ public class RangeValidator : BaseCompareValidator
+ {
+ public RangeValidator(): base()
+ {
+ }
+
+ public string MaximumValue
+ {
+ get
+ {
+ object o = ViewState["MaximumValue"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["MaximumValue"] = value;
+ }
+ }
+
+ public string MinimumValue
+ {
+ get
+ {
+ object o = ViewState["MinimumValue"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["MinimumValue"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(base.RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid");
+ writer.AddAttribute("maximumvalue", MaximumValue);
+ writer.AddAttribute("minimumvalue", MinimumValue);
+ }
+ }
+
+ protected override bool ControlPropertiesValid()
+ {
+ string max = MaximumValue;
+ if(!CanConvert(max, Type))
+ {
+ string[] fmt = new string[4];
+ fmt[0] = max;
+ fmt[1] = "MaximumValue";
+ fmt[2] = ID;
+ fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
+ }
+ string min = MaximumValue;
+ if(!CanConvert(min, Type))
+ {
+ string[] fmt = new string[4];
+ fmt[0] = min;
+ fmt[1] = "MinimumValue";
+ fmt[2] = ID;
+ fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
+ }
+
+ if(Compare(max, min, ValidationCompareOperator.GreaterThan, ValidationDataType.Double))
+ {
+ string[] fmt = new string[3];
+ fmt[0] = min;
+ fmt[1] = max;
+ fmt[2] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_range_overalap", fmt));
+ }
+ return base.ControlPropertiesValid();
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = GetControlValidationValue(ControlToValidate);
+ if(ctrl == null || ctrl.Trim().Length == 0)
+ {
+ return true;
+ }
+ bool retVal = Compare(ctrl, MinimumValue, ValidationCompareOperator.GreaterThanEqual,
+ ValidationDataType.String);
+ if(!retVal)
+ {
+ retVal = Compare(ctrl, MaximumValue, ValidationCompareOperator.LessThanEqual,
+ ValidationDataType.String);
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
new file mode 100644
index 00000000000..dd2ee91de64
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
@@ -0,0 +1,88 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RegularExpressionValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Text.RegularExpressions;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RegularExpressionValidator runat=\"server\" "
+ + "ErrorMessage=\"RegularExpressionValidator\">"
+ + "</{0}:RegularExpressionValidator>")]
+ public class RegularExpressionValidator : BaseValidator
+ {
+ public RegularExpressionValidator(): base()
+ {
+ }
+
+ public string ValidationExpression
+ {
+ get
+ {
+ object o = ViewState["ValidationExpression"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ try
+ {
+ Regex.IsMatch("", value);
+ } catch(Exception)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_bad_regex", value));
+ }
+ ViewState["ValidationExpression"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(base.RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
+ string exp = ValidationExpression;
+ if(exp.Length > 0)
+ {
+ writer.AddAttribute("validationexpression", exp);
+ }
+ }
+ }
+
+ protected override bool EvaluateIsValid ()
+ {
+ string ctrl = GetControlValidationValue (ControlToValidate);
+ if (ctrl == null || ctrl.Trim ().Length == 0)
+ return true;
+
+ bool retVal;
+ try {
+ Match match = Regex.Match (ctrl, ValidationExpression);
+ if (match.Success && match.Index == 0) {
+ retVal = true;
+ } else {
+ retVal = false;
+ }
+ } catch (Exception) {
+ retVal = true;
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs
new file mode 100755
index 00000000000..fc26596dafc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: RepeatDirection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum RepeatDirection
+ {
+ Horizontal,
+ Vertical
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
new file mode 100644
index 00000000000..79ad32eb23d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
@@ -0,0 +1,372 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeatInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeatInfo
+ {
+ private bool outerTableImp;
+ private int repeatColumns;
+ private RepeatDirection repeatDirection;
+ private RepeatLayout repeatLayout;
+
+ public RepeatInfo()
+ {
+ outerTableImp = false;
+ repeatColumns = 0;
+ repeatDirection = RepeatDirection.Vertical;
+ repeatLayout = RepeatLayout.Table;
+ }
+
+ public bool OuterTableImplied
+ {
+ get
+ {
+ return outerTableImp;
+ }
+ set
+ {
+ outerTableImp = value;
+ }
+ }
+
+ public int RepeatColumns
+ {
+ get
+ {
+ return repeatColumns;
+ }
+ set
+ {
+ repeatColumns = value;
+ }
+ }
+
+ public RepeatDirection RepeatDirection
+ {
+ get
+ {
+ return repeatDirection;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentException();
+ repeatDirection = value;
+ }
+ }
+
+ public RepeatLayout RepeatLayout
+ {
+ get
+ {
+ return repeatLayout;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ repeatLayout = value;
+ }
+ }
+
+ public void RenderRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ if(RepeatDirection == RepeatDirection.Vertical)
+ {
+ DoVerticalRendering(writer, user, controlStyle, baseControl);
+ } else
+ {
+ DoHorizontalRendering(writer, user, controlStyle, baseControl);
+ }
+ }
+
+ private void DoVerticalRendering(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ int total = user.RepeatedItemCount;
+ int colsCount;
+ int rowsCount;
+ if(repeatColumns == 0 || repeatColumns==1)
+ {
+ colsCount = 1;
+ rowsCount = total;
+ } else
+ {
+ colsCount = repeatColumns;
+ rowsCount = (total + repeatColumns - 1) / repeatColumns;
+ if(rowsCount ==0 && total != 0)
+ {
+ rowsCount = 1;
+ colsCount = total;
+ }
+ }
+ WebControl ctrl = null;
+ bool isTable = true;
+ bool hasSeps = user.HasSeparators;
+ if(!outerTableImp)
+ {
+ if(RepeatLayout == RepeatLayout.Table)
+ {
+ ctrl = new Table();
+ } else
+ {
+ ctrl = new WebControl(HtmlTextWriterTag.Span);
+ isTable = false;
+ }
+ }
+
+ if(ctrl != null)
+ {
+ ctrl.ID = baseControl.ClientID;
+ ctrl.CopyBaseAttributes(baseControl);
+ ctrl.ApplyStyle(controlStyle);
+ ctrl.RenderBeginTag(writer);
+ }
+
+ Style itemStyle;
+ int colSpan = 0;
+ if(user.HasHeader)
+ {
+ if(isTable)
+ {
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ if(rowsCount != 1)
+ {
+ colSpan = rowsCount;
+ if(hasSeps)
+ colSpan += rowsCount;
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle(ListItemType.Header, -1);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Header, -1, this, writer);
+ if(isTable)
+ {
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ } else
+ {
+ if(!outerTableImp)
+ {
+ writer.WriteFullBeginTag("br");
+ }
+ }
+ }
+
+ int rowIndex = 0;
+ int colIndex = 0;
+ int index = 0;
+ while(rowIndex < rowsCount)
+ {
+ if(isTable)
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ colIndex = 0;
+ while(colIndex < colsCount)
+ {
+ index = rowIndex + colIndex * rowsCount;
+ if(index < total)
+ {
+ if(isTable)
+ {
+ itemStyle = user.GetItemStyle(ListItemType.Item, index);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Item, index, this, writer);
+ if(isTable)
+ writer.RenderEndTag();
+ if(hasSeps && index != (total - 1))
+ {
+ if(colsCount == 1)
+ {
+ writer.RenderEndTag();
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ } else
+ {
+ writer.WriteFullBeginTag("br");
+ }
+ if(isTable)
+ {
+ itemStyle = user.GetItemStyle(ListItemType.Separator, index);
+ if(itemStyle != null)
+ itemStyle.AddAttributesToRender(writer);
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ if(index < total)
+ user.RenderItem(ListItemType.Separator, index, this, writer);
+ if(isTable)
+ writer.RenderEndTag();
+ }
+ }
+ colIndex++;
+ }
+ if(isTable)
+ writer.RenderEndTag();
+ else
+ if(rowIndex != (rowsCount - 1) || (user.HasFooter && !outerTableImp))
+ writer.WriteFullBeginTag("br");
+ rowIndex++;
+ }
+ if(user.HasFooter)
+ {
+ if(isTable)
+ {
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ if(colsCount != 1)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle(ListItemType.Footer, -1);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Footer, -1, this, writer);
+ if(isTable)
+ {
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ }
+ }
+ if(ctrl != null)
+ {
+ ctrl.RenderEndTag(writer);
+ }
+ }
+
+ private void DoHorizontalRendering (HtmlTextWriter writer,
+ IRepeatInfoUser user,
+ Style controlStyle,
+ WebControl baseControl)
+ {
+ /* Based on DoVerticalRendering */
+ int total = user.RepeatedItemCount;
+ int colsCount = repeatColumns;
+ int rowsCount = 0;
+
+ if (colsCount == 0)
+ colsCount = total;
+ WebControl ctrl = null;
+ bool isTable = true;
+ bool hasSeps = user.HasSeparators;
+ if (!outerTableImp){
+ isTable = (RepeatLayout == RepeatLayout.Table);
+ ctrl = (isTable) ? new Table () : new WebControl (HtmlTextWriterTag.Span);
+ ctrl.ID = baseControl.ClientID;
+ ctrl.CopyBaseAttributes (baseControl);
+ ctrl.ApplyStyle (controlStyle);
+ ctrl.RenderBeginTag (writer);
+ }
+
+ Style itemStyle;
+ int colSpan = 0;
+ if (user.HasHeader){
+ if (isTable){
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+ if (rowsCount != 1){
+ colSpan = rowsCount;
+ if (hasSeps)
+ colSpan += rowsCount;
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan,
+ colSpan.ToString (NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle (ListItemType.Header, -1);
+ if (itemStyle != null)
+ itemStyle.AddAttributesToRender (writer);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+
+ user.RenderItem (ListItemType.Header, -1, this, writer);
+
+ if (isTable){
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ } else if (!outerTableImp)
+ writer.WriteFullBeginTag ("br");
+ }
+
+ for (int index = 0; index < total; index++){
+ if (isTable && index == 0)
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+
+ if (isTable){
+ itemStyle = user.GetItemStyle (ListItemType.Item, index);
+ if (itemStyle != null)
+ itemStyle.AddAttributesToRender(writer);
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+
+ user.RenderItem(ListItemType.Item, index, this, writer);
+ if (isTable)
+ writer.RenderEndTag ();
+
+ if (hasSeps && index != (total - 1)){
+ if (isTable){
+ itemStyle = user.GetItemStyle (ListItemType.Separator, index);
+ if (itemStyle != null)
+ itemStyle.AddAttributesToRender (writer);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+ user.RenderItem (ListItemType.Separator, index, this, writer);
+ if (isTable)
+ writer.RenderEndTag ();
+ }
+ rowsCount++;
+ if (rowsCount == total || index == (total - 1)) {
+ if (isTable)
+ writer.RenderEndTag ();
+ else if (rowsCount < total)
+ writer.WriteFullBeginTag ("br");
+ rowsCount = 0;
+ }
+ }
+
+ if (user.HasFooter){
+ if (isTable){
+ writer.RenderBeginTag (HtmlTextWriterTag.Tr);
+ if (colsCount != 1)
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan,
+ colSpan.ToString(NumberFormatInfo.InvariantInfo));
+
+ itemStyle = user.GetItemStyle (ListItemType.Footer, -1);
+ if(itemStyle != null)
+ itemStyle.AddAttributesToRender (writer);
+ writer.RenderBeginTag (HtmlTextWriterTag.Td);
+ }
+ user.RenderItem (ListItemType.Footer, -1, this, writer);
+ if (isTable){
+ writer.RenderEndTag ();
+ writer.RenderEndTag ();
+ }
+ }
+
+ if (ctrl != null)
+ ctrl.RenderEndTag(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs
new file mode 100755
index 00000000000..de1e81530e0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: RepeatLayout
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum RepeatLayout
+ {
+ Table,
+ Flow
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
new file mode 100644
index 00000000000..d5362c97fa7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
@@ -0,0 +1,377 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Repeater
+ *
+ * Author: Gaurav Vaish, Gonzalo Paniagua (gonzalo@ximian.com)
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.Web.Util;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("ItemCommand")]
+ [DefaultProperty("DataSource")]
+ //[Designer("??")]
+ [ParseChildren(true)]
+ [PersistChildren(false)]
+ public class Repeater : Control, INamingContainer
+ {
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+
+ private static readonly string ITEMCOUNT = "Repeater_Item_Count";
+
+ private ITemplate alternatingItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+ private ITemplate separatorTemplate;
+ private object dataSource;
+
+ private RepeaterItemCollection items;
+ private ArrayList itemsArrayList;
+
+ public Repeater(): base()
+ {
+ }
+
+ public event RepeaterCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ public event RepeaterItemEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ public event RepeaterItemEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ public virtual ITemplate AlternatingItemTemplate
+ {
+ get
+ {
+ return alternatingItemTemplate;
+ }
+ set
+ {
+ alternatingItemTemplate = value;
+ }
+ }
+
+ public override ControlCollection Controls
+ {
+ get
+ {
+ EnsureChildControls();
+ return base.Controls;
+ }
+ }
+
+ public virtual string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ dataSource = value;
+ }
+ }
+
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ }
+ }
+
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ }
+ }
+
+ public virtual RepeaterItemCollection Items
+ {
+ get
+ {
+ if(items != null)
+ {
+ if(itemsArrayList != null)
+ {
+ EnsureChildControls();
+ }
+ items = new RepeaterItemCollection(itemsArrayList);
+ }
+ return items;
+ }
+ }
+
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ }
+ }
+
+ public virtual ITemplate SeparatorTemplate
+ {
+ get
+ {
+ return separatorTemplate;
+ }
+ set
+ {
+ separatorTemplate = value;
+ }
+ }
+
+ public override void DataBind()
+ {
+ OnDataBinding(EventArgs.Empty);
+ }
+
+ protected override void CreateChildControls()
+ {
+ Controls.Clear();
+ if(ViewState[ITEMCOUNT] != null)
+ {
+ CreateControlHierarchy(false);
+ } else
+ {
+ itemsArrayList = new ArrayList();
+ }
+ ClearChildViewState();
+ }
+
+ private RepeaterItem CreateItem (int itemIndex,
+ ListItemType itemType,
+ bool dataBind,
+ object dataItem)
+ {
+ RepeaterItem repeaterItem = new RepeaterItem (itemIndex, itemType);
+ RepeaterItemEventArgs repeaterEventArgs = new RepeaterItemEventArgs (repeaterItem);
+ InstantiateItem (repeaterItem);
+ if (dataBind)
+ repeaterItem.DataItem = dataItem;
+ OnItemCreated (repeaterEventArgs);
+ Controls.Add (repeaterItem);
+ if (dataBind) {
+ repeaterItem.DataBind ();
+ OnItemDataBound (repeaterEventArgs);
+ repeaterItem.DataItem = null;
+ }
+ return repeaterItem;
+ }
+
+ private void InstantiateItem (RepeaterItem item)
+ {
+ ITemplate template;
+ switch (item.ItemType) {
+ case ListItemType.Header:
+ template = this.headerTemplate;
+ break;
+ case ListItemType.Footer:
+ template = this.footerTemplate;
+ break;
+ case ListItemType.Item:
+ template = this.itemTemplate;
+ break;
+ case ListItemType.AlternatingItem:
+ template = this.alternatingItemTemplate;
+ break;
+ case ListItemType.Separator:
+ template = this.separatorTemplate;
+ break;
+ default:
+ throw new HttpException ("Unknown ListItemType: " + item.ItemType);
+ }
+
+ template.InstantiateIn (item);
+ }
+
+ protected virtual void CreateControlHierarchy (bool useDataSource)
+ {
+ ArrayList itemList = new ArrayList ();
+ items = new RepeaterItemCollection (itemList);
+ IEnumerable ds = null;
+ if (useDataSource)
+ ds = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+
+ if (!useDataSource) {
+ int itemCount = (int) ViewState [ITEMCOUNT];
+ if (itemCount != -1)
+ ds = new ArrayList (itemCount);
+ }
+
+ if (ds == null)
+ return;
+
+ if (headerTemplate != null)
+ CreateItem (-1, ListItemType.Header, useDataSource, null);
+
+ bool even = true;
+ int index = 0;
+ foreach (object item in ds){
+ if (separatorTemplate != null && index > 0)
+ CreateItem (index - 1, ListItemType.Separator, useDataSource, null);
+
+ RepeaterItem repeaterItem;
+ ListItemType lType;
+ if (!even && alternatingItemTemplate != null)
+ lType = ListItemType.AlternatingItem;
+ else
+ lType = ListItemType.Item;
+
+ repeaterItem = CreateItem (index, lType, useDataSource, item);
+ itemList.Add (repeaterItem);
+ index++;
+ even = !even;
+ }
+
+ if (footerTemplate != null)
+ CreateItem (-1, ListItemType.Footer, useDataSource, null);
+ }
+
+ protected override bool OnBubbleEvent(object sender, EventArgs e)
+ {
+ bool retVal = false;
+ if(e is RepeaterCommandEventArgs)
+ {
+ OnItemCommand((RepeaterCommandEventArgs)e);
+ retVal = true;
+ }
+ return retVal;
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ Controls.Clear();
+ ClearChildViewState();
+ CreateControlHierarchy(true);
+ ChildControlsCreated = true;
+ }
+
+ protected virtual void OnItemCommand(RepeaterCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterCommandEventHandler rceh = (RepeaterCommandEventHandler)
+ Events [ItemCommandEvent];
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual void OnItemCreated(RepeaterItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterItemEventHandler rceh = (RepeaterItemEventHandler)
+ Events [ItemCreatedEvent];
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual void OnItemDataBound(RepeaterItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterItemEventHandler rceh = (RepeaterItemEventHandler)
+ Events [ItemDataBoundEvent];
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual RepeaterItem CreateItem (int itemIndex, ListItemType itemType)
+ {
+ return new RepeaterItem (itemIndex, itemType);
+ }
+
+ protected virtual void InitializeItem (RepeaterItem item)
+ {
+ InstantiateItem (item);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
new file mode 100644
index 00000000000..1d2e5c298ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
@@ -0,0 +1,46 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: RepeaterCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterCommandEventArgs: CommandEventArgs
+ {
+ private RepeaterItem rItem;
+ private object cmdSrc;
+
+ public RepeaterCommandEventArgs(RepeaterItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ rItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public RepeaterItem Item
+ {
+ get
+ {
+ return rItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
new file mode 100644
index 00000000000..1d93d3d8a67
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void RepeaterCommandEventHandler(object sender, RepeaterCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
new file mode 100644
index 00000000000..69adc3bb369
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
@@ -0,0 +1,72 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: RepeaterItem
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ public class RepeaterItem: Control, INamingContainer
+ {
+ private int itemIndex;
+ private ListItemType itemType;
+ private object dataItem;
+
+ public RepeaterItem(int itemIndex, ListItemType itemType)
+ {
+ this.itemIndex = itemIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ RepeaterCommandEventArgs rcea = new RepeaterCommandEventArgs(this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent(source, rcea);
+ return true;
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
new file mode 100644
index 00000000000..a77a5549562
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeaterItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public RepeaterItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public RepeaterItem this[int index]
+ {
+ get
+ {
+ return (RepeaterItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(RepeaterItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs
new file mode 100644
index 00000000000..4ccd5dc1269
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeaterItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterItemEventArgs : EventArgs
+ {
+ private RepeaterItem item;
+
+ public RepeaterItemEventArgs(RepeaterItem item)
+ {
+ this.item = item;
+ }
+
+ public RepeaterItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs
new file mode 100644
index 00000000000..73f7913171c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void RepeaterItemEventHandler(object sender, RepeaterItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
new file mode 100644
index 00000000000..907d1ccc7b2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
@@ -0,0 +1,60 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RequiredFieldValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" "
+ + "ErrorMessage=\"RequiredFieldValidator\">"
+ + "</{0}:RequiredFieldValidator>")]
+ public class RequiredFieldValidator : BaseValidator
+ {
+ public RequiredFieldValidator(): base()
+ {
+ }
+
+ public string InitialValue
+ {
+ get
+ {
+ object o = ViewState["InitialValue"];
+ if(o != null)
+ return (String)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["InitialValue"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+ writer.AddAttribute("initialvalue", InitialValue);
+ }
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string val = GetControlValidationValue(ControlToValidate);
+ if(val != null)
+ {
+ return (val.Trim() != InitialValue.Trim());
+ }
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
new file mode 100644
index 00000000000..dc4f807dfdb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
@@ -0,0 +1,125 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: SelectedDatesCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class SelectedDatesCollection : ICollection, IEnumerable
+ {
+ ArrayList dateList;
+
+ public SelectedDatesCollection(ArrayList dateList)
+ {
+ this.dateList = dateList;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return dateList.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DateTime this[int index]
+ {
+ get
+ {
+ return (DateTime)(dateList[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(DateTime date)
+ {
+ dateList.Add(date);
+ }
+
+ public void Clear()
+ {
+ dateList.Clear();
+ }
+
+ public bool Contains(DateTime date)
+ {
+ return dateList.Contains(date);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DateTime current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return dateList.GetEnumerator();
+ }
+
+ public void Remove(DateTime date)
+ {
+ dateList.Remove(date);
+ }
+
+ public void SelectRange(DateTime fromDate, DateTime toDate)
+ {
+ dateList.Clear();
+ //FIXME: Probable bug in MS implementation. It SHOULD NOT
+ // clear the list if fromDate > toDate
+ if(fromDate > toDate)
+ {
+ return;
+ }
+ DateTime local = fromDate;
+ do
+ {
+ dateList.Add(local);
+ local = local.AddDays(1);
+ } while(local < toDate);
+ }
+
+ internal ArrayList GetDateList ()
+ {
+ return dateList;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs
new file mode 100644
index 00000000000..1bfd0aabfd0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs
@@ -0,0 +1,42 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ServerValidateEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class ServerValidateEventArgs : EventArgs
+ {
+ private bool isValid;
+ private string value;
+
+ public ServerValidateEventArgs(string value, bool isValid)
+ {
+ this.value = value;
+ this.isValid = isValid;
+ }
+
+ public bool IsValid
+ {
+ get { return isValid; }
+ set { isValid = value; }
+ }
+
+ public string Value
+ {
+ get { return value; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs
new file mode 100644
index 00000000000..b37ffd5f26f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void ServerValidateEventHandler(object sender, ServerValidateEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
new file mode 100644
index 00000000000..3aea32ef075
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
@@ -0,0 +1,539 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Style
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Drawing;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class Style : Component , IStateManager
+ {
+ internal static int MARKED = (0x01 << 0);
+ internal static int BACKCOLOR = (0x01 << 1);
+ internal static int BORDERCOLOR = (0x01 << 2);
+ internal static int BORDERSTYLE = (0x01 << 3);
+ internal static int BORDERWIDTH = (0x01 << 4);
+ internal static int CSSCLASS = (0x01 << 5);
+ internal static int FORECOLOR = (0x01 << 6);
+ internal static int HEIGHT = (0x01 << 7);
+ internal static int WIDTH = (0x01 << 8);
+ internal static int FONT_BOLD = (0x01 << 9);
+ internal static int FONT_ITALIC = (0x01 << 10);
+ internal static int FONT_NAMES = (0x01 << 11);
+ internal static int FONT_SIZE = (0x01 << 12);
+ internal static int FONT_STRIKE = (0x01 << 13);
+ internal static int FONT_OLINE = (0x01 << 14);
+ internal static int FONT_ULINE = (0x01 << 15);
+
+ internal static string selectionBitString = "_SystemWebUIWebControlsStyle_SBS";
+
+ private StateBag viewState;
+ private int selectionBits;
+ private bool selfStateBag;
+
+ private FontInfo font;
+
+ public Style()
+ {
+ Initialize(null);
+ selfStateBag = true;
+ }
+
+ public Style(StateBag bag): base()
+ {
+ Initialize(bag);
+ selfStateBag = false;
+ }
+
+ private void Initialize(StateBag bag)
+ {
+ viewState = bag;
+ selectionBits = 0x00;
+ }
+
+ protected internal StateBag ViewState
+ {
+ get
+ {
+ if(viewState == null)
+ {
+ viewState = new StateBag(false);
+ if(IsTrackingViewState)
+ viewState.TrackViewState();
+ }
+ return viewState;
+ }
+ }
+
+ internal bool IsSet(int bit)
+ {
+ return ( (selectionBits & bit) != 0x00);
+ }
+
+ internal virtual void Set(int bit)
+ {
+ selectionBits |= bit;
+ if(IsTrackingViewState)
+ selectionBits |= MARKED;
+ }
+
+ public Color BackColor
+ {
+ get
+ {
+ if(IsSet(BACKCOLOR))
+ return (Color)ViewState["BackColor"];
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["BackColor"] = value;
+ Set(BACKCOLOR);
+ }
+ }
+
+ public Color BorderColor
+ {
+ get
+ {
+ if(IsSet(BORDERCOLOR))
+ return (Color)ViewState["BorderColor"];
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["BorderColor"] = value;
+ Set(BORDERCOLOR);
+ }
+ }
+
+ public BorderStyle BorderStyle
+ {
+ get
+ {
+ if(IsSet(BORDERSTYLE))
+ return (BorderStyle)ViewState["BorderStyle"];
+ return BorderStyle.NotSet;
+ }
+ set
+ {
+ ViewState["BorderStyle"] = value;
+ Set(BORDERSTYLE);
+ }
+ }
+
+ public Unit BorderWidth
+ {
+ get
+ {
+ if(IsSet(BORDERWIDTH))
+ return (Unit)ViewState["BorderWidth"];
+ return Unit.Empty;
+ }
+ set
+ {
+ ViewState["BorderWidth"] = value;
+ Set(BORDERWIDTH);
+ }
+ }
+
+ public string CssClass
+ {
+ get
+ {
+ if(IsSet(CSSCLASS))
+ return (string)ViewState["CssClass"];
+ return string.Empty;
+ }
+ set
+ {
+ ViewState["CssClass"] = value;
+ Set(CSSCLASS);
+ }
+ }
+
+ public Color ForeColor
+ {
+ get
+ {
+ if(IsSet(FORECOLOR))
+ return (Color)ViewState["ForeColor"];
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["ForeColor"] = value;
+ Set(FORECOLOR);
+ }
+ }
+
+ public Unit Height
+ {
+ get
+ {
+ if(IsSet(HEIGHT))
+ return (Unit)ViewState["Height"];
+ return Unit.Empty;
+ }
+ set
+ {
+ ViewState["Height"] = value;
+ Set(HEIGHT);
+ }
+ }
+
+ public Unit Width
+ {
+ get
+ {
+ if(IsSet(WIDTH))
+ return (Unit)ViewState["Width"];
+ return Unit.Empty;
+ }
+ set
+ {
+ ViewState["Width"] = value;
+ Set(WIDTH);
+ }
+ }
+
+ public FontInfo Font
+ {
+ get
+ {
+ if(font==null)
+ font = new FontInfo(this);
+ return font;
+ }
+ }
+
+ protected internal virtual bool IsEmpty
+ {
+ get { return (selectionBits == 0); }
+ }
+
+ private void AddColor(HtmlTextWriter writer, HtmlTextWriterStyle style, Color color)
+ {
+ if(!color.IsEmpty)
+ writer.AddStyleAttribute(style, ColorTranslator.ToHtml(color));
+ }
+
+ private static string StringArrayToString(string[] array, char separator)
+ {
+ if(array.Length == 0)
+ return String.Empty;
+ StringBuilder sb = new StringBuilder();
+ for(int i=0; i < array.Length; i++)
+ {
+ if(i==0)
+ {
+ sb.Append(array[0]);
+ } else
+ {
+ sb.Append(separator);
+ sb.Append(array[i]);
+ }
+ }
+ return sb.ToString();
+ }
+
+ public void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer, null);
+ }
+
+ public virtual void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ if(IsSet(BACKCOLOR))
+ {
+ AddColor(writer, HtmlTextWriterStyle.BackgroundColor, (Color)ViewState["BackColor"]);
+ }
+
+ if(IsSet(BORDERCOLOR))
+ {
+ AddColor(writer, HtmlTextWriterStyle.BorderColor, (Color)ViewState["BorderColor"]);
+ }
+
+ if(IsSet(FORECOLOR))
+ {
+ AddColor(writer, HtmlTextWriterStyle.Color, (Color)ViewState["ForeColor"]);
+ }
+
+ if(IsSet(CSSCLASS))
+ {
+ string cssClass = (string)ViewState["CssClass"];
+ if(cssClass.Length > 0)
+ writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
+ }
+
+ if(!BorderWidth.IsEmpty)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, BorderWidth.ToString(CultureInfo.InvariantCulture));
+ if(BorderStyle!=BorderStyle.NotSet)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, Enum.Format(typeof(BorderStyle), BorderStyle, "G"));
+ } else
+ {
+ if(BorderWidth.Value != 0.0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
+ }
+ }
+ } else
+ {
+ if(BorderStyle!=BorderStyle.NotSet)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, Enum.Format(typeof(BorderStyle), BorderStyle, "G"));
+ }
+ }
+
+ if(Font.Names.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, StringArrayToString(Font.Names,','));
+ }
+
+ if(!Font.Size.IsEmpty)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, Font.Size.ToString(CultureInfo.InvariantCulture));
+ }
+
+ if(Font.Bold)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
+ }
+
+ if(Font.Italic)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontStyle, "italic");
+ }
+
+ string textDecoration = String.Empty;
+ if(Font.Strikeout)
+ {
+ textDecoration += " strikeout";
+ }
+ if(Font.Underline)
+ {
+ textDecoration += " underline";
+ }
+ if(Font.Overline)
+ {
+ textDecoration += " overline";
+ }
+ if(textDecoration.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, textDecoration);
+ }
+
+ Unit u = Unit.Empty;
+ if(IsSet(HEIGHT))
+ {
+ u = (Unit)ViewState["Height"];
+ writer.AddStyleAttribute(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
+ }
+ if(IsSet(WIDTH))
+ {
+ u = (Unit)ViewState["Width"];
+ writer.AddStyleAttribute(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
+ }
+ }
+
+ public virtual void CopyFrom(Style source)
+ {
+ if(source!=null && !source.IsEmpty)
+ {
+ Font.CopyFrom(source.Font);
+ if(source.Height!=Unit.Empty)
+ {
+ Height = source.Height;
+ }
+ if(source.Width!=Unit.Empty)
+ {
+ Width = source.Width;
+ }
+ if(source.BorderColor!=Color.Empty)
+ {
+ BorderColor = source.BorderColor;
+ }
+ if(source.BorderWidth!=Unit.Empty)
+ {
+ BorderWidth = source.BorderWidth;
+ }
+ if(source.BorderStyle!=BorderStyle.NotSet)
+ {
+ BorderStyle = source.BorderStyle;
+ }
+ if(source.BackColor!=Color.Empty)
+ {
+ BackColor = source.BackColor;
+ }
+ if(source.CssClass!=String.Empty)
+ {
+ CssClass = source.CssClass;
+ }
+ if(source.ForeColor!=Color.Empty)
+ {
+ ForeColor = source.ForeColor;
+ }
+ }
+ }
+
+ public virtual void MergeWith(Style with)
+ {
+ if(with!=null && !with.IsEmpty)
+ {
+ if(IsEmpty)
+ {
+ CopyFrom(with);
+ return;
+ }
+
+ Font.MergeWith(with.Font);
+ if(!IsSet(HEIGHT) && with.Height!=Unit.Empty)
+ {
+ Height = with.Height;
+ }
+ if(!IsSet(WIDTH) && with.Width!=Unit.Empty)
+ {
+ Width = with.Width;
+ }
+ if(!IsSet(BORDERCOLOR) && with.BorderColor!=Color.Empty)
+ {
+ BorderColor = with.BorderColor;
+ }
+ if(!IsSet(BORDERWIDTH) && with.BorderWidth!=Unit.Empty)
+ {
+ BorderWidth = with.BorderWidth;
+ }
+ if(!IsSet(BORDERSTYLE) && with.BorderStyle!=BorderStyle.NotSet)
+ {
+ BorderStyle = with.BorderStyle;
+ }
+ if(!IsSet(BACKCOLOR) && with.BackColor!=Color.Empty)
+ {
+ BackColor = with.BackColor;
+ }
+ if(!IsSet(CSSCLASS) && with.CssClass!=String.Empty)
+ {
+ CssClass = with.CssClass;
+ }
+ if(!IsSet(FORECOLOR) && with.ForeColor!=Color.Empty)
+ {
+ ForeColor = with.ForeColor;
+ }
+ }
+ }
+
+ public virtual void Reset()
+ {
+ if(IsSet(BACKCOLOR))
+ ViewState.Remove("BackColor");
+ if(IsSet(BORDERCOLOR))
+ ViewState.Remove("BorderColor");
+ if(IsSet(BORDERSTYLE))
+ ViewState.Remove("BorderStyle");
+ if(IsSet(BORDERWIDTH))
+ ViewState.Remove("BorderWidth");
+ if(IsSet(CSSCLASS))
+ ViewState.Remove("CssClass");
+ if(IsSet(FORECOLOR))
+ ViewState.Remove("ForeColor");
+ if(IsSet(HEIGHT))
+ ViewState.Remove("Height");
+ if(IsSet(WIDTH))
+ ViewState.Remove("Width");
+ if(font!=null)
+ font.Reset();
+ selectionBits = 0x00;
+ }
+
+ protected bool IsTrackingViewState
+ {
+ get
+ {
+ return ( (selectionBits & MARKED) != 0x00 );
+ }
+ }
+
+ protected internal virtual void TrackViewState()
+ {
+ if(viewState!=null)
+ ViewState.TrackViewState();
+ Set(MARKED);
+ }
+
+ protected internal virtual object SaveViewState()
+ {
+ if(viewState != null)
+ {
+ if(IsSet(MARKED))
+ {
+ ViewState[selectionBitString] = selectionBits;
+ }
+ if(selfStateBag)
+ {
+ return ViewState.SaveViewState();
+ }
+ }
+ return null;
+ }
+
+ protected internal void LoadViewState(object state)
+ {
+ if (state != null && selfStateBag)
+ ViewState.LoadViewState(state);
+
+ if (viewState != null) {
+ object o = ViewState[selectionBitString];
+ if (o != null)
+ selectionBits = (int) o;
+ }
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+
+ public override string ToString()
+ {
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TODO b/mcs/class/System.Web/System.Web.UI.WebControls/TODO
new file mode 100755
index 00000000000..05abe9b822a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TODO
@@ -0,0 +1,156 @@
+All Classes, Interfaces, Structures, Delegates and Enumerations
+
+
+<attributesIssue>
+ Attributes may have to be supplied to the classes. Some of the attributes
+ include DefaultPropertyAttribute, ToolboxItemAttribute, ParseChildrenAttribute
+ (to be added to System.Web.UI) etc. Currently, I have not taken care of these
+ aspects. They are to be handled later on.
+</attributesIssue>
+
+<disposableItemsIssue>
+ I have not taken care of any disposing issues that may be involved. But I think
+ it will not be a problem since I am no where using unmanaged code.
+</disposableItemsIssue>
+
+<legends>
+*: Completed
+&: Work in progress. See <item-name>.cs file for maintainer's name
+</legends>
+
+* AdCreatedEventArgs
+* AdRotator
+* BaseCompareValidator
+* BaseDataList
+& BaseValidator
+& BoundColumn
+* Button
+* ButtonColumn
+& Calendar
+* CalendarDay
+* CheckBox
+* CheckBoxList
+* CommandEventArgs
+& CompareValidator
+* CustomValidator
+& DataGrid
+* DataGridColumn
+* DataGridColumnCollection
+* DataGridCommandEventArgs
+& DataGridItem
+* DataGridItemCollection
+* DataGridItemEventArgs
+* DataGridPageChangedEventArgs
+& DataGridPagerStyle
+* DataGridShortCommandEventArgs
+* DataKeyCollection
+& DataList
+* DataListCommandEventArgs
+& DataListItem
+* DataListItemCollecton
+* DataListItemEventArgs
+* DayRenderEventArgs
+* DropDownList
+& EditCommandColumn
+* FontInfo
+* FontNamesConverter
+& FontUnitConverter
+* HyperLink
+* HyperLinkColumn
+* HyperLinkControlBuilder
+* Image
+* ImageButton
+* Label
+* LabelControlBuilder
+* LinkButton
+* LinkButtonControlBuilder
+* ListBox
+* ListControl
+* ListItem
+* ListItemCollection
+* ListItemControlBuilder
+* Literal
+* LiteralControlBuilder
+* MonthChangedEventArgs
+* PagedDataSource
+* Panel
+* PlaceHolder
+* PlaceHolderControlBuilder
+* RadioButton
+& RadioButtonList
+* RangeValidator
+* RegularExpressionValidator
+& Repeater
+* RepeaterCommandEventArgs
+& RepeaterItem
+* RepeaterItemCollection
+* RepeaterItemEventArgs
+& RepeatInfo
+* RequiredFieldValidator
+* SelectedDatesCollection
+* ServerValidateEventArgs
+* Style
+* Table
+* TableCell
+* TableCellCollection
+* TableCellControlBuilder
+* TableHeaderCell
+* TableItemStyle
+* TableRow
+* TableRowCollection
+* TableStyle
+* TargetConverter
+* TemplateColumn
+& TextBox
+* TextBoxControlBuilder
+* UnitConverter
+* ValidatedControlConverter
+& ValidationSummary
+& WebColorConverter
+& WebControl
+& Xml
+
+* IRepeatInfoUser
+
+* FontUnit
+* Unit
+
+* AdCreatedEventHandler
+* CommandEventHandler
+* DataGridCommandEventHandler
+* DataGridItemEventHandler
+* DataGridPageChangedEventHandler
+* DataGridSortCommandEventHandler
+* DataListCommandEventHandler
+* DataListItemEventHandler
+* DayRenderEventHandler
+* MonthChangedEventHandler
+* RepeaterCommandEventHandler
+* RepeaterItemEventHandler
+* ServerValidateEventHandler
+
+* BorderStyle
+* ButtonColumnType
+* CalendarSelectionMode
+* DayNameFormat
+* FirstDayOfWeek
+* FontSize
+* GridLines
+* HorizontalAlign
+* ImageAlign
+* ListItemType
+* ListSelectionMode
+* NextPrevFormat
+* PagerMode
+* PagerPosition
+* RepeatDirection
+* RepeatLayout
+* TextAlign
+* TextBoxMode
+* TitleFormat
+* UnitType
+* ValidationCompareOperator
+* ValidationDataType
+* ValidationSummaryDisplayMode
+* ValidatorDisplay
+* VerticalAlign
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
new file mode 100644
index 00000000000..16d1cf25f18
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
@@ -0,0 +1,159 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Table
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Rows")]
+ //[Designer("??")]
+ [ParseChildren(true, "Rows")]
+ public class Table: WebControl
+ {
+ private TableRowCollection rows;
+
+ private class TableRowControlCollection : ControlCollection
+ {
+ public TableRowControlCollection (Control owner) : base (owner)
+ {
+ }
+
+ public override void Add (Control child)
+ {
+ if (!(child is TableRow))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "Table",
+ child.GetType ().Name.ToString ()));
+ base.Add (child);
+ }
+
+ public override void AddAt(int index, Control child)
+ {
+ if (!(child is TableRow))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "Table",
+ child.GetType ().Name.ToString ()));
+ base.AddAt (index, child);
+ }
+ }
+
+ public Table () : base (HtmlTextWriterTag.Table)
+ {
+ }
+
+ public virtual string BackImageUrl
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).BackImageUrl;
+ return String.Empty;
+ }
+
+ set { ((TableStyle) ControlStyle).BackImageUrl = value; }
+ }
+
+ public virtual int CellPadding
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).CellPadding;
+ return -1;
+ }
+
+ set { ((TableStyle) ControlStyle).CellPadding = value; }
+ }
+
+ public virtual int CellSpacing
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).CellSpacing;
+ return -1;
+ }
+
+ set { ((TableStyle) ControlStyle).CellSpacing = value; }
+ }
+
+ public virtual GridLines GridLines
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).GridLines;
+ return GridLines.None;
+ }
+
+ set { ((TableStyle) ControlStyle).GridLines = value; }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableStyle) ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+
+ set { ((TableStyle) ControlStyle).HorizontalAlign = value; }
+ }
+
+ public virtual TableRowCollection Rows
+ {
+ get {
+ if (rows == null)
+ rows = new TableRowCollection (this);
+ return rows;
+ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ if(!BorderColor.IsEmpty)
+ writer.AddAttribute (HtmlTextWriterAttribute.Bordercolor,
+ ColorTranslator.ToHtml (BorderColor));
+
+ Unit bw = BorderWidth;
+ if (GridLines == GridLines.None)
+ bw = Unit.Pixel (0);
+ else if (bw.IsEmpty || bw.Type == UnitType.Pixel)
+ bw = Unit.Pixel(1);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Border,
+ ((int) bw.Value).ToString (NumberFormatInfo.InvariantInfo));
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new TableRowControlCollection (this);
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ return new TableStyle (ViewState);
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ foreach (TableRow current in Rows)
+ current.RenderControl (writer);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
new file mode 100644
index 00000000000..cf8c19ae151
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
@@ -0,0 +1,147 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCell
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ [ToolboxItem(false)]
+ [ControlBuilder(typeof(TableCellControlBuilder))]
+ [ParseChildren(false)]
+ [PersistChildren(true)]
+ public class TableCell: WebControl
+ {
+ public TableCell () : base (HtmlTextWriterTag.Td)
+ {
+ PreventAutoID ();
+ }
+
+ internal TableCell (HtmlTextWriterTag tag) : base (tag)
+ {
+ PreventAutoID ();
+ }
+
+ public virtual int ColumnSpan
+ {
+ get {
+ object o = ViewState ["ColumnSpan"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set { ViewState ["ColumnSpan"] = value; }
+ }
+
+ public virtual int RowSpan
+ {
+ get {
+ object o = ViewState ["RowSpan"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set { ViewState ["RowSpan"] = value; }
+ }
+
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableItemStyle) ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+ set { ((TableItemStyle) ControlStyle).HorizontalAlign = value; }
+ }
+
+ public virtual VerticalAlign VerticalAlign
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableItemStyle) ControlStyle).VerticalAlign;
+ return VerticalAlign.NotSet;
+ }
+
+ set { ((TableItemStyle) ControlStyle).VerticalAlign = value; }
+ }
+
+ public virtual bool Wrap
+ {
+ get {
+ if (ControlStyleCreated)
+ return ((TableItemStyle) ControlStyle).Wrap;
+ return true;
+ }
+ set { ((TableItemStyle) ControlStyle).Wrap = value; }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender (writer);
+ if (ColumnSpan > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan,
+ ColumnSpan.ToString (NumberFormatInfo.InvariantInfo));
+
+ if (RowSpan > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Rowspan,
+ RowSpan.ToString (NumberFormatInfo.InvariantInfo));
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (HasControls ()){
+ base.AddParsedSubObject (obj);
+ return;
+ }
+
+ if (obj is LiteralControl){
+ Text = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ string text = Text;
+ if (text.Length > 0){
+ Text = String.Empty;
+ base.AddParsedSubObject (new LiteralControl (text));
+ }
+
+ base.AddParsedSubObject (obj);
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ return new TableItemStyle (ViewState);
+ }
+
+ protected override void RenderContents (HtmlTextWriter writer)
+ {
+ if (HasControls ())
+ base.RenderContents (writer);
+ else
+ writer.Write (Text);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs
new file mode 100644
index 00000000000..c3b442b91de
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs
@@ -0,0 +1,181 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCellCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ //[Editor("??")]
+ public sealed class TableCellCollection: IList, ICollection, IEnumerable
+ {
+ private TableRow owner;
+
+ internal TableCellCollection(TableRow owner)
+ {
+ if(owner == null)
+ {
+ throw new ArgumentNullException();
+ }
+ this.owner = owner;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return owner.Controls.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public TableCell this[int index]
+ {
+ get
+ {
+ return (TableCell)owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int Add(TableCell cell)
+ {
+ AddAt(-1, cell);
+ return owner.Controls.Count;
+ }
+
+ public void AddAt(int index, TableCell cell)
+ {
+ owner.Controls.AddAt(index, cell);
+ }
+
+ public void AddRange(TableCell[] cells)
+ {
+ foreach(TableCell cell in cells)
+ {
+ Add(cell);
+ }
+ }
+
+ public void Clear()
+ {
+ if(owner.HasControls())
+ {
+ owner.Controls.Clear();
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object cell in this)
+ {
+ array.SetValue(cell, index++);
+ }
+ }
+
+ public int GetCellIndex(TableCell cell)
+ {
+ if(!owner.HasControls())
+ {
+ return -1;
+ }
+ return owner.Controls.IndexOf(cell);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return owner.Controls.GetEnumerator();
+ }
+
+ public void Remove(TableCell cell)
+ {
+ owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index)
+ {
+ owner.Controls.RemoveAt(index);
+ }
+
+ int IList.Add(object o)
+ {
+ return Add((TableCell)o);
+ }
+
+ bool IList.Contains(object o)
+ {
+ return owner.Controls.Contains((TableCell)o);
+ }
+
+ int IList.IndexOf(object o)
+ {
+ return owner.Controls.IndexOf((TableCell)o);
+ }
+
+ void IList.Insert(int index, object o)
+ {
+ owner.Controls.AddAt(index, (TableCell)o);
+ }
+
+ void IList.Remove(object o)
+ {
+ owner.Controls.Remove((TableCell)o);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ RemoveAt(index);
+ AddAt(index, (TableCell)value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
new file mode 100644
index 00000000000..6363462fa51
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCellControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableCellControlBuilder: ControlBuilder
+ {
+ public TableCellControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
new file mode 100644
index 00000000000..e3ccb0c1a93
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableHeaderCell
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableHeaderCell: TableCell
+ {
+ public TableHeaderCell(): base(HtmlTextWriterTag.Th)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
new file mode 100644
index 00000000000..cddc73434aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
@@ -0,0 +1,176 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableItemStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableItemStyle: Style
+ {
+ private static int H_ALIGN = (0x01 << 16);
+ private static int V_ALIGN = (0x01 << 17);
+ private static int WRAP = (0x01 << 18);
+
+ public TableItemStyle(): base()
+ {
+ }
+
+ public TableItemStyle(StateBag bag): base(bag)
+ {
+ }
+
+ [Bindable(true)]
+ [DefaultValue(HorizontalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_HorizontalAlign")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(IsSet(H_ALIGN))
+ return (HorizontalAlign)ViewState["HorizontalAlign"];
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["HorizontalAlign"] = value;
+ Set(H_ALIGN);
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(VerticalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_VerticalAlign")]
+ public virtual VerticalAlign VerticalAlign
+ {
+ get
+ {
+ if(IsSet(V_ALIGN))
+ return (VerticalAlign)ViewState["VerticalAlign"];
+ return VerticalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(VerticalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["VerticalAlign"] = value;
+ Set(V_ALIGN);
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(VerticalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_Wrap")]
+ public virtual bool Wrap
+ {
+ get
+ {
+ if(IsSet(WRAP))
+ return (bool)ViewState["Wrap"];
+ return true;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ }
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s!=null && s is TableItemStyle && !s.IsEmpty)
+ {
+ base.CopyFrom(s);
+ TableItemStyle from = (TableItemStyle)s;
+ if(from.IsSet(H_ALIGN))
+ {
+ HorizontalAlign = from.HorizontalAlign;
+ }
+ if(from.IsSet(V_ALIGN))
+ {
+ VerticalAlign = from.VerticalAlign;
+ }
+ if(from.IsSet(WRAP))
+ {
+ Wrap = from.Wrap;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s!=null && s is TableItemStyle && !s.IsEmpty)
+ {
+ base.MergeWith(s);
+ TableItemStyle with = (TableItemStyle)s;
+ if(with.IsSet(H_ALIGN) && !IsSet(H_ALIGN))
+ {
+ HorizontalAlign = with.HorizontalAlign;
+ }
+ if(with.IsSet(V_ALIGN) && !IsSet(V_ALIGN))
+ {
+ VerticalAlign = with.VerticalAlign;
+ }
+ if(with.IsSet(WRAP) && !IsSet(WRAP))
+ {
+ Wrap = with.Wrap;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(H_ALIGN))
+ ViewState.Remove("HorizontalAlign");
+ if(IsSet(V_ALIGN))
+ ViewState.Remove("VerticalAlign");
+ if(IsSet(WRAP))
+ ViewState.Remove("Wrap");
+ base.Reset();
+ }
+
+ public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ base.AddAttributesToRender(writer, owner);
+ if(!Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ // Temporarily commented out. I'm having problems in cygwin.
+ //writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, HorizontalAlign.ToString ());
+ }
+ if(VerticalAlign != VerticalAlign.NotSet)
+ {
+ // Temporarily commented out. I'm having problems in cygwin.
+ //writer.AddAttribute(HtmlTextWriterAttribute.Valign, TypeDescriptor.GetConverter(typeof(VerticalAlign)).ConvertToString(VerticalAlign));
+ writer.AddAttribute(HtmlTextWriterAttribute.Valign, VerticalAlign.ToString ());
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs
new file mode 100644
index 00000000000..a0a1d82c922
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs
@@ -0,0 +1,99 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableRow
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Cells")]
+ [ParseChildren(true, "Cells")]
+ public class TableRow: WebControl
+ {
+ private TableCellCollection cells;
+
+ public TableRow() : base (HtmlTextWriterTag.Tr)
+ {
+ PreventAutoID ();
+ }
+
+ public virtual TableCellCollection Cells
+ {
+ get {
+ if (cells == null)
+ cells = new TableCellCollection (this);
+ return cells;
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get {
+ object o = ViewState ["HorizontalAlign"];
+ return (o == null) ? HorizontalAlign.NotSet : (HorizontalAlign) o;
+ }
+
+ set { ViewState ["HorizontalAlign"] = value; }
+ }
+
+ public virtual VerticalAlign VerticalAlign
+ {
+ get {
+ object o = ViewState ["VerticalAlign"];
+ return (o == null) ? VerticalAlign.NotSet : (VerticalAlign) o;
+ }
+
+ set { ViewState ["VerticalAlign"] = value; }
+ }
+
+ protected override Style CreateControlStyle ()
+ {
+ return new TableItemStyle (ViewState);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new CellControlCollection (this);
+ }
+
+ protected class CellControlCollection : ControlCollection
+ {
+ internal CellControlCollection (Control owner) : base (owner)
+ {
+ }
+
+ public override void Add (Control child)
+ {
+ if (!(child is TableCell))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "TableRow",
+ GetType ().Name.ToString ()));
+ base.Add (child);
+ }
+
+ public override void AddAt(int index, Control child)
+ {
+ if (!(child is TableCell))
+ throw new ArgumentException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type",
+ "TableRow",
+ GetType ().Name.ToString ()));
+ base.AddAt (index, child);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs
new file mode 100644
index 00000000000..b2db6123249
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs
@@ -0,0 +1,179 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableRowCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TableRowCollection: IList, ICollection, IEnumerable
+ {
+ Table owner;
+
+ internal TableRowCollection(Table owner)
+ {
+ if(owner == null)
+ {
+ throw new ArgumentNullException();
+ }
+ this.owner = owner;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return owner.Controls.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public TableRow this[int index]
+ {
+ get
+ {
+ return (TableRow)owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int Add(TableRow row)
+ {
+ AddAt(-1, row);
+ return owner.Controls.Count;
+ }
+
+ public void AddAt(int index, TableRow row)
+ {
+ owner.Controls.AddAt(index, row);
+ }
+
+ public void AddRange(TableRow[] rows)
+ {
+ foreach(TableRow row in rows)
+ {
+ Add(row);
+ }
+ }
+
+ public void Clear()
+ {
+ if(owner.HasControls())
+ {
+ owner.Controls.Clear();
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public int GetRowIndex(TableRow row)
+ {
+ if(!owner.HasControls())
+ {
+ return -1;
+ }
+ return owner.Controls.IndexOf(row);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return owner.Controls.GetEnumerator();
+ }
+
+ public void Remove(TableRow row)
+ {
+ owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index)
+ {
+ owner.Controls.RemoveAt(index);
+ }
+
+ int IList.Add(object o)
+ {
+ return Add((TableRow)o);
+ }
+
+ bool IList.Contains(object o)
+ {
+ return owner.Controls.Contains((TableRow)o);
+ }
+
+ int IList.IndexOf(object o)
+ {
+ return owner.Controls.IndexOf((TableRow)o);
+ }
+
+ void IList.Insert(int index, object o)
+ {
+ owner.Controls.AddAt(index, (TableRow)o);
+ }
+
+ void IList.Remove(object o)
+ {
+ owner.Controls.Remove((TableRow)o);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ RemoveAt(index);
+ AddAt(index, (TableRow)value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
new file mode 100644
index 00000000000..6b1e7cd1415
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
@@ -0,0 +1,229 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableStyle : Style
+ {
+ private static int IMAGE_URL = (0x01 << 16);
+ private static int CELL_PADD = (0x01 << 17);
+ private static int CELL_SPAC = (0x01 << 18);
+ private static int GRID_LINE = (0x01 << 19);
+ private static int HOR_ALIGN = (0x01 << 20);
+
+ public TableStyle(): base()
+ {
+ }
+
+ public TableStyle(StateBag bag): base(bag)
+ {
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ if(IsSet(IMAGE_URL))
+ return (string)(ViewState["BackImageUrl"]);
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null)
+ throw new ArgumentNullException("BackImageUrl");
+ ViewState["BackImageUrl"] = value;
+ Set(IMAGE_URL);
+ }
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(IsSet(CELL_PADD))
+ return (int)(ViewState["CellPadding"]);
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("CellPadding");
+ ViewState["CellPadding"] = value;
+ Set(CELL_PADD);
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(IsSet(CELL_SPAC))
+ return (int)(ViewState["CellSpacing"]);
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("CellSpacing");
+ ViewState["CellSpacing"] = value;
+ Set(CELL_SPAC);
+ }
+ }
+
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(IsSet(GRID_LINE))
+ return (GridLines)(ViewState["GridLines"]);
+ return GridLines.None;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(GridLines), value))
+ throw new ArgumentException();
+ ViewState["GridLines"] = value;
+ Set(GRID_LINE);
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(IsSet(HOR_ALIGN))
+ return (HorizontalAlign)(ViewState["HorizontalAlign"]);
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ throw new ArgumentException();
+ ViewState["HorizontalAlign"] = value;
+ Set(HOR_ALIGN);
+ }
+ }
+
+ public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ base.AddAttributesToRender(writer, owner);
+ if(BackImageUrl.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + owner.ResolveUrl(BackImageUrl) + ")");
+ }
+ if(CellSpacing >= 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(CellPadding >= 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, CellPadding.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));
+ }
+ string gd = "";
+ switch(GridLines)
+ {
+ case GridLines.None: gd = "";
+ break;
+ case GridLines.Horizontal: gd = "cols";
+ break;
+ case GridLines.Vertical: gd = "rows";
+ break;
+ case GridLines.Both: gd = "all";
+ break;
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd);
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s != null && s is TableStyle && !s.IsEmpty)
+ {
+ base.CopyFrom(s);
+ TableStyle from = (TableStyle)s;
+ if(from.IsSet(HOR_ALIGN))
+ {
+ HorizontalAlign = from.HorizontalAlign;
+ }
+ if(from.IsSet(IMAGE_URL))
+ {
+ BackImageUrl = from.BackImageUrl;
+ }
+ if(from.IsSet(CELL_PADD))
+ {
+ CellPadding = from.CellPadding;
+ }
+ if(from.IsSet(CELL_SPAC))
+ {
+ CellSpacing = from.CellSpacing;
+ }
+ if(from.IsSet(GRID_LINE))
+ {
+ GridLines = from.GridLines;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && s is TableStyle && !s.IsEmpty)
+ {
+ base.MergeWith(s);
+ TableStyle with = (TableStyle)s;
+ if(with.IsSet(HOR_ALIGN) && IsSet(HOR_ALIGN))
+ {
+ HorizontalAlign = with.HorizontalAlign;
+ }
+ if(with.IsSet(IMAGE_URL) && IsSet(IMAGE_URL))
+ {
+ BackImageUrl = with.BackImageUrl;
+ }
+ if(with.IsSet(CELL_PADD) && IsSet(CELL_PADD))
+ {
+ CellPadding = with.CellPadding;
+ }
+ if(with.IsSet(CELL_SPAC) && IsSet(CELL_SPAC))
+ {
+ CellSpacing = with.CellSpacing;
+ }
+ if(with.IsSet(GRID_LINE) && IsSet(GRID_LINE))
+ {
+ GridLines = with.GridLines;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(IMAGE_URL))
+ ViewState.Remove("BackImageUrl");
+ if(IsSet(HOR_ALIGN))
+ ViewState.Remove("HorizontalAlign");
+ if(IsSet(CELL_PADD))
+ ViewState.Remove("CellPadding");
+ if(IsSet(CELL_SPAC))
+ ViewState.Remove("CellSpacing");
+ if(IsSet(GRID_LINE))
+ ViewState.Remove("GridLines");
+ base.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs
new file mode 100644
index 00000000000..409dd35a9c0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs
@@ -0,0 +1,55 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TargetConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TargetConverter : StringConverter
+ {
+ private StandardValuesCollection standardValues;
+ private string[] values = {
+ "_parent",
+ "_self",
+ "_blank",
+ "_search",
+ "_top"
+ };
+
+ public TargetConverter(): base()
+ {
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(standardValues == null)
+ {
+ standardValues = new StandardValuesCollection(values);
+ }
+ return standardValues;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
new file mode 100644
index 00000000000..b64b42bde50
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
@@ -0,0 +1,109 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TemplateColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TemplateColumn : DataGridColumn
+ {
+ private ITemplate editItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+
+ public TemplateColumn(): base()
+ {
+ }
+
+ public virtual ITemplate EditItemTemplate
+ {
+ get
+ {
+ return editItemTemplate;
+ }
+ set
+ {
+ editItemTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+ ITemplate toRender = null;
+ switch(itemType)
+ {
+ case ListItemType.Header: toRender = headerTemplate;
+ break;
+ case ListItemType.Footer: toRender = footerTemplate;
+ break;
+ case ListItemType.Item: toRender = itemTemplate;
+ break;
+ case ListItemType.AlternatingItem: toRender = itemTemplate;
+ break;
+ case ListItemType.SelectedItem: toRender = editItemTemplate;
+ break;
+ default: toRender = editItemTemplate;
+ break;
+ }
+ if(toRender != null)
+ {
+ cell.Text = String.Empty;
+ toRender.InstantiateIn(cell);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs
new file mode 100755
index 00000000000..906bb73badd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TextAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TextAlign
+ {
+ Left = 1,
+ Right
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
new file mode 100644
index 00000000000..2e1b5a87795
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
@@ -0,0 +1,236 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TextBox
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 80%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("TextChanged")]
+ [DefaultProperty("Text")]
+ [ParseChildren(false)]
+ [ValidationProperty("Text")]
+ public class TextBox : WebControl, IPostBackDataHandler
+ {
+ private static readonly object TextChangedEvent = new object ();
+
+ public TextBox() : base (HtmlTextWriterTag.Input)
+ {
+ }
+
+ public virtual bool AutoPostBack
+ {
+ get {
+ object o = ViewState ["AutoPostBack"];
+ return (o == null) ? false : (bool) o;
+ }
+
+ set { ViewState ["AutoPostBack"] = value; }
+ }
+
+ public virtual int Columns
+ {
+ get {
+ object o = ViewState ["Columns"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set { ViewState ["Columns"] = value; }
+ }
+
+ public virtual int MaxLength
+ {
+ get
+ {
+ object o = ViewState ["MaxLength"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set { ViewState ["MaxLength"] = value; }
+ }
+
+ public virtual bool ReadOnly
+ {
+ get
+ {
+ object o = ViewState ["ReadOnly"];
+ return (o == null) ? false : (bool) o;
+ }
+ set { ViewState ["ReadOnly"] = value; }
+ }
+
+ public virtual int Rows
+ {
+ get
+ {
+ object o = ViewState ["Rows"];
+ return (o == null) ? 0 : (int) o;
+ }
+
+ set { ViewState ["Rows"] = value; }
+ }
+
+ public virtual string Text
+ {
+ get {
+ object o = ViewState ["Text"];
+ return (o == null) ? String.Empty : (string) o;
+ }
+
+ set { ViewState ["Text"] = value; }
+ }
+
+ public virtual TextBoxMode TextMode
+ {
+ get {
+ object o = ViewState ["TextMode"];
+ return (o == null) ? TextBoxMode.SingleLine : (TextBoxMode) o;
+ }
+
+ set {
+ if(!Enum.IsDefined (typeof(TextBoxMode), value))
+ throw new ArgumentException ();
+ ViewState ["TextMode"] = value;
+ }
+ }
+
+ public virtual bool Wrap
+ {
+ get {
+ object o = ViewState ["Wrap"];
+ return (o == null) ? true : (bool) o;
+ }
+
+ set { ViewState ["Wrap"] = value; }
+ }
+
+ public event EventHandler TextChanged
+ {
+ add { Events.AddHandler (TextChangedEvent, value); }
+ remove { Events.RemoveHandler (TextChangedEvent, value); }
+ }
+
+ protected override HtmlTextWriterTag TagKey
+ {
+ get {
+ if(TextMode == TextBoxMode.MultiLine)
+ return HtmlTextWriterTag.Textarea;
+ return HtmlTextWriterTag.Input;
+ }
+ }
+
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ if(Page != null)
+ Page.VerifyRenderingInServerForm (this);
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
+ if (TextMode == TextBoxMode.MultiLine){
+ if (Rows > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Rows,
+ Rows.ToString (
+ NumberFormatInfo.InvariantInfo));
+
+ if (Columns > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Cols,
+ Columns.ToString (
+ NumberFormatInfo.InvariantInfo));
+
+ if (!Wrap)
+ writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "off");
+ } else {
+ string mode;
+ if (TextMode == TextBoxMode.Password)
+ mode = "password";
+ else {
+ mode = "text";
+ if (Text.Length > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
+ }
+
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, mode);
+ if (MaxLength > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Maxlength,
+ MaxLength.ToString (NumberFormatInfo.InvariantInfo));
+
+ if (Columns > 0)
+ writer.AddAttribute (HtmlTextWriterAttribute.Size,
+ Columns.ToString (NumberFormatInfo.InvariantInfo));
+ }
+
+ if (ReadOnly)
+ writer.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "readonly");
+
+ base.AddAttributesToRender (writer);
+
+ if (AutoPostBack && Page != null){
+ writer.AddAttribute (HtmlTextWriterAttribute.Onchange,
+ Page.GetPostBackClientEvent (this, ""));
+ writer.AddAttribute ("language", "javascript");
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(!(obj is LiteralControl))
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_Of_Type", "TextBox",
+ GetType ().Name.ToString ()));
+
+ Text = ((LiteralControl) obj).Text;
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (Events [TextChangedEvent] == null)
+ ViewState.SetItemDirty ("Text", false);
+ }
+
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ if(Events != null){
+ EventHandler eh = (EventHandler) (Events [TextChangedEvent]);
+ if(eh != null)
+ eh (this, e);
+ }
+ }
+
+ protected override void Render (HtmlTextWriter writer)
+ {
+ RenderBeginTag(writer);
+ if (TextMode == TextBoxMode.MultiLine)
+ HttpUtility.HtmlEncode (Text, writer);
+ RenderEndTag(writer);
+ }
+
+ bool IPostBackDataHandler.LoadPostData (string postDataKey,
+ NameValueCollection postCollection)
+ {
+ if (postCollection [postDataKey] != Text){
+ Text = postCollection [postDataKey];
+ return true;
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent ()
+ {
+ OnTextChanged (EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
new file mode 100644
index 00000000000..7c26db6eaf3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TextBoxControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TextBoxControlBuilder : ControlBuilder
+ {
+ public TextBoxControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals()
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs
new file mode 100755
index 00000000000..47b903ec0f2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TextBoxMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TextBoxMode
+ {
+ SingleLine,
+ MultiLine,
+ Password
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs
new file mode 100755
index 00000000000..3cfb9a42f42
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TitleFormat
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TitleFormat
+ {
+ Month,
+ MonthYear
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
new file mode 100644
index 00000000000..550961bf513
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
@@ -0,0 +1,257 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Struct: Unit
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(UnitConverter))]
+ public struct Unit
+ {
+ public static readonly Unit Empty = new Unit();
+
+ private static int Min = -32768;
+ private static int Max = +32767;
+
+ private UnitType type;
+ private double val;
+
+ public static Unit Parse(string s)
+ {
+ return new Unit(s);
+ }
+
+ public static Unit Parse(string s, CultureInfo culture)
+ {
+ return new Unit(s, culture);
+ }
+
+ public static Unit Percentage(double n)
+ {
+ return new Unit (n, UnitType.Percentage);
+ }
+
+ public static Unit Pixel(int n)
+ {
+ return new Unit (n, UnitType.Pixel);
+ }
+
+ public static Unit Point(int n)
+ {
+ return new Unit(n, UnitType.Point);
+ }
+
+ public static bool operator ==(Unit left, Unit right)
+ {
+ return (left.type == right.type && left.val == right.val);
+ }
+
+ public static bool operator !=(Unit left, Unit right)
+ {
+ return !(left == right);
+ }
+
+ public static implicit operator Unit(int n)
+ {
+ return new Unit(n);
+ }
+
+ public Unit(double value)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ type = UnitType.Pixel;
+ }
+
+ public Unit(int value)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ type = UnitType.Pixel;
+ }
+
+ public Unit(string value): this(value, CultureInfo.CurrentCulture)
+ {
+ }
+
+ public Unit(double value, UnitType type)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ this.type = type;
+ }
+
+ public Unit(string value, CultureInfo culture): this(value, culture, UnitType.Pixel)
+ {
+ }
+
+ internal Unit(string value, CultureInfo culture, UnitType defType)
+ {
+ string valueTrim;
+ if (value == null || (valueTrim = value.Trim ()).Length == 0) {
+ val = 0;
+ type = UnitType.Pixel;
+ return;
+ }
+
+ if (culture == null)
+ culture = CultureInfo.CurrentCulture;
+
+ string strVal = valueTrim.ToLower ();
+ int length = strVal.Length;
+ char c;
+ int start = -1;
+ for (int i = 0; i < length; i++) {
+ c = strVal [i];
+ if( (c >= '0' && c <= '9') || (c == '-' || c == '.' || c == ',') )
+ start = i;
+ }
+
+ if (start == -1)
+ throw new ArgumentException("No digits in 'value'");
+
+ start++;
+ if (start < length) {
+ type = GetTypeFromString (strVal.Substring (start).Trim ());
+ val = 0;
+ } else {
+ type = defType;
+ }
+
+ try {
+ string numbers = strVal.Substring (0, start);
+ if (type == UnitType.Pixel)
+ val = (double) Int32.Parse (numbers, culture);
+ else
+ val = (double) Single.Parse (numbers, culture);
+ } catch (Exception) {
+ throw new FormatException ("Error parsing " + value);
+ }
+
+ if (val < Min || val > Max)
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ private static UnitType GetTypeFromString(string s)
+ {
+ if(s == null || s.Length == 0)
+ return UnitType.Pixel;
+ s = s.ToLower().Trim();
+ string[] uTypes = {
+ "px",
+ "pt",
+ "pc",
+ "in",
+ "mm",
+ "cm",
+ "%",
+ "em",
+ "ex"
+ };
+ int i = 0;
+ foreach(string cType in uTypes)
+ {
+ if(s == cType)
+ return (UnitType)Enum.ToObject(typeof(UnitType), (i + 1));
+ i++;
+ }
+ return UnitType.Pixel;
+ }
+
+ private string GetStringFromPixel(UnitType ut)
+ {
+ string[] uTypes = {
+ "px",
+ "pt",
+ "pc",
+ "in",
+ "mm",
+ "cm",
+ "%",
+ "em",
+ "ex"
+ };
+ if( !Enum.IsDefined(typeof(UnitType), ut) )
+ return "px";
+ return uTypes[(int)ut - 1];
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return (type == 0);
+ }
+ }
+
+ public UnitType Type
+ {
+ get
+ {
+ if(IsEmpty)
+ return UnitType.Pixel;
+ return type;
+ }
+ }
+
+ public double Value
+ {
+ get
+ {
+ return val;
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj != null && obj is Unit)
+ {
+ Unit that = (Unit)obj;
+ return ( this.type == that.type && this.val == that.val );
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return ( (type.GetHashCode() << 2) | (val.GetHashCode()) );
+ }
+
+ public override string ToString()
+ {
+ if(IsEmpty)
+ return String.Empty;
+ return ( val.ToString() + GetStringFromPixel(type) );
+ }
+
+ public string ToString(CultureInfo culture)
+ {
+ if(IsEmpty)
+ return String.Empty;
+ return ( val.ToString(culture) + GetStringFromPixel(type) );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
new file mode 100644
index 00000000000..b3320bb39ce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
@@ -0,0 +1,65 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: UnitConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class UnitConverter : TypeConverter
+ {
+ public UnitConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value == null)
+ return null;
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val.Length == 0)
+ {
+ return Unit.Empty;
+ }
+ return (culture == null ? Unit.Parse(val) : Unit.Parse(val, culture));
+ }
+ return ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof(string))
+ {
+ Unit val = (Unit)value;
+ if(val == Unit.Empty)
+ {
+ return String.Empty;
+ }
+ return val.ToString(culture);
+ }
+ return ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs
new file mode 100755
index 00000000000..285c1cc7195
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs
@@ -0,0 +1,28 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: UnitType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum UnitType
+ {
+ Pixel = 1,
+ Point,
+ Pica,
+ Inch,
+ Mm,
+ Cm,
+ Percentage,
+ Em,
+ Ex
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs
new file mode 100644
index 00000000000..883154a7429
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs
@@ -0,0 +1,76 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ValidatedControlConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ValidatedControlConverter : StringConverter
+ {
+ public ValidatedControlConverter(): base()
+ {
+ }
+
+ private object[] GetValues(IContainer container)
+ {
+ ArrayList values = new ArrayList();
+ IEnumerator ie = container.Components.GetEnumerator();
+ try
+ {
+ foreach(IComponent current in container.Components)
+ {
+ Control ctrl = (Control)current;
+ if(ctrl == null || ctrl.ID == null || ctrl.ID.Length == 0)
+ continue;
+ ValidationPropertyAttribute attrib = (ValidationPropertyAttribute)((TypeDescriptor.GetAttributes(ctrl))[typeof(ValidationPropertyAttribute)]);
+ if(attrib == null || attrib.Name == null)
+ continue;
+ values.Add(String.Copy(ctrl.ID));
+ }
+ }finally
+ {
+ if(ie is IDisposable)
+ ((IDisposable)ie).Dispose();
+ }
+ values.Sort();
+ return values.ToArray();
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(context != null && context.Container != null)
+ {
+ object[] values = GetValues(context.Container);
+ if(values != null)
+ {
+ return new StandardValuesCollection(values);
+ }
+ }
+ return null;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs
new file mode 100755
index 00000000000..a752aa1df5d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationCompareOperator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationCompareOperator
+ {
+ Equal,
+ NotEqual,
+ GreaterThan,
+ GreaterThanEqual,
+ LessThan,
+ LessThanEqual,
+ DataTypeCheck
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs
new file mode 100755
index 00000000000..227133269e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs
@@ -0,0 +1,24 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationDataType
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationDataType
+ {
+ String,
+ Integer,
+ Double,
+ Date,
+ Currency
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
new file mode 100644
index 00000000000..a90ce3f20fe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
@@ -0,0 +1,142 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ValidationSummary
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ValidationSummary : WebControl
+ {
+ private bool uplevelRender;
+
+ public ValidationSummary(): base(HtmlTextWriterTag.Div)
+ {
+ uplevelRender = false;
+ ForeColor = Color.Red;
+ }
+
+ public ValidationSummaryDisplayMode DisplayMode
+ {
+ get
+ {
+ object o = ViewState["DisplayMode"];
+ if(o != null)
+ return (ValidationSummaryDisplayMode)o;
+ return ValidationSummaryDisplayMode.BulletList;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ValidationSummaryDisplayMode), value))
+ throw new ArgumentException();
+ ViewState["DisplayMode"] = value;
+ }
+ }
+
+ public bool EnableClientScript
+ {
+ get
+ {
+ object o = ViewState["EnableClientScript"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ public override Color ForeColor
+ {
+ get
+ {
+ return ForeColor;
+ }
+ set
+ {
+ ForeColor = value;
+ }
+ }
+
+ public bool ShowMessageBox
+ {
+ get
+ {
+ object o = ViewState["ShowMessageBox"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowMessageBox"] = value;
+ }
+ }
+
+ public bool ShowSummary
+ {
+ get
+ {
+ object o = ViewState["ShowSummary"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowSummary"] = value;
+ }
+ }
+
+ public string HeaderText
+ {
+ get
+ {
+ object o = ViewState["HeaderText"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderText"] = value;
+ }
+ }
+
+ [MonoTODO("FIXME_See_Comments")]
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(uplevelRender)
+ {
+ //FIXME: This is not the case always. I forgot the case when it is absent.
+ // something to do with the ID's value? or ClienID's value itself?
+ writer.AddAttribute("id", ClientID);
+ if(HeaderText.Length > 0)
+ writer.AddAttribute("headertext", HeaderText, true);
+ if(ShowMessageBox)
+ writer.AddAttribute("showmessagebox", "True");
+ if(!ShowSummary)
+ writer.AddAttribute("showsummary", "False");
+ if(DisplayMode != ValidationSummaryDisplayMode.BulletList)
+ {
+ writer.AddAttribute("displaymode", PropertyConverter.EnumToString(typeof(ValidationSummaryDisplayMode), DisplayMode));
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
new file mode 100755
index 00000000000..c3cf718395c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationSummaryDisplayMode
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationSummaryDisplayMode
+ {
+ List,
+ BulletList,
+ SingleParagraph
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs
new file mode 100755
index 00000000000..48086af18bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidatorDisplay
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidatorDisplay
+ {
+ None,
+ Static,
+ Dynamic
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs
new file mode 100755
index 00000000000..caaea9d7c7b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: VerticalAlign
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(VerticalAlignConverter))]
+ public enum VerticalAlign
+ {
+ NotSet,
+ Top,
+ Middle,
+ Bottom
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs
new file mode 100644
index 00000000000..17bfe389b4e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlignConverter.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.WebControls.VerticalAlignConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Web.UI.WebControls
+{
+ class VerticalAlignConverter : EnumConverter
+ {
+ public VerticalAlignConverter () : base (typeof(VerticalAlign))
+ {
+ }
+
+ // The base class is enough to handle everything.
+ // The methods are here just to make the class status page happy.
+ // Add some optimizations?
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
new file mode 100644
index 00000000000..2b36327049a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
@@ -0,0 +1,74 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: WebColorConverter
+ *
+ * Author: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class WebColorConverter : ColorConverter
+ {
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ if (value is string) {
+ string val = ((string) value).Trim ();
+ if(val == String.Empty || val.Length == 0)
+ return Color.Empty;
+
+ NumberStyles style = (val [0] == '#') ? NumberStyles.HexNumber :
+ NumberStyles.None;
+
+ try {
+ int n = Int32.Parse (val.Substring (1), style);
+ return Color.FromArgb (n);
+ } catch {
+ Color c = Color.FromName (val);
+ if (c.A != 0 || c.R != 0 || c.B != 0 || c.G != 0)
+ return c;
+ }
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ if (destinationType == null)
+ throw new ArgumentNullException ("destinationType");
+
+ if (destinationType == typeof (String) && value != null) {
+ Color c = (Color) value;
+ if (c == Color.Empty)
+ return String.Empty;
+
+ if (c.IsNamedColor || c.IsSystemColor)
+ return c.Name;
+
+ return String.Format ("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B);
+ }
+
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
new file mode 100755
index 00000000000..d7a84d0b541
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
@@ -0,0 +1,451 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: WebControl
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 40%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ [PersistChildrenAttribute(false)]
+ [ParseChildrenAttribute(true)]
+ public class WebControl : Control, IAttributeAccessor
+ {
+ //TODO: A list of private members may be incomplete
+
+ private HtmlTextWriterTag tagKey;
+ private string stringTag;
+ private AttributeCollection attributes;
+ private StateBag attributeState;
+ private Style controlStyle;
+ private bool enabled;
+ private string tagName;
+
+ // TODO: The constructors definitions
+ protected WebControl () : this (HtmlTextWriterTag.Span)
+ {
+ }
+
+ public WebControl(HtmlTextWriterTag tag): base()
+ {
+ //FIXME: am i right?
+ tagKey = tag;
+ //stringTag = null;
+ Initialize();
+ }
+
+ protected WebControl(string tag): base()
+ {
+ //FIXME: am i right?
+ stringTag = tag;
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ controlStyle = null;
+ enabled = true;
+ tagName = stringTag;
+ attributeState = null;
+ }
+
+ public virtual string AccessKey
+ {
+ get
+ {
+ object o = ViewState["AccessKey"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["AccessKey"] = value;
+ }
+ }
+
+ [MonoTODO("FIXME_Internal_method_calls")]
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ if(attributes==null)
+ {
+ //FIXME: From where to get StateBag and how? I think this method is OK!
+ if(attributeState == null)
+ {
+ attributeState = new StateBag(true);
+ if(IsTrackingViewState)
+ {
+ attributeState.TrackViewState();
+ }
+ }
+ attributes = new AttributeCollection(attributeState);
+ }
+ return attributes;
+ }
+ }
+
+ public virtual Color BackColor
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Color.Empty;
+ return ControlStyle.BackColor;
+ }
+
+ set {
+ ControlStyle.BackColor = value;
+ }
+ }
+
+ public virtual Color BorderColor
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Color.Empty;
+ return ControlStyle.BorderColor;
+ }
+
+ set {
+ ControlStyle.BorderColor = value;
+ }
+ }
+
+ public virtual BorderStyle BorderStyle
+ {
+ get {
+ if (!ControlStyleCreated)
+ return BorderStyle.NotSet;
+ return ControlStyle.BorderStyle;
+ }
+
+ set {
+ ControlStyle.BorderStyle = value;
+ }
+ }
+
+ public virtual Unit BorderWidth
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Unit.Empty;
+ return ControlStyle.BorderWidth;
+ }
+
+ set {
+ if (value.Value < 0)
+ throw new ArgumentException();
+ ControlStyle.BorderWidth = value;
+ }
+ }
+
+ public Style ControlStyle
+ {
+ get
+ {
+ if(controlStyle == null)
+ {
+ controlStyle = CreateControlStyle();
+ if(IsTrackingViewState)
+ {
+ controlStyle.TrackViewState();
+ }
+ controlStyle.LoadViewState(null);
+ }
+ return controlStyle;
+ }
+ }
+
+ public bool ControlStyleCreated
+ {
+ get
+ {
+ return (controlStyle!=null);
+ }
+ }
+
+ public virtual string CssClass
+ {
+ get
+ {
+ return ControlStyle.CssClass;
+ }
+ set
+ {
+ ControlStyle.CssClass = value;
+ }
+ }
+
+ public virtual bool Enabled
+ {
+ get
+ {
+ return enabled;
+ }
+ set
+ {
+ enabled = value;
+ }
+ }
+
+ public virtual FontInfo Font
+ {
+ get
+ {
+ return ControlStyle.Font;
+ }
+ }
+
+ public virtual Color ForeColor
+ {
+ get {
+ if (!ControlStyleCreated)
+ return Color.Empty;
+ return ControlStyle.ForeColor;
+ }
+
+ set {
+ ControlStyle.ForeColor = value;
+ }
+ }
+
+ public virtual Unit Height
+ {
+ get
+ {
+ return ControlStyle.Height;
+ }
+ set
+ {
+ ControlStyle.Height = value;
+ }
+ }
+
+ public CssStyleCollection Style
+ {
+ get
+ {
+ return Attributes.CssStyle;
+ }
+ }
+
+ public virtual short TabIndex
+ {
+ get
+ {
+ object o = ViewState["TabIndex"];
+ if(o!=null)
+ return (short)o;
+ return 0;
+ }
+ set
+ {
+ if(value < -32768 || value > 32767)
+ throw new ArgumentException();
+ ViewState["TabIndex"] = value;
+ }
+ }
+
+ public virtual string ToolTip
+ {
+ get
+ {
+ object o = ViewState["ToolTip"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ToolTip"] = value;
+ }
+ }
+
+ public virtual Unit Width
+ {
+ get
+ {
+ return ControlStyle.Width;
+ }
+ set
+ {
+ ControlStyle.Width = value;
+ }
+ }
+
+ public void ApplyStyle(Style s)
+ {
+ if (s != null && !s.IsEmpty)
+ ControlStyle.CopyFrom (s);
+ }
+
+ public void CopyBaseAttributes(WebControl controlSrc)
+ {
+ /*
+ * AccessKey, Enabled, ToolTip, TabIndex, Attributes
+ */
+ AccessKey = controlSrc.AccessKey;
+ Enabled = controlSrc.Enabled;
+ ToolTip = controlSrc.ToolTip;
+ TabIndex = controlSrc.TabIndex;
+ attributes = controlSrc.Attributes;
+ AttributeCollection otherAtt = controlSrc.Attributes;
+ foreach (string key in controlSrc.Attributes.Keys)
+ Attributes [key] = otherAtt [key];
+ }
+
+ public void MergeStyle(Style s)
+ {
+ ControlStyle.MergeWith(s);
+ }
+
+ public virtual void RenderBeginTag(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ writer.RenderBeginTag(TagName);
+ }
+
+ public virtual void RenderEndTag(HtmlTextWriter writer)
+ {
+ writer.RenderEndTag();
+ }
+
+ protected virtual HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ return tagKey;
+ }
+ }
+
+ protected virtual string TagName
+ {
+ get
+ {
+ if(tagName == null && TagKey != 0)
+ {
+ tagName = Enum.Format(typeof(HtmlTextWriterTag), TagKey, "G").ToString();
+ }
+ // What if tagName is null and tagKey 0?
+ return tagName;
+ }
+ }
+
+ protected virtual void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(ID!=null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
+ }
+ if(AccessKey.Length>0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey);
+ }
+ if(!Enabled)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
+ }
+ if(ToolTip.Length>0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
+ }
+ if(TabIndex != 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString());
+ }
+ if(ControlStyleCreated)
+ {
+ if(!ControlStyle.IsEmpty)
+ {
+ ControlStyle.AddAttributesToRender(writer, this);
+ }
+ }
+ if(attributeState != null){
+ IEnumerator ie = Attributes.Keys.GetEnumerator ();
+ while (ie.MoveNext ()){
+ string key = (string) ie.Current;
+ writer.AddAttribute (key, Attributes [key]);
+ }
+ }
+ }
+
+ protected virtual Style CreateControlStyle()
+ {
+ return new Style(ViewState);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ Triplet saved = (Triplet) savedState;
+ base.LoadViewState (saved.First);
+ if (ControlStyleCreated)
+ ControlStyle.LoadViewState (saved.Second);
+ if (attributeState != null)
+ attributeState.LoadViewState (saved.Third);
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RenderBeginTag(writer);
+ RenderContents(writer);
+ RenderEndTag(writer);
+ }
+
+ protected virtual void RenderContents(HtmlTextWriter writer)
+ {
+ base.Render(writer);
+ }
+
+ protected override object SaveViewState()
+ {
+ object baseView = base.SaveViewState ();
+ object controlView = null;
+ if (ControlStyleCreated)
+ controlView = ControlStyle.SaveViewState();
+
+ object attrView = null;
+ if (attributeState != null)
+ attrView = attributeState.SaveViewState();
+
+ return new Triplet (baseView, controlView, attrView);
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if (ControlStyleCreated)
+ ControlStyle.TrackViewState ();
+ if (attributeState != null)
+ attributeState.TrackViewState ();
+ }
+
+ string IAttributeAccessor.GetAttribute(string key)
+ {
+ if(Attributes!=null)
+ return Attributes[key] as string;
+ return null;
+ }
+
+ void IAttributeAccessor.SetAttribute(string key, string value)
+ {
+ Attributes[key] = value;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
new file mode 100644
index 00000000000..487dffbc599
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
@@ -0,0 +1,224 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Xml
+ *
+ * Author: Gaurav Vaish, Gonzalo Paniagua Javier
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>, <gonzalo@ximian.com>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ * (c) 2002 Ximian, Inc. (http://www.ximian.com)
+ */
+
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("DocumentSource")]
+ [PersistChildren(false)]
+ public class Xml : Control
+ {
+ private XmlDocument document;
+ private string documentContent;
+ private string documentSource;
+ private XslTransform transform;
+ private XsltArgumentList transformArgumentList;
+ private string transformSource;
+
+ private XPathDocument xpathDoc;
+
+ private static XslTransform defaultTransform;
+
+ static Xml()
+ {
+ XmlTextReader reader = new XmlTextReader(new StringReader("<xsl:stylesheet version='1.0' " +
+ "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>" +
+ "<xsl:template match=\"\">" +
+ "<xsl:copy-of select=\".\"/>" +
+ "</xsl:template>" +
+ "</xsl:stylesheet>"));
+ defaultTransform = new XslTransform();
+ defaultTransform.Load(reader);
+ }
+
+ public Xml(): base()
+ {
+ }
+
+ [MonoTODO("security")]
+ private void LoadXmlDoc ()
+ {
+ if (documentContent != null && documentContent.Length > 0) {
+ document = new XmlDocument();
+ document.LoadXml (documentContent);
+ return;
+ }
+
+ if (documentSource != null && documentSource.Length != 0) {
+ document = new XmlDocument();
+ document.Load (documentSource);
+ }
+ }
+
+ public XmlDocument Document
+ {
+ get
+ {
+ if(document == null)
+ LoadXmlDoc();
+ return document;
+ }
+ set
+ {
+ documentSource = null;
+ documentContent = null;
+ xpathDoc = null;
+ document = value;
+ }
+ }
+
+ public string DocumentContent
+ {
+ get
+ {
+ return String.Empty;
+ }
+ set
+ {
+ document = null;
+ xpathDoc = null;
+ documentContent = value;
+ }
+ }
+
+ public string DocumentSource
+ {
+ get
+ {
+ if(documentSource != null)
+ return documentSource;
+ return String.Empty;
+ }
+ set
+ {
+ document = null;
+ documentContent = null;
+ xpathDoc = null;
+ documentSource = value;
+ }
+ }
+
+ public XslTransform Transform
+ {
+ get
+ {
+ return transform;
+ }
+ set
+ {
+ transformSource = null;
+ transform = value;
+ }
+ }
+
+ public string TransformSource
+ {
+ get
+ {
+ if(transformSource != null)
+ return transformSource;
+ return String.Empty;
+ }
+ set
+ {
+ transform = null;
+ transformSource = value;
+ }
+ }
+
+ public XsltArgumentList TransformArgumentList
+ {
+ get
+ {
+ return transformArgumentList;
+ }
+ set
+ {
+ transformArgumentList = value;
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(obj is LiteralControl)
+ {
+ DocumentContent = ((LiteralControl)obj).Text;
+ return;
+ }
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_of_Type",
+ "Xml",
+ GetType().Name));
+ }
+
+ [MonoTODO("security")]
+ private void LoadXpathDoc ()
+ {
+ if(documentContent != null && documentContent.Length > 0) {
+ xpathDoc = new XPathDocument (new StringReader (documentContent));
+ return;
+ }
+
+ if (documentSource != null && documentSource.Length != 0) {
+ xpathDoc = new XPathDocument (MapPathSecure (documentSource));
+ return;
+ }
+ }
+
+ [MonoTODO("security")]
+ private void LoadTransform ()
+ {
+ if (transform != null)
+ return;
+
+ if (transformSource != null && transformSource.Length != 0) {
+ transform = new XslTransform ();
+ transform.Load (transformSource);
+ }
+ }
+
+ protected override void Render(HtmlTextWriter output)
+ {
+ if(document == null)
+ {
+ LoadXpathDoc();
+ }
+
+ LoadTransform();
+ if(document == null || xpathDoc == null)
+ {
+ return;
+ }
+ if(transform == null)
+ {
+ transform = defaultTransform;
+ }
+ if(document != null)
+ {
+ Transform.Transform(document, transformArgumentList, output);
+ return;
+ }
+ Transform.Transform(xpathDoc, transformArgumentList, output);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs b/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
new file mode 100644
index 00000000000..de9df55763b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.ApplicationfileParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ internal sealed class ApplicationFileParser : TemplateParser
+ {
+ [MonoTODO]
+ protected override Type CompileIntoType ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ internal static Type GetCompiledApplicationType (string inputFile,
+ HttpContext context,
+ ref ApplicationFileParser parser)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override Type DefaultBaseType
+ {
+ get {
+ return typeof (HttpApplication);
+ }
+ }
+
+ protected override string DefaultDirectiveName
+ {
+ get {
+ return "application";
+ }
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs b/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs
new file mode 100755
index 00000000000..be03b6c7ed0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/AttributeCollection.cs
@@ -0,0 +1,82 @@
+//
+// System.Web.UI.AttributeCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class AttributeCollection
+ {
+ private StateBag bag;
+ private CssStyleCollection styleCollection;
+
+ public AttributeCollection (StateBag bag)
+ {
+ this.bag = bag;
+ }
+
+ public int Count {
+ get { return bag.Count; }
+ }
+
+ public CssStyleCollection CssStyle {
+ get {
+ if (styleCollection == null)
+ styleCollection = new CssStyleCollection (bag);
+ return styleCollection;
+ }
+ }
+
+ public string this [string key] {
+ get { return bag [key] as string; }
+
+ set { bag.Add (key, value); }
+ }
+
+ public ICollection Keys {
+ get { return bag.Keys; }
+ }
+
+ public void Add (string key, string value)
+ {
+ if (styleCollection != null && 0 == String.Compare (key, "style", true))
+ styleCollection.FillStyle (value);
+ else
+ bag.Add (key, value);
+ }
+
+ public void AddAttributes (HtmlTextWriter writer)
+ {
+ foreach (string key in bag.Keys) {
+ string value = bag [key] as string;
+ writer.AddAttribute (key, value);
+ }
+ }
+
+ public void Clear ()
+ {
+ bag.Clear ();
+ }
+
+ public void Remove (string key)
+ {
+ bag.Remove (key);
+ }
+
+ public void Render (HtmlTextWriter writer)
+ {
+ foreach (string key in bag.Keys) {
+ string value = bag [key] as string;
+ writer.WriteAttribute (key, value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BaseParser.cs b/mcs/class/System.Web/System.Web.UI/BaseParser.cs
new file mode 100755
index 00000000000..480ef7501b3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BaseParser.cs
@@ -0,0 +1,84 @@
+//
+// System.Web.UI.BaseParser.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System.IO;
+using System.Web;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public class BaseParser
+ {
+ private HttpContext context;
+ private string baseDir;
+ private string baseVDir;
+ private string vPath;
+
+ internal string MapPath (string path)
+ {
+ return MapPath (path, true);
+ }
+
+ internal string MapPath (string path, bool allowCrossAppMapping)
+ {
+ if (context == null)
+ throw new HttpException ("context is null!!");
+
+ return context.Request.MapPath (path, context.Request.ApplicationPath, allowCrossAppMapping);
+ }
+
+ internal string PhysicalPath (string path)
+ {
+ if (Path.DirectorySeparatorChar != '/')
+ path = path.Replace ('/', '\\');
+
+ return Path.Combine (BaseDir, path);
+ }
+
+ internal HttpContext Context
+ {
+ get {
+ return context;
+ }
+ set {
+ context = value;
+ }
+ }
+
+ internal string BaseDir
+ {
+ get {
+ if (baseDir == null)
+ baseDir = MapPath (BaseVirtualDir, false);
+
+ return baseDir;
+ }
+ }
+
+ internal string BaseVirtualDir
+ {
+ get {
+ if (baseVDir == null)
+ baseVDir = UrlUtils.GetDirectory (context.Request.FilePath);
+
+ return baseVDir;
+ }
+ }
+
+ internal string CurrentVirtualPath
+ {
+ get {
+ return vPath;
+ }
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/BuildMethod.cs b/mcs/class/System.Web/System.Web.UI/BuildMethod.cs
new file mode 100644
index 00000000000..d06a4024166
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BuildMethod.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.UI.BuildMethod.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate Control BuildMethod();
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs b/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs
new file mode 100644
index 00000000000..8d53ce41e2e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.UI.BuildTemplateMethod.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate void BuildTemplateMethod(Control control);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog
new file mode 100644
index 00000000000..564d1459118
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ChangeLog
@@ -0,0 +1,673 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: some more tweaks to naming containers stuff.
+ * DataBinder.cs: don't throw exception if the container is null.
+
+ * Page.cs: now we can render client scripts, startup scripts and hidden
+ fields. Only render __VIEWSTATE if there is someone that will take care
+ of it.
+ (RaisePostBackEvents): first try the last one that required raise event,
+ then try __EVENTTARGET.
+
+2003-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixes in UniqueID, FindControl, AddedControl,
+ UnloadRecursive, InitRecursive. Reduced the size of __VIEWSTATE. Made
+ FindControl work with NamingContainers.
+
+ * ControlCollection.cs: notify the parent when clearing the collection.
+
+ * LosFormatter.cs: Added debugging output and generate a valid
+ viewstate even for unknown types.
+
+ * Page.cs: GetPostBackEventReference now uses UniqueID. Reduced
+ viewstate.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: make it fire the LoadData related events also for controls
+ such as ImageButton, whose variable(s) in the query string are of the
+ form ctrl_name.x and only fire them once per control.
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs:
+ (GetPropertyValue): don't try to get the property as indexed
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs: use TypeDescriptor to get the properties and their
+ values.
+
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (AddedControl): take the children to the same state of the parent.
+ (InitRecursive): set the page of the children.
+
+ * Page.cs: removed one line (it's done a few lines above).
+
+ * UserControl.cs:
+ (OnInit): always call InitializeAsUserControl
+ (InitializeAsUserControl): sets the page for the control.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed bug #36037.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: a couple of path fixes to make it work
+ when the page is not in the root directory.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed PreRenderRecursiveInternal. Thanks to kojoadams for
+ reporting the bug.
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BaseParser.cs: use MapPath and context to locate files.
+ * Control.cs: implemented MapPathSecure.
+ * TemplateControl.cs: use UrlUtils to generate the path.
+ * TemplateControlParser.cs: use the context and MapPath.
+ * UserControl.cs: implemented MapPath.
+ * UserControlParser.cs: added context parameter to constructor.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented MapPathSecure.
+ * Page.cs: fixed Server property.
+
+2002-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs: try the indexer if the property is not found in
+ GetPropertyValue ().
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: added AutoEventWireup internal property.
+
+ * Page.cs: removed page events wire up from here.
+
+ * TemplateControl.cs: new method WireupAutomaticEvents to hook up page
+ and user controls events.
+
+ * TemplateControlParser.cs: process the options that are applicable
+ once we have the instance of the control.
+
+ * TemplateParser.cs: also stores the options.
+
+ * UserControl.cs: hook up events before initializing the control.
+
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: new method to set bindingContainer value.
+ * TemplateControl.cs: added controls are not binding containers.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented TemplateSourceDirectory.
+ * TemplateControl.cs: implemented LoadControl and LoadTemplate.
+
+2002-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UserControl.cs: fixed SetAttribute.
+ * UserControlParser.cs: set the correct base type.
+
+2002-11-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateParser.cs: fixed BaseType.
+ * UserControlParser.cs: helper class to compile user controls.
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: added DateTime to special types.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: added array serialization support. Disabled binary
+ serialization and add some debugging code.
+
+ * StateBag.cs: the length of the list of value can be less than the
+ length if the list of keys when remaining values are null.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: return something useful in GetPostBackClientEvent.
+
+2002-11-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: implemented FileDependecies and made it protected.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: save control names instead of the controls
+ themselves to the ViewState.
+
+ * LosFormatter.cs: added support for serializing unknown
+ types. BinaryFormatter does not work so you better don't store anything
+ of unknown Type in ViewState.
+
+ * Page.cs: GetViewStateString works now using LosFormatter.
+ Complete "Control execution lifecycle" by unloading all the child
+ controls. Check for null in RaisePostBackEvents.
+ LoadPageViewStateFromPersistenceMedium uses LosFormatter too.
+
+2002-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DataBinder.cs: implemented Eval and GetIndexedPropertyValue methods.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: Use WebEncoding.Encoding.
+
+ * Control.cs:
+ * Page.cs: fixed namespace.
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: set the context in ProcessRequest. Added a few trace calls.
+ * Control.cs: added some trace information.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleHandlerFactory.cs: new handler for .ashx files.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/PageHandlerFactory.cs: new file.
+ * System.Web.UI/PageParser.cs:
+ * System.Web.UI/TemplateControlParser.cs: we are now able to compile
+ pages and use HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented ObBubbleEvent.
+ * Page.cs: temporary workaround to make POST work with xsp server.
+
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: fixed InvokeEventMethod now that Type.GetMethod does not
+ return pvt methods.
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SimpleWebHandlerParser.cs: New file.
+ * WebServiceParser.cs: New file.
+
+2002-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LosFormatter.cs: almost fully implemented.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompiledTemplateBuilder.cs: InstantiateIn is virtual.
+ * EmptyControlCollection.cs: throw correct exception.
+ * LosFormatter.cs: stubbed out.
+ * OutputCacheLocation.cs: little fix.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/ApplicationFileParser.cs:
+ * System.Web.UI/BaseParser.cs:
+ * System.Web.UI/PageParser.cs:
+ * System.Web.UI/TemplateControl.cs:
+ * System.Web.UI/TemplateControlParser.cs:
+ * System.Web.UI/TemplateParser.cs: first steps to move xsp into
+ System.Web.
+
+2002-07-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: request to render postback script can be after form started
+ rendering.
+
+2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: added more page events to invoke automagically if some
+ methods are defined.
+
+2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (SaveViewState): save state even when control is not visible.
+ (SaveViewStateRecursive):
+ (LoadViewStateRecursive): made internal.
+
+2002-07-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: improved event raising to allow client postback for a wider
+ variety of actions (clicking an hyperlink, ...).
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UserControl.cs: implemented Load/SaveViewState.
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs:
+ (Add): handle 'style' through styleCollection.
+
+ * CssStyleCollection.cs:
+ (fillStyle): renamed to FillStyle and made it internal.
+
+ * Page.cs:
+ (GetViewStateString): fixed, broken after other recent changes.
+ (ProcessPostData): allow a second try for postback data after OnLoad.
+ (ProcessRequest): clear controls collection, removed call to
+ UnloadRecursive.
+
+2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: uncommented Dispose.
+
+ * Page.cs:
+ (DeterminePostBackMode): more checkings.
+ (GetPostBackClientHyperLink): implemented.
+ (GetPostBackEventReference): added some comments with the HTML that MS
+ generates for that.
+ (ProcessRequest): fixed processing order. The page is unloaded after
+ a request and regenerated from view state on subsequents posts.
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed related to ViewState. Added RemovedControl.
+
+ * ControlCollection.cs: notify owner of control removal.
+
+ * CssStyleCollection.cs: almost rewritten to make it render the style
+ attribute after changes to it.
+
+ * Page.cs: follow the guidelines in 'Control execution lifecycle'.
+ Removed Xml code.
+
+ * StateBag.cs: don't use IDictionary.GetEnumerator on the
+ HybridDictionary: it makes the program give an InvalidCastException at
+ runtime. Why?
+
+2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: fire Init and Load events for all children.
+
+2002-07-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UserControl.cs: New file.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlBuilderAttribute.cs: finished implementation.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConstructorNeedsTagAttribute.cs: the default constructor sets the
+ property to false.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/AttributeCollection.cs: added CssStyleCollection.
+
+ * System.Web.UI/CssStyleCollection.cs: use a StateBag instead of a
+ Hashtable. Added internal .ctor.
+
+ * System.Web.UI/DataBinding.cs: propertyType is a Type. Implemented
+ Equals and GetHashCode.
+
+ * System.Web.UI/DataBoundLiteralControl.cs:
+ (LoadViewState):
+ (SaveViewState): implemented.
+
+ * System.Web.UI/Page.cs: FileDependencies is not public.
+
+ * System.Web.UI/ParseChildrenAttribute.cs: give a value to Default.
+ (GetHashCode):
+ (Equals):
+ (IsDefaultAttribute): implemented.
+
+2002-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: fixed Visible property.
+ * Page.cs: fixed GetViewStateString.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/Page.cs:
+ (GetViewStateString): new function to give the server access to the
+ generated view state string.
+ (Validate): d'oh!
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (SaveViewstateRecursive): implemented.
+ (SaveViewState): fixed.
+ (IParserAccessor.AddParsedSubObject): don't use 'this'.
+
+ * Page.cs: added code to save view state to an xml file. It's not
+ being used right now.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/LiteralControl.cs:
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: reimplemented FindControls.
+
+ * Page.cs:
+ (.ctor): set the page for this control.
+ (IsPostBack): return valid value.
+ (DeterminePostBackMode): finished.
+ (OnFormRender): render __VIEWSTATE (uses GetTypeHashCode()).
+ (ProcessPostData): implemented. Raises change and postback events.
+ (ProcessRequest): changed to support reuse of the instance.
+ (RegisterRequiresPostBack): implemented.
+
+ * ValidatorCollection.cs: implemented all methods.
+
+2002-06-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ * Page.cs: first attemp to save view state.
+
+ * HtmlForm.cs: don't render Action.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: implemented more properties using information we already
+ have in Context.
+ (OnFormRender):
+ (OnFormPostRender):
+ (VerifyRenderingInServerForm): implemented.
+
+2002-06-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: changed InvokeEventMethod to use a GetMethod that works with
+ out runtime. Renamed Page_Init and Page_Load.
+
+ After this, we can load a dll and render HTML in linux.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (AddedControl): new function that is called whenever a control is
+ added to a collection of controls in a container. It sets the defaults
+ except for Page.
+
+ * ControlCollection.cs: call AddedControl in Add/AddAt.
+
+ * DataBoundLiteralControl.cs: implemented constructor, Text, Render,
+ SetStaticString and SetDataBoundString.
+
+ * Page.cs: removed SetDefaults.
+
+2002-06-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompiledTemplateBuilder.cs: new file. Used in the code generated
+ by xsp.
+
+ * Control.cs:
+ (BindingContainer): implemented.
+ (EnsureChildControls): avoid stack overflow.
+
+ * DataBinder.cs: implemented Eval and PropertyValue.
+
+2002-06-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HtmlTextWriter.cs: fixed style attributes rendering (almost the same
+ bug as in regular attributes).
+
+2002-06-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: implemented PreventAutoID.
+
+ * Page.cs:
+ (SetDefaults): don't set ID automatically if Control.PreventAutoID has
+ been called.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs:
+ (Validators): if the collection is null, create one.
+ (GetPostBackEventReference 2): don't throw exception.
+ (GetPostBackClientEvent): return a string with containing the method
+ name, the control name and the argument.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: SetPage is now called SetDefaults and also sets a default
+ ID for controls that don't have one yet.
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs:
+ (GetPostBackClient):
+ (RegisterRequiresPostBack): don't throw NotImplementedException to
+ keep going.
+ (ProcessRequest): set the current page as the Page property for *all*
+ the controls, not just the direct children of the page.
+
+2002-06-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs:
+ (MapPathSecure): until security is implemented, return the same path
+ received as argument.
+ (RenderControl): call OnPreRender before rendering the control. So
+ AdRotator can read its configuration file.Is there any other place
+ where this should be done?
+
+ * HtmlTextWriter.cs:
+ (AddAttribute): fixed. Now it really stores attributes.
+ (RenderBeginTag): fixed a couple of bugs (little ones but hard to find).
+
+2002-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlCollection.cs:
+ (AddAt): if index is -1 behave as a plain Add.
+
+2002-06-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: for each child control to render, assign Control.Page.
+ Probably also needed in HtmlContainerControl derived classes.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs: don't need a Hastable. StateBag now works
+ fine and takes care of the details.
+
+ * Control.cs: added HasChildren property.
+
+ * StateBag.cs: fixed a couple of nasty bugs.
+
+2002-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: run OnInit, OnLoad y PreRender before rendering the page.
+ Invoke Page_Init and/or Page_Load if the user supplied them (though
+ this should depend on AutoEventWireUp attribute of Page directive).
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Control.cs: don't throw exception in ControlID. By now, it returns ID.
+
+ * Page.cs:
+ (ProcessRequest): implemented.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.UI/Page.cs: finished stubbing out. Implemented some
+ methods.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs:
+ (FileDependencies): now is public public.
+ (EnableViewStateMAC): uncommented and made protected.
+ (GetTypeHashCode): added method.
+
+2002-05-24 Duncan Mak <duncan@ximian.com>
+
+ * TemplateControl.cs (SetStringResourcePointer): Fixed typo.
+
+ * StateBag.cs (Item): Changed the visibility level of the this
+ [object] indexer.
+
+ Misc. formatting edits, fixing some bugs introduced by the indentation.
+
+ * DataBinder.cs (Eval)
+ (GetIndexedPropertyValue)
+ (GetPropertyValue): Fixed return types.
+
+2002-05-21 Miguel de Icaza <miguel@ximian.com>
+
+ * HtmlTextWriter.cs: Use this to change the member instances.
+
+2002-05-17 Duncan Mak <duncan@ximian.com>
+
+ * AttributeCollection.cs:
+ * ControlCollection.cs:
+ * CssStyleCollection.cs:
+ * DataBindingCollection.cs:
+ * EmptyControlCollection.cs: Added missing Collection classes.
+
+2002-05-17 Duncan Mak <duncan@ximian.com>
+
+ * BaseParser.cs:
+ * TemplateParser.cs: Implemented. BaseParser is weird because
+ there is no documentation on what it does.
+
+ * ControlBuilder.cs:
+
+ * DataBinder.cs:
+ * DataBinding.cs: Added.
+
+ * DataBoundLiteralControl.cs:
+ * Triplet.cs: Added.
+
+ * RenderMethod.cs: Added this delegate for Control.cs
+
+2002-05-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ValidationPropertyAttribute.cs: a couple of fixes to make it compile.
+
+2002-05-14 Duncan Mak <duncan@ximian.com>
+
+ * ValidationPropertyAttribute.cs: Added to CVS.
+
+2002-05-10 Duncan Mak <duncan@ximian.com>
+
+ * ConstructorNeedsTagAttribute.cs:
+ * ControlBuilderAttribute.cs:
+ * ImageClickEventArgs.cs:
+ * ParseChildrenAttribute.cs:
+ * PartialCachingAttribute.cs:
+ * PersistChildrenAttribute.cs:
+ * PersistenceModeAttribute.cs:
+ * TemplateContainerAttribute.cs: Added to CVS.
+
+ * PersistanceMode.cs: Removed, fixed typo.
+ * PersistenceMode.cs: Replacing above.
+
+ * StateBag.cs (this): Fixed indexer, it takes a string as the
+ index, not an object.
+
+ * ValidatorCollection.cs: Fixed typo, ValidatedCollection to ValidatorCollection.
+
+ * Page.cs (Validators): return type should be ValidatorCollection,
+ not ValidatedCollection.
+
+ * TagPrefixAttribute.cs: Added to CVS.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * Utils.cs (GetClientValidatedEvent): Uncommented the 'Page' argument.
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataBindingHandlerAttribute.cs
+ - Completed
+ * ToolboxDataAttribute.cs - Completed
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * DesignTimeParseData.cs: initialze static member to avoid compile
+ error
+ * PropertyConverter.cs: remove uneeded exception variables from
+ catch blocks.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * DesignTimeParseData.cs: fix header to show correct class name
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * StateBag.cs - Completed
+
+2001-12-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Pair.cs - Small undocumented class. Completed.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DesignTimeParseData.cs - Initial implementation
+ * StateBag.cs - Initial implementation
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * PropertyConverter.cs - Undocumented class. Completed.
+ * Utils.cs - Undocumented, private class.
+ Initial implementation
+
+2001-08-28 Bob Smith <bob@thestuff.net>
+ * Control.cs: Figured out some undocumented API.
+ * Added TODO.
+ * BuildMethod.cs: Initial implementation.
+ * BuildTemplateMethod.cs: Initial implementation.
+ * HtmlTextWriterAttribute.cs: Initial implementation.
+ * HtmlTextWriterStyle.cs: Initial implementation.
+ * HtmlTextWriterTag.cs: Initial implementation.
+ * IAttributeAccessor.cs: Initial implementation.
+ * IDataBindingsAccessor.cs: Initial implementation.
+ * ImageClickEventHandler.cs: Initial implementation.
+ * INamingContainer.cs: Initial implementation.
+ * IParserAccessor.cs: Initial implementation.
+ * IPostBackDataHandler.cs: Initial implementation.
+ * IPostBackEventHandler.cs: Initial implementation.
+ * IStateManager.cs: Initial implementation.
+ * ITagNameToTypeMapper.cs: Initial implementation.
+ * ITemplate.cs: Initial implementation.
+ * IValidator.cs: Initial implementation.
+ * OutputCacheLocation.cs: Initial implementation.
+ * PersistanceMode.cs: Initial implementation.
+ * StateItem.cs: Initial implementation.
+
+2001-08-27 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Bug fixes and implementations.
+
+2001-08-24 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Bug fixes.
+
+2001-08-23 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: More implementation. Events reworked for performance.
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * LiteralControl.cs: Implemented.
+ * Control.cs: Even more implementation (Events). What a beast.
+
+2001-08-20 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: More implementation. Not done yet. Shutter.
+
+2001-08-17 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Partial implementation.
diff --git a/mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs b/mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs
new file mode 100644
index 00000000000..a3ad857a0d3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CompiledTemplateBuilder.cs
@@ -0,0 +1,29 @@
+//
+// System.Web.UI.CompiledTemplateBuilder
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+// This is used in the generated C# code from MS and xsp does the same.
+// It just seems to be a container implementing an ITemplate interface.
+
+namespace System.Web.UI {
+
+public class CompiledTemplateBuilder : ITemplate
+{
+ private BuildTemplateMethod templateMethod;
+
+ public CompiledTemplateBuilder (BuildTemplateMethod templateMethod)
+ {
+ this.templateMethod = templateMethod;
+ }
+
+ public virtual void InstantiateIn (Control ctrl)
+ {
+ templateMethod (ctrl);
+ }
+}
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs b/mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs
new file mode 100755
index 00000000000..cacfe8da90a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ConstructorNeedsTagAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Web.UI.ConstructorNeedsTagAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ConstructorNeedsTagAttribute : Attribute
+ {
+ bool needsTag;
+
+ public ConstructorNeedsTagAttribute ()
+ {
+ needsTag = false;
+ }
+
+ public ConstructorNeedsTagAttribute (bool needsTag)
+ {
+ this.needsTag = needsTag;
+ }
+
+ public bool NeedsTag {
+ get { return needsTag; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs
new file mode 100644
index 00000000000..9e2720bab14
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Control.cs
@@ -0,0 +1,867 @@
+//
+// System.Web.UI.Control.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+/*
+ * Maintainer: bob@thestuff.net, gvaish@iitk.ac.in
+ * (C) Bob Smith, Gaurav Vaish
+ */
+
+//notes: view state only tracks changes after OnInit method is executed for the page request. You can read from it at any time, but cant write to it during rendering.
+//even more notes: view state info in trackviewstate method description. read later.
+//Ok, enough notes: what the heck is different between enable view state, and track view state.
+//Well, maybe not. How does the ViewState know when to track changes? Does it look at the property
+//on the owning control, or does it have a method/property of its own that gets called?
+// I think this last question is solved in the Interface for it. Look into this.
+
+//cycle:
+//init is called when control is first created.
+//load view state ic called right after init to populate the view state.
+//loadpostdata is called if ipostbackdatahandler is implemented.
+//load is called when control is loaded into a page
+//raisepostdatachangedevent if ipostbackdatahandler is implemented.
+//raisepostbackevent if ipostbackeventhandler is implemented.
+//prerender is called when the server is about to render its page object
+//SaveViewState is called.
+//Unload then dispose it apears. :)
+
+//Naming Container MUST have some methods. What are they? No clue. Help? (updated: the doc says that it's just a marker interface)
+
+//read this later. http://gotdotnet.com/quickstart/aspplus/
+//This to: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconattributesdesign-timesupport.asp
+//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpcontracefunctionality.asp
+
+// Isnt life grand? :)
+// See the undocumented methods? Gota love um. ;)
+// ASP.test4_aspx.Page_Load(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnLoad(EventArgs e) +67
+// System.Web.UI.Control.LoadRecursive() +73
+// System.Web.UI.Page.ProcessRequestMain() +394
+
+// ASP.test4_aspx.Page_Unload(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.EventHandler.Invoke(Object sender, EventArgs e) +0
+// System.Web.UI.Control.OnUnload(EventArgs e) +67
+// System.Web.UI.Control.UnloadRecursive(Boolean dispose) +78
+// System.Web.UI.Page.ProcessRequest() +194
+// System.Web.UI.Page.ProcessRequest(HttpContext context) +18
+// System.Web.CallHandlerExecutionStep.Execute() +179
+// System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
+
+
+// ASP.test4_aspx.Page_Unload(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnUnload(EventArgs e) +67
+// System.Web.UI.Control.UnloadRecursive(Boolean dispose) +78
+// System.Web.UI.Page.ProcessRequest()
+
+// ASP.test4_aspx.Page_Kill(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnPreRender(EventArgs e) +67
+// System.Web.UI.Control.PreRenderRecursiveInternal() +61
+// System.Web.UI.Page.ProcessRequestMain() +753
+
+// ASP.test4_aspx.OnInit(EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.InitRecursive(Control namingContainer) +202
+// System.Web.UI.Page.ProcessRequestMain() +120
+
+// ASP.test4_aspx.SaveViewState() in \\genfs2\www24\bobsmith11\test4.aspx:12
+// System.Web.UI.Control.SaveViewStateRecursive() +51
+// System.Web.UI.Page.SavePageViewState() +174
+// System.Web.UI.Page.ProcessRequestMain() +861
+
+// ASP.test_aspx.LoadViewState(Object t) +28
+// System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
+// System.Web.UI.Page.LoadPageViewState() +182
+// System.Web.UI.Page.ProcessRequestMain() +256
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
+ {
+ private static readonly object DataBindingEvent = new object();
+ private static readonly object DisposedEvent = new object();
+ private static readonly object InitEvent = new object();
+ private static readonly object LoadEvent = new object();
+ private static readonly object PreRenderEvent = new object();
+ private static readonly object UnloadEvent = new object();
+ private string uniqueID;
+ private string _userId = null;
+ private string _cachedClientId = null;
+ private ControlCollection _controls = null;
+ private bool _enableViewState = true;
+ private IDictionary _childViewStates = null; //TODO: Not sure datatype. Placeholder guess.
+ private bool _isNamingContainer = false;
+ private Control _namingContainer = null;
+ private Page _page = null;
+ private Control _parent = null;
+ private ISite _site = null;
+ private bool _visible = true;
+ private HttpContext _context = null;
+ private bool _childControlsCreated = false;
+ private StateBag _viewState = null;
+ private bool _trackViewState = false;
+ private EventHandlerList _events = new EventHandlerList();
+ private RenderMethod _renderMethodDelegate = null;
+ private bool autoID = true;
+ private bool creatingControls = false;
+ private bool bindingContainer = true;
+ private bool autoEventWireup = true;
+
+ bool inited = false;
+ bool loaded = false;
+ bool prerendered = false;
+ int defaultNumberID = 0;
+
+ private DataBindingCollection dataBindings = null;
+
+ public Control()
+ {
+ if (this is INamingContainer) _isNamingContainer = true;
+ }
+
+ public Control BindingContainer
+ {
+ get {
+ Control container = NamingContainer;
+ if (!container.bindingContainer)
+ container = container.BindingContainer;
+ return container;
+ }
+ }
+
+ public virtual string ClientID {
+ get {
+ string client = UniqueID;
+
+ if (client != null)
+ client = client.Replace (':', '_');
+
+ return client;
+ }
+ }
+
+ public virtual ControlCollection Controls //DIT
+ {
+ get
+ {
+ if (_controls == null) _controls = CreateControlCollection();
+ return _controls;
+ }
+ }
+ public virtual bool EnableViewState //DIT
+ {
+ get
+ {
+ return _enableViewState;
+ }
+ set
+ {
+ _enableViewState = value;
+ }
+ }
+
+ public virtual string ID {
+ get {
+ return _userId;
+ }
+
+ set {
+ if (value == "")
+ value = null;
+
+ _userId = value;
+ NullifyUniqueID ();
+ }
+ }
+
+ public virtual Control NamingContainer //DIT
+ {
+ get
+ {
+ if (_namingContainer == null && _parent != null)
+ {
+ if (_parent._isNamingContainer == false)
+ _namingContainer = _parent.NamingContainer;
+ else
+ _namingContainer = _parent;
+ }
+ return _namingContainer;
+ }
+ }
+ public virtual Page Page //DIT
+ {
+ get
+ {
+ if (_page == null && _parent != null) _page = _parent.Page;
+ return _page;
+ }
+ set
+ {
+ _page = value;
+ }
+ }
+ public virtual Control Parent //DIT
+ {
+ get
+ {
+ return _parent;
+ }
+ }
+ public ISite Site //DIT
+ {
+ get
+ {
+ return _site;
+ }
+ set
+ {
+ _site = value;
+ }
+ }
+
+ public virtual string TemplateSourceDirectory {
+ get { return (_parent == null) ? String.Empty : _parent.TemplateSourceDirectory; }
+ }
+
+ public virtual string UniqueID {
+ get {
+ if (uniqueID != null)
+ return uniqueID;
+
+ if (_namingContainer == null) {
+ return _userId;
+ }
+
+ if (_userId == null)
+ _userId = _namingContainer.GetDefaultName ();
+
+ string prefix = _namingContainer.UniqueID;
+ if (_namingContainer == _page || prefix == null) {
+ uniqueID = _userId;
+ return uniqueID;
+ }
+
+ uniqueID = prefix + ":" + _userId;
+ return uniqueID;
+ }
+ }
+ public virtual bool Visible
+ {
+ get
+ {
+ if (_visible == false)
+ return false;
+
+ if (_parent != null)
+ return _parent.Visible;
+
+ return true;
+ }
+ set
+ {
+ _visible = value;
+ }
+ }
+ protected bool ChildControlsCreated //DIT
+ {
+ get
+ {
+ return _childControlsCreated;
+ }
+ set
+ {
+ if (value == false && _childControlsCreated == true)
+ _controls.Clear();
+ _childControlsCreated = value;
+ }
+ }
+ protected virtual HttpContext Context //DIT
+ {
+ get
+ {
+ HttpContext context;
+ if (_context != null)
+ return _context;
+ if (_parent == null)
+ return HttpContext.Current;
+ context = _parent.Context;
+ if (context != null)
+ return context;
+ return HttpContext.Current;
+ }
+ }
+ protected EventHandlerList Events //DIT
+ {
+ get
+ {
+ if (_events == null)
+ {
+ _events = new EventHandlerList();
+ }
+ return _events;
+ }
+ }
+ protected bool HasChildViewState //DIT
+ {
+ get
+ {
+ if (_childViewStates == null) return false;
+ return true;
+ }
+ }
+ protected bool IsTrackingViewState //DIT
+ {
+ get
+ {
+ return _trackViewState;
+ }
+ }
+ protected virtual StateBag ViewState
+ {
+ get
+ {
+ if(_viewState == null)
+ _viewState = new StateBag (ViewStateIgnoresCase);
+
+ if (IsTrackingViewState)
+ _viewState.TrackViewState ();
+
+ return _viewState;
+ }
+ }
+
+ protected virtual bool ViewStateIgnoresCase
+ {
+ get {
+ return false;
+ }
+ }
+
+ internal bool AutoEventWireup {
+ get { return autoEventWireup; }
+ set { autoEventWireup = value; }
+ }
+
+ internal void SetBindingContainer (bool isBC)
+ {
+ bindingContainer = isBC;
+ }
+
+ internal void ResetChildNames ()
+ {
+ defaultNumberID = 0;
+ }
+
+ string GetDefaultName ()
+ {
+ return "_ctrl" + defaultNumberID++;
+ }
+
+ void NullifyUniqueID ()
+ {
+ uniqueID = null;
+ if (_controls == null)
+ return;
+
+ foreach (Control c in _controls)
+ c.NullifyUniqueID ();
+ }
+
+ protected internal virtual void AddedControl (Control control, int index)
+ {
+ /* Ensure the control don't have more than 1 parent */
+ if (control._parent != null)
+ control._parent.Controls.Remove (control);
+
+ control._parent = this;
+ control._page = Page;
+
+ if (_isNamingContainer) {
+ control._namingContainer = this;
+ if (control.AutoID == true && control._userId == null) {
+ control._userId = GetDefaultName ();
+ }
+ }
+
+ if (inited)
+ control.InitRecursive (_isNamingContainer ? this : null);
+
+ if (loaded)
+ control.LoadRecursive ();
+
+ if (prerendered)
+ control.PreRenderRecursiveInternal ();
+ }
+
+ protected virtual void AddParsedSubObject(object obj) //DIT
+ {
+ WebTrace.PushContext ("Control.AddParsedSubobject ()");
+ Control c = obj as Control;
+ WebTrace.WriteLine ("Start: {0} -> {1}", obj, (c != null) ? c.ID : String.Empty);
+ if (c != null) Controls.Add(c);
+ WebTrace.WriteLine ("End");
+ WebTrace.PopContext ();
+ }
+ protected void BuildProfileTree(string parentId, bool calcViewState)
+ {
+ //TODO
+ }
+ protected void ClearChildViewState()
+ {
+ //TODO
+ //Not quite sure about this. an example clears children then calls this, so I think
+ //view state is local to the current object, not children.
+ }
+ protected virtual void CreateChildControls() {} //DIT
+ protected virtual ControlCollection CreateControlCollection() //DIT
+ {
+ return new ControlCollection(this);
+ }
+
+ protected virtual void EnsureChildControls () //DIT
+ {
+ if (ChildControlsCreated == false && !creatingControls) {
+ creatingControls = true;
+ CreateChildControls();
+ ChildControlsCreated = true;
+ creatingControls = false;
+ }
+ }
+
+ public virtual Control FindControl (string id)
+ {
+ return FindControl (id, 0);
+ }
+
+ Control LookForControlByName (string id)
+ {
+ if (!HasChildren)
+ return null;
+
+ foreach (Control c in _controls) {
+ if (String.Compare (id, c._userId, true) == 0)
+ return c;
+
+ if (!c._isNamingContainer && c.HasChildren) {
+ Control child = c.LookForControlByName (id);
+ if (child != null)
+ return child;
+ }
+ }
+
+ return null;
+ }
+
+ protected virtual Control FindControl (string id, int pathOffset)
+ {
+ EnsureChildControls ();
+ if (_controls == null)
+ return null;
+
+ Control namingContainer = null;
+ if (!_isNamingContainer) {
+ namingContainer = NamingContainer;
+ if (namingContainer == null)
+ return null;
+
+ return namingContainer.FindControl (id, pathOffset);
+ }
+
+ int colon = id.IndexOf (':', pathOffset);
+ if (colon == -1)
+ return LookForControlByName (id.Substring (pathOffset));
+
+ string idfound = id.Substring (pathOffset, colon - pathOffset);
+ namingContainer = LookForControlByName (idfound);
+ if (namingContainer == null)
+ return null;
+
+ return namingContainer.FindControl (id, colon + 1);
+ }
+
+ protected virtual void LoadViewState(object savedState)
+ {
+ if (savedState != null)
+ ViewState.LoadViewState (savedState);
+ }
+
+ [MonoTODO("Secure?")]
+ protected string MapPathSecure(string virtualPath)
+ {
+ string combined = UrlUtils.Combine (TemplateSourceDirectory, virtualPath);
+ return Context.Request.MapPath (combined);
+ }
+
+ protected virtual bool OnBubbleEvent(object source, EventArgs args) //DIT
+ {
+ return false;
+ }
+ protected virtual void OnDataBinding(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[DataBindingEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnInit(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[InitEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnLoad(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[LoadEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnPreRender(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[PreRenderEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnUnload(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[UnloadEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+
+ protected void RaiseBubbleEvent(object source, EventArgs args)
+ {
+ Control c = Parent;
+ while (c != null) {
+ if (c.OnBubbleEvent (source, args))
+ break;
+ c = c.Parent;
+ }
+ }
+
+ protected virtual void Render(HtmlTextWriter writer) //DIT
+ {
+ RenderChildren(writer);
+ }
+
+ protected virtual void RenderChildren(HtmlTextWriter writer) //DIT
+ {
+ if (_renderMethodDelegate != null)
+ _renderMethodDelegate(writer, this);
+ else if (_controls != null)
+ foreach (Control c in _controls)
+ c.RenderControl(writer);
+ }
+
+ protected virtual object SaveViewState ()
+ {
+ if (_viewState == null)
+ return null;
+
+ return _viewState.SaveViewState ();
+ }
+
+ protected virtual void TrackViewState()
+ {
+ if (_viewState != null)
+ _viewState.TrackViewState ();
+ _trackViewState = true;
+ }
+
+ public virtual void Dispose()
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler) _events [DisposedEvent];
+ if (eh != null)
+ eh(this, EventArgs.Empty);
+ }
+ }
+
+ public bool HasChildren
+ {
+ get { return (_controls != null && _controls.Count > 0); }
+ }
+
+ public event EventHandler DataBinding //DIT
+ {
+ add
+ {
+ Events.AddHandler(DataBindingEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DataBindingEvent, value);
+ }
+ }
+ public event EventHandler Disposed //DIT
+ {
+ add
+ {
+ Events.AddHandler(DisposedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DisposedEvent, value);
+ }
+ }
+ public event EventHandler Init //DIT
+ {
+ add
+ {
+ Events.AddHandler(InitEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(InitEvent, value);
+ }
+ }
+ public event EventHandler Load //DIT
+ {
+ add
+ {
+ Events.AddHandler(LoadEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(LoadEvent, value);
+ }
+ }
+ public event EventHandler PreRender //DIT
+ {
+ add
+ {
+ Events.AddHandler(PreRenderEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(PreRenderEvent, value);
+ }
+ }
+ public event EventHandler Unload //DIT
+ {
+ add
+ {
+ Events.AddHandler(UnloadEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UnloadEvent, value);
+ }
+ }
+
+ public virtual void DataBind() //DIT
+ {
+ OnDataBinding(EventArgs.Empty);
+ if (_controls != null)
+ foreach (Control c in _controls)
+ c.DataBind();
+ }
+
+ public virtual bool HasControls() //DIT
+ {
+ if (_controls != null && _controls.Count >0) return true;
+ return false;
+ }
+
+ public void RenderControl(HtmlTextWriter writer)
+ {
+ if (_visible)
+ {
+ //TODO: Something about tracing here.
+ Render(writer);
+ }
+ }
+
+ [MonoTODO]
+ public string ResolveUrl(string relativeUrl)
+ {
+ return relativeUrl;
+ }
+
+ public void SetRenderMethodDelegate(RenderMethod renderMethod) //DIT
+ {
+ WebTrace.PushContext ("Control.AddParsedSubobject ()");
+ WebTrace.WriteLine ("Start");
+ _renderMethodDelegate = renderMethod;
+ WebTrace.WriteLine ("End");
+ WebTrace.PopContext ();
+ }
+
+ protected void LoadRecursive()
+ {
+ OnLoad (EventArgs.Empty);
+ if (_controls != null) {
+ foreach (Control c in _controls)
+ c.LoadRecursive ();
+ }
+ loaded = true;
+ }
+
+ protected void UnloadRecursive(Boolean dispose)
+ {
+ if (_controls != null) {
+ foreach (Control c in _controls)
+ c.UnloadRecursive (dispose);
+ }
+
+ OnUnload (EventArgs.Empty);
+ if (dispose)
+ Dispose();
+ }
+
+ protected void PreRenderRecursiveInternal()
+ {
+ if (_visible) {
+ EnsureChildControls ();
+ OnPreRender (EventArgs.Empty);
+ if (_controls == null)
+ return;
+
+ foreach (Control c in _controls)
+ c.PreRenderRecursiveInternal ();
+ }
+ prerendered = true;
+ }
+
+ protected void InitRecursive(Control namingContainer)
+ {
+ if (_controls != null) {
+ if (_isNamingContainer)
+ namingContainer = this;
+
+ if (namingContainer != null &&
+ namingContainer._userId == null &&
+ namingContainer.autoID)
+ namingContainer._userId = namingContainer.GetDefaultName ();
+
+ foreach (Control c in _controls) {
+ c._page = Page;
+ c._namingContainer = namingContainer;
+ c.InitRecursive (namingContainer);
+ }
+ }
+
+ OnInit (EventArgs.Empty);
+ TrackViewState ();
+ inited = true;
+ }
+
+ internal object SaveViewStateRecursive ()
+ {
+ if (!EnableViewState)
+ return null;
+
+ ArrayList controlList = null;
+ ArrayList controlStates = null;
+
+ foreach (Control ctrl in Controls) {
+ object ctrlState = ctrl.SaveViewStateRecursive ();
+ if (ctrlState == null || ctrl.ID == null)
+ continue;
+
+ if (controlList == null) {
+ controlList = new ArrayList ();
+ controlStates = new ArrayList ();
+ }
+
+ controlList.Add (ctrl.ID);
+ controlStates.Add (ctrlState);
+ }
+
+ object thisState = SaveViewState ();
+ if (thisState == null && controlList == null && controlStates == null)
+ return null;
+
+ return new Triplet (thisState, controlList, controlStates);
+ }
+
+ internal void LoadViewStateRecursive (object savedState)
+ {
+ if (!EnableViewState || !Visible || savedState == null)
+ return;
+
+ Triplet savedInfo = (Triplet) savedState;
+ LoadViewState (savedInfo.First);
+
+ ArrayList controlList = savedInfo.Second as ArrayList;
+ if (controlList == null)
+ return;
+ ArrayList controlStates = savedInfo.Third as ArrayList;
+ int nControls = controlList.Count;
+ for (int i = 0; i < nControls; i++) {
+ Control c = FindControl ((string) controlList [i]);
+ if (c != null && controlStates != null)
+ c.LoadViewStateRecursive (controlStates [i]);
+ }
+ }
+
+ void IParserAccessor.AddParsedSubObject(object obj)
+ {
+ AddParsedSubObject(obj);
+ }
+
+ DataBindingCollection IDataBindingsAccessor.DataBindings
+ {
+ get
+ {
+ if(dataBindings == null)
+ dataBindings = new DataBindingCollection();
+ return dataBindings;
+ }
+ }
+
+ bool IDataBindingsAccessor.HasDataBindings
+ {
+ get
+ {
+ return (dataBindings!=null && dataBindings.Count>0);
+ }
+ }
+
+ internal bool AutoID
+ {
+ get { return autoID; }
+ set {
+ if (value == false && !_isNamingContainer)
+ return;
+
+ autoID = value;
+ }
+ }
+
+ internal void PreventAutoID()
+ {
+ AutoID = false;
+ }
+
+ protected internal virtual void RemovedControl (Control control)
+ {
+ control.UnloadRecursive (false);
+ control._parent = null;
+ control._page = null;
+ control._namingContainer = null;
+ }
+
+ //TODO: I think there are some needed Interface implementations to do here.
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
new file mode 100755
index 00000000000..7acb206a3a3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
@@ -0,0 +1,167 @@
+//
+// System.Web.UI.ControlBuilder.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public class ControlBuilder
+ {
+ TemplateParser parser;
+ ControlBuilder parentBuilder;
+ Type type;
+ string tagName;
+ string id;
+ IDictionary attribs;
+ int line;
+ string fileName;
+
+ public ControlBuilder ()
+ {
+ }
+
+
+ internal ControlBuilder (
+ TemplateParser parser, ControlBuilder parentBuilder,
+ Type type, string tagName, string id,
+ IDictionary attribs, int line, string sourceFileName)
+
+ {
+ this.parser = parser;
+ this.parentBuilder = parentBuilder;
+ this.type = type;
+ this.tagName = tagName;
+ this.id = id;
+ this.attribs = attribs;
+ this.line = line;
+ this.fileName = sourceFileName;
+ }
+
+ public Type ControlType {
+ get { return type; }
+ }
+
+ [MonoTODO]
+ public bool FChildrenAsProperties {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public bool FIsNonParserAccessor {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public bool HasAspCode {
+ get { return false; }
+ }
+
+ public string ID {
+ get { return id; }
+
+ set { id = value; }
+ }
+
+ [MonoTODO]
+ public bool InDesigner {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public Type NamingContainerType {
+ get { return null; }
+ }
+
+ protected TemplateParser Parser {
+ get { return parser; }
+ }
+
+ public string TagName {
+ get { return tagName; }
+ }
+
+ [MonoTODO]
+ public virtual bool AllowWhitespaceLiterals ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public virtual void AppendLiteralString (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void AppendSubBuilder (ControlBuilder subBuilder)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void CloseControl ()
+ {
+ }
+
+ [MonoTODO]
+ public static ControlBuilder CreateBuilderFromType (
+ TemplateParser parser, ControlBuilder parentBuilder,
+ Type type, string tagName, string id,
+ IDictionary attribs, int line, string sourceFileName)
+ {
+ return new ControlBuilder (parser, parentBuilder, type,
+ tagName, id, attribs, line, sourceFileName);
+ }
+
+ [MonoTODO]
+ public virtual Type GetChildControlType (string tagName, IDictionary attribs)
+ {
+ return attribs [tagName] as Type;
+ }
+
+ [MonoTODO]
+ public virtual bool HasBody ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public virtual bool HtmlDecodeLiterals ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public virtual void Init (
+ TemplateParser parser, ControlBuilder parentBuilder,
+ Type type, string tagName, string id, IDictionary attribs)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool NeedsTagInnerText ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void OnAppendToParentBuilder ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void SetTagInnerText (string text)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs b/mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs
new file mode 100755
index 00000000000..dfae94c445d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlBuilderAttribute.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.ControlBuilderAttribute.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ControlBuilderAttribute : Attribute
+ {
+ Type builderType;
+ public static readonly ControlBuilderAttribute Default = new ControlBuilderAttribute (null);
+
+ public ControlBuilderAttribute (Type builderType)
+ {
+ this.builderType = builderType;
+ }
+
+ public Type BuilderType {
+ get { return builderType; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ControlBuilderAttribute))
+ return false;
+ return ((ControlBuilderAttribute) obj).builderType == builderType;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ControlCollection.cs b/mcs/class/System.Web/System.Web.UI/ControlCollection.cs
new file mode 100755
index 00000000000..225b55b10ce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ControlCollection.cs
@@ -0,0 +1,124 @@
+//
+// System.Web.UI.ControlCollection.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public class ControlCollection : ICollection, IEnumerable
+ {
+ ArrayList list = new ArrayList ();
+ Control owner;
+
+ public ControlCollection (Control owner)
+ {
+ if (owner == null)
+ throw new ArgumentException ();
+
+ this.owner = owner;
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public virtual Control this [int index] {
+ get { return list [index] as Control; }
+ }
+
+ protected Control Owner {
+ get { return owner; }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public virtual void Add (Control child)
+ {
+ if (child == null)
+ throw new ArgumentNullException ();
+ if (IsReadOnly)
+ throw new HttpException ();
+
+ list.Add (child);
+ owner.AddedControl (child, list.Count - 1);
+ }
+
+ public virtual void AddAt (int index, Control child)
+ {
+ if (child == null) // maybe we should check for ! (child is Control)?
+ throw new ArgumentNullException ();
+
+ if ((index < -1) || (index > Count))
+ throw new ArgumentOutOfRangeException ();
+
+ if (IsReadOnly)
+ throw new HttpException ();
+
+ if (index == -1){
+ Add (child);
+ } else {
+ list [index] = child;
+ owner.AddedControl (child, index);
+ }
+ }
+
+ public virtual void Clear ()
+ {
+ list.Clear ();
+ if (owner != null)
+ owner.ResetChildNames ();
+ }
+
+ public virtual bool Contains (Control c)
+ {
+ return list.Contains (c);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public virtual int IndexOf (Control c)
+ {
+ return list.IndexOf (c);
+ }
+
+ public virtual void Remove (Control value)
+ {
+ list.Remove (value);
+ owner.RemovedControl (value);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (IsReadOnly)
+ throw new HttpException ();
+
+ Control value = (Control) list [index];
+ list.RemoveAt (index);
+ owner.RemovedControl (value);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs b/mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs
new file mode 100755
index 00000000000..8191228681c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs
@@ -0,0 +1,106 @@
+//
+// System.Web.UI.CssStyleCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.UI {
+
+ public sealed class CssStyleCollection
+ {
+ private StateBag bag;
+ private StateBag style;
+
+ internal CssStyleCollection (StateBag bag)
+ {
+ this.bag = bag;
+ style = new StateBag ();
+ string st_string = bag ["style"] as string;
+ if (st_string != null)
+ FillStyle (st_string);
+ }
+
+ internal void FillStyle (string s)
+ {
+ int mark = s.IndexOf (':');
+ if (mark == -1)
+ return;
+ string key = s.Substring (0, mark). Trim ();
+ if (mark + 1 > s.Length)
+ return;
+
+ string fullValue = s.Substring (mark + 1);
+ if (fullValue == "")
+ return;
+
+ mark = fullValue.IndexOf (';');
+ string value;
+ if (mark == -1)
+ value = fullValue.Trim ();
+ else
+ value = fullValue.Substring (0, mark).Trim ();
+
+ style.Add (key, value);
+ if (mark + 1 > fullValue.Length)
+ return;
+ FillStyle (fullValue.Substring (mark + 1));
+ }
+
+ private string BagToString ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ foreach (string k in style.Keys)
+ sb.AppendFormat ("{0}: {1}; ", k, style [k]);
+ return sb.ToString ();
+ }
+
+ public int Count
+ {
+ get { return style.Count; }
+ }
+
+ public string this [string key]
+ {
+ get {
+ return style [key] as string;
+ }
+
+ set {
+ Add (key, value);
+ }
+ }
+
+ public ICollection Keys {
+ get { return style.Keys; }
+ }
+
+ public void Add (string key, string value)
+ {
+ style [key] = value;
+ bag ["style"] = BagToString ();
+ }
+
+ public void Clear ()
+ {
+ bag.Remove ("style");
+ style.Clear ();
+ }
+
+ public void Remove (string key)
+ {
+ if (style [key] != null) {
+ style.Remove (key);
+ bag ["style"] = BagToString ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataBinder.cs b/mcs/class/System.Web/System.Web.UI/DataBinder.cs
new file mode 100755
index 00000000000..5ab388c6d89
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBinder.cs
@@ -0,0 +1,158 @@
+//
+// System.Web.UI.DataBinder.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI {
+
+ public sealed class DataBinder
+ {
+ public DataBinder ()
+ {
+ }
+
+ private static string FormatResult (object result, string format)
+ {
+ if (result == null)
+ return String.Empty;
+
+ if (format == null)
+ return result.ToString ();
+
+ return String.Format (format, result);
+ }
+
+ public static object Eval (object container, string expression)
+ {
+ if (expression == null)
+ throw new ArgumentNullException ("expression");
+
+ object current = container;
+
+ while (current != null) {
+ int dot = expression.IndexOf ('.');
+ int size = (dot == -1) ? expression.Length : dot;
+ string prop = expression.Substring (0, size);
+ if (prop.IndexOf ('[') != -1)
+ current = GetIndexedPropertyValue (current, prop);
+ else
+ current = GetPropertyValue (current, prop);
+
+ if (dot == -1)
+ break;
+
+ expression = expression.Substring (prop.Length + 1);
+ }
+
+ return current;
+ }
+
+ public static string Eval (object container, string expression, string format)
+ {
+ object result = Eval (container, expression);
+ return FormatResult (result, format);
+ }
+
+ public static object GetIndexedPropertyValue (object container, string expr)
+ {
+ if (expr == null)
+ throw new ArgumentNullException ("expr");
+
+ int openIdx = expr.IndexOf ('[');
+ int closeIdx = expr.IndexOf (']'); // see the test case. MS ignores all after the first ]
+ if (openIdx < 0 || closeIdx < 0 || closeIdx - openIdx <= 1)
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+
+ string val = expr.Substring (openIdx + 1, closeIdx - openIdx - 1);
+ val = val.Trim ();
+ int valLength = val.Length;
+ if (valLength == 0)
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+
+ int intVal = 0;
+ bool is_string;
+ char first = val [0];
+ if (first >= '0' && first <= '9') {
+ is_string = false;
+ try {
+ intVal = Int32.Parse (val);
+ } catch {
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+ }
+
+ } else if (first == '"' && val [valLength - 1] == '"') {
+ is_string = true;
+ val = val.Substring (0, val.Length - 1).Substring (1);
+ } else {
+ throw new ArgumentException (expr + " is not a valid indexed expression.");
+ }
+
+ string property = null;
+ if (openIdx > 0) {
+ property = expr.Substring (0, openIdx);
+ if (property != null && property != String.Empty)
+ container = GetPropertyValue (container, property);
+ }
+
+ if (container == null)
+ return null;
+
+ Type t = container.GetType ();
+ // MS does not seem to look for any other than "Item"!!!
+ object [] atts = t.GetCustomAttributes (typeof (DefaultMemberAttribute), false);
+ if (atts.Length != 1)
+ throw new ArgumentException (expr + " indexer not found.");
+
+ property = ((DefaultMemberAttribute) atts [0]).MemberName;
+
+ Type [] argTypes = new Type [] { (is_string) ? typeof (string) : typeof (int) };
+ PropertyInfo prop = t.GetProperty (property, argTypes);
+ if (prop == null)
+ throw new ArgumentException (expr + " indexer not found.");
+
+ object [] args = new object [1];
+ if (is_string)
+ args [0] = val;
+ else
+ args [0] = intVal;
+
+ return prop.GetValue (container, args);
+ }
+
+ public static string GetIndexedPropertyValue (object container, string expr, string format)
+ {
+ object result = GetIndexedPropertyValue (container, expr);
+ return FormatResult (result, format);
+ }
+
+ public static object GetPropertyValue (object container, string propName)
+ {
+ if (propName == null)
+ throw new ArgumentNullException ("propName");
+
+ PropertyDescriptor prop = TypeDescriptor.GetProperties (container).Find (propName, true);
+ if (prop == null) {
+ throw new HttpException ("Property " + propName + " not found in " +
+ container.GetType ());
+ }
+
+ return prop.GetValue (container);
+ }
+
+ public static string GetPropertyValue (object container, string propName, string format)
+ {
+ object result = GetPropertyValue (container, propName);
+ return FormatResult (result, format);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DataBinding.cs b/mcs/class/System.Web/System.Web.UI/DataBinding.cs
new file mode 100755
index 00000000000..cf0c8a07d49
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBinding.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.UI.DataBinding.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ public sealed class DataBinding
+ {
+ string propertyName;
+ Type propertyType;
+ string expression;
+
+ public DataBinding (string propertyName, Type propertyType,
+ string expression)
+ {
+ this.propertyName = propertyName;
+ this.propertyType = propertyType;
+ this.expression = expression;
+ }
+
+ public string Expression {
+ get { return expression; }
+ set { expression = value; }
+ }
+
+ public string PropertyName {
+ get { return propertyName; }
+ }
+
+ public Type PropertyType {
+ get { return propertyType; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DataBinding))
+ return false;
+
+ DataBinding o = (DataBinding) obj;
+ return (o.Expression == expression &&
+ o.PropertyName == propertyName &&
+ o.PropertyType == propertyType);
+ }
+
+ public override int GetHashCode ()
+ {
+ return propertyName.GetHashCode () +
+ (propertyType.GetHashCode () << 1) +
+ (expression.GetHashCode () << 2) ;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs b/mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs
new file mode 100755
index 00000000000..80e86454612
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs
@@ -0,0 +1,92 @@
+//
+// System.Web.UI.DataBindingCollection.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class DataBindingCollection : ICollection, IEnumerable
+ {
+ Hashtable list;
+ ArrayList removed;
+
+ public DataBindingCollection ()
+ {
+ list = new Hashtable ();
+ removed = new ArrayList ();
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public DataBinding this [string propertyName] {
+ get { return list [propertyName] as DataBinding; }
+ }
+
+ public string [] RemovedBindings {
+ get { return (string []) removed.ToArray (typeof (string)); }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public void Add (DataBinding binding)
+ {
+ list.Add (binding.PropertyName, binding);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public void Remove (DataBinding binding)
+ {
+ string key = binding.PropertyName;
+ Remove (key);
+ }
+
+ public void Remove (string propertyName)
+ {
+ removed.Add (propertyName);
+ list.Remove (propertyName);
+ }
+
+ public void Remove (string propertyName,
+ bool addToRemovedList)
+ {
+ if (addToRemovedList)
+ removed.Add (String.Empty); // LAMESPEC
+ else
+ removed.Add (propertyName);
+
+ list.Remove (propertyName);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs b/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
new file mode 100644
index 00000000000..65af373bc8c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
@@ -0,0 +1,49 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: DataBindingHandlerAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class DataBindingHandlerAttribute : Attribute
+ {
+ public static readonly DataBindingHandlerAttribute Default;
+
+ private string handlerTypeName;
+
+ public DataBindingHandlerAttribute()
+ {
+ handlerTypeName = String.Empty;
+ }
+
+ public DataBindingHandlerAttribute(string typeName)
+ {
+ handlerTypeName = typeName;
+ }
+
+ public DataBindingHandlerAttribute(Type type)
+ {
+ handlerTypeName = type.AssemblyQualifiedName;
+ }
+
+ public string HandlerTypeName
+ {
+ get
+ {
+ return handlerTypeName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs b/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs
new file mode 100755
index 00000000000..33374d4a0bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.UI.DataBoundLiteralCOntrol.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Text;
+
+namespace System.Web.UI {
+
+ public sealed class DataBoundLiteralControl : Control
+ {
+ private string [] staticLiterals;
+ private string [] dataBoundLiterals;
+
+ public DataBoundLiteralControl (int staticLiteralsCount,
+ int dataBoundLiteralCount)
+ {
+ staticLiterals = new string [staticLiteralsCount];
+ dataBoundLiterals = new string [dataBoundLiteralCount];
+ PreventAutoID ();
+ }
+
+ public string Text {
+ get {
+ StringBuilder text = new StringBuilder ();
+ int stLength = staticLiterals.Length;
+ int dbLength = dataBoundLiterals.Length;
+ int max = (stLength > dbLength) ? stLength : dbLength;
+ for (int i = 0; i < max; i++){
+ if (i < stLength)
+ text.Append (staticLiterals [i]);
+ if (i < dbLength)
+ text.Append (dataBoundLiterals [i]);
+ }
+
+ return text.ToString ();
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null)
+ dataBoundLiterals = (string []) savedState;
+ }
+
+ protected override void Render (HtmlTextWriter output)
+ {
+ output.Write (Text);
+ }
+
+ protected override object SaveViewState ()
+ {
+ if (dataBoundLiterals.Length == 0)
+ return null;
+ return dataBoundLiterals;
+ }
+
+ public void SetDataBoundString (int index, string s)
+ {
+ dataBoundLiterals [index] = s;
+ }
+
+ public void SetStaticString (int index, string s)
+ {
+ staticLiterals [index] = s;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs b/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
new file mode 100644
index 00000000000..901e0c4cb91
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: DesignTimeParseData
+ *
+ * Author: Gaurav Vaish
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: ?%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public sealed class DesignTimeParseData
+ {
+ private static bool inDesigner = false;
+
+ internal static bool InDesigner
+ {
+ get
+ {
+ return inDesigner;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs b/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs
new file mode 100755
index 00000000000..9d5a039625e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs
@@ -0,0 +1,30 @@
+//
+// System.Web.UI.EmptyControlCollection.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ public class EmptyControlCollection : ControlCollection
+ {
+ public EmptyControlCollection (Control owner)
+ : base (owner)
+ {
+ }
+
+ public override void Add (Control child)
+ {
+ throw new NotSupportedException ("Control " + Owner.ID + " does not allow children");
+ }
+
+ public override void AddAt (int index, Control child)
+ {
+ throw new NotSupportedException ("Control " + Owner.ID + " does not allow children");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
new file mode 100644
index 00000000000..f78cffc1b6b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
@@ -0,0 +1,1027 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI{
+
+public class HtmlTextWriter : System.IO.TextWriter {
+
+static HtmlTextWriter(){
+ HtmlTextWriter._tagKeyLookupTable = new Hashtable(97);
+ HtmlTextWriter._tagNameLookupArray = new TagInformation[97];
+ HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other);
+ HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline);
+ HtmlTextWriter.RegisterTag("acronym", HtmlTextWriterTag.Acronym, TagType.Inline);
+ HtmlTextWriter.RegisterTag("address", HtmlTextWriterTag.Address, TagType.Other);
+ HtmlTextWriter.RegisterTag("area", HtmlTextWriterTag.Area, TagType.Other);
+ HtmlTextWriter.RegisterTag("b", HtmlTextWriterTag.B, TagType.Inline);
+ HtmlTextWriter.RegisterTag("base", HtmlTextWriterTag.Base, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("basefont", HtmlTextWriterTag.Basefont, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("bdo", HtmlTextWriterTag.Bdo, TagType.Inline);
+ HtmlTextWriter.RegisterTag("bgsound", HtmlTextWriterTag.Bgsound, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("big", HtmlTextWriterTag.Big, TagType.Inline);
+ HtmlTextWriter.RegisterTag("blockquote", HtmlTextWriterTag.Blockquote, TagType.Other);
+ HtmlTextWriter.RegisterTag("body", HtmlTextWriterTag.Body, TagType.Other);
+ HtmlTextWriter.RegisterTag("br", HtmlTextWriterTag.Br, TagType.Other);
+ HtmlTextWriter.RegisterTag("button", HtmlTextWriterTag.Button, TagType.Inline);
+ HtmlTextWriter.RegisterTag("caption", HtmlTextWriterTag.Caption, TagType.Other);
+ HtmlTextWriter.RegisterTag("center", HtmlTextWriterTag.Center, TagType.Other);
+ HtmlTextWriter.RegisterTag("cite", HtmlTextWriterTag.Cite, TagType.Inline);
+ HtmlTextWriter.RegisterTag("code", HtmlTextWriterTag.Code, TagType.Inline);
+ HtmlTextWriter.RegisterTag("col", HtmlTextWriterTag.Col, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("colgroup", HtmlTextWriterTag.Colgroup, TagType.Other);
+ HtmlTextWriter.RegisterTag("del", HtmlTextWriterTag.Del, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dd", HtmlTextWriterTag.Dd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dfn", HtmlTextWriterTag.Dfn, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dir", HtmlTextWriterTag.Dir, TagType.Other);
+ HtmlTextWriter.RegisterTag("div", HtmlTextWriterTag.Div, TagType.Other);
+ HtmlTextWriter.RegisterTag("dl", HtmlTextWriterTag.Dl, TagType.Other);
+ HtmlTextWriter.RegisterTag("dt", HtmlTextWriterTag.Dt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("em", HtmlTextWriterTag.Em, TagType.Inline);
+ HtmlTextWriter.RegisterTag("embed", HtmlTextWriterTag.Embed, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("fieldset", HtmlTextWriterTag.Fieldset, TagType.Other);
+ HtmlTextWriter.RegisterTag("font", HtmlTextWriterTag.Font, TagType.Inline);
+ HtmlTextWriter.RegisterTag("form", HtmlTextWriterTag.Form, TagType.Other);
+ HtmlTextWriter.RegisterTag("frame", HtmlTextWriterTag.Frame, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("frameset", HtmlTextWriterTag.Frameset, TagType.Other);
+ HtmlTextWriter.RegisterTag("h1", HtmlTextWriterTag.H1, TagType.Other);
+ HtmlTextWriter.RegisterTag("h2", HtmlTextWriterTag.H2, TagType.Other);
+ HtmlTextWriter.RegisterTag("h3", HtmlTextWriterTag.H3, TagType.Other);
+ HtmlTextWriter.RegisterTag("h4", HtmlTextWriterTag.H4, TagType.Other);
+ HtmlTextWriter.RegisterTag("h5", HtmlTextWriterTag.H5, TagType.Other);
+ HtmlTextWriter.RegisterTag("h6", HtmlTextWriterTag.H6, TagType.Other);
+ HtmlTextWriter.RegisterTag("head", HtmlTextWriterTag.Head, TagType.Other);
+ HtmlTextWriter.RegisterTag("hr", HtmlTextWriterTag.Hr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("html", HtmlTextWriterTag.Html, TagType.Other);
+ HtmlTextWriter.RegisterTag("i", HtmlTextWriterTag.I, TagType.Inline);
+ HtmlTextWriter.RegisterTag("iframe", HtmlTextWriterTag.Iframe, TagType.Other);
+ HtmlTextWriter.RegisterTag("img", HtmlTextWriterTag.Img, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("input", HtmlTextWriterTag.Input, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("ins", HtmlTextWriterTag.Ins, TagType.Inline);
+ HtmlTextWriter.RegisterTag("isindex", HtmlTextWriterTag.Isindex, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("kbd", HtmlTextWriterTag.Kbd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("label", HtmlTextWriterTag.Label, TagType.Inline);
+ HtmlTextWriter.RegisterTag("legend", HtmlTextWriterTag.Legend, TagType.Other);
+ HtmlTextWriter.RegisterTag("li", HtmlTextWriterTag.Li, TagType.Inline);
+ HtmlTextWriter.RegisterTag("link", HtmlTextWriterTag.Link, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("map", HtmlTextWriterTag.Map, TagType.Other);
+ HtmlTextWriter.RegisterTag("marquee", HtmlTextWriterTag.Marquee, TagType.Other);
+ HtmlTextWriter.RegisterTag("menu", HtmlTextWriterTag.Menu, TagType.Other);
+ HtmlTextWriter.RegisterTag("meta", HtmlTextWriterTag.Meta, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("nobr", HtmlTextWriterTag.Nobr, TagType.Inline);
+ HtmlTextWriter.RegisterTag("noframes", HtmlTextWriterTag.Noframes, TagType.Other);
+ HtmlTextWriter.RegisterTag("noscript", HtmlTextWriterTag.Noscript, TagType.Other);
+ HtmlTextWriter.RegisterTag("object", HtmlTextWriterTag.Object, TagType.Other);
+ HtmlTextWriter.RegisterTag("ol", HtmlTextWriterTag.Ol, TagType.Other);
+ HtmlTextWriter.RegisterTag("option", HtmlTextWriterTag.Option, TagType.Other);
+ HtmlTextWriter.RegisterTag("p", HtmlTextWriterTag.P, TagType.Inline);
+ HtmlTextWriter.RegisterTag("param", HtmlTextWriterTag.Param, TagType.Other);
+ HtmlTextWriter.RegisterTag("pre", HtmlTextWriterTag.Pre, TagType.Other);
+ HtmlTextWriter.RegisterTag("q", HtmlTextWriterTag.Q, TagType.Inline);
+ HtmlTextWriter.RegisterTag("rt", HtmlTextWriterTag.Rt, TagType.Other);
+ HtmlTextWriter.RegisterTag("ruby", HtmlTextWriterTag.Ruby, TagType.Other);
+ HtmlTextWriter.RegisterTag("s", HtmlTextWriterTag.S, TagType.Inline);
+ HtmlTextWriter.RegisterTag("samp", HtmlTextWriterTag.Samp, TagType.Inline);
+ HtmlTextWriter.RegisterTag("script", HtmlTextWriterTag.Script, TagType.Other);
+ HtmlTextWriter.RegisterTag("select", HtmlTextWriterTag.Select, TagType.Other);
+ HtmlTextWriter.RegisterTag("small", HtmlTextWriterTag.Small, TagType.Other);
+ HtmlTextWriter.RegisterTag("span", HtmlTextWriterTag.Span, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strike", HtmlTextWriterTag.Strike, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strong", HtmlTextWriterTag.Strong, TagType.Inline);
+ HtmlTextWriter.RegisterTag("style", HtmlTextWriterTag.Style, TagType.Other);
+ HtmlTextWriter.RegisterTag("sub", HtmlTextWriterTag.Sub, TagType.Inline);
+ HtmlTextWriter.RegisterTag("sup", HtmlTextWriterTag.Sup, TagType.Inline);
+ HtmlTextWriter.RegisterTag("table", HtmlTextWriterTag.Table, TagType.Other);
+ HtmlTextWriter.RegisterTag("tbody", HtmlTextWriterTag.Tbody, TagType.Other);
+ HtmlTextWriter.RegisterTag("td", HtmlTextWriterTag.Td, TagType.Inline);
+ HtmlTextWriter.RegisterTag("textarea", HtmlTextWriterTag.Textarea, TagType.Inline);
+ HtmlTextWriter.RegisterTag("tfoot", HtmlTextWriterTag.Tfoot, TagType.Other);
+ HtmlTextWriter.RegisterTag("th", HtmlTextWriterTag.Th, TagType.Inline);
+ HtmlTextWriter.RegisterTag("thead", HtmlTextWriterTag.Thead, TagType.Other);
+ HtmlTextWriter.RegisterTag("title", HtmlTextWriterTag.Title, TagType.Other);
+ HtmlTextWriter.RegisterTag("tr", HtmlTextWriterTag.Tr, TagType.Other);
+ HtmlTextWriter.RegisterTag("tt", HtmlTextWriterTag.Tt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("u", HtmlTextWriterTag.U, TagType.Inline);
+ HtmlTextWriter.RegisterTag("ul", HtmlTextWriterTag.Ul, TagType.Other);
+ HtmlTextWriter.RegisterTag("var", HtmlTextWriterTag.Var, TagType.Inline);
+ HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other);
+
+ HtmlTextWriter._attrKeyLookupTable = new Hashtable(40);
+ HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40];
+ HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true);
+ HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false);
+ HtmlTextWriter.RegisterAttribute("alt", HtmlTextWriterAttribute.Alt, true);
+ HtmlTextWriter.RegisterAttribute("background", HtmlTextWriterAttribute.Background, true);
+ HtmlTextWriter.RegisterAttribute("bgcolor", HtmlTextWriterAttribute.Bgcolor, false);
+ HtmlTextWriter.RegisterAttribute("border", HtmlTextWriterAttribute.Border, false);
+ HtmlTextWriter.RegisterAttribute("bordercolor", HtmlTextWriterAttribute.Bordercolor, false);
+ HtmlTextWriter.RegisterAttribute("cellpadding", HtmlTextWriterAttribute.Cellpadding, false);
+ HtmlTextWriter.RegisterAttribute("cellspacing", HtmlTextWriterAttribute.Cellspacing, false);
+ HtmlTextWriter.RegisterAttribute("checked", HtmlTextWriterAttribute.Checked, false);
+ HtmlTextWriter.RegisterAttribute("class", HtmlTextWriterAttribute.Class, true);
+ HtmlTextWriter.RegisterAttribute("cols", HtmlTextWriterAttribute.Cols, false);
+ HtmlTextWriter.RegisterAttribute("colspan", HtmlTextWriterAttribute.Colspan, false);
+ HtmlTextWriter.RegisterAttribute("disabled", HtmlTextWriterAttribute.Disabled, false);
+ HtmlTextWriter.RegisterAttribute("for", HtmlTextWriterAttribute.For, false);
+ HtmlTextWriter.RegisterAttribute("height", HtmlTextWriterAttribute.Height, false);
+ HtmlTextWriter.RegisterAttribute("href", HtmlTextWriterAttribute.Href, true);
+ HtmlTextWriter.RegisterAttribute("id", HtmlTextWriterAttribute.Id, false);
+ HtmlTextWriter.RegisterAttribute("maxlength", HtmlTextWriterAttribute.Maxlength, false);
+ HtmlTextWriter.RegisterAttribute("multiple", HtmlTextWriterAttribute.Multiple, false);
+ HtmlTextWriter.RegisterAttribute("name", HtmlTextWriterAttribute.Name, false);
+ HtmlTextWriter.RegisterAttribute("nowrap", HtmlTextWriterAttribute.Nowrap, false);
+ HtmlTextWriter.RegisterAttribute("onchange", HtmlTextWriterAttribute.Onchange, true);
+ HtmlTextWriter.RegisterAttribute("onclick", HtmlTextWriterAttribute.Onclick, true);
+ HtmlTextWriter.RegisterAttribute("readonly", HtmlTextWriterAttribute.ReadOnly, false);
+ HtmlTextWriter.RegisterAttribute("rows", HtmlTextWriterAttribute.Rows, false);
+ HtmlTextWriter.RegisterAttribute("rowspan", HtmlTextWriterAttribute.Rowspan, false);
+ HtmlTextWriter.RegisterAttribute("rules", HtmlTextWriterAttribute.Rules, false);
+ HtmlTextWriter.RegisterAttribute("selected", HtmlTextWriterAttribute.Selected, false);
+ HtmlTextWriter.RegisterAttribute("size", HtmlTextWriterAttribute.Size, false);
+ HtmlTextWriter.RegisterAttribute("src", HtmlTextWriterAttribute.Src, true);
+ HtmlTextWriter.RegisterAttribute("style", HtmlTextWriterAttribute.Style, false);
+ HtmlTextWriter.RegisterAttribute("tabindex", HtmlTextWriterAttribute.Tabindex, false);
+ HtmlTextWriter.RegisterAttribute("target", HtmlTextWriterAttribute.Target, false);
+ HtmlTextWriter.RegisterAttribute("title", HtmlTextWriterAttribute.Title, true);
+ HtmlTextWriter.RegisterAttribute("type", HtmlTextWriterAttribute.Type, false);
+ HtmlTextWriter.RegisterAttribute("valign", HtmlTextWriterAttribute.Valign, false);
+ HtmlTextWriter.RegisterAttribute("value", HtmlTextWriterAttribute.Value, true);
+ HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false);
+ HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false);
+
+ HtmlTextWriter._styleKeyLookupTable = new Hashtable(14);
+ HtmlTextWriter._styleNameLookupArray = new String[14];
+ HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor);
+ HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage);
+ HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse);
+ HtmlTextWriter.RegisterStyle("border-color", HtmlTextWriterStyle.BorderColor);
+ HtmlTextWriter.RegisterStyle("border-style", HtmlTextWriterStyle.BorderStyle);
+ HtmlTextWriter.RegisterStyle("border-width", HtmlTextWriterStyle.BorderWidth);
+ HtmlTextWriter.RegisterStyle("color", HtmlTextWriterStyle.Color);
+ HtmlTextWriter.RegisterStyle("font-family", HtmlTextWriterStyle.FontFamily);
+ HtmlTextWriter.RegisterStyle("font-size", HtmlTextWriterStyle.FontSize);
+ HtmlTextWriter.RegisterStyle("font-style", HtmlTextWriterStyle.FontStyle);
+ HtmlTextWriter.RegisterStyle("font-weight", HtmlTextWriterStyle.FontWeight);
+ HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height);
+ HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration);
+ HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width);
+}
+
+public HtmlTextWriter(TextWriter writer):this(writer, " "){}
+
+public HtmlTextWriter(TextWriter writer, string tabString) : base() {
+ this.writer = writer;
+ this.tabString = tabString;
+ indentLevel = 0;
+ tabsPending = false;
+ _httpWriter = writer as HttpWriter;
+ _isDescendant = GetType() == typeof(HtmlTextWriter) == false;
+ _attrList = new RenderAttribute[20];
+ _attrCount = 0;
+ _styleList = new RenderStyle[20];
+ _styleCount = 0;
+ _endTags = new TagStackEntry[16];
+ _endTagCount = 0;
+ _inlineCount = 0;
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AttributeInformation attrInfo = HtmlTextWriter._attrNameLookupArray[(int) key];
+ AddAttribute(attrInfo.name, value, key, attrInfo.encode);
+ }
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AddAttribute(HtmlTextWriter._attrNameLookupArray[(int) key].name, value, key, fEncode);
+ }
+}
+
+public virtual void AddAttribute(string name, string value){
+ HtmlTextWriterAttribute attr = GetAttributeKey(name);
+ value = EncodeAttributeValue(GetAttributeKey(name), value);
+ AddAttribute(name, value, attr);
+}
+
+public virtual void AddAttribute(string name, string value, bool fEndode){
+ value = EncodeAttributeValue(value, fEndode);
+ AddAttribute(name, value, GetAttributeKey(name));
+}
+
+protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key){
+ AddAttribute(name, value, key, false);
+}
+
+private void AddAttribute(string name, string value, HtmlTextWriterAttribute key, bool encode){
+ if (_attrCount >= (int) _attrList.Length) {
+ RenderAttribute[] rAttrArr = new RenderAttribute[_attrList.Length * 2];
+ System.Array.Copy(_attrList, rAttrArr, (int) _attrList.Length);
+ _attrList = rAttrArr;
+ }
+ RenderAttribute rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ rAttr.encode = encode;
+ _attrList [_attrCount++] = rAttr;
+}
+
+public virtual void AddStyleAttribute(HtmlTextWriterStyle key, string value){
+ AddStyleAttribute(GetStyleName(key), value, key);
+}
+
+public virtual void AddStyleAttribute(string name, string value){
+ AddStyleAttribute(name, value, GetStyleKey(name));
+}
+
+protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key){
+ RenderStyle[] tagRender;
+ RenderStyle beforeTag;
+
+ if (_styleCount >= (int) _styleList.Length) {
+ RenderStyle[] rAttrArr = new RenderStyle[_styleList.Length * 2];
+ System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length);
+ _styleList = rAttrArr;
+ }
+ RenderStyle rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ _styleList [_styleCount++] = rAttr;
+}
+
+public override void Close(){
+ writer.Close();
+}
+
+protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value){
+ bool valid = true;
+ if (0 <= (int) attrKey && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ valid = HtmlTextWriter._attrNameLookupArray[(int) attrKey].encode;
+ return EncodeAttributeValue(value, valid);
+}
+
+protected string EncodeAttributeValue(string value, bool fEncode){
+ if (value == null)
+ return null;
+ if (!(fEncode))
+ return value;
+ return System.Web.HttpUtility.HtmlAttributeEncode(value);
+}
+
+protected string EncodeUrl(string url){
+ if (url.IndexOf(SpaceChar) < 0)
+ return url;
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ for(int i=0; i <= url.Length; i++){
+ char temp = url[i];
+ if (temp != 32)
+ sb.Append(temp);
+ else
+ sb.Append("%20");
+ }
+ return sb.ToString();
+}
+
+protected virtual void FilterAttributes(){
+ int count = 0;
+ for(int i=0; i < _styleCount; i++){
+ RenderStyle rStyle = _styleList[i];
+ if (OnStyleAttributeRender(rStyle.name, rStyle.value, rStyle.key)) {
+ count++;
+ }
+ }
+ _styleCount = count;
+ count = 0;
+ for(int i=0; i <= _attrCount; i++){
+ RenderAttribute rAttr = _attrList[i];
+ if (OnAttributeRender(rAttr.name, rAttr.value, rAttr.key)) {
+ count++;
+ }
+ }
+ _attrCount = count;
+}
+
+public override void Flush(){
+ writer.Flush();
+}
+
+protected HtmlTextWriterAttribute GetAttributeKey(string attrName){
+ if (attrName != null && attrName.Length > 0) {
+ object attr = HtmlTextWriter._attrKeyLookupTable[attrName.ToLower()];
+ if (attr != null)
+ return (HtmlTextWriterAttribute) attr;
+ }
+ return (HtmlTextWriterAttribute) (-1);
+}
+
+protected string GetAttributeName(HtmlTextWriterAttribute attrKey){
+ if ((int) attrKey >= 0 && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ return HtmlTextWriter._attrNameLookupArray[(int) attrKey].name;
+ return System.String.Empty;
+}
+
+protected HtmlTextWriterStyle GetStyleKey(string styleName){
+ if (styleName != null && styleName.Length > 0) {
+ object style = HtmlTextWriter._styleKeyLookupTable[styleName.ToLower()];
+ if (style != null)
+ return (HtmlTextWriterStyle) style;
+ }
+ return (HtmlTextWriterStyle) (-1);
+}
+
+protected string GetStyleName(HtmlTextWriterStyle styleKey){
+ if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)
+ return HtmlTextWriter._styleNameLookupArray[(int) styleKey];
+ return System.String.Empty;
+}
+
+protected virtual HtmlTextWriterTag GetTagKey(string tagName){
+ if (tagName != null && tagName.Length > 0) {
+ object tag = HtmlTextWriter._tagKeyLookupTable[tagName.ToLower()];
+ if (tag != null)
+ return (HtmlTextWriterTag) tag;
+ }
+ return 0;
+}
+
+protected virtual string GetTagName(HtmlTextWriterTag tagKey){
+ if ((int) tagKey >= 0 && (int) tagKey < HtmlTextWriter._tagNameLookupArray.Length)
+ return HtmlTextWriter._tagNameLookupArray[(int) tagKey].name;
+ return System.String.Empty;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key){
+ for (int i=0; i < _attrCount; i++) {
+ if (_attrList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key, ref string value){
+ value = null;
+ for (int i=0; i < _attrCount; i++) {
+ if (_attrList[i].key == key) {
+ value = _attrList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key){
+ for (int i= 0; i < _styleCount; i++) {
+ if (_styleList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, ref string value){
+ value = null;
+ for( int i=0; i < _styleCount; i++) {
+ if (_styleList[i].key == key) {
+ value = _styleList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected virtual bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key){
+ return true;
+}
+
+protected virtual bool OnStyleAttributeRender(string name, string value, HtmlTextWriterStyle key){
+ return true;
+}
+
+protected virtual bool OnTagRender(string name, HtmlTextWriterTag key){
+ return true;
+}
+
+protected virtual void OutputTabs(){
+ if (tabsPending) {
+ for(int i=0; i <= indentLevel; i++) {
+ writer.Write(tabString);
+ }
+ tabsPending = false;
+ }
+}
+
+protected string PopEndTag(){
+ if (_endTagCount <= 0)
+ throw new InvalidOperationException("A PopEndTag was called without a corresponding PushEndTag");
+ _endTagCount--;
+ TagKey = _endTags[_endTagCount].tagKey;
+ return _endTags[_endTagCount].endTagText;
+}
+
+protected void PushEndTag(string endTag){
+ if (_endTagCount >= (int) _endTags.Length) {
+ TagStackEntry[] temp = new TagStackEntry[(int) _endTags.Length * 2];
+ System.Array.Copy(_endTags, temp, (int) _endTags.Length);
+ _endTags = temp;
+ }
+ _endTags[_endTagCount].tagKey = _tagKey;
+ _endTags[_endTagCount].endTagText = endTag;
+ _endTagCount++;
+}
+
+protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key){
+ HtmlTextWriter.RegisterAttribute(name, key, false);
+}
+
+private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool fEncode){
+ name = name.ToLower();
+ HtmlTextWriter._attrKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._attrNameLookupArray.Length)
+ HtmlTextWriter._attrNameLookupArray[(int) key] = new AttributeInformation(name, fEncode);
+}
+
+protected static void RegisterStyle(string name, HtmlTextWriterStyle key){
+ name = name.ToLower();
+ HtmlTextWriter._styleKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._styleNameLookupArray.Length)
+ HtmlTextWriter._styleNameLookupArray[(int) key] = name;
+}
+
+protected static void RegisterTag(string name, HtmlTextWriterTag key){
+ HtmlTextWriter.RegisterTag(name, key, TagType.Other);
+}
+
+private static void RegisterTag(string name, HtmlTextWriterTag key, TagType type){
+ name = name.ToLower();
+ HtmlTextWriter._tagKeyLookupTable.Add(name, key);
+ string fullTag = null;
+ if ((int) type != 1 && (int) key != 0) {
+ fullTag = EndTagLeftChars + name + TagRightChar;
+ }
+ if ((int) key < HtmlTextWriter._tagNameLookupArray.Length)
+ HtmlTextWriter._tagNameLookupArray[(int) key] = new TagInformation(name, type, fullTag);
+}
+
+protected virtual string RenderAfterContent(){
+ return null;
+}
+
+protected virtual string RenderAfterTag(){
+ return null;
+}
+
+protected virtual string RenderBeforeContent(){
+ return null;
+}
+
+protected virtual string RenderBeforeTag(){
+ return null;
+}
+
+public virtual void RenderBeginTag(HtmlTextWriterTag tagKey){
+ TagKey = tagKey;
+ bool tagRendered = true;
+ bool tagRender = true;
+ if (_isDescendant) {
+ tagRender = OnTagRender(_tagName, _tagKey);
+ FilterAttributes();
+ string beforeTag = RenderBeforeTag();
+ if (beforeTag != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeTag);
+ }
+ }
+ TagInformation currentTag = HtmlTextWriter._tagNameLookupArray[_tagIndex];
+ if (tagRender) {
+ tagRendered = false;
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(_tagName);
+ RenderAttribute rAttr;
+ string rAttrValue = null;
+ for (int i=0; i < _attrCount; i++) {
+ rAttr = _attrList[i];
+ if (rAttr.key == HtmlTextWriterAttribute.Style)
+ rAttrValue = rAttr.value;
+ else {
+ writer.Write(SpaceChar);
+ writer.Write(rAttr.name);
+ if (rAttr.value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (rAttr.encode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, writer);
+ }
+ else {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(rAttr.value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+ }
+ }
+ if (_styleCount > 0 || rAttrValue != null) {
+ writer.Write(SpaceChar);
+ writer.Write("style");
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ RenderStyle rStyle;
+ for (int i=0; i < _styleCount; i++) {
+ rStyle = _styleList[i];
+ writer.Write(rStyle.name);
+ writer.Write(StyleEqualsChar);
+ writer.Write(rStyle.value);
+ writer.Write(SemicolonChar);
+ }
+ if (rAttrValue != null)
+ writer.Write(rAttrValue);
+ writer.Write(DoubleQuoteChar);
+ }
+ if (currentTag.tagType == TagType.NonClosing) {
+ writer.Write(SpaceChar);
+ writer.Write(SlashChar);
+ writer.Write(TagRightChar);
+ }
+ else
+ writer.Write(TagRightChar);
+ }
+ string beforeContent = RenderBeforeContent();
+ if (beforeContent != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeContent);
+ }
+ if (tagRendered) {
+ if (currentTag.tagType == TagType.Inline)
+ _inlineCount++;
+ else {
+ WriteLine();
+ Indent++;
+ }
+ if (currentTag.closingTag == null) {
+ currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
+ }
+ }
+ if (_isDescendant) {
+ string afterContent = RenderAfterContent();
+ if (afterContent != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterContent;
+ }
+ string afterTag = RenderAfterTag();
+ if (afterTag != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterTag;
+ }
+ }
+ PushEndTag(currentTag.closingTag);
+ _attrCount = 0;
+ _styleCount = 0;
+}
+
+public virtual void RenderBeginTag(string tagName){
+ TagName = tagName;
+ RenderBeginTag(_tagKey);
+}
+
+public virtual void RenderEndTag(){
+ string endTagText = PopEndTag();
+ if (endTagText != null) {
+ if (HtmlTextWriter._tagNameLookupArray[_tagIndex].tagType == 0) {
+ _inlineCount--;
+ Write(endTagText);
+ }
+ else{
+ WriteLine();
+ Indent--;
+ Write(endTagText);
+ }
+ }
+}
+
+public override void Write(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer);
+}
+
+public override void Write(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer, index, count);
+}
+
+public override void Write(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(s);
+}
+
+public override void Write(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0);
+}
+
+public override void Write(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0, arg1);
+}
+
+public override void Write(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg);
+}
+
+public virtual void WriteAttribute(string name, string value){
+ WriteAttribute(name, value, false);
+}
+
+public virtual void WriteAttribute(string name, string value, bool fEncode){
+ writer.Write(SpaceChar);
+ writer.Write(name);
+ if (value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else{
+ writer.Write(value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+}
+
+public virtual void WriteBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+}
+
+public virtual void WriteEndTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(SlashChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public virtual void WriteFullBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public override void WriteLine(){
+ writer.WriteLine();
+ tabsPending = true;
+}
+
+public override void WriteLine(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer, index, count);
+ tabsPending = true;
+}
+
+public override void WriteLine(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(s);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0, arg1);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg);
+ tabsPending = true;
+}
+
+[CLSCompliant(false)]
+public override void WriteLine(uint value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public void WriteLineNoTabs(string s){
+ writer.WriteLine(s);
+}
+
+public virtual void WriteStyleAttribute(string name, string value){
+ WriteStyleAttribute(name, value, false);
+}
+
+public virtual void WriteStyleAttribute(string name, string value, bool fEncode){
+ writer.Write(name);
+ writer.Write(StyleEqualsChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(value);
+ }
+ writer.Write(SemicolonChar);
+}
+
+public override System.Text.Encoding Encoding {
+ get{
+ return writer.Encoding;
+ }
+}
+
+public int Indent {
+ get{
+ return indentLevel;
+ }
+ set{
+ if (value < 0)
+ value = 0;
+ indentLevel = value;
+ }
+}
+
+public TextWriter InnerWriter {
+ get{
+ return writer;
+ }
+ set{
+ writer = value;
+ _httpWriter = value as HttpWriter;
+ }
+}
+
+public override string NewLine {
+ get{
+ return writer.NewLine;
+ }
+ set{
+ writer.NewLine = value;
+ }
+}
+
+protected HtmlTextWriterTag TagKey {
+ get{
+ return _tagKey;
+ }
+ set{
+ _tagIndex = (int) value;
+ if (_tagIndex < 0 || _tagIndex >= (int) HtmlTextWriter._tagNameLookupArray.Length)
+ throw new ArgumentOutOfRangeException("value");
+ _tagKey = value;
+ if (value != 0)
+ _tagName = HtmlTextWriter._tagNameLookupArray[_tagIndex].name;
+ }
+}
+
+protected string TagName {
+ get{
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ _tagKey = GetTagKey(_tagName);
+ _tagIndex = (int) _tagKey;
+ }
+}
+
+public const string DefaultTabString = "\t";
+public const char DoubleQuoteChar = '"';
+public const string EndTagLeftChars = "</";
+public const char EqualsChar = '=';
+public const string EqualsDoubleQuoteString = "=\"";
+public const string SelfClosingChars = " /";
+public const string SelfClosingTagEnd = " />";
+public const char SemicolonChar = ';';
+public const char SingleQuoteChar = '\'';
+public const char SlashChar = '/';
+public const char SpaceChar = ' ';
+public const char StyleEqualsChar = ':';
+public const char TagLeftChar = '<';
+public const char TagRightChar = '>';
+
+private int _attrCount;
+private int _endTagCount;
+private int _styleCount;
+private int indentLevel;
+private int _inlineCount;
+private int _tagIndex;
+
+private bool _isDescendant;
+private bool tabsPending;
+
+private HtmlTextWriterTag _tagKey;
+private TextWriter writer;
+private HttpWriter _httpWriter;
+
+private static Hashtable _attrKeyLookupTable;
+private static Hashtable _styleKeyLookupTable;
+private static Hashtable _tagKeyLookupTable;
+
+private string _tagName;
+private string tabString;
+private static string[] _styleNameLookupArray;
+
+private RenderAttribute[] _attrList;
+private static AttributeInformation[] _attrNameLookupArray;
+private static TagInformation[] _tagNameLookupArray;
+private TagStackEntry[] _endTags;
+private RenderStyle[] _styleList;
+
+} //HtmlTextWriter
+
+struct AttributeInformation {
+ public bool encode;
+ public string name;
+
+ public AttributeInformation(string name, bool encode){
+ this.encode = encode;
+ this.name = name;
+ }
+}
+
+struct RenderAttribute {
+ public bool encode;
+ public HtmlTextWriterAttribute key;
+ public string name;
+ public string value;
+}
+
+struct RenderStyle {
+ public HtmlTextWriterStyle key;
+ public string name;
+ public string value;
+}
+
+struct TagInformation {
+ public string closingTag;
+ public string name;
+ public TagType tagType;
+
+ public TagInformation(string name, TagType tagType, string closingTag){
+ this.name = name;
+ this.tagType = tagType;
+ this.closingTag = closingTag;
+ }
+}
+
+struct TagStackEntry {
+ public string endTagText;
+ public HtmlTextWriterTag tagKey;
+}
+
+enum TagType {
+ Inline,
+ NonClosing,
+ Other
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
new file mode 100644
index 00000000000..5b82723c5c3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
@@ -0,0 +1,54 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterAttribute {
+Accesskey,
+Align,
+Alt,
+Background,
+Bgcolor,
+Border,
+Bordercolor,
+Cellpadding,
+Cellspacing,
+Checked,
+Class,
+Cols,
+Colspan,
+Disabled,
+For,
+Height,
+Href,
+Id,
+Maxlength,
+Multiple,
+Name,
+Nowrap,
+Onchange,
+Onclick,
+ReadOnly,
+Rows,
+Rowspan,
+Rules,
+Selected,
+Size,
+Src,
+Style,
+Tabindex,
+Target,
+Title,
+Type,
+Valign,
+Value,
+Width,
+Wrap,
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
new file mode 100644
index 00000000000..4955422d668
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
@@ -0,0 +1,28 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterStyle {
+BackgroundColor,
+BackgroundImage,
+BorderCollapse,
+BorderColor,
+BorderStyle,
+BorderWidth,
+Color,
+FontFamily,
+FontSize,
+FontStyle,
+FontWeight,
+Height,
+TextDecoration,
+Width
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
new file mode 100644
index 00000000000..f248979246a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
@@ -0,0 +1,111 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterTag {
+Unknown,
+A,
+Acronym,
+Address,
+Area,
+B,
+Base,
+Basefont,
+Bdo,
+Bgsound,
+Big,
+Blockquote,
+Body,
+Br,
+Button,
+Caption,
+Center,
+Cite,
+Code,
+Col,
+Colgroup,
+Dd,
+Del,
+Dfn,
+Dir,
+Div,
+Dl,
+Dt,
+Em,
+Embed,
+Fieldset,
+Font,
+Form,
+Frame,
+Frameset,
+H1,
+H2,
+H3,
+H4,
+H5,
+H6,
+Head,
+Hr,
+Html,
+I,
+Iframe,
+Img,
+Input,
+Ins,
+Isindex,
+Kbd,
+Label,
+Legend,
+Li,
+Link,
+Map,
+Marquee,
+Menu,
+Meta,
+Nobr,
+Noframes,
+Noscript,
+Object,
+Ol,
+Option,
+P,
+Param,
+Pre,
+Q,
+Rt,
+Ruby,
+S,
+Samp,
+Script,
+Select,
+Small,
+Span,
+Strike,
+Strong,
+Style,
+Sub,
+Sup,
+Table,
+Tbody,
+Td,
+Textarea,
+Tfoot,
+Th,
+Thead,
+Title,
+Tr,
+Tt,
+U,
+Ul,
+Var,
+Wbr,
+Xml
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs b/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs
new file mode 100644
index 00000000000..be0984b2c8b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.UI.IAttributeAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IAttributeAccessor
+ {
+ string GetAttribute(string key);
+ void SetAttribute(string key, string value);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs b/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs
new file mode 100644
index 00000000000..5ff7f00b2da
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.UI.IDataBindingsAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IDataBindingsAccessor
+ {
+ DataBindingCollection DataBindings {get;}
+ bool HasDataBindings {get;}
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/INamingContainer.cs b/mcs/class/System.Web/System.Web.UI/INamingContainer.cs
new file mode 100644
index 00000000000..659c5b60bed
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/INamingContainer.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.UI.INamingContainer.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface INamingContainer
+ {
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs b/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs
new file mode 100644
index 00000000000..cad22017e9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.UI.IParserAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IParserAccessor
+ {
+ void AddParsedSubObject(object obj);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs b/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs
new file mode 100644
index 00000000000..7d105cb7476
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.UI.IPostBackDataHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public interface IPostBackDataHandler
+ {
+ bool LoadPostData(string postDataKey, NameValueCollection postCollection);
+ void RaisePostDataChangedEvent();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs b/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs
new file mode 100644
index 00000000000..daa6f70160c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.UI.IPostBackEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IPostBackEventHandler
+ {
+ void RaisePostBackEvent(string eventArgument);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IStateManager.cs b/mcs/class/System.Web/System.Web.UI/IStateManager.cs
new file mode 100644
index 00000000000..4bcb6b8deb0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IStateManager.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.UI.IStateManager.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IStateManager
+ {
+ void LoadViewState(object state);
+ object SaveViewState();
+ void TrackViewState();
+ bool IsTrackingViewState { get; }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs b/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs
new file mode 100644
index 00000000000..da35c6b0ee8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.UI.ITagNameToTypeMapper.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface ITagNameToTypeMapper
+ {
+ Type GetControlType(string tagName, IDictionary attribs);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ITemplate.cs b/mcs/class/System.Web/System.Web.UI/ITemplate.cs
new file mode 100644
index 00000000000..c9981859b37
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITemplate.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.UI.ITemplate.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface ITemplate
+ {
+ void InstantiateIn(Control container);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IValidator.cs b/mcs/class/System.Web/System.Web.UI/IValidator.cs
new file mode 100644
index 00000000000..47b418aee39
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IValidator.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.UI.IValidator.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IValidator
+ {
+ void Validate();
+ string ErrorMessage {get; set;}
+ bool IsValid {get; set;}
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs b/mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs
new file mode 100755
index 00000000000..d2330bb6615
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ImageClickEventArgs.cs
@@ -0,0 +1,25 @@
+//
+// System.Web.UI.ImageClickEventArgs.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+ public sealed class ImageClickEventArgs : EventArgs
+ {
+ public ImageClickEventArgs (int x, int y)
+ {
+ X = x;
+ Y = y;
+ }
+
+ public int X;
+ public int Y;
+ }
+}
+
+
diff --git a/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs b/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs
new file mode 100644
index 00000000000..2bcc75881df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.UI.ImageClickEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate void ImageClickEventHandler(object sender, ImageClickEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs
new file mode 100644
index 00000000000..7a3ef1d0a7a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.UI.LiteralControl.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public class LiteralControl : Control
+ {
+ private string _text = String.Empty;
+ public LiteralControl() {}
+ public LiteralControl(string text)
+ {
+ _text = text;
+ }
+ public virtual string Text
+ {
+ get
+ {
+ return _text;
+ }
+ set
+ {
+ _text = value;
+ }
+ }
+ protected override void Render(HtmlTextWriter writer)
+ {
+ writer.Write(_text);
+ }
+
+ protected override ControlCollection CreateControlCollection ()
+ {
+ return new EmptyControlCollection (this);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/LosFormatter.cs b/mcs/class/System.Web/System.Web.UI/LosFormatter.cs
new file mode 100644
index 00000000000..fc06c921206
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/LosFormatter.cs
@@ -0,0 +1,487 @@
+//
+// System.Web.UI.LosFormatter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+using System.Web.UI;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public sealed class LosFormatter
+ {
+ delegate void WriteObject (LosFormatter formatter, TextWriter writer, object value);
+ static char [] specialChars = new char [] {'<', '>', ';'};
+
+ const char booleanID = 'o';
+ const char stringID = 's';
+ const char charID = 'c';
+ const char int16ID = 'i';
+ const char int32ID = 'I';
+ const char int64ID = 'l';
+ const char colorID = 'C';
+ const char pairID = 'p';
+ const char tripletID = 't';
+ const char arrayListID = 'L';
+ const char hashtableID = 'h';
+ const char binaryID = 'b';
+ const char arrayID = 'a';
+ const char dateTimeID = 'd';
+
+ static Hashtable specialTypes;
+ static Hashtable idToType;
+
+ static LosFormatter ()
+ {
+ specialTypes = new Hashtable ();
+ specialTypes.Add (typeof (Boolean), new WriteObject (WriteBoolean));
+ specialTypes.Add (typeof (Pair), new WriteObject (WritePair));
+ specialTypes.Add (typeof (Triplet), new WriteObject (WriteTriplet));
+ specialTypes.Add (typeof (Color), new WriteObject (WriteColor));
+ specialTypes.Add (typeof (ArrayList), new WriteObject (WriteArrayList));
+ specialTypes.Add (typeof (Hashtable), new WriteObject (WriteHashtable));
+ specialTypes.Add (typeof (Array), new WriteObject (WriteArray));
+ specialTypes.Add (typeof (DateTime), new WriteObject (WriteDateTime));
+
+ idToType = new Hashtable ();
+ idToType.Add (typeof (string), stringID);
+ idToType.Add (typeof (char), charID);
+ idToType.Add (typeof (Int16), int16ID);
+ idToType.Add (typeof (Int32), int32ID);
+ idToType.Add (typeof (Int64), int64ID);
+ idToType.Add (typeof (Boolean), booleanID);
+ idToType.Add (typeof (Pair), pairID);
+ idToType.Add (typeof (Triplet), tripletID);
+ idToType.Add (typeof (Color), colorID);
+ idToType.Add (typeof (ArrayList), arrayListID);
+ idToType.Add (typeof (Hashtable), hashtableID);
+ idToType.Add (typeof (Array), arrayID);
+ }
+
+ public object Deserialize (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+
+ return Deserialize (new StreamReader (stream));
+ }
+
+ public object Deserialize (TextReader input)
+ {
+ if (input == null)
+ throw new ArgumentNullException ("input");
+
+ return Deserialize (input.ReadToEnd ());
+ }
+
+ public object Deserialize (string input)
+ {
+ if (input == null)
+ throw new ArgumentNullException ("input");
+
+ string real_input = WebEncoding.Encoding.GetString (Convert.FromBase64String (input));
+ return DeserializeObject (real_input);
+ }
+
+ private static string UnEscapeSpecialChars (string str)
+ {
+ if (str.IndexOf ('\\') == -1)
+ return str;
+
+ string result = str.Replace ("\\;", ";");
+ result = result.Replace ("\\>", ">");
+ result = result.Replace ("\\<", "<");
+ result = result.Replace ("\\\\", "\\");
+ return result;
+ }
+
+ private static string GetEnclosedString (string input)
+ {
+ if (input [0] != '<')
+ throw new ArgumentException (input);
+
+ int count = 1;
+ bool escaped = false;
+ StringBuilder result = new StringBuilder ();
+ for (int i = 1; count != 0 && i < input.Length; i++) {
+ char c = input [i];
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ escaped = true;
+ else if (c == '<')
+ count++;
+ else if (c == '>')
+ count--;
+
+ result.Append (c);
+ }
+
+ result.Length--;
+ return result.ToString ();
+ }
+
+ private static string [] GetStringValues (string input)
+ {
+ if (input == null || input.Length == 0)
+ return new string [0];
+
+ int length = input.Length;
+ bool escaped = false;
+ int opened = 0;
+ ArrayList list = new ArrayList ();
+ StringBuilder builder = new StringBuilder ();
+ for (int i = 0; i < length; i++) {
+ char c = input [i];
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ escaped = true;
+ else if (c == '<')
+ opened++;
+ else if (c == '>')
+ opened--;
+ else if (c == ';' && opened == 0) {
+ list.Add (builder.ToString ());
+ builder = new StringBuilder ();
+ continue;
+ }
+
+ builder.Append (c);
+ }
+
+ list.Add (builder.ToString ());
+
+ string [] result = new string [list.Count];
+ list.CopyTo (result, 0);
+ return result;
+ }
+
+ private object DeserializeObject (string input)
+ {
+ if (input == null || input.Length < 2)
+ return null;
+
+ object obj;
+ string enclosed = GetEnclosedString (input.Substring (1));
+ string [] splitted;
+
+ switch (input [0]) {
+ case booleanID:
+ obj = enclosed.Length == 1;
+ break;
+ case stringID:
+ obj = UnEscapeSpecialChars (enclosed);
+ break;
+ case int16ID:
+ obj = Int16.Parse (enclosed);
+ break;
+ case int32ID:
+ obj = Int32.Parse (enclosed);
+ break;
+ case int64ID:
+ obj = Int64.Parse (enclosed);
+ break;
+ case colorID:
+ obj = Color.FromArgb (Int32.Parse (enclosed));
+ break;
+ case pairID:
+ Pair pair = new Pair ();
+ obj = pair;
+ splitted = GetStringValues (enclosed);
+ if (splitted.Length > 0) {
+ pair.First = DeserializeObject (splitted [0]);
+ if (splitted.Length > 1)
+ pair.Second = DeserializeObject (splitted [1]);
+ }
+ break;
+ case tripletID:
+ Triplet triplet = new Triplet ();
+ obj = triplet;
+ splitted = GetStringValues (enclosed);
+ if (splitted.Length == 0)
+ break;
+ triplet.First = DeserializeObject (splitted [0]);
+ if (splitted.Length < 1)
+ break;
+ triplet.Second = DeserializeObject (splitted [1]);
+ if (splitted.Length < 2)
+ break;
+ triplet.Third = DeserializeObject (splitted [2]);
+ break;
+ case arrayListID:
+ case arrayID:
+ ArrayList list = new ArrayList ();
+ obj = list;
+ splitted = GetStringValues (enclosed);
+ foreach (string s in splitted) {
+ object o = DeserializeObject (s);
+ list.Add (o);
+ }
+
+ if (input [0] == arrayID)
+ obj = list.ToArray (typeof (object));
+
+ break;
+ case hashtableID:
+ object key;
+ object value;
+ Hashtable hash = new Hashtable ();
+ obj = hash;
+ splitted = GetStringValues (enclosed);
+ int length = splitted.Length;
+ for (int i = 0; i < length; i++) {
+ key = DeserializeObject (splitted [i++]);
+ if (i < length)
+ value = DeserializeObject (splitted [i]);
+ else
+ value = null;
+
+ hash.Add (key, value);
+ }
+ break;
+ case binaryID:
+ byte [] buffer = WebEncoding.Encoding.GetBytes (enclosed);
+ MemoryStream ms = new MemoryStream (buffer);
+ BinaryFormatter fmt = new BinaryFormatter ();
+ obj = fmt.Deserialize (ms);
+ break;
+ case dateTimeID:
+ obj = new DateTime (Int64.Parse (enclosed));
+ break;
+ default:
+ throw new ArgumentException ("input");
+ }
+
+ return obj;
+ }
+
+ public void Serialize (Stream stream, object value)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ StreamWriter writer = new StreamWriter (stream);
+ Serialize (writer, value);
+ writer.Flush ();
+ }
+
+ public void Serialize (TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ if (output == null)
+ throw new ArgumentNullException ("output");
+
+ StringBuilder builder = new StringBuilder ();
+ StringWriter writer = new StringWriter (builder);
+ SerializeObject (writer, value);
+ byte [] bytes = WebEncoding.Encoding.GetBytes (builder.ToString ());
+ output.Write (Convert.ToBase64String (bytes));
+ }
+
+ private static void WriteBoolean (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (booleanID);
+ bool b = (bool) value;
+ output.Write (b ? "<t>" : "<>");
+ }
+
+ private static void WritePair (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (pairID);
+ Pair pair = (Pair) value;
+ output.Write ('<');
+ formatter.SerializeObject (output, pair.First);
+ output.Write (';');
+ formatter.SerializeObject (output, pair.Second);
+ output.Write ('>');
+ }
+
+ private static void WriteTriplet (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (tripletID);
+ Triplet triplet = (Triplet) value;
+ output.Write ('<');
+ formatter.SerializeObject (output, triplet.First);
+ output.Write (';');
+ formatter.SerializeObject (output, triplet.Second);
+ output.Write (';');
+ formatter.SerializeObject (output, triplet.Third);
+ output.Write ('>');
+ }
+
+ private static void WriteColor (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ Color c = (Color) value;
+ output.Write (String.Format ("{0}<{1}>", colorID, c.ToArgb ()));
+ }
+
+ private static void WriteArrayList (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (arrayListID);
+ output.Write ('<');
+ ArrayList list = (ArrayList) value;
+ for (int i = 0; i < list.Count; i++) {
+ formatter.SerializeObject (output, list [i]);
+ if (i != list.Count - 1)
+ output.Write (';');
+ }
+ output.Write('>');
+ }
+
+ private static void WriteArray (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (arrayID);
+ output.Write ('<');
+ Array array = (Array) value;
+ for (int i = 0; i < array.Length; i++) {
+ formatter.SerializeObject (output, array.GetValue (i));
+ if (i != array.Length - 1)
+ output.Write (';');
+ }
+ output.Write('>');
+ }
+
+ private static void WriteHashtable (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (hashtableID);
+ output.Write ('<');
+ Hashtable hash = (Hashtable) value;
+ int i = 0;
+ foreach (DictionaryEntry entry in hash) {
+ formatter.SerializeObject (output, entry.Key);
+ output.Write (';');
+ formatter.SerializeObject (output, entry.Value);
+ if (i != hash.Count - 1)
+ output.Write (';');
+ i++;
+ }
+ output.Write('>');
+ }
+
+ private static void WriteDateTime (LosFormatter formatter, TextWriter output, object value)
+ {
+ if (value == null)
+ return;
+
+ output.Write (dateTimeID);
+ output.Write ('<');
+ output.Write (((DateTime) value).Ticks);
+ output.Write('>');
+ }
+
+ private static string EscapeSpecialChars (string str)
+ {
+ if (str.IndexOfAny (specialChars) == -1)
+ return str;
+
+ string result = str.Replace ("\\", "\\\\");
+ result = result.Replace ("<", "\\<");
+ result = result.Replace (">", "\\>");
+ result = result.Replace (";", "\\;");
+ return result;
+ }
+
+ private void SerializeBinary (TextWriter output, object value)
+ {
+ WebTrace.PushContext ("LosFormatter.SerializeBinary");
+ Console.WriteLine ("not serializing value type: " + value.GetType ());
+ output.Write ("<>");
+ /* This is just for debugging purposes */
+ /*if (value is Array) {
+ Array array = (Array) value;
+ for (int i = 0; i < array.Length; i++) {
+ object o = array.GetValue (i);
+ if (o == null)
+ WebTrace.WriteLine ("\t{0} is null", i);
+ else
+ WebTrace.WriteLine ("\t{0} {1} {2}", i, o.GetType (), o);
+ }
+ }
+ */
+ /*
+ BinaryFormatter fmt = new BinaryFormatter ();
+ MemoryStream stream = new MemoryStream ();
+
+ fmt.Serialize (stream, value);
+ output.Write (binaryID);
+ output.Write ('<');
+ byte [] buffer = stream.GetBuffer ();
+ output.Write (Convert.ToBase64String (stream.GetBuffer ()));
+ output.Write ('>');
+ */
+ WebTrace.PopContext ();
+ }
+
+ private void SerializeObject (TextWriter output, object value)
+ {
+ WebTrace.PushContext ("LosFormatter.SerializeObject");
+ if (value == null) {
+ WebTrace.WriteLine ("value is null");
+ WebTrace.PopContext ();
+ return;
+ }
+
+ Type t = value.GetType ();
+ if (t.IsArray)
+ t = typeof (Array);
+
+ if (specialTypes.Contains (t)) {
+ WriteObject w = (WriteObject) specialTypes [t];
+ w (this, output, value);
+ WebTrace.WriteLine ("special type: {0}", value.GetType ());
+ WebTrace.PopContext ();
+ return;
+ }
+
+ if (idToType.Contains (t)) {
+ char c = (char) idToType [t];
+ string s = EscapeSpecialChars (value.ToString ());
+ output.Write (String.Format ("{0}<{1}>", c, value.ToString ()));
+ WebTrace.WriteLine ("regular type: {0}", value.GetType ());
+ WebTrace.PopContext ();
+ return;
+ }
+
+ SerializeBinary (output, value);
+ WebTrace.PopContext ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs b/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs
new file mode 100644
index 00000000000..173654504c0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs
@@ -0,0 +1,23 @@
+//
+// System.Web.UI.OutputCacheLocation.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public enum OutputCacheLocation
+ {
+ Any,
+ Client,
+ Downstream,
+ Server,
+ None
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs
new file mode 100755
index 00000000000..af39217060c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Page.cs
@@ -0,0 +1,706 @@
+//
+// System.Web.UI.Page
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Security.Principal;
+using System.Text;
+using System.Web;
+using System.Web.Caching;
+using System.Web.SessionState;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+
+public class Page : TemplateControl, IHttpHandler
+{
+ private string _culture;
+ private bool _viewState = true;
+ private bool _viewStateMac = false;
+ private string _errorPage;
+ private string _ID;
+ private bool _isValid;
+ private bool _smartNavigation = false;
+ private TraceContext _trace;
+ private bool _traceEnabled;
+ private TraceMode _traceModeValue;
+ private int _transactionMode;
+ private string _UICulture;
+ private HttpContext _context;
+ private ValidatorCollection _validators;
+ private bool renderingForm;
+ private object _savedViewState;
+ private ArrayList _requiresPostBack;
+ private ArrayList requiresPostDataChanged;
+ private IPostBackEventHandler requiresRaiseEvent;
+ private NameValueCollection secondPostData;
+ private bool requiresPostBackScript = false;
+ private bool postBackScriptRendered = false;
+ Hashtable clientScriptBlocks;
+ Hashtable startupScriptBlocks;
+ Hashtable hiddenFields;
+ bool handleViewState;
+
+ protected const string postEventArgumentID = "__EVENTARGUMENT";
+ protected const string postEventSourceID = "__EVENTTARGET";
+
+ #region Constructor
+ public Page ()
+ {
+ Page = this;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public HttpApplicationState Application
+ {
+ get { return _context.Application; }
+ }
+
+ bool AspCompatMode
+ {
+ set { throw new NotImplementedException (); }
+ }
+
+ bool Buffer
+ {
+ set { Response.BufferOutput = value; }
+ }
+
+ public Cache Cache
+ {
+ get { return _context.Cache; }
+ }
+
+ [MonoTODO]
+ public string ClientTarget
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ int CodePage
+ {
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ string ContentType
+ {
+ set { throw new NotImplementedException (); }
+ }
+
+ protected override HttpContext Context
+ {
+ get { return _context; }
+ }
+
+ string Culture
+ {
+ set { _culture = value; }
+ }
+
+ public override bool EnableViewState
+ {
+ get { return _viewState; }
+ set { _viewState = value; }
+ }
+
+ protected bool EnableViewStateMac
+ {
+ get { return _viewStateMac; }
+ set { _viewStateMac = value; }
+ }
+
+ public string ErrorPage
+ {
+ get { return _errorPage; }
+ set { _errorPage = value; }
+ }
+
+ protected ArrayList FileDependencies
+ {
+ set {
+ if (Response != null)
+ Response.AddFileDependencies (value);
+ }
+ }
+
+ public override string ID
+ {
+ get { return _ID; }
+ set { _ID = value; }
+ }
+
+ public bool IsPostBack
+ {
+ get {
+ return (0 == String.Compare (Request.HttpMethod, "POST", true));
+ }
+ }
+
+ public bool IsReusable {
+ get { return false; }
+ }
+
+ public bool IsValid
+ {
+ get { return _isValid; }
+ }
+
+ [MonoTODO]
+ int LCID {
+ set { throw new NotImplementedException (); }
+ }
+
+ public HttpRequest Request
+ {
+ get { return _context.Request; }
+ }
+
+ public HttpResponse Response
+ {
+ get { return _context.Response; }
+ }
+
+ string ResponseEncoding
+ {
+ set { Response.ContentEncoding = Encoding.GetEncoding (value); }
+ }
+
+ public HttpServerUtility Server
+ {
+ get {
+ return Context.Server;
+ }
+ }
+
+ public virtual HttpSessionState Session
+ {
+ get { return _context.Session; }
+ }
+
+ public bool SmartNavigation
+ {
+ get { return _smartNavigation; }
+ set { _smartNavigation = value; }
+ }
+
+ public TraceContext Trace
+ {
+ get { return _trace; }
+ }
+
+ bool TraceEnabled
+ {
+ set { _traceEnabled = value; }
+ }
+
+ TraceMode TraceModeValue
+ {
+ set { _traceModeValue = value; }
+ }
+
+ int TransactionMode
+ {
+ set { _transactionMode = value; }
+ }
+
+ string UICulture
+ {
+ set { _UICulture = value; }
+ }
+
+ public IPrincipal User
+ {
+ get { return _context.User; }
+ }
+
+ public ValidatorCollection Validators
+ {
+ get {
+ if (_validators == null)
+ _validators = new ValidatorCollection ();
+ return _validators;
+ }
+ }
+
+ public override bool Visible
+ {
+ get { return base.Visible; }
+ set { base.Visible = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ protected IAsyncResult AspCompatBeginProcessRequest (HttpContext context,
+ AsyncCallback cb,
+ object extraData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void AspcompatEndProcessRequest (IAsyncResult result)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual HtmlTextWriter CreateHtmlTextWriter (TextWriter tw)
+ {
+ return new HtmlTextWriter (tw);
+ }
+
+ [MonoTODO]
+ public void DesignerInitialize ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual NameValueCollection DeterminePostBackMode ()
+ {
+ if (_context == null)
+ return null;
+
+ HttpRequest req = _context.Request;
+ if (req == null)
+ return null;
+
+ NameValueCollection coll = null;
+ if (IsPostBack)
+ coll = req.Form;
+ else
+ coll = req.QueryString;
+
+
+ if (coll == null || coll ["__VIEWSTATE"] == null)
+ return null;
+
+ return coll;
+ }
+
+ public string GetPostBackClientEvent (Control control, string argument)
+ {
+ return GetPostBackEventReference (control, argument);
+ }
+
+ public string GetPostBackClientHyperlink (Control control, string argument)
+ {
+ return "javascript:" + GetPostBackEventReference (control, argument);
+ }
+
+ public string GetPostBackEventReference (Control control)
+ {
+ return GetPostBackEventReference (control, "");
+ }
+
+ public string GetPostBackEventReference (Control control, string argument)
+ {
+ RequiresPostBackScript ();
+ return String.Format ("__doPostBack ('{0}', '{1}')", control.UniqueID, argument);
+ }
+
+ internal void RequiresPostBackScript ()
+ {
+ requiresPostBackScript = true;
+ }
+
+ public virtual int GetTypeHashCode ()
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ protected virtual void InitOutputCache (int duration,
+ string varyByHeader,
+ string varyByCustom,
+ OutputCacheLocation location,
+ string varyByParam)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool IsClientScriptBlockRegistered (string key)
+ {
+ if (clientScriptBlocks == null)
+ return false;
+
+ return clientScriptBlocks.ContainsKey (key);
+ }
+
+ public bool IsStartupScriptRegistered (string key)
+ {
+ if (startupScriptBlocks == null)
+ return false;
+
+ return startupScriptBlocks.ContainsKey (key);
+ }
+
+ public string MapPath (string virtualPath)
+ {
+ return Request.MapPath (virtualPath);
+ }
+
+ private void RenderPostBackScript (HtmlTextWriter writer, string formUniqueID)
+ {
+ writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventSourceID);
+ writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventArgumentID);
+ writer.WriteLine ();
+ writer.WriteLine ("<script language=\"javascript\">");
+ writer.WriteLine ("<!--");
+ writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {");
+ writer.WriteLine ("\t\tvar theform = document.{0};", formUniqueID);
+ writer.WriteLine ("\t\ttheform.{0}.value = eventTarget;", postEventSourceID);
+ writer.WriteLine ("\t\ttheform.{0}.value = eventArgument;", postEventArgumentID);
+ writer.WriteLine ("\t\ttheform.submit();");
+ writer.WriteLine ("\t}");
+ writer.WriteLine ("// -->");
+ writer.WriteLine ("</script>");
+ }
+
+ static void WriteScripts (HtmlTextWriter writer, Hashtable scripts)
+ {
+ if (scripts == null)
+ return;
+
+ foreach (string key in scripts.Values)
+ writer.WriteLine (key);
+ }
+
+ void WriteHiddenFields (HtmlTextWriter writer)
+ {
+ if (hiddenFields == null)
+ return;
+
+ foreach (string key in hiddenFields.Keys) {
+ string value = hiddenFields [key] as string;
+ writer.WriteLine ("\n<input type=\"hidden\" name=\"{0}\" value=\"{1}\" />", key, value);
+ }
+
+ hiddenFields = null;
+ }
+
+ internal void OnFormRender (HtmlTextWriter writer, string formUniqueID)
+ {
+ if (renderingForm)
+ throw new HttpException ("Only 1 HtmlForm is allowed per page.");
+
+ renderingForm = true;
+ writer.WriteLine ();
+ WriteHiddenFields (writer);
+ if (requiresPostBackScript) {
+ RenderPostBackScript (writer, formUniqueID);
+ postBackScriptRendered = true;
+ }
+
+ if (handleViewState) {
+ writer.Write ("<input type=\"hidden\" name=\"__VIEWSTATE\" ");
+ writer.WriteLine ("value=\"{0}\" />", GetViewStateString ());
+ }
+
+ WriteScripts (writer, clientScriptBlocks);
+ }
+
+ internal string GetViewStateString ()
+ {
+ StringWriter sr = new StringWriter ();
+ LosFormatter fmt = new LosFormatter ();
+ fmt.Serialize (sr, _savedViewState);
+ return sr.GetStringBuilder ().ToString ();
+ }
+
+ internal void OnFormPostRender (HtmlTextWriter writer, string formUniqueID)
+ {
+ if (!postBackScriptRendered && requiresPostBackScript)
+ RenderPostBackScript (writer, formUniqueID);
+
+ WriteHiddenFields (writer);
+ WriteScripts (writer, startupScriptBlocks);
+ renderingForm = false;
+ postBackScriptRendered = false;
+ }
+
+ private void ProcessPostData (NameValueCollection data, bool second)
+ {
+ if (data == null)
+ return;
+
+ Hashtable used = new Hashtable ();
+ foreach (string id in data.AllKeys){
+ if (id == "__VIEWSTATE" || id == postEventSourceID || id == postEventArgumentID)
+ continue;
+
+ string real_id = id;
+ int dot = real_id.IndexOf ('.');
+ if (dot >= 1)
+ real_id = real_id.Substring (0, dot);
+
+ if (real_id == null || used.ContainsKey (real_id))
+ continue;
+
+ used.Add (real_id, real_id);
+
+ Control ctrl = FindControl (real_id);
+ if (ctrl != null){
+ IPostBackDataHandler pbdh = ctrl as IPostBackDataHandler;
+ IPostBackEventHandler pbeh = ctrl as IPostBackEventHandler;
+
+ if (pbdh == null) {
+ if (pbeh != null)
+ RegisterRequiresRaiseEvent (pbeh);
+ continue;
+ }
+
+ if (pbdh.LoadPostData (real_id, data) == true) {
+ if (requiresPostDataChanged == null)
+ requiresPostDataChanged = new ArrayList ();
+ requiresPostDataChanged.Add (pbdh);
+ }
+ } else if (!second) {
+ if (secondPostData == null)
+ secondPostData = new NameValueCollection ();
+ secondPostData.Add (real_id, null);
+ }
+ }
+ }
+
+ public void ProcessRequest (HttpContext context)
+ {
+ _context = context;
+ WebTrace.PushContext ("Page.ProcessRequest ()");
+ WebTrace.WriteLine ("Entering");
+ WireupAutomaticEvents ();
+ WebTrace.WriteLine ("Finished hookup");
+ //-- Control execution lifecycle in the docs
+ WebTrace.WriteLine ("FrameworkInitialize");
+ FrameworkInitialize ();
+ WebTrace.WriteLine ("InitRecursive");
+ InitRecursive (null);
+ renderingForm = false;
+ if (IsPostBack) {
+ LoadPageViewState ();
+ ProcessPostData (DeterminePostBackMode (), false);
+ }
+
+ WebTrace.WriteLine ("LoadRecursive");
+ LoadRecursive ();
+ if (IsPostBack) {
+ ProcessPostData (secondPostData, true);
+ RaiseChangedEvents ();
+ RaisePostBackEvents ();
+ }
+ WebTrace.WriteLine ("PreRenderRecursiveInternal");
+ PreRenderRecursiveInternal ();
+
+ WebTrace.WriteLine ("SavePageViewState");
+ SavePageViewState ();
+ //--
+ HtmlTextWriter output = new HtmlTextWriter (context.Response.Output);
+ WebTrace.WriteLine ("RenderControl");
+ RenderControl (output);
+ _context = null;
+ WebTrace.WriteLine ("UnloadRecursive");
+ UnloadRecursive (true);
+ WebTrace.WriteLine ("End");
+ WebTrace.PopContext ();
+ }
+
+ internal void RaisePostBackEvents ()
+ {
+ if (requiresRaiseEvent != null) {
+ RaisePostBackEvent (requiresRaiseEvent, null);
+ return;
+ }
+
+ NameValueCollection postdata = DeterminePostBackMode ();
+ if (postdata == null)
+ return;
+
+ string eventTarget = postdata [postEventSourceID];
+ if (eventTarget == null || eventTarget.Length == 0)
+ return;
+
+ IPostBackEventHandler target = FindControl (eventTarget) as IPostBackEventHandler;
+ if (target == null)
+ return;
+
+ string eventArgument = postdata [postEventArgumentID];
+ RaisePostBackEvent (target, eventArgument);
+ }
+
+ internal void RaiseChangedEvents ()
+ {
+ if (requiresPostDataChanged == null)
+ return;
+
+ foreach (IPostBackDataHandler ipdh in requiresPostDataChanged)
+ ipdh.RaisePostDataChangedEvent ();
+
+ requiresPostDataChanged.Clear ();
+ }
+
+ protected virtual void RaisePostBackEvent (IPostBackEventHandler sourceControl, string eventArgument)
+ {
+ sourceControl.RaisePostBackEvent (eventArgument);
+ }
+
+ [MonoTODO]
+ public void RegisterArrayDeclaration (string arrayName, string arrayValue)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void RegisterClientScriptBlock (string key, string script)
+ {
+ if (IsClientScriptBlockRegistered (key))
+ return;
+
+ if (clientScriptBlocks == null)
+ clientScriptBlocks = new Hashtable ();
+
+ clientScriptBlocks.Add (key, script);
+ }
+
+ public virtual void RegisterHiddenField (string hiddenFieldName, string hiddenFieldInitialValue)
+ {
+ if (hiddenFields == null)
+ hiddenFields = new Hashtable ();
+
+ if (!hiddenFields.ContainsKey (hiddenFieldName))
+ hiddenFields.Add (hiddenFieldName, hiddenFieldInitialValue);
+ }
+
+ [MonoTODO]
+ public void RegisterClientScriptFile (string a, string b, string c)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RegisterOnSubmitStatement (string key, string script)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void RegisterRequiresPostBack (Control control)
+ {
+ if (_requiresPostBack == null)
+ _requiresPostBack = new ArrayList ();
+
+ _requiresPostBack.Add (control.ID);
+ }
+
+ public virtual void RegisterRequiresRaiseEvent (IPostBackEventHandler control)
+ {
+ requiresRaiseEvent = control;
+ }
+
+ public virtual void RegisterStartupScript (string key, string script)
+ {
+ if (IsStartupScriptRegistered (key))
+ return;
+
+ if (startupScriptBlocks == null)
+ startupScriptBlocks = new Hashtable ();
+
+ startupScriptBlocks.Add (key, script);
+ }
+
+ public void RegisterViewStateHandler ()
+ {
+ handleViewState = true;
+ }
+
+ protected virtual void SavePageStateToPersistenceMedium (object viewState)
+ {
+ _savedViewState = viewState;
+ }
+
+ protected virtual object LoadPageStateFromPersistenceMedium ()
+ {
+ NameValueCollection postdata = DeterminePostBackMode ();
+ string view_state;
+ if (postdata == null || (view_state = postdata ["__VIEWSTATE"]) == null)
+ return null;
+
+ _savedViewState = null;
+ LosFormatter fmt = new LosFormatter ();
+
+ try {
+ _savedViewState = fmt.Deserialize (view_state);
+ } catch (Exception e) {
+ throw new HttpException ("Error restoring page viewstate.\n{0}", e);
+ }
+
+ return _savedViewState;
+ }
+
+ internal void LoadPageViewState()
+ {
+ WebTrace.PushContext ("LoadPageViewState");
+ object sState = LoadPageStateFromPersistenceMedium ();
+ WebTrace.WriteLine ("sState = '{0}'", sState);
+ if (sState != null) {
+ Pair pair = (Pair) sState;
+ LoadViewStateRecursive (pair.First);
+ _requiresPostBack = pair.Second as ArrayList;
+ }
+ WebTrace.PopContext ();
+ }
+
+ internal void SavePageViewState ()
+ {
+ if (!handleViewState)
+ return;
+
+ Pair pair = new Pair ();
+ pair.First = SaveViewStateRecursive ();
+ if (_requiresPostBack != null && _requiresPostBack.Count > 0)
+ pair.Second = _requiresPostBack;
+ SavePageStateToPersistenceMedium (pair);
+ }
+
+ public virtual void Validate ()
+ {
+ if (_validators == null || _validators.Count == 0){
+ _isValid = true;
+ return;
+ }
+
+ bool all_valid = true;
+ foreach (IValidator v in _validators){
+ v.Validate ();
+ if (v.IsValid == false)
+ all_valid = false;
+ }
+
+ if (all_valid)
+ _isValid = true;
+ }
+
+ public virtual void VerifyRenderingInServerForm (Control control)
+ {
+ if (!renderingForm)
+ throw new HttpException ("Control '" + control.ClientID + " " + control.GetType () +
+ "' must be rendered within a HtmlForm");
+ }
+
+ #endregion
+}
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs b/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs
new file mode 100644
index 00000000000..db9238b254f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.cs
@@ -0,0 +1,27 @@
+//
+// System.Web.UI.PageHandlerFactory
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ class PageHandlerFactory : IHttpHandlerFactory
+ {
+ public virtual IHttpHandler GetHandler (HttpContext context, string requestType, string url, string path)
+ {
+ return PageParser.GetCompiledPageInstance (url, path, context);
+ }
+
+ public virtual void ReleaseHandler (IHttpHandler handler)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs
new file mode 100644
index 00000000000..a0c49e7c31c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs
@@ -0,0 +1,46 @@
+//
+// System.Web.UI.PageParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ public sealed class PageParser : TemplateControlParser
+ {
+ public static IHttpHandler GetCompiledPageInstance (string virtualPath,
+ string inputFile,
+ HttpContext context)
+ {
+ PageParser pp = new PageParser ();
+ IHttpHandler h = (IHttpHandler) pp.GetCompiledInstance (virtualPath, inputFile, context);
+ return h;
+ }
+
+ protected override Type CompileIntoType ()
+ {
+ return PageCompiler.CompilePageType (this);
+ }
+
+ protected override Type DefaultBaseType
+ {
+ get {
+ return typeof (Page);
+ }
+ }
+
+ protected override string DefaultDirectiveName
+ {
+ get {
+ return "page";
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/Pair.cs b/mcs/class/System.Web/System.Web.UI/Pair.cs
new file mode 100644
index 00000000000..bf13fabdce8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Pair.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: Pair
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public class Pair
+ {
+ public object First;
+ public object Second;
+
+ public Pair(object first, object second)
+ {
+ First = first;
+ Second = second;
+ }
+
+ public Pair()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs b/mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs
new file mode 100755
index 00000000000..95b621a8015
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ParseChildrenAttribute.cs
@@ -0,0 +1,80 @@
+//
+// System.Web.UI.ParseChildrenAttribute.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ParseChildrenAttribute : Attribute
+ {
+ bool childrenAsProperties;
+ string defaultProperty;
+ public static readonly ParseChildrenAttribute Default = new ParseChildrenAttribute ();
+
+ // LAMESPEC
+ public ParseChildrenAttribute ()
+ {
+ childrenAsProperties = false;
+ defaultProperty = "";
+ }
+
+ public ParseChildrenAttribute (bool childrenAsProperties)
+ {
+ this.childrenAsProperties = childrenAsProperties;
+ this.defaultProperty = "";
+ }
+
+ public ParseChildrenAttribute (bool childrenAsProperties,
+ string defaultProperty)
+ {
+ this.childrenAsProperties = childrenAsProperties;
+ if (childrenAsProperties)
+ this.defaultProperty = defaultProperty;
+ }
+
+ public bool ChildrenAsProperties {
+
+ get { return childrenAsProperties; }
+
+ set { childrenAsProperties = value; }
+ }
+
+ public string DefaultProperty {
+ get { return defaultProperty; }
+
+ set { defaultProperty = value; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ParseChildrenAttribute))
+ return false;
+
+ ParseChildrenAttribute o = (ParseChildrenAttribute) obj;
+ if (childrenAsProperties == o.childrenAsProperties){
+ if (childrenAsProperties == false)
+ return true;
+ return (defaultProperty == o.DefaultProperty);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs b/mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs
new file mode 100755
index 00000000000..be490317e8b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PartialCachingAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.Web.UI.PartialCachingAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class PartialCachingAttribute : Attribute
+ {
+ int duration;
+ string varyByControls;
+ string varyByCustom;
+ string varyByParams;
+
+ public PartialCachingAttribute (int duration)
+ {
+ this.duration = duration;
+ }
+
+ public PartialCachingAttribute (int duration, string varyByParams,
+ string varyByControls, string varyByCustom)
+ {
+ this.duration = duration;
+ this.varyByParams = varyByParams;
+ this.varyByControls = varyByControls;
+ this.varyByCustom = varyByCustom;
+ }
+
+ public int Duration {
+ get { return duration; }
+ }
+
+ public string VaryByParams {
+ get { return varyByParams; }
+ }
+
+ public string VaryByControls {
+ get { return varyByControls; }
+ }
+
+ public string VaryByCustom {
+ get { return varyByCustom; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs b/mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs
new file mode 100755
index 00000000000..a38d49c817f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistChildrenAttribute.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.PersistChildrenAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class PersistChildrenAttribute : Attribute
+ {
+ bool persist;
+
+ public PersistChildrenAttribute (bool persist)
+ {
+ this.persist = persist;
+ }
+
+ public static readonly PersistChildrenAttribute Default;
+ public static readonly PersistChildrenAttribute Yes;
+ public static readonly PersistChildrenAttribute No;
+
+ public bool Persist {
+ get { return persist; }
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return 42;
+ }
+
+ [MonoTODO]
+ public override bool IsDefaultAttribute ()
+ {
+ return false;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/PersistenceMode.cs b/mcs/class/System.Web/System.Web.UI/PersistenceMode.cs
new file mode 100755
index 00000000000..e58f2847489
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistenceMode.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.UI.PersistenceMode.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public enum PersistenceMode
+ {
+ Attribute = 0,
+ InnerProperty = 1,
+ InnerDefaultProperty = 2,
+ EncodedInnerDefaultProperty = 3,
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs b/mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs
new file mode 100755
index 00000000000..1f878f6ef2b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistenceModeAttribute.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.UI.PersistenceModeAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class PersistenceModeAttribute : Attribute
+ {
+ PersistenceMode mode;
+
+ public PersistenceModeAttribute (PersistenceMode mode)
+ {
+ this.mode = mode;
+ }
+
+ public static readonly PersistenceModeAttribute Attribute;
+ public static readonly PersistenceModeAttribute Default;
+ public static readonly PersistenceModeAttribute EncodedInnerDefaultProperty;
+ public static readonly PersistenceModeAttribute InnerDefaultProperty;
+ public static readonly PersistenceModeAttribute InnerProperty;
+
+ public PersistenceMode Mode {
+ get { return mode; }
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ return 42;
+ }
+
+ [MonoTODO]
+ public override bool IsDefaultAttribute ()
+ {
+ return false;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs b/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
new file mode 100644
index 00000000000..d98e80f912a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
@@ -0,0 +1,124 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: PropertyConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ public sealed class PropertyConverter
+ {
+ private static Type[] parseMethodTypes;
+ private static Type[] parseMethodTypesWithSOP;
+
+ static PropertyConverter()
+ {
+ parseMethodTypes = new Type[1];
+ parseMethodTypes[0] = typeof(string);
+ parseMethodTypesWithSOP = new Type[2];
+ parseMethodTypesWithSOP[0] = typeof(string);
+ parseMethodTypesWithSOP[1] = typeof(IServiceProvider);
+ }
+
+ private PropertyConverter()
+ {
+ // Prevent any instance
+ }
+
+ public static object EnumFromString(Type enumType, string enumValue)
+ {
+ object retVal = null;
+ try
+ {
+ retVal = Enum.Parse(enumType, enumValue, true);
+ } catch
+ {
+ retVal = null;
+ }
+ return retVal;
+ }
+
+ public static string EnumToString(Type enumType, object enumValue)
+ {
+ string retVal = Enum.Format(enumType, enumValue, "G");
+ return retVal.Replace('_','-');
+ }
+
+ public static object ObjectFromString(Type objType, MemberInfo propertyInfo, string objValue)
+ {
+ if(objValue == null)
+ return null;
+ if(! (!objType.Equals(typeof(Boolean)) || objValue.Length > 0) )
+ {
+ return null;
+ }
+ if(objType.IsEnum)
+ {
+ return EnumFromString(objType, objValue);
+ }
+ if(objType.Equals(typeof(string)))
+ {
+ return objValue;
+ }
+ PropertyDescriptor pc = null;
+ if(propertyInfo != null)
+ {
+ pc = (TypeDescriptor.GetProperties(propertyInfo.ReflectedType))[propertyInfo.Name];
+ }
+ if(pc != null)
+ {
+ TypeConverter converter = pc.Converter;
+ if(converter!=null && converter.CanConvertFrom(typeof(string)))
+ {
+ return converter.ConvertFromInvariantString(objValue);
+ }
+ }
+ MethodInfo mi = objType.GetMethod("Parse", parseMethodTypesWithSOP);
+ object o = null;
+ if(mi != null)
+ {
+ object[] parameters = new object[2];
+ parameters[0] = objValue;
+ parameters[1] = CultureInfo.InvariantCulture;
+ try
+ {
+ o = Utils.InvokeMethod(mi, null, parameters);
+ } catch
+ {
+ }
+ }
+ if(o == null)
+ {
+ mi = objType.GetMethod("Parse", parseMethodTypes);
+ if(mi!=null)
+ {
+ object[] parameters = new object[1];
+ parameters[0] = objValue;
+ try
+ {
+ o = Utils.InvokeMethod(mi, null, parameters);
+ } catch
+ {
+ }
+ }
+ }
+ if(o == null)
+ {
+ throw new HttpException(/*HttpRuntime.FormatResourceString(*/"Type_not_creatable_from_string"/*, objType.FullName, objValue, propertyInfo.Name)*/);
+ }
+ return o;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/RenderMethod.cs b/mcs/class/System.Web/System.Web.UI/RenderMethod.cs
new file mode 100755
index 00000000000..8f2db742cdb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/RenderMethod.cs
@@ -0,0 +1,13 @@
+//
+//
+// System.Web.UI.RenderMethod.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Web.UI {
+
+ public delegate void RenderMethod (HtmlTextWriter output, Control container);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs b/mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs
new file mode 100644
index 00000000000..5d0da1df6d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/SimpleHandlerFactory.cs
@@ -0,0 +1,31 @@
+//
+// System.Web.UI.SimpleHandlerFactory
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+
+namespace System.Web.UI
+{
+ class SimpleHandlerFactory : IHttpHandlerFactory
+ {
+ [MonoTODO]
+ public virtual IHttpHandler GetHandler (HttpContext context,
+ string requestType,
+ string virtualPath,
+ string path)
+ {
+ // This should handle *.ashx files
+ throw new NotImplementedException ();
+ }
+
+ public virtual void ReleaseHandler (System.Web.IHttpHandler handler)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
new file mode 100644
index 00000000000..bb3bc6732ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
@@ -0,0 +1,186 @@
+//
+// System.Web.UI.SimpleWebHandlerParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public abstract class SimpleWebHandlerParser
+ {
+ HttpContext context;
+ string vPath;
+ string physPath;
+ string className;
+ string codeBehind;
+ bool debug;
+ string language;
+ string program;
+
+ protected SimpleWebHandlerParser (HttpContext context, string virtualPath, string physicalPath)
+ {
+ this.context = context;
+ this.vPath = virtualPath;
+ this.physPath = physicalPath;
+ GetDirectiveAndContent ();
+ }
+
+ private void GetDirectiveAndContent ()
+ {
+ StreamReader reader = new StreamReader (File.OpenRead (physPath));
+ string line;
+ bool directiveFound = false;
+ StringBuilder content = new StringBuilder ();
+
+ while ((line = reader.ReadLine ()) != null) {
+ string trimmed = line.Trim ();
+ if (!directiveFound && trimmed != String.Empty)
+ continue;
+
+ if (!directiveFound) {
+ ParseDirective (trimmed);
+ directiveFound = true;
+ continue;
+ }
+
+ content.Append (line + "\n");
+ content.Append (reader.ReadToEnd ());
+ }
+
+ this.program = content.ToString ();
+ reader.Close ();
+ }
+
+ private void ParseDirective (string line)
+ {
+ MemoryStream st = new MemoryStream (WebEncoding.Encoding.GetBytes (line));
+ AspParser parser = new AspParser (physPath, st);
+ parser.Parse ();
+ ArrayList elems = parser.Elements;
+ if (elems.Count != 1)
+ throw new ApplicationException ("Error looking for WebService directive.");
+
+ Directive directive = elems [0] as Directive;
+ if (directive == null)
+ throw new ApplicationException ("Error looking for WebService directive.");
+
+ if (0 != String.Compare (directive.TagID, DefaultDirectiveName, false))
+ throw new ApplicationException ("Expecting @WebService. Got: " +
+ directive.TagID);
+
+ TagAttributes ta = directive.Attributes;
+ className = ta ["class"] as string;
+ if (className == null)
+ throw new ApplicationException ("No Class attribute found.");
+
+ string d = ta ["debug"] as string;
+ if (d != null)
+ debug = Convert.ToBoolean (d);
+
+ language = ta ["language"] as string;
+ if (language != null) {
+ if (0 != String.Compare (language, "C#", false))
+ throw new ApplicationException ("Only C# language is supported.");
+ }
+
+ codeBehind = ta ["codebehind"] as string;
+ if (codeBehind != null) {
+ string ext = Path.GetExtension (codeBehind);
+ if (0 != String.Compare (ext, "cs", false) &&
+ 0 != String.Compare (ext, "dll", false))
+ throw new ApplicationException ("Unknown file type in CodeBehind.");
+
+ }
+ }
+
+ protected abstract string DefaultDirectiveName { get; }
+
+ internal HttpContext Context
+ {
+ get {
+ return context;
+ }
+ }
+
+ internal string VirtualPath
+ {
+ get {
+ return vPath;
+ }
+ }
+
+ internal string PhysicalPath
+ {
+ get {
+ return physPath;
+ }
+ }
+
+ internal string ClassName
+ {
+ get {
+ return className;
+ }
+
+ set {
+ className = value;
+ }
+ }
+
+ internal string CodeBehind
+ {
+ get {
+ return codeBehind;
+ }
+
+ set {
+ codeBehind = value;
+ }
+ }
+
+ internal bool Debug
+ {
+ get {
+ return debug;
+ }
+
+ set {
+ debug = value;
+ }
+ }
+
+ internal string Language
+ {
+ get {
+ return language;
+ }
+
+ set {
+ language = value;
+ }
+ }
+
+ internal string Program
+ {
+ get {
+ return program;
+ }
+
+ set {
+ program = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/StateBag.cs b/mcs/class/System.Web/System.Web.UI/StateBag.cs
new file mode 100644
index 00000000000..925e5722e4d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateBag.cs
@@ -0,0 +1,249 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: StateBag
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public sealed class StateBag : IStateManager, IDictionary, ICollection, IEnumerable
+ {
+ private bool ignoreCase;
+ private bool marked;
+ private HybridDictionary bag;
+
+ public StateBag (bool ignoreCase)
+ {
+ Initialize (ignoreCase);
+ }
+
+ public StateBag ()
+ {
+ Initialize (false);
+ }
+
+ private void Initialize (bool ignoreCase)
+ {
+ this.ignoreCase = ignoreCase;
+ marked = false;
+ bag = new HybridDictionary (ignoreCase);
+ }
+
+ public int Count {
+ get { return bag.Count; }
+ }
+
+
+ public object this [string key] {
+ get {
+ if (key == null || key.Length == 0)
+ throw new ArgumentException (HttpRuntime.FormatResourceString ("Key_Cannot_Be_Null"));
+
+ object val = bag [key];
+
+ if (val is StateItem)
+ return ((StateItem) val).Value;
+
+ return null; //
+ }
+
+ set { Add (key, value); }
+ }
+
+ object IDictionary.this [object key] {
+ get { return this [(string) key] as object; }
+
+ set { Add ((string) key, value); }
+ }
+
+ public ICollection Keys {
+ get { return bag.Keys; }
+ }
+
+ public ICollection Values {
+ get { return bag.Values; }
+ }
+
+ public StateItem Add (string key, object value)
+ {
+ if (key == null || key.Length == 0)
+ throw new ArgumentException (HttpRuntime.FormatResourceString ("Key_Cannot_Be_Null"));
+
+ StateItem val = bag [key] as StateItem; //don't throw exception when null
+ if(val == null) {
+ if(value != null || marked) {
+ val = new StateItem (value);
+ bag.Add (key, val);
+ }
+ }
+ else if (value == null && !marked)
+ bag.Remove (key);
+ else
+ val.Value = value;
+
+ if (val != null && marked) {
+ val.IsDirty = true;
+ }
+
+ return val;
+ }
+
+ public void Clear ()
+ {
+ bag.Clear ();
+ }
+
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ return bag.GetEnumerator ();
+ }
+
+ public bool IsItemDirty (string key)
+ {
+ object o = bag [key];
+
+ if (o is StateItem)
+ return ((StateItem) o).IsDirty;
+
+ return false;
+ }
+
+ public void Remove (string key)
+ {
+ bag.Remove (key);
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ public void SetItemDirty (string key, bool dirty)
+ {
+ if (bag [key] is StateItem)
+ ((StateItem) bag [key]).IsDirty = dirty;
+ }
+
+ internal bool IsTrackingViewState {
+ get { return marked; }
+ }
+
+ internal void LoadViewState (object state)
+ {
+ if(state!=null) {
+ Pair pair = (Pair) state;
+ ArrayList keyList = (ArrayList) (pair.First);
+ ArrayList valList = (ArrayList) (pair.Second);
+
+ int valCount = valList.Count;
+ for(int i = 0; i < keyList.Count; i++) {
+ if (i < valCount)
+ Add ((string) keyList [i], valList [i]);
+ else
+ Add ((string) keyList [i], null);
+ }
+ }
+ }
+
+ internal object SaveViewState ()
+ {
+ if(bag.Count > 0) {
+ ArrayList keyList = null, valList = null;
+
+ foreach (string key in bag.Keys) {
+ StateItem item = (StateItem) bag [key];
+
+ if (item.IsDirty) {
+ if (keyList == null) {
+ keyList = new ArrayList ();
+ valList = new ArrayList ();
+ }
+
+ keyList.Add (key);
+ valList.Add (item.Value);
+ }
+ }
+
+ if (keyList!=null)
+ return new Pair (keyList, valList);
+ }
+ return null;
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ void IStateManager.LoadViewState (object savedState)
+ {
+ LoadViewState (savedState);
+ }
+
+ object IStateManager.SaveViewState ()
+ {
+ return SaveViewState ();
+ }
+
+ void IStateManager.TrackViewState ()
+ {
+ TrackViewState ();
+ }
+
+ bool IStateManager.IsTrackingViewState {
+ get { return IsTrackingViewState; }
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ Values.CopyTo (array, index);
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get { return this; }
+ }
+
+ void IDictionary.Add (object key, object value)
+ {
+ Add ((string) key, value);
+ }
+
+ void IDictionary.Remove (object key)
+ {
+ Remove ((string) key);
+ }
+
+ bool IDictionary.Contains (object key)
+ {
+ return bag.Contains ((string) key);
+ }
+
+ bool IDictionary.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IDictionary.IsReadOnly {
+ get { return false; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/StateItem.cs b/mcs/class/System.Web/System.Web.UI/StateItem.cs
new file mode 100644
index 00000000000..81a425bbaac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateItem.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.StateItem.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public sealed class StateItem
+ {
+ private bool _isDirty = false;
+ private object _value = null;
+ public bool IsDirty
+ {
+ get
+ {
+ return _isDirty;
+ }
+ set
+ {
+ _isDirty = value;
+ }
+ }
+ public object Value
+ {
+ get
+ {
+ return _value;
+ }
+ set
+ {
+ _value = value;
+ }
+ }
+ private StateItem() {}
+ internal StateItem(Object value)
+ {
+ _value = value;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TODO b/mcs/class/System.Web/System.Web.UI/TODO
new file mode 100644
index 00000000000..de529b87f86
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TODO
@@ -0,0 +1,42 @@
+AttributeCollection
+BaseParser
+BasePartialCachingControl
+CompiledTemplateBuilder
+ConstructorNeedsTagAttribute
+ControlBuilder
+ControlBuilderAttribute
+ControlCollection
+CssStyleCollection
+DataBinder
+DataBinding
+DataBindingCollection
+DataBindingHandlerAttribute
+DataBoundLiteralControl
+DesignTimeParseData
+DesignTimeTemplateParser
+EmptyControlCollection
+Html32TextWriter
+HtmlTextWriter
+ImageClickEventArgs
+LosFormatter
+Page
+PageParser
+ParseChildrenAttribute
+PartialCachingAttribute
+PartialCachingControl
+PersistChildrenAttribute
+PersistanceModeAttribute
+RootBuilder
+SimpleWebHandlerParser
+StateBag
+StaticPartialCachingControl
+TagPrefixAttribute
+TemplateBuilder
+TemplateContainerAttribute
+TemplateControl
+TemplateControlParser
+ToolboxDataAttribute
+UserControl
+ValidationPropertyAttribute
+ValidatorCollection
+WebServiceProvider
diff --git a/mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs b/mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs
new file mode 100755
index 00000000000..0dc56d241f5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TagPrefixAttribute.cs
@@ -0,0 +1,37 @@
+//
+// System.Web.UI.TagPrefixAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class TagPrefixAttribute : Attribute
+ {
+ string namespaceName;
+ string tagPrefix;
+
+ public TagPrefixAttribute (string namespaceName,
+ string tagPrefix)
+ {
+ if (namespaceName == null || tagPrefix == null)
+ throw new ArgumentNullException ();
+
+ this.namespaceName = namespaceName;
+ this.tagPrefix = tagPrefix;
+ }
+
+ public string NamespaceName {
+ get { return namespaceName; }
+ }
+
+ public string TagPrefix {
+ get { return tagPrefix; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs b/mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs
new file mode 100755
index 00000000000..854bcf1419e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateContainerAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Web.UI.TemplateContainerAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class TemplateContainerAttribute : Attribute
+ {
+ Type containerType;
+
+ public TemplateContainerAttribute (Type containerType)
+ {
+ this.containerType = containerType;
+ }
+
+ public Type ContainerType {
+ get { return containerType; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
new file mode 100755
index 00000000000..c5498d5d977
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
@@ -0,0 +1,217 @@
+//
+// System.Web.UI.TemplateControl.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI {
+
+ public abstract class TemplateControl : Control, INamingContainer
+ {
+ static object abortTransaction = new object ();
+ static object commitTransaction = new object ();
+ static object error = new object ();
+ static string [] methodNames = { "Page_Init",
+ "Page_Load",
+ "Page_DataBind",
+ "Page_PreRender",
+ "Page_Dispose",
+ "Page_Error" };
+
+ const BindingFlags bflags = BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Static |
+ BindingFlags.Instance;
+
+ #region Constructor
+ protected TemplateControl ()
+ {
+ Construct ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ protected virtual int AutoHandlers {
+ get { return 0; }
+ set { }
+ }
+
+ protected virtual bool SupportAutoEvents {
+ get { return true; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ protected virtual void Construct ()
+ {
+ }
+
+ [MonoTODO]
+ protected virtual LiteralControl CreateResourceBasedLiteralControl (int offset,
+ int size,
+ bool fAsciiOnly)
+ {
+ return null;
+ }
+
+ internal void WireupAutomaticEvents ()
+ {
+ if (!SupportAutoEvents || !AutoEventWireup)
+ return;
+
+ Type type = GetType ();
+ foreach (MethodInfo method in type.GetMethods (bflags)) {
+ int pos = Array.IndexOf (methodNames, method.Name);
+ if (pos == -1)
+ continue;
+
+ string name = methodNames [pos];
+ pos = name.IndexOf ("_");
+ if (pos == -1 || pos + 1 == name.Length)
+ continue;
+
+ if (method.ReturnType != typeof (void))
+ continue;
+
+ ParameterInfo [] parms = method.GetParameters ();
+ if (parms.Length != 2 ||
+ parms [0].ParameterType != typeof (object) ||
+ parms [1].ParameterType != typeof (EventArgs))
+ continue;
+
+ string eventName = name.Substring (pos + 1);
+ EventInfo evt = type.GetEvent (eventName);
+ if (evt == null)
+ continue;
+
+ evt.AddEventHandler (this, Delegate.CreateDelegate (typeof (EventHandler), method));
+ }
+ }
+
+ protected virtual void FrameworkInitialize ()
+ {
+ }
+
+ Type GetTypeFromControlPath (string virtualPath)
+ {
+ if (virtualPath == null)
+ throw new ArgumentNullException ("virtualPath");
+
+ string vpath = UrlUtils.Combine (TemplateSourceDirectory, virtualPath);
+ return UserControlCompiler.CompileUserControlType (new UserControlParser (vpath, Context));
+ }
+
+ public Control LoadControl (string virtualPath)
+ {
+ object control = Activator.CreateInstance (GetTypeFromControlPath (virtualPath));
+ if (control is UserControl)
+ ((UserControl) control).InitializeAsUserControl (Page);
+
+ return (Control) control;
+ }
+
+ public ITemplate LoadTemplate (string virtualPath)
+ {
+ Type t = GetTypeFromControlPath (virtualPath);
+ return new SimpleTemplate (t);
+ }
+
+ protected virtual void OnAbortTransaction (EventArgs e)
+ {
+ EventHandler eh = Events [error] as EventHandler;
+ if (eh != null)
+ eh.Invoke (this, e);
+ }
+
+ protected virtual void OnCommitTransaction (EventArgs e)
+ {
+ EventHandler eh = Events [commitTransaction] as EventHandler;
+ if (eh != null)
+ eh.Invoke (this, e);
+ }
+
+ protected virtual void OnError (EventArgs e)
+ {
+ EventHandler eh = Events [abortTransaction] as EventHandler;
+ if (eh != null)
+ eh.Invoke (this, e);
+ }
+
+ [MonoTODO]
+ public Control ParseControl (string content)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public static object ReadStringResource (Type t)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ protected void SetStringResourcePointer (object stringResourcePointer,
+ int maxResourceOffset)
+ {
+ }
+
+ [MonoTODO]
+ protected void WriteUTF8ResourceString (HtmlTextWriter output, int offset,
+ int size, bool fAsciiOnly)
+ {
+ }
+
+ #endregion
+
+ #region Events
+
+ public event EventHandler AbortTransaction {
+ add { Events.AddHandler (abortTransaction, value); }
+ remove { Events.RemoveHandler (abortTransaction, value); }
+ }
+
+ public event EventHandler CommitTransaction {
+ add { Events.AddHandler (commitTransaction, value); }
+ remove { Events.RemoveHandler (commitTransaction, value); }
+ }
+
+ public event EventHandler Error {
+ add { Events.AddHandler (error, value); }
+ remove { Events.RemoveHandler (error, value); }
+ }
+
+ #endregion
+
+ class SimpleTemplate : ITemplate
+ {
+ Type type;
+
+ public SimpleTemplate (Type type)
+ {
+ this.type = type;
+ }
+
+ public void InstantiateIn (Control control)
+ {
+ Control template = Activator.CreateInstance (type) as Control;
+ template.SetBindingContainer (false);
+ control.Controls.Add (template);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
new file mode 100644
index 00000000000..33f05b48bb5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.TemplateControlParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Web.Compilation;
+using System.Web.Util;
+
+namespace System.Web.UI
+{
+ public abstract class TemplateControlParser : TemplateParser
+ {
+ internal object GetCompiledInstance (string virtualPath, string inputFile, HttpContext context)
+ {
+ Context = context;
+ InputFile = MapPath (virtualPath);
+ Type type = CompileIntoType ();
+ if (type == null)
+ return null;
+
+ object ctrl = Activator.CreateInstance (type);
+ if (ctrl == null)
+ return null;
+
+ HandleOptions (ctrl);
+ return ctrl;
+ }
+
+ protected override void HandleOptions (object obj)
+ {
+ Control ctrl = obj as Control;
+ Hashtable options = Options;
+ if (options == null)
+ return;
+
+ if (options ["AutoEventWireup"] != null)
+ ctrl.AutoEventWireup = (bool) options ["AutoEventWireup"];
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
new file mode 100755
index 00000000000..b52d2f46719
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
@@ -0,0 +1,55 @@
+//
+// System.Web.UI.TemplateParser
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public abstract class TemplateParser : BaseParser
+ {
+ string inputFile;
+ string text;
+ Hashtable options;
+
+ protected abstract Type CompileIntoType ();
+
+ protected virtual void HandleOptions (object obj)
+ {
+ }
+
+ protected abstract Type DefaultBaseType { get; }
+
+ protected abstract string DefaultDirectiveName { get; }
+
+ internal string InputFile
+ {
+ get { return inputFile; }
+ set { inputFile = value; }
+ }
+
+ internal string Text
+ {
+ get { return text; }
+ set { text = value; }
+ }
+
+ internal Type BaseType
+ {
+ get { return DefaultBaseType; }
+ }
+
+ internal Hashtable Options {
+ get { return options; }
+ set { options = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs b/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
new file mode 100644
index 00000000000..88bdd66227f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
@@ -0,0 +1,58 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: ToolboxDataAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+
+namespace System.Web.UI
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class ToolboxDataAttribute : Attribute
+ {
+ public static readonly ToolboxDataAttribute Default = new ToolboxDataAttribute("");
+
+ private string data;
+
+ public ToolboxDataAttribute(string data)
+ {
+ this.data = data;
+ }
+
+ public string Data
+ {
+ get
+ {
+ return data;
+ }
+ }
+
+ public override bool IsDefaultAttribute()
+ {
+ return Default.Equals(this);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj != null && obj is ToolboxDataAttribute)
+ {
+ ToolboxDataAttribute tda = (ToolboxDataAttribute)obj;
+ return (tda.Data == Data);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Triplet.cs b/mcs/class/System.Web/System.Web.UI/Triplet.cs
new file mode 100755
index 00000000000..28c8546c762
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Triplet.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.Triplet.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+ public class Triplet
+ {
+ public object First;
+ public object Second;
+ public object Third;
+
+ public Triplet ()
+ {
+ }
+
+ public Triplet (object x, object y)
+ {
+ First = x;
+ Second = y;
+ }
+
+ public Triplet (object x, object y, object z)
+ {
+ First = x;
+ Second = y;
+ Third = z;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/UserControl.cs b/mcs/class/System.Web/System.Web.UI/UserControl.cs
new file mode 100644
index 00000000000..50ef9362fab
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UserControl.cs
@@ -0,0 +1,189 @@
+//
+// System.Web.UI.UserControl
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Web.Caching;
+using System.Web.SessionState;
+
+namespace System.Web.UI
+{
+ public class UserControl : TemplateControl, IAttributeAccessor
+ {
+ private bool initialized;
+ private AttributeCollection attributes;
+ private StateBag attrBag;
+
+ public UserControl ()
+ {
+ //??
+ }
+
+ public HttpApplicationState Application
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Application;
+ }
+ }
+
+ private void EnsureAttributes ()
+ {
+ if (attributes == null) {
+ attrBag = new StateBag (true);
+ if (IsTrackingViewState)
+ attrBag.TrackViewState ();
+ attributes = new AttributeCollection (attrBag);
+ }
+ }
+
+ public AttributeCollection Attributes
+ {
+ get {
+ return attributes;
+ }
+ }
+
+ public Cache Cache
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Cache;
+ }
+ }
+
+ public bool IsPostBack
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return false;
+ return p.IsPostBack;
+ }
+ }
+
+ public HttpRequest Request
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Request;
+ }
+ }
+
+ public HttpResponse Response
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Response;
+ }
+ }
+
+ public HttpServerUtility Server
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Server;
+ }
+ }
+
+ public HttpSessionState Session
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Session;
+ }
+ }
+
+ public TraceContext Trace
+ {
+ get {
+ Page p = Page;
+ if (p == null)
+ return null;
+ return p.Trace;
+ }
+ }
+
+ [MonoTODO]
+ public void DesignerInitialize ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void InitializeAsUserControl (Page page)
+ {
+ if (initialized)
+ return;
+ initialized = true;
+ this.Page = page;
+ WireupAutomaticEvents ();
+ FrameworkInitialize ();
+ }
+
+ public string MapPath (string virtualPath)
+ {
+ return Request.MapPath (virtualPath, TemplateSourceDirectory, true);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ Pair p = (Pair) savedState;
+ base.LoadViewState (p.First);
+ if (p.Second != null) {
+ EnsureAttributes ();
+ attrBag.LoadViewState (p.Second);
+ }
+ }
+
+ }
+
+ protected override void OnInit (EventArgs e)
+ {
+ InitializeAsUserControl (Page);
+
+ base.OnInit(e);
+ }
+
+ protected override object SaveViewState ()
+ {
+ object baseState = base.SaveViewState();
+ object attrState = null;
+ if (attributes != null)
+ attrState = attrBag.SaveViewState ();
+ if (baseState == null && attrState == null)
+ return null;
+ return new Pair (baseState, attrState);
+ }
+
+ string IAttributeAccessor.GetAttribute (string name)
+ {
+ if (attributes == null)
+ return null;
+ return attributes [name];
+ }
+
+ void IAttributeAccessor.SetAttribute (string name, string value)
+ {
+ EnsureAttributes ();
+ Attributes [name] = value;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
new file mode 100644
index 00000000000..16253a6533d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
@@ -0,0 +1,50 @@
+//
+// System.Web.UI.UserControlParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ public sealed class UserControlParser : TemplateControlParser
+ {
+ internal UserControlParser (string inputFile, HttpContext context)
+ {
+ Context = context;
+ InputFile = context.Request.MapPath (inputFile);
+ }
+
+ public static Type GetCompiledType (string virtualPath, string inputFile, HttpContext context)
+ {
+ UserControlParser ucp = new UserControlParser (inputFile, context);
+ Type t = ucp.CompileIntoType ();
+ return t;
+ }
+
+ protected override Type CompileIntoType ()
+ {
+ return UserControlCompiler.CompileUserControlType (this);
+ }
+
+ protected override Type DefaultBaseType
+ {
+ get {
+ return typeof (UserControl);
+ }
+ }
+
+ protected override string DefaultDirectiveName
+ {
+ get {
+ return "control";
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/Utils.cs b/mcs/class/System.Web/System.Web.UI/Utils.cs
new file mode 100644
index 00000000000..5efb7a7919a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Utils.cs
@@ -0,0 +1,46 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: Utils
+ *
+ * Author: Gaurav Vaish
+ * Maintainer-> gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ internal class Utils
+ {
+ internal static object InvokeMethod(MethodInfo info, object obj, object[] parameters)
+ {
+ object retVal = null;
+ try
+ {
+ retVal = info.Invoke(obj, parameters);
+ } catch(TargetInvocationException tie)
+ {
+ throw tie.InnerException;
+ }
+ return retVal;
+ }
+
+ internal static string GetClientValidatedEvent(Page page)
+ {
+ return "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();";
+ }
+
+ internal static string GetClientValidatedPostBack(Control control)
+ {
+ return (" { if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) " +
+ control.Page.GetPostBackEventReference(control) +
+ " } " );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs b/mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs
new file mode 100644
index 00000000000..01281a6f002
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ValidationPropertyAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Web.UI.ValidationPropertyAttribute.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ValidationPropertyAttribute : Attribute
+ {
+ string name;
+
+ public ValidationPropertyAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ public string Name {
+ get { return name; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs b/mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs
new file mode 100755
index 00000000000..eef684a96ab
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ValidatorCollection.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.UI.ValidatorCollection.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+ public sealed class ValidatorCollection : ICollection, IEnumerable
+ {
+ private ArrayList _validators;
+
+ public ValidatorCollection ()
+ {
+ _validators = new ArrayList ();
+ }
+
+ public int Count {
+ get { return _validators.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return _validators.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return _validators.IsSynchronized; }
+ }
+
+ public IValidator this [int index] {
+ get { return (IValidator) _validators [index]; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ public void Add (IValidator validator)
+ {
+ _validators.Add (validator);
+ }
+
+ public bool Contains (IValidator validator)
+ {
+ return _validators.Contains (validator);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ _validators.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return _validators.GetEnumerator ();
+ }
+
+ public void Remove (IValidator validator)
+ {
+ _validators.Remove (validator);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/WebServiceParser.cs b/mcs/class/System.Web/System.Web.UI/WebServiceParser.cs
new file mode 100644
index 00000000000..c107c729871
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/WebServiceParser.cs
@@ -0,0 +1,36 @@
+//
+// System.Web.UI.WebServiceParser
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Web;
+using System.Web.Compilation;
+
+namespace System.Web.UI
+{
+ public class WebServiceParser : SimpleWebHandlerParser
+ {
+ private WebServiceParser (HttpContext context, string virtualPath, string physicalPath)
+ : base (context, virtualPath, physicalPath)
+ {
+ }
+
+ public static Type GetCompiledType (string inputFile, HttpContext context)
+ {
+ WebServiceParser parser = new WebServiceParser (context, null, inputFile);
+ return WebServiceCompiler.CompileIntoType (parser);
+ }
+
+ protected override string DefaultDirectiveName
+ {
+ get {
+ return "webservice";
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/.cvsignore b/mcs/class/System.Web/System.Web.Util/.cvsignore
new file mode 100644
index 00000000000..04bc145deea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/.cvsignore
@@ -0,0 +1 @@
+_*
diff --git a/mcs/class/System.Web/System.Web.Util/ApacheVersionInfo.cs b/mcs/class/System.Web/System.Web.Util/ApacheVersionInfo.cs
new file mode 100644
index 00000000000..229104aa271
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/ApacheVersionInfo.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: ApacheVersionInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Util
+{
+ /// <summary>
+ /// Versions of the modules related to Apache
+ /// </summary>
+ /// <remarks>
+ /// At present I don't know what modules are to be loaded and how
+ /// </remarks>
+ /// <see>
+ /// System.Web.Util.IISVersionInfo
+ /// </see>
+ internal class ApacheVersionInfo
+ {
+ public ApacheVersionInfo()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/ChangeLog b/mcs/class/System.Web/System.Web.Util/ChangeLog
new file mode 100644
index 00000000000..15f40d2ebc6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/ChangeLog
@@ -0,0 +1,84 @@
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: fixed IsRelativeUrl and IsRootUrl.
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathUtil.cs: removed.
+ * UrlUtils.cs: fixed Combine to handle '~'.
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathUtil.cs: some path handling methods that are not available in
+ System.IO.Path.
+
+2002-10-28 Gaurav Vaish <gvaish_mono@lycos.com>
+
+ * DataSourceHelper.cs : Fresh implementation. Moved from
+ System.Web.UI.WebControls.DataGrid
+ ::ResolveData(object, string).
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebTrace.cs: fixed namespace.
+
+ * WebEncoding.cs: new class that holds the default encoding for
+ System.Web.
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * FileChangesMonitor.cs: remove redundant using statement; use int
+ for MAXLEN; capitalize correctly 'WebHashCodeProvider';
+ fix typo rsLock -> rwLock; Change IsRooted to IsPathRooted;
+ set out parameter value where needed
+ * FilePathParser.cs: qualify method GetPathRoot() with 'Path.'
+ * IISVersionInfo.cs: initialize static member to avoid compile error.
+ * WebEqualComparer.cs: static member defC shouldn't be readonly;
+ the string comparer had some typos (fixed)
+ * WebHashCodeProvider.cs: needed System.Globalization; static member
+ defHcp shouldn't be readonly; remove double equal typo.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * FileAction.cs: Use 0x7FFFFFFF as enum value for error. 0xFFFFFFFF
+ is too big for Int32.
+ * FileChangeEventHandler.cs: put missing 'void' return type on delegate
+ FileChangeEventHandler()
+ * FileChangedEventArgs.cs: ditto for FileChangedEvent()
+ * NativeFileChangeEventHandler.cs: ditto for NativeFileChangeEventHandler()
+ * FileChangesMonitor.cs: add needed namespaces and comment out imcomplete
+ code.
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ApacheVersionInfo.cs - Dummy class, for later use.
+ * FileAction.cs:
+ * FileChangeEventHandler.cs:
+ * FileChangeEventArgs.cs:
+ * FileChangesMonitor.cs:
+ * NativeFileChangeEventHandler.cs
+ - To be used in System.Web/Http* classes.
+ Initially needed for HttpRuntime
+ * IISVersionInfo.cs - Some useful methods
+
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * UrlUtils.cs - Added functions Combine and Reduce
+
+2001-12-16 Miguel de Icaza <miguel@ximian.com>
+
+ * DataSourceHelper.cs, UrlUtils.cs: Set the correct namespace.
+
+2001-11-30
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * DataSourceHelper.cs - Resolving DataSource objects
+
+2001-11-09
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * UrlUtil.cs - Some basic functions
+
+2001-11-08
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * Namespace - Created the namespace for commonly used,
+ otherwise not available functions
diff --git a/mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs b/mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs
new file mode 100644
index 00000000000..d5519e6234a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/DataSourceHelper.cs
@@ -0,0 +1,67 @@
+/**
+ * Namespace: System.Web.UI.Util
+ * Class: DataSourceHelper
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Status: 10%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.Util
+{
+ internal class DataSourceHelper
+ {
+ public static IEnumerable GetResolvedDataSource(object source, string member)
+ {
+ if(source != null && source is IListSource)
+ {
+ IListSource src = (IListSource)source;
+ IList list = src.GetList();
+ if(!src.ContainsListCollection)
+ {
+ return list;
+ }
+ if(list != null && list is ITypedList)
+ {
+ ITypedList tlist = (ITypedList)list;
+ PropertyDescriptorCollection pdc = tlist.GetItemProperties(new PropertyDescriptor[0]);
+ if(pdc != null && pdc.Count > 0)
+ {
+ PropertyDescriptor pd = null;
+ if(member != null && member.Length > 0)
+ {
+ pd = pdc.Find(member, true);
+ } else
+ {
+ pd = pdc[0];
+ }
+ if(pd != null)
+ {
+ object rv = pd.GetValue(list[0]);
+ if(rv != null && rv is IEnumerable)
+ {
+ return (IEnumerable)rv;
+ }
+ }
+ throw new HttpException(
+ HttpRuntime.FormatResourceString("ListSource_Missing_DataMember", member));
+ }
+ throw new HttpException(
+ HttpRuntime.FormatResourceString("ListSource_Without_DataMembers"));
+ }
+ }
+ if(source is IEnumerable)
+ {
+ return (IEnumerable)source;
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/FileAction.cs b/mcs/class/System.Web/System.Web.Util/FileAction.cs
new file mode 100644
index 00000000000..1a727011e25
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/FileAction.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: FileAction
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Util
+{
+ public enum FileAction
+ {
+ Overwhleming,
+ Added,
+ Removed,
+ Modifiled,
+ RenamedOldName,
+ RenamedNewName,
+ Error = 0x7FFFFFFF
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs
new file mode 100644
index 00000000000..88bcf46e99b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: FileChangeEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Util
+{
+ public delegate void FileChangeEventHandler(object sender, int method);
+}
diff --git a/mcs/class/System.Web/System.Web.Util/FileChangedEventArgs.cs b/mcs/class/System.Web/System.Web.Util/FileChangedEventArgs.cs
new file mode 100644
index 00000000000..69bc9818f4a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/FileChangedEventArgs.cs
@@ -0,0 +1,43 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: FileChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Util
+{
+ internal class FileChangedEventArgs : EventArgs
+ {
+ private string filename;
+ private FileAction action;
+
+ public void FileChangedEvent(FileAction action, string file)
+ {
+ this.action = action;
+ this.filename = file;
+ }
+
+ public string FileName
+ {
+ get
+ {
+ return filename;
+ }
+ }
+
+ public FileAction Action
+ {
+ get
+ {
+ return action;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/FileChangesMonitor.cs b/mcs/class/System.Web/System.Web.Util/FileChangesMonitor.cs
new file mode 100644
index 00000000000..069d2a4f385
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/FileChangesMonitor.cs
@@ -0,0 +1,62 @@
+/**
+ *
+ * Namespace: System.Web.Util
+ * Class: FileChangesMonitor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.IO;
+using System.Web;
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.Threading;
+
+namespace System.Web.Util
+{
+ internal class FileChangesMonitor
+ {
+ private static string BIN = "bin";
+ private static string BINDIR = "bin/";
+ private static int MAXLEN = 260;
+
+ private FileChangeEventHandler cbRename;
+ private NativeFileChangeEventHandler cbSubDirs;
+
+ private int monitoredSubdirs;
+ private string rootDir;
+ private Hashtable allDirs;
+ private GCHandle rootcbSubDirs;
+
+ private ReaderWriterLock rwLock;
+
+ public FileChangesMonitor()
+ {
+ allDirs = new Hashtable(WebHashCodeProvider.Default, WebEqualComparer.Default);
+ rwLock = new ReaderWriterLock();
+ }
+
+ /// <param name="file">Name of the file</param>
+ /// <param name="mTime">Last modification date</param>
+ /// <param name="length">Legnth of the file</param>
+ [MonoTODO]
+ public void GetFileAttributes(string file, out DateTime mTime, long length)
+ {
+ if(!Path.IsPathRooted(file))
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Path_must_be_rooted"));
+ }
+ // TODO: finish this
+ mTime = DateTime.Now;
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/FilePathParser.cs b/mcs/class/System.Web/System.Web.Util/FilePathParser.cs
new file mode 100644
index 00000000000..625ac056d03
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/FilePathParser.cs
@@ -0,0 +1,82 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: FilePathParser
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+using System.IO;
+
+namespace System.Web.Util
+{
+ internal class FilePathParser
+ {
+ private static char[] pathSeparators = {
+ Path.DirectorySeparatorChar,
+ Path.AltDirectorySeparatorChar
+ };
+
+ private string dirName;
+ private string fileName;
+ private string shortDirName;
+ private string shortFileName;
+
+ private bool exists;
+
+ [MonoTODO]
+ public FilePathParser(string path, bool isFile, bool getShortNames)
+ {
+ path = path.Trim();
+ if(Path.GetPathRoot(path).Length < path.Length)
+ {
+ path = path.TrimEnd(pathSeparators);
+ }
+ if(!isFile)
+ {
+ dirName = GetBaseDirOrRoot(path);
+ } else
+ {
+ dirName = path;
+ }
+ if(getShortNames)
+ {
+ if(!Directory.Exists(dirName))
+ {
+ dirName = null;
+ return;
+ }
+ shortDirName = GetShortPathName(dirName);
+ if(shortDirName==null)
+ {
+ dirName = null;
+ return;
+ }
+ if(shortDirName == dirName)
+ {
+ shortDirName = null;
+ } else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public static string GetBaseDirOrRoot(string file)
+ {
+ string bDir = Path.GetDirectoryName(file);
+ return ( bDir!=null ? bDir : Path.GetPathRoot(file));
+ }
+
+ [MonoTODO("Native_Call_Required")]
+ public static string GetShortPathName(string path)
+ {
+ //TODO: Native calls required, it's in kernel32.dll for windows
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/IISVersionInfo.cs b/mcs/class/System.Web/System.Web.Util/IISVersionInfo.cs
new file mode 100644
index 00000000000..68f252531d3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/IISVersionInfo.cs
@@ -0,0 +1,109 @@
+/**
+
+ * Namespace: System.Web.Util
+ * Class: IISVersionInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+
+ *
+
+ * (C) Gaurav Vaish (2001)
+
+ */
+
+
+using System;
+using System.Diagnostics;
+using System.Web;
+
+namespace System.Web.Util
+{
+ //FIXME: This is highly Windows/IIS specific code. What about Apache related stuff?
+ internal class IISVersionInfo
+ {
+ private static string isapiVersion;
+ private static string mscoreeVersion;
+ private static string systemWebVersion;
+
+ private static readonly object lockObj = null;
+
+ public IISVersionInfo()
+ {
+ }
+
+ internal static string IsapiVersion
+ {
+ get
+ {
+ if(isapiVersion==null)
+ {
+ lock(lockObj)
+ {
+ // Recheck - another thread may have set the value
+ // before entering lock / exiting previous lock
+ if(isapiVersion==null)
+ {
+ //FIXME: What about Apache? What dll/shared-object to be loaded?
+ isapiVersion = GetLoadedModuleVersion("aspnet_isapi.dll");
+ }
+ }
+ }
+ return isapiVersion;
+ }
+ }
+
+ internal static string ClrVersion
+ {
+ get
+ {
+ if(mscoreeVersion==null)
+ {
+ lock(lockObj)
+ {
+ if(mscoreeVersion==null)
+ {
+ mscoreeVersion = GetLoadedModuleVersion("mscorlib.dll");
+ }
+ }
+ }
+ return mscoreeVersion;
+ }
+ }
+
+ internal static string SystemWebVersion
+ {
+ get
+ {
+ if(systemWebVersion == null)
+ {
+ lock(lockObj)
+ {
+ if(systemWebVersion==null)
+ {
+ systemWebVersion = (FileVersionInfo.GetVersionInfo((typeof(HttpRuntime)).Module.FullyQualifiedName)).FileVersion;
+ }
+ }
+ }
+ return systemWebVersion;
+ }
+ }
+
+ [MonoTODO]
+ internal static string GetLoadedModuleVersion(string modulename)
+ {
+ //TODO: Load the version information from the module
+ // Needs native calls - which ones, since the module will not be .Net aware
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal static string GetLoadedModuleFilename(string modulename)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
new file mode 100644
index 00000000000..13a88dc0c1e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: NativeFileChangeEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Util
+{
+ public delegate void NativeFileChangeEventHandler(object sender, int method);
+}
diff --git a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
new file mode 100644
index 00000000000..4068a9b6f61
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
@@ -0,0 +1,290 @@
+/**
+ * Namespace: System.Web.UI.Util
+ * Class: UrlUtils
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.Util
+{
+ internal class UrlUtils
+ {
+ /*
+ * I could not find these functions in the class System.Uri
+ * Besides, an instance of Uri will not be formed until and unless the address is of
+ * the form protocol://[user:pass]host[:port]/[fullpath]
+ * ie, a protocol, and that too without any blanks before,
+ * is a must which may not be the case here.
+ * Important: Escaped URL is assumed here. nothing like .aspx?path=/something
+ * It should be .aspx?path=%2Fsomething
+ */
+ public static string GetProtocol(string url)
+ {
+ //Taking code from Java Class java.net.URL
+ if(url!=null)
+ {
+ if(url.Length>0)
+ {
+
+ int i, start = 0, limit;
+ limit = url.Length;
+ char c;
+ bool aRef = false;
+ while( (limit > 0) && (url[limit-1] <= ' '))
+ {
+ limit --;
+ }
+ while( (start < limit) && (url[start] <= ' '))
+ {
+ start++;
+ }
+ if(RegionMatches(true, url, start, "url:", 0, 4))
+ {
+ start += 4;
+ }
+ if(start < url.Length && url[start]=='#')
+ {
+ aRef = true;
+ }
+ for(i = start; !aRef && (i < limit) && ((c=url[i]) != '/'); i++)
+ {
+ if(c==':')
+ {
+ return url.Substring(start, i - start);
+ }
+ }
+ }
+ }
+ return String.Empty;
+ }
+
+ public static bool IsRelativeUrl(string url)
+ {
+ if (url.IndexOf(':') == -1)
+ return !IsRooted(url);
+
+ return false;
+ }
+
+ public static bool IsRootUrl(string url)
+ {
+ if(url!=null)
+ {
+ if(url.Length>0)
+ {
+ return IsValidProtocol(GetProtocol(url).ToLower());
+ }
+ }
+ return true;
+ }
+
+ public static bool IsRooted(string path)
+ {
+ if(path!=null && path.Length > 0)
+ {
+ return (path[0]=='/' || path[0]=='\\');
+ }
+ return true;
+ }
+
+ public static void FailIfPhysicalPath(string path)
+ {
+ if(path!= null && path.Length > 1)
+ {
+ if(path[1]==':' || path.StartsWith(@"\\"))
+ throw new HttpException(HttpRuntime.FormatResourceString("Physical_path_not_allowed", path));
+ }
+ }
+
+ public static string Combine (string basePath, string relPath)
+ {
+ FailIfPhysicalPath (relPath);
+ if (IsRootUrl (relPath)) {
+ if (relPath != null && relPath.Length > 0)
+ return Reduce (relPath);
+
+ return String.Empty;
+ }
+
+ if (relPath.Length < 3 || relPath [0] != '~' || relPath [0] == '/' || relPath [0] == '\\') {
+ if (basePath == null || basePath.Length == 1 || basePath [0] == '/')
+ basePath = String.Empty;
+
+ return Reduce (basePath + "/" + relPath);
+ }
+
+ string vPath = HttpRuntime.AppDomainAppVirtualPath;
+ if (vPath.Length <= 1)
+ vPath = String.Empty;
+
+ return Reduce (vPath + "/" + relPath.Substring (2));
+ }
+
+ public static bool IsValidProtocol(string protocol)
+ {
+ if(protocol.Length < 1)
+ return false;
+ char c = protocol[0];
+ if(!Char.IsLetter(c))
+ {
+ return false;
+ }
+ for(int i=1; i < protocol.Length; i++)
+ {
+ c = protocol[i];
+ if(!Char.IsLetterOrDigit(c) && c!='.' && c!='+' && c!='-')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * MakeRelative("http://www.foo.com/bar1/bar2/file","http://www.foo.com/bar1")
+ * will return "bar2/file"
+ * while MakeRelative("http://www.foo.com/bar1/...","http://www.anotherfoo.com")
+ * return 'null' and so does the call
+ * MakeRelative("http://www.foo.com/bar1/bar2","http://www.foo.com/bar")
+ */
+ public static string MakeRelative(string fullUrl, string relativeTo)
+ {
+ if(fullUrl==relativeTo)
+ {
+ return String.Empty;
+ }
+ if(fullUrl.IndexOf(relativeTo)!=0)
+ {
+ return null;
+ }
+ string leftOver = fullUrl.Substring(relativeTo.Length);
+ if(!fullUrl.EndsWith("/") && !leftOver.StartsWith("/"))
+ {
+ return null;
+ }
+ if(leftOver.StartsWith("/"))
+ {
+ leftOver = leftOver.Substring(1);
+ }
+ return leftOver;
+ }
+
+ /*
+ * Check JavaDocs for java.lang.String#RegionMatches(bool, int, String, int, int)
+ * Could not find anything similar in the System.String class
+ */
+ public static bool RegionMatches(bool ignoreCase, string source, int start, string match, int offset, int len)
+ {
+ if(source!=null || match!=null)
+ {
+ if(source.Length>0 && match.Length>0)
+ {
+ char[] ta = source.ToCharArray();
+ char[] pa = match.ToCharArray();
+ if((offset < 0) || (start < 0) || (start > (source.Length - len)) || (offset > (match.Length - len)))
+ {
+ return false;
+ }
+ while(len-- > 0)
+ {
+ char c1 = ta[start++];
+ char c2 = pa[offset++];
+ if(c1==c2)
+ continue;
+ if(ignoreCase)
+ {
+ if(Char.ToUpper(c1)==Char.ToUpper(c2))
+ continue;
+ // Check for Gregorian Calendar where the above may not hold good
+ if(Char.ToLower(c1)==Char.ToLower(c2))
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static string Reduce(string path)
+ {
+ int len = path.Length;
+ int dotIndex = -1;
+ path = path.Replace('\\','/');
+ while(true)
+ {
+ dotIndex++;
+ dotIndex = path.IndexOf('.', dotIndex);
+ if(dotIndex < 0)
+ {
+ return path;
+ }
+ if(dotIndex != 0 && path[dotIndex -1]=='/')
+ continue;
+ if(dotIndex+1 == len || path[dotIndex+1]=='/')
+ break;
+ if(path[dotIndex+1]=='.')
+ continue;
+ if(dotIndex+2 == len || path[dotIndex+2]=='/')
+ break;
+ }
+ ArrayList list = new ArrayList();
+ StringBuilder sb = new StringBuilder();
+ dotIndex = 0;
+ int temp;
+ do
+ {
+ temp = dotIndex;
+ dotIndex = path.IndexOf('/', temp + 1);
+ if(dotIndex < 0)
+ dotIndex = len;
+ if( (dotIndex - temp) <= 3 && (dotIndex < 1 || path[dotIndex - 1]== '.') && ( (temp+1) >= len || path[temp+1]=='.') )
+ {
+ if(dotIndex - temp == 3)
+ continue;
+ if(list.Count == 0)
+ throw new System.Web.HttpException(System.Web.HttpRuntime.FormatResourceString("Cannot_exit_up_top_directory"));
+ sb.Length = (int) list[list.Count - 1];
+ list.RemoveRange(list.Count - 1, 1);
+ continue;
+ }
+ list.Add(sb.Length);
+ sb.Append(path, temp, dotIndex - temp);
+ } while(dotIndex != len);
+ return sb.ToString();
+ }
+
+ public static string GetDirectory(string url)
+ {
+ if(url==null)
+ {
+ return null;
+ }
+ if(url.Length==0)
+ {
+ return String.Empty;
+ }
+ url.Replace('\\','/');
+
+ string baseDir = "";
+ int last = url.LastIndexOf ('/');
+ if (last > 0)
+ baseDir = url.Substring(0, url.LastIndexOf('/'));
+
+ if(baseDir.Length==0)
+ {
+ baseDir = "/";
+ }
+ return baseDir;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WebEncoding.cs b/mcs/class/System.Web/System.Web.Util/WebEncoding.cs
new file mode 100644
index 00000000000..5966bd0405f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebEncoding.cs
@@ -0,0 +1,24 @@
+//
+// System.Web.Util.WebEncoding
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Text;
+
+namespace System.Web.Util
+{
+ internal class WebEncoding
+ {
+ static Encoding encoding = new UTF8Encoding (false);
+
+ static public Encoding Encoding
+ {
+ get { return encoding; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs b/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
new file mode 100644
index 00000000000..9ab223bcbd4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
@@ -0,0 +1,107 @@
+/**
+ * Namespace: System.Web.Util
+ * Class: WebEqualComparer
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Globalization;
+using System.Collections;
+
+namespace System.Web.Util
+{
+ public class WebEqualComparer : IComparer
+ {
+ private static IComparer defC;
+
+ public WebEqualComparer()
+ {
+ }
+
+ public static IComparer Default
+ {
+ get
+ {
+ if(defC == null)
+ {
+ defC = new WebEqualComparer();
+ }
+ return defC;
+ }
+ }
+
+ /// <summary>
+ /// To compare two strings
+ /// </summary>
+ /// <remarks>
+ /// Cannot apply String.Compare(..) since I am at web
+ /// </remarks>
+ int IComparer.Compare(object left, object right)
+ {
+ string leftStr, rightStr;
+ leftStr = null;
+ rightStr = null;
+ if(left is string)
+ {
+ leftStr = (string)left;
+ }
+ if(right is string)
+ {
+ rightStr = (string)right;
+ }
+
+ if(leftStr==null || rightStr==null)
+ {
+ throw new ArgumentException();
+ }
+
+ int ll = leftStr.Length;
+ int lr = rightStr.Length;
+ if(ll==0 && lr==0)
+ {
+ return 0;
+ }
+
+ if(ll==0 || lr==0)
+ {
+ return ( (ll > 0) ? 1 : -1);
+ }
+
+ char cl,cr;
+ int i=0;
+ for(i=0; i < leftStr.Length; i++)
+ {
+ if(i==lr)
+ {
+ return 1;
+ }
+ cl = leftStr[i];
+ cr = leftStr[i];
+ if(cl==cr)
+ {
+ continue;
+ }
+ UnicodeCategory ucl = Char.GetUnicodeCategory(cl);
+ UnicodeCategory ucr = Char.GetUnicodeCategory(cr);
+ if(ucl==ucr)
+ {
+ return ( (cl > cr) ? 1 : -1 );
+ }
+ cl = Char.ToLower(cl);
+ cr = Char.ToLower(cr);
+ if(cl!=cr)
+ {
+ return ( (cl > cr) ? 1 : -1);
+ }
+ }
+ return ( (i==lr) ? 0 : -1 );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs b/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
new file mode 100644
index 00000000000..57ddd4dd632
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
@@ -0,0 +1,54 @@
+/**
+
+ * Namespace: System.Web.Util
+ * Class: WebHashCodeProvider
+ *
+
+ * Author: Gaurav Vaish
+
+ * Maintainer: gvaish@iitk.ac.in
+
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+
+ * Implementation: yes
+
+ * Status: ??%
+
+ *
+
+ * (C) Gaurav Vaish (2001)
+
+ */
+
+
+using System.Collections;
+using System.Globalization;
+
+namespace System.Web.Util
+{
+ public class WebHashCodeProvider : IHashCodeProvider
+ {
+ private static IHashCodeProvider defHcp;
+
+ public WebHashCodeProvider()
+ {
+ }
+
+ int IHashCodeProvider.GetHashCode(object key)
+ {
+ return Default.GetHashCode(key);
+ }
+
+ public static IHashCodeProvider Default
+ {
+ get
+ {
+ if(defHcp==null)
+ {
+ defHcp = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture);
+ }
+ return defHcp;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WebTrace.cs b/mcs/class/System.Web/System.Web.Util/WebTrace.cs
new file mode 100644
index 00000000000..53b96402f4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WebTrace.cs
@@ -0,0 +1,98 @@
+//
+// System.Web.Util.WebTrace
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Web.Util
+{
+ internal class WebTrace
+ {
+ static Stack ctxStack;
+ static bool trace;
+
+ static WebTrace ()
+ {
+ ctxStack = new Stack ();
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void PushContext (string context)
+ {
+ ctxStack.Push (context);
+ Trace.Indent ();
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void PopContext ()
+ {
+ if (ctxStack.Count == 0)
+ return;
+
+ Trace.Unindent ();
+ ctxStack.Pop ();
+ }
+
+ static public string Context
+ {
+ get {
+ if (ctxStack.Count == 0)
+ return "No context";
+
+ return (string) ctxStack.Peek ();
+ }
+ }
+
+ static public bool StackTrace
+ {
+ get { return trace; }
+
+ set { trace = value; }
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg)
+ {
+ Trace.WriteLine (Format (msg));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, object arg)
+ {
+ Trace.WriteLine (Format (String.Format (msg, arg)));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, object arg1, object arg2)
+ {
+ Trace.WriteLine (Format (String.Format (msg, arg1, arg2)));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, object arg1, object arg2, object arg3)
+ {
+ Trace.WriteLine (Format (String.Format (msg, arg1, arg2, arg3)));
+ }
+
+ [Conditional("WEBTRACE")]
+ static public void WriteLine (string msg, params object [] args)
+ {
+ Trace.WriteLine (Format (String.Format (msg, args)));
+ }
+
+ static string Format (string msg)
+ {
+ if (trace)
+ return String.Format ("{0}: {1}\n{2}", Context, msg, Environment.StackTrace);
+ else
+ return String.Format ("{0}: {1}", Context, msg);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.build b/mcs/class/System.Web/System.Web.build
new file mode 100644
index 00000000000..419f237efcf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.build
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Web.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Web.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/debug"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Drawing.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+ <target name="trace">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Web.dll" debug="${debug}">
+ <arg value="/d:TRACE"/>
+ <arg value="/d:WEBTRACE"/>
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/debug"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Drawing.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Web.dll" failonerror="false"/>
+ <delete file="../lib/System.Web.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Web/System.Web/.cvsignore b/mcs/class/System.Web/System.Web/.cvsignore
new file mode 100644
index 00000000000..04bc145deea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/.cvsignore
@@ -0,0 +1 @@
+_*
diff --git a/mcs/class/System.Web/System.Web/BeginEventHandler.cs b/mcs/class/System.Web/System.Web/BeginEventHandler.cs
new file mode 100644
index 00000000000..c2bd1ac2782
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/BeginEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.BeginEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public delegate IAsyncResult BeginEventHandler(object sender,
+ EventArgs e,
+ AsyncCallback cb,
+ object extraData);
+}
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog
new file mode 100644
index 00000000000..ba33cb3caf9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ChangeLog
@@ -0,0 +1,536 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: implemented CurrentExecutionFilePath.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: keep _lasterror if no context. Attach
+ application events *after* modules initialization (if not, User is not
+ set when the user handler is called).
+
+ * HttpApplicationFactory.cs: made all methods related to
+ AttachEvents static. I will fix OnStart/OnEnd for application and
+ session later.
+
+ * HttpRequest.cs: don't initialize cookies twice.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs:
+ (ApplyAppPathModifiers): return the root directory for "".
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: fixed HtmlDecode to avoid ArgumentOutOfRangeException.
+
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: added new state to handle default authentication.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: removed hack to get the User.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: fixed bug #36038. Thanks to juancri@tagnet.org for
+ reporting the bug and how to fix it.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCookie.cs: send 'expires' in the header.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpValueCollection.cs: patch from Botjan Vizin
+ <bostjan.vizin@siol.net> that implements ToString (bool).
+
+2002-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: add the context as parameter when building
+ the application Type.
+
+ * HttpCookie.cs: new internal constructor.
+ * HttpCookieCollection.cs: new internal method to make a cookie expire.
+
+ * HttpRequest.cs: MapPath fixes.
+ * HttpResponse.cs: implemented ApplyAppPathModifier.
+ * HttpRuntime.cs: fixed typo in AppDomainAppVirtualPath.
+
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: hack to create a default user when there's no one.
+ Implemented GetConfig (string).
+
+ * HttpRequest.cs: fixes to MapPath (string).
+
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: avoid nulls and exception when getting resource
+ format strings.
+
+ * StaticFileHandler.cs: added file name to error message.
+
+2002-12-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: avoid sending chunked content for HTTP/1.1.
+
+2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: get the events from the application class,
+ fire Application/Session Start/End and add the others as application
+ events.
+
+2002-11-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: compile global.asax file if it exists.
+
+2002-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: provide a default Browser until we detect it.
+ * HttpResponse.cs:
+ (End): do not close the connection here.
+ (Flush (bool)): send the headers when, for example, Redirect () is
+ called.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpException.cs: simple error output.
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: style.
+ * HttpException.cs: style.
+ * HttpRuntime.cs: only flush the response if there are no errors.
+ Otherwise, write an error output.
+ * HttpWriter.cs: change Unicode to UTF8.
+
+2002-11-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: don't begin the request using ExecuteNextAsync
+ (it fails to work on NetServ).
+
+ * HttpWorkerRequest.cs: typo.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpValueCollection.cs: the value may contain trailing '=' as it is
+ UrlEncoded. Don't split name=value based on '='.
+
+2002-11-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCookie.cs: made GetCookieHeader internal.
+
+ * HttpRequest.cs: get cookies from request.
+
+ * HttpResponse.cs: send cookies. Implemented
+ AddFileDependencies (). Added check for _Writer == null in Flush
+ (Patrik ;-). Clear the content if HEAD or SupressContent == true.
+ Removed redirect hack used in old server.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: fixed GetRawContent (). Now it only tries to read at
+ most ContentLength bytes.
+
+ * HttpResponse.cs: now it sends the headers. Added
+ X-Powered-By header :-).
+
+ * HttpRuntime.cs: fixed typo.
+
+ * HttpValueCollection.cs: cosmetic changes.
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: reenabled a few lines of code
+ (ThreadPool already fixed).
+
+ * HttpRequest.cs:
+ * HttpResponse.cs:
+ * HttpUtility.cs:
+ * HttpValueCollection.cs:
+ * HttpWriter.cs: Use WebEncoding.Encoding.
+
+2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWriter.cs: changed encoding of the writer from Unicode to UTF8.
+ This fixes sending bytes and allows mixing byte with chars.
+
+2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: implemented WriteFile methods.
+ * MimeTypes.cs: removed duplicated entries.
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: don't throw exception in a couple of
+ methods not yet implemented.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: fixed type and handle factories when creating
+ IHttpHandler for a request.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: use handlers from configuration.
+ * HttpContext.cs: get handlers from ConfigurationSettings.
+
+2002-10-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpMethodNotAllowedHandler.cs:
+ * HttpRuntime.cs:
+ * StaticFileHandler.cs: Modified file.
+
+ * HttpUtility.cs: implemented all missing methods.
+
+
+2002-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web/HttpApplication.cs: use the static file handler.
+ * System.Web/HttpForbiddenHandler.cs: handler to forbid access.
+ * System.Web/HttpMethodNotAllowedHandler.cs: handler for method not
+ allowed.
+
+ * System.Web/HttpUtility.cs: finished all UrlDecode methods.
+ * System.Web/MimeTypes.cs: map from file extension to MIME type.
+ * System.Web/StaticFileHandler.cs: serves static files
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web/HttpApplication.cs:
+ * System.Web/HttpApplicationFactory.cs:
+ * System.Web/HttpRequest.cs:
+ * System.Web/HttpRuntime.cs: we are now able to compile pages and use
+ HttpApplication, HttpRuntime and SimpleWorkerRequest.
+
+2002-09-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: added some missing methods.
+ * HttpApplicationFactory.cs: get event handlers for the application.
+ * HttpAsyncResult.cs: little fixes.
+ * HttpRequest.cs: make Encoding work even with no worker request.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWorkerRequest.cs: mcs doesn't go crazy. It's just me, that forgot
+ to add HttpMapPath to the list file...
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWorkerRequest.cs: fixes compilation with mcs. I will add a bug
+ report when i get a test case.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs:
+ * HttpCachePolicy.cs:
+ * HttpResponseHeader.cs:
+ * HttpResponseStream.cs:
+ * HttpResponseStreamProxy.cs:
+ * HttpValueCollection.cs: misc. fixes based on class status page.
+
+ * IHttpMapPath.cs: New file.
+
+ * HttpRequest.cs: implemented ContentEncoding.
+ * HttpWorkerRequest.cs: mono-stylized and implemented
+ SendResponseFromMemory.
+
+2002-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: reformatted.
+ * HttpStaticObjectsCollection.cs: implemented GetEnumertor, CopyTo and
+ the indexer.
+
+2002-08-05 Patrik Torstensson <ptorsten@hotmail.com>
+
+ * HttpApplication.cs: Implemented a state machine to allow handling of
+ HttpModules and HttpHandlers. Implementation of async handlers.
+
+ * HttpApplicationFactory.cs: Factory for creating HttpApplication
+ instances, including caching.
+
+ * HttpRuntime.cs: Usage of the new HttpApplicationFactory to get a
+ application instance to execute requests in and implementation of
+ request execution (still no request queue).
+
+ * HttpAsyncResult.cs: New file to handle async module results.
+
+ * HttpRequest.cs: Change signature of Dispose
+ * HttpResponse.cs: new internal method allowing filtering to happen
+ during the request flow in the state machine.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: events were not being initialized.
+
+2002-07-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ProcessModelInfo.cs: fixed compilation.
+
+2002-07-25 Tim Coleman <tim@timcoleman.com>
+ * ProcessModelInfo.cs:
+ New class added
+ * HttpParseException.cs:
+ * HttpCompileException.cs:
+ * HttpUnhandledException.cs:
+ Internal constructors added to these
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * ProcessInfo.cs:
+ Fix constructor, reference to shutdownreason.
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * HttpCachePolicy.cs:
+ Added stubbs to this class.
+ * HttpCacheability.cs:
+ * HttpCacheRevalidation.cs:
+ * HttpValidationStatus.cs:
+ * ProcessShutdownReason.cs:
+ * ProcessStatus.cs:
+ * TraceMode.cs:
+ Reorder the enumerations (and in some cases make
+ one-based) in order to agree with the .NET
+ implementation, based on the class status page.
+ * ProcessInfo.cs:
+ Implementation of this class.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * HttpCompileException.cs:
+ * HttpParseException.cs:
+ * HttpUnhandledException.cs:
+ New stubbs created.
+ * HttpApplication.cs:
+ * HttpBrowserCapabilities.cs:
+ Added missing methods stubbs and attributes based
+ on the class status page. Also reformatted some
+ source for consistency.
+
+2002-07-23 Tim Coleman <tim@timcoleman.com>
+ * HttpUtility.cs: Moved entities hashtable into main
+ class as a static object, so we don't instantiate
+ a new one every time. Also put the hashtable
+ building into a lock block.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * HttpUtility.cs: Cleanup of the code, implementation
+ of HtmlDecode/HtmlEncode functions
+
+2002-07-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: quick&dirty hack to make redirection work. Should
+ be out of there once we have SimpleWorkerRequest.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpUtility.cs: little typo, big headache.
+
+2002-07-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: don't throw NotImplemented in a couple of methods.
+
+2002-06-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web/HttpResponse.cs:
+
+ Fixes based on class status page:
+
+ - Add attributes (DefaultEvent, ParseChildren).
+ - Fix declarations.
+ - Explicitly implement some interfaces (IPostBackDataHandler
+ and IPostBackEventHandler).
+ - Implemented some missing methods.
+
+2002-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs:
+ (Session): return null instead of throwing an exception.
+
+ * HttpRequest.cs:
+ (HttpMethod): return RequestType if not set.
+ (GetRawContent): return QueryString if we don't have a
+ HttpWorkerRequest.
+
+ * HttpUtility.cs: fixed Decode and Encode.
+
+2002-06-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs:
+ * HttpContext.cs: added System.Web.SessionState namespace.
+
+ * HttpSessionState.cs: removed. It is under
+ System.Web.SessionState.
+
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * HttpBrowserCapabilities.cs (BackgroundSounds): Fixed typo.
+
+2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: implemented Browser property.
+
+2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpBrowserCapabilities.cs: stubbed out.
+
+2002-05-18 Miguel de Icaza <miguel@ximian.com>
+
+ * HttpRuntime.cs: Reformat file.
+
+2002-05-07 Duncan Mak <duncan@ximian.com>
+
+ * HttpBrowserCapabilities.cs: Added, replacing
+ HttpBrowserCapabilites because of typo.
+
+ * HttpBrowserCapabilites.cs: Removed, replaced by above.
+
+ * HttpRequest.cs (Browser): Fixed typo.
+
+2002-04-12 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpApplication.cs: Minor updates
+ * HttpApplicationState.cs: Ready.
+ * HttpClientCertificate.cs: Signature updates
+ * HttpValueCollection.cs: ready
+ * HttpStaticObjectsCollection.cs: ready
+ * HttpResponseHeader.cs: made internal only
+ * HttpResponse.cs: Signature updates
+ * HttpPostedFile.cs: ready
+ * HttpCacheVaryByHeaders.cs: ready (except communication to policy)
+ * HttpCacheVaryByParams.cs: ready (except communication to policy)
+
+ System.Web is now over 60% ready..
+
+2002-04-11 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpException.cs: 95% ready, only windows dependent code left
+ * HttpFileCollection.cs: Finished.
+ * HttpRequest.cs: Minor fixes and fixed signature problems
+ * HttpResponse.cs: Implementation of missing methods and signature problems
+ * HttpResponseHeader.cs: Fixed signature problems
+ * HttpRuntime.cs: Fixed signature problems
+ * HttpServerUtility.cs: Added support for HttpApplication
+ * HttpSessionState.cs: Fixed signature issues
+ * HttpUtility.cs: fixed signature issues
+ * HttpValueCollection.cs: Support for cookie parsing and fixed signature issues
+ * HttpWorkerRequest.cs: Fixed small signature issue
+ * HttpWriter.cs: Fixed signature issue
+ * HttpApplication.cs: Basic implementation
+ * HttpApplicationState.cs: Small fixes to support major change comming up
+ * HttpBrowserCapabilities.cs: Added Type method
+ * HttpClientCertificate.cs: Almost ready, needs to parse certificate.
+ * HttpContext.cs: Fixed signature issues and added last methods.
+ * HttpCookie.cs: Full implementation
+ * HttpCookieCollection.cs: Full implementation
+ * TraceContext.cs: Methods implemented.
+ * HttpPostedFile.cs: Placeholder
+ * HttpStaticObjectsCollection.cs: Placeholder
+ * HttpModuleCollection.cs: Ready, will be used during the major revamp.
+
+ * Fixed a number of other small signature problems also (class status page)
+
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpWorkerRequest.EndOfSendNotification.cs Removed (included in WorkerRequest)
+ * Checkin of all new files (noted in last changenote)
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpContext.cs: First implementation (basic support, few methods left to impl)
+ * HttpException.cs: Partial implementation (basic support)
+ * HttpHelper.cs: Header parse helper, used by runtime (non public)
+ * HttpRequest.cs: Implementation (all methods there, not all fully impl)
+ * HttpRequestStream.cs: Full implementation
+ * HttpResponse.cs: Partial implementation(almost all methods)
+ * HttpResponseHeader.cs: Header helper
+ * HttpResponseStream.cs: Full implementation - Response stream support
+ * HttpResponseStreamProxy.cs: Implementation - filter support
+ * HttpRuntime.cs: Rewrite to support one IHttpModule (use for testing the runtime)
+ * HttpServerUtility.cs: Implemented usage of HttpContext for methods
+ and moved encoding functions to HttpUtility.
+
+ * HttpUtility.cs: Added encoding/decoding functions from HttpServerUtility and
+ added the Attribute encoding functions.
+
+ * HttpValueCollection.cs: Implementation.
+ * HttpWorkerRequest.cs: Rewrite and implementation of all methods (ready)
+ * HttpWriter.cs: Implementation (with filter support)
+
+ * HttpFileCollection: Added dummy class (placeholder)
+ * HttpApplication.cs: Added dummy class (placeholder)
+ * HttpApplicationState.cs: Added dummy class (placeholder)
+ * HttpBrowserCapabilities.cs: Added dummy class (placeholder)
+ * HtttpCachePolicy.cs: Added dummy class (placeholder)
+ * HttpClientCertificate.cs: Added dummy class (placeholder)
+ * HttpSessionState.cs: Added dummy class (placeholder)
+ * TraceContext.cs: Added dummy class (placeholder)
+
+
+2002/04/10 Nick Drochak <ndrochak@gol.com>
+
+ * HttpServerUtility.cs: Fix build breaker.
+
+2002-03-28 Wictor Wilén <wictor@iBizkit.se>
+
+ * HttpServerUtils.cs : Added some more functionality
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * HttpServerUtils.cs (UrlDecode): You cannot implicitly cast a
+ char to a string, use ToString() instead.
+
+2002-03-16 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * WebCategoryAttribute.cs
+ : Added private attribute.
+
+2002-03-16 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * HttpRuntime.cs : Stubbed methods for
+ FormatStringResource(...) in agreement with the various
+ overloads available at String.Format(...)
+
+2002-01-08 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * TODOAttribute.cs : Added, as an internal class to the assembly
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * HttpRuntime.cs: remove uneeded exception variable from catch and
+ initialize remaining instance members to avoid compile warnings
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * HttpRuntime.cs: fix spelling error/variable name change.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * HttpRuntime.cs : Initial implementation
+
+2001-08-29 Bob Smith <bob@thestuff.net>
+
+ * HttpWorkerRequest.cs: Partial Implementation.
+
+2001-08-16 Bob Smith <bob@thestuff.net>
+
+ * HttpCookieCollection.cs, HttpCookie.cs: Bug fixes.
+
+2001-08-09 Bob Smith <bob@thestuff.net>
+
+ * BeginEventHandler.cs: Implemented.
+ * EndEventHandler.cs: Implemented.
+ * HttpCacheability.cs: Implemented.
+ * HttpCacheRevalidation.cs: Implemented.
+ * HttpCacheValidateHandler.cs: Implemented.
+ * HttpCookieCollection.cs: Implemented.
+ * HttpCookie.cs: Implemented.
+ * HttpValidationStatus.cs: Implemented.
+ * HttpWorkerRequest.EndOfSendNotification.cs: Implemented.
+ * IHttpAsyncHandler.cs: Implemented.
+ * IHttpHandler.cs: Implemented.
+ * IHttpHandlerFactory.cs: Implemented.
+ * IHttpModule.cs: Implemented.
+ * ProcessShutdownReason.cs: Implemented.
+ * ProcessStatus.cs: Implemented.
+ * TraceMode.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web/EndEventHandler.cs b/mcs/class/System.Web/System.Web/EndEventHandler.cs
new file mode 100644
index 00000000000..cd7a51c222a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/EndEventHandler.cs
@@ -0,0 +1,13 @@
+//
+// System.Web.EndEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public delegate void EndEventHandler(IAsyncResult ar);
+}
diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs
new file mode 100644
index 00000000000..044e1d1c7ac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplication.cs
@@ -0,0 +1,1037 @@
+//
+// System.Web.HttpApplication
+//
+// Authors:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Threading;
+using System.Security.Principal;
+using System.Runtime.Remoting.Messaging;
+using System.Web.UI;
+using System.Web.Configuration;
+using System.Web.SessionState;
+
+namespace System.Web
+{
+
+ [ToolboxItem(true)]
+ public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable
+ {
+
+#region Event Handlers
+
+ // Async event holders
+ AsyncEvents _acquireRequestStateAsync;
+ AsyncEvents _authenticateRequestAsync;
+ AsyncEvents _endRequestAsync;
+ AsyncEvents _beginRequestAsync;
+ AsyncEvents _authorizeRequestAsync;
+ AsyncEvents _updateRequestCacheAsync;
+ AsyncEvents _resolveRequestCacheAsync;
+ AsyncEvents _releaseRequestStateAsync;
+ AsyncEvents _preRequestHandlerExecuteAsync;
+ AsyncEvents _postRequestHandlerExecuteAsync;
+
+ // ID objects used to indentify the event
+ static object AcquireRequestStateId = new Object ();
+ static object AuthenticateRequestId = new Object ();
+ static object DefaultAuthenticationId = new Object ();
+ static object EndRequestId = new Object ();
+ static object DisposedId = new Object ();
+ static object BeginRequestId = new Object ();
+ static object AuthorizeRequestId = new Object ();
+ static object UpdateRequestCacheId = new Object ();
+ static object ResolveRequestCacheId = new Object ();
+ static object ReleaseRequestStateId = new Object ();
+ static object PreSendRequestContentId = new Object ();
+ static object PreSendRequestHeadersId = new Object ();
+ static object PreRequestHandlerExecuteId = new Object ();
+ static object PostRequestHandlerExecuteId = new Object ();
+ static object ErrorId = new Object ();
+
+ // List of events
+ private EventHandlerList _Events;
+
+ public event EventHandler AcquireRequestState {
+ add { Events.AddHandler (AcquireRequestStateId, value); }
+ remove { Events.RemoveHandler (AcquireRequestStateId, value); }
+ }
+
+ public event EventHandler AuthenticateRequest {
+ add { Events.AddHandler (AuthenticateRequestId, value); }
+ remove { Events.RemoveHandler (AuthenticateRequestId, value); }
+ }
+
+ public event EventHandler AuthorizeRequest {
+ add { Events.AddHandler (AuthorizeRequestId, value); }
+ remove { Events.RemoveHandler (AuthorizeRequestId, value); }
+ }
+
+ public event EventHandler BeginRequest {
+ add { Events.AddHandler (BeginRequestId, value); }
+ remove { Events.RemoveHandler (BeginRequestId, value); }
+ }
+
+ public event EventHandler Disposed {
+ add { Events.AddHandler (DisposedId, value); }
+ remove { Events.RemoveHandler (DisposedId, value); }
+ }
+
+ public event EventHandler EndRequest {
+ add { Events.AddHandler (EndRequestId, value); }
+ remove { Events.RemoveHandler (EndRequestId, value); }
+ }
+
+ public event EventHandler Error {
+ add { Events.AddHandler (ErrorId, value); }
+ remove { Events.RemoveHandler (ErrorId, value); }
+ }
+
+ public event EventHandler PostRequestHandlerExecute {
+ add { Events.AddHandler (PostRequestHandlerExecuteId, value); }
+ remove { Events.RemoveHandler (PostRequestHandlerExecuteId, value); }
+ }
+
+ public event EventHandler PreRequestHandlerExecute {
+ add { Events.AddHandler (PreRequestHandlerExecuteId, value); }
+ remove { Events.RemoveHandler (PreRequestHandlerExecuteId, value); }
+ }
+
+ public event EventHandler PreSendRequestContent {
+ add { Events.AddHandler (PreSendRequestContentId, value); }
+ remove { Events.RemoveHandler (PreSendRequestContentId, value); }
+ }
+
+ public event EventHandler ReleaseRequestState {
+ add { Events.AddHandler (ReleaseRequestStateId, value); }
+ remove { Events.RemoveHandler (ReleaseRequestStateId, value); }
+ }
+
+ public event EventHandler ResolveRequestCache
+ {
+ add { Events.AddHandler (ResolveRequestCacheId, value); }
+ remove { Events.RemoveHandler (ResolveRequestCacheId, value); }
+ }
+
+ public event EventHandler UpdateRequestCache {
+ add { Events.AddHandler (UpdateRequestCacheId, value); }
+ remove { Events.RemoveHandler (UpdateRequestCacheId, value); }
+ }
+
+ public event EventHandler PreSendRequestHeaders {
+ add { Events.AddHandler (PreSendRequestHeadersId, value); }
+ remove { Events.RemoveHandler (PreSendRequestHeadersId, value); }
+ }
+
+ internal event EventHandler DefaultAuthentication {
+ add { Events.AddHandler (DefaultAuthenticationId, value); }
+ remove { Events.RemoveHandler (DefaultAuthenticationId, value); }
+ }
+
+ public void AddOnAcquireRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _acquireRequestStateAsync)
+ _acquireRequestStateAsync = new AsyncEvents ();
+
+ _acquireRequestStateAsync.Add (beg, end);
+ }
+
+ public void AddOnAuthenticateRequestAsync(BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _authenticateRequestAsync)
+ _authenticateRequestAsync = new AsyncEvents ();
+
+ _authenticateRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnAuthorizeRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _authorizeRequestAsync)
+ _authorizeRequestAsync = new AsyncEvents ();
+
+ _authorizeRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnBeginRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _beginRequestAsync)
+ _beginRequestAsync = new AsyncEvents ();
+
+ _beginRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnEndRequestAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _endRequestAsync)
+ _endRequestAsync = new AsyncEvents ();
+
+ _endRequestAsync.Add (beg, end);
+ }
+
+ public void AddOnPostRequestHandlerExecuteAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _postRequestHandlerExecuteAsync)
+ _postRequestHandlerExecuteAsync = new AsyncEvents ();
+
+ _postRequestHandlerExecuteAsync.Add (beg, end);
+ }
+
+ public void AddOnPreRequestHandlerExecuteAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _preRequestHandlerExecuteAsync)
+ _preRequestHandlerExecuteAsync = new AsyncEvents ();
+
+ _preRequestHandlerExecuteAsync.Add (beg, end);
+ }
+
+ public void AddOnReleaseRequestStateAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _releaseRequestStateAsync)
+ _releaseRequestStateAsync = new AsyncEvents ();
+
+ _releaseRequestStateAsync.Add (beg, end);
+ }
+
+ public void AddOnResolveRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _resolveRequestCacheAsync)
+ _resolveRequestCacheAsync = new AsyncEvents ();
+
+ _resolveRequestCacheAsync.Add (beg, end);
+ }
+
+ public void AddOnUpdateRequestCacheAsync (BeginEventHandler beg, EndEventHandler end)
+ {
+ if (null == _updateRequestCacheAsync)
+ _updateRequestCacheAsync = new AsyncEvents ();
+
+ _updateRequestCacheAsync.Add (beg, end);
+ }
+
+#endregion
+
+#region State Machine
+
+ interface IStateHandler
+ {
+ void Execute();
+ bool CompletedSynchronously { get; }
+ bool PossibleToTimeout { get; }
+ }
+
+ class EventState : IStateHandler
+ {
+ HttpApplication _app;
+ EventHandler _event;
+
+ public EventState (HttpApplication app, EventHandler evt)
+ {
+ _app = app;
+ _event = evt;
+ }
+
+ public void Execute ()
+ {
+ if (null != _event)
+ _event (_app, EventArgs.Empty);
+ }
+
+ public bool CompletedSynchronously {
+ get { return true; }
+ }
+
+ public bool PossibleToTimeout {
+ get { return true; }
+ }
+ }
+
+ class AsyncEventState : IStateHandler
+ {
+ HttpApplication _app;
+ BeginEventHandler _begin;
+ EndEventHandler _end;
+ AsyncCallback _callback;
+ bool _async;
+
+ public AsyncEventState (HttpApplication app,
+ BeginEventHandler begin,
+ EndEventHandler end)
+ {
+ _async = false;
+ _app = app;
+ _begin = begin;
+ _end = end;
+ _callback = new AsyncCallback (OnAsyncReady);
+ }
+
+ public void Execute ()
+ {
+ _async = true;
+ IAsyncResult ar = _begin (_app, EventArgs.Empty, _callback, null);
+ if (ar.CompletedSynchronously) {
+ _async = false;
+ _end (ar);
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get { return !_async; }
+ }
+
+ public bool PossibleToTimeout {
+ get {
+ // We can't cancel a async event
+ return false;
+ }
+ }
+
+ private void OnAsyncReady (IAsyncResult ar)
+ {
+ if (ar.CompletedSynchronously)
+ return;
+
+ Exception error = null;
+
+ try {
+ // Invoke end handler
+ _end(ar);
+ } catch (Exception exc) {
+ // Flow this error to the next state (handle during state execution)
+ error = exc;
+ }
+
+ _app._state.ExecuteNextAsync (error);
+ }
+ }
+
+ class AsyncEvents
+ {
+ ArrayList _events;
+ class EventRecord {
+ public EventRecord(BeginEventHandler beg, EndEventHandler end)
+ {
+ Begin = beg;
+ End = end;
+ }
+
+ public BeginEventHandler Begin;
+ public EndEventHandler End;
+ }
+
+ public AsyncEvents ()
+ {
+ _events = new ArrayList ();
+ }
+
+ public void Add (BeginEventHandler begin, EndEventHandler end)
+ {
+ _events.Add (new EventRecord (begin, end));
+ }
+
+ public void GetAsStates (HttpApplication app, ArrayList states)
+ {
+ foreach (object obj in _events)
+ states.Add (new AsyncEventState (app,
+ ((EventRecord) obj).Begin,
+ ((EventRecord) obj).End));
+ }
+ }
+
+
+ class ExecuteHandlerState : IStateHandler
+ {
+ HttpApplication _app;
+ AsyncCallback _callback;
+ IHttpAsyncHandler _handler;
+ bool _async;
+
+ public ExecuteHandlerState (HttpApplication app)
+ {
+ _app = app;
+ _callback = new AsyncCallback (OnAsyncReady);
+ }
+
+ private void OnAsyncReady (IAsyncResult ar)
+ {
+ if (ar.CompletedSynchronously)
+ return;
+
+ Exception error = null;
+
+ try {
+ // Invoke end handler
+ _handler.EndProcessRequest(ar);
+ } catch (Exception exc) {
+ // Flow this error to the next state (handle during state execution)
+ error = exc;
+ }
+
+ _handler = null;
+ _app._state.ExecuteNextAsync (error);
+ }
+
+ public void Execute ()
+ {
+ IHttpHandler handler = _app.Context.Handler;
+ if (handler == null)
+ return;
+
+ // Check if we can execute async
+ if (handler is IHttpAsyncHandler) {
+ _async = true;
+ _handler = (IHttpAsyncHandler) handler;
+
+ IAsyncResult ar = _handler.BeginProcessRequest (_app.Context,
+ _callback,
+ null);
+
+ if (ar.CompletedSynchronously) {
+ _async = false;
+ _handler = null;
+ ((IHttpAsyncHandler) handler).EndProcessRequest (ar);
+ }
+ } else {
+ _async = false;
+
+ // Sync handler
+ handler.ProcessRequest (_app.Context);
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get { return !_async; }
+ }
+
+ public bool PossibleToTimeout {
+ get {
+ if (_app.Context.Handler is IHttpAsyncHandler)
+ return false;
+
+ return true;
+ }
+ }
+ }
+
+ class CreateHandlerState : IStateHandler
+ {
+ HttpApplication _app;
+
+ public CreateHandlerState (HttpApplication app)
+ {
+ _app = app;
+ }
+
+ public void Execute ()
+ {
+ _app.Context.Handler = _app.CreateHttpHandler ( _app.Context,
+ _app.Request.RequestType,
+ _app.Request.FilePath,
+ _app.Request.PhysicalPath);
+ }
+
+ public bool CompletedSynchronously {
+ get { return true; }
+ }
+
+ public bool PossibleToTimeout {
+ get { return false; }
+ }
+ }
+
+ class FilterHandlerState : IStateHandler
+ {
+ HttpApplication _app;
+
+ public FilterHandlerState (HttpApplication app)
+ {
+ _app = app;
+ }
+
+ public void Execute ()
+ {
+ _app.Context.Response.DoFilter ();
+ }
+
+ public bool CompletedSynchronously {
+ get { return true; }
+ }
+
+ public bool PossibleToTimeout {
+ get { return true; }
+ }
+ }
+
+ class StateMachine
+ {
+ HttpApplication _app;
+ WaitCallback _asynchandler;
+
+ IStateHandler [] _handlers;
+ int _currentStateIdx;
+ int _endStateIdx;
+ int _countSteps;
+ int _countSyncSteps;
+
+ // Helper to create the states for a normal event
+ private void GetAsStates (object Event, ArrayList states)
+ {
+ // Get list of clients for the sync events
+ Delegate evnt = _app.Events [Event];
+ if (evnt == null)
+ return;
+
+ System.Delegate [] clients = evnt.GetInvocationList();
+ foreach (Delegate client in clients)
+ states.Add (new EventState (_app, (EventHandler) client));
+ }
+
+ internal StateMachine (HttpApplication app)
+ {
+ _app = app;
+ }
+
+ internal void Init ()
+ {
+ _asynchandler = new WaitCallback (OnAsyncCallback);
+
+ // Create a arraylist of states to execute
+ ArrayList states = new ArrayList ();
+
+ // BeginRequest
+ if (null != _app._beginRequestAsync)
+ _app._beginRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.BeginRequestId, states);
+
+ // AuthenticateRequest
+ if (null != _app._authenticateRequestAsync)
+ _app._authenticateRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.AuthenticateRequestId, states);
+
+ // DefaultAuthentication
+ EventHandler defaultAuthHandler = (EventHandler) _app.Events [HttpApplication.DefaultAuthenticationId];
+ states.Add (new EventState (_app, defaultAuthHandler));
+
+ // AuthorizeRequest
+ if (null != _app._authorizeRequestAsync)
+ _app._authorizeRequestAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.AuthorizeRequestId, states);
+
+ // ResolveRequestCache
+ if (null != _app._resolveRequestCacheAsync)
+ _app._resolveRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.ResolveRequestCacheId, states);
+
+ // [A handler (a page corresponding to the request URL) is created at this point.]
+ states.Add (new CreateHandlerState (_app));
+
+ // AcquireRequestState
+ if (null != _app._acquireRequestStateAsync)
+ _app._acquireRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.AcquireRequestStateId, states);
+
+ // PreRequestHandlerExecute
+ if (null != _app._preRequestHandlerExecuteAsync)
+ _app._preRequestHandlerExecuteAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PreRequestHandlerExecuteId, states);
+
+ // [The handler is executed.]
+ states.Add (new ExecuteHandlerState (_app));
+
+ // PostRequestHandlerExecute
+ if (null != _app._postRequestHandlerExecuteAsync)
+ _app._postRequestHandlerExecuteAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.PostRequestHandlerExecuteId, states);
+
+ // ReleaseRequestState
+ if (null != _app._releaseRequestStateAsync)
+ _app._releaseRequestStateAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.ReleaseRequestStateId, states);
+
+ // [Response filters, if any, filter the output.]
+ states.Add (new FilterHandlerState (_app));
+
+ // UpdateRequestCache
+ if (null != _app._updateRequestCacheAsync)
+ _app._updateRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.UpdateRequestCacheId, states);
+
+ // EndRequest
+ if (null != _app._updateRequestCacheAsync)
+ _app._updateRequestCacheAsync.GetAsStates (_app, states);
+ GetAsStates (HttpApplication.EndRequestId, states);
+
+ // Make list ready to execute
+ _handlers = new IStateHandler [states.Count];
+ states.CopyTo (_handlers);
+ }
+
+
+ internal void Reset ()
+ {
+ _countSyncSteps = 0;
+ _countSteps = 0;
+ _currentStateIdx = -1;
+ _endStateIdx = _handlers.Length - 1;
+ }
+
+ internal void Start ()
+ {
+ Reset ();
+ ExecuteNextAsync (null);
+ }
+
+ internal void ExecuteNextAsync (Exception lasterror)
+ {
+ if (!Thread.CurrentThread.IsThreadPoolThread)
+ ThreadPool.QueueUserWorkItem (_asynchandler, lasterror);
+ else
+ ExecuteNext (lasterror);
+ }
+
+ internal void ExecuteNext (Exception lasterror)
+ {
+ bool ready_sync = false;
+ IStateHandler handler;
+
+ lock (_app) {
+ _app.OnStateExecuteEnter ();
+ try {
+ do {
+ if (null != lasterror) {
+ _app.HandleError (lasterror);
+ lasterror = null;
+ }
+
+ // Check if request flow is to be stopped
+ if (_app._CompleteRequest)
+ _currentStateIdx = _endStateIdx;
+
+ // Get next state handler
+ if (_currentStateIdx < _endStateIdx) {
+ _currentStateIdx++;
+ handler = _handlers [_currentStateIdx];
+
+ _countSteps++;
+ lasterror = ExecuteState (handler,
+ ref ready_sync);
+
+ if (ready_sync)
+ _countSyncSteps++;
+ }
+ } while (ready_sync && _currentStateIdx < _endStateIdx);
+ } finally {
+ _app.OnStateExecuteLeave ();
+ }
+ }
+
+ // Finish the request off..
+ if (_currentStateIdx == _endStateIdx) {
+ _app._asyncWebResult.Complete ((_countSyncSteps == _countSteps),
+ null,
+ null);
+
+ _app.Context.Handler = null;
+ _app.Context.ApplicationInstance = null;
+ _app.RecycleHandlers ();
+ _app._asyncWebResult = null;
+
+ HttpApplicationFactory.RecycleInstance (_app);
+ }
+ }
+
+ private void OnAsyncCallback (object obj)
+ {
+ ExecuteNext ((Exception) obj);
+ }
+
+ [MonoTODO()]
+ private Exception ExecuteState (IStateHandler state, ref bool readysync)
+ {
+ Exception lasterror = null;
+ try {
+
+ if (state.PossibleToTimeout) {
+ // TODO: Start timeout possible
+ try {
+ state.Execute ();
+ } finally {
+ // TODO: end timeout possible
+ }
+
+ // Check if we have a timeout and wait for the exception.
+ } else {
+ state.Execute ();
+ }
+
+ if (state.CompletedSynchronously)
+ readysync = true;
+ else
+ readysync = false;
+
+ } catch (ThreadAbortException obj) {
+ obj = obj;
+ // TODO!
+ // handle request timeout and return timeout httpexception
+ } catch (Exception obj) {
+ lasterror = obj;
+ }
+
+ return lasterror;
+ }
+ }
+
+#endregion
+
+#region Fields
+
+ StateMachine _state;
+
+ bool _CompleteRequest;
+ HttpContext _Context;
+ Exception _lastError;
+
+ HttpContext _savedContext;
+ IPrincipal _savedUser;
+ HttpAsyncResult _asyncWebResult;
+
+ ISite _Site;
+ HttpModuleCollection _ModuleCollection;
+ HttpSessionState _Session;
+ HttpApplicationState _appState;
+
+ bool _InPreRequestResponseMode;
+#endregion
+
+#region Constructor
+
+ public HttpApplication ()
+ {
+ }
+
+#endregion
+
+#region Methods
+ private IHttpHandler CreateHttpHandler (HttpContext context,
+ string type,
+ string file,
+ string path)
+ {
+ HandlerFactoryConfiguration handler =
+ HttpContext.GetAppConfig ("system.web/httpHandlers")
+ as HandlerFactoryConfiguration;
+
+ if (handler == null)
+ throw new HttpException ("Cannot get system.web/httpHandlers handler.");
+
+ object result = handler.FindHandler (type, path).Create ();
+ if (result is IHttpHandler)
+ return (IHttpHandler) result;
+
+ if (result is IHttpHandlerFactory) {
+ IHttpHandlerFactory factory = (IHttpHandlerFactory) result;
+ return factory.GetHandler (context, type, file, path);
+ }
+
+ return null;
+ }
+
+ [MonoTODO()]
+ internal void RecycleHandlers ()
+ {
+ // TODO: Recycle the created handlers (via factory?)
+ }
+
+ internal void InitModules ()
+ {
+ ModulesConfiguration modules;
+
+ modules = (ModulesConfiguration) HttpContext.GetAppConfig ("system.web/httpModules");
+ if (null == modules)
+ throw new HttpException (
+ HttpRuntime.FormatResourceString ("missing_modules_config"));
+
+ _ModuleCollection = modules.CreateCollection ();
+ if (_ModuleCollection == null)
+ return;
+
+ int pos, count;
+
+ count = _ModuleCollection.Count;
+ for (pos = 0; pos != count; pos++)
+ ((IHttpModule) _ModuleCollection.Get (pos)).Init (this);
+ }
+
+ internal void InitCulture ()
+ {
+ // TODO: Read culture info from globalization from config
+ }
+
+ internal void OnStateExecuteEnter ()
+ {
+ // TODO: Set correct culture for the thread
+ // TODO: Register in timeout manager
+
+ _savedContext = HttpContext.Context;
+ HttpContext.Context = _Context;
+
+ _savedUser = Thread.CurrentPrincipal;
+ Thread.CurrentPrincipal = Context.User;
+ }
+
+ internal void OnStateExecuteLeave ()
+ {
+ // TODO: Restore culture for the thread
+ // TODO: Remove from timeout manager
+
+ HttpContext.Context = _savedContext;
+ if (null != _savedUser) {
+ Thread.CurrentPrincipal = _savedUser;
+ _savedUser = null;
+ }
+ }
+
+ internal void ClearError ()
+ {
+ _lastError = null;
+ }
+
+ internal void HandleError (Exception obj)
+ {
+ EventHandler handler;
+ bool fire = true;
+
+ if (null != _Context) {
+ if (null != _Context.Error)
+ fire = false;
+
+ _Context.AddError (obj);
+ } else {
+ if (null != _lastError)
+ fire = false;
+
+ _lastError = obj;
+ }
+
+ if (!fire)
+ return;
+
+ // Fire OnError event here
+ handler = (EventHandler) Events [HttpApplication.ErrorId];
+ if (null != handler) {
+ try {
+ handler (this, EventArgs.Empty);
+ } catch (Exception excp) {
+ if (null != _Context)
+ _Context.AddError (excp);
+ }
+ }
+ }
+
+ [MonoTODO]
+ internal void Startup (HttpContext context, HttpApplicationState state)
+ {
+ // TODO: Need to attach methods in global.asax to correct events
+ _Context = context;
+
+ _appState = state;
+ _state = new StateMachine (this);
+
+ // Initialize all IHttpModule(s)
+ InitModules ();
+ HttpApplicationFactory.AttachEvents (this);
+
+ // Initialize custom application
+ _InPreRequestResponseMode = true;
+ try {
+ Init ();
+ } catch (Exception obj) {
+ HandleError (obj);
+ }
+
+ _InPreRequestResponseMode = false;
+
+ _state.Init ();
+ }
+
+ internal void Cleanup ()
+ {
+ try {
+ Dispose ();
+ } catch (Exception obj) {
+ HandleError (obj);
+ }
+
+ if (null != _ModuleCollection) {
+ int pos;
+ int count = _ModuleCollection.Count;
+
+ for (pos = 0; pos != count; pos++)
+ ((IHttpModule) _ModuleCollection.Get (pos)).Dispose ();
+
+ _ModuleCollection = null;
+ }
+
+ _state = null;
+ }
+
+ public void CompleteRequest ()
+ {
+ _CompleteRequest = true;
+ }
+
+ public virtual void Dispose ()
+ {
+ _Site = null;
+ EventHandler disposed = (EventHandler) Events [HttpApplication.DisposedId];
+ if (null != disposed)
+ disposed (this, EventArgs.Empty);
+ }
+
+ public virtual void Init ()
+ {
+ }
+
+ public virtual string GetVaryByCustomString (HttpContext context, string custom)
+ {
+ if (custom.ToLower () == "browser")
+ return context.Request.Browser.Type;
+
+ return null;
+ }
+
+ IAsyncResult IHttpAsyncHandler.BeginProcessRequest (HttpContext context,
+ AsyncCallback cb,
+ object extraData)
+ {
+ _Context = context;
+ Context.ApplicationInstance = this;
+ _CompleteRequest = false;
+
+ _asyncWebResult = new HttpAsyncResult (cb, extraData);
+
+ _state.Reset ();
+ _state.ExecuteNext (null);
+
+ return _asyncWebResult;
+ }
+
+ void IHttpAsyncHandler.EndProcessRequest (IAsyncResult result)
+ {
+ HttpAsyncResult ar = (HttpAsyncResult) result;
+
+ if (null != ar.Error)
+ throw ar.Error;
+ }
+
+ void IHttpHandler.ProcessRequest (HttpContext context)
+ {
+ throw new NotSupportedException (HttpRuntime.FormatResourceString("sync_not_supported"));
+ }
+
+ bool IHttpHandler.IsReusable {
+ get { return true; }
+ }
+#endregion
+
+#region Properties
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpApplicationState Application {
+ get { return HttpApplicationFactory.ApplicationState; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpContext Context {
+ get { return _Context; }
+ }
+
+ protected EventHandlerList Events {
+ get {
+ if (null == _Events)
+ _Events = new EventHandlerList ();
+
+ return _Events;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpModuleCollection Modules {
+ get {
+ if (null == _ModuleCollection)
+ _ModuleCollection = new HttpModuleCollection ();
+
+ return _ModuleCollection;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpRequest Request {
+ get {
+ if (null != _Context && (!_InPreRequestResponseMode))
+ return _Context.Request;
+
+ throw new HttpException ("Can't get request object");
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpResponse Response {
+ get {
+ if (null != _Context && (!_InPreRequestResponseMode))
+ return _Context.Response;
+
+ throw new HttpException ("Can't get response object");
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpServerUtility Server {
+ get {
+ if (null != _Context)
+ return _Context.Server;
+
+ return new HttpServerUtility (this);
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public HttpSessionState Session {
+ get {
+ if (null != _Session)
+ return _Session;
+
+ if (null != _Context && null != _Context.Session)
+ return _Context.Session;
+
+ throw new HttpException ("Failed to get session object");
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public IPrincipal User {
+ get { return _Context.User; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public ISite Site {
+ get { return _Site; }
+ set { _Site = value; }
+ }
+#endregion Properties
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
new file mode 100644
index 00000000000..c290aae5789
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
@@ -0,0 +1,321 @@
+//
+// System.Web.HttpApplicationFactory
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Web;
+using System.Web.Compilation;
+using System.Web.SessionState;
+
+namespace System.Web {
+ /// <summary>
+ /// TODO: We need to compile the global.asax into a type inherited from HttpApplication
+ /// </summary>
+ [MonoTODO]
+ class HttpApplicationFactory {
+ private string _appFilename;
+ private Type _appType;
+
+ private bool _appInitialized;
+ private bool _appFiredEnd;
+
+ private Stack _appFreePublicList;
+ private int _appFreePublicInstances;
+ static private int _appMaxFreePublicInstances = 32;
+
+ private HttpApplicationState _state;
+ static Hashtable appEventNames;
+
+ static IHttpHandler custApplication;
+
+ static private HttpApplicationFactory s_Factory = new HttpApplicationFactory();
+
+ static HttpApplicationFactory ()
+ {
+ appEventNames = new Hashtable ();
+ appEventNames.Add ("Application_BeginRequest", null);
+ appEventNames.Add ("Application_AuthenticateRequest", null);
+ appEventNames.Add ("Application_AuthorizeRequest", null);
+ appEventNames.Add ("Application_ResolveRequestCache", null);
+ appEventNames.Add ("Application_AcquireRequestState", null);
+ appEventNames.Add ("Application_PreRequestHandlerExecute", null);
+ appEventNames.Add ("Application_PostRequestHandlerExecute", null);
+ appEventNames.Add ("Application_ReleaseRequestState", null);
+ appEventNames.Add ("Application_UpdateRequestCache", null);
+ appEventNames.Add ("Application_EndRequest", null);
+ appEventNames.Add ("Application_PreSendRequestHeaders", null);
+ appEventNames.Add ("Application_PreSendRequestContent", null);
+ appEventNames.Add ("Application_Disposed", null);
+ appEventNames.Add ("Application_Error", null);
+ }
+
+ public HttpApplicationFactory() {
+ _appInitialized = false;
+ _appFiredEnd = false;
+
+ _appFreePublicList = new Stack();
+ _appFreePublicInstances = 0;
+ }
+
+ static private string GetAppFilename(HttpContext context) {
+ return Path.Combine(context.Request.PhysicalApplicationPath, "global.asax");
+ }
+
+ private void CompileApp(HttpContext context) {
+ if (File.Exists(_appFilename)) {
+ // Setup filemonitor for all filedepend also. CacheDependency?
+
+ _appType = GlobalAsaxCompiler.CompileApplicationType (_appFilename, context);
+ if (_appType == null)
+ throw new ApplicationException ("Error compiling application file (global.asax).");
+ } else {
+ _appType = typeof (System.Web.HttpApplication);
+ _state = new HttpApplicationState ();
+ }
+ }
+
+ static bool IsEventHandler (MethodInfo m)
+ {
+ if (m.ReturnType != typeof (void))
+ return false;
+
+ ParameterInfo [] pi = m.GetParameters ();
+ if (pi.Length != 2)
+ return false;
+
+ if (pi [0].ParameterType != typeof (object) ||
+ pi [1].ParameterType != typeof (EventArgs))
+ return false;
+
+ return appEventNames.ContainsKey (m.Name);
+ }
+
+ static void AddEvent (MethodInfo method, Hashtable appTypeEventHandlers)
+ {
+ string name = method.Name;
+ ArrayList list;
+ list = appTypeEventHandlers [name] as ArrayList;
+ if (list == null) {
+ list = new ArrayList ();
+ appTypeEventHandlers [name] = list;
+ }
+ list.Add (method);
+ }
+
+ static Hashtable GetApplicationTypeEvents (HttpApplication app)
+ {
+ Type appType = app.GetType ();
+ Hashtable appTypeEventHandlers = new Hashtable ();
+ ArrayList evtMethods = new ArrayList ();
+ BindingFlags flags = BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Instance |
+ BindingFlags.Static;
+
+ MethodInfo [] methods = appType.GetMethods (flags);
+ foreach (MethodInfo m in methods) {
+ if (IsEventHandler (m))
+ AddEvent (m, appTypeEventHandlers);
+ }
+
+ Type baseType = appType.BaseType;
+ if (baseType == typeof (HttpApplication))
+ return appTypeEventHandlers;
+
+ flags = BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
+
+ methods = appType.GetMethods (flags);
+ foreach (MethodInfo m in methods) {
+ if (IsEventHandler (m))
+ AddEvent (m, appTypeEventHandlers);
+ }
+
+ return appTypeEventHandlers;
+ }
+
+ void FireEvents (string method_name, object state_context, object [] args)
+ {
+ /*
+ if (methods == null || methods.Count == 0)
+ return;
+
+ foreach (MethodInfo method in methods)
+ method.Invoke (this, args);
+ */
+ }
+
+ void FireOnAppStart (HttpContext context)
+ {
+ FireEvents ("Application_OnStart", context, new object [] {this, EventArgs.Empty});
+ }
+
+ void FireOnAppEnd ()
+ {
+ FireEvents ("Application_OnEnd", null, new object [] {this, EventArgs.Empty});
+ }
+
+ void FireOnSessionStart (HttpSessionState state, object source, EventArgs args)
+ {
+ FireEvents ("Session_OnStart", state, new object [] {source, args});
+ }
+
+ void FireOnSessionEnd (HttpSessionState state, object source, EventArgs args)
+ {
+ FireEvents ("Session_OnEnd", state, new object [] {source, args});
+ }
+
+ private void InitializeFactory(HttpContext context) {
+ // TODO: Should we be impersonating here? We are reading a app file.. security issue?
+
+ _appFilename = GetAppFilename(context);
+
+ CompileApp(context);
+ FireOnAppStart(context);
+ }
+
+ private void Dispose() {
+ ArrayList torelease = new ArrayList();
+ lock (_appFreePublicList) {
+ do {
+ torelease.Add(_appFreePublicList.Pop());
+ } while (_appFreePublicList.Count > 0);
+ }
+
+ if (torelease.Count > 0) {
+ foreach (Object obj in torelease) {
+ ((HttpApplication) obj).Cleanup();
+ }
+ }
+
+ if (!_appFiredEnd) {
+ lock (this) {
+ if (!_appFiredEnd) {
+ FireOnAppEnd();
+ _appFiredEnd = true;
+ }
+ }
+ }
+ }
+
+ internal static IHttpHandler GetInstance(HttpContext context)
+ {
+ if (custApplication != null)
+ return custApplication;
+
+ if (!s_Factory._appInitialized) {
+ lock (s_Factory) {
+ if (!s_Factory._appInitialized) {
+ s_Factory.InitializeFactory(context);
+ s_Factory._appInitialized = true;
+ }
+ }
+ }
+
+ return s_Factory.GetPublicInstance(context);
+ }
+
+ internal static void RecycleInstance(HttpApplication app) {
+ if (!s_Factory._appInitialized)
+ throw new InvalidOperationException("Factory not intialized");
+
+ s_Factory.RecyclePublicInstance(app);
+ }
+
+ internal static void AttachEvents (HttpApplication app)
+ {
+ Type appType = app.GetType ();
+ Hashtable appTypeEventHandlers = GetApplicationTypeEvents (app);
+ foreach (string key in appTypeEventHandlers.Keys) {
+ if (key == "Application_OnStart" || key == "Application_OnEnd" ||
+ key == "Session_OnStart" || key == "Session_OnEnd")
+ continue;
+
+ int pos = key.IndexOf ('_');
+ if (pos == -1 || key.Length <= pos + 1)
+ continue;
+
+ EventInfo evt = appType.GetEvent (key.Substring (pos + 1));
+ if (evt == null)
+ continue;
+
+ ArrayList list = appTypeEventHandlers [key] as ArrayList;
+ if (list == null || list.Count == 0)
+ continue;
+
+ foreach (MethodInfo method in list)
+ evt.AddEventHandler (app, Delegate.CreateDelegate (typeof (EventHandler), method));
+ }
+ }
+
+ private IHttpHandler GetPublicInstance(HttpContext context) {
+ HttpApplication app = null;
+
+ lock (_appFreePublicList) {
+ if (_appFreePublicInstances > 0) {
+ app = (HttpApplication) _appFreePublicList.Pop();
+ _appFreePublicInstances--;
+ }
+ }
+
+ if (app == null) {
+ // Create non-public object
+ app = (HttpApplication) HttpRuntime.CreateInternalObject(_appType);
+
+ app.Startup(context, HttpApplicationFactory.ApplicationState);
+ }
+
+ return (IHttpHandler) app;
+ }
+
+ internal void RecyclePublicInstance(HttpApplication app) {
+ lock (_appFreePublicList) {
+ if (_appFreePublicInstances < _appMaxFreePublicInstances) {
+ _appFreePublicList.Push(app);
+ _appFreePublicInstances++;
+
+ app = null;
+ }
+ }
+
+ if (app != null) {
+ app.Cleanup();
+ }
+ }
+
+ static internal HttpApplicationState ApplicationState {
+ get {
+ if (null == s_Factory._state) {
+ s_Factory._state = new HttpApplicationState();
+ }
+
+ return s_Factory._state;
+ }
+ }
+
+ internal static void EndApplication() {
+ s_Factory.Dispose();
+ }
+
+ internal static void StartSession(HttpSessionState state, object source, EventArgs args) {
+ s_Factory.FireOnSessionStart(state, source, args);
+ }
+
+ static void EndSession(HttpSessionState state, object source, EventArgs args) {
+ s_Factory.FireOnSessionEnd(state, source, args);
+ }
+
+ public static void SetCustomApplication (IHttpHandler customApplication)
+ {
+ custApplication = customApplication;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationState.cs b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
new file mode 100644
index 00000000000..6131f07c776
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
@@ -0,0 +1,232 @@
+//
+// System.Web.HttpApplicationState
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Threading;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+
+ [MonoTODO("Performance - Use SWMR lock here")]
+ public sealed class HttpApplicationState : NameObjectCollectionBase {
+ private HttpStaticObjectsCollection _AppObjects;
+ private HttpStaticObjectsCollection _SessionObjects;
+
+ // TODO : Change to ReadWriteLock when ready
+ private Mutex _Lock;
+
+ private void LockRead() {
+ Monitor.Enter(this);
+ }
+
+ private void LockWrite() {
+ Monitor.Enter(this);
+ }
+
+ private void UnlockRead() {
+ Monitor.Exit(this);
+ }
+
+ private void UnlockWrite() {
+ Monitor.Exit(this);
+ }
+
+ internal HttpApplicationState() {
+ _AppObjects = new HttpStaticObjectsCollection();
+ _SessionObjects = new HttpStaticObjectsCollection();
+ _Lock = new Mutex();
+ }
+
+ internal HttpApplicationState(HttpStaticObjectsCollection AppObj, HttpStaticObjectsCollection SessionObj) {
+ if (null != AppObj) {
+ _AppObjects = AppObj;
+ } else {
+ _AppObjects = new HttpStaticObjectsCollection();
+ }
+
+ if (null != SessionObj) {
+ _SessionObjects = SessionObj;
+ } else {
+ _SessionObjects = new HttpStaticObjectsCollection();
+ }
+ _Lock = new Mutex();
+ }
+
+ public void Add(string name, object value) {
+
+ LockWrite();
+ try {
+ BaseAdd(name, value);
+ }
+ finally {
+ UnlockWrite();
+ }
+ }
+
+ public void Clear() {
+
+ LockWrite();
+ try {
+ BaseClear();
+ }
+ finally {
+ UnlockWrite();
+ }
+ }
+
+ public object Get(string name) {
+ object ret = null;
+
+ LockRead();
+ try {
+ ret = BaseGet(name);
+ }
+ finally {
+ UnlockRead();
+ }
+
+ return ret;
+ }
+
+ public object Get(int index) {
+ object ret = null;
+
+ LockRead();
+ try {
+ ret = BaseGet(index);
+ }
+ finally {
+ UnlockRead();
+ }
+
+ return ret;
+ }
+
+ public string GetKey(int index) {
+ string ret = null;
+
+ LockRead();
+ try {
+ ret = BaseGetKey(index);
+ }
+ finally {
+ UnlockRead();
+ }
+
+ return ret;
+ }
+
+ public void Lock() {
+ LockWrite();
+ }
+
+ public void Remove(string name) {
+ LockWrite();
+ try {
+ BaseRemove(name);
+ }
+ finally {
+ UnlockWrite();
+ }
+ }
+
+ public void RemoveAll() {
+ Clear();
+ }
+
+ public void RemoveAt(int index) {
+ LockWrite();
+ try {
+ BaseRemoveAt(index);
+ }
+ finally {
+ UnlockWrite();
+ }
+ }
+
+ public void Set(string name, object value) {
+ LockWrite();
+ try {
+ BaseSet(name, value);
+ }
+ finally {
+ UnlockWrite();
+ }
+ }
+
+ public void UnLock() {
+ UnlockWrite();
+ }
+
+ public string [] AllKeys {
+ get {
+ string [] ret = null;
+
+ LockRead();
+ try {
+ ret = BaseGetAllKeys();
+ }
+ finally {
+ UnlockRead();
+ }
+
+ return ret;
+ }
+ }
+
+ public HttpApplicationState Contents {
+ get {
+ return this;
+ }
+ }
+
+ override public int Count {
+ get {
+ int ret = 0;
+
+ LockRead();
+ try {
+ ret = base.Count;
+ }
+ finally {
+ UnlockRead();
+ }
+
+ return ret;
+ }
+ }
+
+ public object this[string name] {
+ get {
+ return Get(name);
+ }
+ set {
+ Set(name, value);
+ }
+ }
+
+ public object this[int index] {
+ get {
+ return Get(index);
+ }
+ }
+
+ // ASP Session based objects
+ internal HttpStaticObjectsCollection SessionObjects {
+ get {
+ return _SessionObjects;
+ }
+ }
+
+ // ASP App based objects
+ public HttpStaticObjectsCollection StaticObjects {
+ get {
+ return _AppObjects;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpAsyncResult.cs b/mcs/class/System.Web/System.Web/HttpAsyncResult.cs
new file mode 100644
index 00000000000..87340a616b4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpAsyncResult.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.HttpAsyncResult
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+//
+using System;
+using System.Threading;
+
+namespace System.Web
+{
+ internal class HttpAsyncResult : IAsyncResult
+ {
+ private object _result;
+ private object _asyncState;
+ private AsyncCallback _callback;
+ private Exception _error;
+
+ private bool _ready;
+ private bool _readySync;
+
+ internal HttpAsyncResult(AsyncCallback callback, object state) {
+ _callback = callback;
+ _asyncState = state;
+ }
+
+ internal void Complete(bool sync, object result, Exception error) {
+ _ready = true;
+ _readySync = sync;
+ _result = result;
+ _error = error;
+ if (null != _callback) {
+ _callback(this);
+ }
+ }
+
+ internal Exception Error {
+ get {
+ return null;
+ }
+ }
+
+ public object AsyncState {
+ get {
+ return _asyncState;
+ }
+ }
+
+ public object AsyncObject {
+ get {
+ return null;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ get {
+ return null;
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get {
+ return _readySync;
+ }
+ }
+
+ public bool IsCompleted {
+ get {
+ return _ready;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs b/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs
new file mode 100755
index 00000000000..a4c095c7f6d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpBrowserCapabilities.cs
@@ -0,0 +1,143 @@
+//
+// System.Web.HttpBrowserCapabilities
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+using System;
+using System.Web.Configuration;
+
+namespace System.Web {
+public class HttpBrowserCapabilities : HttpCapabilitiesBase
+{
+ public HttpBrowserCapabilities()
+ {
+ }
+
+ public bool ActiveXControls {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public bool AOL {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public bool BackgroundSounds {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public bool Beta {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public string Browser {
+ get { return "Not Implemented"; }
+ }
+
+ [MonoTODO()]
+ public bool CDF {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public Version ClrVersion {
+ get { return new Version (0, 0); }
+ }
+
+ [MonoTODO()]
+ public bool Cookies {
+ get { return true; }
+ }
+
+ [MonoTODO()]
+ public bool Crawler {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public Version EcmaScriptVersion {
+ get { return new Version (0, 0); }
+ }
+
+ [MonoTODO()]
+ public bool Frames {
+ get { return true; }
+ }
+
+ [MonoTODO()]
+ public bool JavaApplets {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public bool JavaScript {
+ get { return true; }
+ }
+
+ [MonoTODO()]
+ public int MajorVersion {
+ get { return 0; }
+ }
+
+ [MonoTODO()]
+ public double MinorVersion {
+ get { return 0.0; }
+ }
+
+ [MonoTODO()]
+ public Version MSDomVersion {
+ get { return new Version (0, 0); }
+ }
+
+ [MonoTODO()]
+ public string Platform {
+ get { return "mono::"; }
+ }
+
+ [MonoTODO()]
+ public bool Tables {
+ get { return true; }
+ }
+
+ [MonoTODO()]
+ public Type TagWriter {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO()]
+ public string Type {
+ get { return "4"; }
+ }
+
+ [MonoTODO()]
+ public bool VBScript {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public string Version {
+ get { return "4.0"; }
+ }
+
+ [MonoTODO()]
+ public Version W3CDomVersion {
+ get { return new Version (0, 0); }
+ }
+
+ [MonoTODO()]
+ public bool Win16 {
+ get { return false; }
+ }
+
+ [MonoTODO()]
+ public bool Win32 {
+ get { return true; }
+ }
+
+}
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCachePolicy.cs b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
new file mode 100644
index 00000000000..d3a6cf445cb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
@@ -0,0 +1,148 @@
+//
+// System.Web.HttpCachePolicy
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+using System;
+
+namespace System.Web {
+ public sealed class HttpCachePolicy {
+
+ internal HttpCachePolicy ()
+ {
+ }
+
+ #region Fields
+
+ HttpCacheVaryByHeaders varyByHeaders;
+ HttpCacheVaryByParams varyByParams;
+
+ #endregion
+
+ #region Properties
+
+ public HttpCacheVaryByHeaders VaryByHeaders {
+ get { return varyByHeaders; }
+ }
+
+ public HttpCacheVaryByParams VaryByParams {
+ get { return varyByParams; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void AddValidationCallback (HttpCacheValidateHandler handler, object data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AppendCacheExtension (string extension)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetCacheability (HttpCacheability cacheability)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetCacheability (HttpCacheability cacheability, string field)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetETag (string etag)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetETagFromFileDependencies ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetExpires (DateTime date)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetLastModified (DateTime date)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetLastModifiedFromFileDependencies ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetMaxAge (TimeSpan date)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetNoServerCaching ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetNoStore ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetNoTransforms ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetProxyMaxAge (TimeSpan delta)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetRevalidation (HttpCacheRevalidation revalidation)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetSlidingExpiration (bool slide)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetValidUntilExpires (bool validUntilExpires)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetVaryByCustom (string custom)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs b/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs
new file mode 100644
index 00000000000..dfe83e605b1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs
@@ -0,0 +1,17 @@
+//
+// System.Web.HttpCacheRevalidation.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum HttpCacheRevalidation {
+ AllCaches = 0x1,
+ ProxyCaches,
+ None,
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs b/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs
new file mode 100644
index 00000000000..032aea39f6f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.HttpCacheValidateHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public delegate void HttpCacheValidateHandler(
+ HttpContext context,
+ object data,
+ ref HttpValidationStatus validationStatus);
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
new file mode 100644
index 00000000000..93ee07a0afe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
@@ -0,0 +1,110 @@
+//
+// System.Web.HttpCacheVaryByHeaders
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpCacheVaryByHeaders {
+ private Hashtable _Items;
+ private bool _Dirty;
+ private bool _Wildcard;
+
+ // TODO: We need internal methods here to communicate with CachePolicy
+
+ internal HttpCacheVaryByHeaders() {
+ }
+
+ public void VaryByUnspecifiedParameters() {
+ _Dirty = true;
+ _Wildcard = true;
+ _Items = null;
+ }
+
+ public bool AcceptTypes {
+ get {
+ return this["Accept"];
+ }
+
+ set {
+ this["Accept"] = value;
+ }
+ }
+
+ public bool this[string header] {
+ get {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (header == "*") {
+ return _Wildcard;
+ }
+
+ if (null != _Items) {
+ return _Items.ContainsKey(header);
+ }
+
+ return false;
+ }
+
+ set {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (!(value)) {
+ return;
+ }
+
+ _Dirty = true;
+
+ if (header == "*") {
+ VaryByUnspecifiedParameters();
+ return;
+ }
+
+ if (!_Wildcard) {
+ if (null == _Items) {
+ _Items = new Hashtable();
+ }
+
+ _Items[header] = true;
+ }
+ }
+ }
+
+ public bool UserAgent {
+ get {
+ return this["User-Agent"];
+ }
+
+ set {
+ this["User-Agent"] = value;
+ }
+ }
+
+ public bool UserCharSet {
+ get {
+ return this["Accept-Charset"];
+ }
+
+ set {
+ this["Accept-Charset"] = value;
+ }
+ }
+
+ public bool UserLanguage {
+ get {
+ return this["Accept-Language"];
+ }
+
+ set {
+ this["Accept-Language"] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
new file mode 100644
index 00000000000..057ae081d7e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.HttpCacheVaryByParams
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpCacheVaryByParams {
+ private Hashtable _Items;
+ private bool _IgnoreParams;
+ private bool _Wildcard;
+ private bool _Dirty;
+
+ // TODO: We need internal methods here to communicate with CachePolicy
+
+ internal HttpCacheVaryByParams() {
+ }
+
+ public bool IgnoreParams {
+ get {
+ return _IgnoreParams;
+ }
+
+ set {
+ if (_Wildcard || null != _Items) {
+ return;
+ }
+
+ _Dirty = true;
+ _IgnoreParams = value;
+ }
+ }
+
+ public bool this[string header] {
+ get {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (header == "*") {
+ return _Wildcard;
+ }
+
+ if (null != _Items) {
+ return _Items.ContainsKey(header);
+ }
+
+ return false;
+ }
+
+ set {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (!(value)) {
+ return;
+ }
+
+ _Dirty = true;
+
+ if (header == "*") {
+ _Wildcard = true;
+ _Items = null;
+ return;
+ }
+
+ if (!_Wildcard) {
+ if (null == _Items) {
+ _Items = new Hashtable();
+ }
+
+ _Items[header] = true;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheability.cs b/mcs/class/System.Web/System.Web/HttpCacheability.cs
new file mode 100644
index 00000000000..448996473c4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheability.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.HttpCacheability.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum HttpCacheability {
+ NoCache = 0x1,
+ Private,
+ Server,
+ Public,
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpClientCertificate.cs b/mcs/class/System.Web/System.Web/HttpClientCertificate.cs
new file mode 100644
index 00000000000..4ffc12c0cd8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpClientCertificate.cs
@@ -0,0 +1,147 @@
+//
+// System.Web.HttpClientCertificate
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ [MonoTODO()]
+ public class HttpClientCertificate : NameValueCollection {
+ private HttpContext _Context;
+ private byte [] _BinaryIssuer;
+ private int _CertEncoding;
+ private byte [] _Certificate;
+ private string _Cookie;
+ private int _Flags;
+ private string _Issuer;
+ private int _KeySize;
+ private byte [] _PublicKey;
+ private int _SecretKeySize;
+ private string _SerialNumber;
+ private string _ServerIssuer;
+ private string _ServerSubject;
+ private string _Subject;
+
+ private DateTime _ValidFrom;
+ private DateTime _ValidTo;
+
+ [MonoTODO("Decode ceritificate from Server variables.. CGI standard?")]
+ internal HttpClientCertificate(HttpContext Context) {
+ _Context = Context;
+ _Flags = 0;
+ }
+
+ public byte [] BinaryIssuer {
+ get {
+ return _BinaryIssuer;
+ }
+ }
+
+ public int CertEncoding {
+ get {
+ return _CertEncoding;
+ }
+ }
+
+ public byte [] Certificate {
+ get {
+ return _Certificate;
+ }
+ }
+
+ public string Cookie {
+ get {
+ return _Cookie;
+ }
+ }
+
+ public int Flags {
+ get {
+ return _Flags;
+ }
+ }
+
+ [MonoTODO()]
+ public bool IsPresent {
+ get {
+ return false;
+ }
+ }
+
+ public string Issuer {
+ get {
+ return _Issuer;
+ }
+ }
+
+ [MonoTODO()]
+ public bool IsValid {
+ get {
+ return false;
+ }
+ }
+
+ public int KeySize {
+ get {
+ return _KeySize;
+ }
+ }
+
+ public byte [] PublicKey {
+ get {
+ return _PublicKey;
+ }
+ }
+
+ public int SecretKeySize {
+ get {
+ return _SecretKeySize;
+ }
+ }
+
+ public string SerialNumber {
+ get {
+ return _SerialNumber;
+ }
+ }
+
+ public string ServerIssuer {
+ get {
+ return _ServerIssuer;
+ }
+ }
+
+ public string ServerSubject {
+ get {
+ return _ServerSubject;
+ }
+ }
+
+ public string Subject {
+ get {
+ return _Subject;
+ }
+ }
+
+ public DateTime ValidFrom {
+ get {
+ return _ValidFrom;
+ }
+ }
+
+ public DateTime ValidUntil {
+ get {
+ return ValidUntil;
+ }
+ }
+
+ [MonoTODO()]
+ public override string Get(string s) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCompileException.cs b/mcs/class/System.Web/System.Web/HttpCompileException.cs
new file mode 100644
index 00000000000..d320ea4a631
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCompileException.cs
@@ -0,0 +1,45 @@
+//
+// System.Web.HttpCompileException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom.Compiler;
+
+namespace System.Web {
+ public sealed class HttpCompileException : HttpException {
+
+ #region Fields
+
+ CompilerResults results;
+ string sourceCode;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal HttpCompileException (CompilerResults results, string sourceCode)
+ : base ()
+ {
+ this.results = results;
+ this.sourceCode = sourceCode;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public CompilerResults Results {
+ get { return results; }
+ }
+
+ public string SourceCode {
+ get { return sourceCode; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs
new file mode 100644
index 00000000000..a776acd5e14
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpContext.cs
@@ -0,0 +1,299 @@
+//
+// System.Web.HttpContext
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Security.Principal;
+using System.Web.Caching;
+using System.Web.Configuration;
+using System.Web.SessionState;
+using System.Threading;
+
+namespace System.Web
+{
+ public sealed class HttpContext : IServiceProvider
+ {
+ private ArrayList _arrExceptions;
+
+ private HttpResponse _oResponse;
+ private HttpRequest _oRequest;
+ private HttpServerUtility _Server;
+ private HttpApplication _oApplication;
+ private HttpWorkerRequest _oWorkerRequest;
+ private IHttpHandler _Handler;
+ private IHttpAsyncHandler _AsyncHandler;
+ private IPrincipal _User;
+
+ private bool _skipauth;
+ private Hashtable _oItems;
+ private DateTime _oTimestamp;
+
+ public HttpContext (HttpRequest Request, HttpResponse Response)
+ {
+ Context = this;
+
+ _arrExceptions = null;
+ _oItems = null;
+ _oTimestamp = DateTime.Now;
+ _oRequest = Request;
+ _oResponse = Response;
+ }
+
+ public HttpContext (HttpWorkerRequest WorkerRequest)
+ {
+ Context = this;
+
+ _arrExceptions = null;
+ _oItems = null;
+ _oTimestamp = DateTime.Now;
+ _oRequest = new HttpRequest (WorkerRequest, this);
+ _oResponse = new HttpResponse (WorkerRequest, this);
+ _oWorkerRequest = WorkerRequest;
+ }
+
+ internal HttpWorkerRequest WorkerRequest
+ {
+ get {
+ return _oWorkerRequest;
+ }
+ }
+
+ [MonoTODO("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")]
+ internal static HttpContext Context
+ {
+ get {
+ return (HttpContext) Thread.GetData (Thread.GetNamedDataSlot ("Context"));
+ }
+
+ set {
+ Thread.SetData (Thread.GetNamedDataSlot ("Context"), value);
+ }
+ }
+
+ public Exception [] AllErrors
+ {
+ get {
+ if (_arrExceptions == null || _arrExceptions.Count == 0)
+ return null;
+
+ return (Exception []) _arrExceptions.ToArray (typeof (Exception));;
+ }
+ }
+
+ public HttpApplicationState Application
+ {
+ get {
+ return HttpApplicationFactory.ApplicationState;
+ }
+ }
+
+ public HttpApplication ApplicationInstance
+ {
+ get {
+ return _oApplication;
+ }
+ set {
+ _oApplication = value;
+ }
+ }
+
+ public Cache Cache
+ {
+ get {
+ return HttpRuntime.Cache;
+ }
+ }
+
+ public static HttpContext Current
+ {
+ get {
+ return Context;
+ }
+ }
+
+ public Exception Error
+ {
+ get {
+ if (_arrExceptions == null || _arrExceptions.Count == 0)
+ return null;
+
+ return (Exception) _arrExceptions [0];
+ }
+ }
+
+ public IHttpHandler Handler
+ {
+ get {
+ return _Handler;
+ }
+
+ set {
+ _Handler = value;
+ }
+ }
+
+ internal IHttpAsyncHandler AsyncHandler
+ {
+ get {
+ return _AsyncHandler;
+ }
+
+ set {
+ _AsyncHandler = value;
+ }
+ }
+
+ [MonoTODO("bool IsCustomErrorEnabled")]
+ public bool IsCustomErrorEnabled
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO("bool IsDebuggingEnabled")]
+ public bool IsDebuggingEnabled
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public IDictionary Items
+ {
+ get {
+ if (_oItems == null)
+ _oItems = new Hashtable ();
+
+ return _oItems;
+ }
+ }
+
+ public HttpRequest Request
+ {
+ get {
+ return _oRequest;
+ }
+ }
+
+ public HttpResponse Response
+ {
+ get {
+ return _oResponse;
+ }
+ }
+
+ public HttpServerUtility Server
+ {
+ get {
+ if (null == _Server)
+ _Server = new HttpServerUtility (this);
+
+ return _Server;
+ }
+ }
+
+ public HttpSessionState Session
+ {
+ get {
+ return (HttpSessionState) Items ["sessionstate"];
+ }
+ }
+
+ public bool SkipAuthorization
+ {
+ get {
+ return _skipauth;
+ }
+
+ set {
+ _skipauth = value;
+ }
+ }
+
+ public DateTime Timestamp
+ {
+ get {
+ return _oTimestamp;
+ }
+ }
+
+ [MonoTODO("TraceContext Trace")]
+ public TraceContext Trace
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public IPrincipal User
+ {
+ get {
+ return _User;
+ }
+ set {
+ _User = value;
+ }
+ }
+
+ public void AddError (Exception errorInfo)
+ {
+ if (_arrExceptions == null)
+ _arrExceptions = new ArrayList ();
+
+ _arrExceptions.Add (errorInfo);
+ }
+
+ public void ClearError ()
+ {
+ _arrExceptions = null;
+ }
+
+ public object GetConfig (string name)
+ {
+ return ConfigurationSettings.GetConfig (name);
+ }
+
+ public static object GetAppConfig (string name)
+ {
+ return ConfigurationSettings.GetConfig (name);
+ }
+
+ object IServiceProvider.GetService (Type service)
+ {
+ if (service == typeof (HttpWorkerRequest))
+ return _oWorkerRequest;
+
+ if (service == typeof (HttpRequest))
+ return Request;
+
+ if (service == typeof (HttpResponse))
+ return Response;
+
+ if (service == typeof (HttpApplication))
+ return ApplicationInstance;
+
+ if (service == typeof (HttpApplicationState))
+ return Application;
+
+ if (service == typeof (HttpSessionState))
+ return Session;
+
+ if (service == typeof (HttpServerUtility))
+ return Server;
+
+ return null;
+ }
+
+ [MonoTODO("void RewritePath(string path)")]
+ public void RewritePath (string Path)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCookie.cs b/mcs/class/System.Web/System.Web/HttpCookie.cs
new file mode 100644
index 00000000000..507244a1976
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookie.cs
@@ -0,0 +1,183 @@
+//
+// System.Web.HttpCookie
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Text;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web
+{
+ public sealed class HttpCookie
+ {
+ string _Name;
+ string _Value;
+ string _Domain;
+ DateTime _Expires;
+ bool _ExpiresSet;
+ string _Path;
+ bool _Secure = false;
+
+ HttpValueCollection _Values;
+
+ internal HttpCookie ()
+ {
+ _Path = "/";
+ }
+
+ public HttpCookie (string name)
+ {
+ _Path = "/";
+ _Name = name;
+ }
+
+ public HttpCookie (string name, string value)
+ {
+ _Name = name;
+ _Value = value;
+ _Path = "/";
+ }
+
+ internal HttpCookie (string name, string value, string path, DateTime expires)
+ {
+ _Name = name;
+ _Value = value;
+ _Path = path;
+ if (expires != DateTime.MinValue)
+ Expires = expires;
+ }
+
+ internal HttpResponseHeader GetCookieHeader ()
+ {
+ StringBuilder oSetCookie = new StringBuilder ();
+
+ if (null != _Name && _Name.Length > 0) {
+ oSetCookie.Append (_Name);
+ oSetCookie.Append ("=");
+ }
+
+ if (null != _Values) {
+ oSetCookie.Append (_Values.ToString (false));
+ } else if (null != _Value) {
+ oSetCookie.Append (_Value);
+ }
+
+ if (null != _Domain && _Domain.Length > 0) {
+ oSetCookie.Append ("; domain=");
+ oSetCookie.Append (_Domain);
+ }
+
+ if (null != _Path && Path.Length > 0) {
+ oSetCookie.Append ("; path=");
+ oSetCookie.Append (_Path);
+ }
+
+ if (_ExpiresSet && _Expires != DateTime.MinValue) {
+ oSetCookie.Append ("; expires=");
+ oSetCookie.Append (_Expires.ToUniversalTime ().ToString ("ddd, dd-MMM-yyyy HH':'mm':'ss '+0000'"));
+ }
+
+ if (_Secure)
+ oSetCookie.Append ("; secure");
+
+ return new HttpResponseHeader (HttpWorkerRequest.HeaderSetCookie, oSetCookie.ToString());
+ }
+
+ public string Domain
+ {
+ get { return _Domain; }
+ set { _Domain = value; }
+ }
+
+ public DateTime Expires
+ {
+ get {
+ if (!_ExpiresSet)
+ return DateTime.MinValue;
+
+ return _Expires;
+ }
+
+ set {
+ _ExpiresSet = true;
+ _Expires = value;
+ }
+ }
+
+ public bool HasKeys
+ {
+ get {
+ return Values.HasKeys ();
+ }
+ }
+
+ public string this [string key]
+ {
+ get { return Values [key]; }
+ set { Values [key] = value; }
+ }
+
+ public string Name
+ {
+ get { return _Name; }
+ set { _Name = value; }
+ }
+
+ public string Path
+ {
+ get { return _Path; }
+ set { _Path = value; }
+ }
+
+ public bool Secure
+ {
+ get { return _Secure; }
+ set { _Secure = value; }
+ }
+
+ public string Value
+ {
+ get {
+ if (null != _Values)
+ return _Values.ToString (false);
+
+ return _Value;
+ }
+
+ set {
+ if (null != _Values) {
+ _Values.Reset ();
+ _Values.Add (null, value);
+ return;
+ }
+
+ _Value = value;
+ }
+ }
+
+ public NameValueCollection Values
+ {
+ get {
+ if (null == _Values) {
+ _Values = new HttpValueCollection ();
+ if (null != _Value) {
+ // Do we have multiple keys
+ if (_Value.IndexOf ("&") >= 0 || _Value.IndexOf ("=") >= 0) {
+ _Values.FillFromCookieString (_Value);
+ } else {
+ _Values.Add (null, _Value);
+ }
+
+ _Value = null;
+ }
+ }
+
+ return _Values;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCookieCollection.cs b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
new file mode 100644
index 00000000000..e9872411813
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
@@ -0,0 +1,147 @@
+//
+// System.Web.HttpCookieCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (First impl Bob Smith <bob@thestuff.net>)
+//
+
+using System;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web
+{
+ public sealed class HttpCookieCollection : NameObjectCollectionBase
+ {
+ HttpCookie [] _AllCookies;
+ string [] _AllKeys;
+
+ HttpResponse _Response;
+
+ internal HttpCookieCollection(HttpResponse Response, bool ReadOnly) : base()
+ {
+ _Response = Response;
+ IsReadOnly = ReadOnly;
+ }
+
+ public HttpCookieCollection () { }
+
+ public string [] AllKeys
+ {
+ get {
+ if (null == _AllKeys)
+ _AllKeys = BaseGetAllKeys ();
+
+ return _AllKeys;
+ }
+ }
+
+ public HttpCookie this [int index]
+ {
+ get { return Get (index); }
+ }
+
+ public HttpCookie this [string name]
+ {
+ get { return Get (name); }
+ }
+
+ public void Add (HttpCookie cookie)
+ {
+ if (null != _Response)
+ _Response.GoingToChangeCookieColl ();
+
+ // empy performance cache
+ _AllCookies = null;
+ _AllKeys = null;
+
+ BaseAdd (cookie.Name, cookie);
+
+ if (null != _Response)
+ _Response.OnCookieAdd (cookie);
+ }
+
+ public void Clear ()
+ {
+ _AllCookies = null;
+ _AllKeys = null;
+ BaseClear ();
+ }
+
+ public void CopyTo (Array dest, int index)
+ {
+ if (null == _AllCookies) {
+ _AllCookies = new HttpCookie [Count];
+
+ for (int i = 0; i != Count; i++)
+ _AllCookies [i] = Get (i);
+ }
+
+ _AllCookies.CopyTo (dest, index);
+ }
+
+ public HttpCookie Get (int index)
+ {
+ return BaseGet (index) as HttpCookie;
+ }
+
+ public HttpCookie Get (string name)
+ {
+ HttpCookie oRet = BaseGet (name) as HttpCookie;
+ if (null == oRet && _Response != null) {
+ _AllCookies = null;
+ _AllKeys = null;
+
+ _Response.GoingToChangeCookieColl ();
+
+ oRet = new HttpCookie (name);
+ BaseAdd (name, oRet);
+
+ _Response.OnCookieAdd (oRet);
+ }
+
+ return oRet;
+ }
+
+ public string GetKey (int index)
+ {
+ return BaseGetKey (index);
+ }
+
+ public void Remove (string name)
+ {
+ if (null != _Response)
+ _Response.GoingToChangeCookieColl ();
+
+ _AllCookies = null;
+ _AllKeys = null;
+ BaseRemove (name);
+
+ if (null != _Response)
+ _Response.ChangedCookieColl ();
+ }
+
+ public void Set (HttpCookie cookie)
+ {
+ if (null != _Response)
+ _Response.GoingToChangeCookieColl ();
+
+ _AllCookies = null;
+ _AllKeys = null;
+ BaseSet (cookie.Name, cookie);
+
+ if (null != _Response)
+ _Response.ChangedCookieColl();
+ }
+
+ internal void MakeCookieExpire (string name, string path)
+ {
+ DateTime expirationTime = new DateTime (1999, 10, 12); // This is the date MS sends!
+ HttpCookie willExpire = new HttpCookie (name, String.Empty, path, expirationTime);
+ Remove (name);
+ Add (willExpire);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpException.cs b/mcs/class/System.Web/System.Web/HttpException.cs
new file mode 100644
index 00000000000..e94b325c0f5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpException.cs
@@ -0,0 +1,86 @@
+//
+// System.Web.HttpException
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Text;
+//using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Web.Util;
+
+namespace System.Web
+{
+ public class HttpException : ExternalException
+ {
+ int _HttpCode;
+ int _HR;
+
+ public HttpException () : base ()
+ {
+ }
+
+ public HttpException (string sMessage) : base (sMessage)
+ {
+ }
+
+ public HttpException (string sMessage, Exception InnerException)
+ : base (sMessage, InnerException)
+ {
+ }
+
+ public HttpException (int iHttpCode, string sMessage) : base (sMessage)
+ {
+ _HttpCode = iHttpCode;
+ }
+
+ public HttpException (int iHttpCode, string sMessage, int iHR) : base (sMessage)
+ {
+ _HttpCode = iHttpCode;
+ _HR = iHR;
+ }
+
+ public HttpException (string sMessage, int iHR) : base (sMessage)
+ {
+ _HR = iHR;
+ }
+
+ public HttpException (int iHttpCode,
+ string sMessage,
+ Exception InnerException)
+ : base (sMessage, InnerException)
+ {
+ _HttpCode = iHttpCode;
+ }
+
+ [MonoTODO("Format messages")]
+ public string GetHtmlErrorMessage ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<html>\n<title>");
+ sb.Append (HttpUtility.HtmlEncode (Message));
+ sb.Append ("</title><body><h1>Error</h1>\n<pre>");
+ sb.Append (HttpUtility.HtmlEncode (ToString ()));
+ sb.Append ("</pre></body>\n</html>\n");
+ return sb.ToString ();
+ }
+
+ [MonoTODO("Check error type and Set the correct error code")]
+ public int GetHttpCode ()
+ {
+ return _HttpCode;
+ }
+
+/* [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static int GetLastError_internal ();*/
+
+ public static HttpException CreateFromLastError (string message)
+ {
+ WebTrace.WriteLine ("CreateFromLastError");
+ //return new HttpException (message, GetLastError_internal ());
+ return new HttpException (message, 0);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpFileCollection.cs b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
new file mode 100644
index 00000000000..423a5d4f605
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.HttpFileCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpFileCollection : NameObjectCollectionBase {
+ private HttpPostedFile [] _AllFiles;
+ private string [] _AllKeys;
+
+ internal HttpFileCollection() : base() {
+ }
+
+ internal void AddFile(string name, HttpPostedFile file) {
+ _AllFiles = null;
+ _AllKeys = null;
+
+ BaseAdd(name, file);
+ }
+
+ public void CopyTo(Array Dest, int index) {
+ if (null == _AllFiles) {
+ _AllFiles = new HttpPostedFile[Count];
+ for (int i = 0; i != Count; i++) {
+ _AllFiles[i] = Get(i);
+ }
+ }
+
+ if (null != _AllFiles) {
+ _AllFiles.CopyTo(Dest, index);
+ }
+ }
+
+ public HttpPostedFile Get(string Name) {
+ return (HttpPostedFile) BaseGet(Name);
+ }
+
+ public HttpPostedFile Get(int index) {
+ return (HttpPostedFile) BaseGet(index);
+ }
+
+ public string GetKey(int index) {
+ return BaseGetKey(index);
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _AllKeys) {
+ _AllKeys = BaseGetAllKeys();
+ }
+
+ return _AllKeys;
+ }
+ }
+
+ public HttpPostedFile this [string name] {
+ get {
+ return Get(name);
+ }
+ }
+
+ public HttpPostedFile this [int index] {
+ get {
+ return Get(index);
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs b/mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs
new file mode 100644
index 00000000000..1d45d683296
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpForbiddenHandler.cs
@@ -0,0 +1,27 @@
+//
+// System.Web.HttpForbiddenHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web
+{
+ class HttpForbiddenHandler : IHttpHandler
+ {
+ public void ProcessRequest (HttpContext context)
+ {
+ throw new HttpException (403, "Forbidden");
+ }
+
+ public bool IsReusable
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpHelper.cs b/mcs/class/System.Web/System.Web/HttpHelper.cs
new file mode 100644
index 00000000000..9798f8b3b4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpHelper.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.HttpHelper
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+
+namespace System.Web {
+ internal class HttpHelper {
+ internal static string [] ParseMultiValueHeader(string header) {
+ if (null == header) {
+ return null;
+ }
+
+ if (header.Length == 0) {
+ return null;
+ }
+
+ // Parse the , chars
+ Stack oValues = new Stack();
+
+ string sValue;
+
+ int iLastPos = -1;
+ int iPos = header.IndexOf(",");
+
+ while (iPos != -1) {
+ sValue = header.Substring(iLastPos + 1, iPos - iLastPos - 1).Trim();
+ iLastPos = iPos;
+
+ iPos = header.IndexOf(",", iPos + 1);
+ oValues.Push(sValue);
+ }
+
+ sValue = header.Substring(iLastPos + 1).Trim();
+ oValues.Push(sValue);
+
+ string [] arrValues = new string[oValues.Count];
+
+ Array.Copy(oValues.ToArray(), 0, arrValues, 0, oValues.Count);
+
+ return arrValues;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs b/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs
new file mode 100644
index 00000000000..e89a6082509
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs
@@ -0,0 +1,28 @@
+//
+// System.Web.HttpMethodNotAllowedHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web
+{
+ class HttpMethodNotAllowedHandler : IHttpHandler
+ {
+ public void ProcessRequest (HttpContext context)
+ {
+ throw new HttpException (405, "Forbidden");
+ }
+
+
+ public bool IsReusable
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpModuleCollection.cs b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
new file mode 100644
index 00000000000..c7dc329abc8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.HttpModuleCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpModuleCollection : NameObjectCollectionBase {
+ private IHttpModule [] _Modules;
+ private string [] _Keys;
+
+ internal HttpModuleCollection() : base() {
+ }
+
+ internal void AddModule(string key, IHttpModule m) {
+ _Modules = null;
+ _Keys = null;
+
+ BaseAdd(key, m);
+ }
+
+ public void CopyTo(Array dest, int index) {
+ if (null == _Modules) {
+ _Modules = new IHttpModule[Count];
+
+ for (int i = 0; i != Count; i++) {
+ _Modules[i] = Get(i);
+ }
+ }
+
+ if (null != _Modules) {
+ _Modules.CopyTo(dest, index);
+ }
+ }
+
+ public IHttpModule Get(string key) {
+ return (IHttpModule) BaseGet(key);
+ }
+
+ public IHttpModule Get(int index) {
+ return (IHttpModule) BaseGet(index);
+ }
+
+ public string GetKey(int index) {
+ return GetKey(index);
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _Keys) {
+ _Keys = BaseGetAllKeys();
+ }
+
+ return _Keys;
+ }
+ }
+
+ public IHttpModule this [string key] {
+ get {
+ return Get(key);
+ }
+ }
+
+ public IHttpModule this [int index] {
+ get {
+ return Get(index);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpParseException.cs b/mcs/class/System.Web/System.Web/HttpParseException.cs
new file mode 100644
index 00000000000..9683dc8a835
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpParseException.cs
@@ -0,0 +1,44 @@
+//
+// System.Web.HttpParseException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web {
+ public sealed class HttpParseException : HttpException {
+
+ #region Fields
+
+ string fileName;
+ int line;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO ("Figure out what to do with this.")]
+ internal HttpParseException (string message, Exception innerException, string sourceCode, string fileName, int line)
+ : base (message, innerException)
+ {
+ this.fileName = fileName;
+ this.line = line;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string FileName {
+ get { return fileName; }
+ }
+
+ public int Line {
+ get { return line; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpPostedFile.cs b/mcs/class/System.Web/System.Web/HttpPostedFile.cs
new file mode 100644
index 00000000000..02c02fc217a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpPostedFile.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.HttpPostedFile
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ public sealed class HttpPostedFile {
+ private HttpRequestStream _Stream;
+ private string _ContentType;
+ private string _FileName;
+
+ internal HttpPostedFile(string file, string type, HttpRequestStream data) {
+ _Stream = data;
+ _FileName = file;
+ _ContentType = type;
+ }
+
+ public void SaveAs(string filename) {
+ FileStream File = new FileStream(filename, FileMode.Create);
+ if (_Stream.DataLength > 0) {
+ File.Write(_Stream.Data, _Stream.DataOffset, _Stream.DataLength);
+ }
+
+ File.Flush();
+ File.Close();
+ }
+
+ public int ContentLength {
+ get {
+ return _Stream.DataLength;
+ }
+ }
+
+ public string ContentType {
+ get {
+ return _ContentType;
+ }
+ }
+
+ public string FileName {
+ get {
+ return _FileName;
+ }
+ }
+
+ public Stream InputStream {
+ get {
+ return _Stream;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs
new file mode 100644
index 00000000000..99105ce5b2f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -0,0 +1,1010 @@
+//
+// System.Web.HttpRequest
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2001, 2002 Patrick Torstensson
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web {
+ [MonoTODO("Review security in all path access function")]
+ public sealed class HttpRequest {
+ private string [] _arrAcceptTypes;
+ private string [] _arrUserLanguages;
+
+ private byte [] _arrRawContent;
+ private int _iContentLength;
+
+ private string _sContentType;
+ private string _sHttpMethod;
+ private string _sRawUrl;
+ private string _sUserAgent;
+ private string _sUserHostAddress;
+ private string _sUserHostName;
+ private string _sPath;
+ private string _sPathInfo;
+ private string _sFilePath;
+ private string _sPathTranslated;
+ private string _sQueryStringRaw;
+ private string _sRequestType;
+ private string _sRequestRootVirtualDir;
+
+ private Encoding _oContentEncoding;
+
+ private Uri _oUriReferrer;
+ private Uri _oUrl;
+
+ private int _iTotalBytes;
+
+ private HttpContext _oContext;
+
+ private HttpWorkerRequest _WorkerRequest;
+ private HttpRequestStream _oInputStream;
+ private HttpClientCertificate _ClientCert;
+
+ private HttpValueCollection _oServerVariables;
+ private HttpValueCollection _oHeaders;
+ private HttpValueCollection _oQueryString;
+ private HttpValueCollection _oFormData;
+ private HttpValueCollection _oParams;
+
+ private HttpBrowserCapabilities _browser;
+
+ private HttpCookieCollection cookies;
+ private bool rewritten;
+
+ public HttpRequest(string Filename, string Url, string Querystring) {
+ _iContentLength = -1;
+ _iTotalBytes = -1;
+
+ _WorkerRequest = null;
+ _sPathTranslated = Filename;
+ _sRequestType = "GET";
+
+ _oUrl = new Uri(Url);
+ _sPath = _oUrl.AbsolutePath;
+
+ _sQueryStringRaw = Querystring;
+ _oQueryString = new HttpValueCollection(Querystring, true, WebEncoding.Encoding);
+ }
+
+ internal HttpRequest(HttpWorkerRequest WorkRequest, HttpContext Context) {
+ _WorkerRequest = WorkRequest;
+ _oContext = Context;
+
+ _iContentLength = -1;
+ _iTotalBytes = -1;
+ }
+
+ static private string MakeServerVariableFromHeader(string header) {
+ return "HTTP_" + header.ToUpper().Replace("-", "_");
+ }
+
+ [MonoTODO("Need to support non-raw mode also..")]
+ private string GetAllHeaders(bool Raw) {
+ StringBuilder oData;
+
+ if (null == _WorkerRequest) {
+ return null;
+ }
+
+ oData = new StringBuilder(512);
+
+ string sHeaderValue;
+ string sHeaderName;
+ int iCount = 0;
+
+ // Add all know headers
+ for (; iCount != 40; iCount++) {
+ sHeaderValue = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderValue && sHeaderValue.Length > 0) {
+ sHeaderName = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderName && sHeaderName.Length > 0) {
+ oData.Append(sHeaderName);
+ oData.Append(": ");
+ oData.Append(sHeaderValue);
+ oData.Append("\r\n");
+ }
+ }
+ }
+
+ // Get all other headers
+ string [][] arrUnknownHeaders = _WorkerRequest.GetUnknownRequestHeaders();
+ if (null != arrUnknownHeaders) {
+ for (iCount = 0; iCount != arrUnknownHeaders.Length; iCount++) {
+ oData.Append(arrUnknownHeaders[iCount][0]);
+ oData.Append(": ");
+ oData.Append(arrUnknownHeaders[iCount][1]);
+ oData.Append("\r\n");
+ }
+ }
+
+ return oData.ToString();
+ }
+
+ [MonoTODO("We need to handly 'dynamic' variables like AUTH_USER, that can be changed during runtime... special collection")]
+ private void ParseServerVariables() {
+ if (null == _WorkerRequest) {
+ return;
+ }
+
+ if (_oServerVariables == null) {
+ string sTmp;
+
+ _oServerVariables = new HttpValueCollection();
+
+ _oServerVariables.Add("ALL_HTTP", GetAllHeaders(false));
+ _oServerVariables.Add("ALL_RAW", GetAllHeaders(true));
+
+ _oServerVariables.Add("APPL_MD_PATH", _WorkerRequest.GetServerVariable("APPL_MD_PATH"));
+ _oServerVariables.Add("AUTH_PASSWORD", _WorkerRequest.GetServerVariable("AUTH_PASSWORD"));
+ _oServerVariables.Add("CERT_COOKIE", _WorkerRequest.GetServerVariable("CERT_COOKIE"));
+ _oServerVariables.Add("CERT_FLAGS", _WorkerRequest.GetServerVariable("CERT_FLAGS"));
+ _oServerVariables.Add("CERT_ISSUER", _WorkerRequest.GetServerVariable("CERT_ISSUER"));
+ _oServerVariables.Add("CERT_KEYSIZE", _WorkerRequest.GetServerVariable("CERT_KEYSIZE"));
+ _oServerVariables.Add("CERT_SECRETKEYSIZE", _WorkerRequest.GetServerVariable("CERT_SECRETKEYSIZE"));
+ _oServerVariables.Add("CERT_SERIALNUMBER", _WorkerRequest.GetServerVariable("CERT_SERIALNUMBER"));
+ _oServerVariables.Add("CERT_SERVER_ISSUER", _WorkerRequest.GetServerVariable("CERT_SERVER_ISSUER"));
+ _oServerVariables.Add("CERT_SERVER_SUBJECT", _WorkerRequest.GetServerVariable("CERT_SERVER_SUBJECT"));
+ _oServerVariables.Add("CERT_SUBJECT", _WorkerRequest.GetServerVariable("CERT_SUBJECT"));
+
+ _oServerVariables.Add("GATEWAY_INTERFACE", _WorkerRequest.GetServerVariable("GATEWAY_INTERFACE"));
+ _oServerVariables.Add("HTTPS", _WorkerRequest.GetServerVariable("HTTPS"));
+ _oServerVariables.Add("HTTPS_KEYSIZE", _WorkerRequest.GetServerVariable("HTTPS_KEYSIZE"));
+ _oServerVariables.Add("HTTPS_SECRETKEYSIZE", _WorkerRequest.GetServerVariable("HTTPS_SECRETKEYSIZE"));
+
+ _oServerVariables.Add("CONTENT_TYPE", ContentType);
+ _oServerVariables.Add("HTTPS_SERVER_ISSUER", _WorkerRequest.GetServerVariable("HTTPS_SERVER_ISSUER"));
+ _oServerVariables.Add("HTTPS_SERVER_SUBJECT", _WorkerRequest.GetServerVariable("HTTPS_SERVER_SUBJECT"));
+ _oServerVariables.Add("INSTANCE_ID", _WorkerRequest.GetServerVariable("INSTANCE_ID"));
+ _oServerVariables.Add("INSTANCE_META_PATH", _WorkerRequest.GetServerVariable("INSTANCE_META_PATH"));
+ _oServerVariables.Add("LOCAL_ADDR", _WorkerRequest.GetLocalAddress());
+ _oServerVariables.Add("REMOTE_ADDR", UserHostAddress);
+ _oServerVariables.Add("REMOTE_HOST", UserHostName);
+ _oServerVariables.Add("REQUEST_METHOD", HttpMethod);
+ _oServerVariables.Add("SERVER_NAME", _WorkerRequest.GetServerName());
+ _oServerVariables.Add("SERVER_PORT", _WorkerRequest.GetLocalPort().ToString());
+ _oServerVariables.Add("SERVER_PROTOCOL", _WorkerRequest.GetHttpVersion());
+ _oServerVariables.Add("SERVER_SOFTWARE", _WorkerRequest.GetServerVariable("SERVER_SOFTWARE"));
+
+ if (_WorkerRequest.IsSecure()) {
+ _oServerVariables.Add("SERVER_PORT_SECURE", "1");
+ } else {
+ _oServerVariables.Add("SERVER_PORT_SECURE", "0");
+ }
+
+ sTmp = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength);
+ if (null != sTmp) {
+ _oServerVariables.Add("CONTENT_LENGTH", sTmp);
+ }
+
+ // TODO: Should be dynamic
+ if (null != _oContext.User && _oContext.User.Identity.IsAuthenticated) {
+ _oServerVariables.Add("AUTH_TYPE", _oContext.User.Identity.AuthenticationType);
+ _oServerVariables.Add("AUTH_USER", _oContext.User.Identity.Name);
+ } else {
+ _oServerVariables.Add("AUTH_TYPE", "");
+ _oServerVariables.Add("AUTH_USER", "");
+ }
+
+ _oServerVariables.Add("PATH_INFO", PathInfo);
+ _oServerVariables.Add("PATH_TRANSLATED", PhysicalPath);
+ _oServerVariables.Add("QUERY_STRING", QueryStringRaw);
+ _oServerVariables.Add("SCRIPT_NAME", FilePath);
+ // end dynamic
+
+ _oServerVariables.MakeReadOnly();
+ }
+ }
+
+ [MonoTODO("Handle multipart/form-data")]
+ private void ParseFormData ()
+ {
+ if (_oFormData != null)
+ return;
+
+ string contentType = ContentType;
+ if (0 != String.Compare (contentType, "application/x-www-form-urlencoded", true)) {
+ if (contentType.Length > 0)
+ Console.WriteLine ("Content-Type -> {0} not supported", contentType);
+ _oFormData = new HttpValueCollection ();
+ return;
+ }
+
+ byte [] arrData = GetRawContent ();
+ Encoding enc = ContentEncoding;
+ string data = enc.GetString (arrData);
+ _oFormData = new HttpValueCollection (data, true, enc);
+ }
+
+ [MonoTODO("void Dispose")]
+ internal void Dispose() {
+ }
+
+ private byte [] GetRawContent ()
+ {
+ if (_arrRawContent != null)
+ return _arrRawContent;
+
+ if (null == _WorkerRequest) {
+ if (QueryStringRaw == null)
+ return null;
+ char [] q = QueryStringRaw.ToCharArray ();
+ _arrRawContent = new byte [q.Length];
+ for (int i = 0; i < q.Length; i++)
+ _arrRawContent [i] = (byte) q [i];
+ return _arrRawContent;
+ }
+
+ _arrRawContent = _WorkerRequest.GetPreloadedEntityBody ();
+ if (_arrRawContent == null)
+ _arrRawContent = new byte [0];
+
+ int length = ContentLength;
+ if (_WorkerRequest.IsEntireEntityBodyIsPreloaded () || length <= _arrRawContent.Length)
+ return _arrRawContent;
+
+ byte [] arrBuffer = new byte [Math.Min (16384, length)];
+ MemoryStream ms = new MemoryStream (arrBuffer.Length);
+ ms.Write (_arrRawContent, 0, _arrRawContent.Length);
+ int read = 0;
+ for (int loaded = _arrRawContent.Length; loaded < length; loaded += read) {
+ read = _WorkerRequest.ReadEntityBody (arrBuffer, arrBuffer.Length);
+ if (read == 0)
+ break;
+
+ ms.Write (arrBuffer, 0, read);
+ }
+
+ _arrRawContent = ms.GetBuffer ();
+ return _arrRawContent;
+ }
+
+ public string [] AcceptTypes {
+ get {
+ if (null == _arrAcceptTypes && null != _WorkerRequest) {
+ _arrAcceptTypes = HttpHelper.ParseMultiValueHeader(_WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderAccept));
+ }
+
+ return _arrAcceptTypes;
+
+ }
+ }
+
+ public string ApplicationPath {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.GetAppPath();
+ }
+
+ return null;
+ }
+ }
+
+ public HttpBrowserCapabilities Browser {
+ get {
+ if (_browser == null)
+ _browser = new HttpBrowserCapabilities ();
+
+ return _browser;
+ }
+
+ set { _browser = value; }
+ }
+
+ public HttpClientCertificate ClientCertificate {
+ get {
+ if (null == _ClientCert) {
+ _ClientCert = new HttpClientCertificate(_oContext);
+ }
+
+ return _ClientCert;
+ }
+ }
+
+ private string GetValueFromHeader (string header, string attr)
+ {
+ int where = header.IndexOf (attr + '=');
+ if (where == -1)
+ return null;
+
+ where += attr.Length + 1;
+ int max = header.Length;
+ if (where >= max)
+ return String.Empty;
+
+ char ending = header [where];
+ if (ending != '"')
+ ending = ' ';
+
+ int end = header.Substring (where + 1).IndexOf (ending);
+ if (end == -1)
+ return (ending == '"') ? null : header.Substring (where);
+
+ return header.Substring (where, end);
+ }
+
+ public Encoding ContentEncoding
+ {
+ get {
+ if (_oContentEncoding == null) {
+ if (_WorkerRequest != null &&
+ (!_WorkerRequest.HasEntityBody () || ContentType != String.Empty)) {
+ _oContentEncoding = WebEncoding.Encoding;
+ } else {
+ string charset;
+ charset = GetValueFromHeader (_sContentType, "charset");
+ try {
+ _oContentEncoding = Encoding.GetEncoding (charset);
+ } catch {
+ _oContentEncoding = WebEncoding.Encoding;
+ }
+ }
+ }
+
+ return _oContentEncoding;
+ }
+
+ set {
+ _oContentEncoding = value;
+ }
+ }
+
+ public int ContentLength {
+ get {
+ if (_iContentLength == -1 && null != _WorkerRequest) {
+ string sLength = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength);
+ if (sLength != null) {
+ try {
+ _iContentLength = Int32.Parse(sLength);
+ }
+ catch(Exception) {
+ }
+ }
+ }
+
+ if (_iContentLength < 0) {
+ _iContentLength = 0;
+ }
+
+ return _iContentLength;
+ }
+ }
+
+ public string ContentType {
+ get {
+ if (null == _sContentType) {
+ if (null != _WorkerRequest) {
+ _sContentType = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentType);
+ }
+
+ if (null == _sContentType) {
+ _sContentType = string.Empty;
+ }
+ }
+
+ return _sContentType;
+ }
+ }
+
+ static private string GetCookieValue (string str, int length, ref int i)
+ {
+ if (i >= length)
+ return null;
+
+ int k = i;
+ while (k < length && Char.IsWhiteSpace (str [k]))
+ k++;
+
+ int begin = k;
+ while (k < length && str [k] != ';')
+ k++;
+
+ i = k;
+ return str.Substring (begin, i - begin).Trim ();
+ }
+
+ static private string GetCookieName (string str, int length, ref int i)
+ {
+ if (i >= length)
+ return null;
+
+ int k = i;
+ while (k < length && Char.IsWhiteSpace (str [k]))
+ k++;
+
+ int begin = k;
+ while (k < length && str [k] != ';' && str [k] != '=')
+ k++;
+
+ i = k + 1;
+ return str.Substring (begin, k - begin).Trim ();
+ }
+
+ private void GetCookies ()
+ {
+ string header = _WorkerRequest.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
+ if (header == null || header.Length == 0)
+ return;
+
+ /* RFC 2109
+ * cookie = "Cookie:" cookie-version
+ * 1*((";" | ",") cookie-value)
+ * cookie-value = NAME "=" VALUE [";" path] [";" domain]
+ * cookie-version = "$Version" "=" value
+ * NAME = attr
+ * VALUE = value
+ * path = "$Path" "=" value
+ * domain = "$Domain" "=" value
+ *
+ * MS ignores $Version!
+ * ',' as a separator produces errors.
+ */
+
+ string [] name_values = header.Trim ().Split (';');
+ int length = name_values.Length;
+ HttpCookie cookie = null;
+ int pos;
+ for (int i = 0; i < length; i++) {
+ pos = 0;
+ string name_value = name_values [i].Trim ();
+ string name = GetCookieName (name_value, name_value.Length, ref pos);
+ string value = GetCookieValue (name_value, name_value.Length, ref pos);
+ if (cookie != null) {
+ if (name == "$Path") {
+ cookie.Path = value;
+ continue;
+ } else if (name == "$Domain") {
+ cookie.Domain = value;
+ continue;
+ } else {
+ cookies.Add (cookie);
+ cookie = null;
+ }
+ }
+ cookie = new HttpCookie (name, value);
+ }
+
+ if (cookie != null)
+ cookies.Add (cookie);
+ }
+
+ public HttpCookieCollection Cookies
+ {
+ get {
+ if (cookies == null) {
+ cookies = new HttpCookieCollection (null, false);
+ if (_WorkerRequest != null)
+ GetCookies ();
+ }
+
+ return cookies;
+ }
+ }
+
+ public string CurrentExecutionFilePath {
+ get {
+ return FilePath;
+ }
+ }
+
+ public string FilePath {
+ get {
+ if (null == _sFilePath && null != _WorkerRequest) {
+ _sFilePath = _WorkerRequest.GetFilePath();
+ }
+
+ return _sFilePath;
+ }
+ }
+
+ [MonoTODO()]
+ public HttpFileCollection Files {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("Use stream filter in the request stream")]
+ public Stream Filter {
+ get {
+ throw new NotImplementedException();
+ }
+
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+
+ public NameValueCollection Form {
+ get {
+ ParseFormData();
+
+ return (NameValueCollection) _oFormData;
+ }
+ }
+
+ public NameValueCollection Headers {
+ get {
+ if (_oHeaders == null) {
+ _oHeaders = new HttpValueCollection();
+
+ if (null != _WorkerRequest) {
+ string sHeaderValue;
+ string sHeaderName;
+ int iCount = 0;
+
+ // Add all know headers
+ for (; iCount != 40; iCount++) {
+ sHeaderValue = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderValue && sHeaderValue.Length > 0) {
+ sHeaderName = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderName && sHeaderName.Length > 0) {
+ _oHeaders.Add(sHeaderName, sHeaderValue);
+ }
+ }
+ }
+
+ // Get all other headers
+ string [][] arrUnknownHeaders = _WorkerRequest.GetUnknownRequestHeaders();
+ if (null != arrUnknownHeaders) {
+ for (iCount = 0; iCount != arrUnknownHeaders.Length; iCount++) {
+ _oHeaders.Add(arrUnknownHeaders[iCount][0], arrUnknownHeaders[iCount][1]);
+ }
+ }
+ }
+
+ // Make headers read-only
+ _oHeaders.MakeReadOnly();
+ }
+
+ return (NameValueCollection) _oHeaders;
+ }
+ }
+
+ public string HttpMethod {
+ get {
+ if (null == _sHttpMethod) {
+ if (null != _WorkerRequest) {
+ _sHttpMethod = _WorkerRequest.GetHttpVerbName().ToUpper();
+ }
+
+ if (_sHttpMethod == null) {
+ if (RequestType != null)
+ _sHttpMethod = RequestType;
+ else
+ _sHttpMethod = "GET";
+ }
+ }
+
+ return _sHttpMethod;
+ }
+ }
+
+ public Stream InputStream {
+ get {
+ if (_oInputStream == null) {
+ byte [] arrInputData = GetRawContent ();
+
+ if (null != arrInputData) {
+ _oInputStream = new HttpRequestStream(arrInputData, 0, arrInputData.Length);
+ } else {
+ _oInputStream = new HttpRequestStream(null, 0, 0);
+ }
+ }
+
+ return _oInputStream;
+ }
+ }
+
+ public bool IsAuthenticated {
+ get {
+ if (_oContext != null && _oContext.User != null && _oContext.User.Identity != null) {
+ return _oContext.User.Identity.IsAuthenticated;
+ }
+
+ return false;
+ }
+ }
+
+ public bool IsSecureConnection {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.IsSecure();
+ }
+
+ return false;
+ }
+ }
+
+ [MonoTODO("Call item in querystring, form, cookie and servervariables")]
+ public string this [string sKey] {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("Add cookie collection to our Params collection via merge")]
+ public NameValueCollection Params {
+ get {
+ if (_oParams == null) {
+ _oParams = new HttpValueCollection();
+
+ _oParams.Merge(QueryString);
+ _oParams.Merge(Form);
+ _oParams.Merge(ServerVariables);
+ // TODO: Cookie
+
+ _oParams.MakeReadOnly();
+ }
+
+ return (NameValueCollection) _oParams;
+ }
+ }
+
+ public string Path {
+ get {
+ if (_sPath == null) {
+ if (null != _WorkerRequest) {
+ _sPath = _WorkerRequest.GetUriPath();
+ }
+
+ if (_sPath == null) {
+ _sPath = string.Empty;
+ }
+ }
+
+ return _sPath;
+ }
+ }
+
+ public string PathInfo {
+ get {
+ if (_sPathInfo == null) {
+ if (null != _WorkerRequest) {
+ _sPathInfo = _WorkerRequest.GetPathInfo();
+ }
+
+ if (_sPathInfo == null) {
+ _sPathInfo = string.Empty;
+ }
+ }
+
+ return _sPathInfo;
+ }
+ }
+
+ public string PhysicalApplicationPath {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.GetAppPathTranslated();
+ }
+
+ return null;
+ }
+ }
+
+ public string PhysicalPath {
+ get {
+ if (_sPathTranslated == null && _WorkerRequest != null) {
+ if (rewritten)
+ _sPathTranslated = _WorkerRequest.GetFilePathTranslated ();
+
+ if (null == _sPathTranslated)
+ _sPathTranslated = _WorkerRequest.MapPath (FilePath);
+ }
+
+ return _sPathTranslated;
+ }
+ }
+
+ public NameValueCollection QueryString {
+ get {
+ if (_oQueryString == null) {
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true,
+ WebEncoding.Encoding);
+ }
+
+ return _oQueryString;
+ }
+ }
+
+ // Used to parse the querystring
+ internal string QueryStringRaw {
+ get {
+ if (_sQueryStringRaw == null && null != _WorkerRequest) {
+ byte [] arrQuerystringBytes = _WorkerRequest.GetQueryStringRawBytes();
+ if (null != arrQuerystringBytes && arrQuerystringBytes.Length > 0) {
+ _sQueryStringRaw = ContentEncoding.GetString(arrQuerystringBytes);
+ } else {
+ _sQueryStringRaw = _WorkerRequest.GetQueryString();
+ }
+ }
+
+ if (_sQueryStringRaw == null) {
+ _sQueryStringRaw = string.Empty;
+ }
+
+ return _sQueryStringRaw;
+ }
+ }
+
+ public string RawUrl {
+ get {
+ if (null == _sRawUrl) {
+ if (null != _WorkerRequest) {
+ _sRawUrl = _WorkerRequest.GetRawUrl();
+ } else {
+ _sRawUrl = Path;
+ if (QueryStringRaw != null && QueryStringRaw.Length > 0) {
+ _sRawUrl = _sRawUrl + "?" + QueryStringRaw;
+ }
+ }
+ }
+
+ return _sRawUrl;
+ }
+ }
+
+ public string RequestType {
+ get {
+ if (null == _sRequestType) {
+ return HttpMethod;
+ }
+
+ return _sRequestType;
+ }
+
+ set {
+ _sRequestType = value;
+ }
+ }
+
+
+ public NameValueCollection ServerVariables {
+ get {
+ ParseServerVariables();
+
+ return (NameValueCollection) _oServerVariables;
+ }
+ }
+
+ public int TotalBytes {
+ get {
+ if (_iTotalBytes == -1) {
+ if (null != InputStream) {
+ _iTotalBytes = (int) InputStream.Length;
+ } else {
+ _iTotalBytes = 0;
+ }
+ }
+
+ return _iTotalBytes;
+ }
+ }
+
+ public Uri Url {
+ get {
+ if (null == _oUrl) {
+ _oUrl = new Uri(RawUrl);
+ }
+
+ return _oUrl;
+ }
+ }
+
+ public Uri UrlReferrer {
+ get {
+ if (null == _oUriReferrer && null != _WorkerRequest) {
+ string sReferrer = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderReferer);
+ if (null != sReferrer && sReferrer.Length > 0) {
+ try {
+ if (sReferrer.IndexOf("://") >= 0) {
+ _oUriReferrer = new Uri(sReferrer);
+ } else {
+ _oUriReferrer = new Uri(this.Url, sReferrer);
+ }
+ }
+ catch (Exception) {
+ }
+ }
+ }
+
+ return _oUriReferrer;
+ }
+ }
+
+ public string UserAgent {
+ get {
+ if (_sUserAgent == null && _WorkerRequest != null) {
+ _sUserAgent = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderUserAgent);
+ }
+
+ if (_sUserAgent == null) {
+ _sUserAgent = string.Empty;
+ }
+
+ return _sUserAgent;
+ }
+ }
+
+ public string UserHostAddress {
+ get {
+ if (_sUserHostAddress == null && null != _WorkerRequest) {
+ _sUserHostAddress = _WorkerRequest.GetRemoteAddress();
+ }
+
+ if (_sUserHostAddress == null || _sUserHostAddress.Length == 0) {
+ _sUserHostAddress = "127.0.0.1";
+ }
+
+ return _sUserHostAddress;
+ }
+ }
+
+ public string UserHostName {
+ get {
+ if (_sUserHostName == null && null != _WorkerRequest) {
+ _sUserHostName = _WorkerRequest.GetRemoteName();
+ }
+
+ if (_sUserHostName == null || _sUserHostName.Length == 0) {
+ _sUserHostName = UserHostAddress;
+ }
+
+ return _sUserHostName;
+ }
+ }
+
+ public string [] UserLanguages {
+ get {
+ if (_arrUserLanguages == null && null != _WorkerRequest) {
+ _arrUserLanguages = HttpHelper.ParseMultiValueHeader(_WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderAcceptLanguage));
+ }
+
+ return _arrUserLanguages;
+ }
+ }
+
+ internal string RootVirtualDir {
+ get {
+ if (_sRequestRootVirtualDir == null) {
+ _sRequestRootVirtualDir = FilePath;
+ int pos = _sRequestRootVirtualDir.LastIndexOf ('/');
+ if (pos == -1 || pos == 0)
+ _sRequestRootVirtualDir = "/";
+ else
+ _sRequestRootVirtualDir = _sRequestRootVirtualDir.Substring (0, pos);
+ }
+
+ return _sRequestRootVirtualDir;
+ }
+ }
+
+ public byte [] BinaryRead(int count) {
+ int iSize = TotalBytes;
+ if (iSize == 0) {
+ throw new ArgumentException();
+ }
+
+ byte [] arrData = new byte[iSize];
+
+ int iRetSize = InputStream.Read(arrData, 0, iSize);
+ if (iRetSize != iSize) {
+ byte [] tmpData = new byte[iRetSize];
+ if (iRetSize > 0) {
+ Array.Copy(arrData, 0, tmpData, 0, iRetSize);
+ }
+
+ arrData = tmpData;
+ }
+
+ return arrData;
+ }
+
+ public int [] MapImageCoordinates(string ImageFieldName) {
+ NameValueCollection oItems;
+
+ if (HttpMethod == "GET" || HttpMethod == "HEAD") {
+ oItems = QueryString;
+ } else if (HttpMethod == "POST") {
+ oItems = Form;
+ } else {
+ return null;
+ }
+
+ int [] arrRet = null;
+ try {
+ string sX = oItems.Get(ImageFieldName + ".x");
+ string sY = oItems.Get(ImageFieldName + ".y");
+
+ if (null != sX && null != sY) {
+ int [] arrTmp = new Int32[2];
+ arrRet[0] = Int32.Parse(sX);
+ arrRet[1] = Int32.Parse(sY);
+
+ arrRet = arrTmp;
+ }
+ }
+ catch (Exception) {
+ }
+
+ return arrRet;
+ }
+
+ public string MapPath (string VirtualPath)
+ {
+ return MapPath (VirtualPath, RootVirtualDir, true);
+ }
+
+ [MonoTODO("allowCrossAppMapping?")]
+ public string MapPath (string virtualPath, string baseVirtualDir, bool allowCrossAppMapping)
+ {
+ if (_WorkerRequest == null)
+ throw new HttpException ("No HttpWorkerRequest!!!");
+
+ if (virtualPath == null || virtualPath.Length == 0)
+ virtualPath = ".";
+ else
+ virtualPath = virtualPath.Trim ();
+
+ if (System.IO.Path.DirectorySeparatorChar != '/')
+ virtualPath = virtualPath.Replace (System.IO.Path.DirectorySeparatorChar, '/');
+
+ if (UrlUtils.IsRooted (virtualPath)) {
+ virtualPath = UrlUtils.Reduce (virtualPath);
+ } else {
+ if (baseVirtualDir == null)
+ virtualPath = UrlUtils.Combine (RootVirtualDir, virtualPath);
+ else
+ virtualPath = UrlUtils.Combine (baseVirtualDir, virtualPath);
+ }
+
+ return _WorkerRequest.MapPath (virtualPath);
+ }
+
+ public void SaveAs(string filename, bool includeHeaders) {
+ FileStream oFile;
+ TextWriter oWriter;
+ HttpRequestStream oData;
+
+ oFile = new FileStream(filename, FileMode.CreateNew);
+ if (includeHeaders) {
+ oWriter = new StreamWriter(oFile);
+ oWriter.Write(HttpMethod + " " + Path);
+
+ if (QueryStringRaw != null && QueryStringRaw.Length > 0)
+ oWriter.Write("?" + QueryStringRaw);
+ if (_WorkerRequest != null) {
+ oWriter.Write(" " + _WorkerRequest.GetHttpVersion() + "\r\n");
+ oWriter.Write(GetAllHeaders(true));
+ } else {
+ oWriter.Write("\r\n");
+ }
+
+ oWriter.Write("\r\n");
+ oWriter.Flush();
+ }
+
+ oData = (HttpRequestStream) InputStream;
+
+ if (oData.DataLength > 0) {
+ oFile.Write(oData.Data, oData.DataOffset, oData.DataLength);
+ }
+
+ oFile.Flush();
+ oFile.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRequestStream.cs b/mcs/class/System.Web/System.Web/HttpRequestStream.cs
new file mode 100644
index 00000000000..c67281d3dd1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequestStream.cs
@@ -0,0 +1,142 @@
+//
+// System.Web.HttpRequestStream
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ public class HttpRequestStream : Stream {
+ private byte [] _arrData;
+ private int _iLength;
+ private int _iOffset;
+ private int _iPos;
+
+ internal HttpRequestStream(byte [] buffer, int offset, int length) {
+ _iPos = 0;
+ _iOffset = offset;
+ _iLength = length;
+
+ _arrData = buffer;
+ }
+
+ private void Reset() {
+ _iPos = 0;
+ _iOffset = 0;
+ _iLength = 0;
+
+ _arrData = null;
+ }
+
+ public override void Flush() {
+ }
+
+ public override void Close() {
+ Reset();
+ }
+
+ public override int Read(byte [] buffer, int offset, int length) {
+ int iBytes = length;
+
+ if (_iPos + length > _arrData.Length) {
+ iBytes = (int) _arrData.Length - _iPos;
+ }
+
+ if (iBytes <= 0) {
+ return 0;
+ }
+
+ Buffer.BlockCopy(_arrData, _iPos, buffer, offset, iBytes);
+ _iPos += iBytes;
+
+ return iBytes;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ switch (origin) {
+ case SeekOrigin.Begin : if (offset > _arrData.Length) {
+ throw new ArgumentException();
+ }
+ _iPos = (int) offset;
+ break;
+
+ case SeekOrigin.Current : if (((long) _iPos + offset > _arrData.Length) || (_iPos + (int) offset < 0)) {
+ throw new ArgumentException();
+ }
+ _iPos += Convert.ToInt32(offset);
+ break;
+
+ case SeekOrigin.End: if (_arrData.Length - offset < 0) {
+ throw new ArgumentException();
+ }
+
+ _iPos = Convert.ToInt32( _arrData.Length - offset);
+ break;
+ }
+
+ return (long) _iPos;
+ }
+
+ public override void SetLength(long length) {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ throw new NotSupportedException();
+ }
+
+ public override bool CanRead {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return false;
+ }
+ }
+
+ public byte [] Data {
+ get {
+ return _arrData;
+ }
+ }
+
+ public int DataLength {
+ get {
+ return _iLength;
+ }
+ }
+
+ public int DataOffset {
+ get {
+ return _iOffset;
+ }
+ }
+
+ public override long Length {
+ get {
+ return (long) _arrData.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ return (long) _iPos;
+ }
+
+ set {
+ Seek(value, SeekOrigin.Begin);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs
new file mode 100644
index 00000000000..07087d70a9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponse.cs
@@ -0,0 +1,901 @@
+//
+// System.Web.HttpResponse
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Web.Util;
+
+namespace System.Web
+{
+ public sealed class HttpResponse
+ {
+ // Chunked encoding static helpers
+ static byte [] s_arrChunkSuffix = { 10, 13 };
+ static byte [] s_arrChunkEnd = { 10 , 13 };
+ static string s_sChunkedPrefix = "\r\n";
+
+ ArrayList _Headers;
+
+ bool _bClientDisconnected;
+ bool _bSuppressHeaders;
+ bool _bSuppressContent;
+ bool _bChunked;
+ bool _bEnded;
+ bool _bBuffering;
+ bool _bHeadersSent;
+ bool _bFlushing;
+ long _lContentLength;
+ int _iStatusCode;
+
+ bool _ClientDisconnected;
+
+ string _sContentType;
+ string _sCacheControl;
+ string _sTransferEncoding;
+ string _sCharset;
+ string _sStatusDescription;
+
+ HttpCookieCollection _Cookies;
+ HttpCachePolicy _CachePolicy;
+
+ Encoding _ContentEncoding;
+
+ HttpContext _Context;
+ HttpWriter _Writer;
+ TextWriter _TextWriter;
+
+ HttpWorkerRequest _WorkerRequest;
+
+ ArrayList fileDependencies;
+
+ public HttpResponse (TextWriter output)
+ {
+ _bBuffering = true;
+ _bFlushing = false;
+ _bHeadersSent = false;
+
+ _Headers = new ArrayList ();
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _sCacheControl = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+
+ _bChunked = false;
+
+ _TextWriter = output;
+ }
+
+ internal HttpResponse (HttpWorkerRequest WorkerRequest, HttpContext Context)
+ {
+ _Context = Context;
+ _WorkerRequest = WorkerRequest;
+
+ _bBuffering = true;
+ _bFlushing = false;
+ _bHeadersSent = false;
+
+ _Headers = new ArrayList ();
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _sCacheControl = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+
+ _bChunked = false;
+
+ _Writer = new HttpWriter (this);
+ _TextWriter = _Writer;
+ }
+
+ internal Encoder ContentEncoder
+ {
+ get {
+ return ContentEncoding.GetEncoder ();
+ }
+ }
+
+ internal void FinalFlush ()
+ {
+ Flush (true);
+ }
+
+ internal void DoFilter ()
+ {
+ if (null != _Writer)
+ _Writer.FilterData (true);
+ }
+
+ [MonoTODO("We need to add cache headers also")]
+ private ArrayList GenerateHeaders ()
+ {
+ ArrayList oHeaders = new ArrayList (_Headers.ToArray ());
+
+ oHeaders.Add (new HttpResponseHeader ("X-Powered-By", "Mono"));
+ // save culture info, we need us info here
+ CultureInfo oSavedInfo = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo (0x0409);
+
+ string date = DateTime.Now.ToUniversalTime ().ToString ("ddd, d MMM yyyy HH:mm:ss ");
+ oHeaders.Add (new HttpResponseHeader ("Date", date + "GMT"));
+
+ Thread.CurrentThread.CurrentCulture = oSavedInfo;
+
+ if (_lContentLength > 0) {
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderContentLength,
+ _lContentLength.ToString ()));
+ }
+
+ if (_sContentType != null) {
+ if (_sContentType.IndexOf ("charset=") == -1) {
+ if (Charset.Length == 0) {
+ Charset = ContentEncoding.HeaderName;
+ }
+
+ // Time to build our string
+ if (Charset.Length > 0) {
+ _sContentType += "; charset=" + Charset;
+ }
+ }
+
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderContentType,
+ _sContentType));
+ }
+
+ if (_sCacheControl != null) {
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderPragma,
+ _sCacheControl));
+ }
+
+ if (_sTransferEncoding != null) {
+ oHeaders.Add (new HttpResponseHeader (HttpWorkerRequest.HeaderTransferEncoding,
+ _sTransferEncoding));
+ }
+
+ if (_Cookies != null) {
+ int length = _Cookies.Count;
+ for (int i = 0; i < length; i++) {
+ oHeaders.Add (_Cookies.Get (i).GetCookieHeader ());
+ }
+ }
+
+ return oHeaders;
+ }
+
+ private void SendHeaders ()
+ {
+ _WorkerRequest.SendStatus (StatusCode, StatusDescription);
+
+ ArrayList oHeaders = GenerateHeaders ();
+ foreach (HttpResponseHeader oHeader in oHeaders)
+ oHeader.SendContent (_WorkerRequest);
+
+ _bHeadersSent = true;
+ }
+
+ public string Status
+ {
+ get {
+ return String.Format ("{0} {1}", StatusCode, StatusDescription);
+ }
+
+ set {
+ string sMsg = "OK";
+ int iCode = 200;
+
+ try {
+ iCode = Int32.Parse (value.Substring (0, value.IndexOf (' ')));
+ sMsg = value.Substring (value.IndexOf (' ') + 1);
+ } catch (Exception) {
+ throw new HttpException ("Invalid status string");
+ }
+
+ StatusCode = iCode;
+ StatusDescription = sMsg;
+ }
+ }
+
+ [MonoTODO()]
+ public void AddCacheItemDependencies (ArrayList cacheKeys)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO()]
+ public void AddCacheItemDependency(string cacheKey)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AddFileDependencies (ArrayList filenames)
+ {
+ if (filenames == null || filenames.Count == 0)
+ return;
+
+ if (fileDependencies == null) {
+ fileDependencies = (ArrayList) filenames.Clone ();
+ return;
+ }
+
+ foreach (string fn in filenames)
+ AddFileDependency (fn);
+ }
+
+ public void AddFileDependency (string filename)
+ {
+ if (fileDependencies == null)
+ fileDependencies = new ArrayList ();
+
+ fileDependencies.Add (filename);
+ }
+
+ public void AddHeader (string name, string value)
+ {
+ AppendHeader(name, value);
+ }
+
+ public void AppendCookie (HttpCookie cookie)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Cannot append cookies after HTTP headers have been sent");
+
+ Cookies.Add (cookie);
+ }
+
+ [MonoTODO()]
+ public void AppendToLog (string param)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string ApplyAppPathModifier (string virtualPath)
+ {
+ if (virtualPath == null)
+ return null;
+
+ if (virtualPath == "")
+ return _Context.Request.RootVirtualDir;
+
+ if (UrlUtils.IsRelativeUrl (virtualPath)) {
+ virtualPath = UrlUtils.Combine (_Context.Request.RootVirtualDir, virtualPath);
+ } else if (UrlUtils.IsRooted (virtualPath)) {
+ virtualPath = UrlUtils.Reduce (virtualPath);
+ }
+
+ return virtualPath;
+ }
+
+ public bool Buffer
+ {
+ get {
+ return BufferOutput;
+ }
+
+ set {
+ BufferOutput = value;
+ }
+ }
+
+ public bool BufferOutput
+ {
+ get {
+ return _bBuffering;
+ }
+
+ set {
+ if (_Writer != null)
+ _Writer.Update ();
+
+ _bBuffering = value;
+ }
+ }
+
+ public HttpCachePolicy Cache
+ {
+ get {
+ if (null == _CachePolicy)
+ _CachePolicy = new HttpCachePolicy ();
+
+ return _CachePolicy;
+ }
+ }
+
+ [MonoTODO("Set status in the cache policy")]
+ public string CacheControl
+ {
+ get {
+ return _sCacheControl;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sCacheControl = value;
+ }
+ }
+
+ public string Charset
+ {
+ get {
+ if (null == _sCharset)
+ _sCharset = ContentEncoding.WebName;
+
+ return _sCharset;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sCharset = value;
+ }
+ }
+
+ public Encoding ContentEncoding
+ {
+ get {
+ if (_ContentEncoding == null)
+ _ContentEncoding = WebEncoding.Encoding;
+
+ return _ContentEncoding;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentException ("Can't set a null as encoding");
+
+ _ContentEncoding = value;
+
+ if (_Writer != null)
+ _Writer.Update ();
+ }
+ }
+
+ public string ContentType
+ {
+ get {
+ return _sContentType;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sContentType = value;
+ }
+ }
+
+ public HttpCookieCollection Cookies
+ {
+ get {
+ if (null == _Cookies)
+ _Cookies = new HttpCookieCollection (this, false);
+
+ return _Cookies;
+ }
+ }
+
+ [MonoTODO("Set expires in the cache policy")]
+ public int Expires
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO("Set expiresabsolute in the cache policy")]
+ public DateTime ExpiresAbsolute
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Stream Filter
+ {
+ get {
+ if (_Writer != null)
+ return _Writer.GetActiveFilter ();
+
+ return null;
+ }
+
+ set {
+ if (_Writer == null)
+ throw new HttpException ("Filtering is not allowed");
+
+ _Writer.ActivateFilter (value);
+ }
+ }
+
+ public bool IsClientConnected
+ {
+ get {
+ if (_ClientDisconnected)
+ return false;
+
+ if (null != _WorkerRequest && (!_WorkerRequest.IsClientConnected ())) {
+ _ClientDisconnected = false;
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ public TextWriter Output
+ {
+ get {
+ return _TextWriter;
+ }
+ }
+
+ public Stream OutputStream
+ {
+ get {
+ if (_Writer == null)
+ throw new HttpException ("an Output stream not available when " +
+ "running with custom text writer");
+
+ return _Writer.OutputStream;
+ }
+ }
+
+ public string StatusDescription
+ {
+ get {
+ if (null == _sStatusDescription)
+ _sStatusDescription =
+ HttpWorkerRequest.GetStatusDescription (_iStatusCode);
+
+ return _sStatusDescription;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sStatusDescription = value;
+ }
+ }
+
+ public int StatusCode
+ {
+ get {
+ return _iStatusCode;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sStatusDescription = null;
+ _iStatusCode = value;
+ }
+ }
+
+ public bool SuppressContent
+ {
+ get {
+ return _bSuppressContent;
+ }
+
+ set {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _bSuppressContent = true;
+ }
+ }
+
+ public HttpRequest Request
+ {
+ get {
+ if (_Context == null)
+ return null;
+
+ return _Context.Request;
+ }
+ }
+
+ internal void AppendHeader (int iIndex, string value)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ switch (iIndex) {
+ case HttpWorkerRequest.HeaderContentLength:
+ _lContentLength = Int64.Parse (value);
+ break;
+ case HttpWorkerRequest.HeaderContentEncoding:
+ _sContentType = value;
+ break;
+ case HttpWorkerRequest.HeaderTransferEncoding:
+ _sTransferEncoding = value;
+ if (value.Equals ("chunked")) {
+ _bChunked = true;
+ } else {
+ _bChunked = false;
+ }
+ break;
+ case HttpWorkerRequest.HeaderPragma:
+ _sCacheControl = value;
+ break;
+ default:
+ _Headers.Add (new HttpResponseHeader (iIndex, value));
+ break;
+ }
+ }
+
+ public void AppendHeader (string name, string value)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ switch (name.ToLower ()) {
+ case "content-length":
+ _lContentLength = Int64.Parse (value);
+ break;
+ case "content-type":
+ _sContentType = value;
+ break;
+ case "transfer-encoding":
+ _sTransferEncoding = value;
+ if (value.Equals ("chunked")) {
+ _bChunked = true;
+ } else {
+ _bChunked = false;
+ }
+ break;
+ case "pragma":
+ _sCacheControl = value;
+ break;
+ default:
+ _Headers.Add (new HttpResponseHeader (name, value));
+ break;
+ }
+ }
+
+ public void BinaryWrite (byte [] buffer)
+ {
+ OutputStream.Write (buffer, 0, buffer.Length);
+ }
+
+ public void Clear ()
+ {
+ if (_Writer != null)
+ _Writer.Clear ();
+ }
+
+ public void ClearContent ()
+ {
+ Clear();
+ }
+
+ public void ClearHeaders ()
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _Headers = new ArrayList ();
+ _sCacheControl = null;
+ _sTransferEncoding = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+ }
+
+ public void Close ()
+ {
+ _bClientDisconnected = false;
+ _WorkerRequest.CloseConnection ();
+ _bClientDisconnected = true;
+ }
+
+ internal void Dispose ()
+ {
+ if (_Writer != null) {
+ _Writer.Dispose ();
+ _Writer = null;
+ }
+ }
+
+ [MonoTODO("Handle callbacks into before done with session, needs to have a non ended flush here")]
+ internal void FlushAtEndOfRequest ()
+ {
+ Flush (true);
+ }
+
+ public void End ()
+ {
+ if (_bEnded)
+ return;
+
+ Flush ();
+ _bEnded = true;
+ _Context.ApplicationInstance.CompleteRequest ();
+ }
+
+ public void Flush ()
+ {
+ Flush (false);
+ }
+
+ private void Flush (bool bFinish)
+ {
+ if (_bFlushing)
+ return;
+
+ _bFlushing = true;
+
+ if (_Writer == null) {
+ _TextWriter.Flush ();
+ _bFlushing = false;
+ return;
+ }
+
+ try {
+ long length;
+ if (!_bHeadersSent && !_bSuppressHeaders && !_bClientDisconnected) {
+ if (bFinish) {
+ length = _Writer.BufferSize;
+ if (length == 0 && _lContentLength == 0)
+ _sContentType = null;
+
+ SendHeaders ();
+ length = _Writer.BufferSize;
+ if (length != 0)
+ _WorkerRequest.SendCalculatedContentLength ((int) length);
+ } else {
+ if (_lContentLength == 0 && _iStatusCode == 200 &&
+ _sTransferEncoding == null) {
+ // Check we are going todo chunked encoding
+ string sProto = Request.ServerVariables ["SERVER_PROTOCOL"];
+ sProto = "HTTP/1.0"; // Remove this line when we support properly
+ // chunked content
+
+ if (sProto != null && sProto == "HTTP/1.1") {
+ AppendHeader (
+ HttpWorkerRequest.HeaderTransferEncoding,
+ "chunked");
+ } else {
+ // Just in case, the old browsers send a HTTP/1.0
+ // request with Connection: Keep-Alive
+ AppendHeader (
+ HttpWorkerRequest.HeaderConnection,
+ "Close");
+ }
+ }
+
+ SendHeaders ();
+ }
+ }
+
+ if (!_bSuppressContent && Request.HttpMethod == "HEAD")
+ _bSuppressContent = true;
+
+ if (!_bSuppressContent) {
+ _bClientDisconnected = false;
+ if (_bChunked) {
+ Encoding oASCII = Encoding.ASCII;
+
+ string chunk = Convert.ToString(_Writer.BufferSize, 16);
+ byte [] arrPrefix = oASCII.GetBytes (chunk + s_sChunkedPrefix);
+
+ _WorkerRequest.SendResponseFromMemory (arrPrefix,
+ arrPrefix.Length);
+
+ _Writer.SendContent (_WorkerRequest);
+
+ _WorkerRequest.SendResponseFromMemory (s_arrChunkSuffix,
+ s_arrChunkSuffix.Length);
+ if (bFinish)
+ _WorkerRequest.SendResponseFromMemory (
+ s_arrChunkEnd, s_arrChunkEnd.Length);
+ } else {
+ _Writer.SendContent (_WorkerRequest);
+ }
+ } else {
+ _Writer.Clear ();
+ }
+
+ _WorkerRequest.FlushResponse (bFinish);
+
+ if (!bFinish)
+ _Writer.Clear ();
+ } finally {
+ _bFlushing = false;
+ }
+ }
+
+ public void Pics (string value)
+ {
+ AppendHeader ("PICS-Label", value);
+ }
+
+
+ public void Redirect (string url)
+ {
+ Redirect (url, true);
+ }
+
+ public void Redirect (string url, bool endResponse)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Headers has been sent to the client");
+
+ Clear ();
+
+ url = ApplyAppPathModifier (url);
+ StatusCode = 302;
+ AppendHeader (HttpWorkerRequest.HeaderLocation, url);
+
+ // Text for browsers that can't handle location header
+ Write ("<html><head><title>Object moved</title></head><body>\r\n");
+ Write ("<h2>Object moved to <a href='" + url + "'>here</a></h2>\r\n");
+ Write ("</body><html>\r\n");
+
+ if (endResponse)
+ End ();
+ }
+
+ public void Write (char ch)
+ {
+ _TextWriter.Write(ch);
+ }
+
+ public void Write (object obj)
+ {
+ _TextWriter.Write(obj);
+ }
+
+ public void Write (string str)
+ {
+ _TextWriter.Write (str);
+ }
+
+ public void Write (char [] buffer, int index, int count)
+ {
+ _TextWriter.Write (buffer, index, count);
+ }
+
+ [MonoTODO()]
+ public static void RemoveOutputCacheItem (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetCookie (HttpCookie cookie)
+ {
+ if (_bHeadersSent)
+ throw new HttpException ("Cannot append cookies after HTTP headers have been sent");
+
+ Cookies.Add (cookie);
+ }
+
+ private void WriteFromStream (Stream stream, long offset, long length, long bufsize)
+ {
+ if (offset < 0 || length <= 0)
+ return;
+
+ long stLength = stream.Length;
+ if (offset + length > stLength)
+ length = stLength - offset;
+
+ if (offset > 0)
+ stream.Seek (offset, SeekOrigin.Begin);
+
+ byte [] fileContent = new byte [bufsize];
+ int count = (int) Math.Min (Int32.MaxValue, bufsize);
+ while (length > 0 && (count = stream.Read (fileContent, 0, count)) != 0) {
+ _Writer.WriteBytes (fileContent, 0, count);
+ length -= count;
+ count = (int) Math.Min (length, fileContent.Length);
+ }
+ }
+
+ public void WriteFile (string filename)
+ {
+ WriteFile (filename, false);
+ }
+
+ public void WriteFile (string filename, bool readIntoMemory)
+ {
+ FileStream fs = null;
+ try {
+ fs = File.OpenRead (filename);
+ long size = fs.Length;
+ if (readIntoMemory) {
+ WriteFromStream (fs, 0, size, size);
+ } else {
+ WriteFromStream (fs, 0, size, 8192);
+ }
+ } finally {
+ if (fs != null)
+ fs.Close ();
+ }
+ }
+
+ public void WriteFile (string filename, long offset, long size)
+ {
+ FileStream fs = null;
+ try {
+ fs = File.OpenRead (filename);
+ WriteFromStream (fs, offset, size, 8192);
+ } finally {
+ if (fs != null)
+ fs.Close ();
+ }
+ }
+
+ public void WriteFile (IntPtr fileHandle, long offset, long size)
+ {
+ FileStream fs = null;
+ try {
+ fs = new FileStream (fileHandle, FileAccess.Read);
+ WriteFromStream (fs, offset, size, 8192);
+ } finally {
+ if (fs != null)
+ fs.Close ();
+ }
+ }
+
+ [MonoTODO()]
+ internal void OnCookieAdd (HttpCookie cookie)
+ {
+ }
+
+ [MonoTODO("Do we need this?")]
+ internal void OnCookieChange (HttpCookie cookie)
+ {
+ }
+
+ [MonoTODO()]
+ internal void GoingToChangeCookieColl ()
+ {
+ }
+
+ [MonoTODO()]
+ internal void ChangedCookieColl ()
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpResponseHeader.cs b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
new file mode 100644
index 00000000000..c8cc64a5767
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
@@ -0,0 +1,49 @@
+//
+// System.Web.HttpResponseHeader
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ internal class HttpResponseHeader {
+ private string _sHeader;
+ private string _sValue;
+ private int _iKnowHeaderId;
+
+ internal HttpResponseHeader(int KnowHeaderId, string value) {
+ _iKnowHeaderId = KnowHeaderId;
+ _sValue = value;
+ }
+
+ internal HttpResponseHeader(string header, string value) {
+ _sHeader = header;
+ _sValue = value;
+ }
+
+ internal string Name {
+ get {
+ if (null == _sHeader) {
+ return HttpWorkerRequest.GetKnownResponseHeaderName(_iKnowHeaderId);
+ }
+
+ return _sHeader;
+ }
+ }
+
+ internal string Value {
+ get {
+ return _sValue;
+ }
+ }
+
+ internal void SendContent(HttpWorkerRequest WorkerRequest) {
+ if (null != _sHeader) {
+ WorkerRequest.SendUnknownResponseHeader(_sHeader, _sValue);
+ } else {
+ WorkerRequest.SendKnownResponseHeader(_iKnowHeaderId, _sValue);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseStream.cs b/mcs/class/System.Web/System.Web/HttpResponseStream.cs
new file mode 100644
index 00000000000..831118b67ae
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseStream.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.HttpResponseStream
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ /// <summary>
+ /// Simple wrapper around HttpWriter to support the Stream interface
+ /// </summary>
+ class HttpResponseStream : Stream {
+ private HttpWriter _Writer;
+
+ internal HttpResponseStream(HttpWriter Writer) {
+ _Writer = Writer;
+ }
+
+ public override void Flush() {
+ _Writer.Flush();
+ }
+
+ public override void Close() {
+ _Writer.Close();
+ }
+
+ public override int Read(byte [] buffer, int offset, int length) {
+ throw new NotSupportedException();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long length) {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ if (offset < 0) {
+ throw new ArgumentOutOfRangeException("offset");
+ }
+
+ if (length <= 0) {
+ throw new ArgumentOutOfRangeException("length");
+ }
+
+ _Writer.WriteBytes(buffer, offset, length);
+ }
+
+ public override bool CanRead {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override long Position {
+ get {
+ throw new NotSupportedException();
+ }
+
+ set {
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs b/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs
new file mode 100644
index 00000000000..30bf5709d43
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.HttpResponseStreamProxy
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ /// <summary>
+ /// Used to detect if there is a valid filter proxy.
+ /// </summary>
+ class HttpResponseStreamProxy : HttpResponseStream {
+ bool _FilteringActive;
+
+ internal HttpResponseStreamProxy(HttpWriter Writer) : base(Writer) {
+ _FilteringActive = false;
+ }
+
+ internal void CheckFilteringState() {
+ if (_FilteringActive) {
+ throw new HttpException("Invalid response filter state");
+ }
+ }
+
+ internal bool Active {
+ get {
+ return _FilteringActive;
+ }
+ set {
+ _FilteringActive = value;
+ }
+ }
+
+ public override void Flush() {
+ }
+
+ public override void Close() {
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ CheckFilteringState();
+
+ Write(buffer, offset, length);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs
new file mode 100644
index 00000000000..7806b76f7ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs
@@ -0,0 +1,463 @@
+//
+// System.Web.HttpRuntime
+//
+// Author:
+// Patrik Torstensson (ptorsten@hotmail.com)
+// Gaurav Vaish (gvaish@iitk.ac.in)
+//
+using System;
+using System.Collections;
+using System.Text;
+using System.Security;
+using System.Security.Permissions;
+using System.Threading;
+using System.Web.UI;
+using System.Web.Util;
+using System.Web.Caching;
+
+namespace System.Web {
+
+ public sealed class HttpRuntime {
+
+ // Security permission helper objects
+ private static IStackWalk appPathDiscoveryStackWalk;
+ private static IStackWalk ctrlPrincipalStackWalk;
+ private static IStackWalk sensitiveInfoStackWalk;
+ private static IStackWalk unmgdCodeStackWalk;
+ private static IStackWalk unrestrictedStackWalk;
+ private static IStackWalk reflectionStackWalk;
+
+ private static HttpRuntime _runtime;
+ private static string appDomainAppId;
+ private static string appDomainId;
+ private static string appDomainAppPath;
+ private static string appDomainAppVirtualPath;
+ private Cache _cache;
+
+ private int _activeRequests;
+ private HttpWorkerRequest.EndOfSendNotification _endOfSendCallback;
+ private AsyncCallback _handlerCallback;
+ private WaitCallback _appDomainCallback;
+
+ private bool _firstRequestStarted;
+ private bool _firstRequestExecuted;
+ private DateTime _firstRequestStartTime;
+
+ private Exception _initError;
+
+ static HttpRuntime ()
+ {
+ appPathDiscoveryStackWalk = null;
+ ctrlPrincipalStackWalk = null;
+ sensitiveInfoStackWalk = null;
+ unmgdCodeStackWalk = null;
+ unrestrictedStackWalk = null;
+
+ _runtime = new HttpRuntime ();
+ _runtime.Init();
+ }
+
+ public HttpRuntime ()
+ {
+ }
+
+ static internal object CreateInternalObject(Type type) {
+ return Activator.CreateInstance(type, true);
+ }
+
+ [MonoTODO()]
+ private void Init ()
+ {
+ try {
+ _cache = new Cache ();
+
+ // TODO: timeout manager
+ // TODO: Load all app domain data
+ // TODO: Trace manager
+ _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification(OnEndOfSend);
+ _handlerCallback = new AsyncCallback(OnHandlerReady);
+ _appDomainCallback = new WaitCallback(OnAppDomainUnload);
+ }
+ catch (Exception error) {
+ _initError = error;
+ }
+ }
+
+ private void OnFirstRequestStart() {
+ if (null == _initError) {
+ // TODO: First request initialize (config, trace, request queue)
+ }
+
+ // If we got an error during init, throw to client now..
+ if (null != _initError)
+ throw _initError;
+ }
+
+ private void OnFirstRequestEnd() {
+ }
+
+ private void OnHandlerReady(IAsyncResult ar) {
+ HttpContext context = (HttpContext) ar.AsyncState;
+ try {
+ IHttpAsyncHandler handler = context.AsyncHandler;
+
+ try {
+ handler.EndProcessRequest(ar);
+ }
+ catch (Exception error) {
+ context.AddError(error);
+ }
+ }
+ finally {
+ context.AsyncHandler = null;
+ }
+
+ FinishRequest(context, context.Error);
+ }
+
+ private void OnEndOfSend(HttpWorkerRequest request, object data) {
+ HttpContext context = (HttpContext) data;
+
+ context.Request.Dispose();
+ context.Response.Dispose();
+ }
+
+ internal void FinishRequest(HttpContext context, Exception error) {
+ if (context.Error != null)
+ Console.WriteLine ("context.Error: {0}", context.Error);
+ if (error == null) {
+ try {
+ context.Response.FlushAtEndOfRequest();
+ } catch (Exception obj) {
+ error = obj;
+ }
+ }
+
+ HttpWorkerRequest request = context.WorkerRequest;
+ if (null != error) {
+ WebTrace.WriteLine (error.ToString ());
+
+ context.Response.Clear ();
+ if (!(error is HttpException)) {
+ error = new HttpException (String.Empty, error);
+ }
+ context.Response.Write (((HttpException) error).GetHtmlErrorMessage ());
+ context.Response.FinalFlush ();
+ }
+
+ if (!_firstRequestExecuted) {
+ lock (this) {
+ if (!_firstRequestExecuted) {
+ OnFirstRequestEnd();
+ _firstRequestExecuted = true;
+ }
+ }
+ }
+
+ Interlocked.Decrement(ref _activeRequests);
+
+ if (null != request)
+ request.EndOfRequest();
+
+ // TODO: Schedule more work in request queue
+ }
+
+ private void OnAppDomainUnload(object state) {
+ Dispose();
+ }
+
+ [MonoTODO]
+ internal void Dispose() {
+ // TODO: Drain Request queue
+ // TODO: Stop request queue
+ // TODO: Move timeout value to config
+ WaitForRequests(5000);
+
+ _cache.Dispose();
+ HttpApplicationFactory.EndApplication();
+ }
+
+ [MonoTODO]
+ internal void WaitForRequests(int ms) {
+ DateTime timeout = DateTime.Now.AddMilliseconds(ms);
+
+ do {
+ // TODO: We should check the request queue here also
+ if (_activeRequests == 0)
+ return;
+
+ Thread.Sleep(100);
+ } while (timeout > DateTime.Now);
+ }
+
+ internal void InternalExecuteRequest(HttpWorkerRequest request)
+ {
+ if (request == null)
+ throw new ArgumentNullException ("request");
+
+ IHttpHandler handler;
+ IHttpAsyncHandler async_handler;
+
+ HttpContext context = new HttpContext(request);
+
+ request.SetEndOfSendNotification(_endOfSendCallback, context);
+
+ Interlocked.Increment(ref _activeRequests);
+
+ try {
+ if (!_firstRequestStarted) {
+ lock (this) {
+ if (!_firstRequestStarted) {
+ _firstRequestStartTime = DateTime.Now;
+
+ OnFirstRequestStart();
+ _firstRequestStarted = true;
+ }
+ }
+ }
+
+ handler = HttpApplicationFactory.GetInstance(context);
+ if (null == handler)
+ throw new HttpException(FormatResourceString("unable_to_create_app"));
+
+ if (handler is IHttpAsyncHandler) {
+ async_handler = (IHttpAsyncHandler) handler;
+
+ context.AsyncHandler = async_handler;
+ async_handler.BeginProcessRequest(context, _handlerCallback, context);
+ } else {
+ handler.ProcessRequest(context);
+ FinishRequest(context, null);
+ }
+ }
+ catch (Exception error) {
+ FinishRequest(context, error);
+ }
+ }
+
+ public static void ProcessRequest (HttpWorkerRequest Request)
+ {
+ // TODO: Request queue
+ _runtime.InternalExecuteRequest(Request);
+ }
+
+ public static Cache Cache {
+ get {
+ return _runtime._cache;
+ }
+ }
+
+ public static string AppDomainAppId {
+ get {
+ if (appDomainAppId == null)
+ appDomainAppId = (string) AppDomain.CurrentDomain.GetData (".appId");
+
+ return appDomainAppId;
+ }
+ }
+
+ public static string AppDomainAppPath {
+ get {
+ if (appDomainAppPath == null)
+ appDomainAppPath = (string) AppDomain.CurrentDomain.GetData (".appPath");
+
+ return appDomainAppPath;
+ }
+ }
+
+ public static string AppDomainAppVirtualPath {
+ get {
+ if (appDomainAppVirtualPath == null)
+ appDomainAppVirtualPath = (string) AppDomain.CurrentDomain.GetData (".appVPath");
+
+ return appDomainAppVirtualPath;
+ }
+ }
+
+ public static string AppDomainId {
+ get {
+ if (appDomainId == null)
+ appDomainId = (string) AppDomain.CurrentDomain.GetData (".domainId");
+
+ return appDomainId;
+ }
+ }
+
+ [MonoTODO]
+ public static string AspInstallDirectory {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static string BinDirectory {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static string ClrInstallDirectory {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static string CodegenDir {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static bool IsOnUNCShare {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static string MachineConfigurationDirectory {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static void Close ()
+ {
+ _runtime.Dispose();
+ }
+
+ internal static string FormatResourceString (string key)
+ {
+ return GetResourceString (key);
+ }
+
+ internal static string FormatResourceString (string key, string arg0)
+ {
+ /*string format = GetResourceString (key);
+
+ if (format == null)
+ return null;
+
+ return String.Format (format, arg0);
+ */
+ return String.Format ("{0}: {1}", key, arg0);
+ }
+
+ [MonoTODO ("FormatResourceString (string, string, string)")]
+ internal static string FormatResourceString (string key, string arg0, string type) {
+ return String.Format ("{0}: {1} {2}", key, arg0, type);
+ }
+
+ [MonoTODO ("FormatResourceString (string, string, string, string)")]
+ internal static string FormatResourceString (string key, string arg0,
+ string arg1, string arg2)
+ {
+ return String.Format ("{0}: {1} {2} {3}", key, arg0, arg1, arg2);
+ }
+
+ [MonoTODO ("FormatResourceString (string, string[]")]
+ internal static string FormatResourceString (string key, string[] args)
+ {
+ //StringBuilder sb = new StringBuilder ();
+ /*sb.AppendFormat ("{0}: ", key);
+ foreach (string s in args)
+ sb.AppendFormat ("{0} ", s);
+
+ if (sb.Length > 0)
+ sb.Length--;
+ return sb.ToString ();*/
+ string s = key + ": ";
+ if (args != null)
+ foreach (string k in args)
+ s += k + " ";
+ return s;
+ }
+
+ private static string GetResourceString (string key) {
+ return _runtime.GetResourceStringFromResourceManager (key);
+ }
+
+ [MonoTODO ("GetResourceStringFromResourceManager (string)")]
+ private string GetResourceStringFromResourceManager (string key) {
+ return "String returned by HttpRuntime.GetResourceStringFromResourceManager";
+ }
+
+ #region Security Internal Methods (not impl)
+ [MonoTODO ("Get Application path from the appdomain object")]
+ internal static IStackWalk AppPathDiscovery {
+ get {
+ if (appPathDiscoveryStackWalk == null) {
+ appPathDiscoveryStackWalk = new FileIOPermission (
+ FileIOPermissionAccess.PathDiscovery, "<apppath>");
+ }
+ return appPathDiscoveryStackWalk;
+ }
+ }
+
+ internal static IStackWalk ControlPrincipal {
+ get {
+ if (ctrlPrincipalStackWalk == null) {
+ ctrlPrincipalStackWalk = new SecurityPermission (
+ SecurityPermissionFlag.ControlPrincipal);
+ }
+ return ctrlPrincipalStackWalk;
+ }
+ }
+
+ internal static IStackWalk Reflection {
+ get {
+ if (reflectionStackWalk == null) {
+ reflectionStackWalk = new ReflectionPermission (
+ ReflectionPermissionFlag.TypeInformation |
+ ReflectionPermissionFlag.MemberAccess);
+ }
+ return reflectionStackWalk;
+ }
+ }
+
+ internal static IStackWalk SensitiveInformation {
+ get {
+ if (sensitiveInfoStackWalk == null) {
+ sensitiveInfoStackWalk = new EnvironmentPermission (
+ PermissionState.Unrestricted);
+ }
+ return sensitiveInfoStackWalk;
+ }
+ }
+
+ internal static IStackWalk UnmanagedCode {
+ get {
+ if (unmgdCodeStackWalk == null) {
+ unmgdCodeStackWalk = new SecurityPermission (
+ SecurityPermissionFlag.UnmanagedCode);
+ }
+ return unmgdCodeStackWalk;
+ }
+ }
+
+ internal static IStackWalk Unrestricted {
+ get {
+ if (unrestrictedStackWalk == null) {
+ unrestrictedStackWalk = new PermissionSet (
+ PermissionState.Unrestricted);
+ }
+ return unrestrictedStackWalk;
+ }
+ }
+
+ internal static IStackWalk FileReadAccess (string file)
+ {
+ return new FileIOPermission (FileIOPermissionAccess.Read, file);
+ }
+
+ internal static IStackWalk PathDiscoveryAccess (string path)
+ {
+ return new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
new file mode 100644
index 00000000000..c41d72d9d56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
@@ -0,0 +1,283 @@
+/**
+ * Namespace: System.Web
+ * Class: HttpServerUtility
+ *
+ * Author: Wictor Wilén
+ * Contact: <wictor@ibizkit.se>, <patrik.torstensson@labs2.com>
+ * Status: ?%
+ *
+ * (C) Wictor Wilén (2002)
+ * ---------------------------------------
+ * 2002-03-27 Wictor Started implementation
+ * 2002-04-09 Patrik Added HttpContext constructor
+ * 2002-04-10 Patrik Moved encoding to HttpUtility and
+ * fixed all functions that used
+ * HttpContext
+ *
+ */
+using System;
+using System.IO;
+
+namespace System.Web {
+ public sealed class HttpServerUtility {
+
+ private static string _name = "";
+
+ private HttpContext _Context;
+ private HttpApplication _Application;
+
+ [MonoTODO()]
+ internal HttpServerUtility(HttpContext Context) {
+ _Context = Context;
+ }
+
+ [MonoTODO()]
+ internal HttpServerUtility(HttpApplication app) {
+ _Application = app;
+ }
+
+ // Properties
+
+
+ /// <summary>
+ /// Gets the server's computer name.
+ /// </summary>
+ public string MachineName {
+ get {
+ if(_name.Length == 0) {
+ _name = Environment.MachineName;
+ }
+ return _name;
+ }
+ }
+ /// <summary>
+ /// Gets and sets the request time-out in seconds.
+ /// </summary>
+ [MonoTODO()]
+ public int ScriptTimeout {
+ get {
+ throw new System.NotImplementedException();
+ }
+ set {
+ throw new System.NotImplementedException();
+ }
+ }
+
+ // Methods
+
+ /// <summary>
+ /// Clears the previous exception.
+ /// </summary>
+ public void ClearError() {
+ if (null != _Context) {
+ _Context.ClearError();
+ return;
+ }
+
+ if (null != _Application) {
+ _Application.ClearError();
+ }
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's Programmatic Identifier (ProgID).
+ /// </summary>
+ /// <param name="progID">The class or type of object to be instantiated. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObject(string progID) {
+ return CreateObject(Type.GetTypeFromProgID(progID));
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's type.
+ /// </summary>
+ /// <param name="type">A Type representing the object to create. </param>
+ /// <returns>The new object.</returns>
+ [MonoTODO()]
+ public object CreateObject(Type type) {
+ Object o;
+ o = Activator.CreateInstance(type);
+
+ // TODO: Call OnStartPage()
+
+ return o;
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's class identifier (CLSID).
+ /// </summary>
+ /// <param name="clsid">The class identifier of the object to be instantiated. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObjectFromClsid(string clsid) {
+ Guid guid = new Guid(clsid);
+ return CreateObject(Type.GetTypeFromCLSID(guid));
+ }
+
+
+ /// <summary>
+ /// Executes a request to another page using the specified URL path to the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new request. </param>
+ [MonoTODO()]
+ public void Execute(string path) {
+ throw new System.NotImplementedException();
+ }
+
+
+ /// <summary>
+ /// Executes a request to another page using the specified URL path to the page. A TextWriter captures output from the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new request. </param>
+ /// <param name="writer">The TextWriter to capture the output. </param>
+ [MonoTODO()]
+ public void Execute(string path, TextWriter writer ) {
+ throw new System.NotImplementedException();
+ }
+
+
+
+ /// <summary>
+ /// Returns the previous exception.
+ /// </summary>
+ /// <returns>The previous exception that was thrown.</returns>
+ [MonoTODO()]
+ public Exception GetLastError() {
+ throw new System.NotImplementedException();
+ }
+
+
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The HTML string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ [MonoTODO()]
+ public string HtmlDecode(string s) {
+ return HttpUtility.HtmlDecode(s);
+ }
+
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The HTML string to decode</param>
+ /// <param name="output">The TextWriter output stream containing the decoded string. </param>
+ public void HtmlDecode(string s, TextWriter output) {
+ output.Write(HttpUtility.HtmlDecode(s));
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <returns>The HTML-encoded text.</returns>
+ public string HtmlEncode(string s) {
+ return HttpUtility.HtmlEncode(s);
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public void HtmlEncode( string s, TextWriter output) {
+ output.Write(HtmlEncode(s));
+ }
+
+
+ /// <summary>
+ /// Returns the physical file path that corresponds to the specified virtual path on the Web server.
+ /// </summary>
+ /// <param name="path">The virtual path on the Web server. </param>
+ /// <returns>The physical file path that corresponds to path.</returns>
+ public string MapPath(string path) {
+ if (null == _Context) {
+ throw new HttpException("MapPath is not available");
+ }
+
+ return _Context.Request.MapPath(path);
+ }
+
+ /// <summary>
+ /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new page on the server to execute. </param>
+ [MonoTODO()]
+ public void Transfer(string path) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page. Specifies whether to clear the QueryString and Form collections.
+ /// </summary>
+ /// <param name="path">The URL path of the new page on the server to execute. </param>
+ /// <param name="preserveForm">If true, the QueryString and Form collections are preserved. If false, they are cleared. The default is false. </param>
+ [MonoTODO()]
+ public void Transfer(string path, bool preserveForm ) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// URL-decodes a string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The text string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ /// <remarks>
+ /// Post/html encoding @ ftp://ftp.isi.edu/in-notes/rfc1866.txt
+ /// Uncomment the line marked with RFC1738 to get pure RFC1738
+ /// and it will also consider the RFC1866 (ftp://ftp.isi.edu/in-notes/rfc1866.txt)
+ /// `application/x-www-form-urlencoded' format
+ /// </remarks>
+ public string UrlDecode(string s) {
+ return HttpUtility.UrlDecode(s);
+ }
+
+ /// <summary>
+ /// Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s"></param>
+ /// <param name="output"></param>
+ public void UrlDecode(string s, TextWriter output) {
+ output.Write(UrlDecode(s));
+ }
+
+ /// <summary>
+ /// URL-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text to URL-encode. </param>
+ /// <returns>The URL encoded text.</returns>
+ public string UrlEncode(string s) {
+ return HttpUtility.UrlEncode(s);
+ }
+
+ /// <summary>
+ /// URL encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public void UrlEncode(string s, TextWriter output) {
+ output.Write(UrlEncode(s));
+ }
+
+ /// <summary>
+ /// URL-encodes the path portion of a URL string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text to URL-encode.</param>
+ /// <returns>The URL encoded text.</returns>
+ /// <remarks>Does not do any browser specific adjustments, just encode everything</remarks>
+ public string UrlPathEncode(string s) {
+ // find the path portion (?)
+ int idx = s.IndexOf("?");
+ string s2 = s.Substring(0, idx-1);
+ s2 = UrlEncode(s2);
+ s2 += s.Substring(idx);
+
+ return s2;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
new file mode 100644
index 00000000000..d2027061ea2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpStaticObjectsCollection : ICollection, IEnumerable {
+ private Hashtable _Objects;
+
+ // Needs to hold object items that can be latebound and can be serialized
+ public HttpStaticObjectsCollection() {
+ _Objects = new Hashtable();
+ }
+
+ public object GetObject(string name) {
+ return this[name];
+ }
+
+ public IEnumerator GetEnumerator() {
+ return _Objects.GetEnumerator ();
+ }
+
+ public void CopyTo(Array array, int index) {
+ _Objects.CopyTo (array, index);
+ }
+
+ internal IDictionary GetObjects() {
+ return _Objects;
+ }
+
+ public object this[string name] {
+ get {
+ return _Objects [name];
+ }
+ }
+
+ public int Count {
+ get {
+ return _Objects.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return this;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpUnhandledException.cs b/mcs/class/System.Web/System.Web/HttpUnhandledException.cs
new file mode 100644
index 00000000000..bb411bdf6f1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpUnhandledException.cs
@@ -0,0 +1,28 @@
+//
+// System.Web.HttpUnhandledException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Web {
+ public sealed class HttpUnhandledException : HttpException {
+
+ #region Constructors
+
+ internal HttpUnhandledException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ [MonoTODO ("What does this do?")]
+ internal HttpUnhandledException (string message, string x, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs
new file mode 100644
index 00000000000..280dba10fc8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpUtility.cs
@@ -0,0 +1,777 @@
+//
+// System.Web.HttpUtility
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Wictor Wilén (decode/encode functions) (wictor@ibizkit.se)
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+using System;
+using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Web.Util;
+
+namespace System.Web {
+ public sealed class HttpUtility {
+
+ #region Fields
+
+ const string _hex = "0123456789ABCDEF";
+ const string _chars = "<>;:.?=&@*+%/\\";
+ static Hashtable entities;
+ static string buildingHtmlEntityReferences = "Building HTML entity reference table.";
+
+ #endregion // Fields
+
+ #region Constructors
+
+ static HttpUtility ()
+ {
+ lock (buildingHtmlEntityReferences) {
+ // Build the hash table of HTML entity references. This list comes
+ // from the HTML 4.01 W3C recommendation.
+ entities = new Hashtable ();
+ entities.Add ("nbsp", '\u00A0');
+ entities.Add ("iexcl", '\u00A1');
+ entities.Add ("cent", '\u00A2');
+ entities.Add ("pound", '\u00A3');
+ entities.Add ("curren", '\u00A4');
+ entities.Add ("yen", '\u00A5');
+ entities.Add ("brvbar", '\u00A6');
+ entities.Add ("sect", '\u00A7');
+ entities.Add ("uml", '\u00A8');
+ entities.Add ("copy", '\u00A9');
+ entities.Add ("ordf", '\u00AA');
+ entities.Add ("laquo", '\u00AB');
+ entities.Add ("not", '\u00AC');
+ entities.Add ("shy", '\u00AD');
+ entities.Add ("reg", '\u00AE');
+ entities.Add ("macr", '\u00AF');
+ entities.Add ("deg", '\u00B0');
+ entities.Add ("plusmn", '\u00B1');
+ entities.Add ("sup2", '\u00B2');
+ entities.Add ("sup3", '\u00B3');
+ entities.Add ("acute", '\u00B4');
+ entities.Add ("micro", '\u00B5');
+ entities.Add ("para", '\u00B6');
+ entities.Add ("middot", '\u00B7');
+ entities.Add ("cedil", '\u00B8');
+ entities.Add ("sup1", '\u00B9');
+ entities.Add ("ordm", '\u00BA');
+ entities.Add ("raquo", '\u00BB');
+ entities.Add ("frac14", '\u00BC');
+ entities.Add ("frac12", '\u00BD');
+ entities.Add ("frac34", '\u00BE');
+ entities.Add ("iquest", '\u00BF');
+ entities.Add ("Agrave", '\u00C0');
+ entities.Add ("Aacute", '\u00C1');
+ entities.Add ("Acirc", '\u00C2');
+ entities.Add ("Atilde", '\u00C3');
+ entities.Add ("Auml", '\u00C4');
+ entities.Add ("Aring", '\u00C5');
+ entities.Add ("AElig", '\u00C6');
+ entities.Add ("Ccedil", '\u00C7');
+ entities.Add ("Egrave", '\u00C8');
+ entities.Add ("Eacute", '\u00C9');
+ entities.Add ("Ecirc", '\u00CA');
+ entities.Add ("Euml", '\u00CB');
+ entities.Add ("Igrave", '\u00CC');
+ entities.Add ("Iacute", '\u00CD');
+ entities.Add ("Icirc", '\u00CE');
+ entities.Add ("Iuml", '\u00CF');
+ entities.Add ("ETH", '\u00D0');
+ entities.Add ("Ntilde", '\u00D1');
+ entities.Add ("Ograve", '\u00D2');
+ entities.Add ("Oacute", '\u00D3');
+ entities.Add ("Ocirc", '\u00D4');
+ entities.Add ("Otilde", '\u00D5');
+ entities.Add ("Ouml", '\u00D6');
+ entities.Add ("times", '\u00D7');
+ entities.Add ("Oslash", '\u00D8');
+ entities.Add ("Ugrave", '\u00D9');
+ entities.Add ("Uacute", '\u00DA');
+ entities.Add ("Ucirc", '\u00DB');
+ entities.Add ("Uuml", '\u00DC');
+ entities.Add ("Yacute", '\u00DD');
+ entities.Add ("THORN", '\u00DE');
+ entities.Add ("szlig", '\u00DF');
+ entities.Add ("agrave", '\u00E0');
+ entities.Add ("aacute", '\u00E1');
+ entities.Add ("acirc", '\u00E2');
+ entities.Add ("atilde", '\u00E3');
+ entities.Add ("auml", '\u00E4');
+ entities.Add ("aring", '\u00E5');
+ entities.Add ("aelig", '\u00E6');
+ entities.Add ("ccedil", '\u00E7');
+ entities.Add ("egrave", '\u00E8');
+ entities.Add ("eacute", '\u00E9');
+ entities.Add ("ecirc", '\u00EA');
+ entities.Add ("euml", '\u00EB');
+ entities.Add ("igrave", '\u00EC');
+ entities.Add ("iacute", '\u00ED');
+ entities.Add ("icirc", '\u00EE');
+ entities.Add ("iuml", '\u00EF');
+ entities.Add ("eth", '\u00F0');
+ entities.Add ("ntilde", '\u00F1');
+ entities.Add ("ograve", '\u00F2');
+ entities.Add ("oacute", '\u00F3');
+ entities.Add ("ocirc", '\u00F4');
+ entities.Add ("otilde", '\u00F5');
+ entities.Add ("ouml", '\u00F6');
+ entities.Add ("divide", '\u00F7');
+ entities.Add ("oslash", '\u00F8');
+ entities.Add ("ugrave", '\u00F9');
+ entities.Add ("uacute", '\u00FA');
+ entities.Add ("ucirc", '\u00FB');
+ entities.Add ("uuml", '\u00FC');
+ entities.Add ("yacute", '\u00FD');
+ entities.Add ("thorn", '\u00FE');
+ entities.Add ("yuml", '\u00FF');
+ entities.Add ("fnof", '\u0192');
+ entities.Add ("Alpha", '\u0391');
+ entities.Add ("Beta", '\u0392');
+ entities.Add ("Gamma", '\u0393');
+ entities.Add ("Delta", '\u0394');
+ entities.Add ("Epsilon", '\u0395');
+ entities.Add ("Zeta", '\u0396');
+ entities.Add ("Eta", '\u0397');
+ entities.Add ("Theta", '\u0398');
+ entities.Add ("Iota", '\u0399');
+ entities.Add ("Kappa", '\u039A');
+ entities.Add ("Lambda", '\u039B');
+ entities.Add ("Mu", '\u039C');
+ entities.Add ("Nu", '\u039D');
+ entities.Add ("Xi", '\u039E');
+ entities.Add ("Omicron", '\u039F');
+ entities.Add ("Pi", '\u03A0');
+ entities.Add ("Rho", '\u03A1');
+ entities.Add ("Sigma", '\u03A3');
+ entities.Add ("Tau", '\u03A4');
+ entities.Add ("Upsilon", '\u03A5');
+ entities.Add ("Phi", '\u03A6');
+ entities.Add ("Chi", '\u03A7');
+ entities.Add ("Psi", '\u03A8');
+ entities.Add ("Omega", '\u03A9');
+ entities.Add ("alpha", '\u03B1');
+ entities.Add ("beta", '\u03B2');
+ entities.Add ("gamma", '\u03B3');
+ entities.Add ("delta", '\u03B4');
+ entities.Add ("epsilon", '\u03B5');
+ entities.Add ("zeta", '\u03B6');
+ entities.Add ("eta", '\u03B7');
+ entities.Add ("theta", '\u03B8');
+ entities.Add ("iota", '\u03B9');
+ entities.Add ("kappa", '\u03BA');
+ entities.Add ("lambda", '\u03BB');
+ entities.Add ("mu", '\u03BC');
+ entities.Add ("nu", '\u03BD');
+ entities.Add ("xi", '\u03BE');
+ entities.Add ("omicron", '\u03BF');
+ entities.Add ("pi", '\u03C0');
+ entities.Add ("rho", '\u03C1');
+ entities.Add ("sigmaf", '\u03C2');
+ entities.Add ("sigma", '\u03C3');
+ entities.Add ("tau", '\u03C4');
+ entities.Add ("upsilon", '\u03C5');
+ entities.Add ("phi", '\u03C6');
+ entities.Add ("chi", '\u03C7');
+ entities.Add ("psi", '\u03C8');
+ entities.Add ("omega", '\u03C9');
+ entities.Add ("thetasym", '\u03D1');
+ entities.Add ("upsih", '\u03D2');
+ entities.Add ("piv", '\u03D6');
+ entities.Add ("bull", '\u2022');
+ entities.Add ("hellip", '\u2026');
+ entities.Add ("prime", '\u2032');
+ entities.Add ("Prime", '\u2033');
+ entities.Add ("oline", '\u203E');
+ entities.Add ("frasl", '\u2044');
+ entities.Add ("weierp", '\u2118');
+ entities.Add ("image", '\u2111');
+ entities.Add ("real", '\u211C');
+ entities.Add ("trade", '\u2122');
+ entities.Add ("alefsym", '\u2135');
+ entities.Add ("larr", '\u2190');
+ entities.Add ("uarr", '\u2191');
+ entities.Add ("rarr", '\u2192');
+ entities.Add ("darr", '\u2193');
+ entities.Add ("harr", '\u2194');
+ entities.Add ("crarr", '\u21B5');
+ entities.Add ("lArr", '\u21D0');
+ entities.Add ("uArr", '\u21D1');
+ entities.Add ("rArr", '\u21D2');
+ entities.Add ("dArr", '\u21D3');
+ entities.Add ("hArr", '\u21D4');
+ entities.Add ("forall", '\u2200');
+ entities.Add ("part", '\u2202');
+ entities.Add ("exist", '\u2203');
+ entities.Add ("empty", '\u2205');
+ entities.Add ("nabla", '\u2207');
+ entities.Add ("isin", '\u2208');
+ entities.Add ("notin", '\u2209');
+ entities.Add ("ni", '\u220B');
+ entities.Add ("prod", '\u220F');
+ entities.Add ("sum", '\u2211');
+ entities.Add ("minus", '\u2212');
+ entities.Add ("lowast", '\u2217');
+ entities.Add ("radic", '\u221A');
+ entities.Add ("prop", '\u221D');
+ entities.Add ("infin", '\u221E');
+ entities.Add ("ang", '\u2220');
+ entities.Add ("and", '\u2227');
+ entities.Add ("or", '\u2228');
+ entities.Add ("cap", '\u2229');
+ entities.Add ("cup", '\u222A');
+ entities.Add ("int", '\u222B');
+ entities.Add ("there4", '\u2234');
+ entities.Add ("sim", '\u223C');
+ entities.Add ("cong", '\u2245');
+ entities.Add ("asymp", '\u2248');
+ entities.Add ("ne", '\u2260');
+ entities.Add ("equiv", '\u2261');
+ entities.Add ("le", '\u2264');
+ entities.Add ("ge", '\u2265');
+ entities.Add ("sub", '\u2282');
+ entities.Add ("sup", '\u2283');
+ entities.Add ("nsub", '\u2284');
+ entities.Add ("sube", '\u2286');
+ entities.Add ("supe", '\u2287');
+ entities.Add ("oplus", '\u2295');
+ entities.Add ("otimes", '\u2297');
+ entities.Add ("perp", '\u22A5');
+ entities.Add ("sdot", '\u22C5');
+ entities.Add ("lceil", '\u2308');
+ entities.Add ("rceil", '\u2309');
+ entities.Add ("lfloor", '\u230A');
+ entities.Add ("rfloor", '\u230B');
+ entities.Add ("lang", '\u2329');
+ entities.Add ("rang", '\u232A');
+ entities.Add ("loz", '\u25CA');
+ entities.Add ("spades", '\u2660');
+ entities.Add ("clubs", '\u2663');
+ entities.Add ("hearts", '\u2665');
+ entities.Add ("diams", '\u2666');
+ entities.Add ("quot", '\u0022');
+ entities.Add ("amp", '\u0026');
+ entities.Add ("lt", '\u003C');
+ entities.Add ("gt", '\u003E');
+ entities.Add ("OElig", '\u0152');
+ entities.Add ("oelig", '\u0153');
+ entities.Add ("Scaron", '\u0160');
+ entities.Add ("scaron", '\u0161');
+ entities.Add ("Yuml", '\u0178');
+ entities.Add ("circ", '\u02C6');
+ entities.Add ("tilde", '\u02DC');
+ entities.Add ("ensp", '\u2002');
+ entities.Add ("emsp", '\u2003');
+ entities.Add ("thinsp", '\u2009');
+ entities.Add ("zwnj", '\u200C');
+ entities.Add ("zwj", '\u200D');
+ entities.Add ("lrm", '\u200E');
+ entities.Add ("rlm", '\u200F');
+ entities.Add ("ndash", '\u2013');
+ entities.Add ("mdash", '\u2014');
+ entities.Add ("lsquo", '\u2018');
+ entities.Add ("rsquo", '\u2019');
+ entities.Add ("sbquo", '\u201A');
+ entities.Add ("ldquo", '\u201C');
+ entities.Add ("rdquo", '\u201D');
+ entities.Add ("bdquo", '\u201E');
+ entities.Add ("dagger", '\u2020');
+ entities.Add ("Dagger", '\u2021');
+ entities.Add ("permil", '\u2030');
+ entities.Add ("lsaquo", '\u2039');
+ entities.Add ("rsaquo", '\u203A');
+ entities.Add ("euro", '\u20AC');
+ }
+ }
+
+ public HttpUtility ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public static void HtmlAttributeEncode (string s, TextWriter output)
+ {
+ output.Write(HtmlAttributeEncode(s));
+ }
+
+ public static string HtmlAttributeEncode (string s)
+ {
+ if (null == s)
+ return null;
+
+ StringBuilder output = new StringBuilder ();
+
+ foreach (char c in s)
+ switch (c) {
+ case '&' :
+ output.Append ("&amp;");
+ break;
+ case '"' :
+ output.Append ("&quot;");
+ break;
+ default:
+ output.Append (c);
+ break;
+ }
+
+ return output.ToString();
+ }
+
+ public static string UrlDecode (string str)
+ {
+ return UrlDecode(str, WebEncoding.Encoding);
+ }
+
+ private static char [] GetChars (ArrayList b, Encoding e)
+ {
+ byte [] bytes = (byte []) b.ToArray (typeof (byte));
+ return e.GetChars (bytes);
+ }
+
+ public static string UrlDecode (string s, Encoding e)
+ {
+ if (null == s)
+ return null;
+
+ if (e == null)
+ e = WebEncoding.Encoding;
+
+ StringBuilder output = new StringBuilder ();
+ long len = s.Length;
+ NumberStyles hexa = NumberStyles.HexNumber;
+ ArrayList bytes = new ArrayList ();
+ char [] chars;
+
+ for (int i = 0; i < len; i++) {
+ if (s [i] == '%' && i + 2 < len) {
+ if (s [i + 1] == 'u' && i + 5 < len) {
+ if (bytes.Count > 0) {
+ chars = GetChars (bytes, e);
+ output.Append (chars);
+ bytes.Clear ();
+ }
+ output.Append ((char) Int32.Parse (s.Substring (i + 2, 4), hexa));
+ i += 5;
+ } else {
+ bytes.Add ((byte) Int32.Parse (s.Substring (i + 1, 2), hexa));
+ i += 2;
+ }
+ }
+ else {
+ if (bytes.Count > 0) {
+ chars = GetChars (bytes, e);
+ output.Append (chars);
+ bytes.Clear ();
+ }
+
+ if (s [i] == '+') {
+ output.Append (' ');
+ } else {
+ output.Append (s [i]);
+ }
+ }
+ }
+
+ if (bytes.Count > 0) {
+ chars = GetChars (bytes, e);
+ output.Append (chars);
+ }
+
+ return output.ToString ();
+ }
+
+ public static string UrlDecode (byte [] bytes, Encoding e)
+ {
+ if (bytes == null)
+ return null;
+
+ return UrlDecode (bytes, 0, bytes.Length, e);
+ }
+
+ private static int GetInt (byte b)
+ {
+ char c = Char.ToUpper ((char) b);
+ if (c >= '0' && c <= '9')
+ return c - '0';
+
+ if (c < 'A' || c > 'F')
+ return 0;
+
+ return (c - 'A' + 10);
+ }
+
+ private static char GetChar (byte [] bytes, int offset, int length)
+ {
+ int value = 0;
+ int end = length + offset;
+ for (int i = offset; i < end; i++)
+ value = (value << 4) + GetInt (bytes [offset]);
+
+ return (char) value;
+ }
+
+ public static string UrlDecode (byte [] bytes, int offset, int count, Encoding e)
+ {
+ if (bytes == null || count == 0)
+ return null;
+
+ if (bytes == null)
+ throw new ArgumentNullException ("bytes");
+
+ if (offset < 0 || offset > bytes.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (count < 0 || offset + count > bytes.Length)
+ throw new ArgumentOutOfRangeException ("count");
+
+ StringBuilder output = new StringBuilder ();
+ ArrayList byteArray = new ArrayList ();
+ char [] chars;
+
+ int end = count + offset;
+ for (int i = offset; i < end; i++) {
+ if (bytes [i] == '%' && i + 2 < count) {
+ if (bytes [i + 1] == (byte) 'u' && i + 5 < end) {
+ if (byteArray.Count > 0) {
+ chars = GetChars (byteArray, e);
+ output.Append (chars);
+ byteArray.Clear ();
+ }
+ output.Append (GetChar (bytes, offset + 2, 4));
+ i += 5;
+ } else {
+ byteArray.Add ((byte) GetChar (bytes, offset + 1, 2));
+ i += 2;
+ }
+ } else {
+ if (byteArray.Count > 0) {
+ chars = GetChars (byteArray, e);
+ output.Append (chars);
+ byteArray.Clear ();
+ }
+
+ if (bytes [i] == '+') {
+ output.Append (' ');
+ } else {
+ output.Append ((char) bytes [i]);
+ }
+ }
+ }
+
+ if (byteArray.Count > 0) {
+ chars = GetChars (byteArray, e);
+ output.Append (chars);
+ }
+
+ return output.ToString ();
+ }
+
+ public static byte [] UrlDecodeToBytes (byte [] bytes)
+ {
+ if (bytes == null)
+ return null;
+
+ return UrlDecodeToBytes (bytes, 0, bytes.Length);
+ }
+
+ public static byte [] UrlDecodeToBytes (string str)
+ {
+ return UrlDecodeToBytes (str, WebEncoding.Encoding);
+ }
+
+ public static byte [] UrlDecodeToBytes (string str, Encoding e)
+ {
+ if (str == null)
+ return null;
+
+ if (e == null)
+ throw new ArgumentNullException ("e");
+
+ return UrlDecodeToBytes (e.GetBytes (str));
+ }
+
+ public static byte [] UrlDecodeToBytes (byte [] bytes, int offset, int count)
+ {
+ if (bytes == null)
+ return null;
+
+ int len = bytes.Length;
+ if (offset < 0 || offset >= len)
+ throw new ArgumentOutOfRangeException("offset");
+
+ if (count < 0 || offset <= len - count)
+ throw new ArgumentOutOfRangeException("count");
+
+ ArrayList result = new ArrayList ();
+ int end = offset + count;
+ for (int i = offset; i < end; i++){
+ char c = (char) bytes [i];
+ if (c == '+')
+ c = ' ';
+ else if (c == '%' && i < end - 2) {
+ c = GetChar (bytes, i, 2);
+ i += 2;
+ }
+ result.Add ((byte) c);
+ }
+
+ return (byte []) result.ToArray (typeof (byte));
+ }
+
+ public static string UrlEncode(string str)
+ {
+ return UrlEncode(str, WebEncoding.Encoding);
+ }
+
+ public static string UrlEncode (string s, Encoding Enc)
+ {
+ if (s == null)
+ return null;
+
+ byte [] bytes = Enc.GetBytes (s);
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
+ }
+
+ public static string UrlEncode (byte [] bytes)
+ {
+ if (bytes == null)
+ return null;
+
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
+ }
+
+ public static string UrlEncode (byte [] bytes, int offset, int count)
+ {
+ if (bytes == null)
+ return null;
+
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, offset, count));
+ }
+
+ public static byte [] UrlEncodeToBytes (string str)
+ {
+ return UrlEncodeToBytes (str, WebEncoding.Encoding);
+ }
+
+ public static byte [] UrlEncodeToBytes (string str, Encoding e)
+ {
+ if (str == null)
+ return null;
+
+ byte [] bytes = e.GetBytes (str);
+ return UrlEncodeToBytes (bytes, 0, bytes.Length);
+ }
+
+ public static byte [] UrlEncodeToBytes (byte [] bytes)
+ {
+ if (bytes == null)
+ return null;
+
+ return UrlEncodeToBytes (bytes, 0, bytes.Length);
+ }
+
+ static char [] hexChars = "0123456789ABCDEF".ToCharArray ();
+
+ public static byte [] UrlEncodeToBytes (byte [] bytes, int offset, int count)
+ {
+ if (bytes == null)
+ return null;
+
+ int len = bytes.Length;
+ if (offset < 0 || offset >= len)
+ throw new ArgumentOutOfRangeException("offset");
+
+ if (count < 0 || offset < len - count)
+ throw new ArgumentOutOfRangeException("count");
+
+ ArrayList result = new ArrayList ();
+ int end = offset + count;
+ for (int i = offset; i < end; i++) {
+ char c = (char) bytes [i];
+ if (c == ' ')
+ result.Add ((byte) '+');
+ else if ((c < '0' && c != '-' && c != '.') ||
+ (c < 'A' && c > '9') ||
+ (c > 'Z' && c < 'a' && c != '_') ||
+ (c > 'z')) {
+ result.Add ((byte) '%');
+ int idx = ((int) c) >> 4;
+ result.Add ((byte) hexChars [idx]);
+ idx = ((int) c) & 0x0F;
+ result.Add ((byte) hexChars [idx]);
+ } else {
+ result.Add ((byte) c);
+ }
+ }
+
+ return (byte []) result.ToArray (typeof (byte));
+ }
+
+ public static string UrlEncodeUnicode (string str)
+ {
+ if (str == null)
+ return null;
+
+ StringBuilder result = new StringBuilder ();
+ int end = str.Length;
+ for (int i = 0; i < end; i++) {
+ int idx;
+ char c = str [i];
+ if (c == ' ') {
+ result.Append ('+');
+ continue;
+ }
+
+ if (c > 255) {
+ result.Append ("%u");
+ idx = ((int) c) >> 24;
+ result.Append (hexChars [idx]);
+ idx = (((int) c) >> 16) & 0x0F;
+ result.Append (hexChars [idx]);
+ idx = (((int) c) >> 8) & 0x0F;
+ result.Append (hexChars [idx]);
+ idx = ((int) c) & 0x0F;
+ result.Append (hexChars [idx]);
+ continue;
+ }
+
+ if ((c < '0' && c != '-' && c != '.') ||
+ (c < 'A' && c > '9') ||
+ (c > 'Z' && c < 'a' && c != '_') ||
+ (c > 'z')) {
+ result.Append ('%');
+ idx = ((int) c) >> 4;
+ result.Append (hexChars [idx]);
+ idx = ((int) c) & 0x0F;
+ result.Append (hexChars [idx]);
+ continue;
+ }
+
+ result.Append (c);
+ }
+
+ return result.ToString ();
+ }
+
+ public static byte [] UrlEncodeUnicodeToBytes (string str)
+ {
+ if (str == null)
+ return null;
+
+ return Encoding.ASCII.GetBytes (UrlEncodeUnicode (str));
+ }
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The HTML string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ public static string HtmlDecode (string s)
+ {
+ bool insideEntity = false; // used to indicate that we are in a potential entity
+ string entity = String.Empty;
+ StringBuilder output = new StringBuilder ();
+
+ foreach (char c in s) {
+ switch (c) {
+ case '&' :
+ output.Append (entity);
+ entity = "&";
+ insideEntity = true;
+ break;
+ case ';' :
+ if (!insideEntity) {
+ output.Append (c);
+ break;
+ }
+
+ entity += c;
+ int length = entity.Length;
+ if (length >= 2 && entity[1] == '#' && entity[2] != ';')
+ entity = ((char) Int32.Parse (entity.Substring (2, entity.Length - 3))).ToString();
+ else if (length > 1 && entities.ContainsKey (entity.Substring (1, entity.Length - 2)))
+ entity = entities [entity.Substring (1, entity.Length - 2)].ToString ();
+
+ output.Append (entity);
+ entity = String.Empty;
+ insideEntity = false;
+ break;
+ default :
+ if (insideEntity)
+ entity += c;
+ else
+ output.Append (c);
+ break;
+ }
+ }
+ output.Append (entity);
+ return output.ToString ();
+ }
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The HTML string to decode</param>
+ /// <param name="output">The TextWriter output stream containing the decoded string. </param>
+ public static void HtmlDecode(string s, TextWriter output)
+ {
+ output.Write (HtmlDecode (s));
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <returns>The HTML-encoded text.</returns>
+ public static string HtmlEncode (string s)
+ {
+ StringBuilder output = new StringBuilder ();
+
+ foreach (char c in s)
+ switch (c) {
+ case '&' :
+ output.Append ("&amp;");
+ break;
+ case '>' :
+ output.Append ("&gt;");
+ break;
+ case '<' :
+ output.Append ("&lt;");
+ break;
+ case '"' :
+ output.Append ("&quot;");
+ break;
+ default:
+ if ((int) c > 128) {
+ output.Append ("&#");
+ output.Append (((int) c).ToString ());
+ output.Append (";");
+ }
+ else
+ output.Append (c);
+ break;
+ }
+ return output.ToString ();
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public static void HtmlEncode(string s, TextWriter output)
+ {
+ output.Write (HtmlEncode (s));
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpValidationStatus.cs b/mcs/class/System.Web/System.Web/HttpValidationStatus.cs
new file mode 100644
index 00000000000..0933b9a6737
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpValidationStatus.cs
@@ -0,0 +1,17 @@
+//
+// System.Web.HttpValidationStatus.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum HttpValidationStatus {
+ Invalid = 0x1,
+ IgnoreThisRequest,
+ Valid
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpValueCollection.cs b/mcs/class/System.Web/System.Web/HttpValueCollection.cs
new file mode 100644
index 00000000000..a120094cbea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpValueCollection.cs
@@ -0,0 +1,192 @@
+//
+// System.Web.HttpValueCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+using System;
+using System.Collections.Specialized;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Web.Util;
+
+namespace System.Web
+{
+ [Serializable]
+ class HttpValueCollection : NameValueCollection
+ {
+ bool _bHeaders;
+
+ internal HttpValueCollection ()
+ {
+ _bHeaders = false;
+ }
+
+ internal HttpValueCollection (string sData)
+ {
+ FillFromQueryString (sData, WebEncoding.Encoding);
+ IsReadOnly = true;
+ }
+
+ internal HttpValueCollection(string sData, bool ReadOnly, Encoding encoding)
+ {
+ FillFromQueryString (sData, encoding);
+ IsReadOnly = ReadOnly;
+ }
+
+ protected HttpValueCollection (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // string = header1: value1\r\nheader2: value2
+ internal void FillFromHeaders (string sHeaders, Encoding encoding)
+ {
+ _bHeaders = true;
+ char [] arrSplitValue = new char [] {':'};
+ string sKey, sValue;
+
+ sKey = "";
+ sValue = "";
+
+ string [] arrValues = sHeaders.Split (new char [] {'\r', '\n'});
+ foreach (string sLine in arrValues) {
+ string [] arrKeyValue = sLine.Split (arrSplitValue);
+ if (arrKeyValue.Length == 1 && arrKeyValue [0].Length == 0) {
+ // Empty \r or \n is ignored
+ continue;
+ }
+
+ if (arrKeyValue[0] != sKey && sKey.Length > 0) {
+ Add (HttpUtility.UrlDecode (sKey, encoding),
+ HttpUtility.UrlDecode (sValue, encoding));
+ }
+
+ if (arrKeyValue.Length == 1) {
+ sValue += "\r\n" + arrKeyValue [0].Trim();
+ continue;
+ } else if (arrKeyValue.Length == 2) {
+ if (arrKeyValue[0].Length == 0) {
+ sValue += arrKeyValue [1].Trim();
+ continue;
+ }
+
+ sKey = arrKeyValue [0].Trim();
+ sValue = arrKeyValue [1].Trim();
+ }
+ }
+
+ if (sKey.Length > 0) {
+ Add (HttpUtility.UrlDecode (sKey, encoding),
+ HttpUtility.UrlDecode (sValue, encoding));
+ }
+ }
+
+ internal void FillFromHeaders (string sData)
+ {
+ FillFromHeaders (sData, WebEncoding.Encoding);
+ }
+
+ // String = test=aaa&kalle=nisse
+ internal void FillFromQueryString (string sData, Encoding encoding)
+ {
+ _bHeaders = false;
+
+ string k, v;
+ int eq;
+ string [] arrValues = sData.Split (new char [] {'&'});
+ foreach (string sValue in arrValues) {
+ eq = sValue.IndexOf ('=');
+ if (eq == 0)
+ throw new InvalidOperationException ("Data is malformed");
+
+ if (eq == -1) {
+ k = HttpUtility.UrlDecode (sValue.Trim (), encoding);
+ Add (k, String.Empty);
+ continue;
+ }
+
+ k = sValue.Substring (0, eq).Trim ();
+ if (k.Length == 0)
+ throw new InvalidOperationException ("Data is malformed");
+
+ v = String.Empty;
+ if (eq + 1 < sValue.Length) {
+ v = sValue.Substring (eq + 1).Trim ();
+ if (v.Length == 0)
+ v = String.Empty;
+ }
+
+ k = HttpUtility.UrlDecode (k, encoding);
+ if (v.Length > 0)
+ v = HttpUtility.UrlDecode (v, encoding);
+
+ Add (k, v);
+ }
+ }
+
+ internal void FillFromQueryString (string sData)
+ {
+ FillFromQueryString (sData, WebEncoding.Encoding);
+ }
+
+ internal void FillFromCookieString (string sData)
+ {
+ FillFromQueryString (sData, WebEncoding.Encoding);
+ }
+
+ internal void MakeReadOnly ()
+ {
+ IsReadOnly = true;
+ }
+
+ internal void MakeReadWrite ()
+ {
+ IsReadOnly = false;
+ }
+
+ internal void Merge (NameValueCollection oData)
+ {
+ foreach (string sKey in oData)
+ Add (sKey, oData [sKey]);
+ }
+
+ internal void Reset ()
+ {
+ Clear ();
+ }
+
+ internal string ToString (bool UrlEncode)
+ {
+ StringBuilder result = new StringBuilder ();
+ string eq = (_bHeaders ? ":" : "=");
+ string separator = (_bHeaders ? "\r\n" : "&");
+
+ foreach (string strKey in AllKeys) {
+
+ if (result.Length > 0)
+ result.Append (separator);
+
+ if (UrlEncode) {
+ // use encoding
+ result.Append (HttpUtility.UrlEncode (strKey, WebEncoding.Encoding));
+ result.Append (eq);
+ result.Append (HttpUtility.UrlEncode (Get (strKey), WebEncoding.Encoding));
+ } else {
+ result.Append (strKey);
+ result.Append (eq);
+ result.Append (Get (strKey));
+ }
+ }
+
+ return result.ToString ();
+ }
+
+ virtual new public string ToString ()
+ {
+ return ToString (false);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs b/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
new file mode 100644
index 00000000000..4eede54bbf2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
@@ -0,0 +1,529 @@
+//
+// System.Web.HttpWorkerRequest
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (constants from Bob Smith (bob@thestuff.net))
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Patrik Torstensson
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.Web
+{
+ public abstract class HttpWorkerRequest : IHttpMapPath
+ {
+ public delegate void EndOfSendNotification (HttpWorkerRequest wr, object extraData);
+
+ public const int HeaderAccept = 20;
+ public const int HeaderAcceptCharset = 21;
+ public const int HeaderAcceptEncoding = 22;
+ public const int HeaderAcceptLanguage = 23;
+ public const int HeaderAcceptRanges = 20;
+ public const int HeaderAge = 21;
+ public const int HeaderAllow = 10;
+ public const int HeaderAuthorization = 24;
+ public const int HeaderCacheControl = 0;
+ public const int HeaderConnection = 1;
+ public const int HeaderContentEncoding = 13;
+ public const int HeaderContentLanguage = 14;
+ public const int HeaderContentLength = 11;
+ public const int HeaderContentLocation = 15;
+ public const int HeaderContentMd5 = 16;
+ public const int HeaderContentRange = 17;
+ public const int HeaderContentType = 12;
+ public const int HeaderCookie = 25;
+ public const int HeaderDate = 2;
+ public const int HeaderEtag = 22;
+ public const int HeaderExpect = 26;
+ public const int HeaderExpires = 18;
+ public const int HeaderFrom = 27;
+ public const int HeaderHost = 28;
+ public const int HeaderIfMatch = 29;
+ public const int HeaderIfModifiedSince = 30;
+ public const int HeaderIfNoneMatch = 31;
+ public const int HeaderIfRange = 32;
+ public const int HeaderIfUnmodifiedSince = 33;
+ public const int HeaderKeepAlive = 3;
+ public const int HeaderLastModified = 19;
+ public const int HeaderLocation = 23;
+ public const int HeaderMaxForwards = 34;
+ public const int HeaderPragma = 4;
+ public const int HeaderProxyAuthenticate = 24;
+ public const int HeaderProxyAuthorization = 35;
+ public const int HeaderRange = 37;
+ public const int HeaderReferer = 36;
+ public const int HeaderRetryAfter = 25;
+ public const int HeaderServer = 26;
+ public const int HeaderSetCookie = 27;
+ public const int HeaderTe = 38;
+ public const int HeaderTrailer = 5;
+ public const int HeaderTransferEncoding = 6;
+ public const int HeaderUpgrade = 7;
+ public const int HeaderUserAgent = 39;
+ public const int HeaderVary = 28;
+ public const int HeaderVia = 8;
+ public const int HeaderWarning = 9;
+ public const int HeaderWwwAuthenticate = 29;
+ public const int ReasonCachePolicy = 2;
+ public const int ReasonCacheSecurity = 3;
+ public const int ReasonClientDisconnect = 4;
+ public const int ReasonDefault = 0;
+ public const int ReasonFileHandleCacheMiss = 1;
+ public const int ReasonResponseCacheMiss = 0;
+ public const int RequestHeaderMaximum = 40;
+ public const int ResponseHeaderMaximum = 30;
+
+ static string [][] s_HttpStatusDescriptions;
+ static string [] s_HttpRequestHeaderNames;
+ static string [] s_HttpResponseHeaderNames;
+
+ static Hashtable s_HttpResponseHeadersTable;
+ static Hashtable s_HttpRequestHeaderTable;
+
+ static HttpWorkerRequest ()
+ {
+ string [] sSubCodes;
+
+ s_HttpStatusDescriptions = new string [6][];
+
+ sSubCodes = new String [3];
+ sSubCodes [0] = "Continue";
+ sSubCodes [1] = "Switching Protocols";
+ sSubCodes [2] = "Processing";
+ s_HttpStatusDescriptions [1] = sSubCodes;
+
+ sSubCodes = new String [8];
+ sSubCodes [0] = "OK";
+ sSubCodes [1] = "Created";
+ sSubCodes [2] = "Accepted";
+ sSubCodes [3] = "Non-Authoritative Information";
+ sSubCodes [4] = "No Content";
+ sSubCodes [5] = "Reset Content";
+ sSubCodes [6] = "Partial Content";
+ sSubCodes [7] = "Multi-Status";
+ s_HttpStatusDescriptions [2] = sSubCodes;
+
+ sSubCodes = new String [8];
+ sSubCodes [0] = "Multiple Choices";
+ sSubCodes [1] = "Moved Permanently";
+ sSubCodes [2] = "Found";
+ sSubCodes [3] = "See Other";
+ sSubCodes [4] = "Not Modified";
+ sSubCodes [5] = "Use Proxy";
+ sSubCodes [6] = String.Empty;
+ sSubCodes [7] = "Temporary Redirect";
+ s_HttpStatusDescriptions [3] = sSubCodes;
+
+ sSubCodes = new String [24];
+ sSubCodes [0] = "Bad Request";
+ sSubCodes [1] = "Unauthorized";
+ sSubCodes [2] = "Payment Required";
+ sSubCodes [3] = "Forbidden";
+ sSubCodes [4] = "Not Found";
+ sSubCodes [5] = "Method Not Allowed";
+ sSubCodes [6] = "Not Acceptable";
+ sSubCodes [7] = "Proxy Authentication Required";
+ sSubCodes [8] = "Request Timeout";
+ sSubCodes [9] = "Conflict";
+ sSubCodes [10] = "Gone";
+ sSubCodes [11] = "Length Required";
+ sSubCodes [12] = "Precondition Failed";
+ sSubCodes [13] = "Request Entity Too Large";
+ sSubCodes [14] = "Request-Uri Too Long";
+ sSubCodes [15] = "Unsupported Media Type";
+ sSubCodes [16] = "Requested Range Not Satisfiable";
+ sSubCodes [17] = "Expectation Failed";
+ sSubCodes [18] = String.Empty;
+ sSubCodes [19] = String.Empty;
+ sSubCodes [20] = String.Empty;
+ sSubCodes [21] = "Unprocessable Entity";
+ sSubCodes [22] = "Locked";
+ sSubCodes [23] = "Failed Dependency";
+ s_HttpStatusDescriptions [4] = sSubCodes;
+
+ sSubCodes = new String [8];
+ sSubCodes [0] = "Internal Server Error";
+ sSubCodes [1] = "Not Implemented";
+ sSubCodes [2] = "Bad Gateway";
+ sSubCodes [3] = "Service Unavailable";
+ sSubCodes [4] = "Gateway Timeout";
+ sSubCodes [5] = "Http Version Not Supported";
+ sSubCodes [6] = String.Empty;
+ sSubCodes [7] = "Insufficient Storage";
+ s_HttpStatusDescriptions [5] = sSubCodes;
+
+ InitLookupTables ();
+ }
+
+ protected HttpWorkerRequest ()
+ {
+ }
+
+ static private void InitLookupTables ()
+ {
+ // Performance arrays
+ s_HttpRequestHeaderNames = new string [40];
+ s_HttpResponseHeaderNames = new string [30];
+
+ // Lookup tables (name -> id)
+ s_HttpRequestHeaderTable = new Hashtable ();
+ s_HttpResponseHeadersTable = new Hashtable ();
+
+ AddHeader (true, true, 0, "Cache-Control");
+ AddHeader (true, true, 1, "Connection");
+ AddHeader (true, true, 2, "Date");
+ AddHeader (true, true, 3, "Keep-Alive");
+ AddHeader (true, true, 4, "Pragma");
+ AddHeader (true, true, 5, "Trailer");
+ AddHeader (true, true, 6, "Transfer-Encoding");
+ AddHeader (true, true, 7, "Upgrade");
+ AddHeader (true, true, 8, "Via");
+ AddHeader (true, true, 9, "Warning");
+ AddHeader (true, true, 10, "Allow");
+ AddHeader (true, true, 11, "Content-Length");
+ AddHeader (true, true, 12, "Content-Type");
+ AddHeader (true, true, 13, "Content-Encoding");
+ AddHeader (true, true, 14, "Content-Language");
+ AddHeader (true, true, 15, "Content-Location");
+ AddHeader (true, true, 16, "Content-MD5");
+ AddHeader (true, true, 17, "Content-Range");
+ AddHeader (true, true, 18, "Expires");
+ AddHeader (true, true, 19, "Last-Modified");
+ AddHeader (true, false, 20, "Accept");
+ AddHeader (true, false, 21, "Accept-Charset");
+ AddHeader (true, false, 22, "Accept-Encoding");
+ AddHeader (true, false, 23, "Accept-Language");
+ AddHeader (true, false, 24, "Authorization");
+ AddHeader (true, false, 25, "Cookie");
+ AddHeader (true, false, 26, "Expect");
+ AddHeader (true, false, 27, "From");
+ AddHeader (true, false, 28, "Host");
+ AddHeader (true, false, 29, "If-Match");
+ AddHeader (true, false, 30, "If-Modified-Since");
+ AddHeader (true, false, 31, "If-None-Match");
+ AddHeader (true, false, 32, "If-Range");
+ AddHeader (true, false, 33, "If-Unmodified-Since");
+ AddHeader (true, false, 34, "Max-Forwards");
+ AddHeader (true, false, 35, "Proxy-Authorization");
+ AddHeader (true, false, 36, "Referer");
+ AddHeader (true, false, 37, "Range");
+ AddHeader (true, false, 38, "TE");
+ AddHeader (true, false, 39, "User-Agent");
+ AddHeader (false, true, 20, "Accept-Ranges");
+ AddHeader (false, true, 21, "Age");
+ AddHeader (false, true, 22, "ETag");
+ AddHeader (false, true, 23, "Location");
+ AddHeader (false, true, 24, "Proxy-Authenticate");
+ AddHeader (false, true, 25, "Retry-After");
+ AddHeader (false, true, 26, "Server");
+ AddHeader (false, true, 27, "Set-Cookie");
+ AddHeader (false, true, 28, "Vary");
+ AddHeader (false, true, 29, "WWW-Authenticate");
+ }
+
+ static private void AddHeader(bool bRequest, bool bResponse, int iID, string sHeader)
+ {
+ if (bResponse) {
+ s_HttpResponseHeaderNames [iID] = sHeader;
+ s_HttpResponseHeadersTable.Add (sHeader, iID);
+ }
+
+ if (bRequest) {
+ s_HttpRequestHeaderNames [iID] = sHeader;
+ s_HttpRequestHeaderTable.Add (sHeader, iID);
+ }
+ }
+
+ public virtual void CloseConnection ()
+ {
+ }
+
+ public abstract void EndOfRequest ();
+ public abstract void FlushResponse (bool finalFlush);
+
+ public virtual string GetAppPath ()
+ {
+ return null;
+ }
+
+ public virtual string GetAppPathTranslated ()
+ {
+ return null;
+ }
+
+ public virtual string GetAppPoolID ()
+ {
+ return null;
+ }
+
+ public virtual long GetBytesRead ()
+ {
+ return 0;
+ }
+
+ public virtual byte[] GetClientCertificate ()
+ {
+ return new byte[0];
+ }
+
+ public virtual byte[] GetClientCertificateBinaryIssuer ()
+ {
+ return new byte[0];
+ }
+
+ public virtual int GetClientCertificateEncoding ()
+ {
+ return 0;
+ }
+
+ public virtual byte[] GetClientCertificatePublicKey ()
+ {
+ return new byte[0];
+ }
+
+ public virtual DateTime GetClientCertificateValidFrom ()
+ {
+ return DateTime.Now;
+ }
+
+ public virtual DateTime GetClientCertificateValidUntil ()
+ {
+ return DateTime.Now;
+ }
+
+ public virtual long GetConnectionID ()
+ {
+ return 0;
+ }
+
+ public virtual string GetFilePath ()
+ {
+ return GetUriPath();
+ }
+
+ public virtual string GetFilePathTranslated ()
+ {
+ return null;
+ }
+
+ public abstract string GetHttpVerbName ();
+ public abstract string GetHttpVersion ();
+
+ public virtual string GetKnownRequestHeader (int index)
+ {
+ return null;
+ }
+
+ public static int GetKnownRequestHeaderIndex (string header)
+ {
+ object index;
+ index = s_HttpRequestHeaderTable [header];
+ if (null != index)
+ return (Int32) index;
+
+ return -1;
+ }
+
+ public static string GetKnownRequestHeaderName (int index)
+ {
+ return s_HttpRequestHeaderNames [index];
+ }
+
+ public static int GetKnownResponseHeaderIndex (string header)
+ {
+ object index;
+
+ index = s_HttpResponseHeadersTable [header];
+ if (null != index)
+ return (Int32) index;
+
+ return -1;
+ }
+
+ public static string GetKnownResponseHeaderName(int index)
+ {
+ return s_HttpResponseHeaderNames [index];
+ }
+
+ public abstract string GetLocalAddress ();
+ public abstract int GetLocalPort ();
+
+ public virtual string GetPathInfo ()
+ {
+ return String.Empty;
+ }
+
+ public virtual byte [] GetPreloadedEntityBody ()
+ {
+ return null;
+ }
+
+ public virtual string GetProtocol ()
+ {
+ return (IsSecure ()) ? "https" : "http";
+ }
+
+ public abstract string GetQueryString ();
+
+ public virtual byte[] GetQueryStringRawBytes ()
+ {
+ return null;
+ }
+
+ public abstract string GetRawUrl ();
+ public abstract string GetRemoteAddress ();
+
+ public virtual string GetRemoteName ()
+ {
+ return GetRemoteAddress();
+ }
+
+ public abstract int GetRemotePort ();
+
+ public virtual int GetRequestReason ()
+ {
+ return 0;
+ }
+
+ public virtual string GetServerName ()
+ {
+ return GetLocalAddress();
+ }
+
+ public virtual string GetServerVariable (string name)
+ {
+ return null;
+ }
+
+ public static string GetStatusDescription (int code)
+ {
+ if (code>= 100 && code < 600) {
+ int iMajor = code / 100;
+ int iMinor = code % 100;
+ if (iMinor < (int) s_HttpStatusDescriptions [iMajor].Length)
+ return s_HttpStatusDescriptions [iMajor][iMinor];
+ }
+
+ return String.Empty;
+ }
+
+ public virtual string GetUnknownRequestHeader (string name)
+ {
+ return null;
+ }
+
+ [CLSCompliant(false)]
+ public virtual string [][] GetUnknownRequestHeaders ()
+ {
+ return null;
+ }
+
+ public abstract string GetUriPath ();
+
+ public virtual long GetUrlContextID ()
+ {
+ return 0;
+ }
+
+ public virtual IntPtr GetUserToken ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual IntPtr GetVirtualPathToken ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public bool HasEntityBody ()
+ {
+ string sContentLength = GetKnownRequestHeader (HeaderContentLength);
+ if (null != sContentLength && sContentLength != "0")
+ return true;
+
+ if (null != GetKnownRequestHeader (HeaderTransferEncoding))
+ return true;
+
+ if (null != GetPreloadedEntityBody () || IsEntireEntityBodyIsPreloaded ())
+ return true;
+
+ return false;
+ }
+
+ public virtual bool HeadersSent ()
+ {
+ return true;
+ }
+
+ public virtual bool IsClientConnected ()
+ {
+ return true;
+ }
+
+ public virtual bool IsEntireEntityBodyIsPreloaded ()
+ {
+ return false;
+ }
+
+ public virtual bool IsSecure ()
+ {
+ return false;
+ }
+
+ public virtual string MapPath (string virtualPath)
+ {
+ return null;
+ }
+
+ public virtual int ReadEntityBody (byte[] buffer, int size)
+ {
+ return 0;
+ }
+
+ public virtual void SendCalculatedContentLength (int contentLength)
+ {
+ }
+
+ public abstract void SendKnownResponseHeader (int index, string value);
+ public abstract void SendResponseFromFile (IntPtr handle, long offset, long length);
+ public abstract void SendResponseFromFile (string filename, long offset, long length);
+ public abstract void SendResponseFromMemory (byte [] data, int length);
+
+ public virtual void SendResponseFromMemory (IntPtr data, int length)
+ {
+ if (length <= 0)
+ return;
+
+ byte [] dataBytes = new byte [length];
+ Marshal.Copy (data, dataBytes, 0, length);
+ SendResponseFromMemory (dataBytes, length);
+ }
+
+ public abstract void SendStatus (int statusCode, string statusDescription);
+ public abstract void SendUnknownResponseHeader (string name, string value);
+
+ public virtual void SetEndOfSendNotification (EndOfSendNotification callback, object extraData)
+ {
+ }
+
+ public virtual string MachineConfigPath
+ {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string MachineInstallDirectory
+ {
+ get {
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpWriter.cs b/mcs/class/System.Web/System.Web/HttpWriter.cs
new file mode 100644
index 00000000000..55e62ac2842
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpWriter.cs
@@ -0,0 +1,209 @@
+//
+// System.Web.HttpWriter
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+using System.Text;
+using System.Web.Util;
+
+namespace System.Web
+{
+ public sealed class HttpWriter : TextWriter
+ {
+ HttpResponse _Response;
+
+ HttpResponseStream _ResponseStream;
+
+ MemoryStream _OutputStream;
+ StreamWriter _OutputHelper;
+ Encoder _Encoder;
+ Encoding _Encoding;
+
+ Stream _OutputFilter;
+ HttpResponseStreamProxy _OutputProxy;
+
+ internal HttpWriter (HttpResponse Response)
+ {
+ _Response = Response;
+
+ _OutputStream = new MemoryStream (32768);
+ _OutputHelper = new StreamWriter (_OutputStream, WebEncoding.Encoding);
+ _ResponseStream = new HttpResponseStream (this);
+
+ Update ();
+ }
+
+ internal void Dispose ()
+ {
+ _OutputHelper.Close ();
+ _OutputStream.Close ();
+ _OutputFilter.Close ();
+ }
+
+ internal Stream GetActiveFilter ()
+ {
+ if (null == _OutputFilter) {
+ // Create a filter proxy to allow us to know if we have a valid filter
+ if (null == _OutputProxy)
+ _OutputProxy = new HttpResponseStreamProxy (this);
+
+ return _OutputProxy;
+ }
+ return _OutputFilter;
+ }
+
+ internal void ActivateFilter (Stream OutputFilter)
+ {
+ if (null == _OutputProxy)
+ throw new HttpException ("Invalid filter usage");
+
+ _OutputFilter = OutputFilter;
+ }
+
+ internal void FilterData (bool CloseStream)
+ {
+ // Check if we have any filter at all
+ if (null == _OutputFilter)
+ return;
+
+ FlushBuffers ();
+
+ // Save our current data
+ byte [] arrData = _OutputStream.ToArray ();
+
+ // Remove our internal data
+ Clear ();
+
+ // If we have a filter then we have a proxy
+ _OutputProxy.Active = true;
+
+ try {
+ // Call the filter (it does a callback into our HttpWriter again)
+ _OutputFilter.Write (arrData, 0, arrData.Length);
+
+ if (CloseStream)
+ _OutputFilter.Close ();
+ } finally {
+ _OutputProxy.Active = false;
+ }
+ }
+
+ internal void Clear ()
+ {
+ _OutputHelper.Close ();
+ _OutputStream.Close ();
+
+ // Quick way of doing cleanup
+ _OutputStream = new MemoryStream (32768);
+ _OutputHelper = new StreamWriter (_OutputStream, WebEncoding.Encoding);
+ }
+
+ internal void SendContent (HttpWorkerRequest Handler)
+ {
+ FlushBuffers();
+
+ int l = (int)_OutputStream.Length;
+ if (l > 0) {
+ byte [] arrContent = _OutputStream.ToArray ();
+ Handler.SendResponseFromMemory (arrContent, l);
+ }
+ }
+
+ internal void Update ()
+ {
+ _Encoder = _Response.ContentEncoder;
+ _Encoding = _Response.ContentEncoding;
+ }
+
+ internal long BufferSize
+ {
+ get {
+ FlushBuffers ();
+ return _OutputStream.Length;
+ }
+ }
+
+ internal void FlushBuffers ()
+ {
+ _OutputHelper.Flush ();
+ _OutputStream.Flush ();
+ }
+
+ public override Encoding Encoding
+ {
+ get { return _Encoding; }
+ }
+
+ public Stream OutputStream
+ {
+ get { return _ResponseStream; }
+ }
+
+ public override void Close ()
+ {
+ FlushBuffers ();
+ _Response.Flush ();
+ _Response.Close ();
+ }
+
+ public override void Flush ()
+ {
+ FlushBuffers ();
+ _Response.Flush ();
+ }
+
+ private void CheckIfFlush ()
+ {
+ if (!_Response.BufferOutput) {
+ FlushBuffers ();
+ _Response.Flush ();
+ }
+ }
+
+ public override void Write (char ch)
+ {
+ _OutputHelper.Write (ch);
+ CheckIfFlush ();
+ }
+
+ public override void Write (object obj)
+ {
+ _OutputHelper.Write (obj.ToString ());
+ CheckIfFlush ();
+ }
+
+ public override void Write (string s)
+ {
+ _OutputHelper.Write (s);
+ CheckIfFlush ();
+ }
+
+ public override void Write (char [] buffer, int index, int count)
+ {
+ _OutputHelper.Write (buffer, index, count);
+ CheckIfFlush ();
+ }
+
+ public void WriteBytes (byte [] buffer, int index, int count)
+ {
+ _OutputStream.Write (buffer, index, count);
+ CheckIfFlush ();
+ }
+
+ public override void WriteLine ()
+ {
+ _OutputHelper.Write ("\r\n");
+ CheckIfFlush ();
+ }
+
+ public void WriteString (string s, int index, int count)
+ {
+ _OutputHelper.Write (s.Substring (index, count));
+ CheckIfFlush ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs b/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
new file mode 100644
index 00000000000..06e62cba463
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.IHttpAsyncHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web
+{
+ public interface IHttpAsyncHandler : IHttpHandler
+ {
+ IAsyncResult BeginProcessRequest(HttpContext context,
+ AsyncCallback cb,
+ object extraData);
+ void EndProcessRequest(IAsyncResult result);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpHandler.cs b/mcs/class/System.Web/System.Web/IHttpHandler.cs
new file mode 100644
index 00000000000..8bad2c1b1bd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.IHttpHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web
+{
+ public interface IHttpHandler
+ {
+ bool IsReusable { get; }
+ void ProcessRequest(HttpContext context);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs b/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
new file mode 100644
index 00000000000..b8cc4a3d2c5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.IHttpHandlerFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web
+{
+ public interface IHttpHandlerFactory
+ {
+ IHttpHandler GetHandler(HttpContext context,
+ string requestType,
+ string url,
+ string pathTranslated);
+ void ReleaseHandler(IHttpHandler handler);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpMapPath.cs b/mcs/class/System.Web/System.Web/IHttpMapPath.cs
new file mode 100644
index 00000000000..933ffb47336
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpMapPath.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.IHttpMapPath
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Web
+{
+ interface IHttpMapPath
+ {
+ string MapPath (string path);
+ string MachineConfigPath { get; }
+ }
+
+}
+
diff --git a/mcs/class/System.Web/System.Web/IHttpModule.cs b/mcs/class/System.Web/System.Web/IHttpModule.cs
new file mode 100644
index 00000000000..a98d2f54d29
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpModule.cs
@@ -0,0 +1,14 @@
+//
+// System.Web.IHttpModule.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web {
+ public interface IHttpModule {
+ void Dispose();
+ void Init(HttpApplication context);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/MimeTypes.cs b/mcs/class/System.Web/System.Web/MimeTypes.cs
new file mode 100644
index 00000000000..ff267d853c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/MimeTypes.cs
@@ -0,0 +1,471 @@
+//
+// System.Web.MimeTypes
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web
+{
+ class MimeTypes
+ {
+ static Hashtable mimeTypes;
+
+ static MimeTypes ()
+ {
+ mimeTypes = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+
+ mimeTypes.Add ("3dm", "x-world/x-3dmf");
+ mimeTypes.Add ("3dmf", "x-world/x-3dmf");
+ mimeTypes.Add ("aab", "application/x-authorware-bin");
+ mimeTypes.Add ("aam", "application/x-authorware-map");
+ mimeTypes.Add ("aas", "application/x-authorware-seg");
+ mimeTypes.Add ("abc", "text/vnd.abc");
+ mimeTypes.Add ("acgi", "text/html");
+ mimeTypes.Add ("afl", "video/animaflex");
+ mimeTypes.Add ("ai", "application/postscript");
+ mimeTypes.Add ("aif", "audio/aiff");
+ mimeTypes.Add ("aifc", "audio/aiff");
+ mimeTypes.Add ("aiff", "audio/aiff");
+ mimeTypes.Add ("aim", "application/x-aim");
+ mimeTypes.Add ("aip", "text/x-audiosoft-intra");
+ mimeTypes.Add ("ani", "application/x-navi-animation");
+ mimeTypes.Add ("aos", "application/x-nokia-9000-communicator-add-on-software");
+ mimeTypes.Add ("aps", "application/mime");
+ mimeTypes.Add ("art", "image/x-jg");
+ mimeTypes.Add ("asf", "video/x-ms-asf");
+ mimeTypes.Add ("asm", "text/x-asm");
+ mimeTypes.Add ("asp", "text/asp");
+ mimeTypes.Add ("asx", "application/x-mplayer2");
+ mimeTypes.Add ("au", "audio/x-au");
+ mimeTypes.Add ("avi", "video/avi");
+ mimeTypes.Add ("avs", "video/avs-video");
+ mimeTypes.Add ("bcpio", "application/x-bcpio");
+ mimeTypes.Add ("bm", "image/bmp");
+ mimeTypes.Add ("bmp", "image/bmp");
+ mimeTypes.Add ("boo", "application/book");
+ mimeTypes.Add ("book", "application/book");
+ mimeTypes.Add ("boz", "application/x-bzip2");
+ mimeTypes.Add ("bsh", "application/x-bsh");
+ mimeTypes.Add ("bz", "application/x-bzip");
+ mimeTypes.Add ("bz2", "application/x-bzip2");
+ mimeTypes.Add ("c", "text/plain");
+ mimeTypes.Add ("c++", "text/plain");
+ mimeTypes.Add ("cat", "application/vnd.ms-pki.seccat");
+ mimeTypes.Add ("cc", "text/plain");
+ mimeTypes.Add ("ccad", "application/clariscad");
+ mimeTypes.Add ("cco", "application/x-cocoa");
+ mimeTypes.Add ("cdf", "application/cdf");
+ mimeTypes.Add ("cer", "application/pkix-cert");
+ mimeTypes.Add ("cha", "application/x-chat");
+ mimeTypes.Add ("chat", "application/x-chat");
+ mimeTypes.Add ("class", "application/java");
+ mimeTypes.Add ("conf", "text/plain");
+ mimeTypes.Add ("cpio", "application/x-cpio");
+ mimeTypes.Add ("cpp", "text/plain");
+ mimeTypes.Add ("cpt", "application/x-cpt");
+ mimeTypes.Add ("crl", "application/pkix-crl");
+ mimeTypes.Add ("crt", "application/pkix-cert");
+ mimeTypes.Add ("csh", "application/x-csh");
+ mimeTypes.Add ("css", "text/css");
+ mimeTypes.Add ("cxx", "text/plain");
+ mimeTypes.Add ("dcr", "application/x-director");
+ mimeTypes.Add ("deepv", "application/x-deepv");
+ mimeTypes.Add ("def", "text/plain");
+ mimeTypes.Add ("der", "application/x-x509-ca-cert");
+ mimeTypes.Add ("dif", "video/x-dv");
+ mimeTypes.Add ("dir", "application/x-director");
+ mimeTypes.Add ("dl", "video/dl");
+ mimeTypes.Add ("doc", "application/msword");
+ mimeTypes.Add ("dot", "application/msword");
+ mimeTypes.Add ("dp", "application/commonground");
+ mimeTypes.Add ("drw", "application/drafting");
+ mimeTypes.Add ("dv", "video/x-dv");
+ mimeTypes.Add ("dvi", "application/x-dvi");
+ mimeTypes.Add ("dwf", "drawing/x-dwf (old)");
+ mimeTypes.Add ("dwg", "application/acad");
+ mimeTypes.Add ("dxf", "application/dxf");
+ mimeTypes.Add ("dxr", "application/x-director");
+ mimeTypes.Add ("el", "text/x-script.elisp");
+ mimeTypes.Add ("elc", "application/x-elc");
+ mimeTypes.Add ("eps", "application/postscript");
+ mimeTypes.Add ("es", "application/x-esrehber");
+ mimeTypes.Add ("etx", "text/x-setext");
+ mimeTypes.Add ("evy", "application/envoy");
+ mimeTypes.Add ("f", "text/plain");
+ mimeTypes.Add ("f77", "text/plain");
+ mimeTypes.Add ("f90", "text/plain");
+ mimeTypes.Add ("fdf", "application/vnd.fdf");
+ mimeTypes.Add ("fif", "image/fif");
+ mimeTypes.Add ("fli", "video/fli");
+ mimeTypes.Add ("flo", "image/florian");
+ mimeTypes.Add ("flx", "text/vnd.fmi.flexstor");
+ mimeTypes.Add ("fmf", "video/x-atomic3d-feature");
+ mimeTypes.Add ("for", "text/plain");
+ mimeTypes.Add ("fpx", "image/vnd.fpx");
+ mimeTypes.Add ("frl", "application/freeloader");
+ mimeTypes.Add ("funk", "audio/make");
+ mimeTypes.Add ("g", "text/plain");
+ mimeTypes.Add ("g3", "image/g3fax");
+ mimeTypes.Add ("gif", "image/gif");
+ mimeTypes.Add ("gl", "video/gl");
+ mimeTypes.Add ("gsd", "audio/x-gsm");
+ mimeTypes.Add ("gsm", "audio/x-gsm");
+ mimeTypes.Add ("gsp", "application/x-gsp");
+ mimeTypes.Add ("gss", "application/x-gss");
+ mimeTypes.Add ("gtar", "application/x-gtar");
+ mimeTypes.Add ("gz", "application/x-gzip");
+ mimeTypes.Add ("gzip", "application/x-gzip");
+ mimeTypes.Add ("h", "text/plain");
+ mimeTypes.Add ("hdf", "application/x-hdf");
+ mimeTypes.Add ("help", "application/x-helpfile");
+ mimeTypes.Add ("hgl", "application/vnd.hp-HPGL");
+ mimeTypes.Add ("hh", "text/plain");
+ mimeTypes.Add ("hlb", "text/x-script");
+ mimeTypes.Add ("hlp", "application/x-helpfile");
+ mimeTypes.Add ("hpg", "application/vnd.hp-HPGL");
+ mimeTypes.Add ("hpgl", "application/vnd.hp-HPGL");
+ mimeTypes.Add ("hqx", "application/binhex");
+ mimeTypes.Add ("hta", "application/hta");
+ mimeTypes.Add ("htc", "text/x-component");
+ mimeTypes.Add ("htm", "text/html");
+ mimeTypes.Add ("html", "text/html");
+ mimeTypes.Add ("htmls", "text/html");
+ mimeTypes.Add ("htt", "text/webviewhtml");
+ mimeTypes.Add ("htx ", "text/html");
+ mimeTypes.Add ("ice ", "x-conference/x-cooltalk");
+ mimeTypes.Add ("ico", "image/x-icon");
+ mimeTypes.Add ("idc", "text/plain");
+ mimeTypes.Add ("ief", "image/ief");
+ mimeTypes.Add ("iefs", "image/ief");
+ mimeTypes.Add ("iges", "application/iges");
+ mimeTypes.Add ("igs", "application/iges");
+ mimeTypes.Add ("ima", "application/x-ima");
+ mimeTypes.Add ("imap", "application/x-httpd-imap");
+ mimeTypes.Add ("inf ", "application/inf");
+ mimeTypes.Add ("ins", "application/x-internett-signup");
+ mimeTypes.Add ("ip ", "application/x-ip2");
+ mimeTypes.Add ("isu", "video/x-isvideo");
+ mimeTypes.Add ("it", "audio/it");
+ mimeTypes.Add ("iv", "application/x-inventor");
+ mimeTypes.Add ("ivr", "i-world/i-vrml");
+ mimeTypes.Add ("ivy", "application/x-livescreen");
+ mimeTypes.Add ("jam ", "audio/x-jam");
+ mimeTypes.Add ("jav", "text/plain");
+ mimeTypes.Add ("java", "text/plain");
+ mimeTypes.Add ("jcm ", "application/x-java-commerce");
+ mimeTypes.Add ("jfif", "image/jpeg");
+ mimeTypes.Add ("jfif-tbnl", "image/jpeg");
+ mimeTypes.Add ("jpe", "image/jpeg");
+ mimeTypes.Add ("jpeg", "image/jpeg");
+ mimeTypes.Add ("jps", "image/x-jps");
+ mimeTypes.Add ("js ", "application/x-javascript");
+ mimeTypes.Add ("jut", "image/jutvision");
+ mimeTypes.Add ("kar", "audio/midi");
+ mimeTypes.Add ("ksh", "text/x-script.ksh");
+ mimeTypes.Add ("la ", "audio/nspaudio");
+ mimeTypes.Add ("lam", "audio/x-liveaudio");
+ mimeTypes.Add ("latex ", "application/x-latex");
+ mimeTypes.Add ("list", "text/plain");
+ mimeTypes.Add ("lma", "audio/nspaudio");
+ mimeTypes.Add ("log ", "text/plain");
+ mimeTypes.Add ("lsp ", "application/x-lisp");
+ mimeTypes.Add ("lst ", "text/plain");
+ mimeTypes.Add ("lsx", "text/x-la-asf");
+ mimeTypes.Add ("ltx", "application/x-latex");
+ mimeTypes.Add ("m", "text/plain");
+ mimeTypes.Add ("m1v", "video/mpeg");
+ mimeTypes.Add ("m2a", "audio/mpeg");
+ mimeTypes.Add ("m2v", "video/mpeg");
+ mimeTypes.Add ("m3u ", "audio/x-mpequrl");
+ mimeTypes.Add ("man", "application/x-troff-man");
+ mimeTypes.Add ("map", "application/x-navimap");
+ mimeTypes.Add ("mar", "text/plain");
+ mimeTypes.Add ("mbd", "application/mbedlet");
+ mimeTypes.Add ("mc$", "application/x-magic-cap-package-1.0");
+ mimeTypes.Add ("mcd", "application/mcad");
+ mimeTypes.Add ("mcf", "image/vasa");
+ mimeTypes.Add ("mcp", "application/netmc");
+ mimeTypes.Add ("me ", "application/x-troff-me");
+ mimeTypes.Add ("mht", "message/rfc822");
+ mimeTypes.Add ("mhtml", "message/rfc822");
+ mimeTypes.Add ("mid", "audio/midi");
+ mimeTypes.Add ("midi", "audio/midi");
+ mimeTypes.Add ("mif", "application/x-mif");
+ mimeTypes.Add ("mime ", "message/rfc822");
+ mimeTypes.Add ("mjf", "audio/x-vnd.AudioExplosion.MjuiceMediaFile");
+ mimeTypes.Add ("mjpg ", "video/x-motion-jpeg");
+ mimeTypes.Add ("mm", "application/base64");
+ mimeTypes.Add ("mme", "application/base64");
+ mimeTypes.Add ("mod", "audio/mod");
+ mimeTypes.Add ("moov", "video/quicktime");
+ mimeTypes.Add ("mov", "video/quicktime");
+ mimeTypes.Add ("movie", "video/x-sgi-movie");
+ mimeTypes.Add ("mp2", "video/mpeg");
+ mimeTypes.Add ("mp3", "audio/mpeg3");
+ mimeTypes.Add ("mpa", "audio/mpeg");
+ mimeTypes.Add ("mpc", "application/x-project");
+ mimeTypes.Add ("mpe", "video/mpeg");
+ mimeTypes.Add ("mpeg", "video/mpeg");
+ mimeTypes.Add ("mpg", "video/mpeg");
+ mimeTypes.Add ("mpga", "audio/mpeg");
+ mimeTypes.Add ("mpp", "application/vnd.ms-project");
+ mimeTypes.Add ("mpt", "application/x-project");
+ mimeTypes.Add ("mpv", "application/x-project");
+ mimeTypes.Add ("mpx", "application/x-project");
+ mimeTypes.Add ("mrc", "application/marc");
+ mimeTypes.Add ("ms", "application/x-troff-ms");
+ mimeTypes.Add ("mv", "video/x-sgi-movie");
+ mimeTypes.Add ("my", "audio/make");
+ mimeTypes.Add ("mzz", "application/x-vnd.AudioExplosion.mzz");
+ mimeTypes.Add ("nap", "image/naplps");
+ mimeTypes.Add ("naplps", "image/naplps");
+ mimeTypes.Add ("nc", "application/x-netcdf");
+ mimeTypes.Add ("ncm", "application/vnd.nokia.configuration-message");
+ mimeTypes.Add ("nif", "image/x-niff");
+ mimeTypes.Add ("niff", "image/x-niff");
+ mimeTypes.Add ("nix", "application/x-mix-transfer");
+ mimeTypes.Add ("nsc", "application/x-conference");
+ mimeTypes.Add ("nvd", "application/x-navidoc");
+ mimeTypes.Add ("oda", "application/oda");
+ mimeTypes.Add ("omc", "application/x-omc");
+ mimeTypes.Add ("omcd", "application/x-omcdatamaker");
+ mimeTypes.Add ("omcr", "application/x-omcregerator");
+ mimeTypes.Add ("p", "text/x-pascal");
+ mimeTypes.Add ("p10", "application/pkcs10");
+ mimeTypes.Add ("p12", "application/pkcs-12");
+ mimeTypes.Add ("p7a", "application/x-pkcs7-signature");
+ mimeTypes.Add ("p7c", "application/pkcs7-mime");
+ mimeTypes.Add ("p7m", "application/pkcs7-mime");
+ mimeTypes.Add ("p7r", "application/x-pkcs7-certreqresp");
+ mimeTypes.Add ("p7s", "application/pkcs7-signature");
+ mimeTypes.Add ("part ", "application/pro_eng");
+ mimeTypes.Add ("pas", "text/pascal");
+ mimeTypes.Add ("pbm ", "image/x-portable-bitmap");
+ mimeTypes.Add ("pcl", "application/x-pcl");
+ mimeTypes.Add ("pct", "image/x-pict");
+ mimeTypes.Add ("pcx", "image/x-pcx");
+ mimeTypes.Add ("pdb", "chemical/x-pdb");
+ mimeTypes.Add ("pdf", "application/pdf");
+ mimeTypes.Add ("pfunk", "audio/make");
+ mimeTypes.Add ("pgm", "image/x-portable-graymap");
+ mimeTypes.Add ("pic", "image/pict");
+ mimeTypes.Add ("pict", "image/pict");
+ mimeTypes.Add ("pkg", "application/x-newton-compatible-pkg");
+ mimeTypes.Add ("pko", "application/vnd.ms-pki.pko");
+ mimeTypes.Add ("pl", "text/plain");
+ mimeTypes.Add ("plx", "application/x-PiXCLscript");
+ mimeTypes.Add ("pm", "image/x-xpixmap");
+ mimeTypes.Add ("pm4 ", "application/x-pagemaker");
+ mimeTypes.Add ("pm5", "application/x-pagemaker");
+ mimeTypes.Add ("png", "image/png");
+ mimeTypes.Add ("pnm", "application/x-portable-anymap");
+ mimeTypes.Add ("pot", "application/mspowerpoint");
+ mimeTypes.Add ("pov", "model/x-pov");
+ mimeTypes.Add ("ppa", "application/vnd.ms-powerpoint");
+ mimeTypes.Add ("ppm", "image/x-portable-pixmap");
+ mimeTypes.Add ("pps", "application/mspowerpoint");
+ mimeTypes.Add ("ppt", "application/mspowerpoint");
+ mimeTypes.Add ("ppz", "application/mspowerpoint");
+ mimeTypes.Add ("pre", "application/x-freelance");
+ mimeTypes.Add ("prt", "application/pro_eng");
+ mimeTypes.Add ("ps", "application/postscript");
+ mimeTypes.Add ("pvu", "paleovu/x-pv");
+ mimeTypes.Add ("pwz ", "application/vnd.ms-powerpoint");
+ mimeTypes.Add ("py ", "text/x-script.phyton");
+ mimeTypes.Add ("pyc ", "applicaiton/x-bytecode.python");
+ mimeTypes.Add ("qcp ", "audio/vnd.qcelp");
+ mimeTypes.Add ("qd3 ", "x-world/x-3dmf");
+ mimeTypes.Add ("qd3d ", "x-world/x-3dmf");
+ mimeTypes.Add ("qif", "image/x-quicktime");
+ mimeTypes.Add ("qt", "video/quicktime");
+ mimeTypes.Add ("qtc", "video/x-qtc");
+ mimeTypes.Add ("qti", "image/x-quicktime");
+ mimeTypes.Add ("qtif", "image/x-quicktime");
+ mimeTypes.Add ("ra", "audio/x-pn-realaudio");
+ mimeTypes.Add ("ram", "audio/x-pn-realaudio");
+ mimeTypes.Add ("ras", "application/x-cmu-raster");
+ mimeTypes.Add ("rast", "image/cmu-raster");
+ mimeTypes.Add ("rexx ", "text/x-script.rexx");
+ mimeTypes.Add ("rf", "image/vnd.rn-realflash");
+ mimeTypes.Add ("rgb ", "image/x-rgb");
+ mimeTypes.Add ("rm", "application/vnd.rn-realmedia");
+ mimeTypes.Add ("rmi", "audio/mid");
+ mimeTypes.Add ("rmm ", "audio/x-pn-realaudio");
+ mimeTypes.Add ("rmp", "audio/x-pn-realaudio");
+ mimeTypes.Add ("rng", "application/ringing-tones");
+ mimeTypes.Add ("rnx ", "application/vnd.rn-realplayer");
+ mimeTypes.Add ("roff", "application/x-troff");
+ mimeTypes.Add ("rp ", "image/vnd.rn-realpix");
+ mimeTypes.Add ("rpm", "audio/x-pn-realaudio-plugin");
+ mimeTypes.Add ("rt", "text/richtext");
+ mimeTypes.Add ("rtf", "text/richtext");
+ mimeTypes.Add ("rtx", "text/richtext");
+ mimeTypes.Add ("rv", "video/vnd.rn-realvideo");
+ mimeTypes.Add ("s", "text/x-asm");
+ mimeTypes.Add ("s3m ", "audio/s3m");
+ mimeTypes.Add ("sbk ", "application/x-tbook");
+ mimeTypes.Add ("scm", "application/x-lotusscreencam");
+ mimeTypes.Add ("sdml", "text/plain");
+ mimeTypes.Add ("sdp ", "application/sdp");
+ mimeTypes.Add ("sdr", "application/sounder");
+ mimeTypes.Add ("sea", "application/sea");
+ mimeTypes.Add ("set", "application/set");
+ mimeTypes.Add ("sgm ", "text/sgml");
+ mimeTypes.Add ("sgml", "text/sgml");
+ mimeTypes.Add ("sh", "text/x-script.sh");
+ mimeTypes.Add ("shar", "application/x-bsh");
+ mimeTypes.Add ("shtml ", "text/html");
+ mimeTypes.Add ("sid", "audio/x-psid");
+ mimeTypes.Add ("sit", "application/x-sit");
+ mimeTypes.Add ("skd", "application/x-koan");
+ mimeTypes.Add ("skm ", "application/x-koan");
+ mimeTypes.Add ("skp ", "application/x-koan");
+ mimeTypes.Add ("skt ", "application/x-koan");
+ mimeTypes.Add ("sl ", "application/x-seelogo");
+ mimeTypes.Add ("smi ", "application/smil");
+ mimeTypes.Add ("smil ", "application/smil");
+ mimeTypes.Add ("snd", "audio/basic");
+ mimeTypes.Add ("sol", "application/solids");
+ mimeTypes.Add ("spc ", "application/x-pkcs7-certificates");
+ mimeTypes.Add ("spl", "application/futuresplash");
+ mimeTypes.Add ("spr", "application/x-sprite");
+ mimeTypes.Add ("sprite ", "application/x-sprite");
+ mimeTypes.Add ("src", "application/x-wais-source");
+ mimeTypes.Add ("ssi", "text/x-server-parsed-html");
+ mimeTypes.Add ("ssm ", "application/streamingmedia");
+ mimeTypes.Add ("sst", "application/vnd.ms-pki.certstore");
+ mimeTypes.Add ("step", "application/step");
+ mimeTypes.Add ("stl", "application/sla");
+ mimeTypes.Add ("stp", "application/step");
+ mimeTypes.Add ("sv4cpio", "application/x-sv4cpio");
+ mimeTypes.Add ("sv4crc", "application/x-sv4crc");
+ mimeTypes.Add ("svf", "image/x-dwg");
+ mimeTypes.Add ("svr", "application/x-world");
+ mimeTypes.Add ("swf", "application/x-shockwave-flash");
+ mimeTypes.Add ("t", "application/x-troff");
+ mimeTypes.Add ("talk", "text/x-speech");
+ mimeTypes.Add ("tar", "application/x-tar");
+ mimeTypes.Add ("tbk", "application/toolbook");
+ mimeTypes.Add ("tcl", "text/x-script.tcl");
+ mimeTypes.Add ("tcsh", "text/x-script.tcsh");
+ mimeTypes.Add ("tex", "application/x-tex");
+ mimeTypes.Add ("texi", "application/x-texinfo");
+ mimeTypes.Add ("texinfo", "application/x-texinfo");
+ mimeTypes.Add ("text", "text/plain");
+ mimeTypes.Add ("tgz", "application/x-compressed");
+ mimeTypes.Add ("tif", "image/tiff");
+ mimeTypes.Add ("tiff", "image/tiff");
+ mimeTypes.Add ("tr", "application/x-troff");
+ mimeTypes.Add ("tsi", "audio/tsp-audio");
+ mimeTypes.Add ("tsp", "audio/tsplayer");
+ mimeTypes.Add ("tsv", "text/tab-separated-values");
+ mimeTypes.Add ("turbot", "image/florian");
+ mimeTypes.Add ("txt", "text/plain");
+ mimeTypes.Add ("uil", "text/x-uil");
+ mimeTypes.Add ("uni", "text/uri-list");
+ mimeTypes.Add ("unis", "text/uri-list");
+ mimeTypes.Add ("unv", "application/i-deas");
+ mimeTypes.Add ("uri", "text/uri-list");
+ mimeTypes.Add ("uris", "text/uri-list");
+ mimeTypes.Add ("ustar", "multipart/x-ustar");
+ mimeTypes.Add ("uu", "text/x-uuencode");
+ mimeTypes.Add ("uue", "text/x-uuencode");
+ mimeTypes.Add ("vcd", "application/x-cdlink");
+ mimeTypes.Add ("vcs", "text/x-vCalendar");
+ mimeTypes.Add ("vda", "application/vda");
+ mimeTypes.Add ("vdo", "video/vdo");
+ mimeTypes.Add ("vew ", "application/groupwise");
+ mimeTypes.Add ("viv", "video/vivo");
+ mimeTypes.Add ("vivo", "video/vivo");
+ mimeTypes.Add ("vmd ", "application/vocaltec-media-desc");
+ mimeTypes.Add ("vmf", "application/vocaltec-media-file");
+ mimeTypes.Add ("voc", "audio/voc");
+ mimeTypes.Add ("vos", "video/vosaic");
+ mimeTypes.Add ("vox", "audio/voxware");
+ mimeTypes.Add ("vqe", "audio/x-twinvq-plugin");
+ mimeTypes.Add ("vqf", "audio/x-twinvq");
+ mimeTypes.Add ("vql", "audio/x-twinvq-plugin");
+ mimeTypes.Add ("vrml", "application/x-vrml");
+ mimeTypes.Add ("vrt", "x-world/x-vrt");
+ mimeTypes.Add ("vsd", "application/x-visio");
+ mimeTypes.Add ("vst", "application/x-visio");
+ mimeTypes.Add ("vsw ", "application/x-visio");
+ mimeTypes.Add ("w60", "application/wordperfect6.0");
+ mimeTypes.Add ("w61", "application/wordperfect6.1");
+ mimeTypes.Add ("w6w", "application/msword");
+ mimeTypes.Add ("wav", "audio/wav");
+ mimeTypes.Add ("wb1", "application/x-qpro");
+ mimeTypes.Add ("wbmp", "image/vnd.wap.wbmp");
+ mimeTypes.Add ("web", "application/vnd.xara");
+ mimeTypes.Add ("wiz", "application/msword");
+ mimeTypes.Add ("wk1", "application/x-123");
+ mimeTypes.Add ("wmf", "windows/metafile");
+ mimeTypes.Add ("wml", "text/vnd.wap.wml");
+ mimeTypes.Add ("wmlc ", "application/vnd.wap.wmlc");
+ mimeTypes.Add ("wmls", "text/vnd.wap.wmlscript");
+ mimeTypes.Add ("wmlsc ", "application/vnd.wap.wmlscriptc");
+ mimeTypes.Add ("word ", "application/msword");
+ mimeTypes.Add ("wp", "application/wordperfect");
+ mimeTypes.Add ("wp5", "application/wordperfect");
+ mimeTypes.Add ("wp6 ", "application/wordperfect");
+ mimeTypes.Add ("wpd", "application/wordperfect");
+ mimeTypes.Add ("wq1", "application/x-lotus");
+ mimeTypes.Add ("wri", "application/mswrite");
+ mimeTypes.Add ("wrl", "application/x-world");
+ mimeTypes.Add ("wrz", "model/vrml");
+ mimeTypes.Add ("wsc", "text/scriplet");
+ mimeTypes.Add ("wsrc", "application/x-wais-source");
+ mimeTypes.Add ("wtk ", "application/x-wintalk");
+ mimeTypes.Add ("xbm", "image/x-xbitmap");
+ mimeTypes.Add ("xdr", "video/x-amt-demorun");
+ mimeTypes.Add ("xgz", "xgl/drawing");
+ mimeTypes.Add ("xif", "image/vnd.xiff");
+ mimeTypes.Add ("xl", "application/excel");
+ mimeTypes.Add ("xla", "application/excel");
+ mimeTypes.Add ("xlb", "application/excel");
+ mimeTypes.Add ("xlc", "application/excel");
+ mimeTypes.Add ("xld ", "application/excel");
+ mimeTypes.Add ("xlk", "application/excel");
+ mimeTypes.Add ("xll", "application/excel");
+ mimeTypes.Add ("xlm", "application/excel");
+ mimeTypes.Add ("xls", "application/excel");
+ mimeTypes.Add ("xlt", "application/excel");
+ mimeTypes.Add ("xlv", "application/excel");
+ mimeTypes.Add ("xlw", "application/excel");
+ mimeTypes.Add ("xm", "audio/xm");
+ mimeTypes.Add ("xml", "text/xml");
+ mimeTypes.Add ("xmz", "xgl/movie");
+ mimeTypes.Add ("xpix", "application/x-vnd.ls-xpix");
+ mimeTypes.Add ("xpm", "image/xpm");
+ mimeTypes.Add ("x-png", "image/png");
+ mimeTypes.Add ("xsr", "video/x-amt-showrun");
+ mimeTypes.Add ("xwd", "image/x-xwd");
+ mimeTypes.Add ("xyz", "chemical/x-pdb");
+ mimeTypes.Add ("z", "application/x-compressed");
+ mimeTypes.Add ("zip", "application/zip");
+ mimeTypes.Add ("zsh", "text/x-script.zsh");
+ }
+
+ public static string GetMimeType (string fileName)
+ {
+ string result = null;
+ int dot = fileName.LastIndexOf ('.');
+
+ if (dot != -1 && fileName.Length > dot + 1)
+ result = mimeTypes [fileName.Substring (dot + 1)] as string;
+
+ if (result == null)
+ result = "application/octet-stream";
+
+ return result;
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/NOTES b/mcs/class/System.Web/System.Web/NOTES
new file mode 100644
index 00000000000..55926bd4ef9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/NOTES
@@ -0,0 +1,21 @@
+Found another namespace not listed. System.Web.Hosting.
+HttpRuntime.ProcessRequest and HttpWorkerRequest seems to be the key.
+
+ASP maintains a pool of HttpApplication objects dirived from Global.asax.
+One is used per request, then reclamed after the request is totally
+complete.
+
+Read:
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconaspnetapplications.asp
+
+
+Request notes:
+It apears each http request has its own thread. Need to figure out how to deal with this with apache.
+
+Session notes:
+When a request is finished, the contents of Request.Session are serialized and dumped to the State Server.
+When a request is started, a new Request.Session is created, data is deserialized from the State Server, and the objects are placed back into Request.Session.
+The State Server is accessed via the SessionStateModule which is used for both session ID and state data management.
+HttpApplicationState instance is created the first time a url within the applications virtual directory is accessed. Its accessable through HttpContext.Application.
+HttpApplicationState needs to use lock/unlock explicitly.
+Not shared across machines or multiple processes.
diff --git a/mcs/class/System.Web/System.Web/ProcessInfo.cs b/mcs/class/System.Web/System.Web/ProcessInfo.cs
new file mode 100644
index 00000000000..d9e8ec60421
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessInfo.cs
@@ -0,0 +1,90 @@
+//
+// System.Web.ProcessInfo
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+namespace System.Web {
+ public class ProcessInfo {
+
+ #region Fields
+
+ TimeSpan age;
+ int peakMemoryUsed;
+ int processID;
+ int requestCount;
+ ProcessShutdownReason shutdownReason;
+ DateTime startTime;
+ ProcessStatus status;
+
+ #endregion
+
+ #region Constructors
+
+ public ProcessInfo ()
+ {
+ }
+
+ public ProcessInfo (DateTime startTime, TimeSpan age, int processID, int requestCount, ProcessStatus status, ProcessShutdownReason shutdownReason, int peakMemoryUsed)
+ {
+ this.age = age;
+ this.peakMemoryUsed = peakMemoryUsed;
+ this.processID = processID;
+ this.requestCount = requestCount;
+ this.shutdownReason = shutdownReason;
+ this.startTime = startTime;
+ this.status = status;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public TimeSpan Age {
+ get { return age; }
+ }
+
+ public int PeakMemoryUsed {
+ get { return peakMemoryUsed; }
+ }
+
+ public int ProcessID {
+ get { return processID; }
+ }
+
+ public int RequestCount {
+ get { return requestCount; }
+ }
+
+ public ProcessShutdownReason ShutdownReason {
+ get { return shutdownReason; }
+ }
+
+ public DateTime StartTime {
+ get { return startTime; }
+ }
+
+ public ProcessStatus Status {
+ get { return status; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void SetAll (DateTime startTime, TimeSpan age, int processID, int requestCount, ProcessStatus status, ProcessShutdownReason shutdownReason, int peakMemoryUsed)
+ {
+ this.age = age;
+ this.peakMemoryUsed = peakMemoryUsed;
+ this.processID = processID;
+ this.requestCount = requestCount;
+ this.shutdownReason = shutdownReason;
+ this.startTime = startTime;
+ this.status = status;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/ProcessModelInfo.cs b/mcs/class/System.Web/System.Web/ProcessModelInfo.cs
new file mode 100644
index 00000000000..7d6f1f6a10b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessModelInfo.cs
@@ -0,0 +1,52 @@
+//
+// System.Web.ProcessModelInfo
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+
+using System;
+
+namespace System.Web {
+ public class ProcessModelInfo {
+
+ #region Fields
+
+ #endregion
+
+ #region Constructors
+
+ public ProcessModelInfo ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO ("Retrieve appropriate variables from worker")]
+ public static ProcessInfo GetCurrentProcessInfo ()
+ {
+ HttpContext httpContext;
+ DateTime startTime = DateTime.Now;
+ TimeSpan age = TimeSpan.Zero;
+ int processID = 0;
+ int requestCount = 0;
+ ProcessStatus status = ProcessStatus.Terminated;
+ ProcessShutdownReason shutdownReason = ProcessShutdownReason.None;
+ int peakMemoryUsed = 0;
+
+ httpContext = HttpContext.Current;
+ return new ProcessInfo (startTime, age, processID, requestCount, status, shutdownReason, peakMemoryUsed);
+ }
+
+ [MonoTODO ("Retrieve process information.")]
+ public static ProcessInfo[] GetHistory ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs b/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
new file mode 100644
index 00000000000..8dcb0783a69
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
@@ -0,0 +1,23 @@
+//
+// System.Web.ProcessShutdownReason.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ [Serializable]
+ public enum ProcessShutdownReason {
+ None,
+ Unexpected,
+ RequestsLimit,
+ RequestQueueLimit,
+ Timeout,
+ IdleTimeout,
+ MemoryLimitExceeded,
+ PingFailed,
+ DeadlockSuspected
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/ProcessStatus.cs b/mcs/class/System.Web/System.Web/ProcessStatus.cs
new file mode 100644
index 00000000000..a7897b54d3b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessStatus.cs
@@ -0,0 +1,17 @@
+//
+// System.Web.ProcessStatus.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ public enum ProcessStatus {
+ Alive = 0x1,
+ ShuttingDown,
+ ShutDown,
+ Terminated
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/StaticFileHandler.cs b/mcs/class/System.Web/System.Web/StaticFileHandler.cs
new file mode 100644
index 00000000000..463e9fd2e72
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/StaticFileHandler.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.StaticFileHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.IO;
+
+namespace System.Web
+{
+ class StaticFileHandler : IHttpHandler
+ {
+ public void ProcessRequest (HttpContext context)
+ {
+ HttpRequest request = context.Request;
+ HttpResponse response = context.Response;
+ string fileName = request.PhysicalPath;
+ FileInfo fi = new FileInfo (fileName);
+ if (!fi.Exists)
+ throw new HttpException (404, "File '" + fileName + "' does not exist");
+
+ if ((fi.Attributes & FileAttributes.Directory) != 0) {
+ response.Redirect (request.Path + '/');
+ return;
+ }
+
+ DateTime lastWT = fi.LastWriteTime;
+ try {
+ response.WriteFile (fileName);
+ response.ContentType = MimeTypes.GetMimeType (fileName);
+ } catch (Exception e) {
+ throw new HttpException (401, "Forbidden");
+ }
+ }
+
+ public bool IsReusable
+ {
+ get {
+ return true;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/TODO b/mcs/class/System.Web/System.Web/TODO
new file mode 100644
index 00000000000..4de26ec8397
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TODO
@@ -0,0 +1,19 @@
+HttpClientCertificate
+HttpApplicationState
+HttpFileCollection
+HttpModuleCollection
+HttpException
+HttpCompileException
+HttpParseException
+HttpUnhandledException
+HttpCapabilitiesBase
+HttpBrowserCapabilities
+HttpApplication
+HttpCachePolicy
+HttpCacheVaryByHeaders
+HttpCacheVaryByParams
+HttpPostedFile
+HttpStaticObjectsCollection
+ProcessInfo
+ProcessModelInfo
+TraceContext
diff --git a/mcs/class/System.Web/System.Web/TODOAttribute.cs b/mcs/class/System.Web/System.Web/TODOAttribute.cs
new file mode 100644
index 00000000000..e8d67ea5791
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Web {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs
new file mode 100644
index 00000000000..0708227547c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceContext.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.TraceContext
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ public sealed class TraceContext {
+ private HttpContext _Context;
+ private bool _Enabled;
+ private TraceMode _Mode;
+
+ public TraceContext(HttpContext Context) {
+ _Context = Context;
+ _Enabled = true;
+ }
+
+ public bool IsEnabled {
+ get {
+ return _Enabled;
+ }
+
+ set {
+ _Enabled = value;
+ }
+ }
+
+ public TraceMode TraceMode {
+ get {
+ return _Mode;
+ }
+
+ set {
+ _Mode = value;
+ }
+ }
+
+ public void Warn(string msg) {
+ Write(String.Empty, msg, null, true);
+ }
+
+ public void Warn(string category, string msg) {
+ Write(category, msg, null, true);
+ }
+
+ public void Warn(string category, string msg, Exception error) {
+ Write(category, msg, error, true);
+ }
+
+ public void Write(string msg) {
+ Write(String.Empty, msg, null, true);
+ }
+
+ public void Write(string category, string msg) {
+ Write(category, msg, null, true);
+ }
+
+ public void Write(string category, string msg, Exception error) {
+ Write(category, msg, error, true);
+ }
+
+ [MonoTODO("Save the data into a web dataset directly...")]
+ private void Write(string category, string msg, Exception error, bool Warning) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/TraceMode.cs b/mcs/class/System.Web/System.Web/TraceMode.cs
new file mode 100644
index 00000000000..caab8229afd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceMode.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.TraceMode.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ public enum TraceMode {
+ SortByTime,
+ SortByCategory,
+ Default
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs b/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
new file mode 100644
index 00000000000..dd4b9ea5b46
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
@@ -0,0 +1,38 @@
+/**
+ * Namespace: System.Web
+ * Class: WebCategoryAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+
+namespace System.Web
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class WebCategoryAttribute : CategoryAttribute
+ {
+ public WebCategoryAttribute(string category) : base(category)
+ {
+ }
+
+ [MonoTODO]
+ protected override string GetLocalizedString(string value)
+ {
+ string retVal = base.GetLocalizedString(value);
+ if(retVal == null)
+ {
+ throw new NotImplementedException();
+ //retVal = "Category_" + something I don't know how to get!
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs b/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
new file mode 100644
index 00000000000..2425607069a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
@@ -0,0 +1,44 @@
+/**
+ * Namespace: System.Web
+ * Class: WebSysDescriptionAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal class WebSysDescriptionAttribute : DescriptionAttribute
+ {
+ private bool isReplaced;
+
+ public WebSysDescriptionAttribute(string description) : base(description)
+ {
+ }
+
+ [MonoTODO]
+ public override string Description
+ {
+ get
+ {
+ if(!isReplaced)
+ {
+ throw new NotImplementedException();
+ //DescriptionValue = Description + do something I donno;
+ }
+ return Description;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/DataBinderTests.cs b/mcs/class/System.Web/Test/DataBinderTests.cs
new file mode 100644
index 00000000000..96cde3ceb98
--- /dev/null
+++ b/mcs/class/System.Web/Test/DataBinderTests.cs
@@ -0,0 +1,181 @@
+//
+// System.Web.UI.DataBinderTests
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+//#define NUNIT // Comment out this one if you wanna play with the test without using NUnit
+
+#if NUNIT
+using NUnit.Framework;
+#else
+using System.Reflection;
+#endif
+
+using System.IO;
+using System;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Runtime.CompilerServices;
+
+namespace MonoTests.System.Web.UI
+{
+#if NUNIT
+ public class DataBinderTests : TestCase
+ {
+#else
+ public class DataBinderTests
+ {
+#endif
+#if NUNIT
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (PathTest));
+ }
+ }
+
+ public DataBinderTests () : base ("MonoTests.System.Web.UI.DataBinderTests testcase") { }
+ public DataBinderTests (string name) : base (name) { }
+
+ protected override void SetUp ()
+ {
+#else
+ static DataBinderTests ()
+ {
+#endif
+ instance = new ClassInstance ("instance");
+ instance.another = new ClassInstance ("another");
+ }
+
+ static ClassInstance instance;
+
+ public void TestEval1 ()
+ {
+ try {
+ DataBinder.Eval (instance, "hello");
+ Fail ("Eval1 #1 didn't throw exception");
+ } catch (HttpException) {
+ }
+
+ object o = instance.Prop1;
+ AssertEquals ("Eval1 #2", DataBinder.Eval (instance, "Prop1"), o);
+ o = instance.Prop2;
+ AssertEquals ("Eval1 #3", DataBinder.Eval (instance, "Prop2"), o);
+ o = instance [0];
+ AssertEquals ("Eval1 #4", DataBinder.Eval (instance, "[0]"), o);
+ o = instance ["hi there!"];
+ AssertEquals ("Eval1 #4", DataBinder.Eval (instance, "[\"hi there!\"]"), o);
+ }
+
+ public void TestEval2 ()
+ {
+ try {
+ DataBinder.Eval (instance, "Another.hello");
+ Fail ("Eval2 #1 didn't throw exception");
+ } catch (HttpException) {
+ }
+
+ object o = instance.Another.Prop1;
+ AssertEquals ("Eval2 #2", DataBinder.Eval (instance, "Another.Prop1"), o);
+ o = instance.Another.Prop2;
+ AssertEquals ("Eval2 #3", DataBinder.Eval (instance, "Another.Prop2"), o);
+ o = instance.Another [0];
+ AssertEquals ("Eval2 #4", DataBinder.Eval (instance, "Another[0]"), o);
+ o = instance.Another ["hi there!"];
+ AssertEquals ("Eval2 #4", DataBinder.Eval (instance, "Another[\"hi there!\"]"), o);
+ AssertEquals ("Eval2 #5", DataBinder.Eval (instance,
+ "Another[\"hi there!\"] MS ignores this]"), o);
+
+ // MS gets fooled with this!!!
+ //AssertEquals ("Eval2 #4", DataBinder.Eval (instance, "Another[\"hi] there!\"]"), o);
+ }
+
+#if !NUNIT
+ void Assert (string msg, bool result)
+ {
+ if (!result)
+ Console.WriteLine (msg);
+ }
+
+ void AssertEquals (string msg, object expected, object real)
+ {
+ if (expected == null && real == null)
+ return;
+
+ if (expected != null && expected.Equals (real))
+ return;
+
+ Console.WriteLine ("{0}: expected: '{1}', got: '{2}'", msg, expected, real);
+ }
+
+ void Fail (string msg)
+ {
+ Console.WriteLine ("Failed: {0}", msg);
+ }
+
+ static void Main ()
+ {
+ DataBinderTests dbt = new DataBinderTests ();
+ Type t = typeof (DataBinderTests);
+ MethodInfo [] methods = t.GetMethods ();
+ foreach (MethodInfo m in methods) {
+ if (m.Name.Substring (0, 4) == "Test")
+ m.Invoke (dbt, null);
+ }
+ }
+#endif
+ }
+
+ class ClassInstance
+ {
+ public string hello = "Hello";
+ public ClassInstance another;
+ string prefix;
+
+ public ClassInstance (string prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ public object Prop1
+ {
+ get {
+ return prefix + "This is Prop1";
+ }
+ }
+
+ public object Prop2
+ {
+ get {
+ return prefix + "This is Prop2";
+ }
+ }
+
+ public object this [int index]
+ {
+ get {
+ return prefix + "This is the indexer for int. Index: " + index;
+ }
+ }
+
+ public object this [string index]
+ {
+ get {
+ return prefix + "This is the indexer for string. Index: " + index;
+ }
+ }
+
+ public ClassInstance Another
+ {
+ get {
+ return another;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs b/mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs
new file mode 100644
index 00000000000..cab2351e1ed
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/AsyncHandler.cs
@@ -0,0 +1,103 @@
+using System;
+using System.Threading;
+using System.Web;
+
+namespace TestMonoWeb {
+ /// <summary>
+ /// Summary description for AsyncHandler.
+ /// </summary>
+ public class AsyncHandler : IHttpAsyncHandler {
+ private HttpContext _context;
+ public bool IsReusable {
+ get {
+ //To enable pooling, return true here.
+ //This keeps the handler in memory.
+ return false;
+ }
+ }
+
+ public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) {
+ AsynchOperation asynch = new AsynchOperation(cb, context, null);
+ asynch.StartAsyncWork();
+
+ context.Response.Write("AsyncHandler.BeginProcessRequest<br>\n");
+ context.Response.Flush();
+
+ //Signal the application that asynchronous
+ //processing is being performed.
+ SomeResult asynchForBegin = new SomeResult();
+
+ //Processing is not synchronous.
+ asynchForBegin.SetSynch(false);
+
+ //Processing is not complete.
+ asynchForBegin.SetCompleted(false);
+
+ _context = context;
+
+ return new SomeResult();
+ }
+
+ public void EndProcessRequest(IAsyncResult result) {
+ _context.Response.Write("AsyncHandler.EndProcessRequest<br>\n");
+ }
+
+ //This method is required but is not called.
+ public void ProcessRequest(HttpContext context) {
+ }
+
+ }//end class
+
+ public class SomeResult : IAsyncResult {
+
+ /*
+ An instance of this class is returned to the application.
+ This class lets the application know how the BeginEventHandler method has been handled. The application checks the CompletedSynchronously method.
+ */
+
+ private bool _blnIsCompleted = false;
+ private Mutex myMutex = null;
+ private Object myAsynchStateObject = null;
+ private bool _blnCompletedSynchronously = false;
+
+ public void SetCompleted(bool blnTrueOrFalse) {
+ _blnIsCompleted = blnTrueOrFalse;
+ }
+
+ public void SetSynch(bool blnTrueOrFalse) {
+ _blnCompletedSynchronously = blnTrueOrFalse;
+ }
+
+ public bool IsCompleted {
+ /*
+ This is not called by the application. However, set it to true.
+ */
+ get {
+ return _blnIsCompleted;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ //The application does not call this method.
+ get {
+ return myMutex;
+ }
+ }
+
+ public Object AsyncState {
+ //The application does not call this method because
+ //null is passed in as the last parameter to BeginEventHandler.
+ get {
+ return myAsynchStateObject;
+ }
+ }
+
+ public bool CompletedSynchronously {
+ //The application wants to know if this is synchronous.
+ //Return true if the Begin method was called synchronously.
+ get {
+ return _blnCompletedSynchronously;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs b/mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs
new file mode 100644
index 00000000000..839297b1c9e
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/AsyncModule.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ /// <summary>
+ /// Summary description for AsyncModule.
+ /// </summary>
+ public class AsyncModule : IHttpModule
+ {
+ HttpApplication _app;
+
+ public void Init(HttpApplication app) {
+ app.AddOnPreRequestHandlerExecuteAsync(
+ new BeginEventHandler(this.BeginPreHandlerExecute),
+ new EndEventHandler(this.EndPreHandlerExecute));
+
+ _app = app;
+ }
+
+ IAsyncResult BeginPreHandlerExecute(Object source, EventArgs e, AsyncCallback cb, Object extraData) {
+ ((HttpApplication) source).Context.Response.Write("AsyncModule.BeginPreHandlerExecute()<br>\n");
+
+ AsynchOperation asynch = new AsynchOperation(cb, _app.Context, extraData);
+ asynch.StartAsyncWork();
+ return asynch;
+ }
+
+ void EndPreHandlerExecute(IAsyncResult ar) {
+ ((AsynchOperation) ar).Context.Response.Write("AsyncModule.EndPreHandlerExecute()<br>\n");
+ }
+
+ public void Dispose() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs b/mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs
new file mode 100644
index 00000000000..46b0ff1f722
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/AsyncOperation.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Threading;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ class AsynchOperation : IAsyncResult {
+ private bool _completed;
+ private Object _state;
+ private AsyncCallback _callback;
+ private HttpContext _context;
+
+ bool IAsyncResult.IsCompleted { get { return _completed; } }
+ WaitHandle IAsyncResult.AsyncWaitHandle { get { return null; } }
+ Object IAsyncResult.AsyncState { get { return _state; } }
+ bool IAsyncResult.CompletedSynchronously { get { return false; } }
+
+ public HttpContext Context {
+ get {
+ return _context;
+ }
+ }
+
+ public AsynchOperation(AsyncCallback callback, HttpContext context, Object state) {
+ _callback = callback;
+ _context = context;
+ _state = state;
+ _completed = false;
+ }
+
+ public void StartAsyncWork() {
+ ThreadPool.QueueUserWorkItem(new WaitCallback(DoSomething), null /*workItemState*/);
+ }
+
+ private void DoSomething(Object workItemState) {
+ // Just for testing..
+ Thread.Sleep(100);
+ _completed = true;
+ _callback(this);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/README b/mcs/class/System.Web/Test/TestMonoWeb/README
new file mode 100644
index 00000000000..1d4950d8036
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/README
@@ -0,0 +1,5 @@
+This small test program tests HttpModule and HttpHandler. The test program can both handle async and sync tests.
+
+This program uses the temporary configuration for modules and handlers.
+
+- Patrik Torstensson \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs b/mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs
new file mode 100644
index 00000000000..7dd01bb65ab
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/SyncHandler.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ public class SyncHandler : IHttpHandler {
+
+ public void ProcessRequest(HttpContext context) {
+ context.Response.Write("SyncHandler.ProcessRequest<br>\n");
+ }
+
+ public bool IsReusable {
+ get { return false; }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs b/mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs
new file mode 100644
index 00000000000..7fddb06a8bf
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/SyncModule.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections;
+using System.Web;
+
+namespace TestMonoWeb
+{
+ public class SyncModule : IHttpModule {
+ public String ModuleName {
+ get { return "HelloWorldModule"; }
+ }
+ //In the Init function, register for HttpApplication
+ //events by adding your handlers.
+ public void Init(HttpApplication application) {
+ application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
+ application.EndRequest += (new EventHandler(this.Application_EndRequest));
+ }
+
+ //Your BeginRequest event handler.
+ private void Application_BeginRequest(Object source, EventArgs e) {
+ HttpApplication application = (HttpApplication)source;
+ HttpContext context = application.Context;
+
+ context.Response.Write("SyncModule.Application_BeginRequest()<br>\n");
+ }
+
+ //Your EndRequest event handler.
+ private void Application_EndRequest(Object source, EventArgs e) {
+ HttpApplication application = (HttpApplication)source;
+ HttpContext context = application.Context;
+
+ context.Response.Write("SyncModule.Application_EndRequest()<br>\n");
+ }
+
+ public void Dispose() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/Test1.cs b/mcs/class/System.Web/Test/TestMonoWeb/Test1.cs
new file mode 100644
index 00000000000..b453cd8b170
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/Test1.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Web;
+using System.Web.Hosting;
+using System.Web.Configuration;
+
+namespace TestMonoWeb
+{
+ public class MyHost : MarshalByRefObject {
+ public MyHost() {
+ }
+ }
+ /// <summary>
+ /// Summary description for Test1.
+ /// </summary>
+ public class Test1
+ {
+ static void Main(string[] args) {
+ // Create the application host
+ object host = ApplicationHost.CreateApplicationHost(typeof(MyHost), "/", "c:\\");
+
+ int request_count = 10;
+ SimpleWorkerRequest [] requests = new SimpleWorkerRequest[request_count];
+
+ int pos;
+ for (pos = 0; pos != request_count; pos++) {
+ requests[pos] = new SimpleWorkerRequest("test.aspx", "", Console.Out);
+ }
+
+ ModulesConfiguration.Add("syncmodule", typeof(SyncModule).AssemblyQualifiedName);
+ ModulesConfiguration.Add("asyncmodule", typeof(AsyncModule).AssemblyQualifiedName);
+
+ HandlerFactoryConfiguration.Add("get", "/", typeof(AsyncHandler).AssemblyQualifiedName);
+ //HandlerFactoryConfiguration.Add("get", "/", typeof(SyncHandler).AssemblyQualifiedName);
+
+ for (pos = 0; pos != request_count; pos++)
+ HttpRuntime.ProcessRequest(requests[pos]);
+
+ HttpRuntime.Close();
+/*
+ Console.Write("Press Enter to quit.");
+ Console.WriteLine();
+ Console.ReadLine();
+*/
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/TestMonoWeb/TestMonoWeb.build b/mcs/class/System.Web/Test/TestMonoWeb/TestMonoWeb.build
new file mode 100644
index 00000000000..98ecbcc49c3
--- /dev/null
+++ b/mcs/class/System.Web/Test/TestMonoWeb/TestMonoWeb.build
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="exe" output="TestMonoWeb.exe" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0649"/> <!-- always default value -->
+ <arg value="/nowarn:0067"/> <!-- event never used -->
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/>
+ <arg value="/debug"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Web.dll"/>
+ <arg value="/r:System.Drawing.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ </csc>
+ </target>
+</project>
diff --git a/mcs/class/System.Web/Test/test.aspx b/mcs/class/System.Web/Test/test.aspx
new file mode 100644
index 00000000000..363fab9697f
--- /dev/null
+++ b/mcs/class/System.Web/Test/test.aspx
@@ -0,0 +1,29 @@
+<%@ page language="c#"%>
+<html>
+<head>
+<title>Test</title>
+<%Response.Write("Test");%>
+
+<script runat="server" language="c#">
+ void SubmitBtn_Click(Object sender, EventArgs e) {
+ Response.Write("Hi");
+ }
+</script>
+
+<form action="test.aspx" method="post" runat="server">
+<asp:button text="Click Me" OnClick="SubmitBtn_Click" runat="server"/>
+</form>
+
+<!-- output
+
+<html>
+<head>
+<title>Test</title>
+Test<form name="ctrl0" method="post" action="test.aspx" id="ctrl0">
+<input type="hidden" name="__VIEWSTATE" value="dDwtMTc0MDc5ODg1Mzs7Pg==" />
+
+<input type="submit" name="ctrl1" value="Click Me" />
+</form>
+
+
+--> \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/test2.aspx b/mcs/class/System.Web/Test/test2.aspx
new file mode 100644
index 00000000000..168aa05cb58
--- /dev/null
+++ b/mcs/class/System.Web/Test/test2.aspx
@@ -0,0 +1,101 @@
+<%@ Page Language="C#" %>
+<html>
+<head>
+<script language="C#" runat="server">
+void Page_Load(Object Sender, EventArgs e) {
+ if (!IsPostBack) {
+ ArrayList values = new ArrayList();
+
+ values.Add(new PositionData("Microsoft", "Msft"));
+ values.Add(new PositionData("Intel", "Intc"));
+ values.Add(new PositionData("Dell", "Dell"));
+
+ Repeater1.DataSource = values;
+ Repeater1.DataBind();
+
+ Repeater2.DataSource = values;
+ Repeater2.DataBind();
+ Response.Write(Repeater1.Controls[0].ClientID);
+ Response.Write("<br>");
+ Response.Write(Repeater1.Controls[0].UniqueID);
+ Response.Write("<br>");
+ }
+ }
+
+ public class PositionData {
+
+ private string name;
+ private string ticker;
+
+ public PositionData(string name, string ticker) {
+ this.name = name;
+ this.ticker = ticker;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string Ticker {
+ get {
+ return ticker;
+ }
+ }
+ }
+
+ </script>
+
+</head>
+<body>
+
+<h3><font face="Verdana">Repeater Example</font></h3>
+
+<form runat=server>
+
+<b>Repeater1:</b>
+
+<p>
+
+<asp:Repeater id=Repeater1 runat="server">
+<HeaderTemplate>
+<table border=1>
+<tr>
+<td><b>Company</b></td>
+<td><b>Symbol</b></td>
+</tr>
+</HeaderTemplate>
+
+<ItemTemplate>
+<tr>
+<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> <asp:label id="test"></td>
+<td> <%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
+</tr>
+</ItemTemplate>
+
+<FooterTemplate>
+</table>
+</FooterTemplate>
+
+</asp:Repeater>
+<p>
+
+<b>Repeater2:</b>
+<p>
+<asp:Repeater id=Repeater2 runat="server">
+
+<HeaderTemplate>
+Company data:
+ </HeaderTemplate>
+
+<ItemTemplate>
+<%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>)
+ </ItemTemplate>
+
+<SeparatorTemplate>, </SeparatorTemplate>
+</asp:Repeater>
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test3.aspx b/mcs/class/System.Web/Test/test3.aspx
new file mode 100644
index 00000000000..d8776e45f48
--- /dev/null
+++ b/mcs/class/System.Web/Test/test3.aspx
@@ -0,0 +1,23 @@
+<%@ Page Debug="true" %>
+<html>
+<script runat=server language="vb">
+
+Sub AnchorBtn_Click(Source As Object, E as EventArgs)
+ Message.InnerText = Message.InnerHtml
+ End Sub
+
+ </script>
+
+<body>
+<form method=post runat=server>
+
+<a OnServerClick="AnchorBtn_Click" runat=server> Click here at your peril.</a>
+
+<h1>
+<span id="Message" runat=server><span id="Message2" runat=server>narf</span></span>
+</h1>
+
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test4.aspx b/mcs/class/System.Web/Test/test4.aspx
new file mode 100644
index 00000000000..f9c020c1d85
--- /dev/null
+++ b/mcs/class/System.Web/Test/test4.aspx
@@ -0,0 +1,119 @@
+<%@ Page Language="C#" Debug="true" %>
+<html>
+<head>
+<script language="C#" runat="server">
+// protected override void OnInit(EventArgs e){
+// throw new Exception();
+// }
+ protected override void LoadViewState(object savedState){
+ throw new Exception();
+ }
+ protected override object SaveViewState(){
+ throw new Exception();
+ }
+ void Page_Kill(Object Sender, EventArgs e) {
+ throw new Exception();
+ }
+ protected override void OnInit(EventArgs e){
+ EnableViewState = true;
+ TrackViewState();
+ ViewState["test"] = "DIE!";
+ }
+ void Page_Load(Object Sender, EventArgs e) {
+// ((Control)Sender).PreRender += new EventHandler(Page_Kill);
+ if (!IsPostBack) {
+ ArrayList values = new ArrayList();
+
+ values.Add(new PositionData("Microsoft", "Msft"));
+ values.Add(new PositionData("Intel", "Intc"));
+ values.Add(new PositionData("Dell", "Dell"));
+
+ Repeater1.DataSource = values;
+ Repeater1.DataBind();
+
+ Repeater2.DataSource = values;
+ Repeater2.DataBind();
+ Response.Write(Repeater1.Controls[0].ClientID);
+ Response.Write("<br>");
+ Response.Write(Repeater1.Controls[0].UniqueID);
+ Response.Write("<br>");
+ }
+ }
+
+ public class PositionData {
+
+ private string name;
+ private string ticker;
+
+ public PositionData(string name, string ticker) {
+ this.name = name;
+ this.ticker = ticker;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string Ticker {
+ get {
+ return ticker;
+ }
+ }
+ }
+
+ </script>
+
+</head>
+<body>
+
+<h3><font face="Verdana">Repeater Example</font></h3>
+
+<form runat=server>
+
+<b>Repeater1:</b>
+
+<p>
+
+<asp:Repeater id=Repeater1 runat="server">
+<HeaderTemplate>
+<table border=1>
+<tr>
+<td><b>Company</b></td>
+<td><b>Symbol</b></td>
+</tr>
+</HeaderTemplate>
+
+<ItemTemplate>
+<tr>
+<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> <asp:label id="test"></td>
+<td> <%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
+</tr>
+</ItemTemplate>
+
+<FooterTemplate>
+</table>
+</FooterTemplate>
+
+</asp:Repeater>
+<p>
+
+<b>Repeater2:</b>
+<p>
+<asp:Repeater id=Repeater2 runat="server">
+
+<HeaderTemplate>
+Company data:
+ </HeaderTemplate>
+
+<ItemTemplate>
+<%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>)
+ </ItemTemplate>
+
+<SeparatorTemplate>, </SeparatorTemplate>
+</asp:Repeater>
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test5.aspx b/mcs/class/System.Web/Test/test5.aspx
new file mode 100644
index 00000000000..2aaf4bf06c2
--- /dev/null
+++ b/mcs/class/System.Web/Test/test5.aspx
@@ -0,0 +1,121 @@
+<%@ Page Language="C#" Debug="true" %>
+<html>
+<head>
+<%
+Response.Write(HttpWorkerRequest.HeaderAccept);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptCharset);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptLanguage);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptRanges);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAge);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAllow);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAuthorization);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderCacheControl);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderConnection);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLanguage);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLength);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLocation);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentMd5);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentType);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderCookie);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderDate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderEtag);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderExpect);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderExpires);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderFrom);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderHost);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfMatch);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfModifiedSince);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfNoneMatch);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfUnmodifiedSince);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderKeepAlive);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderLastModified);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderLocation);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderMaxForwards);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderPragma);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderProxyAuthenticate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderProxyAuthorization);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderReferer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderRetryAfter);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderServer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderSetCookie);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTe);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTrailer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTransferEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderUpgrade);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderUserAgent);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderVary);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderVia);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderWarning);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderWwwAuthenticate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonCachePolicy);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonCacheSecurity);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonClientDisconnect);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonDefault);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonFileHandleCacheMiss);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonResponseCacheMiss);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.RequestHeaderMaximum);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ResponseHeaderMaximum);
+Response.Write("<br>");
+%> \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/test6.aspx b/mcs/class/System.Web/Test/test6.aspx
new file mode 100644
index 00000000000..594c4bc7bbb
--- /dev/null
+++ b/mcs/class/System.Web/Test/test6.aspx
@@ -0,0 +1,83 @@
+<html>
+<head>
+<!--
+ Author: Gaurav Vaish
+ Original Source: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIWebControlsCalendarClassSelectedDateTopic.asp
+ Copyright: (C) Gaurav Vaish, 2001
+-->
+ <script language="C#" runat="server">
+
+ void Selection_Change(Object sender, EventArgs e)
+ {
+ Label1.Text = "The selected date is " + Calendar1.SelectedDate.ToShortDateString();
+ }
+
+ void Selection_Change_Month(Object sender, EventArgs e)
+ {
+ Label2.Text = "The selected date is " + Calendar2.SelectedDate.ToShortDateString();
+ }
+
+ void Selection_Change_DWM(Object sender, EventArgs e)
+ {
+ Label3.Text = "The selected date is " + Calendar3.SelectedDate.ToShortDateString();
+ }
+
+ </script>
+
+</head>
+<body>
+
+ <form runat="server">
+
+ <h3><font face="Verdana">Calendar Example</font></h3>
+
+ Select a date on the Calendar control.<br><br>
+
+ <asp:Calendar ID="Calendar1" runat="server"
+ SelectionMode="Day"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label1" runat=server />
+
+ <hr><br>
+
+ <asp:Calendar ID="Calendar2" runat="server"
+ SelectionMode="DayWeek"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change_Month">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label2" runat=server />
+
+ <hr><br>
+
+ <asp:Calendar ID="Calendar3" runat="server"
+ SelectionMode="DayWeekMonth"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change_DWM">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label3" runat=server />
+
+ <hr><br>
+
+ </form>
+</body>
+</html> \ No newline at end of file
diff --git a/mcs/class/System.Web/list b/mcs/class/System.Web/list
new file mode 100755
index 00000000000..0fb7ac8e943
--- /dev/null
+++ b/mcs/class/System.Web/list
@@ -0,0 +1,369 @@
+System.Web/BeginEventHandler.cs
+System.Web/EndEventHandler.cs
+System.Web/HttpCacheRevalidation.cs
+System.Web/HttpCacheability.cs
+System.Web/HttpCookie.cs
+System.Web/HttpCookieCollection.cs
+System.Web/HttpRuntime.cs
+System.Web/HttpServerUtility.cs
+System.Web/HttpValidationStatus.cs
+System.Web/HttpWriter.cs
+System.Web/TraceContext.cs
+System.Web/HttpWorkerRequest.cs
+System.Web/IHttpAsyncHandler.cs
+System.Web/IHttpHandler.cs
+System.Web/IHttpHandlerFactory.cs
+System.Web/IHttpMapPath.cs
+System.Web/IHttpModule.cs
+System.Web/ProcessShutdownReason.cs
+System.Web/ProcessStatus.cs
+System.Web/TODOAttribute.cs
+System.Web/TraceMode.cs
+System.Web/WebCategoryAttribute.cs
+System.Web/WebSysDescriptionAttribute.cs
+System.Web/HttpApplication.cs
+System.Web/HttpApplicationState.cs
+System.Web/HttpApplicationFactory.cs
+System.Web/HttpAsyncResult.cs
+System.Web/HttpBrowserCapabilities.cs
+System.Web/HttpCachePolicy.cs
+System.Web/HttpClientCertificate.cs
+System.Web/HttpCompileException.cs
+System.Web/HttpContext.cs
+System.Web/HttpException.cs
+System.Web/HttpFileCollection.cs
+System.Web/HttpForbiddenHandler.cs
+System.Web/HttpHelper.cs
+System.Web/HttpParseException.cs
+System.Web/HttpRequest.cs
+System.Web/HttpRequestStream.cs
+System.Web/HttpResponse.cs
+System.Web/HttpResponseHeader.cs
+System.Web/HttpResponseStream.cs
+System.Web/HttpResponseStreamProxy.cs
+System.Web/HttpUtility.cs
+System.Web/HttpValueCollection.cs
+System.Web/HttpCacheValidateHandler.cs
+System.Web/HttpCacheVaryByHeaders.cs
+System.Web/HttpCacheVaryByParams.cs
+System.Web/HttpMethodNotAllowedHandler.cs
+System.Web/HttpModuleCollection.cs
+System.Web/HttpPostedFile.cs
+System.Web/HttpStaticObjectsCollection.cs
+System.Web/HttpUnhandledException.cs
+System.Web/MimeTypes.cs
+System.Web/ProcessInfo.cs
+System.Web/StaticFileHandler.cs
+System.Web.Caching/Cache.cs
+System.Web.Caching/CacheDefinitions.cs
+System.Web.Caching/CacheDependency.cs
+System.Web.Caching/CacheEntry.cs
+System.Web.Caching/CacheExpires.cs
+System.Web.Caching/ExpiresBuckets.cs
+System.Web.Configuration/AuthConfig.cs
+System.Web.Configuration/AuthenticationConfigHandler.cs
+System.Web.Configuration/AuthenticationMode.cs
+System.Web.Configuration/ClientTargetSectionHandler.cs
+System.Web.Configuration/FormsAuthPasswordFormat.cs
+System.Web.Configuration/FormsProtectionEnum.cs
+System.Web.Configuration/GlobalizationConfiguration.cs
+System.Web.Configuration/HttpCapabilitiesBase.cs
+System.Web.Configuration/HandlerFactoryConfiguration.cs
+System.Web.Configuration/HandlerFactoryProxy.cs
+System.Web.Configuration/HttpConfigurationContext.cs
+System.Web.Configuration/HttpHandlersSectionHandler.cs
+System.Web.Configuration/HttpModulesConfigurationHandler.cs
+System.Web.Configuration/HandlerItem.cs
+System.Web.Configuration/MachineKeyConfig.cs
+System.Web.Configuration/MachineKeyConfigHandler.cs
+System.Web.Configuration/ModulesConfiguration.cs
+System.Web.Configuration/ModuleItem.cs
+System.Web.Hosting/AppDomainFactory.cs
+System.Web.Hosting/ApplicationHost.cs
+System.Web.Hosting/IAppDomainFactory.cs
+System.Web.Hosting/IISAPIRuntime.cs
+System.Web.Hosting/ISAPIRuntime.cs
+System.Web.Hosting/SimpleWorkerRequest.cs
+System.Web.Mail/MailAttachment.cs
+System.Web.Mail/MailEncoding.cs
+System.Web.Mail/MailFormat.cs
+System.Web.Mail/MailMessage.cs
+System.Web.Mail/MailPriority.cs
+System.Web.Mail/SmtpMail.cs
+System.Web.UI/BuildMethod.cs
+System.Web.UI/BuildTemplateMethod.cs
+System.Web.UI/Control.cs
+System.Web.UI/DataBindingHandlerAttribute.cs
+System.Web.UI/DesignTimeParseData.cs
+System.Web.UI/HtmlTextWriter.cs
+System.Web.UI/HtmlTextWriterAttribute.cs
+System.Web.UI/HtmlTextWriterStyle.cs
+System.Web.UI/HtmlTextWriterTag.cs
+System.Web.UI/IAttributeAccessor.cs
+System.Web.UI/IDataBindingsAccessor.cs
+System.Web.UI/INamingContainer.cs
+System.Web.UI/IParserAccessor.cs
+System.Web.UI/IPostBackDataHandler.cs
+System.Web.UI/IPostBackEventHandler.cs
+System.Web.UI/IStateManager.cs
+System.Web.UI/ITagNameToTypeMapper.cs
+System.Web.UI/ITemplate.cs
+System.Web.UI/IValidator.cs
+System.Web.UI/ImageClickEventHandler.cs
+System.Web.UI/LiteralControl.cs
+System.Web.UI/LosFormatter.cs
+System.Web.UI/OutputCacheLocation.cs
+System.Web.UI/Pair.cs
+System.Web.UI/PersistenceMode.cs
+System.Web.UI/PropertyConverter.cs
+System.Web.UI/StateBag.cs
+System.Web.UI/StateItem.cs
+System.Web.UI/SimpleWebHandlerParser.cs
+System.Web.UI/ToolboxDataAttribute.cs
+System.Web.UI/Utils.cs
+System.Web.UI/ConstructorNeedsTagAttribute.cs
+System.Web.UI/ControlBuilderAttribute.cs
+System.Web.UI/ImageClickEventArgs.cs
+System.Web.UI/Page.cs
+System.Web.UI/PageHandlerFactory.cs
+System.Web.UI/PageParser.cs
+System.Web.UI/ParseChildrenAttribute.cs
+System.Web.UI/PartialCachingAttribute.cs
+System.Web.UI/PersistChildrenAttribute.cs
+System.Web.UI/PersistenceModeAttribute.cs
+System.Web.UI/SimpleHandlerFactory.cs
+System.Web.UI/TagPrefixAttribute.cs
+System.Web.UI/TemplateContainerAttribute.cs
+System.Web.UI/TemplateControlParser.cs
+System.Web.UI/UserControlParser.cs
+System.Web.UI/ValidatorCollection.cs
+System.Web.UI/ValidationPropertyAttribute.cs
+System.Web.UI/AttributeCollection.cs
+System.Web.UI/BaseParser.cs
+System.Web.UI/ControlBuilder.cs
+System.Web.UI/ControlCollection.cs
+System.Web.UI/CssStyleCollection.cs
+System.Web.UI/DataBinder.cs
+System.Web.UI/DataBinding.cs
+System.Web.UI/DataBindingCollection.cs
+System.Web.UI/DataBoundLiteralControl.cs
+System.Web.UI/EmptyControlCollection.cs
+System.Web.UI/RenderMethod.cs
+System.Web.UI/TemplateControl.cs
+System.Web.UI/TemplateParser.cs
+System.Web.UI/Triplet.cs
+System.Web.UI/UserControl.cs
+System.Web.UI/CompiledTemplateBuilder.cs
+System.Web.UI/WebServiceParser.cs
+System.Web.UI.HtmlControls/HtmlAnchor.cs
+System.Web.UI.HtmlControls/HtmlButton.cs
+System.Web.UI.HtmlControls/HtmlContainerControl.cs
+System.Web.UI.HtmlControls/HtmlControl.cs
+System.Web.UI.HtmlControls/HtmlForm.cs
+System.Web.UI.HtmlControls/HtmlGenericControl.cs
+System.Web.UI.HtmlControls/HtmlImage.cs
+System.Web.UI.HtmlControls/HtmlInputButton.cs
+System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
+System.Web.UI.HtmlControls/HtmlInputControl.cs
+System.Web.UI.HtmlControls/HtmlInputFile.cs
+System.Web.UI.HtmlControls/HtmlInputHidden.cs
+System.Web.UI.HtmlControls/HtmlInputImage.cs
+System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
+System.Web.UI.HtmlControls/HtmlInputText.cs
+System.Web.UI.HtmlControls/HtmlSelect.cs
+System.Web.UI.HtmlControls/HtmlTable.cs
+System.Web.UI.HtmlControls/HtmlTableCell.cs
+System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
+System.Web.UI.HtmlControls/HtmlTableRow.cs
+System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
+System.Web.UI.HtmlControls/HtmlTextArea.cs
+System.Web.UI.WebControls/AdCreatedEventArgs.cs
+System.Web.UI.WebControls/AdCreatedEventHandler.cs
+System.Web.UI.WebControls/AdRotator.cs
+System.Web.UI.WebControls/BaseCompareValidator.cs
+System.Web.UI.WebControls/BaseDataList.cs
+System.Web.UI.WebControls/BaseValidator.cs
+System.Web.UI.WebControls/BorderStyle.cs
+System.Web.UI.WebControls/BoundColumn.cs
+System.Web.UI.WebControls/Button.cs
+System.Web.UI.WebControls/ButtonColumn.cs
+System.Web.UI.WebControls/ButtonColumnType.cs
+System.Web.UI.WebControls/Calendar.cs
+System.Web.UI.WebControls/CalendarDay.cs
+System.Web.UI.WebControls/CalendarSelectionMode.cs
+System.Web.UI.WebControls/CheckBox.cs
+System.Web.UI.WebControls/CheckBoxList.cs
+System.Web.UI.WebControls/CommandEventArgs.cs
+System.Web.UI.WebControls/CommandEventHandler.cs
+System.Web.UI.WebControls/CompareValidator.cs
+System.Web.UI.WebControls/CustomValidator.cs
+System.Web.UI.WebControls/DataGrid.cs
+System.Web.UI.WebControls/DataGridColumn.cs
+System.Web.UI.WebControls/DataGridColumnCollection.cs
+System.Web.UI.WebControls/DataGridCommandEventArgs.cs
+System.Web.UI.WebControls/DataGridCommandEventHandler.cs
+System.Web.UI.WebControls/DataGridItem.cs
+System.Web.UI.WebControls/DataGridItemCollection.cs
+System.Web.UI.WebControls/DataGridItemEventArgs.cs
+System.Web.UI.WebControls/DataGridItemEventHandler.cs
+System.Web.UI.WebControls/DataGridLinkButton.cs
+System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
+System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
+System.Web.UI.WebControls/DataGridPagerStyle.cs
+System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
+System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
+System.Web.UI.WebControls/DataGridTableInternal.cs
+System.Web.UI.WebControls/DataKeyCollection.cs
+System.Web.UI.WebControls/DataList.cs
+System.Web.UI.WebControls/DataListCommandEventArgs.cs
+System.Web.UI.WebControls/DataListCommandEventHandler.cs
+System.Web.UI.WebControls/DataListItem.cs
+System.Web.UI.WebControls/DataListItemCollection.cs
+System.Web.UI.WebControls/DataListItemEventArgs.cs
+System.Web.UI.WebControls/DataListItemEventHandler.cs
+System.Web.UI.WebControls/DataSourceInternal.cs
+System.Web.UI.WebControls/DayNameFormat.cs
+System.Web.UI.WebControls/DayRenderEventArgs.cs
+System.Web.UI.WebControls/DayRenderEventHandler.cs
+System.Web.UI.WebControls/DropDownList.cs
+System.Web.UI.WebControls/EditCommandColumn.cs
+System.Web.UI.WebControls/FirstDayOfWeek.cs
+System.Web.UI.WebControls/FontInfo.cs
+System.Web.UI.WebControls/FontNamesConverter.cs
+System.Web.UI.WebControls/FontSize.cs
+System.Web.UI.WebControls/FontUnit.cs
+System.Web.UI.WebControls/FontUnitConverter.cs
+System.Web.UI.WebControls/GridLines.cs
+System.Web.UI.WebControls/HorizontalAlign.cs
+System.Web.UI.WebControls/HorizontalAlignConverter.cs
+System.Web.UI.WebControls/HyperLink.cs
+System.Web.UI.WebControls/HyperLinkColumn.cs
+System.Web.UI.WebControls/HyperLinkControlBuilder.cs
+System.Web.UI.WebControls/IRepeatInfoUser.cs
+System.Web.UI.WebControls/Image.cs
+System.Web.UI.WebControls/ImageAlign.cs
+System.Web.UI.WebControls/ImageButton.cs
+System.Web.UI.WebControls/Label.cs
+System.Web.UI.WebControls/LabelControlBuilder.cs
+System.Web.UI.WebControls/LinkButton.cs
+System.Web.UI.WebControls/LinkButtonControlBuilder.cs
+System.Web.UI.WebControls/LinkButtonInternal.cs
+System.Web.UI.WebControls/ListBox.cs
+System.Web.UI.WebControls/ListControl.cs
+System.Web.UI.WebControls/ListItem.cs
+System.Web.UI.WebControls/ListItemCollection.cs
+System.Web.UI.WebControls/ListItemControlBuilder.cs
+System.Web.UI.WebControls/ListItemType.cs
+System.Web.UI.WebControls/ListSelectionMode.cs
+System.Web.UI.WebControls/Literal.cs
+System.Web.UI.WebControls/LiteralControlBuilder.cs
+System.Web.UI.WebControls/MonthChangedEventArgs.cs
+System.Web.UI.WebControls/MonthChangedEventHandler.cs
+System.Web.UI.WebControls/NextPrevFormat.cs
+System.Web.UI.WebControls/PagedDataSource.cs
+System.Web.UI.WebControls/PagerMode.cs
+System.Web.UI.WebControls/PagerPosition.cs
+System.Web.UI.WebControls/Panel.cs
+System.Web.UI.WebControls/PlaceHolder.cs
+System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
+System.Web.UI.WebControls/RadioButton.cs
+System.Web.UI.WebControls/RadioButtonList.cs
+System.Web.UI.WebControls/RangeValidator.cs
+System.Web.UI.WebControls/RegularExpressionValidator.cs
+System.Web.UI.WebControls/RepeatDirection.cs
+System.Web.UI.WebControls/RepeatInfo.cs
+System.Web.UI.WebControls/RepeatLayout.cs
+System.Web.UI.WebControls/Repeater.cs
+System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
+System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
+System.Web.UI.WebControls/RepeaterItem.cs
+System.Web.UI.WebControls/RepeaterItemCollection.cs
+System.Web.UI.WebControls/RepeaterItemEventArgs.cs
+System.Web.UI.WebControls/RepeaterItemEventHandler.cs
+System.Web.UI.WebControls/RequiredFieldValidator.cs
+System.Web.UI.WebControls/SelectedDatesCollection.cs
+System.Web.UI.WebControls/ServerValidateEventArgs.cs
+System.Web.UI.WebControls/ServerValidateEventHandler.cs
+System.Web.UI.WebControls/Style.cs
+System.Web.UI.WebControls/Table.cs
+System.Web.UI.WebControls/TableCell.cs
+System.Web.UI.WebControls/TableCellCollection.cs
+System.Web.UI.WebControls/TableCellControlBuilder.cs
+System.Web.UI.WebControls/TableHeaderCell.cs
+System.Web.UI.WebControls/TableItemStyle.cs
+System.Web.UI.WebControls/TableRow.cs
+System.Web.UI.WebControls/TableRowCollection.cs
+System.Web.UI.WebControls/TableStyle.cs
+System.Web.UI.WebControls/TargetConverter.cs
+System.Web.UI.WebControls/TemplateColumn.cs
+System.Web.UI.WebControls/TextAlign.cs
+System.Web.UI.WebControls/TextBox.cs
+System.Web.UI.WebControls/TextBoxControlBuilder.cs
+System.Web.UI.WebControls/TextBoxMode.cs
+System.Web.UI.WebControls/TitleFormat.cs
+System.Web.UI.WebControls/Unit.cs
+System.Web.UI.WebControls/UnitConverter.cs
+System.Web.UI.WebControls/UnitType.cs
+System.Web.UI.WebControls/ValidatedControlConverter.cs
+System.Web.UI.WebControls/ValidationCompareOperator.cs
+System.Web.UI.WebControls/ValidationDataType.cs
+System.Web.UI.WebControls/ValidationSummary.cs
+System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
+System.Web.UI.WebControls/ValidatorDisplay.cs
+System.Web.UI.WebControls/VerticalAlign.cs
+System.Web.UI.WebControls/VerticalAlignConverter.cs
+System.Web.UI.WebControls/WebColorConverter.cs
+System.Web.UI.WebControls/WebControl.cs
+System.Web.UI.WebControls/Xml.cs
+System.Web.Util/ApacheVersionInfo.cs
+System.Web.Util/DataSourceHelper.cs
+System.Web.Util/FileAction.cs
+System.Web.Util/FileChangeEventHandler.cs
+System.Web.Util/FileChangedEventArgs.cs
+System.Web.Util/FileChangesMonitor.cs
+System.Web.Util/FilePathParser.cs
+System.Web.Util/IISVersionInfo.cs
+System.Web.Util/NativeFileChangeEventHandler.cs
+System.Web.Util/UrlUtils.cs
+System.Web.Util/WebEncoding.cs
+System.Web.Util/WebEqualComparer.cs
+System.Web.Util/WebHashCodeProvider.cs
+System.Web.Util/WebTrace.cs
+System.Web.Security/DefaultAuthenticationEventArgs.cs
+System.Web.Security/DefaultAuthenticationEventHandler.cs
+System.Web.Security/DefaultAuthenticationModule.cs
+System.Web.Security/FileAuthorizationModule.cs
+System.Web.Security/FormsAuthentication.cs
+System.Web.Security/FormsAuthenticationEventArgs.cs
+System.Web.Security/FormsAuthenticationEventHandler.cs
+System.Web.Security/FormsAuthenticationModule.cs
+System.Web.Security/FormsAuthenticationTicket.cs
+System.Web.Security/FormsIdentity.cs
+System.Web.Security/PassportAuthenticationEventArgs.cs
+System.Web.Security/PassportAuthenticationEventHandler.cs
+System.Web.Security/PassportAuthenticationModule.cs
+System.Web.Security/PassportIdentity.cs
+System.Web.Security/UrlAuthorizationModule.cs
+System.Web.Security/WindowsAuthenticationEventArgs.cs
+System.Web.Security/WindowsAuthenticationEventHandler.cs
+System.Web.Security/WindowsAuthenticationModule.cs
+System.Web.SessionState/HttpSessionState.cs
+System.Web.SessionState/IReadOnlySessionState.cs
+System.Web.SessionState/IRequiresSessionState.cs
+System.Web.SessionState/SessionDictionary.cs
+System.Web.SessionState/SessionStateMode.cs
+System.Web.SessionState/SessionStateModule.cs
+System.Web.Compilation/AspComponentFoundry.cs
+System.Web.Compilation/AspElements.cs
+System.Web.Compilation/AspGenerator.cs
+System.Web.Compilation/AspParser.cs
+System.Web.Compilation/AspTokenizer.cs
+System.Web.Compilation/BaseCompiler.cs
+System.Web.Compilation/CachingCompiler.cs
+System.Web.Compilation/CompilationResult.cs
+System.Web.Compilation/CompilationException.cs
+System.Web.Compilation/GlobalAsaxCompiler.cs
+System.Web.Compilation/PageCompiler.cs
+System.Web.Compilation/UserControlCompiler.cs
+System.Web.Compilation/WebServiceCompiler.cs
+System.Web.Handlers/TraceHandler.cs
diff --git a/mcs/class/System.Web/makefile.gnu b/mcs/class/System.Web/makefile.gnu
new file mode 100644
index 00000000000..0333f0235a8
--- /dev/null
+++ b/mcs/class/System.Web/makefile.gnu
@@ -0,0 +1,13 @@
+topdir = ../..
+
+LIBRARY = $(topdir)/class/lib/System.Web.dll
+
+LIB_LIST = list
+LIB_FLAGS = -r corlib -r System -r System.Drawing -r System.Xml
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=./Test*
+
+export MONO_PATH = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.Web/makefile.trace b/mcs/class/System.Web/makefile.trace
new file mode 100644
index 00000000000..789f5a5f5a4
--- /dev/null
+++ b/mcs/class/System.Web/makefile.trace
@@ -0,0 +1,12 @@
+# Used to build System.Web with trace support
+NANT=$(RUNTIME) ../../nant/NAnt.exe
+MAKE_GNU=$(MAKE) -f makefile.gnu -C .
+PLATFORM=uname | grep CYGWIN 2> /dev/null
+all:
+ @echo "Building System.Web.dll with Trace enabled."
+ ($(PLATFORM) && $(NANT) trace) || \
+ $(MAKE_GNU) LIB_FLAGS="/d:TRACE /d:WEBTRACE -r corlib -r System -r System.Drawing -r System.Xml"
+
+clean:
+ ($(PLATFORM) && $(NANT) clean) || $(MAKE_GNU) clean
+
diff --git a/mcs/class/System.Windows.Forms/.cvsignore b/mcs/class/System.Windows.Forms/.cvsignore
new file mode 100644
index 00000000000..29b2f870dfe
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/.cvsignore
@@ -0,0 +1,3 @@
+library-deps.stamp
+.response
+.makefrag
diff --git a/mcs/class/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/ChangeLog
new file mode 100644
index 00000000000..53ab5383d14
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/ChangeLog
@@ -0,0 +1,9 @@
+2003-01-15 Duncan Mak <duncan@ximian.com>
+
+ * Make it not spam all those warnings. Blocking errors 0108 and also
+ 0114.
+
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * added ChangeLog
+ * fixed MonoTodo compile errors with csc
diff --git a/mcs/class/System.Windows.Forms/CheckOutList b/mcs/class/System.Windows.Forms/CheckOutList
new file mode 100644
index 00000000000..3a2a8eb38b3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/CheckOutList
@@ -0,0 +1,208 @@
+
+AccessibleObject.cs
+AmbientProperties.cs
+Application.cs Need CE
+ApplicationContext.cs
+AssemblyInfo.cs
+AxHost.cs
+Binding.cs Need CE
+BindingContext.cs Need CE
+BindingManagerBase.cs Need CE
+BindingMemberInfo.cs Need CE - Needs constructor only.
+Button.cs Need CE - 10-28-2002 John Sohn <jsohn@columbus.rr.com>
+CheckBox.cs Need CE
+CheckedListBox.cs
+Clipboard.cs
+ColorDialog.cs
+ColumnHeader.cs Need CE
+ComboBox.cs Need CE
+CommonDialog.cs Need CE
+ContainerControl.cs Need CE
+ContextMenu.cs Need CE - 10-28-2002 - Alexandre Pigolkine <pigolkin@transporeon.com>
+Control.cs Need CE - 11-4-2002 Amitabh Iyer <amitabh.iyer@infrasofttech.biz>
+ControlBindingsCollection.cs Need CE
+ControlPaint.cs
+CreateParams.cs
+CurrencyManager.cs Need CE
+Cursor.cs Need CE
+CursorConverter.cs
+Cursors.cs Need CE
+DataFormats.cs
+DataGrid.cs
+DataGridBoolColumn.cs
+DataGridCell.cs
+DataGridColumnStyle.cs
+DataGridPreferredColumnWidthTypeConverter.cs
+DataGridTableStyle.cs
+DataGridTextBox.cs
+DataGridTextBoxColumn.cs
+DataObject.cs
+DateTimePicker.cs
+DomainUpDown.cs Need CE
+ErrorProvider.cs
+FeatureSupport.cs
+FileDialog.cs Need CE
+FolderBrowserDialog.cs
+FontDialog.cs
+Form.cs Need CE Amitabh Iyer <amitabh.iyer@infrasofttech.biz>
+GridColumnStylesCollection.cs
+GridItem.cs
+GridItemCollection.cs
+GridTableStylesCollection.cs
+GroupBox.cs
+Help.cs
+HelpProvider.cs
+HScrollBar.cs Need CE - 10-28-2002- Dennis Hayes <dennish@raytek.com>
+ImageIndexConverter.cs
+ImageList.cs Need CE - 10-28-2002 - Javier Alvarez <jamaa@tid.es>
+ImageListStreamer.cs
+InputLanguage.cs
+InputLanguageCollection.cs
+KeysConverter.cs
+Label.cs Need CE - 10-28-2002 John Sohn <jsohn@columbus.rr.com>
+LinkArea.cs
+LinkLabel.cs
+LinkState.cs
+ListBindingConverter.cs
+ListBox.cs Need CE - 10-28-2002 - Joshua Perry <jperry@1800contacts.com
+ListControl.cs Need CE
+ListView.cs Need CE
+ListViewItem.cs Need CE
+ListViewItemConverter.cs
+MainMenu.cs Need CE - 10-28-2002 - Alexandre Pigolkine <pigolkin@transporeon.com>
+Menu.cs Need CE - 10-28-2002 - Alexandre Pigolkine <pigolkin@transporeon.com>
+MenuItem.cs Need CE - 10-28-2002 - Alexandre Pigolkine <pigolkin@transporeon.com>
+Message.cs
+MessageBox.cs Need CE
+MethodInvoker.cs
+MonthCalendar.cs
+NativeWindow.cs 11-4-2002 Dominik Pich [Dominik@implemented.org]
+NotifyIcon.cs Javier - 10-28-2002 - Alvarez <jamaa@tid.es>
+NumericUpDown.cs Need CE
+OpacityConverter.cs
+OpenFileDialog.cs Need CE
+OSFeature.cs
+PageSetupDialog.cs
+Panel.cs Need CE
+PictureBox Need CE Needs Stubbing!!!
+PrintControllerWithStatusDialog.cs
+PrintDialog.cs
+PrintPreviewControl.cs
+PrintPreviewDialog.cs
+ProgressBar.cs Need CE
+PropertyGrid.cs
+PropertyManager.cs Need CE
+RadioButton.cs Need CE
+RichTextBox.cs
+RichTextBoxSelectionAttribute.cs
+RichTextBoxWordPunctuations.cs
+SaveFileDialog.cs Need CE
+Screen.cs Need CE - 10-28-2002 - Frs-Denis Gonthier <fgonthier@hermes.usherb.ca>
+ScrollableControl.cs Need CE - 10-28-2002 - Dennis Hayes <dennish@raytek.com>
+ScrollBar.cs Need CE - 10-28-2002 - Dennis Hayes <dennish@raytek.com>
+SecurityIDType.cs
+SelectionRange.cs
+SelectionRangeConverter.cs
+SendKeys.cs
+Splitter.cs
+StatusBar.cs Need CE
+StatusBarPanel.cs
+StatusBarPanelCollection.cs
+StructFormat.cs
+SystemInformation.cs Need CE (2 functions)
+TabControl.cs Need CE
+TabPage.cs Need CE
+TextBox.cs Need CE - 10-28-2002 - Joshua Perry <jperry@1800contacts.com
+TextBoxBase.cs Need CE - 10-28-2002 - Joshua Perry <jperry@1800contacts.com
+ThreadExceptionDialog.cs
+Timer.cs Need CE - 10-28-2002 - Javier Alvarez <jamaa@tid.es>
+ToolBar.cs Need CE
+ToolBarButton.cs Need CE
+tooltip.cs
+TrackBar.cs Need CE
+TreeNode.cs Need CE - 10-28-2002 - Jeff Bakst <jbakst@telocity.com>
+TreeNodeCollection.cs Need CE - 10-28-2002 - Jeff Bakst <jbakst@telocity.com>
+TreeNodeConverter.cs - 10-28-2002 - Jeff Bakst <jbakst@telocity.com>
+TreeView.cs Need CE - 10-28-2002 - Jeff Bakst <jbakst@telocity.com>
+TreeViewImageIndexConverter.cs - 10-28-2002 - Jeff Bakst <jbakst@telocity.com>
+UpDownBase.cs Need CE
+UserControl.cs Amitabh Iyer <amitabh.iyer@infrasofttech.biz>
+VScrollBar.cs Need CE - 10-28-2002 - Dennis Hayes <dennish@raytek.com>
+
+===================================================
+
+System.Windows.Forms.Design
+None of these are needed for CE
+
+=============================
+
+AnchorEditor.cs
+AssemblyInfo.cs
+AxImporter.cs
+ComponentDocumentDesigner.cs
+ComponentEditor.cs Needs stubbing
+ComponentEditorForm.cs
+ComponentTray.cs Needs stubbing
+ControlDesigner.cs
+DocumentDesigner.cs Needs stubbing
+EventsTab.cs Needs stubbing
+FileNameEditor.cs Needs stubbing
+IMenuEditorService.cs Needs stubbing
+IUIService.cs Needs stubbing
+IWindowsformsEditorService.cs Needs stubbing
+MenusCommands.cs Needs stubbing
+ParentControlDesigner.cs Needs stubbing
+PropertyTab.cs Needs stubbing
+ScrollableControlDesigner.cs Needs stubbing
+SelectionRules.cs Needs enumeration! easy task for someone.
+UITypeEditor.cs Needs stubbing
+
+===================================================
+
+System.Drawing.Drawing2D
+CE Complete
+Much work left for full .NET
+
+=============================
+
+
+===================================================
+
+System.Drawing.Drawing2D
+Much work left for full .NET
+
+=============================
+
+ImageAttributes.cs Needs CE (2 functions)
+
+===================================================
+
+System.Drawing
+Much work left for full .NET
+
+=============================
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mcs/class/System.Windows.Forms/Gtk/AnchorStyles.cs b/mcs/class/System.Windows.Forms/Gtk/AnchorStyles.cs
new file mode 100644
index 00000000000..2b166e21061
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/AnchorStyles.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.AnchorStyles.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AnchorStyles{
+ Bottom = 2,
+ Left = 4,
+ None = 0,
+ Right = 8,
+ Top = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Application.cs b/mcs/class/System.Windows.Forms/Gtk/Application.cs
new file mode 100644
index 00000000000..1ce7107ef92
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Application.cs
@@ -0,0 +1,37 @@
+//
+// System.Windows.Forms.Application
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Drawing;
+using Gtk;
+using GtkSharp;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public sealed class Application {
+ public static void Run ()
+ {
+ Gtk.Application.Run ();
+ }
+
+ static void terminate_event_loop (object o, EventArgs args)
+ {
+ Gtk.Application.Quit ();
+ }
+
+ public static void Run (Form form)
+ {
+ form.Visible = true;
+ form.Closed += new EventHandler (terminate_event_loop);
+
+ Gtk.Application.Run ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Button.cs b/mcs/class/System.Windows.Forms/Gtk/Button.cs
new file mode 100644
index 00000000000..5bfd9b998a5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Button.cs
@@ -0,0 +1,107 @@
+//
+// System.Windows.Forms.Button.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents a Windows button control.
+ /// </summary>
+
+ public class Button : ButtonBase, IButtonControl
+ {
+ // private fields
+ DialogResult dialogResult;
+//
+// // --- Constructor ---
+// protected Button() : base() {
+// dialogResult = DialogResult.None;
+// }
+//
+//
+//
+//
+// // --- Properties ---
+// [MonoTODO]
+// protected override CreateParams CreateParams {
+// get { throw new NotImplementedException (); }
+// }
+//
+ // --- IButtonControl property ---
+ public virtual DialogResult DialogResult {
+ get { return dialogResult; }
+ set { dialogResult=value; }
+ }
+//
+//
+//
+//
+ // --- IButtonControl method ---
+ [MonoTODO]
+ public virtual void NotifyDefault(bool value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void PerformClick() {
+ throw new NotImplementedException ();
+ }
+//
+// // --- Button methods for events ---
+// [MonoTODO]
+// protected override void OnClick(EventArgs e) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnMouseUp(MouseEventArgs mevent) {
+// throw new NotImplementedException ();
+// }
+//
+// // --- Button methods ---
+// [MonoTODO]
+// protected override bool ProcessMnemonic(char charCode) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override string ToString() {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void WndProc(ref Message m) {
+// throw new NotImplementedException ();
+// }
+//
+//
+//
+//
+// /// --- Button events ---
+// /// commented out, cause it only supports the .NET Framework infrastructure
+// /*
+// [MonoTODO]
+// public new event EventHandler DoubleClick {
+// add {
+// throw new NotImplementedException ();
+// }
+// remove {
+// throw new NotImplementedException ();
+// }
+// }
+// */
+
+ internal override Gtk.Widget CreateWidget () {
+ Gtk.Button button = new Gtk.Button ();
+ button.Add (label.Widget);
+ return button;
+ }
+ }
+//
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs b/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs
new file mode 100644
index 00000000000..48ffea11b0e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs
@@ -0,0 +1,204 @@
+//
+// System.Windows.Forms.ButtonBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Implements the basic functionality common to button controls.
+ /// ToDo note:
+ /// - no methods are implemented
+ /// </summary>
+
+ public abstract class ButtonBase : Control
+ {
+ // private fields
+// FlatStyle flatStyle;
+// Image image;
+// ContentAlignment imageAlign;
+// int imageIndex;
+ ContentAlignment textAlign;
+ internal protected Label label;
+
+//
+// // --- Constructor ---
+ protected ButtonBase() : base() {
+// flatStyle = FlatStyle.Standard;
+// image = null;
+// imageAlign = ContentAlignment.MiddleCenter;
+// imageIndex = -1;
+ textAlign = ContentAlignment.MiddleCenter;
+ label = new Label ();
+ label.Text = Text;
+ label.Visible = true;
+ ConnectToClicked ();
+ }
+
+ internal protected void clicked_cb (object o, EventArgs args)
+ {
+ OnClick (EventArgs.Empty);
+ }
+
+ internal protected void ConnectToClicked ()
+ {
+ ((Gtk.Button) Widget).Clicked += new EventHandler (clicked_cb);
+ }
+
+ // --- Properties ---
+// [MonoTODO]
+// protected override CreateParams CreateParams {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// protected override ImeMode DefaultImeMode {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// protected override Size DefaultSize {
+// get { throw new NotImplementedException (); }
+// }
+//
+// public FlatStyle FlatStyle {
+// get { return flatStyle; }
+// set { flatStyle=value; }
+// }
+//
+// public Image Image {
+// get { return image; }
+// set { image=value; }
+// }
+//
+// public ContentAlignment ImageAlign {
+// get { return imageAlign; }
+// set { imageAlign=value; }
+// }
+//
+// public int ImageIndex {
+// get { return imageIndex; }
+// set { imageIndex=value; }
+// }
+//
+// [MonoTODO]
+// public new ImeMode ImeMode {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// protected bool IsDefault {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+
+ public virtual ContentAlignment TextAlign {
+ get { return label.TextAlign; }
+ set { label.TextAlign=value; }
+ }
+//
+//
+//
+//
+//
+// /// --- Methods ---
+// /// internal .NET framework supporting methods, not stubbed out:
+// /// - protected override void Dispose(bool);
+// /// - protected void ResetFlagsandPaint();
+// [MonoTODO]
+// protected override AccessibleObject CreateAccessibilityInstance() {
+// throw new NotImplementedException ();
+// }
+//
+// /// [methods for events]
+// [MonoTODO]
+// protected override void OnEnabledChanged(EventArgs e) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnGotFocus(EventArgs e) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnKeyDown(KeyEventArgs kevent) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnKeyUp(KeyEventArgs kevent) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnLostFocus(EventArgs e) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnMouseDown(MouseEventArgs mevent) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnMouseEnter(EventArgs eventargs) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnMouseLeave(EventArgs eventargs) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnMouseMove(MouseEventArgs mevent) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnMouseUp(MouseEventArgs mevent) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnPaint(PaintEventArgs pevent) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnParentChanged(EventArgs e) {
+// throw new NotImplementedException ();
+// }
+//
+ protected override void OnTextChanged(EventArgs e) {
+ label.Text = Text;
+ }
+//
+// [MonoTODO]
+// protected override void OnVisibleChanged(EventArgs e) {
+// throw new NotImplementedException ();
+// }
+// /// end of [methods for events]
+//
+// [MonoTODO]
+// protected override void WndProc(ref Message m) {
+// throw new NotImplementedException ();
+// }
+//
+//
+//
+// /// --- ButtonBase.ButtonBaseAccessibleObject ---
+// /// the class is not stubbed, cause it's only used for .NET framework
+//
+//
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ContainerControl.cs b/mcs/class/System.Windows.Forms/Gtk/ContainerControl.cs
new file mode 100644
index 00000000000..5efb9445089
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ContainerControl.cs
@@ -0,0 +1,114 @@
+//
+// System.Windows.Forms.ContainerControl.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Provides focus management functionality for controls that can function as a container for other controls.
+ /// </summary>
+
+ public class ContainerControl : ScrollableControl, IContainerControl
+ {
+ protected ContainerControl() : base() {
+ }
+
+
+ public Control ActiveControl {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+//
+// [MonoTODO]
+// public override BindingContext BindingContext {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// protected override CreateParams CreateParams {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// public Form ParentForm {
+// get { throw new NotImplementedException (); }
+// }
+//
+//
+//
+// /// --- Methods ---
+// /// internal .NET framework supporting methods, not stubbed out:
+// /// - protected virtual void UpdateDefaultButton()
+// [MonoTODO]
+// protected override void AdjustFormScrollbars(bool displayScrollbars) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void Dispose(bool disposing) {
+// throw new NotImplementedException ();
+// }
+//
+ [MonoTODO]
+ bool IContainerControl.ActivateControl(Control control) {
+ throw new NotImplementedException ();
+ }
+//
+// // [event methods]
+// [MonoTODO]
+// protected override void OnControlRemoved(ControlEventArgs e) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void OnCreateControl() {
+// throw new NotImplementedException ();
+// }
+// // end of [event methods]
+//
+// [MonoTODO]
+// protected override bool ProcessDialogChar(char charCode) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override bool ProcessDialogKey(Keys keyData) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override bool ProcessMnemonic(char charCode) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected virtual bool ProcessTabKey(bool forward) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void Select(bool directed,bool forward) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public bool Validate() {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void WndProc(ref Message m) {
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Control.cs b/mcs/class/System.Windows.Forms/Gtk/Control.cs
new file mode 100644
index 00000000000..646e0028ef3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Control.cs
@@ -0,0 +1,263 @@
+//
+// System.Windows.Forms.Form
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Rachel Hestilow (hestilow@ximian.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Drawing;
+using Gtk;
+using GtkSharp;
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+ public class Control : Component {
+ internal Widget widget;
+ Control parent;
+ string text;
+ int left, top, width, height;
+ ControlCollection controls;
+ Point location = new Point (0, 0);
+ Gtk.Layout layout = null;
+ AnchorStyles anchor = AnchorStyles.Top|AnchorStyles.Left;
+
+ static int init_me;
+
+ public class ControlCollection : IList, ICollection, IEnumerable, ICloneable
+ {
+ ArrayList list = new ArrayList ();
+ Control owner;
+
+ public ControlCollection (Control owner)
+ {
+ this.owner = owner;
+ }
+
+ private ControlCollection ()
+ {
+ }
+
+ // ControlCollection
+ public virtual void Add (Control value) {
+ list.Add (value);
+ owner.OnControlAdded (new ControlEventArgs (value));
+ }
+ public virtual void AddRange (Control[] controls) {
+ list.AddRange (controls);
+ foreach (Control c in controls)
+ owner.OnControlAdded (new ControlEventArgs (c));
+ }
+
+ public bool Contains (Control value) { return list.Contains (value); }
+ public virtual void Remove (Control value) {
+ list.Remove (value);
+ owner.OnControlAdded (new ControlEventArgs (value));
+ }
+ public virtual Control this[int index] { get { return (Control) list[index]; } }
+ public int GetChildIndex (Control child) {
+ return GetChildIndex (child, true);
+ }
+ public int GetChildIndex (Control child, bool throwException) {
+ if (throwException && !Contains (child))
+ throw new Exception ();
+ return list.IndexOf (child);
+ }
+ public int IndexOf (Control value) { return list.IndexOf (value); }
+ public void SetChildIndex (Control child, int newIndex) {
+ int oldIndex = GetChildIndex (child);
+ if (oldIndex == newIndex)
+ return;
+ // is this correct behavior?
+ Control other = (Control) list[newIndex];
+ list[oldIndex] = other;
+ list[newIndex] = child;
+ }
+
+ // IList
+ public bool IsFixedSize { get { return list.IsFixedSize; } }
+ public bool IsReadOnly { get { return list.IsReadOnly; } }
+ int IList.Add (object value) { return list.Add (value); }
+ public void Clear () { list.Clear (); }
+ bool IList.Contains (object value) { return list.Contains (value); }
+ int IList.IndexOf (object value) { return list.IndexOf (value); }
+ void IList.Insert (int index, object value) { list.Insert (index, value); }
+ void IList.Remove (object value) { list.Remove (value); }
+ public void RemoveAt (int index) { list.RemoveAt (index); }
+
+ // ICollection
+ public int Count { get { return list.Count; } }
+ public bool IsSynchronized { get { return list.IsSynchronized; } }
+ public object SyncRoot { get { return list.SyncRoot; } }
+ public void CopyTo (Array array, int index) { list.CopyTo (array, index); }
+
+ // IEnumerable
+ public IEnumerator GetEnumerator () { return list.GetEnumerator (); }
+
+ // ICloneable
+ public object Clone () {
+ ControlCollection c = new ControlCollection ();
+ c.list = (ArrayList) list.Clone ();
+ c.owner = owner;
+ return c;
+ }
+
+ object IList.this[int index]
+ {
+ get { return list[index]; }
+ set { list[index] = value; }
+ }
+
+ }
+
+ static Control ()
+ {
+ init_me = 1;
+ }
+
+ public Control () : this ("")
+ {
+ }
+
+ public Control (string text) : this (null, text)
+ {
+ }
+
+ public Control (Control parent, string text)
+ {
+ this.parent = parent;
+ this.text = text;
+
+ }
+
+ public Control (string text, int left, int top, int width, int height)
+ {
+ }
+
+ public Control (Control parent, string text, int left, int top, int width, int height)
+ {
+ }
+
+ internal Widget Widget {
+ get {
+ if (widget == null)
+ widget = CreateWidget ();
+ return widget;
+ }
+ }
+
+ internal virtual Widget CreateWidget ()
+ {
+ layout = new Gtk.Layout (new Gtk.Adjustment (IntPtr.Zero), new Gtk.Adjustment (IntPtr.Zero));
+ layout.Show ();
+ return layout;
+ }
+
+ public virtual string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ OnTextChanged (EventArgs.Empty);
+ }
+ }
+
+ public event EventHandler TextChanged;
+
+ protected virtual void OnTextChanged (EventArgs e) {
+ if (TextChanged != null)
+ TextChanged (this, e);
+ }
+
+ public void Show ()
+ {
+ Widget.Show ();
+ }
+
+ public void Hide ()
+ {
+ Widget.Hide ();
+ }
+
+ public bool Visible {
+ get {
+ return Widget.Visible;
+ }
+
+ set {
+ Widget.Visible = value;
+ }
+ }
+
+ public ControlCollection Controls {
+ get { if (controls == null) controls = new ControlCollection (this); return controls;}
+ }
+
+ public event ControlEventHandler ControlAdded;
+ public event ControlEventHandler ControlRemoved;
+
+ internal void ControlLocationChanged (object o, EventArgs e)
+ {
+ Control c = (Control) o;
+ Point l = c.Location;
+ if (layout == null) {
+ Widget w = Widget;
+ }
+
+ layout.Move (c.Widget, l.X, l.Y);
+ }
+
+ protected virtual void OnControlAdded(ControlEventArgs e) {
+ e.Control.Visible = true;
+
+ if (ControlAdded != null)
+ ControlAdded (this, e);
+
+ Point l = e.Control.Location;
+ if (layout == null) {
+ Widget w = Widget;
+ }
+ layout.Put (e.Control.Widget, l.X, l.Y);
+ e.Control.LocationChanged += new EventHandler (ControlLocationChanged);
+ }
+
+ protected virtual void OnControlRemoved(ControlEventArgs e) {
+ if (ControlRemoved != null)
+ ControlRemoved (this, e);
+ }
+
+ public Point Location {
+ get { return location; }
+ set {
+ location = value;
+ OnLocationChanged (EventArgs.Empty);
+ }
+ }
+
+ public event EventHandler LocationChanged;
+
+ public virtual void OnLocationChanged (EventArgs e) {
+
+ if (LocationChanged != null)
+ LocationChanged (this, e);
+ }
+
+ public event EventHandler Click;
+
+ protected virtual void OnClick (EventArgs e) {
+ if (Click != null)
+ Click (this, e);
+ }
+
+ public virtual AnchorStyles Anchor {
+ get { return anchor; }
+ set { anchor=value; }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ControlEventArgs.cs b/mcs/class/System.Windows.Forms/Gtk/ControlEventArgs.cs
new file mode 100644
index 00000000000..408647128e9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ControlEventArgs.cs
@@ -0,0 +1,36 @@
+//
+// System.Windows.Forms.ControlEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+
+// (C) Ximian, Inc., 2002
+
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Provides data for the ControlAdded and ControlRemoved events.
+ /// ToDo note:
+ /// - no methods are implemented
+ /// </summary>
+
+ public class ControlEventArgs : EventArgs
+ {
+ Control control;
+
+ #region Constructors
+ public ControlEventArgs(Control control) {
+ this.control = control;
+ }
+ #endregion
+
+ #region Properties
+ public Control Control {
+ get { return control; }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ControlEventHandler.cs b/mcs/class/System.Windows.Forms/Gtk/ControlEventHandler.cs
new file mode 100644
index 00000000000..d42d35259c8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ControlEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ControlEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ControlEventHandler (
+ object sender,
+ ControlEventArgs e
+ );
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/Gtk/DialogResult.cs b/mcs/class/System.Windows.Forms/Gtk/DialogResult.cs
new file mode 100644
index 00000000000..82a5ff3646c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/DialogResult.cs
@@ -0,0 +1,31 @@
+//
+// System.Windows.Forms.DialogResult.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Specifies identifiers to indicate the return value of a dialog box.
+ /// </summary>
+ [Serializable]
+ //[ComVisible(true)]
+ public enum DialogResult
+ {
+ //Values were verified with enumcheck.
+ None = 0,
+ OK = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Form.cs b/mcs/class/System.Windows.Forms/Gtk/Form.cs
new file mode 100644
index 00000000000..6e9ad2ed2b7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Form.cs
@@ -0,0 +1,820 @@
+//
+// System.Windows.Forms.Form
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Drawing;
+using Gtk;
+using GtkSharp;
+
+namespace System.Windows.Forms {
+
+ public class Form : ContainerControl {
+ Window win;
+ string caption;
+
+ public Form () : base ()
+ {
+ }
+
+ static Form ()
+ {
+ Gtk.Application.Init ();
+ }
+
+ void delete_cb (object o, DeleteEventArgs args)
+ {
+
+ //if (Closing != null)
+ //Closing (o, args);
+
+ if (Closed != null)
+ Closed (o, args);
+ }
+
+ internal override Widget CreateWidget ()
+ {
+ Widget contents = base.CreateWidget ();
+ win = new Window (WindowType.Toplevel);
+
+ win.DeleteEvent += new DeleteEventHandler (delete_cb);
+ win.Title = Text;
+ win.Add (contents);
+ return (Widget) win;
+ }
+
+ // --- Public Properties
+ //
+ // [MonoTODO]
+ // public IButtonControl AcceptButton {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public static Form ActiveForm {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Form ActiveMdiChild {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool AutoScale {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public virtual Size AtoScaleBaseSize {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public override bool AutoScroll {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public virtual Color BackColor {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public IButtonControl CancelButton {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public new Size ClientSize {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool ControlBox {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Rectangle DesktopBounds {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Point DesktopLocation {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public DialogResult DialogResult {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public FormBorderStyle FormBorderStyle {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool HelpButton {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Icon Icon {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool IsMidiChild {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool IsMidiContainer {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool KeyPreview {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool MaximizeBox {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Size MaximumSize {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Form[] MdiChildren {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Form MdiParent {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public MainMenu Menu {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public MainMenu MergedMenu {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool MinimizeBox {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Size MinimumSize {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool Modal {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public double Opacity {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Form[] OwnedForms {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Form Owner {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool ShowInTaskbar {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public override ISite Site {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public SizeGripStyle SizeGripStyle {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public FormStartPosition StartPosition {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool TopLevel {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public bool TopMost {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public Color TransparencyKey {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public FormWindowState WindowState {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Public Methods
+ //
+ // [MonoTODO]
+ // public void Activate()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void AddOwnedForm(Form ownedForm)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void Close()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void Dispose()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public virtual bool Equals(object o);
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public static bool Equals(object o1, object o2);
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public static SizeF GetAutoScaleSize(Font font)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void Invalidate()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public object Invoke()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void LayoutMdi(MdiLayout value)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void PerformLayout()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void RemoveOwnedForm(Form ownedForm)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void ResumeLayout()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void Scale(float f)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void Select()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void SetBounds(int, int, int, int)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public void SetDesktopLocation(int x, int y)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public DialogResult ShowDialog()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // public override string ToString()
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ //
+ // --- Public Events
+ //
+ // [MonoTODO]
+ // public event EventHandler Activated {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public event EventHandler Closed;
+
+ // public event CancelEventHandler Closing;
+
+ // [MonoTODO]
+ // public event EventHandler Deactivate {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event InputLanguageChangedEventHandler InputLanguageChanged {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event InputLanguageChangingEventHandler InputLanguageChanging {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ // [MonoTODO]
+ // public event EventHandler Load {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event EventHandler MaximizedBoundsChanged {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event EventHandler MaximumSizeChanged {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event EventHandler MdiChildActivate {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event EventHandler MenuComplete {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event EventHandler MenuStart {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // public event EventHandler MinimumSizedChanged {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Protected Properties
+ //
+ // [MonoTODO]
+ // protected override CreateParams CreateParams {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // protected override ImeMode DefaultImeMode {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ // [MonoTODO]
+ // protected override Size DefaultSize {
+ //}
+ // [MonoTODO]
+ // protected Rectangle MaximizedBounds {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Protected Methods
+ //
+ // [MonoTODO]
+ // protected override void AdjustFormScrollbars(bool displayScrollbars)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override ControlCollection CreateControlsInstnace()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void CreateHandle()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void DefWndProc(ref Message m)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void Dispose(bool b)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected virtual void OnClosed(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnClosing(CancelEventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected override void OnCreateControl()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void OnFontChanged(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void OnHandleCreated(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void OnHandleDestroyed(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected virtual void OnInputLanguageChanged( OnInputLanguageChangedEventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnInputLanguagedChanging( OnInputLanguagedChangingEventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnLoad(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnMaximizedBoundsChanged(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnMaximumSizedChanged(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnMdiChildActive(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnMenuComplete(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnMenuStart(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected virtual void OnMinimumSizeChanged(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected override void OnPaint(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void OnResize(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void OnStyleChanged(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ protected override void OnTextChanged(EventArgs e)
+ {
+ if (win != null)
+ win.Title = Text;
+ }
+
+ // [MonoTODO]
+ // protected override void OnVisibleChanged(EventArgs e)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected override bool ProcessCmdKey( ref Message msg, Keys keyData)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override bool ProcessDialogKey(Keys keyData)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override bool ProcessKeyPreview(ref Message m)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override bool ProcessTabKey(bool forward)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected override void ScaleScore(float x, float y)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void Select(bool b1, bool b2)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void SelectClientSizeCore(int x, int y)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void SetVisibleCore(bool value)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ // [MonoTODO]
+ // protected void UpdateBounds()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected override void WndProc(ref Message m)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/HorizontalAlignment.cs b/mcs/class/System.Windows.Forms/Gtk/HorizontalAlignment.cs
new file mode 100644
index 00000000000..0430f0ae8bc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/HorizontalAlignment.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.HorizontalAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum HorizontalAlignment {
+ Center = 2,
+ Left = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/IButtonControl.cs b/mcs/class/System.Windows.Forms/Gtk/IButtonControl.cs
new file mode 100644
index 00000000000..874d98543c0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/IButtonControl.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.IButtonControl.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ interface IButtonControl {
+ void NotifyDefault(bool value);
+ void PerformClick();
+ DialogResult DialogResult {get; set;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/IContainerControl.cs b/mcs/class/System.Windows.Forms/Gtk/IContainerControl.cs
new file mode 100644
index 00000000000..989400c32c0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/IContainerControl.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.IContainerControl.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IContainerControl
+ {
+ bool ActivateControl(Control active);
+ Control ActiveControl {get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/Gtk/Label.cs b/mcs/class/System.Windows.Forms/Gtk/Label.cs
new file mode 100644
index 00000000000..982c0a68f8a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Label.cs
@@ -0,0 +1,276 @@
+//
+// System.Windows.Forms.Label.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+ using System.Drawing;
+
+ // <summary>
+ //
+ // </summary>
+
+ public class Label : Control {
+
+ public Label () : base ()
+ {
+ }
+
+ //public virtual bool AutoSize {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public FlatStyle FlatStyle {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public Image Image {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public ContentAlignment ImageAlign {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public int ImageIndex {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public ImageList ImageList {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public ImeMode ImeMode {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public int PreferredHeight {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public int PreferredWidth {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public bool TabStop {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ [MonoTODO]
+ public virtual ContentAlignment TextAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ //[MonoTODO]
+ //public bool UseMnemonic {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Public Methods
+ //
+ //[MonoTODO]
+ //public virtual bool Equals(object o);
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public static bool Equals(object o1, object o2);
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Select()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public override string ToString()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //
+ // --- Public Events
+ //
+ //[MonoTODO]
+ //public event EventHandler AutoSizeChanged {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public event EventHandler TextAlignChanged {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Protected Methods
+ //
+ //[MonoTODO]
+ //protected Rectangle CalcImageRenderBounds( Image image, Rectangle rect, ContentAlignment align)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void Dispose()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void Dispose(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void DrawImage( Graphics g, Image img, Rectangle r, ContentAlignment align)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnEnabledChanged (EventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnFontChanged (EventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnPaint (PaintEventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnParentChanged (EventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ protected override void OnTextChanged (EventArgs e)
+ {
+ ((Gtk.Label) Widget).Text = Text;
+ }
+
+ //[MonoTODO]
+ //protected override void OnVisibleChanged (EventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override bool ProcessMnemonic(char charCode)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected ContentAlignment RtlTranslateAlignment( ContentAlignment alignment)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected HorizontalAlignment RtlTranslateAlignment( HorizontalAlignment alignment)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected virtual void Select(bool val1, bool val2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void SetBoundsCore( int x, int y, int width, int height BoundsSpecified specified)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void UpdateBounds()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void UpdateBounds(int b1, int b2, int b3, int b4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void WndProc(ref Message m)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ internal override Gtk.Widget CreateWidget () {
+ return new Gtk.Label (Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs b/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs
new file mode 100644
index 00000000000..c18aa28f0c9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs
@@ -0,0 +1,206 @@
+//
+// System.Windows.Forms.ProgressBar
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Remco de Jong (rdj@rdj.cg.nu)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.Drawing.Printing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows progress bar control.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class ProgressBar : Control {
+
+ #region Fields
+ private int maximum;
+ private int minimum;
+ private int step;
+ private int val;
+ #endregion
+
+ #region Constructor
+ [MonoTODO]
+ public ProgressBar()
+ {
+ maximum=100;
+ minimum=0;
+ step=10;
+ val=0;
+ }
+ #endregion
+
+ internal override Gtk.Widget CreateWidget () {
+ Gtk.ProgressBar pbar = new Gtk.ProgressBar ();
+ return pbar;
+ }
+
+/* #region Properties
+ [MonoTODO]
+ public override bool AllowDrop {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Color BackColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+*/
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new bool CausesValidation {get; set;}
+
+/* [MonoTODO]
+ protected override CreateParams CreateParams {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Font Font {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+*/
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new ImeMode ImeMode {get; set;}
+
+ public int Maximum {
+ get {
+ return maximum;
+ }
+ set {
+ maximum=value;
+ }
+ }
+
+ public int Minimum {
+ get {
+ return minimum;
+ }
+ set {
+ minimum=value;
+ }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new bool TabStop {get; set;}
+/* [MonoTODO]
+ public override RightToLeft RightToLeft {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+*/
+ public int Step {
+ get {
+ return step;
+ }
+ set {
+ step=value;
+ }
+ }
+
+ protected override void OnTextChanged(EventArgs e)
+ {
+ ((Gtk.ProgressBar)Widget).Text = Text;
+ }
+
+ public int Value {
+ get {
+ return val;
+ }
+ set {
+ if (val <= maximum) {
+ val=value;
+ float fraction = ((float) val / (float) maximum);
+ ((Gtk.ProgressBar)Widget).Fraction = fraction;
+ }
+ }
+ }
+// #endregion
+
+
+
+
+/* #region Methods
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+ public void Increment(int value)
+ {
+ Value += value;
+ }
+
+/* [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+ public void PerformStep()
+ {
+ Value += step;
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+// #endregion
+
+
+
+
+ #region Events
+ /*
+ * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code:
+ public new event EventHandler DoubleClick;
+ public new event EventHandler Enter;
+ public new event KeyEventHandler KeyDown;
+ public new event KeyPressEventHandler KeyPress;
+ public new event KeyEventHandler KeyUp;
+ public new event EventHandler Leave;
+ public new event PaintEventHandler Paint;
+ */
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ScrollBars.cs b/mcs/class/System.Windows.Forms/Gtk/ScrollBars.cs
new file mode 100644
index 00000000000..355b159bbfb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ScrollBars.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ScrollBars.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ScrollBars {
+ Both = 3,
+ Horizontal = 1,
+ None = 0,
+ Vertical = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs b/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs
new file mode 100644
index 00000000000..6bfa153b5c7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs
@@ -0,0 +1,305 @@
+//
+// System.Windows.Forms.Form
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Drawing;
+using Gtk;
+using GtkSharp;
+
+namespace System.Windows.Forms {
+ public class ScrollableControl : Control {
+
+ //
+ // --- Constructor
+ //
+ //[MonoTODO]
+ //public ScrollableControl()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //
+ // --- Public Properties
+ //
+ //[MonoTODO]
+ //public virtual bool AutoScroll {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public Size AutoScrollMargin {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public Size AutoScrollMinSize {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public Point AutoScrollPosition {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public override Rectangle DisplayRectangle {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public ScrollableControl.DockPaddingEdges DockPadding {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public override ISite Site {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Public Methods
+ //
+ //[MonoTODO]
+ //public IAsyncResult BeginInvoke(Delegate del)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public IAsyncResult BeginInvoke(Delegate del, object[] objs)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Dispose()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public virtual bool Equals(object o);
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public static bool Equals(object o1, object o2);
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Invalidate()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Invalidate(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Invalidate(Rectangle rect)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Invalidate(Region reg)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Invalidate(Rectangle rect, bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Invalidate(Region reg, bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public object Invoke(Delegate del)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public object Invoke(Delegate del, object[] objs)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void PerformLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void PerformLayout(Control ctl, string str)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void ResumeLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void ResumeLayout(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Scale(float val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Scale(float val1, float val2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Select()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void Select(bool val1, bool val2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void SetBounds(int val1, int val2, int val3, int val4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //public void SetBounds(int val1, int val2, int val3, int val4, BoundsSpecified bounds)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //
+ // --- Protected Properties
+ //
+ //[MonoTODO]
+ //protected override CreateParams CreateParams {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //protected bool HScroll {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //protected bool VScroll {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Protected Methods
+ //
+ //[MonoTODO]
+ //protected virtual void AdjustFormScrollbars( bool displayScrollbars)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void Dispose(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnLayout(LayoutEventArgs levent)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnMouseWheel(MouseEventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void OnVisibleChanged(EventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //ContentAlignment RtlTranslateAlignment(ContentAlignment calign)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment halign)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment lralign)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void ScaleCore(float dx, float dy)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void UpdateBounds()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void UpdateBounds(int val1, int val2, int val3, int val4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected void UpdateBounds(int val1, int val2, int val3, int val4, int val5, int val6)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //[MonoTODO]
+ //protected override void WndProc(ref Message m)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TextBox.cs b/mcs/class/System.Windows.Forms/Gtk/TextBox.cs
new file mode 100644
index 00000000000..6f0c3a805cd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TextBox.cs
@@ -0,0 +1,218 @@
+//
+// System.Windows.Forms.TextBox
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+// Remco de Jong (rdj@rdj.cg.nu)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class TextBox : TextBoxBase {
+
+ private Gtk.TextView textview;
+ private ScrollBars scrollbars;
+ private HorizontalAlignment textalign;
+ private bool wordwrap;
+
+ //
+ // --- Public Constructor
+ //
+ public TextBox() {
+ scrollbars = ScrollBars.None;
+ }
+
+ internal override Gtk.Widget CreateWidget () {
+ // needs to initialized with a textbuffer from TextBoxBase
+ // we need default adjustments, but the scrolledwindow constructor does not take null as argument
+
+ Gtk.ScrolledWindow window = new Gtk.ScrolledWindow (new Gtk.Adjustment (IntPtr.Zero), new Gtk.Adjustment (IntPtr.Zero));
+ window.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
+ window.AddWithViewport(TextView);
+ return window;
+ }
+
+ // --- Public Properties
+
+ public override bool ReadOnly {
+ get
+ {
+ return !TextView.Editable;
+ }
+ set
+ {
+ if (value == TextView.Editable) { // only change if value is different, correct behaviour?
+ TextView.Editable = !value;
+ OnReadOnlyChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [MonoTODO]
+ public bool AcceptsReturn {
+
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+/* public CharacterCasing CharacterCasing {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+*/ [MonoTODO]
+ public char PasswordChar {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public ScrollBars ScrollBars {
+ get {
+ return scrollbars;
+ }
+ set {
+ scrollbars = value;
+
+ Gtk.PolicyType vpolicy = Gtk.PolicyType.Never; // correct behaviour?
+ Gtk.PolicyType hpolicy = Gtk.PolicyType.Never;
+
+ if (scrollbars == ScrollBars.Both) {
+ vpolicy = Gtk.PolicyType.Always;
+ hpolicy = Gtk.PolicyType.Always;
+ }
+ else if (scrollbars == ScrollBars.Horizontal) {
+ hpolicy = Gtk.PolicyType.Always;
+ }
+ else if (scrollbars == ScrollBars.Vertical) {
+ vpolicy = Gtk.PolicyType.Always;
+ }
+
+ ((Gtk.ScrolledWindow) Widget).SetPolicy(hpolicy, vpolicy);
+ }
+ }
+
+ public HorizontalAlignment TextAlign {
+ get
+ {
+ return textalign;
+ }
+ set
+ {
+ Gtk.Justification justification = Gtk.Justification.Left;
+ if (value == HorizontalAlignment.Center) {
+ justification = Gtk.Justification.Center;
+ }
+ else if (value == HorizontalAlignment.Right) {
+ justification = Gtk.Justification.Right;
+ }
+
+ TextView.Justification = justification;
+ textalign = value;
+
+ OnTextAlignChanged(EventArgs.Empty);
+ }
+ }
+
+ public override bool WordWrap {
+ get
+ {
+ return wordwrap;
+ }
+ set
+ {
+ Gtk.WrapMode wrapmode = Gtk.WrapMode.None;
+ wordwrap = value;
+ if (wordwrap)
+ wrapmode = Gtk.WrapMode.Word;
+
+ TextView.WrapMode = wrapmode;
+ }
+ }
+
+
+ // --- Public Events
+
+ public event EventHandler TextAlignChanged;
+
+ // --- Protected Properties
+
+/* [MonoTODO]
+ protected override CreateParams CreateParams {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+*/
+ // --- Protected Members
+
+ protected Gtk.TextView TextView {
+ get {
+ if (textview == null) {
+ textview = new Gtk.TextView(TextBuffer);
+ textview.Show();
+ }
+ return textview;
+ }
+ }
+
+/* protected override bool IsInputKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs mevent)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ protected virtual void OnTextAlignChanged(EventArgs e)
+ {
+ if (TextAlignChanged != null)
+ TextAlignChanged (this, e);
+ }
+
+/* [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+*/ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs b/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs
new file mode 100644
index 00000000000..28e14422f38
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs
@@ -0,0 +1,442 @@
+//
+// System.Windows.Forms.TextBoxBase
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+// Remco de Jong (rdj@rdj.cg.nu)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class TextBoxBase : Control {
+
+ private int maxlength = 0;
+ private Gtk.TextTagTable tagtable;
+ private Gtk.TextBuffer textbuffer = null;
+
+ //
+ // --- Public Properties
+ //
+
+ public TextBoxBase () {
+ }
+
+ protected Gtk.TextBuffer TextBuffer {
+ get {
+ if (textbuffer == null) {
+ tagtable = new Gtk.TextTagTable ();
+ textbuffer = new Gtk.TextBuffer (tagtable);
+ // attach events
+
+ textbuffer.ModifiedChanged += new EventHandler (modified_changed_cb);
+ }
+
+ return textbuffer;
+ }
+ }
+
+ protected override void OnTextChanged(EventArgs e)
+ {
+ TextBuffer.SetText(Text, Text.Length);
+ }
+
+ [MonoTODO]
+ public bool AcceptsTab {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual bool AutoSize {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+/* [MonoTODO]
+ public override Color BackColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+*/ [MonoTODO]
+ public bool CanUndo {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool HideSelection {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string[] Lines {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ Clear ();
+ foreach (String s in value) {
+ AppendText (s + "\n");
+ }
+ }
+ }
+ [MonoTODO]
+ public virtual int MaxLength {
+ get
+ {
+ return maxlength;
+ }
+ set
+ {
+ maxlength = value;
+ }
+ }
+
+ public bool Modified {
+ get
+ {
+ return TextBuffer.Modified;
+ }
+ set
+ {
+ if (TextBuffer.Modified != value) { // only call if it has really been changed since this will trigger an event, is this correct behavior?
+ TextBuffer.Modified = value;
+ }
+ }
+ }
+ [MonoTODO]
+ public virtual bool Multiline {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int PreferredHeight {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual bool ReadOnly {
+ // needs to be overwritten by child classes
+ get { return false; }
+ set {}
+ }
+
+ [MonoTODO]
+ public virtual string SelectedText {
+ get
+ {
+ String selection = "";
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+
+ if (TextBuffer.GetSelectionBounds(ref start, ref end))
+ selection = TextBuffer.GetText(start, end, true);
+
+ return selection;
+ }
+ set
+ {
+ // paste text over selection
+ }
+ }
+ [MonoTODO]
+ public virtual int SelectionLength {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectionStart {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual int TextLength {
+
+ get
+ {
+ return Text.Length;
+ }
+ }
+ [MonoTODO]
+
+ public virtual bool WordWrap {
+ get
+ {
+ return false;
+ }
+ set
+ {
+ }
+ }
+
+ // --- Public Methods
+
+ public void AppendText(string text)
+ {
+ Text += text;
+ }
+
+ public void Clear()
+ {
+ TextBuffer.SetText("", 0);
+ }
+ [MonoTODO]
+ public void ClearUndo()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Copy()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Cut()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Paste()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ScrollToCaret()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Select(int start, int length)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SelectAll()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Undo()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Internal Events (Gtk)
+
+ internal protected void modified_changed_cb (object o, EventArgs args)
+ {
+ OnModifiedChanged (EventArgs.Empty);
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event EventHandler AcceptsTabChanged;
+ [MonoTODO]
+ public event EventHandler AutoSizeChanged;
+ [MonoTODO]
+ public event EventHandler BorderStyleChanged;
+ [MonoTODO]
+ //public override event EventHandler Click;
+ [MonoTODO]
+ public event EventHandler HideSelectionChanged;
+ public event EventHandler ModifiedChanged;
+ [MonoTODO]
+ public event EventHandler MultilineChanged;
+ public event EventHandler ReadOnlyChanged;
+
+ // --- Protected Properties
+/*
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+/* protected override bool IsInputKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+*/ [MonoTODO]
+ protected virtual void OnAcceptsTabChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnAutoSizeChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBorderStyleChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+/*
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+ protected virtual void OnHideSelectionChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnModifiedChanged(EventArgs e)
+ {
+ if (ModifiedChanged != null)
+ ModifiedChanged (this, e);
+ }
+ [MonoTODO]
+ protected virtual void OnMultilineChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnReadOnlyChanged(EventArgs e)
+ {
+ if (ReadOnlyChanged != null)
+ ReadOnlyChanged (this, e);
+ }
+/* [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+*/ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/Gtk/changelog b/mcs/class/System.Windows.Forms/Gtk/changelog
new file mode 100644
index 00000000000..1ba86b3a7ea
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/changelog
@@ -0,0 +1,13 @@
+2002-8-7 DennisHayes <dennish@raytek.com>
+
+* Started changelog
+
+2002-8-7 DennisHayes <dennish@raytek.com>
+Check in for Remco de Jong <rdj@rdj.cg.nu>
+
+* HorizontalAlignment.cs
+* ProgressBar.cs
+* ScrollBars.cs
+* TextBox.cs
+* TextBoxBase.cs
+* added new files with some functinality
diff --git a/mcs/class/System.Windows.Forms/Gtk/demo.cs b/mcs/class/System.Windows.Forms/Gtk/demo.cs
new file mode 100644
index 00000000000..d0a6abbe9f1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/demo.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+class X {
+ static void Clicked (object o, EventArgs args)
+ {
+ Console.WriteLine ("the button was clicked");
+ }
+
+ static void Demo_Window ()
+ {
+ Form form = new Form ();
+
+ form.Text = "hello";
+
+ Label l = new Label ();
+ l.Location = new Point (20, 20);
+ l.Text = "Hello world";
+ form.Controls.Add (l);
+
+ Button b = new Button ();
+ b.Text = "a button";
+ b.Location = new Point (20, 60);
+ b.Click += new EventHandler (Clicked);
+ form.Controls.Add (b);
+
+ form.Visible = true;
+
+ Application.Run ();
+ }
+
+ static void Demo_AppRun ()
+ {
+ Form form = new Form ();
+
+ form.Text = "hello";
+
+ Application.Run (form);
+ }
+
+ static void Main (string [] args)
+ {
+ string demo = "window";
+
+ if (args.Length > 0)
+ demo = args [0];
+
+ switch (demo){
+ case "window":
+ Demo_Window ();
+ break;
+ case "app_run":
+ Demo_AppRun ();
+ break;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/makefile b/mcs/class/System.Windows.Forms/Gtk/makefile
new file mode 100644
index 00000000000..d7857734d5c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/makefile
@@ -0,0 +1,26 @@
+CSC=mcs
+SWFF=-r gtk-sharp -r glib-sharp -r System.Drawing
+
+SOURCES = \
+ AnchorStyles.cs \
+ Application.cs \
+ ContainerControl.cs \
+ Button.cs \
+ ButtonBase.cs \
+ Control.cs \
+ ControlEventArgs.cs \
+ ControlEventHandler.cs \
+ DialogResult.cs \
+ Form.cs \
+ IButtonControl.cs \
+ IContainerControl.cs \
+ Label.cs \
+ ScrollableControl.cs
+
+all: demo.exe
+
+demo.exe: demo.cs System.Windows.Forms.dll
+ $(CSC) demo.cs -r System.Windows.Forms.dll -r System.Drawing
+
+System.Windows.Forms.dll: $(SOURCES)
+ $(CSC) $(SWFF) --target library -o System.Windows.Forms.dll $(SOURCES)
diff --git a/mcs/class/System.Windows.Forms/README b/mcs/class/System.Windows.Forms/README
new file mode 100644
index 00000000000..2a558f8f0b2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/README
@@ -0,0 +1,102 @@
+System.Windows.Forms README
+
+ by John Sohn (jsohn@columbus.rr.com) and Miguel de Icaza (miguel@ximian.com)
+
+ The maintainers:
+ Dennis Hayes (DENNISH@Raytek.com)
+ Backup: Miguel de Icaza (miguel@ximian.com)
+
+ Mailing list:
+
+ http://lists.ximian.com/mailman/listinfo/mono-winforms-list
+
+ The address is:
+
+ mono-winforms-list@ximian.com.
+
+
+* Introduction
+
+ Welcome to the System.Windows.Forms implementation for Mono.
+
+ This is still an early version of the class library. The
+ plans for this library have changed, the plans to use multiple
+ backends is no longer being pursued.
+
+ We are now implementing this using the Wine library (because
+ Windows.Forms applications require the message handling to be
+ compatible with Windows, look up the Control.Wndproc method
+ for details).
+
+ Currently it is possible to use the Visual Studio solution in
+ this directory to build the class libraries, and test the
+ sample programs against our implementation.
+
+ To run and execute with the Mono runtime on linux, the story
+ is more complicated as we need to use the "WineLib" support in
+ Wine.
+
+* The Layout
+
+ The layout in this directory has some historical files that you can
+ safely ignore, the following are just historical directories:
+
+ Gtk/
+ WINElib/
+
+ All of the real code is being done in the same was as it is being done
+ in the rest of the Mono assemblies.
+
+* Building System.Windows.Forms for Unix using Wine.
+
+ Since a WineLib application is a Windows application that is compiled under
+ Unix/Linux as a shared library it needs to be started differently than other
+ applications. The WineLib application is started as any other Windows
+ application running under Wine using the wine command. You cannot simply link
+ in libwine (gcc myapp.c -lwine) to use Win32 functions.
+
+ In order to use WineLib/Win32 functions under Mono I have created a small
+ "stub" application that embeds the Mono engine inside the WineLib application.
+ This is basically a replacement for the "mono" command that can be used
+ to call the Win32 API (using WineLib) within an application written for Mono.
+
+ To get started I suggest installing Wine and Mono first if they are not
+ already installed. I am usually using the latest Wine snapshots built from
+ source and installed under /usr/local. Also be sure to build/use a version of
+ Mono with garbage collection disabled as there is a problem using WineLib with
+ garbage collection enabled (check the mono-list archives for this discussion).
+ You can disable garbage collection when building mono by adding --with-gc=none
+ to the configure command. In the mono directory I build mono as:
+ ./configure --with-gc=none
+
+ In the WINELib makefile you may have set these to the appropriate files and/or
+ paths on your PC:
+
+ X11R6_INCLUDE=/usr/X11R6/include
+ WINE_INCLUDE=/usr/local/include/wine
+ WINE_LIB=/usr/local/lib/wine
+ LIBMONO=/usr/local/lib/libmono.a
+
+ If you type make from the mcs/class/System.Windows.Forms/WINELib
+ directory it should build:
+
+ System.Windows.Forms.dll -
+ The current (if largely incomplete) Windows Forms package.
+
+ FormTest.exe, NativeWindowTest.exe, Test.exe -
+ Test applications which link to and tests the System.Windows.Forms.dll
+
+ monostub.exe.so -
+ The WineLib application that starts the Mono/WineLib application. This
+ small WineLib application embeds the Mono JIT engine allowing any Mono
+ application running in it access to WineLib/Win32 function calls.
+
+ Before starting any of the applications set the LD_LIBRARY_PATH to the
+ current directory (so DllImport can find the monostub.exe.so library):
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
+
+ To start any of the applications you type (from the WINELib directory):
+ wine monostub.exe.so mono-winelibapp.exe
+
+
+
diff --git a/mcs/class/System.Windows.Forms/SWFTest/App.ico b/mcs/class/System.Windows.Forms/SWFTest/App.ico
new file mode 100644
index 00000000000..3a5525fd794
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/App.ico
Binary files differ
diff --git a/mcs/class/System.Windows.Forms/SWFTest/AssemblyInfo.cs b/mcs/class/System.Windows.Forms/SWFTest/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/System.Windows.Forms/SWFTest/Form1.cs b/mcs/class/System.Windows.Forms/SWFTest/Form1.cs
new file mode 100644
index 00000000000..aba9ca8fe44
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/Form1.cs
@@ -0,0 +1,364 @@
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+
+namespace SWFTest
+{
+ /// <summary>
+ /// Summary description for Form1.
+ /// </summary>
+ public class Form1 : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.LinkLabel linkLabel1;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.MainMenu mainMenu1;
+ private System.Windows.Forms.CheckBox checkBox1;
+ private System.Windows.Forms.RadioButton radioButton1;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.ContextMenu contextMenu1;
+ private System.Windows.Forms.StatusBar statusBar1;
+ private System.Windows.Forms.ToolBar toolBar1;
+ private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.DataGrid dataGrid1;
+ private System.Windows.Forms.MonthCalendar monthCalendar1;
+ private System.Windows.Forms.DateTimePicker dateTimePicker1;
+ private System.Windows.Forms.HScrollBar hScrollBar1;
+ private System.Windows.Forms.VScrollBar vScrollBar1;
+ private System.Windows.Forms.Timer timer1;
+ private System.Windows.Forms.Splitter splitter1;
+ private System.Windows.Forms.DomainUpDown domainUpDown1;
+ private System.Windows.Forms.NumericUpDown numericUpDown1;
+ private System.Windows.Forms.TrackBar trackBar1;
+ private System.Windows.Forms.ProgressBar progressBar1;
+ private System.Windows.Forms.RichTextBox richTextBox1;
+ private System.Windows.Forms.ImageList imageList1;
+ private System.Windows.Forms.HelpProvider helpProvider1;
+ private System.Windows.Forms.ToolTip toolTip1;
+ private System.Windows.Forms.ContextMenu contextMenu2;
+ private System.Windows.Forms.NotifyIcon notifyIcon1;
+ private System.Windows.Forms.OpenFileDialog openFileDialog1;
+ private System.Windows.Forms.SaveFileDialog saveFileDialog1;
+ private System.Windows.Forms.FontDialog fontDialog1;
+ private System.Windows.Forms.ColorDialog colorDialog1;
+ private System.Windows.Forms.PrintDialog printDialog1;
+ private System.Windows.Forms.PrintPreviewControl printPreviewControl1;
+ private System.Windows.Forms.ErrorProvider errorProvider1;
+ private System.Drawing.Printing.PrintDocument printDocument1;
+ private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
+ private System.ComponentModel.IContainer components;
+
+ public Form1()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.label1 = new System.Windows.Forms.Label();
+ this.linkLabel1 = new System.Windows.Forms.LinkLabel();
+ this.button1 = new System.Windows.Forms.Button();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this.checkBox1 = new System.Windows.Forms.CheckBox();
+ this.radioButton1 = new System.Windows.Forms.RadioButton();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.contextMenu1 = new System.Windows.Forms.ContextMenu();
+ this.statusBar1 = new System.Windows.Forms.StatusBar();
+ this.toolBar1 = new System.Windows.Forms.ToolBar();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.dataGrid1 = new System.Windows.Forms.DataGrid();
+ this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
+ this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
+ this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
+ this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.splitter1 = new System.Windows.Forms.Splitter();
+ this.domainUpDown1 = new System.Windows.Forms.DomainUpDown();
+ this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+ this.trackBar1 = new System.Windows.Forms.TrackBar();
+ this.progressBar1 = new System.Windows.Forms.ProgressBar();
+ this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+ this.imageList1 = new System.Windows.Forms.ImageList(this.components);
+ this.helpProvider1 = new System.Windows.Forms.HelpProvider();
+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.contextMenu2 = new System.Windows.Forms.ContextMenu();
+ this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
+ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
+ this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
+ this.fontDialog1 = new System.Windows.Forms.FontDialog();
+ this.colorDialog1 = new System.Windows.Forms.ColorDialog();
+ this.printDialog1 = new System.Windows.Forms.PrintDialog();
+ this.printPreviewControl1 = new System.Windows.Forms.PrintPreviewControl();
+ this.errorProvider1 = new System.Windows.Forms.ErrorProvider();
+ this.printDocument1 = new System.Drawing.Printing.PrintDocument();
+ this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.Location = new System.Drawing.Point(111, 252);
+ this.label1.Name = "label1";
+ this.label1.TabIndex = 0;
+ this.label1.Text = "label1";
+ //
+ // linkLabel1
+ //
+ this.linkLabel1.Location = new System.Drawing.Point(26, 74);
+ this.linkLabel1.Name = "linkLabel1";
+ this.linkLabel1.TabIndex = 1;
+ this.linkLabel1.TabStop = true;
+ this.linkLabel1.Text = "linkLabel1";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(26, 117);
+ this.button1.Name = "button1";
+ this.button1.TabIndex = 2;
+ this.button1.Text = "button1";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(17, 157);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.TabIndex = 3;
+ this.textBox1.Text = "textBox1";
+ //
+ // checkBox1
+ //
+ this.checkBox1.Location = new System.Drawing.Point(16, 211);
+ this.checkBox1.Name = "checkBox1";
+ this.checkBox1.TabIndex = 4;
+ this.checkBox1.Text = "checkBox1";
+ //
+ // radioButton1
+ //
+ this.radioButton1.Location = new System.Drawing.Point(10, 257);
+ this.radioButton1.Name = "radioButton1";
+ this.radioButton1.TabIndex = 5;
+ this.radioButton1.Text = "radioButton1";
+ //
+ // groupBox1
+ //
+ this.groupBox1.Location = new System.Drawing.Point(14, 293);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.TabIndex = 6;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "groupBox1";
+ //
+ // statusBar1
+ //
+ this.statusBar1.Location = new System.Drawing.Point(0, 548);
+ this.statusBar1.Name = "statusBar1";
+ this.statusBar1.Size = new System.Drawing.Size(813, 22);
+ this.statusBar1.TabIndex = 7;
+ this.statusBar1.Text = "statusBar1";
+ //
+ // toolBar1
+ //
+ this.toolBar1.DropDownArrows = true;
+ this.toolBar1.Location = new System.Drawing.Point(0, 0);
+ this.toolBar1.Name = "toolBar1";
+ this.toolBar1.ShowToolTips = true;
+ this.toolBar1.Size = new System.Drawing.Size(813, 42);
+ this.toolBar1.TabIndex = 8;
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.BackColor = System.Drawing.Color.Red;
+ this.pictureBox1.Location = new System.Drawing.Point(22, 415);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.TabIndex = 9;
+ this.pictureBox1.TabStop = false;
+ //
+ // panel1
+ //
+ this.panel1.Location = new System.Drawing.Point(164, 421);
+ this.panel1.Name = "panel1";
+ this.panel1.TabIndex = 10;
+ //
+ // dataGrid1
+ //
+ this.dataGrid1.DataMember = "";
+ this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
+ this.dataGrid1.Location = new System.Drawing.Point(147, 78);
+ this.dataGrid1.Name = "dataGrid1";
+ this.dataGrid1.TabIndex = 11;
+ //
+ // monthCalendar1
+ //
+ this.monthCalendar1.Location = new System.Drawing.Point(318, 72);
+ this.monthCalendar1.Name = "monthCalendar1";
+ this.monthCalendar1.TabIndex = 12;
+ //
+ // dateTimePicker1
+ //
+ this.dateTimePicker1.Location = new System.Drawing.Point(109, 188);
+ this.dateTimePicker1.Name = "dateTimePicker1";
+ this.dateTimePicker1.TabIndex = 13;
+ //
+ // hScrollBar1
+ //
+ this.hScrollBar1.Location = new System.Drawing.Point(189, 242);
+ this.hScrollBar1.Name = "hScrollBar1";
+ this.hScrollBar1.TabIndex = 14;
+ //
+ // vScrollBar1
+ //
+ this.vScrollBar1.Location = new System.Drawing.Point(241, 318);
+ this.vScrollBar1.Name = "vScrollBar1";
+ this.vScrollBar1.TabIndex = 15;
+ //
+ // splitter1
+ //
+ this.splitter1.Location = new System.Drawing.Point(0, 42);
+ this.splitter1.Name = "splitter1";
+ this.splitter1.Size = new System.Drawing.Size(3, 506);
+ this.splitter1.TabIndex = 16;
+ this.splitter1.TabStop = false;
+ //
+ // domainUpDown1
+ //
+ this.domainUpDown1.Location = new System.Drawing.Point(315, 257);
+ this.domainUpDown1.Name = "domainUpDown1";
+ this.domainUpDown1.TabIndex = 17;
+ this.domainUpDown1.Text = "domainUpDown1";
+ //
+ // numericUpDown1
+ //
+ this.numericUpDown1.Location = new System.Drawing.Point(319, 314);
+ this.numericUpDown1.Name = "numericUpDown1";
+ this.numericUpDown1.TabIndex = 18;
+ //
+ // trackBar1
+ //
+ this.trackBar1.Location = new System.Drawing.Point(392, 374);
+ this.trackBar1.Name = "trackBar1";
+ this.trackBar1.TabIndex = 19;
+ //
+ // progressBar1
+ //
+ this.progressBar1.Location = new System.Drawing.Point(381, 442);
+ this.progressBar1.Name = "progressBar1";
+ this.progressBar1.TabIndex = 20;
+ //
+ // richTextBox1
+ //
+ this.richTextBox1.Location = new System.Drawing.Point(527, 79);
+ this.richTextBox1.Name = "richTextBox1";
+ this.richTextBox1.TabIndex = 21;
+ this.richTextBox1.Text = "richTextBox1";
+ //
+ // imageList1
+ //
+ this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
+ this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
+ //
+ // notifyIcon1
+ //
+ this.notifyIcon1.Text = "notifyIcon1";
+ this.notifyIcon1.Visible = true;
+ //
+ // saveFileDialog1
+ //
+ this.saveFileDialog1.FileName = "doc1";
+ //
+ // printPreviewControl1
+ //
+ this.printPreviewControl1.AutoZoom = false;
+ this.printPreviewControl1.Location = new System.Drawing.Point(456, 260);
+ this.printPreviewControl1.Name = "printPreviewControl1";
+ this.printPreviewControl1.Size = new System.Drawing.Size(100, 100);
+ this.printPreviewControl1.TabIndex = 22;
+ this.printPreviewControl1.Zoom = 0.3;
+ //
+ // errorProvider1
+ //
+ this.errorProvider1.ContainerControl = this;
+ this.errorProvider1.DataMember = "";
+ //
+ // Form1
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(813, 570);
+ this.Controls.Add(this.printPreviewControl1);
+ this.Controls.Add(this.richTextBox1);
+ this.Controls.Add(this.progressBar1);
+ this.Controls.Add(this.trackBar1);
+ this.Controls.Add(this.numericUpDown1);
+ this.Controls.Add(this.domainUpDown1);
+ this.Controls.Add(this.splitter1);
+ this.Controls.Add(this.vScrollBar1);
+ this.Controls.Add(this.hScrollBar1);
+ this.Controls.Add(this.dateTimePicker1);
+ this.Controls.Add(this.monthCalendar1);
+ this.Controls.Add(this.dataGrid1);
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.toolBar1);
+ this.Controls.Add(this.statusBar1);
+ this.Controls.Add(this.groupBox1);
+ this.Controls.Add(this.radioButton1);
+ this.Controls.Add(this.checkBox1);
+ this.Controls.Add(this.textBox1);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.linkLabel1);
+ this.Controls.Add(this.label1);
+ this.Menu = this.mainMenu1;
+ this.Name = "Form1";
+ this.Text = "Form1";
+ ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.Run(new Form1());
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/SWFTest/Form1.resx b/mcs/class/System.Windows.Forms/SWFTest/Form1.resx
new file mode 100644
index 00000000000..a0b54853cb2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/Form1.resx
@@ -0,0 +1,499 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used forserialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <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" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </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>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="linkLabel1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="linkLabel1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="linkLabel1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="button1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="textBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="textBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="textBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="mainMenu1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="mainMenu1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>154, 3</value>
+ </data>
+ <data name="mainMenu1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="checkBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="checkBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="checkBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="radioButton1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="radioButton1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="radioButton1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="groupBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="groupBox1.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>2, 2</value>
+ </data>
+ <data name="groupBox1.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="groupBox1.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="groupBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="contextMenu1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="contextMenu1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>263, 3</value>
+ </data>
+ <data name="contextMenu1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="statusBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="statusBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="statusBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="toolBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="toolBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="toolBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="pictureBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="pictureBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="pictureBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="panel1.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="panel1.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="panel1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="panel1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="panel1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="panel1.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>2, 2</value>
+ </data>
+ <data name="dataGrid1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="dataGrid1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="dataGrid1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="monthCalendar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="monthCalendar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="monthCalendar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="dateTimePicker1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="dateTimePicker1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="dateTimePicker1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="hScrollBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="hScrollBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="hScrollBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="vScrollBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="vScrollBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="vScrollBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="timer1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="timer1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>385, 3</value>
+ </data>
+ <data name="timer1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="splitter1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="splitter1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="splitter1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="domainUpDown1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="domainUpDown1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="domainUpDown1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="numericUpDown1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="numericUpDown1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="numericUpDown1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="trackBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="trackBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="trackBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="progressBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="progressBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="progressBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="richTextBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="richTextBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="richTextBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="imageList1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="imageList1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="imageList1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>468, 3</value>
+ </data>
+ <data name="helpProvider1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="helpProvider1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>573, 3</value>
+ </data>
+ <data name="helpProvider1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="toolTip1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="toolTip1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>693, 3</value>
+ </data>
+ <data name="toolTip1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="contextMenu2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="contextMenu2.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 40</value>
+ </data>
+ <data name="contextMenu2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="notifyIcon1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="notifyIcon1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>139, 40</value>
+ </data>
+ <data name="notifyIcon1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="openFileDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="openFileDialog1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="openFileDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>246, 40</value>
+ </data>
+ <data name="saveFileDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="saveFileDialog1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="saveFileDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>376, 40</value>
+ </data>
+ <data name="fontDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>504, 40</value>
+ </data>
+ <data name="fontDialog1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="fontDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="colorDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="colorDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>612, 40</value>
+ </data>
+ <data name="colorDialog1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="printDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="printDialog1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="printDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>725, 40</value>
+ </data>
+ <data name="printPreviewControl1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="printPreviewControl1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="printPreviewControl1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="errorProvider1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="errorProvider1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 77</value>
+ </data>
+ <data name="errorProvider1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="printDocument1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="printDocument1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>140, 77</value>
+ </data>
+ <data name="printDocument1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="pageSetupDialog1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="pageSetupDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+ <data name="pageSetupDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>271, 77</value>
+ </data>
+ <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>(Default)</value>
+ </data>
+ <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>2, 2</value>
+ </data>
+ <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>69</value>
+ </data>
+ <data name="$this.Name">
+ <value>Form1</value>
+ </data>
+ <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </data>
+ <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Private</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj b/mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj
new file mode 100644
index 00000000000..9ca47834e94
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj
@@ -0,0 +1,129 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.2292"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{CC2EFED3-199D-48A1-BA05-A7093A6B4C07}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = "App.ico"
+ AssemblyKeyContainerName = ""
+ AssemblyName = "SWFTest"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "WinExe"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "SWFTest"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "Accessibility"
+ AssemblyName = "Accessibility"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\Accessibility.dll"
+ />
+ <Reference
+ Name = "System.Runtime.Serialization.Formatters.Soap"
+ AssemblyName = "System.Runtime.Serialization.Formatters.Soap"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Runtime.Serialization.Formatters.Soap.dll"
+ />
+ <Reference
+ Name = "System.Windows.Forms"
+ Project = "{E0B52BB7-B244-4724-9A63-9616B6FAA5E8}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "App.ico"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form1.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form1.resx"
+ DependentUpon = "Form1.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj.user b/mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj.user
new file mode 100644
index 00000000000..8d0f2d53bad
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/SWFTest.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP LastOpenVersion = "7.10.2292" >
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/SWFTest/changelog b/mcs/class/System.Windows.Forms/SWFTest/changelog
new file mode 100644
index 00000000000..5112edbdf64
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/changelog
@@ -0,0 +1,14 @@
+ 2002-12-1 DennisHayes <dennish@raytek.com>
+
+ * Changelog started 12-1-2002
+ * Added test project to sln.
+ * Has all standard controls on form, execpt printpreviewdialog
+ * On my computer, compiles, runs, cna be resized, moved, shut down without error.
+ * Shows only standard window with client area, no form, no controls visible at run time.
+
+ * 1) Copy properitytag.cs from system.windows.design to system.windows.forms.
+ * 2) In Visual studio solution explorer, remove the reference to system.windows.forms.
+ * 3) For testing add ref to system.windows.forms *project*
+ * or
+ * For changing form in VS, add ref to system.windows.forms *.NET DLL"
+
diff --git a/mcs/class/System.Windows.Forms/SWFTest/makefile b/mcs/class/System.Windows.Forms/SWFTest/makefile
new file mode 100644
index 00000000000..12322a0dc64
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/makefile
@@ -0,0 +1,2 @@
+all:
+ mcs AssemblyInfo.cs Form1.cs /r:System.Windows.Forms /r:System.Drawing /resource:App.ico /resource:Form1.resx
diff --git a/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs
new file mode 100644
index 00000000000..4fd3fdeb868
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs
@@ -0,0 +1,89 @@
+//
+// System.Resources.ResXResourceReader.cs
+//
+// Authors:
+// Duncan Mak <duncan@ximian.com>
+// Nick Drochak <ndrochak@gol.com>
+//
+// 2001 (C) Ximian Inc, http://www.ximian.com
+//
+// TODO: Finish this
+
+using System.Collections;
+using System.Resources;
+using System.IO;
+
+namespace System.Resources
+{
+ public sealed class ResXResourceReader : IResourceReader, IDisposable
+ {
+ Stream stream;
+
+ // Constructors
+ public ResXResourceReader (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+
+ if (!stream.CanRead)
+ throw new ArgumentException ("Stream was not readable.");
+
+ this.stream = stream;
+
+ if (!IsStreamValid()){
+ throw new ArgumentException("Stream is not a valid .resources file! It was possibly truncated.");
+ }
+ }
+
+ public ResXResourceReader (string fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentException ("Path cannot be null.");
+
+ if (String.Empty == fileName)
+ throw new ArgumentException("Empty path name is not legal.");
+
+ if (!System.IO.File.Exists (fileName))
+ throw new FileNotFoundException ("Could not find file " + Path.GetFullPath(fileName));
+
+ stream = new FileStream (fileName, FileMode.Open);
+
+ if (!IsStreamValid()){
+ throw new ArgumentException("Stream is not a valid .resources file! It was possibly truncated.");
+ }
+ }
+
+ [MonoTODO]
+ private bool IsStreamValid() {
+ return true;
+ }
+
+ public void Close ()
+ {
+ stream.Close ();
+ stream = null;
+ }
+
+ public IDictionaryEnumerator GetEnumerator () {
+ if (null == stream){
+ throw new InvalidOperationException("ResourceReader is closed.");
+ }
+ else {
+ return null;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return ((IResourceReader) this).GetEnumerator();
+ }
+
+ [MonoTODO]
+ void IDisposable.Dispose ()
+ {
+ // FIXME: is this all we need to do?
+ Close();
+ }
+
+ } // public sealed class ResXResourceReader
+} // namespace System.Resources
diff --git a/mcs/class/System.Windows.Forms/System.Resources/ResXResourceWriter.cs b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceWriter.cs
new file mode 100644
index 00000000000..b228bed4a3a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceWriter.cs
@@ -0,0 +1,64 @@
+//
+// System.Resources.ResXResourceWriter.cs
+//
+// Author:
+// Duncan Mak <duncan@ximian.com>
+//
+// 2001 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+
+namespace System.Resources
+{
+ public sealed class ResXResourceWriter : IResourceWriter
+ {
+ [MonoTODO]
+ public ResXResourceWriter (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream is null");
+ if (stream.CanWrite == false)
+ throw new ArgumentException ("stream is not writable.");
+ }
+
+ [MonoTODO]
+ public ResXResourceWriter (String fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName is null.");
+ }
+
+ [MonoTODO]
+ public void AddResource (string name, byte[] value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ("Parameter is a null reference.");
+ }
+
+ [MonoTODO]
+ public void AddResource (string name, object value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ("Parameter is a null reference.");
+ }
+
+ [MonoTODO]
+ public void AddResource (string name, string value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ("Parameter is a null reference.");
+ }
+
+ [MonoTODO]
+ public void Close () {}
+
+ public void Dispose ()
+ {
+ Close();
+ }
+
+ [MonoTODO]
+ public void Generate () {}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AnchorEditor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AnchorEditor.cs
new file mode 100644
index 00000000000..86354eab2af
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AnchorEditor.cs
@@ -0,0 +1,35 @@
+//
+// System.Windows.Forms.Design.AnchorEditor.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Drawing.Design;
+using System.ComponentModel;
+using System.Runtime.Remoting;
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for AnchorEditor.
+ /// </summary>
+ [MonoTODO]
+ public sealed class AnchorEditor : UITypeEditor {
+ [MonoTODO]
+ public AnchorEditor() {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+// [MonoTODO]
+// public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value){
+// throw new NotImplementedException ();
+// }
+// Documented, but not implmented by Mictosoft?
+// [MonoTODO]
+// public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AssemblyInfo.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AxImporter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AxImporter.cs
new file mode 100644
index 00000000000..28c3f689eaf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/AxImporter.cs
@@ -0,0 +1,87 @@
+//
+// System.Windows.Forms.Design.AxImporter.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Runtime.InteropServices;
+using System.IO;
+using System.Reflection;
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for AxImporter.
+ /// </summary>
+ [MonoTODO]
+ public class AxImporter
+ {
+ [MonoTODO]
+ public AxImporter(AxImporter.Options options)
+ {
+ throw new NotImplementedException ();
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ [MonoTODO]
+ public string[] GeneratedAsemblies{
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string[] GeneratedSoruces{
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+// [MonoTODO]
+// public TYPELIBATTR[] GeneratedTypeLibAttribute{
+// get {
+// throw new NotImplementedException ();
+// }
+// }
+ [MonoTODO]
+ public string GenerateFromFile(FileInfo file){
+ throw new NotImplementedException ();
+ }
+// UCOMITTypeLib documented, but not implmented by Microsoft?
+// [MonoTODO]
+// public string GenerateFromTypeLibrary(UCOMITTypeLib typeLib){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string GenerateFromTypeLibrary(UCOMITTypeLib typeLib, Guid clsid){
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static string GetFileOfTypeLib(ref TYPELIBATTR tlibattr){
+// throw new NotImplementedException ();
+// }
+
+ public sealed class Options{
+ public Options(){
+ }
+
+ //props
+ public bool delaySign;
+ public bool GenSources;
+ public string keyContainer;
+ public string keyfile;
+ public StrongNameKeyPair keyPair;
+
+ public bool noLogo;
+ public string outputDirectory;
+ public string outputName;
+ public bool overwriteRCW;
+ public byte[] publicKey;
+//implment
+// public AxImporter.IReferenceResolver references;
+ public bool silentMode;
+ public bool verboseMode;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentDocumentDesigner.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentDocumentDesigner.cs
new file mode 100644
index 00000000000..19c2fe7d05e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentDocumentDesigner.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.Design.ComponentDocumentDesigner.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Windows.Forms;
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for ComponentDocumentDesigner.
+ /// </summary>
+ public class ComponentDocumentDesigner {//: ComponentDesigner, IRootDesigner, ITooloxUser, ITypeDescriptorFilterService {
+ public ComponentDocumentDesigner()
+ {
+ throw new NotImplementedException ();
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+// public Control Control {
+// get{
+// throw new NotImplementedException ();
+// }
+// }
+ public bool TrayAutoArrange{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+ public bool TrayLargeIcon{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+// public override void Initialize(IComponent component){
+// throw new NotImplementedException ();
+// }
+
+// protected override void Dispose(bool disposing){
+// throw new NotImplementedException ();
+// }
+// protected virtual bool GetToolSupported(ToolboxItem tool){
+// throw new NotImplementedException ();
+// }
+// protected override void preFilterProperties(IDictionary properties){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs
new file mode 100644
index 00000000000..ea69adbc175
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for WindowsFormsComponentEditor.
+ /// </summary>
+ public class ComponentEditor
+ {
+ public ComponentEditor()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs
new file mode 100644
index 00000000000..59575f040f1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs
@@ -0,0 +1,51 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Windows.Forms;
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for ComponentEditorForm.
+ /// </summary>
+ public class ComponentEditorForm { //: Form {
+ public ComponentEditorForm()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ public ComponentEditorForm(object component, Type[] pageTypes){
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+// protected override void OnActivated(EventArgs e){
+// throw new NotImplementedException ();
+// }
+// public override bool PreProcessMessage(ref Message msg){
+// throw new NotImplementedException ();
+// }
+// public virtual DialogResult ShowForm(){
+// throw new NotImplementedException ();
+// }
+// public virtual DialogResult ShowForm(int page){
+// throw new NotImplementedException ();
+// }
+// public virtual DialogResult ShowForm(IWin32Window owner){
+// throw new NotImplementedException ();
+// }
+// public virtual DialogResult ShowForm(IWin32Window owner, int page){
+// throw new NotImplementedException ();
+// }
+// protected override viod onHelpRequested(HelpEventArgs e){
+// throw new NotImplementedException ();
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentTray.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentTray.cs
new file mode 100644
index 00000000000..09fd00408fc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentTray.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for ComponentTray.
+ /// </summary>
+ public class ComponentTray
+ {
+ public ComponentTray()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ControlDesigner.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ControlDesigner.cs
new file mode 100644
index 00000000000..5adb68c6320
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ControlDesigner.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design {
+ /// <summary>
+ /// Summary description for ControlDesigner.
+ /// </summary>
+ public class ControlDesigner {
+ public ControlDesigner() {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ public class ControlDesignerAccessibleObject{
+ public ControlDesignerAccessibleObject() {
+ //
+ // TODO: Add constructor logic here
+ throw new NotImplementedException ();
+ //
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/DocumentDesigner.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/DocumentDesigner.cs
new file mode 100644
index 00000000000..0a0030cde1b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/DocumentDesigner.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for DocumentDesigner.
+ /// </summary>
+ public class DocumentDesigner
+ {
+ public DocumentDesigner()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs
new file mode 100644
index 00000000000..82f9db9e8e5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for EventsTab.
+ /// </summary>
+ public class EventsTab
+ {
+ public EventsTab()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/FileNameEditor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/FileNameEditor.cs
new file mode 100644
index 00000000000..c41e4c39745
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/FileNameEditor.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for FileNameEditor.
+ /// </summary>
+ public class FileNameEditor
+ {
+ public FileNameEditor()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IMenuEditorService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IMenuEditorService.cs
new file mode 100644
index 00000000000..0ff23b98c38
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IMenuEditorService.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for IMenuEditorService.
+ /// </summary>
+ public interface IMenuEditorService
+ {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs
new file mode 100644
index 00000000000..649d7eed5f9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for IUIService.
+ /// </summary>
+ public interface IUIService
+ {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IWindowsformsEditorService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IWindowsformsEditorService.cs
new file mode 100644
index 00000000000..a87af92b94d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IWindowsformsEditorService.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for IWindowsformsEditorService.
+ /// </summary>
+ public interface IWindowsformsEditorService
+ {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/MenusCommands.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/MenusCommands.cs
new file mode 100644
index 00000000000..0b7cdc26988
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/MenusCommands.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for MenusCommands.
+ /// </summary>
+ public class MenusCommands
+ {
+ public MenusCommands()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ParentControlDesigner.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ParentControlDesigner.cs
new file mode 100644
index 00000000000..593a82ead06
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ParentControlDesigner.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for ParentControlDesigner.
+ /// </summary>
+ public class ParentControlDesigner
+ {
+ public ParentControlDesigner()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs
new file mode 100644
index 00000000000..3488cb62ea8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for PropertyTab.
+ /// </summary>
+ public class PropertyTab
+ {
+ public PropertyTab()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ScrollableControlDesigner.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ScrollableControlDesigner.cs
new file mode 100644
index 00000000000..673c74aecce
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ScrollableControlDesigner.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Design.ComponentEditorForm.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for ScrollableControlDesigner.
+ /// </summary>
+ public class ScrollableControlDesigner
+ {
+ public ScrollableControlDesigner()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/SelectionRules.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/SelectionRules.cs
new file mode 100644
index 00000000000..f990290ef1a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/SelectionRules.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for SelectionRules.
+ /// </summary>
+ public enum SelectionRules
+ {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj
new file mode 100644
index 00000000000..0026e1e1937
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj
@@ -0,0 +1,193 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{EF89E643-02F5-4E97-9353-3C92F209EB47}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.Windows.Forms.Design"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "System.Windows.Forms.Design"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.XML"
+ HintPath = "..\..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "System.Drawing.Design"
+ AssemblyName = "System.Drawing.Design"
+ HintPath = "..\..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.Design.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AnchorEditor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AxImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComponentDocumentDesigner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComponentEditor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComponentEditorForm.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComponentTray.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlDesigner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DocumentDesigner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventsTab.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FileNameEditor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IMenuEditorService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IUIService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWindowsformsEditorService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MenusCommands.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ParentControlDesigner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTab.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollableControlDesigner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectionRules.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UITypeEditor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj.user b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj.user
new file mode 100644
index 00000000000..fca0192f25c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/System.Windows.Forms.Design.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/TODOAttribute.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/TODOAttribute.cs
new file mode 100644
index 00000000000..6e2ace72630
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/UITypeEditor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/UITypeEditor.cs
new file mode 100644
index 00000000000..7b3fa422e1b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/UITypeEditor.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for UITypeEditor.
+ /// </summary>
+ public class UITypeEditor
+ {
+ public UITypeEditor()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog
new file mode 100644
index 00000000000..53df5dbe98f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog
@@ -0,0 +1,40 @@
+2002-8-4 DennisHayes <dennish@raytek.com>
+
+* Started cheanglog
+
+2002-8-4 DennisHayes <dennish@raytek.com>
+
+* AnchorEditor.cs
+* AxImporter.cs
+* ComponentDocumentDesigner.cs
+* ComponentEditorForm.cs
+* Stubbed out
+
+* ComponentTray.cs
+* ControlDesigner.cs
+* ComponentEditor.cs
+* DocumentDesigner.cs
+* EventsTab.cs
+* FileNameEditor.cs
+* IMenuEditorService.cs
+* IUIService.cs
+* IWindowsformsEditorService.cs
+* MenusCommands.cs
+* ParentControlDesigner.cs
+* PropertyTab.cs
+* ScrollableControlDesigner.cs
+* SelectionRules.cs
+* UITypeEditor.cs
+* Class body defined only. No stubbs done.
+
+* TODOAttribute.cs
+* Used to mark unimplemented functions.
+
+* System.Windows.Forms.Design.csproj
+* System.Windows.Forms.Design.csproj.user
+* AssemblyInfo.cs
+* Needed for Visual Studio compile.
+
+
+
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/MenuTest.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/MenuTest.cs
new file mode 100644
index 00000000000..6a2b9753f07
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/MenuTest.cs
@@ -0,0 +1,222 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Collections;
+
+class MyMenuItem : MenuItem
+{
+ public MyMenuItem( string s) : base(s)
+ {
+ }
+
+ public int GetID()
+ {
+ return MenuID;
+ }
+
+ public new IntPtr Handle
+ {
+ get
+ {
+ return IntPtr.Zero;
+ }
+ }
+
+}
+
+// Test basic functionality of the Application and Form class
+class MenuTest : Form
+{
+
+ Button button;
+ MainMenu testMenu_ = null;
+
+ public MenuTest () : base ()
+ {
+ ClientSize = new Size(300, 250);
+ CreateMyMainMenu();
+
+ button = new Button ();
+ button.Top = 20;
+ button.Left = 20;
+ button.Width = 50;
+ button.Height = 50;
+ button.Parent = this;
+ button.Text = "Menu";
+
+ button.Click += new EventHandler(OnMenuButtonClick);
+
+ }
+
+ MenuItem[] RecentFilesMenu()
+ {
+ MenuItem menuItem1 = new MenuItem("MenuTest.cs");
+ MenuItem menuItem2 = new MenuItem("/etc/passwd");
+ MenuItem menuItem3 = new MenuItem("~/.wine/config");
+ return new MenuItem[3] {menuItem1, menuItem2, menuItem3};
+ }
+
+ // Doesn't gets called, waiting for Button implementation
+ void OnMenuButtonClick( object c, EventArgs e)
+ {
+ if( Menu != null)
+ {
+ Menu = null;
+ }
+ else
+ {
+ Menu = testMenu_;
+ }
+ }
+
+ MenuItem menuItem4 = null;
+
+ public void CreateMyMainMenu()
+ {
+ testMenu_ = new MainMenu();
+
+ MyMenuItem myMI = new MyMenuItem("2");
+ MenuItem refMi = myMI;
+ IntPtr ip = refMi.Handle;
+ ip = myMI.Handle;
+ System.Console.WriteLine("My menu ID {0}", myMI.GetID());
+
+ MenuItem menuItem1 = new MenuItem("&New", new System.EventHandler(this.OnFileNew));
+ MenuItem menuItem2 = new MenuItem("&Open...", new System.EventHandler(this.OnFileOpen));
+ MenuItem menuItem3 = new MenuItem("&Quit", new System.EventHandler(this.OnFileQuit));
+ MenuItem recentFiles = new MenuItem("Recent files", RecentFilesMenu());
+ MenuItem FileMenu = new MenuItem("File", new MenuItem[]{menuItem1, menuItem2,recentFiles, menuItem3});
+
+ myMI = new MyMenuItem("2");
+ System.Console.WriteLine("My menu ID {0}", myMI.GetID());
+
+ menuItem1.Text = "&File";
+ menuItem2.Text = "&Edit";
+ menuItem3.Text = "E&xit";
+
+ MenuItem mi10 = new MenuItem("Dos");
+ MenuItem mi11 = new MenuItem("Unix");
+ menuItem4 = new MenuItem("&Save As...", new MenuItem[]{mi10, mi11});
+ FileMenu.MenuItems.Add(2, menuItem4);
+ int pos = testMenu_.MenuItems.Add(FileMenu);
+ System.Console.WriteLine("Menu File added at position {0}", pos);
+
+ MenuItem menuTest1 = new MenuItem("&Test properties", new System.EventHandler(this.OnTestProperties));
+ MenuItem TestMenu = new MenuItem("Test", new MenuItem[]{menuTest1});
+ testMenu_.MenuItems.Add(TestMenu);
+
+ Menu = testMenu_;
+
+ myMI = new MyMenuItem("2");
+ System.Console.WriteLine("My menu ID {0}", myMI.GetID());
+ }
+
+ protected void OnFileNew( object sender, System.EventArgs e)
+ {
+ MessageBox.Show(this, "The File->New command selected", "MenuTest");
+ menuItem4.Click += new System.EventHandler( this.OnFileSaveAs);
+ menuItem4.MenuItems.Clear();
+ }
+
+ protected void OnFileOpen( object sender, System.EventArgs e)
+ {
+ MessageBox.Show(this, "A file-open dialog will appear soon", "MenuTest");
+ }
+
+ protected void OnFileQuit( object sender, System.EventArgs e)
+ {
+ System.Console.WriteLine("The Exit command selected");
+ Application.Exit();
+ }
+
+ protected void OnFileSaveAs( object sender, System.EventArgs e)
+ {
+ MessageBox.Show("OnFileSaveAs");
+ menuItem4.Index = 0;
+ }
+
+ protected void OnTestProperties( object sender, System.EventArgs e)
+ {
+ MenuItem send = sender as MenuItem;
+ if( send != null)
+ {
+ Menu parent = send.Parent;
+ if( parent != null){
+ MenuItem mi1 = new MenuItem("BarBreak");
+ mi1.BarBreak = true;
+ MenuItem mi2 = new MenuItem("Break");
+ mi2.Break = true;
+ MenuItem mi3 = new MenuItem("Checked");
+ mi3.Checked = true;
+ MenuItem mi4 = new MenuItem("Disabled");
+ mi4.Enabled = false;
+ MenuItem mi5 = new MenuItem("DefaultItem");
+ mi5.DefaultItem = true;
+ MenuItem mi6 = new MenuItem("RadioCheck");
+ mi6.RadioCheck = true;
+ mi6.Checked = true;
+ MenuItem mi7 = new MenuItem("-");
+ mi7.RadioCheck = true;
+
+ MenuItem SubMenu = new MenuItem("SubMenu", new MenuItem[]{mi1, mi2, mi3, mi4, mi5, mi6, mi7});
+ parent.MenuItems.Add(SubMenu);
+ }
+ }
+ }
+
+ // - verifies the WndProc can be overridden propery
+ // - verifies the Application.MessageLoop is working properly
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+
+ // should be true after the Run command is reached
+ //Console.WriteLine ("Application.MessageLoop: " +
+ //Application.MessageLoop);
+ }
+
+ static public void Test1 ()
+ {
+ MenuTest form = new MenuTest ();
+
+ //should be false
+ Console.WriteLine ("Application.MessageLoop: " +
+ Application.MessageLoop);
+
+ Application.Run (form);
+ }
+
+ static public void Test2()
+ {
+ MenuItem mi = new MyMenuItem("123");
+ MenuItem mp = new MenuItem("PPP", new MenuItem[] { mi });
+ MenuItem mc = mi.CloneMenu();
+
+ System.Console.WriteLine("Clone equals to original {0}", mc.Equals(mi));
+ System.Console.WriteLine("Original Parent {0}", mi.Parent.ToString());
+ System.Console.WriteLine("Clone Parent {0}", mc.Parent != null ? mc.Parent.ToString() : "<null>");
+ System.Console.WriteLine("Clone Parent is the same {0}", mc.Parent == mi.Parent);
+ }
+
+ static public void Test3()
+ {
+ MenuItem mi1 = new MenuItem("123");
+ MenuItem mi2 = new MenuItem("234");
+
+ MenuItem parent = new MenuItem( "parent", new MenuItem[] { mi1, mi2});
+ IList il = (IList)parent.MenuItems;
+ System.Console.WriteLine("List of menu items IsReadOnly {0}, IsFixedSize {1}", il.IsReadOnly, il.IsFixedSize);
+ il.Add(new MenuItem("This must be inside"));
+ //il.Add( new ArrayList());
+ //il[1] = new MenuItem("345");
+ //parent.MenuItems[1] = new MenuItem("asd");
+ }
+
+ static public int Main (String[] args)
+ {
+ Test3();
+ Test2();
+ Test1();
+ return 0;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/changelog b/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/changelog
new file mode 100644
index 00000000000..c0fa2e4f4ae
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/changelog
@@ -0,0 +1,4 @@
+ 2002-10-26 DennisHayes <dennish@raytek.com>
+ * Test and sample programs for SWF.
+ * Created dir and started changlog.
+ * Miguel will soon move files from SWF that were just moved from WINELIB.
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.build b/mcs/class/System.Windows.Forms/System.Windows.Forms.build
new file mode 100644
index 00000000000..95fde823090
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.build
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.XML.dll -->
+
+<project name="System.Windows.Forms" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Windows.Forms.dll" debug="${debug}">
+ <!-- 'foo' is defined in multiple places; using definition from 'bar' -->
+ <arg value="/nowarn:1595"/>
+ <!-- Other languages may permit the internal virtual member 'foo' to be overridden -->
+ <arg value="/nowarn:0679"/>
+ <arg value="/nowarn:0649"/>
+ <arg value="/nowarn:0168"/>
+ <arg value="/nowarn:0067"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:Accessibility.dll"/>
+ <arg value="/r:System.dll"/>
+ <arg value="/r:System.Drawing.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="System.Windows.Forms.Test/**"/>
+ <excludes name="Gtk/**"/>
+ <excludes name="SWFTest/**"/>
+ <excludes name="System.Windows.Forms/PictureBox.cs"/>
+ <excludes name="System.Windows.Forms.Design/TODOAttribute.cs"/>
+ <excludes name="System.Windows.Forms.Design/AssemblyInfo.cs"/>
+ <excludes name="WINELib/**"/>
+ </sources>
+ </csc>
+ <copy file="../lib/System.Windows.Forms.dll" tofile="Test/System.Windows.Forms.dll"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.Windows.Forms.dll" failonerror="false"/>
+ <delete file="Test/System.Windows.Forms.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.sln b/mcs/class/System.Windows.Forms/System.Windows.Forms.sln
new file mode 100644
index 00000000000..04d1a0f1188
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.sln
@@ -0,0 +1,34 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows.Forms", "System.Windows.Forms\System.Windows.Forms.csproj", "{E0B52BB7-B244-4724-9A63-9616B6FAA5E8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows.Forms.Design", "System.Windows.Forms.Design\System.Windows.Forms.Design.csproj", "{A38C110F-63F4-4B53-A67E-9A46681C768E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWFTest", "SWFTest\SWFTest.csproj", "{CC2EFED3-199D-48A1-BA05-A7093A6B4C07}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ {E0B52BB7-B244-4724-9A63-9616B6FAA5E8}.0 = {A38C110F-63F4-4B53-A67E-9A46681C768E}
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {E0B52BB7-B244-4724-9A63-9616B6FAA5E8}.Debug.ActiveCfg = Debug|.NET
+ {E0B52BB7-B244-4724-9A63-9616B6FAA5E8}.Debug.Build.0 = Debug|.NET
+ {E0B52BB7-B244-4724-9A63-9616B6FAA5E8}.Release.ActiveCfg = Release|.NET
+ {E0B52BB7-B244-4724-9A63-9616B6FAA5E8}.Release.Build.0 = Release|.NET
+ {A38C110F-63F4-4B53-A67E-9A46681C768E}.Debug.ActiveCfg = Debug|.NET
+ {A38C110F-63F4-4B53-A67E-9A46681C768E}.Debug.Build.0 = Debug|.NET
+ {A38C110F-63F4-4B53-A67E-9A46681C768E}.Release.ActiveCfg = Release|.NET
+ {A38C110F-63F4-4B53-A67E-9A46681C768E}.Release.Build.0 = Release|.NET
+ {CC2EFED3-199D-48A1-BA05-A7093A6B4C07}.Debug.ActiveCfg = Debug|.NET
+ {CC2EFED3-199D-48A1-BA05-A7093A6B4C07}.Debug.Build.0 = Debug|.NET
+ {CC2EFED3-199D-48A1-BA05-A7093A6B4C07}.Release.ActiveCfg = Release|.NET
+ {CC2EFED3-199D-48A1-BA05-A7093A6B4C07}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs
new file mode 100644
index 00000000000..8e0e546281b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.AccessibleEvents.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian = , Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AccessibleEvents{
+ AcceleratorChange = 32786,
+ Create = 32768,
+ DefaultActionChange = 32765,
+ DescriptionChange = 32781,
+ Destroy = 32769,
+ Focus = 32773,
+ HelpChange = 32784,
+ Hide = 32771,
+ LocationChange = 32779,
+ NameChange = 32780,
+ ParentChange = 32783,
+ Reorder = 32772,
+ Selection = 32774,
+ SelectionAdd = 32775,
+ SelectionRemove = 32776,
+ SelectionWithin = 32777,
+ Show = 32770,
+ StateChange = 32778,
+ SystemAlert = 2,
+ SystemCaptureEnd = 9,
+ SystemCaptureStart = 8,
+ SystemContextHelpEnd = 13,
+ SystemContextHelpStart = 12,
+ SystemDialogEnd = 17,
+ SystemDialogStart = 16,
+ SystemDragDropEnd = 15,
+ SystemDragDropStart = 14,
+ SystemForeground = 3,
+ SystemMenuEnd = 5,
+ SystemMenuPopupEnd = 7,
+ SystemMenuPopupStart = 6,
+ SystemMenuStart = 4,
+ SystemMinimizeEnd = 23,
+ SystemMinimizeStart = 22,
+ SystemMoveSizeEnd = 11,
+ SystemMoveSizeStart = 10,
+ SystemScrollingEnd = 19,
+ SystemScrollingStart = 18,
+ SystemSound = 1,
+ SystemSwitchEnd = 21,
+ SystemSwitchStart = 20,
+ ValueChange = 32782
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs
new file mode 100644
index 00000000000..b34241ed6aa
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs
@@ -0,0 +1,31 @@
+//
+// System.Windows.Forms.AccessibleNavigation.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies a values for navigating among accessible objects.
+ /// </summary>
+
+ public enum AccessibleNavigation {
+
+ //Values were verified with enumcheck.
+ Down = 2,
+ FirstChild = 7,
+ LastChild = 8,
+ Left = 3,
+ Next = 5,
+ Previous = 6,
+ Right = 4,
+ Up = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs
new file mode 100644
index 00000000000..319cbb78f0e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs
@@ -0,0 +1,301 @@
+//
+// System.Windows.Forms.AccessibleObject.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using Accessibility;
+using System.Runtime.InteropServices;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides information that accessibility applications use to adjust an application's UI for users with impairments.
+ ///
+ /// ToDo note:
+ /// - IAccessible members not stubbed out
+ /// - MarshalByRefObject members not stubbed out
+ /// MSDN gives little info on the members of IAccessible: "This member supports the .NET Framework infrastructure and is not intended to be used directly from your code."
+ /// </summary>
+ [MonoTODO]
+ public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
+ private string defaultAction;
+ private string description;
+ private string help;
+ private string keyboardShortcut;
+ private AccessibleObject parent;
+ private AccessibleRole role;
+ private AccessibleStates state;
+ private string name;
+ private string value;
+ // --- Constructor ---
+ [MonoTODO]
+ public AccessibleObject() {
+ name = null;
+ parent = null;
+ role = AccessibleRole.None;
+ state = AccessibleStates.None;
+ value = null;
+
+ }
+
+ // --- Properties ---
+
+
+ public virtual Rectangle Bounds {
+ get { return Rectangle.Empty; } // As per spec for default. Expect override.
+ }
+
+ public virtual string DefaultAction {
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ public virtual string Description {
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ public virtual string Help {
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ public virtual string KeyboardShortcut {
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ public virtual string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public virtual string Value {
+ get { return this.value; }
+ set { this.value = value; }
+ }
+
+ public virtual AccessibleObject Parent {
+ get { return parent; }
+ set { parent = value; }
+ }
+
+ public virtual AccessibleRole Role {
+ get { return role; }
+ set { role = value; }
+ }
+
+ public virtual AccessibleStates State {
+ get { return state; }
+ set { state = value; }
+ }
+
+ // --- Methods ---
+
+ public virtual void DoDefaultAction() {
+ return; //default action is "" and cannot be changed, must be overridden.
+ }
+
+ [MonoTODO]
+ public virtual AccessibleObject GetChild(int index) {
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual int GetChildCount() {
+ return -1; //as per spec
+ }
+
+ [MonoTODO]
+ public virtual AccessibleObject GetFocused() {
+ return null;//FIXME: not quite to spec.
+ }
+
+ public virtual int GetHelpTopic(out string fileName) {
+ fileName = "";
+ return -1;//no help
+ }
+
+ public virtual AccessibleObject GetSelected() {
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual AccessibleObject HitTest(int x,int y) {
+ return null; }
+
+ [MonoTODO]
+ public virtual AccessibleObject Navigate(AccessibleNavigation navdir) {
+ //by default, navagate back to here. Does this work?
+ //not to spec, but better than execption FIXME:
+ return this;
+ }
+
+ [MonoTODO]
+ public virtual void Select(AccessibleSelection flags) {
+ return;//FIXME: Not to spec. should be over ridden anyway.
+ }
+
+ //Not part of spec?
+ //[MonoTODO]
+ //[ComVisible(true)]
+ //protected void UseStdAccessibleObjects(IntPtr handle,int objid)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ // --- Methods: IReflect ---
+ [MonoTODO]
+ FieldInfo IReflect.GetField( string name,BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ FieldInfo[] IReflect.GetFields (BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ MemberInfo[] IReflect.GetMember( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ MemberInfo[] IReflect.GetMembers( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ MethodInfo IReflect.GetMethod( string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ MethodInfo IReflect.GetMethod( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+
+
+ [MonoTODO]
+ MethodInfo[] IReflect.GetMethods( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyInfo[] IReflect.GetProperties( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyInfo IReflect.GetProperty( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyInfo IReflect.GetProperty( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ //[Guid("")]
+ object IReflect.InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+
+ Type IReflect.UnderlyingSystemType {
+ //private Type UnderlyingSystemType {
+ get { throw new NotImplementedException (); }
+ }
+
+ void IAccessible.accDoDefaultAction(object childID) {
+ //FIXME:
+ }
+ int IAccessible.accChildCount{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+
+ object IAccessible.accFocus{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object IAccessible.accHitTest(int xLeft, int yTop) {
+ throw new NotImplementedException ();
+ }
+ void IAccessible.accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.accNavigate(int navDir, object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.accParent {
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void IAccessible.accSelect(int flagsSelect, object childID) {
+ //FIXME:
+ }
+ object IAccessible.accSelection {
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object IAccessible.get_accChild(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accDefaultAction(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accDescription(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accHelp(object childID) {
+ throw new NotImplementedException ();
+ }
+ int IAccessible.get_accHelpTopic(out string pszHelpFile,object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accKeyboardShortcut(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accName(object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.get_accRole(object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.get_accState(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accValue(object childID) {
+ throw new NotImplementedException ();
+ }
+ void IAccessible.set_accName(object childID, string newName) {
+ //FIXME:
+ }
+ void IAccessible.set_accValue(object childID, string newValue) {
+ //FIXME:
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleRole.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleRole.cs
new file mode 100644
index 00000000000..79138947a7a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleRole.cs
@@ -0,0 +1,80 @@
+//
+// System.Windows.Forms.AccessibleRole.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AccessibleRole{
+ Alert = 8,
+ Animation = 54,
+ Application = 14,
+ Border = 19,
+ ButtonDropDownGrid = 58,
+ ButtonMenu = 57,
+ Caret = 7,
+ Cell = 29,
+ Character = 32,
+ Chart = 17,
+ CheckButton = 44,
+ Client = 10,
+ Clock = 61,
+ Column = 27,
+ ColumnHeader = 25,
+ ComboBox = 46,
+ Cursor = 6,
+ Default = -1,
+ Diagram = 53,
+ Dial = 49,
+ Dialog = 18,
+ Document = 15,
+ DropList = 47,
+ Equation = 55,
+ Graphic = 40,
+ Grip = 4,
+ Grouping = 20,
+ HelpBalloon = 31,
+ HotkeyField = 50,
+ Indicator = 39,
+ Link = 30,
+ List = 33,
+ ListItem = 34,
+ MenuBar = 2,
+ MenuItem = 12,
+ MenuPopup = 11,
+ None = 0,
+ Outline = 35,
+ OutlineItem = 36,
+ PageTab = 37,
+ PageTabList = 60,
+ Pane = 16,
+ ProgressBar = 48,
+ PropertyPage = 38,
+ PushButton = 43,
+ RadioButton = 45,
+ Row = 28,
+ RowHeader = 26,
+ ScrollBar = 3,
+ Separator = 21,
+ Slider = 51,
+ Sound = 5,
+ SpinButton = 52,
+ StaticText = 41,
+ StatusBar = 23,
+ Table = 24,
+ Text = 42,
+ TitleBar = 1,
+ ToolBar = 22,
+ ToolTip = 13,
+ WhiteSpace = 59,
+ Window = 9
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs
new file mode 100644
index 00000000000..47f233eb2e0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.AccessibleSelection.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how an accessible object is selected or receives focus.
+ /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ public enum AccessibleSelection {
+
+ AddSelection = 1,
+ ExtendSelection = 2,
+ None = 0,
+ RemoveSelection = 4,
+ TakeFocus = 8,
+ TakeSelection = 16
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleStates.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleStates.cs
new file mode 100644
index 00000000000..d4298e928f7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleStates.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.AccessibleStates.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AccessibleStates{
+ AlertLow = 67108864,
+ AlertMedium = 134217728,
+ AlertHigh = 268435456,
+ Animated = 16384,
+ Busy = 2048,
+ Checked = 16,
+ Collapsed = 1024,
+ Default = 256,
+ Expanded = 512,
+ ExtSelectable = 33554432,
+ Floating = 4096,
+ Focusable = 1048576,
+ Focused = 4,
+ HotTracked = 128,
+ Indeterminate =32,
+ Mixed = 32,
+ Invisible = 32768,
+ Linked = 4194304,
+ Marqueed = 8192,
+ Moveable = 262144,
+ MultiSelectable = 16777216,
+ None = 0,
+ Pressed = 8,
+ Protected = 536870912,
+ ReadOnly = 64,
+ Offscreen = 65536,
+ Selectable = 2097152,
+ Selected = 2,
+ SelfVoicing = 524288,
+ Sizeable = 131072,
+ Traversed =8388608,
+ Unavailable = 1,
+ Valid = 1073741823,
+
+
+ //Where did these come from, are they missing from elsewhere?
+ //AddSelection = ,
+ //ExtendSelection = ,
+ //None = ,
+ //RemoveSelection = ,
+ //TakeFocus = ,
+ //TakeSelection =
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AmbientProperties.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AmbientProperties.cs
new file mode 100644
index 00000000000..5ef36c02f91
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AmbientProperties.cs
@@ -0,0 +1,96 @@
+//
+// System.Windows.Forms.AmbientProperties
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) Ximian, Inc 2002
+//
+using System.Runtime.InteropServices;
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides ambient property values to top-level controls.
+ /// </summary>
+
+ public sealed class AmbientProperties {
+ Cursor cursor;
+ Font font;
+ Color backColor;
+ Color foreColor;
+ // --- Constructor ---
+ public AmbientProperties() {
+ cursor = null;
+ font = null;
+ backColor = Color.Empty;
+ foreColor = Color.Empty;
+ }
+
+ // --- (public) Properties ---
+
+ public Cursor Cursor {
+ get {
+ //if set, use our value, if not, search site for it.
+ if(cursor != null){
+ //This is correct
+ return cursor;
+ }
+ else{
+ //This needs to find cursor from the system
+ //If it cannot, return default
+ return cursor;//FIXME: get value from system
+ }
+ }
+ set {
+ cursor = value;
+ }
+ }
+
+ public Font Font {
+ get {
+ if(font != null){
+ return font;
+ }
+ else{//try to get font from system
+ return font;//FIXME: get value from system
+ }
+ }
+ set {
+ font = value;
+ }
+ }
+
+ public Color ForeColor {
+ get {
+ if(foreColor != Color.Empty){
+ return foreColor;
+ }
+ else{
+ //FIXME: return system color if possible
+ return foreColor;
+ }
+ }
+ set {
+ foreColor = value;
+ }
+ }
+ public Color BackColor {
+ get {
+ if(backColor != Color.Empty){
+ return backColor;
+ }
+ else{
+ //FIXME: return system color if possible
+ return backColor;
+ }
+ }
+ set {
+ backColor = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AnchorStyles.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AnchorStyles.cs
new file mode 100644
index 00000000000..015c3454951
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AnchorStyles.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.AnchorStyles.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AnchorStyles{
+ Bottom = 2,
+ Left = 4,
+ None = 0,
+ Right = 8,
+ Top = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Appearance.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Appearance.cs
new file mode 100644
index 00000000000..64cfba8f898
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Appearance.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.Appearance.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum Appearance {
+ Button = 0,
+ Normal = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs
new file mode 100644
index 00000000000..041b226a38a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs
@@ -0,0 +1,270 @@
+//
+// System.Windows.Forms.Application
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Miguel de Icaza (miguel@ximian.com)
+// Dennis hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Drawing;
+using Microsoft.Win32;
+using System.ComponentModel;
+using System.Threading;
+using System.Globalization;
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides static methods and properties to manage an application,
+ /// such as methods to start and stop an application, to process
+ /// Windows messages, and properties to get information about an
+ /// application. This class cannot be inherited.
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class Application {
+ static private ApplicationContext applicationContext = null;
+ static private bool messageLoopStarted = false;
+ static private bool messageLoopStopRequest = false;
+ static private ArrayList messageFilters = new ArrayList ();
+ static private string safeTopLevelCaptionFormat;
+ // --- (public) Properties ---
+ public static bool AllowQuit {
+ // according to docs return false if embbedded in a
+ // browser, not (yet?) embedded in a browser
+ get { return true; }
+ }
+
+ [MonoTODO]
+ public static string CommonAppDataPath {
+ get {
+ //FIXME:
+ return "";
+ }
+ }
+
+ [MonoTODO]
+ public static RegistryKey CommonAppDataRegistry {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static string CompanyName {
+ get {
+ //FIXME:
+ return "Company Name";
+ }
+ }
+
+ [MonoTODO]
+ public static CultureInfo CurrentCulture {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public static InputLanguage CurrentInputLanguage {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string ExecutablePath {
+ get {
+ //FIXME:
+ return "";
+ }
+ }
+
+ [MonoTODO]
+ public static string LocalUserAppDataPath {
+ get {
+ //FIXME:
+ return "";
+ }
+ }
+
+ public static bool MessageLoop {
+ get {
+ return messageLoopStarted;
+ }
+ }
+
+ [MonoTODO]
+ public static string ProductName {
+ get {
+ //FIXME:
+ return "Product Name";
+ }
+ }
+
+ [MonoTODO]
+ public static string ProductVersion {
+ get {
+ //FIXME:
+ return "0.0.0";
+ }
+ }
+
+ [MonoTODO]
+ public static string SafeTopLevelCaptionFormat {
+ get {
+ return safeTopLevelCaptionFormat;
+ }
+ set {
+ safeTopLevelCaptionFormat = value;
+ }
+ }
+
+ [MonoTODO]
+ public static string StartupPath {
+ get {
+ //FIXME:
+ return "";
+ }
+ }
+
+ [MonoTODO]
+ public static string UserAppDataPath {
+ get {
+ //FIXME:
+ return "";
+ }
+ }
+
+ //[MonoTODO]
+ // Registry key not yet defined
+ //public static RegistryKey UserAppDataRegistry {
+ // get { throw new NotImplementedException (); }
+ //}
+
+ // --- Methods ---
+ public static void AddMessageFilter (IMessageFilter value)
+ {
+ messageFilters.Add (value);
+ }
+
+ //Compact Framework
+ public static void DoEvents ()
+ {
+ MSG msg = new MSG();
+
+ while (Win32.PeekMessageA (ref msg, (IntPtr) 0, 0, 0,
+ (uint)PeekMessageFlags.PM_REMOVE) != 0);
+ }
+
+ //Compact Framework
+ public static void Exit ()
+ {
+ Win32.PostQuitMessage (0);
+ }
+
+ public static void ExitThread ()
+ {
+ messageLoopStopRequest = true;
+ }
+
+ [MonoTODO]
+ public static ApartmentState OleRequired ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void OnThreadException (Exception t)
+ {
+ //FIXME:
+ }
+
+ public static void RemoveMessageFilter (IMessageFilter value)
+ {
+ messageFilters.Remove (value);
+ }
+
+ static private void ApplicationFormClosed (object o, EventArgs args)
+ {
+ Win32.PostQuitMessage (0);
+ }
+
+ //Compact Framework
+ static public void Run ()
+ {
+ MSG msg = new MSG();
+
+ messageLoopStarted = true;
+
+ while (!messageLoopStopRequest &&
+ Win32.GetMessageA (ref msg, 0, 0, 0) != 0) {
+
+ bool dispatchMessage = true;
+
+ Message message = new Message ();
+ message.HWnd = msg.hwnd;
+ message.Msg = msg.message;//
+ message.WParam = msg.wParam;
+ message.LParam = msg.lParam;
+
+ IEnumerator e = messageFilters.GetEnumerator();
+
+ while (e.MoveNext()) {
+ IMessageFilter filter =
+ (IMessageFilter) e.Current;
+
+ // if PreFilterMessage returns true
+ // the message should not be dispatched
+ if (filter.PreFilterMessage (ref message))
+ dispatchMessage = false;
+ }
+
+ if (dispatchMessage) {
+ Win32.TranslateMessage (ref msg);
+ Win32.DispatchMessageA (ref msg);
+ }
+
+ //if (Idle != null)
+ //Idle (null, new EventArgs());
+ }
+
+ //if (ApplicationExit != null)
+ //ApplicationExit (null, new EventArgs());
+ }
+
+ public static void Run (ApplicationContext context)
+ {
+ applicationContext = context;
+ applicationContext.MainForm.Show ();
+ applicationContext.MainForm.Closed +=
+ new EventHandler (ApplicationFormClosed);
+ Run();
+ }
+
+ //[TypeAttributes.BeforeFieldInit]
+ public static void Run (Form form)
+ // Documents say this parameter name should be mainform,
+ // but the verifier says context.
+ {
+ form.CreateControl ();
+ ApplicationContext context = new ApplicationContext (
+ form);
+ Run (context);
+ }
+
+ // --- Events ---
+ public static event EventHandler ApplicationExit;
+ public static event EventHandler Idle;
+ public static event ThreadExceptionEventHandler ThreadException;
+ public static event EventHandler ThreadExit;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ApplicationContext.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
new file mode 100644
index 00000000000..9450d93973d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
@@ -0,0 +1,81 @@
+//
+// System.Windows.Forms.ApplicationContext
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies the contextual information about an application thread.
+ /// </summary>
+
+ [MonoTODO]
+ public class ApplicationContext {
+
+ Form mainForm;
+
+ // --- (public) Properties ---
+ public Form MainForm {
+ get { return mainForm; }
+ set { mainForm = value; }
+ }
+
+ // --- Constructor ---
+ public ApplicationContext()
+ {
+ mainForm = null;
+ }
+
+ public ApplicationContext(Form mainForm) : this()
+ {
+ this.mainForm = mainForm;
+ }
+
+ // --- Methods ---
+ [MonoTODO]
+ public void Dispose()
+ {
+ // see documentation on ApplicationContext.Dispose Method (Boolean)
+ this.Dispose(true);
+ }
+
+ [MonoTODO]
+ protected virtual void Dispose(bool disposing)
+ {
+
+ }
+
+ [MonoTODO]
+ public void ExitThread()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void ExitThreadCore()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnMainFormClosed(object sender,EventArgs e)
+ {
+ //FIXME:
+ }
+
+ // --- Methods: object ---
+ [MonoTODO]
+ ~ApplicationContext() {
+ // see documentation on ApplicationContext.Dispose Method (Boolean)
+ this.Dispose(false);
+ }
+
+ // --- Events ---
+ public event EventHandler ThreadExit;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs
new file mode 100644
index 00000000000..15f4d140f1b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ArrangeDirection.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ArrangeDirection {
+ Down = 4,
+ Left = 0,
+ Right = 0,
+ Up = 4
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs
new file mode 100644
index 00000000000..00d22c215d7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.ArrangeStartingPosition.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ArrangeStartingPosition {
+ BottomLeft = 0,
+ BottomRight = 1,
+ Hide = 8,
+ TopLeft = 2,
+ TopRight = 3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AssemblyInfo.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AssemblyInfo.cs
new file mode 100644
index 00000000000..9f89a3282c5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs
new file mode 100644
index 00000000000..96e9e029563
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs
@@ -0,0 +1,518 @@
+//
+// System.Windows.Forms.AxHost
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+//
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Wraps ActiveX controls and exposes them as fully featured Windows Forms controls.
+ /// </summary>
+
+ [MonoTODO]
+ public abstract class AxHost : Control, ISupportInitialize, ICustomTypeDescriptor {
+
+ /// --- Constructors ---
+ /// Class AxHost does not have a constructor for non-internal purposes.
+ /// Thus, no constructor is stubbed out.
+ /// Here are the two AxHost constructors for supporting .NET Framework infrastructure:
+ /// - AxHost(String clsid);
+ /// - AxHost(string clsid,int flags);
+
+
+
+
+ /// --- public Properties ---
+ /// Properties supporting .NET framework, only. Not stubbed out:
+ /// - public bool EditMode {get;}
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ //FIXME:
+ return base.BackColor;
+ }
+ set {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+
+ [MonoTODO]
+ public ContainerControl ContainingControl {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override ContextMenu ContextMenu {
+ get {
+ //FIXME:
+ return base.ContextMenu;
+ }
+ set {
+ //FIXME:
+ base.ContextMenu = value;
+ }
+ }
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ //FIXME:
+ return base.CreateParams;
+ }
+ }
+
+ [MonoTODO]
+ public override Cursor Cursor {
+ get {
+ //FIXME:
+ return base.Cursor;
+ }
+ set {
+ //FIXME:
+ base.Cursor = value;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ //FIXME:
+ return base.DefaultSize;
+ }
+ }
+
+ [MonoTODO]
+ public override bool Enabled {
+ get {
+ //FIXME:
+ return base.Enabled;
+ }
+ set {
+ //FIXME:
+ base.Enabled = value;
+ }
+ }
+
+ [MonoTODO]
+ public override Font Font {
+ get {
+ //FIXME:
+ return base.Font;
+ }
+ set {
+ //FIXME:
+ base.Font = value;
+ }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool HasAboutBox {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public AxHost.State OcxState {
+ get {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ //FIXME
+ public virtual bool RightToLeft {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ ISite Site {
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+
+ /// --- methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected virtual void CreateSink();
+ /// - protected virtual void DetachSink();
+ /// - public void DoVerb(int verb);
+ /// - protected static Color GetColorFromOleColor(uint color);
+ /// - protected static Font GetFontFromIFont(object font);
+ /// - protected static Font GetFontFromIFontDisp(object font);
+ /// - protected static object GetIFontDispFromFont(Font font);
+ /// - protected static object GetIFontFromFont(Font font);
+ /// - protected static object GetIPictureDispFromPicture(Image image);
+ /// - protected static object GetIPictureFromCursor(Cursor cursor);
+ /// - protected static object GetIPictureFromPicture(Image image);
+ /// - protected static double GetOADateFromTime(DateTime time);
+ /// - protected static uint GetOleColorFromColor(Color color);
+ /// - protected static Image GetPictureFromIPicture(object picture);
+ /// - protected static Image GetPictureFromIPictureDisp(object picture);
+ /// - protected static DateTime GetTimeFromOADate(double date);
+ /// - public void InvokeEditMode();
+ /// - public void MakeDirty();
+ /// - protected bool PropsValid();
+ /// - protected void RaiseOnMouseDown(short button,short shift,int x,int y);
+ /// - protected void RaiseOnMouseDown(short button,short shift,float x,float y);
+ /// - protected void RaiseOnMouseDown(object o1,object o2,object o3,object o4);
+ /// - protected void RaiseOnMouseMove(short button,short shift,int x,int y);
+ /// - protected void RaiseOnMouseMove(short button,short shift,float x,float y);
+ /// - protected void RaiseOnMouseMove(object o1,object o2,object o3,object o4);
+ /// - protected void RaiseOnMouseUp(short button,short shift,int x,int y);
+ /// - protected void RaiseOnMouseUp(short button,short shift,float x,float y);
+ /// - protected void RaiseOnMouseUp(object o1,object o2,object o3,object o4);
+
+ [MonoTODO]
+ protected virtual void AttachInterfaces() {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void BeginInit() {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void CreateHandle() {
+ //FIXME:
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected override void DestroyHandle() {
+ //FIXME:
+ base.DestroyHandle();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) {
+ //FIXME:
+ base.Dispose(disposing);
+ }
+
+ [MonoTODO]
+ public virtual void EndInit() {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public object GetOcx() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasPropertyPages() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool IsInputChar(char charCode) {
+ //FIXME:
+ return base.IsInputChar(charCode);
+ }
+
+ /// --- methods used with events ---
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e) {
+ //FIXME:
+ base.OnBackColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e) {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnForeColorChanged(EventArgs e) {
+ //FIXME:
+ base.OnForeColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e) {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ [MonoTODO]
+ protected override void OnLostFocus(EventArgs e) {
+ //FIXME:
+ base.OnLostFocus(e);
+ }
+ /// --- END OF: methods used with events ---
+
+ [MonoTODO]
+ public override bool PreProcessMessage(ref Message msg) {
+ //FIXME:
+ return base.PreProcessMessage(ref msg);
+ }
+
+ [MonoTODO]
+ protected override bool ProcessMnemonic(char charCode) {
+ //FIXME:
+ return base.ProcessMnemonic(charCode);
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData) { // .NET V1.1 Beta
+ //FIXME:
+ return base.ProcessDialogKey(keyData);
+ }
+
+ [MonoTODO]
+ protected void SetAboutBoxDelegate(AxHost.AboutBoxDelegate d) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void SetBoundsCore(int x,int y,int width,int height,BoundsSpecified specified) {
+ //FIXME:
+ base.SetBoundsCore(x,y,width,height,specified);
+ }
+
+ [MonoTODO]
+ protected override void SetVisibleCore(bool value) {
+ //FIXME:
+ base.SetVisibleCore(value);
+ }
+
+ [MonoTODO]
+ public void ShowAboutBox() {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ShowPropertyPages() {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ShowPropertyPages(Control control) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m) {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+
+ /// --- events ---
+
+ //[MonoToDo]
+ //public event EventHandler BackColorChanged;
+ //public new event EventHandler BackgroundImageChanged;
+ //public new event EventHandler BindingContextChanged;
+ //public new event UICuesEventHandler ChangeUICues;
+ //public new event EventHandler Click;
+ //public new event EventHandler ContextMenuChanged;
+ //public new event EventHandler CursorChanged;
+ //public new event EventHandler DoubleClick;
+ //public new event DragEventHandler DragDrop;
+ //public new event DragEventHandler DragEnter;
+ //public new event EventHandler DragLeave;
+ //public new event DragEventHandler DragOver;
+ //public new event EventHandler EnabledChanged;
+ //public new event EventHandler FontChanged;
+ //public new event EventHandler ForeColorChanged;
+ //public new event GiveFeedbackEventHandler GiveFeedback;
+ //public new event HelpEventHandler HelpRequested;
+ //public new event EventHandler ImeModeChanged;
+ //public new event KeyEventHandler KeyDown;
+ //public new event KeyPressEventHandler KeyPress;
+ //public new event KeyEventHandler KeyUp;
+ //public new event LayoutEventHandler Layout;
+ //public new event MouseEventHandler MouseDown;
+ //public new event EventHandler MouseEnter;
+ //public new event EventHandler MouseHover;
+ //public new event EventHandler MouseLeave;
+ //public new event MouseEventHandler MouseMove;
+ //public new event MouseEventHandler MouseUp;
+ //public new event MouseEventHandler MouseWheel;
+ //public new event PaintEventHandler Paint;
+ //public new event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
+ //public new event QueryContinueDragEventHandler QueryContinueDrag;
+ //public new event EventHandler RightToLeftChanged;
+ //public new event EventHandler StyleChanged;
+ //public new event EventHandler TabIndexChanged;
+ //public new event EventHandler TabStopChanged;
+ //public new event EventHandler TextChanged;
+
+ /// --- public delegates ---
+ //[Serializable]
+ protected delegate void AboutBoxDelegate();
+
+ /// --- ICustomTypeDescriptor methods ---
+ /// Note: all of them are supporting .NET framework, but have to be stubbed out for the interface
+
+ [MonoTODO]
+ AttributeCollection ICustomTypeDescriptor.GetAttributes()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetClassName()
+ {
+ //FIXME:
+ return "";
+ }
+
+ [MonoTODO]
+ string ICustomTypeDescriptor.GetComponentName()
+ {
+ //FIXME:
+ return "";
+ }
+
+ [MonoTODO]
+ TypeConverter ICustomTypeDescriptor.GetConverter()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetEditor(Type editorBaseType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ /// sub-class: AxHost.InvalidActiveXStateException
+ /// <summary>
+ /// The exception that is thrown when the ActiveX control is referenced while in an invalid state.
+ /// </summary>
+ [MonoTODO]
+ public class InvalidActiveXStateException : Exception {
+
+ }
+
+
+ /// sub-class: AxHost.State
+ /// <summary>
+ /// Encapsulates the persisted state of an ActiveX control.
+ ///
+ /// Note: the class does not contain any documented methods, just only those supporting .NET framework
+ /// </summary>
+ [MonoTODO]
+ [Serializable]
+ public class State : ISerializable {
+
+ /// The classes only constructor is supporting .NET framework, and thus not stubbed out:
+ /// - [Serializable] public AxHost.State(Stream ms,int storageType,bool manualUpdate,string licKey);
+
+ /// --- Methods ---
+ //[Serializable]
+ void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BaseCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BaseCollection.cs
new file mode 100644
index 00000000000..666bdba213d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BaseCollection.cs
@@ -0,0 +1,73 @@
+//
+// System.Windows.Forms.BaseCollection
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides the base functionality for creating data-related collections in the System.Windows.Forms namespace.
+ /// ToDo note:
+ /// - Synchronization is not implemented
+ /// - MarshalByRefObject members not stubbed out
+ /// </summary>
+
+ public class BaseCollection : MarshalByRefObject, ICollection, IEnumerable {
+
+ ArrayList list;
+
+ // --- Constructor ---
+ public BaseCollection()
+ {
+ this.list = null;
+ }
+
+ // --- public and protected Properties ---
+// public virtual int ICollection.Count {
+ public virtual int Count {
+ get {
+ return list.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ //always false as per spec.
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ //always false as per spec.
+ get { return false; }
+ }
+
+ protected virtual ArrayList List {
+ get {
+ return list;
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ // --- public Methods ---
+ public void CopyTo (Array ar, int index)
+ {
+ list.CopyTo(ar, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Binding.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Binding.cs
new file mode 100644
index 00000000000..fc23300231f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Binding.cs
@@ -0,0 +1,99 @@
+//
+// System.Windows.Forms.Binding.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+ public class Binding {
+
+ /// <summary>
+ /// Represents the simple binding between the property value of an object and the property value of a control.
+ ///
+ /// ToDo note:
+ /// - MarshalByRefObject members not stubbed out
+ /// </summary>
+
+ // --- Constructor
+ //
+ public Binding(string propertyName,object dataSource,string dataMember)
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public BindingManagerBase BindingManagerBase {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public BindingMemberInfo BindingMemberInfo {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Control Control {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object DataSource {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsBinding {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string PropertyName {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ protected virtual void OnFormat(ConvertEventArgs cevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnParse(ConvertEventArgs cevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event ConvertEventHandler Format {
+
+ add { throw new NotImplementedException (); }
+ remove { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public event ConvertEventHandler Parse {
+
+ add { throw new NotImplementedException (); }
+ remove { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingContext.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingContext.cs
new file mode 100644
index 00000000000..29f2a9e6c26
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingContext.cs
@@ -0,0 +1,87 @@
+//
+// System.Windows.Forms.BindingContext.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ public class BindingContext {
+
+ /// <summary>
+ /// Manages the collection of BindingManagerBase objects for any object that inherits from the Control class.
+ /// </summary>
+
+ //private
+ // --- Constructor
+ [MonoTODO]
+ public BindingContext ()
+ {
+ //
+ }
+
+ //
+ // --- Public Properties
+ // Following properties not stubbed out, because they are only supporting internal .NET Framework infrastructure.
+ // - bool IsReadOnly {get;}
+ [MonoTODO]
+ public BindingManagerBase this[object dataSource] {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public BindingManagerBase this[object dataSource,string dataMember] {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ //
+ // --- Methods
+ // Following methods not stubbed out, because they are only supporting internal .NET Framework infrastructure.
+ // - protected virtual void AddCore(object dataSource,BindingManagerBase listManager)
+ // - protected virtual void ClearCore()
+ // - void ICollection.CopyTo(Array ar,int index)
+ // - IEnumerator IEnumerable.GetEnumerator()
+ // - protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ // - protected virtual void RemoveCore(object dataSource)
+ [MonoTODO]
+ protected internal void Add(object dataSource, BindingManagerBase listManager)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool Contains(object dataSource)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(object dataSource,string dataMember)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal void Remove(object dataSource)
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Events
+ // Following events not stubbed out, because they are only supporting internal .NET Framework infrastructure
+ public event CollectionChangeEventHandler CollectionChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs
new file mode 100644
index 00000000000..bb7e7254d95
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs
@@ -0,0 +1,112 @@
+//
+// System.Windows.Forms.BindingManagerBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+ //Compact Framework. Everything execpt suspend and resume binding needed for CE.
+ [MonoTODO]
+ public abstract class BindingManagerBase {
+
+
+ /// <summary>
+ /// Manages all Binding objects that are bound to the same data source and data member. This class is abstract.
+ /// </summary>
+
+ // --- Constructor
+ [MonoTODO]
+ public BindingManagerBase ()
+ {
+ }
+
+ //
+ // --- Fields
+ protected EventHandler onCurrentChangedHandler;
+ protected EventHandler onPositionChangedHandler;
+
+
+ //
+ // --- Public Properties
+ [MonoTODO]
+ public BindingsCollection Bindings {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ public abstract int Count {
+
+ get;
+ }
+
+ public abstract object Current {
+
+ get;
+ }
+
+ public abstract int Position {
+
+ get;
+ set;
+ }
+
+ //
+ // --- Methods
+ public abstract void AddNew();
+
+ public abstract void CancelCurrentEdit();
+
+ public abstract void EndCurrentEdit();
+
+ public abstract PropertyDescriptorCollection GetItemProperties ();
+
+ [MonoTODO]
+ protected internal virtual PropertyDescriptorCollection GetItemProperties (ArrayList dataSources,ArrayList listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual PropertyDescriptorCollection GetItemProperties (Type listType,int offset,ArrayList dataSources,ArrayList listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //protected abstract string GetListName(ArrayList listAccessors);
+ protected internal abstract string GetListName(ArrayList listAccessors);
+
+ protected internal abstract void OnCurrentChanged(EventArgs e);
+
+ [MonoTODO]
+ protected void PullData()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void PushData()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void RemoveAt(int index);
+
+ public abstract void ResumeBinding();
+ public abstract void SuspendBinding();
+
+ protected abstract void UpdateIsBinding();
+
+
+ //
+ // --- Public Events
+
+ public event EventHandler CurrentChanged;
+ public event EventHandler PositionChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs
new file mode 100644
index 00000000000..cb868c0b97d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs
@@ -0,0 +1,138 @@
+//
+// System.Drawing.BindingMemberInfo.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+//TODO:
+// 1) Add real values in constructor.
+// 2) Verify nocheck needed in GetHashCode.
+// 3) Verify GetHashCode returns decent and valid hash.
+
+
+using System;
+using System.Windows.Forms;
+namespace System.Windows.Forms {
+
+ public struct BindingMemberInfo {
+
+ private string bindingfield;
+ private string bindingpath;
+ private string bindingmember;
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+
+ public BindingMemberInfo (string dataMember)
+ {
+ //TODO: Initilize with real values.
+ bindingmember = ("");
+ bindingfield = ("");
+ bindingpath = ("");
+ }
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two BindingMemberInfo objects. The return value is
+ /// based on the equivalence of the BindingMember, BindingPath,
+ /// and BindingMember properties of the two objects.
+ /// </remarks>
+
+ public static bool operator == (BindingMemberInfo bmi_a,
+ BindingMemberInfo bmi_b) {
+
+ return ((bmi_a.bindingfield == bmi_b.bindingfield) &&
+ (bmi_a.bindingpath == bmi_b.bindingpath)&&
+ (bmi_a.bindingmember == bmi_b.bindingmember));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two BindingMemberInfo objects. The return value is
+ /// based on the equivalence of the BindingMember, BindingPath,
+ /// and BindingMember properties of the two objects.
+ /// </remarks>
+ public static bool operator != (BindingMemberInfo bmi_a,
+ BindingMemberInfo bmi_b) {
+ return ((bmi_a.bindingfield != bmi_b.bindingfield) ||
+ (bmi_a.bindingpath != bmi_b.bindingpath)||
+ (bmi_a.bindingmember != bmi_b.bindingmember));
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+
+ public string BindingField {
+ get{
+ return bindingfield;
+ }
+ }
+
+ public string BindingPath {
+ get{
+ return bindingpath;
+ }
+ }
+
+ public string BindingMember {
+ get{
+ return bindingmember;
+ }
+ }
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this BindingMemberInfo and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is BindingMemberInfo))
+ return false;
+
+ return (this == (BindingMemberInfo) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ unchecked{
+ // MONOTODO: This should not be checked, remove unchecked, if redundant.
+ return (int)( bindingfield.GetHashCode() ^ bindingmember.GetHashCode() ^ bindingpath.GetHashCode());
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingsCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
new file mode 100644
index 00000000000..8e6f1a8737b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
@@ -0,0 +1,111 @@
+//
+// System.Windows.Forms.BindingsCollection.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a collection of Binding objects for a control.
+ ///
+ /// </summary>
+
+ public class BindingsCollection : BaseCollection {
+
+ #region Constructors
+ protected internal BindingsCollection ()
+ {
+ }
+ #endregion
+
+ // --- public and protected Properties ---
+ public override int Count {
+ get {
+ return base.Count;
+ }
+ }
+
+ public Binding this[int index] {
+ get {
+ return (Binding)(base.List[index]);
+ }
+ }
+
+ [MonoTODO]
+ protected override ArrayList List {
+ get {
+ return base.List;
+ }
+ }
+
+ // --- public Methods ---
+ // following internal methods are (will) not be stubbed out:
+ // - protected virtual void AddCore(Binding dataBinding);
+ // - protected virtual void ClearCore();
+ // - protected virtual void RemoveCore(Binding dataBinding);
+ //
+ // CollectionChanged event:
+ // Though it was not documented, here methods Add and Remove
+ // cause the CollectionChanged event to occur, similarily as Clear.
+ // Would be nice if someone checked the exact event behavior of .NET implementation.
+
+ protected internal void Add(Binding binding)
+ {
+ base.List.Add(binding);
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Add,
+ base.List
+ ));
+ }
+
+ protected internal void Clear()
+ {
+ base.List.Clear();
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Refresh,
+ base.List
+ ));
+ }
+
+ protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ CollectionChanged(this, ccevent);
+ }
+
+ protected internal void Remove(Binding binding)
+ {
+ base.List.Remove(binding);
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Remove,
+ base.List
+ ));
+ }
+
+ protected internal void RemoveAt(int index)
+ {
+ base.List.RemoveAt(index);
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Remove,
+ base.List
+ ));
+ }
+
+ protected internal bool ShouldSerializeMyAll()
+ {
+ if (this.Count>0) return true;
+ else return false;
+ }
+
+ // public events
+ public event CollectionChangeEventHandler CollectionChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BootMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BootMode.cs
new file mode 100644
index 00000000000..c5658c4aa25
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BootMode.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.BootMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum BootMode {
+ FailSafe = 1,
+ FailSafeWithNetwork = 2,
+ Normal = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DSide.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DSide.cs
new file mode 100644
index 00000000000..63bb8c7e8be
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DSide.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.Border3DSide.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum Border3DSide {
+ All = 2063,
+ Bottom = 8,
+ Left = 1,
+ Middle = 2048,
+ Right = 4,
+ Top = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DStyle.cs
new file mode 100644
index 00000000000..5e17cd4816d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Border3DStyle.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.Border3DStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum Border3DStyle {
+ Adjust = 8192,
+ Bump = 9,
+ Etched = 6,
+ Flat = 16394,
+ Raised = 5,
+ RaisedInner = 4,
+ RaisedOuter = 1,
+ Sunken = 10,
+ SunkenInner = 8,
+ SunkenOuter = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BorderStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BorderStyle.cs
new file mode 100644
index 00000000000..fcd173d53eb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BorderStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.BorderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum BorderStyle {
+ Fixed3D = 2,
+ FixedSingle = 1,
+ None = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs
new file mode 100644
index 00000000000..e7d104d51bd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.BoundsSpecified.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum BoundsSpecified {
+ All = 15,
+ Height = 8,
+ Location = 3,
+ None = 0,
+ Size = 12,
+ Width = 4,
+ X = 1,
+ Y = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs
new file mode 100644
index 00000000000..914401e8a4b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs
@@ -0,0 +1,115 @@
+//
+// System.Windows.Forms.Button.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows button control.
+ /// </summary>
+
+ public class Button : ButtonBase, IButtonControl {
+
+ // private fields
+ DialogResult dialogResult;
+
+ // --- Constructor ---
+ public Button() : base()
+ {
+ dialogResult = DialogResult.None;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "BUTTON";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ // --- IButtonControl property ---
+ public virtual DialogResult DialogResult {
+ get { return dialogResult; }
+ set { dialogResult = value; }
+ }
+
+ // --- IButtonControl method ---
+ [MonoTODO]
+ public virtual void NotifyDefault(bool value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void PerformClick()
+ {
+ //FIXME:
+ }
+
+ // --- Button methods for events ---
+ protected override void OnClick(EventArgs e)
+ {
+ base.OnClick (e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ // --- Button methods ---
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ return base.ProcessMnemonic (charCode);
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ return base.ToString();
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- Button events ---
+ /// commented out, cause it only supports the .NET Framework infrastructure
+ /*
+ [MonoTODO]
+ public new event EventHandler DoubleClick {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs
new file mode 100644
index 00000000000..c5f2634fcd9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs
@@ -0,0 +1,199 @@
+//
+// System.Windows.Forms.ButtonBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Implements the basic functionality common to button controls.
+ /// </summary>
+
+ public abstract class ButtonBase : Control {
+
+ // private fields
+ FlatStyle flatStyle;
+ Image image;
+ ContentAlignment imageAlign;
+ int imageIndex;
+ ContentAlignment textAlign;
+ ImeMode imeMode;
+ bool isDefault;
+ CreateParams createParams;
+ Label label;
+//
+// // --- Constructor ---
+ protected ButtonBase() : base()
+ {
+ flatStyle = FlatStyle.Standard;
+ image = null;
+ imageAlign = ContentAlignment.MiddleCenter;
+ imageIndex = -1;
+ textAlign = ContentAlignment.MiddleCenter;
+ imeMode = ImeMode.Inherit;
+ isDefault = false;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get { return createParams; }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(75,23);// default size for button.
+ }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set { flatStyle=value; }
+ }
+
+ public Image Image {
+ get { return image; }
+ set { image=value; }
+ }
+
+ public ContentAlignment ImageAlign {
+ get { return imageAlign; }
+ set { imageAlign=value; }
+ }
+
+ public int ImageIndex {
+ get { return imageIndex; }
+ set { imageIndex=value; }
+ }
+
+ public new ImeMode ImeMode {
+ get {
+ return imeMode; }
+ set {
+ imeMode = value;
+ }
+ }
+
+ protected bool IsDefault {
+ get {
+ return isDefault;
+ }
+ set {
+ isDefault = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual ContentAlignment TextAlign {
+ get { return label.TextAlign; }
+ set { label.TextAlign = value; }
+ }
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected override void Dispose(bool);
+ /// - protected void ResetFlagsandPaint();
+
+
+ // I do not think this is part of the spec.
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ /// [methods for events]
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnGotFocus (EventArgs e)
+ {
+ base.OnGotFocus (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs kevent)
+ {
+ base.OnKeyDown (kevent);
+ }
+
+ protected override void OnKeyUp (KeyEventArgs kevent)
+ {
+ base.OnKeyUp (kevent);
+ }
+
+ protected override void OnLostFocus (EventArgs e)
+ {
+ base.OnLostFocus (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ base.OnMouseDown (e);
+ }
+
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ base.OnMouseEnter (e);
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+ /// end of [methods for events]
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- ButtonBase.ButtonBaseAccessibleObject ---
+ /// the class is not stubbed, cause it's only used for .NET framework
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs
new file mode 100644
index 00000000000..43a54af58fa
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.ButtonBorderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ButtonBorderStyle {
+ Dashed = 2,
+ Dotted = 1,
+ Inset = 4,
+ None = 0,
+ Outset = 5,
+ Solid = 3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonState.cs
new file mode 100644
index 00000000000..f0f869d390e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonState.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.ButtonState.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ButtonState {
+ All = 181176,
+ Checked = 1024,
+ Flat = 16384,
+ Inactive = 256,
+ Normal = 0,
+ Pushed = 512
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs
new file mode 100644
index 00000000000..555163d5bb0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.CaptionButton.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the type of caption button to display.
+ /// </summary>
+
+ public enum CaptionButton {
+
+ //Values were verified with enumcheck.
+ Close = 0,
+ Minimize = 1,
+ Maximize = 2,
+ Restore = 3,
+ Help = 4,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog
new file mode 100644
index 00000000000..83fe68ed0bb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog
@@ -0,0 +1,2064 @@
+ 2002-12-9 DennisHayes <dennish@raytek.com>
+
+ * Form.cs
+ * KeysConverter.cs
+ * Label.cs
+ * LinkArea.cs
+ * LinkLabel.cs
+ * ListBindingConverter.cs
+ * ListBox.cs
+ * ListControl.cs
+ * ListView.cs
+ * ListViewItem.cs
+ * ListViewItemConverter.cs
+ * MainMenu.cs
+ * Menu.cs
+ * MenuItem.cs
+ * NativeWindow.cs
+ * NumericUpDown.cs
+ * OpacityConverter.cs
+ * OSFeature.cs
+ * PictureBox.cs
+ * PrintControllerWithStatusDialog.cs
+ * PrintDialog.cs
+ * PrintPreviewControl.cs
+ * PropertyManager.cs
+ * RadioButton.cs
+ * Screen.cs
+ * ScrollableControl.cs
+ * ScrollBar.cs
+ * SendKeys.cs
+ * SplitterEventArgs.cs
+ * StatusBar.cs
+ * SystemInformation.cs
+ * TextBoxBase.cs
+ * ToolBar.cs
+ * TrackBar.cs
+ * TreeNode.cs
+ * TreeNodeCollection.cs
+ * TreeNodeConverter.cs
+ * TreeView.cs
+
+ * cleanup, fixes, some implmentation
+
+ 2002-12-6 DennisHayes <dennish@raytek.com>
+
+ * checkin for Alexandre Pigolkine (pigolkine@gmx.de)
+ * Form.cs
+ * Menu.cs
+ * MenuItem.cs
+
+ * Implmentation
+
+ 2002-12-6 DennisHayes <dennish@raytek.com>
+
+ * Control.cs
+ * Form.cs
+ * MonthCalendar.cs
+ * Screen.cs
+ * SelectionRange.cs
+ * SelectionRangeConverter.cs
+ * TabPage.cs
+ * TextBox.cs
+ * Timer.cs
+ * ToolBarButton.cs
+ * TrackBar.cs
+ * UpDownBase.cs
+ * UserControl.cs
+ * tooltip.cs
+
+ * cleanup, dead code removeal, replaced throw not implmented's with //FIXME:s
+
+ 2002-12-3 DennisHayes <dennish@raytek.com>
+ * *.cs
+ * switched to unix style line terminiators
+
+
+ 2002-12-3 DennisHayes <dennish@raytek.com>
+
+ * 140 files changed. replaced throw notimplmenteds with FIXME:s, removed dead code,
+ * corrected
+
+ 2002-12-1 DennisHayes <dennish@raytek.com>
+
+ * AccessibleObject.cs
+ * Application.cs
+ * ApplicationContext.cs
+ * AxHost.cs
+ * Binding.cs
+ * BindingContext.cs
+ * Button.cs
+ * CheckBox.cs
+ * CheckedListBox.cs
+ * Clipboard.cs
+ * ColorDialog.cs
+ * ColumnHeader.cs
+ * ComboBox.cs
+ * CommonDialog.cs
+ * ContainerControl.cs
+ * ContextMenu.cs
+ * Control.cs
+ * ControlBindingsCollection.cs
+ * ControlPaint.cs
+ * CreateParams.cs
+ * CurrencyManager.cs
+ * Cursor.cs
+ * CursorConverter.cs
+ * Cursors.cs
+ * DataFormats.cs
+ * DataGrid.cs
+ * DataGridTableStyle.cs
+ * DataGridTextBox.cs
+ * DataGridTextBoxColumn.cs
+ * DataObject.cs
+ * ErrorProvider.cs
+ * Form.cs
+
+ * removed some throw notimplmented ecexptions
+ * Some small implmentaions
+ * some dead code removal
+
+ 2002-11-28 DennisHayes <dennish@raytek.com>
+
+ * In visual studio, I added a SWFTest project to the SWF solution.
+ * Using Microsoft's swf.dll, I added one of each possible stock controls to the form.
+ * I closed the form (swf design stuff i svery incomplete).
+ * I Removed the reference to MS's swf.dll, and added a reference to the SWF project.
+ * The result compiles, runs, and can be closed, without crashing in windows.
+ * PrintPreviewDialog is the only item (other than crystal reports) on the
+ * standard toolbar that is not included.
+ * When run, a standard window comes up, not a dialog/form type window.
+ * The form is as small as possible, just a caption bar of minimum width
+ * with control bax and min/max box. It can be resized to any size fine.
+ * no controls are actualy displayed. they may be of zero size, or it
+ * may be due to the window not being a dialog box, or it may be anything.
+
+ * ApplicationContext.cs
+ * Button.cs
+ * ChangeLog
+ * CheckBox.cs
+ * CheckedListBox.cs
+ * ColorDialog.cs
+ * ComboBox.cs
+ * ContainerControl.cs
+ * Control.cs
+ * DataGrid.cs
+ * DateTimePicker.cs
+ * DomainUpDown.cs
+ * ErrorProvider.cs
+ * FileDialog.cs
+ * FontDialog.cs
+ * Form.cs
+ * GroupBox.cs
+ * HelpProvider.cs
+ * HScrollBar.cs
+ * ImageList.cs
+ * Label.cs
+ * LinkLabel.cs
+ * ListBox.cs
+ * ListControl.cs
+ * ListView.cs
+ * logfile.txt
+ * MainMenu.cs
+ * Menu.cs
+ * MenuItem.cs
+ * NativeWindow.cs
+ * NotifyIcon.cs
+ * NumericUpDown.cs
+ * OpenFileDialog.cs
+ * PageSetupDialog.cs
+ * Panel.cs
+ * PictureBox.cs
+ * PrintDialog.cs
+ * PrintPreviewControl.cs
+ * PrintPreviewDialog.cs
+ * ProgressBar.cs
+ * RadioButton.cs
+ * RichTextBox.cs
+ * SaveFileDialog.cs
+ * ScrollableControl.cs
+ * ScrollBar.cs
+ * Splitter.cs
+ * StatusBar.cs
+ * System.Windows.Forms.csproj
+ * System.Windows.Forms.csproj.user
+ * TabControl.cs
+ * TextBox.cs
+ * TextBoxBase.cs
+ * Timer.cs
+ * ToolBar.cs
+ * ToolBarButton.cs
+ * tooltip.cs
+ * TrackBar.cs
+ * TreeNode.cs
+ * TreeNodeCollection.cs
+ * TreeView.cs
+ * UpDownBase.cs
+ * UserControl.cs
+ * VScrollBar.cs
+ * win32Enums.cs
+ * win32functions.cs
+
+ 2002-11-27 DennisHayes <dennish@raytek.com>
+ * checkin for Alexandre Pigolkine (pigolkine@gmx.de) with minor changes
+
+ * Control.cs
+ * MainMenu.cs
+ * Menu.cs
+ * MenuItem.cs
+ * NativeWindow.cs
+ * win32Enums.cs
+ * win32functions.cs
+
+ * WIN32 implmentation
+
+ 2002-11-24 DennisHayes <dennish@raytek.com>
+
+ * Application.cs
+ * Control.cs
+ * Form.cs
+ * Message.cs
+ * NativeWindow.cs
+ * ScrollableControl.cs
+ * win32functions.cs
+ * win32Structs.cs
+
+ * Fixed added more win32 stuff
+ * On windows in Visual studio and runs my test program, but does
+ * not display a window. the window Handle is null, so the size gets set to 0,0.
+
+
+ 2002-11-23 DennisHayes <dennish@raytek.com>
+ checked in for Francois-Denis Gonthier
+
+ * win32functions.cs
+ * win32Structs.cs
+ * Menu.cs
+ * ScrollableControl.cs
+ * MenuItem.cs
+ * NativeWindow.cs
+ * Form.cs
+ * move some more stuff from monostub to c#
+ * converted a couple of files to unix style line end
+ * some implmementation
+
+ 2002-11-17 DennisHayes <dennish@raytek.com>
+
+ * AccessibleObject.cs
+
+ * Removed COMvisible. Docs say yes, but verifer says no
+
+ 2002-11-17 DennisHayes <dennish@raytek.com>
+
+ * Application.cs
+ * Button.cs
+ * Control.cs
+ * Form.cs
+ * Label.cs
+ * ListBox.cs
+ * Menu.cs
+ * MessageBox.cs
+ * NativeWindow.cs
+ * PrintPreviewDialog.cs
+ * ScrollableControl.cs
+ * ScrollBar.cs
+ * VScrollBar.cs
+
+ * Made changes releated to the new win32 stuff
+
+ 2002-11-17 DennisHayes <dennish@raytek.com>
+ * Win32Enums.cs
+ * Win32Handles.cs
+ * Win32Interfaces.cs
+ * Win32RegistryUtil.cs
+ * Win32Structs.cs
+
+ * Completed merging files from Carlos Harvey Perez
+ * Moved all parts of Win32.cs to these files
+ * eliminated Win32.cs.
+ *
+ * many things moved from win32.cs still commented out.
+ * Also needs to be mono styled.
+
+ * Win32.cs - removed
+
+ 2002-11-12 DennisHayes <dennish@raytek.com>
+
+ * Win32Enums.cs
+ * Win32Handles.cs
+ * Win32Interfaces.cs
+ * Win32RegistryUtil.cs
+ * Win32Structs.cs
+
+ * Added files from Carlos Harvey Perez
+ ** Thanks Carlos! **
+ * Moved all parts of Win32.cs to these files
+ * Execpt for functions. Will merge functions
+ * and eliminate remove Win32.cs soon.
+ *
+ * most things moved from win32.cs still commented out.
+ * Also needs to be mono styled.
+
+ * Win32.cs
+ * Moved stuff from win32.cs to files from Carlos.2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListBox.cs: added ItemHeight and DrawMode properties. Fixes the build
+ in unix.
+
+ * ListBox.cs: added ItemHeight and DrawMode properties. Fixes the build
+ in unix.
+
+2002-11-02 Miguel de Icaza <miguel@ximian.com>
+
+ * Win32.cs: Added IsMenu, CreateMenu, AppendMenuA, DestroyMenu entry points.
+
+2002-10-29 DennisHayes <dennish@raytek.com>
+
+ * AmbientProperties.cs
+ * Application.cs
+ * ApplicationContext.cs
+ * CheckBox.cs
+ * CheckedListBox.cs
+ * ColumnHeader.cs
+ * ContainerControl.cs
+ * ContextMenu.cs
+ * Control.cs
+ * Cursors.cs
+ * HScrollBar.cs
+ * ListBox.cs
+ * MainMenu.cs
+ * Menu.cs
+ * MenuItem.cs
+ * MessageBox.cs
+ * NativeWindow.cs
+ * PictureBox.cs
+ * ScrollableControl.cs
+ * ScrollBar.cs
+ * System.Windows.Forms.csproj
+ * System.Windows.Forms.csproj.user
+ * VScrollBar.cs
+ * Win32.cs
+
+ * minor formating, bug fixes, and implmentation
+
+
+ 2002-10-29 DennisHayes <dennish@raytek.com>
+ * checkin for Alexandre Pigolkine (pigolkine@gmx.de)
+ * Menu classes start on implmentation
+
+ 2002-10-27 DennisHayes <dennish@raytek.com>
+
+ * AccessibleObject.cs
+ * AssemblyInfo.cs
+ * AxHost.cs
+ * BaseCollection.cs
+ * BindingMemberInfo.cs
+ * BindingsCollection.cs
+ * ButtonBase.cs
+ * ColumnClickEventArgs.cs
+ * ComboBox.cs
+ * ContainerControl.cs
+ * ContentsResizedEventArgs.cs
+ * Control.cs
+ * ControlEventArgs.cs
+ * ConvertEventArgs.cs
+ * DateBoldEventArgs.cs
+ * DateRangeEventArgs.cs
+ * DomainUpDown.cs
+ * DragEventArgs.cs
+ * DrawItemEventArgs.cs
+ * FolderBrowserDialog.cs
+ * Form.cs
+ * GiveFeedbackEventArgs.cs
+ * HelpEventArgs.cs
+ * InputLanguageChangedEventArgs.cs
+ * InputLanguageChangingEventArgs.cs
+ * InvalidateEventArgs.cs
+ * ItemChangedEventArgs.cs
+ * ItemCheckEventArgs.cs
+ * ItemDragEventArgs.cs
+ * KeyEventArgs.cs
+ * KeyPressEventArgs.cs
+ * Keys.cs
+ * LabelEditEventArgs.cs
+ * LayoutEventArgs.cs
+ * LinkClickedEventArgs.cs
+ * LinkLabelLinkClickedEventArgs.cs
+ * ListControl.cs
+ * MeasureItemEventArgs.cs
+ * MouseEventArgs.cs
+ * NavigateEventArgs.cs
+ * NodeLabelEditEventArgs.cs
+ * PaintEventArgs.cs
+ * PrintPreviewDialog.cs
+ * PropertyTabChangedEventArgs.cs
+ * PropertyValueChangedEventArgs.cs
+ * QueryAccessibilityHelpEventArgs.cs
+ * QueryContinueDragEventArgs.cs
+ * ScrollEventArgs.cs
+ * SelectedGridItemChangedEventArgs.cs
+ * SplitterEventArgs.cs
+ * StatusBarDrawItemEventArgs.cs
+ * StatusBarPanelClickEventArgs.cs
+ * System.Windows.Forms.csproj
+ * System.Windows.Forms.csproj.user
+ * TextBox.cs
+ * ToolBarButtonClickEventArgs.cs
+ * TreeNodeConverter.cs
+ * TreeViewCancelEventArgs.cs
+ * UICuesEventArgs.cs
+ * UpDownBase.cs
+ * UpDownEventArgs.cs
+ * VScrollBar.cs
+
+ * Stubs now compliant with .NET 1.1 Beta, except for one that has dependencies.
+ * Added FolderBrowserDialog.cs for .NET 1.1 beta compatibility.
+ * Completed implmentation of all *Args classes.
+ * Updated checkoutlist.
+ * Made fixes so this will compile using Visual studio under windows.
+
+
+
+ 2002-10-26 DennisHayes <dennish@raytek.com>
+
+ * Added CheckOutFile to SWF one level up from here
+ * to keep track of who is working on what.
+
+ 2002-10-24 DennisHayes <dennish@raytek.com>
+
+ * AccessibleObject.cs
+ * Application.cs
+ * AssemblyInfo.cs
+ * BaseCollection.cs
+ * BindingContext.cs
+ * BindingManagerBase.cs
+ * BindingsCollection.cs
+ * ContainerControl.cs
+ * Control.cs
+ * Font.cs
+ * Form.cs
+ * IAccessible.cs
+ * InputLanguageCollection.cs
+ * Label.cs
+ * MessageBox.cs
+ * PropertyTabChangedEventArgs.cs
+ * ScrollableControl.cs
+ * Win32.cs
+ * WINELib.csproj
+ * WINELib.csproj.user
+ * winelib.sln
+
+ * Changes to get winelib version running with more methods uncommented out.
+ * Especialy trying to get CE compliance.
+
+2002-10-22 DennisHayes <dennish@raytek.com>
+ * Miguel moved files from WINELIB to here
+ * See ochagelog for details
+
+2002-10-13 DennisHayes <dennish@raytek.com>
+
+ *Application.cs
+ *AxHost.cs
+ *ChangeLog
+ *CheckedListBox.cs
+ *ComboBox.cs
+ *CurrencyManager.cs
+ *DateTimePicker.cs
+ *DomainUpDown.cs
+ *FolderBrowserDialog.cs
+ *ListBox.cs
+ *logfile.txt
+ *StatusBarDrawItemEventArgs.cs
+ *TabControl.cs
+ *TextBox.cs
+ *TrackBar.cs
+ *UpDownBase.cs
+
+ * Updated to match .NET V1.1 Beta
+
+2002-9-2 DennisHayes <dennish@raytek.com>
+
+* AccessibleObject.cs
+* AmbientProperties.cs
+* AxHost.cs
+* Button.cs
+* ButtonBase.cs
+* CheckBox.cs
+* ColorDialog.cs
+* ColumnHeader.cs
+* ComboBox.cs
+* ContainerControl.cs
+* DataGrid.cs
+* DateTimePicker.cs
+* ListControl.cs
+* PrintPreviewDialog.cs
+* Implmented any functions.
+
+* System.Windows.Forms.csproj
+* System.Windows.Forms.csproj.user
+* Added win32.cs
+
+2002-8-6 DennisHayes <dennish@raytek.com>
+* Checked in for Ginandrea Terzi (gterzi@lario.com)
+
+* MeasureItemEventArgs.cs
+* PropertyValueChangedEventArgs.cs
+* ScrollEventArgs.cs
+* ScrollEventType.cs
+* SelectionMode.cs
+* Shortcut.cs
+* TickStyle.cs
+* ToolBarButtonClickEventArgs.cs
+* TreeViewAction.cs
+* TriangleDirection.cs
+* UICues.cs
+* UICuesEventArgs.cs
+* UpDownBase.cs
+* UpDownEventHandler.cs
+* Fixed syntax errors and verifier errors
+
+2002-8-6 DennisHayes <dennish@raytek.com>
+
+* PropertyTabChangedEventArgs.cs
+* Minor sytax bug fixes.
+
+* System.Windows.Forms.csproj
+* System.Windows.Forms.csproj.user
+* System.Windows.Forms.sln
+* Added support for System.Windows.Forms.Design
+* Builds two dlls instead of one.
+* Allows compiling for now, but needs to be fixed
+
+2002-8-2 DennisHayes <dennish@raytek.com>
+* Checked in for Ginandrea Terzi (gterzi@lario.com)
+
+* AssemblyInfo.cs
+* ColumnClickEventArgs.cs
+* ContentsResizedEventArgs.cs
+* ControlEventArgs.cs
+* ConvertEventArgs.cs
+* DateBoldEventArgs.cs
+* DateRangeEventArgs.cs
+* DragEventArgs.cs
+* DrawItemEventArgs.cs
+* GiveFeedbackEventArgs.cs
+* HelpEventArgs.cs
+* InputLanguageChangedEventArgs.cs
+* InputLanguageChangingEventArgs.cs
+* InvalidateEventArgs.cs
+* ItemChangedEventArgs.cs
+* ItemCheckEventArgs.cs
+* ItemDragEventArgs.cs
+* KeyEventArgs.cs
+* KeyPressEventArgs.cs
+* LabelEditEventArgs.cs
+* LayoutEventArgs.cs
+* LinkClickedEventArgs.cs
+* LinkLabelLinkClickedEventArgs.cs
+* logfile.txt
+* MeasureItemEventArgs.cs
+* MouseEventArgs.cs
+* NavigateEventArgs.cs
+* NodeLabelEditEventArgs.cs
+* PaintEventArgs.cs
+* PropertyTabChangedEventArgs.cs
+* PropertyValueChangedEventArgs.cs
+* QueryAccessibilityHelpEventArgs.cs
+* QueryContinueDragEventArgs.cs
+* ScrollEventArgs.cs
+* SelectedGridItemChangedEventArgs.cs
+* SplitterEventArgs.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanelClickEventArgs.cs
+* ToolBarButtonClickEventArgs.cs
+* TreeViewCancelEventArgs.cs
+* UICuesEventArgs.cs
+* UpDownEventArgs.cs
+* Improved ToString functions
+* Completed the rest of the *.args classes
+
+2002-8-1 DennisHayes <dennish@raytek.com>
+* Checked in for Ginandrea Terzi (gterzi@lario.com)
+
+* KeyEventArgs.cs
+* KeyPressEventArgs.cs
+* LabelEditEventArgs.cs
+* LayoutEventArgs.cs
+* LinkClickedEventArgs.cs
+* LinkLabelLinkClickedEventArgs.cs
+* MeasureItemEventArgs.cs
+* MouseEventArgs.cs
+* NavigateEventArgs.cs
+* NodeLabelEditEventArgs.cs
+* PaintEventArgs.cs
+* PropertyTabChangedEventArgs.cs
+* PropertyValueChangedEventArgs.cs
+* QueryAccessibilityHelpEventArgs.cs
+* QueryContinueDragEventArgs.cs
+* ScrollEventArgs.cs
+* SelectedGridItemChangedEventArgs.cs
+* SplitterEventArgs.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanelClickEventArgs.cs
+* ToolBarButtonClickEventArgs.cs
+* TreeViewCancelEventArgs.cs
+* UICuesEventArgs.cs
+* UpDownEventArgs.cs
+* Corrected, cleaned up/ completed some *args.cs classes.
+* May break build, but should be easy to fix, will verifiy
+* tonight and check in any needed fixes.
+
+2002-8-1 DennisHayes <dennish@raytek.com>
+* MonthCalendar.cs
+* ButtonBase.cs
+* Form.cs
+* MonthCalendar commented out, stubbs need work
+* GTK references removed from Buttonbase and form, to make compile easier.
+* Replace GTK references as soon as build works on Windows and Linux.
+* With this, SWF should compile uder visual studio
+
+2002-8-1 DennisHayes <dennish@raytek.com>
+* TODOAttribute.cs
+* ComVisible.cs
+* added so the namespace can compile, remove when replaced with mono equivalents.
+
+2002-8-1 DennisHayes <dennish@raytek.com>
+* System.Windows.Forms.csproj
+* System.Windows.Forms.csproj.user
+* System.Windows.Forms.sln
+* AssemblyInfo.cs * Not sure if this file is needed. not a part of the namespace, just visual studio
+* Added files to compile using visual Studio
+
+2002-8-1 DennisHayes <dennish@raytek.com>
+* Getopt.cs
+* removed, file contained only trash, not needed.
+
+
+2002-7-30 DennisHayes <dennish@raytek.com>
+
+* AccessibleNavigation.cs
+* AccessibleObject.cs
+* AccessibleSelection.cs
+* AmbientProperties.cs
+* Application.cs
+* ApplicationContext.cs
+* AxHost.cs
+* BaseCollection.cs
+* Binding.cs
+* BindingContext.cs
+* BindingManagerBase.cs
+* BindingMemberInfo.cs
+* BindingsCollection.cs
+* Button.cs
+* ButtonBase.cs
+* CaptionButton.cs
+* CharacterCasing.cs
+* CheckBox.cs
+* CheckedListBox.cs
+* CheckState.cs
+* Clipboard.cs
+* ColorDialog.cs
+* ColumnClickEventArgs.cs
+* ColumnClickEventHandler.cs
+* ColumnHeader.cs
+* ComboBox.cs
+* CommonDialog.cs
+* ContainerControl.cs
+* ContentsResizedEventHandler.cs
+* ContextMenu.cs
+* Control.cs
+* ControlBindingsCollection.cs
+* ControlEventArgs.cs
+* ControlEventHandler.cs
+* ControlPaint.cs
+* ConvertEventHandler.cs
+* CreateParams.cs
+* CurrencyManager.cs
+* Cursor.cs
+* CursorConverter.cs
+* Cursors.cs
+* DataFormats.cs
+* DataGrid.cs
+* DataGridBoolColumn.cs
+* DataGridCell.cs
+* DataGridColumnStyle.cs
+* DataGridParentRowsLabelStyle.cs
+* DataGridPreferredColumnWidthTypeConverter.cs
+* DataGridTableStyle.cs
+* DataGridTextBox.cs
+* DataGridTextBoxColumn.cs
+* DataObject.cs
+* DateBoldEventArgs.cs
+* DateRangeEventArgs.cs
+* DateRangeEventHandler.cs
+* DateTimePicker.cs
+* DialogResult.cs
+* DockStyle.cs
+* DomainUpDown.cs
+* DragAction.cs
+* DragDropEffects.cs
+* DragEventArgs.cs
+* DragEventHandler.cs
+* DrawItemEventArgs.cs
+* DrawItemEventHandler.cs
+* DrawItemState.cs
+* DrawMode.cs
+* ErrorBlinkStyle.cs
+* ErrorIconAlignment.cs
+* ErrorProvider.cs
+* FeatureSupport.cs
+* FileDialog.cs
+* FlatStyle.cs
+* FontDialog.cs
+* Form.cs
+* FormBorderStyle.cs
+* FormStartPosition.cs
+* FormWindowState.cs
+* FrameStyle.cs
+* GiveFeedbackEventHandler.cs
+* GridColumnStylesCollection.cs
+* GridItemCollection.cs
+* GridTableStylesCollection.cs
+* GroupBox.cs
+* Help.cs
+* HelpEventHandler.cs
+* HelpProvider.cs
+* HScrollBar.cs
+* ImageIndexConverter.cs
+* ImageList.cs
+* ImageListStreamer.cs
+* InputLanguage.cs
+* InputLanguageChangedEventHandler.cs
+* InputLanguageChangingEventHandler.cs
+* InputLanguageCollection.cs
+* InvalidateEventHandler.cs
+* ItemChangedEventArgs.cs
+* ItemChangedEventHandler.cs
+* ItemCheckEventHandler.cs
+* ItemDragEventHandler.cs
+* KeyEventHandler.cs
+* KeyPressEventArgs.cs
+* KeyPressEventHandler.cs
+* KeysConverter.cs
+* Label.cs
+* LabelEditEventHandler.cs
+* LayoutEventHandler.cs
+* LinkArea.cs
+* LinkClickedEventHandler.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventHandler.cs
+* ListBindingConverter.cs
+* ListBox.cs
+* ListControl.cs
+* ListView.cs
+* ListViewItem.cs
+* ListViewItemConverter.cs
+* logfile.txt
+* MainMenu.cs
+* MeasureItemEventHandler.cs
+* Menu.cs
+* MenuItem.cs
+* Message.cs
+* MessageBox.cs
+* MethodInvoker.cs
+* MonthCalendar.cs
+* MouseEventHandler.cs
+* NativeWindow.cs
+* NavigateEventHandler.cs
+* NodeLabelEditEventHandler.cs
+* NotifyIcon.cs
+* NumericUpDown.cs
+* OpacityConverter.cs
+* OpenFileDialog.cs
+* OSFeature.cs
+* PageSetupDialog.cs
+* PaintEventArgs.cs
+* PaintEventHandler.cs
+* Panel.cs
+* PrintControllerWithStatusDialog.cs
+* PrintDialog.cs
+* PrintPreviewControl.cs
+* PrintPreviewDialog.cs
+* ProgressBar.cs
+* PropertyGrid.cs
+* PropertyManager.cs
+* PropertyTabChangedEventArgs.cs
+* PropertyTabChangedEventHandler.cs
+* PropertyValueChangedEventHandler.cs
+* QueryAccessibilityHelpEventHandler.cs
+* QueryContinueDragEventHandler.cs
+* RadioButton.cs
+* RichTextBox.cs
+* SaveFileDialog.cs
+* Screen.cs
+* ScrollableControl.cs
+* ScrollBar.cs
+* ScrollEventArgs.cs
+* ScrollEventHandler.cs
+* SelectedGridItemChangedEventHandler.cs
+* SelectionRange.cs
+* SelectionRangeConverter.cs
+* SendKeys.cs
+* Splitter.cs
+* SplitterEventHandler.cs
+* StatusBar.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarDrawItemEventHandler.cs
+* StatusBarPanel.cs
+* StatusBarPanelClickEventArgs.cs
+* StatusBarPanelClickEventHandler.cs
+* StatusBarPanelCollection.cs
+* SystemInformation.cs
+* TabControl.cs
+* TabPage.cs
+* TextBox.cs
+* TextBoxBase.cs
+* ThreadExceptionDialog.cs
+* Timer.cs
+* ToolBar.cs
+* ToolBarButton.cs
+* ToolBarButtonClickEventHandler.cs
+* ToolTip.cs
+* TrackBar.cs
+* TreeNode.cs
+* TreeNodeCollection.cs
+* TreeNodeConverter.cs
+* TreeView.cs
+* TreeViewCancelEventHandler.cs
+* TreeViewEventHandler.cs
+* TreeViewImageIndexConverter.cs
+* UICuesEventArgs.cs
+* UICuesEventHandler.cs
+* UpDownBase.cs
+* UpDownEventHandler.cs
+* UserControl.cs
+* VScrollBar.cs
+* Fixed errors reported by verify.exe, mostly attribute errors.
+* Added my name to author's list to files I edited in the last two weeks
+
+2002-7-22 DennisHayes <dennish@raytek.com>
+
+* DateTimePickerFormat.cs
+* Added values.
+* The NAMESPACE NOW COMPILES under windows in Visual Studio using the Microsoft version of the classes.
+* Verify.exe reports 600 errors.
+
+2002-7-21 DennisHayes <dennish@raytek.com>
+
+* AccessibleObject.cs
+* AmbientProperties.cs
+* AxHost.cs
+* BaseCollection.cs
+* BindingsCollection.cs
+* ButtonBase.cs
+* CheckBox.cs
+* CheckedListBox.cs
+* ComboBox.cs
+* ContainerControl.cs
+* ContextMenu.cs
+* Control.cs
+* ControlEventArgs.cs
+* ControlPaint.cs
+* ConvertEventArgs.cs
+* DataGrid.cs
+* DataGridColumnStyle.cs
+* DataObject.cs
+* DateTimePicker.cs
+* DomainUpDown.cs
+* DragEventArgs.cs
+* DrawItemEventArgs.cs
+* ErrorProvider.cs
+* FeatureSupport.cs
+* FileDialog.cs
+* FontDialog.cs
+* Form.cs
+* GiveFeedbackEventArgs.cs
+* GridColumnStylesCollection.cs
+* GridItem.cs
+* GridItemCollection.cs
+* GridTableStylesCollection.cs
+* GroupBox.cs
+* Help.cs
+* HelpEventArgs.cs
+* HelpProvider.cs
+* HScrollBar.cs
+* ImageIndexConverter.cs
+* ImageList.cs
+* ImageListStreamer.cs
+* InputLanguage.cs
+* InputLanguageChangedEventArgs.cs
+* InputLanguageChangingEventArgs.cs
+* InputLanguageCollection.cs
+* InvalidateEventArgs.cs
+* ItemChangedEventArgs.cs
+* ItemCheckEventArgs.cs
+* ItemDragEventArgs.cs
+* KeyEventArgs.cs
+* KeyPressEventArgs.cs
+* KeysConverter.cs
+* Label.cs
+* LabelEditEventArgs.cs
+* LayoutEventArgs.cs
+* LinkArea.cs
+* LinkClickedEventArgs.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventArgs.cs
+* LinkLabelLinkClickedEventHandler.cs
+* ListBindingConverter.cs
+* ListBox.cs
+* ListControl.cs
+* ListView.cs
+* ListViewItem.cs
+* ListViewItemConverter.cs
+* MainMenu.cs
+* MeasureItemEventArgs.cs
+* Menu.cs
+* MenuItem.cs
+* Message.cs
+* MessageBox.cs
+* MouseEventArgs.cs
+* NativeWindow.cs
+* NavigateEventArgs.cs
+* NodeLabelEditEventArgs.cs
+* NotifyIcon.cs
+* NumericUpDown.cs
+* OpacityConverter.cs
+* OpenFileDialog.cs
+* OSFeature.cs
+* PageSetupDialog.cs
+* PaintEventArgs.cs
+* Panel.cs
+* PrintControllerWithStatusDialog.cs
+* PrintDialog.cs
+* PrintPreviewDialog.cs
+* QueryAccessibilityHelpEventArgs.cs
+* QueryContinueDragEventArgs.cs
+* RadioButton.cs
+* RichTextBox.cs
+* SaveFileDialog.cs
+* Screen.cs
+* ScrollableControl.cs
+* ScrollBar.cs
+* ScrollEventArgs.cs
+* SelectedGridItemChangedEventArgs.cs
+* SelectionRange.cs
+* SelectionRangeConverter.cs
+* SendKeys.cs
+* Splitter.cs
+* SplitterEventArgs.cs
+* StatusBar.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanelCollection.cs
+* TabControl.cs
+* TabPage.cs
+* TextBox.cs
+* TextBoxBase.cs
+* ToolBar.cs
+* ToolBarButtonClickEventArgs.cs
+* ToolTip.cs
+* TrackBar.cs
+* TreeNodeCollection.cs
+* TreeView.cs
+* UserControl.cs
+* commented out inherited class that did not need to be stubbed.
+* fixed bugs, added values to one enum. Stubbed interfaces.
+* The NAMESPACE NOW COMPILES under windows in Visual Studio using the Microsoft version of the classes.
+* Verify.exe reports 600 errors.
+
+2002-7-7 DennisHayes <dennish@raytek.com>
+
+* ToolBarButtonClickEventArgs.cs
+* UpDownEventArgs.cs
+* KeyPressEventHandler.cs
+* Added new files.
+
+2002-7-7 DennisHayes <dennish@raytek.com>
+
+* AccessibleEvents.cs
+* AccessibleNavigation.cs
+* AccessibleObject.cs
+* AccessibleRole.cs
+* AccessibleSelection.cs
+* AccessibleStates.cs
+* AmbientProperties.cs
+* AnchorStyles.cs
+* Appearance.cs
+* Application.cs
+* ApplicationContext.cs
+* ArrangeDirection.cs
+* ArrangeStartingPosition.cs
+* AxHost.cs
+* BaseCollection.cs
+* Binding.cs
+* BindingContext.cs
+* BindingManagerBase.cs
+* BindingMemberInfo.cs
+* BindingsCollection.cs
+* BootMode.cs
+* Border3DSide.cs
+* Border3DStyle.cs
+* BorderStyle.cs
+* BoundsSpecified.cs
+* Button.cs
+* ButtonBase.cs
+* ButtonBorderStyle.cs
+* ButtonState.cs
+* CaptionButton.cs
+* CharacterCasing.cs
+* CheckBox.cs
+* CheckedListBox.cs
+* CheckState.cs
+* Clipboard.cs
+* ColorDepth.cs
+* ColorDialog.cs
+* ColumnClickEventArgs.cs
+* ColumnClickEventHandler.cs
+* ColumnHeader.cs
+* ColumnHeaderStyle.cs
+* ComboBox.cs
+* ComboBoxStyle.cs
+* CommonDialog.cs
+* ComVisible.cs
+* ContainerControl.cs
+* ContentsResizedEventArgs.cs
+* ContentsResizedEventHandler.cs
+* ContextMenu.cs
+* Control.cs
+* ControlBindingsCollection.cs
+* ControlEventArgs.cs
+* ControlEventHandler.cs
+* ControlPaint.cs
+* ControlStyles.cs
+* ConvertEventArgs.cs
+* ConvertEventHandler.cs
+* CreateParams.cs
+* CurrencyManager.cs
+* Cursor.cs
+* CursorConverter.cs
+* Cursors.cs
+* DataFormats.cs
+* DataGrid.cs
+* DataGridBoolColumn.cs
+* DataGridCell.cs
+* DataGridColumnStyle.cs
+* DataGridLineStyle.cs
+* DataGridParentRowsLabelStyle.cs
+* DataGridPreferredColumnWidthTypeConverter.cs
+* DataGridTableStyle.cs
+* DataGridTextBox.cs
+* DataGridTextBoxColumn.cs
+* DataObject.cs
+* DateBoldEventArgs.cs
+* DateRangeEventArgs.cs
+* DateRangeEventHandler.cs
+* DateTimePicker.cs
+* DateTimePickerFormat.cs
+* day.cs
+* DialogResult.cs
+* DockStyle.cs
+* DomainUpDown.cs
+* DragAction.cs
+* DragDropEffects.cs
+* DragEventArgs.cs
+* DragEventHandler.cs
+* DrawItemEventArgs.cs
+* DrawItemEventHandler.cs
+* DrawItemState.cs
+* DrawMode.cs
+* ErrorBlinkStyle.cs
+* ErrorIconAlignment.cs
+* ErrorProvider.cs
+* FeatureSupport.cs
+* FileDialog.cs
+* FlatStyle.cs
+* FontDialog.cs
+* Form.cs
+* FormBorderStyle.cs
+* FormStartPosition.cs
+* FormWindowState.cs
+* FrameStyle.cs
+* Getopt.cs
+* GiveFeedbackEventArgs.cs
+* GiveFeedbackEventHandler.cs
+* GridColumnStylesCollection.cs
+* GridItem.cs
+* GridItemCollection.cs
+* GridItemType.cs
+* GridTableStylesCollection.cs
+* GroupBox.cs
+* Help.cs
+* HelpEventArgs.cs
+* HelpEventHandler.cs
+* HelpNavigator.cs
+* HelpProvider.cs
+* HorizontalAlignment.cs
+* HScrollBar.cs
+* IButtonControl.cs
+* ICommandExecutor.cs
+* IComponentEditorPageSite.cs
+* IContainerControl.cs
+* IDataGridColumnStyleEditingNotificationService.cs
+* IDataGridEditingService.cs
+* IDataObject.cs
+* IFeatureSupport.cs
+* IFileReaderService.cs
+* ImageIndexConverter.cs
+* ImageList.cs
+* ImageListStreamer.cs
+* ImeMode.cs
+* IMessageFilter.cs
+* InputLanguage.cs
+* InputLanguageChangedEventArgs.cs
+* InputLanguageChangedEventHandler.cs
+* InputLanguageChangingEventArgs.cs
+* InputLanguageChangingEventHandler.cs
+* InputLanguageCollection.cs
+* InvalidateEventArgs.cs
+* InvalidateEventHandler.cs
+* ItemActivation.cs
+* ItemBoundsPortion.cs
+* ItemChangedEventArgs.cs
+* ItemChangedEventHandler.cs
+* ItemCheckEventArgs.cs
+* ItemCheckEventHandler.cs
+* ItemDragEventArgs.cs
+* ItemDragEventHandler.cs
+* IWin32Window.cs
+* IWindowTarget.cs
+* KeyEventArgs.cs
+* KeyEventHandler.cs
+* KeyPressEventArgs.cs
+* KeyPressEventHandler.cs
+* Keys.cs
+* KeysConverter.cs
+* Label.cs
+* LabelEditEventArgs.cs
+* LabelEditEventHandler.cs
+* LayoutEventArgs.cs
+* LayoutEventHandler.cs
+* LeftRightAlignment.cs
+* LinkArea.cs
+* LinkBehavior.cs
+* LinkClickedEventArgs.cs
+* LinkClickedEventHandler.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventArgs.cs
+* LinkLabelLinkClickedEventHandler.cs
+* LinkState.cs
+* ListBindingConverter.cs
+* ListBox.cs
+* ListControl.cs
+* ListView.cs
+* ListViewAlignment.cs
+* ListViewItem.cs
+* ListViewItemConverter.cs
+* MainMenu.cs
+* MdiLayout.cs
+* MeasureItemEventArgs.cs
+* MeasureItemEventHandler.cs
+* Menu.cs
+* MenuGlyph.cs
+* MenuItem.cs
+* MenuMerge.cs
+* Message.cs
+* MessageBox.cs
+* MessageBoxButtons.cs
+* MessageBoxDefaultButton.cs
+* MessageBoxIcon.cs
+* MessageBoxOptions.cs
+* MethodInvoker.cs
+* MonthCalendar.cs
+* MouseButtons.cs
+* MouseEventArgs.cs
+* MouseEventHandler.cs
+* NativeWindow.cs
+* NavigateEventArgs.cs
+* NavigateEventHandler.cs
+* NodeLabelEditEventArgs.cs
+* NodeLabelEditEventHandler.cs
+* NotifyIcon.cs
+* NumericUpDown.cs
+* OpacityConverter.cs
+* OpenFileDialog.cs
+* Orientation.cs
+* OSFeature.cs
+* PageSetupDialog.cs
+* PaintEventArgs.cs
+* PaintEventHandler.cs
+* Panel.cs
+* PictureBoxSizeMode.cs
+* PrintControllerWithStatusDialog.cs
+* PrintDialog.cs
+* PrintPreviewControl.cs
+* PrintPreviewDialog.cs
+* ProgressBar.cs
+* PropertyGrid.cs
+* PropertyManager.cs
+* PropertySort.cs
+* PropertyTabChangedEventArgs.cs
+* PropertyTabChangedEventHandler.cs
+* PropertyValueChangedEventArgs.cs
+* PropertyValueChangedEventHandler.cs
+* QueryAccessibilityHelpEventArgs.cs
+* QueryAccessibilityHelpEventHandler.cs
+* QueryContinueDragEventArgs.cs
+* QueryContinueDragEventHandler.cs
+* RadioButton.cs
+* RichTextBox.cs
+* RichTextBoxFinds.cs
+* RichTextBoxScrollBars.cs
+* RichTextBoxSelectionAttribute.cs
+* RichTextBoxSelectionTypes.cs
+* RichTextBoxStreamType.cs
+* RichTextBoxWordPunctuations.cs
+* RightToLeft.cs
+* SaveFileDialog.cs
+* Screen.cs
+* ScrollableControl.cs
+* ScrollBar.cs
+* ScrollBars.cs
+* ScrollButton.cs
+* ScrollEventArgs.cs
+* ScrollEventHandler.cs
+* ScrollEventType.cs
+* SecurityIDType.cs
+* SelectedGridItemChangedEventArgs.cs
+* SelectedGridItemChangedEventHandler.cs
+* SelectionMode.cs
+* SelectionRange.cs
+* SelectionRangeConverter.cs
+* SendKeys.cs
+* Shortcut.cs
+* SizeGripStyle.cs
+* SortOrder.cs
+* Splitter.cs
+* SplitterEventArgs.cs
+* SplitterEventHandler.cs
+* StatusBar.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarDrawItemEventHandler.cs
+* StatusBarPanel.cs
+* StatusBarPanelAutoSize.cs
+* StatusBarPanelBorderStyle.cs
+* StatusBarPanelClickEventArgs.cs
+* StatusBarPanelClickEventHandler.cs
+* StatusBarPanelCollection.cs
+* StatusBarPanelStyle.cs
+* StructFormat.cs
+* SystemInformation.cs
+* TabAlignment.cs
+* TabAppearance.cs
+* TabControl.cs
+* TabDrawMode.cs
+* TabPage.cs
+* TabSizeMode.cs
+* TextBox.cs
+* TextBoxBase.cs
+* ThreadExceptionDialog.cs
+* TickStyle.cs
+* Timer.cs
+* ToolBar.cs
+* ToolBarAppearance.cs
+* ToolBarButton.cs
+* ToolBarButtonClickEventArgs.cs
+* ToolBarButtonClickEventHandler.cs
+* ToolBarButtonStyle.cs
+* ToolBarTextAlign.cs
+* ToolTip.cs
+* TrackBar.cs
+* TreeNode.cs
+* TreeNodeCollection.cs
+* TreeNodeConverter.cs
+* TreeView.cs
+* TreeViewAction.cs
+* TreeViewCancelEventArgs.cs
+* TreeViewCancelEventHandler.cs
+* TreeViewEventArgs.cs
+* TreeViewEventHandler.cs
+* TreeViewImageIndexConverter.cs
+* UICues.cs
+* UICuesEventArgs.cs
+* UICuesEventHandler.cs
+* UpDownBase.cs
+* UpDownEventArgs.cs
+* UpDownEventHandler.cs
+* UserControl.cs
+* View.cs
+* VScrollBar.cs
+* Monostyled everything!
+
+
+
+2002-7-7 DennisHayes <dennish@raytek.com>
+
+* AccessibleObject.cs
+* AmbientProperties.cs
+* AxHost.cs
+* BindingsCollection.cs
+* Button.cs
+* ButtonBase.cs
+* ChangeLog
+* CheckBox.cs
+* CheckedListBox.cs
+* ColorDialog.cs
+* ComboBox.cs
+* CommonDialog.cs
+* ContainerControl.cs
+* ContextMenu.cs
+* ControlEventArgs.cs
+* CurrencyManager.cs
+* DataGrid.cs
+* DataGridBoolColumn.cs
+* DataGridColumnStyle.cs
+* DataGridTableStyle.cs
+* DataGridTextBox.cs
+* DataGridTextBoxColumn.cs
+* DateTimePickerFormat.cs
+* ErrorProvider.cs
+* FileDialog.cs
+* FontDialog.cs
+* Form.cs
+* GroupBox.cs
+* HelpProvider.cs
+* HScrollBar.cs
+* ImageList.cs
+* KeyPressEventHandler.cs
+* Label.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventArgs.cs
+* ListBox.cs
+* ListControl.cs
+* ListView.cs
+* logfile.txt
+* MainMenu.cs
+* Menu.cs
+* MenuItem.cs
+* MonthCalendar.cs
+* NotifyIcon.cs
+* OpenFileDialog.cs
+* PageSetupDialog.cs
+* Panel.cs
+* PrintDialog.cs
+* PropertyManager.cs
+* RadioButton.cs
+* RichTextBox.cs
+* SaveFileDialog.cs
+* ScrollableControl.cs
+* ScrollBar.cs
+* Splitter.cs
+* StatusBar.cs
+* StatusBarPanel.cs
+* TabControl.cs
+* TabPage.cs
+* TextBox.cs
+* TextBoxBase.cs
+* ThreadExceptionDialog.cs
+* Timer.cs
+* ToolBar.cs
+* ToolBarButton.cs
+* TrackBar.cs
+* TreeView.cs
+* UpDownBase.cs
+* VScrollBar.cs
+* Uncommented stuff, re-commented stuff, adding usings, fixed minor syntax errors.
+
+2002-7-6 DennisHayes <dennish@raytek.com>
+
+* DragEventArgs.cs
+* PropertyValueChangedEventArgs.cs
+* InputLanguageChangedEventArgs.cs
+* added files
+
+2002-7-6 DennisHayes <dennish@raytek.com>
+
+* ToolBarButtonClickEventArgs.cs
+* UpDownEventArgs.cs
+* PropertyValueChangedEventArgs.c
+* Added new files
+
+2002-7-6 DennisHayes <dennish@raytek.com>
+
+* AccessibleObject.cs
+* AmbientProperties.cs
+* Application.cs
+* ApplicationContext.cs
+* AxHost.cs
+* BaseCollection.cs
+* Binding.cs
+* BindingContext.cs
+* BindingManagerBase.cs
+* BindingsCollection.cs
+* CaptionButton.cs
+* Clipboard.cs
+* ColumnHeader.cs
+* Control.cs
+* ControlBindingsCollection.cs
+* ControlPaint.cs
+* CreateParams.cs
+* CurrencyManager.cs
+* Cursor.cs
+* CursorConverter.cs
+* Cursors.cs
+* DataFormats.cs
+* DataGridPreferredColumnWidthTypeConverter.cs
+* DataGridTextBoxColumn.cs
+* DataObject.cs
+* DateBoldEventArgs.cs
+* DateTimePicker.cs
+* DomainUpDown.cs
+* FeatureSupport.cs
+* FontDialog.cs
+* Form.cs
+* GridColumnStylesCollection.cs
+* GridItemCollection.cs
+* GridTableStylesCollection.cs
+* Help.cs
+* IButtonControl.cs
+* IFileReaderService.cs
+* ImageIndexConverter.cs
+* ImageListStreamer.cs
+* IMessageFilter.cs
+* InputLanguage.cs
+* InputLanguageChangeEventArgs.cs
+* InputLanguageCollection.cs
+* ItemChangedEventArgs.cs
+* KeyEventArgs.cs
+* KeyPressEventArgs.cs
+* KeysConverter.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventArgs.cs
+* LinkLabelLinkClickedEventHandler.cs
+* ListBindingConverter.cs
+* ListViewItem.cs
+* ListViewItemConverter.cs
+* logfile.txt
+* MessageBox.cs
+* NativeWindow.cs
+* NumericUpDown.cs
+* OpacityConverter.cs
+* OSFeature.cs
+* PaintEventArgs.cs
+* PrintControllerWithStatusDialog.cs
+* PropertyGrid.cs
+* PropertyTabChangedEventArgs.cs
+* PropertyTabChangedEventHandler.cs
+* PropertyValueChangedEventArgs.cs
+* Screen.cs
+* ScrollEventArgs.cs
+* SelectionRange.cs
+* SelectionRangeConverter.cs
+* SendKeys.cs
+* SplitterEventArgs.cs
+* StatusBarPanelClickEventArgs.cs
+* StatusBarPanelCollection.cs
+* SystemInformation.cs
+* ToolBarButtonClickEventArgs.cs
+* ToolTip.cs
+* TreeNode.cs
+* TreeNodeCollection.cs
+* TreeNodeConverter.cs
+* TreeViewCancelEventArgs.cs
+* TreeViewImageIndexConverter.cs
+* UICuesEventArgs.cs
+* UpDownBase.cs
+* UpDownEventArgs.cs
+* UserControl.cs
+* Added usings, corrected minor syntax errors, uncommented some stuff to flush out compile errors.
+
+2002-7-3 DennisHayes <dennish@raytek.com>
+
+* AccessibleObject.cs
+* Application.cs
+* AxHost.cs
+* Button.cs
+* Control.cs
+* Form.cs
+* GridColumnStylesCollection.cs
+* GridItemCollection.cs
+* GridTableStylesCollection.cs
+* ImageIndexConverter.cs
+* ImageListStreamer.cs
+* InputLanguageChangingEventArgs.cs
+* KeysConverter.cs
+* Label.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventArgs.cs
+* ListBox.cs
+* ListView.cs
+* ListViewItem.cs
+* ListViewItemConverter.cs
+* Menu.cs
+* NumericUpDown.cs
+* ScrollableControl.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanel.cs
+* StatusBarPanelCollection.cs
+* TabControl.cs
+* TrackBar.cs
+* TreeNodeCollection.cs
+* added usings, minor syntax corrections.
+
+2002-7-3 DennisHayes <dennish@raytek.com>
+* checked in for Jaak Simm (jaaksimm@firm.ee)
+* PrintPreviewControl.cs
+* PrintPreviewDialog.cs
+* ProgressBar.cs
+* PropertyGrid.cs
+* PropertyManager.cs
+* PropertyTabChangedEventArgs.cs
+* new files added
+
+2002-7-2 DennisHayes <dennish@raytek.com>
+* Application.cs
+* ControlEventArgs.cs
+* Form.cs
+* merged changes made by miguel and hestilow in gkt# to system.windows.forms
+
+2002-7-2 DennisHayes <dennish@raytek.com>
+* Button.cs
+* ButtonBase.cs
+* ContainerControl.cs
+* Label.cs
+* ScrollableControl.cs
+* Copied changes made by miguel and hestilow in gkt# to system.windows.forms
+
+2002-7-2 DennisHayes <dennish@raytek.com>
+* Checked in for Richard Baumann (biochem333@nyc.rr.com)
+* DataGridTextBoxColumn.cs
+* DataObject.cs
+* DateBoldEventArgs.cs
+* DateRangeEventArgs.cs
+* DateTimePicker.cs
+* DomainUpDown.cs
+* DragEventArgs.cs
+* DrawItemEventArgs.cs
+* added new files
+
+2002-7-2 DennisHayes <dennish@raytek.com>
+* checked in for Jaak Simm (jaaksimm@firm.ee)
+* DataFormats.cs
+* DataGrid.cs
+* DataGridBoolColumn.cs
+* DataGridColumnStyle.cs
+* DataGridPreferredColumnWidthTypeConverter.cs
+* DataGridTableStyle.cs
+* DataGridTextBox.cs
+* new classes added
+
+2002-7-2 DennisHayes <dennish@raytek.com>
+* Checked in for Richard Baumann (biochem333@nyc.rr.com)
+* StatusBar.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanel.cs
+* StatusBarPanelClickEventArgs.cs
+* SystemInformation.cs
+* Minor changes by Rich B
+
+2002-7-1 DennisHayes <dennish@raytek.com>
+
+* AccessibleObject.cs
+* AmbientProperties.cs
+* Application.cs
+* ApplicationContext.cs
+* ArrangeDirection.cs
+* AxHost.cs BaseCollection.cs
+* Binding.cs BindingContext.cs
+* BindingManagerBase.cs
+* BindingMemberInfo.cs
+* BindingsCollection.cs
+* Button.cs
+* ButtonBase.cs
+* CheckBox.cs
+* CheckedListBox.cs
+* Clipboard.cs
+* ColorDialog.cs
+* ColumnClickEventArgs.cs
+* ColumnClickEventHandler.cs
+* ColumnHeader.cs
+* ComboBox.cs
+* CommonDialog.cs
+* ComVisible.cs
+* ContainerControl.cs
+* ContentsResizedEventArgs.cs
+* ContextMenu.cs
+* Control.cs
+* ControlBindingsCollection.cs
+* ControlEventArgs.cs
+* ControlPaint.cs
+* ConvertEventArgs.cs
+* CreateParams.cs
+* CurrencyManager.cs
+* Cursor.cs
+* CursorConverter.cs
+* Cursors.cs
+* ErrorProvider.cs
+* FeatureSupport.cs
+* FileDialog.cs
+* Form.cs
+* GiveFeedbackEventArgs.cs
+* GridColumnStylesCollection.cs
+* GridItem.cs
+* GridItemCollection.cs
+* GridTableStylesCollection.cs
+* GroupBox.cs
+* Help.cs
+* HelpEventArgs.cs
+* HelpProvider.cs
+* HScrollBar.cs
+* ImageIndexConverter.cs
+* ImageList.cs
+* ImageListStreamer.cs
+* InputLanguage.cs
+* InputLanguageChangedEventArgs.cs
+* InputLanguageChangingEventArgs.cs
+* InputLanguageCollection.cs
+* InvalidateEventArgs.cs
+* ItemChangedEventArgs.cs
+* ItemCheckEventArgs.cs
+* ItemDragEventArgs.cs
+* IWin32Window.cs
+* KeyEventArgs.cs
+* KeyPressEventArgs.cs
+* KeysConverter.cs
+* Label.cs
+* LabelEditEventArgs.cs
+* LabelEditEventHandler.cs
+* LayoutEventArgs.cs
+* LinkClickedEventArgs.cs
+* LinkLabel.cs
+* LinkLabelLinkClickedEventArgs.cs
+* ListBindingConverter.cs
+* ListBox.cs
+* ListControl.cs
+* ListView.cs
+* ListViewItem.cs
+* ListViewItemConverter.cs
+* MainMenu.cs
+* MeasureItemEventArgs.cs
+* Menu.cs MenuItem.cs
+* Message.cs
+* MessageBox.cs
+* MonthCalendar.cs
+* MouseEventArgs.cs
+* NativeWindow.cs
+* NavigateEventArgs.cs
+* NodeLabelEditEventArgs.cs
+* NotifyIcon.cs
+* NumericUpDown.cs
+* OpacityConverter.cs
+* OpenFileDialog.cs
+* OSFeature.cs
+* PageSetupDialog.cs
+* PaintEventArgs.cs
+* Panel.cs
+* PrintControllerWithStatusDialog.cs
+* PrintDialog.cs
+* QueryAccessibilityHelpEventArgs.cs
+* QueryContinueDragEventArgs.cs
+* RadioButton.cs
+* RichTextBox.cs
+* SaveFileDialog.cs
+* Screen.cs
+* ScrollableControl.cs
+* ScrollBar.cs
+* ScrollEventArgs.cs
+* SelectedGridItemChangedEventArgs.cs
+* SelectionRange.cs
+* SelectionRangeConverter.cs
+* SendKeys.cs
+* Splitter.cs
+* SplitterEventArgs.cs
+* StatusBar.cs
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanel.cs
+* StatusBarPanelClickEventArgs.cs
+* StatusBarPanelCollection.cs
+* SystemInformation.cs
+* TabControl.cs
+* TabPage.cs
+* TextBox.cs
+* TextBoxBase.cs
+* ThreadExceptionDialog.cs
+* Timer.cs
+* ToolBar.cs
+* ToolBarButton.cs
+* TrackBar.cs
+* TreeNode.cs
+* TreeNodeCollection.cs
+* TreeNodeConverter.cs
+* TreeView.cs
+* TreeViewCancelEventArgs.cs
+* TreeViewEventArgs.cs
+* TreeViewImageIndexConverter.cs
+* UICuesEventArgs.cs
+* UserControl.cs
+* VScrollBar.cs
+* Implmented some stuff, fixed some stuff, monostyled some stuff, uncommented-out some stuff.
+
+
+2002-7-1 DennisHayes <dennish@raytek.com>
+* changelog
+* reversed order, putting most recent entries at the top
+
+2002-6-24 DennisHayes <dennish@raytek.com>
+* AccessibleStates.cs
+* ArrangeDirection.cs
+* AccessibleEvents.cs
+* Added values for enums
+
+2002-6-24 DennisHayes <dennish@raytek.com>
+* BindingMemberInfo.cs
+* CaptionButton.cs
+* DataGridCell.cs
+* Message.cs
+* MessageBox.cs
+* Fixed bugs preventing compile
+
+2002-6-18 DennisHayes <dennish@raytek.com>
+* checked in for Stefan Warnke (StefanW@POBox.com)
+* UICuesEventArgs.cs
+* UpDownBase.cs
+* Better comments and formatting
+
+2002-6-18 DennisHayes <dennish@raytek.com>
+* Checked in for Jackson Harper (jackson@latitudegeo.com)
+* ToolBar.cs
+* TabControl.cs
+* TabPage.cs
+* Added sub classes
+
+2002-6-5 DennisHayes <dennish@raytek.com>
+* TabControl.cs
+* TabPage.cs
+* TextBox.cs
+* TextBoxBase.cs
+* ThreadExceptionDialog.cs
+* Timer.cs
+* added new files for Jackson Harper (jackson@latitudegeo.com)
+* needs to be mono styled, and may have other issues
+
+2002-6-5 DennisHayes <dennish@raytek.com>
+* ErrorProvider.cs
+* PrintControllerWithStatusDialog.cs
+* PrintDialog.cs
+* added new files for paul
+
+2002-6-5 DennisHayes <dennish@raytek.com>
+* StatusBarDrawItemEventArgs.cs
+* StatusBarPanel.cs
+* StatusBarPanelClickEventArgs.cs
+* StatusBarPanelCollection.cs
+* SystemInformation.cs
+* added new files for Richard Baumann (biochem333@nyc.rr.com)
+
+2002-6-5 DennisHayes <dennish@raytek.com>
+* removed, code moved to main class files, Form.cs, ImageList.cs, LinkLabel.cs,
+* ListBox.cs, ListView.cs, ListViewItem.cs, Menu.cs, MonthCalendar.cs, ScrollableControl.cs
+* Form.ControlCollectison.cs
+* ImageList.ImageCollection.c
+* LinkLabel.LinkCollection.cs
+* ListBox.ObjectCollection.cs
+* ListBox.SelectedIndexCollection.cs
+* ListBox.SelectedObjectCollection.cs
+* ListView.CheckedListViewItemCollection.cs
+* ListView.CheckedIndexCollection.cs
+* ListView.ColumnHeaderCollection.cs
+* ListView.ListViewItemCollection.cs
+* ListView.SelectedIndexCollection.cs
+* ListView.SelectedListViewItemCollection.cs
+* ListViewItem.ListViewSubItem.cs
+* ListViewItem.ListViewSubItemCollection.cs
+* Menu.MenuItemCollection.cs
+* MonthCalendar.HitTestInfo.cs
+* ScrollableControl.DockPaddingEdges.cs
+
+2002-6-5 DennisHayes <dennish@raytek.com>
+* Checked in for Jackson Harper (jackson@latitudegeo.com)
+* ToolBar.cs
+* ToolBarButton.cs
+* ToolTip.cs
+* TrackBar.cs
+* TreeNode.cs
+* TreeNodeCollection.cs
+* TreeNodeConverter.cs
+* TreeView.cs
+* TreeViewCancelEventArgs.cs
+* TreeViewEventArgs.cs
+* TreeViewImageIndexConverter.cs
+* Just stubbs
+* New files added, work in progress cleanup and mono style needed.
+
+2002-6-5 DennisHayes <dennish@raytek.com>
+* checked in for Stefan Warnke (StefanW@POBox.com)
+* UICuesEventArgs.cs
+* UpDownBase.cs
+* Just stubbs
+* New files, work in progress, needs cleanup and mono style
+
+
+
+2002-5-31 DennisHayes <dennish@raytek.com>
+* ItemChangedEventHandler.cs
+* InvalidateEventHandler.cs
+* ItemChangedEventHandler.cs
+* added new files
+
+2002-5-31 DennisHayes <dennish@raytek.com>
+ Check in for Paul Osman <paul.osman@sympatico.ca>
+* Panel.cs
+* New class, Stubbed and commented out
+
+2002-5-31 DennisHayes <dennish@raytek.com>
+ Check in for Paul Osman <paul.osman@sympatico.ca>
+* MonthCalendar.cs
+* MonthCalendar.HitTestInfo.cs
+* MouseEventArgs.cs
+* NativeWindow.cs
+* Removed trash byte
+
+2002-5-31 DennisHayes <dennish@raytek.com>
+* ColumnClickEventArgs.cs
+* Fully implmented.
+
+2002-5-31 DennisHayes <dennish@raytek.com>
+* Minor formating in lots of files
+
+
+2002-5-27 DennisHayes <dennish@raytek.com>
+Added structs. All structs in System.Windows.Forms done
+* BindingMemberInfo.cs
+* DataGridCell.cs
+* LinkArea.cs
+* Message.cs
+* Complete execpt for Message.cs GetLParam
+* and
+* BindingMemberInfo needs constructor.
+* All need verification of hashcodes.
+
+2002-5-27 DennisHayes <dennish@raytek.com>
+Added delegates. All delegates in System.Windows.Forms done
+* ColumnClickEventHandler.cs
+* ContentsResizedEventHandler.cs
+* ControlEventHandler.cs
+* ConvertEventHandler.cs
+* DateRangeEventHandler.cs
+* DragEventHandler.cs
+* DrawItemEventHandler.cs
+* GiveFeedbackEventHandler.cs
+* HelpEventHandler.cs
+* InputLanguageChangedEventHandler.cs
+* InputLanguageChangingEventHandler.cs
+* InvalidateEventHandler.cs
+* ItemChangedEventHandler.cs
+* ItemCheckEventHandler.cs
+* ItemDragEventHandler.cs
+* KeyEventHandler.cs
+* LabelEditEventHandler.cs
+* LayoutEventHandler.cs
+* LinkClickedEventHandler.cs
+* LinkLabelLinkClickedEventHandler.cs
+
+2002-5-27 DennisHayes <dennish@raytek.com>
+ Check in for Paul Osman <paul.osman@sympatico.ca>
+* NumericUpDown.cs
+* OpacityConverter.cs
+* OpenFileDialog.cs
+* OSFeature.cs
+* PageSetupDialog.cs
+* PaintEventArgs.cs
+* MonthCalendar.HitTestInfo.cs
+* MouseEventArgs.cs
+* NativeWindow.cs
+* Stubbed and commented out
+* NativeWindow.cs, MonthCalendar.HitTestInfo.cs, MouseEventArgs.cs,
+* have bad extra byte from old skeleton, need new corrected version.
+* MonthCalendar.HitTestInfo.cs needs to be incorporated into MonthCalendar.
+
+2002-5-27 DennisHayes <dennish@raytek.com>
+ Check in for Paul Osman <paul.osman@sympatico.ca>
+* Menu.cs
+* Menu.MenuItemCollection.cs
+* MenuItem.cs
+* MessageBox.cs
+* MonthCalendar.cs
+* Stubbed and commented out
+* MonthCalendar.cs has bad extra byte from old skeleton, need new corrected version.
+* MonthCalendar.HitTestInfo.cs needs to be incorporated into MonthCalendar.
+* Menu.MenuItemCollection.cs needs to be incorporated into Menu.cs.
+
+2002-5-27 DennisHayes <dennish@raytek.com>
+ Check in for Paul Osman <paul.osman@sympatico.ca>
+* Panel.cs
+* New class, Stubbed and commented out
+
+2002-5-10 Dennis Hayes
+* added IMessageFilter
+* Interfaces complete
+
+ 2002-5-8 Dennis Hayes <dennish@raytek.com>
+* RichTextBoxFinds.cs
+* RichTextBoxScrollBars.cs
+* RichTextBoxSelectionAttribute.cs
+* RichTextBoxSelectionTypes.cs
+* RichTextBoxStreamType.cs
+* RichTextBoxWordPunctuations.cs
+* RightToLeft.cs
+* ScrollBars.cs
+* ScrollButton.cs
+* ScrollEventType.cs
+* SecurityIDType.cs
+* SelectionMode.cs
+* Shortcut.cs
+* SizeGripStyle.cs
+* SortOrder.cs
+* StatusBarPanelAutoSize.cs
+* StatusBarPanelBorderStyle.cs
+* StatusBarPanelStyle.cs
+* StructFormat.cs
+* TabAlignment.cs
+* TabAppearance.cs
+* TabDrawMode.cs
+* TabSizeMode.cs
+* TickStyle.cs
+* ToolBarAppearance.cs
+* ToolBarButtonStyle.cs
+* ToolBarTextAlign.cs
+* TreeViewAction.cs
+* UICues.cs
+* View.cs
+* Added enums.
+* All System.Windows.Forms enums complete with correct values.
+ 2002-5-8 Dennis Hayes <dennish@raytek.com>
+Dennis Hayes <dennish@raytek.com>
+Checking in new System.Windows.forms classes (a* to c*) for
+Jaak Simm <jaaksimm@firm.ee>
+* AmbientProperties.cs
+* Application.cs
+* ApplicationContext.cs
+* AxHost.cs
+* BaseCollection.cs
+* Binding.cs
+* BindingContext.cs
+* BindingManagerBase.cs
+* BindingsCollection.cs
+* Button.cs
+* ButtonBase.cs
+* CheckBox.cs
+* CheckedListBox.cs
+* Clipboard.cs
+* ColorDialog.cs
+* ColumnClickEventArgs.cs
+* ColumnHeader.cs
+* ComboBox.cs
+* CommonDialog.cs
+* ContainerControl.cs
+* ContentsResizedEventArgs.cs
+* ContextMenu.cs
+* Control.cs
+* ControlBindingsCollection.cs
+* ControlEventArgs.cs
+* ControlPaint.cs
+* ConvertEventArgs.cs
+* CreateParams.cs
+* CurrencyManager.cs
+* Cursor.cs
+* CursorConverter.cs
+* Cursors.cs
+* Classes stubbed and commented out.
+
+ 2002-5-8 Dennis Hayes <dennish@raytek.com>
+Dennis Hayes <dennish@raytek.com>
+Checking in new System.Windows.forms classe for John Rebbeck <john@rebent.com>
+
+* UserControl.cs
+Stubbed and commented out
+
+ 2002-5-8 Dennis Hayes <dennish@raytek.com>
+Dennis Hayes <dennish@raytek.com>
+Checking in new System.Windows.forms classe for Paul Osman <paul.osmand@sympatico.ca>
+
+* NavigateEventArgs.cs
+* NodeLabelEditEventArgs.cs
+* NotifyIcon.cs
+Stubbed and commented out
+
+2002-05-07 Daniel Carrera (dcarrera@math.utoronto.ca)
+* Fixed a problem with an "extra byte" problem. It caused an extra '?'
+ at the beginning of some lines.
+ Classes F-L and Q-R were updated.
+* Added the classes SaveFileDialog.cs and Screen.cs
+
+2002-5-7 Dennis Hayes <dennish@raytek.com>
+* Added duplicate values
+* System.Windows.Forms.Keys.cs
+
+2002-5-7 Dennis Hayes <dennish@raytek.com>
+* LeftRightAlignment.cs
+* LinkBehavior.cs
+* LinkState.cs
+* ListViewAlignment.cs
+* MdiLayout.cs
+* MenuGlyph.cs
+* MenuMerge.cs
+* MessageBoxButtons.cs
+* MessageBoxDefaultButton.cs
+* MessageBoxIcon.cs
+* MessageBoxOptions.cs
+* MouseButtons.cs
+* Orientation.cs
+* PictureBoxSizeMode.cs
+* PropertySort.cs
+* Added some more enums. All have correct values.
+
+* 5-5-2002 Dennis Hayes <dennish@raytek.com>
+* Added enums
+* GridItemType.cs
+* HelpNavigator.cs
+* HorizontalAlignment.cs
+* ImeMode.cs
+* ItemActivation.cs
+* ItemBoundsPortion.cs
+* Keys.cs
+* All correct execpt for Keys.cs which is missing a half dozen
+* duplicate entries that need correcting.
+
+2002-05-02 Daniel Carrera (dcarrera@math.utoronto.ca)
+* small update to classes [F-H]*
+* added stubbed and commented out classes for [I-L]*
+* added stubbed and commented out classes for R*
+2002-4-23 Dennis Hayes <dennish@raytek.com>
+
+ * AccessibleNavigation.cs :added to cvs with bad enum values, I will correct.
+ * AccessibleSelection.cs :added with good enum values.
+ * ContentsResizedEventHandler.cs :Added delagate
+ * MainMenu.cs
+ * AccessibleObject.cs
+ * MeasureItemEventArgs :added stubbed classes. Commented out.
+ * IButtonControl.cs : Added interface.
+2002-4-23 Dennis Hayes <dennish@raytek.com>
+* added stubbed and commented out classes from F to G *
+
+
+2002-04-10 Duncan Mak <duncan@ximian.com>
+
+ * CaptionButton.cs:
+ * CharacterCasing.cs:
+ * CheckState.cs:
+ * DataGridParentRowsLabelStyle.cs:
+ * DialogResult.cs:
+ * DockStyle.cs:
+ * DragAction.cs:
+ * DragDropEffects.cs:
+ * DrawItemState.cs:
+ * DrawMode.cs:
+ * ErrorBlinkStyle.cs:
+ * ErrorIconAlignment.cs:
+ * FlatStyle.cs:
+ * FormBorderStyle.cs:
+ * FormStartPosition.cs:
+ * FormWindowState.cs:
+ * FrameStyle.cs: Fixed enum layouts with EnumCheck.
+
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs
new file mode 100644
index 00000000000..f9b7a2a53df
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.CharacterCasing.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the case of characters in a TextBox control.
+ /// </summary>
+ public enum CharacterCasing {
+
+ //Values were verified with enumcheck.
+ Normal = 0,
+ Upper = 1,
+ Lower = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs
new file mode 100644
index 00000000000..92a92986754
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs
@@ -0,0 +1,194 @@
+//
+// System.Windows.Forms.CheckBox.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows check box.
+ /// </summary>
+
+ [MonoTODO]
+ public class CheckBox : ButtonBase {
+
+ // private fields
+ Appearance appearance;
+ bool autoCheck;
+ ContentAlignment checkAlign;
+ bool _checked;
+ CheckState checkState;
+ bool threeState;
+ ContentAlignment textAlign;
+
+ // --- Constructor ---
+ public CheckBox() : base()
+ {
+ appearance = Appearance.Normal;
+ autoCheck = true;
+ checkAlign = ContentAlignment.MiddleLeft;
+ _checked = false;
+ checkState = CheckState.Unchecked;
+ threeState = false;
+ textAlign = ContentAlignment.MiddleCenter;
+ }
+
+ // --- CheckBox Properties ---
+ public Appearance Appearance {
+ get { return appearance; }
+ set { appearance=value; }
+ }
+
+ public bool AutoCheck {
+ get { return autoCheck; }
+ set { autoCheck = value; }
+ }
+
+ public ContentAlignment CheckAlign {
+ get { return checkAlign; }
+ set { checkAlign=value; }
+ }
+
+ public bool Checked {
+ get { return _checked; }
+ set { _checked=value; }
+ }
+
+ public CheckState CheckState {
+ get { return checkState; }
+ set { checkState = value; }
+ }
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "CHECKBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ (int)WindowStyles.WS_CHILD |
+ (int)WindowStyles.WS_VISIBLE | (int)SS_Static_Control_Types.SS_LEFT );
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get { return new Size(100,20); }
+ }
+
+ [MonoTODO]
+ public override ContentAlignment TextAlign {
+ get {
+ return textAlign;
+ }
+ set {
+ textAlign = value;
+ }
+ }
+
+ public bool ThreeState {
+ get { return threeState; }
+ set { threeState = value; }
+ }
+
+
+
+
+ // --- CheckBox methods ---
+
+ // I do not think this is part of the spec
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+
+ // [event methods]
+ [MonoTODO]
+ protected virtual void OnAppearanceChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnCheckedChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnCheckStateChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnClick(EventArgs e)
+ {
+ //FIXME:
+ base.OnClick(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseUp(e);
+ }
+ // end of [event methods]
+
+
+ [MonoTODO]
+ protected override bool ProcessMnemonic(char charCode)
+ {
+ //FIXME:
+ return base.ProcessMnemonic(charCode);
+ }
+
+ [MonoTODO]
+ //FIXME: do a better tostring
+ public override string ToString()
+ {
+ if(Checked){
+ return "CheckBox" + " Checked";
+ }
+ else{
+ return "CheckBox" + " Unchecked";
+ }
+ }
+
+ /// --- CheckBox events ---
+ public event EventHandler AppearanceChanged;
+ public event EventHandler CheckedChanged;
+ public event EventHandler CheckStateChanged;
+
+ /// --- public class CheckBox.CheckBoxAccessibleObject : ButtonBase.ButtonBaseAccessibleObject ---
+ /// the class is not stubbed, cause it's only used for .NET framework
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs
new file mode 100644
index 00000000000..a7bf2bc9208
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.CheckState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the state of a control, such as a check box,
+ /// that can be checked, unchecked, or set to an indeterminate state.
+ /// </summary>
+ public enum CheckState {
+
+ //Values were verified with enumcheck.
+ Unchecked = 0,
+ Checked = 1,
+ Indeterminate = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
new file mode 100644
index 00000000000..8e928338340
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
@@ -0,0 +1,538 @@
+//
+// System.Windows.Forms.CheckedListBox.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Denis hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Displays a ListBox in which a check box is displayed to the left of each item.
+ /// </summary>
+
+ [MonoTODO]
+ public class CheckedListBox : ListBox {
+
+ // private fields
+ private bool checkOnClick;
+ private bool threeDCheckBoxes;
+
+
+ // --- Constructor ---
+ public CheckedListBox() : base()
+ {
+ checkOnClick = false;
+ threeDCheckBoxes = true;
+ }
+
+ // --- CheckedListBox Properties ---
+ [MonoTODO]
+ public CheckedListBox.CheckedIndexCollection CheckedIndices {
+ get {
+ throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public CheckedListBox.CheckedItemCollection CheckedItems {
+ get {
+ throw new NotImplementedException (); }
+ }
+
+ public bool CheckOnClick {
+ get {
+ return checkOnClick;
+ }
+ set {
+ checkOnClick = value;
+ }
+ }
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "CHECKEDLISTBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ public override DrawMode DrawMode {
+ get {
+ //FIXME
+ return base.DrawMode;
+ }
+ set {
+ //FIXME
+ base.DrawMode = value;
+ }
+ }
+
+ [MonoTODO]
+ public override int ItemHeight {
+ get {
+ //FIXME
+ return base.ItemHeight;
+ }
+ set {
+ //FIXME
+ base.ItemHeight = value;
+ }
+ }
+
+ [MonoTODO]
+ public CheckedListBox.ObjectCollection Items {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public new object DataSource { // .NET V1.1 Beta. needs implmented
+ get { return base.DataSource; }
+ set { base.DataSource = value; }
+ }
+
+ [MonoTODO]
+ public new string DisplayMember { // .NET V1.1 Beta. needs implmented
+ get { return base.DisplayMember; }
+ set { base.DisplayMember = value; }
+ }
+
+ [MonoTODO]
+ public new string ValueMember { // .NET V1.1 Beta. needs implmented
+ get { return base.DisplayMember; }
+ set { base.DisplayMember = value; }
+ }
+
+ public override SelectionMode SelectionMode {
+ set {
+ if (value!=SelectionMode.One && value!=SelectionMode.None)
+ throw new ArgumentException();
+ base.SelectionMode=value;
+ }
+ }
+
+ public bool ThreeDCheckBoxes {
+ get { return threeDCheckBoxes; }
+ set { threeDCheckBoxes=value; }
+ }
+
+ // --- CheckedListBox methods ---
+ // following methods were not stubbed out, because they only support .NET framework:
+ // - protected virtual void OnItemCheck(ItemCheckEventArgs ice)
+ // - protected override void WmReflectCommand(ref Message m)
+
+ // I do not think this is part of the spec.
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+// [MonoTODO]
+// protected override ObjectCollection CreateItemCollection()
+// {
+// throw new NotImplementedException ();
+// }
+
+ [MonoTODO]
+ public bool GetItemChecked(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public CheckState GetItemCheckState(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [event methods]
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e)
+ {
+ //FIXME
+ base.OnBackColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnClick(EventArgs e)
+ {
+ //FIXME
+ base.OnClick(e);
+ }
+
+ [MonoTODO]
+ protected override void OnDrawItem(DrawItemEventArgs e)
+ {
+ //FIXME
+ base.OnDrawItem(e);
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME
+ base.OnFontChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME
+ base.OnHandleCreated(e);
+ }
+
+ // only supports .NET framework, thus is not stubbed out
+ /*
+ [MonoTODO]
+ protected virtual void OnItemCheck(ItemCheckEventArgs ice)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ [MonoTODO]
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ //FIXME
+ base.OnKeyPress(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMeasureItem(MeasureItemEventArgs e)
+ {
+ //FIXME
+ base.OnMeasureItem(e);
+ }
+
+ [MonoTODO]
+ protected override void OnSelectedIndexChanged(EventArgs e)
+ {
+ //FIXME
+ base.OnSelectedIndexChanged(e);
+ }
+ // end of [event methods]
+
+ [MonoTODO]
+ public void SetItemChecked(int index,bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetItemCheckState(int index,CheckState value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME
+ base.WndProc(ref m);
+ }
+
+
+
+
+ /// --- CheckedListBox events ---
+ /// following events are not stubbed out, because they only support .NET framework:
+ /// - public new event EventHandler Click;
+ /// - public new event DrawItemEventHandler DrawItem;
+ /// - public new event MeasureItemEventHandler MeasureItem;
+ public event ItemCheckEventHandler ItemCheck;
+
+
+
+
+ /// sub-class: CheckedListBox.CheckedIndexCollection
+ /// <summary>
+ /// Encapsulates the collection of indexes of checked items (including items in an indeterminate state) in a CheckedListBox.
+ /// </summary>
+ [MonoTODO]
+ public class CheckedIndexCollection : IList, ICollection, IEnumerable {
+
+
+ /// --- CheckedIndexCollection Properties ---
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int this[int index] {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// --- ICollection properties ---
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object IList.this[int index] {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+
+ /// --- CheckedIndexCollection Methods ---
+ /// Note: IList methods are stubbed out, otherwise does not IList interface cannot be implemented
+ [MonoTODO]
+ public bool Contains(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- CheckedIndexCollection.IList methods ---
+ [MonoTODO]
+ int IList.Add(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains(object index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf(object index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index,object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ } // --- end of CheckedListBox.CheckedIndexCollection ---
+
+
+
+
+ /// sub-class: CheckedListBox.CheckedItemCollection
+ /// <summary>
+ /// Encapsulates the collection of checked items (including items in an indeterminate state) in a CheckedListBox control.
+ /// </summary>
+ [MonoTODO]
+ public class CheckedItemCollection : IList, ICollection, IEnumerable {
+
+
+ /// --- CheckedItemCollection Properties ---
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int this[int index] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ /// --- ICollection properties ---
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object IList.this[int index] {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+
+
+ /// --- CheckedItemCollection Methods ---
+ /// Note: IList methods are stubbed out, otherwise IList interface cannot be implemented
+ [MonoTODO]
+ public bool Contains(int item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- CheckedItemCollection.IList methods ---
+ [MonoTODO]
+ int IList.Add(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains(object index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf(object index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index,object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ } // --- end of CheckedListBox.CheckedItemCollection ---
+
+ /// sub-class: CheckedListBox.ObjectCollection
+ /// <summary>
+ /// Represents the collection of items in a CheckedListBox.
+ /// </summary>
+
+ [MonoTODO]
+ public class ObjectCollection : ListBox.ObjectCollection {
+
+ /// --- ObjectCollection.constructor ---
+ [MonoTODO]
+ public ObjectCollection(CheckedListBox owner) :base(owner)
+ {
+
+ }
+
+ /// --- methods ---
+ [MonoTODO]
+ public int Add(object item,bool isChecked)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Add(object item,CheckState check)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Clipboard.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Clipboard.cs
new file mode 100644
index 00000000000..31ac48c977a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Clipboard.cs
@@ -0,0 +1,39 @@
+//
+// System.Windows.Forms.Clipboard.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides methods to place data on and retrieve data from the system Clipboard. This class cannot be inherited.
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class Clipboard {
+
+ // --- Methods ---
+ [MonoTODO]
+ public static IDataObject GetDataObject()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SetDataObject(object data)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void SetDataObject(object data,bool copy)
+ {
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDepth.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDepth.cs
new file mode 100644
index 00000000000..9115acf69ec
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDepth.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.ColorDepth.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ColorDepth {
+ Depth16Bit = 16,
+ Depth24Bit = 24,
+ Depth32Bit = 32,
+ Depth4Bit = 4,
+ Depth8Bit = 8
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs
new file mode 100644
index 00000000000..db83c153aad
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs
@@ -0,0 +1,140 @@
+//
+// System.Windows.Forms.ColorDialog.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a common dialog box that displays available colors along with controls that allow the user to define custom colors.
+ /// </summary>
+
+ [MonoTODO]
+ public class ColorDialog : CommonDialog {
+
+ // private fields
+ private bool allowFullOpen;
+ private bool anyColor;
+ private Color color;
+ private int[] customColors;
+ private bool fullOpen;
+ private bool showHelp;
+ private bool solidColorOnly;
+
+ /// --- Constructor ---
+ public ColorDialog() : base()
+ {
+ allowFullOpen = true;
+ anyColor = false;
+ color = Color.Black;
+ customColors = null;
+ fullOpen = false;
+ showHelp = false;
+ solidColorOnly = false;
+ }
+
+
+
+
+ /// --- Properties ---
+ /// following properties are not stubbed out, because they only support .NET framework
+ /// - protected virtual IntPtr Instance {get;}
+ /// - protected virtual int Options {get;}
+ public virtual bool AllowFullOpen {
+ get {
+ return allowFullOpen;
+ }
+ set {
+ allowFullOpen = value;
+ }
+ }
+
+ public virtual bool AnyColor {
+ get {
+ return anyColor;
+ }
+ set {
+ anyColor=value;
+ }
+ }
+
+ public Color Color {
+ get {
+ return color;
+ }
+ set {
+ color=value;
+ }
+ }
+
+ public int[] CustomColors {
+ get {
+ return customColors;
+ }
+ set {
+ customColors=value;
+ }
+ }
+
+ public virtual bool FullOpen {
+ get {
+ return fullOpen;
+ }
+ set {
+ fullOpen=value;
+ }
+ }
+
+ public virtual bool ShowHelp {
+ get {
+ return showHelp;
+ }
+ set {
+ showHelp=value;
+ }
+ }
+
+ public virtual bool SolidColorOnly {
+ get {
+ return solidColorOnly;
+ }
+ set {
+ solidColorOnly=value;
+ }
+ }
+
+ /// --- ColorDialog methods ---
+ [MonoTODO]
+ public override void Reset()
+ {
+ allowFullOpen = true;
+ anyColor = false;
+ color = Color.Black;
+ customColors = null;
+ fullOpen = false;
+ showHelp = false;
+ solidColorOnly = false;
+ }
+
+ [MonoTODO]
+ protected override bool RunDialog(IntPtr hwndOwner)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ //FIXME: do a better tostring
+ public override string ToString()
+ {
+ return "Color Dialog " + color.ToString();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs
new file mode 100644
index 00000000000..edbe6857ea4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs
@@ -0,0 +1,32 @@
+//
+// System.Windows.Forms.ColumnClickEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Implmented by Dennis Hayes <dennish@raytek.com>
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the ColumnClick event.
+ /// </summary>
+ public class ColumnClickEventArgs : EventArgs {
+
+ private int column;
+ /// --- Constructor ---
+ public ColumnClickEventArgs(int Column) : base()
+ {
+ column = Column;
+ }
+
+ /// --- Properties ---
+ public int Column {
+ get {
+ return column;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs
new file mode 100644
index 00000000000..356f95a6c70
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Windows.Forms.ColumnClickEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ColumnClickEventHandler(
+ object sender,
+ ColumnClickEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeader.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
new file mode 100644
index 00000000000..a4b6f4a137a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
@@ -0,0 +1,84 @@
+//
+// System.Windows.Forms.ColumnHeader.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Displays a single column header in a ListView control.
+ /// </summary>
+
+ [MonoTODO]
+ public class ColumnHeader : Component, ICloneable {
+
+ // private fields
+ string text;
+ HorizontalAlignment textAlign;
+ int width;
+ int index;
+ /// --- constructor ---
+ [MonoTODO]
+ public ColumnHeader() : base ()
+ {
+ text = null;
+ textAlign = HorizontalAlignment.Left;
+ width = -2;//default to autosize, not in spec
+ index = -1;//default to not in list
+ }
+
+ // --- Properties ---
+ [MonoTODO]
+ public int Index {
+ get { return index; }
+ }
+
+ [MonoTODO]
+ public ListView ListView {
+ //return parent control.
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Text {
+ get { return text; }
+ set { text = value; }
+ }
+
+ public HorizontalAlignment TextAlign {
+ get { return textAlign; }
+ set { textAlign = value; }
+ }
+
+ [MonoTODO]
+ public int Width {
+ get { return width; }
+ set { width = value; }
+ }
+
+ /// --- Methods ---
+ [MonoTODO]
+ public object Clone()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose(disposing);
+ }
+
+ public override string ToString()
+ {
+ //FIXME: add class specific info to the string
+ return "Column header " + text;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs
new file mode 100644
index 00000000000..29a98898d1e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.ColumnHeaderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ColumnHeaderStyle {
+ Clickable = 2,
+ Nonclickable = 1,
+ None = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ComVisible.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComVisible.cs
new file mode 100644
index 00000000000..d1dd601be28
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComVisible.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.ComVisible.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Enum |
+ AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Interface |
+ AttributeTargets.Delegate)]
+ public sealed class ComVisibleAttribute : Attribute {
+
+ private bool Visible = false;
+ public ComVisibleAttribute(bool value) {Visible = value;}
+ public bool Value { get {return Visible;} }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs
new file mode 100644
index 00000000000..eeaad94f94d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs
@@ -0,0 +1,672 @@
+//
+// System.Windows.Forms.ComboBox.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Collections;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows combo box control.
+ /// </summary>
+
+ [MonoTODO]
+ public class ComboBox : ListControl {
+
+ // private fields
+ DrawMode drawMode;
+ ComboBoxStyle dropDownStyle;
+ bool droppedDown;
+ bool integralHeight;
+ bool sorted;
+ Image backgroundImage;
+ ControlStyles controlStyles;
+ string text;
+ int selectedLength;
+ string selectedText;
+ int selectedIndex;
+ object selectedItem;
+ int selecedStart;
+
+ bool updateing; // true when begin update has been called. do not paint when true;
+ // --- Constructor ---
+ public ComboBox() : base()
+ {
+ selectedLength = 0;
+ selectedText = "";
+ selectedIndex = 0;
+ selectedItem = null;
+ selecedStart = 0;
+ updateing = false;
+ //controlStyles = null;
+ drawMode = DrawMode.Normal;
+ dropDownStyle = ComboBoxStyle.DropDown;
+ droppedDown = false;
+ integralHeight = true;
+ sorted = false;
+ backgroundImage = null;
+ text = "";
+
+ }
+
+ // --- Properties ---
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ }
+ set {
+ if(BackColor.A != 255){
+ if(
+ (controlStyles & ControlStyles.SupportsTransparentBackColor) !=
+ ControlStyles.SupportsTransparentBackColor
+ ){
+ throw new
+ ArgumentOutOfRangeException("BackColor", BackColor, "Transparant background color not allowed.");
+ }
+ }
+ base.BackColor = value;
+ }
+ }
+
+ public override Image BackgroundImage {
+ get {
+ return backgroundImage;
+ }
+ set {
+ backgroundImage = value;
+ }
+ }
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "COMBOBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(121,21);//correct size
+ }
+ }
+
+ public DrawMode DrawMode {
+ get {
+ return drawMode;
+ }
+ set {
+ drawMode = value;
+ }
+ }
+
+ public ComboBoxStyle DropDownStyle {
+ get {
+ return dropDownStyle;
+ }
+ set {
+ dropDownStyle = value;
+ }
+ }
+
+ [MonoTODO]
+ public int DropDownWidth {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public bool DroppedDown {
+ get {
+ return droppedDown;
+ }
+ set {
+ droppedDown = value;
+ }
+ }
+
+ [MonoTODO]
+ public override bool Focused {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public bool IntegralHeight {
+ get {
+ return integralHeight;
+ }
+ set {
+ integralHeight=value;
+ }
+ }
+
+ [MonoTODO]
+ public int ItemHeight {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public ComboBox.ObjectCollection Items {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int MaxDropDownItems {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int MaxLength {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int PreferredHeight {
+ get {
+ return 20; //FIXME: this is the default, good as any?
+ }
+ }
+
+ [MonoTODO]
+ public override int SelectedIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public object SelectedItem {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public string SelectedText {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int SelectionLength {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int SelectionStart {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public bool Sorted {
+ get {
+ return sorted;
+ }
+ set {
+ sorted = value;
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get {
+ return text;
+ }
+ set {
+ text = value;
+ }
+ }
+
+
+
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ [MonoTODO]
+ protected override void OnSelectedValueChanged(EventArgs e){ // .NET V1.1 Beta
+ //FIXME:
+ base.OnSelectedValueChanged(e);
+ }
+
+ /// - protected override void SetItemCore(int index,object value);
+ [MonoTODO]
+ protected virtual void AddItemsCore(object[] value) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void BeginUpdate()
+ {
+ updateing = true;
+ }
+
+ [MonoTODO]
+ public void EndUpdate()
+ {
+ updateing = false;
+ }
+
+ [MonoTODO]
+ public int FindString(string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int FindString(string s,int startIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int FindStringExact(string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int FindStringExact(string s,int startIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetItemHeight(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+
+ /// [methods for events]
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnBackColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnDataSourceChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnDataSourceChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnDisplayMemberChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnDisplayMemberChanged(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnDrawItem(DrawItemEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnDropDown(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnDropDownStyleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnForeColorChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnForeColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleDestroyed(e);
+ }
+
+ [MonoTODO]
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyPress(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnMeasureItem(MeasureItemEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnParentBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnParentBackColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ //FIXME:
+ base.OnResize(e);
+ }
+
+ [MonoTODO]
+ protected override void OnSelectedIndexChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnSelectedIndexChanged(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectionChangeCommitted(EventArgs e)
+ {
+ //FIXME:
+ }
+ /// end of [methods for events]
+
+
+ [MonoTODO]
+ protected override void RefreshItem(int index)
+ {
+ //FIXME:
+ base.Refresh();
+ }
+
+ [MonoTODO]
+ public void Select(int start,int length)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void SelectAll()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void SetBoundsCore(int x,int y,int width,int height,BoundsSpecified specified)
+ {
+ //FIXME:
+ base.SetBoundsCore(x,y,width,height,specified);
+ }
+
+ // for IList interface
+ // FIXME not sure how to handle this
+ //[MonoTODO]
+ //protected override void SetItemsCore(IList value)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+
+
+ /// --- Button events ---
+ /// commented out, cause it only supports the .NET Framework infrastructure
+ [MonoTODO]
+ public event DrawItemEventHandler DrawItem;
+
+ [MonoTODO]
+ public event EventHandler DropDown;
+
+ [MonoTODO]
+ public event EventHandler DropDownStyleChanged;
+
+ [MonoTODO]
+ public event MeasureItemEventHandler MeasureItem;
+
+ /* only supports .NET framework
+ [MonoTODO]
+ public new event PaintEventHandler Paint;
+ */
+
+ [MonoTODO]
+ public event EventHandler SelectedIndexChanged;
+
+ [MonoTODO]
+ public event EventHandler SelectionChangeCommitted;
+
+ /// --- public class ComboBox.ChildAccessibleObject : AccessibleObject ---
+ /// the class is not stubbed, cause it's only used for .NET framework
+
+
+ /// sub-class: ComboBox.ObjectCollection
+ /// <summary>
+ /// Represents the collection of items in a ComboBox.
+ /// </summary>
+ [MonoTODO]
+ public class ObjectCollection : IList, ICollection, IEnumerable {
+
+ /// --- ObjectCollection.constructor ---
+ [MonoTODO]
+ public ObjectCollection (ComboBox owner)
+ {
+
+ }
+
+ /// --- ObjectCollection Properties ---
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int this[int index] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ /// --- ICollection properties ---
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object IList.this[int index] {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ /// --- methods ---
+ /// --- ObjectCollection Methods ---
+ /// Note: IList methods are stubbed out, otherwise IList interface cannot be implemented
+ [MonoTODO]
+ public int Add(object item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange(object[] items)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool Contains(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo(object[] dest,int arrayIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// for ICollection:
+ [MonoTODO]
+ void ICollection.CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Insert(int index,object item)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Remove(object value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+ } // --- end of ComboBox.ObjectCollection ---
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs
new file mode 100644
index 00000000000..bef45a26180
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.ComboBoxStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ComboBoxStyle {
+ DropDown = 1,
+ DropDownList = 2,
+ Simple = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CommonDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CommonDialog.cs
new file mode 100644
index 00000000000..809145d4214
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CommonDialog.cs
@@ -0,0 +1,71 @@
+//
+// System.Windows.Forms.CommonDialog.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies the base class used for displaying dialog boxes on the screen.
+ /// </summary>
+
+ [MonoTODO]
+ public abstract class CommonDialog : Component {
+
+ // private fields
+
+ /// --- constructor ---
+ [MonoTODO]
+ public CommonDialog() : base ()
+ {
+ }
+
+ /// --- Methods ---
+ [MonoTODO]
+ protected virtual IntPtr HookProc(IntPtr hWnd,int msg,IntPtr wparam,IntPtr lparam)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // event methods
+ [MonoTODO]
+ protected virtual void OnHelpRequest(EventArgs e)
+ {
+ //FIXME:
+ }
+ // end of event methods
+
+ [MonoTODO]
+ protected virtual IntPtr OwnerWndProc(IntPtr hWnd,int msg,IntPtr wparam,IntPtr lparam)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void Reset();
+
+ protected abstract bool RunDialog(IntPtr hwndOwner);
+
+ [MonoTODO]
+ public DialogResult ShowDialog()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DialogResult ShowDialog(IWin32Window owner)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// events
+ [MonoTODO]
+ public event EventHandler HelpRequest;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs
new file mode 100644
index 00000000000..52ee1309844
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs
@@ -0,0 +1,138 @@
+//
+// System.Windows.Forms.ContainerControl.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides focus management functionality for controls that can function as a container for other controls.
+ /// </summary>
+
+ public class ContainerControl : ScrollableControl, IContainerControl {
+
+ protected ContainerControl () : base ()
+ {
+ }
+
+
+ public Control ActiveControl {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ // not ready for BindingContext
+ //public override BindingContext BindingContext {
+ // get { throw new NotImplementedException (); }
+ // set { throw new NotImplementedException (); }
+ //}
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams; }
+ }
+
+ [MonoTODO]
+ public Form ParentForm {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected virtual void UpdateDefaultButton()
+
+ protected override void AdjustFormScrollbars (
+ bool displayScrollbars)
+ {
+ //FIXME:
+ base.AdjustFormScrollbars (displayScrollbars);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ //FIXME
+ base.Dispose(disposing);
+ }
+
+ [MonoTODO]
+ // not memeber?
+ bool IContainerControl.ActivateControl(Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [event methods]
+ protected override void OnControlRemoved (ControlEventArgs e)
+ {
+ //FIXME:
+ base.OnControlRemoved (e);
+ }
+
+ protected override void OnCreateControl ()
+ {
+ //FIXME:
+ base.OnCreateControl ();
+ }
+ // end of [event methods]
+
+ [MonoTODO]
+ protected override bool ProcessDialogChar (char charCode)
+ {
+ //FIXME:
+ return base.ProcessDialogChar(charCode);
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ //FIXME:
+ return base.ProcessDialogKey(keyData);
+ }
+
+ [MonoTODO]
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ //FIXME:
+ return base.ProcessMnemonic(charCode);
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessTabKey (bool forward)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Not an overridden function?
+ //protected override void Select(bool directed,bool forward)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public bool Validate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs
new file mode 100644
index 00000000000..1e33b82a29e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs
@@ -0,0 +1,41 @@
+//
+// System.Windows.Forms.ColumnClickEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the ContentsResized event.
+ /// </summary>
+
+ public class ContentsResizedEventArgs : EventArgs {
+
+ #region Fields
+ private Rectangle newrectangle;
+ #endregion
+
+ /// --- Constructor ---
+ public ContentsResizedEventArgs(Rectangle newRectangle) : base()
+ {
+ newrectangle = newRectangle;
+ }
+
+ #region Public Propeties
+ public Rectangle NewRectangle
+ {
+ get {
+ return newrectangle;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs
new file mode 100644
index 00000000000..7db2c6222af
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ContentsResizedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ContentsResizedEventHandler(
+ object sender,
+ ContentsResizedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContextMenu.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContextMenu.cs
new file mode 100644
index 00000000000..4e90b15f416
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContextMenu.cs
@@ -0,0 +1,64 @@
+//
+// System.Windows.Forms.ContextMenu.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// Alexandre Pigolkine (pigolkine@gmx.de)
+//
+// (C) Ximian, Inc., 2002
+//
+
+//using System.ComponentModel;
+//using System.Collections;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows combo box control.
+ /// </summary>
+
+ [MonoTODO]
+ public class ContextMenu : Menu {
+
+ // private fields
+ RightToLeft rightToLeft;
+
+ // --- Constructor ---
+ [MonoTODO]
+ public ContextMenu() : base(null)
+ {
+ rightToLeft = RightToLeft.Inherit;
+ }
+
+ [MonoTODO]
+ public ContextMenu(MenuItem[] menuItems) : base(menuItems)//menu does not have public constructor. Is this a gtk menu?
+ {
+ }
+
+ // --- Properties ---
+ public virtual RightToLeft RightToLeft {
+ get { return rightToLeft; }
+ set { rightToLeft=value; }
+ }
+
+ [MonoTODO]
+ public Control SourceControl {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected internal virtual void OnPopup(EventArgs e);
+ [MonoTODO]
+ public void Show(Control control,Point pos)
+ {
+ //FIXME:
+ }
+
+ /// events
+ [MonoTODO]
+ public event EventHandler Popup;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs
new file mode 100644
index 00000000000..d272f099bb0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs
@@ -0,0 +1,2615 @@
+ //
+ // System.Windows.Forms.Control.cs
+ //
+ // Author:
+ // stubbed out by Jaak Simm (jaaksimm@firm.ee)
+ // Dennis Hayes (dennish@rayetk.com)
+ // WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+ //
+ // (C) Ximian, Inc., 2002
+ //
+
+ using System.ComponentModel;
+ using System.Drawing;
+ using System.Collections;
+
+ namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Defines the base class for controls, which are components with
+ /// visual representation.
+ /// </summary>
+
+ public class Control : Component , ISynchronizeInvoke, IWin32Window {
+
+
+ // Helper NativeWindow class to dispatch messages back
+ // to the Control class
+ protected class ControlNativeWindow : NativeWindow {
+
+ private Control control;
+
+ public ControlNativeWindow (Control control) : base() {
+ this.control = control;
+ }
+
+ protected override void WndProc (ref Message m) {
+ base.WndProc (ref m);
+
+ control.WndProc (ref m);
+ }
+ }
+
+ // FIXME: not sure if dervied classes should have access
+ protected ControlNativeWindow window;
+ private ControlCollection childControls;
+ private Control parent;
+
+ // private fields
+ // it seems these are stored in case the window is not created,
+ // corresponding properties (below) need to check if window
+ // is created or not and react accordingly
+ string accessibleDefaultActionDescription;
+ string accessibleDescription;
+ string accessibleName;
+ AccessibleRole accessibleRole;
+ bool allowDrop;
+ AnchorStyles anchor;
+ Color backColor;
+ Image backgroundImage;
+ //BindingContext bindingContext;
+ Rectangle bounds;
+ bool causesValidation;
+ //ContextMenu contextMenu;
+ DockStyle dock;
+ bool enabled;
+ Font font;
+ Color foreColor;
+ ImeMode imeMode;
+ bool isAccessible;
+ // Point location; // using bounds to store location
+ string name;
+ Region region;
+ RightToLeft rightToLeft;
+ bool tabStop;
+ string text;
+ bool visible;
+ object tag;
+ // --- Constructors ---
+
+ //Compact Framework //only Control()
+ public Control ()
+ {
+ CreateControlsInstance ();
+
+ accessibleDefaultActionDescription = null;
+ accessibleDescription = null;
+ accessibleName = null;
+ accessibleRole = AccessibleRole.Default;
+ allowDrop = false;
+ anchor = AnchorStyles.Top | AnchorStyles.Left;
+ //backColor = Control.DefaultBackColor;
+ backgroundImage = null;
+ bounds = new Rectangle();
+ // bindingContext = null;
+ causesValidation = true;
+ // contextMenu = null;
+ dock = DockStyle.None;
+ enabled = true;
+ // font = Control.DefaultFont;
+ // foreColor = Control.DefaultForeColor;
+ imeMode = ImeMode.Inherit;
+ isAccessible = false;
+ // location = new Point (0,0); should be from OS
+ name = "";
+ region = null;
+ rightToLeft = RightToLeft.Inherit;
+ tabStop = false;
+ text = "";
+ visible = true;
+ parent = null;
+ CreateHandle();//sets window handle. FIXME: No it does not
+ }
+
+ // according to docs, the constructors do not create
+ // the (HWND) window
+ public Control (string text) : this()
+ {
+ Text = text;
+ // SetWindowTextA (Handle, text);
+ }
+
+ public Control (Control parent, string text) : this (text)
+ {
+ Parent = parent;
+ // SetParent (Handle, parent.Handle);
+ }
+
+ public Control (string text, int left, int top,
+ int width, int height) : this(text)
+ {
+ Left = left;
+ Top = top;
+ Width = width;
+ Height = height;
+ //SetWindowPos (Handle, (IntPtr) 0, left, top,
+ // width, height, 0);
+ }
+
+ public Control (Control parent,string text,int left, int top,
+ int width,int height) : this (parent, text)
+ {
+ Left = left;
+ Top = top;
+ Width = width;
+ Height = height;
+ // SetWindowPos (Handle, (IntPtr) 0, left, top,
+ // width, height, 0);
+ }
+
+ // for internal use only, create a control class
+ // for an existing, created HWND
+ private Control (IntPtr existingHandle)
+ {
+ window = (ControlNativeWindow) NativeWindow.FromHandle (
+ existingHandle);
+ }
+
+ // --- Properties ---
+ // Properties only supporting .NET framework, not stubbed out:
+ // - protected bool RenderRightToLeft {get;}
+ // - public IWindowTarget WindowTarget {get; set;}
+ //[MonoTODO]
+ //public AccessibleObject AccessibilityObject {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public string AccessibleDefaultActionDescription {
+ get {
+ return accessibleDefaultActionDescription;
+ }
+ set {
+ accessibleDefaultActionDescription = value;
+ }
+ }
+
+ public string AccessibleDescription {
+ get {
+ return accessibleDescription;
+ }
+ set {
+ accessibleDescription=value;
+ }
+ }
+
+ public string AccessibleName {
+ get {
+ return accessibleName;
+ }
+ set {
+ accessibleName=value;
+ }
+ }
+
+ public AccessibleRole AccessibleRole {
+ get {
+ return accessibleRole;
+ }
+ set {
+ accessibleRole=value;
+ }
+ }
+
+ public virtual bool AllowDrop {
+ get {
+ return allowDrop;
+ }
+ set {
+ allowDrop=value;
+ }
+ }
+
+ public virtual AnchorStyles Anchor {
+ get {
+ return anchor;
+ }
+ set {
+ anchor=value;
+ }
+ }
+
+ //Compact Framework
+ public virtual Color BackColor {
+ get {
+ if (IsHandleCreated) {
+ IntPtr dc = Win32.GetDC (Handle);
+ uint bgColor = Win32.GetBkColor (dc);
+ Win32.ReleaseDC (Handle, dc);
+ int r = (int) (bgColor & 0xFF);
+ int g = (int) ((bgColor >> 8) & 0xFF);
+ int b = (int) ((bgColor >> 16) & 0xFF);
+ return Color.FromArgb (r, g, b);
+ } else return backColor;
+ }
+ set {
+ backColor = value;
+ if (IsHandleCreated) {
+ IntPtr dc = Win32.GetDC (Handle);
+ Win32.SetBkColor (dc, (uint) value.ToArgb());
+ Win32.ReleaseDC (Handle, dc);
+ }
+ }
+ }
+
+ public virtual Image BackgroundImage {
+ get {
+ return backgroundImage;
+ }
+ set {
+ backgroundImage = value;
+ // FIXME: force redraw
+ }
+ }
+
+ public virtual BindingContext BindingContext {
+ get {
+ //return bindingContext;
+ throw new NotImplementedException ();
+ }
+ set {
+ //bindingContext=value;
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public int Bottom {
+ get {
+ return Top + Height;
+ }
+ }
+
+ //Compact Framework
+ public Rectangle Bounds {
+ get {
+ if (IsHandleCreated) {
+ RECT rect = new RECT();
+ Win32.GetWindowRect (Handle, ref rect);
+ return new Rectangle ((int) rect.left,
+ (int) rect.top,
+ (int) rect.right,
+ (int) rect.bottom);
+ } else return bounds;
+ }
+ set {
+ if (IsHandleCreated)
+ Win32.SetWindowPos (
+ //Handle, (IntPtr) 0, value.X, value.Y,
+ Handle, SetWindowPosZOrder.HWND_TOPMOST, value.X, value.Y,
+ value.Width, value.Height, 0);
+ else bounds = value;
+ }
+ }
+
+ public bool CanFocus {
+ get {
+ if (IsHandleCreated && Visible && Enabled)
+ return true;
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ public bool CanSelect {
+ get {
+ // if (ControlStyles.Selectable &&
+ // isContainedInAnotherControl &&
+ // parentIsVisiable && isVisialbe &&
+ // parentIsEnabled && isEnabled) {
+ // return true;
+ // }
+ // return false;
+
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public bool Capture {
+ get {
+ if (IsHandleCreated) {
+ IntPtr captured = Win32.GetCapture ();
+ if (Handle == captured)
+ return true;
+ }
+ return false;
+ }
+ set {
+ if (IsHandleCreated) {
+ if (value)
+ Win32.SetCapture (Handle);
+ else {
+ IntPtr captured = Win32.GetCapture ();
+
+ // if this window is in capture state
+ // release it
+ if (Handle == captured)
+ Win32.ReleaseCapture ();
+ }
+ }
+ }
+ }
+
+ public bool CausesValidation {
+ get {
+ return causesValidation;
+ }
+ set {
+ causesValidation=value;
+ }
+ }
+
+ //Compact Framework
+ public Rectangle ClientRectangle {
+ get {
+ if (IsHandleCreated) {
+ RECT rect = new RECT();
+ Win32.GetClientRect (Handle, ref rect);
+ return new Rectangle ((int) rect.left,
+ (int) rect.top,
+ (int) rect.right,
+ (int) rect.bottom);
+ }
+
+ // FIXME: is the correct return value for
+ // window who's handle is not created
+ return new Rectangle (0, 0, 0, 0);
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Size ClientSize {
+ get {
+ if (IsHandleCreated) {
+ RECT rect = new RECT();
+ Win32.GetClientRect (Handle, ref rect);
+ return new Size (
+ (int) rect.right,
+ (int) rect.bottom);
+ }
+ // FIXME: is the correct return value for
+ // window who's handle is not created
+ return new Size (0, 0);
+ }
+ set {
+ // FIXME: Is this good default style ?
+ SetClientSize(value, (int)(WindowStyles.WS_CHILD | WindowStyles.WS_BORDER), false);
+ }
+ }
+
+ [MonoTODO]
+ public string CompanyName {
+ get {
+ //Better than throwing an execption
+ return "Company Name";
+ }
+ }
+
+ internal void SetClientSize(Size value, int styleIfNoWindow, bool menuIfNoWindow) {
+ RECT rc = new RECT();
+ rc.left = rc.top = 0;
+ rc.right = value.Width;
+ rc.bottom = value.Height;
+
+ if( Handle != IntPtr.Zero){
+ int style = Win32.GetWindowLong( Handle, GetWindowLongFlag.GWL_STYLE).ToInt32();
+ int menuExists = 0;
+ if( (style & (int)WindowStyles.WS_CHILD) == 0 ){
+ menuExists = Win32.GetMenu(Handle) != IntPtr.Zero ? 1 : 0;
+ }
+ Win32.AdjustWindowRect( ref rc, style, menuExists);
+ Win32.SetWindowPos( Handle, SetWindowPosZOrder.HWND_TOP, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
+ SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOZORDER);
+ }
+ else {
+ Win32.AdjustWindowRect( ref rc, styleIfNoWindow, menuIfNoWindow ? 1 : 0);
+ }
+ Width = rc.right - rc.left;
+ Height = rc.bottom - rc.top;
+ }
+
+ public bool ContainsFocus {
+ get {
+ if (IsHandleCreated) {
+ IntPtr focusedWindow = Win32.GetFocus();
+ if (focusedWindow == Handle)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public virtual ContextMenu ContextMenu {
+ get {
+ //return contextMenu;
+ throw new NotImplementedException ();
+ }
+ set {
+ //contextMenu=value;
+ throw new NotImplementedException ();
+ }
+ }
+
+ public ControlCollection Controls {
+ get { return childControls; }
+ }
+
+ public bool Created {
+ get {
+ if (Handle != (IntPtr) 0)
+ return true;
+ return false;
+ }
+ }
+
+ protected virtual CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ createParams.Caption = Text;
+ createParams.ClassName = "CONTROL";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+
+ if (parent != null)
+ createParams.Parent = parent.Handle;
+ else
+ createParams.Parent = (IntPtr) 0;
+
+ createParams.Style = (int) WindowStyles.WS_OVERLAPPEDWINDOW;
+
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ public virtual Cursor Cursor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ // waiting for BindingContext; should be stubbed now
+ public ControlBindingsCollection DataBindings {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static Color DefaultBackColor {
+ get {
+ // FIXME: use GetSystemMetrics?
+ //return SystemColors.Control;
+ throw new NotImplementedException ();
+ }
+ }
+
+ //[MonoTODO]
+ // FIXME: use GetSystemMetrics?
+ //public static Font DefaultFont {
+ // FIXME: get current system font from GenericSansSerif
+ // call ArgumentException not called
+ // get {
+ // throw new NotImplementedException ();
+ //return (FontFamily.GenericSansSerif);
+ // }
+ //}
+
+ public static Color DefaultForeColor {
+ get {
+ return SystemColors.ControlText;
+ }
+ }
+
+ protected virtual ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected virtual Size DefaultSize {
+ get {
+ //Default label size, this should be correct.
+ return new Size(100,23);
+ }
+ }
+
+ public virtual Rectangle DisplayRectangle {
+ get {
+ return ClientRectangle;
+ }
+ }
+
+ [MonoTODO]
+ public bool Disposing {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual DockStyle Dock {
+ get {
+ return dock;
+ }
+ set {
+ dock=value;
+ }
+ }
+
+ //Compact Framework
+ public virtual bool Enabled {
+ get {
+ return Win32.IsWindowEnabled (Handle);
+ }
+ set {
+ Win32.EnableWindow (Handle, value);
+ }
+ }
+
+ //Compact Framework
+ public virtual bool Focused {
+ get {
+ return ContainsFocus;
+ }
+ }
+
+ //Compact Framework
+ public virtual Font Font {
+ get {
+ throw new NotImplementedException ();
+ //uint ReturnValue = SendMessage(Handle, WM_GETFONT, IntPtr.Zero, IntPtr.Zero);
+ //if(ReturnValue != 0)throw new Exception("Could not get Font",null);
+ //return Handle;
+ }
+ set {
+ throw new NotImplementedException ();
+ //uint ReturnValue = SendMessage(Handle, WM_SETFONT, value, (IntPtr)1 );
+ //if(ReturnValue != 0)throw new Exception("Could not set Font",null);
+ }
+ }
+
+ [MonoTODO]
+ protected int FontHeight {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public virtual Color ForeColor {
+ get {
+ return foreColor;
+ }
+ set {
+ foreColor = value;
+ }
+ }
+
+ public bool HasChildren {
+ get {
+ if (childControls.Count >0)
+ return true;
+ return false;
+ }
+ }
+
+ //Compact Framework
+ public int Height {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ }
+ return bounds.Height;
+ }
+ set {
+ bounds.Height = value;
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ public ImeMode ImeMode {
+ // CHECKME:
+ get {
+ return imeMode;
+ }
+ set {
+ imeMode=value;
+ }
+ }
+
+ public bool IsAccessible {
+ // CHECKME:
+ get {
+ return isAccessible;
+ } // default is false
+ set {
+ isAccessible=value;
+ }
+ }
+
+ public bool IsDisposed {
+ get {
+ if (Handle == (IntPtr) 0)
+ return true;
+ return false;
+ }
+ }
+
+ public bool IsHandleCreated {
+ get {
+ if (Handle != (IntPtr) 0)
+ return true;
+ return false;
+ }
+ }
+
+ //Compact Framework
+ public int Left {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ return 0;
+ } else return bounds.X;
+ }
+ set {
+ bounds.X = value;
+
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ //Compact Framework
+ public Point Location {
+ // CHECKME:
+ get {
+ return new Point (Top, Left);
+ }
+ set {
+ bounds.X = value.X;
+ bounds.Y = value.Y;
+
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+
+ }
+ }
+
+ [MonoTODO]
+ public static Keys ModifierKeys {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public static MouseButtons MouseButtons {
+ get {
+ // FIXME: use GetAsycKeyState?
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public static Point MousePosition {
+ get {
+ POINT point = new POINT();
+ Win32.GetCursorPos (ref point);
+ return new Point ( (int) point.x, (int) point.y);
+ }
+ }
+
+ public string Name {
+ // CHECKME:
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ //Compact Framework
+ public Control Parent {
+ get {
+ return parent;
+ //IntPtr parent = GetParent (Handle);
+ //return FromHandle (parent);
+ }
+ set {
+ Console.WriteLine ("setting parent");
+ parent = value;
+
+ Console.WriteLine ("add ourself to the parents control");
+ // add ourself to the parents control
+ parent.Controls.Add (this);
+
+ Console.WriteLine ("SetParent");
+ if (IsHandleCreated) {
+ Console.WriteLine ("Handle created");
+ Win32.SetParent (Handle, value.Handle);
+ }
+ }
+ }
+
+ [MonoTODO]
+ public string ProductName {
+ get {
+ //FIXME:
+ return "Product Name";
+ }
+ }
+
+ [MonoTODO]
+ public string ProductVersion {
+ get {
+ //FIXME:
+ return "Product Version";
+ }
+ }
+
+ [MonoTODO]
+ public bool RecreatingHandle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Region Region {
+ // CHECKME:
+ get {
+ return region;
+ }
+ set {
+ region = value;
+ }
+ }
+
+ [MonoTODO]
+ protected bool ResizeRedraw {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public int Right {
+ get {
+ return Left + Width;
+ }
+ }
+
+ [MonoTODO]
+ public virtual RightToLeft RightToLeft {
+ // CHECKME:
+ get {
+ return rightToLeft;
+ }
+ set {
+ rightToLeft=value;
+ }
+ }
+
+ [MonoTODO]
+ protected virtual bool ShowFocusCues {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected bool ShowKeyboardCues {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public Size Size {
+ //FIXME: should we return client size or someother size???
+ get {
+ RECT WindowRectangle;
+ WindowRectangle = new RECT();
+ if(!Win32.GetWindowRect(Handle,ref WindowRectangle)){
+ //throw new Exception("couild not retreve Control Size");
+ }
+ return new Size(WindowRectangle.right - WindowRectangle.left,
+ WindowRectangle.bottom - WindowRectangle.top);
+ }
+ set {
+ Win32.SetWindowPos(Handle, SetWindowPosZOrder.HWND_TOP, 0, 0, this.Size.Width, this.Size.Height,
+ SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOMOVE |
+ SetWindowPosFlags.SWP_NOZORDER);// Activating might be a good idea?? | SetWindowPosFlags.SWP_NOACTIVATE);
+ }
+ }
+ internal int tabindex;//for debug/test only. remove
+ [MonoTODO]
+ public int TabIndex {
+ get {
+ return tabindex;
+ }
+ set {
+ tabindex = value;
+ }
+ }
+
+ public bool TabStop {
+ // CHECKME:
+ get {
+ return tabStop;
+ }
+ set {
+ tabStop = value;
+ }
+ }
+
+ [MonoTODO]
+ public object Tag {
+ get {
+ return tag;
+ }
+ set {
+ tag = value;
+ }
+ }
+
+ //Compact Framework
+ public virtual string Text {
+ get {
+ if (IsHandleCreated) {
+ String text = "";
+ int length = Win32.GetWindowTextLengthA (Handle);
+ Win32.GetWindowTextA (Handle, ref text, length);
+ return text;
+ }
+ else{
+ return text;
+ }
+ }
+ set {
+ text = value;
+
+ if (IsHandleCreated)
+ Win32.SetWindowTextA (Handle, value);
+ }
+ }
+
+ //Compact Framework
+ public int Top {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ return 0;
+ } else return bounds.Top;
+ }
+ set {
+ bounds.Y = value;
+
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ [MonoTODO]
+ public Control TopLevelControl {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public bool Visible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ if (value)
+ Win32.ShowWindow (
+ Handle, ShowWindowStyles.SW_SHOW);
+ else
+ Win32.ShowWindow (
+ Handle, ShowWindowStyles.SW_HIDE);
+ }
+ }
+
+ //Compact Framework
+ public int Width {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ }
+ return bounds.Width;
+ }
+ set {
+ bounds.Width = value;
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ /// --- methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected virtual void NotifyInvalidate(Rectangle invalidatedArea)
+ /// - protected void RaiseDragEvent(object key,DragEventArgs e);
+ /// - protected void RaiseKeyEvent(object key,KeyEventArgs e);
+ /// - protected void RaiseMouseEvent(object key,MouseEventArgs e);
+ /// - protected void RaisePaintEvent(object key,PaintEventArgs e);
+ /// - protected void ResetMouseEventArgs();
+
+ [MonoTODO]
+ protected void AccessibilityNotifyClients (
+ AccessibleEvents accEvent,int childID)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public void BringToFront ()
+ {
+ //FIXME:
+ }
+
+ public bool Contains (Control ctl)
+ {
+ return childControls.Contains (ctl);
+ }
+
+ public void CreateControl ()
+ {
+ CreateHandle ();
+ }
+
+ [MonoTODO]
+ protected virtual AccessibleObject CreateAccessibilityInstance() {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual ControlCollection CreateControlsInstance ()
+ {
+ childControls = new ControlCollection (this);
+ return childControls;
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Graphics CreateGraphics ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void CreateHandle ()
+ {
+ window = new ControlNativeWindow (this);
+
+ window.CreateHandle (CreateParams);
+ }
+
+ protected virtual void DefWndProc (ref Message m)
+ {
+ window.DefWndProc(ref m);
+ }
+
+ protected virtual void DestroyHandle ()
+ {
+ window.DestroyHandle ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ //FIXME:
+ base.Dispose(disposing);
+ }
+
+ [MonoTODO]
+ public DragDropEffects DoDragDrop (
+ object data, DragDropEffects allowedEffects)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public object EndInvoke(IAsyncResult asyncResult):
+ //look under ISynchronizeInvoke methods
+
+ [MonoTODO]
+ public Form FindForm ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public bool Focus ()
+ {
+ if (Win32.SetFocus (Handle) != (IntPtr) 0)
+ return true;
+ return false;
+ }
+
+ [MonoTODO]
+ public static Control FromChildHandle (IntPtr handle)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Control FromHandle (IntPtr handle)
+ {
+ Control control = new Control (handle);
+ return control;
+ }
+
+ [MonoTODO]
+ public Control GetChildAtPoint (Point pt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ //public IContainerControl GetContainerControl ()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public Control GetNextControl (Control ctl, bool forward)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool GetStyle (ControlStyles flag)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool GetTopLevel ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Hide ()
+ {
+ if (IsHandleCreated)
+ Win32.ShowWindow (Handle, ShowWindowStyles.SW_HIDE);
+ }
+
+ [MonoTODO]
+ protected virtual void InitLayout ()
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ public void Invalidate ()
+ {
+ if (IsHandleCreated) {
+ //FIXME:
+ //RECT rect = (RECT) null;
+ //InvalidateRect (Handle, ref rect, true);
+ }
+ }
+
+ [MonoTODO]
+ public void Invalidate (bool invalidateChildren)
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ public void Invalidate (Rectangle rc)
+ {
+ if (IsHandleCreated) {
+ RECT rect = new RECT();
+ rect.left = rc.Left;
+ rect.top = rc.Top;
+ rect.right = rc.Right;
+ rect.bottom = rc.Bottom;
+ Win32.InvalidateRect (Handle, ref rect, true);
+ }
+ }
+
+ [MonoTODO]
+ public void Invalidate(Region region)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Invalidate (Rectangle rc, bool invalidateChildren)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Invalidate(Region region,bool invalidateChildren)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void InvokeGotFocus (Control toInvoke, EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void InvokeLostFocus (Control toInvoke, EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void InvokeOnClick (Control toInvoke, EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void InvokePaint (Control c, PaintEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void InvokePaintBackground (
+ Control c,PaintEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual bool IsInputChar (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool IsInputKey (Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsMnemonic (char charCode,string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // methods used with events:
+ protected virtual void OnBackColorChanged (EventArgs e)
+ {
+ if (BackColorChanged != null)
+ BackColorChanged (this, e);
+ }
+
+ protected virtual void OnBackgroundImageChanged (EventArgs e)
+ {
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, e);
+ }
+
+ protected virtual void OnBindingContextChanged (EventArgs e)
+ {
+ if (BindingContextChanged != null)
+ BindingContextChanged (this, e);
+ }
+
+ protected virtual void OnCausesValidationChanged (EventArgs e)
+ {
+ if (CausesValidationChanged != null)
+ CausesValidationChanged (this, e);
+ }
+
+ protected virtual void OnChangeUICues(UICuesEventArgs e)
+ {
+ if (ChangeUICues != null)
+ ChangeUICues (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnClick (EventArgs e)
+ {
+ if (Click != null)
+ Click (this, e);
+ }
+
+
+ protected virtual void OnContextMenuChanged (EventArgs e)
+ {
+ if (ContextMenuChanged != null)
+ ContextMenuChanged (this, e);
+ }
+
+ protected virtual void OnControlAdded (ControlEventArgs e)
+ {
+ if (ControlAdded != null)
+ ControlAdded (this, e);
+ }
+
+ protected virtual void OnControlRemoved (ControlEventArgs e)
+ {
+ if (ControlRemoved != null)
+ ControlRemoved (this, e);
+ }
+
+ protected virtual void OnCreateControl ()
+ {
+ //FIXME:
+ }
+
+ protected virtual void OnCursorChanged (EventArgs e)
+ {
+ if (CursorChanged != null)
+ CursorChanged (this, e);
+ }
+
+ protected virtual void OnDockChanged (EventArgs e)
+ {
+ if (DockChanged != null)
+ DockChanged (this, e);
+ }
+
+ protected virtual void OnDoubleClick (EventArgs e)
+ {
+ if (DoubleClick != null)
+ DoubleClick (this, e);
+ }
+
+ protected virtual void OnDragDrop (DragEventArgs e)
+ {
+ if (DragDrop != null)
+ DragDrop (this, e);
+ }
+
+ protected virtual void OnDragEnter (DragEventArgs e)
+ {
+ if (DragEnter != null)
+ DragEnter (this, e);
+ }
+
+ protected virtual void OnDragLeave (EventArgs e)
+ {
+ if (DragLeave != null)
+ DragLeave (this, e);
+ }
+
+ protected virtual void OnDragOver (DragEventArgs e)
+ {
+ if (DragOver != null)
+ DragOver (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnEnabledChanged (EventArgs e)
+ {
+ if (EnabledChanged != null)
+ EnabledChanged (this, e);
+ }
+
+ protected virtual void OnEnter (EventArgs e)
+ {
+ if (Enter != null)
+ Enter (this, e);
+ }
+
+ protected virtual void OnFontChanged (EventArgs e)
+ {
+ if (FontChanged != null)
+ FontChanged (this, e);
+ }
+
+ protected virtual void OnForeColorChanged (EventArgs e)
+ {
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, e);
+ }
+
+ protected virtual void OnGiveFeedback (GiveFeedbackEventArgs e)
+ {
+ if (GiveFeedback != null)
+ GiveFeedback (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnGotFocus (EventArgs e)
+ {
+ if (GotFocus != null)
+ GotFocus (this, e);
+ }
+
+ protected virtual void OnHandleCreated (EventArgs e)
+ {
+ Console.WriteLine ("OnHandleCreated");
+
+ if (HandleCreated != null)
+ HandleCreated (this, e);
+
+ // create all child windows
+ IEnumerator cw = childControls.GetEnumerator();
+
+ while (cw.MoveNext()) {
+ Console.WriteLine ("Adding Control");
+ Control control = (Control) cw.Current;
+ control.CreateControl ();
+ control.Show ();
+ }
+ }
+
+ protected virtual void OnHandleDestroyed (EventArgs e)
+ {
+ if (HandleDestroyed != null)
+ HandleDestroyed (this, e);
+ }
+
+ protected virtual void OnHelpRequested (HelpEventArgs e)
+ {
+ if (HelpRequested != null)
+ HelpRequested (this, e);
+ }
+
+ protected virtual void OnImeModeChanged (EventArgs e)
+ {
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, e);
+ }
+
+ protected virtual void OnInvalidated (InvalidateEventArgs e)
+ {
+ if (Invalidated != null)
+ Invalidated (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnKeyDown (KeyEventArgs e)
+ {
+ if (KeyDown != null)
+ KeyDown (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnKeyPress (KeyPressEventArgs e)
+ {
+ if (KeyPress != null)
+ KeyPress (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnKeyUp (KeyEventArgs e)
+ {
+ if (KeyUp != null)
+ KeyUp (this, e);
+
+ }
+
+ protected virtual void OnLayout (LayoutEventArgs e)
+ {
+ if (Layout != null)
+ Layout (this, e);
+ }
+
+ protected virtual void OnLeave (EventArgs e)
+ {
+ if (Leave != null)
+ Leave (this, e);
+ }
+
+ protected virtual void OnLocationChanged (EventArgs e)
+ {
+ if (LocationChanged != null)
+ LocationChanged (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnLostFocus (EventArgs e)
+ {
+ if (LostFocus != null)
+ LostFocus (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnMouseDown (MouseEventArgs e)
+ {
+ if (MouseDown != null)
+ MouseDown (this, e);
+ }
+
+ protected virtual void OnMouseEnter (EventArgs e)
+ {
+ if (MouseEnter != null)
+ MouseEnter (this, e);
+ }
+
+ protected virtual void OnMouseHover (EventArgs e)
+ {
+ if (MouseHover != null)
+ MouseHover (this, e);
+ }
+
+ protected virtual void OnMouseLeave (EventArgs e)
+ {
+ if (MouseLeave != null)
+ MouseLeave (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnMouseMove (MouseEventArgs e)
+ {
+ if (MouseMove != null)
+ MouseMove (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnMouseUp (MouseEventArgs e)
+ {
+ if (MouseUp != null)
+ MouseUp (this, e);
+ }
+
+ protected virtual void OnMouseWheel (MouseEventArgs e)
+ {
+ if (MouseWheel != null)
+ MouseWheel (this, e);
+ }
+
+ protected virtual void OnMove (EventArgs e)
+ {
+ if (Move != null)
+ Move (this, e);
+ }
+
+ protected virtual void OnNotifyMessage (Message m)
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ protected virtual void OnPaint (PaintEventArgs e)
+ {
+ if (Paint != null)
+ Paint (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnPaintBackground (PaintEventArgs e)
+ {
+ //FIXME:
+ }
+
+ protected virtual void OnParentBackColorChanged (EventArgs e)
+ {
+ if (BackColorChanged != null)
+ BackColorChanged (this, e);
+ }
+
+ protected virtual void OnParentBackgroundImageChanged (
+ EventArgs e)
+ {
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, e);
+ }
+
+ protected virtual void OnParentBindingContextChanged (
+ EventArgs e)
+ {
+ if (BindingContextChanged != null)
+ BindingContextChanged (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnParentChanged (EventArgs e)
+ {
+ if (ParentChanged != null)
+ ParentChanged (this, e);
+ }
+
+ protected virtual void OnParentEnabledChanged (EventArgs e)
+ {
+ if (EnabledChanged != null)
+ EnabledChanged (this, e);
+ }
+
+ protected virtual void OnParentFontChanged (EventArgs e)
+ {
+ if (FontChanged != null)
+ FontChanged (this, e);
+ }
+
+ protected virtual void OnParentForeColorChanged (EventArgs e)
+ {
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, e);
+ }
+
+ protected virtual void OnParentRightToLeftChanged (
+ EventArgs e)
+ {
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, e);
+ }
+
+ protected virtual void OnParentVisibleChanged (EventArgs e)
+ {
+ if (VisibleChanged != null)
+ VisibleChanged (this, e);
+ }
+
+ protected virtual void OnQueryContinueDrag (
+ QueryContinueDragEventArgs e)
+ {
+ if (QueryContinueDrag != null)
+ QueryContinueDrag (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnResize (EventArgs e)
+ {
+ if (Resize != null)
+ Resize (this, e);
+ }
+
+ protected virtual void OnRightToLeftChanged (EventArgs e)
+ {
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, e);
+ }
+
+ protected virtual void OnSizeChanged (EventArgs e)
+ {
+ if (SizeChanged != null)
+ SizeChanged (this, e);
+ }
+
+ protected virtual void OnStyleChanged (EventArgs e)
+ {
+ if (StyleChanged != null)
+ StyleChanged (this, e);
+ }
+
+ protected virtual void OnSystemColorsChanged (EventArgs e)
+ {
+ if (SystemColorsChanged != null)
+ SystemColorsChanged (this, e);
+ }
+
+ protected virtual void OnTabIndexChanged (EventArgs e)
+ {
+ if (TabIndexChanged != null)
+ TabIndexChanged (this, e);
+ }
+
+ protected virtual void OnTabStopChanged (EventArgs e)
+ {
+ if (TabStopChanged != null)
+ TabStopChanged (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ if (TextChanged != null)
+ TextChanged (this, e);
+ }
+
+ //[MonoTODO] // this doesn't seem to be documented
+ // protected virtual void OnTextAlignChanged (EventArgs e) {
+ // TextAlignChanged (this, e);
+ // }
+
+ protected virtual void OnValidated (EventArgs e)
+ {
+ if (Validated != null)
+ Validated (this, e);
+ }
+
+ //[MonoTODO]
+ // CancelEventArgs not ready
+ //protected virtual void OnValidating(CancelEventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ protected virtual void OnVisibleChanged (EventArgs e)
+ {
+ if (VisibleChanged != null)
+ VisibleChanged (this, e);
+ }
+ // --- end of methods for events ---
+
+
+ [MonoTODO]
+ public void PerformLayout ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void PerformLayout (Control affectedControl,
+ string affectedProperty)
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Point PointToClient (Point p)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Point PointToScreen (Point p)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool PreProcessMessage (ref Message msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessCmdKey (ref Message msg,
+ Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessDialogChar (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessDialogKey (Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessKeyEventArgs (ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual bool ProcessKeyMessage (
+ ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessKeyPreview (ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessMnemonic (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // used when properties/values of Control
+ // are big enough to warrant recreating the HWND
+ protected void RecreateHandle()
+ {
+ CreateHandle ();
+
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Rectangle RectangleToClient (Rectangle r)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Rectangle RectangleToScreen (Rectangle r)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected static bool ReflectMessage (IntPtr hWnd,
+ ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public virtual void Refresh ()
+ {
+ //RECT rect = (RECT) null;
+ //InvalidateRect (Handle, ref rect, true);
+ Win32.UpdateWindow (Handle);
+ }
+
+ [MonoTODO]
+ public virtual void ResetBackColor ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetBindings ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void ResetFont ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void ResetForeColor ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetImeMode ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void ResetRightToLeft ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void ResetText ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResumeLayout ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResumeLayout (bool performLayout)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected ContentAlignment RtlTranslateAlignment (
+ ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected HorizontalAlignment RtlTranslateAlignment (
+ HorizontalAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected LeftRightAlignment RtlTranslateAlignment (
+ LeftRightAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected ContentAlignment RtlTranslateContent (
+ ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected HorizontalAlignment RtlTranslateHorizontal (
+ HorizontalAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected LeftRightAlignment RtlTranslateLeftRight (
+ LeftRightAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Scale (float ratio)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Scale (float dx,float dy)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void ScaleCore (float dx, float dy)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Select ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void Select (bool directed,bool forward)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool SelectNextControl (Control ctl, bool forward,
+ bool tabStopOnly,
+ bool nested, bool wrap)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public void SendToBack ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void SetBounds (int x, int y, int width, int height)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void SetBounds (int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void SetBoundsCore (
+ int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void SetClientSizeCore (int x, int y)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void SetStyle (ControlStyles flag, bool value)
+ {
+ //FIXME:
+ }
+
+ protected void SetTopLevel (bool value)
+ {
+ if (value)
+ // FIXME: verify on whether this is supposed
+ // to activate/deactive the window
+ Win32.SetWindowPos (Handle,
+ SetWindowPosZOrder.HWND_NOTOPMOST,
+ 0, 0, 0, 0, 0);
+ else
+ // FIXME: this does not make sense but
+ // the docs say the window is hidden
+ Win32.ShowWindow (Handle, ShowWindowStyles.SW_HIDE);
+ }
+
+ [MonoTODO]
+ protected virtual void SetVisibleCore (bool value)
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ public void Show ()
+ {
+ Win32.ShowWindow (Handle, ShowWindowStyles.SW_SHOW);
+ }
+
+ [MonoTODO]
+ public void SuspendLayout ()
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ public void Update ()
+ {
+ Win32.UpdateWindow (Handle);
+ }
+
+ [MonoTODO]
+ protected void UpdateBounds ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void UpdateBounds (int x, int y, int width, int height)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void UpdateBounds (
+ int x, int y, int width, int height, int clientWidth,
+ int clientHeight)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void UpdateStyles ()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void UpdateZOrder ()
+ {
+ //FIXME:
+ }
+
+ // WndProc - calls appriate On... function for the give
+ // message
+ //
+ // These On... functions do not appear to be called by
+ // WndProc:
+ //
+ // background color/image handled by WinForms
+ // OnBackColorChanged
+ // OnBackgroundImageChanged
+ // OnForeColorChanged
+ // OnPaintBackground
+ //
+ // controls are added/removed by WinForms
+ // OnControlAdded
+ // OnControlRemoved
+ // OnCreateControl
+ //
+ // OnBindingContextChanged
+ // OnCausesValidationChanged
+ // OnChangeUICues
+ // OnContextMenuChanged
+ // OnRightToLeftChanged
+ // OnGiveFeedback
+ // OnLayout
+ // OnDockChanged
+ // OnCursorChanged
+ // OnTextAlignChanged
+ // OnValidated
+ // OnValidating
+ // OnTabIndexChanged
+ // OnTabStopChanged
+ // OnLocationChanged
+ //
+ // FIXME: may be one of the WM_IME_ messages
+ // OnImeModeChanged
+ //
+ // InvalidateRect is called by no Invalidate message exists
+ // OnInvalidated
+ //
+ // these messages ARE not called by WNDPROC according to docs
+ // OnParentBackColorChanged
+ // OnParentBackgroundImageChanged
+ // OnParentBindingContextChanged
+ // OnParentChanged
+ // OnParentEnabledChanged
+ // OnParentFontChanged
+ // OnParentForeColorChanged
+ // OnParentRightToLeftChanged
+ // OnParentVisibleChanged
+ //
+ protected virtual void WndProc(ref Message m)
+ {
+ EventArgs eventArgs = new EventArgs ();
+ // FIXME: paintEventArgs is not being created properly
+ // FIXME: Graphics does not have a public constructor, you must get one from .NET
+ //PaintEventArgs paintEventArgs = new PaintEventArgs (
+ // new Graphics(), new Rectangle());
+
+ switch (m.Msg) {
+
+ case Msg.WM_CREATE:
+ Console.WriteLine ("WM_CREATE");
+ OnHandleCreated (eventArgs);
+ break;
+ case Msg.WM_LBUTTONDBLCLK:
+ OnDoubleClick (eventArgs);
+ break;
+ // OnDragDrop
+ // OnDragEnter
+ // OnDragLeave
+ // OnDragOver
+ // OnQueryContinueDrag
+ case Msg.WM_ENABLE:
+ OnEnabledChanged (eventArgs);
+ break;
+ case Msg.WM_SETFOCUS:
+ OnEnter (eventArgs);
+ OnGotFocus (eventArgs);
+ break;
+ case Msg.WM_FONTCHANGE:
+ OnFontChanged (eventArgs);
+ break;
+ case Msg.WM_DESTROY:
+ OnHandleDestroyed (eventArgs);
+ break;
+ case Msg.WM_HELP:
+ // FIXME:
+ //OnHelpRequested (eventArgs);
+ break;
+ case Msg.WM_KEYDOWN:
+ // FIXME:
+ // OnKeyDown (eventArgs);
+ break;
+ case Msg.WM_CHAR:
+ // FIXME:
+ // OnKeyPress (eventArgs);
+ break;
+ case Msg.WM_KEYUP:
+ // FIXME:
+ // OnKeyUp (eventArgs);
+ break;
+ case Msg.WM_KILLFOCUS:
+ OnLeave (eventArgs);
+ OnLostFocus (eventArgs);
+ break;
+ case Msg.WM_LBUTTONDOWN:
+ // FIXME:
+ // OnMouseDown (eventArgs);
+ break;
+ case Msg.WM_MOUSEACTIVATE:
+ OnMouseEnter (eventArgs);
+ break;
+ case Msg.WM_MOUSEHOVER: // called by TrackMouseEvent
+ OnMouseHover (eventArgs);
+ break;
+ case Msg.WM_MOUSELEAVE: // called by TrackMouseEvent
+ OnMouseLeave (eventArgs);
+ break;
+ case Msg.WM_MOUSEMOVE:
+ // FIXME:
+ // OnMouseMove (eventArgs);
+ break;
+ case Msg.WM_LBUTTONUP:
+ // FIXME:
+ // OnMouseUp (eventArgs);
+ break;
+ case Msg.WM_MOUSEWHEEL:
+ // FIXME:
+ // OnMouseWheel (eventArgs);
+ break;
+ case Msg.WM_MOVE:
+ OnMove (eventArgs);
+ break;
+ case Msg.WM_NOTIFY:
+ // FIXME: get NM_CLICKED msg from pnmh
+ // OnClick (eventArgs);
+ // OnNotifyMessage (eventArgs);
+ case Msg.WM_PAINT:
+ //OnPaint (paintEventArgs);
+ break;
+ case Msg.WM_SIZE:
+ OnResize (eventArgs);
+ OnSizeChanged (eventArgs);
+ break;
+ case Msg.WM_STYLECHANGED:
+ OnStyleChanged (eventArgs);
+ break;
+ case Msg.WM_SYSCOLORCHANGE:
+ OnSystemColorsChanged (eventArgs);
+ break;
+ case Msg.WM_SETTEXT:
+ OnTextChanged (eventArgs);
+ break;
+ case Msg.WM_SHOWWINDOW:
+ OnVisibleChanged (eventArgs);
+ break;
+ // default:
+ // DefWndProc (ref m);
+ // break;
+ }
+ }
+
+ /// --- Control: events ---
+ public event EventHandler BackColorChanged;
+ public event EventHandler BackgroundImageChanged;
+ public event EventHandler BindingContextChanged;
+ public event EventHandler CausesValidationChanged;
+ public event UICuesEventHandler ChangeUICues;
+
+ //Compact Framework
+ public event EventHandler Click;
+
+ public event EventHandler ContextMenuChanged;
+ public event ControlEventHandler ControlAdded;
+ public event ControlEventHandler ControlRemoved;
+ public event EventHandler CursorChanged;
+ public event EventHandler DockChanged;
+ public event EventHandler DoubleClick;
+ public event DragEventHandler DragDrop;
+ public event DragEventHandler DragEnter;
+ public event EventHandler DragLeave;
+ public event DragEventHandler DragOver;
+
+ //Compact Framework
+ public event EventHandler EnabledChanged;
+
+ public event EventHandler Enter;
+ public event EventHandler FontChanged;
+ public event EventHandler ForeColorChanged;
+ public event GiveFeedbackEventHandler GiveFeedback;
+
+ //Compact Framework
+ public event EventHandler GotFocus;
+
+ public event EventHandler HandleCreated;
+ public event EventHandler HandleDestroyed;
+ public event HelpEventHandler HelpRequested;
+ public event EventHandler ImeModeChanged;
+ public event InvalidateEventHandler Invalidated;
+
+ //Compact Framework
+ public event KeyEventHandler KeyDown;
+
+ //Compact Framework
+ public event KeyPressEventHandler KeyPress;
+
+ //Compact Framework
+ public event KeyEventHandler KeyUp;
+
+ public event LayoutEventHandler Layout;
+ public event EventHandler Leave;
+ public event EventHandler LocationChanged;
+
+ //Compact Framework
+ public event EventHandler LostFocus;
+
+ //Compact Framework
+ public event MouseEventHandler MouseDown;
+
+ public event EventHandler MouseEnter;
+ public event EventHandler MouseHover;
+ public event EventHandler MouseLeave;
+
+ //Compact Framework
+ public event MouseEventHandler MouseMove;
+
+ //Compact Framework
+ public event MouseEventHandler MouseUp;
+
+ public event MouseEventHandler MouseWheel;
+ public event EventHandler Move;
+
+ //Compact Framework
+ public event PaintEventHandler Paint;
+
+ //Compact Framework
+ public event EventHandler ParentChanged;
+
+ public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
+ public event QueryContinueDragEventHandler QueryContinueDrag;
+
+ //Compact Framework
+ public event EventHandler Resize;
+
+ public event EventHandler RightToLeftChanged;
+ public event EventHandler SizeChanged;
+ public event EventHandler StyleChanged;
+ public event EventHandler SystemColorsChanged;
+ public event EventHandler TabIndexChanged;
+ public event EventHandler TabStopChanged;
+
+ //Compact Framework
+ public event EventHandler TextChanged;
+
+ public event EventHandler Validated;
+ //[MonoTODO]
+ // CancelEventHandler not yet defined
+ //public event CancelEventHandler Validating {
+
+ public event EventHandler VisibleChanged;
+
+ /// --- IWin32Window properties
+ public IntPtr Handle {
+ get {
+ if (window != null)
+ return window.Handle;
+ return (IntPtr) 0;
+ }
+ }
+
+ /// --- ISynchronizeInvoke properties ---
+ [MonoTODO]
+ public bool InvokeRequired {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// --- ISynchronizeInvoke methods ---
+ [MonoTODO]
+ public IAsyncResult BeginInvoke (Delegate method)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IAsyncResult BeginInvoke (Delegate method,
+ object[] args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object EndInvoke (IAsyncResult asyncResult)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public object Invoke (Delegate method)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //[MonoTODO]
+ public object Invoke (Delegate method, object[] args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// sub-class: Control.ControlAccessibleObject
+ /// <summary>
+ /// Provides information about a control that can be used by an accessibility application.
+ /// </summary>
+ public class ControlAccessibleObject : AccessibleObject {
+ // AccessibleObject not ready to be base class
+ /// --- ControlAccessibleObject.constructor ---
+ [MonoTODO]
+ public ControlAccessibleObject (Control ownerControl)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ /// --- ControlAccessibleObject Properties ---
+ [MonoTODO]
+ public override string DefaultAction {
+ get {
+ //FIXME:
+ return base.DefaultAction;
+ }
+ }
+
+ [MonoTODO]
+ public override string Description {
+ get {
+ //FIXME:
+ return base.Description;
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override string Help {
+ get {
+ //FIXME:
+ return base.Help;
+ }
+ }
+
+ [MonoTODO]
+ public override string KeyboardShortcut {
+ get {
+ //FIXME:
+ return base.KeyboardShortcut;
+ }
+ }
+
+ [MonoTODO]
+ public override string Name {
+ get {
+ //FIXME:
+ return base.Name;
+ }
+ set {
+ //FIXME:
+ base.Name = value;
+ }
+ }
+
+ [MonoTODO]
+ public Control Owner {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override AccessibleRole Role {
+ get {
+ //FIXME:
+ return base.Role;
+ }
+ }
+
+ /// --- ControlAccessibleObject Methods ---
+ [MonoTODO]
+ public override int GetHelpTopic(out string fileName)
+ {
+ //FIXME:
+ return base.GetHelpTopic(out fileName);
+ }
+
+ [MonoTODO]
+ public void NotifyClients (AccessibleEvents accEvent)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void NotifyClients (AccessibleEvents accEvent,
+ int childID)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ }
+
+ /// sub-class: Control.ControlCollection
+ /// <summary>
+ /// Represents a collection of Control objects
+ /// </summary>
+ public class ControlCollection : IList, ICollection, IEnumerable, ICloneable {
+
+ private ArrayList collection = new ArrayList ();
+ private Control owner;
+
+ /// --- ControlCollection.constructor ---
+ public ControlCollection (Control owner)
+ {
+ this.owner = owner;
+ }
+
+ /// --- ControlCollection Properties ---
+ public int Count {
+ get {
+ return collection.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return collection.IsReadOnly;
+ }
+ }
+
+ public virtual Control this [int index] {
+ get {
+ return (Control) collection[index];
+ }
+ }
+
+ public virtual void Add (Control value)
+ {
+ collection.Add (value);
+ }
+
+ public virtual void AddRange (Control[] controls)
+ {
+ collection.AddRange (controls);
+ }
+
+ public virtual void Clear ()
+ {
+ collection.Clear ();
+ }
+
+ public bool Contains (Control control)
+ {
+ return collection.Contains (control);
+ }
+
+ public void CopyTo (Array dest,int index)
+ {
+ collection.CopyTo (dest, index);
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ //FIXME:
+ return base.Equals(obj);
+ }
+
+ [MonoTODO]
+ public int GetChildIndex (Control child)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME:
+ return base.GetHashCode();
+ }
+
+ public int IndexOf (Control control)
+ {
+ return collection.IndexOf (control);
+ }
+
+ public virtual void Remove (Control value)
+ {
+ collection.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ collection.RemoveAt (index);
+ }
+
+ [MonoTODO]
+ public void SetChildIndex (Control child,int newIndex)
+ {
+ //FIXME:
+ }
+
+ /// --- ControlCollection.IClonable methods ---
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- ControlCollection.IList properties ---
+ bool IList.IsFixedSize {
+ get {
+ return collection.IsFixedSize;
+ }
+ }
+
+ object IList.this [int index] {
+ get {
+ return collection[index];
+ }
+ set {
+ collection[index] = value;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return collection.SyncRoot;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return collection.IsSynchronized;
+ }
+ }
+
+ /// --- ControlCollection.IList methods ---
+ int IList.Add (object control)
+ {
+ return collection.Add (control);
+ }
+
+ bool IList.Contains (object control)
+ {
+ return collection.Contains (control);
+ }
+
+ int IList.IndexOf (object control)
+ {
+ return collection.IndexOf (control);
+ }
+
+ void IList.Insert (int index,object value)
+ {
+ collection.Insert (index, value);
+ }
+
+ void IList.Remove (object control)
+ {
+ collection.Remove (control);
+ }
+ } // --- end of Control.ControlCollection ---
+ }
+ }
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs
new file mode 100644
index 00000000000..b9bf8b34856
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs
@@ -0,0 +1,78 @@
+//
+// System.Windows.Forms.ControlBindingsCollection.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the collection of data bindings for a control.
+ /// </summary>
+
+ [MonoTODO]
+ public class ControlBindingsCollection : BindingsCollection {
+
+ #region Constructors
+ protected internal ControlBindingsCollection() : base ()
+ {
+ }
+ #endregion
+
+ #region Properties
+ [MonoTODO]
+ public Control Control {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ // Commented out: bug in mcs, it has been now filed.
+// public Binding this[string propertyName] {
+// get { throw new NotImplementedException (); }
+// }
+ #endregion
+
+ #region Methods
+ /// following methods were not stubbed out, because they only support .NET framework:
+ /// - protected override void AddCore(Binding dataBinding);
+ /// - protected override void ClearCore();
+ /// - protected override void RemoveCore(Binding dataBinding);
+ public new void Add(Binding binding)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Binding Add(string propertyName,object dataSource,string dataMember)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public new void Remove(Binding binding)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public new void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs
new file mode 100644
index 00000000000..b520f595412
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Forms.ControlEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+
+// (C) Ximian, Inc., 2002
+
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Complete.
+ /// </summary>
+
+ public class ControlEventArgs : EventArgs {
+
+ #region Fields
+ Control control;
+ #endregion
+
+ public ControlEventArgs(Control control)
+ {
+ this.control = control;
+ }
+
+ #region Public Properties
+ public Control Control
+ {
+ get
+ {
+ return control;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs
new file mode 100644
index 00000000000..9e76e082256
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ControlEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ControlEventHandler (
+ object sender,
+ ControlEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs
new file mode 100644
index 00000000000..63172825fce
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs
@@ -0,0 +1,437 @@
+//
+// System.Windows.Forms.ControlPaint.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides methods used to paint common Windows controls and their elements.
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class ControlPaint {
+
+ #region Properties
+ [MonoTODO]
+ public static Color ContrastControlDark {
+
+ get { throw new NotImplementedException (); }
+ }
+ #endregion
+
+ #region Methods
+ /// following methods were not stubbed out, because they only support .NET framework:
+ /// - public static IntPtr CreateHBitmap16Bit(Bitmap bitmap,Color background)
+ /// - public static IntPtr CreateHBitmapColorMask(Bitmap bitmap,IntPtr monochromeMask);
+ /// - public static IntPtr CreateHBitmapTransparencyMask(Bitmap bitmap);
+ [MonoTODO]
+ public static Color Dark(Color baseColor)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Color Dark(Color baseColor,float percOfDarkDark)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Color DarkDark(Color baseColor)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void DrawBorder(
+ Graphics graphics) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void DrawBorder(
+ Graphics graphics,
+ Rectangle bounds,
+ Color leftColor,
+ int leftWidth,
+ ButtonBorderStyle leftStyle,
+ Color topColor,
+ int topWidth,
+ ButtonBorderStyle topStyle,
+ Color rightColor,
+ int rightWidth,
+ ButtonBorderStyle rightStyle,
+ Color bottomColor,
+ int bottomWidth,
+ ButtonBorderStyle bottomStyle) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics,
+ Rectangle rectangle) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics,
+ Rectangle rectangle,
+ Border3DStyle Style) {
+ //FIXME:
+
+ }
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics,
+ Rectangle rectangle,
+ Border3DStyle Style,
+ Border3DSide Sides) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics, int x) {
+ //FIXME:
+ }
+ //is this part of spec? I do not think so.
+ //[MonoTODO]
+ //public static void DrawBorder3D(
+ // Graphics graphics, int x) {
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ Border3DStyle style) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawBorder3D(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ Border3DStyle style,
+ Border3DSide sides) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawButton(
+ Graphics graphics,
+ Rectangle rectangle) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawButton(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawCaptionButton(
+ Graphics graphics,
+ Rectangle rectangle) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawCaptionButton(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ CaptionButton button,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawCheckBox(
+ Graphics graphics,
+ Rectangle rectangle) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawCheckBox(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawComboButton(
+ Graphics graphics,
+ Rectangle rectangle) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawComboButton(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawContainerGrabHandle(Graphics graphics,Rectangle bounds)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawFocusRectangle(
+ Graphics graphics,
+ Rectangle rectangle) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawFocusRectangle(
+ Graphics graphics,
+ Rectangle rectangle,
+ Color foreColor,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawGrabHandle(
+ Graphics graphics,
+ Rectangle rectangle,
+ bool primary,
+ bool enabled) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawGrid(
+ Graphics graphics,
+ Rectangle area,
+ Size pixelsBetweenDots,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawImageDisabled(
+ Graphics graphics,
+ Image image,
+ int x,
+ int y,
+ Color background) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawLockedFrame(
+ Graphics graphics,
+ Rectangle rectangle,
+ bool primary) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawMenuGlyph(
+ Graphics graphics,
+ Rectangle rectangle,
+ MenuGlyph glyph) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawMenuGlyph(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ MenuGlyph glyph) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawMixedCheckBox(
+ Graphics graphics,
+ Rectangle rectangle,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawMixedCheckBox(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawRadioButton(
+ Graphics graphics,
+ Rectangle rectangle,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawRadioButton(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawReversibleFrame(
+ Rectangle rectangle,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawReversibleLine(
+ Point start,
+ Point end,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawScrollButton(
+ Graphics graphics,
+ Rectangle rectangle,
+ ScrollButton button) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawScrollButton(
+ Graphics graphics,
+ int x,
+ int y,
+ int width,
+ int height,
+ ScrollButton button,
+ ButtonState state) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawSelectionFrame(
+ Graphics graphics,
+ bool active,
+ Rectangle outsideRect,
+ Rectangle insideRect,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawSizeGrip(
+ Graphics graphics,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawSizeGrip(
+ Graphics graphics,
+ Color backColor,
+ int x,
+ int y,
+ int width,
+ int height) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void DrawStringDisabled(
+ Graphics graphics,
+ string s,
+ Font font,
+ Color color,
+ RectangleF layoutRectangle,
+ StringFormat format) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void FillReversibleRectangle(
+ Rectangle rectangle,
+ Color backColor) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static Color Light(Color baseColor)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Color Light(Color baseColor,float percOfLightLight)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Color LightLight(Color baseColor)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlStyles.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlStyles.cs
new file mode 100644
index 00000000000..e2035daf253
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlStyles.cs
@@ -0,0 +1,32 @@
+//
+// System.Windows.Forms.ControlStyles.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ControlStyles {
+ AllPaintingInWmPaint = 8192,
+ CacheText = 16384,
+ ContainerControl = 1,
+ DoubleBuffer = 65536,
+ EnableNotifyMessage = 32768,
+ FixedHeight = 64,
+ FixedWidth = 32,
+ Opaque = 4,
+ ResizeRedraw = 16,
+ Selectable = 512,
+ StandardClick = 256,
+ StandardDoubleClick = 4096,
+ SupportsTransparentBackColor = 2045,
+ UserMouse = 1024,
+ UserPaint = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs
new file mode 100644
index 00000000000..39ca63f8e31
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Windows.Forms.ConvertEventArgs.cs
+//
+// Author:
+// Stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Finished by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the Format and Parse events.
+ /// </summary>
+
+ public class ConvertEventArgs : EventArgs {
+
+ #region Fields
+
+ private Type desiredtype;
+ private object objectvalue;
+
+ #endregion
+
+ //Constructor
+ public ConvertEventArgs(object objectValue,Type desiredType)
+ {
+ this.desiredtype = desiredType;
+ this.objectvalue = objectValue;
+ }
+
+ #region Public Properties
+
+ public Type DesiredType
+ {
+ get {
+ return desiredtype;
+ }
+ }
+
+ public object Value {
+ get {
+ return objectvalue;
+ }
+ set {
+ objectvalue = value;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs
new file mode 100644
index 00000000000..e135d03e295
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ConvertEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ConvertEventHandler (
+ object sender,
+ ConvertEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CreateParams.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CreateParams.cs
new file mode 100644
index 00000000000..636a7ba572b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CreateParams.cs
@@ -0,0 +1,109 @@
+//
+// System.Windows.Forms.CreateParams.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Encapsulates the information needed when creating a control.
+ /// </summary>
+
+ public class CreateParams {
+
+ #region Fields
+ private string caption;
+ private string className;
+ private int classStyle;
+ private int exStyle;
+ private int height;
+ private object param;
+ private IntPtr parent;
+ private int style;
+ private int width;
+ private int x;
+ private int y;
+ #endregion
+
+ #region Constructors
+ public CreateParams()
+ {
+ }
+ #endregion
+
+ #region Properties
+ public string Caption {
+ get { return caption; }
+ set { caption = value; }
+ }
+
+ public string ClassName {
+ get { return className; }
+ set { className = value; }
+ }
+
+ public int ClassStyle {
+ get { return classStyle; }
+ set { classStyle = value; }
+ }
+
+ public int ExStyle {
+ get { return exStyle; }
+ set { exStyle = value; }
+ }
+
+ public int Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public object Param {
+ get { return param; }
+ set { param = value; }
+ }
+
+ public IntPtr Parent {
+ get { return parent; }
+ set { parent = value; }
+ }
+
+ public int Style {
+ get { return style; }
+ set { style = value; }
+ }
+
+ public int Width {
+ get { return width; }
+ set { width = value; }
+ }
+
+ public int X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Y {
+ get { return y; }
+ set { y = value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CurrencyManager.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
new file mode 100644
index 00000000000..f28039e0263
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
@@ -0,0 +1,175 @@
+//
+// System.Windows.Forms.CurrencyManager.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Manages a list of Binding objects.
+ /// </summary>
+ [MonoTODO]
+ public class CurrencyManager : BindingManagerBase {
+
+ #region Fields
+ /* uncomment if needed
+ protected Type finalType;
+ protected int listposition;
+ */
+ internal int count = 0;
+ internal object current = null;
+ internal int position = 0;
+ #endregion
+
+ #region Properties
+ [MonoTODO]
+ public override int Count {
+ get {
+ return count;
+ }
+ }
+
+ [MonoTODO]
+ public override object Current {
+ get {
+ //FIXME:
+ return current;
+ }
+ }
+
+ [MonoTODO]
+ public IList List {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override int Position {
+
+ get {
+ //FIXME:
+ return position;
+ }
+ set {
+ //FIXME:
+ position = value;
+ }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public override void AddNew()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void CancelCurrentEdit()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void CheckEmpty()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void EndCurrentEdit()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override PropertyDescriptorCollection GetItemProperties()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override string GetListName(ArrayList listAccessors)
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ /// <methods for events>
+ [MonoTODO]
+ protected internal override void OnCurrentChanged(EventArgs e)
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnItemChanged(ItemChangedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /* this method only supports .NET framework
+ [MonoTODO]
+ protected virtual void OnPositionChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }*/
+ /// </methods for events>
+
+ [MonoTODO]
+ public void Refresh()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void RemoveAt(int index)
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void ResumeBinding()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void SuspendBinding()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void UpdateIsBinding()
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ #region Events
+ [MonoTODO]
+ public event ItemChangedEventHandler ItemChanged;
+ public event EventHandler MetaDataChanged; // .NET V1.1 Beta
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs
new file mode 100644
index 00000000000..e7d80b67d09
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs
@@ -0,0 +1,178 @@
+//
+// System.Windows.Forms.Cursor.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the image used to paint the mouse pointer.
+ /// </summary>
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class Cursor : IDisposable, ISerializable {
+
+ #region Fields
+ #endregion
+
+ #region Constructors
+ [MonoTODO]
+ public Cursor(IntPtr handle)
+ {
+
+ }
+
+ [MonoTODO]
+ public Cursor(Stream stream)
+ {
+
+ }
+
+ [MonoTODO]
+ public Cursor(string fileName)
+ {
+
+ }
+
+ [MonoTODO]
+ public Cursor(Type type,string resource)
+ {
+
+ }
+ #endregion
+
+ #region Properties
+ [MonoTODO]
+ public static Rectangle Clip {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor Current {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static Point Position {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Size Size {
+ get { throw new NotImplementedException (); }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public IntPtr CopyHandle()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Draw(Graphics g,Rectangle targetRect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DrawStretched(Graphics g,Rectangle targetRect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ //FIXME:
+ return base.Equals(obj);
+ }
+
+ [MonoTODO]
+ ~Cursor() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ //FIXME:
+ return base.GetHashCode();
+ }
+
+ [MonoTODO]
+ public static void Hide()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// ISerializable.GetObjectData only supports .NET framework:
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Show()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ #endregion
+
+ #region Operators
+ [MonoTODO]
+ public static bool operator ==(Cursor left, Cursor right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool operator !=(Cursor left, Cursor right)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CursorConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CursorConverter.cs
new file mode 100644
index 00000000000..f74f634d26f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CursorConverter.cs
@@ -0,0 +1,76 @@
+//
+// System.Windows.Forms.CursorConverter.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides a type converter to convert Cursor objects to and from various other representations.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public class CursorConverter : TypeConverter {
+
+ #region Constructors
+ [MonoTODO]
+ public CursorConverter()
+ {
+
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public override bool CanConvertFrom(ITypeDescriptorContext context,Type sourceType)
+ {
+ //FIXME:
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ [MonoTODO]
+ public override bool CanConvertTo(ITypeDescriptorContext context,Type destinationType)
+ {
+ //FIXME:
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ [MonoTODO]
+ public override object ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,object value)
+ {
+ //FIXME:
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo(ITypeDescriptorContext context,CultureInfo culture,object value,Type destinationType)
+ {
+ //FIXME:
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ [MonoTODO]
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValues(context);
+ }
+
+ [MonoTODO]
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValuesSupported(context);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursors.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursors.cs
new file mode 100644
index 00000000000..16a8e6db731
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursors.cs
@@ -0,0 +1,234 @@
+//
+// System.Windows.Forms.Cursors.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides a collection of Cursor objects for use by a Windows Forms application.
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class Cursors {
+
+ #region Properties
+ [MonoTODO]
+ public static Cursor AppStarting {
+
+ get {
+//HANDLE LoadImage(
+// HINSTANCE hinst, // handle to instance // = null
+// LPCTSTR lpszName, // image to load // = IDC_APPSTARTING
+// UINT uType, // image type //= IMAGE_CURSOR
+// int cxDesired, // desired width // = 0
+// int cyDesired, // desired height // = 0
+// UINT fuLoad // load options // = LR_DEFAULTSIZE || ??
+//);
+ //Cursor cursor = new Cursor(
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor Arrow {
+ // LPCTSTR lpszName, // image to load // = IDC_ARROW
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor Cross {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor Default {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor Hand {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor Help {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor HSplit {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor IBeam {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor No {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor NoMove2D {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor NoMoveHoriz {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor NoMoveVert {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanEast {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanNE {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanNorth {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanNW {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanSE {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanSouth {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanSW {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor PanWest {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor SizeAll {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor SizeNESW {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor SizeNS {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor SizeNWSE {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor SizeWE {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor UpArrow {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor VSplit {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Cursor WaitCursor {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataFormats.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataFormats.cs
new file mode 100644
index 00000000000..343c00675a9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataFormats.cs
@@ -0,0 +1,93 @@
+//
+// System.Windows.Forms.DataFormats
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides static (Shared in Visual Basic), predefined Clipboard format names.
+ /// Use them to identify the format of data that you store in an IDataObject.
+ /// </summary>
+
+ [MonoTODO]
+ public class DataFormats {
+
+ #region Fields
+ public static readonly string Bitmap="Bitmap";
+ public static readonly string CommaSeparatedValue="Csv";
+ public static readonly string Dib="DeviceIndependentBitmap";
+ public static readonly string Dif="DataInterchangeFormat";
+ public static readonly string EnhancedMetafile="EnhancedMetafile";
+ public static readonly string FileDrop="FileDrop";
+ public static readonly string Html="HTML Format";
+ public static readonly string Locale="Locale";
+ public static readonly string MetafilePict="MetaFilePict";
+ public static readonly string OemText="OEMText";
+ public static readonly string Palette="Palette";
+ public static readonly string PenData="PenData";
+ public static readonly string Riff="RiffAudio";
+ public static readonly string Rtf="Rich Text Format";
+ public static readonly string Serializable="WindowsForms10PersistentObject";
+ public static readonly string StringFormat="System.String";
+ public static readonly string Text="Text";
+ public static readonly string Tiff="TaggedImageFileFormat";
+ public static readonly string UnicodeText="UnicodeText";
+ public static readonly string WaveAudio="WaveAudio";
+ #endregion
+
+ #region Methods
+ /// <todo>
+ /// these methods will have to use Windows Registry to fetch the existing Format (id,name)
+ /// or create a new format with the given string/int
+ /// </todo>
+ [MonoTODO]
+ public static Format GetFormat(int id)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Format GetFormat(string format)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ /// sub-class: DataFormats.Format
+ /// <summary>
+ /// Represents a clipboard format type.
+ /// </summary>
+ public class Format {
+ int id;
+ string name;
+
+ #region Constructors
+ /// <note>
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// </note>
+ public Format (string name,int id)
+ {
+ this.id=id;
+ this.name=name;
+ }
+ #endregion
+
+ #region Methods
+ public int Id {
+ get { return id; }
+ }
+
+ public string Name {
+ get { return name; }
+ }
+ #endregion
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs
new file mode 100644
index 00000000000..47e6075929b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs
@@ -0,0 +1,1057 @@
+//
+// System.Windows.Forms.DataGrid
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Displays ADO.NET data in a scrollable grid.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public class DataGrid : Control, ISupportInitialize {
+
+ #region Fields
+ bool allowNavigation;
+ bool allowSorting;
+ Color alternatingBackColor;
+ Color backgroundColor;
+ BorderStyle borderStyle;
+ Color captionBackColor;
+ Font captionFont;
+ Color captionForeColor;
+ string captionText;
+ bool captionVisible;
+ bool columnHeadersVisible;
+ string dataMember;
+ bool flatMode;
+ Color gridLineColor;
+ DataGridLineStyle gridLineStyle;
+ Color headerBackColor;
+ Color headerForeColor;
+ Color linkColor;
+ Color linkHoverColor;
+ Color parentRowsBackColor;
+ Color parentRowsForeColor;
+ DataGridParentRowsLabelStyle parentRowsLabelStyle;
+ bool parentRowsVisible;
+ bool readOnly;
+ int rowHeaderWidth;
+ Color selectionBackColor;
+ Color selectionForeColor;
+ #endregion
+
+ #region Constructors
+ [MonoTODO]
+ public DataGrid()
+ {
+ // setting default values:
+ allowNavigation=true;
+ borderStyle = BorderStyle.FixedSingle;
+ captionBackColor = SystemColors.ActiveCaption;
+ captionForeColor = SystemColors.ActiveCaptionText;
+ captionText = "";
+ captionVisible = true;
+ columnHeadersVisible = true;
+ dataMember = "";
+ flatMode = true;
+ gridLineColor = SystemColors.Control;
+ gridLineStyle = DataGridLineStyle.Solid;
+ headerBackColor = SystemColors.Control;
+ headerForeColor = SystemColors.ControlText;
+ linkColor = SystemColors.HotTrack;
+ linkHoverColor = SystemColors.HotTrack;
+ parentRowsBackColor = SystemColors.Control;
+ parentRowsForeColor = SystemColors.WindowText;
+ parentRowsLabelStyle = DataGridParentRowsLabelStyle.Both;
+ parentRowsVisible = true;
+ readOnly = false;
+ rowHeaderWidth = 50;
+ selectionBackColor = SystemColors.ActiveCaption;
+ selectionForeColor = SystemColors.ActiveCaptionText;
+ }
+ #endregion
+
+ #region Properties
+ public bool AllowNavigation {
+ get {
+ return allowNavigation;
+ }
+ set {
+ allowNavigation=value;
+ }
+ }
+
+ public bool AllowSorting {
+ get {
+ return allowSorting;
+ }
+ set {
+ allowSorting=value;
+ }
+ }
+
+ public Color AlternatingBackColor {
+ get {
+ return alternatingBackColor;
+ }
+ set {
+ alternatingBackColor=value;
+ }
+ }
+
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public Color BackgroundColor {
+ get {
+ return backgroundColor;
+ }
+ set {
+ backgroundColor=value;
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+
+ public BorderStyle BorderStyle {
+ get {
+ return borderStyle;
+ }
+ set {
+ borderStyle=value;
+ }
+ }
+
+ public Color CaptionBackColor {
+ get {
+ return captionBackColor;
+ }
+ set {
+ captionBackColor=value;
+ }
+ }
+
+ public Font CaptionFont {
+ get {
+ return captionFont;
+ }
+ set {
+ captionFont=value;
+ }
+ }
+
+ public Color CaptionForeColor {
+ get {
+ return captionForeColor;
+ }
+ set {
+ captionForeColor=value;
+ }
+ }
+
+ public string CaptionText {
+ get {
+ return captionText;
+ }
+ set {
+ captionText=value;
+ }
+ }
+
+ public bool CaptionVisible {
+ get {
+ return captionVisible;
+ }
+ set {
+ captionVisible=value;
+ }
+ }
+
+ public bool ColumnHeadersVisible {
+ get {
+ return columnHeadersVisible;
+ }
+ set {
+ columnHeadersVisible=value;
+ }
+ }
+
+ [MonoTODO]
+ public DataGridCell CurrentCell {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int CurrentRowIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override Cursor Cursor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public string DataMember {
+ get { return dataMember; }
+ set { dataMember=value; }
+ }
+
+ [MonoTODO]
+ public object DataSource {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ //FIXME: verify numbers
+ return new Size(300,200);
+ }
+ }
+
+ [MonoTODO]
+ public int FirstVisibleColumn {
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool FlatMode {
+ get { return flatMode; }
+ set { flatMode=value; }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+
+ public Color GridLineColor {
+ get { return gridLineColor; }
+ set { gridLineColor=value; }
+ }
+
+ public DataGridLineStyle GridLineStyle {
+ get { return gridLineStyle; }
+ set { gridLineStyle=value; }
+ }
+
+ public Color HeaderBackColor {
+ get { return headerBackColor; }
+ set {
+ if (value==Color.Empty) throw new ArgumentNullException();
+ headerBackColor=value;
+ }
+ }
+
+ public Color HeaderForeColor {
+ get { return headerForeColor; }
+ set { headerForeColor=value; }
+ }
+
+ [MonoTODO]
+ protected ScrollBar HorizScrollBar {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[DataGridCell cell] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[int rowIndex,int columnIndex] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public Color LinkColor {
+ get { return linkColor; }
+ set { linkColor=value; }
+ }
+
+ public Color LinkHoverColor {
+ get { return linkHoverColor; }
+ set { linkHoverColor=value; }
+ }
+
+ [MonoTODO]
+ protected internal CurrencyManager ListManager {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public Color ParentRowsBackColor {
+ get { return parentRowsBackColor; }
+ set { parentRowsBackColor=value; }
+ }
+
+ public Color ParentRowsForeColor {
+ get { return parentRowsForeColor; }
+ set { parentRowsForeColor=value; }
+ }
+
+ public DataGridParentRowsLabelStyle ParentRowsLabelStyle {
+ get { return parentRowsLabelStyle; }
+ set { parentRowsLabelStyle=value; }
+ }
+
+ public bool ParentRowsVisible {
+ get { return parentRowsVisible; }
+ set { parentRowsVisible=value; }
+ }
+
+ [MonoTODO]
+ public int PreferredColumnWidth {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int PreferredRowHeight {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly=value; }
+ }
+
+ [MonoTODO]
+ public bool RowHeadersVisible {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int RowHeaderWidth {
+ get { return rowHeaderWidth; }
+ set { rowHeaderWidth=value; }
+ }
+
+ public Color SelectionBackColor {
+ get { return selectionBackColor; }
+ set { selectionBackColor=value; }
+ }
+
+ public Color SelectionForeColor {
+ get { return selectionForeColor; }
+ set { selectionForeColor=value; }
+ }
+
+ [MonoTODO]
+ public override ISite Site {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public GridTableStylesCollection TableStyles {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+
+ [MonoTODO]
+ protected ScrollBar VertScrollBar {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int VisibleColumnCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int VisibleRowCount {
+ get { throw new NotImplementedException (); }
+ }
+ #endregion
+
+ #region Methods
+ /* Following members support the .NET Framework infrastructure and are not intended to be used directly from your code.
+ * Methods not stubbed out:
+ - protected virtual string GetOutputTextDelimiter()
+ - public void ResetLinkHoverColor()
+ - public void SubObjectsSiteChange(bool site)
+ */
+ [MonoTODO]
+ public bool BeginEdit(DataGridColumnStyle gridColumn,int rowNumber)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void BeginInit()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void CancelEditing()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Collapse(int row)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void ColumnStartedEditing(Control editingControl)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void ColumnStartedEditing(Rectangle bounds)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ //FIXME:
+ return base.CreateAccessibilityInstance();
+ }
+
+ [MonoTODO]
+ protected virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop,bool isDefault)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool EndEdit(DataGridColumnStyle gridColumn,int rowNumber,bool shouldAbort)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void EndInit()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public Rectangle GetCellBounds(DataGridCell dgc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Rectangle GetCellBounds(int row,int col)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Rectangle GetCurrentCellBounds()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void GridHScrolled(object sender,ScrollEventArgs se)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void GridVScrolled(object sender,ScrollEventArgs se)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public HitTestInfo HitTest(Point position)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public HitTestInfo HitTest(int x,int y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsExpanded(int rowNumber)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsSelected(int row)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void NavigateBack()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void NavigateTo(int rowNumber,string relationName)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnAllowNavigationChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void OnBackButtonClicked(object sender,EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnBackColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnBackgroundColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnBindingContextChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnBindingContextChanged(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnBorderStyleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnCaptionVisibleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnCurrentCellChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnDataSourceChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnEnter(EventArgs e)
+ {
+ //FIXME:
+ base.OnEnter(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnFlatModeChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnForeColorChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnForeColorChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleDestroyed(e);
+ }
+
+ [MonoTODO]
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyDown(e);
+ }
+
+ [MonoTODO]
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyPress(e);
+ }
+
+ [MonoTODO]
+ protected override void OnLayout(LayoutEventArgs e)
+ {
+ //FIXME:
+ base.OnLayout(e);
+ }
+
+ [MonoTODO]
+ protected override void OnLeave(EventArgs e)
+ {
+ //FIXME:
+ base.OnLeave(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseDown(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ //FIXME:
+ base.OnMouseLeave(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseMove(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseUp(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseWheel(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseWheel(e);
+ }
+
+ [MonoTODO]
+ protected void OnNavigate(NavigateEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaint(e);
+ }
+
+ [MonoTODO]
+ protected override void OnPaintBackground(PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaintBackground(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnParentRowsLabelStyleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnParentRowsVisibleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnReadOnlyChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected void OnRowHeaderClick(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void OnScroll(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void OnShowParentDetailsButtonClicked(object sender,EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ //FIXME:
+ return base.ProcessDialogKey(keyData);
+ }
+
+ [MonoTODO]
+ protected bool ProcessGridKey(KeyEventArgs ke)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ProcessKeyPreview(ref Message m)
+ {
+ //FIXME:
+ return base.ProcessKeyPreview(ref m);
+ }
+
+ [MonoTODO]
+ protected bool ProcessTabKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResetAlternatingBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void ResetBackColor()
+ {
+ //FIXME:
+ base.ResetBackColor();
+ }
+
+ [MonoTODO]
+ public override void ResetForeColor()
+ {
+ //FIXME:
+ base.ResetForeColor();
+ }
+
+ [MonoTODO]
+ public void ResetGridLineColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderFont()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderForeColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetLinkColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void ResetSelection()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetSelectionBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetSelectionForeColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Select(int row)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void SetDataBinding(object dataSource,string dataMember)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeAlternatingBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeBackgroundColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeCaptionBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeCaptionForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeGridLineColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeHeaderBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool ShouldSerializeHeaderFont()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeHeaderForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeLinkHoverColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeParentRowsBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeParentRowsForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool ShouldSerializePreferredRowHeight()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool ShouldSerializeSelectionBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeSelectionForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void UnSelect(int row)
+ {
+ //FIXME:
+ }
+ #endregion
+
+ #region Events
+ public event EventHandler AllowNavigationChanged;
+ public event EventHandler BackButtonClick;
+ public event EventHandler BackgroundColorChanged;
+ public event EventHandler BorderStyleChanged;
+ public event EventHandler CaptionVisibleChanged;
+ public event EventHandler CurrentCellChanged;
+ public event EventHandler DataSourceChanged;
+ public event EventHandler FlatModeChanged;
+ public event NavigateEventHandler Navigate;
+ public event EventHandler ParentRowsLabelStyleChanged;
+ public event EventHandler ParentRowsVisibleChanged;
+ public event EventHandler ReadOnlyChanged;
+ protected event EventHandler RowHeaderClick;
+ public event EventHandler Scroll;
+ public event EventHandler ShowParentDetailsButtonClick;
+ #endregion
+
+ /// sub-class: DataGrid.HitTestInfo
+ /// <summary>
+ /// Contains information about a part of the System.Windows.Forms.DataGrid at a specified coordinate. This class cannot be inherited.
+ /// </summary>
+ [MonoTODO]
+ public sealed class HitTestInfo {
+ #region DataGrid.HitTestInfo: Fields
+ [MonoTODO]
+ public static readonly DataGrid.HitTestInfo Nowhere;
+ #endregion
+
+ #region DataGrid.HitTestInfo: Properties
+ [MonoTODO]
+ public int Column {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Row {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public HitTestType Type {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion
+
+ /// sub-enumeration: DataGrid.HitTestType
+ /// <summary>
+ /// Specifies the part of the System.Windows.Forms.DataGrid control the user has clicked
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum HitTestType {
+ Caption = 32,
+ Cell = 1,
+ ColumnHeader = 2,
+ ColumnResize = 8,
+ None = 0,
+ ParentRows = 64,
+ RowHeader = 4,
+ RowResize = 16
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
new file mode 100644
index 00000000000..f0aa72ba6c2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
@@ -0,0 +1,175 @@
+//
+// System.Windows.Forms.DataGridBoolColumn
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies a column in which each cell contains a check box for representing a Boolean value.
+ /// </summary>
+
+ [MonoTODO]
+ public class DataGridBoolColumn : DataGridColumnStyle {
+
+ #region Fields
+ bool allowNull;
+ object falseValue;
+ object nullValue;
+ object trueValue;
+ #endregion
+
+ #region Constructor
+ [MonoTODO]
+ public DataGridBoolColumn()
+ {
+
+ }
+
+ [MonoTODO]
+ public DataGridBoolColumn(PropertyDescriptor prop)
+ {
+
+ }
+
+ /*
+ * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ [MonoTODO]
+ public DataGridBoolColumn(PropertyDescriptor prop,bool isDefault)
+ {
+ }
+ */
+ #endregion
+
+ #region Properties
+
+ public bool AllowNull {
+ get { return allowNull; }
+ set { allowNull=value; }
+ }
+
+ public object FalseValue {
+ get { return falseValue; }
+ set { falseValue=value; }
+ }
+
+ public object NullValue {
+ get { return nullValue; }
+ set { nullValue=value; }
+ }
+
+ public object TrueValue {
+ get { return trueValue; }
+ set { trueValue=value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ protected internal override void Abort(int rowNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override bool Commit(CurrencyManager dataSource,int rowNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void ConcedeFocus()
+ {
+ //FIXME:
+ base.ConcedeFocus();
+ }
+
+ [MonoTODO]
+ protected internal override void Edit(CurrencyManager source, int rowNum,
+ Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal override void EnterNullValue()
+ {
+ //FIXME:
+ base.EnterNullValue();
+ }
+
+ [MonoTODO]
+ protected internal override object GetColumnValueAtRow(CurrencyManager source,int rowNum)
+ {
+ //FIXME:
+ return base.GetColumnValueAtRow(source, rowNum);
+ }
+
+ [MonoTODO]
+ protected internal override int GetMinimumHeight()
+ {
+ //FIXME:made up number
+ return 20;
+ }
+
+ [MonoTODO]
+ protected internal override int GetPreferredHeight(Graphics g, object value)
+ {
+ //FIXME:made up number
+ return 300;
+ }
+
+ [MonoTODO]
+ protected internal override Size GetPreferredSize(Graphics g, object value)
+ {
+ //FIXME:made up number
+ return new Size(300,300);
+ }
+
+ [MonoTODO]
+ protected internal override void Paint(Graphics g, Rectangle bounds,
+ CurrencyManager source, int rowNum) {
+ //FIXME:made up number
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void Paint(Graphics g, Rectangle bounds,
+ CurrencyManager source, int rowNum, bool alignToRight) {
+
+ //return base.Paint(g, bounds, source, rowNum,
+ }
+
+ [MonoTODO]
+ protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source,
+ int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal override void SetColumnValueAtRow(CurrencyManager source,int rowNum, object value)
+ {
+ //FIXME:
+ base.SetColumnValueAtRow(source, rowNum, value);
+ }
+ #endregion
+
+ #region Events
+ [MonoTODO]
+ public event EventHandler AllowNullChanged;
+
+ [MonoTODO]
+ public event EventHandler FalseValueChanged;
+
+ [MonoTODO]
+ protected event EventHandler TrueValueChanged;
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs
new file mode 100644
index 00000000000..9fc0c2a3b23
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs
@@ -0,0 +1,132 @@
+//
+// System.Windows.Forms.DataGridCell.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public struct DataGridCell {
+
+ private int rownumber;
+ private int columnnumber;
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+
+ public DataGridCell (int r, int c)
+ {
+ rownumber = r;
+ columnnumber = c;
+ }
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <remarks>
+ /// Compares two DataGridCell objects. The return value is
+ /// based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
+ /// </remarks>
+
+ public static bool operator == (DataGridCell dgc_a,
+ DataGridCell dgc_b) {
+
+ return ((dgc_a.rownumber == dgc_b.rownumber) &&
+ (dgc_a.columnnumber == dgc_b.columnnumber));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DataGridCell objects. The return value is
+ /// based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
+ /// </remarks>
+ public static bool operator != (DataGridCell dgc_a,
+ DataGridCell dgc_b) {
+ return ((dgc_a.rownumber != dgc_b.rownumber) ||
+ (dgc_a.columnnumber != dgc_b.columnnumber));
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+
+ public int RowNumber {
+ get{
+ return rownumber;
+ }
+ set{
+ rownumber = value;
+ }
+ }
+
+ public int ColumeNumber {
+ get{
+ return columnnumber;
+ }
+ set{
+ columnnumber = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this DataGridCell and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DataGridCell))
+ return false;
+
+ return (this == (DataGridCell) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return (int)( rownumber ^ columnnumber);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the DataGridCell as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", rownumber, columnnumber );
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
new file mode 100644
index 00000000000..c2efd99c773
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
@@ -0,0 +1,254 @@
+//
+// System.Windows.Forms.DataGridColumnStyle
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies the appearance and text formatting and behavior of a System.Windows.Forms.DataGrid control column. This class is abstract.
+ /// </summary>
+
+ [MonoTODO]
+ public abstract class DataGridColumnStyle : Component, IDataGridColumnStyleEditingNotificationService {
+
+ #region Fields
+ HorizontalAlignment alignment;
+ DataGridTableStyle dataGridTableStyle;
+ int fontHeight;
+ string headerText;
+ string mappingName;
+ string nullText;
+ PropertyDescriptor propertyDescriptor;
+ bool readOnly;
+ int width;
+ #endregion
+
+ #region Constructors
+ [MonoTODO]
+ public DataGridColumnStyle()
+ {
+ alignment=HorizontalAlignment.Left;
+ dataGridTableStyle=null;
+ fontHeight=-1;
+ headerText="";
+ readOnly=false;
+ }
+
+ [MonoTODO]
+ public DataGridColumnStyle(PropertyDescriptor prop) : this()
+ {
+ propertyDescriptor=prop;
+ }
+ #endregion
+
+ #region Properties
+ public virtual HorizontalAlignment Alignment {
+ get { return alignment; }
+ set { alignment=value; }
+ }
+
+ public virtual DataGridTableStyle DataGridTableStyle {
+ get { return dataGridTableStyle; }
+ }
+
+ protected int FontHeight {
+ get { return fontHeight; }
+ }
+ /*
+ * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ public AccessibleObject HeaderAccessibleObject {get;}
+ */
+
+ public virtual string HeaderText {
+ get { return headerText; }
+ set { headerText=value; }
+ }
+
+ public string MappingName {
+ get { return mappingName; }
+ set { mappingName=value; }
+ }
+
+ public virtual string NullText {
+ get { return nullText; }
+ set { nullText=value; }
+ }
+
+ public virtual PropertyDescriptor PropertyDescriptor {
+ get { return propertyDescriptor; }
+ set { propertyDescriptor=value; }
+ }
+
+ public virtual bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly=value; }
+ }
+
+ public virtual int Width {
+ get { return width; }
+ set { width=value; }
+ }
+ #endregion
+
+ #region Methods
+ protected internal abstract void Abort(int rowNum);
+
+ [MonoTODO]
+ protected void BeginUpdate()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void CheckValidDataSource(CurrencyManager value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void ColumnStartedEditing(Control editingControl)
+ {
+ //FIXME:
+ }
+
+ protected internal abstract bool Commit(CurrencyManager dataSource,int rowNum);
+
+ [MonoTODO]
+ protected internal virtual void ConcedeFocus()
+ {
+ //FIXME:
+ }
+
+ /*
+ * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ protected virtual AccessibleObject CreateHeaderAccessibleObject()
+ */
+
+ [MonoTODO]
+ protected internal virtual void Edit(CurrencyManager source) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void Edit(CurrencyManager source, int rowNum) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal abstract void Edit(CurrencyManager source, int rowNum, Rectangle bounds,
+ bool readOnly, string instantText, bool cellIsVisible);
+
+ [MonoTODO]
+ protected void EndUpdate()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void EnterNullValue()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual object GetColumnValueAtRow(CurrencyManager source,int rowNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected internal abstract int GetMinimumHeight();
+
+ protected internal abstract int GetPreferredHeight(Graphics g,object value);
+
+ protected internal abstract Size GetPreferredSize(Graphics g,object value);
+
+ /*
+ * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ */
+ [MonoTODO]
+ void IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing(Control editingControl)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void Invalidate()
+ {
+ //FIXME:
+ }
+
+ protected internal abstract void Paint(Graphics g,Rectangle bounds,CurrencyManager source,int rowNum);
+
+ protected internal abstract void Paint(Graphics g,Rectangle bounds,CurrencyManager source,int rowNum,bool alignToRight);
+
+ [MonoTODO]
+ protected internal virtual void Paint(Graphics g, Rectangle bounds, CurrencyManager source,
+ int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderText()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void SetColumnValueAtRow(CurrencyManager source,int rowNum,object value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void SetDataGrid(DataGrid value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void SetDataGridInColumn(DataGrid value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected internal virtual void UpdateUI(CurrencyManager source,int rowNum,string instantText) {
+ //FIXME:
+ }
+ #endregion
+
+ #region Events
+
+ public event EventHandler AlignmentChanged;
+
+ /* This member supports the .NET Framework infrastructure and is not intended to be used directly from your code
+ public event EventHandler FontChanged;
+ */
+
+ public event EventHandler HeaderTextChanged;
+ public event EventHandler MappingNameChanged;
+ public event EventHandler NullTextChanged;
+ public event EventHandler PropertyDescriptorChanged;
+ public event EventHandler ReadOnlyChanged;
+ public event EventHandler WidthChanged;
+ #endregion
+
+ /// sub-classes:
+ /// This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ ///
+ /// protected class DataGridColumnStyle.CompModSwitches;
+ /// protected class DataGridColumnStyle.DataGridColumnHeaderAccessibleObject : AccessibleObject;
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs
new file mode 100644
index 00000000000..6d040da911e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.DataGridLineStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum DataGridLineStyle {
+ None = 0,
+ Solid = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs
new file mode 100644
index 00000000000..3f9d86b4d9f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.DataGridParentRowsLabelStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how the parent row labels of a DataGrid control are displayed.
+ /// </summary>
+ public enum DataGridParentRowsLabelStyle {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ TableName = 1,
+ ColumnName = 2,
+ Both = 3,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs
new file mode 100644
index 00000000000..f11031c35d8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.DataGridPreferredColumnWidthTypeConverter
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Converts the value of an object to a different data type.
+ /// </summary>
+
+ [MonoTODO]
+ public class DataGridPreferredColumnWidthTypeConverter : TypeConverter {
+
+ #region Constructors
+ [MonoTODO]
+ public DataGridPreferredColumnWidthTypeConverter()
+ {
+
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public override bool CanConvertFrom(ITypeDescriptorContext context,Type sourceType)
+ {
+ //FIXME:
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ [MonoTODO]
+ public override object ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,object value)
+ {
+ //FIXME:
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo(
+ ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType) {
+ //FIXME:
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ #endregion
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
new file mode 100644
index 00000000000..bfa8d5818c3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
@@ -0,0 +1,485 @@
+//
+// System.Windows.Forms.DataGridTableStyle
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the table drawn by the System.Windows.Forms.DataGrid control at run time.
+ /// </summary>
+
+ [MonoTODO]
+ public class DataGridTableStyle : Component {
+
+ #region Fields
+ // This member supports the .NET Framework infrastructure and is not intended to be used directly from your code:
+ // public static DataGridTableStyle DefaultTableStyle;
+ bool allowSorting;
+ Color alternatingBackColor;
+ Color backColor;
+ bool columnHeadersVisible;
+ DataGrid dataGrid;
+ Color foreColor;
+ Color gridLineColor;
+ DataGridLineStyle gridLineStyle;
+ Color headerBackColor;
+ Font headerFont;
+ Color headerForeColor;
+ Color linkColor;
+ string mappingName;
+ int preferredColumnWidth;
+ int preferredRowHeight;
+ bool readOnly;
+ bool rowHeadersVisible;
+ int rowHeaderWidth;
+ Color selectionBackColor;
+ Color selectionForeColor;
+ #endregion
+
+ #region Constructors
+ [MonoTODO]
+ public DataGridTableStyle()
+ {
+ allowSorting=true;
+ alternatingBackColor=SystemColors.Window;
+ gridLineStyle=DataGridLineStyle.Solid;
+ rowHeadersVisible=true;
+ }
+
+ // This member supports the .NET Framework infrastructure and is not intended to be used directly from your code:
+ // public DataGridTableStyle(bool isDefaultTableStyle);
+
+ [MonoTODO]
+ public DataGridTableStyle(CurrencyManager listManager) : this()
+ {
+
+ }
+ #endregion
+
+ #region Properties
+ public bool AllowSorting {
+ get { return allowSorting; }
+ set { allowSorting=value; }
+ }
+
+ public Color AlternatingBackColor {
+ get { return alternatingBackColor; }
+ set { alternatingBackColor=value; }
+ }
+
+ public Color BackColor {
+ get { return backColor; }
+ set { backColor=value; }
+ }
+
+ public bool ColumnHeadersVisible {
+ get { return columnHeadersVisible; }
+ set { columnHeadersVisible=value; }
+ }
+
+ public virtual DataGrid DataGrid {
+ get { return dataGrid; }
+ set { dataGrid=value; }
+ }
+
+ public Color ForeColor {
+ get { return foreColor; }
+ set { foreColor=value; }
+ }
+
+ [MonoTODO]
+ public virtual GridColumnStylesCollection GridColumnStyles {
+ get { throw new NotImplementedException (); }
+ }
+
+ public Color GridLineColor {
+ get { return gridLineColor; }
+ set { gridLineColor=value; }
+ }
+
+ public DataGridLineStyle GridLineStyle {
+ get { return gridLineStyle; }
+ set { gridLineStyle=value; }
+ }
+
+ public Color HeaderBackColor {
+ get { return headerBackColor; }
+ set { headerBackColor=value; }
+ }
+
+ public Font HeaderFont {
+ get { return headerFont; }
+ set { headerFont=value; }
+ }
+
+ public Color HeaderForeColor {
+ get { return headerForeColor; }
+ set { headerForeColor=value; }
+ }
+
+ public Color LinkColor {
+ get { return linkColor; }
+ set { linkColor=value; }
+ }
+
+ // This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ // public Color LinkHoverColor {get; set;}
+
+ public string MappingName {
+ get { return mappingName; }
+ set { mappingName=value; }
+ }
+
+ public int PreferredColumnWidth {
+ get { return preferredColumnWidth; }
+ set { preferredColumnWidth=value; }
+ }
+
+ public int PreferredRowHeight {
+ get { return preferredRowHeight; }
+ set { preferredRowHeight=value; }
+ }
+
+ public virtual bool ReadOnly {
+ get { return allowSorting; }
+ set { allowSorting=value; }
+ }
+
+ public bool RowHeadersVisible {
+ get { return rowHeadersVisible; }
+ set { rowHeadersVisible=value; }
+ }
+
+ [MonoTODO]
+ public int RowHeaderWidth {
+ get { return rowHeaderWidth; }
+ set { rowHeaderWidth=value; }
+ }
+
+ public Color SelectionBackColor {
+ get { return selectionBackColor; }
+ set { selectionBackColor=value; }
+ }
+
+ public Color SelectionForeColor {
+ get { return selectionForeColor; }
+ set { selectionForeColor=value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public bool BeginEdit(DataGridColumnStyle gridColumn,int rowNumber)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop,bool isDefault)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing)
+ {
+ //FIXME:
+ base.Dispose(disposing);;
+ }
+
+ [MonoTODO]
+ public bool EndEdit(DataGridColumnStyle gridColumn,int rowNumber,bool shouldAbort)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnAllowSortingChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnAlternatingBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnColumnHeadersVisibleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnForeColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnGridLineColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnGridLineStyleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnHeaderBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnHeaderFontChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnHeaderForeColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnLinkColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnLinkHoverColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnMappingNameChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnPreferredColumnWidthChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnPreferredRowHeightChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnReadOnlyChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnRowHeadersVisibleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnRowHeaderWidthChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectionBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectionForeColorChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetAlternatingBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetForeColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetGridLineColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderFont()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetHeaderForeColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetLinkColor()
+ {
+ //FIXME:
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ // public void ResetLinkHoverColor
+
+ [MonoTODO]
+ public void ResetSelectionBackColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetSelectionForeColor()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeAlternatingBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool ShouldSerializeBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool ShouldSerializeForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeGridLineColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeHeaderBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeHeaderForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeLinkColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// protected virtual bool ShouldSerializeLinkHoverColor();
+
+ [MonoTODO]
+ protected bool ShouldSerializePreferredRowHeight()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool ShouldSerializeSelectionBackColor()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ShouldSerializeSelectionForeColor()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ #region Events
+ public event EventHandler AllowSortingChanged ;
+ public event EventHandler AlternatingBackColorChanged;
+ public event EventHandler BackColorChanged;
+ public event EventHandler ColumnHeadersVisibleChanged;
+ public event EventHandler ForeColorChanged;
+ public event EventHandler GridLineColorChanged;
+ public event EventHandler GridLineStyleChanged;
+ public event EventHandler HeaderBackColorChanged;
+ public event EventHandler HeaderFontChanged;
+ public event EventHandler HeaderForeColorChanged;
+ public event EventHandler LinkColorChanged;
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public event EventHandler LinkHoverColorChanged;
+
+ public event EventHandler MappingNameChanged;
+ public event EventHandler PreferredColumnWidthChanged;
+ public event EventHandler PreferredRowHeightChanged;
+ public event EventHandler ReadOnlyChanged;
+ public event EventHandler RowHeadersVisibleChanged;
+ public event EventHandler RowHeaderWidthChanged;
+ public event EventHandler SelectionBackColorChanged;
+ public event EventHandler SelectionForeColorChanged;
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs
new file mode 100644
index 00000000000..7268953dae3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs
@@ -0,0 +1,78 @@
+//
+// System.Windows.Forms.DataGridTextBox
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a TextBox control that is hosted in a DataGridTextBoxColumn.
+ /// </summary>
+
+ [MonoTODO]
+ public class DataGridTextBox : TextBox {
+
+ #region Fields
+ bool isInEditOrNavigateMode;
+ #endregion
+
+ #region Constructor
+ [MonoTODO]
+ public DataGridTextBox()
+ {
+ isInEditOrNavigateMode=true;
+ }
+ #endregion
+
+ #region Properties
+ public bool IsInEditOrNavigateMode {
+ get { return isInEditOrNavigateMode; }
+ set { isInEditOrNavigateMode=value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyPress(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseWheel(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseWheel(e);
+ }
+
+ [MonoTODO]
+ protected internal override bool ProcessKeyMessage(ref Message m)
+ {
+ //FIXME:
+ return base.ProcessKeyMessage(ref m);
+ }
+
+ [MonoTODO]
+ public void SetDataGrid(DataGrid parentGrid)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
new file mode 100644
index 00000000000..32d158fd1db
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
@@ -0,0 +1,202 @@
+//
+// System.Windows.Forms.DataGridTextBoxColumn
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Drawing;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Hosts a TextBox control in a cell of a DataGridColumnStyle for editing strings.
+ // </summary>
+ public class DataGridTextBoxColumn : DataGridColumnStyle {
+
+ //
+ // --- Constructors/Destructors
+ //
+ [MonoTODO]
+ public DataGridTextBoxColumn() : base()
+ {
+
+ }
+ [MonoTODO]
+ public DataGridTextBoxColumn(PropertyDescriptor prop) : base(prop)
+ {
+
+ }
+ [MonoTODO]
+ public DataGridTextBoxColumn(PropertyDescriptor prop, bool isDefault) : base(prop)
+ {
+ // This method is internal to the .NET framework.
+
+ }
+ [MonoTODO]
+ public DataGridTextBoxColumn(PropertyDescriptor prop, string format) : base(prop)
+ {
+
+ }
+ [MonoTODO]
+ public DataGridTextBoxColumn(PropertyDescriptor prop, string format, bool isDefault) : base(prop)
+ {
+ // This method is internal to the .NET framework.
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected internal override void Abort(int rowNum)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected internal override bool Commit(CurrencyManager dataSource, int rowNum)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected internal override void ConcedeFocus()
+ {
+ //FIXME:
+ base.ConcedeFocus();
+ }
+ [MonoTODO]
+ protected internal override void Edit(CurrencyManager source, int rowNum, Rectangle bounds,
+ bool readOnly, string instantText, bool cellIsVisible) {
+
+ // This method is internal to the .NET framework.
+ throw new NotImplementedException ();
+ }
+// [MonoTODO]
+// //FIXME
+// protected internal virtual void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly)
+// {
+// // This method is internal to the .NET framework.
+// throw new NotImplementedException ();
+// }
+ [MonoTODO]
+ protected internal virtual void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText)
+ {
+ // This method is internal to the .NET framework.
+ //FIXME:
+ }
+ [MonoTODO]
+ protected void EndEdit()
+ {
+ // This method is internal to the .NET framework.
+ //FIXME:
+ }
+ [MonoTODO]
+ protected internal override void EnterNullValue()
+ {
+ //FIXME:
+ base.EnterNullValue();
+ }
+ [MonoTODO]
+ protected internal override int GetMinimumHeight()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected internal override int GetPreferredHeight(Graphics g, object value)
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected internal override Size GetPreferredSize(Graphics g, object value)
+ {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void HideEditBox()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum)
+ {
+ // This method is internal to the .NET framework.
+ //FIXME:
+ }
+ [MonoTODO]
+ protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
+ {
+ // This method is internal to the .NET framework.
+ //FIXME:
+ }
+ [MonoTODO]
+ protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum,
+ Brush backBrush, Brush foreBrush, bool alignToRight) {
+
+ // This method is internal to the .NET framework.
+ //FIXME:
+ }
+ [MonoTODO]
+ protected void PaintText(Graphics g, Rectangle bounds, string text, bool alignToRight)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected void PaintText(Graphics g, Rectangle textBounds, string text, Brush backBrush, Brush foreBrush, bool alignToRight)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void SetDataGridInColumn(DataGrid value)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected internal override void UpdateUI(CurrencyManager source, int rowNum, string instantText)
+ {
+ //FIXME:
+ }
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public string Format {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public IFormatProvider FormatInfo {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override PropertyDescriptor PropertyDescriptor {
+
+ set {
+ //FIXME:
+ base.PropertyDescriptor = value;
+ }
+ }
+ [MonoTODO]
+ public override bool ReadOnly {
+
+ get {
+ //FIXME:
+ return base.ReadOnly;
+ }
+ set {
+ //FIXME:
+ base.ReadOnly = value;
+ }
+ }
+ [MonoTODO]
+ public virtual TextBox TextBox {
+
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataObject.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataObject.cs
new file mode 100644
index 00000000000..767b4dc785f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataObject.cs
@@ -0,0 +1,115 @@
+//
+// System.Windows.Forms.DataObject
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Runtime.InteropServices;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Implements a basic data transfer mechanism.
+ // </summary>
+ [ClassInterface(ClassInterfaceType.None)]
+ public class DataObject : IDataObject {
+
+ //
+ // --- Constructors/Destructors
+ //
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public DataObject() : base()
+ {
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public DataObject(object data) : this()
+ {
+
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public DataObject(string format, object data) : this(data)
+ {
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual object GetData(string format)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual object GetData(Type format)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual object GetData(string format, bool autoConvert)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual bool GetDataPresent(string format)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual bool GetDataPresent(Type format)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual bool GetDataPresent(string format, bool autoConvert)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual string[] GetFormats()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual string[] GetFormats(bool autoConvert)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual void SetData(object data)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual void SetData(string format, object data)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual void SetData(Type format, object data)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ //[ClassInterface(ClassInterfaceType.None)]
+ public virtual void SetData(string format, bool autoConvert, object data)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs
new file mode 100644
index 00000000000..dcd58cae3c1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs
@@ -0,0 +1,47 @@
+//
+// System.Windows.Forms.DateBoldEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This class is internal to the .NET framework.
+ // </summary>
+ public class DateBoldEventArgs : EventArgs {
+
+ private int size;
+ private DateTime start;
+ private int [] daysToBold;
+
+ //
+ // --- Public Properties
+ //
+
+ DateBoldEventArgs(DateTime start, int size, int [] daysToBold){
+ this.size = size;
+ this.start = start;
+ this.daysToBold = daysToBold;
+ }
+
+ public int[] DaysToBold {
+
+ get { return daysToBold; }
+ set { daysToBold = value; }
+ }
+
+ public int Size {
+ get { return size; }
+ }
+
+ public DateTime StartDate {
+
+ get { return start; }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs
new file mode 100644
index 00000000000..5d15b74a599
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Windows.Forms.DateRangeEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Implemented by Richard Baumann <biochem333@nyc.rr.com>
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DateChanged or DateSelected events of the MonthCalendar control.
+ /// </summary>
+ public class DateRangeEventArgs : EventArgs {
+
+ #region Fields
+
+ private DateTime end;
+ private DateTime start;
+
+ #endregion
+
+ //
+ // --- Constructors/Destructors
+ //
+ public DateRangeEventArgs(DateTime start, DateTime end) : base()
+ {
+ this.start = start;
+ this.end = end;
+ }
+
+ #region Public Properties
+
+ public DateTime End
+ {
+ get {
+ return end;
+ }
+ }
+
+ public DateTime Start {
+ get {
+ return start;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs
new file mode 100644
index 00000000000..cfafde60d58
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.DateRangeEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void DateRangeEventHandler (
+ object sender,
+ DateRangeEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs
new file mode 100644
index 00000000000..c80aa0fb0ea
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs
@@ -0,0 +1,459 @@
+//
+// System.Windows.Forms.DateTimePicker
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Represents a Windows date-time picker control.
+ // </summary>
+ public class DateTimePicker : Control {
+
+ //
+ // --- Public Fields
+ //
+ public static readonly DateTime MaxDateTime;
+ public static readonly DateTime MinDateTime;
+
+ //
+ // --- Protected Fields
+ //
+ protected static readonly Color DefaultMonthBackColor;
+ protected static readonly Color DefaultTitleBackColor;
+ protected static readonly Color DefaultTitleForeColor;
+ protected static readonly Color DefaultTrailingForeColor;
+
+ //
+ // --- Private Fields
+ //
+ private Font calendarFont;
+ private Color calendarForeColor;
+ private Color calendarMonthBackground;
+ private Color calendarTitleBackColor;
+ private Color calendarTitleForeColor;
+ private Color calendarTrailingForeColor;
+ private bool CHecked;
+ private string customFormat;
+ private LeftRightAlignment dropDownAlign;
+ private DateTimePickerFormat format;
+ private DateTime maxDate;
+ private DateTime minDate;
+ private int preferredHeight;
+ private bool showCheckBox;
+ private bool showUpDown;
+ private DateTime value;
+
+ //
+ // --- Constructors/Destructors
+ //
+
+ [MonoTODO]
+ public DateTimePicker() : base()
+ {
+ // defaults :)
+ calendarForeColor = ForeColor;
+ calendarMonthBackground = DefaultMonthBackColor;
+ calendarTitleBackColor = DefaultTitleBackColor;
+ calendarTitleForeColor = DefaultTitleForeColor;
+ calendarTrailingForeColor = DefaultTrailingForeColor;
+ CHecked = true;
+ customFormat = null;
+ dropDownAlign = LeftRightAlignment.Left;
+ format = DateTimePickerFormat.Long;
+ maxDate = MaxDateTime;
+ minDate = MinDateTime;
+ showCheckBox = false;
+ showUpDown = false;
+ }
+
+ [MonoTODO]
+ static DateTimePicker()
+ {
+ MaxDateTime = new DateTime(9998,12,31,23,59,59);
+ MinDateTime = new DateTime(1753,1,1,0,0,0);
+ // As usual, the MS docs aren't very helpful...
+ // I'm guessing these are all the right colors... not sure though
+ // I'll check on Windows when I'm in a more masochistic mood ;)
+ DefaultMonthBackColor = System.Drawing.SystemColors.Window;
+ DefaultTitleBackColor = System.Drawing.SystemColors.ActiveCaption;
+ DefaultTitleForeColor = System.Drawing.SystemColors.ActiveCaptionText;
+ DefaultTrailingForeColor = System.Drawing.SystemColors.WindowText;
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ //FIXME:
+ return base.CreateAccessibilityInstance();;
+ }
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ //FIXME: Just to get it running
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected override void DestroyHandle()
+ {
+ //FIXME:
+ base.DestroyHandle();
+ }
+
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+
+ [MonoTODO]
+ protected virtual void OnCloseUp(EventArgs e)
+ {
+ if (CloseUp != null) {
+
+ CloseUp(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected virtual void OnDropDown(EventArgs e)
+ {
+ if (DropDown != null) {
+
+ DropDown(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME:
+ //if (FontChanged != null) {
+ // FontChanged(this, e);
+ //}
+ }
+
+ [MonoTODO]
+ protected virtual void OnFormatChanged(EventArgs e)
+ {
+ if (FormatChanged != null) {
+
+ FormatChanged(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected override void OnSystemColorsChanged(EventArgs e)
+ {
+ //FIXME:
+ //if (SystemColorsChanged != null) {
+ // SystemColorsChanged(this, e);
+ //}
+ }
+
+ [MonoTODO]
+ protected virtual void OnValueChanged(EventArgs e)
+ {
+ if (ValueChanged != null) {
+
+ ValueChanged(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ //FIXME:
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+
+
+ // --- Public Events
+
+ public event EventHandler CloseUp;
+ public event EventHandler DropDown;
+ public event EventHandler FormatChanged;
+ //public new event PaintEventHandler Paint; // This event is internal to the .NET framework.
+ public event EventHandler ValueChanged;
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public override Color BackColor {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Font CalendarFont {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color CalendarForeColor {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color CalendarMonthBackground {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color CalendarTitleBackColor {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color CalendarTitleForeColor {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color CalendarTrailingForeColor {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool Checked {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public string CustomFormat {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public LeftRightAlignment DropDownAlign {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ //FIXME: Just to get it to run
+ get {
+ return base.ForeColor;
+ }
+ set {
+ base.ForeColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public DateTimePickerFormat Format {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public DateTime MaxDate {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public DateTime MinDate {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int PreferredHeight {
+ get{
+ return 300;
+ }
+ }
+
+ [MonoTODO]
+ public bool ShowCheckBox {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool ShowUpDown {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ //FIXME: just to get it to run
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ [MonoTODO]
+ public DateTime Value {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "DATETIMEPICKER";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get{
+ return new System.Drawing.Size(200,20);//correct size.
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs
new file mode 100644
index 00000000000..b1262e48f3c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.DateTimePickerFormat.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// </summary>
+ public enum DateTimePickerFormat {
+ Custom = 8,
+ Long = 1,
+ Short = 2,
+ Time = 4
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs
new file mode 100644
index 00000000000..60590325c56
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs
@@ -0,0 +1,31 @@
+//
+// System.Windows.Forms.DialogResult.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies identifiers to indicate the return value of a dialog box.
+ /// </summary>
+ //LAMESPEC: Docs say serializable, verifer says no.
+ [ComVisible(true)]
+ public enum DialogResult {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ OK = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs
new file mode 100644
index 00000000000..c30cb28399e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.DockStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the position and manner in which a control is docked.
+ /// </summary>
+ public enum DockStyle {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ Top = 1,
+ Bottom = 2,
+ left = 3,
+ Right = 4,
+ Fill = 5,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DomainUpDown.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DomainUpDown.cs
new file mode 100644
index 00000000000..ce1aba40572
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DomainUpDown.cs
@@ -0,0 +1,187 @@
+//
+// System.Windows.Forms.DomainUpDown
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Collections;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Represents a Windows up-down control that displays string values.
+ // </summary>
+ public class DomainUpDown : UpDownBase {
+
+
+ // --- Constructors/Destructors
+
+ [MonoTODO]
+ public DomainUpDown() : base()
+ {
+ }
+
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override void DownButton()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ [MonoTODO]
+ public override void UpButton()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ //FIXME:
+ return base.CreateAccessibilityInstance();
+ }
+ //[MonoTODO]
+ //protected override void OnChanged(object source, EventArgs e)
+ //{
+ // //This method is internal to the .NET framework.
+ // if (Changed != null) {
+ //
+ // Changed(this, e);
+ // }
+ //}
+ [MonoTODO]
+ protected void OnSelectedItemChanged(object source, EventArgs e)
+ {
+ if (SelectedItemChanged != null) {
+
+ SelectedItemChanged(this, e);
+ }
+ }
+ [MonoTODO]
+ protected override void OnTextBoxKeyDown(object source, KeyEventArgs e)
+ {
+ throw new NotImplementedException ();
+ //if (TextBoxKeyDown != null) {
+ // TextBoxKeyDown(this, e);
+ //}
+ }
+ [MonoTODO]
+ protected override void UpdateEditText()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Events
+
+ public event EventHandler SelectedItemChanged;
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public DomainUpDown.DomainUpDownItemCollection Items {
+
+ get { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public int SelectedIndex{// default -1 {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public object SelectedItem{ // default null {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public bool Sorted{ // default false {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public bool Wrap{ // default false {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ //System.Windows.Forms.DomainUpDown.DomainUpDownItemCollection
+ //
+ //Author:
+ //stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+ //
+ //(C) Ximian, Inc., 2002
+ //
+ //<summary>
+ //Encapsulates a collection of objects for use by the DomainUpDown class.
+ //</summary>
+ public class DomainUpDownItemCollection : ArrayList {
+
+ //
+ // --- Constructors/Destructors
+ //
+ [MonoTODO]
+ internal DomainUpDownItemCollection(DomainUpDown owner) : base()
+ {
+
+ }
+
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override int Add(object value)
+ {
+ //FIXME:
+ return base.Add(value);
+ }
+ [MonoTODO]
+ public override void Insert(int index, object value)
+ {
+ //FIXME:
+ base.Insert(index, value);
+ }
+ [MonoTODO]
+ public override void Remove(object obj)
+ {
+ //FIXME:
+ base.Remove(obj);
+ }
+ [MonoTODO]
+ public override void RemoveAt(int index)
+ {
+ //FIXME:
+ base.RemoveAt(index);
+ }
+
+
+ // --- Public Properties
+
+ public override object this[int index] {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs
new file mode 100644
index 00000000000..3b3217bf1ee
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.DragAction.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how and if a drag-and-drop operation should continue.
+ /// </summary>
+
+ [ComVisible(true)]
+ public enum DragAction {
+
+ //Values were verified with enumcheck.
+ Continue = 0,
+ Drop = 1,
+ Cancel = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs
new file mode 100644
index 00000000000..dd3e0b6c537
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.DragDropEffects.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the effects of a drag-and-drop operation.
+ /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ public enum DragDropEffects {
+
+ None = 0,
+ Copy = 1,
+ Move = 2,
+ Link = 4,
+ Scroll = -2147483648,
+ All = -2147483645,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventArgs.cs
new file mode 100644
index 00000000000..411d5dbeaf6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventArgs.cs
@@ -0,0 +1,95 @@
+//
+// System.Windows.Forms.DragEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Implemented by Richard Baumann <biochem333@nyc.rr.com>
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DragDrop, DragEnter, or DragOver event.
+ /// </summary>
+ [ComVisible(true)]
+ public class DragEventArgs : EventArgs {
+
+ #region Fields
+ private DragDropEffects allowedEffect;
+ private IDataObject data;
+ private DragDropEffects effect;
+ private int keyState;
+ private int x;
+ private int y;
+ #endregion
+
+ //
+ // --- Constructors/Destructors
+ //
+ public DragEventArgs(IDataObject data, int keyState, int x, int y, DragDropEffects allowedEffect, DragDropEffects effect) : base()
+ {
+ this.data = data;
+ this.keyState = keyState;
+ this.x = x;
+ this.y = y;
+ this.allowedEffect = allowedEffect;
+ this.effect = effect;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public DragDropEffects AllowedEffect {
+ get {
+ return allowedEffect;
+ }
+ }
+
+ [ComVisible(true)]
+ public IDataObject Data {
+ get {
+ return data;
+ }
+ }
+
+ [ComVisible(true)]
+ public DragDropEffects Effect {
+ get {
+ return effect;
+ }
+ set {
+ effect = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public int KeyState {
+ get {
+ return keyState;
+ }
+ }
+
+ [ComVisible(true)]
+ public int X {
+ get {
+ return x;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Y {
+ get {
+ return y;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventHandler.cs
new file mode 100644
index 00000000000..40544380020
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.DragEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void DragEventHandler (
+ object sender,
+ DragEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs
new file mode 100644
index 00000000000..15d9a5d4c8e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs
@@ -0,0 +1,128 @@
+//
+// System.Windows.Forms.DrawItemEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Implemented by Richard Baumann <biochem333@nyc.rr.com>
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DrawItem event.
+ /// </summary>
+ public class DrawItemEventArgs : EventArgs {
+
+ #region Fields
+ private Color backColor;
+ private Rectangle bounds;
+ private Font font;
+ private Color foreColor;
+ private Graphics graphics;
+ private int index;
+ private DrawItemState state;
+ #endregion
+
+ //
+ // --- Constructors/Destructors
+ //
+
+ public DrawItemEventArgs(Graphics graphics, Font font, Rectangle bounds, int index, DrawItemState state) : base()
+ {
+ this.graphics = graphics;
+ this. font = font;
+ this. bounds = bounds;
+ this.index = index;
+ this.state = state;
+ foreColor = SystemColors.WindowText;
+ backColor = SystemColors.Window;
+ throw new NotImplementedException ();
+ }
+
+ public DrawItemEventArgs(Graphics graphics, Font font, Rectangle bounds, int index,
+ DrawItemState state, Color foreColor, Color backColor) : base()
+ {
+ this.graphics = graphics;
+ this. font = font;
+ this. bounds = bounds;
+ this.index = index;
+ this.state = state;
+ this.foreColor = foreColor;
+ this.backColor = backColor;
+ }
+
+ #region Public Methods
+
+ public virtual void DrawBackground()
+ {
+ SolidBrush temp = new SolidBrush(BackColor);
+ graphics.FillRectangle(temp,bounds);
+ temp.Dispose();
+ }
+
+ public virtual void DrawFocusRectangle()
+ {
+ if( (DrawItemState.Focus == (DrawItemState.Focus & state)) && // check for focus
+ (DrawItemState.NoFocusRect != (DrawItemState.NoFocusRect & state))){ // check if this matters {
+
+ ControlPaint.DrawFocusRectangle(graphics,bounds,foreColor,backColor);
+ }
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ public Color BackColor
+ {
+ get {
+ return (DrawItemState.Selected == (state & DrawItemState.Selected)) ? SystemColors.Highlight : backColor;
+ }
+ }
+
+ public Rectangle Bounds {
+ get {
+ return bounds;
+ }
+ }
+
+ public Font Font {
+ get {
+ return font;
+ }
+ }
+
+ public Color ForeColor {
+ get {
+ return (DrawItemState.Selected == (state & DrawItemState.Selected)) ? SystemColors.HighlightText : foreColor;
+ }
+ }
+
+ public Graphics Graphics {
+ get {
+ return graphics;
+ }
+ }
+
+ public int Index {
+ get {
+ return index;
+ }
+ }
+
+ public DrawItemState State {
+ get {
+ return state;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs
new file mode 100644
index 00000000000..1dcd3dad40a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.DrawItemEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void DrawItemEventHandler (
+ object sender,
+ DrawItemEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs
new file mode 100644
index 00000000000..4e40887123f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs
@@ -0,0 +1,35 @@
+//
+// System.Windows.Forms.DrawItemState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the state of an item that is being drawn.
+ /// this enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ public enum DrawItemState {
+
+ None = 0,
+ Selected = 1,
+ Grayed = 2,
+ Disabled = 4,
+ Checked = 8,
+ Focus = 16,
+ Default = 32,
+ HotLight = 64,
+ Inactive = 128,
+ NoAccelerator = 256,
+ NoFocusRect = 512,
+ ComboBoxEdit = 1024,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs
new file mode 100644
index 00000000000..31ea9357a63
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.DrawMode.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how the elements of a control are drawn.
+ /// </summary>
+
+ public enum DrawMode {
+
+ //Values were verified with enumcheck.
+ Normal = 0,
+ OwnerDrawFixed = 1,
+ OwnerDrawVariable = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs
new file mode 100644
index 00000000000..d89df62de85
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.ErrorBlinkStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies constants indicating when the error icon, supplied by an ErrorProvider,
+ /// should blink to alert the user that an error has occurred.
+ /// </summary>
+ public enum ErrorBlinkStyle {
+
+ //Values were verified with enumcheck.
+ BlinkIfDifferentError = 0,
+ AlwaysBlink = 1,
+ NeverBlink = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs
new file mode 100644
index 00000000000..20361f54333
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.ErrorIconAlignment.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies constants indicating the locations that an error icon can appear
+ /// in relation to the control with an error.
+ /// </summary>
+ public enum ErrorIconAlignment {
+
+ //Values were verified with enumcheck.
+ TopLeft = 0,
+ TopRight = 1,
+ MiddleLeft = 2,
+ MiddleRight = 3,
+ BottomLeft = 4,
+ BottomRight = 5,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs
new file mode 100644
index 00000000000..7fdd2db1356
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs
@@ -0,0 +1,163 @@
+//
+// System.Windows.Forms.ErrorProvider
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes(dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.Runtime.Remoting;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+using System.ComponentModel;
+ public class ErrorProvider : Component, IExtenderProvider {
+ internal string dataMember;
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ErrorProvider()
+ {
+ dataMember = "";
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override ISite Site {
+ set {
+ //FIXME:
+ base.Site = value;
+ }
+ }
+
+ [MonoTODO]
+ public int BlinkRate {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public ErrorBlinkStyle BlinkStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ internal ContainerControl cc;//FIXME: just to get it to run
+ [MonoTODO]
+ public ContainerControl ContainerControl {
+ get {
+ return cc;
+ }
+ set {
+ cc = value;
+ }
+ }
+
+ [MonoTODO]
+ public string DataMember {
+ get {
+ return dataMember;
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public object DataSource {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Icon Icon {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void BindToDataAndErrors(object newDataSource, string newDataMember)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool CanExtend(object extendee)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetError(Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ErrorIconAlignment GetIconAlignment(Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetIconPadding(Control control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object InitializeLifetimeService()
+ {
+ //FIXME:
+ return base.InitializeLifetimeService();
+ }
+ [MonoTODO]
+ public void SetError(Control control,string value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void SetIconAlignment(Control control, ErrorIconAlignment value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void SetIconPadding(Control control, int padding)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void UpdateBinding()
+ {
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs
new file mode 100644
index 00000000000..98ef17fe41f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs
@@ -0,0 +1,50 @@
+//
+// System.Windows.Forms.FeatureSupport.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public abstract class FeatureSupport : IFeatureSupport {
+
+ //
+ // --- Public Methods
+ //
+ //IFeatureSupport
+
+ [MonoTODO]
+ Version IFeatureSupport.GetVersionPresent(object feature) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IFeatureSupport.IsPresent(object feature){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IFeatureSupport.IsPresent(object feature, Version minimumVersion){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public abstract Version GetVersionPresent(object o);
+
+ //
+ // --- Protected Constructors
+ //
+ [MonoTODO]
+ protected FeatureSupport()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs
new file mode 100644
index 00000000000..d5a0365be76
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs
@@ -0,0 +1,188 @@
+//
+// System.Windows.Forms.FileDialog.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public abstract class FileDialog : CommonDialog {
+ internal string fileName = "";
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool AddExtension {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public virtual bool CheckFileExists {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool CheckPathExists {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string DefaultExt {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool DereferenceLinks {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string FileName {
+ get {
+ return fileName;
+ }
+ set {
+ fileName = value;
+ }
+ }
+ [MonoTODO]
+ public string[] FileNames {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string Filter {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int FilterIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string InitialDirectory {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool RestoreDirectory {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowHelp {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string Title {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ValidateNames {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+
+ [MonoTODO]
+ public override void Reset()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Public Events
+ //
+
+ public event CancelEventHandler FileOk;
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
+ {
+ //FIXME:
+ return base.HookProc(hWnd, msg, wparam, lparam);
+ }
+ [MonoTODO]
+ protected void OnFileOk( CancelEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override bool RunDialog( IntPtr hWndOwner)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs
new file mode 100644
index 00000000000..e81a92a8aa2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.FlatStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the appearance of a control.
+ /// </summary>
+ public enum FlatStyle {
+
+ //Values were verified with enumcheck.
+ Flat = 0,
+ Popup = 1,
+ Standard = 2,
+ System = 3,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
new file mode 100644
index 00000000000..952a357c4c5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
@@ -0,0 +1,121 @@
+//
+// System.Windows.Forms.FolderBrowserDialog.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+ using System.Runtime.Remoting;
+ using System.ComponentModel;
+
+
+ // Beta specs do not specify what class to defrive from.
+ // Using CommonDialog because
+ public class FolderBrowserDialog : CommonDialog {
+
+ string description;
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public FolderBrowserDialog() {
+ description = "";
+ }
+
+ [MonoTODO]
+ public override void Reset(){
+ //
+ }
+
+ [MonoTODO]
+ protected override bool RunDialog(IntPtr hWndOwner){
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ public string Description {
+ get {
+ return description;
+ }
+ set {
+ description = value;
+ }
+ }
+
+ //beta docs do not have accessor.
+ //protected bool DesignMode {
+ //}
+
+ //protected EventHandlerList Events {
+ //}
+
+ public Environment.SpecialFolder RootFolder {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public string SelectedPath {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public bool ShowNewFolderButton {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ //public virtual System.ComponentModel.IContainer Container {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ // FIXME: beta 1.1 says the following should be public virtual ISite Site {
+ // but the compiler gives warning that it must be new.
+ // Probably system.component needs to change to be beta 1.1 compliant
+ public new virtual ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //Specs seem to say they need to be here, but adding them conflicts with commondialog : component.disposed/helprequest
+ //public event EventHandler Disposed;
+ //public event EventHandler HelpRequest;
+
+ }
+}
+
+
+
+
+
+
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Font.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Font.cs
new file mode 100644
index 00000000000..128c2a1bfc2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Font.cs
@@ -0,0 +1,8 @@
+
+namespace System.Windows.Forms {
+ // allows code to compile without commenting out references
+ // to Font... to be removed
+
+ public class Font {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs
new file mode 100644
index 00000000000..248b9bba74b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs
@@ -0,0 +1,197 @@
+//
+// System.Windows.Forms.FontDialog.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class FontDialog : CommonDialog {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public FontDialog()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool AllowScriptChange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowSimululations {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowVectorForms {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowVerticalForms {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Color Color {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool FixedPitchOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Font Font {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool FontMustExist {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int MaxSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int MinSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ScriptsOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowApply {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowEffects {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowHelp {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override void Reset()
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event EventHandler Apply;
+
+ //
+ // --- Protected Properties
+ //
+
+ [MonoTODO]
+ protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
+ {
+ //FIXME:
+ return base.HookProc(hWnd, msg, wparam,lparam);
+ }
+ [MonoTODO]
+ protected override bool RunDialog(IntPtr hWndOwner)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs
new file mode 100644
index 00000000000..daa6c3e2cb6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs
@@ -0,0 +1,978 @@
+ //
+ // System.Windows.Forms.Form
+ //
+ // Author:
+ // Miguel de Icaza (miguel@ximian.com)
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ // Dennis Hayes (dennish@raytek.com)
+ // WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ using System;
+ using System.Drawing;
+ using System.ComponentModel;
+ using System.Collections;
+
+ namespace System.Windows.Forms {
+
+ public class Form : ContainerControl {
+ DialogResult dialogResult;
+ Size maximumSize;
+ Size minimizeSize;
+ double opacity;
+ // Temperary varibles that may be replaced
+ // with win32 functions
+
+ // owner draw
+ private bool controlBox;
+ private bool minimizeBox;
+ private bool maximizeBox;
+ private bool helpButton;
+ //end owner draw
+
+ FormBorderStyle formBorderStyle;
+
+ // End of temperay varibles
+
+ public Form () : base ()
+ {
+ opacity = 0;
+
+ }
+
+ static Form ()
+ {
+
+ }
+
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public IButtonControl AcceptButton {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public static Form ActiveForm {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form ActiveMdiChild {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool AutoScale {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ internal Size autoscalebasesize; //debug/test only
+
+ [MonoTODO]
+ public virtual Size AutoScaleBaseSize {
+ get {
+ return autoscalebasesize;
+ }
+ set {
+ autoscalebasesize = value;
+ }
+ }
+
+ public override bool AutoScroll {
+ get {
+ return base.AutoScroll;
+ }
+ set {
+ base.AutoScroll = value;
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ }
+ set {
+ base.BackColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public IButtonControl CancelButton {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public new Size ClientSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //bool MenuReady;
+ //if(mainMenu_
+ SetClientSize( value, (int)WindowStyles.WS_OVERLAPPEDWINDOW, mainMenu_ != null);
+ }
+ }
+
+ //Compact Framework
+ //FIXME:
+ // In .NET this can be changed at any time.
+ // In WIN32 this is fixed when the window is created.
+ // In WIN32 to change this after the window is created,
+ // like in .NET, we must draw the caption bar our self.
+ // In the mean time, just set/return a bool.
+ // This might be the start of the drawing
+ [MonoTODO]
+ public bool ControlBox {
+ get {
+ return controlBox;
+ }
+ set {
+ controlBox = value;
+ //force paint
+ }
+ }
+
+ [MonoTODO]
+ public Rectangle DesktopBounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Point DesktopLocation {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public DialogResult DialogResult {
+ get {
+ return dialogResult;
+ }
+ set {
+ dialogResult = value;
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public FormBorderStyle FormBorderStyle {
+ get {
+ return formBorderStyle;
+ }
+ set {
+ formBorderStyle = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool HelpButton {
+ get {
+ return helpButton;
+ }
+ set {
+ helpButton = value;
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ public Icon Icon {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool IsMidiChild {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool IsMidiContainer {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool KeyPreview {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public bool MaximizeBox {
+ get {
+ return maximizeBox;
+ }
+ set {
+ maximizeBox = value;
+ }
+ }
+
+ [MonoTODO]
+ public Size MaximumSize {
+ get {
+ return maximumSize;
+ }
+ set {
+ maximumSize = value;
+ }
+ }
+
+ [MonoTODO]
+ public Form[] MdiChildren {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Form MdiParent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ private MainMenu mainMenu_ = null;
+
+ private void assignMenu()
+ {
+ if( Handle != IntPtr.Zero ) {
+ // FIXME: If Form's window has no style for menu, probably, better to add it
+ // if menu have to be removed, remove the style.
+ // Attention to the repainting.
+ if( mainMenu_ != null) {
+// //long myStyle = Win32.GetWindowLongA( Handle, Win32.GWL_STYLE);
+// //myStyle |= (long)Win32.WS_OVERLAPPEDWINDOW;
+// //Win32.SetWindowLongA( Handle, Win32.GWL_STYLE, myStyle);
+ Win32.SetMenu( Handle, mainMenu_.Handle);
+ }
+ else {
+ Win32.SetMenu( Handle, IntPtr.Zero);
+ }
+ }
+ }
+
+ public MainMenu Menu {
+ get {
+ return mainMenu_;
+ }
+ set {
+ mainMenu_ = value;
+ assignMenu();
+ }
+ }
+
+ //[MonoTODO]
+ //public MainMenu MergedMenu {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //Compact Framework
+ [MonoTODO]
+ public bool MinimizeBox {
+ get {
+ return minimizeBox;
+ }
+ set {
+ minimizeBox = value;
+ }
+ }
+
+ [MonoTODO]
+ public Size MinimumSize {
+ get {
+ return maximumSize;
+ }
+ set {
+ maximumSize = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool Modal {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public double Opacity {
+ get {
+ return opacity;
+ }
+ set {
+ opacity = value;
+ }
+ }
+
+ [MonoTODO]
+ public Form[] OwnedForms {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form Owner {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool ShowInTaskbar {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ public override ISite Site {
+ get {
+ return base.Site;
+ }
+ set {
+ base.Site = value;
+ }
+ }
+
+ [MonoTODO]
+ public SizeGripStyle SizeGripStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public FormStartPosition StartPosition {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool TopLevel {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool TopMost {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color TransparencyKey {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ //Compact Framework
+ [MonoTODO]
+ public FormWindowState WindowState {
+ get {
+ WINDOWPLACEMENT placement = new WINDOWPLACEMENT();
+
+ //bool ReturnValue = Win32.GetWindowPlacement(Handle, ref placement ) ;
+ //if(placement.showCmd == SW_MINIMIZE){
+ // return FormWindowState.Minimized;
+ //}
+ //if(placement.showCmd == SW_MAXIMIZE){
+ // return FormWindowState.Maximized;
+ //}
+ return FormWindowState.Normal;
+ //Other options such as hide are possible in win32, but not in this part of .NET
+ // also this may not work because it looks like showCmd is for setting, and might not be set
+ // by win32 in a get.
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ // --- Public Methods
+ public void Activate ()
+ {
+ Win32.SetActiveWindow (Handle);
+ }
+
+ [MonoTODO]
+ public void AddOwnedForm (Form ownedForm)
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ public void Close ()
+ {
+ Win32.CloseWindow (Handle);
+ }
+
+ [MonoTODO]
+ public void LayoutMdi (MdiLayout value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void RemoveOwnedForm (Form ownedForm)
+ {
+ //FIXME:
+ }
+
+
+ public void SetDesktopLocation (int x, int y)
+ {
+ Win32.SetWindowPos ((IntPtr) Handle, SetWindowPosZOrder.HWND_TOPMOST,
+ x, y, 0, 0,
+ SetWindowPosFlags.SWP_NOSIZE |
+ SetWindowPosFlags.SWP_NOZORDER);
+ }
+
+
+ [MonoTODO]
+ public DialogResult ShowDialog ()
+ {
+ Win32.ShowWindow (Handle, ShowWindowStyles.SW_SHOW);
+ return new DialogResult();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ // --- Public Events
+
+ public event EventHandler Activated;
+
+ public event EventHandler Closed;
+
+ //Compact Framework
+ // CancelEventHandler not yet implemented/stubbed
+ //public event CancelEventHandler Closing;
+
+ public event EventHandler Deactivate;
+ public event InputLanguageChangedEventHandler InputLanguageChanged;
+ public event InputLanguageChangingEventHandler InputLanguageChanging;
+
+ //Compact Framework
+ public event EventHandler Load;
+
+ public event EventHandler MaximizedBoundsChanged;
+ public event EventHandler MaximumSizeChanged;
+ public event EventHandler MdiChildActivate;
+ public event EventHandler MenuComplete;
+ public event EventHandler MenuStart;
+ public event EventHandler MinimumSizedChanged;
+
+
+ // --- Protected Properties
+
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return base.DefaultImeMode;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(300,300);
+ }
+ }
+
+ [MonoTODO]
+ public new Size Size {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ protected Rectangle MaximizedBounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ // --- Protected Methods
+
+ protected override void AdjustFormScrollbars (
+ bool displayScrollbars)
+ {
+ base.AdjustFormScrollbars (displayScrollbars);
+ }
+
+ protected override Control.ControlCollection
+ CreateControlsInstance ()
+ {
+ return base.CreateControlsInstance ();
+ }
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+
+ if (IsHandleCreated)
+ OnHandleCreated (new EventArgs());
+ OnLoad(new EventArgs());
+ }
+
+ protected override void DefWndProc (ref Message m)
+ {
+ window.DefWndProc (ref m);
+ }
+
+ //Compact Framework
+ protected virtual void OnClosed (EventArgs e)
+ {
+ if (Closed != null)
+ Closed (this, e);
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ protected virtual void OnClosing(CancelEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnCreateControl ()
+ {
+ base.OnCreateControl ();
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ Console.WriteLine ("OnHandleCreated");
+ assignMenu();
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnInputLanguageChanged (
+ InputLanguageChangedEventArgs e)
+ {
+ if (InputLanguageChanged != null)
+ InputLanguageChanged (this, e);
+ }
+
+ protected virtual void OnInputLanguagedChanging (
+ InputLanguageChangingEventArgs e)
+ {
+ if (InputLanguageChanging != null)
+ InputLanguageChanging (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnLoad (EventArgs e)
+ {
+ if (Load != null)
+ Load (this, e);
+ }
+
+ protected virtual void OnMaximizedBoundsChanged (EventArgs e)
+ {
+ if (MaximizedBoundsChanged != null)
+ MaximizedBoundsChanged (this, e);
+ }
+
+ protected virtual void OnMaximumSizeChanged (EventArgs e)
+ {
+ if (MaximumSizeChanged != null)
+ MaximumSizeChanged (this, e);
+ }
+
+ protected virtual void OnMdiChildActivate (EventArgs e)
+ {
+ if (MdiChildActivate != null)
+ MdiChildActivate (this, e);
+ }
+
+ protected virtual void OnMenuComplete (EventArgs e)
+ {
+ if (MenuComplete != null)
+ MenuComplete (this, e);
+ }
+
+ protected virtual void OnMenuStart (EventArgs e)
+ {
+ if (MenuStart != null)
+ MenuStart (this, e);
+ }
+
+ protected virtual void OnMinimumSizeChanged (EventArgs e)
+ {
+ //FIXME:
+ }
+
+ //Compact Framework
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ }
+
+ //Compact Framework
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ }
+
+ protected override void OnStyleChanged (EventArgs e)
+ {
+ base.OnStyleChanged (e);
+ }
+
+ //Compact Framework
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ protected virtual IntPtr OnMenuCommand (uint id)
+ {
+ //base.OnVisibleChanged (e);
+ System.Console.WriteLine("Form on command {0}", id);
+ if(Menu != null) {
+ MenuItem mi = Menu.GetMenuItemByID( id);
+ if( mi != null) {
+ mi.PerformClick();
+ }
+ }
+ return IntPtr.Zero;
+ }
+
+ protected virtual IntPtr OnWmCommand (ref Message m)
+ {
+ uint wNotifyCode = (uint) ( ((uint)m.WParam.ToInt32() & 0xFFFF0000) >> 16);
+ uint wID = (uint)(m.WParam.ToInt32() & 0x0000FFFFL);
+ if( m.LParam.ToInt32() == 0) {
+ if( wNotifyCode == 0) {
+ // Menu
+ return OnMenuCommand(wID);
+ }
+ else if( wNotifyCode == 1) {
+ // Accelerator
+ }
+ }
+ else {
+ // Control notification
+ System.Console.WriteLine("Control notification Code {0} Id {1} Hwnd {2}", wNotifyCode, wID, m.LParam.ToInt32());
+ }
+ return new IntPtr(1);
+ }
+
+ protected override bool ProcessCmdKey ( ref Message msg, Keys keyData)
+ {
+ return base.ProcessCmdKey (ref msg, keyData);
+ }
+
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ return base.ProcessDialogKey (keyData);
+ }
+
+ protected override bool ProcessKeyPreview (ref Message m)
+ {
+ return base.ProcessKeyPreview (ref m);
+ }
+
+ protected override bool ProcessTabKey (bool forward)
+ {
+ return base.ProcessTabKey (forward);
+ }
+
+ protected override void ScaleCore (float x, float y)
+ {
+ base.ScaleCore (x, y);
+ }
+
+ protected override void SetBoundsCore (
+ int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void SetClientSizeCore (int x, int y)
+ {
+ base.SetClientSizeCore (x, y);
+ }
+
+ protected override void SetVisibleCore (bool value)
+ {
+ base.SetVisibleCore (value);
+ }
+
+ protected override void WndProc (ref Message m) {
+ base.WndProc (ref m);
+ if((int)m.Msg == (int)Msg.WM_MBUTTONDBLCLK){
+ OnDoubleClick(new EventArgs());
+ }
+
+ switch (m.Msg) {
+ case Msg.WM_CLOSE:
+ EventArgs closeArgs = new EventArgs();
+ OnClosed (closeArgs);
+ break;
+ //case ?:
+ //OnCreateControl()
+ //break;
+ case Msg.WM_FONTCHANGE:
+ EventArgs fontChangedArgs = new EventArgs();
+ OnFontChanged (fontChangedArgs);
+ break;
+ case Msg.WM_CREATE:
+ EventArgs handleCreatedArgs = new EventArgs();
+ OnHandleCreated (handleCreatedArgs);
+ break;
+ case Msg.WM_DESTROY:
+ EventArgs destroyArgs = new EventArgs();
+ OnHandleDestroyed (destroyArgs);
+ break;
+ case Msg.WM_INPUTLANGCHANGE:
+ //InputLanguageChangedEventArgs ilChangedArgs =
+ // new InputLanguageChangedEventArgs();
+ //OnInputLanguageChanged (ilChangedArgs);
+ break;
+ case Msg.WM_INPUTLANGCHANGEREQUEST:
+ //InputLanguageChangingEventArgs ilChangingArgs =
+ // new InputLanguageChangingEventArgs();
+ //OnInputLanguagedChanging (ilChangingArgs);
+ break;
+ /*
+ case Win32.WM_SHOWWINDOW:
+ EventArgs e;
+ OnLoad (e);
+ break;
+ */
+ // case ?:
+ // OnMaximizedBoundsChanged(EventArgs e)
+ // break;
+ // case ?:
+ // OnMaximumSizedChanged(EventArgs e)
+ //break;
+ case Msg.WM_MDIACTIVATE:
+ EventArgs mdiActivateArgs = new EventArgs();
+ OnMdiChildActivate (mdiActivateArgs);
+ break;
+ case Msg.WM_EXITMENULOOP:
+ EventArgs menuCompleteArgs = new EventArgs();
+ OnMenuComplete (menuCompleteArgs);
+ break;
+ case Msg.WM_ENTERMENULOOP:
+ EventArgs enterMenuLoopArgs = new EventArgs();
+ OnMenuStart (enterMenuLoopArgs);
+ break;
+ // case ?:
+ // OnMinimumSizeChanged(EventArgs e)
+ // break;
+ case Msg.WM_PAINT:
+ //FXIME:
+ //PaintEventArgs paintArgs = new PaintEventArgs(graphics, clipRectange);
+ //OnPaint (paintArgs);
+ break;
+ case Msg.WM_SIZE:
+ OnResize (new EventArgs());
+ break;
+ //case ?:
+ //OnStyleChanged(EventArgs e)
+ //break;
+ case Msg.WM_SETTEXT:
+ EventArgs textChangedArgs = new EventArgs();
+ OnTextChanged (textChangedArgs);
+ break;
+ case Msg.WM_SHOWWINDOW:
+ EventArgs visibleChangedArgs = new EventArgs();
+ OnVisibleChanged (visibleChangedArgs);
+ break;
+ case Msg.WM_COMMAND:
+ OnWmCommand (ref m);
+ break;
+ case Msg.WM_INITMENU:
+ OnWmInitMenu (ref m);
+ break;
+ case Msg.WM_INITMENUPOPUP:
+ OnWmInitMenuPopup (ref m);
+ break;
+ }
+ }
+ #region new 11.26.2002 from Alexandre Pigolkine (pigolkine@gmx.de)
+ protected virtual void OnWmInitMenu (ref Message m) {
+ Menu mn = System.Windows.Forms.Menu.GetMenuByHandle( m.WParam);
+ if( mn != null) {
+ mn.OnWmInitMenu();
+ }
+ }
+
+ protected virtual void OnWmInitMenuPopup (ref Message m) {
+ Menu mn = System.Windows.Forms.Menu.GetMenuByHandle( m.WParam);
+ if( mn != null) {
+ mn.OnWmInitMenuPopup();
+ }
+ }
+ #endregion
+
+ //sub class
+ //System.Windows.Forms.Form.ControlCollection.cs
+ //
+ //Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ //
+ // <summary>
+ // </summary>
+ // TODO: implement support classes and derive from
+ // proper classes
+ // FIXME: use this or the one defined on Control?
+ public class ControlCollectionX :
+ System.Windows.Forms.Control.ControlCollection
+ /*,ICollection*/ {
+
+ // --- Constructor
+ // base class not defined (yet!)
+ public ControlCollectionX (Form owner) : base(owner) {
+
+ }
+
+ // --- Public Methods
+
+ // TODO: see what causes this compile error
+ public override void Add(Control value) {
+ base.Add (value);
+ }
+
+ public override bool Equals (object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+
+ public override int GetHashCode () {
+ //FIXME add our proprities
+ return base.GetHashCode ();
+ }
+
+ public override void Remove(Control value) {
+ base.Remove (value);
+ }
+ } // end of Subclass
+ }
+ }
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs
new file mode 100644
index 00000000000..51b485e95cf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.FormBorderStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the border styles for a form.
+ /// </summary>
+ [ComVisible(true)]
+ public enum FormBorderStyle {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ FixedSingle = 1,
+ Fixed3D = 2,
+ FixedDialog = 3,
+ Sizable = 4,
+ FixedToolWindows = 5,
+ SizableToolWindow = 6
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs
new file mode 100644
index 00000000000..37ce62ddd22
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.FormStartPosition.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the initial position of a form.
+ /// </summary>
+ [ComVisible(true)]
+ public enum FormStartPosition {
+
+ //Values were verified with enumcheck.
+ Manual = 0,
+ CenterScreen = 1,
+ WindowsDefaultLocation = 2,
+ WindowsDefaultBounds = 3,
+ CenterParent = 4,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs
new file mode 100644
index 00000000000..c540d0fa7dd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.FormWindowState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how a form window is displayed.
+ /// </summary>
+ [ComVisible(true)]
+ public enum FormWindowState {
+
+ //Values were verified with enumcheck.
+ Normal = 0,
+ Maximized = 1,
+ Minimized = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs
new file mode 100644
index 00000000000..2cc598419f7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.FrameStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the frame style of the selected control.
+ /// </summary>
+ public enum FrameStyle {
+
+ //Values were verified with enumcheck.
+ Dashed = 0,
+ Thick = 1,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs
new file mode 100644
index 00000000000..30cf6222cc7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Windows.Forms.GiveFeedbackEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partialy completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Completed
+ /// </summary>
+
+ public class GiveFeedbackEventArgs : EventArgs {
+
+ #region Fields
+ DragDropEffects effect;
+ bool useDefaultCursors;
+ #endregion
+
+ public GiveFeedbackEventArgs( DragDropEffects effect, bool useDefaultCursors )
+ {
+ this.effect = effect;
+ this.useDefaultCursors = useDefaultCursors;
+ }
+
+ #region Public Properties
+
+ public DragDropEffects Effect
+ {
+ get {
+ return effect;
+ }
+ }
+
+ public bool UseDefaultCursors {
+ get {
+ return useDefaultCursors;
+ }
+ set {
+ useDefaultCursors = value;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs
new file mode 100644
index 00000000000..609934dbb38
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.GiveFeedbackEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void GiveFeedbackEventHandler (
+ object sender,
+ GiveFeedbackEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
new file mode 100644
index 00000000000..4c09e2716f0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
@@ -0,0 +1,178 @@
+//
+// System.Windows.Forms.GridColumnStylesCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class GridColumnStylesCollection : BaseCollection, IList {
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public virtual int Add(DataGridColumnStyle column) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange(DataGridColumnStyle [] columns)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool Contains()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(DataGridColumnStyle element)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(DataGridColumnStyle column)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void ResetPropertyDescriptors()
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override ArrayList List {
+ get {
+ return base.List;
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected void OnCollectionChanged(CollectionChangeEventArgs cevent)
+ {
+ //FIXME:
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ public object this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs
new file mode 100644
index 00000000000..b745375a229
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs
@@ -0,0 +1,63 @@
+//
+// System.Windows.Forms.GridItem.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public abstract class GridItem {
+ bool expandable;
+ bool expanded;
+ //
+ // --- Public Properties
+ //
+ public bool Expandable {
+ get {
+ return expandable;
+ }
+ }
+ public bool Expanded {
+ get {
+ return expanded;
+ }
+ set {
+ expanded = value;
+ }
+ }
+ public abstract GridItemCollection GridItems {
+ get;
+ }
+ public abstract GridItemType GridItemType {
+ get;
+ }
+ public abstract string Label {
+ get;
+ }
+ public abstract GridItem Parent {
+ get;
+ }
+ //public abstract PropertyDescriptor PropertyDescriptor {
+ // get;
+ //}
+ public abstract object Value {
+ get;
+ }
+
+ //
+ // --- Protected Constructor
+ //
+ [MonoTODO]
+ protected GridItem()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
new file mode 100644
index 00000000000..cc5063c16b4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
@@ -0,0 +1,67 @@
+//
+// System.Windows.Forms.GridItemCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public abstract class GridItemCollection : ICollection, IEnumerable {
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public GridItem this[string str] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemType.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemType.cs
new file mode 100644
index 00000000000..87dcc4fb7e9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemType.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.GridItemType.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum GridItemType {
+ ArrayValue = 2,
+ Category = 1,
+ Property = 0,
+ Root = 3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
new file mode 100644
index 00000000000..2cdc8264acb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
@@ -0,0 +1,162 @@
+//
+// System.Windows.Forms.GridTableStylesCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class GridTableStylesCollection : BaseCollection, IList {
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public DataGridTableStyle this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DataGridTableStyle this[string s] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public virtual int Add(DataGridTableStyle table)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void AddRange(DataGridTableStyle[] tables)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool Contains(DataGridTableStyle table)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(DataGridTableStyle table)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override ArrayList List {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected void OnCollectionChanged(CollectionChangeEventArgs cevent)
+ {
+ //FIXME:
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs
new file mode 100644
index 00000000000..7637e899f5a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs
@@ -0,0 +1,135 @@
+//
+// System.Windows.Forms.GroupBox.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class GroupBox : Control {
+
+ //
+ // --- Constructor
+ //
+
+ [MonoTODO]
+ public GroupBox() {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public override bool AllowDrop {
+ get {
+ //FIXME:
+ return base.AllowDrop;
+ }
+ set {
+ //FIXME:
+ base.AllowDrop = value;
+ }
+ }
+
+ [MonoTODO]
+ public override Rectangle DisplayRectangle {
+ get {
+ //FIXME:
+ return base.DisplayRectangle;
+ }
+ }
+
+ [MonoTODO]
+ public FlatStyle FlatStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override string ToString() {
+ //FIXME:
+ return base.ToString();
+ }
+
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "GROUP";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ (int)WindowStyles.WS_CHILD |
+ (int)WindowStyles.WS_VISIBLE | (int)SS_Static_Control_Types.SS_LEFT );
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new Size(200,100);//correct value
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e) {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnPaint(PaintEventArgs e) {
+ //FIXME:
+ base.OnPaint(e);
+ }
+
+ [MonoTODO]
+ protected override bool ProcessMnemonic(char charCode) {
+ //FIXME:
+ return base.ProcessMnemonic(charCode);
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m) {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs
new file mode 100644
index 00000000000..d7b646a6db3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs
@@ -0,0 +1,64 @@
+//
+// System.Windows.Forms.HScrollBar.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+// CE Complete
+using System.Drawing;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class HScrollBar : ScrollBar {
+
+ //
+ // --- Constructor
+ //
+
+ [MonoTODO]
+ public HScrollBar() {
+ //FIXME: implment
+ }
+
+ //
+ // --- Protected Properties
+ //
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "HSCROLL";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ (int)WindowStyles.WS_CHILD |
+ (int)WindowStyles.WS_VISIBLE | (int)SS_Static_Control_Types.SS_LEFT );
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new Size(80,16);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs
new file mode 100644
index 00000000000..dac942e0acc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Forms.Help.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class Help {
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public static void ShowHelp(Control c, string s)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void ShowHelp(Control c, string s, HelpNavigator nav)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public static void ShowHelpIndex(Control parent, string url)
+ {
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs
new file mode 100644
index 00000000000..304c90783e6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs
@@ -0,0 +1,52 @@
+//
+// System.Windows.Forms.HelpEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Complete.
+ // </summary>
+
+ public class HelpEventArgs : EventArgs {
+
+ #region Fields
+ private Point mousePos;
+ private bool handled;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public HelpEventArgs(Point mousePos)
+ {
+ this.mousePos = mousePos;
+ handled = false; // Gian : hadled is false, otherwise all events are managed by user by default.
+ }
+
+ #region Public Properties
+ public bool Handled
+ {
+ get {
+ return handled;
+ }
+ set {
+ handled = value;
+ }
+ }
+ public Point MousePos {
+ get {
+ return mousePos;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs
new file mode 100644
index 00000000000..fa20a8bb065
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.HelpEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void HelpEventHandler (
+ object sender,
+ HelpEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpNavigator.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpNavigator.cs
new file mode 100644
index 00000000000..36f48612b9e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpNavigator.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.HelpNavigator.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum HelpNavigator {
+ AssociateIndex = -2147483643,
+ Find = -2147483644,
+ Index = -2147483645,
+ KeywordIndex = -2147483642,
+ TableOfContents = -2147483646,
+ Topic = -2147483647
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs
new file mode 100644
index 00000000000..b4b6888dc13
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs
@@ -0,0 +1,98 @@
+//
+// System.Windows.Forms.HelpProvider.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+ using System.ComponentModel;
+ public class HelpProvider : Component, IExtenderProvider {
+
+ //
+ // --- Constructor
+ //
+
+ [MonoTODO]
+ public HelpProvider() {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public virtual string HelpNamespace {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public virtual string GetHelpKeyword(Control ctl) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual HelpNavigator GetHelpNavigator(Control ctl) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GetHelpString(Control ctl) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool GetShowHelp(Control ctl) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void SetHelpKeyword(Control ctl, string keyword) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void SetHelpNavigator(Control ctl, HelpNavigator nav) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void SetHelpString(Control ctl, string helpString) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public virtual void SetShowHelp(Control ctl, bool val) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ bool IExtenderProvider.CanExtend(object extendee){
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs
new file mode 100644
index 00000000000..ba35421a87c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.HorizontalAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum HorizontalAlignment {
+ Center = 2,
+ Left = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs
new file mode 100644
index 00000000000..89bf63f8f95
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.IButtonControl.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IButtonControl {
+ void NotifyDefault(bool value);
+ void PerformClick();
+ DialogResult DialogResult {get; set;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs
new file mode 100644
index 00000000000..9f22288f044
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.ICommandExecutor.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface ICommandExecutor {
+
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The Execute method had its own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+ void Execute();
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs
new file mode 100644
index 00000000000..edbd38bfe6a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.IComponentEditorPageSite.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IComponentEditorPageSite {
+
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ Control GetControl();
+ void SetDirty();
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs
new file mode 100644
index 00000000000..8d9de072dc1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.IContainerControl.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IContainerControl {
+
+ bool ActivateControl(Control active);
+ Control ActiveControl {get; set;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
new file mode 100644
index 00000000000..831d7eba35e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.IDataGridColumnStyleEditingNotificationService.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IDataGridColumnStyleEditingNotificationService {
+
+ void ColumnStartedEditing(Control editingControl);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs
new file mode 100644
index 00000000000..be78fb1856d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.IDataGridEditingService.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IDataGridEditingService {
+
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber);
+ bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs
new file mode 100644
index 00000000000..0942260cd01
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs
@@ -0,0 +1,32 @@
+//
+// System.Windows.Forms.IDataObject.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IDataObject {
+
+ object GetData(string format);
+ object GetData(Type format);
+ object GetData(string format, bool autoConvert);
+
+ bool GetDataPresent(string format);
+ bool GetDataPresent(Type format);
+ bool GetDataPresent(string format, bool autoConvert);
+
+ string[] GetFormats();
+ string[] GetFormats(bool autoConvert);
+
+ void SetData(object data);
+ void SetData(string format, object data);
+ void SetData(Type format, object data);
+ void SetData(string format, bool autoConvert, object data);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs
new file mode 100644
index 00000000000..c49de395576
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.IFeatureSupport.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IFeatureSupport {
+
+ Version GetVersionPresent(object feature);
+ bool IsPresent(object feature);
+ bool IsPresent(object feature, Version minimumVersion);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs
new file mode 100644
index 00000000000..d8b072fddd3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.IFileReaderService.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System.IO;
+namespace System.Windows.Forms {
+
+ public interface IFileReaderService {
+
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following method had its own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ Stream OpenFileFromSource(string relativePath);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IMessageFilter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IMessageFilter.cs
new file mode 100644
index 00000000000..eacab02a0ad
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IMessageFilter.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.IMessageFilter.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System.Threading;
+namespace System.Windows.Forms {
+
+ public interface IMessageFilter {
+ bool PreFilterMessage(ref Message m);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs
new file mode 100644
index 00000000000..f729d617314
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.IWin32Window.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ // FixMe [Guid("")]
+ // FixMe [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IWin32Window {
+
+ IntPtr Handle {get;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs
new file mode 100644
index 00000000000..96bda894e69
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.IWindowTarget.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IWindowTarget {
+
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ void OnHandleChange(IntPtr newHandle);
+ void OnMessage(ref Message m);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs
new file mode 100644
index 00000000000..508b0d3cb61
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs
@@ -0,0 +1,83 @@
+//
+// System.Windows.Forms.ImageIndexConverter.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.Globalization;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ImageIndexConverter : Int32Converter {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ImageIndexConverter()
+ {
+
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override object ConvertFrom(ITypeDescriptorContext context,
+ CultureInfo culture, object value )
+ {
+ //FIXME:
+ return base.ConvertFrom(context, culture, value);
+ }
+
+
+ [MonoTODO]
+ public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture,
+ object value, Type destinationType)
+ {
+ //FIXME:
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ [MonoTODO]
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValues(context);
+ }
+
+ [MonoTODO]
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValuesExclusive(context);
+ }
+
+ [MonoTODO]
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValuesSupported(context);
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ protected virtual bool IncludeNoneAsStandardValue {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs
new file mode 100644
index 00000000000..11f40284afd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs
@@ -0,0 +1,338 @@
+//
+// System.Windows.Forms.ImageList.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.Drawing;
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+ public sealed class ImageList : Component {
+ internal ColorDepth colorDepth;
+ //
+ // --- Constructor
+ //
+
+ [MonoTODO]
+ public ImageList()
+ {
+ colorDepth = ColorDepth.Depth8Bit;
+ }
+
+ [MonoTODO]
+ public ImageList(IContainer cont) : this()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public ColorDepth ColorDepth {
+ get {
+ return colorDepth;
+ }
+ set {
+ colorDepth = value;
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HandleCreated {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ImageList.ImageCollection Images {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal Size imageSize; //FIXME: just to get it to run
+ [MonoTODO]
+ public Size ImageSize {
+ get {
+ return imageSize;
+ }
+ set {
+ imageSize = value;
+ }
+ }
+
+ [MonoTODO]
+ public ImageListStreamer ImageStream {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal Color transparentColor; //FIXME: just to get it to run
+ [MonoTODO]
+ public Color TransparentColor {
+ get {
+ return transparentColor;
+ }
+ set {
+ transparentColor = value;
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public void Draw(Graphics g, Point pt, int n)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Draw(Graphics g, int n1, int n2, int n3)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Public Events
+ //
+ public event EventHandler RecreateHandle;
+
+ //
+ // System.Windows.Forms.ImageList.ImageCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ //// (C) 2002 Ximian, Inc
+ ////
+ // <summary>
+ //
+ // </summary>
+
+ public sealed class ImageCollection : IList, ICollection, IEnumerable {
+
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Empty {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Image this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public void Add(Icon icon)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Add(Image img)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public int Add(Image img, Color col)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int AddStrip(Image value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool Contains(Image image)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(Image image)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(Image image)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+
+ }// End of Subclass
+
+ }//End of class
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs
new file mode 100644
index 00000000000..c11623e3cda
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.ImageListStreamer.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public sealed class ImageListStreamer : ISerializable {
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context){
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ImeMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImeMode.cs
new file mode 100644
index 00000000000..37bbb973380
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImeMode.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.ImeMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ImeMode {
+ Alpha = 8,
+ AlphaFull = 7,
+ Disable = 3,
+ Hangul = 10,
+ HangulFull = 9,
+ Hiragana = 4,
+ Inherit = -1,
+ Katakana = 5,
+ KatakanaHalf = 6,
+ NoControl = 0,
+ Off = 2,
+ On = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs
new file mode 100644
index 00000000000..31d6a1f4de8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs
@@ -0,0 +1,83 @@
+//
+// System.Windows.Forms.InputLanguage.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public sealed class InputLanguage {
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public CultureInfo Culture {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static InputLanguage CurrentInputLanguage {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static InputLanguage DefaultInputLanguage {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static InputLanguageCollection InstalledInputLanguages {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string LayoutName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ //FIXME:
+ return base.Equals(obj);
+ }
+
+ [MonoTODO]
+ public static InputLanguage FromCulture(CultureInfo culture)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ //FIXME:
+ return base.GetHashCode();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs
new file mode 100644
index 00000000000..3d9d7406eaf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs
@@ -0,0 +1,66 @@
+//
+// System.Windows.Forms.InputLanguageChangeEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partial Completed by Dennis Hayes (dennish@raytek.com)
+// Giananadrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class InputLanguageChangedEventArgs : EventArgs {
+
+ #region Fields
+ private CultureInfo culture;
+ private byte charSet;
+ private InputLanguage inputLanguage;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public InputLanguageChangedEventArgs ( CultureInfo culture, byte charSet) {
+ this.culture = culture;
+ this.charSet = charSet;
+ inputLanguage = InputLanguage.FromCulture(culture);
+ }
+
+ public InputLanguageChangedEventArgs ( InputLanguage inputLanguage, byte charSet) {
+ this.inputLanguage = inputLanguage;
+ this.charSet = charSet;
+ culture = this.inputLanguage.Culture;
+ }
+
+ #region Public Properties
+
+ public byte CharSet
+ {
+ get {
+
+ return charSet;
+ }
+ }
+
+ public CultureInfo Culture {
+ get {
+ return culture;
+ }
+ }
+
+ [MonoTODO]
+ public InputLanguage InputLanguage {
+ get {
+ return InputLanguage;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs
new file mode 100644
index 00000000000..132e25d1f7f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windoes.Forms.InputLanguageChangedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void InputLanguageChangedEventHandler (
+ object sender,
+ InputLanguageChangedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs
new file mode 100644
index 00000000000..aacf422cc43
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs
@@ -0,0 +1,64 @@
+//
+// System.Windows.Forms.InputLanguageChangingEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class InputLanguageChangingEventArgs : EventArgs {
+
+ #region Fields
+ private CultureInfo culture;
+ private bool systemcharset;
+ private InputLanguage inputlanguage;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+
+ public InputLanguageChangingEventArgs(CultureInfo culture, bool sysCharSet) {
+ this.culture = culture;
+ this.systemcharset =sysCharSet;
+ }
+
+ public InputLanguageChangingEventArgs(InputLanguage inputlanguage, bool sysCharSet) {
+ this.culture = culture;
+ this.inputlanguage = inputlanguage;
+ }
+
+ #region Public Properties
+
+ public CultureInfo Culture
+ {
+ get {
+ return culture;
+ }
+ }
+
+ public InputLanguage InputLanguage {
+ get {
+ return inputlanguage;
+ }
+ }
+
+ public bool SysCharSet {
+ get {
+ return systemcharset;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs
new file mode 100644
index 00000000000..60d71966655
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.InputLanguageChangingEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void InputLanguageChangingEventHandler (
+ object sender,
+ InputLanguageChangingEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs
new file mode 100644
index 00000000000..c4e2e270ddd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs
@@ -0,0 +1,49 @@
+//
+// System.Windows.Forms.InputLanguageCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class InputLanguageCollection : ReadOnlyCollectionBase {
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public InputLanguage this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public bool Contains(InputLanguage lang) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo(InputLanguage[] array, int index) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public int IndexOf(InputLanguage lang) {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs
new file mode 100644
index 00000000000..04b3207c993
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs
@@ -0,0 +1,41 @@
+//
+// System.Windows.Forms.InvalidateEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class InvalidateEventArgs : EventArgs {
+
+ #region Fields
+ private Rectangle InvalidRectangle;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public InvalidateEventArgs(Rectangle invalidRect)
+ {
+ InvalidRectangle = invalidRect;
+ }
+
+ #region Public Properties
+ public Rectangle InvalidRect
+ {
+ get {
+ return InvalidRectangle;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs
new file mode 100644
index 00000000000..77309f10287
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.InvalidateEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void InvalidateEventHandler (
+ object sender,
+ InvalidateEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemActivation.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemActivation.cs
new file mode 100644
index 00000000000..452e6e70e74
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemActivation.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.ItemActivation.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ItemActivation {
+ OneClick = 1,
+ Standard = 0,
+ TwoClick = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs
new file mode 100644
index 00000000000..9959513e97f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ItemBoundsPortion.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ItemBoundsPortion {
+ Entire = 0,
+ Icon = 1,
+ ItemOnly = 3,
+ Label = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs
new file mode 100644
index 00000000000..e196790f4df
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs
@@ -0,0 +1,36 @@
+//
+// System.Windows.Forms.ItemChangedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class ItemChangedEventArgs : EventArgs {
+
+ #region Fields
+ // After looking at ItemChangedEvent, It seems index is always zero.
+ // The ItemChangedEventhandler quierys the sender object to find the item changed.
+ private int index = 0; //Never assigned. default to 0.
+ #endregion
+
+ #region Public Properties
+ public int Index
+ {
+ get {
+ return index;
+ }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs
new file mode 100644
index 00000000000..7e2564916d9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ItemChangedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ItemChangedEventHandler (
+ object sender,
+ ItemChangedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs
new file mode 100644
index 00000000000..7a216e872fd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// System.Windows.Forms.ItemCheckEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class ItemCheckEventArgs : EventArgs {
+
+ #region Fields
+ private int index;
+ private CheckState newcheckvalue;
+ private CheckState currentcheckvalue;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public ItemCheckEventArgs(int index, CheckState newCheckValue, CheckState currentValue )
+ {
+ this.index = index;
+ newcheckvalue = newCheckValue;
+ currentcheckvalue = currentValue;
+ }
+
+ #region Public Properties
+
+ public CheckState CurrentValue
+ {
+ get {
+ return currentcheckvalue;
+ }
+ }
+
+ public int Index {
+ get {
+ return index;
+ }
+ }
+
+ public CheckState NewValue {
+ get {
+ return newcheckvalue;
+ }
+ set {
+ newcheckvalue = value;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs
new file mode 100644
index 00000000000..b872db4aaa6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Wondows.Forms.ItemCheckEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ItemCheckEventHandler (
+ object sender,
+ ItemCheckEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs
new file mode 100644
index 00000000000..d9c94df8c8a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.Windows.Forms.ItemDragEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ItemDragEventArgs : EventArgs {
+
+ #region Fields
+ private MouseButtons buttons;
+ private object itemdrageobject;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public ItemDragEventArgs(MouseButtons bttns)
+ {
+ buttons = bttns;
+ }
+ public ItemDragEventArgs(MouseButtons bttns, object o)
+ {
+ buttons = bttns;
+ itemdrageobject = o;
+ }
+
+ #region Public Properties
+ public MouseButtons Button
+ {
+ get {
+ return buttons;
+ }
+ }
+
+ public object Item
+ {
+ get {
+ return itemdrageobject;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs
new file mode 100644
index 00000000000..b9498cf9457
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ItemDragEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ItemDragEventHandler (
+ object sender,
+ ItemDragEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs
new file mode 100644
index 00000000000..d2aa045a4d2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs
@@ -0,0 +1,111 @@
+//
+// System.Windows.Forms.KeyEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Complete
+ // </summary>
+
+ public class KeyEventArgs : EventArgs {
+
+ #region Fields
+
+ private Keys keydata;
+ private bool handled = false;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public KeyEventArgs (Keys keyData)
+ {
+ this.keydata = keyData;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public virtual bool Alt
+ {
+ get {
+ return (keydata == Keys.Alt);
+ }
+ }
+
+ [ComVisible(true)]
+ public bool Control
+ {
+ get {
+ return (keydata == Keys.Control);
+ }
+ }
+
+ [ComVisible(true)]
+ public bool Handled
+ {
+ get {
+ return handled;
+ }
+ set {
+ handled = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public Keys KeyCode
+ {
+ get {
+ return keydata & Keys.KeyCode;
+ }
+ }
+
+ [ComVisible(true)]
+ public Keys KeyData
+ {
+ get {
+ return keydata;
+ }
+ }
+
+ [ComVisible(true)]
+ public int KeyValue
+ {
+ get {
+ return Convert.ToInt32(keydata);
+ }
+ }
+
+ [ComVisible(true)]
+ public Keys Modifiers
+ {
+ get {
+ Keys returnKeys = new Keys();
+ if(keydata == Keys.Alt)returnKeys = Keys.Alt;
+ if(keydata == Keys.Control)returnKeys = returnKeys | Keys.Control;
+ if(keydata == Keys.Shift)returnKeys = returnKeys | Keys.Shift;
+ return returnKeys;
+ }
+ }
+
+ [ComVisible(true)]
+ public bool Shift
+ {
+ get {
+ return (keydata == Keys.Shift);
+ }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs
new file mode 100644
index 00000000000..4bf11a4a481
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.KeyEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void KeyEventHandler (
+ object sender,
+ KeyEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs
new file mode 100644
index 00000000000..be1ddf64d8c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs
@@ -0,0 +1,55 @@
+//
+// System.Windows.Forms.KeyPressEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class KeyPressEventArgs : EventArgs {
+
+ #region Fields
+
+ private char keychar;
+ private bool handled = false; //Gian : Initialize?
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public KeyPressEventArgs (char keyChar)
+ {
+ this.keychar = keyChar;
+ }
+
+ #region Public Properties
+ [ComVisible(true)]
+ public bool Handled {
+ get {
+ return handled;
+ }
+ set {
+ handled = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public char KeyChar {
+ get {
+ return keychar;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs
new file mode 100644
index 00000000000..6acca0d7ac9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.KeyPressEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void KeyPressEventHandler (
+ object sender,
+ KeyPressEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Keys.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Keys.cs
new file mode 100644
index 00000000000..4a5e53bd0a4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Keys.cs
@@ -0,0 +1,202 @@
+//
+// System.Windows.Forms.Keys.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ ///
+ [Flags]
+ public enum Keys {
+ A = 65,
+ Add = 107,
+ Alt = 262144,
+ Apps = 93,
+ Attn = 246,
+ B = 66,
+ Back = 8,
+ BrowserBack = 166,
+ BrowserFavorites = 171,
+ BrowserForward = 167,
+ BrowserHome = 172,
+ BrowserRefresh = 168,
+ BrowserSearch = 170,
+ BrowserStop = 169,
+ C = 67,
+ Cancel = 3,
+ Capital = 20,
+ CapsLock = 20,
+ Clear = 12,
+ Control = 131072,
+ ControlKey = 17,
+ Crsel = 247,
+ D = 68,
+ D0 = 48,
+ D1 = 49,
+ D2 = 50,
+ D3 = 51,
+ D4 = 52,
+ D5 = 53,
+ D6 = 54,
+ D7 = 55,
+ D8 = 56,
+ D9 = 57,
+ Decimal = 110,
+ Delete = 46,
+ Divide = 111,
+ Down = 40,
+ E = 69,
+ End = 35,
+ Enter = 13,
+ EraseEof = 249,
+ Escape = 27,
+ Execute = 43,
+ Exsel = 248,
+ F = 70,
+ F1 = 112,
+ F2 = 113,
+ F3 = 114,
+ F4 = 115,
+ F5 = 116,
+ F6 = 117,
+ F7 = 118,
+ F8 = 119,
+ F9 = 120,
+ F10 = 121,
+ F11 = 122,
+ F12 = 123,
+ F13 = 124,
+ F14 = 125,
+ F15 = 126,
+ F16 = 127,
+ F17 = 128,
+ F18 = 129,
+ F19 = 130,
+ F20 = 131,
+ F21 = 132,
+ F22 = 133,
+ F23 = 134,
+ F24 = 135,
+ FinalMode = 24,
+ G = 71,
+ H = 72,
+ HanguelMode = 21,
+ HangulMode = 21,
+ HanjaMode = 25,
+ Help = 47,
+ Home = 36,
+ I = 73,
+ IMEAceept = 30,
+ IMEConvert = 28,
+ IMEModeChange = 31,
+ IMENonconvert = 29,
+ Insert = 45,
+ J = 74,
+ JunjaMode = 23,
+ K = 75,
+ KanaMode = 21,
+ KanjiMode = 25,
+ KeyCode = 65535,
+ L = 76,
+ LaunchApplication1 = 182,
+ LaunchApplication2 = 183,
+ LaunchMail = 180,
+ LButton = 1,
+ LControlKey = 162,
+ Left = 37,
+ LineFeed = 10,
+ LShiftKey = 160,
+ LMenu = 164,
+ LWin = 91,
+ M = 77,
+ MButton = 4,
+ MediaNextTrack = 176,
+ MediaPlayPause = 179,
+ MediaPreviousTrack = 177,
+ MediaStop = 178,
+ Menu = 18,
+ Modifiers = -65536,
+ Multiply = 106,
+ N = 78,
+ Next = 34,
+ NoName = 252,
+ None = 0,
+ NumLock = 144,
+ NumPad0 = 96,
+ NumPad1 = 97,
+ NumPad2 = 98,
+ NumPad3 = 99,
+ NumPad4 = 100,
+ NumPad5 = 101,
+ NumPad6 = 102,
+ NumPad7 = 103,
+ NumPad8 = 104,
+ NumPad9 = 105,
+ O = 79,
+ Oem8 = 223,
+ OemBackslash = 226,
+ OemClear = 254,
+ OemCloseBrackets = 221,
+ Oemcomma = 188,
+ OemMinus = 189,
+ OemOpenBrackets = 219,
+ OemPeriod = 190,
+ OemPipe = 220,
+ Oemplus = 187,
+ OemQuestion = 191,
+ OemQuotes = 222,
+ OemSemicolon = 186,
+ Oemtilde = 192,
+ P = 80,
+ Pa1 = 253,
+ PageDown = 34,
+ PageUp = 33,
+ Pause = 19,
+ Play = 250,
+ Print = 42,
+ PrintScreen = 44,
+ Prior = 33,
+ ProcessKey = 229,
+ Q = 81,
+ R = 82,
+ RButton = 2,
+ RControlKey = 163,
+ Return = 13,
+ Right = 39,
+ RMenu = 165,
+ RShiftKey = 161,
+ RWin = 92,
+ S = 83,
+ Scroll = 145,
+ Select = 41,
+ SelectMedia = 181,
+ Separator = 108,
+ Shift = 65536,
+ ShiftKey = 16,
+ Snapshot = 44,
+ Space = 32,
+ Subtract = 109,
+ T = 84,
+ Tab = 9,
+ U = 85,
+ Up = 38,
+ V = 86,
+ VolumeDown = 174,
+ VolumeMute = 173,
+ VolumeUp = 175,
+ W = 87,
+ X = 88,
+ XButton1 = 5,
+ XButton2 = 6,
+ Y = 89,
+ Z = 90,
+ Zoom = 251
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeysConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeysConverter.cs
new file mode 100644
index 00000000000..4a21506bbd9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeysConverter.cs
@@ -0,0 +1,107 @@
+//
+// System.Windows.Forms.KeysConverter.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+ public class KeysConverter : TypeConverter, IComparer {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public KeysConverter()
+ {
+
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type type)
+ {
+ //FIXME:
+ return CanConvertFrom(context,type);
+ }
+ [MonoTODO]
+ public bool CanCompareTo(Type type)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual bool CanCompareTo(ITypeDescriptorContext context, Type type)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Compare(object a, object b)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ //FIXME:
+ return base.ConvertFrom(context,culture, value);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ //FIXME:
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ [MonoTODO]
+ public bool GetProertiesSupported()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool GetProertiesSupported(ITypeDescriptorContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValues(context);
+ }
+
+ [MonoTODO]
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValuesExclusive(context);
+ }
+
+ [MonoTODO]
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetStandardValuesExclusive(context);
+ }
+
+ [MonoTODO]
+ public override bool IsValid(ITypeDescriptorContext context, object value)
+ {
+ //FIXME:
+ return base.IsValid(context, value);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs
new file mode 100644
index 00000000000..bb270ed8ef7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs
@@ -0,0 +1,395 @@
+ //
+ // System.Windows.Forms.Label.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ // implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+ // Dennis Hayes (dennish@raytek.com)
+ // WineLib implementation started by John Sohn (jsohn@columbus.rr.com)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ namespace System.Windows.Forms {
+ using System.ComponentModel;
+ using System.Drawing;
+
+ // <summary>
+ //
+ // </summary>
+
+ public class Label : Control {
+
+ Image backgroundImage;
+ BorderStyle borderStyle;
+ bool autoSize;
+ Image image;
+ ContentAlignment imageAlign;
+ ImeMode defaultImeMode;
+ bool renderTransparent;
+ FlatStyle flatStyle;
+ int preferredHeight;
+ int preferredWidth;
+ bool tabStop;
+ ContentAlignment textAlign;
+ bool useMnemonic;
+
+ //
+ // --- Constructor
+ //
+ public Label () : base ()
+ {
+ // Defaults in the Spec
+ autoSize = false;
+ borderStyle = BorderStyle.None;
+
+ //Defaults not in the spec
+ Image backgroundImage;
+ Image image;
+ ContentAlignment imageAlign;
+ ImeMode defaultImeMode;
+ bool renderTransparent;
+ FlatStyle flatStyle;
+ int preferredHeight;
+ int preferredWidth;
+ bool tabStop;
+ ContentAlignment textAlign;
+ bool useMnemonic;
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ public virtual bool AutoSize {
+ get {
+ return autoSize;
+ }
+ set {
+ autoSize = value;
+ }
+ }
+
+ public override Image BackgroundImage {
+ get {
+ return backgroundImage;
+ }
+ set {
+ backgroundImage = value;
+ // FIXME: force redraw
+ }
+ }
+
+ public virtual BorderStyle BorderStyle {
+ get {
+ return borderStyle;
+ }
+ set {
+ borderStyle = value;
+ }
+ }
+
+
+ public FlatStyle FlatStyle {
+ get {
+ return flatStyle;
+ }
+ set {
+ flatStyle = value;
+ }
+ }
+
+ public Image Image {
+ get {
+ return image;
+ }
+ set {
+ image = value;
+ }
+ }
+
+ public ContentAlignment ImageAlign {
+ get {
+ return imageAlign;
+ }
+ set {
+ imageAlign = value;
+ }
+ }
+
+
+ [MonoTODO]
+ public int ImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public ImageList ImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public new ImeMode ImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public int PreferredHeight {
+ get {
+ return preferredHeight;
+ }
+ }
+
+ public int PreferredWidth {
+ get {
+ return preferredWidth;
+ }
+ }
+
+ public new bool TabStop {
+ get {
+ return tabStop;
+ }
+ set {
+ tabStop = value;
+ }
+ }
+
+ //Compact Framework
+ public virtual ContentAlignment TextAlign {
+ get {
+ return textAlign;
+ }
+ set {
+ textAlign = value;
+ }
+ }
+
+ public bool UseMnemonic {
+ get {
+ return useMnemonic;
+ }
+ set {
+ useMnemonic = value;
+ }
+ }
+
+ //
+ // --- Protected Properties
+ //
+
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "STATIC";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ (int)WindowStyles.WS_CHILD |
+ (int)WindowStyles.WS_VISIBLE | (int)SS_Static_Control_Types.SS_LEFT );
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(100,23);//Correct value
+ }
+ }
+
+ protected virtual bool RenderTransparent {
+ get {
+ return renderTransparent;
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ //FIXME:
+ return defaultImeMode;
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ public new void Select()
+ {
+ //FIXME:
+ base.Select ();
+ }
+
+ //Compact Framework
+ public override string ToString()
+ {
+ //FIXME: add name of lable, as well as text. would adding base.ToString work?
+ return "Label: " + base.Text;
+ }
+
+ //
+ // --- Public Events
+ //
+ public event EventHandler AutoSizeChanged;
+
+ public event EventHandler TextAlignChanged;
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected Rectangle CalcImageRenderBounds (
+ Image image, Rectangle rect, ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ //FIXME:
+ return base.CreateAccessibilityInstance();
+ }
+
+ [MonoTODO]
+ protected void DrawImage (Graphics g, Image img,
+ Rectangle r, ContentAlignment align)
+ {
+ //FIXME:
+ }
+
+ protected virtual void OnAutoSizeChanged (EventArgs e) {
+ if (AutoSizeChanged != null) AutoSizeChanged (this, e);
+ }
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ //FIXME:
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ //FIXME:
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaint(e);
+ }
+
+ //Compact Framework
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected virtual void OnTextAlignChanged (EventArgs e) {
+ if (TextAlignChanged != null) TextAlignChanged (this, e);
+ }
+
+ //Compact Framework
+ protected override void OnTextChanged (EventArgs e) {
+ //FIXME:
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ protected override bool ProcessMnemonic(char charCode)
+ {
+ return base.ProcessMnemonic (charCode);
+ }
+
+ [MonoTODO]
+ protected new ContentAlignment RtlTranslateAlignment (
+ ContentAlignment alignment)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected new HorizontalAlignment RtlTranslateAlignment (
+ HorizontalAlignment alignment)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected new LeftRightAlignment RtlTranslateAlignment (
+ LeftRightAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected new virtual void Select (bool directed, bool forward)
+ {
+ //FIXME:
+ }
+
+ protected override void SetBoundsCore (
+ int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected new void UpdateBounds()
+ {
+ base.UpdateBounds ();
+ }
+
+ protected new void UpdateBounds (int x, int y,
+ int width, int height)
+ {
+ base.UpdateBounds (x, y, width, height);
+ }
+
+
+ protected new void UpdateBounds (int x, int y, int width,
+ int height, int clientWidth,
+ int clientHeight)
+ {
+ base.UpdateBounds (x, y, width, height, clientWidth,
+ clientHeight);
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+ }
+ }
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs
new file mode 100644
index 00000000000..66cbef5cfca
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs
@@ -0,0 +1,62 @@
+//
+// System.Windows.Forms.LabelEditEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class LabelEditEventArgs : EventArgs {
+
+ #region Fields
+
+ private int item;
+ private string label = ""; //Gian : Initialized string to empty...
+ private bool canceledit = false;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LabelEditEventArgs (int item)
+ {
+ this.item = item;
+ }
+
+ public LabelEditEventArgs (int item, string label) {
+ this.item = item;
+ this.label = label;
+ }
+
+ #region Public Properties
+ public bool CancelEdit
+ {
+ get {
+ return canceledit;
+ }
+ set {
+ canceledit = value;
+ }
+ }
+ public int Item {
+ get {
+ return item;
+ }
+ }
+ public string Label {
+ get {
+ return label;
+ }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs
new file mode 100644
index 00000000000..b61d61cd52e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.LabelEditEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void LabelEditEventHandler (
+ object sender,
+ LabelEditEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs
new file mode 100644
index 00000000000..6b60c7e6ad9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Windows.Forms.LayoutEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public sealed class LayoutEventArgs : EventArgs {
+
+ #region Fields
+
+ private Control affectedcontrol;
+ private string affectedproperty;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LayoutEventArgs (Control affectedControl, string affectedProperty)
+ {
+ affectedproperty = affectedProperty;
+ affectedcontrol = affectedControl;
+ }
+
+ #region Public Properties
+
+ public Control AffectedControl {
+ get {
+ return affectedcontrol;
+ }
+ }
+ public string AffectedProperty {
+ get {
+ return affectedproperty;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs
new file mode 100644
index 00000000000..b7a1c8e916e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.LayoutEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void LayoutEventHandler (
+ object sender,
+ LayoutEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs
new file mode 100644
index 00000000000..d2454491c06
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.LeftRightAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum LeftRightAlignment {
+ Left = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkArea.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkArea.cs
new file mode 100644
index 00000000000..ac77a24d625
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkArea.cs
@@ -0,0 +1,68 @@
+//
+// System.Drawing.LinkArea.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public struct LinkArea {
+
+ private int start;
+ private int length;
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+
+ public LinkArea (int Start, int Length)
+ {
+ start = Start;
+ length = Length;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ public bool IsEmpty {
+ get{
+ // Start can be 0, so no way to know if it is empty.
+ // Docs seem to say Start must/should be set before
+ // length, os if length is valid, start must also be ok.
+ return length!=0;
+ }
+ }
+
+ public int Start {
+ get{
+ return start;
+ }
+ set{
+ start = value;
+ }
+ }
+
+ public int Length {
+ get{
+ return length;
+ }
+ set{
+ length = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkBehavior.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkBehavior.cs
new file mode 100644
index 00000000000..8770c78e51a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkBehavior.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.LinkBehavior.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum LinkBehavior {
+ AlwaysUnderline = 1,
+ HoverUnderline = 2,
+ NeverUnderline = 3,
+ SystemDefault = 0,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs
new file mode 100644
index 00000000000..3313970228a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs
@@ -0,0 +1,45 @@
+//
+// System.Windows.Forms.LinkClickedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class LinkClickedEventArgs : EventArgs {
+
+ #region Fields
+
+ private string linktext;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LinkClickedEventArgs(string linkText)
+ {
+ linktext = linkText;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public string LinkText
+ {
+ get {
+ return linktext;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs
new file mode 100644
index 00000000000..50225ba7983
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.LinkClickedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void LinkClickedEventHandler (
+ object sender,
+ LinkClickedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs
new file mode 100644
index 00000000000..7cafa305b0e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs
@@ -0,0 +1,478 @@
+//
+// System.Windows.Forms.LinkLabel.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// stub ammended by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class LinkLabel : Label, IButtonControl {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public LinkLabel()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Color ActiveLinkcolor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Color DisabledLinkColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public LinkArea LinkArea {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public LinkBehavior LinkBehavior {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Color LinkColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public LinkLabel.LinkCollection Links {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool LinkVisited {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ //FIXME: This is to get it to run
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public Color VisitedLinkColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ // --- IButtonControl members:
+ DialogResult IButtonControl.DialogResult {
+ [MonoTODO] get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO] set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IButtonControl.NotifyDefault(bool value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IButtonControl.PerformClick()
+ {
+ //FIXME:
+ }
+ // --- end of IButtonControl members
+
+
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event LinkLabelLinkClickedEventHandler LinkClicked;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ //FIXME:
+ return DefaultImeMode;
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ //FIXME:
+ return CreateAccessibilityInstance();
+ }
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ //FIXME: this is just to get it running
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected override void OnEnabledChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnEnabledChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnFontChanged( EventArgs e)
+ {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnGotFocus( EventArgs e)
+ {
+ //FIXME:
+ base.OnGotFocus(e);
+ }
+ [MonoTODO]
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyDown(e);
+ }
+ [MonoTODO]
+ protected override void OnLostFocus (EventArgs e)
+ {
+ //FIXME:
+ base.OnLostFocus(e);
+ }
+ [MonoTODO]
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseDown(e);
+ }
+ // I think that this should be 'MouseEventArgs'
+ // but the documentation says EventArgs.
+ [MonoTODO]
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ //FIXME:
+ base.OnMouseLeave(e);
+ }
+ [MonoTODO]
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseMove(e);
+ }
+ [MonoTODO]
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseUp(e);
+ }
+ [MonoTODO]
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaint(e);
+ }
+ [MonoTODO]
+ protected override void OnPaintBackground(PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaint(e);
+ }
+ [MonoTODO]
+ protected override void OnTextAlignChanged( EventArgs e)
+ {
+ //FIXME:
+ base.OnTabIndexChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnTextChanged( EventArgs e)
+ {
+ //FIXME:
+ base.OnTabIndexChanged(e);
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ //FIXME:
+ return base.ProcessDialogKey(keyData);
+ }
+
+ [MonoTODO]
+ protected override void Select(bool directed, bool forward)
+ {
+ //FIXME:
+ base.Select(directed, forward);
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(
+ int x,
+ int y,
+ int width,
+ int height,
+ BoundsSpecified specified) {
+
+ //FIXME:
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message msg)
+ {
+ //FIXME:
+ base.WndProc(ref msg);
+ }
+
+ /// System.Windows.Forms.LinkLabel.Link
+ /// <summary>Represents a link within a LinkLabel control.</summary>
+ ///
+ /// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+ [MonoTODO]
+ public class Link {
+ bool enabled;
+ int length;
+ object linkData;
+ int start;
+ bool visited;
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled=value; }
+ }
+
+ public int Length {
+ get { return length; }
+ set { length=value; }
+ }
+
+ public object LinkData {
+ get { return linkData; }
+ set { linkData=value; }
+ }
+
+ public int Start {
+ get { return start; }
+ set { start=value; }
+ }
+
+ public bool Visited {
+ get { return visited; }
+ set { visited=value; }
+ }
+ }
+
+//
+// System.Windows.Forms.LinkLabel.LinkCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+//
+// (C) 2002 Ximian, Inc
+//
+
+ // <summary>
+ // </summary>
+
+ public class LinkCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public LinkCollection(LinkLabel owner)
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual LinkLabel.Link this[ int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public Link Add(int val1, int val2)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Link Add(int val1, int val2, object o)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(LinkLabel.Link link)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Remove(LinkLabel.Link value)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+
+ /// --- LinkLabel.IList properties ---
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object IList.this[int index] {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+
+ object ICollection.SyncRoot {
+ [MonoTODO] get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ [MonoTODO] get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void ICollection.CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- LinkLabel.IList methods ---
+ [MonoTODO]
+ int IList.Add(object control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains(object control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf(object control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index,object value)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove(object control)
+ {
+ //FIXME:
+ }
+ }//End of subclass
+ }// End of Class
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs
new file mode 100644
index 00000000000..51d14e0efc3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs
@@ -0,0 +1,45 @@
+//
+// System.Windows.Forms.LinkLabelLinkClickedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class LinkLabelLinkClickedEventArgs : EventArgs {
+
+ #region Fields
+
+ private LinkLabel.Link link;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+
+ public LinkLabelLinkClickedEventArgs(LinkLabel.Link link)
+ {
+ this.link = link;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public LinkLabel.Link Link{
+ get {
+ return link;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs
new file mode 100644
index 00000000000..7b840eaee2f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.LinkLabelLinkClickEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void LinkLabelLinkClickedEventHandler (
+ object sender,
+ LinkLabelLinkClickedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkState.cs
new file mode 100644
index 00000000000..3ba1b9256d3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkState.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.LinkState.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum LinkState {
+ Active = 2,
+ Hover = 1,
+ Normal = 0,
+ Visited = 4
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs
new file mode 100644
index 00000000000..36728567ac9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs
@@ -0,0 +1,61 @@
+//
+// System.Windows.Forms.ListBindingConverter.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+ public class ListBindingConverter : TypeConverter {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListBindingConverter()
+ {
+
+ }
+
+ //
+ // --- Public Methods
+ //
+ //
+
+ [MonoTODO]
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type t)
+ {
+ //FIXME:
+ return base.CanConvertTo(context, t);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object o, Type t)
+ {
+ //FIXME:
+ return base.ConvertTo(context, culture,o, t);
+ }
+ [MonoTODO]
+ public override object CreateInstance(ITypeDescriptorContext context, IDictionary dict)
+ {
+ //FIXME:
+ return base.CreateInstance(context, dict);;
+ }
+
+ [MonoTODO]
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetCreateInstanceSupported(context);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs
new file mode 100644
index 00000000000..7bbd205c02c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs
@@ -0,0 +1,858 @@
+//
+// System.Windows.Forms.ListBox.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ListBox : ListControl {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListBox() {
+
+ }
+
+ //
+ // --- Public Fields
+ //
+ public const int DefaultItemHeight = 500;//just guessing FIXME // = ??;
+ public const int NoMatches = 0 ;//just guessing FIXME // = ??;
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ //FIXME:
+ return base.BackColor;
+ }
+ set {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+ [MonoTODO]
+ public override RightToLeft RightToLeft {
+ get {
+ //FIXME:
+ return base.RightToLeft;
+ }
+ set {
+ //FIXME:
+ base.RightToLeft = value;
+ }
+ }
+ [MonoTODO]
+ public bool ScrollAlwaysVisible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override int SelectedIndex {
+ get {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ListBox.SelectedIndexCollection SelectedIndices {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public object SelectedItem {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ListBox.SelectedObjectCollection SelectedItems {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual SelectionMode SelectionMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool Sorted {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public int TopIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool UseTabStops {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public virtual DrawMode DrawMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public virtual int ItemHeight {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void BeginUpdate() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void ClearSelected() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EndUpdate() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public int FindString(string str) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int FindString(string str, int val) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int FindStringExact(string str) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int FindStringExact(string str, int val) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int GetItemHeight(int index) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Rectangle GetItemRectangle(int index) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool GetSelected(int index) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexFromPoint(Point pt) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexFromPoint(int val1, int val2) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SetSelected(int index, bool val) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString() {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event DrawItemEventHandler DrawItem;
+ [MonoTODO]
+ public event MeasureItemEventHandler MeasureItem;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "LISTBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new Size(120,95);
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected virtual ObjectCollection CreateItemCollection() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnChangeUICues(UICuesEventArgs e) {
+ //FIXME:
+ base.OnChangeUICues(e);
+ }
+ [MonoTODO]
+ protected override void OnDataSourceChanged(EventArgs e) {
+ //FIXME:
+ base.OnDataSourceChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnDisplayMemberChanged(EventArgs e) {
+ //FIXME:
+ base.OnDisplayMemberChanged(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnDrawItem(DrawItemEventArgs e) {
+ //FIXME:
+ }
+
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e) {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e) {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e) {
+ //FIXME:
+ base.OnHandleDestroyed(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnMeasureItem(MeasureItemEventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnParentChanged(EventArgs e) {
+ //FIXME:
+ base.OnParentChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e) {
+ //FIXME:
+ base.OnResize(e);
+ }
+ [MonoTODO]
+ protected override void OnSelectedIndexChanged(EventArgs e) {
+ //FIXME:
+ base.OnSelectedIndexChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnSelectedValueChanged(EventArgs e) {
+ //FIXME:
+ base.OnSelectedValueChanged(e);
+ }
+
+ protected override void RefreshItem(int index) {
+ //FIXME:
+ }
+
+ public override void Refresh() { // .NET V1.1 Beta
+ base.Refresh();
+ }
+
+ [MonoTODO]
+ protected override void SetBoundsCore( int x, int y, int width, int height, BoundsSpecified specified) {
+ //FIXME:
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+ [MonoTODO]
+ protected void Sort() {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message msg) {
+ //FIXME:
+ base.WndProc(ref msg);
+ }
+
+ //
+ // <summary>
+ // This is a subclass
+ // </summary>
+
+ public class SelectedObjectCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SelectedObjectCollection(ListBox owner) {
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public object this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public bool Contains(object selectedObject) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(object selectedObject) {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+#if A
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+#endif
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }//End of subclass
+
+ // <summary>
+ // </summary>
+
+ public class ObjectCollection : IList, ICollection {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ObjectCollection(ListBox box) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public ObjectCollection(ListBox box, object[] objs) {
+ //FIXME:
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual object this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public int Add(object item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void AddRange(object[] items) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void AddRange(ListBox.ObjectCollection collection) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Clear() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public bool Contains(object value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(object[] dest, int arrayIndex) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(object val) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Insert(int index, object item) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Remove(object val) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void RemoveAt(int index) {
+ //FIXME:
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+#if A
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+#endif
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }//end of SubClass
+
+ // <summary>
+ // </summary>
+
+ public class SelectedIndexCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SelectedIndexCollection(ListBox owner) {
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public bool Contains(int selectedIndex) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }//End of subclass
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs
new file mode 100644
index 00000000000..c035ac66610
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs
@@ -0,0 +1,141 @@
+//
+// System.Windows.Forms.ListControl.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public abstract class ListControl : Control {
+
+ //ControlStyles controlStyles;
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public object DataSource {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string DisplayMember {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public abstract int SelectedIndex {get;set;}
+
+ [MonoTODO]
+ public object SelectedValue {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string ValueMember {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public string GetItemText(object Item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event EventHandler DataSourceChanged;
+ [MonoTODO]
+ public event EventHandler DisplayMemberChanged;
+
+ //
+ // --- Protected Constructor
+ //
+ [MonoTODO]
+ protected ListControl()
+ {
+
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected CurrencyManager DataManager {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+ [MonoTODO]
+ protected virtual void OnDataSourceChanged(EventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnDisplayMemberChanged(EventArgs e) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectedIndexChanged(EventArgs e) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectedValueChanged(EventArgs e){
+ //FIXME:
+ }
+
+
+ [MonoTODO]
+ protected override void OnBindingContextChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnBindingContextChanged(e);
+ }
+
+ [MonoTODO]
+ protected abstract void RefreshItem(int index);
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs
new file mode 100644
index 00000000000..444fe355c62
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs
@@ -0,0 +1,1476 @@
+//
+// System.Windows.Forms.ListView.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System;
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+ public class ListView : Control {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListView() {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public ItemActivation Activation {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ListViewAlignment Alignment {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowColumnReorder {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AutoArrange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ //FIXME:
+ return base.BackColor;
+ }
+ set {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool CheckBoxes {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public CheckedIndexCollection CheckedIndices {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public CheckedListViewItemCollection CheckedItems {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ColumnHeaderCollection Columns {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+ [MonoTODO]
+ public bool FullRowSelect {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool GridLines {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ColumnHeaderStyle HeaderStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool HideSelection {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool HoverSelection {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ListView.ListViewItemCollection Items {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool LabelEdit {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool LabelWrap {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ImageList LargeImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool MultiSelect {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool Scrollable {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ListView.SelectedIndexCollection SelectedIndices {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ListView.SelectedListViewItemCollection SelectedItems {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ImageList SmallImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public SortOrder Sorting {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ImageList StateImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public View View {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void ArrangeIcons() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void ArrangeIcons(ListViewAlignment align) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void BeginUpdate() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Clear() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EndUpdate() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EnsureVisible(int index) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public ListViewItem GetItemAt(int x, int y) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Rectangle RetItemRect(int val) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Rectangle RetItemRect(int val, ItemBoundsPortion portion) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString() {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event LabelEditEventHandler AfterLabelEdit;
+ public event LabelEditEventHandler BeforeLabelEdit;
+ public event ColumnClickEventHandler ColumnClick;
+ public event EventHandler ItemActivate;
+ public event ItemCheckEventHandler ItemCheck;
+ public event ItemDragEventHandler ItemDrag;
+ public event EventHandler SelectedIndexChanged;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "LISTVIEW";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new Size(121, 97); //Correct Size.
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override void CreateHandle() {
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData) {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+
+ [MonoTODO]
+ protected virtual void OnAfterLabelEdit(LabelEditEventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeLabelEdit(LabelEditEventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnColumnClick(ColumnClickEventArgs e) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnEnabledChanged(EventArgs e) {
+ //FIXME:
+ base.OnEnabledChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e) {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e) {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected virtual void OnItemActivate(EventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnItemCheck(ItemCheckEventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnItemDrag(ItemDragEventArgs e) {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnSelectedItemChanged(EventArgs e) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnSystemColorsChanged(EventArgs e) {
+ //FIXME:
+ base.OnSystemColorsChanged(e);
+ }
+ [MonoTODO]
+ protected override void Select(bool directed, bool forward) {
+ //FIXME:
+ base.Select(directed, forward);
+ }
+ [MonoTODO]
+ protected void UpdateExtendedStyles() {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m) {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ //start subclasses
+ //
+ // System.Windows.Forms.ListView.SelectedListViewItemCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ // <summary>
+ // </summary>
+
+ public class SelectedListViewItemCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SelectedListViewItemCollection(ListView owner) {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ListViewItem this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void Clear() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public bool Contains(ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+ //
+ // System.Windows.Forms.ListView.CheckedListViewItemCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ // <summary>
+ // </summary>
+
+ public class CheckedListViewItemCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public CheckedListViewItemCollection(ListView owner) {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ListViewItem this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public bool Contains(ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object CopyTo(Array dest, int index) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+ //
+ // System.Windows.Forms.ListView.ColumnHeaderCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ // <summary>
+ // </summary>
+
+ public class ColumnHeaderCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ColumnHeaderCollection(ListView owner) {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual ColumnHeader this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public virtual int Add(ColumnHeader value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual ColumnHeader Add(string s, int b, HorizontalAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void AddRange(ColumnHeader[] values) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Clear() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public bool Contains(ColumnHeader value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(ColumnHeader value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Insert(int b, ColumnHeader value) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Insert(int val1, string str, int val2, HorizontalAlignment align) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public virtual void Remove(ColumnHeader value) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public virtual void RemoveAt(int index) {
+ //FIXME:
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ object IList.this[int index]{
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+ //
+ // System.Windows.Forms.ListView.ListViewItemCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ // <summary>
+ // </summary>
+
+ public class ListViewItemCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListViewItemCollection (ListView owner) {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual ListViewItem this [int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public virtual ListViewItem Add (ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual ListViewItem Add (string str) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual ListViewItem Add (string str, int val) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void AddRange(ListViewItem[] values) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Clear() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public bool Contains(ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(ListViewItem item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Remove(ListViewItem item) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public virtual void RemoveAt(int index) {
+ //FIXME:
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+ //
+ // System.Windows.Forms.ListView.SelectedIndexCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ // <summary>
+ // </summary>
+
+ public class SelectedIndexCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SelectedIndexCollection(ListView owner) {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int this [int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public bool Contains(ListView item) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(int index) {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ object IList.this[int index]{
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+ //
+ // System.Windows.Forms.ListView.CheckedIndexCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ // <summary>
+ // </summary>
+
+ public class CheckedIndexCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public CheckedIndexCollection(ListView owner) {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public bool Contains(int checkedIndex) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override bool Equals(object obj) {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(int checkedIndex) {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+ //***********************************
+ // Sub Class
+ //***********************************
+// [MonoTODO]
+// // FIXME this sub class has many members that have not been stubbed out.
+// public class CheckedListViewItemCollection {
+// CheckedListViewItemCollection(ListView owner){
+// throw new NotImplementedException ();
+// }
+// }
+// [MonoTODO]
+// // FIXME this sub class has many members that have not been stubbed out.
+// public class ColumnHeaderCollection {
+// ColumnHeaderCollection(ListView owner){
+// throw new NotImplementedException ();
+// }
+//
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs
new file mode 100644
index 00000000000..df6e8e58705
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ListViewAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ListViewAlignment {
+ Default = 0,
+ Left = 1,
+ SnapToGrid = 5,
+ Top = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs
new file mode 100644
index 00000000000..0ac06cee193
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs
@@ -0,0 +1,554 @@
+//
+// System.Windows.Forms.ListViewItem.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Runtime.Serialization;
+using System.Drawing;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ListViewItem : ICloneable, ISerializable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListViewItem()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewItem(string str)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewItem(string[] strings)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewItem(ListViewItem.ListViewSubItem[] subItems)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewItem(string str, int val)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewItem(string[] strings, int val)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewItem(string[] strings, int val, Color color1, Color color2, Font font)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Rectangle Bounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Checked {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool Focused {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Font Font {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Color Forecolor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ImageList ImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Index {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ListView ListView {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Selected {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int StateImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ListViewSubItemCollection SubItems {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public object Tag {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string Text {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool UseItemStyleForSubItems {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void BeginEdit()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public object Clone()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void EnsureVisible()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public Rectangle GetBounds(ItemBoundsPortion portion)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Remove()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected virtual void Deserialize(SerializationInfo info, StreamingContext context)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void Serialize(SerializationInfo info, StreamingContext context)
+ {
+ //FIXME:
+ }
+
+ // ISerializable.method:
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo info,StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // System.Windows.Forms.ListViewItem.ListViewSubItemCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ // stub ammended by Jaak Simm (jaaksimm@firm.ee)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ // <summary>
+ // </summary>
+ [MonoTODO]
+ [Serializable]
+ public class ListViewSubItemCollection : IList, ICollection, IEnumerable {
+ /// Constructors
+ [MonoTODO]
+ public ListViewSubItemCollection(ListViewItem owner)
+ {
+ //FIXME:
+ }
+
+
+ /// Properties
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public ListViewSubItem this[int index] {
+ get { throw new NotImplementedException (); }
+ set {
+ //FIXME:
+ }
+ }
+
+
+ /// --- ICollection properties ---
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object IList.this[int index] {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+
+ /// Methods
+ [MonoTODO]
+ public ListViewSubItem Add(ListViewItem.ListViewSubItem item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewSubItem Add(string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ListViewSubItem Add(string text,Color foreColor,Color backColor,Font font)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange(ListViewItem.ListViewSubItem[] items)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void AddRange(string[] items)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void AddRange(
+ string[] items,
+ Color foreColor,
+ Color backColor,
+ Font font) {
+
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public bool Contains(ListViewItem.ListViewSubItem subItem)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ICollection.CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add(object item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains(object subItem)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf(object subItem)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index,object item)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove(object item)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public int IndexOf(ListViewItem.ListViewSubItem subItem)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Insert(int index,ListViewItem.ListViewSubItem item)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void Remove(ListViewItem.ListViewSubItem item)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+ }
+ //
+ // System.Windows.Forms.ListViewItem.ListViewSubItem.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ // <summary>
+ // </summary>
+
+ public class ListViewSubItem {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListViewSubItem()
+ {
+ }
+ [MonoTODO]
+ public ListViewSubItem(ListViewItem item, string str)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public ListViewSubItem(ListViewItem item, string str, Color color1, Color color2, Font font)
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Font Font {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string Text {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ //FIXME:
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public void ResetStyle()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs
new file mode 100644
index 00000000000..654a2bdef53
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs
@@ -0,0 +1,42 @@
+//
+// System.Windows.Forms.ListViewItemConverter.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+using System.ComponentModel;
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ListViewItemConverter : ExpandableObjectConverter {
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ListViewItemConverter()
+ {
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type type)
+ {
+ //FIXME:
+ return base.CanConvertTo(context, type);
+ }
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object obj, Type type)
+ {
+ //FIXME:
+ return base.ConvertTo(context, type);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs
new file mode 100644
index 00000000000..0196339e095
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs
@@ -0,0 +1,79 @@
+//
+// System.Windows.Forms.MainMenu.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+// Alexandre Pigolkine (pigolkine@gmx.de)
+//
+// (C) 2002 Ximian, Inc
+//
+
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using System.Runtime.Remoting;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+
+ public class MainMenu : Menu {
+
+ //
+ // --- Constructors
+ //
+
+ [MonoTODO]
+ public MainMenu() : base(null)
+ {
+ }
+
+ [MonoTODO]
+ public MainMenu(MenuItem[] items) : base(items)
+ {
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public virtual MainMenu CloneMenu()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public Form GetForm()
+ {
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME: Replace with real to string.
+ return base.ToString();
+ }
+
+ //
+ // -- Public Properties
+ //
+
+ [MonoTODO]
+ public virtual RightToLeft RightToLeft {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MdiLayout.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MdiLayout.cs
new file mode 100644
index 00000000000..64bdf8eaa62
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MdiLayout.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.MdiLayout.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MdiLayout {
+ ArrangeIcons = 3,
+ Cascade = 0,
+ TileHorizontal = 1,
+ TileVertical = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs
new file mode 100644
index 00000000000..a4c3db75a81
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs
@@ -0,0 +1,96 @@
+//
+// System.Windows.Forms.MeasureItemEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// </summary>
+
+ public class MeasureItemEventArgs : EventArgs {
+
+ #region Fields
+
+ private Graphics graphics;
+ private int index;
+ private int itemheight = -1;
+ private int itemwidth = -1;
+
+ #endregion
+
+ //
+ // --- Constructors
+ //
+ public MeasureItemEventArgs(Graphics graphics, int index)
+ {
+ this.index = index;
+ this.graphics = graphics;
+ }
+
+ public MeasureItemEventArgs(Graphics graphics, int index, int itemheight)
+ {
+ this.index = index;
+ this.graphics = graphics;
+ itemheight = ItemHeight;
+ }
+
+ #region Public Properties
+
+ public Graphics Graphics
+ {
+ get
+ {
+ return graphics;
+ }
+ }
+
+ public int Index
+ {
+ get
+ {
+ return index;
+ }
+ }
+
+ public int ItemHeight
+ {
+ get
+ {
+ return itemheight;
+ }
+ set
+ {
+ itemheight = value;
+ }
+ }
+
+ public int ItemWidth
+ {
+ get
+ {
+ return itemwidth;
+ }
+ set
+ {
+ itemwidth = value;
+ }
+ }
+
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs
new file mode 100644
index 00000000000..9b690b45c2e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.MeasureItemEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the MeasureItem event of the
+ /// ListBox, ComboBox, CheckedListBox, or MenuItem controls.
+ /// </summary>
+ [Serializable]
+ public delegate void MeasureItemEventHandler(object sender, MeasureItemEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs
new file mode 100644
index 00000000000..58e6a3dd735
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs
@@ -0,0 +1,473 @@
+//
+// System.Windows.Forms.Menu.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+// Alexandre Pigolkine (pigolkine@gmx.de)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using System.Collections;
+using System.Runtime.Remoting;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// </summary>
+ using System.ComponentModel;
+ public abstract class Menu : Component {
+
+ //
+ // -- Public Methods
+ //
+
+ [MonoTODO]
+ public ContextMenu GetContextMenu() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public MainMenu GetMainMenu() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public virtual void MergeMenu(Menu menuSrc) {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ //do our own ToString here.
+ // this is overrridden
+ return base.ToString();
+ }
+
+ //
+ // -- Protected Methods
+ //
+
+ protected void CloneMenu(Menu menuSrc) {
+ //FIXME:
+ }
+
+ protected Menu( MenuItem[] items) {
+ MenuItems.AddRange ( items);
+ }
+
+ //
+ // -- Public Properties
+ //
+
+ protected internal bool menuStructureModified_ = true;
+
+ internal void BuildMenuStructure ()
+ {
+ if( menuStructureModified_) {
+ while( Win32.RemoveMenu( menuHandle_, 0, (uint)MF_.MF_BYPOSITION) != 0);
+ foreach(MenuItem mi in MenuItems) {
+ System.Console.WriteLine("MenuItem {0} Parent {1}", mi.Text, mi.IsParent);
+ if( mi.IsParent){
+ Win32.AppendMenuA( menuHandle_, (int)MF_.MF_ENABLED | (int)MF_.MF_STRING | (int)MF_.MF_POPUP,
+ mi.Handle, mi.Text);
+ }
+ else {
+ Win32.AppendMenuA( menuHandle_, (int)MF_.MF_ENABLED | (int)MF_.MF_STRING,
+ (IntPtr) mi.GetID(), mi.Text);
+ }
+ }
+ menuStructureModified_ = false;
+ }
+ }
+
+ protected Menu parent_ = null;
+
+ protected IntPtr menuHandle_ = IntPtr.Zero;
+ internal void CreateMenuHandle()
+ {
+ if( menuHandle_ == IntPtr.Zero) {
+ menuHandle_ = Win32.CreateMenu();
+ //System.Console.WriteLine("Create menu {0}", menuHandle_);
+ BuildMenuStructure();
+ allMenus_[menuHandle_] = this;
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ CreateMenuHandle();
+ return menuHandle_;
+ }
+ }
+
+ public virtual bool IsParent {
+
+ get {
+ return MenuItems.Count != 0;
+ }
+ }
+
+ public MenuItem MdiListItem {
+
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ private Menu.MenuItemCollection menuCollection_ = null;
+
+ public Menu.MenuItemCollection MenuItems {
+ get {
+ if( menuCollection_ == null) {
+ menuCollection_ = new Menu.MenuItemCollection( this);
+ }
+ return menuCollection_;
+ }
+ }
+
+ // Library interface
+
+ // Recursively searches for specified item in menu.
+ // Goes immediately into child, when mets one.
+ internal MenuItem GetMenuItemByID (uint id)
+ {
+ foreach( MenuItem mi in MenuItems) {
+ if( mi.IsParent) {
+ MenuItem submi = mi.GetMenuItemByID(id);
+ if( submi != null) return submi;
+ }
+ else {
+ if( mi.GetID() == id){
+ return mi;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static Hashtable allMenus_ = new Hashtable();
+
+ internal static Menu GetMenuByHandle (IntPtr hMenu)
+ {
+ Menu result = null;
+ try {
+ result = allMenus_[hMenu] as Menu;
+ }
+ catch(ArgumentNullException) {
+ }
+ catch(NotSupportedException) {
+ }
+ return result;
+ }
+
+ internal void OnNewMenuItemAdd (MenuItem mi)
+ {
+ menuStructureModified_ = true;
+ mi.SetParent( this);
+ }
+
+ internal void OnRemoveMenuItem (MenuItem mi)
+ {
+ if(menuHandle_ != IntPtr.Zero) {
+ menuStructureModified_ = true;
+ }
+ mi.SetParent( null);
+ }
+
+ internal void OnLastSubItemRemoved ()
+ {
+ if( menuHandle_ != IntPtr.Zero) {
+ //System.Console.WriteLine("Delete menu {0}", menuHandle_);
+ Win32.DestroyMenu(menuHandle_);
+ allMenus_.Remove(menuHandle_);
+ menuHandle_ = IntPtr.Zero;
+
+ if( parent_ != null) {
+ parent_.menuStructureModified_ = true;
+ }
+ }
+ }
+
+ internal void OnWmInitMenu ()
+ {
+ }
+
+ internal void OnWmInitMenuPopup ()
+ {
+ BuildMenuStructure();
+ }
+
+ //
+ // -- Protected Properties
+ //
+
+ //
+ // System.Windows.Forms.Menu.MenuItemCollection.cs
+ //
+ // Author:
+ // stubbed out by Paul Osman (paul.osman@sympatico.ca)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ /// <summary>
+ /// </summary>
+
+ public class MenuItemCollection : IList, ICollection, IEnumerable {
+ private ArrayList items_ = new ArrayList();
+ private Menu parentMenu_ = null;
+ //
+ // -- Constructor
+ //
+
+ public MenuItemCollection (Menu m) {
+ parentMenu_ = m;
+ }
+
+ internal void MoveItemToIndex( int index, MenuItem mi)
+ {
+ if( index >= items_.Count){
+ // FIXME: Set exception parameters
+ throw new ArgumentException();
+ }
+ else if( items_.Count != 1){
+ items_.Remove (mi);
+ items_.Insert (index, mi);
+ mi.SetIndex(index);
+ }
+ }
+
+ //
+ // -- Public Methods
+ //
+
+ public virtual int Add (MenuItem mi) {
+ int result = -1;
+ if( mi != null && parentMenu_ != null){
+ parentMenu_.OnNewMenuItemAdd(mi);
+ items_.Add(mi);
+ result = items_.Count - 1;
+ mi.SetIndex(result);
+ //System.Console.WriteLine("Adding menuItem {0}, parent {1}", mi.Text, mi.IsParent);
+/*
+ if( mi.IsParent){
+ Win32.AppendMenuA( parentMenu_.Handle, (int)MF_.MF_ENABLED | (int)MF_.MF_STRING | (int)MF_.MF_POPUP,
+ mi.Handle, mi.Text);
+ }
+ else {
+ Win32.AppendMenuA( parentMenu_.Handle, (int)MF_.MF_ENABLED | (int)MF_.MF_STRING,
+ (IntPtr) mi.GetID(), mi.Text);
+ }
+*/
+ }
+ return result;
+ }
+
+ private MenuItem AddMenuItemCommon (MenuItem mi) {
+ return ( -1 != Add (mi)) ? mi : null;
+ }
+
+ public virtual MenuItem Add ( string s) {
+ return AddMenuItemCommon( new MenuItem (s));
+ }
+
+ public virtual int Add ( int i, MenuItem mi) {
+ if( i > items_.Count){
+ // FIXME: Set exception details
+ throw new System.ArgumentException();
+ }
+ int result = -1;
+ if( mi != null && parentMenu_ != null){
+ parentMenu_.OnNewMenuItemAdd(mi);
+ items_.Insert(i, mi);
+ result = i;
+ mi.SetIndex(result);
+/*
+ if( mi.IsParent){
+ Win32.InsertMenuA( parentMenu_.Handle, (uint)i,
+ (int)MF_.MF_ENABLED | (int)MF_.MF_STRING | (int)MF_.MF_POPUP | (int)MF_.MF_BYPOSITION,
+ mi.Handle, mi.Text);
+ }
+ else {
+ Win32.InsertMenuA( parentMenu_.Handle, (uint)i,
+ (int)MF_.MF_ENABLED | (int)MF_.MF_STRING | (int)MF_.MF_BYPOSITION,
+ (IntPtr) mi.GetID(), mi.Text);
+ }
+*/
+ }
+ return result;
+ }
+
+ public virtual MenuItem Add (string s, EventHandler e) {
+ return AddMenuItemCommon(new MenuItem ( s, e));
+ }
+
+ public virtual MenuItem Add (string s, MenuItem[] items) {
+ return AddMenuItemCommon(new MenuItem ( s, items));
+ }
+
+ public virtual void AddRange(MenuItem[] items) {
+ if( items != null) {
+ foreach( MenuItem mi in items) {
+ Add(mi);
+ }
+ }
+ }
+
+ public virtual void Clear() {
+ if( parentMenu_ != null){
+ foreach( MenuItem mi in items_) {
+ parentMenu_.OnRemoveMenuItem( mi);
+ }
+ }
+ items_.Clear();
+ if( parentMenu_ != null){
+ parentMenu_.OnLastSubItemRemoved();
+ }
+ }
+
+ public bool Contains(MenuItem m) {
+ return items_.Contains(m);
+ }
+
+ public void CopyTo(Array a, int i) {
+ int targetIdx = i;
+ foreach( MenuItem mi in items_) {
+ MenuItem newMi = mi.CloneMenu();
+ a.SetValue(newMi,targetIdx++);
+ }
+ }
+
+ public IEnumerator GetEnumerator() {
+ return items_.GetEnumerator();
+ }
+
+ public int IndexOf(MenuItem m) {
+ return items_.IndexOf(m);
+ }
+
+ public virtual void Remove(MenuItem m) {
+ if( m != null && parentMenu_ != null){
+ if( Contains(m)){
+ parentMenu_.OnRemoveMenuItem(m);
+ items_.Remove(m);
+ if( items_.Count == 0){
+ parentMenu_.OnLastSubItemRemoved();
+ }
+ }
+ }
+ }
+
+ public virtual void RemoveAt(int i) {
+ Remove(items_[i] as MenuItem);
+ }
+
+ //
+ // -- Public Properties
+ //
+
+ public int Count {
+
+ get {
+ return items_.Count;
+ }
+ }
+
+ // public virtual MenuItem this(int i)
+ // {
+ // get
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ object IList.this[int index]{
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+ }
+}
+
+
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuGlyph.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuGlyph.cs
new file mode 100644
index 00000000000..393a0546e4c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuGlyph.cs
@@ -0,0 +1,24 @@
+
+//
+// System.Windows.Forms.MenuGlyph.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MenuGlyph {
+ Arrow = 0,
+ Bullet = 2,
+ Checkmark = 1,
+ Max = 2,
+ Min = 0
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs
new file mode 100644
index 00000000000..3468336935b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs
@@ -0,0 +1,388 @@
+//
+// System.Windows.Forms.Menu.MenuItem.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+// Alexandre Pigolkine (pigolkine@gmx.de)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using System.Runtime.Remoting;
+using System.ComponentModel;
+using System.Text;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+
+ public class MenuItem : Menu {
+ //
+ // - Constructor
+ //
+ public MenuItem() : base(null) {
+ }
+
+ public MenuItem(string s) : this(){
+ text_ = s;
+ }
+
+ public MenuItem(string s, EventHandler e) : this() {
+ text_ = s;
+ Click += e;
+ }
+
+ public MenuItem(string s, MenuItem[] items) : base(items) {
+ text_ = s;
+ }
+
+ public MenuItem(string s, EventHandler e, Shortcut sc) : this() {
+ throw new NotImplementedException ();
+ }
+
+ public MenuItem(MenuMerge mm, int i, Shortcut sc, string s, EventHandler e, EventHandler e1, EventHandler e2, MenuItem[] items) : base(items){
+ throw new NotImplementedException ();
+ }
+
+ //
+ // -- Public Methods
+ //
+
+ public virtual MenuItem CloneMenu() {
+ MenuItem result = new MenuItem();
+ result.CloneMenu(this);
+ return result;
+ }
+
+ public override ObjRef CreateObjRef(Type t) {
+ throw new NotImplementedException ();
+ }
+
+ public override bool Equals(object o) {
+ return base.Equals(o);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ public virtual MenuItem MergeMenu() {
+ throw new NotImplementedException ();
+ }
+
+ public void MergeMenu(MenuItem m) {
+ throw new NotImplementedException ();
+ }
+
+ public void PerformClick() {
+ OnClick( new EventArgs());
+ }
+
+ public virtual void PerformSelect() {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString() {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(base.ToString());
+ sb.AppendFormat(", Items.Count: {0}, Text: {1}", MenuItems.Count, Text);
+ return sb.ToString();
+ }
+
+ //
+ // -- Protected Methods
+ //
+
+ protected void CloneMenu(MenuItem m) {
+ Text = m.Text;
+ Click += m.Click;
+ if( m.MenuItems.Count != 0){
+ MenuItem[] all_items = new MenuItem[m.MenuItems.Count];
+ m.MenuItems.CopyTo(all_items, 0);
+ MenuItems.AddRange(all_items);
+ }
+ }
+
+ ~MenuItem() {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnClick(EventArgs e) {
+ if( Click != null){
+ Click(this,e);
+ }
+ }
+
+ protected virtual void OnDrawItem(DrawItemEventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnMeasureItem(MeasureItemEventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnPopUp(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnSelect(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // -- Public Properties
+ //
+
+ public bool BarBreak {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool Break {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool Checked {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //public IContainer Container {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public bool DefaultItem {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool Enabled {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+/*
+ // completely inherit from base class
+ public new IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+*/
+ protected int index_ = -1;
+
+ internal void SetIndex( int value)
+ {
+ index_ = value;
+ }
+
+ public int Index {
+
+ get {
+ return index_;
+ }
+ set {
+ if( index_ != value){
+ if(Parent != null){
+ Parent.MenuItems.MoveItemToIndex(value, this);
+ Parent.menuStructureModified_ = true;
+ }
+ }
+ }
+ }
+
+ public override bool IsParent {
+
+ get {
+ return base.IsParent;
+ }
+ }
+
+ public bool MdiList {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int MergeOrder {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public MenuMerge MergeType {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public char Mnemonic {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool OwnerDraw {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal void SetParent( Menu parent) {
+ // FIXME: set exception parameters
+ if( parent != null && parent_ != null)
+ throw new System.Exception();
+ parent_ = parent;
+ }
+
+ public Menu Parent {
+
+ get {
+ return parent_;
+ }
+ }
+
+ public bool RadioCheck {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Shortcut Shortcut {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ private string text_ = String.Empty;
+
+ public string Text {
+ get {
+ return text_;
+ }
+ set {
+ text_ = value;
+ }
+ }
+
+ public bool Visible {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // -- Protected Properties
+ //
+
+ internal const int INVALID_MENU_ID = -1; //0xffffffff;
+ // Variables are stored here to provide access for the base functions
+ protected int MenuID_ = INVALID_MENU_ID;
+
+ // Provides unique id to all items in all menus, hopefully space is enougth.
+ // Possible to use array to keep ids from deleted menu items
+ // and reuse them.
+ protected static int MenuIDs_ = 1;
+
+ protected int GetNewMenuID()
+ {
+ return MenuIDs_++;
+ }
+
+ protected int MenuID {
+
+ get {
+ if( MenuID_ == INVALID_MENU_ID) {
+ MenuID_ = GetNewMenuID();
+ }
+ return (int)MenuID_;
+ }
+ }
+
+ //
+ // Btw, this function is funky, it is being used by routines that are supposed
+ // to be passing an IntPtr to the AppendMenu function
+ //
+ internal int GetID()
+ {
+ return MenuID;
+ }
+
+ //
+ // -- Public Events
+ //
+
+ public event EventHandler Click;
+ //inherited
+ //public event EventHandler Disposed;
+ public event DrawItemEventHandler DrawItem;
+ public event MeasureItemEventHandler MeasureItem;
+ public event EventHandler PopUp;
+ public event EventHandler Select;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuMerge.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuMerge.cs
new file mode 100644
index 00000000000..b6b8fc9653a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuMerge.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.MenuMerge.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MenuMerge {
+ Add = 0,
+ MergeItems = 2,
+ Remove = 3,
+ Replace = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Message.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Message.cs
new file mode 100644
index 00000000000..65688396f29
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Message.cs
@@ -0,0 +1,172 @@
+//
+// System.Drawing.Message.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+//TODO uncomment and implment GetLParam.
+using System;
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public struct Message {
+
+ private Msg msg;
+ private IntPtr hwnd;
+ private IntPtr lparam;
+ private IntPtr wparam;
+ private IntPtr result;
+
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Message objects. The return value is
+ /// based on the equivalence of the Msg, HWnd, LParam,
+ /// WParam, and Result properties of the two objects.
+ /// </remarks>
+
+ public static bool operator == (Message msg_a,
+ Message msg_b) {
+
+ return ((msg_a.msg == msg_b.msg) &&
+ (msg_a.hwnd == msg_b.hwnd) &&
+ (msg_a.lparam == msg_b.lparam) &&
+ (msg_a.wparam == msg_b.wparam) &&
+ (msg_a.result == msg_b.result));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Message objects. The return value is
+ /// based on the equivalence of the Msg, HWnd, LParam,
+ /// WParam, and Result properties of the two objects.
+ /// </remarks>
+
+ public static bool operator != (Message msg_a,
+ Message msg_b) {
+ return ((msg_a.msg != msg_b.msg) ||
+ (msg_a.hwnd != msg_b.hwnd) ||
+ (msg_a.lparam != msg_b.lparam) ||
+ (msg_a.wparam != msg_b.wparam) ||
+ (msg_a.result != msg_b.result));
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ public Msg Msg {
+ get{
+ return msg;
+ }
+ set{
+ msg = value;
+ }
+ }
+
+ public IntPtr HWnd {
+ get{
+ return hwnd;
+ }
+ set{
+ hwnd = value;
+ }
+ }
+
+ public IntPtr LParam {
+ get{
+ return lparam;
+ }
+ set{
+ lparam = value;
+ }
+ }
+
+ public IntPtr WParam {
+ get{
+ return wparam;
+ }
+ set{
+ wparam = value;
+ }
+ }
+
+ public IntPtr Result {
+ get{
+ return result;
+ }
+ set{
+ result = value;
+ }
+ }
+
+ public static Message create(IntPtr hWnd, Msg msg, IntPtr wparam, IntPtr lparam)
+ {
+ Message NewMessage = new Message();
+ NewMessage.msg = msg;
+ NewMessage.wparam = wparam;
+ NewMessage.lparam = lparam;
+ NewMessage.hwnd = hWnd;
+ return NewMessage;
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Message and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is Message))
+ return false;
+
+ return (this == (Message) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode();// (int)( msg ^ lparam ^ wparam ^ result ^ whnd);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Message as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3},{4}]", msg.ToString(), lparam.ToString(), wparam.ToString(), result.ToString(), hwnd.ToString());
+ }
+
+// public object GetLParam(Type cls){
+// // throw new NotImplementedException ();
+// //return (object) lparam;
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBox.cs
new file mode 100644
index 00000000000..a723f6299ce
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBox.cs
@@ -0,0 +1,129 @@
+//
+// System.Windows.Forms.MessageBox.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Most items complete
+ /// </summary>
+ public class MessageBox {
+
+ //
+ // -- Public Methods
+ //
+
+ //Compact Framework
+ public static DialogResult Show(string text)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, "", (uint)WB_MessageBox_Types.MB_OK);
+ }
+
+ public static DialogResult Show (IWin32Window w, string text)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, "", (uint)WB_MessageBox_Types.MB_OK);
+ }
+
+ //Compact Framework
+ public static DialogResult Show (string text, string caption)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption, (uint)WB_MessageBox_Types.MB_OK);
+ }
+
+ public static DialogResult Show (IWin32Window w, string text, string caption)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption, (uint)WB_MessageBox_Types.MB_OK);
+ }
+
+ public static DialogResult Show (string text, string caption,
+ MessageBoxButtons mb)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption, (uint) mb);
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text,
+ string caption, MessageBoxButtons mb)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption, (uint) mb);
+ }
+
+ public static DialogResult Show (
+ string text, string caption, MessageBoxButtons mb,
+ MessageBoxIcon mi)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) ((uint)mb | (uint)mi) );
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) ((uint)mb |(uint) mi) );
+ }
+
+ //Compact Framework
+ public static DialogResult Show (
+ string text, string caption, MessageBoxButtons mb,
+ MessageBoxIcon mi, MessageBoxDefaultButton md)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) ((uint)mb | (uint)mi | (uint)md) );
+
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi,
+ MessageBoxDefaultButton md)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) ((uint)mb | (uint)mi | (uint)md) );
+ }
+
+ public static DialogResult
+ Show (string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi,
+ MessageBoxDefaultButton md, MessageBoxOptions mo)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) ((uint)mb | (uint)mi | (uint)md |(uint) mo) );
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi,
+ MessageBoxDefaultButton md, MessageBoxOptions mo)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) ((uint)mb | (uint)mi | (uint)md | (uint)mo) );
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs
new file mode 100644
index 00000000000..17a044edab4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.MessageBoxButtons.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+public enum MessageBoxButtons {
+ AbortRetryIgnore = 2,
+ OK = 0,
+ OKCancel = 1,
+ RetryCancel = 5,
+ YesNo = 4,
+ YesNoCancel = 3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs
new file mode 100644
index 00000000000..618937d0f07
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.MessageBoxDefaultButton.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxDefaultButton {
+ Button1 = 0,
+ Button2 = 256,
+ Button3 = 512
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs
new file mode 100644
index 00000000000..6aff0e89e4a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.MessageBoxIcon.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxIcon {
+ Asterisk = 64,
+ Error = 16,
+ Exclamation = 48,
+ Hand = 16,
+ Information = 64,
+ None = 0,
+ Question = 32,
+ Stop = 16,
+ Warning = 48
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs
new file mode 100644
index 00000000000..8a1e2931b69
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.MessageBoxOptions.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxOptions {
+ DefaultDesktopOnly = 131072,
+ RightAlign = 524288,
+ RtlReading = 1048576,
+ ServiceNotification = 2097152
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs
new file mode 100644
index 00000000000..77f6af27eaf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.MethodInvoker.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that handles the Invoke event for a method.
+ /// </summary>
+ [Serializable]
+ public delegate void MethodInvoker();
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs
new file mode 100644
index 00000000000..e610e70e7f0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs
@@ -0,0 +1,1616 @@
+//
+// System.Windows.Forms.MonthCalendar.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.ComponentModel;
+using System.Runtime.Remoting;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class MonthCalendar : Control {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public MonthCalendar() {
+
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void AddAnnuallyBoldedDate(DateTime date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void AddBoldedDate(DateTime date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void AddMonthlyBoldedDate(DateTime date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAllAnnuallyBoldedDates() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void BringToFront() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CreateControl() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Hide() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Invalidate() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Invalidate(bool b) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Invalidate(Rectangle r) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Invalidate(Region rg) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Invalidate(Rectangle r, bool b) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Invalidate(Region rg, bool b) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void PerformLayout() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void PerformLayout(Control ctl, string s) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAllBoldedDates() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAllMonthlyBoldedDates() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAnnuallyBoldedDate(DateTime Date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveBoldedDate(DateTime Date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveMonthlyBoldedDate(DateTime Date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ResetBindings() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ResetImeMode() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ResumeLayout() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ResumeLayout(bool b) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Scale(float ft) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Scale(float ft, float ft1) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Select() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SendToBack() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SetBounds(int i, int i1, int i2, int i3) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SetCalendarDimensions(int x, int y) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SetDate(DateTime Date) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SetSelectionRange(DateTime Date, DateTime Date1) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Show() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SuspendLayout() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Update() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void UpdateBoldedDates() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IAsyncResult BeginInvoke(Delegate dels) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IAsyncResult BeginInvoke(Delegate dels, object[] objs) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool Contains(Control ctl) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Graphics CreateGraphics() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public DragDropEffects DoDragDrop(object o, DragDropEffects dde) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object EndEnvoke(IAsyncResult asyncResult) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static bool Equals(object o, object o1) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Form FindForm() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool Focus() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Control GetChildAtPoint(Point pt) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IContainerControl GetContainerControl() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public SelectionRange GetDisplayRange(bool b) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual int GetHashCode() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object GetLifetimeService() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Control GetNextControl(Control ctl, bool b) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Type GetType() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public HitTestInfo HitTest(Point pt) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public HitTestInfo HitTest(int i, int i1) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual object InitializeLifetimeService() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Invoke(Delegate d) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Invoke(Delegate d, object[] obj) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Point PointToClient(Point pt) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Point PointToScreen(Point pt) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Rectangle RectangleToClient(Rectangle r) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Rectangle RectangleToScreen(Rectangle r) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool SelectNextControl(Control ctl, bool b, bool b1, bool b2, bool b3) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual ObjRef CreateObjRef(Type reqType) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual bool Equals(object o) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual bool PreProcessMessage(ref Message msg) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Refresh() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void ResetBackColor() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void ResetCursor() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void ResetFont() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void ResetForeColor() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void ResetRightToLeft() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void ResetText() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Select(bool b, bool b1) {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public AccessibleObject AccessibilityObject {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string AccessibleDefaultActionDescription {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string AccessibleDescription {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string AccessibleName {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public AccessibleRole AccessibleRole {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual bool AllowDrop {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual AnchorStyles Anchor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime[] AnnuallyBoldedDates {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual BindingContext BindingContext {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime[] BoldedDates {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Bottom {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Rectangle Bounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size CalendarDimensions {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool CanFocus {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool CanSelect {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Capture {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool CausesValidation {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Rectangle ClientRectangle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size ClientSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string CompanyName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public IContainer Container {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ContainsFocus {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual ContextMenu ContextMenu {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Control.ControlCollection Controls {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Created {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual Cursor Cursor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ControlBindingsCollection DataBindings {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual Rectangle DisplayRectangle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Disposing {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual DockStyle Dock {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Enabled {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Day FirstDayOfWeek {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual bool Focused {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual Font Font {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool HasChildren {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Height {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool InvokeRequired {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsAccessible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsDisposed {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsHandleCreated {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Left {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Point Location {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public DateTime MaxDate {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int MaxSelectionCount {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime MinDate {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime[] MonthlyBoldedDates {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string Name {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Control Parent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string ProductName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string ProductVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool RecreatingHandle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Region Region {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Right {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual RightToLeft RightToLeft {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ScrollChange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime SelectionEnd {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public SelectionRange SelectionRange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime SelectionStart {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowToday {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowTodayCircle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowWeekNumbers {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size SingleMonthSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size Size {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int TabIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool TabStop {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public object Tag {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public Color TitleBackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color TitleForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime TodayDate {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool TodayDateSet {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Top {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Control TopLevelControl {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color TrailingForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Visible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Width {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override void CreateHandle() {
+ //FIXME:
+ base.CreateHandle();
+ }
+ [MonoTODO]
+ protected bool GetStyle(ControlStyles flag) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected bool GetTopLevel() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override bool IsInputKey(Keys KeyData) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected object MemberwiseClone() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected internal virtual bool ProcessKeyMessage(ref Message m) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected ContentAlignment RtlTranslateAlignment(ContentAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected ContentAlignment RtlTranslateContent(ContentAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected HorizontalAlignment RtlTranslateHorizontal(HorizontalAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected LeftRightAlignment RtlTranslateLeftRight(LeftRightAlignment align) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m) {
+ throw new NotImplementedException ();
+ }
+ //protected virtual void Dispose(bool disposed)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ protected virtual void InitLayout() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBackgroundImageChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBindingContextChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnCausesValidationChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnChangeUICues(UICuesEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnClick(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnContextMenuChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnControlAdded(ControlEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnControlRemoved(ControlEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnCreateControl() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnCursorChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDateChanged(DateRangeEventArgs drevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDateSelected(DateRangeEventArgs drevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDockChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDoubleClick(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDragDrop(DragEventArgs drgevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDragEnter(DragEventArgs drgevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDragLeave(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnDragOver(DragEventArgs drgevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnEnabledChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnEnter(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnFontChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnForeColorChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnGiveFeedback(GiveFeedbackEventArgs gfbevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnGotFocus(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnHandleDestroyed(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnHelpRequested(HelpEventArgs hevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnImeModeChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnInvalidated(InvalidateEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnKeyDown(KeyEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnKeyPress(KeyPressEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnKeyUp(KeyEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnLayout(LayoutEventArgs levent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnLeave(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnLocationChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnLostFocus(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseDown(MouseEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseEnter(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseHover(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseLeave(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseMove(MouseEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseUp(MouseEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMouseWheel(MouseEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnMove(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnNotifyMessage(Message m) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnPaint(PaintEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnPaintBackground(PaintEventArgs pevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentBackColorChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentBackgroundImageChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentBindingContextChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentEnabledChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentFontChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentForeColorChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentRightToLeftChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnParentVisibleChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs qcdevent) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnResize(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnRightToLeftChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnSizeChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnStyleChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnSystemColorsChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnTabIndexChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnTabStopChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnTextChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnValidated(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnValidating(CancelEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnVisibleChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void ScaleCore(float dx,float dy) {
+ throw new NotImplementedException ();
+ }
+ // [MonoTODO]
+ // protected virtual void Select(bool b, bool b1)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ [MonoTODO]
+ protected virtual void SetClientSizeCore(int x, int y) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void SetVisibleCore(bool value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void AccessibilityNotifyClients(AccessibleEvents accEvent, int i) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void InvokeGotFocus(Control toInvoke, EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void InvokeLostFocus(Control toInvoke, EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void InvokeOnClick(Control toInvoke, EventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void InvokePaint(Control c, PaintEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void InvokePaintBackground(Control c, PaintEventArgs e) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void RecreateHandle() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void SetStyle(ControlStyles flag, bool value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void SetTopLevel(bool value) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void UpdateBounds() {
+ throw new NotImplementedException ();
+ }
+ // [MonoTODO]
+ // protected void UpdateBounds(int x, int y, int width, int height);
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // [MonoTODO]
+ // protected void UpdateBounds(int x, int y, int width, int height, int clientWidth, intclientHeigth);
+ // {
+ // throw new NotImplementedException ();
+ // }
+ [MonoTODO]
+ protected void UpdateStyles() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected void UpdateZOrder() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual AccessibleObject CreateAccessibilityInstance() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual ControlCollection CreateControlsInstance() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void DefWndProc(ref Message m) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void DestroyHandle() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual object GetService(Type service) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool IsInputChar(char charCode) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool ProcessCmdKey(ref Message msg, Keys keyData) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool ProcessDialogChar(char charCode) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool ProcessDialogKey(Keys keyData) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool ProcessKeyEventArgs(ref Message m) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool ProcessKeyPreview(ref Message m) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual bool ProcessMnemonic(char charCode) {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ //FIXME:
+ return base.CreateParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected bool DesignMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected bool ResizeRedraw {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected EventHandlerList Events {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected bool ShowKeyboardCues {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected int FontHeight {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected virtual bool ShowFocusCues {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Events
+ //
+ public event EventHandler BackColorChanged;
+ public event EventHandler BackgroundImageChanged;
+ public event EventHandler BindingContextChanged;
+ public event EventHandler CausesValidationChanged;
+ public event UICuesEventHandler ChangeUICues;
+ public event EventHandler ContextMenuChanged;
+ public event ControlEventHandler ControlAdded;
+ public event ControlEventHandler ControlRemoved;
+ public event EventHandler CursorChanged;
+ public event DateRangeEventHandler DateChanged;
+ public event DateRangeEventHandler DateSelected;
+ public event EventHandler Disposed;
+ public event EventHandler DockChanged;
+ public event DragEventHandler DragDrop;
+ public event DragEventHandler DragEnter;
+ public event EventHandler DragLeave;
+ public event DragEventHandler DragOver;
+ public event EventHandler EnabledChanged;
+ public event EventHandler Enter;
+ public event EventHandler FontChanged;
+ public event EventHandler ForeColorChanged;
+ public event GiveFeedbackEventHandler GiveFeedback;
+ public event EventHandler GotFocus;
+ public event EventHandler HandleCreated;
+ public event EventHandler HandleDestroyed;
+ public event HelpEventHandler HelpRequested;
+ public event EventHandler ImeModeChanged;
+ public event InvalidateEventHandler Invalidated;
+ public event KeyEventHandler KeyDown;
+ public event KeyPressEventHandler KeyPress;
+ public event KeyEventHandler KeyUp;
+ public event LayoutEventHandler Layout;
+ public event EventHandler Leave;
+ public event EventHandler LocationChanged;
+ public event EventHandler LostFocus;
+ public event MouseEventHandler MouseDown;
+ public event EventHandler MouseEnter;
+ public event EventHandler MouseHover;
+ public event EventHandler MouseLeave;
+ public event MouseEventHandler MouseMove;
+ public event MouseEventHandler MouseUp;
+ public event MouseEventHandler MouseWheel;
+ public event EventHandler Move;
+ public event EventHandler ParentChanged;
+ public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
+ public event QueryContinueDragEventHandler QueryContinueDrag;
+ public event EventHandler Resize;
+ public event EventHandler RightToLeftChanged;
+ public event EventHandler SizeChanged;
+ public event EventHandler StyleChanged;
+ public event EventHandler SystemColorsChanged;
+ public event EventHandler TabIndexChanged;
+ public event EventHandler TabStopChanged;
+ public event EventHandler TextChanged;
+ public event EventHandler Validated;
+ public event CancelEventHandler Validating;
+ public event EventHandler VisibleChanged;
+
+ //
+ // System.Windows.Forms.MonthCalendar.HitTestInfo.cs
+ //
+ // Author:
+ // stubbed out by Paul Osman (paul.osman@sympatico.ca)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ // <summary>
+ // </summary>
+
+ public sealed class HitTestInfo {
+
+ //
+ // --- Public Properties
+ //
+ // [MonoTODO]
+ // public MonthCalendar.HitArea HitArea {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // }
+ [MonoTODO]
+ public Point Point {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public DateTime Time {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseButtons.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseButtons.cs
new file mode 100644
index 00000000000..2928db68a13
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseButtons.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.MouseButtons.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MouseButtons {
+ Left = 1048576,
+ Middle = 4194304,
+ None = 0,
+ Right = 2097152,
+ XButton1 = 8388608,
+ XButton2 = 16777216
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs
new file mode 100644
index 00000000000..d876815b02a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs
@@ -0,0 +1,80 @@
+//
+// System.Windows.Forms.MouseEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class MouseEventArgs : EventArgs {
+
+ #region Fields
+
+ private MouseButtons button;
+ private int clicks;
+ private int x;
+ private int y;
+ private int delta;
+
+ #endregion
+
+ public MouseEventArgs(MouseButtons button, int clicks, int x, int y, int delta)
+ {
+ this.button = button;
+ this.clicks = clicks;
+ this.x = x;
+ this.y = y;
+ this.delta = delta;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public MouseButtons Button
+ {
+ get {
+ return button;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Clicks {
+ get {
+ return clicks;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Delta {
+ get {
+ return delta;
+ }
+ }
+
+ [ComVisible(true)]
+ public int X {
+ get {
+ return x;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Y {
+ get {
+ return y;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs
new file mode 100644
index 00000000000..8e1277cacad
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.MouseEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the MouseDown, MouseUp, or MouseMove
+ /// event of a form, control, or other component.
+ /// </summary>
+ [Serializable]
+ public delegate void MouseEventHandler(object sender, MouseEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs
new file mode 100644
index 00000000000..eb57f7da723
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs
@@ -0,0 +1,202 @@
+//
+// System.Windows.Forms.NativeWindow.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.Remoting;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class NativeWindow : MarshalByRefObject {
+
+ // the window's HWND
+ private IntPtr windowHandle;
+ static private Hashtable windowCollection = new Hashtable ();
+ static bool registeredClass = false;
+ static Win32.WndProc wp;
+ //
+ // --- Constructor
+ //
+ public NativeWindow ()
+ {
+ windowHandle = (IntPtr) 0;
+ wp = null;
+ }
+
+ //
+ // --- Public Properties
+ //
+ public IntPtr Handle
+ {
+ get {
+ return windowHandle;
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ public void AssignHandle (IntPtr handle)
+ {
+ if (windowHandle != (IntPtr) 0)
+ windowCollection.Remove (windowHandle);
+
+ windowHandle = handle;
+ windowCollection.Add (windowHandle, this);
+ OnHandleChange ();
+ }
+
+ public virtual void CreateHandle (CreateParams cp)
+ {
+ IntPtr createdHWnd = (IntPtr) 0;
+ Object lpParam = new Object();
+
+ if (!registeredClass) {
+ WNDCLASS wndClass = new WNDCLASS();
+
+ wndClass.style = (int) (CS_.CS_OWNDC |
+ CS_.CS_VREDRAW |
+ CS_.CS_HREDRAW);
+ wndClass.lpfnWndProc = GetWindowProc();
+ wndClass.cbClsExtra = 0;
+ wndClass.cbWndExtra = 0;
+ wndClass.hInstance = (IntPtr)0;
+ wndClass.hIcon = (IntPtr)0;
+ wndClass.hCursor = (IntPtr)0;
+ wndClass.hbrBackground = (IntPtr)6; // ???
+ wndClass.lpszMenuName = "";
+ wndClass.lpszClassName = "mono_native_window";
+
+ if (Win32.RegisterClass(ref wndClass) != 0) {
+ registeredClass = true;
+ } else {
+ windowHandle = (IntPtr)0;
+ return;
+ }
+ }
+
+ windowHandle = Win32.CreateWindowEx (
+ (uint) cp.ExStyle, cp.ClassName,
+ cp.Caption,(uint) cp.Style,
+ cp.X, cp.Y, cp.Width, cp.Height,
+ (IntPtr) cp.Parent, (IntPtr) 0,
+ (IntPtr) 0, ref lpParam);
+
+ if (windowHandle != (IntPtr) 0)
+ windowCollection.Add (windowHandle, this);
+ //debug
+ //else {
+ // System.Console.WriteLine("Cannot create window {0}", Win32.FormatMessage(Win32.GetLastError()));
+ //}
+ }
+
+ public void DefWndProc (ref Message m)
+ {
+ m.Result = Win32.DefWindowProcA (m.HWnd, m.Msg,
+ m.WParam, m.LParam);
+ }
+
+ public virtual void DestroyHandle ()
+ {
+ windowCollection.Remove (windowHandle);
+ Win32.DestroyWindow (windowHandle);
+ }
+
+ public static NativeWindow FromHandle (IntPtr handle)
+ {
+ NativeWindow window = new NativeWindow ();
+ window.AssignHandle (handle);
+ return window;
+ }
+
+ public virtual void ReleaseHandle ()
+ {
+ windowHandle = (IntPtr) 0;
+ OnHandleChange ();
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+
+ [MonoTODO]
+ protected virtual void OnHandleChange ()
+ {
+ // to be overridden
+ }
+
+ [MonoTODO]
+ protected virtual void OnThreadException (Exception e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void WndProc (ref Message m)
+ {
+ if (m.Msg == Msg.WM_CREATE)
+ Console.WriteLine ("NW WndProc WM_CREATE");
+ DefWndProc (ref m);
+ }
+
+ //
+ // --- Destructor
+ //
+ [MonoTODO]
+ ~NativeWindow ()
+ {
+ }
+
+ static private IntPtr WndProc (
+ IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam)
+ {
+ // windowCollection is a collection of all the
+ // NativeWindow(s) that have been created.
+ // Dispatch the current message to the approriate
+ // window.
+ NativeWindow window =
+ (NativeWindow) windowCollection[hWnd];
+ Message message = new Message ();
+ message.HWnd = hWnd;
+ message.Msg = msg;
+ message.WParam = wParam;
+ message.LParam = lParam;
+ message.Result = (IntPtr) 0;
+
+ if (msg == Msg.WM_CREATE)
+ Console.WriteLine ("WM_CREATE (static)");
+
+ if (window != null) {
+ if (msg == Msg.WM_CREATE)
+ Console.WriteLine ("WM_CREATE (static != null)");
+ window.WndProc(ref message);
+ } else {
+ Console.WriteLine ("no window, defwndproc");
+ // even though we are not managing the
+ // window let the window get the message
+ message.Result = Win32.DefWindowProcA (
+ hWnd, msg, wParam, lParam);
+ }
+
+ return message.Result;
+ }
+ internal static Win32.WndProc GetWindowProc() {
+ if( wp == null){
+ wp = new Win32.WndProc (WndProc);
+ }
+ return wp;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs
new file mode 100644
index 00000000000..29985bc9109
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs
@@ -0,0 +1,48 @@
+//
+// System.Windows.Forms.NavigateEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class NavigateEventArgs : EventArgs {
+
+ #region Fields
+
+ private bool isforward;
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+
+ public NavigateEventArgs(bool isForward)
+ {
+ isforward = isForward;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public bool Forward
+ {
+ get {
+ return isforward;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs
new file mode 100644
index 00000000000..a74a75e366f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.NavigateEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the NavigateEventArgs event of a DataGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void NavigateEventHandler(object sender, NavigateEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs
new file mode 100644
index 00000000000..ed380d64c84
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs
@@ -0,0 +1,69 @@
+//
+// System.Windows.Forms.NodeLabelEditEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class NodeLabelEditEventArgs : EventArgs {
+
+ #region Fields
+
+ private TreeNode node;
+ private string label = "";
+ private bool canceledit = false;
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+
+ public NodeLabelEditEventArgs(TreeNode node)
+ {
+ this.node = node;
+ }
+
+ public NodeLabelEditEventArgs(TreeNode node, string label)
+ {
+ this.node = node;
+ this.label = label;
+ }
+
+ #region Public Properties
+
+ public bool CancelEdit {
+ get {
+ return canceledit;
+ }
+ set {
+ canceledit = value;
+ }
+ }
+
+ public string Label
+ {
+ get {
+ return label;
+ }
+ }
+
+ public TreeNode Node {
+ get {
+ return node;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs
new file mode 100644
index 00000000000..f241ff9aa29
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.NodeLabelEditEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the BeforeLabelEdit
+ /// and AfterLabelEdit events of a TreeView control.
+ /// </summary>
+ [Serializable]
+ public delegate void NodeLabelEditEventHandler(object sender, NodeLabelEditEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NotifyIcon.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
new file mode 100644
index 00000000000..097fec73900
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
@@ -0,0 +1,96 @@
+//
+// System.Windows.Forms.NotifyIcon.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.Remoting;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+ public sealed class NotifyIcon : Component {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public NotifyIcon()
+ {
+
+ }
+
+ [MonoTODO]
+ public NotifyIcon(IContainer container) {
+
+ }
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public ContextMenu ContextMenu {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Icon Icon {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ internal string text; //FIXME: just to get it to run
+ [MonoTODO]
+ public string Text {
+ get {
+ return text;
+ }
+ set {
+ text = value;
+ }
+ }
+
+ internal bool visible;//FIXME: just to get it to run
+ [MonoTODO]
+ public bool Visible {
+ get {
+ return visible;
+ }
+ set {
+ visible = value;
+ }
+ }
+
+ //
+ // --- Public Events
+ //
+ public event EventHandler Click;
+ public event EventHandler DoubleClick;
+ public event MouseEventHandler MouseDown;
+ public event MouseEventHandler MouseMove;
+ public event MouseEventHandler MouseUp;
+ //
+ // --- Protected Methods
+ //
+ protected override void Dispose(bool disposing) {
+ base.Dispose (disposing);
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NumericUpDown.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NumericUpDown.cs
new file mode 100644
index 00000000000..d5f81ea037e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NumericUpDown.cs
@@ -0,0 +1,181 @@
+//
+// System.Windows.Forms.NumericUpDown.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class NumericUpDown : UpDownBase, ISupportInitialize {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public NumericUpDown()
+ {
+
+ }
+
+ public override void DownButton(){
+ //FIXME:
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public int DecimalPlaces {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool Hexadecimal {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public decimal Maximum {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public decimal Minimum {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ //FIXME: just to get it to run
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ [MonoTODO]
+ public bool ThousandsSeparator {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public decimal Value {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ [MonoTODO]
+ public override void UpButton()
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Events
+ //
+
+ public event EventHandler ValueChanged;
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ //FIXME:
+ return base.CreateAccessibilityInstance();
+ }
+
+ [MonoTODO]
+ protected override void OnTextBoxKeyPress(object source, KeyPressEventArgs e)
+ {
+ //FIXME:
+ base.OnTextBoxKeyPress(source, e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnValueChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected void ParseEditText()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void UpdateEditText()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void ValidateEditText()
+ {
+ //FIXME:
+ base.ValidateEditText();
+ }
+
+ void ISupportInitialize.BeginInit(){
+ //FIXME:
+ }
+
+ void ISupportInitialize.EndInit(){
+ //FIXME:
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/OSFeature.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/OSFeature.cs
new file mode 100644
index 00000000000..a332e90355c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/OSFeature.cs
@@ -0,0 +1,54 @@
+//
+// System.Windows.Forms.OSFeature.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class OSFeature : FeatureSupport {
+
+ //
+ // --- Public Fields
+ //
+ public static readonly object LayeredWindows;
+ public static readonly object Themes;
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public static OSFeature Feature {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override Version GetVersionPresent(object feature)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual bool IsPresent(object o)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual bool IsPresent(object o, Version v)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/OpacityConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/OpacityConverter.cs
new file mode 100644
index 00000000000..68216877de0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/OpacityConverter.cs
@@ -0,0 +1,47 @@
+//
+// System.Windows.Forms.OpacityConverter.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class OpacityConverter : TypeConverter {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public OpacityConverter()
+ {
+
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ public bool CanConvertFrom(Type sourceType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object ConvertFrom(object context)
+ {
+ throw new NotImplementedException ();
+ }
+ public object ConvertTo(object context, Type destinationType)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
new file mode 100644
index 00000000000..462ce3a8905
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
@@ -0,0 +1,84 @@
+//
+// System.Windows.Forms.OpenFileDialog.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.IO;
+using System.Runtime.Remoting;
+using System;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public sealed class OpenFileDialog : FileDialog {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public OpenFileDialog() {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool Multiselect {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ReadOnlyChecked {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override bool CheckFileExists {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public Stream OpenFile() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override void Reset() {
+ //FIXME:
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Orientation.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Orientation.cs
new file mode 100644
index 00000000000..192bdafd6df
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Orientation.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.Orientation.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum Orientation {
+ Horizontal = 0,
+ Vertical = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs
new file mode 100644
index 00000000000..9fc782e3d6e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs
@@ -0,0 +1,145 @@
+//
+// System.Windows.Forms.PageSetupDialog.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing.Printing;
+using System.Runtime.Remoting;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public sealed class PageSetupDialog : CommonDialog {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public PageSetupDialog()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool AllowMargins {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowOrientation {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowPaper {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowPrinter {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowHelp {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowNetwork {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public PrintDocument Document {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Margins MinMargins {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public PageSettings PageSettings {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public PrinterSettings PrinterSettings {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override void Reset()
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected override bool RunDialog(IntPtr hwndOwner)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs
new file mode 100644
index 00000000000..05aa885cf2e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs
@@ -0,0 +1,66 @@
+//
+// System.Windows.Forms.PaintEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class PaintEventArgs : EventArgs, IDisposable {
+
+ #region Fields
+
+ private Graphics mgraphics;
+ private Rectangle mclipRect;
+
+ #endregion
+
+ public PaintEventArgs(Graphics graphics, Rectangle clipRect )
+ {
+ this.mgraphics = graphics;
+ this.mclipRect = clipRect;
+ }
+
+ #region Public Properties
+ public Rectangle ClipRectangle
+ {
+ get {
+ return mclipRect;
+ }
+ }
+
+ public Graphics Graphics {
+ get {
+ return mgraphics;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ public void Dispose()
+ {
+ //
+ }
+
+ #endregion
+
+ #region Protected Methods
+
+ protected virtual void Dispose(bool disposing)
+ {
+ //
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs
new file mode 100644
index 00000000000..029769efdc9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.PaintEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the Paint event of a Control class.
+ /// </summary>
+ [Serializable]
+ public delegate void PaintEventHandler(object sender, PaintEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Panel.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Panel.cs
new file mode 100644
index 00000000000..1c1e39a2346
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Panel.cs
@@ -0,0 +1,102 @@
+//
+// System.Windows.Forms.Panel.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.Runtime.Remoting;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class Panel : ScrollableControl {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public Panel() {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ //FIXME:
+ return base.Site;
+ }
+ set {
+ //FIXME:
+ base.Site = value;
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "PANEL";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new Size(219,109);
+ }
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e) {
+ //FIXME:
+ base.OnResize(e);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs
new file mode 100644
index 00000000000..e63a3985131
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs
@@ -0,0 +1,157 @@
+//
+// System.Windows.Forms.PicureBox
+//
+// Author:
+// stubbed out by Hossein Safavi (hsafavi@purdue.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ //<summary>
+ //</summary>
+ using System.Drawing;
+ using System.ComponentModel;
+ public class PictureBox : Control {
+
+ Image image;
+ PictureBoxSizeMode sizeMode;
+ //
+ // --- Public Constructor
+ //
+ [MonoTODO]
+ public PictureBox ()
+ {
+ image = null;
+ sizeMode = PictureBoxSizeMode.Normal;
+ }
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public Image Image {
+ get {
+ return image;
+ }
+ set {
+ image = value;
+ }
+ }
+
+ [MonoTODO]
+ public new ImeMode ImeMode {
+ get {
+ return base.ImeMode;
+ }
+ set {
+ base.ImeMode = value;
+ }
+ }
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "PICTUREBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ return base.DefaultImeMode;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new Size(100,50);
+ }
+ }
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ [MonoTODO]
+ public PictureBoxSizeMode SizeMode () {
+ return sizeMode;
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected override void OnEnabledChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnEnabledChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaint(e);
+ }
+ [MonoTODO]
+ protected override void OnParentChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnParentChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ //FIXME:
+ OnResize(e);
+ }
+ [MonoTODO]
+ protected virtual void OnSizeModeChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnVisibleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x,int y,int width,int height,BoundsSpecified specified)
+ {
+ //FIXME:
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+ //
+ // --- Public Events
+ //
+
+ [MonoTODO]
+ public event EventHandler SizeModeChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs
new file mode 100644
index 00000000000..4365d80b4fc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.PictureBoxSizeMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum PictureBoxSizeMode {
+ AutoSize = 2,
+ CenterImage = 3,
+ Normal = 0,
+ StretchImage = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs
new file mode 100644
index 00000000000..b602bbe399c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs
@@ -0,0 +1,62 @@
+//
+// System.Windows.Forms.PrintControllerWithStatusDialog
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing.Printing;
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class PrintControllerWithStatusDialog : PrintController {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public PrintControllerWithStatusDialog(PrintController underlyingController)
+ {
+
+ }
+ [MonoTODO]
+ public PrintControllerWithStatusDialog(PrintController underlyingController, string dialogTitle)
+ {
+
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override void OnEndPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ //FIXME:
+ base.OnEndPage(document, e);
+ }
+ [MonoTODO]
+ public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
+ {
+ //FIXME:
+ base.OnEndPrint(document, e);
+ }
+ [MonoTODO]
+ public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
+ {
+ //FIXME:
+ return base.OnStartPage(document, e);
+ }
+ [MonoTODO]
+ public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
+ {
+ //FIXME:
+ base.OnStartPrint(document, e);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintDialog.cs
new file mode 100644
index 00000000000..4c608902317
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintDialog.cs
@@ -0,0 +1,127 @@
+//
+// System.Windows.Forms.PrintDialog
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing.Printing;
+using System.Runtime.Remoting;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public sealed class PrintDialog : CommonDialog {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public PrintDialog()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool AllowPrintToFile {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowSelection {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AllowSomePages {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public PrintDocument Document {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public PrinterSettings PrinterSettings {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool PrintToFile {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowHelp {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowNetwork {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override void Reset()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected override bool RunDialog(IntPtr hwndOwner)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
new file mode 100644
index 00000000000..487e9f3f990
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
@@ -0,0 +1,173 @@
+//
+// System.Windows.Forms.PrintPreviewControl
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.Drawing.Printing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// The raw "preview" part of print previewing, without any dialogs or buttons. Most PrintPreviewControl objects are found on PrintPreviewDialog objects, but they do not have to be.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public class PrintPreviewControl : Control {
+
+ #region Fields
+ bool autoZoom;
+ int columns;
+ PrintDocument document;
+ int rows;
+ int startPage;
+ bool useAntiAlias;
+ double zoom;
+ #endregion
+
+ #region Constructors
+ [MonoTODO]
+ public PrintPreviewControl()
+ {
+ autoZoom=true;
+ columns=1;
+ document=null;
+ rows=0;
+ startPage=0;
+ zoom=1.0;
+ }
+ #endregion
+
+ #region Properties
+ public bool AutoZoom {
+ get { return autoZoom; }
+ set { autoZoom=value; }
+ }
+
+ public int Columns {
+ get { return columns; }
+ set { columns=value; }
+ }
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "PRINTPREVIEWCONTROL";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ public PrintDocument Document {
+ get { return document; }
+ set { document=value; }
+ }
+
+ public int Rows {
+ get { return rows; }
+ set { rows=value; }
+ }
+
+ public int StartPage {
+ get { return startPage; }
+ set { startPage=value; }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ public bool UseAntiAlias {
+ get { return useAntiAlias; }
+ set { useAntiAlias=value; }
+ }
+
+ public double Zoom {
+ get { return zoom; }
+ set { zoom=value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public void InvalidatePreview()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ //FIXME:
+ base.OnPaint(e);
+ }
+
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ //FIXME:
+ base.OnResize(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnStartPageChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void ResetBackColor()
+ {
+ //FIXME:
+ base.ResetBackColor();
+ }
+
+ [MonoTODO]
+ public override void ResetForeColor()
+ {
+ //FIXME:
+ base.ResetForeColor();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ #endregion
+
+ #region Events
+ [MonoTODO]
+ public event EventHandler StartPageChanged;
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
new file mode 100644
index 00000000000..935a7d1ce7a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
@@ -0,0 +1,372 @@
+//
+// System.Windows.Forms.PrintPreviewDialog
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.Drawing.Printing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a dialog box form that contains a PrintPreviewControl.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public class PrintPreviewDialog : Form {
+
+ #region Fields
+ IButtonControl acceptButton;
+ string accessibleDescription;
+ string accessibleName;
+ AccessibleRole accessibleRole;
+ bool autoScale;
+ Size autoScrollMargin;
+ Size autoScrollMinSize;
+ bool causesValidation;
+ bool controlBox;
+ ControlBindingsCollection dataBindings;
+ PrintDocument document;
+ bool enabled;
+ FormBorderStyle formBorderStyle;
+ bool helpButton;
+ Icon icon;
+ ImeMode imeMode;
+ bool isMdiContainer;
+ bool keyPreview;
+ Point location;
+ bool maximizeBox;
+ Size maximumSize;
+ MainMenu menu;
+ bool minimizeBox;
+ Size minimumSize;
+ PrintPreviewControl printPreviewControl;
+ bool showInTaskbar;
+ Size size;
+ FormStartPosition startPosition;
+ bool tabStop;
+ object tag;
+ bool topMost;
+ Color transparencyKey;
+ bool useAntiAlias;
+ bool visible;
+ FormWindowState windowState;
+ #endregion
+
+ #region Constructor
+ [MonoTODO]
+ public PrintPreviewDialog()
+ {
+ document=null;
+
+ accessibleDescription=null;
+ accessibleName=null;
+ accessibleRole=AccessibleRole.Default;
+ autoScale=true;
+ controlBox=true;
+ enabled=true;
+ helpButton=false;
+ imeMode=ImeMode.Inherit;
+ isMdiContainer=false;
+ keyPreview=false;
+ maximizeBox=true;
+ minimizeBox=true;
+ showInTaskbar=true;
+ tabStop=true;
+ tag=null;
+ topMost=false;
+ visible=true;
+ windowState=FormWindowState.Normal;
+
+ }
+ #endregion
+
+ #region Properties
+ public new IButtonControl AcceptButton {
+ get { return acceptButton; }
+ set { acceptButton=value; }
+ }
+
+ public new string AccessibleDescription {
+ get { return accessibleDescription; }
+ set { accessibleDescription=value; }
+ }
+
+ public new string AccessibleName {
+ get { return accessibleName; }
+ set { accessibleName=value; }
+ }
+
+ public new AccessibleRole AccessibleRole {
+ get { return accessibleRole; }
+ set { accessibleRole=value; }
+ }
+
+ [MonoTODO]
+ public override bool AllowDrop {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override AnchorStyles Anchor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new bool AutoScale {
+ get { return autoScale; }
+ set { autoScale=value; }
+ }
+
+ [MonoTODO]
+ public override Size AutoScaleBaseSize {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override bool AutoScroll {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new Size AutoScrollMargin {
+ get { return autoScrollMargin; }
+ set { autoScrollMargin=value; }
+ }
+
+ public new Size AutoScrollMinSize {
+ get { return autoScrollMinSize; }
+ set { autoScrollMinSize=value; }
+ }
+
+ [MonoTODO]
+ public override Color BackColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new IButtonControl CancelButton {get; set;}
+
+ public new bool CausesValidation {
+ get { return causesValidation; }
+ set { causesValidation=value; }
+ }
+
+ [MonoTODO]
+ public override ContextMenu ContextMenu {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new bool ControlBox {
+ get { return controlBox; }
+ set { controlBox=value; }
+ }
+
+ [MonoTODO]
+ public override Cursor Cursor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new ControlBindingsCollection DataBindings {
+ get { return dataBindings; }
+ set { dataBindings=value; }
+ }
+
+ [MonoTODO]
+ public override DockStyle Dock {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new ScrollableControl.DockPaddingEdges DockPadding {get;}
+
+ public PrintDocument Document {
+ get { return document; }
+ set { document=value; }
+ }
+
+ public new bool Enabled {
+ get { return enabled; }
+ set { enabled=value; }
+ }
+
+ [MonoTODO]
+ public override Font Font {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new FormBorderStyle FormBorderStyle {
+ get { return formBorderStyle; }
+ set { formBorderStyle=value; }
+ }
+
+ public new bool HelpButton {
+ get { return helpButton; }
+ set { helpButton=value; }
+ }
+
+ public new Icon Icon {
+ get { return icon; }
+ set { icon=value; }
+ }
+
+ public new ImeMode ImeMode {
+ get { return imeMode; }
+ set { imeMode=value; }
+ }
+
+ public bool IsMdiContainer {
+ get { return isMdiContainer; }
+ set { isMdiContainer=value; }
+ }
+
+ public new bool KeyPreview {
+ get { return keyPreview; }
+ set { keyPreview=value; }
+ }
+
+ public new Point Location {
+ get { return location; }
+ set { location=value; }
+ }
+
+ public new bool MaximizeBox {
+ get { return maximizeBox; }
+ set { maximizeBox=value; }
+ }
+
+ public new Size MaximumSize {
+ get { return maximumSize; }
+ set { maximumSize=value; }
+ }
+
+ public new MainMenu Menu {
+ get { return menu; }
+ set { menu=value; }
+ }
+
+ public new bool MinimizeBox {
+ get { return minimizeBox; }
+ set { minimizeBox=value; }
+ }
+
+ public new Size MinimumSize {
+ get { return minimumSize; }
+ set { minimumSize=value; }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new double Opacity {get; set;}
+
+ public PrintPreviewControl PrintPreviewControl {
+ get { return printPreviewControl; }
+ set { printPreviewControl=value; }
+ }
+
+ [MonoTODO]
+ public override RightToLeft RightToLeft {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new bool ShowInTaskbar {
+ get { return showInTaskbar; }
+ set { showInTaskbar=value; }
+ }
+
+ public new Size Size {
+ get { return size; }
+ set { size=value; }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new SizeGripStyle SizeGripStyle {get; set;}
+
+ public new FormStartPosition StartPosition {
+ get { return startPosition; }
+ set { startPosition=value; }
+ }
+
+ public new bool TabStop {
+ get { return tabStop; }
+ set { tabStop=value; }
+ }
+
+ public new object Tag {
+ get { return tag; }
+ set { tag=value; }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public new bool TopMost {
+ get { return topMost; }
+ set { topMost=value; }
+ }
+
+ public new Color TransparencyKey {
+ get { return transparencyKey; }
+ set { transparencyKey=value; }
+ }
+
+ public bool UseAntiAlias {
+ get { return useAntiAlias; }
+ set { useAntiAlias=value; }
+ }
+
+ public new bool Visible {
+ get { return visible; }
+ set { visible=value; }
+ }
+
+ public new FormWindowState WindowState {
+ get { return windowState; }
+ set { windowState=value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ProgressBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ProgressBar.cs
new file mode 100644
index 00000000000..a7c3f63ffdf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ProgressBar.cs
@@ -0,0 +1,240 @@
+//
+// System.Windows.Forms.ProgressBar
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+using System.Drawing.Printing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows progress bar control.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class ProgressBar : Control {
+
+ #region Fields
+ int maximum;
+ int minimum;
+ int step;
+ int value;
+ #endregion
+
+ #region Constructor
+ [MonoTODO]
+ public ProgressBar()
+ {
+ maximum=100;
+ minimum=0;
+ step=10;
+ value=0;
+ }
+ #endregion
+
+ #region Properties
+ [MonoTODO]
+ public override bool AllowDrop {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new bool CausesValidation {get; set;}
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "PROGRESSBAR";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Font Font {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new ImeMode ImeMode {get; set;}
+
+ public int Maximum {
+ get {
+ return maximum;
+ }
+ set {
+ maximum=value;
+ }
+ }
+
+ public int Minimum {
+ get {
+ return minimum;
+ }
+ set {
+ minimum=value;
+ }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new bool TabStop {get; set;}
+ [MonoTODO]
+ public override RightToLeft RightToLeft {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int Step {
+ get {
+ return step;
+ }
+ set {
+ step=value;
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ public int Value {
+ get {
+ return value;
+ }
+ set {
+ value=value;
+ }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ protected override void CreateHandle() {
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ public void Increment(int value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void PerformStep()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ #region Events
+ /*
+ * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code:
+ public new event EventHandler DoubleClick;
+ public new event EventHandler Enter;
+ public new event KeyEventHandler KeyDown;
+ public new event KeyPressEventHandler KeyPress;
+ public new event KeyEventHandler KeyUp;
+ public new event EventHandler Leave;
+ public new event PaintEventHandler Paint;
+ */
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
new file mode 100644
index 00000000000..b70d3021739
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
@@ -0,0 +1,462 @@
+//
+// System.Windows.Forms.PropertyGrid
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+//using System.Drawing.Printing;
+using System.ComponentModel;
+using System.Collections;
+//using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides a user interface for browsing the properties of an object.
+
+ /// </summary>
+
+ [MonoTODO]
+ public class PropertyGrid : ContainerControl {
+
+ #region Fields
+ AttributeCollection browsableAttributes;
+ Color commandsBackColor;
+ Color commandsForeColor;
+ bool commandsVisibleIfAvailable;
+ Color helpBackColor;
+ Color helpForeColor;
+ bool helpVisible;
+ bool largeButtons;
+ Color lineColor;
+ PropertySort propertySort;
+ bool toolbarVisible;
+ Color viewBackColor;
+ Color viewForeColor;
+ #endregion
+
+ #region Constructors
+ [MonoTODO]
+ public PropertyGrid()
+ {
+ browsableAttributes = new AttributeCollection(
+ new Attribute[] {BrowsableAttribute.Yes} //Attribute[] attributes
+ );
+ commandsBackColor=SystemColors.Control;
+ commandsForeColor=SystemColors.ControlText;
+ commandsVisibleIfAvailable=false;
+ helpBackColor=SystemColors.Control;
+ helpForeColor=SystemColors.ControlText;
+ helpVisible=true;
+ largeButtons=false;
+ lineColor=SystemColors.ScrollBar;
+ propertySort=PropertySort.Categorized;// OR PropertySort.Alphabetical;
+ toolbarVisible=true;
+ viewBackColor=SystemColors.Window;
+ viewForeColor=SystemColors.WindowText;
+ }
+ #endregion
+
+ #region Properties
+ [MonoTODO]
+ public override bool AutoScroll {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Color BackColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public AttributeCollection BrowsableAttributes {
+ get { return browsableAttributes; }
+ set {
+ if (value==null || value==AttributeCollection.Empty) {
+ browsableAttributes=new AttributeCollection(
+ new Attribute[] {BrowsableAttribute.Yes} //Attribute[] attributes
+ );
+ }
+ else {
+ browsableAttributes=value;
+ }
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool CanShowCommands {
+ get { throw new NotImplementedException (); }
+ }
+
+ public Color CommandsBackColor {
+ get { return commandsBackColor; }
+ set { commandsBackColor=value; }
+ }
+
+ public Color CommandsForeColor {
+ get { return commandsForeColor; }
+ set { commandsForeColor=value; }
+ }
+
+ [MonoTODO]
+ public virtual bool CommandsVisible {
+ get { throw new NotImplementedException (); }
+ }
+
+ public virtual bool CommandsVisibleIfAvailable {
+ get { return commandsVisibleIfAvailable; }
+ set { commandsVisibleIfAvailable=value; }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// public new Control.ControlCollection Controls {get;}
+
+ [MonoTODO]
+ public Point ContextMenuDefaultLocation {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ protected virtual Type DefaultTabType {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// protected bool DrawFlatToolbar {get; set;}
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public Color HelpBackColor {
+ get { return helpBackColor; }
+ set { helpBackColor=value; }
+ }
+
+ public Color HelpForeColor {
+ get { return helpForeColor; }
+ set { helpForeColor=value; }
+ }
+
+ public virtual bool HelpVisible {
+ get { return helpVisible; }
+ set { helpVisible=value; }
+ }
+
+ public bool LargeButtons {
+ get { return largeButtons; }
+ set { largeButtons=value; }
+ }
+
+ public Color LineColor {
+ get { return lineColor; }
+ set { lineColor=value; }
+ }
+
+ public PropertySort PropertySort {
+ get { return propertySort; }
+ set { propertySort=value; }
+ }
+
+ [MonoTODO]
+ public PropertyGrid.PropertyTabCollection PropertyTabs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public GridItem SelectedGridItem {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object SelectedObject {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object[] SelectedObjects {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+// [MonoTODO]
+// public PropertyTab SelectedTab {
+// get { throw new NotImplementedException (); }
+// }
+
+ [MonoTODO]
+ protected override bool ShowFocusCues {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override ISite Site {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public virtual bool ToolbarVisible {
+ get { return toolbarVisible; }
+ set { toolbarVisible=value; }
+ }
+
+ public Color ViewBackColor {
+ get { return viewBackColor; }
+ set { viewBackColor=value; }
+ }
+
+ public Color ViewForeColor {
+ get { return viewForeColor; }
+ set { viewForeColor=value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public void CollapseAllGridItems()
+ {
+ throw new NotImplementedException ();
+ }
+
+// [MonoTODO]
+// protected virtual PropertyTab CreatePropertyTab(Type tabType) {
+// throw new NotImplementedException ();
+// }
+
+ //inherited
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public void ExpandAllGridItems()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnGotFocus(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnMouseDown(MouseEventArgs me)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnMouseMove(MouseEventArgs me)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs me)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnPaint(PaintEventArgs pevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnPropertyTabChanged(PropertyTabChangedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnPropertyValueChanged(PropertyValueChangedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectedGridItemChanged(SelectedGridItemChangedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectedObjectsChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnSystemColorsChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnVisibleChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void Refresh()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshTabs(PropertyTabScope tabScope)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResetSelectedProperty()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void ScaleCore(float dx,float dy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ #region Events
+ public event EventHandler PropertySortChanged;
+ public event PropertyTabChangedEventHandler PropertyTabChanged;
+ public event PropertyValueChangedEventHandler PropertyValueChanged;
+ public event SelectedGridItemChangedEventHandler SelectedGridItemChanged;
+ public event EventHandler SelectedObjectsChanged;
+ #endregion
+
+ /// sub-class: PropertyGrid.PropertyTabCollection
+ /// <summary>
+ /// Contains a collection of PropertyTab objects.
+ /// </summary>
+ public class PropertyTabCollection : ICollection, IEnumerable {
+ #region Properties
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ }
+
+// [MonoTODO]
+// public PropertyTab this[int index] {
+// get { throw new NotImplementedException (); }
+// }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public void AddTabType(Type propertyTabType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddTabType(Type propertyTabType,PropertyTabScope tabScope)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear(PropertyTabScope tabScope)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ICollection.CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveTabType(Type propertyTabType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object SyncRoot {
+ // FIXME: should return object that can be used with the C# lock keyword
+ get { return this; }
+ }
+
+ [MonoTODO]
+ public bool IsSynchronized {
+ // FIXME: should return true if object is synchronized
+ get { return false; }
+ }
+ #endregion
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyManager.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyManager.cs
new file mode 100644
index 00000000000..632ee69b76d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyManager.cs
@@ -0,0 +1,127 @@
+//
+// System.Windows.Forms.PropertyManager
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+//using System.Drawing;
+//using System.Drawing.Printing;
+using System.ComponentModel;
+using System.Collections;
+//using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Maintains a Binding between an object's property and a data-bound control property.
+ /// </summary>
+
+ [MonoTODO]
+ public class PropertyManager : BindingManagerBase {
+
+ /*
+ #region Fields
+ #endregion
+ */
+
+ #region Constructor
+ [MonoTODO]
+ public PropertyManager()
+ {
+
+ }
+ #endregion
+
+ #region Properties
+ [MonoTODO]
+ public override int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override object Current {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override int Position {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public override void AddNew()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void CancelCurrentEdit()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void EndCurrentEdit()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override PropertyDescriptorCollection GetItemProperties()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override string GetListName(ArrayList listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override void OnCurrentChanged(EventArgs ea)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void ResumeBinding()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ public override void SuspendBinding()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void UpdateIsBinding()
+ {
+ //FIXME:
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertySort.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertySort.cs
new file mode 100644
index 00000000000..0d7c2ccae93
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertySort.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.PropertySort.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum PropertySort {
+ Alphabetical = 1,
+ Categorized = 2,
+ CategorizedAlphabetical = 3,
+ NoSort = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs
new file mode 100644
index 00000000000..8f362f02dca
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs
@@ -0,0 +1,58 @@
+//
+// System.Windows.Forms.PropertyTabChangedEventArgs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Runtime.InteropServices;
+using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the PropertyTabChanged event of a PropertyGrid.
+ ///
+ /// </summary>
+
+ [ComVisible(true)]
+ public class PropertyTabChangedEventArgs : EventArgs {
+
+ #region Fields
+
+ private PropertyTab oldtab;
+ private PropertyTab newtab;
+
+ #endregion
+
+ #region Constructor
+ public PropertyTabChangedEventArgs(PropertyTab oldTab, PropertyTab newTab){
+
+ this.oldtab = oldTab;
+ this.newtab = newTab;
+
+ }
+ #endregion
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public PropertyTab NewTab {
+ get {
+ return newtab;
+ }
+ }
+
+ [ComVisible(true)]
+ public PropertyTab OldTab {
+ get {
+ return oldtab;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs
new file mode 100644
index 00000000000..e1e37613bef
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.PropertyTabChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the PropertyTabChanged event of a PropertyGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void PropertyTabChangedEventHandler(object s, PropertyTabChangedEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs
new file mode 100644
index 00000000000..fda6ca1b71f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// System.Windows.Forms.PropertyValueChangedEventArgs
+//
+// Author:
+// stubbed out by Dennis Hayes(dennish@raytek.com)
+// completed by Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Summary description for PropertyValueChangedEventArgs.
+ /// </summary>
+ public class PropertyValueChangedEventArgs : EventArgs {
+
+ #region Fields
+ private GridItem changedItem;
+ private object oldValue;
+ #endregion
+
+ public PropertyValueChangedEventArgs(GridItem changedItem, object oldValue)
+ {
+ this.changedItem = changedItem;
+ this.oldValue = oldValue;
+ }
+
+ #region Public Properties
+
+ // ChangedItem Property
+ public GridItem ChangedItem
+ {
+ get
+ {
+ return changedItem;
+ }
+ }
+
+ // OldValue Property
+ public object OldValue
+ {
+ get
+ {
+ return oldValue;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs
new file mode 100644
index 00000000000..73b05787502
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.PropertyValueChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// The event handler class that is invoked when
+ /// a property in the grid is modified by the user.
+ /// </summary>
+ [Serializable]
+ public delegate void PropertyValueChangedEventHandler(object s, PropertyValueChangedEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs
new file mode 100644
index 00000000000..a225eb332f9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs
@@ -0,0 +1,80 @@
+//
+// System.Windows.Forms.QueryAccessibilityHelpEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class QueryAccessibilityHelpEventArgs : EventArgs {
+
+ #region Fields
+
+ string helpnamespace;
+ string helpstring;
+ string helpkeyword;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+
+ public QueryAccessibilityHelpEventArgs()
+ {
+ this.helpkeyword = "";
+ this.helpnamespace = "";
+ this.helpstring = "";
+ }
+
+ public QueryAccessibilityHelpEventArgs(string helpNamespace, string helpString, string helpKeyword) {
+ this.helpkeyword = helpKeyword;
+ this.helpnamespace = helpNamespace;
+ this.helpstring =helpString;
+ }
+
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public string HelpKeyword {
+ get {
+ return helpkeyword;
+ }
+ set {
+ helpkeyword = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public string HelpNamespace {
+ get {
+ return helpnamespace;
+ }
+ set {
+ helpnamespace = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public string HelpString {
+ get {
+ return helpstring;
+ }
+ set {
+ helpstring = value;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
new file mode 100644
index 00000000000..b4435c9e15c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.QueryAccessibilityHelpEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the QueryAccessibilityHelp event of a control.
+ /// </summary>
+ [Serializable]
+ public delegate void QueryAccessibilityHelpEventHandler(object sender, QueryAccessibilityHelpEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs
new file mode 100644
index 00000000000..c02aa1e4437
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs
@@ -0,0 +1,66 @@
+//
+// System.Windows.Forms.QueryContinueDragEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class QueryContinueDragEventArgs : EventArgs {
+
+ #region Fields
+
+ private int keystate;
+ private bool escapepressed;
+ private DragAction action;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public QueryContinueDragEventArgs(int keyState, bool escapePressed, DragAction action)
+ {
+ this.keystate = keyState;
+ this.escapepressed = escapePressed;
+ this.action = action;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public DragAction Action {
+ get {
+ return action;
+ }
+ set {
+ action = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public bool EscapePressed {
+ get {
+ return escapepressed;
+ }
+ }
+
+ [ComVisible(true)]
+ public int KeyState {
+ get {
+ return keystate;
+ }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs
new file mode 100644
index 00000000000..6b9a7d97c31
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.QueryContinueDragEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the QueryContinueDrag event of a Control.
+ /// </summary>
+ [Serializable]
+ public delegate void QueryContinueDragEventHandler(object sender, QueryContinueDragEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs
new file mode 100644
index 00000000000..11533cb99c1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs
@@ -0,0 +1,205 @@
+//
+// System.Windows.Forms.RadioButton.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class RadioButton : ButtonBase {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public RadioButton()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Appearance Appearance {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool AutoCheck {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ContentAlignment CheckAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Checked {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override ContentAlignment TextAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public void PerformClick()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event EventHandler AppearanceChanged {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public event EventHandler CheckedChanged {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "RADIOBUTTON";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ (int)WindowStyles.WS_CHILD |
+ (int)WindowStyles.WS_VISIBLE | (int)SS_Static_Control_Types.SS_LEFT );
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnCheckedChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnClick(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnEnter(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs mevent)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override bool ProcessMnemonic(char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs
new file mode 100644
index 00000000000..f5dfca40b5a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs
@@ -0,0 +1,589 @@
+//
+// System.Windows.Forms.RichTextBox.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.IO;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class RichTextBox : TextBoxBase {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public RichTextBox()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override bool AllowDrop {
+ get {
+ //FIXME:
+ return base.AllowDrop;
+ }
+ set {
+ //FIXME:
+ base.AllowDrop = value;
+ }
+ }
+ [MonoTODO]
+ public override bool AutoSize {
+ get {
+ //FIXME:
+ return base.AutoSize;;
+ }
+ set {
+ //FIXME:
+ base.AutoSize = value;
+ }
+ }
+ [MonoTODO]
+ public bool AutoWordSelection {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+ [MonoTODO]
+ public int BulletIndent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool CanRedo {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool DetectUrls {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Font Font {
+ get {
+ //FIXME:
+ return base.Font;
+ }
+ set {
+ //FIXME:
+ base.Font = value;
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+ [MonoTODO]
+ public override int MaxLength {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override bool Multiline {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string RedoActionName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int RightMargin {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string Rtf {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public RichTextBoxScrollBars ScrollBars {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string SelectedRtf {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string SelectedText {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public HorizontalAlignment SelectionAlignment {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool SelectionBullet {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectionCharOffset {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color SelectionColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Font SelectionFont {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectionHangingIndent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectionIndent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override int SelectionLength {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool SelectionProtected {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectionRightIndent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int[] SelectionTabs {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public RichTextBoxSelectionTypes SelectionType {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowSelectionMargin {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public override int TextLength {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string UndoActionName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public float ZoomFactor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public bool CanPaste(DataFormats.Format clipFormat)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ } [MonoTODO]
+ public int Find(char[] chars)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Find(string srt)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Find(char[] chars, int val)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Find(string srt, RichTextBoxFinds finds)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Find(char[] chars, int val1, int val2)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Find(string srt, int val, RichTextBoxFinds finds)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Find(string srt, int val1, int val2, RichTextBoxFinds finds)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public char GetCharFromPosition(Point pt)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int GetLineFromCharIndex(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Point GetPositionFromCharIndex(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void LoadFile(string str)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void LoadFile(Stream str, RichTextBoxStreamType type)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ public void Paste(DataFormats.Format format)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Redo()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SaveFile(string str)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SaveFile(Stream str, RichTextBoxStreamType type)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SaveFile(string str, RichTextBoxStreamType type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ public event ContentsResizedEventHandler ContentsResized;
+ public event EventHandler HScroll;
+ public event EventHandler ImeChange;
+ public event LinkClickedEventHandler LinkClicked;
+ public event EventHandler Protected;
+ public event EventHandler SelectionChanged;
+ public event EventHandler VScroll;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "RICHTEXTBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new System.Drawing.Size(300,300);
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected virtual object CreateRichTextEditOleCallback()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnContentsResized(ContentsResizedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnContextMenuChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnHScroll(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnImeChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnClicked(LinkClickedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnProtected(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnRightToLeftChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectionChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnSystemColorsChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnTextChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnVScroll(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs
new file mode 100644
index 00000000000..e2d83f56d73
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.RichTextBoxFinds.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RichTextBoxFinds {
+ MatchCase = 4,
+ NoHighlight = 8,
+ None = 0,
+ Reverse = 16,
+ WholeWord = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs
new file mode 100644
index 00000000000..6bfaa34293d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.RichTextBoxScrollBars.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RichTextBoxScrollBars {
+ Both = 3,
+ ForcedBoth = 19,
+ ForcedHorizontal = 17,
+ ForcedVertical = 18,
+ Horizontal = 1,
+ None = 0,
+ Vertical = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs
new file mode 100644
index 00000000000..498d34a8414
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.RichTextBoxSelectionAttribute.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RichTextBoxSelectionAttribute {
+ All = 1,
+ Mixed = -1,
+ None = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs
new file mode 100644
index 00000000000..cdc99939ca9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.RichTextBoxSelectionTypes.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RichTextBoxSelectionTypes {
+ Empty = 0,
+ MultiChar = 4,
+ MultiObject = 8,
+ Object = 2,
+ Text = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs
new file mode 100644
index 00000000000..9331b559ad2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.RichTextBoxStreamType.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RichTextBoxStreamType {
+ RichNoOleObjs = 2,
+ PlainText = 1,
+ RichText = 0,
+ TextTextOleObjs = 3,
+ UnicodePlainText = 4
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs
new file mode 100644
index 00000000000..4e608bb4c5a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.RichTextBoxWordPunctuations.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RichTextBoxWordPunctuations {
+ All = 896,
+ Custom = 512,
+ Level1 =128,
+ Level2 = 256
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RightToLeft.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RightToLeft.cs
new file mode 100644
index 00000000000..274d77411dc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RightToLeft.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.RightToLeft.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RightToLeft {
+ Inherit = 2,
+ No = 0,
+ Yes = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
new file mode 100644
index 00000000000..0538f1b24df
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
@@ -0,0 +1,65 @@
+//
+// System.Windows.Forms.SaveFileDialog.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.IO;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public sealed class SaveFileDialog : FileDialog {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SaveFileDialog()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool CreatePrompt {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool OverwritePrompt {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public Stream OpenFile()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override void Reset()
+ {
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs
new file mode 100644
index 00000000000..2fcbf192d8f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs
@@ -0,0 +1,120 @@
+//
+// System.Windows.Forms.Screen.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Runtime.InteropServices;
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class Screen {
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public static Screen[] AllScreens {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Rectangle Bounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string DeviceName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Primary {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static Screen PrimaryScreen {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Rectangle WorkingArea {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ return base.Equals(obj);
+ }
+ [MonoTODO]
+ public static Screen FormControl(Control ctl)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Screen FormHandle(IntPtr hwnd)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Screen FormPoint(Point point)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Screen FormRectangle(Rectangle rect)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Rectangle GetBounds(Control ctl)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Rectangle GetBounds(Point pt)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static Rectangle GetBounds(Rectangle rect)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ [MonoTODO]
+ public static Rectangle GetWorkingArea(Control ctl)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ return base.ToString();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs
new file mode 100644
index 00000000000..e57a71c2f6a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs
@@ -0,0 +1,236 @@
+//
+// System.Windows.Forms.ScrollBar.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+//public void add_Click(EventHandler value);
+//public void add_MouseDown(MouseEventHandler value);
+//public void add_MouseMove(MouseEventHandler value);
+//public void add_MouseUp(MouseEventHandler value);
+//public void add_Paint(PaintEventHandler value);
+//
+//protected virtual void OnValueChanged(EventArgs e);
+//public Font Font {get; set;}
+
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ScrollBar : Control {
+
+ //
+ // --- Constructor
+ //
+
+ public ScrollBar() : base()
+ {
+ //spec says tabstop defaults to false.
+ base.TabStop = false;
+ //base.window
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ //FIXME:
+ return base.BackColor;
+ }
+ set {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public new ImeMode ImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public int LargeChange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public int Maximum {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public int Minimum {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public int SmallChange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ public override string Text {
+ //Can't imagen what a scroll bar would do with text, so just call base.
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ public int Value {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ //COMPACT FRAMEWORK
+ public override string ToString()
+ {
+ //replace with value, if implmeted as properity.
+ return Value.ToString();
+ }
+
+ //
+ // --- Public Events
+ //
+
+ [MonoTODO]
+ public event ScrollEventHandler Scroll;
+
+ //Compact FrameWork
+ public event EventHandler ValueChanged;
+
+ //
+ // --- Protected Properties
+ //
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ createParams.Caption = "";
+ createParams.ClassName = "SCROLLBAR";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+
+ //if (parent != null)
+ // createParams.Parent = parent.Handle;
+ //else
+ createParams.Parent = (IntPtr) 0;
+
+ createParams.Style = (int) WindowStyles.WS_OVERLAPPEDWINDOW;
+
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ //FIXME:
+ return base.DefaultImeMode;
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ //COMPACT FRAMEWORK
+ [MonoTODO]
+ protected override void OnEnabledChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnEnabledChanged(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBars.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBars.cs
new file mode 100644
index 00000000000..d2e8d427362
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBars.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ScrollBars.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ScrollBars {
+ Both = 3,
+ Horizontal = 1,
+ None = 0,
+ Vertical = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollButton.cs
new file mode 100644
index 00000000000..861def358a4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollButton.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.ScrollButton.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ScrollButton {
+ Down = 1,
+ Left = 2,
+ Max = 3,
+ Min = 0,
+ Right = 3,
+ Up = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs
new file mode 100644
index 00000000000..db723ec3df0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.ScrollEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ScrollEventArgs : EventArgs {
+
+ #region Fields
+
+ private int newvalue;
+ private ScrollEventType type;
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public ScrollEventArgs(ScrollEventType type, int newVal)
+ {
+ this.newvalue = newvalue;
+ this.type = type;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public int NewValue
+ {
+ get {
+ return newvalue;
+ }
+ set {
+ newvalue = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public ScrollEventType Type {
+ get {
+ return type;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs
new file mode 100644
index 00000000000..d83ea4602b1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ScrollEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that handles the Scroll
+ /// event of a ScrollBar, TrackBar, or DataGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void ScrollEventHandler(object sender, ScrollEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventType.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventType.cs
new file mode 100644
index 00000000000..81271d818fb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventType.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.ScrollEventType.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ScrollEventType {
+ EndScroll = 8,
+ First = 6,
+ LargeDecrement = 2,
+ LargeIncrement = 3,
+ Last = 7,
+ SmallDecrement = 0,
+ ThumbPosition = 4,
+ SmallIncrement = 1,
+ ThumbTrack = 5
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
new file mode 100644
index 00000000000..ed0e37d9d95
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
@@ -0,0 +1,346 @@
+//
+// System.Windows.Forms.Form
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// ScrollableControl.DockPaddingEdges stub added by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+// CE Complete.
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ public class ScrollableControl : Control {
+
+ private static bool classRegistered = false;
+
+ private ScrollableControl.DockPaddingEdges dockPadding;
+
+ //
+ // --- Constructor
+ //
+ public ScrollableControl () : base ()
+ {
+ dockPadding = new ScrollableControl.DockPaddingEdges();
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public virtual bool AutoScroll {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Size AutoScrollMargin {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Size AutoScrollMinSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Point AutoScrollPosition {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ public override Rectangle DisplayRectangle {
+ get {
+ return base.DisplayRectangle;
+ }
+ }
+
+ [MonoTODO]
+ public ScrollableControl.DockPaddingEdges DockPadding {
+ get {
+ return dockPadding;
+ }
+ }
+
+ //
+ // --- Protected Properties
+ //
+
+ protected override CreateParams CreateParams {
+ get {
+ if (!classRegistered) {
+ WNDCLASS wndClass = new WNDCLASS();
+
+ wndClass.style = (int) (CS_.CS_OWNDC | CS_.CS_VREDRAW | CS_.CS_HREDRAW);
+ wndClass.lpfnWndProc = NativeWindow.GetWindowProc();
+ wndClass.cbClsExtra = 0;
+ wndClass.cbWndExtra = 0;
+ wndClass.hInstance = (IntPtr)0;
+ wndClass.hIcon = (IntPtr)0;
+ wndClass.hCursor = (IntPtr)0;
+ wndClass.hbrBackground = (IntPtr)6; // ???
+ wndClass.lpszMenuName = "";
+ wndClass.lpszClassName = "mono_scrollable_control";
+
+ if (Win32.RegisterClass(ref wndClass) != 0)
+ classRegistered = true;
+ }
+
+ CreateParams createParams = new CreateParams ();
+ createParams.Caption = "Hello World";
+ createParams.ClassName = "mono_scrollable_control";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+
+ //if (parent != null)
+ // createParams.Parent = parent.Handle;
+ //else
+ createParams.Parent = (IntPtr) 0;
+
+ createParams.Style = (int) WindowStyles.WS_OVERLAPPEDWINDOW;
+ //test version with scroll bars.
+ //createParams.Style = (int) (WindowStyles.WS_OVERLAPPEDWINDOW | WindowStyles.WS_HSCROLL | WindowStyles.WS_VSCROLL);
+
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected bool HScroll {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ protected bool VScroll {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ static private IntPtr WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) {
+ Message message = new Message();
+
+ message.HWnd = hWnd;
+ message.Msg = msg;
+ message.WParam = wParam;
+ message.LParam = lParam;
+ message.Result = (IntPtr)0;
+
+ return (IntPtr)0;
+ }
+
+ [MonoTODO]
+ protected virtual void AdjustFormScrollbars (
+ bool displayScrollbars)
+ {
+ //FIXME:
+ }
+
+ protected override void OnLayout (LayoutEventArgs e) {
+ //FIXME:
+ base.OnLayout (e);
+ }
+
+ protected override void OnMouseWheel (MouseEventArgs e) {
+ //FIXME:
+ base.OnMouseWheel (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e) {
+ //FIXME:
+ base.OnVisibleChanged (e);
+ }
+
+ protected override void ScaleCore (float dx, float dy) {
+ //FIXME:
+ base.ScaleCore (dx, dy);
+ }
+
+ protected override void WndProc (ref Message m) {
+ //FIXME:
+ base.WndProc (ref m);
+ }
+
+
+ /// ScrollableControl.DockPaddingEdges
+ /// Determines the border padding for docked controls.
+
+ public class DockPaddingEdges : ICloneable {
+ // --- Fields ---
+ int all;
+ int bottom;
+ int left;
+ int right;
+ int top;
+
+
+ // --- public Properties ---
+ public int All {
+ get {
+ return all;
+ }
+ set {
+ all = value;
+ left = value;
+ right = value;
+ bottom = value;
+ top = value;
+ }
+ }
+
+ public int Bottom {
+ get { return bottom; }
+ set { bottom = value; }
+ }
+
+ public int Left {
+ get { return left; }
+ set { left = value; }
+ }
+
+ public int Right {
+ get { return right; }
+ set { right = value; }
+ }
+
+ public int Top {
+ get { return top; }
+ set { top = value; }
+ }
+
+
+ /// --- public Methods ---
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DockPaddingEdges objects. The return value is
+ /// based on the equivalence of the
+ /// properties of the two DockPaddingEdges.
+ /// </remarks>
+
+ public static bool operator == (DockPaddingEdges objA, DockPaddingEdges objB) {
+ return ((objA.left == objB.left) &&
+ (objA.right == objB.right) &&
+ (objA.top == objB.top) &&
+ (objA.bottom == objB.bottom) &&
+ (objA.all == objB.all));
+ }
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this DockPaddingEdges and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj) {
+ if (!(obj is DockPaddingEdges))
+ return false;
+
+ return (this == (DockPaddingEdges) obj);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DockPaddingEdges objects. The return value is
+ /// based on the equivalence of the
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator != (DockPaddingEdges objA, DockPaddingEdges objB) {
+ return ((objA.left != objB.left) ||
+ (objA.right != objB.right) ||
+ (objA.top != objB.top) ||
+ (objA.bottom != objB.bottom) ||
+ (objA.all != objB.all));
+ }
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode () {
+ unchecked{
+ return all * top * bottom * right * left;
+ }
+ }
+
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ object ICloneable.Clone ()
+ {
+ DockPaddingEdges dpe = new DockPaddingEdges();
+ dpe.all = all;
+ dpe.top = top;
+ dpe.right = right;
+ dpe.bottom = bottom;
+ dpe.left = left;
+ return (object) dpe;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the DockPaddingEdges as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return "All = " + all.ToString() + " Top = " + top.ToString() +
+ " Right = " + right.ToString() + " Bottom = " + bottom.ToString() +
+ " Left = " + left.ToString();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SecurityIDType.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SecurityIDType.cs
new file mode 100644
index 00000000000..d4113ec8e43
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SecurityIDType.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.SecurityIDType.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum SecurityIDType {
+ Alias = 4,
+ Computer = 9,
+ DeletedAccount = 6,
+ Domain = 3,
+ Group = 2,
+ Invalid = 7,
+ Unknown = 8,
+ User = 1,
+ WellKnownGroup = 5
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs
new file mode 100644
index 00000000000..b95360d92cd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs
@@ -0,0 +1,46 @@
+//
+// System.Windows.Forms.SelectedGridItemChangedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms
+{
+
+ // <summary>
+ // </summary>
+
+ public class SelectedGridItemChangedEventArgs : EventArgs {
+ GridItem old;
+ GridItem newGridItem;
+
+ //
+ // --- Constructor
+ //
+ public SelectedGridItemChangedEventArgs(GridItem old, GridItem newGridItem) {
+ this.newGridItem = newGridItem;
+ this.old = old;
+ }
+
+ #region Public Properties
+
+ public GridItem NewSelection
+ {
+ get {
+ return newGridItem;
+ }
+ }
+
+ public GridItem OldSelection {
+ get {
+ return old;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
new file mode 100644
index 00000000000..bac2a102a5b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.SelectedGridItemChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the SelectedGridItemChanged event of a PropertyGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void SelectedGridItemChangedEventHandler(object sender, SelectedGridItemChangedEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionMode.cs
new file mode 100644
index 00000000000..ce4416847e2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionMode.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.SelectionMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SelectionMode {
+ MultiExtended = 3,
+ MultiSimple = 2,
+ None = 0,
+ One = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRange.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRange.cs
new file mode 100644
index 00000000000..236071a39d2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRange.cs
@@ -0,0 +1,69 @@
+//
+// System.Windows.Forms.SelectionRange.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class SelectionRange {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SelectionRange()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public SelectionRange(SelectionRange range)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public SelectionRange(DateTime time1,DateTime time2)
+ {
+ //FIXME:
+ }
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public DateTime End {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public DateTime Start {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ return base.ToString();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs
new file mode 100644
index 00000000000..292ca12872d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs
@@ -0,0 +1,95 @@
+//
+// System.Windows.Forms.SelectionRangeConverter.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+using System.Collections;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+using System.ComponentModel;
+ public class SelectionRangeConverter : TypeConverter {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public SelectionRangeConverter()
+ {
+ //FIXME:
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type type)
+ {
+ //FIXME:
+ return base.CanConvertFrom(context,type);
+ }
+
+ [MonoTODO]
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type type)
+ {
+ //FIXME:
+ return base.CanConvertTo(context, type);
+ }
+
+ [MonoTODO]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ //FIXME:
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type type)
+ {
+ //FIXME:
+ return base.ConvertTo(context, culture, value, type);
+ }
+
+ [MonoTODO]
+ public override object CreateInstance(ITypeDescriptorContext context, IDictionary dict)
+ {
+ //FIXME:
+ return base.CreateInstance(context, dict );
+ }
+
+ [MonoTODO]
+ public bool CreateInstanceSupported()
+ {
+ //FIXME:
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
+ {
+ //FIXME:
+ return base.GetCreateInstanceSupported(context);
+ }
+
+ //Not part of Spec??
+ //[MonoTODO]
+ //public override PropertyDescriptorCollection GetProperties( ITypeDescriptorContext context, object obj, Attribute[] atts)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //
+ //[MonoTODO]
+ //public override bool GetPropertiesSupported(ITypeDescriptorContext context)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SendKeys.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SendKeys.cs
new file mode 100644
index 00000000000..6fba383b0cb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SendKeys.cs
@@ -0,0 +1,38 @@
+//
+// System.Windows.Forms.SendKeys.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class SendKeys {
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ static void Flush()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ static void Send(string keys)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ static void SendWait(string keys)
+ {
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Shortcut.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Shortcut.cs
new file mode 100644
index 00000000000..578ec426c87
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Shortcut.cs
@@ -0,0 +1,170 @@
+//
+// System.Windows.Forms.Shortcut.cs
+//
+// Author:
+// Dennis Hayes = dennish@raytek.com
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// = C, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum Shortcut {
+ Alt0 = 262192,
+ Alt1 = 262193,
+ Alt2 = 262194,
+ Alt3 = 262195,
+ Alt4 = 262196,
+ Alt5 = 262197,
+ Alt6 = 262198,
+ Alt7 = 262199,
+ Alt8 = 262200,
+ Alt9 = 262201,
+ AltBksp = 262152,
+ AltF1 = 262256,
+ AltF2 = 262257,
+ AltF3 = 262258,
+ AltF4 = 262259,
+ AltF5 = 262260,
+ AltF6 = 262261,
+ AltF7 = 262262,
+ AltF8 = 262263,
+ AltF9 = 262264,
+ AltF10 = 262265,
+ AltF11 = 262266,
+ AltF12 = 262267,
+ Ctrl0 = 131120,
+ Ctrl1 = 131121,
+ Ctrl2 = 131122,
+ Ctrl3 = 131123,
+ Ctrl4 = 131124,
+ Ctrl5 = 131125,
+ Ctrl6 = 131126,
+ Ctrl7 = 131127,
+ Ctrl8 = 131128,
+ Ctrl9 = 131129,
+ CtrlA = 131137,
+ CtrlB = 131138,
+ CtrlC = 131139,
+ CtrlD = 131140,
+ CtrlDel = 131118,
+ CtrlE = 131141,
+ CtrlF = 131142,
+ CtrlF1 = 131184,
+ CtrlF2 = 131185,
+ CtrlF3 = 131186,
+ CtrlF4 = 131187,
+ CtrlF5 = 131188,
+ CtrlF6 = 131189,
+ CtrlF7 = 131190,
+ CtrlF8 = 131191,
+ CtrlF9 = 131192,
+ CtrlF10 = 131193,
+ CtrlF11 = 131194,
+ CtrlF12 = 131195,
+ CtrlG = 131143,
+ CtrlH = 131144,
+ CtrlI = 131145,
+ CtrlIns = 131117,
+ CtrlJ = 131146,
+ CtrlK = 131147,
+ CtrlL = 131148,
+ CtrlM = 131149,
+ CtrlN = 131150,
+ CtrlO = 131151,
+ CtrlP = 131152,
+ CtrlQ = 131153,
+ CtrlR = 131154,
+ CtrlS = 131155,
+ CtrlT = 131156,
+ CtrlU = 131157,
+ CtrlV = 131158,
+ CtrlW = 131159,
+ CtrlX = 131160,
+ CtrlY = 131161,
+ CtrlZ = 131162,
+ CtrlShift0 = 196656,
+ CtrlShift1 = 196657,
+ CtrlShift2 = 196658,
+ CtrlShift3 = 196659,
+ CtrlShift4 = 196660,
+ CtrlShift5 = 196661,
+ CtrlShift6 = 196662,
+ CtrlShift7 = 196663,
+ CtrlShift8 = 196664,
+ CtrlShift9 = 196665,
+ CtrlShiftA = 196673,
+ CtrlShiftB = 196674,
+ CtrlShiftC = 196675,
+ CtrlShiftD = 196676,
+ CtrlShiftE = 196677,
+ CtrlShiftF = 196678,
+ CtrlShiftF1 = 196720,
+ CtrlShiftF2 = 196721,
+ CtrlShiftF3 = 196722,
+ CtrlShiftF4 = 196723,
+ CtrlShiftF5 = 196724,
+ CtrlShiftF6 = 196725,
+ CtrlShiftF7 = 196726,
+ CtrlShiftF8 = 196727,
+ CtrlShiftF9 = 196728,
+ CtrlShiftF10 = 196729,
+ CtrlShiftF11 = 196730,
+ CtrlShiftF12 = 196731,
+ CtrlShiftG = 196679,
+ CtrlShiftH = 196680,
+ CtrlShiftI = 196681,
+ CtrlShiftJ = 196682,
+ CtrlShiftK = 196683,
+ CtrlShiftL = 196684,
+ CtrlShiftM = 196685,
+ CtrlShiftN = 196686,
+ CtrlShiftO = 196687,
+ CtrlShiftP = 196688,
+ CtrlShiftQ = 196689,
+ CtrlShiftR = 196690,
+ CtrlShiftS = 196691,
+ CtrlShiftT = 196692,
+ CtrlShiftU = 196693,
+ CtrlShiftV = 196694,
+ CtrlShiftW = 196695,
+ CtrlShiftX = 196696,
+ CtrlShiftY = 196697,
+ CtrlShiftZ = 196698,
+ Del = 46,
+ F1 = 112,
+ F2 = 113,
+ F3 = 114,
+ F4 = 115,
+ F5 = 116,
+ F6 = 117,
+ F7 = 118,
+ F8 = 119,
+ F9 = 120,
+ F10 = 121,
+ F11 = 122,
+ F12 = 123,
+ Ins = 45,
+ None = 0,
+ ShiftDel = 65582,
+ ShiftF1 = 65648,
+ ShiftF2 = 65649,
+ ShiftF3 = 65650,
+ ShiftF4 = 65651,
+ ShiftF5 = 65652,
+ ShiftF6 = 65653,
+ ShiftF7 = 65654,
+ ShiftF8 = 65655,
+ ShiftF9 = 65656,
+ ShiftF10 = 65657,
+ ShiftF11 = 65658,
+ ShiftF12 = 65659,
+ ShiftIns = 65581
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs
new file mode 100644
index 00000000000..5fc664afc80
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.SizeGripStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum SizeGripStyle {
+ Auto = 0,
+ Hide = 2,
+ Show = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SortOrder.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SortOrder.cs
new file mode 100644
index 00000000000..1068f4c40af
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SortOrder.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.SortOrder.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum SortOrder {
+ Ascending = 1,
+ Descending = 2,
+ Nonoe = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Splitter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Splitter.cs
new file mode 100644
index 00000000000..5157d54cb1b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Splitter.cs
@@ -0,0 +1,221 @@
+//
+// System.Windows.Forms.Splitter.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class Splitter : Control, IMessageFilter {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public Splitter()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override bool AllowDrop {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override AnchorStyles Anchor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override DockStyle Dock {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Font Font {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int MinExtra {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int MinSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SplitPosition {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "SPLITTER";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new System.Drawing.Size(10,500);
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore( int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ throw new NotImplementedException ();
+ }
+ bool IMessageFilter.PreFilterMessage(ref Message m){
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs
new file mode 100644
index 00000000000..2e9a1009039
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs
@@ -0,0 +1,75 @@
+//
+// System.Windows.Forms.SplitterEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ [ComVisible(true)]
+ public class SplitterEventArgs : EventArgs {
+
+ #region Fields
+ private int x;
+ private int y;
+ private int splitx;
+ private int splity;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public SplitterEventArgs(int x, int y, int splitX, int splitY)
+ {
+ this.x = x;
+ this.y = y;
+ splitx = splitX;
+ splity = splitY;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public int SplitX {
+ get {
+ return splitx;
+ }
+ set {
+ splitx = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public int SplitY {
+ get {
+ return splity;
+ }
+ set {
+ splity = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public int X {
+ get {
+ return x;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Y {
+ get {
+ return y;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs
new file mode 100644
index 00000000000..6573b88a9d3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.SplitterEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the SplitterMoving and SplitterMoved events of a Splitter.
+ /// </summary>
+ [Serializable]
+ public delegate void SplitterEventHandler(object sender, SplitterEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs
new file mode 100644
index 00000000000..3570e28fccc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs
@@ -0,0 +1,564 @@
+//
+// System.Windows.Forms.StatusBar.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Represents a Windows status bar control.
+ // </summary>
+ public class StatusBar : Control {
+
+ //
+ // --- Private Fields
+ //
+ private bool showPanels;
+ private bool sizingGrip;
+
+ //
+ // --- Constructors/Destructors
+ //
+ [MonoTODO]
+ public StatusBar() : base()
+ {
+ Dock = DockStyle.Bottom;
+ showPanels = false;
+ sizingGrip = true;
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected virtual void OnDrawItem(StatusBarDrawItemEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleDestroyed(e);
+ }
+
+ [MonoTODO]
+ protected override void OnLayout(LayoutEventArgs e)
+ {
+ //FIXME:
+ base.OnLayout(e);
+ }
+
+ [MonoTODO]
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseDown(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnPanelClick(StatusBarPanelClickEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ //FIXME:
+ base.OnResize(e);
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+
+ //
+ // --- Public Events
+ //
+ public event StatusBarDrawItemEventHandler DrawItem;
+ public event StatusBarPanelClickEventHandler PanelClick;
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override Color BackColor {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //just to get it to run
+ //FIXME:
+ internal DockStyle dockstyle;
+ [MonoTODO]
+ public override DockStyle Dock {
+ get {
+ return dockstyle;
+ }
+ set {
+ dockstyle = value;
+ }
+ }
+
+ [MonoTODO]
+ public override Font Font {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public new ImeMode ImeMode {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public StatusBar.StatusBarPanelCollection Panels {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool ShowPanels {// default false {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool SizingGrip // default true {
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public new bool TabStop {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override string Text {
+
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "STATUSBAR";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ //
+ // System.Windows.Forms.StatusBar.StatusBarPanelCollection
+ //
+ // Author:
+ // stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+ // stub ammended by Jaak Simm (jaaksimm@firm.ee)
+ // Implemented by Richard Baumann <biochem333@nyc.rr.com>
+ // (C) Ximian, Inc., 2002
+ //
+ // <summary>
+ // Represents the collection of panels in a StatusBar control.
+ // </summary>
+ public class StatusBarPanelCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Private Fields
+ //
+ private ArrayList list;
+ private StatusBar owner;
+ private static string class_string = "System.Windows.Forms.StatusBar.StatusBarPanelCollection::";
+
+ //
+ // --- Constructors/Destructors
+ //
+ StatusBarPanelCollection(StatusBar owner) : base()
+ {
+ list = new ArrayList();
+ this.owner = owner;
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public virtual int Add(StatusBarPanel panel)
+ {
+ string method_string = "Add(StatusBarPanel) ";
+ if (panel == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panel == null");
+ }
+ if (panel.Parent == null) {
+
+ throw new ArgumentException(class_string + method_string + "panel.Parent != null");
+ }
+ // FIXME: StatusBarPanel.Parent is readonly!
+ //panel.Parent = owner;
+ return list.Add(panel);
+ }
+
+ [MonoTODO]
+ public virtual StatusBarPanel Add(string s)
+ {
+ throw new NotImplementedException ();
+ // StatusBarPanel tmp = new StatusBarPanel();
+ // tmp.Text = s;
+ // // FIXME: StatusBarPanel.Parent is readonly!
+ // //tmp.Parent = owner;
+ // list.Add(tmp);
+ // return tmp;
+ }
+
+ [MonoTODO]
+ public virtual void AddRange(StatusBarPanel[] panels)
+ {
+ string method_string = "AddRange(StatusBarPanel[]) ";
+ if (panels == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panels == null");
+ }
+ for (int i = 0; i < panels.Length; i++) {
+ // FIXME: StatusBarPanel.Parent is readonly!
+ //panels[i].Parent = owner;
+ }
+ list.AddRange(panels);
+ }
+
+ public virtual void Clear()
+ {
+ list.Clear();
+ }
+
+ public bool Contains(StatusBarPanel panel)
+ {
+ return list.Contains(panel);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ public int IndexOf(StatusBarPanel panel)
+ {
+ return list.IndexOf(panel);
+ }
+
+ [MonoTODO]
+ public virtual void Insert(int index, StatusBarPanel panel)
+ {
+ string method_string = "Insert(int,StatusBarPanel) ";
+ if (panel == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panel == null");
+ }
+ if (panel.Parent == null) {
+
+ throw new ArgumentException(class_string + method_string + "panel.Parent != null");
+ }
+ if (panel.AutoSize != StatusBarPanelAutoSize.None &&
+ panel.AutoSize != StatusBarPanelAutoSize.Contents &&
+ panel.AutoSize != StatusBarPanelAutoSize.Spring)
+ {
+ throw new InvalidEnumArgumentException(class_string + method_string + "panel.AutoSize is not a valid StatusBarPanelAutoSize value");
+ }
+ list.Insert(index,panel);
+
+ // do this after insert because insert does the range checking and might throw an exception
+ // FIXME: StatusBarPanel.Parent is readonly!
+ // panel.Parent = owner; // a rethrow for a better exception message, or an extra range check, would incur an unnecessary performance cost
+ }
+
+ public virtual void Remove(StatusBarPanel panel)
+ {
+ string method_string = "Remove(StatusBarPanel) ";
+ if (panel == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panel == null");
+ }
+ list.Remove(panel);
+ }
+
+ public virtual void RemoveAt(int index)
+ {
+ list.RemoveAt(index);
+ }
+
+ void ICollection.CopyTo(Array dest, int index)
+ {
+ string method_string = "ICollection.CopyTo(Array,int) ";
+ if (dest == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "array == null");
+ }
+ if (index < 0) {
+
+ throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
+ }
+ if (dest.Rank != 1) {
+
+ throw new ArgumentException(class_string + method_string + "array is multidimensional");
+ }
+ if (index >= dest.Length) {
+
+ throw new ArgumentException(class_string + method_string + "index >= array.Length");
+ }
+ if (Count+index >= dest.Length) {
+
+ throw new ArgumentException(class_string + method_string + "insufficient array capacity");
+ }
+ // easier/quicker to let the runtime throw the invalid cast exception if necessary
+ for (int i = 0; index < dest.Length; i++, index++) {
+
+ dest.SetValue(list[i], index);
+ }
+ }
+
+ int IList.Add(object panel)
+ {
+ string method_string = "IList.Add(object) ";
+ if (!(panel is StatusBarPanel)) {
+
+ throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+ }
+ return Add((StatusBarPanel) panel);
+ }
+
+ bool IList.Contains(object panel)
+ {
+ if (!(panel is StatusBarPanel)) {
+
+ return false;
+ }
+ return Contains((StatusBarPanel) panel);
+ }
+
+ int IList.IndexOf(object panel)
+ {
+ if (!(panel is StatusBarPanel)) {
+
+ return -1;
+ }
+ return IndexOf((StatusBarPanel) panel);
+ }
+
+ void IList.Insert(int index, object panel)
+ {
+ string method_string = "IList.Insert(int,object) ";
+ if (!(panel is StatusBarPanel)) {
+
+ throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+ }
+ Insert(index, (StatusBarPanel) panel);
+ }
+
+ void IList.Remove(object panel)
+ {
+ string method_string = "IList.Remove(object) ";
+ if (!(panel is StatusBarPanel)) {
+
+ throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+ }
+ Remove((StatusBarPanel) panel);
+ }
+
+
+ // --- Public Properties
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ //get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+
+ get { return false; }
+ }
+
+ object IList.this[int index] {
+
+ get { return this[index]; }
+ set { this[index]=(StatusBarPanel)value; }
+ }
+
+ public virtual StatusBarPanel this[int index] {
+
+ get
+ {
+ // The same checks are done by the list, so this is redundant
+ // This is left here in case you prefer better exception messages over performance
+ //string method_string = "get_Item(int) ";
+ //if (index < 0)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
+ //}
+ //if (index >= Count)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index >= Count");
+ //}
+ return (StatusBarPanel)list[index];
+ }
+ set
+ {
+ // The same checks are done by the list, so this is redundant
+ // This is left here in case you prefer better exception messages over performance
+ //string method_string = "set_Item(int,StatusBarPanel) ";
+ //if (index < 0)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
+ //}
+ //if (index >= Count)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index >= Count");
+ //}
+ //if (value == null)
+ //{
+ // throw new ArgumentNullException(class_string + method_string + "panel == null");
+ //}
+ list[index] = value;
+ }
+ }
+
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+
+ // --- Private Properties
+
+ private bool IsFixedSize { get { return false; } }
+
+// private object ILList.this[int index]
+// {
+// get { return (StatusBarPanel) this[index]; }
+// set
+// {
+// string method_string = "IList.set_Item(int,object) ";
+// if (!(value is StatusBarPanel))
+// {
+// throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+// }
+// this[index] = (StatusBarPanel) value;
+// }
+// }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs
new file mode 100644
index 00000000000..2291f0b5177
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs
@@ -0,0 +1,43 @@
+//
+// System.Windows.Forms.StatusBarDrawItemEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DrawItem event.
+ /// </summary>
+ public class StatusBarDrawItemEventArgs : DrawItemEventArgs {
+
+ private StatusBarPanel panel;
+
+ /// --- Constructor ---
+ public StatusBarDrawItemEventArgs(Graphics g, Font font,
+ Rectangle r, int itemId, DrawItemState itemState,
+ StatusBarPanel panel, Color foreColor, Color backColor)
+ : base(g, font, r, itemId, itemState, foreColor, backColor) {
+ this.panel = panel;
+ }
+
+ public StatusBarDrawItemEventArgs(Graphics g, Font font,
+ Rectangle r, int itemId, DrawItemState itemState, StatusBarPanel panel)
+ : base(g, font, r, itemId, itemState) {
+ this.panel = panel;
+ }
+
+ #region Public Properties
+ public StatusBarPanel Panel
+ {
+ get {
+ return panel;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs
new file mode 100644
index 00000000000..36fd5720fff
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.StatusBarDrawItemEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the DrawItem event of a StatusBar.
+ /// </summary>
+ [Serializable]
+ public delegate void StatusBarDrawItemEventHandler(object sender, StatusBarDrawItemEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs
new file mode 100644
index 00000000000..783cd28b119
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs
@@ -0,0 +1,131 @@
+//
+// System.Windows.Forms.StatusBarPanel
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a panel in a StatusBar control.
+ /// </summary>
+ public class StatusBarPanel : Component, ISupportInitialize {
+
+ //
+ // --- Private Fields
+ //
+ private HorizontalAlignment alignment;
+ private StatusBarPanelAutoSize autoSize;
+ private StatusBarPanelBorderStyle borderStyle;
+ private Icon icon;
+ private int minWidth;
+ private StatusBar parent;
+ private StatusBarPanelStyle style;
+ private string text;
+ private string toolTipText;
+ private int width;
+
+ //
+ // --- Constructors/Destructors
+ //
+ StatusBarPanel() : base()
+ {
+ alignment = HorizontalAlignment.Left;
+ autoSize = StatusBarPanelAutoSize.None;
+ borderStyle = StatusBarPanelBorderStyle.Sunken;
+ icon = null;
+ minWidth = 10;
+ style = StatusBarPanelStyle.Text;
+ text = "";
+ toolTipText = "";
+ width = 100;
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void BeginInit()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EndInit()
+ {
+ //FIXME:
+ }
+ public override string ToString()
+ {
+ return text;
+ }
+ //
+ // --- Public Properties
+ //
+ public HorizontalAlignment Alignment {
+
+ get { return alignment; }
+ set { alignment = value; }
+ }
+ public StatusBarPanelAutoSize AutoSize {
+
+ get { return autoSize; }
+ set
+ {
+ if (value != StatusBarPanelAutoSize.None && value != StatusBarPanelAutoSize.Contents && value != StatusBarPanelAutoSize.Spring) {
+
+ throw new InvalidEnumArgumentException(
+ "System.Windows.Forms.StatusBarPanel::set_AutoSize(StatusBarPanelAutoSize) " +
+ "value is not a valid StatusBarPanelAutoSize value");
+ }
+ autoSize = value;
+ }
+ }
+ public StatusBarPanelBorderStyle BorderStyle {
+
+ get { return borderStyle; }
+ set { borderStyle = value; }
+ }
+ public Icon Icon {
+
+ get { return icon; }
+ set { icon = value; }
+ }
+ public int MinWidth {
+
+ get { return minWidth; }
+ set { minWidth = value; }
+ }
+ public StatusBar Parent {
+
+ get { return parent; }
+ set { parent = value; }
+ }
+ public StatusBarPanelStyle Style {
+
+ get { return style; }
+ set { style = value; }
+ }
+ public string Text {
+
+ get { return text; }
+ set { text = value; }
+ }
+ public string ToolTipText {
+
+ get { return toolTipText; }
+ set { toolTipText = value; }
+ }
+ public int Width {
+
+ get { return width; }
+ set { width = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs
new file mode 100644
index 00000000000..3f46f90d1a5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.StatusBarPanelAutoSize.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StatusBarPanelAutoSize {
+ Contents = 3,
+ None = 1,
+ Spring = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs
new file mode 100644
index 00000000000..fb9889df0bc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.StatusBarPanelBorderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StatusBarPanelBorderStyle {
+ None = 1,
+ Raised = 2,
+ Sunken =3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs
new file mode 100644
index 00000000000..11d6f711267
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs
@@ -0,0 +1,46 @@
+//
+// System.Windows.Forms.StatusBarPanelClickEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the PanelClick event.
+ /// </summary>
+ public class StatusBarPanelClickEventArgs : MouseEventArgs {
+
+ private StatusBarPanel panel;
+
+ /// --- Constructor ---
+ public StatusBarPanelClickEventArgs(StatusBarPanel panel, MouseButtons button, int clicks, int x, int y) : base(button, clicks, x, y, 0)
+ {
+ this.panel = panel;
+ }
+
+ #region Public Properties
+
+ /// <summary>
+ /// StatusBarPanel Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Gets the StatusBarPanel to draw.
+ /// </remarks>
+ public StatusBarPanel StatusBarPanel
+ {
+ get
+ {
+ return panel;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs
new file mode 100644
index 00000000000..5f51e7b5a81
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.StatusBarPanelClickEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the PanelClick event of a StatusBar.
+ /// </summary>
+ [Serializable]
+ public delegate void StatusBarPanelClickEventHandler(object sender, StatusBarPanelClickEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelCollection.cs
new file mode 100644
index 00000000000..ecd7babf2ef
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelCollection.cs
@@ -0,0 +1,194 @@
+//
+// System.Windows.Forms.StatusBarPanelCollection
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Represents the collection of panels in a StatusBar control.
+ // </summary>
+
+ public class StatusBarPanelCollection : IList, ICollection, IEnumerable {
+
+
+ // --- Public Methods
+
+ [MonoTODO]
+ StatusBarPanelCollection(StatusBar owner)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual int Add(StatusBarPanel panel)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual StatusBarPanel Add(string s)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void AddRange(StatusBarPanel[] panels)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool Contains(StatusBarPanel panel)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(StatusBarPanel panel)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Insert(int index, StatusBarPanel panel)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Remove(StatusBarPanel panel)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ ~StatusBarPanelCollection()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public int Count {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+
+ get
+ {
+ return false; // for this collection, this is always false
+ }
+ }
+ [MonoTODO]
+ public virtual StatusBarPanel this[int index] {
+
+ get{ throw new NotImplementedException (); }
+ set{ throw new NotImplementedException (); }
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs
new file mode 100644
index 00000000000..0bca668fc96
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.StatusBarPanelStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StatusBarPanelStyle {
+ OwnerDraw = 2,
+ Text =1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StructFormat.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StructFormat.cs
new file mode 100644
index 00000000000..a35c2b9e232
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StructFormat.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.StructFormat.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StructFormat {
+ Ansi = 1,
+ Auto = 3,
+ Unicode = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj b/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj
new file mode 100644
index 00000000000..203edc4326f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj
@@ -0,0 +1,1713 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{E0B52BB7-B244-4724-9A63-9616B6FAA5E8}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.Windows.Forms"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "System.Windows.Forms"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
+ />
+ <Reference
+ Name = "Accessibility"
+ AssemblyName = "Accessibility"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\Accessibility.dll"
+ />
+ <Reference
+ Name = "System.Runtime.Remoting"
+ AssemblyName = "System.Runtime.Remoting"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Runtime.Remoting.dll"
+ />
+ <Reference
+ Name = "System.Drawing.Design"
+ AssemblyName = "System.Drawing.Design"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.Design.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AccessibleEvents.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleNavigation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleRole.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleSelection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleStates.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AmbientProperties.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AnchorStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Appearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Application.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ApplicationContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ArrangeDirection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ArrangeStartingPosition.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AxHost.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BaseCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Binding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingManagerBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingMemberInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BootMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Border3DSide.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Border3DStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BoundsSpecified.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Button.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ButtonBase.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ButtonBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ButtonState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CaptionButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CharacterCasing.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CheckBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CheckedListBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CheckState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Clipboard.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColorDepth.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColorDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnHeader.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnHeaderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComboBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComboBoxStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComVisible.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContainerControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContentsResizedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContentsResizedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContextMenu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Control.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlBindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlPaint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConvertEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConvertEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CreateParams.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CurrencyManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Cursor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CursorConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Cursors.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataFormats.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGrid.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridBoolColumn.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridCell.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridColumnStyle.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridLineStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridParentRowsLabelStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridPreferredColumnWidthTypeConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridTableStyle.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridTextBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataGridTextBoxColumn.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DataObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateBoldEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateRangeEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateRangeEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateTimePicker.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateTimePickerFormat.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "day.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DialogResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DockStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DomainUpDown.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragDropEffects.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ErrorBlinkStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ErrorIconAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ErrorProvider.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FeatureSupport.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FileDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FlatStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FolderBrowserDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Font.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FontDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormStartPosition.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormWindowState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FrameStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GiveFeedbackEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GiveFeedbackEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridColumnStylesCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridItemCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridItemType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridTableStylesCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GroupBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Help.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpNavigator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpProvider.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HorizontalAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HScrollBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IButtonControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ICommandExecutor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IComponentEditorPageSite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IContainerControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IDataGridColumnStyleEditingNotificationService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IDataGridEditingService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IDataObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IFeatureSupport.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IFileReaderService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageIndexConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageList.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageListStreamer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IMessageFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangingEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangingEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemActivation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemBoundsPortion.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemCheckEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemCheckEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWin32Window.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWindowTarget.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyPressEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyPressEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Keys.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeysConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Label.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LayoutEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LayoutEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LeftRightAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkArea.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkBehavior.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabelLinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabelLinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListBindingConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListView.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListViewAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListViewItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListViewItemConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MainMenu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MdiLayout.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MeasureItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MeasureItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Menu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MenuGlyph.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MenuItem.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MenuMerge.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Message.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxDefaultButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxIcon.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxOptions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MethodInvoker.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MonthCalendar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NativeWindow.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NavigateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NavigateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NodeLabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NodeLabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NotifyIcon.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NumericUpDown.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OpacityConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OpenFileDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Orientation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OSFeature.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PageSetupDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PaintEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PaintEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Panel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PictureBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PictureBoxSizeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PrintControllerWithStatusDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PrintDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PrintPreviewControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PrintPreviewDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProgressBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyGrid.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertySort.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTab.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTabChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTabChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyValueChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyValueChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryAccessibilityHelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryAccessibilityHelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryContinueDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryContinueDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RadioButton.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBoxFinds.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBoxScrollBars.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBoxSelectionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBoxSelectionTypes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBoxStreamType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RichTextBoxWordPunctuations.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RightToLeft.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SaveFileDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Screen.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollableControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollBars.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SecurityIDType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectedGridItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectedGridItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectionMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectionRange.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectionRangeConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SendKeys.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Shortcut.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SizeGripStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SortOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Splitter.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SplitterEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SplitterEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarDrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarDrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelAutoSize.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StructFormat.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SystemInformation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabAppearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabDrawMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabPage.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabSizeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TextBox.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TextBoxBase.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ThreadExceptionDialog.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TickStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Timer.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarAppearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButton.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarTextAlign.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "tooltip.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TrackBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNodeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNodeConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeView.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewCancelEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewCancelEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewImageIndexConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICues.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICuesEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICuesEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownBase.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UserControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "View.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "VScrollBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "win32Enums.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "win32functions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "win32Handles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "win32Interfaces.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "win32RegistryUtil.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "win32Structs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj.user b/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj.user
new file mode 100644
index 00000000000..4089d2bb533
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.sln b/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.sln
new file mode 100644
index 00000000000..cb5a2aecab4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/System.Windows.Forms.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows.Forms", "System.Windows.Forms.csproj", "{E432273C-2550-4642-866B-3FD63BE785EB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows.Forms.Design", "..\System.Windows.Forms.Design\System.Windows.Forms.Design.csproj", "{EF89E643-02F5-4E97-9353-3C92F209EB47}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {E432273C-2550-4642-866B-3FD63BE785EB}.Debug.ActiveCfg = Debug|.NET
+ {E432273C-2550-4642-866B-3FD63BE785EB}.Debug.Build.0 = Debug|.NET
+ {E432273C-2550-4642-866B-3FD63BE785EB}.Release.ActiveCfg = Release|.NET
+ {E432273C-2550-4642-866B-3FD63BE785EB}.Release.Build.0 = Release|.NET
+ {EF89E643-02F5-4E97-9353-3C92F209EB47}.Debug.ActiveCfg = Debug|.NET
+ {EF89E643-02F5-4E97-9353-3C92F209EB47}.Debug.Build.0 = Debug|.NET
+ {EF89E643-02F5-4E97-9353-3C92F209EB47}.Release.ActiveCfg = Release|.NET
+ {EF89E643-02F5-4E97-9353-3C92F209EB47}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SystemInformation.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SystemInformation.cs
new file mode 100644
index 00000000000..e6a14ced620
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SystemInformation.cs
@@ -0,0 +1,323 @@
+//
+// System.Windows.Forms.SystemInformation
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Provides information about the operating system.
+ // </summary>
+
+ public class SystemInformation {
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public static ArrangeDirection ArrangeDirection {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static ArrangeStartingPosition ArrangeStartingPosition {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static BootMode BootMode {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size Border3DSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size BorderSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size CaptionButtonSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int CaptionHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static string ComputerName {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size CursorSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool DbcsEnabled {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool DebugOS {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size DoubleClickSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int DoubleClickTime {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool DragFullWindows {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size DragSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size FixedFrameBorderSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size FrameBorderSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool HighContrast {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int HorizontalScrollBarArrowWidth {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int HorizontalScrollBarHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int HorizontalScrollBarThumbWidth {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size IconSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size IconSpacingSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int KanjiWindowHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MaxWindowTrackSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MenuButtonSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MenuCheckSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Font MenuFont {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int MenuHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool MidEastEnabled {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MinimizedWindowSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MinimizedWindowSpacingSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MinimumWindowSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size MinWindowTrackSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int MonitorCount {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool MonitorsSameDisplayFormat {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int MouseButtons {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool MouseButtonsSwapped {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool MousePresent {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool MouseWheelPresent {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int MouseWheelScrollLines {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool NativeMouseWheelSupport {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool Network {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool PenWindows {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size PrimaryMonitorMaximizedWindowSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size PrimaryMonitorSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool RightAlignedMenus {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool Secure {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool ShowSounds {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size SmallIconSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Size ToolWindowCaptionButtonSize {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int ToolWindowCaptionHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static string UserDomainName {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static bool UserInteractive {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static string UserName {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int VerticalScrollBarArrowHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int VerticalScrollBarThumbHeight {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static int VerticalScrollBarWidth {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Rectangle VirtualScreen {
+
+ get{ throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public static Rectangle WorkingArea {
+
+ get{ throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TODOAttribute.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TODOAttribute.cs
new file mode 100644
index 00000000000..bb7a1e0bb54
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TabAlignment.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabAlignment.cs
new file mode 100644
index 00000000000..20b7dfd068c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.TabAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabAlignment {
+ Bottom = 1,
+ Left = 2,
+ Right = 3,
+ Top = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TabAppearance.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabAppearance.cs
new file mode 100644
index 00000000000..2a173cebe6a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabAppearance.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.TabAppearance.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabAppearance {
+ Buttons = 1,
+ FlatButtons = 2,
+ Normal =0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TabControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabControl.cs
new file mode 100644
index 00000000000..d74ad79899e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabControl.cs
@@ -0,0 +1,532 @@
+//
+// System.Windows.Forms.TabControl
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.Collections;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class TabControl : Control {
+
+ private int selectedIndex;
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public TabControl() {
+ selectedIndex = 0;
+ }
+
+ [MonoTODO]
+ public TabAlignment Alignment {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public TabAppearance Appearance {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Rectangle DisplayRectangle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public TabDrawMode DrawMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HotTrack {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ImageList ImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Size ItemSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Multiline {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Point Padding {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int RowCount {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int SelectedIndex {
+ get {
+ return selectedIndex;
+ }
+ set {
+ selectedIndex = value;
+ }
+ }
+
+ [MonoTODO]
+ public TabPage SelectedTab {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool ShowToolTips {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public TabSizeMode SizeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int TabCount {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public TabControl.TabPageCollection TabPages {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ //FIXME: just to get it to run
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public Rectangle GetTabRect(int index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event DrawItemEventHandler DrawItem;
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "TABCONTROL";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ return new System.Drawing.Size(200,100);
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override Control.ControlCollection CreateControlsInstance() {
+ //just to get i tto run, wrong, very wrong
+ return new Control.ControlCollection(this);
+ }
+
+ [MonoTODO]
+ protected override void CreateHandle() {
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) { // .NET V1.1 Beta. .needs implmentation
+ base.Dispose(disposing);
+ }
+
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnDrawItem(DrawItemEventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnKeyDown(KeyEventArgs ke) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnResize(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelectedIndexChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnStyleChanged(EventArgs e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ProcessKeyPreview(ref Message m) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void RemoveAll() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m) {
+ throw new NotImplementedException ();
+ }
+
+ //FIXME DONT COMPILE
+// [MonoTODO]
+// public class ControlCollection {//: Control.ControlCollection {
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public override void Add(Control value) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override void Remove(Control value) {
+// throw new NotImplementedException ();
+// }
+// }
+ public class TabPageCollection : IList, ICollection, IEnumerable {
+ //
+ // --- Public Contructor
+ //
+ [MonoTODO]
+ public TabPageCollection(TabControl owner) {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual TabPage this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //--- Public Methods
+
+ [MonoTODO]
+ public void Add(TabPage value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange(TabPage[] pages) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Clear() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(TabPage page) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(TabPage page) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(TabPage value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index) {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TabDrawMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabDrawMode.cs
new file mode 100644
index 00000000000..a1e0387afb4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabDrawMode.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TabDrawMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabDrawMode {
+ Normal = 0,
+ OwnerDrawfixed =1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TabPage.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabPage.cs
new file mode 100644
index 00000000000..7cd31ea7496
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabPage.cs
@@ -0,0 +1,115 @@
+//
+// System.Windows.Forms.TabPage
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TabPage : Panel {
+
+ //
+ // --- Public Constructor
+ //
+ [MonoTODO]
+ public TabPage() {
+ //FIXME:
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override AnchorStyles Anchor {
+ get {
+ //FIXME:
+ return base.Anchor;
+ }
+ set {
+ //FIXME:
+ base.Anchor = value;
+ }
+ }
+ [MonoTODO]
+ public override DockStyle Dock {
+ get {
+ //FIXME:
+ return base.Dock;
+ }
+ set {
+ //FIXME:
+ base.Dock = value; }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public string ToolTipText {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public static TabPage GetTabPageOfComponent(object comp) {
+ //FIXME:
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString() {
+ //FIXME:
+ return base.ToString();
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override ControlCollection CreateControlsInstance() {
+ //FIXME:
+ return base.CreateControlsInstance();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ //FIXME:
+ base.SetBoundsCore(x,y,width,height,specified);
+ }
+ // FIXME dont compile
+ //[MonoTODO]
+ //public class TabPageControlCollection : Control.ControlCollection {
+ // //
+ // // --- Public Methods
+ // //
+ // public override void Add(Control value) {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TabSizeMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabSizeMode.cs
new file mode 100644
index 00000000000..b8bd053207a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TabSizeMode.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.TabSizeMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabSizeMode {
+ FillToRight = 1,
+ Fixed = 2,
+ Normal = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBox.cs
new file mode 100644
index 00000000000..21c24192b7c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBox.cs
@@ -0,0 +1,170 @@
+//
+// System.Windows.Forms.TextBox
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class TextBox : TextBoxBase {
+
+ //
+ // --- Public Constructor
+ //
+ [MonoTODO]
+ public TextBox()
+ {
+
+ }
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public bool AcceptsReturn {
+
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public CharacterCasing CharacterCasing {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public char PasswordChar {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ScrollBars ScrollBars {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public HorizontalAlignment TextAlign {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event EventHandler TextAlignChanged;
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "TEXTBOX";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ //FIXME:
+ return base.ImeMode;
+ }
+ }
+ [MonoTODO]
+ public override int SelectionLength {
+ get {
+ //FIXME:
+ return base.SelectionLength;
+ }
+ set {
+ //FIXME:
+ base.SelectionLength = value;
+ }
+ }
+
+ // --- Protected Members
+
+
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+ [MonoTODO]
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ //FIXME:
+ base.OnMouseUp(e);
+ }
+ [MonoTODO]
+ //[Lame Spec] spec says this should be virtural
+ //Spec was right!
+ protected virtual void OnTextAlignChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
new file mode 100644
index 00000000000..2bf872b2b56
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
@@ -0,0 +1,430 @@
+//
+// System.Windows.Forms.TextBoxBase
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TextBoxBase : Control {
+ private string text;
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool AcceptsTab {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public virtual bool AutoSize {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ //FIXME:
+ return base.BackColor;
+ }
+ set
+ {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get
+ {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set
+ {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool CanUndo {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get
+ {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set
+ {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+ [MonoTODO]
+ public bool HideSelection {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string[] Lines {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public virtual int MaxLength {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool Modified {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public virtual bool Multiline {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int PreferredHeight {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ReadOnly {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public virtual string SelectedText {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public virtual int SelectionLength {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int SelectionStart {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get
+ {
+ //FIXME:
+ return base.Text;
+ }
+ set
+ {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public virtual int TextLength {
+
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool WordWrap {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void AppendText(string text)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Clear()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void ClearUndo()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Copy()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Cut()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Paste()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void ScrollToCaret()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Select(int start, int length)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void SelectAll()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ [MonoTODO]
+ public void Undo()
+ {
+ //FIXME:
+ }
+
+ // --- Public Events
+
+ public event EventHandler AcceptsTabChanged;
+ public event EventHandler AutoSizeChanged;
+ public event EventHandler BorderStyleChanged;
+ //[MonoTODO]
+ //public event EventHandler Click;
+ public event EventHandler HideSelectionChanged;
+ public event EventHandler ModifiedChanged;
+ public event EventHandler MultilineChanged;
+ public event EventHandler ReadOnlyChanged;
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "BUTTONBASE";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get
+ {
+ return new Size(100,20); //Correct size
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ //FIXME:
+ base.CreateHandle();
+ }
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+ [MonoTODO]
+ protected virtual void OnAcceptsTabChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnAutoSizeChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBorderStyleChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleDestroyed(e);
+ }
+ [MonoTODO]
+ protected virtual void OnHideSelectionChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnModifiedChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnMultilineChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnReadOnlyChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ //FIXME:
+ return base.ProcessDialogKey(keyData);
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ //FIXME:
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs
new file mode 100644
index 00000000000..ff8fd533094
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.ThreadExceptionDialog
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class ThreadExceptionDialog : Form {
+
+ //
+ // --- Public Constructor
+ //
+ [MonoTODO]
+ public ThreadExceptionDialog(Exception t)
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TickStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TickStyle.cs
new file mode 100644
index 00000000000..69d32ebc238
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TickStyle.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.TickStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TickStyle {
+ Both = 3,
+ BottomRight = 2,
+ None =0,
+ TopLeft = 1,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs
new file mode 100644
index 00000000000..2eccbeb5524
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs
@@ -0,0 +1,86 @@
+//
+// System.Windows.Forms.Timer
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+using System.ComponentModel;
+ public class Timer : Component {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public Timer()
+ {
+
+ }
+ [MonoTODO]
+ public Timer(IContainer container)
+ {
+
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public virtual bool Enabled {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int Interval {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void Start()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Stop()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event EventHandler Tick;
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ protected virtual void OnTick(EventArgs e)
+ {
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs
new file mode 100644
index 00000000000..2136d286e09
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs
@@ -0,0 +1,473 @@
+//
+// System.Windows.Forms.ToolBar
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class ToolBar : Control {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public ToolBar()
+ {
+
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public ToolBarAppearance Appearance {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool AutoSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ToolBar.ToolBarButtonCollection Buttons {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size ButtonSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Divider {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override DockStyle Dock{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal bool dropDownArrows; //FIXME: Just to get it to run
+ [MonoTODO]
+ public bool DropDownArrows {
+ get {
+ return dropDownArrows;
+ }
+ set {
+ dropDownArrows = value;
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ImageList ImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size ImageSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public new ImeMode ImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override RightToLeft RightToLeft {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal bool showToolTips;//FIXME: just to get it to run
+ [MonoTODO]
+ public bool ShowToolTips {
+ get {
+ return showToolTips;
+ }
+ set {
+ showToolTips = value;
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public ToolBarTextAlign TextAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Wrappable{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event ToolBarButtonClickEventHandler ButtonClick;
+ [MonoTODO]
+ public event ToolBarButtonClickEventHandler ButtonDropDown;
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "TOOLBAR";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ base.CreateHandle();
+ }
+
+ [MonoTODO]
+ protected virtual void OnButtonClick(ToolBarButtonClickEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnButtonDropDown(ToolBarButtonClickEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ }
+ public class ToolBarButtonCollection : IList, ICollection, IEnumerable {
+ //
+ // --- Public Constructor
+ //
+ [MonoTODO]
+ public ToolBarButtonCollection(ToolBar owner)
+ {
+
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual ToolBarButton this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public int Add(string text)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Add(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void AddRange(ToolBarButton[] buttons)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Clear()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public bool Contains(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Insert(int index, ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ //[MonoTODO]
+ //public void Insert(int index, ToolBarButton button) {
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public void Remove(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs
new file mode 100644
index 00000000000..b3bd4c4753c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ToolBarAppearance.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ToolBarAppearance {
+ Flat = 1,
+ Normal = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
new file mode 100644
index 00000000000..477ca699998
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
@@ -0,0 +1,163 @@
+//
+// System.Windows.Forms.ToolBarButton
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+using System.ComponentModel;
+ public class ToolBarButton : Component {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public ToolBarButton()
+ {
+
+ }
+
+ [MonoTODO]
+ public ToolBarButton(string text)
+ {
+
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Menu DropDownMenu {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool Enabled {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int ImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public ToolBar Parent {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool PartialPush {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool Pushed {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public Rectangle Rectangle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ToolBarButtonStyle Style {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public object Tag {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public string Text {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public string ToolTipText {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool Visible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ return base.ToString();
+ }
+ //
+ // --- Protected Methods
+ //
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs
new file mode 100644
index 00000000000..7b0978ca4ba
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventArgs
+//
+// Author:
+// stubbed out by Dennis Hayes(dennish@raytek.com)
+// stub ammended by Jaak Simm (jaaksimm@firm.ee)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Summary description for ToolBarButtonClickEventArgs.
+ /// </summary>
+ [MonoTODO]
+ public class ToolBarButtonClickEventArgs : EventArgs {
+
+ #region Field
+ ToolBarButton button;
+ #endregion
+
+ #region Constructor
+ public ToolBarButtonClickEventArgs(ToolBarButton button)
+ {
+ this.button=button;
+ }
+ #endregion
+
+ #region Properties
+ public ToolBarButton Button {
+ get { return button; }
+ set { button=value; }
+ }
+ #endregion
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs
new file mode 100644
index 00000000000..ff53027261c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the ButtonClick event of a ToolBar.
+ /// </summary>
+ [Serializable]
+ public delegate void ToolBarButtonClickEventHandler(object sender, ToolBarButtonClickEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs
new file mode 100644
index 00000000000..485544ffd68
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ToolBarButtonStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ToolBarButtonStyle {
+ DropDownButton = 4,
+ PushButton = 1,
+ Separator = 3,
+ ToggleButton =2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs
new file mode 100644
index 00000000000..044ee16f4ed
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ToolBarTextAlign.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ToolBarTextAlign {
+ Right = 1,
+ Underneath = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TrackBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TrackBar.cs
new file mode 100644
index 00000000000..8078fdf47aa
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TrackBar.cs
@@ -0,0 +1,280 @@
+//
+// System.Windows.Forms.TrackBar
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TrackBar : Control, ISupportInitialize {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public TrackBar()
+ {
+
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool AutoSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+ [MonoTODO]
+ public override Font Font {
+ get {
+ //FIXME:
+ return base.Font;
+ }
+ set {
+ //FIXME:
+ base.Font = value;
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+ [MonoTODO]
+ public int LargeChange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int Maximum {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int Minimum {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Orientation Orientation {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int SmallChange {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public int TickFrequency {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public TickStyle TickStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int Value {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void SetRange(int minValue, int maxValue)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event EventHandler Scroll;
+ [MonoTODO]
+ public event EventHandler ValueChanged;
+
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "TRACKBAR";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ //FIXME:
+ return base.DefaultImeMode;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ //FIXME: replace with correct values
+ return new System.Drawing.Size(300,20);
+ }
+ }
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ //FIXME: just to get it to run
+ base.CreateHandle();
+ }
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return IsInputKey(keyData);
+ }
+ [MonoTODO]
+ protected override void OnBackColorChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnBackColorChanged(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ [MonoTODO]
+ protected virtual void OnScroll(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnMouseWheel(MouseEventArgs e) { // .NET V1.1 Beta.
+ //FIXME:
+ base.OnMouseWheel(e);
+ }
+
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ //FIXME:
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+
+ void ISupportInitialize.BeginInit(){
+ //FIXME:
+ }
+
+ void ISupportInitialize.EndInit(){
+ //FIXME:
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNode.cs
new file mode 100644
index 00000000000..635effb3a82
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNode.cs
@@ -0,0 +1,316 @@
+//
+// System.Windows.Forms.TreeNode
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class TreeNode : MarshalByRefObject, ICloneable {
+
+
+ // --- Public Constructors
+
+ [MonoTODO]
+ public TreeNode()
+ {
+
+ }
+ [MonoTODO]
+ public TreeNode(string text)
+ {
+
+ }
+ [MonoTODO]
+ public TreeNode(string text, TreeNode[] children)
+ {
+
+ }
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public Color BackColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Rectangle Bounds {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Checked {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode FirstNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color ForeColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string FullPath {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public IntPtr Handle {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Index {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsEditing {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsExpanded {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsSelected {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsVisible {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode LastNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode NextNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode NextVisibleNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public Font NodeFont {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public TreeNodeCollection Nodes {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode Parent {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode PrevNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode PrevVisibleNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectedImageIndex {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public object Tag {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public string Text {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public TreeView TreeView {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void BeginEdit()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public virtual object Clone()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Collapse()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EndEdit(bool cancel)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EnsureVisible()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Expand()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void ExpandAll()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public static TreeNode FromHandle(TreeView tree, IntPtr handle)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int GetNodeCount(bool includeSubTrees)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Remove()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Toggle()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
new file mode 100644
index 00000000000..31341e8daa5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
@@ -0,0 +1,186 @@
+//
+// System.Windows.Forms.TreeNodeCollection
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public class TreeNodeCollection : IList, ICollection, IEnumerable {
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual TreeNode this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public virtual TreeNode Add(string text)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual int Add(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void AddRange(TreeNode[] nodes)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public virtual void Clear()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public bool Contains(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Insert(int index, TreeNode node)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void Remove(TreeNode node)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public virtual void RemoveAt(int index)
+ {
+ //FIXME:
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ //FIXME:
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ //FIXME:
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ //FIXME:
+ }
+ // End Of ICollection
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs
new file mode 100644
index 00000000000..dfe231ee12f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs
@@ -0,0 +1,42 @@
+//
+// System.Windows.Forms.TreeNodeConverter
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+using System.ComponentModel;
+ public class TreeNodeConverter : TypeConverter {
+
+
+ // --- Public Constructors
+
+ [MonoTODO]
+ public TreeNodeConverter()
+ {
+ //
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ //FIXME: return types that we can convert to
+ return false;
+ }
+ [MonoTODO]
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ //FIXME: Implment our own conversion
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs
new file mode 100644
index 00000000000..70d1875423d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs
@@ -0,0 +1,506 @@
+//
+// System.Windows.Forms.TreeView
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+
+ //
+ // </summary>
+
+ public class TreeView : Control {
+
+ private int imageIndex;
+ private int selectedImageIndex;
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public TreeView()
+ {
+ imageIndex = 0;
+ selectedImageIndex = 0;
+ }
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public override Color BackColor {
+ get
+ {
+ //FIXME:
+ return base.BackColor;
+ }
+ set
+ {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get
+ {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set
+ {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool CheckBoxes {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get
+ {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set
+ {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+ [MonoTODO]
+ public bool FullRowSelect {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool HideSelection {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool HotTracking {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get
+ {
+ return imageIndex;
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public ImageList ImageList {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int Indent {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int ItemHeight {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool LabelEdit {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public TreeNodeCollection Nodes {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string PathSeparator {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool Scrollable {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public int SelectedImageIndex {
+ get
+ {
+ return selectedImageIndex;
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public TreeNode SelectedNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowLines {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowPlusMinus {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool ShowRootLines {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+ [MonoTODO]
+ public bool Sorted {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ //FIXME:
+ }
+ }
+
+ public override string Text {
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set
+ {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+ [MonoTODO]
+ public TreeNode TopNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int VisibleCount {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void BeginUpdate()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void CollapseAll()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void EndUpdate()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void ExpandAll()
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ public TreeNode GetNodeAt(Point pt)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public TreeNode GetNodeAt(int x, int y)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int GetNodeCount(bool includeSubTrees)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ //FIXME:
+ return base.ToString();
+ }
+
+ // --- Public Events
+
+ public event TreeViewEventHandler AfterCheck;
+ public event TreeViewEventHandler AfterCollapse;
+ public event TreeViewEventHandler AfterExpand;
+ public event NodeLabelEditEventHandler AfterLabelEdit;
+ public event TreeViewEventHandler AfterSelect;
+ public event TreeViewCancelEventHandler BeforeCheck;
+ public event TreeViewCancelEventHandler BeforeCollapse;
+ public event TreeViewCancelEventHandler BeforeExpand;
+ public event NodeLabelEditEventHandler BeforeLabelEdit;
+ public event TreeViewCancelEventHandler BeforeSelect;
+ public event ItemDragEventHandler ItemDrag;
+ //public new event PaintEventHandler Paint;
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "TREEVIEW";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get
+ {
+ return new Size(121,97);//Correct size.
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ //FIXME: just to get it to run
+ base.CreateHandle();
+ }
+
+
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ //FIXME:
+ return base.IsInputKey(keyData);
+ }
+ [MonoTODO]
+ protected virtual void OnAfterCheck(TreeViewEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnAfterCollapse(TreeViewEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnAfterExpand(TreeViewEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnAfterLabelEdit(NodeLabelEditEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnAfterSelect(TreeViewEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeCheck(TreeViewCancelEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeCollapse(TreeViewCancelEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeExpand(TreeViewCancelEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeLabelEdit(NodeLabelEditEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeSelect(TreeViewCancelEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleDestroyed(e);
+ }
+ [MonoTODO]
+ protected virtual void OnItemDrag(ItemDragEventArgs e)
+ {
+ //FIXME:
+ }
+ [MonoTODO]
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyDown(e);
+ }
+ [MonoTODO]
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyPress(e);
+ }
+ [MonoTODO]
+ protected override void OnKeyUp(KeyEventArgs e)
+ {
+ //FIXME:
+ base.OnKeyUp(e);
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ base.WndProc(ref m);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewAction.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewAction.cs
new file mode 100644
index 00000000000..835a79bb0c7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewAction.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.TreeViewAction.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TreeViewAction {
+ ByKeyboard = 1,
+ ByMouse = 2,
+ Collapse = 3,
+ Expand =4,
+ Unknown = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs
new file mode 100644
index 00000000000..79ede67235f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs
@@ -0,0 +1,61 @@
+//
+// System.Windows.Forms.TreeViewCancelEventArgs
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TreeViewCancelEventArgs : CancelEventArgs {
+
+ private TreeNode node;
+ private TreeViewAction action;
+ //
+ // --- Public Constructors
+ //
+ public TreeViewCancelEventArgs(TreeNode node, bool cancel, TreeViewAction action) : base(cancel)
+ {
+ this.node = node;
+ this.action = action;
+ }
+
+ #region Public Properties
+ /// <summary>
+ /// Action Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Gets the type of TreeViewAction that raised the event.
+ /// </remarks>
+ public TreeViewAction Action
+ {
+ get {
+ return action;
+ }
+ }
+
+ /// <summary>
+ /// Node Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Gets the tree node to be checked, expanded, collapsed, or selected.
+ /// </remarks>
+ public TreeNode Node
+ {
+ get {
+ return node;
+ }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs
new file mode 100644
index 00000000000..01825016296
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TreeViewCancelEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the BeforeCheck,
+ /// BeforeCollapse, BeforeExpand, or BeforeSelect event of a TreeView.
+ /// </summary>
+ [Serializable]
+ public delegate void TreeViewCancelEventHandler(object sender, TreeViewCancelEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs
new file mode 100644
index 00000000000..d84cca5ca12
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs
@@ -0,0 +1,44 @@
+//
+// System.Windows.Forms.TreeViewEventArgs
+//
+// Author:
+// Stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Completed by Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TreeViewEventArgs : EventArgs {
+ private TreeNode node;
+ private TreeViewAction action;
+ //
+ // --- Public Constructors
+ //
+ public TreeViewEventArgs(TreeNode node)
+ {
+ this.node = node;
+ }
+ public TreeViewEventArgs(TreeNode node, TreeViewAction action)
+ {
+ this.node = node;
+ this.action = action;
+ }
+ //
+ // --- Public Properties
+ //
+ public TreeViewAction Action {
+ get {
+ return action;
+ }
+ }
+ public TreeNode Node {
+ get {
+ return node;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs
new file mode 100644
index 00000000000..934114c902a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TreeViewEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the
+ /// AfterCheck, AfterCollapse, AfterExpand, or AfterSelect event of a TreeView.
+ /// </summary>
+ [Serializable]
+ public delegate void TreeViewEventHandler(object sender, TreeViewEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs
new file mode 100644
index 00000000000..c2f8f1c48dd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs
@@ -0,0 +1,38 @@
+//
+// System.Windows.Forms.TreeViewImageIndexConverter
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TreeViewImageIndexConverter : ImageIndexConverter {
+
+
+ // --- Public Constructors
+
+ [MonoTODO]
+ public TreeViewImageIndexConverter()
+ {
+
+ }
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override bool IncludeNoneAsStandardValue {
+ get
+ {
+ //FIXME:
+ return base.IncludeNoneAsStandardValue;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UICues.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICues.cs
new file mode 100644
index 00000000000..32b540a3591
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICues.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.UICues.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ // Specifies the state of the user interface
+ [Flags]
+ public enum UICues
+ {
+ Changed = 12, // The state of the focus cues and keyboard cues has changed.
+ ChangeFocus = 4, // The state of the focus cues has changed.
+ ChangeKeyboard = 8, // The state of the keyboard cues has changed.
+ None = 0, // No change was made.
+ ShowFocus = 1, // Focus rectangles are displayed after the change.
+ ShowKeyboard = 2, // Keyboard cues are underlined after the change.
+ Shown = 3, // Focus rectangles are displayed and keyboard cues are underlined
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs
new file mode 100644
index 00000000000..52369bf4c05
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs
@@ -0,0 +1,73 @@
+//
+// System.Windows.Forms.UICuesEventArgs
+//
+// Author:
+// stubbed out by Stefan Warnke (StefanW@POBox.com)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+
+ /// <summary>
+ /// UICuesEventArgs specifies which user interface feature changed and its new value.
+ /// </summary>
+ public class UICuesEventArgs : EventArgs {
+
+ private UICues uicues;
+
+// /// --- Constructor ---
+
+ public UICuesEventArgs(UICues uicues)
+ {
+ this.uicues = uicues;
+ }
+
+ /// --- Public Properties ---
+ #region Public Properties
+
+ // Gets the bitwise combination of the UICues values
+ public UICues Changed {
+ get {
+ return uicues;
+ }
+ }
+
+ // Gets a value indicating whether the state of the focus cues has changed.
+ public bool ChangeFocus {
+ get {
+ return (uicues & UICues.ChangeFocus) == 0;
+ }
+ }
+
+ // Gets a value indicating whether the state of the keyboard cues has changed
+ public bool ChangeKeyboard {
+ get {
+ return (uicues & UICues.ChangeKeyboard) == 0;
+ }
+ }
+
+ // Gets a value indicating whether focus rectangles are shown after the change
+ public bool ShowFocus {
+ get {
+ return (uicues & UICues.ShowFocus) == 0;
+ }
+ }
+
+ // Gets a value indicating whether keyboard cues are underlined after the change
+ public bool ShowKeyboard {
+ get {
+ return (uicues & UICues.ShowKeyboard) == 0;
+
+ }
+ }
+ #endregion // Public Properties
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs
new file mode 100644
index 00000000000..3dace600070
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.UICuesEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a method that will handle the ChangeUICues event of a Control.
+ /// </summary>
+ public delegate void UICuesEventHandler(object sender, UICuesEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs
new file mode 100644
index 00000000000..ca1d8aa4ccb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs
@@ -0,0 +1,356 @@
+//
+// System.Windows.Forms.UpDownBase
+//
+// Author:
+// stubbed out by Stefan Warnke (StefanW@POBox.com)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+
+ /// <summary>
+ /// The up-down control consists of a text box and a small vertical scroll
+ /// bar, commonly referred to as a spinner control.
+ /// </summary>
+ public abstract class UpDownBase : ContainerControl {
+
+ //UpDownBase+ButtonID
+ enum ButtonID
+ {
+ Down = 2,
+ None = 0,
+ Up = 1
+ }
+
+ /// --- Constructor ---
+ public UpDownBase()
+ {
+
+ }
+
+ /// --- Destructor ---
+
+ /// --- Public Properties ---
+ #region Public Properties
+ // Gets or sets the background color for the control
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ //FIXME:
+ }
+ set {
+ //FIXME:
+ base.BackColor = value;
+ }
+ }
+
+ // Gets or sets the background image displayed in the control
+ public override Image BackgroundImage {
+ get {
+ //FIXME:
+ return base.BackgroundImage;
+ }
+ set {
+ //FIXME:
+ base.BackgroundImage = value;
+ }
+ }
+
+ // Gets or sets the border style for the up-down control
+ public BorderStyle BorderStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // Gets or sets the shortcut menu associated with the control
+ public override ContextMenu ContextMenu {
+ get {
+ //FIXME:
+ return base.ContextMenu;
+ }
+ set {
+ //FIXME:
+ base.ContextMenu = value;
+ }
+ }
+
+ // Gets a value indicating whether the control has input focus
+ public override bool Focused {
+ get {
+ //FIXME:
+ return base.Focused;
+ }
+ }
+
+ // Gets or sets the foreground color of the control
+ public override Color ForeColor {
+ get {
+ //FIXME:
+ return base.ForeColor;
+ }
+ set {
+ //FIXME:
+ base.ForeColor = value;
+ }
+ }
+
+ // Gets or sets a value indicating whether the user can use the
+ // UP ARROW and DOWN ARROW keys to select values
+ public bool InterceptArrowKeys {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // Gets the height of the up-down control
+ public int PreferredHeight {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // Gets or sets a value indicating whether the text may be
+ // changed by the use of the up or down buttons only
+ public bool ReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // Gets or sets the site of the control.
+ public override ISite Site {
+ get {
+ //FIXME:
+ return base.Site;
+ }
+ set {
+ //FIXME:
+ base.Site = value;
+ }
+ }
+
+ // Gets or sets the text displayed in the up-down control
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ // Gets or sets the alignment of the text in the up-down control
+ public HorizontalAlignment TextAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // Gets or sets the alignment of the up and down buttons on the
+ // up-down control
+ public LeftRightAlignment UpDownAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ #endregion // Public Properties
+
+
+ /// --- Public Methods ---
+ #region Public Methods
+
+ // When overridden in a derived class, handles the pressing of the down
+ // button on the up-down control.
+ public abstract void DownButton();
+
+ // Selects a range of text in the up-down control specifying the
+ // starting position and number of characters to select.
+ public void Select(int start,int length)
+ {
+ //FIXME:
+ }
+
+ // When overridden in a derived class, handles the pressing of
+ // the up button on the up-down control
+ public abstract void UpButton();
+
+ #endregion // Public Methods
+
+
+ /// --- Protected Properties ---
+ #region Protected Properties
+
+ // Gets or sets a value indicating whether the text property is being
+ // changed internally by its parent class
+ protected bool ChangingText {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // Gets the required creation parameters when the control handle is created
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "UPDOWNBASE";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ // createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ // Gets the default size of the control.
+ protected override Size DefaultSize {
+ get {
+ return new System.Drawing.Size(100,20);
+ }
+ }
+
+ // Gets or sets a value indicating whether a value has been entered by the user
+ protected bool UserEdit {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+ #endregion // Protected Properties
+
+
+ /// --- Protected Methods ---
+ #region Protected Methods
+
+ // Raises the FontChanged event
+ protected override void OnFontChanged(EventArgs e)
+ {
+ //FIXME:
+ base.OnFontChanged(e);
+ }
+
+ // Raises the HandleCreated event
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ //FIXME:
+ base.OnHandleCreated(e);
+ }
+
+ // Raises the Layout event
+ protected override void OnLayout(LayoutEventArgs e)
+ {
+ //FIXME:
+ base.OnLayout(e);
+ }
+
+ // Raises the MouseWheel event
+ protected override void OnMouseWheel(MouseEventArgs e)
+ {
+ //FIXME:
+ }
+
+ // Raises the KeyDown event
+ protected virtual void OnTextBoxKeyDown(object source, KeyEventArgs e)
+ {
+ //FIXME:
+ }
+
+ // Raises the KeyPress event
+ protected virtual void OnTextBoxKeyPress(object source, KeyPressEventArgs e)
+ {
+ //FIXME:
+ }
+
+ // Raises the LostFocus event
+ protected virtual void OnTextBoxLostFocus(object source, EventArgs e)
+ {
+ //FIXME:
+ }
+
+ // Raises the Resize event
+ protected virtual void OnTextBoxResize(object source, EventArgs e)
+ {
+ //FIXME:
+ }
+
+ // Raises the TextChanged event.
+ protected virtual void OnTextBoxTextChanged(object source, EventArgs e)
+ {
+ //FIXME:
+ }
+
+ // This member overrides Control.SetBoundsCore.
+ protected override void SetBoundsCore(int x, int y, int width,
+ int height, BoundsSpecified specified) {
+
+ //FIXME:
+ }
+
+ // When overridden in a derived class, updates the text displayed in the
+ // up-down control
+ protected abstract void UpdateEditText();
+
+ // When overridden in a derived class, validates the text displayed in the
+ // up-down control
+ protected virtual void ValidateEditText()
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+
+ //FIXME shoould this be (ref message m)??
+ protected virtual void WndProc(Message m) { // .NET V1.1 Beta
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool Disposing) { // .NET V1.1 Beta
+ base.Dispose(Disposing);
+ }
+
+ #endregion // Protected Methods
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs
new file mode 100644
index 00000000000..cb59cf0c2c1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.UpDownEventArgs
+//
+// Author:
+// stubbed out by Dennis Hayes(dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Summary description for UpDownEventArgs.
+ /// </summary>
+ public class UpDownEventArgs : EventArgs {
+ private int buttonID;
+
+ public UpDownEventArgs(int buttonPushed){
+ buttonID = buttonPushed;
+ }
+
+ public int ButtonID {
+ get {
+ return buttonID;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs
new file mode 100644
index 00000000000..d805338ce0f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.UpDownEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// This type supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ /// </summary>
+ [Serializable]
+ public delegate void UpDownEventHandler(object source, UpDownEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UserControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UserControl.cs
new file mode 100644
index 00000000000..3c8b9596250
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UserControl.cs
@@ -0,0 +1,73 @@
+//
+// System.Windows.Forms.UpDownEventHandler.cs
+//
+// Authors:
+// //unknown
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class UserControl : ContainerControl{
+
+ // --- Properties ---
+ [MonoTODO]
+ protected override Size DefaultSize {
+
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ public override string Text {
+
+ get {
+ //FIXME:
+ return base.Text;
+ }
+ set {
+ //FIXME:
+ base.Text = value;
+ }
+ }
+
+ // --- Constructor ---
+ [MonoTODO]
+ public UserControl()
+ {
+
+ }
+
+ // --- Methods ---
+ [MonoTODO]
+ protected override void OnCreateControl()
+ {
+ //FIXME:
+ base.OnCreateControl();
+ }
+
+ [MonoTODO]
+ protected virtual void OnLoad(EventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ //FIXME:
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ //FIXME:
+ }
+
+ // --- Events ---
+ public event EventHandler Load;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/VScrollBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/VScrollBar.cs
new file mode 100644
index 00000000000..9eb6813bc24
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/VScrollBar.cs
@@ -0,0 +1,71 @@
+//
+// System.Windows.Forms.StructFormat.cs
+//
+// Author:
+// John Rebbeck <john@rebent.com>
+// Dennis Hayes (dennish@Raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class VScrollBar : ScrollBar {
+
+ private RightToLeft rightToLeft;
+ // --- Properties ---
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ createParams.Caption = "";
+ createParams.ClassName = "VSCROLL";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+
+ //if (parent != null)
+ // createParams.Parent = parent.Handle;
+ //else
+ createParams.Parent = (IntPtr) 0;
+
+ createParams.Style = (int) WindowStyles.WS_OVERLAPPEDWINDOW;
+
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ //Set to Microsoft Default
+ return new Size(16,80);
+ }
+ }
+
+ [MonoTODO]
+ public override RightToLeft RightToLeft {
+
+ get {
+ return rightToLeft;
+ }
+ set {
+ rightToLeft = value;
+ //FixMe: invalidate to force redraw.
+ //Invalidate();
+ }
+ }
+
+ // --- Constructor ---
+ [MonoTODO]
+ public VScrollBar()
+ {
+ rightToLeft = RightToLeft.Inherit;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/View.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/View.cs
new file mode 100644
index 00000000000..4492e381387
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/View.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.View.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum View {
+ Details = 1,
+ LargeIcon = 0,
+ List = 3,
+ SmallIcon = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj b/mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj
new file mode 100644
index 00000000000..80216f7ca9d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj
@@ -0,0 +1,1013 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{27FD2668-67DD-4B30-8D2F-156B1EDD4F88}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "WINELib"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "WINELib"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
+ />
+ <Reference
+ Name = "Accessibility"
+ AssemblyName = "Accessibility"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\Accessibility.dll"
+ />
+ <Reference
+ Name = "System.Windows.Forms.Design"
+ Project = "{EF89E643-02F5-4E97-9353-3C92F209EB47}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AccessibleEvents.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleNavigation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleRole.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleSelection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleStates.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AnchorStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Application.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ApplicationContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BaseCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Binding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingManagerBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingMemberInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BoundsSpecified.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Button.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ButtonBase.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CheckState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColorDepth.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComVisible.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContainerControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContentsResizedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContentsResizedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContextMenu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Control.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Control.resx"
+ DependentUpon = "Control.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "ControlBindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConvertEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConvertEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CreateParams.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Cursor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateBoldEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateRangeEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateRangeEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DialogResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DockStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragDropEffects.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ErrorIconAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FlatStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Font.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormStartPosition.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormTest.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormWindowState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GiveFeedbackEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GiveFeedbackEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HorizontalAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IAccessible.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IButtonControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IContainerControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IDataObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageList.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageListStreamer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IMessageFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangingEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangingEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemCheckEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemCheckEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWin32Window.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWindowTarget.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyPressEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyPressEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Keys.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Label.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LayoutEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LayoutEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LeftRightAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkArea.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkBehavior.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabelLinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabelLinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListViewAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MainMenu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MdiLayout.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MeasureItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MeasureItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Menu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MenuItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Message.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxDefaultButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxIcon.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxOptions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NativeWindow.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NativeWindowTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NavigateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NavigateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NodeLabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NodeLabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PaintEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PaintEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTabChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTabChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyValueChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyValueChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryAccessibilityHelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryAccessibilityHelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryContinueDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryContinueDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RightToLeft.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollableControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectedGridItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectedGridItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SizeGripStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SplitterEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SplitterEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarDrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarDrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelAutoSize.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Test.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarAppearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButton.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarTextAlign.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "tooltip.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNodeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeView.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewCancelEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewCancelEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICues.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICuesEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICuesEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Win32.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj.user b/mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj.user
new file mode 100644
index 00000000000..e31ed2b1364
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/WINELib.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/day.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/day.cs
new file mode 100644
index 00000000000..7f401f6f838
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/day.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.Day.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum Day {
+ Default = 7,
+ Friday = 4,
+ Monday = 0,
+ Saturday = 5,
+ Sunday = 6,
+ Thursday = 3,
+ Tuesday = 1,
+ Wednesday = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile b/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile
new file mode 100644
index 00000000000..a2f1560d9fa
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/makefile
@@ -0,0 +1,56 @@
+CSC=mcs
+X11R6_INCLUDE=/usr/X11R6/include
+WINE_INCLUDE=/usr/include/wine
+WINE_LIB=/usr/lib/wine
+GLIB20_INCLUDE=`pkg-config --cflags glib-2.0` `pkg-config --cflags gmodule-2.0`
+GLIB20_LIB=`pkg-config --libs glib-2.0` `pkg-config --libs gmodule-2.0`
+# GLIB20_LIB_INCLUDE=/usr/lib/glib-2.0/include
+LIBMONO=/mono/lib/libmono.a
+
+all: monostub.exe.so System.Windows.Forms.dll NativeWindowTest.exe \
+ FormTest.exe Test.exe
+
+##########################################################################
+# build the mono stub application
+monostub.exe.so: monostub.o monostub.exe.spec.o monostub.exe.dbg.o
+ gcc -shared -Wl,-Bsymbolic -D_REENTRANT -DWINELIB -o monostub.exe.so \
+ monostub.exe.spec.o \
+ monostub.o monostub.exe.dbg.o -I/usr/local/include \
+ $(GLIB20_INCUDE) -L/usr/lib \
+ $(LIBMONO) -lgc \
+ -lwine -lntdll.dll $(GLIB20_LIB) -lm -lpthread
+
+clean:
+ rm *.o monostub.exe.dbg.c monostub.exe.spec.c monostub.exe.so *.exe *.dll
+
+monostub.o: monostub.c
+ gcc -c -I. -I$(WINE_INCLUDE) $(GLIB20_INCLUDE) -g -O2 -Wall -I$(X11R6_INCLUDE) -D_REENTRANT -DWINELIB -o monostub.o monostub.c
+
+monostub.exe.tmp.o: monostub.o
+ ld -r monostub.o -o monostub.exe.tmp.o
+ strip --strip-unneeded monostub.exe.tmp.o
+
+monostub.exe.spec.c: monostub.exe.tmp.o
+ winebuild -sym monostub.exe.tmp.o -o monostub.exe.spec.c -exe monostub.exe -mgui -L$(WINE_LIB) -lcomdlg32 -lshell32 -luser32 -lgdi32 -lkernel32
+
+monostub.exe.spec.o: monostub.exe.spec.c
+ gcc -c -I. -I. -I$(WINE_INCLUDE) -g -O2 -I$(X11R6_INCLUDE) -D_REENTRANT -DWINELIB -o monostub.exe.spec.o monostub.exe.spec.c
+
+monostub.exe.dbg.c: monostub.exe.spec.o
+ winebuild -o monostub.exe.dbg.c -debug -C. monostub.c
+
+monostub.exe.dbg.o: monostub.exe.dbg.c
+ gcc -c -I. -I. -I$(WINE_INCLUDE) -g -O2 -I$(X11R6_INCLUDE) -D_REENTRANT -DWINELIB -o monostub.exe.dbg.o monostub.exe.dbg.c
+
+##########################################################################
+# build System.Windows.Forms.dll and test/sample applications
+
+Test.exe: Test.cs
+ $(CSC) Test.cs
+
+NativeWindowTest.exe: NativeWindowTest.cs System.Windows.Forms.dll
+ $(CSC) -r System.Windows.Forms.dll NativeWindowTest.cs
+
+FormTest.exe: FormTest.cs System.Windows.Forms.dll
+ $(CSC) -r System.Windows.Forms.dll FormTest.cs
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/monostub.c b/mcs/class/System.Windows.Forms/System.Windows.Forms/monostub.c
new file mode 100644
index 00000000000..03e47bdb3df
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/monostub.c
@@ -0,0 +1,113 @@
+#include <mono/jit/jit.h>
+#include <stdio.h>
+
+//
+// The Mono and WINE header files have overlapping definitions in the
+// header files. Since we are only using a few functions and definitions
+// define them here to avoid conflicts.
+//
+// these are defined in jit.h
+// typedef long LONG;
+// typedef unsigned long DWORD;
+// typedef unsigned short WORD;
+// typedef UINT HANDLE;
+// typedef HINSTANCE HMODULE;
+
+#define __stdcall __attribute__((__stdcall__))
+#define CALLBACK __stdcall
+#define WINAPI __stdcall
+#define PASCAL __stdcall
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef char CHAR;
+typedef CHAR *LPSTR;
+typedef const CHAR *LPCSTR;
+
+typedef UINT WPARAM;
+typedef LONG LPARAM;
+typedef LONG LRESULT;
+typedef WORD ATOM;
+
+typedef void* HWND;
+typedef void* HINSTANCE;
+typedef void* HICON;
+typedef void* HCURSOR;
+typedef void* HBRUSH;
+
+typedef LRESULT (CALLBACK *WNDPROC) (HWND, UINT, WPARAM, LPARAM);
+
+typedef struct
+{
+ UINT style;
+ WNDPROC lpfnWndProc;
+ INT cbClsExtra;
+ INT cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCSTR lpszMenuName;
+ LPCSTR lpszClassName;
+} WNDCLASSA;
+
+ATOM WINAPI RegisterClassA (const WNDCLASSA *);
+HMODULE WINAPI GetModuleHandleA (LPCSTR);
+INT WINAPI MessageBoxExA (HWND, LPCSTR, LPCSTR, UINT, WORD);
+
+HINSTANCE applicationInstance = NULL;
+
+// register WNDCLASS for use in embeded application, this is a work around
+// for Bugzilla item #29548
+int PASCAL MonoRegisterClass (UINT style, WNDPROC lpfnWndProc, INT cbClsExtra,
+ INT cbWndExtra, HINSTANCE hInstance, HICON hIcon,
+ HCURSOR hCursor, HBRUSH hbrBackground,
+ LPCSTR lpszMenuName, LPCSTR lpszClassName)
+{
+ WNDCLASSA wc;
+ int retval = 0;
+
+ wc.lpszClassName = lpszClassName;
+ wc.lpfnWndProc = lpfnWndProc;
+ wc.style = style;
+ wc.hInstance = applicationInstance;
+ wc.hIcon = hIcon;
+ wc.hCursor = hCursor;
+ wc.hbrBackground = hbrBackground;
+ wc.lpszMenuName = lpszMenuName;
+ wc.cbClsExtra = cbClsExtra;
+ wc.cbWndExtra = cbWndExtra;
+
+ retval = RegisterClassA (&wc);
+
+ return retval;
+}
+
+int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpszCmdLine, int nCmdShow)
+{
+ MonoDomain *domain = NULL;
+ MonoAssembly *assembly = NULL;
+ int retval = 0;
+
+ applicationInstance = hInstance;
+
+ printf ("initializing JIT engine\n");
+ domain = mono_jit_init (lpszCmdLine);
+
+ printf ("opening assembly\n");
+ assembly = mono_domain_assembly_open (domain, lpszCmdLine);
+
+ if (!assembly){
+ printf("error opening assembly\n");
+ return 1;
+ }
+
+ printf ("executing assembly\n");
+ retval = mono_jit_exec (domain, assembly, 0, 0);
+
+ printf ("calling JIT cleanup\n");
+ mono_jit_cleanup (domain);
+
+ return retval;
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog b/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog
new file mode 100644
index 00000000000..38cf0dceda6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ochangelog
@@ -0,0 +1,193 @@
+ 2002-10-18 DennisHayes <dennish@raytek.com>
+
+ * Application.cs
+ * ContainerControl.cs
+ * Control.cs
+ * Form.cs
+ * Label.cs
+
+ * Added //Compact Framework comment to members that belong.
+ * A CE subset of SWF might not be that difficult to reach.
+ * John has already completed *Most* of the CE members in these files.
+ *
+ * also added a couple of members that seem to have not been
+ s stubbed, hope I did not break the build, unable to test
+
+ 2002-10-13 John Sohn <jsohn@columbus.rr.com>
+ * Button.cs:
+ * Label.cs:
+ * Control.cs:
+ * Form.cs: fixed location of elements on Form
+ * FormTest.cs: changed location of Label and Button on Form
+
+ 2002-10-12 John Sohn <jsohn@columbus.rr.com>
+ * ButtonBase.cs:
+ * Button.cs: initial implementation of Button class
+ * FormTest.cs: added Button to form
+ * makefile: added Button.cs and ButtonBase.cs to makefile
+
+ 2002-10-12 John Sohn <jsohn@columbus.rr.com>
+ * Control.cs:
+ * Label.cs: changed CreateHandle method to use CreateParams property
+ * README: added instructions for building and using project
+ * makefile: removed monostart.c from makefile
+ * monostart.c:
+ * test.sh
+ * build.sh: no longer used, removed
+
+ 2002-9-29 John Sohn <jsohn@columbus.rr.com>
+ * Form.cs: Site property now calls base class
+ * FormTest.cs: set label position on test form
+ * Label.cs: implemented more methods
+ * makefile: stub no longer links to gc library
+
+ 2002-9-24 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs: Run method now creates the Form
+ * ContainerControl.cs: no implementation but made sure overridden
+ methods call the base class
+ * Control.cs: Implemented several more methods in the implementation
+ of this class. Implemented ControlCollection, allowing controls
+ to be added and removed from the Form.
+ * Form.cs: Implemented more methods of the Form class
+ * FormTest.cs: Added code to draw and display a Label
+ * Label.cs: Initial implementation of Label class. The Label can
+ be added and displayed on a Form.
+ * NativeWindow.cs: modified debugging (console) output
+ * ScrollableControl.cs: no implementation but made sure overridden
+ methods call the base class
+ * Win32.cs: added more Win32 imports and definitions
+ * monostub.c: now store the application HINSTANCE
+ * makefile: added Label.cs to makefile
+
+ 2002-9-16 John Sohn <jsohn@columbus.rr.com>
+ * Control.cs:
+ * ScrollableControl.cs
+ * Form.cs: added Win32 implementation to more methods and properties
+ * MessageBox.cs: fixed typo
+ * makefile: now using pkg-config for including and linking glib
+
+ 2002-9-3 John Sohn <jsohn@columbus.rr.com>
+ * Control.cs: mapped more of the functions to the Win32 API
+ * Win32.cs: added more Win32 imports and definitions
+
+ 2002-9-1 John Sohn <jsohn@columbus.rr.com>
+ * MessageBox.cs: added mostly complete implementation of the
+ MessageBox class
+ * Application.cs: completed implementation of Run methods, implemented
+ message handler functionality
+ * Form.cs: implemented the Close event, allows the Application class to
+ receive notification for shutting down the application
+ * FormTest.cs: added additional functionality to test most methods
+ currently implemented in the Application and Form class
+ * NativeWindowTest.cs: fixed methods which received the MSG structure,
+ previously was using an integer type instead of the struct
+ * Win32.cs: added more Win32 imports and definitions
+ * makefile: added the MessageBox.cs class to the build
+
+ 2002-8-30 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs: removed _ApplicationWndProc, we no longer need to
+ have the WndProc callback in the stub application
+ * Control.cs: use new registered class, implemented WndProc
+ functionality
+ * NativeWindow.cs: Now using the WndProc handler again. The window
+ class is now registered in C# code instead of the helper function
+ in the stub shared library.
+ * NativeWindowTest.cs: using the new registered class
+ * Win32.cs: added more Win32 definitions, added DllImport and helper
+ function in stub application to register the window class.
+ * monostart.c: no longer being used, tagged for deletion. no longer
+ registering the class and WNDPROC inside the stub application
+ * monostub.c: Simplified the stub application and am now registering
+ the window class and WNDPROC callback in C# code. This is now the only
+ file that is used in the stub application. In order to simplify the
+ code the #include <windows.h> was removed due to overlap with the
+ jit.h include file but some definitions from windows.h are included
+ in this file. WinMain and MonoRegisterClass are the only functions
+ that exist in this file and application.
+ * makefile: removed monostart.c from the build, added Test.exe to
+ the build
+
+ 2002-8-21 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs:
+ * Control.cs:
+ * Form.cs:
+ * NativeWindow.cs:
+ * NativeWindowTest.cs: updated code to build on latest mcs in cvs
+
+ 2002-8-21 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs:
+ * NativeWindow.cs:
+ * NativeWindowTest.cs: compliant with new DllImports in Win32.cs
+ * makefile: correctly links libmono.a
+
+ 2002-8-20 John Sohn <jsohn@columbus.rr.com>
+ * Win32.cs: now uses correct Win32 imports and defs. Fixed file provded
+ by Dennis Hayes (dennish@raytek.com)
+ * Application.cs: fixed Win32 API calls
+ * Control.cs: commented out functions which broked build
+ but are not currently implemented
+ * DrawItemEventHandler.cs:
+ * MenuItem.cs: added empty classes that allows build to continue
+ without commenting out references to them in the source
+ * NativeWindow.cs: fixed Win32 API calls
+
+ 2002-8-19 John Sohn <jsohn@columbus.rr.com>
+ * monostart.c: fixed link from monostub WndProc to Application
+ class WndProc
+ * FormTest.cs: test of class NOT derived from the Form class
+
+ 2002-8-18 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs:
+ * ContainerControl.cs:
+ * Control.cs:
+ * Form.cs:
+ * FormTest.cs:
+ * NativeWindow.cs:
+ * NativeWindowTest.cs:
+ * ScrollableControl.cs:
+ * Win32.cs: Updated to better conform to Mono coding conventions
+
+ 2002-8-16 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs: start of implementation, implements Run(Form) and
+ handles WndProc as called from monostub WINE application
+ * Font.cs: empty class that allows code with references to
+ Font to compile
+ * IContainerControl.cs: empty class the allows code with references to
+ IContainerControl to compile
+ * ContainerControl.cs: start of implementation, a base class of Form
+ * Form.cs: start of implementation, converts most messages to
+ appropriate On handlers
+ * NativeWindow.cs: almost complete implementation of NativeWindow class
+ * Win32.cs: central point for DllImport and WineLib defs
+ * Control.cs: start of implementation, a base class of Form
+ * DrawItemEventArgs.cs - empty class the allows code with references
+ to DrawItemEventArgs to compile
+ * IAccessible.cs - empty class the allows code with references to
+ IAccessible to compile
+ * ScrollableControl.cs: start of implementation, a base class of Form
+ * FormTest.cs - test application for the Form class
+ * NativeWindowTest.cs - test application for the NativeWindowTest
+ * monostub.c - added WNDCLASS registration
+ * monosart.c - added WndProc handler for messages, dispatch messages
+ to C# code using Mono embedded API
+ * makefile - Now uses a real makefile to build monostub.exe.so,
+ System.Windows.Forms, and test applications. Based on the makefile
+ used in the Gtk target of Windows.Forms. The build.sh script is
+ no longer maintained.
+
+ 2002-8-7 DennisHayes <dennish@raytek.com>
+
+ * Started changelog
+
+ 2002-8-4 DennisHayes <dennish@raytek.com>
+ Checked in for John Sohn <jsohn@columbus.rr.com
+
+ * build.sh
+ * changelog
+ * monostart.c
+ * monostub.c
+ * monostub.exe.dbg.c
+ * monostub.exe.spec.c
+ * Test.cs
+ * test.sh
+ * Experiment to get first form working using WINELIB
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/tooltip.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/tooltip.cs
new file mode 100644
index 00000000000..9ce182c0eca
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/tooltip.cs
@@ -0,0 +1,122 @@
+//
+// System.Windows.Forms.ToolTip
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ //
+ // </summary>
+
+ public sealed class ToolTip : Component, IExtenderProvider {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public ToolTip() {
+
+ }
+
+ [MonoTODO]
+ public ToolTip(IContainer cont) {
+
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool Active {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int AutomaticDelay {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int AutoPopDelay{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int InitialDelay {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public int ReshowDelay {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ [MonoTODO]
+ public bool ShowAlways {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ //FIXME:
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void RemoveAll() {
+ //FIXME:
+ }
+ [MonoTODO]
+ public void SetToolTip(Control control, string caption) {
+ //FIXME:
+ }
+ [MonoTODO]
+ public override string ToString() {
+ //FIXME:
+ return base.ToString();
+ }
+ //
+ // --- Protected Methods
+ //
+
+ [MonoTODO]
+ ~ToolTip() {
+
+ }
+ bool IExtenderProvider.CanExtend(object extendee){
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs
new file mode 100644
index 00000000000..9c0617d6524
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Enums.cs
@@ -0,0 +1,2127 @@
+/*
+ * Copyright (C) 5/11/2002 Carlos Harvey Perez
+ *
+ * Minor additons for project Mono by
+ * John Sohn (jsohn@columbus.rr.com)
+ * Dennis Hayes (dennish@raytek.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.
+ * IN NO EVENT SHALL CARLOS HARVEY PEREZ BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Carlos Harvey Perez
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from Carlos Harvey Perez.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using System.Drawing;
+
+
+//namespace UtilityLibrary.Win32
+namespace System.Windows.Forms{
+ /// <summary>
+ /// Window API enumerations
+ /// </summary>
+
+ #region Peek Message Flags
+ internal enum PeekMessageFlags
+ {
+ PM_NOREMOVE = 0,
+ PM_REMOVE = 1,
+ PM_NOYIELD = 2
+ }
+ #endregion
+
+ #region Windows Messages
+ public enum Msg
+ {
+ WM_NULL = 0x0000,
+ WM_CREATE = 0x0001,
+ WM_DESTROY = 0x0002,
+ WM_MOVE = 0x0003,
+ WM_SIZE = 0x0005,
+ WM_ACTIVATE = 0x0006,
+ WM_SETFOCUS = 0x0007,
+ WM_KILLFOCUS = 0x0008,
+// public const uint WM_SETVISIBLE = 0x0009;
+ WM_ENABLE = 0x000A,
+ WM_SETREDRAW = 0x000B,
+ WM_SETTEXT = 0x000C,
+ WM_GETTEXT = 0x000D,
+ WM_GETTEXTLENGTH = 0x000E,
+ WM_PAINT = 0x000F,
+ WM_CLOSE = 0x0010,
+ WM_QUERYENDSESSION = 0x0011,
+ WM_QUIT = 0x0012,
+ WM_QUERYOPEN = 0x0013,
+ WM_ERASEBKGND = 0x0014,
+ WM_SYSCOLORCHANGE = 0x0015,
+ WM_ENDSESSION = 0x0016,
+// public const uint WM_SYSTEMERROR = 0x0017;
+ WM_SHOWWINDOW = 0x0018,
+ WM_CTLCOLOR = 0x0019,
+ WM_WININICHANGE = 0x001A,
+ WM_SETTINGCHANGE = 0x001A,
+ WM_DEVMODECHANGE = 0x001B,
+ WM_ACTIVATEAPP = 0x001C,
+ WM_FONTCHANGE = 0x001D,
+ WM_TIMECHANGE = 0x001E,
+ WM_CANCELMODE = 0x001F,
+ WM_SETCURSOR = 0x0020,
+ WM_MOUSEACTIVATE = 0x0021,
+ WM_CHILDACTIVATE = 0x0022,
+ WM_QUEUESYNC = 0x0023,
+ WM_GETMINMAXINFO = 0x0024,
+ WM_PAINTICON = 0x0026,
+ WM_ICONERASEBKGND = 0x0027,
+ WM_NEXTDLGCTL = 0x0028,
+// public const uint WM_ALTTABACTIVE = 0x0029;
+ WM_SPOOLERSTATUS = 0x002A,
+ WM_DRAWITEM = 0x002B,
+ WM_MEASUREITEM = 0x002C,
+ WM_DELETEITEM = 0x002D,
+ WM_VKEYTOITEM = 0x002E,
+ WM_CHARTOITEM = 0x002F,
+ WM_SETFONT = 0x0030,
+ WM_GETFONT = 0x0031,
+ WM_SETHOTKEY = 0x0032,
+ WM_GETHOTKEY = 0x0033,
+// public const uint WM_FILESYSCHANGE = 0x0034;
+// public const uint WM_ISACTIVEICON = 0x0035;
+// public const uint WM_QUERYPARKICON = 0x0036;
+ WM_QUERYDRAGICON = 0x0037,
+ WM_COMPAREITEM = 0x0039,
+// public const uint WM_TESTING = 0x003a;
+// public const uint WM_OTHERWINDOWCREATED = 0x003c;
+ WM_GETOBJECT = 0x003D,
+// public const uint WM_ACTIVATESHELLWINDOW = 0x003e;
+ WM_COMPACTING = 0x0041,
+ WM_COMMNOTIFY = 0x0044 ,
+ WM_WINDOWPOSCHANGING = 0x0046,
+ WM_WINDOWPOSCHANGED = 0x0047,
+ WM_POWER = 0x0048,
+ WM_COPYDATA = 0x004A,
+ WM_CANCELJOURNAL = 0x004B,
+ WM_NOTIFY = 0x004E,
+ WM_INPUTLANGCHANGEREQUEST = 0x0050,
+ WM_INPUTLANGCHANGE = 0x0051,
+ WM_TCARD = 0x0052,
+ WM_HELP = 0x0053,
+ WM_USERCHANGED = 0x0054,
+ WM_NOTIFYFORMAT = 0x0055,
+ WM_CONTEXTMENU = 0x007B,
+ WM_STYLECHANGING = 0x007C,
+ WM_STYLECHANGED = 0x007D,
+ WM_DISPLAYCHANGE = 0x007E,
+ WM_GETICON = 0x007F,
+ WM_SETICON = 0x0080,
+ WM_NCCREATE = 0x0081,
+ WM_NCDESTROY = 0x0082,
+ WM_NCCALCSIZE = 0x0083,
+ WM_NCHITTEST = 0x0084,
+ WM_NCPAINT = 0x0085,
+ WM_NCACTIVATE = 0x0086,
+ WM_GETDLGCODE = 0x0087,
+ WM_SYNCPAINT = 0x0088,
+// public const uint WM_SYNCTASK = 0x0089;
+ WM_NCMOUSEMOVE = 0x00A0,
+ WM_NCLBUTTONDOWN = 0x00A1,
+ WM_NCLBUTTONUP = 0x00A2,
+ WM_NCLBUTTONDBLCLK = 0x00A3,
+ WM_NCRBUTTONDOWN = 0x00A4,
+ WM_NCRBUTTONUP = 0x00A5,
+ WM_NCRBUTTONDBLCLK = 0x00A6,
+ WM_NCMBUTTONDOWN = 0x00A7,
+ WM_NCMBUTTONUP = 0x00A8,
+ WM_NCMBUTTONDBLCLK = 0x00A9,
+// public const uint WM_NCXBUTTONDOWN = 0x00ab;
+// public const uint WM_NCXBUTTONUP = 0x00ac;
+// public const uint WM_NCXBUTTONDBLCLK = 0x00ad;
+ WM_KEYDOWN = 0x0100,
+ WM_KEYUP = 0x0101,
+ WM_CHAR = 0x0102,
+ WM_DEADCHAR = 0x0103,
+ WM_SYSKEYDOWN = 0x0104,
+ WM_SYSKEYUP = 0x0105,
+ WM_SYSCHAR = 0x0106,
+ WM_SYSDEADCHAR = 0x0107,
+ WM_KEYLAST = 0x0108,
+ WM_IME_STARTCOMPOSITION = 0x010D,
+ WM_IME_ENDCOMPOSITION = 0x010E,
+ WM_IME_COMPOSITION = 0x010F,
+ WM_IME_KEYLAST = 0x010F,
+ WM_INITDIALOG = 0x0110,
+ WM_COMMAND = 0x0111,
+ WM_SYSCOMMAND = 0x0112,
+ WM_TIMER = 0x0113,
+ WM_HSCROLL = 0x0114,
+ WM_VSCROLL = 0x0115,
+ WM_INITMENU = 0x0116,
+ WM_INITMENUPOPUP = 0x0117,
+// public const uint WM_SYSTIMER = 0x0118;
+ WM_MENUSELECT = 0x011F,
+ WM_MENUCHAR = 0x0120,
+ WM_ENTERIDLE = 0x0121,
+ WM_MENURBUTTONUP = 0x0122,
+ WM_MENUDRAG = 0x0123,
+ WM_MENUGETOBJECT = 0x0124,
+ WM_UNINITMENUPOPUP = 0x0125,
+ WM_MENUCOMMAND = 0x0126,
+// public const uint WM_CHANGEUISTATE = 0x0127;
+// public const uint WM_UPDATEUISTATE = 0x0128;
+// public const uint WM_QUERYUISTATE = 0x0129;
+
+// public const uint WM_LBTRACKPOINT = 0x0131;
+ WM_CTLCOLORMSGBOX = 0x0132,
+ WM_CTLCOLOREDIT = 0x0133,
+ WM_CTLCOLORLISTBOX = 0x0134,
+ WM_CTLCOLORBTN = 0x0135,
+ WM_CTLCOLORDLG = 0x0136,
+ WM_CTLCOLORSCROLLBAR = 0x0137,
+ WM_CTLCOLORSTATIC = 0x0138,
+ WM_MOUSEMOVE = 0x0200,
+ WM_LBUTTONDOWN = 0x0201,
+ WM_LBUTTONUP = 0x0202,
+ WM_LBUTTONDBLCLK = 0x0203,
+ WM_RBUTTONDOWN = 0x0204,
+ WM_RBUTTONUP = 0x0205,
+ WM_RBUTTONDBLCLK = 0x0206,
+ WM_MBUTTONDOWN = 0x0207,
+ WM_MBUTTONUP = 0x0208,
+ WM_MBUTTONDBLCLK = 0x0209,
+ WM_MOUSEWHEEL = 0x020A,
+// public const uint WM_XBUTTONDOWN = 0x020B;
+// public const uint WM_XBUTTONUP = 0x020C;
+// public const uint WM_XBUTTONDBLCLK = 0x020D;
+ WM_PARENTNOTIFY = 0x0210,
+ WM_ENTERMENULOOP = 0x0211,
+ WM_EXITMENULOOP = 0x0212,
+ WM_NEXTMENU = 0x0213,
+ WM_SIZING = 0x0214,
+ WM_CAPTURECHANGED = 0x0215,
+ WM_MOVING = 0x0216,
+// public const uint WM_POWERBROADCAST = 0x0218;
+ WM_DEVICECHANGE = 0x0219,
+ WM_MDICREATE = 0x0220,
+ WM_MDIDESTROY = 0x0221,
+ WM_MDIACTIVATE = 0x0222,
+ WM_MDIRESTORE = 0x0223,
+ WM_MDINEXT = 0x0224,
+ WM_MDIMAXIMIZE = 0x0225,
+ WM_MDITILE = 0x0226,
+ WM_MDICASCADE = 0x0227,
+ WM_MDIICONARRANGE = 0x0228,
+ WM_MDIGETACTIVE = 0x0229,
+ /* D&D messages */
+// public const uint WM_DROPOBJECT = 0x022A;
+// public const uint WM_QUERYDROPOBJECT = 0x022B;
+// public const uint WM_BEGINDRAG = 0x022C;
+// public const uint WM_DRAGLOOP = 0x022D;
+// public const uint WM_DRAGSELECT = 0x022E;
+// public const uint WM_DRAGMOVE = 0x022F;
+ WM_MDISETMENU = 0x0230,
+ WM_ENTERSIZEMOVE = 0x0231,
+ WM_EXITSIZEMOVE = 0x0232,
+ WM_DROPFILES = 0x0233,
+ WM_MDIREFRESHMENU = 0x0234,
+ WM_IME_SETCONTEXT = 0x0281,
+ WM_IME_NOTIFY = 0x0282,
+ WM_IME_CONTROL = 0x0283,
+ WM_IME_COMPOSITIONFULL = 0x0284,
+ WM_IME_SELECT = 0x0285,
+ WM_IME_CHAR = 0x0286,
+ WM_IME_REQUEST = 0x0288,
+ WM_IME_KEYDOWN = 0x0290,
+ WM_IME_KEYUP = 0x0291,
+ WM_MOUSEHOVER = 0x02A1,
+ WM_MOUSELEAVE = 0x02A3,
+ WM_CUT = 0x0300,
+ WM_COPY = 0x0301,
+ WM_PASTE = 0x0302,
+ WM_CLEAR = 0x0303,
+ WM_UNDO = 0x0304,
+ WM_RENDERFORMAT = 0x0305,
+ WM_RENDERALLFORMATS = 0x0306,
+ WM_DESTROYCLIPBOARD = 0x0307,
+ WM_DRAWCLIPBOARD = 0x0308,
+ WM_PAINTCLIPBOARD = 0x0309,
+ WM_VSCROLLCLIPBOARD = 0x030A,
+ WM_SIZECLIPBOARD = 0x030B,
+ WM_ASKCBFORMATNAME = 0x030C,
+ WM_CHANGECBCHAIN = 0x030D,
+ WM_HSCROLLCLIPBOARD = 0x030E,
+ WM_QUERYNEWPALETTE = 0x030F,
+ WM_PALETTEISCHANGING = 0x0310,
+ WM_PALETTECHANGED = 0x0311,
+ WM_HOTKEY = 0x0312,
+ WM_PRINT = 0x0317,
+ WM_PRINTCLIENT = 0x0318,
+ WM_HANDHELDFIRST = 0x0358,
+ WM_HANDHELDLAST = 0x035F,
+ WM_AFXFIRST = 0x0360,
+ WM_AFXLAST = 0x037F,
+ WM_PENWINFIRST = 0x0380,
+ WM_PENWINLAST = 0x038F,
+ WM_APP = 0x8000,
+ WM_USER = 0x0400,
+ WM_REFLECT = WM_USER + 0x1c00
+ }
+ #endregion
+
+ #region Window Styles
+ [Flags]
+ public enum WindowStyles : long
+ {
+ WS_OVERLAPPED = 0x00000000,
+ WS_POPUP = 0x80000000,
+ WS_CHILD = 0x40000000,
+ WS_MINIMIZE = 0x20000000,
+ WS_VISIBLE = 0x10000000,
+ WS_DISABLED = 0x08000000,
+ WS_CLIPSIBLINGS = 0x04000000,
+ WS_CLIPCHILDREN = 0x02000000,
+ WS_MAXIMIZE = 0x01000000,
+ WS_CAPTION = 0x00C00000,
+ WS_BORDER = 0x00800000,
+ WS_DLGFRAME = 0x00400000,
+ WS_VSCROLL = 0x00200000,
+ WS_HSCROLL = 0x00100000,
+ WS_SYSMENU = 0x00080000,
+ WS_THICKFRAME = 0x00040000,
+ WS_GROUP = 0x00020000,
+ WS_TABSTOP = 0x00010000,
+ WS_MINIMIZEBOX = 0x00020000,
+ WS_MAXIMIZEBOX = 0x00010000,
+ WS_TILED = 0x00000000,
+ WS_ICONIC = 0x20000000,
+ WS_SIZEBOX = 0x00040000,
+ WS_POPUPWINDOW = 0x80880000,
+ WS_OVERLAPPEDWINDOW = 0x00CF0000,
+//this OR option is perferred
+// public const uint WS_OVERLAPPEDWINDOW = WS_OVERLAPPED |
+// WS_CAPTION | WS_SYSMENU | WS_THICKFRAME|
+// WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
+ WS_TILEDWINDOW = 0x00CF0000,
+ WS_CHILDWINDOW = 0x40000000
+ }
+ #endregion
+
+ #region Window Extended Styles
+ public enum WindowExStyles
+ {
+ WS_EX_DLGMODALFRAME = 0x00000001,
+ WS_EX_NOPARENTNOTIFY = 0x00000004,
+ WS_EX_TOPMOST = 0x00000008,
+ WS_EX_ACCEPTFILES = 0x00000010,
+ WS_EX_TRANSPARENT = 0x00000020,
+ WS_EX_MDICHILD = 0x00000040,
+ WS_EX_TOOLWINDOW = 0x00000080,
+ WS_EX_WINDOWEDGE = 0x00000100,
+ WS_EX_CLIENTEDGE = 0x00000200,
+ WS_EX_CONTEXTHELP = 0x00000400,
+ WS_EX_RIGHT = 0x00001000,
+ WS_EX_LEFT = 0x00000000,
+ WS_EX_RTLREADING = 0x00002000,
+ WS_EX_LTRREADING = 0x00000000,
+ WS_EX_LEFTSCROLLBAR = 0x00004000,
+ WS_EX_RIGHTSCROLLBAR = 0x00000000,
+ WS_EX_CONTROLPARENT = 0x00010000,
+ WS_EX_STATICEDGE = 0x00020000,
+ WS_EX_APPWINDOW = 0x00040000,
+ WS_EX_OVERLAPPEDWINDOW = 0x00000300,
+ WS_EX_PALETTEWINDOW = 0x00000188,
+ WS_EX_LAYERED = 0x00080000
+ }
+ #endregion
+
+ #region ShowWindow Styles
+ public enum ShowWindowStyles : short
+ {
+ SW_HIDE = 0,
+ SW_SHOWNORMAL = 1,
+ SW_NORMAL = 1,
+ SW_SHOWMINIMIZED = 2,
+ SW_SHOWMAXIMIZED = 3,
+ SW_MAXIMIZE = 3,
+ SW_SHOWNOACTIVATE = 4,
+ SW_SHOW = 5,
+ SW_MINIMIZE = 6,
+ SW_SHOWMINNOACTIVE = 7,
+ SW_SHOWNA = 8,
+ SW_RESTORE = 9,
+ SW_SHOWDEFAULT = 10,
+ SW_FORCEMINIMIZE = 11,
+ SW_MAX = 11
+// public const uint SW_NORMALNA = 0xCC;
+ }
+ #endregion
+
+ #region SetWindowPos Z Order
+ public enum SetWindowPosZOrder
+ {
+ HWND_TOP = 0,
+ HWND_BOTTOM = 1,
+ HWND_TOPMOST = -1,
+ HWND_NOTOPMOST = -2
+// public const int HWND_MESSAGE = -3;
+}
+ #endregion
+
+ #region SetWindowPosFlags
+ [Flags]
+ public enum SetWindowPosFlags
+ {
+ SWP_NOSIZE = 0x0001,
+ SWP_NOMOVE = 0x0002,
+ SWP_NOZORDER = 0x0004,
+ SWP_NOREDRAW = 0x0008,
+ SWP_NOACTIVATE = 0x0010,
+ SWP_FRAMECHANGED = 0x0020,
+ SWP_SHOWWINDOW = 0x0040,
+ SWP_HIDEWINDOW = 0x0080,
+ SWP_NOCOPYBITS = 0x0100,
+ SWP_NOOWNERZORDER = 0x0200,
+ SWP_NOSENDCHANGING = 0x0400,
+ SWP_DRAWFRAME = SWP_FRAMECHANGED,
+ SWP_NOREPOSITION = SWP_NOOWNERZORDER,
+ SWP_DEFERERASE = 0x2000,
+ SWP_ASYNCWINDOWPOS = 0x4000
+ }
+ #endregion
+
+ #region Virtual Keys
+ public enum VirtualKeys
+ {
+ VK_LBUTTON = 0x01,
+ VK_CANCEL = 0x03,
+ VK_BACK = 0x08,
+ VK_TAB = 0x09,
+ VK_CLEAR = 0x0C,
+ VK_RETURN = 0x0D,
+ VK_SHIFT = 0x10,
+ VK_CONTROL = 0x11,
+ VK_MENU = 0x12,
+ VK_CAPITAL = 0x14,
+ VK_ESCAPE = 0x1B,
+ VK_SPACE = 0x20,
+ VK_PRIOR = 0x21,
+ VK_NEXT = 0x22,
+ VK_END = 0x23,
+ VK_HOME = 0x24,
+ VK_LEFT = 0x25,
+ VK_UP = 0x26,
+ VK_RIGHT = 0x27,
+ VK_DOWN = 0x28,
+ VK_SELECT = 0x29,
+ VK_EXECUTE = 0x2B,
+ VK_SNAPSHOT = 0x2C,
+ VK_HELP = 0x2F,
+ VK_0 = 0x30,
+ VK_1 = 0x31,
+ VK_2 = 0x32,
+ VK_3 = 0x33,
+ VK_4 = 0x34,
+ VK_5 = 0x35,
+ VK_6 = 0x36,
+ VK_7 = 0x37,
+ VK_8 = 0x38,
+ VK_9 = 0x39,
+ VK_A = 0x41,
+ VK_B = 0x42,
+ VK_C = 0x43,
+ VK_D = 0x44,
+ VK_E = 0x45,
+ VK_F = 0x46,
+ VK_G = 0x47,
+ VK_H = 0x48,
+ VK_I = 0x49,
+ VK_J = 0x4A,
+ VK_K = 0x4B,
+ VK_L = 0x4C,
+ VK_M = 0x4D,
+ VK_N = 0x4E,
+ VK_O = 0x4F,
+ VK_P = 0x50,
+ VK_Q = 0x51,
+ VK_R = 0x52,
+ VK_S = 0x53,
+ VK_T = 0x54,
+ VK_U = 0x55,
+ VK_V = 0x56,
+ VK_W = 0x57,
+ VK_X = 0x58,
+ VK_Y = 0x59,
+ VK_Z = 0x5A,
+ VK_NUMPAD0 = 0x60,
+ VK_NUMPAD1 = 0x61,
+ VK_NUMPAD2 = 0x62,
+ VK_NUMPAD3 = 0x63,
+ VK_NUMPAD4 = 0x64,
+ VK_NUMPAD5 = 0x65,
+ VK_NUMPAD6 = 0x66,
+ VK_NUMPAD7 = 0x67,
+ VK_NUMPAD8 = 0x68,
+ VK_NUMPAD9 = 0x69,
+ VK_MULTIPLY = 0x6A,
+ VK_ADD = 0x6B,
+ VK_SEPARATOR = 0x6C,
+ VK_SUBTRACT = 0x6D,
+ VK_DECIMAL = 0x6E,
+ VK_DIVIDE = 0x6F,
+ VK_ATTN = 0xF6,
+ VK_CRSEL = 0xF7,
+ VK_EXSEL = 0xF8,
+ VK_EREOF = 0xF9,
+ VK_PLAY = 0xFA,
+ VK_ZOOM = 0xFB,
+ VK_NONAME = 0xFC,
+ VK_PA1 = 0xFD,
+ VK_OEM_CLEAR = 0xFE,
+ VK_LWIN = 0x5B,
+ VK_RWIN = 0x5C,
+ VK_APPS = 0x5D,
+ VK_LSHIFT = 0xA0,
+ VK_RSHIFT = 0xA1,
+ VK_LCONTROL = 0xA2,
+ VK_RCONTROL = 0xA3,
+ VK_LMENU = 0xA4,
+ VK_RMENU = 0xA5
+ }
+ #endregion
+
+ #region PatBlt Types
+ public enum PatBltTypes
+ {
+ SRCCOPY = 0x00CC0020,
+ SRCPAINT = 0x00EE0086,
+ SRCAND = 0x008800C6,
+ SRCINVERT = 0x00660046,
+ SRCERASE = 0x00440328,
+ NOTSRCCOPY = 0x00330008,
+ NOTSRCERASE = 0x001100A6,
+ MERGECOPY = 0x00C000CA,
+ MERGEPAINT = 0x00BB0226,
+ PATCOPY = 0x00F00021,
+ PATPAINT = 0x00FB0A09,
+ PATINVERT = 0x005A0049,
+ DSTINVERT = 0x00550009,
+ BLACKNESS = 0x00000042,
+ WHITENESS = 0x00FF0062
+ }
+ #endregion
+
+ #region Clipboard Formats
+ public enum ClipboardFormats
+ {
+ CF_TEXT = 1,
+ CF_BITMAP = 2,
+ CF_METAFILEPICT = 3,
+ CF_SYLK = 4,
+ CF_DIF = 5,
+ CF_TIFF = 6,
+ CF_OEMTEXT = 7,
+ CF_DIB = 8,
+ CF_PALETTE = 9,
+ CF_PENDATA = 10,
+ CF_RIFF = 11,
+ CF_WAVE = 12,
+ CF_UNICODETEXT = 13,
+ CF_ENHMETAFILE = 14,
+ CF_HDROP = 15,
+ CF_LOCALE = 16,
+ CF_MAX = 17,
+ CF_OWNERDISPLAY = 0x0080,
+ CF_DSPTEXT = 0x0081,
+ CF_DSPBITMAP = 0x0082,
+ CF_DSPMETAFILEPICT = 0x0083,
+ CF_DSPENHMETAFILE = 0x008E,
+ CF_PRIVATEFIRST = 0x0200,
+ CF_PRIVATELAST = 0x02FF,
+ CF_GDIOBJFIRST = 0x0300,
+ CF_GDIOBJLAST = 0x03FF
+ }
+ #endregion
+
+ #region Common Controls Initialization flags
+ public enum CommonControlInitFlags
+ {
+ ICC_LISTVIEW_CLASSES = 0x00000001,
+ ICC_TREEVIEW_CLASSES = 0x00000002,
+ ICC_BAR_CLASSES = 0x00000004,
+ ICC_TAB_CLASSES = 0x00000008,
+ ICC_UPDOWN_CLASS = 0x00000010,
+ ICC_PROGRESS_CLASS = 0x00000020,
+ ICC_HOTKEY_CLASS = 0x00000040,
+ ICC_ANIMATE_CLASS = 0x00000080,
+ ICC_WIN95_CLASSES = 0x000000FF,
+ ICC_DATE_CLASSES = 0x00000100,
+ ICC_USEREX_CLASSES = 0x00000200,
+ ICC_COOL_CLASSES = 0x00000400,
+ ICC_INTERNET_CLASSES = 0x00000800,
+ ICC_PAGESCROLLER_CLASS = 0x00001000,
+ ICC_NATIVEFNTCTL_CLASS = 0x00002000
+ }
+ #endregion
+
+ #region Common Controls Styles
+ public enum CommonControlStyles
+ {
+ CCS_TOP = 0x00000001,
+ CCS_NOMOVEY = 0x00000002,
+ CCS_BOTTOM = 0x00000003,
+ CCS_NORESIZE = 0x00000004,
+ CCS_NOPARENTALIGN = 0x00000008,
+ CCS_ADJUSTABLE = 0x00000020,
+ CCS_NODIVIDER = 0x00000040,
+ CCS_VERT = 0x00000080,
+ CCS_LEFT = (CCS_VERT | CCS_TOP),
+ CCS_RIGHT = (CCS_VERT | CCS_BOTTOM),
+ CCS_NOMOVEX = (CCS_VERT | CCS_NOMOVEY)
+ }
+ #endregion
+
+ #region ToolBar Styles
+ public enum ToolBarStyles
+ {
+ TBSTYLE_BUTTON = 0x0000,
+ TBSTYLE_SEP = 0x0001,
+ TBSTYLE_CHECK = 0x0002,
+ TBSTYLE_GROUP = 0x0004,
+ TBSTYLE_CHECKGROUP = (TBSTYLE_GROUP | TBSTYLE_CHECK),
+ TBSTYLE_DROPDOWN = 0x0008,
+ TBSTYLE_AUTOSIZE = 0x0010,
+ TBSTYLE_NOPREFIX = 0x0020,
+ TBSTYLE_TOOLTIPS = 0x0100,
+ TBSTYLE_WRAPABLE = 0x0200,
+ TBSTYLE_ALTDRAG = 0x0400,
+ TBSTYLE_FLAT = 0x0800,
+ TBSTYLE_LIST = 0x1000,
+ TBSTYLE_CUSTOMERASE = 0x2000,
+ TBSTYLE_REGISTERDROP = 0x4000,
+ TBSTYLE_TRANSPARENT = 0x8000,
+ TBSTYLE_EX_DRAWDDARROWS = 0x00000001
+ }
+ #endregion
+
+ #region ToolBar Ex Styles
+ public enum ToolBarExStyles
+ {
+ TBSTYLE_EX_DRAWDDARROWS = 0x1,
+ TBSTYLE_EX_HIDECLIPPEDBUTTONS = 0x10,
+ TBSTYLE_EX_DOUBLEBUFFER = 0x80
+ }
+ #endregion
+
+ #region ToolBar Messages
+ public enum ToolBarMessages
+ {
+ WM_USER = 0x0400,
+ TB_ENABLEBUTTON = (WM_USER + 1),
+ TB_CHECKBUTTON = (WM_USER + 2),
+ TB_PRESSBUTTON = (WM_USER + 3),
+ TB_HIDEBUTTON = (WM_USER + 4),
+ TB_INDETERMINATE = (WM_USER + 5),
+ TB_MARKBUTTON = (WM_USER + 6),
+ TB_ISBUTTONENABLED = (WM_USER + 9),
+ TB_ISBUTTONCHECKED = (WM_USER + 10),
+ TB_ISBUTTONPRESSED = (WM_USER + 11),
+ TB_ISBUTTONHIDDEN = (WM_USER + 12),
+ TB_ISBUTTONINDETERMINATE= (WM_USER + 13),
+ TB_ISBUTTONHIGHLIGHTED = (WM_USER + 14),
+ TB_SETSTATE = (WM_USER + 17),
+ TB_GETSTATE = (WM_USER + 18),
+ TB_ADDBITMAP = (WM_USER + 19),
+ TB_ADDBUTTONSA = (WM_USER + 20),
+ TB_INSERTBUTTONA = (WM_USER + 21),
+ TB_ADDBUTTONS = (WM_USER + 20),
+ TB_INSERTBUTTON = (WM_USER + 21),
+ TB_DELETEBUTTON = (WM_USER + 22),
+ TB_GETBUTTON = (WM_USER + 23),
+ TB_BUTTONCOUNT = (WM_USER + 24),
+ TB_COMMANDTOINDEX = (WM_USER + 25),
+ TB_SAVERESTOREA = (WM_USER + 26),
+ TB_CUSTOMIZE = (WM_USER + 27),
+ TB_ADDSTRINGA = (WM_USER + 28),
+ TB_GETITEMRECT = (WM_USER + 29),
+ TB_BUTTONSTRUCTSIZE = (WM_USER + 30),
+ TB_SETBUTTONSIZE = (WM_USER + 31),
+ TB_SETBITMAPSIZE = (WM_USER + 32),
+ TB_AUTOSIZE = (WM_USER + 33),
+ TB_GETTOOLTIPS = (WM_USER + 35),
+ TB_SETTOOLTIPS = (WM_USER + 36),
+ TB_SETPARENT = (WM_USER + 37),
+ TB_SETROWS = (WM_USER + 39),
+ TB_GETROWS = (WM_USER + 40),
+ TB_GETBITMAPFLAGS = (WM_USER + 41),
+ TB_SETCMDID = (WM_USER + 42),
+ TB_CHANGEBITMAP = (WM_USER + 43),
+ TB_GETBITMAP = (WM_USER + 44),
+ TB_GETBUTTONTEXTA = (WM_USER + 45),
+ TB_GETBUTTONTEXTW = (WM_USER + 75),
+ TB_REPLACEBITMAP = (WM_USER + 46),
+ TB_SETINDENT = (WM_USER + 47),
+ TB_SETIMAGELIST = (WM_USER + 48),
+ TB_GETIMAGELIST = (WM_USER + 49),
+ TB_LOADIMAGES = (WM_USER + 50),
+ TB_GETRECT = (WM_USER + 51),
+ TB_SETHOTIMAGELIST = (WM_USER + 52),
+ TB_GETHOTIMAGELIST = (WM_USER + 53),
+ TB_SETDISABLEDIMAGELIST = (WM_USER + 54),
+ TB_GETDISABLEDIMAGELIST = (WM_USER + 55),
+ TB_SETSTYLE = (WM_USER + 56),
+ TB_GETSTYLE = (WM_USER + 57),
+ TB_GETBUTTONSIZE = (WM_USER + 58),
+ TB_SETBUTTONWIDTH = (WM_USER + 59),
+ TB_SETMAXTEXTROWS = (WM_USER + 60),
+ TB_GETTEXTROWS = (WM_USER + 61),
+ TB_GETOBJECT = (WM_USER + 62),
+ TB_GETBUTTONINFOW = (WM_USER + 63),
+ TB_SETBUTTONINFOW = (WM_USER + 64),
+ TB_GETBUTTONINFOA = (WM_USER + 65),
+ TB_SETBUTTONINFOA = (WM_USER + 66),
+ TB_INSERTBUTTONW = (WM_USER + 67),
+ TB_ADDBUTTONSW = (WM_USER + 68),
+ TB_HITTEST = (WM_USER + 69),
+ TB_SETDRAWTEXTFLAGS = (WM_USER + 70),
+ TB_GETHOTITEM = (WM_USER + 71),
+ TB_SETHOTITEM = (WM_USER + 72),
+ TB_SETANCHORHIGHLIGHT = (WM_USER + 73),
+ TB_GETANCHORHIGHLIGHT = (WM_USER + 74),
+ TB_SAVERESTOREW = (WM_USER + 76),
+ TB_ADDSTRINGW = (WM_USER + 77),
+ TB_MAPACCELERATORA = (WM_USER + 78),
+ TB_GETINSERTMARK = (WM_USER + 79),
+ TB_SETINSERTMARK = (WM_USER + 80),
+ TB_INSERTMARKHITTEST = (WM_USER + 81),
+ TB_MOVEBUTTON = (WM_USER + 82),
+ TB_GETMAXSIZE = (WM_USER + 83),
+ TB_SETEXTENDEDSTYLE = (WM_USER + 84),
+ TB_GETEXTENDEDSTYLE = (WM_USER + 85),
+ TB_GETPADDING = (WM_USER + 86),
+ TB_SETPADDING = (WM_USER + 87),
+ TB_SETINSERTMARKCOLOR = (WM_USER + 88),
+ TB_GETINSERTMARKCOLOR = (WM_USER + 89)
+ }
+ #endregion
+
+ #region ToolBar Notifications
+ public enum ToolBarNotifications
+ {
+ TTN_NEEDTEXTA = ((0-520)-0),
+ TTN_NEEDTEXTW = ((0-520)-10),
+ TBN_QUERYINSERT = ((0-700)-6),
+ TBN_DROPDOWN = ((0-700)-10),
+ TBN_HOTITEMCHANGE = ((0 - 700) - 13)
+ }
+ #endregion
+
+ #region Reflected Messages
+ public enum ReflectedMessages
+ {
+ OCM__BASE = (Msg.WM_USER+0x1c00),
+ OCM_COMMAND = (OCM__BASE + Msg.WM_COMMAND),
+ OCM_CTLCOLORBTN = (OCM__BASE + Msg.WM_CTLCOLORBTN),
+ OCM_CTLCOLOREDIT = (OCM__BASE + Msg.WM_CTLCOLOREDIT),
+ OCM_CTLCOLORDLG = (OCM__BASE + Msg.WM_CTLCOLORDLG),
+ OCM_CTLCOLORLISTBOX = (OCM__BASE + Msg.WM_CTLCOLORLISTBOX),
+ OCM_CTLCOLORMSGBOX = (OCM__BASE + Msg.WM_CTLCOLORMSGBOX),
+ OCM_CTLCOLORSCROLLBAR = (OCM__BASE + Msg.WM_CTLCOLORSCROLLBAR),
+ OCM_CTLCOLORSTATIC = (OCM__BASE + Msg.WM_CTLCOLORSTATIC),
+ OCM_CTLCOLOR = (OCM__BASE + Msg.WM_CTLCOLOR),
+ OCM_DRAWITEM = (OCM__BASE + Msg.WM_DRAWITEM),
+ OCM_MEASUREITEM = (OCM__BASE + Msg.WM_MEASUREITEM),
+ OCM_DELETEITEM = (OCM__BASE + Msg.WM_DELETEITEM),
+ OCM_VKEYTOITEM = (OCM__BASE + Msg.WM_VKEYTOITEM),
+ OCM_CHARTOITEM = (OCM__BASE + Msg.WM_CHARTOITEM),
+ OCM_COMPAREITEM = (OCM__BASE + Msg.WM_COMPAREITEM),
+ OCM_HSCROLL = (OCM__BASE + Msg.WM_HSCROLL),
+ OCM_VSCROLL = (OCM__BASE + Msg.WM_VSCROLL),
+ OCM_PARENTNOTIFY = (OCM__BASE + Msg.WM_PARENTNOTIFY),
+ OCM_NOTIFY = (OCM__BASE + Msg.WM_NOTIFY)
+ }
+ #endregion
+
+ #region Notification Messages
+ public enum NotificationMessages
+ {
+ NM_FIRST = (0-0),
+ NM_CUSTOMDRAW = (NM_FIRST-12),
+ NM_NCHITTEST = (NM_FIRST-14)
+ }
+ #endregion
+
+ #region ToolTip Flags
+ public enum ToolTipFlags
+ {
+ TTF_CENTERTIP = 0x0002,
+ TTF_RTLREADING = 0x0004,
+ TTF_SUBCLASS = 0x0010,
+ TTF_TRACK = 0x0020,
+ TTF_ABSOLUTE = 0x0080,
+ TTF_TRANSPARENT = 0x0100,
+ TTF_DI_SETITEM = 0x8000
+ }
+ #endregion
+
+ #region Custom Draw Return Flags
+ public enum CustomDrawReturnFlags
+ {
+ CDRF_DODEFAULT = 0x00000000,
+ CDRF_NEWFONT = 0x00000002,
+ CDRF_SKIPDEFAULT = 0x00000004,
+ CDRF_NOTIFYPOSTPAINT = 0x00000010,
+ CDRF_NOTIFYITEMDRAW = 0x00000020,
+ CDRF_NOTIFYSUBITEMDRAW = 0x00000020,
+ CDRF_NOTIFYPOSTERASE = 0x00000040
+ }
+ #endregion
+
+ #region Custom Draw Item State Flags
+ public enum CustomDrawItemStateFlags
+ {
+ CDIS_SELECTED = 0x0001,
+ CDIS_GRAYED = 0x0002,
+ CDIS_DISABLED = 0x0004,
+ CDIS_CHECKED = 0x0008,
+ CDIS_FOCUS = 0x0010,
+ CDIS_DEFAULT = 0x0020,
+ CDIS_HOT = 0x0040,
+ CDIS_MARKED = 0x0080,
+ CDIS_INDETERMINATE = 0x0100
+ }
+ #endregion
+
+ #region Custom Draw Draw State Flags
+ public enum CustomDrawDrawStateFlags
+ {
+ CDDS_PREPAINT = 0x00000001,
+ CDDS_POSTPAINT = 0x00000002,
+ CDDS_PREERASE = 0x00000003,
+ CDDS_POSTERASE = 0x00000004,
+ CDDS_ITEM = 0x00010000,
+ CDDS_ITEMPREPAINT = (CDDS_ITEM | CDDS_PREPAINT),
+ CDDS_ITEMPOSTPAINT = (CDDS_ITEM | CDDS_POSTPAINT),
+ CDDS_ITEMPREERASE = (CDDS_ITEM | CDDS_PREERASE),
+ CDDS_ITEMPOSTERASE = (CDDS_ITEM | CDDS_POSTERASE),
+ CDDS_SUBITEM = 0x00020000
+ }
+ #endregion
+
+ #region Toolbar button info flags
+ public enum ToolBarButtonInfoFlags
+ {
+ TBIF_IMAGE = 0x00000001,
+ TBIF_TEXT = 0x00000002,
+ TBIF_STATE = 0x00000004,
+ TBIF_STYLE = 0x00000008,
+ TBIF_LPARAM = 0x00000010,
+ TBIF_COMMAND = 0x00000020,
+ TBIF_SIZE = 0x00000040,
+ I_IMAGECALLBACK = -1,
+ I_IMAGENONE = -2
+ }
+ #endregion
+
+ #region Toolbar button styles
+ public enum ToolBarButtonStyles
+ {
+ TBSTYLE_BUTTON = 0x0000,
+ TBSTYLE_SEP = 0x0001,
+ TBSTYLE_CHECK = 0x0002,
+ TBSTYLE_GROUP = 0x0004,
+ TBSTYLE_CHECKGROUP = (TBSTYLE_GROUP | TBSTYLE_CHECK),
+ TBSTYLE_DROPDOWN = 0x0008,
+ TBSTYLE_AUTOSIZE = 0x0010,
+ TBSTYLE_NOPREFIX = 0x0020,
+ TBSTYLE_TOOLTIPS = 0x0100,
+ TBSTYLE_WRAPABLE = 0x0200,
+ TBSTYLE_ALTDRAG = 0x0400,
+ TBSTYLE_FLAT = 0x0800,
+ TBSTYLE_LIST = 0x1000,
+ TBSTYLE_CUSTOMERASE = 0x2000,
+ TBSTYLE_REGISTERDROP = 0x4000,
+ TBSTYLE_TRANSPARENT = 0x8000,
+ TBSTYLE_EX_DRAWDDARROWS = 0x00000001
+ }
+ #endregion
+
+ #region Toolbar button state
+ public enum ToolBarButtonStates
+ {
+ TBSTATE_CHECKED = 0x01,
+ TBSTATE_PRESSED = 0x02,
+ TBSTATE_ENABLED = 0x04,
+ TBSTATE_HIDDEN = 0x08,
+ TBSTATE_INDETERMINATE = 0x10,
+ TBSTATE_WRAP = 0x20,
+ TBSTATE_ELLIPSES = 0x40,
+ TBSTATE_MARKED = 0x80
+ }
+ #endregion
+
+ #region Windows Hook Codes
+ public enum WindowsHookCodes
+ {
+ WH_MSGFILTER = (-1),
+ WH_JOURNALRECORD = 0,
+ WH_JOURNALPLAYBACK = 1,
+ WH_KEYBOARD = 2,
+ WH_GETMESSAGE = 3,
+ WH_CALLWNDPROC = 4,
+ WH_CBT = 5,
+ WH_SYSMSGFILTER = 6,
+ WH_MOUSE = 7,
+ WH_HARDWARE = 8,
+ WH_DEBUG = 9,
+ WH_SHELL = 10,
+ WH_FOREGROUNDIDLE = 11,
+ WH_CALLWNDPROCRET = 12,
+ WH_KEYBOARD_LL = 13,
+ WH_MOUSE_LL = 14
+ }
+
+ #endregion
+
+ #region Mouse Hook Filters
+ public enum MouseHookFilters
+ {
+ MSGF_DIALOGBOX = 0,
+ MSGF_MESSAGEBOX = 1,
+ MSGF_MENU = 2,
+ MSGF_SCROLLBAR = 5,
+ MSGF_NEXTWINDOW = 6
+ }
+
+ #endregion
+
+ #region Draw Text format flags
+ public enum DrawTextFormatFlags
+ {
+ 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
+ }
+
+ #endregion
+
+ #region Rebar Styles
+ public enum RebarStyles
+ {
+ RBS_TOOLTIPS = 0x0100,
+ RBS_VARHEIGHT = 0x0200,
+ RBS_BANDBORDERS = 0x0400,
+ RBS_FIXEDORDER = 0x0800,
+ RBS_REGISTERDROP = 0x1000,
+ RBS_AUTOSIZE = 0x2000,
+ RBS_VERTICALGRIPPER = 0x4000,
+ RBS_DBLCLKTOGGLE = 0x8000,
+ }
+ #endregion
+
+ #region Rebar Notifications
+ public enum RebarNotifications
+ {
+ RBN_FIRST = (0-831),
+ RBN_HEIGHTCHANGE = (RBN_FIRST - 0),
+ RBN_GETOBJECT = (RBN_FIRST - 1),
+ RBN_LAYOUTCHANGED = (RBN_FIRST - 2),
+ RBN_AUTOSIZE = (RBN_FIRST - 3),
+ RBN_BEGINDRAG = (RBN_FIRST - 4),
+ RBN_ENDDRAG = (RBN_FIRST - 5),
+ RBN_DELETINGBAND = (RBN_FIRST - 6),
+ RBN_DELETEDBAND = (RBN_FIRST - 7),
+ RBN_CHILDSIZE = (RBN_FIRST - 8),
+ RBN_CHEVRONPUSHED = (RBN_FIRST - 10)
+ }
+ #endregion
+
+ #region Rebar Messages
+ public enum RebarMessages
+ {
+ CCM_FIRST = 0x2000,
+ WM_USER = 0x0400,
+ RB_INSERTBANDA = (WM_USER + 1),
+ RB_DELETEBAND = (WM_USER + 2),
+ RB_GETBARINFO = (WM_USER + 3),
+ RB_SETBARINFO = (WM_USER + 4),
+ RB_GETBANDINFO = (WM_USER + 5),
+ RB_SETBANDINFOA = (WM_USER + 6),
+ RB_SETPARENT = (WM_USER + 7),
+ RB_HITTEST = (WM_USER + 8),
+ RB_GETRECT = (WM_USER + 9),
+ RB_INSERTBANDW = (WM_USER + 10),
+ RB_SETBANDINFOW = (WM_USER + 11),
+ RB_GETBANDCOUNT = (WM_USER + 12),
+ RB_GETROWCOUNT = (WM_USER + 13),
+ RB_GETROWHEIGHT = (WM_USER + 14),
+ RB_IDTOINDEX = (WM_USER + 16),
+ RB_GETTOOLTIPS = (WM_USER + 17),
+ RB_SETTOOLTIPS = (WM_USER + 18),
+ RB_SETBKCOLOR = (WM_USER + 19),
+ RB_GETBKCOLOR = (WM_USER + 20),
+ RB_SETTEXTCOLOR = (WM_USER + 21),
+ RB_GETTEXTCOLOR = (WM_USER + 22),
+ RB_SIZETORECT = (WM_USER + 23),
+ RB_SETCOLORSCHEME = (CCM_FIRST + 2),
+ RB_GETCOLORSCHEME = (CCM_FIRST + 3),
+ RB_BEGINDRAG = (WM_USER + 24),
+ RB_ENDDRAG = (WM_USER + 25),
+ RB_DRAGMOVE = (WM_USER + 26),
+ RB_GETBARHEIGHT = (WM_USER + 27),
+ RB_GETBANDINFOW = (WM_USER + 28),
+ RB_GETBANDINFOA = (WM_USER + 29),
+ RB_MINIMIZEBAND = (WM_USER + 30),
+ RB_MAXIMIZEBAND = (WM_USER + 31),
+ RB_GETDROPTARGET = (CCM_FIRST + 4),
+ RB_GETBANDBORDERS = (WM_USER + 34),
+ RB_SHOWBAND = (WM_USER + 35),
+ RB_SETPALETTE = (WM_USER + 37),
+ RB_GETPALETTE = (WM_USER + 38),
+ RB_MOVEBAND = (WM_USER + 39),
+ RB_SETUNICODEFORMAT = (CCM_FIRST + 5),
+ RB_GETUNICODEFORMAT = (CCM_FIRST + 6)
+ }
+ #endregion
+
+ #region Rebar Info Mask
+ public enum RebarInfoMask
+ {
+ RBBIM_STYLE = 0x00000001,
+ RBBIM_COLORS = 0x00000002,
+ RBBIM_TEXT = 0x00000004,
+ RBBIM_IMAGE = 0x00000008,
+ RBBIM_CHILD = 0x00000010,
+ RBBIM_CHILDSIZE = 0x00000020,
+ RBBIM_SIZE = 0x00000040,
+ RBBIM_BACKGROUND = 0x00000080,
+ RBBIM_ID = 0x00000100,
+ RBBIM_IDEALSIZE = 0x00000200,
+ RBBIM_LPARAM = 0x00000400,
+ BBIM_HEADERSIZE = 0x00000800
+ }
+ #endregion
+
+ #region Rebar Styles
+ public enum RebarStylesEx
+ {
+ RBBS_BREAK = 0x1,
+ RBBS_CHILDEDGE = 0x4,
+ RBBS_FIXEDBMP = 0x20,
+ RBBS_GRIPPERALWAYS = 0x80,
+ RBBS_USECHEVRON = 0x200
+ }
+ #endregion
+
+ #region Object types
+ public enum ObjectTypes
+ {
+ 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
+ }
+ #endregion
+
+ #region WM_MENUCHAR return values
+ public enum MenuCharReturnValues
+ {
+ MNC_IGNORE = 0,
+ MNC_CLOSE = 1,
+ MNC_EXECUTE = 2,
+ MNC_SELECT = 3
+ }
+ #endregion
+
+ #region Background Mode
+ public enum BackgroundMode
+ {
+ TRANSPARENT = 1,
+ OPAQUE = 2
+ }
+ #endregion
+
+ #region ListView Messages
+ public enum ListViewMessages
+ {
+ LVM_FIRST = 0x1000,
+ LVM_GETSUBITEMRECT = (LVM_FIRST + 56),
+ LVM_GETITEMSTATE = (LVM_FIRST + 44),
+ LVM_GETITEMTEXTW = (LVM_FIRST + 115)
+ }
+ #endregion
+
+ #region Header Control Messages
+ public enum HeaderControlMessages
+ {
+ HDM_FIRST = 0x1200,
+ HDM_GETITEMRECT = (HDM_FIRST + 7),
+ HDM_HITTEST = (HDM_FIRST + 6),
+ HDM_SETIMAGELIST = (HDM_FIRST + 8),
+ HDM_GETITEMW = (HDM_FIRST + 11),
+ HDM_ORDERTOINDEX = (HDM_FIRST + 15)
+ }
+ #endregion
+
+ #region Header Control Notifications
+ public enum HeaderControlNotifications
+ {
+ HDN_FIRST = (0-300),
+ HDN_ITEMCLICKW = (HDN_FIRST-22),
+ HDN_ITEMDBLCLICKW = (HDN_FIRST-23),
+ HDN_DIVIDERDBLCLICKW = (HDN_FIRST-25),
+ HDN_BEGINTRACKW = (HDN_FIRST-26),
+ HDN_ENDTRACKW = (HDN_FIRST-27)
+ }
+ #endregion
+
+ #region Header Control HitTest Flags
+ public enum HeaderControlHitTestFlags
+ {
+ HHT_NOWHERE = 0x0001,
+ HHT_ONHEADER = 0x0002,
+ HHT_ONDIVIDER = 0x0004,
+ HHT_ONDIVOPEN = 0x0008,
+ HHT_ABOVE = 0x0100,
+ HHT_BELOW = 0x0200,
+ HHT_TORIGHT = 0x0400,
+ HHT_TOLEFT = 0x0800
+ }
+ #endregion
+
+ #region List View sub item portion
+ public enum SubItemPortion
+ {
+ LVIR_BOUNDS = 0,
+ LVIR_ICON = 1,
+ LVIR_LABEL = 2
+ }
+ #endregion
+
+ #region Cursor Type
+ public enum CursorType
+ {
+ 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_HAND = 32649,
+ IDC_APPSTARTING = 32650,
+ IDC_HELP = 32651
+ }
+ #endregion
+
+ #region Tracker Event Flags
+ public enum TrackerEventFlags : long
+ {
+ TME_HOVER = 0x00000001,
+ TME_LEAVE = 0x00000002,
+ TME_QUERY = 0x40000000,
+ TME_CANCEL = 0x80000000
+ }
+ #endregion
+
+ #region Mouse Activate Flags
+ public enum MouseActivateFlags
+ {
+ MA_ACTIVATE = 1,
+ MA_ACTIVATEANDEAT = 2,
+ MA_NOACTIVATE = 3,
+ MA_NOACTIVATEANDEAT = 4
+ }
+ #endregion
+
+ #region Dialog Codes
+ public enum DialogCodes
+ {
+ DLGC_WANTARROWS = 0x0001,
+ DLGC_WANTTAB = 0x0002,
+ DLGC_WANTALLKEYS = 0x0004,
+ DLGC_WANTMESSAGE = 0x0004,
+ DLGC_HASSETSEL = 0x0008,
+ DLGC_DEFPUSHBUTTON = 0x0010,
+ DLGC_UNDEFPUSHBUTTON = 0x0020,
+ DLGC_RADIOBUTTON = 0x0040,
+ DLGC_WANTCHARS = 0x0080,
+ DLGC_STATIC = 0x0100,
+ DLGC_BUTTON = 0x2000
+ }
+ #endregion
+
+ #region Update Layered Windows Flags
+ public enum UpdateLayeredWindowFlags
+ {
+ ULW_COLORKEY = 0x00000001,
+ ULW_ALPHA = 0x00000002,
+ ULW_OPAQUE = 0x00000004
+ }
+ #endregion
+
+ #region Blend Flags
+ public enum BlendFlags : byte
+ {
+ AC_SRC_OVER = 0x00,
+ AC_SRC_ALPHA = 0x01
+ }
+ #endregion
+
+ #region ComboBox messages
+ public enum ComboBoxMessages
+ {
+ CB_GETDROPPEDSTATE = 0x0157
+ }
+ #endregion
+
+ #region TreeView Messages
+ public enum TreeViewMessages
+ {
+ TV_FIRST = 0x1100,
+ TVM_GETITEMRECT = (TV_FIRST + 4),
+ TVM_SETIMAGELIST = (TV_FIRST + 9),
+ TVM_HITTEST = (TV_FIRST + 17),
+ TVM_SORTCHILDRENCB = (TV_FIRST + 21),
+ TVM_GETITEMW = (TV_FIRST + 62),
+ TVM_SETITEMW = (TV_FIRST + 63),
+ TVM_INSERTITEMW = (TV_FIRST + 50)
+ }
+ #endregion
+
+ #region TreeViewImageListFlags
+ public enum TreeViewImageListFlags
+ {
+ TVSIL_NORMAL = 0,
+ TVSIL_STATE = 2
+ }
+ #endregion
+
+ #region TreeViewItem Flags
+ [Flags]
+ public enum TreeViewItemFlags
+ {
+ TVIF_NONE = 0x0000,
+ TVIF_TEXT = 0x0001,
+ TVIF_IMAGE = 0x0002,
+ TVIF_PARAM = 0x0004,
+ TVIF_STATE = 0x0008,
+ TVIF_HANDLE = 0x0010,
+ TVIF_SELECTEDIMAGE = 0x0020,
+ TVIF_CHILDREN = 0x0040,
+ TVIF_INTEGRAL = 0x0080,
+ I_CHILDRENCALLBACK = -1,
+ LPSTR_TEXTCALLBACK = -1,
+ I_IMAGECALLBACK = -1,
+ I_IMAGENONE = -2
+ }
+ #endregion
+
+ #region ListViewItem flags
+ public enum ListViewItemFlags
+ {
+ LVIF_TEXT = 0x0001,
+ LVIF_IMAGE = 0x0002,
+ LVIF_PARAM = 0x0004,
+ LVIF_STATE = 0x0008,
+ LVIF_INDENT = 0x0010,
+ LVIF_NORECOMPUTE = 0x0800
+ }
+ #endregion
+
+ #region HeaderItem flags
+ public enum HeaderItemFlags
+ {
+ HDI_WIDTH = 0x0001,
+ HDI_HEIGHT = HDI_WIDTH,
+ HDI_TEXT = 0x0002,
+ HDI_FORMAT = 0x0004,
+ HDI_LPARAM = 0x0008,
+ HDI_BITMAP = 0x0010,
+ HDI_IMAGE = 0x0020,
+ HDI_DI_SETITEM = 0x0040,
+ HDI_ORDER = 0x0080
+ }
+ #endregion
+
+ #region GetDCExFlags
+ public enum GetDCExFlags
+ {
+ DCX_WINDOW = 0x00000001,
+ DCX_CACHE = 0x00000002,
+ DCX_NORESETATTRS = 0x00000004,
+ DCX_CLIPCHILDREN = 0x00000008,
+ DCX_CLIPSIBLINGS = 0x00000010,
+ DCX_PARENTCLIP = 0x00000020,
+ DCX_EXCLUDERGN = 0x00000040,
+ DCX_INTERSECTRGN = 0x00000080,
+ DCX_EXCLUDEUPDATE = 0x00000100,
+ DCX_INTERSECTUPDATE = 0x00000200,
+ DCX_LOCKWINDOWUPDATE = 0x00000400,
+ DCX_VALIDATE = 0x00200000
+ }
+ #endregion
+
+ #region HitTest
+ public enum HitTest
+ {
+ HTERROR = (-2),
+ HTTRANSPARENT = (-1),
+ HTNOWHERE = 0,
+ HTCLIENT = 1,
+ HTCAPTION = 2,
+ HTSYSMENU = 3,
+ HTGROWBOX = 4,
+ HTSIZE = HTGROWBOX,
+ HTMENU = 5,
+ HTHSCROLL = 6,
+ HTVSCROLL = 7,
+ HTMINBUTTON = 8,
+ HTMAXBUTTON = 9,
+ HTLEFT = 10,
+ HTRIGHT = 11,
+ HTTOP = 12,
+ HTTOPLEFT = 13,
+ HTTOPRIGHT = 14,
+ HTBOTTOM = 15,
+ HTBOTTOMLEFT = 16,
+ HTBOTTOMRIGHT = 17,
+ HTBORDER = 18,
+ HTREDUCE = HTMINBUTTON,
+ HTZOOM = HTMAXBUTTON,
+ HTSIZEFIRST = HTLEFT,
+ HTSIZELAST = HTBOTTOMRIGHT,
+ HTOBJECT = 19,
+ HTCLOSE = 20,
+ HTHELP = 21
+ }
+ #endregion
+
+ #region ActivateFlags
+ public enum ActivateState
+ {
+ WA_INACTIVE = 0,
+ WA_ACTIVE = 1,
+ WA_CLICKACTIVE = 2
+ }
+ #endregion
+
+ #region StrechModeFlags
+ public enum StrechModeFlags
+ {
+ BLACKONWHITE = 1,
+ WHITEONBLACK = 2,
+ COLORONCOLOR = 3,
+ HALFTONE = 4,
+ MAXSTRETCHBLTMODE = 4
+ }
+ #endregion
+
+ #region ScrollBarFlags
+ public enum ScrollBarFlags
+ {
+ SBS_HORZ = 0x0000,
+ SBS_VERT = 0x0001,
+ SBS_TOPALIGN = 0x0002,
+ SBS_LEFTALIGN = 0x0002,
+ SBS_BOTTOMALIGN = 0x0004,
+ SBS_RIGHTALIGN = 0x0004,
+ SBS_SIZEBOXTOPLEFTALIGN = 0x0002,
+ SBS_SIZEBOXBOTTOMRIGHTALIGN = 0x0004,
+ SBS_SIZEBOX = 0x0008,
+ SBS_SIZEGRIP = 0x0010
+ }
+ #endregion
+
+ #region System Metrics Codes
+ public enum SystemMetricsCodes
+ {
+ 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 = SM_CXDLGFRAME,
+ SM_CYFIXEDFRAME = SM_CYDLGFRAME,
+ SM_CXSIZEFRAME = SM_CXFRAME,
+ SM_CYSIZEFRAME = SM_CYFRAME,
+ 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
+ }
+ #endregion
+
+ #region ScrollBarTypes
+ public enum ScrollBarTypes
+ {
+ SB_HORZ = 0,
+ SB_VERT = 1,
+ SB_CTL = 2,
+ SB_BOTH = 3
+ }
+ #endregion
+
+ #region SrollBarInfoFlags
+ public enum ScrollBarInfoFlags
+ {
+ SIF_RANGE = 0x0001,
+ SIF_PAGE = 0x0002,
+ SIF_POS = 0x0004,
+ SIF_DISABLENOSCROLL = 0x0008,
+ SIF_TRACKPOS = 0x0010,
+ SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
+ }
+ #endregion
+
+ #region Enable ScrollBar flags
+ public enum EnableScrollBarFlags
+ {
+ ESB_ENABLE_BOTH = 0x0000,
+ ESB_DISABLE_BOTH = 0x0003,
+ ESB_DISABLE_LEFT = 0x0001,
+ ESB_DISABLE_RIGHT = 0x0002,
+ ESB_DISABLE_UP = 0x0001,
+ ESB_DISABLE_DOWN = 0x0002,
+ ESB_DISABLE_LTUP = ESB_DISABLE_LEFT,
+ ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT
+ }
+ #endregion
+
+ #region Scroll Requests
+ public enum ScrollBarRequests
+ {
+ SB_LINEUP = 0,
+ SB_LINELEFT = 0,
+ SB_LINEDOWN = 1,
+ SB_LINERIGHT = 1,
+ SB_PAGEUP = 2,
+ SB_PAGELEFT = 2,
+ SB_PAGEDOWN = 3,
+ SB_PAGERIGHT = 3,
+ SB_THUMBPOSITION = 4,
+ SB_THUMBTRACK = 5,
+ SB_TOP = 6,
+ SB_LEFT = 6,
+ SB_BOTTOM = 7,
+ SB_RIGHT = 7,
+ SB_ENDSCROLL = 8
+ }
+ #endregion
+
+ #region SrollWindowEx flags
+ public enum ScrollWindowExFlags
+ {
+ SW_SCROLLCHILDREN = 0x0001,
+ SW_INVALIDATE = 0x0002,
+ SW_ERASE = 0x0004,
+ SW_SMOOTHSCROLL = 0x0010
+ }
+ #endregion
+
+ #region ImageListFlags
+ public enum ImageListFlags
+ {
+ ILC_MASK = 0x0001,
+ ILC_COLOR = 0x0000,
+ ILC_COLORDDB = 0x00FE,
+ ILC_COLOR4 = 0x0004,
+ ILC_COLOR8 = 0x0008,
+ ILC_COLOR16 = 0x0010,
+ ILC_COLOR24 = 0x0018,
+ ILC_COLOR32 = 0x0020,
+ ILC_PALETTE = 0x0800
+ }
+ #endregion
+
+ #region ImageListDrawFlags
+ public enum ImageListDrawFlags
+ {
+ ILD_NORMAL = 0x0000,
+ ILD_TRANSPARENT = 0x0001,
+ ILD_MASK = 0x0010,
+ ILD_IMAGE = 0x0020,
+ ILD_ROP = 0x0040,
+ ILD_BLEND25 = 0x0002,
+ ILD_BLEND50 = 0x0004,
+ ILD_OVERLAYMASK = 0x0F00
+ }
+ #endregion
+
+ #region List View Notifications
+ public enum ListViewNotifications
+ {
+ LVN_FIRST = (0-100),
+ LVN_GETDISPINFOW = (LVN_FIRST-77),
+ LVN_SETDISPINFOA = (LVN_FIRST-51)
+ }
+ #endregion
+
+ #region Drive Type
+ public enum DriveType
+ {
+ DRIVE_UNKNOWN = 0,
+ DRIVE_NO_ROOT_DIR = 1,
+ DRIVE_REMOVABLE = 2,
+ DRIVE_FIXED = 3,
+ DRIVE_REMOTE = 4,
+ DRIVE_CDROM = 5,
+ DRIVE_RAMDISK = 6
+ }
+ #endregion
+
+ #region Shell File Info Flags
+ public enum ShellFileInfoFlags
+ {
+ SHGFI_ICON = 0x000000100,
+ SHGFI_DISPLAYNAME = 0x000000200,
+ SHGFI_TYPENAME = 0x000000400,
+ SHGFI_ATTRIBUTES = 0x000000800,
+ SHGFI_ICONLOCATION = 0x000001000,
+ SHGFI_EXETYPE = 0x000002000,
+ SHGFI_SYSICONINDEX = 0x000004000,
+ SHGFI_LINKOVERLAY = 0x000008000,
+ SHGFI_SELECTED = 0x000010000,
+ SHGFI_ATTR_SPECIFIED = 0x000020000,
+ SHGFI_LARGEICON = 0x000000000,
+ SHGFI_SMALLICON = 0x000000001,
+ SHGFI_OPENICON = 0x000000002,
+ SHGFI_SHELLICONSIZE = 0x000000004,
+ SHGFI_PIDL = 0x000000008,
+ SHGFI_USEFILEATTRIBUTES = 0x000000010
+ }
+ #endregion
+
+ #region Shell Special Folder
+ public enum ShellSpecialFolder
+ {
+ CSIDL_DESKTOP = 0x0000,
+ CSIDL_INTERNET = 0x0001,
+ CSIDL_PROGRAMS = 0x0002,
+ CSIDL_CONTROLS = 0x0003,
+ CSIDL_PRINTERS = 0x0004,
+ CSIDL_PERSONAL = 0x0005,
+ CSIDL_FAVORITES = 0x0006,
+ CSIDL_STARTUP = 0x0007,
+ CSIDL_RECENT = 0x0008,
+ CSIDL_SENDTO = 0x0009,
+ CSIDL_BITBUCKET = 0x000a,
+ CSIDL_STARTMENU = 0x000b,
+ CSIDL_DESKTOPDIRECTORY = 0x0010,
+ CSIDL_DRIVES = 0x0011,
+ CSIDL_NETWORK = 0x0012,
+ CSIDL_NETHOOD = 0x0013,
+ CSIDL_FONTS = 0x0014,
+ CSIDL_TEMPLATES = 0x0015,
+ CSIDL_COMMON_STARTMENU = 0x0016,
+ CSIDL_COMMON_PROGRAMS = 0X0017,
+ CSIDL_COMMON_STARTUP = 0x0018,
+ CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019,
+ CSIDL_APPDATA = 0x001a,
+ CSIDL_PRINTHOOD = 0x001b,
+ CSIDL_ALTSTARTUP = 0x001d,
+ CSIDL_COMMON_ALTSTARTUP = 0x001e,
+ CSIDL_COMMON_FAVORITES = 0x001f,
+ CSIDL_INTERNET_CACHE = 0x0020,
+ CSIDL_COOKIES = 0x0021,
+ CSIDL_HISTORY = 0x0022
+ }
+ #endregion
+
+ #region ShellEnumFlags
+ [Flags]
+ public enum ShellEnumFlags
+ {
+ SHCONTF_FOLDERS = 32, // for shell browser
+ SHCONTF_NONFOLDERS = 64, // for default view
+ SHCONTF_INCLUDEHIDDEN = 128, // for hidden/system objects
+ }
+ #endregion
+
+ #region ShellGetDisplayNameOfFlags
+ [Flags]
+ public enum ShellGetDisplayNameOfFlags
+ {
+ SHGDN_NORMAL = 0, // default (display purpose)
+ SHGDN_INFOLDER = 1, // displayed under a folder (relative)
+ SHGDN_INCLUDE_NONFILESYS = 0x2000, // if not set, display names for shell name space items that are not in the file system will fail.
+ SHGDN_FORADDRESSBAR = 0x4000, // for displaying in the address (drives dropdown) bar
+ SHGDN_FORPARSING = 0x8000, // for ParseDisplayName or path
+ }
+ #endregion
+
+ #region STRRETFlags
+ [Flags]
+ public enum STRRETFlags
+ {
+ STRRET_WSTR = 0x0000, // Use STRRET.pOleStr
+ STRRET_OFFSET = 0x0001, // Use STRRET.uOffset to Ansi
+ STRRET_CSTR = 0x0002 // Use STRRET.cStr
+ }
+ #endregion
+
+ #region GetAttributeOfFlags
+ [Flags]
+ public enum GetAttributeOfFlags : long
+ {
+ DROPEFFECT_NONE = 0,
+ DROPEFFECT_COPY = 1,
+ DROPEFFECT_MOVE = 2,
+ DROPEFFECT_LINK = 4,
+ DROPEFFECT_SCROLL = 0x80000000,
+ SFGAO_CANCOPY = DROPEFFECT_COPY, // Objects can be copied
+ SFGAO_CANMOVE = DROPEFFECT_MOVE, // Objects can be moved
+ SFGAO_CANLINK = DROPEFFECT_LINK, // Objects can be linked
+ SFGAO_CANRENAME = 0x00000010, // Objects can be renamed
+ SFGAO_CANDELETE = 0x00000020, // Objects can be deleted
+ SFGAO_HASPROPSHEET = 0x00000040, // Objects have property sheets
+ SFGAO_DROPTARGET = 0x00000100, // Objects are drop target
+ SFGAO_CAPABILITYMASK = 0x00000177,
+ SFGAO_LINK = 0x00010000, // Shortcut (link)
+ SFGAO_SHARE = 0x00020000, // shared
+ SFGAO_READONLY = 0x00040000, // read-only
+ SFGAO_GHOSTED = 0x00080000, // ghosted icon
+ SFGAO_HIDDEN = 0x00080000, // hidden object
+ SFGAO_DISPLAYATTRMASK = 0x000F0000,
+ SFGAO_FILESYSANCESTOR = 0x10000000, // It contains file system folder
+ SFGAO_FOLDER = 0x20000000, // It's a folder.
+ SFGAO_FILESYSTEM = 0x40000000, // is a file system thing (file/folder/root)
+ SFGAO_HASSUBFOLDER = 0x80000000, // Expandable in the map pane
+ SFGAO_CONTENTSMASK = 0x80000000,
+ SFGAO_VALIDATE = 0x01000000, // invalidate cached information
+ SFGAO_REMOVABLE = 0x02000000, // is this removeable media?
+ SFGAO_COMPRESSED = 0x04000000, // Object is compressed (use alt color)
+ SFGAO_BROWSABLE = 0x08000000, // is in-place browsable
+ SFGAO_NONENUMERATED = 0x00100000, // is a non-enumerated object
+ SFGAO_NEWCONTENT = 0x00200000 // should show bold in explorer tree
+ }
+ #endregion
+
+ #region ListViewItemState
+ public enum ListViewItemState
+ {
+ LVIS_FOCUSED = 0x0001,
+ LVIS_SELECTED = 0x0002,
+ LVIS_CUT = 0x0004,
+ LVIS_DROPHILITED = 0x0008,
+ LVIS_ACTIVATING = 0x0020,
+ LVIS_OVERLAYMASK = 0x0F00,
+ LVIS_STATEIMAGEMASK = 0xF000
+ }
+ #endregion
+
+ #region TreeViewItemInsertPosition
+ public enum TreeViewItemInsertPosition : long
+ {
+ TVI_ROOT = 0xFFFF0000,
+ TVI_FIRST = 0xFFFF0001,
+ TVI_LAST = 0xFFFF0002,
+ TVI_SORT = 0xFFFF0003
+ }
+ #endregion
+
+ #region TreeViewNotifications
+ public enum TreeViewNotifications
+ {
+ TVN_FIRST = -400,
+ TVN_SELCHANGINGA =(TVN_FIRST-1),
+ TVN_SELCHANGINGW =(TVN_FIRST-50),
+ TVN_SELCHANGEDA =(TVN_FIRST-2),
+ TVN_SELCHANGEDW =(TVN_FIRST-51),
+ TVN_GETDISPINFOA =(TVN_FIRST-3),
+ TVN_GETDISPINFOW =(TVN_FIRST-52),
+ TVN_SETDISPINFOA =(TVN_FIRST-4),
+ TVN_SETDISPINFOW =(TVN_FIRST-53),
+ TVN_ITEMEXPANDINGA = (TVN_FIRST-5),
+ TVN_ITEMEXPANDINGW = (TVN_FIRST-54),
+ TVN_ITEMEXPANDEDA = (TVN_FIRST-6),
+ TVN_ITEMEXPANDEDW = (TVN_FIRST-55),
+ TVN_BEGINDRAGA = (TVN_FIRST-7),
+ TVN_BEGINDRAGW = (TVN_FIRST-56),
+ TVN_BEGINRDRAGA = (TVN_FIRST-8),
+ TVN_BEGINRDRAGW = (TVN_FIRST-57),
+ TVN_DELETEITEMA = (TVN_FIRST-9),
+ TVN_DELETEITEMW = (TVN_FIRST-58),
+ TVN_BEGINLABELEDITA = (TVN_FIRST-10),
+ TVN_BEGINLABELEDITW = (TVN_FIRST-59),
+ TVN_ENDLABELEDITA = (TVN_FIRST-11),
+ TVN_ENDLABELEDITW = (TVN_FIRST-60),
+ TVN_KEYDOWN = (TVN_FIRST-12),
+ TVN_GETINFOTIPA = (TVN_FIRST-13),
+ TVN_GETINFOTIPW = (TVN_FIRST-14),
+ TVN_SINGLEEXPAND = (TVN_FIRST-15)
+ }
+ #endregion
+
+ #region TreeViewItemExpansion
+ public enum TreeViewItemExpansion
+ {
+ TVE_COLLAPSE = 0x0001,
+ TVE_EXPAND = 0x0002,
+ TVE_TOGGLE = 0x0003,
+ TVE_EXPANDPARTIAL = 0x4000,
+ TVE_COLLAPSERESET = 0x8000
+ }
+ #endregion
+
+ #region WinErrors
+ public enum WinErrors
+ {
+ NOERROR = 0x00000000
+ }
+ #endregion
+
+ #region TreeViewHitTest
+ public enum TreeViewHitTestFlags
+ {
+ TVHT_NOWHERE = 0x0001,
+ TVHT_ONITEMICON = 0x0002,
+ TVHT_ONITEMLABEL = 0x0004,
+ TVHT_ONITEM = (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON),
+ TVHT_ONITEMINDENT = 0x0008,
+ TVHT_ONITEMBUTTON = 0x0010,
+ TVHT_ONITEMRIGHT = 0x0020,
+ TVHT_ONITEMSTATEICON = 0x0040,
+ TVHT_ABOVE = 0x0100,
+ TVHT_BELOW = 0x0200,
+ TVHT_TORIGHT = 0x0400,
+ TVHT_TOLEFT = 0x0800
+ }
+ #endregion
+
+ #region TreeViewItemState
+ public enum TreeViewItemState
+ {
+ TVIS_SELECTED = 0x0002,
+ TVIS_CUT = 0x0004,
+ TVIS_DROPHILITED = 0x0008,
+ TVIS_BOLD = 0x0010,
+ TVIS_EXPANDED = 0x0020,
+ TVIS_EXPANDEDONCE = 0x0040,
+ TVIS_EXPANDPARTIAL = 0x0080,
+ TVIS_OVERLAYMASK = 0x0F00,
+ TVIS_STATEIMAGEMASK = 0xF000,
+ TVIS_USERMASK = 0xF000
+ }
+ #endregion
+
+ #region Windows System Objects
+ public enum SystemObject : long
+ {
+ // Reserved IDs for system objects
+ OBJID_WINDOW = 0x00000000,
+ OBJID_SYSMENU = 0xFFFFFFFF,
+ OBJID_TITLEBAR = 0xFFFFFFFE,
+ OBJID_MENU = 0xFFFFFFFD,
+ OBJID_CLIENT = 0xFFFFFFFC,
+ OBJID_VSCROLL = 0xFFFFFFFB,
+ OBJID_HSCROLL = 0xFFFFFFFA,
+ OBJID_SIZEGRIP = 0xFFFFFFF9,
+ OBJID_CARET = 0xFFFFFFF8,
+ OBJID_CURSOR = 0xFFFFFFF7,
+ OBJID_ALERT = 0xFFFFFFF6,
+ OBJID_SOUND = 0xFFFFFFF5
+ }
+ #endregion
+
+ #region SystemState
+ public enum SystemState
+ {
+ STATE_SYSTEM_UNAVAILABLE = 0x00000001, // Disabled
+ STATE_SYSTEM_SELECTED = 0x00000002,
+ STATE_SYSTEM_FOCUSED = 0x00000004,
+ STATE_SYSTEM_PRESSED = 0x00000008,
+ STATE_SYSTEM_CHECKED = 0x00000010,
+ STATE_SYSTEM_MIXED = 0x00000020, // 3-state checkbox or toolbar button
+ STATE_SYSTEM_READONLY = 0x00000040,
+ STATE_SYSTEM_HOTTRACKED = 0x00000080,
+ STATE_SYSTEM_DEFAULT = 0x00000100,
+ STATE_SYSTEM_EXPANDED = 0x00000200,
+ STATE_SYSTEM_COLLAPSED = 0x00000400,
+ STATE_SYSTEM_BUSY = 0x00000800,
+ STATE_SYSTEM_FLOATING = 0x00001000, // Children "owned" not "contained" by parent
+ STATE_SYSTEM_MARQUEED = 0x00002000,
+ STATE_SYSTEM_ANIMATED = 0x00004000,
+ STATE_SYSTEM_INVISIBLE = 0x00008000,
+ STATE_SYSTEM_OFFSCREEN = 0x00010000,
+ STATE_SYSTEM_SIZEABLE = 0x00020000,
+ STATE_SYSTEM_MOVEABLE = 0x00040000,
+ STATE_SYSTEM_SELFVOICING = 0x00080000,
+ STATE_SYSTEM_FOCUSABLE = 0x00100000,
+ STATE_SYSTEM_SELECTABLE = 0x00200000,
+ STATE_SYSTEM_LINKED = 0x00400000,
+ STATE_SYSTEM_TRAVERSED = 0x00800000,
+ STATE_SYSTEM_MULTISELECTABLE = 0x01000000, // Supports multiple selection
+ STATE_SYSTEM_EXTSELECTABLE = 0x02000000, // Supports extended selection
+ STATE_SYSTEM_ALERT_LOW = 0x04000000, // This information is of low priority
+ STATE_SYSTEM_ALERT_MEDIUM = 0x08000000, // This information is of medium priority
+ STATE_SYSTEM_ALERT_HIGH = 0x10000000, // This information is of high priority
+ STATE_SYSTEM_VALID = 0x1FFFFFFF
+ }
+ #endregion
+
+ #region QueryContextMenuFlags
+ public enum QueryContextMenuFlags : long
+ {
+ CMF_NORMAL = 0x00000000,
+ CMF_DEFAULTONLY = 0x00000001,
+ CMF_VERBSONLY = 0x00000002,
+ CMF_EXPLORE = 0x00000004,
+ CMF_NOVERBS = 0x00000008,
+ CMF_CANRENAME = 0x00000010,
+ CMF_NODEFAULT = 0x00000020,
+ CMF_INCLUDESTATIC = 0x00000040,
+ CMF_RESERVED = 0xffff0000
+ }
+ #endregion
+
+ #region GetWindowLongFlag
+ public enum GetWindowLongFlag
+ {
+ GWL_WNDPROC = (-4),
+ GWL_HINSTANCE = (-6),
+ GWL_HWNDPARENT = (-8),
+ GWL_STYLE = (-16),
+ GWL_EXSTYLE = (-20),
+ GWL_USERDATA = (-21),
+ GWL_ID = (-12)
+ }
+ #endregion
+
+ #region CommonControlMessages
+ public enum CommonControlMessages
+ {
+ CCM_FIRST = 0x2000, // Common control shared messages
+ CCM_SETBKCOLOR = (CCM_FIRST + 1), // lParam is bkColor
+ CCM_SETCOLORSCHEME = (CCM_FIRST + 2), // lParam is color scheme
+ CCM_GETCOLORSCHEME = (CCM_FIRST + 3), // fills in COLORSCHEME pointed to by lParam
+ CCM_GETDROPTARGET = (CCM_FIRST + 4),
+ CCM_SETUNICODEFORMAT = (CCM_FIRST + 5),
+ CCM_GETUNICODEFORMAT = (CCM_FIRST + 6),
+ CCM_SETVERSION = (CCM_FIRST + 7)
+ }
+ #endregion
+
+ #region PenStyle
+ public enum PenStyle
+ {
+ 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
+ }
+ #endregion
+
+ #region ImageListDrawColor
+ public enum ImageListDrawColor
+ {
+ None,
+ Default
+ }
+ #endregion
+
+ #region ImageList Draw Colors
+ internal enum ImageListDrawColors : uint
+ {
+ CLR_NONE = 0xFFFFFFFF,
+ CLR_DEFAULT = 0xFF000000
+ }
+ #endregion
+
+ #region WM_SIZE_Param_Values
+ public enum WM_SIZE_Param_Values
+ {
+ SIZE_RESTORED = 0,
+ SIZE_MINIMIZED = 1,
+ SIZE_MAXIMIZED = 2,
+ SIZE_MAXSHOW = 3,
+ SIZE_MAXHIDE = 4
+ }
+ #endregion
+
+ #region WMSizingMessage
+ public enum WM_Sizing_Message_Param_Values {
+ /* wParam for WM_SIZING message */
+ WMSZ_LEFT = 1,
+ WMSZ_RIGHT = 2,
+ WMSZ_TOP = 3,
+ WMSZ_TOPLEFT = 4,
+ WMSZ_TOPRIGHT = 5,
+ WMSZ_BOTTOM = 6,
+ WMSZ_BOTTOMLEFT = 7,
+ WMSZ_BOTTOMRIGHT = 8
+}
+ #endregion WMSizingMessage
+
+ /* Win32 4.0 messages for IME */
+// internal const uint IME_SETCONTEXT = 0x0281;
+// internal const uint IME_NOTIFY = 0x0282;
+// internal const uint IME_CONTROL = 0x0283;
+// internal const uint IME_COMPOSITIONFULL = 0x0284;
+// internal const uint IME_SELECT = 0x0285;
+// internal const uint IME_CHAR = 0x0286;
+// /* Win32 5.0 messages for IME */
+// internal const uint IME_REQUEST = 0x0288;
+//
+// /* Win32 4.0 messages for IME */
+// internal const uint IME_KEYDOWN = 0x0290;
+// internal const uint IME_KEYUP = 0x0291;
+
+ #region CS_Types
+ [Flags]
+ internal enum CS_ {
+ CS_VREDRAW = 0x0001,
+ CS_HREDRAW = 0x0002,
+ CS_KEYCVTWINDOW = 0x0004,
+ CS_DBLCLKS = 0x0008,
+ CS_OWNDC = 0x0020,
+ CS_CLASSDC = 0x0040,
+ CS_PARENTDC = 0x0080,
+ CS_NOKEYCVT = 0x0100,
+ CS_NOCLOSE = 0x0200,
+ CS_SAVEBITS = 0x0800,
+ CS_BYTEALIGNCLIENT = 0x1000,
+ CS_BYTEALIGNWINDOW = 0x2000,
+ CS_GLOBALCLASS = 0x4000,
+ CS_IME = 0x00010000
+ }
+ #endregion
+
+ #region PeekMessage
+ internal enum PeekMessage {
+ // PeekMessage types
+ PM_NOREMOVE = 0x0000,
+ PM_REMOVE = 0x0001,
+ PM_NOYIELD = 0x0002
+ }
+ #endregion
+
+ #region WB_MessageBox_Types
+ internal enum WB_MessageBox_Types {
+ // MessageBox types
+ MB_OK = 0x00000000,
+ MB_OKCANCEL = 0x00000001,
+ MB_ABORTRETRYIGNORE = 0x00000002,
+ MB_YESNOCANCEL = 0x00000003,
+ MB_YESNO = 0x00000004,
+ MB_RETRYCANCEL = 0x00000005,
+ MB_TYPEMASK = 0x0000000F
+ }
+ #endregion
+
+ #region Static Contreol Types
+ internal enum SS_Static_Control_Types {
+ // Static Control Styles
+ SS_LEFT = 0x00000000,
+ SS_CENTER = 0x00000001,
+ SS_RIGHT = 0x00000002,
+ SS_ICON = 0x00000003,
+ SS_BLACKRECT = 0x00000004,
+ SS_GRAYRECT = 0x00000005,
+ SS_WHITERECT = 0x00000006,
+ SS_BLACKFRAME = 0x00000007,
+ SS_GRAYFRAME = 0x00000008,
+ SS_WHITEFRAME = 0x00000009,
+
+ SS_SIMPLE = 0x0000000B,
+ SS_LEFTNOWORDWRAP = 0x0000000C,
+
+ SS_OWNERDRAW = 0x0000000D,
+ SS_BITMAP = 0x0000000E,
+ SS_ENHMETAFILE = 0x0000000F,
+
+ SS_ETCHEDHORZ = 0x00000010,
+ SS_ETCHEDVERT = 0x00000011,
+ SS_ETCHEDFRAME = 0x00000012,
+ SS_TYPEMASK = 0x0000001F,
+
+ SS_NOPREFIX = 0x00000080,
+ SS_NOTIFY = 0x00000100,
+ SS_CENTERIMAGE = 0x00000200,
+ SS_RIGHTJUST = 0x00000400,
+ SS_REALSIZEIMAGE = 0x00000800,
+ SS_SUNKEN = 0x00001000
+ }
+ #endregion
+
+ #region WF_
+ internal enum MF_ {
+ MF_INSERT = 0x0,
+ MF_CHANGE = 0x80,
+ MF_APPEND = 0x100,
+ MF_DELETE = 0x200,
+ MF_REMOVE = 0x1000,
+ MF_BYCOMMAND = 0,
+ MF_BYPOSITION = 0x400,
+ MF_SEPARATOR = 0x800,
+ MF_ENABLED = 0,
+ MF_GRAYED = 1,
+ MF_DISABLED = 2,
+ MF_UNCHECKED = 0,
+ MF_CHECKED = 8,
+ MF_USECHECKBITMAPS = 0x200,
+ MF_STRING = 0,
+ MF_BITMAP = 4,
+ MF_OWNERDRAW = 0x100,
+ MF_POPUP = 0x10,
+ MF_MENUBARBREAK = 0x20,
+ MF_MENUBREAK = 0x40,
+ MF_UNHILITE = 0,
+ MF_HILITE = 0x80,
+ MF_DEFAULT = 0x1000,
+ MF_SYSMENU = 0x2000,
+ MF_HELP = 0x4000,
+ MF_RIGHTJUSTIFY = 0x4000
+ }
+ #endregion
+
+ internal enum FM_ {
+ FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x100,
+ FORMAT_MESSAGE_IGNORE_INSERTS = 0x200,
+ FORMAT_MESSAGE_FROM_STRING = 0x400,
+ FORMAT_MESSAGE_FROM_HMODULE = 0x800,
+ FORMAT_MESSAGE_FROM_SYSTEM = 0x1000,
+ FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x2000,
+ FORMAT_MESSAGE_MAX_WIDTH_MASK = 0xFF
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Handles.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Handles.cs
new file mode 100644
index 00000000000..78db30fc2fd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Handles.cs
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 5/11/2002 Carlos Harvey Perez
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.
+ * IN NO EVENT SHALL CARLOS HARVEY PEREZ BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Carlos Harvey Perez
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from Carlos Harvey Perez.
+ */
+
+using System;
+
+//namespace UtilityLibrary.Win32
+namespace System.Windows.Forms{
+ internal class ShellHandle : IDisposable
+ {
+ #region Class Variables
+ IntPtr handle = IntPtr.Zero;
+ #endregion
+
+ #region Constructors
+ // Can only be used as base classes
+ internal ShellHandle(IntPtr handle)
+ {
+ this.handle = handle;
+ }
+
+ ~ShellHandle()
+ {
+ Dispose(false);
+ }
+ #endregion
+
+ #region Properties
+ internal IntPtr Handle
+ {
+ get { return handle; }
+ }
+
+ #endregion
+
+ #region Virtuals
+ internal virtual void Dispose(bool disposing)
+ {
+ // This class encapsulate a PIDL handle that
+ // it is allocated my the Shell Memory Manager
+ // it needs to be deallocated by the Shell Memory Manager
+ // interface too
+
+ // To avoid threads simultaneously releasing this resource
+ lock (this)
+ {
+
+ if ( handle != IntPtr.Zero )
+ {
+ // If we have a valid handle
+ // Release pointer that was allocated by the COM memory allocator
+ Win32.SHFreeMalloc(handle);
+ handle = IntPtr.Zero;
+ }
+ }
+ }
+ #endregion
+
+ #region Methods
+ // Implements the IDisposable Interface
+ public void Dispose()
+ {
+ // Let the Garbage Collector know that it does
+ // not need to call finalize for this class
+ GC.SuppressFinalize(this);
+
+ // Do the disposing
+ Dispose(true);
+ }
+ #endregion
+
+ }
+
+ internal class COMInterface : IDisposable
+ {
+ #region Class Variables
+ internal IUnknown iUnknown = null;
+ #endregion
+
+ #region Constructors
+ // Can only be used as base classes
+ internal COMInterface(IUnknown iUnknown)
+ {
+ this.iUnknown = iUnknown;
+ }
+
+ ~COMInterface()
+ {
+ Dispose(false);
+ }
+ #endregion
+
+ #region Properties
+ #endregion
+
+ #region Virtuals
+ protected virtual void Dispose(bool disposing)
+ {
+ // Release the reference to this interface
+ lock(this)
+ {
+ if ( iUnknown != null )
+ {
+ iUnknown.Release();
+ iUnknown = null;
+ }
+ }
+ }
+ #endregion
+
+ #region Methods
+ // Implements the IDisposable Interface
+ public void Dispose()
+ {
+ // Let the Garbage Collector know that it does
+ // not need to call finalize for this class
+ GC.SuppressFinalize(this);
+
+ // Do the disposing
+ Dispose(true);
+ }
+ #endregion
+
+ }
+
+ internal class GdiHandle : IDisposable
+ {
+ #region Class Variables
+ IntPtr handle = IntPtr.Zero;
+ #endregion
+
+ #region Constructors
+ // Can only be used as base classes
+ protected GdiHandle(IntPtr handle)
+ {
+ this.handle = handle;
+ }
+
+ ~GdiHandle()
+ {
+ Dispose(false);
+ }
+ #endregion
+
+ #region Properties
+ public IntPtr Handle
+ {
+ get { return handle; }
+ }
+
+ #endregion
+
+ #region Virtuals
+ protected virtual void Dispose(bool disposing)
+ {
+ // To avoid threads simultaneously releasing this resource
+ lock (this)
+ {
+
+ if ( handle != IntPtr.Zero )
+ {
+ // If we have a valid handle
+ // Destroy the handle
+ Win32.DeleteObject(handle);
+ handle = IntPtr.Zero;
+ }
+ }
+ }
+ #endregion
+
+ #region Methods
+ // Implements the IDisposable Interface
+ public void Dispose()
+ {
+ // Let the Garbage Collector know that it does
+ // not need to call finalize for this class
+ GC.SuppressFinalize(this);
+
+ // Do the disposing
+ Dispose(true);
+ }
+ #endregion
+
+ }
+
+
+
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Interfaces.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Interfaces.cs
new file mode 100644
index 00000000000..0939b003d30
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Interfaces.cs
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 5/11/2002 Carlos Harvey Perez
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.
+ * IN NO EVENT SHALL CARLOS HARVEY PEREZ BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Carlos Harvey Perez
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from Carlos Harvey Perez.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+
+//namespace UtilityLibrary.Win32
+namespace System.Windows.Forms{
+
+ #region IUnknown
+ [ComImport, Guid("00000000-0000-0000-c000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IUnknown
+ {
+ [PreserveSig]
+ IntPtr QueryInterface(REFIID riid, out IntPtr pVoid);
+
+ [PreserveSig]
+ IntPtr AddRef();
+
+ [PreserveSig]
+ IntPtr Release();
+ }
+ #endregion
+
+ #region IMalloc
+ [ComImport, Guid("00000002-0000-0000-C000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IMalloc
+ {
+ [PreserveSig]
+ IntPtr Alloc(int cb);
+
+ [PreserveSig]
+ IntPtr Realloc(IntPtr pv, int cb);
+
+ [PreserveSig]
+ void Free(IntPtr pv);
+
+ [PreserveSig]
+ int GetSize(IntPtr pv);
+
+ [PreserveSig]
+ int DidAlloc(IntPtr pv);
+
+ [PreserveSig]
+ void HeapMinimize();
+ }
+ #endregion
+
+ #region IShellFolder
+ [ComImport, Guid("000214E6-0000-0000-c000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellFolder
+ {
+ [PreserveSig]
+ int ParseDisplayName(IntPtr hWnd, IntPtr bindingContext,
+ IntPtr OLEString, out int chEaten, ref IntPtr idList, ref int attributes);
+
+ [PreserveSig]
+ int EnumObjects(IntPtr hWnd, ShellEnumFlags flags, ref IEnumIDList enumList);
+
+ [PreserveSig]
+ int BindToObject(IntPtr idList, IntPtr bindingContext, ref REFIID refiid, ref IShellFolder folder);
+
+ [PreserveSig]
+ int BindToStorage(ref IntPtr idList, IntPtr bindingContext, ref REFIID riid, IntPtr pVoid);
+
+ [PreserveSig]
+ int CompareIDs(int lparam, IntPtr idList1, IntPtr idList2);
+
+ [PreserveSig]
+ int CreateViewObject(IntPtr hWnd, REFIID riid, IntPtr pVoid);
+
+ [PreserveSig]
+ int GetAttributesOf(int count, ref IntPtr idList, out GetAttributeOfFlags attributes);
+
+ [PreserveSig]
+ int GetUIObjectOf(IntPtr hWnd, int count, ref IntPtr idList,
+ ref REFIID riid, out int arrayInOut, ref IUnknown iUnknown);
+
+ [PreserveSig]
+ int GetDisplayNameOf(IntPtr idList, ShellGetDisplayNameOfFlags flags, ref STRRET strRet);
+
+ [PreserveSig]
+ int SetNameOf(IntPtr hWnd, ref IntPtr idList,
+ IntPtr pOLEString, int flags, ref IntPtr pItemIDList);
+
+ }
+ #endregion
+
+ #region IEnumIDList
+ [ComImport, Guid("000214f2-0000-0000-c000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IEnumIDList
+ {
+ [PreserveSig]
+ int Next(int count, ref IntPtr idList, out int fetched);
+
+ [PreserveSig]
+ int Skip(int count);
+
+ [PreserveSig]
+ int Reset();
+
+ [PreserveSig]
+ int Clone(ref IEnumIDList list);
+ }
+ #endregion
+
+ #region IContextMenu
+ [ComImport, Guid("000214e4-0000-0000-c000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IContextMenu
+ {
+ [PreserveSig]
+ int QueryContextMenu(IntPtr hMenu, int indexMenu, int idFirstCommand, int idLastCommand, QueryContextMenuFlags flags);
+
+ [PreserveSig]
+ int InvokeCommand(ref CMINVOKECOMMANDINFO ici);
+
+ [PreserveSig]
+ int GetCommandString(int idCommand, int type, int reserved, string commandName, int cchMax);
+ }
+ #endregion
+
+ #region IContextMenu2
+ [ComImport, Guid("000214f4-0000-0000-c000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IContextMenu2
+ {
+
+ [PreserveSig]
+ int HandleMenuMsg(int message, int wParam, int lParam);
+ }
+ #endregion
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32RegistryUtil.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32RegistryUtil.cs
new file mode 100644
index 00000000000..22b881e5f85
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32RegistryUtil.cs
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 5/11/2002 Carlos Harvey Perez
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.
+ * IN NO EVENT SHALL CARLOS HARVEY PEREZ BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Carlos Harvey Perez
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from Carlos Harvey Perez.
+ */
+
+using System;
+using Microsoft.Win32;
+
+//namespace UtilityLibrary.Win32
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Summary description for Registry.
+ /// </summary>
+ public class RegistryUtil
+ {
+ #region Constructors
+ // No need to constructo this object
+ private RegistryUtil()
+ {
+ }
+ #endregion
+
+ #region Implementation
+ static public void WriteToRegistry(RegistryKey RegHive, string RegPath, string KeyName, string KeyValue)
+ {
+ // Split the registry path
+ string[] regStrings;
+ regStrings = RegPath.Split('\\');
+ // First item of array will be the base key, so be carefull iterating below
+ RegistryKey[] RegKey = new RegistryKey[regStrings.Length + 1];
+ RegKey[0] = RegHive;
+
+ for( int i = 0; i < regStrings.Length; i++ )
+ {
+ RegKey[i + 1] = RegKey[i].OpenSubKey(regStrings[i], true);
+ // If key does not exist, create it
+ if (RegKey[i + 1] == null)
+ {
+ RegKey[i + 1] = RegKey[i].CreateSubKey(regStrings[i]);
+ }
+ }
+
+ // Write the value to the registry
+ try
+ {
+ RegKey[regStrings.Length].SetValue(KeyName, KeyValue);
+ }
+ catch (System.NullReferenceException)
+ {
+ throw(new Exception("Null Reference"));
+ }
+ catch (System.UnauthorizedAccessException)
+ {
+ throw(new Exception("Unauthorized Access"));
+ }
+ }
+
+ static public string ReadFromRegistry(RegistryKey RegHive, string RegPath, string KeyName, string DefaultValue)
+ {
+ string[] regStrings;
+ string result = "";
+
+ regStrings = RegPath.Split('\\');
+ //First item of array will be the base key, so be carefull iterating below
+ RegistryKey[] RegKey = new RegistryKey[regStrings.Length + 1];
+ RegKey[0] = RegHive;
+
+ for( int i = 0; i < regStrings.Length; i++ )
+ {
+ RegKey[i + 1] = RegKey[i].OpenSubKey(regStrings[i]);
+ if (i == regStrings.Length - 1 )
+ {
+ result = (string)RegKey[i + 1].GetValue(KeyName, DefaultValue);
+ }
+ }
+ return result;
+ }
+
+ #endregion
+ }
+}
+
+
+
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Structs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Structs.cs
new file mode 100644
index 00000000000..8c955aa62b6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32Structs.cs
@@ -0,0 +1,732 @@
+/*
+ * Copyright (C) 5/11/2002 Carlos Harvey Perez
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.
+ * IN NO EVENT SHALL CARLOS HARVEY PEREZ BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Carlos Harvey Perez
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from Carlos Harvey Perez.
+ */
+
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Diagnostics;
+
+//namespace UtilityLibrary.Win32
+namespace System.Windows.Forms
+{
+
+ /// <summary>
+ /// Structures to interoperate with the Windows 32 API
+ /// </summary>
+
+ #region SIZE
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SIZE
+ {
+ internal int cx;
+ internal int cy;
+ }
+ #endregion
+
+ #region RECT
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct RECT
+ {
+ internal int left;
+ internal int top;
+ internal int right;
+ internal int bottom;
+ }
+ #endregion
+
+ #region INITCOMMONCONTROLSEX
+ [StructLayout(LayoutKind.Sequential, Pack=1)]
+ internal class INITCOMMONCONTROLSEX
+ {
+ internal int dwSize;
+ internal CommonControlInitFlags dwICC;
+ }
+ #endregion
+
+ #region TBBUTTON
+ [StructLayout(LayoutKind.Sequential, Pack=1)]
+ internal struct TBBUTTON
+ {
+ internal int iBitmap;
+ internal int idCommand;
+ internal byte fsState;
+ internal byte fsStyle;
+ internal byte bReserved0;
+ internal byte bReserved1;
+ internal int dwData;
+ internal int iString;
+ }
+ #endregion
+
+ #region POINT
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct POINT
+ {
+ internal int x;
+ internal int y;
+ }
+ #endregion
+
+ #region NMHDR
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMHDR
+ {
+ internal IntPtr hwndFrom;
+ internal int idFrom;
+ internal int code;
+ }
+ #endregion
+
+ #region TOOLTIPTEXTA
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
+ internal struct TOOLTIPTEXTA
+ {
+ internal NMHDR hdr;
+ internal IntPtr lpszText;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=80)]
+ internal string szText;
+ internal IntPtr hinst;
+ internal ToolTipFlags flags;
+ }
+ #endregion
+
+ #region TOOLTIPTEXT
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct TOOLTIPTEXT
+ {
+ internal NMHDR hdr;
+ internal IntPtr lpszText;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=80)]
+ internal string szText;
+ internal IntPtr hinst;
+ internal int uFlags;
+ }
+ #endregion
+
+ #region NMCUSTOMDRAW
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMCUSTOMDRAW
+ {
+ internal NMHDR hdr;
+ internal int dwDrawStage;
+ internal IntPtr hdc;
+ internal RECT rc;
+ internal int dwItemSpec;
+ internal int uItemState;
+ internal IntPtr lItemlParam;
+ }
+ #endregion
+
+ #region NMTBCUSTOMDRAW
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMTBCUSTOMDRAW
+ {
+ internal NMCUSTOMDRAW nmcd;
+ internal IntPtr hbrMonoDither;
+ internal IntPtr hbrLines;
+ internal IntPtr hpenLines;
+ internal int clrText;
+ internal int clrMark;
+ internal int clrTextHighlight;
+ internal int clrBtnFace;
+ internal int clrBtnHighlight;
+ internal int clrHighlightHotTrack;
+ internal RECT rcText;
+ internal int nStringBkMode;
+ internal int nHLStringBkMode;
+ }
+ #endregion
+
+ #region NMLVCUSTOMDRAW
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMLVCUSTOMDRAW
+ {
+ internal NMCUSTOMDRAW nmcd;
+ internal int clrText;
+ internal int clrTextBk;
+ internal int iSubItem;
+ }
+ #endregion
+
+ #region TBBUTTONINFO
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct TBBUTTONINFO
+ {
+ internal int cbSize;
+ internal int dwMask;
+ internal int idCommand;
+ internal int iImage;
+ internal byte fsState;
+ internal byte fsStyle;
+ internal short cx;
+ internal IntPtr lParam;
+ internal IntPtr pszText;
+ internal int cchText;
+ }
+ #endregion
+
+ #region REBARBANDINFO
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct REBARBANDINFO
+ {
+ internal int cbSize;
+ internal RebarInfoMask fMask;
+ internal RebarStylesEx fStyle;
+ internal int clrFore;
+ internal int clrBack;
+ internal IntPtr lpText;
+ internal int cch;
+ internal int iImage;
+ internal IntPtr hwndChild;
+ internal int cxMinChild;
+ internal int cyMinChild;
+ internal int cx;
+ internal IntPtr hbmBack;
+ internal int wID;
+ internal int cyChild;
+ internal int cyMaxChild;
+ internal int cyIntegral;
+ internal int cxIdeal;
+ internal int lParam;
+ internal int cxHeader;
+ }
+ #endregion
+
+ #region MOUSEHOOKSTRUCT
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MOUSEHOOKSTRUCT
+ {
+ internal POINT pt;
+ internal IntPtr hwnd;
+ internal int wHitTestCode;
+ internal IntPtr dwExtraInfo;
+ }
+ #endregion
+
+ #region NMTOOLBAR
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMTOOLBAR
+ {
+ internal NMHDR hdr;
+ internal int iItem;
+ internal TBBUTTON tbButton;
+ internal int cchText;
+ internal IntPtr pszText;
+ internal RECT rcButton;
+ }
+ #endregion
+
+ #region NMREBARCHEVRON
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMREBARCHEVRON
+ {
+ internal NMHDR hdr;
+ internal int uBand;
+ internal int wID;
+ internal int lParam;
+ internal RECT rc;
+ internal int lParamNM;
+ }
+ #endregion
+
+ #region BITMAP
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct BITMAP
+ {
+ internal long bmType;
+ internal long bmWidth;
+ internal long bmHeight;
+ internal long bmWidthBytes;
+ internal short bmPlanes;
+ internal short bmBitsPixel;
+ internal IntPtr bmBits;
+ }
+ #endregion
+
+ #region BITMAPINFO_FLAT
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct BITMAPINFO_FLAT
+ {
+ internal int bmiHeader_biSize;
+ internal int bmiHeader_biWidth;
+ internal int bmiHeader_biHeight;
+ internal short bmiHeader_biPlanes;
+ internal short bmiHeader_biBitCount;
+ internal int bmiHeader_biCompression;
+ internal int bmiHeader_biSizeImage;
+ internal int bmiHeader_biXPelsPerMeter;
+ internal int bmiHeader_biYPelsPerMeter;
+ internal int bmiHeader_biClrUsed;
+ internal int bmiHeader_biClrImportant;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=1024)]
+ internal byte[] bmiColors;
+ }
+ #endregion
+
+ #region RGBQUAD
+ internal struct RGBQUAD
+ {
+ internal byte rgbBlue;
+ internal byte rgbGreen;
+ internal byte rgbRed;
+ internal byte rgbReserved;
+ }
+ #endregion
+
+ #region BITMAPINFOHEADER
+ [StructLayout(LayoutKind.Sequential)]
+ internal class BITMAPINFOHEADER
+ {
+ internal int biSize = Marshal.SizeOf(typeof(BITMAPINFOHEADER));
+ internal int biWidth;
+ internal int biHeight;
+ internal short biPlanes;
+ internal short biBitCount;
+ internal int biCompression;
+ internal int biSizeImage;
+ internal int biXPelsPerMeter;
+ internal int biYPelsPerMeter;
+ internal int biClrUsed;
+ internal int biClrImportant;
+ }
+ #endregion
+
+ #region BITMAPINFO
+ [StructLayout(LayoutKind.Sequential)]
+ internal class BITMAPINFO
+ {
+ internal BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=1024)]
+ internal byte[] bmiColors;
+ }
+ #endregion
+
+ #region PALETTEENTRY
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct PALETTEENTRY
+ {
+ internal byte peRed;
+ internal byte peGreen;
+ internal byte peBlue;
+ internal byte peFlags;
+ }
+ #endregion
+
+ #region MESSAGE
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MESSAGE
+ {
+ internal IntPtr hwnd;
+ internal int message;
+ internal IntPtr wParam;
+ internal IntPtr lParam;
+ internal int time;
+ internal int pt_x;
+ internal int pt_y;
+ }
+ #endregion
+
+ #region HD_HITTESTINFO
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct HD_HITTESTINFO
+ {
+ internal POINT pt;
+ internal HeaderControlHitTestFlags flags;
+ internal int iItem;
+ }
+ #endregion
+
+ #region DLLVERSIONINFO
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct DLLVERSIONINFO
+ {
+ internal int cbSize;
+ internal int dwMajorVersion;
+ internal int dwMinorVersion;
+ internal int dwBuildNumber;
+ internal int dwPlatformID;
+ }
+ #endregion
+
+ #region PAINTSTRUCT
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct PAINTSTRUCT
+ {
+ internal IntPtr hdc;
+ internal int fErase;
+ internal Rectangle rcPaint;
+ internal int fRestore;
+ internal int fIncUpdate;
+ internal int Reserved1;
+ internal int Reserved2;
+ internal int Reserved3;
+ internal int Reserved4;
+ internal int Reserved5;
+ internal int Reserved6;
+ internal int Reserved7;
+ internal int Reserved8;
+ }
+ #endregion
+
+ #region BLENDFUNCTION
+ [StructLayout(LayoutKind.Sequential, Pack=1)]
+ internal struct BLENDFUNCTION
+ {
+ internal byte BlendOp;
+ internal byte BlendFlags;
+ internal byte SourceConstantAlpha;
+ internal byte AlphaFormat;
+ }
+
+ #endregion
+
+ #region TRACKMOUSEEVENTS
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct TRACKMOUSEEVENTS
+ {
+ internal int cbSize;
+ internal TrackerEventFlags dwFlags;
+ internal IntPtr hWnd;
+ internal int dwHoverTime;
+ }
+ #endregion
+
+ #region NMTVCUSTOMDRAW
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NMTVCUSTOMDRAW
+ {
+ internal NMCUSTOMDRAW nmcd;
+ internal int clrText;
+ internal int clrTextBk;
+ internal int iLevel;
+ }
+ #endregion
+
+ #region TVITEM
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct TVITEM
+ {
+ internal int mask;
+ internal IntPtr hItem;
+ internal int state;
+ internal int stateMask;
+ internal IntPtr pszText;
+ internal int cchTextMax;
+ internal int iImage;
+ internal int iSelectedImage;
+ internal int cChildren;
+ internal IntPtr lParam;
+ }
+ #endregion
+
+ #region LVITEM
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct LVITEM
+ {
+ internal ListViewItemFlags mask;
+ internal int iItem;
+ internal int iSubItem;
+ internal int state;
+ internal int stateMask;
+ internal IntPtr pszText;
+ internal int cchTextMax;
+ internal int iImage;
+ internal int lParam;
+ internal int iIndent;
+ }
+ #endregion
+
+ #region HDITEM
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct HDITEM
+ {
+ internal HeaderItemFlags mask;
+ internal int cxy;
+ internal IntPtr pszText;
+ internal IntPtr hbm;
+ internal int cchTextMax;
+ internal int fmt;
+ internal int lParam;
+ internal int iImage;
+ internal int iOrder;
+ }
+ #endregion
+
+ #region WINDOWPLACEMENT
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct WINDOWPLACEMENT
+ {
+ internal uint length; //Were int in original code
+ internal uint flags; //
+ internal uint showCmd; //
+ internal POINT ptMinPosition;
+ internal POINT ptMaxPosition;
+ internal RECT rcNormalPosition;
+ }
+ #endregion
+
+ #region SCROLLINFO
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct SCROLLINFO
+ {
+ internal int cbSize;
+ internal int fMask;
+ internal int nMin;
+ internal int nMax;
+ internal int nPage;
+ internal int nPos;
+ internal int nTrackPos;
+ }
+ #endregion
+
+ #region SHFILEINFO
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct SHFILEINFO
+ {
+ internal IntPtr hIcon;
+ internal int iIcon;
+ internal int dwAttributes;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
+ internal string szDisplayName;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=80)]
+ internal string szTypeName;
+ }
+
+ #endregion
+
+ #region SHITEMID
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SHITEMID
+ {
+ internal short cb;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=1)]
+ internal byte[] abID;
+ }
+ #endregion
+
+ #region ITEMIDLIST
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct ITEMIDLIST
+ {
+ internal SHITEMID mkid;
+ }
+ #endregion
+
+ #region IID
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct IID
+ {
+ int x;
+ short s1;
+ short s2;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=8)]
+ byte[] chars;
+ }
+ #endregion
+
+ #region REFIID
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct REFIID
+ {
+ internal int x;
+ internal short s1;
+ internal short s2;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=8)]
+ internal byte[] chars;
+
+ internal REFIID(string guid)
+ {
+ // Needs to be a string of the form:
+ // "000214E6-0000-0000-c000-000000000046"
+ string[] data = guid.Split('-');
+ Debug.Assert(data.Length == 5);
+ x = Convert.ToInt32(data[0], 16);
+ s1 = Convert.ToInt16(data[1], 16);
+ s2 = Convert.ToInt16(data[2], 16);
+ string bytesData = data[3] + data[4];
+ chars = new byte[] { Convert.ToByte(bytesData.Substring(0,2), 16), Convert.ToByte(bytesData.Substring(2,2), 16),
+ Convert.ToByte(bytesData.Substring(4,2), 16), Convert.ToByte(bytesData.Substring(6,2), 16),
+ Convert.ToByte(bytesData.Substring(8,2), 16), Convert.ToByte(bytesData.Substring(10,2), 16),
+ Convert.ToByte(bytesData.Substring(12,2), 16), Convert.ToByte(bytesData.Substring(14,2), 16) };
+ }
+
+ }
+ #endregion
+
+ #region STRRET
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct STRRET
+ {
+ internal STRRETFlags uType; // One of the STRRET values
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=1024)]
+ internal byte[] cStr;
+ }
+ #endregion
+
+ #region STRRET_EX
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct STRRET_EX
+ {
+ [FieldOffset(0)] internal STRRETFlags uType; // One of the STRRET values
+ [FieldOffset(4)] internal IntPtr pOLEString;
+ }
+ #endregion
+
+ #region TVINSERTSTRUCT
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct TVINSERTSTRUCT
+ {
+ internal int hParent;
+ internal int hInsertAfter;
+ internal TVITEM item;
+ }
+ #endregion
+
+ #region NM_TREEVIEW
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct NM_TREEVIEW
+ {
+ internal NMHDR hdr;
+ internal int action;
+ internal TVITEM itemOld;
+ internal TVITEM itemNew;
+ internal POINT ptDrag;
+ }
+ #endregion
+
+ #region TVHITTESTINFO
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct TVHITTESTINFO
+ {
+ internal POINT pt;
+ internal TreeViewHitTestFlags flags;
+ internal IntPtr hItem;
+ }
+ #endregion
+
+ #region TVSORTCB
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct TVSORTCB
+ {
+ internal IntPtr hParent;
+ internal Win32.CompareFunc lpfnCompare;
+ internal int lParam;
+ }
+ #endregion
+
+ #region SCROLLBARINFO
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct SCROLLBARINFO
+ {
+ internal int cbSize;
+ internal RECT rcScrollBar;
+ internal int dxyLineButton;
+ internal int xyThumbTop;
+ internal int xyThumbBottom;
+ internal int reserved;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=6)]
+ internal int[] rgstate;
+ }
+ #endregion
+
+ #region CMINVOKECOMMANDINFO
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct CMINVOKECOMMANDINFO
+ {
+ internal int cbSize; // sizeof(CMINVOKECOMMANDINFO)
+ internal int fMask; // any combination of CMIC_MASK_*
+ internal IntPtr hwnd; // might be NULL (indicating no owner window)
+ internal IntPtr lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
+ internal IntPtr lpParameters; // might be NULL (indicating no parameter)
+ internal IntPtr lpDirectory; // might be NULL (indicating no specific directory)
+ internal int nShow; // one of SW_ values for ShowWindow() API
+ internal int dwHotKey;
+ internal IntPtr hIcon;
+ }
+ #endregion
+
+ #region NMHEADER
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct NMHEADER
+ {
+ internal NMHDR hdr;
+ internal int iItem;
+ internal int iButton;
+ internal HDITEM hItem;
+ }
+ #endregion
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MSG {
+ internal IntPtr hwnd;
+ internal Msg message;
+ internal IntPtr wParam;
+ internal IntPtr lParam;
+ internal uint time;
+ internal POINT pt;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct WNDCLASS {
+ internal int style;
+ internal Win32.WndProc lpfnWndProc;
+ internal int cbClsExtra;
+ internal int cbWndExtra;
+ internal IntPtr hInstance;
+ internal IntPtr hIcon;
+ internal IntPtr hCursor;
+ internal IntPtr hbrBackground;
+ internal string lpszMenuName;
+ internal string lpszClassName;
+ }
+
+
+ //
+ //
+ // [StructLayout(LayoutKind.Sequential)]
+ // internal struct WNDCLASSA {
+ // uint style;
+ // WNDPROC lpfnWndProc;
+ // INT cbClsExtra;
+ // INT cbWndExtra;
+ // HINSTANCE hInstance;
+ // HICON hIcon;
+ // HCURSOR hCursor;
+ // HBRUSH hbrBackground;
+ // LPCSTR lpszMenuName;
+ // LPCSTR lpszClassName;
+ // }
+
+
+
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs
new file mode 100644
index 00000000000..a6343bccd97
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs
@@ -0,0 +1,840 @@
+/*
+ * Copyright (C) 5/11/2002 Carlos Harvey Perez
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.
+ * IN NO EVENT SHALL CARLOS HARVEY PEREZ BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Carlos Harvey Perez
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from Carlos Harvey Perez.
+ */
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Diagnostics;
+
+//using UtilityLibrary.WinControls;
+
+//namespace UtilityLibrary.Win32
+namespace System.Windows.Forms{
+ /// <summary>
+ /// Windows API Functions
+ /// </summary>
+ public class Win32
+ {
+ #region Constructors
+ // No need to construct this object
+ #endregion
+
+ #region Constans values
+ internal const string TOOLBARCLASSNAME = "ToolbarWindow32";
+ internal const string REBARCLASSNAME = "ReBarWindow32";
+ internal const string PROGRESSBARCLASSNAME = "msctls_progress32";
+ internal const string SCROLLBAR = "SCROLLBAR";
+ #endregion
+
+ #region CallBacks
+ internal delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
+ internal delegate int CompareFunc(IntPtr param1, IntPtr param2, IntPtr sortParam);
+ internal delegate int WinProc(IntPtr hWnd, int message, int wParam, int lParam);
+ #endregion
+
+ #region Kernel32.dll functions
+ [DllImport("kernel32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
+ internal static extern int GetCurrentThreadId();
+ [DllImport("kernel32.dll")]
+ internal static extern int GetDriveType(string rootPathName);
+ [DllImport("kernel32.dll")]
+ internal static extern int GetVolumeInformation(string drivePath,
+ StringBuilder volumeNameBuffer,
+ int driveNameBufferSize,
+ out int serialNumber,
+ out int maxFileNameLength,
+ out int fileSystemFlags,
+ StringBuilder systemNameBuffer,
+ int systemNameBufferSize);
+ [DllImport("kernel32.dll")]
+ internal static extern void OutputDebugString(string message);
+ #endregion
+
+ #region Gdi32.dll functions
+ [DllImport("gdi32.dll")]
+ static internal extern bool StretchBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest,
+ IntPtr hDCSrc, int XOriginScr, int YOriginSrc, int WidthScr, int HeightScr, PatBltTypes Rop);
+ [DllImport("gdi32.dll")]
+ static internal extern IntPtr CreateCompatibleDC(IntPtr hDC);
+ [DllImport("gdi32.dll")]
+ static internal extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int Width, int Heigth);
+ [DllImport("gdi32.dll")]
+ static internal extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
+ [DllImport("gdi32.dll")]
+ static internal extern bool BitBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest,
+ IntPtr hDCSrc, int XOriginScr, int YOriginSrc, PatBltTypes flags);
+ [DllImport("gdi32.dll")]
+ static internal extern IntPtr DeleteDC(IntPtr hDC);
+ [DllImport("gdi32.dll")]
+ static internal extern bool PatBlt(IntPtr hDC, int XLeft, int YLeft, int Width, int Height, int Rop);
+ [DllImport("gdi32.dll")]
+ static internal extern bool DeleteObject(IntPtr hObject);
+ [DllImport("gdi32.dll")]
+ static internal extern int GetPixel(IntPtr hDC, int XPos, int YPos);
+ [DllImport("gdi32.dll")]
+ static internal extern int SetMapMode(IntPtr hDC, int fnMapMode);
+ [DllImport("gdi32.dll")]
+ static internal extern int GetObjectType(IntPtr handle);
+ [DllImport("gdi32")]
+ internal static extern IntPtr CreateDIBSection(IntPtr hdc, ref BITMAPINFO_FLAT bmi,
+ int iUsage, ref int ppvBits, IntPtr hSection, int dwOffset);
+ [DllImport("gdi32")]
+ internal static extern int GetDIBits(IntPtr hDC, IntPtr hbm, int StartScan, int ScanLines, int lpBits, BITMAPINFOHEADER bmi, int usage);
+ [DllImport("gdi32")]
+ internal static extern int GetDIBits(IntPtr hdc, IntPtr hbm, int StartScan, int ScanLines, int lpBits, ref BITMAPINFO_FLAT bmi, int usage);
+ [DllImport("gdi32")]
+ internal static extern IntPtr GetPaletteEntries(IntPtr hpal, int iStartIndex, int nEntries, byte[] lppe);
+ [DllImport("gdi32")]
+ internal static extern IntPtr GetSystemPaletteEntries(IntPtr hdc, int iStartIndex, int nEntries, byte[] lppe);
+ [DllImport("gdi32")]
+ internal static extern int SetDCBrushColor(IntPtr hdc, int crColor);
+ [DllImport("gdi32")]
+ internal static extern IntPtr CreateSolidBrush(int crColor);
+ [DllImport("gdi32")]
+ internal static extern int SetBkMode(IntPtr hDC, BackgroundMode mode);
+ [DllImport("gdi32")]
+ internal static extern int SetViewportOrgEx(IntPtr hdc, int x, int y, int param);
+ [DllImport("gdi32")]
+ internal static extern int SetTextColor(IntPtr hDC, int colorRef);
+ [DllImport("gdi32")]
+ internal static extern int SetStretchBltMode(IntPtr hDC, StrechModeFlags StrechMode);
+ [DllImport("gdi32")]
+ internal static extern int SetPixel(IntPtr hDC, int x, int y, int color);
+ [DllImport("gdi32")]
+ internal static extern IntPtr CreatePen(PenStyle penStyle, int width, int color);
+ [DllImport("gdi32")]
+ internal static extern int GetClipRgn(IntPtr hDC, ref IntPtr region);
+ [DllImport("gdi32")]
+ internal static extern IntPtr CreateRectRgn(int nLeftRect, int TopRect, int nRightRect, int nBottomRect);
+ [DllImport("gdi32")]
+ internal static extern int GetRgnBox(IntPtr hRegion, ref RECT rc);
+ #endregion
+
+ #region Uxtheme.dll functions
+ [DllImport("uxtheme.dll")]
+ static public extern int SetWindowTheme(IntPtr hWnd, StringBuilder AppID, StringBuilder ClassID);
+ static public void DisableWindowsXPTheme(IntPtr hWnd)
+ {
+ // Disable using the Window XP Theme for the Window handle
+ // passed as a parameter
+ StringBuilder applicationName = new StringBuilder(" ", 1);
+ StringBuilder classIDs = new StringBuilder(" " , 1);
+ Win32.SetWindowTheme(hWnd, applicationName, classIDs);
+ }
+ #endregion
+
+ #region User32.dll functions
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern IntPtr GetDesktopWindow();
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool ShowWindow(IntPtr hWnd, ShowWindowStyles State);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool SetForegroundWindow(IntPtr hWnd);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool OpenClipboard(IntPtr hWndNewOwner);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool CloseClipboard();
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool EmptyClipboard();
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern IntPtr SetClipboardData( int Format, IntPtr hData);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool GetMenuItemRect(IntPtr hWnd, IntPtr hMenu, int Item, ref RECT rc);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SendMessage(IntPtr hWnd, Msg msg, int wParam, int lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref RECT lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref POINT lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, ToolBarMessages msg, int wParam, ref TBBUTTON lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, ToolBarMessages msg, int wParam, ref TBBUTTONINFO lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SendMessage(IntPtr hWnd, RebarMessages msg, int wParam, ref REBARBANDINFO lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVITEM lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVINSERTSTRUCT lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVSORTCB lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVHITTESTINFO hti);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, ListViewMessages msg, int wParam, ref LVITEM lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, HeaderControlMessages msg, int wParam, ref HDITEM lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern void SendMessage(IntPtr hWnd, HeaderControlMessages msg, int wParam, ref HD_HITTESTINFO hti);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SendMessage(IntPtr hWnd, HeaderControlMessages msg, int wParam, int lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, int lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr PostMessage(IntPtr hWnd, Msg msg, int wParam, int lParam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr SetWindowsHookEx(WindowsHookCodes hookid, HookProc pfnhook, IntPtr hinst, int threadid);
+ [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
+ internal static extern bool UnhookWindowsHookEx(IntPtr hhook);
+ [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
+ internal static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtr wparam, IntPtr lparam);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal extern static int DrawText(IntPtr hdc, string lpString, int nCount, ref RECT lpRect, DrawTextFormatFlags flags);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal extern static IntPtr GetDlgItem(IntPtr hDlg, int nControlID);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal extern static int InvalidateRect(IntPtr hWnd, ref RECT rc, int bErase);
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ internal extern static int InvalidateRect(IntPtr hWnd, IntPtr rc, int bErase);
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool WaitMessage();
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool PeekMessage(ref MESSAGE msg, int hWnd, int wFilterMin, int wFilterMax, PeekMessageFlags flags);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool GetMessage(ref MESSAGE msg, int hWnd, int wFilterMin, int wFilterMax);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool TranslateMessage(ref MESSAGE msg);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool DispatchMessage(ref MESSAGE msg);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr LoadCursor(IntPtr hInstance, CursorType cursor);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr SetCursor(IntPtr hCursor);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref POINT pptDst, ref SIZE psize,
+ IntPtr hdcSrc, ref POINT pprSrc, Int32 crKey, ref BLENDFUNCTION pblend, UpdateLayeredWindowFlags dwFlags);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool TrackMouseEvent(ref TRACKMOUSEEVENTS tme);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern short GetKeyState(int virtKey);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern int GetClassName(IntPtr hWnd, StringBuilder ClassName, int nMaxCount);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SetWindowLong(IntPtr hWnd, GetWindowLongFlag flag, int dwNewLong);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SetWindowLong(IntPtr hWnd, GetWindowLongFlag flag, WinProc winProc);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRegion, int flags);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr GetWindowDC(IntPtr hWnd);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern int FillRect(IntPtr hDC, ref RECT rect, IntPtr hBrush);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SetWindowText(IntPtr hWnd, string text);
+
+ [DllImport("User32.dll", CharSet=CharSet.Auto)]
+ internal static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int maxCount);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int GetSystemMetrics(SystemMetricsCodes code);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si, int fRedraw);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int ShowScrollBar(IntPtr hWnd, int bar, int show);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int EnableScrollBar(IntPtr hWnd, int flags, int arrows);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int BringWindowToTop(IntPtr hWnd);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int GetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy,
+ ref RECT rcScroll, ref RECT rcClip, IntPtr UpdateRegion, ref RECT rcInvalidated, int flags);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool IsWindow(IntPtr hWnd);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int LockWindowUpdate(IntPtr hWnd);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool ValidateRect(IntPtr hWnd, ref RECT rcInvalidated);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern bool ValidateRect(IntPtr hWnd, IntPtr rc);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int GetScrollBarInfo(IntPtr hWnd, SystemObject id, ref SCROLLBARINFO sbi);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern IntPtr GetWindowLong(IntPtr hWnd, GetWindowLongFlag flag);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int SetProp(IntPtr hWnd, IntPtr atom, IntPtr hData);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int CallWindowProc(IntPtr hOldProc, IntPtr hWnd, int message, int wParam, int lParam);
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int EndMenu();
+
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
+ static internal extern int DefWindowProc(IntPtr hWnd, int message, int wParam, int lParam);
+
+ #endregion
+
+ #region Shell32.dll functions
+
+ [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr SHGetFileInfo(string drivePath, int fileAttributes,
+ out SHFILEINFO fileInfo, int countBytesFileInfo, ShellFileInfoFlags flags);
+
+ [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
+ internal static extern IntPtr SHGetFileInfo(IntPtr idl, int fileAttributes,
+ out SHFILEINFO fileInfo, int countBytesFileInfo, ShellFileInfoFlags flags);
+
+ [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SHGetSpecialFolderLocation(IntPtr hwndOwner, ShellSpecialFolder folder, out IntPtr idl);
+
+ [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SHGetMalloc(out IMalloc alloc);
+
+ [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SHGetDesktopFolder(out IShellFolder folder);
+
+ [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
+ internal static extern int SHGetPathFromIDList(IntPtr idl, StringBuilder path);
+
+ internal static void SHFreeMalloc(IntPtr handle)
+ {
+ IMalloc alloc = null;
+ try
+ {
+ Win32.SHGetMalloc(out alloc);
+ Debug.Assert(alloc != null);
+ alloc.Free(handle);
+ // Free allocator itself
+ IUnknown iUnknown = (IUnknown)alloc;
+ iUnknown.Release();
+ }
+ catch (Exception e)
+ {
+ // In case the Garbage collector is trying to free
+ // this memory from its own thread
+ Debug.WriteLine(e.Message);
+ }
+ }
+
+ #endregion
+
+ #region Common Controls functions
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool InitCommonControlsEx(INITCOMMONCONTROLSEX icc);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool InitCommonControls();
+
+ [DllImport("comctl32.dll", EntryPoint="DllGetVersion")]
+ internal extern static int GetCommonControlDLLVersion(ref DLLVERSIONINFO dvi);
+
+ [DllImport("comctl32.dll")]
+ internal static extern IntPtr ImageList_Create(int width, int height, int flags, int count, int grow);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_Destroy(IntPtr handle);
+
+ [DllImport("comctl32.dll")]
+ internal static extern int ImageList_Add(IntPtr imageHandle, IntPtr hBitmap, IntPtr hMask);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_Remove(IntPtr imageHandle, int index);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_BeginDrag(IntPtr imageHandle, int imageIndex, int xHotSpot, int yHotSpot);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_DragEnter(IntPtr hWndLock, int x, int y);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_DragMove(int x, int y);
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_DragLeave(IntPtr hWndLock);
+
+ [DllImport("comctl32.dll")]
+ internal static extern void ImageList_EndDrag();
+
+ [DllImport("comctl32.dll")]
+ internal static extern bool ImageList_Draw(IntPtr hImageList, int imageIndex,
+ IntPtr hDCDest, int x, int y, ImageListDrawFlags flags);
+
+ [DllImport("comctl32.dll")]
+ internal static extern int ImageList_DrawEx(
+ IntPtr hImageList, int imageIndex, IntPtr hDCDest, int x, int y, int dx, int dy,
+ uint backColor, uint foregColor, ImageListDrawFlags flags);
+
+ [DllImport("comctl32.dll")]
+ internal static extern int ImageList_DragShowNolock(int show);
+
+ [DllImport("comctl32.dll")]
+ internal static extern int ImageList_AddMasked(IntPtr hImageList, IntPtr hBitmap, int crMask);
+
+ [DllImport("comctl32.dll")]
+ internal static extern int ImageList_SetDragCursorImage(IntPtr himlDrag, int iDrag, int dxHotspot, int dyHotspot);
+
+ internal static int ImageList_DrawEx(IntPtr hImageList, int imageIndex, IntPtr hDCDest, int x, int y, int dx, int dy,
+ ImageListDrawColor backColor, ImageListDrawColor foreColor, ImageListDrawFlags flags)
+ {
+ uint bColor = (uint)ImageListDrawColors.CLR_NONE;
+ if ( backColor == ImageListDrawColor.Default )
+ bColor = (uint)ImageListDrawColors.CLR_DEFAULT;
+
+ uint fColor = (uint)ImageListDrawColors.CLR_NONE;
+ if ( foreColor == ImageListDrawColor.Default )
+ fColor = (uint)ImageListDrawColors.CLR_DEFAULT;
+
+ // Call actual function
+ return ImageList_DrawEx(hImageList, imageIndex, hDCDest, x, y, dx, dy, bColor, fColor, flags);
+ }
+
+
+ static internal bool IsCommonCtrl6()
+ {
+ DLLVERSIONINFO dllVersion = new DLLVERSIONINFO();
+ // We are assummng here that anything greater or equal than 6
+ // will have the new XP theme drawing enable
+ dllVersion.cbSize = Marshal.SizeOf(typeof(DLLVERSIONINFO));
+ Win32.GetCommonControlDLLVersion(ref dllVersion);
+ return (dllVersion.dwMajorVersion >= 6);
+ }
+
+ #endregion
+
+ #region Win32 Macro-Like helpers
+ internal static int X_LPARAM(int lParam)
+ {
+ return (lParam & 0xffff);
+ }
+
+ internal static int Y_LPARAM(int lParam)
+ {
+ return (lParam >> 16);
+ }
+
+ internal static Point GetPointFromLPARAM(int lParam)
+ {
+ return new Point(X_LPARAM(lParam), Y_LPARAM(lParam));
+ }
+
+ internal static int LOW_ORDER(int param)
+ {
+ return (param & 0xffff);
+ }
+
+ internal static int HIGH_ORDER(int param)
+ {
+ return (param >> 16);
+ }
+
+ internal static int INDEXTOOVERLAYMASK(int index)
+ {
+ return (int)((uint)index << 8);
+ }
+
+ internal static int OVERLAYMASKTOINDEX(int index)
+ {
+ return (int)((uint)index >> 8);
+ }
+
+ internal static int INDEXTOSTATEIMAGEMASK(int i)
+ {
+ return (int)((uint)i << 12);
+ }
+
+ internal static int STATEIMAGEMASKTOINDEX(int i)
+ {
+ return (int)((uint)i >> 12);
+ }
+
+ internal static short HRESULT_CODE(int hr)
+ {
+ return (short)(hr & 0xFFFF);
+ }
+
+ internal static bool SUCCEEDED(int status)
+ {
+ return (status >= 0);
+ }
+
+ internal static bool FAILED(int status)
+ {
+ return (status < 0);
+ }
+
+ internal static int MAKEINTRESOURCE(int res)
+ {
+ return 0x0000FFFF & res;
+ }
+ #endregion
+
+
+ #region Mono win32 Fuinctions
+
+ internal delegate IntPtr WndProc (IntPtr hwnd, Msg msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Ansi, EntryPoint = "RegisterClassA")]
+ internal static extern uint RegisterClass(ref WNDCLASS wndClass);
+
+ #region Added by Dennis hayes 10-20-2002
+ //correct?
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern uint SendMessage(
+ IntPtr hWnd, uint Msg,
+ IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool GetWindowPlacement(
+ IntPtr hWnd,
+ ref WINDOWPLACEMENT lpwndpl // position data
+ );
+ #endregion
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Ansi, EntryPoint = "CreateWindowExA")]
+ internal static extern IntPtr CreateWindowEx (
+ uint dwExStyle, string lpClassName,
+ string lpWindowName, uint dwStyle,
+ int x, int y, int nWidth, int nHeight,
+ IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
+ ref object lpParam);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr CreateMenu ();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Ansi)]
+ internal static extern bool AppendMenuA(IntPtr hMenu, uint uflags, IntPtr NewItem, string item);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall)]
+ internal static extern bool DestroyMenu (IntPtr hMenu);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ internal extern static IntPtr DefWindowProcA (
+ IntPtr hWnd, Msg Msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ internal extern static int DestroyWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ internal static extern int ShowWindow (IntPtr hWnd,
+ uint nCmdShow);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,CharSet = CharSet.Auto)]
+ internal static extern int GetMessageA (ref MSG msg, int hwnd,
+ int msgFrom, int msgTo);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ internal static extern int TranslateMessage (ref MSG msg);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ internal static extern int DispatchMessageA (ref MSG msg);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ internal static extern int PeekMessageA (
+ ref MSG msg, IntPtr hWnd, uint wMsgFilterMin,
+ uint wMsgFilterMax, uint wRemoveMsg);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static void PostQuitMessage (int nExitCode);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static IntPtr SetActiveWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static int CloseWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static int SetWindowPos (
+ IntPtr hWnd, SetWindowPosZOrder pos,
+ int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern int MessageBoxA (
+ IntPtr hWnd, string pText, string pCaption, uint uType);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr SetParent (
+ IntPtr hWndChild, IntPtr hWndNewParent);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetParent (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool SetWindowTextA (
+ IntPtr hWnd, string lpString);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool UpdateWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern uint GetBkColor (IntPtr hdc);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern uint SetBkColor (IntPtr hdc, uint crColor);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetDC (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern int ReleaseDC (IntPtr hWnd, IntPtr hDC);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetFocus();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr SetFocus (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool IsWindowEnabled (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool IsMenu (IntPtr hWnd);
+
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool EnableWindow (
+ IntPtr hWnd, bool bEnable);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool GetWindowRect (
+ IntPtr hWnd, ref RECT lpRect);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool GetClientRect (
+ IntPtr hWnd, ref RECT lpRect);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool InvalidateRect (
+ IntPtr hWnd, ref RECT lpRect, bool bErase);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetCapture ();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr SetCapture (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool ReleaseCapture ();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern int GetWindowTextA (
+ IntPtr hWnd, ref String lpString, int nMaxCount);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern int GetWindowTextLengthA (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern bool GetCursorPos (ref POINT lpPoint);
+
+ #endregion
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetMenu (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal static extern int SetMenu (IntPtr hWnd, IntPtr hMenu);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Ansi)]
+ internal static extern int InsertMenuA(IntPtr hMenu, uint pos, uint uflags, IntPtr NewItem, string item);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Ansi)]
+ internal static extern int RemoveMenu(IntPtr hMenu, uint pos, uint uflags);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall)]
+ internal static extern int DrawMenuBar (IntPtr hWnd);
+
+
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static int AdjustWindowRect (
+ ref RECT rc, int dwStyle, int bMenu);
+
+
+
+ [DllImport ("kernel32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static uint GetLastError ();
+
+ [DllImport ("kernel32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ internal extern static uint FormatMessage (
+ uint flags, IntPtr lpSource,
+ uint messageId, uint languageId,
+ StringBuilder lpBuffer, int nSize,
+ IntPtr Arguments);
+
+ internal static string FormatMessage(uint error) {
+ StringBuilder sb = new StringBuilder(2048);
+ Win32.FormatMessage( (uint)(FM_.FORMAT_MESSAGE_FROM_SYSTEM | FM_.FORMAT_MESSAGE_IGNORE_INSERTS),
+ IntPtr.Zero, error, 0, sb, sb.Capacity, IntPtr.Zero);
+ return sb.ToString();
+ }
+
+
+
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AccessibleEvents.cs b/mcs/class/System.Windows.Forms/WINELib/AccessibleEvents.cs
new file mode 100644
index 00000000000..d39f188ec1d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AccessibleEvents.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.AccessibleEvents.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian = , Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AccessibleEvents{
+ AcceleratorChange = 32786,
+ Create = 32768,
+ DefaultActionChange = 32765,
+ DescriptionChange = 32781,
+ Destroy = 32769,
+ Focus = 32773,
+ HelpChange = 32784,
+ Hide = 32771,
+ LocationChange = 32779,
+ NameChange = 32780,
+ ParentChange = 32783,
+ Reorder = 32772,
+ Selection = 32774,
+ SelectionAdd = 32775,
+ SelectionRemove = 32776,
+ SelectionWithin = 32777,
+ Show = 32770,
+ StateChange = 32778,
+ SystemAlert = 2,
+ SystemCaptureEnd = 9,
+ SystemCaptureStart = 8,
+ SystemContextHelpEnd = 13,
+ SystemContextHelpStart = 12,
+ SystemDialogEnd = 17,
+ SystemDialogStart = 16,
+ SystemDragDropEnd = 15,
+ SystemDragDropStart = 14,
+ SystemForeground = 3,
+ SystemMenuEnd = 5,
+ SystemMenuPopupEnd = 7,
+ SystemMenuPopupStart = 6,
+ SystemMenuStart = 4,
+ SystemMinimizeEnd = 23,
+ SystemMinimizeStart = 22,
+ SystemMoveSizeEnd = 11,
+ SystemMoveSizeStart = 10,
+ SystemScrollingEnd = 19,
+ SystemScrollingStart = 18,
+ SystemSound = 1,
+ SystemSwitchEnd = 21,
+ SystemSwitchStart = 20,
+ ValueChange = 32782
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AccessibleNavigation.cs b/mcs/class/System.Windows.Forms/WINELib/AccessibleNavigation.cs
new file mode 100644
index 00000000000..c7d017728cf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AccessibleNavigation.cs
@@ -0,0 +1,32 @@
+//
+// System.Windows.Forms.AccessibleNavigation.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies a values for navigating among accessible objects.
+ /// </summary>
+
+ //[Serializable]
+ public enum AccessibleNavigation {
+
+ //Values were verified with enumcheck.
+ Down = 2,
+ FirstChild = 7,
+ LastChild = 8,
+ Left = 3,
+ Next = 5,
+ Previous = 6,
+ Right = 4,
+ Up = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AccessibleObject.cs b/mcs/class/System.Windows.Forms/WINELib/AccessibleObject.cs
new file mode 100644
index 00000000000..ea97e6cf1fa
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AccessibleObject.cs
@@ -0,0 +1,370 @@
+//
+// System.Windows.Forms.AccessibleObject.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using Accessibility;
+using System.Runtime.InteropServices;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides information that accessibility applications use to adjust an application's UI for users with impairments.
+ ///
+ /// ToDo note:
+ /// - Nothing is implemented
+ /// - IAccessible members not stubbed out
+ /// - MarshalByRefObject members not stubbed out
+ /// MSDN gives little info on the members of IAccessible: "This member supports the .NET Framework infrastructure and is not intended to be used directly from your code."
+ /// </summary>
+ [MonoTODO]
+ [ComVisible(true)]
+ public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
+ private string defaultAction;
+ private string description;
+ private string help;
+ private string keyboardShortcut;
+ private AccessibleObject parent;
+ private AccessibleRole role;
+ private AccessibleStates state;
+ private string name;
+ private string value;
+ // --- Constructor ---
+ [MonoTODO]
+ public AccessibleObject() {
+ name = null;
+ parent = null;
+ role = AccessibleRole.None;
+ state = AccessibleStates.None;
+ value = null;
+
+ }
+
+ [MonoTODO]
+ ~AccessibleObject(){
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this AccessibleObject and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj) {
+ if (!(obj is AccessibleObject))
+ return false;
+
+ return (this == (AccessibleObject) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode () {
+ //unchecked{//FIXME Add out proprities to the hash
+ return base.GetHashCode();
+ //}
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the AccessibleObject as a string.
+ /// </remarks>
+
+ //spec says inherited
+ //public override string ToString () {
+ // return "AccessibleObject".GetType();//per spec as I read it?
+ //}
+
+ // --- Properties ---
+
+ [ComVisible(true)]
+ public virtual Rectangle Bounds {
+
+ get { return Rectangle.Empty; } // As per spec for default. Expect override.
+ }
+
+ [ComVisible(true)]
+ public virtual string DefaultAction {
+
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ [ComVisible(true)]
+ public virtual string Description {
+
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ [ComVisible(true)]
+ public virtual string Help {
+
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ [ComVisible(true)]
+ public virtual string KeyboardShortcut {
+
+ get {return null; }// As per spec for default. Expect override.
+ }
+
+ [ComVisible(true)]
+ public virtual string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [ComVisible(true)]
+ public virtual string Value {
+ get { return this.value; }
+ set { this.value = value; }
+ }
+
+ [ComVisible(true)]
+ public virtual AccessibleObject Parent {
+ get { return parent; }
+ set { parent = value; }
+ }
+
+ [ComVisible(true)]
+ public virtual AccessibleRole Role {
+ get { return role; }
+ set { role = value; }
+ }
+
+ [ComVisible(true)]
+ public virtual AccessibleStates State {
+ get { return state; }
+ set { state = value; }
+ }
+
+ // --- Methods ---
+ [ComVisible(true)]
+ public virtual void DoDefaultAction() {
+ return; //default action is "" and cannot be changed, must be overridden.
+ }
+
+ [ComVisible(true)]
+ public virtual AccessibleObject GetChild(int index) {
+ return null;
+ }
+
+ [ComVisible(true)]
+ public virtual int GetChildCount() {
+ return -1; //as per spec
+ }
+
+ [MonoTODO]
+ [ComVisible(true)]
+ public virtual AccessibleObject GetFocused() {
+ return null;//FIXME: not quite to spec.
+ }
+
+ [ComVisible(true)]
+ public virtual int GetHelpTopic(out string fileName) {
+ fileName = "";
+ return -1;//no help
+ }
+
+ [ComVisible(true)]
+ public virtual AccessibleObject GetSelected() {
+ return null;
+ }
+
+ [MonoTODO]
+ [ComVisible(true)]
+ public virtual AccessibleObject HitTest(int x,int y) {
+ return null; }
+
+ [MonoTODO]
+ [ComVisible(true)]
+ public virtual AccessibleObject Navigate(AccessibleNavigation navdir) {
+ //by default, navagate back to here. Does this work?
+ //not to spec, but better than execption FIXME:
+ return this;
+ }
+
+ [MonoTODO]
+ [ComVisible(true)]
+ public virtual void Select(AccessibleSelection flags) {
+ return;//FIXME: Not to spec. should be over ridden anyway.
+ }
+
+ //Not part of spec?
+ //[MonoTODO]
+ //[ComVisible(true)]
+ //protected void UseStdAccessibleObjects(IntPtr handle,int objid)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+
+ // --- Methods: IReflect ---
+ [MonoTODO]
+ FieldInfo IReflect.GetField( string name,BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ FieldInfo[] IReflect.GetFields (BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ MemberInfo[] IReflect.GetMember( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ MemberInfo[] IReflect.GetMembers( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ MethodInfo IReflect.GetMethod( string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ MethodInfo IReflect.GetMethod( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+
+
+ [MonoTODO]
+ MethodInfo[] IReflect.GetMethods( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyInfo[] IReflect.GetProperties( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyInfo IReflect.GetProperty( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ PropertyInfo IReflect.GetProperty( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ //[Guid("")]
+ object IReflect.InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+
+ Type IReflect.UnderlyingSystemType {
+ //private Type UnderlyingSystemType {
+ get { throw new NotImplementedException (); }
+ }
+
+ void IAccessible.accDoDefaultAction(object childID) {
+ throw new NotImplementedException ();
+ }
+ int IAccessible.accChildCount{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+
+ object IAccessible.accFocus{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object IAccessible.accHitTest(int xLeft, int yTop) {
+ throw new NotImplementedException ();
+ }
+ void IAccessible.accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.accNavigate(int navDir, object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.accParent {
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void IAccessible.accSelect(int flagsSelect, object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.accSelection {
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object IAccessible.get_accChild(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accDefaultAction(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accDescription(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accHelp(object childID) {
+ throw new NotImplementedException ();
+ }
+ int IAccessible.get_accHelpTopic(out string pszHelpFile,object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accKeyboardShortcut(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accName(object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.get_accRole(object childID) {
+ throw new NotImplementedException ();
+ }
+ object IAccessible.get_accState(object childID) {
+ throw new NotImplementedException ();
+ }
+ string IAccessible.get_accValue(object childID) {
+ throw new NotImplementedException ();
+ }
+ void IAccessible.set_accName(object childID, string newName) {
+ throw new NotImplementedException ();
+ }
+ void IAccessible.set_accValue(object childID, string newValue) {
+ throw new NotImplementedException ();
+ }
+ }
+
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/AccessibleRole.cs b/mcs/class/System.Windows.Forms/WINELib/AccessibleRole.cs
new file mode 100644
index 00000000000..8a21d96e95c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AccessibleRole.cs
@@ -0,0 +1,80 @@
+//
+// System.Windows.Forms.AccessibleRole.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AccessibleRole{
+ Alert = 8,
+ Animation = 54,
+ Application = 14,
+ Border = 19,
+ ButtonDropDownGrid = 58,
+ ButtonMenu = 57,
+ Caret = 7,
+ Cell = 29,
+ Character = 32,
+ Chart = 17,
+ CheckButton = 44,
+ Client = 10,
+ Clock = 61,
+ Column = 27,
+ ColumnHeader = 25,
+ ComboBox = 46,
+ Cursor = 6,
+ Default = -1,
+ Diagram = 53,
+ Dial = 49,
+ Dialog = 18,
+ Document = 15,
+ DropList = 47,
+ Equation = 55,
+ Graphic = 40,
+ Grip = 4,
+ Grouping = 20,
+ HelpBalloon = 31,
+ HotkeyField = 50,
+ Indicator = 39,
+ Link = 30,
+ List = 33,
+ ListItem = 34,
+ MenuBar = 2,
+ MenuItem = 12,
+ MenuPopup = 11,
+ None = 0,
+ Outline = 35,
+ OutlineItem = 36,
+ PageTab = 37,
+ PageTabList = 60,
+ Pane = 16,
+ ProgressBar = 48,
+ PropertyPage = 38,
+ PushButton = 43,
+ RadioButton = 45,
+ Row = 28,
+ RowHeader = 26,
+ ScrollBar = 3,
+ Separator = 21,
+ Slider = 51,
+ Sound = 5,
+ SpinButton = 52,
+ StaticText = 41,
+ StatusBar = 23,
+ Table = 24,
+ Text = 42,
+ TitleBar = 1,
+ ToolBar = 22,
+ ToolTip = 13,
+ WhiteSpace = 59,
+ Window = 9
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AccessibleSelection.cs b/mcs/class/System.Windows.Forms/WINELib/AccessibleSelection.cs
new file mode 100644
index 00000000000..dce814a48bd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AccessibleSelection.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.AccessibleSelection.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how an accessible object is selected or receives focus.
+ /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ //[Serializable]
+ public enum AccessibleSelection {
+
+ AddSelection = 1,
+ ExtendSelection = 2,
+ None = 0,
+ RemoveSelection = 4,
+ TakeFocus = 8,
+ TakeSelection = 16
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AccessibleStates.cs b/mcs/class/System.Windows.Forms/WINELib/AccessibleStates.cs
new file mode 100644
index 00000000000..49eb44e63bc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AccessibleStates.cs
@@ -0,0 +1,59 @@
+//
+// System.Windows.Forms.AccessibleStates.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AccessibleStates{
+ AlertLow = 67108864,
+ AlertMedium = 134217728,
+ AlertHigh = 268435456,
+ Animated = 16384,
+ Busy = 2048,
+ Checked = 16,
+ Collapsed = 1024,
+ Default = 256,
+ Expanded = 512,
+ ExtSelectable = 33554432,
+ Floating = 4096,
+ Focusable = 1048576,
+ Focused = 4,
+ HotTracked = 128,
+ Indeterminate =32,
+ Mixed = 32,
+ Invisible = 32768,
+ Linked = 4194304,
+ Marqueed = 8192,
+ Moveable = 262144,
+ MultiSelectable = 16777216,
+ None = 0,
+ Pressed = 8,
+ Protected = 536870912,
+ ReadOnly = 64,
+ Offscreen = 65536,
+ Selectable = 2097152,
+ Selected = 2,
+ SelfVoicing = 524288,
+ Sizeable = 131072,
+ Traversed =8388608,
+ Unavailable = 1,
+ Valid = 1073741823,
+
+
+ //Where did these come from, are they missing from elsewhere?
+ //AddSelection = ,
+ //ExtendSelection = ,
+ //None = ,
+ //RemoveSelection = ,
+ //TakeFocus = ,
+ //TakeSelection =
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AnchorStyles.cs b/mcs/class/System.Windows.Forms/WINELib/AnchorStyles.cs
new file mode 100644
index 00000000000..2b166e21061
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AnchorStyles.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.AnchorStyles.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum AnchorStyles{
+ Bottom = 2,
+ Left = 4,
+ None = 0,
+ Right = 8,
+ Top = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Application.cs b/mcs/class/System.Windows.Forms/WINELib/Application.cs
new file mode 100644
index 00000000000..f5834623880
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Application.cs
@@ -0,0 +1,236 @@
+//
+// System.Windows.Forms.Application
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Miguel de Icaza (miguel@ximian.com)
+// Dennis hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Drawing;
+using Microsoft.Win32;
+using System.ComponentModel;
+using System.Threading;
+using System.Globalization;
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides static methods and properties to manage an application,
+ /// such as methods to start and stop an application, to process
+ /// Windows messages, and properties to get information about an
+ /// application. This class cannot be inherited.
+ /// </summary>
+
+ [MonoTODO]
+ public sealed class Application {
+ static private ApplicationContext applicationContext = null;
+ static private bool messageLoopStarted = false;
+ static private bool messageLoopStopRequest = false;
+ private static ArrayList messageFilters = new ArrayList ();
+
+ // --- (public) Properties ---
+ public static bool AllowQuit {
+ // according to docs return false if embbedded in a
+ // browser, not (yet?) embedded in a browser
+ get { return true; }
+ }
+
+ [MonoTODO]
+ public static string CommonAppDataPath {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ // Registry key not yet defined (this should be interesting)
+ //public static RegistryKey CommonAppDataRegistry {
+ // get { throw new NotImplementedException (); }
+ //}
+
+ [MonoTODO]
+ public static string CompanyName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static CultureInfo CurrentCulture {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static InputLanguage CurrentInputLanguage {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string ExecutablePath {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string LocalUserAppDataPath {
+ get { throw new NotImplementedException (); }
+ }
+
+ public static bool MessageLoop {
+ get { return messageLoopStarted; }
+ }
+
+ [MonoTODO]
+ public static string ProductName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string ProductVersion {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string SafeTopLevelCaptionFormat {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string StartupPath {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static string UserAppDataPath {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ // Registry key not yet defined
+ //public static RegistryKey UserAppDataRegistry {
+ // get { throw new NotImplementedException (); }
+ //}
+
+ // --- Methods ---
+ public static void AddMessageFilter (IMessageFilter value)
+ {
+ messageFilters.Add (value);
+ }
+
+ //Compact Framework
+ public static void DoEvents ()
+ {
+ Win32.MSG msg = new Win32.MSG();
+
+ while (Win32.PeekMessageA (ref msg, (IntPtr) 0, 0, 0,
+ Win32.PM_REMOVE) != 0);
+ }
+
+ //Compact Framework
+ public static void Exit ()
+ {
+ Win32.PostQuitMessage (0);
+ }
+
+ public static void ExitThread ()
+ {
+ messageLoopStopRequest = true;
+ }
+
+ [MonoTODO]
+ public static ApartmentState OleRequired ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void OnThreadException (Exception t)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static void RemoveMessageFilter (IMessageFilter value)
+ {
+ messageFilters.Remove (value);
+ }
+
+ static private void ApplicationFormClosed (object o, EventArgs args)
+ {
+ Win32.PostQuitMessage (0);
+ }
+
+ //Compact Framework
+ static public void Run ()
+ {
+ Win32.MSG msg = new Win32.MSG();
+
+ messageLoopStarted = true;
+
+ while (!messageLoopStopRequest &&
+ Win32.GetMessageA (ref msg, 0, 0, 0) != 0) {
+
+ bool dispatchMessage = true;
+
+ Message message = new Message ();
+ message.HWnd = msg.hwnd;
+ message.Msg = (int) msg.message;
+ message.WParam = msg.wParam;
+ message.LParam = msg.lParam;
+
+ IEnumerator e = messageFilters.GetEnumerator();
+
+ while (e.MoveNext()) {
+ IMessageFilter filter =
+ (IMessageFilter) e.Current;
+
+ // if PreFilterMessage returns true
+ // the message should not be dispatched
+ if (filter.PreFilterMessage (ref message))
+ dispatchMessage = false;
+ }
+
+ if (dispatchMessage) {
+ Win32.TranslateMessage (ref msg);
+ Win32.DispatchMessageA (ref msg);
+ }
+
+ //if (Idle != null)
+ //Idle (null, new EventArgs());
+ }
+
+ //if (ApplicationExit != null)
+ //ApplicationExit (null, new EventArgs());
+ }
+
+ public static void Run (ApplicationContext context)
+ {
+ applicationContext = context;
+ applicationContext.MainForm.Show ();
+ applicationContext.MainForm.Closed +=
+ new EventHandler (ApplicationFormClosed);
+ Run();
+ }
+
+ //[TypeAttributes.BeforeFieldInit]
+ public static void Run (Form form)
+ // Documents say this parameter name should be mainform,
+ // but the verifier says context.
+ {
+ form.CreateControl ();
+ ApplicationContext context = new ApplicationContext (
+ form);
+ Run (context);
+ }
+
+ // --- Events ---
+ public static event EventHandler ApplicationExit;
+ public static event EventHandler Idle;
+ public static event ThreadExceptionEventHandler ThreadException;
+ public static event EventHandler ThreadExit;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ApplicationContext.cs b/mcs/class/System.Windows.Forms/WINELib/ApplicationContext.cs
new file mode 100644
index 00000000000..9fcf00f9a15
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ApplicationContext.cs
@@ -0,0 +1,83 @@
+//
+// System.Windows.Forms.ApplicationContext
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies the contextual information about an application thread.
+ ///
+ /// ToDo note: Needsa Core; eg,==,!=,Gethascode,ToString.
+ /// </summary>
+
+ [MonoTODO]
+ public class ApplicationContext {
+
+ Form mainForm;
+
+ // --- (public) Properties ---
+ public Form MainForm {
+ get { return mainForm; }
+ set { mainForm = value; }
+ }
+
+ // --- Constructor ---
+ public ApplicationContext()
+ {
+ mainForm=null;
+ }
+
+ public ApplicationContext(Form mainForm) : this()
+ {
+ this.mainForm=mainForm;
+ }
+
+ // --- Methods ---
+ [MonoTODO]
+ public void Dispose()
+ {
+ // see documentation on ApplicationContext.Dispose Method (Boolean)
+ this.Dispose(true);
+ }
+
+ [MonoTODO]
+ protected virtual void Dispose(bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExitThread()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void ExitThreadCore()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnMainFormClosed(object sender,EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Methods: object ---
+ [MonoTODO]
+ ~ApplicationContext() {
+ // see documentation on ApplicationContext.Dispose Method (Boolean)
+ this.Dispose(false);
+ }
+
+ // --- Events ---
+ public event EventHandler ThreadExit;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/AssemblyInfo.cs b/mcs/class/System.Windows.Forms/WINELib/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/System.Windows.Forms/WINELib/BaseCollection.cs b/mcs/class/System.Windows.Forms/WINELib/BaseCollection.cs
new file mode 100644
index 00000000000..ef6934c1c2f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BaseCollection.cs
@@ -0,0 +1,79 @@
+//
+// System.Windows.Forms.BaseCollection
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides the base functionality for creating data-related collections in the System.Windows.Forms namespace.
+ /// ToDo note:
+ /// - Synchronization is not implemented
+ /// - MarshalByRefObject members not stubbed out
+ /// </summary>
+
+ [MonoTODO]
+ public class BaseCollection : MarshalByRefObject, ICollection, IEnumerable {
+
+ ArrayList list;
+
+
+ // --- Constructor ---
+ public BaseCollection()
+ {
+ this.list = null;
+ }
+
+
+
+ // --- public and protected Properties ---
+ //virtual
+ int ICollection.Count {
+ get {
+ return list.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ //always false as per spec.
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public bool IsSynchronized {
+ //always false as per spec.
+ get { return false; }
+ }
+
+ protected virtual ArrayList List {
+ get {
+ return list;
+ }
+ }
+
+ [MonoTODO]
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ // --- public Methods ---
+ public void CopyTo (Array ar, int index)
+ {
+ list.CopyTo(ar, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Binding.cs b/mcs/class/System.Windows.Forms/WINELib/Binding.cs
new file mode 100644
index 00000000000..1ffad0d12e1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Binding.cs
@@ -0,0 +1,101 @@
+//
+// System.Windows.Forms.Binding.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+ public class Binding {
+
+ /// <summary>
+ /// Represents the simple binding between the property value of an object and the property value of a control.
+ ///
+ /// ToDo note:
+ /// - Nothing is implemented
+ /// - MarshalByRefObject members not stubbed out
+ /// </summary>
+
+ // --- Constructor
+ //
+ public Binding(string propertyName,object dataSource,string dataMember)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public BindingManagerBase BindingManagerBase {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public BindingMemberInfo BindingMemberInfo {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Control Control {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object DataSource {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsBinding {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string PropertyName {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ protected virtual void OnFormat(ConvertEventArgs cevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnParse(ConvertEventArgs cevent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event ConvertEventHandler Format {
+
+ add { throw new NotImplementedException (); }
+ remove { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public event ConvertEventHandler Parse {
+
+ add { throw new NotImplementedException (); }
+ remove { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/BindingContext.cs b/mcs/class/System.Windows.Forms/WINELib/BindingContext.cs
new file mode 100644
index 00000000000..f6eeb6bc4e3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BindingContext.cs
@@ -0,0 +1,88 @@
+//
+// System.Windows.Forms.BindingContext.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ public class BindingContext {
+
+ /// <summary>
+ /// Manages the collection of BindingManagerBase objects for any object that inherits from the Control class.
+ /// </summary>
+
+ //private
+ // --- Constructor
+ [MonoTODO]
+ public BindingContext ()
+ {
+ //
+ }
+
+
+ //
+ // --- Public Properties
+ // Following properties not stubbed out, because they are only supporting internal .NET Framework infrastructure.
+ // - bool IsReadOnly {get;}
+ [MonoTODO]
+ public BindingManagerBase this[object dataSource] {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public BindingManagerBase this[object dataSource,string dataMember] {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ //
+ // --- Methods
+ // Following methods not stubbed out, because they are only supporting internal .NET Framework infrastructure.
+ // - protected virtual void AddCore(object dataSource,BindingManagerBase listManager)
+ // - protected virtual void ClearCore()
+ // - void ICollection.CopyTo(Array ar,int index)
+ // - IEnumerator IEnumerable.GetEnumerator()
+ // - protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ // - protected virtual void RemoveCore(object dataSource)
+ [MonoTODO]
+ protected internal void Add(object dataSource, BindingManagerBase listManager)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(object dataSource)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(object dataSource,string dataMember)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal void Remove(object dataSource)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ // Following events not stubbed out, because they are only supporting internal .NET Framework infrastructure
+ public event CollectionChangeEventHandler CollectionChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/BindingManagerBase.cs b/mcs/class/System.Windows.Forms/WINELib/BindingManagerBase.cs
new file mode 100644
index 00000000000..ec2c968e3a4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BindingManagerBase.cs
@@ -0,0 +1,112 @@
+//
+// System.Windows.Forms.BindingManagerBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+ //Compact Framework. Everything execpt suspend and resume binding needed for CE.
+ [MonoTODO]
+ public abstract class BindingManagerBase {
+
+
+ /// <summary>
+ /// Manages all Binding objects that are bound to the same data source and data member. This class is abstract.
+ /// </summary>
+
+ // --- Constructor
+ [MonoTODO]
+ public BindingManagerBase ()
+ {
+ }
+
+ //
+ // --- Fields
+ protected EventHandler onCurrentChangedHandler;
+ protected EventHandler onPositionChangedHandler;
+
+
+ //
+ // --- Public Properties
+ [MonoTODO]
+ public BindingsCollection Bindings {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ public abstract int Count {
+
+ get;
+ }
+
+ public abstract object Current {
+
+ get;
+ }
+
+ public abstract int Position {
+
+ get;
+ set;
+ }
+
+ //
+ // --- Methods
+ public abstract void AddNew();
+
+ public abstract void CancelCurrentEdit();
+
+ public abstract void EndCurrentEdit();
+
+ public abstract PropertyDescriptorCollection GetItemProperties ();
+
+ [MonoTODO]
+ protected internal virtual PropertyDescriptorCollection GetItemProperties (ArrayList dataSources,ArrayList listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual PropertyDescriptorCollection GetItemProperties (Type listType,int offset,ArrayList dataSources,ArrayList listAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //protected abstract string GetListName(ArrayList listAccessors);
+ protected internal abstract string GetListName(ArrayList listAccessors);
+
+ protected internal abstract void OnCurrentChanged(EventArgs e);
+
+ [MonoTODO]
+ protected void PullData()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void PushData()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void RemoveAt(int index);
+
+ public abstract void ResumeBinding();
+ public abstract void SuspendBinding();
+
+ protected abstract void UpdateIsBinding();
+
+
+ //
+ // --- Public Events
+
+ public event EventHandler CurrentChanged;
+ public event EventHandler PositionChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/BindingMemberInfo.cs b/mcs/class/System.Windows.Forms/WINELib/BindingMemberInfo.cs
new file mode 100644
index 00000000000..f4268a7319a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BindingMemberInfo.cs
@@ -0,0 +1,149 @@
+//
+// System.Drawing.BindingMemberInfo.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+//TODO:
+// 1) Add real values in constructor.
+// 2) Verify nocheck needed in GetHashCode.
+// 3) Verify GetHashCode returns decent and valid hash.
+
+
+using System;
+using System.Windows.Forms;
+namespace System.Windows.Forms {
+
+ public struct BindingMemberInfo {
+
+ private string bindingfield;
+ private string bindingpath;
+ private string bindingmember;
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+
+ public BindingMemberInfo (string dataMember)
+ {
+ //TODO: Initilize with real values.
+ bindingmember = ("");
+ bindingfield = ("");
+ bindingpath = ("");
+ }
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two BindingMemberInfo objects. The return value is
+ /// based on the equivalence of the BindingMember, BindingPath,
+ /// and BindingMember properties of the two objects.
+ /// </remarks>
+
+ public static bool operator == (BindingMemberInfo bmi_a,
+ BindingMemberInfo bmi_b) {
+
+ return ((bmi_a.bindingfield == bmi_b.bindingfield) &&
+ (bmi_a.bindingpath == bmi_b.bindingpath)&&
+ (bmi_a.bindingmember == bmi_b.bindingmember));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two BindingMemberInfo objects. The return value is
+ /// based on the equivalence of the BindingMember, BindingPath,
+ /// and BindingMember properties of the two objects.
+ /// </remarks>
+ public static bool operator != (BindingMemberInfo bmi_a,
+ BindingMemberInfo bmi_b) {
+ return ((bmi_a.bindingfield != bmi_b.bindingfield) ||
+ (bmi_a.bindingpath != bmi_b.bindingpath)||
+ (bmi_a.bindingmember != bmi_b.bindingmember));
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+
+ public string BindingField {
+ get{
+ return bindingfield;
+ }
+ }
+
+ public string BindingPath {
+ get{
+ return bindingpath;
+ }
+ }
+
+ public string BindingMember {
+ get{
+ return bindingmember;
+ }
+ }
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this BindingMemberInfo and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is BindingMemberInfo))
+ return false;
+
+ return (this == (BindingMemberInfo) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ unchecked{// MONOTODO: This should not be checked, remove unchecked, if redundant.
+ return (int)( bindingfield.GetHashCode() ^ bindingmember.GetHashCode() ^ bindingpath.GetHashCode());
+ }
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the BindingMemberInfo as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2}]", bindingpath, bindingfield, bindingmember);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/BindingsCollection.cs b/mcs/class/System.Windows.Forms/WINELib/BindingsCollection.cs
new file mode 100644
index 00000000000..54dfcea2ee4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BindingsCollection.cs
@@ -0,0 +1,113 @@
+//
+// System.Windows.Forms.BindingsCollection.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a collection of Binding objects for a control.
+ ///
+ /// </summary>
+
+ [MonoTODO]
+ public class BindingsCollection : BaseCollection {
+
+ #region Constructors
+ protected internal BindingsCollection ()
+ {
+ }
+ #endregion
+
+ // --- public and protected Properties ---
+ public virtual int Count {
+ get {
+ return base.Count;
+ }
+ }
+
+ public Binding this[int index] {
+ get {
+ return (Binding)(base.List[index]);
+ }
+ }
+
+ [MonoTODO]
+ protected override ArrayList List {
+ get {
+ return base.List;
+ }
+ }
+
+ // --- public Methods ---
+ // following internal methods are (will) not be stubbed out:
+ // - protected virtual void AddCore(Binding dataBinding);
+ // - protected virtual void ClearCore();
+ // - protected virtual void RemoveCore(Binding dataBinding);
+ //
+ // CollectionChanged event:
+ // Though it was not documented, here methods Add and Remove
+ // cause the CollectionChanged event to occur, similarily as Clear.
+ // Would be nice if someone checked the exact event behavior of .NET implementation.
+
+ protected internal void Add(Binding binding)
+ {
+ base.List.Add(binding);
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Add,
+ base.List
+ ));
+ }
+
+ protected internal void Clear()
+ {
+ base.List.Clear();
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Refresh,
+ base.List
+ ));
+ }
+
+ protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ CollectionChanged(this, ccevent);
+ }
+
+ protected internal void Remove(Binding binding)
+ {
+ base.List.Remove(binding);
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Remove,
+ base.List
+ ));
+ }
+
+ protected internal void RemoveAt(int index)
+ {
+ base.List.RemoveAt(index);
+ OnCollectionChanged(new CollectionChangeEventArgs(
+ CollectionChangeAction.Remove,
+ base.List
+ ));
+ }
+
+ protected internal bool ShouldSerializeMyAll()
+ {
+ throw new NotImplementedException ();
+ if (this.Count>0) return true;
+ else return false;
+ }
+
+ // public events
+ public event CollectionChangeEventHandler CollectionChanged;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/BorderStyle.cs b/mcs/class/System.Windows.Forms/WINELib/BorderStyle.cs
new file mode 100644
index 00000000000..ae105c61d4c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BorderStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.BorderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum BorderStyle {
+ Fixed3D = 2,
+ FixedSingle = 1,
+ None = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/BoundsSpecified.cs b/mcs/class/System.Windows.Forms/WINELib/BoundsSpecified.cs
new file mode 100644
index 00000000000..797552920e0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/BoundsSpecified.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.BoundsSpecified.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum BoundsSpecified {
+ All = 15,
+ Height = 8,
+ Location = 3,
+ None = 0,
+ Size = 12,
+ Width = 4,
+ X = 1,
+ Y = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Button.cs b/mcs/class/System.Windows.Forms/WINELib/Button.cs
new file mode 100644
index 00000000000..b6ed689bfdd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Button.cs
@@ -0,0 +1,115 @@
+//
+// System.Windows.Forms.Button.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows button control.
+ /// </summary>
+
+ public class Button : ButtonBase, IButtonControl {
+
+ // private fields
+ DialogResult dialogResult;
+
+ // --- Constructor ---
+ public Button() : base()
+ {
+ dialogResult = DialogResult.None;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "BUTTON";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ Win32.WS_CHILD |
+ Win32.WS_VISIBLE);
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ // --- IButtonControl property ---
+ public virtual DialogResult DialogResult {
+ get { return dialogResult; }
+ set { dialogResult = value; }
+ }
+
+ // --- IButtonControl method ---
+ [MonoTODO]
+ public virtual void NotifyDefault(bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void PerformClick()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Button methods for events ---
+ protected override void OnClick(EventArgs e)
+ {
+ base.OnClick (e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ // --- Button methods ---
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ return base.ProcessMnemonic (charCode);
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- Button events ---
+ /// commented out, cause it only supports the .NET Framework infrastructure
+ /*
+ [MonoTODO]
+ public new event EventHandler DoubleClick {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs b/mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs
new file mode 100644
index 00000000000..af28a639730
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ButtonBase.cs
@@ -0,0 +1,198 @@
+//
+// System.Windows.Forms.ButtonBase.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Implements the basic functionality common to button controls.
+ /// ToDo note:
+ /// - no methods are implemented
+ /// </summary>
+
+ public abstract class ButtonBase : Control {
+
+ // private fields
+ FlatStyle flatStyle;
+ Image image;
+ ContentAlignment imageAlign;
+ int imageIndex;
+ ContentAlignment textAlign;
+ ImeMode imeMode;
+ bool isDefault;
+ CreateParams createParams;
+//
+// // --- Constructor ---
+ protected ButtonBase() : base()
+ {
+ flatStyle = FlatStyle.Standard;
+ image = null;
+ imageAlign = ContentAlignment.MiddleCenter;
+ imageIndex = -1;
+ textAlign = ContentAlignment.MiddleCenter;
+ imeMode = ImeMode.Inherit;
+ isDefault = false;
+ }
+
+ // --- Properties ---
+ protected override CreateParams CreateParams {
+ get { return createParams; }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return base.DefaultSize; }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set { flatStyle=value; }
+ }
+
+ public Image Image {
+ get { return image; }
+ set { image=value; }
+ }
+
+ public ContentAlignment ImageAlign {
+ get { return imageAlign; }
+ set { imageAlign=value; }
+ }
+
+ public int ImageIndex {
+ get { return imageIndex; }
+ set { imageIndex=value; }
+ }
+
+ public new ImeMode ImeMode {
+ get {
+ return imeMode; }
+ set {
+ imeMode = value;
+ }
+ }
+
+ protected bool IsDefault {
+ get {
+ return isDefault;
+ }
+ set {
+ isDefault = value;
+ }
+ }
+
+ [MonoTODO]
+ //public virtual ContentAlignment TextAlign {
+ // get { return label.TextAlign; }
+ // set { label.TextAlign = value; }
+ //}
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected override void Dispose(bool);
+ /// - protected void ResetFlagsandPaint();
+
+
+ // I do not think this is part of the spec.
+ //protected override AccessibleObject CreateAccessibilityInstance()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ /// [methods for events]
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnGotFocus (EventArgs e)
+ {
+ base.OnGotFocus (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs kevent)
+ {
+ base.OnKeyDown (kevent);
+ }
+
+ protected override void OnKeyUp (KeyEventArgs kevent)
+ {
+ base.OnKeyUp (kevent);
+ }
+
+ protected override void OnLostFocus (EventArgs e)
+ {
+ base.OnLostFocus (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ base.OnMouseDown (e);
+ }
+
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ base.OnMouseEnter (e);
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+ /// end of [methods for events]
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// --- ButtonBase.ButtonBaseAccessibleObject ---
+ /// the class is not stubbed, cause it's only used for .NET framework
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/CheckState.cs b/mcs/class/System.Windows.Forms/WINELib/CheckState.cs
new file mode 100644
index 00000000000..94464793c81
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/CheckState.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.CheckState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the state of a control, such as a check box,
+ /// that can be checked, unchecked, or set to an indeterminate state.
+ /// </summary>
+ //[Serializable]
+ public enum CheckState {
+
+ //Values were verified with enumcheck.
+ Unchecked = 0,
+ Checked = 1,
+ Indeterminate = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ColorDepth.cs b/mcs/class/System.Windows.Forms/WINELib/ColorDepth.cs
new file mode 100644
index 00000000000..9ee4992bb42
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ColorDepth.cs
@@ -0,0 +1,22 @@
+//
+// System.Windows.Forms.ColorDepth.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ColorDepth {
+ Depth16Bit = 16,
+ Depth24Bit = 24,
+ Depth32Bit = 32,
+ Depth4Bit = 4,
+ Depth8Bit = 8
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ColumnClickEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ColumnClickEventArgs.cs
new file mode 100644
index 00000000000..1adcdbdc6e1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ColumnClickEventArgs.cs
@@ -0,0 +1,103 @@
+//
+// System.Windows.Forms.ColumnClickEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Implmented by Dennis Hayes <dennish@raytek.com>
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the ColumnClick event.
+ /// </summary>
+ public class ColumnClickEventArgs : EventArgs {
+
+ private int column;
+ /// --- Constructor ---
+ public ColumnClickEventArgs(int Column) : base()
+ {
+ column = Column;
+ }
+
+
+ /// --- Properties ---
+ public int Column {
+ get {
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ColumnClickEventArgs objects. The return value is
+ /// based on the equivalence of the Column properties
+ /// of the two ColumnClickEventArgs.
+ /// </remarks>
+
+ public static bool operator == (ColumnClickEventArgs ColumnClickEventArgsA , ColumnClickEventArgs ColumnClickEventArgsB)
+ {
+ return ColumnClickEventArgsA.column == ColumnClickEventArgsB.column;
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ColumnClickEventArgs objects. The return value is
+ /// based on the equivalence of the Column properties
+ /// of the two ColumnClickEventArgs.
+ /// </remarks>
+
+ public static bool operator != (ColumnClickEventArgs ColumnClickEventArgsA, ColumnClickEventArgs ColumnClickEventArgsB)
+ {
+ return ColumnClickEventArgsA.column != ColumnClickEventArgsB.column;
+ }
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this ColumnClickEventArgs and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ColumnClickEventArgs))return false;
+ return (this == (ColumnClickEventArgs) obj);
+ }
+
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ // If class has only one proprity, just return the hash code of the proprity.
+ public override int GetHashCode ()
+ {
+ return column.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the ColumnClickEventArgs as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0}]", column);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ColumnClickEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ColumnClickEventHandler.cs
new file mode 100644
index 00000000000..b3f15632067
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ColumnClickEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.Windows.Forms.ColumnClickEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ColumnClickEventHandler(
+ object sender,
+ ColumnClickEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ComVisible.cs b/mcs/class/System.Windows.Forms/WINELib/ComVisible.cs
new file mode 100644
index 00000000000..5b55ebf5ee9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ComVisible.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.ComVisible.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Enum |
+ AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Interface |
+ AttributeTargets.Delegate)]
+ public sealed class ComVisibleAttribute : Attribute {
+
+ private bool Visible = false;
+ public ComVisibleAttribute(bool value) {Visible = value;}
+ public bool Value { get {return Visible;} }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ContainerControl.cs b/mcs/class/System.Windows.Forms/WINELib/ContainerControl.cs
new file mode 100644
index 00000000000..d9069ab2617
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ContainerControl.cs
@@ -0,0 +1,127 @@
+//
+// System.Windows.Forms.ContainerControl.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides focus management functionality for controls that can function as a container for other controls.
+ /// </summary>
+
+ public class ContainerControl : ScrollableControl, IContainerControl {
+
+ protected ContainerControl () : base ()
+ {
+ }
+
+
+ public Control ActiveControl {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ // not ready for BindingContext
+ //public override BindingContext BindingContext {
+ // get { throw new NotImplementedException (); }
+ // set { throw new NotImplementedException (); }
+ //}
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams; }
+ }
+
+ [MonoTODO]
+ public Form ParentForm {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected virtual void UpdateDefaultButton()
+
+ protected override void AdjustFormScrollbars (
+ bool displayScrollbars)
+ {
+ base.AdjustFormScrollbars (displayScrollbars);
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // not memeber?
+ //bool IContainerControl.ActivateControl(Control control)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ // [event methods]
+ protected override void OnControlRemoved (ControlEventArgs e)
+ {
+ base.OnControlRemoved (e);
+ }
+
+ protected override void OnCreateControl ()
+ {
+ base.OnCreateControl ();
+ }
+ // end of [event methods]
+
+ [MonoTODO]
+ protected override bool ProcessDialogChar (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessTabKey (bool forward)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Not an overridden function?
+ //protected override void Select(bool directed,bool forward)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public bool Validate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ base.WndProc(ref m);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventArgs.cs
new file mode 100644
index 00000000000..c439f824ced
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventArgs.cs
@@ -0,0 +1,122 @@
+//
+// System.Windows.Forms.ColumnClickEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the ContentsResized event.
+ /// </summary>
+
+ public class ContentsResizedEventArgs : EventArgs {
+
+ #region Fields
+ private Rectangle newrectangle;
+ #endregion
+
+ /// --- Constructor ---
+ public ContentsResizedEventArgs(Rectangle newRectangle) : base()
+ {
+ newrectangle = newRectangle;
+ }
+
+ #region Public Propeties
+ public Rectangle NewRectangle
+ {
+ get {
+ return newrectangle;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ContentsResizedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// newRectangle Property
+ /// of the two ContentsResizedEventArgs.
+ /// </remarks>
+ public static bool operator == (ContentsResizedEventArgs ContentsResizedEventArgsA, ContentsResizedEventArgs ContentsResizedEventArgsB)
+ {
+ return (ContentsResizedEventArgsA.NewRectangle == ContentsResizedEventArgsB.NewRectangle);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ContentsResizedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// newRectangle Property
+ /// of the two ContentsResizedEventArgs.
+ /// </remarks>
+ public static bool operator != (ContentsResizedEventArgs ContentsResizedEventArgsA, ContentsResizedEventArgs ContentsResizedEventArgsB)
+ {
+ return (ContentsResizedEventArgsA.NewRectangle != ContentsResizedEventArgsB.NewRectangle);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ContentsResizedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ContentsResizedEventArgs))return false;
+ return (this == (ContentsResizedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " ContentsResizedEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventHandler.cs
new file mode 100644
index 00000000000..ed43ff42eb9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ContentsResizedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ContentsResizedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ContentsResizedEventHandler(
+ object sender,
+ ContentsResizedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ContextMenu.cs b/mcs/class/System.Windows.Forms/WINELib/ContextMenu.cs
new file mode 100644
index 00000000000..ac06acc5e6d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ContextMenu.cs
@@ -0,0 +1,82 @@
+//
+// System.Windows.Forms.ContextMenu.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+//using System.ComponentModel;
+//using System.Collections;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a Windows combo box control.
+ /// ToDo note:
+ /// - nothing is implemented
+ /// </summary>
+
+ [MonoTODO]
+ public class ContextMenu : Menu {
+
+ // private fields
+ RightToLeft rightToLeft;
+
+ // --- Constructor ---
+ [MonoTODO]
+ public ContextMenu() //: base(null)
+ {
+ rightToLeft = RightToLeft.Inherit;
+ }
+
+ [MonoTODO]
+ public ContextMenu(MenuItem[] menuItems) //: base(menuItems)//menu does not have public constructor. Is this a gtk menu?
+ {
+ }
+
+
+
+
+ // --- Properties ---
+ public virtual RightToLeft RightToLeft {
+ get { return rightToLeft; }
+ set { rightToLeft=value; }
+ }
+
+ [MonoTODO]
+ public Control SourceControl {
+ get { throw new NotImplementedException (); }
+ }
+
+
+
+
+ /// --- Methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected internal virtual void OnPopup(EventArgs e);
+ [MonoTODO]
+ public void Show(Control control,Point pos)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+
+
+ /// events
+ [MonoTODO]
+ public event EventHandler Popup {
+ add {
+ throw new NotImplementedException ();
+ }
+ remove {
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Control.cs b/mcs/class/System.Windows.Forms/WINELib/Control.cs
new file mode 100644
index 00000000000..2791867bec8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Control.cs
@@ -0,0 +1,2954 @@
+ //
+ // System.Windows.Forms.Control.cs
+ //
+ // Author:
+ // stubbed out by Jaak Simm (jaaksimm@firm.ee)
+ // Dennis Hayes (dennish@rayetk.com)
+ // WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+ //
+ // (C) Ximian, Inc., 2002
+ //
+
+ using System.ComponentModel;
+ using System.Drawing;
+ using System.Collections;
+
+ namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Defines the base class for controls, which are components with
+ /// visual representation.
+ /// </summary>
+
+ public class Control : Component , ISynchronizeInvoke, IWin32Window {
+
+ // Helper NativeWindow class to dispatch messages back
+ // to the Control class
+ protected class ControlNativeWindow : NativeWindow {
+
+ private Control control;
+
+ public ControlNativeWindow (Control control) : base() {
+ this.control = control;
+ }
+
+ protected override void WndProc (ref Message m) {
+ base.WndProc (ref m);
+
+ control.WndProc (ref m);
+ }
+ }
+
+ // FIXME: not sure if dervied classes should have access
+ protected ControlNativeWindow window;
+ private ControlCollection childControls;
+ private Control parent;
+
+ // private fields
+ // it seems these are stored in case the window is not created,
+ // corresponding properties (below) need to check if window
+ // is created or not and react accordingly
+ string accessibleDefaultActionDescription;
+ string accessibleDescription;
+ string accessibleName;
+ AccessibleRole accessibleRole;
+ bool allowDrop;
+ AnchorStyles anchor;
+ Color backColor;
+ Image backgroundImage;
+ //BindingContext bindingContext;
+ Rectangle bounds;
+ bool causesValidation;
+ //ContextMenu contextMenu;
+ DockStyle dock;
+ bool enabled;
+ Font font;
+ Color foreColor;
+ ImeMode imeMode;
+ bool isAccessible;
+ // Point location; // using bounds to store location
+ string name;
+ Region region;
+ RightToLeft rightToLeft;
+ bool tabStop;
+ string text;
+ bool visible;
+
+ // --- Constructors ---
+
+ //Compact Framework //only Control()
+ public Control ()
+ {
+ CreateControlsInstance ();
+
+ accessibleDefaultActionDescription = null;
+ accessibleDescription = null;
+ accessibleName = null;
+ accessibleRole = AccessibleRole.Default;
+ allowDrop = false;
+ anchor = AnchorStyles.Top | AnchorStyles.Left;
+ //backColor = Control.DefaultBackColor;
+ backgroundImage = null;
+ bounds = new Rectangle();
+ // bindingContext = null;
+ causesValidation = true;
+ // contextMenu = null;
+ dock = DockStyle.None;
+ enabled = true;
+ // font = Control.DefaultFont;
+ // foreColor = Control.DefaultForeColor;
+ imeMode = ImeMode.Inherit;
+ isAccessible = false;
+ // location = new Point (0,0); should be from OS
+ name = "";
+ region = null;
+ rightToLeft = RightToLeft.Inherit;
+ tabStop = false;
+ text = "";
+ visible = true;
+ parent = null;
+ window = null;
+ }
+
+ // according to docs, the constructors do not create
+ // the (HWND) window
+ public Control (string text) : this()
+ {
+ Text = text;
+ // Win32.SetWindowTextA (Handle, text);
+ }
+
+ public Control (Control parent, string text) : this (text)
+ {
+ Parent = parent;
+ // Win32.SetParent (Handle, parent.Handle);
+ }
+
+ public Control (string text, int left, int top,
+ int width, int height) : this(text)
+ {
+ Left = left;
+ Top = top;
+ Width = width;
+ Height = height;
+ //Win32.SetWindowPos (Handle, (IntPtr) 0, left, top,
+ // width, height, 0);
+ }
+
+ public Control (Control parent,string text,int left, int top,
+ int width,int height) : this (parent, text)
+ {
+ Left = left;
+ Top = top;
+ Width = width;
+ Height = height;
+ // Win32.SetWindowPos (Handle, (IntPtr) 0, left, top,
+ // width, height, 0);
+ }
+
+ // for internal use only, create a control class
+ // for an existing, created HWND
+ private Control (IntPtr existingHandle)
+ {
+ window = (ControlNativeWindow) NativeWindow.FromHandle (
+ existingHandle);
+ }
+
+ // --- Properties ---
+ // Properties only supporting .NET framework, not stubbed out:
+ // - protected bool RenderRightToLeft {get;}
+ // - public IWindowTarget WindowTarget {get; set;}
+ //[MonoTODO]
+ //public AccessibleObject AccessibilityObject {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public string AccessibleDefaultActionDescription {
+ get {
+ return accessibleDefaultActionDescription;
+ }
+ set {
+ accessibleDefaultActionDescription = value;
+ }
+ }
+
+ public string AccessibleDescription {
+ get {
+ return accessibleDescription;
+ }
+ set {
+ accessibleDescription=value;
+ }
+ }
+
+ public string AccessibleName {
+ get {
+ return accessibleName;
+ }
+ set {
+ accessibleName=value;
+ }
+ }
+
+ public AccessibleRole AccessibleRole {
+ get {
+ return accessibleRole;
+ }
+ set {
+ accessibleRole=value;
+ }
+ }
+
+ public virtual bool AllowDrop {
+ get {
+ return allowDrop;
+ }
+ set {
+ allowDrop=value;
+ }
+ }
+
+ public virtual AnchorStyles Anchor {
+ get {
+ return anchor;
+ }
+ set {
+ anchor=value;
+ }
+ }
+
+ //Compact Framework
+ public virtual Color BackColor {
+ get {
+ if (IsHandleCreated) {
+ IntPtr dc = Win32.GetDC (Handle);
+ uint bgColor = Win32.GetBkColor (dc);
+ Win32.ReleaseDC (Handle, dc);
+ int r = (int) (bgColor & 0xFF);
+ int g = (int) ((bgColor >> 8) & 0xFF);
+ int b = (int) ((bgColor >> 16) & 0xFF);
+ return Color.FromArgb (r, g, b);
+ } else return backColor;
+ }
+ set {
+ backColor = value;
+ if (IsHandleCreated) {
+ IntPtr dc = Win32.GetDC (Handle);
+ Win32.SetBkColor (dc, (uint) value.ToArgb());
+ Win32.ReleaseDC (Handle, dc);
+ }
+ }
+ }
+
+ public virtual Image BackgroundImage {
+ get {
+ return backgroundImage;
+ }
+ set {
+ backgroundImage = value;
+ // FIXME: force redraw
+ }
+ }
+
+ // waiting for BindingContext
+ //public virtual BindingContext BindingContext {
+ // get {
+ // //return bindingContext;
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // //bindingContext=value;
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //Compact Framework
+ public int Bottom {
+ get {
+ return Top + Height;
+ }
+ }
+
+ //Compact Framework
+ public Rectangle Bounds {
+ get {
+ if (IsHandleCreated) {
+ Win32.RECT rect = new Win32.RECT();
+ Win32.GetWindowRect (Handle, ref rect);
+ return new Rectangle ((int) rect.left,
+ (int) rect.top,
+ (int) rect.right,
+ (int) rect.bottom);
+ } else return bounds;
+ }
+ set {
+ if (IsHandleCreated)
+ Win32.SetWindowPos (
+ Handle, (IntPtr) 0, value.X, value.Y,
+ value.Width, value.Height, 0);
+ else bounds = value;
+ }
+ }
+
+ public bool CanFocus {
+ get {
+ if (IsHandleCreated && Visible && Enabled)
+ return true;
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ public bool CanSelect {
+ get {
+ // if (ControlStyles.Selectable &&
+ // isContainedInAnotherControl &&
+ // parentIsVisiable && isVisialbe &&
+ // parentIsEnabled && isEnabled) {
+ // return true;
+ // }
+ // return false;
+
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public bool Capture {
+ get {
+ if (IsHandleCreated) {
+ IntPtr captured = Win32.GetCapture ();
+ if (Handle == captured)
+ return true;
+ }
+ return false;
+ }
+ set {
+ if (IsHandleCreated) {
+ if (value)
+ Win32.SetCapture (Handle);
+ else {
+ IntPtr captured = Win32.GetCapture ();
+
+ // if this window is in capture state
+ // release it
+ if (Handle == captured)
+ Win32.ReleaseCapture ();
+ }
+ }
+ }
+ }
+
+ public bool CausesValidation {
+ get {
+ return causesValidation;
+ }
+ set {
+ causesValidation=value;
+ }
+ }
+
+ //Compact Framework
+ public Rectangle ClientRectangle {
+ get {
+ if (IsHandleCreated) {
+ Win32.RECT rect = new Win32.RECT();
+ Win32.GetClientRect (Handle, ref rect);
+ return new Rectangle ((int) rect.left,
+ (int) rect.top,
+ (int) rect.right,
+ (int) rect.bottom);
+ }
+
+ // FIXME: is the correct return value for
+ // window who's handle is not created
+ return new Rectangle (0, 0, 0, 0);
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Size ClientSize {
+ get {
+ // FIXME: use GetSystemMetrics and/or
+ // GetClientRect here?
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string CompanyName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool ContainsFocus {
+ get {
+ if (IsHandleCreated) {
+ IntPtr focusedWindow = Win32.GetFocus();
+ if (focusedWindow == Handle)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ //public virtual ContextMenu ContextMenu {
+ // get {
+ // //return contextMenu;
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // //contextMenu=value;
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public ControlCollection Controls {
+ get { return childControls; }
+ }
+
+ public bool Created {
+ get {
+ if (Handle != (IntPtr) 0)
+ return true;
+ return false;
+ }
+ }
+
+ protected virtual CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ createParams.Caption = Text;
+ createParams.ClassName = "mono_native_window";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+
+ if (parent != null)
+ createParams.Parent = parent.Handle;
+ else
+ createParams.Parent = (IntPtr) 0;
+
+ createParams.Style = (int) Win32.WS_OVERLAPPEDWINDOW;
+
+ return createParams;
+ }
+ }
+
+ [MonoTODO]
+ public virtual Cursor Cursor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ // waiting for BindingContext
+ //public ControlBindingsCollection DataBindings {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public static Color DefaultBackColor {
+ get {
+ // FIXME: use GetSystemMetrics?
+ //return SystemColors.Control;
+ throw new NotImplementedException ();
+ }
+ }
+
+ //[MonoTODO]
+ // FIXME: use GetSystemMetrics?
+ //public static Font DefaultFont {
+ // FIXME: get current system font from GenericSansSerif
+ // call ArgumentException not called
+ // get {
+ // throw new NotImplementedException ();
+ //return (FontFamily.GenericSansSerif);
+ // }
+ //}
+
+ public static Color DefaultForeColor {
+ get {
+ // FIXME: use GetSystemMetrics?
+ //return SystemColors.ControlText;
+ throw new NotImplementedException ();
+ }
+ }
+
+ protected virtual ImeMode DefaultImeMode {
+ get {
+ //return ImeMode.Inherit;
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected virtual Size DefaultSize {
+ get {
+ // FIXME: use GetSystemMetrics?
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual Rectangle DisplayRectangle {
+ get {
+ return ClientRectangle;
+ }
+ }
+
+ [MonoTODO]
+ public bool Disposing {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual DockStyle Dock {
+ get {
+ return dock;
+ }
+ set {
+ dock=value;
+ }
+ }
+
+ //Compact Framework
+ public virtual bool Enabled {
+ get {
+ return Win32.IsWindowEnabled (Handle);
+ }
+ set {
+ Win32.EnableWindow (Handle, value);
+ }
+ }
+
+ //Compact Framework
+ public virtual bool Focused {
+ get {
+ return ContainsFocus;
+ }
+ }
+
+ //Compact Framework
+ // [MonoTODO]
+ //public virtual Font Font {
+ // CHECKME:
+ // get {
+ //return font;
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ //font=value;
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ [MonoTODO]
+ protected int FontHeight {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public virtual Color ForeColor {
+ get {
+ return foreColor;
+ }
+ set {
+ foreColor = value;
+ }
+ }
+
+ public bool HasChildren {
+ get {
+ if (childControls.Count >0)
+ return true;
+ return false;
+ }
+ }
+
+ //Compact Framework
+ public int Height {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ }
+ return bounds.Height;
+ }
+ set {
+ bounds.Height = value;
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ public ImeMode ImeMode {
+ // CHECKME:
+ get {
+ return imeMode;
+ }
+ set {
+ imeMode=value;
+ }
+ }
+
+ public bool IsAccessible {
+ // CHECKME:
+ get {
+ return isAccessible;
+ } // default is false
+ set {
+ isAccessible=value;
+ }
+ }
+
+ public bool IsDisposed {
+ get {
+ if (Handle == (IntPtr) 0)
+ return true;
+ return false;
+ }
+ }
+
+ public bool IsHandleCreated {
+ get {
+ if (Handle != (IntPtr) 0)
+ return true;
+ return false;
+ }
+ }
+
+ //Compact Framework
+ public int Left {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ return 0;
+ } else return bounds.X;
+ }
+ set {
+ bounds.X = value;
+
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ //Compact Framework
+ public Point Location {
+ // CHECKME:
+ get {
+ return new Point (Top, Left);
+ }
+ set {
+ bounds.X = value.X;
+ bounds.Y = value.Y;
+
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+
+ }
+ }
+
+ [MonoTODO]
+ public static Keys ModifierKeys {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public static MouseButtons MouseButtons {
+ get {
+ // FIXME: use GetAsycKeyState?
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public static Point MousePosition {
+ get {
+ Win32.POINT point = new Win32.POINT();
+ Win32.GetCursorPos (ref point);
+ return new Point ( (int) point.x, (int) point.y);
+ }
+ }
+
+ public string Name {
+ // CHECKME:
+ get {
+ return name;
+ }
+ set {
+ name=value;
+ }
+ }
+
+ //Compact Framework
+ public Control Parent {
+ get {
+ return parent;
+ //IntPtr parent = Win32.GetParent (Handle);
+ //return FromHandle (parent);
+ }
+ set {
+ Console.WriteLine ("setting parent");
+ parent = value;
+
+ Console.WriteLine ("add ourself to the parents control");
+ // add ourself to the parents control
+ parent.Controls.Add (this);
+
+ Console.WriteLine ("SetParent");
+ if (IsHandleCreated) {
+ Console.WriteLine ("Handle created");
+ Win32.SetParent (Handle, value.Handle);
+ }
+ }
+ }
+
+ [MonoTODO]
+ public string ProductName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string ProductVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool RecreatingHandle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Region Region {
+ // CHECKME:
+ get {
+ return region;
+ }
+ set {
+ region=value;
+ }
+ }
+
+ [MonoTODO]
+ protected bool ResizeRedraw {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public int Right {
+ get {
+ return Left + Width;
+ }
+ }
+
+ [MonoTODO]
+ public virtual RightToLeft RightToLeft {
+ // CHECKME:
+ get {
+ return rightToLeft;
+ }
+ set {
+ rightToLeft=value;
+ }
+ }
+
+ [MonoTODO]
+ protected virtual bool ShowFocusCues {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected bool ShowKeyboardCues {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Size Size {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int TabIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool TabStop {
+ // CHECKME:
+ get {
+ return tabStop;
+ }
+ set {
+ tabStop = value;
+ }
+ }
+
+ [MonoTODO]
+ public object Tag {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public virtual string Text {
+ get {
+ if (IsHandleCreated) {
+ String text = "";
+ int length = Win32.GetWindowTextLengthA (Handle);
+ Win32.GetWindowTextA (Handle, ref text, length);
+ return text;
+ } else return text;
+ }
+ set {
+ text = value;
+
+ if (IsHandleCreated)
+ Win32.SetWindowTextA (Handle, value);
+ }
+ }
+
+ //Compact Framework
+ public int Top {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ return 0;
+ } else return bounds.Top;
+ }
+ set {
+ bounds.Y = value;
+
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ [MonoTODO]
+ public Control TopLevelControl {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ public bool Visible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ if (value)
+ Win32.ShowWindow (
+ Handle, Win32.SW_SHOW);
+ else
+ Win32.ShowWindow (
+ Handle, Win32.SW_HIDE);
+ }
+ }
+
+ //Compact Framework
+ public int Width {
+ get {
+ if (IsHandleCreated) {
+ // FIXME: GetWindowPos
+ }
+ return bounds.Width;
+ }
+ set {
+ bounds.Width = value;
+ if (IsHandleCreated) {
+ // FIXME: SetWindowPos
+ }
+ }
+ }
+
+ /// --- methods ---
+ /// internal .NET framework supporting methods, not stubbed out:
+ /// - protected virtual void NotifyInvalidate(Rectangle invalidatedArea)
+ /// - protected void RaiseDragEvent(object key,DragEventArgs e);
+ /// - protected void RaiseKeyEvent(object key,KeyEventArgs e);
+ /// - protected void RaiseMouseEvent(object key,MouseEventArgs e);
+ /// - protected void RaisePaintEvent(object key,PaintEventArgs e);
+ /// - protected void ResetMouseEventArgs();
+
+ [MonoTODO]
+ protected void AccessibilityNotifyClients (
+ AccessibleEvents accEvent,int childID)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public void BringToFront ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool Contains (Control ctl)
+ {
+ return childControls.Contains (ctl);
+ }
+
+ public void CreateControl ()
+ {
+ CreateHandle ();
+ }
+
+ //[MonoTODO]
+ //AccessibleObject not ready
+ //protected virtual AccessibleObject CreateAccessibilityInstance() {
+ // throw new NotImplementedException ();
+ //}
+
+ protected virtual ControlCollection CreateControlsInstance ()
+ {
+ childControls = new ControlCollection (this);
+ return childControls;
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Graphics CreateGraphics ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void CreateHandle ()
+ {
+ window = new ControlNativeWindow (this);
+
+ window.CreateHandle (CreateParams);
+ }
+
+ protected virtual void DefWndProc (ref Message m)
+ {
+ window.DefWndProc(ref m);
+ }
+
+ protected virtual void DestroyHandle ()
+ {
+ window.DestroyHandle ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DragDropEffects DoDragDrop (
+ object data, DragDropEffects allowedEffects)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public object EndInvoke(IAsyncResult asyncResult):
+ //look under ISynchronizeInvoke methods
+
+ [MonoTODO]
+ public Form FindForm ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public bool Focus ()
+ {
+ if (Win32.SetFocus (Handle) != (IntPtr) 0)
+ return true;
+ return false;
+ }
+
+ [MonoTODO]
+ public static Control FromChildHandle (IntPtr handle)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Control FromHandle (IntPtr handle)
+ {
+ Control control = new Control (handle);
+ return control;
+ }
+
+ [MonoTODO]
+ public Control GetChildAtPoint (Point pt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ //public IContainerControl GetContainerControl ()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public Control GetNextControl (Control ctl, bool forward)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool GetStyle (ControlStyles flag)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected bool GetTopLevel ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Hide ()
+ {
+ if (IsHandleCreated)
+ Win32.ShowWindow (Handle, Win32.SW_HIDE);
+ }
+
+ [MonoTODO]
+ protected virtual void InitLayout ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Invalidate ()
+ {
+ if (IsHandleCreated) {
+ Win32.RECT rect = (Win32.RECT) null;
+ Win32.InvalidateRect (Handle, ref rect, true);
+ }
+ }
+
+ [MonoTODO]
+ public void Invalidate (bool invalidateChildren)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Invalidate (Rectangle rc)
+ {
+ if (IsHandleCreated) {
+ Win32.RECT rect = new Win32.RECT();
+ rect.left = rc.Left;
+ rect.top = rc.Top;
+ rect.right = rc.Right;
+ rect.bottom = rc.Bottom;
+ Win32.InvalidateRect (Handle, ref rect, true);
+ }
+ }
+
+ //[MonoTODO]
+ public void Invalidate(Region region)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Invalidate (Rectangle rc, bool invalidateChildren)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //[MonoTODO]
+ public void Invalidate(Region region,bool invalidateChildren)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InvokeGotFocus (Control toInvoke, EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InvokeLostFocus (Control toInvoke, EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InvokeOnClick (Control toInvoke, EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InvokePaint (Control c, PaintEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InvokePaintBackground (
+ Control c,PaintEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool IsInputChar (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool IsInputKey (Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsMnemonic (char charCode,string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // methods used with events:
+ protected virtual void OnBackColorChanged (EventArgs e)
+ {
+ if (BackColorChanged != null)
+ BackColorChanged (this, e);
+ }
+
+ protected virtual void OnBackgroundImageChanged (EventArgs e)
+ {
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, e);
+ }
+
+ protected virtual void OnBindingContextChanged (EventArgs e)
+ {
+ if (BindingContextChanged != null)
+ BindingContextChanged (this, e);
+ }
+
+ protected virtual void OnCausesValidationChanged (EventArgs e)
+ {
+ if (CausesValidationChanged != null)
+ CausesValidationChanged (this, e);
+ }
+
+ protected virtual void OnChangeUICues(UICuesEventArgs e)
+ {
+ if (ChangeUICues != null)
+ ChangeUICues (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnClick (EventArgs e)
+ {
+ if (Click != null)
+ Click (this, e);
+ }
+
+
+ protected virtual void OnContextMenuChanged (EventArgs e)
+ {
+ if (ContextMenuChanged != null)
+ ContextMenuChanged (this, e);
+ }
+
+ protected virtual void OnControlAdded (ControlEventArgs e)
+ {
+ if (ControlAdded != null)
+ ControlAdded (this, e);
+ }
+
+ protected virtual void OnControlRemoved (ControlEventArgs e)
+ {
+ if (ControlRemoved != null)
+ ControlRemoved (this, e);
+ }
+
+ protected virtual void OnCreateControl ()
+ {
+
+ }
+
+ protected virtual void OnCursorChanged (EventArgs e)
+ {
+ if (CursorChanged != null)
+ CursorChanged (this, e);
+ }
+
+ protected virtual void OnDockChanged (EventArgs e)
+ {
+ if (DockChanged != null)
+ DockChanged (this, e);
+ }
+
+ protected virtual void OnDoubleClick (EventArgs e)
+ {
+ if (DoubleClick != null)
+ DoubleClick (this, e);
+ }
+
+ protected virtual void OnDragDrop (DragEventArgs e)
+ {
+ if (DragDrop != null)
+ DragDrop (this, e);
+ }
+
+ protected virtual void OnDragEnter (DragEventArgs e)
+ {
+ if (DragEnter != null)
+ DragEnter (this, e);
+ }
+
+ protected virtual void OnDragLeave (EventArgs e)
+ {
+ if (DragLeave != null)
+ DragLeave (this, e);
+ }
+
+ protected virtual void OnDragOver (DragEventArgs e)
+ {
+ if (DragOver != null)
+ DragOver (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnEnabledChanged (EventArgs e)
+ {
+ if (EnabledChanged != null)
+ EnabledChanged (this, e);
+ }
+
+ protected virtual void OnEnter (EventArgs e)
+ {
+ if (Enter != null)
+ Enter (this, e);
+ }
+
+ protected virtual void OnFontChanged (EventArgs e)
+ {
+ if (FontChanged != null)
+ FontChanged (this, e);
+ }
+
+ protected virtual void OnForeColorChanged (EventArgs e)
+ {
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, e);
+ }
+
+ protected virtual void OnGiveFeedback (GiveFeedbackEventArgs e)
+ {
+ if (GiveFeedback != null)
+ GiveFeedback (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnGotFocus (EventArgs e)
+ {
+ if (GotFocus != null)
+ GotFocus (this, e);
+ }
+
+ protected virtual void OnHandleCreated (EventArgs e)
+ {
+ Console.WriteLine ("OnHandleCreated");
+
+ if (HandleCreated != null)
+ HandleCreated (this, e);
+
+ // create all child windows
+ IEnumerator cw = childControls.GetEnumerator();
+
+ while (cw.MoveNext()) {
+ Console.WriteLine ("Adding Control");
+ Control control = (Control) cw.Current;
+ control.CreateControl ();
+ control.Show ();
+ }
+ }
+
+ protected virtual void OnHandleDestroyed (EventArgs e)
+ {
+ if (HandleDestroyed != null)
+ HandleDestroyed (this, e);
+ }
+
+ protected virtual void OnHelpRequested (HelpEventArgs e)
+ {
+ if (HelpRequested != null)
+ HelpRequested (this, e);
+ }
+
+ protected virtual void OnImeModeChanged (EventArgs e)
+ {
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, e);
+ }
+
+ protected virtual void OnInvalidated (InvalidateEventArgs e)
+ {
+ if (Invalidated != null)
+ Invalidated (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnKeyDown (KeyEventArgs e)
+ {
+ if (KeyDown != null)
+ KeyDown (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnKeyPress (KeyPressEventArgs e)
+ {
+ if (KeyPress != null)
+ KeyPress (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnKeyUp (KeyEventArgs e)
+ {
+ if (KeyUp != null)
+ KeyUp (this, e);
+
+ }
+
+ protected virtual void OnLayout (LayoutEventArgs e)
+ {
+ if (Layout != null)
+ Layout (this, e);
+ }
+
+ protected virtual void OnLeave (EventArgs e)
+ {
+ if (Leave != null)
+ Leave (this, e);
+ }
+
+ protected virtual void OnLocationChanged (EventArgs e)
+ {
+ if (LocationChanged != null)
+ LocationChanged (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnLostFocus (EventArgs e)
+ {
+ if (LostFocus != null)
+ LostFocus (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnMouseDown (MouseEventArgs e)
+ {
+ if (MouseDown != null)
+ MouseDown (this, e);
+ }
+
+ protected virtual void OnMouseEnter (EventArgs e)
+ {
+ if (MouseEnter != null)
+ MouseEnter (this, e);
+ }
+
+ protected virtual void OnMouseHover (EventArgs e)
+ {
+ if (MouseHover != null)
+ MouseHover (this, e);
+ }
+
+ protected virtual void OnMouseLeave (EventArgs e)
+ {
+ if (MouseLeave != null)
+ MouseLeave (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnMouseMove (MouseEventArgs e)
+ {
+ if (MouseMove != null)
+ MouseMove (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnMouseUp (MouseEventArgs e)
+ {
+ if (MouseUp != null)
+ MouseUp (this, e);
+ }
+
+ protected virtual void OnMouseWheel (MouseEventArgs e)
+ {
+ if (MouseWheel != null)
+ MouseWheel (this, e);
+ }
+
+ protected virtual void OnMove (EventArgs e)
+ {
+ if (Move != null)
+ Move (this, e);
+ }
+
+ protected virtual void OnNotifyMessage (Message m)
+ {
+
+ }
+
+ //Compact Framework
+ protected virtual void OnPaint (PaintEventArgs e)
+ {
+ if (Paint != null)
+ Paint (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnPaintBackground (PaintEventArgs e)
+ {
+
+ }
+
+ protected virtual void OnParentBackColorChanged (EventArgs e)
+ {
+ if (BackColorChanged != null)
+ BackColorChanged (this, e);
+ }
+
+ protected virtual void OnParentBackgroundImageChanged (
+ EventArgs e)
+ {
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, e);
+ }
+
+ protected virtual void OnParentBindingContextChanged (
+ EventArgs e)
+ {
+ if (BindingContextChanged != null)
+ BindingContextChanged (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnParentChanged (EventArgs e)
+ {
+ if (ParentChanged != null)
+ ParentChanged (this, e);
+ }
+
+ protected virtual void OnParentEnabledChanged (EventArgs e)
+ {
+ if (EnabledChanged != null)
+ EnabledChanged (this, e);
+ }
+
+ protected virtual void OnParentFontChanged (EventArgs e)
+ {
+ if (FontChanged != null)
+ FontChanged (this, e);
+ }
+
+ protected virtual void OnParentForeColorChanged (EventArgs e)
+ {
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, e);
+ }
+
+ protected virtual void OnParentRightToLeftChanged (
+ EventArgs e)
+ {
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, e);
+ }
+
+ protected virtual void OnParentVisibleChanged (EventArgs e)
+ {
+ if (VisibleChanged != null)
+ VisibleChanged (this, e);
+ }
+
+ protected virtual void OnQueryContinueDrag (
+ QueryContinueDragEventArgs e)
+ {
+ if (QueryContinueDrag != null)
+ QueryContinueDrag (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnResize (EventArgs e)
+ {
+ if (Resize != null)
+ Resize (this, e);
+ }
+
+ protected virtual void OnRightToLeftChanged (EventArgs e)
+ {
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, e);
+ }
+
+ protected virtual void OnSizeChanged (EventArgs e)
+ {
+ if (SizeChanged != null)
+ SizeChanged (this, e);
+ }
+
+ protected virtual void OnStyleChanged (EventArgs e)
+ {
+ if (StyleChanged != null)
+ StyleChanged (this, e);
+ }
+
+ protected virtual void OnSystemColorsChanged (EventArgs e)
+ {
+ if (SystemColorsChanged != null)
+ SystemColorsChanged (this, e);
+ }
+
+ protected virtual void OnTabIndexChanged (EventArgs e)
+ {
+ if (TabIndexChanged != null)
+ TabIndexChanged (this, e);
+ }
+
+ protected virtual void OnTabStopChanged (EventArgs e)
+ {
+ if (TabStopChanged != null)
+ TabStopChanged (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnTextChanged (EventArgs e)
+ {
+ if (TextChanged != null)
+ TextChanged (this, e);
+ }
+
+ [MonoTODO] // this doesn't seem to be documented
+ // protected virtual void OnTextAlignChanged (EventArgs e) {
+ // TextAlignChanged (this, e);
+ // }
+
+ protected virtual void OnValidated (EventArgs e)
+ {
+ if (Validated != null)
+ Validated (this, e);
+ }
+
+ [MonoTODO]
+ // CancelEventArgs not ready
+ //protected virtual void OnValidating(CancelEventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ protected virtual void OnVisibleChanged (EventArgs e)
+ {
+ if (VisibleChanged != null)
+ VisibleChanged (this, e);
+ }
+ // --- end of methods for events ---
+
+
+ [MonoTODO]
+ public void PerformLayout ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void PerformLayout (Control affectedControl,
+ string affectedProperty)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Point PointToClient (Point p)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Point PointToScreen (Point p)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool PreProcessMessage (ref Message msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessCmdKey (ref Message msg,
+ Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessDialogChar (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessDialogKey (Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessKeyEventArgs (ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual bool ProcessKeyMessage (
+ ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessKeyPreview (ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual bool ProcessMnemonic (char charCode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // used when properties/values of Control
+ // are big enough to warrant recreating the HWND
+ protected void RecreateHandle()
+ {
+ CreateHandle ();
+
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Rectangle RectangleToClient (Rectangle r)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public Rectangle RectangleToScreen (Rectangle r)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected static bool ReflectMessage (IntPtr hWnd,
+ ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public virtual void Refresh ()
+ {
+ Win32.RECT rect = (Win32.RECT) null;
+ Win32.InvalidateRect (Handle, ref rect, true);
+ Win32.UpdateWindow (Handle);
+ }
+
+ [MonoTODO]
+ public virtual void ResetBackColor ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResetBindings ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ResetFont ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ResetForeColor ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResetImeMode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ResetRightToLeft ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ResetText ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResumeLayout ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResumeLayout (bool performLayout)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected ContentAlignment RtlTranslateAlignment (
+ ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected HorizontalAlignment RtlTranslateAlignment (
+ HorizontalAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected LeftRightAlignment RtlTranslateAlignment (
+ LeftRightAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected ContentAlignment RtlTranslateContent (
+ ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected HorizontalAlignment RtlTranslateHorizontal (
+ HorizontalAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected LeftRightAlignment RtlTranslateLeftRight (
+ LeftRightAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Scale (float ratio)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Scale (float dx,float dy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void ScaleCore (float dx, float dy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Select ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Select (bool directed,bool forward)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool SelectNextControl (Control ctl, bool forward,
+ bool tabStopOnly,
+ bool nested, bool wrap)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public void SendToBack ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetBounds (int x, int y, int width, int height)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetBounds (int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void SetBoundsCore (
+ int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void SetClientSizeCore (int x, int y)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void SetStyle (ControlStyles flag, bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void SetTopLevel (bool value)
+ {
+ if (value)
+ // FIXME: verify on whether this is supposed
+ // to activate/deactive the window
+ Win32.SetWindowPos (Handle,
+ (IntPtr) Win32.HWND_NOTOPMOST,
+ 0, 0, 0, 0, 0);
+ else
+ // FIXME: this does not make sense but
+ // the docs say the window is hidden
+ Win32.ShowWindow (Handle, Win32.SW_HIDE);
+ }
+
+ [MonoTODO]
+ protected virtual void SetVisibleCore (bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Show ()
+ {
+ Win32.ShowWindow (Handle, Win32.SW_SHOW);
+ }
+
+ [MonoTODO]
+ public void SuspendLayout ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Update ()
+ {
+ Win32.UpdateWindow (Handle);
+ }
+
+ [MonoTODO]
+ protected void UpdateBounds ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void UpdateBounds (int x, int y, int width, int height)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void UpdateBounds (
+ int x, int y, int width, int height, int clientWidth,
+ int clientHeight)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void UpdateStyles ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void UpdateZOrder ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // WndProc - calls appriate On... function for the give
+ // message
+ //
+ // These On... functions do not appear to be called by
+ // WndProc:
+ //
+ // background color/image handled by WinForms
+ // OnBackColorChanged
+ // OnBackgroundImageChanged
+ // OnForeColorChanged
+ // OnPaintBackground
+ //
+ // controls are added/removed by WinForms
+ // OnControlAdded
+ // OnControlRemoved
+ // OnCreateControl
+ //
+ // OnBindingContextChanged
+ // OnCausesValidationChanged
+ // OnChangeUICues
+ // OnContextMenuChanged
+ // OnRightToLeftChanged
+ // OnGiveFeedback
+ // OnLayout
+ // OnDockChanged
+ // OnCursorChanged
+ // OnTextAlignChanged
+ // OnValidated
+ // OnValidating
+ // OnTabIndexChanged
+ // OnTabStopChanged
+ // OnLocationChanged
+ //
+ // FIXME: may be one of the WM_IME_ messages
+ // OnImeModeChanged
+ //
+ // InvalidateRect is called by no Invalidate message exists
+ // OnInvalidated
+ //
+ // these messages ARE not called by WNDPROC according to docs
+ // OnParentBackColorChanged
+ // OnParentBackgroundImageChanged
+ // OnParentBindingContextChanged
+ // OnParentChanged
+ // OnParentEnabledChanged
+ // OnParentFontChanged
+ // OnParentForeColorChanged
+ // OnParentRightToLeftChanged
+ // OnParentVisibleChanged
+ //
+ protected virtual void WndProc(ref Message m)
+ {
+ EventArgs eventArgs = new EventArgs ();
+ // FIXME: paintEventArgs is not being created properly
+ PaintEventArgs paintEventArgs = new PaintEventArgs (
+ new Graphics(), new Rectangle());
+
+ switch (m.Msg) {
+
+ case Win32.WM_CREATE:
+ Console.WriteLine ("WM_CREATE");
+ OnHandleCreated (eventArgs);
+ break;
+ case Win32.WM_LBUTTONDBLCLK:
+ OnDoubleClick (eventArgs);
+ break;
+ // OnDragDrop
+ // OnDragEnter
+ // OnDragLeave
+ // OnDragOver
+ // OnQueryContinueDrag
+ case Win32.WM_ENABLE:
+ OnEnabledChanged (eventArgs);
+ break;
+ case Win32.WM_SETFOCUS:
+ OnEnter (eventArgs);
+ OnGotFocus (eventArgs);
+ break;
+ case Win32.WM_FONTCHANGE:
+ OnFontChanged (eventArgs);
+ break;
+ case Win32.WM_DESTROY:
+ OnHandleDestroyed (eventArgs);
+ break;
+ case Win32.WM_HELP:
+ // FIXME:
+ //OnHelpRequested (eventArgs);
+ break;
+ case Win32.WM_KEYDOWN:
+ // FIXME:
+ // OnKeyDown (eventArgs);
+ break;
+ case Win32.WM_CHAR:
+ // FIXME:
+ // OnKeyPress (eventArgs);
+ break;
+ case Win32.WM_KEYUP:
+ // FIXME:
+ // OnKeyUp (eventArgs);
+ break;
+ case Win32.WM_KILLFOCUS:
+ OnLeave (eventArgs);
+ OnLostFocus (eventArgs);
+ break;
+ case Win32.WM_LBUTTONDOWN:
+ // FIXME:
+ // OnMouseDown (eventArgs);
+ break;
+ case Win32.WM_MOUSEACTIVATE:
+ OnMouseEnter (eventArgs);
+ break;
+ case Win32.WM_MOUSEHOVER: // called by TrackMouseEvent
+ OnMouseHover (eventArgs);
+ break;
+ case Win32.WM_MOUSELEAVE: // called by TrackMouseEvent
+ OnMouseLeave (eventArgs);
+ break;
+ case Win32.WM_MOUSEMOVE:
+ // FIXME:
+ // OnMouseMove (eventArgs);
+ break;
+ case Win32.WM_LBUTTONUP:
+ // FIXME:
+ // OnMouseUp (eventArgs);
+ break;
+ case Win32.WM_MOUSEWHEEL:
+ // FIXME:
+ // OnMouseWheel (eventArgs);
+ break;
+ case Win32.WM_MOVE:
+ OnMove (eventArgs);
+ break;
+ case Win32.WM_NOTIFY:
+ // FIXME: get NM_CLICKED msg from pnmh
+ // OnClick (eventArgs);
+ // OnNotifyMessage (eventArgs);
+ case Win32.WM_PAINT:
+ OnPaint (paintEventArgs);
+ break;
+ case Win32.WM_SIZE:
+ OnResize (eventArgs);
+ OnSizeChanged (eventArgs);
+ break;
+ case Win32.WM_STYLECHANGED:
+ OnStyleChanged (eventArgs);
+ break;
+ case Win32.WM_SYSCOLORCHANGE:
+ OnSystemColorsChanged (eventArgs);
+ break;
+ case Win32.WM_SETTEXT:
+ OnTextChanged (eventArgs);
+ break;
+ case Win32.WM_SHOWWINDOW:
+ OnVisibleChanged (eventArgs);
+ break;
+ // default:
+ // DefWndProc (ref m);
+ // break;
+ }
+ }
+
+ /// --- Control: events ---
+ public event EventHandler BackColorChanged;// {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler BackgroundImageChanged; //{
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler BindingContextChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler CausesValidationChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event UICuesEventHandler ChangeUICues; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler Click; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler ContextMenuChanged;
+
+ public event ControlEventHandler ControlAdded; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event ControlEventHandler ControlRemoved; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler CursorChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler DockChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler DoubleClick; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event DragEventHandler DragDrop; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event DragEventHandler DragEnter; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler DragLeave; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event DragEventHandler DragOver; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler EnabledChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler Enter; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler FontChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler ForeColorChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event GiveFeedbackEventHandler GiveFeedback; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler GotFocus; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler HandleCreated; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler HandleDestroyed; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event HelpEventHandler HelpRequested; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler ImeModeChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event InvalidateEventHandler Invalidated; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event KeyEventHandler KeyDown; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event KeyPressEventHandler KeyPress; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event KeyEventHandler KeyUp; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event LayoutEventHandler Layout; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler Leave; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler LocationChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler LostFocus; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event MouseEventHandler MouseDown; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MouseEnter; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MouseHover; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MouseLeave; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event MouseEventHandler MouseMove; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event MouseEventHandler MouseUp; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event MouseEventHandler MouseWheel; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler Move; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event PaintEventHandler Paint; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler ParentChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event QueryContinueDragEventHandler QueryContinueDrag; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler Resize; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler RightToLeftChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler SizeChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler StyleChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler SystemColorsChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler TabIndexChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler TabStopChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler TextChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler Validated; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ [MonoTODO]
+ // CancelEventHandler not yet defined
+ //public event CancelEventHandler Validating {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ public event EventHandler VisibleChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ /// --- IWin32Window properties
+ public IntPtr Handle {
+ get {
+ if (window != null)
+ return window.Handle;
+ return (IntPtr) 0;
+ }
+ }
+
+ /// --- ISynchronizeInvoke properties ---
+ [MonoTODO]
+ public bool InvokeRequired {
+ get { throw new NotImplementedException (); }
+ }
+
+ /// --- ISynchronizeInvoke methods ---
+ [MonoTODO]
+ public IAsyncResult BeginInvoke (Delegate method)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IAsyncResult BeginInvoke (Delegate method,
+ object[] args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object EndInvoke (IAsyncResult asyncResult)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public object Invoke (Delegate method)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object Invoke (Delegate method,object[] args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// sub-class: Control.ControlAccessibleObject
+ /// <summary>
+ /// Provides information about a control that can be used by an accessibility application.
+ /// </summary>
+ public class ControlAccessibleObject /*: AccessibleObject*/ {
+ // AccessibleObject not ready to be base class
+ /// --- ControlAccessibleObject.constructor ---
+ [MonoTODO]
+ public ControlAccessibleObject (Control ownerControl)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ /// --- ControlAccessibleObject Properties ---
+ [MonoTODO]
+ // public override string DefaultAction {
+ // get { throw new NotImplementedException (); }
+ // }
+
+ [MonoTODO]
+ // public override string Description {
+ // get { throw new NotImplementedException (); }
+ // }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ // public override string Help {
+ // get { throw new NotImplementedException (); }
+ // }
+
+ [MonoTODO]
+ // public override string KeyboardShortcut {
+ // get { throw new NotImplementedException (); }
+ // }
+
+ [MonoTODO]
+ // public override string Name {
+ // get { throw new NotImplementedException (); }
+ // set { throw new NotImplementedException (); }
+ // }
+
+ [MonoTODO]
+ public Control Owner {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ // public override AccessibleRole Role {
+ // get { throw new NotImplementedException (); }
+ // }
+
+
+ /// --- ControlAccessibleObject Methods ---
+ [MonoTODO]
+ // public override int GetHelpTopic(out string fileName)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ [MonoTODO]
+ public void NotifyClients (AccessibleEvents accEvent)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void NotifyClients (AccessibleEvents accEvent,
+ int childID)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// sub-class: Control.ControlCollection
+ /// <summary>
+ /// Represents a collection of Control objects
+ /// </summary>
+ public class ControlCollection : IList, ICollection, IEnumerable, ICloneable {
+
+ private ArrayList collection = new ArrayList ();
+ private Control owner;
+
+ /// --- ControlCollection.constructor ---
+ public ControlCollection (Control owner)
+ {
+ this.owner = owner;
+ }
+
+ /// --- ControlCollection Properties ---
+ public int Count {
+ get { return collection.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return collection.IsReadOnly; }
+ }
+
+ public virtual Control this [int index] {
+ get { return (Control) collection[index]; }
+ }
+
+ public virtual void Add (Control value)
+ {
+ collection.Add (value);
+ }
+
+ public virtual void AddRange (Control[] controls)
+ {
+ collection.AddRange (controls);
+ }
+
+ public virtual void Clear ()
+ {
+ collection.Clear ();
+ }
+
+ public bool Contains (Control control)
+ {
+ return collection.Contains (control);
+ }
+
+ public void CopyTo (Array dest,int index)
+ {
+ collection.CopyTo (dest, index);
+ }
+
+ [MonoTODO]
+ public override bool Equals (object other)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //public static bool Equals(object o1, object o2) {
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public int GetChildIndex (Control child)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public int IndexOf (Control control)
+ {
+ return collection.IndexOf (control);
+ }
+
+ public virtual void Remove (Control value)
+ {
+ collection.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ collection.RemoveAt (index);
+ }
+
+ [MonoTODO]
+ public void SetChildIndex (Control child,int newIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- ControlCollection.IClonable methods ---
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- ControlCollection.IList properties ---
+ bool IList.IsFixedSize {
+ get { return collection.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return collection[index]; }
+ set { collection[index] = value; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return collection.SyncRoot; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return collection.IsSynchronized; }
+ }
+
+ /// --- ControlCollection.IList methods ---
+ int IList.Add (object control)
+ {
+ return collection.Add (control);
+ }
+
+ bool IList.Contains (object control)
+ {
+ return collection.Contains (control);
+ }
+
+ int IList.IndexOf (object control)
+ {
+ return collection.IndexOf (control);
+ }
+
+ void IList.Insert (int index,object value)
+ {
+ collection.Insert (index, value);
+ }
+
+ void IList.Remove (object control)
+ {
+ collection.Remove (control);
+ }
+ } // --- end of Control.ControlCollection ---
+ }
+ }
diff --git a/mcs/class/System.Windows.Forms/WINELib/ControlBindingsCollection.cs b/mcs/class/System.Windows.Forms/WINELib/ControlBindingsCollection.cs
new file mode 100644
index 00000000000..1e5c9623e31
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ControlBindingsCollection.cs
@@ -0,0 +1,85 @@
+//
+// System.Windows.Forms.ControlBindingsCollection.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the collection of data bindings for a control.
+ ///
+ /// ToDo note:
+ /// - no methods are implemented
+ /// </summary>
+
+ [MonoTODO]
+ public class ControlBindingsCollection : BindingsCollection {
+
+ #region Constructors
+ protected internal ControlBindingsCollection() : base ()
+ {
+ }
+ #endregion
+
+
+ #region Properties
+ [MonoTODO]
+ public Control Control {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Binding this[string propertyName] {
+ get { throw new NotImplementedException (); }
+ }
+ #endregion
+
+
+
+
+ #region Methods
+ /// following methods were not stubbed out, because they only support .NET framework:
+ /// - protected override void AddCore(Binding dataBinding);
+ /// - protected override void ClearCore();
+ /// - protected override void RemoveCore(Binding dataBinding);
+ [MonoTODO]
+ public new void Add(Binding binding)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Binding Add(string propertyName,object dataSource,string dataMember)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new void Remove(Binding binding)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public new void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ControlEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ControlEventArgs.cs
new file mode 100644
index 00000000000..7c8804b109d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ControlEventArgs.cs
@@ -0,0 +1,121 @@
+//
+// System.Windows.Forms.ControlEventArgs.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+
+// (C) Ximian, Inc., 2002
+
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Complete.
+ /// </summary>
+
+ public class ControlEventArgs : EventArgs {
+
+ #region Fields
+ Control control;
+ #endregion
+
+ public ControlEventArgs(Control control)
+ {
+ this.control = control;
+ }
+
+ #region Public Properties
+ public Control Control
+ {
+ get
+ {
+ return control;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ControlEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// control Property
+ /// of the two ControlEventArgs.
+ /// </remarks>
+ public static bool operator == (ControlEventArgs ControlEventArgsA, ControlEventArgs ControlEventArgsB)
+ {
+ return (ControlEventArgsA.Control == ControlEventArgsB.Control);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ControlEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// control Property
+ /// of the two ControlEventArgs.
+ /// </remarks>
+ public static bool operator != (ControlEventArgs ControlEventArgsA, ControlEventArgs ControlEventArgsB)
+ {
+ return (ControlEventArgsA.Control != ControlEventArgsB.Control);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ControlEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ControlEventArgs))return false;
+ return (this == (ControlEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " ControlEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ControlEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ControlEventHandler.cs
new file mode 100644
index 00000000000..e478b17c87e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ControlEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ControlEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ControlEventHandler (
+ object sender,
+ ControlEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ControlStyles.cs b/mcs/class/System.Windows.Forms/WINELib/ControlStyles.cs
new file mode 100644
index 00000000000..bddb6c49752
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ControlStyles.cs
@@ -0,0 +1,32 @@
+//
+// System.Windows.Forms.ControlStyles.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ControlStyles {
+ AllPaintingInWmPaint = 8192,
+ CacheText = 16384,
+ ContainerControl = 1,
+ DoubleBuffer = 65536,
+ EnableNotifyMessage = 32768,
+ FixedHeight = 64,
+ FixedWidth = 32,
+ Opaque = 4,
+ ResizeRedraw = 16,
+ Selectable = 512,
+ StandardClick = 256,
+ StandardDoubleClick = 4096,
+ SupportsTransparentBackColor = 2045,
+ UserMouse = 1024,
+ UserPaint = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ConvertEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ConvertEventArgs.cs
new file mode 100644
index 00000000000..ccc4f86dd98
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ConvertEventArgs.cs
@@ -0,0 +1,134 @@
+//
+// System.Windows.Forms.ConvertEventArgs.cs
+//
+// Author:
+// Stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Finished by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the Format and Parse events.
+ /// </summary>
+
+ public class ConvertEventArgs : EventArgs {
+
+ #region Fields
+
+ private Type desiredtype;
+ private object objectvalue;
+
+ #endregion
+
+ //Constructor
+ public ConvertEventArgs(object objectValue,Type desiredType)
+ {
+ this.desiredtype = desiredType;
+ this.objectvalue = objectValue;
+ }
+
+ #region Public Properties
+ public Type DesiredType
+ {
+ get {
+ return desiredtype;
+ }
+ }
+
+ public object Value {
+ get {
+ return objectvalue;
+ }
+ set {
+ objectvalue = value;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ConvertEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// DesiredType and Value Property
+ /// of the two ContentsResizedEventArgs.
+ /// </remarks>
+ public static bool operator == (ConvertEventArgs ConvertEventArgsA, ConvertEventArgs ConvertEventArgsB)
+ {
+ return (ConvertEventArgsA.DesiredType == ConvertEventArgsB.DesiredType) &&
+ (ConvertEventArgsA.Value == ConvertEventArgsB.Value);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ConvertEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// DesiredType and Value Property
+ /// of the two ContentsResizedEventArgs.
+ /// </remarks>
+ public static bool operator != (ConvertEventArgs ConvertEventArgsA, ConvertEventArgs ConvertEventArgsB)
+ {
+ return (ConvertEventArgsA.DesiredType != ConvertEventArgsB.DesiredType) ||
+ (ConvertEventArgsA.Value != ConvertEventArgsB.Value);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ConvertEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ConvertEventArgs))return false;
+ return (this == (ConvertEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " ConvertEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ConvertEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ConvertEventHandler.cs
new file mode 100644
index 00000000000..080edc9fdc8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ConvertEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ConvertEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ConvertEventHandler (
+ object sender,
+ ConvertEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/CreateParams.cs b/mcs/class/System.Windows.Forms/WINELib/CreateParams.cs
new file mode 100644
index 00000000000..b6bb0c463f9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/CreateParams.cs
@@ -0,0 +1,108 @@
+//
+// System.Windows.Forms.CreateParams.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Encapsulates the information needed when creating a control.
+ /// </summary>
+
+ public class CreateParams {
+
+ #region Fields
+ private string caption;
+ private string className;
+ private int classStyle;
+ private int exStyle;
+ private int height;
+ private object param;
+ private IntPtr parent;
+ private int style;
+ private int width;
+ private int x;
+ private int y;
+ #endregion
+
+ #region Constructors
+ public CreateParams()
+ {
+ }
+ #endregion
+
+ #region Properties
+ public string Caption {
+ get { return caption; }
+ set { caption = value; }
+ }
+
+ public string ClassName {
+ get { return className; }
+ set { className = value; }
+ }
+
+ public int ClassStyle {
+ get { return classStyle; }
+ set { classStyle = value; }
+ }
+
+ public int ExStyle {
+ get { return exStyle; }
+ set { exStyle = value; }
+ }
+
+ public int Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public object Param {
+ get { return param; }
+ set { param = value; }
+ }
+
+ public IntPtr Parent {
+ get { return parent; }
+ set { parent = value; }
+ }
+
+ public int Style {
+ get { return style; }
+ set { style = value; }
+ }
+
+ public int Width {
+ get { return width; }
+ set { width = value; }
+ }
+
+ public int X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Y {
+ get { return y; }
+ set { y = value; }
+ }
+ #endregion
+
+ #region Methods
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Cursor.cs b/mcs/class/System.Windows.Forms/WINELib/Cursor.cs
new file mode 100644
index 00000000000..fb1a8f66890
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Cursor.cs
@@ -0,0 +1,180 @@
+//
+// System.Windows.Forms.Cursor.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the image used to paint the mouse pointer.
+ ///
+ /// ToDo note:
+ /// - nothing is implemented
+ /// </summary>
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class Cursor : IDisposable, ISerializable {
+
+ #region Fields
+ #endregion
+
+
+
+ #region Constructors
+ [MonoTODO]
+ public Cursor(IntPtr handle)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Cursor(Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Cursor(string fileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Cursor(Type type,string resource)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+
+
+
+ #region Properties
+ [MonoTODO]
+ public static Rectangle Clip {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static Cursor Current {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static Point Position {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Size Size {
+ get { throw new NotImplementedException (); }
+ }
+ #endregion
+
+
+
+
+ #region Methods
+ [MonoTODO]
+ public IntPtr CopyHandle()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Draw(Graphics g,Rectangle targetRect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DrawStretched(Graphics g,Rectangle targetRect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~Cursor() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Hide()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// ISerializable.GetObjectData only supports .NET framework:
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Show()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+
+
+ #region Operators
+ [MonoTODO]
+ public static bool operator ==(Cursor left, Cursor right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool operator !=(Cursor left, Cursor right)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DateBoldEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/DateBoldEventArgs.cs
new file mode 100644
index 00000000000..bc36fd3f348
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DateBoldEventArgs.cs
@@ -0,0 +1,39 @@
+//
+// System.Windows.Forms.DateBoldEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ // This class is internal to the .NET framework.
+ // </summary>
+ public class DateBoldEventArgs : EventArgs {
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int[] DaysToBold {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public int Size {
+
+ get { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public DateTime StartDate {
+
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DateRangeEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/DateRangeEventArgs.cs
new file mode 100644
index 00000000000..04ea20b353b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DateRangeEventArgs.cs
@@ -0,0 +1,133 @@
+//
+// System.Windows.Forms.DateRangeEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Implemented by Richard Baumann <biochem333@nyc.rr.com>
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DateChanged or DateSelected events of the MonthCalendar control.
+ /// </summary>
+ public class DateRangeEventArgs : EventArgs {
+
+ #region Fields
+
+ private DateTime end;
+ private DateTime start;
+
+ #endregion
+
+ //
+ // --- Constructors/Destructors
+ //
+ public DateRangeEventArgs(DateTime start, DateTime end) : base()
+ {
+ this.start = start;
+ this.end = end;
+ }
+
+ #region Public Properties
+ public DateTime End
+ {
+ get {
+ return end;
+ }
+ }
+
+ public DateTime Start {
+ get {
+ return start;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DateRangeEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// start and end Property
+ /// of the two DateRangeEventArgs.
+ /// </remarks>
+ public static bool operator == (DateRangeEventArgs DateRangeEventArgsA, DateRangeEventArgs DateRangeEventArgsB)
+ {
+ return (DateRangeEventArgsA.Start == DateRangeEventArgsB.Start) &&
+ (DateRangeEventArgsA.End == DateRangeEventArgsB.End);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DateRangeEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// start and end Property
+ /// of the two DateRangeEventArgs.
+ /// </remarks>
+ public static bool operator != (DateRangeEventArgs DateRangeEventArgsA, DateRangeEventArgs DateRangeEventArgsB)
+ {
+ return (DateRangeEventArgsA.Start != DateRangeEventArgsB.Start) ||
+ (DateRangeEventArgsA.End != DateRangeEventArgsB.End);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// DateRangeEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DateRangeEventArgs))return false;
+ return (this == (DateRangeEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " DateRangeEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DateRangeEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/DateRangeEventHandler.cs
new file mode 100644
index 00000000000..5913f96335c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DateRangeEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.DateRangeEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void DateRangeEventHandler (
+ object sender,
+ DateRangeEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DialogResult.cs b/mcs/class/System.Windows.Forms/WINELib/DialogResult.cs
new file mode 100644
index 00000000000..d45246f20f9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DialogResult.cs
@@ -0,0 +1,32 @@
+//
+// System.Windows.Forms.DialogResult.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Specifies identifiers to indicate the return value of a dialog box.
+ /// </summary>
+ //LAMESPEC: Docs say serializable, verifer says no.
+ //[Serializable]
+ [ComVisible(true)]
+ public enum DialogResult {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ OK = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DockStyle.cs b/mcs/class/System.Windows.Forms/WINELib/DockStyle.cs
new file mode 100644
index 00000000000..b510861bfde
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DockStyle.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.DockStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the position and manner in which a control is docked.
+ /// </summary>
+ //[Serializable]
+ public enum DockStyle {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ Top = 1,
+ Bottom = 2,
+ left = 3,
+ Right = 4,
+ Fill = 5,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DragAction.cs b/mcs/class/System.Windows.Forms/WINELib/DragAction.cs
new file mode 100644
index 00000000000..e345b1dbfd7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DragAction.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.DragAction.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how and if a drag-and-drop operation should continue.
+ /// </summary>
+ //[Serializable]
+ [ComVisible(true)]
+ public enum DragAction {
+
+ //Values were verified with enumcheck.
+ Continue = 0,
+ Drop = 1,
+ Cancel = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DragDropEffects.cs b/mcs/class/System.Windows.Forms/WINELib/DragDropEffects.cs
new file mode 100644
index 00000000000..e7152fd029d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DragDropEffects.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.DragDropEffects.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the effects of a drag-and-drop operation.
+ /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ //[Serializable]
+ public enum DragDropEffects {
+
+ None = 0,
+ Copy = 1,
+ Move = 2,
+ Link = 4,
+ Scroll = -2147483648,
+ All = -2147483645,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DragEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/DragEventArgs.cs
new file mode 100644
index 00000000000..c612833b155
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DragEventArgs.cs
@@ -0,0 +1,177 @@
+//
+// System.Windows.Forms.DragEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Implemented by Richard Baumann <biochem333@nyc.rr.com>
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DragDrop, DragEnter, or DragOver event.
+ /// </summary>
+ [ComVisible(true)]
+ public class DragEventArgs : EventArgs {
+
+ #region Fields
+ private DragDropEffects allowedEffect;
+ private IDataObject data;
+ private DragDropEffects effect;
+ private int keyState;
+ private int x;
+ private int y;
+ #endregion
+
+ //
+ // --- Constructors/Destructors
+ //
+ public DragEventArgs(IDataObject data, int keyState, int x, int y, DragDropEffects allowedEffect, DragDropEffects effect) : base()
+ {
+ this.data = data;
+ this.keyState = keyState;
+ this.x = x;
+ this.y = y;
+ this.allowedEffect = allowedEffect;
+ this.effect = effect;
+ }
+
+ #region Public Properties
+ [ComVisible(true)]
+ public DragDropEffects AllowedEffect {
+ get {
+ return allowedEffect;
+ }
+ }
+ [ComVisible(true)]
+ public IDataObject Data {
+ get {
+ return data;
+ }
+ }
+ [ComVisible(true)]
+ public DragDropEffects Effect {
+ get {
+ return effect;
+ }
+ set {
+ effect = value;
+ }
+ }
+ [ComVisible(true)]
+ public int KeyState {
+ get {
+ return keyState;
+ }
+ }
+ [ComVisible(true)]
+ public int X {
+ get {
+ return x;
+ }
+ }
+ [ComVisible(true)]
+ public int Y {
+ get {
+ return y;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DragEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// AllowedEffect, Data, Effect, KeyState, X , Y Property
+ /// of the two DragEventArgs.
+ /// </remarks>
+ public static bool operator == (DragEventArgs DragEventArgsA, DragEventArgs DragEventArgsB)
+ {
+ return (DragEventArgsA.AllowedEffect == DragEventArgsB.AllowedEffect) &&
+ (DragEventArgsA.Data == DragEventArgsB.Data) &&
+ (DragEventArgsA.Effect == DragEventArgsB.Effect) &&
+ (DragEventArgsA.KeyState == DragEventArgsB.KeyState) &&
+ (DragEventArgsA.X == DragEventArgsB.X) &&
+ (DragEventArgsA.Y == DragEventArgsB.Y);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two DragEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// AllowedEffect, Data, Effect, KeyState, X , Y Property
+ /// of the two DragEventArgs.
+ /// </remarks>
+ public static bool operator != (DragEventArgs DragEventArgsA, DragEventArgs DragEventArgsB)
+ {
+ return (DragEventArgsA.AllowedEffect != DragEventArgsB.AllowedEffect) ||
+ (DragEventArgsA.Data != DragEventArgsB.Data) ||
+ (DragEventArgsA.Effect != DragEventArgsB.Effect) ||
+ (DragEventArgsA.KeyState != DragEventArgsB.KeyState) ||
+ (DragEventArgsA.X != DragEventArgsB.X) ||
+ (DragEventArgsA.Y != DragEventArgsB.Y);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// DragEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DragEventArgs))return false;
+ return (this == (DragEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " DragEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DragEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/DragEventHandler.cs
new file mode 100644
index 00000000000..6dfc763e634
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DragEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.DragEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void DragEventHandler (
+ object sender,
+ DragEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/DrawItemEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/DrawItemEventArgs.cs
new file mode 100644
index 00000000000..838b2649aee
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DrawItemEventArgs.cs
@@ -0,0 +1,9 @@
+
+namespace System.Windows.Forms {
+ // allows code to compile without commenting out references
+ // to Font... to be removed
+ class DrawItemEventArgs {
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/DrawItemEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/DrawItemEventHandler.cs
new file mode 100644
index 00000000000..bab209627e1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DrawItemEventHandler.cs
@@ -0,0 +1,8 @@
+
+namespace System.Windows.Forms {
+
+ class DrawItemEventHandler {
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/DrawItemState.cs b/mcs/class/System.Windows.Forms/WINELib/DrawItemState.cs
new file mode 100644
index 00000000000..8ccf8f0e2a7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/DrawItemState.cs
@@ -0,0 +1,36 @@
+//
+// System.Windows.Forms.DrawItemState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the state of an item that is being drawn.
+ /// this enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ //[Serializable]
+ public enum DrawItemState {
+
+ None = 0,
+ Selected = 1,
+ Grayed = 2,
+ Disabled = 4,
+ Checked = 8,
+ Focus = 16,
+ Default = 32,
+ HotLight = 64,
+ Inactive = 128,
+ NoAccelerator = 256,
+ NoFocusRect = 512,
+ ComboBoxEdit = 1024,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ErrorIconAlignment.cs b/mcs/class/System.Windows.Forms/WINELib/ErrorIconAlignment.cs
new file mode 100644
index 00000000000..968a9502d59
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ErrorIconAlignment.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.ErrorIconAlignment.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies constants indicating the locations that an error icon can appear
+ /// in relation to the control with an error.
+ /// </summary>
+ //[Serializable]
+ public enum ErrorIconAlignment {
+
+ //Values were verified with enumcheck.
+ TopLeft = 0,
+ TopRight = 1,
+ MiddleLeft = 2,
+ MiddleRight = 3,
+ BottomLeft = 4,
+ BottomRight = 5,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/FlatStyle.cs b/mcs/class/System.Windows.Forms/WINELib/FlatStyle.cs
new file mode 100644
index 00000000000..5f31c5fb20d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/FlatStyle.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.FlatStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the appearance of a control.
+ /// </summary>
+ //[Serializable]
+ public enum FlatStyle {
+
+ //Values were verified with enumcheck.
+ Flat = 0,
+ Popup = 1,
+ Standard = 2,
+ System = 3,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Font.cs b/mcs/class/System.Windows.Forms/WINELib/Font.cs
new file mode 100644
index 00000000000..45a960b3ae6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Font.cs
@@ -0,0 +1,6 @@
+namespace System.Windows.Forms {
+ // allows code to compile without commenting out references
+ // to Font... to be removed
+ class Font {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Form.cs b/mcs/class/System.Windows.Forms/WINELib/Form.cs
new file mode 100644
index 00000000000..af3cda884f8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Form.cs
@@ -0,0 +1,1029 @@
+ //
+ // System.Windows.Forms.Form
+ //
+ // Author:
+ // Miguel de Icaza (miguel@ximian.com)
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ // Dennis Hayes (dennish@raytek.com)
+ // WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ using System;
+ using System.Drawing;
+ using System.ComponentModel;
+ using System.Collections;
+
+ namespace System.Windows.Forms {
+
+ public class Form : ContainerControl {
+
+ public Form () : base ()
+ {
+ }
+
+ static Form ()
+ {
+
+ }
+
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public IButtonControl AcceptButton {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static Form ActiveForm {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form ActiveMdiChild {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool AutoScale {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual Size AutoScaleBaseSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override bool AutoScroll {
+ get {
+ return base.AutoScroll;
+ }
+ set {
+ base.AutoScroll = value;
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ }
+ set {
+ base.BackColor = value;
+ }
+ }
+
+ [MonoTODO]
+ public IButtonControl CancelButton {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public new Size ClientSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public bool ControlBox {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Rectangle DesktopBounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Point DesktopLocation {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public DialogResult DialogResult {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public FormBorderStyle FormBorderStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HelpButton {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ // Icon class not yet stubbed/implemented
+ //public Icon Icon {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ [MonoTODO]
+ public bool IsMidiChild {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsMidiContainer {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool KeyPreview {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public bool MaximizeBox {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Size MaximumSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form[] MdiChildren {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form MdiParent {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //Compact Framework
+ //[MonoTODO]
+ //public MainMenu Menu {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ [MonoTODO]
+ //public MainMenu MergedMenu {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //Compact Framework
+ [MonoTODO]
+ public bool MinimizeBox {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Size MinimumSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Modal {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public double Opacity {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form[] OwnedForms {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Form Owner {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool ShowInTaskbar {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ public override ISite Site {
+ get {
+ return base.Site;
+ }
+ set {
+ base.Site = value;
+ }
+ }
+
+ [MonoTODO]
+ public SizeGripStyle SizeGripStyle {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public FormStartPosition StartPosition {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool TopLevel {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool TopMost {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Color TransparencyKey {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ //Compact Framework
+ [MonoTODO]
+ public FormWindowState WindowState {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ // --- Public Methods
+ public void Activate ()
+ {
+ Win32.SetActiveWindow (Handle);
+ }
+
+ [MonoTODO]
+ public void AddOwnedForm (Form ownedForm)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ public void Close ()
+ {
+ Win32.CloseWindow (Handle);
+ }
+
+ //inherited
+ //public void Dispose ()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public static bool Equals (object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //} [MonoTODO]
+
+ public override bool Equals (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ public override int GetHashCode () {
+ //FIXME add our proprities
+ return base.GetHashCode ();
+ }
+
+ [MonoTODO]
+ // Font class not implemented or stubbed
+ //public static SizeF GetAutoScaleSize(Font font)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //public void Invalidate()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //public object Invoke()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public void LayoutMdi (MdiLayout value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public void PerformLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public void RemoveOwnedForm (Form ownedForm)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // public void ResumeLayout()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ //
+ // public void Scale(float f)
+ // {
+ // throw new NotImplementedException ();
+ // }
+ //
+ // public void Select()
+ // {
+ // throw new NotImplementedException ();
+ // }
+ //
+ // public void SetBounds(int x, int y, int width, int height)
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ public void SetDesktopLocation (int x, int y)
+ {
+ Win32.SetWindowPos ((IntPtr) Handle, (IntPtr) 0,
+ x, y, 0, 0,
+ (int) (Win32.SWP_NOSIZE |
+ Win32.SWP_NOZORDER));
+ }
+
+ public new void Show ()
+ {
+ Win32.ShowWindow (Handle, (int) Win32.SW_SHOW);
+ }
+
+ [MonoTODO]
+ public DialogResult ShowDialog ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Events
+
+ public event EventHandler Activated; //{
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler Closed;
+
+ //Compact Framework
+ // CancelEventHandler not yet implemented/stubbed
+ //public event CancelEventHandler Closing;
+
+ public event EventHandler Deactivate; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event InputLanguageChangedEventHandler InputLanguageChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event InputLanguageChangingEventHandler InputLanguageChanging; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //Compact Framework
+ public event EventHandler Load; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MaximizedBoundsChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MaximumSizeChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MdiChildActivate; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MenuComplete; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MenuStart; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler MinimumSizedChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+
+ // --- Protected Properties
+
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return base.DefaultImeMode;
+ }
+ }
+
+ //[MonoTODO]
+ ////FIXME
+ //protected override Size DefaultSize {
+ //}
+
+ //[MonoTODO]
+ //public new Size Size {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ // set {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ [MonoTODO]
+ protected Rectangle MaximizedBounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ // --- Protected Methods
+
+ protected override void AdjustFormScrollbars (
+ bool displayScrollbars)
+ {
+ base.AdjustFormScrollbars (displayScrollbars);
+ }
+
+ protected override Control.ControlCollection
+ CreateControlsInstance ()
+ {
+ return base.CreateControlsInstance ();
+ }
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+
+ if (IsHandleCreated)
+ OnHandleCreated (new EventArgs());
+ }
+
+ protected override void DefWndProc (ref Message m)
+ {
+ window.DefWndProc (ref m);
+ }
+
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //Compact Framework
+ protected virtual void OnClosed (EventArgs e)
+ {
+ if (Closed != null)
+ Closed (this, e);
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ // CancelEventArgs not yet stubbed/implemented
+ //protected virtual void OnClosing(CancelEventArgs e)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ protected override void OnCreateControl ()
+ {
+ base.OnCreateControl ();
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ Console.WriteLine ("OnHandleCreated");
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnInputLanguageChanged (
+ InputLanguageChangedEventArgs e)
+ {
+ if (InputLanguageChanged != null)
+ InputLanguageChanged (this, e);
+ }
+
+ protected virtual void OnInputLanguagedChanging (
+ InputLanguageChangingEventArgs e)
+ {
+ if (InputLanguageChanging != null)
+ InputLanguageChanging (this, e);
+ }
+
+ //Compact Framework
+ protected virtual void OnLoad (EventArgs e)
+ {
+ if (Load != null)
+ Load (this, e);
+ }
+
+ protected virtual void OnMaximizedBoundsChanged (EventArgs e)
+ {
+ if (MaximizedBoundsChanged != null)
+ MaximizedBoundsChanged (this, e);
+ }
+
+ protected virtual void OnMaximumSizeChanged (EventArgs e)
+ {
+ if (MaximumSizeChanged != null)
+ MaximumSizeChanged (this, e);
+ }
+
+ protected virtual void OnMdiChildActivate (EventArgs e)
+ {
+ if (MdiChildActivate != null)
+ MdiChildActivate (this, e);
+ }
+
+ protected virtual void OnMenuComplete (EventArgs e)
+ {
+ if (MenuComplete != null)
+ MenuComplete (this, e);
+ }
+
+ protected virtual void OnMenuStart (EventArgs e)
+ {
+ if (MenuStart != null)
+ MenuStart (this, e);
+ }
+
+ protected virtual void OnMinimumSizeChanged (EventArgs e)
+ {
+
+ }
+
+ //Compact Framework
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+ }
+
+ //Compact Framework
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ }
+
+ protected override void OnStyleChanged (EventArgs e)
+ {
+ base.OnStyleChanged (e);
+ }
+
+ //Compact Framework
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ protected override bool ProcessCmdKey (
+ ref Message msg, Keys keyData)
+ {
+ return base.ProcessCmdKey (ref msg, keyData);
+ }
+
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ return base.ProcessDialogKey (keyData);
+ }
+
+ protected override bool ProcessKeyPreview (ref Message m)
+ {
+ return base.ProcessKeyPreview (ref m);
+ }
+
+ protected override bool ProcessTabKey (bool forward)
+ {
+ return base.ProcessTabKey (forward);
+ }
+
+ protected override void ScaleCore (float x, float y)
+ {
+ base.ScaleCore (x, y);
+ }
+
+ //public void Select(bool b1, bool b2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ protected override void SetBoundsCore (
+ int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void SetClientSizeCore (int x, int y)
+ {
+ base.SetClientSizeCore (x, y);
+ }
+
+ protected override void SetVisibleCore (bool value)
+ {
+ base.SetVisibleCore (value);
+ }
+
+ //protected void UpdateBounds()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+
+ switch (m.Msg) {
+ case Win32.WM_CLOSE:
+ EventArgs closeArgs = new EventArgs();
+ OnClosed (closeArgs);
+ break;
+ //case ?:
+ //OnCreateControl()
+ //break;
+ case Win32.WM_FONTCHANGE:
+ EventArgs fontChangedArgs = new EventArgs();
+ OnFontChanged (fontChangedArgs);
+ break;
+ case Win32.WM_CREATE:
+ EventArgs handleCreatedArgs = new EventArgs();
+ OnHandleCreated (handleCreatedArgs);
+ break;
+ case Win32.WM_DESTROY:
+ EventArgs destroyArgs = new EventArgs();
+ OnHandleDestroyed (destroyArgs);
+ break;
+ case Win32.WM_INPUTLANGCHANGE:
+ //InputLanguageChangedEventArgs ilChangedArgs =
+ // new InputLanguageChangedEventArgs();
+ //OnInputLanguageChanged (ilChangedArgs);
+ break;
+ case Win32.WM_INPUTLANGCHANGEREQUEST:
+ //InputLanguageChangingEventArgs ilChangingArgs =
+ // new InputLanguageChangingEventArgs();
+ //OnInputLanguagedChanging (ilChangingArgs);
+ break;
+ /*
+ case Win32.WM_SHOWWINDOW:
+ EventArgs e;
+ OnLoad (e);
+ break;
+ */
+ // case ?:
+ // OnMaximizedBoundsChanged(EventArgs e)
+ // break;
+ // case ?:
+ // OnMaximumSizedChanged(EventArgs e)
+ //break;
+ case Win32.WM_MDIACTIVATE:
+ EventArgs mdiActivateArgs = new EventArgs();
+ OnMdiChildActivate (mdiActivateArgs);
+ break;
+ case Win32.WM_EXITMENULOOP:
+ EventArgs menuCompleteArgs = new EventArgs();
+ OnMenuComplete (menuCompleteArgs);
+ break;
+ case Win32.WM_ENTERMENULOOP:
+ EventArgs enterMenuLoopArgs = new EventArgs();
+ OnMenuStart (enterMenuLoopArgs);
+ break;
+ // case ?:
+ // OnMinimumSizeChanged(EventArgs e)
+ // break;
+ case Win32.WM_PAINT:
+ //PaintEventArgs paintArgs = new PaintEventArgs();
+ //OnPaint (paintArgs);
+ break;
+ case Win32.WM_SIZE:
+ EventArgs resizeArgs = new EventArgs();
+ OnResize (resizeArgs);
+ break;
+ //case ?:
+ //OnStyleChanged(EventArgs e)
+ //break;
+ case Win32.WM_SETTEXT:
+ EventArgs textChangedArgs = new EventArgs();
+ OnTextChanged (textChangedArgs);
+ break;
+ case Win32.WM_SHOWWINDOW:
+ EventArgs visibleChangedArgs = new EventArgs();
+ OnVisibleChanged (visibleChangedArgs);
+ break;
+ }
+ }
+
+ //sub class
+ //System.Windows.Forms.Form.ControlCollection.cs
+ //
+ //Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ //
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+ // TODO: implement support classes and derive from
+ // proper classes
+ // FIXME: use this or the one defined on Control?
+ public class ControlCollectionX :
+ System.Windows.Forms.Control.ControlCollection
+ /*,ICollection*/ {
+
+ // --- Constructor
+ // base class not defined (yet!)
+ public ControlCollectionX (Form owner) : base(owner) {
+
+ }
+
+ // --- Public Methods
+
+ // TODO: see what causes this compile error
+ public override void Add(Control value) {
+ base.Add (value);
+ }
+
+ public override bool Equals (object o) {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2) {
+ // throw new NotImplementedException ();
+ //}
+
+ public override int GetHashCode () {
+ //FIXME add our proprities
+ return base.GetHashCode ();
+ }
+
+ //public override int GetChildIndex(Control c) {
+ //return base.GetChildIndex (c);
+ //}
+
+ public override void Remove(Control value) {
+ base.Remove (value);
+ }
+ } // end of Subclass
+ }
+ }
diff --git a/mcs/class/System.Windows.Forms/WINELib/FormBorderStyle.cs b/mcs/class/System.Windows.Forms/WINELib/FormBorderStyle.cs
new file mode 100644
index 00000000000..66738ef9bbb
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/FormBorderStyle.cs
@@ -0,0 +1,31 @@
+//
+// System.Windows.Forms.FormBorderStyle.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the border styles for a form.
+ /// </summary>
+ //[Serializable]
+ [ComVisible(true)]
+ public enum FormBorderStyle {
+
+ //Values were verified with enumcheck.
+ None = 0,
+ FixedSingle = 1,
+ Fixed3D = 2,
+ FixedDialog = 3,
+ Sizable = 4,
+ FixedToolWindows = 5,
+ SizableToolWindow = 6
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/FormStartPosition.cs b/mcs/class/System.Windows.Forms/WINELib/FormStartPosition.cs
new file mode 100644
index 00000000000..b1fb9089e70
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/FormStartPosition.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.FormStartPosition.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the initial position of a form.
+ /// </summary>
+ //[Serializable]
+ [ComVisible(true)]
+ public enum FormStartPosition {
+
+ //Values were verified with enumcheck.
+ Manual = 0,
+ CenterScreen = 1,
+ WindowsDefaultLocation = 2,
+ WindowsDefaultBounds = 3,
+ CenterParent = 4,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/FormTest.cs b/mcs/class/System.Windows.Forms/WINELib/FormTest.cs
new file mode 100644
index 00000000000..cf9a4dbd58f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/FormTest.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Windows.Forms;
+
+// Test basic functionality of the Application and Form class
+class FormTest : Form {
+
+ Label label;
+ Button button;
+
+ public FormTest () : base ()
+ {
+ label = new Label ();
+ label.Top = 50;
+ label.Left = 10;
+ label.Width = 50;
+ label.Height = 50;
+ label.Parent = this;
+ label.Text = "Label";
+
+ button = new Button ();
+ button.Top = 50;
+ button.Left = 120;
+ button.Width = 50;
+ button.Height = 50;
+ button.Parent = this;
+ button.Text = "Button";
+ }
+
+ // - verifies the WndProc can be overridden propery
+ // - verifies the Application.MessageLoop is working properly
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+
+ // should be true after the Run command is reached
+ Console.WriteLine ("Application.MessageLoop: " +
+ Application.MessageLoop);
+ }
+
+ public class MouseMoveMessageFilter : IMessageFilter {
+
+ public bool PreFilterMessage(ref Message m)
+ {
+ Console.WriteLine ("PreFilter(ing) message");
+
+ if (m.Msg == Win32.WM_MOUSEMOVE) {
+ Console.WriteLine ("captured mousemove");
+ return true;
+ }
+ return false;
+ }
+ }
+
+
+ static public void Test1 ()
+ {
+ MessageBox.Show ("test derived form");
+ FormTest form = new FormTest ();
+ MouseMoveMessageFilter f = new MouseMoveMessageFilter();
+ Application.AddMessageFilter (f);
+
+ // should be false
+ Console.WriteLine ("Application.MessageLoop: " +
+ Application.MessageLoop);
+
+ Application.Run (form);
+ Application.RemoveMessageFilter (f);
+ }
+
+ static public void Test2 ()
+ {
+ MessageBox.Show ("test non-derived form, ctrl-c from console to quit");
+ Form form = new Form ();
+ form.Show ();
+ Application.DoEvents ();
+ Application.Run ();
+ }
+
+ static public int Main (String[] args)
+ {
+ Test1();
+ //Test2();
+ return 0;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/FormWindowState.cs b/mcs/class/System.Windows.Forms/WINELib/FormWindowState.cs
new file mode 100644
index 00000000000..e47baa119da
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/FormWindowState.cs
@@ -0,0 +1,27 @@
+//
+// System.Windows.Forms.FormWindowState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how a form window is displayed.
+ /// </summary>
+ //[Serializable]
+ [ComVisible(true)]
+ public enum FormWindowState {
+
+ //Values were verified with enumcheck.
+ Normal = 0,
+ Maximized = 1,
+ Minimized = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventArgs.cs
new file mode 100644
index 00000000000..19d817d4415
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventArgs.cs
@@ -0,0 +1,131 @@
+//
+// System.Windows.Forms.GiveFeedbackEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partialy completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Completed
+ /// </summary>
+
+ public class GiveFeedbackEventArgs : EventArgs {
+
+ #region Fields
+ DragDropEffects effect;
+ bool useDefaultCursors;
+ #endregion
+
+ public GiveFeedbackEventArgs( DragDropEffects effect, bool useDefaultCursors )
+ {
+ this.effect = effect;
+ this.useDefaultCursors = useDefaultCursors;
+ }
+
+ #region Public Properties
+ public DragDropEffects Effect
+ {
+ get {
+ return effect;
+ }
+ }
+ public bool UseDefaultCursors {
+ get {
+ return useDefaultCursors;
+ }
+ set {
+ useDefaultCursors = value;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two GiveFeedbackEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Effect and UseDefaultCursors Property
+ /// of the two GiveFeedbackEventArgs.
+ /// </remarks>
+ public static bool operator == (GiveFeedbackEventArgs GiveFeedbackEventArgsA, GiveFeedbackEventArgs GiveFeedbackEventArgsB)
+ {
+ return (GiveFeedbackEventArgsA.Effect == GiveFeedbackEventArgsB.Effect) &&
+ (GiveFeedbackEventArgsA.UseDefaultCursors == GiveFeedbackEventArgsB.UseDefaultCursors);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two GiveFeedbackEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Effect and UseDefaultCursors Property
+ /// of the two GiveFeedbackEventArgs.
+ /// </remarks>
+ public static bool operator != (GiveFeedbackEventArgs GiveFeedbackEventArgsA, GiveFeedbackEventArgs GiveFeedbackEventArgsB)
+ {
+ return (GiveFeedbackEventArgsA.Effect != GiveFeedbackEventArgsB.Effect) ||
+ (GiveFeedbackEventArgsA.UseDefaultCursors != GiveFeedbackEventArgsB.UseDefaultCursors);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// GiveFeedbackEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is GiveFeedbackEventArgs))return false;
+ return (this == (GiveFeedbackEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " GiveFeedbackEventArgs";
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventHandler.cs
new file mode 100644
index 00000000000..136b6a29c98
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/GiveFeedbackEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.GiveFeedbackEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void GiveFeedbackEventHandler (
+ object sender,
+ GiveFeedbackEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/GridItem.cs b/mcs/class/System.Windows.Forms/WINELib/GridItem.cs
new file mode 100644
index 00000000000..573dfa3c977
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/GridItem.cs
@@ -0,0 +1,100 @@
+//
+// System.Windows.Forms.GridItem.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public abstract class GridItem {
+ bool expandable;
+ bool expanded;
+ //
+ // --- Public Properties
+ //
+ public bool Expandable {
+ get {
+ return expandable;
+ }
+ }
+ public bool Expanded {
+ get {
+ return expanded;
+ }
+ set {
+ expanded = value;
+ }
+ }
+ //[MonoTODO]
+ //public abstract GridItemCollection GridItems {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public abstract GridItemType GridItemType {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public abstract string Label {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public abstract GridItem Parent {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public abstract PropertyDescriptor PropertyDescriptor {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+ //[MonoTODO]
+ //public abstract object Value {
+ // get {
+ // throw new NotImplementedException ();
+ // }
+ //}
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ //
+ // --- Protected Constructor
+ //
+ [MonoTODO]
+ protected GridItem()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/HelpEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/HelpEventArgs.cs
new file mode 100644
index 00000000000..87fa7088839
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/HelpEventArgs.cs
@@ -0,0 +1,134 @@
+//
+// System.Windows.Forms.HelpEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Complete.
+ // </summary>
+
+ public class HelpEventArgs : EventArgs {
+
+ #region Fields
+ private Point mousePos;
+ private bool handled;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public HelpEventArgs(Point mousePos)
+ {
+ this.mousePos = mousePos;
+ handled = false; // Gian : hadled is false, otherwise all events are managed by user by default.
+ }
+
+ #region Public Properties
+ public bool Handled
+ {
+ get {
+ return handled;
+ }
+ set {
+ handled = value;
+ }
+ }
+ public Point MousePos {
+ get {
+ return mousePos;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two HelpEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Handled and MousePos Property
+ /// of the two HelpEventArgs.
+ /// </remarks>
+ public static bool operator == (HelpEventArgs HelpEventArgsA, HelpEventArgs HelpEventArgsB)
+ {
+ return (HelpEventArgsA.Handled == HelpEventArgsB.Handled) &&
+ (HelpEventArgsA.MousePos == HelpEventArgsB.MousePos);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two HelpEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Handled and MousePos Property
+ /// of the two HelpEventArgs.
+ /// </remarks>
+ public static bool operator != (HelpEventArgs HelpEventArgsA, HelpEventArgs HelpEventArgsB)
+ {
+ return (HelpEventArgsA.Handled != HelpEventArgsB.Handled) ||
+ (HelpEventArgsA.MousePos != HelpEventArgsB.MousePos);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// HelpEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is HelpEventArgs))return false;
+ return (this == (HelpEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " HelpEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/HelpEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/HelpEventHandler.cs
new file mode 100644
index 00000000000..14f84f59d78
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/HelpEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.HelpEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void HelpEventHandler (
+ object sender,
+ HelpEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/HorizontalAlignment.cs b/mcs/class/System.Windows.Forms/WINELib/HorizontalAlignment.cs
new file mode 100644
index 00000000000..0430f0ae8bc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/HorizontalAlignment.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.HorizontalAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum HorizontalAlignment {
+ Center = 2,
+ Left = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/IAccessible.cs b/mcs/class/System.Windows.Forms/WINELib/IAccessible.cs
new file mode 100644
index 00000000000..a3e89588756
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IAccessible.cs
@@ -0,0 +1,7 @@
+
+namespace System.Windows.Forms {
+ interface IAccessible {
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/IButtonControl.cs b/mcs/class/System.Windows.Forms/WINELib/IButtonControl.cs
new file mode 100644
index 00000000000..c962adc53db
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IButtonControl.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.IButtonControl.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IButtonControl {
+ void NotifyDefault(bool value);
+ void PerformClick();
+ DialogResult DialogResult {get; set;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/IContainerControl.cs b/mcs/class/System.Windows.Forms/WINELib/IContainerControl.cs
new file mode 100644
index 00000000000..61dbbb42cc0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IContainerControl.cs
@@ -0,0 +1,8 @@
+namespace System.Windows.Forms {
+ // allows code to compile without commenting out references
+ // to Font... to be removed
+ interface IContainerControl {
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/IDataObject.cs b/mcs/class/System.Windows.Forms/WINELib/IDataObject.cs
new file mode 100644
index 00000000000..319c2772f18
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IDataObject.cs
@@ -0,0 +1,33 @@
+//
+// System.Windows.Forms.IDataObject.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ [ComVisible(true)]
+ public interface IDataObject {
+
+ object GetData(string format);
+ object GetData(Type format);
+ object GetData(string format, bool autoConvert);
+
+ bool GetDataPresent(string format);
+ bool GetDataPresent(Type format);
+ bool GetDataPresent(string format, bool autoConvert);
+
+ string[] GetFormats();
+ string[] GetFormats(bool autoConvert);
+
+ void SetData(object data);
+ void SetData(string format, object data);
+ void SetData(Type format, object data);
+ void SetData(string format, bool autoConvert, object data);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/IMessageFilter.cs b/mcs/class/System.Windows.Forms/WINELib/IMessageFilter.cs
new file mode 100644
index 00000000000..cb57ed75204
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IMessageFilter.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.IMessageFilter.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+using System.Threading;
+namespace System.Windows.Forms {
+
+ public interface IMessageFilter {
+ bool PreFilterMessage(ref Message m);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/IWin32Window.cs b/mcs/class/System.Windows.Forms/WINELib/IWin32Window.cs
new file mode 100644
index 00000000000..5de9e06dd79
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IWin32Window.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.IWin32Window.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ [ComVisible(true)]
+ // FixMe [Guid("")]
+ // FixMe [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IWin32Window {
+
+ IntPtr Handle {get;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/IWindowTarget.cs b/mcs/class/System.Windows.Forms/WINELib/IWindowTarget.cs
new file mode 100644
index 00000000000..f5482584eed
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/IWindowTarget.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.IWindowTarget.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ public interface IWindowTarget {
+
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ void OnHandleChange(IntPtr newHandle);
+ void OnMessage(ref Message m);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/ImageList.cs b/mcs/class/System.Windows.Forms/WINELib/ImageList.cs
new file mode 100644
index 00000000000..fc85a25df33
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ImageList.cs
@@ -0,0 +1,381 @@
+//
+// System.Windows.Forms.ImageList.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+using System.Drawing;
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+ public sealed class ImageList : Component {
+
+ //
+ // --- Constructor
+ //
+
+ [MonoTODO]
+ public ImageList()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ImageList(IContainer cont)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public ColorDepth ColorDepth {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HandleCreated {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ImageList.ImageCollection Images {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Size ImageSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ImageListStreamer ImageStream {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Color TransparentColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ //public void Dispose()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public void Draw(Graphics g, Point pt, int n)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Draw(Graphics g, int n1, int n2, int n3)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ public event EventHandler RecreateHandle;
+
+ //
+ // --- Protected Methods
+ //
+ //[MonoTODO]
+ //protected virtual void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+
+ //
+ // System.Windows.Forms.ImageList.ImageCollection.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ //
+ //// (C) 2002 Ximian, Inc
+ ////
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public sealed class ImageCollection : IList, ICollection, IEnumerable {
+
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool Empty {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Image this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public void Add(Icon icon)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Add(Image img)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Add(Image img, Color col)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int AddStrip(Image value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(Image image)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(Image image)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(Image image)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+
+ }// End of Subclass
+
+ }//End of class
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ImageListStreamer.cs b/mcs/class/System.Windows.Forms/WINELib/ImageListStreamer.cs
new file mode 100644
index 00000000000..a35d9759d69
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ImageListStreamer.cs
@@ -0,0 +1,41 @@
+//
+// System.Windows.Forms.ImageListStreamer.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public sealed class ImageListStreamer : ISerializable {
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override bool Equals(object o) {
+ throw new NotImplementedException ();
+ }
+ //public static bool Equals(object o1, object o2) {
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context){
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ImeMode.cs b/mcs/class/System.Windows.Forms/WINELib/ImeMode.cs
new file mode 100644
index 00000000000..bd34afa9430
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ImeMode.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.ImeMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ImeMode {
+ Alpha = 8,
+ AlphaFull = 7,
+ Disable = 3,
+ Hangul = 10,
+ HangulFull = 9,
+ Hiragana = 4,
+ Inherit = -1,
+ Katakana = 5,
+ KatakanaHalf = 6,
+ NoControl = 0,
+ Off = 2,
+ On = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InputLanguage.cs b/mcs/class/System.Windows.Forms/WINELib/InputLanguage.cs
new file mode 100644
index 00000000000..8b466c7ed48
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InputLanguage.cs
@@ -0,0 +1,86 @@
+//
+// System.Windows.Forms.InputLanguage.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public sealed class InputLanguage {
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public CultureInfo Culture {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static InputLanguage CurrentInputLanguage {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static InputLanguage DefaultInputLanguage {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public static InputLanguageCollection InstalledInputLanguages {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string LayoutName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public static InputLanguage FromCulture(CultureInfo culture)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventArgs.cs
new file mode 100644
index 00000000000..2cf36fb3e65
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventArgs.cs
@@ -0,0 +1,140 @@
+//
+// System.Windows.Forms.InputLanguageChangeEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partial Completed by Dennis Hayes (dennish@raytek.com)
+// Giananadrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Template. Needs completition on CharSet property
+ // </summary>
+
+ public class InputLanguageChangedEventArgs : EventArgs {
+
+ #region Fields
+ private CultureInfo culture;
+ private byte b;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public InputLanguageChangedEventArgs ( CultureInfo culture, byte b) {
+ this.culture = culture;
+ this.b = b;
+ }
+
+ #region Public Properties
+ [MonoTODO]
+ public byte CharSet
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ public CultureInfo Culture {
+ get {
+ return culture;
+ }
+ }
+ [MonoTODO]
+ public InputLanguage InputLanguage {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two InputLanguageChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// CharSet, Culture and InputLanguage Property
+ /// of the two InputLanguageChangedEventArgs.
+ /// </remarks>
+ public static bool operator == (InputLanguageChangedEventArgs InputLanguageChangedEventArgsA, InputLanguageChangedEventArgs InputLanguageChangedEventArgsB)
+ {
+ return (InputLanguageChangedEventArgsA.CharSet == InputLanguageChangedEventArgsB.CharSet) &&
+ (InputLanguageChangedEventArgsA.Culture == InputLanguageChangedEventArgsB.Culture) &&
+ (InputLanguageChangedEventArgsA.InputLanguage == InputLanguageChangedEventArgsB.InputLanguage);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two InputLanguageChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// CharSet, Culture and InputLanguage Property
+ /// of the two InputLanguageChangedEventArgs.
+ /// </remarks>
+ public static bool operator != (InputLanguageChangedEventArgs InputLanguageChangedEventArgsA, InputLanguageChangedEventArgs InputLanguageChangedEventArgsB)
+ {
+ return (InputLanguageChangedEventArgsA.CharSet != InputLanguageChangedEventArgsB.CharSet) ||
+ (InputLanguageChangedEventArgsA.Culture != InputLanguageChangedEventArgsB.Culture) ||
+ (InputLanguageChangedEventArgsA.InputLanguage != InputLanguageChangedEventArgsB.InputLanguage);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// InputLanguageChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is InputLanguageChangedEventArgs))return false;
+ return (this == (InputLanguageChangedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " InputLanguageChangedEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventHandler.cs
new file mode 100644
index 00000000000..72b5732f3f5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windoes.Forms.InputLanguageChangedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void InputLanguageChangedEventHandler (
+ object sender,
+ InputLanguageChangedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventArgs.cs
new file mode 100644
index 00000000000..4192b8f2774
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventArgs.cs
@@ -0,0 +1,146 @@
+//
+// System.Windows.Forms.InputLanguageChangingEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class InputLanguageChangingEventArgs : EventArgs {
+
+ #region Fields
+ private CultureInfo culture;
+ private bool systemcharset;
+ private InputLanguage inputlanguage;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO] //what about input lang?
+ public InputLanguageChangingEventArgs(CultureInfo culture, bool sysCharSet) {
+ this.culture = culture;
+ this.systemcharset =sysCharSet;
+ }
+
+ [MonoTODO] //what about culture?
+ public InputLanguageChangingEventArgs(InputLanguage inputlanguage, bool sysCharSet) {
+ this.culture = culture;
+ this.inputlanguage = inputlanguage;
+ }
+
+ #region Public Properties
+ public CultureInfo Culture
+ {
+ get {
+ return culture;
+ }
+ }
+ public InputLanguage InputLanguage {
+ get {
+ return inputlanguage;
+ }
+ }
+ public bool SysCharSet {
+ get {
+ return systemcharset;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two InputLanguageChangingEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Culture, InputLanguage and SysCharSet Property
+ /// of the two InputLanguageChangingEventArgs.
+ /// </remarks>
+ public static bool operator == (InputLanguageChangingEventArgs InputLanguageChangingEventArgsA, InputLanguageChangingEventArgs InputLanguageChangingEventArgsB)
+ {
+ return (InputLanguageChangingEventArgsA.Culture == InputLanguageChangingEventArgsB.Culture) &&
+ (InputLanguageChangingEventArgsA.InputLanguage == InputLanguageChangingEventArgsB.InputLanguage) &&
+ (InputLanguageChangingEventArgsA.SysCharSet == InputLanguageChangingEventArgsB.SysCharSet);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two InputLanguageChangingEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Culture, InputLanguage and SysCharSet Property
+ /// of the two InputLanguageChangingEventArgs.
+ /// </remarks>
+ public static bool operator != (InputLanguageChangingEventArgs InputLanguageChangingEventArgsA, InputLanguageChangingEventArgs InputLanguageChangingEventArgsB)
+ {
+ return (InputLanguageChangingEventArgsA.Culture != InputLanguageChangingEventArgsB.Culture) ||
+ (InputLanguageChangingEventArgsA.InputLanguage != InputLanguageChangingEventArgsB.InputLanguage) ||
+ (InputLanguageChangingEventArgsA.SysCharSet != InputLanguageChangingEventArgsB.SysCharSet);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// InputLanguageChangingEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is InputLanguageChangingEventArgs))return false;
+ return (this == (InputLanguageChangingEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " InputLanguageChangingEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventHandler.cs
new file mode 100644
index 00000000000..89c61f80f78
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InputLanguageChangingEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.InputLanguageChangingEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void InputLanguageChangingEventHandler (
+ object sender,
+ InputLanguageChangingEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InputLanguageCollection.cs b/mcs/class/System.Windows.Forms/WINELib/InputLanguageCollection.cs
new file mode 100644
index 00000000000..c9445525320
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InputLanguageCollection.cs
@@ -0,0 +1,70 @@
+//
+// System.Windows.Forms.InputLanguageCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class InputLanguageCollection : ReadOnlyCollectionBase {
+
+ //
+ // --- Public Properties
+ //
+
+ [MonoTODO]
+ public InputLanguage this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public bool Contains(InputLanguage lang)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo(InputLanguage[] array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ [MonoTODO]
+ public int IndexOf(InputLanguage lang)
+ {
+ throw new NotImplementedException ();
+ }
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+}
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InvalidateEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/InvalidateEventArgs.cs
new file mode 100644
index 00000000000..67cbf6d2aac
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InvalidateEventArgs.cs
@@ -0,0 +1,122 @@
+//
+// System.Windows.Forms.InvalidateEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class InvalidateEventArgs : EventArgs {
+
+ #region Fields
+ private Rectangle InvalidRectangle;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public InvalidateEventArgs(Rectangle invalidRect)
+ {
+ InvalidRectangle = invalidRect;
+ }
+
+ #region Public Properties
+ public Rectangle InvalidRect
+ {
+ get {
+ return InvalidRectangle;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two InvalidateEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// InvalidRect Property
+ /// of the two InvalidateEventArgs.
+ /// </remarks>
+ public static bool operator == (InvalidateEventArgs InvalidateEventArgsA, InvalidateEventArgs InvalidateEventArgsB)
+ {
+ return (InvalidateEventArgsA.InvalidRect == InvalidateEventArgsB.InvalidRect);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two InvalidateEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// InvalidRect Property
+ /// of the two InvalidateEventArgs.
+ /// </remarks>
+ public static bool operator != (InvalidateEventArgs InvalidateEventArgsA, InvalidateEventArgs InvalidateEventArgsB)
+ {
+ return (InvalidateEventArgsA.InvalidRect != InvalidateEventArgsB.InvalidRect);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// InvalidateEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is InvalidateEventArgs))return false;
+ return (this == (InvalidateEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " InvalidateEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/InvalidateEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/InvalidateEventHandler.cs
new file mode 100644
index 00000000000..11fa398faac
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/InvalidateEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.InvalidateEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void InvalidateEventHandler (
+ object sender,
+ InvalidateEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ItemChangedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ItemChangedEventArgs.cs
new file mode 100644
index 00000000000..b0905dc7cb5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ItemChangedEventArgs.cs
@@ -0,0 +1,113 @@
+//
+// System.Windows.Forms.ItemChangedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class ItemChangedEventArgs : EventArgs {
+
+ #region Fields
+ private int index = 0; //Never assigned. default to 0.
+ #endregion
+
+ #region Public Properties
+ public int Index
+ {
+ get {
+ return index;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ItemChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Index Property
+ /// of the two ItemChangedEventArgs.
+ /// </remarks>
+ public static bool operator == (ItemChangedEventArgs ItemChangedEventArgsA, ItemChangedEventArgs ItemChangedEventArgsB)
+ {
+ return (ItemChangedEventArgsA.Index == ItemChangedEventArgsB.Index);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ItemChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Index Property
+ /// of the two ItemChangedEventArgs.
+ /// </remarks>
+ public static bool operator != (ItemChangedEventArgs ItemChangedEventArgsA, ItemChangedEventArgs ItemChangedEventArgsB)
+ {
+ return (ItemChangedEventArgsA.Index != ItemChangedEventArgsB.Index);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ItemChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ItemChangedEventArgs))return false;
+ return (this == (ItemChangedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " ItemChangedEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ItemChangedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ItemChangedEventHandler.cs
new file mode 100644
index 00000000000..99563864331
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ItemChangedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ItemChangedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ItemChangedEventHandler (
+ object sender,
+ ItemChangedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ItemCheckEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ItemCheckEventArgs.cs
new file mode 100644
index 00000000000..b2a7d7c16a5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ItemCheckEventArgs.cs
@@ -0,0 +1,143 @@
+//
+// System.Windows.Forms.ItemCheckEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class ItemCheckEventArgs : EventArgs {
+
+ #region Fields
+ private int index;
+ private CheckState newcheckvalue;
+ private CheckState currentcheckvalue;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public ItemCheckEventArgs(int index, CheckState newCheckValue, CheckState currentValue )
+ {
+ this.index = index;
+ newcheckvalue = newCheckValue;
+ currentcheckvalue = currentValue;
+ }
+
+ #region Public Properties
+ public CheckState CurrentValue
+ {
+ get {
+ return currentcheckvalue;
+ }
+ }
+ public int Index {
+ get {
+ return index;
+ }
+ }
+ public CheckState NewValue {
+ get {
+ return newcheckvalue;
+ }
+ set {
+ newcheckvalue = value;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ItemCheckEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// CurrentValue, Index, NewValue and end Property
+ /// of the two ItemCheckEventArgs.
+ /// </remarks>
+ public static bool operator == (ItemCheckEventArgs ItemCheckEventArgsA, ItemCheckEventArgs ItemCheckEventArgsB)
+ {
+ return (ItemCheckEventArgsA.CurrentValue == ItemCheckEventArgsB.CurrentValue) &&
+ (ItemCheckEventArgsA.Index == ItemCheckEventArgsB.Index) &&
+ (ItemCheckEventArgsA.NewValue == ItemCheckEventArgsB.NewValue);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ItemCheckEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// CurrentValue, Index, NewValue and end Property
+ /// of the two ItemCheckEventArgs.
+ /// </remarks>
+ public static bool operator != (ItemCheckEventArgs ItemCheckEventArgsA, ItemCheckEventArgs ItemCheckEventArgsB)
+ {
+ return (ItemCheckEventArgsA.CurrentValue != ItemCheckEventArgsB.CurrentValue) ||
+ (ItemCheckEventArgsA.Index != ItemCheckEventArgsB.Index) ||
+ (ItemCheckEventArgsA.NewValue != ItemCheckEventArgsB.NewValue);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ItemCheckEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ItemCheckEventArgs))return false;
+ return (this == (ItemCheckEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " ItemCheckEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ItemCheckEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ItemCheckEventHandler.cs
new file mode 100644
index 00000000000..b1abaab8ddc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ItemCheckEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Wondows.Forms.ItemCheckEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ItemCheckEventHandler (
+ object sender,
+ ItemCheckEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ItemDragEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ItemDragEventArgs.cs
new file mode 100644
index 00000000000..02956fd6468
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ItemDragEventArgs.cs
@@ -0,0 +1,137 @@
+//
+// System.Windows.Forms.ItemDragEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ // </summary>
+
+ public class ItemDragEventArgs : EventArgs {
+
+ #region Fields
+ private MouseButtons buttons;
+ private object itemdrageobject;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public ItemDragEventArgs(MouseButtons bttns)
+ {
+ buttons = bttns;
+ }
+ public ItemDragEventArgs(MouseButtons bttns, object o)
+ {
+ buttons = bttns;
+ itemdrageobject = o;
+ }
+
+ #region Public Properties
+ public MouseButtons Button
+ {
+ get {
+ return buttons;
+ }
+ }
+
+ public object Item
+ {
+ get {
+ return itemdrageobject;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ItemDragEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// button and item Property
+ /// of the two ItemDragEventArgs.
+ /// </remarks>
+ public static bool operator == (ItemDragEventArgs ItemDragEventArgsA, ItemDragEventArgs ItemDragEventArgsB)
+ {
+ return (ItemDragEventArgsA.Button == ItemDragEventArgsB.Button) &&
+ (ItemDragEventArgsA.Item == ItemDragEventArgsB.Item);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ItemDragEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// button and item Property
+ /// of the two ItemDragEventArgs.
+ /// </remarks>
+ public static bool operator != (ItemDragEventArgs ItemDragEventArgsA, ItemDragEventArgs ItemDragEventArgsB)
+ {
+ return (ItemDragEventArgsA.Button != ItemDragEventArgsB.Button) ||
+ (ItemDragEventArgsA.Item != ItemDragEventArgsB.Item);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ItemDragEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ItemDragEventArgs))return false;
+ return (this == (ItemDragEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " ItemDragEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ItemDragEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ItemDragEventHandler.cs
new file mode 100644
index 00000000000..07c36587ae0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ItemDragEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.ItemDragEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void ItemDragEventHandler (
+ object sender,
+ ItemDragEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/KeyEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/KeyEventArgs.cs
new file mode 100644
index 00000000000..a73b69713f5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/KeyEventArgs.cs
@@ -0,0 +1,208 @@
+//
+// System.Windows.Forms.KeyEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Complete
+ // </summary>
+
+ public class KeyEventArgs : EventArgs {
+
+ #region Fields
+
+ private Keys keydata;
+ private Keys keycode;
+ private Keys modifiers;
+
+ private bool alt = false;
+ private bool control = false;
+ private bool handled = false;
+ private bool shift = false;
+
+ private int keyvalue = -1;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public KeyEventArgs (Keys keyData)
+ {
+ keydata = keyData;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public virtual bool Alt
+ {
+ get {
+ return alt;
+ }
+ }
+
+ [ComVisible(true)]
+ public bool Control
+ {
+ get {
+ return control;
+ }
+ }
+
+ [ComVisible(true)]
+ public bool Handled
+ {
+ get {
+ return handled;
+ }
+ set {
+ handled = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public Keys KeyCode
+ {
+ get {
+ return keycode;
+ }
+ }
+
+ [ComVisible(true)]
+ public Keys KeyData
+ {
+ get {
+ return keydata;
+ }
+ }
+
+ [ComVisible(true)]
+ public int KeyValue
+ {
+ get {
+ return keyvalue;
+ }
+ }
+
+ [ComVisible(true)]
+ public Keys Modifiers
+ {
+ get {
+ return modifiers;
+ }
+ }
+
+ [ComVisible(true)]
+ public bool Shift
+ {
+ get {
+ return shift;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two KeyEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// alt, control, handled, keycode, keydata, keyvalue, modifiers, shift Property
+ /// of the two KeyEventArgs.
+ /// </remarks>
+ public static bool operator == (KeyEventArgs KeyEventArgsA, KeyEventArgs KeyEventArgsB)
+ {
+ return (KeyEventArgsA.Alt == KeyEventArgsB.Alt) &&
+ (KeyEventArgsA.Control == KeyEventArgsB.Control) &&
+ (KeyEventArgsA.Handled == KeyEventArgsB.Handled) &&
+ (KeyEventArgsA.KeyCode == KeyEventArgsB.KeyCode) &&
+ (KeyEventArgsA.KeyData == KeyEventArgsB.KeyData) &&
+ (KeyEventArgsA.KeyValue == KeyEventArgsB.KeyValue) &&
+ (KeyEventArgsA.Modifiers == KeyEventArgsB.Modifiers) &&
+ (KeyEventArgsA.Shift == KeyEventArgsB.Shift);
+
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two KeyEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// alt, control, handled, keycode, keydata, keyvalue, modifiers, shift Property
+ /// of the two KeyEventArgs.
+ /// </remarks>
+ public static bool operator != (KeyEventArgs KeyEventArgsA, KeyEventArgs KeyEventArgsB)
+ {
+ return (KeyEventArgsA.Alt != KeyEventArgsB.Alt) ||
+ (KeyEventArgsA.Control != KeyEventArgsB.Control) ||
+ (KeyEventArgsA.Handled != KeyEventArgsB.Handled) ||
+ (KeyEventArgsA.KeyCode != KeyEventArgsB.KeyCode) ||
+ (KeyEventArgsA.KeyData != KeyEventArgsB.KeyData) ||
+ (KeyEventArgsA.KeyValue != KeyEventArgsB.KeyValue) ||
+ (KeyEventArgsA.Modifiers != KeyEventArgsB.Modifiers) ||
+ (KeyEventArgsA.Shift != KeyEventArgsB.Shift);
+
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// KeyEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is KeyEventArgs))return false;
+ return (this == (KeyEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " KeyEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/KeyEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/KeyEventHandler.cs
new file mode 100644
index 00000000000..d86cf733bd1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/KeyEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.KeyEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void KeyEventHandler (
+ object sender,
+ KeyEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/KeyPressEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/KeyPressEventArgs.cs
new file mode 100644
index 00000000000..ac6e6805baa
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/KeyPressEventArgs.cs
@@ -0,0 +1,135 @@
+//
+// System.Windows.Forms.KeyPressEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ // </summary>
+
+ public class KeyPressEventArgs : EventArgs {
+
+ #region Fields
+
+ private char keychar;
+ private bool handled = false; //Gian : Initialize?
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public KeyPressEventArgs (char keyChar)
+ {
+ this.keychar = keyChar;
+ }
+
+ #region Public Properties
+ [ComVisible(true)]
+ public bool Handled {
+ get {
+ return handled;
+ }
+ set {
+ handled = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public char KeyChar {
+ get {
+ return keychar;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two KeyPressEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Handled and KeyChar Property
+ /// of the two KeyPressEventArgs.
+ /// </remarks>
+ public static bool operator == (KeyPressEventArgs KeyPressEventArgsA, KeyPressEventArgs KeyPressEventArgsB)
+ {
+ return (KeyPressEventArgsA.Handled == KeyPressEventArgsB.Handled) && (KeyPressEventArgsA.KeyChar == KeyPressEventArgsB.KeyChar);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two KeyPressEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Handled and KeyChar Property
+ /// of the two KeyPressEventArgs.
+ /// </remarks>
+ public static bool operator != (KeyPressEventArgs KeyPressEventArgsA, KeyPressEventArgs KeyPressEventArgsB)
+ {
+ return (KeyPressEventArgsA.Handled != KeyPressEventArgsB.Handled) || (KeyPressEventArgsA.KeyChar != KeyPressEventArgsB.KeyChar);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// KeyPressEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is KeyPressEventArgs))return false;
+ return (this == (KeyPressEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " KeyPressEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/KeyPressEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/KeyPressEventHandler.cs
new file mode 100644
index 00000000000..193ab1700f3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/KeyPressEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.KeyPressEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void KeyPressEventHandler (
+ object sender,
+ KeyPressEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Keys.cs b/mcs/class/System.Windows.Forms/WINELib/Keys.cs
new file mode 100644
index 00000000000..f9d8081a250
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Keys.cs
@@ -0,0 +1,202 @@
+//
+// System.Windows.Forms.Keys.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ //TODO:
+ //Values not yet implmented
+ /// </summary>
+ public enum Keys {
+ A = 65,
+ Add = 107,
+ Alt = 262144,
+ Apps = 93,
+ Attn = 246,
+ B = 66,
+ Back = 8,
+ BrowserBack = 166,
+ BrowserFavorites = 171,
+ BrowserForward = 167,
+ BrowserHome = 172,
+ BrowserRefresh = 168,
+ BrowserSearch = 170,
+ BrowserStop = 169,
+ C = 67,
+ Cancel = 3,
+ Capital = 20,
+ CapsLock = 20,
+ Clear = 12,
+ Control = 131072,
+ ControlKey = 17,
+ Crsel = 247,
+ D = 68,
+ D0 = 48,
+ D1 = 49,
+ D2 = 50,
+ D3 = 51,
+ D4 = 52,
+ D5 = 53,
+ D6 = 54,
+ D7 = 55,
+ D8 = 56,
+ D9 = 57,
+ Decimal = 110,
+ Delete = 46,
+ Divide = 111,
+ Down = 40,
+ E = 69,
+ End = 35,
+ Enter = 13,
+ EraseEof = 249,
+ Escape = 27,
+ Execute = 43,
+ Exsel = 248,
+ F = 70,
+ F1 = 112,
+ F2 = 113,
+ F3 = 114,
+ F4 = 115,
+ F5 = 116,
+ F6 = 117,
+ F7 = 118,
+ F8 = 119,
+ F9 = 120,
+ F10 = 121,
+ F11 = 122,
+ F12 = 123,
+ F13 = 124,
+ F14 = 125,
+ F15 = 126,
+ F16 = 127,
+ F17 = 128,
+ F18 = 129,
+ F19 = 130,
+ F20 = 131,
+ F21 = 132,
+ F22 = 133,
+ F23 = 134,
+ F24 = 135,
+ FinalMode = 24,
+ G = 71,
+ H = 72,
+ HanguelMode = 21,
+ HangulMode = 21,
+ HanjaMode = 25,
+ Help = 47,
+ Home = 36,
+ I = 73,
+ IMEAceept = 30,
+ IMEConvert = 28,
+ IMEModeChange = 31,
+ IMENonconvert = 29,
+ Insert = 45,
+ J = 74,
+ JunjaMode = 23,
+ K = 75,
+ KanaMode = 21,
+ KanjiMode = 25,
+ KeyCode = 65535,
+ L = 76,
+ LaunchApplication1 = 182,
+ LaunchApplication2 = 183,
+ LaunchMail = 180,
+ LButton = 1,
+ LControlKey = 162,
+ Left = 37,
+ LineFeed = 10,
+ LShiftKey = 160,
+ LMenu = 164,
+ LWin = 91,
+ M = 77,
+ MButton = 4,
+ MediaNextTrack = 176,
+ MediaPlayPause = 179,
+ MediaPreviousTrack = 177,
+ MediaStop = 178,
+ Menu = 18,
+ Modifiers = -65536,
+ Multiply = 106,
+ N = 78,
+ Next = 34,
+ NoName = 252,
+ None = 0,
+ NumLock = 144,
+ NumPad0 = 96,
+ NumPad1 = 97,
+ NumPad2 = 98,
+ NumPad3 = 99,
+ NumPad4 = 100,
+ NumPad5 = 101,
+ NumPad6 = 102,
+ NumPad7 = 103,
+ NumPad8 = 104,
+ NumPad9 = 105,
+ O = 79,
+ Oem8 = 223,
+ OemBackslash = 226,
+ OemClear = 254,
+ OemCloseBrackets = 221,
+ Oemcomma = 188,
+ OemMinus = 189,
+ OemOpenBrackets = 219,
+ OemPeriod = 190,
+ OemPipe = 220,
+ Oemplus = 187,
+ OemQuestion = 191,
+ OemQuotes = 222,
+ OemSemicolon = 186,
+ Oemtilde = 192,
+ P = 80,
+ Pa1 = 253,
+ PageDown = 34,
+ PageUp = 33,
+ Pause = 19,
+ Play = 250,
+ Print = 42,
+ PrintScreen = 44,
+ Prior = 33,
+ ProcessKey = 229,
+ Q = 81,
+ R = 82,
+ RButton = 2,
+ RControlKey = 163,
+ Return = 13,
+ Right = 39,
+ RMenu = 165,
+ RShiftKey = 161,
+ RWin = 92,
+ S = 83,
+ Scroll = 145,
+ Select = 41,
+ SelectMedia = 181,
+ Separator = 108,
+ Shift = 65536,
+ ShiftKey = 16,
+ Snapshot = 44,
+ Space = 32,
+ Subtract = 109,
+ T = 84,
+ Tab = 9,
+ U = 85,
+ Up = 38,
+ V = 86,
+ VolumeDown = 174,
+ VolumeMute = 173,
+ VolumeUp = 175,
+ W = 87,
+ X = 88,
+ XButton1 = 5,
+ XButton2 = 6,
+ Y = 89,
+ Z = 90,
+ Zoom = 251
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Label.cs b/mcs/class/System.Windows.Forms/WINELib/Label.cs
new file mode 100644
index 00000000000..3784481e9ae
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Label.cs
@@ -0,0 +1,410 @@
+ //
+ // System.Windows.Forms.Label.cs
+ //
+ // Author:
+ // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+ // implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
+ // Dennis Hayes (dennish@raytek.com)
+ // WineLib implementation started by John Sohn (jsohn@columbus.rr.com)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+
+ namespace System.Windows.Forms {
+ using System.ComponentModel;
+ using System.Drawing;
+
+ // <summary>
+ //
+ // </summary>
+
+ public class Label : Control {
+
+ Image backgroundImage;
+ BorderStyle borderStyle;
+ bool autoSize;
+ Image image;
+ ContentAlignment imageAlign;
+ ImeMode defaultImeMode;
+ bool renderTransparent;
+ FlatStyle flatStyle;
+ int preferredHeight;
+ int preferredWidth;
+ bool tabStop;
+ ContentAlignment textAlign;
+ bool useMnemonic;
+
+ //
+ // --- Constructor
+ //
+ public Label () : base ()
+ {
+
+ }
+
+ //
+ // --- Public Properties
+ //
+ public virtual bool AutoSize {
+ get {
+ return autoSize;
+ }
+ set {
+ autoSize = value;
+ }
+ }
+
+ public override Image BackgroundImage {
+ get {
+ return backgroundImage;
+ }
+ set {
+ backgroundImage = value;
+ // FIXME: force redraw
+ }
+ }
+
+ public virtual BorderStyle BorderStyle {
+ get {
+ return borderStyle;
+ }
+ set {
+ borderStyle = value;
+ }
+ }
+
+
+ public FlatStyle FlatStyle {
+ get {
+ return flatStyle;
+ }
+ set {
+ flatStyle = value;
+ }
+ }
+
+ public Image Image {
+ get {
+ return image;
+ }
+ set {
+ image = value;
+ }
+ }
+
+ public ContentAlignment ImageAlign {
+ get {
+ return imageAlign;
+ }
+ set {
+ imageAlign = value;
+ }
+ }
+
+
+ [MonoTODO]
+ public int ImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ImageList ImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public new ImeMode ImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int PreferredHeight {
+ get {
+ return preferredHeight;
+ }
+ }
+
+ public int PreferredWidth {
+ get {
+ return preferredWidth;
+ }
+ }
+
+ public new bool TabStop {
+ get {
+ return tabStop;
+ }
+ set {
+ tabStop = value;
+ }
+ }
+
+ //Compact Framework
+ public virtual ContentAlignment TextAlign {
+ get {
+ return textAlign;
+ }
+ set {
+ textAlign = value;
+ }
+ }
+
+ public bool UseMnemonic {
+ get {
+ return useMnemonic;
+ }
+ set {
+ useMnemonic = value;
+ }
+ }
+
+ //
+ // --- Protected Properties
+ //
+
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = new CreateParams ();
+ window = new ControlNativeWindow (this);
+
+ createParams.Caption = Text;
+ createParams.ClassName = "STATIC";
+ createParams.X = Left;
+ createParams.Y = Top;
+ createParams.Width = Width;
+ createParams.Height = Height;
+ createParams.ClassStyle = 0;
+ createParams.ExStyle = 0;
+ createParams.Param = 0;
+ createParams.Parent = Parent.Handle;
+ createParams.Style = (int) (
+ Win32.WS_CHILD |
+ Win32.WS_VISIBLE | Win32.SS_LEFT );
+ window.CreateHandle (createParams);
+ return createParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ // FIXME: use GetSystemMetrics?
+ throw new NotImplementedException ();
+ }
+ }
+
+ protected virtual bool RenderTransparent {
+ get {
+ return renderTransparent;
+ }
+ set {
+ renderTransparent = value;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return defaultImeMode;
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ public new void Select()
+ {
+ base.Select ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ public event EventHandler AutoSizeChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ public event EventHandler TextAlignChanged; // {
+ // add {
+ // throw new NotImplementedException ();
+ // }
+ // remove {
+ // throw new NotImplementedException ();
+ // }
+ // }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected Rectangle CalcImageRenderBounds (
+ Image image, Rectangle rect, ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ // protected override AccessibleObject CreateAccessibilityInstance()
+ // {
+ // throw new NotImplementedException ();
+ // }
+
+ protected new virtual void Dispose()
+ {
+ //throw new NotImplementedException ();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ //throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void DrawImage (Graphics g, Image img,
+ Rectangle r, ContentAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnAutoSizeChanged (EventArgs e) {
+ if (AutoSizeChanged != null)
+ AutoSizeChanged (this, e);
+
+ }
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+
+ }
+
+ //Compact Framework
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected virtual void OnTextAlignChanged (EventArgs e) {
+ if (TextAlignChanged != null)
+ TextAlignChanged (this, e);
+ }
+
+ //Compact Framework
+ protected override void OnTextChanged (EventArgs e) {
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ protected override bool ProcessMnemonic(char charCode)
+ {
+ return base.ProcessMnemonic (charCode);
+ }
+
+ [MonoTODO]
+ protected new ContentAlignment RtlTranslateAlignment (
+ ContentAlignment alignment)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected new HorizontalAlignment RtlTranslateAlignment (
+ HorizontalAlignment alignment)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected new LeftRightAlignment RtlTranslateAlignment (
+ LeftRightAlignment align)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected new virtual void Select (bool directed, bool forward)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void SetBoundsCore (
+ int x, int y, int width, int height,
+ BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected new void UpdateBounds()
+ {
+ base.UpdateBounds ();
+ }
+
+ protected new void UpdateBounds (int x, int y,
+ int width, int height)
+ {
+ base.UpdateBounds (x, y, width, height);
+ }
+
+
+ protected new void UpdateBounds (int x, int y, int width,
+ int height, int clientWidth,
+ int clientHeight)
+ {
+ base.UpdateBounds (x, y, width, height, clientWidth,
+ clientHeight);
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+ }
+ }
diff --git a/mcs/class/System.Windows.Forms/WINELib/LabelEditEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/LabelEditEventArgs.cs
new file mode 100644
index 00000000000..7d329d98104
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LabelEditEventArgs.cs
@@ -0,0 +1,144 @@
+//
+// System.Windows.Forms.LabelEditEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class LabelEditEventArgs : EventArgs {
+
+ #region Fields
+
+ private int item;
+ private string label = ""; //Gian : Initialized string to empty...
+ private bool canceledit = false;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LabelEditEventArgs (int item)
+ {
+ this.item = item;
+ }
+
+ public LabelEditEventArgs (int item, string label) {
+ this.item = item;
+ this.label = label;
+ }
+
+
+ #region Public Properties
+ public bool CancelEdit
+ {
+ get {
+ return canceledit;
+ }
+ set {
+ canceledit = value;
+ }
+ }
+ public int Item {
+ get {
+ return item;
+ }
+ }
+ public string Label {
+ get {
+ return label;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LabelEditEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// CancelEdit, Item and Label Property
+ /// of the two LabelEditEventArgs.
+ /// </remarks>
+ public static bool operator == (LabelEditEventArgs LabelEditEventArgsA, LabelEditEventArgs LabelEditEventArgsB)
+ {
+ return (LabelEditEventArgsA.CancelEdit == LabelEditEventArgsB.CancelEdit) &&
+ (LabelEditEventArgsA.Item == LabelEditEventArgsB.Item) &&
+ (LabelEditEventArgsA.Label == LabelEditEventArgsB.Label);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LabelEditEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// CancelEdit, Item and Label Property
+ /// of the two LabelEditEventArgs.
+ /// </remarks>
+ public static bool operator != (LabelEditEventArgs LabelEditEventArgsA, LabelEditEventArgs LabelEditEventArgsB)
+ {
+ return (LabelEditEventArgsA.CancelEdit != LabelEditEventArgsB.CancelEdit) ||
+ (LabelEditEventArgsA.Item != LabelEditEventArgsB.Item) ||
+ (LabelEditEventArgsA.Label != LabelEditEventArgsB.Label);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// LabelEditEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LabelEditEventArgs))return false;
+ return (this == (LabelEditEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " LabelEditEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LabelEditEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/LabelEditEventHandler.cs
new file mode 100644
index 00000000000..acf126b983b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LabelEditEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.LabelEditEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void LabelEditEventHandler (
+ object sender,
+ LabelEditEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LayoutEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/LayoutEventArgs.cs
new file mode 100644
index 00000000000..42d225cae10
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LayoutEventArgs.cs
@@ -0,0 +1,130 @@
+//
+// System.Windows.Forms.LayoutEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public sealed class LayoutEventArgs : EventArgs {
+
+ #region Fields
+
+ private Control affectedcontrol;
+ private string affectedproperty;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LayoutEventArgs (Control affectedControl, string affectedProperty)
+ {
+ affectedproperty = affectedProperty;
+ affectedcontrol = affectedControl;
+ }
+
+ #region Public Properties
+
+ public Control AffectedControl {
+ get {
+ return affectedcontrol;
+ }
+ }
+ public string AffectedProperty {
+ get {
+ return affectedproperty;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LayoutEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// AffectedControl and AffectedProperty Property
+ /// of the two LayoutEventArgs.
+ /// </remarks>
+ public static bool operator == (LayoutEventArgs LayoutEventArgsA, LayoutEventArgs LayoutEventArgsB)
+ {
+ return (LayoutEventArgsA.AffectedControl == LayoutEventArgsB.AffectedControl) && (LayoutEventArgsA.AffectedProperty == LayoutEventArgsB.AffectedProperty);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LayoutEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// AffectedControl and AffectedProperty Property
+ /// of the two LayoutEventArgs.
+ /// </remarks>
+ public static bool operator != (LayoutEventArgs LayoutEventArgsA, LayoutEventArgs LayoutEventArgsB)
+ {
+ return (LayoutEventArgsA.AffectedControl != LayoutEventArgsB.AffectedControl) || (LayoutEventArgsA.AffectedProperty != LayoutEventArgsB.AffectedProperty);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// LayoutEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LayoutEventArgs))return false;
+ return (this == (LayoutEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " LayoutEventArgs";
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LayoutEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/LayoutEventHandler.cs
new file mode 100644
index 00000000000..a9dab24f202
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LayoutEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Windows.Forms.LayoutEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void LayoutEventHandler (
+ object sender,
+ LayoutEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LeftRightAlignment.cs b/mcs/class/System.Windows.Forms/WINELib/LeftRightAlignment.cs
new file mode 100644
index 00000000000..2cbb2f15fbe
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LeftRightAlignment.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.LeftRightAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum LeftRightAlignment {
+ Left = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkArea.cs b/mcs/class/System.Windows.Forms/WINELib/LinkArea.cs
new file mode 100644
index 00000000000..dcd8583e2db
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkArea.cs
@@ -0,0 +1,146 @@
+//
+// System.Drawing.LinkArea.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public struct LinkArea {
+
+ private int start;
+ private int length;
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+
+ public LinkArea (int Start, int Length)
+ {
+ start = Start;
+ length = Length;
+ }
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LinkArea objects. The return value is
+ /// based on the equivalence of the Start and Length properties of the two objects.
+ /// </remarks>
+
+ public static bool operator == (LinkArea la_a,
+ LinkArea la_b) {
+
+ return ((la_a.start == la_b.start) &&
+ (la_a.length == la_b.length));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LinkArea objects. The return value is
+ /// based on the equivalence of the Start and Length properties of the two objects.
+ /// </remarks>
+ public static bool operator != (LinkArea la_a,
+ LinkArea la_b) {
+ return ((la_a.start != la_b.start) ||
+ (la_a.length != la_b.length));
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ public bool IsEmpty {
+ get{
+ // Start can be 0, so no way to know if it is empty.
+ // Docs seem to say Start must/should be set before
+ // length, os if length is valid, start must also be ok.
+ return length!=0;
+ }
+ }
+
+ public int Start {
+ get{
+ return start;
+ }
+ set{
+ start = value;
+ }
+ }
+
+ public int Length {
+ get{
+ return length;
+ }
+ set{
+ length = value;
+ }
+ }
+
+
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this LinkArea and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LinkArea))
+ return false;
+
+ return (this == (LinkArea) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return (int)( start ^ length);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the LinkArea as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", start, length );
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkBehavior.cs b/mcs/class/System.Windows.Forms/WINELib/LinkBehavior.cs
new file mode 100644
index 00000000000..0c994a33cb0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkBehavior.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.LinkBehavior.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum LinkBehavior {
+ AlwaysUnderline = 1,
+ HoverUnderline = 2,
+ NeverUnderline = 3,
+ SystemDefault = 0,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkClickedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/LinkClickedEventArgs.cs
new file mode 100644
index 00000000000..fee8194c7be
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkClickedEventArgs.cs
@@ -0,0 +1,123 @@
+//
+// System.Windows.Forms.LinkClickedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class LinkClickedEventArgs : EventArgs {
+
+ #region Fields
+
+ private string linktext;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LinkClickedEventArgs(string linkText)
+ {
+ linktext = linkText;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public string LinkText
+ {
+ get {
+ return linktext;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LinkClickedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// LinkText Property
+ /// of the two LinkClickedEventArgs.
+ /// </remarks>
+ public static bool operator == (LinkClickedEventArgs LinkClickedEventArgsA, LinkClickedEventArgs LinkClickedEventArgsB)
+ {
+ return (LinkClickedEventArgsA.LinkText == LinkClickedEventArgsB.LinkText);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LinkClickedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// LinkText Property
+ /// of the two LinkClickedEventArgs.
+ /// </remarks>
+ public static bool operator != (LinkClickedEventArgs LinkClickedEventArgsA, LinkClickedEventArgs LinkClickedEventArgsB)
+ {
+ return (LinkClickedEventArgsA.LinkText != LinkClickedEventArgsB.LinkText);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// LinkClickedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LinkClickedEventArgs))return false;
+ return (this == (LinkClickedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString() + " LinkClickedEventArgs";
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkClickedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/LinkClickedEventHandler.cs
new file mode 100644
index 00000000000..54d6eab5b2e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkClickedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.LinkClickedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void LinkClickedEventHandler (
+ object sender,
+ LinkClickedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkLabel.cs b/mcs/class/System.Windows.Forms/WINELib/LinkLabel.cs
new file mode 100644
index 00000000000..186e37bab61
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkLabel.cs
@@ -0,0 +1,601 @@
+//
+// System.Windows.Forms.LinkLabel.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// stub ammended by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class LinkLabel : Label, IButtonControl {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public LinkLabel()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Color ActiveLinkcolor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color DisabledLinkColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public LinkArea LinkArea {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public LinkBehavior LinkBehavior {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color LinkColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public LinkLabel.LinkCollection Links {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool LinkVisited {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color VisitedLinkColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ //public IAsyncResult BeginInvoke(Delegate del)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public IAsyncResult BeginInvoke(Delegate del, object[] objs)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Dispose()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ //public void Invalidate()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(Rectangle rect)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(Region reg)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public object Invoke(Delegate del)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public object Invoke(Delegate del, object[] objs)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void PerformLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void PerformLayout(Control ctl, string str)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void ResumeLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void ResumeLayout(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Scale(float val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Scale(float val1, float val2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public override void Select()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public override void Select(bool directed, bool forward)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void SetBounds(int b1, int b2, int b3, int b4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void SetBounds(int b1, int b2, int b3, int b4, int b5, int b6)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ // --- IButtonControl members:
+ DialogResult IButtonControl.DialogResult {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ void IButtonControl.NotifyDefault(bool value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IButtonControl.PerformClick()
+ {
+ throw new NotImplementedException ();
+ }
+ // --- end of IButtonControl members
+
+
+ // --- Public Events
+ //
+ [MonoTODO]
+ public event LinkLabelLinkClickedEventHandler LinkClicked;
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override AccessibleObject CreateAccessibilityInstance()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //protected override virtual void Dispose(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+
+ [MonoTODO]
+ protected override void OnEnabledChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnFontChanged( EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnGotFocus( EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnLostFocus (EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ // I think that this should be 'MouseEventArgs'
+ // but the documentation says EventArgs.
+ [MonoTODO]
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnPaintBackground(PaintEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnTextAlignChanged( EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnTextChanged( EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+ //protected ContentAlignment RtlTranslateAlignment(ContentAlignment align)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //protected HorizontalAlignment RtlTranslateAlignment( HorizontalAlignment align)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //protected LeftRightAlignment RtlTranslateAlignment( LeftRightAlignment align)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ protected override void Select(bool val1, bool val2)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(
+ int x,
+ int y,
+ int width,
+ int height,
+ BoundsSpecified specified) {
+
+ throw new NotImplementedException ();
+ }
+ //protected void UpdateBounds()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //protected void UpdateBounds(int val1, int val2, int val3, int val4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //protected void UpdateBounds(int val1, int val2, int val3, int val4, int val5, int val6)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ protected override void WndProc(ref Message msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+
+
+ /// System.Windows.Forms.LinkLabel.Link
+ /// <summary>Represents a link within a LinkLabel control.</summary>
+ ///
+ /// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+ [MonoTODO]
+ public class Link {
+ bool enabled;
+ int length;
+ object linkData;
+ int start;
+ bool visited;
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled=value; }
+ }
+
+ public int Length {
+ get { return length; }
+ set { length=value; }
+ }
+
+ public object LinkData {
+ get { return linkData; }
+ set { linkData=value; }
+ }
+
+ public int Start {
+ get { return start; }
+ set { start=value; }
+ }
+
+ public bool Visited {
+ get { return visited; }
+ set { visited=value; }
+ }
+ }
+
+//
+// System.Windows.Forms.LinkLabel.LinkCollection.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+//
+// (C) 2002 Ximian, Inc
+//
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class LinkCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public LinkCollection(LinkLabel owner)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual LinkLabel.Link this[ int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public Link Add(int val1, int val2)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public Link Add(int val1, int val2, object o)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+ // Inherited
+ //public override bool Contains(LinkLabel.Link link)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(LinkLabel.Link link)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Remove(LinkLabel.Link value)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- LinkLabel.IList properties ---
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ object IList.this[int index] {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ [MonoTODO] set { throw new NotImplementedException (); }
+ }
+
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ void ICollection.CopyTo(Array dest,int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// --- LinkLabel.IList methods ---
+ [MonoTODO]
+ int IList.Add(object control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains(object control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf(object control)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index,object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove(object control)
+ {
+ throw new NotImplementedException ();
+ }
+ }//End of subclass
+ }// End of Class
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventArgs.cs
new file mode 100644
index 00000000000..7bbd6baa75f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventArgs.cs
@@ -0,0 +1,124 @@
+//
+// System.Windows.Forms.LinkLabelLinkClickedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Just a template...
+ // </summary>
+
+ public class LinkLabelLinkClickedEventArgs : EventArgs {
+
+ #region Fields
+
+ private LinkLabel.Link link;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public LinkLabelLinkClickedEventArgs(LinkLabel.Link link)
+ {
+ this.link = link;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public LinkLabel.Link Link{
+ get {
+ return link;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LinkLabelLinkClickedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Link Property
+ /// of the two LinkLabelLinkClickedEventArgs.
+ /// </remarks>
+ public static bool operator == (LinkLabelLinkClickedEventArgs LinkLabelLinkClickedEventArgsA, LinkLabelLinkClickedEventArgs LinkLabelLinkClickedEventArgsB)
+ {
+ return (LinkLabelLinkClickedEventArgsA.Link == LinkLabelLinkClickedEventArgsB.Link);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two LinkLabelLinkClickedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Link Property
+ /// of the two LinkLabelLinkClickedEventArgs.
+ /// </remarks>
+ public static bool operator != (LinkLabelLinkClickedEventArgs LinkLabelLinkClickedEventArgsA, LinkLabelLinkClickedEventArgs LinkLabelLinkClickedEventArgsB)
+ {
+ return (LinkLabelLinkClickedEventArgsA.Link != LinkLabelLinkClickedEventArgsB.Link);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// LinkLabelLinkClickedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is LinkLabelLinkClickedEventArgs))return false;
+ return (this == (LinkLabelLinkClickedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventHandler.cs
new file mode 100644
index 00000000000..09ce8ddb225
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/LinkLabelLinkClickedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.LinkLabelLinkClickEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ //[Serializable]
+ public delegate void LinkLabelLinkClickedEventHandler (
+ object sender,
+ LinkLabelLinkClickedEventArgs e
+ );
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ListViewAlignment.cs b/mcs/class/System.Windows.Forms/WINELib/ListViewAlignment.cs
new file mode 100644
index 00000000000..13a609ce8be
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ListViewAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ListViewAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ListViewAlignment {
+ Default = 0,
+ Left = 1,
+ SnapToGrid = 5,
+ Top = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MainMenu.cs b/mcs/class/System.Windows.Forms/WINELib/MainMenu.cs
new file mode 100644
index 00000000000..b8e117abbc8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MainMenu.cs
@@ -0,0 +1,243 @@
+//
+// System.Windows.Forms.MainMenu.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using System.Runtime.Remoting;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// ToDo note:
+ /// - Nothing is implemented
+ /// </summary>
+
+ public class MainMenu : Menu {
+
+ //
+ // --- Constructors
+ //
+
+ [MonoTODO]
+ public MainMenu()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public MainMenu(MenuItem[] items)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Methods
+ //
+
+ [MonoTODO]
+ public virtual MainMenu CloneMenu()
+ {
+ throw new NotImplementedException();
+ }
+// [MonoTODO]
+// //FIXME
+// protected void MainMenu(Menu m)
+// {
+// throw new NotImplementedException();
+// }
+
+ [MonoTODO]
+ public override ObjRef CreateObjRef(Type requestedType)
+ {
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public override bool Equals(object o) {
+ throw new NotImplementedException();
+ }
+
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+ //inherited
+ //public override void Dispose()
+ //{
+ // throw new NotImplementedException();
+ //}
+ //
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException();
+ //}
+ //public override bool Equals(object o, object o)
+ //{
+ // throw new NotImplementedException();
+ //}
+ //public ContextMenu GetContextMenu()
+ //{
+ // throw new NotImplementedException();
+ //}
+ //public object GetLifetimeService()
+ //{
+ // throw new NotImplementedException();
+ //}
+ //public MainMenu GetMainMenu() {
+ // throw new NotImplementedException();
+ //}
+ //
+ //public override Type GetType() {
+ // throw new NotImplementedException();
+ //}
+ //
+ //public virtual object InitializeLifetimeService() {
+ // throw new NotImplementedException();
+ //}
+ //
+ //public virtual void MergeMenu(Menu menuSrc) {
+ // throw new NotImplementedException();
+ //}
+
+ [MonoTODO]
+ public Form GetForm()
+ {
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException();
+ }
+
+ //
+ // -- Protected Methods
+ //
+
+ //protected void CloneMenu(Menu menuSrc)
+ //{
+ // throw new NotImplementedException();
+ //}
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException();
+ //}
+ //public void Dispose()
+ //{
+ // throw new NotImplementedException();
+ //}
+ //protected object MemberwiseClone()
+ //{
+ // throw new NotImplementedException();
+ //}
+
+ [MonoTODO]
+ protected virtual object GetService()
+ {
+ throw new NotImplementedException();
+ }
+
+ //
+ // -- DeConstructor
+ //
+
+ [MonoTODO]
+ ~MainMenu()
+ {
+ throw new NotImplementedException();
+ }
+
+ //
+ // -- Public Events
+ //
+ //inherited
+ //public event EventHandler Disposed;
+
+ //
+ // -- Public Properties
+ //
+ //inherited
+ //public IContainer Container {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //public IntPtr Handle {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //public MenuItem MdiListItem {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //public Menu.MenuItemCollection MenuItems {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //public override ISite Site {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ // set
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+
+ [MonoTODO]
+ public override bool IsParent {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public virtual RightToLeft RightToLeft {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ //
+ // -- protected Properties
+ //
+ //inherited
+ //protected bool DesignMode {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //protected EventHandler Events {
+ // get
+ // {
+ // throw new NotImplementedException();
+ // }
+ //}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MdiLayout.cs b/mcs/class/System.Windows.Forms/WINELib/MdiLayout.cs
new file mode 100644
index 00000000000..628de363de7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MdiLayout.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.MdiLayout.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MdiLayout {
+ ArrangeIcons = 3,
+ Cascade = 0,
+ TileHorizontal = 1,
+ TileVertical = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MeasureItemEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/MeasureItemEventArgs.cs
new file mode 100644
index 00000000000..1f14b6623f4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MeasureItemEventArgs.cs
@@ -0,0 +1,180 @@
+//
+// System.Windows.Forms.MeasureItemEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// </summary>
+
+ public class MeasureItemEventArgs : EventArgs {
+
+ #region Fields
+
+ private Graphics graphics;
+ private int index;
+ private int itemheight = -1;
+ private int itemwidth = -1;
+
+ #endregion
+
+ //
+ // --- Constructors
+ //
+ public MeasureItemEventArgs(Graphics graphics, int index)
+ {
+ this.index = index;
+ this.graphics = graphics;
+ }
+
+ public MeasureItemEventArgs(Graphics graphics, int index, int itemheight)
+ {
+ this.index = index;
+ this.graphics = graphics;
+ itemheight = ItemHeight;
+ }
+
+ #region Public Properties
+
+ public Graphics Graphics
+ {
+ get
+ {
+ return graphics;
+ }
+ }
+
+ public int Index
+ {
+ get
+ {
+ return index;
+ }
+ }
+
+ public int ItemHeight
+ {
+ get
+ {
+ return itemheight;
+ }
+ set
+ {
+ itemheight = value;
+ }
+ }
+
+ public int ItemWidth
+ {
+ get
+ {
+ return itemwidth;
+ }
+ set
+ {
+ itemwidth = value;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two MeasureItemEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// graphics, index, itemheight and itemwidth Property
+ /// of the two MeasureItemEventArgs.
+ /// </remarks>
+ public static bool operator == (MeasureItemEventArgs MeasureItemEventArgsA, MeasureItemEventArgs MeasureItemEventArgsB)
+ {
+ return (MeasureItemEventArgsA.Graphics == MeasureItemEventArgsB.Graphics) &&
+ (MeasureItemEventArgsA.Index == MeasureItemEventArgsB.Index) &&
+ (MeasureItemEventArgsA.ItemHeight == MeasureItemEventArgsB.ItemHeight) &&
+ (MeasureItemEventArgsA.ItemWidth == MeasureItemEventArgsB.ItemWidth);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two MeasureItemEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// graphics, index, itemheight and itemwidth Property
+ /// of the two MeasureItemEventArgs.
+ /// </remarks>
+ public static bool operator != (MeasureItemEventArgs MeasureItemEventArgsA, MeasureItemEventArgs MeasureItemEventArgsB)
+ {
+ return (MeasureItemEventArgsA.Graphics != MeasureItemEventArgsB.Graphics) ||
+ (MeasureItemEventArgsA.Index != MeasureItemEventArgsB.Index) ||
+ (MeasureItemEventArgsA.ItemHeight != MeasureItemEventArgsB.ItemHeight) ||
+ (MeasureItemEventArgsA.ItemWidth != MeasureItemEventArgsB.ItemWidth);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// PropertyTabChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is MeasureItemEventArgs))return false;
+ return (this == (MeasureItemEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/MeasureItemEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/MeasureItemEventHandler.cs
new file mode 100644
index 00000000000..b0dcb098028
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MeasureItemEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.MeasureItemEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the MeasureItem event of the
+ /// ListBox, ComboBox, CheckedListBox, or MenuItem controls.
+ /// </summary>
+ //[Serializable]
+ public delegate void MeasureItemEventHandler(object sender, MeasureItemEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Menu.cs b/mcs/class/System.Windows.Forms/WINELib/Menu.cs
new file mode 100644
index 00000000000..33bf9313e5c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Menu.cs
@@ -0,0 +1,394 @@
+//
+// System.Windows.Forms.Menu.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+using System.Collections;
+using System.Runtime.Remoting;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// ToDo note:
+ /// - Nothing is implemented
+ /// </summary>
+ using System.ComponentModel;
+ public abstract class Menu : Component {
+
+ //
+ // -- Public Methods
+ //
+ //inherited
+ //public virtual ObjRef CreateObjRef(Type t) {
+ // throw new NotImplementedException();
+ //}
+ //
+ //public void Dispose() {
+ // throw new NotImplementedException();
+ //}
+ //
+ //protected virtual void Dispose(bool disposing) {
+ // throw new NotImplementedException();
+ //}
+
+ public override bool Equals(object o) {
+ throw new NotImplementedException();
+ }
+
+ //public static bool Equals(object o1, object o2) {
+ // throw new NotImplementedException();
+ //}
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ public ContextMenu GetContextMenu() {
+ throw new NotImplementedException();
+ }
+
+ public MainMenu GetMainMenu() {
+ throw new NotImplementedException();
+ }
+
+ //inherited
+ //public object GetLifetimeService() {
+ // throw new NotImplementedException();
+ //}
+ //public Type GetType() {
+ // throw new NotImplementedException();
+ //}
+ //public virtual object InitializeLifetimeService() {
+ // throw new NotImplementedException();
+ //}
+
+ public virtual void MergeMenu(Menu menuSrc) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString() {
+ throw new NotImplementedException();
+ }
+
+ //
+ // -- Protected Methods
+ //
+
+ protected void CloneMenu(Menu menuSrc) {
+ throw new NotImplementedException();
+ }
+
+
+ ~Menu() {
+ throw new NotImplementedException();
+ }
+
+ //protected virtual object GetService(Type service) {
+ // throw new NotImplementedException();
+ //}
+ //
+ //protected object MemberwiseClone() {
+ // throw new NotImplementedException();
+ //}
+
+ //
+ // -- Public Events
+ //
+
+ //inherited
+ //public event EventHandler Disposed;
+
+ //
+ // -- Public Properties
+ //
+
+ //inherited
+ //public IContainer Container {
+ // get {
+ // throw new NotImplementedException();
+ // }
+ //}
+
+ public IntPtr Handle {
+
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public virtual bool IsParent {
+
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public MenuItem MdiListItem {
+
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public Menu.MenuItemCollection MenuItems {
+
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ //inherited
+ //public virtual ISite Site {
+ // get {
+ // throw new NotImplementedException();
+ // }
+ // set {
+ // throw new NotImplementedException();
+ // }
+ //}
+
+ //
+ // -- Protected Properties
+ //
+
+ //inherited
+ //protected bool DesignMode {
+ // get {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //protected EventHandlerList Events {
+ // get {
+ // throw new NotImplementedException();
+ // }
+ //}
+ //
+ // System.Windows.Forms.Menu.MenuItemCollection.cs
+ //
+ // Author:
+ // stubbed out by Paul Osman (paul.osman@sympatico.ca)
+ //
+ // (C) 2002 Ximian, Inc
+ //
+ /// <summary>
+ /// ToDo note:
+ /// - Nothing is implemented
+ /// </summary>
+
+ public class MenuItemCollection : IList, ICollection, IEnumerable {
+
+ //
+ // -- Constructor
+ //
+
+ public MenuItemCollection(Menu m) {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // -- Public Methods
+ //
+
+ public virtual int Add(MenuItem m) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual MenuItem Add(string s) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual int Add(int i, MenuItem m) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual MenuItem Add(string s, EventHandler e) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual MenuItem Add(string s, MenuItem[] items) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void AddRange(MenuItem[] items) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void Clear() {
+ throw new NotImplementedException ();
+ }
+
+ public bool Contains(MenuItem m) {
+ throw new NotImplementedException ();
+ }
+
+ public void CopyTo(Array a, int i) {
+ throw new NotImplementedException ();
+ }
+
+ public override bool Equals(object o) {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //public static bool Equals(object o1, object o2) {
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ } public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ //public override Type GetType() {
+ // throw new NotImplementedException ();
+ //}
+
+ public int IndexOf(MenuItem m) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void Remove(MenuItem m) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void RemoveAt(int i) {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // -- Protected Methods
+ //
+
+ ~MenuItemCollection() {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //protected object MemberwiseClone() {
+ // throw new NotImplementedException ();
+ //}
+
+ //
+ // -- Public Properties
+ //
+
+ public int Count {
+
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // public virtual MenuItem this(int i)
+ // {
+ // get
+ // {
+ // throw new NotImplementedException ();
+ // }
+ // }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/MenuItem.cs b/mcs/class/System.Windows.Forms/WINELib/MenuItem.cs
new file mode 100644
index 00000000000..c3dbc1b89a5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MenuItem.cs
@@ -0,0 +1,7 @@
+
+namespace System.Windows.Forms {
+
+ class MenuItem {
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Message.cs b/mcs/class/System.Windows.Forms/WINELib/Message.cs
new file mode 100644
index 00000000000..b0515a5d904
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Message.cs
@@ -0,0 +1,172 @@
+//
+// System.Drawing.Message.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+//TODO uncomment and implment GetLParam.
+using System;
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public struct Message {
+
+ private int msg;
+ private IntPtr hwnd;
+ private IntPtr lparam;
+ private IntPtr wparam;
+ private IntPtr result;
+
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Message objects. The return value is
+ /// based on the equivalence of the Msg, HWnd, LParam,
+ /// WParam, and Result properties of the two objects.
+ /// </remarks>
+
+ public static bool operator == (Message msg_a,
+ Message msg_b) {
+
+ return ((msg_a.msg == msg_b.msg) &&
+ (msg_a.hwnd == msg_b.hwnd) &&
+ (msg_a.lparam == msg_b.lparam) &&
+ (msg_a.wparam == msg_b.wparam) &&
+ (msg_a.result == msg_b.result));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Message objects. The return value is
+ /// based on the equivalence of the Msg, HWnd, LParam,
+ /// WParam, and Result properties of the two objects.
+ /// </remarks>
+
+ public static bool operator != (Message msg_a,
+ Message msg_b) {
+ return ((msg_a.msg != msg_b.msg) ||
+ (msg_a.hwnd != msg_b.hwnd) ||
+ (msg_a.lparam != msg_b.lparam) ||
+ (msg_a.wparam != msg_b.wparam) ||
+ (msg_a.result != msg_b.result));
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ public int Msg {
+ get{
+ return msg;
+ }
+ set{
+ msg = value;
+ }
+ }
+
+ public IntPtr HWnd {
+ get{
+ return hwnd;
+ }
+ set{
+ hwnd = value;
+ }
+ }
+
+ public IntPtr LParam {
+ get{
+ return lparam;
+ }
+ set{
+ lparam = value;
+ }
+ }
+
+ public IntPtr WParam {
+ get{
+ return wparam;
+ }
+ set{
+ wparam = value;
+ }
+ }
+
+ public IntPtr Result {
+ get{
+ return result;
+ }
+ set{
+ result = value;
+ }
+ }
+
+ public static Message create(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam)
+ {
+ Message NewMessage = new Message();
+ NewMessage.msg = msg;
+ NewMessage.wparam = wparam;
+ NewMessage.lparam = lparam;
+ NewMessage.hwnd = hWnd;
+ return NewMessage;
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Message and another object.
+ /// </remarks>
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is Message))
+ return false;
+
+ return (this == (Message) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode();// (int)( msg ^ lparam ^ wparam ^ result ^ whnd);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Message as a string.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3},{4}]", msg.ToString(), lparam.ToString(), wparam.ToString(), result.ToString(), hwnd.ToString());
+ }
+
+// public object GetLParam(Type cls){
+// // throw new NotImplementedException ();
+// //return (object) lparam;
+// }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MessageBox.cs b/mcs/class/System.Windows.Forms/WINELib/MessageBox.cs
new file mode 100644
index 00000000000..4a82e01429c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MessageBox.cs
@@ -0,0 +1,179 @@
+//
+// System.Windows.Forms.MessageBox.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+//using System.Windows.Forms.AccessibleObject.IAccessible;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Most items complete
+ /// </summary>
+ public class MessageBox {
+
+ //
+ // -- Public Methods
+ //
+
+ //Compact Framework
+ [MonoTODO]
+ public override bool Equals(object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //Compact Framework
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ //FIXME add our proprities
+ return base.GetHashCode();
+ }
+
+ //Compact Framework
+ //public Type GetType() {
+ // throw new NotImplementedException ();
+ //}
+
+ //Compact Framework
+ public static DialogResult Show(string text)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, "",
+ Win32.MB_OK);
+ }
+
+ public static DialogResult Show (IWin32Window w, string text)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, "",
+ Win32.MB_OK);
+ }
+
+ //Compact Framework
+ public static DialogResult Show (string text, string caption)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ Win32.MB_OK);
+ }
+
+ public static DialogResult Show (IWin32Window w, string text,
+ string caption)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ Win32.MB_OK);
+ }
+
+ public static DialogResult Show (string text, string caption,
+ MessageBoxButtons mb)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) mb);
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text,
+ string caption, MessageBoxButtons mb)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) mb);
+ }
+
+ public static DialogResult Show (
+ string text, string caption, MessageBoxButtons mb,
+ MessageBoxIcon mi)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) (mb | mi) );
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) (mb | mi) );
+ }
+
+ //Compact Framework
+ public static DialogResult Show (
+ string text, string caption, MessageBoxButtons mb,
+ MessageBoxIcon mi, MessageBoxDefaultButton md)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) (mb | mi | md) );
+
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi,
+ MessageBoxDefaultButton md)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) (mb | mi | md) );
+ }
+
+ public static DialogResult
+ Show (string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi,
+ MessageBoxDefaultButton md, MessageBoxOptions mo)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA ((IntPtr) 0, text, caption,
+ (uint) (mb | mi | md | mo) );
+ }
+
+ public static DialogResult Show (
+ IWin32Window w, string text, string caption,
+ MessageBoxButtons mb, MessageBoxIcon mi,
+ MessageBoxDefaultButton md, MessageBoxOptions mo)
+ {
+ return (DialogResult)
+ Win32.MessageBoxA (w.Handle, text, caption,
+ (uint) (mb | mi | md | mo) );
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ public override string ToString () {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ ~MessageBox () {
+ throw new NotImplementedException ();
+ }
+
+ //Compact Framework
+ [MonoTODO]
+ protected object MemberWiseClone () {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MessageBoxButtons.cs b/mcs/class/System.Windows.Forms/WINELib/MessageBoxButtons.cs
new file mode 100644
index 00000000000..cc0fa0dfaaf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MessageBoxButtons.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.MessageBoxButtons.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+public enum MessageBoxButtons {
+ AbortRetryIgnore = 2,
+ OK = 0,
+ OKCancel = 1,
+ RetryCancel = 5,
+ YesNo = 4,
+ YesNoCancel = 3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MessageBoxDefaultButton.cs b/mcs/class/System.Windows.Forms/WINELib/MessageBoxDefaultButton.cs
new file mode 100644
index 00000000000..cb3357d39fc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MessageBoxDefaultButton.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.MessageBoxDefaultButton.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxDefaultButton {
+ Button1 = 0,
+ Button2 = 256,
+ Button3 = 512
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MessageBoxIcon.cs b/mcs/class/System.Windows.Forms/WINELib/MessageBoxIcon.cs
new file mode 100644
index 00000000000..43f05fc767a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MessageBoxIcon.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.MessageBoxIcon.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxIcon {
+ Asterisk = 64,
+ Error = 16,
+ Exclamation = 48,
+ Hand = 16,
+ Information = 64,
+ None = 0,
+ Question = 32,
+ Stop = 16,
+ Warning = 48
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MessageBoxOptions.cs b/mcs/class/System.Windows.Forms/WINELib/MessageBoxOptions.cs
new file mode 100644
index 00000000000..57a638335d2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MessageBoxOptions.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.MessageBoxOptions.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxOptions {
+ DefaultDesktopOnly = 131072,
+ RightAlign = 524288,
+ RtlReading = 1048576,
+ ServiceNotification = 2097152
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MouseButtons.cs b/mcs/class/System.Windows.Forms/WINELib/MouseButtons.cs
new file mode 100644
index 00000000000..0e2a1628b69
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MouseButtons.cs
@@ -0,0 +1,23 @@
+//
+// System.Windows.Forms.MouseButtons.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MouseButtons {
+ Left = 1048576,
+ Middle = 4194304,
+ None = 0,
+ Right = 2097152,
+ XButton1 = 8388608,
+ XButton2 = 16777216
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MouseEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/MouseEventArgs.cs
new file mode 100644
index 00000000000..ff2ca4a3137
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MouseEventArgs.cs
@@ -0,0 +1,168 @@
+//
+// System.Windows.Forms.MouseEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class MouseEventArgs : EventArgs {
+
+ #region Fields
+
+ private MouseButtons button;
+ private int clicks;
+ private int x;
+ private int y;
+ private int delta;
+
+ #endregion
+
+ public MouseEventArgs(MouseButtons button, int clicks, int x, int y, int delta)
+ {
+ this.button = button;
+ this.clicks = clicks;
+ this.x = x;
+ this.y = y;
+ this.delta = delta;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public MouseButtons Button
+ {
+ get {
+ return button;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Clicks {
+ get {
+ return clicks;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Delta {
+ get {
+ return delta;
+ }
+ }
+
+ [ComVisible(true)]
+ public int X {
+ get {
+ return x;
+ }
+ }
+
+ [ComVisible(true)]
+ public int Y {
+ get {
+ return y;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two MouseEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// X, Y, Clicks, Delta and Button Property
+ /// of the two MouseEventArgs.
+ /// </remarks>
+ public static bool operator == (MouseEventArgs MouseEventArgsA, MouseEventArgs MouseEventArgsB)
+ {
+ return (MouseEventArgsA.X == MouseEventArgsB.X) &&
+ (MouseEventArgsA.Y == MouseEventArgsB.Y) &&
+ (MouseEventArgsA.Clicks == MouseEventArgsB.Clicks) &&
+ (MouseEventArgsA.Delta == MouseEventArgsB.Delta) &&
+ (MouseEventArgsA.Button == MouseEventArgsB.Button);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two MouseEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// X, Y, Clicks, Delta and Button Property
+ /// of the two MouseEventArgs.
+ /// </remarks>
+ public static bool operator != (MouseEventArgs MouseEventArgsA, MouseEventArgs MouseEventArgsB)
+ {
+ return (MouseEventArgsA.X != MouseEventArgsB.X) ||
+ (MouseEventArgsA.Y != MouseEventArgsB.Y) ||
+ (MouseEventArgsA.Clicks != MouseEventArgsB.Clicks) ||
+ (MouseEventArgsA.Delta != MouseEventArgsB.Delta) ||
+ (MouseEventArgsA.Button != MouseEventArgsB.Button);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// MouseEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is MouseEventArgs))return false;
+ return (this == (MouseEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/MouseEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/MouseEventHandler.cs
new file mode 100644
index 00000000000..64d95720fde
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/MouseEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.MouseEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the MouseDown, MouseUp, or MouseMove
+ /// event of a form, control, or other component.
+ /// </summary>
+ //[Serializable]
+ public delegate void MouseEventHandler(object sender, MouseEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/NativeWindow.cs b/mcs/class/System.Windows.Forms/WINELib/NativeWindow.cs
new file mode 100644
index 00000000000..d089e15b511
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/NativeWindow.cs
@@ -0,0 +1,231 @@
+//
+// System.Windows.Forms.NativeWindow.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@Raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.Remoting;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Implementation started.
+ //
+ // </summary>
+
+ public class NativeWindow : MarshalByRefObject {
+
+ // the window's HWND
+ private IntPtr windowHandle;
+ static private Hashtable windowCollection = new Hashtable ();
+ static bool registeredClass = false;
+
+ //
+ // --- Constructor
+ //
+ public NativeWindow ()
+ {
+ windowHandle = (IntPtr) 0;
+ }
+
+ //
+ // --- Public Properties
+ //
+ public IntPtr Handle
+ {
+ get {
+ return windowHandle;
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ public void AssignHandle (IntPtr handle)
+ {
+ if (windowHandle != (IntPtr) 0)
+ windowCollection.Remove (windowHandle);
+
+ windowHandle = handle;
+ windowCollection.Add (windowHandle, this);
+ OnHandleChange ();
+ }
+
+ public virtual void CreateHandle (CreateParams cp)
+ {
+ IntPtr createdHWnd = (IntPtr) 0;
+ Object lpParam = new Object();
+
+ if (!registeredClass) {
+ Win32.WndProc wp = new Win32.WndProc (WndProc);
+ if (Win32.MonoRegisterClass(
+ (int) (Win32.CS_OWNDC |
+ Win32.CS_VREDRAW |
+ Win32.CS_HREDRAW),
+ wp, 0, 0, (IntPtr) 0, (IntPtr) 0,
+ (IntPtr) 0, (IntPtr) 6, "",
+ "mono_native_window") != 0) {
+ registeredClass = true;
+ } else {
+ windowHandle = (IntPtr) 0;
+ return;
+ }
+ }
+
+ windowHandle = Win32.CreateWindowExA (
+ (uint) cp.ExStyle, cp.ClassName,
+ cp.Caption,(uint) cp.Style,
+ cp.X, cp.Y, cp.Width, cp.Height,
+ (IntPtr) cp.Parent, (IntPtr) 0,
+ (IntPtr) 0, ref lpParam);
+
+ if (windowHandle != (IntPtr) 0)
+ windowCollection.Add (windowHandle, this);
+ }
+
+ [MonoTODO]
+ public override ObjRef CreateObjRef (Type requestedType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void DefWndProc (ref Message m)
+ {
+ m.Result = Win32.DefWindowProcA (m.HWnd, m.Msg,
+ m.WParam, m.LParam);
+ }
+
+ public virtual void DestroyHandle ()
+ {
+ windowCollection.Remove (windowHandle);
+ Win32.DestroyWindow (windowHandle);
+ }
+
+ [MonoTODO]
+ public override bool Equals (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME add our proprities
+ return base.GetHashCode ();
+ }
+
+ public static NativeWindow FromHandle (IntPtr handle)
+ {
+ NativeWindow window = new NativeWindow ();
+ window.AssignHandle (handle);
+ return window;
+ }
+
+ //inherited
+ //public object GetLifetimeService() {
+ // throw new NotImplementedException ();
+ //}
+
+ //public Type GetType() {
+ // throw new NotImplementedException ();
+ //}
+
+ //public virtual object InitializeLifetimeService(){
+ // throw new NotImplementedException ();
+ //}
+
+ public virtual void ReleaseHandle ()
+ {
+ windowHandle = (IntPtr) 0;
+ OnHandleChange ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Protected Methods
+ //
+ //inherited
+ //protected object MemberwiseClone() {
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ protected virtual void OnHandleChange ()
+ {
+ // to be overridden
+ }
+
+ [MonoTODO]
+ protected virtual void OnThreadException (Exception e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void WndProc (ref Message m)
+ {
+ if (m.Msg == Win32.WM_CREATE)
+ Console.WriteLine ("NW WndProc WM_CREATE");
+ DefWndProc (ref m);
+ }
+
+ //
+ // --- Destructor
+ //
+ [MonoTODO]
+ ~NativeWindow ()
+ {
+ }
+
+ static private IntPtr WndProc (
+ IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
+ {
+ // windowCollection is a collection of all the
+ // NativeWindow(s) that have been created.
+ // Dispatch the current message to the approriate
+ // window.
+ NativeWindow window =
+ (NativeWindow) windowCollection[hWnd];
+ Message message = new Message ();
+ message.HWnd = hWnd;
+ message.Msg = msg;
+ message.WParam = wParam;
+ message.LParam = lParam;
+ message.Result = (IntPtr) 0;
+
+ if (msg == Win32.WM_CREATE)
+ Console.WriteLine ("WM_CREATE (static)");
+
+ if (window != null) {
+ if (msg == Win32.WM_CREATE)
+ Console.WriteLine ("WM_CREATE (static != null)");
+ window.WndProc(ref message);
+ } else {
+ Console.WriteLine ("no window, defwndproc");
+ // even though we are not managing the
+ // window let the window get the message
+ message.Result = Win32.DefWindowProcA (
+ hWnd, msg, wParam, lParam);
+ }
+
+ return message.Result;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/NativeWindowTest.cs b/mcs/class/System.Windows.Forms/WINELib/NativeWindowTest.cs
new file mode 100644
index 00000000000..f0cd6a7cda3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/NativeWindowTest.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+
+public class NativeWindowTest : NativeWindow {
+
+ protected override void WndProc (ref Message m)
+ {
+ Console.WriteLine ("in NativeWindowTest WndProc");
+
+ m.Result = (IntPtr) 0;
+
+ if (m.Msg == Win32.WM_DESTROY) {
+ Console.WriteLine ("posting quit message");
+ Win32.PostQuitMessage (0);
+ } else
+ DefWndProc (ref m);
+ }
+
+ static public void Main () {
+ Console.WriteLine ("NativeWindow sample application begin");
+
+ Console.WriteLine ("Creating NativeWindow");
+ NativeWindowTest nw = new NativeWindowTest ();
+
+ Console.WriteLine ("Creating CreateParams");
+ CreateParams cp = new CreateParams ();
+
+ Console.WriteLine ("setting up CreateParams");
+
+ cp.Caption = "Mono Native Window Test";
+ cp.ClassName = "mono_native_window";
+ cp.X = 10;
+ cp.Y = 10;
+ cp.Width = 640;
+ cp.Height = 480;
+ cp.ClassStyle = 0;
+ cp.ExStyle = 0;
+ cp.Param = 0;
+ cp.Param = 0;
+ cp.Style = (int) (
+ Win32.WS_OVERLAPPEDWINDOW | Win32.WS_HSCROLL|
+ Win32.WS_VSCROLL);
+
+ Console.WriteLine ("creating handle");
+ nw.CreateHandle (cp);
+
+ Console.WriteLine ("showing window");
+ Win32.ShowWindow (nw.Handle, (int) Win32.SW_SHOW);
+
+ Win32.MSG msg = new Win32.MSG();
+
+ while (Win32.GetMessageA (ref msg, 0, 0, 0) != 0) {
+ Win32.TranslateMessage (ref msg);
+ Win32.DispatchMessageA (ref msg);
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/NavigateEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/NavigateEventArgs.cs
new file mode 100644
index 00000000000..713b8a662dd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/NavigateEventArgs.cs
@@ -0,0 +1,128 @@
+//
+// System.Windows.Forms.NavigateEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class NavigateEventArgs : EventArgs {
+
+ #region Fields
+
+ private bool isforward;
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public NavigateEventArgs(bool isForward)
+ {
+ isforward = isForward;
+ }
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public bool Forward
+ {
+ get {
+ return isforward;
+ }
+ }
+ #endregion
+
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two NavigateEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Forward Property
+ /// of the two NavigateEventArgs.
+ /// </remarks>
+ public static bool operator == (NavigateEventArgs NavigateEventArgsA, NavigateEventArgs NavigateEventArgsB)
+ {
+ return (NavigateEventArgsA.Forward == NavigateEventArgsB.Forward);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two NavigateEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Forward Property
+ /// of the two NavigateEventArgs.
+ /// </remarks>
+ public static bool operator != (NavigateEventArgs NavigateEventArgsA, NavigateEventArgs NavigateEventArgsB)
+ {
+ return (NavigateEventArgsA.Forward != NavigateEventArgsB.Forward);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// PropertyTabChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is NavigateEventArgs))return false;
+ return (this == (NavigateEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/NavigateEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/NavigateEventHandler.cs
new file mode 100644
index 00000000000..eee69bb3d75
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/NavigateEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.NavigateEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the NavigateEventArgs event of a DataGrid.
+ /// </summary>
+ //[Serializable]
+ public delegate void NavigateEventHandler(object sender, NavigateEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventArgs.cs
new file mode 100644
index 00000000000..3e396e3e747
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventArgs.cs
@@ -0,0 +1,144 @@
+//
+// System.Windows.Forms.NodeLabelEditEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class NodeLabelEditEventArgs : EventArgs {
+
+ #region Fields
+
+ private TreeNode node;
+ private string label = "";
+ private bool canceledit = false;
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public NodeLabelEditEventArgs(TreeNode node)
+ {
+ this.node = node;
+ }
+ public NodeLabelEditEventArgs(TreeNode node, string label)
+ {
+ this.node = node;
+ this.label = label;
+ }
+
+ #region Public Properties
+
+ public bool CancelEdit {
+ get {
+ return canceledit;
+ }
+ set {
+ canceledit = value;
+ }
+ }
+ public string Label
+ {
+ get {
+ return label;
+ }
+ }
+ public TreeNode Node {
+ get {
+ return node;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two NodeLabelEditEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// label, Node and CancelEdit Property
+ /// of the two NodeLabelEditEventArgs.
+ /// </remarks>
+ public static bool operator == (NodeLabelEditEventArgs NodeLabelEditEventArgsA, NodeLabelEditEventArgs NodeLabelEditEventArgsB)
+ {
+ return (NodeLabelEditEventArgsA.Label == NodeLabelEditEventArgsB.Label) && (NodeLabelEditEventArgsA.Node == NodeLabelEditEventArgsB.Node) && (NodeLabelEditEventArgsA.CancelEdit == NodeLabelEditEventArgsB.CancelEdit);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two NodeLabelEditEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// label, Node and CancelEdit Property
+ /// of the two NodeLabelEditEventArgs.
+ /// </remarks>
+ public static bool operator != (NodeLabelEditEventArgs NodeLabelEditEventArgsA, NodeLabelEditEventArgs NodeLabelEditEventArgsB)
+ {
+ return (NodeLabelEditEventArgsA.Label != NodeLabelEditEventArgsB.Label) || (NodeLabelEditEventArgsA.Node != NodeLabelEditEventArgsB.Node) || (NodeLabelEditEventArgsA.CancelEdit != NodeLabelEditEventArgsB.CancelEdit);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// PropertyTabChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is NodeLabelEditEventArgs))return false;
+ return (this == (NodeLabelEditEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventHandler.cs
new file mode 100644
index 00000000000..e6f35aa403e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/NodeLabelEditEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.NodeLabelEditEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the BeforeLabelEdit
+ /// and AfterLabelEdit events of a TreeView control.
+ /// </summary>
+ //[Serializable]
+ public delegate void NodeLabelEditEventHandler(object sender, NodeLabelEditEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/PaintEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/PaintEventArgs.cs
new file mode 100644
index 00000000000..773c2abe008
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/PaintEventArgs.cs
@@ -0,0 +1,146 @@
+//
+// System.Windows.Forms.PaintEventArgs.cs
+//
+// Author:
+// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class PaintEventArgs : EventArgs, IDisposable {
+
+ #region Fields
+
+ private Graphics mgraphics;
+ private Rectangle mclipRect;
+
+ #endregion
+
+
+ public PaintEventArgs(Graphics graphics, Rectangle clipRect )
+ {
+ this.mgraphics = graphics;
+ this.mclipRect = clipRect;
+ }
+
+
+ #region Public Properties
+ public Rectangle ClipRectangle
+ {
+ get {
+ return mclipRect;
+ }
+ }
+
+ public Graphics Graphics {
+ get {
+ return mgraphics;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PaintEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Graphics and ClipRectangle Property
+ /// of the two PaintEventArgs.
+ /// </remarks>
+ public static bool operator == (PaintEventArgs PaintEventArgsA, PaintEventArgs PaintEventArgsB)
+ {
+ return (PaintEventArgsA.Graphics == PaintEventArgsB.Graphics) && (PaintEventArgsA.ClipRectangle == PaintEventArgsB.ClipRectangle);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PaintEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Graphics and ClipRectangle Property
+ /// of the two PaintEventArgs.
+ /// </remarks>
+ public static bool operator != (PaintEventArgs PaintEventArgsA, PaintEventArgs PaintEventArgsB)
+ {
+ return (PaintEventArgsA.Graphics != PaintEventArgsB.Graphics) || (PaintEventArgsA.ClipRectangle != PaintEventArgsB.ClipRectangle);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// PaintEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is PaintEventArgs))return false;
+ return (this == (PaintEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+ #region Protected Methods
+
+ [MonoTODO]
+ protected virtual void Dispose(bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/PaintEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/PaintEventHandler.cs
new file mode 100644
index 00000000000..565f768af61
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/PaintEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.PaintEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the Paint event of a Control class.
+ /// </summary>
+ //[Serializable]
+ public delegate void PaintEventHandler(object sender, PaintEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventArgs.cs
new file mode 100644
index 00000000000..36d8395d595
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventArgs.cs
@@ -0,0 +1,139 @@
+//
+// System.Windows.Forms.PropertyTabChangedEventArgs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.Runtime.InteropServices;
+using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the PropertyTabChanged event of a PropertyGrid.
+ ///
+ /// ToDo note:
+ /// - nothing is implemented
+ /// </summary>
+
+ [MonoTODO]
+ [ComVisible(true)]
+ public class PropertyTabChangedEventArgs : EventArgs {
+
+ #region Fields
+
+ private PropertyTab oldtab;
+ private PropertyTab newtab;
+
+ #endregion
+
+ #region Constructor
+ //[ComVisible(true)]
+ public PropertyTabChangedEventArgs(PropertyTab oldTab, PropertyTab newTab){
+
+ this.oldtab = oldTab;
+ this.newtab = newTab;
+
+ }
+ #endregion
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public PropertyTab NewTab {
+ get {
+ return newtab;
+ }
+ }
+
+ [ComVisible(true)]
+ public PropertyTab OldTab {
+ get {
+ return oldtab;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PropertyTabChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// oldtab and newtab Property
+ /// of the two PropertyTabChangedEventArgs.
+ /// </remarks>
+ public static bool operator == (PropertyTabChangedEventArgs PropertyTabChangedEventArgsA, PropertyTabChangedEventArgs PropertyTabChangedEventArgsB)
+ {
+ return (PropertyTabChangedEventArgsA.NewTab == PropertyTabChangedEventArgsB.NewTab) && (PropertyTabChangedEventArgsA.OldTab == PropertyTabChangedEventArgsB.OldTab);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PropertyValueChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// ChangedItem and OldValue Property
+ /// of the two PropertyValueChangedEventArgs.
+ /// </remarks>
+ public static bool operator != (PropertyTabChangedEventArgs PropertyTabChangedEventArgsA, PropertyTabChangedEventArgs PropertyTabChangedEventArgsB)
+ {
+ return (PropertyTabChangedEventArgsA.NewTab != PropertyTabChangedEventArgsB.NewTab) || (PropertyTabChangedEventArgsA.OldTab != PropertyTabChangedEventArgsB.OldTab);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// PropertyTabChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is PropertyTabChangedEventArgs))return false;
+ return (this == (PropertyTabChangedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventHandler.cs
new file mode 100644
index 00000000000..c878d4425b5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/PropertyTabChangedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.PropertyTabChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the PropertyTabChanged event of a PropertyGrid.
+ /// </summary>
+ //[Serializable]
+ public delegate void PropertyTabChangedEventHandler(object s, PropertyTabChangedEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventArgs.cs
new file mode 100644
index 00000000000..a280a71664e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventArgs.cs
@@ -0,0 +1,131 @@
+//
+// System.Windows.Forms.PropertyValueChangedEventArgs
+//
+// Author:
+// stubbed out by Dennis Hayes(dennish@raytek.com)
+// completed by Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Summary description for PropertyValueChangedEventArgs.
+ /// </summary>
+ public class PropertyValueChangedEventArgs : EventArgs {
+
+ #region Fields
+ private GridItem changedItem;
+ private object oldValue;
+ #endregion
+
+ public PropertyValueChangedEventArgs(GridItem changedItem, object oldValue)
+ {
+ this.changedItem = changedItem;
+ this.oldValue = oldValue;
+ }
+
+ #region Public Properties
+
+ // ChangedItem Property
+ public GridItem ChangedItem
+ {
+ get
+ {
+ return changedItem;
+ }
+ }
+
+ // OldValue Property
+ public object OldValue
+ {
+ get
+ {
+ return oldValue;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PropertyValueChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// ChangedItem and OldValue Property
+ /// of the two PropertyValueChangedEventArgs.
+ /// </remarks>
+ public static bool operator == (PropertyValueChangedEventArgs PropertyValueChangedEventArgsA, PropertyValueChangedEventArgs PropertyValueChangedEventArgsB)
+ {
+ return (PropertyValueChangedEventArgsA.ChangedItem == PropertyValueChangedEventArgsB.ChangedItem) && (PropertyValueChangedEventArgsA.OldValue == PropertyValueChangedEventArgsB.OldValue);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PropertyValueChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// ChangedItem and OldValue Property
+ /// of the two PropertyValueChangedEventArgs.
+ /// </remarks>
+ public static bool operator != (PropertyValueChangedEventArgs PropertyValueChangedEventArgsA, PropertyValueChangedEventArgs PropertyValueChangedEventArgsB)
+ {
+ return (PropertyValueChangedEventArgsA.ChangedItem != PropertyValueChangedEventArgsB.ChangedItem) || (PropertyValueChangedEventArgsA.OldValue != PropertyValueChangedEventArgsB.OldValue);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// PropertyValueChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is PropertyValueChangedEventArgs))return false;
+ return (this == (PropertyValueChangedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the PropertyValueChangedEventArgs as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventHandler.cs
new file mode 100644
index 00000000000..1722cea904e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/PropertyValueChangedEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.PropertyValueChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// The event handler class that is invoked when
+ /// a property in the grid is modified by the user.
+ /// </summary>
+ //[Serializable]
+ public delegate void PropertyValueChangedEventHandler(object s, PropertyValueChangedEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventArgs.cs
new file mode 100644
index 00000000000..9a8d13b570c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventArgs.cs
@@ -0,0 +1,156 @@
+//
+// System.Windows.Forms.QueryAccessibilityHelpEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class QueryAccessibilityHelpEventArgs : EventArgs {
+
+ #region Fields
+
+ string helpnamespace;
+ string helpstring;
+ string helpkeyword;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ public QueryAccessibilityHelpEventArgs()
+ {
+ this.helpkeyword = "";
+ this.helpnamespace = "";
+ this.helpstring = "";
+ }
+ public QueryAccessibilityHelpEventArgs(string helpNamespace, string helpString, string helpKeyword) {
+ this.helpkeyword = helpKeyword;
+ this.helpnamespace = helpNamespace;
+ this.helpstring =helpString;
+ }
+
+
+ #region Public Properties
+ [ComVisible(true)]
+ public string HelpKeyword {
+ get {
+ return helpkeyword;
+ }
+ set {
+ helpkeyword = value;
+ }
+ }
+ [ComVisible(true)]
+ public string HelpNamespace {
+ get {
+ return helpnamespace;
+ }
+ set {
+ helpnamespace = value;
+ }
+ }
+ [ComVisible(true)]
+ public string HelpString {
+ get {
+ return helpstring;
+ }
+ set {
+ helpstring = value;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two QueryAccessibilityHelpEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// helpkeyword, helpnamespace and helpstring Property
+ /// of the two QueryAccessibilityHelpEventArgs.
+ /// </remarks>
+ public static bool operator == (QueryAccessibilityHelpEventArgs QueryAccessibilityHelpEventArgsA, QueryAccessibilityHelpEventArgs QueryAccessibilityHelpEventArgsB)
+ {
+ return ((QueryAccessibilityHelpEventArgsA.HelpKeyword == QueryAccessibilityHelpEventArgsB.HelpKeyword) && (QueryAccessibilityHelpEventArgsA.HelpNamespace == QueryAccessibilityHelpEventArgsB.HelpNamespace) && (QueryAccessibilityHelpEventArgsA.HelpString == QueryAccessibilityHelpEventArgsB.HelpString));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two QueryAccessibilityHelpEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// helpkeyword, helpnamespace and helpstring Property
+ /// of the two QueryAccessibilityHelpEventArgs.
+ /// </remarks>
+ public static bool operator != (QueryAccessibilityHelpEventArgs QueryAccessibilityHelpEventArgsA, QueryAccessibilityHelpEventArgs QueryAccessibilityHelpEventArgsB)
+ {
+ return ((QueryAccessibilityHelpEventArgsA.HelpKeyword != QueryAccessibilityHelpEventArgsB.HelpKeyword) || (QueryAccessibilityHelpEventArgsA.HelpNamespace != QueryAccessibilityHelpEventArgsB.HelpNamespace) || (QueryAccessibilityHelpEventArgsA.HelpString != QueryAccessibilityHelpEventArgsB.HelpString));
+ }
+
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// QueryAccessibilityHelpEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is QueryAccessibilityHelpEventArgs))return false;
+ return (this == (QueryAccessibilityHelpEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventHandler.cs
new file mode 100644
index 00000000000..63470391650
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/QueryAccessibilityHelpEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.QueryAccessibilityHelpEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the QueryAccessibilityHelp event of a control.
+ /// </summary>
+ //[Serializable]
+ public delegate void QueryAccessibilityHelpEventHandler(object sender, QueryAccessibilityHelpEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventArgs.cs
new file mode 100644
index 00000000000..46cac1028a1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventArgs.cs
@@ -0,0 +1,142 @@
+//
+// System.Windows.Forms.QueryContinueDragEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // Just a template.
+ // </summary>
+
+ public class QueryContinueDragEventArgs : EventArgs {
+
+ #region Fields
+
+ private int keystate;
+ private bool escapepressed;
+ private DragAction action;
+
+ #endregion
+ //
+ // --- Constructor
+ //
+ //[ComVisible(true)]
+ public QueryContinueDragEventArgs(int keyState, bool escapePressed, DragAction action)
+ {
+ this.keystate = keyState;
+ this.escapepressed = escapePressed;
+ this.action = action;
+ }
+
+ #region Public Properties
+ [ComVisible(true)]
+ public DragAction Action {
+ get {
+ return action;
+ }
+ set {
+ action = value;
+ }
+ }
+ [ComVisible(true)]
+ public bool EscapePressed {
+ get {
+ return escapepressed;
+ }
+ }
+ [ComVisible(true)]
+ public int KeyState {
+ get {
+ return keystate;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two QueryContinueDragEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// keystate, escaperessed and action Property
+ /// of the two QueryContinueDragEventArgs.
+ /// </remarks>
+ public static bool operator == (QueryContinueDragEventArgs QueryContinueDragEventArgsA, QueryContinueDragEventArgs QueryContinueDragEventArgsB)
+ {
+ return ((QueryContinueDragEventArgsA.EscapePressed == QueryContinueDragEventArgsB.EscapePressed) && (QueryContinueDragEventArgsA.KeyState == QueryContinueDragEventArgsB.KeyState) && (QueryContinueDragEventArgsA.Action == QueryContinueDragEventArgsB.Action));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ScrollEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// newvalue and type Property
+ /// of the two ScrollEventArgs.
+ /// </remarks>
+ public static bool operator != (QueryContinueDragEventArgs QueryContinueDragEventArgsA, QueryContinueDragEventArgs QueryContinueDragEventArgsB)
+ {
+ return ((QueryContinueDragEventArgsA.EscapePressed != QueryContinueDragEventArgsB.EscapePressed) || (QueryContinueDragEventArgsA.KeyState != QueryContinueDragEventArgsB.KeyState) || (QueryContinueDragEventArgsA.Action != QueryContinueDragEventArgsB.Action));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// QueryContinueDragEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is QueryContinueDragEventArgs))return false;
+ return (this == (QueryContinueDragEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventHandler.cs
new file mode 100644
index 00000000000..a53272926a1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/QueryContinueDragEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.QueryContinueDragEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the QueryContinueDrag event of a Control.
+ /// </summary>
+ //[Serializable]
+ public delegate void QueryContinueDragEventHandler(object sender, QueryContinueDragEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/README b/mcs/class/System.Windows.Forms/WINELib/README
new file mode 100644
index 00000000000..f73081d5580
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/README
@@ -0,0 +1,51 @@
+Since a WineLib application is a Windows application that is compiled under
+Unix/Linux as a shared library it needs to be started differently than other
+applications. The WineLib application is started as any other Windows
+application running under Wine using the wine command. You cannot simply link
+in libwine (gcc myapp.c -lwine) to use Win32 functions.
+
+In order to use WineLib/Win32 functions under Mono I have created a small
+"stub" application that embeds the Mono engine inside the WineLib application.
+This is basically a replacement for the "mono" command that can be used
+to call the Win32 API (using WineLib) within an application written for Mono.
+
+To get started I suggest installing Wine and Mono first if they are not
+already installed. I am usually using the latest Wine snapshots built from
+source and installed under /usr/local. Also be sure to build/use a version of
+Mono with garbage collection disabled as there is a problem using WineLib with
+garbage collection enabled (check the mono-list archives for this discussion).
+You can disable garbage collection when building mono by adding --with-gc=none
+to the configure command. In the mono directory I build mono as:
+ ./configure --with-gc=none
+
+In the WINELib makefile you may have set these to the appropriate files and/or
+paths on your PC:
+
+X11R6_INCLUDE=/usr/X11R6/include
+WINE_INCLUDE=/usr/local/include/wine
+WINE_LIB=/usr/local/lib/wine
+LIBMONO=/usr/local/lib/libmono.a
+
+If you type make from the mcs/class/System.Windows.Forms/WINELib
+directory it should build:
+
+System.Windows.Forms.dll -
+The current (if largely incomplete) Windows Forms package.
+
+FormTest.exe, NativeWindowTest.exe, Test.exe -
+Test applications which link to and tests the System.Windows.Forms.dll
+
+monostub.exe.so -
+The WineLib application that starts the Mono/WineLib application. This
+small WineLib application embeds the Mono JIT engine allowing any Mono
+application running in it access to WineLib/Win32 function calls.
+
+Before starting any of the applications set the LD_LIBRARY_PATH to the
+current directory (so DllImport can find the monostub.exe.so library):
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
+
+To start any of the applications you type (from the WINELib directory):
+ wine monostub.exe.so mono-winelibapp.exe
+
+John Sohn
+jsohn@columbus.rr.com
diff --git a/mcs/class/System.Windows.Forms/WINELib/RightToLeft.cs b/mcs/class/System.Windows.Forms/WINELib/RightToLeft.cs
new file mode 100644
index 00000000000..bd7b9fb4a12
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/RightToLeft.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.RightToLeft.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum RightToLeft {
+ Inherit = 2,
+ No =0,
+ Yes = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ScrollEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ScrollEventArgs.cs
new file mode 100644
index 00000000000..6ad6169db91
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ScrollEventArgs.cs
@@ -0,0 +1,140 @@
+//
+// System.Windows.Forms.ScrollEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gterzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ // </summary>
+
+ public class ScrollEventArgs : EventArgs {
+
+ #region Fields
+
+ private int newvalue;
+ private ScrollEventType type;
+
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ [MonoTODO]
+ public ScrollEventArgs(ScrollEventType type, int newVal)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ #region Public Properties
+
+ [ComVisible(true)]
+ public int NewValue
+ {
+ get {
+ return newvalue;
+ }
+ set {
+ newvalue = value;
+ }
+ }
+
+ [ComVisible(true)]
+ public ScrollEventType Type {
+ get {
+ return type;
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ScrollEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// newvalue and type Property
+ /// of the two ScrollEventArgs.
+ /// </remarks>
+ public static bool operator == (ScrollEventArgs ScrollEventArgsA, ScrollEventArgs ScrollEventArgsB)
+ {
+ return ((ScrollEventArgsA.NewValue == ScrollEventArgsB.NewValue) && (ScrollEventArgsA.Type == ScrollEventArgsB.Type));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ScrollEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// newvalue and type Property
+ /// of the two ScrollEventArgs.
+ /// </remarks>
+ public static bool operator != (ScrollEventArgs ScrollEventArgsA, ScrollEventArgs ScrollEventArgsB)
+ {
+ return ((ScrollEventArgsA.NewValue != ScrollEventArgsB.NewValue) || (ScrollEventArgsA.Type != ScrollEventArgsB.Type));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// UICuesEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ScrollEventArgs))return false;
+ return (this == (ScrollEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the object as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ScrollEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ScrollEventHandler.cs
new file mode 100644
index 00000000000..2aa9bf6c3de
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ScrollEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ScrollEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that handles the Scroll
+ /// event of a ScrollBar, TrackBar, or DataGrid.
+ /// </summary>
+ //[Serializable]
+ public delegate void ScrollEventHandler(object sender, ScrollEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ScrollEventType.cs b/mcs/class/System.Windows.Forms/WINELib/ScrollEventType.cs
new file mode 100644
index 00000000000..2b9b3f495b3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ScrollEventType.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.ScrollEventType.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ScrollEventType {
+ EndScroll = 8,
+ First = 6,
+ LargeDecrement = 2,
+ LargeIncrement = 3,
+ Last = 7,
+ SmallDecrement = 0,
+ ThumbPosition = 4,
+ SmallIncrement = 1,
+ ThumbTrack = 5
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ScrollableControl.cs b/mcs/class/System.Windows.Forms/WINELib/ScrollableControl.cs
new file mode 100644
index 00000000000..c3640e52a6e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ScrollableControl.cs
@@ -0,0 +1,363 @@
+//
+// System.Windows.Forms.Form
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// ScrollableControl.DockPaddingEdges stub added by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ public class ScrollableControl : Control {
+
+ //
+ // --- Constructor
+ //
+ public ScrollableControl () : base ()
+ {
+ }
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public virtual bool AutoScroll {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Size AutoScrollMargin {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Size AutoScrollMinSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public Point AutoScrollPosition {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override Rectangle DisplayRectangle {
+ get {
+ return base.DisplayRectangle;
+ }
+ }
+
+ [MonoTODO]
+ public ScrollableControl.DockPaddingEdges DockPadding {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override ISite Site {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Public Methods
+ //
+ //public IAsyncResult BeginInvoke(Delegate del)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public IAsyncResult BeginInvoke(Delegate del, object[] objs)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Dispose()
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public override bool Equals (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //public static bool Equals(object o1, object o2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ [MonoTODO]
+ public override int GetHashCode () {
+ //FIXME add our proprities
+ return base.GetHashCode ();
+ }
+
+ //public void Invalidate()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(Rectangle rect)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(Region reg)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(Rectangle rect, bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Invalidate(Region reg, bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public object Invoke(Delegate del)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public object Invoke(Delegate del, object[] objs)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void PerformLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void PerformLayout(Control ctl, string str)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void ResumeLayout()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void ResumeLayout(bool val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Scale(float val)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Scale(float val1, float val2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Select()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void Select(bool val1, bool val2)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void SetBounds(int val1, int val2, int val3, int val4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //public void SetBounds(int val1, int val2, int val3, int val4, BoundsSpecified bounds)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //
+ // --- Protected Properties
+ //
+
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ [MonoTODO]
+ protected bool HScroll {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ protected bool VScroll {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected virtual void AdjustFormScrollbars (
+ bool displayScrollbars)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ protected override void OnLayout (LayoutEventArgs e)
+ {
+ base.OnLayout (e);
+ }
+
+ protected override void OnMouseWheel (MouseEventArgs e)
+ {
+ base.OnMouseWheel (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ //ContentAlignment RtlTranslateAlignment(ContentAlignment calign)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment halign)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment lralign)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ protected override void ScaleCore (float dx, float dy)
+ {
+ base.ScaleCore (dx, dy);
+ }
+
+ //protected void UpdateBounds()
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //protected void UpdateBounds(int val1, int val2, int val3, int val4)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ //protected void UpdateBounds(int val1, int val2, int val3, int val4, int val5, int val6)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ /// ScrollableControl.DockPaddingEdges
+ /// Determines the border padding for docked controls.
+ public class DockPaddingEdges : ICloneable {
+ // --- Fields ---
+ int all;
+ int bottom;
+ int left;
+ int right;
+ int top;
+
+
+ // --- public Properties ---
+ public int All {
+ get { return all; }
+ set { all=value; }
+ }
+
+ public int Bottom {
+ get { return bottom; }
+ set { bottom=value; }
+ }
+
+ public int Left {
+ get { return left; }
+ set { left=value; }
+ }
+
+ public int Right {
+ get { return right; }
+ set { right=value; }
+ }
+
+ public int Top {
+ get { return top; }
+ set { top=value; }
+ }
+
+
+ /// --- public Methods ---
+ [MonoTODO]
+ public override bool Equals (object other)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventArgs.cs
new file mode 100644
index 00000000000..3c3bf1133c6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventArgs.cs
@@ -0,0 +1,121 @@
+//
+// System.Windows.Forms.SelectedGridItemChangedEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms
+{
+
+ // <summary>
+ // </summary>
+
+ public class SelectedGridItemChangedEventArgs : EventArgs {
+ GridItem old;
+ GridItem newGridItem;
+
+ //
+ // --- Constructor
+ //
+ public SelectedGridItemChangedEventArgs(GridItem old, GridItem newGridItem) {
+ this.newGridItem = newGridItem;
+ this.old = old;
+ }
+
+ #region Public Properties
+ public GridItem NewSelection
+ {
+ get {
+ return newGridItem;
+ }
+ }
+ public GridItem OldSelection {
+ get {
+ return old;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SelectedGridItemChangedEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// NewSelection and OldSelection Property
+ /// of the two SelectedGridItemChangedEventArgs.
+ /// </remarks>
+ public static bool operator == (SelectedGridItemChangedEventArgs SelectedGridItemChangedEventArgsA, SelectedGridItemChangedEventArgs SelectedGridItemChangedEventArgsB)
+ {
+ return (SelectedGridItemChangedEventArgsA.NewSelection == SelectedGridItemChangedEventArgsB.NewSelection) && (SelectedGridItemChangedEventArgsA.OldSelection == SelectedGridItemChangedEventArgsB.OldSelection);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two UICuesEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Changed Property
+ /// of the two UICuesEventArgs.
+ /// </remarks>
+ public static bool operator != (SelectedGridItemChangedEventArgs SelectedGridItemChangedEventArgsA, SelectedGridItemChangedEventArgs SelectedGridItemChangedEventArgsB)
+ {
+ return (SelectedGridItemChangedEventArgsA.NewSelection != SelectedGridItemChangedEventArgsB.NewSelection) || (SelectedGridItemChangedEventArgsA.OldSelection != SelectedGridItemChangedEventArgsB.OldSelection);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// SelectedGridItemChangedEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is SelectedGridItemChangedEventArgs))return false;
+ return (this == (SelectedGridItemChangedEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the SelectedGridItemChangedEventArgs as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventHandler.cs
new file mode 100644
index 00000000000..3c2a65959c4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/SelectedGridItemChangedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.SelectedGridItemChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the SelectedGridItemChanged event of a PropertyGrid.
+ /// </summary>
+ //[Serializable]
+ public delegate void SelectedGridItemChangedEventHandler(object sender, SelectedGridItemChangedEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/SizeGripStyle.cs b/mcs/class/System.Windows.Forms/WINELib/SizeGripStyle.cs
new file mode 100644
index 00000000000..7883ed12915
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/SizeGripStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.SizeGripStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum SizeGripStyle {
+ Auto = 0,
+ Hide = 2,
+ Show = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/SplitterEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/SplitterEventArgs.cs
new file mode 100644
index 00000000000..b6e084182a2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/SplitterEventArgs.cs
@@ -0,0 +1,148 @@
+//
+// System.Windows.Forms.SplitterEventArgs.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ [ComVisible(true)]
+ public class SplitterEventArgs : EventArgs {
+
+ #region Fields
+ private int x;
+ private int y;
+ private int splitx;
+ private int splity;
+ #endregion
+
+ //
+ // --- Constructor
+ //
+ public SplitterEventArgs(int x, int y, int splitX, int splitY)
+ {
+ this.x = x;
+ this.y = y;
+ splitx = splitX;
+ splity = splitY;
+ }
+
+ #region Public Properties
+ [ComVisible(true)]
+ public int SplitX {
+ get {
+ return splitx;
+ }
+ set {
+ splitx = value;
+ }
+ }
+ [ComVisible(true)]
+ public int SplitY {
+ get {
+ return splity;
+ }
+ set {
+ splity = value;
+ }
+ }
+ [ComVisible(true)]
+ public int X {
+ get {
+ return x;
+ }
+ }
+ [ComVisible(true)]
+ public int Y {
+ get {
+ return y;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SplitterEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// SplitX, SplitY, X, Y Property
+ /// of the two SplitterEventArgs.
+ /// </remarks>
+ public static bool operator == (SplitterEventArgs SplitterEventArgsA, SplitterEventArgs SplitterEventArgsB)
+ {
+ return (SplitterEventArgsA.SplitX == SplitterEventArgsB.SplitX) && (SplitterEventArgsA.SplitY == SplitterEventArgsB.SplitY) && (SplitterEventArgsA.X == SplitterEventArgsB.X) && (SplitterEventArgsA.Y == SplitterEventArgsB.Y);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SplitterEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// SplitX, SplitY, X, Y Property
+ /// of the two SplitterEventArgs.
+ /// </remarks>
+ public static bool operator != (SplitterEventArgs SplitterEventArgsA, SplitterEventArgs SplitterEventArgsB)
+ {
+ return (SplitterEventArgsA.SplitX != SplitterEventArgsB.SplitX) || (SplitterEventArgsA.SplitY != SplitterEventArgsB.SplitY) || (SplitterEventArgsA.X != SplitterEventArgsB.X) || (SplitterEventArgsA.Y != SplitterEventArgsB.Y);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// UICuesEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is SplitterEventArgs))return false;
+ return (this == (SplitterEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the SplitterEventArgs as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/SplitterEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/SplitterEventHandler.cs
new file mode 100644
index 00000000000..5b8aafae22e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/SplitterEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.SplitterEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the SplitterMoving and SplitterMoved events of a Splitter.
+ /// </summary>
+ //[Serializable]
+ public delegate void SplitterEventHandler(object sender, SplitterEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBar.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBar.cs
new file mode 100644
index 00000000000..14ad7423aa9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBar.cs
@@ -0,0 +1,487 @@
+//
+// System.Windows.Forms.StatusBar.cs
+//
+// Author:
+// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ // Represents a Windows status bar control.
+ // </summary>
+ public class StatusBar : Control {
+
+ //
+ // --- Private Fields
+ //
+ private bool showPanels;
+ private bool sizingGrip;
+
+ //
+ // --- Constructors/Destructors
+ //
+ [MonoTODO]
+ public StatusBar() : base()
+ {
+ Dock = DockStyle.Bottom;
+ showPanels = false;
+ sizingGrip = true;
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Protected Methods
+ //
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ protected virtual void OnDrawItem(StatusBarDrawItemEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnLayout(LayoutEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnPanelClick(StatusBarPanelClickEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // --- Public Events
+ //
+ public event StatusBarDrawItemEventHandler DrawItem;
+ public event StatusBarPanelClickEventHandler PanelClick;
+
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public override Color BackColor {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override DockStyle Dock {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override Font Font {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public new ImeMode ImeMode {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public StatusBar.StatusBarPanelCollection Panels {
+
+ get { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public bool ShowPanels {// default false {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public bool SizingGrip // default true {
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public new bool TabStop {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ public override string Text {
+
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+
+ get { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+
+ get { throw new NotImplementedException (); }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+
+ get { throw new NotImplementedException (); }
+ }
+
+ //
+ // System.Windows.Forms.StatusBar.StatusBarPanelCollection
+ //
+ // Author:
+ // stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+ // stub ammended by Jaak Simm (jaaksimm@firm.ee)
+ // Implemented by Richard Baumann <biochem333@nyc.rr.com>
+ // (C) Ximian, Inc., 2002
+ //
+ // <summary>
+ // Represents the collection of panels in a StatusBar control.
+ // </summary>
+ public class StatusBarPanelCollection : IList, ICollection, IEnumerable {
+
+ //
+ // --- Private Fields
+ //
+ private ArrayList list;
+ private StatusBar owner;
+ private static string class_string = "System.Windows.Forms.StatusBar.StatusBarPanelCollection::";
+
+ //
+ // --- Constructors/Destructors
+ //
+ StatusBarPanelCollection(StatusBar owner) : base()
+ {
+ list = new ArrayList();
+ this.owner = owner;
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public virtual int Add(StatusBarPanel panel)
+ {
+ string method_string = "Add(StatusBarPanel) ";
+ if (panel == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panel == null");
+ }
+ if (panel.Parent == null) {
+
+ throw new ArgumentException(class_string + method_string + "panel.Parent != null");
+ }
+ // FIXME: StatusBarPanel.Parent is readonly!
+ //panel.Parent = owner;
+ return list.Add(panel);
+ }
+ [MonoTODO]
+ public virtual StatusBarPanel Add(string s)
+ {
+ throw new NotImplementedException ();
+ // StatusBarPanel tmp = new StatusBarPanel();
+ // tmp.Text = s;
+ // // FIXME: StatusBarPanel.Parent is readonly!
+ // //tmp.Parent = owner;
+ // list.Add(tmp);
+ // return tmp;
+ }
+ [MonoTODO]
+ public virtual void AddRange(StatusBarPanel[] panels)
+ {
+ string method_string = "AddRange(StatusBarPanel[]) ";
+ if (panels == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panels == null");
+ }
+ for (int i = 0; i < panels.Length; i++) {
+ // FIXME: StatusBarPanel.Parent is readonly!
+ //panels[i].Parent = owner;
+ }
+ list.AddRange(panels);
+ }
+ public virtual void Clear()
+ {
+ list.Clear();
+ }
+ public bool Contains(StatusBarPanel panel)
+ {
+ return list.Contains(panel);
+ }
+ public IEnumerator GetEnumerator()
+ {
+ return list.GetEnumerator();
+ }
+ public int IndexOf(StatusBarPanel panel)
+ {
+ return list.IndexOf(panel);
+ }
+ [MonoTODO]
+ public virtual void Insert(int index, StatusBarPanel panel)
+ {
+ string method_string = "Insert(int,StatusBarPanel) ";
+ if (panel == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panel == null");
+ }
+ if (panel.Parent == null) {
+
+ throw new ArgumentException(class_string + method_string + "panel.Parent != null");
+ }
+ if (panel.AutoSize != StatusBarPanelAutoSize.None &&
+ panel.AutoSize != StatusBarPanelAutoSize.Contents &&
+ panel.AutoSize != StatusBarPanelAutoSize.Spring)
+ {
+ throw new InvalidEnumArgumentException(class_string + method_string + "panel.AutoSize is not a valid StatusBarPanelAutoSize value");
+ }
+ list.Insert(index,panel);
+
+ // do this after insert because insert does the range checking and might throw an exception
+ // FIXME: StatusBarPanel.Parent is readonly!
+ // panel.Parent = owner; // a rethrow for a better exception message, or an extra range check, would incur an unnecessary performance cost
+ }
+ public virtual void Remove(StatusBarPanel panel)
+ {
+ string method_string = "Remove(StatusBarPanel) ";
+ if (panel == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "panel == null");
+ }
+ list.Remove(panel);
+ }
+ public virtual void RemoveAt(int index)
+ {
+ list.RemoveAt(index);
+ }
+ void ICollection.CopyTo(Array dest, int index)
+ {
+ string method_string = "ICollection.CopyTo(Array,int) ";
+ if (dest == null) {
+
+ throw new ArgumentNullException(class_string + method_string + "array == null");
+ }
+ if (index < 0) {
+
+ throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
+ }
+ if (dest.Rank != 1) {
+
+ throw new ArgumentException(class_string + method_string + "array is multidimensional");
+ }
+ if (index >= dest.Length) {
+
+ throw new ArgumentException(class_string + method_string + "index >= array.Length");
+ }
+ if (Count+index >= dest.Length) {
+
+ throw new ArgumentException(class_string + method_string + "insufficient array capacity");
+ }
+ // easier/quicker to let the runtime throw the invalid cast exception if necessary
+ for (int i = 0; index < dest.Length; i++, index++) {
+
+ dest.SetValue(list[i], index);
+ }
+ }
+ int IList.Add(object panel)
+ {
+ string method_string = "IList.Add(object) ";
+ if (!(panel is StatusBarPanel)) {
+
+ throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+ }
+ return Add((StatusBarPanel) panel);
+ }
+ bool IList.Contains(object panel)
+ {
+ if (!(panel is StatusBarPanel)) {
+
+ return false;
+ }
+ return Contains((StatusBarPanel) panel);
+ }
+ int IList.IndexOf(object panel)
+ {
+ if (!(panel is StatusBarPanel)) {
+
+ return -1;
+ }
+ return IndexOf((StatusBarPanel) panel);
+ }
+ void IList.Insert(int index, object panel)
+ {
+ string method_string = "IList.Insert(int,object) ";
+ if (!(panel is StatusBarPanel)) {
+
+ throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+ }
+ Insert(index, (StatusBarPanel) panel);
+ }
+ void IList.Remove(object panel)
+ {
+ string method_string = "IList.Remove(object) ";
+ if (!(panel is StatusBarPanel)) {
+
+ throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+ }
+ Remove((StatusBarPanel) panel);
+ }
+
+
+ // --- Public Properties
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ //get { return list.Count; }
+ }
+ public bool IsReadOnly {
+
+ get { return false; }
+ }
+ object IList.this[int index] {
+
+ get { return this[index]; }
+ set { this[index]=(StatusBarPanel)value; }
+ }
+ public virtual StatusBarPanel this[int index] {
+
+ get
+ {
+ // The same checks are done by the list, so this is redundant
+ // This is left here in case you prefer better exception messages over performance
+ //string method_string = "get_Item(int) ";
+ //if (index < 0)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
+ //}
+ //if (index >= Count)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index >= Count");
+ //}
+ return (StatusBarPanel)list[index];
+ }
+ set
+ {
+ // The same checks are done by the list, so this is redundant
+ // This is left here in case you prefer better exception messages over performance
+ //string method_string = "set_Item(int,StatusBarPanel) ";
+ //if (index < 0)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
+ //}
+ //if (index >= Count)
+ //{
+ // throw new ArgumentOutOfRangeException(class_string + method_string + "index >= Count");
+ //}
+ //if (value == null)
+ //{
+ // throw new ArgumentNullException(class_string + method_string + "panel == null");
+ //}
+ list[index] = value;
+ }
+ }
+ bool IList.IsFixedSize {
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+ object ICollection.SyncRoot {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+ bool ICollection.IsSynchronized {
+
+ [MonoTODO] get { throw new NotImplementedException (); }
+ }
+
+
+ // --- Private Properties
+
+ private bool IsFixedSize { get { return false; } }
+
+// private object ILList.this[int index]
+// {
+// get { return (StatusBarPanel) this[index]; }
+// set
+// {
+// string method_string = "IList.set_Item(int,object) ";
+// if (!(value is StatusBarPanel))
+// {
+// throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
+// }
+// this[index] = (StatusBarPanel) value;
+// }
+// }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventArgs.cs
new file mode 100644
index 00000000000..b2b317408cc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventArgs.cs
@@ -0,0 +1,119 @@
+//
+// System.Windows.Forms.StatusBarDrawItemEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the DrawItem event.
+ /// </summary>
+ public class StatusBarDrawItemEventArgs : DrawItemEventArgs {
+
+ private StatusBarPanel panel;
+
+ /// --- Constructor ---
+ public StatusBarDrawItemEventArgs(Graphics g, Font font,
+ Rectangle r, int itemId, DrawItemState itemState,
+ StatusBarPanel panel, Color foreColor, Color backColor)
+ : base(g, font, r, itemId, itemState, foreColor, backColor) {
+ this.panel = panel;
+ }
+
+ public StatusBarDrawItemEventArgs(Graphics g, Font font,
+ Rectangle r, int itemId, DrawItemState itemState, StatusBarPanel panel)
+ : base(g, font, r, itemId, itemState) {
+ this.panel = panel;
+ }
+
+ #region Public Properties
+ public StatusBarPanel Panel
+ {
+ get {
+ return panel;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two StatusBarDrawItemEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// the BackColor, Bounds, Font, ForeColor, Graphics,
+ /// Index, Panel, and State properties of the two
+ /// StatusBarDrawItemEventArgs.
+ /// </remarks>
+ public static bool operator == (StatusBarDrawItemEventArgs objA, StatusBarDrawItemEventArgs objB)
+ {
+ return ((objA.panel == objB.panel) && ((DrawItemEventArgs) objA == (DrawItemEventArgs) objB));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two StatusBarDrawItemEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// the BackColor, Bounds, Font, ForeColor, Graphics,
+ /// Index, Panel, and State properties of the two
+ /// StatusBarDrawItemEventArgs.
+ /// </remarks>
+ public static bool operator != (StatusBarDrawItemEventArgs objA, StatusBarDrawItemEventArgs objB)
+ {
+ return ((objA.panel != objB.panel) || ((DrawItemEventArgs) objA != (DrawItemEventArgs) objB));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// StatusBarDrawItemEventArgs and another object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is StatusBarDrawItemEventArgs))return false;
+ return (this == (StatusBarDrawItemEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// Returns DrawItemEventArgs.GetHashCode().
+ /// </remarks>
+ public override int GetHashCode ()
+ {
+ // FIXME: In a perfect world, get hashcode would include
+ // Panel, but this shouldbe good enough.
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the StatusBarDrawItemEventArgs as a string.
+ /// </remarks>
+ public override string ToString ()
+ {
+ return base.ToString() + panel.ToString();
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventHandler.cs
new file mode 100644
index 00000000000..a10c044ca9e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarDrawItemEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.StatusBarDrawItemEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the DrawItem event of a StatusBar.
+ /// </summary>
+ //[Serializable]
+ public delegate void StatusBarDrawItemEventHandler(object sender, StatusBarDrawItemEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarPanel.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanel.cs
new file mode 100644
index 00000000000..b5728b7744b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanel.cs
@@ -0,0 +1,141 @@
+//
+// System.Windows.Forms.StatusBarPanel
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a panel in a StatusBar control.
+ /// </summary>
+ public class StatusBarPanel : Component, ISupportInitialize {
+
+ //
+ // --- Private Fields
+ //
+ private HorizontalAlignment alignment;
+ private StatusBarPanelAutoSize autoSize;
+ private StatusBarPanelBorderStyle borderStyle;
+ private Icon icon;
+ private int minWidth;
+ private StatusBar parent;
+ private StatusBarPanelStyle style;
+ private string text;
+ private string toolTipText;
+ private int width;
+
+ //
+ // --- Constructors/Destructors
+ //
+ StatusBarPanel() : base()
+ {
+ alignment = HorizontalAlignment.Left;
+ autoSize = StatusBarPanelAutoSize.None;
+ borderStyle = StatusBarPanelBorderStyle.Sunken;
+ icon = null;
+ minWidth = 10;
+ style = StatusBarPanelStyle.Text;
+ text = "";
+ toolTipText = "";
+ width = 100;
+ }
+
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public void BeginInit()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void EndInit()
+ {
+ throw new NotImplementedException ();
+ }
+ public override string ToString()
+ {
+ return text;
+ }
+
+ //
+ // --- Protected Methods
+ //
+
+ //inherited
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+
+ //
+ // --- Public Properties
+ //
+ public HorizontalAlignment Alignment {
+
+ get { return alignment; }
+ set { alignment = value; }
+ }
+ public StatusBarPanelAutoSize AutoSize {
+
+ get { return autoSize; }
+ set
+ {
+ if (value != StatusBarPanelAutoSize.None && value != StatusBarPanelAutoSize.Contents && value != StatusBarPanelAutoSize.Spring) {
+
+ throw new InvalidEnumArgumentException("System.Windows.Forms.StatusBarPanel::set_AutoSize(StatusBarPanelAutoSize) " +
+ "value is not a valid StatusBarPanelAutoSize value");
+ }
+ autoSize = value;
+ }
+ }
+ public StatusBarPanelBorderStyle BorderStyle {
+
+ get { return borderStyle; }
+ set { borderStyle = value; }
+ }
+ public Icon Icon {
+
+ get { return icon; }
+ set { icon = value; }
+ }
+ public int MinWidth {
+
+ get { return minWidth; }
+ set { minWidth = value; }
+ }
+ public StatusBar Parent {
+
+ get { return parent; }
+ set { parent = value; }
+ }
+ public StatusBarPanelStyle Style {
+
+ get { return style; }
+ set { style = value; }
+ }
+ public string Text {
+
+ get { return text; }
+ set { text = value; }
+ }
+ public string ToolTipText {
+
+ get { return toolTipText; }
+ set { toolTipText = value; }
+ }
+ public int Width {
+
+ get { return width; }
+ set { width = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelAutoSize.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelAutoSize.cs
new file mode 100644
index 00000000000..d1f02a8e314
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelAutoSize.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.StatusBarPanelAutoSize.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StatusBarPanelAutoSize {
+ Contents = 3,
+ None = 1,
+ Spring = 2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelBorderStyle.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelBorderStyle.cs
new file mode 100644
index 00000000000..19eec69a051
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelBorderStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.StatusBarPanelBorderStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StatusBarPanelBorderStyle {
+ None = 1,
+ Raised = 2,
+ Sunken =3
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventArgs.cs
new file mode 100644
index 00000000000..3f8fc50e254
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventArgs.cs
@@ -0,0 +1,121 @@
+//
+// System.Windows.Forms.StatusBarPanelClickEventArgs
+//
+// Author:
+// stubbed out by Richard Baumann (biochem333@nyc.rr.com)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides data for the PanelClick event.
+ /// </summary>
+ public class StatusBarPanelClickEventArgs : MouseEventArgs {
+
+ private StatusBarPanel panel;
+
+ /// --- Constructor ---
+ public StatusBarPanelClickEventArgs(StatusBarPanel panel, MouseButtons button, int clicks, int x, int y) : base(button, clicks, x, y, 0)
+ {
+ this.panel = panel;
+ }
+
+ #region Public Properties
+
+ /// <summary>
+ /// StatusBarPanel Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Gets the StatusBarPanel to draw.
+ /// </remarks>
+ public StatusBarPanel StatusBarPanel
+ {
+ get
+ {
+ return panel;
+ }
+ }
+
+
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two StatusBarPanelClickEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// the StatusBarPanel, Button, Clicks, X, and Y
+ /// properties of the two StatusBarPanelClickEventArgs.
+ /// </remarks>
+ public static bool operator == (StatusBarPanelClickEventArgs objA, StatusBarPanelClickEventArgs objB)
+ {
+ return ((objA.panel == objB.panel) && (objA.Button == objB.Button) && (objA.Clicks == objB.Clicks) && (objA.X == objB.X) && (objA.Y == objB.Y));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two StatusBarPanelClickEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// the StatusBarPanel, Button, Clicks, X, and Y
+ /// properties of the two StatusBarPanelClickEventArgs.
+ /// </remarks>
+ public static bool operator != (StatusBarPanelClickEventArgs objA, StatusBarPanelClickEventArgs objB)
+ {
+ return ((objA.panel != objB.panel) || (objA.Button != objB.Button) || (objA.Clicks != objB.Clicks) || (objA.X != objB.X) || (objA.Y != objB.Y));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// StatusBarPanelClickEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is StatusBarPanelClickEventArgs))return false;
+ return (this == (StatusBarPanelClickEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ public override int GetHashCode ()
+ {
+ return unchecked(panel.GetHashCode() * base.GetHashCode());
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the StatusBarPanelClickEventArgs as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventHandler.cs
new file mode 100644
index 00000000000..c7238743026
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelClickEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.StatusBarPanelClickEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the PanelClick event of a StatusBar.
+ /// </summary>
+ //[Serializable]
+ public delegate void StatusBarPanelClickEventHandler(object sender, StatusBarPanelClickEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelStyle.cs b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelStyle.cs
new file mode 100644
index 00000000000..1be98572930
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/StatusBarPanelStyle.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.StatusBarPanelStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum StatusBarPanelStyle {
+ OwnerDraw = 2,
+ Text =1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TODOAttribute.cs b/mcs/class/System.Windows.Forms/WINELib/TODOAttribute.cs
new file mode 100644
index 00000000000..6e2ace72630
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TabAlignment.cs b/mcs/class/System.Windows.Forms/WINELib/TabAlignment.cs
new file mode 100644
index 00000000000..fb7ed7f6b82
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TabAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.TabAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabAlignment {
+ Bottom = 1,
+ Left = 2,
+ Right = 3,
+ Top = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/Test.cs b/mcs/class/System.Windows.Forms/WINELib/Test.cs
new file mode 100644
index 00000000000..3f62a000e6f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Test.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Runtime.InteropServices;
+
+public class Test
+{
+ [DllImport ("user32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public static extern int MessageBoxA (int hWnd, string pText, string pCaption, int uType);
+
+ static public void Main()
+ {
+ MessageBoxA(0, "Calling winelib from Mono", "TEST", 0);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBar.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBar.cs
new file mode 100644
index 00000000000..1065bd3690d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBar.cs
@@ -0,0 +1,458 @@
+//
+// System.Windows.Forms.ToolBar
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+using System.Collections;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class ToolBar : Control {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public ToolBar()
+ {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public ToolBarAppearance Appearance {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool AutoSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ToolBar.ToolBarButtonCollection Buttons {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size ButtonSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Divider {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override DockStyle Dock{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool DropDownArrows {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ImageList ImageList {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Size ImageSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public new ImeMode ImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override RightToLeft RightToLeft {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowToolTips {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ToolBarTextAlign TextAlign {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Wrappable{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event ToolBarButtonClickEventHandler ButtonClick;
+ [MonoTODO]
+ public event ToolBarButtonClickEventHandler ButtonDropDown;
+ //
+ // --- Protected Properties
+ //
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override ImeMode DefaultImeMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ protected virtual void OnButtonClick(ToolBarButtonClickEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnButtonDropDown(ToolBarButtonClickEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+ public class ToolBarButtonCollection : IList, ICollection, IEnumerable {
+ //
+ // --- Public Constructor
+ //
+ [MonoTODO]
+ public ToolBarButtonCollection(ToolBar owner)
+ {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual ToolBarButton this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ //
+ // --- Public Methods
+ //
+ [MonoTODO]
+ public int Add(string text)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int Add(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void AddRange(ToolBarButton[] buttons)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool Contains(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Insert(int index, ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ //[MonoTODO]
+ //public void Insert(int index, ToolBarButton button) {
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ public void Remove(ToolBarButton button)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBarAppearance.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBarAppearance.cs
new file mode 100644
index 00000000000..7400821b435
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBarAppearance.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ToolBarAppearance.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ToolBarAppearance {
+ Flat = 1,
+ Normal = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBarButton.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBarButton.cs
new file mode 100644
index 00000000000..a05f776daa4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBarButton.cs
@@ -0,0 +1,157 @@
+//
+// System.Windows.Forms.ToolBarButton
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+using System.ComponentModel;
+ public class ToolBarButton : Component {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public ToolBarButton()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public ToolBarButton(string text)
+ {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public Menu DropDownMenu {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Enabled {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ToolBar Parent {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool PartialPush {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Pushed {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Rectangle Rectangle {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ToolBarButtonStyle Style {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public object Tag {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string Text {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string ToolTipText {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Visible {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Protected Methods
+ //
+
+ //inherited
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventArgs.cs
new file mode 100644
index 00000000000..89f7fa171bc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventArgs.cs
@@ -0,0 +1,118 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventArgs
+//
+// Author:
+// stubbed out by Dennis Hayes(dennish@raytek.com)
+// stub ammended by Jaak Simm (jaaksimm@firm.ee)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Summary description for ToolBarButtonClickEventArgs.
+ /// </summary>
+ [MonoTODO]
+ public class ToolBarButtonClickEventArgs : EventArgs {
+
+ #region Field
+ ToolBarButton button;
+ #endregion
+
+ #region Constructor
+ public ToolBarButtonClickEventArgs(ToolBarButton button)
+ {
+ this.button=button;
+ }
+ #endregion
+
+ #region Properties
+ public ToolBarButton Button {
+ get { return button; }
+ set { button=value; }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ToolBarButtonClickEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Button Property
+ /// of the two ToolBarButtonClickEventArgs.
+ /// </remarks>
+ public static bool operator == (ToolBarButtonClickEventArgs ToolBarButtonClickEventArgsA, ToolBarButtonClickEventArgs ToolBarButtonClickEventArgsB)
+ {
+ return (ToolBarButtonClickEventArgsA.Button == ToolBarButtonClickEventArgsB.Button);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two ToolBarButtonClickEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Button Property
+ /// of the two ToolBarButtonClickEventArgs.
+ /// </remarks>
+ public static bool operator != (ToolBarButtonClickEventArgs ToolBarButtonClickEventArgsA, ToolBarButtonClickEventArgs ToolBarButtonClickEventArgsB)
+ {
+ return (ToolBarButtonClickEventArgsA.Button != ToolBarButtonClickEventArgsB.Button);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// ToolBarButtonClickEventArgsA and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ToolBarButtonClickEventArgs))return false;
+ return (this == (ToolBarButtonClickEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the ToolBarButtonClickEventArgsA as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventHandler.cs
new file mode 100644
index 00000000000..0cf437186e0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonClickEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the ButtonClick event of a ToolBar.
+ /// </summary>
+ //[Serializable]
+ public delegate void ToolBarButtonClickEventHandler(object sender, ToolBarButtonClickEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonStyle.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonStyle.cs
new file mode 100644
index 00000000000..954774f964d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBarButtonStyle.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.ToolBarButtonStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ToolBarButtonStyle {
+ DropDownButton = 4,
+ PushButton = 1,
+ Separator = 3,
+ ToggleButton =2
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/ToolBarTextAlign.cs b/mcs/class/System.Windows.Forms/WINELib/ToolBarTextAlign.cs
new file mode 100644
index 00000000000..76d26fd5aca
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/ToolBarTextAlign.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ToolBarTextAlign.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ToolBarTextAlign {
+ Right = 1,
+ Underneath = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeNode.cs b/mcs/class/System.Windows.Forms/WINELib/TreeNode.cs
new file mode 100644
index 00000000000..4baede6efdc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeNode.cs
@@ -0,0 +1,316 @@
+//
+// System.Windows.Forms.TreeNode
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class TreeNode : MarshalByRefObject, ICloneable {
+
+
+ // --- Public Constructors
+
+ [MonoTODO]
+ public TreeNode()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public TreeNode(string text)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public TreeNode(string text, TreeNode[] children)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public Color BackColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Rectangle Bounds {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Checked {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode FirstNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Color ForeColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string FullPath {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public IntPtr Handle {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Index {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsEditing {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsExpanded {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsSelected {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsVisible {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode LastNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode NextNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode NextVisibleNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public Font NodeFont {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNodeCollection Nodes {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode Parent {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode PrevNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode PrevVisibleNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectedImageIndex {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public object Tag {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string Text {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeView TreeView {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void BeginEdit()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual object Clone()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Collapse()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void EndEdit(bool cancel)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void EnsureVisible()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Expand()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ExpandAll()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static TreeNode FromHandle(TreeView tree, IntPtr handle)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int GetNodeCount(bool includeSubTrees)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Remove()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Toggle()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeNodeCollection.cs b/mcs/class/System.Windows.Forms/WINELib/TreeNodeCollection.cs
new file mode 100644
index 00000000000..062c8bdcd3a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeNodeCollection.cs
@@ -0,0 +1,187 @@
+//
+// System.Windows.Forms.TreeNodeCollection
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class TreeNodeCollection : IList, ICollection, IEnumerable {
+
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public virtual TreeNode this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public virtual TreeNode Add(string text)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual int Add(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void AddRange(TreeNode[] nodes)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public bool Contains(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CopyTo(Array dest, int index)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int IndexOf(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void Insert(int index, TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Remove(TreeNode node)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public virtual void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{
+ // We allow addition, removeal, and editing of items after creation of the list.
+ return false;
+ }
+ }
+ bool IList.IsFixedSize{
+ get{
+ // We allow addition and removeal of items after creation of the list.
+ return false;
+ }
+ }
+
+ //[MonoTODO]
+ object IList.this[int index]{
+ get{
+ throw new NotImplementedException ();
+ }
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IList.Clear(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.Add( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.Remove( object value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IList.RemoveAt( int index){
+ throw new NotImplementedException ();
+ }
+ // End of IList interface
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ bool ICollection.IsSynchronized{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ object ICollection.SyncRoot{
+ get{
+ throw new NotImplementedException ();
+ }
+ }
+ void ICollection.CopyTo(Array array, int index){
+ throw new NotImplementedException ();
+ }
+ // End Of ICollection
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeView.cs b/mcs/class/System.Windows.Forms/WINELib/TreeView.cs
new file mode 100644
index 00000000000..ee0fe2280f6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeView.cs
@@ -0,0 +1,485 @@
+//
+// System.Windows.Forms.TreeView
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.Drawing;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public class TreeView : Control {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public TreeView()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Properties
+
+ [MonoTODO]
+ public override Color BackColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool CheckBoxes {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool FullRowSelect {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool HideSelection {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool HotTracking {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public ImageList ImageList {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int Indent {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ItemHeight {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool LabelEdit {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNodeCollection Nodes {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public string PathSeparator {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Scrollable {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int SelectedImageIndex {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode SelectedNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowLines {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowPlusMinus {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowRootLines {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool Sorted {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public override string Text {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public TreeNode TopNode {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int VisibleCount {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void BeginUpdate()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void CollapseAll()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void EndUpdate()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void ExpandAll()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public TreeNode GetNodeAt(Point pt)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public TreeNode GetNodeAt(int x, int y)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public int GetNodeCount(bool includeSubTrees)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ // --- Public Events
+
+ [MonoTODO]
+ public event TreeViewEventHandler AfterCheck;
+ [MonoTODO]
+ public event TreeViewEventHandler AfterCollapse;
+ [MonoTODO]
+ public event TreeViewEventHandler AfterExpand;
+ [MonoTODO]
+ public event NodeLabelEditEventHandler AfterLabelEdit;
+ [MonoTODO]
+ public event TreeViewEventHandler AfterSelect;
+ [MonoTODO]
+ public event TreeViewCancelEventHandler BeforeCheck;
+ [MonoTODO]
+ public event TreeViewCancelEventHandler BeforeCollapse;
+ [MonoTODO]
+ public event TreeViewCancelEventHandler BeforeExpand;
+ [MonoTODO]
+ public event NodeLabelEditEventHandler BeforeLabelEdit;
+ [MonoTODO]
+ public event TreeViewCancelEventHandler BeforeSelect;
+ [MonoTODO]
+ public event ItemDragEventHandler ItemDrag;
+ //public new event PaintEventHandler Paint;
+
+ // --- Protected Properties
+
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Protected Methods
+
+ [MonoTODO]
+ protected override void CreateHandle()
+ {
+ throw new NotImplementedException ();
+ }
+
+ //inherited
+ //protected override void Dispose(bool disposing)
+ //{
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnAfterCheck(TreeViewEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnAfterCollapse(TreeViewEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnAfterExpand(TreeViewEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnAfterLabelEdit(NodeLabelEditEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnAfterSelect(TreeViewEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeCheck(TreeViewCancelEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeCollapse(TreeViewCancelEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeExpand(TreeViewCancelEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeLabelEdit(NodeLabelEditEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnBeforeSelect(TreeViewCancelEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected virtual void OnItemDrag(ItemDragEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnKeyPress(KeyPressEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void OnKeyUp(KeyEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ protected override void WndProc(ref Message m)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeViewAction.cs b/mcs/class/System.Windows.Forms/WINELib/TreeViewAction.cs
new file mode 100644
index 00000000000..2af134e947d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeViewAction.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.TreeViewAction.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TreeViewAction {
+ ByKeyboard = 1,
+ ByMouse = 2,
+ Collapse = 3,
+ Expand =4,
+ Unknown = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventArgs.cs
new file mode 100644
index 00000000000..9b7528aee53
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventArgs.cs
@@ -0,0 +1,138 @@
+//
+// System.Windows.Forms.TreeViewCancelEventArgs
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Partially completed by Dennis Hayes (dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TreeViewCancelEventArgs : CancelEventArgs {
+
+ private TreeNode node;
+ private TreeViewAction action;
+ //
+ // --- Public Constructors
+ //
+ public TreeViewCancelEventArgs(TreeNode node, bool cancel, TreeViewAction action) : base(cancel)
+ {
+ this.node = node;
+ this.action = action;
+ }
+
+ #region Public Properties
+ /// <summary>
+ /// Action Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Gets the type of TreeViewAction that raised the event.
+ /// </remarks>
+ public TreeViewAction Action
+ {
+ get {
+ return action;
+ }
+ }
+
+ /// <summary>
+ /// Node Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Gets the tree node to be checked, expanded, collapsed, or selected.
+ /// </remarks>
+ public TreeNode Node
+ {
+ get {
+ return node;
+ }
+ }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this TreeViewCancelEventArgs and another object.
+ /// </remarks>
+ public override bool Equals(object obj)
+ {
+ if (!(obj is TreeViewCancelEventArgs))
+ return false;
+
+ return (this == (TreeViewCancelEventArgs) obj);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two TreeViewCancelEventArgs objects. The return value is
+ /// based on the equivalence of the node and action property
+ /// of the two TreeViewCancelEventArgs.
+ /// </remarks>
+ public static bool operator == (TreeViewCancelEventArgs TreeViewCancelEventArgsA, TreeViewCancelEventArgs TreeViewCancelEventArgsB)
+ {
+ return ((TreeViewCancelEventArgsA.action == TreeViewCancelEventArgsB.action) && (TreeViewCancelEventArgsA.Node == TreeViewCancelEventArgsB.Node)) ;
+ }
+
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two TreeViewCancelEventArgs objects. The return value is
+ /// based on the equivalence of the node and action property
+ /// of the two TreeViewCancelEventArgs.
+ /// </remarks>
+ public static bool operator != (TreeViewCancelEventArgs TreeViewCancelEventArgsA, TreeViewCancelEventArgs TreeViewCancelEventArgsB)
+ {
+ return ((TreeViewCancelEventArgsA.action != TreeViewCancelEventArgsB.action) || (TreeViewCancelEventArgsA.Node != TreeViewCancelEventArgsB.Node)) ;
+ }
+
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the TreeViewCancelEventArgs as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion // Public Methods
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventHandler.cs
new file mode 100644
index 00000000000..005595fb3f5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeViewCancelEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TreeViewCancelEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the BeforeCheck,
+ /// BeforeCollapse, BeforeExpand, or BeforeSelect event of a TreeView.
+ /// </summary>
+ //[Serializable]
+ public delegate void TreeViewCancelEventHandler(object sender, TreeViewCancelEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeViewEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/TreeViewEventArgs.cs
new file mode 100644
index 00000000000..7188c1ee2ac
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeViewEventArgs.cs
@@ -0,0 +1,44 @@
+//
+// System.Windows.Forms.TreeViewEventArgs
+//
+// Author:
+// Stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Completed by Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc
+//
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // </summary>
+
+ public class TreeViewEventArgs : EventArgs {
+ private TreeNode node;
+ private TreeViewAction action;
+ //
+ // --- Public Constructors
+ //
+ public TreeViewEventArgs(TreeNode node)
+ {
+ this.node = node;
+ }
+ public TreeViewEventArgs(TreeNode node, TreeViewAction action)
+ {
+ this.node = node;
+ this.action = action;
+ }
+ //
+ // --- Public Properties
+ //
+ public TreeViewAction Action {
+ get {
+ return action;
+ }
+ }
+ public TreeNode Node {
+ get {
+ return node;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/TreeViewEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/TreeViewEventHandler.cs
new file mode 100644
index 00000000000..14702b3f0a7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/TreeViewEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TreeViewEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents the method that will handle the
+ /// AfterCheck, AfterCollapse, AfterExpand, or AfterSelect event of a TreeView.
+ /// </summary>
+ //[Serializable]
+ public delegate void TreeViewEventHandler(object sender, TreeViewEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/UICues.cs b/mcs/class/System.Windows.Forms/WINELib/UICues.cs
new file mode 100644
index 00000000000..6a3336daab9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/UICues.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.UICues.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ // Specifies the state of the user interface
+ [Flags]
+ public enum UICues
+ {
+ Changed = 12, // The state of the focus cues and keyboard cues has changed.
+ ChangeFocus = 4, // The state of the focus cues has changed.
+ ChangeKeyboard = 8, // The state of the keyboard cues has changed.
+ None = 0, // No change was made.
+ ShowFocus = 1, // Focus rectangles are displayed after the change.
+ ShowKeyboard = 2, // Keyboard cues are underlined after the change.
+ Shown = 3, // Focus rectangles are displayed and keyboard cues are underlined
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/UICuesEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/UICuesEventArgs.cs
new file mode 100644
index 00000000000..0110ff21049
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/UICuesEventArgs.cs
@@ -0,0 +1,149 @@
+//
+// System.Windows.Forms.UICuesEventArgs
+//
+// Author:
+// stubbed out by Stefan Warnke (StefanW@POBox.com)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ // </summary>
+
+
+ /// <summary>
+ /// UICuesEventArgs specifies which user interface feature changed and its new value.
+ /// </summary>
+ public class UICuesEventArgs : EventArgs {
+
+ private UICues uicues;
+// /// --- Constructor ---
+ public UICuesEventArgs(UICues uicues)
+ {
+ this.uicues = uicues;
+ }
+
+ /// --- Public Properties ---
+ #region Public Properties
+
+ // Gets the bitwise combination of the UICues values
+ public UICues Changed {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // Gets a value indicating whether the state of the focus cues has changed.
+ public bool ChangeFocus {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // Gets a value indicating whether the state of the keyboard cues has changed
+ public bool ChangeKeyboard {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // Gets a value indicating whether focus rectangles are shown after the change
+ public bool ShowFocus {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // Gets a value indicating whether keyboard cues are underlined after the change
+ public bool ShowKeyboard {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two UICuesEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Changed Property
+ /// of the two UICuesEventArgs.
+ /// </remarks>
+ public static bool operator == (UICuesEventArgs UICuesEventArgsA, UICuesEventArgs UICuesEventArgsB)
+ {
+ return (UICuesEventArgsA.Changed == UICuesEventArgsB.Changed);
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two UICuesEventArgs objects.
+ /// The return value is based on the equivalence of
+ /// Changed Property
+ /// of the two UICuesEventArgs.
+ /// </remarks>
+ public static bool operator != (UICuesEventArgs UICuesEventArgsA, UICuesEventArgs UICuesEventArgsB)
+ {
+ return (UICuesEventArgsA.Changed != UICuesEventArgsB.Changed);
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this
+ /// UICuesEventArgs and another
+ /// object.
+ /// </remarks>
+ public override bool Equals (object obj)
+ {
+ if (!(obj is UICuesEventArgs))return false;
+ return (this == (UICuesEventArgs) obj);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ //FIXME: add class specific stuff;
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the UICuesEventArgs as a string.
+ /// </remarks>
+ [MonoTODO]
+ public override string ToString ()
+ {
+ //FIXME: add class specific stuff;
+ return base.ToString();
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/UICuesEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/UICuesEventHandler.cs
new file mode 100644
index 00000000000..dcb179ae4bf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/UICuesEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.UICuesEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Represents a method that will handle the ChangeUICues event of a Control.
+ /// </summary>
+ public delegate void UICuesEventHandler(object sender, UICuesEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/UpDownEventArgs.cs b/mcs/class/System.Windows.Forms/WINELib/UpDownEventArgs.cs
new file mode 100644
index 00000000000..dc3fd67b0d3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/UpDownEventArgs.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.UpDownEventArgs
+//
+// Author:
+// stubbed out by Dennis Hayes(dennish@raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) Ximian, Inc., 2002
+//
+using System;
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Summary description for UpDownEventArgs.
+ /// </summary>
+ public class UpDownEventArgs : EventArgs {
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/UpDownEventHandler.cs b/mcs/class/System.Windows.Forms/WINELib/UpDownEventHandler.cs
new file mode 100644
index 00000000000..e2a408355ab
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/UpDownEventHandler.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.UpDownEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// Gianandrea Terzi (gianandrea.terzi@lario.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// This type supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ /// </summary>
+ //[Serializable]
+ public delegate void UpDownEventHandler(object source, UpDownEventArgs e);
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/WINELib.csproj b/mcs/class/System.Windows.Forms/WINELib/WINELib.csproj
new file mode 100644
index 00000000000..80216f7ca9d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/WINELib.csproj
@@ -0,0 +1,1013 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{27FD2668-67DD-4B30-8D2F-156B1EDD4F88}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "WINELib"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "WINELib"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
+ />
+ <Reference
+ Name = "Accessibility"
+ AssemblyName = "Accessibility"
+ HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\Accessibility.dll"
+ />
+ <Reference
+ Name = "System.Windows.Forms.Design"
+ Project = "{EF89E643-02F5-4E97-9353-3C92F209EB47}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AccessibleEvents.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleNavigation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleRole.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleSelection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AccessibleStates.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AnchorStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Application.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ApplicationContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BaseCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Binding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingManagerBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingMemberInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BoundsSpecified.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Button.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ButtonBase.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CheckState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColorDepth.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ColumnClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ComVisible.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContainerControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContentsResizedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContentsResizedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ContextMenu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Control.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Control.resx"
+ DependentUpon = "Control.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "ControlBindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ControlStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConvertEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConvertEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CreateParams.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Cursor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateBoldEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateRangeEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DateRangeEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DialogResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DockStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragDropEffects.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DrawItemState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ErrorIconAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FlatStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Font.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormStartPosition.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormTest.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FormWindowState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GiveFeedbackEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GiveFeedbackEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GridItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "HorizontalAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IAccessible.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IButtonControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IContainerControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IDataObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageList.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageListStreamer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IMessageFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangingEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageChangingEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InputLanguageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemCheckEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemCheckEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ItemDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWin32Window.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IWindowTarget.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyPressEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyPressEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Keys.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Label.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LayoutEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LayoutEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LeftRightAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkArea.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkBehavior.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabelLinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LinkLabelLinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ListViewAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MainMenu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MdiLayout.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MeasureItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MeasureItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Menu.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MenuItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Message.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxDefaultButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxIcon.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageBoxOptions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MouseEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NativeWindow.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NativeWindowTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NavigateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NavigateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NodeLabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NodeLabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PaintEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PaintEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTabChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyTabChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyValueChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyValueChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryAccessibilityHelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryAccessibilityHelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryContinueDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueryContinueDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RightToLeft.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollableControl.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ScrollEventType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectedGridItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectedGridItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SizeGripStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SplitterEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SplitterEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarDrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarDrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanel.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelAutoSize.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StatusBarPanelStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TabAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Test.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarAppearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButton.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarButtonStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ToolBarTextAlign.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "tooltip.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeNodeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeView.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewCancelEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewCancelEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TreeViewEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICues.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICuesEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UICuesEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UpDownEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Win32.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/WINELib.csproj.user b/mcs/class/System.Windows.Forms/WINELib/WINELib.csproj.user
new file mode 100644
index 00000000000..e31ed2b1364
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/WINELib.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.Windows.Forms/WINELib/Win32.cs b/mcs/class/System.Windows.Forms/WINELib/Win32.cs
new file mode 100644
index 00000000000..f648ccfc896
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/Win32.cs
@@ -0,0 +1,678 @@
+//
+// System.Windows.Forms.Win32
+//
+// Provides easy access to commonly used Win32/WINELib contants and functions
+//
+// Author:
+// John Sohn (jsohn@columbus.rr.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ // holder for DLL Win32 DllImports
+ public class Win32 {
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class POINT {
+ public long x;
+ public long y;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RECT {
+ public long left;
+ public long top;
+ public long right;
+ public long bottom;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct MSG {
+ public IntPtr hwnd;
+ public uint message;
+ public IntPtr wParam;
+ public IntPtr lParam;
+ public uint time;
+ public POINT pt;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct WNDCLASS {
+ public int style;
+ public WndProc lpfnWndProc;
+ public int cbClsExtra;
+ public int cbWndExtra;
+ public IntPtr hInstance;
+ public IntPtr hIcon;
+ public IntPtr hCursor;
+ public IntPtr hbrBackground;
+ public string lpszMenuName;
+ public string lpszClassName;
+ }
+
+ // helper function for calling RegisterClass
+ public delegate IntPtr WndProc (IntPtr hwnd, int msg,
+ IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("monostub.exe",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern int MonoRegisterClass (
+ int style, WndProc lpfnWndProc, int cbClsExtra,
+ int cbWndExtra, IntPtr hInstance, IntPtr hIcon,
+ IntPtr hCursor, IntPtr hbrBackground,
+ string lpszMenuName, string lpszClassName);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr CreateWindowExA (
+ uint dwExStyle, string lpClassName,
+ string lpWindowName, uint dwStyle,
+ int x, int y, int nWidth, int nHeight,
+ IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance,
+ ref object lpParam);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public extern static IntPtr DefWindowProcA (
+ IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public extern static int DestroyWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public static extern int ShowWindow (IntPtr hWnd,
+ uint nCmdShow);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,CharSet = CharSet.Auto)]
+ public static extern int GetMessageA (ref MSG msg, int hwnd,
+ int msgFrom, int msgTo);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public static extern int TranslateMessage (ref MSG msg);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public static extern int DispatchMessageA (ref MSG msg);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public static extern int PeekMessageA (
+ ref MSG msg, IntPtr hWnd, uint wMsgFilterMin,
+ uint wMsgFilterMax, uint wRemoveMsg);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public extern static void PostQuitMessage (int nExitCode);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public extern static IntPtr SetActiveWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public extern static int CloseWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll", CallingConvention =
+ CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public extern static int SetWindowPos (
+ IntPtr hWnd, IntPtr hWndInsertAfter,
+ int X, int Y, int cx, int cy, int uFlags);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern int MessageBoxA (
+ IntPtr hWnd, string pText, string pCaption, uint uType);
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr SetParent (
+ IntPtr hWndChild, IntPtr hWndNewParent);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr GetParent (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool SetWindowTextA (
+ IntPtr hWnd, string lpString);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool UpdateWindow (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern uint GetBkColor (IntPtr hdc);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern uint SetBkColor (IntPtr hdc, uint crColor);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr GetDC (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern int ReleaseDC (IntPtr hWnd, IntPtr hDC);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr GetFocus();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr SetFocus (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool IsWindowEnabled (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool EnableWindow (
+ IntPtr hWnd, bool bEnable);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool GetWindowRect (
+ IntPtr hWnd, ref RECT lpRect);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool GetClientRect (
+ IntPtr hWnd, ref RECT lpRect);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool InvalidateRect (
+ IntPtr hWnd, ref RECT lpRect, bool bErase);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr GetCapture ();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern IntPtr SetCapture (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool ReleaseCapture ();
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern int GetWindowTextA (
+ IntPtr hWnd, ref String lpString, int nMaxCount);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern int GetWindowTextLengthA (IntPtr hWnd);
+
+ [DllImport ("user32.dll",
+ CallingConvention = CallingConvention.StdCall,
+ CharSet = CharSet.Auto)]
+ public static extern bool GetCursorPos (ref POINT lpPoint);
+
+
+
+ // Window Messages
+ public const uint WM_NULL = 0x0000;
+ public const uint WM_CREATE = 0x0001;
+ public const uint WM_DESTROY = 0x0002;
+ public const uint WM_MOVE = 0x0003;
+ public const uint WM_SIZEWAIT = 0x0004;
+ public const uint WM_SIZE = 0x0005;
+ public const uint WM_ACTIVATE = 0x0006;
+ public const uint WM_SETFOCUS = 0x0007;
+ public const uint WM_KILLFOCUS = 0x0008;
+ public const uint WM_SETVISIBLE = 0x0009;
+ public const uint WM_ENABLE = 0x000a;
+ public const uint WM_SETREDRAW = 0x000b;
+ public const uint WM_SETTEXT = 0x000c;
+ public const uint WM_GETTEXT = 0x000d;
+ public const uint WM_GETTEXTLENGTH = 0x000e;
+ public const uint WM_PAINT = 0x000f;
+ public const uint WM_CLOSE = 0x0010;
+ public const uint WM_QUERYENDSESSION = 0x0011;
+ public const uint WM_QUIT = 0x0012;
+ public const uint WM_QUERYOPEN = 0x0013;
+ public const uint WM_ERASEBKGND = 0x0014;
+ public const uint WM_SYSCOLORCHANGE = 0x0015;
+ public const uint WM_ENDSESSION = 0x0016;
+ public const uint WM_SYSTEMERROR = 0x0017;
+ public const uint WM_SHOWWINDOW = 0x0018;
+ public const uint WM_CTLCOLOR = 0x0019;
+ public const uint WM_WININICHANGE = 0x001a;
+ public const uint WM_SETTINGCHANGE = WM_WININICHANGE;
+ public const uint WM_DEVMODECHANGE = 0x001b;
+ public const uint WM_ACTIVATEAPP = 0x001c;
+ public const uint WM_FONTCHANGE = 0x001d;
+ public const uint WM_TIMECHANGE = 0x001e;
+ public const uint WM_CANCELMODE = 0x001f;
+ public const uint WM_SETCURSOR = 0x0020;
+ public const uint WM_MOUSEACTIVATE = 0x0021;
+ public const uint WM_CHILDACTIVATE = 0x0022;
+ public const uint WM_QUEUESYNC = 0x0023;
+ public const uint WM_GETMINMAXINFO = 0x0024;
+
+ public const uint WM_PAINTICON = 0x0026;
+ public const uint WM_ICONERASEBKGND = 0x0027;
+ public const uint WM_NEXTDLGCTL = 0x0028;
+ public const uint WM_ALTTABACTIVE = 0x0029;
+ public const uint WM_SPOOLERSTATUS = 0x002a;
+ public const uint WM_DRAWITEM = 0x002b;
+ public const uint WM_MEASUREITEM = 0x002c;
+ public const uint WM_DELETEITEM = 0x002d;
+ public const uint WM_VKEYTOITEM = 0x002e;
+ public const uint WM_CHARTOITEM = 0x002f;
+ public const uint WM_SETFONT = 0x0030;
+ public const uint WM_GETFONT = 0x0031;
+ public const uint WM_SETHOTKEY = 0x0032;
+ public const uint WM_GETHOTKEY = 0x0033;
+ public const uint WM_FILESYSCHANGE = 0x0034;
+ public const uint WM_ISACTIVEICON = 0x0035;
+ public const uint WM_QUERYPARKICON = 0x0036;
+ public const uint WM_QUERYDRAGICON = 0x0037;
+ public const uint WM_QUERYSAVESTATE = 0x0038;
+ public const uint WM_COMPAREITEM = 0x0039;
+ public const uint WM_TESTING = 0x003a;
+
+ public const uint WM_OTHERWINDOWCREATED = 0x003c;
+ public const uint WM_OTHERWINDOWDESTROYED = 0x003d;
+ public const uint WM_ACTIVATESHELLWINDOW = 0x003e;
+
+ public const uint WM_COMPACTING = 0x0041;
+
+ public const uint WM_COMMNOTIFY = 0x0044;
+ public const uint WM_WINDOWPOSCHANGING = 0x0046;
+ public const uint WM_WINDOWPOSCHANGED = 0x0047;
+ public const uint WM_POWER = 0x0048;
+
+ /* Win32 4.0 messages */
+ public const uint WM_COPYDATA = 0x004a;
+ public const uint WM_CANCELJOURNAL = 0x004b;
+ public const uint WM_NOTIFY = 0x004e;
+ public const uint WM_INPUTLANGCHANGEREQUEST = 0x0050;
+ public const uint WM_INPUTLANGCHANGE = 0x0051;
+ public const uint WM_TCARD = 0x0052;
+ public const uint WM_HELP = 0x0053;
+ public const uint WM_USERCHANGED = 0x0054;
+ public const uint WM_NOTIFYFORMAT = 0x0055;
+
+ public const uint WM_CONTEXTMENU = 0x007b;
+ public const uint WM_STYLECHANGING = 0x007c;
+ public const uint WM_STYLECHANGED = 0x007d;
+ public const uint WM_DISPLAYCHANGE = 0x007e;
+ public const uint WM_GETICON = 0x007f;
+ public const uint WM_SETICON = 0x0080;
+
+ /* Non-client system messages */
+ public const uint WM_NCCREATE = 0x0081;
+ public const uint WM_NCDESTROY = 0x0082;
+ public const uint WM_NCCALCSIZE = 0x0083;
+ public const uint WM_NCHITTEST = 0x0084;
+ public const uint WM_NCPAINT = 0x0085;
+ public const uint WM_NCACTIVATE = 0x0086;
+
+ public const uint WM_GETDLGCODE = 0x0087;
+ public const uint WM_SYNCPAINT = 0x0088;
+ public const uint WM_SYNCTASK = 0x0089;
+
+ /* Non-client mouse messages */
+ public const uint WM_NCMOUSEMOVE = 0x00a0;
+ public const uint WM_NCLBUTTONDOWN = 0x00a1;
+ public const uint WM_NCLBUTTONUP = 0x00a2;
+ public const uint WM_NCLBUTTONDBLCLK = 0x00a3;
+ public const uint WM_NCRBUTTONDOWN = 0x00a4;
+ public const uint WM_NCRBUTTONUP = 0x00a5;
+ public const uint WM_NCRBUTTONDBLCLK = 0x00a6;
+ public const uint WM_NCMBUTTONDOWN = 0x00a7;
+ public const uint WM_NCMBUTTONUP = 0x00a8;
+ public const uint WM_NCMBUTTONDBLCLK = 0x00a9;
+
+ public const uint WM_NCXBUTTONDOWN = 0x00ab;
+ public const uint WM_NCXBUTTONUP = 0x00ac;
+ public const uint WM_NCXBUTTONDBLCLK = 0x00ad;
+
+ /* Keyboard messages */
+ public const uint WM_KEYDOWN = 0x0100;
+ public const uint WM_KEYUP = 0x0101;
+ public const uint WM_CHAR = 0x0102;
+ public const uint WM_DEADCHAR = 0x0103;
+ public const uint WM_SYSKEYDOWN = 0x0104;
+ public const uint WM_SYSKEYUP = 0x0105;
+ public const uint WM_SYSCHAR = 0x0106;
+ public const uint WM_SYSDEADCHAR = 0x0107;
+ public const uint WM_KEYFIRST = WM_KEYDOWN;
+ public const uint WM_KEYLAST = 0x0108;
+
+ /* Win32 4.0 messages for IME */
+ public const uint IME_STARTCOMPOSITION = 0x010d;
+ public const uint IME_ENDCOMPOSITION = 0x010e;
+ public const uint IME_COMPOSITION = 0x010f;
+ public const uint IME_KEYLAST = 0x010f;
+
+ public const uint WM_INITDIALOG = 0x0110;
+ public const uint WM_COMMAND = 0x0111;
+ public const uint WM_SYSCOMMAND = 0x0112;
+ public const uint WM_TIMER = 0x0113;
+ public const uint WM_SYSTIMER = 0x0118;
+
+ /* scroll messages */
+ public const uint WM_HSCROLL = 0x0114;
+ public const uint WM_VSCROLL = 0x0115;
+
+ /* Menu messages */
+ public const uint WM_INITMENU = 0x0116;
+ public const uint WM_INITMENUPOPUP = 0x0117;
+
+ public const uint WM_MENUSELECT = 0x011F;
+ public const uint WM_MENUCHAR = 0x0120;
+ public const uint WM_ENTERIDLE = 0x0121;
+
+ public const uint WM_MENURBUTTONUP = 0x0122;
+ public const uint WM_MENUDRAG = 0x0123;
+ public const uint WM_MENUGETOBJECT = 0x0124;
+ public const uint WM_UNINITMENUPOPUP = 0x0125;
+ public const uint WM_MENUCOMMAND = 0x0126;
+
+ public const uint WM_CHANGEUISTATE = 0x0127;
+ public const uint WM_UPDATEUISTATE = 0x0128;
+ public const uint WM_QUERYUISTATE = 0x0129;
+
+ public const uint WM_LBTRACKPOINT = 0x0131;
+
+ /* Win32 CTLCOLOR messages */
+ public const uint WM_CTLCOLORMSGBOX = 0x0132;
+ public const uint WM_CTLCOLOREDIT = 0x0133;
+ public const uint WM_CTLCOLORLISTBOX = 0x0134;
+ public const uint WM_CTLCOLORBTN = 0x0135;
+ public const uint WM_CTLCOLORDLG = 0x0136;
+ public const uint WM_CTLCOLORSCROLLBAR = 0x0137;
+ public const uint WM_CTLCOLORSTATIC = 0x0138;
+
+ /* Mouse messages */
+ public const uint WM_MOUSEMOVE = 0x0200;
+ public const uint WM_LBUTTONDOWN = 0x0201;
+ public const uint WM_LBUTTONUP = 0x0202;
+ public const uint WM_LBUTTONDBLCLK = 0x0203;
+ public const uint WM_RBUTTONDOWN = 0x0204;
+ public const uint WM_RBUTTONUP = 0x0205;
+ public const uint WM_RBUTTONDBLCLK = 0x0206;
+ public const uint WM_MBUTTONDOWN = 0x0207;
+ public const uint WM_MBUTTONUP = 0x0208;
+ public const uint WM_MBUTTONDBLCLK = 0x0209;
+ public const uint WM_MOUSEWHEEL = 0x020A;
+ public const uint WM_XBUTTONDOWN = 0x020B;
+ public const uint WM_XBUTTONUP = 0x020C;
+ public const uint WM_XBUTTONDBLCLK = 0x020D;
+
+ public const uint WM_MOUSEFIRST = 0x0200;
+ public const uint WM_MOUSELAST = 0x020D;
+
+ public const uint WM_WHEEL_DELTA = 120;
+ public const uint WM_WHEEL_PAGESCROLL = 65535;
+ public const uint WM_PARENTNOTIFY = 0x0210;
+ public const uint WM_ENTERMENULOOP = 0x0211;
+ public const uint WM_EXITMENULOOP = 0x0212;
+ public const uint WM_NEXTMENU = 0x0213;
+
+ /* Win32 4.0 messages */
+ public const uint WM_SIZING = 0x0214;
+ public const uint WM_CAPTURECHANGED = 0x0215;
+ public const uint WM_MOVING = 0x0216;
+ public const uint WM_POWERBROADCAST = 0x0218;
+ public const uint WM_DEVICECHANGE = 0x0219;
+
+ /* wParam for WM_SIZING message */
+ public const uint WMSZ_LEFT = 1;
+ public const uint WMSZ_RIGHT = 2;
+ public const uint WMSZ_TOP = 3;
+ public const uint WMSZ_TOPLEFT = 4;
+ public const uint WMSZ_TOPRIGHT = 5;
+ public const uint WMSZ_BOTTOM = 6;
+ public const uint WMSZ_BOTTOMLEFT = 7;
+ public const uint WMSZ_BOTTOMRIGHT = 8;
+
+ /* MDI messages */
+ public const uint WM_MDICREATE = 0x0220;
+ public const uint WM_MDIDESTROY = 0x0221;
+ public const uint WM_MDIACTIVATE = 0x0222;
+ public const uint WM_MDIRESTORE = 0x0223;
+ public const uint WM_MDINEXT = 0x0224;
+ public const uint WM_MDIMAXIMIZE = 0x0225;
+ public const uint WM_MDITILE = 0x0226;
+ public const uint WM_MDICASCADE = 0x0227;
+ public const uint WM_MDIICONARRANGE = 0x0228;
+ public const uint WM_MDIGETACTIVE = 0x0229;
+ public const uint WM_MDIREFRESHMENU = 0x0234;
+
+ /* D&D messages */
+ public const uint WM_DROPOBJECT = 0x022A;
+ public const uint WM_QUERYDROPOBJECT = 0x022B;
+ public const uint WM_BEGINDRAG = 0x022C;
+ public const uint WM_DRAGLOOP = 0x022D;
+ public const uint WM_DRAGSELECT = 0x022E;
+ public const uint WM_DRAGMOVE = 0x022F;
+ public const uint WM_MDISETMENU = 0x0230;
+
+ public const uint WM_ENTERSIZEMOVE = 0x0231;
+ public const uint WM_EXITSIZEMOVE = 0x0232;
+ public const uint WM_DROPFILES = 0x0233;
+
+
+ /* Win32 4.0 messages for IME */
+ public const uint IME_SETCONTEXT = 0x0281;
+ public const uint IME_NOTIFY = 0x0282;
+ public const uint IME_CONTROL = 0x0283;
+ public const uint IME_COMPOSITIONFULL = 0x0284;
+ public const uint IME_SELECT = 0x0285;
+ public const uint IME_CHAR = 0x0286;
+ /* Win32 5.0 messages for IME */
+ public const uint IME_REQUEST = 0x0288;
+
+ /* Win32 4.0 messages for IME */
+ public const uint IME_KEYDOWN = 0x0290;
+ public const uint IME_KEYUP = 0x0291;
+
+ /* Clipboard command messages */
+ public const uint WM_CUT = 0x0300;
+ public const uint WM_COPY = 0x0301;
+ public const uint WM_PASTE = 0x0302;
+ public const uint WM_CLEAR = 0x0303;
+ public const uint WM_UNDO = 0x0304;
+
+ /* Clipboard owner messages */
+ public const uint WM_RENDERFORMAT = 0x0305;
+ public const uint WM_RENDERALLFORMATS = 0x0306;
+ public const uint WM_DESTROYCLIPBOARD = 0x0307;
+
+ /* Clipboard viewer messages */
+ public const uint WM_DRAWCLIPBOARD = 0x0308;
+ public const uint WM_PAINTCLIPBOARD = 0x0309;
+ public const uint WM_VSCROLLCLIPBOARD = 0x030A;
+ public const uint WM_SIZECLIPBOARD = 0x030B;
+ public const uint WM_ASKCBFORMATNAME = 0x030C;
+ public const uint WM_CHANGECBCHAIN = 0x030D;
+ public const uint WM_HSCROLLCLIPBOARD = 0x030E;
+
+ public const uint WM_QUERYNEWPALETTE = 0x030F;
+ public const uint WM_PALETTEISCHANGING = 0x0310;
+ public const uint WM_PALETTECHANGED = 0x0311;
+ public const uint WM_HOTKEY = 0x0312;
+
+ public const uint WM_PRINT = 0x0317;
+ public const uint WM_PRINTCLIENT = 0x0318;
+
+ public const uint WM_PENWINFIRST = 0x0380;
+ public const uint WM_PENWINLAST = 0x038F;
+
+
+ public const uint WM_APP = 0x8000;
+
+ public const int WM_MOUSEHOVER = 0x02A1;
+ public const int WM_MOUSELEAVE = 0x02A3;
+
+ // Window Styles
+ public const uint WS_OVERLAPPED = 0x00000000;
+ public const uint WS_POPUP = 0x80000000;
+ public const uint WS_CHILD = 0x40000000;
+ public const uint WS_MINIMIZE = 0x20000000;
+ public const uint WS_VISIBLE = 0x10000000;
+ public const uint WS_DISABLED = 0x08000000;
+ public const uint WS_CLIPSIBLINGS = 0x04000000;
+ public const uint WS_CLIPCHILDREN = 0x02000000;
+ public const uint WS_MAXIMIZE = 0x01000000;
+ public const uint WS_CAPTION = 0x00C00000;
+ public const uint WS_BORDER = 0x00800000;
+ public const uint WS_DLGFRAME = 0x00400000;
+ public const uint WS_VSCROLL = 0x00200000;
+ public const uint WS_HSCROLL = 0x00100000;
+ public const uint WS_SYSMENU = 0x00080000;
+ public const uint WS_THICKFRAME = 0x00040000;
+ public const uint WS_GROUP = 0x00020000;
+ public const uint WS_TABSTOP = 0x00010000;
+ public const uint WS_MINIMIZEBOX = 0x00020000;
+ public const uint WS_MAXIMIZEBOX = 0x00010000;
+ public const uint WS_OVERLAPPEDWINDOW = WS_OVERLAPPED |
+ WS_CAPTION | WS_SYSMENU | WS_THICKFRAME|
+ WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
+
+ // ShowWindow types
+ public const uint SW_HIDE = 0;
+ public const uint SW_SHOWNORMAL = 1;
+ public const uint SW_NORMAL = 1;
+ public const uint SW_SHOWMINIMIZED = 2;
+ public const uint SW_SHOWMAXIMIZED = 3;
+ public const uint SW_MAXIMIZE = 3;
+ public const uint SW_SHOWNOACTIVATE = 4;
+ public const uint SW_SHOW = 5;
+ public const uint SW_MINIMIZE = 6;
+ public const uint SW_SHOWMINNOACTIVE = 7;
+ public const uint SW_SHOWNA = 8;
+ public const uint SW_RESTORE = 9;
+ public const uint SW_SHOWDEFAULT = 10;
+ public const uint SW_FORCEMINIMIZE = 11;
+ public const uint SW_MAX = 11;
+ public const uint SW_NORMALNA = 0xCC;
+
+ // SetWindowPos types
+ public const uint SWP_NOSIZE = 0x0001;
+ public const uint SWP_NOMOVE = 0x0002;
+ public const uint SWP_NOZORDER = 0x0004;
+ public const uint SWP_NOREDRAW = 0x0008;
+ public const uint SWP_NOACTIVATE = 0x0010;
+ public const uint SWP_FRAMECHANGED = 0x0020;
+ public const uint SWP_SHOWWINDOW = 0x0040;
+ public const uint SWP_HIDEWINDOW = 0x0080;
+ public const uint SWP_NOCOPYBITS = 0x0100;
+ public const uint SWP_NOOWNERZORDER = 0x0200;
+ public const uint SWP_DRAWFRAME = SWP_FRAMECHANGED;
+ public const uint SWP_NOREPOSITION = SWP_NOOWNERZORDER;
+ public const uint SWP_NOSENDCHANGING = 0x0400;
+ public const uint SWP_DEFERERASE = 0x2000;
+ public const uint SWP_ASYNCWINDOWPOS = 0x4000;
+
+
+ public const uint CS_VREDRAW = 0x0001;
+ public const uint CS_HREDRAW = 0x0002;
+ public const uint CS_KEYCVTWINDOW = 0x0004;
+ public const uint CS_DBLCLKS = 0x0008;
+ public const uint CS_OWNDC = 0x0020;
+ public const uint CS_CLASSDC = 0x0040;
+ public const uint CS_PARENTDC = 0x0080;
+ public const uint CS_NOKEYCVT = 0x0100;
+ public const uint CS_NOCLOSE = 0x0200;
+ public const uint CS_SAVEBITS = 0x0800;
+ public const uint CS_BYTEALIGNCLIENT = 0x1000;
+ public const uint CS_BYTEALIGNWINDOW = 0x2000;
+ public const uint CS_GLOBALCLASS = 0x4000;
+ public const uint CS_IME = 0x00010000;
+
+ // PeekMessage types
+ public const uint PM_NOREMOVE = 0x0000;
+ public const uint PM_REMOVE = 0x0001;
+ public const uint PM_NOYIELD = 0x0002;
+
+ // MessageBox types
+ public const uint MB_OK = 0x00000000;
+ public const uint MB_OKCANCEL = 0x00000001;
+ public const uint MB_ABORTRETRYIGNORE = 0x00000002;
+ public const uint MB_YESNOCANCEL = 0x00000003;
+ public const uint MB_YESNO = 0x00000004;
+ public const uint MB_RETRYCANCEL = 0x00000005;
+ public const uint MB_TYPEMASK = 0x0000000F;
+
+ public const int HWND_TOP = 0;
+ public const int HWND_BOTTOM = 1;
+ public const int HWND_TOPMOST = -1;
+ public const int HWND_NOTOPMOST = -2;
+ public const int HWND_MESSAGE = -3;
+
+ // Static Control Styles
+ public const int SS_LEFT = 0x00000000L;
+ public const int SS_CENTER = 0x00000001L;
+ public const int SS_RIGHT = 0x00000002L;
+ public const int SS_ICON = 0x00000003L;
+ public const int SS_BLACKRECT = 0x00000004L;
+ public const int SS_GRAYRECT = 0x00000005L;
+ public const int SS_WHITERECT = 0x00000006L;
+ public const int SS_BLACKFRAME = 0x00000007L;
+ public const int SS_GRAYFRAME = 0x00000008L;
+ public const int SS_WHITEFRAME = 0x00000009L;
+
+ public const int SS_SIMPLE = 0x0000000BL;
+ public const int SS_LEFTNOWORDWRAP = 0x0000000CL;
+
+ public const int SS_OWNERDRAW = 0x0000000DL;
+ public const int SS_BITMAP = 0x0000000EL;
+ public const int SS_ENHMETAFILE = 0x0000000FL;
+
+ public const int SS_ETCHEDHORZ = 0x00000010L;
+ public const int SS_ETCHEDVERT = 0x00000011L;
+ public const int SS_ETCHEDFRAME = 0x00000012L;
+ public const int SS_TYPEMASK = 0x0000001FL;
+
+ public const int SS_NOPREFIX = 0x00000080L;
+ public const int SS_NOTIFY = 0x00000100L;
+ public const int SS_CENTERIMAGE = 0x00000200L;
+ public const int SS_RIGHTJUST = 0x00000400L;
+ public const int SS_REALSIZEIMAGE = 0x00000800L;
+ public const int SS_SUNKEN = 0x00001000L;
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/changelog b/mcs/class/System.Windows.Forms/WINELib/changelog
new file mode 100644
index 00000000000..38cf0dceda6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/changelog
@@ -0,0 +1,193 @@
+ 2002-10-18 DennisHayes <dennish@raytek.com>
+
+ * Application.cs
+ * ContainerControl.cs
+ * Control.cs
+ * Form.cs
+ * Label.cs
+
+ * Added //Compact Framework comment to members that belong.
+ * A CE subset of SWF might not be that difficult to reach.
+ * John has already completed *Most* of the CE members in these files.
+ *
+ * also added a couple of members that seem to have not been
+ s stubbed, hope I did not break the build, unable to test
+
+ 2002-10-13 John Sohn <jsohn@columbus.rr.com>
+ * Button.cs:
+ * Label.cs:
+ * Control.cs:
+ * Form.cs: fixed location of elements on Form
+ * FormTest.cs: changed location of Label and Button on Form
+
+ 2002-10-12 John Sohn <jsohn@columbus.rr.com>
+ * ButtonBase.cs:
+ * Button.cs: initial implementation of Button class
+ * FormTest.cs: added Button to form
+ * makefile: added Button.cs and ButtonBase.cs to makefile
+
+ 2002-10-12 John Sohn <jsohn@columbus.rr.com>
+ * Control.cs:
+ * Label.cs: changed CreateHandle method to use CreateParams property
+ * README: added instructions for building and using project
+ * makefile: removed monostart.c from makefile
+ * monostart.c:
+ * test.sh
+ * build.sh: no longer used, removed
+
+ 2002-9-29 John Sohn <jsohn@columbus.rr.com>
+ * Form.cs: Site property now calls base class
+ * FormTest.cs: set label position on test form
+ * Label.cs: implemented more methods
+ * makefile: stub no longer links to gc library
+
+ 2002-9-24 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs: Run method now creates the Form
+ * ContainerControl.cs: no implementation but made sure overridden
+ methods call the base class
+ * Control.cs: Implemented several more methods in the implementation
+ of this class. Implemented ControlCollection, allowing controls
+ to be added and removed from the Form.
+ * Form.cs: Implemented more methods of the Form class
+ * FormTest.cs: Added code to draw and display a Label
+ * Label.cs: Initial implementation of Label class. The Label can
+ be added and displayed on a Form.
+ * NativeWindow.cs: modified debugging (console) output
+ * ScrollableControl.cs: no implementation but made sure overridden
+ methods call the base class
+ * Win32.cs: added more Win32 imports and definitions
+ * monostub.c: now store the application HINSTANCE
+ * makefile: added Label.cs to makefile
+
+ 2002-9-16 John Sohn <jsohn@columbus.rr.com>
+ * Control.cs:
+ * ScrollableControl.cs
+ * Form.cs: added Win32 implementation to more methods and properties
+ * MessageBox.cs: fixed typo
+ * makefile: now using pkg-config for including and linking glib
+
+ 2002-9-3 John Sohn <jsohn@columbus.rr.com>
+ * Control.cs: mapped more of the functions to the Win32 API
+ * Win32.cs: added more Win32 imports and definitions
+
+ 2002-9-1 John Sohn <jsohn@columbus.rr.com>
+ * MessageBox.cs: added mostly complete implementation of the
+ MessageBox class
+ * Application.cs: completed implementation of Run methods, implemented
+ message handler functionality
+ * Form.cs: implemented the Close event, allows the Application class to
+ receive notification for shutting down the application
+ * FormTest.cs: added additional functionality to test most methods
+ currently implemented in the Application and Form class
+ * NativeWindowTest.cs: fixed methods which received the MSG structure,
+ previously was using an integer type instead of the struct
+ * Win32.cs: added more Win32 imports and definitions
+ * makefile: added the MessageBox.cs class to the build
+
+ 2002-8-30 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs: removed _ApplicationWndProc, we no longer need to
+ have the WndProc callback in the stub application
+ * Control.cs: use new registered class, implemented WndProc
+ functionality
+ * NativeWindow.cs: Now using the WndProc handler again. The window
+ class is now registered in C# code instead of the helper function
+ in the stub shared library.
+ * NativeWindowTest.cs: using the new registered class
+ * Win32.cs: added more Win32 definitions, added DllImport and helper
+ function in stub application to register the window class.
+ * monostart.c: no longer being used, tagged for deletion. no longer
+ registering the class and WNDPROC inside the stub application
+ * monostub.c: Simplified the stub application and am now registering
+ the window class and WNDPROC callback in C# code. This is now the only
+ file that is used in the stub application. In order to simplify the
+ code the #include <windows.h> was removed due to overlap with the
+ jit.h include file but some definitions from windows.h are included
+ in this file. WinMain and MonoRegisterClass are the only functions
+ that exist in this file and application.
+ * makefile: removed monostart.c from the build, added Test.exe to
+ the build
+
+ 2002-8-21 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs:
+ * Control.cs:
+ * Form.cs:
+ * NativeWindow.cs:
+ * NativeWindowTest.cs: updated code to build on latest mcs in cvs
+
+ 2002-8-21 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs:
+ * NativeWindow.cs:
+ * NativeWindowTest.cs: compliant with new DllImports in Win32.cs
+ * makefile: correctly links libmono.a
+
+ 2002-8-20 John Sohn <jsohn@columbus.rr.com>
+ * Win32.cs: now uses correct Win32 imports and defs. Fixed file provded
+ by Dennis Hayes (dennish@raytek.com)
+ * Application.cs: fixed Win32 API calls
+ * Control.cs: commented out functions which broked build
+ but are not currently implemented
+ * DrawItemEventHandler.cs:
+ * MenuItem.cs: added empty classes that allows build to continue
+ without commenting out references to them in the source
+ * NativeWindow.cs: fixed Win32 API calls
+
+ 2002-8-19 John Sohn <jsohn@columbus.rr.com>
+ * monostart.c: fixed link from monostub WndProc to Application
+ class WndProc
+ * FormTest.cs: test of class NOT derived from the Form class
+
+ 2002-8-18 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs:
+ * ContainerControl.cs:
+ * Control.cs:
+ * Form.cs:
+ * FormTest.cs:
+ * NativeWindow.cs:
+ * NativeWindowTest.cs:
+ * ScrollableControl.cs:
+ * Win32.cs: Updated to better conform to Mono coding conventions
+
+ 2002-8-16 John Sohn <jsohn@columbus.rr.com>
+ * Application.cs: start of implementation, implements Run(Form) and
+ handles WndProc as called from monostub WINE application
+ * Font.cs: empty class that allows code with references to
+ Font to compile
+ * IContainerControl.cs: empty class the allows code with references to
+ IContainerControl to compile
+ * ContainerControl.cs: start of implementation, a base class of Form
+ * Form.cs: start of implementation, converts most messages to
+ appropriate On handlers
+ * NativeWindow.cs: almost complete implementation of NativeWindow class
+ * Win32.cs: central point for DllImport and WineLib defs
+ * Control.cs: start of implementation, a base class of Form
+ * DrawItemEventArgs.cs - empty class the allows code with references
+ to DrawItemEventArgs to compile
+ * IAccessible.cs - empty class the allows code with references to
+ IAccessible to compile
+ * ScrollableControl.cs: start of implementation, a base class of Form
+ * FormTest.cs - test application for the Form class
+ * NativeWindowTest.cs - test application for the NativeWindowTest
+ * monostub.c - added WNDCLASS registration
+ * monosart.c - added WndProc handler for messages, dispatch messages
+ to C# code using Mono embedded API
+ * makefile - Now uses a real makefile to build monostub.exe.so,
+ System.Windows.Forms, and test applications. Based on the makefile
+ used in the Gtk target of Windows.Forms. The build.sh script is
+ no longer maintained.
+
+ 2002-8-7 DennisHayes <dennish@raytek.com>
+
+ * Started changelog
+
+ 2002-8-4 DennisHayes <dennish@raytek.com>
+ Checked in for John Sohn <jsohn@columbus.rr.com
+
+ * build.sh
+ * changelog
+ * monostart.c
+ * monostub.c
+ * monostub.exe.dbg.c
+ * monostub.exe.spec.c
+ * Test.cs
+ * test.sh
+ * Experiment to get first form working using WINELIB
diff --git a/mcs/class/System.Windows.Forms/WINELib/makefile b/mcs/class/System.Windows.Forms/WINELib/makefile
new file mode 100644
index 00000000000..cc56d942d9c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/makefile
@@ -0,0 +1,156 @@
+CSC=mcs
+X11R6_INCLUDE=/usr/X11R6/include
+WINE_INCLUDE=/usr/local/include/wine
+WINE_LIB=/usr/local/lib/wine
+GLIB20_INCLUDE=`pkg-config --cflags glib-2.0` `pkg-config --cflags gmodule-2.0`
+GLIB20_LIB=`pkg-config --libs glib-2.0` `pkg-config --libs gmodule-2.0`
+# GLIB20_LIB_INCLUDE=/usr/lib/glib-2.0/include
+LIBMONO=/usr/local/lib/libmono.a
+SOURCES = \
+ Win32.cs \
+ Font.cs \
+ MenuItem.cs \
+ DrawItemEventArgs.cs \
+ DrawItemEventHandler.cs \
+ ../System.Windows.Forms/BorderStyle.cs \
+ ../System.Windows.Forms/Message.cs \
+ ../System.Windows.Forms/CreateParams.cs \
+ ../System.Windows.Forms/MdiLayout.cs \
+ ../System.Windows.Forms/InputLanguage.cs \
+ ../System.Windows.Forms/InputLanguageCollection.cs \
+ ../System.Windows.Forms/InputLanguageChangedEventArgs.cs \
+ ../System.Windows.Forms/InputLanguageChangingEventArgs.cs \
+ ../System.Windows.Forms/PaintEventArgs.cs \
+ ../System.Windows.Forms/Keys.cs \
+ ../System.Windows.Forms/BoundsSpecified.cs \
+ ../System.Windows.Forms/RightToLeft.cs \
+ ../System.Windows.Forms/Shortcut.cs \
+ ../System.Windows.Forms/MeasureItemEventArgs.cs \
+ ../System.Windows.Forms/SizeGripStyle.cs \
+ ../System.Windows.Forms/FormStartPosition.cs \
+ ../System.Windows.Forms/FormWindowState.cs \
+ ../System.Windows.Forms/ImeMode.cs \
+ ../System.Windows.Forms/InputLanguageChangedEventHandler.cs \
+ ../System.Windows.Forms/MeasureItemEventHandler.cs \
+ ../System.Windows.Forms/InputLanguageChangingEventHandler.cs \
+ ../System.Windows.Forms/DrawItemState.cs \
+ ../System.Windows.Forms/ComVisible.cs \
+ ../System.Windows.Forms/DialogResult.cs \
+ ../System.Windows.Forms/IButtonControl.cs \
+ ../System.Windows.Forms/FormBorderStyle.cs \
+ ../System.Windows.Forms/AccessibleEvents.cs \
+ ../System.Windows.Forms/IWin32Window.cs \
+ ../System.Windows.Forms/DragDropEffects.cs \
+ ../System.Windows.Forms/ControlStyles.cs \
+ ../System.Windows.Forms/ControlEventArgs.cs \
+ ../System.Windows.Forms/DragEventArgs.cs \
+ ../System.Windows.Forms/GiveFeedbackEventArgs.cs \
+ ../System.Windows.Forms/HelpEventArgs.cs \
+ ../System.Windows.Forms/InvalidateEventArgs.cs \
+ ../System.Windows.Forms/KeyEventArgs.cs \
+ ../System.Windows.Forms/KeyPressEventArgs.cs \
+ ../System.Windows.Forms/MouseEventArgs.cs \
+ ../System.Windows.Forms/LayoutEventArgs.cs \
+ ../System.Windows.Forms/QueryContinueDragEventArgs.cs \
+ ../System.Windows.Forms/HorizontalAlignment.cs \
+ ../System.Windows.Forms/LeftRightAlignment.cs \
+ ../System.Windows.Forms/AccessibleRole.cs \
+ ../System.Windows.Forms/AnchorStyles.cs \
+ ../System.Windows.Forms/Cursor.cs \
+ ../System.Windows.Forms/BaseCollection.cs \
+ ../System.Windows.Forms/DockStyle.cs \
+ ../System.Windows.Forms/ControlEventHandler.cs \
+ ../System.Windows.Forms/MouseButtons.cs \
+ ../System.Windows.Forms/UICues.cs \
+ ../System.Windows.Forms/UICuesEventArgs.cs \
+ ../System.Windows.Forms/UICuesEventHandler.cs \
+ ../System.Windows.Forms/DragEventHandler.cs \
+ ../System.Windows.Forms/HelpEventHandler.cs \
+ ../System.Windows.Forms/GiveFeedbackEventHandler.cs \
+ ../System.Windows.Forms/InvalidateEventHandler.cs \
+ ../System.Windows.Forms/KeyEventHandler.cs \
+ ../System.Windows.Forms/KeyPressEventHandler.cs \
+ ../System.Windows.Forms/LayoutEventHandler.cs \
+ ../System.Windows.Forms/MouseEventHandler.cs \
+ ../System.Windows.Forms/PaintEventHandler.cs \
+ ../System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs \
+ ../System.Windows.Forms/QueryContinueDragEventHandler.cs \
+ ../System.Windows.Forms/IDataObject.cs \
+ ../System.Windows.Forms/DragAction.cs \
+ ../System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs \
+ ../System.Windows.Forms/IMessageFilter.cs \
+ ../System.Windows.Forms/ApplicationContext.cs \
+ ../System.Windows.Forms/MessageBoxButtons.cs \
+ ../System.Windows.Forms/MessageBoxIcon.cs \
+ ../System.Windows.Forms/MessageBoxDefaultButton.cs \
+ ../System.Windows.Forms/MessageBoxOptions.cs \
+ ../System.Windows.Forms/FlatStyle.cs \
+ ../System.Windows.Forms/ImageListStreamer.cs \
+ ../System.Windows.Forms/ImageList.cs \
+ ../System.Windows.Forms/ColorDepth.cs \
+ IContainerControl.cs \
+ Control.cs \
+ ScrollableControl.cs \
+ ContainerControl.cs \
+ Label.cs \
+ Form.cs \
+ Application.cs \
+ NativeWindow.cs \
+ ButtonBase.cs \
+ Button.cs \
+ MessageBox.cs
+
+myall:
+ @echo This directory is now obsolete, its only used for reference purposes
+ @echo Please use the ../System.Windows.Forms directory now
+ @echo Read the mcs/class/System.Windows.Forms/README file for details.
+
+all: monostub.exe.so System.Windows.Forms.dll NativeWindowTest.exe \
+ FormTest.exe Test.exe
+
+##########################################################################
+# build the mono stub application
+monostub.exe.so: monostub.o monostub.exe.spec.o monostub.exe.dbg.o
+ gcc -shared -Wl,-Bsymbolic -D_REENTRANT -DWINELIB -o monostub.exe.so \
+ monostub.exe.spec.o \
+ monostub.o monostub.exe.dbg.o -I/usr/local/include \
+ $(GLIB20_INCUDE) -L/usr/lib \
+ $(LIBMONO) -lgc \
+ -lwine -lntdll.dll $(GLIB20_LIB) -lm -lpthread
+
+clean:
+ rm *.o monostub.exe.dbg.c monostub.exe.spec.c monostub.exe.so *.exe *.dll
+
+monostub.o: monostub.c
+ gcc -c -I. -I$(WINE_INCLUDE) $(GLIB20_INCLUDE) -g -O2 -Wall -I$(X11R6_INCLUDE) -D_REENTRANT -DWINELIB -o monostub.o monostub.c
+
+monostub.exe.tmp.o: monostub.o
+ ld -r monostub.o -o monostub.exe.tmp.o
+ strip --strip-unneeded monostub.exe.tmp.o
+
+monostub.exe.spec.c: monostub.exe.tmp.o
+ winebuild -sym monostub.exe.tmp.o -o monostub.exe.spec.c -exe monostub.exe -mgui -L$(WINE_LIB) -lcomdlg32 -lshell32 -luser32 -lgdi32 -lkernel32
+
+monostub.exe.spec.o: monostub.exe.spec.c
+ gcc -c -I. -I. -I$(WINE_INCLUDE) -g -O2 -I$(X11R6_INCLUDE) -D_REENTRANT -DWINELIB -o monostub.exe.spec.o monostub.exe.spec.c
+
+monostub.exe.dbg.c: monostub.exe.spec.o
+ winebuild -o monostub.exe.dbg.c -debug -C. monostub.c
+
+monostub.exe.dbg.o: monostub.exe.dbg.c
+ gcc -c -I. -I. -I$(WINE_INCLUDE) -g -O2 -I$(X11R6_INCLUDE) -D_REENTRANT -DWINELIB -o monostub.exe.dbg.o monostub.exe.dbg.c
+
+##########################################################################
+# build System.Windows.Forms.dll and test/sample applications
+
+Test.exe: Test.cs
+ $(CSC) Test.cs
+
+NativeWindowTest.exe: NativeWindowTest.cs System.Windows.Forms.dll
+ $(CSC) -r System.Windows.Forms.dll NativeWindowTest.cs
+
+FormTest.exe: FormTest.cs System.Windows.Forms.dll
+ $(CSC) -r System.Windows.Forms.dll FormTest.cs
+
+System.Windows.Forms.dll: $(SOURCES)
+ $(CSC) --target library -o System.Windows.Forms.dll $(SOURCES) -r System.Drawing
diff --git a/mcs/class/System.Windows.Forms/WINELib/monostub.c b/mcs/class/System.Windows.Forms/WINELib/monostub.c
new file mode 100644
index 00000000000..03e47bdb3df
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/monostub.c
@@ -0,0 +1,113 @@
+#include <mono/jit/jit.h>
+#include <stdio.h>
+
+//
+// The Mono and WINE header files have overlapping definitions in the
+// header files. Since we are only using a few functions and definitions
+// define them here to avoid conflicts.
+//
+// these are defined in jit.h
+// typedef long LONG;
+// typedef unsigned long DWORD;
+// typedef unsigned short WORD;
+// typedef UINT HANDLE;
+// typedef HINSTANCE HMODULE;
+
+#define __stdcall __attribute__((__stdcall__))
+#define CALLBACK __stdcall
+#define WINAPI __stdcall
+#define PASCAL __stdcall
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef char CHAR;
+typedef CHAR *LPSTR;
+typedef const CHAR *LPCSTR;
+
+typedef UINT WPARAM;
+typedef LONG LPARAM;
+typedef LONG LRESULT;
+typedef WORD ATOM;
+
+typedef void* HWND;
+typedef void* HINSTANCE;
+typedef void* HICON;
+typedef void* HCURSOR;
+typedef void* HBRUSH;
+
+typedef LRESULT (CALLBACK *WNDPROC) (HWND, UINT, WPARAM, LPARAM);
+
+typedef struct
+{
+ UINT style;
+ WNDPROC lpfnWndProc;
+ INT cbClsExtra;
+ INT cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCSTR lpszMenuName;
+ LPCSTR lpszClassName;
+} WNDCLASSA;
+
+ATOM WINAPI RegisterClassA (const WNDCLASSA *);
+HMODULE WINAPI GetModuleHandleA (LPCSTR);
+INT WINAPI MessageBoxExA (HWND, LPCSTR, LPCSTR, UINT, WORD);
+
+HINSTANCE applicationInstance = NULL;
+
+// register WNDCLASS for use in embeded application, this is a work around
+// for Bugzilla item #29548
+int PASCAL MonoRegisterClass (UINT style, WNDPROC lpfnWndProc, INT cbClsExtra,
+ INT cbWndExtra, HINSTANCE hInstance, HICON hIcon,
+ HCURSOR hCursor, HBRUSH hbrBackground,
+ LPCSTR lpszMenuName, LPCSTR lpszClassName)
+{
+ WNDCLASSA wc;
+ int retval = 0;
+
+ wc.lpszClassName = lpszClassName;
+ wc.lpfnWndProc = lpfnWndProc;
+ wc.style = style;
+ wc.hInstance = applicationInstance;
+ wc.hIcon = hIcon;
+ wc.hCursor = hCursor;
+ wc.hbrBackground = hbrBackground;
+ wc.lpszMenuName = lpszMenuName;
+ wc.cbClsExtra = cbClsExtra;
+ wc.cbWndExtra = cbWndExtra;
+
+ retval = RegisterClassA (&wc);
+
+ return retval;
+}
+
+int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpszCmdLine, int nCmdShow)
+{
+ MonoDomain *domain = NULL;
+ MonoAssembly *assembly = NULL;
+ int retval = 0;
+
+ applicationInstance = hInstance;
+
+ printf ("initializing JIT engine\n");
+ domain = mono_jit_init (lpszCmdLine);
+
+ printf ("opening assembly\n");
+ assembly = mono_domain_assembly_open (domain, lpszCmdLine);
+
+ if (!assembly){
+ printf("error opening assembly\n");
+ return 1;
+ }
+
+ printf ("executing assembly\n");
+ retval = mono_jit_exec (domain, assembly, 0, 0);
+
+ printf ("calling JIT cleanup\n");
+ mono_jit_cleanup (domain);
+
+ return retval;
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/tooltip.cs b/mcs/class/System.Windows.Forms/WINELib/tooltip.cs
new file mode 100644
index 00000000000..e81a2949e64
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/tooltip.cs
@@ -0,0 +1,120 @@
+//
+// System.Windows.Forms.ToolTip
+//
+// Author:
+// stubbed out by Jackson Harper (jackson@latitudegeo.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc
+//
+using System.ComponentModel;
+namespace System.Windows.Forms {
+
+ // <summary>
+ // This is only a template. Nothing is implemented yet.
+ //
+ // </summary>
+
+ public sealed class ToolTip : Component, IExtenderProvider {
+
+ //
+ // --- Public Constructors
+ //
+ [MonoTODO]
+ public ToolTip() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public ToolTip(IContainer cont) {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Public Properties
+ //
+ [MonoTODO]
+ public bool Active {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int AutomaticDelay {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int AutoPopDelay{
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int InitialDelay {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public int ReshowDelay {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ [MonoTODO]
+ public bool ShowAlways {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // --- Public Methods
+
+ [MonoTODO]
+ public void RemoveAll() {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void SetToolTip(Control control, string caption) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+ //
+ // --- Protected Methods
+ //
+
+ //inherited
+ //protected override void Dispose(bool disposing) {
+ // throw new NotImplementedException ();
+ //}
+ [MonoTODO]
+ ~ToolTip() {
+ throw new NotImplementedException ();
+ }
+ bool IExtenderProvider.CanExtend(object extendee){
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/WINELib/winelib.sln b/mcs/class/System.Windows.Forms/WINELib/winelib.sln
new file mode 100644
index 00000000000..1bd43ac09b8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/WINELib/winelib.sln
@@ -0,0 +1,3 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Global
+EndGlobal
diff --git a/mcs/class/System.Windows.Forms/list.unix b/mcs/class/System.Windows.Forms/list.unix
new file mode 100644
index 00000000000..a0fd8530b25
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/list.unix
@@ -0,0 +1,343 @@
+System.Resources/ResXResourceReader.cs
+System.Resources/ResXResourceWriter.cs
+System.Windows.Forms/AccessibleEvents.cs
+System.Windows.Forms/AccessibleNavigation.cs
+System.Windows.Forms/AccessibleObject.cs
+System.Windows.Forms/AccessibleRole.cs
+System.Windows.Forms/AccessibleSelection.cs
+System.Windows.Forms/AccessibleStates.cs
+System.Windows.Forms/AmbientProperties.cs
+System.Windows.Forms/AnchorStyles.cs
+System.Windows.Forms/Appearance.cs
+System.Windows.Forms/ApplicationContext.cs
+System.Windows.Forms/Application.cs
+System.Windows.Forms/ArrangeDirection.cs
+System.Windows.Forms/ArrangeStartingPosition.cs
+System.Windows.Forms/AssemblyInfo.cs
+System.Windows.Forms/AxHost.cs
+System.Windows.Forms/BaseCollection.cs
+System.Windows.Forms/BindingContext.cs
+System.Windows.Forms/Binding.cs
+System.Windows.Forms/BindingManagerBase.cs
+System.Windows.Forms/BindingMemberInfo.cs
+System.Windows.Forms/BindingsCollection.cs
+System.Windows.Forms/BootMode.cs
+System.Windows.Forms/Border3DSide.cs
+System.Windows.Forms/Border3DStyle.cs
+System.Windows.Forms/BorderStyle.cs
+System.Windows.Forms/BoundsSpecified.cs
+System.Windows.Forms/ButtonBase.cs
+System.Windows.Forms/ButtonBorderStyle.cs
+System.Windows.Forms/Button.cs
+System.Windows.Forms/ButtonState.cs
+System.Windows.Forms/CaptionButton.cs
+System.Windows.Forms/CharacterCasing.cs
+System.Windows.Forms/CheckBox.cs
+System.Windows.Forms/CheckedListBox.cs
+System.Windows.Forms/CheckState.cs
+System.Windows.Forms/Clipboard.cs
+System.Windows.Forms/ColorDepth.cs
+System.Windows.Forms/ColorDialog.cs
+System.Windows.Forms/ColumnClickEventArgs.cs
+System.Windows.Forms/ColumnClickEventHandler.cs
+System.Windows.Forms/ColumnHeader.cs
+System.Windows.Forms/ColumnHeaderStyle.cs
+System.Windows.Forms/ComboBox.cs
+System.Windows.Forms/ComboBoxStyle.cs
+System.Windows.Forms/CommonDialog.cs
+System.Windows.Forms/ComVisible.cs
+System.Windows.Forms/ContainerControl.cs
+System.Windows.Forms/ContentsResizedEventArgs.cs
+System.Windows.Forms/ContentsResizedEventHandler.cs
+System.Windows.Forms/ContextMenu.cs
+System.Windows.Forms/ControlBindingsCollection.cs
+System.Windows.Forms/Control.cs
+System.Windows.Forms/ControlEventArgs.cs
+System.Windows.Forms/ControlEventHandler.cs
+System.Windows.Forms/ControlPaint.cs
+System.Windows.Forms/ControlStyles.cs
+System.Windows.Forms/ConvertEventArgs.cs
+System.Windows.Forms/ConvertEventHandler.cs
+System.Windows.Forms/CreateParams.cs
+System.Windows.Forms/CurrencyManager.cs
+System.Windows.Forms/CursorConverter.cs
+System.Windows.Forms/Cursor.cs
+System.Windows.Forms/Cursors.cs
+System.Windows.Forms/DataFormats.cs
+System.Windows.Forms/DataGridBoolColumn.cs
+System.Windows.Forms/DataGridCell.cs
+System.Windows.Forms/DataGridColumnStyle.cs
+System.Windows.Forms/DataGrid.cs
+System.Windows.Forms/DataGridLineStyle.cs
+System.Windows.Forms/DataGridParentRowsLabelStyle.cs
+System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs
+System.Windows.Forms/DataGridTableStyle.cs
+System.Windows.Forms/DataGridTextBoxColumn.cs
+System.Windows.Forms/DataGridTextBox.cs
+System.Windows.Forms/DataObject.cs
+System.Windows.Forms/DateBoldEventArgs.cs
+System.Windows.Forms/DateRangeEventArgs.cs
+System.Windows.Forms/DateRangeEventHandler.cs
+System.Windows.Forms/DateTimePicker.cs
+System.Windows.Forms/DateTimePickerFormat.cs
+System.Windows.Forms/day.cs
+System.Windows.Forms/DialogResult.cs
+System.Windows.Forms/DockStyle.cs
+System.Windows.Forms/DomainUpDown.cs
+System.Windows.Forms/DragAction.cs
+System.Windows.Forms/DragDropEffects.cs
+System.Windows.Forms/DragEventArgs.cs
+System.Windows.Forms/DragEventHandler.cs
+System.Windows.Forms/DrawItemEventArgs.cs
+System.Windows.Forms/DrawItemEventHandler.cs
+System.Windows.Forms/DrawItemState.cs
+System.Windows.Forms/DrawMode.cs
+System.Windows.Forms/ErrorBlinkStyle.cs
+System.Windows.Forms/ErrorIconAlignment.cs
+System.Windows.Forms/ErrorProvider.cs
+System.Windows.Forms/FeatureSupport.cs
+System.Windows.Forms/FileDialog.cs
+System.Windows.Forms/FlatStyle.cs
+System.Windows.Forms/FolderBrowserDialog.cs
+System.Windows.Forms/Font.cs
+System.Windows.Forms/FontDialog.cs
+System.Windows.Forms/FormBorderStyle.cs
+System.Windows.Forms/Form.cs
+System.Windows.Forms/FormStartPosition.cs
+System.Windows.Forms/FormWindowState.cs
+System.Windows.Forms/FrameStyle.cs
+System.Windows.Forms/GiveFeedbackEventArgs.cs
+System.Windows.Forms/GiveFeedbackEventHandler.cs
+System.Windows.Forms/GridColumnStylesCollection.cs
+System.Windows.Forms/GridItemCollection.cs
+System.Windows.Forms/GridItem.cs
+System.Windows.Forms/GridItemType.cs
+System.Windows.Forms/GridTableStylesCollection.cs
+System.Windows.Forms/GroupBox.cs
+System.Windows.Forms/Help.cs
+System.Windows.Forms/HelpEventArgs.cs
+System.Windows.Forms/HelpEventHandler.cs
+System.Windows.Forms/HelpNavigator.cs
+System.Windows.Forms/HelpProvider.cs
+System.Windows.Forms/HorizontalAlignment.cs
+System.Windows.Forms/HScrollBar.cs
+System.Windows.Forms/IButtonControl.cs
+System.Windows.Forms/ICommandExecutor.cs
+System.Windows.Forms/IComponentEditorPageSite.cs
+System.Windows.Forms/IContainerControl.cs
+System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
+System.Windows.Forms/IDataGridEditingService.cs
+System.Windows.Forms/IDataObject.cs
+System.Windows.Forms/IFeatureSupport.cs
+System.Windows.Forms/IFileReaderService.cs
+System.Windows.Forms/ImageIndexConverter.cs
+System.Windows.Forms/ImageList.cs
+System.Windows.Forms/ImageListStreamer.cs
+System.Windows.Forms/ImeMode.cs
+System.Windows.Forms/IMessageFilter.cs
+System.Windows.Forms/InputLanguageChangedEventArgs.cs
+System.Windows.Forms/InputLanguageChangedEventHandler.cs
+System.Windows.Forms/InputLanguageChangingEventArgs.cs
+System.Windows.Forms/InputLanguageChangingEventHandler.cs
+System.Windows.Forms/InputLanguageCollection.cs
+System.Windows.Forms/InputLanguage.cs
+System.Windows.Forms/InvalidateEventArgs.cs
+System.Windows.Forms/InvalidateEventHandler.cs
+System.Windows.Forms/ItemActivation.cs
+System.Windows.Forms/ItemBoundsPortion.cs
+System.Windows.Forms/ItemChangedEventArgs.cs
+System.Windows.Forms/ItemChangedEventHandler.cs
+System.Windows.Forms/ItemCheckEventArgs.cs
+System.Windows.Forms/ItemCheckEventHandler.cs
+System.Windows.Forms/ItemDragEventArgs.cs
+System.Windows.Forms/ItemDragEventHandler.cs
+System.Windows.Forms/IWin32Window.cs
+System.Windows.Forms/IWindowTarget.cs
+System.Windows.Forms/KeyEventArgs.cs
+System.Windows.Forms/KeyEventHandler.cs
+System.Windows.Forms/KeyPressEventArgs.cs
+System.Windows.Forms/KeyPressEventHandler.cs
+System.Windows.Forms/KeysConverter.cs
+System.Windows.Forms/Keys.cs
+System.Windows.Forms/Label.cs
+System.Windows.Forms/LabelEditEventArgs.cs
+System.Windows.Forms/LabelEditEventHandler.cs
+System.Windows.Forms/LayoutEventArgs.cs
+System.Windows.Forms/LayoutEventHandler.cs
+System.Windows.Forms/LeftRightAlignment.cs
+System.Windows.Forms/LinkArea.cs
+System.Windows.Forms/LinkBehavior.cs
+System.Windows.Forms/LinkClickedEventArgs.cs
+System.Windows.Forms/LinkClickedEventHandler.cs
+System.Windows.Forms/LinkLabel.cs
+System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs
+System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs
+System.Windows.Forms/LinkState.cs
+System.Windows.Forms/ListBindingConverter.cs
+System.Windows.Forms/ListBox.cs
+System.Windows.Forms/ListControl.cs
+System.Windows.Forms/ListViewAlignment.cs
+System.Windows.Forms/ListView.cs
+System.Windows.Forms/ListViewItemConverter.cs
+System.Windows.Forms/ListViewItem.cs
+System.Windows.Forms/MainMenu.cs
+System.Windows.Forms/MdiLayout.cs
+System.Windows.Forms/MeasureItemEventArgs.cs
+System.Windows.Forms/MeasureItemEventHandler.cs
+System.Windows.Forms/Menu.cs
+System.Windows.Forms/MenuGlyph.cs
+System.Windows.Forms/MenuItem.cs
+System.Windows.Forms/MenuMerge.cs
+System.Windows.Forms/MessageBoxButtons.cs
+System.Windows.Forms/MessageBox.cs
+System.Windows.Forms/MessageBoxDefaultButton.cs
+System.Windows.Forms/MessageBoxIcon.cs
+System.Windows.Forms/MessageBoxOptions.cs
+System.Windows.Forms/Message.cs
+System.Windows.Forms/MethodInvoker.cs
+System.Windows.Forms/MonthCalendar.cs
+System.Windows.Forms/MouseButtons.cs
+System.Windows.Forms/MouseEventArgs.cs
+System.Windows.Forms/MouseEventHandler.cs
+System.Windows.Forms/NativeWindow.cs
+System.Windows.Forms/NavigateEventArgs.cs
+System.Windows.Forms/NavigateEventHandler.cs
+System.Windows.Forms/NodeLabelEditEventArgs.cs
+System.Windows.Forms/NodeLabelEditEventHandler.cs
+System.Windows.Forms/NotifyIcon.cs
+System.Windows.Forms/NumericUpDown.cs
+System.Windows.Forms/OpacityConverter.cs
+System.Windows.Forms/OpenFileDialog.cs
+System.Windows.Forms/Orientation.cs
+System.Windows.Forms/OSFeature.cs
+System.Windows.Forms/PageSetupDialog.cs
+System.Windows.Forms/PaintEventArgs.cs
+System.Windows.Forms/PaintEventHandler.cs
+System.Windows.Forms/Panel.cs
+System.Windows.Forms/PictureBox.cs
+System.Windows.Forms/PictureBoxSizeMode.cs
+System.Windows.Forms/PrintControllerWithStatusDialog.cs
+System.Windows.Forms/PrintDialog.cs
+System.Windows.Forms/PrintPreviewControl.cs
+System.Windows.Forms/PrintPreviewDialog.cs
+System.Windows.Forms/ProgressBar.cs
+System.Windows.Forms/PropertyGrid.cs
+System.Windows.Forms/PropertyManager.cs
+System.Windows.Forms/PropertySort.cs
+System.Windows.Forms/PropertyTabChangedEventArgs.cs
+System.Windows.Forms/PropertyTabChangedEventHandler.cs
+System.Windows.Forms/PropertyValueChangedEventArgs.cs
+System.Windows.Forms/PropertyValueChangedEventHandler.cs
+System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs
+System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
+System.Windows.Forms/QueryContinueDragEventArgs.cs
+System.Windows.Forms/QueryContinueDragEventHandler.cs
+System.Windows.Forms/RadioButton.cs
+System.Windows.Forms/RichTextBox.cs
+System.Windows.Forms/RichTextBoxFinds.cs
+System.Windows.Forms/RichTextBoxScrollBars.cs
+System.Windows.Forms/RichTextBoxSelectionAttribute.cs
+System.Windows.Forms/RichTextBoxSelectionTypes.cs
+System.Windows.Forms/RichTextBoxStreamType.cs
+System.Windows.Forms/RichTextBoxWordPunctuations.cs
+System.Windows.Forms/RightToLeft.cs
+System.Windows.Forms/SaveFileDialog.cs
+System.Windows.Forms/Screen.cs
+System.Windows.Forms/ScrollableControl.cs
+System.Windows.Forms/ScrollBar.cs
+System.Windows.Forms/ScrollBars.cs
+System.Windows.Forms/ScrollButton.cs
+System.Windows.Forms/ScrollEventArgs.cs
+System.Windows.Forms/ScrollEventHandler.cs
+System.Windows.Forms/ScrollEventType.cs
+System.Windows.Forms/SecurityIDType.cs
+System.Windows.Forms/SelectedGridItemChangedEventArgs.cs
+System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
+System.Windows.Forms/SelectionMode.cs
+System.Windows.Forms/SelectionRangeConverter.cs
+System.Windows.Forms/SelectionRange.cs
+System.Windows.Forms/SendKeys.cs
+System.Windows.Forms/Shortcut.cs
+System.Windows.Forms/SizeGripStyle.cs
+System.Windows.Forms/SortOrder.cs
+System.Windows.Forms/Splitter.cs
+System.Windows.Forms/SplitterEventArgs.cs
+System.Windows.Forms/SplitterEventHandler.cs
+System.Windows.Forms/StatusBar.cs
+System.Windows.Forms/StatusBarDrawItemEventArgs.cs
+System.Windows.Forms/StatusBarDrawItemEventHandler.cs
+System.Windows.Forms/StatusBarPanelAutoSize.cs
+System.Windows.Forms/StatusBarPanelBorderStyle.cs
+System.Windows.Forms/StatusBarPanelClickEventArgs.cs
+System.Windows.Forms/StatusBarPanelClickEventHandler.cs
+System.Windows.Forms/StatusBarPanelCollection.cs
+System.Windows.Forms/StatusBarPanel.cs
+System.Windows.Forms/StatusBarPanelStyle.cs
+System.Windows.Forms/StructFormat.cs
+System.Windows.Forms/SystemInformation.cs
+System.Windows.Forms/TabAlignment.cs
+System.Windows.Forms/TabAppearance.cs
+System.Windows.Forms/TabControl.cs
+System.Windows.Forms/TabDrawMode.cs
+System.Windows.Forms/TabPage.cs
+System.Windows.Forms/TabSizeMode.cs
+System.Windows.Forms/TextBoxBase.cs
+System.Windows.Forms/TextBox.cs
+System.Windows.Forms/ThreadExceptionDialog.cs
+System.Windows.Forms/TickStyle.cs
+System.Windows.Forms/Timer.cs
+System.Windows.Forms/TODOAttribute.cs
+System.Windows.Forms/ToolBarAppearance.cs
+System.Windows.Forms/ToolBarButtonClickEventArgs.cs
+System.Windows.Forms/ToolBarButtonClickEventHandler.cs
+System.Windows.Forms/ToolBarButton.cs
+System.Windows.Forms/ToolBarButtonStyle.cs
+System.Windows.Forms/ToolBar.cs
+System.Windows.Forms/ToolBarTextAlign.cs
+System.Windows.Forms/tooltip.cs
+System.Windows.Forms/TrackBar.cs
+System.Windows.Forms/TreeNodeCollection.cs
+System.Windows.Forms/TreeNodeConverter.cs
+System.Windows.Forms/TreeNode.cs
+System.Windows.Forms/TreeViewAction.cs
+System.Windows.Forms/TreeViewCancelEventArgs.cs
+System.Windows.Forms/TreeViewCancelEventHandler.cs
+System.Windows.Forms/TreeView.cs
+System.Windows.Forms/TreeViewEventArgs.cs
+System.Windows.Forms/TreeViewEventHandler.cs
+System.Windows.Forms/TreeViewImageIndexConverter.cs
+System.Windows.Forms/UICues.cs
+System.Windows.Forms/UICuesEventArgs.cs
+System.Windows.Forms/UICuesEventHandler.cs
+System.Windows.Forms/UpDownBase.cs
+System.Windows.Forms/UpDownEventArgs.cs
+System.Windows.Forms/UpDownEventHandler.cs
+System.Windows.Forms/UserControl.cs
+System.Windows.Forms/View.cs
+System.Windows.Forms/VScrollBar.cs
+System.Windows.Forms/win32Enums.cs
+System.Windows.Forms/win32Handles.cs
+System.Windows.Forms/win32Interfaces.cs
+System.Windows.Forms/win32RegistryUtil.cs
+System.Windows.Forms/win32Structs.cs
+System.Windows.Forms/win32functions.cs
+System.Windows.Forms.Design/AnchorEditor.cs
+System.Windows.Forms.Design/AssemblyInfo.cs
+System.Windows.Forms.Design/AxImporter.cs
+System.Windows.Forms.Design/ComponentDocumentDesigner.cs
+System.Windows.Forms.Design/ComponentEditor.cs
+System.Windows.Forms.Design/ComponentEditorForm.cs
+System.Windows.Forms.Design/ComponentTray.cs
+System.Windows.Forms.Design/ControlDesigner.cs
+System.Windows.Forms.Design/DocumentDesigner.cs
+System.Windows.Forms.Design/EventsTab.cs
+System.Windows.Forms.Design/FileNameEditor.cs
+System.Windows.Forms.Design/IMenuEditorService.cs
+System.Windows.Forms.Design/IUIService.cs
+System.Windows.Forms.Design/IWindowsformsEditorService.cs
+System.Windows.Forms.Design/MenusCommands.cs
+System.Windows.Forms.Design/ParentControlDesigner.cs
+System.Windows.Forms.Design/PropertyTab.cs
+System.Windows.Forms.Design/ScrollableControlDesigner.cs
+System.Windows.Forms.Design/SelectionRules.cs
+System.Windows.Forms.Design/UITypeEditor.cs
diff --git a/mcs/class/System.Windows.Forms/makefile.gnu b/mcs/class/System.Windows.Forms/makefile.gnu
new file mode 100644
index 00000000000..b3210f094b2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/makefile.gnu
@@ -0,0 +1,16 @@
+topdir = ../..
+
+TEST_DIR = Test
+LIBRARY = $(topdir)/class/lib/System.Windows.Forms.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r System -r System.Drawing -r Accessibility /nowarn:0114 /nowarn:0108
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ ./System.Xml/Driver.cs
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System.XML/.cvsignore b/mcs/class/System.XML/.cvsignore
new file mode 100644
index 00000000000..c61ca171548
--- /dev/null
+++ b/mcs/class/System.XML/.cvsignore
@@ -0,0 +1,9 @@
+*.dll
+list
+*.suo
+*.csproj.user
+bin
+obj
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.XML/ChangeLog b/mcs/class/System.XML/ChangeLog
new file mode 100644
index 00000000000..9352d6954a4
--- /dev/null
+++ b/mcs/class/System.XML/ChangeLog
@@ -0,0 +1,56 @@
+2003-01-16 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * updated Mono.System.Xml.csproj. (patch by David B. Bitton)
+
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * updated .build file(s) to correctly contain required buildfile
+ attribute for nant
+
+2002-10-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * makefile.gnu: added test target.
+
+2002-08-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix:
+ Add System.Xml.Serialization/XmlCustomFormatter.cs
+
+2002-08-19 Tim Coleman <tim@timcoleman.com>
+ * list.unix:
+ Add System.Xml.Serialization/XmlSerializationWriter.cs
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * list.unix:
+ Add some more classes to this build list.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix:
+ Add System.Xml.Serialization/SoapReflectionImporter.cs to build
+ list.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix: added new classes to build list.
+
+2002-06-20 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * System.Xml.Serialization: Added to build target
+
+2002-05-24 Miguel de Icaza <miguel@ximian.com>
+
+ * System.Xml.Serialization/XmlElementAttribute.cs: Add allowmultiple
+
+2002-03-06 Jason Diamond <jason@injektilo.org>
+
+ * System.XML.build: Disable warning CS0679: Other languages may permit the internal virtual member 'foo' to be overridden.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * System.XML.build: Change dll name to System.Xml.dll from
+ System.XML.dll (not easy to notice, btw)
+
+2001-12-07 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * System.XML.build: Add dependancy on linux target to test target. Need to have the dll before we can test it, right? Plus is encourages other to try 'make test'.
+
diff --git a/mcs/class/System.XML/Mono.System.XML.csproj b/mcs/class/System.XML/Mono.System.XML.csproj
new file mode 100644
index 00000000000..eddc84d379a
--- /dev/null
+++ b/mcs/class/System.XML/Mono.System.XML.csproj
@@ -0,0 +1,1265 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.XML"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "System.XML"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "System.Xml\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml\Driver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\EntityHandling.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\Formatting.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\IHasXmlNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\IXmlLineInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\NameTable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\Profile.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\ReadState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\ValidationType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\WhitespaceHandling.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\WriteState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlAttributeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlCDataSection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlChar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlCharacterData.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlComment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlConstructs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlConvert.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDeclaration.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocument.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocumentFragment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocumentNavigator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocumentType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlEntity.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlEntityReference.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlImplementation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlLinkedNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNamedNodeMap.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNamespaceManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNameTable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeArrayList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeChangedAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeListChildren.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNotation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlParserContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlProcessingInstruction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlQualifiedName.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlResolver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlSignificantWhitespace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlSpace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlText.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTextReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTextWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTextWriterOpenElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTokenizedType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlUrlResolver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlWhitespace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\BUGS.txt"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "System.Xml.Schema\BUGS-MS.txt"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "System.Xml.Schema\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Schema\ValidationEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\ValidationHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchema.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAll.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAnnotated.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAnnotation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAny.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAnyAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAppInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAttributeGroup.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaAttributeGroupRef.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaChoice.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaCollectionEnumerator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaComplexContent.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaComplexContentExtension.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaComplexContentRestriction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaComplexType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaContent.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaContentModel.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaContentProcessing.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaContentType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaDatatype.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaDerivationMethod.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaDocumentation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaEnumerationFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaExternal.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaForm.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaFractionDigitsFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaGroup.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaGroupBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaGroupRef.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaIdentityConstraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaImport.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaInclude.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaKey.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaKeyref.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaLengthFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaMaxExclusiveFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaMaxInclusiveFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaMaxLengthFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaMinExclusiveFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaMinInclusiveFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaMinLengthFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaNotation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaNumericFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaObjectCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaObjectEnumerator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaObjectTable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaParticle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaPatternFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaRedefine.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSequence.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleContent.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleContentExtension.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleContentRestriction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleTypeContent.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleTypeList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleTypeRestriction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaSimpleTypeUnion.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaTotalDigitsFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaUnique.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaUse.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaUtil.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaWhiteSpaceFacet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSchemaXPath.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\XmlSeverityType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Schema\CVS\Entries"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Schema\CVS\Repository"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Schema\CVS\Root"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\CodeIdentifier.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\CodeIdentifiers.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\IXmlSerializable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SchemaTypes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapAttributeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapAttributeOverrides.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapAttributes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapCodeExporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapElementAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapEnumAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapIgnoreAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapIncludeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapReflectionImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapSchemaExporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapSchemaImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapSchemaMember.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\SoapTypeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\TypeData.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\TypeMember.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\TypeTranslator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\UnreferencedObjectEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\UnreferencedObjectEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAnyAttributeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAnyElementAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAnyElementAttributes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlArrayAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlArrayItemAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlArrayItemAttributes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAttributeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAttributeEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAttributeEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAttributeOverrides.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlAttributes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlChoiceIdentifierAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlCodeExporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlCustomFormatter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlElementAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlElementAttributes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlElementEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlElementEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlEnumAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlIgnoreAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlIncludeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlMapping.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlMemberMapping.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlMembersMapping.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlNamespaceDeclarationsAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlNodeEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlNodeEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlReflectionImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlReflectionMember.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlRootAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSchemaExporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSchemaImporter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSchemas.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializationCollectionFixupCallback.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializationFixupCallback.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializationReadCallback.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializationReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializationWriteCallback.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializationWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlSerializerNamespaces.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlTextAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlTypeAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\XmlTypeMapping.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\CVS\Entries"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\CVS\Repository"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.Serialization\CVS\Root"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.XPath\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.XPath\DefaultContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\Expression.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\Iterator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\IXPathNavigable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\Parser.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\Parser.jay"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.XPath\Tokenizer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XmlCaseOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XmlDataType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XmlSortOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathDocument.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathExpression.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNamespaceScope.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNavigator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNodeIterator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNodeType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathResultType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\IXsltContextFunction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\IXsltContextVariable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\XsltArgumentList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\XsltCompileException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\XsltContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\XsltException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.Xsl\XslTransform.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Mono.System.XML.sln b/mcs/class/System.XML/Mono.System.XML.sln
new file mode 100644
index 00000000000..0d2c98ae7dd
--- /dev/null
+++ b/mcs/class/System.XML/Mono.System.XML.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.System.XML", "Mono.System.XML.csproj", "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoMicro.Test", "Test\MonoMicro.Test.csproj", "{F7734143-3845-4288-B1CA-FE614FFA70F0}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Debug.ActiveCfg = Debug|.NET
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Debug.Build.0 = Debug|.NET
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Release.ActiveCfg = Release|.NET
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Release.Build.0 = Release|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Debug.ActiveCfg = Debug|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Debug.Build.0 = Debug|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Release.ActiveCfg = Release|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/System.XML/README b/mcs/class/System.XML/README
new file mode 100755
index 00000000000..498b53d0796
--- /dev/null
+++ b/mcs/class/System.XML/README
@@ -0,0 +1,8 @@
+Build instructions for use with the mono runtime.
+
+Run:
+ mcs @list.unix
+
+If no errors occourred, copy the generated System.Xml.dll file to the runtime dir
+(probably /usr/local/lib).
+
diff --git a/mcs/class/System.XML/System.XML.build b/mcs/class/System.XML/System.XML.build
new file mode 100644
index 00000000000..cee6b79d8b9
--- /dev/null
+++ b/mcs/class/System.XML/System.XML.build
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.XML.dll -->
+
+<project name="System.XML" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Xml.dll" debug="${debug}">
+ <!-- 'foo' is defined in multiple places; using definition from 'bar' -->
+ <arg value="/nowarn:1595"/>
+ <!-- Other languages may permit the internal virtual member 'foo' to be overridden -->
+ <arg value="/nowarn:0679"/>
+ <arg value="/nowarn:0649"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <!--excludes name="System.Xml.Serialization/**"/-->
+ </sources>
+ </csc>
+ <copy file="../lib/System.Xml.dll" tofile="Test/System.XML.dll"/>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.XML.dll" failonerror="false"/>
+ <delete file="../lib/System.Xml.dll" failonerror="false"/>
+ <delete file="Test/System.XML.dll" failonerror="false"/>
+ <delete file="Test/System.Xml.dll" failonerror="false"/>
+ <delete file="../lib/System.XML.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt b/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt
new file mode 100755
index 00000000000..ad4ece9c910
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt
@@ -0,0 +1,20 @@
+BUGS in MS Implementation of XmlSchema:
+
+1. Does not allow duplicate values in lists for final* and block* attributes.
+ For example "restriction restriction" is not allowed even though its a valid
+ value for blockDefault.
+
+2. Resets the minOccurs to 0 if maxOccurs="0", whereas it should raise an error.
+
+3. Allows abstract="true" in the a localElement whereas it is not allowed.
+ <?xml version="1.0"?>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified">
+ <xsd:element name="doc">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="elem1"/>
+ <xsd:element abstract="true" name="elem2"/> <!--This element is not valid -->
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema> \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/BUGS.txt b/mcs/class/System.XML/System.Xml.Schema/BUGS.txt
new file mode 100755
index 00000000000..cf602178c3d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/BUGS.txt
@@ -0,0 +1,5 @@
+Bugs in Implementation:
+
+// None of the XmlSchemaObjects except the XmlSchema populate XmlSerializerNamespaces.
+//2. Non schema attributes are not being handled. Need an internal XmlAttribute constructor.
+//3. Documentation and appInfo's Markup is not being read in the Read() Method.
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
new file mode 100755
index 00000000000..13917ba73c5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
@@ -0,0 +1,69 @@
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * XmlSchemaException.cs: Partiall implement the ISerializable
+ methods. It's not clear now SourceSchemaObject should be deserialized.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * XmlSchema.cs: Removed isCompiled which is defined as internal
+ in XmlSchemaObject.
+
+2002-06-18 Dwivedi, Ajay kumar <adwiv@yahoo.com>
+
+ * XmlSchema: Started work on Validate methods
+
+2002-06-18 Dwivedi, Ajay kumar <adwiv@yahoo.com>
+ * XmlSchema: The Read and Write methods are no more [MonoTODO] :)
+
+ * XmlSchemaAppInfo: Xml Markup is now being read.
+
+ * XmlSchemaDocumentation: Xml Markup is now being read.
+
+ * All: Unhandled attributes are being handled properly.
+
+ * All: Reordered the properties in all cs files to match with MS
+ Implementation. This was required since the order is importatnt
+ for the XmlSerializer.
+
+2002-06-14 Dwivedi, Ajay kumar <adwiv@yahoo.com>
+ * General: Fixed a few more Bugs
+
+2002-06-10 Dwivedi, Ajay kumar <adwiv@yahoo.com>
+ * XmlSchemaReader: A Wrapper class around XmlReader with customized
+ methods to suit reading a schema.
+ * General: Implemented Read() method for the schema. There are only
+ a few minor bugs remaining.
+
+2002-05-25 Dwivedi, Ajay kumar <adwiv@yahoo.com>
+ * BUGS.txt: New file to keep track of bugs
+
+ * ALL: All classes are initialized exactly as in .NET except
+ 1. inclusion of language attribute in schema
+ 2. ComplexContent's Particle is initialized to null whereas .NET
+ to some internal implementation. IMO Null is more appropriate
+
+ * ALL: Changed the Compile methods to return the count of errors.
+
+ * ALL: Complile methods are almost complete. Pass 1453 of 3061 tests.
+ This number should shoot up if we write a parser to read the
+ Schema instead of using reflection (which is slower too)
+
+2002-05-04 Dwivedi, Ajay kumar <adwiv@yahoo.com>
+ * XmlSchemaUtil.cs: New file added.
+
+ * Parser.cs: New file Added. Unused at the moment.
+
+ * XmlSchemaObjectCollection: Fixed GetEnumerator
+
+ * General: Preprocessing for Attributes and SimpleTypes completed.
+
+2002-04-26 Duncan Mak <duncan@ximian.com>
+
+ * ValidationHandler.cs: New file.
+
+ * XmlSchemaInfo.cs: New file.
+
+ * *.cs: More updates from Ajay.
+
+2002-03-27 Duncan Mak <duncan@ximian.com>
+
+ * *.cs: Updates from Ajay Dwivedi <AjayKumar.Dwivedi@dresdner-bank.com>.
diff --git a/mcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs b/mcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs
new file mode 100755
index 00000000000..df846514e1e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs
@@ -0,0 +1,38 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for ValidationEventArgs.
+ /// </summary>
+ public sealed class ValidationEventArgs : EventArgs
+ {
+ private XmlSchemaException exception;
+ private string message;
+ private XmlSeverityType severity;
+
+ private ValidationEventArgs()
+ {}
+
+ internal ValidationEventArgs(XmlSchemaException ex, string message, XmlSeverityType severity)
+ {
+ this.exception = ex;
+ this.message = message;
+ this.severity = severity;
+ }
+ public XmlSchemaException Exception
+ {
+ get{ return exception; }
+ }
+ public string Message
+ {
+ get{ return message; }
+ }
+ public XmlSeverityType Severity
+ {
+ get{ return severity; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs b/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs
new file mode 100755
index 00000000000..898a10a840f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs
@@ -0,0 +1,48 @@
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// </summary>
+ public delegate void ValidationEventHandler(object sender,ValidationEventArgs e);
+
+ /// <summary>
+ /// Docs say we need to raise an exception if ValidationEventHandler is not set(null)
+ /// So we use this class to raise the events rather than calling the delegate by itself
+ /// </summary>
+ internal class ValidationHandler
+ {
+ public static void RaiseValidationEvent(ValidationEventHandler handle, Exception innerException, object sender, string message, XmlSeverityType severity)
+ {
+ XmlSchemaException ex = new XmlSchemaException(message,innerException);
+ ValidationEventArgs e = new ValidationEventArgs(ex,message,severity);
+ if(handle == null)
+ {
+ throw e.Exception;
+ }
+ else
+ {
+ handle(sender,e);
+ }
+ }
+ public static void RaiseValidationError(ValidationEventHandler handle, object sender, string message)
+ {
+ RaiseValidationEvent(handle,null,sender,message,XmlSeverityType.Error);
+ }
+
+ public static void RaiseValidationError(ValidationEventHandler handle, string message, Exception innerException)
+ {
+ RaiseValidationEvent(handle, innerException, null, message, XmlSeverityType.Error);
+ }
+
+ public static void RaiseValidationWarning (ValidationEventHandler handle, object sender, string message)
+ {
+ RaiseValidationEvent(handle,null,sender,message,XmlSeverityType.Warning);
+ }
+
+ public static void RaiseValidationWarning(ValidationEventHandler handle, string message, Exception innerException)
+ {
+ RaiseValidationEvent(handle, innerException, null, message, XmlSeverityType.Warning);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
new file mode 100755
index 00000000000..61f16ec71ca
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
@@ -0,0 +1,711 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+using System.IO;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchema.
+ /// </summary>
+ [XmlRoot("schema",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public class XmlSchema : XmlSchemaObject
+ {
+ //public constants
+ public const string Namespace = "http://www.w3.org/2001/XMLSchema";
+ public const string InstanceNamespace = "http://www.w3.org/2001/XMLSchema-instance";
+
+ //private fields
+ private XmlSchemaForm attributeFormDefault ;
+ private XmlSchemaObjectTable attributeGroups ;
+ private XmlSchemaObjectTable attributes ;
+ private XmlSchemaDerivationMethod blockDefault ;
+ private XmlSchemaForm elementFormDefault ;
+ private XmlSchemaObjectTable elements ;
+ private XmlSchemaDerivationMethod finalDefault ;
+ private XmlSchemaObjectTable groups ;
+ private string id ;
+ private XmlSchemaObjectCollection includes ;
+ private XmlSchemaObjectCollection items ;
+ private XmlSchemaObjectTable notations ;
+ private XmlSchemaObjectTable schemaTypes ;
+ private string targetNamespace ;
+ private XmlAttribute[] unhandledAttributes ;
+ private string version;
+ private string language;
+
+ // Compiler specific things
+ private XmlSchemaInfo info;
+ private static string xmlname = "schema";
+
+ public XmlSchema()
+ {
+ attributeFormDefault= XmlSchemaForm.None;
+ blockDefault = XmlSchemaDerivationMethod.None;
+ elementFormDefault = XmlSchemaForm.None;
+ finalDefault = XmlSchemaDerivationMethod.None;
+ includes = new XmlSchemaObjectCollection();
+ isCompiled = false;
+ items = new XmlSchemaObjectCollection();
+ attributeGroups = new XmlSchemaObjectTable();
+ attributes = new XmlSchemaObjectTable();
+ elements = new XmlSchemaObjectTable();
+ groups = new XmlSchemaObjectTable();
+ notations = new XmlSchemaObjectTable();
+ schemaTypes = new XmlSchemaObjectTable();
+ }
+
+ #region Properties
+
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("attributeFormDefault")]
+ public XmlSchemaForm AttributeFormDefault
+ {
+ get{ return attributeFormDefault; }
+ set{ this.attributeFormDefault = value;}
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("blockDefault")]
+ public XmlSchemaDerivationMethod BlockDefault
+ {
+ get{ return blockDefault;}
+ set{ blockDefault = value;}
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("finalDefault")]
+ public XmlSchemaDerivationMethod FinalDefault
+ {
+ get{ return finalDefault;}
+ set{ finalDefault = value;}
+ }
+
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("elementFormDefault")]
+ public XmlSchemaForm ElementFormDefault
+ {
+ get{ return elementFormDefault;}
+ set{ elementFormDefault = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("targetNamespace")]
+ public string TargetNamespace
+ {
+ get{ return targetNamespace;}
+ set{ targetNamespace = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("version")]
+ public string Version
+ {
+ get{ return version;}
+ set{ version = value;}
+ }
+
+ [XmlElement("include",typeof(XmlSchemaInclude),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("import",typeof(XmlSchemaImport),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("redefine",typeof(XmlSchemaRedefine),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Includes
+ {
+ get{ return includes;}
+ }
+
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ //Only Schema's attributeGroup has type XmlSchemaAttributeGroup.
+ //Others (complextype, restrictions etc) must have XmlSchemaAttributeGroupRef
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("notation",typeof(XmlSchemaNotation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("annotation",typeof(XmlSchemaAnnotation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Items
+ {
+ get{ return items;}
+ }
+
+ [XmlIgnore]
+ public bool IsCompiled
+ {
+ get{ return isCompiled;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Attributes
+ {
+ get{ return attributes;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable AttributeGroups
+ {
+ get{ return attributeGroups; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable SchemaTypes
+ {
+ get{ return schemaTypes; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Elements
+ {
+ get{ return elements;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id;}
+ set{ id = value;}
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get
+ {
+ if(unhandledAttributeList != null)
+ {
+ unhandledAttributes = (XmlAttribute[]) unhandledAttributeList.ToArray(typeof(XmlAttribute));
+ unhandledAttributeList = null;
+ }
+ return unhandledAttributes;
+ }
+ set
+ {
+ unhandledAttributes = value;
+ unhandledAttributeList = null;
+ }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Groups
+ {
+ get{ return groups;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Notations
+ {
+ get{ return notations;}
+ }
+
+ // New attribute defined in W3C schema element
+ [System.Xml.Serialization.XmlAttribute("xml:lang")]
+ public string Language
+ {
+ get{ return language; }
+ set{ language = value; }
+ }
+
+ #endregion
+
+ #region Compile
+
+ // Methods
+ /// <summary>
+ /// This compile method does two things:
+ /// 1. It compiles and fills the PSVI dataset
+ /// 2. Validates the schema by calling Validate method.
+ /// Every XmlSchemaObject has a Compile Method which gets called.
+ /// </summary>
+ /// <remarks>
+ /// 1. blockDefault must be one of #all | List of (extension | restriction | substitution)
+ /// 2. finalDefault must be one of (#all | List of (extension | restriction| union| list))
+ /// 3. id must be of type ID
+ /// 4. targetNamespace should be any uri
+ /// 5. version should be a normalizedString
+ /// 6. xml:lang should be a language
+ /// </remarks>
+ [MonoTODO]
+ public void Compile(ValidationEventHandler handler)
+ {
+ // Create the xmlschemainfo object which we use to pass variables like targetnamespace;
+ info = new XmlSchemaInfo();
+
+ //1. Union and List are not allowed in block default
+ if(BlockDefault != XmlSchemaDerivationMethod.All)
+ {
+ if((BlockDefault & XmlSchemaDerivationMethod.List)!=0 )
+ error(handler, "list is not allowed in blockDefault attribute");
+ if((BlockDefault & XmlSchemaDerivationMethod.Union)!=0 )
+ error(handler, "union is not allowed in blockDefault attribute");
+ }
+
+ //2. Substitution is not allowed in finaldefault.
+ if(FinalDefault != XmlSchemaDerivationMethod.All)
+ {
+ if((FinalDefault & XmlSchemaDerivationMethod.Substitution)!=0 )
+ error(handler, "substitution is not allowed in finalDefault attribute");
+ }
+
+ //3. id must be of type ID
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, handler);
+
+ //4. targetNamespace should be of type anyURI or absent
+ if(TargetNamespace != null)
+ {
+ if(!XmlSchemaUtil.CheckAnyUri(TargetNamespace))
+ error(handler, TargetNamespace+" is not a valid value for targetNamespace attribute of schema");
+ else
+ info.TargetNamespace = TargetNamespace;
+ }
+
+ //5. version should be of type normalizedString
+ if(!XmlSchemaUtil.CheckNormalizedString(Version))
+ error(handler, Version + "is not a valid value for version attribute of schema");
+
+ //6. xml:lang must be a language
+ if(!XmlSchemaUtil.CheckLanguage(Language))
+ error(handler, Language + " is not a valid language");
+
+ // elementFormDefault defaults to UnQualified
+ if(ElementFormDefault != XmlSchemaForm.Qualified)
+ info.ElementFormDefault = XmlSchemaForm.Unqualified;
+ else
+ info.ElementFormDefault = XmlSchemaForm.Qualified;
+
+ // attributeFormDefault defaults to UnQualified
+ if(AttributeFormDefault != XmlSchemaForm.Qualified)
+ info.AttributeFormDefault = XmlSchemaForm.Unqualified;
+ else
+ info.AttributeFormDefault = XmlSchemaForm.Qualified;
+
+ if(FinalDefault == XmlSchemaDerivationMethod.All)
+ info.FinalDefault = XmlSchemaDerivationMethod.All;
+ else // If finalDefault is None, info's finalDefault is set to empty
+ info.FinalDefault = (FinalDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction));
+
+ if(BlockDefault == XmlSchemaDerivationMethod.All)
+ info.BlockDefault = XmlSchemaDerivationMethod.All;
+ else // If finalDefault is None, info's blockDefault is set to empty
+ info.BlockDefault = (blockDefault & (XmlSchemaDerivationMethod.Extension |
+ XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution));
+
+ // Compile the content of this schema
+ foreach(XmlSchemaObject obj in Includes)
+ {
+ if(obj is XmlSchemaExternal)
+ {
+ //FIXME: Kuch to karo! (Do Something ;)
+ }
+ else
+ {
+ error(handler,"Object of Type "+obj.GetType().Name+" is not valid in Includes Property of XmlSchema");
+ }
+ }
+ foreach(XmlSchemaObject obj in Items)
+ {
+ if(obj is XmlSchemaAnnotation)
+ {
+ int numerr = ((XmlSchemaAnnotation)obj).Compile(handler,info);
+ errorCount += numerr;
+ if( numerr == 0)
+ {
+ //FIXME: What PSVI set do we add this to?
+ }
+ }
+ else if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ attr.parentIsSchema = true;
+ int numerr = attr.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ Attributes.Add(attr.QualifiedName, attr);
+ }
+ }
+ else if(obj is XmlSchemaAttributeGroup)
+ {
+ XmlSchemaAttributeGroup attrgrp = (XmlSchemaAttributeGroup) obj;
+ int numerr = attrgrp.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ AttributeGroups.Add(attrgrp.QualifiedName, attrgrp);
+ }
+ }
+ else if(obj is XmlSchemaComplexType)
+ {
+ XmlSchemaComplexType ctype = (XmlSchemaComplexType) obj;
+ ctype.istoplevel = true;
+ int numerr = ctype.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ schemaTypes.Add(ctype.QualifiedName, ctype);
+ }
+ }
+ else if(obj is XmlSchemaSimpleType)
+ {
+ XmlSchemaSimpleType stype = (XmlSchemaSimpleType) obj;
+ stype.islocal = false; //This simple type is toplevel
+ int numerr = stype.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ SchemaTypes.Add(stype.QualifiedName, stype);
+ }
+ }
+ else if(obj is XmlSchemaElement)
+ {
+ XmlSchemaElement elem = (XmlSchemaElement) obj;
+ elem.parentIsSchema = true;
+ int numerr = elem.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ Elements.Add(elem.QualifiedName,elem);
+ }
+ }
+ else if(obj is XmlSchemaGroup)
+ {
+ XmlSchemaGroup grp = (XmlSchemaGroup) obj;
+ int numerr = grp.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ Groups.Add(grp.QualifiedName,grp);
+ }
+ }
+ else if(obj is XmlSchemaNotation)
+ {
+ XmlSchemaNotation ntn = (XmlSchemaNotation) obj;
+ int numerr = ntn.Compile(handler,info);
+ errorCount += numerr;
+ if(numerr == 0)
+ {
+ Notations.Add(ntn.QualifiedName, ntn);
+ }
+ }
+ else
+ {
+ ValidationHandler.RaiseValidationError(handler,this,
+ "Object of Type "+obj.GetType().Name+" is not valid in Item Property of Schema");
+ }
+ }
+ Validate(handler);
+ }
+
+ #endregion
+
+ [MonoTODO]
+ private void Validate(ValidationEventHandler handler)
+ {
+ info.SchemaTypes = SchemaTypes;
+
+ foreach(XmlSchemaAttribute attr in Attributes.Values)
+ {
+ attr.Validate(handler, info);
+ }
+ foreach(XmlSchemaAttributeGroup attrgrp in AttributeGroups.Values)
+ {
+ attrgrp.Validate(handler);
+ }
+ foreach(XmlSchemaType type in SchemaTypes.Values)
+ {
+ if(type is XmlSchemaComplexType)
+ {
+ ((XmlSchemaComplexType)type).Validate(handler);
+ }
+ else
+ ((XmlSchemaSimpleType)type).Validate(handler, info);
+ }
+ foreach(XmlSchemaElement elem in Elements.Values)
+ {
+ elem.Validate(handler);
+ }
+ foreach(XmlSchemaGroup grp in Groups.Values)
+ {
+ grp.Validate(handler);
+ }
+ foreach(XmlSchemaNotation ntn in Notations.Values)
+ {
+ ntn.Validate(handler);
+ }
+ }
+
+
+ #region Read
+
+ public static XmlSchema Read(TextReader reader, ValidationEventHandler validationEventHandler)
+ {
+ return Read(new XmlTextReader(reader),validationEventHandler);
+ }
+ public static XmlSchema Read(Stream stream, ValidationEventHandler validationEventHandler)
+ {
+ return Read(new XmlTextReader(stream),validationEventHandler);
+ }
+
+ public static XmlSchema Read(XmlReader rdr, ValidationEventHandler validationEventHandler)
+ {
+ //XmlSerializer xser = new XmlSerializer(typeof(XmlSchema));
+ //return (XmlSchema) xser.Deserialize(reader);
+ XmlSchemaReader reader = new XmlSchemaReader(rdr, validationEventHandler);
+
+ while(reader.ReadNextElement())
+ {
+ switch(reader.NodeType)
+ {
+ case XmlNodeType.Element:
+ if(reader.LocalName == "schema")
+ {
+ XmlSchema schema = new XmlSchema();
+
+ schema.LineNumber = reader.LineNumber;
+ schema.LinePosition = reader.LinePosition;
+ schema.SourceUri = reader.BaseURI;
+
+ ReadAttributes(schema, reader, validationEventHandler);
+ //IsEmptyElement does not behave properly if reader is
+ //positioned at an attribute.
+ reader.MoveToElement();
+ if(!reader.IsEmptyElement)
+ {
+ ReadContent(schema, reader, validationEventHandler);
+ }
+ return schema;
+ }
+ else
+ {
+ //Schema can't be generated. Throw an exception
+ throw new XmlSchemaException("The root element must be schema", null);
+ }
+ default:
+ error(validationEventHandler, "This should never happen. XmlSchema.Read 1 ",null);
+ break;
+ }
+ }
+ throw new XmlSchemaException("The top level schema must have namespace "+XmlSchema.Namespace, null);
+ }
+
+ private static void ReadAttributes(XmlSchema schema, XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ Exception ex;
+
+ reader.MoveToElement();
+ while(reader.MoveToNextAttribute())
+ {
+ switch(reader.Name)
+ {
+ case "attributeFormDefault" :
+ schema.attributeFormDefault = XmlSchemaUtil.ReadFormAttribute(reader,out ex);
+ if(ex != null)
+ error(h, reader.Value + " is not a valid value for attributeFormDefault.", ex);
+ break;
+ case "blockDefault" :
+ schema.blockDefault = XmlSchemaUtil.ReadDerivationAttribute(reader,out ex, "blockDefault");
+ if(ex != null)
+ warn(h, ex.Message, ex);
+ break;
+ case "elementFormDefault":
+ schema.elementFormDefault = XmlSchemaUtil.ReadFormAttribute(reader, out ex);
+ if(ex != null)
+ error(h, reader.Value + " is not a valid value for elementFormDefault.", ex);
+ break;
+ case "finalDefault":
+ schema.finalDefault = XmlSchemaUtil.ReadDerivationAttribute(reader, out ex, "finalDefault");
+ if(ex != null)
+ warn(h, ex.Message , ex);
+ break;
+ case "id":
+ schema.id = reader.Value;
+ break;
+ case "targetNamespace":
+ schema.targetNamespace = reader.Value;
+ break;
+ case "version":
+ schema.version = reader.Value;
+ break;
+ case "xml:lang":
+ schema.language = reader.Value;
+ break;
+ default:
+ if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ error(h, reader.Name + " attribute is not allowed in schema element",null);
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,schema);
+ }
+ break;
+ }
+ }
+ }
+
+ private static void ReadContent(XmlSchema schema, XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ reader.MoveToElement();
+ if(reader.LocalName != "schema" && reader.NamespaceURI != XmlSchema.Namespace && reader.NodeType != XmlNodeType.Element)
+ error(h, "UNREACHABLE CODE REACHED: Method: Schema.ReadContent, " + reader.LocalName + ", " + reader.NamespaceURI,null);
+
+ //(include | import | redefine | annotation)*,
+ //((simpleType | complexType | group | attributeGroup | element | attribute | notation | annotation)*
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchema.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1)
+ {
+ if(reader.LocalName == "include")
+ {
+ XmlSchemaInclude include = XmlSchemaInclude.Read(reader,h);
+ if(include != null)
+ schema.includes.Add(include);
+ continue;
+ }
+ if(reader.LocalName == "import")
+ {
+ XmlSchemaImport import = XmlSchemaImport.Read(reader,h);
+ if(import != null)
+ schema.includes.Add(import);
+ continue;
+ }
+ if(reader.LocalName == "redefine")
+ {
+ XmlSchemaRedefine redefine = XmlSchemaRedefine.Read(reader,h);
+ if(redefine != null)
+ schema.includes.Add(redefine);
+ continue;
+ }
+ if(reader.LocalName == "annotation")
+ {
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ schema.items.Add(annotation);
+ continue;
+ }
+ }
+ if(level <=2)
+ {
+ level = 2;
+ if(reader.LocalName == "simpleType")
+ {
+ XmlSchemaSimpleType stype = XmlSchemaSimpleType.Read(reader,h);
+ if(stype != null)
+ schema.items.Add(stype);
+ continue;
+ }
+ if(reader.LocalName == "complexType")
+ {
+ XmlSchemaComplexType ctype = XmlSchemaComplexType.Read(reader,h);
+ if(ctype != null)
+ schema.items.Add(ctype);
+ continue;
+ }
+ if(reader.LocalName == "group")
+ {
+ XmlSchemaGroup group = XmlSchemaGroup.Read(reader,h);
+ if(group != null)
+ schema.items.Add(group);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ XmlSchemaAttributeGroup attributeGroup = XmlSchemaAttributeGroup.Read(reader,h);
+ if(attributeGroup != null)
+ schema.items.Add(attributeGroup);
+ continue;
+ }
+ if(reader.LocalName == "element")
+ {
+ XmlSchemaElement element = XmlSchemaElement.Read(reader,h);
+ if(element != null)
+ schema.items.Add(element);
+ continue;
+ }
+ if(reader.LocalName == "attribute")
+ {
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ schema.items.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "notation")
+ {
+ XmlSchemaNotation notation = XmlSchemaNotation.Read(reader,h);
+ if(notation != null)
+ schema.items.Add(notation);
+ continue;
+ }
+ if(reader.LocalName == "annotation")
+ {
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ schema.items.Add(annotation);
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ }
+ #endregion
+
+ #region write
+
+ public void Write(System.IO.Stream stream)
+ {
+ Write(stream,null);
+ }
+ public void Write(System.IO.TextWriter writer)
+ {
+ Write(writer,null);
+ }
+ public void Write(System.Xml.XmlWriter writer)
+ {
+ Write(writer,null);
+ }
+ public void Write(System.IO.Stream stream, System.Xml.XmlNamespaceManager namespaceManager)
+ {
+ Write(new XmlTextWriter(stream,null),namespaceManager);
+ }
+ public void Write(System.IO.TextWriter writer, System.Xml.XmlNamespaceManager namespaceManager)
+ {
+ XmlTextWriter xwriter = new XmlTextWriter(writer);
+ xwriter.Formatting = Formatting.Indented;
+ Write(xwriter,namespaceManager);
+ }
+ public void Write(System.Xml.XmlWriter writer, System.Xml.XmlNamespaceManager namespaceManager)
+ {
+ if(Namespaces == null)
+ {
+ Namespaces = new XmlSerializerNamespaces();
+ }
+ //Add the xml schema namespace.
+ if(Namespaces.Count == 0)
+ {
+ Namespaces.Add("xs", XmlSchema.Namespace);
+ if (TargetNamespace != null && TargetNamespace != String.Empty)
+ Namespaces.Add("tns", TargetNamespace);
+ }
+ if(namespaceManager != null)
+ {
+ foreach(string name in namespaceManager)
+ {
+ //xml and xmlns namespaced are added by default in namespaceManager.
+ //So we should ignore them
+ if(name!="xml" && name != "xmlns")
+ Namespaces.Add(name,namespaceManager.LookupNamespace(name));
+ }
+ }
+
+ XmlSerializer xser = new XmlSerializer(typeof(XmlSchema));
+ xser.Serialize(writer,this,Namespaces);
+ writer.Flush();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
new file mode 100755
index 00000000000..21e52e7e5b6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
@@ -0,0 +1,165 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAll.
+ /// </summary>
+ public class XmlSchemaAll : XmlSchemaGroupBase
+ {
+ private XmlSchemaObjectCollection items;
+ private static string xmlname = "all";
+
+ public XmlSchemaAll()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+
+ /// <remarks>
+ /// 1. MaxOccurs must be one. (default is also one)
+ /// 2. MinOccurs must be zero or one.
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ //FIXME: Should we reset the values on error??
+ if(MaxOccurs != Decimal.One)
+ error(h,"maxOccurs must be 1");
+ if(MinOccurs != Decimal.One && MinOccurs != Decimal.Zero)
+ error(h,"minOccurs must be 0 or 1");
+
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);
+
+ foreach(XmlSchemaObject obj in Items)
+ {
+ if(obj is XmlSchemaElement)
+ {
+ XmlSchemaElement elem = (XmlSchemaElement)obj;
+ if(elem.MaxOccurs != Decimal.One && elem.MaxOccurs != Decimal.Zero)
+ {
+ elem.error(h,"The {max occurs} of all the elements of 'all' must be 0 or 1. ");
+ }
+ errorCount += elem.Compile(h,info);
+ }
+ else
+ {
+ error(h,"XmlSchemaAll can only contain Items of type Element");
+ }
+ }
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<all
+ // id = ID
+ // maxOccurs = 1 : 1
+ // minOccurs = (0 | 1) : 1
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, element*)
+ //</all>
+ internal static XmlSchemaAll Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAll all = new XmlSchemaAll();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAll.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ all.LineNumber = reader.LineNumber;
+ all.LinePosition = reader.LinePosition;
+ all.SourceUri = reader.BaseURI;
+
+ //Read Attributes
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ all.Id = reader.Value;
+ }
+ else if(reader.Name == "maxOccurs")
+ {
+ try
+ {
+ all.MaxOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for maxOccurs",e);
+ }
+ }
+ else if(reader.Name == "minOccurs")
+ {
+ try
+ {
+ all.MinOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for minOccurs",e);
+ }
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for all",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,all);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return all;
+
+ //Content: (annotation?, element*)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAll.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ all.Annotation = annotation;
+ continue;
+ }
+ if(level <=2 && reader.LocalName == "element")
+ {
+ level = 2;
+ XmlSchemaElement element = XmlSchemaElement.Read(reader,h);
+ if(element != null)
+ all.items.Add(element);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return all;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs
new file mode 100755
index 00000000000..6631dfed480
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs
@@ -0,0 +1,56 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAnnotated.
+ /// </summary>
+
+ public class XmlSchemaAnnotated : XmlSchemaObject
+ {
+ private XmlSchemaAnnotation annotation;
+ private string id;
+ private XmlAttribute[] unhandledAttributes;
+
+ public XmlSchemaAnnotated()
+ {}
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id; }
+ set{ id = value; }
+ }
+
+ [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnnotation Annotation
+ {
+ get{ return annotation; }
+ set{ annotation = value; }
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get
+ {
+ if(unhandledAttributeList != null)
+ {
+ unhandledAttributes = (XmlAttribute[]) unhandledAttributeList.ToArray(typeof(XmlAttribute));
+ unhandledAttributeList = null;
+ }
+ return unhandledAttributes;
+ }
+ set
+ {
+ unhandledAttributes = value;
+ unhandledAttributeList = null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
new file mode 100755
index 00000000000..12fe3d26875
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
@@ -0,0 +1,145 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAnnotation.
+ /// </summary>
+ public class XmlSchemaAnnotation : XmlSchemaObject
+ {
+ private string id;
+ private XmlSchemaObjectCollection items;
+ private XmlAttribute[] unhandledAttributes;
+ private static string xmlname = "annotation";
+ public XmlSchemaAnnotation()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id; }
+ set{ id = value; }
+ }
+
+ [XmlElement("appinfo",typeof(XmlSchemaAppInfo),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("documentation",typeof(XmlSchemaDocumentation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get
+ {
+ if(unhandledAttributeList != null)
+ {
+ unhandledAttributes = (XmlAttribute[]) unhandledAttributeList.ToArray(typeof(XmlAttribute));
+ unhandledAttributeList = null;
+ }
+ return unhandledAttributes;
+ }
+ set
+ {
+ unhandledAttributes = value;
+ unhandledAttributeList = null;
+ }
+ }
+
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return 0;
+ }
+
+ //<annotation
+ // id = ID
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (appinfo | documentation)*
+ //</annotation>
+ internal static XmlSchemaAnnotation Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAnnotation.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ annotation.LineNumber = reader.LineNumber;
+ annotation.LinePosition = reader.LinePosition;
+ annotation.SourceUri = reader.BaseURI;
+
+ //Read Attributes
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ annotation.Id = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for annotation",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,annotation);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return annotation;
+
+ //Content: (appinfo | documentation)*
+ bool skip = false;
+ while(!reader.EOF)
+ {
+ if(skip)
+ skip=false;
+ else
+ reader.ReadNextElement();
+
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAnnotation.Read, name="+reader.Name,null);
+ break;
+ }
+ if(reader.LocalName == "appinfo")
+ {
+ XmlSchemaAppInfo appinfo = XmlSchemaAppInfo.Read(reader,h,out skip);
+ if(appinfo != null)
+ annotation.items.Add(appinfo);
+ continue;
+ }
+ if(reader.LocalName == "documentation")
+ {
+ XmlSchemaDocumentation documentation = XmlSchemaDocumentation.Read(reader,h, out skip);
+ if(documentation != null)
+ annotation.items.Add(documentation);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return annotation;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
new file mode 100755
index 00000000000..6f652481669
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
@@ -0,0 +1,192 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAny.
+ /// </summary>
+ public class XmlSchemaAny : XmlSchemaParticle
+ {
+ private string nameSpace;
+ private XmlSchemaContentProcessing processing;
+ private static string xmlname = "any";
+
+ public XmlSchemaAny()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("namespace")]
+ public string Namespace
+ {
+ get{ return nameSpace; }
+ set{ nameSpace = value; }
+ }
+
+ [DefaultValue(XmlSchemaContentProcessing.None)]
+ [System.Xml.Serialization.XmlAttribute("processContents")]
+ public XmlSchemaContentProcessing ProcessContents
+ {
+ get{ return processing; }
+ set{ processing = value; }
+ }
+
+ /// <remarks>
+ /// 1. id must be of type ID
+ /// 2. namespace can have one of the following values:
+ /// a) ##any or ##other
+ /// b) list of anyURI and ##targetNamespace and ##local
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ //define ##any=1,##other=2,##targetNamespace=4,##local=8,anyURI=16
+ int nscount = 0;
+ string[] nslist = XmlSchemaUtil.SplitList(Namespace);
+ foreach(string ns in nslist)
+ {
+ switch(ns)
+ {
+ case "##any":
+ nscount |= 1;
+ break;
+ case "##other":
+ nscount |= 2;
+ break;
+ case "##targetNamespace":
+ nscount |= 4;
+ break;
+ case "##local":
+ nscount |= 8;
+ break;
+ default:
+ if(!XmlSchemaUtil.CheckAnyUri(ns))
+ error(h,"the namespace is not a valid anyURI");
+ else
+ nscount |= 16;
+ break;
+ }
+ }
+ if((nscount&1) == 1 && nscount != 1)
+ error(h,"##any if present must be the only namespace attribute");
+ if((nscount&2) == 2 && nscount != 2)
+ error(h,"##other if present must be the only namespace attribute");
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<any
+ // id = ID
+ // maxOccurs = (nonNegativeInteger | unbounded) : 1
+ // minOccurs = nonNegativeInteger : 1
+ // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any
+ // processContents = (lax | skip | strict) : strict
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</any>
+ internal static XmlSchemaAny Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAny any = new XmlSchemaAny();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAny.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ any.LineNumber = reader.LineNumber;
+ any.LinePosition = reader.LinePosition;
+ any.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ any.Id = reader.Value;
+ }
+ else if(reader.Name == "maxOccurs")
+ {
+ try
+ {
+ any.MaxOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for maxOccurs",e);
+ }
+ }
+ else if(reader.Name == "minOccurs")
+ {
+ try
+ {
+ any.MinOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for minOccurs", e);
+ }
+ }
+ else if(reader.Name == "namespace")
+ {
+ any.nameSpace = reader.Value;
+ }
+ else if(reader.Name == "processContents")
+ {
+ Exception innerex;
+ any.processing = XmlSchemaUtil.ReadProcessingAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for processContents",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for any",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,any);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return any;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAny.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ any.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return any;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
new file mode 100755
index 00000000000..fb1a515e5ca
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
@@ -0,0 +1,169 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAnyAttribute.
+ /// </summary>
+ public class XmlSchemaAnyAttribute : XmlSchemaAnnotated
+ {
+ private string nameSpace;
+ private XmlSchemaContentProcessing processing;
+ private static string xmlname = "anyAttribute";
+
+ public XmlSchemaAnyAttribute()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("namespace")]
+ public string Namespace
+ {
+ get{ return nameSpace; }
+ set{ nameSpace = value; }
+ }
+
+ [DefaultValue(XmlSchemaContentProcessing.None)]
+ [System.Xml.Serialization.XmlAttribute("processContents")]
+ public XmlSchemaContentProcessing ProcessContents
+ {
+ get{ return processing; }
+ set{ processing = value; }
+ }
+
+ /// <remarks>
+ /// 1. id must be of type ID
+ /// 2. namespace can have one of the following values:
+ /// a) ##any or ##other
+ /// b) list of anyURI and ##targetNamespace and ##local
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ //define ##any=1,##other=2,##targetNamespace=4,##local=8,anyURI=16
+ int nscount = 0;
+ string[] nslist = XmlSchemaUtil.SplitList(Namespace);
+ foreach(string ns in nslist)
+ {
+ switch(ns)
+ {
+ case "##any":
+ nscount |= 1;
+ break;
+ case "##other":
+ nscount |= 2;
+ break;
+ case "##targetNamespace":
+ nscount |= 4;
+ break;
+ case "##local":
+ nscount |= 8;
+ break;
+ default:
+ if(!XmlSchemaUtil.CheckAnyUri(ns))
+ error(h,"the namespace is not a valid anyURI");
+ else
+ nscount |= 16;
+ break;
+ }
+ }
+ if((nscount&1) == 1 && nscount != 1)
+ error(h,"##any if present must be the only namespace attribute");
+ if((nscount&2) == 2 && nscount != 2)
+ error(h,"##other if present must be the only namespace attribute");
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<anyAttribute
+ // id = ID
+ // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any
+ // processContents = (lax | skip | strict) : strict
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</anyAttribute>
+ internal static XmlSchemaAnyAttribute Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAnyAttribute any = new XmlSchemaAnyAttribute();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAnyAttribute.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ any.LineNumber = reader.LineNumber;
+ any.LinePosition = reader.LinePosition;
+ any.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ any.Id = reader.Value;
+ }
+ else if(reader.Name == "namespace")
+ {
+ any.nameSpace = reader.Value;
+ }
+ else if(reader.Name == "processContents")
+ {
+ Exception innerex;
+ any.processing = XmlSchemaUtil.ReadProcessingAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for processContents",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for anyAttribute",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,any);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return any;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAnyAttribute.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ any.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return any;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs
new file mode 100755
index 00000000000..da66837c504
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs
@@ -0,0 +1,91 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAppInfo.
+ /// </summary>
+ public class XmlSchemaAppInfo : XmlSchemaObject
+ {
+ private XmlNode[] markup;
+ private string source;
+
+ public XmlSchemaAppInfo()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("source")]
+ public string Source
+ {
+ get{ return source; }
+ set{ source = value; }
+ }
+
+ [XmlAnyElement]
+ [XmlText]
+ public XmlNode[] Markup
+ {
+ get{ return markup; }
+ set{ markup = value; }
+ }
+
+ //<appinfo
+ // source = anyURI>
+ // Content: ({any})*
+ //</appinfo>
+ internal static XmlSchemaAppInfo Read(XmlSchemaReader reader, ValidationEventHandler h, out bool skip)
+ {
+ skip = false;
+ XmlSchemaAppInfo appinfo = new XmlSchemaAppInfo();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != "appinfo")
+ {
+ error(h,"Should not happen :1: XmlSchemaAppInfo.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ appinfo.LineNumber = reader.LineNumber;
+ appinfo.LinePosition = reader.LinePosition;
+ appinfo.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "source")
+ {
+ appinfo.source = reader.Value;
+ }
+ else
+ {
+ error(h,reader.Name + " is not a valid attribute for appinfo",null);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return appinfo;
+
+ //Content {any}*
+ //FIXME: This is a pure Quick Hack; There must be a another method;
+ XmlDocument xmldoc = new XmlDocument();
+ xmldoc.AppendChild(xmldoc.ReadNode(reader));
+ XmlNode root = xmldoc.FirstChild;
+ if(root != null && root.ChildNodes != null)
+ {
+ appinfo.Markup = new XmlNode[root.ChildNodes.Count];
+ for(int i=0;i<root.ChildNodes.Count;i++)
+ {
+ appinfo.Markup[i] = root.ChildNodes[i];
+ }
+ }
+ if(reader.NodeType == XmlNodeType.Element || reader.NodeType == XmlNodeType.EndElement)
+ skip = true;
+ return appinfo;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
new file mode 100755
index 00000000000..a7e82b6db3f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
@@ -0,0 +1,435 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAttribute.
+ /// </summary>
+ public class XmlSchemaAttribute : XmlSchemaAnnotated
+ {
+ private object attributeType;
+ private string defaultValue;
+ private string fixedValue;
+ private XmlSchemaForm form;
+ private string name;
+ private XmlQualifiedName qualifiedName;
+ private XmlQualifiedName refName;
+ private XmlSchemaSimpleType schemaType;
+ private XmlQualifiedName schemaTypeName;
+ private XmlSchemaUse use;
+ //Compilation fields
+ internal bool parentIsSchema = false;
+ private static string xmlname = "attribute";
+
+ public XmlSchemaAttribute()
+ {
+ //FIXME: Docs says the default is optional.
+ //Whereas the MS implementation has default None.
+ form = XmlSchemaForm.None;
+ use = XmlSchemaUse.None;
+ schemaTypeName = XmlQualifiedName.Empty;
+ qualifiedName = XmlQualifiedName.Empty;
+ refName = XmlQualifiedName.Empty;
+ }
+
+ // Properties
+ #region Properties
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("default")]
+ public string DefaultValue
+ {
+ get{ return defaultValue;}
+ set
+ { // Default Value and fixed Value are mutually exclusive
+ fixedValue = null;
+ defaultValue = value;
+ }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("fixed")]
+ public string FixedValue
+ {
+ get{ return fixedValue;}
+ set
+ { // Default Value and fixed Value are mutually exclusive
+ defaultValue = null;
+ fixedValue = value;
+ }
+ }
+
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("form")]
+ public XmlSchemaForm Form
+ {
+ get{ return form;}
+ set{ form = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name;}
+ set
+ {
+ name = value;
+ }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName;}
+ set
+ {
+ refName = value;
+ }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("type")]
+ public XmlQualifiedName SchemaTypeName
+ {
+ get{ return schemaTypeName;}
+ set{ schemaTypeName = value;}
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType SchemaType
+ {
+ get{ return schemaType;}
+ set{ schemaType = value;}
+ }
+
+ [DefaultValue(XmlSchemaUse.None)]
+ [System.Xml.Serialization.XmlAttribute("use")]
+ public XmlSchemaUse Use
+ {
+ get{ return use;}
+ set{ use = value;}
+ }
+
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qualifiedName;}
+ }
+
+ [XmlIgnore]
+ public object AttributeType
+ { //FIXME: This is not correct. Is it?
+ get{ return attributeType; }
+ }
+
+ #endregion
+
+ /// <remarks>
+ /// For an attribute:
+ /// a) If the parent is schema
+ /// 1-5 are from <xs:complexType name="topLevelAttribute"> in the Schema for Schema
+ /// 6-8 are from "Constraints on XML Representations of Attribute Declarations"
+ /// 9-10 are from "Attribute Declaration Schema Component"
+ /// 11-16 are from "Constraints on Attribute Declaration Schema Components"
+ /// 1. ref must be absent
+ /// 2. form must be absent
+ /// 3. use must be absent
+ /// 4. name must be present and of type NCName
+ /// 5. *NO CHECK REQUIRED* Only simple types and annotation are allowed as content
+ /// 6. default and fixed must not both be present.
+ /// 7. *NO CHECK REQUIRED* If default and use are both present... (Not possible since use is absent)
+ /// 8. type and <simpleType> must not both be present.
+ /// 9. Target Namespace should be schema's targetnamespace or absent
+ /// 10. Type Definiton coressponds to <simpletype> element, or type value, or absent
+ /// 11. *TO UNDERSTAND* Missing Sub-components
+ /// 12. value constraint must be of the same datatype as of type
+ /// 13. if the type definition is ID then there should be no value constraint.
+ /// 14. name must not be xmlns
+ /// 15. Targetnamespace must not be xsi. This implies the target namespace of schema can't be xsi if toplevel attributes are used.
+ /// 16. *Exception to rule 15* inbuilt attributes: xsi:nil, xsi:type, xsi:schemaLocation, xsi: noNamespaceSchemaLocation
+ /// b) If the parent is complextype and ref is not set
+ /// 1. name must be present and of type NCName.
+ /// 2. type and <simpleType> must not both be present.
+ /// 3. default and fixed must not both be present.
+ /// 4. If default and use are both present, use must have the ·actual value· optional.
+ /// 5. name must not be xmlns
+ /// 6. Targetnamespace must not be xsi.
+ /// 7. *Exception to rule 15* inbuilt attributes: xsi:nil, xsi:type, xsi:schemaLocation, xsi: noNamespaceSchemaLocation
+ /// 8. If form has actual value qualified or the schema's formdefault is qualified, targetnamespace
+ /// is same as schema's target namespace, otherwise absent.
+ /// c) if the parent is not schema and ref is set
+ /// 1. name must not be present
+ /// 2. all of <simpleType>, form and type must be absent.
+ /// 3. default and fixed must not both be present.
+ /// 4. If default and use are both present, use must have the ·actual value· optional.
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ if(parentIsSchema)//a
+ {
+ if(RefName!= null && !RefName.IsEmpty) // a.1
+ error(h,"ref must be absent in the top level <attribute>");
+
+ if(Form != XmlSchemaForm.None) // a.2
+ error(h,"form must be absent in the top level <attribute>");
+
+ if(Use != XmlSchemaUse.None) // a.3
+ error(h,"use must be absent in the top level <attribute>");
+
+ // TODO: a.10, a.11, a.12, a.13
+ CompileCommon(h,info, true);
+ }
+ else // local
+ {
+ //FIXME: How to Use of AttributeFormDefault????
+ if(RefName == null || RefName.IsEmpty)
+ {
+ //TODO: b.8
+ CompileCommon(h,info, true);
+ }
+ else
+ {
+ if(this.name != null)
+ error(h,"name must be absent if ref is present");
+ if(this.form != XmlSchemaForm.None)
+ error(h,"form must be absent if ref is present");
+ if(this.schemaType != null)
+ error(h,"simpletype must be absent if ref is present");
+ if(this.schemaTypeName != null && !this.schemaTypeName.IsEmpty)
+ error(h,"type must be absent if ref is present");
+ CompileCommon(h,info,false);
+ }
+ }
+
+ return errorCount;
+ }
+
+ private void CompileCommon(ValidationEventHandler h, XmlSchemaInfo info, bool refIsNotPresent)
+ {
+ if(refIsNotPresent)
+ {
+ if(Name == null) //a.4, b.1,
+ error(h,"Required attribute name must be present");
+ else if(!XmlSchemaUtil.CheckNCName(Name)) // a.4.2, b1.2
+ error(h,"attribute name must be NCName");
+ else if(Name == "xmlns") // a.14 , b5
+ error(h,"attribute name must not be xmlns");
+ else
+ qualifiedName = new XmlQualifiedName(Name, info.TargetNamespace);
+
+ if(SchemaType != null)
+ {
+ if(SchemaTypeName != null && !SchemaTypeName.IsEmpty) // a.8
+ error(h,"attribute can't have both a type and <simpleType> content");
+
+ errorCount += SchemaType.Compile(h,info);
+ }
+
+ if(SchemaTypeName != null && !XmlSchemaUtil.CheckQName(SchemaTypeName))
+ error(h,SchemaTypeName+" is not a valid QName");
+ }
+ else
+ {
+ if(RefName == null || RefName.IsEmpty)
+ error(h,"Error: Should Never Happen. refname must be present");
+ else
+ qualifiedName = RefName;
+ }
+
+ if(info.TargetNamespace == XmlSchema.InstanceNamespace && Name != "nil" && Name != "type"
+ && Name != "schemaLocation" && Name != "noNamespaceSchemaLocation") // a.15, a.16
+ error(h,"targetNamespace can't be " + XmlSchema.InstanceNamespace);
+
+ if(DefaultValue != null && FixedValue != null) // a.6, b.3, c.3
+ error(h,"default and fixed must not both be present in an Attribute");
+
+ if(DefaultValue != null && Use != XmlSchemaUse.None && Use != XmlSchemaUse.Optional)
+ error(h,"if default is present, use must be optional");
+
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);
+ }
+
+ /// <summary>
+ /// Schema Component:
+ /// QName, SimpleType, Scope, Default|Fixed, annotation
+ /// </summary>
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(isCompiled)
+ return errorCount;
+
+ //If Parent is schema:
+ if(parentIsSchema)
+ {
+ if(SchemaType != null)
+ {
+ errorCount += SchemaType.Validate(h, info);
+ attributeType = SchemaType;
+ }
+ else if(SchemaTypeName != null && !SchemaTypeName.IsEmpty)
+ {
+ //First Try to get a Inbuilt DataType
+ XmlSchemaDatatype dtype = XmlSchemaDatatype.GetType(SchemaTypeName);
+ if(dtype != null)
+ {
+ attributeType = dtype;
+ }
+ else
+ {
+ XmlSchemaObject obj = info.SchemaTypes[SchemaTypeName];
+
+ if(obj is XmlSchemaSimpleType)
+ {
+ XmlSchemaSimpleType stype = (XmlSchemaSimpleType) obj;
+ errorCount += stype.Validate(h, info);
+ attributeType = stype;
+ }
+ else if(attributeType == null)
+ error(h,"The type '"+ SchemaTypeName +"' is not defined in the schema");
+ else if(attributeType is XmlSchemaComplexType)
+ error(h,"An attribute can't have complexType Content");
+ else
+ error(h, "Should Never Happen. Illegal content in SchemaTypes");
+ }
+ }
+ else
+ {
+ error(h,"Should Never Happen. Attribute SimpleType Not set. Should have been caught in the Compile() phase");
+ }
+ }
+ else
+ {
+ //TODO: Local Attribute Validation
+ }
+ isCompiled = true;
+ return errorCount;
+ }
+ //<attribute
+ // default = string
+ // fixed = string
+ // form = (qualified | unqualified)
+ // id = ID
+ // name = NCName
+ // ref = QName
+ // type = QName
+ // use = (optional | prohibited | required) : optional
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (simpleType?))
+ //</attribute>
+ internal static XmlSchemaAttribute Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAttribute attribute = new XmlSchemaAttribute();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAttribute.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ attribute.LineNumber = reader.LineNumber;
+ attribute.LinePosition = reader.LinePosition;
+ attribute.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "default")
+ {
+ attribute.defaultValue = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ attribute.fixedValue = reader.Value;
+ }
+ else if(reader.Name == "form")
+ {
+ Exception innerex;
+ attribute.form = XmlSchemaUtil.ReadFormAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for form attribute", innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ attribute.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ attribute.name = reader.Value;
+ }
+ else if(reader.Name == "ref")
+ {
+ Exception innerex;
+ attribute.refName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for ref attribute",innerex);
+ }
+ else if(reader.Name == "type")
+ {
+ Exception innerex;
+ attribute.schemaTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for type attribute",innerex);
+ }
+ else if(reader.Name == "use")
+ {
+ Exception innerex;
+ attribute.use = XmlSchemaUtil.ReadUseAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for use attribute", innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for attribute",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,attribute);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return attribute;
+
+ // Content: (annotation?, (simpleType?))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAttribute.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ attribute.Annotation = annotation;
+ continue;
+ }
+ if(level <=2 && reader.LocalName == "simpleType")
+ {
+ level = 3;
+ XmlSchemaSimpleType stype = XmlSchemaSimpleType.Read(reader,h);
+ if(stype != null)
+ attribute.schemaType = stype;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return attribute;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
new file mode 100755
index 00000000000..ab5d1da1afe
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
@@ -0,0 +1,208 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAttributeGroup.
+ /// </summary>
+ public class XmlSchemaAttributeGroup : XmlSchemaAnnotated
+ {
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private string name;
+ private XmlSchemaAttributeGroup redefined;
+ private XmlQualifiedName qualifiedName;
+ private static string xmlname = "attributeGroup";
+
+ public XmlSchemaAttributeGroup()
+ {
+ attributes = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name;}
+ set{ name = value;}
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes;}
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any;}
+ set{ any = value;}
+ }
+
+ //Undocumented property
+ [XmlIgnore]
+ public XmlSchemaAttributeGroup RedefinedAttributeGroup
+ {
+ get{ return redefined;}
+ }
+
+ [XmlIgnore]
+ internal XmlQualifiedName QualifiedName
+ {
+ get{ return qualifiedName;}
+ }
+
+ /// <remarks>
+ /// An Attribute group can only be defined as a child of XmlSchema or in XmlSchemaRedefine.
+ /// The other attributeGroup has type XmlSchemaAttributeGroupRef.
+ /// 1. Name must be present
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ if(this.Name == null) //1
+ error(h,"Name is required in top level simpletype");
+ else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2
+ error(h,"name attribute of a simpleType must be NCName");
+ else
+ this.qualifiedName = new XmlQualifiedName(this.Name,info.TargetNamespace);
+
+ if(this.AnyAttribute != null)
+ {
+ errorCount += this.AnyAttribute.Compile(h,info);
+ }
+
+ foreach(XmlSchemaObject obj in Attributes)
+ {
+ if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ errorCount += attr.Compile(h, info);
+ }
+ else if(obj is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef) obj;
+ errorCount += gref.Compile(h, info);
+ }
+ else
+ {
+ error(h,"invalid type of object in Attributes property");
+ }
+ }
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<attributeGroup
+ // id = ID
+ // name = NCName
+ // ref = QName // Not present in this class.
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
+ //</attributeGroup>
+ internal static XmlSchemaAttributeGroup Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAttributeGroup attrgrp = new XmlSchemaAttributeGroup();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAttributeGroup.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ attrgrp.LineNumber = reader.LineNumber;
+ attrgrp.LinePosition = reader.LinePosition;
+ attrgrp.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ attrgrp.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ attrgrp.name = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for attributeGroup in this context",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,attrgrp);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return attrgrp;
+
+ //Content: 1.annotation?, 2.(attribute | attributeGroup)*, 3.anyAttribute?
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAttributeGroup.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ attrgrp.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "attribute")
+ {
+ level = 2;
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ attrgrp.Attributes.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ level = 2;
+ XmlSchemaAttributeGroupRef attr = XmlSchemaAttributeGroupRef.Read(reader,h);
+ if(attr != null)
+ attrgrp.attributes.Add(attr);
+ continue;
+ }
+ }
+ if(level <= 3 && reader.LocalName == "anyAttribute")
+ {
+ level = 4;
+ XmlSchemaAnyAttribute anyattr = XmlSchemaAnyAttribute.Read(reader,h);
+ if(anyattr != null)
+ attrgrp.AnyAttribute = anyattr;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return attrgrp;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
new file mode 100755
index 00000000000..0fb4a4261aa
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
@@ -0,0 +1,126 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAttributeGroupRef.
+ /// </summary>
+ public class XmlSchemaAttributeGroupRef : XmlSchemaAnnotated
+ {
+ private XmlQualifiedName refName;
+ private static string xmlname = "attributeGroup";
+ public XmlSchemaAttributeGroupRef()
+ {
+ refName = XmlQualifiedName.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName; }
+ set{ refName = value; }
+ }
+
+ /// <remarks>
+ /// 1. ref must be present
+ /// 2. The element must be empty. ?? FIXME: Is this correct or annotation is permitted?
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+ if(RefName == null || RefName.IsEmpty)
+ error(h, "ref must be present");
+ else if(!XmlSchemaUtil.CheckQName(RefName))
+ error(h, "ref must be a valid qname");
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+// if(this.Annotation != null)
+// error(h, "attributegroup with a ref can't have any content");
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<attributeGroup
+ // id = ID
+ // ref = QName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</attributeGroup>
+ internal static XmlSchemaAttributeGroupRef Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaAttributeGroupRef attrgrp = new XmlSchemaAttributeGroupRef();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAttributeGroupRef.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ attrgrp.LineNumber = reader.LineNumber;
+ attrgrp.LinePosition = reader.LinePosition;
+ attrgrp.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ attrgrp.Id = reader.Value;
+ }
+ else if(reader.Name == "ref")
+ {
+ Exception innerex;
+ attrgrp.refName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for ref attribute",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for attributeGroup in this context",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,attrgrp);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return attrgrp;
+ int level = 1;
+
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaAttributeGroupRef.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ attrgrp.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return attrgrp;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
new file mode 100755
index 00000000000..040de9d9719
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
@@ -0,0 +1,203 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAll.
+ /// </summary>
+ public class XmlSchemaChoice : XmlSchemaGroupBase
+ {
+ private XmlSchemaObjectCollection items;
+ private static string xmlname = "choice";
+
+ public XmlSchemaChoice()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("any",typeof(XmlSchemaAny),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ //FIXME: Should we reset the values
+ if(MinOccurs > MaxOccurs)
+ error(h,"minOccurs must be less than or equal to maxOccurs");
+
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);
+
+ foreach(XmlSchemaObject obj in Items)
+ {
+ if(obj is XmlSchemaElement)
+ {
+ errorCount += ((XmlSchemaElement)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaGroupRef)
+ {
+ errorCount += ((XmlSchemaGroupRef)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaChoice)
+ {
+ errorCount += ((XmlSchemaChoice)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaSequence)
+ {
+ errorCount += ((XmlSchemaSequence)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaAny)
+ {
+ errorCount += ((XmlSchemaAny)obj).Compile(h,info);
+ }
+ }
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<choice
+ // id = ID
+ // maxOccurs = (nonNegativeInteger | unbounded) : 1
+ // minOccurs = nonNegativeInteger : 1
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (element | group | choice | sequence | any)*)
+ //</choice>
+ internal static XmlSchemaChoice Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaChoice choice = new XmlSchemaChoice();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaChoice.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ choice.LineNumber = reader.LineNumber;
+ choice.LinePosition = reader.LinePosition;
+ choice.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ choice.Id = reader.Value;
+ }
+ else if(reader.Name == "maxOccurs")
+ {
+ try
+ {
+ choice.MaxOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for maxOccurs",e);
+ }
+ }
+ else if(reader.Name == "minOccurs")
+ {
+ try
+ {
+ choice.MinOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for minOccurs",e);
+ }
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for choice",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,choice);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return choice;
+
+ // Content: (annotation?, (element | group | choice | sequence | any)*)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaChoice.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ choice.Annotation = annotation;
+ continue;
+ }
+ if(level <=2)
+ {
+ if(reader.LocalName == "element")
+ {
+ level = 2;
+ XmlSchemaElement element = XmlSchemaElement.Read(reader,h);
+ if(element != null)
+ choice.items.Add(element);
+ continue;
+ }
+ if(reader.LocalName == "group")
+ {
+ level = 2;
+ XmlSchemaGroupRef group = XmlSchemaGroupRef.Read(reader,h);
+ if(group != null)
+ choice.items.Add(group);
+ continue;
+ }
+ if(reader.LocalName == "choice")
+ {
+ level = 2;
+ XmlSchemaChoice ch = XmlSchemaChoice.Read(reader,h);
+ if(ch != null)
+ choice.items.Add(ch);
+ continue;
+ }
+ if(reader.LocalName == "sequence")
+ {
+ level = 2;
+ XmlSchemaSequence sequence = XmlSchemaSequence.Read(reader,h);
+ if(sequence != null)
+ choice.items.Add(sequence);
+ continue;
+ }
+ if(reader.LocalName == "any")
+ {
+ level = 2;
+ XmlSchemaAny any = XmlSchemaAny.Read(reader,h);
+ if(any != null)
+ choice.items.Add(any);
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return choice;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
new file mode 100755
index 00000000000..57f73fc72b8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
@@ -0,0 +1,130 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaCollection.
+ /// </summary>
+ public sealed class XmlSchemaCollection : ICollection, IEnumerable
+ {
+ //private fields
+ private Hashtable htable;
+ private Hashtable uriTable;
+ private XmlNameTable ntable;
+
+ public XmlSchemaCollection()
+ : this (new NameTable ())
+ {
+ }
+
+ public XmlSchemaCollection(XmlNameTable nametable)
+ {
+ htable = new Hashtable();
+ uriTable = new Hashtable ();
+ ntable = nametable;
+ }
+
+ //properties
+ public int Count
+ {
+ get
+ {
+ return this.htable.Count;
+ }
+ }
+ public XmlNameTable NameTable
+ {
+ get
+ {
+ return this.ntable;
+ }
+ }
+ public XmlSchema this[ string ns ]
+ {
+ get
+ {
+ return (XmlSchema) this.htable[ns];
+ }
+ }
+
+ // Events
+ public event ValidationEventHandler ValidationEventHandler;
+
+ // Methods
+ [MonoTODO]
+ public XmlSchema Add(string ns, XmlReader reader)
+ {
+ if (reader == null)
+ throw new ArgumentNullException ("reader");
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlSchema Add(string ns, string uri)
+ {
+ if (uri == null || uri == String.Empty)
+ throw new ArgumentNullException ("uri");
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlSchema Add(XmlSchema schema)
+ {
+ if (schema == null)
+ throw new ArgumentNullException ("schema");
+
+ throw new NotImplementedException ();
+ }
+
+ public void Add(XmlSchemaCollection schema)
+ {
+ if (schema == null)
+ throw new ArgumentNullException ("schema");
+
+ foreach (XmlSchema s in schema)
+ Add (s);
+ }
+
+ public bool Contains(string ns)
+ {
+ return this.htable.Contains(ns);
+ }
+ public bool Contains(XmlSchema schema)
+ {
+ return this.htable.Contains(schema.TargetNamespace);
+ }
+ public void CopyTo(XmlSchema[] array, int index)
+ {
+
+ }
+ public XmlSchemaCollectionEnumerator GetEnumerator()
+ {
+ return new XmlSchemaCollectionEnumerator(this.htable);
+ }
+
+ //assembly Methods
+ [MonoTODO]
+ void ICollection.CopyTo(Array array, int index)
+ {
+ }
+ bool ICollection.IsSynchronized
+ {
+ get { return false; }
+ }
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.htable.GetEnumerator();
+ }
+ Object ICollection.SyncRoot
+ {
+ get { return this; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs
new file mode 100755
index 00000000000..3130c3094ac
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs
@@ -0,0 +1,47 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaCollectionEnumerator.
+ /// </summary>
+ public sealed class XmlSchemaCollectionEnumerator : IEnumerator
+ {
+ private IDictionaryEnumerator xenum;
+ internal XmlSchemaCollectionEnumerator(Hashtable htable)
+ {
+ this.xenum = htable.GetEnumerator();
+ }
+ // Properties
+ public XmlSchema Current
+ {
+ get
+ {
+ return (XmlSchema) xenum.Current;
+ }
+ }
+ // Methods
+ public bool MoveNext()
+ {
+ return xenum.MoveNext();
+ }
+
+ //Explicit Interface implementation
+ bool IEnumerator.MoveNext()
+ {
+ return xenum.MoveNext();
+ }
+ void IEnumerator.Reset()
+ {
+ xenum.Reset();
+ }
+ object IEnumerator.Current
+ {
+ get{return (XmlSchema) xenum.Current;}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
new file mode 100755
index 00000000000..45b07b3b1f0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
@@ -0,0 +1,162 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexContent.
+ /// </summary>
+ public class XmlSchemaComplexContent : XmlSchemaContentModel
+ {
+ private XmlSchemaContent content;
+ private bool isMixed;
+ private static string xmlname = "complexContent";
+
+ public XmlSchemaComplexContent()
+ {}
+
+ [System.Xml.Serialization.XmlAttribute("mixed")]
+ public bool IsMixed
+ {
+ get{ return isMixed; }
+ set{ isMixed = value; }
+ }
+
+ [XmlElement("restriction",typeof(XmlSchemaComplexContentRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("extension",typeof(XmlSchemaComplexContentExtension),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaContent Content
+ {
+ get{ return content; }
+ set{ content = value; }
+ }
+
+ /// <remarks>
+ /// 1. Content must be present
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(Content == null)
+ {
+ error(h, "Content must be present in a complexContent");
+ }
+ else
+ {
+ if(Content is XmlSchemaComplexContentRestriction)
+ {
+ XmlSchemaComplexContentRestriction xscr = (XmlSchemaComplexContentRestriction) Content;
+ errorCount += xscr.Compile(h,info);
+ }
+ else if(Content is XmlSchemaComplexContentExtension)
+ {
+ XmlSchemaComplexContentExtension xsce = (XmlSchemaComplexContentExtension) Content;
+ errorCount += xsce.Compile(h,info);
+ }
+ else
+ error(h,"complexContent can't have any value other than restriction or extention");
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<complexContent
+ // id = ID
+ // mixed = boolean
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (restriction | extension))
+ //</complexContent>
+ internal static XmlSchemaComplexContent Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaComplexContent complex = new XmlSchemaComplexContent();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexContent.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ complex.LineNumber = reader.LineNumber;
+ complex.LinePosition = reader.LinePosition;
+ complex.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ complex.Id = reader.Value;
+ }
+ else if(reader.Name == "mixed")
+ {
+ Exception innerex;
+ complex.isMixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h,reader.Value + " is an invalid value for mixed",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for complexContent",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,complex);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return complex;
+ //Content: (annotation?, (restriction | extension))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaComplexContent.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ complex.Annotation = annotation;
+ continue;
+ }
+ if(level <=2)
+ {
+ if(reader.LocalName == "restriction")
+ {
+ level = 3;
+ XmlSchemaComplexContentRestriction restriction = XmlSchemaComplexContentRestriction.Read(reader,h);
+ if(restriction != null)
+ complex.content = restriction;
+ continue;
+ }
+ if(reader.LocalName == "extension")
+ {
+ level = 3;
+ XmlSchemaComplexContentExtension extension = XmlSchemaComplexContentExtension.Read(reader,h);
+ if(extension != null)
+ complex.content = extension;
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return complex;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
new file mode 100755
index 00000000000..4deced9326a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
@@ -0,0 +1,254 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexContentExtension.
+ /// </summary>
+ public class XmlSchemaComplexContentExtension : XmlSchemaContent
+ {
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaParticle particle;
+ private static string xmlname = "extension";
+
+ public XmlSchemaComplexContentExtension()
+ {
+ attributes = new XmlSchemaObjectCollection();
+ baseTypeName = XmlQualifiedName.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaParticle Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value;}
+ }
+
+ /// <remarks>
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(BaseTypeName == null || BaseTypeName.IsEmpty)
+ {
+ error(h, "base must be present and a QName");
+ }
+ else if(!XmlSchemaUtil.CheckQName(BaseTypeName))
+ error(h,"BaseTypeName is not a valid XmlQualifiedName");
+
+ if(this.AnyAttribute != null)
+ {
+ errorCount += AnyAttribute.Compile(h,info);
+ }
+
+ foreach(XmlSchemaObject obj in Attributes)
+ {
+ if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ errorCount += attr.Compile(h,info);
+ }
+ else if(obj is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;
+ errorCount += atgrp.Compile(h,info);
+ }
+ else
+ error(h,obj.GetType() +" is not valid in this place::ComplexConetnetExtension");
+ }
+
+ if(Particle != null)
+ {
+ if(Particle is XmlSchemaGroupRef)
+ {
+ errorCount += ((XmlSchemaGroupRef)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaAll)
+ {
+ errorCount += ((XmlSchemaAll)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaChoice)
+ {
+ errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaSequence)
+ {
+ errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);
+ }
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<extension
+ // base = QName
+ // id = ID
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
+ //</extension>
+ internal static XmlSchemaComplexContentExtension Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexContentExtension.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ extension.LineNumber = reader.LineNumber;
+ extension.LinePosition = reader.LinePosition;
+ extension.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "base")
+ {
+ Exception innerex;
+ extension.baseTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for base attribute",innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ extension.Id = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for extension",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,extension);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return extension;
+ //Content: 1. annotation?,
+ // (2.(group | all | choice | sequence)?, (3.(attribute | attributeGroup)*, 4.anyAttribute?)))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaComplexContentExtension.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ extension.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "group")
+ {
+ level = 3;
+ XmlSchemaGroupRef group = XmlSchemaGroupRef.Read(reader,h);
+ if(group != null)
+ extension.particle = group;
+ continue;
+ }
+ if(reader.LocalName == "all")
+ {
+ level = 3;
+ XmlSchemaAll all = XmlSchemaAll.Read(reader,h);
+ if(all != null)
+ extension.particle = all;
+ continue;
+ }
+ if(reader.LocalName == "choice")
+ {
+ level = 3;
+ XmlSchemaChoice choice = XmlSchemaChoice.Read(reader,h);
+ if(choice != null)
+ extension.particle = choice;
+ continue;
+ }
+ if(reader.LocalName == "sequence")
+ {
+ level = 3;
+ XmlSchemaSequence sequence = XmlSchemaSequence.Read(reader,h);
+ if(sequence != null)
+ extension.particle = sequence;
+ continue;
+ }
+ }
+ if(level <= 3)
+ {
+ if(reader.LocalName == "attribute")
+ {
+ level = 3;
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ extension.Attributes.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ level = 3;
+ XmlSchemaAttributeGroupRef attr = XmlSchemaAttributeGroupRef.Read(reader,h);
+ if(attr != null)
+ extension.attributes.Add(attr);
+ continue;
+ }
+ }
+ if(level <= 4 && reader.LocalName == "anyAttribute")
+ {
+ level = 5;
+ XmlSchemaAnyAttribute anyattr = XmlSchemaAnyAttribute.Read(reader,h);
+ if(anyattr != null)
+ extension.AnyAttribute = anyattr;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return extension;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
new file mode 100755
index 00000000000..e744a3a47c0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
@@ -0,0 +1,256 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexContentRestriction.
+ /// </summary>
+ public class XmlSchemaComplexContentRestriction : XmlSchemaContent
+ {
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaParticle particle;
+ private static string xmlname = "restriction";
+
+ public XmlSchemaComplexContentRestriction()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ attributes = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaParticle Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value; }
+ }
+
+ /// <remarks>
+ /// 1. base must be present
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(BaseTypeName == null || BaseTypeName.IsEmpty)
+ {
+ error(h, "base must be present and a QName");
+ }
+ else if(!XmlSchemaUtil.CheckQName(BaseTypeName))
+ error(h,"BaseTypeName is not a valid XmlQualifiedName");
+
+ if(this.AnyAttribute != null)
+ {
+ errorCount += AnyAttribute.Compile(h,info);
+ }
+
+ foreach(XmlSchemaObject obj in Attributes)
+ {
+ if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ errorCount += attr.Compile(h,info);
+ }
+ else if(obj is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;
+ errorCount += atgrp.Compile(h,info);
+ }
+ else
+ error(h,obj.GetType() +" is not valid in this place::ComplexContentRestriction");
+ }
+
+ if(Particle != null)
+ {
+ if(Particle is XmlSchemaGroupRef)
+ {
+ errorCount += ((XmlSchemaGroupRef)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaAll)
+ {
+ errorCount += ((XmlSchemaAll)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaChoice)
+ {
+ errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaSequence)
+ {
+ errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);
+ }
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<restriction
+ // base = QName
+ // id = ID
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
+ //</restriction>
+ internal static XmlSchemaComplexContentRestriction Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexContentRestriction.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ restriction.LineNumber = reader.LineNumber;
+ restriction.LinePosition = reader.LinePosition;
+ restriction.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "base")
+ {
+ Exception innerex;
+ restriction.baseTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for base attribute",innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ restriction.Id = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for restriction",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,restriction);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return restriction;
+ //Content: 1. annotation?,
+ // (2.(group | all | choice | sequence)?, (3.(attribute | attributeGroup)*, 4.anyAttribute?)))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaComplexContentRestriction.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ restriction.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "group")
+ {
+ level = 3;
+ XmlSchemaGroupRef group = XmlSchemaGroupRef.Read(reader,h);
+ if(group != null)
+ restriction.particle = group;
+ continue;
+ }
+ if(reader.LocalName == "all")
+ {
+ level = 3;
+ XmlSchemaAll all = XmlSchemaAll.Read(reader,h);
+ if(all != null)
+ restriction.particle = all;
+ continue;
+ }
+ if(reader.LocalName == "choice")
+ {
+ level = 3;
+ XmlSchemaChoice choice = XmlSchemaChoice.Read(reader,h);
+ if(choice != null)
+ restriction.particle = choice;
+ continue;
+ }
+ if(reader.LocalName == "sequence")
+ {
+ level = 3;
+ XmlSchemaSequence sequence = XmlSchemaSequence.Read(reader,h);
+ if(sequence != null)
+ restriction.particle = sequence;
+ continue;
+ }
+ }
+ if(level <= 3)
+ {
+ if(reader.LocalName == "attribute")
+ {
+ level = 3;
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ restriction.Attributes.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ level = 3;
+ XmlSchemaAttributeGroupRef attr = XmlSchemaAttributeGroupRef.Read(reader,h);
+ if(attr != null)
+ restriction.attributes.Add(attr);
+ continue;
+ }
+ }
+ if(level <= 4 && reader.LocalName == "anyAttribute")
+ {
+ level = 5;
+ XmlSchemaAnyAttribute anyattr = XmlSchemaAnyAttribute.Read(reader,h);
+ if(anyattr != null)
+ restriction.AnyAttribute = anyattr;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return restriction;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
new file mode 100755
index 00000000000..113aff9f415
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
@@ -0,0 +1,463 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexType.
+ /// </summary>
+ public class XmlSchemaComplexType : XmlSchemaType
+ {
+ private XmlSchemaAnyAttribute anyAttribute;
+ private XmlSchemaObjectCollection attributes;
+ private XmlSchemaObjectTable attributeUses;
+ private XmlSchemaAnyAttribute attributeWildcard;
+ private XmlSchemaDerivationMethod block;
+ private XmlSchemaDerivationMethod blockResolved;
+ private XmlSchemaContentModel contentModel;
+ private XmlSchemaContentType contentType;
+ private XmlSchemaParticle contentTypeParticle;
+ private bool isAbstract;
+ private bool isMixed;
+ private XmlSchemaParticle particle;
+
+ internal bool istoplevel = false;
+ private static string xmlname = "complexType";
+
+ public XmlSchemaComplexType()
+ {
+ attributes = new XmlSchemaObjectCollection();
+ block = XmlSchemaDerivationMethod.None;
+ attributeUses = new XmlSchemaObjectTable();
+ }
+
+ #region Attributes
+
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("abstract")]
+ public bool IsAbstract
+ {
+ get{ return isAbstract; }
+ set{ isAbstract = value; }
+ }
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("block")]
+ public XmlSchemaDerivationMethod Block
+ {
+ get{ return block; }
+ set{ block = value; }
+ }
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("mixed")]
+ public override bool IsMixed
+ {
+ get{ return isMixed; }
+ set{ isMixed = value; }
+ }
+
+ #endregion
+
+ #region Elements
+
+ [XmlElement("simpleContent",typeof(XmlSchemaSimpleContent),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexContent",typeof(XmlSchemaComplexContent),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaContentModel ContentModel
+ {
+ get{ return contentModel; }
+ set{ contentModel = value; }
+ }
+
+ //LAMESPEC: The default value for particle in Schema is of Type EmptyParticle (internal?)
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaParticle Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return anyAttribute; }
+ set{ anyAttribute = value; }
+ }
+
+ #endregion
+
+ #region XmlIgnore
+ [XmlIgnore]
+ public XmlSchemaContentType ContentType
+ {
+ get{ return contentType; }
+ }
+ [XmlIgnore]
+ public XmlSchemaParticle ContentTypeParticle
+ {
+ get{ return contentTypeParticle; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod BlockResolved
+ {
+ get{ return blockResolved; }
+ }
+ [XmlIgnore]
+ public XmlSchemaObjectTable AttributeUses
+ {
+ get{ return attributeUses; }
+ }
+ [XmlIgnore]
+ public XmlSchemaAnyAttribute AttributeWildcard
+ {
+ get{ return attributeWildcard; }
+ }
+ #endregion
+
+ /// <remarks>
+ /// 1. If ContentModel is present, neither particle nor Attributes nor AnyAttribute can be present.
+ /// 2. If particle is present,
+ /// a. For a topLevelComplexType
+ /// 1. name must be present and type NCName
+ /// 2. if block is #all, blockdefault is #all, else List of (extension | restriction)
+ /// 3. if final is #all, finaldefault is #all, else List of (extension | restriction)
+ /// b. For a local Complex type
+ /// 1. abstract must be false
+ /// 2. Name must be absent
+ /// 3. final must be absent
+ /// 4. block must be absent
+ ///
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(istoplevel)
+ {
+ if(this.Name == null || this.Name == string.Empty)
+ error(h,"name must be present in a top level complex type");
+ else if(!XmlSchemaUtil.CheckNCName(Name))
+ error(h,"name must be a NCName");
+ else
+ this.qName = new XmlQualifiedName(Name,info.TargetNamespace);
+
+ if(Block != XmlSchemaDerivationMethod.None)
+ {
+ if(Block == XmlSchemaDerivationMethod.All)
+ {
+ blockResolved = XmlSchemaDerivationMethod.All;
+ }
+ else
+ {
+ //TODO: Check what all is not allowed
+ blockResolved = Block & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);
+ }
+ }
+ else
+ {
+ if(info.BlockDefault == XmlSchemaDerivationMethod.All)
+ {
+ blockResolved = XmlSchemaDerivationMethod.All;
+ }
+ else
+ blockResolved = info.BlockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);
+ }
+ if(Final != XmlSchemaDerivationMethod.None)
+ {
+ if(Final == XmlSchemaDerivationMethod.All)
+ {
+ finalResolved = XmlSchemaDerivationMethod.All;
+ }
+ else
+ {
+ //TODO: Check what all is not allowed
+ finalResolved = Final & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);
+ }
+ }
+ else
+ {
+ if(info.FinalDefault == XmlSchemaDerivationMethod.All)
+ {
+ finalResolved = XmlSchemaDerivationMethod.All;
+ }
+ else
+ {
+ finalResolved = info.BlockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);
+ }
+ }
+ }
+ else // Not Top Level
+ {
+ if(isAbstract)
+ error(h,"abstract must be false in a local complex type");
+ if(Name != null)
+ error(h,"name must be absent in a local complex type");
+ if(Final != XmlSchemaDerivationMethod.None)
+ error(h,"final must be absent in a local complex type");
+ if(block != XmlSchemaDerivationMethod.None)
+ error(h,"block must be absent in a local complex type");
+ }
+
+ if(ContentModel != null)
+ {
+ if(anyAttribute != null || Attributes.Count != 0 || Particle != null)
+ error(h,"attributes, particles or anyattribute is not allowed if ContentModel is present");
+
+ if(ContentModel is XmlSchemaSimpleContent)
+ {
+ XmlSchemaSimpleContent smodel = (XmlSchemaSimpleContent)ContentModel;
+ errorCount += smodel.Compile(h,info);
+ }
+ else if(ContentModel is XmlSchemaComplexContent)
+ {
+ XmlSchemaComplexContent cmodel = (XmlSchemaComplexContent)ContentModel;
+ errorCount += cmodel.Compile(h,info);
+ }
+ }
+ else
+ {
+ if(Particle is XmlSchemaGroupRef)
+ {
+ XmlSchemaGroupRef xsgr = (XmlSchemaGroupRef)Particle;
+ errorCount += xsgr.Compile(h,info);
+ }
+ else if(Particle is XmlSchemaAll)
+ {
+ XmlSchemaAll xsa = (XmlSchemaAll)Particle;
+ errorCount += xsa.Compile(h,info);
+ }
+ else if(Particle is XmlSchemaChoice)
+ {
+ XmlSchemaChoice xsc = (XmlSchemaChoice)Particle;
+ errorCount += xsc.Compile(h,info);
+ }
+ else if(Particle is XmlSchemaSequence)
+ {
+ XmlSchemaSequence xss = (XmlSchemaSequence)Particle;
+ errorCount += xss.Compile(h,info);
+ }
+
+ if(this.anyAttribute != null)
+ {
+ AnyAttribute.Compile(h,info);
+ }
+ foreach(XmlSchemaObject obj in Attributes)
+ {
+ if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ errorCount += attr.Compile(h,info);
+ }
+ else if(obj is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;
+ errorCount += atgrp.Compile(h,info);
+ }
+ else
+ error(h,obj.GetType() +" is not valid in this place::ComplexType");
+ }
+ }
+
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<complexType
+ // abstract = boolean : false
+ // block = (#all | List of (extension | restriction))
+ // final = (#all | List of (extension | restriction))
+ // id = ID
+ // mixed = boolean : false
+ // name = NCName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
+ //</complexType>
+ internal static XmlSchemaComplexType Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaComplexType ctype = new XmlSchemaComplexType();
+ reader.MoveToElement();
+ Exception innerex;
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexType.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ ctype.LineNumber = reader.LineNumber;
+ ctype.LinePosition = reader.LinePosition;
+ ctype.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "abstract")
+ {
+ ctype.IsAbstract = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h,reader.Value + " is invalid value for abstract",innerex);
+ }
+ else if(reader.Name == "block")
+ {
+ ctype.block = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "block");
+ if(innerex != null)
+ warn(h,"some invalid values for block attribute were found",innerex);
+ }
+ else if(reader.Name == "final")
+ {
+ ctype.Final = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "block");
+ if(innerex != null)
+ warn(h,"some invalid values for final attribute were found",innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ ctype.Id = reader.Value;
+ }
+ else if(reader.Name == "mixed")
+ {
+ ctype.isMixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h,reader.Value + " is invalid value for mixed",innerex);
+ }
+ else if(reader.Name == "name")
+ {
+ ctype.Name = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for complexType",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,ctype);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return ctype;
+
+ //Content: 1. annotation?,
+ // 2. simpleContent | 2. complexContent |
+ // (3.(group | all | choice | sequence)?, (4.(attribute | attributeGroup)*, 5.anyAttribute?)))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaComplexType.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ ctype.Annotation = annotation;
+ continue;
+ }
+ if(level <=2)
+ {
+ if(reader.LocalName == "simpleContent")
+ {
+ level = 6;
+ XmlSchemaSimpleContent simple = XmlSchemaSimpleContent.Read(reader,h);
+ if(simple != null)
+ ctype.ContentModel = simple;
+ continue;
+ }
+ if(reader.LocalName == "complexContent")
+ {
+ level = 6;
+ XmlSchemaComplexContent complex = XmlSchemaComplexContent.Read(reader,h);
+ if(complex != null)
+ ctype.contentModel = complex;
+ continue;
+ }
+ }
+ if(level <= 3)
+ {
+ if(reader.LocalName == "group")
+ {
+ level = 4;
+ XmlSchemaGroupRef group = XmlSchemaGroupRef.Read(reader,h);
+ if(group != null)
+ ctype.particle = group;
+ continue;
+ }
+ if(reader.LocalName == "all")
+ {
+ level = 4;
+ XmlSchemaAll all = XmlSchemaAll.Read(reader,h);
+ if(all != null)
+ ctype.particle = all;
+ continue;
+ }
+ if(reader.LocalName == "choice")
+ {
+ level = 4;
+ XmlSchemaChoice choice = XmlSchemaChoice.Read(reader,h);
+ if(choice != null)
+ ctype.particle = choice;
+ continue;
+ }
+ if(reader.LocalName == "sequence")
+ {
+ level = 4;
+ XmlSchemaSequence sequence = XmlSchemaSequence.Read(reader,h);
+ if(sequence != null)
+ ctype.particle = sequence;
+ continue;
+ }
+ }
+ if(level <= 4)
+ {
+ if(reader.LocalName == "attribute")
+ {
+ level = 4;
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ ctype.Attributes.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ level = 4;
+ XmlSchemaAttributeGroupRef attr = XmlSchemaAttributeGroupRef.Read(reader,h);
+ if(attr != null)
+ ctype.attributes.Add(attr);
+ continue;
+ }
+ }
+ if(level <= 5 && reader.LocalName == "anyAttribute")
+ {
+ level = 6;
+ XmlSchemaAnyAttribute anyattr = XmlSchemaAnyAttribute.Read(reader,h);
+ if(anyattr != null)
+ ctype.AnyAttribute = anyattr;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return ctype;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
new file mode 100755
index 00000000000..ac32916437a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
@@ -0,0 +1,15 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContent.
+ /// </summary>
+ public abstract class XmlSchemaContent : XmlSchemaAnnotated
+ {
+ protected XmlSchemaContent()
+ {}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs
new file mode 100755
index 00000000000..994dd211de5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs
@@ -0,0 +1,19 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContentModel.
+ /// </summary>
+ public abstract class XmlSchemaContentModel : XmlSchemaAnnotated
+ {
+ protected XmlSchemaContentModel()
+ {
+ }
+ [XmlIgnore]
+ public abstract XmlSchemaContent Content {get; set;}
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs
new file mode 100755
index 00000000000..2cd60231a03
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs
@@ -0,0 +1,22 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContentProcessing.
+ /// </summary>
+ public enum XmlSchemaContentProcessing
+ {
+ [XmlIgnore]
+ None = 0,
+ [XmlEnum("skip")]
+ Skip = 1,
+ [XmlEnum("lax")]
+ Lax = 2,
+ [XmlEnum("strict")]
+ Strict = 3,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs
new file mode 100755
index 00000000000..dc7bda2433e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs
@@ -0,0 +1,17 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContentType.
+ /// </summary>
+ public enum XmlSchemaContentType
+ {
+ TextOnly = 0,
+ Empty = 1,
+ ElementOnly = 2,
+ Mixed = 3,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
new file mode 100755
index 00000000000..778a9ef39ec
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
@@ -0,0 +1,30 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaDatatype.
+ /// </summary>
+ public abstract class XmlSchemaDatatype
+ {
+ protected XmlSchemaDatatype()
+ {
+ }
+
+ public abstract XmlTokenizedType TokenizedType { get; }
+ public abstract Type ValueType { get; }
+
+ // Methods
+ public abstract object ParseValue(string s,
+ XmlNameTable nameTable, XmlNamespaceManager nsmgr);
+
+ //TODO: This should return appropriate inbuilt type
+ internal static XmlSchemaDatatype GetType(XmlQualifiedName qname)
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs
new file mode 100755
index 00000000000..fcd63c899fe
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs
@@ -0,0 +1,31 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaDerivationMethod.
+ /// </summary>
+ [Flags]
+ public enum XmlSchemaDerivationMethod
+ {
+ [XmlEnum("")]
+ Empty = 0x00000000,
+ [XmlEnum("substitution")]
+ Substitution= 0x00000001,
+ [XmlEnum("extension")]
+ Extension = 0x00000002,
+ [XmlEnum("restriction")]
+ Restriction = 0x00000004,
+ [XmlEnum("list")]
+ List = 0x00000008,
+ [XmlEnum("union")]
+ Union = 0x00000010,
+ [XmlEnum("#all")]
+ All = 0x000000FF,
+ [XmlIgnore]
+ None = 0x00000100,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs
new file mode 100755
index 00000000000..7788d6d685b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs
@@ -0,0 +1,104 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaDocumentation.
+ /// </summary>
+ public class XmlSchemaDocumentation : XmlSchemaObject
+ {
+ private string language;
+ private XmlNode[] markup;
+ private string source;
+
+ public XmlSchemaDocumentation()
+ {
+ }
+
+ [XmlAnyElement]
+ [XmlText]
+ public XmlNode[] Markup
+ {
+ get{ return markup; }
+ set{ markup = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("source")]
+ public string Source
+ {
+ get{ return source; }
+ set{ source = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("xml:lang")]
+ public string Language
+ {
+ get{ return language; }
+ set{ language = value; }
+ }
+
+ //<documentation
+ // source = anyURI
+ // xml:lang = language>
+ // Content: ({any})*
+ //</documentation>
+ internal static XmlSchemaDocumentation Read(XmlSchemaReader reader, ValidationEventHandler h, out bool skip)
+ {
+ skip = false;
+ XmlSchemaDocumentation doc = new XmlSchemaDocumentation();
+
+ reader.MoveToElement();
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != "documentation")
+ {
+ error(h,"Should not happen :1: XmlSchemaDocumentation.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ doc.LineNumber = reader.LineNumber;
+ doc.LinePosition = reader.LinePosition;
+ doc.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "source")
+ {
+ doc.source = reader.Value;
+ }
+ else if(reader.Name == "xml:lang")
+ {
+ doc.language = reader.Value;
+ }
+ else
+ {
+ error(h,reader.Name + " is not a valid attribute for documentation",null);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return doc;
+
+ //Content {any}*
+ XmlDocument xmldoc = new XmlDocument();
+ xmldoc.AppendChild(xmldoc.ReadNode(reader));
+ XmlNode root = xmldoc.FirstChild;
+ if(root != null && root.ChildNodes != null)
+ {
+ doc.Markup = new XmlNode[root.ChildNodes.Count];
+ for(int i=0;i<root.ChildNodes.Count;i++)
+ {
+ doc.Markup[i] = root.ChildNodes[i];
+ }
+ }
+ if(reader.NodeType == XmlNodeType.Element || reader.NodeType == XmlNodeType.EndElement)
+ skip = true;
+
+ return doc;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
new file mode 100755
index 00000000000..5f95fd66ef2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
@@ -0,0 +1,625 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaElement.
+ /// </summary>
+ public class XmlSchemaElement : XmlSchemaParticle
+ {
+ private XmlSchemaDerivationMethod block;
+ private XmlSchemaDerivationMethod blockResolved;
+ private XmlSchemaObjectCollection constraints;
+ private string defaultValue;
+ private object elementType;
+ private XmlSchemaDerivationMethod final;
+ private XmlSchemaDerivationMethod finalResolved;
+ private string fixedValue;
+ private XmlSchemaForm form;
+ private bool isAbstract;
+ private bool isNillable;
+ private string name;
+ private XmlQualifiedName qName;
+ private XmlQualifiedName refName;
+ private XmlSchemaType schemaType;
+ private XmlQualifiedName schemaTypeName;
+ private XmlQualifiedName substitutionGroup;
+ internal bool parentIsSchema = false;
+ private string targetNamespace;
+ private string hash;
+
+ private static string xmlname = "element";
+
+ public XmlSchemaElement()
+ {
+ block = XmlSchemaDerivationMethod.None;
+ final = XmlSchemaDerivationMethod.None;
+ constraints = new XmlSchemaObjectCollection();
+ qName = XmlQualifiedName.Empty;
+ refName = XmlQualifiedName.Empty;
+ schemaTypeName = XmlQualifiedName.Empty;
+ substitutionGroup = XmlQualifiedName.Empty;
+ substitutionGroup = XmlQualifiedName.Empty;
+ }
+
+ #region Attributes
+
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("abstract")]
+ public bool IsAbstract
+ {
+ get{ return isAbstract; }
+ set{ isAbstract = value; }
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("block")]
+ public XmlSchemaDerivationMethod Block
+ {
+ get{ return block; }
+ set{ block = value; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("default")]
+ public string DefaultValue
+ {
+ get{ return defaultValue; }
+ set{ defaultValue = value; }
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("final")]
+ public XmlSchemaDerivationMethod Final
+ {
+ get{ return final; }
+ set{ final = value; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("fixed")]
+ public string FixedValue
+ {
+ get{ return fixedValue; }
+ set{ fixedValue = value; }
+ }
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("form")]
+ public XmlSchemaForm Form
+ {
+ get{ return form; }
+ set{ form = value; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("nillable")]
+ public bool IsNillable
+ {
+ get{ return isNillable; }
+ set{ isNillable = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName; }
+ set{ refName = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("substitutionGroup")]
+ public XmlQualifiedName SubstitutionGroup
+ {
+ get{ return substitutionGroup; }
+ set{ substitutionGroup = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("type")]
+ public XmlQualifiedName SchemaTypeName
+ {
+ get{ return schemaTypeName; }
+ set{ schemaTypeName = value; }
+ }
+
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaType SchemaType
+ {
+ get{ return schemaType; }
+ set{ schemaType = value; }
+ }
+
+ [XmlElement("unique",typeof(XmlSchemaUnique),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("key",typeof(XmlSchemaKey),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("keyref",typeof(XmlSchemaKeyref),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Constraints
+ {
+ get{ return constraints; }
+ }
+
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qName; }
+ }
+
+ [XmlIgnore]
+ public object ElementType
+ {
+ get{ return elementType; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod BlockResolved
+ {
+ get{ return blockResolved; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod FinalResolved
+ {
+ get{ return finalResolved; }
+ }
+
+ #endregion
+
+ /// <remarks>
+ /// a) If Element has parent as schema:
+ /// 1. name must be present and of type NCName.
+ /// 2. ref must be absent
+ /// 3. form must be absent
+ /// 4. minOccurs must be absent
+ /// 5. maxOccurs must be absent
+ /// b) If Element has parent is not schema and ref is absent
+ /// 1. name must be present and of type NCName.
+ /// 2. if form equals qualified or form is absent and schema's formdefault is qualifed,
+ /// targetNamespace is schema's targetnamespace else empty.
+ /// 3. type and either <simpleType> or <complexType> are mutually exclusive
+ /// 4. default and fixed must not both be present.
+ /// 5. substitutiongroup must be absent
+ /// 6. final must be absent
+ /// 7. abstract must be absent
+ /// c) if the parent is not schema and ref is set
+ /// 1. name must not be present
+ /// 2. all of <simpleType>,<complexType>, <key>, <keyref>, <unique>, nillable,
+ /// default, fixed, form, block and type, must be absent.
+ /// 3. substitutiongroup is prohibited
+ /// 4. final is prohibited
+ /// 5. abstract is prohibited
+ /// 6. default and fixed must not both be present.(Actually both are absent)
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(this.defaultValue != null && this.fixedValue != null)
+ error(h,"both default and fixed can't be present");
+
+ if(parentIsSchema)
+ {
+ if(this.refName != null && !RefName.IsEmpty)
+ error(h,"ref must be absent");
+
+ if(this.name == null) //b1
+ error(h,"Required attribute name must be present");
+ else if(!XmlSchemaUtil.CheckNCName(this.name)) // b1.2
+ error(h,"attribute name must be NCName");
+ else
+ this.qName = new XmlQualifiedName(this.name, info.TargetNamespace);
+
+ if(form != XmlSchemaForm.None)
+ error(h,"form must be absent");
+ if(MinOccursString != null)
+ error(h,"minOccurs must be absent");
+ if(MaxOccursString != null)
+ error(h,"maxOccurs must be absent");
+
+ XmlSchemaDerivationMethod allfinal = (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);
+ if(final == XmlSchemaDerivationMethod.All)
+ finalResolved = allfinal;
+ else if(final == XmlSchemaDerivationMethod.None)
+ finalResolved = info.BlockDefault & allfinal;
+ else
+ {
+ if((final & ~allfinal) != 0)
+ warn(h,"some values for final are invalid in this context");
+ finalResolved = final & allfinal;
+ }
+
+ XmlSchemaDerivationMethod allblock = XmlSchemaDerivationMethod.Extension |
+ XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution;
+
+ if(block == XmlSchemaDerivationMethod.All)
+ blockResolved = allblock;
+ else if(block == XmlSchemaDerivationMethod.None)
+ blockResolved = info.BlockDefault & allblock;
+ else
+ {
+ if((block & ~allblock) != 0)
+ warn(h,"Some of the values for block are invalid in this context");
+ blockResolved = block & allblock;
+ }
+
+ if(schemaType != null && schemaTypeName != null && !schemaTypeName.IsEmpty)
+ {
+ error(h,"both schemaType and content can't be present");
+ }
+
+ //Even if both are present, read both of them.
+ if(schemaType != null)
+ {
+ if(schemaType is XmlSchemaSimpleType)
+ {
+ errorCount += ((XmlSchemaSimpleType)schemaType).Compile(h,info);
+ }
+ else if(schemaType is XmlSchemaComplexType)
+ {
+ errorCount += ((XmlSchemaComplexType)schemaType).Compile(h,info);
+ }
+ else
+ error(h,"only simpletype or complextype is allowed");
+ }
+ if(schemaTypeName != null && !schemaTypeName.IsEmpty)
+ {
+ if(!XmlSchemaUtil.CheckQName(SchemaTypeName))
+ error(h,"SchemaTypeName must be an XmlQualifiedName");
+ }
+ if(SubstitutionGroup != null && !SubstitutionGroup.IsEmpty)
+ {
+ if(!XmlSchemaUtil.CheckQName(SubstitutionGroup))
+ error(h,"SubstitutionGroup must be a valid XmlQualifiedName");
+ }
+
+ foreach(XmlSchemaObject obj in constraints)
+ {
+ if(obj is XmlSchemaUnique)
+ errorCount += ((XmlSchemaUnique)obj).Compile(h,info);
+ else if(obj is XmlSchemaKey)
+ errorCount += ((XmlSchemaKey)obj).Compile(h,info);
+ else if(obj is XmlSchemaKeyref)
+ errorCount += ((XmlSchemaKeyref)obj).Compile(h,info);
+ }
+
+
+ }
+ else
+ {
+ if(substitutionGroup != null && !substitutionGroup.IsEmpty)
+ error(h,"substitutionGroup must be absent");
+ if(final != XmlSchemaDerivationMethod.None)
+ error(h,"final must be absent");
+ if(isAbstract)
+ error(h,"abstract must be absent");
+
+ //FIXME: Should we reset the values
+ if(MinOccurs > MaxOccurs)
+ error(h,"minOccurs must be less than or equal to maxOccurs");
+
+ if(refName == null || RefName.IsEmpty)
+ {
+ if(form == XmlSchemaForm.Qualified || (form == XmlSchemaForm.None && info.ElementFormDefault == XmlSchemaForm.Qualified))
+ this.targetNamespace = info.TargetNamespace;
+ else
+ this.targetNamespace = string.Empty;
+
+ if(this.name == null) //b1
+ error(h,"Required attribute name must be present");
+ else if(!XmlSchemaUtil.CheckNCName(this.name)) // b1.2
+ error(h,"attribute name must be NCName");
+ else
+ this.qName = new XmlQualifiedName(this.name, this.targetNamespace);
+
+ XmlSchemaDerivationMethod allblock = XmlSchemaDerivationMethod.Extension |
+ XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution;
+
+ if(block == XmlSchemaDerivationMethod.All)
+ blockResolved = allblock;
+ else if(block == XmlSchemaDerivationMethod.None)
+ blockResolved = info.BlockDefault & allblock;
+ else
+ {
+ if((block & ~allblock) != 0)
+ warn(h,"Some of the values for block are invalid in this context");
+ blockResolved = block & allblock;
+ }
+
+ if(schemaType != null && schemaTypeName != null && !schemaTypeName.IsEmpty)
+ {
+ error(h,"both schemaType and content can't be present");
+ }
+
+ //Even if both are present, read both of them.
+ if(schemaType != null)
+ {
+ if(schemaType is XmlSchemaSimpleType)
+ {
+ errorCount += ((XmlSchemaSimpleType)schemaType).Compile(h,info);
+ }
+ else if(schemaType is XmlSchemaComplexType)
+ {
+ errorCount += ((XmlSchemaComplexType)schemaType).Compile(h,info);
+ }
+ else
+ error(h,"only simpletype or complextype is allowed");
+ }
+ if(schemaTypeName != null && !schemaTypeName.IsEmpty)
+ {
+ if(!XmlSchemaUtil.CheckQName(SchemaTypeName))
+ error(h,"SchemaTypeName must be an XmlQualifiedName");
+ }
+ if(SubstitutionGroup != null && !SubstitutionGroup.IsEmpty)
+ {
+ if(!XmlSchemaUtil.CheckQName(SubstitutionGroup))
+ error(h,"SubstitutionGroup must be a valid XmlQualifiedName");
+ }
+
+ foreach(XmlSchemaObject obj in constraints)
+ {
+ if(obj is XmlSchemaUnique)
+ errorCount += ((XmlSchemaUnique)obj).Compile(h,info);
+ else if(obj is XmlSchemaKey)
+ errorCount += ((XmlSchemaKey)obj).Compile(h,info);
+ else if(obj is XmlSchemaKeyref)
+ errorCount += ((XmlSchemaKeyref)obj).Compile(h,info);
+ }
+ }
+ else
+ {
+ if(!XmlSchemaUtil.CheckQName(RefName))
+ error(h,"RefName must be a XmlQualifiedName");
+
+ if(name != null)
+ error(h,"name must not be present when ref is present");
+ if(Constraints.Count != 0)
+ error(h,"key, keyref and unique must be absent");
+ if(isNillable)
+ error(h,"nillable must be absent");
+ if(defaultValue != null)
+ error(h,"default must be absent");
+ if(fixedValue != null)
+ error(h,"fixed must be null");
+ if(form != XmlSchemaForm.None)
+ error(h,"form must be absent");
+ if(block != XmlSchemaDerivationMethod.None)
+ error(h,"block must be absent");
+ if(schemaTypeName != null && !schemaTypeName.IsEmpty)
+ error(h,"type must be absent");
+ if(SchemaType != null)
+ error(h,"simpleType or complexType must be absent");
+ }
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<element
+ // abstract = boolean : false
+ // block = (#all | List of (extension | restriction | substitution))
+ // default = string
+ // final = (#all | List of (extension | restriction))
+ // fixed = string
+ // form = (qualified | unqualified)
+ // id = ID
+ // maxOccurs = (nonNegativeInteger | unbounded) : 1
+ // minOccurs = nonNegativeInteger : 1
+ // name = NCName
+ // nillable = boolean : false
+ // ref = QName
+ // substitutionGroup = QName
+ // type = QName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
+ //</element>
+
+ internal static XmlSchemaElement Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaElement element = new XmlSchemaElement();
+ Exception innerex;
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaElement.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ element.LineNumber = reader.LineNumber;
+ element.LinePosition = reader.LinePosition;
+ element.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "abstract")
+ {
+ element.IsAbstract = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h,reader.Value + " is invalid value for abstract",innerex);
+ }
+ else if(reader.Name == "block")
+ {
+ element.block = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "block");
+ if(innerex != null)
+ warn(h,"some invalid values for block attribute were found",innerex);
+ }
+ else if(reader.Name == "default")
+ {
+ element.defaultValue = reader.Value;
+ }
+ else if(reader.Name == "final")
+ {
+ element.Final = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "block");
+ if(innerex != null)
+ warn(h,"some invalid values for final attribute were found",innerex);
+ }
+ else if(reader.Name == "fixed")
+ {
+ element.fixedValue = reader.Value;
+ }
+ else if(reader.Name == "form")
+ {
+ element.form = XmlSchemaUtil.ReadFormAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h,reader.Value + " is an invalid value for form attribute",innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ element.Id = reader.Value;
+ }
+ else if(reader.Name == "maxOccurs")
+ {
+ try
+ {
+ element.MaxOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for maxOccurs",e);
+ }
+ }
+ else if(reader.Name == "minOccurs")
+ {
+ try
+ {
+ element.MinOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for minOccurs",e);
+ }
+ }
+ else if(reader.Name == "name")
+ {
+ element.Name = reader.Value;
+ }
+ else if(reader.Name == "nillable")
+ {
+ element.IsNillable = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h,reader.Value + "is not a valid value for nillable",innerex);
+ }
+ else if(reader.Name == "ref")
+ {
+ element.refName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for ref attribute",innerex);
+ }
+ else if(reader.Name == "substitutionGroup")
+ {
+ element.substitutionGroup = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for substitutionGroup attribute",innerex);
+ }
+ else if(reader.Name == "type")
+ {
+ element.SchemaTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for type attribute",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for element",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,element);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return element;
+
+ // Content: annotation?,
+ // (simpleType | complexType)?,
+ // (unique | key | keyref)*
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaElement.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ element.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "simpleType")
+ {
+ level = 3;
+ XmlSchemaSimpleType simple = XmlSchemaSimpleType.Read(reader,h);
+ if(simple != null)
+ element.SchemaType = simple;
+ continue;
+ }
+ if(reader.LocalName == "complexType")
+ {
+ level = 3;
+ XmlSchemaComplexType complex = XmlSchemaComplexType.Read(reader,h);
+ if(complex != null)
+ {
+ element.SchemaType = complex;
+ }
+ continue;
+ }
+ }
+ if(level <= 3)
+ {
+ if(reader.LocalName == "unique")
+ {
+ level = 3;
+ XmlSchemaUnique unique = XmlSchemaUnique.Read(reader,h);
+ if(unique != null)
+ element.constraints.Add(unique);
+ continue;
+ }
+ else if(reader.LocalName == "key")
+ {
+ level = 3;
+ XmlSchemaKey key = XmlSchemaKey.Read(reader,h);
+ if(key != null)
+ element.constraints.Add(key);
+ continue;
+ }
+ else if(reader.LocalName == "keyref")
+ {
+ level = 3;
+ XmlSchemaKeyref keyref = XmlSchemaKeyref.Read(reader,h);
+ if(keyref != null)
+ element.constraints.Add(keyref);
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return element;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
new file mode 100755
index 00000000000..512b3c7d70a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
@@ -0,0 +1,87 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaEnumerationFacet.
+ /// </summary>
+ public class XmlSchemaEnumerationFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "enumeration";
+ public XmlSchemaEnumerationFacet()
+ {
+ }
+
+ //<enumeration
+ // id = ID
+ // value = anySimpleType
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</enumeration>
+ internal static XmlSchemaEnumerationFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaEnumerationFacet enumeration = new XmlSchemaEnumerationFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaEnumerationFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ enumeration.LineNumber = reader.LineNumber;
+ enumeration.LinePosition = reader.LinePosition;
+ enumeration.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ enumeration.Id = reader.Value;
+ }
+ else if(reader.Name == "value")
+ {
+ enumeration.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,enumeration);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return enumeration;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaEnumerationFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ enumeration.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return enumeration;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs
new file mode 100755
index 00000000000..01ea8721d3b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs
@@ -0,0 +1,94 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Runtime.Serialization;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaException.
+ /// </summary>
+ [Serializable]
+ public class XmlSchemaException : System.SystemException
+ {
+ //fields
+ private int lineNumber;
+ private int linePosition;
+ private XmlSchemaObject sourceObj;
+ private string sourceUri;
+
+ protected XmlSchemaException(SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ this.lineNumber = info.GetInt32 ("lineNumber");
+ this.linePosition = info.GetInt32 ("linePosition");
+ this.sourceUri = info.GetString ("sourceUri");
+ this.sourceObj = info.GetValue ("sourceObj", typeof (XmlSchemaObject)) as XmlSchemaObject;
+ }
+
+
+ internal XmlSchemaException(string message, int lineNumber, int linePosition,
+ XmlSchemaObject sourceObject, string sourceUri, Exception innerException)
+ : base(message, innerException)
+ {
+ this.lineNumber = lineNumber;
+ this.linePosition = linePosition;
+ this.sourceObj = sourceObject;
+ this.sourceUri = sourceUri;
+ }
+ internal XmlSchemaException(string message, XmlSchemaObject sourceObject,
+ Exception innerException)
+ : base(message, innerException)
+ {
+ this.lineNumber = sourceObject.LineNumber;
+ this.linePosition = sourceObject.LinePosition;
+ this.sourceObj = sourceObject;
+ this.sourceUri = sourceObject.SourceUri;
+ }
+
+ public XmlSchemaException(string message, Exception innerException)
+ : base(message,innerException){}
+
+ // Properties
+ public int LineNumber
+ {
+ get{ return this.lineNumber;}
+ }
+ public int LinePosition
+ {
+ get{ return this.linePosition;}
+ }
+ public XmlSchemaObject SourceSchemaObject
+ {
+ get{ return this.sourceObj; }
+ }
+ public string SourceUri
+ {
+ get{ return this.sourceUri; }
+ }
+
+ public override string Message
+ {
+ get {
+ string msg = base.Message;
+ if (sourceUri != null)
+ msg = String.Format ("XmlSchema error: {0}\n" +
+ "URI: {1}, line {2}, position {3}",
+ msg, sourceUri, lineNumber, linePosition);
+
+ return msg;
+ }
+ }
+
+ // Methods
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("lineNumber", lineNumber);
+ info.AddValue ("linePosition", linePosition);
+ info.AddValue ("sourceUri", sourceUri);
+ info.AddValue ("sourceObj", sourceObj);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs
new file mode 100755
index 00000000000..1f691587ea1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs
@@ -0,0 +1,62 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Collections;
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaExternal.
+ /// </summary>
+ public abstract class XmlSchemaExternal : XmlSchemaObject
+ {
+ private string id;
+ private XmlSchema schema;
+ private string location;
+ private XmlAttribute[] unhandledAttributes;
+
+ protected XmlSchemaExternal()
+ {}
+
+ [System.Xml.Serialization.XmlAttribute("schemaLocation")]
+ public string SchemaLocation
+ {
+ get{ return location; }
+ set{ location = value; }
+ }
+
+ [XmlIgnore]
+ public XmlSchema Schema
+ {
+ get{ return schema; }
+ set{ schema = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id; }
+ set{ id = value; }
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get
+ {
+ if(unhandledAttributeList != null)
+ {
+ unhandledAttributes = (XmlAttribute[]) unhandledAttributeList.ToArray(typeof(XmlAttribute));
+ unhandledAttributeList = null;
+ }
+ return unhandledAttributes;
+ }
+ set
+ {
+ unhandledAttributes = value;
+ unhandledAttributeList = null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
new file mode 100755
index 00000000000..076bc74486d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
@@ -0,0 +1,37 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaFacet.
+ /// </summary>
+ public abstract class XmlSchemaFacet : XmlSchemaAnnotated
+ {
+ private bool isFixed;
+ private string val;
+
+ protected XmlSchemaFacet()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("value")]
+ public string Value
+ {
+ get{ return val; }
+ set{ val = value; }
+ }
+
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("fixed")]
+ public virtual bool IsFixed
+ {
+ get{ return isFixed; }
+ set{ isFixed = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs
new file mode 100755
index 00000000000..8efb7e3d548
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs
@@ -0,0 +1,19 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaForm.
+ /// </summary>
+ public enum XmlSchemaForm
+ {
+ [XmlIgnore]
+ None = 0x00000000,
+ [XmlEnum("qualified")]
+ Qualified = 0x00000001,
+ [XmlEnum("unqualified")]
+ Unqualified = 0x00000002,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
new file mode 100755
index 00000000000..319d19fd8e3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
@@ -0,0 +1,98 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaFractionDigitsFacet.
+ /// </summary>
+ public class XmlSchemaFractionDigitsFacet : XmlSchemaNumericFacet
+ {
+ private static string xmlname = "fractionDigits";
+
+ public XmlSchemaFractionDigitsFacet()
+ {
+ }
+
+ //<fractionDigits
+ // fixed = boolean : false
+ // id = ID
+ // value = nonNegativeInteger
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</fractionDigits>
+ internal static XmlSchemaFractionDigitsFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaFractionDigitsFacet fraction = new XmlSchemaFractionDigitsFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaFractionDigitsFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ fraction.LineNumber = reader.LineNumber;
+ fraction.LinePosition = reader.LinePosition;
+ fraction.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ fraction.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ fraction.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ fraction.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,fraction);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return fraction;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaFractionDigitsFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ fraction.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return fraction;
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
new file mode 100755
index 00000000000..9848d6ad319
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
@@ -0,0 +1,195 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// refers to the named group
+ /// </summary>
+ public class XmlSchemaGroup : XmlSchemaAnnotated
+ {
+ private string name;
+ private XmlSchemaGroupBase particle;
+ private XmlQualifiedName qualifiedName;
+
+ private static string xmlname = "group";
+
+ public XmlSchemaGroup()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaGroupBase Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+
+ [XmlIgnore]
+ internal XmlQualifiedName QualifiedName
+ {
+ get{ return qualifiedName;}
+ }
+
+ // 1. name must be present
+ // 2. MinOccurs & MaxOccurs of the Particle must be absent
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(Name == null)
+ error(h,"Required attribute name must be present");
+ else if(!XmlSchemaUtil.CheckNCName(this.name))
+ error(h,"attribute name must be NCName");
+ else
+ qualifiedName = new XmlQualifiedName(Name,info.TargetNamespace);
+
+ if(Particle == null)
+ {
+ error(h,"Particle is required");
+ }
+ else
+ {
+ if(Particle.MaxOccursString != null)
+ Particle.error(h,"MaxOccurs must not be present when the Particle is a child of Group");
+ if(Particle.MinOccursString != null)
+ Particle.error(h,"MinOccurs must not be present when the Particle is a child of Group");
+
+ if(Particle is XmlSchemaChoice)
+ {
+ errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaSequence)
+ {
+ errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);
+ }
+ else if(Particle is XmlSchemaAll)
+ {
+ errorCount += ((XmlSchemaAll)Particle).Compile(h,info);
+ }
+ else
+ {
+ error(h,"only all,choice or sequence are allowed");
+ }
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //From the Errata
+ //<group
+ // id = ID
+ // name = NCName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (all | choice | sequence)?)
+ //</group>
+ internal static XmlSchemaGroup Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaGroup group = new XmlSchemaGroup();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaGroup.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ group.LineNumber = reader.LineNumber;
+ group.LinePosition = reader.LinePosition;
+ group.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ group.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ group.name = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for group",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,group);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return group;
+
+// Content: (annotation?, (all | choice | sequence)?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaGroup.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ group.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "all")
+ {
+ level = 3;
+ XmlSchemaAll all = XmlSchemaAll.Read(reader,h);
+ if(all != null)
+ group.Particle = all;
+ continue;
+ }
+ if(reader.LocalName == "choice")
+ {
+ level = 3;
+ XmlSchemaChoice choice = XmlSchemaChoice.Read(reader,h);
+ if(choice != null)
+ group.Particle = choice;
+ continue;
+ }
+ if(reader.LocalName == "sequence")
+ {
+ level = 3;
+ XmlSchemaSequence sequence = XmlSchemaSequence.Read(reader,h);
+ if(sequence != null)
+ group.Particle = sequence;
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return group;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
new file mode 100755
index 00000000000..152e3b09f57
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
@@ -0,0 +1,20 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaGroupBase.
+ /// </summary>
+ public abstract class XmlSchemaGroupBase : XmlSchemaParticle
+ {
+ protected XmlSchemaGroupBase()
+ {
+ }
+
+ [XmlIgnore]
+ public abstract XmlSchemaObjectCollection Items { get; }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
new file mode 100755
index 00000000000..31ceaf8e864
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
@@ -0,0 +1,156 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaGroupRef.
+ /// </summary>
+ public class XmlSchemaGroupRef : XmlSchemaParticle
+ {
+ private XmlSchemaGroupBase particle;
+ private XmlQualifiedName refName;
+ private static string xmlname = "group";
+
+ public XmlSchemaGroupRef()
+ {
+ refName = XmlQualifiedName.Empty;
+ }
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName; }
+ set{ refName = value; }
+ }
+ [XmlIgnore]
+ public XmlSchemaGroupBase Particle
+ {
+ get{ return particle; }
+ }
+ /// <remarks>
+ /// 1. RefName must be present
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ //FIXME: Should we reset the values
+ if(MinOccurs > MaxOccurs)
+ error(h,"minOccurs must be less than or equal to maxOccurs");
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ if(refName == null || refName.IsEmpty)
+ {
+ error(h,"ref must be present");
+ }
+ else if(!XmlSchemaUtil.CheckQName(RefName))
+ error(h, "RefName must be a valid XmlQualifiedName");
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ // <group
+ // id = ID
+ // ref = QName
+ // minOccurs = ? : 1
+ // maxOccurs = ? : 1>
+ // Content: (annotation?)
+ // </group>
+ internal static XmlSchemaGroupRef Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaGroupRef groupref = new XmlSchemaGroupRef();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaGroup.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ groupref.LineNumber = reader.LineNumber;
+ groupref.LinePosition = reader.LinePosition;
+ groupref.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ groupref.Id = reader.Value;
+ }
+ else if(reader.Name == "ref")
+ {
+ Exception innerex;
+ groupref.refName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for ref attribute",innerex);
+ }
+ else if(reader.Name == "maxOccurs")
+ {
+ try
+ {
+ groupref.MaxOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for maxOccurs",e);
+ }
+ }
+ else if(reader.Name == "minOccurs")
+ {
+ try
+ {
+ groupref.MinOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for minOccurs", e);
+ }
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for group",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,groupref);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return groupref;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaGroupRef.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ groupref.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return groupref;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
new file mode 100755
index 00000000000..7e09ca0842d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
@@ -0,0 +1,91 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaIdentityConstraint.
+ /// </summary>
+ public class XmlSchemaIdentityConstraint : XmlSchemaAnnotated
+ {
+ private XmlSchemaObjectCollection fields;
+ private string name;
+ private XmlQualifiedName qName;
+ private XmlSchemaXPath selector;
+
+ public XmlSchemaIdentityConstraint()
+ {
+ fields = new XmlSchemaObjectCollection();
+ qName = XmlQualifiedName.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+
+ [XmlElement("selector",typeof(XmlSchemaXPath),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaXPath Selector
+ {
+ get{ return selector; }
+ set{ selector = value; }
+ }
+
+ [XmlElement("field",typeof(XmlSchemaXPath),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Fields
+ {
+ get{ return fields; }
+ }
+
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qName; }
+ }
+ /// <remarks>
+ /// 1. name must be present
+ /// 2. selector and field must be present
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(Name == null)
+ error(h,"Required attribute name must be present");
+ else if(!XmlSchemaUtil.CheckNCName(this.name))
+ error(h,"attribute name must be NCName");
+ else
+ this.qName = new XmlQualifiedName(Name,info.TargetNamespace);
+
+ if(Selector == null)
+ error(h,"selector must be present");
+ else
+ {
+ errorCount += Selector.Compile(h,info);
+ }
+
+ if(Fields.Count == 0)
+ error(h,"atleast one field value must be present");
+ else
+ {
+ foreach(XmlSchemaObject obj in Fields)
+ {
+ if(obj is XmlSchemaXPath)
+ {
+ XmlSchemaXPath field = (XmlSchemaXPath)obj;
+ errorCount += field.Compile(h,info);
+ }
+ else
+ error(h,"Object of type "+obj.GetType()+" is invalid in the Fields Collection");
+ }
+ }
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs
new file mode 100755
index 00000000000..7586b2db155
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs
@@ -0,0 +1,109 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaImport.
+ /// </summary>
+ public class XmlSchemaImport : XmlSchemaExternal
+ {
+ private XmlSchemaAnnotation annotation;
+ private string nameSpace;
+ private static string xmlname = "import";
+
+ public XmlSchemaImport()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("namespace")]
+ public string Namespace
+ {
+ get{ return nameSpace; }
+ set{ nameSpace = value; }
+ }
+
+ [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnnotation Annotation
+ {
+ get{ return annotation; }
+ set{ annotation = value; }
+ }
+ //<import
+ // id = ID
+ // namespace = anyURI
+ // schemaLocation = anyURI
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</import>
+ internal static XmlSchemaImport Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaImport import = new XmlSchemaImport();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != "import")
+ {
+ error(h,"Should not happen :1: XmlSchemaImport.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ import.LineNumber = reader.LineNumber;
+ import.LinePosition = reader.LinePosition;
+ import.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ import.Id = reader.Value;
+ }
+ else if(reader.Name == "namespace")
+ {
+ import.nameSpace = reader.Value;
+ }
+ else if(reader.Name == "schemaLocation")
+ {
+ import.SchemaLocation = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for import",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,import);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return import;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaImport.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ import.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return import;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs
new file mode 100755
index 00000000000..8cbb081eb7a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs
@@ -0,0 +1,97 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaInclude.
+ /// </summary>
+ public class XmlSchemaInclude : XmlSchemaExternal
+ {
+ private XmlSchemaAnnotation annotation;
+ private static string xmlname = "include";
+
+ public XmlSchemaInclude()
+ {
+ }
+ [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnnotation Annotation
+ {
+ get{ return annotation; }
+ set{ annotation = value; }
+ }
+
+ //<include
+ // id = ID
+ // schemaLocation = anyURI
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</include>
+ internal static XmlSchemaInclude Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaInclude include = new XmlSchemaInclude();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaInclude.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ include.LineNumber = reader.LineNumber;
+ include.LinePosition = reader.LinePosition;
+ include.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ include.Id = reader.Value;
+ }
+ else if(reader.Name == "schemaLocation")
+ {
+ include.SchemaLocation = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for include",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,include);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return include;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaInclude.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ include.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+
+ return include;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInfo.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInfo.cs
new file mode 100755
index 00000000000..9fc85b04f26
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInfo.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// This class would store the infomation we need during compilation.
+ /// </summary>
+ internal class XmlSchemaInfo
+ {
+ internal XmlSchemaInfo()
+ {
+ IDCollection = new Hashtable();
+ }
+
+ internal string TargetNamespace = null;
+ internal XmlSchemaDerivationMethod FinalDefault = XmlSchemaDerivationMethod.None;
+ internal XmlSchemaDerivationMethod BlockDefault = XmlSchemaDerivationMethod.None;
+ internal XmlSchemaForm ElementFormDefault = XmlSchemaForm.None;
+ internal XmlSchemaForm AttributeFormDefault = XmlSchemaForm.None;
+ internal Hashtable IDCollection;
+ internal XmlSchemaObjectTable SchemaTypes ;
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
new file mode 100755
index 00000000000..b883f9e8da7
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
@@ -0,0 +1,127 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaKey.
+ /// </summary>
+ public class XmlSchemaKey : XmlSchemaIdentityConstraint
+ {
+ private static string xmlname = "key";
+
+ public XmlSchemaKey()
+ {
+ }
+ /// <remarks>
+ /// 1. name must be present
+ /// 2. selector and field must be present
+ /// </remarks>
+ [MonoTODO]
+ internal new int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ return base.Compile(h,info);
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ internal new void error(ValidationEventHandler handle, string message)
+ {
+ errorCount++;
+ ValidationHandler.RaiseValidationError(handle, this, message);
+ }
+
+ //<key
+ // id = ID
+ // name = NCName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (selector, field+))
+ //</key>
+ internal static XmlSchemaKey Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaKey key = new XmlSchemaKey();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaKey.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ key.LineNumber = reader.LineNumber;
+ key.LinePosition = reader.LinePosition;
+ key.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ key.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ key.Name = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for key",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,key);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return key;
+
+ // Content: annotation?, selector, field+
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaKey.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ key.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2 && reader.LocalName == "selector")
+ {
+ level = 3;
+ XmlSchemaXPath selector = XmlSchemaXPath.Read(reader,h,"selector");
+ if(selector != null)
+ key.Selector = selector;
+ continue;
+ }
+ if(level <= 3 && reader.LocalName == "field")
+ {
+ level = 3;
+ if(key.Selector == null)
+ error(h,"selector must be defined before field declarations",null);
+ XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");
+ if(field != null)
+ key.Fields.Add(field);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return key;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
new file mode 100755
index 00000000000..f22a40f23bd
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
@@ -0,0 +1,151 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaKeyref.
+ /// </summary>
+ public class XmlSchemaKeyref : XmlSchemaIdentityConstraint
+ {
+ private XmlQualifiedName refer;
+ private static string xmlname = "keyref";
+
+ public XmlSchemaKeyref()
+ {
+ refer = XmlQualifiedName.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("refer")]
+ public XmlQualifiedName Refer
+ {
+ get{ return refer; }
+ set{ refer = value; }
+ }
+ /// <remarks>
+ /// 1. name must be present
+ /// 2. selector and field must be present
+ /// 3. refer must be present
+ /// </remarks>
+ [MonoTODO]
+ internal new int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount += base.Compile(h,info);
+ if(refer == null || refer.IsEmpty)
+ error(h,"refer must be present");
+ else if(!XmlSchemaUtil.CheckQName(refer))
+ error(h,"Refer is not a valid XmlQualifiedName");
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ internal new void error(ValidationEventHandler handle, string message)
+ {
+ errorCount++;
+ ValidationHandler.RaiseValidationError(handle, this, message);
+ }
+ //<key
+ // id = ID
+ // name = NCName
+ // refer = QName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (selector, field+))
+ //</key>
+ internal static XmlSchemaKeyref Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaKeyref keyref = new XmlSchemaKeyref();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaKeyref.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ keyref.LineNumber = reader.LineNumber;
+ keyref.LinePosition = reader.LinePosition;
+ keyref.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ keyref.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ keyref.Name = reader.Value;
+ }
+ else if(reader.Name == "refer")
+ {
+ Exception innerex;
+ keyref.refer = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for refer attribute",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for keyref",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,keyref);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return keyref;
+
+ // Content: annotation?, selector, field+
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaKeyref.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ keyref.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2 && reader.LocalName == "selector")
+ {
+ level = 3;
+ XmlSchemaXPath selector = XmlSchemaXPath.Read(reader,h,"selector");
+ if(selector != null)
+ keyref.Selector = selector;
+ continue;
+ }
+ if(level <= 3 && reader.LocalName == "field")
+ {
+ level = 3;
+ if(keyref.Selector == null)
+ error(h,"selector must be defined before field declarations",null);
+ XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");
+ if(field != null)
+ keyref.Fields.Add(field);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return keyref;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
new file mode 100755
index 00000000000..263d3c1c58e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
@@ -0,0 +1,96 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaLengthFacet.
+ /// </summary>
+ public class XmlSchemaLengthFacet : XmlSchemaNumericFacet
+ {
+ private static string xmlname = "length";
+
+ public XmlSchemaLengthFacet()
+ {
+ }
+
+ //<length
+ // fixed = boolean : false
+ // id = ID
+ // value = nonNegativeInteger
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</length>
+ internal static XmlSchemaLengthFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaLengthFacet length = new XmlSchemaLengthFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaLengthFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ length.LineNumber = reader.LineNumber;
+ length.LinePosition = reader.LinePosition;
+ length.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ length.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ length.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ length.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for group",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,length);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return length;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaLengthFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ length.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return length;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
new file mode 100755
index 00000000000..258c5bf9ccc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
@@ -0,0 +1,96 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMaxExclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMaxExclusiveFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "maxExclusive";
+
+ public XmlSchemaMaxExclusiveFacet()
+ {
+ }
+
+ //<maxExclusive
+ // fixed = boolean : false
+ // id = ID
+ // value = anySimpleType
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</maxExclusive>
+ internal static XmlSchemaMaxExclusiveFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaMaxExclusiveFacet maxex = new XmlSchemaMaxExclusiveFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaMaxExclusiveFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ maxex.LineNumber = reader.LineNumber;
+ maxex.LinePosition = reader.LinePosition;
+ maxex.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ maxex.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ maxex.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ maxex.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,maxex);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return maxex;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaMaxExclusiveFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ maxex.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return maxex;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
new file mode 100755
index 00000000000..c080abad8d9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
@@ -0,0 +1,96 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMaxInclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMaxInclusiveFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "maxInclusive";
+
+ public XmlSchemaMaxInclusiveFacet()
+ {
+ }
+
+ //<maxInclusive
+ // fixed = boolean : false
+ // id = ID
+ // value = anySimpleType
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</maxInclusive>
+ internal static XmlSchemaMaxInclusiveFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaMaxInclusiveFacet maxi = new XmlSchemaMaxInclusiveFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaMaxInclusiveFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ maxi.LineNumber = reader.LineNumber;
+ maxi.LinePosition = reader.LinePosition;
+ maxi.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ maxi.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ maxi.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ maxi.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,maxi);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return maxi;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaMaxInclusiveFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ maxi.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return maxi;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
new file mode 100755
index 00000000000..a7bbb98b145
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
@@ -0,0 +1,97 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMaxLengthFacet.
+ /// </summary>
+ public class XmlSchemaMaxLengthFacet : XmlSchemaNumericFacet
+ {
+ private static string xmlname = "maxLength";
+
+ public XmlSchemaMaxLengthFacet()
+ {
+ }
+
+ //<maxLength
+ // fixed = boolean : false
+ // id = ID
+ // value = nonNegativeInteger
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</maxLength>
+ internal static XmlSchemaMaxLengthFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaMaxLengthFacet length = new XmlSchemaMaxLengthFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaMaxLengthFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ length.LineNumber = reader.LineNumber;
+ length.LinePosition = reader.LinePosition;
+ length.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ length.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ length.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ length.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for group",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,length);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return length;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaMaxLengthFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ length.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return length;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
new file mode 100755
index 00000000000..ea0cda2c7fa
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
@@ -0,0 +1,96 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMinExclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMinExclusiveFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "minExclusive";
+
+ public XmlSchemaMinExclusiveFacet()
+ {
+ }
+
+ //<minExclusive
+ // fixed = boolean : false
+ // id = ID
+ // value = anySimpleType
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</minExclusive>
+ internal static XmlSchemaMinExclusiveFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaMinExclusiveFacet minex = new XmlSchemaMinExclusiveFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaMinExclusiveFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ minex.LineNumber = reader.LineNumber;
+ minex.LinePosition = reader.LinePosition;
+ minex.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ minex.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ minex.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ minex.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,minex);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return minex;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaMinExclusiveFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ minex.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return minex;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
new file mode 100755
index 00000000000..8459cd3ebe5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
@@ -0,0 +1,95 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMinInclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMinInclusiveFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "minInclusive";
+
+ public XmlSchemaMinInclusiveFacet()
+ {
+ }
+ //<minInclusive
+ // fixed = boolean : false
+ // id = ID
+ // value = anySimpleType
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</minInclusive>
+ internal static XmlSchemaMinInclusiveFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaMinInclusiveFacet mini = new XmlSchemaMinInclusiveFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaMinInclusiveFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ mini.LineNumber = reader.LineNumber;
+ mini.LinePosition = reader.LinePosition;
+ mini.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ mini.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ mini.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ mini.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,mini);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return mini;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaMinInclusiveFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ mini.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return mini;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
new file mode 100755
index 00000000000..51763977a4a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
@@ -0,0 +1,96 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMinLengthFacet.
+ /// </summary>
+ public class XmlSchemaMinLengthFacet : XmlSchemaNumericFacet
+ {
+ private static string xmlname = "minLength";
+
+ public XmlSchemaMinLengthFacet()
+ {
+ }
+
+ //<minLength
+ // fixed = boolean : false
+ // id = ID
+ // value = nonNegativeInteger
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</minLength>
+ internal static XmlSchemaMinLengthFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaMinLengthFacet length = new XmlSchemaMinLengthFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaMinLengthFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ length.LineNumber = reader.LineNumber;
+ length.LinePosition = reader.LinePosition;
+ length.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ length.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ length.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ length.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,length);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return length;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaMinLengthFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ length.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return length;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
new file mode 100755
index 00000000000..f07b83213c5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
@@ -0,0 +1,158 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaNotation.
+ /// </summary>
+ public class XmlSchemaNotation : XmlSchemaAnnotated
+ {
+ private string name;
+ private string pub;
+ private string system;
+ private XmlQualifiedName qualifiedName;
+ private static string xmlname = "notation";
+
+ public XmlSchemaNotation()
+ {
+ }
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+ [System.Xml.Serialization.XmlAttribute("public")]
+ public string Public
+ {
+ get{ return pub; }
+ set{ pub = value; }
+ }
+ [System.Xml.Serialization.XmlAttribute("system")]
+ public string System
+ {
+ get{ return system; }
+ set{ system = value; }
+ }
+
+ [XmlIgnore]
+ internal XmlQualifiedName QualifiedName
+ {
+ get{ return qualifiedName;}
+ }
+
+ // 1. name and public must be present
+ // public and system must be anyURI
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(Name == null)
+ error(h,"Required attribute name must be present");
+ else if(!XmlSchemaUtil.CheckNCName(this.name))
+ error(h,"attribute name must be NCName");
+ else
+ qualifiedName = new XmlQualifiedName(Name,info.TargetNamespace);
+
+ if(Public==null)
+ error(h,"public must be present");
+ else if(!XmlSchemaUtil.CheckAnyUri(Public))
+ error(h,"public must be anyURI");
+
+ if(system != null && !XmlSchemaUtil.CheckAnyUri(system))
+ error(h,"system must be present and of Type anyURI");
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<notation
+ // id = ID
+ // name = NCName
+ // public = anyURI
+ // system = anyURI
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</notation>
+ internal static XmlSchemaNotation Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaNotation notation = new XmlSchemaNotation();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaInclude.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ notation.LineNumber = reader.LineNumber;
+ notation.LinePosition = reader.LinePosition;
+ notation.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ notation.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ notation.name = reader.Value;
+ }
+ else if(reader.Name == "public")
+ {
+ notation.pub = reader.Value;
+ }
+ else if(reader.Name == "system")
+ {
+ notation.system = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for notation",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,notation);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return notation;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaNotation.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ notation.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return notation;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs
new file mode 100755
index 00000000000..72359a71f16
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaNumericFacet.
+ /// </summary>
+ public abstract class XmlSchemaNumericFacet : XmlSchemaFacet
+ {
+ protected XmlSchemaNumericFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
new file mode 100755
index 00000000000..71e8b57faf4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
@@ -0,0 +1,75 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObject.
+ /// </summary>
+ public abstract class XmlSchemaObject
+ {
+ private int lineNumber;
+ private int linePosition;
+ private string sourceUri;
+ private XmlSerializerNamespaces namespaces;
+ internal ArrayList unhandledAttributeList ;
+ internal bool isCompiled = false;
+ internal int errorCount = 0;
+
+ protected XmlSchemaObject()
+ {
+ namespaces = new XmlSerializerNamespaces();
+ unhandledAttributeList = null;
+ }
+
+ [XmlIgnore]
+ public int LineNumber
+ {
+ get{ return lineNumber; }
+ set{ lineNumber = value; }
+ }
+ [XmlIgnore]
+ public int LinePosition
+ {
+ get{ return linePosition; }
+ set{ linePosition = value; }
+ }
+ [XmlIgnore]
+ public string SourceUri
+ {
+ get{ return sourceUri; }
+ set{ sourceUri = value; }
+ }
+
+ // Undocumented Property
+ [XmlNamespaceDeclarations]
+ public XmlSerializerNamespaces Namespaces
+ {
+ get{ return namespaces; }
+ set{ namespaces = value; }
+ }
+
+ internal void error(ValidationEventHandler handle,string message)
+ {
+ errorCount++;
+ ValidationHandler.RaiseValidationError(handle,this,message);
+ }
+ internal void warn(ValidationEventHandler handle,string message)
+ {
+ errorCount++;
+ ValidationHandler.RaiseValidationWarning(handle,this,message);
+ }
+ internal static void error(ValidationEventHandler handle, string message, Exception innerException)
+ {
+ ValidationHandler.RaiseValidationError(handle,message, innerException);
+ }
+ internal static void warn(ValidationEventHandler handle, string message, Exception innerException)
+ {
+ ValidationHandler.RaiseValidationWarning(handle,message, innerException);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs
new file mode 100755
index 00000000000..874c5c13830
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs
@@ -0,0 +1,88 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObjectCollection.
+ /// </summary>
+ public class XmlSchemaObjectCollection : System.Collections.CollectionBase
+ {
+ private XmlSchemaObject parent;
+
+ public XmlSchemaObjectCollection()
+ {
+ }
+ public XmlSchemaObjectCollection(XmlSchemaObject parent)
+ {
+ this.parent = parent;
+ }
+
+ // Properties
+ public virtual XmlSchemaObject this[ int index ]
+ {
+ get
+ {
+ return (XmlSchemaObject) this.List[index];
+ }
+ set
+ {
+ this.List[index] = value;
+ }
+ }
+
+ // Methods
+ public int Add(XmlSchemaObject item)
+ {
+ return this.List.Add(item);
+ }
+
+ public bool Contains(XmlSchemaObject item)
+ {
+ return this.List.Contains(item);
+ }
+
+ public void CopyTo(XmlSchemaObject[] array, int index)
+ {
+ this.List.CopyTo(array,index);
+ }
+
+ public new XmlSchemaObjectEnumerator GetEnumerator ()
+ {
+ return new XmlSchemaObjectEnumerator(this.List);
+ }
+
+ public int IndexOf(XmlSchemaObject item)
+ {
+ return this.List.IndexOf(item);
+ }
+
+ public void Insert(int index, XmlSchemaObject item)
+ {
+ this.List.Insert(index, item);
+ }
+
+ protected override void OnClear()
+ {
+ }
+
+ protected override void OnInsert(int index,object item)
+ {
+ }
+
+ protected override void OnRemove(int index,object item)
+ {
+ }
+
+ protected override void OnSet(int index,object oldValue,object newValue)
+ {
+ }
+
+ public void Remove(XmlSchemaObject item)
+ {
+ this.List.Remove(item);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs
new file mode 100755
index 00000000000..6c2af9513d5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs
@@ -0,0 +1,49 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObjectEnumerator.
+ /// </summary>
+ public sealed class XmlSchemaObjectEnumerator : IEnumerator
+ {
+ private IEnumerator ienum;
+ internal XmlSchemaObjectEnumerator(IList list)
+ {
+ this.ienum = list.GetEnumerator();
+ }
+ // Properties
+ public XmlSchemaObject Current
+ {
+ get
+ {
+ return (XmlSchemaObject) ienum.Current;
+ }
+ }
+ // Methods
+ public bool MoveNext()
+ {
+ return ienum.MoveNext();
+ }
+ public void Reset()
+ {
+ ienum.Reset();
+ }
+ //Explicit Interface implementation
+ bool IEnumerator.MoveNext()
+ {
+ return ienum.MoveNext();
+ }
+ void IEnumerator.Reset()
+ {
+ ienum.Reset();
+ }
+ object IEnumerator.Current
+ {
+ get{return (XmlSchema) ienum.Current;}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
new file mode 100755
index 00000000000..16461b9875c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
@@ -0,0 +1,51 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObjectTable.
+ /// </summary>
+ public class XmlSchemaObjectTable
+ {
+ private Hashtable table;
+
+ internal XmlSchemaObjectTable()
+ {
+ table = new Hashtable();
+ }
+ public int Count
+ {
+ get{ return table.Count; }
+ }
+ public XmlSchemaObject this[XmlQualifiedName name]
+ {
+ get{ return (XmlSchemaObject) table[name]; }
+ }
+ public ICollection Names
+ {
+ get{ return table.Keys; }
+ }
+ public ICollection Values
+ {
+ get{ return table.Values;}
+ }
+
+ public bool Contains(XmlQualifiedName name)
+ {
+ return table.Contains(name);
+ }
+ public IDictionaryEnumerator GetEnumerator()
+ {
+ return table.GetEnumerator();
+ }
+
+ internal void Add(XmlQualifiedName name, XmlSchemaObject value)
+ {
+ table.Add(name,value);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
new file mode 100755
index 00000000000..119c335b3c0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
@@ -0,0 +1,98 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaParticle.
+ /// </summary>
+ public abstract class XmlSchemaParticle : XmlSchemaAnnotated
+ {
+ decimal minOccurs, maxOccurs;
+ string minstr, maxstr;
+
+ protected XmlSchemaParticle()
+ {
+ minOccurs = decimal.One;
+ maxOccurs = decimal.One;
+ }
+
+ #region Attributes
+
+ [System.Xml.Serialization.XmlAttribute("minOccurs")]
+ public string MinOccursString
+ {
+ get{ return minstr; }
+ set
+ {
+ decimal val = decimal.Parse(value);
+ if(val >= 0 && (val == Decimal.Truncate(val)))
+ {
+ minOccurs = val;
+ minstr = val.ToString();
+ }
+ else
+ {
+ throw new XmlSchemaException
+ ("MinOccursString must be a non-negative number",null);
+ }
+ }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("maxOccurs")]
+ public string MaxOccursString
+ {
+ get{ return maxstr; }
+ set
+ {
+ if(value == "unbounded")
+ {
+ maxstr = value;
+ maxOccurs = decimal.MaxValue;
+ }
+ else
+ {
+ decimal val = decimal.Parse(value);
+ if(val >= 0 && (val == Decimal.Truncate(val)))
+ {
+ maxOccurs = val;
+ maxstr = val.ToString();
+ }
+ else
+ {
+ throw new XmlSchemaException
+ ("MaxOccurs must be a non-negative integer",null);
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ #region XmlIgnore
+
+ [XmlIgnore]
+ public decimal MinOccurs
+ {
+ get{ return minOccurs; }
+ set
+ {
+ MinOccursString = value.ToString();
+ }
+ }
+
+ [XmlIgnore]
+ public decimal MaxOccurs
+ {
+ get{ return maxOccurs; }
+ set
+ {
+ MaxOccursString = value.ToString();
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
new file mode 100755
index 00000000000..da2effbb380
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
@@ -0,0 +1,87 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaPatternFacet.
+ /// </summary>
+ public class XmlSchemaPatternFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "pattern";
+
+ public XmlSchemaPatternFacet()
+ {
+ }
+ //<pattern
+ // id = ID
+ // value = anySimpleType
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</pattern>
+ internal static XmlSchemaPatternFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaPatternFacet pattern = new XmlSchemaPatternFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaPatternFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ pattern.LineNumber = reader.LineNumber;
+ pattern.LinePosition = reader.LinePosition;
+ pattern.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ pattern.Id = reader.Value;
+ }
+ else if(reader.Name == "value")
+ {
+ pattern.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,pattern);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return pattern;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaPatternFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ pattern.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return pattern;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs
new file mode 100755
index 00000000000..fc4375a9767
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs
@@ -0,0 +1,358 @@
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// A wrapper around XmlReader
+ /// </summary>
+ public class XmlSchemaReader : XmlReader, IXmlLineInfo
+ {
+ XmlReader reader;
+ ValidationEventHandler handler;
+ bool hasLineInfo;
+ public XmlSchemaReader(XmlReader reader,ValidationEventHandler handler)
+ {
+ this.reader = reader;
+ this.handler = handler;
+ if(reader is IXmlLineInfo)
+ {
+ IXmlLineInfo info = (IXmlLineInfo)reader;
+ hasLineInfo = info.HasLineInfo();
+ }
+ }
+
+ /// <summary>
+ /// Returns the Namespace:LocalName for the object
+ /// </summary>
+ public string FullName
+ {
+ get { return NamespaceURI + ":" + LocalName; }
+ }
+
+ public void RaiseInvalidElementError()
+ {
+ string errstr = "Element "+FullName + " is invalid in this context.\n";
+ if(hasLineInfo)
+ errstr += "The error occured on ("+((IXmlLineInfo)reader).LineNumber
+ +","+((IXmlLineInfo)reader).LinePosition+")";
+ XmlSchemaObject.error(handler, errstr, null);
+ SkipToEnd();
+ }
+ /// <summary>
+ /// Reads till the next Element or EndElement. Also checks that the Namespace of the element is
+ /// Schema's Namespace.
+ /// </summary>
+ /// <returns></returns>
+ public bool ReadNextElement()
+ {
+ MoveToElement();
+ while(Read())
+ {
+ if(NodeType == XmlNodeType.Element || NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.NamespaceURI != XmlSchema.Namespace)
+ {
+ RaiseInvalidElementError();
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Skips to the end of the current element
+ /// </summary>
+ public void SkipToEnd()
+ {
+ MoveToElement();
+ if(IsEmptyElement || NodeType != XmlNodeType.Element)
+ return;
+ if(NodeType == XmlNodeType.Element)
+ {
+ int depth = Depth;
+ while(Read())
+ {
+ if(Depth == depth)
+ break;
+ }
+ }
+ return;
+ }
+
+ #region LineInfo
+ public bool HasLineInfo()
+ {
+ return hasLineInfo;
+ }
+ public int LineNumber
+ {
+ get { return hasLineInfo?((IXmlLineInfo)reader).LineNumber: 0; }
+ }
+ public int LinePosition
+ {
+ get { return hasLineInfo?((IXmlLineInfo)reader).LinePosition: 0; }
+ }
+ #endregion
+
+ #region Delegates
+ public override int AttributeCount
+ {
+ get { return reader.AttributeCount; }
+ }
+ public override string BaseURI
+ {
+ get { return reader.BaseURI; }
+ }
+ public override bool CanResolveEntity
+ {
+ get { return reader.CanResolveEntity; }
+ }
+ public override int Depth
+ {
+ get { return reader.Depth; }
+ }
+ public override bool EOF
+ {
+ get { return reader.EOF; }
+ }
+ public override bool HasAttributes
+ {
+ get { return reader.HasAttributes; }
+ }
+ public override bool HasValue
+ {
+ get { return reader.HasValue; }
+ }
+ public override bool IsDefault
+ {
+ get { return reader.IsDefault; }
+ }
+ public override bool IsEmptyElement
+ {
+ get { return reader.IsEmptyElement; }
+ }
+ public override string this[ int i ]
+ {
+ get { return reader[i]; }
+ }
+ public override string this[ string name ]
+ {
+ get { return reader[name]; }
+ }
+ public override string this[ string name, string namespaceURI ]
+ {
+ get { return reader[name,namespaceURI]; }
+ }
+ public override string LocalName
+ {
+ get { return reader.LocalName; }
+ }
+ public override string Name
+ {
+ get { return reader.Name; }
+ }
+ public override string NamespaceURI
+ {
+ get { return reader.NamespaceURI; }
+ }
+ public override XmlNameTable NameTable
+ {
+ get { return reader.NameTable; }
+ }
+ public override XmlNodeType NodeType
+ {
+ get { return reader.NodeType; }
+ }
+ public override string Prefix
+ {
+ get { return reader.Prefix; }
+ }
+ public override char QuoteChar
+ {
+ get { return reader.QuoteChar; }
+ }
+ public override ReadState ReadState
+ {
+ get { return reader.ReadState; }
+ }
+ public override string Value
+ {
+ get { return reader.Value; }
+ }
+ public override string XmlLang
+ {
+ get { return reader.XmlLang; }
+ }
+ public override XmlSpace XmlSpace
+ {
+ get { return reader.XmlSpace; }
+ }
+
+ public override void Close()
+ {
+ reader.Close();
+ }
+
+ public override bool Equals(object obj)
+ {
+ return reader.Equals(obj);
+ }
+
+ public override string GetAttribute(int i)
+ {
+ return reader.GetAttribute(i);
+ }
+
+ public override string GetAttribute(string name)
+ {
+ return reader.GetAttribute(name);
+ }
+
+ public override string GetAttribute(string name, string namespaceURI)
+ {
+ return reader.GetAttribute(name, namespaceURI);
+ }
+
+ public override int GetHashCode()
+ {
+ return reader.GetHashCode();
+ }
+
+ public override bool IsStartElement()
+ {
+ return reader.IsStartElement();
+ }
+
+ public override bool IsStartElement(string localname, string ns)
+ {
+ return reader.IsStartElement(localname, ns);
+ }
+
+ public override bool IsStartElement(string name)
+ {
+ return reader.IsStartElement(name);
+ }
+
+ public override string LookupNamespace(string prefix)
+ {
+ return reader.LookupNamespace(prefix);
+ }
+
+ public override void MoveToAttribute(int i)
+ {
+ reader.MoveToAttribute(i);
+ }
+
+ public override bool MoveToAttribute(string name)
+ {
+ return reader.MoveToAttribute(name);
+ }
+
+ public override bool MoveToAttribute(string name, string ns)
+ {
+ return reader.MoveToAttribute(name,ns);
+ }
+
+ public override System.Xml.XmlNodeType MoveToContent()
+ {
+ return reader.MoveToContent();
+ }
+
+ public override bool MoveToElement()
+ {
+ return reader.MoveToElement();
+ }
+
+ public override bool MoveToFirstAttribute()
+ {
+ return reader.MoveToFirstAttribute();
+ }
+
+ public override bool MoveToNextAttribute()
+ {
+ return reader.MoveToNextAttribute();
+ }
+
+ public override bool Read()
+ {
+ return reader.Read();
+ }
+
+ public override bool ReadAttributeValue()
+ {
+ return reader.ReadAttributeValue();
+ }
+
+ public override string ReadElementString()
+ {
+ return reader.ReadElementString();
+ }
+
+ public override string ReadElementString(string localname, string ns)
+ {
+ return reader.ReadElementString(localname, ns);
+ }
+
+ public override string ReadElementString(string name)
+ {
+ return reader.ReadElementString(name);
+ }
+
+ public override void ReadEndElement()
+ {
+ reader.ReadEndElement();
+ }
+
+ public override string ReadInnerXml()
+ {
+ return reader.ReadInnerXml();
+ }
+
+ public override string ReadOuterXml()
+ {
+ return reader.ReadOuterXml();
+ }
+
+ public override void ReadStartElement()
+ {
+ reader.ReadStartElement();
+ }
+
+ public override void ReadStartElement(string localname, string ns)
+ {
+ reader.ReadStartElement(localname, ns);
+ }
+
+ public override void ReadStartElement(string name)
+ {
+ reader.ReadStartElement(name);
+ }
+
+ public override string ReadString()
+ {
+ return reader.ReadString();
+ }
+
+ public override void ResolveEntity()
+ {
+ reader.ResolveEntity();
+ }
+
+ public override void Skip()
+ {
+ reader.Skip();
+ }
+
+ public override string ToString()
+ {
+ return reader.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs
new file mode 100755
index 00000000000..bd573ec94ab
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs
@@ -0,0 +1,151 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaRedefine.
+ /// </summary>
+ public class XmlSchemaRedefine : XmlSchemaExternal
+ {
+ private XmlSchemaObjectTable attributeGroups;
+ private XmlSchemaObjectTable groups;
+ private XmlSchemaObjectCollection items;
+ private XmlSchemaObjectTable schemaTypes;
+ private static string xmlname = "redefine";
+
+ public XmlSchemaRedefine()
+ {
+ attributeGroups = new XmlSchemaObjectTable();
+ groups = new XmlSchemaObjectTable();
+ items = new XmlSchemaObjectCollection(this);
+ schemaTypes = new XmlSchemaObjectTable();
+ }
+
+ [XmlElement("annotation",typeof(XmlSchemaAnnotation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ //NOTE: AttributeGroup and not AttributeGroupRef
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable AttributeGroups
+ {
+ get{ return attributeGroups; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable SchemaTypes
+ {
+ get{ return schemaTypes; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Groups
+ {
+ get{ return groups; }
+ }
+//<redefine
+// id = ID
+// schemaLocation = anyURI
+// {any attributes with non-schema namespace . . .}>
+// Content: (annotation | (simpleType | complexType | group | attributeGroup))*
+//</redefine>
+ internal static XmlSchemaRedefine Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaRedefine redefine = new XmlSchemaRedefine();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaRedefine.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ redefine.LineNumber = reader.LineNumber;
+ redefine.LinePosition = reader.LinePosition;
+ redefine.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ redefine.Id = reader.Value;
+ }
+ else if(reader.Name == "schemaLocation")
+ {
+ redefine.SchemaLocation = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for redefine",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,redefine);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return redefine;
+
+ //(annotation | (simpleType | complexType | group | attributeGroup))*
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaRedefine.Read, name="+reader.Name,null);
+ break;
+ }
+ if(reader.LocalName == "annotation")
+ {
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ redefine.items.Add(annotation);
+ continue;
+ }
+ if(reader.LocalName == "simpleType")
+ {
+ XmlSchemaSimpleType simpleType = XmlSchemaSimpleType.Read(reader,h);
+ if(simpleType != null)
+ redefine.items.Add(simpleType);
+ continue;
+ }
+ if(reader.LocalName == "complexType")
+ {
+ XmlSchemaComplexType complexType = XmlSchemaComplexType.Read(reader,h);
+ if(complexType != null)
+ redefine.items.Add(complexType);
+ continue;
+ }
+ if(reader.LocalName == "group")
+ {
+ XmlSchemaGroup group = XmlSchemaGroup.Read(reader,h);
+ if(group != null)
+ redefine.items.Add(group);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ XmlSchemaAttributeGroup attributeGroup = XmlSchemaAttributeGroup.Read(reader,h);
+ if(attributeGroup != null)
+ redefine.items.Add(attributeGroup);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return redefine;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
new file mode 100755
index 00000000000..769ab66f2b7
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
@@ -0,0 +1,202 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSequence.
+ /// </summary>
+ public class XmlSchemaSequence : XmlSchemaGroupBase
+ {
+ private XmlSchemaObjectCollection items;
+ private static string xmlname = "sequence";
+
+ public XmlSchemaSequence()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("any",typeof(XmlSchemaAny),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ //FIXME: Should we reset the values
+ if(MinOccurs > MaxOccurs)
+ error(h,"minOccurs must be less than or equal to maxOccurs");
+
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);
+
+ foreach(XmlSchemaObject obj in Items)
+ {
+ if(obj is XmlSchemaElement)
+ {
+ errorCount += ((XmlSchemaElement)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaGroupRef)
+ {
+ errorCount += ((XmlSchemaGroupRef)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaChoice)
+ {
+ errorCount += ((XmlSchemaChoice)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaSequence)
+ {
+ errorCount += ((XmlSchemaSequence)obj).Compile(h,info);
+ }
+ else if(obj is XmlSchemaAny)
+ {
+ errorCount += ((XmlSchemaAny)obj).Compile(h,info);
+ }
+ }
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<sequence
+ // id = ID
+ // maxOccurs = (nonNegativeInteger | unbounded) : 1
+ // minOccurs = nonNegativeInteger : 1
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (element | group | choice | sequence | any)*)
+ //</sequence>
+ internal static XmlSchemaSequence Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSequence sequence = new XmlSchemaSequence();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaSequence.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ sequence.LineNumber = reader.LineNumber;
+ sequence.LinePosition = reader.LinePosition;
+ sequence.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ sequence.Id = reader.Value;
+ }
+ else if(reader.Name == "maxOccurs")
+ {
+ try
+ {
+ sequence.MaxOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for maxOccurs",e);
+ }
+ }
+ else if(reader.Name == "minOccurs")
+ {
+ try
+ {
+ sequence.MinOccursString = reader.Value;
+ }
+ catch(Exception e)
+ {
+ error(h,reader.Value + " is an invalid value for minOccurs",e);
+ }
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for sequence",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,sequence);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return sequence;
+
+ // Content: (annotation?, (element | group | choice | sequence | any)*)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSequence.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ sequence.Annotation = annotation;
+ continue;
+ }
+ if(level <=2)
+ {
+ if(reader.LocalName == "element")
+ {
+ level = 2;
+ XmlSchemaElement element = XmlSchemaElement.Read(reader,h);
+ if(element != null)
+ sequence.items.Add(element);
+ continue;
+ }
+ if(reader.LocalName == "group")
+ {
+ level = 2;
+ XmlSchemaGroupRef group = XmlSchemaGroupRef.Read(reader,h);
+ if(group != null)
+ sequence.items.Add(group);
+ continue;
+ }
+ if(reader.LocalName == "choice")
+ {
+ level = 2;
+ XmlSchemaChoice choice = XmlSchemaChoice.Read(reader,h);
+ if(choice != null)
+ sequence.items.Add(choice);
+ continue;
+ }
+ if(reader.LocalName == "sequence")
+ {
+ level = 2;
+ XmlSchemaSequence seq = XmlSchemaSequence.Read(reader,h);
+ if(seq != null)
+ sequence.items.Add(seq);
+ continue;
+ }
+ if(reader.LocalName == "any")
+ {
+ level = 2;
+ XmlSchemaAny any = XmlSchemaAny.Read(reader,h);
+ if(any != null)
+ sequence.items.Add(any);
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return sequence;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
new file mode 100755
index 00000000000..2c2fce3f933
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
@@ -0,0 +1,146 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleContent.
+ /// </summary>
+ public class XmlSchemaSimpleContent : XmlSchemaContentModel
+ {
+ private XmlSchemaContent content;
+ private static string xmlname = "simpleContent";
+ public XmlSchemaSimpleContent()
+ {
+ }
+
+ [XmlElement("restriction",typeof(XmlSchemaSimpleContentRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("extension",typeof(XmlSchemaSimpleContentExtension),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaContent Content
+ {
+ get{ return content; }
+ set{ content = value; }
+ }
+
+ ///<remarks>
+ /// 1. Content must be present and one of restriction or extention
+ ///</remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(Content == null)
+ {
+ error(h, "Content must be present in a simpleContent");
+ }
+ else
+ {
+ if(Content is XmlSchemaSimpleContentRestriction)
+ {
+ XmlSchemaSimpleContentRestriction xscr = (XmlSchemaSimpleContentRestriction) Content;
+ errorCount += xscr.Compile(h,info);
+ }
+ else if(Content is XmlSchemaSimpleContentExtension)
+ {
+ XmlSchemaSimpleContentExtension xsce = (XmlSchemaSimpleContentExtension) Content;
+ errorCount += xsce.Compile(h,info);
+ }
+ else
+ error(h,"simpleContent can't have any value other than restriction or extention");
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<simpleContent
+ // id = ID
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (restriction | extension))
+ //</simpleContent>
+ internal static XmlSchemaSimpleContent Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleContent simple = new XmlSchemaSimpleContent();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexContent.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ simple.LineNumber = reader.LineNumber;
+ simple.LinePosition = reader.LinePosition;
+ simple.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ simple.Id = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for simpleContent",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,simple);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return simple;
+ //Content: (annotation?, (restriction | extension))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleContent.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ simple.Annotation = annotation;
+ continue;
+ }
+ if(level <=2)
+ {
+ if(reader.LocalName == "restriction")
+ {
+ level = 3;
+ XmlSchemaSimpleContentRestriction restriction = XmlSchemaSimpleContentRestriction.Read(reader,h);
+ if(restriction != null)
+ simple.content = restriction;
+ continue;
+ }
+ if(reader.LocalName == "extension")
+ {
+ level = 3;
+ XmlSchemaSimpleContentExtension extension = XmlSchemaSimpleContentExtension.Read(reader,h);
+ if(extension != null)
+ simple.content = extension;
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return simple;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
new file mode 100755
index 00000000000..09d10f25ef6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
@@ -0,0 +1,190 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleContentExtension.
+ /// </summary>
+ public class XmlSchemaSimpleContentExtension : XmlSchemaContent
+ {
+
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlQualifiedName baseTypeName;
+ private static string xmlname = "extension";
+
+ public XmlSchemaSimpleContentExtension()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ attributes = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value; }
+ }
+
+ ///<remarks>
+ /// 1. Base must be present and a QName
+ ///</remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(BaseTypeName == null || BaseTypeName.IsEmpty)
+ {
+ error(h, "base must be present and a QName");
+ }
+ else if(!XmlSchemaUtil.CheckQName(BaseTypeName))
+ error(h,"BaseTypeName must be a QName");
+
+ if(this.AnyAttribute != null)
+ {
+ errorCount += AnyAttribute.Compile(h,info);
+ }
+
+ foreach(XmlSchemaObject obj in Attributes)
+ {
+ if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ errorCount += attr.Compile(h,info);
+ }
+ else if(obj is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;
+ errorCount += atgrp.Compile(h,info);
+ }
+ else
+ error(h,obj.GetType() +" is not valid in this place::SimpleConentExtension");
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<extension
+ //base = QName
+ //id = ID
+ //{any attributes with non-schema namespace . . .}>
+ //Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
+ //</extension>
+ internal static XmlSchemaSimpleContentExtension Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleContentExtension extension = new XmlSchemaSimpleContentExtension();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaAttributeGroup.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ extension.LineNumber = reader.LineNumber;
+ extension.LinePosition = reader.LinePosition;
+ extension.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "base")
+ {
+ Exception innerex;
+ extension.baseTypeName= XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for base attribute",innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ extension.Id = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for extension in this context",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,extension);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return extension;
+
+ //Content: 1.annotation?, 2.(attribute | attributeGroup)*, 3.anyAttribute?
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleContentExtension.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ extension.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "attribute")
+ {
+ level = 2;
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ extension.Attributes.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ level = 2;
+ XmlSchemaAttributeGroupRef attr = XmlSchemaAttributeGroupRef.Read(reader,h);
+ if(attr != null)
+ extension.attributes.Add(attr);
+ continue;
+ }
+ }
+ if(level <= 3 && reader.LocalName == "anyAttribute")
+ {
+ level = 4;
+ XmlSchemaAnyAttribute anyattr = XmlSchemaAnyAttribute.Read(reader,h);
+ if(anyattr != null)
+ extension.AnyAttribute = anyattr;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return extension;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
new file mode 100755
index 00000000000..f908b8788ed
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
@@ -0,0 +1,337 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleContentRestriction.
+ /// </summary>
+ public class XmlSchemaSimpleContentRestriction : XmlSchemaContent
+ {
+
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlSchemaSimpleType baseType;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaObjectCollection facets;
+ private static string xmlname = "restriction";
+
+ public XmlSchemaSimpleContentRestriction()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ attributes = new XmlSchemaObjectCollection();
+ facets = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType BaseType
+ {
+ get{ return baseType; }
+ set{ baseType = value; }
+ }
+
+ [XmlElement("minExclusive",typeof(XmlSchemaMinExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minInclusive",typeof(XmlSchemaMinInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxExclusive",typeof(XmlSchemaMaxExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxInclusive",typeof(XmlSchemaMaxInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("totalDigits",typeof(XmlSchemaTotalDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("fractionDigits",typeof(XmlSchemaFractionDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("length",typeof(XmlSchemaLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minLength",typeof(XmlSchemaMinLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxLength",typeof(XmlSchemaMaxLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("enumeration",typeof(XmlSchemaEnumerationFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("whiteSpace",typeof(XmlSchemaWhiteSpaceFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("pattern",typeof(XmlSchemaPatternFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Facets
+ {
+ get{ return facets; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value; }
+ }
+
+ ///<remarks>
+ /// 1. Base must be present and a QName
+ ///</remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(BaseTypeName == null || BaseTypeName.IsEmpty)
+ {
+ error(h, "base must be present and a QName");
+ }
+ else if(!XmlSchemaUtil.CheckQName(BaseTypeName))
+ error(h,"BaseTypeName must be a QName");
+
+ if(BaseType != null)
+ {
+ errorCount += BaseType.Compile(h,info);
+ }
+
+ if(this.AnyAttribute != null)
+ {
+ errorCount += AnyAttribute.Compile(h,info);
+ }
+
+ foreach(XmlSchemaObject obj in Attributes)
+ {
+ if(obj is XmlSchemaAttribute)
+ {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;
+ errorCount += attr.Compile(h,info);
+ }
+ else if(obj is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;
+ errorCount += atgrp.Compile(h,info);
+ }
+ else
+ error(h,obj.GetType() +" is not valid in this place::SimpleContentRestriction");
+ }
+
+ //TODO: Compile Facets: Looks like they are a part of datatypes. So we'll do them with the datatypes
+
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ //<restriction
+ //base = QName
+ //id = ID
+ //{any attributes with non-schema namespace . . .}>
+ //Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?))
+ //</restriction>
+ internal static XmlSchemaSimpleContentRestriction Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleContentRestriction restriction = new XmlSchemaSimpleContentRestriction();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexContentRestriction.Read, name="+reader.Name,null);
+ reader.SkipToEnd();
+ return null;
+ }
+
+ restriction.LineNumber = reader.LineNumber;
+ restriction.LinePosition = reader.LinePosition;
+ restriction.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "base")
+ {
+ Exception innerex;
+ restriction.baseTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for base attribute",innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ restriction.Id = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for restriction",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,restriction);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return restriction;
+
+ //Content: 1.annotation?,
+ // 2.simpleType?,
+ // 3.(minExclusive |...| enumeration | whiteSpace | pattern)*,
+ // 4.(attribute | attributeGroup)*,
+ // 5.anyAttribute?
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleContentRestriction.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ restriction.Annotation = annotation;
+ continue;
+ }
+ if(level <=2 && reader.LocalName == "simpleType")
+ {
+ level = 3;
+ XmlSchemaSimpleType stype = XmlSchemaSimpleType.Read(reader,h);
+ if(stype != null)
+ restriction.baseType = stype;
+ continue;
+ }
+ if(level <= 3)
+ {
+ if(reader.LocalName == "minExclusive")
+ {
+ level = 3;
+ XmlSchemaMinExclusiveFacet minex = XmlSchemaMinExclusiveFacet.Read(reader,h);
+ if(minex != null)
+ restriction.facets.Add(minex);
+ continue;
+ }
+ else if(reader.LocalName == "minInclusive")
+ {
+ level = 3;
+ XmlSchemaMinInclusiveFacet mini = XmlSchemaMinInclusiveFacet.Read(reader,h);
+ if(mini != null)
+ restriction.facets.Add(mini);
+ continue;
+ }
+ else if(reader.LocalName == "maxExclusive")
+ {
+ level = 3;
+ XmlSchemaMaxExclusiveFacet maxex = XmlSchemaMaxExclusiveFacet.Read(reader,h);
+ if(maxex != null)
+ restriction.facets.Add(maxex);
+ continue;
+ }
+ else if(reader.LocalName == "maxInclusive")
+ {
+ level = 3;
+ XmlSchemaMaxInclusiveFacet maxi = XmlSchemaMaxInclusiveFacet.Read(reader,h);
+ if(maxi != null)
+ restriction.facets.Add(maxi);
+ continue;
+ }
+ else if(reader.LocalName == "totalDigits")
+ {
+ level = 3;
+ XmlSchemaTotalDigitsFacet total = XmlSchemaTotalDigitsFacet.Read(reader,h);
+ if(total != null)
+ restriction.facets.Add(total);
+ continue;
+ }
+ else if(reader.LocalName == "fractionDigits")
+ {
+ level = 3;
+ XmlSchemaFractionDigitsFacet fraction = XmlSchemaFractionDigitsFacet.Read(reader,h);
+ if(fraction != null)
+ restriction.facets.Add(fraction);
+ continue;
+ }
+ else if(reader.LocalName == "length")
+ {
+ level = 3;
+ XmlSchemaLengthFacet length = XmlSchemaLengthFacet.Read(reader,h);
+ if(length != null)
+ restriction.facets.Add(length);
+ continue;
+ }
+ else if(reader.LocalName == "minLength")
+ {
+ level = 3;
+ XmlSchemaMinLengthFacet minlen = XmlSchemaMinLengthFacet.Read(reader,h);
+ if(minlen != null)
+ restriction.facets.Add(minlen);
+ continue;
+ }
+ else if(reader.LocalName == "maxLength")
+ {
+ level = 3;
+ XmlSchemaMaxLengthFacet maxlen = XmlSchemaMaxLengthFacet.Read(reader,h);
+ if(maxlen != null)
+ restriction.facets.Add(maxlen);
+ continue;
+ }
+ else if(reader.LocalName == "enumeration")
+ {
+ level = 3;
+ XmlSchemaEnumerationFacet enumeration = XmlSchemaEnumerationFacet.Read(reader,h);
+ if(enumeration != null)
+ restriction.facets.Add(enumeration);
+ continue;
+ }
+ else if(reader.LocalName == "whiteSpace")
+ {
+ level = 3;
+ XmlSchemaWhiteSpaceFacet ws = XmlSchemaWhiteSpaceFacet.Read(reader,h);
+ if(ws != null)
+ restriction.facets.Add(ws);
+ continue;
+ }
+ else if(reader.LocalName == "pattern")
+ {
+ level = 3;
+ XmlSchemaPatternFacet pattern = XmlSchemaPatternFacet.Read(reader,h);
+ if(pattern != null)
+ restriction.facets.Add(pattern);
+ continue;
+ }
+ }
+ if(level <= 4)
+ {
+ if(reader.LocalName == "attribute")
+ {
+ level = 4;
+ XmlSchemaAttribute attr = XmlSchemaAttribute.Read(reader,h);
+ if(attr != null)
+ restriction.Attributes.Add(attr);
+ continue;
+ }
+ if(reader.LocalName == "attributeGroup")
+ {
+ level = 4;
+ XmlSchemaAttributeGroupRef attr = XmlSchemaAttributeGroupRef.Read(reader,h);
+ if(attr != null)
+ restriction.attributes.Add(attr);
+ continue;
+ }
+ }
+ if(level <= 5 && reader.LocalName == "anyAttribute")
+ {
+ level = 6;
+ XmlSchemaAnyAttribute anyattr = XmlSchemaAnyAttribute.Read(reader,h);
+ if(anyattr != null)
+ restriction.AnyAttribute = anyattr;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return restriction;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
new file mode 100755
index 00000000000..81007f59a63
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
@@ -0,0 +1,237 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleType.
+ /// </summary>
+ public class XmlSchemaSimpleType : XmlSchemaType
+ {
+ private XmlSchemaSimpleTypeContent content;
+ //compilation vars
+ internal bool islocal = true; // Assuming local means we have to specify islocal=false only in XmlSchema
+ private static string xmlname = "simpleType";
+
+ public XmlSchemaSimpleType()
+ {
+ }
+
+ [XmlElement("restriction",typeof(XmlSchemaSimpleTypeRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("list",typeof(XmlSchemaSimpleTypeList),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("union",typeof(XmlSchemaSimpleTypeUnion),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleTypeContent Content
+ {
+ get{ return content; }
+ set{ content = value; }
+ }
+
+ /// <remarks>
+ /// For a simple Type:
+ /// 1. Content must be present
+ /// 2. id if present, must have be a valid ID
+ /// a) If the simpletype is local
+ /// 1- are from <xs:complexType name="simpleType"> and <xs:complexType name="localSimpleType">
+ /// 1. name is prohibited
+ /// 2. final is prohibited
+ /// b) If the simpletype is toplevel
+ /// 1- are from <xs:complexType name="simpleType"> and <xs:complexType name="topLevelSimpleType">
+ /// 1. name is required, type must be NCName
+ /// 2. Content is required
+ /// 3. final can have values : #all | (list | union | restriction)
+ /// 4. If final is set, finalResolved is same as final (but within the values of b.3)
+ /// 5. If final is not set, the finalDefault of the schema (ie. only #all and restriction)
+ /// 6. Base type is:
+ /// 4.1 If restriction is chosen,the base type of restriction or elements
+ /// 4.2 otherwise simple ur-type
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ if(this.islocal) // a
+ {
+ if(this.Name != null) // a.1
+ error(h,"Name is prohibited in a local simpletype");
+ if(this.Final != XmlSchemaDerivationMethod.None) //a.2
+ error(h,"Final is prohibited in a local simpletype");
+ }
+ else //b
+ {
+ if(this.Name == null) //b.1
+ error(h,"Name is required in top level simpletype");
+ else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2
+ error(h,"name attribute of a simpleType must be NCName");
+ else
+ this.qName = new XmlQualifiedName(this.Name,info.TargetNamespace);
+
+ //NOTE: Although the FinalResolved can be Empty, it is not a valid value for Final
+ //DEVIATION: If an error occurs, the finaldefault is always consulted. This deviates
+ // from the way MS implementation works.
+ switch(this.Final) //b.3, b.4
+ {
+ case XmlSchemaDerivationMethod.All:
+ this.finalResolved = XmlSchemaDerivationMethod.All;
+ break;
+ case XmlSchemaDerivationMethod.List:
+ this.finalResolved = XmlSchemaDerivationMethod.List;
+ break;
+ case XmlSchemaDerivationMethod.Union:
+ this.finalResolved = XmlSchemaDerivationMethod.Union;
+ break;
+ case XmlSchemaDerivationMethod.Restriction:
+ this.finalResolved = XmlSchemaDerivationMethod.Restriction;
+ break;
+ default:
+ error(h,"The value of final attribute is not valid for simpleType");
+ goto case XmlSchemaDerivationMethod.None;
+ // use assignment from finaldefault on schema.
+ case XmlSchemaDerivationMethod.None: // b.5
+ if(info.FinalDefault == XmlSchemaDerivationMethod.All)
+ finalResolved = XmlSchemaDerivationMethod.All;
+ else
+ finalResolved = info.FinalDefault & (XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.List |
+ XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Union );
+ break;
+ }
+ }
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ if(this.Content == null) //a.3,b.2
+ error(h,"Content is required in a simpletype");
+ else if(Content is XmlSchemaSimpleTypeRestriction)
+ {
+ errorCount += ((XmlSchemaSimpleTypeRestriction)Content).Compile(h,info);
+ }
+ else if(Content is XmlSchemaSimpleTypeList)
+ {
+ errorCount += ((XmlSchemaSimpleTypeList)Content).Compile(h,info);
+ }
+ else if(Content is XmlSchemaSimpleTypeUnion)
+ {
+ errorCount += ((XmlSchemaSimpleTypeUnion)Content).Compile(h,info);
+ }
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ if(isCompiled)
+ return errorCount;
+
+ return errorCount;
+ }
+
+ //<simpleType
+ // final = (#all | (list | union | restriction))
+ // id = ID
+ // name = NCName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (restriction | list | union))
+ //</simpleType>
+ internal static XmlSchemaSimpleType Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleType stype = new XmlSchemaSimpleType();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaGroup.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ stype.LineNumber = reader.LineNumber;
+ stype.LinePosition = reader.LinePosition;
+ stype.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "final")
+ {
+ Exception innerex;
+ stype.Final = XmlSchemaUtil.ReadDerivationAttribute(reader, out innerex, "final");
+ if(innerex != null)
+ error(h, "some invalid values not a valid value for final", innerex);
+ }
+ else if(reader.Name == "id")
+ {
+ stype.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ stype.Name = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for simpleType",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,stype);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return stype;
+
+ // Content: (annotation?, (restriction | list | union))
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleType.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ stype.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2)
+ {
+ if(reader.LocalName == "restriction")
+ {
+ level = 3;
+ XmlSchemaSimpleTypeRestriction restriction = XmlSchemaSimpleTypeRestriction.Read(reader,h);
+ if(restriction != null)
+ stype.content = restriction;
+ continue;
+ }
+ if(reader.LocalName == "list")
+ {
+ level = 3;
+ XmlSchemaSimpleTypeList list = XmlSchemaSimpleTypeList.Read(reader,h);
+ if(list != null)
+ stype.content = list;
+ continue;
+ }
+ if(reader.LocalName == "union")
+ {
+ level = 3;
+ XmlSchemaSimpleTypeUnion union = XmlSchemaSimpleTypeUnion.Read(reader,h);
+ if(union != null)
+ stype.content = union;
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return stype;
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
new file mode 100755
index 00000000000..6068361768c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
@@ -0,0 +1,17 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeContent.
+ /// </summary>
+ public abstract class XmlSchemaSimpleTypeContent : XmlSchemaAnnotated
+ {
+ protected XmlSchemaSimpleTypeContent()
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
new file mode 100755
index 00000000000..dea8741a540
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
@@ -0,0 +1,152 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeList.
+ /// </summary>
+ public class XmlSchemaSimpleTypeList : XmlSchemaSimpleTypeContent
+ {
+ private XmlSchemaSimpleType itemType;
+ private XmlQualifiedName itemTypeName;
+ private static string xmlname = "list";
+
+ public XmlSchemaSimpleTypeList()
+ {
+ this.ItemTypeName = XmlQualifiedName.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("itemType")]
+ public XmlQualifiedName ItemTypeName
+ {
+ get{ return itemTypeName; }
+ set
+ {
+ itemTypeName = value;
+ }
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType ItemType
+ {
+ get{ return itemType; }
+ set
+ {
+ itemType = value;
+ }
+ }
+ /// <remarks>
+ /// 1. One of itemType or a <simpleType> must be present, but not both.
+ /// 2. id must be of type ID
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ if(ItemType != null && !ItemTypeName.IsEmpty)
+ error(h, "both itemType and simpletype can't be present");
+ if(ItemType == null && ItemTypeName.IsEmpty)
+ error(h, "one of itemType or simpletype must be present");
+ if(ItemType != null)
+ {
+ errorCount += ItemType.Compile(h,info);
+ }
+ if(!XmlSchemaUtil.CheckQName(ItemTypeName))
+ error(h,"BaseTypeName must be a XmlQualifiedName");
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<list
+ // id = ID
+ // itemType = QName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (simpleType?))
+ //</list>
+ internal static XmlSchemaSimpleTypeList Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleTypeList list = new XmlSchemaSimpleTypeList();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaSimpleTypeList.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ list.LineNumber = reader.LineNumber;
+ list.LinePosition = reader.LinePosition;
+ list.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ list.Id = reader.Value;
+ }
+ else if(reader.Name == "itemType")
+ {
+ Exception innerex;
+ list.ItemTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for itemType attribute",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for list",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,list);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return list;
+ // Content: annotation?, simpleType?
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleTypeList.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ list.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2 && reader.LocalName == "simpleType")
+ {
+ level = 3;
+ XmlSchemaSimpleType stype = XmlSchemaSimpleType.Read(reader,h);
+ if(stype != null)
+ list.itemType = stype;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return list;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
new file mode 100755
index 00000000000..b3f78b77129
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
@@ -0,0 +1,267 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeRestriction.
+ /// </summary>
+ public class XmlSchemaSimpleTypeRestriction : XmlSchemaSimpleTypeContent
+ {
+ private XmlSchemaSimpleType baseType;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaObjectCollection facets;
+ private static string xmlname = "restriction";
+
+ public XmlSchemaSimpleTypeRestriction()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ facets = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType BaseType
+ {
+ get{ return baseType; }
+ set{ baseType = value; }
+ }
+
+ [XmlElement("minExclusive",typeof(XmlSchemaMinExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minInclusive",typeof(XmlSchemaMinInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxExclusive",typeof(XmlSchemaMaxExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxInclusive",typeof(XmlSchemaMaxInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("totalDigits",typeof(XmlSchemaTotalDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("fractionDigits",typeof(XmlSchemaFractionDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("length",typeof(XmlSchemaLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minLength",typeof(XmlSchemaMinLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxLength",typeof(XmlSchemaMaxLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("enumeration",typeof(XmlSchemaEnumerationFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("whiteSpace",typeof(XmlSchemaWhiteSpaceFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("pattern",typeof(XmlSchemaPatternFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Facets
+ {
+ get{ return facets; }
+ }
+
+ /// <remarks>
+ /// 1. One of base or simpletype must be present but not both
+ /// 2. id must be a valid ID
+ /// 3. base must be a valid QName *NO CHECK REQUIRED*
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ if(this.baseType != null && !this.BaseTypeName.IsEmpty)
+ error(h, "both base and simpletype can't be set");
+ if(this.baseType == null && this.BaseTypeName.IsEmpty)
+ error(h, "one of basetype or simpletype must be present");
+ if(this.baseType != null)
+ {
+ errorCount += this.baseType.Compile(h,info);
+ }
+ if(!XmlSchemaUtil.CheckQName(BaseTypeName))
+ error(h,"BaseTypeName must be a XmlQualifiedName");
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<restriction
+ // base = QName
+ // id = ID
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
+ //</restriction>
+ internal static XmlSchemaSimpleTypeRestriction Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaSimpleTypeRestriction.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ restriction.LineNumber = reader.LineNumber;
+ restriction.LinePosition = reader.LinePosition;
+ restriction.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ restriction.Id = reader.Value;
+ }
+ else if(reader.Name == "base")
+ {
+ Exception innerex;
+ restriction.baseTypeName = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for base attribute",innerex);
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for restriction",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,restriction);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return restriction;
+
+ // Content: annotation?, simpleType?, (minExclusive |. .. | pattern)*
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleTypeRestriction.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ restriction.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2 && reader.LocalName == "simpleType")
+ {
+ level = 3;
+ XmlSchemaSimpleType stype = XmlSchemaSimpleType.Read(reader,h);
+ if(stype != null)
+ restriction.baseType = stype;
+ continue;
+ }
+ if(level <= 3)
+ {
+ if(reader.LocalName == "minExclusive")
+ {
+ level = 3;
+ XmlSchemaMinExclusiveFacet minex = XmlSchemaMinExclusiveFacet.Read(reader,h);
+ if(minex != null)
+ restriction.facets.Add(minex);
+ continue;
+ }
+ else if(reader.LocalName == "minInclusive")
+ {
+ level = 3;
+ XmlSchemaMinInclusiveFacet mini = XmlSchemaMinInclusiveFacet.Read(reader,h);
+ if(mini != null)
+ restriction.facets.Add(mini);
+ continue;
+ }
+ else if(reader.LocalName == "maxExclusive")
+ {
+ level = 3;
+ XmlSchemaMaxExclusiveFacet maxex = XmlSchemaMaxExclusiveFacet.Read(reader,h);
+ if(maxex != null)
+ restriction.facets.Add(maxex);
+ continue;
+ }
+ else if(reader.LocalName == "maxInclusive")
+ {
+ level = 3;
+ XmlSchemaMaxInclusiveFacet maxi = XmlSchemaMaxInclusiveFacet.Read(reader,h);
+ if(maxi != null)
+ restriction.facets.Add(maxi);
+ continue;
+ }
+ else if(reader.LocalName == "totalDigits")
+ {
+ level = 3;
+ XmlSchemaTotalDigitsFacet total = XmlSchemaTotalDigitsFacet.Read(reader,h);
+ if(total != null)
+ restriction.facets.Add(total);
+ continue;
+ }
+ else if(reader.LocalName == "fractionDigits")
+ {
+ level = 3;
+ XmlSchemaFractionDigitsFacet fraction = XmlSchemaFractionDigitsFacet.Read(reader,h);
+ if(fraction != null)
+ restriction.facets.Add(fraction);
+ continue;
+ }
+ else if(reader.LocalName == "length")
+ {
+ level = 3;
+ XmlSchemaLengthFacet length = XmlSchemaLengthFacet.Read(reader,h);
+ if(length != null)
+ restriction.facets.Add(length);
+ continue;
+ }
+ else if(reader.LocalName == "minLength")
+ {
+ level = 3;
+ XmlSchemaMinLengthFacet minlen = XmlSchemaMinLengthFacet.Read(reader,h);
+ if(minlen != null)
+ restriction.facets.Add(minlen);
+ continue;
+ }
+ else if(reader.LocalName == "maxLength")
+ {
+ level = 3;
+ XmlSchemaMaxLengthFacet maxlen = XmlSchemaMaxLengthFacet.Read(reader,h);
+ if(maxlen != null)
+ restriction.facets.Add(maxlen);
+ continue;
+ }
+ else if(reader.LocalName == "enumeration")
+ {
+ level = 3;
+ XmlSchemaEnumerationFacet enumeration = XmlSchemaEnumerationFacet.Read(reader,h);
+ if(enumeration != null)
+ restriction.facets.Add(enumeration);
+ continue;
+ }
+ else if(reader.LocalName == "whiteSpace")
+ {
+ level = 3;
+ XmlSchemaWhiteSpaceFacet ws = XmlSchemaWhiteSpaceFacet.Read(reader,h);
+ if(ws != null)
+ restriction.facets.Add(ws);
+ continue;
+ }
+ else if(reader.LocalName == "pattern")
+ {
+ level = 3;
+ XmlSchemaPatternFacet pattern = XmlSchemaPatternFacet.Read(reader,h);
+ if(pattern != null)
+ restriction.facets.Add(pattern);
+ continue;
+ }
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return restriction;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
new file mode 100755
index 00000000000..f6279ad6bf3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
@@ -0,0 +1,175 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeUnion.
+ /// </summary>
+ public class XmlSchemaSimpleTypeUnion : XmlSchemaSimpleTypeContent
+ {
+ private XmlSchemaObjectCollection baseTypes;
+ private XmlQualifiedName[] memberTypes;
+ private static string xmlname = "union";
+
+ public XmlSchemaSimpleTypeUnion()
+ {
+ baseTypes = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection BaseTypes
+ {
+ get{ return baseTypes; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("memberTypes")]
+ public XmlQualifiedName[] MemberTypes
+ {
+ get{ return memberTypes; }
+ set{ memberTypes = value; }
+ }
+ /// <remarks>
+ /// 1. Circular union type definition is disallowed. (WTH is this?)
+ /// 2. id must be a valid ID
+ /// </remarks>
+ [MonoTODO]
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ errorCount = 0;
+
+ int count = BaseTypes.Count;
+
+ foreach(XmlSchemaObject obj in baseTypes)
+ {
+ if(obj != null && obj is XmlSchemaSimpleType)
+ {
+ XmlSchemaSimpleType stype = (XmlSchemaSimpleType) obj;
+ errorCount += stype.Compile(h,info);
+ }
+ else
+ {
+ error(h, "baseTypes can't have objects other than a simpletype");
+ }
+ }
+
+ if(memberTypes!=null)
+ {
+ for(int i=0; i< memberTypes.Length; i++)
+ {
+ if(memberTypes[i] == null || !XmlSchemaUtil.CheckQName(MemberTypes[i]))
+ {
+ warn(h,"Invalid membertype");
+ memberTypes[i] = XmlQualifiedName.Empty;
+ }
+ else
+ {
+ count += MemberTypes.Length;
+ }
+ }
+ }
+
+ if(count == 0)
+ error(h, "Atleast one simpletype or membertype must be present");
+
+ XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);
+
+ return errorCount;
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+ //<union
+ // id = ID
+ // memberTypes = List of QName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (simpleType*))
+ //</union>
+ internal static XmlSchemaSimpleTypeUnion Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaSimpleTypeUnion union = new XmlSchemaSimpleTypeUnion();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaSimpleTypeUnion.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ union.LineNumber = reader.LineNumber;
+ union.LinePosition = reader.LinePosition;
+ union.SourceUri = reader.BaseURI;
+
+ //Read Attributes
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ union.Id = reader.Value;
+ }
+ else if(reader.Name == "memberTypes")
+ {
+ Exception innerEx;
+ string[] names = XmlSchemaUtil.SplitList(reader.Value);
+ union.memberTypes = new XmlQualifiedName[names.Length];
+ for(int i=0;i<names.Length;i++)
+ {
+ union.memberTypes[i] = XmlSchemaUtil.ToQName(reader,names[i],out innerEx);
+ if(innerEx != null)
+ error(h,"'"+names[i] + "' is not a valid memberType",innerEx);
+ }
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for union",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,union);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return union;
+
+ // Content: annotation?, simpleType*
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaSimpleTypeUnion.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ union.Annotation = annotation;
+ continue;
+ }
+ if(level <=2 && reader.LocalName == "simpleType")
+ {
+ level = 2;
+ XmlSchemaSimpleType stype = XmlSchemaSimpleType.Read(reader,h);
+ if(stype != null)
+ union.baseTypes.Add(stype);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return union;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
new file mode 100755
index 00000000000..d7ef688b549
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
@@ -0,0 +1,96 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaTotalDigitsFacet.
+ /// </summary>
+ public class XmlSchemaTotalDigitsFacet : XmlSchemaNumericFacet
+ {
+ private static string xmlname = "totalDigits";
+
+ public XmlSchemaTotalDigitsFacet()
+ {
+ }
+ //<totalDigits
+ // fixed = boolean : false
+ // id = ID
+ // value = positiveInteger
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</totalDigits>
+ internal static XmlSchemaTotalDigitsFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaTotalDigitsFacet td = new XmlSchemaTotalDigitsFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaTotalDigitsFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ td.LineNumber = reader.LineNumber;
+ td.LinePosition = reader.LinePosition;
+ td.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ td.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ td.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ td.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,td);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return td;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaTotalDigitsFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ td.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return td;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
new file mode 100755
index 00000000000..e1a24b97c17
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
@@ -0,0 +1,81 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaType.
+ /// </summary>
+ public class XmlSchemaType : XmlSchemaAnnotated
+ {
+ private object baseSchemaType;
+ private XmlSchemaDatatype datatype;
+ private XmlSchemaDerivationMethod derivedBy;
+ private XmlSchemaDerivationMethod final;
+ internal XmlSchemaDerivationMethod finalResolved;
+ private bool isMixed;
+ private string name;
+ internal XmlQualifiedName qName;
+
+ public XmlSchemaType()
+ {
+ final = XmlSchemaDerivationMethod.None;
+ qName = XmlQualifiedName.Empty;
+ }
+
+ #region Attributes
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("final")]
+ public XmlSchemaDerivationMethod Final
+ {
+ get{ return final; }
+ set{ final = value; }
+ }
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qName; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod FinalResolved
+ {
+ get{ return finalResolved; }
+ }
+ [XmlIgnore]
+ public object BaseSchemaType
+ {
+ get{ return baseSchemaType; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod DerivedBy
+ {
+ get{ return derivedBy; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDatatype Datatype
+ {
+ get{ return datatype; }
+ }
+ #endregion
+
+ #region XmlIgnore
+ [XmlIgnore]
+ public virtual bool IsMixed
+ {
+ get{ return isMixed; }
+ set{ isMixed = value; }
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
new file mode 100755
index 00000000000..bb8fd7a6e0d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
@@ -0,0 +1,126 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaUnique.
+ /// </summary>
+ public class XmlSchemaUnique : XmlSchemaIdentityConstraint
+ {
+ private static string xmlname = "unique";
+
+ public XmlSchemaUnique()
+ {
+ }
+ /// <remarks>
+ /// 1. name must be present
+ /// 2. selector and field must be present
+ /// </remarks>
+ [MonoTODO]
+ internal new int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ return base.Compile(h,info);
+ }
+
+ [MonoTODO]
+ internal int Validate(ValidationEventHandler h)
+ {
+ return errorCount;
+ }
+
+ internal new void error(ValidationEventHandler handle, string message)
+ {
+ errorCount++;
+ ValidationHandler.RaiseValidationError(handle, this, message);
+ }
+ //<unique
+ // id = ID
+ // name = NCName
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?, (selector, field+))
+ //</unique>
+ internal static XmlSchemaUnique Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaUnique unique = new XmlSchemaUnique();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaUnique.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ unique.LineNumber = reader.LineNumber;
+ unique.LinePosition = reader.LinePosition;
+ unique.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ unique.Id = reader.Value;
+ }
+ else if(reader.Name == "name")
+ {
+ unique.Name = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for unique",null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,unique);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return unique;
+
+ // Content: annotation?, selector, field+
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaUnion.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ unique.Annotation = annotation;
+ continue;
+ }
+ if(level <= 2 && reader.LocalName == "selector")
+ {
+ level = 3;
+ XmlSchemaXPath selector = XmlSchemaXPath.Read(reader,h,"selector");
+ if(selector != null)
+ unique.Selector = selector;
+ continue;
+ }
+ if(level <= 3 && reader.LocalName == "field")
+ {
+ level = 3;
+ if(unique.Selector == null)
+ error(h,"selector must be defined before field declarations",null);
+ XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");
+ if(field != null)
+ unique.Fields.Add(field);
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return unique;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs
new file mode 100755
index 00000000000..8015edd8ed2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs
@@ -0,0 +1,22 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaUse.
+ /// </summary>
+ public enum XmlSchemaUse
+ {
+ [XmlIgnore]
+ None = 0x00000000,
+ [XmlEnum("optional")]
+ Optional = 0x00000001,
+ [XmlEnum("prohibited")]
+ Prohibited = 0x00000002,
+ [XmlEnum("required")]
+ Required = 0x00000003,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs
new file mode 100755
index 00000000000..dc6a7c6a64d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs
@@ -0,0 +1,299 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// All Methods in this class should use XmlConvert. Some Methods are not present in the
+ /// MS Implementation. We should provide them.
+ /// </summary>
+ internal class XmlSchemaUtil
+ {
+ private XmlSchemaUtil()
+ {}
+
+ public static void CompileID(string id, XmlSchemaObject xso, Hashtable idCollection, ValidationEventHandler h)
+ {
+ //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#ID
+ // 1. ID must be a NCName
+ // 2. ID must be unique in the schema
+ if(id == null)
+ return;
+ if(!CheckNCName(id))
+ xso.error(h,id+" is not a valid id attribute");
+ else if(idCollection.ContainsKey(id))
+ xso.error(h,"Duplicate id attribute "+id);
+ else
+ idCollection.Add(id,xso);
+ }
+
+ [MonoTODO]
+ public static bool CheckAnyUri(string uri)
+ {
+ return true;
+ }
+
+ public static bool CheckToken(string token)
+ {
+ //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#token
+ return true;
+ }
+
+ public static bool CheckNormalizedString(string token)
+ {
+ return true;
+ }
+
+ public static bool CheckLanguage(string lang)
+ {
+ //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#language
+ return true;
+ }
+ public static bool CheckNCName(string name)
+ {
+ //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#NCName
+ try
+ {
+ XmlConvert.VerifyNCName(name);
+ return true;
+ }
+ catch(Exception ex)
+ {
+ return false;
+ }
+ }
+
+ public static bool CheckQName(XmlQualifiedName qname)
+ {
+ return true;
+ }
+ public static bool IsValidQName(string qname)
+ {
+ foreach(string part in qname.Split(new char[]{':'},2))
+ {
+ if(!CheckNCName(part))
+ return false;
+ }
+ return true;
+ }
+
+ //FIXME: First remove all the multiple instances of whitespace and then return the strings.
+ //The current method returns empty strings if there are two or more consecutive whitespaces.
+ public static string[] SplitList(string list)
+ {
+ if(list == null || list == string.Empty)
+ return new String[0];
+
+ string[] listarr = list.Split(new char[]{' ','\t','\n'});
+ int pos=0;
+ int i = 0;
+ for(i=0;i<listarr.Length;i++)
+ {
+ if(listarr[i] != null && listarr[i] != String.Empty)
+ {
+ listarr[pos++] = listarr[i];
+ }
+ }
+ if(pos == i)
+ return listarr;
+ string[] retarr = new String[pos];
+ if(pos!=0)
+ Array.Copy(listarr, retarr, pos);
+ return retarr;
+ }
+
+ public static void ReadUnhandledAttribute(XmlReader reader, XmlSchemaObject xso)
+ {
+ if(reader.Prefix == "xmlns")
+ xso.Namespaces.Add(reader.LocalName, reader.Value);
+ else if(reader.Name == "xmlns")
+ xso.Namespaces.Add("",reader.Value);
+ else
+ {
+ if(xso.unhandledAttributeList == null)
+ xso.unhandledAttributeList = new System.Collections.ArrayList();
+ XmlAttribute attr = new XmlDocument().CreateAttribute(reader.LocalName,reader.NamespaceURI);
+ attr.Value = reader.Value;
+ xso.unhandledAttributeList.Add(attr);
+ }
+ }
+
+ public static bool ReadBoolAttribute(XmlReader reader, out Exception innerExcpetion)
+ {
+ innerExcpetion = null;
+ try
+ {
+ bool val = XmlConvert.ToBoolean(reader.Value);
+ return val;
+ }
+ catch(Exception ex)
+ {
+ innerExcpetion = ex;
+ return false;
+ }
+ }
+ public static decimal ReadDecimalAttribute(XmlReader reader, out Exception innerExcpetion)
+ {
+ innerExcpetion = null;
+ try
+ {
+ decimal val = XmlConvert.ToDecimal(reader.Value);
+ return val;
+ }
+ catch(Exception ex)
+ {
+ innerExcpetion = ex;
+ return decimal.Zero;
+ }
+ }
+
+ // Is some value is read, return it.
+ // If no values return empty.
+ // If exception, return none
+ public static XmlSchemaDerivationMethod ReadDerivationAttribute(XmlReader reader, out Exception innerExcpetion, string name)
+ {
+ innerExcpetion = null;
+ try
+ {
+ string list = reader.Value;
+ string warn = "";
+ XmlSchemaDerivationMethod val = 0;
+
+ if(list.IndexOf("#all") != -1 && list.Trim() != "#all")
+ {
+ innerExcpetion = new Exception(list+" is not a valid value for "+ name +". #all if present must be the only value");
+ return XmlSchemaDerivationMethod.All;
+ }
+ foreach(string xsdm in XmlSchemaUtil.SplitList(list))
+ {
+ switch(xsdm)
+ {
+ case "":
+ val |= XmlSchemaDerivationMethod.Empty; break;
+ case "#all":
+ val |= XmlSchemaDerivationMethod.All; break;
+ case "substitution":
+ val |= XmlSchemaDerivationMethod.Substitution; break;
+ case "extension":
+ val |= XmlSchemaDerivationMethod.Extension; break;
+ case "restriction":
+ val |= XmlSchemaDerivationMethod.Restriction; break;
+ case "list":
+ val |= XmlSchemaDerivationMethod.List; break;
+ case "union":
+ val |= XmlSchemaDerivationMethod.Union; break;
+ default:
+ warn += xsdm + " "; break;
+ }
+ }
+ if(warn != "")
+ innerExcpetion = new Exception(warn + "is/are not valid values for " + name);
+ return val;
+ }
+ catch(Exception ex)
+ {
+ innerExcpetion = ex;
+ return XmlSchemaDerivationMethod.None;
+ }
+ }
+
+ public static XmlSchemaForm ReadFormAttribute(XmlReader reader, out Exception innerExcpetion)
+ {
+ innerExcpetion = null;
+ XmlSchemaForm val = XmlSchemaForm.None;
+ switch(reader.Value)
+ {
+ case "qualified":
+ val = XmlSchemaForm.Qualified; break;
+ case "unqualified":
+ val = XmlSchemaForm.Unqualified; break;
+ default:
+ innerExcpetion = new Exception("only qualified or unqulified is a valid value"); break;
+ }
+ return val;
+ }
+
+ public static XmlSchemaContentProcessing ReadProcessingAttribute(XmlReader reader, out Exception innerExcpetion)
+ {
+ innerExcpetion = null;
+ XmlSchemaContentProcessing val = XmlSchemaContentProcessing.None;
+ switch(reader.Value)
+ {
+ case "lax":
+ val = XmlSchemaContentProcessing.Lax; break;
+ case "strict":
+ val = XmlSchemaContentProcessing.Strict; break;
+ case "skip":
+ val = XmlSchemaContentProcessing.Skip; break;
+ default:
+ innerExcpetion = new Exception("only lax , strict or skip are valid values for processContents");
+ break;
+ }
+ return val;
+ }
+
+ public static XmlSchemaUse ReadUseAttribute(XmlReader reader, out Exception innerExcpetion)
+ {
+ innerExcpetion = null;
+ XmlSchemaUse val = XmlSchemaUse.None;
+ switch(reader.Value)
+ {
+ case "optional":
+ val = XmlSchemaUse.Optional; break;
+ case "prohibited":
+ val = XmlSchemaUse.Prohibited; break;
+ case "required":
+ val = XmlSchemaUse.Required; break;
+ default:
+ innerExcpetion = new Exception("only optional , prohibited or required are valid values for use");
+ break;
+ }
+ return val;
+ }
+ public static XmlQualifiedName ReadQNameAttribute(XmlReader reader, out Exception innerEx)
+ {
+ return ToQName(reader, reader.Value, out innerEx);
+ }
+
+ //While Creating a XmlQualifedName, we should check:
+ // 1. If a prefix is present, its namespace should be resolvable.
+ // 2. If a prefix is not present, and if the defaultNamespace is set,
+ public static XmlQualifiedName ToQName(XmlReader reader, string qnamestr, out Exception innerEx)
+ {
+
+ string ns;
+ string name;
+ XmlQualifiedName qname;
+ innerEx = null;
+
+ if(!IsValidQName(qnamestr))
+ {
+ innerEx = new Exception(qnamestr + " is an invalid QName. Either name or namespace is not a NCName");
+ return XmlQualifiedName.Empty;
+ }
+
+ string[] values = qnamestr.Split(new char[]{':'},2);
+
+ if(values.Length == 2)
+ {
+ ns = reader.LookupNamespace(values[0]);
+ if(ns == null)
+ {
+ innerEx = new Exception("Namespace Prefix '"+values[0]+"could not be resolved");
+ return XmlQualifiedName.Empty;
+ }
+ name = values[1];
+ }
+ else
+ {
+ //Default Namespace
+ ns = reader.LookupNamespace("");
+ name = values[0];
+ }
+
+ qname = new XmlQualifiedName(name,ns);
+ return qname;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
new file mode 100755
index 00000000000..df39caba223
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
@@ -0,0 +1,97 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaWhiteSpaceFacet.
+ /// </summary>
+ public class XmlSchemaWhiteSpaceFacet : XmlSchemaFacet
+ {
+ private static string xmlname = "whiteSpace";
+
+ public XmlSchemaWhiteSpaceFacet()
+ {
+ }
+ // <whiteSpace
+ // fixed = boolean : false
+ // id = ID
+ // value = (collapse | preserve | replace)
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ // </whiteSpace>
+ internal static XmlSchemaWhiteSpaceFacet Read(XmlSchemaReader reader, ValidationEventHandler h)
+ {
+ XmlSchemaWhiteSpaceFacet ws = new XmlSchemaWhiteSpaceFacet();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
+ {
+ error(h,"Should not happen :1: XmlSchemaWhiteSpaceFacet.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ ws.LineNumber = reader.LineNumber;
+ ws.LinePosition = reader.LinePosition;
+ ws.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ ws.Id = reader.Value;
+ }
+ else if(reader.Name == "fixed")
+ {
+ Exception innerex;
+ ws.IsFixed = XmlSchemaUtil.ReadBoolAttribute(reader,out innerex);
+ if(innerex != null)
+ error(h, reader.Value + " is not a valid value for fixed attribute",innerex);
+ }
+ else if(reader.Name == "value")
+ {
+ ws.Value = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+xmlname,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,ws);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return ws;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != xmlname)
+ error(h,"Should not happen :2: XmlSchemaWhiteSpaceFacet.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ ws.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return ws;
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
new file mode 100755
index 00000000000..8f7447e0f53
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
@@ -0,0 +1,104 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaXPath.
+ /// </summary>
+ public class XmlSchemaXPath : XmlSchemaAnnotated
+ {
+ private string xpath;
+
+ public XmlSchemaXPath()
+ {
+ }
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("xpath")]
+ public string XPath
+ {
+ get{ return xpath; }
+ set{ xpath = value; }
+ }
+
+ internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
+ {
+ XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);
+ return errorCount;
+ }
+
+ //<selector
+ // id = ID
+ // xpath = a subset of XPath expression, see below
+ // {any attributes with non-schema namespace . . .}>
+ // Content: (annotation?)
+ //</selector>
+ internal static XmlSchemaXPath Read(XmlSchemaReader reader, ValidationEventHandler h,string name)
+ {
+ XmlSchemaXPath path = new XmlSchemaXPath();
+ reader.MoveToElement();
+
+ if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != name)
+ {
+ error(h,"Should not happen :1: XmlSchemaComplexContentRestriction.Read, name="+reader.Name,null);
+ reader.Skip();
+ return null;
+ }
+
+ path.LineNumber = reader.LineNumber;
+ path.LinePosition = reader.LinePosition;
+ path.SourceUri = reader.BaseURI;
+
+ while(reader.MoveToNextAttribute())
+ {
+ if(reader.Name == "id")
+ {
+ path.Id = reader.Value;
+ }
+ else if(reader.Name == "xpath")
+ {
+ path.xpath = reader.Value;
+ }
+ else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
+ {
+ error(h,reader.Name + " is not a valid attribute for "+name,null);
+ }
+ else
+ {
+ XmlSchemaUtil.ReadUnhandledAttribute(reader,path);
+ }
+ }
+
+ reader.MoveToElement();
+ if(reader.IsEmptyElement)
+ return path;
+
+ // Content: (annotation?)
+ int level = 1;
+ while(reader.ReadNextElement())
+ {
+ if(reader.NodeType == XmlNodeType.EndElement)
+ {
+ if(reader.LocalName != name)
+ error(h,"Should not happen :2: XmlSchemaXPath.Read, name="+reader.Name,null);
+ break;
+ }
+ if(level <= 1 && reader.LocalName == "annotation")
+ {
+ level = 2; //Only one annotation
+ XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
+ if(annotation != null)
+ path.Annotation = annotation;
+ continue;
+ }
+ reader.RaiseInvalidElementError();
+ }
+ return path;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs
new file mode 100755
index 00000000000..f16d15967e8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs
@@ -0,0 +1,15 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSeverityType.
+ /// </summary>
+ public enum XmlSeverityType
+ {
+ Error = 0x00000000,
+ Warning = 0x00000001,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs b/mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
new file mode 100755
index 00000000000..3b1d98de2dd
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -0,0 +1,143 @@
+2003-01-16 Ajay kumar Dwivedi <adwiv@yahoo.com>
+ * XmlSerializer.cs: Array serialization for 1D arrays works
+ * TypeTranslator: Added for translations`
+
+2002-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlCustomFormatter.cs: finished.
+ * XmlSerializationReader.cs: implemented some more methods.
+
+2002-09-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlSerializationReader.cs: implemented a few methods.
+
+ * XmlAnyElementAttribute.cs:
+ * XmlArrayAttribute.cs:
+ * XmlChoiceIdentifierAttribute.cs:
+ * XmlElementAttribute.cs:
+ * XmlMemberMapping.cs:
+ * XmlMembersMapping.cs: class status based fixes.
+
+2002-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CodeIdentifiers.cs:
+ * XmlSchemaExporter.cs:
+ * XmlSchemaImporter.cs:
+ * XmlSchemas.cs:
+ * XmlSerializationWriteCallback.cs:
+ * XmlSerializationWriter.cs:
+ * XmlSerializer.cs:
+ * XmlSerializerNamespaces.cs: some class status based fixed and
+ implemented a couple of methods.
+
+ * SoapSchemaExporter.cs: stubbed out.
+
+2002-08-24 Tim Coleman <tim@timcoleman.com>
+ * SoapCodeExporter.cs:
+ Fix return value of ExportTypeMapping.
+ * XmlCustomFormatter.cs:
+ Change methods to be internal instead of public.
+ * XmlSerializationWriter.cs:
+ Modify GetPrimitiveTypeName to build on linux.
+ Modify GetQualifiedName to return an incrementing prefix
+ instead of the same one all the time (still need to manage
+ conflicts)
+ Modify WriteElementString to only do special stuff is XsiType
+ is not defined.
+ Modify WriteTypedPrimitive to use FromXmlQualifiedName if it's
+ an XmlQualifiedName.
+
+2002-08-22 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializationReader.cs:
+ Some implementation
+ * XmlSerializationWriter.cs:
+ More implementation
+ * XmlCustomFormatter.cs:
+ Implemented this class.
+
+2002-08-20 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializationWriter.cs:
+ Some implementation.
+
+2002-08-19 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializer.cs:
+ New stubs added.
+ * XmlSerializationWriter.cs:
+ New stubs added.
+
+2002-08-14 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializer.cs:
+ More reformatting of source code so I can
+ better understand what it does.
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializer.cs:
+ Some reformatting of code for readability.
+ Modify to correctly serialize ICollection objects
+ such as the BindingCollection of a ServiceDescription
+ for example.
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializer.cs:
+ Changed Implements() to check based on name rather
+ than FullName. FullName was never working correctly.
+
+2002-07-26 Tim Coleman <tim@timcoleman.com>
+ * XmlSerializer.cs:
+ The constructor now looks for an XmlRootAttribute attribute
+ if one is not passed in. Various changes to make it emit
+ proper XML, such as handling an element without a namespace
+ prefix, and using WriteEndDocument where it should be.
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * CodeIdentifier.cs:
+ * IXmlSerializable.cs:
+ * XmlSerializationCollectionFixupCallback.cs:
+ * XmlSerializationFixupCallback.cs:
+ * XmlSerializationReadCallback.cs:
+ * XmlSerializationReader.cs:
+ * XmlSerializationWriteCallback.cs:
+ Add new classes.
+ * XmlSchemas.cs
+ * CodeIdentifiers.cs:
+ Implement some of these classes
+ * XmlCodeExporter.cs:
+ Fix return type of a function
+
+2002-07-24 Tim Coleman <tim@timcoleman.com>
+ * SoapReflectionImporter.cs:
+ New class added to build
+ System.Web.Services.Description.ServiceDescription.cs
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * CodeIdentifiers.cs:
+ * SoapCodeExporter.cs:
+ * SoapSchemaExporter.cs:
+ * XmlCodeExporter.cs:
+ * XmlMemberMapping.cs:
+ * XmlMembersMapping.cs:
+ * XmlReflectionImporter.cs:
+ * XmlReflectionMember.cs:
+ * XmlSchemaExporter.cs:
+ * XmlSchemaImporter.cs:
+ * XmlSchemas.cs:
+ New stubbs added to aid in the linux build of
+ System.Web.Services.
+
+2002-07-05 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlSeriailizer: Serialize method can serialize XmlSchema perfectly.
+
+ * XmlSerializerNamespaces: Reverted to use of a single Hashtable.
+
+2002-07-02 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlSeriailizer: Updated Serialize() method.
+
+2002-06-27 Ajay kumar Dwivedi <adwiv@yahoo.com>
+ * XmlSerializer: Serialize() method Partially Implemented.
+
+2002-06-20 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * Soap & XmlOverrides: Implemented using TypeMember as key with
+ suggestions from Rafael.
diff --git a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs
new file mode 100644
index 00000000000..94a532b402b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs
@@ -0,0 +1,50 @@
+//
+// System.Xml.Serialization.CodeIdentifier.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Xml.Serialization {
+ public class CodeIdentifier {
+
+ public CodeIdentifier ()
+ {
+ }
+
+ public static string MakeCamel (string identifier)
+ {
+ string validIdentifier = MakeValid (identifier);
+ return (Char.ToLower (validIdentifier[0]) + validIdentifier.Substring (1));
+ }
+
+ public static string MakePascal (string identifier)
+ {
+ string validIdentifier = MakeValid (identifier);
+ return (Char.ToUpper (validIdentifier[0]) + validIdentifier.Substring (1));
+ }
+
+ public static string MakeValid (string identifier)
+ {
+ if (identifier == null)
+ throw new NullReferenceException ();
+ if (identifier.Length == 0)
+ return identifier;
+
+ string output = "";
+
+ if (Char.IsNumber (identifier[0]))
+ output = "Item";
+
+ foreach (char c in identifier)
+ if (Char.IsLetterOrDigit (c) || c == '_')
+ output += c;
+
+ return output;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs
new file mode 100644
index 00000000000..0cd713946c8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs
@@ -0,0 +1,110 @@
+//
+// System.Xml.Serialization.CodeIdentifiers
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml.Serialization {
+ public class CodeIdentifiers {
+
+ #region Fields
+
+ bool useCamelCasing;
+ Hashtable table = new Hashtable ();
+ Hashtable reserved = new Hashtable ();
+
+ #endregion
+
+ #region Constructors
+
+ public CodeIdentifiers ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool UseCamelCasing {
+ get { return useCamelCasing; }
+ set { useCamelCasing = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public void Add (string identifier, object value)
+ {
+ table.Add (identifier, value);
+ }
+
+ public void AddReserved (string identifier)
+ {
+ reserved.Add (identifier, identifier);
+ }
+
+ public string AddUnique (string identifier, object value)
+ {
+ string unique = MakeUnique (identifier);
+ Add (unique, value);
+ return unique;
+ }
+
+ public void Clear ()
+ {
+ table.Clear ();
+ }
+
+ public bool IsInUse (string identifier)
+ {
+ return (table.ContainsKey (identifier) || reserved.ContainsKey (identifier));
+ }
+
+ public string MakeRightCase (string identifier)
+ {
+ if (UseCamelCasing)
+ return CodeIdentifier.MakeCamel (identifier);
+ else
+ return CodeIdentifier.MakePascal (identifier);
+ }
+
+ public string MakeUnique (string identifier)
+ {
+ string uniqueIdentifier = identifier;
+ int i = 1;
+
+ while (IsInUse (uniqueIdentifier)) {
+ uniqueIdentifier = String.Format ("{0}{1}", identifier, i.ToString ());
+ i += 1;
+ }
+
+ return uniqueIdentifier;
+ }
+
+ public void Remove (string identifier)
+ {
+ table.Remove (identifier);
+ }
+
+ public void RemoveReserved (string identifier)
+ {
+ reserved.Remove (identifier);
+ }
+
+ public object ToArray (Type type)
+ {
+ Array list = Array.CreateInstance (type, table.Count);
+ table.CopyTo (list, 0);
+ return list;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs b/mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs
new file mode 100644
index 00000000000..3aa7f785e69
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs
@@ -0,0 +1,19 @@
+//
+// System.Xml.Serialization.IXmlSerializable.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml.Schema;
+
+namespace System.Xml.Serialization {
+ public interface IXmlSerializable {
+
+ XmlSchema GetSchema ();
+ void ReadXml (XmlReader reader);
+ void WriteXml (XmlWriter writer);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SchemaTypes.cs b/mcs/class/System.XML/System.Xml.Serialization/SchemaTypes.cs
new file mode 100644
index 00000000000..5110eb15910
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SchemaTypes.cs
@@ -0,0 +1,23 @@
+//
+// System.Xml.Serialization.SchemaTypes
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Xml.Serialization
+{
+ internal enum SchemaTypes {
+ NotSet = 0,
+ Primitive,
+ Enum,
+ Array,
+ Class,
+ DataSet,
+ XmlNode,
+ Void
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs
new file mode 100644
index 00000000000..71311673741
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs
@@ -0,0 +1,61 @@
+//
+// SoapAttributeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapAttributeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class SoapAttributeAttribute : Attribute
+ {
+ private string attrName;
+ private string dataType;
+ private string ns;
+
+ public SoapAttributeAttribute ()
+ {
+ }
+
+ public SoapAttributeAttribute (string attrName)
+ {
+ AttributeName = attrName;
+ }
+
+ public string AttributeName {
+ get {
+ return attrName;
+ }
+ set {
+ attrName = value;
+ }
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs
new file mode 100644
index 00000000000..dcbbca6bcb7
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs
@@ -0,0 +1,72 @@
+//
+// SoapAttributeOverrides.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public class SoapAttributeOverrides
+ {
+ /// <summary>
+ /// This class requires to store SoapAttrributes indexed by a key containg
+ /// both Type and Member Name. There are 3 approaches to this IMO.
+ /// 1. Make the key as "FullTypeName..MemberName", with ".." seperating Type and Member.
+ /// 2. Use a jagged 2D hashtable. The main hashtable is indexed by Type and each value
+ /// contains another hashtable which is indexed by member names. (Too many hashtables)
+ /// 3. Use a new class which emcompasses the Type and MemberName. An implementation is there
+ /// in TypeMember class in this namespace. (Too many instantiations of the class needed)
+ ///
+ /// Method 1 is the most elegent, but I am not sure if the seperator is language insensitive.
+ /// What if someone writes a language which allows . in the member names.
+ /// </summary>
+ ///
+ private Hashtable overrides;
+
+ public SoapAttributeOverrides ()
+ {
+ overrides = new Hashtable();
+ }
+
+ public SoapAttributes this [Type type]
+ {
+ get { return this [type, string.Empty]; }
+ }
+
+ public SoapAttributes this [Type type, string member]
+ {
+ get
+ {
+ return (SoapAttributes) overrides[GetKey(type,member)];
+ }
+ }
+
+ public void Add (Type type, SoapAttributes attributes)
+ {
+ Add(type, string.Empty, attributes);
+ }
+
+ public void Add (Type type, string member, SoapAttributes attributes)
+ {
+ if(overrides[GetKey(type, member)] != null)
+ throw new Exception("The attributes for the given type and Member already exist in the collection");
+
+ overrides.Add(GetKey(type,member), attributes);
+ }
+
+ private TypeMember GetKey(Type type, string member)
+ {
+ return new TypeMember(type, member);
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs
new file mode 100644
index 00000000000..786ca2921f3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs
@@ -0,0 +1,88 @@
+//
+// SoapAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Reflection;
+using System;
+using System.ComponentModel;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapAttributes.
+ /// </summary>
+ public class SoapAttributes
+ {
+ private SoapAttributeAttribute soapAttribute;
+ private object soapDefaultValue;
+ private SoapElementAttribute soapElement;
+ private SoapEnumAttribute soapEnum;
+ private bool soapIgnore;
+ private SoapTypeAttribute soapType;
+
+ public SoapAttributes ()
+ {
+ }
+
+ public SoapAttributes (ICustomAttributeProvider provider)
+ {
+ object[] attributes = provider.GetCustomAttributes(false);
+ foreach(object obj in attributes)
+ {
+ if(obj is SoapAttributeAttribute)
+ soapAttribute = (SoapAttributeAttribute) obj;
+ else if(obj is DefaultValueAttribute)
+ soapDefaultValue = obj;
+ else if(obj is SoapElementAttribute)
+ soapElement = (SoapElementAttribute) obj;
+ else if(obj is SoapEnumAttribute)
+ soapEnum = (SoapEnumAttribute) obj;
+ else if(obj is SoapIgnoreAttribute)
+ soapIgnore = true;
+ else if(obj is SoapTypeAttribute)
+ soapType = (SoapTypeAttribute) obj;
+ }
+ }
+
+ public SoapAttributeAttribute SoapAttribute
+ {
+ get { return soapAttribute; }
+ set { soapAttribute = value; }
+ }
+
+ public object SoapDefaultValue
+ {
+ get { return soapDefaultValue; }
+ set { soapDefaultValue = value; }
+ }
+
+ public SoapElementAttribute SoapElement
+ {
+ get { return soapElement; }
+ set { soapElement = value; }
+ }
+
+ public SoapEnumAttribute SoapEnum
+ {
+ get { return soapEnum; }
+ set { soapEnum = value; }
+ }
+
+ public bool SoapIgnore
+ {
+ get { return soapIgnore; }
+ set { soapIgnore = value; }
+ }
+
+ public SoapTypeAttribute SoapType
+ {
+ get { return soapType; }
+ set { soapType = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs
new file mode 100644
index 00000000000..6c25de9e392
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs
@@ -0,0 +1,75 @@
+//
+// System.Xml.Serialization.SoapCodeExporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom;
+
+namespace System.Xml.Serialization {
+ public class SoapCodeExporter {
+
+ #region Fields
+
+ CodeNamespace codeNamespace;
+ CodeCompileUnit codeCompileUnit;
+ CodeAttributeDeclarationCollection includeMetadata;
+
+ #endregion
+
+ #region Constructors
+
+ public SoapCodeExporter (CodeNamespace codeNamespace)
+ {
+ includeMetadata = new CodeAttributeDeclarationCollection ();
+ this.codeNamespace = codeNamespace;
+ }
+
+ public SoapCodeExporter (CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit)
+ : this (codeNamespace)
+ {
+ this.codeCompileUnit = codeCompileUnit;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public CodeAttributeDeclarationCollection IncludeMetadata {
+ get { return includeMetadata; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlMemberMapping member)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlMemberMapping member, bool forceUseMemberName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs
new file mode 100644
index 00000000000..fbb6527e821
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs
@@ -0,0 +1,60 @@
+//
+// SoapElementAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapElementAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class SoapElementAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private bool isNullable;
+
+ public SoapElementAttribute ()
+ {
+ }
+ public SoapElementAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+
+ public string ElementName {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+
+ public bool IsNullable {
+ get {
+ return isNullable;
+ }
+ set {
+ isNullable = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs
new file mode 100644
index 00000000000..fba4f311126
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs
@@ -0,0 +1,40 @@
+//
+// SoapEnumAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapEnumAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Field)]
+ public class SoapEnumAttribute : Attribute
+ {
+ private string name;
+
+ public SoapEnumAttribute ()
+ {
+ }
+
+ public SoapEnumAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs
new file mode 100644
index 00000000000..52798f1dd30
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs
@@ -0,0 +1,25 @@
+//
+// SoapIgnoreAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapIgnoreAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class SoapIgnoreAttribute : Attribute
+ {
+ public SoapIgnoreAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs
new file mode 100644
index 00000000000..aaf3e29d03c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs
@@ -0,0 +1,38 @@
+//
+// SoapIncludeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapIncludeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Method)]
+ public class SoapIncludeAttribute : Attribute
+ {
+ private Type type;
+
+ public SoapIncludeAttribute( Type type)
+ {
+ Type = type;
+ }
+
+ public Type Type
+ {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs
new file mode 100644
index 00000000000..11c2b5926c2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs
@@ -0,0 +1,90 @@
+//
+// System.Xml.Serialization.SoapReflectionImporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Reflection;
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ public class SoapReflectionImporter {
+
+ #region Constructors
+
+ [MonoTODO]
+ public SoapReflectionImporter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SoapReflectionImporter (SoapAttributeOverrides attributeOverrides)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SoapReflectionImporter (string defaultNamespace)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SoapReflectionImporter (SoapAttributeOverrides attributeOverrides, string defaultNamespace)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors, bool validate)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTypeMapping ImportTypeMapping (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTypeMapping ImportTypeMapping (Type type, string defaultNamespace)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void IncludeType (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void IncludeTypes (ICustomAttributeProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs
new file mode 100644
index 00000000000..f11cbe45d47
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs
@@ -0,0 +1,42 @@
+//
+// System.Xml.Serialization.SoapSchemaExporter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ public class SoapSchemaExporter
+ {
+ [MonoTODO]
+ public SoapSchemaExporter (XmlSchemas schemas)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping,
+ bool exportEnclosingType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs
new file mode 100644
index 00000000000..baafb07716d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs
@@ -0,0 +1,71 @@
+//
+// System.Xml.Serialization.SoapSchemaImporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ public class SoapSchemaImporter {
+
+ #region Fields
+
+ XmlSchemas schemas;
+ CodeIdentifiers typeIdentifiers;
+
+ #endregion
+
+ #region Constructors
+
+ public SoapSchemaImporter (XmlSchemas schemas)
+ {
+ this.schemas = schemas;
+ }
+
+ public SoapSchemaImporter (XmlSchemas schemas, CodeIdentifiers typeIdentifiers)
+ : this (schemas)
+ {
+ this.typeIdentifiers = typeIdentifiers;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public XmlTypeMapping ImportDerivedTypeMapping (XmlQualifiedName name, Type baseType, bool baseTypeCanBeIndirect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember member)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string name, string ns, SoapSchemaMember[] members, bool hasWrapperElement, Type baseType, bool baseTypeCanBeIndirect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaMember.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaMember.cs
new file mode 100644
index 00000000000..733d59c57e8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaMember.cs
@@ -0,0 +1,44 @@
+//
+// System.Xml.Serialization.SoapSchemaMember
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ public class SoapSchemaMember {
+
+ #region Fields
+
+ string memberName;
+ XmlQualifiedName memberType;
+
+ #endregion
+
+ #region Constructors
+
+ public SoapSchemaMember ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string MemberName {
+ get { return memberName; }
+ set { memberName = value; }
+ }
+
+ public XmlQualifiedName MemberType {
+ get { return memberType; }
+ set { memberType = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs
new file mode 100644
index 00000000000..d6e68934cc6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs
@@ -0,0 +1,59 @@
+//
+// SoapTypeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapTypeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface)]
+ public class SoapTypeAttribute : Attribute
+ {
+ private string ns;
+ private string typeName;
+ private bool includeInSchema = true;
+
+ public SoapTypeAttribute ()
+ {
+ }
+ public SoapTypeAttribute (string typeName)
+ {
+ TypeName = typeName;
+ }
+ public SoapTypeAttribute (string typeName, string ns)
+ {
+ TypeName = typeName;
+ Namespace = ns;
+ }
+
+ public bool IncludeInSchema
+ {
+ get { return includeInSchema; }
+ set { includeInSchema = value; }
+ }
+
+ public string Namespace {
+ get { return ns;
+ }
+ set { ns = value;
+ }
+ }
+ public string TypeName {
+ get { return typeName;
+ }
+ set { typeName = value;
+ }
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs b/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs
new file mode 100644
index 00000000000..ee9223b0b59
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs
@@ -0,0 +1,82 @@
+//
+// System.Xml.Serialization.TypeData
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ internal class TypeData
+ {
+ Type type;
+ string elementName;
+ SchemaTypes sType;
+
+ public TypeData (Type type, string elementName, bool isPrimitive)
+ {
+ this.type = type;
+ this.elementName = elementName;
+ if (isPrimitive)
+ sType = SchemaTypes.Primitive;
+ else
+ sType = SchemaTypes.NotSet;
+ }
+
+ private SchemaTypes GetSchemaType ()
+ {
+ if (type.IsEnum)
+ return SchemaTypes.Enum;
+ else if (type.IsArray)
+ return SchemaTypes.Array;
+ /*else if (type == typeof (System.Data.DataSet))
+ return SchemaTypes.DataSet;*/
+ else if (type == typeof (System.Xml.XmlNode))
+ return SchemaTypes.XmlNode;
+ return SchemaTypes.Class;
+ }
+
+ public string ElementName
+ {
+ get {
+ return elementName;
+ }
+ }
+
+ public string TypeName
+ {
+ get {
+ return type.Name;
+ }
+ }
+
+ public Type Type
+ {
+ get {
+ return type;
+ }
+ }
+
+ public string FullTypeName
+ {
+ get {
+ return type.FullName.Replace ('+', '.');
+ }
+ }
+
+ public SchemaTypes SchemaType
+ {
+ get {
+ if (sType == SchemaTypes.NotSet)
+ sType = GetSchemaType ();
+
+ return sType;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/TypeMember.cs b/mcs/class/System.XML/System.Xml.Serialization/TypeMember.cs
new file mode 100755
index 00000000000..854e31cb511
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/TypeMember.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// TypeMember is immutable class which is used as a key in a Hashtable.
+ /// </summary>
+
+ internal sealed class TypeMember
+ {
+ Type type;
+ string member;
+ internal TypeMember(Type type, string member)
+ {
+ this.type = type;
+ this.member = member;
+ }
+
+ public override int GetHashCode()
+ {
+ return unchecked (type.GetHashCode() + member.GetHashCode());
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj is TypeMember)
+ return TypeMember.Equals(this,(TypeMember)obj);
+
+ return false;
+ }
+
+ public static bool Equals(TypeMember tm1, TypeMember tm2)
+ {
+ if(Object.ReferenceEquals(tm1,tm2))
+ return true;
+ if(Object.ReferenceEquals(tm1,null) || Object.ReferenceEquals(tm2,null))
+ return false;
+ if(tm1.type == tm2.type && tm1.member == tm2.member)
+ return true;
+ return false;
+ }
+
+ public static bool operator==(TypeMember tm1, TypeMember tm2)
+ {
+ return TypeMember.Equals(tm1,tm2);
+ }
+
+ public static bool operator!=(TypeMember tm1, TypeMember tm2)
+ {
+ return !TypeMember.Equals(tm1,tm2);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs b/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs
new file mode 100644
index 00000000000..7988b342e50
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs
@@ -0,0 +1,53 @@
+//
+// System.Xml.Serialization.TypeTranslator
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ internal class TypeTranslator
+ {
+ static Hashtable primitives;
+
+ static TypeTranslator ()
+ {
+ primitives = new Hashtable ();
+ primitives.Add (typeof (bool), "boolean");
+ primitives.Add (typeof (short), "short");
+ primitives.Add (typeof (ushort), "unsignedShort");
+ primitives.Add (typeof (int), "int");
+ primitives.Add (typeof (uint), "unsignedInt");
+ primitives.Add (typeof (long), "long");
+ primitives.Add (typeof (ulong), "unsignedLong");
+ primitives.Add (typeof (float), "float");
+ primitives.Add (typeof (double), "double");
+ primitives.Add (typeof (DateTime), "dateTime"); // TODO: timeInstant, Xml date, xml time
+ primitives.Add (typeof (Guid), "guid");
+ primitives.Add (typeof (Decimal), "decimal");
+ primitives.Add (typeof (XmlQualifiedName), "QName");
+ primitives.Add (typeof (string), "string");
+ primitives.Add (typeof (byte), "unsignedByte");
+ primitives.Add (typeof (sbyte), "byte");
+ primitives.Add (typeof (char), "char");
+ primitives.Add (typeof (object), "anyType");
+ }
+
+ private TypeTranslator ()
+ {
+ }
+
+ static public TypeData GetTypeData (Type type)
+ {
+ string name = primitives [type] as string;
+ return new TypeData (type, (name == null) ? type.Name : name, name != null);
+ }
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs
new file mode 100644
index 00000000000..b501cb5fea0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs
@@ -0,0 +1,35 @@
+//
+// UnreferencedObjectEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for UnreferencedObjectEventArgs.
+ /// </summary>
+ public class UnreferencedObjectEventArgs : EventArgs
+ {
+ private object unreferencedObject;
+ private string unreferencedId;
+
+ public UnreferencedObjectEventArgs(object o, string id)
+ {
+ unreferencedObject = o;
+ unreferencedId = id;
+ }
+
+ public string UnreferencedId {
+ get{ return unreferencedId; }
+ }
+ public object UnreferencedObject {
+ get{ return unreferencedObject; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventHandler.cs b/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventHandler.cs
new file mode 100755
index 00000000000..5344f05a746
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// UnreferencedObjectEventHandler.cs:
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void UnreferencedObjectEventHandler (object sender, UnreferencedObjectEventArgs e);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs
new file mode 100644
index 00000000000..c34e70448d6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs
@@ -0,0 +1,28 @@
+//
+// XmlAnyAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAnyAttributeAttribute.
+ /// </summary>
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlAnyAttributeAttribute : Attribute
+ {
+
+ public XmlAnyAttributeAttribute()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs
new file mode 100644
index 00000000000..255be7ea96c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs
@@ -0,0 +1,66 @@
+//
+// filename.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAnyElementAttribute.
+ /// </summary>
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlAnyElementAttribute : Attribute
+ {
+ private string elementName;
+ private string ns;
+ private int order;
+
+ public XmlAnyElementAttribute ()
+ {
+ }
+
+ public XmlAnyElementAttribute (string name)
+ {
+ elementName = name;
+ }
+
+ public XmlAnyElementAttribute (string name, string ns)
+ {
+ elementName = name;
+ Namespace = ns;
+ }
+
+ public string Name {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ /// <summary>
+ /// Specifies Order in which Memberswill be serialized as Elements.
+ /// </summary>
+ internal int Order
+ {
+ get{ return order; }
+ set{ order = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs
new file mode 100644
index 00000000000..86242fe7097
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs
@@ -0,0 +1,66 @@
+//
+// XmlAnyElementAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System.Xml.Serialization;
+using System.Collections;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAnyElementAttributes.
+ /// </summary>
+ public class XmlAnyElementAttributes : CollectionBase
+ {
+
+ public XmlAnyElementAttribute this[int index]
+ {
+ get
+ {
+ return (XmlAnyElementAttribute)List[index];
+ }
+ set
+ {
+ List[index] = value;
+ }
+ }
+
+ public int Add(XmlAnyElementAttribute attribute)
+ {
+ return List.Add(attribute);
+ }
+
+ public bool Contains(XmlAnyElementAttribute attribute)
+ {
+ return List.Contains(attribute);
+ }
+
+ public int IndexOf(XmlAnyElementAttribute attribute)
+ {
+ return List.IndexOf(attribute);
+ }
+
+ public void Insert(int index, XmlAnyElementAttribute attribute)
+ {
+ List.Insert(index, attribute);
+ }
+
+ public void Remove(XmlAnyElementAttribute attribute)
+ {
+ List.Remove(attribute);
+ }
+
+ public void CopyTo(XmlAnyElementAttribute[] array,int index)
+ {
+ List.CopyTo(array, index);
+ }
+ }
+
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs
new file mode 100644
index 00000000000..d0b67ab636d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs
@@ -0,0 +1,90 @@
+//
+// XmlArrayAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlArrayAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlArrayAttribute : Attribute
+ {
+ private string elementName;
+ private XmlSchemaForm form;
+ private bool isNullable;
+ private string ns;
+ private int order;
+
+ public XmlArrayAttribute()
+ {
+ }
+
+ public XmlArrayAttribute(string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string ElementName
+ {
+ get
+ {
+ return elementName;
+ }
+ set
+ {
+ elementName = value;
+ }
+ }
+ public XmlSchemaForm Form
+ {
+ get
+ {
+ return form;
+ }
+ set
+ {
+ form = value;
+ }
+ }
+ public bool IsNullable
+ {
+ get
+ {
+ return isNullable;
+ }
+ set
+ {
+ isNullable = value;
+ }
+ }
+ public string Namespace
+ {
+ get
+ {
+ return ns;
+ }
+ set
+ {
+ ns = value;
+ }
+ }
+ /// <summary>
+ /// Specifies Order in which Memberswill be serialized as Elements.
+ /// </summary>
+ internal int Order
+ {
+ get{ return order; }
+ set{ order = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs
new file mode 100644
index 00000000000..354af362b76
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs
@@ -0,0 +1,85 @@
+//
+// XmlArrayItemAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlArrayItemAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlArrayItemAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private XmlSchemaForm form;
+ private string ns;
+ private bool isNullable;
+ private int nestingLevel;
+ private Type type;
+ private int order;
+
+ public XmlArrayItemAttribute ()
+ {
+ }
+ public XmlArrayItemAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+ public XmlArrayItemAttribute (Type type)
+ {
+ Type = type;
+ }
+ public XmlArrayItemAttribute (string elementName, Type type)
+ {
+ ElementName = elementName;
+ Type = type;
+ }
+
+ public string DataType {
+ get { return dataType; }
+ set { dataType = value; }
+ }
+ public string ElementName {
+ get { return elementName; }
+ set { elementName = value; }
+ }
+ public XmlSchemaForm Form {
+ get { return form; }
+ set { form = value; }
+ }
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+ public bool IsNullable {
+ get { return isNullable; }
+ set { isNullable = value; }
+ }
+ public Type Type {
+ get { return type; }
+ set { type = value; }
+ }
+ public int NestingLevel {
+ get { return nestingLevel; }
+ set { nestingLevel = value; }
+ }
+ /// <summary>
+ /// Specifies Order in which Memberswill be serialized as Elements.
+ /// </summary>
+ public int Order
+ {
+ get{ return order; }
+ set{ order = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs
new file mode 100644
index 00000000000..51528209a41
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs
@@ -0,0 +1,61 @@
+//
+// XmlArrayItemAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Serialization;
+using System.Collections;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlArrayItemAttributes.
+ /// </summary>
+ public class XmlArrayItemAttributes : CollectionBase
+ {
+
+ public XmlArrayItemAttribute this [int index] {
+ get {
+ return (XmlArrayItemAttribute)List [index];
+ }
+ set {
+ List [index] = value;
+ }
+ }
+
+ public int Add (XmlArrayItemAttribute attribute)
+ {
+ return List.Add(attribute);
+ }
+
+ public bool Contains(XmlArrayItemAttribute attribute)
+ {
+ return List.Contains(attribute);
+ }
+
+ public void CopyTo(XmlArrayItemAttribute[] array, int index)
+ {
+ List.CopyTo(array, index);
+ }
+
+ public int IndexOf(XmlArrayItemAttribute attribute)
+ {
+ return List.IndexOf(attribute);
+ }
+
+ public void Insert(int index, XmlArrayItemAttribute attribute)
+ {
+ List.Insert(index, attribute);
+ }
+
+ public void Remove(XmlArrayItemAttribute attribute)
+ {
+ List.Remove(attribute);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
new file mode 100644
index 00000000000..e23ff75890c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
@@ -0,0 +1,95 @@
+//
+// XmlAttributeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlAttributeAttribute : Attribute
+ {
+ private string attributeName;
+ private string dataType;
+ private Type type;
+ private XmlSchemaForm form;
+ private string ns;
+
+ public XmlAttributeAttribute ()
+ {
+ }
+
+ public XmlAttributeAttribute (string attributeName)
+ {
+ AttributeName = attributeName;
+ }
+
+ public XmlAttributeAttribute (Type type)
+ {
+ Type = type;
+ }
+
+ public XmlAttributeAttribute (string attributeName, Type type)
+ {
+ AttributeName = attributeName;
+ Type = type;
+ }
+
+ public string AttributeName {
+ get {
+ return attributeName;
+ }
+ set {
+ attributeName = value;
+ }
+ }
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public XmlSchemaForm Form {
+ get {
+ return form;
+ }
+ set {
+ if(Namespace != null)
+ form = value;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+
+ public Type Type
+ {
+ get
+ {
+ return type;
+ }
+ set
+ {
+ type = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs
new file mode 100644
index 00000000000..e39c6811573
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs
@@ -0,0 +1,49 @@
+//
+// XmlAttributeEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributeEventArgs.
+ /// </summary>
+ public class XmlAttributeEventArgs : EventArgs
+ {
+ private XmlAttribute attr;
+ private int lineNumber;
+ private int linePosition;
+ private object obj;
+
+ internal XmlAttributeEventArgs(XmlAttribute attr, int lineNum, int linePos, object source)
+ {
+ this.attr = attr;
+ this.lineNumber = lineNum;
+ this.linePosition = linePos;
+ this.obj = source;
+ }
+
+ public XmlAttribute Attr {
+ get { return attr; }
+ }
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public int LinePosition {
+ get { return linePosition; }
+ }
+
+ public object ObjectBeingDeserialized {
+ get{ return obj; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventHandler.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventHandler.cs
new file mode 100755
index 00000000000..35a0f2d5474
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// XmlAttributeEventHandler.cs:
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void XmlAttributeEventHandler (object sender, XmlAttributeEventArgs e);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs
new file mode 100644
index 00000000000..75c6112c794
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs
@@ -0,0 +1,60 @@
+//
+// XmlAttributeOverrides.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributeOverrides.
+ /// </summary>
+ public class XmlAttributeOverrides
+ {
+
+ private Hashtable overrides;
+
+ public XmlAttributeOverrides ()
+ {
+ overrides = new Hashtable();
+ }
+
+ public XmlAttributes this [Type type]
+ {
+ get { return this [type, string.Empty]; }
+ }
+
+ public XmlAttributes this [Type type, string member]
+ {
+ get
+ {
+ return (XmlAttributes) overrides[GetKey(type,member)];
+ }
+ }
+
+ public void Add (Type type, XmlAttributes attributes)
+ {
+ Add(type, string.Empty, attributes);
+ }
+
+ public void Add (Type type, string member, XmlAttributes attributes)
+ {
+ if(overrides[GetKey(type, member)] != null)
+ throw new Exception("The attributes for the given type and Member already exist in the collection");
+
+ overrides.Add(GetKey(type,member), attributes);
+ }
+
+ private TypeMember GetKey(Type type, string member)
+ {
+ return new TypeMember(type, member);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs
new file mode 100644
index 00000000000..a9f22b5c0b9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs
@@ -0,0 +1,439 @@
+//
+// XmlAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Reflection;
+using System;
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributes.
+ /// </summary>
+ public class XmlAttributes
+ {
+ private XmlAnyAttributeAttribute xmlAnyAttribute;
+ private XmlAnyElementAttributes xmlAnyElements;
+ private XmlArrayAttribute xmlArray;
+ private XmlArrayItemAttributes xmlArrayItems;
+ private XmlAttributeAttribute xmlAttribute;
+ private XmlChoiceIdentifierAttribute xmlChoiceIdentifier;
+ private object xmlDefaultValue;
+ private XmlElementAttributes xmlElements;
+ private XmlEnumAttribute xmlEnum;
+ private bool xmlIgnore;
+ private bool xmlns;
+ private XmlRootAttribute xmlRoot;
+ private XmlTextAttribute xmlText;
+ private XmlTypeAttribute xmlType;
+
+ private MemberInfo minfo;
+ private FieldInfo finfo;
+ private PropertyInfo pinfo;
+ internal ArrayList XmlIncludes;
+ //internal string ElementName;
+
+ //The element Order in serialization.
+ internal int order;
+ internal bool isAttribute;
+ internal static XmlAttributes.XmlAttributesComparer attrComparer;
+
+ //Sorting Order of Elements: XmlNs, XmlAttributes, XmlElement
+ internal class XmlAttributesComparer : IComparer
+ {
+ public int Compare(object x,object y)
+ {
+ if(x is XmlAttributes && y is XmlAttributes)
+ {
+ XmlAttributes attx = (XmlAttributes)x;
+ XmlAttributes atty = (XmlAttributes)y;
+ if(attx.xmlns)
+ return -1;
+ if(atty.xmlns)
+ return 1;
+ if(attx.isAttribute)
+ return -1;
+ if(atty.isAttribute)
+ return 1;
+ int diff = attx.order - atty.order;
+ if(diff == 0)
+ return 0;
+ if(diff > 0)
+ return 1;
+ if(diff < 0)
+ return -1;
+ }
+ if(x == null)
+ return -1;
+ if(y == null)
+ return 1;
+ throw new Exception("Should never occur. XmlAttributesComparer.Compare");
+ }
+ }
+
+ public XmlAttributes ()
+ {
+ xmlAnyElements = new XmlAnyElementAttributes ();
+ xmlArrayItems = new XmlArrayItemAttributes ();
+ xmlElements = new XmlElementAttributes ();
+ XmlIncludes = new ArrayList();
+ }
+
+ static XmlAttributes ()
+ {
+ attrComparer = new XmlAttributes.XmlAttributesComparer();
+ }
+
+ public XmlAttributes (ICustomAttributeProvider provider)
+ {
+ object[] attributes = provider.GetCustomAttributes(false);
+ foreach(object obj in attributes)
+ {
+ if(obj is XmlAnyAttributeAttribute)
+ xmlAnyAttribute = (XmlAnyAttributeAttribute) obj;
+ else if(obj is XmlAnyElementAttribute)
+ xmlAnyElements.Add((XmlAnyElementAttribute) obj);
+ else if(obj is XmlArrayAttribute)
+ xmlArray = (XmlArrayAttribute) obj;
+ else if(obj is XmlArrayItemAttribute)
+ xmlArrayItems.Add((XmlArrayItemAttribute) obj);
+ else if(obj is XmlAttributeAttribute)
+ xmlAttribute = (XmlAttributeAttribute) obj;
+ else if(obj is XmlChoiceIdentifierAttribute)
+ xmlChoiceIdentifier = (XmlChoiceIdentifierAttribute) obj;
+ else if(obj is DefaultValueAttribute)
+ xmlDefaultValue = obj;
+ else if(obj is XmlElementAttribute )
+ xmlElements.Add((XmlElementAttribute ) obj);
+ else if(obj is XmlEnumAttribute)
+ xmlEnum = (XmlEnumAttribute) obj;
+ else if(obj is XmlIgnoreAttribute)
+ xmlIgnore = true;
+ else if(obj is XmlNamespaceDeclarationsAttribute)
+ xmlns = true;
+ else if(obj is XmlRootAttribute)
+ xmlRoot = (XmlRootAttribute) obj;
+ else if(obj is XmlTextAttribute)
+ xmlText = (XmlTextAttribute) obj;
+ else if(obj is XmlTypeAttribute)
+ xmlType = (XmlTypeAttribute) obj;
+ }
+ }
+
+ #region public properties
+ public XmlAnyAttributeAttribute XmlAnyAttribute
+ {
+ get
+ {
+ return xmlAnyAttribute;
+ }
+ set
+ {
+ xmlAnyAttribute = value;
+ }
+ }
+ public XmlAnyElementAttributes XmlAnyElements
+ {
+ get
+ {
+ return xmlAnyElements;
+ }
+ }
+ public XmlArrayAttribute XmlArray
+ {
+ get
+ {
+ return xmlArray;
+ }
+ set
+ {
+ xmlArray = value;
+ }
+ }
+ public XmlArrayItemAttributes XmlArrayItems
+ {
+ get
+ {
+ return xmlArrayItems;
+ }
+ }
+ public XmlAttributeAttribute XmlAttribute
+ {
+ get
+ {
+ return xmlAttribute;
+ }
+ set
+ {
+ xmlAttribute = value;
+ }
+ }
+ public XmlChoiceIdentifierAttribute XmlChoiceIdentifier
+ {
+ get
+ {
+ return xmlChoiceIdentifier;
+ }
+ }
+ public object XmlDefaultValue
+ {
+ get
+ {
+ return xmlDefaultValue;
+ }
+ set
+ {
+ xmlDefaultValue = value;
+ }
+ }
+ public XmlElementAttributes XmlElements
+ {
+ get
+ {
+ return xmlElements;
+ }
+ }
+ public XmlEnumAttribute XmlEnum
+ {
+ get
+ {
+ return xmlEnum;
+ }
+ set
+ {
+ xmlEnum = value;
+ }
+ }
+ public bool XmlIgnore
+ {
+ get
+ {
+ return xmlIgnore;
+ }
+ set
+ {
+ xmlIgnore = value;
+ }
+ }
+ public bool Xmlns
+ {
+ get
+ {
+ return xmlns;
+ }
+ set
+ {
+ xmlns = value;
+ }
+ }
+ public XmlRootAttribute XmlRoot
+ {
+ get
+ {
+ return xmlRoot;}
+ set
+ {
+ xmlRoot = value;
+ }
+ }
+ public XmlTextAttribute XmlText
+ {
+ get
+ {
+ return xmlText;
+ }
+ set
+ {
+ xmlText = value;
+ }
+ }
+ public XmlTypeAttribute XmlType
+ {
+ get
+ {
+ return xmlType;
+ }
+ set
+ {
+ xmlType = value;
+ }
+ }
+ #endregion
+
+ #region internal properties
+ internal MemberInfo MemberInfo
+ {
+ get { return minfo; }
+ set { minfo = value; }
+ }
+
+ internal FieldInfo FieldInfo
+ {
+ get { return finfo; }
+ set { finfo = value; }
+ }
+
+ internal PropertyInfo PropertyInfo
+ {
+ get { return pinfo; }
+ set { pinfo = value; }
+ }
+ #endregion
+
+ //Only permissible attributes for a class type are: XmlRoot and XmlInclude
+ internal static XmlAttributes FromClass(Type classType)
+ {
+ XmlAttributes XmlAttr = new XmlAttributes();
+ object[] attributes = classType.GetCustomAttributes(false);
+ foreach(object obj in attributes)
+ {
+ if(obj is XmlRootAttribute)
+ XmlAttr.xmlRoot = (XmlRootAttribute) obj;
+ else if(obj is XmlIncludeAttribute)
+ XmlAttr.XmlIncludes.Add(obj);
+ }
+ return XmlAttr;
+ }
+
+ internal static XmlAttributes FromField(MemberInfo member, FieldInfo finfo)
+ {
+ XmlAttributes XmlAttr = new XmlAttributes();
+ object[] attributes = member.GetCustomAttributes(false);
+ XmlAttr.AddMemberAttributes(attributes);
+
+ XmlAttr.minfo = member;
+ XmlAttr.finfo = finfo;
+
+ return XmlAttr;
+ }
+
+
+ internal static XmlAttributes FromProperty(MemberInfo member, PropertyInfo pinfo)
+ {
+
+ XmlAttributes XmlAttr = new XmlAttributes();
+ object[] attributes = member.GetCustomAttributes(false);
+ XmlAttr.AddMemberAttributes(attributes);
+
+ XmlAttr.minfo = member;
+ XmlAttr.pinfo = pinfo;
+ return XmlAttr;
+ }
+
+ internal void AddMemberAttributes(object[] attributes)
+ {
+ foreach(object obj in attributes)
+ {
+ if(obj is XmlAnyAttributeAttribute)
+ {
+ xmlAnyAttribute = (XmlAnyAttributeAttribute) obj;
+ isAttribute = true;
+ }
+ else if(obj is XmlAttributeAttribute)
+ {
+ xmlAttribute = (XmlAttributeAttribute) obj;
+ isAttribute = true;
+ }
+ else if(obj is XmlNamespaceDeclarationsAttribute)
+ {
+ xmlns = true;
+ isAttribute = true;
+ }
+ else if(obj is XmlAnyElementAttribute)
+ {
+ xmlAnyElements.Add((XmlAnyElementAttribute) obj);
+ order = ((XmlAnyElementAttribute) obj).Order;
+ }
+ else if(obj is XmlArrayAttribute)
+ {
+ xmlArray = (XmlArrayAttribute) obj;
+ order = ((XmlArrayAttribute) obj).Order;
+ }
+ else if(obj is XmlArrayItemAttribute)
+ {
+ xmlArrayItems.Add((XmlArrayItemAttribute) obj);
+ order = ((XmlArrayItemAttribute) obj).Order;
+ }
+ else if(obj is XmlChoiceIdentifierAttribute)
+ {
+ xmlChoiceIdentifier = (XmlChoiceIdentifierAttribute) obj;
+ order = ((XmlChoiceIdentifierAttribute) obj).Order;
+ }
+ else if(obj is XmlTextAttribute)
+ {
+ xmlText = (XmlTextAttribute) obj;
+ order = ((XmlTextAttribute) obj).Order;
+ }
+ else if(obj is XmlElementAttribute )
+ {
+ xmlElements.Add((XmlElementAttribute ) obj);
+ order = ((XmlElementAttribute ) obj).Order;
+ }
+ else if(obj is DefaultValueAttribute)
+ {
+ xmlDefaultValue = ((DefaultValueAttribute ) obj).Value;
+ }
+ else if(obj is XmlEnumAttribute)
+ {
+ xmlEnum = (XmlEnumAttribute) obj;
+ }
+ else if(obj is XmlIgnoreAttribute)
+ {
+ xmlIgnore = true;
+ }
+ else if(obj is XmlRootAttribute)
+ {
+ throw new Exception("should never happen. XmlRoot on a member");
+ }
+ else if(obj is XmlTypeAttribute)
+ {
+ xmlType = (XmlTypeAttribute) obj;
+ }
+ }
+ }
+
+ internal string GetAttributeName(Type type, string defaultName)
+ {
+ if(XmlAttribute != null && XmlAttribute.AttributeName != null && XmlAttribute.AttributeName != "")
+ return XmlAttribute.AttributeName;
+ return defaultName;
+ }
+
+ internal string GetElementName(Type type, string defaultName)
+ {
+ foreach(XmlElementAttribute elem in XmlElements)
+ {
+ if(elem.Type == type && elem.ElementName != null && elem.ElementName != "")
+ return elem.ElementName;
+ else if(elem.Type == null && elem.ElementName != null && elem.ElementName != "")
+ return elem.ElementName;
+ }
+ return defaultName;
+ }
+
+ internal string GetAttributeNamespace(Type type)
+ {
+ if(XmlAttribute != null)
+ return XmlAttribute.Namespace;
+ return null;
+ }
+ internal string GetElementNamespace(Type type)
+ {
+ foreach(XmlElementAttribute elem in XmlElements)
+ {
+ if(elem.Type == type )
+ return elem.Namespace;
+ else if(elem.Type == null)
+ return elem.Namespace;
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs
new file mode 100644
index 00000000000..6b84f761e02
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs
@@ -0,0 +1,51 @@
+//
+// XmlChoiceIdentifierAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlChoiceIdentifierAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlChoiceIdentifierAttribute : Attribute
+ {
+ private string memberName;
+ private int order;
+
+ public XmlChoiceIdentifierAttribute ()
+ {
+ }
+ public XmlChoiceIdentifierAttribute (string name)
+ {
+ MemberName = name;
+ }
+
+ public string MemberName {
+ get {
+ return memberName;
+ }
+ set {
+ memberName = value;
+ }
+ }
+
+ /// <summary>
+ /// Specifies Order in which Memberswill be serialized as Elements.
+ /// </summary>
+ internal int Order
+ {
+ get{ return order; }
+ set{ order = value; }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs
new file mode 100644
index 00000000000..d6ead00212f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs
@@ -0,0 +1,81 @@
+//
+// System.Xml.Serialization.XmlCodeExporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.CodeDom;
+
+namespace System.Xml.Serialization {
+ public class XmlCodeExporter {
+
+ #region Fields
+
+ CodeNamespace codeNamespace;
+ CodeCompileUnit codeCompileUnit;
+ CodeAttributeDeclarationCollection includeMetadata;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlCodeExporter (CodeNamespace codeNamespace)
+ {
+ includeMetadata = new CodeAttributeDeclarationCollection ();
+ this.codeNamespace = codeNamespace;
+ }
+
+ public XmlCodeExporter (CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit)
+ : this (codeNamespace)
+ {
+ this.codeCompileUnit = codeCompileUnit;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public CodeAttributeDeclarationCollection IncludeMetadata {
+ get { return includeMetadata; }
+ }
+
+ #endregion Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlMemberMapping member, string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlTypeMapping member, string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlMemberMapping member, string ns, bool forceUseMemberName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
new file mode 100644
index 00000000000..90f710fac73
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs
@@ -0,0 +1,133 @@
+//
+// System.Xml.Serialization.XmlCustomFormatter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Text;
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ internal class XmlCustomFormatter {
+
+ #region Methods
+
+ [MonoTODO]
+ internal static byte[] FromByteArrayBase64 (byte[] value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal static string FromByteArrayHex (byte[] value)
+ {
+ StringBuilder output = new StringBuilder ();
+ foreach (byte val in value)
+ output.Append (val.ToString ("X2"));
+ return output.ToString ();
+ }
+
+ internal static string FromChar (char value)
+ {
+ return ((int) value).ToString ();
+ }
+
+ internal static string FromDate (DateTime value)
+ {
+ return XmlConvert.ToString (value, "yyyy-MM-dd");
+ }
+
+ internal static string FromDateTime (DateTime value)
+ {
+ return XmlConvert.ToString (value, "yyyy-MM-ddTHH:mm:ss.fffffffzzz");
+ }
+
+ internal static string FromTime (DateTime value)
+ {
+ return XmlConvert.ToString (value, "HH:mm:ss.fffffffzzz");
+ }
+
+ internal static string FromEnum (long value, string[] values, long[] ids)
+ {
+ int length = ids.Length;
+
+ for (int i = 0; i < length; i ++) {
+ if (ids[i] == value)
+ if (i >= values.Length)
+ return String.Empty;
+ else
+ return values[i].ToString ();
+ }
+ return value.ToString ();
+ }
+
+ internal static string FromXmlName (string name)
+ {
+ return XmlConvert.EncodeName (name);
+ }
+
+ internal static string FromXmlNCName (string ncName)
+ {
+ return XmlConvert.EncodeLocalName (ncName);
+ }
+
+ internal static string FromXmlNmToken (string nmToken)
+ {
+ return XmlConvert.EncodeNmToken (nmToken);
+ }
+
+ internal static string FromXmlNmTokens (string nmTokens)
+ {
+ StringBuilder output = new StringBuilder ();
+ string [] tokens = nmTokens.Split (' ');
+ foreach (string token in tokens)
+ output.Append (FromXmlNmToken (token));
+ return output.ToString ();
+ }
+
+ internal static char ToChar (string value)
+ {
+ return (char) XmlConvert.ToUInt16 (value);
+ }
+
+ internal static DateTime ToDate (string value)
+ {
+ return ToDateTime (value);
+ }
+
+ internal static DateTime ToDateTime (string value)
+ {
+ return XmlConvert.ToDateTime (value);
+ }
+
+ internal static DateTime ToTime (string value)
+ {
+ return ToDateTime (value);
+ }
+
+ internal static string ToXmlName (string value)
+ {
+ return XmlConvert.DecodeName (value);
+ }
+
+ internal static string ToXmlNCName (string value)
+ {
+ return ToXmlName (value);
+ }
+
+ internal static string ToXmlNmToken (string value)
+ {
+ return ToXmlName (value);
+ }
+
+ internal static string ToXmlNmTokens (string value)
+ {
+ return ToXmlName (value);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs
new file mode 100644
index 00000000000..f72e43bc347
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs
@@ -0,0 +1,104 @@
+//
+// XmlElementAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlElementAttribute.
+ /// </summary
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple=true)]
+ public class XmlElementAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private XmlSchemaForm form;
+ private string ns;
+ private bool isNullable;
+ private Type type;
+ private int order;
+
+ public XmlElementAttribute ()
+ {
+ }
+ public XmlElementAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+ public XmlElementAttribute (Type type)
+ {
+ Type = type;
+ }
+ public XmlElementAttribute (string elementName, Type type)
+ {
+ ElementName = elementName;
+ Type = type;
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public string ElementName {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+ public XmlSchemaForm Form {
+ get {
+ return form;
+ }
+ set {
+ form = value;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ public bool IsNullable {
+ get {
+ return isNullable;
+ }
+ set {
+ isNullable = value;
+ }
+ }
+ public Type Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ /// <summary>
+ /// Specifies Order in which Memberswill be serialized as Elements.
+ /// </summary>
+ internal int Order
+ {
+ get{ return order; }
+ set{ order = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs
new file mode 100644
index 00000000000..b2a75c1d50c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs
@@ -0,0 +1,59 @@
+//
+// XmlElementAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Collections;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlElementAttributes.
+ /// </summary>
+ public class XmlElementAttributes : CollectionBase
+ {
+ public XmlElementAttribute this [int index] {
+ get {
+ return (XmlElementAttribute)List [index];
+ }
+ set {
+ List [index] = value;
+ }
+ }
+
+ public int Add (XmlElementAttribute attribute)
+ {
+ return List.Add (attribute);
+ }
+
+ public bool Contains(XmlElementAttribute attribute)
+ {
+ return List.Contains(attribute);
+ }
+
+ public int IndexOf(XmlElementAttribute attribute)
+ {
+ return List.IndexOf(attribute);
+ }
+
+ public void Insert(int index, XmlElementAttribute attribute)
+ {
+ List.Insert(index, attribute);
+ }
+
+ public void Remove(XmlElementAttribute attribute)
+ {
+ List.Remove(attribute);
+ }
+
+ public void CopyTo(XmlElementAttribute[] array,int index)
+ {
+ List.CopyTo(array, index);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs
new file mode 100644
index 00000000000..94655c0bb0c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// XmlElementEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlElementEventArgs.
+ /// </summary>
+ public class XmlElementEventArgs : EventArgs
+ {
+ private XmlElement attr;
+ private int lineNumber;
+ private int linePosition;
+ private object obj;
+
+ internal XmlElementEventArgs(XmlElement attr, int lineNum, int linePos, object source)
+ {
+ this.attr = attr;
+ this.lineNumber = lineNum;
+ this.linePosition = linePos;
+ this.obj = source;
+ }
+
+ public XmlElement Element
+ {
+ get { return attr; }
+ }
+
+ public int LineNumber
+ {
+ get { return lineNumber; }
+ }
+
+ public int LinePosition
+ {
+ get { return linePosition; }
+ }
+
+ public object ObjectBeingDeserialized
+ {
+ get{ return obj; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventHandler.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventHandler.cs
new file mode 100755
index 00000000000..be4dda7428a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// XmlElementEventHandler.cs:
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void XmlElementEventHandler (object sender, XmlElementEventArgs e);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs
new file mode 100644
index 00000000000..e95087c09fb
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs
@@ -0,0 +1,41 @@
+//
+// XmlEnumAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlEnumAttribute.
+ /// </summary>\
+ [AttributeUsage(AttributeTargets.Field)]
+ public class XmlEnumAttribute : Attribute
+ {
+ private string name;
+
+ public XmlEnumAttribute ()
+ {
+ }
+
+ public XmlEnumAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs
new file mode 100644
index 00000000000..cb0fe82ba33
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs
@@ -0,0 +1,26 @@
+//
+// XmlIgnoreAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlIgnoreAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlIgnoreAttribute : Attribute
+ {
+ public XmlIgnoreAttribute ()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs
new file mode 100644
index 00000000000..e7eafcdf4cc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs
@@ -0,0 +1,37 @@
+//
+// XmlIncludeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlIncludeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Method)]
+ public class XmlIncludeAttribute : Attribute
+ {
+ private Type type;
+
+ public XmlIncludeAttribute (Type type)
+ {
+ Type = type;
+ }
+
+ public Type Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs
new file mode 100644
index 00000000000..a989e674218
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs
@@ -0,0 +1,23 @@
+//
+// XmlMapping.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlMapping.
+ /// </summary>
+ public abstract class XmlMapping
+ {
+ internal XmlMapping ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs
new file mode 100644
index 00000000000..8c222aa8b82
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs
@@ -0,0 +1,56 @@
+//
+// System.Xml.Serialization.XmlMemberMapping
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Xml.Serialization {
+ public class XmlMemberMapping {
+
+ internal XmlMemberMapping ()
+ {
+ }
+
+ #region Properties
+
+ public bool Any {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string ElementName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string MemberName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Namespace {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string TypeFullName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string TypeName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string TypeNamespace {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs
new file mode 100644
index 00000000000..ebd9b6bc60d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs
@@ -0,0 +1,53 @@
+//
+// System.Xml.Serialization.XmlMembersMapping
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Reflection;
+
+namespace System.Xml.Serialization {
+ public class XmlMembersMapping : XmlMapping {
+
+ internal XmlMembersMapping ()
+ {
+ }
+
+ #region Properties
+
+ public int Count {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string ElementName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public XmlMemberMapping this [int index] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Namespace {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string TypeName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string TypeNamespace {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs
new file mode 100644
index 00000000000..4cc59b3cf00
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs
@@ -0,0 +1,26 @@
+//
+// XmlNamespaceDeclarationsAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlNamespaceDeclarationsAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlNamespaceDeclarationsAttribute : Attribute
+ {
+ public XmlNamespaceDeclarationsAttribute ()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs
new file mode 100644
index 00000000000..8064d6855f2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs
@@ -0,0 +1,82 @@
+//
+// XmlNodeEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlNodeEventArgs.
+ /// </summary>
+ public class XmlNodeEventArgs : EventArgs
+ {
+ private int linenumber;
+ private int lineposition ;
+ private string localname;
+ private string name;
+ private string nsuri;
+ private XmlNodeType nodetype;
+ private object source;
+ private string text;
+
+ internal XmlNodeEventArgs(int linenumber, int lineposition, string localname, string name, string nsuri,
+ XmlNodeType nodetype, object source, string text)
+ {
+ this.linenumber = linenumber;
+ this.lineposition = lineposition;
+ this.localname = localname;
+ this.name = name;
+ this.nsuri = nsuri;
+ this.nodetype = nodetype;
+ this.source = source;
+ this.text = text;
+ }
+
+ public int LineNumber
+ {
+ get { return linenumber; }
+ }
+
+ public int LinePosition
+ {
+ get { return lineposition; }
+ }
+
+ public string LocalName
+ {
+ get { return localname; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string NamespaceURI
+ {
+ get { return nsuri; }
+ }
+
+ public XmlNodeType NodeType
+ {
+ get { return nodetype; }
+ }
+
+ public object ObjectBeingDeserialized
+ {
+ get { return source; }
+ }
+
+ public string Text
+ {
+ get { return text; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventHandler.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventHandler.cs
new file mode 100755
index 00000000000..4c1fdb5c92b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// XmlNodeEventHandler.cs:
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void XmlNodeEventHandler (object sender, XmlNodeEventArgs e);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
new file mode 100644
index 00000000000..108a50b2929
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
@@ -0,0 +1,128 @@
+//
+// System.Xml.Serialization.XmlReflectionImporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Reflection;
+
+namespace System.Xml.Serialization {
+ public class XmlReflectionImporter {
+
+ string defaultNamespace;
+ XmlAttributeOverrides attributeOverrides;
+
+ #region Constructors
+
+ public XmlReflectionImporter ()
+ : this (null, null)
+ {
+ }
+
+ public XmlReflectionImporter (string defaultNamespace)
+ : this (null, defaultNamespace)
+ {
+ }
+
+ public XmlReflectionImporter (XmlAttributeOverrides attributeOverrides)
+ : this (attributeOverrides, null)
+ {
+ }
+
+ public XmlReflectionImporter (XmlAttributeOverrides attributeOverrides, string defaultNamespace)
+ {
+ if (defaultNamespace == null)
+ this.defaultNamespace = String.Empty;
+ else
+ this.defaultNamespace = defaultNamespace;
+
+ if (attributeOverrides == null)
+ this.attributeOverrides = new XmlAttributeOverrides();
+ else
+ this.attributeOverrides = attributeOverrides;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (string elementName,
+ string ns,
+ XmlReflectionMember [] members,
+ bool hasWrapperElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public XmlTypeMapping ImportTypeMapping (Type type)
+ {
+ return ImportTypeMapping (type, null, null);
+ }
+
+ public XmlTypeMapping ImportTypeMapping (Type type, string defaultNamespace)
+ {
+ return ImportTypeMapping (type, null, defaultNamespace);
+ }
+
+ public XmlTypeMapping ImportTypeMapping (Type type, XmlRootAttribute group)
+ {
+ return ImportTypeMapping (type, group, null);
+ }
+
+ public XmlTypeMapping ImportTypeMapping (Type type, XmlRootAttribute group, string defaultNamespace)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ if (type == typeof (void))
+ throw new InvalidOperationException ("Type " + type.Name +
+ " may not be serialized.");
+
+ XmlAttributes atts = new XmlAttributes (type);
+ TypeData data = TypeTranslator.GetTypeData (type);
+ string elementName = data.ElementName;
+ string typeName = data.TypeName;
+ string typeFullName = data.FullTypeName;
+ string nameSpc = (defaultNamespace != null) ? defaultNamespace : this.defaultNamespace;
+ return new XmlTypeMapping (elementName, nameSpc, typeFullName, typeName);
+ }
+
+ private void ImportTypeMapping (TypeData data, string ns)
+ {
+ ImportTypeMapping (data.Type, null, ns);
+ }
+
+ public void IncludeType (Type type)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ TypeData data = TypeTranslator.GetTypeData (type);
+ ImportTypeMapping (data, defaultNamespace);
+ }
+
+ public void IncludeTypes (ICustomAttributeProvider provider)
+ {
+ if (provider == null)
+ throw new ArgumentNullException ("provider");
+
+ Type ixml = typeof (IXmlSerializable);
+ object [] customAttrs = provider.GetCustomAttributes (typeof (XmlIncludeAttribute), false);
+ foreach (XmlIncludeAttribute att in customAttrs) {
+ Type type = att.Type;
+ if (ixml.IsAssignableFrom (type)) {
+ string fmt = "Type {0} is derived from {1} and therefore cannot " +
+ "be used with attribute XmlInclude";
+ throw new InvalidOperationException (String.Format (fmt, type, ixml));
+ }
+ IncludeType (type);
+ }
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionMember.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionMember.cs
new file mode 100644
index 00000000000..43ba1a82e9b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionMember.cs
@@ -0,0 +1,66 @@
+//
+// System.Xml.Serialization.XmlReflectionMember
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.Xml.Serialization {
+ public class XmlReflectionMember {
+
+ #region Fields
+
+ bool isReturnValue;
+ string memberName;
+ Type memberType;
+ bool overrideIsNullable;
+ SoapAttributes soapAttributes;
+ XmlAttributes xmlAttributes;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlReflectionMember ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool IsReturnValue {
+ get { return isReturnValue; }
+ set { isReturnValue = value; }
+ }
+
+ public string MemberName {
+ get { return memberName; }
+ set { memberName = value; }
+ }
+
+ public Type MemberType {
+ get { return memberType; }
+ set { memberType = value; }
+ }
+
+ public bool OverrideIsNullable {
+ get { return overrideIsNullable; }
+ set { overrideIsNullable = value; }
+ }
+
+ public SoapAttributes SoapAttributes {
+ get { return soapAttributes; }
+ set { soapAttributes = value; }
+ }
+
+ public XmlAttributes XmlAttributes {
+ get { return xmlAttributes; }
+ set { xmlAttributes = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
new file mode 100644
index 00000000000..cc3a83c1b9f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
@@ -0,0 +1,73 @@
+//
+// XmlRootAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlRootAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface |
+ AttributeTargets.ReturnValue)]
+ public class XmlRootAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private bool isNullable;
+ private string ns;
+
+ public XmlRootAttribute ()
+ {
+
+ }
+ public XmlRootAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string DataType
+ {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public string ElementName
+ {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+ public bool IsNullable
+ {
+ get {
+ return isNullable;
+ }
+ set {
+ isNullable = value;
+ }
+ }
+ public string Namespace
+ {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs
new file mode 100644
index 00000000000..991bbce1b3e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs
@@ -0,0 +1,58 @@
+//
+// System.Xml.Serialization.XmlSchemaExporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ public class XmlSchemaExporter {
+
+ #region Fields
+
+ XmlSchemas schemas;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlSchemaExporter (XmlSchemas schemas)
+ {
+ this.schemas = schemas;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public string ExportAnyType (string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlQualifiedName ExportTypeMapping (XmlMembersMapping xmlMembersMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
new file mode 100644
index 00000000000..fd0df8faadc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
@@ -0,0 +1,91 @@
+//
+// System.Xml.Serialization.XmlSchemaImporter
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ public class XmlSchemaImporter {
+
+ #region Fields
+
+ XmlSchemas schemas;
+ CodeIdentifiers typeIdentifiers;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlSchemaImporter (XmlSchemas schemas)
+ {
+ this.schemas = schemas;
+ }
+
+ public XmlSchemaImporter (XmlSchemas schemas, CodeIdentifiers typeIdentifiers)
+ : this (schemas)
+ {
+ this.typeIdentifiers = typeIdentifiers;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public XmlMembersMapping ImportAnyType (XmlQualifiedName typeName, string elementName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTypeMapping ImportDerivedTypeMapping (XmlQualifiedName name, Type baseType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTypeMapping ImportDerivedTypeMapping (XmlQualifiedName name, bool baseTypeCanBeIndirect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTypeMapping ImportDerivedTypeMapping (XmlQualifiedName name,
+ Type baseType,
+ bool baseTypeCanBeIndirect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (XmlQualifiedName name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (XmlQualifiedName[] names)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlMembersMapping ImportMembersMapping (XmlQualifiedName[] names, Type baseType, bool baseTypeCanBeIndirect)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTypeMapping ImportTypeMapping (XmlQualifiedName name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs
new file mode 100644
index 00000000000..0918f928489
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs
@@ -0,0 +1,148 @@
+//
+// System.Xml.Serialization.XmlSchemas
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Xml.Schema;
+
+namespace System.Xml.Serialization {
+ public class XmlSchemas : CollectionBase {
+
+ #region Fields
+
+ Hashtable table = new Hashtable ();
+
+ #endregion
+
+ #region Constructors
+
+ public XmlSchemas ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public XmlSchema this [int index] {
+ get {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ return (XmlSchema) List [index];
+ }
+ set { List [index] = value; }
+ }
+
+ public XmlSchema this [string ns] {
+ get { return (XmlSchema) table[ns]; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (XmlSchema schema)
+ {
+ Insert (Count, schema);
+ return (Count - 1);
+ }
+
+ public void Add (XmlSchemas schemas)
+ {
+ foreach (XmlSchema schema in schemas)
+ Add (schema);
+ }
+
+ public bool Contains (XmlSchema schema)
+ {
+ return List.Contains (schema);
+ }
+
+ public void CopyTo (XmlSchema[] array, int index)
+ {
+ List.CopyTo (array, index);
+ }
+
+ public object Find (XmlQualifiedName name, Type type)
+ {
+ XmlSchema schema = table [name.Namespace] as XmlSchema;
+ if (schema == null)
+ return null;
+
+ if (!schema.IsCompiled) {
+ try {
+ schema.Compile (null);
+ } catch {
+ throw new InvalidOperationException ("Error compiling XmlSchema " +
+ name.Namespace);
+ }
+ }
+
+ XmlSchemaObjectTable tbl = null;
+
+ if (type == typeof (XmlSchemaSimpleType) || type == typeof (XmlSchemaComplexType))
+ tbl = schema.SchemaTypes;
+ else if (type == typeof (XmlSchemaAttribute))
+ tbl = schema.Attributes;
+ else if (type == typeof (XmlSchemaAttributeGroup))
+ tbl = schema.AttributeGroups;
+ else if (type == typeof (XmlSchemaElement))
+ tbl = schema.Elements;
+ else if (type == typeof (XmlSchemaGroup))
+ tbl = schema.Groups;
+ else if (type == typeof (XmlSchemaNotation))
+ tbl = schema.Notations;
+
+ return (tbl != null) ? tbl [name] : null;
+ }
+
+ public int IndexOf (XmlSchema schema)
+ {
+ return List.IndexOf (schema);
+ }
+
+ public void Insert (int index, XmlSchema schema)
+ {
+ List.Insert (index, schema);
+ }
+
+ [MonoTODO]
+ public static bool IsDataSet (XmlSchema schema)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnClear ()
+ {
+ table.Clear ();
+ }
+
+ protected override void OnInsert (int index, object value)
+ {
+ table [((XmlSchema) value).TargetNamespace] = value;
+ }
+
+ protected override void OnRemove (int index, object value)
+ {
+ table.Remove (value);
+ }
+
+ protected override void OnSet (int index, object oldValue, object newValue)
+ {
+ table [((XmlSchema) oldValue).TargetNamespace] = newValue;
+ }
+
+ public void Remove (XmlSchema schema)
+ {
+ List.Remove (schema);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs
new file mode 100644
index 00000000000..2fd79643126
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.Serialization.XmlSerializationCollectionFixupCallback.cs:
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void XmlSerializationCollectionFixupCallback (object collection, object collectionItems);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs
new file mode 100644
index 00000000000..e1bf47a4fa5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.Serialization.XmlSerializationFixupCallback.cs:
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void XmlSerializationFixupCallback (object fixup);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs
new file mode 100644
index 00000000000..bd426ff0415
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.Serialization.XmlSerializationReadCallback.cs:
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate object XmlSerializationReadCallback ();
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
new file mode 100644
index 00000000000..1ffff04a79b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
@@ -0,0 +1,634 @@
+//
+// System.Xml.Serialization.XmlSerializationReader.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (C) Tim Coleman, 2002
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace System.Xml.Serialization {
+ public abstract class XmlSerializationReader {
+
+ #region Fields
+
+ XmlDocument document;
+ XmlReader reader;
+ ArrayList fixups;
+ ArrayList collFixups;
+ Hashtable readCallbacks;
+ Hashtable typesCallbacks;
+ ArrayList noIDTargets;
+ Hashtable targets;
+
+ string w3SchemaNS;
+ string w3SchemaNS2000;
+ string w3SchemaNS1999;
+ string w3InstanceNS;
+ string w3InstanceNS2000;
+ string w3InstanceNS1999;
+ string soapNS;
+ string schema;
+ string wsdlNS;
+ string wsdlArrayType;
+ string nullX;
+ string nil;
+ string typeX;
+ string arrayType;
+ string anyType;
+ #endregion
+
+ private void Initialize ()
+ {
+ w3SchemaNS = reader.NameTable.Add ("http://www.w3.org/2001/XMLSchema");
+ w3SchemaNS2000 = reader.NameTable.Add ("http://www.w3.org/2000/10/XMLSchema");
+ w3SchemaNS1999 = reader.NameTable.Add ("http://www.w3.org/1999/XMLSchema");
+ w3InstanceNS = reader.NameTable.Add ("http://www.w3.org/2001/XMLSchema-instance");
+ w3InstanceNS2000 = reader.NameTable.Add ("http://www.w3.org/2000/10/XMLSchema-instance");
+ w3InstanceNS1999 = reader.NameTable.Add ("http://www.w3.org/1999/XMLSchema-instance");
+ soapNS = reader.NameTable.Add ("http://schemas.xmlsoap.org/soap/encoding/");
+ schema = reader.NameTable.Add ("schema");
+ wsdlNS = reader.NameTable.Add ("http://schemas.xmlsoap.org/wsdl/");
+ wsdlArrayType = reader.NameTable.Add ("arrayType");
+ nullX = reader.NameTable.Add ("null");
+ nil = reader.NameTable.Add ("nil");
+ typeX = reader.NameTable.Add ("type");
+ arrayType = reader.NameTable.Add ("arrayType");
+ anyType = reader.NameTable.Add ("anyType");
+ InitIDs ();
+ }
+
+ private ArrayList EnsureArrayList (ArrayList list)
+ {
+ if (list == null)
+ list = new ArrayList ();
+ return list;
+ }
+
+ private Hashtable EnsureHashtable (Hashtable hash)
+ {
+ if (hash == null)
+ hash = new Hashtable ();
+ return hash;
+ }
+
+ protected XmlSerializationReader ()
+ {
+ }
+
+ protected XmlDocument Document
+ {
+ get {
+ if (document == null)
+ document = new XmlDocument (reader.NameTable);
+
+ return document;
+ }
+ }
+
+ protected XmlReader Reader {
+ get { return reader; }
+ }
+
+ #region Methods
+
+ protected void AddFixup (CollectionFixup fixup)
+ {
+ collFixups = EnsureArrayList (collFixups);
+ collFixups.Add(fixup);
+ }
+
+ protected void AddFixup (Fixup fixup)
+ {
+ fixups = EnsureArrayList (fixups);
+ fixups.Add(fixup);
+ }
+
+ protected void AddReadCallback (string name, string ns, Type type, XmlSerializationReadCallback read)
+ {
+ XmlNameTable nt = reader.NameTable;
+ XmlQualifiedName xqn = new XmlQualifiedName (nt.Add (name), nt.Add (ns));
+ readCallbacks = EnsureHashtable (readCallbacks);
+ readCallbacks.Add (xqn, read);
+ typesCallbacks = EnsureHashtable (typesCallbacks);
+ typesCallbacks.Add (xqn, type);
+ }
+
+ protected void AddTarget (string id, object o)
+ {
+ if (id != null) {
+ targets = EnsureHashtable (targets);
+ if (targets [id] == null)
+ targets.Add (id, o);
+ } else {
+ if (o != null)
+ return;
+ noIDTargets = EnsureArrayList (noIDTargets);
+ noIDTargets.Add (o);
+ }
+ }
+
+ private string CurrentTag ()
+ {
+ switch (reader.NodeType) {
+ case XmlNodeType.None:
+ return String.Format ("<{0} xmlns='{1}'>", reader.LocalName,
+ reader.NamespaceURI);
+ case XmlNodeType.Attribute:
+ return reader.Value;
+ case XmlNodeType.Text:
+ return "CDATA";
+ case XmlNodeType.ProcessingInstruction:
+ return "<--";
+ case XmlNodeType.Entity:
+ return "<?";
+ case XmlNodeType.EndElement:
+ return ">";
+ default:
+ return "(unknown)";
+ }
+ }
+
+ protected Exception CreateAbstractTypeException (string name, string ns)
+ {
+ string message = "Error at " + name + " " + ns + ":" + CurrentTag ();
+ return new InvalidOperationException (message);
+ }
+
+ protected Exception CreateInvalidCastException (Type type, object value)
+ {
+ string message = String.Format ("Cannot assign object of type {0} to an object of " +
+ "type {1}.", value.GetType (), type);
+ return new InvalidCastException (message);
+ }
+
+ protected Exception CreateReadOnlyCollectionException (string name)
+ {
+ string message = String.Format ("Could not serialize {0}. Default constructors are " +
+ "required for collections and enumerators.", name);
+ return new InvalidOperationException (message);
+ }
+
+ protected Exception CreateUnknownConstantException (string value, Type enumType)
+ {
+ string message = String.Format ("'{0}' is not a valid value for {1}.", value, enumType);
+ return new InvalidOperationException (message);
+ }
+
+ protected Exception CreateUnknownNodeException ()
+ {
+ string message = "Unknown xml node -> " + CurrentTag ();
+ return new InvalidOperationException (message);
+ }
+
+ protected Exception CreateUnknownTypeException (XmlQualifiedName type)
+ {
+ string message = "Unknown type " + type.Namespace + ":" + type.Name + " " + CurrentTag ();
+ return new InvalidOperationException (message);
+ }
+
+ protected Array EnsureArrayIndex (Array a, int index, Type elementType)
+ {
+ if (a != null && index < a.Length)
+ return a;
+
+ int size;
+ if (a == null) {
+ size = 32;
+ } else {
+ size = a.Length * 2;
+ }
+
+ Array result = Array.CreateInstance (elementType, size);
+ if (a != null)
+ Array.Copy (a, result, index);
+
+ return result;
+ }
+
+ [MonoTODO ("Implement")]
+ protected void FixupArrayRefs (object fixup)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected int GetArrayLength (string name, string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected bool GetNullAttr ()
+ {
+ string na = reader.GetAttribute (nullX, w3InstanceNS);
+ if (na == null) {
+ na = reader.GetAttribute (nil, w3InstanceNS);
+ if (na == null) {
+ na = reader.GetAttribute (nullX, w3InstanceNS2000);
+ if (na == null)
+ na = reader.GetAttribute (nullX, w3InstanceNS1999);
+ }
+ }
+ return (na != null);
+ }
+
+ [MonoTODO ("Implement")]
+ protected object GetTarget (string id)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected XmlQualifiedName GetXsiType ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract void InitCallbacks ();
+ protected abstract void InitIDs ();
+
+ protected bool IsXmlnsAttribute (string name)
+ {
+ int length = name.Length;
+ if (length < 5)
+ return false;
+
+ if (length == 5)
+ return (name == "xmlns");
+
+ return name.StartsWith ("xmlns:");
+ }
+
+ [MonoTODO ("Implement")]
+ protected void ParseWsdlArrayType (XmlAttribute attr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected XmlQualifiedName ReadElementQualifiedName ()
+ {
+ if (reader.IsEmptyElement) {
+ reader.Skip();
+ return ToXmlQualifiedName (String.Empty);
+ }
+
+ XmlQualifiedName xqn = ToXmlQualifiedName(reader.ReadString ());
+ reader.ReadEndElement ();
+ return xqn;
+ }
+
+ protected void ReadEndElement ()
+ {
+ while (reader.NodeType == XmlNodeType.Whitespace)
+ reader.Skip ();
+
+ if (reader.NodeType != XmlNodeType.None) {
+ reader.ReadEndElement ();
+ } else {
+ reader.Skip ();
+ }
+ }
+
+ protected bool ReadNull ()
+ {
+ if (!GetNullAttr ())
+ return false;
+
+ if (reader.IsEmptyElement) {
+ reader.Skip();
+ return true;
+ }
+
+ reader.ReadStartElement();
+ while (reader.NodeType != XmlNodeType.EndElement)
+ UnknownNode (null);
+ ReadEndElement ();
+ return true;
+ }
+
+ protected XmlQualifiedName ReadNullableQualifiedName ()
+ {
+ if (ReadNull ())
+ return null;
+
+ return ReadElementQualifiedName ();
+ }
+
+ protected string ReadNullableString ()
+ {
+ if (ReadNull ())
+ return null;
+
+ return reader.ReadElementString ();
+ }
+
+ protected bool ReadReference (out string fixupReference)
+ {
+ string href = reader.GetAttribute ("href");
+ if (href == null) {
+ fixupReference = null;
+ return false;
+ }
+
+ if (href [0] != '#')
+ throw new InvalidOperationException("href not found: " + href);
+
+ fixupReference = href.Substring (1);
+ if (!reader.IsEmptyElement) {
+ reader.ReadStartElement ();
+ ReadEndElement ();
+ } else {
+ reader.Skip ();
+ }
+ return true;
+ }
+
+ protected object ReadReferencedElement ()
+ {
+ return ReadReferencedElement (null, null);
+ }
+
+ protected object ReadReferencedElement (string name, string ns)
+ {
+ string unused;
+ return ReadReferencingElement (name, ns, false, out unused);
+ }
+
+ protected void ReadReferencedElements ()
+ {
+ string unused;
+
+ reader.MoveToContent();
+ XmlNodeType nt = reader.NodeType;
+ while (nt != XmlNodeType.EndElement && nt != XmlNodeType.None) {
+ ReadReferencingElement (null, null, true, out unused);
+ reader.MoveToContent ();
+ nt = reader.NodeType;
+ }
+ }
+
+ [MonoTODO ("Implement")]
+ protected object ReadReferencingElement (out string fixupReference)
+ {
+ return ReadReferencingElement (null, null, false, out fixupReference);
+ }
+
+ protected object ReadReferencingElement (string name, string ns, out string fixupReference)
+ {
+ return ReadReferencingElement (name, ns, false, out fixupReference);
+ }
+
+ [MonoTODO]
+ protected object ReadReferencingElement (string name,
+ string ns,
+ bool elementCanBeType,
+ out string fixupReference)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected IXmlSerializable ReadSerializable (IXmlSerializable serializable)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected string ReadString (string value)
+ {
+ if (value == null || value == String.Empty)
+ return reader.ReadString ();
+
+ return (value + reader.ReadString ());
+ }
+
+ [MonoTODO ("Implement")]
+ protected object ReadTypedPrimitive (XmlQualifiedName type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected XmlNode ReadXmlNode (bool wrapped)
+ {
+ return document.ReadNode (reader);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void Referenced (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected Array ShrinkArray (Array a, int length, Type elementType, bool isNullable)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected byte[] ToByteArrayBase64 (bool isNull)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected static byte[] ToByteArrayBase64 (string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected byte[] ToByteArrayHex (bool isNull)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected static byte[] ToByteArrayHex (string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected static char ToChar (string value)
+ {
+ return XmlCustomFormatter.ToChar (value);
+ }
+
+ protected static DateTime ToDate (string value)
+ {
+ return XmlCustomFormatter.ToDate (value);
+ }
+
+ protected static DateTime ToDateTime (string value)
+ {
+ return XmlCustomFormatter.ToDateTime (value);
+ }
+
+ [MonoTODO ("Implement")]
+ protected static long ToEnum (string value, Hashtable h, string typeName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected static DateTime ToTime (string value)
+ {
+ return XmlCustomFormatter.ToTime (value);
+ }
+
+ protected static string ToXmlName (string value)
+ {
+ return XmlCustomFormatter.ToXmlName (value);
+ }
+
+ protected static string ToXmlNCName (string value)
+ {
+ return XmlCustomFormatter.ToXmlNCName (value);
+ }
+
+ protected static string ToXmlNmToken (string value)
+ {
+ return XmlCustomFormatter.ToXmlNmToken (value);
+ }
+
+ protected static string ToXmlNmTokens (string value)
+ {
+ return XmlCustomFormatter.ToXmlNmTokens (value);
+ }
+
+ protected XmlQualifiedName ToXmlQualifiedName (string value)
+ {
+ string name;
+ string ns;
+ int lastColon = value.LastIndexOf (':');
+ string decodedValue = XmlConvert.DecodeName (value);
+ if (lastColon < 0) {
+ name = reader.NameTable.Add (decodedValue);
+ ns = reader.LookupNamespace (String.Empty);
+ } else {
+ string prefix = value.Substring (0, lastColon);
+ ns = reader.LookupNamespace (prefix);
+ if (ns == null)
+ throw new InvalidOperationException ("namespace " + prefix + "not defined");
+
+ name = reader.NameTable.Add (value.Substring (lastColon + 1));
+ }
+
+ return new XmlQualifiedName (name, ns);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void UnknownAttribute (object o, XmlAttribute attr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void UnknownElement (object o, XmlElement elem)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void UnknownNode (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void UnreferencedObject (string id, object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ protected class CollectionFixup {
+
+ #region Fields
+
+ XmlSerializationCollectionFixupCallback callback;
+ object collection;
+ object collectionItems;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public CollectionFixup (object collection, XmlSerializationCollectionFixupCallback callback, object collectionItems)
+ {
+ this.callback = callback;
+ this.collection = collection;
+ this.collectionItems = collectionItems;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public XmlSerializationCollectionFixupCallback Callback {
+ get { return callback; }
+ }
+
+ public object Collection {
+ get { return collection; }
+ }
+
+ public object CollectionItems {
+ get { return collectionItems; }
+ }
+
+ #endregion // Properties
+ }
+
+ protected class Fixup {
+
+ #region Fields
+
+ object source;
+ string[] ids;
+ XmlSerializationFixupCallback callback;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public Fixup (object o, XmlSerializationFixupCallback callback, int count)
+ {
+ this.callback = callback;
+ }
+
+ [MonoTODO]
+ public Fixup (object o, XmlSerializationFixupCallback callback, string[] ids)
+ {
+ this.callback = callback;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public XmlSerializationFixupCallback Callback {
+ get { return callback; }
+ }
+
+ public string[] Ids {
+ get { return ids; }
+ }
+
+ public object Source {
+ get { return source; }
+ set { source = value; }
+ }
+
+ #endregion // Properties
+ }
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs
new file mode 100644
index 00000000000..8da2224c979
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.Serialization.XmlSerializationWriteCallback.cs:
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.Xml.Serialization {
+
+ [Serializable]
+ public delegate void XmlSerializationWriteCallback (object o);
+}
+
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs
new file mode 100644
index 00000000000..6dc637b70ed
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs
@@ -0,0 +1,571 @@
+//
+// System.Xml.Serialization.XmlSerializationWriter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Xml;
+using System.Xml.Schema;
+
+namespace System.Xml.Serialization {
+ public abstract class XmlSerializationWriter {
+
+ #region Fields
+
+ Hashtable references;
+ int referenceCount;
+ int qnameCount;
+
+ ArrayList namespaces;
+ XmlWriter writer;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ protected XmlSerializationWriter ()
+ {
+ qnameCount = 0;
+ references = new Hashtable ();
+ referenceCount = 0;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ protected ArrayList Namespaces {
+ get { return namespaces; }
+ set { namespaces = value; }
+ }
+
+ protected XmlWriter Writer {
+ get { return writer; }
+ set { writer = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO ("Implement")]
+ protected void AddWriteCallback (Type type, string typeName, string typeNs, XmlSerializationWriteCallback callback)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected Exception CreateMismatchChoiceException (string value, string elementName, string enumValue)
+ {
+ string message = String.Format ("Value of {0} mismatches the type of {1}, you need to set it to {2}.", elementName, value, enumValue);
+ return new InvalidOperationException (message);
+ }
+
+ protected Exception CreateUnknownAnyElementException (string name, string ns)
+ {
+ string message = String.Format ("The XML element named '{0}' from namespace '{1}' was not expected. The XML element name and namespace must match those provided via XmlAnyElementAttribute(s).", name, ns);
+ return new InvalidOperationException (message);
+ }
+
+ protected Exception CreateUnknownTypeException (object o)
+ {
+ return CreateUnknownTypeException (o.GetType ());
+ }
+
+ protected Exception CreateUnknownTypeException (Type type)
+ {
+ string message = String.Format ("The type {0} may not be used in this context.", type);
+ return new InvalidOperationException (message);
+ }
+
+ protected static byte[] FromByteArrayBase64 (byte[] value)
+ {
+ return XmlCustomFormatter.FromByteArrayBase64 (value);
+ }
+
+ protected static string FromByteArrayHex (byte[] value)
+ {
+ return XmlCustomFormatter.FromByteArrayHex (value);
+ }
+
+ protected static string FromChar (char value)
+ {
+ return XmlCustomFormatter.FromChar (value);
+ }
+
+ protected static string FromDate (DateTime value)
+ {
+ return XmlCustomFormatter.FromDate (value);
+ }
+
+ protected static string FromDateTime (DateTime value)
+ {
+ return XmlCustomFormatter.FromDateTime (value);
+ }
+
+ protected static string FromEnum (long value, string[] values, long[] ids)
+ {
+ return XmlCustomFormatter.FromEnum (value, values, ids);
+ }
+
+ protected static string FromTime (DateTime value)
+ {
+ return XmlCustomFormatter.FromTime (value);
+ }
+
+ protected static string FromXmlName (string name)
+ {
+ return XmlCustomFormatter.FromXmlName (name);
+ }
+
+ protected static string FromXmlNCName (string ncName)
+ {
+ return XmlCustomFormatter.FromXmlNCName (ncName);
+ }
+
+ protected static string FromXmlNmToken (string nmToken)
+ {
+ return XmlCustomFormatter.FromXmlNmToken (nmToken);
+ }
+
+ protected static string FromXmlNmTokens (string nmTokens)
+ {
+ return XmlCustomFormatter.FromXmlNmTokens (nmTokens);
+ }
+
+ [MonoTODO ("Implement")]
+ protected string FromXmlQualifiedName (XmlQualifiedName xmlQualifiedName)
+ {
+ return GetQualifiedName (xmlQualifiedName.Name, xmlQualifiedName.Namespace);
+ }
+
+ private string GetId (object o, bool addToReferencesList)
+ {
+ referenceCount += 1;
+ string id = String.Format ("id{0}", referenceCount);
+ if (addToReferencesList)
+ references[o] = id;
+ return id;
+ }
+
+ [MonoTODO ("Complete this list.")]
+ private string GetPrimitiveTypeName (Type type)
+ {
+ if (type == typeof (string))
+ return "string";
+ if (type == typeof (bool))
+ return "Boolean";
+ if (type == typeof (float))
+ return "float";
+ if (type == typeof (double))
+ return "double";
+ if (type == typeof (XmlQualifiedName))
+ return "QName";
+
+ return String.Empty;
+ }
+
+ [MonoTODO ("Need to check for namespace conflicts before blindly allocating qN")]
+ private string GetQualifiedName (string name, string ns)
+ {
+ qnameCount += 1;
+ string prefix = String.Format ("q{0}", qnameCount);
+
+ WriteAttribute ("xmlns", prefix, null, ns);
+ return String.Format ("{0}:{1}", prefix, name);
+ }
+
+ protected abstract void InitCallbacks ();
+
+ [MonoTODO ("Implement")]
+ protected void TopLevelElement ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void WriteAttribute (string localName, byte[] value)
+ {
+ WriteAttribute (localName, String.Empty, value);
+ }
+
+ protected void WriteAttribute (string localName, string value)
+ {
+ WriteAttribute (String.Empty, localName, String.Empty, value);
+ }
+
+ protected void WriteAttribute (string localName, string ns, byte[] value)
+ {
+ Writer.WriteStartAttribute (localName, ns);
+ WriteValue (value);
+ Writer.WriteEndAttribute ();
+ }
+
+ protected void WriteAttribute (string localName, string ns, string value)
+ {
+ WriteAttribute (String.Empty, localName, ns, value);
+ }
+
+ protected void WriteAttribute (string prefix, string localName, string ns, string value)
+ {
+ Writer.WriteStartAttribute (prefix, localName, ns);
+ WriteValue (value);
+ Writer.WriteEndAttribute ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteElementEncoded (XmlNode node, string name, string ns, bool isNullable, bool any)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteElementLiteral (XmlNode node, string name, string ns, bool isNullable, bool any)
+ {
+ WriteStartElement (name, ns);
+ node.WriteTo (Writer);
+ WriteEndElement ();
+ }
+
+ protected void WriteElementQualifiedName (string localName, XmlQualifiedName value)
+ {
+ WriteElementQualifiedName (localName, String.Empty, value, null);
+ }
+
+ protected void WriteElementQualifiedName (string localName, string ns, XmlQualifiedName value)
+ {
+ WriteElementQualifiedName (localName, ns, value, null);
+ }
+
+ protected void WriteElementQualifiedName (string localName, XmlQualifiedName value, XmlQualifiedName xsiType)
+ {
+ WriteElementQualifiedName (localName, String.Empty, value, xsiType);
+ }
+
+ protected void WriteElementQualifiedName (string localName, string ns, XmlQualifiedName value, XmlQualifiedName xsiType)
+ {
+ WriteStartElement (localName, ns);
+ Writer.WriteString (FromXmlQualifiedName (value));
+ WriteEndElement ();
+ }
+
+ protected void WriteElementString (string localName, string value)
+ {
+ WriteElementString (localName, String.Empty, value, null);
+ }
+
+ protected void WriteElementString (string localName, string ns, string value)
+ {
+ WriteElementString (localName, ns, value, null);
+ }
+
+ protected void WriteElementString (string localName, string value, XmlQualifiedName xsiType)
+ {
+ WriteElementString (localName, String.Empty, value, xsiType);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteElementString (string localName, string ns, string value, XmlQualifiedName xsiType)
+ {
+ if (xsiType != null) {
+ WriteStartElement (localName, ns);
+ WriteXsiType (xsiType.Name, xsiType.Namespace);
+ Writer.WriteString (value);
+ WriteEndElement ();
+ }
+ else
+ Writer.WriteElementString (localName, ns, value);
+ }
+
+ protected void WriteElementStringRaw (string localName, byte[] value)
+ {
+ WriteElementStringRaw (localName, String.Empty, value, null);
+ }
+
+ protected void WriteElementStringRaw (string localName, string value)
+ {
+ WriteElementStringRaw (localName, String.Empty, value, null);
+ }
+
+ protected void WriteElementStringRaw (string localName, byte[] value, XmlQualifiedName xsiType)
+ {
+ WriteElementStringRaw (localName, String.Empty, value, xsiType);
+ }
+
+ protected void WriteElementStringRaw (string localName, string ns, byte[] value)
+ {
+ WriteElementStringRaw (localName, ns, value, null);
+ }
+
+ protected void WriteElementStringRaw (string localName, string ns, string value)
+ {
+ WriteElementStringRaw (localName, ns, value, null);
+ }
+
+ protected void WriteElementStringRaw (string localName, string value, XmlQualifiedName xsiType)
+ {
+ WriteElementStringRaw (localName, String.Empty, value, null);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteElementStringRaw (string localName, string ns, byte[] value, XmlQualifiedName xsiType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteElementStringRaw (string localName, string ns, string value, XmlQualifiedName xsiType)
+ {
+ WriteStartElement (localName, ns);
+
+ if (xsiType != null)
+ WriteXsiType (xsiType.Name, xsiType.Namespace);
+
+ Writer.WriteRaw (value);
+ WriteEndElement ();
+ }
+
+ protected void WriteEmptyTag (string name)
+ {
+ WriteEmptyTag (name, String.Empty);
+ }
+
+ [MonoTODO ("Verify")]
+ protected void WriteEmptyTag (string name, string ns)
+ {
+ Writer.WriteStartElement (name, ns);
+ Writer.WriteEndElement ();
+ }
+
+ protected void WriteEndElement ()
+ {
+ WriteEndElement (null);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteEndElement (object o)
+ {
+ Writer.WriteEndElement ();
+ }
+
+ protected void WriteId (object o)
+ {
+ WriteAttribute ("id", GetId (o, true));
+ }
+
+ protected void WriteNamespaceDeclarations (XmlSerializerNamespaces ns)
+ {
+ if (ns == null)
+ return;
+
+ Hashtable tbl = ns.Namespaces;
+ foreach (string key in tbl.Keys) {
+ string val = tbl [key] as string;
+ if (val == null)
+ val = String.Empty;
+ WriteAttribute ("xmlns", key, null, val);
+ }
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableQualifiedNameEncoded (string name, string ns, XmlQualifiedName value, XmlQualifiedName xsiType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableQualifiedNameLiteral (string name, string ns, XmlQualifiedName value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableStringEncoded (string name, string ns, string value, XmlQualifiedName xsiType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableStringEncodedRaw (string name, string ns, byte[] value, XmlQualifiedName xsiType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableStringEncodedRaw (string name, string ns, string value, XmlQualifiedName xsiType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableStringLiteral (string name, string ns, string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableStringLiteralRaw (string name, string ns, byte[] value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullableStringLiteralRaw (string name, string ns, string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void WriteNullTagEncoded (string name)
+ {
+ WriteNullTagEncoded (name, String.Empty);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullTagEncoded (string name, string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void WriteNullTagLiteral (string name)
+ {
+ WriteNullTagLiteral (name, String.Empty);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteNullTagLiteral (string name, string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void WritePotentiallyReferencingElement (string n, string ns, object o)
+ {
+ WritePotentiallyReferencingElement (n, ns, o, null, false, false);
+ }
+
+ protected void WritePotentiallyReferencingElement (string n, string ns, object o, Type ambientType)
+ {
+ WritePotentiallyReferencingElement (n, ns, o, ambientType, false, false);
+ }
+
+ protected void WritePotentiallyReferencingElement (string n, string ns, object o, Type ambientType, bool suppressReference)
+ {
+ WritePotentiallyReferencingElement (n, ns, o, ambientType, suppressReference, false);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WritePotentiallyReferencingElement (string n, string ns, object o, Type ambientType, bool suppressReference, bool isNullable)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteReferencedElements ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void WriteReferencingElement (string n, string ns, object o)
+ {
+ WriteReferencingElement (n, ns, o, false);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteReferencingElement (string n, string ns, object o, bool isNullable)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteSerializable (IXmlSerializable serializable, string name, string ns, bool isNullable)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected void WriteStartDocument ()
+ {
+ Writer.WriteStartDocument ();
+ }
+
+ protected void WriteStartElement (string name)
+ {
+ WriteStartElement (name, String.Empty, null, false);
+ }
+
+ protected void WriteStartElement (string name, string ns)
+ {
+ WriteStartElement (name, ns, null, false);
+ }
+
+ protected void WriteStartElement (string name, string ns, bool writePrefixed)
+ {
+ WriteStartElement (name, ns, null, writePrefixed);
+ }
+
+ protected void WriteStartElement (string name, string ns, object o)
+ {
+ WriteStartElement (name, ns, o, false);
+ }
+
+ [MonoTODO]
+ protected void WriteStartElement (string name, string ns, object o, bool writePrefixed)
+ {
+ if (writePrefixed)
+ Writer.WriteStartElement (String.Empty, name, ns);
+ else
+ Writer.WriteStartElement (name, ns);
+ }
+
+ protected void WriteTypedPrimitive (string name, string ns, object o, bool xsiType)
+ {
+ string value;
+
+ WriteStartElement (name, ns);
+
+ if (o is XmlQualifiedName)
+ value = FromXmlQualifiedName ((XmlQualifiedName) o);
+ else
+ value = o.ToString ();
+
+ if (xsiType)
+ WriteXsiType (GetPrimitiveTypeName (o.GetType ()), XmlSchema.Namespace);
+
+ WriteValue (value);
+ WriteEndElement ();
+ }
+
+ protected void WriteValue (byte[] value)
+ {
+ Writer.WriteBase64 (value, 0, value.Length);
+ }
+
+ protected void WriteValue (string value)
+ {
+ Writer.WriteString (value);
+ }
+
+ protected void WriteXmlAttribute (XmlNode node)
+ {
+ WriteXmlAttribute (node, null);
+ }
+
+ [MonoTODO ("Implement")]
+ protected void WriteXmlAttribute (XmlNode node, object container)
+ {
+ if (!(node is XmlAttribute))
+ throw new InvalidOperationException ("The node must be either type XmlAttribute or a derived type.");
+ throw new NotImplementedException ();
+ }
+
+ protected void WriteXsiType (string name, string ns)
+ {
+ WriteAttribute ("type", XmlSchema.InstanceNamespace, GetQualifiedName (name, ns));
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs
new file mode 100644
index 00000000000..3a5ba0fd1e6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs
@@ -0,0 +1,1012 @@
+//
+// Mono Class Libraries
+// System.Xml.Serialization.XmlSerializer
+//
+// Authors:
+// John Donagher (john@webmeta.com)
+// Ajay kumar Dwivedi (adwiv@yahoo.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) 2002 John Donagher, Ajay kumar Dwivedi
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+using System.Xml.Schema;
+
+namespace System.Xml.Serialization {
+ /// <summary>
+ /// Summary description for XmlSerializer.
+ /// </summary>
+ public class XmlSerializer {
+
+ #region Fields
+
+ Type xsertype;
+ XmlAttributeOverrides overrides;
+ Type[] extraTypes;
+ XmlRootAttribute rootAttribute;
+ string defaultNamespace;
+ Hashtable typeTable;
+ bool useOrder;
+ bool isNullable;
+ Hashtable typeMappings = new Hashtable ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ protected XmlSerializer ()
+ {
+ }
+
+ public XmlSerializer (Type type)
+ : this (type, null, null, null, null)
+ {
+ }
+
+ public XmlSerializer (XmlTypeMapping xmlTypeMapping)
+ {
+ typeMappings.Add (xmlTypeMapping.TypeFullName, xmlTypeMapping);
+ }
+
+ public XmlSerializer (Type type, string defaultNamespace)
+ : this (type, null, null, null, defaultNamespace)
+ {
+ }
+
+ public XmlSerializer (Type type, Type[] extraTypes)
+ : this (type, null, extraTypes, null, null)
+ {
+ }
+
+ public XmlSerializer (Type type, XmlAttributeOverrides overrides)
+ : this (type, overrides, null, null, null)
+ {
+ }
+
+ public XmlSerializer (Type type, XmlRootAttribute root)
+ : this (type, null, null, root, null)
+ {
+ }
+
+ internal XmlSerializer (Hashtable typeTable)
+ {
+ this.typeTable = typeTable;
+ }
+
+ public XmlSerializer (Type type,
+ XmlAttributeOverrides overrides,
+ Type [] extraTypes,
+ XmlRootAttribute root,
+ string defaultNamespace)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ XmlReflectionImporter ri = new XmlReflectionImporter (overrides, defaultNamespace);
+ TypeData td = TypeTranslator.GetTypeData (type);
+ typeMappings.Add (td.FullTypeName, ri.ImportTypeMapping (type, root, defaultNamespace));
+ ri.IncludeTypes (type);
+
+ if (extraTypes != null) {
+ foreach (Type t in extraTypes) {
+ td = TypeTranslator.GetTypeData (t);
+ string n = td.FullTypeName;
+ typeMappings.Add (n, ri.ImportTypeMapping (type, root, defaultNamespace));
+ ri.IncludeTypes (t);
+ }
+ }
+
+ this.xsertype = type;
+ this.overrides = overrides;
+ this.extraTypes = (extraTypes == null ? new Type[0] : extraTypes);
+
+ if (root != null)
+ this.rootAttribute = root;
+ else {
+ object[] attributes = type.GetCustomAttributes (typeof (XmlRootAttribute), false);
+ if (attributes.Length > 0)
+ this.rootAttribute = (XmlRootAttribute) attributes[0];
+ }
+
+ this.defaultNamespace = defaultNamespace;
+
+ if (typeTable == null)
+ typeTable = new Hashtable ();
+
+ FillTypeTable (type);
+ }
+
+ #endregion // Constructors
+
+ #region Events
+
+ public event XmlAttributeEventHandler UnknownAttribute;
+ public event XmlElementEventHandler UnknownElement;
+ public event XmlNodeEventHandler UnknownNode;
+ public event UnreferencedObjectEventHandler UnreferencedObject;
+
+ #endregion // Events
+
+ #region Properties
+
+ internal bool UseOrder {
+ get { return useOrder; }
+ set { useOrder = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public virtual bool CanDeserialize (XmlReader xmlReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual XmlSerializationReader CreateReader ()
+ {
+ // This is what MS does!!!
+ throw new NotImplementedException ();
+ }
+
+ protected virtual XmlSerializationWriter CreateWriter ()
+ {
+ // This is what MS does!!!
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object Deserialize (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Deserialize (TextReader textReader)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Deserialize (XmlReader xmlReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual object Deserialize (XmlSerializationReader reader)
+ {
+ // This is what MS does!!!
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static XmlSerializer [] FromMappings (XmlMapping [] mappings)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static XmlSerializer [] FromTypes (Type [] mappings)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Serialize (object o, XmlSerializationWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Serialize (Stream stream, object o)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (stream, System.Text.Encoding.Default);
+ xmlWriter.Formatting = Formatting.Indented;
+ Serialize (xmlWriter, o, null);
+ }
+
+ public void Serialize (TextWriter textWriter, object o)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (textWriter);
+ xmlWriter.Formatting = Formatting.Indented;
+ Serialize (xmlWriter, o, null);
+ }
+
+ public void Serialize (XmlWriter xmlWriter, object o)
+ {
+ Serialize (xmlWriter, o, null);
+ }
+
+ public void Serialize (Stream stream, object o, XmlSerializerNamespaces namespaces)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (stream, System.Text.Encoding.Default);
+ xmlWriter.Formatting = Formatting.Indented;
+ Serialize (xmlWriter, o, namespaces);
+ }
+
+ public void Serialize (TextWriter textWriter, object o, XmlSerializerNamespaces namespaces)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (textWriter);
+ xmlWriter.Formatting = Formatting.Indented;
+ Serialize (xmlWriter, o, namespaces);
+ }
+
+ public void Serialize (XmlWriter writer, object o, XmlSerializerNamespaces namespaces)
+ {
+ Type objType = xsertype;//o.GetType ();
+
+ if (IsInbuiltType(objType))
+ {
+ writer.WriteStartDocument ();
+ SerializeBuiltIn (writer, o);
+ writer.WriteEndDocument();
+ return;
+ }
+
+ string rootName = objType.Name;
+ string rootNs = String.Empty;
+ string rootPrefix = String.Empty;
+
+ if (namespaces == null)
+ namespaces = new XmlSerializerNamespaces ();
+
+ if (namespaces.Count == 0) {
+ namespaces.Add ("xsd", XmlSchema.Namespace);
+ namespaces.Add ("xsi", XmlSchema.InstanceNamespace);
+ }
+
+ XmlSerializerNamespaces nss = new XmlSerializerNamespaces ();
+ XmlQualifiedName[] qnames;
+
+ writer.WriteStartDocument ();
+ object [] memberObj = (object []) typeTable [objType];
+ if (memberObj == null)
+ throw new Exception ("Unknown Type " + objType +
+ " encountered during Serialization");
+
+ Hashtable memberTable = (Hashtable) memberObj [0];
+ XmlAttributes xmlAttributes = (XmlAttributes) memberTable [""];
+
+ //If we have been passed an XmlRoot, set it on the base class
+ if (rootAttribute != null)
+ xmlAttributes.XmlRoot = rootAttribute;
+
+ if (xmlAttributes.XmlRoot != null) {
+ isNullable = xmlAttributes.XmlRoot.IsNullable;
+ if (xmlAttributes.XmlRoot.ElementName != null)
+ rootName = xmlAttributes.XmlRoot.ElementName;
+ rootNs = xmlAttributes.XmlRoot.Namespace;
+ }
+
+ if (namespaces != null && namespaces.GetPrefix (rootNs) != null)
+ rootPrefix = namespaces.GetPrefix (rootNs);
+
+ //XMLNS attributes in the Root
+ XmlAttributes XnsAttrs = (XmlAttributes) ((object[]) typeTable[objType])[1];
+
+ if (XnsAttrs != null) {
+ MemberInfo member = XnsAttrs.MemberInfo;
+ FieldInfo fieldInfo = member as FieldInfo;
+ PropertyInfo propertyInfo = member as PropertyInfo;
+ XmlSerializerNamespaces xns;
+
+ if (fieldInfo != null)
+ xns = (XmlSerializerNamespaces) fieldInfo.GetValue (o);
+ else
+ xns = (XmlSerializerNamespaces) propertyInfo.GetValue (o, null);
+
+ qnames = xns.ToArray ();
+
+ foreach (XmlQualifiedName qname in qnames)
+ nss.Add (qname.Name, qname.Namespace);
+ }
+
+ //XmlNs from the namespaces passed
+ qnames = namespaces.ToArray ();
+ foreach (XmlQualifiedName qname in qnames)
+ if (writer.LookupPrefix (qname.Namespace) != qname.Name)
+ nss.Add (qname.Name, qname.Namespace);
+
+ writer.WriteStartElement (rootPrefix, rootName, rootNs);
+
+ qnames = nss.ToArray();
+ foreach (XmlQualifiedName qname in qnames)
+ if (writer.LookupPrefix (qname.Namespace) != qname.Name)
+ writer.WriteAttributeString ("xmlns", qname.Name, null, qname.Namespace);
+
+ if (rootPrefix == String.Empty && rootNs != String.Empty && rootNs != null)
+ writer.WriteAttributeString (String.Empty, "xmlns", null, rootNs);
+
+ SerializeMembers (writer, o, true);//, namespaces);
+
+ writer.WriteEndDocument ();
+ }
+
+ private void SerializeBuiltIn (XmlWriter writer, object o)
+ {
+ TypeData td = TypeTranslator.GetTypeData (o.GetType ());
+ writer.WriteStartElement (td.ElementName);
+ WriteBuiltinValue(writer,o);
+ writer.WriteEndElement();
+ }
+
+ private void WriteNilAttribute(XmlWriter writer)
+ {
+ writer.WriteAttributeString("nil",XmlSchema.InstanceNamespace, "true");
+ }
+
+ private void WriteBuiltinValue(XmlWriter writer, object o)
+ {
+ if(o == null)
+ WriteNilAttribute(writer);
+ else
+ writer.WriteString (GetXmlValue(o));
+ }
+
+ private void SerializeMembers (XmlWriter writer, object o, bool isRoot)
+ {
+ if(o == null)
+ {
+ WriteNilAttribute(writer);
+ return;
+ }
+
+ Type objType = o.GetType ();
+
+ if (IsInbuiltType(objType))
+ {
+ SerializeBuiltIn (writer, o);
+ return;
+ }
+
+ XmlAttributes nsAttributes = (XmlAttributes) ((object[]) typeTable [objType])[1];
+ ArrayList attributes = (ArrayList) ((object[]) typeTable [objType])[2];
+ ArrayList elements = (ArrayList) ((object[]) typeTable [objType])[3];
+
+ if (!isRoot && nsAttributes != null) {
+ MemberInfo member = nsAttributes.MemberInfo;
+ FieldInfo fieldInfo = member as FieldInfo;
+ PropertyInfo propertyInfo = member as PropertyInfo;
+
+ XmlSerializerNamespaces xns;
+
+ if (fieldInfo != null)
+ xns = (XmlSerializerNamespaces) fieldInfo.GetValue (o);
+ else
+ xns = (XmlSerializerNamespaces) propertyInfo.GetValue (o, null);
+
+ XmlQualifiedName[] qnames = xns.ToArray ();
+ foreach (XmlQualifiedName qname in qnames)
+ if (writer.LookupPrefix (qname.Namespace) != qname.Name)
+ writer.WriteAttributeString ("xmlns", qname.Name, null, qname.Namespace);
+ }
+
+ //Serialize the Attributes.
+ foreach (XmlAttributes xmlAttributes in attributes) {
+ MemberInfo member = xmlAttributes.MemberInfo;
+ FieldInfo fieldInfo = member as FieldInfo;
+ PropertyInfo propertyInfo = member as PropertyInfo;
+
+ Type attributeType;
+ object attributeValue;
+ string attributeValueString;
+ string attributeName;
+ string attributeNs;
+
+ if (fieldInfo != null) {
+ attributeType = fieldInfo.FieldType;
+ attributeValue = fieldInfo.GetValue (o);
+ }
+ else {
+ attributeType = propertyInfo.PropertyType;
+ attributeValue = propertyInfo.GetValue (o, null);
+ }
+
+ attributeName = xmlAttributes.GetAttributeName (attributeType, member.Name);
+ attributeNs = xmlAttributes.GetAttributeNamespace (attributeType);
+
+ if (attributeValue is XmlQualifiedName) {
+ XmlQualifiedName qname = (XmlQualifiedName) attributeValue;
+
+ if (qname.IsEmpty)
+ continue;
+
+ writer.WriteStartAttribute (attributeName, attributeNs);
+ writer.WriteQualifiedName (qname.Name, qname.Namespace);
+ writer.WriteEndAttribute ();
+ continue;
+ }
+ else if (attributeValue is XmlQualifiedName[]) {
+ XmlQualifiedName[] qnames = (XmlQualifiedName[]) attributeValue;
+ writer.WriteStartAttribute (attributeName, attributeNs);
+ int count = 0;
+ foreach (XmlQualifiedName qname in qnames) {
+ if (qname.IsEmpty)
+ continue;
+ if (count++ > 0)
+ writer.WriteWhitespace (" ");
+ writer.WriteQualifiedName (qname.Name, qname.Namespace);
+ }
+ writer.WriteEndAttribute ();
+ continue;
+ }
+ else if (attributeValue is XmlAttribute[]) {
+ XmlAttribute[] xmlattrs = (XmlAttribute[]) attributeValue;
+ foreach (XmlAttribute xmlattr in xmlattrs)
+ xmlattr.WriteTo(writer);
+ continue;
+ }
+
+ attributeValueString = GetXmlValue (attributeValue);
+ if (attributeValueString != GetXmlValue (xmlAttributes.XmlDefaultValue))
+ writer.WriteAttributeString (attributeName, attributeNs, attributeValueString);
+ }
+
+ // Serialize Elements
+ foreach (XmlAttributes xmlElements in elements) {
+ MemberInfo member = xmlElements.MemberInfo;
+ FieldInfo fieldInfo = member as FieldInfo;
+ PropertyInfo propertyInfo = member as PropertyInfo;
+
+ Type elementType;
+ object elementValue;
+ string elementName;
+ string elementNs;
+
+ if (fieldInfo != null) {
+ elementType = fieldInfo.FieldType;
+ elementValue = fieldInfo.GetValue (o);
+ }
+ else {
+ elementType = propertyInfo.PropertyType;
+ elementValue = propertyInfo.GetValue (o, null);
+ }
+
+ elementName = xmlElements.GetElementName (elementType, member.Name);
+ elementNs = xmlElements.GetElementNamespace (elementType);
+ WriteElement (writer, xmlElements, elementName, elementNs, elementType, elementValue);
+ }
+ }
+
+ [MonoTODO ("Remove FIXMEs")]
+ private void WriteElement (XmlWriter writer, XmlAttributes attrs, string name, string ns, Type type, Object value)
+ {
+ //IF the element has XmlText Attribute, the name of the member is not serialized;
+ if (attrs.XmlText != null && value != null)
+ {
+ if (type == typeof (object[]))
+ {
+ foreach(object obj in (object[]) value)
+ writer.WriteRaw(""+obj);
+ }
+ else if (type == typeof (string[]))
+ {
+ foreach(string str in (string[]) value)
+ writer.WriteRaw(str);
+ }
+ else if (type == typeof (XmlNode))
+ {
+ ((XmlNode) value).WriteTo (writer);
+ }
+ else if (type == typeof (XmlNode[]))
+ {
+ XmlNode[] nodes = (XmlNode[]) value;
+ foreach (XmlNode node in nodes)
+ node.WriteTo (writer);
+ }
+ return;
+ }
+
+ //If not text, serialize as an element
+
+ //Start the element tag
+ writer.WriteStartElement (name, ns);
+
+ if (IsInbuiltType (type))
+ {
+ WriteBuiltinValue(writer,value);
+ }
+ else if (type.IsArray && value != null)
+ {
+ SerializeArray (writer, value);
+ }
+ else if (value is ICollection)
+ {
+ BindingFlags flags = BindingFlags.Public | BindingFlags.Instance;
+
+ //Find a non indexer Count Property with return type of int
+ PropertyInfo countInfo = type.GetProperty ("Count", flags, null, typeof (int), new Type[0], null);
+ PropertyInfo itemInfo = type.GetProperty ("Item", flags, null, null, new Type[1] {typeof (int)}, null);
+ int count = (int) countInfo.GetValue (value, null);
+
+ if (count > 0)
+ for (int i = 0; i < count; i++)
+ {
+ object itemValue = itemInfo.GetValue (value, new object[1] {i});
+ Type itemType = itemInfo.PropertyType;
+
+ if (itemValue != null)
+ {
+ string itemName = attrs.GetElementName (itemValue.GetType (), TypeTranslator.GetTypeData(itemType).ElementName);
+ string itemNs = attrs.GetElementNamespace (itemValue.GetType ());
+
+ writer.WriteStartElement (itemName, itemNs);
+ SerializeMembers (writer, itemValue, false);
+ writer.WriteEndElement ();
+ }
+ }
+ }
+ else if (value is IEnumerable)
+ {
+ // FIXME
+ }
+ else if (type.IsEnum)
+ {
+ // FIXME
+ }
+ else
+ { //Complex Type
+ SerializeMembers (writer, value, false);
+ }
+
+ // Close the Element
+ writer.WriteEndElement();
+ }
+
+ //Does not take care of any array specific Xml Attributes
+ [MonoTODO]
+ private void SerializeArray (XmlWriter writer, object o)
+ {
+ Array arr = (o as Array);
+ if(arr == null || arr.Rank != 1)
+ throw new ApplicationException("Expected a single dimension Array, Got "+ o);
+
+ Type arrayType = arr.GetType().GetElementType();
+ string arrayTypeName = TypeTranslator.GetTypeData(arrayType).ElementName;
+
+ TypeData td = TypeTranslator.GetTypeData (arrayType);
+ writer.WriteStartElement (td.ElementName);
+ Console.WriteLine(td.ElementName);
+ //Special Treatment for Byte array
+ if(arrayType.Equals(typeof(byte)))
+ {
+ WriteBuiltinValue(writer,o);
+ }
+ else
+ {
+ for(int i=0; i< arr.Length; i++)
+ {
+ object value = arr.GetValue(i);
+ if (IsInbuiltType (arrayType))
+ {
+ WriteBuiltinValue(writer, value);
+ }
+ else
+ {
+ SerializeMembers(writer, value, false);
+ }
+ }
+ }
+ writer.WriteEndElement();
+ }
+
+ /// <summary>
+ /// If the type is a string, valuetype or primitive type we do not populate the TypeTable.
+ /// If the type is an array, we populate the TypeTable with Element type of the array.
+ /// If the type implements ICollection, it is handled differently. We do not care for its members.
+ /// If the type implements IEnumberable, we check that it implements Add(). Don't care for members.
+ /// </summary>
+ [MonoTODO ("Remove FIXMEs")]
+ private void FillTypeTable (Type type)
+ {
+ if (typeTable.Contains (type))
+ return;
+
+ //For value types and strings we don't need the members.
+ //FIXME: We will need the enum types probably.
+ if (IsInbuiltType (type))
+ return;
+
+ //Array, ICollection and IEnumberable are treated differenty
+ if (type.IsArray) {
+ FillArrayType (type);
+ return;
+ }
+ else if (type.IsEnum) {
+ FillEnum (type);
+ return;
+ }
+ else {
+ //There must be a public constructor
+ if (!HasDefaultConstructor (type))
+ throw new Exception ("Can't Serialize Type " + type.Name + " since it does not have default Constructor");
+
+ if (type.GetInterface ("ICollection") == typeof (System.Collections.ICollection)) {
+ FillICollectionType (type);
+ return;
+ }
+ if (type.GetInterface ("IEnumerable") == typeof (System.Collections.IEnumerable)) {
+ //FillIEnumerableType(type);
+ //return;
+ }
+ }
+
+
+ //Add the Class to the hashtable.
+ //Each value of the hashtable has two objects, one is the hashtable with key of membername (for deserialization)
+ //Other is an Array of XmlSerializernames, Array of XmlAttributes & Array of XmlElements.
+ Object[] memberObj = new Object[4];
+ typeTable.Add (type,memberObj);
+
+ Hashtable memberTable = new Hashtable ();
+ memberObj[0] = memberTable;
+ memberTable.Add ("", XmlAttributes.FromClass (type));
+
+ memberObj[1] = null;
+
+ ArrayList attributes = new ArrayList ();
+ memberObj[2] = attributes;
+
+ ArrayList elements = new ArrayList ();
+ memberObj[3] = elements;
+
+ //Get the graph of the members. Graph is nothing but the order
+ //in which MS implementation serializes the members.
+ MemberInfo[] minfo = GetGraph (type);
+
+ foreach (MemberInfo member in minfo) {
+ FieldInfo fieldInfo = (member as FieldInfo);
+ PropertyInfo propertyInfo = (member as PropertyInfo);
+
+ if (fieldInfo != null) {
+ //If field is readOnly or const, do not serialize it.
+ if (fieldInfo.IsLiteral || fieldInfo.IsInitOnly)
+ continue;
+
+ XmlAttributes xmlAttributes = XmlAttributes.FromField (member, fieldInfo);
+
+ //If XmlAttributes have XmlIgnore, ignore this member
+
+ if (xmlAttributes.XmlIgnore)
+ continue;
+
+ //If this member is a XmlNs type, set the XmlNs object.
+ if (xmlAttributes.Xmlns) {
+ memberObj[1] = xmlAttributes;
+ continue;
+ }
+
+ //If the member is a attribute Type, Add to attribute list
+ if (xmlAttributes.isAttribute)
+ attributes.Add (xmlAttributes);
+ else //Add to elements
+ elements.Add (xmlAttributes);
+
+ //Add in the Hashtable.
+ memberTable.Add (member.Name, xmlAttributes);
+
+ if (xmlAttributes.XmlAnyAttribute != null || xmlAttributes.XmlText != null)
+ continue;
+
+ if (xmlAttributes.XmlElements.Count > 0) {
+ foreach (XmlElementAttribute elem in xmlAttributes.XmlElements) {
+ if (elem.Type != null)
+ FillTypeTable (elem.Type);
+ else
+ FillTypeTable (fieldInfo.FieldType);
+ }
+ continue;
+ }
+
+ if (!IsInbuiltType (fieldInfo.FieldType))
+ FillTypeTable (fieldInfo.FieldType);
+ }
+ else if (propertyInfo != null) {
+ //If property is readonly or writeonly, do not serialize it.
+ //Exceptions are properties whose return type is array, ICollection or IEnumerable
+ //Indexers are not serialized unless the class Implements ICollection.
+ if (!(propertyInfo.PropertyType.IsArray || Implements (propertyInfo.PropertyType, typeof (ICollection)) ||
+ (propertyInfo.PropertyType != typeof (string) && Implements (propertyInfo.PropertyType, typeof (IEnumerable))))) {
+ if(!(propertyInfo.CanRead && propertyInfo.CanWrite) || propertyInfo.GetIndexParameters ().Length != 0)
+ continue;
+ }
+
+ XmlAttributes xmlAttributes = XmlAttributes.FromProperty (member, propertyInfo);
+
+ // If XmlAttributes have XmlIgnore, ignore this member
+ if (xmlAttributes.XmlIgnore)
+ continue;
+
+ // If this member is a XmlNs type, set the XmlNs object.
+ if (xmlAttributes.Xmlns) {
+ memberObj[1] = xmlAttributes;
+ continue;
+ }
+ // If the member is a attribute Type, Add to attribute list
+ if (xmlAttributes.isAttribute)
+ attributes.Add (xmlAttributes);
+ else //Add to elements
+ elements.Add (xmlAttributes);
+
+ // OtherWise add in the Hashtable.
+ memberTable.Add (member.Name, xmlAttributes);
+
+ if (xmlAttributes.XmlAnyAttribute != null || xmlAttributes.XmlText != null)
+ continue;
+
+ if (xmlAttributes.XmlElements.Count > 0) {
+ foreach (XmlElementAttribute elem in xmlAttributes.XmlElements) {
+ if (elem.Type != null)
+ FillTypeTable (elem.Type);
+ else
+ FillTypeTable (propertyInfo.PropertyType);
+ }
+ continue;
+ }
+
+ if (!IsInbuiltType (propertyInfo.PropertyType))
+ FillTypeTable (propertyInfo.PropertyType);
+ }
+ }
+
+ // Sort the attributes for the members according to their Order
+ // This is an extension to MS's Implementation and will be useful
+ // if our reflection does not return the same order of elements
+ // as MS .NET impl
+ if (useOrder)
+ BubbleSort (elements, XmlAttributes.attrComparer);
+ }
+
+ private void FillArrayType (Type type)
+ {
+ if (type.GetArrayRank () != 1)
+ throw new Exception ("MultiDimensional Arrays are not Supported");
+
+ Type arrayType = type.GetElementType ();
+
+ if (arrayType.IsArray)
+ FillArrayType (arrayType);
+ else if (!IsInbuiltType (arrayType))
+ FillTypeTable (arrayType);
+ }
+
+ private void FillICollectionType (Type type)
+ {
+ //Must have an public Indexer that takes an integer and
+ //a public Count Property which returns an int.
+
+ BindingFlags flags = BindingFlags.Public | BindingFlags.Instance;
+
+ //Find a non indexer Count Property with return type of int
+ PropertyInfo countProp = type.GetProperty ("Count", flags, null, typeof (int), new Type[0], null);
+ if (countProp == null || !countProp.CanRead)
+ throw new Exception ("Cannot Serialize " + type + " because it implements ICollectoion, but does not implement public Count property");
+ //Find a indexer Item Property which takes an int
+ PropertyInfo itemProp = type.GetProperty ("Item", flags, null, null, new Type[1] {typeof (int)}, null);
+ if (itemProp == null || !itemProp.CanRead || !itemProp.CanWrite)
+ throw new Exception ("Cannot Serialize " + type + " because it does not have a read/write indexer property that takes an int as argument");
+ FillTypeTable (itemProp.PropertyType);
+ }
+
+ [MonoTODO]
+ private void FillIEnumerableType (Type type)
+ {
+ //Must implement a public Add method that takes a single parameter.
+ //The Add method's parameter must be of the same type as is returned from
+ //the Current property on the value returned from GetEnumerator, or one of that type's bases.
+
+ // We currently ignore enumerable types anyway, so this method was junked.
+ // The code did not do what the documentation above says (if that is even possible!)
+ return;
+ }
+
+ private void FillEnum (Type type)
+ {
+ Hashtable memberTable = new Hashtable ();
+ BindingFlags flags = BindingFlags.Public | BindingFlags.Instance;
+ typeTable.Add (type, memberTable);
+ string[] names = Enum.GetNames (type);
+
+ foreach (string name in names) {
+ MemberInfo[] members = type.GetMember (name);
+ if (members.Length != 1)
+ throw new Exception("Should never happen. Enum member not present or more than one. " + name);
+ XmlAttributes xmlAttributes = new XmlAttributes (members[0]);
+
+ if (xmlAttributes.XmlIgnore)
+ continue;
+
+ if (xmlAttributes.XmlEnum != null)
+ memberTable.Add (members[0].Name, xmlAttributes.XmlEnum.Name);
+ else
+ memberTable.Add (members[0].Name, members[0].Name);
+ }
+ }
+
+ private bool HasDefaultConstructor (Type type)
+ {
+ ConstructorInfo defaultConstructor = type.GetConstructor (new Type[0]);
+ if (defaultConstructor == null || defaultConstructor.IsAbstract || defaultConstructor.IsStatic || !defaultConstructor.IsPublic)
+ return false;
+
+ return true;
+ }
+
+ private bool IsInbuiltType (Type type)
+ {
+ if (type.IsEnum)
+ return false;
+ if (type.IsValueType || type == typeof (string) || type.IsPrimitive)
+ return true;
+ if (type == typeof (DateTime) || type == typeof (XmlNode))
+ return true;
+
+ return false;
+ }
+
+ private static MemberInfo[] GetGraph(Type type)
+ {
+ ArrayList typeGraph = new ArrayList ();
+ GetGraph (type, typeGraph);
+ return (MemberInfo[]) typeGraph.ToArray (typeof (MemberInfo));
+ }
+
+ private static void GetGraph (Type type, ArrayList typeGraph)
+ {
+ BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
+ if (type.BaseType == null)
+ return;
+ GetGraph (type.BaseType, typeGraph);
+
+ typeGraph.AddRange (type.GetFields (flags));
+ typeGraph.AddRange (type.GetProperties (flags));
+ }
+
+ private string GetXmlValue (object value)
+ {
+ if (value == null)
+ return null;
+ #region enum type
+ if (value is Enum)
+ {
+ Type type = value.GetType ();
+
+ if (typeTable.ContainsKey (type)) {
+ Hashtable memberTable = (Hashtable) (typeTable[type]);
+ if (type.IsDefined (typeof (FlagsAttribute), false)) {
+ //If value is exactly a single enum member
+ if (memberTable.Contains (value.ToString ()))
+ return (string) memberTable[value.ToString ()];
+
+ string retval = "";
+ int enumval = (int) value;
+ string[] names = Enum.GetNames (type);
+
+ foreach (string key in names) {
+ if (!memberTable.ContainsKey (key))
+ continue;
+
+ //Otherwise multiple values.
+ int val = (int) Enum.Parse (type, key);
+ if (val != 0 && (enumval & val) == val)
+ retval += " " + (string) memberTable[Enum.GetName (type, val)];
+ }
+
+ retval = retval.Trim ();
+
+ if (retval.Length == 0)
+ return null;
+
+ return retval;
+ }
+ else if (memberTable.ContainsKey (value.ToString ()))
+ return (string) memberTable[value.ToString()];
+ else
+ return null;
+ }
+ else
+ throw new Exception ("Unknown Enumeration");
+ }
+ #endregion
+ if (value is byte[])
+ return XmlCustomFormatter.FromByteArrayHex((byte[])value);
+ if (value is Guid)
+ return XmlConvert.ToString((Guid)value);
+ if(value is DateTime)
+ return XmlConvert.ToString((DateTime)value);
+ if(value is TimeSpan)
+ return XmlConvert.ToString((TimeSpan)value);
+ if(value is bool)
+ return XmlConvert.ToString((bool)value);
+ if(value is byte)
+ return XmlConvert.ToString((byte)value);
+ if(value is char)
+ return XmlCustomFormatter.FromChar((char)value);
+ if(value is decimal)
+ return XmlConvert.ToString((decimal)value);
+ if(value is double)
+ return XmlConvert.ToString((double)value);
+ if(value is short)
+ return XmlConvert.ToString((short)value);
+ if(value is int)
+ return XmlConvert.ToString((int)value);
+ if(value is long)
+ return XmlConvert.ToString((long)value);
+ if(value is sbyte)
+ return XmlConvert.ToString((sbyte)value);
+ if(value is float)
+ return XmlConvert.ToString((float)value);
+ if(value is ushort)
+ return XmlConvert.ToString((ushort)value);
+ if(value is uint)
+ return XmlConvert.ToString((uint)value);
+ if(value is ulong)
+ return XmlConvert.ToString((ulong)value);
+ if (value is XmlQualifiedName) {
+ if (((XmlQualifiedName) value).IsEmpty)
+ return null;
+ }
+ return (value == null) ? null : value.ToString ();
+ }
+
+ [MonoTODO ("Remove FIXMEs")]
+ private static void ProcessAttributes (XmlAttributes attrs, Hashtable memberTable)
+ {
+ if (attrs.XmlAnyAttribute != null) {
+ // FIXME
+ }
+ foreach (XmlAnyElementAttribute anyelem in attrs.XmlAnyElements)
+ memberTable.Add (new XmlQualifiedName (anyelem.Name, anyelem.Namespace), attrs);
+
+ if (attrs.XmlArray != null) {
+ // FIXME
+ }
+
+ foreach (XmlArrayItemAttribute item in attrs.XmlArrayItems)
+ memberTable.Add (new XmlQualifiedName (item.ElementName, item.Namespace), attrs);
+
+ if (attrs.XmlAttribute != null)
+ memberTable.Add (new XmlQualifiedName (attrs.XmlAttribute.AttributeName,attrs.XmlAttribute.Namespace), attrs);
+
+ if (attrs.XmlChoiceIdentifier != null) {
+ // FIXME
+ }
+
+ foreach (XmlElementAttribute elem in attrs.XmlElements)
+ memberTable.Add (new XmlQualifiedName (elem.ElementName, elem.Namespace), attrs);
+
+ if (attrs.XmlEnum != null) {
+ // FIXME
+ }
+
+ if (attrs.XmlType != null)
+ memberTable.Add (new XmlQualifiedName (attrs.XmlType.TypeName, attrs.XmlType.Namespace), attrs);
+ }
+
+ private bool Implements (Type type, Type interfaceType)
+ {
+ return (type.GetInterface (interfaceType.Name) == interfaceType);
+ }
+
+ private static void BubbleSort (ArrayList array, IComparer comparer)
+ {
+ int len = array.Count;
+ object obj1, obj2;
+ for (int i=0; i < len; i++) {
+ for (int j=0; j < len -i -1; j++) {
+ obj1 = array[j];
+ obj2 = array[j+1];
+ if (comparer.Compare (obj2 , obj1 ) < 0) {
+ array[j] = obj2;
+ array[j+1] = obj1;
+ }
+ }
+ }
+ }
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs
new file mode 100644
index 00000000000..744026ae201
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs
@@ -0,0 +1,76 @@
+//
+// XmlSerializerNamespaces.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlSerializerNamespaces.
+ /// </summary>
+ public class XmlSerializerNamespaces
+ {
+ private Hashtable namespaces;
+
+ public XmlSerializerNamespaces ()
+ {
+ namespaces = new Hashtable ();
+ }
+
+ public XmlSerializerNamespaces(XmlQualifiedName[] namespaces)
+ : this()
+ {
+ foreach(XmlQualifiedName qname in namespaces)
+ {
+ this.namespaces[qname.Name] = qname;
+ }
+ }
+
+ public XmlSerializerNamespaces(XmlSerializerNamespaces namespaces)
+ : this(namespaces.ToArray())
+ {}
+
+ public void Add (string prefix, string ns)
+ {
+ XmlQualifiedName qname = new XmlQualifiedName(prefix,ns);
+ namespaces[qname.Name] = qname;
+ }
+
+ public XmlQualifiedName[] ToArray ()
+ {
+ XmlQualifiedName[] array = new XmlQualifiedName[namespaces.Count];
+ namespaces.Values.CopyTo(array,0);
+ return array;
+ }
+
+ public int Count
+ {
+ get{ return namespaces.Count; }
+ }
+
+ internal string GetPrefix(string Ns)
+ {
+ foreach(string prefix in namespaces.Keys)
+ {
+ if(Ns == ((XmlQualifiedName)namespaces[prefix]).Namespace)
+ return prefix;
+ }
+ return null;
+ }
+
+ internal Hashtable Namespaces
+ {
+ get {
+ return namespaces;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs
new file mode 100644
index 00000000000..c45c61cc2c6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs
@@ -0,0 +1,61 @@
+//
+// XmlTextAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlTextAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlTextAttribute : Attribute
+ {
+ private string dataType;
+ private Type type;
+ private int order;
+
+ public XmlTextAttribute ()
+ {
+ }
+
+ public XmlTextAttribute (Type type)
+ {
+ Type = type;
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public Type Type
+ {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ /// <summary>
+ /// Specifies Order in which Memberswill be serialized as Elements.
+ /// </summary>
+ internal int Order
+ {
+ get{ return order; }
+ set{ order = value; }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs
new file mode 100644
index 00000000000..dd8ebacb162
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs
@@ -0,0 +1,60 @@
+//
+// XmlTypeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlTypeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface)]
+ public class XmlTypeAttribute : Attribute
+ {
+ private bool includeInSchema;
+ private string ns;
+ private string typeName;
+
+ public XmlTypeAttribute ()
+ {
+ }
+
+ public XmlTypeAttribute (string typeName)
+ {
+ TypeName = typeName;
+ }
+
+ public bool IncludeInSchema {
+ get {
+ return includeInSchema;
+ }
+ set {
+ includeInSchema = value;
+ }
+ }
+
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ public string TypeName {
+ get {
+ return typeName;
+ }
+ set {
+ typeName = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
new file mode 100644
index 00000000000..ff9c9b7b4f0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
@@ -0,0 +1,50 @@
+//
+// XmlTypeMapping.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlTypeMapping.
+ /// </summary>
+ public class XmlTypeMapping : XmlMapping
+ {
+ private string elementName;
+ private string ns;
+ private string typeFullName;
+ private string typeName;
+
+ internal XmlTypeMapping(string elementName, string ns, string typeFullName, string typeName)
+ {
+ this.elementName = elementName;
+ this.ns = ns;
+ this.typeFullName = typeFullName;
+ this.typeName = typeName;
+ }
+
+ public string ElementName
+ {
+ get { return elementName; }
+ }
+ public string Namespace
+ {
+ get { return ns; }
+ }
+ public string TypeFullName
+ {
+ get { return typeFullName; }
+ }
+ public string TypeName
+ {
+ get { return typeName; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
new file mode 100644
index 00000000000..de38e95c0ce
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
@@ -0,0 +1,183 @@
+2003-01-02 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * Tokenizer.cs : Fixed ParseIdentifier to allow digits.
+ (It should be a temporary fix.)
+
+2002-09-22 Nick Drochak <ndrochak@gol.com>
+
+ * Parser.cs: Remove extraneous "using" that was stopping the build.
+
+2002-09-21 Piers Haken <piersh@friskit.com>
+
+ * XPathException: implementation
+ * Expression.cs:
+ * Iterator.cs:
+ * Parser.jay:
+ * Tokenizer.jay:
+ * XPathNavigator.jay:
+ use XPathException.
+
+2002-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Parser.cs: commented out non-existent namespace (it compiles fine
+ with mcs because of a bug that is already on bugzilla).
+
+2002-09-12 Piers Haken <piersh@friskit.com>
+
+ * Tokenizer.cs: fix parsing numbers that start with '.'
+ * DefaultContext.cs: use MS-compatible formatting of doubles
+
+2002-09-12 Piers Haken <piersh@friskit.com>
+
+ * Iterator.cs: added NullIterator to handle unspecified contexts
+ * XPathNavigator.cs: use NullIterator insted of SelfIterator when context is unspecified.
+ * XPathNodeIterator.cs: change default _count to -1 to prevent recalculations for NullIterators
+
+2002-09-12 Piers Haken <piersh@friskit.com>
+
+ * Expression.cs, Parser.jay: allow ExprSLASH to take a generic expression as its left argument.
+ * Iterator.cs: fix SlashIterator.Clone() when _iterRight is null.
+ * DefaultContext.cs: fix id() return type.
+
+2002-09-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultContext.cs: fixed bug #28840.
+ * Expression.cs: added FIXME.
+
+2002-08-17 Jason Diamond <jason@injektilo.org>
+
+ * XPathNavigator.cs: Fixed matching on patterns that look like
+ absolute XPath expressions.
+
+2002-08-17 Jason Diamond <jason@injektilo.org>
+
+ * XPathNavigator.cs: Added naive (but working) implementation of
+ Matches.
+
+2002-07-31 Piers Haken <piersh@friskit.com>
+
+ * XPathDocument.cs: simple, XmlDocument-based implementation
+
+2002-07-25 Piers Haken <piersh@friskit.com>
+
+ * DefaultContext.cs: implement XPathFunctionName 'name()' function.
+
+2002-07-17 Piers Haken <piersh@friskit.com>
+
+ * DefaultContext.cs: implement 'string-length()', 'normalize-space()'
+ * Parser.jay: remove redundant production
+ * Expression.cs: add switches for debugging under VS.NET
+
+2002-07-17 Piers Haken <piersh@friskit.com>
+
+ * Expression.cs: implement nodeset/nodeset comparisons (non-optimal)
+
+2002-07-15 Piers Haken <piersh@friskit.com>
+
+ * Iterator.cs:
+ - rename UnionIterator to MergedIterator,
+ - create new UnionIterator to implment uniqueness for '|' operator
+ - fix position bug in ArrayListIterator.Clone()
+ * Expression.cs: use new UnionIterator constructor syntax
+
+2002-07-12 Piers Haken <piersh@friskit.com>
+
+ * Iterator.cs: PredicateIterator: handle numeric predicates
+ * Parser.jay: add some debugging support: yyparseDebug
+ * Tokenizer.cs: cleanup, include '-' chars in identifier tokens
+
+2002-06-29 Piers Haken <piersh@friskit.com>
+
+ * Expression.cs:
+ - remove dead code
+ - NodeTest uses XPathResultType instead of internal NodeTestTypes enum
+ - remove NodeTestTypes enum
+ - remove NodeTestTypeAny (functionality provided by base now)
+ - fix ExprStep to handle wildcard QNames
+ * Parser.jay:
+ - moved to Mono.Xml.XPath namespace
+ - use XPathResultType
+ - handle wildcard QNames
+
+ * Tokenizer.cs: moved to Mono.Xml.XPath namespace
+
+ * XPathNavigator.cs: implement
+ - IsDescendant
+ - SelectAncestors
+ - SelectDescendants
+ - SelectChildren
+
+ * XPathResultType.cs: fix enum values
+
+2002-06-24 Jason Diamond <jason@injektilo.org>
+
+ * XPathScanner.cs: Removed.
+
+2002-06-24 Dick Porter <dick@ximian.com>
+
+ * XmlCaseOrder.cs: Fix namespace
+
+2002-06-23 Piers Haken <piersh@friskit.com>
+
+ * DefaultContext.cs: implemented XPathFUnctionId
+ * Iterator.cs: new ArrayListIterator for id() support
+
+2002-06-23 Piers Haken <piersh@friskit.com>
+
+ * XPathNavigator.cs: implement:
+ - Compile
+ - Evaluate
+ - Clone
+ - Select
+ - ToString
+ - some forwarding methods
+
+ * XPathNodeIterator: implement caching Count
+
+ * Tokenizer.cs: new XPath tokenizer
+ * Parser.jay: new XPath grammar
+ * Parser.cs: new precompiled XPath grammar
+ * Expression.cs: new XPath expression objects
+ * Iterator.cs: new XPath result/context objects
+ * DefaultContext.cs: new XPath function binding context
+
+2002-05-08 Tim Coleman <tim@timcoleman.com>
+ * XPathDocument.cs:
+ * XPathException.cs: New stub files added.
+
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlCaseOrder.cs: Moved to here from System.Xml.
+
+2002-03-26 Jason Diamond <jason@injektilo.org>
+
+ * XPathScanner.cs: Now handles name tests with wildacards. Abbreviated
+ steps. Both absolution and relative abbreviated location paths.
+
+2002-03-25 Jason Diamond <jason@injektilo.org>
+
+ * XPathScanner.cs: Added new file. This class is supposed to be internal
+ but that would make it impossible to test.
+
+2002-03-08 Duncan Mak <duncan@ximian.com>
+
+ * XPathNamespaceScope.cs:
+ * XPathNodeType.cs:
+ * XPathResultType.cs:
+ * XmlDataType.cs:
+ * XmlSortOrder.cs: Used EnumCheck and realigned elements to be compatible with MS
+ implementation. XPathResultType is interesting as EnumCheck does
+ not show the Navigator element, but shows the String element twice.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlDataType.cs, XmlSortOrder.cs, XPathNodeType.cs: Added files.
+
+2002-03-06 Jason Diamond <jason@injektilo.org>
+
+ * ChangeLog: Added to this directory.
+
+ * XPathExpression.cs, XPathNamespaceScope.cs, XPathNodeIterator.cs,
+ XPathResultType.cs: New files.
+
+ * XPathNavigator.cs: Stubbed out all properties and methods.
diff --git a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs
new file mode 100644
index 00000000000..ed27d168858
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs
@@ -0,0 +1,618 @@
+//
+// System.Xml.XPath.DefaultContext & support classes
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2002 Piers Haken
+//
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+
+namespace System.Xml.XPath
+{
+ /// <summary>
+ /// Summary description for DefaultContext.
+ /// </summary>
+ internal class DefaultContext : XsltContext
+ {
+ protected static Hashtable _htFunctions = new Hashtable ();
+
+ static DefaultContext()
+ {
+ Add (new XPathFunctionLast ());
+ Add (new XPathFunctionPosition ());
+ Add (new XPathFunctionCount ());
+ Add (new XPathFunctionId ());
+ Add (new XPathFunctionLocalName ());
+ Add (new XPathFunctionNamespaceUri ());
+ Add (new XPathFunctionName ());
+ Add (new XPathFunctionString ());
+ Add (new XPathFunctionConcat ());
+ Add (new XPathFunctionStartsWith ());
+ Add (new XPathFunctionContains ());
+ Add (new XPathFunctionSubstringBefore ());
+ Add (new XPathFunctionSubstringAfter ());
+ Add (new XPathFunctionSubstring ());
+ Add (new XPathFunctionStringLength ());
+ Add (new XPathFunctionNormalizeSpace ());
+ Add (new XPathFunctionTranslate ());
+ Add (new XPathFunctionBoolean ());
+ Add (new XPathFunctionNot ());
+ Add (new XPathFunctionTrue ());
+ Add (new XPathFunctionFalse ());
+ Add (new XPathFunctionLang ());
+ Add (new XPathFunctionNumber ());
+ Add (new XPathFunctionSum ());
+ Add (new XPathFunctionFloor ());
+ Add (new XPathFunctionCeil ());
+ Add (new XPathFunctionRound ());
+ }
+
+ [MonoTODO]
+ public override IXsltContextFunction ResolveFunction (string prefix, string name, XPathResultType[] ArgTypes)
+ {
+ // match the prefix
+ if (prefix != null && prefix != "") // TODO: should we allow some namespaces here?
+ return null;
+
+ // match the function name
+ XPathFunction fn = (XPathFunction) _htFunctions [name];
+ if (fn == null)
+ return null;
+
+ // check the number of arguments
+ int cArgs = ArgTypes.Length;
+ if (cArgs < fn.Minargs || cArgs > fn.Maxargs)
+ return null;
+
+ // check the types of the arguments
+ XPathResultType [] rgTypes = fn.ArgTypes;
+ if (rgTypes == null)
+ {
+ if (cArgs != 0)
+ return null;
+ }
+ else
+ {
+ int cTypes = rgTypes.Length;
+ for (int iArg = 0; iArg < cArgs; iArg ++)
+ {
+ XPathResultType typeRequested = ArgTypes [iArg];
+ XPathResultType typeDefined = (iArg >= cTypes) ? rgTypes [cTypes - 1] : rgTypes [iArg];
+ if (typeDefined != XPathResultType.Any && typeDefined != typeRequested)
+ return null;
+ }
+ }
+ return fn;
+ }
+ public override IXsltContextVariable ResolveVariable (string prefix, string name)
+ {
+ return null;
+ }
+ [MonoTODO]
+ public override int CompareDocument (string baseUri, string nextBaseUri) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public override bool PreserveWhitespace (XPathNavigator nav) { throw new NotImplementedException (); }
+ [MonoTODO]
+ public override bool Whitespace { get { throw new NotImplementedException (); }}
+ protected static void Add (XPathFunction fn)
+ {
+ _htFunctions.Add (fn.Name, fn);
+ }
+ }
+
+ internal class XPathFunctions
+ {
+ public static bool ToBoolean (object arg)
+ {
+ if (arg == null)
+ throw new ArgumentNullException ();
+ if (arg is bool)
+ return (bool) arg;
+ if (arg is double)
+ {
+ double dArg = (double) arg;
+ return (dArg != 0.0 && !double.IsNaN (dArg));
+ }
+ if (arg is string)
+ return ((string) arg).Length != 0;
+ if (arg is BaseIterator)
+ {
+ BaseIterator iter = (BaseIterator) arg;
+ return iter.MoveNext ();
+ }
+ throw new ArgumentException ();
+ }
+ [MonoTODO]
+ public static string ToString (object arg)
+ {
+ if (arg == null)
+ throw new ArgumentNullException ();
+ if (arg is string)
+ return (string) arg;
+ if (arg is bool)
+ return ((bool) arg) ? "true" : "false";
+ if (arg is double)
+ return ((double) arg).ToString ("R", System.Globalization.NumberFormatInfo.InvariantInfo);
+ if (arg is BaseIterator)
+ {
+ BaseIterator iter = (BaseIterator) arg;
+ if (!iter.MoveNext ())
+ return "";
+ return iter.Current.Value;
+ }
+ throw new ArgumentException ();
+ }
+ [MonoTODO]
+ public static double ToNumber (object arg)
+ {
+ if (arg == null)
+ throw new ArgumentNullException ();
+ if (arg is BaseIterator)
+ arg = ToString (arg); // follow on
+ if (arg is string)
+ return XmlConvert.ToDouble ((string) arg); // TODO: spec? convert string to number
+ if (arg is double)
+ return (double) arg;
+ if (arg is bool)
+ return Convert.ToDouble ((bool) arg);
+ throw new ArgumentException ();
+ }
+ }
+
+ internal abstract class XPathFunction : IXsltContextFunction
+ {
+ public abstract XPathResultType ReturnType { get; }
+ public abstract int Minargs { get; }
+ public abstract int Maxargs { get; }
+ public abstract XPathResultType [] ArgTypes { get; }
+ public object Invoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return TypesafeInvoke (xsltContext, args, docContext);
+ }
+
+ public abstract string Name { get; }
+ public abstract object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext);
+ }
+
+ internal class XPathFunctionLast : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 0; }}
+ public override XPathResultType [] ArgTypes { get { return null; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ throw new NotImplementedException (); // special-cased
+ }
+ public override string Name { get { return "last"; }}
+ }
+ internal class XPathFunctionPosition : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 0; }}
+ public override XPathResultType [] ArgTypes { get { return null; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ throw new NotImplementedException (); // special-cased
+ }
+ public override string Name { get { return "position"; }}
+ }
+ internal class XPathFunctionCount : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return ((BaseIterator) args [0]).Count;
+ }
+ public override string Name { get { return "count"; }}
+ }
+ internal class XPathFunctionId : XPathFunction
+ {
+ private static char [] rgchWhitespace = {' ', '\t', '\r', '\n'};
+ public override XPathResultType ReturnType { get { return XPathResultType.NodeSet; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ String strArgs;
+ BaseIterator iter = args [0] as BaseIterator;
+ if (iter != null)
+ {
+ strArgs = "";
+ while (!iter.MoveNext ())
+ strArgs += iter.Current.Value + " ";
+ }
+ else
+ strArgs = XPathFunctions.ToString (args [0]);
+ string [] rgstrArgs = strArgs.Split (rgchWhitespace);
+ ArrayList rgNodes = new ArrayList ();
+ foreach (string strArg in rgstrArgs)
+ {
+ if (docContext.MoveToId (strArg))
+ rgNodes.Add (docContext.Clone ());
+ }
+ return new ArrayListIterator (iter, rgNodes);
+ }
+ public override string Name { get { return "id"; }}
+ }
+ internal class XPathFunctionLocalName : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.NodeSet; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ BaseIterator iter = (args.Length == 1) ? ((BaseIterator) args [0]) : new SelfIterator (docContext, xsltContext);
+ if (iter == null || !iter.MoveNext ())
+ return "";
+ return iter.Current.LocalName;
+ }
+ public override string Name { get { return "local-name"; }}
+ }
+ internal class XPathFunctionNamespaceUri : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ BaseIterator iter = (args.Length == 1) ? ((BaseIterator) args [0]) : new SelfIterator (docContext, xsltContext);
+ if (iter == null || !iter.MoveNext ())
+ return "";
+ return iter.Current.NamespaceURI; // TODO: should the namespace be expanded wrt. the given context?
+ }
+ public override string Name { get { return "namespace-uri"; }}
+ }
+ internal class XPathFunctionName : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ BaseIterator iter = (args.Length == 1) ? ((BaseIterator) args [0]) : new SelfIterator (docContext, xsltContext);
+ if (iter == null || !iter.MoveNext ())
+ return "";
+ return iter.Current.Name;
+ }
+ public override string Name { get { return "name"; }}
+ }
+ internal class XPathFunctionString : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return XPathFunctions.ToString (args [0]);
+ }
+ public override string Name { get { return "string"; }}
+ }
+ internal class XPathFunctionConcat : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 2; }}
+ public override int Maxargs { get { return int.MaxValue; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String, XPathResultType.String }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ String str = "";
+ foreach (string strArg in args)
+ str += strArg;
+ return str;
+ }
+ public override string Name { get { return "concat"; }}
+ }
+ internal class XPathFunctionStartsWith : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 2; }}
+ public override int Maxargs { get { return 2; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ string str1 = (string) args [0];
+ string str2 = (string) args [1];
+ return str1.StartsWith (str2);
+ }
+ public override string Name { get { return "starts-with"; }}
+ }
+ internal class XPathFunctionContains : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 2; }}
+ public override int Maxargs { get { return 2; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ string str1 = (string) args [0];
+ string str2 = (string) args [1];
+ return str1.IndexOf (str2) != -1;
+ }
+ public override string Name { get { return "contains"; }}
+ }
+ internal class XPathFunctionSubstringBefore : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 2; }}
+ public override int Maxargs { get { return 2; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ string str1 = (string) args [0];
+ string str2 = (string) args [1];
+ int ich = str1.IndexOf (str2);
+ if (ich <= 0)
+ return "";
+ return str1.Substring (0, ich);
+ }
+ public override string Name { get { return "substring-before"; }}
+ }
+ internal class XPathFunctionSubstringAfter : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 2; }}
+ public override int Maxargs { get { return 2; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ string str1 = (string) args [0];
+ string str2 = (string) args [1];
+ int ich = str1.IndexOf (str2);
+ if (ich <= 0)
+ return "";
+ return str1.Substring (ich + str2.Length);
+ }
+ public override string Name { get { return "substring-after"; }}
+ }
+ internal class XPathFunctionSubstring : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 2; }}
+ public override int Maxargs { get { return int.MaxValue; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String, XPathResultType.String }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ // TODO: check this, what the hell were they smoking?
+ string str = (string) args [0];
+ double ich = Math.Round ((double) args [1]) - 1;
+ if (Double.IsNaN (ich) || ich >= (double) str.Length)
+ return "";
+
+ if (args.Length == 2)
+ {
+ if (ich < 0)
+ ich = 0.0;
+ return str.Substring ((int) ich);
+ }
+ else
+ {
+ double cch = Math.Round ((double) args [2]);
+ if (Double.IsNaN (cch))
+ return "";
+ if (ich < 0.0 || cch < 0.0)
+ {
+ cch = ich + cch;
+ if (cch <= 0.0)
+ return "";
+ ich = 0.0;
+ }
+ double cchMax = (double) str.Length - ich;
+ if (cch > cchMax)
+ cch = cchMax;
+ return str.Substring ((int) ich, (int) cch);
+ }
+ }
+ public override string Name { get { return "substring"; }}
+ }
+ internal class XPathFunctionStringLength : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ string str;
+ if (args.Length == 1)
+ str = (string) args [0];
+ else
+ str = docContext.Value;
+ return (double) str.Length;
+ }
+ public override string Name { get { return "string-length"; }}
+ }
+ internal class XPathFunctionNormalizeSpace : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ string str;
+ if (args.Length == 1)
+ str = (string) args [0];
+ else
+ str = docContext.Value;
+ System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+ bool fSpace = false;
+ foreach (char ch in str)
+ {
+ if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
+ {
+ fSpace = true;
+ }
+ else
+ {
+ if (fSpace)
+ {
+ fSpace = false;
+ if (sb.Length > 0)
+ sb.Append (' ');
+ }
+ sb.Append (ch);
+ }
+ }
+ return sb.ToString ();
+ }
+ public override string Name { get { return "normalize-space"; }}
+ }
+ internal class XPathFunctionTranslate : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override int Minargs { get { return 3; }}
+ public override int Maxargs { get { return 3; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String, XPathResultType.String }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ throw new NotImplementedException ();
+ }
+ public override string Name { get { return "translate"; }}
+ }
+ internal class XPathFunctionBoolean : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return XPathFunctions.ToBoolean (args [0]);
+ }
+ public override string Name { get { return "boolean"; }}
+ }
+ internal class XPathFunctionNot : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return !(XPathFunctions.ToBoolean (args [0]));
+ }
+ public override string Name { get { return "not"; }}
+ }
+ internal class XPathFunctionTrue : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 0; }}
+ public override XPathResultType [] ArgTypes { get { return null; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return true;
+ }
+ public override string Name { get { return "true"; }}
+ }
+ internal class XPathFunctionFalse : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 0; }}
+ public override XPathResultType [] ArgTypes { get { return null; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return false;
+ }
+ public override string Name { get { return "false"; }}
+ }
+ internal class XPathFunctionLang : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ throw new NotImplementedException ();
+ }
+ public override string Name { get { return "lang"; }}
+ }
+ internal class XPathFunctionNumber : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 0; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return XPathFunctions.ToNumber (args [0]);
+ }
+ public override string Name { get { return "number"; }}
+ }
+ internal class XPathFunctionSum : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }}
+ [MonoTODO]
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ throw new NotImplementedException ();
+ }
+ public override string Name { get { return "sum"; }}
+ }
+ internal class XPathFunctionFloor : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Number }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return Math.Floor ((double) args [0]);
+ }
+ public override string Name { get { return "floor"; }}
+ }
+ internal class XPathFunctionCeil : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Number }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ return Math.Ceiling ((double) args [0]);
+ }
+ public override string Name { get { return "ceil"; }}
+ }
+ internal class XPathFunctionRound : XPathFunction
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override int Minargs { get { return 1; }}
+ public override int Maxargs { get { return 1; }}
+ public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Number }; }}
+ public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext)
+ {
+ double arg = (double) args [0];
+ if (arg < -0.5 || arg > 0)
+ return Math.Floor (arg + 0.5);
+ return Math.Round (arg);
+ }
+ public override string Name { get { return "round"; }}
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/Expression.cs b/mcs/class/System.XML/System.Xml.XPath/Expression.cs
new file mode 100644
index 00000000000..fe1d25e9ba1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/Expression.cs
@@ -0,0 +1,1009 @@
+//
+// System.Xml.XPath.XPathExpression support classes
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2002 Piers Haken
+//
+using System;
+using System.IO;
+using System.Collections;
+using System.Xml;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+
+namespace System.Xml.XPath
+{
+#if XPATH_DEBUG
+ internal class CompiledExpression : Test.Xml.XPath.XPathExpression
+#else
+ internal class CompiledExpression : XPathExpression
+#endif
+ {
+ protected XmlNamespaceManager _nsm;
+ protected Expression _expr;
+
+ public CompiledExpression (Expression expr)
+ {
+ _expr = expr;
+ }
+ private CompiledExpression (CompiledExpression other)
+ {
+ _nsm = other._nsm;
+ _expr = other._expr;
+ }
+#if XPATH_DEBUG
+ public override Test.Xml.XPath.XPathExpression Clone () { return new CompiledExpression (this); }
+#else
+ public override XPathExpression Clone () { return new CompiledExpression (this); }
+#endif
+
+ public override void SetContext (XmlNamespaceManager nsManager)
+ {
+ _nsm = nsManager;
+ }
+ public override String Expression { get { return _expr.ToString (); }}
+ public override XPathResultType ReturnType { get { return _expr.ReturnType; }}
+ [MonoTODO]
+ public override void AddSort (Object obj, IComparer cmp)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override void AddSort(object obj, XmlSortOrder sortOrder, XmlCaseOrder caseOrder, string str, XmlDataType type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object Evaluate (BaseIterator iter)
+ {
+ try
+ {
+ return _expr.Evaluate (iter);
+ }
+ catch (XPathException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new XPathException ("Error during evaluation", e);
+ }
+ }
+ public XPathNodeIterator EvaluateNodeSet (BaseIterator iter)
+ {
+ try
+ {
+ return _expr.EvaluateNodeSet (iter);
+ }
+ catch (XPathException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new XPathException ("Error during evaluation", e);
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// Summary description for Expression.
+ /// </summary>
+ internal abstract class Expression
+ {
+ public Expression ()
+ {
+ }
+ public abstract XPathResultType ReturnType { get; }
+ public virtual XPathResultType GetReturnType (BaseIterator iter) { return ReturnType; }
+ public virtual object Evaluate (BaseIterator iter) { return null; }
+
+ public BaseIterator EvaluateNodeSet (BaseIterator iter)
+ {
+ if (GetReturnType (iter) == XPathResultType.NodeSet)
+ return (BaseIterator) Evaluate (iter);
+ throw new XPathException ("expected nodeset: "+ToString ());
+ }
+ [MonoTODO]
+ public double EvaluateNumber (BaseIterator iter)
+ {
+ object result;
+ XPathResultType type = GetReturnType (iter);
+ if (type == XPathResultType.NodeSet)
+ {
+ result = EvaluateString (iter);
+ type = XPathResultType.String;
+ }
+ else
+ result = Evaluate (iter);
+
+ switch (type)
+ {
+ case XPathResultType.Number:
+ return (double) result;
+ case XPathResultType.Boolean:
+ return Convert.ToDouble ((bool) result);
+ case XPathResultType.String:
+ return XmlConvert.ToDouble ((string) result); // TODO: spec? convert string to number
+ default:
+ throw new XPathException ("invalid node type"); // TODO: handle other types
+ }
+ }
+ [MonoTODO]
+ public string EvaluateString (BaseIterator iter)
+ {
+ object result = Evaluate (iter);
+ switch (GetReturnType (iter))
+ {
+ case XPathResultType.Number:
+ return (string) XmlConvert.ToString ((double) result); // TODO: spec? convert number to string
+ case XPathResultType.Boolean:
+ return ((bool) result) ? "true" : "false";
+ case XPathResultType.String:
+ return (string) result;
+ case XPathResultType.NodeSet:
+ {
+ BaseIterator iterResult = (BaseIterator) result;
+ if (iterResult == null || !iterResult.MoveNext ())
+ return "";
+ return iterResult.Current.Value;
+ }
+ default:
+ throw new XPathException ("invalid node type"); // TODO: handle other types
+ }
+ }
+ [MonoTODO]
+ public bool EvaluateBoolean (BaseIterator iter)
+ {
+ object result = Evaluate (iter);
+ switch (GetReturnType (iter))
+ {
+ case XPathResultType.Number:
+ {
+ double num = (double) result;
+ return (num != 0.0 && num != -0.0 && num != Double.NaN);
+ }
+ case XPathResultType.Boolean:
+ return (bool) result;
+ case XPathResultType.String:
+ return ((string) result).Length != 0;
+ case XPathResultType.NodeSet:
+ {
+ BaseIterator iterResult = (BaseIterator) result;
+ return (iterResult != null && iterResult.MoveNext ());
+ }
+ default:
+ throw new XPathException ("invalid node type"); // TODO: handle other types
+ }
+ }
+ }
+
+ internal abstract class ExprBinary : Expression
+ {
+ protected Expression _left, _right;
+
+ public ExprBinary (Expression left, Expression right)
+ {
+ _left = left;
+ _right = right;
+ }
+ public override String ToString ()
+ {
+ return _left.ToString () + ' ' + Operator + ' ' + _right.ToString ();
+ }
+ protected abstract String Operator { get; }
+ }
+
+ internal abstract class ExprBoolean : ExprBinary
+ {
+ public ExprBoolean (Expression left, Expression right) : base (left, right) {}
+ public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }}
+ }
+
+ internal class ExprOR : ExprBoolean
+ {
+ public ExprOR (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "or"; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ if (_left.EvaluateBoolean (iter))
+ return true;
+ return _right.EvaluateBoolean (iter);
+ }
+ }
+ internal class ExprAND : ExprBoolean
+ {
+ public ExprAND (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "and"; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ if (!_left.EvaluateBoolean (iter))
+ return false;
+ return _right.EvaluateBoolean (iter);
+ }
+ }
+
+ internal abstract class EqualityExpr : ExprBoolean
+ {
+ public EqualityExpr (Expression left, Expression right) : base (left, right) {}
+ [MonoTODO]
+ public override object Evaluate (BaseIterator iter)
+ {
+ XPathResultType typeL = _left.GetReturnType (iter);
+ XPathResultType typeR = _right.GetReturnType (iter);
+ if (typeL == XPathResultType.NodeSet || typeR == XPathResultType.NodeSet)
+ {
+ Expression left, right;
+ if (typeL != XPathResultType.NodeSet)
+ {
+ left = _right;
+ right = _left;
+ XPathResultType typeTmp = typeL;
+ typeL = typeR;
+ typeR = typeTmp;
+ }
+ else
+ {
+ left = _left;
+ right = _right;
+ }
+ if (typeR == XPathResultType.Boolean)
+ {
+ bool fL = left.EvaluateBoolean (iter);
+ bool fR = right.EvaluateBoolean (iter);
+ return Compare (Convert.ToDouble (fL), Convert.ToDouble (fR));
+ }
+ else
+ {
+ BaseIterator iterL = left.EvaluateNodeSet (iter);
+ if (typeR == XPathResultType.Number)
+ {
+ double dR = right.EvaluateNumber (iter);
+ while (iterL.MoveNext ())
+ if (Compare (XPathFunctions.ToNumber (iterL.Current.Value), dR))
+ return true;
+ }
+ else if (typeR == XPathResultType.String)
+ {
+ string strR = right.EvaluateString (iter);
+ while (iterL.MoveNext ())
+ if (Compare (iterL.Current.Value, strR))
+ return true;
+ }
+ else if (typeR == XPathResultType.NodeSet)
+ {
+ BaseIterator iterR = right.EvaluateNodeSet (iter);
+ ArrayList rgNodesL = new ArrayList ();
+ while (iterL.MoveNext ())
+ rgNodesL.Add (XPathFunctions.ToString (iterL.Current.Value));
+ while (iterR.MoveNext ())
+ {
+ string strR = XPathFunctions.ToString (iterR.Current.Value);
+ foreach (string strL in rgNodesL)
+ if (Compare (strL, strR))
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ else if (typeL == XPathResultType.Boolean || typeR == XPathResultType.Boolean)
+ return Compare (_left.EvaluateBoolean (iter), _right.EvaluateBoolean (iter));
+ else if (typeL == XPathResultType.Number || typeR == XPathResultType.Number)
+ return Compare (_left.EvaluateNumber (iter), _right.EvaluateNumber (iter));
+ else
+ return Compare (_left.EvaluateString (iter), _right.EvaluateString (iter));
+ }
+ [MonoTODO]
+ public abstract bool Compare (object arg1, object arg2); // TODO: should probably have type-safe methods here
+ }
+
+ internal class ExprEQ : EqualityExpr
+ {
+ public ExprEQ (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "="; }}
+ public override bool Compare (object arg1, object arg2)
+ {
+ return arg1.Equals (arg2);
+ }
+ }
+ internal class ExprNE : EqualityExpr
+ {
+ public ExprNE (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "!="; }}
+ public override bool Compare (object arg1, object arg2)
+ {
+ return !arg1.Equals (arg2);
+ }
+ }
+
+ internal abstract class RelationalExpr : ExprBoolean
+ {
+ public RelationalExpr (Expression left, Expression right) : base (left, right) {}
+ [MonoTODO]
+ public override object Evaluate (BaseIterator iter)
+ {
+ XPathResultType typeL = _left.GetReturnType (iter);
+ XPathResultType typeR = _right.GetReturnType (iter);
+ if (typeL == XPathResultType.NodeSet || typeR == XPathResultType.NodeSet)
+ {
+ bool fReverse = false;
+ Expression left, right;
+ if (typeL != XPathResultType.NodeSet)
+ {
+ fReverse = true;
+ left = _right;
+ right = _left;
+ XPathResultType typeTmp = typeL;
+ typeL = typeR;
+ typeR = typeTmp;
+ }
+ else
+ {
+ left = _left;
+ right = _right;
+ }
+ if (typeR == XPathResultType.Boolean)
+ {
+ bool fL = left.EvaluateBoolean (iter);
+ bool fR = right.EvaluateBoolean (iter);
+ return Compare (Convert.ToDouble (fL), Convert.ToDouble (fR), fReverse);
+ }
+ else
+ {
+ BaseIterator iterL = left.EvaluateNodeSet (iter);
+ if (typeR == XPathResultType.Number || typeR == XPathResultType.String)
+ {
+ double dR = right.EvaluateNumber (iter);
+ while (iterL.MoveNext ())
+ if (Compare (XPathFunctions.ToNumber (iterL.Current.Value), dR, fReverse))
+ return true;
+ }
+ else if (typeR == XPathResultType.NodeSet)
+ {
+ BaseIterator iterR = right.EvaluateNodeSet (iter);
+ ArrayList rgNodesL = new ArrayList ();
+ while (iterL.MoveNext ())
+ rgNodesL.Add (XPathFunctions.ToNumber (iterL.Current.Value));
+ while (iterR.MoveNext ())
+ {
+ double numR = XPathFunctions.ToNumber (iterR.Current.Value);
+ foreach (double numL in rgNodesL)
+ if (Compare (numL, numR))
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ else
+ return Compare (_left.EvaluateNumber (iter), _right.EvaluateNumber (iter));
+ }
+ public abstract bool Compare (double arg1, double arg2);
+ public bool Compare (double arg1, double arg2, bool fReverse)
+ {
+ if (fReverse)
+ return Compare (arg2, arg1);
+ else
+ return Compare (arg1, arg2);
+ }
+ }
+ internal class ExprGT : RelationalExpr
+ {
+ public ExprGT (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return ">"; }}
+ public override bool Compare (double arg1, double arg2)
+ {
+ return arg1 > arg2;
+ }
+ }
+ internal class ExprGE : RelationalExpr
+ {
+ public ExprGE (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return ">="; }}
+ public override bool Compare (double arg1, double arg2)
+ {
+ return arg1 >= arg2;
+ }
+ }
+ internal class ExprLT : RelationalExpr
+ {
+ public ExprLT (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "<"; }}
+ public override bool Compare (double arg1, double arg2)
+ {
+ return arg1 < arg2;
+ }
+ }
+ internal class ExprLE : RelationalExpr
+ {
+ public ExprLE (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "<="; }}
+ public override bool Compare (double arg1, double arg2)
+ {
+ return arg1 <= arg2;
+ }
+ }
+
+
+ internal abstract class ExprNumeric : ExprBinary
+ {
+ public ExprNumeric (Expression left, Expression right) : base (left, right) {}
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ }
+
+ internal class ExprPLUS : ExprNumeric
+ {
+ public ExprPLUS (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "+"; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _left.EvaluateNumber (iter) + _right.EvaluateNumber (iter);
+ }
+ }
+ internal class ExprMINUS : ExprNumeric
+ {
+ public ExprMINUS (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "-"; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _left.EvaluateNumber (iter) - _right.EvaluateNumber (iter);
+ }
+ }
+ internal class ExprMULT : ExprNumeric
+ {
+ public ExprMULT (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "*"; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _left.EvaluateNumber (iter) * _right.EvaluateNumber (iter);
+ }
+ }
+ internal class ExprDIV : ExprNumeric
+ {
+ public ExprDIV (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "/"; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _left.EvaluateNumber (iter) / _right.EvaluateNumber (iter);
+ }
+ }
+ internal class ExprMOD : ExprNumeric
+ {
+ public ExprMOD (Expression left, Expression right) : base (left, right) {}
+ protected override String Operator { get { return "%"; }}
+ [MonoTODO]
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _left.EvaluateNumber (iter) % _right.EvaluateNumber (iter); // TODO: spec?
+ }
+ }
+ internal class ExprNEG : Expression
+ {
+ Expression _expr;
+ public ExprNEG (Expression expr)
+ {
+ _expr = expr;
+ }
+ public override String ToString () { return "- " + _expr.ToString (); }
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return - _expr.EvaluateNumber (iter);
+ }
+ }
+
+
+ internal abstract class NodeSet : Expression
+ {
+ public override XPathResultType ReturnType { get { return XPathResultType.NodeSet; }}
+ }
+ internal class ExprUNION : NodeSet
+ {
+ protected Expression _left, _right;
+ public ExprUNION (NodeSet left, NodeSet right)
+ {
+ _left = left;
+ _right = right;
+ }
+ public override String ToString () { return _left.ToString ()+ " | " + _right.ToString (); }
+ public override object Evaluate (BaseIterator iter)
+ {
+ BaseIterator iterLeft = _left.EvaluateNodeSet (iter);
+ BaseIterator iterRight = _right.EvaluateNodeSet (iter);
+ return new UnionIterator (iter, iterLeft, iterRight);
+ }
+ }
+ internal class ExprSLASH : NodeSet
+ {
+ protected Expression _left, _right;
+ public ExprSLASH (Expression left, NodeSet right)
+ {
+ _left = left;
+ _right = right;
+ }
+ public override String ToString () { return _left.ToString ()+ "/" + _right.ToString (); }
+ public override object Evaluate (BaseIterator iter)
+ {
+ BaseIterator iterLeft = _left.EvaluateNodeSet (iter);
+ return new SlashIterator (iterLeft, _right);
+ }
+ }
+ internal class ExprRoot : NodeSet
+ {
+ public override String ToString () { return ""; }
+ public override object Evaluate (BaseIterator iter)
+ {
+ XPathNavigator navRoot = iter.Current.Clone ();
+ navRoot.MoveToRoot ();
+ return new SelfIterator (navRoot, iter.Context);
+ }
+ }
+
+ internal enum Axes
+ {
+ Ancestor,
+ AncestorOrSelf,
+ Attribute,
+ Child,
+ Descendant,
+ DescendantOrSelf,
+ Following,
+ FollowingSibling,
+ Namespace,
+ Parent,
+ Preceding,
+ PrecedingSibling,
+ Self,
+ }
+
+ internal class AxisSpecifier
+ {
+ protected Axes _axis;
+ public AxisSpecifier (Axes axis)
+ {
+ _axis = axis;
+ }
+ public XPathNodeType NodeType
+ {
+ get
+ {
+ switch (_axis)
+ {
+ case Axes.Namespace:
+ return XPathNodeType.Namespace;
+ case Axes.Attribute:
+ return XPathNodeType.Attribute;
+ default:
+ return XPathNodeType.Element;
+ }
+ }
+ }
+ public override string ToString ()
+ {
+ switch (_axis)
+ {
+ case Axes.Ancestor:
+ return "ancestor";
+ case Axes.AncestorOrSelf:
+ return "ancestor-or-self";
+ case Axes.Attribute:
+ return "attribute";
+ case Axes.Child:
+ return "child";
+ case Axes.Descendant:
+ return "descendant";
+ case Axes.DescendantOrSelf:
+ return "descendant-or-self";
+ case Axes.Following:
+ return "following";
+ case Axes.FollowingSibling:
+ return "following-sibling";
+ case Axes.Namespace:
+ return "namespace";
+ case Axes.Parent:
+ return "parent";
+ case Axes.Preceding:
+ return "preceeding";
+ case Axes.PrecedingSibling:
+ return "preceeding-sibling";
+ case Axes.Self:
+ return "self";
+ default:
+ throw new IndexOutOfRangeException ();
+ }
+ }
+ public Axes Axis { get { return _axis; }}
+ public virtual BaseIterator Evaluate (BaseIterator iter)
+ {
+ switch (_axis)
+ {
+ case Axes.Ancestor:
+ return new AncestorIterator (iter);
+ case Axes.AncestorOrSelf:
+ return new AncestorOrSelfIterator (iter);
+ case Axes.Attribute:
+ return new AttributeIterator (iter);
+ case Axes.Child:
+ return new ChildIterator (iter);
+ case Axes.Descendant:
+ return new DescendantIterator (iter);
+ case Axes.DescendantOrSelf:
+ return new DescendantOrSelfIterator (iter);
+ case Axes.Following:
+ return new FollowingIterator (iter);
+ case Axes.FollowingSibling:
+ return new FollowingSiblingIterator (iter);
+ case Axes.Namespace:
+ return new NamespaceIterator (iter);
+ case Axes.Parent:
+ return new ParentIterator (iter);
+ case Axes.Preceding:
+ return new PrecedingIterator (iter);
+ case Axes.PrecedingSibling:
+ return new PrecedingSiblingIterator (iter);
+ case Axes.Self:
+ return new SelfIterator (iter);
+ default:
+ throw new IndexOutOfRangeException ();
+ }
+ }
+ }
+
+ internal abstract class NodeTest
+ {
+ protected AxisSpecifier _axis;
+ public NodeTest (AxisSpecifier axis)
+ {
+ _axis = axis;
+ }
+ public NodeTest (Axes axis)
+ {
+ _axis = new AxisSpecifier (axis);
+ }
+ public abstract bool Match (XsltContext context, XPathNavigator nav);
+ public AxisSpecifier Axis { get { return _axis; }}
+ public virtual BaseIterator Evaluate (BaseIterator iter)
+ {
+ BaseIterator iterAxis = _axis.Evaluate (iter);
+ return new AxisIterator (iterAxis, this);
+ }
+ }
+
+ internal class NodeTypeTest : NodeTest
+ {
+ protected XPathNodeType _type;
+ protected String _param;
+ public NodeTypeTest (Axes axis) : base (axis)
+ {
+ _type = _axis.NodeType;
+ }
+ public NodeTypeTest (Axes axis, XPathNodeType type) : base (axis)
+ {
+ _type = type;
+ }
+ [MonoTODO]
+ public NodeTypeTest (Axes axis, XPathNodeType type, String param) : base (axis)
+ {
+ _type = type;
+ _param = param;
+ if (param != null && type != XPathNodeType.ProcessingInstruction)
+ throw new XPathException ("No argument allowed for "+ToString (_type)+"() test"); // TODO: better description
+ }
+ public override String ToString ()
+ {
+ String strType = ToString (_type);
+ if (_type == XPathNodeType.ProcessingInstruction && _param != null)
+ strType += "('" + _param + "')";
+ else
+ strType += "()";
+
+ return _axis.ToString () + "::" + strType;
+ }
+ private static String ToString (XPathNodeType type)
+ {
+ switch (type)
+ {
+ case XPathNodeType.Comment:
+ return "comment";
+ case XPathNodeType.Text:
+ return "text";
+ case XPathNodeType.ProcessingInstruction:
+ return "processing-instruction";
+ case XPathNodeType.All:
+ case XPathNodeType.Attribute:
+ case XPathNodeType.Element:
+ return "node";
+ default:
+ throw new NotImplementedException ();
+ }
+ }
+ public override bool Match (XsltContext context, XPathNavigator nav)
+ {
+ XPathNodeType nodeType = nav.NodeType;
+ switch (_type)
+ {
+ case XPathNodeType.All:
+ return true;
+
+ case XPathNodeType.ProcessingInstruction:
+ if (nodeType != XPathNodeType.ProcessingInstruction)
+ return false;
+ if (_param != null && nav.Name != _param)
+ return false;
+ return true;
+
+ default:
+ return _type == nodeType;
+ }
+ }
+ }
+ internal class NodeNameTest : NodeTest
+ {
+ protected QName _name;
+ public NodeNameTest (Axes axis, QName name) : base (axis)
+ {
+ _name = name;
+ }
+ public override String ToString () { return _axis.ToString () + "::" + _name.ToString (); }
+ [MonoTODO]
+ public override bool Match (XsltContext context, XPathNavigator nav)
+ {
+ // must be the correct node type
+ if (nav.NodeType != _axis.NodeType)
+ return false;
+
+ if (_name.Local != null && _name.Local != "")
+ {
+ // test the local part of the name first
+ if (_name.Local != nav.LocalName)
+ return false;
+ }
+
+ // get the prefix for the given name
+ String strURI1 = "";
+ if (_name.Prefix != null)
+ {
+ strURI1 = context.LookupNamespace (_name.Prefix); // TODO: check to see if this returns null or ""
+ if (strURI1 == null)
+ throw new XPathException ("Invalid namespace prefix: "+_name.Prefix);
+ }
+
+ string strURI = nav.NamespaceURI;
+ if (strURI == null && strURI1 == "") // TODO: remove when bug #26855 fixed
+ return true;
+
+ // test the prefixes
+ return strURI1 == nav.NamespaceURI;
+ }
+ }
+
+ internal class ExprStep : NodeSet
+ {
+ protected NodeTest _test;
+ protected Expression [] _preds;
+ public ExprStep (NodeTest test, ExprPredicates preds)
+ {
+ _test = test;
+ if (preds != null)
+ _preds = preds.GetPredicates ();
+ }
+ public ExprStep (NodeTest test)
+ {
+ _test = test;
+ }
+ public override String ToString ()
+ {
+ String strExpr = _test.ToString ();
+ if (_preds != null)
+ {
+ foreach (Expression pred in _preds)
+ {
+ strExpr += '[' + pred.ToString () + ']';
+ }
+ }
+ return strExpr;
+ }
+ public override object Evaluate (BaseIterator iter)
+ {
+ BaseIterator iterStep = _test.Evaluate (iter);
+ if (_preds == null)
+ return iterStep;
+
+ return new PredicateIterator (iterStep, _preds);
+ }
+ }
+
+
+ internal class ExprPredicates
+ {
+ protected Expression _pred;
+ protected ExprPredicates _tail;
+ public ExprPredicates (Expression pred, ExprPredicates tail)
+ {
+ _pred = pred;
+ _tail = tail;
+ }
+ public ExprPredicates (Expression pred)
+ {
+ _pred = pred;
+ }
+ public Expression [] GetPredicates ()
+ {
+ ArrayList lstPreds = new ArrayList ();
+ ExprPredicates curr = this;
+ while (curr != null)
+ {
+ lstPreds.Add (curr._pred);
+ curr = curr._tail;
+ }
+ return (Expression []) lstPreds.ToArray (typeof (Expression));
+ }
+ }
+
+ internal class ExprFilter : Expression
+ {
+ protected Expression _expr;
+ protected Expression _pred;
+ public ExprFilter (Expression expr, Expression pred)
+ {
+ _expr = expr;
+ _pred = pred;
+ }
+ public override String ToString () { return "(" + _expr.ToString () + ")[" + _pred.ToString () + "]"; }
+ public override XPathResultType ReturnType { get { return XPathResultType.NodeSet; }}
+ }
+
+ internal class QName
+ {
+ protected String _prefix;
+ protected String _local;
+ public QName (String prefix, String local)
+ {
+ _prefix = prefix;
+ _local = local;
+ }
+ public override String ToString ()
+ {
+ String strLocal = (_local != null) ? _local : "*";
+ if (_prefix != null)
+ return _prefix + ':' + strLocal;
+ return strLocal;
+ }
+ public String Prefix { get { return _prefix; } }
+ public String Local { get { return _local; } }
+ }
+ internal class NCName : QName
+ {
+ public NCName (String local) : base (null, local) {}
+ }
+
+ internal class ExprNumber : Expression
+ {
+ protected double _value;
+ public ExprNumber (double value)
+ {
+ _value = value;
+ }
+ public override String ToString () { return _value.ToString (); }
+ public override XPathResultType ReturnType { get { return XPathResultType.Number; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _value;
+ }
+ }
+ internal class ExprLiteral : Expression
+ {
+ protected String _value;
+ public ExprLiteral (String value)
+ {
+ _value = value;
+ }
+ public override String ToString () { return "'" + _value + "'"; }
+ public override XPathResultType ReturnType { get { return XPathResultType.String; }}
+ public override object Evaluate (BaseIterator iter)
+ {
+ return _value;
+ }
+ }
+
+ internal class ExprVariable : Expression
+ {
+ protected QName _name;
+ public ExprVariable (QName name)
+ {
+ _name = name;
+ }
+ public override String ToString () { return "$" + _name.ToString (); }
+ public override XPathResultType ReturnType { get { return XPathResultType.Any; }}
+ public override XPathResultType GetReturnType (BaseIterator iter)
+ {
+ IXsltContextVariable var = iter.Context.ResolveVariable (_name.Prefix, _name.Local);
+ return var.VariableType;
+ }
+ }
+
+ internal class FunctionArguments
+ {
+ protected Expression _arg;
+ protected FunctionArguments _tail;
+ public FunctionArguments (Expression arg, FunctionArguments tail)
+ {
+ _arg = arg;
+ _tail = tail;
+ }
+ public Expression Arg
+ {
+ get { return _arg; }
+ }
+ public FunctionArguments Tail
+ {
+ get { return _tail; }
+ }
+ }
+ internal class ExprFunctionCall : Expression
+ {
+ protected QName _name;
+ protected ArrayList _args = new ArrayList ();
+ public ExprFunctionCall (String name, FunctionArguments args)
+ {
+ _name = new NCName (name);
+ while (args != null)
+ {
+ _args.Add (args.Arg);
+ args = args.Tail;
+ }
+ }
+ public override String ToString ()
+ {
+ String strArgs = "";
+ foreach (Expression arg in _args)
+ {
+ if (strArgs != "")
+ strArgs += ", ";
+ strArgs += arg.ToString ();
+ }
+ return _name.ToString () + '(' + strArgs + ')';
+ }
+ public override XPathResultType ReturnType { get { return XPathResultType.Any; }}
+ public override XPathResultType GetReturnType (BaseIterator iter)
+ {
+ IXsltContextFunction func = iter.Context.ResolveFunction (_name.Prefix, _name.Local, GetArgTypes (iter));
+ return func.ReturnType;
+ }
+ private XPathResultType [] GetArgTypes (BaseIterator iter)
+ {
+ // TODO: can we cache these? what if the types depend on the context?
+ XPathResultType [] rgArgs = new XPathResultType [_args.Count];
+ for (int iArg = 0; iArg < _args.Count; iArg++)
+ rgArgs [iArg] = ((Expression) _args [iArg]).GetReturnType (iter);
+ return rgArgs;
+ }
+ public override object Evaluate (BaseIterator iter)
+ {
+ //special-case the 'last' and 'position' functions
+ if (_args.Count == 0 && _name.Prefix == null)
+ {
+ if (_name.Local == "last")
+ {
+ return (double) iter.Count;
+ }
+ else if (_name.Local == "position")
+ {
+ return (double) iter.CurrentPosition;
+ }
+ }
+
+ XPathResultType [] rgTypes = GetArgTypes (iter);
+ //FIXME: what if func == null after next line?
+ IXsltContextFunction func = iter.Context.ResolveFunction (_name.Prefix, _name.Local, rgTypes);
+ object [] rgArgs = new object [_args.Count];
+ for (int iArg = 0; iArg < _args.Count; iArg ++)
+ rgArgs [iArg] = ((Expression) _args [iArg]).Evaluate (iter);
+ return func.Invoke (iter.Context, rgArgs, iter.Current);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs b/mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs
new file mode 100644
index 00000000000..13c9018e761
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs
@@ -0,0 +1,16 @@
+//
+// System.Xml.XPath.IXPathNavigable
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public interface IXPathNavigable
+ {
+ XPathNavigator CreateNavigator ();
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs
new file mode 100644
index 00000000000..4b8a43d98fc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs
@@ -0,0 +1,607 @@
+//
+// System.Xml.XPath.BaseIterator
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2002 Piers Haken
+//
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+
+namespace System.Xml.XPath
+{
+ internal abstract class BaseIterator : XPathNodeIterator
+ {
+ private XsltContext _context;
+
+ internal BaseIterator (BaseIterator other)
+ {
+ _context = other._context;
+ }
+ internal BaseIterator (XsltContext context)
+ {
+ _context = context;
+ }
+
+ public XsltContext Context { get { return _context; } }
+
+ public override string ToString ()
+ {
+ return Current.NodeType.ToString () + "[" + CurrentPosition + "] : " + Current.Name + " = " + Current.Value;
+ }
+ }
+
+ internal class MergedIterator : BaseIterator
+ {
+ protected ArrayList _iters = new ArrayList ();
+ protected int _pos;
+ protected int _index;
+
+ public MergedIterator (BaseIterator iter ) : base (iter) {}
+ protected MergedIterator (MergedIterator other) : base (other)
+ {
+ foreach (object obj in other._iters)
+ _iters.Add (obj);
+ _pos = other._pos;
+ _index = other._index;
+ }
+ public override XPathNodeIterator Clone () { return new MergedIterator (this); }
+
+ public void Add (BaseIterator iter)
+ {
+ _iters.Add (iter);
+ }
+
+ public override bool MoveNext ()
+ {
+ while (_index < _iters.Count)
+ {
+ BaseIterator iter = (BaseIterator) _iters [_index];
+ if (iter.MoveNext ())
+ {
+ _pos ++;
+ return true;
+ }
+ _index ++;
+ }
+ return false;
+ }
+ public override XPathNavigator Current
+ {
+ get
+ {
+ if (_index >= _iters.Count)
+ return null;
+ BaseIterator iter = (BaseIterator) _iters [_index];
+ return iter.Current;
+ }
+ }
+ public override int CurrentPosition { get { return _pos; }}
+ }
+
+ internal abstract class SimpleIterator : BaseIterator
+ {
+ protected XPathNavigator _nav;
+ protected int _pos;
+
+ public SimpleIterator (BaseIterator iter) : base (iter)
+ {
+ _nav = iter.Current.Clone ();
+ }
+ protected SimpleIterator (SimpleIterator other) : base (other)
+ {
+ _nav = other._nav.Clone ();
+ _pos = other._pos;
+ }
+ public SimpleIterator (XPathNavigator nav, XsltContext context) : base (context)
+ {
+ _nav = nav.Clone ();
+ }
+
+ public override XPathNavigator Current { get { return _nav; }}
+ public override int CurrentPosition { get { return _pos; }}
+ }
+
+ internal class SelfIterator : SimpleIterator
+ {
+ public SelfIterator (BaseIterator iter) : base (iter) {}
+ public SelfIterator (XPathNavigator nav, XsltContext context) : base (nav, context) {}
+ protected SelfIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new SelfIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_pos == 0)
+ {
+ _pos = 1;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class NullIterator : SelfIterator
+ {
+ public NullIterator (BaseIterator iter) : base (iter) {}
+ public NullIterator (XPathNavigator nav, XsltContext context) : base (nav, context) {}
+ protected NullIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new NullIterator (this); }
+ public override bool MoveNext ()
+ {
+ return false;
+ }
+ }
+
+ internal class ParentIterator : SimpleIterator
+ {
+ public ParentIterator (BaseIterator iter) : base (iter) {}
+ protected ParentIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new ParentIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_pos == 0 && _nav.MoveToParent ())
+ {
+ _pos = 1;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class ChildIterator : SimpleIterator
+ {
+ public ChildIterator (BaseIterator iter) : base (iter) {}
+ protected ChildIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new ChildIterator (this); }
+ public override bool MoveNext ()
+ {
+ bool fSuccess = (_pos == 0) ? _nav.MoveToFirstChild () : _nav.MoveToNext ();
+ if (fSuccess)
+ _pos ++;
+ return fSuccess;
+ }
+ }
+
+ internal class FollowingSiblingIterator : SimpleIterator
+ {
+ public FollowingSiblingIterator (BaseIterator iter) : base (iter) {}
+ protected FollowingSiblingIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new FollowingSiblingIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_nav.MoveToNext ())
+ {
+ _pos ++;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class PrecedingSiblingIterator : SimpleIterator
+ {
+ public PrecedingSiblingIterator (BaseIterator iter) : base (iter) {}
+ protected PrecedingSiblingIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new PrecedingSiblingIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_nav.MoveToPrevious ())
+ {
+ _pos ++;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class AncestorIterator : SimpleIterator
+ {
+ public AncestorIterator (BaseIterator iter) : base (iter) {}
+ protected AncestorIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new AncestorIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_nav.MoveToParent ())
+ {
+ _pos ++;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class AncestorOrSelfIterator : MergedIterator
+ {
+ public AncestorOrSelfIterator (BaseIterator iter) : base (iter)
+ {
+ Add (new SelfIterator (iter));
+ Add (new AncestorIterator (iter));
+ }
+ protected AncestorOrSelfIterator (MergedIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new AncestorOrSelfIterator (this); }
+ }
+
+ internal class DescendantIterator : SimpleIterator
+ {
+ protected int _depth;
+ public DescendantIterator (BaseIterator iter) : base (iter) {}
+ protected DescendantIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new DescendantIterator (this); }
+ [MonoTODO]
+ public override bool MoveNext ()
+ {
+ if (_nav.MoveToFirstChild ())
+ {
+ _depth ++;
+ _pos ++;
+ return true;
+ }
+ while (_depth != 0)
+ {
+ if (_nav.MoveToNext ())
+ {
+ _pos ++;
+ return true;
+ }
+ if (!_nav.MoveToParent ()) // should NEVER fail!
+ throw new XPathException ("unexpected depth"); // TODO: better message
+ _depth --;
+ }
+ return false;
+ }
+ }
+
+ internal class DescendantOrSelfIterator : MergedIterator
+ {
+ public DescendantOrSelfIterator (BaseIterator iter) : base (iter)
+ {
+ Add (new SelfIterator (iter));
+ Add (new DescendantIterator (iter));
+ }
+ protected DescendantOrSelfIterator (MergedIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new DescendantOrSelfIterator (this); }
+ }
+
+ internal class FollowingIterator : SimpleIterator
+ {
+ public FollowingIterator (BaseIterator iter) : base (iter) {}
+ protected FollowingIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new FollowingIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_pos == 0)
+ {
+ if (_nav.MoveToNext ())
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ else
+ {
+ if (_nav.MoveToFirstChild ())
+ {
+ _pos ++;
+ return true;
+ }
+ do
+ {
+ if (_nav.MoveToNext ())
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ while (_nav.MoveToParent ());
+ }
+ return false;
+ }
+ }
+
+ internal class PrecedingIterator : SimpleIterator
+ {
+ public PrecedingIterator (BaseIterator iter) : base (iter) {}
+ protected PrecedingIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new PrecedingIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_pos == 0)
+ {
+ if (_nav.MoveToPrevious ())
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ else
+ {
+ if (_nav.MoveToFirstChild ())
+ {
+ while (_nav.MoveToNext ())
+ ;
+ _pos ++;
+ return true;
+ }
+ do
+ {
+ if (_nav.MoveToPrevious ())
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ while (_nav.MoveToParent ());
+ }
+ return false;
+ }
+ }
+
+ internal class NamespaceIterator : SimpleIterator
+ {
+ public NamespaceIterator (BaseIterator iter) : base (iter) {}
+ protected NamespaceIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new NamespaceIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_pos == 0)
+ {
+ if (_nav.MoveToFirstNamespace ())
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ else if (_nav.MoveToNextNamespace ())
+ {
+ _pos ++;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class AttributeIterator : SimpleIterator
+ {
+ public AttributeIterator (BaseIterator iter) : base (iter) {}
+ protected AttributeIterator (SimpleIterator other) : base (other) {}
+ public override XPathNodeIterator Clone () { return new AttributeIterator (this); }
+ public override bool MoveNext ()
+ {
+ if (_pos == 0)
+ {
+ if (_nav.MoveToFirstAttribute ())
+ {
+ _pos += 1;
+ return true;
+ }
+ }
+ else if (_nav.MoveToNextAttribute ())
+ {
+ _pos ++;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ internal class AxisIterator : BaseIterator
+ {
+ protected BaseIterator _iter;
+ protected NodeTest _test;
+ protected int _pos;
+
+ public AxisIterator (BaseIterator iter, NodeTest test) : base (iter)
+ {
+ _iter = iter;
+ _test = test;
+ }
+
+ protected AxisIterator (AxisIterator other) : base (other)
+ {
+ _iter = (BaseIterator) other._iter.Clone ();
+ _test = other._test;
+ _pos = other._pos;
+ }
+ public override XPathNodeIterator Clone () { return new AxisIterator (this); }
+
+ public override bool MoveNext ()
+ {
+ while (_iter.MoveNext ())
+ {
+ if (_test.Match (Context, Current))
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ return false;
+ }
+ public override XPathNavigator Current { get { return _iter.Current; }}
+ public override int CurrentPosition { get { return _pos; }}
+ }
+
+ internal class SlashIterator : BaseIterator
+ {
+ protected BaseIterator _iterLeft;
+ protected BaseIterator _iterRight;
+ protected Expression _expr;
+ protected int _pos;
+
+ public SlashIterator (BaseIterator iter, Expression expr) : base (iter)
+ {
+ _iterLeft = iter;
+ _expr = expr;
+ }
+
+ protected SlashIterator (SlashIterator other) : base (other)
+ {
+ _iterLeft = (BaseIterator) other._iterLeft.Clone ();
+ if (other._iterRight != null)
+ _iterRight = (BaseIterator) other._iterRight.Clone ();
+ _expr = other._expr;
+ _pos = other._pos;
+ }
+ public override XPathNodeIterator Clone () { return new SlashIterator (this); }
+
+ public override bool MoveNext ()
+ {
+ while (_iterRight == null || !_iterRight.MoveNext ())
+ {
+ if (!_iterLeft.MoveNext ())
+ return false;
+ _iterRight = _expr.EvaluateNodeSet (_iterLeft);
+ }
+ _pos ++;
+ return true;
+ }
+ public override XPathNavigator Current { get { return _iterRight.Current; }}
+ public override int CurrentPosition { get { return _pos; }}
+ }
+ internal class PredicateIterator : BaseIterator
+ {
+ protected BaseIterator _iter;
+ protected Expression [] _preds;
+ protected int _pos;
+
+ public PredicateIterator (BaseIterator iter, Expression [] preds) : base (iter)
+ {
+ _iter = iter;
+ _preds = preds;
+ }
+
+ protected PredicateIterator (PredicateIterator other) : base (other)
+ {
+ _iter = (BaseIterator) other._iter.Clone ();
+ _preds = other._preds;
+ _pos = other._pos;
+ }
+ public override XPathNodeIterator Clone () { return new PredicateIterator (this); }
+
+ public override bool MoveNext ()
+ {
+ while (_iter.MoveNext ())
+ {
+ bool fTrue = true;
+ foreach (Expression pred in _preds)
+ {
+ object result = pred.Evaluate ((BaseIterator) _iter.Clone ());
+ if (result is double)
+ {
+ if ((double) result != _iter.CurrentPosition)
+ {
+ fTrue = false;
+ break;
+ }
+ }
+ else if (!XPathFunctions.ToBoolean (result))
+ {
+ fTrue = false;
+ break;
+ }
+ }
+ if (fTrue)
+ return true;
+ }
+ return false;
+ }
+ public override XPathNavigator Current { get { return _iter.Current; }}
+ public override int CurrentPosition { get { return _pos; }}
+ }
+ internal class ArrayListIterator : BaseIterator
+ {
+ protected ArrayList _rgNodes;
+ protected int _pos;
+
+ public ArrayListIterator (BaseIterator iter, ArrayList rgNodes) : base (iter)
+ {
+ _rgNodes = rgNodes;
+ }
+
+ protected ArrayListIterator (ArrayListIterator other) : base (other)
+ {
+ _rgNodes = other._rgNodes;
+ _pos = other._pos;
+ }
+ public override XPathNodeIterator Clone () { return new ArrayListIterator (this); }
+
+ public override bool MoveNext ()
+ {
+ if (_pos >= _rgNodes.Count)
+ return false;
+ _pos++;
+ return true;
+ }
+ public override XPathNavigator Current { get { return (XPathNavigator) _rgNodes [_pos - 1]; }}
+ public override int CurrentPosition { get { return _pos; }}
+ }
+
+ internal class UnionIterator : BaseIterator
+ {
+ protected ArrayList _rgNodes;
+ protected BaseIterator _left, _right;
+ protected int _pos;
+
+ public UnionIterator (BaseIterator iter, BaseIterator left, BaseIterator right) : base (iter)
+ {
+ _rgNodes = new ArrayList ();
+ _left = left;
+ _right = right;
+ }
+
+ protected UnionIterator (UnionIterator other) : base (other)
+ {
+ _rgNodes = (ArrayList) other._rgNodes.Clone ();
+ _left = other._left;
+ _right = other._right;
+ _pos = other._pos;
+ }
+ public override XPathNodeIterator Clone () { return new UnionIterator (this); }
+
+ public override bool MoveNext ()
+ {
+ if (_left.MoveNext ())
+ {
+ _rgNodes.Add (_left.Current.Clone ());
+ _pos ++;
+ return true;
+ }
+
+ while (_right.MoveNext ())
+ {
+ XPathNavigator navRight = _right.Current;
+ bool fFound = false;
+ foreach (XPathNavigator navLeft in _rgNodes)
+ {
+ if (navLeft.IsSamePosition (navRight))
+ {
+ fFound = true;
+ break;
+ }
+ }
+ if (!fFound)
+ {
+ _pos ++;
+ return true;
+ }
+ }
+ return false;
+ }
+ public override XPathNavigator Current
+ {
+ get
+ {
+ if (_pos < _rgNodes.Count)
+ throw new XPathException ("bug in UnionOperator"); // TODO: better exception
+ if (_pos == _rgNodes.Count)
+ return _left.Current;
+ else
+ return _right.Current;
+ }
+ }
+ public override int CurrentPosition { get { return _pos; }}
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/Parser.cs b/mcs/class/System.XML/System.Xml.XPath/Parser.cs
new file mode 100644
index 00000000000..6914e278dc9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/Parser.cs
@@ -0,0 +1,1107 @@
+// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
+
+ // line 2 "Parser.jay"
+// XPath parser
+//
+// Author - Piers Haken <piersh@friskit.com>
+//
+
+// TODO: FUNCTION_CALL should be a QName, not just a NCName
+// TODO: PROCESSING_INSTRUCTION's optional parameter
+// TODO: flatten argument/predicate lists in place
+
+using System;
+using System.Xml.XPath;
+//using Test.Xml.XPath;
+
+namespace Mono.Xml.XPath
+{
+ public class XPathParser
+ {
+ internal object yyparseSafe (Tokenizer tok)
+ {
+ return yyparseSafe (tok, null);
+ }
+
+ internal object yyparseSafe (Tokenizer tok, object yyDebug)
+ {
+ try
+ {
+ return yyparse (tok, yyDebug);
+ }
+ catch (XPathException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new XPathException ("Error during parse", e);
+ }
+ }
+
+ internal object yyparseDebug (Tokenizer tok)
+ {
+ return yyparseSafe (tok, new yydebug.yyDebugSimple ());
+ }
+
+ // line 48 "-"
+
+ /** simplified error message.
+ @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
+ */
+ public void yyerror (string message) {
+ yyerror(message, null);
+ }
+
+ /** (syntax) error message.
+ Can be overwritten to control message format.
+ @param message text to be displayed.
+ @param expected vector of acceptable tokens, if available.
+ */
+ public void yyerror (string message, string[] expected) {
+ if ((expected != null) && (expected.Length > 0)) {
+ System.Console.Write (message+", expecting");
+ for (int n = 0; n < expected.Length; ++ n)
+ System.Console.Write (" "+expected[n]);
+ System.Console.WriteLine ();
+ } else
+ System.Console.WriteLine (message);
+ }
+
+ /** debugging support, requires the package jay.yydebug.
+ Set to null to suppress debugging messages.
+ */
+ protected yydebug.yyDebug debug;
+
+ protected static int yyFinal = 25;
+ public static string [] yyRule = {
+ "$accept : Expr",
+ "Expr : OrExpr",
+ "OrExpr : AndExpr",
+ "OrExpr : OrExpr OR AndExpr",
+ "AndExpr : EqualityExpr",
+ "AndExpr : AndExpr AND EqualityExpr",
+ "EqualityExpr : RelationalExpr",
+ "EqualityExpr : EqualityExpr EQ RelationalExpr",
+ "EqualityExpr : EqualityExpr NE RelationalExpr",
+ "RelationalExpr : AdditiveExpr",
+ "RelationalExpr : RelationalExpr LT AdditiveExpr",
+ "RelationalExpr : RelationalExpr GT AdditiveExpr",
+ "RelationalExpr : RelationalExpr LE AdditiveExpr",
+ "RelationalExpr : RelationalExpr GE AdditiveExpr",
+ "AdditiveExpr : MultiplicativeExpr",
+ "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr",
+ "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr",
+ "MultiplicativeExpr : UnaryExpr",
+ "MultiplicativeExpr : MultiplicativeExpr ASTERISK UnaryExpr",
+ "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr",
+ "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr",
+ "UnaryExpr : UnionExpr",
+ "UnaryExpr : MINUS UnaryExpr",
+ "UnionExpr : PathExpr",
+ "UnionExpr : UnionExpr BAR PathExpr",
+ "PathExpr : RelativeLocationPath",
+ "PathExpr : SLASH",
+ "PathExpr : SLASH RelativeLocationPath",
+ "PathExpr : SLASH2 RelativeLocationPath",
+ "PathExpr : FilterExpr",
+ "PathExpr : FilterExpr SLASH RelativeLocationPath",
+ "PathExpr : FilterExpr SLASH2 RelativeLocationPath",
+ "RelativeLocationPath : Step",
+ "RelativeLocationPath : RelativeLocationPath SLASH Step",
+ "RelativeLocationPath : RelativeLocationPath SLASH2 Step",
+ "Step : AxisSpecifier QName ZeroOrMorePredicates",
+ "Step : AxisSpecifier ASTERISK ZeroOrMorePredicates",
+ "Step : AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE ZeroOrMorePredicates",
+ "Step : DOT",
+ "Step : DOT2",
+ "AxisSpecifier :",
+ "AxisSpecifier : AT",
+ "AxisSpecifier : AxisName COLON2",
+ "NodeType : COMMENT",
+ "NodeType : TEXT",
+ "NodeType : PROCESSING_INSTRUCTION",
+ "NodeType : NODE",
+ "FilterExpr : PrimaryExpr",
+ "FilterExpr : FilterExpr Predicate",
+ "PrimaryExpr : DOLLAR QName",
+ "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE",
+ "PrimaryExpr : LITERAL",
+ "PrimaryExpr : NUMBER",
+ "PrimaryExpr : FunctionCall",
+ "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE",
+ "OptionalArgumentList :",
+ "OptionalArgumentList : Expr OptionalArgumentListTail",
+ "OptionalArgumentListTail :",
+ "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail",
+ "ZeroOrMorePredicates :",
+ "ZeroOrMorePredicates : Predicate ZeroOrMorePredicates",
+ "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE",
+ "AxisName : ANCESTOR",
+ "AxisName : ANCESTOR_OR_SELF",
+ "AxisName : ATTRIBUTE",
+ "AxisName : CHILD",
+ "AxisName : DESCENDANT",
+ "AxisName : DESCENDANT_OR_SELF",
+ "AxisName : FOLLOWING",
+ "AxisName : FOLLOWING_SIBLING",
+ "AxisName : NAMESPACE",
+ "AxisName : PARENT",
+ "AxisName : PRECEDING",
+ "AxisName : PRECEDING_SIBLING",
+ "AxisName : SELF",
+ "OptionalLiteral :",
+ "OptionalLiteral : LITERAL",
+ "QName : NCName",
+ "QName : NCName COLON ASTERISK",
+ "QName : NCName COLON NCName",
+ };
+ protected static string [] yyName = {
+ "end-of-file",null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+ null,null,null,null,null,null,null,"ERROR","EOF","SLASH","SLASH2",
+ "DOT","DOT2","COLON","COLON2","COMMA","AT","FUNCTION_NAME",
+ "BRACKET_OPEN","BRACKET_CLOSE","PAREN_OPEN","PAREN_CLOSE","AND","OR",
+ "DIV","MOD","PLUS","MINUS","ASTERISK","DOLLAR","BAR","EQ","NE","LE",
+ "GE","LT","GT","ANCESTOR","ANCESTOR_OR_SELF","ATTRIBUTE","CHILD",
+ "DESCENDANT","DESCENDANT_OR_SELF","FOLLOWING","FOLLOWING_SIBLING",
+ "NAMESPACE","PARENT","PRECEDING","PRECEDING_SIBLING","SELF","COMMENT",
+ "TEXT","PROCESSING_INSTRUCTION","NODE","NUMBER","LITERAL","NCName",
+ };
+
+ /** index-checked interface to yyName[].
+ @param token single character or %token value.
+ @return token name or [illegal] or [unknown].
+ */
+ public static string yyname (int token) {
+ if ((token < 0) || (token > yyName.Length)) return "[illegal]";
+ string name;
+ if ((name = yyName[token]) != null) return name;
+ return "[unknown]";
+ }
+
+ /** computes list of expected tokens on error by tracing the tables.
+ @param state for which to compute the list.
+ @return list of token names.
+ */
+ protected string[] yyExpecting (int state) {
+ int token, n, len = 0;
+ bool[] ok = new bool[yyName.Length];
+
+ if ((n = yySindex[state]) != 0)
+ for (token = n < 0 ? -n : 0;
+ (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
+ if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
+ ++ len;
+ ok[token] = true;
+ }
+ if ((n = yyRindex[state]) != 0)
+ for (token = n < 0 ? -n : 0;
+ (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
+ if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
+ ++ len;
+ ok[token] = true;
+ }
+
+ string [] result = new string[len];
+ for (n = token = 0; n < len; ++ token)
+ if (ok[token]) result[n++] = yyName[token];
+ return result;
+ }
+
+ /** the generated parser, with debugging messages.
+ Maintains a state and a value stack, currently with fixed maximum size.
+ @param yyLex scanner.
+ @param yydebug debug message writer implementing yyDebug, or null.
+ @return result of the last reduction, if any.
+ @throws yyException on irrecoverable parse error.
+ */
+ public Object yyparse (yyParser.yyInput yyLex, Object yyd)
+ {
+ this.debug = (yydebug.yyDebug)yyd;
+ return yyparse(yyLex);
+ }
+
+ /** initial size and increment of the state/value stack [default 256].
+ This is not final so that it can be overwritten outside of invocations
+ of yyparse().
+ */
+ protected int yyMax;
+
+ /** executed at the beginning of a reduce action.
+ Used as $$ = yyDefault($1), prior to the user-specified action, if any.
+ Can be overwritten to provide deep copy, etc.
+ @param first value for $1, or null.
+ @return first.
+ */
+ protected Object yyDefault (Object first) {
+ return first;
+ }
+
+ /** the generated parser.
+ Maintains a state and a value stack, currently with fixed maximum size.
+ @param yyLex scanner.
+ @return result of the last reduction, if any.
+ @throws yyException on irrecoverable parse error.
+ */
+ public Object yyparse (yyParser.yyInput yyLex)
+ {
+ if (yyMax <= 0) yyMax = 256; // initial size
+ int yyState = 0; // state stack ptr
+ int [] yyStates = new int[yyMax]; // state stack
+ Object yyVal = null; // value stack ptr
+ Object [] yyVals = new Object[yyMax]; // value stack
+ int yyToken = -1; // current input
+ int yyErrorFlag = 0; // #tks to shift
+
+ int yyTop = 0;
+ goto skip;
+ yyLoop:
+ yyTop++;
+ skip:
+ for (;; ++ yyTop) {
+ if (yyTop >= yyStates.Length) { // dynamically increase
+ int[] i = new int[yyStates.Length+yyMax];
+ yyStates.CopyTo (i, 0);
+ yyStates = i;
+ Object[] o = new Object[yyVals.Length+yyMax];
+ yyVals.CopyTo (o, 0);
+ yyVals = o;
+ }
+ yyStates[yyTop] = yyState;
+ yyVals[yyTop] = yyVal;
+ if (debug != null) debug.push(yyState, yyVal);
+
+ yyDiscarded: for (;;) { // discarding a token does not change stack
+ int yyN;
+ if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
+ if (yyToken < 0) {
+ yyToken = yyLex.advance() ? yyLex.token() : 0;
+ if (debug != null)
+ debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
+ }
+ if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
+ && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
+ if (debug != null)
+ debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
+ yyState = yyTable[yyN]; // shift to yyN
+ yyVal = yyLex.value();
+ yyToken = -1;
+ if (yyErrorFlag > 0) -- yyErrorFlag;
+ goto yyLoop;
+ }
+ if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
+ && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
+ yyN = yyTable[yyN]; // reduce (yyN)
+ else
+ switch (yyErrorFlag) {
+
+ case 0:
+ yyerror("syntax error", yyExpecting(yyState));
+ if (debug != null) debug.error("syntax error");
+ goto case 1;
+ case 1: case 2:
+ yyErrorFlag = 3;
+ do {
+ if ((yyN = yySindex[yyStates[yyTop]]) != 0
+ && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
+ && yyCheck[yyN] == Token.yyErrorCode) {
+ if (debug != null)
+ debug.shift(yyStates[yyTop], yyTable[yyN], 3);
+ yyState = yyTable[yyN];
+ yyVal = yyLex.value();
+ goto yyLoop;
+ }
+ if (debug != null) debug.pop(yyStates[yyTop]);
+ } while (-- yyTop >= 0);
+ if (debug != null) debug.reject();
+ throw new yyParser.yyException("irrecoverable syntax error");
+
+ case 3:
+ if (yyToken == 0) {
+ if (debug != null) debug.reject();
+ throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
+ }
+ if (debug != null)
+ debug.discard(yyState, yyToken, yyname(yyToken),
+ yyLex.value());
+ yyToken = -1;
+ goto yyDiscarded; // leave stack alone
+ }
+ }
+ int yyV = yyTop + 1-yyLen[yyN];
+ if (debug != null)
+ debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
+ yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
+ switch (yyN) {
+case 3:
+ // line 133 "Parser.jay"
+ {
+ yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 5:
+ // line 141 "Parser.jay"
+ {
+ yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 7:
+ // line 149 "Parser.jay"
+ {
+ yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 8:
+ // line 153 "Parser.jay"
+ {
+ yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 10:
+ // line 161 "Parser.jay"
+ {
+ yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 11:
+ // line 165 "Parser.jay"
+ {
+ yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 12:
+ // line 169 "Parser.jay"
+ {
+ yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 13:
+ // line 173 "Parser.jay"
+ {
+ yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 15:
+ // line 181 "Parser.jay"
+ {
+ yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 16:
+ // line 185 "Parser.jay"
+ {
+ yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 18:
+ // line 193 "Parser.jay"
+ {
+ yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 19:
+ // line 197 "Parser.jay"
+ {
+ yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 20:
+ // line 201 "Parser.jay"
+ {
+ yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 22:
+ // line 209 "Parser.jay"
+ {
+ yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 24:
+ // line 217 "Parser.jay"
+ {
+ yyVal = new ExprUNION ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 26:
+ // line 225 "Parser.jay"
+ {
+ yyVal = new ExprRoot ();
+ }
+ break;
+case 27:
+ // line 229 "Parser.jay"
+ {
+ yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 28:
+ // line 233 "Parser.jay"
+ {
+ ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
+ yyVal = new ExprSLASH (new ExprSLASH (new ExprRoot (), exprStep), (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 30:
+ // line 239 "Parser.jay"
+ {
+ yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 31:
+ // line 243 "Parser.jay"
+ {
+ ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
+ yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 33:
+ // line 252 "Parser.jay"
+ {
+ yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 34:
+ // line 256 "Parser.jay"
+ {
+ ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
+ yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]);
+ }
+ break;
+case 35:
+ // line 264 "Parser.jay"
+ {
+ yyVal = new ExprStep (new NodeNameTest ((Axes) yyVals[-2+yyTop], (QName) yyVals[-1+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
+ }
+ break;
+case 36:
+ // line 268 "Parser.jay"
+ {
+ yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
+ }
+ break;
+case 37:
+ // line 272 "Parser.jay"
+ {
+ yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-5+yyTop], (XPathNodeType) yyVals[-4+yyTop], (String) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]);
+ }
+ break;
+case 38:
+ // line 276 "Parser.jay"
+ {
+ yyVal = new ExprStep (new NodeTypeTest (Axes.Self, XPathNodeType.All));
+ }
+ break;
+case 39:
+ // line 280 "Parser.jay"
+ {
+ yyVal = new ExprStep (new NodeTypeTest (Axes.Parent, XPathNodeType.All));
+ }
+ break;
+case 40:
+ // line 287 "Parser.jay"
+ {
+ yyVal = Axes.Child;
+ }
+ break;
+case 41:
+ // line 291 "Parser.jay"
+ {
+ yyVal = Axes.Attribute;
+ }
+ break;
+case 42:
+ // line 295 "Parser.jay"
+ {
+ yyVal = yyVals[-1+yyTop];
+ }
+ break;
+case 43:
+ // line 301 "Parser.jay"
+ { yyVal = XPathNodeType.Comment; }
+ break;
+case 44:
+ // line 302 "Parser.jay"
+ { yyVal = XPathNodeType.Text; }
+ break;
+case 45:
+ // line 303 "Parser.jay"
+ { yyVal = XPathNodeType.ProcessingInstruction; }
+ break;
+case 46:
+ // line 304 "Parser.jay"
+ { yyVal = XPathNodeType.All; }
+ break;
+case 48:
+ // line 311 "Parser.jay"
+ {
+ yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]);
+ }
+ break;
+case 49:
+ // line 318 "Parser.jay"
+ {
+ yyVal = new ExprVariable ((QName) yyVals[0+yyTop]);
+ }
+ break;
+case 50:
+ // line 322 "Parser.jay"
+ {
+ yyVal = yyVals[-1+yyTop];
+ }
+ break;
+case 51:
+ // line 326 "Parser.jay"
+ {
+ yyVal = new ExprLiteral ((String) yyVals[0+yyTop]);
+ }
+ break;
+case 52:
+ // line 330 "Parser.jay"
+ {
+ yyVal = new ExprNumber ((double) yyVals[0+yyTop]);
+ }
+ break;
+case 54:
+ // line 338 "Parser.jay"
+ {
+ yyVal = new ExprFunctionCall ((String) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]);
+ }
+ break;
+case 56:
+ // line 346 "Parser.jay"
+ {
+ yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
+ }
+ break;
+case 58:
+ // line 354 "Parser.jay"
+ {
+ yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]);
+ }
+ break;
+case 60:
+ // line 363 "Parser.jay"
+ {
+ yyVal = new ExprPredicates ((Expression) yyVals[-1+yyTop], (ExprPredicates) yyVals[0+yyTop]);
+ }
+ break;
+case 61:
+ // line 370 "Parser.jay"
+ {
+ yyVal = yyVals[-1+yyTop];
+ }
+ break;
+case 62:
+ // line 376 "Parser.jay"
+ { yyVal = Axes.Ancestor; }
+ break;
+case 63:
+ // line 377 "Parser.jay"
+ { yyVal = Axes.AncestorOrSelf; }
+ break;
+case 64:
+ // line 378 "Parser.jay"
+ { yyVal = Axes.Attribute; }
+ break;
+case 65:
+ // line 379 "Parser.jay"
+ { yyVal = Axes.Child; }
+ break;
+case 66:
+ // line 380 "Parser.jay"
+ { yyVal = Axes.Descendant; }
+ break;
+case 67:
+ // line 381 "Parser.jay"
+ { yyVal = Axes.DescendantOrSelf; }
+ break;
+case 68:
+ // line 382 "Parser.jay"
+ { yyVal = Axes.Following; }
+ break;
+case 69:
+ // line 383 "Parser.jay"
+ { yyVal = Axes.FollowingSibling; }
+ break;
+case 70:
+ // line 384 "Parser.jay"
+ { yyVal = Axes.Namespace; }
+ break;
+case 71:
+ // line 385 "Parser.jay"
+ { yyVal = Axes.Parent; }
+ break;
+case 72:
+ // line 386 "Parser.jay"
+ { yyVal = Axes.Preceding; }
+ break;
+case 73:
+ // line 387 "Parser.jay"
+ { yyVal = Axes.PrecedingSibling; }
+ break;
+case 74:
+ // line 388 "Parser.jay"
+ { yyVal = Axes.Self; }
+ break;
+case 77:
+ // line 398 "Parser.jay"
+ {
+ yyVal = new NCName ((String) yyVals[0+yyTop]);
+ }
+ break;
+case 78:
+ // line 402 "Parser.jay"
+ {
+ yyVal = new QName ((String) yyVals[-2+yyTop], null);
+ }
+ break;
+case 79:
+ // line 406 "Parser.jay"
+ {
+ yyVal = new QName ((String) yyVals[-2+yyTop], (String) yyVals[0+yyTop]);
+ }
+ break;
+ // line 683 "-"
+ }
+ yyTop -= yyLen[yyN];
+ yyState = yyStates[yyTop];
+ int yyM = yyLhs[yyN];
+ if (yyState == 0 && yyM == 0) {
+ if (debug != null) debug.shift(0, yyFinal);
+ yyState = yyFinal;
+ if (yyToken < 0) {
+ yyToken = yyLex.advance() ? yyLex.token() : 0;
+ if (debug != null)
+ debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
+ }
+ if (yyToken == 0) {
+ if (debug != null) debug.accept(yyVal);
+ return yyVal;
+ }
+ goto yyLoop;
+ }
+ if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
+ && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
+ yyState = yyTable[yyN];
+ else
+ yyState = yyDgoto[yyM];
+ if (debug != null) debug.shift(yyStates[yyTop], yyState);
+ goto yyLoop;
+ }
+ }
+ }
+
+ static short [] yyLhs = { -1,
+ 0, 1, 1, 2, 2, 3, 3, 3, 4, 4,
+ 4, 4, 4, 5, 5, 5, 6, 6, 6, 6,
+ 7, 7, 8, 8, 9, 9, 9, 9, 9, 9,
+ 9, 10, 10, 10, 12, 12, 12, 12, 12, 13,
+ 13, 13, 16, 16, 16, 16, 11, 11, 19, 19,
+ 19, 19, 19, 21, 22, 22, 23, 23, 15, 15,
+ 20, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 17, 17, 14, 14, 14,
+ };
+ static short [] yyLen = { 2,
+ 1, 1, 3, 1, 3, 1, 3, 3, 1, 3,
+ 3, 3, 3, 1, 3, 3, 1, 3, 3, 3,
+ 1, 2, 1, 3, 1, 1, 2, 2, 1, 3,
+ 3, 1, 3, 3, 3, 3, 6, 1, 1, 0,
+ 1, 2, 1, 1, 1, 1, 1, 2, 2, 3,
+ 1, 1, 1, 4, 0, 2, 0, 3, 0, 2,
+ 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 1, 1, 3, 3,
+ };
+ static short [] yyDefRed = { 0,
+ 0, 0, 38, 39, 41, 0, 0, 0, 0, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 52, 51, 0, 0, 0, 0, 0, 0,
+ 0, 17, 0, 23, 0, 0, 32, 0, 0, 47,
+ 53, 0, 0, 0, 0, 22, 0, 49, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 48, 0, 43,
+ 44, 45, 46, 0, 0, 42, 0, 0, 50, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 19, 20, 18, 24, 33, 34, 0, 0, 0, 36,
+ 0, 35, 0, 0, 56, 54, 78, 79, 61, 60,
+ 76, 0, 0, 0, 58, 37,
+ };
+ protected static short [] yyDgoto = { 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 48, 100, 75, 112, 39, 40, 101,
+ 41, 78, 105,
+ };
+ protected static short [] yySindex = { -188,
+ -85, -85, 0, 0, 0, -258, -188, -188, -297, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -215, -257, -253, -265, -245,
+ -261, 0, -221, 0, -218, -252, 0, -256, -203, 0,
+ 0, -218, -218, -188, -209, 0, -200, 0, -188, -188,
+ -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
+ -188, -130, -85, -85, -85, -85, -188, 0, -204, 0,
+ 0, 0, 0, -204, -195, 0, -199, -194, 0, -268,
+ -257, -253, -265, -265, -245, -245, -245, -245, -261, -261,
+ 0, 0, 0, 0, 0, 0, -218, -218, -202, 0,
+ -204, 0, -229, -188, 0, 0, 0, 0, 0, 0,
+ 0, -191, -199, -204, 0, 0,
+ };
+ protected static short [] yyRindex = { -182,
+ 1, -182, 0, 0, 0, 0, -182, -182, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 253, 65, 23, 435, 319,
+ 244, 0, 222, 0, 90, 112, 0, 0, 0, 0,
+ 0, 134, 156, -267, 0, 0, 40, 0, -182, -182,
+ -182, -182, -182, -182, -182, -182, -182, -182, -182, -182,
+ -182, -182, -182, -182, -182, -182, -182, 0, 68, 0,
+ 0, 0, 0, 68, 0, 0, -190, 0, 0, 0,
+ 510, 501, 457, 479, 347, 369, 391, 413, 267, 289,
+ 0, 0, 0, 0, 0, 0, 178, 200, 0, 0,
+ 68, 0, -187, -182, 0, 0, 0, 0, 0, 0,
+ 0, 0, -190, 68, 0, 0,
+ };
+ protected static short [] yyGindex = { -7,
+ 0, 34, 35, -3, -29, -1, -6, 0, 24, 4,
+ 0, -12, 0, 49, -71, 0, 0, 0, 0, 52,
+ 0, 0, -21,
+ };
+ protected static short [] yyTable = { 45,
+ 26, 46, 102, 55, 42, 43, 65, 66, 47, 107,
+ 40, 44, 59, 60, 50, 67, 61, 53, 54, 55,
+ 56, 69, 4, 85, 86, 87, 88, 51, 52, 110,
+ 57, 58, 40, 40, 40, 40, 77, 108, 40, 77,
+ 63, 64, 116, 70, 71, 72, 73, 83, 84, 47,
+ 95, 96, 91, 92, 93, 89, 90, 49, 62, 99,
+ 76, 79, 80, 67, 2, 104, 109, 59, 97, 98,
+ 1, 2, 3, 4, 103, 111, 106, 5, 6, 114,
+ 57, 7, 81, 75, 82, 94, 74, 68, 8, 25,
+ 9, 115, 0, 0, 0, 40, 113, 0, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 29, 0, 0, 0, 23, 24, 40, 40, 40,
+ 40, 0, 0, 40, 0, 0, 0, 0, 1, 2,
+ 3, 4, 0, 27, 0, 5, 6, 0, 0, 7,
+ 0, 0, 0, 0, 0, 0, 0, 0, 9, 0,
+ 0, 0, 0, 0, 0, 28, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
+ 0, 0, 0, 23, 24, 3, 4, 30, 0, 0,
+ 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 0, 0, 0, 0, 0, 0,
+ 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 26, 15, 0, 0, 26,
+ 0, 26, 26, 26, 26, 26, 26, 26, 26, 0,
+ 26, 26, 26, 26, 26, 26, 26, 4, 16, 0,
+ 0, 4, 0, 4, 4, 4, 0, 0, 77, 77,
+ 40, 40, 40, 40, 77, 0, 40, 77, 77, 0,
+ 77, 77, 77, 77, 77, 77, 77, 77, 9, 77,
+ 77, 77, 77, 77, 77, 77, 59, 59, 0, 2,
+ 0, 0, 59, 2, 0, 2, 59, 2, 59, 59,
+ 59, 59, 59, 59, 59, 59, 12, 59, 59, 59,
+ 59, 59, 59, 59, 25, 0, 0, 0, 25, 0,
+ 25, 25, 25, 25, 25, 25, 25, 25, 13, 25,
+ 25, 25, 25, 25, 25, 25, 29, 0, 0, 0,
+ 29, 0, 29, 29, 29, 29, 29, 29, 29, 29,
+ 10, 29, 29, 29, 29, 29, 29, 29, 27, 0,
+ 0, 0, 27, 0, 27, 27, 27, 27, 27, 27,
+ 27, 27, 11, 27, 27, 27, 27, 27, 27, 27,
+ 28, 0, 0, 0, 28, 0, 28, 28, 28, 28,
+ 28, 28, 28, 28, 6, 28, 28, 28, 28, 28,
+ 28, 28, 30, 0, 0, 0, 30, 0, 30, 30,
+ 30, 30, 30, 30, 30, 30, 7, 30, 30, 30,
+ 30, 30, 30, 30, 31, 0, 0, 0, 31, 0,
+ 31, 31, 31, 31, 31, 31, 31, 31, 8, 31,
+ 31, 31, 31, 31, 31, 31, 21, 0, 0, 0,
+ 21, 0, 21, 21, 21, 21, 21, 21, 21, 21,
+ 5, 0, 21, 21, 21, 21, 21, 21, 14, 3,
+ 0, 0, 14, 0, 14, 14, 14, 1, 0, 14,
+ 14, 1, 0, 1, 14, 14, 14, 14, 14, 14,
+ 0, 15, 0, 0, 0, 15, 0, 15, 15, 15,
+ 0, 0, 15, 15, 0, 0, 0, 15, 15, 15,
+ 15, 15, 15, 16, 0, 0, 0, 16, 0, 16,
+ 16, 16, 0, 0, 16, 16, 0, 0, 0, 16,
+ 16, 16, 16, 16, 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 9, 0, 0, 0, 9, 0, 9,
+ 9, 9, 0, 0, 0, 0, 0, 0, 0, 9,
+ 9, 9, 9, 9, 9, 0, 0, 0, 0, 0,
+ 0, 12, 0, 0, 0, 12, 0, 12, 12, 12,
+ 0, 0, 0, 0, 0, 0, 0, 12, 12, 12,
+ 12, 12, 12, 13, 0, 0, 0, 13, 0, 13,
+ 13, 13, 0, 0, 0, 0, 0, 0, 0, 13,
+ 13, 13, 13, 13, 13, 10, 0, 0, 0, 10,
+ 0, 10, 10, 10, 0, 0, 0, 0, 0, 0,
+ 0, 10, 10, 10, 10, 10, 10, 11, 0, 0,
+ 0, 11, 0, 11, 11, 11, 0, 0, 0, 0,
+ 0, 0, 0, 11, 11, 11, 11, 11, 11, 6,
+ 0, 0, 0, 6, 0, 6, 6, 6, 0, 0,
+ 0, 0, 0, 0, 0, 6, 6, 0, 0, 0,
+ 0, 7, 0, 0, 0, 7, 0, 7, 7, 7,
+ 0, 0, 0, 0, 0, 0, 0, 7, 7, 0,
+ 0, 0, 0, 8, 0, 0, 0, 8, 0, 8,
+ 8, 8, 0, 0, 0, 0, 0, 0, 0, 8,
+ 8, 0, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 5, 5, 5, 3, 0, 0, 0, 3, 0,
+ 3, 0, 3,
+ };
+ protected static short [] yyCheck = { 7,
+ 0, 8, 74, 271, 1, 2, 259, 260, 306, 278,
+ 278, 270, 274, 275, 272, 268, 278, 283, 284, 285,
+ 286, 278, 0, 53, 54, 55, 56, 281, 282, 101,
+ 276, 277, 300, 301, 302, 303, 44, 306, 306, 0,
+ 259, 260, 114, 300, 301, 302, 303, 51, 52, 306,
+ 63, 64, 59, 60, 61, 57, 58, 273, 280, 67,
+ 264, 271, 263, 268, 0, 265, 269, 0, 65, 66,
+ 259, 260, 261, 262, 270, 305, 271, 266, 267, 271,
+ 271, 270, 49, 271, 50, 62, 38, 36, 277, 0,
+ 279, 113, -1, -1, -1, 278, 104, -1, 287, 288,
+ 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
+ 299, 0, -1, -1, -1, 304, 305, 300, 301, 302,
+ 303, -1, -1, 306, -1, -1, -1, -1, 259, 260,
+ 261, 262, -1, 0, -1, 266, 267, -1, -1, 270,
+ -1, -1, -1, -1, -1, -1, -1, -1, 279, -1,
+ -1, -1, -1, -1, -1, 0, 287, 288, 289, 290,
+ 291, 292, 293, 294, 295, 296, 297, 298, 299, -1,
+ -1, -1, -1, 304, 305, 261, 262, 0, -1, -1,
+ 266, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
+ -1, 287, 288, 289, 290, 291, 292, 293, 294, 295,
+ 296, 297, 298, 299, -1, -1, -1, -1, -1, -1,
+ -1, 0, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
+ -1, -1, 0, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 265, 0, -1, -1, 269,
+ -1, 271, 272, 273, 274, 275, 276, 277, 278, -1,
+ 280, 281, 282, 283, 284, 285, 286, 265, 0, -1,
+ -1, 269, -1, 271, 272, 273, -1, -1, 259, 260,
+ 300, 301, 302, 303, 265, -1, 306, 268, 269, -1,
+ 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
+ 281, 282, 283, 284, 285, 286, 259, 260, -1, 265,
+ -1, -1, 265, 269, -1, 271, 269, 273, 271, 272,
+ 273, 274, 275, 276, 277, 278, 0, 280, 281, 282,
+ 283, 284, 285, 286, 265, -1, -1, -1, 269, -1,
+ 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
+ 281, 282, 283, 284, 285, 286, 265, -1, -1, -1,
+ 269, -1, 271, 272, 273, 274, 275, 276, 277, 278,
+ 0, 280, 281, 282, 283, 284, 285, 286, 265, -1,
+ -1, -1, 269, -1, 271, 272, 273, 274, 275, 276,
+ 277, 278, 0, 280, 281, 282, 283, 284, 285, 286,
+ 265, -1, -1, -1, 269, -1, 271, 272, 273, 274,
+ 275, 276, 277, 278, 0, 280, 281, 282, 283, 284,
+ 285, 286, 265, -1, -1, -1, 269, -1, 271, 272,
+ 273, 274, 275, 276, 277, 278, 0, 280, 281, 282,
+ 283, 284, 285, 286, 265, -1, -1, -1, 269, -1,
+ 271, 272, 273, 274, 275, 276, 277, 278, 0, 280,
+ 281, 282, 283, 284, 285, 286, 265, -1, -1, -1,
+ 269, -1, 271, 272, 273, 274, 275, 276, 277, 278,
+ 0, -1, 281, 282, 283, 284, 285, 286, 265, 0,
+ -1, -1, 269, -1, 271, 272, 273, 265, -1, 276,
+ 277, 269, -1, 271, 281, 282, 283, 284, 285, 286,
+ -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
+ -1, -1, 276, 277, -1, -1, -1, 281, 282, 283,
+ 284, 285, 286, 265, -1, -1, -1, 269, -1, 271,
+ 272, 273, -1, -1, 276, 277, -1, -1, -1, 281,
+ 282, 283, 284, 285, 286, -1, -1, -1, -1, -1,
+ -1, -1, -1, 265, -1, -1, -1, 269, -1, 271,
+ 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
+ 282, 283, 284, 285, 286, -1, -1, -1, -1, -1,
+ -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
+ -1, -1, -1, -1, -1, -1, -1, 281, 282, 283,
+ 284, 285, 286, 265, -1, -1, -1, 269, -1, 271,
+ 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
+ 282, 283, 284, 285, 286, 265, -1, -1, -1, 269,
+ -1, 271, 272, 273, -1, -1, -1, -1, -1, -1,
+ -1, 281, 282, 283, 284, 285, 286, 265, -1, -1,
+ -1, 269, -1, 271, 272, 273, -1, -1, -1, -1,
+ -1, -1, -1, 281, 282, 283, 284, 285, 286, 265,
+ -1, -1, -1, 269, -1, 271, 272, 273, -1, -1,
+ -1, -1, -1, -1, -1, 281, 282, -1, -1, -1,
+ -1, 265, -1, -1, -1, 269, -1, 271, 272, 273,
+ -1, -1, -1, -1, -1, -1, -1, 281, 282, -1,
+ -1, -1, -1, 265, -1, -1, -1, 269, -1, 271,
+ 272, 273, -1, -1, -1, -1, -1, -1, -1, 281,
+ 282, -1, -1, -1, -1, 265, -1, -1, -1, 269,
+ -1, 271, 272, 273, 265, -1, -1, -1, 269, -1,
+ 271, -1, 273,
+ };
+
+ // line 412 "Parser.jay"
+ }
+ // line 950 "-"
+namespace yydebug {
+ using System;
+ public interface yyDebug {
+ void push (int state, Object value);
+ void lex (int state, int token, string name, Object value);
+ void shift (int from, int to, int errorFlag);
+ void pop (int state);
+ void discard (int state, int token, string name, Object value);
+ void reduce (int from, int to, int rule, string text, int len);
+ void shift (int from, int to);
+ void accept (Object value);
+ void error (string message);
+ void reject ();
+ }
+
+ class yyDebugSimple : yyDebug {
+ void println (string s){
+ Console.WriteLine (s);
+ }
+
+ public void push (int state, Object value) {
+ println ("push\tstate "+state+"\tvalue "+value);
+ }
+
+ public void lex (int state, int token, string name, Object value) {
+ println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
+ }
+
+ public void shift (int from, int to, int errorFlag) {
+ switch (errorFlag) {
+ default: // normally
+ println("shift\tfrom state "+from+" to "+to);
+ break;
+ case 0: case 1: case 2: // in error recovery
+ println("shift\tfrom state "+from+" to "+to
+ +"\t"+errorFlag+" left to recover");
+ break;
+ case 3: // normally
+ println("shift\tfrom state "+from+" to "+to+"\ton error");
+ break;
+ }
+ }
+
+ public void pop (int state) {
+ println("pop\tstate "+state+"\ton error");
+ }
+
+ public void discard (int state, int token, string name, Object value) {
+ println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
+ }
+
+ public void reduce (int from, int to, int rule, string text, int len) {
+ println("reduce\tstate "+from+"\tuncover "+to
+ +"\trule ("+rule+") "+text);
+ }
+
+ public void shift (int from, int to) {
+ println("goto\tfrom state "+from+" to "+to);
+ }
+
+ public void accept (Object value) {
+ println("accept\tvalue "+value);
+ }
+
+ public void error (string message) {
+ println("error\t"+message);
+ }
+
+ public void reject () {
+ println("reject");
+ }
+
+ }
+}
+// %token constants
+ class Token {
+ public const int ERROR = 257;
+ public const int EOF = 258;
+ public const int SLASH = 259;
+ public const int SLASH2 = 260;
+ public const int DOT = 261;
+ public const int DOT2 = 262;
+ public const int COLON = 263;
+ public const int COLON2 = 264;
+ public const int COMMA = 265;
+ public const int AT = 266;
+ public const int FUNCTION_NAME = 267;
+ public const int BRACKET_OPEN = 268;
+ public const int BRACKET_CLOSE = 269;
+ public const int PAREN_OPEN = 270;
+ public const int PAREN_CLOSE = 271;
+ public const int AND = 272;
+ public const int OR = 273;
+ public const int DIV = 274;
+ public const int MOD = 275;
+ public const int PLUS = 276;
+ public const int MINUS = 277;
+ public const int ASTERISK = 278;
+ public const int DOLLAR = 279;
+ public const int BAR = 280;
+ public const int EQ = 281;
+ public const int NE = 282;
+ public const int LE = 283;
+ public const int GE = 284;
+ public const int LT = 285;
+ public const int GT = 286;
+ public const int ANCESTOR = 287;
+ public const int ANCESTOR_OR_SELF = 288;
+ public const int ATTRIBUTE = 289;
+ public const int CHILD = 290;
+ public const int DESCENDANT = 291;
+ public const int DESCENDANT_OR_SELF = 292;
+ public const int FOLLOWING = 293;
+ public const int FOLLOWING_SIBLING = 294;
+ public const int NAMESPACE = 295;
+ public const int PARENT = 296;
+ public const int PRECEDING = 297;
+ public const int PRECEDING_SIBLING = 298;
+ public const int SELF = 299;
+ public const int COMMENT = 300;
+ public const int TEXT = 301;
+ public const int PROCESSING_INSTRUCTION = 302;
+ public const int NODE = 303;
+ public const int NUMBER = 304;
+ public const int LITERAL = 305;
+ public const int NCName = 306;
+ public const int yyErrorCode = 256;
+ }
+ namespace yyParser {
+ using System;
+ /** thrown for irrecoverable syntax errors and stack overflow.
+ */
+ public class yyException : System.Exception {
+ public yyException (string message) : base (message) {
+ }
+ }
+
+ /** must be implemented by a scanner object to supply input to the parser.
+ */
+ public interface yyInput {
+ /** move on to next token.
+ @return false if positioned beyond tokens.
+ @throws IOException on input error.
+ */
+ bool advance (); // throws java.io.IOException;
+ /** classifies current token.
+ Should not be called if advance() returned false.
+ @return current %token or single character.
+ */
+ int token ();
+ /** associated with current token.
+ Should not be called if advance() returned false.
+ @return value for token().
+ */
+ Object value ();
+ }
+ }
+} // close outermost namespace, that MUST HAVE BEEN opened in the prolog
diff --git a/mcs/class/System.XML/System.Xml.XPath/Parser.jay b/mcs/class/System.XML/System.Xml.XPath/Parser.jay
new file mode 100644
index 00000000000..3d686da8f6a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/Parser.jay
@@ -0,0 +1,412 @@
+%{
+// XPath parser
+//
+// Author - Piers Haken <piersh@friskit.com>
+//
+
+// TODO: FUNCTION_CALL should be a QName, not just a NCName
+// TODO: PROCESSING_INSTRUCTION's optional parameter
+// TODO: flatten argument/predicate lists in place
+
+using System;
+using System.Xml.XPath;
+using Test.Xml.XPath;
+
+namespace Mono.Xml.XPath
+{
+ public class XPathParser
+ {
+ internal object yyparseSafe (Tokenizer tok)
+ {
+ return yyparseSafe (tok, null);
+ }
+
+ internal object yyparseSafe (Tokenizer tok, object yyDebug)
+ {
+ try
+ {
+ return yyparse (tok, yyDebug);
+ }
+ catch (XPathException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new XPathException ("Error during parse", e);
+ }
+ }
+
+ internal object yyparseDebug (Tokenizer tok)
+ {
+ return yyparseSafe (tok, new yydebug.yyDebugSimple ());
+ }
+
+%}
+
+%token ERROR
+%token EOF
+
+%token SLASH
+%token SLASH2
+%token DOT
+%token DOT2
+%token COLON
+%token COLON2
+%token COMMA
+%token AT
+
+%token FUNCTION_NAME
+
+%token BRACKET_OPEN
+%token BRACKET_CLOSE
+%token PAREN_OPEN
+%token PAREN_CLOSE
+
+%token AND
+%token OR
+%token DIV
+%token MOD
+%token PLUS
+%token MINUS
+%token ASTERISK
+%token DOLLAR
+%token BAR
+%token EQ
+%token NE
+%token LE
+%token GE
+%token LT
+%token GT
+
+%token ANCESTOR
+%token ANCESTOR_OR_SELF
+%token ATTRIBUTE
+%token CHILD
+%token DESCENDANT
+%token DESCENDANT_OR_SELF
+%token FOLLOWING
+%token FOLLOWING_SIBLING
+%token NAMESPACE
+%token PARENT
+%token PRECEDING
+%token PRECEDING_SIBLING
+%token SELF
+
+%token COMMENT
+%token TEXT
+%token PROCESSING_INSTRUCTION
+%token NODE
+
+%token NUMBER
+%token LITERAL
+%token NCName
+
+
+%start Expr
+
+
+%left AND
+%left OR
+%left EQ
+%left NE
+%left LE
+%left GE
+%left LT
+%left GT
+
+%left DIV
+%left MOD
+%left PLUS
+%left MINUS
+
+%%
+
+
+Expr
+ : OrExpr
+ ;
+
+OrExpr
+ : AndExpr
+ | OrExpr OR AndExpr
+ {
+ $$ = new ExprOR ((Expression) $1, (Expression) $3);
+ }
+ ;
+
+AndExpr
+ : EqualityExpr
+ | AndExpr AND EqualityExpr
+ {
+ $$ = new ExprAND ((Expression) $1, (Expression) $3);
+ }
+ ;
+
+EqualityExpr
+ : RelationalExpr
+ | EqualityExpr EQ RelationalExpr
+ {
+ $$ = new ExprEQ ((Expression) $1, (Expression) $3);
+ }
+ | EqualityExpr NE RelationalExpr
+ {
+ $$ = new ExprNE ((Expression) $1, (Expression) $3);
+ }
+ ;
+
+RelationalExpr
+ : AdditiveExpr
+ | RelationalExpr LT AdditiveExpr
+ {
+ $$ = new ExprLT ((Expression) $1, (Expression) $3);
+ }
+ | RelationalExpr GT AdditiveExpr
+ {
+ $$ = new ExprGT ((Expression) $1, (Expression) $3);
+ }
+ | RelationalExpr LE AdditiveExpr
+ {
+ $$ = new ExprLE ((Expression) $1, (Expression) $3);
+ }
+ | RelationalExpr GE AdditiveExpr
+ {
+ $$ = new ExprGE ((Expression) $1, (Expression) $3);
+ }
+ ;
+
+AdditiveExpr
+ : MultiplicativeExpr
+ | AdditiveExpr PLUS MultiplicativeExpr
+ {
+ $$ = new ExprPLUS ((Expression) $1, (Expression) $3);
+ }
+ | AdditiveExpr MINUS MultiplicativeExpr
+ {
+ $$ = new ExprMINUS ((Expression) $1, (Expression) $3);
+ }
+ ;
+
+MultiplicativeExpr
+ : UnaryExpr
+ | MultiplicativeExpr ASTERISK UnaryExpr
+ {
+ $$ = new ExprMULT ((Expression) $1, (Expression) $3);
+ }
+ | MultiplicativeExpr DIV UnaryExpr
+ {
+ $$ = new ExprDIV ((Expression) $1, (Expression) $3);
+ }
+ | MultiplicativeExpr MOD UnaryExpr
+ {
+ $$ = new ExprMOD ((Expression) $1, (Expression) $3);
+ }
+ ;
+
+UnaryExpr
+ : UnionExpr
+ | MINUS UnaryExpr
+ {
+ $$ = new ExprNEG ((Expression) $2);
+ }
+ ;
+
+UnionExpr
+ : PathExpr
+ | UnionExpr BAR PathExpr
+ {
+ $$ = new ExprUNION ((NodeSet) $1, (NodeSet) $3);
+ }
+ ;
+
+PathExpr
+ : RelativeLocationPath
+ | SLASH
+ {
+ $$ = new ExprRoot ();
+ }
+ | SLASH RelativeLocationPath
+ {
+ $$ = new ExprSLASH (new ExprRoot (), (NodeSet) $2);
+ }
+ | SLASH2 RelativeLocationPath
+ {
+ ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
+ $$ = new ExprSLASH (new ExprSLASH (new ExprRoot (), exprStep), (NodeSet) $2);
+ }
+ | FilterExpr
+ | FilterExpr SLASH RelativeLocationPath
+ {
+ $$ = new ExprSLASH ((Expression) $1, (NodeSet) $3);
+ }
+ | FilterExpr SLASH2 RelativeLocationPath
+ {
+ ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
+ $$ = new ExprSLASH (new ExprSLASH ((Expression) $1, exprStep), (NodeSet) $3);
+ }
+ ;
+
+RelativeLocationPath
+ : Step
+ | RelativeLocationPath SLASH Step
+ {
+ $$ = new ExprSLASH ((Expression) $1, (NodeSet) $3);
+ }
+ | RelativeLocationPath SLASH2 Step
+ {
+ ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All));
+ $$ = new ExprSLASH (new ExprSLASH ((Expression) $1, exprStep), (NodeSet) $3);
+ }
+ ;
+
+Step
+ : AxisSpecifier QName ZeroOrMorePredicates
+ {
+ $$ = new ExprStep (new NodeNameTest ((Axes) $1, (QName) $2), (ExprPredicates) $3);
+ }
+ | AxisSpecifier ASTERISK ZeroOrMorePredicates
+ {
+ $$ = new ExprStep (new NodeTypeTest ((Axes) $1), (ExprPredicates) $3);
+ }
+ | AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE ZeroOrMorePredicates
+ {
+ $$ = new ExprStep (new NodeTypeTest ((Axes) $1, (XPathNodeType) $2, (String) $4), (ExprPredicates) $6);
+ }
+ | DOT
+ {
+ $$ = new ExprStep (new NodeTypeTest (Axes.Self, XPathNodeType.All));
+ }
+ | DOT2
+ {
+ $$ = new ExprStep (new NodeTypeTest (Axes.Parent, XPathNodeType.All));
+ }
+ ;
+
+AxisSpecifier
+ : /* empty */
+ {
+ $$ = Axes.Child;
+ }
+ | AT
+ {
+ $$ = Axes.Attribute;
+ }
+ | AxisName COLON2
+ {
+ $$ = $1;
+ }
+ ;
+
+NodeType
+ : COMMENT { $$ = XPathNodeType.Comment; }
+ | TEXT { $$ = XPathNodeType.Text; }
+ | PROCESSING_INSTRUCTION { $$ = XPathNodeType.ProcessingInstruction; }
+ | NODE { $$ = XPathNodeType.All; }
+ ;
+
+
+FilterExpr
+ : PrimaryExpr
+ | FilterExpr Predicate
+ {
+ $$ = new ExprFilter ((Expression) $1, (Expression) $2);
+ }
+ ;
+
+PrimaryExpr
+ : DOLLAR QName
+ {
+ $$ = new ExprVariable ((QName) $2);
+ }
+ | PAREN_OPEN Expr PAREN_CLOSE
+ {
+ $$ = $2;
+ }
+ | LITERAL
+ {
+ $$ = new ExprLiteral ((String) $1);
+ }
+ | NUMBER
+ {
+ $$ = new ExprNumber ((double) $1);
+ }
+ | FunctionCall
+ ;
+
+FunctionCall
+ : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE
+ {
+ $$ = new ExprFunctionCall ((String) $1, (FunctionArguments) $3);
+ }
+ ;
+
+OptionalArgumentList
+ : /* empty */
+ | Expr OptionalArgumentListTail
+ {
+ $$ = new FunctionArguments ((Expression) $1, (FunctionArguments) $2);
+ }
+ ;
+
+OptionalArgumentListTail
+ : /* empty */
+ | COMMA Expr OptionalArgumentListTail
+ {
+ $$ = new FunctionArguments ((Expression) $2, (FunctionArguments) $3);
+ }
+ ;
+
+
+ZeroOrMorePredicates
+ : /* empty */
+ | Predicate ZeroOrMorePredicates
+ {
+ $$ = new ExprPredicates ((Expression) $1, (ExprPredicates) $2);
+ }
+ ;
+
+Predicate
+ : BRACKET_OPEN Expr BRACKET_CLOSE
+ {
+ $$ = $2;
+ }
+ ;
+
+AxisName
+ : ANCESTOR { $$ = Axes.Ancestor; }
+ | ANCESTOR_OR_SELF { $$ = Axes.AncestorOrSelf; }
+ | ATTRIBUTE { $$ = Axes.Attribute; }
+ | CHILD { $$ = Axes.Child; }
+ | DESCENDANT { $$ = Axes.Descendant; }
+ | DESCENDANT_OR_SELF { $$ = Axes.DescendantOrSelf; }
+ | FOLLOWING { $$ = Axes.Following; }
+ | FOLLOWING_SIBLING { $$ = Axes.FollowingSibling; }
+ | NAMESPACE { $$ = Axes.Namespace; }
+ | PARENT { $$ = Axes.Parent; }
+ | PRECEDING { $$ = Axes.Preceding; }
+ | PRECEDING_SIBLING { $$ = Axes.PrecedingSibling; }
+ | SELF { $$ = Axes.Self; }
+ ;
+
+OptionalLiteral
+ : /* empty */
+ | LITERAL
+ ;
+
+QName
+ : NCName
+ {
+ $$ = new NCName ((String) $1);
+ }
+ | NCName COLON ASTERISK
+ {
+ $$ = new QName ((String) $1, null);
+ }
+ | NCName COLON NCName
+ {
+ $$ = new QName ((String) $1, (String) $3);
+ }
+ ;
+
+%%
+ }
diff --git a/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs b/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs
new file mode 100644
index 00000000000..56e58512bcc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs
@@ -0,0 +1,334 @@
+//
+// System.Xml.XPath.Tokenizer
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2002 Piers Haken
+//
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+using Mono.Xml.XPath;
+using Mono.Xml.XPath.yyParser;
+
+namespace System.Xml.XPath
+{
+ internal class Tokenizer : Mono.Xml.XPath.yyParser.yyInput
+ {
+ private char [] m_rgchInput;
+ private int m_ich;
+ private int m_cch;
+ private int m_iToken;
+ private Object m_objToken;
+ private static Hashtable s_mapTokens = new Hashtable ();
+ private static readonly Object [] s_rgTokenMap =
+ {
+ Token.AND, "and",
+ Token.OR, "or",
+ Token.DIV, "div",
+ Token.MOD, "mod",
+ Token.ANCESTOR, "ancestor",
+ Token.ANCESTOR_OR_SELF, "ancestor-or-self",
+ Token.ATTRIBUTE, "attribute",
+ Token.CHILD, "child",
+ Token.DESCENDANT, "descendant",
+ Token.DESCENDANT_OR_SELF, "descendant-or-self",
+ Token.FOLLOWING, "following",
+ Token.FOLLOWING_SIBLING, "following-sibling",
+ Token.NAMESPACE, "namespace",
+ Token.PARENT, "parent",
+ Token.PRECEDING, "preceding",
+ Token.PRECEDING_SIBLING, "preceding-sibling",
+ Token.SELF, "self",
+ Token.COMMENT, "comment",
+ Token.TEXT, "text",
+ Token.PROCESSING_INSTRUCTION, "processing-instruction",
+ Token.NODE, "node",
+ };
+ private const char EOL = '\0';
+
+ static Tokenizer ()
+ {
+ for (int i = 0; i < s_rgTokenMap.Length; i += 2)
+ s_mapTokens.Add (s_rgTokenMap [i + 1], s_rgTokenMap [i]);
+ }
+
+ public Tokenizer (string strInput)
+ {
+ m_rgchInput = strInput.ToCharArray ();
+ m_ich = 0;
+ m_cch = strInput.Length;
+ SkipWhitespace ();
+ }
+
+ private char Peek ()
+ {
+ if (m_ich >= m_cch)
+ return EOL;
+ return m_rgchInput [m_ich];
+ }
+
+ private char GetChar ()
+ {
+ if (m_ich >= m_cch)
+ return EOL;
+ return m_rgchInput [m_ich++];
+ }
+
+ private char PutBack ()
+ {
+ if (m_ich == 0)
+ throw new XPathException ("invalid tokenizer state"); // TODO: better description
+ return m_rgchInput [--m_ich];
+ }
+
+ private void SkipWhitespace ()
+ {
+ while (IsWhitespace (Peek ()))
+ GetChar ();
+ }
+
+ [MonoTODO]
+ private int ParseNumber ()
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ while (IsDigit (Peek ()))
+ sb.Append ((char) GetChar ());
+
+ // TODO: doesn't handle '3.' error case
+ if (Peek () == '.')
+ {
+ sb.Append ((char) GetChar ());
+ while (IsDigit (Peek ()))
+ sb.Append ((char) GetChar ());
+ }
+ m_objToken = Double.Parse (sb.ToString ());
+ return Token.NUMBER;
+ }
+
+ private int ParseLiteral ()
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ char chInit = GetChar ();
+ char ch;
+ while ((ch = Peek ()) != chInit)
+ {
+ if (ch == EOL)
+ return Token.ERROR;
+ sb.Append ((char) GetChar ());
+ }
+ GetChar ();
+ m_objToken = sb.ToString ();
+ return Token.LITERAL;
+ }
+
+ private int ParseIdentifier ()
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ char ch;
+ while ((ch = Peek ()) == '_' || ch == '-' || Char.IsLetterOrDigit (ch))
+ sb.Append ((char) GetChar ());
+
+ String strToken = sb.ToString ();
+ Object objToken = s_mapTokens [strToken];
+ if (objToken != null)
+ return (int) objToken;
+
+ m_objToken = strToken;
+
+ SkipWhitespace ();
+ if (Peek () == '(')
+ return Token.FUNCTION_NAME;
+
+ return Token.NCName;
+ }
+
+ private static bool IsWhitespace (char ch)
+ {
+ // return Char.IsWhiteSpace (ch);
+ return (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
+ }
+
+ private static bool IsDigit (char ch)
+ {
+ // return Char.IsDigit (ch);
+ return ch >= '0' && ch <= '9';
+ }
+
+
+ int ParseToken ()
+ {
+ char ch = Peek ();
+ switch (ch)
+ {
+ case EOL:
+ return Token.EOF;
+
+ case '/':
+ GetChar ();
+ if (Peek () == '/')
+ {
+ GetChar ();
+ return Token.SLASH2;
+ }
+ return Token.SLASH;
+
+ case '.':
+ GetChar ();
+ if (Peek () == '.')
+ {
+ GetChar ();
+ return Token.DOT2;
+ }
+ else if (IsDigit (Peek ()))
+ {
+ PutBack ();
+ return ParseNumber ();
+ }
+ return Token.DOT;
+
+ case ':':
+ GetChar ();
+ if (Peek () == ':')
+ {
+ GetChar ();
+ return Token.COLON2;
+ }
+ return Token.COLON;
+
+ case ',':
+ GetChar ();
+ return Token.COMMA;
+
+ case '@':
+ GetChar ();
+ return Token.AT;
+
+ case '[':
+ GetChar ();
+ return Token.BRACKET_OPEN;
+
+ case ']':
+ GetChar ();
+ return Token.BRACKET_CLOSE;
+
+ case '(':
+ GetChar ();
+ return Token.PAREN_OPEN;
+
+ case ')':
+ GetChar ();
+ return Token.PAREN_CLOSE;
+
+ case '+':
+ GetChar ();
+ return Token.PLUS;
+
+ case '-':
+ GetChar ();
+ return Token.MINUS;
+
+ case '*':
+ GetChar ();
+ return Token.ASTERISK;
+
+ case '$':
+ GetChar ();
+ return Token.DOLLAR;
+
+ case '|':
+ GetChar ();
+ return Token.BAR;
+
+ case '=':
+ GetChar ();
+ return Token.EQ;
+
+ case '!':
+ GetChar ();
+ if (Peek () == '=')
+ {
+ GetChar ();
+ return Token.NE;
+ }
+ break;
+
+ case '>':
+ GetChar ();
+ if (Peek () == '=')
+ {
+ GetChar ();
+ return Token.GE;
+ }
+ return Token.GT;
+
+ case '<':
+ GetChar ();
+ if (Peek () == '=')
+ {
+ GetChar ();
+ return Token.LE;
+ }
+ return Token.LT;
+
+ case '\'':
+ return ParseLiteral ();
+
+ case '\"':
+ return ParseLiteral ();
+
+ default:
+ {
+ if (IsDigit (ch))
+ {
+ return ParseNumber ();
+ }
+ else
+ {
+ return ParseIdentifier ();
+ }
+ }
+ }
+ return Token.ERROR;
+ }
+
+ ///////////////////////////
+ // yyParser.yyInput methods
+ ///////////////////////////
+
+ /** move on to next token.
+ @return false if positioned beyond tokens.
+ @throws IOException on input error.
+ */
+ public bool advance ()
+ {
+ m_objToken = null;
+ m_iToken = ParseToken ();
+ SkipWhitespace ();
+ return (m_iToken != Token.EOF);
+ }
+
+ /** classifies current token.
+ Should not be called if advance() returned false.
+ @return current %token or single character.
+ */
+ public int token ()
+ {
+ return m_iToken;
+ }
+
+ /** associated with current token.
+ Should not be called if advance() returned false.
+ @return value for token().
+ */
+ public Object value ()
+ {
+ return m_objToken;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathDocument.cs b/mcs/class/System.XML/System.Xml.XPath/XPathDocument.cs
new file mode 100644
index 00000000000..a48f9473ca5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathDocument.cs
@@ -0,0 +1,68 @@
+//
+// System.Xml.XPath.XPathDocument
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System.IO;
+using System.Xml;
+
+namespace System.Xml.XPath
+{
+ [MonoTODO]
+ public class XPathDocument : IXPathNavigable
+ {
+ XmlDocument _doc = new XmlDocument ();
+
+#region Constructors
+
+ public XPathDocument (Stream stream)
+ {
+ _doc.Load (stream);
+ }
+
+ public XPathDocument (string uri)
+ {
+ _doc.Load (uri);
+ }
+
+ public XPathDocument (TextReader reader)
+ {
+ _doc.Load (reader);
+ }
+
+ public XPathDocument (XmlReader reader)
+ {
+ _doc.Load (reader);
+ }
+
+ public XPathDocument (string uri, XmlSpace space)
+ {
+ if (space == XmlSpace.Preserve)
+ _doc.PreserveWhitespace = true;
+ _doc.Load (uri);
+ }
+
+ public XPathDocument (XmlReader reader, XmlSpace space)
+ {
+ if (space == XmlSpace.Preserve)
+ _doc.PreserveWhitespace = true;
+ _doc.Load (reader);
+ }
+
+#endregion
+
+#region Methods
+
+ public XPathNavigator CreateNavigator ()
+ {
+ return _doc.CreateNavigator ();
+ }
+
+#endregion
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathException.cs b/mcs/class/System.XML/System.Xml.XPath/XPathException.cs
new file mode 100644
index 00000000000..8a64b449d62
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathException.cs
@@ -0,0 +1,27 @@
+//
+// System.Xml.XPath.XPathException
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Copyright 2002 Tim Coleman
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Xml.XPath
+{
+ [Serializable]
+ public class XPathException : SystemException
+ {
+ #region Constructors
+
+ protected XPathException (SerializationInfo info, StreamingContext context) : base (info, context) {}
+
+ public XPathException (string message, Exception innerException) : base (message, innerException) {}
+
+ internal XPathException (string message) : base (message, null) {}
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs b/mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs
new file mode 100644
index 00000000000..4d525b36e02
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs
@@ -0,0 +1,50 @@
+//
+// System.Xml.XPath.XPathExpression
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System.Collections;
+
+namespace System.Xml.XPath
+{
+ public abstract class XPathExpression
+ {
+ #region Constructor
+
+ internal XPathExpression ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract string Expression { get; }
+
+ public abstract XPathResultType ReturnType { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract void AddSort (object expr, IComparer comparer);
+
+ public abstract void AddSort (
+ object expr,
+ XmlSortOrder order,
+ XmlCaseOrder caseOrder,
+ string lang,
+ XmlDataType dataType
+ );
+
+ public abstract XPathExpression Clone ();
+
+ public abstract void SetContext (XmlNamespaceManager nsManager);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs
new file mode 100644
index 00000000000..34a55e92662
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs
@@ -0,0 +1,18 @@
+//
+// System.Xml.XPath.XPathNamespaceScope
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XPathNamespaceScope
+ {
+ All = 0,
+ ExcludeXml = 1,
+ Local =2,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
new file mode 100644
index 00000000000..4cabe71079b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
@@ -0,0 +1,261 @@
+//
+// System.Xml.XPath.XPathNavigator
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using Mono.Xml.XPath;
+
+namespace System.Xml.XPath
+{
+ public abstract class XPathNavigator : ICloneable
+ {
+ #region Constructor
+
+ protected XPathNavigator ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract string BaseURI { get; }
+
+ public abstract bool HasAttributes { get; }
+
+ public abstract bool HasChildren { get; }
+
+ public abstract bool IsEmptyElement { get; }
+
+ public abstract string LocalName { get; }
+
+ public abstract string Name { get; }
+
+ public abstract string NamespaceURI { get; }
+
+ public abstract XmlNameTable NameTable { get; }
+
+ public abstract XPathNodeType NodeType { get; }
+
+ public abstract string Prefix { get; }
+
+ public abstract string Value { get; }
+
+ public abstract string XmlLang { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract XPathNavigator Clone ();
+
+ [MonoTODO]
+ public virtual XmlNodeOrder ComparePosition (XPathNavigator nav)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XPathExpression Compile (string xpath)
+ {
+ Tokenizer tokenizer = new Tokenizer (xpath);
+ XPathParser parser = new XPathParser ();
+ Expression expr = (Expression) parser.yyparseSafe (tokenizer);
+// Expression expr = (Expression) parser.yyparseDebug (tokenizer);
+ return new CompiledExpression (expr);
+ }
+
+ public virtual object Evaluate (string xpath)
+ {
+ return Evaluate (Compile (xpath));
+ }
+
+ public virtual object Evaluate (XPathExpression expr)
+ {
+ return Evaluate (expr, null);
+ }
+
+ public virtual object Evaluate (XPathExpression expr, XPathNodeIterator context)
+ {
+ if (context == null)
+ context = new NullIterator (this, new DefaultContext ());
+ return ((CompiledExpression) expr).Evaluate ((BaseIterator) context);
+ }
+
+ public abstract string GetAttribute (string localName, string namespaceURI);
+
+ public abstract string GetNamespace (string name);
+
+ object ICloneable.Clone ()
+ {
+ return Clone ();
+ }
+
+ public virtual bool IsDescendant (XPathNavigator nav)
+ {
+ if (nav != null)
+ {
+ nav = nav.Clone ();
+ while (nav.MoveToParent ())
+ {
+ if (IsSamePosition (nav))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public abstract bool IsSamePosition (XPathNavigator other);
+
+ public virtual bool Matches (string xpath)
+ {
+ return Matches (Compile (xpath));
+ }
+
+ public virtual bool Matches (XPathExpression expr)
+ {
+ XPathNodeIterator nodes = Select (expr);
+
+ while (nodes.MoveNext ()) {
+ if (IsSamePosition (nodes.Current))
+ return true;
+ }
+
+ XPathNavigator navigator = Clone ();
+
+ while (navigator.MoveToParent ()) {
+ nodes = navigator.Select (expr);
+
+ while (nodes.MoveNext ()) {
+ if (IsSamePosition (nodes.Current))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public abstract bool MoveTo (XPathNavigator other);
+
+ public abstract bool MoveToAttribute (string localName, string namespaceURI);
+
+ public abstract bool MoveToFirst ();
+
+ public abstract bool MoveToFirstAttribute ();
+
+ public abstract bool MoveToFirstChild ();
+
+ public bool MoveToFirstNamespace ()
+ {
+ return MoveToFirstNamespace (XPathNamespaceScope.All);
+ }
+
+ public abstract bool MoveToFirstNamespace (XPathNamespaceScope namespaceScope);
+
+ public abstract bool MoveToId (string id);
+
+ public abstract bool MoveToNamespace (string name);
+
+ public abstract bool MoveToNext ();
+
+ public abstract bool MoveToNextAttribute ();
+
+ public bool MoveToNextNamespace ()
+ {
+ return MoveToNextNamespace (XPathNamespaceScope.All);
+ }
+
+ public abstract bool MoveToNextNamespace (XPathNamespaceScope namespaceScope);
+
+ public abstract bool MoveToParent ();
+
+ public abstract bool MoveToPrevious ();
+
+ public abstract void MoveToRoot ();
+
+ public virtual XPathNodeIterator Select (string xpath)
+ {
+ return Select (Compile (xpath));
+ }
+
+ public virtual XPathNodeIterator Select (XPathExpression expr)
+ {
+ BaseIterator iter = new NullIterator (this, new DefaultContext ());
+ return ((CompiledExpression) expr).EvaluateNodeSet (iter);
+ }
+
+ public virtual XPathNodeIterator SelectAncestors (XPathNodeType type, bool matchSelf)
+ {
+ Axes axis = (matchSelf) ? Axes.AncestorOrSelf : Axes.Ancestor;
+ NodeTest test = new NodeTypeTest (axis, type);
+ return SelectTest (test);
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectAncestors (string name, string namespaceURI, bool matchSelf)
+ {
+ if (namespaceURI != null && namespaceURI != "")
+ throw new NotImplementedException ();
+
+ Axes axis = (matchSelf) ? Axes.AncestorOrSelf : Axes.Ancestor;
+ QName qname = new QName ("", name);
+ NodeTest test = new NodeNameTest (axis, qname);
+ return SelectTest (test);
+ }
+
+ public virtual XPathNodeIterator SelectChildren (XPathNodeType type)
+ {
+ NodeTest test = new NodeTypeTest (Axes.Child, type);
+ return SelectTest (test);
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectChildren (string name, string namespaceURI)
+ {
+ if (namespaceURI != null && namespaceURI != "")
+ throw new NotImplementedException ();
+
+ Axes axis = Axes.Child;
+ QName qname = new QName ("", name);
+ NodeTest test = new NodeNameTest (axis, qname);
+ return SelectTest (test);
+ }
+
+ public virtual XPathNodeIterator SelectDescendants (XPathNodeType type, bool matchSelf)
+ {
+ Axes axis = (matchSelf) ? Axes.DescendantOrSelf : Axes.Descendant;
+ NodeTest test = new NodeTypeTest (axis, type);
+ return SelectTest (test);
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectDescendants (string name, string namespaceURI, bool matchSelf)
+ {
+ if (namespaceURI != null && namespaceURI != "")
+ throw new NotImplementedException ();
+
+ Axes axis = (matchSelf) ? Axes.DescendantOrSelf : Axes.Descendant;
+ QName qname = new QName ("", name);
+ NodeTest test = new NodeNameTest (axis, qname);
+ return SelectTest (test);
+ }
+
+ internal XPathNodeIterator SelectTest (NodeTest test)
+ {
+ Expression expr = new ExprStep (test, null);
+ BaseIterator iter = new NullIterator (this, new DefaultContext ());
+ return expr.EvaluateNodeSet (iter);
+ }
+
+ public override string ToString ()
+ {
+ return Value;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs
new file mode 100644
index 00000000000..d27f65a0f12
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs
@@ -0,0 +1,63 @@
+//
+// System.Xml.XPath.XPathNodeIterator
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml.XPath
+{
+ public abstract class XPathNodeIterator : ICloneable
+ {
+ private int _count = -1;
+
+ #region Constructor
+
+ protected XPathNodeIterator ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual int Count
+ {
+ get
+ {
+ if (_count == -1)
+ {
+ // compute and cache the count
+ XPathNodeIterator tmp = Clone ();
+ while (tmp.MoveNext ())
+ ;
+ _count = tmp.CurrentPosition;
+ }
+ return _count;
+ }
+ }
+
+ public abstract XPathNavigator Current { get; }
+
+ public abstract int CurrentPosition { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract XPathNodeIterator Clone ();
+
+ object ICloneable.Clone ()
+ {
+ return Clone ();
+ }
+
+ public abstract bool MoveNext ();
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs
new file mode 100644
index 00000000000..22720f838be
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs
@@ -0,0 +1,25 @@
+//
+// System.Xml.XPath.XPathNodeType
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XPathNodeType
+ {
+ Root = 0,
+ Element = 1,
+ Attribute = 2,
+ Namespace = 3,
+ Text = 4,
+ SignificantWhitespace = 5,
+ Whitespace = 6,
+ ProcessingInstruction = 7,
+ Comment = 8,
+ All = 9,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs b/mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs
new file mode 100644
index 00000000000..82ab383a1e3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs
@@ -0,0 +1,22 @@
+//
+// System.Xml.XPath.XPathResultType
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XPathResultType
+ {
+ Number = 0,
+ String = 1,
+ Boolean = 2,
+ NodeSet = 3,
+ Navigator = 1,
+ Any = 5,
+ Error = 6,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs b/mcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs
new file mode 100755
index 00000000000..6e841b7467c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs
@@ -0,0 +1,33 @@
+// XmlCaseOrder.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:47:03 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml.XPath {
+
+
+ /// <summary>
+ /// </summary>
+ public enum XmlCaseOrder {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ UpperFirst = 1,
+
+ /// <summary>
+ /// </summary>
+ LowerFirst = 2,
+ } // XmlCaseOrder
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs b/mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs
new file mode 100644
index 00000000000..4b8c8ea44ae
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.XPath.XmlDataType
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XmlDataType
+ {
+ Text = 1,
+ Number = 2,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs b/mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs
new file mode 100644
index 00000000000..925aa15cd6c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.XPath.XmlSortOrder
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XmlSortOrder
+ {
+ Ascending = 1,
+ Descending = 2,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/ChangeLog b/mcs/class/System.XML/System.Xml.Xsl/ChangeLog
new file mode 100644
index 00000000000..fb4b40c200d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/ChangeLog
@@ -0,0 +1,25 @@
+2002-09-23 Duncan Mak <duncan@ximian.com>
+
+ * XslTransform.cs (Laod): Implemented the simple version that
+ takes one XPathNavigator as argument.
+ (Save): New private method for recreating the XML in text from a
+ XPathNavigator
+ (WriteCurrentNode):
+ (WriteTree): private methods for generating the text XML from the
+ XPathNavigator tree.
+
+2002-09-20 Duncan Mak <duncan@ximian.com>
+
+ * XslTransform.cs (Load): Implemented the methods, not
+ including the ones that deal with XPathNavigator (hopefully those
+ will come later).
+ (Transform): Implemented the version that saves directly to a file.
+ (Save): New private method for recreating the XML in text from
+ from an XmlReader
+
+ We're now P/Invoking libxslt for doing XSLT work.
+
+2002-06-23 Piers Haken <piersh@friskit.com>
+
+ * XsltContext.cs: added 'PreserveWhitespace' abstract method
+
diff --git a/mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs b/mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs
new file mode 100644
index 00000000000..4f2dc25efd0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/IXsltContextFunction.cs
@@ -0,0 +1,28 @@
+// System.Xml.Xsl.IXsltContextFunction
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml.Xsl
+{
+ public interface IXsltContextFunction
+ {
+ #region Properties
+
+ XPathResultType [] ArgTypes { get; }
+ int Maxargs { get; }
+ int Minargs { get; }
+ XPathResultType ReturnType { get; }
+
+ #endregion
+
+ #region Methods
+
+ object Invoke (XsltContext xsltContext, object [] args, XPathNavigator docContext);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs b/mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs
new file mode 100644
index 00000000000..f1b4aa0f3b9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/IXsltContextVariable.cs
@@ -0,0 +1,27 @@
+// System.Xml.Xsl.IXsltContextVariable
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml.Xsl
+{
+ public interface IXsltContextVariable
+ {
+ #region Properties
+
+ bool IsLocal { get; }
+ bool IsParam { get; }
+ XPathResultType VariableType { get; }
+
+ #endregion
+
+ #region Methods
+
+ object Evaluate (XsltContext xsltContext);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs b/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs
new file mode 100644
index 00000000000..dee1a343945
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs
@@ -0,0 +1,314 @@
+// System.Xml.Xsl.XslTransform
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Xml.XPath;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace System.Xml.Xsl
+{
+ public sealed class XslTransform
+ {
+
+ #region Fields
+
+ XmlResolver xmlResolver;
+ string stylesheet_file;
+ #endregion
+
+ #region Constructors
+ public XslTransform ()
+ {
+ stylesheet_file = String.Empty;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public XmlResolver XmlResolver {
+ set { xmlResolver = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ // Loads the XSLT stylesheet contained in the IXPathNavigable.
+ public void Load (IXPathNavigable stylesheet)
+ {
+ Load (stylesheet.CreateNavigator ());
+ }
+
+ // Loads the XSLT stylesheet specified by a URL.
+ public void Load (string url)
+ {
+ stylesheet_file = url;
+ }
+
+ // Loads the XSLT stylesheet contained in the XmlReader
+ public void Load (XmlReader stylesheet)
+ {
+ stylesheet_file = Path.GetTempFileName ();
+ Save (stylesheet, stylesheet_file);
+ }
+
+ // Loads the XSLT stylesheet contained in the XPathNavigator
+ public void Load (XPathNavigator stylesheet)
+ {
+ stylesheet_file = Path.GetTempFileName ();
+ Save (stylesheet, stylesheet_file);
+ }
+
+ [MonoTODO]
+ // Loads the XSLT stylesheet contained in the IXPathNavigable.
+ public void Load (IXPathNavigable stylesheet, XmlResolver resolver)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Loads the XSLT stylesheet specified by a URL.
+ public void Load (string url, XmlResolver resolver)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Loads the XSLT stylesheet contained in the XmlReader
+ public void Load (XmlReader stylesheet, XmlResolver resolver)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Loads the XSLT stylesheet contained in the XPathNavigator
+ public void Load (XPathNavigator stylesheet, XmlResolver resolver)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [DllImport ("libxslt.so")]
+ static extern IntPtr xsltParseStylesheetFile (string filename);
+
+ [DllImport ("libxslt.so")]
+ static extern IntPtr xsltApplyStylesheet (IntPtr stylePtr, IntPtr DocPtr, string [] parameters);
+
+ [DllImport ("libxslt.so")]
+ static extern IntPtr xmlNewDoc (string version);
+
+ [DllImport ("libxslt.so")]
+ static extern IntPtr xmlParseFile (string filename);
+
+ [DllImport ("libxslt.so")]
+ static extern int xmlSaveFile (string filename, IntPtr cur);
+
+ [MonoTODO]
+ // Transforms the XML data in the IXPathNavigable using
+ // the specified args and outputs the result to an XmlReader.
+ public XmlReader Transform (IXPathNavigable input, XsltArgumentList args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the input file and outputs
+ // the result to an output file.
+ public void Transform (string inputfile, string outputfile)
+ {
+ IntPtr xmlDocument = xmlParseFile (inputfile);
+ IntPtr xmlStylesheet = xsltParseStylesheetFile (stylesheet_file);
+ IntPtr xmlOutput = xmlNewDoc ("1.0");
+ string [] parameters = new string [] {};
+
+ xmlOutput = xsltApplyStylesheet (xmlStylesheet, xmlDocument, parameters);
+
+ xmlSaveFile (outputfile, xmlOutput);
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the XPathNavigator using
+ // the specified args and outputs the result to an XmlReader.
+ public XmlReader Transform (XPathNavigator input, XsltArgumentList args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the IXPathNavigable using
+ // the specified args and outputs the result to a Stream.
+ public void Transform (IXPathNavigable input, XsltArgumentList args, Stream output)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the IXPathNavigable using
+ // the specified args and outputs the result to a TextWriter.
+ public void Transform (IXPathNavigable input, XsltArgumentList args, TextWriter output)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the IXPathNavigable using
+ // the specified args and outputs the result to an XmlWriter.
+ public void Transform (IXPathNavigable input, XsltArgumentList args, XmlWriter output)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the XPathNavigator using
+ // the specified args and outputs the result to a Stream.
+ public void Transform (XPathNavigator input, XsltArgumentList args, Stream output)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the XPathNavigator using
+ // the specified args and outputs the result to a TextWriter.
+ public void Transform (XPathNavigator input, XsltArgumentList args, TextWriter output)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ // Transforms the XML data in the XPathNavigator using
+ // the specified args and outputs the result to an XmlWriter.
+ public void Transform (XPathNavigator input, XsltArgumentList args, XmlWriter output)
+ {
+ throw new NotImplementedException ();
+ }
+
+ static void Save (XmlReader rdr, string filename)
+ {
+ XmlTextWriter writer = new XmlTextWriter (filename, new UTF8Encoding ());
+
+ while (rdr.Read ()) {
+ switch (rdr.NodeType) {
+
+ case XmlNodeType.CDATA:
+ writer.WriteCData (rdr.Value);
+ break;
+
+ case XmlNodeType.Comment:
+ writer.WriteComment (rdr.Value);
+ break;
+
+ case XmlNodeType.DocumentType:
+ writer.WriteDocType (rdr.Value, null, null, null);
+ break;
+
+ case XmlNodeType.Element:
+ writer.WriteStartElement (rdr.Name, rdr.Value);
+
+ while (rdr.MoveToNextAttribute ())
+ writer.WriteAttributes (rdr, true);
+ break;
+
+ case XmlNodeType.EndElement:
+ writer.WriteEndElement ();
+ break;
+
+ case XmlNodeType.ProcessingInstruction:
+ writer.WriteProcessingInstruction (rdr.Name, rdr.Value);
+ break;
+
+ case XmlNodeType.Text:
+ writer.WriteString (rdr.Value);
+ break;
+
+ case XmlNodeType.Whitespace:
+ writer.WriteWhitespace (rdr.Value);
+ break;
+
+ case XmlNodeType.XmlDeclaration:
+ writer.WriteStartDocument ();
+ break;
+ }
+ }
+
+ writer.Close ();
+ }
+
+ static void Save (XPathNavigator navigator, string filename)
+ {
+ XmlTextWriter writer = new XmlTextWriter (filename, new UTF8Encoding ());
+ XPathNodeType type = XPathNodeType.All;
+
+ WriteTree (navigator, writer, type);
+ }
+
+ // Walks the XPathNavigator tree recursively
+ static void WriteTree (XPathNavigator navigator, XmlTextWriter writer, XPathNodeType type)
+ {
+ WriteCurrentNode (navigator, writer, ref type);
+
+ if (navigator.HasAttributes) {
+ navigator.MoveToFirstAttribute ();
+
+ do {
+ WriteCurrentNode (navigator, writer, ref type);
+ } while ( navigator.MoveToNextAttribute ());
+
+ navigator.MoveToParent ();
+ }
+
+ if (navigator.HasChildren) {
+ navigator.MoveToFirstChild ();
+
+ do {
+ WriteTree (navigator, writer, type);
+ } while (navigator.MoveToNext ());
+
+ navigator.MoveToParent ();
+ }
+ }
+
+ // Format the output
+ static void WriteCurrentNode (XPathNavigator navigator, XmlTextWriter writer, ref XPathNodeType current_type)
+ {
+ switch (navigator.NodeType) {
+ case XPathNodeType.Attribute:
+ current_type = XPathNodeType.Attribute;
+ writer.WriteAttributeString (navigator.LocalName, navigator.Value);
+ break;
+
+ case XPathNodeType.Comment:
+ writer.WriteComment (navigator.Value);
+ break;
+
+ case XPathNodeType.Element:
+ current_type = XPathNodeType.Element;
+ writer.WriteStartElement (navigator.Name);
+ break;
+
+ case XPathNodeType.ProcessingInstruction:
+ writer.WriteProcessingInstruction (navigator.Name, navigator.Value);
+ break;
+
+ case XPathNodeType.Text:
+ writer.WriteString (navigator.Value);
+
+ if (current_type == XPathNodeType.Element) {
+ writer.WriteEndElement ();
+ current_type = XPathNodeType.All;
+ }
+
+ break;
+
+ case XPathNodeType.SignificantWhitespace:
+ case XPathNodeType.Whitespace:
+ writer.WriteWhitespace (navigator.Value);
+ break;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs
new file mode 100644
index 00000000000..e4ac3b138f0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/XsltArgumentList.cs
@@ -0,0 +1,131 @@
+// System.Xml.Xsl.XsltArgumentList
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.XPath;
+
+namespace System.Xml.Xsl
+{
+ public sealed class XsltArgumentList
+ {
+ #region Fields
+
+ private Hashtable extensionObjects;
+ private Hashtable parameters;
+
+ #endregion
+
+ #region Constructors
+
+ public XsltArgumentList ()
+ {
+ extensionObjects = new Hashtable ();
+ parameters = new Hashtable ();
+ }
+
+ #endregion
+
+ #region Methods
+
+ public void AddExtensionObject (string namespaceUri, object extension)
+ {
+ if (namespaceUri == null)
+ throw new ArgumentException ("The namespaceUri is a null reference.");
+ if (namespaceUri == "http://www.w3.org/1999/XSL/Transform")
+ throw new ArgumentException ("The namespaceUri is http://www.w3.org/1999/XSL/Transform.");
+ if (extensionObjects.Contains (namespaceUri))
+ throw new ArgumentException ("The namespaceUri already has an extension object associated with it.");
+
+ extensionObjects [namespaceUri] = extension;
+ }
+
+ public void AddParam (string name, string namespaceUri, object parameter)
+ {
+
+ if (namespaceUri == null)
+ throw new ArgumentException ("The namespaceUri is a null reference.");
+
+ if (namespaceUri == "http://www.w3.org/1999/XSL/Transform")
+ throw new ArgumentException ("The namespaceUri is http://www.w3.org/1999/XSL/Transform.");
+
+ if (name == null)
+ throw new ArgumentException ("The parameter name is a null reference.");
+
+
+ // TODO:
+ // verify that the name is a valid name according to
+ // the W3C XML specification
+
+ XmlQualifiedName qName = new XmlQualifiedName (name, namespaceUri);
+
+ if (parameters.Contains (qName))
+ throw new ArgumentException ("The namespaceUri already has a parameter associated with it.");
+
+ parameter = ValidateParam (parameter);
+
+ parameters [qName] = parameter;
+ }
+
+ public void Clear ()
+ {
+ extensionObjects.Clear ();
+ parameters.Clear ();
+ }
+
+ public object GetExtensionObject (string namespaceUri)
+ {
+ return extensionObjects [namespaceUri];
+ }
+
+ public object GetParam (string name, string namespaceUri)
+ {
+ if (name == null)
+ throw (new ArgumentException ("The parameter name is a null reference."));
+ if (namespaceUri == null)
+ throw (new ArgumentException ("The namespaceUri is a null reference."));
+
+ XmlQualifiedName qName = new XmlQualifiedName (name, namespaceUri);
+ return parameters [qName];
+ }
+
+ public object RemoveExtensionObject (string namespaceUri)
+ {
+ object extensionObject = this.GetExtensionObject (namespaceUri);
+ extensionObjects.Remove (namespaceUri);
+ return extensionObject;
+ }
+
+ public object RemoveParam (string name, string namespaceUri)
+ {
+ XmlQualifiedName qName = new XmlQualifiedName (name, namespaceUri);
+ object parameter = this.GetParam (name, namespaceUri);
+ parameters.Remove (qName);
+ return parameter;
+ }
+
+ private object ValidateParam (object parameter)
+ {
+ if (parameter is string) return parameter;
+ if (parameter is bool) return parameter;
+ if (parameter is double) return parameter;
+ if (parameter is XPathNavigator) return parameter;
+ if (parameter is XPathNodeIterator) return parameter;
+
+ if (parameter is Int16) return (double) parameter;
+ if (parameter is UInt16) return (double) parameter;
+ if (parameter is Int32) return (double) parameter;
+ if (parameter is Int64) return (double) parameter;
+ if (parameter is UInt64) return (double) parameter;
+ if (parameter is Single) return (double) parameter;
+ if (parameter is decimal) return (double) parameter;
+
+ return parameter.ToString ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs
new file mode 100644
index 00000000000..7cd4011b763
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/XsltCompileException.cs
@@ -0,0 +1,56 @@
+// System.Xml.Xsl.XsltCompileException
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Xml.Xsl
+{
+ [Serializable]
+ public class XsltCompileException : XsltException
+ {
+ #region Fields
+
+ string message;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO]
+ protected XsltCompileException (SerializationInfo info, StreamingContext context )
+ : base (info, context)
+ {
+ }
+
+ [MonoTODO]
+ // I don't think this base() call is right, but what
+ // should the message be for XsltException?
+ public XsltCompileException (Exception inner, String sourceUri, int lineNumber, int linePosition)
+ : base (sourceUri, inner)
+ {
+ }
+
+
+ #endregion
+
+ #region Properties
+
+ public override string Message {
+ get { return message; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs
new file mode 100644
index 00000000000..b47822ae7a3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs
@@ -0,0 +1,45 @@
+// System.Xml.Xsl.XsltContext
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Xml;
+using System.Xml.XPath;
+
+namespace System.Xml.Xsl
+{
+ public abstract class XsltContext : XmlNamespaceManager
+ {
+ #region Constructors
+
+ // should this really be calling new NameTable() in the
+ // base() call?
+ public XsltContext ()
+ : base (new NameTable ())
+ {
+ }
+
+ public XsltContext (NameTable table)
+ : base (table)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract bool Whitespace { get; }
+ public abstract bool PreserveWhitespace (XPathNavigator nav);
+
+ #endregion
+
+ #region Methods
+
+ public abstract int CompareDocument (string baseUri, string nextbaseUri);
+ public abstract IXsltContextFunction ResolveFunction (string prefix, string name, XPathResultType [] ArgTypes);
+ public abstract IXsltContextVariable ResolveVariable (string prefix, string name);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltException.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltException.cs
new file mode 100644
index 00000000000..29e6adad0b6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Xsl/XsltException.cs
@@ -0,0 +1,72 @@
+// System.Xml.Xsl.XsltException
+//
+// Author: Tim Coleman <tim@timcoleman.com>
+// (C) Copyright 2002 Tim Coleman
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Xml.Xsl
+{
+ [Serializable]
+ public class XsltException : SystemException
+ {
+ #region Fields
+
+ string message;
+ int lineNumber;
+ int linePosition;
+ string sourceUri;
+
+ #endregion
+
+ #region Constructors
+
+ public XsltException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ this.message = message;
+ }
+
+ protected XsltException (SerializationInfo info, StreamingContext context)
+ {
+ lineNumber = info.GetInt32 ("lineNumber");
+ linePosition = info.GetInt32 ("linePosition");
+ sourceUri = info.GetString ("sourceUri");
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public int LinePosition {
+ get { return linePosition; }
+ }
+
+ public override string Message {
+ get { return message; }
+ }
+
+ public string SourceUri {
+ get { return sourceUri; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("lineNumber", lineNumber);
+ info.AddValue ("linePosition", linePosition);
+ info.AddValue ("sourceUri", sourceUri);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
new file mode 100644
index 00000000000..5fd0d8d1035
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -0,0 +1,1293 @@
+2003-01-19 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlNamespaceManager.cs : fundamental change of LookupPrefix to return
+ null when no matching uri.
+ * XmlElement.cs : removed unnecessary xmlns output.
+ * XmlNode.cs : GetPrefixOfNamespace fix along with the change above.
+ * XmlTextWriter.cs : LookupPrefix and WriteStartElementInternal fix
+ along with the change above, and moved timing of 'xmlns' output
+ to CloseStartElement.
+ * XmlWriter.cs: modified WriteStartAttribute, same as yesterday.
+
+2003-01-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlWriter.cs: modified WriteStartElement (see test for detail).
+ Added WriteNode.
+
+2003-01-13 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlDocument.cs: Added CheckName () method to check names validity.
+
+2003-01-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs:
+ (ReadOuterXml): use Depth property which return elementDepth, not depth.
+
+2003-01-11 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlElement.cs : (by ville) XmlElement.set_InnerText event bugfix.
+ * XmlTextReader.cs : some fix for ReadOuterXml().
+
+2003-01-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlTextReader.cs : bugfix for attributes related to creation of
+ XmlAttribute *node*.
+
+2003-01-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlTextReader.cs : bugfix for attribute values which have entity
+ references.
+
+2002-12-28 Ville Palo <vi64pa@koti.soon.fi>
+
+ * XmlDocument.cs: XmlTextWriter.Formatting == Indented when
+ calling Save () -methods.
+
+2002-12-28 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlNodeReader.cs : primitive reading implementation.
+
+2002-12-28 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlElement.cs : quick fix for the incomplete patch of #35308 below.
+
+2002-12-28 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs : removed inconsistent line-feed output.
+ * XmlElement.cs, XmlTextWriter.cs :
+ fixed for bugzilla 35308 (default ns output)
+ * XmlWhitespace.cs : limited output only when preserving whitespace.
+
+2002-12-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlAttribute.cs, XmlDocument.cs, XmlTextReader.cs:
+ Implemented XmlTextReader.ReadAttributeValue().
+ Added internal ReadAttributeNodeValue().
+ Fixed XmlAttribute.InnerXml to use these methods.
+
+ * XmlDocument.cs, XmlDocumentFragment.cs, XmlElement.cs, XmlNode.cs:
+ Implemented XmlDocument.ReadNode() and removed ConstructDOM().
+ Other changes are replacing them.
+
+2002-12-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs: patch by Ville (fixed default PreserveWhitespace)
+
+2002-12-21 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlElement.cs, XmlTextWriter.cs, XmlWriter.cs:
+ patch by JD Conley <jconley@winfessor.com>.
+ (Fix for xmlns attribute output.)
+
+2002-12-05 Ville Palo <vi64p@koti.soon.fi>
+
+ * XmlQualifiedName.cs: Little fix to ToString () -method
+
+2002-12-04 Tim Haynes <thaynes@openlinksw.com>
+
+ * class/System.XML/System.Xml/XmlElement.cs: Made more refined
+ checks on attributeNode to fix 32262.
+
+2002-12-03 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs (CreateNavigator(XmlNode)) : reverted
+ * XmlTextWriter.cs (WriteStartElementInternal):
+ fixed when default namespace was specified, all descendants
+ fail to omit the default namespace declarations.
+ * XmlAttribute.cs,
+ XmlDocument.cs,
+ XmlNode.cs (internal XmlLang/XmlSpace) : implemented(defined)
+ * XmlAttribute.cs,
+ XmlDocumentFragment.cs,
+ XmlElement.cs (set_InnerXml): now uses XmlLang/XmlSpace
+ * XmlElement.cs (set_IsEmpty) : implemented
+ (WriteTo) : removed my improper indenting (Writer already done)
+ * XmlNode.cs (BaseURI) : fixed if ParentNode is null, NullPointerEx
+ (ConstructDOM) : implemented when xmlReader isn't XmlTextReader
+ ...and renamed XmlDocument.ConventionalParser to ReusableReader ;-)
+
+2002-12-01 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlNode.cs (RemoveChild):
+ bugfixed when XmlNode is Document OwnerDocument is null
+ * XmlDeclaration.cs (Value):
+ bugfixed regular expression pattern.
+ * XmlDocument.cs (CreateNavigator): bugfixed access modifier.
+
+2002-11-24 Duncan Mak <duncan@ximian.com>
+
+ * XmlImplementation.cs (HasFeature): Fixed a typo. Thanks for
+ Fabricio Barros Cabral (fx) on #mono for spotting it. This is his
+ first patch to Mono! ;-)
+
+2002-11-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlNode.cs:
+ (AppendChild): readded refChild != null condition before throwing
+ "cannot insert this node in this position" exception. There's probably
+ a better solution. Fixes #34191.
+ (RemoveAll): changed following Atsushi instructions.
+
+
+2002-11-13 Duncan Mak <duncan@ximian.com>
+
+ * XmlElement.cs (IsEmpty): A temporary check-in to keep gtk-sharp
+ compiling.
+
+2002-11-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs : unified all constructors, added ConventionalParser,
+ implemented CloneNode() and CreateEntityReference(),
+ * XmlEntityReference.cs : set_Value, WriteContentTo, WriteTo
+ set BaseURI to MonoTODO
+ * XmlNode.cs : implemented PrependChild, modified ConstructDOM,
+ bugfix InsertAfter (incorrect prepending) and InsertBefore
+ (more than one DocumentElements hadn't caused errors)
+ * XmlTextReader.cs : unified all constructors,
+ added internal SetReaderContext(), SetReaderFragment()
+ bugfix (syntax check of PUBLIC / getting internal subset)
+
+2002-11-13 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ XmlAttribute.cs : set_InnerText, set_InnerXml, some check for set_Prefix
+ XmlAttributeCollection.cs : (indexer) this[localName, namespaceURI]
+ XmlCharacterData.cs : exchanged Data and Value
+ (for processing events and inheritance)
+ XmlDocumentFragment.cs : set_InnerXml
+ XmlSignificantWhitespace.cs : set_Value
+ XmlTextReader.cs : ReadAttributeValue
+
+2002-11-04 Atsushi Enomoto <gigna@kit.hi-ho.ne.jp>
+
+ XmlAttribute.cs: fixed missing internal 'OwnerElement''SetOwnerElement'
+
+2002-11-03 Atsushi Enomoto <gigna@kit.hi-ho.ne.jp>
+
+ * XmlAttributeCollection.cs : checks owner element.
+ implemented CopyTo, InsertAfter, InsertBefore, Prepend,
+ Remove, RemoveAt, SetNamedItem.
+ removed some logics that sets 'Parent' (that should be null)
+ * XmlDocument.cs : set_InnerXml, [PreserveWhitespace(incomplete)]
+ * XmlDocumentFragment.cs : get_InnerXml, WriteContentTo, WriteTo
+ * XmlElement.cs : implemented WriteTo, set_InnerText.
+ Fixed WriteTo() to add xmlns:* attributes when
+ writer.LookupPrefix() returned mismatching.
+ * XmlNamedNodeMap.cs : compare not only name but localname and nsuri.
+ Removing different prefixes for the same uri now runs correct.
+ added SetNamedItem(XmlNode node, int position_to_insert).
+ * XmlNode.cs : ConstructDOM (logically) creates XmlEntityReference,
+ XmlWhitespace, and XmlSignificantWhitespace
+
+2002-10-31 Atsushi Enomoto <gigna@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs : implemented CreateDocumentFragment()
+ * XmlElement.cs, XmlLinkedNode.cs :
+ moved LastLinkedChild from XmlElement to XmlLinkedNode.
+ * XmlEntityReference.cs : must throw NotImplementedException.
+ * XmlNode.cs :
+ + implemented InsertBefore() and then implemented InsertAfter()
+ and modified AppendChild() to call it.
+ + added logic to check ReadOnly, parent document equivalence,
+ and inserting any 'content' before/after DocumentElement.
+ + implemented Clone() [it is equals to CloneNode() by MS doc.]
+ + added logic in RemoveChild() to check parent of oldChild.
+ + fixed ConstructNamespaceManager() to internal only.
+
+2002-10-29 Atsushi Enomoto <gigna@kit.hi-ho.ne.jp>
+
+ * XmlAttribute.cs : add internal 'IsDefault' property
+ (equals to !Specified)
+ * XmlImplementation.cs : added 'internalNameTable' property.
+ * XmlDocument.cs :
+ + now allows "" for 'standalone' in CreateXmlDeclaration.
+ + implemented 'Implementation' property and constructor with it.
+ + added logic for appending name table (but still no use)
+ + implemented property 'DocumentType'
+ (but without internalSubset parsing. wait for next update.)
+ * XmlNode.cs :
+ + modified AppendChild() and RemoveChild() to support fragment.
+ + modified AppendChild() to remove newChild from its parent
+ when newChild is already in the other place.
+ + modified RemoveChild() to set parentNode null.
+ + modified ConstructDOM() to create DocumentType,
+ and fixed access modifier ('internal protected' to 'internal')
+ * XmlLinkedNode.cs : fixed 'NextSibling' to return null
+ when its parent is null.
+ * XmlDocumentFragment.cs : added internal override 'LastLinkedChild'
+ property to enable AppendChild() for this class.
+ * XmlTextReader.cs : appended private publicId and systemId fields.
+
+2002-10-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs: make it work when the underlying Stream is not
+ 'seekable'.
+
+2002-10-26 Piers Haken <piersh@friskit.com>
+
+ * XmlNode.cs: add virtual property XPathNodeType
+ * XmlAttribute.cs:
+ * XmlComment.cs:
+ * XmlDocument.cs:
+ * XmlElement.cs::
+ * XmlProcessingInstruction.cs:
+ * XmlSignificantWhitespace.cs:
+ * XmlText.cs:
+ * XmlWhitespace.cs: implement XPathNodeType property
+ * XmlDocumentNavigator.cs: use XPathNodeType property instead of switch
+
+2002-10-26 Piers Haken <piersh@friskit.com>
+
+ * XmlDocumentNavigator.cs: return invalid XPathNodeType (-1) for unknown node types.
+
+2002-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs: don't increment depth for entity references.
+
+2002-10-22 Tim Haynes <thaynes@openlinksw.com>
+
+ * - Fixed the duplication of xmlns:xx = yy when serializing the
+ XML for serialization
+
+ Fixed the unnecessary parsing/serializing when adding assemblies
+ for serialization
+
+ Avoided setting the XmlNode.InnerXml property
+ (as it's not implemented)
+
+ Fixed the usage/implementation of
+ XmlElement.GetElementsByTagName()
+
+2002-10-21 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs:
+ * XmlElement.cs:
+ * XmlNode.cs:
+ * XmlTextReader.cs: Implementation for XmlNode.InnerXml from
+ Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>.
+
+2002-10-18 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs: Applied a patch by Atsushi Enomoto
+ <ginga@kit.hi-ho.ne.jp>.
+
+2002-10-12 A.Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs (ImportNode): Implemented
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlDocument.cs: one more Load method implemented.
+ * XmlTextReader.cs: Depth now works.
+
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlConvert.cs: IsInvalid is now internal.
+ * XmlNamespaceManager.cs: implemented RemoveNamespace
+ * XmlTextReader.cs: return BaseURI and Encoding from the parser.
+ * XmlTextWriter.cs: implemented WriteName and WriteNmToken.
+
+2002-09-19 Matt Hunter <mahunter@tconl.com>
+
+ * XmlElement.cs: Implementing SetAttributeNode(localName,namespaceURI)
+ * XmlAttributeCollection.cs: Implemented Append (XmlAttribute)
+
+2002-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlConvert.cs: finished implementation.
+ * XmlTextReader.cs: fixed #30239.
+ * XmlTextWriter.cs: fixed #30240.
+
+2002-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs: line and position begin with 1.
+
+2002-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlException.cs: added a new internal constructor for IXmlLineInfo
+ and output line and position info in Message.
+
+ * XmlReader.cs: implemented missing bits.
+
+2002-09-12 Piers Haken <piersh@friksit.com>
+
+ * XmlDocumentNavigator.cs: implement MoveToId()
+
+2002-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextWriter.cs: fixed bug #29886.
+
+2002-08-26 Ravi Pratap <ravi@ximian.com>
+
+
+ * XmlAttribute.cs (InnerText): Implement getting this property.
+
+ * XmlNode.cs (InnerText): Ensure that we append only values of
+ text nodes.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlWriter.cs: made ws and namespaceManager protected. mcs has a bug
+ that allowed compiling this.
+ [ FIXME: filed bug #29435. mcs should have failed on this ]
+
+2002-08-25 Tim Coleman <tim@timcoleman.com>
+ * XmlNode.cs:
+ Change CreateNavigator to not be virtual.
+ * XmlElement.cs:
+ Add set_Prefix and InnerText accessors.
+ * XmlEntityReference.cs:
+ Add set_Value accessor.
+ * XmlTextWriter.cs:
+ Make objects which should be private private.
+ * XmlWriter.cs:
+ Remove WriteStartElementInternal abstract definition.
+ * XmlValidatingReader.cs:
+ New stubs added.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttributeCollection.cs, XmlElement.cs: Implementation of RemoveAll
+ and RemoveAllAttributes courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlElement.cs: Correction to previous GetElementsByTagName patch
+ courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlElement.cs: Added implementation of namepsace
+ qualified GetElementsByTagName courtesy of Matt Hunter
+ <xrkune@tconl.com>.
+
+2002-08-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlElement.cs: Added implementation of
+ GetElementsByTagName courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-16 Jason Diamond <jason@injektilo.org>
+
+ * XmlElement.cs: Fixed writing out qualified elements courtesy of
+ Marcus Bürgel <marcus.buergel@gmx.de>.
+
+2002-08-13 Tim Coleman <tim@timcoleman.com>
+ * XmlTextWriter.cs:
+ Partial implementation of WriteQualifiedName ().
+
+2002-08-07 Kral Ferch <kral_ferch@hotmail.com>
+ * XmlCharacterData.cs: Implemented AppendData(), DeleteData(),
+ InsertData(), and ReplaceData(). These methods fire the
+ NodeChanging and NodeChanged events.
+
+ * XmlDocument.cs: Fixed bugs in onNodeChanged() and onNodeChanging().
+
+ * XmlNode.cs: AppendChild() fires NodeInserting and NodeInserted events.
+ RemoveAll() and RemoveChild() fire NodeRemoving and NodeRemoved events.
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * XmlNamespaceManager.cs:
+ .Net allows the empty namespace to be redefined
+ at a later point, but the current implementation
+ did not. This fixes a hashtable conflict.
+
+2002-07-26 Tim Coleman <tim@timcoleman.com>
+ * XmlTextWriter.cs:
+ When given a textwriter, check to see if it has a
+ null encoding. This was being done for other inputs
+ than a textwriter.
+
+Wed Jul 24 13:16:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * XmlTextReader.cs: rough line/column support.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * XmlConvert.cs: Implement the ToDateTime method. ToDateTime
+ (string, string []) is particularly strange.
+
+ * XmlException.cs: Remember to call the base serialization
+ constructor.
+
+ * XmlNodeReader.cs: Keep a new variable to store the Depth.
+
+2002-07-14 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttribute.cs: Removed ownerElement field since we can reuse
+ parentNode field.
+
+ * XmlDocumentNavigator.cs: MoveToParent now moves to the OwnerElement
+ if the current node is an attribute.
+
+ * XmlElement.cs: SetAttributeNode now sets the new attribute's
+ owner element.
+
+2002-07-12 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs: If null was passed in for prefix or namespaceURI when
+ creating an element, use String.Empty instead.
+
+2002-07-12 Piers Haken <piersh@friksit.com>
+
+ * XmlAttributeCollection.cs: implement some ItemOf indexers
+ * XmlNamedNodeMap.cs: add internal 'Nodes' accessor for the nodeList field
+ * XmlNode.cs: SelectNodes: return empty XmlNodeList, not null
+
+2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+
+2002-10-26 Piers Haken <piersh@friskit.com>
+
+ * XmlDocumentNavigator.cs: return invalid XPathNodeType (-1) for unknown node types.
+
+2002-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs: don't increment depth for entity references.
+
+2002-10-22 Tim Haynes <thaynes@openlinksw.com>
+
+ * - Fixed the duplication of xmlns:xx = yy when serializing the
+ XML for serialization
+
+ Fixed the unnecessary parsing/serializing when adding assemblies
+ for serialization
+
+ Avoided setting the XmlNode.InnerXml property
+ (as it's not implemented)
+
+ Fixed the usage/implementation of
+ XmlElement.GetElementsByTagName()
+
+2002-10-21 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs:
+ * XmlElement.cs:
+ * XmlNode.cs:
+ * XmlTextReader.cs: Implementation for XmlNode.InnerXml from
+ Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>.
+
+2002-10-18 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs: Applied a patch by Atsushi Enomoto
+ <ginga@kit.hi-ho.ne.jp>.
+
+2002-10-12 A.Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocument.cs (ImportNode): Implemented
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlDocument.cs: one more Load method implemented.
+ * XmlTextReader.cs: Depth now works.
+
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlConvert.cs: IsInvalid is now internal.
+ * XmlNamespaceManager.cs: implemented RemoveNamespace
+ * XmlTextReader.cs: return BaseURI and Encoding from the parser.
+ * XmlTextWriter.cs: implemented WriteName and WriteNmToken.
+
+2002-09-19 Matt Hunter <mahunter@tconl.com>
+
+ * XmlElement.cs: Implementing SetAttributeNode(localName,namespaceURI)
+ * XmlAttributeCollection.cs: Implemented Append (XmlAttribute)
+
+2002-09-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlConvert.cs: finished implementation.
+ * XmlTextReader.cs: fixed #30239.
+ * XmlTextWriter.cs: fixed #30240.
+
+2002-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs: line and position begin with 1.
+
+2002-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlException.cs: added a new internal constructor for IXmlLineInfo
+ and output line and position info in Message.
+
+ * XmlReader.cs: implemented missing bits.
+
+2002-09-12 Piers Haken <piersh@friksit.com>
+
+ * XmlDocumentNavigator.cs: implement MoveToId()
+
+2002-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextWriter.cs: fixed bug #29886.
+
+2002-08-26 Ravi Pratap <ravi@ximian.com>
+
+
+ * XmlAttribute.cs (InnerText): Implement getting this property.
+
+ * XmlNode.cs (InnerText): Ensure that we append only values of
+ text nodes.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlWriter.cs: made ws and namespaceManager protected. mcs has a bug
+ that allowed compiling this.
+ [ FIXME: filed bug #29435. mcs should have failed on this ]
+
+2002-08-25 Tim Coleman <tim@timcoleman.com>
+ * XmlNode.cs:
+ Change CreateNavigator to not be virtual.
+ * XmlElement.cs:
+ Add set_Prefix and InnerText accessors.
+ * XmlEntityReference.cs:
+ Add set_Value accessor.
+ * XmlTextWriter.cs:
+ Make objects which should be private private.
+ * XmlWriter.cs:
+ Remove WriteStartElementInternal abstract definition.
+ * XmlValidatingReader.cs:
+ New stubs added.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttributeCollection.cs, XmlElement.cs: Implementation of RemoveAll
+ and RemoveAllAttributes courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlElement.cs: Correction to previous GetElementsByTagName patch
+ courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlElement.cs: Added implementation of namepsace
+ qualified GetElementsByTagName courtesy of Matt Hunter
+ <xrkune@tconl.com>.
+
+2002-08-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlElement.cs: Added implementation of
+ GetElementsByTagName courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-16 Jason Diamond <jason@injektilo.org>
+
+ * XmlElement.cs: Fixed writing out qualified elements courtesy of
+ Marcus Bürgel <marcus.buergel@gmx.de>.
+
+2002-08-13 Tim Coleman <tim@timcoleman.com>
+ * XmlTextWriter.cs:
+ Partial implementation of WriteQualifiedName ().
+
+2002-08-07 Kral Ferch <kral_ferch@hotmail.com>
+ * XmlCharacterData.cs: Implemented AppendData(), DeleteData(),
+ InsertData(), and ReplaceData(). These methods fire the
+ NodeChanging and NodeChanged events.
+
+ * XmlDocument.cs: Fixed bugs in onNodeChanged() and onNodeChanging().
+
+ * XmlNode.cs: AppendChild() fires NodeInserting and NodeInserted events.
+ RemoveAll() and RemoveChild() fire NodeRemoving and NodeRemoved events.
+
+2002-08-03 Tim Coleman <tim@timcoleman.com>
+ * XmlNamespaceManager.cs:
+ .Net allows the empty namespace to be redefined
+ at a later point, but the current implementation
+ did not. This fixes a hashtable conflict.
+
+2002-07-26 Tim Coleman <tim@timcoleman.com>
+ * XmlTextWriter.cs:
+ When given a textwriter, check to see if it has a
+ null encoding. This was being done for other inputs
+ than a textwriter.
+
+Wed Jul 24 13:16:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * XmlTextReader.cs: rough line/column support.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * XmlConvert.cs: Implement the ToDateTime method. ToDateTime
+ (string, string []) is particularly strange.
+
+ * XmlException.cs: Remember to call the base serialization
+ constructor.
+
+ * XmlNodeReader.cs: Keep a new variable to store the Depth.
+
+2002-07-14 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttribute.cs: Removed ownerElement field since we can reuse
+ parentNode field.
+
+ * XmlDocumentNavigator.cs: MoveToParent now moves to the OwnerElement
+ if the current node is an attribute.
+
+ * XmlElement.cs: SetAttributeNode now sets the new attribute's
+ owner element.
+
+2002-07-12 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs: If null was passed in for prefix or namespaceURI when
+ creating an element, use String.Empty instead.
+
+2002-07-12 Piers Haken <piersh@friksit.com>
+
+ * XmlAttributeCollection.cs: implement some ItemOf indexers
+ * XmlNamedNodeMap.cs: add internal 'Nodes' accessor for the nodeList field
+ * XmlNode.cs: SelectNodes: return empty XmlNodeList, not null
+
+2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlTextWriter: Fixed Indentation. IndentationOverridden should
+ not be set when inside a attribute.
+
+2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlTextWriter: In WriteStartElement, if namespace is null and
+ prefix is null|empty do not write out xmlns=""
+
+ * XmlWriter: WriteStartElement calls the virtual method with null
+ argument instead of empty string.
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReader.cs: implemented .ctor (Stream).
+
+2002-06-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlNodeReader.cs: Implementation of most of the properties, and
+ some of the related methods.
+
+2002-06-23 Piers Haken <piersh@friskit.com>
+
+ * XmlDocumentNavigator.cs: implement Clone()
+ * XmlElement.cs: remove bogus unimplemented override of InnerText
+ * XmlNode.cs: implment SelectNodes/SelectSingleNode
+ * XmlNodeArrayList.cs: new support class for SelectNodes
+
+2002-06-21 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlQualifiedName: Name and Namespaces are never null. If null is passed
+ to the constructor, set them to empty strings.
+ Fixed the Operators.
+
+2002-06-18 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlTextReader.cs: HasLineInfo returns false instead of throwing an
+ Exception.
+
+2002-06-14 Duncan Mak <duncan@ximian.com>
+
+ * XmlConvert.cs: Added CLSCompliant attributes to methods.
+
+2002-06-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlCharacterData.cs (Value): Throw an ArgumentException in the
+ set block if the node is read-only.
+
+2002-06-10 Ajay kumar Dwivedi <adwiv@yahoo.com>
+ * XmlConstruct.cs : New Internal class with Helper methods for
+ Checking XmlConstructs
+ * XmlConvert.cs: Implemented most of the methods
+
+2002-06-08 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs (Load):
+ Added bits to Load (string) for BaseURI support.
+
+ * XmlAttribute.cs (BaseURI):
+ * XmlDocument.cs (BaseURI):
+ * XmlEntity.cs (BaseURI): Implemented.
+
+2002-05-27 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentNavigator.cs: Added file to directory.
+
+ * XmlNode.cs (CreateNavigator): Implemented.
+ (InnerText): Implemented.
+
+ * XmlDocument.cs (NamespaceURI, Prefix): Return String.Empty instead of
+ throwing exception.
+ (Load(XmlReader)): Allow for namespace qualified attributes.
+
+ * XmlElement.cs: Implemented GetAttribute(string, string) and both
+ GetAttributeNode overloads.
+ (SetAttributeNode(XmlAttribute)): Implemented.
+
+ * XmlNamedNodeMap.cs: Fixed copy/paste bugs in GetNamedItem(string, string)
+ and RemoveNamedItem(string, string).
+
+ * XmlLinkedNode.cs (PreviousSibling): Implemented.
+
+ * XmlTextReader.cs: Added code to maintain the order of attributes as
+ they're parsed. XML doesn't require this but Microsoft's parser does it and
+ matching them makes testing easier so now we have it, too.
+
+2002-05-26 Miguel de Icaza <miguel@ximian.com>
+
+ * XmlDocument.cs: Implement the Save methods.
+
+2002-05-08 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlNamedNodeMap.cs (SetNamedItem): Fixed a copy/paste bug.
+
+2002-04-28 Duncan Mak <duncan@ximian.com>
+
+ * XmlSignificantWhitespace.cs (Value):
+ * XmlWhitespace.cs (Value): Added MonoTODO to the 'set'
+ block. Added new private method, IsValidWhitespaceChar, for
+ checking.
+
+2002-04-16 Duncan Mak <duncan@ximian.com>
+
+ * XmlParserContext.cs (NameTable): Fixed a typo in the set block.
+
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlAttribute.cs (Prefix): Added preliminary code for set block,
+ added comment on work that needs to be done here. A new MonoTODO item.
+
+ * XmlDocument.cs (ctor): Corrected constructor signature, changed
+ parameter from 'NameTable' to 'XmlNameTable'.
+
+ * XmlDocumentFragment.cs (InnerXml): Added missing set block.
+
+ * XmlCaseOrder.cs: Moved to System.Xml.XPath.
+
+2002-04-10 Duncan Mak <duncan@ximian.com>
+
+ * XmlNodeReader.cs: Initial stubs for the class.
+
+2002-04-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttributes.cs: InnerXml getter, WriteContentTo, and WriteTo
+ implementations.
+
+ * XmlDeclaration.cs: WriteTo implementation.
+
+ * XmlDocument.cs: InnerXml getter implementation.
+
+ * XmlElement.cs: InnerXml getter implementation.
+
+ * XmlNode.cs: Removed MonoTODO attrib on OuterXml.
+
+ * XmlSignificantWhitespace.cs: WriteTo implementation.
+
+ * XmlText.cs: WriteContentTo and WriteTo implementation.
+
+ * XmlTextWriter.cs: WriteRaw implementation.
+
+ * XmlWhitespace.cs: WriteContentTo and WriteTo implementations.
+
+2002-04-05 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttributes.cs: Added reminder MonoTODO to set NamespaceURI
+ if prefix in constructor is one of the default ones.
+
+ * XmlCharacterData.cs: Returns String.Empty for Value and Data
+ even when constructed with null.
+
+ * XmlDeclaration.cs: Value doesn't put encoding or standalone
+ in if they are empty.
+
+ * XmlDocument.cs: Implemented CreateNode methods and this caused
+ the changes in the other files in this checkin.
+
+ * XmlProcessingInstruction.cs: Returns String.Empty for Value and Data
+ even when constructed with null.
+
+ * XmlWhitespace.cs: Changed Value 'get' to return Data.
+
+2002-04-01 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Impls for WriteEndDocument and WriteFullEndElement.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Impls for LookupPrefix, WriteBase64,
+ and WriteCharEntity.
+
+ * XmlWrite.cs: Fixed bug where attribute namespace decl
+ was pushing a scope onto the namespace manager when it shouldn't
+ have been.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Some tweaks for WriteAttibuteString
+ in different states (no open start element, in WriteState.Content mode).
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: XmlLang and XmlSpace properties
+ and WriteWhitespace.
+
+ * XmlTextWriterOpenElement.cs: scope support for XmlLang
+ and XmlSpace.
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Working on Attribute methods.
+
+ * XmlWriter.cs: Working on Attribute methods.
+
+2002-03-28 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs (CreateWhitespace):
+ (CreateSignificantWhitespace): Removed extraneous call to the ToCharArray
+ method.
+
+ * XmlSignificantWhitespace.cs (Value): Removed MonoTODO attribute.
+
+2002-03-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs (CreateDocumentType): Implemented.
+
+ * XmlNode.cs (Value): Implemented.
+
+ * XmlProcessingInstruction.cs (InnerText): Implemented. It works just
+ like XmlCharacterData.
+
+ * XmlDeclaration.cs (CloneNode):
+ * XmlDocument.cs (CreateXmlDeclaration): Added missing constructor
+ arguments.
+
+ * XmlCharacterData.cs (InnerText): Implemented. Funny that the
+ docs say it is the "The concatenated values of the node and all
+ the children of the node.". I wrote some test programs and
+ couldn't get any of the derived nodes to AppendChild. For now,
+ InnerText == Data == Value.
+ (Substring): Fixed typo.
+
+ * XmlDeclaration.cs (XmlDeclaration): Fixed the constructor parameter signature.
+
+ * XmlImplementation.cs (CreateDocument): Implemented.
+
+2002-03-25 Duncan Mak <duncan@ximian.com>
+
+ * XmlDeclaration.cs: Rewrote the class, fixed formatting, added
+ missing properties (InnerText, Value).
+
+ * XmlDocument.cs (CreateXmlDeclaration): Implemented.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Impls for BaseStream and
+ Namespaces and WriteState.
+
+ * XmlWriter.cs: WriteState and WriteStartElementInternal.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeListChildren.cs: made class internal
+ instead of public. Shouldn't be visible outside
+ of System.Xml.
+
+ * XmlTextWriter.cs: Implementations for Formatting,
+ IndentChar, Indenting, QuoteChar, WriteStartDocument(standalone).
+ Suppresses encoding on xml declaration if null stream passed in.
+ Formats output including suppressing indentation for elements in
+ mixed content mode.
+
+ * XmlTextWriterOpenElement.cs: Initial checkin.
+ XmlTextWriter uses stack of these objects to track
+ state.
+
+2002-03-22 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlElement.cs: impl HasAttribute(string name).
+
+2002-03-22 Duncan Mak <duncan@ximian.com>
+
+ * XmlElement.cs: Reformatted.
+ (CloneNode) Corrected.
+
+ * XmlDocument.cs (CreateWhitespace):
+ (CreateSignificantWhitespace): Implemented.
+
+ * XmlAttribute.cs (CloneNode): Changed the child's CloneNode to
+ true, because Attributes have ChildNodes.
+
+2002-03-21 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: WriteStartDocument tracks state, writes out
+ xml declaration along with encoding. WriteEndElement throws
+ exception if no WriteStartElement exists.
+
+2002-03-20 Duncan Mak <duncan@ximian.com>
+
+ * XmlEntityReference.cs (CloneNode): Implemented.
+
+ * XmlException.cs (Message): Implemented. We need to cache the
+ message string because SystemException doesn't expose 'message'
+ from Exception.
+
+ * XmlText.cs (Value): Added in the missing Value property.
+
+2002-03-20 Duncan Mak <duncan@ximian.com>
+
+ * XmlAttribute.cs (CloneNode): Implemented.
+
+ * XmlDocumentFragment.cs (CloneNode): Implemented.
+
+ * XmlElement.cs (CloneNode): Implemented.
+
+2002-03-19 Duncan Mak <duncan@ximian.com>
+
+ * XmlNotation.cs: Added to CVS.
+
+ * XmlAttribute.cs (CloneNode): First crack at the CloneNode method.
+
+ * XmlCDataSection.cs (CloneNode): Implemented.
+
+ * XmlDocumentFragment.cs: Reformatted and added the missing properties
+ (InnerXml, OwnerDocument, ParentNode).
+ (CloneNode): Implemented.
+
+ * XmlSignificantWhitespace.cs (CloneNode): Implemented.
+ (Value) Implemented the 'get' property.
+
+ * XmlWhitespace.cs (Module): implemented.
+
+2002-03-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs: Fixed typo in Load that was duplicating the LocalName
+ in the prefix.
+
+2002-03-18 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Don't restore properties after reading last
+ attribute on an element.
+
+ * XmlDocument.cs: Move back to element after reading attributes
+ so that IsEmptyElement test succeeds.
+
+2002-03-18 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNamespaceManager.cs: Implemented LookupPrefix.
+
+ * XmlTextWriter.cs: Implemented namespace and prefix support.
+
+2002-03-18 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextReader.cs: Restores properties after
+ reading last attribute on an element.
+
+ * XmlNode.cs: AppendChild sets the parent
+ on the child.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlCDataSection.cs: Formatting, Implementation for WriteTo.
+
+ * XmlComment.cs: Implementations for WriteTo and WriteContentTo.
+
+ * XmlElement.cs: Fixed bug in WriteTo.
+
+ * XmlProcessingInstruction.cs: Formatting.
+
+ * XmlTextWriter.cs: Implementations for Close, WriteCData, WriteComment,
+ fixes for WriteEndElement, WriteProcessingInstruction.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocument.cs: Implementations for WriteTo() and WriteContentTo(),
+ had Load() add PIs to the document, moved onXXX methods to alphabetical
+ order in the file.
+
+ * XmlElement.cs: Implementations for WriteTo() and WriteContentTo().
+
+ * XmlNode.cs: Implementations for InnerXml Get and OuterXml.
+
+ * XmlProcessingInstruction.cs: Implementations for WriteTo() and
+ WriteContentTo().
+
+ * XmlTextWriter.cs: Implementations for WriteEndElement,
+ WriteProcessingInstruction, WriteStartElement, and WriteString.
+
+ * XmlWriter.cs: Implemented WriteStartElement() methods.
+
+2002-03-15 Duncan Mak <duncan@ximian.com>
+
+ * XmlEntity.cs: Added to CVS. Need to implement BaseURI and
+ InnerText once I know what they do.
+
+ * XmlDocumentType.cs (XmlDocumentType): Fix the constructor now
+ that we can properly chain constructors.
+ (CloneNode): implemented.
+ (WriteContentTo): Removed MonoTODO attribute as this method has no
+ effect in this class.
+
+ * XmlProcessingInstruction.cs (Value): Added the missing Set
+ block.
+ (InnerText): Added in, but not implemented.
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: implemented constructors and
+ WriteCData and WriteComment.
+
+2002-03-14 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs: Moved the NodeChanged EventHandler to its own
+ file, and updated the callbacks to reflect the change.
+ (XmlDocument): Added the NameTable constructor.
+ (NameTable): Also the NameTable property.
+
+ * XmlNodeChangedEventHandler.cs: Added, replacing the version that
+ was in XmlDocument.cs. It has two arguments now (object,
+ EventArgs) , instead of one (object).
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlWriter.cs: Formatting.
+
+ * XmlTextWriter.cs: Initial checkin.
+
+2002-03-14 Duncan Mak <duncan@ximian.com>
+
+ * Validation.cs: Removed, replaced by ValidationType.cs.
+
+ * ValidationType.cs: Added.
+
+2002-03-13 Duncan Mak <duncan@ximian.com>
+
+ * XmlException.cs: Made it [Serializable], implemented good ol'
+ GetObjectData, and the serialization constructor.
+
+ * XmlNamedNodeMap.cs (SetNamedItem): Check for the Name property.
+ (SetNamedItem): Reverted (added back in) the patch with the
+ ReadOnly checks. "Don't doubt yourself, my son... you were right!"
+
+ * XmlNamedNodeMap.cs (GetEnumerator): piggyback on the ArrayList implementation.
+ (GetNamedItem (string, string)): implemented.
+ (RemoveNamedItem): implemented.
+ (SetNamedItem): implemented.
+
+2002-03-12 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttribute.cs: Moved a method from amongst properties down to
+ it's alphabetical position in the methods section.
+
+ * XmlNode.cs: Passes in 'this' to XmlNodeList constructor instead of
+ last linked child. Set XmlNode base class to return false for IsReadOnly().
+ Implemented GetEnumerator() and RemoveChild().
+
+ * XmlNodeListChildren.cs: Now stores the parent instead of the last child.
+ This is to support the behavior that the Enumerator doesn't become invalid
+ when changes to the children occur. Flushed out rest of implementation for
+ MoveNext, Current, and Reset.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlCharacterData.cs: Reformatted the properties for better readability.
+
+ * XmlLinkedNode.cs: Removed the awful boxy comments.
+
+ * XmlNamedNodeMap.cs (Count):
+ (Item): Implemented. Tests will be coming.
+
+ * XmlEntityReference.cs:
+ * XmlSignificantWhitespace.cs: Implemented these classes except for
+ the Clone, WriteContentTo and WriteTo methods. Will have to
+ investigate into these later.
+
+2002-03-11 Duncan Mak <duncan@ximian.com>
+
+ * IHasXmlNode.cs: Added to CVS.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlParserContext.cs: Added missing constructors and missing Encoding
+ property.
+
+ * XmlTextReader.cs: Start using the XmlParserContext class.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Implemented MoveToElement and MoveToFirstAttribute.
+
+2002-03-08 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlNode.cs (Item): Implemented both indexers.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * DomEncodingType.cs, TreePosition.cs, XPathNodeType.cs, XmlDataType.cs,
+ XmlExceptionCode.cs, XmlSortOrder.cs, XmlUtil.cs: Removed files.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttribute.cs: Attribute nodes are supposed to store their values
+ as child nodes so updated to reflect that.
+
+ * XmlDocument.cs, XmlElement.cs, XmlNode.cs: Moved code that was
+ duplicated in XmlDocument and XmlElement into XmlNode so that it
+ wouldn't have to be duplicated in XmlAttribute, too.
+
+2002-03-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeList.cs, XmlDocument.cs, XmlLinkedNode.cs,
+ XmlNode.cs: Formatting.
+
+ * XmlNodeListChildren.cs: Implementation of XmlNodeList
+ for XmlNode.ChildNodes property.
+
+ * XmlNodeListAsArrayList.cs: Removed file. Using different
+ data structure (circular list) in XmlNode so this file
+ is no longer valid.
+
+ * XmlDocument.cs, XmlElement.cs: New ChildNodes tests found
+ bug in setter property of LastLinkedChild so fixed it.
+
+2002-03-06 Jason Diamond <jason@injektilo.org>
+
+ * XmlInputSource.cs, XmlNames_1_0.cs, XmlParse.cs: Removed files.
+ We already have a parser in XmlTextReader.
+
+ * XmlException.cs: Removed constructor accepting XmlInputSource.
+
+2002-03-06 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNode.cs: Rewrote this class from scratch with
+ MonoToDo attribs and NotImplementedExceptions. Now defines an
+ internal LastLinkedNode property to aid the new implementation.
+ XmlNodes only have ref to owner doc and parent nodes now.
+
+ * XmlLinkedNode.cs: Added NextLinkedSibling internal property
+ and ref to next sibling to support walking our circular child
+ node list.
+
+ * XmlDocument.cs: Added ref to last child node and overrides
+ XmlNode's internal LastLinkedChild property to support walking
+ our circular child node list.
+
+2002-03-02 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlProcessingInstructions.cs: Class was empty. Implemented
+ constructor, properties, and CloneNode() method. Put in
+ MonoToDo attrib for remaining methods.
+
+ * XmlComment.cs: Reformatted and put in MonoToDo attribs.
+ Got rid of helper methods and fields since they were no
+ longer needed.
+
+ * XmlLinkedNode.cs: Reformatted and put in MonoToDo attribs.
+
+ * XmlDocument.cs: Added code to Load(XmlReader) to create XmlComment,
+ XmlCDataSection, and XmlProcessingInstruction nodes. Implemented
+ Createxxx() methods for those three node types.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs: Implemented the remaining CreateElement and
+ CreateAttribute methods.
+
+ * XmlAttribute.cs: Re-implemented.
+
+ * XmlElement.cs: Set owner element on attributes. Reformatted.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Implemented MoveToNextAttribute().
+
+ * XmlDocument.cs: Reformatted. Adding missing methods and MonoTODO
+ attributes. Create attribute nodes while loading. Implemented
+ Load(string) and CreateTextNode().
+
+ * XmlCharacterData.cs, XmlText.cs: Re-implemented.
+
+ * XmlCDataSection.cs, XmlComment.cs: Call correct constructor in
+ XmlCharacterData.
+
+ * XmlNamedNodeMap.cs, XmlAttributeCollection.cs: Stubbed out.
+
+2002-03-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlAttribute.cs : Using fix.
+ * XmlDocument.cs (CreateAttribute(String)): Implement.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlNamespaceManager.cs: Atomize prefixes and namespaces strings in
+ the name table.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlNode.cs: Initial implementation of LoadXml
+ courtesy of Kral Ferch <kral.ferch@hotmail.com>.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlException.cs, XmlReader.cs, XmlTextReader.cs: Reformatted,
+ added missing members and MonoTODO attributes.
+
+ * XmlTextReader.cs: Throw XmlException instead of System.Exception.
+
+2002-02-27 Jason Diamond <jason@injektilo.org>
+
+ * XmlElement.cs: Reformatted, added missing members and MonoTODO
+ attributes.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlCDataSection.cs: Initial implementation.
+
+ * NameTable.cs: Fixed the whole thing. Wrote a NUnit test to test
+ it out. This should (hopefully) be correct.
+
+2002-02-26 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Apparently Microsoft's implementation treats
+ namespace declarations as attributes so we do now, too.
+
+ * XmlNamespaceManager.cs: HasNamespace fixed so that it only
+ checks the current scope.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocumentType.cs: Added a few hacks here and there to
+ temporarily fix the "I broke the build issue".
+
+2002-02-25 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlElement.cs, XmlNode.xs, XmlNodeList.cs,
+ XmlNodeListAsArrayList.cs: Multiple fixes necessary to get
+ simple test to pass. The existing code is really shitty so I'll
+ probably start writing tests and refactoring before much else
+ can get done.
+
+2002-02-25 Duncan Mak <duncan@ximian.com>
+
+ * NameTable.cs: Implemented.
+
+ * XmlDeclaration.cs: It should inherit from XmlLinkedNode, not XmlNode.
+
+2002-02-24 Duncan Mak <duncan@ximian.com>
+
+ * XmlNodeOrder.cs: Added to CVS.
+
+ * XmlQualifiedName.cs: Fixed a warning from Equals ().
+
+ * XmlTokenizedType.cs: Added to CVS.
+
+ * XmlUrlResolver.cs: Added to CVS with one TODO task.
+
+2002-02-23 Duncan Mak <duncan@ximian.com>
+
+ * XmlQualifiedName.cs: Fixed ToString () and added the operators
+ (== and !=).
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Added support for qualified attributes.
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * XmlNamespaceManager.cs: Initial implementation.
+
+ * XmlTextReader.cs: Added support for NamespaceURI property on
+ elements.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * XmlQualifiedName.cs: Fixed compile errors so it would build. Still has
+ MonoTODO's
+
diff --git a/mcs/class/System.XML/System.Xml/Driver.cs b/mcs/class/System.XML/System.Xml/Driver.cs
new file mode 100644
index 00000000000..80f9cf32934
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/Driver.cs
@@ -0,0 +1,56 @@
+//
+// Driver.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+public class Driver
+{
+ public static void Main(string[] args)
+ {
+ XmlReader xmlReader = null;
+
+ if (args.Length < 1)
+ {
+ xmlReader = new XmlTextReader(Console.In);
+ }
+ else
+ {
+ xmlReader = new XmlTextReader(args[0]);
+ }
+
+ while (xmlReader.Read())
+ {
+ Console.WriteLine("NodeType = {0}", xmlReader.NodeType);
+ Console.WriteLine(" Name = {0}", xmlReader.Name);
+ Console.WriteLine(" IsEmptyElement = {0}", xmlReader.IsEmptyElement);
+ Console.WriteLine(" HasAttributes = {0}", xmlReader.HasAttributes);
+ Console.WriteLine(" AttributeCount = {0}", xmlReader.AttributeCount);
+ Console.WriteLine(" HasValue = {0}", xmlReader.HasValue);
+ Console.WriteLine(" Value = {0}", xmlReader.Value);
+ Console.WriteLine(" Depth = {0}", xmlReader.Depth);
+
+ if (xmlReader.HasAttributes)
+ {
+ while (xmlReader.MoveToNextAttribute())
+ {
+ Console.WriteLine(" AttributeName = {0}", xmlReader.Name);
+ Console.WriteLine(" AttributeValue = {0}", xmlReader.Value);
+
+ while (xmlReader.ReadAttributeValue())
+ {
+ Console.WriteLine(" AttributeValueNodeType = {0}", xmlReader.NodeType);
+ Console.WriteLine(" AttributeValueName = {0}", xmlReader.Name);
+ Console.WriteLine(" AttributeValueValue = {0}", xmlReader.Value);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/EntityHandling.cs b/mcs/class/System.XML/System.Xml/EntityHandling.cs
new file mode 100755
index 00000000000..c54b016b1e6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/EntityHandling.cs
@@ -0,0 +1,29 @@
+// EntityHandling.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:46:17 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum EntityHandling {
+
+ /// <summary>
+ /// </summary>
+ ExpandEntities = 1,
+
+ /// <summary>
+ /// </summary>
+ ExpandCharEntities = 2,
+ } // EntityHandling
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/Formatting.cs b/mcs/class/System.XML/System.Xml/Formatting.cs
new file mode 100755
index 00000000000..2586f58a04d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/Formatting.cs
@@ -0,0 +1,29 @@
+// Formatting.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:21 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum Formatting {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ Indented = 1,
+ } // Formatting
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/IHasXmlNode.cs b/mcs/class/System.XML/System.Xml/IHasXmlNode.cs
new file mode 100755
index 00000000000..6eaef10dcfa
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/IHasXmlNode.cs
@@ -0,0 +1,15 @@
+//
+// System.Xml.IHasXmlNode.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public interface IHasXmlNode
+ {
+ XmlNode GetNode ();
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/IXmlLineInfo.cs b/mcs/class/System.XML/System.Xml/IXmlLineInfo.cs
new file mode 100644
index 00000000000..d49e1e93208
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/IXmlLineInfo.cs
@@ -0,0 +1,19 @@
+//
+// System.Xml.IXmlLineInfo.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ public interface IXmlLineInfo
+ {
+ int LineNumber { get; }
+ int LinePosition { get; }
+
+ bool HasLineInfo();
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/NameTable.cs b/mcs/class/System.XML/System.Xml/NameTable.cs
new file mode 100755
index 00000000000..c8533218040
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/NameTable.cs
@@ -0,0 +1,74 @@
+//
+// System.Xml.NameTable.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class NameTable : XmlNameTable
+ {
+ // Fields
+ Hashtable table;
+
+ // Constructor
+ public NameTable ()
+ : base ()
+ {
+ table = new Hashtable ();
+ }
+
+ // Method
+ public override string Add (string key)
+ {
+ if (table.Contains (key))
+ return (string) table [key];
+ else {
+ table.Add (key, key);
+ return key;
+ }
+ }
+
+ public override string Add (char[] key, int start, int len)
+ {
+ if (((0 > start) && (start >= key.Length))
+ || ((0 > len) && (len >= key.Length - len)))
+ throw new IndexOutOfRangeException ("The Index is out of range.");
+
+ if (len == 0)
+ return String.Empty;
+
+ string item = new string (key, start, len);
+
+ return Add (item);
+ }
+
+ public override string Get (string key)
+ {
+ if (! (table.Contains (key)))
+ return null;
+ else
+ return (string) table [key];
+
+ }
+
+ public override string Get (char[] array, int offset, int length)
+ {
+ if (((0 > offset) && (offset >= array.Length))
+ || ((0 > length) && (length >= array.Length - offset)))
+ throw new IndexOutOfRangeException ("The Index is out of range.");
+
+ if (length == 0)
+ return String.Empty;
+
+ string key = new string (array, offset, length);
+
+ return Get (key);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/Profile.cs b/mcs/class/System.XML/System.Xml/Profile.cs
new file mode 100644
index 00000000000..d16049576d1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/Profile.cs
@@ -0,0 +1,47 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// Profile.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+using System.IO;
+using System.Text;
+
+public class Profile
+{
+ public static void Main(string[] args)
+ {
+ XmlReader xmlReader = null;
+
+ if (args.Length < 1)
+ {
+ xmlReader = new XmlTextReader(Console.In);
+ }
+ else
+ {
+ xmlReader = new XmlTextReader(args[0]);
+ }
+
+ int nodes = 0;
+
+ DateTime start = DateTime.Now;
+
+ while (xmlReader.Read())
+ {
+ ++nodes;
+ }
+
+ DateTime end = DateTime.Now;
+
+ Console.WriteLine("time = {0}", end - start);
+
+ Console.WriteLine("nodes = {0}", nodes);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/ReadState.cs b/mcs/class/System.XML/System.Xml/ReadState.cs
new file mode 100644
index 00000000000..6675af3990f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/ReadState.cs
@@ -0,0 +1,41 @@
+// ReadState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:27 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ReadState {
+
+ /// <summary>
+ /// </summary>
+ Initial = 0,
+
+ /// <summary>
+ /// </summary>
+ Interactive = 1,
+
+ /// <summary>
+ /// </summary>
+ Error = 2,
+
+ /// <summary>
+ /// </summary>
+ EndOfFile = 3,
+
+ /// <summary>
+ /// </summary>
+ Closed = 4,
+ } // ReadState
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/TODOAttribute.cs b/mcs/class/System.XML/System.Xml/TODOAttribute.cs
new file mode 100644
index 00000000000..741cd760c1f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Xml {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/ValidationType.cs b/mcs/class/System.XML/System.Xml/ValidationType.cs
new file mode 100755
index 00000000000..d746324e256
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/ValidationType.cs
@@ -0,0 +1,20 @@
+// System.Xml.ValidationType.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Xml
+{
+ public enum ValidationType
+ {
+ None = 0,
+ Auto = 1,
+ DTD = 2,
+ XDR = 3,
+ Schema = 4,
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml/WhitespaceHandling.cs b/mcs/class/System.XML/System.Xml/WhitespaceHandling.cs
new file mode 100644
index 00000000000..8e9962b367e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/WhitespaceHandling.cs
@@ -0,0 +1,33 @@
+// WhitespaceHandling.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:33 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WhitespaceHandling {
+
+ /// <summary>
+ /// </summary>
+ All = 0,
+
+ /// <summary>
+ /// </summary>
+ Significant = 1,
+
+ /// <summary>
+ /// </summary>
+ None = 2,
+ } // WhitespaceHandling
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/WriteState.cs b/mcs/class/System.XML/System.Xml/WriteState.cs
new file mode 100755
index 00000000000..7d387708782
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/WriteState.cs
@@ -0,0 +1,53 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.WriteState
+//
+// Author:
+// Daniel Weber (daniel-weber@austin.rr.com)
+//
+// (C) 2001 Daniel Weber
+
+namespace System.Xml
+{
+
+
+ /// <summary>
+ /// </summary>
+ public enum WriteState {
+
+ /// <summary>
+ /// A write method has not been called.
+ /// </summary>
+ Start = 0,
+
+ /// <summary>
+ /// The prolog is being written.
+ /// </summary>
+ Prolog = 1,
+
+ /// <summary>
+ /// An element start tag is being written.
+ /// </summary>
+ Element = 2,
+
+ /// <summary>
+ /// An attribute is being written.
+ /// </summary>
+ Attribute = 3,
+
+ /// <summary>
+ /// Element content is being written.
+ /// </summary>
+ Content = 4,
+
+ /// <summary>
+ /// The close method has been called.
+ /// </summary>
+ Closed = 5,
+
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
new file mode 100644
index 00000000000..167a9b18aba
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
@@ -0,0 +1,244 @@
+//
+// System.Xml.XmlAttribute
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Text;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public class XmlAttribute : XmlNode
+ {
+ #region Fields
+
+ private XmlLinkedNode lastChild;
+ private string localName;
+ private string namespaceURI;
+ private string prefix;
+ internal bool isDefault;
+ private XmlElement ownerElement;
+
+ #endregion
+
+ #region Constructor
+
+ [MonoTODO("need to set namespaceURI if prefix is recognized built-in ones like xmlns")]
+ protected internal XmlAttribute (
+ string prefix,
+ string localName,
+ string namespaceURI,
+ XmlDocument doc) : base (doc)
+ {
+ // What to be recognized is: xml:space, xml:lang, xml:base, and
+ // xmlns and xmlns:* (when XmlDocument.Namespaces = true only)
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string BaseURI {
+ get {
+ return OwnerElement.BaseURI;
+ }
+ }
+
+ public override string InnerText {
+ get {
+ StringBuilder builder = new StringBuilder ();
+ AppendChildValues (this, builder);
+ return builder.ToString ();
+ }
+
+ set {
+ Value = value;
+ }
+ }
+
+ private void AppendChildValues (XmlNode parent, StringBuilder builder)
+ {
+ XmlNode node = parent.FirstChild;
+
+ while (node != null) {
+ builder.Append (node.Value);
+ AppendChildValues (node, builder);
+ node = node.NextSibling;
+ }
+ }
+
+ [MonoTODO ("Setter is incomplete(XmlTextReader.ReadAttribute is incomplete;No resolution for xml:lang/space")]
+ public override string InnerXml {
+ get {
+ // Not sure why this is an override. Passing through for now.
+ return base.InnerXml;
+ }
+
+ set {
+ XmlNamespaceManager nsmgr = ConstructNamespaceManager ();
+ XmlParserContext ctx = new XmlParserContext (OwnerDocument.NameTable, nsmgr, XmlLang, this.XmlSpace);
+ XmlTextReader xtr = OwnerDocument.ReusableReader;
+ xtr.SetReaderContext (BaseURI, ctx);
+ xtr.SetReaderFragment (new System.IO.StringReader ("'" + value.Replace ("'", "&apos;") + "'"), XmlNodeType.Attribute);
+
+ OwnerDocument.ReadAttributeNodeValue (xtr, this);
+ }
+ }
+
+ public override string LocalName {
+ get {
+ return localName;
+ }
+ }
+
+ public override string Name {
+ get {
+ return prefix != String.Empty ? prefix + ":" + localName : localName;
+ }
+ }
+
+ public override string NamespaceURI {
+ get {
+ return namespaceURI;
+ }
+ }
+
+ public override XmlNodeType NodeType {
+ get {
+ return XmlNodeType.Attribute;
+ }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.Attribute;
+ }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get {
+ return base.OwnerDocument;
+ }
+ }
+
+ public virtual XmlElement OwnerElement {
+ get {
+ return ownerElement;
+ }
+ }
+
+ public override XmlNode ParentNode {
+ get {
+ // It always returns null (by specification).
+ return null;
+ }
+ }
+
+ [MonoTODO("setter incomplete (name character check, format check, wrong prefix&nsURI)")]
+ // We gotta do more in the set block here
+ // We need to do the proper tests and throw
+ // the correct Exceptions
+ //
+ // Wrong cases are: (1)check readonly, (2)check character validity,
+ // (3)check format validity, (4)this is attribute and qualifiedName != "xmlns"
+ // (5)when argument is 'xml' or 'xmlns' and namespaceURI doesn't match
+ public override string Prefix {
+ set {
+ if(IsReadOnly)
+ throw new XmlException ("This node is readonly.");
+
+ XmlNamespaceManager nsmgr = ConstructNamespaceManager ();
+ string nsuri = nsmgr.LookupNamespace (value);
+ if(nsuri == null)
+ throw new XmlException ("Namespace URI not found for this prefix");
+
+ prefix = value;
+ }
+
+ get {
+ return prefix;
+ }
+ }
+
+ [MonoTODO("There are no code which sets 'specified = true', so this logic is without checking.")]
+ public virtual bool Specified {
+ get {
+ return !isDefault;
+ }
+ }
+
+ public override string Value {
+ get {
+ XmlNode firstChild = FirstChild;
+ if (firstChild == null)
+ return String.Empty;
+ return firstChild.Value;
+ }
+
+ set {
+ XmlNode firstChild = FirstChild;
+ if (firstChild == null)
+ AppendChild (OwnerDocument.CreateTextNode (value));
+ else
+ firstChild.Value = value;
+ }
+ }
+
+ internal override string XmlLang {
+ get { return OwnerElement.XmlLang; }
+ }
+
+ internal override XmlSpace XmlSpace {
+ get { return OwnerElement.XmlSpace; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
+ OwnerDocument);
+ if (deep) {
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (true));
+ node = node.NextSibling;
+ }
+ }
+
+ return node;
+ }
+
+ // Parent of XmlAttribute must be null
+ internal void SetOwnerElement (XmlElement el) {
+ ownerElement = el;
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ w.WriteString (Value);
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteAttributeString (prefix, localName, namespaceURI, Value);
+ }
+
+ #endregion
+
+ internal override XmlLinkedNode LastLinkedChild {
+ get { return lastChild; }
+
+ set { lastChild = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
new file mode 100644
index 00000000000..5c9694da556
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
@@ -0,0 +1,207 @@
+//
+// System.Xml.XmlAttributeCollection
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlAttributeCollection : XmlNamedNodeMap, ICollection
+ {
+ XmlElement ownerElement;
+
+ internal XmlAttributeCollection (XmlNode parent) : base (parent)
+ {
+ ownerElement = parent as XmlElement;
+ if(ownerElement == null)
+ throw new XmlException ("invalid construction for XmlAttributeCollection.");
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool IsReadOnly {
+ get {
+ return ownerElement.IsReadOnly;
+ }
+ }
+
+ [MonoTODO]
+ [System.Runtime.CompilerServices.IndexerName ("ItemOf")]
+ public virtual XmlAttribute this [string name] {
+ get {
+ return (XmlAttribute) GetNamedItem (name);
+ }
+ }
+
+ [MonoTODO]
+ [System.Runtime.CompilerServices.IndexerName ("ItemOf")]
+ public virtual XmlAttribute this [int i] {
+ get {
+ return (XmlAttribute) Nodes [i];
+ }
+ }
+
+ [MonoTODO]
+ [System.Runtime.CompilerServices.IndexerName ("ItemOf")]
+ public virtual XmlAttribute this [string localName, string namespaceURI] {
+ get {
+ return (XmlAttribute) GetNamedItem (localName, namespaceURI);
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ public virtual XmlAttribute Append (XmlAttribute node)
+ {
+ XmlNode xmlNode = this.SetNamedItem (node);
+ return node;
+ }
+
+ public void CopyTo (XmlAttribute[] array, int index)
+ {
+ // assuming that Nodes is a correct collection.
+ for(int i=0; i<Nodes.Count; i++)
+ array [index + i] = Nodes [i] as XmlAttribute;
+ }
+
+ [MonoTODO] // I don't know why this method is required...
+ void ICollection.CopyTo (Array array, int index)
+ {
+ // assuming that Nodes is a correct collection.
+ array.CopyTo (Nodes.ToArray (typeof(XmlAttribute)), index);
+ }
+
+ public virtual XmlAttribute InsertAfter (XmlAttribute newNode, XmlAttribute refNode)
+ {
+ if(newNode.OwnerDocument != this.ownerElement.OwnerDocument)
+ throw new ArgumentException ("different document created this newNode.");
+
+ ownerElement.OwnerDocument.onNodeInserting (newNode, null);
+
+ int pos = Nodes.Count + 1;
+ if(refNode != null)
+ {
+ for(int i=0; i<Nodes.Count; i++)
+ {
+ XmlNode n = Nodes [i] as XmlNode;
+ if(n == refNode)
+ {
+ pos = i + 1;
+ break;
+ }
+ }
+ if(pos > Nodes.Count)
+ throw new XmlException ("refNode not found in this collection.");
+ }
+ else
+ pos = 0;
+ SetNamedItem (newNode, pos);
+
+ ownerElement.OwnerDocument.onNodeInserted (newNode, null);
+
+ return newNode;
+ }
+
+ public virtual XmlAttribute InsertBefore (XmlAttribute newNode, XmlAttribute refNode)
+ {
+ if(newNode.OwnerDocument != this.ownerElement.OwnerDocument)
+ throw new ArgumentException ("different document created this newNode.");
+
+ ownerElement.OwnerDocument.onNodeInserting (newNode, null);
+
+ int pos = Nodes.Count;
+ if(refNode != null)
+ {
+ for(int i=0; i<Nodes.Count; i++)
+ {
+ XmlNode n = Nodes [i] as XmlNode;
+ if(n == refNode)
+ {
+ pos = i;
+ break;
+ }
+ }
+ if(pos == Nodes.Count)
+ throw new XmlException ("refNode not found in this collection.");
+ }
+ SetNamedItem (newNode, pos);
+
+ ownerElement.OwnerDocument.onNodeInserted (newNode, null);
+
+ return newNode;
+ }
+
+ public virtual XmlAttribute Prepend (XmlAttribute node)
+ {
+ return this.InsertAfter (node, null);
+ }
+
+ public virtual XmlAttribute Remove (XmlAttribute node)
+ {
+ if(node == null || node.OwnerDocument != this.ownerElement.OwnerDocument)
+ throw new ArgumentException ("node is null or different document created this node.");
+
+ XmlAttribute retAttr = null;
+ foreach(XmlAttribute attr in Nodes)
+ {
+ if(attr == node)
+ {
+ retAttr = attr;
+ break;
+ }
+ }
+
+ if(retAttr != null)
+ {
+ ownerElement.OwnerDocument.onNodeRemoving (node, null);
+ base.RemoveNamedItem (retAttr.LocalName, retAttr.NamespaceURI);
+ ownerElement.OwnerDocument.onNodeRemoved (node, null);
+ }
+ return retAttr;
+ }
+
+ public virtual void RemoveAll ()
+ {
+ while(Count > 0)
+ Remove ((XmlAttribute)Nodes [0]);
+ }
+
+ public virtual XmlAttribute RemoveAt (int i)
+ {
+ if(Nodes.Count <= i)
+ return null;
+ return Remove ((XmlAttribute)Nodes [i]);
+ }
+
+ public override XmlNode SetNamedItem (XmlNode node)
+ {
+ return SetNamedItem(node, -1);
+ }
+
+ [MonoTODO("event handling")]
+ internal new XmlNode SetNamedItem (XmlNode node, int pos)
+ {
+ if(IsReadOnly)
+ throw new XmlException ("this AttributeCollection is read only.");
+
+ return base.SetNamedItem (node, pos);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlCDataSection.cs b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
new file mode 100644
index 00000000000..fae85718883
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
@@ -0,0 +1,54 @@
+//
+// System.Xml.XmlCDataSection.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlCDataSection : XmlCharacterData
+ {
+ #region Constructors
+
+ protected internal XmlCDataSection (string data, XmlDocument doc)
+ : base (data, doc)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string LocalName {
+ get { return "#cdata-section"; }
+ }
+
+ public override string Name {
+ get { return "#cdata-section"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.CDATA; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlCDataSection (Data, OwnerDocument); // CDATA nodes have no children.
+ }
+
+ public override void WriteContentTo (XmlWriter w) { }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteCData (Data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlChar.cs b/mcs/class/System.XML/System.Xml/XmlChar.cs
new file mode 100644
index 00000000000..3bdd932c82b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlChar.cs
@@ -0,0 +1,205 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.XmlChar.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ internal class XmlChar
+ {
+ internal static bool IsWhitespace(int ch)
+ {
+ return ch == 0x20 || ch == 0x9 || ch == 0xD || ch == 0xA;
+ }
+
+ internal static bool IsFirstNameChar(int ch)
+ {
+ bool result = false;
+
+ if (ch >= 0 && ch <= 0xFFFF)
+ {
+ result = (nameBitmap[(firstNamePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
+ }
+
+ return result;
+ }
+
+ internal static bool IsNameChar(int ch)
+ {
+ bool result = false;
+
+ if (ch >= 0 && ch <= 0xFFFF)
+ {
+ result = (nameBitmap[(namePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
+ }
+
+ return result;
+ }
+
+ internal static bool IsPubidChar(int ch)
+ {
+ return IsWhitespace(ch) | ('a' <= ch && ch <= 'z') | ('A' <= ch && ch <= 'Z') | ('0' <= ch && ch <= '9') | "-'()+,./:=?;!*#@$_%".IndexOf((char)ch) >= 0;
+ }
+
+ private static byte[] firstNamePages =
+ {
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
+ 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
+ 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ private static byte[] namePages =
+ {
+ 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
+ 0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
+ 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
+ 0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ private static uint[] nameBitmap =
+ {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
+ 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
+ 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
+ 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
+ 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
+ 0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
+ 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
+ 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
+ 0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
+ 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
+ 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
+ 0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
+ 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
+ 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
+ 0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
+ 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
+ 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
+ 0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
+ 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
+ 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
+ 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
+ 0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
+ 0x40000000, 0xF580C900, 0x00000007, 0x02010800,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
+ 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
+ 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
+ 0x00000000, 0x00004C40, 0x00000000, 0x00000000,
+ 0x00000007, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
+ 0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
+ 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
+ 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
+ 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
+ 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
+ 0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
+ 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
+ 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
+ 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
+ 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
+ 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
+ 0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
+ 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
+ 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
+ 0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
+ 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
+ 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
+ 0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
+ 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
+ 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
+ 0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
+ 0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
+ 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
+ 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
+ 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
+ 0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF
+ };
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlCharacterData.cs b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs
new file mode 100644
index 00000000000..a9fc7d267a6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs
@@ -0,0 +1,134 @@
+//
+// System.Xml.XmlCharacterData.cs
+//
+// Authors:
+// Jason Diamond <jason@injektilo.org>
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Jason Diamond, Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+ public abstract class XmlCharacterData : XmlLinkedNode
+ {
+ private string data;
+
+ #region Constructor
+
+ protected internal XmlCharacterData (string data, XmlDocument doc)
+ : base (doc)
+ {
+ if (data == null)
+ data = String.Empty;
+
+ this.data = data;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual string Data {
+ get { return data; }
+
+ set {
+ OwnerDocument.onNodeChanging (this, this.ParentNode);
+
+ if (IsReadOnly)
+ throw new ArgumentException ("Node is read-only.");
+
+ data = value;
+
+ OwnerDocument.onNodeChanged (this, this.ParentNode);
+ }
+ }
+
+ public override string InnerText {
+ get { return data; }
+
+ set { Data = value; } // invokes events
+ }
+
+ public virtual int Length {
+ get { return data != null ? data.Length : 0; }
+ }
+
+ public override string Value {
+ get { return data; }
+
+ set {
+ Data = value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public virtual void AppendData (string strData)
+ {
+ OwnerDocument.onNodeChanging (this, this.ParentNode);
+ data += strData;
+ OwnerDocument.onNodeChanged (this, this.ParentNode);
+ }
+
+ public virtual void DeleteData (int offset, int count)
+ {
+ OwnerDocument.onNodeChanging (this, this.ParentNode);
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset", "Must be non-negative and must not be greater than the length of this instance.");
+
+ int newCount = data.Length - offset;
+
+ if ((offset + count) < data.Length)
+ newCount = count;
+
+ data = data.Remove (offset, newCount);
+
+ OwnerDocument.onNodeChanged (this, this.ParentNode);
+ }
+
+ public virtual void InsertData (int offset, string strData)
+ {
+ OwnerDocument.onNodeChanging (this, this.ParentNode);
+
+ if ((offset < 0) || (offset > data.Length))
+ throw new ArgumentOutOfRangeException ("offset", "Must be non-negative and must not be greater than the length of this instance.");
+
+ data = data.Insert(offset, strData);
+
+ OwnerDocument.onNodeChanged (this, this.ParentNode);
+ }
+
+ public virtual void ReplaceData (int offset, int count, string strData)
+ {
+ OwnerDocument.onNodeChanging (this, this.ParentNode);
+
+ if ((offset < 0) || (offset > data.Length))
+ throw new ArgumentOutOfRangeException ("offset", "Must be non-negative and must not be greater than the length of this instance.");
+
+ if (strData == null)
+ throw new ArgumentNullException ("strData", "Must be non-null.");
+
+ string newData = data.Substring (0, offset) + strData;
+
+ if ((offset + count) < data.Length)
+ newData += data.Substring (offset + count);
+
+ data = newData;
+
+ OwnerDocument.onNodeChanged (this, this.ParentNode);
+ }
+
+ public virtual string Substring (int offset, int count)
+ {
+ return data.Substring (offset, count);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlComment.cs b/mcs/class/System.XML/System.Xml/XmlComment.cs
new file mode 100644
index 00000000000..a515a1a95f9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlComment.cs
@@ -0,0 +1,65 @@
+//
+// System.Xml.XmlComment
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public class XmlComment : XmlCharacterData
+ {
+ #region Constructors
+
+ protected internal XmlComment (string comment, XmlDocument doc)
+ : base (comment, doc)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string LocalName {
+ get { return "#comment"; }
+ }
+
+ public override string Name {
+ get { return "#comment"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Comment; }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.Comment;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ // discard deep because Comments have no children.
+ return new XmlComment(Value, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) { }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteComment (Data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlConstructs.cs b/mcs/class/System.XML/System.Xml/XmlConstructs.cs
new file mode 100755
index 00000000000..7f23eba5e44
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlConstructs.cs
@@ -0,0 +1,545 @@
+using System;
+
+namespace System.Xml
+{
+ /// <summary>
+ /// http://www.w3.org/TR/REC-xml
+ /// </summary>
+ /// <remarks>
+ /// Includes code and Ideas from org.apache.xerces.util.XMLChar class of Xerces 2.0.1
+ /// However, No surrogate support is included in this class.
+ /// This class is currently public. Make it internal after testing completes
+ /// </remarks>
+ public class XmlConstructs
+ {
+ /** Character flags. */
+ internal static byte[] CHARS = new byte[1 << 16];
+
+ /** Valid character mask. */
+ internal static int VALID = 0x01;
+
+ /** Space character mask. */
+ internal static int SPACE = 0x02;
+
+ /** Name start character mask. */
+ internal static int NAME_START = 0x04;
+
+ /** Name character mask. */
+ internal static int NAME = 0x08;
+
+ /** Pubid character mask. */
+ internal static int PUBID = 0x10;
+ /**
+ * Content character mask. Special characters are those that can
+ * be considered the start of markup, such as '&lt;' and '&amp;'.
+ * The various newline characters are considered special as well.
+ * All other valid XML characters can be considered content.
+ * <p>
+ * This is an optimization for the inner loop of character scanning.
+ */
+ internal static int CONTENT = 0x20;
+
+ /** NCName start character mask. */
+ internal static int NCNAME_START = 0x40;
+
+ /** NCName character mask. */
+ internal static int NCNAME = 0x80;
+
+ static XmlConstructs()
+ {
+ //
+ // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |
+ // [#xE000-#xFFFD] | [#x10000-#x10FFFF]
+ //
+ int[] charRange = {
+ 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD,
+ };
+
+ //
+ // [3] S ::= (#x20 | #x9 | #xD | #xA)+
+ //
+ int[] spaceChar = {
+ 0x0020, 0x0009, 0x000D, 0x000A,
+ };
+
+ //
+ // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
+ // CombiningChar | Extender
+ //
+ int[] nameChar = {
+ 0x002D, 0x002E, // '-' and '.'
+ };
+
+ //
+ // [5] Name ::= (Letter | '_' | ':') (NameChar)*
+ //
+
+ int[] nameStartChar = {
+ 0x003A, 0x005F, // ':' and '_'
+ };
+
+ //
+ // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
+ //
+
+ int[] pubidChar = {
+ 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D,
+ 0x005F
+ };
+
+ int[] pubidRange = {
+ 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A
+ };
+
+ //
+ // [84] Letter ::= BaseChar | Ideographic
+ //
+
+ int[] letterRange = {
+ // BaseChar
+ 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6,
+ 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E,
+ 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217,
+ 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1,
+ 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C,
+ 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4,
+ 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5,
+ 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA,
+ 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7,
+ 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6,
+ 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990,
+ 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD,
+ 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10,
+ 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36,
+ 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B,
+ 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3,
+ 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28,
+ 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D,
+ 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95,
+ 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA,
+ 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10,
+ 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61,
+ 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3,
+ 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10,
+ 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E,
+ 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88,
+ 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB,
+ 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47,
+ 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103,
+ 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155,
+ 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF,
+ 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9,
+ 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D,
+ 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC,
+ 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB,
+ 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B,
+ 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C,
+ 0xAC00, 0xD7A3,
+ // Ideographic
+ 0x3021, 0x3029, 0x4E00, 0x9FA5,
+ };
+ int[] letterChar = {
+ // BaseChar
+ 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5,
+ 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C,
+ 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0,
+ 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E,
+ 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E,
+ 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B,
+ 0x1F5D, 0x1FBE, 0x2126, 0x212E,
+ // Ideographic
+ 0x3007,
+ };
+
+ //
+ // [87] CombiningChar ::= ...
+ //
+
+ int[] combiningCharRange = {
+ 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1,
+ 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652,
+ 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8,
+ 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954,
+ 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8,
+ 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48,
+ 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5,
+ 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43,
+ 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83,
+ 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03,
+ 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56,
+ 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD,
+ 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48,
+ 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9,
+ 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84,
+ 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7,
+ 0x20D0, 0x20DC, 0x302A, 0x302F,
+ };
+
+ int[] combiningCharChar = {
+ 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF,
+ 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7,
+ 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F,
+ 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A,
+ };
+
+ //
+ // [88] Digit ::= ...
+ //
+
+ int[] digitRange = {
+ 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F,
+ 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F,
+ 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F,
+ 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29,
+ };
+
+ //
+ // [89] Extender ::= ...
+ //
+
+ int[] extenderRange = {
+ 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE,
+ };
+
+ int[] extenderChar = {
+ 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005,
+ };
+
+ //
+ // SpecialChar ::= '<', '&', '\n', '\r', ']'
+ //
+
+ int[] specialChar = {
+ '<', '&', '\n', '\r', ']',
+ };
+
+ //
+ // Initialize
+ //
+
+ // set valid characters
+ for (int i = 0; i < charRange.Length; i += 2)
+ {
+ for (int j = charRange[i]; j <= charRange[i + 1]; j++)
+ {
+ CHARS[j] = (byte)(CHARS[j] | VALID | CONTENT);
+ }
+ }
+
+ // remove special characters
+ for (int i = 0; i < specialChar.Length; i++)
+ {
+ CHARS[specialChar[i]] = (byte)(CHARS[specialChar[i]] & ~CONTENT);
+ }
+
+ // set space characters
+ for (int i = 0; i < spaceChar.Length; i++)
+ {
+ CHARS[spaceChar[i]] = (byte)(CHARS[spaceChar[i]] | SPACE);
+ }
+
+ // set name start characters
+ for (int i = 0; i < nameStartChar.Length; i++)
+ {
+ CHARS[nameStartChar[i]] = (byte)(CHARS[nameStartChar[i]] | NAME_START | NAME |
+ NCNAME_START | NCNAME);
+ }
+ for (int i = 0; i < letterRange.Length; i += 2)
+ {
+ for (int j = letterRange[i]; j <= letterRange[i + 1]; j++)
+ {
+ CHARS[j] = (byte)(CHARS[j] | NAME_START | NAME | NCNAME_START | NCNAME);
+ }
+ }
+ for (int i = 0; i < letterChar.Length; i++)
+ {
+ CHARS[letterChar[i]] = (byte)(CHARS[letterChar[i]] | NAME_START | NAME |
+ NCNAME_START | NCNAME);
+ }
+
+ // set name characters
+ for (int i = 0; i < nameChar.Length; i++)
+ {
+ CHARS[nameChar[i]] = (byte)(CHARS[nameChar[i]] | NAME | NCNAME);
+ }
+ for (int i = 0; i < digitRange.Length; i += 2)
+ {
+ for (int j = digitRange[i]; j <= digitRange[i + 1]; j++)
+ {
+ CHARS[j] = (byte)(CHARS[j] | NAME | NCNAME);
+ }
+ }
+ for (int i = 0; i < combiningCharRange.Length; i += 2)
+ {
+ for (int j = combiningCharRange[i]; j <= combiningCharRange[i + 1]; j++)
+ {
+ CHARS[j] = (byte)(CHARS[j] | NAME | NCNAME);
+ }
+ }
+ for (int i = 0; i < combiningCharChar.Length; i++)
+ {
+ CHARS[combiningCharChar[i]] = (byte)(CHARS[combiningCharChar[i]] | NAME | NCNAME);
+ }
+ for (int i = 0; i < extenderRange.Length; i += 2)
+ {
+ for (int j = extenderRange[i]; j <= extenderRange[i + 1]; j++)
+ {
+ CHARS[j] = (byte)(CHARS[j] | NAME | NCNAME);
+ }
+ }
+ for (int i = 0; i < extenderChar.Length; i++)
+ {
+ CHARS[extenderChar[i]] = (byte)(CHARS[extenderChar[i]] | NAME | NCNAME);
+ }
+
+ // remove ':' from allowable NCNAME_START and NCNAME chars
+ CHARS[':'] = (byte)(CHARS[':'] & ~(NCNAME_START | NCNAME));
+
+ // set Pubid characters
+ for (int i = 0; i < pubidChar.Length; i++)
+ {
+ CHARS[pubidChar[i]] = (byte)(CHARS[pubidChar[i]] | PUBID);
+ }
+ for (int i = 0; i < pubidRange.Length; i += 2)
+ {
+ for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++)
+ {
+ CHARS[j] = (byte)(CHARS[j] | PUBID);
+ }
+ }
+ }
+
+ private XmlConstructs()
+ {
+ }
+
+
+ //Static Methods
+
+ /// <summary>
+ /// Returns true if the specified character is valid.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ public static bool IsValid(char c)
+ {
+ return (CHARS[c] & VALID) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is invalid.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ public static bool IsInvalid(char c)
+ {
+ return !IsValid(c);
+ }
+
+ /// <summary>
+ /// Returns true if the specified character can be considered content.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ public static bool IsContent(char c)
+ {
+ return (CHARS[c] & CONTENT) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character can be considered markup.
+ /// Markup characters include '&lt;', '&amp;', and '%'.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ public static bool IsMarkup(char c)
+ {
+ return c == '<' || c == '&' || c == '%';
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is a space character
+ /// as defined by production [3] in the XML 1.0 specification.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ /// <returns></returns>
+ public static bool IsSpace(char c)
+ {
+ return (CHARS[c] & SPACE) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is a valid name start
+ /// character as defined by production [5] in the XML 1.0 specification.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ public static bool IsNameStart(char c)
+ {
+ return (CHARS[c] & NAME_START) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is a valid name
+ /// character as defined by production [4] in the XML 1.0 specification.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ public static bool IsName(char c)
+ {
+ return (CHARS[c] & NAME) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is a valid NCName start
+ /// character as defined by production [4] in Namespaces in XML
+ /// recommendation.
+ /// </summary>
+ /// <param name="c">The character to check.</param>
+ /// <returns></returns>
+ public static bool IsNCNameStart(char c)
+ {
+ return (CHARS[c] & NCNAME_START) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is a valid NCName
+ /// character as defined by production [5] in Namespaces in XML
+ /// recommendation.
+ /// </summary>
+ /// <param name="c"></param>
+ /// <returns></returns>
+ public static bool IsNCName(char c)
+ {
+ return (CHARS[c] & NCNAME) != 0;
+ }
+
+ /// <summary>
+ /// Returns true if the specified character is a valid Pubid
+ /// character as defined by production [13] in the XML 1.0 specification.
+ /// </summary>
+ /// <param name="c">The character to check</param>
+ public static bool IsPubid(char c)
+ {
+ return (CHARS[c] & PUBID) != 0;
+ }
+
+ /// <summary>
+ /// Check to see if a string is a valid Name according to [5]
+ /// in the XML 1.0 Recommendation
+ /// </summary>
+ /// <param name="name">The string to check</param>
+ public static bool IsValidName(String name, out Exception err)
+ {
+ err = null;
+ if (name.Length == 0)
+ {
+ err = new XmlException("Name can not be an empty string",null);
+ return false;
+ }
+ char ch = name[0];
+ if( IsNameStart(ch) == false)
+ {
+ err = new XmlException("The character '"+ch+"' cannot start a Name",null);
+ return false;
+ }
+ for (int i = 1; i < name.Length; i++ )
+ {
+ ch = name[i];
+ if( IsName( ch ) == false )
+ {
+ err = new XmlException("The character '"+ch+"' is not allowed in a Name",null);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Check to see if a string is a valid NCName according to [4]
+ /// from the XML Namespaces 1.0 Recommendation
+ /// </summary>
+ /// <param name="ncName">The string to check</param>
+ public static bool IsValidNCName(String ncName, out Exception err)
+ {
+ err = null;
+ if (ncName.Length == 0)
+ {
+ err = new XmlException("NCName can not be an empty string",null);
+ return false;
+ }
+ char ch = ncName[0];
+ if( IsNCNameStart(ch) == false)
+ {
+ err = new XmlException("The character '"+ch+"' cannot start a NCName",null);
+ return false;
+ }
+ for (int i = 1; i < ncName.Length; i++ )
+ {
+ ch = ncName[i];
+ if( IsNCName( ch ) == false )
+ {
+ err = new XmlException("The character '"+ch+"' is not allowed in a NCName",null);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Check to see if a string is a valid Nmtoken according to [7]
+ /// in the XML 1.0 Recommendation
+ /// </summary>
+ /// <param name="nmtoken">The string to check.</param>
+ public static bool IsValidNmtoken(String nmtoken, out Exception err)
+ {
+ err = null;
+ if (nmtoken.Length == 0)
+ {
+ err = new XmlException("NMTOKEN can not be an empty string", null);
+ return false;
+ }
+ for (int i = 0; i < nmtoken.Length; i++ )
+ {
+ char ch = nmtoken[i];
+ if( ! IsName( ch ) )
+ {
+ err = new XmlException("The character '"+ch+"' is not allowed in a NMTOKEN",null);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // encodings
+
+ /// <summary>
+ /// Returns true if the encoding name is a valid IANA encoding.
+ /// This method does not verify that there is a decoder available
+ /// for this encoding, only that the characters are valid for an
+ /// IANA encoding name.
+ /// </summary>
+ /// <param name="ianaEncoding">The encoding to check.</param>
+ /// <returns></returns>
+ public static bool IsValidIANAEncoding(String ianaEncoding)
+ {
+ if (ianaEncoding != null)
+ {
+ int length = ianaEncoding.Length;
+ if (length > 0)
+ {
+ char c = ianaEncoding[0];
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
+ {
+ for (int i = 1; i < length; i++)
+ {
+ c = ianaEncoding[i];
+ if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&
+ (c < '0' || c > '9') && c != '.' && c != '_' &&
+ c != '-')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlConvert.cs b/mcs/class/System.XML/System.Xml/XmlConvert.cs
new file mode 100755
index 00000000000..fa35d16acab
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlConvert.cs
@@ -0,0 +1,329 @@
+//
+// System.Xml.XmlConvert
+//
+// Authors:
+// Dwivedi, Ajay kumar (Adwiv@Yahoo.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace System.Xml {
+
+ public class XmlConvert {
+
+ static string encodedColon = "_x003A_";
+
+ public XmlConvert()
+ {}
+
+ private static string TryDecoding (string s)
+ {
+ if (s == null || s.Length < 6)
+ return s;
+
+ char c = '\uFFFF';
+ try {
+ c = (char) Int32.Parse (s.Substring (1, 4), NumberStyles.HexNumber);
+ } catch {
+ return s [0] + DecodeName (s.Substring (1));
+ }
+
+ if (s.Length == 6)
+ return c.ToString ();
+ return c + DecodeName (s.Substring (6));
+ }
+
+ public static string DecodeName (string name)
+ {
+ if (name == null || name.Length == 0)
+ return name;
+
+ int pos = name.IndexOf ('_');
+ if (pos == -1 || pos + 6 >= name.Length)
+ return name;
+
+ if (Char.ToUpper (name [pos + 1]) != 'X' || name [pos + 6] != '_')
+ return name [0] + DecodeName (name.Substring (1));
+
+ return name.Substring (0, pos) + TryDecoding (name.Substring (pos + 1));
+ }
+
+ public static string EncodeLocalName (string name)
+ {
+ string encoded = EncodeName (name);
+ int pos = encoded.IndexOf (':');
+ if (pos == -1)
+ return encoded;
+ return encoded.Replace (":", encodedColon);
+ }
+
+ internal static bool IsInvalid (char c, bool firstOnlyLetter)
+ {
+ if (c == ':') // Special case. allowed in EncodeName, but encoded in EncodeLocalName
+ return false;
+
+ if (firstOnlyLetter && !Char.IsLetter (c) && c != '_')
+ return false;
+
+ return !Char.IsLetterOrDigit (c);
+ }
+
+ private static string EncodeName (string name, bool nmtoken)
+ {
+ StringBuilder sb = new StringBuilder ();
+ int length = name.Length;
+ for (int i = 0; i < length; i++) {
+ char c = name [i];
+ if (c != '_' || i + 6 >= length) {
+ bool firstOnlyLetter = (i == 0 && !nmtoken);
+ if (IsInvalid (c, firstOnlyLetter)) {
+ sb.AppendFormat ("_x{0:X4}_", (int) c);
+ continue;
+ }
+ } else {
+ if (Char.ToUpper (name [i + 1]) == 'X' && name [i + 6] == '_') {
+ string decoded = TryDecoding (name.Substring (i + 1, 6));
+ if (decoded.Length == 1) {
+ sb.AppendFormat ("_x{0:X4}_", (int) c);
+ continue;
+ }
+ }
+ }
+ sb.Append (c);
+ }
+ return sb.ToString ();
+ }
+
+ public static string EncodeName (string name)
+ {
+ return EncodeName (name, false);
+ }
+
+ public static string EncodeNmToken(string name)
+ {
+ return EncodeName (name, true);
+ }
+
+ // {true, false, 1, 0}
+ public static bool ToBoolean(string s)
+ {
+ s = s.Trim();
+ switch(s)
+ {
+ case "1":
+ return true;
+ case "true":
+ return true;
+ case "0":
+ return false;
+ case "false":
+ return false;
+ default:
+ throw new FormatException(s + " is not a valid boolean value");
+ }
+ }
+
+ public static byte ToByte(string s)
+ {
+ return Byte.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static char ToChar(string s)
+ {
+ return Char.Parse(s);
+ }
+
+ public static DateTime ToDateTime(string s)
+ {
+ return DateTime.Parse(s);
+ }
+
+ public static DateTime ToDateTime(string s, string format)
+ {
+ DateTimeFormatInfo d = new DateTimeFormatInfo();
+ d.FullDateTimePattern = format;
+ return DateTime.Parse(s, d);
+ }
+
+ public static DateTime ToDateTime(string s, string[] formats)
+ {
+ DateTimeStyles style = DateTimeStyles.AllowLeadingWhite |
+ DateTimeStyles.AllowTrailingWhite;
+ return DateTime.ParseExact (s, formats, DateTimeFormatInfo.InvariantInfo, style);
+ }
+
+ public static Decimal ToDecimal(string s)
+ {
+ return Decimal.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static double ToDouble(string s)
+ {
+ return Double.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static Guid ToGuid(string s)
+ {
+ return new Guid(s);
+ }
+
+ public static short ToInt16(string s)
+ {
+ return Int16.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static int ToInt32(string s)
+ {
+ return Int32.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static long ToInt64(string s)
+ {
+ return Int64.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static SByte ToSByte(string s)
+ {
+ return SByte.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static float ToSingle(string s)
+ {
+ return Single.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(Guid value)
+ {
+ return value.ToString("D",CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(int value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(short value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(byte value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(long value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(char value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ public static string ToString(bool value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString(SByte value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+ public static string ToString(Decimal value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString(UInt64 value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+ public static string ToString(TimeSpan value)
+ {
+ return value.ToString();
+ }
+ public static string ToString(double value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+ public static string ToString(float value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString(UInt32 value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString(UInt16 value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+ public static string ToString(DateTime value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+ public static string ToString(DateTime value, string format)
+ {
+ return value.ToString(format, CultureInfo.InvariantCulture);
+ }
+ public static TimeSpan ToTimeSpan(string s)
+ {
+ return TimeSpan.Parse(s);
+ }
+
+ [CLSCompliant (false)]
+ public static UInt16 ToUInt16(string s)
+ {
+ return UInt16.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static UInt32 ToUInt32(string s)
+ {
+ return UInt32.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ [CLSCompliant (false)]
+ public static UInt64 ToUInt64(string s)
+ {
+ return UInt64.Parse(s, CultureInfo.InvariantCulture);
+ }
+
+ public static string VerifyName(string name)
+ {
+ Exception innerEx;
+ if(name == null)
+ throw new ArgumentNullException("name");
+
+ if(XmlConstructs.IsValidName(name, out innerEx))
+ return name;
+
+ throw new XmlException("'"+name+"' is not a valid XML Name",null);
+ }
+
+ public static string VerifyNCName(string ncname)
+ {
+ Exception innerEx;
+ if(ncname == null)
+ throw new ArgumentNullException("ncname");
+
+ if(XmlConstructs.IsValidName(ncname, out innerEx))
+ return ncname;
+
+ throw new XmlException("'"+ncname+"' is not a valid XML NCName",innerEx);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDeclaration.cs b/mcs/class/System.XML/System.Xml/XmlDeclaration.cs
new file mode 100644
index 00000000000..c34df121227
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDeclaration.cs
@@ -0,0 +1,136 @@
+//
+// System.Xml.XmlDeclaration
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Xml;
+using System.Text.RegularExpressions;
+
+namespace System.Xml
+{
+ public class XmlDeclaration : XmlLinkedNode
+ {
+ string encoding = "UTF-8"; // defaults to UTF-8
+ string standalone;
+ string version;
+
+ protected internal XmlDeclaration (string version, string encoding,
+ string standalone, XmlDocument doc)
+ : base (doc)
+ {
+ if (encoding == null)
+ encoding = "";
+
+ if (standalone == null)
+ standalone = "";
+
+ this.version = version;
+ this.encoding = encoding;
+ this.standalone = standalone;
+ }
+
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = (value == null) ? String.Empty : value; }
+ }
+
+ public override string InnerText {
+ get { return Value; }
+ set { ParseInput (value); }
+ }
+
+ public override string LocalName {
+ get { return "xml"; }
+ }
+
+ public override string Name {
+ get { return "xml"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.XmlDeclaration; }
+ }
+
+ public string Standalone {
+ get { return standalone; }
+ set {
+ if(value != null)
+ {
+ if (value.ToUpper() == "YES")
+ standalone = "yes";
+ if (value.ToUpper() == "NO")
+ standalone = "no";
+ }
+ else
+ standalone = String.Empty;
+ }
+ }
+
+ public override string Value {
+ get {
+ string formatEncoding = "";
+ string formatStandalone = "";
+
+ if (encoding != String.Empty)
+ formatEncoding = String.Format (" encoding=\"{0}\"", encoding);
+
+ if (standalone != String.Empty)
+ formatStandalone = String.Format (" standalone=\"{0}\"", standalone);
+
+ return String.Format ("version=\"{0}\"{1}{2}", Version, formatEncoding, formatStandalone);
+ }
+ set { ParseInput (value); }
+ }
+
+ public string Version {
+ get { return version; }
+ }
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlDeclaration (Version, Encoding, standalone, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ // This doesn't seem to match up very well with w.WriteStartDocument()
+ // so writing out custom here.
+ w.WriteRaw (String.Format ("<?xml {0}?>", Value));
+ }
+
+ void ParseInput (string input)
+ {
+// Encoding = input.Split (new char [] { ' ' }) [1].Split (new char [] { '=' }) [1];
+// Standalone = input.Split (new char [] { ' ' }) [2].Split (new char [] { '=' }) [1];
+ Match m = XmlDeclRegex.Match(input);
+ if(!m.Success)
+ throw new XmlException("illegal XML declaration format.");
+// Version = m.Result("${ver}");
+ Encoding = m.Result("${enc}");
+ Standalone = m.Result("${sta}");
+ }
+
+ // This regular expression matches XMLDecl of XML specification BNF[23]
+ static Regex xmlDeclRegex;
+ Regex XmlDeclRegex
+ {
+ get
+ {
+ if(xmlDeclRegex == null) xmlDeclRegex = new Regex(allMatch, RegexOptions.Compiled);
+ return xmlDeclRegex;
+ }
+ }
+
+ // This code makes some loss, but you may understand a bit easily.
+ const string verMatch = "\\s*version\\s*=\\s*(\\'(?<ver>.*?)\\'|\\\"(?<ver>.*?)\")";
+ const string encMatch = "\\s*encoding\\s*=\\s*(\\'(?<enc>.*?)\\'|\\\"(?<enc>.*?)\")";
+ const string staMatch = "\\s*standalone\\s*=\\s*(\\'(?<sta>.*?)\\'|\\\"(?<sta>.*?)\")";
+ const string allMatch = verMatch + "(" + encMatch + ")?(" + staMatch + ")?";
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocument.cs b/mcs/class/System.XML/System.Xml/XmlDocument.cs
new file mode 100644
index 00000000000..e54a1ed4dcc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocument.cs
@@ -0,0 +1,891 @@
+//
+// System.Xml.XmlDocument
+//
+// Authors:
+// Daniel Weber (daniel-weber@austin.rr.com)
+// Kral Ferch <kral_ferch@hotmail.com>
+// Jason Diamond <jason@injektilo.org>
+// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+//
+// (C) 2001 Daniel Weber
+// (C) 2002 Kral Ferch, Jason Diamond, Miguel de Icaza, Duncan Mak,
+// Atsushi Enomoto
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml.XPath;
+using System.Diagnostics;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlDocument : XmlNode
+ {
+ #region Fields
+
+ XmlLinkedNode lastLinkedChild;
+ XmlNameTable nameTable;
+ string baseURI = String.Empty;
+ XmlImplementation implementation;
+ bool preserveWhitespace = false;
+ WeakReference reusableXmlTextReader;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlDocument () : this (null, null)
+ {
+ }
+
+ protected internal XmlDocument (XmlImplementation imp) : this (imp, null)
+ {
+ }
+
+ public XmlDocument (XmlNameTable nt) : this (null, nt)
+ {
+ }
+
+ XmlDocument (XmlImplementation impl, XmlNameTable nt) : base (null)
+ {
+ implementation = (impl != null) ? impl : new XmlImplementation ();
+ nameTable = (nt != null) ? nt : implementation.internalNameTable;
+ AddDefaultNameTableKeys ();
+ }
+ #endregion
+
+ #region Events
+
+ public event XmlNodeChangedEventHandler NodeChanged;
+
+ public event XmlNodeChangedEventHandler NodeChanging;
+
+ public event XmlNodeChangedEventHandler NodeInserted;
+
+ public event XmlNodeChangedEventHandler NodeInserting;
+
+ public event XmlNodeChangedEventHandler NodeRemoved;
+
+ public event XmlNodeChangedEventHandler NodeRemoving;
+
+ #endregion
+
+ #region Properties
+
+ public override string BaseURI {
+ get {
+ return baseURI;
+ }
+ }
+
+ // Used to read 'InnerXml's for its descendants at any place.
+ internal XmlTextReader ReusableReader {
+ get {
+ if(reusableXmlTextReader == null)
+ reusableXmlTextReader = new WeakReference (null);
+ if(!reusableXmlTextReader.IsAlive) {
+ XmlTextReader reader = new XmlTextReader ((TextReader)null);
+ reusableXmlTextReader.Target = reader;
+ }
+ return (XmlTextReader)reusableXmlTextReader.Target;
+ }
+ }
+
+ public XmlElement DocumentElement {
+ get {
+ XmlNode node = FirstChild;
+
+ while (node != null) {
+ if (node is XmlElement)
+ break;
+ node = node.NextSibling;
+ }
+
+ return node != null ? node as XmlElement : null;
+ }
+ }
+
+ [MonoTODO("It doesn't have internal subset object model.")]
+ public virtual XmlDocumentType DocumentType {
+ get {
+ foreach(XmlNode n in this.ChildNodes) {
+ if(n.NodeType == XmlNodeType.DocumentType)
+ return (XmlDocumentType)n;
+ }
+ return null;
+ }
+ }
+
+ public XmlImplementation Implementation {
+ get { return implementation; }
+ }
+
+ public override string InnerXml {
+ get {
+ return base.InnerXml;
+ }
+ set { // reason for overriding
+ this.LoadXml (value);
+ }
+ }
+
+ public override bool IsReadOnly {
+ get { return false; }
+ }
+
+ internal override XmlLinkedNode LastLinkedChild {
+ get {
+ return lastLinkedChild;
+ }
+
+ set {
+ lastLinkedChild = value;
+ }
+ }
+
+ public override string LocalName {
+ get { return "#document"; }
+ }
+
+ public override string Name {
+ get { return "#document"; }
+ }
+
+ public XmlNameTable NameTable {
+ get { return nameTable; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Document; }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.Root;
+ }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get { return null; }
+ }
+
+ public bool PreserveWhitespace {
+ get { return preserveWhitespace; }
+ set { preserveWhitespace = value; }
+ }
+
+ internal override string XmlLang {
+ get { return String.Empty; }
+ }
+
+ [MonoTODO]
+ public virtual XmlResolver XmlResolver {
+ set { throw new NotImplementedException (); }
+ }
+
+ internal override XmlSpace XmlSpace {
+ get {
+ return XmlSpace.None;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO("Should BaseURI be cloned?")]
+ public override XmlNode CloneNode (bool deep)
+ {
+ XmlDocument doc = implementation.CreateDocument ();
+ doc.PreserveWhitespace = PreserveWhitespace; // required?
+ if(deep)
+ {
+ foreach(XmlNode n in ChildNodes)
+ doc.AppendChild (doc.ImportNode (n, deep));
+ }
+ return doc;
+ }
+
+ public XmlAttribute CreateAttribute (string name)
+ {
+ return CreateAttribute (name, String.Empty);
+ }
+
+ public XmlAttribute CreateAttribute (string qualifiedName, string namespaceURI)
+ {
+ string prefix;
+ string localName;
+
+ ParseName (qualifiedName, out prefix, out localName);
+
+ return CreateAttribute (prefix, localName, namespaceURI);
+ }
+
+ public virtual XmlAttribute CreateAttribute (string prefix, string localName, string namespaceURI)
+ {
+ if ((localName == null) || (localName == String.Empty))
+ throw new ArgumentException ("The attribute local name cannot be empty.");
+
+ return new XmlAttribute (prefix, localName, namespaceURI, this);
+ }
+
+ public virtual XmlCDataSection CreateCDataSection (string data)
+ {
+ return new XmlCDataSection (data, this);
+ }
+
+ public virtual XmlComment CreateComment (string data)
+ {
+ return new XmlComment (data, this);
+ }
+
+ [MonoTODO]
+ protected internal virtual XmlAttribute CreateDefaultAttribute (string prefix, string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XmlDocumentFragment CreateDocumentFragment ()
+ {
+ return new XmlDocumentFragment (this);
+ }
+
+ public virtual XmlDocumentType CreateDocumentType (string name, string publicId,
+ string systemId, string internalSubset)
+ {
+ return new XmlDocumentType (name, publicId, systemId, internalSubset, this);
+ }
+
+ public XmlElement CreateElement (string name)
+ {
+ return CreateElement (name, String.Empty);
+ }
+
+ public XmlElement CreateElement (
+ string qualifiedName,
+ string namespaceURI)
+ {
+ string prefix;
+ string localName;
+
+ ParseName (qualifiedName, out prefix, out localName);
+
+ return CreateElement (prefix, localName, namespaceURI);
+ }
+
+ public virtual XmlElement CreateElement (
+ string prefix,
+ string localName,
+ string namespaceURI)
+ {
+ if ((localName == null) || (localName == String.Empty))
+ throw new ArgumentException ("The local name for elements or attributes cannot be null or an empty string.");
+ CheckName (localName);
+ return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this);
+ }
+
+ public virtual XmlEntityReference CreateEntityReference (string name)
+ {
+ return new XmlEntityReference (name, this);
+ }
+
+ [MonoTODO]
+ internal protected virtual XPathNavigator CreateNavigator (XmlNode node)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XmlNode CreateNode (
+ string nodeTypeString,
+ string name,
+ string namespaceURI)
+ {
+ return CreateNode (GetNodeTypeFromString (nodeTypeString), name, namespaceURI);
+ }
+
+ public virtual XmlNode CreateNode (
+ XmlNodeType type,
+ string name,
+ string namespaceURI)
+ {
+ string prefix = null;
+ string localName = name;
+
+ if ((type == XmlNodeType.Attribute) || (type == XmlNodeType.Element) || (type == XmlNodeType.EntityReference))
+ ParseName (name, out prefix, out localName);
+
+ return CreateNode (type, prefix, localName, namespaceURI);
+ }
+
+ public virtual XmlNode CreateNode (
+ XmlNodeType type,
+ string prefix,
+ string name,
+ string namespaceURI)
+ {
+ switch (type) {
+ case XmlNodeType.Attribute: return CreateAttribute (prefix, name, namespaceURI);
+ case XmlNodeType.CDATA: return CreateCDataSection (null);
+ case XmlNodeType.Comment: return CreateComment (null);
+ case XmlNodeType.Document: return new XmlDocument (); // TODO - test to see which constructor to use, i.e. use existing NameTable or not.
+ case XmlNodeType.DocumentFragment: return CreateDocumentFragment ();
+ case XmlNodeType.DocumentType: return CreateDocumentType (null, null, null, null);
+ case XmlNodeType.Element: return CreateElement (prefix, name, namespaceURI);
+ case XmlNodeType.EntityReference: return CreateEntityReference (null);
+ case XmlNodeType.ProcessingInstruction: return CreateProcessingInstruction (null, null);
+ case XmlNodeType.SignificantWhitespace: return CreateSignificantWhitespace (String.Empty);
+ case XmlNodeType.Text: return CreateTextNode (null);
+ case XmlNodeType.Whitespace: return CreateWhitespace (String.Empty);
+ case XmlNodeType.XmlDeclaration: return CreateXmlDeclaration ("1.0", null, null);
+ default: throw new ArgumentOutOfRangeException(String.Format("{0}\nParameter name: {1}",
+ "Specified argument was out of the range of valid values", type.ToString ()));
+ }
+ }
+
+ public virtual XmlProcessingInstruction CreateProcessingInstruction (
+ string target,
+ string data)
+ {
+ return new XmlProcessingInstruction (target, data, this);
+ }
+
+ public virtual XmlSignificantWhitespace CreateSignificantWhitespace (string text)
+ {
+ foreach (char c in text)
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ throw new ArgumentException ("Invalid whitespace characters.");
+
+ return new XmlSignificantWhitespace (text, this);
+ }
+
+ public virtual XmlText CreateTextNode (string text)
+ {
+ return new XmlText (text, this);
+ }
+
+ public virtual XmlWhitespace CreateWhitespace (string text)
+ {
+ foreach (char c in text)
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ throw new ArgumentException ("Invalid whitespace characters.");
+
+ return new XmlWhitespace (text, this);
+ }
+
+ public virtual XmlDeclaration CreateXmlDeclaration (string version, string encoding,
+ string standalone)
+ {
+ if (version != "1.0")
+ throw new ArgumentException ("version string is not correct.");
+
+ if ((standalone != null && standalone != String.Empty) && !((standalone == "yes") || (standalone == "no")))
+ throw new ArgumentException ("standalone string is not correct.");
+
+ return new XmlDeclaration (version, encoding, standalone, this);
+ }
+
+ [MonoTODO]
+ public virtual XmlElement GetElementById (string elementId)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XmlNodeList GetElementsByTagName (string name)
+ {
+ ArrayList nodeArrayList = new ArrayList ();
+ this.searchNodesRecursively (this, name, nodeArrayList);
+ return new XmlNodeArrayList (nodeArrayList);
+ }
+
+ private void searchNodesRecursively (XmlNode argNode, string argName,
+ ArrayList argArrayList)
+ {
+ XmlNodeList xmlNodeList = argNode.ChildNodes;
+ foreach (XmlNode node in xmlNodeList){
+ if (node.Name.Equals (argName))
+ argArrayList.Add (node);
+ else
+ this.searchNodesRecursively (node, argName, argArrayList);
+ }
+ }
+
+ private void searchNodesRecursively (XmlNode argNode, string argName, string argNamespaceURI,
+ ArrayList argArrayList)
+ {
+ XmlNodeList xmlNodeList = argNode.ChildNodes;
+ foreach (XmlNode node in xmlNodeList){
+ if (node.LocalName.Equals (argName) && node.NamespaceURI.Equals (argNamespaceURI))
+ argArrayList.Add (node);
+ else
+ this.searchNodesRecursively (node, argName, argNamespaceURI, argArrayList);
+ }
+ }
+
+ public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
+ {
+ ArrayList nodeArrayList = new ArrayList ();
+ this.searchNodesRecursively (this, localName, namespaceURI, nodeArrayList);
+ return new XmlNodeArrayList (nodeArrayList);
+ }
+
+ private XmlNodeType GetNodeTypeFromString (string nodeTypeString)
+ {
+ switch (nodeTypeString) {
+ case "attribute": return XmlNodeType.Attribute;
+ case "cdatasection": return XmlNodeType.CDATA;
+ case "comment": return XmlNodeType.Comment;
+ case "document": return XmlNodeType.Document;
+ case "documentfragment": return XmlNodeType.DocumentFragment;
+ case "documenttype": return XmlNodeType.DocumentType;
+ case "element": return XmlNodeType.Element;
+ case "entityreference": return XmlNodeType.EntityReference;
+ case "processinginstruction": return XmlNodeType.ProcessingInstruction;
+ case "significantwhitespace": return XmlNodeType.SignificantWhitespace;
+ case "text": return XmlNodeType.Text;
+ case "whitespace": return XmlNodeType.Whitespace;
+ default:
+ throw new ArgumentException(String.Format("The string doesn't represent any node type : {0}.", nodeTypeString));
+ }
+ }
+
+ [MonoTODO("default attributes (of imported doc); Entity; Notation")]
+ public virtual XmlNode ImportNode (XmlNode node, bool deep)
+ {
+ switch(node.NodeType)
+ {
+ case XmlNodeType.Attribute:
+ {
+ XmlAttribute src_att = node as XmlAttribute;
+ XmlAttribute dst_att = this.CreateAttribute (src_att.Prefix, src_att.LocalName, src_att.NamespaceURI);
+ dst_att.Value = src_att.Value; // always explicitly specified (whether source is specified or not)
+ return dst_att;
+ }
+
+ case XmlNodeType.CDATA:
+ return this.CreateCDataSection (node.Value);
+
+ case XmlNodeType.Comment:
+ return this.CreateComment (node.Value);
+
+ case XmlNodeType.Document:
+ throw new XmlException ("Document cannot be imported.");
+
+ case XmlNodeType.DocumentFragment:
+ {
+ XmlDocumentFragment df = this.CreateDocumentFragment ();
+ if(deep)
+ {
+ foreach(XmlNode n in node.ChildNodes)
+ {
+ df.AppendChild (this.ImportNode (n, deep));
+ }
+ }
+ return df;
+ }
+
+ case XmlNodeType.DocumentType:
+ throw new XmlException ("DocumentType cannot be imported.");
+
+ case XmlNodeType.Element:
+ {
+ XmlElement src = (XmlElement)node;
+ XmlElement dst = this.CreateElement (src.Prefix, src.LocalName, src.NamespaceURI);
+ foreach(XmlAttribute attr in src.Attributes)
+ {
+ if(attr.Specified) // copies only specified attributes
+ dst.SetAttributeNode ((XmlAttribute)this.ImportNode (attr, deep));
+ if(DocumentType != null)
+ {
+ // TODO: create default attribute values
+ }
+ }
+ if(deep)
+ {
+ foreach(XmlNode n in src.ChildNodes)
+ dst.AppendChild (this.ImportNode (n, deep));
+ }
+ return dst;
+ }
+
+ case XmlNodeType.EndElement:
+ throw new XmlException ("Illegal ImportNode call for NodeType.EndElement");
+ case XmlNodeType.EndEntity:
+ throw new XmlException ("Illegal ImportNode call for NodeType.EndEntity");
+
+ case XmlNodeType.Entity:
+ throw new NotImplementedException (); // TODO
+
+ case XmlNodeType.EntityReference:
+ return this.CreateEntityReference (node.Name);
+
+ case XmlNodeType.None:
+ throw new XmlException ("Illegal ImportNode call for NodeType.None");
+
+ case XmlNodeType.Notation:
+ throw new NotImplementedException (); // TODO
+
+ case XmlNodeType.ProcessingInstruction:
+ XmlProcessingInstruction pi = node as XmlProcessingInstruction;
+ return this.CreateProcessingInstruction (pi.Target, pi.Data);
+
+ case XmlNodeType.SignificantWhitespace:
+ return this.CreateSignificantWhitespace (node.Value);
+
+ case XmlNodeType.Text:
+ return this.CreateTextNode (node.Value);
+
+ case XmlNodeType.Whitespace:
+ return this.CreateWhitespace (node.Value);
+
+ case XmlNodeType.XmlDeclaration:
+ XmlDeclaration srcDecl = node as XmlDeclaration;
+ return this.CreateXmlDeclaration (srcDecl.Version, srcDecl.Encoding, srcDecl.Standalone);
+
+ default:
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual void Load (Stream inStream)
+ {
+ XmlReader xmlReader = new XmlTextReader (inStream);
+ Load (xmlReader);
+ }
+
+ public virtual void Load (string filename)
+ {
+ baseURI = filename;
+ XmlReader xmlReader = new XmlTextReader (new StreamReader (filename));
+ Load (xmlReader);
+ }
+
+ public virtual void Load (TextReader txtReader)
+ {
+ Load (new XmlTextReader (txtReader));
+ }
+
+ public virtual void Load (XmlReader xmlReader)
+ {
+ // Reset our document
+ // For now this just means removing all our children but later this
+ // may turn out o need to call a private method that resets other things
+ // like properties we have, etc.
+ RemoveAll ();
+
+ // create all contents with use of ReadNode()
+ do {
+ XmlNode n = ReadNode (xmlReader);
+ if(n == null) break;
+ AppendChild (n);
+ } while (true);
+ }
+
+ public virtual void LoadXml (string xml)
+ {
+ XmlReader xmlReader = new XmlTextReader (new StringReader (xml));
+ Load (xmlReader);
+ }
+
+ internal void onNodeChanged (XmlNode node, XmlNode Parent)
+ {
+ if (NodeChanged != null)
+ NodeChanged (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Change,
+ node, Parent, Parent));
+ }
+
+ internal void onNodeChanging(XmlNode node, XmlNode Parent)
+ {
+ if (NodeChanging != null)
+ NodeChanging (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Change,
+ node, Parent, Parent));
+ }
+
+ internal void onNodeInserted (XmlNode node, XmlNode newParent)
+ {
+ if (NodeInserted != null)
+ NodeInserted (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Insert,
+ node, null, newParent));
+ }
+
+ internal void onNodeInserting (XmlNode node, XmlNode newParent)
+ {
+ if (NodeInserting != null)
+ NodeInserting (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Insert,
+ node, null, newParent));
+ }
+
+ internal void onNodeRemoved (XmlNode node, XmlNode oldParent)
+ {
+ if (NodeRemoved != null)
+ NodeRemoved (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Remove,
+ node, oldParent, null));
+ }
+
+ internal void onNodeRemoving (XmlNode node, XmlNode oldParent)
+ {
+ if (NodeRemoving != null)
+ NodeRemoving (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Remove,
+ node, oldParent, null));
+ }
+
+ private void ParseName (string name, out string prefix, out string localName)
+ {
+ int indexOfColon = name.IndexOf (':');
+
+ if (indexOfColon != -1) {
+ prefix = name.Substring (0, indexOfColon);
+ localName = name.Substring (indexOfColon + 1);
+ } else {
+ prefix = "";
+ localName = name;
+ }
+ }
+
+ // Checks that Element's name is valid
+ private void CheckName (String name)
+ {
+ // TODO: others validations?
+ if (name.IndexOf (" ") >= 0)
+ throw new XmlException ("The ' ' characted cannot be included in a name");
+ }
+
+ // Reads XmlReader and creates Attribute Node.
+ private XmlAttribute ReadAttributeNode(XmlReader reader)
+ {
+ if(reader.NodeType == XmlNodeType.Element)
+ reader.MoveToFirstAttribute ();
+ else if(reader.NodeType != XmlNodeType.Attribute)
+ throw new InvalidOperationException ("bad position to read attribute.");
+ XmlAttribute attribute = CreateAttribute (reader.Prefix, reader.LocalName, reader.NamespaceURI);
+ ReadAttributeNodeValue (reader, attribute);
+ return attribute;
+ }
+
+ // Reads attribute from XmlReader and then creates attribute value children. XmlAttribute also uses this.
+ internal void ReadAttributeNodeValue(XmlReader reader, XmlAttribute attribute)
+ {
+ while(reader.ReadAttributeValue ()) {
+ if(reader.NodeType == XmlNodeType.EntityReference)
+ // FIXME: if DocumentType is available, then try to resolve it.
+ attribute.AppendChild (CreateEntityReference (reader.Name));
+ // FIXME: else if(NodeType == EndEntity) -- reset BaseURI and so on -- ;
+ else
+ // (IMHO) Children of Attribute is likely restricted to Text and EntityReference.
+ attribute.AppendChild (CreateTextNode (reader.Value));
+ }
+ }
+
+ [MonoTODO("DTD parser is not completed.")]
+ public virtual XmlNode ReadNode(XmlReader reader)
+ {
+ // This logic was formerly defined in 'XmlNode.ConstructDOM()'
+
+ XmlNode resultNode = null;
+ XmlNode newNode = null;
+ XmlNode currentNode = null;
+ // It was originally XmlDocument.Load(reader reader) when mcs was v0.16.
+ int startDepth = reader.Depth;
+ bool atStart = true;
+ bool ignoredWhitespace;
+
+ do {
+ ignoredWhitespace = false;
+ reader.Read ();
+ // This complicated check is because we shouldn't make
+ // improper additional XmlReader.Read() by this method itself.
+ if(atStart && (reader.NodeType == XmlNodeType.EndElement ||
+ reader.NodeType == XmlNodeType.EndEntity))
+ throw new InvalidOperationException ("the XmlReader now holds invalid position.");
+ atStart = false;
+ switch (reader.NodeType) {
+
+ case XmlNodeType.Attribute:
+ newNode = ReadAttributeNode (reader);
+ break;
+
+ case XmlNodeType.CDATA:
+ newNode = CreateCDataSection (reader.Value);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Comment:
+ newNode = CreateComment (reader.Value);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Element:
+ XmlElement element = CreateElement (reader.Prefix, reader.LocalName, reader.NamespaceURI);
+ element.IsEmpty = reader.IsEmptyElement;
+ if(currentNode != null)
+ currentNode.AppendChild (element);
+ else
+ resultNode = element;
+
+ // set the element's attributes.
+ while (reader.MoveToNextAttribute ()) {
+ element.SetAttributeNode (ReadAttributeNode (reader));
+ }
+
+ reader.MoveToElement ();
+
+ if (!reader.IsEmptyElement)
+ currentNode = element;
+
+ break;
+
+ case XmlNodeType.EndElement:
+ if(currentNode.Name != reader.Name)
+ throw new XmlException ("mismatch end tag.");
+ currentNode = currentNode.ParentNode;
+ break;
+
+ case XmlNodeType.EndEntity:
+ break; // no operation
+
+ case XmlNodeType.ProcessingInstruction:
+ newNode = CreateProcessingInstruction (reader.Name, reader.Value);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Text:
+ newNode = CreateTextNode (reader.Value);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.XmlDeclaration:
+ // empty strings are dummy, then gives over setting value contents to setter.
+ newNode = CreateXmlDeclaration ("1.0" , String.Empty, String.Empty);
+ ((XmlDeclaration)newNode).Value = reader.Value;
+ if(currentNode != null)
+ throw new XmlException ("XmlDeclaration at invalid position.");
+ break;
+
+ case XmlNodeType.DocumentType:
+ // This logic is kinda hack;-)
+ XmlTextReader xtReader = reader as XmlTextReader;
+ if(xtReader == null) {
+ xtReader = new XmlTextReader (reader.ReadOuterXml (),
+ XmlNodeType.DocumentType,
+ new XmlParserContext (NameTable, ConstructNamespaceManager(), XmlLang, XmlSpace));
+ xtReader.Read ();
+ }
+ newNode = CreateDocumentType (xtReader.Name,
+ xtReader.GetAttribute ("PUBLIC"),
+ xtReader.GetAttribute ("SYSTEM"),
+ xtReader.Value);
+ if(currentNode != null)
+ throw new XmlException ("XmlDocumentType at invalid position.");
+ break;
+
+ case XmlNodeType.EntityReference:
+ newNode = CreateEntityReference (reader.Name);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.SignificantWhitespace:
+ newNode = CreateSignificantWhitespace (reader.Value);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Whitespace:
+ if(PreserveWhitespace) {
+ newNode = CreateWhitespace (reader.Value);
+ if(currentNode != null)
+ currentNode.AppendChild (newNode);
+ }
+ else
+ ignoredWhitespace = true;
+ break;
+ }
+ } while(ignoredWhitespace ||
+ reader.Depth > startDepth ||
+ // This complicated condition is because reader.Depth was set
+ // before XmlTextReader.depth increments ;-)
+ (reader.Depth == startDepth && reader.NodeType == XmlNodeType.Element && reader.IsEmptyElement == false)
+ );
+ return resultNode != null ? resultNode : newNode;
+ }
+
+ public virtual void Save(Stream outStream)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (outStream, Encoding.UTF8);
+ xmlWriter.Formatting = Formatting.Indented;
+ WriteContentTo (xmlWriter);
+ xmlWriter.Close ();
+ }
+
+ public virtual void Save (string filename)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (filename, Encoding.UTF8);
+ xmlWriter.Formatting = Formatting.Indented;
+ WriteContentTo (xmlWriter);
+ xmlWriter.Close ();
+ }
+
+ [MonoTODO]
+ public virtual void Save (TextWriter writer)
+ {
+ XmlTextWriter xmlWriter = new XmlTextWriter (writer);
+ xmlWriter.Formatting = Formatting.Indented;
+ WriteContentTo (xmlWriter);
+ xmlWriter.Flush ();
+ }
+
+ public virtual void Save (XmlWriter xmlWriter)
+ {
+ //
+ // This should preserve white space if PreserveWhiteSpace is true
+ //
+ WriteContentTo (xmlWriter);
+ xmlWriter.Flush ();
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ foreach(XmlNode childNode in ChildNodes) {
+ childNode.WriteTo (w);
+ }
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ WriteContentTo (w);
+ }
+
+ private void AddDefaultNameTableKeys ()
+ {
+ // The following keys are default of MS .NET Framework
+ nameTable.Add ("#text");
+ nameTable.Add ("xml");
+ nameTable.Add ("xmlns");
+ nameTable.Add ("#entity");
+ nameTable.Add ("#document-fragment");
+ nameTable.Add ("#comment");
+ nameTable.Add ("space");
+ nameTable.Add ("id");
+ nameTable.Add ("#whitespace");
+ nameTable.Add ("http://www.w3.org/2000/xmlns/");
+ nameTable.Add ("#cdata-section");
+ nameTable.Add ("lang");
+ nameTable.Add ("#document");
+ nameTable.Add ("#significant-whitespace");
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs b/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
new file mode 100644
index 00000000000..d711c53f487
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
@@ -0,0 +1,125 @@
+//
+// System.Xml.XmlDocumentFragment
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+//
+// (C), Ximian, Inc
+// (C)2002 Atsushi Enomoto
+using System;
+using System.IO;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlDocumentFragment : XmlNode
+ {
+ #region Fields
+
+ private XmlLinkedNode lastLinkedChild;
+
+ #endregion
+
+ #region Constructor
+
+ protected internal XmlDocumentFragment (XmlDocument doc)
+ : base (doc)
+ {
+ }
+
+ #endregion
+ #region Properties
+
+ [MonoTODO("Setter is as incomplete as that of XmlElement.InnerXml")]
+ public override string InnerXml {
+ set {
+ // Copied from XmlElement.InnerXml (in the meantime;-))
+ foreach(XmlNode n in ChildNodes)
+ {
+ this.RemoveChild (n);
+ }
+
+ // I hope there are any well-performance logic...
+ XmlNameTable nt = this.OwnerDocument.NameTable;
+ XmlNamespaceManager nsmgr = this.ConstructNamespaceManager ();
+ XmlParserContext ctx = new XmlParserContext (nt, nsmgr, XmlLang, this.XmlSpace);
+ XmlTextReader xmlReader = OwnerDocument.ReusableReader;
+ xmlReader.SetReaderContext (String.Empty, ctx);
+ xmlReader.SetReaderFragment (new StringReader (value), XmlNodeType.Element);
+
+ do {
+ XmlNode n = OwnerDocument.ReadNode (xmlReader);
+ if(n == null) break;
+ AppendChild (n);
+ } while (true);
+ }
+ get {
+ StringBuilder sb = new StringBuilder ();
+ foreach(XmlNode n in ChildNodes)
+ sb.Append (n.OuterXml);
+ return sb.ToString ();
+ }
+ }
+
+ public override string LocalName {
+ get { return "#document-fragment"; }
+ }
+
+
+ public override string Name {
+ get { return "#document-fragment"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.DocumentFragment; }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get { return base.OwnerDocument; }
+ }
+
+ public override XmlNode ParentNode {
+ get { return null; } // it's always null here.
+ }
+
+ // It is really not a type of XmlLinkedNode,
+ // but I copied this way from XmlElement. I looks good.
+ internal override XmlLinkedNode LastLinkedChild
+ {
+ get { return lastLinkedChild; }
+ set { lastLinkedChild = value; }
+ }
+ #endregion
+
+ #region Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ if (deep) { // clone document + child nodes
+ XmlNode node = FirstChild;
+
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (false));
+ node = node.NextSibling;
+ }
+
+ return node;
+ } else
+ return new XmlDocumentFragment (OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ foreach(XmlNode n in ChildNodes)
+ n.WriteContentTo (w);
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ foreach(XmlNode n in ChildNodes)
+ n.WriteTo (w);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs b/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs
new file mode 100644
index 00000000000..4df3fa7f169
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs
@@ -0,0 +1,304 @@
+//
+// System.Xml.XmlDocumentNavigator
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond
+//
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ internal class XmlDocumentNavigator : XPathNavigator
+ {
+ #region Constructors
+
+ [MonoTODO]
+ internal XmlDocumentNavigator(XmlNode node)
+ {
+ this.node = node;
+ }
+
+ #endregion
+
+ #region Fields
+
+ private XmlNode node;
+ private IEnumerator attributesEnumerator;
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public override string BaseURI {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override bool HasAttributes {
+ get {
+ if (node.Attributes != null)
+ foreach (XmlAttribute attribute in node.Attributes)
+ if (attribute.NamespaceURI != "http://www.w3.org/2000/xmlns/")
+ return true;
+ return false;
+ }
+ }
+
+ public override bool HasChildren {
+ get {
+ XPathNodeType nodeType = NodeType;
+ bool canHaveChildren = nodeType == XPathNodeType.Root || nodeType == XPathNodeType.Element;
+ return canHaveChildren && node.FirstChild != null;
+ }
+ }
+
+ public override bool IsEmptyElement {
+ get {
+ return node.NodeType == XmlNodeType.Element && !HasChildren;
+ }
+ }
+
+ public override string LocalName {
+ get {
+ XPathNodeType nodeType = NodeType;
+ bool canHaveName =
+ nodeType == XPathNodeType.Element ||
+ nodeType == XPathNodeType.Attribute ||
+ nodeType == XPathNodeType.ProcessingInstruction ||
+ nodeType == XPathNodeType.Namespace;
+ return canHaveName ? node.LocalName : String.Empty;
+ }
+ }
+
+ public override string Name {
+ get {
+ XPathNodeType nodeType = NodeType;
+ bool canHaveName =
+ nodeType == XPathNodeType.Element ||
+ nodeType == XPathNodeType.Attribute ||
+ nodeType == XPathNodeType.ProcessingInstruction ||
+ nodeType == XPathNodeType.Namespace;
+ return canHaveName ? node.Name : String.Empty;
+ }
+ }
+
+ public override string NamespaceURI {
+ get {
+ return node.NamespaceURI;
+ }
+ }
+
+ [MonoTODO]
+ public override XmlNameTable NameTable {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override XPathNodeType NodeType {
+ get {
+ return node.XPathNodeType;
+ }
+ }
+
+ public override string Prefix {
+ get {
+ return node.Prefix;
+ }
+ }
+
+ public override string Value {
+ get {
+ switch (NodeType) {
+ case XPathNodeType.Attribute:
+ case XPathNodeType.Comment:
+ case XPathNodeType.ProcessingInstruction:
+ case XPathNodeType.Text:
+ case XPathNodeType.Whitespace:
+ case XPathNodeType.SignificantWhitespace:
+ return node.Value;
+ case XPathNodeType.Element:
+ case XPathNodeType.Root:
+ return node.InnerText;
+ }
+ return String.Empty;
+ }
+ }
+
+ [MonoTODO]
+ public override string XmlLang {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XPathNavigator Clone ()
+ {
+ return new XmlDocumentNavigator (node);
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetNamespace (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool IsSamePosition (XPathNavigator other)
+ {
+ XmlDocumentNavigator otherDocumentNavigator = other as XmlDocumentNavigator;
+ if (otherDocumentNavigator != null)
+ return node == otherDocumentNavigator.node;
+ return false;
+ }
+
+ public override bool MoveTo (XPathNavigator other)
+ {
+ XmlDocumentNavigator otherDocumentNavigator = other as XmlDocumentNavigator;
+ if (otherDocumentNavigator != null) {
+ if (node.OwnerDocument == otherDocumentNavigator.node.OwnerDocument) {
+ node = otherDocumentNavigator.node;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToFirst ()
+ {
+ if (node.NodeType != XmlNodeType.Attribute && node.ParentNode != null) {
+ node = node.ParentNode.FirstChild;
+ return true;
+ }
+ return false;
+ }
+
+ public override bool MoveToFirstAttribute ()
+ {
+ if (NodeType == XPathNodeType.Element) {
+ attributesEnumerator = node.Attributes.GetEnumerator ();
+ return MoveToNextAttribute ();
+ }
+ return false;
+ }
+
+ public override bool MoveToFirstChild ()
+ {
+ if (HasChildren) {
+ node = node.FirstChild;
+ return true;
+ }
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToFirstNamespace (XPathNamespaceScope namespaceScope)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToId (string id)
+ {
+ XmlDocument doc;
+
+ if (node.NodeType == XmlNodeType.Document)
+ doc = (XmlDocument) node;
+ else
+ doc = node.OwnerDocument;
+
+ XmlElement eltNew = doc.GetElementById (id);
+ if (eltNew == null)
+ return false;
+
+ node = eltNew;
+ return true;
+ }
+
+ [MonoTODO]
+ public override bool MoveToNamespace (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToNext ()
+ {
+ if (node.NextSibling != null) {
+ node = node.NextSibling;
+ return true;
+ }
+ return false;
+ }
+
+ public override bool MoveToNextAttribute ()
+ {
+ if (attributesEnumerator != null && attributesEnumerator.MoveNext ()) {
+ node = attributesEnumerator.Current as XmlAttribute;
+ return true;
+ }
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToNextNamespace (XPathNamespaceScope namespaceScope)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToParent ()
+ {
+ if (node.NodeType == XmlNodeType.Attribute) {
+ XmlElement ownerElement = ((XmlAttribute)node).OwnerElement;
+ if (ownerElement != null) {
+ node = ownerElement;
+ return true;
+ }
+ } else if (node.ParentNode != null) {
+ node = node.ParentNode;
+ return true;
+ }
+ return false;
+ }
+
+ public override bool MoveToPrevious ()
+ {
+ if (node.PreviousSibling != null) {
+ node = node.PreviousSibling;
+ return true;
+ }
+ return false;
+ }
+
+ public override void MoveToRoot ()
+ {
+ if (node.NodeType != XmlNodeType.Document)
+ node = node.OwnerDocument;
+ }
+
+ internal XmlNode Node { get { return node; } }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentType.cs b/mcs/class/System.XML/System.Xml/XmlDocumentType.cs
new file mode 100644
index 00000000000..83dbf11c7ea
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocumentType.cs
@@ -0,0 +1,98 @@
+//
+// System.Xml.XmlDocumentType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlDocumentType : XmlLinkedNode
+ {
+ // Fields
+ string name; // name of the document type
+ string publicId; // public identifier on the DOCTYPE
+ string systemId; // system identifier on the DOCTYPE
+ string internalSubset; // value of the DTD internal subset
+
+ // Constructor
+ protected internal XmlDocumentType (string name, string publicId,
+ string systemId, string internalSubset,
+ XmlDocument doc)
+ : base (doc)
+ {
+ this.name = name;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.internalSubset = internalSubset;
+ }
+
+
+ // Properties
+ [MonoTODO]
+ public XmlNamedNodeMap Entities
+ {
+ get { return null; }
+ }
+
+ public string InternalSubset
+ {
+ get { return internalSubset; }
+ }
+
+ public override bool IsReadOnly
+ {
+ get { return true; } // always return true
+ }
+
+ public override string LocalName
+ {
+ get { return name; }
+ }
+
+ public override string Name
+ {
+ get { return name; }
+ }
+
+ public override XmlNodeType NodeType
+ {
+ get { return XmlNodeType.DocumentType; }
+ }
+
+ [MonoTODO]
+ public XmlNamedNodeMap Notations
+ {
+ get { return null; }
+ }
+
+ public string PublicId
+ {
+ get { return publicId; }
+ }
+
+ public string SystemId
+ {
+ get { return systemId; }
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ // deep is ignored
+ return new XmlDocumentType (name, publicId, systemId,
+ internalSubset, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ // No effect
+ }
+
+ [MonoTODO]
+ public override void WriteTo (XmlWriter w)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
new file mode 100644
index 00000000000..6b6fd2838b8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -0,0 +1,383 @@
+//
+// System.Xml.XmlElement
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.Collections;
+using System.Xml.XPath;
+using System.IO;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlElement : XmlLinkedNode
+ {
+ #region Fields
+
+ private XmlAttributeCollection attributes;
+ private string localName;
+ private string namespaceURI;
+ private string prefix;
+ private bool isEmpty;
+
+ #endregion
+
+ #region Constructor
+
+ protected internal XmlElement (
+ string prefix,
+ string localName,
+ string namespaceURI,
+ XmlDocument doc) : base (doc)
+ {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+
+ attributes = new XmlAttributeCollection (this);
+
+ // TODO: Adds default attributes
+ if(doc.DocumentType != null)
+ {
+ }
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override XmlAttributeCollection Attributes {
+ get { return attributes; }
+ }
+
+ public virtual bool HasAttributes {
+ get { return attributes.Count > 0; }
+ }
+
+ public override string InnerText {
+ get {
+ return base.InnerText;
+ }
+ set {
+ // Why its behavior (of MS FCL) is different from InnerXml...?
+ if (FirstChild != null && FirstChild.NodeType == XmlNodeType.Text)
+ FirstChild.Value = value;
+ else {
+ if(FirstChild != null) {
+ foreach (XmlNode n in ChildNodes)
+ this.RemoveChild (n);
+ }
+ // creates new Text node
+ AppendChild(OwnerDocument.CreateTextNode(value));
+ }
+ }
+ }
+
+ public override string InnerXml {
+ get {
+ return base.InnerXml;
+ }
+ set {
+ foreach(XmlNode n in ChildNodes)
+ this.RemoveChild(n);
+
+ // I hope there are any well-performance logic...
+ XmlNameTable nt = this.OwnerDocument.NameTable;
+ XmlNamespaceManager nsmgr = this.ConstructNamespaceManager ();
+ XmlParserContext ctx = new XmlParserContext (nt, nsmgr, XmlLang, this.XmlSpace);
+ XmlTextReader xmlReader = OwnerDocument.ReusableReader;
+ xmlReader.SetReaderContext (String.Empty, ctx);
+ xmlReader.SetReaderFragment (new StringReader (value), XmlNodeType.Element);
+
+ do {
+ XmlNode n = OwnerDocument.ReadNode (xmlReader);
+ if(n == null) break;
+ AppendChild (n);
+ } while (true);
+ }
+ }
+
+ public bool IsEmpty {
+ get { return isEmpty; }
+
+ set {
+ if(value)
+ RemoveAll();
+ isEmpty = value;
+ }
+ }
+
+ public override string LocalName {
+ get { return localName; }
+ }
+
+ public override string Name {
+ get {
+ return prefix != String.Empty ? prefix + ":" + localName : localName;
+ }
+ }
+
+ public override string NamespaceURI {
+ get { return namespaceURI; }
+ }
+
+ [MonoTODO]
+ public override XmlNode NextSibling {
+ get {
+ return base.NextSibling;
+ }
+ }
+
+ public override XmlNodeType NodeType {
+ get {
+ return XmlNodeType.Element;
+ }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.Element;
+ }
+ }
+
+ [MonoTODO]
+ public override XmlDocument OwnerDocument {
+ get {
+ return base.OwnerDocument;
+ }
+ }
+
+ public override string Prefix {
+ get { return prefix; }
+ set { prefix = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override XmlNode CloneNode (bool deep)
+ {
+ XmlNode node = new XmlElement (prefix, localName, namespaceURI,
+ OwnerDocument);
+
+ for (int i = 0; i < node.Attributes.Count; i++)
+ node.AppendChild (node.Attributes [i].CloneNode (false));
+
+ if (deep) {
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (true));
+ node = node.NextSibling;
+ }
+ } // shallow cloning
+
+ //
+ // Reminder: Also look into Default attributes.
+ //
+ return node;
+ }
+
+ [MonoTODO]
+ public virtual string GetAttribute (string name)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (name);
+ return attributeNode != null ? attributeNode.Value : String.Empty;
+ }
+
+ [MonoTODO]
+ public virtual string GetAttribute (string localName, string namespaceURI)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (localName, namespaceURI);
+ return attributeNode != null ? attributeNode.Value : String.Empty;
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute GetAttributeNode (string name)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (name);
+ return attributeNode != null ? attributeNode as XmlAttribute : null;
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute GetAttributeNode (string localName, string namespaceURI)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (localName, namespaceURI);
+ return attributeNode != null ? attributeNode as XmlAttribute : null;
+ }
+
+ public virtual XmlNodeList GetElementsByTagName (string name)
+ {
+ ArrayList nodeArrayList = new ArrayList ();
+ this.searchNodesRecursively (this, name, nodeArrayList);
+ return new XmlNodeArrayList (nodeArrayList);
+ }
+
+ private void searchNodesRecursively (XmlNode argNode, string argName,
+ ArrayList argArrayList)
+ {
+ XmlNodeList xmlNodeList = argNode.ChildNodes;
+ foreach (XmlNode node in xmlNodeList){
+ if (node.Name.Equals (argName))
+ argArrayList.Add (node);
+ else
+ this.searchNodesRecursively (node, argName, argArrayList);
+ }
+ }
+
+ private void searchNodesRecursively (XmlNode argNode, string argName, string argNamespaceURI,
+ ArrayList argArrayList)
+ {
+ XmlNodeList xmlNodeList = argNode.ChildNodes;
+ foreach (XmlNode node in xmlNodeList)
+ {
+ if (node.LocalName.Equals (argName) && node.NamespaceURI.Equals (argNamespaceURI))
+ argArrayList.Add (node);
+ else
+ this.searchNodesRecursively (node, argName, argNamespaceURI, argArrayList);
+ }
+ }
+
+ public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
+ {
+ ArrayList nodeArrayList = new ArrayList ();
+ this.searchNodesRecursively (this, localName, namespaceURI, nodeArrayList);
+ return new XmlNodeArrayList (nodeArrayList);
+ }
+
+ [MonoTODO]
+ public virtual bool HasAttribute (string name)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (name);
+ return attributeNode != null;
+ }
+
+ [MonoTODO]
+ public virtual bool HasAttribute (string localName, string namespaceURI)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (localName, namespaceURI);
+ return attributeNode != null;
+ }
+
+ [MonoTODO ("confirm not removing default attributes [when DTD feature was implemented.")]
+ public override void RemoveAll ()
+ {
+ // Remove the child nodes.
+ base.RemoveAll ();
+
+ // Remove all attributes.
+ attributes.RemoveAll ();
+ }
+
+ [MonoTODO ("confirm not removing default attributes [when DTD feature was implemented.")]
+ public virtual void RemoveAllAttributes ()
+ {
+ attributes.RemoveAll ();
+ }
+
+ [MonoTODO ("confirm not resetting default attributes [when DTD feature was implemented.")]
+ public virtual void RemoveAttribute (string name)
+ {
+ attributes.Remove((XmlAttribute)attributes.GetNamedItem(name));
+ }
+
+ [MonoTODO ("confirm not resetting default attributes [when DTD feature was implemented.")]
+ public virtual void RemoveAttribute (string localName, string namespaceURI)
+ {
+ attributes.Remove((XmlAttribute)attributes.GetNamedItem(localName, namespaceURI));
+ }
+
+ [MonoTODO ("confirm not resetting default attributes [when DTD feature was implemented.")]
+ public virtual XmlNode RemoveAttributeAt (int i)
+ {
+ return attributes.Remove(attributes[i]);
+ }
+
+ [MonoTODO ("confirm not resetting default attributes [when DTD feature was implemented.")]
+ public virtual XmlAttribute RemoveAttributeNode (XmlAttribute oldAttr)
+ {
+ return attributes.Remove(oldAttr);
+ }
+
+ [MonoTODO ("confirm not resetting default attributes [when DTD feature was implemented.")]
+ public virtual XmlAttribute RemoveAttributeNode (string localName, string namespaceURI)
+ {
+ return attributes.Remove(attributes[localName, namespaceURI]);
+ }
+
+ [MonoTODO]
+ public virtual void SetAttribute (string name, string value)
+ {
+ XmlAttribute attribute = OwnerDocument.CreateAttribute (name);
+ attribute.SetOwnerElement(this);
+ attribute.Value = value;
+ Attributes.SetNamedItem (attribute);
+ }
+
+// [MonoTODO]
+ public virtual string SetAttribute (string localName, string namespaceURI, string value)
+ {
+ XmlAttribute attr = attributes[localName, namespaceURI];
+ if(attr == null)
+ {
+ attr = OwnerDocument.CreateAttribute(localName, namespaceURI);
+ attr.Value = value;
+ attributes.SetNamedItem(attr);
+ }
+ else
+ attr.Value = value;
+ return attr.Value;
+ }
+
+// [MonoTODO]
+ public virtual XmlAttribute SetAttributeNode (XmlAttribute newAttr)
+ {
+ newAttr.SetOwnerElement(this);
+ XmlNode oldAttr = Attributes.SetNamedItem(newAttr);
+ return oldAttr != null ? oldAttr as XmlAttribute : null;
+ }
+
+ public virtual XmlAttribute SetAttributeNode (string localName, string namespaceURI)
+ {
+ XmlDocument xmlDoc = this.OwnerDocument;
+ XmlAttribute xmlAttribute = new XmlAttribute (String.Empty, localName, namespaceURI, xmlDoc);
+ return this.attributes.Append (xmlAttribute);
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ foreach(XmlNode childNode in ChildNodes)
+ childNode.WriteTo(w);
+ }
+
+ [MonoTODO]
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteStartElement(Prefix, LocalName, NamespaceURI);
+
+ foreach(XmlNode attributeNode in Attributes)
+ attributeNode.WriteTo(w);
+
+ // write namespace declarations(if not exist)
+ foreach(XmlNode attributeNode in Attributes) {
+ if(attributeNode.Prefix != null && attributeNode.Prefix != String.Empty &&
+ w.LookupPrefix(attributeNode.Prefix) != attributeNode.NamespaceURI &&
+ attributeNode.Prefix != "xmlns")
+ w.WriteAttributeString("xmlns", attributeNode.Prefix, "http://www.w3.org/2000/xmlns/", attributeNode.NamespaceURI);
+ }
+
+ WriteContentTo(w);
+
+ w.WriteEndElement();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlEntity.cs b/mcs/class/System.XML/System.Xml/XmlEntity.cs
new file mode 100755
index 00000000000..f0778d8f3e7
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlEntity.cs
@@ -0,0 +1,123 @@
+//
+// System.Xml.XmlEntity.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlEntity : XmlNode
+ {
+ #region Constructors
+
+ internal XmlEntity (string name, string NDATA, string publicId, string systemId,
+ XmlDocument doc)
+ : base (doc)
+ {
+ this.name = name;
+ this.NDATA = NDATA;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.baseUri = doc.BaseURI;
+ }
+
+ #endregion
+
+ #region Fields
+
+ string name;
+ string NDATA;
+ string publicId;
+ string systemId;
+ string baseUri;
+
+ #endregion
+
+ #region Properties
+
+ public override string BaseURI {
+ get { return baseUri; }
+ }
+
+ [MonoTODO]
+ public override string InnerText {
+ get { throw new NotImplementedException (); }
+ set { throw new InvalidOperationException ("This operation is not supported."); }
+ }
+
+ public override string InnerXml {
+ get { return String.Empty; }
+ set { throw new InvalidOperationException ("This operation is not supported."); }
+ }
+
+ public override bool IsReadOnly {
+ get { return true; } // always read-only.
+ }
+
+ public override string LocalName {
+ get { return name; }
+ }
+
+ public override string Name {
+ get { return name; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Entity; }
+ }
+
+ public string NotationName {
+ get {
+ if (NDATA == null)
+ return null;
+ else
+ return NDATA;
+ }
+ }
+
+ public override string OuterXml {
+ get { return String.Empty; }
+ }
+
+ public string PublicId {
+ get {
+ if (publicId == null)
+ return null;
+ else
+ return publicId;
+ }
+ }
+
+ public string SystemId {
+ get {
+ if (publicId == null)
+ return null;
+ else
+ return systemId;
+ }
+ }
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new InvalidOperationException ("This operation is not supported.");
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ // No effect.
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ // No effect.
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
new file mode 100644
index 00000000000..c6f94cf1bb6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
@@ -0,0 +1,75 @@
+//
+// System.Xml.XmlEntityReference.cs
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlEntityReference : XmlLinkedNode
+ {
+ string entityName;
+
+ // Constructor
+ protected internal XmlEntityReference (string name, XmlDocument doc)
+ : base (doc)
+ {
+ entityName = name;
+ }
+
+ // Properties
+ [MonoTODO]
+ public override string BaseURI {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool IsReadOnly {
+ get { return true; }
+ }
+
+ public override string LocalName {
+ get { return entityName; } // name of the entity referenced.
+ }
+
+ public override string Name {
+ get { return entityName; } // name of the entity referenced.
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.EntityReference; }
+ }
+
+ public override string Value {
+ get { return null; } // always return null here.
+ set {
+ throw new XmlException ("entity reference cannot be set value.");
+ }
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+
+ // API docs: "The replacement text is not included." XmlNode.CloneNode
+ // "The replacement text is set when node is inserted." XmlEntityReference.CloneNode
+ //
+ return new XmlEntityReference ("", OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ // nothing to write for this object.
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteRaw("&");
+ w.WriteName(Name);
+ w.WriteRaw(";");
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlException.cs b/mcs/class/System.XML/System.Xml/XmlException.cs
new file mode 100755
index 00000000000..e0aa241752d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlException.cs
@@ -0,0 +1,93 @@
+//
+// XmlException.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Xml
+{
+ [Serializable]
+ public class XmlException : SystemException
+ {
+ #region Fields
+
+ int lineNumber;
+ int linePosition;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ protected XmlException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ this.lineNumber = info.GetInt32 ("lineNumber");
+ this.linePosition = info.GetInt32 ("linePosition");
+ }
+
+ internal XmlException (string message)
+ : base (message)
+ {
+ }
+
+ internal XmlException (IXmlLineInfo li, string message) : base (message)
+ {
+ if (li != null) {
+ this.lineNumber = li.LineNumber;
+ this.linePosition = li.LinePosition;
+ }
+ }
+
+ internal XmlException (string message, int lineNumber, int linePosition) : base (message)
+ {
+ this.lineNumber = lineNumber;
+ this.linePosition = linePosition;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public int LinePosition {
+ get { return linePosition; }
+ }
+
+ public override string Message {
+ get {
+ if (lineNumber == 0)
+ return base.Message;
+
+ return String.Format ("{0} Line {1}, position {2}.",
+ base.Message, lineNumber, linePosition);
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("lineNumber", lineNumber);
+ info.AddValue ("linePosition", linePosition);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlImplementation.cs b/mcs/class/System.XML/System.Xml/XmlImplementation.cs
new file mode 100644
index 00000000000..7febaa83644
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlImplementation.cs
@@ -0,0 +1,43 @@
+//
+// System.Xml.XmlImplementation.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlImplementation
+ {
+ #region Constructor
+ public XmlImplementation ()
+ : base ()
+ {
+ // The following keys are default of MS .NET Framework
+ NameTable nt = new NameTable();
+ internalNameTable = nt;
+ }
+ #endregion
+
+ #region Public Methods
+ public virtual XmlDocument CreateDocument ()
+ {
+ return new XmlDocument (this);
+ }
+
+ public bool HasFeature (string strFeature, string strVersion)
+ {
+ if ((strFeature == "XML") || (strFeature == "xml") // not case-sensitive
+ && (strVersion == "1.0") || (strVersion == "2.0"))
+ return true;
+ else
+ return false;
+ }
+ #endregion
+
+ #region Internals
+ internal XmlNameTable internalNameTable;
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs b/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs
new file mode 100644
index 00000000000..cc6be542fd4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs
@@ -0,0 +1,77 @@
+//
+// System.Xml.XmlLinkedNode
+//
+// Authors:
+// Jason Diamond <jason@injektilo.org>
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Jason Diamond, Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+ public abstract class XmlLinkedNode : XmlNode
+ {
+ #region Fields
+
+ XmlLinkedNode nextSibling;
+ XmlLinkedNode lastLinkedChild;
+
+ #endregion
+
+ #region Constructors
+ internal XmlLinkedNode(XmlDocument doc) : base(doc) { }
+
+ #endregion
+
+ #region Properties
+
+ public override XmlNode NextSibling
+ {
+ get {
+ if(ParentNode == null) {
+ return null;
+ }
+ else if (Object.ReferenceEquals(nextSibling, ParentNode.LastLinkedChild.NextLinkedSibling) == false) {
+ return nextSibling;
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ internal XmlLinkedNode NextLinkedSibling
+ {
+ get { return nextSibling; }
+ set { nextSibling = value; }
+ }
+
+ public override XmlNode PreviousSibling
+ {
+ get {
+ if (ParentNode != null) {
+ XmlNode node = ParentNode.FirstChild;
+ if (node != this) {
+ do {
+ if (node.NextSibling == this)
+ return node;
+ } while ((node = node.NextSibling) != null);
+ }
+ }
+ return null;
+ }
+ }
+
+ // copied this way from XmlElement
+ internal override XmlLinkedNode LastLinkedChild
+ {
+ get { return lastLinkedChild; }
+ set { lastLinkedChild = value; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNameTable.cs b/mcs/class/System.XML/System.Xml/XmlNameTable.cs
new file mode 100644
index 00000000000..7de896f0fc4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNameTable.cs
@@ -0,0 +1,20 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.XmlNameTable.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ public abstract class XmlNameTable
+ {
+ public abstract string Add (string name);
+ public abstract string Add (char [] buffer, int offset, int length);
+ public abstract string Get (string name);
+ public abstract string Get (char [] buffer, int offset, int length);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs b/mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs
new file mode 100644
index 00000000000..756b30d18b6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs
@@ -0,0 +1,114 @@
+//
+// System.Xml.XmlNamedNodeMap
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlNamedNodeMap : IEnumerable
+ {
+ XmlNode parent;
+ ArrayList nodeList;
+ bool readOnly = false;
+
+ internal XmlNamedNodeMap (XmlNode parent)
+ {
+ this.parent = parent;
+ nodeList = new ArrayList ();
+ }
+
+ public virtual int Count {
+ get { return nodeList.Count; }
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return nodeList.GetEnumerator ();
+ }
+
+ public virtual XmlNode GetNamedItem (string name)
+ {
+ foreach (XmlNode node in nodeList) {
+ if (node.Name == name)
+ return node;
+ }
+ return null;
+ }
+
+ public virtual XmlNode GetNamedItem (string localName, string namespaceURI)
+ {
+ foreach (XmlNode node in nodeList) {
+ if ((node.LocalName == localName)
+ && (node.NamespaceURI == namespaceURI))
+ return node;
+ }
+
+ return null;
+ }
+
+ public virtual XmlNode Item (int index)
+ {
+ if (index < 0 || index > nodeList.Count)
+ return null;
+ else
+ return (XmlNode) nodeList [index];
+ }
+
+ public virtual XmlNode RemoveNamedItem (string name)
+ {
+ foreach (XmlNode node in nodeList)
+ if (node.Name == name) {
+ nodeList.Remove (node);
+ return node;
+ }
+
+ return null;
+ }
+
+ public virtual XmlNode RemoveNamedItem (string localName, string namespaceURI)
+ {
+ foreach (XmlNode node in nodeList)
+ if ((node.LocalName == localName)
+ && (node.NamespaceURI == namespaceURI)) {
+ nodeList.Remove (node);
+ return node;
+ }
+
+ return null;
+ }
+
+ public virtual XmlNode SetNamedItem (XmlNode node)
+ {
+ return SetNamedItem(node, -1);
+ }
+
+ internal XmlNode SetNamedItem (XmlNode node, int pos)
+ {
+ if (readOnly || (node.OwnerDocument != parent.OwnerDocument))
+ throw new ArgumentException ("Cannot add to NodeMap.");
+
+ foreach (XmlNode x in nodeList)
+ if(x.LocalName == node.LocalName && x.NamespaceURI == node.NamespaceURI) {
+ nodeList.Remove (x);
+ nodeList.Add (node);
+ return x;
+ }
+
+ if(pos < 0)
+ nodeList.Add (node);
+ else
+ nodeList.Insert(pos, node);
+ return null;
+ }
+
+ internal ArrayList Nodes { get { return nodeList; } }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
new file mode 100644
index 00000000000..ab8a0ebe6ce
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
@@ -0,0 +1,182 @@
+//
+// XmlNamespaceManager.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlNamespaceManager : IEnumerable
+ {
+ #region Fields
+
+ private XmlNameTable nameTable;
+ private NamespaceScope currentScope;
+
+ #endregion
+
+ #region Constructor
+
+ public XmlNamespaceManager (XmlNameTable nameTable)
+ {
+ this.nameTable = nameTable;
+
+ nameTable.Add ("xmlns");
+ nameTable.Add ("xml");
+ nameTable.Add (String.Empty);
+ nameTable.Add ("http://www.w3.org/2000/xmlns/");
+ nameTable.Add ("http://www.w3.org/XML/1998/namespace");
+
+ PushScope ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual string DefaultNamespace {
+ get { return LookupNamespace (String.Empty); }
+ }
+
+ public XmlNameTable NameTable {
+ get { return nameTable; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public virtual void AddNamespace (string prefix, string uri)
+ {
+ if (prefix == null)
+ throw new ArgumentNullException ("prefix", "Value cannot be null.");
+
+ if (uri == null)
+ throw new ArgumentNullException ("uri", "Value cannot be null.");
+
+ if (prefix.Length > 2 && prefix.Substring (0, 3).ToLower () == "xml")
+ throw new ArgumentException ( "Prefixes beginning with \"xml\" (regardless " + "of whether the characters are uppercase, lowercase, or some combination thereof) are reserved for use by XML.", "prefix");
+
+ if (currentScope.Namespaces == null)
+ currentScope.Namespaces = new Hashtable ();
+
+ if (prefix == String.Empty)
+ currentScope.Namespaces [prefix] = nameTable.Add (uri);
+ else
+ currentScope.Namespaces.Add (nameTable.Add (prefix), nameTable.Add (uri));
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ if (currentScope.Namespaces == null)
+ currentScope.Namespaces = new Hashtable ();
+
+ return currentScope.Namespaces.Keys.GetEnumerator ();
+ }
+
+ public virtual bool HasNamespace (string prefix)
+ {
+ return currentScope != null && currentScope.Namespaces != null && currentScope.Namespaces.Contains (prefix);
+ }
+
+ public virtual string LookupNamespace (string prefix)
+ {
+ NamespaceScope scope = currentScope;
+
+ while (scope != null) {
+ if (scope.Namespaces != null && scope.Namespaces.Contains (prefix))
+ return scope.Namespaces[prefix] as string;
+ scope = scope.Next;
+ }
+
+ switch (prefix) {
+ case "xmlns":
+ return nameTable.Get ("http://www.w3.org/2000/xmlns/");
+ case "xml":
+ return nameTable.Get ("http://www.w3.org/XML/1998/namespace");
+ case "":
+ return nameTable.Get (String.Empty);
+ }
+
+ return null;
+ }
+
+ public virtual string LookupPrefix (string uri)
+ {
+ if (uri == null)
+ return null;
+
+ NamespaceScope scope = currentScope;
+
+ while (scope != null)
+ {
+ if (scope.Namespaces != null && scope.Namespaces.ContainsValue (uri)) {
+ foreach (DictionaryEntry entry in scope.Namespaces) {
+ if (entry.Value.ToString() == uri)
+ return nameTable.Get (entry.Key as string) as string;
+ }
+ }
+
+ scope = scope.Next;
+ }
+
+ // ECMA specifies that this method returns String.Empty
+ // in case of no match. But actually MS.NET returns null.
+ // For more information,see
+ // http://lists.ximian.com/archives/public/mono-list/2003-January/005071.html
+ //return String.Empty;
+ return null;
+ }
+
+ public virtual bool PopScope ()
+ {
+ if (currentScope != null)
+ currentScope = currentScope.Next;
+
+ return currentScope != null;
+ }
+
+ public virtual void PushScope ()
+ {
+ NamespaceScope newScope = new NamespaceScope ();
+ newScope.Next = currentScope;
+ currentScope = newScope;
+ }
+
+ public virtual void RemoveNamespace (string prefix, string uri)
+ {
+ if (prefix == null)
+ throw new ArgumentNullException ("prefix");
+
+ if (uri == null)
+ throw new ArgumentNullException ("uri");
+
+ if (currentScope == null || currentScope.Namespaces == null)
+ return;
+
+ string p = nameTable.Get (prefix);
+ string u = nameTable.Get (uri);
+ if (p == null || u == null)
+ return;
+
+ string storedUri = currentScope.Namespaces [p] as string;
+ if (storedUri == null || storedUri != u)
+ return;
+
+ currentScope.Namespaces.Remove (p);
+ }
+
+ #endregion
+ }
+
+ internal class NamespaceScope
+ {
+ internal NamespaceScope Next;
+ internal Hashtable Namespaces;
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs
new file mode 100644
index 00000000000..f7502f16cf1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNode.cs
@@ -0,0 +1,532 @@
+//
+// System.Xml.XmlNode
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//
+// (C) 2002 Kral Ferch
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public abstract class XmlNode : ICloneable, IEnumerable, IXPathNavigable
+ {
+ #region Fields
+
+ XmlDocument ownerDocument;
+ XmlNode parentNode;
+
+ #endregion
+
+ #region Constructors
+
+ internal XmlNode (XmlDocument ownerDocument)
+ {
+ this.ownerDocument = ownerDocument;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual XmlAttributeCollection Attributes {
+ get { return null; }
+ }
+
+ public virtual string BaseURI {
+ get {
+ // Isn't it conformant to W3C XML Base Recommendation?
+ // As far as I tested, there are not...
+ return (ParentNode != null) ? ParentNode.BaseURI : OwnerDocument.BaseURI;
+ }
+ }
+
+ public virtual XmlNodeList ChildNodes {
+ get {
+ return new XmlNodeListChildren (this);
+ }
+ }
+
+ public virtual XmlNode FirstChild {
+ get {
+ if (LastChild != null) {
+ return LastLinkedChild.NextLinkedSibling;
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ public virtual bool HasChildNodes {
+ get { return LastChild != null; }
+ }
+
+ [MonoTODO("confirm whether this way is right for each not-overriden types.")]
+ public virtual string InnerText {
+ get {
+ StringBuilder builder = new StringBuilder ();
+ AppendChildValues (this, builder);
+ return builder.ToString ();
+ }
+
+ set { throw new NotImplementedException (); }
+ }
+
+ private void AppendChildValues (XmlNode parent, StringBuilder builder)
+ {
+ XmlNode node = parent.FirstChild;
+
+ while (node != null) {
+ if (node.NodeType == XmlNodeType.Text)
+ builder.Append (node.Value);
+ AppendChildValues (node, builder);
+ node = node.NextSibling;
+ }
+ }
+
+ [MonoTODO("Setter.")]
+ public virtual string InnerXml {
+ get {
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+
+ WriteContentTo (xtw);
+
+ return sw.GetStringBuilder ().ToString ();
+ }
+
+ set { throw new NotImplementedException (); }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public virtual XmlElement this [string name] {
+ get {
+ foreach (XmlNode node in ChildNodes) {
+ if ((node.NodeType == XmlNodeType.Element) &&
+ (node.Name == name)) {
+ return (XmlElement) node;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public virtual XmlElement this [string localname, string ns] {
+ get {
+ foreach (XmlNode node in ChildNodes) {
+ if ((node.NodeType == XmlNodeType.Element) &&
+ (node.LocalName == localname) &&
+ (node.NamespaceURI == ns)) {
+ return (XmlElement) node;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public virtual XmlNode LastChild {
+ get { return LastLinkedChild; }
+ }
+
+ internal virtual XmlLinkedNode LastLinkedChild {
+ get { return null; }
+ set { }
+ }
+
+ public abstract string LocalName { get; }
+
+ public abstract string Name { get; }
+
+ public virtual string NamespaceURI {
+ get { return String.Empty; }
+ }
+
+ public virtual XmlNode NextSibling {
+ get { return null; }
+ }
+
+ public abstract XmlNodeType NodeType { get; }
+
+ internal virtual XPathNodeType XPathNodeType {
+ get {
+ return (XPathNodeType) (-1);
+ }
+ }
+
+ public virtual string OuterXml {
+ get {
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+
+ WriteTo (xtw);
+
+ return sw.GetStringBuilder ().ToString ();
+ }
+ }
+
+ public virtual XmlDocument OwnerDocument {
+ get { return ownerDocument; }
+ }
+
+ public virtual XmlNode ParentNode {
+ get { return parentNode; }
+ }
+
+ public virtual string Prefix {
+ get { return String.Empty; }
+ set {}
+ }
+
+ public virtual XmlNode PreviousSibling {
+ get { return null; }
+ }
+
+ public virtual string Value {
+ get { return null; }
+ set { throw new InvalidOperationException ("This node does not have a value"); }
+ }
+
+ internal virtual string XmlLang {
+ get {
+ if(Attributes != null)
+ foreach(XmlAttribute attr in Attributes)
+ if(attr.Name == "xml:lang")
+ return attr.Value;
+ return (ParentNode != null) ? ParentNode.XmlLang : OwnerDocument.XmlLang;
+ }
+ }
+
+ internal virtual XmlSpace XmlSpace {
+ get {
+ if(Attributes != null) {
+ foreach(XmlAttribute attr in Attributes) {
+ if(attr.Name == "xml:space") {
+ switch(attr.Value) {
+ case "preserve": return XmlSpace.Preserve;
+ case "default": return XmlSpace.Default;
+ }
+ break;
+ }
+ }
+ }
+ return (ParentNode != null) ? ParentNode.XmlSpace : OwnerDocument.XmlSpace;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public virtual XmlNode AppendChild (XmlNode newChild)
+ {
+ // I assume that AppendChild(n) equals to InsertAfter(n, this.LastChild) or InsertBefore(n, null)
+ return InsertBefore (newChild, null);
+ }
+
+ public virtual XmlNode Clone ()
+ {
+ // By MS document, it is equivalent to CloneNode(true).
+ return this.CloneNode (true);
+ }
+
+ public abstract XmlNode CloneNode (bool deep);
+
+ [MonoTODO]
+ public XPathNavigator CreateNavigator ()
+ {
+ return new XmlDocumentNavigator (this);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new XmlNodeListChildren (this).GetEnumerator ();
+ }
+
+ [MonoTODO("performance problem.")]
+ public virtual string GetNamespaceOfPrefix (string prefix)
+ {
+ XmlNamespaceManager nsmgr = ConstructNamespaceManager ();
+ return nsmgr.LookupNamespace (prefix);
+ }
+
+ [MonoTODO("performance problem.")]
+ public virtual string GetPrefixOfNamespace (string namespaceURI)
+ {
+ XmlNamespaceManager nsmgr = ConstructNamespaceManager ();
+ string ns = nsmgr.LookupPrefix (namespaceURI);
+ return (ns != null) ? ns : String.Empty;
+ }
+
+ object ICloneable.Clone ()
+ {
+ return Clone ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ public virtual XmlNode InsertAfter (XmlNode newChild, XmlNode refChild)
+ {
+ // I assume that insertAfter(n1, n2) equals to InsertBefore(n1, n2.PreviousSibling).
+
+ // I took this way because rather than calling InsertAfter() from InsertBefore()
+ // because current implementation of 'NextSibling' looks faster than 'PreviousSibling'.
+ XmlNode argNode = null;
+ if(refChild != null)
+ argNode = refChild.NextSibling;
+ else if(ChildNodes.Count > 0)
+ argNode = FirstChild;
+ return InsertBefore (newChild, argNode);
+ }
+
+ [MonoTODO("If inserted node is entity reference, then check conforming entity. Wait for DTD implementation.")]
+ public virtual XmlNode InsertBefore (XmlNode newChild, XmlNode refChild)
+ {
+ XmlDocument ownerDoc = (NodeType == XmlNodeType.Document) ? (XmlDocument)this : OwnerDocument;
+
+ if (NodeType == XmlNodeType.Document ||
+ NodeType == XmlNodeType.Element ||
+ NodeType == XmlNodeType.Attribute ||
+ NodeType == XmlNodeType.DocumentFragment) {
+ if (IsReadOnly)
+ throw new ArgumentException ("The specified node is readonly.");
+
+ if (newChild.OwnerDocument != ownerDoc)
+ throw new ArgumentException ("Can't append a node created by another document.");
+
+ if (refChild != null && newChild.OwnerDocument != refChild.OwnerDocument)
+ throw new ArgumentException ("argument nodes are on the different documents.");
+
+ if (refChild != null && this == ownerDoc &&
+ ownerDoc.DocumentElement != null &&
+ (newChild is XmlElement ||
+ newChild is XmlCharacterData ||
+ newChild is XmlEntityReference))
+ throw new XmlException ("cannot insert this node to this position.");
+
+ // checking validity finished. then appending...
+
+ ownerDoc.onNodeInserting (newChild, this);
+
+ if(newChild.ParentNode != null)
+ newChild.ParentNode.RemoveChild (newChild);
+
+ if(newChild.NodeType == XmlNodeType.DocumentFragment) {
+ int x = newChild.ChildNodes.Count;
+ for(int i=0; i<x; i++) {
+ XmlNode n = newChild.ChildNodes [0];
+ this.InsertBefore (n, refChild); // recursively invokes events. (It is compatible with MS implementation.)
+ }
+ }
+ else {
+ XmlLinkedNode newLinkedChild = (XmlLinkedNode) newChild;
+ XmlLinkedNode lastLinkedChild = LastLinkedChild;
+
+ newLinkedChild.parentNode = this;
+
+ if(refChild == null) {
+ // append last, so:
+ // * set nextSibling of previous lastchild to newChild
+ // * set lastchild = newChild
+ // * set next of newChild to firstChild
+ if(LastLinkedChild != null) {
+ XmlLinkedNode formerFirst = FirstChild as XmlLinkedNode;
+ LastLinkedChild.NextLinkedSibling = newLinkedChild;
+ LastLinkedChild = newLinkedChild;
+ newLinkedChild.NextLinkedSibling = formerFirst;
+ }
+ else {
+ LastLinkedChild = newLinkedChild;
+ LastLinkedChild.NextLinkedSibling = newLinkedChild; // FirstChild
+ }
+ }
+ else {
+ // append not last, so:
+ // * if newchild is first, then set next of lastchild is newChild.
+ // otherwise, set next of previous sibling to newChild
+ // * set next of newChild to refChild
+ XmlLinkedNode prev = refChild.PreviousSibling as XmlLinkedNode;
+ if(prev == null)
+ LastLinkedChild.NextLinkedSibling = newLinkedChild;
+ else
+ prev.NextLinkedSibling = newLinkedChild;
+ newLinkedChild.NextLinkedSibling = refChild as XmlLinkedNode;
+ }
+ ownerDoc.onNodeInserted (newChild, newChild.ParentNode);
+ }
+ return newChild;
+ }
+ else
+ throw new InvalidOperationException ();
+ }
+
+ [MonoTODO]
+ public virtual void Normalize ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XmlNode PrependChild (XmlNode newChild)
+ {
+ return InsertAfter (newChild, null);
+ }
+
+ public virtual void RemoveAll ()
+ {
+ XmlNode next = null;
+ for (XmlNode node = FirstChild; node != null; node = next) {
+ next = node.NextSibling;
+ RemoveChild (node);
+ }
+ }
+
+ public virtual XmlNode RemoveChild (XmlNode oldChild)
+ {
+ XmlDocument ownerDoc = (NodeType == XmlNodeType.Document) ? (XmlDocument)this : OwnerDocument;
+ if(oldChild.ParentNode != this)
+ throw new XmlException ("specified child is not child of this node.");
+
+ ownerDoc.onNodeRemoving (oldChild, oldChild.ParentNode);
+
+ if (NodeType == XmlNodeType.Document || NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute || NodeType == XmlNodeType.DocumentFragment) {
+ if (IsReadOnly)
+ throw new ArgumentException ();
+
+ if (Object.ReferenceEquals (LastLinkedChild, LastLinkedChild.NextLinkedSibling) && Object.ReferenceEquals (LastLinkedChild, oldChild))
+ LastLinkedChild = null;
+ else {
+ XmlLinkedNode oldLinkedChild = (XmlLinkedNode)oldChild;
+ XmlLinkedNode beforeLinkedChild = LastLinkedChild;
+
+ while (!Object.ReferenceEquals (beforeLinkedChild.NextLinkedSibling, LastLinkedChild) && !Object.ReferenceEquals (beforeLinkedChild.NextLinkedSibling, oldLinkedChild))
+ beforeLinkedChild = beforeLinkedChild.NextLinkedSibling;
+
+ if (!Object.ReferenceEquals (beforeLinkedChild.NextLinkedSibling, oldLinkedChild))
+ throw new ArgumentException ();
+
+ beforeLinkedChild.NextLinkedSibling = oldLinkedChild.NextLinkedSibling;
+ oldLinkedChild.NextLinkedSibling = null;
+ }
+
+ ownerDoc.onNodeRemoved (oldChild, oldChild.ParentNode);
+ oldChild.parentNode = null; // clear parent 'after' above logic.
+
+ return oldChild;
+ }
+ else
+ throw new ArgumentException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode ReplaceChild (XmlNode newChild, XmlNode oldChild)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public XmlNodeList SelectNodes (string xpath)
+ {
+ return SelectNodes (xpath, null);
+ }
+
+ [MonoTODO]
+ public XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
+ {
+ XPathNavigator nav = CreateNavigator ();
+ XPathExpression expr = nav.Compile (xpath);
+ if (nsmgr != null)
+ expr.SetContext (nsmgr);
+ XPathNodeIterator iter = nav.Select (expr);
+ ArrayList rgNodes = new ArrayList ();
+ while (iter.MoveNext ())
+ {
+ rgNodes.Add (((XmlDocumentNavigator) iter.Current).Node);
+ }
+ return new XmlNodeArrayList (rgNodes);
+ }
+
+ public XmlNode SelectSingleNode (string xpath)
+ {
+ return SelectSingleNode (xpath, null);
+ }
+
+ [MonoTODO]
+ public XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
+ {
+ XPathNavigator nav = CreateNavigator ();
+ XPathExpression expr = nav.Compile (xpath);
+ if (nsmgr != null)
+ expr.SetContext (nsmgr);
+ XPathNodeIterator iter = nav.Select (expr);
+ if (!iter.MoveNext ())
+ return null;
+ return ((XmlDocumentNavigator) iter.Current).Node;
+ }
+
+ internal void SetParentNode (XmlNode parent)
+ {
+ parentNode = parent;
+ }
+
+ [MonoTODO]
+ public virtual bool Supports (string feature, string version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void WriteContentTo (XmlWriter w);
+
+ public abstract void WriteTo (XmlWriter w);
+
+ // It parses this and all the ancestor elements,
+ // find 'xmlns' declarations, stores and then return them.
+ // TODO: tests
+ internal XmlNamespaceManager ConstructNamespaceManager ()
+ {
+ XmlDocument doc = this is XmlDocument ? (XmlDocument)this : this.OwnerDocument;
+ XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
+ XmlElement el = null;
+ switch(this.NodeType) {
+ case XmlNodeType.Attribute:
+ el = ((XmlAttribute)this).OwnerElement;
+ break;
+ case XmlNodeType.Element:
+ el = this as XmlElement;
+ break;
+ default:
+ el = this.ParentNode as XmlElement;
+ break;
+ }
+
+ while(el != null) {
+ foreach(XmlAttribute attr in el.Attributes) {
+ if(attr.Prefix == "xmlns" || (attr.Name == "xmlns" && attr.Prefix == String.Empty)) {
+ if(nsmgr.LookupNamespace (attr.LocalName) == null )
+ nsmgr.AddNamespace (attr.LocalName, attr.Value);
+ }
+ }
+ // When reached to document, then it will set null value :)
+ el = el.ParentNode as XmlElement;
+ }
+ return nsmgr;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeArrayList.cs b/mcs/class/System.XML/System.Xml/XmlNodeArrayList.cs
new file mode 100644
index 00000000000..a62fd77f401
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeArrayList.cs
@@ -0,0 +1,36 @@
+//
+// System.Xml.XmlNodeArrayList
+//
+// Author:
+// Piers Haken <piersh@friskit.com>
+//
+// (C) 2002 Piers Haken
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ internal class XmlNodeArrayList : XmlNodeList
+ {
+ ArrayList _rgNodes;
+
+ public XmlNodeArrayList (ArrayList rgNodes)
+ {
+ _rgNodes = rgNodes;
+ }
+
+ public override int Count { get { return _rgNodes.Count; } }
+
+ public override IEnumerator GetEnumerator ()
+ {
+ return _rgNodes.GetEnumerator ();
+ }
+
+ public override XmlNode Item (int index)
+ {
+ return (XmlNode) _rgNodes [index];
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs
new file mode 100755
index 00000000000..811edfd92f0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs
@@ -0,0 +1,27 @@
+using System;
+
+namespace System.Xml
+{
+ /// <summary>
+ /// Enumeration of node changed actions.
+ /// </summary>
+ public enum XmlNodeChangedAction
+ {
+
+ /// <summary>
+ /// A node is being inserted in the tree
+ /// </summary>
+ Insert = 0,
+
+ /// <summary>
+ /// A node is being removed from the tree.
+ /// </summary>
+ Remove = 1,
+
+ /// <summary>
+ /// A node is being changed.
+ /// </summary>
+ Change = 2,
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs
new file mode 100644
index 00000000000..29a842ad55d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs
@@ -0,0 +1,67 @@
+using System;
+
+namespace System.Xml
+{
+ /// <summary>
+ /// Passed to delegates on document tree changes
+ /// </summary>
+ public class XmlNodeChangedEventArgs
+ {
+ // Private data members
+ XmlNode _oldParent;
+ XmlNode _newParent;
+ XmlNodeChangedAction _action;
+ XmlNode _node;
+
+ // public properties
+ public XmlNodeChangedAction Action
+ {
+ get
+ {
+ return _action;
+ }
+ }
+
+ public XmlNode Node
+ {
+ get
+ {
+ return _node;
+ }
+ }
+
+
+ public XmlNode OldParent
+ {
+ get
+ {
+ return _oldParent;
+ }
+ }
+
+
+ public XmlNode NewParent
+ {
+ get
+ {
+ return _newParent;
+ }
+ }
+
+
+ // Public Methods
+ // Internal Methods
+ internal XmlNodeChangedEventArgs(
+ XmlNodeChangedAction action,
+ XmlNode node,
+ XmlNode oldParent,
+ XmlNode newParent)
+ {
+ _node = node;
+ _oldParent = oldParent;
+ _newParent = newParent;
+ _action = action;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs
new file mode 100755
index 00000000000..161482276d2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.Xml.XmlNodeChangedEventHandler.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public delegate void XmlNodeChangedEventHandler (Object sender,
+ XmlNodeChangedEventArgs e);
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeList.cs b/mcs/class/System.XML/System.Xml/XmlNodeList.cs
new file mode 100644
index 00000000000..eff56279b55
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeList.cs
@@ -0,0 +1,42 @@
+//
+// System.Xml.XmlNodeList
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public abstract class XmlNodeList : IEnumerable
+ {
+ #region Constructors
+
+ protected XmlNodeList() { }
+
+ #endregion
+
+ #region Properties
+
+ public abstract int Count { get; }
+
+ [System.Runtime.CompilerServices.IndexerName("ItemOf")]
+ public virtual XmlNode this [int i] {
+ get { return Item(i); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public abstract IEnumerator GetEnumerator ();
+
+ public abstract XmlNode Item (int index);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs b/mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs
new file mode 100644
index 00000000000..c5d62823503
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs
@@ -0,0 +1,146 @@
+//
+// System.Xml.XmlNodeList
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ internal class XmlNodeListChildren : XmlNodeList
+ {
+ #region Enumerator
+
+ private class Enumerator : IEnumerator
+ {
+ XmlNode parent;
+ XmlLinkedNode currentChild;
+ bool passedLastNode;
+
+ internal Enumerator (XmlNode parent)
+ {
+ currentChild = null;
+ this.parent = parent;
+ passedLastNode = false;
+ }
+
+ public virtual object Current {
+ get {
+ if ((currentChild == null) ||
+ (parent.LastLinkedChild == null) ||
+ (passedLastNode == true))
+ throw new InvalidOperationException();
+
+ return currentChild;
+ }
+ }
+
+ public virtual bool MoveNext()
+ {
+ bool movedNext = true;
+
+ if (parent.LastLinkedChild == null) {
+ movedNext = false;
+ }
+ else if (currentChild == null) {
+ currentChild = parent.LastLinkedChild.NextLinkedSibling;
+ }
+ else {
+ if (Object.ReferenceEquals(currentChild, parent.LastLinkedChild)) {
+ movedNext = false;
+ passedLastNode = true;
+ }
+ else {
+ currentChild = currentChild.NextLinkedSibling;
+ }
+ }
+
+ return movedNext;
+ }
+
+ public virtual void Reset()
+ {
+ currentChild = null;
+ }
+ }
+
+ #endregion
+
+ #region Fields
+
+ XmlNode parent;
+
+ #endregion
+
+ #region Constructors
+ public XmlNodeListChildren(XmlNode parent)
+ {
+ this.parent = parent;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override int Count {
+ get {
+ int count = 0;
+
+ if (parent.LastLinkedChild != null) {
+ XmlLinkedNode currentChild = parent.LastLinkedChild.NextLinkedSibling;
+
+ count = 1;
+ while (!Object.ReferenceEquals(currentChild, parent.LastLinkedChild)) {
+ currentChild = currentChild.NextLinkedSibling;
+ count++;
+ }
+ }
+
+ return count;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override IEnumerator GetEnumerator ()
+ {
+ return new Enumerator(parent);
+ }
+
+ public override XmlNode Item (int index)
+ {
+ XmlNode requestedNode = null;
+
+ // Instead of checking for && index < Count which has to walk
+ // the whole list to get a count, we'll just keep a count since
+ // we have to walk the list anyways to get to index.
+ if ((index >= 0) && (parent.LastLinkedChild != null)) {
+ XmlLinkedNode currentChild = parent.LastLinkedChild.NextLinkedSibling;
+ int count = 0;
+
+ while ((count < index) && !Object.ReferenceEquals(currentChild, parent.LastLinkedChild))
+ {
+ currentChild = currentChild.NextLinkedSibling;
+ count++;
+ }
+
+ if (count == index) {
+ requestedNode = currentChild;
+ }
+ }
+
+ return requestedNode;
+ }
+
+ #endregion
+ }
+
+
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeOrder.cs b/mcs/class/System.XML/System.Xml/XmlNodeOrder.cs
new file mode 100755
index 00000000000..9550967bbe6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeOrder.cs
@@ -0,0 +1,19 @@
+//
+// System.Xml.XmlNodeOrder.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ [Serializable]
+ public enum XmlNodeOrder
+ {
+ Before = 0,
+ After = 1,
+ Same = 2,
+ Unknown = 3,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeReader.cs b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
new file mode 100755
index 00000000000..bb4636947bc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
@@ -0,0 +1,420 @@
+//
+// System.Xml.XmlNodeReader.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+//
+// (C) Ximian, Inc.
+// (C) Atsushi Enomoto
+//
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlNodeReader : XmlReader
+ {
+ #region Constructor
+
+ XmlNode current;
+ ReadState state = ReadState.Initial;
+ int depth;
+ bool isEndElement;
+ bool isEndEntity;
+ bool nextIsEndElement;
+ bool alreadyRead;
+
+ public XmlNodeReader (XmlNode node)
+ {
+ current = node;
+ if (node.NodeType != XmlNodeType.Document
+ && node.NodeType != XmlNodeType.DocumentFragment)
+ alreadyRead = true;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override int AttributeCount {
+ get {
+ return ((ICollection) current.Attributes).Count;
+ }
+ }
+
+ public override string BaseURI {
+ get { return current.BaseURI; }
+ }
+
+ public override bool CanResolveEntity {
+ get { return false; }
+ }
+
+ public override int Depth {
+ get { return depth; }
+ }
+
+ public override bool EOF {
+ get { return this.ReadState == ReadState.EndOfFile; }
+ }
+
+ public override bool HasAttributes {
+ get {
+ if (current.Attributes == null)
+ return false;
+ else
+ return true;
+ }
+ }
+
+ public override bool HasValue {
+ get {
+ if (current.NodeType == XmlNodeType.Element ||
+ current.NodeType == XmlNodeType.EntityReference ||
+ current.NodeType == XmlNodeType.Document ||
+ current.NodeType == XmlNodeType.DocumentFragment ||
+ current.NodeType == XmlNodeType.Notation ||
+ current.NodeType == XmlNodeType.EndElement ||
+ current.NodeType == XmlNodeType.EndEntity)
+ return false;
+ else
+ return true;
+ }
+
+ }
+
+ [MonoTODO("waiting for DTD implementation")]
+ public override bool IsDefault {
+ get {
+ if (current.NodeType != XmlNodeType.Attribute)
+ return false;
+ else
+ {
+ return ((XmlAttribute) current).isDefault;
+ }
+ }
+ }
+
+ [MonoTODO("test it.")]
+ public override bool IsEmptyElement {
+ get {
+ if(current.NodeType == XmlNodeType.Element)
+ return ((XmlElement) current).IsEmpty;
+ else
+ return false;
+ }
+ }
+
+ public override string this [int i] {
+ get {
+ if (i < 0 || i > AttributeCount)
+ throw new ArgumentOutOfRangeException ("i is out of range.");
+
+ return current.Attributes [i].Value;
+ }
+ }
+
+ public override string this [string name] {
+ get {
+ string ret = current.Attributes [name].Value;
+
+ if (ret == null)
+ return String.Empty;
+ else
+ return ret;
+ }
+ }
+
+ public override string this [string name, string namespaceURI] {
+ get {
+ string ret = current.Attributes [name].Value;
+
+ if (ret == null)
+ return String.Empty;
+ else
+ return ret;
+ }
+ }
+
+ public override string LocalName {
+ get {
+ if (current is XmlCharacterData)
+ return String.Empty;
+ else
+ return current.LocalName;
+ }
+ }
+
+ public override string Name {
+ get { return current.Name; }
+ }
+
+ public override string NamespaceURI {
+ get {
+ return current.NamespaceURI;
+ }
+ }
+
+ public override XmlNameTable NameTable {
+ get {
+ XmlDocument doc =
+ current.NodeType == XmlNodeType.Document ?
+ current as XmlDocument : current.OwnerDocument;
+ return doc.NameTable;
+ }
+ }
+
+ public override XmlNodeType NodeType {
+ get {
+ return isEndElement ? XmlNodeType.EndElement : current.NodeType;
+ }
+ }
+
+ public override string Prefix {
+ get {
+ return current.Prefix;
+ }
+ }
+
+ public override char QuoteChar {
+ get { return '"'; }
+ }
+
+ public override ReadState ReadState {
+ get { return state; }
+ }
+
+ public override string Value {
+ get {
+ return HasValue ? current.Value : String.Empty;
+ }
+ }
+
+ public override string XmlLang {
+ get { return current.XmlLang; }
+ }
+
+ public override XmlSpace XmlSpace {
+ get { return current.XmlSpace; }
+ }
+ #endregion
+
+ #region Methods
+
+ public override void Close ()
+ {
+ current = null;
+ state = ReadState.Closed;
+ }
+
+ public override string GetAttribute (int attributeIndex)
+ {
+ return this [attributeIndex];
+ }
+
+ public override string GetAttribute (string name)
+ {
+ return this [name];
+ }
+
+ public override string GetAttribute (string name, string namespaceURI)
+ {
+ return this [name, namespaceURI];
+ }
+
+ // FIXME: Its performance is not good.
+ public override string LookupNamespace (string prefix)
+ {
+ XmlNamespaceManager nsmgr = current.ConstructNamespaceManager();
+ return nsmgr.LookupNamespace (prefix);
+ }
+
+ public override void MoveToAttribute (int attributeIndex)
+ {
+ if (attributeIndex < 0 || attributeIndex > AttributeCount)
+ throw new ArgumentOutOfRangeException ();
+
+ state = ReadState.Interactive;
+ current = current.Attributes [attributeIndex];
+ }
+
+ public override bool MoveToAttribute (string name)
+ {
+ if (GetAttribute (name) == null)
+ return false;
+ else
+ return true;
+ }
+
+ public override bool MoveToAttribute (string name, string namespaceURI)
+ {
+ if (GetAttribute (name, namespaceURI) == null)
+ return false;
+ else
+ return true;
+ }
+
+ public override bool MoveToElement ()
+ {
+ if (current.NodeType == XmlNodeType.Attribute) {
+ current = ((XmlAttribute) current).OwnerElement;
+ return true;
+ } else
+ return false;
+ }
+
+ public override bool MoveToFirstAttribute ()
+ {
+ if(current.Attributes.Count > 0)
+ {
+ current = current.Attributes [0];
+ return true;
+ }
+ else
+ return false;
+ }
+
+ public override bool MoveToNextAttribute ()
+ {
+ if (current.NodeType != XmlNodeType.Attribute)
+ return MoveToFirstAttribute ();
+ else
+ {
+ XmlAttributeCollection ac = ((XmlAttribute) current).OwnerElement.Attributes;
+ for (int i=0; i<ac.Count-1; i++)
+ {
+ XmlAttribute attr = ac [i];
+ if (attr == current)
+ {
+ current = ac [i+1];
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ [MonoTODO("Entity handling is not supported.")]
+ public override bool Read ()
+ {
+ state = ReadState.Interactive;
+
+ isEndEntity = false;
+
+ if (current.NodeType == XmlNodeType.Attribute)
+ current = ((XmlAttribute) current).OwnerElement;
+
+ if (nextIsEndElement) {
+ nextIsEndElement = false;
+ isEndElement = true;
+ } else if (alreadyRead) {
+ alreadyRead = false;
+ return current != null;
+ }
+
+ if (!isEndElement && current.FirstChild != null) {
+ isEndElement = false;
+ current = current.FirstChild;
+ depth++;
+ } else if (depth == 0) {
+ state = ReadState.EndOfFile;
+ return false;
+ } else if (current.NextSibling != null) {
+ isEndElement = false;
+ current = current.NextSibling;
+ } else {
+ isEndElement = true;
+ depth--;
+ current = current.ParentNode;
+ }
+ return current != null;
+ }
+
+ public override bool ReadAttributeValue ()
+ {
+ if (current is XmlAttribute) {
+ current = current.FirstChild;
+ return current != null;
+ } else if (current.ParentNode.NodeType == XmlNodeType.Attribute) {
+ current = current.NextSibling;
+ return current != null;
+ } else
+ return false;
+ }
+
+ [MonoTODO("Need to move to next content.")]
+ // Its traversal behavior is almost same as Read().
+ public override string ReadInnerXml ()
+ {
+ if (current.NodeType != XmlNodeType.Attribute &&
+ current.NodeType != XmlNodeType.Element)
+ return String.Empty;
+ else
+ return current.InnerXml;
+ }
+
+ [MonoTODO("Need to move to next content.")]
+ // Its traversal behavior is almost same as Read().
+ public override string ReadOuterXml ()
+ {
+ if (current.NodeType != XmlNodeType.Attribute &&
+ current.NodeType != XmlNodeType.Element)
+ return String.Empty;
+ else
+ return current.OuterXml;
+ }
+
+ [MonoTODO("test it.")]
+ public override string ReadString ()
+ {
+ XmlNode original = current;
+ StringBuilder builder = new StringBuilder();
+ foreach (XmlNode child in current.ChildNodes)
+ {
+ if (child is XmlCharacterData)
+ builder.Append (child.Value);
+ else {
+ depth++;
+ current = child;
+ break;
+ }
+ }
+ alreadyRead = true;
+ if (current == original)
+ nextIsEndElement = true;
+ return builder.ToString ();
+ }
+
+ [MonoTODO]
+ public override void ResolveEntity ()
+ {
+ if (current.NodeType != XmlNodeType.EntityReference)
+ throw new InvalidOperationException ("The current node is not an Entity Reference");
+ }
+
+ [MonoTODO("test it.")]
+ public override void Skip ()
+ {
+ if (current.NodeType == XmlNodeType.Attribute)
+ current = ((XmlAttribute) current).OwnerElement.NextSibling;
+ else
+ {
+ if(current.ChildNodes.Count > 0) {
+ current = current.FirstChild;
+ depth++;
+ } else if (current.NextSibling != null) {
+ current = current.NextSibling;
+ } else if (current.NodeType == XmlNodeType.Attribute) {
+ current = current.ParentNode;
+ } else {
+ depth--;
+ }
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeType.cs b/mcs/class/System.XML/System.Xml/XmlNodeType.cs
new file mode 100644
index 00000000000..8ed73dd8db6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeType.cs
@@ -0,0 +1,93 @@
+// XmlNodeType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:46 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum XmlNodeType {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ Element = 1,
+
+ /// <summary>
+ /// </summary>
+ Attribute = 2,
+
+ /// <summary>
+ /// </summary>
+ Text = 3,
+
+ /// <summary>
+ /// </summary>
+ CDATA = 4,
+
+ /// <summary>
+ /// </summary>
+ EntityReference = 5,
+
+ /// <summary>
+ /// </summary>
+ Entity = 6,
+
+ /// <summary>
+ /// </summary>
+ ProcessingInstruction = 7,
+
+ /// <summary>
+ /// </summary>
+ Comment = 8,
+
+ /// <summary>
+ /// </summary>
+ Document = 9,
+
+ /// <summary>
+ /// </summary>
+ DocumentType = 10,
+
+ /// <summary>
+ /// </summary>
+ DocumentFragment = 11,
+
+ /// <summary>
+ /// </summary>
+ Notation = 12,
+
+ /// <summary>
+ /// </summary>
+ Whitespace = 13,
+
+ /// <summary>
+ /// </summary>
+ SignificantWhitespace = 14,
+
+ /// <summary>
+ /// </summary>
+ EndElement = 15,
+
+ /// <summary>
+ /// </summary>
+ EndEntity = 16,
+
+ /// <summary>
+ /// </summary>
+ XmlDeclaration = 17,
+ } // XmlNodeType
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/XmlNotation.cs b/mcs/class/System.XML/System.Xml/XmlNotation.cs
new file mode 100755
index 00000000000..7a8ddbd91c8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNotation.cs
@@ -0,0 +1,100 @@
+//
+// System.Xml.XmlNotation.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+namespace System.Xml
+{
+ public class XmlNotation : XmlNode
+ {
+ #region Fields
+
+ string localName;
+ string publicId;
+ string systemId;
+ string prefix;
+
+ #endregion
+
+ #region Constructor
+
+ internal XmlNotation (string localName, string prefix, string publicId,
+ string systemId, XmlDocument doc)
+ : base (doc)
+ {
+ this.localName = localName;
+ this.prefix = prefix;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string InnerXml {
+ get { return String.Empty; }
+ set { throw new InvalidOperationException ("This operation is not allowed."); }
+ }
+
+ public override bool IsReadOnly {
+ get { return true; } // Notation nodes are always read-only
+ }
+
+ public override string LocalName {
+ get { return localName; }
+ }
+
+ public override string Name {
+ get { return prefix + ":" + localName; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Notation; }
+ }
+
+ public override string OuterXml {
+ get { return String.Empty; }
+ }
+
+ public string PublicId {
+ get {
+ if (publicId != null)
+ return publicId;
+ else
+ return null;
+ }
+ }
+
+ public string SystemId {
+ get {
+ if (systemId != null)
+ return systemId;
+ else
+ return null;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new InvalidOperationException ("This operation is not allowed.");
+ }
+
+ public override void WriteContentTo (XmlWriter w) { } // has no effect.
+
+ public override void WriteTo (XmlWriter w) { } // has no effect.
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlParserContext.cs b/mcs/class/System.XML/System.Xml/XmlParserContext.cs
new file mode 100644
index 00000000000..58c5536a6d1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlParserContext.cs
@@ -0,0 +1,186 @@
+//
+// System.Xml.XmlParserContext
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlParserContext
+ {
+ #region Constructors
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string xmlLang,
+ XmlSpace xmlSpace) :
+
+ this (
+ nt,
+ nsMgr,
+ null,
+ null,
+ null,
+ null,
+ null,
+ xmlLang,
+ xmlSpace,
+ null
+ )
+ {
+ }
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string xmlLang,
+ XmlSpace xmlSpace,
+ Encoding enc) :
+
+ this (
+ nt,
+ nsMgr,
+ null,
+ null,
+ null,
+ null,
+ null,
+ xmlLang,
+ xmlSpace,
+ enc
+ )
+ {
+ }
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string docTypeName,
+ string pubId,
+ string sysId,
+ string internalSubset,
+ string baseURI,
+ string xmlLang,
+ XmlSpace xmlSpace) :
+
+ this (
+ nt,
+ nsMgr,
+ null,
+ null,
+ null,
+ null,
+ null,
+ xmlLang,
+ xmlSpace,
+ null
+ )
+ {
+ }
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string docTypeName,
+ string pubId,
+ string sysId,
+ string internalSubset,
+ string baseURI,
+ string xmlLang,
+ XmlSpace xmlSpace,
+ Encoding enc)
+ {
+ if (nt == null)
+ this.nameTable = nsMgr.NameTable;
+ else
+ this.NameTable = nt;
+
+ this.namespaceManager = nsMgr;
+ this.docTypeName = docTypeName;
+ this.publicID = pubId;
+ this.systemID = sysId;
+ this.internalSubset = internalSubset;
+ this.baseURI = baseURI;
+ this.xmlLang = xmlLang;
+ this.xmlSpace = xmlSpace;
+ this.encoding = enc;
+ }
+
+ #endregion
+
+ #region Fields
+
+ private string baseURI;
+ private string docTypeName;
+ private Encoding encoding;
+ private string internalSubset;
+ private XmlNamespaceManager namespaceManager;
+ private XmlNameTable nameTable;
+ private string publicID;
+ private string systemID;
+ private string xmlLang;
+ private XmlSpace xmlSpace;
+
+ #endregion
+
+ #region Properties
+
+ public string BaseURI {
+ get { return baseURI; }
+ set { baseURI = value; }
+ }
+
+ public string DocTypeName {
+ get { return docTypeName; }
+ set { docTypeName = value; }
+ }
+
+ public Encoding Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ public string InternalSubset {
+ get { return internalSubset; }
+ set { internalSubset = value; }
+ }
+
+ public XmlNamespaceManager NamespaceManager {
+ get { return namespaceManager; }
+ set { namespaceManager = value; }
+ }
+
+ public XmlNameTable NameTable {
+ get { return nameTable; }
+ set { nameTable = value; }
+ }
+
+ public string PublicId {
+ get { return publicID; }
+ set { publicID = value; }
+ }
+
+ public string SystemId {
+ get { return systemID; }
+ set { systemID = value; }
+ }
+
+ public string XmlLang {
+ get { return xmlLang; }
+ set { xmlLang = value; }
+ }
+
+ public XmlSpace XmlSpace {
+ get { return xmlSpace; }
+ set { xmlSpace = value; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs b/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs
new file mode 100644
index 00000000000..089c1896542
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs
@@ -0,0 +1,103 @@
+//
+// System.Xml.XmlProcessingInstruction
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public class XmlProcessingInstruction : XmlLinkedNode
+ {
+ string target;
+ string data;
+
+ #region Constructors
+
+ protected internal XmlProcessingInstruction (string target, string data, XmlDocument doc) : base(doc)
+ {
+ if (data == null)
+ data = String.Empty;
+
+ this.target = target;
+ this.data = data;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public string Data
+ {
+ get { return data; }
+
+ set { data = value; }
+ }
+
+ public override string InnerText
+ {
+ get { return Data; }
+ set { data = value; }
+ }
+
+ public override string LocalName
+ {
+ get { return target; }
+ }
+
+ public override string Name
+ {
+ get { return target; }
+ }
+
+ public override XmlNodeType NodeType
+ {
+ get { return XmlNodeType.ProcessingInstruction; }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.ProcessingInstruction;
+ }
+ }
+
+ public string Target
+ {
+ get { return target; }
+ }
+
+ public override string Value
+ {
+ get { return data; }
+ set {
+ if (this.IsReadOnly)
+ throw new ArgumentException ("This node is read-only.");
+ else
+ data = value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlProcessingInstruction (target, data, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) { }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteProcessingInstruction (target, data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
new file mode 100644
index 00000000000..d2d5f632567
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
@@ -0,0 +1,116 @@
+//
+// System.Xml.XmlQualifiedName.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+// Modified:
+// 21st June 2002 : Ajay kumar Dwivedi (adwiv@yahoo.com)
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlQualifiedName
+ {
+ // Constructors
+ public XmlQualifiedName ()
+ : this (string.Empty, string.Empty)
+ {
+ }
+
+ public XmlQualifiedName (string name)
+ : this (name, string.Empty)
+ {
+ }
+
+ public XmlQualifiedName (string name, string ns)
+ : base ()
+ {
+ this.name = name;
+ this.ns = ns;
+ }
+
+ // Fields
+ public static readonly XmlQualifiedName Empty = new XmlQualifiedName ();
+ private string name;
+ private string ns;
+
+ // Properties
+ public bool IsEmpty
+ {
+ get {
+ if ((name == String.Empty) && (ns == String.Empty))
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string Namespace
+ {
+ get { return ns; }
+ }
+
+ // Methods
+ public override bool Equals (object other)
+ {
+ if(!(other is XmlQualifiedName))
+ return false;
+
+ if ((XmlQualifiedName) this == (XmlQualifiedName) other)
+ return true;
+ else
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return unchecked (name.GetHashCode() + ns.GetHashCode());
+ }
+
+ public override string ToString ()
+ {
+ if (ns == null)
+ return name;
+ else if (ns == string.Empty)
+ return name;
+ else
+ return ns + ":" + name;
+ }
+
+ public static string ToString (string name, string ns)
+ {
+ if (ns == string.Empty)
+ return name;
+ else
+ return ns + ":" + name;
+ }
+
+ // Operators
+ public static bool operator == (XmlQualifiedName a, XmlQualifiedName b)
+ {
+ if((Object)a == null || (Object)b == null)
+ return false;
+
+ if ((a.Name == b.Name) && (a.Namespace == b.Namespace))
+ return true;
+ else
+ return false;
+ }
+
+ public static bool operator != (XmlQualifiedName a, XmlQualifiedName b)
+ {
+ if (a == b)
+ return false;
+ else
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlReader.cs b/mcs/class/System.XML/System.Xml/XmlReader.cs
new file mode 100644
index 00000000000..6e4d243b2f6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlReader.cs
@@ -0,0 +1,374 @@
+//
+// XmlReader.cs
+//
+// Authors:
+// Jason Diamond (jason@injektilo.org)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+namespace System.Xml
+{
+ public abstract class XmlReader
+ {
+ #region Constructor
+
+ protected XmlReader ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract int AttributeCount { get; }
+
+ public abstract string BaseURI { get; }
+
+ public virtual bool CanResolveEntity
+ {
+ get { return false; }
+ }
+
+ public abstract int Depth { get; }
+
+ public abstract bool EOF { get; }
+
+ public virtual bool HasAttributes
+ {
+ get { return AttributeCount > 0; }
+ }
+
+ public abstract bool HasValue { get; }
+
+ public abstract bool IsDefault { get; }
+
+ public abstract bool IsEmptyElement { get; }
+
+ public abstract string this[int i] { get; }
+
+ public abstract string this[string name] { get; }
+
+ public abstract string this[
+ string localName,
+ string namespaceName]
+ { get; }
+
+ public abstract string LocalName { get; }
+
+ public abstract string Name { get; }
+
+ public abstract string NamespaceURI { get; }
+
+ public abstract XmlNameTable NameTable { get; }
+
+ public abstract XmlNodeType NodeType { get; }
+
+ public abstract string Prefix { get; }
+
+ public abstract char QuoteChar { get; }
+
+ public abstract ReadState ReadState { get; }
+
+ public abstract string Value { get; }
+
+ public abstract string XmlLang { get; }
+
+ public abstract XmlSpace XmlSpace { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract void Close ();
+
+ public abstract string GetAttribute (int i);
+
+ public abstract string GetAttribute (string name);
+
+ public abstract string GetAttribute (
+ string localName,
+ string namespaceName);
+
+ public static bool IsName (string s)
+ {
+ bool result = false;
+
+ if (s != null && s.Length > 0) {
+ char[] chars = s.ToCharArray ();
+
+ if (XmlChar.IsFirstNameChar (chars[0])) {
+ int i = 1;
+ int n = chars.Length;
+
+ while (i < n && XmlChar.IsNameChar (chars[i]))
+ ++i;
+
+ result = i == n;
+ }
+ }
+
+ return result;
+ }
+
+ public static bool IsNameToken (string s)
+ {
+ bool result = false;
+
+ if (s != null && s.Length > 0) {
+ char[] chars = s.ToCharArray ();
+
+ int i = 0;
+ int n = chars.Length;
+
+ while (i < n && XmlChar.IsNameChar (chars[i]))
+ ++i;
+
+ result = i == n;
+ }
+
+ return result;
+ }
+
+ public virtual bool IsStartElement ()
+ {
+ return (MoveToContent () == XmlNodeType.Element);
+ }
+
+ public virtual bool IsStartElement (string name)
+ {
+ if (!IsStartElement ())
+ return false;
+
+ return (Name == name);
+ }
+
+ public virtual bool IsStartElement (string localName, string namespaceName)
+ {
+ if (!IsStartElement ())
+ return false;
+
+ return (LocalName == localName && NamespaceURI == namespaceName);
+ }
+
+ public abstract string LookupNamespace (string prefix);
+
+ public abstract void MoveToAttribute (int i);
+
+ public abstract bool MoveToAttribute (string name);
+
+ public abstract bool MoveToAttribute (
+ string localName,
+ string namespaceName);
+
+ private bool IsContent (XmlNodeType nodeType)
+ {
+ /* MS doc says:
+ * (non-white space text, CDATA, Element, EndElement, EntityReference, or EndEntity)
+ */
+ switch (nodeType) {
+ case XmlNodeType.Text:
+ return true;
+ case XmlNodeType.CDATA:
+ return true;
+ case XmlNodeType.Element:
+ return true;
+ case XmlNodeType.EndElement:
+ return true;
+ case XmlNodeType.EntityReference:
+ return true;
+ case XmlNodeType.EndEntity:
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual XmlNodeType MoveToContent ()
+ {
+ do {
+ XmlNodeType nodeType = NodeType;
+ if (IsContent (nodeType))
+ return nodeType;
+ } while (Read ());
+
+ return XmlNodeType.None;
+ }
+
+ public abstract bool MoveToElement ();
+
+ public abstract bool MoveToFirstAttribute ();
+
+ public abstract bool MoveToNextAttribute ();
+
+ public abstract bool Read ();
+
+ public abstract bool ReadAttributeValue ();
+
+ public virtual string ReadElementString ()
+ {
+ if (MoveToContent () != XmlNodeType.Element) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ string result = String.Empty;
+ if (!IsEmptyElement) {
+ Read ();
+ result = ReadString ();
+ if (NodeType != XmlNodeType.EndElement) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+ }
+
+ Read ();
+ return result;
+ }
+
+ public virtual string ReadElementString (string name)
+ {
+ if (MoveToContent () != XmlNodeType.Element) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ if (name != Name) {
+ string error = String.Format ("The {0} tag from namespace {1} is expected.",
+ Name, NamespaceURI);
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ string result = String.Empty;
+ if (!IsEmptyElement) {
+ Read ();
+ result = ReadString ();
+ if (NodeType != XmlNodeType.EndElement) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+ }
+
+ Read ();
+ return result;
+ }
+
+ public virtual string ReadElementString (string localName, string namespaceName)
+ {
+ if (MoveToContent () != XmlNodeType.Element) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ if (localName != LocalName || NamespaceURI != namespaceName) {
+ string error = String.Format ("The {0} tag from namespace {1} is expected.",
+ LocalName, NamespaceURI);
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ string result = String.Empty;
+ if (!IsEmptyElement) {
+ Read ();
+ result = ReadString ();
+ if (NodeType != XmlNodeType.EndElement) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+ }
+
+ Read ();
+ return result;
+ }
+
+ public virtual void ReadEndElement ()
+ {
+ if (MoveToContent () != XmlNodeType.EndElement) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ Read ();
+ }
+
+ public abstract string ReadInnerXml ();
+
+ public abstract string ReadOuterXml ();
+
+ public virtual void ReadStartElement ()
+ {
+ if (MoveToContent () != XmlNodeType.Element) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ Read ();
+ }
+
+ public virtual void ReadStartElement (string name)
+ {
+ if (MoveToContent () != XmlNodeType.Element) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ if (name != Name) {
+ string error = String.Format ("The {0} tag from namespace {1} is expected.",
+ Name, NamespaceURI);
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ Read ();
+ }
+
+ public virtual void ReadStartElement (string localName, string namespaceName)
+ {
+ if (MoveToContent () != XmlNodeType.Element) {
+ string error = String.Format ("'{0}' is an invalid node type.",
+ NodeType.ToString ());
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ if (localName != LocalName || NamespaceURI != namespaceName) {
+ string error = String.Format ("The {0} tag from namespace {1} is expected.",
+ LocalName, NamespaceURI);
+ throw new XmlException (this as IXmlLineInfo, error);
+ }
+
+ Read ();
+ }
+
+ public abstract string ReadString ();
+
+ public abstract void ResolveEntity ();
+
+ public virtual void Skip ()
+ {
+ if (ReadState != ReadState.Interactive)
+ return;
+
+ MoveToElement ();
+ if (NodeType != XmlNodeType.Element || IsEmptyElement) {
+ Read ();
+ return;
+ }
+
+ int depth = Depth;
+ while (Read() && depth < Depth);
+ if (NodeType == XmlNodeType.EndElement)
+ Read ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlResolver.cs b/mcs/class/System.XML/System.Xml/XmlResolver.cs
new file mode 100644
index 00000000000..665dff630e6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlResolver.cs
@@ -0,0 +1,32 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.XmlResolver.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Net;
+
+namespace System.Xml
+{
+ public abstract class XmlResolver
+ {
+ public abstract ICredentials Credentials
+ {
+ set;
+ }
+
+ public abstract object GetEntity(
+ Uri absoluteUri,
+ string role,
+ Type type);
+
+ public abstract Uri ResolveUri(
+ Uri baseUri,
+ string relativeUri);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs
new file mode 100644
index 00000000000..1df1a7f512b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs
@@ -0,0 +1,72 @@
+//
+// System.Xml.XmlSignificantWhitespace.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public class XmlSignificantWhitespace : XmlCharacterData
+ {
+ // Constructor
+ protected internal XmlSignificantWhitespace (string strData, XmlDocument doc)
+ : base (strData, doc)
+ {
+ }
+
+ // Properties
+ public override string LocalName {
+ get { return "#significant-whitespace"; }
+ }
+
+ public override string Name {
+ get { return "#significant-whitespace"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.SignificantWhitespace; }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.SignificantWhitespace;
+ }
+ }
+
+ public override string Value {
+ get { return Data; }
+ set {
+ if (IsValidWhitespaceChar (value) == false)
+ throw new ArgumentException ("Invalid whitespace characters.");
+ base.Data = value;
+ }
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlSignificantWhitespace (Data, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteWhitespace (Data);
+ }
+
+ private bool IsValidWhitespaceChar (string text)
+ {
+ foreach (char c in text)
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ return false;
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlSpace.cs b/mcs/class/System.XML/System.Xml/XmlSpace.cs
new file mode 100644
index 00000000000..f1e1128ff3c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlSpace.cs
@@ -0,0 +1,37 @@
+// XmlSpace.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:52 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// Specifies the current xml:space scope
+ /// </summary>
+ public enum XmlSpace {
+
+ /// <summary>
+ /// No xml:space scope.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// the xml:space scope = "default"
+ /// </summary>
+ Default = 1,
+
+ /// <summary>
+ /// the xml:space scope = "preserve"
+ /// </summary>
+ Preserve = 2,
+ } // XmlSpace
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/XmlText.cs b/mcs/class/System.XML/System.Xml/XmlText.cs
new file mode 100644
index 00000000000..32b0311e184
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlText.cs
@@ -0,0 +1,76 @@
+//
+// System.Xml.XmlText
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public class XmlText : XmlCharacterData
+ {
+ #region Constructor
+
+ protected internal XmlText (string strData, XmlDocument doc) : base(strData, doc)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string LocalName
+ {
+ get { return "#text"; }
+ }
+
+ public override string Name {
+ get { return "#text"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Text; }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get {
+ return XPathNodeType.Text;
+ }
+ }
+
+ public override string Value {
+ get { return Data; }
+ set { Data = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlText SplitText (int offset)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteString (Data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
new file mode 100644
index 00000000000..e61267f3c36
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
@@ -0,0 +1,1741 @@
+//
+// System.Xml.XmlTextReader
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+// Adam Treat (manyoso@yahoo.com)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+// FIXME:
+// This can only parse basic XML: elements, attributes, processing
+// instructions, and comments are OK.
+//
+// It barfs on DOCTYPE declarations.
+// => No barfing, but parsing is incomplete.
+// DTD nodes are not still created.
+//
+// There's also no checking being done for either well-formedness
+// or validity.
+//
+// NameTables aren't being used everywhere yet.
+//
+// Some thought needs to be given to performance. There's too many
+// strings being allocated.
+//
+// Some of the MoveTo methods haven't been implemented yet.
+//
+// LineNumber and LinePosition aren't being tracked.
+//
+// xml:space, xml:lang, and xml:base aren't being tracked.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlTextReader : XmlReader, IXmlLineInfo
+ {
+ WhitespaceHandling whitespaceHandling = WhitespaceHandling.All;
+ #region Constructors
+
+ protected XmlTextReader ()
+ {
+ }
+
+ public XmlTextReader (Stream input)
+ : this (new StreamReader (input))
+ {
+ }
+
+ public XmlTextReader (string url)
+ : this(url, new NameTable ())
+ {
+ }
+
+ public XmlTextReader (TextReader input)
+ : this (input, new NameTable ())
+ {
+ }
+
+ protected XmlTextReader (XmlNameTable nt)
+ : this (String.Empty, null, XmlNodeType.None, null)
+ {
+ }
+
+ public XmlTextReader (Stream input, XmlNameTable nt)
+ : this(new StreamReader (input), nt)
+ {
+ }
+
+ public XmlTextReader (string url, Stream input)
+ : this (url, new StreamReader (input))
+ {
+ }
+
+ public XmlTextReader (string url, TextReader input)
+ : this (url, input, new NameTable ())
+ {
+ }
+
+ [MonoTODO("Non-filename-url must be supported. Waiting for WebClient")]
+ public XmlTextReader (string url, XmlNameTable nt)
+ // : this(url, new StreamReader ((Stream)new XmlUrlResolver ().GetEntity (new Uri (url), null, typeof(Stream))), nt)
+ : this (url, new StreamReader (url), nt)
+ {
+ }
+
+ public XmlTextReader (TextReader input, XmlNameTable nt)
+ : this(String.Empty, input, nt)
+ {
+ }
+
+ public XmlTextReader (Stream xmlFragment, XmlNodeType fragType, XmlParserContext context)
+ : this (String.Empty, new StreamReader (xmlFragment), fragType, context)
+ {
+ }
+
+ public XmlTextReader (string url, Stream input, XmlNameTable nt)
+ : this (url, new StreamReader (input), nt)
+ {
+ }
+
+ public XmlTextReader (string url, TextReader input, XmlNameTable nt)
+ : this (url, input, XmlNodeType.Document, new XmlParserContext (nt, new XmlNamespaceManager (nt), null, XmlSpace.None))
+ {
+ }
+
+ [MonoTODO("TODO as same as private XmlTextReader(TextReader, XmlNodeType, XmlParserContext)")]
+ public XmlTextReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context)
+ : this (String.Empty, new StringReader (xmlFragment), fragType, context)
+ {
+ }
+
+ // TODO still remains as described at head of this file,
+ // but it might not be TODO of the constructors...
+ XmlTextReader (string url, TextReader fragment, XmlNodeType fragType, XmlParserContext context)
+ {
+ this.SetReaderContext(url, context);
+ this.SetReaderFragment(fragment, fragType);
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override int AttributeCount
+ {
+ get { return attributes.Count; }
+ }
+
+ public override string BaseURI
+ {
+ get { return parserContext.BaseURI; }
+ }
+
+ public override int Depth
+ {
+ get {
+ return elementDepth;
+ }
+ }
+
+ public Encoding Encoding
+ {
+ get { return parserContext.Encoding; }
+ }
+
+ public override bool EOF
+ {
+ get
+ {
+ return
+ readState == ReadState.EndOfFile ||
+ readState == ReadState.Closed;
+ }
+ }
+
+ public override bool HasValue
+ {
+ get { return value != String.Empty; }
+ }
+
+ public override bool IsDefault
+ {
+ get
+ {
+ // XmlTextReader does not expand default attributes.
+ return false;
+ }
+ }
+
+ public override bool IsEmptyElement
+ {
+ get { return isEmptyElement; }
+ }
+
+ public override string this [int i]
+ {
+ get { return GetAttribute (i); }
+ }
+
+ public override string this [string name]
+ {
+ get { return GetAttribute (name); }
+ }
+
+ public override string this [string localName, string namespaceName]
+ {
+ get { return GetAttribute (localName, namespaceName); }
+ }
+
+ public int LineNumber
+ {
+ get { return line; }
+ }
+
+ public int LinePosition
+ {
+ get { return column; }
+ }
+
+ public override string LocalName
+ {
+ get { return localName; }
+ }
+
+ public override string Name
+ {
+ get { return name; }
+ }
+
+ [MonoTODO]
+ public bool Namespaces
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public override string NamespaceURI
+ {
+ get { return namespaceURI; }
+ }
+
+ public override XmlNameTable NameTable
+ {
+ get { return parserContext.NameTable; }
+ }
+
+ public override XmlNodeType NodeType
+ {
+ get { return nodeType; }
+ }
+
+ [MonoTODO]
+ public bool Normalization
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public override string Prefix
+ {
+ get { return prefix; }
+ }
+
+ [MonoTODO]
+ public override char QuoteChar
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override ReadState ReadState
+ {
+ get { return readState; }
+ }
+
+ public override string Value
+ {
+ get {
+ if(NodeType == XmlNodeType.Attribute)
+ return ResolveAttributeValue(value);
+ else
+ return value;
+ }
+ }
+
+ public WhitespaceHandling WhitespaceHandling
+ {
+ get { return whitespaceHandling; }
+ set { whitespaceHandling = value; }
+ }
+
+ [MonoTODO]
+ public override string XmlLang
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public XmlResolver XmlResolver
+ {
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override XmlSpace XmlSpace
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override void Close ()
+ {
+ readState = ReadState.Closed;
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (int i)
+ {
+ if (i > attributes.Count)
+ throw new ArgumentOutOfRangeException ("i is smaller than AttributeCount");
+ else
+ return ResolveAttributeValue (attributes [orderedAttributes [i]] as string);
+ }
+
+ public override string GetAttribute (string name)
+ {
+ return attributes.ContainsKey (name) ?
+ ResolveAttributeValue (attributes [name] as string) : String.Empty;
+ }
+
+ public override string GetAttribute (string localName, string namespaceURI)
+ {
+ foreach (DictionaryEntry entry in attributes)
+ {
+ string thisName = entry.Key as string;
+
+ int indexOfColon = thisName.IndexOf (':');
+
+ if (indexOfColon != -1) {
+ string thisLocalName = thisName.Substring (indexOfColon + 1);
+
+ if (localName == thisLocalName) {
+ string thisPrefix = thisName.Substring (0, indexOfColon);
+ string thisNamespaceURI = LookupNamespace (thisPrefix);
+
+ if (namespaceURI == thisNamespaceURI)
+ return attributes.ContainsKey (thisName) ?
+ ResolveAttributeValue (attributes [thisName] as string) : String.Empty;
+ }
+ } else if (localName == "xmlns" && namespaceURI == "http://www.w3.org/2000/xmlns/" && thisName == "xmlns")
+ return attributes.ContainsKey (thisName) ?
+ ResolveAttributeValue (attributes [thisName] as string) : String.Empty;
+ }
+
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ public TextReader GetRemainder ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IXmlLineInfo.HasLineInfo ()
+ {
+ return false;
+ }
+
+ public override string LookupNamespace (string prefix)
+ {
+ return parserContext.NamespaceManager.LookupNamespace (prefix);
+ }
+
+ public override void MoveToAttribute (int i)
+ {
+ MoveToElement ();
+
+ if (attributes == null || orderedAttributes.Count < i || i < 0)
+ throw new ArgumentOutOfRangeException ("attribute index out of range.");
+
+ string name = orderedAttributes [i] as string;
+ string value = attributes [name] as string;
+ SetProperties (
+ XmlNodeType.Attribute, // nodeType
+ name, // name
+ false, // isEmptyElement
+ value, // value
+ false // clearAttributes
+ );
+ }
+
+ public override bool MoveToAttribute (string name)
+ {
+ MoveToElement ();
+ bool match = false;
+
+ if (attributes == null)
+ return false;
+
+ if (orderedAttributesEnumerator == null) {
+ SaveProperties ();
+ orderedAttributesEnumerator = orderedAttributes.GetEnumerator ();
+ }
+
+ while (orderedAttributesEnumerator.MoveNext ()) {
+ if(name == orderedAttributesEnumerator.Current as string) {
+ match = true;
+ break;
+ }
+ }
+
+ if (match) {
+ string value = attributes [name] as string;
+ SetProperties (
+ XmlNodeType.Attribute, // nodeType
+ name, // name
+ false, // isEmptyElement
+ value, // value
+ false // clearAttributes
+ );
+ }
+
+ return match;
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string localName, string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToElement ()
+ {
+ if (orderedAttributesEnumerator != null) {
+ orderedAttributesEnumerator = null;
+ RestoreProperties ();
+ return true;
+ }
+
+ return false;
+ }
+
+ public override bool MoveToFirstAttribute ()
+ {
+ MoveToElement ();
+ return MoveToNextAttribute ();
+ }
+
+ public override bool MoveToNextAttribute ()
+ {
+ if (attributes == null)
+ return false;
+
+ if (orderedAttributesEnumerator == null) {
+ SaveProperties ();
+ orderedAttributesEnumerator = orderedAttributes.GetEnumerator ();
+ }
+
+ if (orderedAttributesEnumerator.MoveNext ()) {
+ string name = orderedAttributesEnumerator.Current as string;
+ string value = attributes [name] as string;
+ SetProperties (
+ XmlNodeType.Attribute, // nodeType
+ name, // name
+ false, // isEmptyElement
+ value, // value
+ false // clearAttributes
+ );
+ return true;
+ }
+
+ return false;
+ }
+
+ public override bool Read ()
+ {
+ bool more = false;
+
+ readState = ReadState.Interactive;
+
+ more = ReadContent ();
+
+ return more;
+ }
+
+ [MonoTODO("This method should consider entity references")]
+ public override bool ReadAttributeValue ()
+ {
+ // reading attribute value phase now stopped
+ if(attributeStringCurrentPosition < 0 ||
+ attributeString.Length < attributeStringCurrentPosition) {
+ attributeStringCurrentPosition = 0;
+ attributeString = String.Empty;
+ return false;
+ }
+
+ // If not started, then initialize attributeString when parsing is at start.
+ if(attributeStringCurrentPosition == 0)
+ attributeString = value;
+
+ bool returnEntity = false;
+ value = String.Empty;
+ int nextPosition = attributeString.IndexOf ('&',
+ attributeStringCurrentPosition);
+
+ // if attribute string starts from '&' then it may be (unparsable) entity reference.
+ if(nextPosition == 0) {
+ string parsed = ReadAttributeValueEntityReference ();
+ if(parsed == null) {
+ // return entity (It is only this case to return entity reference.)
+ int endEntityPosition = attributeString.IndexOf (';',
+ attributeStringCurrentPosition);
+ SetProperties (XmlNodeType.EntityReference,
+ attributeString.Substring (attributeStringCurrentPosition + 1,
+ endEntityPosition - attributeStringCurrentPosition - 1),
+ false,
+ String.Empty,
+ false);
+ attributeStringCurrentPosition = endEntityPosition + 1;
+
+ return true;
+ }
+ else
+ value += parsed;
+ }
+
+ // Other case always set text node.
+ while(!returnEntity) {
+ nextPosition = attributeString.IndexOf ('&', attributeStringCurrentPosition);
+ if(nextPosition < 0) {
+ // Reached to the end of value string.
+ value += attributeString.Substring (attributeStringCurrentPosition);
+ attributeStringCurrentPosition = -1;
+ break;
+ } else if(nextPosition == attributeStringCurrentPosition) {
+ string parsed = ReadAttributeValueEntityReference ();
+ if(parsed != null)
+ value += parsed;
+ else {
+ // Found that an entity reference starts from this point.
+ // Then once stop to parse attribute value and then return text.
+ value += attributeString.Substring (attributeStringCurrentPosition,
+ nextPosition - attributeStringCurrentPosition);
+ break;
+ }
+ } else {
+ value += attributeString.Substring (attributeStringCurrentPosition,
+ nextPosition - attributeStringCurrentPosition);
+ attributeStringCurrentPosition = nextPosition;
+ continue;
+ }
+ }
+
+ SetProperties(XmlNodeType.Text,
+ "#text",
+ false,
+ value,
+ false);
+
+ return true;
+ }
+
+ [MonoTODO]
+ public int ReadBase64 (byte [] buffer, int offset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ReadBinHex (byte [] buffer, int offset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ReadChars (char [] buffer, int offset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ReadInnerXml ()
+ {
+ // Still need a Well Formedness check.
+ // Will wait for Validating reader ;-)
+ if (NodeType == XmlNodeType.Attribute) {
+ return Value;
+ } else {
+ saveToXmlBuffer = true;
+ string startname = this.Name;
+ string endname = string.Empty;
+ readState = ReadState.Interactive;
+
+ while (startname != endname) {
+ ReadContent ();
+ endname = this.Name;
+ }
+
+ xmlBuffer.Replace (currentTag.ToString (), "");
+ saveToXmlBuffer = false;
+ string InnerXml = xmlBuffer.ToString ();
+ xmlBuffer.Length = 0;
+ return InnerXml;
+ }
+ }
+
+ [MonoTODO]
+ public override string ReadOuterXml ()
+ {
+ if (NodeType == XmlNodeType.Attribute) {
+ return Name + "=\"" + Value.Replace ("\"", "&quot;") + "\"";
+ } else {
+ saveToXmlBuffer = true;
+ xmlBuffer.Append (currentTag.ToString ());
+ int startDepth = Depth;
+ readState = ReadState.Interactive;
+
+ do {
+ ReadContent ();
+ } while (Depth > startDepth);
+
+ saveToXmlBuffer = false;
+ string OuterXml = xmlBuffer.ToString ();
+ xmlBuffer.Length = 0;
+ return OuterXml;
+ }
+ }
+
+ [MonoTODO]
+ public override string ReadString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResetState ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void ResolveEntity ()
+ {
+ // XmlTextReaders don't resolve entities.
+ throw new InvalidOperationException ("XmlTextReader cannot resolve external entities.");
+ }
+
+ #endregion
+
+ #region Internals
+ internal string publicId;
+ internal string systemId;
+
+ internal void SetReaderContext (string url, XmlParserContext context)
+ {
+ parserContext = context;
+ parserContext.BaseURI = url;
+ Init ();
+ }
+
+ internal void SetReaderFragment(TextReader fragment, XmlNodeType fragType)
+ {
+ this.reader = fragment;
+ can_seek = fragment != null && fragment.Peek () != -1;
+/* for future use
+ switch(fragType)
+ {
+ case XmlNodeType.Attribute: // attribute content
+ parserContext.InputState = XmlParserInputState.AttributeValue;
+ break;
+ case XmlNodeType.DocumentFragment: // element content
+ parserContext.InputState = XmlParserInputState.Content;
+ break;
+ case XmlNodeType.Element: // one element
+ parserContext.InputState = XmlParserInputState.StartTag;
+ break;
+ case XmlNodeType.Document: // document content
+ parserContext.InputState = XmlParserInputState.Start;
+ break;
+ default:
+ throw new InvalidOperationException("setting this xml node type not allowed.");
+ }
+*/
+ }
+ #endregion
+
+ #region Privates
+
+ private XmlParserContext parserContext;
+
+ private TextReader reader;
+ private ReadState readState;
+
+ private int depth;
+ private int elementDepth;
+ private bool depthDown;
+
+ private bool popScope;
+
+ private XmlNodeType nodeType;
+ private string name;
+ private string prefix;
+ private string localName;
+ private string namespaceURI;
+ private bool isEmptyElement;
+ private string value;
+
+ private XmlNodeType saveNodeType;
+ private string saveName;
+ private string savePrefix;
+ private string saveLocalName;
+ private string saveNamespaceURI;
+ private bool saveIsEmptyElement;
+
+ private Hashtable attributes;
+ private ArrayList orderedAttributes;
+ private IEnumerator orderedAttributesEnumerator;
+
+ private bool returnEntityReference;
+ private string entityReferenceName;
+
+ private char [] nameBuffer;
+ private int nameLength;
+ private int nameCapacity;
+ private const int initialNameCapacity = 256;
+
+ private char [] valueBuffer;
+ private int valueLength;
+ private int valueCapacity;
+ private const int initialValueCapacity = 8192;
+
+ private StringBuilder xmlBuffer; // This is for Read(Inner|Outer)Xml
+ private StringBuilder currentTag; // A buffer for ReadContent for ReadOuterXml
+ private bool saveToXmlBuffer;
+ private int line = 1;
+ private int column = 1;
+ private bool has_peek;
+ private bool can_seek;
+ private int peek_char;
+
+ private string attributeString = String.Empty;
+ private int attributeStringCurrentPosition;
+
+ private void Init ()
+ {
+ readState = ReadState.Initial;
+
+ depth = 0;
+ depthDown = false;
+
+ popScope = false;
+
+ nodeType = XmlNodeType.None;
+ name = String.Empty;
+ prefix = String.Empty;
+ localName = string.Empty;
+ isEmptyElement = false;
+ value = String.Empty;
+
+ attributes = new Hashtable ();
+ orderedAttributes = new ArrayList ();
+ orderedAttributesEnumerator = null;
+
+ returnEntityReference = false;
+ entityReferenceName = String.Empty;
+
+ nameBuffer = new char [initialNameCapacity];
+ nameLength = 0;
+ nameCapacity = initialNameCapacity;
+
+ valueBuffer = new char [initialValueCapacity];
+ valueLength = 0;
+ valueCapacity = initialValueCapacity;
+
+ xmlBuffer = new StringBuilder ();
+ currentTag = new StringBuilder ();
+ }
+
+ // Use this method rather than setting the properties
+ // directly so that all the necessary properties can
+ // be changed in harmony with each other. Maybe the
+ // fields should be in a seperate class to help enforce
+ // this.
+ private void SetProperties (
+ XmlNodeType nodeType,
+ string name,
+ bool isEmptyElement,
+ string value,
+ bool clearAttributes)
+ {
+ this.nodeType = nodeType;
+ this.name = name;
+ this.isEmptyElement = isEmptyElement;
+ this.value = value;
+ this.elementDepth = depth;
+
+ if (clearAttributes)
+ ClearAttributes ();
+
+ int indexOfColon = name.IndexOf (':');
+
+ if (indexOfColon == -1) {
+ prefix = String.Empty;
+ localName = name;
+ } else {
+ prefix = name.Substring (0, indexOfColon);
+ localName = name.Substring (indexOfColon + 1);
+ }
+
+ namespaceURI = LookupNamespace (prefix);
+ }
+
+ private void SaveProperties ()
+ {
+ saveNodeType = nodeType;
+ saveName = name;
+ savePrefix = prefix;
+ saveLocalName = localName;
+ saveNamespaceURI = namespaceURI;
+ saveIsEmptyElement = isEmptyElement;
+ // An element's value is always String.Empty.
+ }
+
+ private void RestoreProperties ()
+ {
+ nodeType = saveNodeType;
+ name = saveName;
+ prefix = savePrefix;
+ localName = saveLocalName;
+ namespaceURI = saveNamespaceURI;
+ isEmptyElement = saveIsEmptyElement;
+ value = String.Empty;
+ }
+
+ private void AddAttribute (string name, string value)
+ {
+ attributes.Add (name, value);
+ orderedAttributes.Add (name);
+ }
+
+ private void ClearAttributes ()
+ {
+ if (attributes.Count > 0) {
+ attributes.Clear ();
+ orderedAttributes.Clear ();
+ }
+
+ orderedAttributesEnumerator = null;
+ }
+
+ private int PeekChar ()
+ {
+ if (can_seek)
+ return reader.Peek ();
+
+ if (has_peek)
+ return peek_char;
+
+ peek_char = reader.Read ();
+ has_peek = true;
+ return peek_char;
+ }
+
+ private int ReadChar ()
+ {
+ int ch;
+ if (has_peek) {
+ ch = peek_char;
+ has_peek = false;
+ } else {
+ ch = reader.Read ();
+ }
+
+ if (ch == '\n') {
+ line++;
+ column = 1;
+ } else {
+ column++;
+ }
+ if (saveToXmlBuffer) {
+ xmlBuffer.Append ((char) ch);
+ }
+ currentTag.Append ((char) ch);
+ return ch;
+ }
+
+ // This should really keep track of some state so
+ // that it's not possible to have more than one document
+ // element or text outside of the document element.
+ private bool ReadContent ()
+ {
+ currentTag.Length = 0;
+ if (popScope) {
+ parserContext.NamespaceManager.PopScope ();
+ popScope = false;
+ }
+
+ if (returnEntityReference) {
+ SetEntityReferenceProperties ();
+ } else {
+ switch (PeekChar ())
+ {
+ case '<':
+ ReadChar ();
+ ReadTag ();
+ break;
+ case '\r':
+ if (whitespaceHandling == WhitespaceHandling.All ||
+ whitespaceHandling == WhitespaceHandling.Significant)
+ return ReadWhitespace ();
+
+ ReadChar ();
+ return ReadContent ();
+ case '\n':
+ if (whitespaceHandling == WhitespaceHandling.All ||
+ whitespaceHandling == WhitespaceHandling.Significant)
+ return ReadWhitespace ();
+
+ ReadChar ();
+ return ReadContent ();
+ case ' ':
+ if (whitespaceHandling == WhitespaceHandling.All ||
+ whitespaceHandling == WhitespaceHandling.Significant)
+ return ReadWhitespace ();
+
+ SkipWhitespace ();
+ return ReadContent ();
+ case -1:
+ readState = ReadState.EndOfFile;
+ SetProperties (
+ XmlNodeType.None, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ String.Empty, // value
+ true // clearAttributes
+ );
+ break;
+ default:
+ ReadText (true);
+ break;
+ }
+ }
+ return this.ReadState != ReadState.EndOfFile;
+ }
+
+ private void SetEntityReferenceProperties ()
+ {
+ SetProperties (
+ XmlNodeType.EntityReference, // nodeType
+ entityReferenceName, // name
+ false, // isEmptyElement
+ String.Empty, // value
+ true // clearAttributes
+ );
+
+ returnEntityReference = false;
+ entityReferenceName = String.Empty;
+ }
+
+ // The leading '<' has already been consumed.
+ private void ReadTag ()
+ {
+ switch (PeekChar ())
+ {
+ case '/':
+ ReadChar ();
+ ReadEndTag ();
+ break;
+ case '?':
+ ReadChar ();
+ ReadProcessingInstruction ();
+ break;
+ case '!':
+ ReadChar ();
+ ReadDeclaration ();
+ break;
+ default:
+ ReadStartTag ();
+ break;
+ }
+ }
+
+ // The leading '<' has already been consumed.
+ private void ReadStartTag ()
+ {
+ parserContext.NamespaceManager.PushScope ();
+
+ string name = ReadName ();
+ SkipWhitespace ();
+
+ bool isEmptyElement = false;
+
+ ClearAttributes ();
+
+ if (XmlChar.IsFirstNameChar (PeekChar ()))
+ ReadAttributes ();
+
+ if (PeekChar () == '/') {
+ ReadChar ();
+ isEmptyElement = true;
+ depthDown = true;
+ popScope = true;
+ }
+
+ Expect ('>');
+
+ SetProperties (
+ XmlNodeType.Element, // nodeType
+ name, // name
+ isEmptyElement, // isEmptyElement
+ String.Empty, // value
+ false // clearAttributes
+ );
+
+ if (!depthDown)
+ ++depth;
+ else
+ depthDown = false;
+
+ }
+
+ // The reader is positioned on the first character
+ // of the element's name.
+ private void ReadEndTag ()
+ {
+ string name = ReadName ();
+ SkipWhitespace ();
+ Expect ('>');
+
+ --depth;
+
+ SetProperties (
+ XmlNodeType.EndElement, // nodeType
+ name, // name
+ false, // isEmptyElement
+ String.Empty, // value
+ true // clearAttributes
+ );
+
+ popScope = true;
+ }
+
+ private void AppendNameChar (int ch)
+ {
+ CheckNameCapacity ();
+ nameBuffer [nameLength++] = (char)ch;
+ }
+
+ private void CheckNameCapacity ()
+ {
+ if (nameLength == nameCapacity) {
+ nameCapacity = nameCapacity * 2;
+ char [] oldNameBuffer = nameBuffer;
+ nameBuffer = new char [nameCapacity];
+ Array.Copy (oldNameBuffer, nameBuffer, nameLength);
+ }
+ }
+
+ private string CreateNameString ()
+ {
+ return new String (nameBuffer, 0, nameLength);
+ }
+
+ private void AppendValueChar (int ch)
+ {
+ CheckValueCapacity ();
+ valueBuffer [valueLength++] = (char)ch;
+ }
+
+ private void CheckValueCapacity ()
+ {
+ if (valueLength == valueCapacity) {
+ valueCapacity = valueCapacity * 2;
+ char [] oldValueBuffer = valueBuffer;
+ valueBuffer = new char [valueCapacity];
+ Array.Copy (oldValueBuffer, valueBuffer, valueLength);
+ }
+ }
+
+ private string CreateValueString ()
+ {
+ return new String (valueBuffer, 0, valueLength);
+ }
+
+ // The reader is positioned on the first character
+ // of the text.
+ private void ReadText (bool cleanValue)
+ {
+ if (cleanValue)
+ valueLength = 0;
+
+ int ch = PeekChar ();
+
+ while (ch != '<' && ch != -1) {
+ if (ch == '&') {
+ ReadChar ();
+ if (ReadReference (false))
+ break;
+ } else
+ AppendValueChar (ReadChar ());
+
+ ch = PeekChar ();
+ }
+
+ if (returnEntityReference && valueLength == 0) {
+ SetEntityReferenceProperties ();
+ } else {
+ SetProperties (
+ XmlNodeType.Text, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+ }
+
+ // The leading '&' has already been consumed.
+ // Returns true if the entity reference isn't a simple
+ // character reference or one of the predefined entities.
+ // This allows the ReadText method to break so that the
+ // next call to Read will return the EntityReference node.
+ private bool ReadReference (bool ignoreEntityReferences)
+ {
+ if (PeekChar () == '#') {
+ ReadChar ();
+ ReadCharacterReference ();
+ } else
+ ReadEntityReference (ignoreEntityReferences);
+
+ return returnEntityReference;
+ }
+
+ private void ReadCharacterReference ()
+ {
+ int value = 0;
+
+ if (PeekChar () == 'x') {
+ ReadChar ();
+
+ while (PeekChar () != ';' && PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch >= '0' && ch <= '9')
+ value = (value << 4) + ch - '0';
+ else if (ch >= 'A' && ch <= 'F')
+ value = (value << 4) + ch - 'A' + 10;
+ else if (ch >= 'a' && ch <= 'f')
+ value = (value << 4) + ch - 'a' + 10;
+ else
+ throw new XmlException (
+ String.Format (
+ "invalid hexadecimal digit: {0} (#x{1:X})",
+ (char)ch,
+ ch));
+ }
+ } else {
+ while (PeekChar () != ';' && PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch >= '0' && ch <= '9')
+ value = value * 10 + ch - '0';
+ else
+ throw new XmlException (
+ String.Format (
+ "invalid decimal digit: {0} (#x{1:X})",
+ (char)ch,
+ ch));
+ }
+ }
+
+ ReadChar (); // ';'
+
+ AppendValueChar (value);
+ }
+
+ private void ReadEntityReference (bool ignoreEntityReferences)
+ {
+ nameLength = 0;
+
+ int ch = PeekChar ();
+
+ while (ch != ';' && ch != -1) {
+ AppendNameChar (ReadChar ());
+ ch = PeekChar ();
+ }
+
+ Expect (';');
+
+ string name = CreateNameString ();
+
+ switch (name)
+ {
+ case "lt":
+ AppendValueChar ('<');
+ break;
+ case "gt":
+ AppendValueChar ('>');
+ break;
+ case "amp":
+ AppendValueChar ('&');
+ break;
+ case "apos":
+ AppendValueChar ('\'');
+ break;
+ case "quot":
+ AppendValueChar ('"');
+ break;
+ default:
+ if (ignoreEntityReferences) {
+ AppendValueChar ('&');
+
+ foreach (char ch2 in name) {
+ AppendValueChar (ch2);
+ }
+
+ AppendValueChar (';');
+ } else {
+ returnEntityReference = true;
+ entityReferenceName = name;
+ }
+ break;
+ }
+ }
+
+ // The reader is positioned on the first character of
+ // the attribute name.
+ private void ReadAttributes ()
+ {
+ do {
+ string name = ReadName ();
+ SkipWhitespace ();
+ Expect ('=');
+ SkipWhitespace ();
+ string value = ReadAttribute ();
+ SkipWhitespace ();
+
+ if (name == "xmlns")
+ parserContext.NamespaceManager.AddNamespace (String.Empty, value);
+ else if (name.StartsWith ("xmlns:"))
+ parserContext.NamespaceManager.AddNamespace (name.Substring (6), value);
+
+ AddAttribute (name, value);
+ } while (PeekChar () != '/' && PeekChar () != '>' && PeekChar () != -1);
+ }
+
+ // The reader is positioned on the quote character.
+ private string ReadAttribute ()
+ {
+ int quoteChar = ReadChar ();
+
+ if (quoteChar != '\'' && quoteChar != '\"')
+ throw new XmlException ("an attribute value was not quoted");
+
+ valueLength = 0;
+
+ while (PeekChar () != quoteChar) {
+ int ch = ReadChar ();
+
+ switch (ch)
+ {
+ case '<':
+ throw new XmlException ("attribute values cannot contain '<'");
+// expansion of entity now should be done at ResolveAttributeValue() method
+// case '&':
+// ReadReference (true);
+// break;
+ case -1:
+ throw new XmlException ("unexpected end of file in an attribute value");
+ default:
+ AppendValueChar (ch);
+ break;
+ }
+ }
+
+ ReadChar (); // quoteChar
+
+ return CreateValueString ();
+ }
+
+ // The reader is positioned on the first character
+ // of the target.
+ //
+ // Now it also reads XmlDeclaration, this method name became improper...
+ private void ReadProcessingInstruction ()
+ {
+ string target = ReadName ();
+ SkipWhitespace ();
+
+ valueLength = 0;
+
+ while (PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch == '?' && PeekChar () == '>') {
+ ReadChar ();
+ break;
+ }
+
+ AppendValueChar ((char)ch);
+ }
+
+/* for future use
+ if(target == "xml") && parserContext.InputState != XmlParserInputState.Start)
+ throw new XmlException("Xml declaration is not allowed here.");
+ else {
+ parserContext.InputState = XmlParserInputState.DTD; //for future use
+ }
+*/
+ SetProperties (
+ target == "xml" ?
+ XmlNodeType.XmlDeclaration :
+ XmlNodeType.ProcessingInstruction, // nodeType
+ target, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<!'.
+ private void ReadDeclaration ()
+ {
+ int ch = PeekChar ();
+
+ switch (ch)
+ {
+ case '-':
+ Expect ("--");
+ ReadComment ();
+ break;
+ case '[':
+ ReadChar ();
+ Expect ("CDATA[");
+ ReadCDATA ();
+ break;
+ case 'D':
+ Expect ("DOCTYPE");
+ ReadDoctypeDecl ();
+ break;
+ }
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<!--'.
+ private void ReadComment ()
+ {
+ valueLength = 0;
+
+ while (PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch == '-' && PeekChar () == '-') {
+ ReadChar ();
+
+ if (PeekChar () != '>')
+ throw new XmlException ("comments cannot contain '--'");
+
+ ReadChar ();
+ break;
+ }
+
+ AppendValueChar ((char)ch);
+ }
+
+ SetProperties (
+ XmlNodeType.Comment, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<![CDATA['.
+ private void ReadCDATA ()
+ {
+ valueLength = 0;
+
+ while (PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch == ']' && PeekChar () == ']') {
+ ch = ReadChar (); // ']'
+
+ if (PeekChar () == '>') {
+ ReadChar (); // '>'
+ break;
+ } else {
+ AppendValueChar (']');
+ AppendValueChar (']');
+ ch = ReadChar ();
+ }
+ }
+
+ AppendValueChar ((char)ch);
+ }
+
+ SetProperties (
+ XmlNodeType.CDATA, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<!DOCTYPE'.
+ private void ReadDoctypeDecl ()
+ {
+ string doctypeName = null;
+ string publicId = String.Empty;
+ string systemId = String.Empty;
+
+ SkipWhitespace ();
+ doctypeName = ReadName ();
+ SkipWhitespace ();
+ xmlBuffer.Length = 0;
+ switch(PeekChar ())
+ {
+ case 'S':
+ systemId = ReadSystemLiteral (true);
+ break;
+ case 'P':
+ publicId = ReadPubidLiteral ();
+ SkipWhitespace ();
+ systemId = ReadSystemLiteral (false);
+ break;
+ }
+ SkipWhitespace ();
+
+
+ if(PeekChar () == '[')
+ {
+ // read markupdecl etc. or end of decl
+ ReadChar ();
+ xmlBuffer.Length = 0;
+ saveToXmlBuffer = true;
+ do {
+ ReadDTDInternalSubset ();
+ } while(nodeType != XmlNodeType.None);
+ xmlBuffer.Remove (xmlBuffer.Length - 1, 1); // cut off ']'
+ saveToXmlBuffer = false;
+ }
+ // end of DOCTYPE decl.
+ SkipWhitespace ();
+ Expect ('>');
+
+ parserContext.InternalSubset = xmlBuffer.ToString ();
+
+ // set properties for <!DOCTYPE> node
+ SetProperties (
+ XmlNodeType.DocumentType, // nodeType
+ doctypeName, // name
+ false, // isEmptyElement
+ parserContext.InternalSubset, // value
+ true // clearAttributes
+ );
+ }
+
+ // Read any one of following:
+ // elementdecl, AttlistDecl, EntityDecl, NotationDecl,
+ // PI, Comment, Parameter Entity, or doctype termination char(']')
+ //
+ // returns a node of some nodeType or null, setting nodeType.
+ // (if None then ']' was found.)
+ private void ReadDTDInternalSubset()
+ {
+ SkipWhitespace ();
+ switch(ReadChar ())
+ {
+ case ']':
+ nodeType = XmlNodeType.None;
+ break;
+ case '%':
+ string peName = ReadName ();
+ Expect (';');
+ nodeType = XmlNodeType.EntityReference; // It's chating a bit;-)
+ break;
+ case '<':
+ switch(ReadChar ())
+ {
+ case '?':
+ ReadProcessingInstruction ();
+ break;
+ case '!':
+ switch(ReadChar ())
+ {
+ case '-':
+ Expect ('-');
+ ReadComment ();
+ break;
+ case 'E':
+ switch(ReadChar ())
+ {
+ case 'N':
+ Expect ("TITY");
+ ReadEntityDecl ();
+ break;
+ case 'L':
+ Expect ("EMENT");
+ ReadElementDecl ();
+ break;
+ default:
+ throw new XmlException ("Syntax Error after '<!E' (ELEMENT or ENTITY must be found)");
+ }
+ break;
+ case 'A':
+ Expect ("TTLIST");
+ ReadAttListDecl ();
+ break;
+ case 'N':
+ Expect ("OTATION");
+ ReadNotationDecl ();
+ break;
+ default:
+ throw new XmlException ("Syntax Error after '<!' characters.");
+ }
+ break;
+ default:
+ throw new XmlException ("Syntax Error after '<' character.");
+ }
+ break;
+ default:
+ throw new XmlException ("Syntax Error inside doctypedecl markup.");
+ }
+ }
+
+ // The reader is positioned on the head of the name.
+ private void ReadElementDecl()
+ {
+ while(ReadChar () != '>');
+ }
+
+ private void ReadEntityDecl()
+ {
+ while(ReadChar () != '>');
+ }
+
+ private void ReadAttListDecl()
+ {
+ while(ReadChar () != '>');
+ }
+
+ private void ReadNotationDecl()
+ {
+ while(ReadChar () != '>');
+ }
+
+ // The reader is positioned on the first 'S' of "SYSTEM".
+ private string ReadSystemLiteral (bool expectSYSTEM)
+ {
+ if(expectSYSTEM)
+ Expect ("SYSTEM");
+ SkipWhitespace ();
+ int quoteChar = ReadChar (); // apos or quot
+ xmlBuffer.Length = 0;
+ saveToXmlBuffer = true;
+ int c = 0;
+ while(c != quoteChar) {
+ c = ReadChar ();
+ if(c < 0) throw new XmlException ("Unexpected end of stream in ExternalID.");
+ }
+ saveToXmlBuffer = false;
+ xmlBuffer.Remove (xmlBuffer.Length-1, 1); // cut quoteChar
+ return xmlBuffer.ToString ();
+ }
+
+ private string ReadPubidLiteral()
+ {
+ Expect ("PUBLIC");
+ SkipWhitespace ();
+ int quoteChar = ReadChar ();
+ xmlBuffer.Length = 0;
+ saveToXmlBuffer = true;
+ int c = 0;
+ while(c != quoteChar)
+ {
+ c = ReadChar ();
+ if(c < 0) throw new XmlException ("Unexpected end of stream in ExternalID.");
+ if(c != quoteChar && !XmlChar.IsPubidChar (c))
+ throw new XmlException("character '" + (char)c + "' not allowed for PUBLIC ID");
+ }
+ ReadChar(); // skips quoteChar
+ xmlBuffer.Remove (xmlBuffer.Length-1, 1); // cut quoteChar
+ saveToXmlBuffer = false;
+ return xmlBuffer.ToString ();
+ }
+
+ // The reader is positioned on the first character
+ // of the name.
+ private string ReadName ()
+ {
+ if (!XmlChar.IsFirstNameChar (PeekChar ()))
+ throw new XmlException ("a name did not start with a legal character");
+
+ nameLength = 0;
+
+ AppendNameChar (ReadChar ());
+
+ while (XmlChar.IsNameChar (PeekChar ())) {
+ AppendNameChar (ReadChar ());
+ }
+
+ return CreateNameString ();
+ }
+
+ // Read the next character and compare it against the
+ // specified character.
+ private void Expect (int expected)
+ {
+ int ch = ReadChar ();
+
+ if (ch != expected) {
+ throw new XmlException (
+ String.Format (
+ "expected '{0}' ({1:X}) but found '{2}' ({3:X})",
+ (char)expected,
+ expected,
+ (char)ch,
+ ch));
+ }
+ }
+
+ private void Expect (string expected)
+ {
+ int len = expected.Length;
+ for(int i=0; i< len; i++)
+ Expect (expected[i]);
+ }
+
+ // Does not consume the first non-whitespace character.
+ private void SkipWhitespace ()
+ {
+ //FIXME: Should not skip if whitespaceHandling == WhiteSpaceHandling.None
+ while (XmlChar.IsWhitespace (PeekChar ()))
+ ReadChar ();
+ }
+
+ private bool ReadWhitespace ()
+ {
+ valueLength = 0;
+ int ch = PeekChar ();
+ do {
+ AppendValueChar (ReadChar ());
+ } while ((ch = PeekChar ()) != -1 && XmlChar.IsWhitespace (ch));
+
+ if (ch != -1 && ch != '<')
+ ReadText (false);
+ else
+ SetProperties (XmlNodeType.Whitespace,
+ String.Empty,
+ false,
+ CreateValueString (),
+ true);
+
+ return (PeekChar () != -1);
+ }
+
+ // read entity reference from attribute string and if parsable then return the value.
+ private string ReadAttributeValueEntityReference ()
+ {
+ int endEntityPosition = attributeString.IndexOf(';',
+ attributeStringCurrentPosition);
+ string entityName = attributeString.Substring (attributeStringCurrentPosition + 1,
+ endEntityPosition - attributeStringCurrentPosition - 1);
+
+ attributeStringCurrentPosition = endEntityPosition + 1;
+
+ if(entityName [0] == '#') {
+ char c;
+ // character entity
+ if(entityName [1] == 'x') {
+ // hexadecimal
+ c = (char) int.Parse ("0" + entityName.Substring (2),
+ System.Globalization.NumberStyles.HexNumber);
+ } else {
+ // decimal
+ c = (char) int.Parse (entityName.Substring (1));
+ }
+ return c.ToString();
+ }
+ else {
+ switch(entityName)
+ {
+ case "lt": return "<";
+ case "gt": return ">";
+ case "amp": return "&";
+ case "quot": return "\"";
+ case "apos": return "'";
+ default: return null;
+ }
+ }
+ }
+
+ private string ResolveAttributeValue (string unresolved)
+ {
+ if(unresolved == null) return null;
+ StringBuilder resolved = new StringBuilder();
+ int pos = 0;
+
+ int next = unresolved.IndexOf ('&');
+ if(next < 0)
+ return unresolved;
+
+ while(next >= 0) {
+ if(pos < next)
+ resolved.Append (unresolved.Substring (pos, next - pos));// - 1);
+ int endPos = unresolved.IndexOf (';', next+1);
+ string entityName =
+ unresolved.Substring (next + 1, endPos - next - 1);
+ if(entityName [0] == '#') {
+ char c;
+ // character entity
+ if(entityName [1] == 'x') {
+ // hexadecimal
+ c = (char) int.Parse ("0" + entityName.Substring (2),
+ System.Globalization.NumberStyles.HexNumber);
+ } else {
+ // decimal
+ c = (char) int.Parse (entityName.Substring (1));
+ }
+ resolved.Append (c);
+ } else {
+ switch(entityName) {
+ case "lt": resolved.Append ("<"); break;
+ case "gt": resolved.Append (">"); break;
+ case "amp": resolved.Append ("&"); break;
+ case "quot": resolved.Append ("\""); break;
+ case "apos": resolved.Append ("'"); break;
+ // With respect to "Value", MS document is helpless
+ // and the implemention returns inconsistent value
+ // (e.g. XML: "&ent; &amp;ent;" ---> Value: "&ent; &ent;".)
+ default: resolved.Append ("&" + entityName + ";"); break;
+ }
+ }
+ pos = endPos + 1;
+ if(pos > unresolved.Length)
+ break;
+ next = unresolved.IndexOf('&', pos);
+ }
+ resolved.Append (unresolved.Substring(pos));
+
+ return resolved.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
new file mode 100644
index 00000000000..a11457b5b85
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
@@ -0,0 +1,700 @@
+//
+// System.Xml.XmlTextWriter
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlTextWriter : XmlWriter
+ {
+ #region Fields
+
+ TextWriter w;
+ bool nullEncoding = false;
+ bool openWriter = true;
+ bool openStartElement = false;
+ bool openStartAttribute = false;
+ bool documentStarted = false;
+ bool namespaces = true;
+ bool openAttribute = false;
+ bool attributeWrittenForElement = false;
+ Stack openElements = new Stack ();
+ Formatting formatting = Formatting.None;
+ int indentation = 2;
+ char indentChar = ' ';
+ string indentChars = " ";
+ char quoteChar = '\"';
+ int indentLevel = 0;
+ string indentFormatting;
+ Stream baseStream = null;
+ string xmlLang = null;
+ XmlSpace xmlSpace = XmlSpace.None;
+ bool openXmlLang = false;
+ bool openXmlSpace = false;
+ string openElementPrefix;
+ string openElementNS;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlTextWriter (TextWriter w) : base ()
+ {
+ this.w = w;
+ nullEncoding = (w.Encoding == null);
+
+ try {
+ baseStream = ((StreamWriter)w).BaseStream;
+ }
+ catch (Exception) { }
+ }
+
+ public XmlTextWriter (Stream w, Encoding encoding) : base ()
+ {
+ if (encoding == null) {
+ nullEncoding = true;
+ encoding = new UTF8Encoding ();
+ }
+
+ this.w = new StreamWriter(w, encoding);
+ baseStream = w;
+ }
+
+ public XmlTextWriter (string filename, Encoding encoding) :
+ this (new FileStream (filename, FileMode.Create, FileAccess.Write, FileShare.None), encoding)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public Stream BaseStream {
+ get { return baseStream; }
+ }
+
+
+ public Formatting Formatting {
+ get { return formatting; }
+ set { formatting = value; }
+ }
+
+ private bool IndentingOverriden
+ {
+ get {
+ if (openElements.Count == 0)
+ return false;
+ else
+ return (((XmlTextWriterOpenElement)openElements.Peek()).IndentingOverriden);
+ }
+ set {
+ if (openElements.Count > 0)
+ ((XmlTextWriterOpenElement)openElements.Peek()).IndentingOverriden = value;
+ }
+ }
+
+ public int Indentation {
+ get { return indentation; }
+ set {
+ indentation = value;
+ UpdateIndentChars ();
+ }
+ }
+
+ public char IndentChar {
+ get { return indentChar; }
+ set {
+ indentChar = value;
+ UpdateIndentChars ();
+ }
+ }
+
+ public bool Namespaces {
+ get { return namespaces; }
+ set {
+ if (ws != WriteState.Start)
+ throw new InvalidOperationException ("NotInWriteState.");
+
+ namespaces = value;
+ }
+ }
+
+ public char QuoteChar {
+ get { return quoteChar; }
+ set {
+ if ((value != '\'') && (value != '\"'))
+ throw new ArgumentException ("This is an invalid XML attribute quote character. Valid attribute quote characters are ' and \".");
+
+ quoteChar = value;
+ }
+ }
+
+ public override WriteState WriteState {
+ get { return ws; }
+ }
+
+ public override string XmlLang {
+ get {
+ string xmlLang = null;
+ int i;
+
+ for (i = 0; i < openElements.Count; i++)
+ {
+ xmlLang = ((XmlTextWriterOpenElement)openElements.ToArray().GetValue(i)).XmlLang;
+ if (xmlLang != null)
+ break;
+ }
+
+ return xmlLang;
+ }
+ }
+
+ public override XmlSpace XmlSpace {
+ get {
+ XmlSpace xmlSpace = XmlSpace.None;
+ int i;
+
+ for (i = 0; i < openElements.Count; i++)
+ {
+ xmlSpace = ((XmlTextWriterOpenElement)openElements.ToArray().GetValue(i)).XmlSpace;
+ if (xmlSpace != XmlSpace.None)
+ break;
+ }
+
+ return xmlSpace;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+ private void AddMissingElementXmlns ()
+ {
+ // output namespace declaration if not exist.
+ string prefix = openElementPrefix;
+ string ns = openElementNS;
+ if (ns != null/* && LookupPrefix (ns) != prefix*/)
+ {
+ string formatXmlns = String.Empty;
+ if (ns != String.Empty)
+ {
+ string existingPrefix = namespaceManager.LookupPrefix (ns);
+ bool addDefaultNamespace = false;
+
+ if (existingPrefix == null)
+ {
+ namespaceManager.AddNamespace (prefix, ns);
+ addDefaultNamespace = true;
+ }
+
+ if (prefix == String.Empty)
+ prefix = existingPrefix;
+
+ if (prefix != existingPrefix)
+ formatXmlns = String.Format (" xmlns:{0}={1}{2}{1}", prefix, quoteChar, ns);
+ else if (addDefaultNamespace)
+ formatXmlns = String.Format (" xmlns={0}{1}{0}", quoteChar, ns);
+ }
+ else if ((prefix == String.Empty) && (namespaceManager.LookupNamespace (prefix) != String.Empty))
+ {
+ namespaceManager.AddNamespace (prefix, ns);
+ formatXmlns = String.Format (" xmlns={0}{0}", quoteChar);
+ }
+ if(formatXmlns != String.Empty)
+ w.Write(formatXmlns);
+ openElementPrefix = null;
+ openElementNS = null;
+ }
+ }
+
+ private void CheckState ()
+ {
+ if (!openWriter) {
+ throw new InvalidOperationException ("The Writer is closed.");
+ }
+ if ((documentStarted == true) && (formatting == Formatting.Indented) && (!IndentingOverriden)) {
+ indentFormatting = w.NewLine;
+ if (indentLevel > 0) {
+ for (int i = 0; i < indentLevel; i++)
+ indentFormatting += indentChars;
+ }
+ }
+ else
+ indentFormatting = "";
+
+ documentStarted = true;
+ }
+
+ public override void Close ()
+ {
+ CloseOpenAttributeAndElements ();
+
+ w.Close();
+ ws = WriteState.Closed;
+ openWriter = false;
+ }
+
+ private void CloseOpenAttributeAndElements ()
+ {
+ if (openAttribute)
+ WriteEndAttribute ();
+
+ while (openElements.Count > 0) {
+ WriteEndElement();
+ }
+ }
+
+ private void CloseStartElement ()
+ {
+ if (!openStartElement)
+ return;
+
+ AddMissingElementXmlns ();
+
+ w.Write (">");
+ ws = WriteState.Content;
+ openStartElement = false;
+ attributeWrittenForElement = false;
+ }
+
+ public override void Flush ()
+ {
+ w.Flush ();
+ }
+
+ public override string LookupPrefix (string ns)
+ {
+ string prefix = namespaceManager.LookupPrefix (ns);
+
+ // XmlNamespaceManager has changed to return null when NSURI not found.
+ // (Contradiction to the documentation.)
+ //if (prefix == String.Empty)
+ // prefix = null;
+ return prefix;
+ }
+
+ private void UpdateIndentChars ()
+ {
+ indentChars = "";
+ for (int i = 0; i < indentation; i++)
+ indentChars += indentChar;
+ }
+
+ public override void WriteBase64 (byte[] buffer, int index, int count)
+ {
+ w.Write (Convert.ToBase64String (buffer, index, count));
+ }
+
+ [MonoTODO]
+ public override void WriteBinHex (byte[] buffer, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteCData (string text)
+ {
+ if (text.IndexOf("]]>") > 0)
+ throw new ArgumentException ();
+
+ CheckState ();
+ CloseStartElement ();
+
+ w.Write("<![CDATA[{0}]]>", text);
+ }
+
+ public override void WriteCharEntity (char ch)
+ {
+ Int16 intCh = (Int16)ch;
+
+ // Make sure the character is not in the surrogate pair
+ // character range, 0xd800- 0xdfff
+ if ((intCh >= -10240) && (intCh <= -8193))
+ throw new ArgumentException ("Surrogate Pair is invalid.");
+
+ w.Write("&#x{0:X};", intCh);
+ }
+
+ [MonoTODO]
+ public override void WriteChars (char[] buffer, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteComment (string text)
+ {
+ if ((text.EndsWith("-")) || (text.IndexOf("-->") > 0)) {
+ throw new ArgumentException ();
+ }
+
+ CheckState ();
+ CloseStartElement ();
+
+ w.Write ("<!--{0}-->", text);
+ }
+
+ public override void WriteDocType (string name, string pubid, string sysid, string subset)
+ {
+ if (name == null || name.Trim ().Length == 0)
+ throw new ArgumentException ("Invalid DOCTYPE name", "name");
+
+ w.Write ("<!DOCTYPE ");
+ w.Write (name);
+ if (pubid != null) {
+ w.Write (String.Format (" PUBLIC {0}{1}{0} {0}{2}{0}", quoteChar, pubid, sysid));
+ } else if (sysid != null) {
+ w.Write (String.Format (" SYSTEM {0}{1}{0}", quoteChar, sysid));
+ }
+
+ if (subset != null)
+ w.Write ("[" + subset + "]");
+
+ w.Write('>');
+ }
+
+ public override void WriteEndAttribute ()
+ {
+ if (!openAttribute)
+ throw new InvalidOperationException("Token EndAttribute in state Start would result in an invalid XML document.");
+
+ CheckState ();
+
+ if (openXmlLang) {
+ w.Write (xmlLang);
+ openXmlLang = false;
+ ((XmlTextWriterOpenElement)openElements.Peek()).XmlLang = xmlLang;
+ }
+
+ if (openXmlSpace)
+ {
+ w.Write (xmlSpace.ToString ().ToLower ());
+ openXmlSpace = false;
+ ((XmlTextWriterOpenElement)openElements.Peek()).XmlSpace = xmlSpace;
+ }
+
+ w.Write ("{0}", quoteChar);
+
+ openAttribute = false;
+ }
+
+ public override void WriteEndDocument ()
+ {
+ CloseOpenAttributeAndElements ();
+
+ if ((ws == WriteState.Start) || (ws == WriteState.Prolog))
+ throw new ArgumentException ("This document does not have a root element.");
+
+ ws = WriteState.Start;
+ }
+
+ public override void WriteEndElement ()
+ {
+ WriteEndElementInternal (false);
+ }
+
+ private void WriteEndElementInternal (bool fullEndElement)
+ {
+ if (openElements.Count == 0)
+ throw new InvalidOperationException("There was no XML start tag open.");
+
+ indentLevel--;
+ CheckState ();
+ AddMissingElementXmlns ();
+
+ if (openStartElement) {
+ if (openAttribute)
+ WriteEndAttribute ();
+ if (fullEndElement)
+ w.Write ("></{0}>", ((XmlTextWriterOpenElement)openElements.Peek ()).Name);
+ else
+ w.Write (" />");
+
+ openElements.Pop ();
+ openStartElement = false;
+ } else {
+ w.Write ("{0}</{1}>", indentFormatting, openElements.Pop ());
+ }
+
+ namespaceManager.PopScope();
+ }
+
+ [MonoTODO]
+ public override void WriteEntityRef (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteFullEndElement ()
+ {
+ WriteEndElementInternal (true);
+ }
+
+ private void CheckValidChars (string name, bool firstOnlyLetter)
+ {
+ foreach (char c in name) {
+ if (XmlConvert.IsInvalid (c, firstOnlyLetter))
+ throw new ArgumentException ("There is an invalid character: '" + c +
+ "'", "name");
+ }
+ }
+
+ public override void WriteName (string name)
+ {
+ CheckValidChars (name, true);
+ w.Write (name);
+ }
+
+ public override void WriteNmToken (string name)
+ {
+ CheckValidChars (name, false);
+ w.Write (name);
+ }
+
+ public override void WriteProcessingInstruction (string name, string text)
+ {
+ if ((name == null) || (name == string.Empty) || (name.IndexOf("?>") > 0) || (text.IndexOf("?>") > 0)) {
+ throw new ArgumentException ();
+ }
+
+ CheckState ();
+ CloseStartElement ();
+
+ w.Write ("{0}<?{1} {2}?>", indentFormatting, name, text);
+ }
+
+ [MonoTODO]
+ public override void WriteQualifiedName (string localName, string ns)
+ {
+ if (localName == null || localName == String.Empty)
+ throw new ArgumentException ();
+
+ CheckState ();
+ w.Write ("{0}:{1}", ns, localName);
+ }
+
+ public override void WriteRaw (string data)
+ {
+ WriteStringInternal (data, false);
+ }
+
+ [MonoTODO]
+ public override void WriteRaw (char[] buffer, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteStartAttribute (string prefix, string localName, string ns)
+ {
+ if ((prefix == "xml") && (localName == "lang"))
+ openXmlLang = true;
+
+ if ((prefix == "xml") && (localName == "space"))
+ openXmlSpace = true;
+
+ if ((prefix == "xmlns") && (localName == "xmlns"))
+ throw new ArgumentException ("Prefixes beginning with \"xml\" (regardless of whether the characters are uppercase, lowercase, or some combination thereof) are reserved for use by XML.");
+
+ CheckState ();
+
+ if (ws == WriteState.Content)
+ throw new InvalidOperationException ("Token StartAttribute in state " + WriteState + " would result in an invalid XML document.");
+
+ if (prefix == null)
+ prefix = String.Empty;
+
+ if (ns == null)
+ ns = String.Empty;
+
+ string formatPrefix = "";
+ string formatSpace = "";
+
+ if (ns != String.Empty)
+ {
+ string existingPrefix = namespaceManager.LookupPrefix (ns);
+
+ if (prefix == String.Empty)
+ prefix = (existingPrefix == null) ?
+ String.Empty : existingPrefix;
+ }
+
+ if (prefix != String.Empty)
+ {
+ formatPrefix = prefix + ":";
+ }
+
+ if (openStartElement || attributeWrittenForElement)
+ formatSpace = " ";
+
+ w.Write ("{0}{1}{2}={3}", formatSpace, formatPrefix, localName, quoteChar);
+
+ openAttribute = true;
+ attributeWrittenForElement = true;
+ ws = WriteState.Attribute;
+ }
+
+ public override void WriteStartDocument ()
+ {
+ WriteStartDocument ("");
+ }
+
+ public override void WriteStartDocument (bool standalone)
+ {
+ string standaloneFormatting;
+
+ if (standalone == true)
+ standaloneFormatting = String.Format (" standalone={0}yes{0}", quoteChar);
+ else
+ standaloneFormatting = String.Format (" standalone={0}no{0}", quoteChar);
+
+ WriteStartDocument (standaloneFormatting);
+ }
+
+ private void WriteStartDocument (string standaloneFormatting)
+ {
+ if (documentStarted == true)
+ throw new InvalidOperationException("WriteStartDocument should be the first call.");
+
+ CheckState ();
+
+ string encodingFormatting = "";
+
+ if (!nullEncoding)
+ encodingFormatting = String.Format (" encoding={0}{1}{0}", quoteChar, w.Encoding.HeaderName);
+
+ w.Write("<?xml version={0}1.0{0}{1}{2}?>", quoteChar, encodingFormatting, standaloneFormatting);
+ ws = WriteState.Prolog;
+ }
+
+ public override void WriteStartElement (string prefix, string localName, string ns)
+ {
+ if (!Namespaces && (((prefix != null) && (prefix != String.Empty))
+ || ((ns != null) && (ns != String.Empty))))
+ throw new ArgumentException ("Cannot set the namespace if Namespaces is 'false'.");
+
+ WriteStartElementInternal (prefix, localName, ns);
+ }
+
+ private void WriteStartElementInternal (string prefix, string localName, string ns)
+ {
+ if ((prefix != null && prefix != String.Empty) && ((ns == null) || (ns == String.Empty)))
+ throw new ArgumentException ("Cannot use a prefix with an empty namespace.");
+
+ CheckState ();
+ CloseStartElement ();
+
+ if (prefix == null)
+ prefix = namespaceManager.LookupPrefix (ns);
+ if (prefix == null)
+ prefix = String.Empty;
+
+ string formatXmlns = "";
+ string formatPrefix = "";
+
+ if(ns != null) {
+ if (prefix != String.Empty)
+ formatPrefix = prefix + ":";
+ }
+
+ w.Write ("{0}<{1}{2}{3}", indentFormatting, formatPrefix, localName, formatXmlns);
+
+
+ openElements.Push (new XmlTextWriterOpenElement (formatPrefix + localName));
+ ws = WriteState.Element;
+ openStartElement = true;
+ openElementNS = ns;
+ openElementPrefix = prefix;
+
+ namespaceManager.PushScope ();
+// if(ns != null)
+// namespaceManager.AddNamespace (prefix, ns);
+ indentLevel++;
+ }
+
+ public override void WriteString (string text)
+ {
+ if (ws == WriteState.Prolog)
+ throw new InvalidOperationException ("Token content in state Prolog would result in an invalid XML document.");
+
+ WriteStringInternal (text, true);
+ }
+
+ private void WriteStringInternal (string text, bool entitize)
+ {
+ if (text == null)
+ text = String.Empty;
+
+ if (text != String.Empty)
+ {
+ CheckState ();
+
+ if (entitize)
+ {
+ text = text.Replace ("&", "&amp;");
+ text = text.Replace ("<", "&lt;");
+ text = text.Replace (">", "&gt;");
+
+ if (openAttribute)
+ {
+ if (quoteChar == '"')
+ text = text.Replace ("\"", "&quot;");
+ else
+ text = text.Replace ("'", "&apos;");
+ }
+ }
+
+ if (!openAttribute)
+ {
+ IndentingOverriden = true;
+ CloseStartElement ();
+ }
+ if (!openXmlLang && !openXmlSpace)
+ w.Write (text);
+ else
+ {
+ if (openXmlLang)
+ xmlLang = text;
+ else
+ {
+ switch (text)
+ {
+ case "default":
+ xmlSpace = XmlSpace.Default;
+ break;
+ case "preserve":
+ xmlSpace = XmlSpace.Preserve;
+ break;
+ default:
+ throw new ArgumentException ("'{0}' is an invalid xml:space value.");
+ }
+ }
+ }
+ }
+ }
+
+ [MonoTODO]
+ public override void WriteSurrogateCharEntity (char lowChar, char highChar)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteWhitespace (string ws)
+ {
+ foreach (char c in ws) {
+ if ((c != ' ') && (c != '\t') && (c != '\r') && (c != '\n'))
+ throw new ArgumentException ();
+ }
+
+ w.Write (ws);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs b/mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs
new file mode 100644
index 00000000000..1f0f63aae3d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs
@@ -0,0 +1,72 @@
+//
+// System.Xml.XmlTextWriterOpenElement
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+//
+// Scope support for XmlLang and XmlSpace in XmlTextWriter.
+//
+using System;
+
+namespace System.Xml
+{
+ internal class XmlTextWriterOpenElement
+ {
+ #region Fields
+
+ string name;
+ string xmlLang;
+ XmlSpace xmlSpace;
+ bool indentingOverriden = false;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlTextWriterOpenElement (string name)
+ {
+ this.name = name;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public bool IndentingOverriden
+ {
+ get { return indentingOverriden; }
+ set { indentingOverriden = value; }
+ }
+
+ public string XmlLang
+ {
+ get { return xmlLang; }
+ set { xmlLang = value; }
+ }
+
+ public XmlSpace XmlSpace
+ {
+ get { return xmlSpace; }
+ set { xmlSpace = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override string ToString ()
+ {
+ return name;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTokenizedType.cs b/mcs/class/System.XML/System.Xml/XmlTokenizedType.cs
new file mode 100755
index 00000000000..13762770ce6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTokenizedType.cs
@@ -0,0 +1,27 @@
+//
+// System.Xml.XmlTokenizedType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ [Serializable] public enum XmlTokenizedType
+ {
+ CDATA = 0,
+ ID = 1,
+ IDREF = 2,
+ IDREFS = 3,
+ ENTITY = 4,
+ ENTITIES = 5,
+ NMTOKEN = 6,
+ NMTOKENS = 7,
+ NOTATION = 8,
+ ENUMERATION = 9,
+ QName = 10,
+ NCName = 11,
+ None = 12,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
new file mode 100755
index 00000000000..54750bb6f60
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
@@ -0,0 +1,41 @@
+// System.Xml.XmlUrlResolver.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Net;
+
+namespace System.Xml
+{
+ public class XmlUrlResolver : XmlResolver
+ {
+ // Field
+ ICredentials credential;
+
+ // Constructor
+ public XmlUrlResolver ()
+ : base ()
+ {
+ }
+
+ // Properties
+ public override ICredentials Credentials
+ {
+ set { credential = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
+ {
+ return null;
+ }
+
+ public override Uri ResolveUri (Uri baseUri, string relativeUri)
+ {
+ return new Uri (baseUri, relativeUri);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
new file mode 100644
index 00000000000..330793f55ad
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
@@ -0,0 +1,341 @@
+//
+// System.Xml.XmlValidatingReader.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.IO;
+using System.Text;
+using System.Xml.Schema;
+
+namespace System.Xml {
+ public class XmlValidatingReader : XmlReader, IXmlLineInfo {
+
+ #region Fields
+
+ EntityHandling entityHandling;
+ bool namespaces;
+ XmlReader reader;
+ ValidationType validationType;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public XmlValidatingReader (XmlReader reader)
+ : base ()
+ {
+ if (!(reader is XmlTextReader))
+ throw new ArgumentException ();
+
+ this.reader = reader;
+ entityHandling = EntityHandling.ExpandEntities;
+ namespaces = true;
+ validationType = ValidationType.Auto;
+ }
+
+ [MonoTODO]
+ public XmlValidatingReader (Stream xmlFragment, XmlNodeType fragType, XmlParserContext context)
+ : this (new XmlTextReader (xmlFragment))
+ {
+ }
+
+ public XmlValidatingReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context)
+ : this (new XmlTextReader (xmlFragment))
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override int AttributeCount {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string BaseURI {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool CanResolveEntity {
+ get { return true; }
+ }
+
+ public override int Depth {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public Encoding Encoding {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public EntityHandling EntityHandling {
+ get { return entityHandling; }
+ set { entityHandling = value; }
+ }
+
+ public override bool EOF {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool HasValue {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool IsDefault {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool IsEmptyElement {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string this [int i] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string this [string name] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string this [string localName, string namespaceName] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ int IXmlLineInfo.LineNumber {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ int IXmlLineInfo.LinePosition {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string LocalName {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string Name {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool Namespaces {
+ get { return namespaces; }
+ set { namespaces = value; }
+ }
+
+ public override string NamespaceURI {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override XmlNameTable NameTable {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override XmlNodeType NodeType {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string Prefix {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override char QuoteChar {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public XmlReader Reader {
+ get { return reader; }
+ }
+
+ public override ReadState ReadState {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public XmlSchemaCollection Schemas {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public object SchemaType {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public ValidationType ValidationType {
+ get { return validationType; }
+ [MonoTODO ("Need to check for exception.")]
+ set { validationType = value; }
+ }
+
+ public override string Value {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string XmlLang {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public XmlResolver XmlResolver {
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ public override XmlSpace XmlSpace {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void Close ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (string localName, string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IXmlLineInfo.HasLineInfo ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string LookupNamespace (string prefix)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void MoveToAttribute (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string localName, string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool MoveToElement ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool MoveToFirstAttribute ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool MoveToNextAttribute ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Read ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ReadAttributeValue ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ReadInnerXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ReadOuterXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ReadString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object ReadTypedValue ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void ResolveEntity ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event ValidationEventHandler ValidationEventHandler;
+
+ #endregion // Events and Delegates
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlWhitespace.cs
new file mode 100644
index 00000000000..ba1013c6683
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlWhitespace.cs
@@ -0,0 +1,72 @@
+//
+// System.Xml.XmlWhitespace.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public class XmlWhitespace : XmlCharacterData
+ {
+ // Constructor
+ protected internal XmlWhitespace (string strData, XmlDocument doc)
+ : base (strData, doc)
+ {
+ }
+
+ // Properties
+ public override string LocalName {
+ get { return "#whitespace"; }
+ }
+
+ public override string Name {
+ get { return "#whitespace"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Whitespace; }
+ }
+
+ internal override XPathNodeType XPathNodeType {
+ get { return XPathNodeType.Whitespace; }
+ }
+
+ public override string Value {
+ get { return Data; }
+ set {
+ if (IsValidWhitespaceChar (value) == false)
+ throw new ArgumentException ("Invalid whitespace characters.");
+ Data = value;
+ }
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ // always return the data value
+ return new XmlWhitespace (Data, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ if(OwnerDocument.PreserveWhitespace)
+ w.WriteWhitespace (Data);
+ }
+
+ private bool IsValidWhitespaceChar (string text)
+ {
+ foreach (char c in text)
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ return false;
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs
new file mode 100644
index 00000000000..0bd2412a084
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs
@@ -0,0 +1,258 @@
+//
+// System.Xml.XmlTextWriter
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+ public abstract class XmlWriter
+ {
+ #region Fields
+
+ protected WriteState ws = WriteState.Start;
+ protected XmlNamespaceManager namespaceManager = new XmlNamespaceManager (new NameTable ());
+
+ #endregion
+
+ #region Constructors
+
+ protected XmlWriter () { }
+
+ #endregion
+
+ #region Properties
+
+ public abstract WriteState WriteState { get; }
+
+ public abstract string XmlLang { get; }
+
+ public abstract XmlSpace XmlSpace { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract void Close ();
+
+ public abstract void Flush ();
+
+ public abstract string LookupPrefix (string ns);
+
+ [MonoTODO("DTDs must be implemented to use 'defattr' parameter.")]
+ public virtual void WriteAttributes (XmlReader reader, bool defattr)
+ {
+ if(reader == null)
+ throw new ArgumentException("null XmlReader specified.", "reader");
+
+ switch(reader.NodeType)
+ {
+ case XmlNodeType.XmlDeclaration:
+ // this method doesn't write "<?xml " and "?>", at least MS .NET Framework as yet.
+ XmlDeclaration decl = new XmlDeclaration("1.0", String.Empty, String.Empty, null);
+ decl.Value = reader.Value;
+ if(decl.Version != null && decl.Version != String.Empty) WriteAttributeString("version", decl.Version);
+ if(decl.Encoding != null && decl.Encoding != String.Empty) WriteAttributeString("encoding", decl.Encoding);
+ if(decl.Standalone != null && decl.Standalone != String.Empty) WriteAttributeString("standalone", decl.Standalone);
+ break;
+ case XmlNodeType.Element:
+ while (reader.MoveToNextAttribute ())
+ {
+ WriteAttributeString(reader.Prefix, reader.LocalName, reader.NamespaceURI, reader.Value);
+ }
+ break;
+ case XmlNodeType.Attribute:
+ do
+ {
+ WriteAttributeString(reader.Prefix, reader.LocalName, reader.NamespaceURI, reader.Value);
+ }
+ while (reader.MoveToNextAttribute ()) ;
+ break;
+ default:
+ throw new XmlException("NodeType is not one of Element, Attribute, nor XmlDeclaration.");
+ }
+ }
+
+ public void WriteAttributeString (string localName, string value)
+ {
+ WriteAttributeString ("", localName, "", value);
+ }
+
+ public void WriteAttributeString (string localName, string ns, string value)
+ {
+ WriteAttributeString ("", localName, ns, value);
+ }
+
+ public void WriteAttributeString (string prefix, string localName, string ns, string value)
+ {
+ if ((prefix == "xmlns") || (localName == "xmlns"))
+ {
+ ns = value;
+
+ if (prefix == "xmlns" && namespaceManager.HasNamespace (localName))
+ return;
+
+ /* Users need to be able to re-declare the default namespace for subnodes
+ else if (localName == "xmlns" && namespaceManager.HasNamespace (String.Empty))
+ return;
+ */
+ }
+
+ WriteStartAttribute (prefix, localName, ns);
+ WriteString (value);
+ WriteEndAttribute ();
+
+ if ((prefix == "xmlns") || (localName == "xmlns"))
+ {
+ if (prefix == "xmlns")
+ namespaceManager.AddNamespace (localName, ns);
+ else
+ namespaceManager.AddNamespace ("", ns);
+ }
+
+ }
+
+ public abstract void WriteBase64 (byte[] buffer, int index, int count);
+
+ public abstract void WriteBinHex (byte[] buffer, int index, int count);
+
+ public abstract void WriteCData (string text);
+
+ public abstract void WriteCharEntity (char ch);
+
+ public abstract void WriteChars (char[] buffer, int index, int count);
+
+ public abstract void WriteComment (string text);
+
+ public abstract void WriteDocType (string name, string pubid, string sysid, string subset);
+
+ public void WriteElementString (string localName, string value)
+ {
+ WriteStartElement(localName);
+ WriteString(value);
+ WriteEndElement();
+ }
+
+ public void WriteElementString (string localName, string ns, string value)
+ {
+ WriteStartElement(localName, ns);
+ WriteString(value);
+ WriteEndElement();
+ }
+
+ public abstract void WriteEndAttribute ();
+
+ public abstract void WriteEndDocument ();
+
+ public abstract void WriteEndElement ();
+
+ public abstract void WriteEntityRef (string name);
+
+ public abstract void WriteFullEndElement ();
+
+ public abstract void WriteName (string name);
+
+ public abstract void WriteNmToken (string name);
+
+ [MonoTODO("needs to test")]
+ public virtual void WriteNode (XmlReader reader, bool defattr)
+ {
+ if (reader == null)
+ throw new ArgumentException ();
+
+ if (reader.ReadState == ReadState.Initial) {
+ while (reader.Read ())
+ WriteNode (reader, defattr);
+ }
+ else {
+ switch (reader.NodeType) {
+ case XmlNodeType.Element:
+ WriteStartElement (reader.Prefix, reader.LocalName, reader.NamespaceURI);
+ WriteAttributes (reader, defattr);
+ if (reader.IsEmptyElement)
+ WriteEndElement ();
+ break;
+ case XmlNodeType.Attribute:
+ break;
+ case XmlNodeType.Text:
+ WriteString (reader.Value);
+ break;
+ case XmlNodeType.CDATA:
+ WriteCData (reader.Value);
+ break;
+ case XmlNodeType.EntityReference:
+ WriteEntityRef (reader.Name);
+ break;
+ case XmlNodeType.ProcessingInstruction:
+ WriteProcessingInstruction (reader.Name, reader.Value);
+ break;
+ case XmlNodeType.Comment:
+ WriteComment (reader.Value);
+ break;
+ case XmlNodeType.DocumentType:
+ WriteDocType (reader.Name,
+ reader ["PUBLIC"], reader ["SYSTEM"], reader.Value);
+ break;
+ case XmlNodeType.SignificantWhitespace:
+ goto case XmlNodeType.Whitespace;
+ case XmlNodeType.Whitespace:
+ WriteWhitespace (reader.Value);
+ break;
+ case XmlNodeType.EndElement:
+ break;
+ case XmlNodeType.EndEntity:
+ break;
+ case XmlNodeType.XmlDeclaration:
+ WriteStartDocument (reader.GetAttribute ("standalone").ToLower () == "yes");
+ break;
+ default:
+ throw new NotImplementedException ();
+ }
+ }
+ }
+
+ public abstract void WriteProcessingInstruction (string name, string text);
+
+ public abstract void WriteQualifiedName (string localName, string ns);
+
+ public abstract void WriteRaw (string data);
+
+ public abstract void WriteRaw (char[] buffer, int index, int count);
+
+ public void WriteStartAttribute (string localName, string ns)
+ {
+ WriteStartAttribute (null, localName, ns);
+ }
+
+ public abstract void WriteStartAttribute (string prefix, string localName, string ns);
+
+ public abstract void WriteStartDocument ();
+
+ public abstract void WriteStartDocument (bool standalone);
+
+ public void WriteStartElement (string localName)
+ {
+ WriteStartElement (null, localName, null);
+ }
+
+ public void WriteStartElement (string localName, string ns)
+ {
+ WriteStartElement (null, localName, ns);
+ }
+
+ public abstract void WriteStartElement (string prefix, string localName, string ns);
+
+ public abstract void WriteString (string text);
+
+ public abstract void WriteSurrogateCharEntity (char lowChar, char highChar);
+
+ public abstract void WriteWhitespace (string ws);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/Test/.cvsignore b/mcs/class/System.XML/Test/.cvsignore
new file mode 100644
index 00000000000..136fcca0890
--- /dev/null
+++ b/mcs/class/System.XML/Test/.cvsignore
@@ -0,0 +1,4 @@
+*.dll
+*.csproj.user
+bin
+obj
diff --git a/mcs/class/System.XML/Test/AllTests.cs b/mcs/class/System.XML/Test/AllTests.cs
new file mode 100644
index 00000000000..4c158627fed
--- /dev/null
+++ b/mcs/class/System.XML/Test/AllTests.cs
@@ -0,0 +1,52 @@
+// Author:
+// Mario Martinez (mariom925@home.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ /// <summary>
+ /// Combines all unit tests for the System.XML.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new TestSuite (typeof (XmlProcessingInstructionTests)));
+ suite.AddTest (new TestSuite (typeof (XmlTextTests)));
+ suite.AddTest (new TestSuite (typeof (XmlTextReaderTests)));
+ suite.AddTest (new TestSuite (typeof (XmlWriterTests)));
+ suite.AddTest (new TestSuite (typeof (XmlTextWriterTests)));
+ suite.AddTest (new TestSuite (typeof (XmlNamespaceManagerTests)));
+ suite.AddTest (new TestSuite (typeof (XmlAttributeTests)));
+ suite.AddTest (new TestSuite (typeof (XmlAttributeCollectionTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDocumentTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDocumentFragmentTests)));
+ suite.AddTest (new TestSuite (typeof (NameTableTests)));
+ suite.AddTest (new TestSuite (typeof (XmlElementTests)));
+ suite.AddTest (new TestSuite (typeof (XmlEntityReferenceTests)));
+ suite.AddTest (new TestSuite (typeof (XmlNodeTests)));
+ suite.AddTest (new TestSuite (typeof (XmlNodeListTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCharacterDataTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCommentTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCDataSectionTests)));
+ suite.AddTest (new TestSuite (typeof (XmlWhitespaceTests)));
+ suite.AddTest (new TestSuite (typeof (XmlSignificantWhitespaceTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDeclarationTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDocumentTypeTests)));
+ suite.AddTest (new TestSuite (typeof (XPathNavigatorTests)));
+ suite.AddTest (new TestSuite (typeof (SelectNodesTests)));
+ suite.AddTest (new TestSuite (typeof (XPathNavigatorMatchesTests)));
+ suite.AddTest (new TestSuite (typeof (XPathNavigatorEvaluateTests)));
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/ChangeLog b/mcs/class/System.XML/Test/ChangeLog
new file mode 100644
index 00000000000..165b50d8edb
--- /dev/null
+++ b/mcs/class/System.XML/Test/ChangeLog
@@ -0,0 +1,598 @@
+2003-01-19 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlElementTests.cs : added TestWriteToDefaultNamespace test.
+ * XmlNodeTests.cs : added TestGetPrefixOfNamespace test.
+
+2003-01-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * added XmlWriterTests.cs file and added it to AllTests.cs
+
+2003-01-13 Nick Drochak <ndrochak@gol.com>
+
+ * XmlNodeTests.cs: MS.NET doesn't throw an exception here.
+
+2003-01-11 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlElementTests.cs : added TestInnerTextAndEvent test.
+ (and many coding style fix.)
+ * XmlTextReaderTests.cs : tiny argument order fix for TestAttributeWithEntityReference test.
+
+2003-01-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocumentTests.cs : test for attribute value bugfix.
+
+2003-01-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlTextReaderTests.cs : test for attribute value bugfix.
+
+2002-01-02 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * SelectNodesTests.cs : added TestAlphabetDigitMixedName.
+
+2002-12-28 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocumentTests.cs : Test for bugzilla #34743 (whitespace handling)
+
+2002-12-28 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocumentTests.cs : Test for bugzilla #35308 (default ns output)
+ * XmlElementTests.cs : Test for output of attributes with different NS.
+
+2002-12-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDocumentTests.cs, XmlWhitespaceTests.cs:
+ fixed whitespace handling (in relation to Ville's patch).
+
+2002-12-21 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlTextWriterTests.cs (TestAttributeNamespacesXmlnsXmlns):
+ fixed bug in the testcase (in relation to JD Conley's patch).
+
+2002-12-01 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlDeclarationTests.cs (TestValueProperty):
+ applied patch by David Sheldon
+
+2002-11-13 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * AllTests.cs : added XmlEntityReferenceTests
+ * XmlDocumentTests.cs : TestCloneNode, TestDocumentWithDoctypeDecl
+ * XmlDocumentFragmentTests.cs : TestSetInnerXml
+ * XmlEntityReferenceTests.cs : created
+ * XmlTextWriterTests.cs : TestWriteAttributes() bugfix (reusing ctx)
+ * XmlNodeTests.cs : bugfix TestInsertAfter(when refChild = null),
+ added TestPrependChild
+
+2002-11-13 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlAttributeTests.cs : TestSetInnerAndOuterXml
+ * XmlSignificantWhitespaceTests.cs : TestDataAndValue
+
+2002-11-03 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlAttributeCollectionTests.cs : TestSetNamedItem,
+ TestInsertBeforeAfterPrepend, TestRemove
+ * XmlElementTests.cs : TestWriteToWithDeletedNamespacePrefix,
+ TestRemoveAttribute()
+ * XmlDocumentFragmentTests.cs : TestGetInnerXml
+
+2002-10-29 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlElementTests.cs : added an Assert InnerXml with element content.
+ * XmlNodeTests.cs : TestInsertBefore() and TestInsertAfter()
+
+2002-10-28 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * added XmlDocumentFragmentTests.cs
+ (including AllTests.cs and System.XML_linux_test.args)
+ * XmlDocumentTests.cs: added test of XMLDeclaration to TestImportNode()
+ * XmlElementTests.cs: added check removing children of InnerXml
+
+2002-10-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.XML_linux_test.args: added XPathNavigatorEvaluateTests.cs
+ * makefile.gnu: pass MONO_PATH when running the tests.
+
+2002-10-24 Nick Drochak <ndrochak@gol.com>
+
+ * System.XML_test.build: remove legacy build of a standalone exe of the
+ unit tests
+ * XmlDocumentTests.cs: Cannot use a URI with Load().
+
+2002-10-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlTextReaderTests.cs: fixed TestEntityReferenceInsideText.
+
+2002-10-22 Nick Drochak <ndrochak@gol.com>
+
+ * XmlTextWriterTests.cs: Null is ok when prefix is "xmlns".
+
+2002-10-21 Duncan Mak <duncan@ximian.com>
+
+ * XmlTextReaderTests.cs:
+ * XmlElementTests.cs:
+ * XmlDocumentTests.cs: Patches from Atsushi Enomoto
+ <ginga@kit.hi-ho.ne.jp>.
+
+2002-10-18 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocumentTests.cs: Apply a patch from Atsushi Enomoto
+ <ginga@kit.hi-ho.ne.jp>.
+
+2002-09-29 Nick Drochak <ndrochak@gol.com>
+
+ * XmlTextReaderTest.cs (AssertEndDocument): Add messages for Asserts()
+ so we can tell where this is failing.
+
+2002-09-19 Matt Hunter <mahunter@tconl.com>
+
+ * XmlElementTests.cs: Test for SetAttributeNode(localName, namespaceURI) added.
+ * XmlAttributeCollectionTests.cs: added TestAppend().
+
+2002-09-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XPathNavigatorEvaluateTests.cs: Tests for string(), concat(),
+ starts-with(), and contains().
+
+2002-09-12 Piers Haken <piersh@friskit.com>
+
+ * XPathNavigatorEvaluateTests.cs: enable string() tests.
+
+2002-09-12 Piers Haken <piersh@friskit.com>
+
+ * XPathNavigatorEvaluateTests.cs: enable last() & count() tests.
+
+2002-09-11 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XPathNavigatorEvaluateTests.cs: Added tests for
+ local-name, namespace-uri, and string.
+
+2002-09-11 Kral Ferch <kral_ferch@hotmail.com>
+
+ * Added XPathNavigatorEvaluateTests.cs file to
+ the MonoMicro.Test project.
+
+ * XPathNavigatorEvaluateTests.cs: New file.
+
+ * AllTests.cs: Added XPathNavigatorEvaluateTests suite.
+
+ * XmlDocumentTests: Added space between namespace decls in
+ TestGetElementsByTagNameUsingNameSpace. Was causing error
+ when testing against Microsoft assembly.
+
+ * XmlElementTests: Added space between namespace decls in
+ TestGetElementsByTagNameUsingNameSpace. Was causing error
+ when testing against Microsoft assembly.
+
+2002-09-06 Kral Ferch <kral_ferch@hotmail.com>
+
+ * Added XPathNavigatorMatchesTests.cs file to
+ the MonoMicro.Test project.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * AllTests.cs, System.XML_linux_test.args,
+ XmlAttributeCollectionTests.cs,XmlElementTests.cs: Added test for
+ RemoveAll and RemoveAllAttributes courtesy of Matt Hunter
+ <xrkune@tconl.com>.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlElementTests.cs: Correction to previous GetElementsByTagName
+ patch courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-22 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs, XmlElementTests.cs: Added tests for
+ namespace qualified GetElementsByTagName courtesy of Matt Hunter
+ <xrkune@tconl.com>.
+
+2002-08-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs, XmlElementTests.cs: Added tests for
+ GetElementsByTagName courtesy of Matt Hunter <xrkune@tconl.com>.
+
+2002-08-17 Jason Diamond <jason@injektilo.org>
+
+ * XPathNavigatorMatchesTests.cs: Added tests for absolute patterns
+ and patterns with predicates.
+
+2002-08-17 Jason Diamond <jason@injektilo.org>
+
+ * AllTests.cs: Added XPathNavigatorMatchesTests suite.
+
+ * XPathNavigatorMatchesTests.cs: Added.
+
+2002-08-16 Jason Diamond <jason@injektilo.org>
+
+ * XmlElementTests.cs: Added test for OuterXml (and WriteTo) for
+ qualified elements.
+
+2002-08-16 Jason Diamond <jason@injektilo.org>
+
+ * makefile.gnu: Added SOURCES_INCLUDE and SOURCES_EXCLUDE variables
+ to get tests to build with the new build system.
+
+2002-08-10 Jason Diamond <jason@injektilo.org>
+
+ * makefile.gnu: Use relative path to NUnitConsole_mono.exe instead of
+ hardcoding it to /usr/local/bin. Default test suite to AllTests but
+ allow it to be overridden from the command line.
+
+ * XmlTextWriterTests.cs: Split TestWriteString into multiple tests.
+ Added encoding parameters to all the StreamReaders in
+ TestBaseConstructorsAndBaseStream. I think this is a bug in Mono's
+ StreamReader since these aren't required when testing against
+ Microsoft's.
+
+2002-08-08 Jason Diamond <jason@injektilo.org>
+
+ * System.XML_linux_test.args: Added Kral's new test classes.
+
+2002-08-07 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlCharacterDataTests.cs: New file.
+
+ * XmlNodeTests.cs: New file.
+
+ * AllTests.cs: Added XmlCharacterDataTests and XmlNodeTests.
+
+ * XmlDocumentTests.cs: Added tests for NodeChanging, NodeChanged,
+ NodeInserting, NodeInserted, NodeRemoving, and NodeRemoved events.
+
+2002-08-03 Jason Diamond <jason@injektilo.org>
+
+ * makefile.gnu: Added.
+
+ * System.XML_linux_test.args: Added.
+
+2002-07-12 Piers Haken <piersh@friskit.com
+
+ * SelectNodesTests.cs: Added TestUnion (bug #27548)
+
+2002-07-11 Jason Diamond <jason@injektilo.org>
+
+ * SelectNodesTests.cs: Added.
+
+ * AllTests.cs: Added SelectNodesTests to suite.
+
+2002-07-11 Piers Haken <piersh@friskit.com>
+
+ * XmlElementTests.cs: added TestCreateElement3WithNullNamespace
+
+2002-06-24 Jason Diamond <jason@injektilo.org>
+
+ * XPathScannerTests.cs: Removed.
+
+ * System.XML_test.build: Removed tests for XPathScanner.
+
+2002-05-27 Jason Diamond <jason@injektilo.org>
+
+ * XPathNavigatorTests.cs: Added file to directory.
+
+ * AllTests.cs: Added XPathNavigatorTests to suite.
+
+ * XmlTextReaderTests.cs: Added test to make sure attributes are ordered
+ like Microsoft's parser does it.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Update build file to run correct class in the test dll.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs
+ * NameTableTests.cs
+ * TheTests.cs
+ * XPathScannerTests.cs
+ * XmlAttributeTests.cs
+ * XmlCDataSectionTests.cs
+ * XmlCommentTests.cs
+ * XmlDeclarationTests.cs
+ * XmlDocumentTests.cs
+ * XmlDocumentTypeTests.cs
+ * XmlElementTests.cs
+ * XmlNamespaceManagerTests.cs
+ * XmlNodeListTests.cs
+ * XmlProcessingInstructionTests.cs
+ * XmlSignificantWhitespaceTests.cs
+ * XmlTextReaderTests.cs
+ * XmlTextTests.cs
+ * XmlTextWriterTests.cs
+ * XmlWhiteSpaceTests.cs: Use same namespace style as corlib tests.
+ Changed Ximian.Mono.Tests to MonoTests.System.Xml
+
+2002-04-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * AllTests.cs: added XmlProcessingInstructionTests and XmlTextTests.
+
+ * MonoMicro.Test.csproj: Added XmlProcessingInstructionTests.cs and
+ XmlTextTests.cs.
+
+ * XmlAttributeTests.cs: Added TestAttributeInnerAndOuterXml.
+
+ * XmlCDataSectionTests.cs: Added TestXmlCDataSectionInnerAndOuterXml.
+
+ * XmlCommentTests.cs: Added TestXmlCommentInnerAndOuterXml.
+
+ * XmlDeclarationTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlDocumentTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlElementTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlProcessingInstructionTests.cs: Initial check-in.
+
+ * XmlSignificantWhitespaceTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlTextTests.cs: Initial check-in.
+
+ * XmlTextWriterTests.cs: Added TestWriteRaw, TestWriteRawInvalidInAttribute,
+ and TestXmlSpaceRaw.
+
+ * XmlWhiteSpacesTests.cs: Added TestInnerAndOuterXml.
+
+2002-04-05 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: CreateNode tests.
+
+2002-04-01 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Tests for WriteEndDocument and WriteFullEndElement.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Tests for LookupPrefix, WriteBase64,
+ and WriteCharEntity.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Finished XmlLang, XmlSpace, and
+ Attribute namespace declaration tests.
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: XmlLang and XmlSpace tests.
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Working on Attributes.
+
+2002-03-28 Duncan Mak <duncan@ximian.com>
+
+ * XmlDeclarationTests.cs (TestConstructor):
+ * XmlDocumentTypeTests.cs (TestAppendChild):
+ * XmlSignificantWhitespaceTests.cs (TestXmlWhitespaceConstructor):
+ * XmlWhiteSpaceTests.cs (TestXmlWhitespaceConstructor): Fixed the
+ test for catching Exceptions.
+
+2002-03-26 Jason Diamond <jason@injektilo.org>
+
+ * AllTests.cs:
+ * Mono.Test.csproj: Removed XPathScanner tests.
+
+ * System.XML_test.build: Test XPathScanner separately.
+
+2002-03-26 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new test,
+ XmlDocumentTypeTests.
+
+ * XmlDocumentTypeTests.cs: New testsuite for XmlDocumentType class.
+
+ * XmlCommentTests.cs (TestXmlNodeBaseProperties): Move the
+ XmlNode.Value test in here.
+
+2002-03-26 Jason Diamond <jason@injektilo.org>
+
+ * XPathScannerTests.cs: More location path tests.
+
+2002-03-25 Jason Diamond <jason@injektilo.org>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new test, XmlScannerTests.
+
+ * XPathScannerTests.cs: Added new tests for XPathScanner class.
+
+2002-03-25 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new test,
+ XmlDeclarationTests.
+
+ * XmlDeclarationTests.cs: Added new test for XmlDeclaration class.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Tests for BaseStream,
+ Namespaces = false, and WriteState.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: constructor tests with
+ different encodings to test that encoding gets suppressed
+ on xml declaration when null stream passed to constructor.
+ WriteStartDocument(standalone) tests. Tests for formatting
+ and indentation. Test for invalid value set on QuoteChar.
+
+2002-03-22 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new files.
+
+ * XmlCDataSectionTests.cs: Added to CVS.
+
+ * XmlCommentTests.cs: Added to CVS. hanks to Kral for helping me
+ setup a testing environment on VS.NET.
+
+ * XmlElementTests.cs: Reformatted.
+ (TestCloneNode): Added.
+
+ * XmlSignificantWhitespaceTests.cs: Added to CVS.
+
+ * XmlWhiteSpaceTests.cs: Added to CVS.
+
+2002-03-21 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: Tessts parent traversal up through
+ document itself until null. Tests a removed elements next
+ sibling is null.
+
+ * XmlNodeListTests.cs: Tests case where enumerator is on
+ a node that gets removed from list.
+
+ * XmlTextWriterTests.cs: Keeping tests for WriteXXX after
+ writer is closed up to date as new WriteXXX methods are written.
+ TestDocumentStart and TestWriteEndElement.
+
+2002-03-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs: Added a test to check an element's names after
+ loading.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: Tests navigation to parents since
+ that was part of a document.Load() bug reported by Mike Kestner.
+
+ * XmlTextWriterTests.cs: Tests for namespaces and prefixes.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: TestOuterXml.
+
+ * XmlTextWriterTests.cs: Tests for CData, Close, Comment, Element,
+ and ProcessingInstruction.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: More LoadXml tests.
+
+ * XmlTextWriterTests.cs: Test for invalid Processing Instructions.
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Added tests TestCData and TestComment.
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Initial checkin.
+
+2002-03-12 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeListTests.cs: New tests: TestNodeTypesThatCantHaveChildren,
+ TestZeroChildren, TestOneChild, TestMultipleChildren,
+ TestAppendChildAffectOnEnumeration, TestRemoveChildAffectOnEnumeration,
+ TestRemoveOnlyChildAffectOnEnumeration, TestCurrentBeforeFirstNode,
+ TestCurrentAfterLastNode, TestCurrentDoesntMove, and TestReset. Made
+ two other tests but not in use yet until RemoveAll is implemented for
+ attributes and XmlNode.ReplaceChild is implemented. The tests are called
+ saveTestReplaceChildAffectOnEnumeration and saveTestRemoveAllAffectOnEnumeration.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test MoveToElement and MoveToFirstAttribute.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttributeTests.cs: Test XmlAttribute child nodes.
+
+2002-03-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeListTests.cs: New file.
+
+ * AllTests.cs: Added XmlNodeListTests.
+
+2002/03/08 Nick Drochak <ndrochak@gol.com>
+
+ * System_test.build: Don't build test dll by default. Only build
+ it when 'make test' is specified.
+
+2002-03-06 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttributeTests.cs: Fixed bug in TestHasChildNodes test.
+
+ * XmlDocumentTests.cs: Started work on some tests for invalid data in
+ various nodes created by the document.
+
+2002-03-02 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: New tests TestLoadProcessingInstruction(),
+ TestLoadCDATA(), and TestLoadComment().
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlElementTests.cs: New file.
+
+ * AllTests.cs: Added XmlElementTests.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test MoveToNextAttribute().
+
+ * XmlDocumentTests.cs: Test loading document containing attributes
+ and text nodes.
+
+2002-03-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlAttributeTests.cs : New test suite for attrs.
+ * AllTests.cs : Add the attr suite.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlNamespaceManagerTests.cs: Make sure the XmlNamespaceManager
+ is using its name table.
+
+ * NameTableTests.cs: Make sure NameTable is really returning the
+ same references.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs: Tests for XmlDocument.LoadXml courtesy of
+ Kral Ferch <kral.ferch@hotmail.com>.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test for XmlException when parse fail.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * System.XML_test.build: Build new executable RunTests.System.XML.exe
+ which you can use to run the tests on Linux.
+
+ * *.cs: Added zero-args constructors.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * NameTableTests.cs: Test for System.Xml.NameTable.
+
+2002-02-26 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test for namespace declarations as
+ attributes.
+
+ * XmlNamespaceManagerTests.cs: Use the newly implemented NameTable
+ when creating the XmlNamespaceManager. Properly test HasNamespace.
+
+2002-02-25 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs: Added file.
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Added tests for qualified attributes.
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * ChangeLog: Added change log to this directory.
+
+ * Test.cs: Renamed to XmlTextReaderTests.cs.
+
+ * XmlTextReaderTests.cs: Added tests for NamespaceURI property.
+
+ * XmlNamespaceManagerTests.cs: Initial tests.
diff --git a/mcs/class/System.XML/Test/Microsoft.Test.csproj b/mcs/class/System.XML/Test/Microsoft.Test.csproj
new file mode 100644
index 00000000000..99f1015f00e
--- /dev/null
+++ b/mcs/class/System.XML/Test/Microsoft.Test.csproj
@@ -0,0 +1,162 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Microsoft.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDeclarationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTypeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSignificantWhitespaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/Mono.Test.csproj b/mcs/class/System.XML/Test/Mono.Test.csproj
new file mode 100644
index 00000000000..677a5b82388
--- /dev/null
+++ b/mcs/class/System.XML/Test/Mono.Test.csproj
@@ -0,0 +1,167 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Mono.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "Mono.System.XML"
+ Project = "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDeclarationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTypeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSignificantWhitespaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/MonoMicro.Test.csproj b/mcs/class/System.XML/Test/MonoMicro.Test.csproj
new file mode 100644
index 00000000000..88ebbc080a1
--- /dev/null
+++ b/mcs/class/System.XML/Test/MonoMicro.Test.csproj
@@ -0,0 +1,212 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{F7734143-3845-4288-B1CA-FE614FFA70F0}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "MonoMicro.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "MonoMicro.Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.XML"
+ HintPath = "..\obj\Debug\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SelectNodesTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeCollectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCharacterDataTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDeclarationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTypeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlProcessingInstructionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSignificantWhitespaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XPathNavigatorEvaluateTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XPathNavigatorMatchesTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XPathNavigatorTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/NameTableTests.cs b/mcs/class/System.XML/Test/NameTableTests.cs
new file mode 100755
index 00000000000..ee115132f44
--- /dev/null
+++ b/mcs/class/System.XML/Test/NameTableTests.cs
@@ -0,0 +1,91 @@
+//
+// System.Xml.NameTableTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class NameTableTests : TestCase
+ {
+ NameTable table;
+
+ public NameTableTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ table = new NameTable ();
+ }
+
+ //
+ // Tests System.Xml.NameTable.Add (string)
+ //
+ public void TestAdd1 ()
+ {
+ string add = "add1";
+ string testAdd = table.Add (add);
+ AssertEquals (add, testAdd);
+ AssertSame (add, testAdd);
+ }
+
+ //
+ // Tests System.Xml.NameTable.Add (char[], int, int)
+ //
+ public void TestAdd2 ()
+ {
+ char[] test = new char [4] { 'a', 'd', 'd', '2' };
+ int index = 0;
+ int length = 3; // "add"
+
+ AssertEquals ("add", table.Add (test, index, length));
+ }
+
+ //
+ // Tests System.Xml.NameTable.Get (string)
+ //
+ public void TestGet1 ()
+ {
+ string get1 = "get1";
+ string testGet = table.Add (get1);
+
+ AssertEquals (table.Get (get1), testGet);
+ AssertSame (get1, testGet );
+ }
+
+ //
+ // Tests System.Xml.NameTable.Get (char[], int, int)
+ //
+ public void TestGet2 ()
+ {
+ char[] test = new char [4] { 'g', 'e', 't', '2' };
+ int index = 0;
+ int length = 3; // "get"
+
+ string testGet = table.Add (test, index, length);
+
+ AssertEquals (table.Get (test, index, length), testGet);
+ }
+
+ //
+ // Tests System.Xml.NameTable.Get (char[], int, 0)
+ //
+ public void TestGet3 ()
+ {
+ char[] test = new char [4] { 't', 'e', 's', 't' };
+ int index = 0;
+ int length = 0;
+
+ AssertEquals (table.Get (test, index, length), String.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/SelectNodesTests.cs b/mcs/class/System.XML/Test/SelectNodesTests.cs
new file mode 100644
index 00000000000..74844240e40
--- /dev/null
+++ b/mcs/class/System.XML/Test/SelectNodesTests.cs
@@ -0,0 +1,227 @@
+//
+// MonoTests.System.Xml.SelectNodesTests
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class SelectNodesTests : TestCase
+ {
+ public SelectNodesTests () : base ("MonoTests.System.Xml.SelectNodesTests testsuite") {}
+ public SelectNodesTests (string name) : base (name) {}
+
+ public void TestRoot ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XmlNodeList nodes = document.SelectNodes ("/");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document, nodes [0]);
+ }
+
+ public void TestDocumentElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XmlNodeList nodes = document.SelectNodes ("/foo");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement, nodes [0]);
+ }
+
+ public void TestBadDocumentElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XmlNodeList nodes = document.SelectNodes ("/bar");
+ AssertEquals (0, nodes.Count);
+ }
+
+ public void TestElementWildcard ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/*");
+ AssertEquals (2, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
+ }
+
+ public void TestOneChildElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ }
+
+ public void TestOneOtherChildElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/baz");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
+ }
+
+ public void TestTextNode ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo>bar</foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/text()");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ }
+
+ public void TestSplitTextNodes ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo>bar<baz />quux</foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/text()");
+ AssertEquals (2, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ AssertSame (document.DocumentElement.ChildNodes [2], nodes [1]);
+ }
+
+ public void TestAbbreviatedParentAxis ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar/..");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement, nodes [0]);
+ }
+
+ public void TestFullParentAxis ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar/parent::node()");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement, nodes [0]);
+ }
+
+ public void TestAbbreviatedAttributeAxis ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar='baz' />");
+ XmlNodeList nodes = document.SelectNodes ("/foo/@bar");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
+ }
+
+ public void TestFullAttributeAxis ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar='baz' />");
+ XmlNodeList nodes = document.SelectNodes ("/foo/attribute::bar");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
+ }
+
+ public void TestAbbreviatedAttributeWildcard ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar='baz' quux='quuux' />");
+ XmlNodeList nodes = document.SelectNodes ("/foo/@*");
+ AssertEquals (2, nodes.Count);
+ // are the attributes guanteed to be ordered in the node list?
+ AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
+ AssertSame (document.DocumentElement.Attributes ["quux"], nodes [1]);
+ }
+
+ public void TestAttributeParent ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar='baz' />");
+ XmlNodeList nodes = document.SelectNodes ("/foo/@bar/..");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement, nodes [0]);
+ }
+
+ public void TestUnionOperator ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar|/foo/baz");
+ AssertEquals (2, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
+ }
+
+ public void TestNodeWildcard ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar />baz<quux /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/node()");
+ AssertEquals (3, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
+ AssertSame (document.DocumentElement.ChildNodes [2], nodes [2]);
+ }
+
+ public void TestPositionalPredicate ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar>1</bar><bar>2</bar></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar[1]");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+ }
+
+ public void TestAllFollowingSiblings ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /><quux /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar/following-sibling::*");
+ AssertEquals (2, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
+ AssertSame (document.DocumentElement.ChildNodes [2], nodes [1]);
+ }
+
+ public void TestFollowingSiblingBaz ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /><quux /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar/following-sibling::baz");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
+ }
+
+ public void TestFollowingSiblingQuux ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /><quux /></foo>");
+ XmlNodeList nodes = document.SelectNodes ("/foo/bar/following-sibling::quux");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement.ChildNodes [2], nodes [0]);
+ }
+
+ public void TestUnion ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XmlNodeList nodes = document.SelectNodes ("(/foo) | (/foo)");
+ AssertEquals (1, nodes.Count); // bug #27548
+ AssertSame (document.DocumentElement, nodes [0]);
+ }
+
+ public void TestAlphabetDigitMixedName ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo1 />");
+ XmlNodeList nodes = document.SelectNodes ("/foo1");
+ AssertEquals (1, nodes.Count);
+ AssertSame (document.DocumentElement, nodes [0]);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/System.XML_linux_test.args b/mcs/class/System.XML/Test/System.XML_linux_test.args
new file mode 100644
index 00000000000..728d1ed0fcd
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.XML_linux_test.args
@@ -0,0 +1,32 @@
+--target library
+-o System.XML_linux_test.dll
+--noconfig
+-r ../../lib/corlib.dll
+-r ../../lib/System.dll
+-r ../../../nunit/NUnitCore_mono.dll
+AllTests.cs
+NameTableTests.cs
+SelectNodesTests.cs
+XmlAttributeCollectionTests.cs
+XmlAttributeTests.cs
+XmlCDataSectionTests.cs
+XmlCharacterDataTests.cs
+XmlCommentTests.cs
+XmlDeclarationTests.cs
+XmlDocumentTests.cs
+XmlDocumentFragmentTests.cs
+XmlDocumentTypeTests.cs
+XmlElementTests.cs
+XmlEntityReferenceTests.cs
+XmlNamespaceManagerTests.cs
+XmlNodeListTests.cs
+XmlNodeTests.cs
+XmlProcessingInstructionTests.cs
+XmlSignificantWhitespaceTests.cs
+XmlTextReaderTests.cs
+XmlTextTests.cs
+XmlTextWriterTests.cs
+XmlWhiteSpaceTests.cs
+XPathNavigatorEvaluateTests.cs
+XPathNavigatorTests.cs
+XPathNavigatorMatchesTests.cs
diff --git a/mcs/class/System.XML/Test/System.XML_test.build b/mcs/class/System.XML/Test/System.XML_test.build
new file mode 100644
index 00000000000..7e3e2b116e3
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.XML_test.build
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.XML_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System.XML_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System.XML_test.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/r:.\System.XML.dll"/>
+ </csc>
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.System.Xml.AllTests,System.XML_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System.XML.dll" failonerror="false"/>
+ <delete file="System.XML_test.dll" failonerror="false"/>
+ <delete file="System.XML_test.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.XML/Test/TheTests.cs b/mcs/class/System.XML/Test/TheTests.cs
new file mode 100644
index 00000000000..6537bed3754
--- /dev/null
+++ b/mcs/class/System.XML/Test/TheTests.cs
@@ -0,0 +1,93 @@
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System.Xml
+{
+ public class RunXmlTextReaderTests : XmlTextReaderTests
+ {
+ protected override void RunTest ()
+ {
+ TestEmptyElement ();
+ TestEmptyElementWithWhitespace ();
+ TestEmptyElementWithStartAndEndTag ();
+ TestEmptyElementWithStartAndEndTagWithWhitespace ();
+ TestNestedEmptyTag ();
+ TestNestedText ();
+ TestEmptyElementWithAttribute ();
+ TestStartAndEndTagWithAttribute ();
+ TestEmptyElementWithTwoAttributes ();
+ TestProcessingInstructionBeforeDocumentElement ();
+ TestCommentBeforeDocumentElement ();
+ TestPredefinedEntities ();
+ TestEntityReference ();
+ TestEntityReferenceInsideText ();
+ TestCharacterReferences ();
+ TestEntityReferenceInAttribute ();
+ TestPredefinedEntitiesInAttribute ();
+ TestCharacterReferencesInAttribute ();
+ TestCDATA ();
+ TestEmptyElementInNamespace ();
+ TestEmptyElementInDefaultNamespace ();
+ TestChildElementInNamespace ();
+ TestChildElementInDefaultNamespace ();
+ TestAttributeInNamespace ();
+ TestIsName ();
+ TestIsNameToken ();
+ }
+ }
+}
+
+namespace MonoTests.System.Xml
+{
+ public class RunXmlNamespaceManagerTests : XmlNamespaceManagerTests
+ {
+ protected override void RunTest ()
+ {
+ TestNewNamespaceManager ();
+ TestAddNamespace ();
+ TestPushScope ();
+ TestPopScope ();
+ }
+ }
+}
+
+namespace MonoTests.System.Xml
+{
+ public class RunXmlDocumentTests : XmlDocumentTests
+ {
+ protected override void RunTest ()
+ {
+ TestDocumentElement ();
+ }
+ }
+}
+
+namespace MonoTests
+{
+ public class RunAllTests
+ {
+ public static void AddAllTests (TestSuite suite)
+ {
+ suite.AddTest (new MonoTests.System.Xml.RunXmlTextReaderTests ());
+ suite.AddTest (new MonoTests.System.Xml.RunXmlNamespaceManagerTests ());
+ suite.AddTest (new MonoTests.System.Xml.RunXmlDocumentTests ());
+ }
+ }
+}
+
+class MainApp
+{
+ public static void Main()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
+
+ TestResult result = new TestResult ();
+ TestSuite suite = new TestSuite ();
+ MonoTests.RunAllTests.AddAllTests (suite);
+ suite.Run (result);
+ MonoTests.MyTestRunner.Print (result);
+ }
+}
+
diff --git a/mcs/class/System.XML/Test/XPathNavigatorEvaluateTests.cs b/mcs/class/System.XML/Test/XPathNavigatorEvaluateTests.cs
new file mode 100644
index 00000000000..a3001792bf5
--- /dev/null
+++ b/mcs/class/System.XML/Test/XPathNavigatorEvaluateTests.cs
@@ -0,0 +1,212 @@
+//
+// MonoTests.System.Xml.XPathNavigatorEvaluateTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+using System.Xml.XPath;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XPathNavigatorEvaluateTests : TestCase
+ {
+ public XPathNavigatorEvaluateTests () : base ("MonoTests.System.Xml.XPathNavigatorEvaluateTests testsuite") {}
+ public XPathNavigatorEvaluateTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XPathNavigator navigator;
+ XmlDocument document2;
+ XPathNavigator navigator2;
+ XmlDocument document3;
+ XPathNavigator navigator3;
+ XPathExpression expression;
+ XPathNodeIterator iterator;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<foo><bar/><baz/><qux/><squonk/></foo>");
+ navigator = document.CreateNavigator ();
+
+ document2 = new XmlDocument ();
+ document2.LoadXml ("<foo><bar baz='1'/><bar baz='2'/><bar baz='3'/></foo>");
+ navigator2 = document2.CreateNavigator ();
+
+ document3 = new XmlDocument ();
+ document3.LoadXml ("<foo><bar/><baz/><qux/></foo>");
+ navigator3 = document3.CreateNavigator ();
+ }
+
+ // Testing Core Function Library functions defined at: http://www.w3.org/TR/xpath#corelib
+ public void TestCoreFunctionNodeSetLast ()
+ {
+ expression = navigator.Compile("last()");
+ iterator = navigator.Select("/foo");
+ AssertEquals ("0", navigator.Evaluate ("last()").ToString());
+ AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
+ AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
+ iterator = navigator.Select("/foo/*");
+ AssertEquals ("4", navigator.Evaluate (expression, iterator).ToString ());
+
+ AssertEquals("3", navigator2.Evaluate ("string(//bar[last()]/@baz)"));
+ }
+
+ public void TestCoreFunctionNodeSetPosition ()
+ {
+ expression = navigator.Compile("position()");
+ iterator = navigator.Select("/foo");
+ AssertEquals ("0", navigator.Evaluate ("position()").ToString ());
+ AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
+ AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
+ iterator = navigator.Select("/foo/*");
+ AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
+ iterator.MoveNext();
+ AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
+ iterator.MoveNext ();
+ AssertEquals ("2", navigator.Evaluate (expression, iterator).ToString ());
+ iterator.MoveNext ();
+ AssertEquals ("3", navigator.Evaluate (expression, iterator).ToString ());
+ }
+
+ public void TestCoreFunctionNodeSetCount ()
+ {
+ AssertEquals ("5", navigator.Evaluate ("count(//*)").ToString ());
+ AssertEquals ("1", navigator.Evaluate ("count(//foo)").ToString ());
+ AssertEquals ("1", navigator.Evaluate ("count(/foo)").ToString ());
+ AssertEquals ("1", navigator.Evaluate ("count(/foo/bar)").ToString ());
+
+ AssertEquals ("3", navigator2.Evaluate ("count(//bar)").ToString ());
+ }
+
+ public void saveTestCoreFunctionNodeSetID ()
+ {
+ document.LoadXml (
+ "<!DOCTYPE foo [" +
+ "<!ELEMENT foo (bar)>" +
+ "<!ELEMENT bar EMPTY>" +
+ "<!ATTLIST bar baz ID #REQUIRED>" +
+ "]>" +
+ "<foo><bar baz='1' qux='hello' /><bar baz='2' qux='world' /></foo>");
+ navigator = document.CreateNavigator();
+
+ AssertEquals ("hello", navigator.Evaluate ("string(id('1')/@qux)").ToString ());
+ AssertEquals ("world", navigator.Evaluate ("string(id('2')/@qux)").ToString ());
+ }
+
+ public void TestCoreFunctionLocalName ()
+ {
+ AssertEquals ("", navigator.Evaluate ("local-name()").ToString ());
+ AssertEquals ("", navigator.Evaluate ("local-name(/bogus)").ToString ());
+ AssertEquals ("foo", navigator.Evaluate ("local-name(/foo)").ToString ());
+ AssertEquals ("bar", navigator3.Evaluate ("local-name(/foo/*)").ToString ());
+ }
+
+ // TODO: umm. Unable to make this return a namespace-uri so far...
+ public void TestCoreFunctionNamespaceURI ()
+ {
+ document.LoadXml ("<foo:bar xmlns:foo='#foo'><foo:baz><foo:qux /></foo:baz></foo:bar>");
+ navigator = document.CreateNavigator ();
+
+ AssertEquals ("", navigator.Evaluate ("namespace-uri()").ToString ());
+ AssertEquals ("", navigator.Evaluate ("namespace-uri(/bogus)").ToString ());
+ //AssertEquals("foo", navigator.Evaluate ("namespace-uri(/bar)").ToString ());
+ AssertEquals ("", navigator2.Evaluate ("namespace-uri(//bar)").ToString ());
+ }
+
+ public void saveTestCoreFunctionString ()
+ {
+ document.LoadXml ("<foo>hello<bar>world</bar><baz>how are you</baz></foo>");
+ navigator = document.CreateNavigator ();
+
+ AssertEquals ("world", navigator.Evaluate ("string(/foo/*)").ToString ());
+ AssertEquals ("NaN", navigator.Evaluate ("string(0 div 0)").ToString ());
+
+ try {
+ navigator.Evaluate ("string(+0)");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ AssertEquals ("0", navigator.Evaluate ("string(-0)").ToString ());
+ AssertEquals ("Infinity", navigator.Evaluate ("string(1 div 0)").ToString ());
+ AssertEquals ("-Infinity", navigator.Evaluate ("string(-1 div 0)").ToString ());
+ AssertEquals ("45", navigator.Evaluate ("string(45)").ToString ());
+ AssertEquals ("-22", navigator.Evaluate ("string(-22)").ToString ());
+ AssertEquals ("0.25", navigator.Evaluate ("string(.25)").ToString ());
+ AssertEquals ("-0.25", navigator.Evaluate ("string(-.25)").ToString ());
+ AssertEquals ("2", navigator.Evaluate ("string(2.0)").ToString ());
+ AssertEquals ("2.01", navigator.Evaluate ("string(2.01)").ToString ());
+ AssertEquals ("-3", navigator.Evaluate ("string(-3.0)").ToString ());
+ AssertEquals ("3.45", navigator.Evaluate ("string(3.45)").ToString ());
+
+ // Wonder what this will look like under a different platform.
+ AssertEquals("0.33333333333333331", navigator.Evaluate ("string(1 div 3)").ToString ());
+ }
+
+ public void TestCoreFunctionConcat ()
+ {
+ try {
+ navigator.Evaluate ("concat()");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ try {
+ navigator.Evaluate ("concat('foo')");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ AssertEquals ("foobar", navigator.Evaluate ("concat('foo', 'bar')").ToString ());
+ AssertEquals ("foobarbaz", navigator.Evaluate ("concat('foo', 'bar', 'baz')").ToString ());
+ AssertEquals ("foobarbazqux", navigator.Evaluate ("concat('foo', 'bar', 'baz', 'qux')").ToString ());
+ AssertEquals ("foobarbazquxquux", navigator.Evaluate ("concat('foo', 'bar', 'baz', 'qux', 'quux')").ToString ());
+ }
+
+ public void TestCoreFunctionStartsWith ()
+ {
+ try {
+ navigator.Evaluate ("starts-with()");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ try {
+ navigator.Evaluate ("starts-with('foo')");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ try {
+ navigator.Evaluate ("starts-with('foo', 'bar', 'baz')");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ Assert ((bool)navigator.Evaluate ("starts-with('foobar', 'foo')"));
+ Assert (!(bool)navigator.Evaluate ("starts-with('foobar', 'bar')"));
+ }
+
+ public void TestCoreFunctionContains ()
+ {
+ try {
+ navigator.Evaluate ("contains()");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ try {
+ navigator.Evaluate ("contains('foo')");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ try {
+ navigator.Evaluate ("contains('foobar', 'oob', 'baz')");
+ Fail ("Expected an XPathException to be thrown.");
+ } catch (XPathException) {}
+
+ Assert ((bool)navigator.Evaluate ("contains('foobar', 'oob')"));
+ Assert (!(bool)navigator.Evaluate ("contains('foobar', 'baz')"));
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XPathNavigatorMatchesTests.cs b/mcs/class/System.XML/Test/XPathNavigatorMatchesTests.cs
new file mode 100644
index 00000000000..a844d80c6b4
--- /dev/null
+++ b/mcs/class/System.XML/Test/XPathNavigatorMatchesTests.cs
@@ -0,0 +1,116 @@
+//
+// MonoTests.System.Xml.XPathNavigatorMatchesTests
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond
+//
+
+using System;
+using System.Xml;
+using System.Xml.XPath;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XPathNavigatorMatchesTests : TestCase
+ {
+ public XPathNavigatorMatchesTests () : base ("MonoTests.System.Xml.XPathNavigatorMatchesTests testsuite") {}
+ public XPathNavigatorMatchesTests (string name) : base (name) {}
+
+ public void TestMatchRoot ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XPathNavigator navigator = document.CreateNavigator ();
+
+ Assert (navigator.Matches ("/"));
+ }
+
+ public void TestFalseMatchRoot ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XPathNavigator navigator = document.CreateNavigator ();
+
+ Assert (!navigator.Matches ("foo"));
+ }
+
+ public void TestMatchDocumentElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ Assert (navigator.Matches ("foo"));
+ }
+
+ public void TestMatchAbsoluteDocumentElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ Assert (navigator.Matches ("/foo"));
+ }
+
+ public void TestMatchDocumentElementChild ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /></foo>");
+ XPathNavigator navigator = document.DocumentElement.FirstChild.CreateNavigator ();
+
+ Assert (navigator.Matches ("bar"));
+ Assert (navigator.Matches ("foo/bar"));
+ }
+
+ public void TestMatchAttribute ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar='baz' />");
+ XPathNavigator navigator = document.DocumentElement.Attributes[0].CreateNavigator ();
+
+ Assert (navigator.Matches ("@bar"));
+ Assert (navigator.Matches ("foo/@bar"));
+ }
+
+ public void TestSlashSlash ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar><baz/></bar></foo>");
+ XPathNavigator navigator = document.DocumentElement.FirstChild.FirstChild.CreateNavigator ();
+
+ Assert (navigator.Matches ("foo//baz"));
+ }
+
+ public void TestAbsoluteSlashSlash ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar><baz/></bar></foo>");
+ XPathNavigator navigator = document.DocumentElement.FirstChild.FirstChild.CreateNavigator ();
+
+ Assert (navigator.Matches ("//baz"));
+ }
+
+ public void TestMatchDocumentElementWithPredicate ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /></foo>");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ Assert (navigator.Matches ("foo[bar]"));
+ }
+
+ public void TestFalseMatchDocumentElementWithPredicate ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /></foo>");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ Assert (!navigator.Matches ("foo[baz]"));
+ }
+ }
+}
+
diff --git a/mcs/class/System.XML/Test/XPathNavigatorTests.cs b/mcs/class/System.XML/Test/XPathNavigatorTests.cs
new file mode 100644
index 00000000000..837b92430e5
--- /dev/null
+++ b/mcs/class/System.XML/Test/XPathNavigatorTests.cs
@@ -0,0 +1,172 @@
+//
+// MonoTests.System.Xml.XPathNavigatorTests
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond
+//
+
+using System;
+using System.Xml;
+using System.Xml.XPath;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XPathNavigatorTests : TestCase
+ {
+ public XPathNavigatorTests () : base ("MonoTests.System.Xml.XPathNavigatorTests testsuite") {}
+ public XPathNavigatorTests (string name) : base (name) {}
+
+ public void TestCreateNavigator ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo />");
+ XPathNavigator navigator = document.CreateNavigator ();
+ AssertNotNull (navigator);
+ }
+
+ public void TestPropertiesOnDocument ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo:bar xmlns:foo='#foo' />");
+ XPathNavigator navigator = document.CreateNavigator ();
+
+ AssertEquals (XPathNodeType.Root, navigator.NodeType);
+ AssertEquals (String.Empty, navigator.Name);
+ AssertEquals (String.Empty, navigator.LocalName);
+ AssertEquals (String.Empty, navigator.NamespaceURI);
+ AssertEquals (String.Empty, navigator.Prefix);
+ Assert (!navigator.HasAttributes);
+ Assert (navigator.HasChildren);
+ Assert (!navigator.IsEmptyElement);
+ }
+
+ public void TestPropertiesOnElement ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo:bar xmlns:foo='#foo' />");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ AssertEquals (XPathNodeType.Element, navigator.NodeType);
+ AssertEquals ("foo:bar", navigator.Name);
+ AssertEquals ("bar", navigator.LocalName);
+ AssertEquals ("#foo", navigator.NamespaceURI);
+ AssertEquals ("foo", navigator.Prefix);
+ Assert (!navigator.HasAttributes);
+ Assert (!navigator.HasChildren);
+ Assert (navigator.IsEmptyElement);
+ }
+
+ public void TestPropertiesOnAttribute ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar:baz='quux' xmlns:bar='#bar' />");
+ XPathNavigator navigator = document.DocumentElement.GetAttributeNode("baz", "#bar").CreateNavigator ();
+
+ AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
+ AssertEquals ("bar:baz", navigator.Name);
+ AssertEquals ("baz", navigator.LocalName);
+ AssertEquals ("#bar", navigator.NamespaceURI);
+ AssertEquals ("bar", navigator.Prefix);
+ Assert (!navigator.HasAttributes);
+ Assert (!navigator.HasChildren);
+ Assert (!navigator.IsEmptyElement);
+ }
+
+ public void TestNavigation ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar /><baz /></foo>");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ AssertEquals ("foo", navigator.Name);
+ Assert (navigator.MoveToFirstChild ());
+ AssertEquals ("bar", navigator.Name);
+ Assert (navigator.MoveToNext ());
+ AssertEquals ("baz", navigator.Name);
+ Assert (!navigator.MoveToNext ());
+ AssertEquals ("baz", navigator.Name);
+ Assert (navigator.MoveToPrevious ());
+ AssertEquals ("bar", navigator.Name);
+ Assert (!navigator.MoveToPrevious ());
+ Assert (navigator.MoveToParent ());
+ AssertEquals ("foo", navigator.Name);
+ navigator.MoveToRoot ();
+ AssertEquals (XPathNodeType.Root, navigator.NodeType);
+ Assert (!navigator.MoveToParent ());
+ AssertEquals (XPathNodeType.Root, navigator.NodeType);
+ Assert (navigator.MoveToFirstChild ());
+ AssertEquals ("foo", navigator.Name);
+ Assert (navigator.MoveToFirst ());
+ AssertEquals ("foo", navigator.Name);
+ Assert (navigator.MoveToFirstChild ());
+ AssertEquals ("bar", navigator.Name);
+ Assert (navigator.MoveToNext ());
+ AssertEquals ("baz", navigator.Name);
+ Assert (navigator.MoveToFirst ());
+ AssertEquals ("bar", navigator.Name);
+ }
+
+ public void TestMoveToAndIsSamePosition ()
+ {
+ XmlDocument document1 = new XmlDocument ();
+ document1.LoadXml ("<foo><bar /></foo>");
+ XPathNavigator navigator1a = document1.DocumentElement.CreateNavigator ();
+ XPathNavigator navigator1b = document1.DocumentElement.CreateNavigator ();
+
+ XmlDocument document2 = new XmlDocument ();
+ document2.LoadXml ("<foo><bar /></foo>");
+ XPathNavigator navigator2 = document2.DocumentElement.CreateNavigator ();
+
+ AssertEquals ("foo", navigator1a.Name);
+ Assert (navigator1a.MoveToFirstChild ());
+ AssertEquals ("bar", navigator1a.Name);
+
+ Assert (!navigator1b.IsSamePosition (navigator1a));
+ AssertEquals ("foo", navigator1b.Name);
+ Assert (navigator1b.MoveTo (navigator1a));
+ Assert (navigator1b.IsSamePosition (navigator1a));
+ AssertEquals ("bar", navigator1b.Name);
+
+ Assert (!navigator2.IsSamePosition (navigator1a));
+ AssertEquals ("foo", navigator2.Name);
+ Assert (!navigator2.MoveTo (navigator1a));
+ AssertEquals ("foo", navigator2.Name);
+ }
+
+ public void TestAttributeNavigation ()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo bar='baz' quux='quuux' />");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ AssertEquals (XPathNodeType.Element, navigator.NodeType);
+ AssertEquals ("foo", navigator.Name);
+ Assert (navigator.MoveToFirstAttribute ());
+ AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
+ AssertEquals ("bar", navigator.Name);
+ AssertEquals ("baz", navigator.Value);
+ Assert (navigator.MoveToNextAttribute ());
+ AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
+ AssertEquals ("quux", navigator.Name);
+ AssertEquals ("quuux", navigator.Value);
+ }
+
+ public void TestElementAndRootValues()
+ {
+ XmlDocument document = new XmlDocument ();
+ document.LoadXml ("<foo><bar>baz</bar><quux>quuux</quux></foo>");
+ XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
+
+ AssertEquals (XPathNodeType.Element, navigator.NodeType);
+ AssertEquals ("foo", navigator.Name);
+ //AssertEquals ("bazquuux", navigator.Value);
+
+ navigator.MoveToRoot ();
+ //AssertEquals ("bazquuux", navigator.Value);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs b/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs
new file mode 100644
index 00000000000..774344fe106
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs
@@ -0,0 +1,149 @@
+// XmlAttributeCollectionTests.cs : Tests for the XmlAttributeCollection class
+//
+// Author: Matt Hunter <xrkune@tconl.com>
+//
+// <c> 2002 Matt Hunter
+
+using System;
+using System.Xml;
+using System.Text;
+using System.IO;
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlAttributeCollectionTests : TestCase
+ {
+ public XmlAttributeCollectionTests() : base("MonoTests.System.Xml.XmlAttributeCollectionTests testsuite") { }
+ public XmlAttributeCollectionTests(string name) : base(name) { }
+
+ private XmlDocument document;
+
+ protected override void SetUp()
+ {
+ document = new XmlDocument ();
+ }
+ public void TestRemoveAll ()
+ {
+ StringBuilder xml = new StringBuilder ();
+ xml.Append ("<?xml version=\"1.0\" ?><library><book type=\"non-fiction\" price=\"34.95\"> ");
+ xml.Append ("<title type=\"intro\">XML Fun</title> " );
+ xml.Append ("<author>John Doe</author></book></library>");
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml.ToString ()));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList bookList = document.GetElementsByTagName ("book");
+ XmlNode xmlNode = bookList.Item (0);
+ XmlElement xmlElement = xmlNode as XmlElement;
+ XmlAttributeCollection attributes = xmlElement.Attributes;
+ attributes.RemoveAll ();
+ AssertEquals ("not all attributes removed.", false, xmlElement.HasAttribute ("type"));
+ }
+
+ public void TestAppend ()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ XmlElement xmlEl = xmlDoc.CreateElement ("TestElement");
+ XmlAttribute xmlAttribute = xmlEl.SetAttributeNode ("attr1", "namespace1");
+ XmlNode xmlNode = xmlDoc.CreateNode (XmlNodeType.Attribute, "attr3", "namespace1");
+ XmlAttribute xmlAttribute3 = xmlNode as XmlAttribute;
+ XmlAttributeCollection attributeCol = xmlEl.Attributes;
+ xmlAttribute3 = attributeCol.Append (xmlAttribute3);
+ AssertEquals ("attribute name not properly created.", true, xmlAttribute3.Name.Equals ("attr3"));
+ AssertEquals ("attribute namespace not properly created.", true, xmlAttribute3.NamespaceURI.Equals ("namespace1"));
+ }
+
+ public void TestCopyTo ()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ xmlDoc.LoadXml("<root a1='garnet' a2='amethyst' a3='Bloodstone' a4='diamond' a5='emerald' a6='pearl' a7='ruby' a8='sapphire' a9='moonstone' a10='opal' a11='topaz' a12='turquoize' />");
+ XmlAttributeCollection col = xmlDoc.DocumentElement.Attributes;
+ XmlAttribute[] array = new XmlAttribute[24];
+ col.CopyTo(array, 0);
+ AssertEquals("garnet", array[0].Value);
+ AssertEquals("moonstone", array[8].Value);
+ AssertEquals("turquoize", array[11].Value);
+ col.CopyTo(array, 12);
+ AssertEquals("garnet", array[12].Value);
+ AssertEquals("moonstone", array[20].Value);
+ AssertEquals("turquoize", array[23].Value);
+ }
+
+ public void TestSetNamedItem ()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ xmlDoc.LoadXml("<root />");
+ XmlElement el = xmlDoc.DocumentElement;
+ XmlAttributeCollection col = xmlDoc.DocumentElement.Attributes;
+
+ XmlAttribute attr = xmlDoc.CreateAttribute("b3");
+ attr.Value = "bloodstone";
+ col.SetNamedItem(attr);
+ AssertEquals("SetNamedItem.Normal", "bloodstone", el.GetAttribute("b3"));
+
+ attr = xmlDoc.CreateAttribute("b3");
+ attr.Value = "aquamaline";
+ col.SetNamedItem(attr);
+ AssertEquals("SetNamedItem.Override", "aquamaline", el.GetAttribute("b3"));
+ AssertEquals("SetNamedItem.Override.Count.1", 1, el.Attributes.Count);
+ AssertEquals("SetNamedItem.Override.Count.2", 1, col.Count);
+ }
+
+ public void TestInsertBeforeAfterPrepend ()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ xmlDoc.LoadXml("<root b2='amethyst' />");
+ XmlElement el = xmlDoc.DocumentElement;
+ XmlAttributeCollection col = xmlDoc.DocumentElement.Attributes;
+ XmlAttribute attr = xmlDoc.CreateAttribute("b1");
+ attr.Value = "garnet";
+ col.InsertAfter(attr, null);
+ AssertEquals("InsertAfterNull", "garnet", el.GetAttributeNode("b1").Value);
+ AssertEquals("InsertAfterNull.Pos", el.GetAttribute("b1"), col[0].Value);
+
+ attr = xmlDoc.CreateAttribute("b3");
+ attr.Value = "bloodstone";
+ col.InsertAfter(attr, el.GetAttributeNode("b2"));
+ AssertEquals("InsertAfterAttr", "bloodstone", el.GetAttributeNode("b3").Value);
+ AssertEquals("InsertAfterAttr.Pos", el.GetAttribute("b3"), col[2].Value);
+
+ attr = xmlDoc.CreateAttribute("b4");
+ attr.Value = "diamond";
+ col.InsertBefore(attr, null);
+ AssertEquals("InsertBeforeNull", "diamond", el.GetAttributeNode("b4").Value);
+ AssertEquals("InsertBeforeNull.Pos", el.GetAttribute("b4"), col[3].Value);
+
+ attr = xmlDoc.CreateAttribute("warning");
+ attr.Value = "mixed modern and traditional;-)";
+ col.InsertBefore(attr, el.GetAttributeNode("b1"));
+ AssertEquals("InsertBeforeAttr", "mixed modern and traditional;-)", el.GetAttributeNode("warning").Value);
+ AssertEquals("InsertBeforeAttr.Pos", el.GetAttributeNode("warning").Value, col[0].Value);
+
+ attr = xmlDoc.CreateAttribute("about");
+ attr.Value = "lists of birthstone.";
+ col.Prepend(attr);
+ AssertEquals("Prepend", "lists of birthstone.", col[0].Value);
+ }
+
+ public void TestRemove ()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ xmlDoc.LoadXml("<root a1='garnet' a2='amethyst' a3='bloodstone' a4='diamond' a5='emerald' a6='pearl' a7='ruby' a8='sapphire' a9='moonstone' a10='opal' a11='topaz' a12='turquoize' />");
+ XmlElement el = xmlDoc.DocumentElement;
+ XmlAttributeCollection col = el.Attributes;
+
+ // Remove
+ XmlAttribute attr = col.Remove(el.GetAttributeNode("a12"));
+ AssertEquals("Remove", 11, col.Count);
+ AssertEquals("Remove.Removed", "a12", attr.Name);
+
+ // RemoveAt
+ attr = col.RemoveAt(5);
+ AssertEquals("RemoveAt", null, el.GetAttributeNode("a6"));
+ AssertEquals("Remove.Removed", "pearl", attr.Value);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlAttributeTests.cs b/mcs/class/System.XML/Test/XmlAttributeTests.cs
new file mode 100644
index 00000000000..404be564fec
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlAttributeTests.cs
@@ -0,0 +1,124 @@
+// XmlAttributeTests.cs : Tests for the XmlAttribute class
+//
+// Author: Mike Kestner <mkestner@speakeasy.net>
+//
+// <c> 2002 Mike Kestner
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlAttributeTests : TestCase
+ {
+ public XmlAttributeTests () : base("MonoTests.System.Xml.XmlAttributeTests testsuite") { }
+ public XmlAttributeTests (string name) : base(name) { }
+
+ XmlDocument doc;
+ XmlAttribute attr;
+
+ protected override void SetUp()
+ {
+ doc = new XmlDocument ();
+ attr = doc.CreateAttribute ("attr1");
+ attr.Value = "val1";
+ }
+
+ public void TestAttributes ()
+ {
+ AssertNull (attr.Attributes);
+ }
+
+ public void TestAttributeInnerAndOuterXml ()
+ {
+ attr = doc.CreateAttribute ("foo", "bar", "http://abc.def");
+ attr.Value = "baz";
+ AssertEquals ("baz", attr.InnerXml);
+ AssertEquals ("foo:bar=\"baz\"", attr.OuterXml);
+ }
+
+ public void TestAttributeWithNoValue ()
+ {
+ XmlAttribute attribute = doc.CreateAttribute ("name");
+ AssertEquals (String.Empty, attribute.Value);
+ Assert (!attribute.HasChildNodes);
+ AssertNull (attribute.FirstChild);
+ AssertNull (attribute.LastChild);
+ AssertEquals (0, attribute.ChildNodes.Count);
+ }
+
+ public void TestAttributeWithValue ()
+ {
+ XmlAttribute attribute = doc.CreateAttribute ("name");
+ attribute.Value = "value";
+ AssertEquals ("value", attribute.Value);
+ Assert (attribute.HasChildNodes);
+ AssertNotNull (attribute.FirstChild);
+ AssertNotNull (attribute.LastChild);
+ AssertEquals (1, attribute.ChildNodes.Count);
+ AssertEquals (XmlNodeType.Text, attribute.ChildNodes [0].NodeType);
+ AssertEquals ("value", attribute.ChildNodes [0].Value);
+ }
+
+ public void TestHasChildNodes ()
+ {
+ Assert (attr.HasChildNodes);
+ }
+
+ public void TestName ()
+ {
+ AssertEquals ("attr1", attr.Name);
+ }
+
+ public void TestNodeType ()
+ {
+ AssertEquals (XmlNodeType.Attribute, attr.NodeType);
+ }
+
+ public void TestOwnerDocument ()
+ {
+ AssertSame (doc, attr.OwnerDocument);
+ }
+
+ public void TestParentNode ()
+ {
+ AssertNull ("Attr parents not allowed", attr.ParentNode);
+ }
+
+ public void TestValue ()
+ {
+ AssertEquals ("val1", attr.Value);
+ }
+
+ public void TestSetInnerTextAndXml ()
+ {
+ string original = doc.OuterXml;
+ doc.LoadXml ("<root name='value' />");
+ XmlNodeChangedEventHandler eh = new XmlNodeChangedEventHandler (OnSetInnerText);
+ try {
+ doc.DocumentElement.Attributes ["name"].InnerText = "a&b";
+ AssertEquals ("setInnerText", "a&b", doc.DocumentElement.Attributes ["name"].Value);
+ doc.DocumentElement.Attributes ["name"].InnerXml = "a&amp;b";
+ AssertEquals ("setInnerXml", "a&b", doc.DocumentElement.Attributes ["name"].Value);
+
+ doc.NodeChanged += eh;
+ doc.DocumentElement.Attributes ["name"].InnerText = "fire";
+ // If you failed to pass it, then the reason may be loop of event.
+ AssertEquals ("setInnerText.Event", "event was fired", doc.DocumentElement.GetAttribute ("appended"));
+ } catch(Exception ex) {
+ Fail(ex.Message);
+ } finally {
+ doc.LoadXml (original);
+ doc.NodeChanged -= eh;
+ }
+ }
+
+ public void OnSetInnerText (object o, XmlNodeChangedEventArgs e)
+ {
+ if(e.NewParent.Value == "fire")
+ doc.DocumentElement.SetAttribute ("appended", "event was fired");
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlCDataSectionTests.cs b/mcs/class/System.XML/Test/XmlCDataSectionTests.cs
new file mode 100755
index 00000000000..dad1050fcf6
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCDataSectionTests.cs
@@ -0,0 +1,99 @@
+//
+// System.Xml.XmlCDataSectionTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlCDataSectionTests : TestCase
+ {
+ XmlDocument document;
+ XmlCDataSection section;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlCDataSectionTests ()
+ : base ("MonoTests.System.Xml.XmlCDataSectionTests testsuite")
+ {
+ }
+
+ public XmlCDataSectionTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ section = document.CreateCDataSection ("CDataSection");
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+ // AssertEquals (original.nodetype + " was incorrectly cloned.",
+ // original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlCDataSectionInnerAndOuterXml ()
+ {
+ section = document.CreateCDataSection ("foo");
+ AssertEquals (String.Empty, section.InnerXml);
+ AssertEquals ("<![CDATA[foo]]>", section.OuterXml);
+ }
+
+ public void TestXmlCDataSectionName ()
+ {
+ AssertEquals (section.NodeType + " Name property broken",
+ section.Name, "#cdata-section");
+ }
+
+ public void TestXmlCDataSectionLocalName ()
+ {
+ AssertEquals (section.NodeType + " LocalName property broken",
+ section.LocalName, "#cdata-section");
+ }
+
+ public void TestXmlCDataSectionNodeType ()
+ {
+ AssertEquals ("XmlCDataSection NodeType property broken",
+ section.NodeType.ToString (), "CDATA");
+ }
+
+ public void TestXmlCDataSectionIsReadOnly ()
+ {
+ AssertEquals ("XmlCDataSection IsReadOnly property broken",
+ section.IsReadOnly, false);
+ }
+
+ public void TestXmlCDataSectionCloneNode ()
+ {
+ original = section;
+
+ shallow = section.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, shallow.Value);
+
+ deep = section.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, deep.Value);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlCharacterDataTests.cs b/mcs/class/System.XML/Test/XmlCharacterDataTests.cs
new file mode 100644
index 00000000000..1fbe0b8295c
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCharacterDataTests.cs
@@ -0,0 +1,175 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlCharacterDataTests : TestCase
+ {
+ public XmlCharacterDataTests () : base ("MonoTests.System.Xml.XmlCharacterDataTests testsuite") {}
+ public XmlCharacterDataTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlComment comment;
+ bool changed;
+ bool changing;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.NodeChanged += new XmlNodeChangedEventHandler (this.EventNodeChanged);
+ document.NodeChanging += new XmlNodeChangedEventHandler (this.EventNodeChanging);
+ comment = document.CreateComment ("foo");
+ }
+
+ private void EventNodeChanged(Object sender, XmlNodeChangedEventArgs e)
+ {
+ changed = true;
+ }
+
+ private void EventNodeChanging (Object sender, XmlNodeChangedEventArgs e)
+ {
+ changing = true;
+ }
+
+ public void TestAppendData ()
+ {
+ changed = false;
+ changing = false;
+ comment.AppendData ("bar");
+ Assert (changed);
+ Assert (changing);
+ AssertEquals ("foobar", comment.Data);
+
+ comment.Value = "foo";
+ comment.AppendData (null);
+ AssertEquals ("foo", comment.Data);
+ }
+
+ public void TestDeleteData ()
+ {
+ comment.Value = "bar";
+ changed = false;
+ changing = false;
+ comment.DeleteData (1, 1);
+ Assert (changed);
+ Assert (changing);
+ AssertEquals ("br", comment.Data);
+
+ try
+ {
+ comment.Value = "foo";
+ comment.DeleteData(-1, 1);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ comment.Value = "foo";
+ comment.DeleteData(1, 5);
+ AssertEquals("f", comment.Data);
+
+ comment.Value = "foo";
+ comment.DeleteData(3, 10);
+ AssertEquals("foo", comment.Data);
+ }
+
+ public void TestInsertData ()
+ {
+ comment.Value = "foobaz";
+ changed = false;
+ changing = false;
+ comment.InsertData (3, "bar");
+ Assert (changed);
+ Assert (changing);
+ AssertEquals ("foobarbaz", comment.Data);
+
+ try
+ {
+ comment.Value = "foo";
+ comment.InsertData (-1, "bar");
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ comment.Value = "foo";
+ comment.InsertData (3, "bar");
+ AssertEquals ("foobar", comment.Data);
+
+ try
+ {
+ comment.Value = "foo";
+ comment.InsertData (4, "bar");
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ try
+ {
+ comment.Value = "foo";
+ comment.InsertData (1, null);
+ Fail ("Expected an ArgumentNullException to be thrown.");
+ }
+ catch (ArgumentNullException) {}
+ }
+
+ public void TestReplaceData ()
+ {
+ changed = false;
+ changing = false;
+ comment.ReplaceData (0, 3, "bar");
+ Assert (changed);
+ Assert (changing);
+ AssertEquals ("bar", comment.Data);
+
+ comment.Value = "foo";
+ comment.ReplaceData (2, 3, "bar");
+ AssertEquals ("fobar", comment.Data);
+
+ comment.Value = "foo";
+ comment.ReplaceData (3, 3, "bar");
+ AssertEquals ("foobar", comment.Data);
+
+ try
+ {
+ comment.Value = "foo";
+ comment.ReplaceData (4, 3, "bar");
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ try
+ {
+ comment.Value = "foo";
+ comment.ReplaceData (-1, 3, "bar");
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ comment.Value = "foo";
+ comment.ReplaceData (0, 2, "bar");
+ AssertEquals ("baro", comment.Data);
+
+ comment.Value = "foo";
+ comment.ReplaceData (0, 5, "bar");
+ AssertEquals ("bar", comment.Data);
+
+ try
+ {
+ comment.Value = "foo";
+ comment.ReplaceData (1, 1, null);
+ Fail ("Expected an ArgumentNullException to be thrown.");
+ }
+ catch (ArgumentNullException) {}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlCommentTests.cs b/mcs/class/System.XML/Test/XmlCommentTests.cs
new file mode 100755
index 00000000000..77ff9abe1b7
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCommentTests.cs
@@ -0,0 +1,107 @@
+//
+// System.Xml.XmlCommentTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlCommentTests : TestCase
+ {
+ XmlDocument document;
+ XmlComment comment;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlCommentTests () : base ("MonoTests.System.Xml.XmlCommentTests testsuite") {}
+
+ public XmlCommentTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestXmlCommentCloneNode ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ original = comment;
+
+ shallow = comment.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = comment.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, deep.Value);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+
+ public void TestXmlCommentInnerAndOuterXml ()
+ {
+ comment = document.CreateComment ("foo");
+ AssertEquals (String.Empty, comment.InnerXml);
+ AssertEquals ("<!--foo-->", comment.OuterXml);
+ }
+
+ public void TestXmlCommentIsReadOnly ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals ("XmlComment IsReadOnly property broken",
+ comment.IsReadOnly, false);
+ }
+
+ public void TestXmlCommentLocalName ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals (comment.NodeType + " LocalName property broken",
+ comment.LocalName, "#comment");
+ }
+
+ public void TestXmlCommentName ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals (comment.NodeType + " Name property broken",
+ comment.Name, "#comment");
+ }
+
+ public void TestXmlCommentNodeType ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals ("XmlComment NodeType property broken",
+ comment.NodeType.ToString (), "Comment");
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+
+ // assertequals (original.nodetype + " was incorrectly cloned.",
+ // original.baseuri, cloned.baseuri);
+
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, cloned.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDeclarationTests.cs b/mcs/class/System.XML/Test/XmlDeclarationTests.cs
new file mode 100755
index 00000000000..5445f9ae624
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDeclarationTests.cs
@@ -0,0 +1,153 @@
+//
+// System.Xml.XmlDeclarationTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlDeclarationTests : TestCase
+ {
+
+ XmlDocument document;
+ XmlDeclaration declaration;
+
+ public XmlDeclarationTests () : base ("MonoTests.System.Xml.XmlDeclarationTests testsuite") {}
+
+ public XmlDeclarationTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<foo><bar></bar></foo>");
+ declaration = document.CreateXmlDeclaration ("1.0", null, null);
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ declaration = document.CreateXmlDeclaration ("1.0", null, null);
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\"?>", declaration.OuterXml);
+
+ declaration = document.CreateXmlDeclaration ("1.0", "doesn't check", null);
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"doesn't check\"?>", declaration.OuterXml);
+
+ declaration = document.CreateXmlDeclaration ("1.0", null, "yes");
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", declaration.OuterXml);
+
+ declaration = document.CreateXmlDeclaration ("1.0", "foo", "no");
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"foo\" standalone=\"no\"?>", declaration.OuterXml);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, cloned.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestConstructor ()
+ {
+ try {
+ XmlDeclaration broken = document.CreateXmlDeclaration ("2.0", null, null);
+ } catch (ArgumentException) {
+ return;
+
+ } catch (Exception e) {
+ Fail("first arg null, wrong exception: " + e.ToString());
+ }
+ }
+
+ public void TestNodeType ()
+ {
+ AssertEquals ("incorrect NodeType returned", XmlNodeType.XmlDeclaration, declaration.NodeType);
+ }
+
+ public void TestNames ()
+ {
+ AssertEquals ("Name is incorrect", "xml", declaration.Name);
+ AssertEquals ("LocalName is incorrect", "xml", declaration.LocalName);
+ }
+
+ public void TestEncodingProperty ()
+ {
+ XmlDeclaration d1 = document.CreateXmlDeclaration ("1.0", "foo", null);
+ AssertEquals ("Encoding property", "foo", d1.Encoding);
+
+ XmlDeclaration d2 = document.CreateXmlDeclaration ("1.0", null, null);
+ AssertEquals ("null Encoding property", String.Empty, d2.Encoding);
+ }
+
+ public void TestStandaloneProperty ()
+ {
+ XmlDeclaration d1 = document.CreateXmlDeclaration ("1.0", null, "yes");
+ AssertEquals ("Yes standalone property", "yes", d1.Standalone);
+
+ XmlDeclaration d2 = document.CreateXmlDeclaration ("1.0", null, "no");
+ AssertEquals ("No standalone property", "no", d2.Standalone);
+
+ XmlDeclaration d3 = document.CreateXmlDeclaration ("1.0", null, null);
+ AssertEquals ("null Standalone property", String.Empty, d3.Standalone);
+ }
+
+ public void TestValueProperty ()
+ {
+ string expected = "version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+
+ XmlDeclaration d = document.CreateXmlDeclaration ("1.0", "ISO-8859-1", "yes");
+ AssertEquals ("Value property", expected, d.Value);
+
+ d.Value = expected;
+ AssertEquals ("Value round-trip", expected, d.Value);
+
+ d.Value = " " + expected;
+ AssertEquals ("Value round-trip (padded)", expected, d.Value);
+
+ d.Value = "version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+ AssertEquals ("Value round-trip (padded 2)", expected, d.Value);
+
+ d.Value = "version=\"1.0\"\tencoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+ AssertEquals ("Value round-trip (\\t)", expected, d.Value);
+
+ d.Value = "version=\"1.0\"\n encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
+ AssertEquals ("Value round-trip (\\n)", expected, d.Value);
+
+ d.Value = "version=\"1.0\" encoding = \"ISO-8859-1\" standalone = \"yes\"" ;
+ AssertEquals ("Value round-trip (spaces)", expected, d.Value);
+
+ d.Value = "version='1.0' encoding='ISO-8859-1' standalone='yes'" ;
+ AssertEquals ("Value round-trip ('s)", expected, d.Value);
+
+ }
+
+ public void TestXmlCommentCloneNode ()
+ {
+ XmlNode original = declaration;
+
+ XmlNode shallow = declaration.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ XmlNode deep = declaration.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDocumentFragmentTests.cs b/mcs/class/System.XML/Test/XmlDocumentFragmentTests.cs
new file mode 100755
index 00000000000..4c9699f5dcb
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDocumentFragmentTests.cs
@@ -0,0 +1,93 @@
+//
+// System.Xml.XmlDocumentFragment.cs
+//
+// Author: Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+//
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlDocumentFragmentTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocumentFragment fragment;
+
+ public XmlDocumentFragmentTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestConstructor ()
+ {
+ XmlDocument d = new XmlDocument ();
+ XmlDocumentFragment df = d.CreateDocumentFragment ();
+ AssertEquals ("#Constructor.NodeName", "#document-fragment", df.Name);
+ AssertEquals ("#Constructor.NodeType", XmlNodeType.DocumentFragment, df.NodeType);
+ }
+
+ public void TestAppendChildToFragment ()
+ {
+ document = new XmlDocument ();
+ fragment = document.CreateDocumentFragment ();
+ document.LoadXml ("<html><head></head><body></body></html>");
+ XmlElement el = document.CreateElement ("p");
+ el.InnerXml = "Test Paragraph";
+
+ // appending element to fragment
+ fragment.AppendChild (el);
+ AssertNotNull ("#AppendChildToFragment.Element", fragment.FirstChild);
+ AssertNotNull ("#AppendChildToFragment.Element.Children", fragment.FirstChild.FirstChild);
+ AssertEquals ("#AppendChildToFragment.Element.Child.Text", "Test Paragraph", fragment.FirstChild.FirstChild.Value);
+ }
+
+ public void TestAppendFragmentToElement ()
+ {
+ document = new XmlDocument ();
+ fragment = document.CreateDocumentFragment ();
+ document.LoadXml ("<html><head></head><body></body></html>");
+ XmlElement body = document.DocumentElement.LastChild as XmlElement;
+ fragment.AppendChild (document.CreateElement ("p"));
+ fragment.AppendChild (document.CreateElement ("div"));
+
+ // appending fragment to element
+ body.AppendChild (fragment);
+ AssertNotNull ("#AppendFragmentToElement.Exist", body.FirstChild);
+ AssertEquals ("#AppendFragmentToElement.ChildIsElement", XmlNodeType.Element, body.FirstChild.NodeType);
+ AssertEquals ("#AppendFragmentToElement.FirstChild", "p", body.FirstChild.Name);
+ AssertEquals ("#AppendFragmentToElement.LastChild", "div", body.LastChild.Name);
+ }
+
+ public void TestGetInnerXml ()
+ {
+ // this will be also tests of TestWriteTo()/TestWriteContentTo()
+
+ document = new XmlDocument ();
+ fragment = document.CreateDocumentFragment ();
+ fragment.AppendChild (document.CreateElement ("foo"));
+ fragment.AppendChild (document.CreateElement ("bar"));
+ fragment.AppendChild (document.CreateElement ("baz"));
+ AssertEquals ("#Simple", "<foo /><bar /><baz />", fragment.InnerXml);
+ }
+
+ public void TestSetInnerXml ()
+ {
+ document = new XmlDocument ();
+ fragment = document.CreateDocumentFragment ();
+ fragment.InnerXml = "<foo /><bar><child /></bar><baz />";
+ AssertEquals ("foo", fragment.FirstChild.Name);
+ AssertEquals ("bar", fragment.FirstChild.NextSibling.Name);
+ AssertEquals ("child", fragment.FirstChild.NextSibling.FirstChild.Name);
+ AssertEquals ("baz", fragment.LastChild.Name);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDocumentTests.cs b/mcs/class/System.XML/Test/XmlDocumentTests.cs
new file mode 100644
index 00000000000..362f9429357
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDocumentTests.cs
@@ -0,0 +1,875 @@
+
+// System.Xml.XmlDocumentTests
+//
+// Authors:
+// Jason Diamond <jason@injektilo.org>
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Jason Diamond, Kral Ferch
+//
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.IO;
+using System.Text;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlDocumentTests : TestCase
+ {
+ public XmlDocumentTests () : base ("MonoTests.System.Xml.XmlDocumentTests testsuite") {}
+ public XmlDocumentTests (string name) : base (name) {}
+
+ private XmlDocument document;
+ private ArrayList eventStrings = new ArrayList();
+
+ // These Event* methods support the TestEventNode* Tests in this file.
+ // Most of them are event handlers for the XmlNodeChangedEventHandler
+ // delegate.
+ private void EventStringAdd(string eventName, XmlNodeChangedEventArgs e)
+ {
+ string oldParent = (e.OldParent != null) ? e.OldParent.Name : "<none>";
+ string newParent = (e.NewParent != null) ? e.NewParent.Name : "<none>";
+ eventStrings.Add (String.Format ("{0}, {1}, {2}, {3}, {4}", eventName, e.Action.ToString (), e.Node.OuterXml, oldParent, newParent));
+ }
+
+ private void EventNodeChanged(Object sender, XmlNodeChangedEventArgs e)
+ {
+ EventStringAdd ("NodeChanged", e);
+ }
+
+ private void EventNodeChanging (Object sender, XmlNodeChangedEventArgs e)
+ {
+ EventStringAdd ("NodeChanging", e);
+ }
+
+ private void EventNodeChangingException (Object sender, XmlNodeChangedEventArgs e)
+ {
+ throw new Exception ("don't change the value.");
+ }
+
+ private void EventNodeInserted(Object sender, XmlNodeChangedEventArgs e)
+ {
+ EventStringAdd ("NodeInserted", e);
+ }
+
+ private void EventNodeInserting(Object sender, XmlNodeChangedEventArgs e)
+ {
+ EventStringAdd ("NodeInserting", e);
+ }
+
+ private void EventNodeInsertingException(Object sender, XmlNodeChangedEventArgs e)
+ {
+ throw new Exception ("don't insert the element.");
+ }
+
+ private void EventNodeRemoved(Object sender, XmlNodeChangedEventArgs e)
+ {
+ EventStringAdd ("NodeRemoved", e);
+ }
+
+ private void EventNodeRemoving(Object sender, XmlNodeChangedEventArgs e)
+ {
+ EventStringAdd ("NodeRemoving", e);
+ }
+
+ private void EventNodeRemovingException(Object sender, XmlNodeChangedEventArgs e)
+ {
+ throw new Exception ("don't remove the element.");
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.PreserveWhitespace = true;
+ }
+
+ public void TestCreateNodeNodeTypeNameEmptyParams ()
+ {
+ XmlNode node;
+
+ try {
+ node = document.CreateNode (null, null, null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ node = document.CreateNode ("attribute", null, null);
+ Fail ("Expected a NullReferenceException to be thrown.");
+ } catch (NullReferenceException) {}
+
+ try {
+ node = document.CreateNode ("attribute", "", null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ node = document.CreateNode ("element", null, null);
+ Fail ("Expected a NullReferenceException to be thrown.");
+ } catch (NullReferenceException) {}
+
+ try {
+ node = document.CreateNode ("element", "", null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ node = document.CreateNode ("entityreference", null, null);
+ Fail ("Expected a NullReferenceException to be thrown.");
+ } catch (NullReferenceException) {}
+ }
+
+ public void TestCreateNodeInvalidXmlNodeType ()
+ {
+ XmlNode node;
+
+ try {
+ node = document.CreateNode (XmlNodeType.EndElement, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.EndEntity, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.Entity, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.None, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.Notation, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ // TODO: undocumented allowable type.
+ node = document.CreateNode (XmlNodeType.XmlDeclaration, null, null);
+ AssertEquals (XmlNodeType.XmlDeclaration, node.NodeType);
+ }
+
+ public void TestCreateNodeWhichParamIsUsed ()
+ {
+ XmlNode node;
+
+ // No constructor params for Document, DocumentFragment.
+
+ node = document.CreateNode (XmlNodeType.CDATA, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlCDataSection)node).Value);
+
+ node = document.CreateNode (XmlNodeType.Comment, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlComment)node).Value);
+
+ node = document.CreateNode (XmlNodeType.DocumentType, "a", "b", "c");
+ AssertNull (((XmlDocumentType)node).Value);
+
+// TODO: add this back in to test when it's implemented.
+// node = document.CreateNode (XmlNodeType.EntityReference, "a", "b", "c");
+// AssertNull (((XmlEntityReference)node).Value);
+
+ node = document.CreateNode (XmlNodeType.ProcessingInstruction, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlProcessingInstruction)node).Value);
+
+ node = document.CreateNode (XmlNodeType.SignificantWhitespace, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlSignificantWhitespace)node).Value);
+
+ node = document.CreateNode (XmlNodeType.Text, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlText)node).Value);
+
+ node = document.CreateNode (XmlNodeType.Whitespace, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlWhitespace)node).Value);
+
+ node = document.CreateNode (XmlNodeType.XmlDeclaration, "a", "b", "c");
+ AssertEquals ("version=\"1.0\"", ((XmlDeclaration)node).Value);
+ }
+
+ public void TestCreateNodeNodeTypeName ()
+ {
+ XmlNode node;
+
+ try {
+ node = document.CreateNode ("foo", null, null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ node = document.CreateNode("attribute", "foo", null);
+ AssertEquals (XmlNodeType.Attribute, node.NodeType);
+
+ node = document.CreateNode("cdatasection", null, null);
+ AssertEquals (XmlNodeType.CDATA, node.NodeType);
+
+ node = document.CreateNode("comment", null, null);
+ AssertEquals (XmlNodeType.Comment, node.NodeType);
+
+ node = document.CreateNode("document", null, null);
+ AssertEquals (XmlNodeType.Document, node.NodeType);
+ // TODO: test which constructor this ended up calling,
+ // i.e. reuse underlying NameTable or not?
+
+// TODO: add this back in to test when it's implemented.
+// node = document.CreateNode("documentfragment", null, null);
+// AssertEquals (XmlNodeType.DocumentFragment, node.NodeType);
+
+ node = document.CreateNode("documenttype", null, null);
+ AssertEquals (XmlNodeType.DocumentType, node.NodeType);
+
+ node = document.CreateNode("element", "foo", null);
+ AssertEquals (XmlNodeType.Element, node.NodeType);
+
+// TODO: add this back in to test when it's implemented.
+// node = document.CreateNode("entityreference", "foo", null);
+// AssertEquals (XmlNodeType.EntityReference, node.NodeType);
+
+ node = document.CreateNode("processinginstruction", null, null);
+ AssertEquals (XmlNodeType.ProcessingInstruction, node.NodeType);
+
+ node = document.CreateNode("significantwhitespace", null, null);
+ AssertEquals (XmlNodeType.SignificantWhitespace, node.NodeType);
+
+ node = document.CreateNode("text", null, null);
+ AssertEquals (XmlNodeType.Text, node.NodeType);
+
+ node = document.CreateNode("whitespace", null, null);
+ AssertEquals (XmlNodeType.Whitespace, node.NodeType);
+ }
+
+ public void TestDocumentElement ()
+ {
+ AssertNull (document.DocumentElement);
+ XmlElement element = document.CreateElement ("foo", "bar", "http://foo/");
+ AssertNotNull (element);
+
+ AssertEquals ("foo", element.Prefix);
+ AssertEquals ("bar", element.LocalName);
+ AssertEquals ("http://foo/", element.NamespaceURI);
+
+ AssertEquals ("foo:bar", element.Name);
+
+ AssertSame (element, document.AppendChild (element));
+
+ AssertSame (element, document.DocumentElement);
+ }
+
+ public void TestDocumentEmpty()
+ {
+ AssertEquals ("Incorrect output for empty document.", "", document.OuterXml);
+ }
+
+ public void TestEventNodeChanged()
+ {
+ XmlElement element;
+ XmlComment comment;
+
+ document.NodeChanged += new XmlNodeChangedEventHandler (this.EventNodeChanged);
+
+ // Node that is part of the document.
+ document.AppendChild (document.CreateElement ("foo"));
+ comment = document.CreateComment ("bar");
+ document.DocumentElement.AppendChild (comment);
+ AssertEquals ("<!--bar-->", document.DocumentElement.InnerXml);
+ comment.Value = "baz";
+ Assert (eventStrings.Contains ("NodeChanged, Change, <!--baz-->, foo, foo"));
+ AssertEquals ("<!--baz-->", document.DocumentElement.InnerXml);
+
+ // Node that isn't part of the document but created by the document.
+ element = document.CreateElement ("foo");
+ comment = document.CreateComment ("bar");
+ element.AppendChild (comment);
+ AssertEquals ("<!--bar-->", element.InnerXml);
+ comment.Value = "baz";
+ Assert (eventStrings.Contains ("NodeChanged, Change, <!--baz-->, foo, foo"));
+ AssertEquals ("<!--baz-->", element.InnerXml);
+
+/*
+ TODO: Insert this when XmlNode.InnerText() and XmlNode.InnerXml() have been implemented.
+
+ // Node that is part of the document.
+ element = document.CreateElement ("foo");
+ element.InnerText = "bar";
+ document.AppendChild(element);
+ element.InnerText = "baz";
+ Assert(eventStrings.Contains("NodeChanged, Change, baz, foo, foo"));
+
+ // Node that isn't part of the document but created by the document.
+ element = document.CreateElement("qux");
+ element.InnerText = "quux";
+ element.InnerText = "quuux";
+ Assert(eventStrings.Contains("NodeChanged, Change, quuux, qux, qux"));
+*/
+ }
+
+ public void TestEventNodeChanging()
+ {
+ XmlElement element;
+ XmlComment comment;
+
+ document.NodeChanging += new XmlNodeChangedEventHandler (this.EventNodeChanging);
+
+ // Node that is part of the document.
+ document.AppendChild (document.CreateElement ("foo"));
+ comment = document.CreateComment ("bar");
+ document.DocumentElement.AppendChild (comment);
+ AssertEquals ("<!--bar-->", document.DocumentElement.InnerXml);
+ comment.Value = "baz";
+ Assert (eventStrings.Contains ("NodeChanging, Change, <!--bar-->, foo, foo"));
+ AssertEquals ("<!--baz-->", document.DocumentElement.InnerXml);
+
+ // Node that isn't part of the document but created by the document.
+ element = document.CreateElement ("foo");
+ comment = document.CreateComment ("bar");
+ element.AppendChild (comment);
+ AssertEquals ("<!--bar-->", element.InnerXml);
+ comment.Value = "baz";
+ Assert (eventStrings.Contains ("NodeChanging, Change, <!--bar-->, foo, foo"));
+ AssertEquals ("<!--baz-->", element.InnerXml);
+
+ // If an exception is thrown the Document returns to original state.
+ document.NodeChanging += new XmlNodeChangedEventHandler (this.EventNodeChangingException);
+ element = document.CreateElement("foo");
+ comment = document.CreateComment ("bar");
+ element.AppendChild (comment);
+ AssertEquals ("<!--bar-->", element.InnerXml);
+ try
+ {
+ comment.Value = "baz";
+ Fail("Expected an exception to be thrown by the NodeChanging event handler method EventNodeChangingException().");
+ } catch (Exception) {}
+ AssertEquals ("<!--bar-->", element.InnerXml);
+
+ // Yes it's a bit anal but this tests whether the node changing event exception fires before the
+ // ArgumentOutOfRangeException. Turns out it does so that means our implementation needs to raise
+ // the node changing event before doing any work.
+ try
+ {
+ comment.ReplaceData(-1, 0, "qux");
+ Fail("Expected an ArgumentOutOfRangeException to be thrown.");
+ }
+ catch (Exception) {}
+
+ /*
+ TODO: Insert this when XmlNode.InnerText() and XmlNode.InnerXml() have been implemented.
+
+ // Node that is part of the document.
+ element = document.CreateElement ("foo");
+ element.InnerText = "bar";
+ document.AppendChild(element);
+ element.InnerText = "baz";
+ Assert(eventStrings.Contains("NodeChanging, Change, bar, foo, foo"));
+
+ // Node that isn't part of the document but created by the document.
+ element = document.CreateElement("foo");
+ element.InnerText = "bar";
+ element.InnerText = "baz";
+ Assert(eventStrings.Contains("NodeChanging, Change, bar, foo, foo"));
+
+ // If an exception is thrown the Document returns to original state.
+ document.NodeChanging += new XmlNodeChangedEventHandler (this.EventNodeChangingException);
+ element = document.CreateElement("foo");
+ element.InnerText = "bar";
+ try {
+ element.InnerText = "baz";
+ Fail("Expected an exception to be thrown by the NodeChanging event handler method EventNodeChangingException().");
+ } catch (Exception) {}
+ AssertEquals("bar", element.InnerText);
+*/
+ }
+
+ public void TestEventNodeInserted()
+ {
+ XmlElement element;
+
+ document.NodeInserted += new XmlNodeChangedEventHandler (this.EventNodeInserted);
+
+ // Inserted 'foo' element to the document.
+ element = document.CreateElement ("foo");
+ document.AppendChild (element);
+ Assert (eventStrings.Contains ("NodeInserted, Insert, <foo />, <none>, #document"));
+
+ // Append child on node in document
+ element = document.CreateElement ("foo");
+ document.DocumentElement.AppendChild (element);
+ Assert (eventStrings.Contains ("NodeInserted, Insert, <foo />, <none>, foo"));
+
+ // Append child on node not in document but created by document
+ element = document.CreateElement ("bar");
+ element.AppendChild(document.CreateElement ("bar"));
+ Assert(eventStrings.Contains("NodeInserted, Insert, <bar />, <none>, bar"));
+ }
+
+ public void TestEventNodeInserting()
+ {
+ XmlElement element;
+
+ document.NodeInserting += new XmlNodeChangedEventHandler (this.EventNodeInserting);
+
+ // Inserting 'foo' element to the document.
+ element = document.CreateElement ("foo");
+ document.AppendChild (element);
+ Assert (eventStrings.Contains ("NodeInserting, Insert, <foo />, <none>, #document"));
+
+ // Append child on node in document
+ element = document.CreateElement ("foo");
+ document.DocumentElement.AppendChild (element);
+ Assert(eventStrings.Contains ("NodeInserting, Insert, <foo />, <none>, foo"));
+
+ // Append child on node not in document but created by document
+ element = document.CreateElement ("bar");
+ AssertEquals (0, element.ChildNodes.Count);
+ element.AppendChild (document.CreateElement ("bar"));
+ Assert (eventStrings.Contains ("NodeInserting, Insert, <bar />, <none>, bar"));
+ AssertEquals (1, element.ChildNodes.Count);
+
+ // If an exception is thrown the Document returns to original state.
+ document.NodeInserting += new XmlNodeChangedEventHandler (this.EventNodeInsertingException);
+ AssertEquals (1, element.ChildNodes.Count);
+ try
+ {
+ element.AppendChild (document.CreateElement("baz"));
+ Fail ("Expected an exception to be thrown by the NodeInserting event handler method EventNodeInsertingException().");
+ }
+ catch (Exception) {}
+ AssertEquals (1, element.ChildNodes.Count);
+ }
+
+ public void TestEventNodeRemoved()
+ {
+ XmlElement element;
+ XmlElement element2;
+
+ document.NodeRemoved += new XmlNodeChangedEventHandler (this.EventNodeRemoved);
+
+ // Removed 'bar' element from 'foo' outside document.
+ element = document.CreateElement ("foo");
+ element2 = document.CreateElement ("bar");
+ element.AppendChild (element2);
+ AssertEquals (1, element.ChildNodes.Count);
+ element.RemoveChild (element2);
+ Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
+ AssertEquals (0, element.ChildNodes.Count);
+
+/*
+ * TODO: put this test back in when AttributeCollection.RemoveAll() is implemented.
+
+ // RemoveAll.
+ element = document.CreateElement ("foo");
+ element2 = document.CreateElement ("bar");
+ element.AppendChild(element2);
+ AssertEquals(1, element.ChildNodes.Count);
+ element.RemoveAll();
+ Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
+ AssertEquals(0, element.ChildNodes.Count);
+*/
+
+ // Removed 'bar' element from 'foo' inside document.
+ element = document.CreateElement ("foo");
+ document.AppendChild (element);
+ element = document.CreateElement ("bar");
+ document.DocumentElement.AppendChild (element);
+ AssertEquals (1, document.DocumentElement.ChildNodes.Count);
+ document.DocumentElement.RemoveChild (element);
+ Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
+ AssertEquals (0, document.DocumentElement.ChildNodes.Count);
+ }
+
+ public void TestEventNodeRemoving()
+ {
+ XmlElement element;
+ XmlElement element2;
+
+ document.NodeRemoving += new XmlNodeChangedEventHandler (this.EventNodeRemoving);
+
+ // Removing 'bar' element from 'foo' outside document.
+ element = document.CreateElement ("foo");
+ element2 = document.CreateElement ("bar");
+ element.AppendChild (element2);
+ AssertEquals (1, element.ChildNodes.Count);
+ element.RemoveChild (element2);
+ Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
+ AssertEquals (0, element.ChildNodes.Count);
+
+/*
+ * TODO: put this test back in when AttributeCollection.RemoveAll() is implemented.
+
+ // RemoveAll.
+ element = document.CreateElement ("foo");
+ element2 = document.CreateElement ("bar");
+ element.AppendChild(element2);
+ AssertEquals(1, element.ChildNodes.Count);
+ element.RemoveAll();
+ Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
+ AssertEquals(0, element.ChildNodes.Count);
+*/
+
+ // Removing 'bar' element from 'foo' inside document.
+ element = document.CreateElement ("foo");
+ document.AppendChild (element);
+ element = document.CreateElement ("bar");
+ document.DocumentElement.AppendChild (element);
+ AssertEquals (1, document.DocumentElement.ChildNodes.Count);
+ document.DocumentElement.RemoveChild (element);
+ Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
+ AssertEquals (0, document.DocumentElement.ChildNodes.Count);
+
+ // If an exception is thrown the Document returns to original state.
+ document.NodeRemoving += new XmlNodeChangedEventHandler (this.EventNodeRemovingException);
+ element.AppendChild (element2);
+ AssertEquals (1, element.ChildNodes.Count);
+ try
+ {
+ element.RemoveChild(element2);
+ Fail ("Expected an exception to be thrown by the NodeRemoving event handler method EventNodeRemovingException().");
+ }
+ catch (Exception) {}
+ AssertEquals (1, element.ChildNodes.Count);
+ }
+
+ public void TestGetElementsByTagNameNoNameSpace ()
+ {
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
+ <author>Tom Clancy</author><price>6.95</price></book><book>
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
+ <price>9.95</price></book><Fluffer><Nutter><book>
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
+ <price>9.95</price></book></Nutter></Fluffer></library>";
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList bookList = document.GetElementsByTagName ("book");
+ AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
+ }
+
+ public void TestGetElementsByTagNameUsingNameSpace ()
+ {
+ StringBuilder xml = new StringBuilder ();
+ xml.Append ("<?xml version=\"1.0\" ?><library xmlns:North=\"http://www.foo.com\" ");
+ xml.Append ("xmlns:South=\"http://www.goo.com\"><North:book type=\"non-fiction\"> ");
+ xml.Append ("<North:title type=\"intro\">XML Fun</North:title> " );
+ xml.Append ("<North:author>John Doe</North:author> " );
+ xml.Append ("<North:price>34.95</North:price></North:book> " );
+ xml.Append ("<South:book type=\"fiction\"> " );
+ xml.Append ("<South:title>Bear and the Dragon</South:title> " );
+ xml.Append ("<South:author>Tom Clancy</South:author> " );
+ xml.Append ("<South:price>6.95</South:price></South:book> " );
+ xml.Append ("<South:book type=\"fiction\"><South:title>Bourne Identity</South:title> " );
+ xml.Append ("<South:author>Robert Ludlum</South:author> " );
+ xml.Append ("<South:price>9.95</South:price></South:book></library>");
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml.ToString ()));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList bookList = document.GetElementsByTagName ("book", "http://www.goo.com");
+ AssertEquals ("GetElementsByTagName (string, uri) returned incorrect count.", 2, bookList.Count);
+ }
+
+
+ public void TestInnerAndOuterXml ()
+ {
+ AssertEquals (String.Empty, document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlDeclaration declaration = document.CreateXmlDeclaration ("1.0", null, null);
+ document.AppendChild (declaration);
+ AssertEquals ("<?xml version=\"1.0\"?>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlElement element = document.CreateElement ("foo");
+ document.AppendChild (element);
+ AssertEquals ("<?xml version=\"1.0\"?><foo />", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlComment comment = document.CreateComment ("bar");
+ document.DocumentElement.AppendChild (comment);
+ AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar--></foo>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlText text = document.CreateTextNode ("baz");
+ document.DocumentElement.AppendChild (text);
+ AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz</foo>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ element = document.CreateElement ("quux");
+ element.SetAttribute ("quuux", "squonk");
+ document.DocumentElement.AppendChild (element);
+ AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz<quux quuux=\"squonk\" /></foo>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+ }
+
+ public void TestLoadWithSystemIOStream ()
+ {
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
+ <author>Tom Clancy</author><price>6.95</price></book><book>
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
+ <price>9.95</price></book><Fluffer><Nutter><book>
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
+ <price>9.95</price></book></Nutter></Fluffer></library>";
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ AssertEquals ("Not Loaded From IOStream", true, document.HasChildNodes);
+ }
+
+ public void TestLoadXmlCDATA ()
+ {
+ document.LoadXml ("<foo><![CDATA[bar]]></foo>");
+ Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.CDATA);
+ AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
+ }
+
+ public void TestLoadXMLComment()
+ {
+// XmlTextReader needs to throw this exception
+// try {
+// document.LoadXml("<!--foo-->");
+// Fail("XmlException should have been thrown.");
+// }
+// catch (XmlException e) {
+// AssertEquals("Exception message doesn't match.", "The root element is missing.", e.Message);
+// }
+
+ document.LoadXml ("<foo><!--Comment--></foo>");
+ Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Comment);
+ AssertEquals ("Comment", document.DocumentElement.FirstChild.Value);
+
+ document.LoadXml (@"<foo><!--bar--></foo>");
+ AssertEquals ("Incorrect target.", "bar", ((XmlComment)document.FirstChild.FirstChild).Data);
+ }
+
+ public void TestLoadXmlElementSingle ()
+ {
+ AssertNull (document.DocumentElement);
+ document.LoadXml ("<foo/>");
+
+ AssertNotNull (document.DocumentElement);
+ AssertSame (document.FirstChild, document.DocumentElement);
+
+ AssertEquals (String.Empty, document.DocumentElement.Prefix);
+ AssertEquals ("foo", document.DocumentElement.LocalName);
+ AssertEquals (String.Empty, document.DocumentElement.NamespaceURI);
+ AssertEquals ("foo", document.DocumentElement.Name);
+ }
+
+ public void TestLoadXmlElementWithAttributes ()
+ {
+ AssertNull (document.DocumentElement);
+ document.LoadXml ("<foo bar='baz' quux='quuux' hoge='hello &amp; world' />");
+
+ XmlElement documentElement = document.DocumentElement;
+
+ AssertEquals ("baz", documentElement.GetAttribute ("bar"));
+ AssertEquals ("quuux", documentElement.GetAttribute ("quux"));
+ AssertEquals ("hello & world", documentElement.GetAttribute ("hoge"));
+ AssertEquals ("hello & world", documentElement.Attributes ["hoge"].Value);
+ AssertEquals (1, documentElement.GetAttributeNode ("hoge").ChildNodes.Count);
+ }
+
+ public void TestLoadXmlElementWithChildElement ()
+ {
+ document.LoadXml ("<foo><bar/></foo>");
+ Assert (document.ChildNodes.Count == 1);
+ Assert (document.FirstChild.ChildNodes.Count == 1);
+ AssertEquals ("foo", document.DocumentElement.LocalName);
+ AssertEquals ("bar", document.DocumentElement.FirstChild.LocalName);
+ }
+
+ public void TestLoadXmlElementWithTextNode ()
+ {
+ document.LoadXml ("<foo>bar</foo>");
+ Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Text);
+ AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
+ }
+
+ public void TestLoadXmlExceptionClearsDocument ()
+ {
+ document.LoadXml ("<foo/>");
+ Assert (document.FirstChild != null);
+
+ try {
+ document.LoadXml ("<123/>");
+ Fail ("An XmlException should have been thrown.");
+ } catch (XmlException) {}
+
+ Assert (document.FirstChild == null);
+ }
+
+ public void TestLoadXmlProcessingInstruction ()
+ {
+ document.LoadXml (@"<?foo bar='baaz' quux='quuux'?><quuuux></quuuux>");
+ AssertEquals ("Incorrect target.", "foo", ((XmlProcessingInstruction)document.FirstChild).Target);
+ AssertEquals ("Incorrect data.", "bar='baaz' quux='quuux'", ((XmlProcessingInstruction)document.FirstChild).Data);
+ }
+
+ public void TestOuterXml ()
+ {
+ string xml;
+
+ xml = "<root><![CDATA[foo]]></root>";
+ document.LoadXml (xml);
+ AssertEquals("XmlDocument with cdata OuterXml is incorrect.", xml, document.OuterXml);
+
+ xml = "<root><!--foo--></root>";
+ document.LoadXml (xml);
+ AssertEquals("XmlDocument with comment OuterXml is incorrect.", xml, document.OuterXml);
+
+ xml = "<root><?foo bar?></root>";
+ document.LoadXml (xml);
+ AssertEquals("XmlDocument with processing instruction OuterXml is incorrect.", xml, document.OuterXml);
+ }
+
+ public void TestParentNodes ()
+ {
+ document.LoadXml ("<foo><bar><baz/></bar></foo>");
+ XmlNode node = document.FirstChild.FirstChild.FirstChild;
+ AssertEquals ("Wrong child found.", "baz", node.LocalName);
+ AssertEquals ("Wrong parent.", "bar", node.ParentNode.LocalName);
+ AssertEquals ("Wrong parent.", "foo", node.ParentNode.ParentNode.LocalName);
+ AssertEquals ("Wrong parent.", "#document", node.ParentNode.ParentNode.ParentNode.LocalName);
+ AssertNull ("Expected parent to be null.", node.ParentNode.ParentNode.ParentNode.ParentNode);
+ }
+
+ public void TestRemovedElementNextSibling ()
+ {
+ XmlNode node;
+ XmlNode nextSibling;
+
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ node = document.DocumentElement.FirstChild;
+ document.DocumentElement.RemoveChild (node);
+ nextSibling = node.NextSibling;
+ AssertNull ("Expected removed node's next sibling to be null.", nextSibling);
+ }
+
+ // ImportNode
+ public void TestImportNode ()
+ {
+ XmlNode n;
+
+ string xlinkURI = "http://www.w3.org/1999/XLink";
+ string xml1 = "<?xml version='1.0' encoding='utf-8' ?><foo xmlns:xlink='" + xlinkURI + "'><bar a1='v1' xlink:href='#foo'><baz><![CDATA[cdata section.\n\titem 1\n\titem 2\n]]>From here, simple text node.</baz></bar></foo>";
+ document.LoadXml(xml1);
+ XmlDocument newDoc = new XmlDocument();
+ newDoc.LoadXml("<hoge><fuga /></hoge>");
+ XmlElement bar = document.DocumentElement.FirstChild as XmlElement;
+
+ // Attribute
+ n = newDoc.ImportNode(bar.GetAttributeNode("href", xlinkURI), true);
+ AssertEquals("#ImportNode.Attr.NS.LocalName", "href", n.LocalName);
+ AssertEquals("#ImportNode.Attr.NS.NSURI", xlinkURI, n.NamespaceURI);
+ AssertEquals("#ImportNode.Attr.NS.Value", "#foo", n.Value);
+
+ // CDATA
+ n = newDoc.ImportNode(bar.FirstChild.FirstChild, true);
+ AssertEquals("#ImportNode.CDATA", "cdata section.\n\titem 1\n\titem 2\n", n.Value);
+
+ // Element
+ XmlElement e = newDoc.ImportNode(bar, true) as XmlElement;
+ AssertEquals("#ImportNode.Element.Name", "bar", e.Name);
+ AssertEquals("#ImportNode.Element.Attr", "#foo", e.GetAttribute("href", xlinkURI));
+ AssertEquals("#ImportNode.Element.deep", "baz", e.FirstChild.Name);
+
+ // Entity Reference:
+ // [2002/10/14] CreateEntityReference was not implemented.
+// document.LoadXml("<!DOCTYPE test PUBLIC 'dummy' [<!ENTITY FOOENT 'foo'>]><root>&FOOENT;</root>");
+// n = newDoc.ImportNode(document.DocumentElement.FirstChild);
+// AssertEquals("#ImportNode.EntityReference", "FOOENT", n.Name);
+// AssertEquals("#ImportNode.EntityReference", "foo_", n.Value);
+
+ // Processing Instruction
+ document.LoadXml("<foo><?xml-stylesheet href='foo.xsl' ?></foo>");
+ XmlProcessingInstruction pi = (XmlProcessingInstruction)newDoc.ImportNode(document.DocumentElement.FirstChild, false);
+ AssertEquals("#ImportNode.ProcessingInstruction.Name", "xml-stylesheet", pi.Name);
+ AssertEquals("#ImportNode.ProcessingInstruction.Data", "href='foo.xsl'", pi.Data.Trim());
+
+ // Text
+ document.LoadXml(xml1);
+ n = newDoc.ImportNode((XmlText)bar.FirstChild.ChildNodes[1], true);
+ AssertEquals("#ImportNode.Text", "From here, simple text node.", n.Value);
+
+ // XmlDeclaration
+ document.LoadXml(xml1);
+ XmlDeclaration decl = (XmlDeclaration)newDoc.ImportNode(document.FirstChild, false);
+ AssertEquals("#ImportNode.XmlDeclaration.Type", XmlNodeType.XmlDeclaration, decl.NodeType);
+ AssertEquals("#ImportNode.XmlDeclaration.Encoding", "utf-8", decl.Encoding);
+ }
+
+ public void TestNameTable()
+ {
+ XmlDocument doc = new XmlDocument();
+ AssertNotNull(doc.NameTable);
+ }
+
+ public void TestSingleEmptyRootDocument()
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml("<root />");
+ AssertNotNull(doc.DocumentElement);
+ }
+
+ public void TestDocumentWithDoctypeDecl ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ try {
+ doc.LoadXml ("<!DOCTYPE test><root />");
+ } catch (XmlException) {
+ Fail ("#DoctypeDecl.OnlyName");
+ }
+ try
+ {
+ doc.LoadXml ("<!DOCTYPE test SYSTEM 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><root />");
+ } catch (XmlException) {
+ Fail("#DoctypeDecl.System");
+ }
+ try {
+ doc.LoadXml ("<!DOCTYPE test PUBLIC '-//test' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><root />");
+ } catch (XmlException) {
+ Fail ("#DoctypeDecl.Public");
+ }
+ // Should this be commented out?
+// try {
+// doc.LoadXml ("<!DOCTYPE test [<!ELEMENT foo >]><root />");
+// } catch (XmlException) {
+// Fail("#DoctypeDecl.ElementDecl");
+// }
+ }
+
+ public void TestCloneNode ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<foo><bar /><baz hoge='fuga'>TEST Text</baz></foo>");
+ XmlDocument doc2 = (XmlDocument)doc.CloneNode (false);
+ AssertEquals ("ShallowCopy", 0, doc2.ChildNodes.Count);
+ doc2 = (XmlDocument)doc.CloneNode (true);
+ AssertEquals ("DeepCopy", "foo", doc2.DocumentElement.Name);
+ }
+
+ public void TestOuterXmlWithDefaultXmlns ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<iq type=\"get\" id=\"ATECLIENT_1\"><query xmlns=\"jabber:iq:auth\"><username></username></query></iq>");
+ AssertEquals ("<iq type=\"get\" id=\"ATECLIENT_1\"><query xmlns=\"jabber:iq:auth\"><username /></query></iq>", doc.OuterXml);
+ }
+
+ public void TestPreserveWhitespace ()
+ {
+ string input =
+ "<?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- --> <foo/>";
+
+ XmlDocument dom = new XmlDocument ();
+ XmlTextReader reader = new XmlTextReader (new StringReader (input));
+ dom.Load (reader);
+
+ AssertEquals (XmlNodeType.Element, dom.FirstChild.NextSibling.NextSibling.NodeType);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDocumentTypeTests.cs b/mcs/class/System.XML/Test/XmlDocumentTypeTests.cs
new file mode 100755
index 00000000000..857478bc51c
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDocumentTypeTests.cs
@@ -0,0 +1,104 @@
+//
+// System.Xml.XmlDocumentTypeTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlDocumentTypeTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocumentType docType;
+ public XmlDocumentTypeTests ()
+ : base ("MonoTests.System.Xml.XmlDocumentTypeTests testsuite")
+ {
+ }
+
+ public XmlDocumentTypeTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ docType = document.CreateDocumentType ("book", null, null, "<!ELEMENT book ANY>");
+ document.AppendChild (docType);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, cloned.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original, cloned));
+ }
+
+ public void TestName ()
+ {
+ AssertEquals ("Getting Name property", "book", docType.Name);
+ }
+
+ public void TestLocalName ()
+ {
+ AssertEquals ("Getting LocalName property", "book", docType.LocalName);
+ }
+
+ public void TestInternalSubset ()
+ {
+ AssertEquals ("Getting Internal Subset property",
+ "<!ELEMENT book ANY>", docType.InternalSubset);
+ }
+
+ public void TestAppendChild ()
+ {
+ try {
+ XmlDocumentType type1 = document.CreateDocumentType ("book", null, null, null);
+ document.AppendChild (type1);
+
+ } catch (InvalidOperationException) {
+ return;
+
+ } catch (Exception) {
+ Fail ("Incorrect Exception thrown.");
+ }
+ }
+
+ public void TestNodeType ()
+ {
+ AssertEquals ("NodeType property broken",
+ docType.NodeType.ToString (), "DocumentType");
+ }
+
+ public void TestIsReadOnly ()
+ {
+ AssertEquals ("IsReadOnly property", "True", docType.IsReadOnly.ToString ());
+ }
+
+ public void TestCloneNode ()
+ {
+ XmlNode original = docType;
+
+ XmlNode cloned1 = docType.CloneNode (true);
+ TestXmlNodeBaseProperties (original, cloned1);
+
+ XmlNode cloned2 = docType.CloneNode (false);
+ TestXmlNodeBaseProperties (original, cloned2);
+
+ AssertEquals ("Deep and shallow cloning", cloned1.Value, cloned2.Value);
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlElementTests.cs b/mcs/class/System.XML/Test/XmlElementTests.cs
new file mode 100644
index 00000000000..5122a42adc8
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlElementTests.cs
@@ -0,0 +1,337 @@
+//
+// XmlElementTests
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+using System.IO;
+using System.Text;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlElementTests : TestCase
+ {
+ public XmlElementTests () : base ("MonoTests.System.Xml.XmlElementTests testsuite") { }
+ public XmlElementTests (string name) : base (name) { }
+
+ private XmlDocument document;
+
+ protected override void SetUp()
+ {
+ document = new XmlDocument ();
+ }
+
+ private void AssertElement (XmlElement element, string prefix,
+ string localName, string namespaceURI,
+ int attributesCount)
+ {
+ AssertEquals (prefix != String.Empty ? prefix + ":" + localName : localName, element.Name);
+ AssertEquals (prefix, element.Prefix);
+ AssertEquals (localName, element.LocalName);
+ AssertEquals (namespaceURI, element.NamespaceURI);
+ //AssertEquals (attributesCount, element.Attributes.Count);
+ }
+
+ // for NodeInserted Event
+ private bool Inserted = false;
+ private void OnNodeInserted (object o, XmlNodeChangedEventArgs e)
+ {
+ Inserted = true;
+ }
+
+ // for NodeChanged Event
+ private bool Changed = false;
+ private void OnNodeChanged (object o, XmlNodeChangedEventArgs e)
+ {
+ Changed = true;
+ }
+
+ // for NodeRemoved Event
+ private bool Removed = false;
+ private void OnNodeRemoved (object o, XmlNodeChangedEventArgs e)
+ {
+ Removed = true;
+ }
+
+
+ public void TestCloneNode ()
+ {
+ XmlElement element = document.CreateElement ("foo");
+ XmlElement child = document.CreateElement ("bar");
+ XmlElement grandson = document.CreateElement ("baz");
+
+ element.SetAttribute ("attr1", "val1");
+ element.SetAttribute ("attr2", "val2");
+ element.AppendChild (child);
+ child.SetAttribute ("attr3", "val3");
+ child.AppendChild (grandson);
+
+ document.AppendChild (element);
+ XmlNode deep = element.CloneNode (true);
+ // AssertEquals ("These should be the same", deep.OuterXml, element.OuterXml);
+ AssertNull ("This is not null", deep.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (element,deep));
+
+ XmlNode shallow = element.CloneNode (false);
+ AssertNull ("This is not null", shallow.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (element,shallow));
+ AssertEquals ("Shallow clones shalt have no children!", false, shallow.HasChildNodes);
+ }
+
+ public void TestCreateElement1 ()
+ {
+ XmlElement element = document.CreateElement ("name");
+ AssertElement (element, String.Empty, "name", String.Empty, 0);
+ }
+
+ public void TestCreateElement1WithPrefix ()
+ {
+ XmlElement element = document.CreateElement ("prefix:localName");
+ AssertElement (element, "prefix", "localName", String.Empty, 0);
+ }
+
+ public void TestCreateElement2 ()
+ {
+ XmlElement element = document.CreateElement ("qualifiedName", "namespaceURI");
+ AssertElement (element, String.Empty, "qualifiedName",
+ "namespaceURI", 0);
+ }
+
+ public void TestCreateElement2WithPrefix ()
+ {
+ XmlElement element = document.CreateElement ("prefix:localName", "namespaceURI");
+ AssertElement (element, "prefix", "localName", "namespaceURI", 0);
+ }
+
+ public void TestCreateElement3 ()
+ {
+ XmlElement element = document.CreateElement ("prefix", "localName", "namespaceURI");
+ AssertElement (element, "prefix", "localName", "namespaceURI", 0);
+ }
+
+ public void TestCreateElement3WithNullNamespace ()
+ {
+ // bug #26855, NamespaceURI should NEVER be null.
+ XmlElement element = document.CreateElement (null, "localName", null);
+ AssertElement (element, String.Empty, "localName", String.Empty, 0);
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ XmlElement element;
+ XmlText text;
+ XmlComment comment;
+
+ element = document.CreateElement ("foo");
+ AssertEquals (String.Empty, element.InnerXml);
+ AssertEquals ("<foo />", element.OuterXml);
+
+ text = document.CreateTextNode ("bar");
+ element.AppendChild (text);
+ AssertEquals ("bar", element.InnerXml);
+ AssertEquals ("<foo>bar</foo>", element.OuterXml);
+
+ element.SetAttribute ("baz", "quux");
+ AssertEquals ("bar", element.InnerXml);
+ AssertEquals ("<foo baz=\"quux\">bar</foo>", element.OuterXml);
+
+ comment = document.CreateComment ("squonk");
+ element.AppendChild (comment);
+ AssertEquals ("bar<!--squonk-->", element.InnerXml);
+ AssertEquals ("<foo baz=\"quux\">bar<!--squonk--></foo>", element.OuterXml);
+
+ element.RemoveAll();
+ element.AppendChild(document.CreateElement("hoge"));
+ AssertEquals ("<hoge />", element.InnerXml);
+ }
+
+ public void TestSetGetAttribute ()
+ {
+ XmlElement element = document.CreateElement ("foo");
+ element.SetAttribute ("attr1", "val1");
+ element.SetAttribute ("attr2", "val2");
+ AssertEquals ("val1", element.GetAttribute ("attr1"));
+ AssertEquals ("val2", element.GetAttribute ("attr2"));
+ }
+
+ public void TestGetElementsByTagNameNoNameSpace ()
+ {
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
+ <author>Tom Clancy</author><price>6.95</price></book><book>
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
+ <price>9.95</price></book><Fluffer><Nutter><book>
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
+ <price>9.95</price></book></Nutter></Fluffer></library>";
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList libraryList = document.GetElementsByTagName ("library");
+ XmlNode xmlNode = libraryList.Item (0);
+ XmlElement xmlElement = xmlNode as XmlElement;
+ XmlNodeList bookList = xmlElement.GetElementsByTagName ("book");
+ AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
+ }
+
+ public void TestGetElementsByTagNameUsingNameSpace ()
+ {
+ StringBuilder xml = new StringBuilder ();
+ xml.Append ("<?xml version=\"1.0\" ?><library xmlns:North=\"http://www.foo.com\" ");
+ xml.Append ("xmlns:South=\"http://www.goo.com\"><North:book type=\"non-fiction\"> ");
+ xml.Append ("<North:title type=\"intro\">XML Fun</North:title> " );
+ xml.Append ("<North:author>John Doe</North:author> " );
+ xml.Append ("<North:price>34.95</North:price></North:book> " );
+ xml.Append ("<South:book type=\"fiction\"> " );
+ xml.Append ("<South:title>Bear and the Dragon</South:title> " );
+ xml.Append ("<South:author>Tom Clancy</South:author> " );
+ xml.Append ("<South:price>6.95</South:price></South:book> " );
+ xml.Append ("<South:book type=\"fiction\"><South:title>Bourne Identity</South:title> " );
+ xml.Append ("<South:author>Robert Ludlum</South:author> " );
+ xml.Append ("<South:price>9.95</South:price></South:book></library>");
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml.ToString ()));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList libraryList = document.GetElementsByTagName ("library");
+ XmlNode xmlNode = libraryList.Item (0);
+ XmlElement xmlElement = xmlNode as XmlElement;
+ XmlNodeList bookList = xmlElement.GetElementsByTagName ("book", "http://www.foo.com");
+ AssertEquals ("GetElementsByTagName (string, uri) returned incorrect count.", 1, bookList.Count);
+ }
+
+ public void TestOuterXmlWithNamespace ()
+ {
+ XmlElement element = document.CreateElement ("foo", "bar", "#foo");
+ AssertEquals ("<foo:bar xmlns:foo=\"#foo\" />", element.OuterXml);
+ }
+
+ public void TestRemoveAllAttributes ()
+ {
+ StringBuilder xml = new StringBuilder ();
+ xml.Append ("<?xml version=\"1.0\" ?><library><book type=\"non-fiction\" price=\"34.95\"> ");
+ xml.Append ("<title type=\"intro\">XML Fun</title> " );
+ xml.Append ("<author>John Doe</author></book></library>");
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml.ToString ()));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList bookList = document.GetElementsByTagName ("book");
+ XmlNode xmlNode = bookList.Item (0);
+ XmlElement xmlElement = xmlNode as XmlElement;
+ xmlElement.RemoveAllAttributes ();
+ AssertEquals ("attributes not properly removed.", false, xmlElement.HasAttribute ("type"));
+ }
+
+ public void TestSetAttributeNode ()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ XmlElement xmlEl = xmlDoc.CreateElement ("TestElement");
+ XmlAttribute xmlAttribute = xmlEl.SetAttributeNode ("attr1", "namespace1");
+ XmlAttribute xmlAttribute2 = xmlEl.SetAttributeNode ("attr2", "namespace2");
+ AssertEquals ("attribute name not properly created.", true, xmlAttribute.Name.Equals ("attr1"));
+ AssertEquals ("attribute namespace not properly created.", true, xmlAttribute.NamespaceURI.Equals ("namespace1"));
+ }
+
+ public void TestInnerXmlSetter ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root/>");
+ XmlElement el = doc.DocumentElement;
+ AssertNull ("#Simple", el.FirstChild);
+ el.InnerXml = "<foo><bar att='baz'/></foo>";
+ XmlElement child = el.FirstChild as XmlElement;
+ AssertNotNull ("#Simple.Child", child);
+ AssertEquals ("#Simple.Child.Name", "foo", child.LocalName);
+
+ XmlElement grandchild = child.FirstChild as XmlElement;
+ AssertNotNull ("#Simple.GrandChild", grandchild);
+ AssertEquals ("#Simple.GrandChild.Name", "bar", grandchild.LocalName);
+ AssertEquals ("#Simple.GrandChild.Attr", "baz", grandchild.GetAttribute ("att"));
+
+ doc.LoadXml ("<root xmlns='NS0' xmlns:ns1='NS1'><foo/><ns1:bar/><ns2:bar xmlns:ns2='NS2' /></root>");
+ el = doc.DocumentElement.FirstChild.NextSibling as XmlElement; // ns1:bar
+ AssertNull ("#Namespaced.Prepare", el.FirstChild);
+ el.InnerXml = "<ns1:baz />";
+ AssertNotNull ("#Namespaced.Child", el.FirstChild);
+ AssertEquals ("#Namespaced.Child.Name", "baz", el.FirstChild.LocalName);
+ AssertEquals ("#Namespaced.Child.NSURI", "NS1", el.FirstChild.NamespaceURI); // important!
+
+ el.InnerXml = "<hoge />";
+ AssertEquals ("#Namespaced.VerifyPreviousCleared", "hoge", el.FirstChild.Name);
+ }
+
+ public void TestRemoveAttribute ()
+ {
+ string xlinkURI = "http://www.w3.org/1999/XLink";
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root a1='1' a2='2' xlink:href='urn:foo' xmlns:xlink='" + xlinkURI + "' />");
+
+ XmlElement el = doc.DocumentElement;
+ el.RemoveAttribute ("a1");
+ AssertNull ("RemoveAttribute", el.GetAttributeNode ("a1"));
+ el.RemoveAttribute ("xlink:href");
+ AssertNull ("RemoveAttribute", el.GetAttributeNode ("href", xlinkURI));
+ el.RemoveAllAttributes ();
+ AssertNull ("RemoveAllAttributes", el.GetAttributeNode ("a2"));
+ }
+
+ public void TestWriteToWithDefaultNamespace ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<RetrievalElement URI=\"\"xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ doc.DocumentElement.WriteTo (xtw);
+ AssertEquals ("<RetrievalElement URI=\"\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", sw.ToString());
+ }
+
+ public void TestWriteToWithDeletedNamespacePrefix ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root xmlns:foo='urn:dummy'><foo foo:bar='baz' /></root>");
+ doc.DocumentElement.RemoveAllAttributes ();
+
+ Assert (doc.DocumentElement.FirstChild.OuterXml.IndexOf("xmlns:foo") > 0);
+ }
+
+ public void TestWriteToWithDifferentNamespaceAttributes ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root xmlns:foo='urn:dummy' xmlns:html='http://www.w3.org/1999/xhtml' html:style='font-size: 1em'></root>");
+ Assert (doc.OuterXml.IndexOf ("xmlns:html=\"http://www.w3.org/1999/xhtml\"") > 0);
+ }
+
+ public void TestInnerTextAndEvent ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ doc.LoadXml ("<root><child>text</child><child2><![CDATA[cdata]]></child2></root>");
+ doc.NodeInserted += new XmlNodeChangedEventHandler (
+ OnNodeInserted);
+ doc.NodeRemoved += new XmlNodeChangedEventHandler (
+ OnNodeRemoved);
+ // If only one child of the element is Text node,
+ // then no events are fired.
+ doc.DocumentElement.FirstChild.InnerText = "no events fired.";
+ AssertEquals ("NoInsertEventFired", false, Inserted);
+ AssertEquals ("NoRemoveEventFired", false, Removed);
+ AssertEquals ("SetInnerTextToSingleText", "no events fired.", doc.DocumentElement.FirstChild.InnerText);
+ Inserted = false;
+ Removed = false;
+
+ // if only one child of the element is CDataSection,
+ // then events are fired.
+ doc.DocumentElement.LastChild.InnerText = "events are fired.";
+ AssertEquals ("InsertedEventFired", true, Inserted);
+ AssertEquals ("RemovedEventFired", true, Removed);
+ AssertEquals ("SetInnerTextToCDataSection", "events are fired.", doc.DocumentElement.LastChild.InnerText);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlEntityReferenceTests.cs b/mcs/class/System.XML/Test/XmlEntityReferenceTests.cs
new file mode 100755
index 00000000000..8cb9c647069
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlEntityReferenceTests.cs
@@ -0,0 +1,35 @@
+//
+// System.Xml.XmlEntityReference.cs
+//
+// Author:
+// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlEntityReferenceTests : TestCase
+ {
+ public XmlEntityReferenceTests () : base ("MonoTests.System.Xml.XmlEntityReferenceTests testsuite") {}
+ public XmlEntityReferenceTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestWriteTo ()
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml("<root/>");
+ XmlEntityReference er = doc.CreateEntityReference("foo");
+ doc.DocumentElement.AppendChild(er);
+ AssertEquals ("Name", "foo", er.Name);
+ AssertEquals ("WriteTo", "<root>&foo;</root>", doc.DocumentElement.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs b/mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs
new file mode 100644
index 00000000000..176c76765cb
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs
@@ -0,0 +1,138 @@
+//
+// XmlNamespaceManagerTests.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlNamespaceManagerTests : TestCase
+ {
+ public XmlNamespaceManagerTests () : base ("MonoTests.System.Xml.XmlNameSpaceManagerTests testsuite") { }
+ public XmlNamespaceManagerTests (string name) : base (name) { }
+
+ private XmlNameTable nameTable;
+ private XmlNamespaceManager namespaceManager;
+
+ protected override void SetUp ()
+ {
+ nameTable = new NameTable ();
+ namespaceManager = new XmlNamespaceManager (nameTable);
+ }
+
+ public void TestNewNamespaceManager ()
+ {
+ // make sure that you can call PopScope when there aren't any to pop.
+ Assert (!namespaceManager.PopScope ());
+
+ // the following strings should have been added to the name table by the
+ // namespace manager.
+ string xmlnsPrefix = nameTable.Get ("xmlns");
+ string xmlPrefix = nameTable.Get ("xml");
+ string stringEmpty = nameTable.Get (String.Empty);
+ string xmlnsNamespace = "http://www.w3.org/2000/xmlns/";
+ string xmlNamespace = "http://www.w3.org/XML/1998/namespace";
+
+ // none of them should be null.
+ AssertNotNull (xmlnsPrefix);
+ AssertNotNull (xmlPrefix);
+ AssertNotNull (stringEmpty);
+ AssertNotNull (xmlnsNamespace);
+ AssertNotNull (xmlNamespace);
+
+ // Microsoft's XmlNamespaceManager reports that these three
+ // namespaces aren't declared for some reason.
+ Assert (!namespaceManager.HasNamespace ("xmlns"));
+ Assert (!namespaceManager.HasNamespace ("xml"));
+ Assert (!namespaceManager.HasNamespace (String.Empty));
+
+ // these three namespaces are declared by default.
+ AssertEquals ("http://www.w3.org/2000/xmlns/", namespaceManager.LookupNamespace ("xmlns"));
+ AssertEquals ("http://www.w3.org/XML/1998/namespace", namespaceManager.LookupNamespace ("xml"));
+ AssertEquals (String.Empty, namespaceManager.LookupNamespace (String.Empty));
+
+ // the namespaces should be the same references found in the name table.
+ AssertSame (xmlnsNamespace, namespaceManager.LookupNamespace ("xmlns"));
+ AssertSame (xmlNamespace, namespaceManager.LookupNamespace ("xml"));
+ AssertSame (stringEmpty, namespaceManager.LookupNamespace (String.Empty));
+
+ // looking up undeclared namespaces should return null.
+ AssertNull (namespaceManager.LookupNamespace ("foo"));
+ }
+
+ public void TestAddNamespace ()
+ {
+ // add a new namespace.
+ namespaceManager.AddNamespace ("foo", "http://foo/");
+ // make sure the new namespace is there.
+ Assert (namespaceManager.HasNamespace ("foo"));
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ }
+
+ public void TestAddNamespaceWithNameTable ()
+ {
+ // add a known reference to the name table.
+ string fooNamespace = "http://foo/";
+ nameTable.Add(fooNamespace);
+
+ // create a new string with the same value but different address.
+ string fooNamespace2 = "http://";
+ fooNamespace2 += "foo/";
+
+ // the references must be different in order for this test to prove anything.
+ Assert (!Object.ReferenceEquals (fooNamespace, fooNamespace2));
+
+ // add the namespace with the reference that's not in the name table.
+ namespaceManager.AddNamespace ("foo", fooNamespace2);
+
+ // the returned reference should be the same one that's in the name table.
+ AssertSame (fooNamespace, namespaceManager.LookupNamespace ("foo"));
+ }
+
+ public void TestPushScope ()
+ {
+ // add a new namespace.
+ namespaceManager.AddNamespace ("foo", "http://foo/");
+ // make sure the new namespace is there.
+ Assert (namespaceManager.HasNamespace ("foo"));
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ // push a new scope.
+ namespaceManager.PushScope ();
+ // add a new namespace.
+ namespaceManager.AddNamespace ("bar", "http://bar/");
+ // make sure the old namespace is not in this new scope.
+ Assert (!namespaceManager.HasNamespace ("foo"));
+ // but we're still supposed to be able to lookup the old namespace.
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ // make sure the new namespace is there.
+ Assert (namespaceManager.HasNamespace ("bar"));
+ AssertEquals ("http://bar/", namespaceManager.LookupNamespace ("bar"));
+ }
+
+ public void TestPopScope ()
+ {
+ // add some namespaces and a scope.
+ TestPushScope ();
+ // pop the scope.
+ Assert (namespaceManager.PopScope ());
+ // make sure the first namespace is still there.
+ Assert (namespaceManager.HasNamespace ("foo"));
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ // make sure the second namespace is no longer there.
+ Assert (!namespaceManager.HasNamespace ("bar"));
+ AssertNull (namespaceManager.LookupNamespace ("bar"));
+ // make sure there are no more scopes to pop.
+ Assert (!namespaceManager.PopScope ());
+ // make sure that popping again doesn't cause an exception.
+ Assert (!namespaceManager.PopScope ());
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlNodeListTests.cs b/mcs/class/System.XML/Test/XmlNodeListTests.cs
new file mode 100644
index 00000000000..66279bb7664
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlNodeListTests.cs
@@ -0,0 +1,215 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlNodeListTests : TestCase
+ {
+ public XmlNodeListTests () : base ("MonoTests.System.Xml.XmlNodeListTests testsuite") {}
+ public XmlNodeListTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlElement documentElement;
+ XmlElement element;
+ XmlNode node;
+ Object obj;
+ IEnumerator enumerator;
+ int index;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestNodeTypesThatCantHaveChildren ()
+ {
+ document.LoadXml ("<foo>bar</foo>");
+ documentElement = document.DocumentElement;
+ node = documentElement.FirstChild;
+ AssertEquals ("Expected a text node.", node.NodeType, XmlNodeType.Text);
+ AssertEquals ("Shouldn't have children.", node.HasChildNodes, false);
+ AssertEquals ("Should be empty node list.", node.ChildNodes.Count, 0);
+ AssertEquals ("Should be empty node list.", node.GetEnumerator().MoveNext(), false);
+ }
+
+ public void TestZeroChildren ()
+ {
+ document.LoadXml ("<foo/>");
+ documentElement = document.DocumentElement;
+ AssertEquals ("Should be empty node list.", documentElement.GetEnumerator().MoveNext(), false);
+ }
+
+ public void TestOneChild ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ documentElement = document.DocumentElement;
+ AssertEquals ("Incorrect number of children returned from Count property.", documentElement.ChildNodes.Count, 1);
+ index = 1;
+ foreach (XmlNode childNode in documentElement.ChildNodes)
+ {
+ AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
+ index++;
+ }
+ AssertEquals ("foreach didn't loop over all children correctly.", index, 2);
+ }
+
+ public void TestMultipleChildren ()
+ {
+ document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
+ element = document.DocumentElement;
+ AssertEquals ("Incorrect number of children returned from Count property.", element.ChildNodes.Count, 3);
+ AssertNull ("Index less than zero should have returned null.", element.ChildNodes [-1]);
+ AssertNull ("Index greater than or equal to Count should have returned null.", element.ChildNodes [3]);
+ AssertEquals ("Didn't return the correct child.", element.FirstChild, element.ChildNodes[0]);
+ AssertEquals ("Didn't return the correct child.", "child1", element.ChildNodes[0].LocalName);
+ AssertEquals ("Didn't return the correct child.", "child2", element.ChildNodes[1].LocalName);
+ AssertEquals ("Didn't return the correct child.", "child3", element.ChildNodes[2].LocalName);
+
+ index = 1;
+ foreach (XmlNode childNode in element.ChildNodes)
+ {
+ AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
+ index++;
+ }
+ AssertEquals ("foreach didn't loop over all children correctly.", index, 4);
+ }
+
+ public void TestAppendChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ enumerator.Reset();
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ element.AppendChild(document.CreateElement("child2"));
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ public void TestRemoveChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ element.RemoveChild(element.FirstChild);
+ enumerator.MoveNext();
+ AssertEquals ("Expected child2 element.", ((XmlElement)enumerator.Current).LocalName, "child2");
+ }
+
+ public void TestRemoveChildAffectOnEnumerationWhenEnumeratorIsOnRemovedChild ()
+ {
+ document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator ();
+ enumerator.MoveNext ();
+ enumerator.MoveNext ();
+ AssertEquals ("Expected child2 element.", "child2", ((XmlElement)enumerator.Current).LocalName);
+ AssertEquals ("Expected child2 element.", "child2", element.FirstChild.NextSibling.LocalName);
+ element.RemoveChild (element.FirstChild.NextSibling);
+ enumerator.MoveNext ();
+
+ try {
+ element = (XmlElement) enumerator.Current;
+ Fail ("Expected an InvalidOperationException.");
+ } catch (InvalidOperationException) { }
+ }
+
+ // TODO: Take the word save off front of this method when XmlNode.ReplaceChild() is implemented.
+ public void saveTestReplaceChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ element = document.DocumentElement;
+ node = document.CreateElement("child3");
+ enumerator = element.GetEnumerator();
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ element.ReplaceChild(node, element.LastChild);
+ enumerator.MoveNext();
+ AssertEquals ("Expected child3 element.", ((XmlElement)enumerator.Current).LocalName, "child3");
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ public void TestRemoveOnlyChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ element.RemoveChild(element.FirstChild);
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ // TODO: Take the word save off front of this method when XmlNode.RemoveAll() is fully implemented.
+ public void saveTestRemoveAllAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ AssertEquals ("Expected 3 children.", element.ChildNodes.Count, 3);
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ element.RemoveAll();
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ public void TestCurrentBeforeFirstNode ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ try
+ {
+ obj = enumerator.Current;
+ Fail ("Calling Current property before first node in list should have thrown InvalidOperationException.");
+ } catch (InvalidOperationException) { }
+ }
+
+ public void TestCurrentAfterLastNode ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ enumerator.MoveNext();
+ enumerator.MoveNext();
+ try
+ {
+ obj = enumerator.Current;
+ Fail ("Calling Current property after last node in list should have thrown InvalidOperationException.");
+ }
+ catch (InvalidOperationException) { }
+ }
+
+ public void TestCurrentDoesntMove ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ enumerator.MoveNext();
+ AssertEquals("Consecutive calls to Current property should yield same reference.", Object.ReferenceEquals(enumerator.Current, enumerator.Current), true);
+ }
+
+ public void TestReset ()
+ {
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ enumerator.MoveNext();
+ enumerator.MoveNext();
+ AssertEquals("Expected child2.", ((XmlElement)enumerator.Current).LocalName, "child2");
+ enumerator.Reset();
+ enumerator.MoveNext();
+ AssertEquals("Expected child1.", ((XmlElement)enumerator.Current).LocalName, "child1");
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlNodeTests.cs b/mcs/class/System.XML/Test/XmlNodeTests.cs
new file mode 100644
index 00000000000..9a8689b10e6
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlNodeTests.cs
@@ -0,0 +1,182 @@
+//
+// System.Xml.XmlNodeTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlNodeTests : TestCase
+ {
+ public XmlNodeTests () : base ("MonoTests.System.Xml.XmlNodeTests testsuite") {}
+ public XmlNodeTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlElement element;
+ XmlElement element2;
+ bool inserted;
+ bool inserting;
+ bool removed;
+ bool removing;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.NodeInserted += new XmlNodeChangedEventHandler (this.EventNodeInserted);
+ document.NodeInserting += new XmlNodeChangedEventHandler (this.EventNodeInserting);
+ document.NodeRemoved += new XmlNodeChangedEventHandler (this.EventNodeRemoved);
+ document.NodeRemoving += new XmlNodeChangedEventHandler (this.EventNodeRemoving);
+ element = document.CreateElement ("foo");
+ element2 = document.CreateElement ("bar");
+ }
+
+ private void EventNodeInserted(Object sender, XmlNodeChangedEventArgs e)
+ {
+ inserted = true;
+ }
+
+ private void EventNodeInserting (Object sender, XmlNodeChangedEventArgs e)
+ {
+ inserting = true;
+ }
+
+ private void EventNodeRemoved(Object sender, XmlNodeChangedEventArgs e)
+ {
+ removed = true;
+ }
+
+ private void EventNodeRemoving (Object sender, XmlNodeChangedEventArgs e)
+ {
+ removing = true;
+ }
+
+ public void TestAppendChild ()
+ {
+ XmlComment comment;
+
+ inserted = false;
+ inserting = false;
+ element.AppendChild (element2);
+ Assert (inserted);
+ Assert (inserting);
+
+ // Can only append to elements, documents, and attributes
+ try
+ {
+ comment = document.CreateComment ("baz");
+ comment.AppendChild (element2);
+ Fail ("Expected an InvalidOperationException to be thrown.");
+ }
+ catch (InvalidOperationException) {}
+
+ // Can't append a node from one document into another document.
+ XmlDocument document2 = new XmlDocument();
+ AssertEquals (1, element.ChildNodes.Count);
+ try
+ {
+ element2 = document2.CreateElement ("qux");
+ element.AppendChild (element2);
+ Fail ("Expected an ArgumentException to be thrown.");
+ }
+ catch (ArgumentException) {}
+ AssertEquals (1, element.ChildNodes.Count);
+
+ // Can't append to a readonly node.
+/* TODO put this in when I figure out how to create a read-only node.
+ try
+ {
+ XmlElement element3 = (XmlElement)element.CloneNode (false);
+ Assert (!element.IsReadOnly);
+ Assert (element3.IsReadOnly);
+ element2 = document.CreateElement ("quux");
+ element3.AppendChild (element2);
+ Fail ("Expected an ArgumentException to be thrown.");
+ }
+ catch (ArgumentException) {}
+*/
+ }
+
+ public void TestInsertBefore()
+ {
+ document = new XmlDocument();
+ document.LoadXml("<root><sub /></root>");
+ XmlElement docelem = document.DocumentElement;
+ docelem.InsertBefore(document.CreateElement("good_child"), docelem.FirstChild);
+ AssertEquals("InsertBefore.Normal", "good_child", docelem.FirstChild.Name);
+ try {
+ document.InsertBefore(document.CreateElement("BAD_MAN"), docelem);
+ Fail("#InsertBefore.BadPositionButNoError.1");
+ }
+ catch(XmlException) {}
+ }
+
+ public void TestInsertAfter()
+ {
+ document = new XmlDocument();
+ document.LoadXml("<root><sub1 /><sub2 /></root>");
+ XmlElement docelem = document.DocumentElement;
+ XmlElement newelem = document.CreateElement("good_child");
+ docelem.InsertAfter(newelem, docelem.FirstChild);
+ AssertEquals("InsertAfter.Normal", 3, docelem.ChildNodes.Count);
+ AssertEquals("InsertAfter.First", "sub1", docelem.FirstChild.Name);
+ AssertEquals("InsertAfter.Last", "sub2", docelem.LastChild.Name);
+ AssertEquals("InsertAfter.Prev", "good_child", docelem.FirstChild.NextSibling.Name);
+ AssertEquals("InsertAfter.Next", "good_child", docelem.LastChild.PreviousSibling.Name);
+ // this doesn't throw an exception
+ document.InsertAfter(document.CreateElement("BAD_MAN"), docelem);
+ AssertEquals("InsertAfter with bad location",
+ "<root><sub1 /><good_child /><sub2 /></root><BAD_MAN />",
+ document.InnerXml);
+}
+
+ public void TestPrependChild()
+ {
+ document = new XmlDocument();
+ document.LoadXml("<root><sub1 /><sub2 /></root>");
+ XmlElement docelem = document.DocumentElement;
+ docelem.PrependChild(document.CreateElement("prepender"));
+ AssertEquals("PrependChild", "prepender", docelem.FirstChild.Name);
+ }
+
+ public void saveTestRemoveAll ()
+ {
+ // TODO: put this test back in when AttributeCollection.RemoveAll() is implemented.
+ element.AppendChild(element2);
+ removed = false;
+ removing = false;
+ element.RemoveAll ();
+ Assert (removed);
+ Assert (removing);
+ }
+
+ public void TestRemoveChild ()
+ {
+ element.AppendChild(element2);
+ removed = false;
+ removing = false;
+ element.RemoveChild (element2);
+ Assert (removed);
+ Assert (removing);
+ }
+
+ public void TestGetPrefixOfNamespace ()
+ {
+ document.LoadXml ("<root><c1 xmlns='urn:foo'><c2 xmlns:foo='urn:foo' xmlns='urn:bar'><c3 xmlns=''/></c2></c1></root>");
+ AssertEquals ("root", String.Empty, document.DocumentElement.GetPrefixOfNamespace ("urn:foo"));
+ AssertEquals ("c1", String.Empty, document.DocumentElement.GetPrefixOfNamespace ("urn:foo"));
+ AssertEquals ("c2", String.Empty, document.DocumentElement.FirstChild.GetPrefixOfNamespace ("urn:foo"));
+ AssertEquals ("c3", "foo", document.DocumentElement.FirstChild.FirstChild.GetPrefixOfNamespace ("urn:foo"));
+
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs b/mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs
new file mode 100644
index 00000000000..0926af316aa
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs
@@ -0,0 +1,36 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlProcessingInstructionTests : TestCase
+ {
+ public XmlProcessingInstructionTests () : base ("MonoTests.System.Xml.XmlProcessingInstructionTests testsuite") {}
+ public XmlProcessingInstructionTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlProcessingInstruction pi;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ pi = document.CreateProcessingInstruction ("foo", "bar");
+ AssertEquals (String.Empty, pi.InnerXml);
+ AssertEquals ("<?foo bar?>", pi.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs b/mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs
new file mode 100755
index 00000000000..870d9869720
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs
@@ -0,0 +1,127 @@
+//
+// System.Xml.XmlWhitespaceTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlSignificantWhitespaceTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocument doc2;
+ XmlSignificantWhitespace whitespace;
+ XmlSignificantWhitespace broken;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlSignificantWhitespaceTests () : base ("MonoTests.System.Xml.XmlWhitespaceTests testsuite") {}
+ public XmlSignificantWhitespaceTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ XmlElement element = document.CreateElement ("foo");
+ whitespace = document.CreateSignificantWhitespace ("\r\n");
+ element.AppendChild (whitespace);
+
+ doc2 = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ whitespace = doc2.CreateSignificantWhitespace ("\r\n\t ");
+ AssertEquals (String.Empty, whitespace.InnerXml);
+ AssertEquals ("\r\n\t ", whitespace.OuterXml);
+ }
+
+ public void TestDataAndValue ()
+ {
+ string val = "\t\t\r\n ";
+ whitespace = doc2.CreateSignificantWhitespace (val);
+ AssertEquals ("#DataValue.1", val, whitespace.Data);
+ AssertEquals ("#DataValue.2", val, whitespace.Value);
+ whitespace.Value = val + "\t";
+ AssertEquals ("#DataValue.3", val + "\t", whitespace.Data);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ cloned.Value, original.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlSignificantWhitespaceBadConstructor ()
+ {
+ try {
+ broken = document.CreateSignificantWhitespace ("black");
+
+ } catch (ArgumentException) {
+ return;
+
+ } catch (Exception) {
+ Fail ("Incorrect Exception thrown.");
+ }
+ }
+
+ public void TestXmlSignificantWhitespaceConstructor ()
+ {
+ AssertEquals ("whitespace char didn't get copied right",
+ "\r\n", whitespace.Data);
+ }
+
+
+ public void TestXmlSignificantWhitespaceName ()
+ {
+ AssertEquals (whitespace.NodeType + " Name property broken",
+ whitespace.Name, "#significant-whitespace");
+ }
+
+ public void TestXmlSignificantWhitespaceLocalName ()
+ {
+ AssertEquals (whitespace.NodeType + " LocalName property broken",
+ whitespace.LocalName, "#significant-whitespace");
+ }
+
+ public void TestXmlSignificantWhitespaceNodeType ()
+ {
+ AssertEquals ("XmlSignificantWhitespace NodeType property broken",
+ whitespace.NodeType.ToString (), "SignificantWhitespace");
+ }
+
+ public void TestXmlSignificantWhitespaceIsReadOnly ()
+ {
+ AssertEquals ("XmlSignificantWhitespace IsReadOnly property broken",
+ whitespace.IsReadOnly, false);
+ }
+
+ public void TestXmlSignificantWhitespaceCloneNode ()
+ {
+ original = whitespace;
+
+ shallow = whitespace.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = whitespace.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlTextReaderTests.cs b/mcs/class/System.XML/Test/XmlTextReaderTests.cs
new file mode 100644
index 00000000000..83d9c8f160d
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlTextReaderTests.cs
@@ -0,0 +1,1776 @@
+//
+// XmlTextReaderTests.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Text;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlTextReaderTests : TestCase
+ {
+ public XmlTextReaderTests () : base ("MonoTests.System.Xml.XmlTextReaderTests testsuite") { }
+ public XmlTextReaderTests (string name) : base (name) { }
+
+ private void AssertStartDocument (XmlReader xmlReader)
+ {
+ Assert (xmlReader.ReadState == ReadState.Initial);
+ Assert (xmlReader.NodeType == XmlNodeType.None);
+ Assert (xmlReader.Depth == 0);
+ Assert (!xmlReader.EOF);
+ }
+
+ private void AssertNode (
+ XmlReader xmlReader,
+ XmlNodeType nodeType,
+ int depth,
+ bool isEmptyElement,
+ string name,
+ string prefix,
+ string localName,
+ string namespaceURI,
+ string value,
+ int attributeCount)
+ {
+ Assert (xmlReader.Read ());
+ Assert (xmlReader.ReadState == ReadState.Interactive);
+ Assert (!xmlReader.EOF);
+ AssertNodeValues (xmlReader, nodeType, depth, isEmptyElement, name, prefix, localName, namespaceURI, value, attributeCount);
+ }
+
+ private void AssertNodeValues (
+ XmlReader xmlReader,
+ XmlNodeType nodeType,
+ int depth,
+ bool isEmptyElement,
+ string name,
+ string prefix,
+ string localName,
+ string namespaceURI,
+ string value,
+ int attributeCount)
+ {
+ AssertEquals ("NodeType", nodeType, xmlReader.NodeType);
+ AssertEquals ("Depth", depth, xmlReader.Depth);
+ AssertEquals ("IsEmptyElement", isEmptyElement, xmlReader.IsEmptyElement);
+
+ AssertEquals ("name", name, xmlReader.Name);
+
+ AssertEquals ("prefix", prefix, xmlReader.Prefix);
+
+ AssertEquals ("localName", localName, xmlReader.LocalName);
+
+ AssertEquals ("namespaceURI", namespaceURI, xmlReader.NamespaceURI);
+
+ AssertEquals ("hasValue", (value != String.Empty), xmlReader.HasValue);
+
+ AssertEquals ("Value", value, xmlReader.Value);
+
+ AssertEquals ("hasAttributes", attributeCount > 0, xmlReader.HasAttributes);
+
+ AssertEquals ("attributeCount", attributeCount, xmlReader.AttributeCount);
+ }
+
+ private void AssertAttribute (
+ XmlReader xmlReader,
+ string name,
+ string prefix,
+ string localName,
+ string namespaceURI,
+ string value)
+ {
+ AssertEquals ("value", value, xmlReader [name]);
+
+ Assert (xmlReader.GetAttribute (name) == value);
+
+ if (namespaceURI != String.Empty) {
+ Assert (xmlReader[localName, namespaceURI] == value);
+ Assert (xmlReader.GetAttribute (localName, namespaceURI) == value);
+ }
+ }
+
+ private void AssertEndDocument (XmlReader xmlReader)
+ {
+ Assert ("could read", !xmlReader.Read ());
+ AssertEquals ("NodeType is not XmlNodeType.None", XmlNodeType.None, xmlReader.NodeType);
+ AssertEquals ("Depth is not 0", 0, xmlReader.Depth);
+ AssertEquals ("ReadState is not ReadState.EndOfFile", ReadState.EndOfFile, xmlReader.ReadState);
+ Assert ("not EOF", xmlReader.EOF);
+
+ xmlReader.Close ();
+ AssertEquals ("ReadState is not ReadState.Cosed", ReadState.Closed, xmlReader.ReadState);
+ }
+
+ public void TestEmptyElement ()
+ {
+ string xml = "<foo/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithBadName ()
+ {
+ string xml = "<1foo/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ bool caughtXmlException = false;
+
+ try {
+ xmlReader.Read();
+ } catch (XmlException) {
+ caughtXmlException = true;
+ }
+
+ Assert(caughtXmlException);
+ }
+
+ public void TestEmptyElementWithWhitespace ()
+ {
+ string xml = "<foo />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithStartAndEndTag ()
+ {
+ string xml = "<foo></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithStartAndEndTagWithWhitespace ()
+ {
+ string xml = "<foo ></foo >";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestNestedEmptyTag ()
+ {
+ string xml = "<foo><bar/></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 1, //depth
+ true, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestNestedText ()
+ {
+ string xml = "<foo>bar</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithAttribute ()
+ {
+ string xml = @"<foo bar=""baz""/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestStartAndEndTagWithAttribute ()
+ {
+ string xml = @"<foo bar='baz'></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithTwoAttributes ()
+ {
+ string xml = @"<foo bar=""baz"" quux='quuux'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "quux", // name
+ String.Empty, // prefix
+ "quux", // localName
+ String.Empty, // namespaceURI
+ "quuux" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestProcessingInstructionBeforeDocumentElement ()
+ {
+ string xml = "<?foo bar?><baz/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.ProcessingInstruction, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCommentBeforeDocumentElement ()
+ {
+ string xml = "<!--foo--><bar/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Comment, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "foo", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestPredefinedEntities ()
+ {
+ string xml = "<foo>&lt;&gt;&amp;&apos;&quot;</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "<>&'\"", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEntityReference ()
+ {
+ string xml = "<foo>&bar;</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EntityReference, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEntityReferenceInsideText ()
+ {
+ string xml = "<foo>bar&baz;quux</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EntityReference, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "quux", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCharacterReferences ()
+ {
+ string xml = "<foo>&#70;&#x4F;&#x4f;</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "FOO", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEntityReferenceInAttribute ()
+ {
+ string xml = "<foo bar='&baz;'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "&baz;" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestPredefinedEntitiesInAttribute ()
+ {
+ string xml = "<foo bar='&lt;&gt;&amp;&apos;&quot;'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "<>&'\"" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCharacterReferencesInAttribute ()
+ {
+ string xml = "<foo bar='&#70;&#x4F;&#x4f;'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "FOO" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCDATA ()
+ {
+ string xml = "<foo><![CDATA[<>&]]></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.CDATA, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "<>&", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementInNamespace ()
+ {
+ string xml = @"<foo:bar xmlns:foo='http://foo/' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:foo", // name
+ "xmlns", // prefix
+ "foo", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementInDefaultNamespace ()
+ {
+ string xml = @"<foo xmlns='http://foo/' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns", // name
+ String.Empty, // prefix
+ "xmlns", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace (String.Empty));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestChildElementInNamespace ()
+ {
+ string xml = @"<foo:bar xmlns:foo='http://foo/'><baz:quux xmlns:baz='http://baz/' /></foo:bar>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:foo", // name
+ "xmlns", // prefix
+ "foo", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 1, // depth
+ true, // isEmptyElement
+ "baz:quux", // name
+ "baz", // prefix
+ "quux", // localName
+ "http://baz/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:baz", // name
+ "xmlns", // prefix
+ "baz", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://baz/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+ AssertEquals ("http://baz/", xmlReader.LookupNamespace ("baz"));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+ AssertNull (xmlReader.LookupNamespace ("baz"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestChildElementInDefaultNamespace ()
+ {
+ string xml = @"<foo:bar xmlns:foo='http://foo/'><baz xmlns='http://baz/' /></foo:bar>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:foo", // name
+ "xmlns", // prefix
+ "foo", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 1, // depth
+ true, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ "http://baz/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns", // name
+ String.Empty, // prefix
+ "xmlns", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://baz/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+ AssertEquals ("http://baz/", xmlReader.LookupNamespace (String.Empty));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestAttributeInNamespace ()
+ {
+ string xml = @"<foo bar:baz='quux' xmlns:bar='http://bar/' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar:baz", // name
+ "bar", // prefix
+ "baz", // localName
+ "http://bar/", // namespaceURI
+ "quux" // value
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:bar", // name
+ "xmlns", // prefix
+ "bar", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://bar/" // value
+ );
+
+ AssertEquals ("http://bar/", xmlReader.LookupNamespace ("bar"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+// The following is #if'ed out because it's specific to the Mono
+// implementation and won't compile when testing Microsoft's code.
+// Feel free to turn it on if you want to test Mono's name tables.
+
+#if false
+
+ public void TestIsFirstNameChar ()
+ {
+ for (int ch = 0; ch <= 0xFFFF; ++ch) {
+ Assert (
+ XmlChar.IsFirstNameChar (ch) ==
+ IsFirstNameChar (ch));
+ }
+ }
+
+ public void TestIsNameChar ()
+ {
+ for (int ch = 0; ch <= 0xFFFF; ++ch) {
+ Assert (
+ XmlChar.IsNameChar (ch) ==
+ IsNameChar (ch));
+ }
+ }
+
+ private static bool IsFirstNameChar (int ch)
+ {
+ return
+ IsLetter (ch) ||
+ (ch == '_') ||
+ (ch == ':');
+ }
+
+ private static bool IsNameChar (int ch)
+ {
+ return
+ IsLetter (ch) ||
+ IsDigit (ch) ||
+ (ch == '.') ||
+ (ch == '-') ||
+ (ch == '_') ||
+ (ch == ':') ||
+ IsCombiningChar (ch) ||
+ IsExtender (ch);
+ }
+
+ private static bool IsLetter (int ch)
+ {
+ return
+ IsBaseChar (ch) ||
+ IsIdeographic (ch);
+ }
+
+ private static bool IsBaseChar (int ch)
+ {
+ return
+ (ch >= 0x0041 && ch <= 0x005A) ||
+ (ch >= 0x0061 && ch <= 0x007A) ||
+ (ch >= 0x00C0 && ch <= 0x00D6) ||
+ (ch >= 0x00D8 && ch <= 0x00F6) ||
+ (ch >= 0x00F8 && ch <= 0x00FF) ||
+ (ch >= 0x0100 && ch <= 0x0131) ||
+ (ch >= 0x0134 && ch <= 0x013E) ||
+ (ch >= 0x0141 && ch <= 0x0148) ||
+ (ch >= 0x014A && ch <= 0x017E) ||
+ (ch >= 0x0180 && ch <= 0x01C3) ||
+ (ch >= 0x01CD && ch <= 0x01F0) ||
+ (ch >= 0x01F4 && ch <= 0x01F5) ||
+ (ch >= 0x01FA && ch <= 0x0217) ||
+ (ch >= 0x0250 && ch <= 0x02A8) ||
+ (ch >= 0x02BB && ch <= 0x02C1) ||
+ (ch == 0x0386) ||
+ (ch >= 0x0388 && ch <= 0x038A) ||
+ (ch == 0x038C) ||
+ (ch >= 0x038E && ch <= 0x03A1) ||
+ (ch >= 0x03A3 && ch <= 0x03CE) ||
+ (ch >= 0x03D0 && ch <= 0x03D6) ||
+ (ch == 0x03DA) ||
+ (ch == 0x03DC) ||
+ (ch == 0x03DE) ||
+ (ch == 0x03E0) ||
+ (ch >= 0x03E2 && ch <= 0x03F3) ||
+ (ch >= 0x0401 && ch <= 0x040C) ||
+ (ch >= 0x040E && ch <= 0x044F) ||
+ (ch >= 0x0451 && ch <= 0x045C) ||
+ (ch >= 0x045E && ch <= 0x0481) ||
+ (ch >= 0x0490 && ch <= 0x04C4) ||
+ (ch >= 0x04C7 && ch <= 0x04C8) ||
+ (ch >= 0x04CB && ch <= 0x04CC) ||
+ (ch >= 0x04D0 && ch <= 0x04EB) ||
+ (ch >= 0x04EE && ch <= 0x04F5) ||
+ (ch >= 0x04F8 && ch <= 0x04F9) ||
+ (ch >= 0x0531 && ch <= 0x0556) ||
+ (ch == 0x0559) ||
+ (ch >= 0x0561 && ch <= 0x0586) ||
+ (ch >= 0x05D0 && ch <= 0x05EA) ||
+ (ch >= 0x05F0 && ch <= 0x05F2) ||
+ (ch >= 0x0621 && ch <= 0x063A) ||
+ (ch >= 0x0641 && ch <= 0x064A) ||
+ (ch >= 0x0671 && ch <= 0x06B7) ||
+ (ch >= 0x06BA && ch <= 0x06BE) ||
+ (ch >= 0x06C0 && ch <= 0x06CE) ||
+ (ch >= 0x06D0 && ch <= 0x06D3) ||
+ (ch == 0x06D5) ||
+ (ch >= 0x06E5 && ch <= 0x06E6) ||
+ (ch >= 0x0905 && ch <= 0x0939) ||
+ (ch == 0x093D) ||
+ (ch >= 0x0958 && ch <= 0x0961) ||
+ (ch >= 0x0985 && ch <= 0x098C) ||
+ (ch >= 0x098F && ch <= 0x0990) ||
+ (ch >= 0x0993 && ch <= 0x09A8) ||
+ (ch >= 0x09AA && ch <= 0x09B0) ||
+ (ch == 0x09B2) ||
+ (ch >= 0x09B6 && ch <= 0x09B9) ||
+ (ch >= 0x09DC && ch <= 0x09DD) ||
+ (ch >= 0x09DF && ch <= 0x09E1) ||
+ (ch >= 0x09F0 && ch <= 0x09F1) ||
+ (ch >= 0x0A05 && ch <= 0x0A0A) ||
+ (ch >= 0x0A0F && ch <= 0x0A10) ||
+ (ch >= 0x0A13 && ch <= 0x0A28) ||
+ (ch >= 0x0A2A && ch <= 0x0A30) ||
+ (ch >= 0x0A32 && ch <= 0x0A33) ||
+ (ch >= 0x0A35 && ch <= 0x0A36) ||
+ (ch >= 0x0A38 && ch <= 0x0A39) ||
+ (ch >= 0x0A59 && ch <= 0x0A5C) ||
+ (ch == 0x0A5E) ||
+ (ch >= 0x0A72 && ch <= 0x0A74) ||
+ (ch >= 0x0A85 && ch <= 0x0A8B) ||
+ (ch == 0x0A8D) ||
+ (ch >= 0x0A8F && ch <= 0x0A91) ||
+ (ch >= 0x0A93 && ch <= 0x0AA8) ||
+ (ch >= 0x0AAA && ch <= 0x0AB0) ||
+ (ch >= 0x0AB2 && ch <= 0x0AB3) ||
+ (ch >= 0x0AB5 && ch <= 0x0AB9) ||
+ (ch == 0x0ABD) ||
+ (ch == 0x0AE0) ||
+ (ch >= 0x0B05 && ch <= 0x0B0C) ||
+ (ch >= 0x0B0F && ch <= 0x0B10) ||
+ (ch >= 0x0B13 && ch <= 0x0B28) ||
+ (ch >= 0x0B2A && ch <= 0x0B30) ||
+ (ch >= 0x0B32 && ch <= 0x0B33) ||
+ (ch >= 0x0B36 && ch <= 0x0B39) ||
+ (ch == 0x0B3D) ||
+ (ch >= 0x0B5C && ch <= 0x0B5D) ||
+ (ch >= 0x0B5F && ch <= 0x0B61) ||
+ (ch >= 0x0B85 && ch <= 0x0B8A) ||
+ (ch >= 0x0B8E && ch <= 0x0B90) ||
+ (ch >= 0x0B92 && ch <= 0x0B95) ||
+ (ch >= 0x0B99 && ch <= 0x0B9A) ||
+ (ch == 0x0B9C) ||
+ (ch >= 0x0B9E && ch <= 0x0B9F) ||
+ (ch >= 0x0BA3 && ch <= 0x0BA4) ||
+ (ch >= 0x0BA8 && ch <= 0x0BAA) ||
+ (ch >= 0x0BAE && ch <= 0x0BB5) ||
+ (ch >= 0x0BB7 && ch <= 0x0BB9) ||
+ (ch >= 0x0C05 && ch <= 0x0C0C) ||
+ (ch >= 0x0C0E && ch <= 0x0C10) ||
+ (ch >= 0x0C12 && ch <= 0x0C28) ||
+ (ch >= 0x0C2A && ch <= 0x0C33) ||
+ (ch >= 0x0C35 && ch <= 0x0C39) ||
+ (ch >= 0x0C60 && ch <= 0x0C61) ||
+ (ch >= 0x0C85 && ch <= 0x0C8C) ||
+ (ch >= 0x0C8E && ch <= 0x0C90) ||
+ (ch >= 0x0C92 && ch <= 0x0CA8) ||
+ (ch >= 0x0CAA && ch <= 0x0CB3) ||
+ (ch >= 0x0CB5 && ch <= 0x0CB9) ||
+ (ch == 0x0CDE) ||
+ (ch >= 0x0CE0 && ch <= 0x0CE1) ||
+ (ch >= 0x0D05 && ch <= 0x0D0C) ||
+ (ch >= 0x0D0E && ch <= 0x0D10) ||
+ (ch >= 0x0D12 && ch <= 0x0D28) ||
+ (ch >= 0x0D2A && ch <= 0x0D39) ||
+ (ch >= 0x0D60 && ch <= 0x0D61) ||
+ (ch >= 0x0E01 && ch <= 0x0E2E) ||
+ (ch == 0x0E30) ||
+ (ch >= 0x0E32 && ch <= 0x0E33) ||
+ (ch >= 0x0E40 && ch <= 0x0E45) ||
+ (ch >= 0x0E81 && ch <= 0x0E82) ||
+ (ch == 0x0E84) ||
+ (ch >= 0x0E87 && ch <= 0x0E88) ||
+ (ch == 0x0E8A) ||
+ (ch == 0x0E8D) ||
+ (ch >= 0x0E94 && ch <= 0x0E97) ||
+ (ch >= 0x0E99 && ch <= 0x0E9F) ||
+ (ch >= 0x0EA1 && ch <= 0x0EA3) ||
+ (ch == 0x0EA5) ||
+ (ch == 0x0EA7) ||
+ (ch >= 0x0EAA && ch <= 0x0EAB) ||
+ (ch >= 0x0EAD && ch <= 0x0EAE) ||
+ (ch == 0x0EB0) ||
+ (ch >= 0x0EB2 && ch <= 0x0EB3) ||
+ (ch == 0x0EBD) ||
+ (ch >= 0x0EC0 && ch <= 0x0EC4) ||
+ (ch >= 0x0F40 && ch <= 0x0F47) ||
+ (ch >= 0x0F49 && ch <= 0x0F69) ||
+ (ch >= 0x10A0 && ch <= 0x10C5) ||
+ (ch >= 0x10D0 && ch <= 0x10F6) ||
+ (ch == 0x1100) ||
+ (ch >= 0x1102 && ch <= 0x1103) ||
+ (ch >= 0x1105 && ch <= 0x1107) ||
+ (ch == 0x1109) ||
+ (ch >= 0x110B && ch <= 0x110C) ||
+ (ch >= 0x110E && ch <= 0x1112) ||
+ (ch == 0x113C) ||
+ (ch == 0x113E) ||
+ (ch == 0x1140) ||
+ (ch == 0x114C) ||
+ (ch == 0x114E) ||
+ (ch == 0x1150) ||
+ (ch >= 0x1154 && ch <= 0x1155) ||
+ (ch == 0x1159) ||
+ (ch >= 0x115F && ch <= 0x1161) ||
+ (ch == 0x1163) ||
+ (ch == 0x1165) ||
+ (ch == 0x1167) ||
+ (ch == 0x1169) ||
+ (ch >= 0x116D && ch <= 0x116E) ||
+ (ch >= 0x1172 && ch <= 0x1173) ||
+ (ch == 0x1175) ||
+ (ch == 0x119E) ||
+ (ch == 0x11A8) ||
+ (ch == 0x11AB) ||
+ (ch >= 0x11AE && ch <= 0x11AF) ||
+ (ch >= 0x11B7 && ch <= 0x11B8) ||
+ (ch == 0x11BA) ||
+ (ch >= 0x11BC && ch <= 0x11C2) ||
+ (ch == 0x11EB) ||
+ (ch == 0x11F0) ||
+ (ch == 0x11F9) ||
+ (ch >= 0x1E00 && ch <= 0x1E9B) ||
+ (ch >= 0x1EA0 && ch <= 0x1EF9) ||
+ (ch >= 0x1F00 && ch <= 0x1F15) ||
+ (ch >= 0x1F18 && ch <= 0x1F1D) ||
+ (ch >= 0x1F20 && ch <= 0x1F45) ||
+ (ch >= 0x1F48 && ch <= 0x1F4D) ||
+ (ch >= 0x1F50 && ch <= 0x1F57) ||
+ (ch == 0x1F59) ||
+ (ch == 0x1F5B) ||
+ (ch == 0x1F5D) ||
+ (ch >= 0x1F5F && ch <= 0x1F7D) ||
+ (ch >= 0x1F80 && ch <= 0x1FB4) ||
+ (ch >= 0x1FB6 && ch <= 0x1FBC) ||
+ (ch == 0x1FBE) ||
+ (ch >= 0x1FC2 && ch <= 0x1FC4) ||
+ (ch >= 0x1FC6 && ch <= 0x1FCC) ||
+ (ch >= 0x1FD0 && ch <= 0x1FD3) ||
+ (ch >= 0x1FD6 && ch <= 0x1FDB) ||
+ (ch >= 0x1FE0 && ch <= 0x1FEC) ||
+ (ch >= 0x1FF2 && ch <= 0x1FF4) ||
+ (ch >= 0x1FF6 && ch <= 0x1FFC) ||
+ (ch == 0x2126) ||
+ (ch >= 0x212A && ch <= 0x212B) ||
+ (ch == 0x212E) ||
+ (ch >= 0x2180 && ch <= 0x2182) ||
+ (ch >= 0x3041 && ch <= 0x3094) ||
+ (ch >= 0x30A1 && ch <= 0x30FA) ||
+ (ch >= 0x3105 && ch <= 0x312C) ||
+ (ch >= 0xAC00 && ch <= 0xD7A3);
+ }
+
+ private static bool IsIdeographic (int ch)
+ {
+ return
+ (ch >= 0x4E00 && ch <= 0x9FA5) ||
+ (ch == 0x3007) ||
+ (ch >= 0x3021 && ch <= 0x3029);
+ }
+
+ private static bool IsDigit (int ch)
+ {
+ return
+ (ch >= 0x0030 && ch <= 0x0039) ||
+ (ch >= 0x0660 && ch <= 0x0669) ||
+ (ch >= 0x06F0 && ch <= 0x06F9) ||
+ (ch >= 0x0966 && ch <= 0x096F) ||
+ (ch >= 0x09E6 && ch <= 0x09EF) ||
+ (ch >= 0x0A66 && ch <= 0x0A6F) ||
+ (ch >= 0x0AE6 && ch <= 0x0AEF) ||
+ (ch >= 0x0B66 && ch <= 0x0B6F) ||
+ (ch >= 0x0BE7 && ch <= 0x0BEF) ||
+ (ch >= 0x0C66 && ch <= 0x0C6F) ||
+ (ch >= 0x0CE6 && ch <= 0x0CEF) ||
+ (ch >= 0x0D66 && ch <= 0x0D6F) ||
+ (ch >= 0x0E50 && ch <= 0x0E59) ||
+ (ch >= 0x0ED0 && ch <= 0x0ED9) ||
+ (ch >= 0x0F20 && ch <= 0x0F29);
+ }
+
+ private static bool IsCombiningChar (int ch)
+ {
+ return
+ (ch >= 0x0300 && ch <= 0x0345) ||
+ (ch >= 0x0360 && ch <= 0x0361) ||
+ (ch >= 0x0483 && ch <= 0x0486) ||
+ (ch >= 0x0591 && ch <= 0x05A1) ||
+ (ch >= 0x05A3 && ch <= 0x05B9) ||
+ (ch >= 0x05BB && ch <= 0x05BD) ||
+ (ch == 0x05BF) ||
+ (ch >= 0x05C1 && ch <= 0x05C2) ||
+ (ch == 0x05C4) ||
+ (ch >= 0x064B && ch <= 0x0652) ||
+ (ch == 0x0670) ||
+ (ch >= 0x06D6 && ch <= 0x06DC) ||
+ (ch >= 0x06DD && ch <= 0x06DF) ||
+ (ch >= 0x06E0 && ch <= 0x06E4) ||
+ (ch >= 0x06E7 && ch <= 0x06E8) ||
+ (ch >= 0x06EA && ch <= 0x06ED) ||
+ (ch >= 0x0901 && ch <= 0x0903) ||
+ (ch == 0x093C) ||
+ (ch >= 0x093E && ch <= 0x094C) ||
+ (ch == 0x094D) ||
+ (ch >= 0x0951 && ch <= 0x0954) ||
+ (ch >= 0x0962 && ch <= 0x0963) ||
+ (ch >= 0x0981 && ch <= 0x0983) ||
+ (ch == 0x09BC) ||
+ (ch == 0x09BE) ||
+ (ch == 0x09BF) ||
+ (ch >= 0x09C0 && ch <= 0x09C4) ||
+ (ch >= 0x09C7 && ch <= 0x09C8) ||
+ (ch >= 0x09CB && ch <= 0x09CD) ||
+ (ch == 0x09D7) ||
+ (ch >= 0x09E2 && ch <= 0x09E3) ||
+ (ch == 0x0A02) ||
+ (ch == 0x0A3C) ||
+ (ch == 0x0A3E) ||
+ (ch == 0x0A3F) ||
+ (ch >= 0x0A40 && ch <= 0x0A42) ||
+ (ch >= 0x0A47 && ch <= 0x0A48) ||
+ (ch >= 0x0A4B && ch <= 0x0A4D) ||
+ (ch >= 0x0A70 && ch <= 0x0A71) ||
+ (ch >= 0x0A81 && ch <= 0x0A83) ||
+ (ch == 0x0ABC) ||
+ (ch >= 0x0ABE && ch <= 0x0AC5) ||
+ (ch >= 0x0AC7 && ch <= 0x0AC9) ||
+ (ch >= 0x0ACB && ch <= 0x0ACD) ||
+ (ch >= 0x0B01 && ch <= 0x0B03) ||
+ (ch == 0x0B3C) ||
+ (ch >= 0x0B3E && ch <= 0x0B43) ||
+ (ch >= 0x0B47 && ch <= 0x0B48) ||
+ (ch >= 0x0B4B && ch <= 0x0B4D) ||
+ (ch >= 0x0B56 && ch <= 0x0B57) ||
+ (ch >= 0x0B82 && ch <= 0x0B83) ||
+ (ch >= 0x0BBE && ch <= 0x0BC2) ||
+ (ch >= 0x0BC6 && ch <= 0x0BC8) ||
+ (ch >= 0x0BCA && ch <= 0x0BCD) ||
+ (ch == 0x0BD7) ||
+ (ch >= 0x0C01 && ch <= 0x0C03) ||
+ (ch >= 0x0C3E && ch <= 0x0C44) ||
+ (ch >= 0x0C46 && ch <= 0x0C48) ||
+ (ch >= 0x0C4A && ch <= 0x0C4D) ||
+ (ch >= 0x0C55 && ch <= 0x0C56) ||
+ (ch >= 0x0C82 && ch <= 0x0C83) ||
+ (ch >= 0x0CBE && ch <= 0x0CC4) ||
+ (ch >= 0x0CC6 && ch <= 0x0CC8) ||
+ (ch >= 0x0CCA && ch <= 0x0CCD) ||
+ (ch >= 0x0CD5 && ch <= 0x0CD6) ||
+ (ch >= 0x0D02 && ch <= 0x0D03) ||
+ (ch >= 0x0D3E && ch <= 0x0D43) ||
+ (ch >= 0x0D46 && ch <= 0x0D48) ||
+ (ch >= 0x0D4A && ch <= 0x0D4D) ||
+ (ch == 0x0D57) ||
+ (ch == 0x0E31) ||
+ (ch >= 0x0E34 && ch <= 0x0E3A) ||
+ (ch >= 0x0E47 && ch <= 0x0E4E) ||
+ (ch == 0x0EB1) ||
+ (ch >= 0x0EB4 && ch <= 0x0EB9) ||
+ (ch >= 0x0EBB && ch <= 0x0EBC) ||
+ (ch >= 0x0EC8 && ch <= 0x0ECD) ||
+ (ch >= 0x0F18 && ch <= 0x0F19) ||
+ (ch == 0x0F35) ||
+ (ch == 0x0F37) ||
+ (ch == 0x0F39) ||
+ (ch == 0x0F3E) ||
+ (ch == 0x0F3F) ||
+ (ch >= 0x0F71 && ch <= 0x0F84) ||
+ (ch >= 0x0F86 && ch <= 0x0F8B) ||
+ (ch >= 0x0F90 && ch <= 0x0F95) ||
+ (ch == 0x0F97) ||
+ (ch >= 0x0F99 && ch <= 0x0FAD) ||
+ (ch >= 0x0FB1 && ch <= 0x0FB7) ||
+ (ch == 0x0FB9) ||
+ (ch >= 0x20D0 && ch <= 0x20DC) ||
+ (ch == 0x20E1) ||
+ (ch >= 0x302A && ch <= 0x302F) ||
+ (ch == 0x3099) ||
+ (ch == 0x309A);
+ }
+
+ private static bool IsExtender (int ch)
+ {
+ return
+ (ch == 0x00B7) ||
+ (ch == 0x02D0) ||
+ (ch == 0x02D1) ||
+ (ch == 0x0387) ||
+ (ch == 0x0640) ||
+ (ch == 0x0E46) ||
+ (ch == 0x0EC6) ||
+ (ch == 0x3005) ||
+ (ch >= 0x3031 && ch <= 0x3035) ||
+ (ch >= 0x309D && ch <= 0x309E) ||
+ (ch >= 0x30FC && ch <= 0x30FE);
+ }
+
+#endif
+
+ public void TestIsName ()
+ {
+ Assert (XmlReader.IsName ("foo"));
+ Assert (!XmlReader.IsName ("1foo"));
+ Assert (!XmlReader.IsName (" foo"));
+ }
+
+ public void TestIsNameToken ()
+ {
+ Assert (XmlReader.IsNameToken ("foo"));
+ Assert (XmlReader.IsNameToken ("1foo"));
+ Assert (!XmlReader.IsNameToken (" foo"));
+ }
+
+ public void TestMoveToElementFromAttribute ()
+ {
+ string xml = @"<foo bar=""baz"" />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (xmlReader.MoveToFirstAttribute ());
+ AssertEquals (XmlNodeType.Attribute, xmlReader.NodeType);
+ Assert (xmlReader.MoveToElement ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToElementFromElement ()
+ {
+ string xml = @"<foo bar=""baz"" />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (!xmlReader.MoveToElement ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToFirstAttributeWithNoAttributes ()
+ {
+ string xml = @"<foo />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (!xmlReader.MoveToFirstAttribute ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToNextAttributeWithNoAttributes ()
+ {
+ string xml = @"<foo />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (!xmlReader.MoveToNextAttribute ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToNextAttribute()
+ {
+ string xml = @"<foo bar=""baz"" quux='quuux'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "quux", // name
+ String.Empty, // prefix
+ "quux", // localName
+ String.Empty, // namespaceURI
+ "quuux" // value
+ );
+
+ Assert (xmlReader.MoveToNextAttribute ());
+ Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
+ Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
+
+ Assert (xmlReader.MoveToNextAttribute ());
+ Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
+ Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
+
+ Assert (!xmlReader.MoveToNextAttribute ());
+
+ Assert (xmlReader.MoveToElement ());
+
+ AssertNodeValues (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestAttributeOrder ()
+ {
+ string xml = @"<foo _1='1' _2='2' _3='3' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+
+ Assert (xmlReader.MoveToFirstAttribute ());
+ AssertEquals ("_1", xmlReader.Name);
+ Assert (xmlReader.MoveToNextAttribute ());
+ AssertEquals ("_2", xmlReader.Name);
+ Assert (xmlReader.MoveToNextAttribute ());
+ AssertEquals ("_3", xmlReader.Name);
+
+ Assert (!xmlReader.MoveToNextAttribute ());
+ }
+
+ public void TestFragmentConstructor()
+ {
+ XmlDocument doc = new XmlDocument();
+// doc.LoadXml("<root/>");
+
+ string xml = @"<foo><bar xmlns=""NSURI"">TEXT NODE</bar></foo>";
+ MemoryStream ms = new MemoryStream(Encoding.Default.GetBytes(xml));
+
+ XmlParserContext ctx = new XmlParserContext(doc.NameTable, new XmlNamespaceManager(doc.NameTable), "", "", "", "",
+ doc.BaseURI, "", XmlSpace.Default, Encoding.Default);
+
+ XmlTextReader xmlReader = new XmlTextReader(ms, XmlNodeType.Element, ctx);
+ AssertNode(xmlReader, XmlNodeType.Element, 0, false, "foo", "", "foo", "", "", 0);
+
+ AssertNode(xmlReader, XmlNodeType.Element, 1, false, "bar", "", "bar", "NSURI", "", 1);
+
+ AssertNode(xmlReader, XmlNodeType.Text, 2, false, "", "", "", "NSURI", "TEXT NODE", 0);
+
+ AssertNode(xmlReader, XmlNodeType.EndElement, 1, false, "bar", "", "bar", "NSURI", "", 0);
+
+ AssertNode(xmlReader, XmlNodeType.EndElement, 0, false, "foo", "", "foo", "", "", 0);
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestAttributeWithEntityReference ()
+ {
+ string xml = @"<a value='hello &amp; world' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+ xmlReader.Read ();
+ AssertEquals ("hello & world", xmlReader ["value"]);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlTextTests.cs b/mcs/class/System.XML/Test/XmlTextTests.cs
new file mode 100644
index 00000000000..a885402e354
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlTextTests.cs
@@ -0,0 +1,36 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlTextTests : TestCase
+ {
+ public XmlTextTests () : base ("MonoTests.System.Xml.XmlTextTests testsuite") {}
+ public XmlTextTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlText text;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ text = document.CreateTextNode ("&<>\"'");
+ AssertEquals (String.Empty, text.InnerXml);
+ AssertEquals ("&amp;&lt;&gt;\"'", text.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlTextWriterTests.cs b/mcs/class/System.XML/Test/XmlTextWriterTests.cs
new file mode 100644
index 00000000000..4643fdcbe6c
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlTextWriterTests.cs
@@ -0,0 +1,943 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlTextWriterTests : TestCase
+ {
+ public XmlTextWriterTests () : base ("MonoTests.System.Xml.XmlTextWriterTests testsuite") {}
+ public XmlTextWriterTests (string name) : base (name) {}
+
+ StringWriter sw;
+ XmlTextWriter xtw;
+
+ protected override void SetUp ()
+ {
+ sw = new StringWriter ();
+ xtw = new XmlTextWriter (sw);
+ xtw.QuoteChar = '\'';
+ }
+
+ private string StringWriterText
+ {
+ get { return sw.GetStringBuilder ().ToString (); }
+ }
+
+ public void TestAttributeNamespacesNonNamespaceAttributeBefore ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString("bar", "baz");
+ xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
+ AssertEquals ("<foo bar='baz' xmlns:abc='http://abc.def'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesNonNamespaceAttributeAfter ()
+ {
+ xtw.WriteStartElement ("foo");
+
+ xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
+ xtw.WriteAttributeString("bar", "baz");
+ AssertEquals ("<foo xmlns:abc='http://abc.def' bar='baz'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesThreeParamWithNullInNamespaceParam ()
+ {
+ xtw.WriteAttributeString ("xmlns", null, "http://abc.def");
+ AssertEquals ("xmlns='http://abc.def'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesThreeParamWithTextInNamespaceParam ()
+ {
+ try
+ {
+ xtw.WriteAttributeString ("xmlns", "http://somenamespace.com", "http://abc.def");
+ }
+ catch (ArgumentException) {}
+ }
+
+ public void TestAttributeNamespacesWithNullInNamespaceParam ()
+ {
+ xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
+ AssertEquals ("xmlns:abc='http://abc.def'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesWithTextInNamespaceParam ()
+ {
+ try {
+ xtw.WriteAttributeString ("xmlns", "abc", "http://somenamespace.com", "http://abc.def");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestAttributeNamespacesXmlnsXmlns ()
+ {
+ xtw.WriteStartElement ("foo");
+ try
+ {
+ xtw.WriteAttributeString ("xmlns", "xmlns", null, "http://abc.def");
+ Fail ("any prefix which name starts from \"xml\" must not be allowed.");
+ }
+ catch (ArgumentException e) {}
+ }
+
+ public void TestAttributeWriteAttributeString ()
+ {
+ xtw.WriteStartElement ("foo");
+
+ xtw.WriteAttributeString ("foo", "bar");
+ AssertEquals ("<foo foo='bar'", StringWriterText);
+
+ xtw.WriteAttributeString ("bar", "");
+ AssertEquals ("<foo foo='bar' bar=''", StringWriterText);
+
+ xtw.WriteAttributeString ("baz", null);
+ AssertEquals ("<foo foo='bar' bar='' baz=''", StringWriterText);
+
+ // TODO: Why does this pass Microsoft?
+ xtw.WriteAttributeString ("", "quux");
+ AssertEquals ("<foo foo='bar' bar='' baz='' ='quux'", StringWriterText);
+
+ // TODO: Why does this pass Microsoft?
+ xtw.WriteAttributeString (null, "quuux");
+ AssertEquals ("<foo foo='bar' bar='' baz='' ='quux' ='quuux'", StringWriterText);
+ }
+
+ public void TestAttributeWriteAttributeStringNotInsideOpenStartElement ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteString ("bar");
+
+ try
+ {
+ xtw.WriteAttributeString ("baz", "quux");
+ Fail ("Expected an InvalidOperationException to be thrown.");
+ }
+ catch (InvalidOperationException) {}
+ }
+
+ public void TestAttributeWriteAttributeStringWithoutParentElement ()
+ {
+ xtw.WriteAttributeString ("foo", "bar");
+ AssertEquals ("foo='bar'", StringWriterText);
+
+ xtw.WriteAttributeString ("baz", "quux");
+ AssertEquals ("foo='bar' baz='quux'", StringWriterText);
+ }
+
+ public void TestCDataValid ()
+ {
+ xtw.WriteCData ("foo");
+ AssertEquals ("WriteCData had incorrect output.", "<![CDATA[foo]]>", StringWriterText);
+ }
+
+ public void TestCDataInvalid ()
+ {
+ try {
+ xtw.WriteCData("foo]]>bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+ }
+
+ public void TestCloseOpenElements ()
+ {
+ xtw.WriteStartElement("foo");
+ xtw.WriteStartElement("bar");
+ xtw.WriteStartElement("baz");
+ xtw.Close();
+ AssertEquals ("Close didn't write out end elements properly.", "<foo><bar><baz /></bar></foo>", StringWriterText);
+ }
+
+ public void TestCloseWriteAfter ()
+ {
+ xtw.WriteElementString ("foo", "bar");
+ xtw.Close ();
+
+ // WriteEndElement and WriteStartDocument aren't tested here because
+ // they will always throw different exceptions besides 'The Writer is closed.'
+ // and there are already tests for those exceptions.
+
+ try {
+ xtw.WriteCData ("foo");
+ Fail ("WriteCData after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteComment ("foo");
+ Fail ("WriteComment after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteProcessingInstruction ("foo", "bar");
+ Fail ("WriteProcessingInstruction after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", "baz");
+ Fail ("WriteStartElement after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try
+ {
+ xtw.WriteAttributeString ("foo", "bar");
+ Fail ("WriteAttributeString after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e)
+ {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteString ("foo");
+ Fail ("WriteString after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+ }
+
+ public void TestCommentValid ()
+ {
+ xtw.WriteComment ("foo");
+ AssertEquals ("WriteComment had incorrect output.", "<!--foo-->", StringWriterText);
+ }
+
+ public void TestCommentInvalid ()
+ {
+ try {
+ xtw.WriteComment("foo-");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try {
+ xtw.WriteComment("foo-->bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+ }
+
+ public void TestConstructorsAndBaseStream ()
+ {
+ Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (null, this.xtw.BaseStream));
+
+ MemoryStream ms;
+ StreamReader sr;
+ XmlTextWriter xtw;
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, new UnicodeEncoding ());
+ xtw.WriteStartDocument ();
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms, Encoding.Unicode);
+ string expectedXmlDeclaration = "<?xml version=\"1.0\" encoding=\"utf-16\"?>";
+ string actualXmlDeclaration = sr.ReadToEnd();
+ AssertEquals (expectedXmlDeclaration, actualXmlDeclaration);
+ Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, new UnicodeEncoding ());
+ xtw.WriteStartDocument (true);
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms, Encoding.Unicode);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", sr.ReadToEnd ());
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, new UTF8Encoding ());
+ xtw.WriteStartDocument ();
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms, Encoding.UTF8);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-8\"?>", sr.ReadToEnd ());
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, null);
+ xtw.WriteStartDocument ();
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms, Encoding.UTF8);
+ AssertEquals ("<?xml version=\"1.0\"?>", sr.ReadToEnd ());
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, null);
+ xtw.WriteStartDocument (true);
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms, Encoding.UTF8);
+ AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", sr.ReadToEnd ());
+ Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
+ }
+
+ public void TestDocumentStart ()
+ {
+ xtw.WriteStartDocument ();
+ AssertEquals ("XmlDeclaration is incorrect.", "<?xml version='1.0' encoding='utf-16'?>", StringWriterText);
+
+ try
+ {
+ xtw.WriteStartDocument ();
+ Fail("Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.",
+ "WriteStartDocument should be the first call.", e.Message);
+ }
+
+ xtw = new XmlTextWriter (sw = new StringWriter ());
+ xtw.QuoteChar = '\'';
+ xtw.WriteStartDocument (true);
+ AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='yes'?>", StringWriterText);
+
+ xtw = new XmlTextWriter (sw = new StringWriter ());
+ xtw.QuoteChar = '\'';
+ xtw.WriteStartDocument (false);
+ AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='no'?>", StringWriterText);
+ }
+
+ public void TestElementEmpty ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteEndElement ();
+ AssertEquals ("Incorrect output.", "<foo />", StringWriterText);
+ }
+
+ public void TestElementWriteElementString ()
+ {
+ xtw.WriteElementString ("foo", "bar");
+ AssertEquals ("WriteElementString has incorrect output.", "<foo>bar</foo>", StringWriterText);
+
+ xtw.WriteElementString ("baz", "");
+ AssertEquals ("<foo>bar</foo><baz />", StringWriterText);
+
+ xtw.WriteElementString ("quux", null);
+ AssertEquals ("<foo>bar</foo><baz /><quux />", StringWriterText);
+
+ xtw.WriteElementString ("", "quuux");
+ AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</>", StringWriterText);
+
+ xtw.WriteElementString (null, "quuuux");
+ AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</><>quuuux</>", StringWriterText);
+ }
+
+ public void TestFormatting ()
+ {
+ xtw.Formatting = Formatting.Indented;
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("foo");
+ xtw.WriteElementString ("bar", "");
+ xtw.Close ();
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\n <bar />\r\n</foo>", StringWriterText);
+ }
+
+ public void TestFormattingInvalidXmlForFun ()
+ {
+ xtw.Formatting = Formatting.Indented;
+ xtw.IndentChar = 'x';
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartElement ("bar");
+ xtw.WriteElementString ("baz", "");
+ xtw.Close ();
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\nxx<bar>\r\nxxxx<baz />\r\nxx</bar>\r\n</foo>", StringWriterText);
+ }
+
+ public void TestFormattingFromRemarks ()
+ {
+ // Remarks section of on-line help for XmlTextWriter.Formatting suggests this test.
+ xtw.Formatting = Formatting.Indented;
+ xtw.WriteStartElement ("ol");
+ xtw.WriteStartElement ("li");
+ xtw.WriteString ("The big "); // This means "li" now has a mixed content model.
+ xtw.WriteElementString ("b", "E");
+ xtw.WriteElementString ("i", "lephant");
+ xtw.WriteString (" walks slowly.");
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ AssertEquals ("<ol>\r\n <li>The big <b>E</b><i>lephant</i> walks slowly.</li>\r\n</ol>", StringWriterText);
+ }
+
+ public void TestLookupPrefix ()
+ {
+ xtw.WriteStartElement ("root");
+
+ xtw.WriteStartElement ("one");
+ xtw.WriteAttributeString ("xmlns", "foo", null, "http://abc.def");
+ xtw.WriteAttributeString ("xmlns", "bar", null, "http://ghi.jkl");
+ AssertEquals ("foo", xtw.LookupPrefix ("http://abc.def"));
+ AssertEquals ("bar", xtw.LookupPrefix ("http://ghi.jkl"));
+ xtw.WriteEndElement ();
+
+ xtw.WriteStartElement ("two");
+ xtw.WriteAttributeString ("xmlns", "baz", null, "http://mno.pqr");
+ xtw.WriteString("quux");
+ AssertEquals ("baz", xtw.LookupPrefix ("http://mno.pqr"));
+ AssertNull (xtw.LookupPrefix ("http://abc.def"));
+ AssertNull (xtw.LookupPrefix ("http://ghi.jkl"));
+
+ AssertNull (xtw.LookupPrefix ("http://bogus"));
+ }
+
+ public void TestNamespacesAttributesPassingInNamespaces ()
+ {
+ xtw.Namespaces = false;
+ xtw.WriteStartElement ("foo");
+
+ // These shouldn't throw any exceptions since they don't pass in
+ // a namespace.
+ xtw.WriteAttributeString ("bar", "baz");
+ xtw.WriteAttributeString ("", "a", "", "b");
+ xtw.WriteAttributeString (null, "c", "", "d");
+ xtw.WriteAttributeString ("", "e", null, "f");
+ xtw.WriteAttributeString (null, "g", null, "h");
+
+ AssertEquals ("<foo bar='baz' a='b' c='d' e='f' g='h'", StringWriterText);
+
+ // These should throw ArgumentException because they pass in a
+ // namespace when Namespaces = false.
+ }
+
+ public void TestNamespacesElementsPassingInNamespaces ()
+ {
+ xtw.Namespaces = false;
+
+ // These shouldn't throw any exceptions since they don't pass in
+ // a namespace.
+ xtw.WriteElementString ("foo", "bar");
+ xtw.WriteStartElement ("baz");
+ xtw.WriteStartElement ("quux", "");
+ xtw.WriteStartElement ("quuux", null);
+ xtw.WriteStartElement (null, "a", null);
+ xtw.WriteStartElement (null, "b", "");
+ xtw.WriteStartElement ("", "c", null);
+ xtw.WriteStartElement ("", "d", "");
+
+ AssertEquals ("<foo>bar</foo><baz><quux><quuux><a><b><c><d", StringWriterText);
+
+ // These should throw ArgumentException because they pass in a
+ // namespace when Namespaces = false.
+ try {
+ xtw.WriteElementString ("qux", "http://netsack.com/", String.Empty);
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "http://netsack.com/");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", "http://netsack.com/");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", null);
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", "");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "", "");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestNamespacesNoNamespaceClearsDefaultNamespace ()
+ {
+ xtw.WriteStartElement(String.Empty, "foo", "http://netsack.com/");
+ xtw.WriteStartElement(String.Empty, "bar", String.Empty);
+ xtw.WriteElementString("baz", String.Empty, String.Empty);
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ AssertEquals ("XmlTextWriter is incorrectly outputting namespaces.",
+ "<foo xmlns='http://netsack.com/'><bar xmlns=''><baz /></bar></foo>", StringWriterText);
+ }
+
+ public void TestNamespacesPrefix ()
+ {
+ xtw.WriteStartElement ("foo", "bar", "http://netsack.com/");
+ xtw.WriteStartElement ("foo", "baz", "http://netsack.com/");
+ xtw.WriteElementString ("qux", "http://netsack.com/", String.Empty);
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ AssertEquals ("XmlTextWriter is incorrectly outputting prefixes.",
+ "<foo:bar xmlns:foo='http://netsack.com/'><foo:baz><foo:qux /></foo:baz></foo:bar>", StringWriterText);
+ }
+
+ public void TestNamespacesPrefixWithEmptyAndNullNamespace ()
+ {
+ try {
+ xtw.WriteStartElement ("foo", "bar", "");
+ Fail ("Should have thrown an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try
+ {
+ xtw.WriteStartElement ("foo", "bar", null);
+ Fail ("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ }
+
+ public void TestNamespacesSettingWhenWriteStateNotStart ()
+ {
+ xtw.WriteStartElement ("foo");
+ try
+ {
+ xtw.Namespaces = false;
+ Fail ("Expected an InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ AssertEquals (true, xtw.Namespaces);
+ }
+
+ public void TestProcessingInstructionValid ()
+ {
+ xtw.WriteProcessingInstruction("foo", "bar");
+ AssertEquals ("WriteProcessingInstruction had incorrect output.", "<?foo bar?>", StringWriterText);
+ }
+
+ public void TestProcessingInstructionInvalid ()
+ {
+ try
+ {
+ xtw.WriteProcessingInstruction("fo?>o", "bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try
+ {
+ xtw.WriteProcessingInstruction("foo", "ba?>r");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try
+ {
+ xtw.WriteProcessingInstruction("", "bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try
+ {
+ xtw.WriteProcessingInstruction(null, "bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+ }
+
+ public void TestQuoteCharDoubleQuote ()
+ {
+ xtw.QuoteChar = '"';
+
+ // version, encoding, standalone
+ xtw.WriteStartDocument (true);
+
+ // namespace declaration
+ xtw.WriteElementString ("foo", "http://netsack.com", "bar");
+
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><foo xmlns=\"http://netsack.com\">bar</foo>", StringWriterText);
+
+
+ }
+
+ public void TestQuoteCharInvalid ()
+ {
+ try {
+ xtw.QuoteChar = 'x';
+ Fail ("Should have thrown an ArgumentException.");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestWriteBase64 ()
+ {
+ UTF8Encoding encoding = new UTF8Encoding();
+ byte[] fooBar = encoding.GetBytes("foobar");
+ xtw.WriteBase64 (fooBar, 0, 6);
+ AssertEquals("Zm9vYmFy", StringWriterText);
+
+ try {
+ xtw.WriteBase64 (fooBar, 3, 6);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteBase64 (fooBar, -1, 6);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ xtw.WriteBase64 (fooBar, 3, -1);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ xtw.WriteBase64 (null, 0, 6);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentNullException) {}
+ }
+
+ public void TestWriteCharEntity ()
+ {
+ xtw.WriteCharEntity ('a');
+ AssertEquals ("&#x61;", StringWriterText);
+
+ xtw.WriteCharEntity ('A');
+ AssertEquals ("&#x61;&#x41;", StringWriterText);
+
+ xtw.WriteCharEntity ('1');
+ AssertEquals ("&#x61;&#x41;&#x31;", StringWriterText);
+
+ xtw.WriteCharEntity ('K');
+ AssertEquals ("&#x61;&#x41;&#x31;&#x4B;", StringWriterText);
+
+ try {
+ xtw.WriteCharEntity ((char)0xd800);
+ } catch (ArgumentException) {}
+ }
+
+ public void TestWriteEndAttribute ()
+ {
+ try
+ {
+ xtw.WriteEndAttribute ();
+ Fail ("Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ }
+
+ public void TestWriteEndDocument ()
+ {
+ try {
+ xtw.WriteEndDocument ();
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ xtw.WriteStartDocument ();
+
+ try
+ {
+ xtw.WriteEndDocument ();
+ Fail ("Expected an ArgumentException.");
+ }
+ catch (ArgumentException) {}
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartAttribute ("bar", null);
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='", StringWriterText);
+
+ xtw.WriteEndDocument ();
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='' />", StringWriterText);
+ AssertEquals (WriteState.Start, xtw.WriteState);
+ }
+
+ public void TestWriteEndElement ()
+ {
+ try {
+ xtw.WriteEndElement ();
+ Fail ("Should have thrown an InvalidOperationException.");
+ } catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "There was no XML start tag open.", e.Message);
+ }
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteEndElement ();
+ AssertEquals ("<foo />", StringWriterText);
+
+ xtw.WriteStartElement ("bar");
+ xtw.WriteStartAttribute ("baz", null);
+ xtw.WriteEndElement ();
+ AssertEquals ("<foo /><bar baz='' />", StringWriterText);
+ }
+
+ public void TestFullEndElement ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteFullEndElement ();
+ AssertEquals ("<foo></foo>", StringWriterText);
+
+ xtw.WriteStartElement ("bar");
+ xtw.WriteAttributeString ("foo", "bar");
+ xtw.WriteFullEndElement ();
+ AssertEquals ("<foo></foo><bar foo='bar'></bar>", StringWriterText);
+
+ xtw.WriteStartElement ("baz");
+ xtw.WriteStartAttribute ("bar", null);
+ xtw.WriteFullEndElement ();
+ AssertEquals ("<foo></foo><bar foo='bar'></bar><baz bar=''></baz>", StringWriterText);
+ }
+
+ public void TestWriteRaw ()
+ {
+ xtw.WriteRaw("&<>\"'");
+ AssertEquals ("&<>\"'", StringWriterText);
+
+ xtw.WriteRaw(null);
+ AssertEquals ("&<>\"'", StringWriterText);
+
+ xtw.WriteRaw("");
+ AssertEquals ("&<>\"'", StringWriterText);
+ }
+
+ public void TestWriteRawInvalidInAttribute ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartAttribute ("bar", null);
+ xtw.WriteRaw ("&<>\"'");
+ xtw.WriteEndAttribute ();
+ xtw.WriteEndElement ();
+ AssertEquals ("<foo bar='&<>\"'' />", StringWriterText);
+ }
+
+ public void TestWriteState ()
+ {
+ AssertEquals (WriteState.Start, xtw.WriteState);
+ xtw.WriteStartDocument ();
+ AssertEquals (WriteState.Prolog, xtw.WriteState);
+ xtw.WriteStartElement ("root");
+ AssertEquals (WriteState.Element, xtw.WriteState);
+ xtw.WriteElementString ("foo", "bar");
+ AssertEquals (WriteState.Content, xtw.WriteState);
+ xtw.Close ();
+ AssertEquals (WriteState.Closed, xtw.WriteState);
+ }
+
+ public void TestWriteString ()
+ {
+ xtw.WriteStartDocument ();
+ try {
+ xtw.WriteString("foo");
+ } catch (InvalidOperationException) {}
+
+ // Testing attribute values
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("bar", "&<>");
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='&amp;&lt;&gt;'", StringWriterText);
+ }
+
+ public void TestWriteAttributeStringSingleQuoteChar()
+ {
+ // When QuoteChar is single quote then replaces single quotes within attributes
+ // but not double quotes.
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("bar", "\"baz\"");
+ xtw.WriteAttributeString ("quux", "'baz'");
+ AssertEquals ("<foo bar='\"baz\"' quux='&apos;baz&apos;'", StringWriterText);
+ }
+
+ public void TestWriteAttributeStringDoubleQuoteChar()
+ {
+ // When QuoteChar is double quote then replaces double quotes within attributes
+ // but not single quotes.
+ xtw.QuoteChar = '"';
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("bar", "\"baz\"");
+ xtw.WriteAttributeString ("quux", "'baz'");
+ AssertEquals ("<foo bar=\"&quot;baz&quot;\" quux=\"'baz'\"", StringWriterText);
+ }
+
+ public void TestWriteStringWithEntities()
+ {
+ // Testing element values
+ xtw.QuoteChar = '\'';
+ xtw.WriteElementString ("foo", "&<>\"'");
+ AssertEquals ("<foo>&amp;&lt;&gt;\"'</foo>", StringWriterText);
+ }
+
+ public void TestXmlLang ()
+ {
+ AssertNull (xtw.XmlLang);
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("xml", "lang", null, "langfoo");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo'", StringWriterText);
+
+ xtw.WriteAttributeString ("boo", "yah");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'", StringWriterText);
+
+ xtw.WriteElementString("bar", "baz");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>", StringWriterText);
+
+ xtw.WriteString("baz");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz", StringWriterText);
+
+ xtw.WriteStartElement ("quux");
+ xtw.WriteStartAttribute ("xml", "lang", null);
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
+
+ xtw.WriteString("langbar");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
+
+ xtw.WriteEndAttribute ();
+ AssertEquals ("langbar", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'", StringWriterText);
+
+ // check if xml:lang repeats output even if same as current scope.
+ xtw.WriteStartElement ("joe");
+ xtw.WriteAttributeString ("xml", "lang", null, "langbar");
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'", StringWriterText);
+
+
+ xtw.WriteElementString ("quuux", "squonk");
+ AssertEquals ("langbar", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux>", StringWriterText);
+
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux>", StringWriterText);
+
+ xtw.WriteEndElement ();
+ AssertNull (xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux></foo>", StringWriterText);
+
+ xtw.Close ();
+ AssertNull (xtw.XmlLang);
+ }
+
+ // TODO: test operational aspects
+ public void TestXmlSpace ()
+ {
+ xtw.WriteStartElement ("foo");
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+
+ xtw.WriteStartElement ("bar");
+ xtw.WriteAttributeString ("xml", "space", null, "preserve");
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'", StringWriterText);
+
+ xtw.WriteStartElement ("baz");
+ xtw.WriteAttributeString ("xml", "space", null, "preserve");
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'", StringWriterText);
+
+ xtw.WriteStartElement ("quux");
+ xtw.WriteStartAttribute ("xml", "space", null);
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
+
+ xtw.WriteString ("default");
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
+
+ xtw.WriteEndAttribute ();
+ AssertEquals (XmlSpace.Default, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='default'", StringWriterText);
+
+ xtw.WriteEndElement ();
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ xtw.WriteEndElement ();
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ xtw.WriteEndElement ();
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+
+ xtw.WriteStartElement ("quux");
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "bubba");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "PRESERVE");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "Preserve");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "Default");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteWhitespace ("x");
+ } catch (ArgumentException) { }
+ }
+
+ public void TestXmlSpaceRaw ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartAttribute ("xml", "space", null);
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+ AssertEquals ("<foo xml:space='", StringWriterText);
+
+ xtw.WriteString ("default");
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+ AssertEquals ("<foo xml:space='", StringWriterText);
+
+ xtw.WriteEndAttribute ();
+ AssertEquals (XmlSpace.Default, xtw.XmlSpace);
+ AssertEquals ("<foo xml:space='default'", StringWriterText);
+ }
+
+ public void TestWriteAttributes ()
+ {
+ XmlDocument doc = new XmlDocument();
+ StringWriter sw = new StringWriter();
+ XmlWriter wr = new XmlTextWriter(sw);
+ StringBuilder sb = sw.GetStringBuilder();
+ XmlParserContext ctx = new XmlParserContext(doc.NameTable, new XmlNamespaceManager(doc.NameTable), "", XmlSpace.Default);
+ XmlTextReader xtr = new XmlTextReader("<?xml version='1.0' encoding='utf-8' standalone='no'?><root a1='A' b2='B' c3='C'><foo><bar /></foo></root>", XmlNodeType.Document, ctx);
+
+ xtr.Read(); // read XMLDecl
+ wr.WriteAttributes(xtr, false);
+ // This method don't always have to take this double-quoted style...
+ AssertEquals("#WriteAttributes.XmlDecl.1", "version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"", sw.ToString().Trim());
+
+ sb.Remove(0, sb.Length); // init
+ ctx = new XmlParserContext(doc.NameTable, new XmlNamespaceManager(doc.NameTable), "", XmlSpace.Default);
+ xtr = new XmlTextReader("<?xml version='1.0' standalone='no'?><root a1='A' b2='B' c3='C'><foo><bar /></foo></root>", XmlNodeType.Document, ctx);
+ xtr.Read(); // read XMLDecl
+ wr.WriteAttributes(xtr, false);
+ // This method don't always have to take this double-quoted style...
+ AssertEquals("#WriteAttributes.XmlDecl.2", "version=\"1.0\" standalone=\"no\"", sw.ToString().Trim());
+
+ sb.Remove(0, sb.Length); // init
+ xtr.Read(); // read root
+ wr.WriteStartElement(xtr.LocalName, xtr.Value);
+ wr.WriteAttributes(xtr, false);
+ wr.WriteEndElement();
+ wr.Close();
+ // This method don't always have to take this double-quoted style...
+ AssertEquals("#WriteAttributes.Element", "<root a1=\"A\" b2=\"B\" c3=\"C\" />", sw.ToString().Trim());
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs b/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
new file mode 100755
index 00000000000..f114356b372
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
@@ -0,0 +1,118 @@
+//
+// System.Xml.XmlWhitespaceTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlWhitespaceTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocument doc2;
+ XmlWhitespace whitespace;
+ XmlWhitespace broken;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlWhitespaceTests () : base ("MonoTests.System.Xml.XmlWhitespaceTests testsuite") {}
+ public XmlWhitespaceTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ XmlElement element = document.CreateElement ("foo");
+ whitespace = document.CreateWhitespace ("\r\n");
+ element.AppendChild (whitespace);
+
+ doc2 = new XmlDocument ();
+ doc2.PreserveWhitespace = true;
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ whitespace = doc2.CreateWhitespace ("\r\n\t ");
+ AssertEquals (String.Empty, whitespace.InnerXml);
+ AssertEquals ("\r\n\t ", whitespace.OuterXml);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ cloned.Value, original.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlWhitespaceBadConstructor ()
+ {
+ try {
+ broken = document.CreateWhitespace ("black");
+
+ } catch (ArgumentException) {
+ return;
+
+ } catch (Exception) {
+ Fail ("Incorrect Exception thrown.");
+ }
+ }
+
+ public void TestXmlWhitespaceConstructor ()
+ {
+ AssertEquals ("whitespace char didn't get copied right",
+ "\r\n", whitespace.Data);
+ }
+
+
+ public void TestXmlWhitespaceName ()
+ {
+ AssertEquals (whitespace.NodeType + " Name property broken",
+ whitespace.Name, "#whitespace");
+ }
+
+ public void TestXmlWhitespaceLocalName ()
+ {
+ AssertEquals (whitespace.NodeType + " LocalName property broken",
+ whitespace.LocalName, "#whitespace");
+ }
+
+ public void TestXmlWhitespaceNodeType ()
+ {
+ AssertEquals ("XmlWhitespace NodeType property broken",
+ whitespace.NodeType.ToString (), "Whitespace");
+ }
+
+ public void TestXmlWhitespaceIsReadOnly ()
+ {
+ AssertEquals ("XmlWhitespace IsReadOnly property broken",
+ whitespace.IsReadOnly, false);
+ }
+
+ public void TestXmlWhitespaceCloneNode ()
+ {
+ original = whitespace;
+
+ shallow = whitespace.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = whitespace.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlWriterTests.cs b/mcs/class/System.XML/Test/XmlWriterTests.cs
new file mode 100644
index 00000000000..f2fc1cbf2dd
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlWriterTests.cs
@@ -0,0 +1,206 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//
+// (C) 2003 Atsushi Enomoto
+//
+//
+// This class mainly checks inheritance and behaviors of XmlWriter.
+//
+
+
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ public class XmlWriterTests : TestCase
+ {
+ public XmlWriterTests () : base ("MonoTests.System.Xml.XmlWriterTests testsuite") {}
+ public XmlWriterTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ }
+
+ // MS.NET's not-overriden XmlWriter.WriteStartElement(name)
+ // invokes WriteStartElement(null, name, null).
+ // WriteStartElement(name, ns) invokes (null, name, ns), too.
+ public void TestStartElement ()
+ {
+ StartElementTestWriter xw = new StartElementTestWriter ();
+ xw.WriteStartDocument ();
+ xw.WriteStartElement ("test");
+ AssertEquals ("StartElementOverride.NS", null, xw.NS);
+ AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);
+ xw.NS = String.Empty;
+ xw.Prefix = String.Empty;
+ xw.WriteStartElement ("test", "urn:hoge");
+ AssertEquals ("StartElementOverride.NS", "urn:hoge", xw.NS);
+ AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);
+ }
+
+ class StartElementTestWriter : DefaultXmlWriter
+ {
+ public StartElementTestWriter () : base () {}
+ public string NS = String.Empty;
+ public string Prefix = String.Empty;
+
+ public override void WriteStartElement (string prefix, string localName, string ns)
+ {
+ this.NS = ns;
+ this.Prefix = prefix;
+ }
+ }
+ }
+
+ internal class DefaultXmlWriter : XmlWriter
+ {
+ public DefaultXmlWriter () : base ()
+ {
+ }
+
+ public override void Close ()
+ {
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public override string LookupPrefix (string ns)
+ {
+ return null;
+ }
+
+ public override void WriteBase64 (byte [] buffer, int index, int count)
+ {
+ }
+
+ public override void WriteBinHex (byte [] buffer, int index, int count)
+ {
+ }
+
+ public override void WriteCData (string text)
+ {
+ }
+
+ public override void WriteCharEntity (char ch)
+ {
+ }
+
+ public override void WriteChars (char [] buffer, int index, int count)
+ {
+ }
+
+ public override void WriteComment (string text)
+ {
+ }
+
+ public override void WriteDocType (string name, string pubid, string sysid, string subset)
+ {
+ }
+
+ public override void WriteEndAttribute ()
+ {
+ }
+
+ public override void WriteEndDocument ()
+ {
+ }
+
+ public override void WriteEndElement ()
+ {
+ }
+
+ public override void WriteEntityRef (string name)
+ {
+ }
+
+ public override void WriteFullEndElement ()
+ {
+ }
+
+ public override void WriteName (string name)
+ {
+ }
+
+ public override void WriteNmToken (string name)
+ {
+ }
+
+ public override void WriteNode (XmlReader reader, bool defattr)
+ {
+ }
+
+ public override void WriteProcessingInstruction (string name, string text)
+ {
+ }
+
+ public override void WriteQualifiedName (string localName, string ns)
+ {
+ }
+
+ public override void WriteRaw (string data)
+ {
+ }
+
+ public override void WriteRaw (char [] buffer, int index, int count)
+ {
+ }
+
+ public override void WriteStartAttribute (string prefix, string localName, string ns)
+ {
+ }
+
+ public override void WriteStartDocument (bool standalone)
+ {
+ }
+
+ public override void WriteStartDocument ()
+ {
+ }
+
+ public override void WriteStartElement (string prefix, string localName, string ns)
+ {
+ }
+
+ public override void WriteString (string text)
+ {
+ }
+
+ public override void WriteSurrogateCharEntity (char lowChar, char highChar)
+ {
+ }
+
+ public override void WriteWhitespace (string ws)
+ {
+ }
+
+ public override WriteState WriteState {
+ get {
+ return WriteState.Start;
+ }
+ }
+
+ public override string XmlLang {
+ get {
+ return null;
+ }
+ }
+
+ public override XmlSpace XmlSpace {
+ get {
+ return XmlSpace.None;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/Test/makefile.gnu b/mcs/class/System.XML/Test/makefile.gnu
new file mode 100644
index 00000000000..814499ffe70
--- /dev/null
+++ b/mcs/class/System.XML/Test/makefile.gnu
@@ -0,0 +1,22 @@
+topdir = ../../..
+
+LIBRARY = System.XML_linux_test.dll
+
+LIB_LIST = System.XML_linux_test.args
+LIB_FLAGS = \
+ -r $(topdir)/class/lib/corlib.dll \
+ -r $(topdir)/class/lib/System.Xml.dll \
+ -r $(topdir)/class/lib/NUnitCore_mono.dll
+
+SOURCES_INCLUDE = *.cs
+SOURCES_EXCLUDE = ./TheTests.cs
+
+include $(topdir)/class/library.make
+
+MCS_FLAGS = --target library --noconfig
+
+TEST_SUITE_PREFIX = MonoTests.System.Xml.
+TEST_SUITE = AllTests
+
+test: $(LIBRARY)
+ -MONO_PATH=$(MONO_PATH) mono $(topdir)/class/lib/NUnitConsole_mono.exe $(TEST_SUITE_PREFIX)$(TEST_SUITE),System.XML_linux_test.dll
diff --git a/mcs/class/System.XML/list b/mcs/class/System.XML/list
new file mode 100755
index 00000000000..647bf6063fa
--- /dev/null
+++ b/mcs/class/System.XML/list
@@ -0,0 +1,192 @@
+System.Xml\\EntityHandling.cs
+System.Xml\\XmlConvert.cs
+System.Xml\\Formatting.cs
+System.Xml\\IHasXmlNode.cs
+System.Xml\\IXmlLineInfo.cs
+System.Xml\\NameTable.cs
+System.Xml\\ReadState.cs
+System.Xml\\TODOAttribute.cs
+System.Xml\\ValidationType.cs
+System.Xml\\WhitespaceHandling.cs
+System.Xml\\WriteState.cs
+System.Xml\\XmlAttribute.cs
+System.Xml\\XmlAttributeCollection.cs
+System.Xml\\XmlCDataSection.cs
+System.Xml\\XmlChar.cs
+System.Xml\\XmlCharacterData.cs
+System.Xml\\XmlComment.cs
+System.Xml\\XmlDeclaration.cs
+System.Xml\\XmlDocument.cs
+System.Xml\\XmlDocumentFragment.cs
+System.Xml\\XmlDocumentType.cs
+System.Xml\\XmlElement.cs
+System.Xml\\XmlEntity.cs
+System.Xml\\XmlEntityReference.cs
+System.Xml\\XmlException.cs
+System.Xml\\XmlImplementation.cs
+System.Xml\\XmlLinkedNode.cs
+System.Xml\\XmlNamedNodeMap.cs
+System.Xml\\XmlNamespaceManager.cs
+System.Xml\\XmlNameTable.cs
+System.Xml\\XmlNode.cs
+System.Xml\\XmlNodeChangedAction.cs
+System.Xml\\XmlNodeChangedEventArgs.cs
+System.Xml\\XmlNodeChangedEventHandler.cs
+System.Xml\\XmlNodeList.cs
+System.Xml\\XmlNodeListChildren.cs
+System.Xml\\XmlNodeOrder.cs
+System.Xml\\XmlNodeReader.cs
+System.Xml\\XmlNodeType.cs
+System.Xml\\XmlNotation.cs
+System.Xml\\XmlParserContext.cs
+System.Xml\\XmlProcessingInstruction.cs
+System.Xml\\XmlQualifiedName.cs
+System.Xml\\XmlReader.cs
+System.Xml\\XmlResolver.cs
+System.Xml\\XmlSignificantWhitespace.cs
+System.Xml\\XmlSpace.cs
+System.Xml\\XmlText.cs
+System.Xml\\XmlTextReader.cs
+System.Xml\\XmlTextWriter.cs
+System.Xml\\XmlTextWriterOpenElement.cs
+System.Xml\\XmlTokenizedType.cs
+System.Xml\\XmlUrlResolver.cs
+System.Xml\\XmlValidatingReader.cs
+System.Xml\\XmlWhitespace.cs
+System.Xml\\XmlWriter.cs
+System.Xml.Schema\\Parser.cs
+System.Xml.Schema\\ValidationEventArgs.cs
+System.Xml.Schema\\ValidationHandler.cs
+System.Xml.Schema\\XmlSchema.cs
+System.Xml.Schema\\XmlSchemaAll.cs
+System.Xml.Schema\\XmlSchemaAnnotated.cs
+System.Xml.Schema\\XmlSchemaAnnotation.cs
+System.Xml.Schema\\XmlSchemaAny.cs
+System.Xml.Schema\\XmlSchemaAnyAttribute.cs
+System.Xml.Schema\\XmlSchemaAppInfo.cs
+System.Xml.Schema\\XmlSchemaAttribute.cs
+System.Xml.Schema\\XmlSchemaAttributeGroup.cs
+System.Xml.Schema\\XmlSchemaAttributeGroupRef.cs
+System.Xml.Schema\\XmlSchemaChoice.cs
+System.Xml.Schema\\XmlSchemaCollection.cs
+System.Xml.Schema\\XmlSchemaCollectionEnumerator.cs
+System.Xml.Schema\\XmlSchemaComplexContent.cs
+System.Xml.Schema\\XmlSchemaComplexContentExtension.cs
+System.Xml.Schema\\XmlSchemaComplexContentRestriction.cs
+System.Xml.Schema\\XmlSchemaComplexType.cs
+System.Xml.Schema\\XmlSchemaContent.cs
+System.Xml.Schema\\XmlSchemaContentModel.cs
+System.Xml.Schema\\XmlSchemaContentProcessing.cs
+System.Xml.Schema\\XmlSchemaContentType.cs
+System.Xml.Schema\\XmlSchemaDatatype.cs
+System.Xml.Schema\\XmlSchemaDerivationMethod.cs
+System.Xml.Schema\\XmlSchemaDocumentation.cs
+System.Xml.Schema\\XmlSchemaElement.cs
+System.Xml.Schema\\XmlSchemaEnumerationFacet.cs
+System.Xml.Schema\\XmlSchemaException.cs
+System.Xml.Schema\\XmlSchemaExternal.cs
+System.Xml.Schema\\XmlSchemaFacet.cs
+System.Xml.Schema\\XmlSchemaForm.cs
+System.Xml.Schema\\XmlSchemaFractionDigitsFacet.cs
+System.Xml.Schema\\XmlSchemaGroup.cs
+System.Xml.Schema\\XmlSchemaGroupBase.cs
+System.Xml.Schema\\XmlSchemaGroupRef.cs
+System.Xml.Schema\\XmlSchemaIdentityConstraint.cs
+System.Xml.Schema\\XmlSchemaImport.cs
+System.Xml.Schema\\XmlSchemaInclude.cs
+System.Xml.Schema\\XmlSchemaInfo.cs
+System.Xml.Schema\\XmlSchemaKey.cs
+System.Xml.Schema\\XmlSchemaKeyref.cs
+System.Xml.Schema\\XmlSchemaLengthFacet.cs
+System.Xml.Schema\\XmlSchemaMaxExclusiveFacet.cs
+System.Xml.Schema\\XmlSchemaMaxInclusiveFacet.cs
+System.Xml.Schema\\XmlSchemaMaxLengthFacet.cs
+System.Xml.Schema\\XmlSchemaMinExclusiveFacet.cs
+System.Xml.Schema\\XmlSchemaMinInclusiveFacet.cs
+System.Xml.Schema\\XmlSchemaMinLengthFacet.cs
+System.Xml.Schema\\XmlSchemaNotation.cs
+System.Xml.Schema\\XmlSchemaNumericFacet.cs
+System.Xml.Schema\\XmlSchemaObject.cs
+System.Xml.Schema\\XmlSchemaObjectCollection.cs
+System.Xml.Schema\\XmlSchemaObjectEnumerator.cs
+System.Xml.Schema\\XmlSchemaObjectTable.cs
+System.Xml.Schema\\XmlSchemaParticle.cs
+System.Xml.Schema\\XmlSchemaPatternFacet.cs
+System.Xml.Schema\\XmlSchemaRedefine.cs
+System.Xml.Schema\\XmlSchemaSequence.cs
+System.Xml.Schema\\XmlSchemaSimpleContent.cs
+System.Xml.Schema\\XmlSchemaSimpleContentExtension.cs
+System.Xml.Schema\\XmlSchemaSimpleContentRestriction.cs
+System.Xml.Schema\\XmlSchemaSimpleType.cs
+System.Xml.Schema\\XmlSchemaSimpleTypeContent.cs
+System.Xml.Schema\\XmlSchemaSimpleTypeList.cs
+System.Xml.Schema\\XmlSchemaSimpleTypeRestriction.cs
+System.Xml.Schema\\XmlSchemaSimpleTypeUnion.cs
+System.Xml.Schema\\XmlSchemaTotalDigitsFacet.cs
+System.Xml.Schema\\XmlSchemaType.cs
+System.Xml.Schema\\XmlSchemaUnique.cs
+System.Xml.Schema\\XmlSchemaUse.cs
+System.Xml.Schema\\XmlSchemaUtil.cs
+System.Xml.Schema\\XmlSchemaWhiteSpaceFacet.cs
+System.Xml.Schema\\XmlSchemaXPath.cs
+System.Xml.Schema\\XmlSeverityType.cs
+System.Xml.XPath\\IXPathNavigable.cs
+System.Xml.XPath\\XmlCaseOrder.cs
+System.Xml.XPath\\XmlDataType.cs
+System.Xml.XPath\\XmlSortOrder.cs
+System.Xml.XPath\\XPathDocument.cs
+System.Xml.XPath\\XPathException.cs
+System.Xml.XPath\\XPathExpression.cs
+System.Xml.XPath\\XPathNamespaceScope.cs
+System.Xml.XPath\\XPathNavigator.cs
+System.Xml.XPath\\XPathNodeIterator.cs
+System.Xml.XPath\\XPathNodeType.cs
+System.Xml.XPath\\XPathResultType.cs
+System.Xml.XPath\\XPathScanner.cs
+System.Xml.Xsl\\IXsltContextFunction.cs
+System.Xml.Xsl\\IXsltContextVariable.cs
+System.Xml.Xsl\\XsltArgumentList.cs
+System.Xml.Xsl\\XsltCompileException.cs
+System.Xml.Xsl\\XsltContext.cs
+System.Xml.Xsl\\XsltException.cs
+System.Xml.Xsl\\XslTransform.cs
+System.Xml.Serialization\\SoapAttributeAttribute.cs
+System.Xml.Serialization\\SoapAttributeOverrides.cs
+System.Xml.Serialization\\SoapAttributes.cs
+System.Xml.Serialization\\SoapElementAttribute.cs
+System.Xml.Serialization\\SoapEnumAttribute.cs
+System.Xml.Serialization\\SoapIgnoreAttribute.cs
+System.Xml.Serialization\\SoapIncludeAttribute.cs
+System.Xml.Serialization\\SoapSchemaExporter.cs
+System.Xml.Serialization\\SoapTypeAttribute.cs
+System.Xml.Serialization\\UnreferencedObjectEventArgs.cs
+System.Xml.Serialization\\XmlAnyAttributeAttribute.cs
+System.Xml.Serialization\\XmlAnyElementAttribute.cs
+System.Xml.Serialization\\XmlAnyElementAttributes.cs
+System.Xml.Serialization\\XmlArrayAttribute.cs
+System.Xml.Serialization\\XmlArrayItemAttribute.cs
+System.Xml.Serialization\\XmlArrayItemAttributes.cs
+System.Xml.Serialization\\XmlAttributeAttribute.cs
+System.Xml.Serialization\\XmlAttributeEventArgs.cs
+System.Xml.Serialization\\XmlAttributeOverrides.cs
+System.Xml.Serialization\\XmlAttributes.cs
+System.Xml.Serialization\\XmlChoiceIdentifierAttribute.cs
+System.Xml.Serialization\\XmlElementAttribute.cs
+System.Xml.Serialization\\XmlElementAttributes.cs
+System.Xml.Serialization\\XmlElementEventArgs.cs
+System.Xml.Serialization\\XmlEnumAttribute.cs
+System.Xml.Serialization\\XmlIgnoreAttribute.cs
+System.Xml.Serialization\\XmlIncludeAttribute.cs
+System.Xml.Serialization\\XmlMapping.cs
+System.Xml.Serialization\\XmlNamespaceDeclarationsAttribute.cs
+System.Xml.Serialization\\XmlNodeEventArgs.cs
+System.Xml.Serialization\\XmlRootAttribute.cs
+System.Xml.Serialization\\XmlSerializer.cs
+System.Xml.Serialization\\XmlSerializerNamespaces.cs
+System.Xml.Serialization\\XmlTextAttribute.cs
+System.Xml.Serialization\\XmlTypeAttribute.cs
+System.Xml.Serialization\\XmlTypeMapping.cs
+System.Xml.Serialization\\XmlAttributeEventHandler.cs
+System.Xml.Serialization\\XmlElementEventHandler.cs
+System.Xml.Serialization\\XmlNodeEventHandler.cs
+System.Xml.Serialization\\UnreferencedObjectEventHandler.cs
diff --git a/mcs/class/System.XML/list.unix b/mcs/class/System.XML/list.unix
new file mode 100755
index 00000000000..50b757eea79
--- /dev/null
+++ b/mcs/class/System.XML/list.unix
@@ -0,0 +1,226 @@
+System.Xml/IHasXmlNode.cs
+System.Xml/EntityHandling.cs
+System.Xml/Formatting.cs
+System.Xml/IXmlLineInfo.cs
+System.Xml/NameTable.cs
+System.Xml/ReadState.cs
+System.Xml/TODOAttribute.cs
+System.Xml/ValidationType.cs
+System.Xml/XmlEntity.cs
+System.Xml/WhitespaceHandling.cs
+System.Xml/WriteState.cs
+System.Xml/XmlTextWriter.cs
+System.Xml/XmlAttribute.cs
+System.Xml/XmlAttributeCollection.cs
+System.Xml/XmlCDataSection.cs
+System.Xml/XmlConstructs.cs
+System.Xml/XmlChar.cs
+System.Xml/XmlCharacterData.cs
+System.Xml/XmlComment.cs
+System.Xml/XmlNotation.cs
+System.Xml/XmlDeclaration.cs
+System.Xml/XmlDocument.cs
+System.Xml/XmlDocumentFragment.cs
+System.Xml/XmlDocumentType.cs
+System.Xml/XmlElement.cs
+System.Xml/XmlEntityReference.cs
+System.Xml/XmlException.cs
+System.Xml/XmlNodeReader.cs
+System.Xml/XmlImplementation.cs
+System.Xml/XmlConvert.cs
+System.Xml/XmlLinkedNode.cs
+System.Xml/XmlNameTable.cs
+System.Xml/XmlNamedNodeMap.cs
+System.Xml/XmlNamespaceManager.cs
+System.Xml/XmlNode.cs
+System.Xml/XmlNodeChangedAction.cs
+System.Xml/XmlNodeChangedEventArgs.cs
+System.Xml/XmlNodeList.cs
+System.Xml/XmlNodeListChildren.cs
+System.Xml/XmlNodeOrder.cs
+System.Xml/XmlNodeType.cs
+System.Xml/XmlParserContext.cs
+System.Xml/XmlProcessingInstruction.cs
+System.Xml/XmlQualifiedName.cs
+System.Xml/XmlReader.cs
+System.Xml/XmlResolver.cs
+System.Xml/XmlSignificantWhitespace.cs
+System.Xml/XmlSpace.cs
+System.Xml/XmlText.cs
+System.Xml/XmlTextReader.cs
+System.Xml/XmlTokenizedType.cs
+System.Xml/XmlUrlResolver.cs
+System.Xml/XmlValidatingReader.cs
+System.Xml/XmlWhitespace.cs
+System.Xml/XmlWriter.cs
+System.Xml/XmlNodeChangedEventHandler.cs
+System.Xml/XmlTextWriterOpenElement.cs
+System.Xml/XmlDocumentNavigator.cs
+System.Xml/XmlNodeArrayList.cs
+System.Xml.XPath/IXPathNavigable.cs
+System.Xml.XPath/XPathNavigator.cs
+System.Xml.XPath/XPathExpression.cs
+System.Xml.XPath/XPathNamespaceScope.cs
+System.Xml.XPath/XPathNodeIterator.cs
+System.Xml.XPath/XPathResultType.cs
+System.Xml.XPath/XPathNodeType.cs
+System.Xml.XPath/XmlDataType.cs
+System.Xml.XPath/XmlSortOrder.cs
+System.Xml.XPath/XmlCaseOrder.cs
+System.Xml.XPath/XPathDocument.cs
+System.Xml.XPath/XPathException.cs
+System.Xml.XPath/DefaultContext.cs
+System.Xml.XPath/Expression.cs
+System.Xml.XPath/Iterator.cs
+System.Xml.XPath/Parser.cs
+System.Xml.XPath/Tokenizer.cs
+System.Xml.Xsl/IXsltContextFunction.cs
+System.Xml.Xsl/IXsltContextVariable.cs
+System.Xml.Xsl/XslTransform.cs
+System.Xml.Xsl/XsltArgumentList.cs
+System.Xml.Xsl/XsltCompileException.cs
+System.Xml.Xsl/XsltContext.cs
+System.Xml.Xsl/XsltException.cs
+System.Xml.Schema/ValidationEventArgs.cs
+System.Xml.Schema/XmlSchema.cs
+System.Xml.Schema/XmlSchemaAll.cs
+System.Xml.Schema/XmlSchemaAnnotated.cs
+System.Xml.Schema/XmlSchemaAnnotation.cs
+System.Xml.Schema/XmlSchemaAny.cs
+System.Xml.Schema/XmlSchemaAnyAttribute.cs
+System.Xml.Schema/XmlSchemaAppInfo.cs
+System.Xml.Schema/XmlSchemaAttribute.cs
+System.Xml.Schema/XmlSchemaAttributeGroup.cs
+System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
+System.Xml.Schema/XmlSchemaChoice.cs
+System.Xml.Schema/XmlSchemaCollection.cs
+System.Xml.Schema/XmlSchemaCollectionEnumerator.cs
+System.Xml.Schema/XmlSchemaComplexContent.cs
+System.Xml.Schema/XmlSchemaComplexContentExtension.cs
+System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
+System.Xml.Schema/XmlSchemaComplexType.cs
+System.Xml.Schema/XmlSchemaContent.cs
+System.Xml.Schema/XmlSchemaContentModel.cs
+System.Xml.Schema/XmlSchemaContentProcessing.cs
+System.Xml.Schema/XmlSchemaContentType.cs
+System.Xml.Schema/XmlSchemaDatatype.cs
+System.Xml.Schema/XmlSchemaDerivationMethod.cs
+System.Xml.Schema/XmlSchemaDocumentation.cs
+System.Xml.Schema/XmlSchemaElement.cs
+System.Xml.Schema/XmlSchemaEnumerationFacet.cs
+System.Xml.Schema/XmlSchemaException.cs
+System.Xml.Schema/XmlSchemaExternal.cs
+System.Xml.Schema/XmlSchemaFacet.cs
+System.Xml.Schema/XmlSchemaForm.cs
+System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
+System.Xml.Schema/XmlSchemaGroup.cs
+System.Xml.Schema/XmlSchemaGroupBase.cs
+System.Xml.Schema/XmlSchemaGroupRef.cs
+System.Xml.Schema/XmlSchemaIdentityConstraint.cs
+System.Xml.Schema/XmlSchemaImport.cs
+System.Xml.Schema/XmlSchemaInclude.cs
+System.Xml.Schema/XmlSchemaKey.cs
+System.Xml.Schema/XmlSchemaKeyref.cs
+System.Xml.Schema/XmlSchemaLengthFacet.cs
+System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
+System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
+System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
+System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
+System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
+System.Xml.Schema/XmlSchemaMinLengthFacet.cs
+System.Xml.Schema/XmlSchemaNotation.cs
+System.Xml.Schema/XmlSchemaNumericFacet.cs
+System.Xml.Schema/XmlSchemaObject.cs
+System.Xml.Schema/XmlSchemaObjectCollection.cs
+System.Xml.Schema/XmlSchemaObjectEnumerator.cs
+System.Xml.Schema/XmlSchemaObjectTable.cs
+System.Xml.Schema/XmlSchemaParticle.cs
+System.Xml.Schema/XmlSchemaPatternFacet.cs
+System.Xml.Schema/XmlSchemaRedefine.cs
+System.Xml.Schema/XmlSchemaSequence.cs
+System.Xml.Schema/XmlSchemaSimpleContent.cs
+System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
+System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
+System.Xml.Schema/XmlSchemaSimpleType.cs
+System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
+System.Xml.Schema/XmlSchemaSimpleTypeList.cs
+System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
+System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
+System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
+System.Xml.Schema/XmlSchemaType.cs
+System.Xml.Schema/XmlSchemaUnique.cs
+System.Xml.Schema/XmlSchemaUse.cs
+System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
+System.Xml.Schema/XmlSchemaXPath.cs
+System.Xml.Schema/XmlSeverityType.cs
+System.Xml.Schema/ValidationHandler.cs
+System.Xml.Schema/XmlSchemaInfo.cs
+System.Xml.Schema/XmlSchemaUtil.cs
+System.Xml.Schema/XmlSchemaReader.cs
+System.Xml.Serialization/AssemblyInfo.cs
+System.Xml.Serialization/CodeIdentifier.cs
+System.Xml.Serialization/CodeIdentifiers.cs
+System.Xml.Serialization/IXmlSerializable.cs
+System.Xml.Serialization/SchemaTypes.cs
+System.Xml.Serialization/SoapAttributeAttribute.cs
+System.Xml.Serialization/SoapAttributeOverrides.cs
+System.Xml.Serialization/SoapAttributes.cs
+System.Xml.Serialization/SoapCodeExporter.cs
+System.Xml.Serialization/SoapElementAttribute.cs
+System.Xml.Serialization/SoapEnumAttribute.cs
+System.Xml.Serialization/SoapIgnoreAttribute.cs
+System.Xml.Serialization/SoapIncludeAttribute.cs
+System.Xml.Serialization/SoapSchemaImporter.cs
+System.Xml.Serialization/SoapSchemaExporter.cs
+System.Xml.Serialization/SoapSchemaMember.cs
+System.Xml.Serialization/SoapReflectionImporter.cs
+System.Xml.Serialization/SoapTypeAttribute.cs
+System.Xml.Serialization/TypeData.cs
+System.Xml.Serialization/TypeMember.cs
+System.Xml.Serialization/TypeTranslator.cs
+System.Xml.Serialization/UnreferencedObjectEventArgs.cs
+System.Xml.Serialization/UnreferencedObjectEventHandler.cs
+System.Xml.Serialization/XmlAnyAttributeAttribute.cs
+System.Xml.Serialization/XmlAnyElementAttribute.cs
+System.Xml.Serialization/XmlAnyElementAttributes.cs
+System.Xml.Serialization/XmlArrayAttribute.cs
+System.Xml.Serialization/XmlArrayItemAttribute.cs
+System.Xml.Serialization/XmlArrayItemAttributes.cs
+System.Xml.Serialization/XmlAttributeAttribute.cs
+System.Xml.Serialization/XmlAttributeEventArgs.cs
+System.Xml.Serialization/XmlAttributeEventHandler.cs
+System.Xml.Serialization/XmlAttributeOverrides.cs
+System.Xml.Serialization/XmlAttributes.cs
+System.Xml.Serialization/XmlCodeExporter.cs
+System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs
+System.Xml.Serialization/XmlCustomFormatter.cs
+System.Xml.Serialization/XmlElementAttribute.cs
+System.Xml.Serialization/XmlElementAttributes.cs
+System.Xml.Serialization/XmlElementEventArgs.cs
+System.Xml.Serialization/XmlEnumAttribute.cs
+System.Xml.Serialization/XmlIgnoreAttribute.cs
+System.Xml.Serialization/XmlIncludeAttribute.cs
+System.Xml.Serialization/XmlMemberMapping.cs
+System.Xml.Serialization/XmlMembersMapping.cs
+System.Xml.Serialization/XmlMapping.cs
+System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs
+System.Xml.Serialization/XmlNodeEventArgs.cs
+System.Xml.Serialization/XmlReflectionImporter.cs
+System.Xml.Serialization/XmlReflectionMember.cs
+System.Xml.Serialization/XmlRootAttribute.cs
+System.Xml.Serialization/XmlSchemaExporter.cs
+System.Xml.Serialization/XmlSchemaImporter.cs
+System.Xml.Serialization/XmlSchemas.cs
+System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs
+System.Xml.Serialization/XmlSerializationFixupCallback.cs
+System.Xml.Serialization/XmlSerializationReadCallback.cs
+System.Xml.Serialization/XmlSerializationReader.cs
+System.Xml.Serialization/XmlSerializationWriteCallback.cs
+System.Xml.Serialization/XmlSerializationWriter.cs
+System.Xml.Serialization/XmlSerializer.cs
+System.Xml.Serialization/XmlSerializerNamespaces.cs
+System.Xml.Serialization/XmlTextAttribute.cs
+System.Xml.Serialization/XmlTypeAttribute.cs
+System.Xml.Serialization/XmlTypeMapping.cs
+System.Xml.Serialization/XmlElementEventHandler.cs
+System.Xml.Serialization/XmlNodeEventHandler.cs
diff --git a/mcs/class/System.XML/makefile.gnu b/mcs/class/System.XML/makefile.gnu
new file mode 100644
index 00000000000..c18c93c190e
--- /dev/null
+++ b/mcs/class/System.XML/makefile.gnu
@@ -0,0 +1,16 @@
+topdir = ../..
+
+TEST_DIR = Test
+LIBRARY = $(topdir)/class/lib/System.Xml.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r System
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ ./System.Xml/Driver.cs
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/System/.cvsignore b/mcs/class/System/.cvsignore
new file mode 100644
index 00000000000..715bf593fe7
--- /dev/null
+++ b/mcs/class/System/.cvsignore
@@ -0,0 +1,5 @@
+System.dll
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System/ChangeLog b/mcs/class/System/ChangeLog
new file mode 100644
index 00000000000..5ae311ff23e
--- /dev/null
+++ b/mcs/class/System/ChangeLog
@@ -0,0 +1,153 @@
+2003-01-10 Duncan Mak <duncan@ximian.com>
+
+ * list.unix (CSharpCodeCompiler): Add
+ Microsoft.Charp.CSharpCodeCompiler for Sean Kasun.
+
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * updated .build file(s) to correctly contain required buildfile
+ attribute for nant
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * list list.unix: Put CSharpCodeGenerator.cs back in build
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * list list.unix: Removed Compiler classes that are being moved to their own assembly
+
+2002-12-05 Alejandro Sánchez Acosta <raciel@gnome.org>
+
+ * list.unix: updated.
+
+2002-11-30 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * list.unix: Changed.
+ * System.ComponentModel.Design: Added
+
+2002-11-11 Tim Coleman <tim@timcoleman.com>
+ * list.unix:
+ * list:
+ * System.ComponentModel/DesignTimeVisibleAttribute.cs:
+ Add new class
+
+2002-11-06 Jackson Harper <jackson@latitudegeo.com>
+
+ * list.unix: Added Microsoft.CSharp/Compiler.cs to build
+
+2002-11-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list.unix: added new files.
+
+2002-11-04 Tim Coleman <tim@timcoleman.com>
+ * System.ComponentModel/RefreshProperties.cs:
+ * System.ComponentModel/RefreshPropertiesAttribute.cs:
+ Add new classes
+
+2002-11-02 Duncan Mak <duncan@ximian.com>
+
+ * list.unix: Added InvalidEnumArgumentException.
+
+2002-10-31 Dick Porter <dick@ximian.com>
+
+ * list.unix: Added MonoIO and MonoIOError to the build
+
+2002-10-29 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.ComponentModel/PropertyDescriptor.cs: added
+ missing abstract methods and properties
+
+ * System.ComponentModel/DerivedPropertyDescriptor.cs: implemented
+ SetValue and added stubs for missing methods and properties
+
+2002-10-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list.unix: added new files in System.Configuration.
+
+2002-10-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list.unix: added new files.
+
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.ComponentModel/Component.cs:
+ * System.ComponentModel/ComponentCollection.cs:
+ * System.ComponentModel/Container.cs:
+ * System.ComponentModel/MarshalByValueComponent.cs:
+ * System.Diagnostics/Process.cs:
+ * System.Diagnostics/TextWriterTraceListener.cs:
+ * System.IO/FileSystemWatcher.cs:
+ IDisposable fixes.
+
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * list.unix: Added System.IO files.
+
+2002-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list:
+ * list.unix: added EnumConverter.cs
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list:
+ * list.unix: added DerivedPropertyDescriptor.cs
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix: Added new file
+ System.ComponentModel.RecommendedAsConfigurableAttribute.cs
+ to build on unix.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix: Added files to the build for linux
+ System.ComponentModel.BindableAttribute.cs,
+ System.ComponentModel.BindableSupport.cs,
+ System.ComponentModel.ExpandableObjectConverter.cs,
+ System.ComponentModel.NotifyParentPropertyAttribute.cs,
+ System.ComponentModel.ToolboxItemAttribute.cs,
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list.unix: Added System.ComponentModel/DefaultEventAttribute.cs
+ and System.ComponentModel.DefaultProperty.cs to build
+
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.build: removed System.Drawing.dll dependency.
+
+2002-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.build: referenced System.Drawing.dll.
+
+2002-05-12 Lawrence Pit <loz@cable.a2000.nl>
+
+ * System.Security.Cryptography.X509Certificates: directory added
+
+2002-05-09 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.build: don't exclude anymore excluded files in
+ System.ComponentModel. They compile on Linux, so they might also
+ on Windows.
+
+2002-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.build: excluded EventDescriptor.cs,
+ EventDescriptorCollection.cs and ICustomTypeDescriptor.cs.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * System.build: Build System.dll with mono's corlib.dll and
+ System.Xml.dll.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * System.build: Start build System.Net.Sockets.Socket.cs,
+ TcpClient.cs and TcpListener.cs
+
+2001-12-07 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * System.build: Add dependancy on linux target to test target. Need to
+ have the dll before we can test it, right? Plus it encourages others
+ to try 'make test'.
+
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
new file mode 100644
index 00000000000..e2d1a498326
--- /dev/null
+++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
@@ -0,0 +1,171 @@
+//
+// Mono.CSharp CSharpCodeCompiler Class implementation
+//
+// Author:
+// Sean Kasun (seank@users.sf.net)
+//
+
+namespace Mono.CSharp
+{
+ using System;
+ using System.CodeDom;
+ using System.CodeDom.Compiler;
+ using System.IO;
+ using System.Text;
+ using System.Reflection;
+ using System.Collections;
+ using System.Diagnostics;
+ using System.Text.RegularExpressions;
+
+ internal class CSharpCodeCompiler : CSharpCodeGenerator, ICodeCompiler
+ {
+ //
+ // Constructors
+ //
+ public CSharpCodeCompiler()
+ {
+ }
+
+ //
+ // Methods
+ //
+ [MonoTODO]
+ public CompilerResults CompileAssemblyFromDom (
+ CompilerParameters options,CodeCompileUnit e)
+ {
+ return CompileAssemblyFromDomBatch(options,new CodeCompileUnit[]{e});
+ }
+ public CompilerResults CompileAssemblyFromDomBatch (
+ CompilerParameters options,CodeCompileUnit[] ea)
+ {
+ string[] fileNames=new string[ea.Length];
+ int i=0;
+ foreach (CodeCompileUnit e in ea)
+ {
+ fileNames[i]=Path.ChangeExtension(Path.GetTempFileName(),"cs");
+ FileStream f=new FileStream(fileNames[i],FileMode.OpenOrCreate);
+ StreamWriter s=new StreamWriter(f);
+
+ GenerateCodeFromCompileUnit(e,s,new CodeGeneratorOptions());
+ s.Close();
+ f.Close();
+ i++;
+ }
+ return CompileAssemblyFromFileBatch(options,fileNames);
+ }
+ public CompilerResults CompileAssemblyFromFile (
+ CompilerParameters options,string fileName)
+ {
+ return CompileAssemblyFromFileBatch(options,new string[]{fileName});
+ }
+ public CompilerResults CompileAssemblyFromFileBatch (
+ CompilerParameters options,string[] fileNames)
+ {
+ if (null == options)
+ throw new ArgumentNullException("options");
+ if (null == fileNames)
+ throw new ArgumentNullException("fileNames");
+
+ CompilerResults results=new CompilerResults(options.TempFiles);
+ Process mcs=new Process();
+
+ string mcs_output;
+ string[] mcs_output_lines;
+ mcs.StartInfo.FileName="mcs";
+ mcs.StartInfo.Arguments=BuildArgs(options,fileNames);
+ mcs.StartInfo.CreateNoWindow=true;
+ mcs.StartInfo.UseShellExecute=false;
+ mcs.StartInfo.RedirectStandardOutput=true;
+ try {
+ mcs.Start();
+ mcs_output=mcs.StandardOutput.ReadToEnd();
+ mcs.WaitForExit();
+ } finally {
+ mcs.Close();
+ }
+ mcs_output_lines=mcs_output.Split(
+ System.Environment.NewLine.ToCharArray());
+ bool loadIt=true;
+ foreach (string error_line in mcs_output_lines)
+ {
+ CompilerError error=CreateErrorFromString(error_line);
+ if (null!=error)
+ {
+ results.Errors.Add(error);
+ if (!error.IsWarning) loadIt=false;
+ }
+ }
+ if (loadIt)
+ results.CompiledAssembly=Assembly.LoadFrom(options.OutputAssembly);
+ else
+ results.CompiledAssembly=null;
+ return results;
+ }
+ public CompilerResults CompileAssemblyFromSource (
+ CompilerParameters options,string source)
+ {
+ return CompileAssemblyFromSourceBatch(options,new string[]{source});
+ }
+ public CompilerResults CompileAssemblyFromSourceBatch (
+ CompilerParameters options,string[] sources)
+ {
+ string[] fileNames=new string[sources.Length];
+ int i=0;
+ foreach (string source in sources)
+ {
+ fileNames[i]=Path.ChangeExtension(Path.GetTempFileName(),"cs");
+ FileStream f=new FileStream(fileNames[i],FileMode.OpenOrCreate);
+ StreamWriter s=new StreamWriter(f);
+ s.Write(source);
+ s.Close();
+ f.Close();
+ i++;
+ }
+ return CompileAssemblyFromFileBatch(options,fileNames);
+ }
+ private static string BuildArgs(
+ CompilerParameters options,string[] fileNames)
+ {
+ StringBuilder args=new StringBuilder();
+ if (options.GenerateExecutables)
+ args.AppendFormat("/target:exe ");
+ else
+ args.AppendFormat("/target:library ");
+ if (options.IncludeDebugInformation)
+ args.AppendFormat("/debug ");
+ if (options.TreatWarningsAsErrors)
+ args.AppendFormat("/warnaserror ");
+ args.AppendFormat("/warn:{0} ",options.WarningLevel);
+ if (options.OutputAssembly==null)
+ options.OutputAssembly=Path.ChangeExtension(Path.GetTempFileName(),"dll");
+ args.AppendFormat("/out:{0} ",options.OutputAssembly);
+ if (null != options.ReferencedAssemblies)
+ {
+ foreach (string import in options.ReferencedAssemblies)
+ args.AppendFormat("/r:'{0}' ",import);
+ }
+ foreach (string source in fileNames)
+ args.AppendFormat("'{0}' ",source);
+ return args.ToString();
+ }
+ private static CompilerError CreateErrorFromString(string error_string)
+ {
+ CompilerError error=new CompilerError();
+ Regex reg = new Regex (@"^(\s*(?<file>.*)\((?<line>\d*)(,(?<column>\d*))?\)\s+)*(?<level>\w+)\s*(?<number>.*):\s(?<message>.*)",
+ RegexOptions.Compiled | RegexOptions.ExplicitCapture);
+ Match match=reg.Match(error_string);
+ if (!match.Success) return null;
+ if (String.Empty != match.Result("${file}"))
+ error.FileName=match.Result("${file}");
+ if (String.Empty != match.Result("${line}"))
+ error.Line=Int32.Parse(match.Result("${line}"));
+ if (String.Empty != match.Result("${column}"))
+ error.Column=Int32.Parse(match.Result("${column}"));
+ if (match.Result("${level}")=="warning")
+ error.IsWarning=true;
+ error.ErrorNumber=match.Result("${number}");
+ error.ErrorText=match.Result("${message}");
+ return error;
+ }
+ }
+}
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
new file mode 100644
index 00000000000..c5db278625b
--- /dev/null
+++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
@@ -0,0 +1,798 @@
+//
+// Mono.CSharp CSharpCodeProvider Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace Mono.CSharp
+{
+ using System;
+ using System.CodeDom;
+ using System.CodeDom.Compiler;
+ using System.IO;
+ using System.Reflection;
+ using System.Collections;
+
+ internal class CSharpCodeGenerator
+ : CodeGenerator
+ {
+ //
+ // Constructors
+ //
+ public CSharpCodeGenerator()
+ {
+ }
+
+ //
+ // Properties
+ //
+ protected override string NullToken {
+ get {
+ return "null";
+ }
+ }
+
+ //
+ // Methods
+ //
+
+ protected override void GenerateArrayCreateExpression( CodeArrayCreateExpression expression )
+ {
+ //
+ // This tries to replicate MS behavior as good as
+ // possible.
+ //
+ // The Code-Array stuff in ms.net seems to be broken
+ // anyways, or I'm too stupid to understand it.
+ //
+ // I'm sick of it. If you try to develop array
+ // creations, test them on windows. If it works there
+ // but not in mono, drop me a note. I'd be especially
+ // interested in jagged-multidimensional combinations
+ // with proper initialization :}
+ //
+
+ TextWriter output = Output;
+
+ output.Write( "new " );
+
+ CodeExpressionCollection initializers = expression.Initializers;
+ CodeTypeReference createType = expression.CreateType;
+
+ if ( initializers.Count > 0 ) {
+
+ OutputType( createType );
+
+ output.WriteLine( " {" );
+ ++Indent;
+ OutputExpressionList( initializers, true );
+ --Indent;
+ output.Write( "}" );
+
+ } else {
+ CodeTypeReference arrayType = createType.ArrayElementType;
+ while ( arrayType != null ) {
+ createType = arrayType;
+ arrayType = arrayType.ArrayElementType;
+ }
+
+ OutputType( createType );
+
+ output.Write( '[' );
+
+ CodeExpression size = expression.SizeExpression;
+ if ( size != null )
+ GenerateExpression( size );
+ else
+ output.Write( expression.Size );
+
+ output.Write( ']' );
+ }
+ }
+
+ protected override void GenerateBaseReferenceExpression( CodeBaseReferenceExpression expression )
+ {
+ Output.Write( "base" );
+ }
+
+ protected override void GenerateCastExpression( CodeCastExpression expression )
+ {
+ TextWriter output = Output;
+ output.Write( "((" );
+ OutputType( expression.TargetType );
+ output.Write( ")(" );
+ GenerateExpression( expression.Expression );
+ output.Write( "))" );
+ }
+
+
+ protected override void GenerateCompileUnitStart( CodeCompileUnit compileUnit )
+ {
+ GenerateComment( new CodeComment( "------------------------------------------------------------------------------" ) );
+ GenerateComment( new CodeComment( " <autogenerated>" ) );
+ GenerateComment( new CodeComment( " This code was generated by a tool." ) );
+ GenerateComment( new CodeComment( " Mono Runtime Version: " + System.Environment.Version ) );
+ GenerateComment( new CodeComment( "" ) );
+ GenerateComment( new CodeComment( " Changes to this file may cause incorrect behavior and will be lost if " ) );
+ GenerateComment( new CodeComment( " the code is regenerated." ) );
+ GenerateComment( new CodeComment( " </autogenerated>" ) );
+ GenerateComment( new CodeComment( "------------------------------------------------------------------------------" ) );
+ Output.WriteLine();
+ }
+
+
+ protected override void GenerateDelegateCreateExpression( CodeDelegateCreateExpression expression )
+ {
+ TextWriter output = Output;
+
+ output.Write( "new " );
+
+ OutputType( expression.DelegateType );
+
+ output.Write( '(' );
+
+ CodeExpression targetObject = expression.TargetObject;
+ if ( targetObject != null ) {
+ GenerateExpression( targetObject );
+ Output.Write( '.' );
+ }
+ output.Write( expression.MethodName );
+
+ output.Write( ')' );
+ }
+
+ protected override void GenerateFieldReferenceExpression( CodeFieldReferenceExpression expression )
+ {
+ CodeExpression targetObject = expression.TargetObject;
+ if ( targetObject != null ) {
+ GenerateExpression( targetObject );
+ Output.Write( '.' );
+ }
+ Output.Write( expression.FieldName );
+ }
+
+ protected override void GenerateArgumentReferenceExpression( CodeArgumentReferenceExpression expression )
+ {
+ Output.Write( expression.ParameterName );
+ }
+
+ protected override void GenerateVariableReferenceExpression( CodeVariableReferenceExpression expression )
+ {
+ Output.Write( expression.VariableName );
+ }
+
+ protected override void GenerateIndexerExpression( CodeIndexerExpression expression )
+ {
+ TextWriter output = Output;
+
+ GenerateExpression( expression.TargetObject );
+ output.Write( '[' );
+ OutputExpressionList( expression.Indices );
+ output.Write( ']' );
+ }
+
+ protected override void GenerateArrayIndexerExpression( CodeArrayIndexerExpression expression )
+ {
+ TextWriter output = Output;
+
+ GenerateExpression( expression.TargetObject );
+ output.Write( '[' );
+ OutputExpressionList( expression.Indices );
+ output.Write( ']' );
+ }
+
+ protected override void GenerateSnippetExpression( CodeSnippetExpression expression )
+ {
+ Output.Write( expression.Value );
+ }
+
+ protected override void GenerateMethodInvokeExpression( CodeMethodInvokeExpression expression )
+ {
+ TextWriter output = Output;
+
+ GenerateMethodReferenceExpression( expression.Method );
+
+ output.Write( '(' );
+ OutputExpressionList( expression.Parameters );
+ output.Write( ')' );
+ }
+
+ protected override void GenerateMethodReferenceExpression( CodeMethodReferenceExpression expression )
+ {
+ GenerateExpression( expression.TargetObject );
+ Output.Write( '.' );
+ Output.Write( expression.MethodName );
+ }
+
+ protected override void GenerateEventReferenceExpression( CodeEventReferenceExpression expression )
+ {
+ GenerateExpression( expression.TargetObject );
+ Output.Write( '.' );
+ Output.Write( expression.EventName );
+ }
+
+ protected override void GenerateDelegateInvokeExpression( CodeDelegateInvokeExpression expression )
+ {
+ GenerateExpression( expression.TargetObject );
+ Output.Write( '(' );
+ OutputExpressionList( expression.Parameters );
+ Output.Write( ')' );
+ }
+
+ protected override void GenerateObjectCreateExpression( CodeObjectCreateExpression expression )
+ {
+ Output.Write( "new " );
+ OutputType( expression.CreateType );
+ Output.Write( '(' );
+ OutputExpressionList( expression.Parameters );
+ Output.Write( ')' );
+ }
+
+ protected override void GeneratePropertyReferenceExpression( CodePropertyReferenceExpression expression )
+ {
+ GenerateMemberReferenceExpression( expression.TargetObject,
+ expression.PropertyName );
+ }
+
+ protected override void GeneratePropertySetValueReferenceExpression( CodePropertySetValueReferenceExpression expression )
+ {
+ Output.Write ( "value" );
+ }
+
+ protected override void GenerateThisReferenceExpression( CodeThisReferenceExpression expression )
+ {
+ Output.Write( "this" );
+ }
+
+ protected override void GenerateExpressionStatement( CodeExpressionStatement statement )
+ {
+ GenerateExpression( statement.Expression );
+ Output.WriteLine( ';' );
+ }
+
+ protected override void GenerateIterationStatement( CodeIterationStatement statement )
+ {
+ TextWriter output = Output;
+
+ output.Write( "for (" );
+ GenerateStatement( statement.InitStatement );
+ output.Write( "; " );
+ GenerateExpression( statement.TestExpression );
+ output.Write( "; " );
+ GenerateStatement( statement.IncrementStatement );
+ output.Write( ") " );
+ GenerateStatements( statement.Statements );
+ }
+
+ protected override void GenerateThrowExceptionStatement( CodeThrowExceptionStatement statement )
+ {
+ Output.Write( "throw " );
+ GenerateExpression( statement.ToThrow );
+ }
+
+ protected override void GenerateComment( CodeComment comment )
+ {
+ TextWriter output = Output;
+
+ if ( comment.DocComment )
+ output.Write( "/// " );
+ else
+ output.Write( "// " );
+
+ output.WriteLine( comment.Text );
+ }
+
+ protected override void GenerateMethodReturnStatement( CodeMethodReturnStatement statement )
+ {
+ TextWriter output = Output;
+
+ output.Write( "return " );
+
+ GenerateExpression( statement.Expression );
+
+ output.Write( ";" );
+ }
+
+ protected override void GenerateConditionStatement( CodeConditionStatement statement )
+ {
+ TextWriter output = Output;
+ output.Write( "if (" );
+
+ GenerateExpression( statement.Condition );
+
+ output.WriteLine( ") {" );
+ ++Indent;
+ GenerateStatements( statement.TrueStatements );
+ --Indent;
+ output.Write( '}' );
+
+ CodeStatementCollection falses = statement.FalseStatements;
+ if ( falses.Count > 0 ) {
+ if ( Options.ElseOnClosing )
+ output.Write( ' ' );
+ else
+ output.WriteLine();
+ output.WriteLine( "else {" );
+ ++Indent;
+ GenerateStatements( falses );
+ --Indent;
+ output.WriteLine( '}' );
+ }
+ }
+
+ protected override void GenerateTryCatchFinallyStatement( CodeTryCatchFinallyStatement statement )
+ {
+ TextWriter output = Output;
+ CodeGeneratorOptions options = Options;
+
+ output.WriteLine( "try {" );
+ ++Indent;
+ GenerateStatements( statement.TryStatements );
+ --Indent;
+ output.Write( '}' );
+
+ foreach ( CodeCatchClause clause in statement.CatchClauses ) {
+ if ( options.ElseOnClosing )
+ output.Write( ' ' );
+ else
+ output.WriteLine();
+ output.Write( "catch (" );
+ OutputTypeNamePair( clause.CatchExceptionType, clause.LocalName );
+ output.WriteLine( ") {" );
+ ++Indent;
+ GenerateStatements( clause.Statements );
+ --Indent;
+ output.Write( '}' );
+ }
+
+ CodeStatementCollection finallies = statement.FinallyStatements;
+ if ( finallies.Count > 0 ) {
+ if ( options.ElseOnClosing )
+ output.Write( ' ' );
+ else
+ output.WriteLine();
+ output.WriteLine( "finally {" );
+ ++Indent;
+ GenerateStatements( finallies );
+ --Indent;
+ output.WriteLine( '}' );
+ }
+
+ output.WriteLine();
+ }
+
+ protected override void GenerateAssignStatement( CodeAssignStatement statement )
+ {
+ TextWriter output = Output;
+ GenerateExpression( statement.Left );
+ output.Write( " = " );
+ GenerateExpression( statement.Right );
+ output.WriteLine( ';' );
+ }
+
+ protected override void GenerateAttachEventStatement( CodeAttachEventStatement statement )
+ {
+ TextWriter output = Output;
+
+ GenerateEventReferenceExpression( statement.Event );
+ output.Write( " += " );
+ GenerateExpression( statement.Listener );
+ output.WriteLine( ';' );
+ }
+
+ protected override void GenerateRemoveEventStatement( CodeRemoveEventStatement statement )
+ {
+ TextWriter output = Output;
+ GenerateEventReferenceExpression( statement.Event );
+ Output.Write( " -= " );
+ GenerateExpression( statement.Listener );
+ output.WriteLine( ';' );
+ }
+
+ protected override void GenerateGotoStatement( CodeGotoStatement statement )
+ {
+ TextWriter output = Output;
+
+ output.Write( "goto " );
+ output.Write( statement.Label );
+ output.Write( ";" );
+ }
+
+ protected override void GenerateLabeledStatement( CodeLabeledStatement statement )
+ {
+ TextWriter output = Output;
+
+ output.Write( statement.Label );
+ GenerateStatement( statement.Statement );
+ }
+
+ protected override void GenerateVariableDeclarationStatement( CodeVariableDeclarationStatement statement )
+ {
+ TextWriter output = Output;
+
+ OutputTypeNamePair( statement.Type, statement.Name );
+
+ CodeExpression initExpression = statement.InitExpression;
+ if ( initExpression != null ) {
+ output.Write( " = " );
+ GenerateExpression( initExpression );
+ }
+
+ output.WriteLine( ';' );
+ }
+
+ protected override void GenerateLinePragmaStart( CodeLinePragma linePragma )
+ {
+ Output.Write( "<GenerateLinePragmaStart>" );
+ }
+
+ protected override void GenerateLinePragmaEnd( CodeLinePragma linePragma )
+ {
+ Output.Write( "<GenerateLinePragmaEnd>" );
+ }
+
+ protected override void GenerateEvent( CodeMemberEvent eventRef, CodeTypeDeclaration declaration )
+ {
+ Output.Write( "<GenerateEvent>" );
+ }
+
+ protected override void GenerateField( CodeMemberField field )
+ {
+ TextWriter output = Output;
+
+ if (field.CustomAttributes.Count > 0)
+ OutputAttributeDeclarations( field.CustomAttributes );
+
+ MemberAttributes attributes = field.Attributes;
+ OutputMemberAccessModifier( attributes );
+ OutputFieldScopeModifier( attributes );
+
+ OutputTypeNamePair( field.Type, field.Name );
+
+ CodeExpression initExpression = field.InitExpression;
+ if ( initExpression != null ) {
+ output.Write( " = " );
+ GenerateExpression( initExpression );
+ }
+
+ output.WriteLine( ';' );
+ }
+
+ protected override void GenerateSnippetMember( CodeSnippetTypeMember member )
+ {
+ Output.Write( "<GenerateSnippetMember>" );
+ }
+
+ protected override void GenerateEntryPointMethod( CodeEntryPointMethod method,
+ CodeTypeDeclaration declaration )
+ {
+ method.Name = "Main";
+ GenerateMethod( method, declaration );
+ }
+
+ protected override void GenerateMethod( CodeMemberMethod method,
+ CodeTypeDeclaration declaration )
+ {
+ TextWriter output = Output;
+
+ if (method.CustomAttributes.Count > 0)
+ OutputAttributeDeclarations( method.CustomAttributes );
+
+ MemberAttributes attributes = method.Attributes;
+
+ OutputMemberAccessModifier( attributes );
+ OutputMemberScopeModifier( attributes );
+
+ OutputType( method.ReturnType );
+
+ output.Write( ' ' );
+
+ CodeTypeReference privateType = method.PrivateImplementationType;
+ if ( privateType != null ) {
+ OutputType( privateType );
+ output.Write( '.' );
+ }
+ output.Write( method.Name );
+
+ output.Write( '(' );
+ OutputParameters( method.Parameters );
+ output.Write( ')' );
+
+ if ( (attributes & MemberAttributes.ScopeMask) == MemberAttributes.Abstract )
+ output.WriteLine( ';' );
+ else {
+ output.WriteLine( " {" );
+ ++Indent;
+ GenerateStatements( method.Statements );
+ --Indent;
+ output.WriteLine( '}' );
+ }
+ }
+
+ protected override void GenerateProperty( CodeMemberProperty property,
+ CodeTypeDeclaration declaration )
+ {
+ TextWriter output = Output;
+
+ if (property.CustomAttributes.Count > 0)
+ OutputAttributeDeclarations( property.CustomAttributes );
+
+ MemberAttributes attributes = property.Attributes;
+ OutputMemberAccessModifier( attributes );
+ OutputFieldScopeModifier( attributes );
+
+ OutputTypeNamePair( property.Type, property.Name );
+ output.WriteLine (" {");
+ ++Indent;
+
+ if (property.HasGet)
+ {
+ output.WriteLine ("get {");
+ ++Indent;
+
+ GenerateStatements (property.GetStatements);
+ output.WriteLine ();
+
+ output.WriteLine ("}");
+ --Indent;
+ }
+
+ if (property.HasSet)
+ {
+ output.WriteLine ("set {");
+ ++Indent;
+
+ GenerateStatements (property.SetStatements);
+ output.WriteLine ();
+
+ output.WriteLine ("}");
+ --Indent;
+ }
+
+ --Indent;
+ output.WriteLine ("}");
+ }
+
+ protected override void GenerateConstructor( CodeConstructor constructor,
+ CodeTypeDeclaration declaration )
+ {
+ Output.Write( "<GenerateConstructor>" );
+ }
+
+ protected override void GenerateTypeConstructor( CodeTypeConstructor constructor )
+ {
+ Output.Write( "<GenerateTypeConstructor>" );
+ }
+
+ protected override void GenerateTypeStart( CodeTypeDeclaration declaration )
+ {
+ TextWriter output = Output;
+
+ TypeAttributes attributes = declaration.TypeAttributes;
+ OutputTypeAttributes( attributes,
+ declaration.IsStruct,
+ declaration.IsEnum );
+
+ output.Write( declaration.Name );
+ output.Write( ' ' );
+
+ IEnumerator enumerator = declaration.BaseTypes.GetEnumerator();
+ if ( enumerator.MoveNext() ) {
+ CodeTypeReference type = (CodeTypeReference)enumerator.Current;
+
+ output.Write( ": " );
+ OutputType( type );
+
+ while ( enumerator.MoveNext() ) {
+ type = (CodeTypeReference)enumerator.Current;
+
+ output.Write( ", " );
+ OutputType( type );
+ }
+
+ output.Write( ' ' );
+ }
+ output.WriteLine( "{" );
+ ++Indent;
+ }
+
+ protected override void GenerateTypeEnd( CodeTypeDeclaration declaration )
+ {
+ --Indent;
+ Output.WriteLine( "}" );
+ }
+
+ protected override void GenerateNamespaceStart( CodeNamespace ns )
+ {
+ TextWriter output = Output;
+
+ string name = ns.Name;
+ if ( name != null && name != "" ) {
+ output.Write( "namespace " );
+ output.Write( name );
+ output.WriteLine( " {" );
+ ++Indent;
+ }
+ }
+
+ protected override void GenerateNamespaceEnd( CodeNamespace ns )
+ {
+ string name = ns.Name;
+ if ( name != null && name != "" ) {
+ --Indent;
+ Output.WriteLine( "}" );
+ }
+ }
+
+ protected override void GenerateNamespaceImport( CodeNamespaceImport import )
+ {
+ TextWriter output = Output;
+
+ output.Write( "using " );
+ output.Write( import.Namespace );
+ output.WriteLine( ';' );
+ }
+
+ protected override void GenerateAttributeDeclarationsStart( CodeAttributeDeclarationCollection attributes )
+ {
+ Output.Write( '[' );
+ }
+
+ protected override void GenerateAttributeDeclarationsEnd( CodeAttributeDeclarationCollection attributes )
+ {
+ Output.WriteLine( ']' );
+ }
+
+ protected override void OutputType( CodeTypeReference type )
+ {
+ Output.Write( GetTypeOutput( type ) );
+ }
+
+ protected override string QuoteSnippetString( string value )
+ {
+ return "\"" + value + "\"";
+ // FIXME: escape quotes
+ }
+
+ private void GenerateDeclaration( CodeTypeReference type, string name, CodeExpression initExpression )
+ {
+ TextWriter output = Output;
+
+ OutputTypeNamePair( type, name );
+
+ if ( initExpression != null ) {
+ output.Write( " = " );
+ GenerateExpression( initExpression );
+ }
+
+ output.WriteLine( ';' );
+ }
+
+ private void GenerateMemberReferenceExpression( CodeExpression targetObject, string memberName )
+ {
+ GenerateExpression( targetObject );
+ Output.Write( '.' );
+ Output.Write( memberName );
+ }
+
+ /*
+ * ICodeGenerator
+ */
+
+ //[MonoTODO]
+ protected override string CreateEscapedIdentifier( string value )
+ {
+ return value;
+ }
+
+ //[MonoTODO]
+ protected override string CreateValidIdentifier( string value )
+ {
+ return value;
+ }
+
+ protected override string GetTypeOutput( CodeTypeReference type )
+ {
+ string output;
+ CodeTypeReference arrayType;
+
+ arrayType = type.ArrayElementType;
+ if ( arrayType != null )
+ output = GetTypeOutput( arrayType );
+ else {
+ switch ( type.BaseType ) {
+
+ case "System.Decimal":
+ output = "decimal";
+ break;
+ case "System.Double":
+ output = "double";
+ break;
+ case "System.Single":
+ output = "float";
+ break;
+
+ case "System.Byte":
+ output = "byte";
+ break;
+ case "System.SByte":
+ output = "sbyte";
+ break;
+ case "System.Int32":
+ output = "int";
+ break;
+ case "System.UInt32":
+ output = "uint";
+ break;
+ case "System.Int64":
+ output = "long";
+ break;
+ case "System.UInt64":
+ output = "ulong";
+ break;
+ case "System.Int16":
+ output = "short";
+ break;
+ case "System.UInt16":
+ output = "ushort";
+ break;
+
+ case "System.Boolean":
+ output = "bool";
+ break;
+
+ case "System.Char":
+ output = "char";
+ break;
+
+ case "System.String":
+ output = "string";
+ break;
+ case "System.Object":
+ output = "object";
+ break;
+
+ case "System.Void":
+ output = "void";
+ break;
+
+ default:
+ output = type.BaseType;
+ break;
+ }
+ }
+
+ int rank = type.ArrayRank;
+ if ( rank > 0 ) {
+ output += "[";
+ for ( --rank; rank > 0; --rank )
+ output += ",";
+ output += "]";
+ }
+
+ return output;
+ }
+
+ protected override bool IsValidIdentifier( string identifier )
+ {
+ return true;
+ }
+
+ protected override bool Supports( GeneratorSupport supports )
+ {
+ if ( (supports & GeneratorSupport.Win32Resources) != 0 )
+ return false;
+ return true;
+ }
+
+#if false
+ //[MonoTODO]
+ public override void ValidateIdentifier( string identifier )
+ {
+ }
+#endif
+ }
+}
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs
new file mode 100644
index 00000000000..325cb9d2a7c
--- /dev/null
+++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeProvider.cs
@@ -0,0 +1,54 @@
+//
+// Microsoft.CSharp CSharpCodeProvider Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace Microsoft.CSharp
+{
+ using System;
+ using System.CodeDom.Compiler;
+ using System.ComponentModel;
+
+ public class CSharpCodeProvider
+ : CodeDomProvider
+ {
+ //
+ // Constructors
+ //
+ public CSharpCodeProvider()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public override string FileExtension {
+ get {
+ return "cs";
+ }
+ }
+
+ //
+ // Methods
+ //
+ public override ICodeCompiler CreateCompiler()
+ {
+ return new Mono.CSharp.CSharpCodeCompiler();
+ }
+
+ public override ICodeGenerator CreateGenerator()
+ {
+ return new Mono.CSharp.CSharpCodeGenerator();
+ }
+
+ [MonoTODO]
+ public override TypeConverter GetConverter( Type Type )
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System/Microsoft.CSharp/ChangeLog b/mcs/class/System/Microsoft.CSharp/ChangeLog
new file mode 100644
index 00000000000..cf4b8db5952
--- /dev/null
+++ b/mcs/class/System/Microsoft.CSharp/ChangeLog
@@ -0,0 +1,65 @@
+2003-01-10 Duncan Mak <duncan@ximian.com>
+
+ * CSharpCodeCompiler.cs:
+ * CSharpCodeProvider.cs: Patch from Sean Kasun
+ <skasun@azstarnet.com> to implement CSharpCodeCompiler.
+
+2002-12-07 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs Compiler.cs: Moving these classes to their own assembly
+
+2002-11-11 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Reordered ErrorLevel enumeration to match MS values
+
+2002-11-11 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Error levels are now lower case to match MS spec
+
+2002-11-9 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: ToString() Do not show source file info if there was no source file in the error message
+
+2002-11-6 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: No longers waits untill mcs is finished running to read output, this should prevent
+ crashes from buffers filling up.
+
+2002-11-4 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs CompilerError.cs: Fixed (C) in header
+
+2002-11-4 Jackson Harper <jackson@latitudegeo.com>
+
+ * Compiler.cs: Added file
+
+2002-11-4 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Changed FileName property to the correct name 'SourceFile'
+
+2002-10-30 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerError.cs: Added class
+
+2002-10-19 Rachel Hestilow <hestilow@ximian.com>
+
+ * CSharpCodeProvider.cs
+ (GeneratePropertySetValueReferenceExpression): Implement.
+ (GenerateField, GenerateMethod): Only call OutputAttributeDeclarations
+ if there are any attributes.
+ (GenerateProperty): Implement.
+
+2002-10-11 Duncan Mak <duncan@ximian.com>
+
+ * CSharpCodeProvider.cs: Fix constructor visibility.
+
+2002-05-28 Daniel Stodden <stodden@in.tum.de>
+
+ * ChangeLog: added
+
+ * CSharpCodeProvider.cs: added
+
+ * CSharpCodeGenerator.cs: C# Code Generator. Not fully complete
+ but doing fairly well.
+
+
diff --git a/mcs/class/System/Microsoft.Win32/ChangeLog b/mcs/class/System/Microsoft.Win32/ChangeLog
new file mode 100644
index 00000000000..b5402a128ef
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/ChangeLog
@@ -0,0 +1,21 @@
+2002-9-15 Johannes Roith <johannes@jroith.de>
+
+ * ChangeLog: Add the change log to this directory
+
+ * PowerModeChangedEventArgs.cs
+ * PowerModeChangedEventHandler.cs
+ * PowerModes.cs
+ * SessionEndedEventArgs.cs
+ * SessionEndedEventHandler.cs
+ * SessionEndingEventArgs.cs
+ * SessionEndingEventHandler.cs
+ * SessionEndReasons.cs
+ * SystemEvents.cs
+ * TimerElapsedEventArgs.cs
+ * TimerElapsedEventHandler.cs
+ * UserPreferenceCategory.cs
+ * UserPreferenceChangedEventArgs.cs
+ * UserPreferenceChangedEventHandler.cs
+ * UserPreferenceChangingEventArgs.cs
+ * UserPreferenceChangingEventHandler.cs:
+ Initial import. \ No newline at end of file
diff --git a/mcs/class/System/Microsoft.Win32/PowerModeChangedEventArgs.cs b/mcs/class/System/Microsoft.Win32/PowerModeChangedEventArgs.cs
new file mode 100644
index 00000000000..d00039e7c03
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/PowerModeChangedEventArgs.cs
@@ -0,0 +1,32 @@
+//
+// PowerModeChangedEventArgs.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+ public class PowerModeChangedEventArgs : System.EventArgs{
+
+ PowerModes mymode;
+
+ public PowerModeChangedEventArgs(PowerModes mode)
+ {
+ this.mymode = mode;
+ }
+
+ public PowerModes Mode {
+
+ get{
+ return mymode;
+ }
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/PowerModeChangedEventHandler.cs b/mcs/class/System/Microsoft.Win32/PowerModeChangedEventHandler.cs
new file mode 100644
index 00000000000..0fadd47a6e0
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/PowerModeChangedEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// PowerModeChangedEventHandler.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public delegate void PowerModeChangedEventHandler(object sender, PowerModeChangedEventArgs e);
+}
diff --git a/mcs/class/System/Microsoft.Win32/PowerModes.cs b/mcs/class/System/Microsoft.Win32/PowerModes.cs
new file mode 100644
index 00000000000..80b17f6cec3
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/PowerModes.cs
@@ -0,0 +1,18 @@
+//
+// PowerModes.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+ public enum PowerModes : int {
+ Resume = 1,
+ StatusChange = 2,
+ Suspend = 3,
+ };
+}
diff --git a/mcs/class/System/Microsoft.Win32/SessionEndReasons.cs b/mcs/class/System/Microsoft.Win32/SessionEndReasons.cs
new file mode 100644
index 00000000000..3ffe9ca2ef4
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/SessionEndReasons.cs
@@ -0,0 +1,17 @@
+//
+// SessionEndReasons.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+ public enum SessionEndReasons : int {
+ Logoff = 1,
+ SystemShutdown = 2,
+ };
+}
diff --git a/mcs/class/System/Microsoft.Win32/SessionEndedEventArgs.cs b/mcs/class/System/Microsoft.Win32/SessionEndedEventArgs.cs
new file mode 100644
index 00000000000..5e0acab3330
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/SessionEndedEventArgs.cs
@@ -0,0 +1,32 @@
+//
+// SessionEndedEventArgs.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public class SessionEndedEventArgs : System.EventArgs{
+
+ SessionEndReasons myreason;
+
+ public SessionEndedEventArgs(SessionEndReasons reason)
+ {
+ this.myreason = reason;
+ }
+
+ public SessionEndReasons Reason {
+
+ get{
+ return myreason;
+ }
+
+ }
+
+}
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/SessionEndedEventHandler.cs b/mcs/class/System/Microsoft.Win32/SessionEndedEventHandler.cs
new file mode 100644
index 00000000000..d2f067ce1e1
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/SessionEndedEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// SessionEndedEventHandler.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public delegate void SessionEndedEventHandler(object sender, SessionEndedEventArgs e);
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/SessionEndingEventArgs.cs b/mcs/class/System/Microsoft.Win32/SessionEndingEventArgs.cs
new file mode 100644
index 00000000000..0a227c45a32
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/SessionEndingEventArgs.cs
@@ -0,0 +1,46 @@
+//
+// SessionEndingEventArgs.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public class SessionEndingEventArgs : System.EventArgs{
+
+ SessionEndReasons myreason;
+ bool mycancel;
+
+ public SessionEndingEventArgs(SessionEndReasons reason)
+ {
+ this.myreason = reason;
+ }
+
+ public SessionEndReasons Reason {
+
+ get{
+ return myreason;
+ }
+
+ }
+
+
+ public bool Cancel {
+
+ get{
+ return mycancel;
+ }
+ set{
+ mycancel = value;
+
+ }
+
+ }
+
+}
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/SessionEndingEventHandler.cs b/mcs/class/System/Microsoft.Win32/SessionEndingEventHandler.cs
new file mode 100644
index 00000000000..0d66f15d068
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/SessionEndingEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// SessionEndingEventHandler.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public delegate void SessionEndingEventHandler(object sender, SessionEndingEventArgs e);
+}
diff --git a/mcs/class/System/Microsoft.Win32/SystemEvents.cs b/mcs/class/System/Microsoft.Win32/SystemEvents.cs
new file mode 100644
index 00000000000..7f7fa5f6ae5
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/SystemEvents.cs
@@ -0,0 +1,110 @@
+//
+// SystemEvents.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+
+namespace Microsoft.Win32 {
+ /// <summary>
+ /// </summary>
+public sealed class SystemEvents : System.EventArgs{
+
+ [MonoTODO]
+ public static void InvokeOnEventsThread(System.Delegate method)
+ {
+ throw new System.NotImplementedException ();
+ }
+
+
+
+ [MonoTODO]
+ public static event System.EventHandler DisplaySettingsChanged {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event System.EventHandler EventsThreadShutdown {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event System.EventHandler InstalledFontsChanged {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event System.EventHandler LowMemory {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event System.EventHandler PaletteChanged {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event PowerModeChangedEventHandler PowerModeChanged {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event SessionEndedEventHandler SessionEnded {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event System.EventHandler SessionEnding {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event System.EventHandler TimeChanged {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event UserPreferenceChangedEventHandler TimerElapsed {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event UserPreferenceChangedEventHandler UserPreferenceChanged {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+ [MonoTODO]
+ public static event UserPreferenceChangingEventHandler UserPreferenceChanging {
+ add { throw new System.NotImplementedException ();}
+ remove { throw new System.NotImplementedException ();}
+ }
+
+
+}
+
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/TODOAttribute.cs b/mcs/class/System/Microsoft.Win32/TODOAttribute.cs
new file mode 100644
index 00000000000..bbd3962221d
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/TODOAttribute.cs
@@ -0,0 +1,34 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace Microsoft.Win32 {
+
+using System;
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute{
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System/Microsoft.Win32/TimerElapsedEventArgs.cs b/mcs/class/System/Microsoft.Win32/TimerElapsedEventArgs.cs
new file mode 100644
index 00000000000..a44c8eecee7
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/TimerElapsedEventArgs.cs
@@ -0,0 +1,33 @@
+//
+// TimerElapsedEventArgs.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public class TimerElapsedEventArgs : System.EventArgs{
+
+ System.IntPtr mytimerId;
+
+
+ public TimerElapsedEventArgs(System.IntPtr timerId)
+ {
+ this.mytimerId = timerId;
+ }
+
+ public System.IntPtr TimerId {
+
+ get{
+ return mytimerId;
+ }
+
+ }
+
+}
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/TimerElapsedEventHandler.cs b/mcs/class/System/Microsoft.Win32/TimerElapsedEventHandler.cs
new file mode 100644
index 00000000000..102e53c7a01
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/TimerElapsedEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// TimerElapsedEventHandler.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public delegate void TimerElapsedEventHandler(object sender, TimerElapsedEventArgs e);
+}
diff --git a/mcs/class/System/Microsoft.Win32/UserPreferenceCategory.cs b/mcs/class/System/Microsoft.Win32/UserPreferenceCategory.cs
new file mode 100644
index 00000000000..ab2775d4735
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/UserPreferenceCategory.cs
@@ -0,0 +1,28 @@
+//
+// UserPreferenceCategory.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+ public enum UserPreferenceCategory : int {
+ Accessibility = 1,
+ Color = 2,
+ Desktop = 3,
+ General = 4,
+ Icon = 5,
+ Keyboard = 6,
+ Menu = 7,
+ Mouse = 8,
+ Policy = 0,
+ Power = 10,
+ Screensaver = 11,
+ Window = 12,
+ Locale = 13
+ };
+}
diff --git a/mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventArgs.cs b/mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventArgs.cs
new file mode 100644
index 00000000000..52c351ee145
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventArgs.cs
@@ -0,0 +1,33 @@
+//
+// UserPreferenceChangedEventArgs.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public class UserPreferenceChangedEventArgs : System.EventArgs{
+
+ UserPreferenceCategory mycategory;
+
+
+ public UserPreferenceChangedEventArgs(UserPreferenceCategory category)
+ {
+ this.mycategory = category;
+ }
+
+ public UserPreferenceCategory category {
+
+ get{
+ return mycategory;
+ }
+
+ }
+
+}
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventHandler.cs b/mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventHandler.cs
new file mode 100644
index 00000000000..3a8afdd4689
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/UserPreferenceChangedEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// UserPreferenceChangedEventHandler.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public delegate void UserPreferenceChangedEventHandler( object sender, UserPreferenceChangedEventArgs e);
+}
diff --git a/mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventArgs.cs b/mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventArgs.cs
new file mode 100644
index 00000000000..9e05693dd49
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventArgs.cs
@@ -0,0 +1,33 @@
+//
+// UserPreferenceChangingEventArgs.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public class UserPreferenceChangingEventArgs : System.EventArgs{
+
+ UserPreferenceCategory mycategory;
+
+
+ public UserPreferenceChangingEventArgs(UserPreferenceCategory category)
+ {
+ this.mycategory = category;
+ }
+
+ public UserPreferenceCategory category {
+
+ get{
+ return mycategory;
+ }
+
+ }
+
+}
+
+}
diff --git a/mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventHandler.cs b/mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventHandler.cs
new file mode 100644
index 00000000000..91659c6e1a1
--- /dev/null
+++ b/mcs/class/System/Microsoft.Win32/UserPreferenceChangingEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// UserPreferenceChangingEventHandler.cs
+//
+// Author:
+// Johannes Roith (johannes@jroith.de)
+//
+// (C) 2002 Johannes Roith
+//
+namespace Microsoft.Win32 {
+
+ /// <summary>
+ /// </summary>
+public delegate void UserPreferenceChangingEventHandler( object sender, UserPreferenceChangingEventArgs e);
+}
diff --git a/mcs/class/System/README b/mcs/class/System/README
new file mode 100755
index 00000000000..e7a0028b8af
--- /dev/null
+++ b/mcs/class/System/README
@@ -0,0 +1,8 @@
+Build instructions for use with the mono runtime.
+
+Run:
+ mcs @list.unix
+
+If no errors occourred, copy the generated System.dll file to the runtime dir
+(probably /usr/local/lib).
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/ChangeLog b/mcs/class/System/System.CodeDom.Compiler/ChangeLog
new file mode 100755
index 00000000000..4d236c05b82
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/ChangeLog
@@ -0,0 +1,61 @@
+2003-01-10 Duncan Mak <duncan@ximian.com>
+
+ * CompilerErrorCollection.cs:
+ * CompilerParameters.cs: Patch from Sean Kasun
+ <skasun@azstarnet.com> implementing most of the MonoTODOs in
+ CompilerErrorCollection and the CompilerParameters overloads in CompilerParameters.cs.
+
+2002-11-30 Jackson Harper <jackson@latitudegeo.com>
+
+ * CodeCompiler.cs: Removed TODO attribute from abstract members
+
+2002-11-30 Jackson Harper <jackson@latitudegeo.com>
+
+ * CodeCompiler.cs: Added stub
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CodeDomProvider.cs:
+ * IndentedTextWriter.cs: misc. fixes.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CompilerError.cs: implemented.
+ * CompilerErrorCollection.cs: stubbed out and fix inheritance.
+ * GeneratorSupport.cs: fixed values.
+
+2002-05-28 Daniel Stodden <stodden@in.tum.de>
+
+ * CodeDomProvider.cs: added, incomplete
+
+ * CodeGeneratorOptions.cs: added, complete
+
+ * CompilerErrorCollection.cs: added, stub
+
+ * CompilerOptions.cs: added, stub
+
+ * CompilerResults.cs: added, complete
+
+ * GeneratorSupport.cs: added, complete
+
+ * ICodeCompiler.cs: added, complete
+
+ * ICodeParser.cs: added, complete
+
+ * IndentedTextWriter.cs: added, complete
+
+ * LanguageOptions.cs: added, complete
+
+ * TempFileCollection.cs: added, stub
+
+ * ICodeGenerator.cs: added, complete
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * CodeGenerator.cs : Mark bits with MonoTODO.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * CodeGenerator.cs: moved using statement out of namespace
+ declaration.
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/CodeCompiler.cs b/mcs/class/System/System.CodeDom.Compiler/CodeCompiler.cs
new file mode 100644
index 00000000000..28c8f563c54
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CodeCompiler.cs
@@ -0,0 +1,138 @@
+//
+// System.CodeDom.Compiler.CodeCompiler
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved
+//
+
+namespace System.CodeDom.Compiler {
+
+ public abstract class CodeCompiler : CodeGenerator, ICodeCompiler
+ {
+
+ [MonoTODO]
+ protected CodeCompiler ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract string CompilerName {
+ get;
+ }
+
+ protected abstract string FileExtension {
+ get;
+ }
+
+ protected abstract string CmdArgsFromParameters (
+ CompilerParameters options);
+
+ [MonoTODO]
+ protected virtual CompilerResults FromDom (
+ CompilerParameters options, CodeCompileUnit e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual CompilerResults FromDomBatch(
+ CompilerParameters options,CodeCompileUnit[] ea)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual CompilerResults FromFile(
+ CompilerParameters options,string fileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual CompilerResults FromFileBatch(
+ CompilerParameters options,string[] fileNames)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual CompilerResults FromSource(
+ CompilerParameters options,string source)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual CompilerResults FromSourceBatch(
+ CompilerParameters options,string[] sources)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ protected virtual string GetResponseFileCmdArgs(
+ CompilerParameters options,string cmdArgs)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ CompilerResults ICodeCompiler.CompileAssemblyFromDom(
+ CompilerParameters options,CodeCompileUnit e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ CompilerResults ICodeCompiler.CompileAssemblyFromDomBatch(
+ CompilerParameters options,CodeCompileUnit[] ea)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ CompilerResults ICodeCompiler.CompileAssemblyFromFile(
+ CompilerParameters options, string fileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ CompilerResults ICodeCompiler.CompileAssemblyFromFileBatch(
+ CompilerParameters options, string[] fileNames)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ CompilerResults ICodeCompiler.CompileAssemblyFromSource(
+ CompilerParameters options, string source)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ CompilerResults ICodeCompiler.CompileAssemblyFromSourceBatch(
+ CompilerParameters options, string[] sources)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected static string JoinStringArray(string[] sa,
+ string separator)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract void ProcessCompilerOutputLine(
+ CompilerResults results, string line);
+
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs b/mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs
new file mode 100644
index 00000000000..b05712d5b82
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs
@@ -0,0 +1,69 @@
+//
+// System.CodeDom.Compiler CodeDomProvider Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.ComponentModel;
+using System.IO;
+
+namespace System.CodeDom.Compiler
+{
+ [ToolboxItem("")]
+ public abstract class CodeDomProvider
+ : Component
+ {
+ //
+ // Constructors
+ //
+ protected CodeDomProvider()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public virtual string FileExtension {
+ get {
+ return String.Empty;
+ }
+ }
+
+ public virtual LanguageOptions LanguageOptions {
+ get {
+ return LanguageOptions.None;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public abstract ICodeCompiler CreateCompiler();
+
+ public abstract ICodeGenerator CreateGenerator();
+
+ public virtual ICodeGenerator CreateGenerator( string fileName )
+ {
+ return CreateGenerator();
+ }
+
+ public virtual ICodeGenerator CreateGenerator( TextWriter output )
+ {
+ return CreateGenerator();
+ }
+
+ public virtual ICodeParser CreateParser()
+ {
+ return null;
+ }
+
+ public virtual TypeConverter GetConverter( Type type )
+ {
+ return TypeDescriptor.GetConverter (type);
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs b/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
new file mode 100755
index 00000000000..36ea5d13ef3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
@@ -0,0 +1,936 @@
+//
+// System.CodeDom.Compiler CodeGenerator class
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.CodeDom;
+using System.Reflection;
+using System.IO;
+using System.Collections;
+
+namespace System.CodeDom.Compiler {
+
+ public abstract class CodeGenerator
+ : ICodeGenerator
+ {
+ private IndentedTextWriter output;
+ private CodeGeneratorOptions options;
+ private CodeTypeMember currentMember;
+ private CodeTypeDeclaration currentType;
+
+ //
+ // Constructors
+ //
+ protected CodeGenerator()
+ {
+ }
+
+ //
+ // Properties
+ //
+ protected CodeTypeMember CurrentMember {
+ get {
+ return currentMember;
+ }
+ }
+
+ protected string CurrentMemberName {
+ get {
+ if ( currentType == null )
+ return null;
+ return currentMember.Name;
+ }
+ }
+
+ protected string CurrentTypeName {
+ get {
+ if ( currentType == null )
+ return null;
+ return currentType.Name;
+ }
+ }
+
+ protected int Indent {
+ get {
+ return output.Indent;
+ }
+ set {
+ output.Indent = value;
+ }
+ }
+
+ protected bool IsCurrentClass {
+ get {
+ if ( currentType == null )
+ return false;
+ return currentType.IsClass;
+ }
+ }
+
+ protected bool IsCurrentDelegate {
+ get {
+ return currentType is CodeTypeDelegate;
+ }
+ }
+
+ protected bool IsCurrentEnum {
+ get {
+ if ( currentType == null )
+ return false;
+ return currentType.IsEnum;
+ }
+ }
+
+ protected bool IsCurrentInterface {
+ get {
+ if ( currentType == null )
+ return false;
+ return currentType.IsInterface;
+ }
+ }
+
+ protected bool IsCurrentStruct {
+ get {
+ if ( currentType == null )
+ return false;
+ return currentType.IsStruct;
+ }
+ }
+
+ protected abstract string NullToken {
+ get;
+ }
+
+
+ protected CodeGeneratorOptions Options {
+ get {
+ return options;
+ }
+ }
+
+ protected TextWriter Output {
+ get {
+ return output;
+ }
+ }
+
+ //
+ // Methods
+ //
+ protected virtual void ContinueOnNewLine( string st )
+ {
+ }
+
+ /*
+ * Code Generation methods
+ */
+ protected abstract void GenerateArgumentReferenceExpression (CodeArgumentReferenceExpression e);
+ protected abstract void GenerateArrayCreateExpression (CodeArrayCreateExpression e);
+ protected abstract void GenerateArrayIndexerExpression( CodeArrayIndexerExpression e );
+ protected abstract void GenerateAssignStatement (CodeAssignStatement s);
+ protected abstract void GenerateAttachEventStatement (CodeAttachEventStatement s);
+ protected abstract void GenerateAttributeDeclarationsStart( CodeAttributeDeclarationCollection attributes );
+ protected abstract void GenerateAttributeDeclarationsEnd( CodeAttributeDeclarationCollection attributes );
+ protected abstract void GenerateBaseReferenceExpression (CodeBaseReferenceExpression e);
+
+ protected virtual void GenerateBinaryOperatorExpression (CodeBinaryOperatorExpression e)
+ {
+ GenerateExpression( e.Left );
+
+ switch ( e.Operator ) {
+ case CodeBinaryOperatorType.Add:
+ output.Write( " + " );
+ break;
+ case CodeBinaryOperatorType.Assign:
+ output.Write( " = " );
+ break;
+ case CodeBinaryOperatorType.BitwiseAnd:
+ output.Write( " & " );
+ break;
+ case CodeBinaryOperatorType.BitwiseOr:
+ output.Write( " | " );
+ break;
+ case CodeBinaryOperatorType.BooleanAnd:
+ output.Write( " && " );
+ break;
+ case CodeBinaryOperatorType.BooleanOr:
+ output.Write( " || " );
+ break;
+ case CodeBinaryOperatorType.Divide:
+ output.Write( " / " );
+ break;
+ case CodeBinaryOperatorType.GreaterThan:
+ output.Write( " > " );
+ break;
+ case CodeBinaryOperatorType.GreaterThanOrEqual:
+ output.Write( " >= " );
+ break;
+ case CodeBinaryOperatorType.IdentityEquality:
+ output.Write( " == " );
+ break;
+ case CodeBinaryOperatorType.IdentityInequality:
+ output.Write( " != " );
+ break;
+ case CodeBinaryOperatorType.LessThan:
+ output.Write( " < " );
+ break;
+ case CodeBinaryOperatorType.LessThanOrEqual:
+ output.Write( " <= " );
+ break;
+ case CodeBinaryOperatorType.Modulus:
+ output.Write( " % " );
+ break;
+ case CodeBinaryOperatorType.Multiply:
+ output.Write( " * " );
+ break;
+ case CodeBinaryOperatorType.Subtract:
+ output.Write( " - " );
+ break;
+ case CodeBinaryOperatorType.ValueEquality:
+ output.Write( " == " );
+ break;
+ }
+
+ GenerateExpression( e.Right );
+ }
+
+ protected abstract void GenerateCastExpression (CodeCastExpression e);
+ protected abstract void GenerateComment( CodeComment comment );
+
+ protected virtual void GenerateCommentStatement( CodeCommentStatement statement )
+ {
+ GenerateComment( statement.Comment );
+ }
+
+ protected virtual void GenerateCommentStatements (CodeCommentStatementCollection statements)
+ {
+ foreach ( CodeCommentStatement comment in statements )
+ GenerateCommentStatement( comment );
+ }
+
+ protected virtual void GenerateCompileUnit( CodeCompileUnit compileUnit )
+ {
+ GenerateCompileUnitStart( compileUnit );
+
+ CodeAttributeDeclarationCollection attributes = compileUnit.AssemblyCustomAttributes;
+ if ( attributes.Count != 0 ) {
+ GenerateAttributeDeclarationsStart( attributes );
+ output.Write( "assembly: " );
+ OutputAttributeDeclarations( compileUnit.AssemblyCustomAttributes );
+ GenerateAttributeDeclarationsEnd( attributes );
+ }
+
+ foreach ( CodeNamespace ns in compileUnit.Namespaces )
+ GenerateNamespace( ns );
+
+ GenerateCompileUnitEnd( compileUnit );
+ }
+
+ protected virtual void GenerateCompileUnitEnd( CodeCompileUnit compileUnit )
+ {
+ output.WriteLine( "<compileUnitEnd>" );
+ }
+
+ protected virtual void GenerateCompileUnitStart( CodeCompileUnit compileUnit )
+ {
+ output.WriteLine( "<compileUnitStart>" );
+ }
+
+ protected abstract void GenerateConditionStatement( CodeConditionStatement s );
+ protected abstract void GenerateConstructor (CodeConstructor x, CodeTypeDeclaration d);
+ protected abstract void GenerateDelegateCreateExpression( CodeDelegateCreateExpression e );
+ protected abstract void GenerateDelegateInvokeExpression( CodeDelegateInvokeExpression e );
+
+ protected virtual void GenerateDirectionExpression( CodeDirectionExpression e )
+ {
+ OutputDirection( e.Direction );
+ output.Write( ' ' );
+ GenerateExpression( e.Expression );
+ }
+
+ protected abstract void GenerateEntryPointMethod( CodeEntryPointMethod m, CodeTypeDeclaration d );
+ protected abstract void GenerateEvent( CodeMemberEvent ev, CodeTypeDeclaration d );
+ protected abstract void GenerateEventReferenceExpression( CodeEventReferenceExpression e );
+
+ protected void GenerateExpression( CodeExpression e )
+ {
+ CodeArgumentReferenceExpression argref = e as CodeArgumentReferenceExpression;
+ if ( argref != null ) {
+ GenerateArgumentReferenceExpression( argref );
+ return;
+ }
+ CodeArrayCreateExpression mkarray = e as CodeArrayCreateExpression;
+ if ( mkarray != null ) {
+ GenerateArrayCreateExpression( mkarray );
+ return;
+ }
+ CodeArrayIndexerExpression arrayidx = e as CodeArrayIndexerExpression;
+ if ( arrayidx != null ) {
+ GenerateArrayIndexerExpression( arrayidx );
+ return;
+ }
+ CodeBaseReferenceExpression baseref = e as CodeBaseReferenceExpression;
+ if ( baseref != null ) {
+ GenerateBaseReferenceExpression( baseref );
+ return;
+ }
+ CodeBinaryOperatorExpression binary = e as CodeBinaryOperatorExpression;
+ if ( binary != null ) {
+ GenerateBinaryOperatorExpression( binary );
+ return;
+ }
+ CodeCastExpression cast = e as CodeCastExpression;
+ if ( cast != null ) {
+ GenerateCastExpression( cast );
+ return;
+ }
+ CodeDelegateCreateExpression mkdel = e as CodeDelegateCreateExpression;
+ if ( mkdel != null ) {
+ GenerateDelegateCreateExpression( mkdel );
+ return;
+ }
+ CodeDelegateInvokeExpression delinvoke = e as CodeDelegateInvokeExpression;
+ if ( delinvoke != null ) {
+ GenerateDelegateInvokeExpression( delinvoke );
+ return;
+ }
+ CodeDirectionExpression direction = e as CodeDirectionExpression;
+ if ( direction != null ) {
+ GenerateDirectionExpression( direction );
+ return;
+ }
+ CodeEventReferenceExpression eventref = e as CodeEventReferenceExpression;
+ if ( eventref != null ) {
+ GenerateEventReferenceExpression( eventref );
+ return;
+ }
+ CodeFieldReferenceExpression fieldref = e as CodeFieldReferenceExpression;
+ if ( fieldref != null ) {
+ GenerateFieldReferenceExpression( fieldref );
+ return;
+ }
+ CodeIndexerExpression idx = e as CodeIndexerExpression;
+ if ( idx != null ) {
+ GenerateIndexerExpression( idx );
+ return;
+ }
+ CodeMethodInvokeExpression methodinv = e as CodeMethodInvokeExpression;
+ if ( methodinv != null ) {
+ GenerateMethodInvokeExpression( methodinv );
+ return;
+ }
+ CodeMethodReferenceExpression methodref = e as CodeMethodReferenceExpression;
+ if ( methodref != null ) {
+ GenerateMethodReferenceExpression( methodref );
+ return;
+ }
+ CodeObjectCreateExpression objref = e as CodeObjectCreateExpression;
+ if ( objref != null ) {
+ GenerateObjectCreateExpression( objref );
+ return;
+ }
+ CodeParameterDeclarationExpression param = e as CodeParameterDeclarationExpression;
+ if ( param != null ) {
+ GenerateParameterDeclarationExpression( param );
+ return;
+ }
+ CodePrimitiveExpression primitive = e as CodePrimitiveExpression;
+ if ( primitive != null ) {
+ GeneratePrimitiveExpression( primitive );
+ return;
+ }
+ CodePropertyReferenceExpression propref = e as CodePropertyReferenceExpression;
+ if ( propref != null ) {
+ GeneratePropertyReferenceExpression( propref );
+ return;
+ }
+ CodePropertySetValueReferenceExpression propset = e as CodePropertySetValueReferenceExpression;
+ if ( propset != null ) {
+ GeneratePropertySetValueReferenceExpression( propset );
+ return;
+ }
+ CodeSnippetExpression snippet = e as CodeSnippetExpression;
+ if ( snippet != null ) {
+ GenerateSnippetExpression( snippet );
+ return;
+ }
+ CodeThisReferenceExpression thisref = e as CodeThisReferenceExpression;
+ if ( thisref != null ) {
+ GenerateThisReferenceExpression( thisref );
+ return;
+ }
+ CodeTypeOfExpression typeOf = e as CodeTypeOfExpression;
+ if ( typeOf != null ) {
+ GenerateTypeOfExpression( typeOf );
+ return;
+ }
+ CodeTypeReferenceExpression typeref = e as CodeTypeReferenceExpression;
+ if ( typeref != null ) {
+ GenerateTypeReferenceExpression( typeref );
+ return;
+ }
+ CodeVariableReferenceExpression varref = e as CodeVariableReferenceExpression;
+ if ( varref != null ) {
+ GenerateVariableReferenceExpression( varref );
+ return;
+ }
+ }
+
+ protected abstract void GenerateExpressionStatement( CodeExpressionStatement statement );
+ protected abstract void GenerateField (CodeMemberField f);
+ protected abstract void GenerateFieldReferenceExpression (CodeFieldReferenceExpression e);
+ protected abstract void GenerateGotoStatement( CodeGotoStatement statement );
+ protected abstract void GenerateIndexerExpression (CodeIndexerExpression e);
+ protected abstract void GenerateIterationStatement( CodeIterationStatement s );
+ protected abstract void GenerateLabeledStatement( CodeLabeledStatement statement );
+ protected abstract void GenerateLinePragmaStart (CodeLinePragma p);
+ protected abstract void GenerateLinePragmaEnd (CodeLinePragma p);
+ protected abstract void GenerateMethod (CodeMemberMethod m, CodeTypeDeclaration d);
+ protected abstract void GenerateMethodInvokeExpression (CodeMethodInvokeExpression e);
+ protected abstract void GenerateMethodReferenceExpression( CodeMethodReferenceExpression e );
+ protected abstract void GenerateMethodReturnStatement (CodeMethodReturnStatement e);
+
+ protected virtual void GenerateNamespace (CodeNamespace ns)
+ {
+ foreach ( CodeCommentStatement statement in ns.Comments )
+ GenerateCommentStatement( statement );
+
+ GenerateNamespaceStart( ns );
+
+ foreach ( CodeNamespaceImport import in ns.Imports )
+ GenerateNamespaceImport( import );
+
+ output.WriteLine();
+
+ foreach ( CodeTypeDeclaration type in ns.Types )
+ GenerateCodeFromType( type, output, options );
+
+ GenerateNamespaceEnd( ns );
+ }
+
+ protected abstract void GenerateNamespaceStart (CodeNamespace ns);
+ protected abstract void GenerateNamespaceEnd (CodeNamespace ns);
+ protected abstract void GenerateNamespaceImport (CodeNamespaceImport i);
+ protected abstract void GenerateObjectCreateExpression (CodeObjectCreateExpression e);
+
+ protected virtual void GenerateParameterDeclarationExpression (CodeParameterDeclarationExpression e)
+ {
+ OutputAttributeDeclarations( e.CustomAttributes );
+ OutputDirection( e.Direction );
+ OutputType( e.Type );
+ output.Write( ' ' );
+ output.Write( e.Name );
+ }
+
+ protected virtual void GeneratePrimitiveExpression (CodePrimitiveExpression e)
+ {
+ output.Write( e.Value );
+ }
+
+ protected abstract void GenerateProperty (CodeMemberProperty p, CodeTypeDeclaration d);
+ protected abstract void GeneratePropertyReferenceExpression (CodePropertyReferenceExpression e);
+ protected abstract void GeneratePropertySetValueReferenceExpression( CodePropertySetValueReferenceExpression e );
+ protected abstract void GenerateRemoveEventStatement( CodeRemoveEventStatement statement );
+ protected abstract void GenerateSnippetExpression( CodeSnippetExpression e );
+ protected abstract void GenerateSnippetMember( CodeSnippetTypeMember m );
+ protected virtual void GenerateSnippetStatement( CodeSnippetStatement s )
+ {
+ output.Write( s.Value );
+ }
+
+ protected void GenerateStatement( CodeStatement s )
+ {
+ CodeAssignStatement assign = s as CodeAssignStatement;
+ if ( assign != null ) {
+ GenerateAssignStatement( assign );
+ return;
+ }
+ CodeAttachEventStatement attach = s as CodeAttachEventStatement;
+ if ( attach != null ) {
+ GenerateAttachEventStatement( attach );
+ return;
+ }
+ CodeCommentStatement comment = s as CodeCommentStatement;
+ if ( comment != null ) {
+ GenerateCommentStatement( comment );
+ return;
+ }
+ CodeConditionStatement condition = s as CodeConditionStatement;
+ if ( condition != null ) {
+ GenerateConditionStatement( condition );
+ return;
+ }
+ CodeExpressionStatement expression = s as CodeExpressionStatement;
+ if ( expression != null ) {
+ GenerateExpressionStatement( expression );
+ return;
+ }
+ CodeGotoStatement gotostmt = s as CodeGotoStatement;
+ if ( gotostmt != null ) {
+ GenerateGotoStatement( gotostmt );
+ return;
+ }
+ CodeIterationStatement iteration = s as CodeIterationStatement;
+ if ( iteration != null ) {
+ GenerateIterationStatement( iteration );
+ return;
+ }
+ CodeLabeledStatement label = s as CodeLabeledStatement;
+ if ( label != null ) {
+ GenerateLabeledStatement( label );
+ return;
+ }
+ CodeMethodReturnStatement returnstmt = s as CodeMethodReturnStatement;
+ if ( returnstmt != null ) {
+ GenerateMethodReturnStatement( returnstmt );
+ return;
+ }
+ CodeRemoveEventStatement remove = s as CodeRemoveEventStatement;
+ if ( remove != null ) {
+ GenerateRemoveEventStatement( remove );
+ return;
+ }
+ CodeSnippetStatement snippet = s as CodeSnippetStatement;
+ if ( snippet != null ) {
+ GenerateSnippetStatement( snippet );
+ return;
+ }
+ CodeThrowExceptionStatement exception = s as CodeThrowExceptionStatement;
+ if ( exception != null ) {
+ GenerateThrowExceptionStatement( exception );
+ return;
+ }
+ CodeTryCatchFinallyStatement trycatch = s as CodeTryCatchFinallyStatement;
+ if ( trycatch != null ) {
+ GenerateTryCatchFinallyStatement( trycatch );
+ return;
+ }
+ CodeVariableDeclarationStatement declaration = s as CodeVariableDeclarationStatement;
+ if ( declaration != null ) {
+ GenerateVariableDeclarationStatement( declaration );
+ return;
+ }
+ }
+
+ protected void GenerateStatements( CodeStatementCollection c )
+ {
+ foreach ( CodeStatement statement in c )
+ GenerateStatement( statement );
+ }
+
+ protected abstract void GenerateThisReferenceExpression (CodeThisReferenceExpression e);
+ protected abstract void GenerateThrowExceptionStatement (CodeThrowExceptionStatement s);
+ protected abstract void GenerateTryCatchFinallyStatement (CodeTryCatchFinallyStatement s);
+ protected abstract void GenerateTypeEnd( CodeTypeDeclaration declaration );
+ protected abstract void GenerateTypeConstructor( CodeTypeConstructor constructor );
+
+ protected virtual void GenerateTypeOfExpression (CodeTypeOfExpression e)
+ {
+ output.Write( "typeof(" );
+ OutputType( e.Type );
+ output.Write( ")" );
+ }
+
+ protected virtual void GenerateTypeReferenceExpression (CodeTypeReferenceExpression e)
+ {
+ OutputType( e.Type );
+ }
+
+ protected abstract void GenerateTypeStart( CodeTypeDeclaration declaration );
+ protected abstract void GenerateVariableDeclarationStatement (CodeVariableDeclarationStatement e);
+ protected abstract void GenerateVariableReferenceExpression( CodeVariableReferenceExpression e );
+
+ //
+ // Other members
+ //
+
+ /*
+ * Output Methods
+ */
+ protected virtual void OutputAttributeArgument( CodeAttributeArgument argument )
+ {
+ string name = argument.Name;
+ if ( name != null ) {
+ output.Write( name );
+ output.Write( '=' );
+ }
+ GenerateExpression( argument.Value );
+ }
+
+ private void OutputAttributeDeclaration( CodeAttributeDeclaration attribute )
+ {
+ output.Write( attribute.Name );
+ output.Write( '(' );
+ IEnumerator enumerator = attribute.Arguments.GetEnumerator();
+ if ( enumerator.MoveNext() ) {
+ CodeAttributeArgument argument = (CodeAttributeArgument)enumerator.Current;
+ OutputAttributeArgument( argument );
+
+ while ( enumerator.MoveNext() ) {
+ output.Write( ',' );
+ argument = (CodeAttributeArgument)enumerator.Current;
+ OutputAttributeArgument( argument );
+ }
+ }
+ output.Write( ')' );
+ }
+
+ protected virtual void OutputAttributeDeclarations( CodeAttributeDeclarationCollection attributes )
+ {
+ GenerateAttributeDeclarationsStart( attributes );
+
+ IEnumerator enumerator = attributes.GetEnumerator();
+ if ( enumerator.MoveNext() ) {
+ CodeAttributeDeclaration attribute = (CodeAttributeDeclaration)enumerator.Current;
+
+ OutputAttributeDeclaration( attribute );
+
+ while ( enumerator.MoveNext() ) {
+ attribute = (CodeAttributeDeclaration)enumerator.Current;
+
+ output.WriteLine( ',' );
+ OutputAttributeDeclaration( attribute );
+ }
+ }
+
+ GenerateAttributeDeclarationsEnd( attributes );
+ }
+
+ protected virtual void OutputDirection( FieldDirection direction )
+ {
+ switch ( direction ) {
+ case FieldDirection.In:
+ output.Write( "in " );
+ break;
+ case FieldDirection.Out:
+ output.Write( "out " );
+ break;
+ case FieldDirection.Ref:
+ output.Write( "ref " );
+ break;
+ }
+ }
+
+ protected virtual void OutputExpressionList( CodeExpressionCollection expressions )
+ {
+ OutputExpressionList( expressions, false );
+ }
+
+ protected virtual void OutputExpressionList( CodeExpressionCollection expressions,
+ bool newLineBetweenItems )
+ {
+ IEnumerator enumerator = expressions.GetEnumerator();
+ if ( enumerator.MoveNext() ) {
+ CodeExpression expression = (CodeExpression)enumerator.Current;
+
+ GenerateExpression( expression );
+
+ while ( enumerator.MoveNext() ) {
+ expression = (CodeExpression)enumerator.Current;
+
+ output.Write( ',' );
+ if ( newLineBetweenItems )
+ output.WriteLine();
+ else
+ output.Write( ' ' );
+
+ GenerateExpression( expression );
+ }
+ }
+ }
+
+ protected virtual void OutputFieldScopeModifier( MemberAttributes attributes )
+ {
+ if ( (attributes & MemberAttributes.VTableMask) == MemberAttributes.New )
+ output.Write( "new " );
+
+ switch ( attributes & MemberAttributes.ScopeMask ) {
+ case MemberAttributes.Static:
+ output.Write( "static " );
+ break;
+ case MemberAttributes.Const:
+ output.Write( "const " );
+ break;
+ }
+ }
+
+ protected virtual void OutputIdentifier( string ident )
+ {
+ }
+
+ protected virtual void OutputMemberAccessModifier( MemberAttributes attributes )
+ {
+ switch ( attributes & MemberAttributes.AccessMask ) {
+ case MemberAttributes.Assembly:
+ output.Write( "internal " );
+ break;
+ case MemberAttributes.FamilyAndAssembly:
+ output.Write( "/* FamAndAssem */ internal " );
+ break;
+ case MemberAttributes.Family:
+ output.Write( "protected " );
+ break;
+ case MemberAttributes.FamilyOrAssembly:
+ output.Write( "protected internal " );
+ break;
+ case MemberAttributes.Private:
+ output.Write( "private " );
+ break;
+ case MemberAttributes.Public:
+ output.Write( "public " );
+ break;
+ }
+ }
+
+ protected virtual void OutputMemberScopeModifier( MemberAttributes attributes )
+ {
+ if ( (attributes & MemberAttributes.VTableMask) == MemberAttributes.New )
+ output.Write( "new " );
+
+ switch ( attributes & MemberAttributes.ScopeMask ) {
+ case MemberAttributes.Abstract:
+ output.Write( "abstract " );
+ break;
+ case MemberAttributes.Final:
+ output.Write( "sealed " );
+ break;
+ case MemberAttributes.Static:
+ output.Write( "static " );
+ break;
+ case MemberAttributes.Override:
+ output.Write( "override " );
+ break;
+ default:
+ //
+ // FUNNY! if the scope value is
+ // rubbish (0 or >Const), and access
+ // is public or protected, make it
+ // "virtual".
+ //
+ // i'm not sure whether this is 100%
+ // correct, but it seems to be MS
+ // behavior.
+ //
+ MemberAttributes access = attributes & MemberAttributes.AccessMask;
+ if ( access == MemberAttributes.Public ||
+ access == MemberAttributes.Family )
+ output.Write( "virtual " );
+ break;
+ }
+ }
+
+ protected virtual void OutputOperator( CodeBinaryOperatorType op )
+ {
+ }
+
+ protected virtual void OutputParameters( CodeParameterDeclarationExpressionCollection parameters )
+ {
+ }
+
+ protected abstract void OutputType( CodeTypeReference t );
+
+ protected virtual void OutputTypeAttributes( TypeAttributes attributes,
+ bool isStruct,
+ bool isEnum )
+ {
+ switch ( attributes & TypeAttributes.VisibilityMask ) {
+ case TypeAttributes.NotPublic:
+ // private by default
+ break;
+
+ case TypeAttributes.Public:
+ case TypeAttributes.NestedPublic:
+ output.Write( "public " );
+ break;
+
+ case TypeAttributes.NestedPrivate:
+ output.Write( "private " );
+ break;
+ }
+
+ if ( isStruct )
+
+ output.Write( "struct " );
+
+ else if ( isEnum )
+
+ output.Write( "enum " );
+
+ else {
+ if ( (attributes & TypeAttributes.Interface) != 0 )
+
+ output.Write( "interface " );
+
+ else {
+
+ if ( (attributes & TypeAttributes.Sealed) != 0 )
+ output.Write( "sealed " );
+
+ if ( (attributes & TypeAttributes.Abstract) != 0 )
+ output.Write( "abstract " );
+
+ output.Write( "class " );
+ }
+ }
+ }
+
+ protected virtual void OutputTypeNamePair( CodeTypeReference type,
+ string name )
+ {
+ OutputType( type );
+ output.Write( ' ' );
+ output.Write( name );
+ }
+
+ protected abstract string QuoteSnippetString( string value );
+
+ /*
+ * ICodeGenerator
+ */
+ protected abstract string CreateEscapedIdentifier( string value );
+ string ICodeGenerator.CreateEscapedIdentifier( string value )
+ {
+ return CreateEscapedIdentifier( value );
+ }
+
+ protected abstract string CreateValidIdentifier( string value );
+ string ICodeGenerator.CreateValidIdentifier( string value )
+ {
+ return CreateValidIdentifier( value );
+ }
+
+ private void InitOutput( TextWriter output, CodeGeneratorOptions options )
+ {
+ if ( options == null )
+ options = new CodeGeneratorOptions();
+
+ this.output = new IndentedTextWriter( output, options.IndentString );
+ this.options = options;
+ }
+
+ public virtual void GenerateCodeFromCompileUnit( CodeCompileUnit compileUnit,
+ TextWriter output,
+ CodeGeneratorOptions options )
+ {
+ InitOutput( output, options );
+ GenerateCompileUnit( compileUnit );
+ }
+
+ [MonoTODO]
+ public virtual void GenerateCodeFromExpression( CodeExpression expression,
+ TextWriter output,
+ CodeGeneratorOptions options )
+ {
+ InitOutput( output, options );
+ }
+
+ public virtual void GenerateCodeFromNamespace( CodeNamespace ns,
+ TextWriter output,
+ CodeGeneratorOptions options )
+ {
+ InitOutput( output, options );
+ GenerateNamespace( ns );
+ }
+
+ public virtual void GenerateCodeFromStatement( CodeStatement statement,
+ TextWriter output,
+ CodeGeneratorOptions options )
+ {
+ InitOutput( output, options );
+ }
+
+ public virtual void GenerateCodeFromType( CodeTypeDeclaration type,
+ TextWriter output,
+ CodeGeneratorOptions options )
+ {
+ CodeTypeDeclaration prevType = this.currentType;
+ this.currentType = type;
+
+ InitOutput( output, options );
+
+ GenerateTypeStart( type );
+
+ foreach ( CodeTypeMember member in type.Members ) {
+
+ CodeTypeMember prevMember = this.currentMember;
+ this.currentMember = member;
+
+ if ( options.BlankLinesBetweenMembers )
+ output.WriteLine();
+
+ CodeMemberEvent eventm = member as CodeMemberEvent;
+ if ( eventm != null ) {
+ GenerateEvent( eventm, type );
+ continue;
+ }
+ CodeMemberField field = member as CodeMemberField;
+ if ( field != null ) {
+ GenerateField( field );
+ continue;
+ }
+ CodeMemberMethod method = member as CodeMemberMethod;
+ if ( method != null ) {
+ GenerateMethod( method, type );
+ continue;
+ }
+ CodeMemberProperty property = member as CodeMemberProperty;
+ if ( property != null ) {
+ GenerateProperty( property, type );
+ continue;
+ }
+ CodeSnippetTypeMember snippet = member as CodeSnippetTypeMember;
+ if ( snippet != null ) {
+ GenerateSnippetMember( snippet );
+ continue;
+ }
+ CodeTypeDeclaration subtype = member as CodeTypeDeclaration;
+ if ( subtype != null ) {
+ GenerateCodeFromType( subtype, output, options );
+ continue;
+ }
+
+ this.currentMember = prevMember;
+ }
+
+ GenerateTypeEnd( type );
+ this.currentType = prevType;
+ }
+
+ protected abstract string GetTypeOutput( CodeTypeReference type );
+
+ string ICodeGenerator.GetTypeOutput( CodeTypeReference type )
+ {
+ return GetTypeOutput( type );
+ }
+
+ protected abstract bool IsValidIdentifier( string value );
+
+ bool ICodeGenerator.IsValidIdentifier( string value )
+ {
+ return IsValidIdentifier( value );
+ }
+
+ protected abstract bool Supports( GeneratorSupport supports );
+
+ bool ICodeGenerator.Supports( GeneratorSupport value )
+ {
+ return Supports( value );
+ }
+
+ [MonoTODO]
+ protected virtual void ValidateIdentifier( string value )
+ {
+ throw new NotImplementedException();
+ }
+
+ void ICodeGenerator.ValidateIdentifier( string value )
+ {
+ ValidateIdentifier( value );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/CodeGeneratorOptions.cs b/mcs/class/System/System.CodeDom.Compiler/CodeGeneratorOptions.cs
new file mode 100644
index 00000000000..b95b620f66e
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CodeGeneratorOptions.cs
@@ -0,0 +1,99 @@
+//
+// System.CodeDom.Compiler CodeGeneratorOptions class
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.CodeDom.Compiler
+{
+ public class CodeGeneratorOptions
+ {
+ private IDictionary properties;
+
+ //
+ // Constructors
+ //
+ public CodeGeneratorOptions()
+ {
+ properties = new ListDictionary();
+ properties.Add( "BlankLinesBetweenMembers", true );
+ properties.Add( "BracingStyle", "Block" );
+ properties.Add( "ElseOnClosing", false );
+ properties.Add( "IndentString", " " );
+ }
+
+ //
+ // Properties
+ //
+
+ /// <summary>
+ /// Whether to insert blank lines between individual members.
+ /// Default is true.
+ /// </summary>
+ public bool BlankLinesBetweenMembers {
+ get {
+ return (bool)properties["BlankLinesBetweenMembers"];
+ }
+ set {
+ properties["BlankLinesBetweenMembers"] = value;
+ }
+ }
+
+ /// <summary>
+ /// "Block" puts braces on the same line as the associated statement or declaration.
+ /// "C" puts braces on the following line.
+ /// Default is "C"
+ /// </summary>
+ public string BracingStyle {
+ get {
+ return (string)properties["BracingStyle"];
+ }
+ set {
+ properties["BracingStyle"] = value;
+ }
+ }
+
+ /// <summary>
+ /// Whether to start <code>else</code>,
+ /// <code>catch</code>, or <code>finally</code>
+ /// blocks on the same line as the previous block.
+ /// Default is false.
+ /// </summary>
+ public bool ElseOnClosing {
+ get {
+ return (bool)properties["ElseOnClosing"];
+ }
+ set {
+ properties["ElseOnClosing"] = value;
+ }
+ }
+
+ /// <summary>
+ /// The string used for individual indentation levels. Default is four spaces.
+ /// </summary>
+ public string IndentString {
+ get {
+ return (string)properties["IndentString"];
+ }
+ set {
+ properties["IndentString"] = value;
+ }
+ }
+
+ public Object this[string index] {
+ get {
+ return properties[index];
+ }
+ set {
+ properties[index] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerError.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerError.cs
new file mode 100644
index 00000000000..07ca418218c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CompilerError.cs
@@ -0,0 +1,81 @@
+//
+// System.CodeDom.Compiler.CompilerError
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.CodeDom.Compiler
+{
+ public class CompilerError
+ {
+ string fileName;
+ int line;
+ int column;
+ string errorNumber;
+ string errorText;
+ bool isWarning = false;
+
+ public CompilerError () :
+ this (String.Empty, 0, 0, String.Empty, String.Empty)
+ {
+ }
+
+ public CompilerError (string fileName, int line, int column, string errorNumber, string errorText)
+ {
+ this.fileName = fileName;
+ this.line = line;
+ this.column = column;
+ this.errorNumber = errorNumber;
+ this.errorText = errorText;
+ }
+
+ public override string ToString ()
+ {
+ string type = isWarning ? "warning" : "error";
+ return String.Format ("{0}({1},{2}) : {3} {4}: {5}", fileName, line, column, type,
+ errorNumber, errorText);
+ }
+
+ public int Line
+ {
+ get { return line; }
+ set { line = value; }
+ }
+
+ public int Column
+ {
+ get { return column; }
+ set { column = value; }
+ }
+
+ public string ErrorNumber
+ {
+ get { return errorNumber; }
+ set { errorNumber = value; }
+ }
+
+ public string ErrorText
+ {
+ get { return errorText; }
+ set { errorText = value; }
+ }
+
+ public bool IsWarning
+ {
+ get { return isWarning; }
+ set { isWarning = value; }
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ set { fileName = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerErrorCollection.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerErrorCollection.cs
new file mode 100644
index 00000000000..39c136769f4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CompilerErrorCollection.cs
@@ -0,0 +1,96 @@
+//
+// System.CodeDom.Compiler CompilerErrorCollection Class implementation
+//
+// Authors:
+// Daniel Stodden (stodden@in.tum.de)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+using System.Collections;
+namespace System.CodeDom.Compiler
+{
+ [MonoTODO]
+ public class CompilerErrorCollection : CollectionBase
+ {
+ [MonoTODO]
+ public CompilerErrorCollection ()
+ {
+ }
+
+ public CompilerErrorCollection (CompilerErrorCollection value)
+ {
+ InnerList.AddRange(value.InnerList);
+ }
+
+ public CompilerErrorCollection (CompilerError[] value)
+ {
+ InnerList.AddRange(value);
+ }
+
+ public int Add (CompilerError value)
+ {
+ return InnerList.Add(value);
+ }
+
+ public void AddRange (CompilerError[] value)
+ {
+ InnerList.AddRange(value);
+ }
+
+ public void AddRange (CompilerErrorCollection value)
+ {
+ InnerList.AddRange(value.InnerList);
+ }
+
+ public bool Contains (CompilerError value)
+ {
+ return InnerList.Contains(value);
+ }
+
+ public void CopyTo (CompilerError[] array, int index)
+ {
+ InnerList.CopyTo(array,index);
+ }
+
+ public int IndexOf (CompilerError value)
+ {
+ return InnerList.IndexOf(value);
+ }
+
+ public void Insert (int index, CompilerError value)
+ {
+ InnerList.Insert(index,value);
+ }
+
+ public void Remove (CompilerError value)
+ {
+ InnerList.Remove(value);
+ }
+
+ public CompilerError this [int index]
+ {
+ get { return (CompilerError) InnerList[index]; }
+ set { InnerList[index]=value; }
+ }
+
+ public bool HasErrors
+ {
+ get {
+ foreach (CompilerError error in InnerList)
+ if (!error.IsWarning) return true;
+ return false;
+ }
+ }
+
+ public bool HasWarnings
+ {
+ get {
+ foreach (CompilerError error in InnerList)
+ if (error.IsWarning) return true;
+ return false;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerOptions.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerOptions.cs
new file mode 100644
index 00000000000..cd25110d763
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CompilerOptions.cs
@@ -0,0 +1,16 @@
+//
+// System.CodeDom.Compiler CompilerOptions Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ public class CompilerOptions
+ {
+ // FIXME
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerParameters.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerParameters.cs
new file mode 100644
index 00000000000..63b43177d36
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CompilerParameters.cs
@@ -0,0 +1,169 @@
+//
+// System.CodeDom.Compiler CompilerParameters Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Collections.Specialized;
+
+namespace System.CodeDom.Compiler
+{
+ public class CompilerParameters
+ {
+ private CompilerOptions compilerOptions;
+ private bool generateExecutables;
+ private bool generateInMemory;
+ private bool includeDebugInformation;
+ private string mainClass;
+ private string outputAssembly;
+ private StringCollection referencedAssemblies;
+ private TempFileCollection tempFiles;
+ private bool treatWarningsAsErrors;
+ private IntPtr userToken;
+ private int warningLevel;
+ private string win32Resources;
+
+ //
+ // Constructors
+ //
+ public CompilerParameters()
+ {
+ }
+
+ public CompilerParameters( string[] assemblyNames )
+ {
+ referencedAssemblies=new StringCollection();
+ referencedAssemblies.AddRange(assemblyNames);
+ }
+
+ public CompilerParameters( string[] assemblyNames, string output )
+ {
+ referencedAssemblies=new StringCollection();
+ referencedAssemblies.AddRange(assemblyNames);
+ outputAssembly=output;
+ }
+
+ public CompilerParameters( string[] assemblyNames, string output, bool includeDebugInfo )
+ {
+ referencedAssemblies=new StringCollection();
+ referencedAssemblies.AddRange(assemblyNames);
+ outputAssembly=output;
+ includeDebugInformation=includeDebugInfo;
+ }
+
+
+ //
+ // Properties
+ //
+ public CompilerOptions CompilerOptions {
+ get {
+ return compilerOptions;
+ }
+ set {
+ compilerOptions = value;
+ }
+ }
+
+ public bool GenerateExecutables {
+ get {
+ return generateExecutables;
+ }
+ set {
+ generateExecutables = value;
+ }
+ }
+
+ public bool GenerateInMemory {
+ get {
+ return generateInMemory;
+ }
+ set {
+ generateInMemory = value;
+ }
+ }
+
+ public bool IncludeDebugInformation {
+ get {
+ return includeDebugInformation;
+ }
+ set {
+ includeDebugInformation = value;
+ }
+ }
+
+ public string MainClass {
+ get {
+ return mainClass;
+ }
+ set {
+ mainClass = value;
+ }
+ }
+
+ public string OutputAssembly {
+ get {
+ return outputAssembly;
+ }
+ set {
+ outputAssembly = value;
+ }
+ }
+
+ public StringCollection ReferencedAssemblies {
+ get {
+ return referencedAssemblies;
+ }
+ set {
+ referencedAssemblies = value;
+ }
+ }
+
+ public TempFileCollection TempFiles {
+ get {
+ return tempFiles;
+ }
+ set {
+ tempFiles = value;
+ }
+ }
+
+ public bool TreatWarningsAsErrors {
+ get {
+ return treatWarningsAsErrors;
+ }
+ set {
+ treatWarningsAsErrors = value;
+ }
+ }
+
+ public IntPtr UserToken {
+ get {
+ return userToken;
+ }
+ set {
+ userToken = value;
+ }
+ }
+
+ public int WarningLevel {
+ get {
+ return warningLevel;
+ }
+ set {
+ warningLevel = value;
+ }
+ }
+
+ public string Win32Resources {
+ get {
+ return win32Resources;
+ }
+ set {
+ win32Resources = value;
+ }
+ }
+ }
+};
diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerResults.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerResults.cs
new file mode 100644
index 00000000000..ee1719cd053
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CompilerResults.cs
@@ -0,0 +1,87 @@
+//
+// System.CodeDom.Compiler CompilerResults Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ using System.Reflection;
+ using System.Collections.Specialized;
+
+ public class CompilerResults
+ {
+ private Assembly compiledAssembly;
+ private CompilerErrorCollection errors;
+ private int nativeCompilerReturnValue;
+ private StringCollection output;
+ private string pathToAssembly;
+ private TempFileCollection tempFiles;
+
+ //
+ // Constructors
+ //
+ public CompilerResults( TempFileCollection tempFiles )
+ {
+ this.tempFiles = tempFiles;
+ }
+
+ //
+ // Properties
+ //
+ public Assembly CompiledAssembly {
+ get {
+ return compiledAssembly;
+ }
+ set {
+ compiledAssembly = value;
+ }
+ }
+
+ public CompilerErrorCollection Errors {
+ get {
+ if ( errors == null )
+ errors = new CompilerErrorCollection();
+ return errors;
+ }
+ }
+
+ public int NativeCompilerReturnValue {
+ get {
+ return nativeCompilerReturnValue;
+ }
+ set {
+ nativeCompilerReturnValue = value;
+ }
+ }
+
+ public StringCollection Output {
+ get {
+ if ( output == null )
+ output = new StringCollection();
+ return output;
+ }
+ }
+
+ public string PathToAssembly {
+ get {
+ return pathToAssembly;
+ }
+ set {
+ pathToAssembly = value;
+ }
+ }
+
+ public TempFileCollection TempFiles {
+ get {
+ return tempFiles;
+ }
+ set {
+ tempFiles = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/GeneratorSupport.cs b/mcs/class/System/System.CodeDom.Compiler/GeneratorSupport.cs
new file mode 100644
index 00000000000..354c97d5dbf
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/GeneratorSupport.cs
@@ -0,0 +1,38 @@
+//
+// System.CodeDom.Compiler GeneratorSupport Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ [Flags]
+ [Serializable]
+ public enum GeneratorSupport {
+ ArraysOfArrays = 1,
+ EntryPointMethod = 1 << 1,
+ GotoStatements = 1 << 2,
+ MultidimensionalArrays = 1 << 3,
+ StaticConstructors = 1 << 4,
+ TryCatchStatements = 1 << 5,
+ ReturnTypeAttributes = 1 << 6,
+ DeclareValueTypes = 1 << 7,
+ DeclareEnums = 1 << 8,
+ DeclareDelegates = 1 << 9,
+ DeclareInterfaces = 1 << 10,
+ DeclareEvents = 1 << 11,
+ AssemblyAttributes = 1 << 12,
+ ParameterAttributes = 1 << 13,
+ ReferenceParameters = 1 << 14,
+ ChainedConstructorArguments = 1 << 15,
+ NestedTypes = 1 << 16,
+ MultipleInterfaceMembers = 1 << 17,
+ PublicStaticMembers = 1 << 18,
+ ComplexExpressions = 1 << 19,
+ Win32Resources = 1 << 20
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/ICodeCompiler.cs b/mcs/class/System/System.CodeDom.Compiler/ICodeCompiler.cs
new file mode 100644
index 00000000000..2a6484b0928
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/ICodeCompiler.cs
@@ -0,0 +1,32 @@
+//
+// System.CodeDom.Compiler ICodeCompiler Interface
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ public interface ICodeCompiler
+ {
+ CompilerResults CompileAssemblyFromDom( CompilerParameters options,
+ CodeCompileUnit compilationUnit );
+
+ CompilerResults CompileAssemblyFromDomBatch( CompilerParameters options,
+ CodeCompileUnit[] batch );
+
+ CompilerResults CompileAssemblyFromFile( CompilerParameters options,
+ string fileName );
+
+ CompilerResults CompileAssemblyFromFileBatch( CompilerParameters options,
+ string[] batch );
+
+ CompilerResults CompileAssemblyFromSource( CompilerParameters options,
+ string source );
+
+ CompilerResults CompileAssemblyFromSourceBatch( CompilerParameters options,
+ string[] batch );
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs b/mcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs
new file mode 100755
index 00000000000..a853048d20d
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs
@@ -0,0 +1,53 @@
+//
+// System.CodeDom.Compiler ICodeGenerator Interface
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ using System.CodeDom;
+ using System.IO;
+
+ public interface ICodeGenerator
+ {
+ //
+ // Methods
+ //
+ string CreateEscapedIdentifier( string value );
+
+ string CreateValidIdentifier( string value );
+
+ void GenerateCodeFromCompileUnit( CodeCompileUnit compileUnit,
+ TextWriter output,
+ CodeGeneratorOptions options );
+
+ void GenerateCodeFromExpression( CodeExpression expression,
+ TextWriter output,
+ CodeGeneratorOptions options );
+
+ void GenerateCodeFromNamespace( CodeNamespace ns,
+ TextWriter output,
+ CodeGeneratorOptions options );
+
+ void GenerateCodeFromStatement( CodeStatement statement,
+ TextWriter output,
+ CodeGeneratorOptions options );
+
+ void GenerateCodeFromType( CodeTypeDeclaration typeDeclaration,
+ TextWriter output,
+ CodeGeneratorOptions options );
+
+ string GetTypeOutput( CodeTypeReference type );
+
+ bool IsValidIdentifier( string value );
+
+ bool Supports( GeneratorSupport supports );
+
+ void ValidateIdentifier( string value );
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/ICodeParser.cs b/mcs/class/System/System.CodeDom.Compiler/ICodeParser.cs
new file mode 100644
index 00000000000..2a2522f5ab2
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/ICodeParser.cs
@@ -0,0 +1,20 @@
+//
+// System.CodeDom.Compiler ICodeParser Interface
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ using System.CodeDom;
+ using System.IO;
+
+ public interface ICodeParser
+ {
+ CodeCompileUnit Parse( TextReader codeStream );
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/IndentedTextWriter.cs b/mcs/class/System/System.CodeDom.Compiler/IndentedTextWriter.cs
new file mode 100644
index 00000000000..ecdb8ced7ec
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/IndentedTextWriter.cs
@@ -0,0 +1,294 @@
+//
+// System.CodeDom.Compiler IndentedTextWriter class
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.IO;
+using System.Text;
+
+namespace System.CodeDom.Compiler {
+
+ public class IndentedTextWriter
+ : TextWriter
+ {
+ private TextWriter writer;
+ private string tabString;
+ private int indent;
+ private bool newline;
+
+ //
+ // Constructors
+ //
+ public IndentedTextWriter( TextWriter writer )
+ {
+ this.writer = writer;
+ this.tabString = DefaultTabString;
+ newline = true;
+ }
+
+ public IndentedTextWriter( TextWriter writer, string tabString )
+ {
+ this.writer = writer;
+ this.tabString = tabString;
+ newline = true;
+ }
+
+
+ //
+ // Fields
+ //
+ public const string DefaultTabString = " ";
+
+ //
+ // Properties
+ //
+ public override Encoding Encoding {
+ get {
+ return writer.Encoding;
+ }
+ }
+
+ public int Indent {
+ get {
+ return indent;
+ }
+ set {
+ indent = value;
+ }
+ }
+
+ public TextWriter InnerWriter {
+ get {
+ return writer;
+ }
+ }
+
+ public override string NewLine {
+ get {
+ return writer.NewLine;
+ }
+ set {
+ writer.NewLine = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public override void Close()
+ {
+ writer.Close();
+ }
+
+ public override void Flush()
+ {
+ writer.Flush();
+ }
+
+ public override void Write( bool value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( char value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( char[] value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( double value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( int value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( long value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( object value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( float value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( string value )
+ {
+ OutputTabs();
+ writer.Write( value );
+ }
+
+ public override void Write( string format, object arg )
+ {
+ OutputTabs();
+ writer.Write( format, arg );
+ }
+
+ public override void Write( string format, params object[] args )
+ {
+ OutputTabs();
+ writer.Write( format, args );
+ }
+
+ public override void Write( char[] buffer, int index, int count )
+ {
+ OutputTabs();
+ writer.Write( buffer, index, count );
+ }
+
+ public override void Write( string format, object arg0, object arg1 )
+ {
+ OutputTabs();
+ writer.Write( format, arg0, arg1 );
+ }
+
+
+ public override void WriteLine()
+ {
+ OutputTabs();
+ writer.WriteLine();
+ newline = true;
+ }
+
+ public override void WriteLine( bool value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( char value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( char[] value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( double value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( int value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( long value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( object value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( float value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( string value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ [CLSCompliant(false)]
+ public override void WriteLine( uint value )
+ {
+ OutputTabs();
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+ public override void WriteLine( string format, object arg )
+ {
+ OutputTabs();
+ writer.WriteLine( format, arg );
+ newline = true;
+ }
+
+ public override void WriteLine( string format, params object[] args )
+ {
+ OutputTabs();
+ writer.WriteLine( format, args );
+ newline = true;
+ }
+
+ public override void WriteLine( char[] buffer, int index, int count )
+ {
+ OutputTabs();
+ writer.WriteLine( buffer, index, count );
+ newline = true;
+ }
+
+ public override void WriteLine( string format, object arg0, object arg1 )
+ {
+ OutputTabs();
+ writer.WriteLine( format, arg0, arg1 );
+ newline = true;
+ }
+
+
+ public void WriteLineNoTabs( string value )
+ {
+ writer.WriteLine( value );
+ newline = true;
+ }
+
+
+ protected virtual void OutputTabs()
+ {
+ if ( newline ) {
+ for ( int i = 0; i < indent; ++i )
+ writer.Write( tabString );
+ newline = false;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/LanguageOptions.cs b/mcs/class/System/System.CodeDom.Compiler/LanguageOptions.cs
new file mode 100644
index 00000000000..7862a656554
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/LanguageOptions.cs
@@ -0,0 +1,18 @@
+//
+// System.CodeDom.Compiler LanguageOptions Enum implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ [Flags]
+ [Serializable]
+ public enum LanguageOptions {
+ None = 0,
+ CaseInsensitive = 1
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs b/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs
new file mode 100644
index 00000000000..6f82830bf90
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs
@@ -0,0 +1,16 @@
+//
+// System.CodeDom.Compiler TempFileCollection Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler
+{
+ public class TempFileCollection
+ {
+ // FIXME
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/ChangeLog b/mcs/class/System/System.CodeDom/ChangeLog
new file mode 100644
index 00000000000..5349e5c52b5
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/ChangeLog
@@ -0,0 +1,243 @@
+2002-10-11 Ravi Pratap <ravi@ximian.com>
+
+ * CodeMethodInvokeExpression.cs : Fix second constructor so that
+ the last argument is params - that is what the docs say.
+
+2002-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CodeBinaryOperatorType.cs:
+ * CodeMemberEvent.cs:
+ * CodeParameterDeclarationExpression.cs:
+ * CodeTypeMember.cs:
+ * CodeTypeReference.cs:
+ * CodeTypeReferenceCollection.cs: misc. fixes
+
+2002-05-28 Daniel Stodden <stodden@in.tum.de>
+
+ * CodeArrayCreateExpression.cs: typo + comments
+
+ * CodeAttributeArgumentCollection.cs: Add() signature fixed
+
+ * CodeAttributeDeclarationCollection.cs: Add() signature fixed
+
+ * CodeCatchClause.cs: ctor signature fixed
+
+ * CodeCatchClauseCollection.cs: Add() signature fixed
+
+ * CodeCommentStatementCollection.cs: Add() signature fixed
+
+ * CodeConstructor.cs: ctor added
+
+ * CodeExpressionCollection.cs: Populate* events: nullref checks
+ added
+
+ * CodeNamespace.cs: Populate* events: nullref checks added
+
+ * CodeNamespaceCollection.cs: Add() signature fixed
+
+ * CodeParameterDeclarationExpressionCollection.cs: Add() signature
+ fixed
+
+ * CodeStatementCollection.cs: Add() signature fixed, missing
+ overload added
+
+ * CodeTypeConstructor.cs: class name typo :P
+
+ * CodeTypeDeclaration.cs: finally figured out how TypeAttributes
+ work.
+
+ * CodeTypeDeclarationCollection.cs: Add() signature fixed
+
+ * CodeTypeReference.cs: added MonoTODOs. some corrections on array
+ type behavior.
+
+ * CodeTypeReferenceCollection.cs: Add() signature fixed
+
+ * MemberAttributes.cs: just comments
+
+2002-05-11 Daniel Stodden <stodden@in.tum.de>
+
+ * CodeAttributeArgumentCollection.cs: inherits CollectionBase
+
+ * CodeAttributeDeclarationCollection.cs: inherits CollectionBase
+
+ * CodeCatchClauseCollection.cs: inherits CollectionBase
+
+ * CodeExpressionCollection.cs: inherits CollectionBase
+
+ * CodeNamespaceImportCollection.cs: not CollectionBase, but
+ matching MS docs
+
+ * CodeParameterDeclarationCollection.cs: inherits CollectionBase
+
+ * CodeStatementCollection.cs: inherits CollectionBase
+
+ * CodeArrayCreateExpression.cs: corrections, completions, whatever
+
+ * CodeAssignStatement.cs: corrections, completions, whatever
+
+ * CodeAttachEventStatement.cs: corrections, completions, whatever
+
+ * CodeAttributeArgument.cs: corrections, completions, whatever
+
+ * CodeAttributeDeclaration.cs: corrections, completions, whatever
+
+ * CodeBaseReferenceExpression.cs: corrections, completions,
+ whatever
+
+ * CodeBinaryOperatorExpression.cs: corrections, completions,
+ whatever
+
+ * CodeCastExpression.cs: corrections, completions, whatever
+
+ * CodeCatchClause.cs: corrections, completions, whatever
+
+ * CodeCommentStatement.cs: corrections, completions, whatever
+
+ * CodeConstructor.cs: corrections, completions, whatever
+
+ * CodeDelegateCreateExpression.cs: corrections, completions,
+ whatever
+
+ * CodeDelegateInvokeExpression.cs: corrections, completions,
+ whatever
+
+ * CodeExpression.cs: corrections, completions, whatever
+
+ * CodeFieldReferenceExpression.cs: corrections, completions,
+ whatever
+
+ * CodeIndexerExpression.cs: corrections, completions, whatever
+
+ * CodeLinePragma.cs: corrections, completions, whatever
+
+ * CodeMemberEvent.cs: corrections, completions, whatever
+
+ * CodeMemberField.cs: corrections, completions, whatever
+
+ * CodeMemberMethod.cs: corrections, completions, whatever
+
+ * CodeMemberProperty.cs: corrections, completions, whatever
+
+ * CodeMethodInvokeExpression.cs: corrections, completions,
+ whatever
+
+ * CodeMethodReturnStatement.cs: corrections, completions, whatever
+
+ * CodeNamespace.cs: corrections, completions, whatever
+
+ * CodeNamespaceImport.cs: corrections, completions, whatever
+
+ * CodeObject.cs: corrections, completions, whatever
+
+ * CodeObjectCreateExpression.cs: corrections, completions,
+ whatever
+
+ * CodeParameterDeclarationExpression.cs: corrections, completions,
+ whatever
+
+ * CodePrimitiveExpression.cs: corrections, completions, whatever
+
+ * CodePropertyReferenceExpression.cs: corrections, completions,
+ whatever
+
+ * CodeStatement.cs: corrections, completions, whatever
+
+ * CodeThisReferenceExpression.cs: corrections, completions,
+ whatever
+
+ * CodeThrowExceptionStatement.cs: corrections, completions,
+ whatever
+
+ * CodeTryCatchFinallyStatement.cs: corrections, completions,
+ whatever
+
+ * CodeTypeDeclaration.cs: corrections, completions, whatever
+
+ * CodeTypeMember.cs: corrections, completions, whatever
+
+ * CodeTypeOfExpression.cs: corrections, completions, whatever
+
+ * CodeTypeReferenceExpression.cs: corrections, completions,
+ whatever
+
+ * CodeVariableDeclarationStatement.cs: corrections, completions,
+ whatever
+
+ * FieldDirection.cs: corrections, completions, whatever
+
+ * CodeArgumentReferenceExpression.cs: added
+
+ * CodeArrayIndexerExpression.cs: added
+
+ * CodeComment.cs: added
+
+ * CodeCommentStatementCollection.cs: added
+
+ * CodeCompileUnit.cs: added
+
+ * CodeConditionStatement.cs: added
+
+ * CodeDirectionExpression.cs: added
+
+ * CodeEntryPointMethod.cs: added
+
+ * CodeEventReferenceExpression.cs: added
+
+ * CodeExpressionStatement.cs: added
+
+ * CodeGotoStatement.cs: added
+
+ * CodeIterationStatement.cs: added
+
+ * CodeLabeledStatement.cs: added
+
+ * CodeMethodReferenceExpression.cs: added
+
+ * CodeNamespaceCollection.cs: added
+
+ * CodePropertySetValueReferenceExpression.cs: added
+
+ * CodeRemoveEventStatement.cs: added
+
+ * CodeSnippetCompileUnit.cs: added
+
+ * CodeSnippetExpression.cs: added
+
+ * CodeSnippetStatement.cs: added
+
+ * CodeSnippetTypeMember.cs: added
+
+ * CodeTypeConstructor.cs: added
+
+ * CodeTypeDeclarationCollection.cs: added
+
+ * CodeTypeDelegate.cs: added
+
+ * CodeTypeMemberCollection.cs: added
+
+ * CodeTypeReference.cs: added
+
+ * CodeTypeReferenceCollection.cs: added
+
+ * CodeVariableReferenceExpression.cs: added
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * MemberAttributes.cs: Added so rest of classes would compile.
+
+ * FieldDirection.cs: Added so rest of classes would compile.
+
+ * CodeTypeMember.cs: Added so rest of classes would compile.
+
+ * CodeTypeDeclaration.cs: Added so rest of classes would compile.
+
+ * CodeObject.cs: Added so rest of classes would compile.
+
+ * CodeBinaryOperatorType.cs: Added so rest of classes would compile.
+
+2001-07-12 Sean MacIsaac <macisaac@ximian.com>
+
+ * All files implementing IList: Added IsFixedSize property.
+
+ * All files: Changed CodeDOM to CodeDom.
diff --git a/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
new file mode 100644
index 00000000000..5f842f3f302
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeArgumentReferenceExpression Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeArgumentReferenceExpression
+ : CodeExpression
+ {
+ private string parameterName;
+
+ //
+ // Constructors
+ //
+ public CodeArgumentReferenceExpression()
+ {
+ }
+
+ public CodeArgumentReferenceExpression( string name )
+ {
+ this.parameterName = name;
+ }
+
+ //
+ // Properties
+ //
+ public string ParameterName {
+ get {
+ return parameterName;
+ }
+ set {
+ parameterName = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
new file mode 100755
index 00000000000..e7bded6024d
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
@@ -0,0 +1,145 @@
+//
+// System.CodeDom CodeArrayCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeArrayCreateExpression
+ : CodeExpression
+ {
+ private CodeTypeReference createType;
+ private CodeExpressionCollection initializers;
+ private CodeExpression sizeExpression;
+ private int size;
+
+ //
+ // Constructors
+ //
+ public CodeArrayCreateExpression ()
+ {
+ }
+
+
+ public CodeArrayCreateExpression (CodeTypeReference createType,
+ CodeExpression size )
+ {
+ this.createType = createType;
+ this.sizeExpression = size;
+ }
+
+ public CodeArrayCreateExpression (CodeTypeReference createType,
+ params CodeExpression[] initializers )
+ {
+ this.createType = createType;
+ this.Initializers.AddRange( initializers );
+ }
+
+ public CodeArrayCreateExpression (CodeTypeReference createType,
+ int size)
+ {
+ this.createType = createType;
+ this.size = size;
+ }
+
+
+ public CodeArrayCreateExpression (string createType,
+ CodeExpression size)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.sizeExpression = size;
+ }
+
+ public CodeArrayCreateExpression (string createType,
+ params CodeExpression[] initializers)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.Initializers.AddRange( initializers );
+ }
+
+ public CodeArrayCreateExpression (string createType,
+ int size)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.size = size;
+ }
+
+
+ public CodeArrayCreateExpression (Type createType,
+ CodeExpression size)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.sizeExpression = size;
+ }
+
+ public CodeArrayCreateExpression (Type createType,
+ params CodeExpression[] initializers)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.Initializers.AddRange( initializers );
+ }
+
+ public CodeArrayCreateExpression (Type createType,
+ int size)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.size = size;
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReference CreateType {
+ get {
+ return createType;
+ }
+ set {
+ createType = value;
+ }
+ }
+
+ public CodeExpressionCollection Initializers {
+ get {
+ if ( initializers == null )
+ initializers = new CodeExpressionCollection();
+
+ return initializers;
+ }
+ }
+
+ public CodeExpression SizeExpression {
+ get {
+ return sizeExpression;
+ }
+ set {
+ sizeExpression = value;
+ }
+ }
+
+ public int Size {
+ get {
+ return size;
+ }
+ set {
+ size = value;
+ // NOTE: Setting Size in ms.Net does
+ // not supersede SizeExpression
+ // values. Instead, the CodeGenerator
+ // seems to always prefer
+ // SizeExpression if set to a value !=
+ // null.
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs b/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
new file mode 100644
index 00000000000..8851f3cf016
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
@@ -0,0 +1,56 @@
+//
+// System.CodeDom CodeArrayIndexerExpression Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeArrayIndexerExpression
+ : CodeExpression
+ {
+ private CodeExpressionCollection indices;
+ private CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeArrayIndexerExpression()
+ {
+ }
+
+ public CodeArrayIndexerExpression( CodeExpression targetObject, params CodeExpression[] indices )
+ {
+ this.targetObject = targetObject;
+ this.Indices.AddRange( indices );
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpressionCollection Indices {
+ get {
+ if ( indices == null )
+ indices = new CodeExpressionCollection();
+ return indices;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAssignStatement.cs b/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
new file mode 100755
index 00000000000..54f55af8d7e
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
@@ -0,0 +1,55 @@
+//
+// System.CodeDom CodeArrayCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeAssignStatement
+ : CodeStatement
+ {
+ CodeExpression left, right;
+
+ //
+ // Constructors
+ //
+ public CodeAssignStatement ()
+ {
+ }
+
+ public CodeAssignStatement (CodeExpression left, CodeExpression right)
+ {
+ this.left = left;
+ this.right = right;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Left {
+ get {
+ return left;
+ }
+ set {
+ left = value;
+ }
+ }
+
+ public CodeExpression Right {
+ get {
+ return right;
+ }
+ set {
+ right = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs b/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
new file mode 100755
index 00000000000..093445711ab
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
@@ -0,0 +1,68 @@
+//
+// System.CodeDom CodeAttachEventStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeAttachEventStatement
+ : CodeStatement
+ {
+ private CodeEventReferenceExpression eventRef;
+ private CodeExpression listener;
+
+ //
+ // Constructors
+ //
+ public CodeAttachEventStatement ()
+ {
+ }
+
+ public CodeAttachEventStatement (CodeEventReferenceExpression eventRef,
+ CodeExpression listener)
+ {
+ this.eventRef = eventRef;
+ this.listener = listener;
+ }
+
+ public CodeAttachEventStatement (CodeExpression targetObject,
+ string eventName,
+ CodeExpression listener)
+ {
+ this.eventRef = new CodeEventReferenceExpression( targetObject,
+ eventName );
+ this.listener = listener;
+ }
+
+ //
+ // Properties
+ //
+ public CodeEventReferenceExpression Event {
+ get {
+ return eventRef;
+ }
+ set {
+ eventRef = value;
+ }
+ }
+
+ public CodeExpression Listener {
+ get {
+ return listener;
+ }
+ set {
+ listener = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeArgument.cs b/mcs/class/System/System.CodeDom/CodeAttributeArgument.cs
new file mode 100755
index 00000000000..c7b6d577776
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeArgument.cs
@@ -0,0 +1,61 @@
+//
+// System.CodeDom CodeAttributeArgument Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeAttributeArgument
+ {
+ private string name;
+ private CodeExpression value;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeArgument ()
+ {
+ }
+
+ public CodeAttributeArgument (CodeExpression value)
+ {
+ this.value = value;
+ }
+
+ public CodeAttributeArgument (string name, CodeExpression value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ //
+ // Properties
+ //
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ public CodeExpression Value {
+ get {
+ return this.value;
+ }
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs b/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs
new file mode 100755
index 00000000000..cca43373ae7
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs
@@ -0,0 +1,100 @@
+//
+// System.CodeDom CodeAttributeArgumentCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeAttributeArgumentCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeAttributeArgumentCollection()
+ {
+ }
+
+ public CodeAttributeArgumentCollection( CodeAttributeArgument[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeAttributeArgumentCollection( CodeAttributeArgumentCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeAttributeArgument this[int index]
+ {
+ get {
+ return (CodeAttributeArgument)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeAttributeArgument value)
+ {
+ return List.Add( value );
+ }
+
+ public void AddRange (CodeAttributeArgument [] value )
+ {
+ foreach ( CodeAttributeArgument elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeAttributeArgumentCollection value)
+ {
+ foreach ( CodeAttributeArgument elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeAttributeArgument value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeAttributeArgument[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeAttributeArgument value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeAttributeArgument value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeAttributeArgument value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
new file mode 100755
index 00000000000..49d0c8d7ca3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
@@ -0,0 +1,63 @@
+//
+// System.CodeDom CodeAttributeDeclaration Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeAttributeDeclaration
+ {
+ private string name;
+ private CodeAttributeArgumentCollection arguments;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeDeclaration ()
+ {
+ }
+
+ public CodeAttributeDeclaration (string name)
+ {
+ this.name = name;
+ }
+
+ public CodeAttributeDeclaration (string name, CodeAttributeArgument [] arguments)
+ {
+ this.name = name;
+ Arguments.AddRange (arguments);
+ }
+
+ //
+ // Properties
+ //
+ public CodeAttributeArgumentCollection Arguments {
+ get {
+ if ( arguments == null )
+ arguments = new CodeAttributeArgumentCollection();
+
+ return arguments;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs b/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs
new file mode 100755
index 00000000000..913641e6ebc
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs
@@ -0,0 +1,100 @@
+//
+// System.CodeDom CodeAttributeDeclarationCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeAttributeDeclarationCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeAttributeDeclarationCollection()
+ {
+ }
+
+ public CodeAttributeDeclarationCollection( CodeAttributeDeclaration[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeAttributeDeclarationCollection( CodeAttributeDeclarationCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeAttributeDeclaration this[int index]
+ {
+ get {
+ return (CodeAttributeDeclaration)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeAttributeDeclaration value)
+ {
+ return List.Add (value);
+ }
+
+ public void AddRange (CodeAttributeDeclaration [] value)
+ {
+ foreach (CodeAttributeDeclaration elem in value)
+ Add( elem );
+ }
+
+ public void AddRange (CodeAttributeDeclarationCollection value)
+ {
+ foreach (CodeAttributeDeclaration elem in value)
+ Add( elem );
+ }
+
+ public bool Contains( CodeAttributeDeclaration value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeAttributeDeclaration[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeAttributeDeclaration value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeAttributeDeclaration value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeAttributeDeclaration value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
new file mode 100755
index 00000000000..3e4cbee16c8
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodeBaseReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeBaseReferenceExpression
+ : CodeExpression
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs b/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
new file mode 100755
index 00000000000..b272e0e5c80
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
@@ -0,0 +1,69 @@
+//
+// System.CodeDom CodeBinaryOperatorExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeBinaryOperatorExpression
+ : CodeExpression
+ {
+ private CodeExpression left, right;
+ private CodeBinaryOperatorType op;
+
+ //
+ // Constructors
+ //
+ public CodeBinaryOperatorExpression ()
+ {
+ }
+
+ public CodeBinaryOperatorExpression (CodeExpression left,
+ CodeBinaryOperatorType op,
+ CodeExpression right)
+ {
+ this.left = left;
+ this.op = op;
+ this.right = right;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Left {
+ get {
+ return left;
+ }
+ set {
+ left = value;
+ }
+ }
+
+ public CodeBinaryOperatorType Operator {
+ get {
+ return op;
+ }
+ set {
+ op = value;
+ }
+ }
+
+ public CodeExpression Right {
+ get {
+ return right;
+ }
+ set {
+ right = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs b/mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs
new file mode 100755
index 00000000000..98a14665a7c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs
@@ -0,0 +1,35 @@
+//
+// System.CodeDom CodeBinaryOperatorType Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ComVisible(true)]
+ public enum CodeBinaryOperatorType {
+ Add = 0,
+ Subtract = 1,
+ Multiply = 2,
+ Divide = 3,
+ Modulus = 4,
+ Assign = 5,
+ IdentityInequality = 6,
+ IdentityEquality = 7,
+ ValueEquality = 8,
+ BitwiseOr = 9,
+ BitwiseAnd = 10,
+ BooleanOr = 11,
+ BooleanAnd = 12,
+ LessThan = 13,
+ LessThanOrEqual = 14,
+ GreaterThan = 15,
+ GreaterThanOrEqual = 16
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCastExpression.cs b/mcs/class/System/System.CodeDom/CodeCastExpression.cs
new file mode 100755
index 00000000000..90ee10aa2f0
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCastExpression.cs
@@ -0,0 +1,71 @@
+//
+// System.CodeDom CodeCastExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeCastExpression
+ : CodeExpression
+ {
+ private CodeTypeReference targetType;
+ private CodeExpression expression;
+
+ //
+ // Constructors
+ //
+ public CodeCastExpression ()
+ {
+ }
+
+ public CodeCastExpression (CodeTypeReference targetType, CodeExpression expression)
+ {
+ this.targetType = targetType;
+ this.expression = expression;
+ }
+
+ public CodeCastExpression (string targetType, CodeExpression expression)
+ {
+ this.targetType = new CodeTypeReference( targetType );
+ this.expression = expression;
+ }
+
+ public CodeCastExpression (Type targetType, CodeExpression expression)
+ {
+ this.targetType = new CodeTypeReference( targetType );
+ this.expression = expression;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Expression {
+ get {
+ return expression;
+ }
+
+ set {
+ expression = value;
+ }
+ }
+
+ public CodeTypeReference TargetType {
+ get {
+ return targetType;
+ }
+ set {
+ targetType = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCatchClause.cs b/mcs/class/System/System.CodeDom/CodeCatchClause.cs
new file mode 100755
index 00000000000..2d5addf592e
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCatchClause.cs
@@ -0,0 +1,81 @@
+//
+// System.CodeDom CodeCatchClaus Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeCatchClause
+ {
+ private CodeTypeReference catchExceptionType;
+ private string localName;
+ private CodeStatementCollection statements;
+
+ //
+ // Constructors
+ //
+ public CodeCatchClause ()
+ {
+ }
+
+ public CodeCatchClause ( string localName )
+ {
+ this.localName = localName;
+ }
+
+ public CodeCatchClause ( string localName,
+ CodeTypeReference catchExceptionType )
+ {
+ this.localName = localName;
+ this.catchExceptionType = catchExceptionType;
+ }
+
+ public CodeCatchClause ( string localName,
+ CodeTypeReference catchExceptionType,
+ params CodeStatement[] statements )
+ {
+ this.localName = localName;
+ this.catchExceptionType = catchExceptionType;
+ this.Statements.AddRange( statements );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReference CatchExceptionType {
+ get {
+ return catchExceptionType;
+ }
+ set {
+ catchExceptionType = value;
+ }
+ }
+
+ public string LocalName {
+ get {
+ return localName;
+ }
+ set {
+ localName = value;
+ }
+ }
+
+ public CodeStatementCollection Statements {
+ get {
+ if ( statements == null )
+ statements = new CodeStatementCollection();
+ return statements;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs b/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs
new file mode 100755
index 00000000000..5cffe97c99f
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs
@@ -0,0 +1,98 @@
+//
+// System.CodeDom CodeCatchClauseCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeCatchClauseCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeCatchClauseCollection()
+ {
+ }
+
+ public CodeCatchClauseCollection( CodeCatchClause[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeCatchClauseCollection( CodeCatchClauseCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeCatchClause this[int index] {
+ get {
+ return (CodeCatchClause)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeCatchClause value)
+ {
+ return List.Add (value);
+ }
+
+ public void AddRange (CodeCatchClause [] value)
+ {
+ foreach (CodeCatchClause ca in value)
+ Add (ca);
+ }
+
+ public void AddRange (CodeCatchClauseCollection value )
+ {
+ foreach (CodeCatchClause ca in value)
+ Add (ca);
+ }
+
+ public bool Contains( CodeCatchClause value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeCatchClause[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeCatchClause value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeCatchClause value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeCatchClause value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeComment.cs b/mcs/class/System/System.CodeDom/CodeComment.cs
new file mode 100644
index 00000000000..8f761110ee8
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeComment.cs
@@ -0,0 +1,62 @@
+//
+// System.CodeDom CodeComment Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeComment
+ : CodeObject
+ {
+ private bool docComment;
+ private string text;
+
+ //
+ // Constructors
+ //
+ public CodeComment()
+ {
+ }
+
+ public CodeComment( string text )
+ {
+ this.text = text;
+ }
+
+ public CodeComment( string text, bool docComment )
+ {
+ this.text = text;
+ this.docComment = docComment;
+ }
+
+ //
+ // Properties
+ //
+ public bool DocComment {
+ get {
+ return docComment;
+ }
+ set {
+ docComment = value;
+ }
+ }
+
+ public string Text {
+ get {
+ return text;
+ }
+ set {
+ text = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCommentStatement.cs b/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
new file mode 100755
index 00000000000..0b52d080afd
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
@@ -0,0 +1,57 @@
+//
+// System.CodeDom CodeCommentStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001, 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeCommentStatement
+ : CodeStatement
+ {
+ private CodeComment comment;
+
+ //
+ // Constructors
+ //
+ public CodeCommentStatement ()
+ {
+ }
+
+ public CodeCommentStatement (CodeComment comment)
+ {
+ this.comment = comment;
+ }
+
+ public CodeCommentStatement (string text)
+ {
+ this.comment = new CodeComment( text );
+ }
+
+ public CodeCommentStatement (string text, bool docComment)
+ {
+ this.comment = new CodeComment( text, docComment );
+ }
+
+ //
+ // Properties
+ //
+ public CodeComment Comment {
+ get {
+ return comment;
+ }
+ set {
+ comment = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs b/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs
new file mode 100644
index 00000000000..10372cc686b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs
@@ -0,0 +1,100 @@
+//
+// System.CodeDom CodeCommentStatementCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeCommentStatementCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeCommentStatementCollection()
+ {
+ }
+
+ public CodeCommentStatementCollection( CodeCommentStatement[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeCommentStatementCollection( CodeCommentStatementCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeCommentStatement this[int index]
+ {
+ get {
+ return (CodeCommentStatement)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeCommentStatement value)
+ {
+ return List.Add( value );
+ }
+
+ public void AddRange (CodeCommentStatement [] value )
+ {
+ foreach ( CodeCommentStatement elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeCommentStatementCollection value)
+ {
+ foreach ( CodeCommentStatement elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeCommentStatement value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeCommentStatement[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeCommentStatement value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeCommentStatement value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeCommentStatement value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCompileUnit.cs b/mcs/class/System/System.CodeDom/CodeCompileUnit.cs
new file mode 100644
index 00000000000..e357f9bec1c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCompileUnit.cs
@@ -0,0 +1,60 @@
+//
+// System.CodeDom CodeCompileUnit Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections.Specialized;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeCompileUnit
+ : CodeObject
+ {
+ private CodeAttributeDeclarationCollection assemblyCustomAttributes;
+ private CodeNamespaceCollection namespaces;
+ private StringCollection referencedAssemblies;
+
+ //
+ // Constructors
+ //
+ public CodeCompileUnit()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public CodeAttributeDeclarationCollection AssemblyCustomAttributes {
+ get {
+ if ( assemblyCustomAttributes == null )
+ assemblyCustomAttributes =
+ new CodeAttributeDeclarationCollection();
+ return assemblyCustomAttributes;
+ }
+ }
+
+ public CodeNamespaceCollection Namespaces {
+ get {
+ if ( namespaces == null )
+ namespaces = new CodeNamespaceCollection();
+ return namespaces;
+ }
+ }
+
+ public StringCollection ReferencedAssemblies {
+ get {
+ if ( referencedAssemblies == null )
+ referencedAssemblies = new StringCollection();
+ return referencedAssemblies;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeConditionStatement.cs b/mcs/class/System/System.CodeDom/CodeConditionStatement.cs
new file mode 100644
index 00000000000..fb04c884371
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeConditionStatement.cs
@@ -0,0 +1,77 @@
+//
+// System.CodeDom CodeConditionStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeConditionStatement
+ : CodeStatement
+ {
+ private CodeExpression condition;
+ private CodeStatementCollection trueStatements;
+ private CodeStatementCollection falseStatements;
+
+ //
+ // Constructors
+ //
+ public CodeConditionStatement()
+ {
+ }
+
+ public CodeConditionStatement( CodeExpression condition,
+ params CodeStatement[] trueStatements )
+ {
+ this.condition = condition;
+ this.TrueStatements.AddRange( trueStatements );
+ }
+
+ public CodeConditionStatement( CodeExpression condition,
+ CodeStatement[] trueStatements,
+ CodeStatement[] falseStatements )
+ {
+ this.condition = condition;
+ this.TrueStatements.AddRange( trueStatements );
+ this.FalseStatements.AddRange( falseStatements );
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value;
+ }
+ }
+
+ public CodeStatementCollection FalseStatements {
+ get {
+ if ( falseStatements == null )
+ falseStatements =
+ new CodeStatementCollection();
+ return falseStatements;
+ }
+ }
+
+ public CodeStatementCollection TrueStatements {
+ get {
+ if ( trueStatements == null )
+ trueStatements =
+ new CodeStatementCollection();
+ return trueStatements;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeConstructor.cs b/mcs/class/System/System.CodeDom/CodeConstructor.cs
new file mode 100755
index 00000000000..bbf99879bb4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeConstructor.cs
@@ -0,0 +1,52 @@
+//
+// System.CodeDom CodeConstructor Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeConstructor
+ : CodeMemberMethod
+ {
+ private CodeExpressionCollection baseConstructorArgs;
+ private CodeExpressionCollection chainedConstructorArgs;
+
+ //
+ // Constructors
+ //
+ public CodeConstructor()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpressionCollection BaseConstructorArgs {
+ get {
+ if ( baseConstructorArgs == null )
+ baseConstructorArgs = new CodeExpressionCollection();
+
+ return baseConstructorArgs;
+ }
+ }
+
+ public CodeExpressionCollection ChainedConstructorArgs {
+ get {
+ if ( chainedConstructorArgs == null )
+ chainedConstructorArgs = new CodeExpressionCollection();
+
+ return chainedConstructorArgs;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
new file mode 100755
index 00000000000..04d1065b8e3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
@@ -0,0 +1,72 @@
+//
+// System.CodeDom CodeDelegateCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeDelegateCreateExpression
+ : CodeExpression
+ {
+ private CodeTypeReference delegateType;
+ private string methodName;
+ private CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeDelegateCreateExpression ()
+ {
+ }
+
+ public CodeDelegateCreateExpression (CodeTypeReference delegateType,
+ CodeExpression targetObject,
+ string methodName)
+ {
+ this.delegateType = delegateType;
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ }
+
+
+ //
+ // Properties
+ //
+ public CodeTypeReference DelegateType {
+ get {
+ return delegateType;
+ }
+ set {
+ delegateType = value;
+ }
+ }
+
+ public string MethodName {
+ get {
+ return methodName;
+ }
+ set {
+ methodName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs b/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
new file mode 100755
index 00000000000..84fa6a69669
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
@@ -0,0 +1,64 @@
+//
+// System.CodeDom CodeDelegateInvokeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeDelegateInvokeExpression
+ : CodeExpression
+ {
+ private CodeExpressionCollection parameters;
+ private CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeDelegateInvokeExpression ()
+ {
+ }
+
+ public CodeDelegateInvokeExpression (CodeExpression targetObject)
+ {
+ this.targetObject = targetObject;
+ }
+
+ public CodeDelegateInvokeExpression (CodeExpression targetObject,
+ CodeExpression [] parameters)
+ {
+ this.targetObject = targetObject;
+ this.Parameters.AddRange( parameters );
+ }
+
+
+ //
+ // Properties
+ //
+ public CodeExpressionCollection Parameters {
+ get {
+ if ( parameters == null )
+ parameters = new CodeExpressionCollection();
+ return parameters;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs b/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
new file mode 100644
index 00000000000..da6b96147af
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
@@ -0,0 +1,59 @@
+//
+// System.CodeDom FieldDirection Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeDirectionExpression
+ : CodeExpression
+ {
+ private FieldDirection direction;
+ private CodeExpression expression;
+
+ //
+ // Constructors
+ //
+ public CodeDirectionExpression()
+ {
+ }
+
+ public CodeDirectionExpression( FieldDirection direction,
+ CodeExpression expression )
+ {
+ this.direction = direction;
+ this.expression = expression;
+ }
+
+ //
+ // Properties
+ //
+ public FieldDirection Direction {
+ get {
+ return direction;
+ }
+ set {
+ direction = value;
+ }
+ }
+
+ public CodeExpression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs b/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
new file mode 100644
index 00000000000..ffc6a198dff
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodeEntryPointMethod Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeEntryPointMethod
+ : CodeMemberMethod
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
new file mode 100644
index 00000000000..cba9754a74b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
@@ -0,0 +1,57 @@
+//
+// System.CodeDom CodeEventReferenceExpression class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeEventReferenceExpression
+ : CodeExpression
+ {
+ private string eventName;
+ private CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeEventReferenceExpression()
+ {
+ }
+
+ public CodeEventReferenceExpression( CodeExpression targetObject, string EventName )
+ {
+ this.targetObject = targetObject;
+ this.eventName = eventName;
+ }
+
+ //
+ // Properties
+ //
+ public string EventName {
+ get {
+ return eventName;
+ }
+ set {
+ eventName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeExpression.cs b/mcs/class/System/System.CodeDom/CodeExpression.cs
new file mode 100755
index 00000000000..91d2f2f2839
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeExpression.cs
@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeExpression
+ : CodeObject
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs b/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs
new file mode 100755
index 00000000000..2ee42a1c9d8
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs
@@ -0,0 +1,100 @@
+//
+// System.CodeDom CodeExpressionCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeExpressionCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeExpressionCollection()
+ {
+ }
+
+ public CodeExpressionCollection( CodeExpression[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeExpressionCollection( CodeExpressionCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression this[int index]
+ {
+ get {
+ return (CodeExpression)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeExpression value)
+ {
+ return List.Add( value );
+ }
+
+ public void AddRange (CodeExpression [] value )
+ {
+ foreach ( CodeExpression elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeExpressionCollection value)
+ {
+ foreach ( CodeExpression elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeExpression value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeExpression[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeExpression value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeExpression value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeExpression value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs b/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
new file mode 100644
index 00000000000..d397290cf99
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeExpressionStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeExpressionStatement
+ : CodeStatement
+ {
+ private CodeExpression expression;
+
+ //
+ // Constructors
+ //
+ public CodeExpressionStatement()
+ {
+ }
+
+ public CodeExpressionStatement(CodeExpression expression)
+ {
+ Expression = expression;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
new file mode 100755
index 00000000000..04f0aca81ef
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
@@ -0,0 +1,59 @@
+//
+// System.CodeDom CodeFieldReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeFieldReferenceExpression
+ : CodeExpression
+ {
+ private CodeExpression targetObject;
+ private string fieldName;
+
+ //
+ // Constructors
+ //
+ public CodeFieldReferenceExpression ()
+ {
+ }
+
+ public CodeFieldReferenceExpression (CodeExpression targetObject,
+ string fieldName)
+ {
+ this.targetObject = targetObject;
+ this.fieldName = fieldName;
+ }
+
+ //
+ // Properties
+ //
+ public string FieldName {
+ get {
+ return fieldName;
+ }
+ set {
+ fieldName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeGotoStatement.cs b/mcs/class/System/System.CodeDom/CodeGotoStatement.cs
new file mode 100644
index 00000000000..283b8862443
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeGotoStatement.cs
@@ -0,0 +1,42 @@
+//
+// System.CodeDom CodeGotoStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeGotoStatement
+ : CodeStatement
+ {
+ private string label;
+
+ //
+ // Constructors
+ //
+ public CodeGotoStatement( string label )
+ {
+ Label = label;
+ }
+
+ //
+ // Properties
+ //
+ public string Label {
+ get {
+ return label;
+ }
+ set {
+ label = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs b/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
new file mode 100755
index 00000000000..958c2287c11
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
@@ -0,0 +1,58 @@
+//
+// System.CodeDom CodeFieldReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeIndexerExpression
+ : CodeExpression
+ {
+ private CodeExpression targetObject;
+ private CodeExpressionCollection indices;
+
+ //
+ // Constructors
+ //
+ public CodeIndexerExpression ()
+ {
+ }
+
+ public CodeIndexerExpression (CodeExpression targetObject, params CodeExpression[] indices)
+ {
+ this.targetObject = targetObject;
+ this.Indices.AddRange( indices );
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpressionCollection Indices {
+ get {
+ if ( indices == null )
+ indices = new CodeExpressionCollection();
+
+ return indices;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeIterationStatement.cs b/mcs/class/System/System.CodeDom/CodeIterationStatement.cs
new file mode 100644
index 00000000000..67b41da3b98
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeIterationStatement.cs
@@ -0,0 +1,81 @@
+//
+// System.CodeDom CodeIterationStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeIterationStatement
+ : CodeStatement
+ {
+ private CodeStatement incrementStatement;
+ private CodeStatement initStatement;
+ private CodeStatementCollection statements;
+ private CodeExpression testExpression;
+
+ //
+ // Constructors
+ //
+ public CodeIterationStatement()
+ {
+ }
+
+ public CodeIterationStatement( CodeStatement initStatement,
+ CodeExpression testExpression,
+ CodeStatement incrementStatement,
+ params CodeStatement[] statements )
+ {
+ this.initStatement = initStatement;
+ this.testExpression = testExpression;
+ this.incrementStatement = incrementStatement;
+ this.Statements.AddRange( statements );
+ }
+
+ //
+ // Properties
+ //
+ public CodeStatement IncrementStatement {
+ get {
+ return incrementStatement;
+ }
+ set {
+ incrementStatement = value;
+ }
+ }
+
+ public CodeStatement InitStatement {
+ get {
+ return initStatement;
+ }
+ set {
+ initStatement = value;
+ }
+ }
+
+ public CodeStatementCollection Statements {
+ get {
+ if ( statements == null )
+ statements = new CodeStatementCollection();
+ return statements;
+ }
+ }
+
+ public CodeExpression TestExpression {
+ get {
+ return testExpression;
+ }
+ set {
+ testExpression = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs b/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
new file mode 100644
index 00000000000..0e79e2a042b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
@@ -0,0 +1,62 @@
+//
+// System.CodeDom CodeLabeledStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeLabeledStatement
+ : CodeStatement
+ {
+ private string label;
+ private CodeStatement statement;
+
+ //
+ // Constructors
+ //
+ public CodeLabeledStatement()
+ {
+ }
+
+ public CodeLabeledStatement( string label )
+ {
+ this.label = label;
+ }
+
+ public CodeLabeledStatement( string label, CodeStatement statement )
+ {
+ this.label = label;
+ this.statement = statement;
+ }
+
+ //
+ // Properties
+ //
+ public string Label {
+ get {
+ return label;
+ }
+ set {
+ label = value;
+ }
+ }
+
+ public CodeStatement Statement {
+ get {
+ return statement;
+ }
+ set {
+ statement = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeLinePragma.cs b/mcs/class/System/System.CodeDom/CodeLinePragma.cs
new file mode 100755
index 00000000000..613961188b0
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLinePragma.cs
@@ -0,0 +1,56 @@
+//
+// System.CodeDom CodeLinePragma Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ // <summary>
+ // Use objects of this class to keep track of locations where
+ // statements are defined
+ // </summary>
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeLinePragma
+ {
+ private string fileName;
+ private int lineNumber;
+
+ //
+ // Constructors
+ //
+ public CodeLinePragma (string fileName, int lineNumber)
+ {
+ this.fileName = fileName;
+ this.lineNumber = lineNumber;
+ }
+
+ //
+ // Properties
+ //
+ public string FileName {
+ get {
+ return fileName;
+ }
+ set {
+ fileName = value;
+ }
+ }
+
+ public int LineNumber {
+ get {
+ return lineNumber;
+ }
+ set {
+ lineNumber = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberEvent.cs b/mcs/class/System/System.CodeDom/CodeMemberEvent.cs
new file mode 100755
index 00000000000..a5562443050
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberEvent.cs
@@ -0,0 +1,68 @@
+//
+// System.CodeDom CodeMemberEvent Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMemberEvent
+ : CodeTypeMember
+ {
+ private CodeTypeReferenceCollection implementationTypes;
+ private CodeTypeReference privateImplementationType;
+ private CodeTypeReference type;
+
+ //
+ // Constructors
+ //
+ public CodeMemberEvent ()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReferenceCollection ImplementationTypes
+ {
+ get {
+ if (implementationTypes == null)
+ implementationTypes = new CodeTypeReferenceCollection ();
+
+ return implementationTypes;
+ }
+ }
+
+ public CodeTypeReference PrivateImplementationType
+ {
+ get {
+ return privateImplementationType;
+ }
+ set {
+ privateImplementationType = value;
+ }
+ }
+
+ public CodeTypeReference Type
+ {
+ get {
+ if (type == null)
+ type = new CodeTypeReference (String.Empty);
+
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberField.cs b/mcs/class/System/System.CodeDom/CodeMemberField.cs
new file mode 100755
index 00000000000..0665da3c2b3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberField.cs
@@ -0,0 +1,67 @@
+//
+// System.CodeDom CodeMemberField Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMemberField
+ : CodeTypeMember
+ {
+ private CodeExpression initExpression;
+ private CodeTypeReference type;
+
+ public CodeMemberField ()
+ {
+ }
+
+ public CodeMemberField (CodeTypeReference type, string name)
+ {
+ this.type = type;
+ this.Name = name;
+ }
+
+ public CodeMemberField (string type, string name)
+ {
+ this.type = new CodeTypeReference( type );
+ this.Name = name;
+ }
+
+ public CodeMemberField (Type type, string name)
+ {
+ this.type = new CodeTypeReference( type );
+ this.Name = name;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression InitExpression {
+ get {
+ return initExpression;
+ }
+ set {
+ initExpression = value;
+ }
+ }
+
+ public CodeTypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberMethod.cs b/mcs/class/System/System.CodeDom/CodeMemberMethod.cs
new file mode 100755
index 00000000000..da7669adb34
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberMethod.cs
@@ -0,0 +1,109 @@
+//
+// System.CodeDom CodeMemberMethod Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMemberMethod
+ : CodeTypeMember
+ {
+ private CodeTypeReferenceCollection implementationTypes;
+ private CodeParameterDeclarationExpressionCollection parameters;
+ private CodeTypeReference privateImplementationType;
+ private CodeTypeReference returnType;
+ private CodeStatementCollection statements;
+ private CodeAttributeDeclarationCollection returnTypeCustomAttributes;
+
+ //
+ // Constructors
+ //
+ public CodeMemberMethod()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReferenceCollection ImplementationTypes {
+ get {
+ if ( implementationTypes == null ) {
+ implementationTypes = new CodeTypeReferenceCollection();
+ if ( PopulateImplementationTypes != null )
+ PopulateImplementationTypes( this, EventArgs.Empty );
+ }
+ return implementationTypes;
+ }
+ }
+
+ public CodeParameterDeclarationExpressionCollection Parameters {
+ get {
+ if ( parameters == null ) {
+ parameters = new CodeParameterDeclarationExpressionCollection();
+ if ( PopulateParameters != null )
+ PopulateParameters( this, EventArgs.Empty );
+ }
+ return parameters;
+ }
+ }
+
+ public CodeTypeReference PrivateImplementationType {
+ get {
+ return privateImplementationType;
+ }
+ set {
+ privateImplementationType = value;
+ }
+ }
+
+ public CodeTypeReference ReturnType {
+ get {
+ if ( returnType == null )
+ return new CodeTypeReference( typeof(void) );
+ return returnType;
+ }
+ set {
+ returnType = value;
+ }
+ }
+
+ public CodeStatementCollection Statements {
+ get {
+ if ( statements == null ) {
+ statements = new CodeStatementCollection();
+ if ( PopulateStatements != null )
+ PopulateStatements( this, EventArgs.Empty );
+ }
+ return statements;
+ }
+ }
+
+ public CodeAttributeDeclarationCollection ReturnTypeCustomAttributes {
+ get {
+ if ( returnTypeCustomAttributes == null )
+ returnTypeCustomAttributes = new CodeAttributeDeclarationCollection();
+
+ return returnTypeCustomAttributes;
+ }
+ }
+
+ //
+ // Events
+ //
+ public event EventHandler PopulateImplementationTypes;
+
+ public event EventHandler PopulateParameters;
+
+ public event EventHandler PopulateStatements;
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberProperty.cs b/mcs/class/System/System.CodeDom/CodeMemberProperty.cs
new file mode 100755
index 00000000000..8ad15530acc
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberProperty.cs
@@ -0,0 +1,108 @@
+//
+// System.CodeDom CodeMemberProperty Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMemberProperty
+ : CodeTypeMember
+ {
+ private CodeStatementCollection getStatements;
+ private bool hasGet;
+ private bool hasSet;
+ private CodeTypeReferenceCollection implementationTypes;
+ private CodeParameterDeclarationExpressionCollection parameters;
+ private CodeTypeReference privateImplementationType;
+ private CodeStatementCollection setStatements;
+ private CodeTypeReference type;
+
+ //
+ // Constructors
+ //
+ public CodeMemberProperty ()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public CodeStatementCollection GetStatements {
+ get {
+ if ( getStatements == null )
+ getStatements = new CodeStatementCollection();
+ return getStatements;
+ }
+ }
+
+ public bool HasGet {
+ get {
+ return hasGet;
+ }
+ set {
+ hasGet = value;
+ }
+ }
+
+ public bool HasSet {
+ get {
+ return hasSet;
+ }
+ set {
+ hasSet = value;
+ }
+ }
+
+ public CodeTypeReferenceCollection ImplementationTypes {
+ get {
+ if ( implementationTypes == null )
+ implementationTypes = new CodeTypeReferenceCollection();
+ return implementationTypes;
+ }
+ }
+
+ public CodeParameterDeclarationExpressionCollection Parameters {
+ get {
+ if ( parameters == null )
+ parameters = new CodeParameterDeclarationExpressionCollection();
+ return parameters;
+ }
+ }
+
+ public CodeTypeReference PrivateImplementationType {
+ get {
+ return privateImplementationType;
+ }
+ set {
+ privateImplementationType = value;
+ }
+ }
+
+ public CodeStatementCollection SetStatements {
+ get {
+ if ( setStatements == null )
+ setStatements = new CodeStatementCollection();
+ return setStatements;
+ }
+ }
+
+ public CodeTypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs b/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
new file mode 100755
index 00000000000..f23b69eec5c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
@@ -0,0 +1,65 @@
+//
+// System.CodeDom CodeMethodInvokeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMethodInvokeExpression
+ : CodeExpression
+ {
+ private CodeMethodReferenceExpression method;
+ private CodeExpressionCollection parameters;
+
+ //
+ // Constructors
+ //
+ public CodeMethodInvokeExpression ()
+ {
+ }
+
+ public CodeMethodInvokeExpression (CodeMethodReferenceExpression method, params CodeExpression[] parameters)
+ {
+ this.method = method;
+ this.Parameters.AddRange( parameters );
+ }
+
+ public CodeMethodInvokeExpression (CodeExpression targetObject,
+ string methodName,
+ params CodeExpression [] parameters)
+ {
+ this.method = new CodeMethodReferenceExpression( targetObject, methodName );
+ this.Parameters.AddRange (parameters);
+ }
+
+ //
+ // Properties
+ //
+ public CodeMethodReferenceExpression Method {
+ get {
+ return method;
+ }
+ set {
+ method = value;
+ }
+ }
+
+ public CodeExpressionCollection Parameters {
+ get {
+ if ( parameters == null )
+ parameters = new CodeExpressionCollection();
+ return parameters;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
new file mode 100644
index 00000000000..1157a3fea7a
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
@@ -0,0 +1,59 @@
+//
+// System.CodeDom CodeMethodInvokeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMethodReferenceExpression
+ : CodeExpression
+ {
+ private string methodName;
+ private CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeMethodReferenceExpression ()
+ {
+ }
+
+ public CodeMethodReferenceExpression (CodeExpression targetObject,
+ string methodName)
+ {
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ }
+
+ //
+ // Properties
+ //
+ public string MethodName {
+ get {
+ return methodName;
+ }
+ set {
+ methodName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs b/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
new file mode 100755
index 00000000000..8ab4bd58c2a
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
@@ -0,0 +1,47 @@
+//
+// System.CodeDom CodeMethodReturnStatement class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeMethodReturnStatement
+ : CodeStatement
+ {
+ private CodeExpression expression;
+
+ //
+ // Constructors
+ //
+ public CodeMethodReturnStatement()
+ {
+ }
+
+ public CodeMethodReturnStatement( CodeExpression expression )
+ {
+ this.expression = expression;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespace.cs b/mcs/class/System/System.CodeDom/CodeNamespace.cs
new file mode 100755
index 00000000000..1de1f7dc76b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespace.cs
@@ -0,0 +1,92 @@
+//
+// System.CodeDom CodeNamespace Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeNamespace
+ : CodeObject
+ {
+ private CodeCommentStatementCollection comments;
+ private CodeNamespaceImportCollection imports;
+ private CodeTypeDeclarationCollection types;
+ private string name;
+
+ //
+ // Constructors
+ //
+ public CodeNamespace()
+ {
+ }
+
+ public CodeNamespace(string name)
+ {
+ this.name = name;
+ }
+
+ //
+ // Properties
+ //
+ public CodeCommentStatementCollection Comments {
+ get {
+ if ( comments == null ) {
+ comments = new CodeCommentStatementCollection();
+ if ( PopulateComments != null )
+ PopulateComments( this, EventArgs.Empty );
+ }
+ return comments;
+ }
+ }
+
+ public CodeNamespaceImportCollection Imports {
+ get {
+ if ( imports == null ) {
+ imports = new CodeNamespaceImportCollection();
+ if ( PopulateImports != null )
+ PopulateImports( this, EventArgs.Empty );
+ }
+ return imports;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ public CodeTypeDeclarationCollection Types {
+ get {
+ if ( types == null ) {
+ types = new CodeTypeDeclarationCollection();
+ if ( PopulateTypes != null )
+ PopulateTypes( this, EventArgs.Empty );
+ }
+ return types;
+ }
+ }
+
+ //
+ // Events
+ //
+ public event EventHandler PopulateComments;
+
+ public event EventHandler PopulateImports;
+
+ public event EventHandler PopulateTypes;
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs b/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs
new file mode 100644
index 00000000000..414fc6826ba
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs
@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeNamespaceCollection Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeNamespaceCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeNamespaceCollection()
+ {
+ }
+
+ public CodeNamespaceCollection( CodeNamespace[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeNamespaceCollection( CodeNamespaceCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeNamespace this[int index]
+ {
+ get {
+ return (CodeNamespace)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeNamespace value)
+ {
+ return List.Add( value );
+ }
+
+ public void AddRange (CodeNamespace [] value )
+ {
+ foreach ( CodeNamespace elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeNamespaceCollection value)
+ {
+ foreach ( CodeNamespace elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeNamespace value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeNamespace[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeNamespace value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeNamespace value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeNamespace value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespaceImport.cs b/mcs/class/System/System.CodeDom/CodeNamespaceImport.cs
new file mode 100755
index 00000000000..a3cc14a6d4f
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespaceImport.cs
@@ -0,0 +1,57 @@
+//
+// System.CodeDom CodeNamespaceImport Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeNamespaceImport
+ : CodeObject
+ {
+ private CodeLinePragma linePragma;
+ private string nameSpace;
+
+ //
+ // Constructors
+ //
+ public CodeNamespaceImport ()
+ {
+ }
+
+ public CodeNamespaceImport (string nameSpace)
+ {
+ this.nameSpace = nameSpace;
+ }
+
+ //
+ // Properties
+ //
+ public CodeLinePragma LinePragma {
+ get {
+ return linePragma;
+ }
+ set {
+ linePragma = value;
+ }
+ }
+
+ public string Namespace {
+ get {
+ return nameSpace;
+ }
+ set {
+ nameSpace = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs b/mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs
new file mode 100755
index 00000000000..dedc7321efc
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs
@@ -0,0 +1,150 @@
+//
+// System.CodeDom CodeNamespaceImportCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ /*
+ * Should probably be derived from CollectionBase like any
+ * other System.CodeDom.*Collection. MS docs say it currently
+ * is not, for whichever reason.
+ */
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeNamespaceImportCollection
+ : IList, ICollection, IEnumerable
+ {
+ private ArrayList namespaceImports;
+
+ //
+ // Constructors
+ //
+ public CodeNamespaceImportCollection ()
+ {
+ namespaceImports = new ArrayList();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return namespaceImports.Count;
+ }
+ }
+
+ public CodeNamespaceImport this [int index] {
+ get {
+ return (CodeNamespaceImport)namespaceImports[index];
+ }
+ set {
+ namespaceImports[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeNamespaceImport value)
+ {
+ namespaceImports.Add (value);
+ }
+
+ public void AddRange (CodeNamespaceImport [] value)
+ {
+ foreach (CodeNamespaceImport elem in value)
+ namespaceImports.Add (elem);
+ }
+
+ public void Clear ()
+ {
+ namespaceImports.Clear ();
+ }
+
+ // IList implementation
+ bool IList.IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ object IList.this[int index] {
+ get {
+ return namespaceImports[index];
+ }
+ set {
+ namespaceImports[index] = value;
+ }
+ }
+
+ int IList.Add( object value )
+ {
+ return namespaceImports.Add( value );
+ }
+
+ bool IList.Contains( object value )
+ {
+ return namespaceImports.Contains( value );
+ }
+
+ int IList.IndexOf( object value )
+ {
+ return namespaceImports.IndexOf( value );
+ }
+
+ void IList.Insert( int index, object value )
+ {
+ namespaceImports.Insert( index, value );
+ }
+
+ void IList.Remove( object value )
+ {
+ namespaceImports.Remove( value );
+ }
+
+ void IList.RemoveAt( int index )
+ {
+ namespaceImports.RemoveAt( index );
+ }
+
+ // ICollection implementation
+ object ICollection.SyncRoot {
+ get {
+ return namespaceImports.SyncRoot;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return namespaceImports.IsSynchronized;
+ }
+ }
+
+ void ICollection.CopyTo( Array array, int index )
+ {
+ namespaceImports.CopyTo( array, index );
+ }
+
+ // IEnumerable implementation
+ public IEnumerator GetEnumerator ()
+ {
+ return namespaceImports.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeObject.cs b/mcs/class/System/System.CodeDom/CodeObject.cs
new file mode 100755
index 00000000000..35b6053e73c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeObject.cs
@@ -0,0 +1,35 @@
+//
+// System.CodeDom CodeObject class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeObject
+ {
+ private IDictionary userData;
+
+ //
+ // Properties
+ //
+ public IDictionary UserData {
+ get {
+ if ( userData == null )
+ userData = new ListDictionary();
+ return userData;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
new file mode 100755
index 00000000000..a495d0b74aa
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
@@ -0,0 +1,72 @@
+//
+// System.CodeDom CodeObjectCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeObjectCreateExpression
+ : CodeExpression
+ {
+ private CodeTypeReference createType;
+ private CodeExpressionCollection parameters;
+
+ //
+ // Constructors
+ //
+ public CodeObjectCreateExpression ()
+ {
+ }
+
+ public CodeObjectCreateExpression (CodeTypeReference createType,
+ params CodeExpression [] parameters)
+ {
+ this.createType = createType;
+ this.Parameters.AddRange( parameters );
+ }
+
+ public CodeObjectCreateExpression (string createType,
+ params CodeExpression [] parameters)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.Parameters.AddRange( parameters );
+ }
+
+ public CodeObjectCreateExpression (Type createType,
+ params CodeExpression [] parameters)
+ {
+ this.createType = new CodeTypeReference( createType );
+ this.Parameters.AddRange( parameters );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReference CreateType {
+ get {
+ return createType;
+ }
+ set {
+ createType = value;
+ }
+ }
+
+ public CodeExpressionCollection Parameters {
+ get {
+ if ( parameters == null )
+ parameters = new CodeExpressionCollection();
+ return parameters;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
new file mode 100755
index 00000000000..799a73db1e0
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
@@ -0,0 +1,91 @@
+//
+// System.CodeDom CodeParameterDeclarationExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeParameterDeclarationExpression
+ : CodeExpression
+ {
+ private CodeAttributeDeclarationCollection customAttributes;
+ private FieldDirection direction;
+ private string name;
+ private CodeTypeReference type;
+
+ //
+ // Constructors
+ //
+ public CodeParameterDeclarationExpression ()
+ {
+ }
+
+ public CodeParameterDeclarationExpression( CodeTypeReference type, string name )
+ {
+ this.type = type;
+ this.name = name;
+ }
+
+ public CodeParameterDeclarationExpression (string type, string name)
+ {
+ this.type = new CodeTypeReference( type );
+ this.name = name;
+ }
+
+ public CodeParameterDeclarationExpression (Type type, string name)
+ {
+ this.type = new CodeTypeReference( type );
+ this.name = name;
+ }
+
+ //
+ // Properties
+ //
+ public CodeAttributeDeclarationCollection CustomAttributes {
+ get {
+ if ( customAttributes == null )
+ customAttributes = new CodeAttributeDeclarationCollection();
+ return customAttributes;
+ }
+ set {
+ customAttributes = value;
+ }
+ }
+
+ public FieldDirection Direction {
+ get {
+ return direction;
+ }
+ set {
+ direction = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ public CodeTypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs
new file mode 100755
index 00000000000..92d73ed42d9
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs
@@ -0,0 +1,100 @@
+//
+// System.CodeDom CodeParameterDeclarationExpressionCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeParameterDeclarationExpressionCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeParameterDeclarationExpressionCollection()
+ {
+ }
+
+ public CodeParameterDeclarationExpressionCollection( CodeParameterDeclarationExpression[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeParameterDeclarationExpressionCollection( CodeParameterDeclarationExpressionCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeParameterDeclarationExpression this[int index]
+ {
+ get {
+ return (CodeParameterDeclarationExpression)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeParameterDeclarationExpression value)
+ {
+ return List.Add( value );
+ }
+
+ public void AddRange (CodeParameterDeclarationExpression [] value )
+ {
+ foreach ( CodeParameterDeclarationExpression elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeParameterDeclarationExpressionCollection value)
+ {
+ foreach ( CodeParameterDeclarationExpression elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeParameterDeclarationExpression value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeParameterDeclarationExpression[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeParameterDeclarationExpression value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeParameterDeclarationExpression value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeParameterDeclarationExpression value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs b/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
new file mode 100755
index 00000000000..c6404cdf08f
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodePrimitiveExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodePrimitiveExpression
+ : CodeExpression
+ {
+ private object value;
+
+ //
+ // Constructors
+ //
+ public CodePrimitiveExpression ()
+ {
+ }
+
+ public CodePrimitiveExpression (Object value)
+ {
+ this.value = value;
+ }
+
+ //
+ // Properties
+ //
+ public object Value {
+ get {
+ return this.value;
+ }
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
new file mode 100755
index 00000000000..0680897c60c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
@@ -0,0 +1,59 @@
+//
+// System.CodeDom CodePropertyReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodePropertyReferenceExpression
+ : CodeExpression
+ {
+ private CodeExpression targetObject;
+ private string propertyName;
+
+ //
+ // Constructors
+ //
+ public CodePropertyReferenceExpression ()
+ {
+ }
+
+ public CodePropertyReferenceExpression (CodeExpression targetObject,
+ string propertyName)
+ {
+ this.targetObject = targetObject;
+ this.propertyName = propertyName;
+ }
+
+ //
+ // Properties
+ //
+ public string PropertyName {
+ get {
+ return propertyName;
+ }
+ set {
+ propertyName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
new file mode 100644
index 00000000000..db99a3ad351
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodePropertySetValueReferenceExpression Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodePropertySetValueReferenceExpression
+ : CodeExpression
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs b/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
new file mode 100644
index 00000000000..c19ace0e84b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
@@ -0,0 +1,68 @@
+//
+// System.CodeDom CodeRemoveEventStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeRemoveEventStatement
+ : CodeStatement
+ {
+ private CodeEventReferenceExpression eventRef;
+ private CodeExpression listener;
+
+ //
+ // Constructors
+ //
+ public CodeRemoveEventStatement ()
+ {
+ }
+
+ public CodeRemoveEventStatement (CodeEventReferenceExpression eventRef,
+ CodeExpression listener)
+ {
+ this.eventRef = eventRef;
+ this.listener = listener;
+ }
+
+ public CodeRemoveEventStatement (CodeExpression targetObject,
+ string eventName,
+ CodeExpression listener)
+ {
+ this.eventRef = new CodeEventReferenceExpression( targetObject,
+ eventName );
+ this.listener = listener;
+ }
+
+ //
+ // Properties
+ //
+ public CodeEventReferenceExpression Event {
+ get {
+ return eventRef;
+ }
+ set {
+ eventRef = value;
+ }
+ }
+
+ public CodeExpression Listener {
+ get {
+ return listener;
+ }
+ set {
+ listener = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeSnippetCompileUnit.cs b/mcs/class/System/System.CodeDom/CodeSnippetCompileUnit.cs
new file mode 100644
index 00000000000..49d13d5d461
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeSnippetCompileUnit.cs
@@ -0,0 +1,52 @@
+//
+// System.CodeDom CodeSnippetCompileUnit Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeSnippetCompileUnit
+ : CodeCompileUnit
+ {
+ private CodeLinePragma linePragma;
+ private string value;
+
+ //
+ // Constructors
+ //
+ public CodeSnippetCompileUnit( string value )
+ {
+ this.value = value;
+ }
+
+ //
+ // Properties
+ //
+ public CodeLinePragma LinePragma {
+ get {
+ return linePragma;
+ }
+ set {
+ linePragma = value;
+ }
+ }
+
+ public string Value {
+ get {
+ return this.value;
+ }
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs b/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
new file mode 100644
index 00000000000..e9023d3c75b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeSnippetExpression Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeSnippetExpression
+ : CodeExpression
+ {
+ private string value;
+
+ //
+ // Constructors
+ //
+ public CodeSnippetExpression()
+ {
+ }
+
+ public CodeSnippetExpression( string value )
+ {
+ Value = value;
+ }
+
+ //
+ // Properties
+ //
+ public string Value {
+ get {
+ return this.value;
+ }
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeSnippetStatement.cs b/mcs/class/System/System.CodeDom/CodeSnippetStatement.cs
new file mode 100644
index 00000000000..1bd06116ba4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeSnippetStatement.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeSnippetStatement Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeSnippetStatement
+ : CodeStatement
+ {
+ private string value;
+
+ //
+ // Constructors
+ //
+ public CodeSnippetStatement()
+ {
+ }
+
+ public CodeSnippetStatement( string value )
+ {
+ this.value = value;
+ }
+
+ //
+ // Properties
+ //
+ public string Value {
+ get {
+ return this.value;
+ }
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs b/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
new file mode 100644
index 00000000000..656afc287af
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeSnippetTypeMember Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeSnippetTypeMember
+ : CodeTypeMember
+ {
+ private string text;
+
+ //
+ // Constructors
+ //
+ public CodeSnippetTypeMember()
+ {
+ }
+
+ public CodeSnippetTypeMember( string text )
+ {
+ this.text = text;
+ }
+
+ //
+ // Properties
+ //
+ public string Text {
+ get {
+ return text;
+ }
+ set {
+ text = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeStatement.cs b/mcs/class/System/System.CodeDom/CodeStatement.cs
new file mode 100755
index 00000000000..f79710a1bbd
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeStatement.cs
@@ -0,0 +1,42 @@
+//
+// System.CodeDom CodeStatement class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeStatement
+ : CodeObject
+ {
+ private CodeLinePragma linePragma;
+
+ //
+ // Constructors
+ //
+ public CodeStatement()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public CodeLinePragma LinePragma {
+ get {
+ return linePragma;
+ }
+ set {
+ linePragma = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeStatementCollection.cs b/mcs/class/System/System.CodeDom/CodeStatementCollection.cs
new file mode 100755
index 00000000000..85462d76346
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeStatementCollection.cs
@@ -0,0 +1,105 @@
+//
+// System.CodeDom CodeStatementCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeStatementCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeStatementCollection()
+ {
+ }
+
+ public CodeStatementCollection( CodeStatement[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeStatementCollection( CodeStatementCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeStatement this[int index]
+ {
+ get {
+ return (CodeStatement)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeStatement value)
+ {
+ return List.Add( value );
+ }
+
+ public int Add (CodeExpression value)
+ {
+ return Add( new CodeExpressionStatement( value ) );
+ }
+
+ public void AddRange (CodeStatement [] statements )
+ {
+ foreach ( CodeStatement elem in statements )
+ Add( elem );
+ }
+
+ public void AddRange( CodeStatementCollection value )
+ {
+ foreach ( CodeStatement elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeStatement value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeStatement[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeStatement value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeStatement value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeStatement value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
new file mode 100755
index 00000000000..737410bbf04
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
@@ -0,0 +1,28 @@
+//
+// System.CodeDom CodeParameterDeclarationExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeThisReferenceExpression
+ : CodeExpression
+ {
+
+ //
+ // Constructors
+ //
+ public CodeThisReferenceExpression()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs b/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
new file mode 100755
index 00000000000..b031fa039dd
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeThrowExceptionStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeThrowExceptionStatement
+ : CodeStatement
+ {
+ private CodeExpression toThrow;
+
+ //
+ // Constructors
+ //
+ public CodeThrowExceptionStatement ()
+ {
+ }
+
+ public CodeThrowExceptionStatement (CodeExpression toThrow)
+ {
+ this.toThrow = toThrow;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression ToThrow {
+ get {
+ return toThrow;
+ }
+ set {
+ toThrow = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs b/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
new file mode 100755
index 00000000000..4ca30008464
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
@@ -0,0 +1,73 @@
+//
+// System.CodeDom CodeTryCatchFinallyStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTryCatchFinallyStatement
+ : CodeStatement
+ {
+ private CodeStatementCollection tryStatements, finallyStatements;
+ private CodeCatchClauseCollection catchClauses;
+
+ //
+ // Constructors
+ //
+ public CodeTryCatchFinallyStatement ()
+ {
+ }
+
+ public CodeTryCatchFinallyStatement (CodeStatement [] tryStatements,
+ CodeCatchClause [] catchClauses)
+ {
+ TryStatements.AddRange( tryStatements );
+ CatchClauses.AddRange( catchClauses );
+ }
+
+ public CodeTryCatchFinallyStatement (CodeStatement [] tryStatements,
+ CodeCatchClause [] catchClauses,
+ CodeStatement [] finallyStatements)
+ {
+ TryStatements.AddRange( tryStatements );
+ CatchClauses.AddRange( catchClauses );
+ FinallyStatements.AddRange( finallyStatements );
+ }
+
+ //
+ // Properties
+ //
+ public CodeStatementCollection FinallyStatements{
+ get {
+ if ( finallyStatements == null )
+ finallyStatements = new CodeStatementCollection();
+ return finallyStatements;
+ }
+ }
+
+ public CodeStatementCollection TryStatements {
+ get {
+ if ( tryStatements == null )
+ tryStatements = new CodeStatementCollection();
+ return tryStatements;
+ }
+ }
+ public CodeCatchClauseCollection CatchClauses {
+ get {
+ if ( catchClauses == null )
+ catchClauses = new CodeCatchClauseCollection();
+ return catchClauses;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs b/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
new file mode 100644
index 00000000000..8213bf56c2a
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodeTypeConstructor Class Implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeConstructor
+ : CodeMemberMethod
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs
new file mode 100755
index 00000000000..be0fdc70cff
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs
@@ -0,0 +1,149 @@
+//
+// System.CodeDom CodeTypeDeclaration Class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Reflection;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeDeclaration
+ : CodeTypeMember
+ {
+ private CodeTypeReferenceCollection baseTypes;
+ private CodeTypeMemberCollection members;
+ private TypeAttributes typeAttributes;
+ private bool isEnum;
+ private bool isStruct;
+
+ //
+ // Constructors
+ //
+
+ public CodeTypeDeclaration()
+ {
+ }
+
+ public CodeTypeDeclaration( string name )
+ {
+ this.Name = name;
+ }
+
+ /* by default, it's a class */
+
+ //
+ // Properties
+ //
+ public CodeTypeReferenceCollection BaseTypes {
+ get {
+ if ( baseTypes == null ) {
+ baseTypes = new CodeTypeReferenceCollection();
+ if ( PopulateBaseTypes != null )
+ PopulateBaseTypes( this, EventArgs.Empty );
+ }
+ return baseTypes;
+ }
+ }
+
+ public bool IsClass {
+ get {
+ if ( (typeAttributes & TypeAttributes.Interface) != 0 )
+ return false;
+ if ( isEnum )
+ return false;
+ if ( isStruct )
+ return false;
+ return true;
+ }
+ set {
+ if ( value ) {
+ typeAttributes &= ~TypeAttributes.Interface;
+ isEnum = false;
+ isStruct = false;
+ }
+ }
+ }
+
+ public bool IsEnum {
+ get {
+ return isEnum;
+ }
+ set {
+ if ( value ) {
+ typeAttributes &= ~TypeAttributes.Interface;
+ isEnum = true;
+ isStruct = false;
+ }
+ }
+ }
+
+ public bool IsInterface {
+ get {
+ return (typeAttributes & TypeAttributes.Interface) != 0;
+ }
+ set {
+ if ( value ) {
+ typeAttributes |= TypeAttributes.Interface;
+ isEnum = false;
+ isStruct = false;
+ }
+ }
+ }
+
+ public bool IsStruct {
+ get {
+ return isStruct;
+ }
+ set {
+ if ( value ) {
+ typeAttributes &= ~TypeAttributes.Interface;
+ isEnum = false;
+ isStruct = true;
+ }
+ }
+ }
+
+ public CodeTypeMemberCollection Members {
+ get {
+ if ( members == null ) {
+ members = new CodeTypeMemberCollection();
+ if ( PopulateMembers != null )
+ PopulateMembers( this, EventArgs.Empty );
+ }
+ return members;
+ }
+ }
+
+ public TypeAttributes TypeAttributes {
+ get {
+ return typeAttributes;
+ }
+ set {
+ typeAttributes = value;
+#if FALSE
+ /* MS does not seem to do this, so don't I */
+ if ( (typeAttributes & TypeAttributes.Interface) != 0 ) {
+ isEnum = false;
+ isStruct = false;
+ }
+#endif
+ }
+ }
+
+ //
+ // Events
+ //
+ public event EventHandler PopulateBaseTypes;
+
+ public event EventHandler PopulateMembers;
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs b/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs
new file mode 100644
index 00000000000..9c1c2a1a3b3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs
@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeTypeDeclarationCollection Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeDeclarationCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeTypeDeclarationCollection()
+ {
+ }
+
+ public CodeTypeDeclarationCollection( CodeTypeDeclaration[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeTypeDeclarationCollection( CodeTypeDeclarationCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeDeclaration this[int index]
+ {
+ get {
+ return (CodeTypeDeclaration)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeTypeDeclaration value)
+ {
+ return List.Add (value);
+ }
+
+ public void AddRange (CodeTypeDeclaration [] value)
+ {
+ foreach (CodeTypeDeclaration ca in value)
+ Add( ca );
+ }
+
+ public void AddRange (CodeTypeDeclarationCollection value)
+ {
+ foreach (CodeTypeDeclaration ca in value)
+ Add( ca );
+ }
+
+ public bool Contains( CodeTypeDeclaration value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeTypeDeclaration[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeTypeDeclaration value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeTypeDeclaration value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeTypeDeclaration value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs b/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs
new file mode 100644
index 00000000000..27ef5a95b76
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs
@@ -0,0 +1,55 @@
+//
+// System.CodeDom CodeTypeDelegate Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeDelegate
+ : CodeTypeDeclaration
+ {
+ private CodeParameterDeclarationExpressionCollection parameters;
+ private CodeTypeReference returnType;
+
+ //
+ // Constructors
+ //
+ public CodeTypeDelegate()
+ {
+ }
+
+ public CodeTypeDelegate( string name )
+ {
+ this.Name = name;
+ }
+
+ //
+ // Properties
+ //
+ public CodeParameterDeclarationExpressionCollection Parameters {
+ get {
+ if ( parameters == null )
+ parameters = new CodeParameterDeclarationExpressionCollection();
+ return parameters;
+ }
+ }
+
+ public CodeTypeReference ReturnType {
+ get {
+ return returnType;
+ }
+ set {
+ returnType = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeMember.cs b/mcs/class/System/System.CodeDom/CodeTypeMember.cs
new file mode 100755
index 00000000000..ea03f20f382
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeMember.cs
@@ -0,0 +1,84 @@
+//
+// System.CodeDom CodeTypeMember Class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeMember
+ : CodeObject
+ {
+ private string name;
+ private MemberAttributes attributes;
+ private CodeCommentStatementCollection comments;
+ private CodeAttributeDeclarationCollection customAttributes;
+ private CodeLinePragma linePragma;
+
+ //
+ // Constructors
+ //
+ public CodeTypeMember()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public MemberAttributes Attributes {
+ get {
+ return attributes;
+ }
+ set {
+ attributes = value;
+ }
+ }
+
+ public CodeCommentStatementCollection Comments {
+ get {
+ if ( comments == null )
+ comments = new CodeCommentStatementCollection();
+ return comments;
+ }
+ }
+
+
+ public CodeAttributeDeclarationCollection CustomAttributes {
+ get {
+ if ( customAttributes == null )
+ customAttributes = new CodeAttributeDeclarationCollection();
+ return customAttributes;
+ }
+ set {
+ customAttributes = value;
+ }
+ }
+
+ public CodeLinePragma LinePragma {
+ get {
+ return linePragma;
+ }
+ set {
+ linePragma = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs b/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs
new file mode 100644
index 00000000000..54b49418590
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs
@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeTypeMemberCollection Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeMemberCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeTypeMemberCollection()
+ {
+ }
+
+ public CodeTypeMemberCollection( CodeTypeMember[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeTypeMemberCollection( CodeTypeMemberCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeMember this[int index]
+ {
+ get {
+ return (CodeTypeMember)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeTypeMember value)
+ {
+ return List.Add( value );
+ }
+
+ public void AddRange (CodeTypeMember [] value )
+ {
+ foreach ( CodeTypeMember elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeTypeMemberCollection value)
+ {
+ foreach ( CodeTypeMember elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeTypeMember value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeTypeMember[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeTypeMember value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeTypeMember value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeTypeMember value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs b/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
new file mode 100755
index 00000000000..1462103aa18
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
@@ -0,0 +1,57 @@
+//
+// System.CodeDom CodeTypeOfExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeOfExpression
+ : CodeExpression
+ {
+ private CodeTypeReference type;
+
+ //
+ // Constructors
+ //
+ public CodeTypeOfExpression ()
+ {
+ }
+
+ public CodeTypeOfExpression (CodeTypeReference type)
+ {
+ this.type = type;
+ }
+
+ public CodeTypeOfExpression (string type)
+ {
+ this.type = new CodeTypeReference( type );
+ }
+
+ public CodeTypeOfExpression (Type type)
+ {
+ this.type = new CodeTypeReference( type );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeReference.cs b/mcs/class/System/System.CodeDom/CodeTypeReference.cs
new file mode 100644
index 00000000000..70e295fca2e
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeReference.cs
@@ -0,0 +1,85 @@
+//
+// System.CodeDom CodeTypeReferenceExpression Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeReference
+ : CodeObject
+ {
+ private string baseType;
+ private CodeTypeReference arrayType;
+ private int rank;
+
+ //
+ // Constructors
+ //
+ public CodeTypeReference( string baseType )
+ {
+ this.baseType = baseType;
+ }
+
+ public CodeTypeReference( Type baseType )
+ {
+ this.baseType = baseType.FullName;
+ }
+
+ public CodeTypeReference( CodeTypeReference arrayType, int rank )
+ {
+ this.baseType = null;
+ this.rank = rank;
+ this.arrayType = arrayType;
+ }
+
+ public CodeTypeReference( string baseType, int rank )
+ : this (new CodeTypeReference (baseType), rank)
+ {
+ }
+
+
+ //
+ // Properties
+ //
+
+ public CodeTypeReference ArrayElementType
+ {
+ get {
+ return arrayType;
+ }
+ set {
+ arrayType = value;
+ }
+ }
+
+ public int ArrayRank {
+ get {
+ return rank;
+ }
+ set {
+ rank = value;
+ }
+ }
+
+ public string BaseType {
+ get {
+ if (baseType == null)
+ return String.Empty;
+
+ return baseType;
+ }
+ set {
+ baseType = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs b/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs
new file mode 100644
index 00000000000..c83a838faa9
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs
@@ -0,0 +1,109 @@
+//
+// System.CodeDom CodeTypeReferenceCollection Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeReferenceCollection
+ : CollectionBase
+ {
+ //
+ // Constructors
+ //
+ public CodeTypeReferenceCollection()
+ {
+ }
+
+ public CodeTypeReferenceCollection( CodeTypeReference[] value )
+ {
+ AddRange( value );
+ }
+
+ public CodeTypeReferenceCollection( CodeTypeReferenceCollection value )
+ {
+ AddRange( value );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReference this[int index]
+ {
+ get {
+ return (CodeTypeReference)List[index];
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public int Add (CodeTypeReference value)
+ {
+ return List.Add( value );
+ }
+
+ public void Add (string value)
+ {
+ Add (new CodeTypeReference (value));
+ }
+
+ public void Add (Type value)
+ {
+ Add (new CodeTypeReference (value));
+ }
+
+ public void AddRange (CodeTypeReference [] value )
+ {
+ foreach ( CodeTypeReference elem in value )
+ Add( elem );
+ }
+
+ public void AddRange (CodeTypeReferenceCollection value)
+ {
+ foreach ( CodeTypeReference elem in value )
+ Add( elem );
+ }
+
+ public bool Contains( CodeTypeReference value )
+ {
+ return List.Contains( value );
+ }
+
+ public void CopyTo( CodeTypeReference[] array, int index )
+ {
+ List.CopyTo( array, index );
+ }
+
+ public int IndexOf( CodeTypeReference value )
+ {
+ return List.IndexOf( value );
+ }
+
+ public void Insert( int index, CodeTypeReference value )
+ {
+ List.Insert( index, value );
+ }
+
+ public void Remove( CodeTypeReference value )
+ {
+ int index = IndexOf( value );
+ if ( index < 0 )
+ throw( new ArgumentException( "The specified object is not found in the collection" ) );
+ RemoveAt( index );
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
new file mode 100755
index 00000000000..726732587ab
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
@@ -0,0 +1,57 @@
+//
+// System.CodeDom CodeTypeReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeTypeReferenceExpression
+ : CodeExpression
+ {
+ private CodeTypeReference type;
+
+ //
+ // Constructors
+ //
+ public CodeTypeReferenceExpression ()
+ {
+ }
+
+ public CodeTypeReferenceExpression (CodeTypeReference type)
+ {
+ this.type = type;
+ }
+
+ public CodeTypeReferenceExpression (string type)
+ {
+ this.type = new CodeTypeReference( type );
+ }
+
+ public CodeTypeReferenceExpression (Type type)
+ {
+ this.type = new CodeTypeReference( type );
+ }
+
+ //
+ // Properties
+ //
+ public CodeTypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs b/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
new file mode 100755
index 00000000000..6bd0671802b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
@@ -0,0 +1,108 @@
+//
+// System.CodeDom CodeVariableDeclarationStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeVariableDeclarationStatement
+ : CodeStatement
+ {
+ private CodeExpression initExpression;
+ private CodeTypeReference type;
+ private string name;
+
+ //
+ // Constructors
+ //
+ public CodeVariableDeclarationStatement ()
+ {
+ }
+
+ public CodeVariableDeclarationStatement( CodeTypeReference type, string name )
+ {
+ this.type = type;
+ this.name = name;
+ }
+
+ public CodeVariableDeclarationStatement( string type, string name )
+ {
+ this.type = new CodeTypeReference( type );
+ this.name = name;
+ }
+
+ public CodeVariableDeclarationStatement( Type type, string name )
+ {
+ this.type = new CodeTypeReference( type );
+ this.name = name;
+ }
+
+ public CodeVariableDeclarationStatement( CodeTypeReference type,
+ string name,
+ CodeExpression initExpression )
+ {
+ this.type = type;
+ this.name = name;
+ this.initExpression = initExpression;
+ }
+
+ public CodeVariableDeclarationStatement( string type,
+ string name,
+ CodeExpression initExpression )
+ {
+ this.type = new CodeTypeReference( type );
+ this.name = name;
+ this.initExpression = initExpression;
+ }
+
+ public CodeVariableDeclarationStatement( Type type,
+ string name,
+ CodeExpression initExpression )
+ {
+ this.type = new CodeTypeReference( type );
+ this.name = name;
+ this.initExpression = initExpression;
+ }
+
+
+ //
+ // Properties
+ //
+ public CodeExpression InitExpression {
+ get {
+ return initExpression;
+ }
+ set {
+ initExpression = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ public CodeTypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
new file mode 100644
index 00000000000..89b5d013b40
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeVariableReferenceExpression Class implementation
+//
+// Author:
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDispatch)]
+ [ComVisible(true)]
+ public class CodeVariableReferenceExpression
+ : CodeExpression
+ {
+ private string variableName;
+
+ //
+ // Constructors
+ //
+ public CodeVariableReferenceExpression()
+ {
+ }
+
+ public CodeVariableReferenceExpression( string variableName )
+ {
+ this.variableName = variableName;
+ }
+
+ //
+ // Properties
+ //
+ public string VariableName {
+ get {
+ return variableName;
+ }
+ set {
+ variableName = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/FieldDirection.cs b/mcs/class/System/System.CodeDom/FieldDirection.cs
new file mode 100755
index 00000000000..ccd6b4c876d
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/FieldDirection.cs
@@ -0,0 +1,21 @@
+//
+// System.CodeDom FieldDirection Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+ [Serializable]
+ [ComVisible(true)]
+ public enum FieldDirection {
+ In,
+ Out,
+ Ref
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/MemberAttributes.cs b/mcs/class/System/System.CodeDom/MemberAttributes.cs
new file mode 100755
index 00000000000..5097375c798
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/MemberAttributes.cs
@@ -0,0 +1,38 @@
+//
+// System.CodeDom MemberAttributes Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+ [Serializable]
+ [ComVisible(true)]
+ public enum MemberAttributes {
+ Abstract = 0x00000001,
+ Final = 0x00000002,
+ Static = 0x00000003,
+ Override = 0x00000004,
+ Const = 0x00000005,
+ ScopeMask = 0x0000000F,
+
+ New = 0x00000010,
+ VTableMask = 0x000000F0,
+
+ Overloaded = 0x00000100,
+
+ Assembly = 0x00001000, // internal
+ FamilyAndAssembly = 0x00002000, // protected AND internal
+ Family = 0x00003000, // protected
+ FamilyOrAssembly = 0x00004000, // protected internal
+ Private = 0x00005000, // private
+ Public = 0x00006000, // public
+ AccessMask = 0x0000F000
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/BitVector32.cs b/mcs/class/System/System.Collections.Specialized/BitVector32.cs
new file mode 100644
index 00000000000..2ff52d876eb
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/BitVector32.cs
@@ -0,0 +1,199 @@
+//
+// System.Collections.Specialized.BitVector32.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Lawrence Pit (loz@cable.a2000.nl)
+// Andrew Birkett (adb@tardis.ed.ac.uk)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Text;
+
+namespace System.Collections.Specialized {
+
+ public struct BitVector32 {
+ int bits;
+
+ public struct Section {
+ private short mask;
+ private short offset;
+
+ internal Section (short mask, short offset) {
+ this.mask = mask;
+ this.offset = offset;
+ }
+
+ public short Mask {
+ get { return mask; }
+ }
+
+ public short Offset {
+ get { return offset; }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (! (o is Section))
+ return false;
+
+ Section section = (Section) o;
+ return this.mask == section.mask &&
+ this.offset == section.offset;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (((Int16) mask).GetHashCode () << 16) +
+ ((Int16) offset).GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return "Section{0x" + Convert.ToString(mask, 16) +
+ ", 0x" + Convert.ToString(offset, 16) + "}";
+ }
+ }
+
+ // Constructors
+
+ public BitVector32 (BitVector32 source)
+ {
+ bits = source.bits;
+ }
+
+ public BitVector32 (int init)
+ {
+ bits = init;
+ }
+
+ // Properties
+
+ public int Data {
+ get { return bits; }
+ }
+
+ public int this [BitVector32.Section section] {
+ get {
+ return ((bits >> section.Offset) & section.Mask);
+ }
+
+ set {
+ if (value < 0)
+ throw new ArgumentException ("Section can't hold negative values");
+ if (value > section.Mask)
+ throw new ArgumentException ("Value too large to fit in section");
+ bits &= (~section.Mask << section.Offset);
+ bits |= (value << section.Offset);
+ }
+ }
+
+ public bool this [int mask] {
+ get {
+ return (bits & mask) == mask;
+ }
+
+ set {
+ if (value)
+ bits |= mask;
+ else
+ bits &= ~mask;
+ }
+ }
+
+ // Methods
+
+ public static int CreateMask ()
+ {
+ return 1;
+ }
+
+ public static int CreateMask (int prev)
+ {
+ if (prev == 0)
+ return 1;
+ if (prev == Int32.MinValue)
+ throw new InvalidOperationException ("all bits set");
+ return prev << 1;
+ }
+
+ public static Section CreateSection (short maxValue)
+ {
+ return CreateSection (maxValue, new Section (0, 0));
+ }
+
+ public static Section CreateSection (short maxValue, BitVector32.Section previous)
+ {
+ if (maxValue < 1)
+ throw new ArgumentException ("maxValue");
+
+ int bit = HighestSetBit(maxValue) + 1;
+ int mask = (1 << bit) - 1;
+ int offset = previous.Offset + NumberOfSetBits (previous.Mask);
+
+ if (offset + NumberOfSetBits (mask) > 32) {
+ throw new ArgumentException ("Sections cannot exceed 32 bits in total");
+ }
+
+ return new Section ((short) mask, (short) offset);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is BitVector32))
+ return false;
+
+ return bits == ((BitVector32) o).bits;
+ }
+
+ public override int GetHashCode ()
+ {
+ return bits.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return ToString (this);
+ }
+
+ public static string ToString (BitVector32 value)
+ {
+ StringBuilder b = new StringBuilder ();
+ b.Append ("BitVector32{");
+ long mask = (long) 0x80000000;
+ while (mask > 0) {
+ b.Append (((value.bits & mask) == 0) ? '0' : '1');
+ mask >>= 1;
+ }
+ b.Append ('}');
+ return b.ToString ();
+ }
+
+ // Private utilities
+ private static int NumberOfSetBits (int i)
+ {
+ int count = 0;
+ for (int bit = 0; bit < 32; bit++) {
+ int mask = 1 << bit;
+ if ((i & mask) != 0)
+ count++;
+ }
+ return count;
+ }
+
+ private static int HighestSetBit (int i)
+ {
+ for (int bit = 31; bit >= 0; bit--) {
+ int mask = 1 << bit;
+ if ((mask & i) != 0) {
+ return bit;
+ }
+ }
+
+ return -1;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/ChangeLog b/mcs/class/System/System.Collections.Specialized/ChangeLog
new file mode 100755
index 00000000000..0e61ece6ad0
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/ChangeLog
@@ -0,0 +1,84 @@
+2003-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringCollection.cs: fixed range checks in CopyTo.
+
+2002-11-06 Daniel Stodden <stodden@in.tum.de>
+
+ * ListDictionary.cs:
+ - Filled in missing CopyTo()s.
+ - No, overwriting an entry should not change the Count <:)
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * NameValueCollection.cs: fixed Add (NameValueCollection).
+
+2002-09-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringCollection.cs: fixes bug #29791. Thanks to Marcus Urban
+ (mathpup@mylinuxisp.com).
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * NameObjectCollectionBase.cs: added iterator stubb to
+ NameObjectCollectionBase.KeysCollection
+
+2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HybridDictionary.cs:
+ (Remove): fixed. The value is either in the list or in the hash.
+
+2002-06-24 Andrew Birkett <adb@tardis.ed.ac.uk>
+
+ * BitVector32.cs: Implemented 'set' section indexer. Check for
+ overly large sections. Factored out some helper methods.
+
+2002-05-11 Lawrence Pit <loz@cable.a2000.nl>
+
+ * NameValueCollection.AsStringArray: fixed ArgumentNullException bug.
+
+2002-05-10 Lawrence Pit <loz@cable.a2000.nl>
+
+ * HybridDictionary.cs: implemented
+ * CollectionsUtil.cs: implemented
+ * BitVector32.cs: implemeneted
+ * Modified signature of method ListDictionary.GetEnumerator
+
+Fri Feb 8 18:02:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * NameObjectCollectionBase.cs, NameValueCollection.cs: tweaks to make
+ it compile and provide the constructor needed by nunitcore.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * BitVector32.cs, ListDictionary.cs : MonoTODO everywhere!
+
+ * NameObjectCollectionBase.cs, NameValueCollection.cs : Ditto.
+
+2001-08-24 Nick Drochak <ndrochak@gol.com>
+ * NameObjectCollectionBase.cs: Add stub implementation
+ * common.src: Add NameObjectCollectionBase to the build
+ * NameValueCollection.cs: add 'override' to CopyTo(). Maybe
+ this code actually belongs in the superclass.
+
+2001-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * common.src: Add NameValueCollection.cs to the build
+
+2001-08-22 John Barnette <jbarn@httcb.net>
+ * StringDictionary.cs:
+ Initial working implementation.
+ * ListDictionary.cs:
+ Initial working implementation.
+
+2001-07-17 John Barnette <jbarn@httcb.net>
+ * StringCollection.cs:
+ Implemented and working according to spec.
+ * StringIterator.cs:
+ (ADDED) Implemented and working according to spec.
+ * StringCollectionTest.cs:
+ (ADDED) Initial revision contains 17 tests; all of 'em
+ run correctly. More complicated tests to follow.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * StringCollection.cs: Added so that CodeDom.* would compile.
+
diff --git a/mcs/class/System/System.Collections.Specialized/CollectionsUtil.cs b/mcs/class/System/System.Collections.Specialized/CollectionsUtil.cs
new file mode 100644
index 00000000000..82d103134f1
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/CollectionsUtil.cs
@@ -0,0 +1,38 @@
+//
+// System.Collections.Specialized.CollectionsUtil.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System.Collections;
+
+namespace System.Collections.Specialized {
+
+ public class CollectionsUtil {
+
+ public CollectionsUtil () {}
+
+ public static Hashtable CreateCaseInsensitiveHashtable ()
+ {
+ return new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ }
+
+
+ public static Hashtable CreateCaseInsensitiveHashtable (IDictionary d) {
+ return new Hashtable (d, CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ }
+
+ public static Hashtable CreateCaseInsensitiveHashtable (int capacity) {
+ return new Hashtable (capacity, CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ }
+
+
+ public static SortedList CreateCaseInsensitiveSortedList () {
+ return new SortedList (CaseInsensitiveComparer.Default);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs b/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs
new file mode 100644
index 00000000000..44548f38774
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/HybridDictionary.cs
@@ -0,0 +1,184 @@
+//
+// System.Collections.Specialized.HybridDictionary.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+
+namespace System.Collections.Specialized {
+
+ [Serializable]
+ public class HybridDictionary : IDictionary, ICollection, IEnumerable {
+
+ private const int switchAfter = 10;
+
+ private ListDictionary list;
+ private Hashtable hashtable;
+ private bool caseInsensitive = false;
+
+ // Constructors
+
+ public HybridDictionary() : this (0, false) { }
+
+ public HybridDictionary (bool caseInsensitive) : this (0, caseInsensitive) { }
+
+ public HybridDictionary (int initialSize) : this (initialSize, false) { }
+
+ public HybridDictionary(int initialSize, bool caseInsensitive)
+ {
+ this.caseInsensitive = caseInsensitive;
+
+ if (initialSize <= switchAfter)
+ if (caseInsensitive)
+ list = new ListDictionary (CaseInsensitiveComparer.Default);
+ else
+ list = new ListDictionary ();
+ else
+ if (caseInsensitive)
+ hashtable = new Hashtable (initialSize,
+ CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ else
+ hashtable = new Hashtable (initialSize);
+ }
+
+
+ // Properties
+
+ public int Count {
+ get {
+ if (list != null)
+ return list.Count;
+ return hashtable.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object this [object key] {
+ get {
+ if (key == null)
+ throw new ArgumentNullException("key");
+ if (list != null)
+ return list [key];
+ return hashtable [key];
+ }
+ set {
+ if (list != null)
+ if (list.Count >= switchAfter)
+ Switch ();
+ else {
+ list [key] = value;
+ return;
+ }
+ hashtable [key] = value;
+ }
+ }
+
+ public ICollection Keys {
+ get {
+ if (list != null)
+ return list.Keys;
+ return hashtable.Keys;
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ public ICollection Values {
+ get {
+ if (list != null)
+ return list.Values;
+ return hashtable.Values;
+ }
+ }
+
+
+ // Methods
+
+ public void Add (object key, object value)
+ {
+ if (list != null)
+ if (list.Count >= switchAfter)
+ Switch ();
+ else {
+ list.Add (key, value);
+ return;
+ }
+ hashtable.Add (key, value);
+ }
+
+ public void Clear ()
+ {
+ if (caseInsensitive)
+ list = new ListDictionary (CaseInsensitiveComparer.Default);
+ else
+ list = new ListDictionary ();
+ hashtable = null;
+ }
+
+ public bool Contains (object key)
+ {
+ if (list != null)
+ return list.Contains (key);
+ return hashtable.Contains (key);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ if (list != null)
+ list.CopyTo (array, index);
+ else
+ hashtable.CopyTo (array, index);
+ }
+
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ if (list != null)
+ return list.GetEnumerator ();
+ return hashtable.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ public void Remove (object key)
+ {
+ if (list != null)
+ list.Remove (key);
+ else
+ hashtable.Remove (key);
+ }
+
+ private void Switch ()
+ {
+ if (caseInsensitive)
+ hashtable = new Hashtable (switchAfter + 1,
+ CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ else
+ hashtable = new Hashtable (switchAfter + 1);
+ IDictionaryEnumerator e = list.GetEnumerator ();
+ while (e.MoveNext ())
+ hashtable.Add (e.Key, e.Value);
+ list = null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/ListDictionary.cs b/mcs/class/System/System.Collections.Specialized/ListDictionary.cs
new file mode 100644
index 00000000000..40e6cb67581
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/ListDictionary.cs
@@ -0,0 +1,429 @@
+namespace System.Collections.Specialized
+{
+ [Serializable]
+ public class ListDictionary : IDictionary, ICollection, IEnumerable
+ {
+ private int count;
+ private int modCount;
+ private ListEntry root;
+ private IComparer comparer;
+
+
+ public ListDictionary()
+ {
+ count = 0;
+ modCount = 0;
+ comparer = null;
+ root = null;
+ }
+
+ public ListDictionary(IComparer comparer) : this()
+ {
+ this.comparer = comparer;
+ }
+
+ private bool AreEqual(object obj1, object obj2)
+ {
+ if (comparer != null) {
+ if (comparer.Compare(obj1, obj2) == 0) {
+ return true;
+ }
+ } else {
+ if (obj1.Equals(obj2)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private ListEntry FindEntry(object key)
+ {
+ if (key == null) {
+ throw new ArgumentNullException("Attempted lookup for a null key.");
+ }
+
+ if (root == null) {
+ return null;
+ } else {
+ ListEntry entry = root;
+
+ while (entry != null) {
+ if (AreEqual(key, entry.key)) {
+ return entry;
+ }
+
+ entry = entry.next;
+ }
+ }
+
+ return null;
+ }
+
+ private void AddImpl(object key, object value)
+ {
+ if (key == null) {
+ throw new ArgumentNullException("Attempted add with a null key.");
+ }
+
+ if (root == null) {
+ root = new ListEntry();
+ root.key = key;
+ root.value = value;
+ } else {
+ ListEntry entry = root;
+
+ while (entry != null) {
+ if (AreEqual(key, entry.key)) {
+ throw new ArgumentException("Duplicate key in add.");
+ }
+
+ if (entry.next == null) {
+ break;
+ }
+
+ entry = entry.next;
+ }
+
+ entry.next = new ListEntry();
+ entry.next.key = key;
+ entry.next.value = value;
+ }
+
+ count++;
+ modCount++;
+ }
+
+ // IEnumerable Interface
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new ListEntryEnumerator(this);
+ }
+
+ // ICollection Interface
+ public int Count {
+ get {
+ return count;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ int i = index;
+ foreach ( DictionaryEntry entry in this )
+ array.SetValue( entry, i++ );
+ }
+
+ // IDictionary Interface
+ public bool IsFixedSize
+ {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get {
+ return false;
+ }
+ }
+
+ // Indexer
+ public object this[object key]
+ {
+ get {
+ ListEntry entry = FindEntry(key);
+ return entry == null ? entry : entry.value;
+ }
+
+ set {
+ ListEntry entry = FindEntry(key);
+ if (entry != null)
+ entry.value = value;
+ else
+ AddImpl(key, value);
+ }
+ }
+
+ public ICollection Keys
+ {
+ get {
+ return new ListEntryCollection(this, true);
+ }
+ }
+
+ public ICollection Values
+ {
+ get {
+ return new ListEntryCollection(this, false);
+ }
+ }
+
+ public void Add(object key, object value)
+ {
+ AddImpl(key, value);
+ }
+
+ public void Clear()
+ {
+ root = null;
+ count = 0;
+ modCount++;
+ }
+
+ public bool Contains(object key)
+ {
+ return FindEntry(key) != null ? true : false;
+ }
+
+ public IDictionaryEnumerator GetEnumerator()
+ {
+ return new ListEntryEnumerator(this);
+ }
+
+ public void Remove(object key)
+ {
+ ListEntry entry = root;
+
+ for (ListEntry prev = null; entry != null; prev = entry, entry = entry.next) {
+ if (AreEqual(key, entry.key)) {
+ if (prev != null) {
+ prev.next = entry.next;
+ } else {
+ root = entry.next;
+ }
+
+ entry.value = null;
+ count--;
+ modCount++;
+ }
+ }
+ }
+
+
+ private class ListEntry
+ {
+ public object key = null;
+ public object value = null;
+ public ListEntry next = null;
+ }
+
+
+ private class ListEntryEnumerator : IEnumerator, IDictionaryEnumerator
+ {
+ private ListDictionary dict;
+ private bool isAtStart;
+ private ListEntry current;
+ private int version;
+
+ public ListEntryEnumerator(ListDictionary dict)
+ {
+ this.dict = dict;
+ version = dict.modCount;
+ Reset();
+ }
+
+ private void FailFast()
+ {
+ if (version != dict.modCount) {
+ throw new InvalidOperationException(
+ "The ListDictionary's contents changed after this enumerator was instantiated.");
+ }
+ }
+
+ public bool MoveNext()
+ {
+ FailFast();
+
+ if (isAtStart) {
+ current = dict.root;
+ isAtStart = false;
+ } else {
+ current = current.next;
+ }
+
+ return current != null ? true : false;
+ }
+
+ public void Reset()
+ {
+ FailFast();
+
+ isAtStart = true;
+ current = null;
+ }
+
+ public object Current
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's first element or after the last element.");
+ }
+
+ return new DictionaryEntry(current.key, current.value);
+ }
+ }
+
+ // IDictionaryEnumerator
+ public DictionaryEntry Entry
+ {
+ get {
+ FailFast();
+ return (DictionaryEntry) Current;
+ }
+ }
+
+ public object Key
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's first element or after the last element.");
+ }
+
+ return current.key;
+ }
+ }
+
+ public object Value
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's first element or after the last element.");
+ }
+
+ return current.value;
+ }
+ }
+ }
+
+ private class ListEntryCollection : ICollection
+ {
+ private ListDictionary dict;
+ private bool isKeyList;
+
+ public ListEntryCollection(ListDictionary dict, bool isKeyList)
+ {
+ this.dict = dict;
+ this.isKeyList = isKeyList;
+ }
+
+ // ICollection Interface
+ public int Count {
+ get {
+ return dict.Count;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get {
+ return dict.SyncRoot;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ int i = index;
+ foreach ( object obj in this )
+ array.SetValue( obj, i++ );
+ }
+
+ // IEnumerable Interface
+ public IEnumerator GetEnumerator()
+ {
+ return new ListEntryCollectionEnumerator(dict, isKeyList);
+ }
+
+ private class ListEntryCollectionEnumerator : IEnumerator
+ {
+ private ListDictionary dict;
+ private bool isKeyList;
+ private bool isAtStart;
+ private int version;
+ private ListEntry current;
+
+ public ListEntryCollectionEnumerator(ListDictionary dict, bool isKeyList)
+ {
+ this.dict = dict;
+ this.isKeyList = isKeyList;
+ isAtStart = true;
+ version = dict.modCount;
+ }
+
+ private void FailFast()
+ {
+ if (version != dict.modCount) {
+ throw new InvalidOperationException(
+ "The Collection's contents changed after this " +
+ "enumerator was instantiated.");
+ }
+ }
+
+ public object Current
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's " +
+ "first element or after the last element.");
+ }
+
+ return isKeyList ? current.key : current.value;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ FailFast();
+
+ if (isAtStart) {
+ current = dict.root;
+ isAtStart = false;
+ } else {
+ current = current.next;
+ }
+
+ return current != null ? true : false;
+ }
+
+ public void Reset()
+ {
+ FailFast();
+ isAtStart = true;
+ current = null;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs b/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
new file mode 100644
index 00000000000..09b4d952988
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
@@ -0,0 +1,518 @@
+/**
+ * System.Collections.Specialized.NamaValueCollection class implementation
+ *
+ * Author: Gleb Novodran
+ */
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Collections.Specialized
+{
+ [Serializable]
+ public abstract class NameObjectCollectionBase : ICollection, IEnumerable, ISerializable, IDeserializationCallback
+ {
+ private Hashtable m_ItemsContainer;
+ /// <summary>
+ /// Extends Hashtable based Items container to support storing null-key pairs
+ /// </summary>
+ private _Item m_NullKeyItem;
+ private ArrayList m_ItemsArray;
+ private IHashCodeProvider m_hashprovider;
+ private IComparer m_comparer;
+ private int m_defCapacity;
+ private bool m_readonly;
+
+ internal IComparer Comparer {
+ get {return m_comparer;}
+ }
+
+ internal IHashCodeProvider HashCodeProvider {
+ get {return m_hashprovider;}
+ }
+
+ internal protected /*?*/ class _Item
+ {
+ public string key;
+ public object value;
+ public _Item(string key, object value)
+ {
+ this.key = key;
+ this.value = value;
+ }
+ }
+ /// <summary>
+ /// Implements IEnumerable interface for KeysCollection
+ /// </summary>
+ [Serializable]
+ internal protected /*?*/ class _KeysEnumerator : IEnumerator
+ {
+ private NameObjectCollectionBase m_collection;
+ private int m_position;
+ /*private*/internal _KeysEnumerator(NameObjectCollectionBase collection)
+ {
+ m_collection = collection;
+ Reset();
+ }
+ public object Current
+ {
+
+ get{
+ if ((m_position<m_collection.Count)||(m_position<0))
+ return m_collection.BaseGetKey(m_position);
+ else
+ throw new InvalidOperationException();
+ }
+
+ }
+ public bool MoveNext()
+ {
+ return ((++m_position)<m_collection.Count)?true:false;
+ }
+ public void Reset()
+ {
+ m_position = -1;
+ }
+ }
+
+ /// <summary>
+ /// SDK: Represents a collection of the String keys of a collection.
+ /// </summary>
+ public class KeysCollection : ICollection, IEnumerable
+ {
+ private NameObjectCollectionBase m_collection;
+
+ internal/*protected?*/ KeysCollection(NameObjectCollectionBase collection)
+ {
+ this.m_collection = collection;
+ }
+ public virtual string Get( int index )
+ {
+ return m_collection.BaseGetKey(index);
+ //throw new Exception("Not implemented yet");
+ }
+
+ // ICollection methods -----------------------------------
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="arr"></param>
+ /// <param name="index"></param>
+ public virtual void /*ICollection*/ CopyTo(Array arr, int index)
+ {
+ if (arr==null)
+ throw new ArgumentNullException("array can't be null");
+ IEnumerator en = this.GetEnumerator();
+ int i = index;
+ while (en.MoveNext())
+ {
+ arr.SetValue(en.Current,i);
+ i++;
+ }
+ }
+
+ public virtual bool IsSynchronized
+ {
+ get{
+ throw new Exception("Not implemented yet");
+ }
+ }
+ public virtual object SyncRoot
+ {
+ get{
+ throw new Exception("Not implemented yet");
+ }
+ }
+ /// <summary>
+ /// Gets the number of keys in the NameObjectCollectionBase.KeysCollection
+ /// </summary>
+ public int Count
+ {
+ get{
+ return m_collection.Count;
+ //throw new Exception("Not implemented yet");
+ }
+ }
+
+ [MonoTODO]
+ public string this [int index] {
+ get { throw new NotImplementedException (); }
+ }
+
+ // IEnumerable methods --------------------------------
+ /// <summary>
+ /// SDK: Returns an enumerator that can iterate through the NameObjectCollectionBase.KeysCollection.
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator GetEnumerator()
+ {
+ return new _KeysEnumerator(m_collection);
+// throw new Exception("Not implemented yet");
+ }
+ }
+
+
+
+ //--------------- Protected Instance Constructors --------------
+
+ /// <summary>
+ /// SDK: Initializes a new instance of the NameObjectCollectionBase class that is empty.
+ /// </summary>
+ [MonoTODO]
+ protected NameObjectCollectionBase():base()
+ {
+ m_readonly = false;
+
+ m_hashprovider = CaseInsensitiveHashCodeProvider.Default;
+ m_comparer = CaseInsensitiveComparer.Default;
+ m_defCapacity = 0;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null;*/
+ //TODO: consider common Reset() method
+ }
+
+ protected NameObjectCollectionBase( int capacity )
+ {
+ m_readonly = false;
+
+ m_hashprovider = CaseInsensitiveHashCodeProvider.Default;
+ m_comparer = CaseInsensitiveComparer.Default;
+ m_defCapacity = capacity;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_defCapacity, m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null; */
+ //throw new Exception("Not implemented yet");
+ }
+ protected NameObjectCollectionBase( IHashCodeProvider hashProvider, IComparer comparer )
+ {
+ m_readonly = false;
+
+ m_hashprovider = hashProvider;
+ m_comparer = comparer;
+ m_defCapacity = 0;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null; */
+ //throw new Exception("Not implemented yet");
+ }
+ protected NameObjectCollectionBase( SerializationInfo info, StreamingContext context )
+ {
+ throw new Exception("Not implemented yet");
+ }
+ protected NameObjectCollectionBase( int capacity, IHashCodeProvider hashProvider, IComparer comparer )
+ {
+ m_readonly = false;
+
+ m_hashprovider = hashProvider;
+ m_comparer = comparer;
+ m_defCapacity = capacity;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_defCapacity,m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null; */
+
+ //throw new Exception("Not implemented yet");
+ }
+
+ private void Init(){
+ m_ItemsContainer = new Hashtable(m_defCapacity,m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null;
+ }
+ //--------------- Public Instance Properties -------------------
+ public virtual NameObjectCollectionBase.KeysCollection Keys
+ {
+ get
+ {
+ return new KeysCollection(this);
+ //throw new Exception("Not implemented yet");
+ }
+ }
+
+ //--------------- Public Instance Methods ----------------------
+ //
+ /// <summary>
+ /// SDK: Returns an enumerator that can iterate through the NameObjectCollectionBase.
+ ///
+ /// <remark>This enumerator returns the keys of the collection as strings.</remark>
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator GetEnumerator()
+ {
+ return new _KeysEnumerator(this);
+ }
+ // GetHashCode
+
+ // ISerializable
+ public virtual void /*ISerializable*/ GetObjectData( SerializationInfo info, StreamingContext context )
+ {
+ throw new Exception("Not implemented yet");
+ }
+
+ // ICollection
+ public virtual int Count
+ {
+ get{
+ return m_ItemsArray.Count;
+ //throw new Exception("Not implemented yet");
+ }
+ }
+ bool ICollection.IsSynchronized
+ {
+ get { return false; }
+ }
+ object ICollection.SyncRoot
+ {
+ get { return this; }
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ // IDeserializationCallback
+ public virtual void OnDeserialization( object sender)
+ {
+ throw new Exception("Not implemented yet");
+ }
+
+ //--------------- Protected Instance Properties ----------------
+ /// <summary>
+ /// SDK: Gets or sets a value indicating whether the NameObjectCollectionBase instance is read-only.
+ /// </summary>
+ protected bool IsReadOnly
+ {
+ get{
+ return m_readonly;
+ }
+ set{
+ m_readonly=value;
+ }
+ }
+
+ //--------------- Protected Instance Methods -------------------
+ /// <summary>
+ /// Adds an Item with the specified key and value into the <see cref="NameObjectCollectionBase"/>NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <param name="value"></param>
+ protected void BaseAdd( string name, object value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+
+ _Item newitem=new _Item(name, value);
+
+ if (name==null){
+ //todo: consider nullkey entry
+ if (m_NullKeyItem==null)
+ m_NullKeyItem = newitem;
+ }
+ else
+ if (m_ItemsContainer[name]==null){
+ m_ItemsContainer.Add(name,newitem);
+ }
+ m_ItemsArray.Add(newitem);
+
+// throw new Exception("Not implemented yet");
+ }
+ protected void BaseClear()
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ Init();
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// SDK: Gets the value of the entry at the specified index of the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="index"></param>
+ /// <returns></returns>
+ protected object BaseGet( int index )
+ {
+ return ((_Item)m_ItemsArray[index]).value;
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// SDK: Gets the value of the first entry with the specified key from the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <remark>CAUTION: The BaseGet method does not distinguish between a null reference which is returned because the specified key is not found and a null reference which is returned because the value associated with the key is a null reference.</remark>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ protected object BaseGet( string name )
+ {
+ _Item item = FindFirstMatchedItem(name);
+ /// CAUTION: The BaseGet method does not distinguish between a null reference which is returned because the specified key is not found and a null reference which is returned because the value associated with the key is a null reference.
+ if (item==null)
+ return null;
+ else
+ return item.value;
+ }
+
+ /// <summary>
+ /// SDK:Returns a String array that contains all the keys in the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <returns>A String array that contains all the keys in the NameObjectCollectionBase instance.</returns>
+ protected string[] BaseGetAllKeys()
+ {
+ int cnt = m_ItemsArray.Count;
+ string[] allKeys = new string[cnt];
+ for(int i=0; i<cnt; i++)
+ allKeys[i] = BaseGetKey(i);//((_Item)m_ItemsArray[i]).key;
+
+ return allKeys;
+ }
+
+ /// <summary>
+ /// SDK: Returns an Object array that contains all the values in the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <returns>An Object array that contains all the values in the NameObjectCollectionBase instance.</returns>
+ protected object[] BaseGetAllValues()
+ {
+ int cnt = m_ItemsArray.Count;
+ object[] allValues = new object[cnt];
+ for(int i=0; i<cnt; i++)
+ allValues[i] = BaseGet(i);
+
+ return allValues;
+// throw new Exception("Not implemented yet");
+ }
+ [MonoTODO]
+ protected object[] BaseGetAllValues( Type type )
+ {
+ if (type == null)
+ throw new ArgumentNullException("'type' argument can't be null");
+ // TODO: implements this
+
+ throw new Exception("Not implemented yet");
+ }
+
+ protected string BaseGetKey( int index )
+ {
+ return ((_Item)m_ItemsArray[index]).key;
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// Gets a value indicating whether the NameObjectCollectionBase instance contains entries whose keys are not a null reference
+ /// </summary>
+ /// <returns>true if the NameObjectCollectionBase instance contains entries whose keys are not a null reference otherwise, false.</returns>
+ protected bool BaseHasKeys()
+ {
+ return (m_ItemsContainer.Count>0);
+// throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="name"></param>
+ [MonoTODO]
+ protected void BaseRemove( string name )
+ {
+ int cnt = 0;
+ String key;
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ if (name!=null)
+ {
+ m_ItemsContainer.Remove(name);
+ }
+ else {
+ m_NullKeyItem = null;
+ }
+
+ cnt = m_ItemsArray.Count;
+ for (int i=0 ; i< cnt; ){
+ key=BaseGetKey(i);
+ // TODO: consider case-sensivity
+ if (String.Compare(key,name)==0){
+ m_ItemsArray.RemoveAt(i);
+ cnt--;
+ }
+ else
+ i++;
+
+ }
+// throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="index"></param>
+ /// <LAME>This function implemented the way Microsoft implemented it -
+ /// item is removed from hashtable and array without considering the case when there are two items with the same key but different values in array.
+ /// E.g. if
+ /// hashtable is [("Key1","value1")] and array contains [("Key1","value1")("Key1","value2")] then
+ /// after RemoveAt(1) the collection will be in following state:
+ /// hashtable:[]
+ /// array: [("Key1","value1")]
+ /// It's ok only then the key is uniquely assosiated with the value
+ /// To fix it a comparsion of objects stored under the same key in the hashtable and in the arraylist should be added
+ /// </LAME>>
+ [MonoTODO]
+ protected void BaseRemoveAt( int index )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ string key = BaseGetKey(index);
+ if (key!=null){
+ // TODO: see LAME description above
+ m_ItemsContainer.Remove(key);
+ }
+ else
+ m_NullKeyItem = null;
+ m_ItemsArray.RemoveAt(index);
+// throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// SDK: Sets the value of the entry at the specified index of the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="index"></param>
+ /// <param name="value"></param>
+ protected void BaseSet( int index, object value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ _Item item = (_Item)m_ItemsArray[index];
+ item.value = value;
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// Sets the value of the first entry with the specified key in the NameObjectCollectionBase instance, if found; otherwise, adds an entry with the specified key and value into the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="name">The String key of the entry to set. The key can be a null reference </param>
+ /// <param name="value">The Object that represents the new value of the entry to set. The value can be a null reference</param>
+ protected void BaseSet( string name, object value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ _Item item = FindFirstMatchedItem(name);
+ if (item!=null)
+ item.value=value;
+ else
+ BaseAdd(name, value);
+
+ //throw new Exception("Not implemented yet");
+ }
+ [MonoTODO]
+ private _Item FindFirstMatchedItem(string name)
+ {
+ if (name!=null)
+ return (_Item)m_ItemsContainer[name];
+ else {
+ //TODO: consider null key case
+ return m_NullKeyItem;
+ //throw new Exception("Not implemented yet");
+ }
+
+ }
+ //~Object();
+
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
new file mode 100644
index 00000000000..cce56a3d274
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
@@ -0,0 +1,364 @@
+/**
+ * System.Collections.Specialized.NamaValueCollection class implementation
+ *
+ * Author: Gleb Novodran
+ */
+// created on 7/21/2001 at 5:15 PM
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace System.Collections.Specialized{
+ [Serializable]
+ public class NameValueCollection : NameObjectCollectionBase
+ {
+ string[] cachedAllKeys = null;
+ string[] cachedAll = null;
+
+ //--------------------- Constructors -----------------------------
+
+ /// <summary> SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ /// has the default initial capacity and uses the default case-insensitive hash code provider and the default case-insensitive comparer.
+ /// </summary>
+ public NameValueCollection() : base()
+ {
+
+ }
+
+ /// <summary> SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ /// has the specified initial capacity and uses the default case-insensitive hash code provider and the default case-insensitive comparer.
+ ///</summary>
+ public NameValueCollection( int capacity ) : base(capacity)
+ {
+
+ }
+
+ /// <summary> SDK: Copies the entries from the specified NameValueCollection to a new
+ /// NameValueCollection with the same initial capacity as the number of entries copied
+ /// and using the same case-insensitive hash code provider and the same case-insensitive
+ /// comparer as the source collection.
+ /// </summary>
+ /// TODO: uncomment constructor below after it will be possible to compile NameValueCollection and
+ /// NameObjectCollectionBase to the same assembly
+
+ public NameValueCollection( NameValueCollection col ) : base(col.HashCodeProvider,col.Comparer)
+ {
+ if (col==null)
+ throw new ArgumentNullException("Null argument is not allowed");
+ Add(col);
+ }
+
+ ///<summary>SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ ///has the default initial capacity and uses the specified hash code provider and
+ ///the specified comparer.</summary>
+ public NameValueCollection( IHashCodeProvider hashProvider, IComparer comparer )
+ : base(hashProvider, comparer)
+ {
+
+ }
+
+ /// <summary>
+ /// SDK: Copies the entries from the specified NameValueCollection to a new NameValueCollection
+ /// with the specified initial capacity or the same initial capacity as the number of entries
+ /// copied, whichever is greater, and using the default case-insensitive hash code provider and
+ /// the default case-insensitive comparer.
+ /// </summary>
+ /// TODO: uncomment constructor below after it will be possible to compile NameValueCollection and
+ /// NameObjectCollectionBase to the same assembly
+
+/* public NameValueCollection( int capacity, NameValueCollection col )
+ : base(capacity, col.get_HashCodeProvider(),col.Comparer)
+ {
+ if (col==null)
+ throw new ArgumentNullException("Null argument is not allowed");
+ Add(col);
+ }
+*/
+ /// <summary>
+ /// SDK: Initializes a new instance of the NameValueCollection class that is serializable
+ /// and uses the specified System.Runtime.Serialization.SerializationInfo and
+ /// System.Runtime.Serialization.StreamingContext.
+ /// </summary>
+ protected NameValueCollection( SerializationInfo info, StreamingContext context )
+ :base(info, context)
+ {
+
+ }
+
+ /// <summary>
+ /// SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ /// has the specified initial capacity and uses the specified hash code provider and
+ /// the specified comparer.
+ /// </summary>
+ public NameValueCollection( int capacity, IHashCodeProvider hashProvider, IComparer comparer )
+ :base(capacity, hashProvider, comparer)
+ {
+
+ }
+
+ //----------------------- Public Instance Properties -------------------------------
+
+
+ ///<summary> SDK:
+ /// Gets all the keys in the NameValueCollection.
+ /// The arrays returned by AllKeys are cached for better performance and are
+ /// automatically refreshed when the collection changes. A derived class can
+ /// invalidate the cached version by calling InvalidateCachedArrays, thereby
+ /// forcing the arrays to be recreated.
+ /// </summary>
+ public virtual string[] AllKeys
+ {
+ get {
+ if (cachedAllKeys==null)
+ cachedAllKeys = BaseGetAllKeys();
+ return this.cachedAllKeys;
+ }
+ }
+
+ public string this[ int index ]
+ {
+ get{
+ return this.Get(index);
+ }
+ }
+
+ public string this[ string name ] {
+ get{
+ return this.Get(name);
+ }
+ set{
+ this.Set(name,value);
+ }
+ }
+
+/////////////////////////////// Public Instance Methods //////////////////////////////
+
+ /// <summary> SDK: Copies the entries in the specified NameValueCollection
+ /// to the current NameValueCollection.</summary>
+ /// LAMESPEC: see description that comes this Add(string, string)
+
+ public void Add (NameValueCollection c)
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException ("Collection is read-only");
+ if (c == null)
+ throw new ArgumentNullException ();
+
+ InvalidateCachedArrays ();
+ int max = c.Count;
+ for (int i=0; i < max; i++){
+ string key = c.GetKey (i);
+ string [] values = c.GetValues (i);
+ foreach (string value in values)
+ Add (key, value);
+ }
+ }
+
+
+ /// <summary> SDK: Adds an entry with the specified name and value to the
+ /// NameValueCollection. </summary>
+ ///
+ /// LAMESPEC:
+ /// in SDK doc: If the same value already exists under the same key in the collection,
+ /// the new value overwrites the old value.
+ /// however the Microsoft implemenatation in this case just adds one more value
+ /// in other words after
+ /// <code>
+ /// NameValueCollection nvc;
+ /// nvc.Add("LAZY","BASTARD")
+ /// nvc.Add("LAZY","BASTARD")
+ /// </code>
+ /// nvc.Get("LAZY") will be "BASTARD,BASTARD" instead of "BASTARD"
+
+ public virtual void Add( string name, string val )
+ {
+
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+
+ InvalidateCachedArrays();
+ ArrayList values = (ArrayList)BaseGet(name);
+ if (values==null){
+ values = new ArrayList();
+ if (val!=null)
+ values.Add(val);
+ BaseAdd(name,values);
+ }
+ else {
+ if (val!=null)
+ values.Add(val);
+ }
+
+ }
+
+ /// <summary> SDK: Invalidates the cached arrays and removes all entries from
+ /// the NameValueCollection.</summary>
+
+ public void Clear(){
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ InvalidateCachedArrays();
+ BaseClear();
+ }
+
+ /// <summary> SDK: Copies the entire NameValueCollection to a compatible one-dimensional Array,
+ /// starting at the specified index of the target array.</summary>
+
+ [MonoTODO]
+ public void CopyTo( Array dest, int index )
+ {
+ if (dest==null)
+ throw new ArgumentNullException("Null argument - dest");
+ if (index<0)
+ throw new ArgumentOutOfRangeException("index is less than 0");
+// throw new Exception("Not implemented yet");
+
+ //TODO: add implementation here
+ if (cachedAll==null)
+ RefreshCachedAll();
+ cachedAll.CopyTo(dest, index);
+ }
+ protected void RefreshCachedAll()
+ {
+ this.cachedAll=null;
+ int max = this.Count;
+ cachedAll = new string[max];
+ for(int i=0;i<max;i++){
+ cachedAll[i] = this.Get(i);
+ }
+
+ }
+
+ /// <summary> SDK: Gets the values at the specified index of the NameValueCollection combined
+ /// into one comma-separated list.</summary>
+
+ public virtual string Get( int index )
+ {
+ ArrayList values = (ArrayList)BaseGet(index);
+ // if index is out of range BaseGet throws an ArgumentOutOfRangeException
+
+ return AsSingleString(values);
+
+ }
+
+ /**
+ * SDK: Gets the values associated with the specified key from the NameValueCollection
+ * combined into one comma-separated list.
+ */
+ public virtual string Get( string name )
+ {
+ ArrayList values = (ArrayList)BaseGet(name);
+/* if (values==null)
+ Console.WriteLine("BaseGet returned null");*/
+ return AsSingleString(values);
+// -------------------------------------------------------------
+
+ }
+ /// <summary></summary>
+ [MonoTODO]
+ private static string AsSingleString(ArrayList values)
+ {
+ const char separator = ',';
+
+ if (values==null)
+ return null;
+ int max = values.Count;
+
+ if (max==0)
+ return null;
+ //TODO: reimplement this
+ StringBuilder sb = new StringBuilder((string)values[0]);
+ for (int i=1; i<max; i++){
+ sb.Append(separator);
+ sb.Append(values[i]);
+ }
+
+ return sb.ToString();
+ }
+
+
+ /// <summary>SDK: Gets the key at the specified index of the NameValueCollection.</summary>
+ public virtual string GetKey( int index )
+ {
+ return BaseGetKey(index);
+ }
+
+
+ /// <summary>SDK: Gets the values at the specified index of the NameValueCollection.</summary>
+
+ public virtual string[] GetValues( int index )
+ {
+ ArrayList values = (ArrayList)BaseGet(index);
+
+ return AsStringArray(values);
+ }
+
+
+ public virtual string[] GetValues( string name )
+ {
+ ArrayList values = (ArrayList)BaseGet(name);
+
+ return AsStringArray(values);
+ }
+
+ private static string[] AsStringArray(ArrayList values)
+ {
+ if (values == null)
+ return null;
+ int max = values.Count;//get_Count();
+ if (max==0)
+ return null;
+
+ string[] valArray =new string[max];
+ values.CopyTo(valArray);
+ return valArray;
+ }
+
+
+ /// <summary>
+ /// SDK: Gets a value indicating whether the NameValueCollection contains keys that
+ /// are not a null reference
+ /// </summary>
+
+ public bool HasKeys()
+ {
+ return BaseHasKeys();
+ }
+
+ public virtual void Remove( string name )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ InvalidateCachedArrays();
+ BaseRemove(name);
+
+ }
+
+ /// <summary>
+ /// Sets the value of an entry in the NameValueCollection.
+ /// </summary>
+ public virtual void Set( string name, string value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ InvalidateCachedArrays();
+
+ ArrayList values = new ArrayList();
+ values.Add(value);
+ BaseSet(name,values);
+
+ }
+
+
+//---------------------- Protected Instance Methods ----------------------
+
+ protected void InvalidateCachedArrays()
+ {
+ cachedAllKeys = null;
+ cachedAll = null;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/StringCollection.cs b/mcs/class/System/System.Collections.Specialized/StringCollection.cs
new file mode 100755
index 00000000000..ac36d454884
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/StringCollection.cs
@@ -0,0 +1,291 @@
+/* System.Collections.Specialized.StringCollection.cs
+ * Authors:
+ * John Barnette (jbarn@httcb.net)
+ * Sean MacIsaac (macisaac@ximian.com)
+ *
+ * Copyright (C) 2001 John Barnette
+ * (C) Ximian, Inc. http://www.ximian.com
+ *
+ * NOTES:
+ * I bet Microsoft uses ArrayList as a backing store for this; I wonder what
+ * the performance difference will be.
+*/
+
+using System;
+
+namespace System.Collections.Specialized {
+ [Serializable]
+ public class StringCollection : IList, ICollection, IEnumerable {
+ private static int InitialCapacity = 11;
+ private static float CapacityMultiplier = 2.0f;
+
+ private int count;
+ private int modCount;
+
+ private string[] entries;
+
+ // Public Constructor
+ public StringCollection() {
+ entries = new string[InitialCapacity];
+ count = 0;
+ modCount = 0;
+ }
+
+ // Public Instance Properties
+ public int Count {
+ get { return count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set { this[index] = value.ToString(); }
+ }
+
+ public string this[int index] {
+ get {
+ if (index < 0 || index >= count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ return entries[index];
+ }
+
+ set {
+ if (index < 0 || index >= count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ modCount++;
+ entries[index] = value;
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+
+ // Public Instance Methods
+
+ int IList.Add(object value) {
+ return Add(value.ToString());
+ }
+
+ public int Add(string value) {
+ modCount++;
+ Resize(count + 1);
+ int index = count++;
+ entries[index] = value;
+
+ return index;
+ }
+
+ public void AddRange(string[] value) {
+ int numEntries = value.Length;
+
+ modCount++;
+ Resize(count + numEntries);
+ Array.Copy(value, 0, entries, count, numEntries);
+ count += numEntries;
+ }
+
+ public void Clear() {
+ modCount++;
+ count = 0;
+ }
+
+ bool IList.Contains(object value) {
+ return Contains(value.ToString());
+ }
+
+ public bool Contains(string value) {
+ foreach (string entry in entries) {
+ if (value.Equals(entry)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void ICollection.CopyTo(Array array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException("array");
+ } else if (index < 0) {
+ throw new ArgumentOutOfRangeException("index");
+ } else if (array.Rank > 1) {
+ throw new ArgumentException("Rank must be 1", "array");
+ } else if (array.Length - index < count) {
+ throw new ArgumentException("Count is smaller than the number of objects to copy",
+ "array");
+ }
+
+ Array.Copy(entries, 0, array, index, count);
+ }
+
+ public void CopyTo(string[] array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException("array");
+ } else if (index < 0) {
+ throw new ArgumentOutOfRangeException("index");
+ } else if (array.Rank > 1) {
+ throw new ArgumentException("Rank must be 1", "array");
+ } else if (array.Length - index < count) {
+ throw new ArgumentException("Count is smaller than the number of objects to copy",
+ "array");
+ }
+
+ Array.Copy(entries, 0, array, index, count);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator() {
+ return new InternalEnumerator(this);
+ }
+
+ public StringEnumerator GetEnumerator() {
+ return new StringEnumerator(this);
+ }
+
+ int IList.IndexOf(object value) {
+ return IndexOf(value.ToString());
+ }
+
+ public int IndexOf(string value) {
+ for (int i = 0; i < count; i++) {
+ if (value.Equals(entries[i])) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ void IList.Insert(int index, object value) {
+ Insert(index, value.ToString());
+ }
+
+ public void Insert(int index, string value) {
+ if (index < 0 || index > count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ modCount++;
+ Resize(count + 1);
+ Array.Copy(entries, index, entries, index + 1, count - index);
+ entries[index] = value;
+ count++;
+ }
+
+
+ void IList.Remove(object value) {
+ Remove(value.ToString());
+ }
+
+ public void Remove(string value) {
+ for (int i = 0; i < count; i++) {
+ if (value.Equals(entries[i])) {
+ RemoveAt(i);
+ return;
+ }
+ }
+ }
+
+ public void RemoveAt(int index) {
+ if (index < 0 || index >= count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ int remaining = count - index - 1;
+
+ modCount++;
+
+ if (remaining > 0) {
+ Array.Copy(entries, index + 1, entries, index, remaining);
+ }
+
+ count--;
+ entries[count] = null;
+ }
+
+
+ // Private Instance Methods
+
+ private void Resize(int minSize) {
+ int oldSize = entries.Length;
+
+ if (minSize > oldSize) {
+ string[] oldEntries = entries;
+ int newSize = (int) (oldEntries.Length * CapacityMultiplier);
+
+ if (newSize < minSize) newSize = minSize;
+ entries = new string[newSize];
+ Array.Copy(oldEntries, 0, entries, 0, count);
+ }
+ }
+
+
+ // Private classes
+
+ private class InternalEnumerator : IEnumerator {
+ private StringCollection data;
+ private int index;
+ private int myModCount;
+
+ public InternalEnumerator(StringCollection data) {
+ this.data = data;
+ myModCount = data.modCount;
+ index = -1;
+ }
+
+
+ // Public Instance Properties
+
+ public object Current {
+ get {
+ if (myModCount != data.modCount) {
+ throw new InvalidOperationException();
+ } else if (index < 0 || index > data.count - 1) {
+ throw new InvalidOperationException();
+ }
+
+ return data[index];
+ }
+ }
+
+
+ // Public Instance Methods
+
+ public bool MoveNext() {
+ if (myModCount != data.modCount) {
+ throw new InvalidOperationException();
+ }
+
+ if (++index >= data.count) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Reset() {
+ if (myModCount != data.modCount) {
+ throw new InvalidOperationException();
+ }
+
+ index = -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/StringDictionary.cs b/mcs/class/System/System.Collections.Specialized/StringDictionary.cs
new file mode 100644
index 00000000000..2e5bc2bfe10
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/StringDictionary.cs
@@ -0,0 +1,97 @@
+namespace System.Collections.Specialized
+{
+ public class StringDictionary : IEnumerable
+ {
+ protected Hashtable table;
+
+ public StringDictionary()
+ {
+ table = new Hashtable();
+ }
+
+ // Public Instance Properties
+
+ public virtual int Count
+ {
+ get {
+ return table.Count;
+ }
+ }
+
+ public virtual bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public virtual string this[string key]
+ {
+ get {
+ return (string) table[key.ToLower()];
+ }
+
+ set {
+ table[key.ToLower()] = value;
+ }
+ }
+
+ public virtual ICollection Keys
+ {
+ get {
+ return table.Keys;
+ }
+ }
+
+ public virtual ICollection Values
+ {
+ get {
+ return table.Values;
+ }
+ }
+
+ public virtual object SyncRoot
+ {
+ get {
+ return table.SyncRoot;
+ }
+ }
+
+ // Public Instance Methods
+
+ public virtual void Add(string key, string value)
+ {
+ table.Add(key.ToLower(), value);
+ }
+
+ public virtual void Clear()
+ {
+ table.Clear();
+ }
+
+ public virtual bool ContainsKey(string key)
+ {
+ return table.ContainsKey(key.ToLower());
+ }
+
+ public virtual bool ContainsValue(string value)
+ {
+ return table.ContainsValue(value);
+ }
+
+ public virtual void CopyTo(Array array, int index)
+ {
+ table.CopyTo(array, index);
+ }
+
+ public virtual IEnumerator GetEnumerator()
+ {
+ return table.GetEnumerator();
+ }
+
+ public virtual void Remove(string key)
+ {
+ table.Remove(key.ToLower());
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Collections.Specialized/StringEnumerator.cs b/mcs/class/System/System.Collections.Specialized/StringEnumerator.cs
new file mode 100644
index 00000000000..8be9d7c5a6e
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/StringEnumerator.cs
@@ -0,0 +1,36 @@
+/* System.Collections.Specialized.StringEnumerator.cs
+ * Authors:
+ * John Barnette (jbarn@httcb.net)
+ *
+ * Copyright (C) 2001 John Barnette
+*/
+
+namespace System.Collections.Specialized {
+ public class StringEnumerator {
+ private StringCollection coll;
+ private IEnumerator enumerable;
+
+ // assembly-scoped constructor
+ internal StringEnumerator(StringCollection coll) {
+ this.coll = coll;
+ this.enumerable = ((IEnumerable)coll).GetEnumerator();
+ }
+
+ // Public Instance Properties
+
+ public string Current {
+ get { return (string) enumerable.Current; }
+ }
+
+
+ // Public Instance Methods
+
+ public bool MoveNext() {
+ return enumerable.MoveNext();
+ }
+
+ public void Reset() {
+ enumerable.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventArgs.cs b/mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventArgs.cs
new file mode 100644
index 00000000000..d7aca22a765
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventArgs.cs
@@ -0,0 +1,43 @@
+// System.ComponentModel.Design.ActiveDesignerEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.Serialization;
+
+namespace System.ComponentModel.Design
+{
+ public class ActiveDesignerEventArgs : EventArgs
+ {
+ private IDesignerHost oldDesigner;
+ private IDesignerHost newDesigner;
+
+ public ActiveDesignerEventArgs (IDesignerHost oldDesigner, IDesignerHost newDesigner) {
+ this.oldDesigner = oldDesigner;
+ this.newDesigner = newDesigner;
+ }
+
+ public IDesignerHost NewDesigner {
+ get {
+ return newDesigner;
+ }
+
+ set {
+ newDesigner = value;
+ }
+ }
+
+ public IDesignerHost OldDesigner {
+ get {
+ return oldDesigner;
+ }
+
+ set {
+ newDesigner = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventHandler.cs b/mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventHandler.cs
new file mode 100644
index 00000000000..77afb24efc8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/ActiveDesignerEventHandler.cs
@@ -0,0 +1,15 @@
+// System.ComponentModel.Design.ActiveDesignerEventHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.Serialization;
+
+namespace System.ComponentModel.Design
+{
+ [Serializable]
+ public delegate void ActiveDesignerEventHandler (object sender, ActiveDesignerEventArgs e);
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/Changelog b/mcs/class/System/System.ComponentModel.Design/Changelog
new file mode 100644
index 00000000000..4d4f8b951a5
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/Changelog
@@ -0,0 +1,23 @@
+2002-12-05 Alejandro Sánchez Acosta <raciel@gnome.org>
+
+ * ActiveDesignerEventArgs.cs,
+ ActiveDesignerEventHandler.cs: Added
+
+
+
+2002-11-30 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * System.ComponentModel.Design/CommandID.cs
+ System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs
+ System.ComponentModel.Design/DesignerTransactionCloseEventHandler.cs
+ System.ComponentModel.Design/DesignerTransaction.cs
+ System.ComponentModel.Design/DesignerVerbCollection.cs
+ System.ComponentModel.Design/DesignerVerb.cs
+ System.ComponentModel.Design/IDesigner.cs
+ System.ComponentModel.Design/IDesignerHost.cs
+ System.ComponentModel.Design/IResourceService.cs
+ System.ComponentModel.Design/ISelectionService.cs
+ System.ComponentModel.Design/IServiceContainer.cs
+ System.ComponentModel.Design/MenuCommand.cs
+ System.ComponentModel.Design/ServiceCreatorCallback.cs : Added.
+
diff --git a/mcs/class/System/System.ComponentModel.Design/CommandID.cs b/mcs/class/System/System.ComponentModel.Design/CommandID.cs
new file mode 100644
index 00000000000..60d0997812e
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/CommandID.cs
@@ -0,0 +1,61 @@
+// System.ComponentModel.Design.CommandID.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public class CommandID
+ {
+
+ [MonoTODO]
+ internal CommandID (string text) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public CommandID (Guid menuGroup, int commandID) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual Guid Guid
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual int ID
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/DesignerTransaction.cs b/mcs/class/System/System.ComponentModel.Design/DesignerTransaction.cs
new file mode 100644
index 00000000000..b8d8e268bad
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/DesignerTransaction.cs
@@ -0,0 +1,53 @@
+// System.ComponentModel.Design.DesignerTransaction.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System;
+
+namespace System.ComponentModel.Design
+{
+ public abstract class DesignerTransaction : IDisposable
+ {
+ [MonoTODO]
+ public DesignerTransaction () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DesignerTransaction (string description) {
+ throw new NotImplementedException ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ this.Dispose();
+ }
+
+ public abstract void Dispose();
+
+ public bool Canceled
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool Committed
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string Description
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs b/mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs
new file mode 100644
index 00000000000..9069611c026
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs
@@ -0,0 +1,28 @@
+// System.ComponentModel.Design.DesignerTransactionCloseEventArgs.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public class DesignerTransactionCloseEventArgs : EventArgs
+ {
+ private bool commit;
+ public DesignerTransactionCloseEventArgs (bool commit) {
+ this.commit = commit;
+ }
+
+ public bool TransactionCommitted
+ {
+ get {
+ return commit;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventHandler.cs b/mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventHandler.cs
new file mode 100644
index 00000000000..cbb38306cac
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/DesignerTransactionCloseEventHandler.cs
@@ -0,0 +1,16 @@
+// System.ComponentModel.Design.DesignerTransactionCloseEventHandler.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [Serializable]
+ [ComVisible(true)]
+ public delegate void DesignerTransactionCloseEventHandler (object sender, DesignerTransactionCloseEventArgs e);
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/DesignerVerb.cs b/mcs/class/System/System.ComponentModel.Design/DesignerVerb.cs
new file mode 100644
index 00000000000..d7e3f5691f8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/DesignerVerb.cs
@@ -0,0 +1,41 @@
+// System.ComponentModel.Design.DesignerVerb.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public class DesignerVerb : MenuCommand
+ {
+ [MonoTODO]
+ public DesignerVerb (string text, EventHandler handler) : base (handler, new CommandID (text)){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DesignerVerb (string text, EventHandler handler, CommandID startCommandID)
+ : base (handler, startCommandID) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string Text
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/DesignerVerbCollection.cs b/mcs/class/System/System.ComponentModel.Design/DesignerVerbCollection.cs
new file mode 100644
index 00000000000..14a07caef91
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/DesignerVerbCollection.cs
@@ -0,0 +1,111 @@
+// System.ComponentModel.Design.DesignerVerbCollection.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public class DesignerVerbCollection : CollectionBase
+ {
+ [MonoTODO]
+ public DesignerVerbCollection(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DesignerVerbCollection (DesignerVerb[] value){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DesignerVerb this[int index]
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Add (DesignerVerb value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange (DesignerVerb[] value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains (DesignerVerb value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo (DesignerVerb[] array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf (DesignerVerb value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Insert (int index, DesignerVerb value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnClear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnInsert (int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnRemove (int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnSet(int index, object oldValue, object newValue)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void OnValidate(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove (DesignerVerb value)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/IDesigner.cs b/mcs/class/System/System.ComponentModel.Design/IDesigner.cs
new file mode 100644
index 00000000000..905c7e40ff1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/IDesigner.cs
@@ -0,0 +1,24 @@
+// System.ComponentModel.Design.IDesigner.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public interface IDesigner : IDisposable
+ {
+ IComponent Component {get;}
+
+ DesignerVerbCollection Verbs {get;}
+
+ void DoDefaultAction ();
+
+ void Initialize (IComponent component);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/IDesignerHost.cs b/mcs/class/System/System.ComponentModel.Design/IDesignerHost.cs
new file mode 100644
index 00000000000..634bdbed79d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/IDesignerHost.cs
@@ -0,0 +1,56 @@
+// System.ComponentModel.Design.IDesignerHost.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public interface IDesignerHost : IServiceContainer, IServiceProvider
+ {
+ IContainer Container {get;}
+
+ bool InTransaction {get;}
+
+ bool Loading {get;}
+
+ IComponent RootComponent {get;}
+
+ string RootComponentClassName {get;}
+
+ string TransactionDescription {get;}
+
+ void Activate();
+
+ IComponent CreateComponent (Type componentClass);
+
+ IComponent CreateComponent (Type componentClass, string name);
+
+ DesignerTransaction CreateTransaction ();
+
+ DesignerTransaction CreateTransaction (string description);
+
+ IDesigner GetDesigner (IComponent component);
+
+ Type GetType (string typeName);
+
+ event EventHandler Activated;
+
+ event EventHandler Deactivated;
+
+ event EventHandler LoadComplete;
+
+ event DesignerTransactionCloseEventHandler TransactionClosed;
+
+ event DesignerTransactionCloseEventHandler TransactionClosing;
+
+ event EventHandler TransactionOpened;
+
+ event EventHandler TransactionOpening;
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/IResourceService.cs b/mcs/class/System/System.ComponentModel.Design/IResourceService.cs
new file mode 100644
index 00000000000..b734ce7d52e
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/IResourceService.cs
@@ -0,0 +1,20 @@
+// System.ComponentModel.Design.IResourceService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Globalization;
+using System.Resources;
+
+namespace System.ComponentModel.Design
+{
+ public interface IResourceService
+ {
+ IResourceReader GetResourceReader (CultureInfo info);
+
+ IResourceWriter GetResourceWriter (CultureInfo info);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/ISelectionService.cs b/mcs/class/System/System.ComponentModel.Design/ISelectionService.cs
new file mode 100644
index 00000000000..690f16d1aa2
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/ISelectionService.cs
@@ -0,0 +1,18 @@
+// System.ComponentModel.Design.ISelectionService.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public interface ISelectionService
+ {
+
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/IServiceContainer.cs b/mcs/class/System/System.ComponentModel.Design/IServiceContainer.cs
new file mode 100644
index 00000000000..64a9b66f610
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/IServiceContainer.cs
@@ -0,0 +1,47 @@
+// System.ComponentModel.Design.IServiceContainer.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public interface IServiceContainer : IServiceProvider
+ {
+ void AddService(
+ Type serviceType,
+ object serviceInstance
+ );
+
+ void AddService(
+ Type serviceType,
+ ServiceCreatorCallback callback
+ );
+
+ void AddService(
+ Type serviceType,
+ object serviceInstance,
+ bool promote
+ );
+
+ void AddService(
+ Type serviceType,
+ ServiceCreatorCallback callback,
+ bool promote
+ );
+
+ void RemoveService(
+ Type serviceType
+ );
+
+ void RemoveService(
+ Type serviceType,
+ bool promote
+ );
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/MenuCommand.cs b/mcs/class/System/System.ComponentModel.Design/MenuCommand.cs
new file mode 100644
index 00000000000..99fe3622ec2
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/MenuCommand.cs
@@ -0,0 +1,109 @@
+// System.ComponentModel.Design.MenuCommand.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public class MenuCommand
+ {
+ [MonoTODO]
+ public MenuCommand (EventHandler handler, CommandID command) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool Checked
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual CommandID CommandID
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool Enabled
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual int OleStatus
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool Supported
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool Visible
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual void Invoke()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnCommandChanged (EventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public event EventHandler CommandChanged;
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel.Design/ServiceCreatorCallback.cs b/mcs/class/System/System.ComponentModel.Design/ServiceCreatorCallback.cs
new file mode 100644
index 00000000000..718b1dbbda4
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/ServiceCreatorCallback.cs
@@ -0,0 +1,15 @@
+// System.ComponentModel.Design.ServiceCreatorCallback.cs
+//
+// Author:
+// Alejandro Sánchez Acosta <raciel@es.gnu.org>
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel.Design
+{
+ [ComVisible(true)]
+ public delegate object ServiceCreatorCallback (IServiceContainer container, Type serviceType);
+}
diff --git a/mcs/class/System/System.ComponentModel/AttributeCollection.cs b/mcs/class/System/System.ComponentModel/AttributeCollection.cs
new file mode 100644
index 00000000000..fb8c7937d2a
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/AttributeCollection.cs
@@ -0,0 +1,130 @@
+//
+// System.ComponentModel.AttributeCollection.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.ComponentModel
+{
+ public class AttributeCollection : ICollection, IEnumerable
+ {
+ private ArrayList attrList = new ArrayList ();
+ public static readonly AttributeCollection Empty = new AttributeCollection (null);
+
+ public AttributeCollection (Attribute[] attributes)
+ {
+ if (attributes != null)
+ for (int i = 0; i < attributes.Length; i++)
+ attrList.Add (attributes[i]);
+ }
+
+ public bool Contains (Attribute attr)
+ {
+ return attrList.Contains (attr);
+ }
+
+ public bool Contains (Attribute [] attributes)
+ {
+ if (attributes == null)
+ return true;
+
+ foreach (Attribute attr in attributes)
+ if (!Contains (attr))
+ return false;
+
+ return true;
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ attrList.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return attrList.GetEnumerator ();
+ }
+
+ public bool Matches (Attribute attr)
+ {
+ foreach (Attribute a in attrList)
+ if (a.Match (attr))
+ return true;
+ return false;
+ }
+
+ public bool Matches (Attribute [] attributes)
+ {
+ foreach (Attribute a in attributes)
+ if (!(Matches (a)))
+ return false;
+ return true;
+ }
+
+ protected Attribute GetDefaultAttribute (Type attributeType)
+ {
+ Attribute attr;
+ BindingFlags bf = BindingFlags.Public | BindingFlags.Static;
+
+ FieldInfo def = attributeType.GetField ("Default", bf);
+ if (def == null) {
+ attr = Activator.CreateInstance (attributeType) as Attribute;
+ if (attr != null && !attr.IsDefaultAttribute ())
+ attr = null;
+ } else {
+ attr = (Attribute) def.GetValue (null);
+ }
+
+ return attr;
+ }
+
+ public bool IsSynchronized {
+ get {
+ return attrList.IsSynchronized;
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return attrList.SyncRoot;
+ }
+ }
+
+ public int Count {
+ get {
+ return attrList.Count;
+ }
+ }
+
+ public virtual Attribute this[Type type] {
+ get {
+ Attribute attr = null;
+ foreach (Attribute a in attrList) {
+ if (a.GetType () == type){
+ attr = a;
+ break;
+ }
+ }
+
+ if (attr == null)
+ attr = GetDefaultAttribute (type);
+
+ return attr;
+ }
+ }
+
+ public virtual Attribute this[int index] {
+ get {
+ return (Attribute) attrList [index];
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs b/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs
new file mode 100644
index 00000000000..5aac55e7e56
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs
@@ -0,0 +1,9 @@
+//
+// System.ComponentModel.BaseNumberConverter.cs
+//
+//
+
+namespace System.ComponentModel {
+ public class BaseNumberConverter : TypeConverter {
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/BindableAttribute.cs b/mcs/class/System/System.ComponentModel/BindableAttribute.cs
new file mode 100755
index 00000000000..ef48152bd48
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/BindableAttribute.cs
@@ -0,0 +1,71 @@
+//
+// System.ComponentModel.BindableAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+//
+
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class BindableAttribute : Attribute {
+
+ #region Fields
+
+ BindableSupport flags;
+ bool bindable;
+
+ #endregion // Fields
+
+ public static readonly BindableAttribute No = new BindableAttribute (BindableSupport.No);
+ public static readonly BindableAttribute Yes = new BindableAttribute (BindableSupport.Yes);
+ public static readonly BindableAttribute Default = new BindableAttribute (BindableSupport.Default);
+
+ #region Constructors
+
+ public BindableAttribute (BindableSupport flags)
+ {
+ this.flags = flags;
+ this.bindable = false;
+ }
+
+ public BindableAttribute (bool bindable)
+ {
+ this.bindable = bindable;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Bindable {
+ get { return bindable; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsDefaultAttribute ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/BindableSupport.cs b/mcs/class/System/System.ComponentModel/BindableSupport.cs
new file mode 100644
index 00000000000..e11e9a1920b
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/BindableSupport.cs
@@ -0,0 +1,18 @@
+//
+// System.ComponentModel.BindableSupport.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.ComponentModel
+{
+ [Serializable]
+ public enum BindableSupport {
+ No,
+ Yes,
+ Default
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
new file mode 100755
index 00000000000..e56beb2f809
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
@@ -0,0 +1,38 @@
+//
+// System.ComponentModel.BrowsableAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ public sealed class BrowsableAttribute : Attribute {
+ bool browsable;
+
+ public static readonly BrowsableAttribute No;
+ public static readonly BrowsableAttribute Yes;
+
+ static BrowsableAttribute ()
+ {
+ No = new BrowsableAttribute (false);
+ Yes = new BrowsableAttribute (false);
+ }
+
+ public BrowsableAttribute (bool browsable)
+ {
+ this.browsable = browsable;
+ }
+
+ public bool Browsable {
+ get {
+ return browsable;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/CancelEventArgs.cs b/mcs/class/System/System.ComponentModel/CancelEventArgs.cs
new file mode 100644
index 00000000000..f09da6d64db
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CancelEventArgs.cs
@@ -0,0 +1,38 @@
+//------------------------------------------------------------------------------
+//
+// System.ComponentModel.CancelEventArgs.
+//
+// Author: Asier Llano Palacios, asierllano@infonegocio.com
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.ComponentModel {
+
+ public class CancelEventArgs : EventArgs
+ {
+ private bool cancel;
+
+ public CancelEventArgs() {
+ cancel = false;
+ }
+
+ public CancelEventArgs( bool cancel )
+ {
+ this.cancel = cancel;
+ }
+
+ public bool Cancel {
+ get {
+ return cancel;
+ }
+ set {
+ cancel = value;
+ }
+ }
+ }
+
+}
+
+
diff --git a/mcs/class/System/System.ComponentModel/CancelEventHandler.cs b/mcs/class/System/System.ComponentModel/CancelEventHandler.cs
new file mode 100644
index 00000000000..10ef8bc2aa3
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CancelEventHandler.cs
@@ -0,0 +1,17 @@
+//------------------------------------------------------------------------------
+//
+// System.ComponentModel.CancelEventHandler.
+//
+// Author: Asier Llano Palacios, asierllano@infonegocio.com
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.ComponentModel {
+
+ [Serializable]
+ public delegate void CancelEventHandler( object sender, CancelEventArgs e );
+}
+
+
diff --git a/mcs/class/System/System.ComponentModel/CategoryAttribute.cs b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
new file mode 100755
index 00000000000..c68b49cda50
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
@@ -0,0 +1,227 @@
+//
+// System.ComponentModel.CategoryAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ public class CategoryAttribute : Attribute {
+ string category;
+
+ static CategoryAttribute action, appearance, behaviour, data, def;
+ static CategoryAttribute design, drag_drop, focus, format, key;
+ static CategoryAttribute layout, mouse, window_style;
+
+ public CategoryAttribute (string category)
+ {
+ this.category = category;
+ }
+
+ public CategoryAttribute ()
+ {
+ this.category = "Misc";
+ }
+
+ [MonoTODO]
+ protected virtual string GetLocalizedString (string value)
+ {
+ // FIXME: IMPLEMENT
+
+ return category;
+ }
+
+ public string Category {
+ get {
+ return category;
+ }
+ }
+
+ public static CategoryAttribute Action {
+ get {
+ if (action != null)
+ return action;
+
+ lock (typeof (CategoryAttribute)){
+ if (action == null)
+ action = new CategoryAttribute ("Action");
+ }
+
+ return action;
+ }
+ }
+
+ public static CategoryAttribute Appearance {
+ get {
+ if (appearance != null)
+ return appearance;
+
+ lock (typeof (CategoryAttribute)){
+ if (appearance == null)
+ appearance = new CategoryAttribute ("Appearance");
+ }
+
+ return appearance;
+ }
+ }
+
+ public static CategoryAttribute Behaviour {
+ get {
+ if (behaviour != null)
+ return behaviour;
+
+ lock (typeof (CategoryAttribute)){
+ if (behaviour == null)
+ behaviour = new CategoryAttribute ("Action");
+ }
+
+ return behaviour;
+ }
+ }
+
+ public static CategoryAttribute Data {
+ get {
+ if (data != null)
+ return data;
+
+ lock (typeof (CategoryAttribute)){
+ if (data == null)
+ data = new CategoryAttribute ("Data");
+ }
+
+ return data;
+ }
+ }
+
+ public static CategoryAttribute Default {
+ get {
+ if (def != null)
+ return def;
+
+ lock (typeof (CategoryAttribute)){
+ if (def == null)
+ def = new CategoryAttribute ("Default");
+ }
+
+ return def;
+ }
+ }
+
+ public static CategoryAttribute Design {
+ get {
+ if (design != null)
+ return design;
+
+ lock (typeof (CategoryAttribute)){
+ if (design == null)
+ design = new CategoryAttribute ("Design");
+ }
+
+ return design;
+ }
+ }
+
+ public static CategoryAttribute DragDrop {
+ get {
+ if (drag_drop != null)
+ return drag_drop;
+
+ lock (typeof (CategoryAttribute)){
+ if (drag_drop == null)
+ drag_drop = new CategoryAttribute ("Drag Drop");
+ }
+
+ return drag_drop;
+ }
+ }
+
+ public static CategoryAttribute Focus {
+ get {
+ if (focus != null)
+ return focus;
+
+ lock (typeof (CategoryAttribute)){
+ if (focus == null)
+ focus = new CategoryAttribute ("Focus");
+ }
+
+ return focus;
+ }
+ }
+
+ public static CategoryAttribute Format {
+ get {
+ if (format != null)
+ return format;
+
+ lock (typeof (CategoryAttribute)){
+ if (format == null)
+ format = new CategoryAttribute ("Format");
+ }
+
+ return format;
+ }
+ }
+
+ public static CategoryAttribute Key {
+ get {
+ if (key != null)
+ return key;
+
+ lock (typeof (CategoryAttribute)){
+ if (key == null)
+ key = new CategoryAttribute ("Key");
+ }
+
+ return key;
+ }
+ }
+
+ public static CategoryAttribute Layout {
+ get {
+ if (layout != null)
+ return layout;
+
+ lock (typeof (CategoryAttribute)){
+ if (layout == null)
+ layout = new CategoryAttribute ("Layout");
+ }
+
+ return layout;
+ }
+ }
+
+ public static CategoryAttribute Mouse {
+ get {
+ if (mouse != null)
+ return mouse;
+
+ lock (typeof (CategoryAttribute)){
+ if (mouse == null)
+ mouse = new CategoryAttribute ("Mouse");
+ }
+
+ return mouse;
+ }
+ }
+
+ public static CategoryAttribute WindowStyle {
+ get {
+ if (window_style != null)
+ return window_style;
+
+ lock (typeof (CategoryAttribute)){
+ if (window_style == null)
+ window_style = new CategoryAttribute ("Window Style");
+ }
+
+ return window_style;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog
new file mode 100644
index 00000000000..8c073ea121b
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ChangeLog
@@ -0,0 +1,340 @@
+2003-01-08 Dick Porter <dick@ximian.com>
+
+ * Win32Exception.cs (ComponentModel): Added EWOULDBLOCK
+
+2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeDescriptor.cs: use ICustomTypeDescriptor if the component
+ implements it. It's done for GetProperties and should be done for the
+ rest of methods present in ICustomTypeDescriptor.
+
+2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeDescriptor.cs: moved code from GetProperties (object) to (Type).
+
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultValueAttribute.cs: the attribute applies to All.
+
+2002-11-19 Duncan Mak <duncan@ximian.com>
+
+ * DesignerAttribute.cs:
+ * EditorAttribute: Style changes. Gonzalo committed the build
+ fixes before I did.
+
+2002-11-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DesignerAttribute.cs:
+ * EditorAttribute.cs: fixed the build.
+
+2002-11-19 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * EditorAttribute: implemented.
+ * DesignerAttribute: implemented.
+
+2002-11-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Win32Exception.cs: added 10107 -> WASSYSCALLFAILURE.
+
+2002-11-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ListBindableAttribute.cs: implemented.
+
+2002-11-02 Duncan Mak <duncan@ximian.com>
+
+ * InvalidEnumArgumentException.cs: Added.
+
+2002-10-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * EventHandlerList.cs: fixed bug #29535.
+
+2002-10-03 Dick Porter <dick@ximian.com>
+
+ * Win32Exception.cs: Added ETIMEDOUT
+
+2002-09-30 Dick Porter <dick@ximian.com>
+
+ * Win32Exception.cs: Sorted the errors, added EINPROGRESS
+
+2002-09-17 Asier Llano Palacios <asierllano@infonegocio.com>
+
+ * CancelEventArgs.cs
+ * WarningException.cs
+ * CancelEventHandler.cs
+ * PropertyChangedEventHandler.cs
+ * IExtenderProvider.cs: Implemented
+
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Component.cs:
+ * ComponentCollection.cs:
+ * Container.cs:
+ * MarshalByValueComponent.cs: IDisposable fixes.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BindableSupport.cs:
+ * Component.cs:
+ * EventDescriptorCollection.cs:
+ * ITypeDescriptorContext.cs:
+ * TypeConverter.cs:
+ * TypeDescriptor.cs: class status based fixes.
+
+ * StringConverter.cs: implemented a couple of methods.
+
+2002-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * EnumConverter.cs: new file.
+
+ * TypeConverter.cs: implemented a few simple methods.
+
+ * TypeDescriptor.cs:
+ (GetConverter): initial support for converters of well-known types.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DerivedPropertyDescriptor.cs: New file. Internal class.
+
+ * PropertyDescriptorCollection.cs: almost fully implemented.
+
+ * TypeDescriptor.cs: implemented a couple of GetProperties ().
+
+Wed Jul 24 13:14:30 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Component.cs: don't die if Disposed is null.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * RecommendedAsConfigurableAttribute.cs: new file added
+ for System.Web.Services build
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * ExpandableObjectConverter.cs: Fix error with constructor
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * TypeConverter.cs: Fixed bad stubb function
+ GetConvertToException ()
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * ComponentCollection.cs: Added reference to
+ ReadOnlyCollectionBase to make sure
+ that we inherit the appropriate methods.
+ Not sure why the Dispose() method is
+ required, but left for now.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * TypeConverter.cs: Added new stubbs
+ * BindableAttribute.cs: Added
+ * BindableSupport.cs: Added
+ * NotifyParentPropertyAttribute.cs: Added
+ * ExpandableObjectConverter.cs: Added
+
+2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MemberDescriptor.cs: implemented Attributes and Category.
+
+ * PropertyDescriptor.cs: implemented Converter. Declared GetValue ().
+
+ * PropertyDescriptorCollection.cs: fixed indexers declaration.
+
+ * ReadOnlyAttribute.cs: GetHashCoder (), Equals (), IsDefault () and
+ fixed value for Yes.
+
+ * ToolboxItemAttribute.cs: fixed declaration of IsDefaultAttribute.
+
+ * TypeConverter.cs: added SimplePropertyDescriptor class.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ToolboxItemAttribute.cs: New file.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultEventAttribute.cs: new file.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs: fixlet.
+
+2002-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs: finished implementation.
+ * TypeDescriptor.cs: implemented GetAttributes (object).
+
+2002-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AttributeCollection.cs: initialize member variables.
+
+ * RefreshEventArgs.cs: implemented.
+ * RefreshEventHandler.cs: New file.
+
+ * TypeDescriptor.cs: fully stubbed out the remaining method.
+
+2002-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultPropertyAttribute.cs: New file.
+
+2002-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeConverter.cs: flushed local changes.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringConverter.cs: stubbed out.
+ * TypeConverter.cs: stubbed the rest out and added some implementation.
+
+ Five errors left when compiling System.Web in linux.
+
+2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeConverterAttribute.cs: attribute used by
+ TypeDescriptor.Getconverter ().
+
+ * TypeDescriptor.cs: implemented GetConverter in the right way.
+
+2002-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeConverter.cs:
+ * ITypeDescriptorContext.cs:
+ * TypeDescriptor.cs: implemented minimal set of features needed by xsp,
+ which uses ColorConverter.
+
+2002-05-12 Daniel Morgan <danmorg@sc.rr.com>
+
+ * IComponent.cs
+ * ISite.cs: added using System
+
+ * MarshalByValueComponent.cs: changed all throwing of Not ImplementedException
+ to // TODOs and added using System. The throwing of the exceptions prevented
+ System.Data from running.
+
+2002-05-10 Rodrigo Moya <rodrigo@ximian.com>
+
+ * EventDescriptorCollection.cs (this[index]): call eventList[index],
+ not this[index], which issues an 'ambigous call' error on Linux.
+
+2002-05-07 Rodrigo Moya <rodrigo@ximian.com>
+
+ * EventDescriptor.cs: added missing constructors.
+
+ * EventDescriptorCollection.cs: fixed interface methods implementation
+
+ * IDataErrorInfo.cs:
+ * IEditableObject.cs: new interfaces.
+
+2002-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.ComponentModel/AttributeCollection.cs: added a cast to make
+ it compile.
+
+2002-05-03 Rodrigo Moya <rodrigo@ximian.com>
+
+ * AttributeCollection.cs:
+ * EventDescriptor.cs:
+ * EventDescriptorCollection.cs:
+ * ICustomTypeDescriptor.cs: new files.
+
+2002-05-01 Duncan Mak <duncan@ximian.com>
+
+ * ListChangedType.cs:
+ * ListChangedEventHandler.cs:
+ * ListChangedEventArgs.cs: Added to fix build.
+
+2002-05-01 Miguel de Icaza <miguel@ximian.com>
+
+ * PropertyDescriptorCollection.cs: Added the IList explicit
+ implementation methods.
+
+ lots of bug fixes to get the build to compile again.
+
+2002-05-01 Duncan Mak <duncan@ximian.com>
+
+ * ListSortDirection.cs: EnumChecked.
+
+2002-05-01 Rodrigo Moya <rodrigo@ximian.com>
+
+ * ListSortDirection.cs: new enumeration. Please, somebody run
+ EnumCheck on it, as I don't have a windows machine.
+
+ * PropertyDescriptorCollection.cs: new class.
+
+ * ITypedList.cs:
+ * IBindingList.cs: new interfaces.
+
+2002-04-28 Duncan Mak <duncan@ximian.com>
+
+ * CollectionChangeAction.cs: Changed enum layout to fit the MS
+ implementation. Please use EnumCheck!
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * CollectionChangeAction.cs: new enumeration.
+
+ * CategoryAttribute.cs: moved the 'return' keyword to the
+ end of the method, to avoid compilation errors on Linux for
+ all CategoryAttribute properties.
+
+2002-04-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * IListSource.cs:
+ * ISupportInitialize.cs:
+ * MarshalByValueComponent.cs: new stubs, needed for System.Data
+ compilation.
+
+ * PropertyChangedEventArgs.cs:
+ * CollectionChangeEventHandler.cs:
+ * CollectionChangeEventArgs.cs: implemented.
+
+2002-04-28 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added error code 11001 to Win32Exception, used by Dns.c
+
+2002-04-04 Dick Porter <dick@ximian.com>
+
+ * ISynchronizeInvoke.cs: Needed by Process
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * Win32Exception.cs: implement, with support for looking up
+ runtime errors.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * Win32Exception.cs: Add.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * CategoryAttribute.cs, Component.cs, ComponentCollection.cs: MonoTODO.
+
+ * Container.cs, MemberDescriptor.cs, PropertyDescriptor.cs : Ditto.
+
+2001-10-27 Miguel de Icaza <miguel@ximian.com>
+
+ * DesignerSerializationVisibilityAttribute.cs: Implemented.
+
+ * DesignerSerializationVisibility.cs: New enumeration.
+
+ * LocalizableAttribute.cs: Implemented.
+
+ * BrowsableAttribute.cs: Implemented.
+
+ * DesignOnlyAttribute.cs: Implemented.
+
+ * DescriptionAttribute.cs: Implement.
+
+ * MemberDescriptor.cs: Implemented.
+
+ * CategoryAttribute.cs: implemented.
+
+2001-08-21 Nick Drochak <ndrochak@gol.com>
+
+ * Component.cs: Eliminated compile errors by removing redundant fields and
+ using the ISite member instead. Also raised the Disposed event, but not
+ sure if it's correct now. Look for FIXME in the comments.
+
+2001-08-02 Miguel de Icaza <miguel@ximian.com>
+
+ * EventHandlerList.cs: New file.
+
+ * Container.cs, Component.cs, IContainer.cs, IComponent.cs,
+ ComponentCollection.cs, ISite.cs: New classes
+
diff --git a/mcs/class/System/System.ComponentModel/CollectionChangeAction.cs b/mcs/class/System/System.ComponentModel/CollectionChangeAction.cs
new file mode 100644
index 00000000000..640e36e11ae
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CollectionChangeAction.cs
@@ -0,0 +1,20 @@
+//
+// System.ComponentModel.CollectionChangeAction.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Specifies how the collection is changed.
+ /// </summary>
+ public enum CollectionChangeAction {
+ Add = 1,
+ Remove = 2,
+ Refresh = 3
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs b/mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs
new file mode 100644
index 00000000000..6ace57b02b7
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.ComponentModel.CollectionChangeEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Provides data for the CollectionChanged event.
+ /// </summary>
+ public class CollectionChangeEventArgs : EventArgs
+ {
+ private CollectionChangeAction changeAction;
+ private object theElement;
+
+ public CollectionChangeEventArgs (CollectionChangeAction action,
+ object element) {
+ changeAction = action;
+ theElement = element;
+ }
+
+ public virtual CollectionChangeAction Action {
+ get {
+ return changeAction;
+ }
+ }
+
+ public virtual object Element {
+ get {
+ return theElement;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs b/mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs
new file mode 100644
index 00000000000..6194af6f11e
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.ComponentModel.CollectionChangeEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.ComponentModel
+{
+ public delegate void CollectionChangeEventHandler (object sender,
+ CollectionChangeEventArgs e);
+}
diff --git a/mcs/class/System/System.ComponentModel/Component.cs b/mcs/class/System/System.ComponentModel/Component.cs
new file mode 100644
index 00000000000..f52975abd66
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Component.cs
@@ -0,0 +1,141 @@
+//
+// System.ComponentModel.Component.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ // <summary>
+ // Component class.
+ // </summary>
+ //
+ // <remarks>
+ // Longer description
+ // </remarks>
+ public class Component : MarshalByRefObject, IComponent, IDisposable {
+
+ EventHandlerList event_handlers;
+ ISite mySite;
+ object disposedEvent = new object ();
+
+ // <summary>
+ // Component Constructor
+ // </summary>
+ public Component ()
+ {
+ event_handlers = null;
+ }
+
+ // <summary>
+ // Get IContainer of this Component
+ // </summary>
+ public IContainer Container {
+ get {
+ return mySite.Container;
+ }
+ }
+
+ protected bool DesignMode {
+ get {
+ return mySite.DesignMode;
+ }
+ }
+
+ protected EventHandlerList Events {
+ get {
+ // Note: space vs. time tradeoff
+ // We create the object here if it's never be accessed before. This potentially
+ // saves space. However, we must check each time the propery is accessed to
+ // determine whether we need to create the object, which increases overhead.
+ // We could put the creation in the contructor, but that would waste space
+ // if it were never used. However, accessing this property would be faster.
+ if (null == event_handlers)
+ {
+ event_handlers = new EventHandlerList();
+ }
+ return event_handlers;
+ }
+ }
+
+ public virtual ISite Site {
+ get {
+ return mySite;
+ }
+
+ set {
+ mySite = value;
+ }
+ }
+
+ ~Component()
+ {
+ Dispose (false);
+ }
+
+ // <summary>
+ // Dispose resources used by this component
+ // </summary>
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ // <summary>
+ // Controls disposal of resources used by this.
+ // </summary>
+ //
+ // <param name="release_all"> Controls which resources are released</param>
+ //
+ // <remarks>
+ // if release_all is set to true, both managed and unmanaged
+ // resources should be released. If release_all is set to false,
+ // only unmanaged resources should be disposed
+ // </remarks>
+ protected virtual void Dispose (bool release_all)
+ {
+ if (release_all) {
+ EventHandler eh = (EventHandler) Events [disposedEvent];
+ if (eh != null)
+ eh (this, EventArgs.Empty);
+ }
+ mySite = null;
+ }
+
+ // <summary>
+ // Implements the IServiceProvider interface
+ // </summary>
+ [MonoTODO]
+ protected virtual object GetService (Type service)
+ {
+ // FIXME: Not sure what this should do.
+ return null;
+ }
+
+ public override string ToString ()
+ {
+ if (mySite == null)
+ return GetType ().ToString ();
+ return String.Format ("{0} [{1}]", mySite.Name, GetType ().ToString ());
+ }
+ // <summary>
+ // This event is called when the component is explicitly disposed.
+ // </summary>
+ public event EventHandler Disposed
+ {
+ add {
+ Events.AddHandler (disposedEvent, value);
+ }
+ remove {
+ Events.RemoveHandler (disposedEvent, value);
+ }
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/ComponentCollection.cs b/mcs/class/System/System.ComponentModel/ComponentCollection.cs
new file mode 100644
index 00000000000..80b85cf616d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ComponentCollection.cs
@@ -0,0 +1,55 @@
+//
+// System.ComponentModel.ComponentCollection.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.ComponentModel {
+ [ComVisible (true)]
+ public class ComponentCollection : ReadOnlyCollectionBase {
+
+ #region Constructors
+
+ [MonoTODO]
+ public ComponentCollection (IComponent[] components)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public virtual IComponent this [string name] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public virtual IComponent this [int index] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void CopyTo (IComponent[] array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/Container.cs b/mcs/class/System/System.ComponentModel/Container.cs
new file mode 100644
index 00000000000..d7eab7390ff
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Container.cs
@@ -0,0 +1,164 @@
+//
+// System.ComponentModel.Container.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ // <summary>
+ // Container class: encapsulates components.
+ // </summary>
+ //
+ // <remarks>
+ //
+ // </remarks>
+ public class Container : IContainer, IDisposable {
+ ComponentCollection cc;
+
+ // <summary>
+ // Auxiliary class to support the default behaviour of CreateSite
+ // </summary>
+ //
+ // <remarks>
+ // This is an internal class that is used to provide a
+ // default implementation of an ISite class. Container
+ // is just a default implementation of IContainer, and
+ // provides this as a way of getting started
+ // </remarks>
+
+ class DefaultSite : ISite {
+ IComponent component;
+ IContainer container;
+ string name;
+
+ public DefaultSite (string name, IComponent component, IContainer container)
+ {
+ this.component = component;
+ this.container = container;
+ this.name = name;
+ }
+
+ public IComponent Component {
+ get {
+ return component;
+ }
+ }
+
+ public IContainer Container {
+ get {
+ return container;
+ }
+ }
+
+ [MonoTODO]
+ public bool DesignMode {
+ get {
+ // FIXME: should we provide a way to set
+ // this value?
+ return false;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual object GetService (Type t)
+ {
+ // FIXME: do not know what this is supposed to do.
+ return null;
+ }
+ }
+
+ // <summary>
+ // Container constructor
+ // </summary>
+ public Container ()
+ {
+ }
+
+ public virtual ComponentCollection Components {
+ get {
+ return cc;
+ }
+ }
+
+ // <summary>
+ // Adds an IComponent to the Container
+ // </summary>
+ [MonoTODO]
+ public virtual void Add (IComponent component)
+ {
+ // FIXME: Add this component to the ComponentCollection.cc
+ }
+
+ // <summary>
+ // Adds an IComponent to the Container. With a name binding.
+ // </summary>
+ [MonoTODO]
+ public virtual void Add (IComponent component, string name)
+ {
+ // FIXME: Add this component to the ComponentCollection.cc
+ }
+
+ // <summary>
+ // Returns an ISite for a component.
+ // <summary>
+ protected virtual ISite CreateSite (IComponent component, string name)
+ {
+ return new DefaultSite (name, component, this);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ bool disposed = false;
+
+ protected virtual void Dispose (bool release_all)
+ {
+ if (disposed)
+ return;
+ disposed = true;
+
+ if (release_all){
+ //??
+ }
+
+ cc = null;
+ }
+
+ ~Container ()
+ {
+ Dispose (false);
+ }
+
+ [MonoTODO]
+ protected virtual object GetService (Type service)
+ {
+ // FIXME: Not clear what GetService does.
+
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual void Remove (IComponent component)
+ {
+ // FIXME: Add this component to the ComponentCollection.cc
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs b/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs
new file mode 100644
index 00000000000..29495b6fb1d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs
@@ -0,0 +1,43 @@
+//
+// System.ComponentModel.DefaultEventAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class DefaultEventAttribute : Attribute
+ {
+ private string eventName;
+
+ public DefaultEventAttribute (string name)
+ {
+ eventName = name;
+ }
+
+ public string Name
+ {
+ get { return eventName; }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is DefaultEventAttribute))
+ return false;
+
+ return (((DefaultEventAttribute) o).eventName == eventName);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs b/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs
new file mode 100644
index 00000000000..0e4b3c351f3
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs
@@ -0,0 +1,43 @@
+//
+// System.ComponentModel.DefaultPropertyAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class DefaultPropertyAttribute : Attribute
+ {
+ private string property_name;
+
+ public DefaultPropertyAttribute (string name)
+ {
+ property_name = name;
+ }
+
+ public string Name
+ {
+ get { return property_name; }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is DefaultPropertyAttribute))
+ return false;
+
+ return (((DefaultPropertyAttribute) o).Name == property_name);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs b/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs
new file mode 100755
index 00000000000..9997d994224
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs
@@ -0,0 +1,133 @@
+using System;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Specifies the default value for a property.
+ /// </summary>
+
+ [MonoTODO("Needs testing. DefaultValueAttribute(System.Type type, string value) is not implemented. Value has no description.")]
+ [AttributeUsage(AttributeTargets.All)]
+ public sealed class DefaultValueAttribute : Attribute
+ {
+
+ private object defaultValue;
+
+ /// <summary>
+ /// FIXME: Summary description for Value.
+ /// </summary>
+ public object Value
+ {
+ get
+ {
+ return defaultValue;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class.
+ /// </summary>
+ /// <param name="value">An System.Object that represents the default value.</param>
+ public DefaultValueAttribute(object value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a System.Boolean value.
+ /// </summary>
+ /// <param name="value">An System.Boolean that represents the default value.</param>
+ public DefaultValueAttribute(bool value)
+ {
+ defaultValue = value;
+ }
+
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using an 8-bit unsigned integer.
+ /// </summary>
+ /// <param name="value">An 8-bit unsigned integer that is the default value.</param>
+ public DefaultValueAttribute(byte value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a Unicode character.
+ /// </summary>
+ /// <param name="value">A Unicode character that is the default value.</param>
+ public DefaultValueAttribute(char value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a double-precision floating point number.
+ /// </summary>
+ /// <param name="value">A double-precision floating point number that is the default value.</param>
+ public DefaultValueAttribute(double value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a 32-bit signed integer.
+ /// </summary>
+ /// <param name="value">A 32-bit signed integer that is the default value.</param>
+ public DefaultValueAttribute(int value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a 64-bit signed integer.
+ /// </summary>
+ /// <param name="value">A 64-bit signed integer that is the default value.</param>
+ public DefaultValueAttribute(long value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a 16-bit signed integer.
+ /// </summary>
+ /// <param name="value">A 16-bit signed integer that is the default value.</param>
+ public DefaultValueAttribute(short value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a single-precision floating point number.
+ /// </summary>
+ /// <param name="value">A single-precision floating point number that is the default value.</param>
+ public DefaultValueAttribute(System.Single value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a System.String.
+ /// </summary>
+ /// <param name="value">A System.String that is the default value.</param>
+ public DefaultValueAttribute(string value)
+ {
+ defaultValue = value;
+ }
+
+ /*
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class, converting the specified value to the specified type, and using an invariant culture as the translation context.
+ /// </summary>
+ /// <param name="type">A System.Type that represents the type to convert the value to.</param>
+ /// <param name="value">A System.String that can be converted to the type using the System.ComponentModel.TypeConverter for the type and the U.S. English culture.</param>
+ public DefaultValueAttribute(System.Type type, string value)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ }
+ */
+ }
+
+}
+
diff --git a/mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs b/mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs
new file mode 100644
index 00000000000..60ba9006477
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs
@@ -0,0 +1,106 @@
+//
+// System.ComponentModel.DerivedPropertyDescriptor
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Reflection;
+
+namespace System.ComponentModel
+{
+ class DerivedPropertyDescriptor : PropertyDescriptor
+ {
+ bool readOnly;
+ Type componentType;
+ Type propertyType;
+ PropertyInfo prop;
+
+ protected DerivedPropertyDescriptor (string name, Attribute [] attrs)
+ : base (name, attrs)
+ {
+ }
+
+ public DerivedPropertyDescriptor (string name, Attribute [] attrs, int dummy)
+ : this (name, attrs)
+ {
+ }
+
+ public void SetReadOnly (bool value)
+ {
+ readOnly = value;
+ }
+
+ public void SetComponentType (Type type)
+ {
+ componentType = type;
+ }
+
+ public void SetPropertyType (Type type)
+ {
+ propertyType = type;
+ }
+
+ public override object GetValue (object component)
+ {
+ if (prop == null)
+ prop = componentType.GetProperty (Name);
+
+ return prop.GetValue (component, null);
+ }
+
+ public override void SetValue(object component, object value) {
+
+ if (prop == null)
+ prop = componentType.GetProperty (Name);
+
+ prop.SetValue (component, value, null);
+ }
+
+ [MonoTODO]
+ public override void ResetValue(object component) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool CanResetValue(object component) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool ShouldSerializeValue(object component) {
+
+ throw new NotImplementedException ();
+ }
+
+ public override Type ComponentType
+ {
+ get {
+ return componentType;
+ }
+
+ }
+
+ public override bool IsReadOnly
+ {
+ get {
+ return readOnly;
+
+ }
+
+ }
+
+ public override Type PropertyType
+ {
+ get {
+ return propertyType;
+ }
+
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs b/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs
new file mode 100755
index 00000000000..03e6f411d78
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs
@@ -0,0 +1,46 @@
+//
+// System.ComponentModel.DescriptionAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ public class DescriptionAttribute : Attribute {
+ string desc;
+
+ public DescriptionAttribute (string name)
+ {
+ desc = name;
+ }
+
+ public DescriptionAttribute ()
+ {
+ desc = "";
+ }
+
+ public virtual string Description {
+ get {
+ return DescriptionValue;
+ }
+ }
+
+ //
+ // Notice that the default Description implementation uses this by default
+ //
+ protected string DescriptionValue {
+ get {
+ return desc;
+ }
+
+ set {
+ desc = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs b/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs
new file mode 100755
index 00000000000..81b39db62f1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs
@@ -0,0 +1,37 @@
+//
+// System.ComponentModel.DesignOnlyAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class DesignOnlyAttribute : Attribute {
+ bool design_only;
+
+ public static readonly DesignOnlyAttribute No;
+ public static readonly DesignOnlyAttribute Yes;
+
+ static DesignOnlyAttribute ()
+ {
+ No = new DesignOnlyAttribute (false);
+ Yes = new DesignOnlyAttribute (false);
+ }
+
+ public DesignOnlyAttribute (bool design_only)
+ {
+ this.design_only = design_only;
+ }
+
+ public bool IsDesignOnly {
+ get {
+ return design_only;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs b/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs
new file mode 100644
index 00000000000..6f5868fedc3
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs
@@ -0,0 +1,68 @@
+//
+// System.ComponentModel.DesignTimeVisibleAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)]
+ public sealed class DesignTimeVisibleAttribute : Attribute
+ {
+ #region Fields
+
+ bool visible;
+
+ public static readonly DesignTimeVisibleAttribute Default = new DesignTimeVisibleAttribute (true);
+ public static readonly DesignTimeVisibleAttribute No = new DesignTimeVisibleAttribute (false);
+ public static readonly DesignTimeVisibleAttribute Yes = new DesignTimeVisibleAttribute (true);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public DesignTimeVisibleAttribute ()
+ : this (true)
+ {
+ }
+
+ public DesignTimeVisibleAttribute (bool visible)
+ {
+ this.visible = visible;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool Visible {
+ get { return visible; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override bool Equals (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsDefaultAttribute ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignerAttribute.cs b/mcs/class/System/System.ComponentModel/DesignerAttribute.cs
new file mode 100644
index 00000000000..7bb14ce35e1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignerAttribute.cs
@@ -0,0 +1,88 @@
+//
+// System.ComponentModel.DesignerAttribute.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.ComponentModel {
+
+ /// <summary>
+ /// Designer Attribute for classes.
+ /// </summary>
+
+ /// <remarks>
+ /// </remarks>
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
+ public sealed class DesignerAttribute : Attribute
+ {
+ string name;
+ string basetypename;
+ Type type;
+ Type basetype;
+
+ public DesignerAttribute (string designerTypeName)
+ {
+ name = designerTypeName;
+ }
+
+ public DesignerAttribute (Type designerType)
+ {
+ type = designerType;
+ }
+
+ public DesignerAttribute (string designerTypeName, string designerBaseTypeName)
+ {
+ name = designerTypeName;
+ basetypename = designerBaseTypeName;
+ }
+
+ public DesignerAttribute (string designerTypeName, Type designerBaseType)
+ {
+ name = designerTypeName;
+ basetype = designerBaseType;
+ }
+
+ public DesignerAttribute (Type designerType, Type designerBaseType)
+ {
+ type = designerType;
+ basetype = designerBaseType;
+ }
+
+ public string DesignerBaseTypeName {
+ get {
+ return basetypename;
+ }
+ }
+
+ public string DesignerTypeName {
+ get {
+ return name;
+ }
+ }
+
+ public override object TypeId {
+ get {
+ return this.GetType ();
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is DesignerAttribute))
+ return false;
+ return (((DesignerAttribute) obj).name == name) &&
+ (((DesignerAttribute) obj).basetype == basetype) &&
+ (((DesignerAttribute) obj).type == type) &&
+ (((DesignerAttribute) obj).basetypename == basetypename);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs
new file mode 100755
index 00000000000..d4291a842c8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs
@@ -0,0 +1,16 @@
+//
+// System.ComponentModel.DesignerSerializationVisibility.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ public enum DesignerSerializationVisibility {
+ Hidden, Visible, Content
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs
new file mode 100755
index 00000000000..fd2fffec348
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs
@@ -0,0 +1,42 @@
+//
+// System.ComponentModel.DesignerSerializationVisibilityAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class DesignerSerializationVisibilityAttribute : Attribute {
+ DesignerSerializationVisibility visibility;
+
+ static DesignerSerializationVisibilityAttribute ()
+ {
+ Content = new DesignerSerializationVisibilityAttribute (
+ DesignerSerializationVisibility.Content);
+ Hidden = new DesignerSerializationVisibilityAttribute (
+ DesignerSerializationVisibility.Hidden);
+ Visible = new DesignerSerializationVisibilityAttribute (
+ DesignerSerializationVisibility.Visible);
+ }
+
+ public DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility vis)
+ {
+ visibility = vis;
+ }
+
+ public static readonly DesignerSerializationVisibilityAttribute Content;
+ public static readonly DesignerSerializationVisibilityAttribute Hidden;
+ public static readonly DesignerSerializationVisibilityAttribute Visible;
+
+ public DesignerSerializationVisibility Visibility {
+ get {
+ return visibility;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EditorAttribute.cs b/mcs/class/System/System.ComponentModel/EditorAttribute.cs
new file mode 100644
index 00000000000..3f3913b172f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EditorAttribute.cs
@@ -0,0 +1,85 @@
+//
+// System.ComponentModel.EditorAttribute.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+namespace System.ComponentModel {
+
+ /// <summary>
+ /// Editor Attribute for classes.
+ /// </summary>
+
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class EditorAttribute : Attribute {
+
+ string name;
+ string basename;
+ Type baseType;
+ Type nametype;
+
+ public EditorAttribute ()
+ {
+ this.name = "";
+ }
+
+ public EditorAttribute (string typeName, string baseTypeName)
+ {
+ name = typeName;
+ basename = baseTypeName;
+ }
+
+ public EditorAttribute (string typeName, Type baseType)
+ {
+ name = typeName;
+ this.baseType = baseType;
+ }
+
+ public EditorAttribute (Type type, Type baseType)
+ {
+ nametype = type;
+ this.baseType = baseType;
+ }
+
+ public string EditorBaseTypeName {
+ get {
+ return basename;
+ }
+ }
+
+ public string EditorTypeName {
+ get {
+ return name;
+ }
+ }
+
+ public override object TypeId {
+ get {
+ return this.GetType ();
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is EditorAttribute))
+ return false;
+
+ return (((EditorAttribute) obj).name == name) &&
+ (((EditorAttribute) obj).basename == basename) &&
+ (((EditorAttribute) obj).baseType == baseType) &&
+ (((EditorAttribute) obj).nametype == nametype);
+
+ }
+
+ public override int GetHashCode ()
+ {
+ if (name == null)
+ return 0;
+
+ return name.GetHashCode ();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs b/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs
new file mode 100755
index 00000000000..912cdb13eed
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs
@@ -0,0 +1,53 @@
+using System;
+
+namespace System.ComponentModel
+{
+
+ /// <summary>
+ /// Specifies that a property or method is viewable in an editor. This class cannot be inherited.
+ /// </summary>
+ [MonoTODO("Missing description for State. Only minimal testing.")]
+ [AttributeUsage(
+ AttributeTargets.Class|
+ AttributeTargets.Constructor|
+ AttributeTargets.Delegate|
+ AttributeTargets.Enum|
+ AttributeTargets.Event|
+ AttributeTargets.Field|
+ AttributeTargets.Interface|
+ AttributeTargets.Method|
+ AttributeTargets.Property|
+ AttributeTargets.Struct)]
+ public sealed class EditorBrowsableAttribute : Attribute
+ {
+ private System.ComponentModel.EditorBrowsableState state;
+
+ /// <summary>
+ /// FIXME: Summary description for State.
+ /// </summary>
+ public System.ComponentModel.EditorBrowsableState State
+ {
+ get
+ {
+ return state;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.EditorBrowsableAttribute class with an System.ComponentModel.EditorBrowsableState.
+ /// </summary>
+ /// <param name="state">The System.ComponentModel.EditorBrowsableState to set System.ComponentModel.EditorBrowsableAttribute.State to.</param>
+ public EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState state)
+ {
+ this.state = state;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.EditorBrowsableAttribute class with an System.ComponentModel.EditorBrowsableState == System.ComponentModel.EditorBrowsableState.Always.
+ /// </summary>
+ public EditorBrowsableAttribute()
+ {
+ this.state = System.ComponentModel.EditorBrowsableState.Always;
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EditorBrowsableState.cs b/mcs/class/System/System.ComponentModel/EditorBrowsableState.cs
new file mode 100755
index 00000000000..eab0d651bb8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EditorBrowsableState.cs
@@ -0,0 +1,34 @@
+//
+// ProjectData.cs
+//
+// Author:
+// Martin Adoue (martin@cwanet.com)
+//
+// (C) 2002 Martin Adoue
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+
+ /// <summary>
+ /// Specifies the browsable state of a property or method from within an editor.
+ /// </summary>
+ public enum EditorBrowsableState
+ {
+ /// <summary>
+ /// The property or method is always browsable from within an editor.
+ /// </summary>
+ Always = 0,
+ /// <summary>
+ /// The property or method is never browsable from within an editor.
+ /// </summary>
+ Never = 1,
+ /// <summary>
+ /// The property or method is a feature that only advanced users should see. An editor can either show or hide such properties.
+ /// </summary>
+ Advanced = 2
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/EnumConverter.cs b/mcs/class/System/System.ComponentModel/EnumConverter.cs
new file mode 100644
index 00000000000..46f43f41757
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EnumConverter.cs
@@ -0,0 +1,92 @@
+//
+// System.ComponentModel.EnumConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Globalization;
+
+namespace System.ComponentModel
+{
+ public class EnumConverter : TypeConverter
+ {
+ private Type type;
+ private StandardValuesCollection stdValues;
+
+ public EnumConverter (Type type)
+ {
+ this.type = type;
+ }
+
+ [MonoTODO]
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ if (destinationType == typeof (string))
+ return value.ToString ();
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ string val = value as string;
+ if (val == null)
+ return base.ConvertFrom(context, culture, value);
+
+ string [] subValues = val.Split (new char [] {','});
+
+ long longResult = 0;
+ foreach (string s in subValues)
+ longResult |= (long) Enum.Parse (type, s, true);
+
+ return Enum.ToObject (type, longResult);
+ }
+
+ public override bool IsValid (ITypeDescriptorContext context, object value)
+ {
+ return Enum.IsDefined (type, value);
+ }
+
+ public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ public override bool GetStandardValuesExclusive (ITypeDescriptorContext context)
+ {
+ return !(type.IsDefined (typeof (FlagsAttribute), false));
+ }
+
+ public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+ {
+ if (stdValues == null) {
+ Array values = Enum.GetValues (type);
+ Array.Sort (values);
+ stdValues = new StandardValuesCollection (values);
+ }
+ return stdValues;
+ }
+ }
+
+}
+
diff --git a/mcs/class/System/System.ComponentModel/EventDescriptor.cs b/mcs/class/System/System.ComponentModel/EventDescriptor.cs
new file mode 100644
index 00000000000..211c07dac9d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EventDescriptor.cs
@@ -0,0 +1,26 @@
+//
+// System.ComponentModel.EventDescriptor.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+namespace System.ComponentModel
+{
+ public abstract class EventDescriptor : MemberDescriptor
+ {
+ protected EventDescriptor (MemberDescriptor desc) : base (desc)
+ {
+ }
+
+ protected EventDescriptor (MemberDescriptor desc, Attribute[] attrs) : base (desc, attrs)
+ {
+ }
+
+ protected EventDescriptor(string str, Attribute[] attrs) : base (str, attrs)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs b/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs
new file mode 100644
index 00000000000..67ab149d9ea
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs
@@ -0,0 +1,167 @@
+//
+// System.ComponentModel.EventDescriptorCollection.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.ComponentModel
+{
+ public class EventDescriptorCollection : IList, ICollection, IEnumerable
+ {
+ private ArrayList eventList;
+
+ public static readonly EventDescriptorCollection Empty;
+
+ public EventDescriptorCollection (EventDescriptor[] events) {
+ for (int i = 0; i < events.Length; i++)
+ this.Add (events[i]);
+ }
+
+ public int Add (EventDescriptor value) {
+ return eventList.Add (value);
+ }
+
+ public void Clear () {
+ eventList.Clear ();
+ }
+
+ public bool Contains (EventDescriptor value) {
+ return eventList.Contains (value);
+ }
+
+ [MonoTODO]
+ public virtual EventDescriptor Find (string name, bool ignoreCase) {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator () {
+ return eventList.GetEnumerator ();
+ }
+
+ public int IndexOf (EventDescriptor value) {
+ return eventList.IndexOf (value);
+ }
+
+ public void Insert (int index, EventDescriptor value) {
+ eventList.Insert (index, value);
+ }
+
+ public void Remove (EventDescriptor value) {
+ eventList.Remove (value);
+ }
+
+ public void RemoveAt (int index) {
+ eventList.RemoveAt (index);
+ }
+
+
+ [MonoTODO]
+ public virtual EventDescriptorCollection Sort () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual EventDescriptorCollection Sort (IComparer comparer) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual EventDescriptorCollection Sort (string[] order) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual EventDescriptorCollection Sort (string[] order,
+ IComparer comparer) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual EventDescriptorCollection InternalSort (IComparer comparer) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual EventDescriptorCollection InternalSort (string[] order) {
+ throw new NotImplementedException ();
+ }
+
+ public int Count {
+ get {
+ return eventList.Count;
+ }
+ }
+
+ public virtual EventDescriptor this[string name] {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual EventDescriptor this[int index] {
+ get {
+ return (EventDescriptor) eventList[index];
+ }
+ }
+
+ // IList methods
+
+ int IList.Add (object value) {
+ return Add ((EventDescriptor) value);
+ }
+
+ bool IList.Contains (object value) {
+ return Contains ((EventDescriptor) value);
+ }
+
+ int IList.IndexOf (object value) {
+ return IndexOf ((EventDescriptor) value);
+ }
+
+ void IList.Insert (int index, object value) {
+ Insert (index, (EventDescriptor) value);
+ }
+
+ void IList.Remove (object value) {
+ Remove ((EventDescriptor) value);
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false; }
+ }
+
+ object IList.this[int index] {
+ get {
+ return eventList[index];
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // ICollection methods
+
+ [MonoTODO]
+ void ICollection.CopyTo (Array array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return null; }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EventHandlerList.cs b/mcs/class/System/System.ComponentModel/EventHandlerList.cs
new file mode 100644
index 00000000000..48e48a0e8d7
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EventHandlerList.cs
@@ -0,0 +1,69 @@
+//
+// System.ComponentModel.EventHandlerList.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.ComponentModel {
+
+ // <summary>
+ // List of Event delegates.
+ // </summary>
+ //
+ // <remarks>
+ // Longer description
+ // </remarks>
+ public sealed class EventHandlerList : IDisposable {
+ Hashtable table;
+
+ public EventHandlerList ()
+ {
+ }
+
+ public Delegate this [object key] {
+ get {
+ if (table == null)
+ return null;
+
+ return table [key] as Delegate;
+ }
+
+ set {
+ AddHandler (key, value);
+ }
+ }
+
+ public void AddHandler (object key, Delegate value)
+ {
+ if (table == null)
+ table = new Hashtable ();
+
+ Delegate prev = table [key] as Delegate;
+ prev = Delegate.Combine (prev, value);
+ table [key] = prev;
+ }
+
+ public void RemoveHandler (object key, Delegate value)
+ {
+ if (table == null)
+ return;
+
+ Delegate prev = table [key] as Delegate;
+ prev = Delegate.Remove (prev, value);
+ table [key] = prev;
+ }
+
+ public void Dispose ()
+ {
+ table = null;
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs b/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs
new file mode 100644
index 00000000000..1db14cd4fdd
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs
@@ -0,0 +1,41 @@
+//
+// System.ComponentModel.ExpandableObjectConverter.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.ComponentModel {
+ public class ExpandableObjectConverter : TypeConverter {
+
+ #region Constructors
+
+ [MonoTODO]
+ public ExpandableObjectConverter ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value, Attribute[] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool GetPropertiesSupported (ITypeDescriptorContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IBindingList.cs b/mcs/class/System/System.ComponentModel/IBindingList.cs
new file mode 100644
index 00000000000..8de1b197f17
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IBindingList.cs
@@ -0,0 +1,69 @@
+//
+// System.ComponentModel.IBindingList.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Collections;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Provides the features required to support both complex and simple scenarios when binding to a data source.
+ /// </summary>
+ public interface IBindingList : IList, ICollection, IEnumerable
+ {
+ void AddIndex (PropertyDescriptor property);
+
+ object AddNew ();
+
+ void ApplySort (PropertyDescriptor property, ListSortDirection direction);
+
+ int Find (PropertyDescriptor property, object key);
+
+ void RemoveIndex (PropertyDescriptor property);
+
+ void RemoveSort ();
+
+ bool AllowEdit {
+ get;
+ }
+
+ bool AllowNew {
+ get;
+ }
+
+ bool AllowRemove {
+ get;
+ }
+
+ bool IsSorted {
+ get;
+ }
+
+ ListSortDirection SortDirection {
+ get;
+ }
+
+ PropertyDescriptor SortProperty {
+ get;
+ }
+
+ bool SupportsChangeNotification {
+ get;
+ }
+
+ bool SupportsSearching {
+ get;
+ }
+
+ bool SupportsSorting {
+ get;
+ }
+
+ event ListChangedEventHandler ListChanged;
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IComponent.cs b/mcs/class/System/System.ComponentModel/IComponent.cs
new file mode 100644
index 00000000000..347bd2beed7
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IComponent.cs
@@ -0,0 +1,22 @@
+//
+// System.ComponentModel.IComponent.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ public interface IComponent : IDisposable {
+
+ ISite Site {
+ get; set;
+ }
+
+ event EventHandler Disposed;
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IContainer.cs b/mcs/class/System/System.ComponentModel/IContainer.cs
new file mode 100644
index 00000000000..7bab5da610d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IContainer.cs
@@ -0,0 +1,24 @@
+//
+// System.ComponentModel.IContainer.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ public interface IContainer : IDisposable {
+
+ ComponentCollection Components {
+ get;
+ }
+
+ void Add (IComponent component);
+
+ void Add (IComponent component, string name);
+
+ void Remove (IComponent component);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs b/mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs
new file mode 100644
index 00000000000..c716355a601
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs
@@ -0,0 +1,38 @@
+//
+// System.ComponentModel.ICustomTypeDescriptor.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+
+namespace System.ComponentModel
+{
+ public interface ICustomTypeDescriptor
+ {
+ AttributeCollection GetAttributes();
+
+ string GetClassName();
+
+ string GetComponentName();
+
+ TypeConverter GetConverter();
+
+ EventDescriptor GetDefaultEvent();
+
+ PropertyDescriptor GetDefaultProperty();
+
+ object GetEditor(Type editorBaseType);
+
+ EventDescriptorCollection GetEvents();
+
+ EventDescriptorCollection GetEvents(Attribute[] arr);
+
+ PropertyDescriptorCollection GetProperties();
+
+ PropertyDescriptorCollection GetProperties(Attribute[] arr);
+
+ object GetPropertyOwner(PropertyDescriptor pd);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IDataErrorInfo.cs b/mcs/class/System/System.ComponentModel/IDataErrorInfo.cs
new file mode 100644
index 00000000000..a37627d07ca
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IDataErrorInfo.cs
@@ -0,0 +1,18 @@
+//
+// System.ComponentModel.IDataErrorInfo.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+
+namespace System.ComponentModel
+{
+ public interface IDataErrorInfo
+ {
+ string Error { get; }
+
+ string this[string columnName] { get; }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IEditableObject.cs b/mcs/class/System/System.ComponentModel/IEditableObject.cs
new file mode 100644
index 00000000000..40e4d105c17
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IEditableObject.cs
@@ -0,0 +1,20 @@
+//
+// System.ComponentModel.IEditableObject.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+
+namespace System.ComponentModel
+{
+ public interface IEditableObject
+ {
+ void BeginEdit();
+
+ void CancelEdit();
+
+ void EndEdit();
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IExtenderProvider.cs b/mcs/class/System/System.ComponentModel/IExtenderProvider.cs
new file mode 100644
index 00000000000..6e3440d4d25
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IExtenderProvider.cs
@@ -0,0 +1,18 @@
+//------------------------------------------------------------------------------
+//
+// System.ComponentModel.IExtenderProvider.
+//
+// Author: Asier Llano Palacios, asierllano@infonegocio.com
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.ComponentModel {
+
+ public interface IExtenderProvider {
+ bool CanExtend( object extendee );
+ }
+}
+
+
diff --git a/mcs/class/System/System.ComponentModel/IListSource.cs b/mcs/class/System/System.ComponentModel/IListSource.cs
new file mode 100644
index 00000000000..f0d27cfec9b
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IListSource.cs
@@ -0,0 +1,23 @@
+//
+// System.ComponentModel.IListSource.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Collections;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Provides functionality to an object to return a list that can be bound to a data source.
+ /// </summary>
+ public interface IListSource
+ {
+ IList GetList ();
+
+ bool ContainsListCollection { get; }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ISite.cs b/mcs/class/System/System.ComponentModel/ISite.cs
new file mode 100644
index 00000000000..dca26662b6f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ISite.cs
@@ -0,0 +1,23 @@
+//
+// System.ComponentModel.Component.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ public interface ISite : IServiceProvider {
+ IComponent Component { get; }
+
+ IContainer Container { get; }
+
+ bool DesignMode { get; }
+
+ string Name { get; set; }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ISupportInitialize.cs b/mcs/class/System/System.ComponentModel/ISupportInitialize.cs
new file mode 100644
index 00000000000..d5b15f6ee6d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ISupportInitialize.cs
@@ -0,0 +1,23 @@
+//
+// System.ComponentModel.ISupportInitialize.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Specifies that this object supports a simple, transacted notification for batch initialization.
+ /// </summary>
+ public interface ISupportInitialize
+ {
+ void BeginInit ();
+
+ void EndInit ();
+ }
+
+}
+
diff --git a/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs b/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs
new file mode 100755
index 00000000000..e5cad4e0739
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs
@@ -0,0 +1,26 @@
+//
+// System.ComponentModel.ISynchronizeInvoke.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ public interface ISynchronizeInvoke
+ {
+ bool InvokeRequired {
+ get;
+ }
+
+ IAsyncResult BeginInvoke(Delegate method, object[] args);
+
+ object EndInvoke(IAsyncResult result);
+
+ object Invoke(Delegate method, object[] args);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs b/mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs
new file mode 100644
index 00000000000..1da741e37f2
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs
@@ -0,0 +1,29 @@
+//
+// System.ComponentModel.ITypeDescriptorContext
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+
+public interface ITypeDescriptorContext : IServiceProvider
+{
+ IContainer Container { get; }
+
+ object Instance { get; }
+
+ PropertyDescriptor PropertyDescriptor { get; }
+
+ void OnComponentChanged ();
+
+ bool OnComponentChanging ();
+}
+
+}
+
diff --git a/mcs/class/System/System.ComponentModel/ITypedList.cs b/mcs/class/System/System.ComponentModel/ITypedList.cs
new file mode 100644
index 00000000000..8ecdeeef7eb
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ITypedList.cs
@@ -0,0 +1,24 @@
+//
+// System.ComponentModel.ITypedList.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Collections;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Provides functionality to discover the schema for a bindable list, where the properties available for binding differ from the public properties of the object to bind to. For instance, using a DataView object that represents a customer table, you want to bind to the properties on the customer object that the DataView represents, not the properties of the DataView.
+ /// </summary>
+ public interface ITypedList
+ {
+ PropertyDescriptorCollection GetItemProperties (
+ PropertyDescriptor[] listAccessors);
+
+ string GetListName (PropertyDescriptor[] listAccessors);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/Int32Converter.cs b/mcs/class/System/System.ComponentModel/Int32Converter.cs
new file mode 100644
index 00000000000..3fd5e94e0c4
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Int32Converter.cs
@@ -0,0 +1,10 @@
+//
+// System.ComponentModel.Int32Converter
+//
+//
+
+namespace System.ComponentModel {
+ public class Int32Converter : BaseNumberConverter {
+
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs b/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs
new file mode 100644
index 00000000000..6a66b871e87
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs
@@ -0,0 +1,42 @@
+//
+// System.ComponentModel.InvalidEnumArgumentException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ [Serializable]
+ public class InvalidEnumArgumentException : ArgumentException
+ {
+ string msg = String.Empty;
+
+ public InvalidEnumArgumentException () : base ()
+ {
+ }
+
+ public InvalidEnumArgumentException (string message)
+ {
+ msg = message;
+ }
+
+ public InvalidEnumArgumentException (string argumentName, int invalidValue, Type enumClass)
+ {
+ msg = argumentName + " is invalid because this value, " + invalidValue + " is not of type " + enumClass.Name;
+ }
+
+ public override string Message {
+ get {
+ if (ParamName == String.Empty)
+ return msg;
+ else
+ return ParamName + ": " + msg;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs b/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs
new file mode 100644
index 00000000000..d09bd565471
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs
@@ -0,0 +1,69 @@
+//
+// System.ComponentModel.ListBindableAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
+ public sealed class ListBindableAttribute : Attribute
+ {
+ public static readonly ListBindableAttribute Default = new ListBindableAttribute (true, true);
+ public static readonly ListBindableAttribute No = new ListBindableAttribute (false, true);
+ public static readonly ListBindableAttribute Yes = new ListBindableAttribute (true, true);
+
+ bool deflt;
+ bool bindable;
+
+ private ListBindableAttribute (bool listBindable, bool deflt)
+ {
+ this.deflt = deflt;
+ bindable = listBindable;
+ }
+
+ public ListBindableAttribute (bool listBindable)
+ {
+ deflt = false;
+ bindable = true;
+ }
+
+ public ListBindableAttribute (BindableSupport flags)
+ {
+ bindable = (flags == BindableSupport.Yes);
+ deflt = (flags == BindableSupport.Default);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is ListBindableAttribute))
+ return false;
+
+ return (((ListBindableAttribute) obj).bindable == bindable &&
+ ((ListBindableAttribute) obj).deflt == deflt);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return deflt;
+ }
+
+ public bool ListBindable
+ {
+ get {
+ return bindable;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/ListChangedEventArgs.cs b/mcs/class/System/System.ComponentModel/ListChangedEventArgs.cs
new file mode 100755
index 00000000000..6004144b880
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ListChangedEventArgs.cs
@@ -0,0 +1,53 @@
+//
+// System.ComponentModel.ListChangedEventArgs.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System.ComponentModel;
+
+namespace System.ComponentModel {
+ public class ListChangedEventArgs : EventArgs
+ {
+
+ ListChangedType changedType;
+ int oldIndex;
+ int newIndex;
+
+ public ListChangedEventArgs (ListChangedType listChangedType,
+ int newIndex)
+ {
+ this.changedType = listChangedType;
+ this.newIndex = newIndex;
+ }
+
+ [MonoTODO]
+ public ListChangedEventArgs (ListChangedType listChangedType,
+ PropertyDescriptor propDesc)
+ {
+ this.changedType = listChangedType;
+ }
+
+ public ListChangedEventArgs (ListChangedType listChangedType,
+ int newIndex, int oldIndex)
+ {
+ this.changedType = listChangedType;
+ this.newIndex = newIndex;
+ this.oldIndex = oldIndex;
+ }
+
+ public ListChangedType ListChangedType {
+ get { return changedType; }
+ }
+
+ public int OldIndex {
+ get { return oldIndex; }
+ }
+
+ public int NewIndex {
+ get { return newIndex; }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ListChangedEventHandler.cs b/mcs/class/System/System.ComponentModel/ListChangedEventHandler.cs
new file mode 100755
index 00000000000..02f5065b886
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ListChangedEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.ComponentModel.ListChangedEventHandler.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.ComponentModel {
+ [Serializable]
+ public delegate void ListChangedEventHandler(object sender,
+ ListChangedEventArgs e);
+}
diff --git a/mcs/class/System/System.ComponentModel/ListChangedType.cs b/mcs/class/System/System.ComponentModel/ListChangedType.cs
new file mode 100755
index 00000000000..b7eff8aa1fe
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ListChangedType.cs
@@ -0,0 +1,23 @@
+//
+// System.ComponentModel.ListChangedType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.ComponentModel {
+ public enum ListChangedType {
+ Reset = 0,
+ ItemAdded = 1,
+ ItemDeleted = 2,
+ ItemMoved = 3,
+ ItemChanged = 4,
+ PropertyDescriptorAdded = 5,
+ PropertyDescriptorDeleted = 6,
+ PropertyDescriptorChanged = 7
+ }
+}
+
+
+
diff --git a/mcs/class/System/System.ComponentModel/ListSortDirection.cs b/mcs/class/System/System.ComponentModel/ListSortDirection.cs
new file mode 100644
index 00000000000..b58a39a4170
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ListSortDirection.cs
@@ -0,0 +1,20 @@
+//
+// System.ComponentModel.ListSortDirection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Rodrigo Moya, 2002
+//
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Specifies the direction of a sort operation.
+ /// </summary>
+ [Serializable]
+ public enum ListSortDirection {
+ Ascending = 0,
+ Descending = 1
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs b/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs
new file mode 100755
index 00000000000..b5425ef8e53
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.ComponentModel.LocalizableAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class LocalizableAttribute : Attribute {
+ bool localizable;
+
+ public static readonly LocalizableAttribute No;
+ public static readonly LocalizableAttribute Yes;
+
+ static LocalizableAttribute ()
+ {
+ No = new LocalizableAttribute (false);
+ Yes = new LocalizableAttribute (false);
+ }
+
+ public LocalizableAttribute (bool localizable)
+ {
+ this.localizable = localizable;
+ }
+
+ public bool IsLocalizable {
+ get {
+ return localizable;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs b/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs
new file mode 100644
index 00000000000..0a701ff45d7
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs
@@ -0,0 +1,90 @@
+//
+// System.ComponentModel.MarshalByValueComponent.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Implements IComponent and provides the base implementation for remotable components that are marshaled by value (a copy of the serialized object is passed).
+ /// </summary>
+ public class MarshalByValueComponent : IComponent, IDisposable, IServiceProvider
+ {
+ [MonoTODO]
+ public MarshalByValueComponent () {
+ // TODO: need to implement for some component model
+ // but do not throw a NotImplementedException
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ [MonoTODO]
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing) {
+ // free managed objects contained here
+ }
+
+ // Free unmanaged objects
+ // Set fields to null
+ }
+
+ ~MarshalByValueComponent ()
+ {
+ Dispose (false);
+ }
+
+ [MonoTODO]
+ public virtual object GetService (Type service) {
+ return null;
+ }
+
+ public virtual IContainer Container {
+ [MonoTODO]
+ get {
+ return null;
+ }
+ }
+
+ public virtual bool DesignMode {
+ [MonoTODO]
+ get {
+ return false;
+ }
+ }
+
+ public virtual ISite Site {
+ [MonoTODO]
+ get {
+ // TODO: need to get Site
+ return null;
+ }
+
+ [MonoTODO]
+ set {
+ // TODO: need to set Site
+ }
+ }
+
+ protected EventHandlerList Events {
+ [MonoTODO]
+ get {
+ // TODO: need to do, but do not
+ // throw a NotImplementedException
+ return null;
+ }
+ }
+
+ public event EventHandler Disposed;
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/MemberDescriptor.cs b/mcs/class/System/System.ComponentModel/MemberDescriptor.cs
new file mode 100755
index 00000000000..3250a8a07b8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/MemberDescriptor.cs
@@ -0,0 +1,120 @@
+//
+// System.ComponentModel.MemberDescriptor.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ public abstract class MemberDescriptor {
+ string name;
+ Attribute [] attrs;
+ AttributeCollection attrCollection;
+
+ protected MemberDescriptor (string name, Attribute [] attrs)
+ {
+ this.name = name;
+ this.attrs = attrs;
+ }
+
+ protected MemberDescriptor (MemberDescriptor reference, Attribute [] attrs)
+ {
+ name = reference.name;
+ this.attrs = attrs;
+ }
+
+ protected MemberDescriptor (string name)
+ {
+ this.name = name;
+ }
+
+ protected MemberDescriptor (MemberDescriptor reference)
+ {
+ name = reference.name;
+ attrs = reference.attrs;
+ }
+
+ protected virtual Attribute [] AttributeArray {
+ get {
+ return attrs;
+ }
+
+ set {
+ attrs = value;
+ }
+ }
+
+ public virtual AttributeCollection Attributes
+ {
+ get {
+ if (attrCollection == null)
+ attrCollection = new AttributeCollection (attrs);
+ return attrCollection;
+ }
+ }
+
+ public virtual string Category {
+ get {
+ return ((CategoryAttribute) Attributes [typeof (CategoryAttribute)]).Category;
+ }
+ }
+
+ public virtual string Description {
+ get {
+ foreach (Attribute attr in attrs){
+ if (attr is DescriptionAttribute)
+ return ((DescriptionAttribute) attr).Description;
+ }
+
+ return "";
+ }
+ }
+
+ public virtual bool DesignTimeOnly {
+ get {
+ foreach (Attribute attr in attrs){
+ if (attr is DesignOnlyAttribute)
+ return ((DesignOnlyAttribute) attr).IsDesignOnly;
+ }
+
+ return false;
+ }
+ }
+
+ //
+ // FIXME: Is there any difference between DisplayName and Name?
+ //
+ [MonoTODO ("Does this diff from Name ?")]
+ public virtual string DisplayName {
+ get {
+ return name;
+ }
+ }
+
+ public virtual string Name {
+ get {
+ return name;
+ }
+ }
+
+ public virtual bool IsBrowsable {
+ get {
+ foreach (Attribute attr in attrs){
+ if (attr is BrowsableAttribute)
+ return ((BrowsableAttribute) attr).Browsable;
+ }
+
+ return false;
+ }
+ }
+
+ protected virtual int NameHashCode {
+ get {
+ return name.GetHashCode ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs b/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs
new file mode 100755
index 00000000000..327dee061c1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs
@@ -0,0 +1,64 @@
+//
+// System.ComponentModel.NotifyParentPropertyAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+//
+
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class NotifyParentPropertyAttribute : Attribute {
+
+ #region Fields
+
+ bool notifyParent;
+
+ #endregion // Fields
+
+ public static readonly NotifyParentPropertyAttribute No = new NotifyParentPropertyAttribute (false);
+ public static readonly NotifyParentPropertyAttribute Yes = new NotifyParentPropertyAttribute (true);
+ public static readonly NotifyParentPropertyAttribute Default = new NotifyParentPropertyAttribute (false);
+
+ #region Constructors
+
+ public NotifyParentPropertyAttribute (bool notifyParent)
+ {
+ this.notifyParent = notifyParent;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool NotifyParent {
+ get { return notifyParent; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsDefaultAttribute ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs b/mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs
new file mode 100644
index 00000000000..d456a807a7b
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs
@@ -0,0 +1,29 @@
+//
+// System.ComponentModel.PropertyChangedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Provides data for the PropertyChanged event.
+ /// </summary>
+ public class PropertyChangedEventArgs : EventArgs
+ {
+ private string propertyName;
+
+ public PropertyChangedEventArgs (string name) {
+ propertyName = name;
+ }
+
+ public virtual string PropertyName {
+ get {
+ return propertyName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs b/mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs
new file mode 100644
index 00000000000..9dd845ef5c1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs
@@ -0,0 +1,17 @@
+//------------------------------------------------------------------------------
+//
+// System.ComponentModel.PropertyChangedEventHandler.
+//
+// Author: Asier Llano Palacios, asierllano@infonegocio.com
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.ComponentModel {
+
+ [Serializable]
+ public delegate void PropertyChangedEventHandler( object sender, PropertyChangedEventArgs e );
+}
+
+
diff --git a/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs b/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
new file mode 100755
index 00000000000..b426fe29afc
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
@@ -0,0 +1,121 @@
+//
+// System.ComponentModel.PropertyDescriptor.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.ComponentModel {
+
+ public abstract class PropertyDescriptor : MemberDescriptor {
+
+ protected PropertyDescriptor (MemberDescriptor reference)
+ : base (reference)
+ {
+ }
+
+ protected PropertyDescriptor (MemberDescriptor reference, Attribute [] attrs)
+ : base (reference, attrs)
+ {
+ }
+
+ protected PropertyDescriptor (string name, Attribute [] attrs)
+ : base (name, attrs)
+ {
+ }
+
+ public abstract Type ComponentType { get; }
+
+ public virtual TypeConverter Converter {
+ get {
+ return TypeDescriptor.GetConverter (PropertyType);
+ }
+ }
+
+ public virtual bool IsLocalizable {
+ get {
+ foreach (Attribute attr in AttributeArray){
+ if (attr is LocalizableAttribute){
+ return ((LocalizableAttribute) attr).IsLocalizable;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public abstract bool IsReadOnly { get; }
+
+ public abstract Type PropertyType { get; }
+
+ public DesignerSerializationVisibility SerializationVisibility {
+ get {
+ foreach (Attribute attr in AttributeArray){
+ if (attr is DesignerSerializationVisibilityAttribute){
+ DesignerSerializationVisibilityAttribute a;
+
+ a = (DesignerSerializationVisibilityAttribute) attr;
+
+ return a.Visibility;
+ }
+ }
+
+ //
+ // Is this a good default if we cant find the property?
+ //
+ return DesignerSerializationVisibility.Hidden;
+ }
+ }
+
+ Hashtable notifiers;
+
+ public virtual void AddValueChanged (object component, EventHandler handler)
+ {
+ EventHandler component_notifiers;
+
+ if (component == null)
+ throw new ArgumentNullException ("component");
+
+ if (handler == null)
+ throw new ArgumentNullException ("handler");
+
+ if (notifiers == null)
+ notifiers = new Hashtable ();
+
+ component_notifiers = (EventHandler) notifiers [component];
+
+ if (component_notifiers != null)
+ component_notifiers += handler;
+ else
+ notifiers [component] = handler;
+ }
+
+ protected virtual void OnValueChanged (object component, EventArgs e)
+ {
+ if (notifiers == null)
+ return;
+
+ EventHandler component_notifiers = (EventHandler) notifiers [component];
+
+ if (component_notifiers == null)
+ return;
+
+ component_notifiers (component, e);
+ }
+
+ public abstract object GetValue (object component);
+
+ public abstract void SetValue (object component, object value);
+
+ public abstract void ResetValue (object component);
+
+ public abstract bool CanResetValue (object component);
+
+ public abstract bool ShouldSerializeValue (object component);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs b/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
new file mode 100644
index 00000000000..0c230abf66c
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
@@ -0,0 +1,283 @@
+//
+// System.ComponentModel.PropertyDescriptorCollection.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Rodrigo Moya, 2002
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System.Collections;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Represents a collection of PropertyDescriptor objects.
+ /// </summary>
+ public class PropertyDescriptorCollection : IList, ICollection, IEnumerable, IDictionary
+ {
+ public static readonly PropertyDescriptorCollection Empty =
+ new PropertyDescriptorCollection (null);
+
+ ArrayList properties;
+ bool readOnly;
+
+ public PropertyDescriptorCollection (PropertyDescriptor[] properties)
+ {
+ this.properties = new ArrayList ();
+ if (properties == null)
+ return;
+
+ foreach (PropertyDescriptor p in properties)
+ this.properties.Add (p);
+ }
+
+ public int Add (PropertyDescriptor value)
+ {
+ properties.Add (value);
+ return properties.Count - 1;
+ }
+
+ int IList.Add (object value)
+ {
+ return Add ((PropertyDescriptor) value);
+ }
+
+ void IDictionary.Add (object key, object value)
+ {
+ Add ((PropertyDescriptor) value);
+ }
+
+ public void Clear ()
+ {
+ properties.Clear ();
+ }
+
+ void IList.Clear ()
+ {
+ Clear ();
+ }
+
+ void IDictionary.Clear ()
+ {
+ Clear ();
+ }
+
+ public bool Contains (PropertyDescriptor value)
+ {
+ return properties.Contains (value);
+ }
+
+ bool IList.Contains (object value)
+ {
+ return Contains ((PropertyDescriptor) value);
+ }
+
+ bool IDictionary.Contains (object value)
+ {
+ return Contains ((PropertyDescriptor) value);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ properties.CopyTo (array, index);
+ }
+
+ public virtual PropertyDescriptor Find (string name, bool ignoreCase)
+ {
+ foreach (PropertyDescriptor p in properties) {
+ if (0 == String.Compare (name, p.Name, ignoreCase))
+ return p;
+ }
+ return null;
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return properties.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ IDictionaryEnumerator IDictionary.GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public int IndexOf (PropertyDescriptor value)
+ {
+ return properties.IndexOf (value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return IndexOf ((PropertyDescriptor) value);
+ }
+
+ [MonoTODO]
+ public void Insert (int index, PropertyDescriptor value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ Insert (index, (PropertyDescriptor) value);
+ }
+
+ public void Remove (PropertyDescriptor value)
+ {
+ properties.Remove (value);
+ }
+
+ void IDictionary.Remove (object value)
+ {
+ Remove ((PropertyDescriptor) value);
+ }
+
+ void IList.Remove (object value)
+ {
+ Remove ((PropertyDescriptor) value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ properties.RemoveAt (index);
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ RemoveAt (index);
+ }
+
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection Sort ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection Sort (IComparer ic)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InternalSort (IComparer ic)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InternalSort (string [] order)
+ {
+ throw new NotImplementedException ();
+ }
+
+ bool IDictionary.IsFixedSize
+ {
+ get {
+ return !readOnly;
+ }
+ }
+
+ bool IList.IsFixedSize
+ {
+ get {
+ return !readOnly;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get {
+ return readOnly;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public int Count
+ {
+ get {
+ return properties.Count;
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get {
+ return null;
+ }
+ }
+
+ ICollection IDictionary.Keys
+ {
+ get {
+ string [] keys = new string [properties.Count];
+ int i = 0;
+ foreach (PropertyDescriptor p in properties)
+ keys [i++] = p.Name;
+ return keys;
+ }
+ }
+
+ ICollection IDictionary.Values
+ {
+ get {
+ return (ICollection) properties.Clone ();
+ }
+ }
+
+ object IDictionary.this [object key]
+ {
+ get {
+ if (!(key is string))
+ return null;
+ return this [(string) key];
+ }
+ set {
+ if (!(key is string) || (value as PropertyDescriptor) == null)
+ throw new ArgumentException ();
+
+ int idx = properties.IndexOf (value);
+ if (idx == -1)
+ Add ((PropertyDescriptor) value);
+ else
+ properties [idx] = value;
+
+ }
+ }
+ public virtual PropertyDescriptor this [string s]
+ {
+ get {
+ return Find (s, false);
+ }
+ }
+
+ object IList.this [int index]
+ {
+ get {
+ return properties [index];
+ }
+
+ set {
+ properties [index] = value;
+ }
+ }
+
+ public virtual PropertyDescriptor this [int index]
+ {
+ get {
+ return (PropertyDescriptor) properties [index];
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/PropertyTabScope.cs b/mcs/class/System/System.ComponentModel/PropertyTabScope.cs
new file mode 100644
index 00000000000..d138940df2c
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/PropertyTabScope.cs
@@ -0,0 +1,9 @@
+namespace System.ComponentModel {
+
+ public enum PropertyTabScope {
+ Static,
+ Global,
+ Document,
+ Component
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs b/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs
new file mode 100755
index 00000000000..e04ad8bbb94
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs
@@ -0,0 +1,54 @@
+//
+// ReadOnlyAttribute.cs
+//
+// Author:
+// Chris J Breisch (cjbreisch@altavista.net)
+//
+// (C) 2002 Chris J Breisch
+//
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.All)]
+ sealed public class ReadOnlyAttribute : Attribute {
+ bool read_only;
+
+ public static readonly ReadOnlyAttribute No;
+ public static readonly ReadOnlyAttribute Yes;
+ public static readonly ReadOnlyAttribute Default;
+
+ static ReadOnlyAttribute ()
+ {
+ No = new ReadOnlyAttribute (false);
+ Yes = new ReadOnlyAttribute (true);
+ Default = new ReadOnlyAttribute (false);
+ }
+
+ public ReadOnlyAttribute (bool read_only)
+ {
+ this.read_only = read_only;
+ }
+
+ public bool IsReadOnly {
+ get {
+ return read_only;
+ }
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is ReadOnlyAttribute))
+ return false;
+
+ return (((ReadOnlyAttribute) o).read_only == read_only);
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs b/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs
new file mode 100644
index 00000000000..1e3cd7be92f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs
@@ -0,0 +1,65 @@
+//
+// System.ComponentModel.RecommendedAsConfigurableAttribute
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.Property)]
+ public class RecommendedAsConfigurableAttribute : Attribute {
+
+ #region Fields
+
+ bool recommendedAsConfigurable;
+
+ public static readonly RecommendedAsConfigurableAttribute Default = new RecommendedAsConfigurableAttribute (false);
+ public static readonly RecommendedAsConfigurableAttribute No = new RecommendedAsConfigurableAttribute (false);
+ public static readonly RecommendedAsConfigurableAttribute Yes = new RecommendedAsConfigurableAttribute (true);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public RecommendedAsConfigurableAttribute (bool recommendedAsConfigurable)
+ {
+ this.recommendedAsConfigurable = recommendedAsConfigurable;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool RecommendedAsConfigurable {
+ get { return recommendedAsConfigurable; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is RecommendedAsConfigurableAttribute))
+ return false;
+
+ return ((RecommendedAsConfigurableAttribute) obj).RecommendedAsConfigurable == recommendedAsConfigurable;
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return (!recommendedAsConfigurable);
+ }
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/RefreshEventArgs.cs b/mcs/class/System/System.ComponentModel/RefreshEventArgs.cs
new file mode 100644
index 00000000000..87de49b4592
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/RefreshEventArgs.cs
@@ -0,0 +1,44 @@
+//
+// System.ComponentModel.RefreshEventArgs
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+public class RefreshEventArgs : EventArgs
+{
+ private object component;
+ private Type type;
+
+ public RefreshEventArgs (object componentChanged)
+ {
+ if (componentChanged == null)
+ throw new ArgumentNullException ("componentChanged");
+
+ component = componentChanged;
+ type = component.GetType ();
+ }
+
+ public RefreshEventArgs (Type typeChanged)
+ {
+ type = typeChanged;
+ }
+
+ public object ComponentChanged
+ {
+ get { return component; }
+ }
+
+ public Type TypeChanged
+ {
+ get { return type; }
+ }
+}
+}
+
diff --git a/mcs/class/System/System.ComponentModel/RefreshEventHandler.cs b/mcs/class/System/System.ComponentModel/RefreshEventHandler.cs
new file mode 100644
index 00000000000..d14b5988000
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/RefreshEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.ComponentModel.RefreshEventHandler
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.ComponentModel
+{
+ public delegate void RefreshEventHandler (RefreshEventArgs e);
+}
+
diff --git a/mcs/class/System/System.ComponentModel/RefreshProperties.cs b/mcs/class/System/System.ComponentModel/RefreshProperties.cs
new file mode 100644
index 00000000000..4a7d7dbc37f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/RefreshProperties.cs
@@ -0,0 +1,18 @@
+//
+// System.ComponentModel.RefreshProperties.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+namespace System.ComponentModel
+{
+ [Serializable]
+ public enum RefreshProperties {
+ All,
+ None,
+ Repaint
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs b/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs
new file mode 100644
index 00000000000..cadbf29d894
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs
@@ -0,0 +1,63 @@
+//
+// System.ComponentModel.RefreshPropertiesAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+//
+
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class RefreshPropertiesAttribute : Attribute {
+
+ #region Fields
+
+ RefreshProperties refresh;
+
+ #endregion // Fields
+
+ public static readonly RefreshPropertiesAttribute All = new RefreshPropertiesAttribute (RefreshProperties.All);
+ public static readonly RefreshPropertiesAttribute Default = new RefreshPropertiesAttribute (RefreshProperties.None);
+ public static readonly RefreshPropertiesAttribute Repaint = new RefreshPropertiesAttribute (RefreshProperties.Repaint);
+
+ #region Constructors
+
+ public RefreshPropertiesAttribute (RefreshProperties refresh)
+ {
+ this.refresh = refresh;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public RefreshProperties RefreshProperties {
+ get { return refresh; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return (this == RefreshPropertiesAttribute.Default);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/StringConverter.cs b/mcs/class/System/System.ComponentModel/StringConverter.cs
new file mode 100644
index 00000000000..351a00ea11c
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/StringConverter.cs
@@ -0,0 +1,41 @@
+//
+// System.ComponentModel.StringConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Globalization;
+
+namespace System.ComponentModel {
+
+public class StringConverter : TypeConverter
+{
+ public StringConverter ()
+ {
+ }
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof(String))
+ return true;
+
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if (value == null)
+ return String.Empty;
+
+ if (value is string)
+ return (string) value;
+
+ return base.ConvertFrom (context, culture, value);
+ }
+}
+}
+
diff --git a/mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs b/mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs
new file mode 100644
index 00000000000..c350c735b2d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs
@@ -0,0 +1,82 @@
+//
+// System.ComponentModel.ToolboxItemAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.All)]
+ public class ToolboxItemAttribute : Attribute
+ {
+ private static string defaultItemType = "System.Drawing.Design.ToolboxItem,System.Drawing";
+
+ public static readonly ToolboxItemAttribute Default = new ToolboxItemAttribute (defaultItemType);
+ public static readonly ToolboxItemAttribute None = new ToolboxItemAttribute (false);
+
+ private Type itemType;
+ private string itemTypeName;
+
+ public ToolboxItemAttribute (bool defaultType)
+ {
+ if (defaultType)
+ itemTypeName = defaultItemType;
+ }
+
+ public ToolboxItemAttribute (string toolboxItemName)
+ {
+ itemTypeName = toolboxItemName;
+ }
+
+ public ToolboxItemAttribute (Type toolboxItemType)
+ {
+ itemType = toolboxItemType;
+ }
+
+ public Type ToolboxItemType
+ {
+ get {
+ if (itemType == null && itemTypeName != null)
+ itemType = Type.GetType (itemTypeName);
+ return itemType;
+ }
+ }
+
+ public string ToolboxItemTypeName
+ {
+ get {
+ if (itemTypeName == null) {
+ if (itemType == null)
+ return "";
+ itemTypeName = itemType.AssemblyQualifiedName;
+ }
+
+ return itemTypeName;
+ }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is ToolboxItemAttribute))
+ return false;
+
+ return (((ToolboxItemAttribute) o).ToolboxItemTypeName == ToolboxItemTypeName);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return Equals (Default);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/TypeConverter.cs b/mcs/class/System/System.ComponentModel/TypeConverter.cs
new file mode 100755
index 00000000000..ced08223f99
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/TypeConverter.cs
@@ -0,0 +1,318 @@
+//
+// System.ComponentModel.TypeConverter
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.ComponentModel {
+
+public class TypeConverter
+{
+ public TypeConverter ()
+ {
+ }
+
+ public bool CanConvertFrom (Type sourceType)
+ {
+ return CanConvertFrom (null, sourceType);
+ }
+
+ [MonoTODO]
+ public virtual bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool CanConvertTo (Type destinationType)
+ {
+ return CanConvertTo (null, destinationType);
+ }
+
+ public virtual bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ return (destinationType == typeof (string));
+ }
+
+ public object ConvertFrom (object o)
+ {
+ return ConvertFrom (null, CultureInfo.CurrentCulture, o);
+ }
+
+ [MonoTODO]
+ public virtual object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object ConvertFromInvariantString (string text)
+ {
+ return ConvertFromInvariantString (null, text);
+ }
+
+ [MonoTODO]
+ public object ConvertFromInvariantString (ITypeDescriptorContext context, string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object ConvertFromString (string s)
+ {
+ return ConvertFrom (s);
+ }
+
+ public object ConvertFromString (ITypeDescriptorContext context, string text)
+ {
+ return ConvertFromString (context, CultureInfo.CurrentCulture, text);
+ }
+
+ [MonoTODO]
+ public object ConvertFromString (ITypeDescriptorContext context, CultureInfo culture, string text)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object ConvertTo (object value, Type destinationType)
+ {
+ return ConvertTo (null, null, value, destinationType);
+ }
+
+ public virtual object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ // context? culture?
+ if (destinationType == null)
+ throw new ArgumentNullException ("destinationType");
+
+ if (destinationType == typeof (string)) {
+ if (value != null)
+ return value.ToString();
+ return String.Empty;
+ }
+
+ throw new NotSupportedException ("Conversion not supported");
+ }
+
+ public string ConvertToInvariantString (object value)
+ {
+ return ConvertToInvariantString (null, value);
+ }
+
+ [MonoTODO]
+ public string ConvertToInvariantString (ITypeDescriptorContext context, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string ConvertToString (object value)
+ {
+ return (string) ConvertTo (null, CultureInfo.CurrentCulture, value, typeof (string));
+ }
+
+ public string ConvertToString (ITypeDescriptorContext context, object value)
+ {
+ return (string) ConvertTo (context, CultureInfo.CurrentCulture, value, typeof (string));
+ }
+
+ public string ConvertToString (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ return (string) ConvertTo (context, culture, value, typeof (string));
+ }
+
+ [MonoTODO]
+ public object CreateInstance (IDictionary propertyValues)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected Exception GetConvertFromException (object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected Exception GetConvertToException (object value, Type destinationType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object CreateInstance (ITypeDescriptorContext context, IDictionary propertyValues)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetCreateInstanceSupported ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool GetCreateInstanceSupported (ITypeDescriptorContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public PropertyDescriptorCollection GetProperties (object value)
+ {
+ return GetProperties (null, value);
+ }
+
+ public PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value)
+ {
+ return GetProperties (context, value, null);
+ }
+
+ public virtual PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context,
+ object value,
+ Attribute[] attributes)
+ {
+ return null;
+ }
+
+ public bool GetPropertiesSupported ()
+ {
+ return GetPropertiesSupported (null);
+ }
+
+ public virtual bool GetPropertiesSupported (ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public ICollection GetStandardValues ()
+ {
+ return GetStandardValues (null);
+ }
+
+ public virtual StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+ {
+ return null;
+ }
+
+ public bool GetStandardValuesExclusive ()
+ {
+ return GetStandardValuesExclusive (null);
+ }
+
+ public virtual bool GetStandardValuesExclusive (ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public bool GetStandardValuesSupported ()
+ {
+ return GetStandardValuesSupported (null);
+ }
+
+ public virtual bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public bool IsValid (object value)
+ {
+ return IsValid (null, value);
+ }
+
+ public virtual bool IsValid (ITypeDescriptorContext context, object value)
+ {
+ return true;
+ }
+
+ public class StandardValuesCollection : ICollection, IEnumerable
+ {
+ private ICollection values;
+
+ public StandardValuesCollection (ICollection values)
+ {
+ this.values = values;
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ values.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return values.GetEnumerator ();
+ }
+
+ bool ICollection.IsSynchronized
+ {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get { return null; }
+ }
+
+ int ICollection.Count
+ {
+ get { return this.Count; }
+ }
+
+ public int Count
+ {
+ get { return values.Count; }
+ }
+
+ public object this [int index]
+ {
+ get { return ((IList) values) [index]; }
+ }
+ }
+
+ protected abstract class SimplePropertyDescriptor : PropertyDescriptor
+ {
+ private Type componentType;
+ private Type propertyType;
+
+ public SimplePropertyDescriptor (Type componentType,
+ string name,
+ Type propertyType) :
+ this (componentType, name, propertyType, new Attribute [0])
+ {
+ }
+
+ public SimplePropertyDescriptor (Type componentType,
+ string name,
+ Type propertyType,
+ Attribute [] attributes) : base (name, attributes)
+ {
+ this.componentType = componentType;
+ this.propertyType = propertyType;
+ }
+
+ public override Type ComponentType
+ {
+ get { return componentType; }
+ }
+
+ public override Type PropertyType
+ {
+ get { return propertyType; }
+ }
+
+ public override bool IsReadOnly
+ {
+ get {
+ return Attributes.Contains (ReadOnlyAttribute.Yes);
+ }
+ }
+ }
+}
+}
+
diff --git a/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs b/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs
new file mode 100644
index 00000000000..21c283db5fd
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs
@@ -0,0 +1,53 @@
+//
+// System.ComponentModel.TypeConverterAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+[AttributeUsage(AttributeTargets.All)]
+public sealed class TypeConverterAttribute : Attribute
+{
+ private string converter_type;
+
+ public TypeConverterAttribute ()
+ {
+ converter_type = "";
+ }
+
+ public TypeConverterAttribute (string typeName)
+ {
+ converter_type = typeName;
+ }
+
+ public TypeConverterAttribute (Type type)
+ {
+ converter_type = type.AssemblyQualifiedName;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is TypeConverterAttribute))
+ return false;
+
+ return ((TypeConverterAttribute) obj).ConverterTypeName == converter_type;
+ }
+
+ public override int GetHashCode ()
+ {
+ return converter_type.GetHashCode ();
+ }
+
+ public string ConverterTypeName
+ {
+ get { return converter_type; }
+ }
+}
+}
+
diff --git a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
new file mode 100644
index 00000000000..1c6c0118151
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
@@ -0,0 +1,350 @@
+//
+// System.ComponentModel.TypeDescriptor
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.ComponentModel
+{
+
+public sealed class TypeDescriptor
+{
+ private static readonly string creatingDefaultConverters = "creatingDefaultConverters";
+ private static Hashtable defaultConverters;
+
+ private TypeDescriptor ()
+ {
+ }
+
+ [MonoTODO]
+ public static void AddEditorTable (Type editorBaseType, Hashtable table)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptor CreateEvent (Type componentType,
+ string name,
+ Type type,
+ Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptor CreateEvent (Type componentType,
+ EventDescriptor oldEventDescriptor,
+ Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptor CreateProperty (Type componentType,
+ string name,
+ Type type,
+ Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptor CreateProperty (Type componentType,
+ PropertyDescriptor oldPropertyDescriptor,
+ Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static AttributeCollection GetAttributes (Type componentType)
+ {
+ if (componentType == null)
+ return AttributeCollection.Empty;
+
+ object [] atts = componentType.GetCustomAttributes (false);
+ return new AttributeCollection ((Attribute []) atts);
+ }
+
+ public static AttributeCollection GetAttributes (object component)
+ {
+ return GetAttributes (component.GetType ());
+ }
+
+ [MonoTODO]
+ public static AttributeCollection GetAttributes (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GetClassName (object component)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GetClassName (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GetComponentName (object component)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GetComponentName (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static TypeConverter GetConverter (object component)
+ {
+ return GetConverter (component.GetType ());
+ }
+
+ [MonoTODO]
+ public static TypeConverter GetConverter (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ private static Hashtable DefaultConverters
+ {
+ get {
+ if (defaultConverters != null)
+ return defaultConverters;
+
+ lock (creatingDefaultConverters) {
+ if (defaultConverters != null)
+ return defaultConverters;
+
+ //FIXME: add more converters as we implement them
+ defaultConverters = new Hashtable ();
+ defaultConverters.Add (typeof (Enum), typeof (EnumConverter));
+ defaultConverters.Add (typeof (string), typeof (StringConverter));
+ }
+ return defaultConverters;
+ }
+ }
+
+ public static TypeConverter GetConverter (Type type)
+ {
+ Type t = DefaultConverters [type] as Type;
+ if (t == null && type.IsEnum)
+ t = (Type) DefaultConverters [typeof (Enum)];
+
+ string converter_name = null;
+ if (t == null) {
+ object [] attrs = type.GetCustomAttributes (false);
+ foreach (object o in attrs){
+ if (o is TypeConverterAttribute){
+ TypeConverterAttribute tc = (TypeConverterAttribute) o;
+ converter_name = tc.ConverterTypeName;
+ break;
+ }
+ }
+ } else {
+ converter_name = t.FullName;
+ }
+
+
+ if (converter_name == null)
+ return null;
+
+ object converter = null;
+ try {
+ converter = Activator.CreateInstance (Type.GetType (converter_name));
+ } catch (Exception){
+ }
+
+ return converter as TypeConverter;
+ }
+
+ [MonoTODO]
+ public static EventDescriptor GetDefaultEvent (object component)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptor GetDefaultEvent (Type componentType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptor GetDefaultEvent (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptor GetDefaultProperty (object component)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptor GetDefaultProperty (Type componentType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptor GetDefaultProperty (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetEditor (object component, Type editorBaseType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetEditor (Type componentType, Type editorBaseType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetEditor (object component, Type editorBaseType, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptorCollection GetEvents (object component)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptorCollection GetEvents (Type componentType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptorCollection GetEvents (object component, Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptorCollection GetEvents (object component, bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptorCollection GetEvents (Type componentType, Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static EventDescriptorCollection GetEvents (object component,
+ Attribute [] attributes,
+ bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static PropertyDescriptorCollection GetProperties (object component)
+ {
+ return GetProperties (component, false);
+ }
+
+ public static PropertyDescriptorCollection GetProperties (Type componentType)
+ {
+ PropertyInfo [] props = componentType.GetProperties ();
+ DerivedPropertyDescriptor [] propsDescriptor = new DerivedPropertyDescriptor [props.Length];
+ int i = 0;
+ foreach (PropertyInfo prop in props) {
+ DerivedPropertyDescriptor propDescriptor = new DerivedPropertyDescriptor (prop.Name,
+ null, 0);
+ propDescriptor.SetReadOnly (!prop.CanWrite);
+ propDescriptor.SetComponentType (componentType);
+ propDescriptor.SetPropertyType (prop.PropertyType);
+ propsDescriptor [i++] = propDescriptor;
+ }
+
+ return new PropertyDescriptorCollection (propsDescriptor);
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptorCollection GetProperties (object component, Attribute [] attributes)
+ {
+ Type type = component.GetType ();
+ if (typeof (ICustomTypeDescriptor).IsAssignableFrom (type))
+ return ((ICustomTypeDescriptor) component).GetProperties (attributes);
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO("noCustomTypeDesc")]
+ public static PropertyDescriptorCollection GetProperties (object component, bool noCustomTypeDesc)
+ {
+ Type type = component.GetType ();
+ if (typeof (ICustomTypeDescriptor).IsAssignableFrom (type))
+ return ((ICustomTypeDescriptor) component).GetProperties ();
+
+ return GetProperties (type);
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptorCollection GetProperties (Type componentType,
+ Attribute [] attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static PropertyDescriptorCollection GetProperties (Type componentType,
+ Attribute [] attributes,
+ bool noCustomTypeDesc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Refresh (Assembly assembly)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Refresh (Module module)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Refresh (object component)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void Refresh (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static event RefreshEventHandler Refreshed;
+}
+}
+
diff --git a/mcs/class/System/System.ComponentModel/WarningException.cs b/mcs/class/System/System.ComponentModel/WarningException.cs
new file mode 100644
index 00000000000..14e7aff65cf
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/WarningException.cs
@@ -0,0 +1,49 @@
+//------------------------------------------------------------------------------
+//
+// System.ComponentModel.WarningException.
+//
+// Author: Asier Llano Palacios, asierllano@infonegocio.com
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.ComponentModel {
+
+ public class WarningException : SystemException
+ {
+ private string helpUrl;
+ private string helpTopic;
+
+ public WarningException( string message )
+ : base( message ) {
+ helpUrl = null;
+ helpTopic = null;
+ }
+
+ public WarningException( string message, string helpUrl )
+ : base( message ) {
+ this.helpUrl = helpUrl;
+ this.helpTopic = null;
+ }
+
+ public WarningException( string message, string helpUrl, string helpTopic ) {
+ this.helpUrl = helpUrl;
+ this.helpTopic = helpTopic;
+ }
+
+ public string HelpTopic {
+ get {
+ return helpTopic;
+ }
+ }
+
+ public string HelpUrl {
+ get {
+ return helpUrl;
+ }
+ }
+ }
+
+}
+
diff --git a/mcs/class/System/System.ComponentModel/Win32Exception.cs b/mcs/class/System/System.ComponentModel/Win32Exception.cs
new file mode 100755
index 00000000000..653d76d227a
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Win32Exception.cs
@@ -0,0 +1,126 @@
+//
+// System.ComponentModel.Win32Exceptioncs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Collections;
+using System.Globalization;
+
+namespace System.ComponentModel
+{
+ [Serializable]
+ public class Win32Exception : ExternalException
+ {
+ private int native_error_code;
+
+ public Win32Exception ()
+ : base (W32ErrorMessage(Marshal.GetLastWin32Error()),
+ Marshal.GetLastWin32Error()) {
+ native_error_code=Marshal.GetLastWin32Error();
+ }
+
+ public Win32Exception(int error)
+ : base (W32ErrorMessage(error), error) {
+ native_error_code=error;
+ }
+
+ public Win32Exception(int error, string message)
+ : base (message, error) {
+ native_error_code=error;
+ }
+
+ protected Win32Exception(SerializationInfo info,
+ StreamingContext context)
+ : base (info, context) {
+ }
+
+ public int NativeErrorCode {
+ get {
+ return(native_error_code);
+ }
+ }
+
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo info,
+ StreamingContext context) {
+ if(info==null) {
+ throw new ArgumentNullException();
+ }
+
+ throw new NotImplementedException();
+ }
+
+ private static Hashtable w32_errors = new Hashtable();
+
+ /* Initialise the list of error strings */
+ static Win32Exception() {
+ /* No need to list everything, just the ones
+ * the runtime can throw. A list of the errors
+ * can be found in class System.IO.MonoIOError.
+ */
+ w32_errors.Add(10004,
+ Locale.GetText("interrupted"));
+ w32_errors.Add(10013,
+ Locale.GetText("Access denied"));
+ w32_errors.Add(10022,
+ Locale.GetText("Invalid arguments"));
+ w32_errors.Add(10035,
+ Locale.GetText("Operation on non-blocking socket would block"));
+ w32_errors.Add(10036,
+ Locale.GetText("Operation in progress"));
+ w32_errors.Add(10038,
+ Locale.GetText("The descriptor is not a socket"));
+ w32_errors.Add(10043,
+ Locale.GetText("proto no supported"));
+ w32_errors.Add(10044,
+ Locale.GetText("socket not supproted"));
+ w32_errors.Add(10045,
+ Locale.GetText("Operation not supported"));
+ w32_errors.Add(10047,
+ Locale.GetText("AF not supported"));
+ w32_errors.Add(10048,
+ Locale.GetText("Address already in use"));
+ w32_errors.Add(10050,
+ Locale.GetText("Network subsystem is down"));
+ w32_errors.Add(10051,
+ Locale.GetText("Network is unreachable"));
+ w32_errors.Add(10055,
+ Locale.GetText("Not enough buffer space is available"));
+ w32_errors.Add(10056,
+ Locale.GetText("Socket is already connected"));
+ w32_errors.Add(10057,
+ Locale.GetText("The socket is not connected"));
+ w32_errors.Add(10058,
+ Locale.GetText("The socket has been shut down"));
+ w32_errors.Add(10060,
+ Locale.GetText("Connection timed out"));
+ w32_errors.Add(10061,
+ Locale.GetText("Connection refused"));
+ w32_errors.Add(10093,
+ Locale.GetText("Winsock not initialized"));
+ w32_errors.Add(10107,
+ Locale.GetText("System call failed"));
+
+ w32_errors.Add(11001,
+ Locale.GetText("No such host is known"));
+ w32_errors.Add(11002,
+ Locale.GetText("A temporary error occurred on an authoritative name server. Try again later."));
+ }
+
+ private static string W32ErrorMessage(int error_code) {
+ string message=(string)w32_errors[error_code];
+
+ if(message==null) {
+ return(Locale.GetText("Some sort of w32 error occurred"));
+ } else {
+ return(message);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/AppSettingsReader.cs b/mcs/class/System/System.Configuration/AppSettingsReader.cs
new file mode 100644
index 00000000000..b0eecba7265
--- /dev/null
+++ b/mcs/class/System/System.Configuration/AppSettingsReader.cs
@@ -0,0 +1,54 @@
+//
+// System.Configuration.AppSettingsReader
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Reflection;
+using System.Collections.Specialized;
+
+namespace System.Configuration
+{
+ public class AppSettingsReader
+ {
+ NameValueCollection appSettings;
+
+ public AppSettingsReader ()
+ {
+ appSettings = ConfigurationSettings.AppSettings;
+ }
+
+ public object GetValue (string key, Type type)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("key");
+
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ string value = appSettings [key];
+ if (value == null)
+ throw new InvalidOperationException ("'" + key + "' could not be found.");
+
+ if (type == typeof (string))
+ return value.Substring (1, value.Length - 2);
+
+ MethodInfo parse = type.GetMethod ("Parse", new Type [] {typeof (string)});
+ if (parse == null)
+ throw new InvalidOperationException ("Type " + type + " does not have a Parse method");
+
+ object result = null;
+ try {
+ result = parse.Invoke (null, new object [] {value});
+ } catch (Exception e) {
+ throw new InvalidOperationException ("Parse error.", e);
+ }
+
+ return result;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Configuration/ChangeLog b/mcs/class/System/System.Configuration/ChangeLog
new file mode 100644
index 00000000000..d94ca2ca6f2
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ChangeLog
@@ -0,0 +1,136 @@
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigXmlDocument.cs: don't jump over the first element.
+ * ConfigurationSettings.cs: pass doc.DocumentElement instead of doc.
+
+ This used to work until i tried to access one attribute of the first
+ element and realized that the element was not the expected!
+ This change does not affect the configuration handlers that only use
+ ChildNodes property on the XmlNode they get as argument.
+
+2002-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigurationSettings.cs: removed type loading hack no longer needed.
+
+2002-12-14 Jonathan Pryor <jonpryor@vt.edu>
+
+ * ConfigurationSettings.cs: Allow configuration sections to be removed.
+
+2002-11-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigurationSettings.cs: use AppDomainSetup to get the configuration
+ file name for the AppDomain.
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigHelper.cs: NameValueCollection.Add is now fixed.
+
+2002-10-14 Martin Baulig <martin@gnome.org>
+
+ * ConfigurationSettings.cs (DefaultConfig.GetAppConfigPath):
+ Append ".config" to the filename, not ".exe.config" since the
+ filename already has a ".exe" suffix.
+
+2002-10-14 Martin Baulig <martin@gnome.org>
+
+ * ConfigurationSettings.cs (DefaultConfig.GetAppConfigPath): Use
+ Assembly.Location, not Assembly.FullName to get its filename.
+
+2002-10-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigHelper.cs: workaround for a bug in NameValueCollection.
+ * ConfigurationSettings.cs: load sections when the parent holds a
+ handler for it. Now overriding appSettings values in the app config
+ file works (first <remove..> and then <add...).
+
+2002-10-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigHelper.cs:
+ * NameValueFileSectionHandler.cs: check that Attributes is not null.
+
+2002-10-09 Miguel de Icaza <miguel@ximian.com>
+
+ * NameValueFileSectionHandler.cs: For now if a section is not
+ present, return null. Do not know what the real fix is. Gonzalo
+ will have to look at this, but the debugger was crashing as
+ appSettings in the machine.config does not exist, but GetConfig
+ returns a non-null value when looking it up when you do a
+ GetDocumentForSection ("appSettings").
+
+2002-10-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigurationSettings.cs: use get_machine_config_path internal call.
+
+2002-10-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigXmlDocument.cs: move the reader for the section to the first
+ element.
+
+ * ConfigurationSettings.cs: fixed hierarchical search for a handler.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigurationSettings.cs: reimplemented. It is now able to deliver
+ sections to their handlers for processing.
+
+2002-10-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ConfigHelper.cs: New file. Contains some
+ helper functions for getting key-value collections from the config file.
+
+ * ConfigXmlDocument.cs: wrapper around xml elements to provide line
+ number and file name info.
+ * IConfigXmlNode.cs: used in ConfigXmlDocument and
+ ConfigurationException.
+
+ * ConfigurationException.cs: get file name and line
+ number from the wrapped XmlNode. Display this info in Message.
+
+ * NameValueFileSectionHandler.cs: new handler.
+ * DictionarySectionHandler.cs:
+ * NameValueSectionHandler.cs: modified to use the helper methods in
+ ConfigHelper.
+
+2002-10-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppSettingsReader.cs: New file.
+ * IConfigurationSystem.cs: New file.
+
+ * IgnoreSectionHandler.cs:
+ * NameValueSectionHandler.cs:
+ * SingleTagSectionHandler.cs: little fixes.
+
+2002-09-03 Martin Baulig <martin@gnome.org>
+
+ * ConfigurationSettings.cs (ConfigurationSettings.GetConfig): Use the
+ correct configuration filename, fixed the TODO.
+ (GetSectionHanderType): Renamed to GetSectionHandlerType.
+
+ * NameValueSectionHandler.cs (NameValueSectionHandler.Create): Allow
+ whitespaces in the configuration file.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * ConfigurationException.cs: Rewrote most of the file and added
+ serialization bits.
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * ConfigurationSettings.cs, IgnoreSectionHandler.cs : MonoTODO decoration
+
+ * SingleTagSectionHandler.cs, DictionarySectionHandler.cs,
+ NameValueSectionHandler.cs : Ditto.
+
+2001-08-28 Christopher Podurgiel <cpodurgiel@msn.com>
+ * IConfigurationSectionHandler.cs: Added reference to System.Xml.
+
+ * SingleTagSectionHandler.cs: Added Implementation of Create() method.
+
+ * NameValueSectionHandler.cs: Added Implementation of Create() method.
+
+ * ConfigurationException.cs: Now returns proper message rather than "System Exception".
+
+2001-08-26 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * ConfigurationSettings.cs: No longer references the NameValueSectionHandler directly. Instead it uses System.Reflection to call the Create() method for the appropriate SectionHandler as defined in the .config file.
+
diff --git a/mcs/class/System/System.Configuration/ConfigHelper.cs b/mcs/class/System/System.Configuration/ConfigHelper.cs
new file mode 100644
index 00000000000..62f4b83f9af
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ConfigHelper.cs
@@ -0,0 +1,184 @@
+//
+// System.Configuration.ConfigHelper
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System.Collections;
+using System.Collections.Specialized;
+using System.Xml;
+
+namespace System.Configuration
+{
+ class ConfigHelper
+ {
+ class CollectionWrapper
+ {
+ IDictionary dict;
+ NameValueCollection collection;
+ bool isDict;
+
+ public CollectionWrapper (IDictionary dict)
+ {
+ this.dict = dict;
+ isDict = true;
+ }
+
+ public CollectionWrapper (NameValueCollection collection)
+ {
+ this.collection = collection;
+ isDict = false;
+ }
+
+ public void Remove (string s)
+ {
+ if (isDict)
+ dict.Remove (s);
+ else
+ collection.Remove (s);
+ }
+
+ public void Clear ()
+ {
+ if (isDict)
+ dict.Clear ();
+ else
+ collection.Clear ();
+ }
+
+ public string this [string key]
+ {
+ set {
+ if (isDict)
+ dict [key] = value;
+ else
+ collection [key] = value;
+ }
+ }
+
+ public object UnWrap ()
+ {
+ if (isDict)
+ return dict;
+ else
+ return collection;
+ }
+ }
+
+ internal static IDictionary GetDictionary (IDictionary prev,
+ XmlNode region,
+ string nameAtt,
+ string valueAtt)
+ {
+ Hashtable hash;
+ if (prev == null)
+ hash = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+ else {
+ Hashtable aux = (Hashtable) prev;
+ hash = (Hashtable) aux.Clone ();
+ }
+
+ CollectionWrapper result = new CollectionWrapper (hash);
+ result = GoGetThem (result, region, nameAtt, valueAtt);
+ if (result == null)
+ return null;
+
+ return result.UnWrap () as IDictionary;
+ }
+
+ internal static NameValueCollection GetNameValueCollection (NameValueCollection prev,
+ XmlNode region,
+ string nameAtt,
+ string valueAtt)
+ {
+ NameValueCollection coll =
+ new NameValueCollection (CaseInsensitiveHashCodeProvider.Default,
+ CaseInsensitiveComparer.Default);
+
+ if (prev != null)
+ coll.Add (prev);
+
+ CollectionWrapper result = new CollectionWrapper (coll);
+ result = GoGetThem (result, region, nameAtt, valueAtt);
+ if (result == null)
+ return null;
+
+ return result.UnWrap () as NameValueCollection;
+ }
+
+ private static CollectionWrapper GoGetThem (CollectionWrapper result,
+ XmlNode region,
+ string nameAtt,
+ string valueAtt)
+ {
+ if (region.Attributes != null && region.Attributes.Count != 0)
+ throw new ConfigurationException ("Unknown attribute", region);
+
+ XmlNode keyNode;
+ XmlNode valueNode;
+ XmlNodeList childs = region.ChildNodes;
+ foreach (XmlNode node in childs) {
+ XmlNodeType ntype = node.NodeType;
+ if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
+ continue;
+
+ if (ntype != XmlNodeType.Element)
+ throw new ConfigurationException ("Only XmlElement allowed", node);
+
+ string nodeName = node.Name;
+ if (nodeName == "clear") {
+ if (node.Attributes != null && node.Attributes.Count != 0)
+ throw new ConfigurationException ("Unknown attribute", node);
+
+ result.Clear ();
+ } else if (nodeName == "remove") {
+ keyNode = null;
+ if (node.Attributes != null)
+ keyNode = node.Attributes.RemoveNamedItem (nameAtt);
+
+ if (keyNode == null)
+ throw new ConfigurationException ("Required attribute not found",
+ node);
+ if (keyNode.Value == String.Empty)
+ throw new ConfigurationException ("Required attribute is empty",
+ node);
+
+ if (node.Attributes.Count != 0)
+ throw new ConfigurationException ("Unknown attribute", node);
+
+ result.Remove (keyNode.Value);
+ } else if (nodeName == "add") {
+ keyNode = null;
+ if (node.Attributes != null)
+ keyNode = node.Attributes.RemoveNamedItem (nameAtt);
+
+ if (keyNode == null)
+ throw new ConfigurationException ("Required attribute not found",
+ node);
+ if (keyNode.Value == String.Empty)
+ throw new ConfigurationException ("Required attribute is empty",
+ node);
+
+ valueNode = node.Attributes.RemoveNamedItem (valueAtt);
+ if (valueNode == null)
+ throw new ConfigurationException ("Required attribute not found",
+ node);
+
+ if (node.Attributes.Count != 0)
+ throw new ConfigurationException ("Unknown attribute", node);
+
+ result [keyNode.Value] = valueNode.Value;
+ } else {
+ throw new ConfigurationException ("Unknown element", node);
+ }
+ }
+
+ return result;
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.Configuration/ConfigXmlDocument.cs b/mcs/class/System/System.Configuration/ConfigXmlDocument.cs
new file mode 100644
index 00000000000..2c890e340b6
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ConfigXmlDocument.cs
@@ -0,0 +1,234 @@
+//
+// System.Configuration.ConfigXmlDocument
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.IO;
+using System.Xml;
+
+namespace System.Configuration
+{
+ public sealed class ConfigXmlDocument : XmlDocument, IConfigXmlNode
+ {
+ XmlTextReader reader;
+ string fileName;
+ int lineNumber;
+
+ public override XmlAttribute CreateAttribute (string prefix,
+ string localName,
+ string namespaceUri)
+ {
+ return new ConfigXmlAttribute (this, prefix, localName, namespaceUri);
+ }
+
+ public override XmlCDataSection CreateCDataSection (string data)
+ {
+ return new ConfigXmlCDataSection (this, data);
+ }
+
+ public override XmlComment CreateComment (string comment)
+ {
+ return new ConfigXmlComment (this, comment);
+ }
+
+ public override XmlElement CreateElement (string prefix, string localName, string namespaceUri)
+ {
+ return new ConfigXmlElement (this, prefix, localName, namespaceUri);
+ }
+
+ public override XmlSignificantWhitespace CreateSignificantWhitespace (string data)
+ {
+ return base.CreateSignificantWhitespace (data);
+ }
+
+ public override XmlText CreateTextNode (string text)
+ {
+ return new ConfigXmlText (this, text);
+ }
+
+ public override XmlWhitespace CreateWhitespace (string data)
+ {
+ return base.CreateWhitespace (data);
+ }
+
+ public override void Load (string filename)
+ {
+ LoadSingleElement (filename, new XmlTextReader (filename));
+ }
+
+ public void LoadSingleElement (string filename, XmlTextReader sourceReader)
+ {
+
+ fileName = filename;
+ lineNumber = sourceReader.LineNumber;
+ string xml = sourceReader.ReadOuterXml();
+ reader = new XmlTextReader (new StringReader (xml), sourceReader.NameTable);
+ Load (reader);
+ reader.Close ();
+ }
+
+ public string Filename
+ {
+ get {
+ return fileName;
+ }
+ }
+
+ public int LineNumber
+ {
+ get {
+ return lineNumber;
+ }
+ }
+
+ //
+ // Wrappers for Xml* that just provide file name and line number addition
+ //
+ class ConfigXmlAttribute : XmlAttribute, IConfigXmlNode
+ {
+ string fileName;
+ int lineNumber;
+
+ public ConfigXmlAttribute (ConfigXmlDocument document,
+ string prefix,
+ string localName,
+ string namespaceUri)
+ : base (prefix, localName, namespaceUri, document)
+ {
+ fileName = document.Filename;
+ lineNumber = document.LineNumber;
+ }
+
+ public string Filename
+ {
+ get {
+ return fileName;
+ }
+ }
+
+ public int LineNumber
+ {
+ get {
+ return lineNumber;
+ }
+ }
+ }
+
+ class ConfigXmlCDataSection : XmlCDataSection, IConfigXmlNode
+ {
+ string fileName;
+ int lineNumber;
+
+ public ConfigXmlCDataSection (ConfigXmlDocument document, string data)
+ : base (data, document)
+ {
+ fileName = document.Filename;
+ lineNumber = document.LineNumber;
+ }
+
+ public string Filename
+ {
+ get {
+ return fileName;
+ }
+ }
+
+ public int LineNumber
+ {
+ get {
+ return lineNumber;
+ }
+ }
+ }
+
+ class ConfigXmlComment : XmlComment, IConfigXmlNode
+ {
+ string fileName;
+ int lineNumber;
+
+ public ConfigXmlComment (ConfigXmlDocument document, string comment)
+ : base (comment, document)
+ {
+ fileName = document.Filename;
+ lineNumber = document.LineNumber;
+ }
+
+ public string Filename
+ {
+ get {
+ return fileName;
+ }
+ }
+
+ public int LineNumber
+ {
+ get {
+ return lineNumber;
+ }
+ }
+ }
+
+ class ConfigXmlElement : XmlElement, IConfigXmlNode
+ {
+ string fileName;
+ int lineNumber;
+
+ public ConfigXmlElement (ConfigXmlDocument document,
+ string prefix,
+ string localName,
+ string namespaceUri)
+ : base (prefix, localName, namespaceUri, document)
+ {
+ fileName = document.Filename;
+ lineNumber = document.LineNumber;
+ }
+
+ public string Filename
+ {
+ get {
+ return fileName;
+ }
+ }
+
+ public int LineNumber
+ {
+ get {
+ return lineNumber;
+ }
+ }
+ }
+
+ class ConfigXmlText : XmlText, IConfigXmlNode
+ {
+ string fileName;
+ int lineNumber;
+
+ public ConfigXmlText (ConfigXmlDocument document, string data)
+ : base (data, document)
+ {
+ fileName = document.Filename;
+ lineNumber = document.LineNumber;
+ }
+
+ public string Filename
+ {
+ get {
+ return fileName;
+ }
+ }
+
+ public int LineNumber
+ {
+ get {
+ return lineNumber;
+ }
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Configuration/ConfigurationException.cs b/mcs/class/System/System.Configuration/ConfigurationException.cs
new file mode 100644
index 00000000000..da0639c1620
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ConfigurationException.cs
@@ -0,0 +1,141 @@
+//
+// System.Configuration.ConfigurationException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Xml;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Configuration
+{
+ [Serializable]
+ public class ConfigurationException : SystemException
+ {
+ // Fields
+ string bareMessage;
+ string filename;
+ int line;
+
+ //
+ // Constructors
+ //
+ public ConfigurationException ()
+ : base (Locale.GetText ("There is an error in a configuration setting."))
+ {
+ filename = null;
+ bareMessage = Locale.GetText ("There is an error in a configuration setting.");
+ line = 0;
+ }
+
+ public ConfigurationException (string message)
+ : base (message)
+ {
+ bareMessage = message;
+ }
+
+ protected ConfigurationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ filename = info.GetString ("filename");
+ line = info.GetInt32 ("line");
+ }
+
+ public ConfigurationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ bareMessage = message;
+ }
+
+ public ConfigurationException (string message, XmlNode node)
+ : base (message)
+ {
+ filename = GetXmlNodeFilename(node);
+ line = GetXmlNodeLineNumber(node);
+ bareMessage = message;
+ }
+
+ public ConfigurationException (string message, Exception inner, XmlNode node)
+ : base (message, inner)
+ {
+ filename = GetXmlNodeFilename (node);
+ line = GetXmlNodeLineNumber (node);
+ bareMessage = message;
+ }
+
+ public ConfigurationException (string message, string filename, int line)
+ : base (message)
+ {
+ bareMessage = message;
+ this.filename = filename;
+ this.line= line;
+ }
+
+ public ConfigurationException (string message, Exception inner, string filename, int line)
+ : base (message)
+ {
+ bareMessage = message;
+ this.filename = filename;
+ this.line = line;
+ }
+ //
+ // Properties
+ //
+ public string BareMessage
+ {
+ get { return bareMessage; }
+ }
+
+ public string Filename
+ {
+ get { return filename; }
+ }
+
+ public int Line
+ {
+ get { return line; }
+ }
+
+ public override string Message
+ {
+ get {
+ string baseMsg = base.Message;
+ string f = (filename == null) ? String.Empty : filename;
+ string l = (line == 0) ? String.Empty : (" line " + line);
+
+ return baseMsg + "(" + f + l + ")";
+ }
+ }
+
+ //
+ // Methods
+ //
+ public static string GetXmlNodeFilename (XmlNode node)
+ {
+ if (!(node is IConfigXmlNode))
+ return String.Empty;
+
+ return ((IConfigXmlNode) node).Filename;
+ }
+
+ public static int GetXmlNodeLineNumber (XmlNode node)
+ {
+ if (!(node is IConfigXmlNode))
+ return 0;
+
+ return ((IConfigXmlNode) node).LineNumber;
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("filename", filename);
+ info.AddValue ("line", line);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/ConfigurationSettings.cs b/mcs/class/System/System.Configuration/ConfigurationSettings.cs
new file mode 100644
index 00000000000..b9c3b963acb
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ConfigurationSettings.cs
@@ -0,0 +1,456 @@
+//
+// System.Configuration.ConfigurationSettings.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// C) Christopher Podurgiel
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Xml;
+using System.Xml.XPath;
+
+namespace System.Configuration
+{
+ public sealed class ConfigurationSettings
+ {
+ static IConfigurationSystem config;
+
+ private ConfigurationSettings ()
+ {
+ }
+
+ public static object GetConfig (string sectionName)
+ {
+ if (config == null)
+ config = DefaultConfig.GetInstance ();
+
+ return config.GetConfig (sectionName);
+ }
+
+ public static NameValueCollection AppSettings
+ {
+ get {
+ object appSettings = GetConfig ("appSettings");
+ if (appSettings == null)
+ appSettings = new NameValueCollection ();
+
+ return (NameValueCollection) appSettings;
+ }
+ }
+
+ }
+
+ //
+ // class DefaultConfig: read configuration from machine.config file and application
+ // config file if available.
+ //
+ class DefaultConfig : IConfigurationSystem
+ {
+ static string creatingInstance = "137213797382-asad";
+ static string buildingData = "1797382-ladgasjkdg";
+ static DefaultConfig instance;
+ ConfigurationData config;
+
+ private DefaultConfig ()
+ {
+ }
+
+ public static DefaultConfig GetInstance ()
+ {
+ if (instance == null) {
+ lock (creatingInstance) {
+ if (instance == null) {
+ instance = new DefaultConfig ();
+ instance.Init ();
+ }
+
+ }
+ }
+
+ return instance;
+ }
+
+ public object GetConfig (string sectionName)
+ {
+ if (config == null)
+ return null;
+
+ return config.GetConfig (sectionName);
+ }
+
+ public void Init ()
+ {
+ if (config == null){
+ lock (buildingData) {
+ if (config != null)
+ return;
+
+ ConfigurationData data = new ConfigurationData ();
+ if (data.Load (GetMachineConfigPath ())) {
+ ConfigurationData appData = new ConfigurationData (data);
+ appData.Load (GetAppConfigPath ());
+ config = appData;
+ } else {
+ Console.WriteLine ("** Warning **: cannot find " + GetMachineConfigPath ());
+ Console.WriteLine ("Trying to load app config file...");
+ data.Load (GetAppConfigPath ());
+ config = data;
+ }
+ }
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern private static string get_machine_config_path ();
+
+ private static string GetMachineConfigPath ()
+ {
+ return get_machine_config_path ();
+ }
+
+ private static string GetAppConfigPath ()
+ {
+ AppDomainSetup currentInfo = AppDomain.CurrentDomain.SetupInformation;
+
+ string configFile = currentInfo.ConfigurationFile;
+ if (configFile == null || configFile.Length == 0)
+ return null;
+
+ return configFile;
+
+ }
+ }
+
+ class ConfigurationData
+ {
+ ConfigurationData parent;
+ Hashtable factories;
+ string fileName;
+ object removedMark = new object ();
+ object groupMark = new object ();
+
+ public ConfigurationData () : this (null)
+ {
+ }
+
+ public ConfigurationData (ConfigurationData parent)
+ {
+ this.parent = (parent == this) ? null : parent;
+ factories = new Hashtable ();
+ }
+
+ public bool Load (string fileName)
+ {
+ if (fileName == null)
+ return false;
+
+ this.fileName = fileName;
+ XmlTextReader reader = null;
+
+ try {
+ try {
+ reader = new XmlTextReader (fileName);
+ } catch {
+ return false;
+ }
+
+ InitRead (reader);
+ ReadConfigFile (reader);
+ } finally {
+ if (reader != null)
+ reader.Close();
+ }
+
+ return true;
+ }
+
+ object GetHandler (string sectionName)
+ {
+ object o = factories [sectionName];
+ if (o == null || o == removedMark) {
+ if (parent != null)
+ return parent.GetHandler (sectionName);
+
+ return null;
+ }
+
+ if (o is IConfigurationSectionHandler)
+ return (IConfigurationSectionHandler) o;
+
+ Type t = Type.GetType ((string) o);
+ if (t == null)
+ throw new ConfigurationException ("Cannot get Type for " + o);
+
+ Type iconfig = typeof (IConfigurationSectionHandler);
+ if (!iconfig.IsAssignableFrom (t))
+ throw new ConfigurationException (sectionName + " does not implement " + iconfig);
+
+ o = Activator.CreateInstance (t, true);
+ if (o == null)
+ throw new ConfigurationException ("Cannot get instance for " + t);
+
+ factories [sectionName] = o;
+
+ return o;
+ }
+
+ //TODO: Should use XPath when it works properly for this.
+ XmlDocument GetDocumentForSection (string sectionName)
+ {
+ XmlTextReader reader = null;
+ try {
+ reader = new XmlTextReader (fileName);
+ } catch {
+ return null;
+ }
+
+ ConfigXmlDocument doc = new ConfigXmlDocument ();
+ InitRead (reader);
+ string [] sectionPath = sectionName.Split ('/');
+ int i = 0;
+ if (!reader.EOF) {
+ if (reader.Name == "configSections")
+ reader.Skip ();
+
+ while (!reader.EOF) {
+ if (reader.NodeType == XmlNodeType.Element &&
+ reader.Name == sectionPath [i]) {
+ if (++i == sectionPath.Length) {
+ doc.LoadSingleElement (fileName, reader);
+ break;
+ }
+ MoveToNextElement (reader);
+ continue;
+ }
+ reader.Skip ();
+ if (reader.NodeType != XmlNodeType.Element)
+ MoveToNextElement (reader);
+ }
+ }
+
+ reader.Close ();
+ return doc;
+ }
+
+ public object GetConfig (string sectionName)
+ {
+ object handler = GetHandler (sectionName);
+ if (handler == null)
+ return null;
+
+ if (!(handler is IConfigurationSectionHandler))
+ return handler;
+
+ object parentConfig = null;
+ if (parent != null)
+ parentConfig = parent.GetConfig (sectionName);
+
+ XmlDocument doc = GetDocumentForSection (sectionName);
+ if (doc == null || doc.DocumentElement == null) {
+ if (parentConfig == null)
+ return null;
+
+ return parentConfig;
+ }
+
+ return ((IConfigurationSectionHandler) handler).Create (parentConfig, null, doc.DocumentElement);
+ }
+
+ private object LookForFactory (string key)
+ {
+ object o = factories [key];
+ if (o != null)
+ return o;
+
+ if (parent != null)
+ return parent.LookForFactory (key);
+
+ return null;
+ }
+
+ private void InitRead (XmlTextReader reader)
+ {
+ reader.MoveToContent ();
+ if (reader.NodeType != XmlNodeType.Element || reader.Name != "configuration")
+ ThrowException ("Configuration file does not have a valid root element", reader);
+
+ if (reader.HasAttributes)
+ ThrowException ("Unrecognized attribute in root element", reader);
+
+ MoveToNextElement (reader);
+ }
+
+ private void MoveToNextElement (XmlTextReader reader)
+ {
+ while (reader.Read ()) {
+ XmlNodeType ntype = reader.NodeType;
+ if (ntype == XmlNodeType.Element)
+ return;
+
+ if (ntype != XmlNodeType.Whitespace &&
+ ntype != XmlNodeType.Comment &&
+ ntype != XmlNodeType.SignificantWhitespace &&
+ ntype != XmlNodeType.EndElement)
+ ThrowException ("Unrecognized element", reader);
+ }
+ }
+
+ private void ReadSection (XmlTextReader reader, string sectionName)
+ {
+ string attName;
+ string nameValue = null;
+ string typeValue = null;
+
+ while (reader.MoveToNextAttribute ()) {
+ attName = reader.Name;
+ if (attName == null)
+ continue;
+
+ if (attName == "allowLocation" || attName == "allowDefinition")
+ continue;
+
+ if (attName == "type") {
+ if (typeValue != null)
+ ThrowException ("Duplicated type attribute.", reader);
+ typeValue = reader.Value;
+ continue;
+ }
+
+ if (attName == "name") {
+ if (nameValue != null)
+ ThrowException ("Duplicated name attribute.", reader);
+ nameValue = reader.Value;
+ continue;
+ }
+
+ ThrowException ("Unrecognized attribute.", reader);
+ }
+
+ if (nameValue == null || typeValue == null)
+ ThrowException ("Required attribute missing", reader);
+
+ if (sectionName != null)
+ nameValue = sectionName + '/' + nameValue;
+
+ reader.MoveToElement();
+ object o = LookForFactory (nameValue);
+ if (o != null && o != removedMark)
+ ThrowException ("Already have a factory for " + nameValue, reader);
+
+ factories [nameValue] = typeValue;
+ MoveToNextElement (reader);
+ }
+
+ private void ReadRemoveSection (XmlTextReader reader, string sectionName)
+ {
+ if (!reader.MoveToNextAttribute () || reader.Name != "name")
+ ThrowException ("Unrecognized attribute.", reader);
+
+ string removeValue = reader.Value;
+ if (removeValue == null || removeValue.Length == 0)
+ ThrowException ("Empty name to remove", reader);
+
+ reader.MoveToElement ();
+
+ if (sectionName != null)
+ removeValue = sectionName + '/' + removeValue;
+
+ object o = LookForFactory (removeValue);
+ if (o != null && o == removedMark)
+ ThrowException ("No factory for " + removeValue, reader);
+
+ factories [removeValue] = removedMark;
+ MoveToNextElement (reader);
+ }
+
+ private void ReadSectionGroup (XmlTextReader reader, string configSection)
+ {
+ if (!reader.MoveToNextAttribute ())
+ ThrowException ("sectionGroup must have a 'name' attribute.", reader);
+
+ if (reader.Name != "name")
+ ThrowException ("Unrecognized attribute.", reader);
+
+ if (reader.MoveToNextAttribute ())
+ ThrowException ("Unrecognized attribute.", reader);
+
+ string value = reader.Value;
+ if (configSection != null)
+ value = configSection + '/' + value;
+
+ object o = LookForFactory (value);
+ if (o != null && o != removedMark)
+ ThrowException ("Already have a factory for " + value, reader);
+
+ factories [value] = groupMark;
+ MoveToNextElement (reader);
+ ReadSections (reader, value);
+ }
+
+ private void ReadSections (XmlTextReader reader, string configSection)
+ {
+ int depth = reader.Depth;
+ while (reader.Depth == depth) {
+ string name = reader.Name;
+ if (name == "section") {
+ ReadSection (reader, configSection);
+ continue;
+ }
+
+ if (name == "remove") {
+ ReadRemoveSection (reader, configSection);
+ continue;
+ }
+
+ if (name == "clear") {
+ if (reader.HasAttributes)
+ ThrowException ("Unrecognized attribute.", reader);
+
+ factories.Clear ();
+ MoveToNextElement (reader);
+ continue;
+ }
+
+ if (name == "sectionGroup") {
+ ReadSectionGroup (reader, configSection);
+ continue;
+ }
+
+
+ ThrowException ("Unrecognized element: " + reader.Name, reader);
+ }
+ }
+
+ private void ReadConfigFile (XmlTextReader reader)
+ {
+ int depth = reader.Depth;
+ while (reader.Depth == depth) {
+ string name = reader.Name;
+ if (name == "configSections") {
+ if (reader.HasAttributes)
+ ThrowException ("Unrecognized attribute in configSections element.", reader);
+ MoveToNextElement (reader);
+ ReadSections (reader, null);
+ return;
+ }
+
+ MoveToNextElement (reader);
+ }
+ }
+
+ private void ThrowException (string text, XmlTextReader reader)
+ {
+ throw new ConfigurationException (text, fileName, reader.LineNumber);
+ }
+ }
+}
+
+
diff --git a/mcs/class/System/System.Configuration/DictionarySectionHandler.cs b/mcs/class/System/System.Configuration/DictionarySectionHandler.cs
new file mode 100644
index 00000000000..4801f577402
--- /dev/null
+++ b/mcs/class/System/System.Configuration/DictionarySectionHandler.cs
@@ -0,0 +1,57 @@
+
+//
+// System.Configuration.DictionarySectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Xml;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for DictionarySectionHandler.
+ /// </summary>
+ public class DictionarySectionHandler : IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Creates a new DictionarySectionHandler object and adds the object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ public virtual object Create(object parent, object context, XmlNode section)
+ {
+ return ConfigHelper.GetDictionary (parent as IDictionary, section,
+ KeyAttributeName, ValueAttributeName);
+ }
+
+ /// <summary>
+ /// Gets the name of the key attribute tag. This property is overidden by derived classes to change
+ /// the name of the key attribute tag. The default is "key".
+ /// </summary>
+ protected virtual string KeyAttributeName
+ {
+ get {
+ return "key";
+ }
+ }
+
+ /// <summary>
+ /// Gets the name of the value tag. This property may be overidden by derived classes to change
+ /// the name of the value tag. The default is "value".
+ /// </summary>
+ protected virtual string ValueAttributeName
+ {
+ get {
+ return "value";
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/IConfigXmlNode.cs b/mcs/class/System/System.Configuration/IConfigXmlNode.cs
new file mode 100644
index 00000000000..9981f6abe23
--- /dev/null
+++ b/mcs/class/System/System.Configuration/IConfigXmlNode.cs
@@ -0,0 +1,18 @@
+//
+// System.Configuration.IConfigXmlNode
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Configuration
+{
+ interface IConfigXmlNode
+ {
+ string Filename { get; }
+ int LineNumber { get; }
+ }
+}
+
diff --git a/mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs b/mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs
new file mode 100644
index 00000000000..d3eae0ad018
--- /dev/null
+++ b/mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs
@@ -0,0 +1,27 @@
+//
+// System.Configuration.IConfigurationSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+using System;
+using System.Xml;
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for IConfigurationSectionHandler.
+ /// </summary>
+ public interface IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Creates a new configuration handler and adds the specified configuration object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="configContext">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ object Create(object parent, object configContext, XmlNode section);
+ }
+}
diff --git a/mcs/class/System/System.Configuration/IConfigurationSystem.cs b/mcs/class/System/System.Configuration/IConfigurationSystem.cs
new file mode 100644
index 00000000000..3e08d6878f0
--- /dev/null
+++ b/mcs/class/System/System.Configuration/IConfigurationSystem.cs
@@ -0,0 +1,18 @@
+//
+// System.Configuration.IConfigurationSystem
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Configuration
+{
+ public interface IConfigurationSystem
+ {
+ object GetConfig (string configKey);
+ void Init ();
+ }
+}
+
diff --git a/mcs/class/System/System.Configuration/IgnoreSectionHandler.cs b/mcs/class/System/System.Configuration/IgnoreSectionHandler.cs
new file mode 100644
index 00000000000..b20c2c4f92e
--- /dev/null
+++ b/mcs/class/System/System.Configuration/IgnoreSectionHandler.cs
@@ -0,0 +1,32 @@
+//
+// System.Configuration.IgnoreSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Xml;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for IgnoreSectionHandler.
+ /// </summary>
+ public class IgnoreSectionHandler : IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Creates a new configuration handler and adds the specified configuration object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="configContext">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ public virtual object Create(object parent, object configContext, XmlNode section)
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/NameValueFileSectionHandler.cs b/mcs/class/System/System.Configuration/NameValueFileSectionHandler.cs
new file mode 100644
index 00000000000..ed8fd36fb8f
--- /dev/null
+++ b/mcs/class/System/System.Configuration/NameValueFileSectionHandler.cs
@@ -0,0 +1,53 @@
+//
+// System.Configuration.NameValueFileSectionHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Xml;
+
+namespace System.Configuration
+{
+ public class NameValueFileSectionHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object configContext, XmlNode section)
+ {
+ XmlNode file = null;
+ if (section.Attributes != null)
+ file = section.Attributes.RemoveNamedItem ("file");
+
+ NameValueCollection pairs = ConfigHelper.GetNameValueCollection (
+ parent as NameValueCollection,
+ section,
+ "key",
+ "value");
+
+ if (file != null && file.Value == String.Empty) {
+ if (!(file is IConfigXmlNode))
+ return null;
+
+ string fileName = ((IConfigXmlNode) file).Filename;
+ string fullPath = Path.Combine (Path.GetDirectoryName (fileName), file.Value);
+ if (!File.Exists (fullPath))
+ return pairs;
+
+ ConfigXmlDocument doc = new ConfigXmlDocument ();
+ doc.Load (fullPath);
+ if (doc.DocumentElement.Name != section.Name)
+ throw new ConfigurationException ("Invalid root element", doc.DocumentElement);
+
+ pairs = ConfigHelper.GetNameValueCollection (pairs, doc.DocumentElement,
+ "key", "value");
+ }
+
+ return pairs;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Configuration/NameValueSectionHandler.cs b/mcs/class/System/System.Configuration/NameValueSectionHandler.cs
new file mode 100644
index 00000000000..7a162576494
--- /dev/null
+++ b/mcs/class/System/System.Configuration/NameValueSectionHandler.cs
@@ -0,0 +1,56 @@
+//
+// System.Configuration.NameValueSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+using System;
+using System.Xml;
+using System.Collections.Specialized;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for NameValueSectionHandler.
+ /// </summary>
+ public class NameValueSectionHandler : IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Creates a new configuration handler and adds the specified configuration object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ public object Create(object parent, object context, XmlNode section)
+ {
+ return ConfigHelper.GetNameValueCollection (parent as NameValueCollection, section,
+ KeyAttributeName, ValueAttributeName);
+ }
+
+ /// <summary>
+ /// Gets the name of the key attribute tag. This property is overidden by derived classes to change
+ /// the name of the key attribute tag. The default is "key".
+ /// </summary>
+ protected virtual string KeyAttributeName
+ {
+ get {
+ return "key";
+ }
+ }
+
+ /// <summary>
+ /// Gets the name of the value tag. This property may be overidden by derived classes to change
+ /// the name of the value tag. The default is "value".
+ /// </summary>
+ protected virtual string ValueAttributeName
+ {
+ get {
+ return "value";
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Configuration/SingleTagSectionHandler.cs b/mcs/class/System/System.Configuration/SingleTagSectionHandler.cs
new file mode 100644
index 00000000000..100de164992
--- /dev/null
+++ b/mcs/class/System/System.Configuration/SingleTagSectionHandler.cs
@@ -0,0 +1,56 @@
+//
+// System.Configuration.SingleTagSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Xml;
+using System.Collections;
+
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for SingleTagSectionHandler.
+ /// </summary>
+ public class SingleTagSectionHandler : IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Returns a collection of configuration section values.
+ /// </summary>
+ /// <param name="parent"></param>
+ /// <param name="context"></param>
+ /// <param name="section">The name of the configuration section.</param>
+ /// <returns></returns>
+ public virtual object Create(object parent, object context, XmlNode section)
+ {
+ Hashtable settingsCollection;
+
+ if (parent == null)
+ settingsCollection = new Hashtable ();
+ else
+ settingsCollection = (Hashtable) parent;
+
+ //Get all of the ChildNodes in the XML section.
+ if(section.HasChildNodes)
+ {
+ throw (new ConfigurationException("Child Nodes not allowed."));
+ }
+
+
+ //Get the attributes for the childNode
+ XmlAttributeCollection xmlAttributes = section.Attributes;
+
+ for(int i=0; i < xmlAttributes.Count; i++)
+ {
+ settingsCollection.Add(xmlAttributes[i].Name, xmlAttributes[i].Value);
+ }
+
+ return settingsCollection;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/BooleanSwitch.cs b/mcs/class/System/System.Diagnostics/BooleanSwitch.cs
new file mode 100755
index 00000000000..04785c98fa6
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/BooleanSwitch.cs
@@ -0,0 +1,39 @@
+//
+// System.Diagnostics.BooleanSwitch.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2001-2002
+//
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Provides a simple on/off switch that controls debugging
+ /// and tracing output
+ /// </summary>
+ public class BooleanSwitch : Switch
+ {
+ /// <summary>
+ /// Initializes a new instance
+ /// </summary>
+ public BooleanSwitch(string displayName, string description)
+ : base(displayName, description)
+ {
+ }
+
+ /// <summary>
+ /// Specifies whether the switch is enabled or disabled
+ /// </summary>
+ public bool Enabled {
+ // On .NET, any non-zero value is true. Only 0 is false.
+ get {return SwitchSetting != 0;}
+ set {
+ SwitchSetting = Convert.ToInt32(value);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..2eb2191238e
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ChangeLog
@@ -0,0 +1,248 @@
+2002-12-20 Jonathan Pryor <jonpryor@vt.edu>
+ * DiagnosticsConfigurationHandler.cs:
+ - Don't assume that optional attributes are always present
+ - <assert/> can't have any child nodes
+ - Change in semantics: if the attribute isn't present, GetAttribute()
+ returns null, not "". This allows us to differentiate between an
+ attribute not being present and an attribute with an empty value.
+ - Translate exceptions if a TraceListener type is invalid
+
+2002-12-19 Jonathan Pryor <jonpryor@vt.edu>
+ * TraceListenerCollection.cs: IndentLevel and IndentSize shouldn't be
+ hardcoded; they should be set to whatever TraceImpl is using (which in
+ turn may have been set by the .config file, so we should get the
+ user-specified values in added listeners).
+ * TraceListener.cs: Make sure that indents are initially written. This
+ allows code that uses Trace.Indent() before a Trace.WriteLine() to be
+ indented properly.
+ * TraceImpl.cs: provide a static constructor to explicitly specify the
+ ordering of initialization, in particular the ordering of
+ TraceImpl.Listeners and the reading of the .config file (by accessing
+ DiagnosticsConfiguration.Settings). This (hopefully) ensures that the
+ Listeners collection is initialized before the .config file is read in, as
+ the DiagnosticsConfigurationHandler will directly modify the listeners
+ collection.
+ The DiagnosticsConfigurationHandler assumes this so that it can <add/> and
+ <remove/> trace listeners and set the logfile for the DefaultTraceListener.
+
+
+2002-12-18 Jonathan Pryor <jonpryor@vt.edu>
+ * BooleanSwitch.cs: Complete re-write. It works now.
+ * DefaultTraceListener.cs:
+ - Use `const' strings, so I don't worry about copy/paste errors
+ - Give `AssertUiEnabled' an actual backing member
+ * DiagnosticsConfigurationHandler.cs: To avoid race conditions, let the
+ configuration handler set .config-specified properties on
+ DefaultTraceListener (AssertUiEnabled, LogFileName) and TraceImpl
+ (AutoFlush, IndentSize).
+ * Switch.cs: Near complete re-write. Actually works, and is (should be)
+ comformant with .NET behavior. Changed member names because they were
+ confusing me. (Yes, that doesn't say much about my memory.)
+ * TextWriterTraceListener.cs: Append text to already existing files, don't
+ overwrite them.
+ * TraceImpl.cs:
+ - Added private destructor, to ensure no instances are created.
+ - Move members declarations to be closer to each other.
+ * TraceSwitch.cs: Complete re-write. It works now.
+
+2002-12-17 Jonathan Pryor <jonpryor@vt.edu>
+ * DiagnosticsConfigurationHandler.cs: Implement so that .config files
+ support <system.diagnostics> sections.
+
+2002-12-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultTraceListener.cs: now OutputDebugStringW is called from an
+ internal call (update your runtime!). No more warnings in linux.
+
+2002-10-31 Dick Porter <dick@ximian.com>
+
+ * Process.cs: MonoIO methods now have an error parameter
+
+2002-10-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultTraceListener.cs: changed OutputDebugString to
+ OutputDebugStringW (no more warnings under windows). Also a few style
+ fixes.
+
+2002-10-23 Dick Porter <dick@ximian.com>
+
+ * Process.cs: Redirected standard input needs to have AutoFlush set
+
+2002-09-27 Dick Porter <dick@ximian.com>
+
+ * Process.cs: Implemented {get_,set_}{Min,Max}WorkingSet,
+ ProcessName, GetProcessById, GetProcesses, GetProcessesByName.
+ Pass the working directory to Start. Pass the program and args in
+ one string to be used with the second arg of CreateProcess, so it
+ will search the path.
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * TraceImpl.cs: Remove debug prints
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * TraceListenerCollection.cs: Set Indet level and size to default
+ values. The values from TraceImpl might have been changed.
+
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Process.cs:
+ * TextWriterTraceListener.cs: IDisposable fixes.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Process.cs: class status based fixes.
+
+2002-07-20 Dick Porter <dick@ximian.com>
+
+ * Process.cs: Implement file handle redirection
+
+2002-07-13 Jonathan Pryor <jonpryor@vt.edu>
+ * CounterCreationData.cs: Implemented
+ * CounterCreationDataCollection.cs: Implemented
+ * CounterSample.cs: Stubbed Out
+ * CounterSampleCalculator.cs: Stubbed Out
+ * InstanceData.cs: Implemented
+ * InstanceDataCollection.cs: Implemented
+ * InstanceDataCollectionCollection.cs: Implemented
+ * MonitoringDescriptionAttribute.cs: Implemented
+ * PerformanceCounter.cs: Stubbed Out
+ * PerformanceCounterCategory.cs: Stubbed Out
+ * PerformanceCounterInstaller.cs: Stubbed Out
+ * PerformanceCounterManager.cs: Stubbed Out
+ * PerformanceCounterPermission.cs: Stubbed Out
+ * PerformanceCounterPermissionAccess.cs: Implemented
+ * PerformanceCounterPermissionAttribute.cs: Stubbed Out
+ * PerformanceCounterPermissionEntry.cs: Stubbed Out
+ * PerformanceCounterPermissionEntryCollection.cs: Implemented
+ * PerformanceCounterType.cs: Implemented
+
+
+2002-06-25 Dick Porter <dick@ximian.com>
+
+ * Process.cs: Process forking and waiting, and some support functions
+
+ * ProcessStartInfo.cs: Implemented the bits needed for basic
+ Process forking
+
+ * ProcessModule.cs: Implemented
+
+ * ProcessModuleCollection.cs: Mostly implemented
+
+ * FileVersionInfo.cs: Implemented
+
+2002-06-16 Jonathan Pryor <jonpryor@vt.edu>
+ * ICollectData.cs: Implemented
+ * TraceImpl.cs: Setting IndentLevel, IndentSize should change the
+ corresponding properties on all current TraceListeners.
+ Also, to answer the FIXME message: Yes, the properties in TraceListener
+ need to be [ThreadStatic] as well.
+ * TraceListenerCollection.cs: When adding a TraceListener, the TraceListener
+ should have its properties set to the current TraceImpl property values.
+ * TraceListener.cs: Make indentSize, lndentLevel [ThreadStatic].
+
+2002-06-09 Jonathan Pryor <jonpryor@vt.edu>
+ * EntryWrittenEventArgs.cs: Implemented
+ * EntryWrittenEventHandler.cs: Implemented
+ * EventLog.cs: Stubbed out
+ * EventLogEntry.cs: Stubbed out
+ * EventLogEntryCOllection.cs: Implemented.
+ * EventLogEntryType.cs: Implemented
+ * EventLogInstaller.cs: Stubbed out
+ * EventLogPermission.cs: Stubbed out
+ * EventLogPermissionAccess.cs: Implemented
+ * EventLogPermissionAttribute.cs: Stubbed out
+ * EventLogPermissionEntry.cs: Stubbed out
+ * EventLogPermissionEntryCollection.cs: Stubbed out
+ * EventLogTraceListener.cs: Stubbed out
+
+2002-05-29 Jonathan Pryor <jonpryor@vt.edu>
+ * DefaultTraceListener.cs: Implemented MONO_TRACE support
+
+2002-05-27 Jonathan Pryor <jonpryor@vt.edu>
+ * Moved public API documentation for the following files to the
+ /mcs/docs/apidocs/xml/en/System.Diagnostics directory:
+ - Debug.cs
+ - DefaultTraceListener.cs
+ - DiagnosticsConfigurationHandler.cs
+ - Switch.cs
+ - TextWriterTraceListener.cs
+ - Trace.cs
+ - TraceLevel.cs
+ - TraceListener.cs
+ - TraceListenerCollection.cs
+ - TraceSwitch.cs
+
+2002-04-10 Jonathan Pryor <jonpryor@vt.edu>
+
+ * TraceListenerCollection.cs: Corrected indexer property to provide the
+ correct return value and implement the IList indexer property correctly.
+
+2002-04-07 Jonathan Pryor <jonpryor@vt.edu>
+
+ * TraceListener.cs: Fix stack overflow bug
+ * DefaultTraceListener.cs: Implement log file support
+
+2002-04-04 Dick Porter <dick@ximian.com>
+
+ * ThreadWaitReason.cs:
+ * ThreadState.cs:
+ * ThreadPriorityLevel.cs:
+ * ProcessWindowStyle.cs:
+ * ProcessThreadCollection.cs
+ * ProcessThread.cs:
+ * ProcessStartInfo.cs:
+ * ProcessModuleCollection.cs: Stub out more classes needed for Process
+
+2002-03-31 Dick Porter <dick@ximian.com>
+
+ * Process.cs:
+ * ProcessPriorityClass.cs:
+ * ProcessModule.cs:
+ * FileVersionInfo.cs: Stub out classes needed for Process
+
+2002-03-08 Jonathan Pryor <jonpryor@vt.edu>
+
+ * Debug.cs: Clean up (lots of code can be shared with Trace.cs, which
+ is why TraceImpl.cs is introduced), "DEBUG" conditional support
+ * TraceListener.cs: Proper implementation of Dispose pattern;
+ implementatino of non-abstract methods in terms of abstract methods
+ * TraceListenerCollection.cs: check 'object' types before adding
+ * TextWriterTraceListener.cs: properly implement Dispose pattern;
+ handle NeedIndent and WriteIndent
+ * Trace.cs: new file; provides Trace functionality, "TRACE" conditional
+ support
+ * DefaultTraceListener.cs: new file; the default trace listener
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * TraceListenerCollection.cs: Remove Warnings.
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * Switch.cs, TraceListenerCollection.cs : Decorate incomplete bits
+ with the MonoTODO attribute.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added Debug.cs to the build.
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added preliminary TraceListenerCollection.cs to the build.
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added TraceListener.cs, TextWriterTraceListener.cs, and
+ DefaultTraceListener.cs to the build and moved them into the
+ proper assembly.
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added DiagnosticsConfigurationHandler.cs to the build.
+
+2001-09-09 Nick Drochak <ndrochak@gol.com>
+
+ * BooleanSwitch.cs: Make this class use it's parent class's features. Namely, use SwitchSetting
+ so that we can get OnSwitchSettingChanged() to fire for free.
+
+2001-09-09 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: added this file
+
+ * Switch.cs: call OnSwitchSettingChanged() when the switch setting is, yes you gessed it, changed.
+
diff --git a/mcs/class/System/System.Diagnostics/CounterCreationData.cs b/mcs/class/System/System.Diagnostics/CounterCreationData.cs
new file mode 100644
index 00000000000..d814e012fea
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/CounterCreationData.cs
@@ -0,0 +1,52 @@
+//
+// System.Diagnostics.CounterCreationData.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ public class CounterCreationData {
+
+ private string help;
+ private string name;
+ private PerformanceCounterType type;
+
+ public CounterCreationData ()
+ {
+ }
+
+ public CounterCreationData (string counterName,
+ string counterHelp,
+ PerformanceCounterType counterType)
+ {
+ name = counterName;
+ help = counterHelp;
+ type = counterType;
+ }
+
+ public string CounterHelp {
+ get {return help;}
+ set {help = value;}
+ }
+
+ public string CounterName {
+ get {return name;}
+ set {name = value;}
+ }
+
+ // may throw InvalidEnumArgumentException
+ public PerformanceCounterType CounterType {
+ get {return type;}
+ set {type = value;}
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/CounterCreationDataCollection.cs b/mcs/class/System/System.Diagnostics/CounterCreationDataCollection.cs
new file mode 100644
index 00000000000..b9114b1f11f
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/CounterCreationDataCollection.cs
@@ -0,0 +1,97 @@
+//
+// System.Diagnostics.CounterCreationDataCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ public class CounterCreationDataCollection : CollectionBase {
+
+ public CounterCreationDataCollection ()
+ {
+ }
+
+ public CounterCreationDataCollection (
+ CounterCreationData[] value)
+ {
+ AddRange (value);
+ }
+
+ public CounterCreationDataCollection (
+ CounterCreationDataCollection value)
+ {
+ AddRange (value);
+ }
+
+ public CounterCreationData this [int index] {
+ get {return (CounterCreationData) InnerList[index];}
+ set {InnerList[index] = value;}
+ }
+
+ public int Add (CounterCreationData value)
+ {
+ return InnerList.Add (value);
+ }
+
+ public void AddRange (CounterCreationData[] value)
+ {
+ foreach (CounterCreationData v in value)
+ {
+ Add (v);
+ }
+ }
+
+ public void AddRange (CounterCreationDataCollection value)
+ {
+ foreach (CounterCreationData v in value)
+ {
+ Add (v);
+ }
+ }
+
+ public bool Contains (CounterCreationData value)
+ {
+ return InnerList.Contains (value);
+ }
+
+ public void CopyTo (CounterCreationData[] array, int index)
+ {
+ InnerList.CopyTo (array, index);
+ }
+
+ public int IndexOf (CounterCreationData value)
+ {
+ return InnerList.IndexOf (value);
+ }
+
+ public void Insert (int index, CounterCreationData value)
+ {
+ InnerList.Insert (index, value);
+ }
+
+ protected override void OnInsert (int index, object value)
+ {
+ if (!(value is CounterCreationData))
+ throw new NotSupportedException (Locale.GetText(
+ "You can only insert " +
+ "CounterCreationData objects into " +
+ "the collection"));
+ }
+
+ public virtual void Remove (CounterCreationData value)
+ {
+ InnerList.Remove (value);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/CounterSample.cs b/mcs/class/System/System.Diagnostics/CounterSample.cs
new file mode 100644
index 00000000000..cf260861f71
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/CounterSample.cs
@@ -0,0 +1,110 @@
+//
+// System.Diagnostics.CounterSample.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public struct CounterSample {
+
+ private long rawValue;
+ private long baseValue;
+ private long counterFrequency;
+ private long systemFrequency;
+ private long timeStamp;
+ private long timeStamp100nSec;
+ private long counterTimeStamp;
+ private PerformanceCounterType counterType;
+
+ CounterSample (long rawValue,
+ long baseValue,
+ long counterFrequency,
+ long systemFrequency,
+ long timeStamp,
+ long timeStamp100nSec,
+ PerformanceCounterType counterType)
+ : this (rawValue, baseValue, counterFrequency,
+ systemFrequency, timeStamp, timeStamp100nSec,
+ counterType, 0)
+ {
+ }
+
+ CounterSample (long rawValue,
+ long baseValue,
+ long counterFrequency,
+ long systemFrequency,
+ long timeStamp,
+ long timeStamp100nSec,
+ PerformanceCounterType counterType,
+ long counterTimeStamp)
+ {
+ this.rawValue = rawValue;
+ this.baseValue = baseValue;
+ this.counterFrequency = counterFrequency;
+ this.systemFrequency = systemFrequency;
+ this.timeStamp = timeStamp;
+ this.timeStamp100nSec = timeStamp100nSec;
+ this.counterType = counterType;
+ this.counterTimeStamp = counterTimeStamp;
+ }
+
+ public static CounterSample Empty = new CounterSample (
+ 0, 0, 0, 0, 0, 0,
+ PerformanceCounterType.NumberOfItems32,
+ 0);
+
+ public long BaseValue {
+ get {return baseValue;}
+ }
+
+ public long CounterFrequency {
+ get {return counterFrequency;}
+ }
+
+ public long CounterTimeStamp {
+ get {return counterTimeStamp;}
+ }
+
+ public PerformanceCounterType CounterType {
+ get {return counterType;}
+ }
+
+ public long RawValue {
+ get {return rawValue;}
+ }
+
+ public long SystemFrequency {
+ get {return systemFrequency;}
+ }
+
+ public long TimeStamp {
+ get {return timeStamp;}
+ }
+
+ public long TimeStamp100nSec {
+ get {return timeStamp100nSec;}
+ }
+
+// [MonoTODO("What's the algorithm?")]
+// public static float Calculate (CounterSample counterSample)
+// {
+// throw new NotSupportedException ();
+// }
+//
+// [MonoTODO("What's the algorithm?")]
+// public static float Calculate (CounterSample counterSample,
+// CounterSample nextCounterSample)
+// {
+// throw new NotSupportedException ();
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs b/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs
new file mode 100644
index 00000000000..81e684444ac
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs
@@ -0,0 +1,32 @@
+//
+// System.Diagnostics.CounterSampleCalculator.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public sealed class CounterSampleCalculator {
+
+// [MonoTODO("What's the algorithm?")]
+// public static float ComputeCounterValue (CounterSample newSample)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO("What's the algorithm?")]
+// public static float ComputeCounterValue (CounterSample oldSample,
+// CounterSample newSample)
+// {
+// throw new NotImplementedException ();
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/Debug.cs b/mcs/class/System/System.Diagnostics/Debug.cs
new file mode 100644
index 00000000000..73ead2ee832
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Debug.cs
@@ -0,0 +1,197 @@
+//
+// System.Diagnostics.Debug.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public sealed class Debug {
+
+ private Debug () {}
+
+ public static bool AutoFlush {
+ get {return TraceImpl.AutoFlush;}
+ set {TraceImpl.AutoFlush = value;}
+ }
+
+ public static int IndentLevel {
+ get {return TraceImpl.IndentLevel;}
+ set {TraceImpl.IndentLevel = value;}
+ }
+
+ public static int IndentSize {
+ get {return TraceImpl.IndentSize;}
+ set {TraceImpl.IndentSize = value;}
+ }
+
+ public static TraceListenerCollection Listeners {
+ get {return TraceImpl.Listeners;}
+ }
+
+ [Conditional("DEBUG")]
+ public static void Assert (bool condition)
+ {
+ TraceImpl.Assert (condition);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Assert (bool condition, string message)
+ {
+ TraceImpl.Assert (condition, message);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Assert (bool condition, string message,
+ string detailMessage)
+ {
+ TraceImpl.Assert (condition, message, detailMessage);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Close ()
+ {
+ TraceImpl.Close ();
+ }
+
+ [Conditional("DEBUG")]
+ public static void Fail (string message)
+ {
+ TraceImpl.Fail (message);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Fail (string message, string detailMessage)
+ {
+ TraceImpl.Fail (message, detailMessage);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Flush ()
+ {
+ TraceImpl.Flush ();
+ }
+
+ [Conditional("DEBUG")]
+ public static void Indent ()
+ {
+ TraceImpl.Indent ();
+ }
+
+ [Conditional("DEBUG")]
+ public static void Unindent ()
+ {
+ TraceImpl.Unindent ();
+ }
+
+ [Conditional("DEBUG")]
+ public static void Write (object value)
+ {
+ TraceImpl.Write (value);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Write (string message)
+ {
+ TraceImpl.Write (message);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Write (object value, string category)
+ {
+ TraceImpl.Write (value, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void Write (string message, string category)
+ {
+ TraceImpl.Write (message, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, object value)
+ {
+ TraceImpl.WriteIf (condition, value);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, string message)
+ {
+ TraceImpl.WriteIf (condition, message);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, value, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, message, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLine (object value)
+ {
+ TraceImpl.WriteLine (value);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLine (string message)
+ {
+ TraceImpl.WriteLine (message);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLine (object value, string category)
+ {
+ TraceImpl.WriteLine (value, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLine (string message, string category)
+ {
+ TraceImpl.WriteLine (message, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, object value)
+ {
+ TraceImpl.WriteLineIf (condition, value);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, string message)
+ {
+ TraceImpl.WriteLineIf (condition, message);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, value, category);
+ }
+
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, message, category);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs b/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
new file mode 100644
index 00000000000..4201a82d04d
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
@@ -0,0 +1,229 @@
+//
+// System.Diagnostics.DefaultTraceListener.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+
+ [ComVisible(false)]
+ public class DefaultTraceListener : TraceListener {
+
+ private static readonly bool OnWin32;
+
+ private const string ConsoleOutTrace = "Console.Out";
+ private const string ConsoleErrorTrace = "Console.Error";
+
+ private static readonly string MonoTracePrefix;
+ private static readonly string MonoTraceFile;
+
+ static DefaultTraceListener ()
+ {
+ // Determine what platform we're on. This impacts how where we send
+ // messages. On Win32 platforms (OnWin32 = true), we use the
+ // `OutputDebugString' api.
+ //
+ // On Linux platforms, we use MONO_TRACE to figure things out. See the
+ // API documentation for more information on MONO_TRACE.
+ OnWin32 = (Path.DirectorySeparatorChar == '\\');
+
+ if (!OnWin32) {
+ // If we're running on Unix, we don't have OutputDebugString.
+ // Instead, send output to...wherever the MONO_TRACE environment
+ // variables says to.
+ String where = Environment.GetEnvironmentVariable("MONO_TRACE");
+
+ if (where != null) {
+ string file = null;
+ string prefix = null;
+
+ if (where.StartsWith (ConsoleOutTrace)) {
+ file = ConsoleOutTrace;
+ prefix = GetPrefix (where, ConsoleOutTrace);
+ }
+ else if (where.StartsWith (ConsoleErrorTrace)) {
+ file = ConsoleErrorTrace;
+ prefix = GetPrefix (where, ConsoleErrorTrace);
+ }
+ else {
+ file = where;
+
+ // We can't firgure out what the prefix would be, as ':' is a
+ // valid filename character. Thus, arbitrary files don't support
+ // prefixes.
+ //
+ // I don't consider this to be a major issue. Prefixes are useful
+ // with Console.Out and Console.Error to help separate trace
+ // output from the actual program output. Writing to an arbitrary
+ // file doesn't introduce issues with disambiguation.
+ prefix = "";
+ }
+
+ MonoTraceFile = file;
+ MonoTracePrefix = prefix;
+ }
+ }
+ }
+
+ /**
+ * Get the prefix for the specified variable.
+ *
+ * "Prefixes" are used in the MONO_TRACE variable, and specify text that
+ * should precede each message printed to the console. The prefix is
+ * appended to the console location with a colon (':') separating them.
+ * For example, if MONO_TRACE is "Console.Out:** my prefix", the prefix is
+ * "** my prefix".
+ *
+ * Everything after the colon, if the colon is present, is used as the
+ * prefix.
+ *
+ * @param var The current MONO_TRACE variable
+ * @param where The name of the output location, e.g. "Console.Out"
+ */
+ private static string GetPrefix (string var, string where)
+ {
+ // actually, we permit any character to separate `where' and the prefix;
+ // we just skip over where the ':' would be. This means that a space or
+ // anything else would suffice, as long as it was only a single
+ // character.
+ if (var.Length > where.Length)
+ return var.Substring (where.Length + 1);
+ return "";
+ }
+
+ private string logFileName = null;
+
+ private bool assertUiEnabled = false;
+
+ public DefaultTraceListener () : base ("Default")
+ {
+ }
+
+ // It's hard to do anything with a UI when we don't have Windows.Forms...
+ [MonoTODO]
+ public bool AssertUiEnabled {
+ get {return assertUiEnabled;}
+ set {/* ignore */}
+ }
+
+ [MonoTODO]
+ public string LogFileName {
+ get {return logFileName;}
+ set {logFileName = value;}
+ }
+
+ public override void Fail (string message)
+ {
+ base.Fail (message);
+ WriteLine (new StackTrace().ToString());
+ }
+
+ public override void Fail (string message, string detailMessage)
+ {
+ base.Fail (message, detailMessage);
+ WriteLine (new StackTrace().ToString());
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void WriteWindowsDebugString (string message);
+
+ private void WriteDebugString (string message)
+ {
+ if (OnWin32)
+ WriteWindowsDebugString (message);
+ else
+ WriteMonoTrace (message);
+ }
+
+ private void WriteMonoTrace (string message)
+ {
+ switch (MonoTraceFile) {
+ case ConsoleOutTrace:
+ Console.Out.Write (message);
+ break;
+ case ConsoleErrorTrace:
+ Console.Error.Write (message);
+ break;
+ default:
+ WriteLogFile (message, MonoTraceFile);
+ break;
+ }
+ }
+
+ private void WritePrefix ()
+ {
+ if (!OnWin32) {
+ WriteMonoTrace (MonoTracePrefix);
+ }
+ }
+
+ private void WriteImpl (string message)
+ {
+ if (NeedIndent) {
+ WriteIndent ();
+ WritePrefix ();
+ }
+
+ WriteDebugString (message);
+
+ if (Debugger.IsLogging())
+ Debugger.Log (0, null, message);
+
+ WriteLogFile (message, LogFileName);
+ }
+
+ private void WriteLogFile (string message, string logFile)
+ {
+ string fname = logFile;
+ if (fname != null && fname.Length != 0) {
+ FileInfo info = new FileInfo (fname);
+ StreamWriter sw = null;
+
+ // Open the file
+ try {
+ if (info.Exists)
+ sw = info.AppendText ();
+ else
+ sw = info.CreateText ();
+ }
+ catch {
+ // We weren't able to open the file for some reason.
+ // We can't write to the log file; so give up.
+ return;
+ }
+
+ using (sw) {
+ sw.Write (message);
+ sw.Flush ();
+ }
+ }
+ }
+
+ public override void Write (string message)
+ {
+ WriteImpl (message);
+ }
+
+ public override void WriteLine (string message)
+ {
+ string msg = message + Environment.NewLine;
+ WriteImpl (msg);
+
+ NeedIndent = true;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs b/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
new file mode 100644
index 00000000000..37125a66acf
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
@@ -0,0 +1,350 @@
+//
+// System.Diagnostics.DiagnosticsConfigurationHandler.cs
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// Authors:
+// John R. Hicks <angryjohn69@nc.rr.com>
+// Jonathan Pryor <jonpryor@vt.edu>
+//
+// (C) 2002
+//
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Diagnostics
+{
+ internal sealed class DiagnosticsConfiguration
+ {
+ private static IDictionary settings = null;
+
+ public static IDictionary Settings {
+ get {
+ // TODO: Does anybody know if this is actually thread-safe under .NET?
+ // I've heard that this construct isn't safe under Java, but it's used
+ // reasonably often under C++, so I'm not sure about .NET.
+ if (settings == null) {
+ lock (typeof(DiagnosticsConfiguration)) {
+ if (settings == null)
+ settings = (IDictionary) ConfigurationSettings.GetConfig ("system.diagnostics");
+ }
+ }
+ return settings;
+ }
+ }
+ }
+
+ public class DiagnosticsConfigurationHandler : IConfigurationSectionHandler
+ {
+ delegate void ElementHandler (IDictionary d, XmlNode node);
+
+ IDictionary elementHandlers = new Hashtable ();
+
+ public DiagnosticsConfigurationHandler ()
+ {
+ elementHandlers ["assert"] = new ElementHandler (AddAssertNode);
+ elementHandlers ["switches"] = new ElementHandler (AddSwitchesNode);
+ elementHandlers ["trace"] = new ElementHandler (AddTraceNode);
+ }
+
+ public virtual object Create (object parent, object configContext, XmlNode section)
+ {
+ IDictionary d;
+ if (parent == null)
+ d = new Hashtable (CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
+ else
+ d = (IDictionary) ((ICloneable)parent).Clone();
+
+ foreach (XmlNode child in section.ChildNodes) {
+ XmlNodeType type = child.NodeType;
+
+ switch (type) {
+ /* ignore */
+ case XmlNodeType.Whitespace:
+ case XmlNodeType.Comment:
+ continue;
+ case XmlNodeType.Element:
+ ElementHandler eh = (ElementHandler) elementHandlers [child.Name];
+ if (eh != null)
+ eh (d, child);
+ else
+ ThrowUnrecognizedElement (child);
+ break;
+ default:
+ ThrowUnrecognizedElement (child);
+ break;
+ }
+ }
+
+ return d;
+ }
+
+ // Remarks: Both attribute are optional
+ private void AddAssertNode (IDictionary d, XmlNode node)
+ {
+ XmlAttributeCollection c = node.Attributes;
+ string assertuienabled = GetAttribute (c, "assertuienabled", false, node);
+ string logfilename = GetAttribute (c, "logfilename", false, node);
+ ValidateInvalidAttributes (c, node);
+ if (assertuienabled != null) {
+ try {
+ d ["assertuienabled"] = bool.Parse (assertuienabled);
+ }
+ catch (Exception e) {
+ throw new ConfigurationException ("The `assertuienabled' attribute must be `true' or `false'",
+ e, node);
+ }
+ }
+
+ if (logfilename != null)
+ d ["logfilename"] = logfilename;
+
+ DefaultTraceListener dtl = (DefaultTraceListener) TraceImpl.Listeners["Default"];
+ if (dtl != null) {
+ if (assertuienabled != null)
+ dtl.AssertUiEnabled = (bool) d ["assertuienabled"];
+ if (logfilename != null)
+ dtl.LogFileName = logfilename;
+ }
+
+ if (node.ChildNodes.Count > 0)
+ ThrowUnrecognizedElement (node.ChildNodes[0]);
+ }
+
+ // name attribute is required, value is optional
+ // Docs do not define "remove" or "clear" elements, but .NET recognizes
+ // them
+ private void AddSwitchesNode (IDictionary d, XmlNode node)
+ {
+ // There are no attributes on <switch/>
+ ValidateInvalidAttributes (node.Attributes, node);
+
+ IDictionary newNodes = new Hashtable ();
+
+ foreach (XmlNode child in node.ChildNodes) {
+ XmlNodeType t = child.NodeType;
+ if (t == XmlNodeType.Whitespace || t == XmlNodeType.Comment)
+ continue;
+ if (t == XmlNodeType.Element) {
+ XmlAttributeCollection attributes = child.Attributes;
+ string name = null;
+ string value = null;
+ switch (child.Name) {
+ case "add":
+ name = GetAttribute (attributes, "name", true, child);
+ value = GetAttribute (attributes, "value", false, child);
+ newNodes[name] = AsString (value);
+ break;
+ case "remove":
+ name = GetAttribute (attributes, "name", true, child);
+ newNodes.Remove (name);
+ break;
+ case "clear":
+ newNodes.Clear ();
+ break;
+ default:
+ ThrowUnrecognizedElement (child);
+ break;
+ }
+ ValidateInvalidAttributes (attributes, child);
+ }
+ else
+ ThrowUnrecognizedNode (child);
+ }
+
+ d [node.Name] = newNodes;
+ }
+
+ private void AddTraceNode (IDictionary d, XmlNode node)
+ {
+ AddTraceAttributes (d, node);
+
+ foreach (XmlNode child in node.ChildNodes) {
+ XmlNodeType t = child.NodeType;
+ if (t == XmlNodeType.Whitespace || t == XmlNodeType.Comment)
+ continue;
+ if (t == XmlNodeType.Element) {
+ if (child.Name == "listeners")
+ AddTraceListeners (child);
+ else
+ ThrowUnrecognizedElement (child);
+ ValidateInvalidAttributes (child.Attributes, child);
+ }
+ else
+ ThrowUnrecognizedNode (child);
+ }
+ }
+
+ // all attributes are optional
+ private void AddTraceAttributes (IDictionary d, XmlNode node)
+ {
+ XmlAttributeCollection c = node.Attributes;
+ string autoflush = GetAttribute (c, "autoflush", false, node);
+ string indentsize = GetAttribute (c, "indentsize", false, node);
+ ValidateInvalidAttributes (c, node);
+ if (autoflush != null) {
+ try {
+ bool b = bool.Parse (autoflush);
+ d ["autoflush"] = b;
+ TraceImpl.AutoFlush = b;
+ }
+ catch (Exception e) {
+ throw new ConfigurationException ("The `autoflush' attribute must be `true' or `false'",
+ e, node);
+ }
+ }
+ if (indentsize != null) {
+ try {
+ int n = int.Parse (indentsize);
+ d ["indentsize"] = n;
+ TraceImpl.IndentSize = n;
+ }
+ catch (Exception e) {
+ throw new ConfigurationException ("The `indentsize' attribute must be an integral value.",
+ e, node);
+ }
+ }
+ }
+
+ // only defines "add" and "remove", but "clear" also works
+ // for add, "name" and "type" are required; initializeData is optional
+ private void AddTraceListeners (XmlNode listenersNode)
+ {
+ // There are no attributes on <listeners/>
+ ValidateInvalidAttributes (listenersNode.Attributes, listenersNode);
+
+ foreach (XmlNode child in listenersNode.ChildNodes) {
+ XmlNodeType t = child.NodeType;
+ if (t == XmlNodeType.Whitespace || t == XmlNodeType.Comment)
+ continue;
+ if (t == XmlNodeType.Element) {
+ XmlAttributeCollection attributes = child.Attributes;
+ string name = null;
+ string type = null;
+ string id = null;
+ switch (child.Name) {
+ case "add":
+ name = GetAttribute (attributes, "name", true, child);
+ type = GetAttribute (attributes, "type", true, child);
+ id = GetAttribute (attributes, "initializeData", false, child);
+ AddTraceListener (name, type, id);
+ break;
+ case "remove":
+ name = GetAttribute (attributes, "name", true, child);
+ RemoveTraceListener (name);
+ break;
+ case "clear":
+ TraceImpl.Listeners.Clear ();
+ break;
+ default:
+ ThrowUnrecognizedElement (child);
+ break;
+ }
+ ValidateInvalidAttributes (attributes, child);
+ }
+ else
+ ThrowUnrecognizedNode (child);
+ }
+ }
+
+ private void AddTraceListener (string name, string type, string initializeData)
+ {
+ Type t = Type.GetType (type);
+ object[] args = null;
+ if (initializeData == null)
+ args = new object[]{name};
+ else
+ args = new object[]{initializeData, name};
+ try {
+ TraceListener l = (TraceListener) Activator.CreateInstance (t, args);
+ TraceImpl.Listeners.Add (l);
+ }
+ catch (Exception e) {
+ throw new ConfigurationException (
+ string.Format ("Invalid Type Specified: {0}", type),
+ e);
+ }
+ }
+
+ private void RemoveTraceListener (string name)
+ {
+ try {
+ TraceImpl.Listeners.Remove (name);
+ }
+ catch (ArgumentException e) {
+ // The specified listener wasn't in the collection
+ // Ignore this; .NET does.
+ }
+ catch (Exception e) {
+ throw new ConfigurationException (
+ string.Format ("Unknown error removing listener: {0}", name),
+ e);
+ }
+ }
+
+ private string GetAttribute (XmlAttributeCollection attrs, string attr, bool required, XmlNode node)
+ {
+ XmlAttribute a = attrs[attr];
+
+ string r = null;
+
+ if (a != null) {
+ r = a.Value;
+ if (required)
+ ValidateAttribute (attr, r, node);
+ attrs.Remove (a);
+ }
+ else if (required)
+ ThrowMissingAttribute (attr, node);
+
+ return r;
+ }
+
+ private string AsString (string s)
+ {
+ return s == null ? string.Empty : s;
+ }
+
+ private void ValidateAttribute (string attribute, string value, XmlNode node)
+ {
+ if (value == null || value.Length == 0)
+ throw new ConfigurationException (string.Format ("Required attribute `{0}' cannot be empty.", attribute), node);
+ }
+
+ private void ValidateInvalidAttributes (XmlAttributeCollection c, XmlNode node)
+ {
+ if (c.Count != 0)
+ ThrowUnrecognizedAttribute (c[0].Name, node);
+ }
+
+ private void ThrowMissingAttribute (string attribute, XmlNode node)
+ {
+ throw new ConfigurationException (string.Format ("Missing required attribute `{0}'.", attribute), node);
+ }
+
+ private void ThrowUnrecognizedNode (XmlNode node)
+ {
+ throw new ConfigurationException (
+ string.Format ("Unrecognized node `{0}'; nodeType={1}", node.Name, node.NodeType),
+ node);
+ }
+
+ private void ThrowUnrecognizedElement (XmlNode node)
+ {
+ throw new ConfigurationException (
+ string.Format ("Unrecognized element <{0}/>", node.Name),
+ node);
+ }
+
+ private void ThrowUnrecognizedAttribute (string attribute, XmlNode node)
+ {
+ throw new ConfigurationException (
+ string.Format ("Unrecognized attribute `{0}' on element <{1}/>.", attribute, node.Name),
+ node);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EntryWrittenEventArgs.cs b/mcs/class/System/System.Diagnostics/EntryWrittenEventArgs.cs
new file mode 100644
index 00000000000..21e007dbe84
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EntryWrittenEventArgs.cs
@@ -0,0 +1,34 @@
+//
+// System.Diagnostics.EntryWrittenEventArgs.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+
+ public class EntryWrittenEventArgs : EventArgs {
+
+ private EventLogEntry entry;
+
+ public EntryWrittenEventArgs () : this (null)
+ {
+ }
+
+ public EntryWrittenEventArgs (EventLogEntry entry)
+ {
+ this.entry = entry;
+ }
+
+ public EventLogEntry Entry {
+ get {return entry;}
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EntryWrittenEventHandler.cs b/mcs/class/System/System.Diagnostics/EntryWrittenEventHandler.cs
new file mode 100644
index 00000000000..beecc3ab8ab
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EntryWrittenEventHandler.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.EntryWrittenEventHandler.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+
+ public delegate void EntryWrittenEventHandler(
+ object sender,
+ EntryWrittenEventArgs e);
+
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLog.cs b/mcs/class/System/System.Diagnostics/EventLog.cs
new file mode 100644
index 00000000000..477191cd8af
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLog.cs
@@ -0,0 +1,271 @@
+//
+// System.Diagnostics.EventLog.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+
+ [MonoTODO("This class is just stubbed out")]
+ public class EventLog : Component, ISupportInitialize {
+
+ private string source;
+ private string logName;
+ private string machineName;
+
+ public EventLog() : this ("")
+ {
+ }
+
+ public EventLog(string logName) : this (logName, "")
+ {
+ }
+
+ public EventLog(string logName, string machineName)
+ : this (logName, machineName, "")
+ {
+ }
+
+ public EventLog(string logName, string machineName,
+ string source)
+ {
+ this.source = source;
+ this.machineName = machineName;
+ this.logName = logName;
+ }
+
+// [MonoTODO]
+// public bool EnableRaisingEvents {
+// get {return false;}
+// set {/* ignore */}
+// }
+//
+// [MonoTODO]
+// public EventLogEntryCollection Entries {
+// get {return null;}
+// }
+//
+// [MonoTODO]
+// public string Log {
+// get {return log;}
+// set {log = value;}
+// }
+//
+// [MonoTODO]
+// public string LogDisplayName {
+// get {return "";}
+// }
+//
+// [MonoTODO]
+// public string MachineName {
+// get {return machineName;}
+// set {/* ignore */}
+// }
+//
+// [MonoTODO]
+// public string Source {
+// get {return source;}
+// set {/* ignore */}
+// }
+//
+// [MonoTODO]
+// public ISynchronizeInvoke SynchronizingObject {
+// get {return null;}
+// set {/* ignore */}
+// }
+//
+ [MonoTODO]
+ public void BeginInit()
+ {
+ throw new NotImplementedException ();
+ }
+
+// [MonoTODO]
+// public void Clear()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public void Close()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void CreateEventSource(string source,
+// string logName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void CreateEventSource(string source,
+// string logName,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void Delete(string logName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void Delete(string logName, string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void DeleteEventSource(string source)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void DeleteEventSource(string source,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void Dispose(bool disposing)
+// {
+// throw new NotImplementedException ();
+// }
+//
+ [MonoTODO]
+ public void EndInit()
+ {
+ throw new NotImplementedException ();
+ }
+
+// [MonoTODO]
+// public static bool Exists(string logName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static bool Exists(string logName, string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static EventLog[] GetEventLogs()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static EventLog[] GetEventLogs(string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static string LogNameFromSourceName(string source,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static bool SourceExists(string source)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static bool SourceExists(string source,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public void WriteEntry(string message)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public void WriteEntry(string message, EventLogEntryType type)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void WriteEntry(string source, string message)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public void WriteEntry(string message, EventLogEntryType type,
+// int eventID)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void WriteEntry(string source, string message,
+// EventLogEntryType type)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public void WriteEntry(string message, EventLogEntryType type,
+// int eventID,
+// short category)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void WriteEntry(string source, string message,
+// EventLogEntryType type, int eventID)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public void WriteEntry(string message, EventLogEntryType type,
+// int eventID,
+// short category, byte[] rawData)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void WriteEntry(string source, string message,
+// EventLogEntryType type, int eventID, short category)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void WriteEntry(string source, string message,
+// EventLogEntryType type, int eventID, short category,
+// byte[] rawData)
+// {
+// throw new NotImplementedException ();
+// }
+
+ public event EntryWrittenEventHandler EntryWritten;
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogEntry.cs b/mcs/class/System/System.Diagnostics/EventLogEntry.cs
new file mode 100644
index 00000000000..32fb4533254
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogEntry.cs
@@ -0,0 +1,105 @@
+//
+// System.Diagnostics.EventLogEntry.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Runtime.Serialization;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ [MonoTODO("Just stubbed out")]
+ public sealed class EventLogEntry : Component, ISerializable {
+
+ [MonoTODO]
+ internal EventLogEntry ()
+ {
+ }
+
+// [MonoTODO]
+// public string Categery {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public short CategoryNumber {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public byte[] Data {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public EventLogEntryType EntryType {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public int EventID {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public int Index {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string Machineame {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string Message {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string[] ReplacementStrings {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string Source {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public DateTime TimeGenerated {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public DateTime TimeWritten {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string UserName {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public bool Equals(EventLogEntry otherEntry)
+// {
+// throw new NotImplementedException ();
+// }
+//
+ [MonoTODO]
+ void ISerializable.GetObjectData(SerializationInfo info,
+ StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogEntryCollection.cs b/mcs/class/System/System.Diagnostics/EventLogEntryCollection.cs
new file mode 100644
index 00000000000..746eec2a6c2
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogEntryCollection.cs
@@ -0,0 +1,57 @@
+//
+// System.Diagnostics.EventLogEntryCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public class EventLogEntryCollection : ICollection, IEnumerable {
+
+ private ArrayList eventLogs = new ArrayList ();
+
+ internal EventLogEntryCollection()
+ {
+ }
+
+ public int Count {
+ get {return eventLogs.Count;}
+ }
+
+ public virtual EventLogEntry this [int index] {
+ get {return (EventLogEntry) eventLogs[index];}
+ }
+
+ bool ICollection.IsSynchronized {
+ get {return eventLogs.IsSynchronized;}
+ }
+
+ object ICollection.SyncRoot {
+ get {return eventLogs.SyncRoot;}
+ }
+
+ public void CopyTo (EventLogEntry[] eventLogs, int index)
+ {
+ eventLogs.CopyTo (eventLogs, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return eventLogs.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ eventLogs.CopyTo (array, index);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogEntryType.cs b/mcs/class/System/System.Diagnostics/EventLogEntryType.cs
new file mode 100644
index 00000000000..0d52a79f31c
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogEntryType.cs
@@ -0,0 +1,24 @@
+//
+// System.Diagnostics.EventLogEntryType.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ public enum EventLogEntryType {
+ Error = 0x01,
+ Warning = 0x02,
+ Information = 0x04,
+ SuccessAudit = 0x08,
+ FailureAudit = 0x10
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogInstaller.cs b/mcs/class/System/System.Diagnostics/EventLogInstaller.cs
new file mode 100644
index 00000000000..c49935cb714
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogInstaller.cs
@@ -0,0 +1,75 @@
+//
+// System.Diagnostics.EventLogInstaller.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+// using System.Configuration.Install;
+
+namespace System.Diagnostics {
+
+ [MonoTODO]
+ public class EventLogInstaller
+// : ComponentInstaller
+ {
+// [MonoTODO]
+// public EventLogInstaller()
+// {
+// }
+//
+// [MonoTODO]
+// public string Log {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+// [MonoTODO]
+// public string Source {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+// [MonoTODO]
+// public UninstallAction UninstallAction {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+// // may throw ArgumentException if
+// // - component isn't an EventlOg
+// // - The Log or Source properties are null or ""
+// [MonoTODO]
+// public override void CopyFromComponenet(IComponent component)
+// {
+// }
+//
+// // may throw PlatformNotSupportedException if not >= NT4
+// [MonoTODO]
+// public override void Install(IDictionary stateSaver)
+// {
+// }
+//
+// [MonoTODO]
+// public override bool IsEquivalentInstaller(
+// ComponentInstaller otherInstaller)
+// {
+// }
+//
+// [MonoTODO]
+// public override void Rollback(IDictionary savedState)
+// {
+// }
+//
+// [MonoTODO]
+// public override void Uninstall(IDictionary savedState)
+// {
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogPermission.cs b/mcs/class/System/System.Diagnostics/EventLogPermission.cs
new file mode 100644
index 00000000000..1858ab6794a
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogPermission.cs
@@ -0,0 +1,50 @@
+//
+// System.Diagnostics.EventLogPermission.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.Diagnostics;
+using System.Security.Permissions;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ [MonoTODO("Just Stubbed Out")]
+ public class EventLogPermission
+// : ResourcePermissionBase
+ {
+// [MonoTODO]
+// public EventLogPermission()
+// {
+// }
+//
+// [MonoTODO]
+// public EventLogPermission(
+// EventLogPermissionEntry[] permissionAccessEntries)
+// {
+// }
+//
+// [MonoTODO]
+// public EventLogPermission(PermissionState state)
+// {
+// }
+//
+// [MonoTODO]
+// public EventLogPermission(
+// EventLogPermissionAccess permissionAccess,
+// string machineName)
+// {
+// }
+//
+// [MonoTODO]
+// public EventLogPermissionEntryCollection PermissionEntries {
+// get {throw new NotImplementedException();}
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionAccess.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionAccess.cs
new file mode 100644
index 00000000000..8ae00f87ae1
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogPermissionAccess.cs
@@ -0,0 +1,23 @@
+//
+// System.Diagnostics.EventLogPermissionAccess.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [Flags, Serializable]
+ public enum EventLogPermissionAccess {
+ None=0,
+ Browse=0x2,
+ Instrument=0x6,
+ Audit=0xA,
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs
new file mode 100644
index 00000000000..17eb6ca9935
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.Diagnostics.EventLogPermissionAttribute.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Diagnostics {
+
+ [AttributeUsage(
+ AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Event)]
+ [Serializable]
+ [MonoTODO("Just Stubbed Out")]
+ public class EventLogPermissionAttribute : CodeAccessSecurityAttribute {
+
+ public EventLogPermissionAttribute(SecurityAction action)
+ : base(action)
+ {
+ }
+
+// // May throw ArgumentException if computer name is invalid
+// public string MachineName {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+// public EventLogPermissionAccess PermissionAccess {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+ [MonoTODO]
+ public override IPermission CreatePermission()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs
new file mode 100644
index 00000000000..efcbbc2016f
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs
@@ -0,0 +1,37 @@
+//
+// System.Diagnostics.EventLogPermissionEntry.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ [MonoTODO("Just Stubbed Out")]
+ public class EventLogPermissionEntry {
+
+// [MonoTODO]
+// public EventLogPermissionEntry(
+// EventLogPermissionAccess permissionAccess,
+// string machineName)
+// {
+// }
+//
+// [MonoTODO]
+// public string MachineName {
+// get {throw new NotImplementedException();}
+// }
+//
+// [MonoTODO]
+// public EventLogPermissionAccess PermissionAccess {
+// get {throw new NotImplementedException();}
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs
new file mode 100644
index 00000000000..e078af0a509
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs
@@ -0,0 +1,104 @@
+//
+// System.Diagnostics.EventLogEntryCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [MonoTODO]
+ public class EventLogPermissionEntryCollection : CollectionBase {
+
+ [MonoTODO]
+ internal EventLogPermissionEntryCollection()
+ {
+ }
+
+// [MonoTODO]
+// public virtual EventLogEntry this [int index] {
+// get {throw new NotImplementedException();}
+// }
+//
+// [MonoTODO]
+// public int Add(EventLogPermissionEntry value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public void AddRange(EventLogPermissionEntry[] value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public void AddRange(EventLogPermissionEntryCollection value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public bool Contains(EventLogPermissionEntry value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public void CopyTo(EventLogPermissionEntry[] array, int index)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public int IndexOf(EventLogPermissionEntry value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public void Insert(int index, EventLogPermissionEntry value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// protected override void OnClear()
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// protected override void OnInsert(int index, object value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// protected override void OnRemove(int index, object value)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// protected override void OnSet(int index, object oldValue,
+// object newValue)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public void Remove(EventLogPermissionEntry value)
+// {
+// throw new NotImplementedException();
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs b/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs
new file mode 100644
index 00000000000..56115b44522
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs
@@ -0,0 +1,75 @@
+//
+// System.Diagnostics.EventLogTraceListener.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [MonoTODO]
+ public class EventLogTraceListener : TraceListener {
+
+// [MonoTODO]
+// public EventLogTraceListener()
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public EventLogTraceListener(EventLog eventLog)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public EventLogTraceListener(string source)
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// public EventLog EventLog {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+// [MonoTODO]
+// public override string Name {
+// get {throw new NotImplementedException();}
+// set {throw new NotImplementedException();}
+// }
+//
+// [MonoTODO]
+// public override void Close()
+// {
+// throw new NotImplementedException();
+// }
+//
+// [MonoTODO]
+// protected override void Dispose(bool disposing)
+// {
+// throw new NotImplementedException();
+// }
+//
+ [MonoTODO]
+ public override void Write(string message)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override void WriteLine(string message)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/FileVersionInfo.cs b/mcs/class/System/System.Diagnostics/FileVersionInfo.cs
new file mode 100755
index 00000000000..1291d4020a6
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/FileVersionInfo.cs
@@ -0,0 +1,274 @@
+//
+// System.Diagnostics.FileVersionInfo.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Diagnostics {
+ public sealed class FileVersionInfo {
+ /* There is no public constructor for this class, it
+ * is initialised by the runtime. All the private
+ * variables here are looked up by name, so dont
+ * change them without also changing the runtime
+ */
+ private string comments;
+ private string companyname;
+ private string filedescription;
+ private string filename;
+ private string fileversion;
+ private string internalname;
+ private string language;
+ private string legalcopyright;
+ private string legaltrademarks;
+ private string originalfilename;
+ private string privatebuild;
+ private string productname;
+ private string productversion;
+ private string specialbuild;
+ private bool isdebug;
+ private bool ispatched;
+ private bool isprerelease;
+ private bool isprivatebuild;
+ private bool isspecialbuild;
+ private int filemajorpart;
+ private int fileminorpart;
+ private int filebuildpart;
+ private int fileprivatepart;
+ private int productmajorpart;
+ private int productminorpart;
+ private int productbuildpart;
+ private int productprivatepart;
+
+ private FileVersionInfo() {
+ /* This is here just to shut the compiler up */
+ comments=null;
+ companyname=null;
+ filedescription=null;
+ filename=null;
+ fileversion=null;
+ internalname=null;
+ language=null;
+ legalcopyright=null;
+ legaltrademarks=null;
+ originalfilename=null;
+ privatebuild=null;
+ productname=null;
+ productversion=null;
+ specialbuild=null;
+ isdebug=false;
+ ispatched=false;
+ isprerelease=false;
+ isprivatebuild=false;
+ isspecialbuild=false;
+ filemajorpart=0;
+ fileminorpart=0;
+ filebuildpart=0;
+ fileprivatepart=0;
+ productmajorpart=0;
+ productminorpart=0;
+ productbuildpart=0;
+ productprivatepart=0;
+ }
+
+
+ public string Comments {
+ get {
+ return(comments);
+ }
+ }
+
+ public string CompanyName {
+ get {
+ return(companyname);
+ }
+ }
+
+ public int FileBuildPart {
+ get {
+ return(filebuildpart);
+ }
+ }
+
+ public string FileDescription {
+ get {
+ return(filedescription);
+ }
+ }
+
+ public int FileMajorPart {
+ get {
+ return(filemajorpart);
+ }
+ }
+
+ public int FileMinorPart {
+ get {
+ return(fileminorpart);
+ }
+ }
+
+ public string FileName {
+ get {
+ return(filename);
+ }
+ }
+
+ public int FilePrivatePart {
+ get {
+ return(fileprivatepart);
+ }
+ }
+
+ public string FileVersion {
+ get {
+ return(fileversion);
+ }
+ }
+
+ public string InternalName {
+ get {
+ return(internalname);
+ }
+ }
+
+ public bool IsDebug {
+ get {
+ return(isdebug);
+ }
+ }
+
+ public bool IsPatched {
+ get {
+ return(ispatched);
+ }
+ }
+
+ public bool IsPreRelease {
+ get {
+ return(isprerelease);
+ }
+ }
+
+ public bool IsPrivateBuild {
+ get {
+ return(isprivatebuild);
+ }
+ }
+
+ public bool IsSpecialBuild {
+ get {
+ return(isspecialbuild);
+ }
+ }
+
+ public string Language {
+ get {
+ return(language);
+ }
+ }
+
+ public string LegalCopyright {
+ get {
+ return(legalcopyright);
+ }
+ }
+
+ public string LegalTrademarks {
+ get {
+ return(legaltrademarks);
+ }
+ }
+
+ public string OriginalFilename {
+ get {
+ return(originalfilename);
+ }
+ }
+
+ public string PrivateBuild {
+ get {
+ return(privatebuild);
+ }
+ }
+
+ public int ProductBuildPart {
+ get {
+ return(productbuildpart);
+ }
+ }
+
+ public int ProductMajorPart {
+ get {
+ return(productmajorpart);
+ }
+ }
+
+ public int ProductMinorPart {
+ get {
+ return(productminorpart);
+ }
+ }
+
+ public string ProductName {
+ get {
+ return(productname);
+ }
+ }
+
+ public int ProductPrivatePart {
+ get {
+ return(productprivatepart);
+ }
+ }
+
+ public string ProductVersion {
+ get {
+ return(productversion);
+ }
+ }
+
+ public string SpecialBuild {
+ get {
+ return(specialbuild);
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void GetVersionInfo_internal(string fileName);
+
+ public static FileVersionInfo GetVersionInfo(string fileName) {
+ FileVersionInfo fvi=new FileVersionInfo();
+
+ fvi.GetVersionInfo_internal(fileName);
+
+ return(fvi);
+ }
+
+ public override string ToString() {
+ string str;
+
+ str="File: " + filename + "\n";
+ str+="InternalName: " + internalname + "\n";
+ str+="OriginalFilename: " + originalfilename + "\n";
+ str+="FileVersion: " + fileversion + "\n";
+ str+="FileDescription: " + filedescription + "\n";
+ str+="Product: " + productname + "\n";
+ str+="ProductVersion: " + productversion + "\n";
+ str+="Debug: " + isdebug + "\n";
+ str+="Patched: " + ispatched + "\n";
+ str+="PreRelease: " + isprerelease + "\n";
+ str+="PrivateBuild: " + isprivatebuild + "\n";
+ str+="SpecialBuild: " + isspecialbuild + "\n";
+ str+="Language " + language + "\n";
+
+ return(str);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/ICollectData.cs b/mcs/class/System/System.Diagnostics/ICollectData.cs
new file mode 100644
index 00000000000..8ed58307627
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ICollectData.cs
@@ -0,0 +1,26 @@
+//
+// System.Diagnostics.ICollectData.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ICollectData {
+ void CloseData ();
+ void CollectData (
+ int id,
+ IntPtr valueName,
+ IntPtr data,
+ int totalBytes,
+ out IntPtr res);
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/InstanceData.cs b/mcs/class/System/System.Diagnostics/InstanceData.cs
new file mode 100644
index 00000000000..af260132fb0
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/InstanceData.cs
@@ -0,0 +1,39 @@
+//
+// System.Diagnostics.InstanceData.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public class InstanceData {
+
+ private string instanceName;
+ private CounterSample sample;
+
+ public InstanceData (string instanceName, CounterSample sample)
+ {
+ this.instanceName = instanceName;
+ this.sample = sample;
+ }
+
+ public string InstanceName {
+ get {return instanceName;}
+ }
+
+ public long RawValue {
+ get {return sample.RawValue;}
+ }
+
+ public CounterSample Sample {
+ get {return sample;}
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/InstanceDataCollection.cs b/mcs/class/System/System.Diagnostics/InstanceDataCollection.cs
new file mode 100644
index 00000000000..e45d7bf9754
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/InstanceDataCollection.cs
@@ -0,0 +1,66 @@
+//
+// System.Diagnostics.InstanceDataCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public class InstanceDataCollection : DictionaryBase {
+
+ private string counterName;
+
+ private static void CheckNull (object value, string name)
+ {
+ if (value == null)
+ throw new ArgumentNullException (name);
+ }
+
+ // may throw ArgumentNullException
+ public InstanceDataCollection (string counterName)
+ {
+ CheckNull (counterName, "counterName");
+ this.counterName = counterName;
+ }
+
+ public string CounterName {
+ get {return counterName;}
+ }
+
+ // may throw ArgumentNullException
+ public InstanceData this [string instanceName] {
+ get {
+ CheckNull (instanceName, "instanceName");
+ return (InstanceData) Dictionary [instanceName];
+ }
+ }
+
+ public ICollection Keys {
+ get {return Dictionary.Keys;}
+ }
+
+ public ICollection Values {
+ get {return Dictionary.Values;}
+ }
+
+ // may throw ArgumentNullException
+ public bool Contains (string instanceName)
+ {
+ CheckNull (instanceName, "instanceName");
+ return Dictionary.Contains (instanceName);
+ }
+
+ public void CopyTo (InstanceData[] instances, int index)
+ {
+ Dictionary.CopyTo (instances, index);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/InstanceDataCollectionCollection.cs b/mcs/class/System/System.Diagnostics/InstanceDataCollectionCollection.cs
new file mode 100644
index 00000000000..6accd956f19
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/InstanceDataCollectionCollection.cs
@@ -0,0 +1,58 @@
+//
+// System.Diagnostics.InstanceDataCollectionCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public class InstanceDataCollectionCollection : DictionaryBase {
+
+ private static void CheckNull (object value, string name)
+ {
+ if (value == null)
+ throw new ArgumentNullException (name);
+ }
+
+ // may throw ArgumentNullException
+ public InstanceDataCollectionCollection ()
+ {
+ }
+
+ // may throw ArgumentNullException
+ public InstanceDataCollection this [string counterName] {
+ get {
+ CheckNull (counterName, "counterName");
+ return (InstanceDataCollection) Dictionary [counterName];
+ }
+ }
+
+ public ICollection Keys {
+ get {return Dictionary.Keys;}
+ }
+
+ public ICollection Values {
+ get {return Dictionary.Values;}
+ }
+
+ // may throw ArgumentNullException
+ public bool Contains (string counterName)
+ {
+ CheckNull (counterName, "counterName");
+ return Dictionary.Contains (counterName);
+ }
+
+ public void CopyTo (InstanceData[] counters, int index)
+ {
+ Dictionary.CopyTo (counters, index);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/MonitoringDescriptionAttribute.cs b/mcs/class/System/System.Diagnostics/MonitoringDescriptionAttribute.cs
new file mode 100644
index 00000000000..982135601c4
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/MonitoringDescriptionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Diagnostics.MonitoringDescriptionAttribute.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [AttributeUsage (AttributeTargets.All)]
+ public class MonitoringDescriptionAttribute : DescriptionAttribute {
+
+ public MonitoringDescriptionAttribute (string description)
+ : base (description)
+ {
+ }
+
+ public override string Description {
+ get {return base.Description;}
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounter.cs b/mcs/class/System/System.Diagnostics/PerformanceCounter.cs
new file mode 100644
index 00000000000..2e7f50478d3
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounter.cs
@@ -0,0 +1,216 @@
+//
+// System.Diagnostics.PerformanceCounter.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ // must be safe for multithreaded operations
+ public class PerformanceCounter : Component, ISupportInitialize {
+
+ private string categoryName;
+ private string counterName;
+ private string instanceName;
+ private string machineName;
+ private bool readOnly;
+
+ [MonoTODO("Find the actual value")]
+ public static int DefaultFileMappingSize = 0x80000;
+
+ // set catname, countname, instname to "", machname to "."
+ public PerformanceCounter ()
+ {
+ categoryName = counterName = instanceName = "";
+ machineName = ".";
+ }
+
+ // throws: InvalidOperationException (if catName or countName
+ // is ""); ArgumentNullException if either is null
+ // sets instName to "", machname to "."
+ public PerformanceCounter (String categoryName,
+ string counterName)
+ : this (categoryName, counterName, false)
+ {
+ }
+
+ public PerformanceCounter (string categoryName,
+ string counterName,
+ bool readOnly)
+ : this (categoryName, counterName, "", readOnly)
+ {
+ }
+
+ public PerformanceCounter (string categoryName,
+ string counterName,
+ string instanceName)
+ : this (categoryName, counterName, instanceName, false)
+ {
+ }
+
+ public PerformanceCounter (string categoryName,
+ string counterName,
+ string instanceName,
+ bool readOnly)
+ {
+
+ CategoryName = categoryName;
+ CounterName = counterName;
+
+ if (categoryName == "" || counterName == "")
+ throw new InvalidOperationException ();
+
+ InstanceName = instanceName;
+ this.instanceName = instanceName;
+ this.machineName = ".";
+ this.readOnly = readOnly;
+ }
+
+ public PerformanceCounter (string categoryName,
+ string counterName,
+ string instanceName,
+ string machineName)
+ : this (categoryName, counterName, instanceName, false)
+ {
+ this.machineName = machineName;
+ }
+
+ // may throw ArgumentNullException
+ public string CategoryName {
+ get {return categoryName;}
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("categoryName");
+ categoryName = value;
+ }
+ }
+
+// // may throw InvalidOperationException
+// [MonoTODO]
+// public string CounterHelp {
+// get {return "";}
+// }
+//
+ // may throw ArgumentNullException
+ public string CounterName {
+ get {return counterName;}
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("counterName");
+ counterName = value;
+ }
+ }
+
+// // may throw InvalidOperationException
+// [MonoTODO]
+// public PerformanceCounterType CounterType {
+// get {return 0;}
+// }
+//
+ public string InstanceName {
+ get {return instanceName;}
+ set {instanceName = value;}
+ }
+
+// // may throw ArgumentException if machine name format is wrong
+// [MonoTODO("What's the machine name format?")]
+// public string MachineName {
+// get {return machineName;}
+// set {machineName = value;}
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public long RawValue {
+// get {return 0;}
+// set {
+// throw new NotImplementedException ();
+// }
+// }
+//
+// public bool ReadOnly {
+// get {return readOnly;}
+// set {readOnly = value;}
+// }
+//
+ [MonoTODO]
+ public void BeginInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+// [MonoTODO]
+// public void Close ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void CloseSharedResources ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public long Decrement ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected override void Dispose (bool disposing)
+// {
+// throw new NotImplementedException ();
+// }
+//
+ [MonoTODO]
+ public void EndInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public long Increment ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public long IncrementBy (long value)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public CounterSample NextSample ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public float NextValue ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public void RemoveInstance ()
+// {
+// throw new NotImplementedException ();
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs
new file mode 100644
index 00000000000..8d7a8e4a5cb
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs
@@ -0,0 +1,182 @@
+//
+// System.Diagnostics.PerformanceCounterCategory.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public class PerformanceCounterCategory {
+
+// [MonoTODO]
+// public PerformanceCounterCategory ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw ArgumentException (""), ArgumentNullException
+// [MonoTODO]
+// public PerformanceCounterCategory (string categoryName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw ArgumentException (""), ArgumentNullException
+// [MonoTODO]
+// public PerformanceCounterCategory (string categoryName,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw InvalidOperationException, Win32Exception
+// [MonoTODO]
+// public string CategoryHelp {
+// get {throw new NotImplementedException ();}
+// }
+//
+// // may throw ArgumentException (""), ArgumentNullException
+// [MonoTODO]
+// public string CategoryName {
+// get {throw new NotImplementedException ();}
+// set {throw new NotImplementedException ();}
+// }
+//
+// // may throw ArgumentException
+// [MonoTODO]
+// public string MachineName {
+// get {throw new NotImplementedException ();}
+// set {throw new NotImplementedException ();}
+// }
+//
+// // may throw ArgumentNullException, InvalidOperationException
+// // (categoryName isn't set), Win32Exception
+// [MonoTODO]
+// public bool CounterExists (string counterName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw ArgumentNullException, InvalidOperationException
+// // (categoryName is ""), Win32Exception
+// [MonoTODO]
+// public bool CounterExists (string counterName,
+// string categoryName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// // may throw ArgumentNullException, InvalidOperationException
+// // (categoryName is "", machine name is bad), Win32Exception
+// [MonoTODO]
+// public bool CounterExists (string counterName,
+// string categoryName,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static PerformanceCounterCategory Create (
+// string categoryName,
+// string categoryHelp,
+// CounterCreationDataCollection counterData)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static PerformanceCounterCategory Create (
+// string categoryName,
+// string categoryHelp,
+// string counterName,
+// string counterHelp)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static void Delete (string categoryName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static bool Exists (string categoryName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static bool Exists (string categoryName,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static PerformanceCounterCategory[] GetCategories ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public static PerformanceCounterCategory[] GetCategories (
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public PerformanceCounter[] GetCounters ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public PerformanceCounter[] GetCounters (string instanceName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public string[] GetInstanceNames ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public bool InstanceExists (string instanceName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public bool InstanceExists (string instanceName,
+// string categoryName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public bool InstanceExists (string instanceName,
+// string categoryName,
+// string machineName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public InstanceDataCollectionCollection ReadCategory ()
+// {
+// throw new NotImplementedException ();
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs
new file mode 100644
index 00000000000..f6183e9e168
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs
@@ -0,0 +1,82 @@
+//
+// System.Diagnostics.PerformanceCounterInstaller.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+// using System.Configuration.Install;
+using System.Diagnostics;
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+
+ public class PerformanceCounterInstaller {
+
+// [MonoTODO]
+// public PerformanceCounterInstaller ()
+// {
+// }
+//
+// // may throw ArgumentNullException
+// [MonoTODO]
+// public string CategoryHelp {
+// get {throw new NotImplementedException ();}
+// set {
+// if (value == null)
+// throw new ArgumentNullException ();
+// throw new NotImplementedException ();
+// }
+// }
+//
+// [MonoTODO]
+// public string CategoryName {
+// get {throw new NotImplementedException ();}
+// set {
+// if (value == null)
+// throw new ArgumentNullException ();
+// throw new NotImplementedException ();
+// }
+// }
+//
+// [MonoTODO]
+// public CounterCreationDataCollection Counters {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public UninstallAction UninstallAction {
+// get {throw new NotImplementedException ();}
+// set {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public override void CopyFromComponent (IComponent component)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override void Install (IDictionary stateSaver)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override void Rollback (IDictionary savedState)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override void Uninstall (IDictionary savedState)
+// {
+// throw new NotImplementedException ();
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs
new file mode 100644
index 00000000000..629bb3f545c
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs
@@ -0,0 +1,44 @@
+//
+// System.Diagnostics.PerformanceCounterManager.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+
+ [ComVisible(true)]
+ // [Guid("")]
+ public class PerformanceCounterManager : ICollectData {
+
+// [MonoTODO]
+// public PerformanceCounterManager ()
+// {
+// throw new NotImplementedException ();
+// }
+//
+ [MonoTODO]
+ void ICollectData.CloseData ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ICollectData.CollectData (
+ int callIdx,
+ IntPtr valueNamePtr,
+ IntPtr dataPtr,
+ int totalBytes,
+ out IntPtr res)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs
new file mode 100644
index 00000000000..b06d637e2fa
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs
@@ -0,0 +1,45 @@
+//
+// System.Diagnostics.PerformaceCounterPermission.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Security.Permissions;
+
+namespace System.Diagnostics {
+
+ public class PerformaceCounterPermission : ResourcePermissionBase {
+
+// public PerformaceCounterPermission ()
+// {
+// }
+//
+// public PerformaceCounterPermission (
+// PerformanceCounterPermissionEntry[]
+// permissionAccessEntries)
+// {
+// }
+//
+// public PerformaceCounterPermission (PermissionState state)
+// {
+// }
+//
+// public PerformaceCounterPermission (
+// PerformanceCounterPermissionAccess permissionAccess,
+// string machineName,
+// string categoryName)
+// {
+// }
+//
+// public PerformanceCounterPermissionEntryCollection
+// PermissionEntries {
+// get {throw new NotImplementedException ();}
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs
new file mode 100644
index 00000000000..127bcd5f4f1
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs
@@ -0,0 +1,22 @@
+//
+// System.Diagnostics.PerformanceCounterPermissionAccess.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public enum PerformanceCounterPermissionAccess {
+ Administrator=0x0E,
+ Browse=0x02,
+ Instrument=0x06,
+ None=0x00
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs
new file mode 100644
index 00000000000..9a011050368
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs
@@ -0,0 +1,61 @@
+//
+// System.Diagnostics.PerformanceCounterPermissionAttribute.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Diagnostics {
+
+ [AttributeUsage(
+ AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method |
+ AttributeTargets.Event )]
+ [MonoTODO]
+ public class PerformanceCounterPermissionAttribute
+ : CodeAccessSecurityAttribute {
+
+ [MonoTODO]
+ public PerformanceCounterPermissionAttribute (
+ SecurityAction action)
+ : base (action)
+ {
+ throw new NotImplementedException ();
+ }
+
+// [MonoTODO]
+// public string CategoryName {
+// get {throw new NotImplementedException ();}
+// set {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string MachineName {
+// get {throw new NotImplementedException ();}
+// set {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public PerformanceCounterPermissionAccess PermissionAccess {
+// get {throw new NotImplementedException ();}
+// set {throw new NotImplementedException ();}
+// }
+//
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs
new file mode 100644
index 00000000000..ae2cd93ff95
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs
@@ -0,0 +1,44 @@
+//
+// System.Diagnostics.PerformanceCounterPermissionEntry.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ [MonoTODO]
+ public class PerformanceCounterPermissionEntry {
+
+// [MonoTODO]
+// public PerformanceCounterPermissionEntry (
+// PerformanceCounterPermissionAccess permissionAccess,
+// string machineName,
+// string categoryName)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public string CategoryName {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public string MachineName {
+// get {throw new NotImplementedException ();}
+// }
+//
+// [MonoTODO]
+// public PerformanceCounterPermissionAccess PermissionAccess {
+// get {throw new NotImplementedException ();}
+// }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs
new file mode 100644
index 00000000000..818c3886a7e
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs
@@ -0,0 +1,107 @@
+//
+// System.Diagnostics.PerformanceCounterPermissionEntryCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ public class PerformanceCounterPermissionEntryCollection
+ : CollectionBase
+ {
+ internal PerformanceCounterPermissionEntryCollection ()
+ {
+ }
+
+ public PerformanceCounterPermissionEntry this [int index] {
+ get {
+ return (PerformanceCounterPermissionEntry)
+ InnerList[index];
+ }
+ set {InnerList[index] = value;}
+ }
+
+ public int Add (PerformanceCounterPermissionEntry value)
+ {
+ return InnerList.Add (value);
+ }
+
+ public void AddRange (PerformanceCounterPermissionEntry[] value)
+ {
+ foreach (PerformanceCounterPermissionEntry e in value)
+ Add (e);
+ }
+
+ public void AddRange (
+ PerformanceCounterPermissionEntryCollection value)
+ {
+ foreach (PerformanceCounterPermissionEntry e in value)
+ Add (e);
+ }
+
+ public bool Contains (PerformanceCounterPermissionEntry value)
+ {
+ return InnerList.Contains (value);
+ }
+
+ public void CopyTo (PerformanceCounterPermissionEntry[] array,
+ int index)
+ {
+ InnerList.CopyTo (array, index);
+ }
+
+ public int IndexOf (PerformanceCounterPermissionEntry value)
+ {
+ return InnerList.IndexOf (value);
+ }
+
+ public void Insert (int index,
+ PerformanceCounterPermissionEntry value)
+ {
+ InnerList.Insert (index, value);
+ }
+
+ protected override void OnClear ()
+ {
+ }
+
+ protected override void OnInsert (int index, object value)
+ {
+ if (!(value is PerformanceCounterPermissionEntry))
+ throw new NotSupportedException (Locale.GetText(
+ "You can only insert " +
+ "PerformanceCounterPermissionEntry " +
+ "objects into the collection."));
+ }
+
+ protected override void OnRemove (int index, object value)
+ {
+ }
+
+ protected override void OnSet (int index,
+ object oldValue,
+ object newValue)
+ {
+ if (!(newValue is PerformanceCounterPermissionEntry))
+ throw new NotSupportedException (Locale.GetText(
+ "You can only insert " +
+ "PerformanceCounterPermissionEntry " +
+ "objects into the collection."));
+ }
+
+ public void Remove (PerformanceCounterPermissionEntry value)
+ {
+ InnerList.Remove (value);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs
new file mode 100644
index 00000000000..a98462be1b5
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs
@@ -0,0 +1,47 @@
+//
+// System.Diagnostics.PerformanceCounterType.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ [Serializable]
+ public enum PerformanceCounterType {
+ NumberOfItemsHEX32=0x00000000,
+ NumberOfItemsHEX64=0x00000100,
+ NumberOfItems32=0x00010000,
+ NumberOfItems64=0x00010100,
+ CounterDelta32=0x00400400,
+ CounterDelta64=0x00400500,
+ SampleCounter=0x00410400,
+ CountPerTimeInterval32=0x00450400,
+ CountPerTimeInterval64=0x00450500,
+ RateOfCountsPerSecond32=0x10410400,
+ RateOfCountsPerSecond64=0x10410500,
+ RawFraction=0x20020400,
+ CounterTimer=0x20410500,
+ Timer100Ns=0x20510500,
+ SampleFraction=0x20C20400,
+ CounterTimerInverse=0x21410500,
+ Timer100NsInverse=0x21510500,
+ CounterMultiTimer=0x22410500,
+ CounterMultiTimer100Ns=0x22510500,
+ CounterMultiTimerInverse=0x23410500,
+ CounterMultiTimer100NsInverse=0x23510500,
+ AverageTimer32=0x30020400,
+ ElapsedTime=0x30240500,
+ AverageCount64=0x40020500,
+ SampleBase=0x40030401,
+ AverageBase=0x40030402,
+ RawBase=0x40030403,
+ CounterMultiBase=0x42030500
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs
new file mode 100755
index 00000000000..822453f97b9
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Process.cs
@@ -0,0 +1,712 @@
+//
+// System.Diagnostics.Process.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.IO;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.Diagnostics {
+ public class Process : Component {
+ [StructLayout(LayoutKind.Sequential)]
+ private struct ProcInfo {
+ public IntPtr process_handle;
+ public IntPtr thread_handle;
+ public int pid;
+ public int tid;
+ };
+
+ IntPtr process_handle;
+ int pid;
+
+ /* Private constructor called from other methods */
+ private Process(IntPtr handle, int id) {
+ process_handle=handle;
+ pid=id;
+ }
+
+ [MonoTODO]
+ public Process() {
+ }
+
+ [MonoTODO]
+ public int BasePriority {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public bool EnableRaisingEvents {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int ExitCode_internal(IntPtr handle);
+
+ public int ExitCode {
+ get {
+ return(ExitCode_internal(process_handle));
+ }
+ }
+
+ /* Returns the process start time in Windows file
+ * times (ticks from DateTime(1/1/1601 00:00 GMT))
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static long ExitTime_internal(IntPtr handle);
+
+ public DateTime ExitTime {
+ get {
+ return(DateTime.FromFileTime(ExitTime_internal(process_handle)));
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return(process_handle);
+ }
+ }
+
+ [MonoTODO]
+ public int HandleCount {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public bool HasExited {
+ get {
+ return(false);
+ }
+ }
+
+ public int Id {
+ get {
+ return(pid);
+ }
+ }
+
+ [MonoTODO]
+ public string MachineName {
+ get {
+ return("localhost");
+ }
+ }
+
+ public ProcessModule MainModule {
+ get {
+ return(this.Modules[0]);
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr MainWindowHandle {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public string MainWindowTitle {
+ get {
+ return("null");
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool GetWorkingSet_internal(IntPtr handle, out int min, out int max);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool SetWorkingSet_internal(IntPtr handle, int min, int max, bool use_min);
+
+ /* LAMESPEC: why is this an IntPtr not a plain int? */
+ public IntPtr MaxWorkingSet {
+ get {
+ if(HasExited) {
+ throw new InvalidOperationException("The process " + ProcessName + " (ID " + Id + ") has exited");
+ }
+
+ int min;
+ int max;
+ bool ok=GetWorkingSet_internal(process_handle, out min, out max);
+ if(ok==false) {
+ throw new Win32Exception();
+ }
+
+ return((IntPtr)max);
+ }
+ set {
+ if(HasExited) {
+ throw new InvalidOperationException("The process " + ProcessName + " (ID " + Id + ") has exited");
+ }
+
+ bool ok=SetWorkingSet_internal(process_handle, 0, value.ToInt32(), false);
+ if(ok==false) {
+ throw new Win32Exception();
+ }
+ }
+ }
+
+ public IntPtr MinWorkingSet {
+ get {
+ if(HasExited) {
+ throw new InvalidOperationException("The process " + ProcessName + " (ID " + Id + ") has exited");
+ }
+
+ int min;
+ int max;
+ bool ok=GetWorkingSet_internal(process_handle, out min, out max);
+ if(ok==false) {
+ throw new Win32Exception();
+ }
+
+ return((IntPtr)min);
+ }
+ set {
+ if(HasExited) {
+ throw new InvalidOperationException("The process " + ProcessName + " (ID " + Id + ") has exited");
+ }
+
+ bool ok=SetWorkingSet_internal(process_handle, value.ToInt32(), 0, true);
+ if(ok==false) {
+ throw new Win32Exception();
+ }
+ }
+ }
+
+ /* Returns the list of process modules. The main module is
+ * element 0.
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern ProcessModule[] GetModules_internal();
+
+ private ProcessModuleCollection module_collection;
+
+ public ProcessModuleCollection Modules {
+ get {
+ if(module_collection==null) {
+ module_collection=new ProcessModuleCollection(GetModules_internal());
+ }
+
+ return(module_collection);
+ }
+ }
+
+ [MonoTODO]
+ public int NonpagedSystemMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PagedMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PagedSystemMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PeakPagedMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PeakVirtualMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PeakWorkingSet {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public bool PriorityBoostEnabled {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ProcessPriorityClass PriorityClass {
+ get {
+ return(ProcessPriorityClass.Normal);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int PrivateMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan PrivilegedProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string ProcessName_internal(IntPtr handle);
+
+ private string process_name=null;
+
+ public string ProcessName {
+ get {
+ if(process_name==null) {
+ process_name=ProcessName_internal(process_handle);
+ /* If process_name is _still_
+ * null, assume the process
+ * has exited
+ */
+ if(process_name==null) {
+ throw new SystemException("The process has exited");
+ }
+
+ /* Strip the suffix (if it
+ * exists) simplistically
+ * instead of removing any
+ * trailing \.???, so we dont
+ * get stupid results on sane
+ * systems
+ */
+ if(process_name.EndsWith(".exe") ||
+ process_name.EndsWith(".bat") ||
+ process_name.EndsWith(".com")) {
+ process_name=process_name.Substring(0, process_name.Length-4);
+ }
+ }
+ return(process_name);
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr ProcessorAffinity {
+ get {
+ return((IntPtr)0);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool Responding {
+ get {
+ return(false);
+ }
+ }
+
+ private StreamReader error_stream=null;
+
+ public StreamReader StandardError {
+ get {
+ return(error_stream);
+ }
+ }
+
+ private StreamWriter input_stream=null;
+
+ public StreamWriter StandardInput {
+ get {
+ return(input_stream);
+ }
+ }
+
+ private StreamReader output_stream=null;
+
+ public StreamReader StandardOutput {
+ get {
+ return(output_stream);
+ }
+ }
+
+ private ProcessStartInfo start_info=null;
+
+ public ProcessStartInfo StartInfo {
+ get {
+ if(start_info==null) {
+ start_info=new ProcessStartInfo();
+ }
+
+ return(start_info);
+ }
+ set {
+ if(value==null) {
+ throw new ArgumentException("value is null");
+ }
+
+ start_info=value;
+ }
+ }
+
+ /* Returns the process start time in Windows file
+ * times (ticks from DateTime(1/1/1601 00:00 GMT))
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static long StartTime_internal(IntPtr handle);
+
+ public DateTime StartTime {
+ get {
+ return(DateTime.FromFileTime(StartTime_internal(process_handle)));
+ }
+ }
+
+ [MonoTODO]
+ public ISynchronizeInvoke SynchronizingObject {
+ get {
+ return(null);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ProcessThreadCollection Threads {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan TotalProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan UserProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public int VirtualMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int WorkingSet {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public void Close() {
+ }
+
+ [MonoTODO]
+ public bool CloseMainWindow() {
+ return(false);
+ }
+
+ [MonoTODO]
+ public static void EnterDebugMode() {
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static IntPtr GetProcess_internal(int pid);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int GetPid_internal();
+
+ public static Process GetCurrentProcess() {
+ int pid=GetPid_internal();
+ IntPtr proc=GetProcess_internal(pid);
+
+ if(proc==IntPtr.Zero) {
+ throw new SystemException("Can't find current process");
+ }
+
+ return(new Process(proc, pid));
+ }
+
+ public static Process GetProcessById(int processId) {
+ IntPtr proc=GetProcess_internal(processId);
+
+ if(proc==IntPtr.Zero) {
+ throw new ArgumentException("Can't find process with ID " + processId.ToString());
+ }
+
+ return(new Process(proc, processId));
+ }
+
+ [MonoTODO]
+ public static Process GetProcessById(int processId, string machineName) {
+ throw new NotImplementedException();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int[] GetProcesses_internal();
+
+ public static Process[] GetProcesses() {
+ int[] pids=GetProcesses_internal();
+ ArrayList proclist=new ArrayList();
+
+ for(int i=0; i<pids.Length; i++) {
+ try {
+ proclist.Add(GetProcessById(pids[i]));
+ } catch (SystemException) {
+ /* The process might exit
+ * between
+ * GetProcesses_internal and
+ * GetProcessById
+ */
+ }
+ }
+
+ return((Process[])proclist.ToArray(typeof(Process)));
+ }
+
+ [MonoTODO]
+ public static Process[] GetProcesses(string machineName) {
+ throw new NotImplementedException();
+ }
+
+ public static Process[] GetProcessesByName(string processName) {
+ Process[] procs=GetProcesses();
+ ArrayList proclist=new ArrayList();
+
+ for(int i=0; i<procs.Length; i++) {
+ /* Ignore case */
+ if(String.Compare(processName,
+ procs[i].ProcessName,
+ true)==0) {
+ proclist.Add(procs[i]);
+ }
+ }
+
+ return((Process[])proclist.ToArray(typeof(Process)));
+ }
+
+ [MonoTODO]
+ public static Process[] GetProcessesByName(string processName, string machineName) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public void Kill() {
+ }
+
+ [MonoTODO]
+ public static void LeaveDebugMode() {
+ }
+
+ [MonoTODO]
+ public void Refresh() {
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Start_internal(string cmd,
+ string dir,
+ IntPtr stdin,
+ IntPtr stdout,
+ IntPtr stderr,
+ ref ProcInfo proc_info);
+
+ private static bool Start_common(ProcessStartInfo startInfo,
+ Process process) {
+ ProcInfo proc_info=new ProcInfo();
+ IntPtr stdin_rd, stdin_wr;
+ IntPtr stdout_rd, stdout_wr;
+ IntPtr stderr_rd, stderr_wr;
+ bool ret;
+
+ if(startInfo.FileName == "") {
+ throw new InvalidOperationException("File name has not been set");
+ }
+
+ if(startInfo.RedirectStandardInput==true) {
+ ret=MonoIO.CreatePipe(out stdin_rd,
+ out stdin_wr);
+ } else {
+ stdin_rd=MonoIO.ConsoleInput;
+ /* This is required to stop the
+ * &$*£ing stupid compiler moaning
+ * that stdin_wr is unassigned, below.
+ */
+ stdin_wr=(IntPtr)0;
+ }
+
+ if(startInfo.RedirectStandardOutput==true) {
+ ret=MonoIO.CreatePipe(out stdout_rd,
+ out stdout_wr);
+ } else {
+ stdout_rd=(IntPtr)0;
+ stdout_wr=MonoIO.ConsoleOutput;
+ }
+
+ if(startInfo.RedirectStandardError==true) {
+ ret=MonoIO.CreatePipe(out stderr_rd,
+ out stderr_wr);
+ } else {
+ stderr_rd=(IntPtr)0;
+ stderr_wr=MonoIO.ConsoleError;
+ }
+
+ ret=Start_internal(startInfo.FileName + " " +
+ startInfo.Arguments,
+ startInfo.WorkingDirectory,
+ stdin_rd, stdout_wr, stderr_wr,
+ ref proc_info);
+
+ process.process_handle=proc_info.process_handle;
+ process.pid=proc_info.pid;
+
+ MonoIOError error;
+
+ if(startInfo.RedirectStandardInput==true) {
+ MonoIO.Close(stdin_rd, out error);
+ process.input_stream=new StreamWriter(new FileStream(stdin_wr, FileAccess.Write, true));
+ process.input_stream.AutoFlush=true;
+ }
+
+ if(startInfo.RedirectStandardOutput==true) {
+ MonoIO.Close(stdout_wr, out error);
+ process.output_stream=new StreamReader(new FileStream(stdout_rd, FileAccess.Read, true));
+ }
+
+ if(startInfo.RedirectStandardError==true) {
+ MonoIO.Close(stderr_wr, out error);
+ process.error_stream=new StreamReader(new FileStream(stderr_rd, FileAccess.Read, true));
+ }
+
+ return(ret);
+ }
+
+ public bool Start() {
+ bool ret;
+
+ ret=Start_common(start_info, this);
+
+ return(ret);
+ }
+
+ public static Process Start(ProcessStartInfo startInfo) {
+ Process process=new Process();
+ bool ret;
+
+ ret=Start_common(startInfo, process);
+
+ if(ret==true) {
+ return(process);
+ } else {
+ return(null);
+ }
+ }
+
+ public static Process Start(string fileName) {
+ return Start(new ProcessStartInfo(fileName));
+ }
+
+ public static Process Start(string fileName,
+ string arguments) {
+ return Start(new ProcessStartInfo(fileName, arguments));
+ }
+
+ public override string ToString() {
+ return(base.ToString() +
+ " (" + this.ProcessName + ")");
+ }
+
+ /* Waits up to ms milliseconds for process 'handle' to
+ * exit. ms can be <0 to mean wait forever.
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern bool WaitForExit_internal(IntPtr handle,
+ int ms);
+
+ public void WaitForExit() {
+ WaitForExit_internal(process_handle, -1);
+ }
+
+ public bool WaitForExit(int milliseconds) {
+ return(WaitForExit_internal(process_handle,
+ milliseconds));
+ }
+
+ [MonoTODO]
+ public bool WaitForInputIdle() {
+ return(false);
+ }
+
+ [MonoTODO]
+ public bool WaitForInputIdle(int milliseconds) {
+ return(false);
+ }
+
+ [MonoTODO]
+ public event EventHandler Exited;
+
+ // Closes the system process handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void Process_free_internal(IntPtr handle);
+
+ private bool disposed = false;
+
+ protected override void Dispose(bool disposing) {
+ // Check to see if Dispose has already been called.
+ if(this.disposed) {
+ this.disposed=true;
+ // If this is a call to Dispose,
+ // dispose all managed resources.
+ if(disposing) {
+ // Do stuff here
+ }
+
+ // Release unmanaged resources
+
+ lock(this) {
+ if(process_handle!=IntPtr.Zero) {
+
+ Process_free_internal(process_handle);
+ process_handle=IntPtr.Zero;
+ }
+ }
+ }
+ base.Dispose (disposing);
+ }
+
+ [MonoTODO]
+ protected void OnExited() {
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/ProcessModule.cs b/mcs/class/System/System.Diagnostics/ProcessModule.cs
new file mode 100755
index 00000000000..a2b17a43f16
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessModule.cs
@@ -0,0 +1,74 @@
+//
+// System.Diagnostics.ProcessModule.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+ public class ProcessModule : Component {
+ private IntPtr baseaddr;
+ private IntPtr entryaddr;
+ private string filename;
+ private FileVersionInfo version_info;
+ private int memory_size;
+ private string modulename;
+
+ internal ProcessModule(IntPtr baseaddr, IntPtr entryaddr,
+ string filename,
+ FileVersionInfo version_info,
+ int memory_size, string modulename) {
+ this.baseaddr=baseaddr;
+ this.entryaddr=entryaddr;
+ this.filename=filename;
+ this.version_info=version_info;
+ this.memory_size=memory_size;
+ this.modulename=modulename;
+ }
+
+ public IntPtr BaseAddress {
+ get {
+ return(baseaddr);
+ }
+ }
+
+ public IntPtr EntryPointAddress {
+ get {
+ return(entryaddr);
+ }
+ }
+
+ public string FileName {
+ get {
+ return(filename);
+ }
+ }
+
+ public FileVersionInfo FileVersionInfo {
+ get {
+ return(version_info);
+ }
+ }
+
+ public int ModuleMemorySize {
+ get {
+ return(memory_size);
+ }
+ }
+
+ public string ModuleName {
+ get {
+ return(modulename);
+ }
+ }
+
+ public override string ToString() {
+ return(this.ModuleName);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
new file mode 100755
index 00000000000..c9ebdcefd5a
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
@@ -0,0 +1,57 @@
+//
+// System.Diagnostics.ProcessModuleCollection.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Diagnostics {
+ public class ProcessModuleCollection : ReadOnlyCollectionBase {
+ private ProcessModule[] modules;
+
+ [MonoTODO]
+ protected ProcessModuleCollection() {
+ }
+
+ public ProcessModuleCollection(ProcessModule[] processModules) {
+ modules=processModules;
+ }
+
+ public ProcessModule this[int index] {
+ get {
+ return(modules[index]);
+ }
+ }
+
+ public bool Contains(ProcessModule module) {
+ foreach(ProcessModule test in modules) {
+ if(module==test) {
+ return(true);
+ }
+ }
+
+ return(false);
+ }
+
+ [MonoTODO]
+ public void CopyTo(ProcessModule[] array, int index) {
+ }
+
+ public int IndexOf(ProcessModule module) {
+ int i;
+
+ for(i=0; i<modules.Length; i++) {
+ if(modules[i]==module) {
+ return(i);
+ }
+ }
+
+ // FIXME!
+ return(0);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessPriorityClass.cs b/mcs/class/System/System.Diagnostics/ProcessPriorityClass.cs
new file mode 100755
index 00000000000..4218bb4390e
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessPriorityClass.cs
@@ -0,0 +1,20 @@
+//
+// System.Diagnostics.ProcessPriorityClass.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ProcessPriorityClass {
+ AboveNormal=0x08000,
+ BelowNormal=0x04000,
+ High=0x00080,
+ Idle=0x00040,
+ Normal=0x00020,
+ RealTime=0x00100,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs b/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs
new file mode 100755
index 00000000000..b519442bf9f
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs
@@ -0,0 +1,171 @@
+//
+// System.Diagnostics.ProcessStartInfo.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections.Specialized;
+
+namespace System.Diagnostics {
+ public sealed class ProcessStartInfo {
+ public ProcessStartInfo() {
+ }
+
+ public ProcessStartInfo(string filename) {
+ this.filename=filename;
+ }
+
+ public ProcessStartInfo(string filename, string arguments) {
+ this.filename=filename;
+ this.arguments=arguments;
+ }
+
+ private string arguments="";
+
+ public string Arguments {
+ get {
+ return(arguments);
+ }
+ set {
+ arguments=value;
+ }
+ }
+
+ private bool create_no_window=false;
+
+ public bool CreateNoWindow {
+ get {
+ return(create_no_window);
+ }
+ set {
+ create_no_window=value;
+ }
+ }
+
+ [MonoTODO("Need to read the env block somehow")]
+ public StringDictionary EnvironmentVariables {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ private bool error_dialog=false;
+
+ public bool ErrorDialog {
+ get {
+ return(error_dialog);
+ }
+ set {
+ error_dialog=value;
+ }
+ }
+
+ private IntPtr error_dialog_parent_handle=(IntPtr)0;
+
+ public IntPtr ErrorDialogParentHandle {
+ get {
+ return(error_dialog_parent_handle);
+ }
+ set {
+ error_dialog_parent_handle=value;
+ }
+ }
+
+ private string filename="";
+
+ public string FileName {
+ get {
+ return(filename);
+ }
+ set {
+ filename=value;
+ }
+ }
+
+ private bool redirect_standard_error=false;
+
+ public bool RedirectStandardError {
+ get {
+ return(redirect_standard_error);
+ }
+ set {
+ redirect_standard_error=value;
+ }
+ }
+
+ private bool redirect_standard_input=false;
+
+ public bool RedirectStandardInput {
+ get {
+ return(redirect_standard_input);
+ }
+ set {
+ redirect_standard_input=value;
+ }
+ }
+
+ private bool redirect_standard_output=false;
+
+ public bool RedirectStandardOutput {
+ get {
+ return(redirect_standard_output);
+ }
+ set {
+ redirect_standard_output=value;
+ }
+ }
+
+ private bool use_shell_execute=true;
+
+ public bool UseShellExecute {
+ get {
+ return(use_shell_execute);
+ }
+ set {
+ use_shell_execute=value;
+ }
+ }
+
+ private string verb="";
+
+ public string Verb {
+ get {
+ return(verb);
+ }
+ set {
+ verb=value;
+ }
+ }
+
+ [MonoTODO]
+ public string[] Verbs {
+ get {
+ return(null);
+ }
+ }
+
+ private ProcessWindowStyle window_style=ProcessWindowStyle.Normal;
+
+ public ProcessWindowStyle WindowStyle {
+ get {
+ return(window_style);
+ }
+ set {
+ window_style=value;
+ }
+ }
+
+ private string working_directory="";
+
+ public string WorkingDirectory {
+ get {
+ return(working_directory);
+ }
+ set {
+ working_directory=value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessThread.cs b/mcs/class/System/System.Diagnostics/ProcessThread.cs
new file mode 100755
index 00000000000..bbc6d56eb97
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessThread.cs
@@ -0,0 +1,118 @@
+//
+// System.Diagnostics.ProcessThread.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+ public class ProcessThread : Component {
+ [MonoTODO]
+ public int BasePriority {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int CurrentPriority {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int Id {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ int IdealProcessor {
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool PriorityBoostEnabled {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ThreadPriorityLevel PriorityLevel {
+ get {
+ return(ThreadPriorityLevel.Idle);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan PrivilegedProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ IntPtr ProcessorAffinity {
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr StartAddress {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public DateTime StartTime {
+ get {
+ return(new DateTime(0));
+ }
+ }
+
+ [MonoTODO]
+ public ThreadState ThreadState {
+ get {
+ return(ThreadState.Initialized);
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan TotalProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan UserProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public ThreadWaitReason WaitReason {
+ get {
+ return(ThreadWaitReason.Executive);
+ }
+ }
+
+ [MonoTODO]
+ public void ResetIdealProcessor() {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
new file mode 100755
index 00000000000..4efbcd21bb0
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
@@ -0,0 +1,56 @@
+//
+// System.Diagnostics.ProcessThreadCollection.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Diagnostics {
+ public class ProcessThreadCollection : ReadOnlyCollectionBase {
+ [MonoTODO]
+ protected ProcessThreadCollection() {
+ }
+
+ [MonoTODO]
+ public ProcessThreadCollection(ProcessThread[] processThreads) {
+ }
+
+ [MonoTODO]
+ public ProcessThread this[int index] {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public int Add(ProcessThread thread) {
+ return(0);
+ }
+
+ [MonoTODO]
+ public bool Contains(ProcessThread thread) {
+ return(false);
+ }
+
+ [MonoTODO]
+ public void CopyTo(ProcessThread[] array, int index) {
+ }
+
+ [MonoTODO]
+ public int IndexOf(ProcessThread thread) {
+ return(0);
+ }
+
+ [MonoTODO]
+ public void Insert(int index, ProcessThread thread) {
+ }
+
+ [MonoTODO]
+ public void Remove(ProcessThread thread) {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessWindowStyle.cs b/mcs/class/System/System.Diagnostics/ProcessWindowStyle.cs
new file mode 100755
index 00000000000..00afa1ac997
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessWindowStyle.cs
@@ -0,0 +1,18 @@
+//
+// System.Diagnostics.ProcessWindowStyle.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ProcessWindowStyle {
+ Hidden=1,
+ Maximized=3,
+ Minimized=2,
+ Normal=0,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/Switch.cs b/mcs/class/System/System.Diagnostics/Switch.cs
new file mode 100755
index 00000000000..d154668710a
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Switch.cs
@@ -0,0 +1,94 @@
+//
+// System.Diagnostics.Switch.cs
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2001-2002
+//
+
+using System.Collections;
+
+namespace System.Diagnostics
+{
+ public abstract class Switch
+ {
+ private string name = "";
+ private string description = "";
+ private int switchSetting = 0;
+
+ // MS Behavior is that (quoting from MSDN for OnSwitchSettingChanged()):
+ // "...It is invoked the first time a switch reads its value from the
+ // configuration file..."
+ // The docs + testing implies two things:
+ // 1. The value of the switch is not read in from the constructor
+ // 2. The value is instead read in on the first time get_SwitchSetting is
+ // invoked
+ // Assuming that OnSwitchSettingChanged() is invoked on a .config file
+ // read and on all changes
+ //
+ // Thus, we need to keep track of whether or not switchSetting has been
+ // initialized. Using `switchSetting=-1' seems logical, but if someone
+ // actually wants to use -1 as a switch value that would cause problems.
+ private bool initialized = false;
+
+ protected Switch(string displayName, string description)
+ {
+ this.name = displayName;
+ this.description = description;
+ }
+
+ public string Description {
+ get {return description;}
+ }
+
+ public string DisplayName {
+ get {return name;}
+ }
+
+ protected int SwitchSetting {
+ get {
+ if (!initialized) {
+ initialized = true;
+ GetConfigFileSetting ();
+ OnSwitchSettingChanged ();
+ }
+ return switchSetting;
+ }
+ set {
+ if(switchSetting != value) {
+ switchSetting = value;
+ OnSwitchSettingChanged();
+ }
+ initialized = true;
+ }
+ }
+
+ private void GetConfigFileSetting ()
+ {
+ // Load up the specified switch
+ IDictionary d =
+ (IDictionary) DiagnosticsConfiguration.Settings ["switches"];
+ if (d != null) {
+ object o = d [name];
+ try {
+ switchSetting = int.Parse (o.ToString());
+ }
+ catch {
+ switchSetting = 0;
+ }
+ }
+ }
+
+ protected virtual void OnSwitchSettingChanged()
+ {
+ // Do nothing. This is merely provided for derived classes to know when
+ // the value of SwitchSetting has changed.
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs b/mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs
new file mode 100644
index 00000000000..45dff28e9c0
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs
@@ -0,0 +1,109 @@
+//
+// System.Diagnostics.TextWriterTraceListener.cs
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.IO;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public class TextWriterTraceListener : TraceListener {
+
+ private TextWriter writer;
+
+ public TextWriterTraceListener () : base ("TextWriter")
+ {
+ }
+
+ public TextWriterTraceListener (Stream stream)
+ : this (stream, "")
+ {
+ }
+
+ public TextWriterTraceListener (string fileName)
+ : this (fileName, "")
+ {
+ }
+
+ public TextWriterTraceListener (TextWriter writer)
+ : this (writer, "")
+ {
+ }
+
+ public TextWriterTraceListener (Stream stream, string name)
+ : base (name != null ? name : "")
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ writer = new StreamWriter (stream);
+ }
+
+ public TextWriterTraceListener (string fileName, string name)
+ : base (name != null ? name : "")
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName");
+ writer = File.AppendText (fileName);
+ }
+
+ public TextWriterTraceListener (TextWriter writer, string name)
+ : base (name != null ? name : "")
+ {
+ if (writer == null)
+ throw new ArgumentNullException ("writer");
+ this.writer = writer;
+ }
+
+ public TextWriter Writer {
+ get {return writer;}
+ set {writer = value;}
+ }
+
+ public override void Close ()
+ {
+ if (writer != null) {
+ writer.Flush ();
+ writer.Close ();
+ writer = null;
+ }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing)
+ Close ();
+
+ base.Dispose (disposing);
+ }
+
+ public override void Flush ()
+ {
+ writer.Flush ();
+ }
+
+ public override void Write (string message)
+ {
+ if (NeedIndent)
+ WriteIndent ();
+ writer.Write (message);
+ }
+
+ public override void WriteLine (string message)
+ {
+ if (NeedIndent)
+ WriteIndent ();
+ writer.WriteLine (message);
+ NeedIndent = true;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs b/mcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs
new file mode 100755
index 00000000000..17297c10738
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.ThreadPriorityLevel.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ThreadPriorityLevel {
+ AboveNormal=1,
+ BelowNormal=-1,
+ Highest=2,
+ Idle=-15,
+ Lowest=-2,
+ Normal=0,
+ TimeCritical=15,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ThreadState.cs b/mcs/class/System/System.Diagnostics/ThreadState.cs
new file mode 100755
index 00000000000..12e4501c104
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ThreadState.cs
@@ -0,0 +1,22 @@
+//
+// System.Diagnostics.ThreadState.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ThreadState {
+ Initialized=0,
+ Ready=1,
+ Running=2,
+ Standby=3,
+ Terminated=4,
+ Transition=6,
+ Unknown=7,
+ Wait=5,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ThreadWaitReason.cs b/mcs/class/System/System.Diagnostics/ThreadWaitReason.cs
new file mode 100755
index 00000000000..97946549f39
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ThreadWaitReason.cs
@@ -0,0 +1,28 @@
+//
+// System.Diagnostics.ThreadWaitReason.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ThreadWaitReason {
+ EventPairHigh=7,
+ EventPairLow=8,
+ ExecutionDelay=4,
+ Executive=0,
+ FreePage=1,
+ LpcReceive=9,
+ LpcReply=10,
+ PageIn=2,
+ PageOut=12,
+ Suspended=5,
+ SystemAllocation=3,
+ Unknown=13,
+ UserRequest=6,
+ VirtualMemory=11,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/Trace.cs b/mcs/class/System/System.Diagnostics/Trace.cs
new file mode 100644
index 00000000000..223672f156c
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Trace.cs
@@ -0,0 +1,197 @@
+//
+// System.Diagnostics.Trace.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public sealed class Trace {
+
+ private Trace () {}
+
+ public static bool AutoFlush {
+ get {return TraceImpl.AutoFlush;}
+ set {TraceImpl.AutoFlush = value;}
+ }
+
+ public static int IndentLevel {
+ get {return TraceImpl.IndentLevel;}
+ set {TraceImpl.IndentLevel = value;}
+ }
+
+ public static int IndentSize {
+ get {return TraceImpl.IndentSize;}
+ set {TraceImpl.IndentSize = value;}
+ }
+
+ public static TraceListenerCollection Listeners {
+ get {return TraceImpl.Listeners;}
+ }
+
+ [Conditional("TRACE")]
+ public static void Assert (bool condition)
+ {
+ TraceImpl.Assert (condition);
+ }
+
+ [Conditional("TRACE")]
+ public static void Assert (bool condition, string message)
+ {
+ TraceImpl.Assert (condition, message);
+ }
+
+ [Conditional("TRACE")]
+ public static void Assert (bool condition, string message,
+ string detailMessage)
+ {
+ TraceImpl.Assert (condition, message, detailMessage);
+ }
+
+ [Conditional("TRACE")]
+ public static void Close ()
+ {
+ TraceImpl.Close ();
+ }
+
+ [Conditional("TRACE")]
+ public static void Fail (string message)
+ {
+ TraceImpl.Fail (message);
+ }
+
+ [Conditional("TRACE")]
+ public static void Fail (string message, string detailMessage)
+ {
+ TraceImpl.Fail (message, detailMessage);
+ }
+
+ [Conditional("TRACE")]
+ public static void Flush ()
+ {
+ TraceImpl.Flush ();
+ }
+
+ [Conditional("TRACE")]
+ public static void Indent ()
+ {
+ TraceImpl.Indent ();
+ }
+
+ [Conditional("TRACE")]
+ public static void Unindent ()
+ {
+ TraceImpl.Unindent ();
+ }
+
+ [Conditional("TRACE")]
+ public static void Write (object value)
+ {
+ TraceImpl.Write (value);
+ }
+
+ [Conditional("TRACE")]
+ public static void Write (string message)
+ {
+ TraceImpl.Write (message);
+ }
+
+ [Conditional("TRACE")]
+ public static void Write (object value, string category)
+ {
+ TraceImpl.Write (value, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void Write (string message, string category)
+ {
+ TraceImpl.Write (message, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, object value)
+ {
+ TraceImpl.WriteIf (condition, value);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, string message)
+ {
+ TraceImpl.WriteIf (condition, message);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, value, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, message, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLine (object value)
+ {
+ TraceImpl.WriteLine (value);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLine (string message)
+ {
+ TraceImpl.WriteLine (message);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLine (object value, string category)
+ {
+ TraceImpl.WriteLine (value, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLine (string message, string category)
+ {
+ TraceImpl.WriteLine (message, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, object value)
+ {
+ TraceImpl.WriteLineIf (condition, value);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, string message)
+ {
+ TraceImpl.WriteLineIf (condition, message);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, value, category);
+ }
+
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, message, category);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceImpl.cs b/mcs/class/System/System.Diagnostics/TraceImpl.cs
new file mode 100644
index 00000000000..5d943f40765
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceImpl.cs
@@ -0,0 +1,337 @@
+//
+// System.Diagnostics.TraceImpl.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Diagnostics;
+using System.Configuration;
+
+namespace System.Diagnostics {
+
+ internal class TraceImpl {
+
+ private static object lock_ = new object ();
+
+ private static bool autoFlush;
+
+ [ThreadStatic]
+ private static int indentLevel = 0;
+
+ [ThreadStatic]
+ private static int indentSize;
+
+ // Grab the .config file stuff.
+ //
+ // There are some ordering issues with the .config file.
+ //
+ // The DiagnosticsConfigurationHandler assumes that the TraceImpl.Listeners
+ // collection exists (so it can initialize the DefaultTraceListener and
+ // add/remove existing listeners).
+ //
+ // When is the .config file read? That's somewhat undefined. The .config
+ // file will be read the first time someone calls
+ // ConfigurationSettings.GetConfig(), but when that occurs is
+ // indeterminate.
+ //
+ // Since it's probable that the Trace/Debug classes will be used by the
+ // application, the .config file should be read in before they're used.
+ //
+ // Thus, place the initialization here. We can ensure that everything is
+ // initialized before reading in the .config file, which should ensure
+ // that everything is sane.
+ static TraceImpl ()
+ {
+ // defaults
+ autoFlush = false;
+ indentLevel = 0;
+ indentSize = 4;
+
+ listeners = new TraceListenerCollection ();
+
+ // Initialize the world
+ System.Collections.IDictionary d = DiagnosticsConfiguration.Settings;
+
+ // remove warning about d being unused
+ d = d;
+ }
+
+ private TraceImpl ()
+ {
+ }
+
+ public static bool AutoFlush {
+ get {return autoFlush;}
+ set {autoFlush = value;}
+ }
+
+ public static int IndentLevel {
+ get {return indentLevel;}
+ set {
+ indentLevel = value;
+
+ // Don't need to lock for threadsafety as
+ // TraceListener.IndentLevel is [ThreadStatic]
+ foreach (TraceListener t in Listeners) {
+ t.IndentLevel = indentLevel;
+ }
+ }
+ }
+
+ public static int IndentSize {
+ get {return indentSize;}
+ set {
+ indentSize = value;
+
+ // Don't need to lock for threadsafety as
+ // TraceListener.IndentSize is [ThreadStatic]
+ foreach (TraceListener t in Listeners) {
+ t.IndentSize = indentSize;
+ }
+ }
+ }
+
+ private static TraceListenerCollection listeners;
+
+ public static TraceListenerCollection Listeners {
+ get {return listeners;}
+ }
+
+ // FIXME: According to MSDN, this method should display a dialog box
+ [MonoTODO]
+ public static void Assert (bool condition)
+ {
+ if (!condition)
+ Fail (new StackTrace().ToString());
+ }
+
+ // FIXME: According to MSDN, this method should display a dialog box
+ [MonoTODO]
+ public static void Assert (bool condition, string message)
+ {
+ if (!condition)
+ Fail (message);
+ }
+
+ // FIXME: According to MSDN, this method should display a dialog box
+ [MonoTODO]
+ public static void Assert (bool condition, string message,
+ string detailMessage)
+ {
+ if (!condition)
+ Fail (message, detailMessage);
+ }
+
+ public static void Close ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Close ();
+ }
+ }
+ }
+
+ // FIXME: From testing .NET, this method should display a dialog
+ [MonoTODO]
+ public static void Fail (string message)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Fail (message);
+ }
+ }
+ }
+
+ // FIXME: From testing .NET, this method should display a dialog
+ [MonoTODO]
+ public static void Fail (string message, string detailMessage)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Fail (message, detailMessage);
+ }
+ }
+ }
+
+ public static void Flush ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners){
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Indent ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.IndentLevel++;
+ }
+ }
+ }
+
+ public static void Unindent ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.IndentLevel--;
+ }
+ }
+ }
+
+ public static void Write (object value)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (value);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Write (string message)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (message);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Write (object value, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (value, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Write (string message, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (message, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteIf (bool condition, object value)
+ {
+ if (condition)
+ Write (value);
+ }
+
+ public static void WriteIf (bool condition, string message)
+ {
+ if (condition)
+ Write (message);
+ }
+
+ public static void WriteIf (bool condition, object value,
+ string category)
+ {
+ if (condition)
+ Write (value, category);
+ }
+
+ public static void WriteIf (bool condition, string message,
+ string category)
+ {
+ if (condition)
+ Write (message, category);
+ }
+
+ public static void WriteLine (object value)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (value);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLine (string message)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (message);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLine (object value, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (value, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLine (string message, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (message, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLineIf (bool condition, object value)
+ {
+ if (condition)
+ WriteLine (value);
+ }
+
+ public static void WriteLineIf (bool condition, string message)
+ {
+ if (condition)
+ WriteLine (message);
+ }
+
+ public static void WriteLineIf (bool condition, object value,
+ string category)
+ {
+ if (condition)
+ WriteLine (value, category);
+ }
+
+ public static void WriteLineIf (bool condition, string message,
+ string category)
+ {
+ if (condition)
+ WriteLine (message, category);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceLevel.cs b/mcs/class/System/System.Diagnostics/TraceLevel.cs
new file mode 100755
index 00000000000..f4f0ba6b4f1
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceLevel.cs
@@ -0,0 +1,24 @@
+// TraceLevel.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:34:29 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Diagnostics {
+
+ public enum TraceLevel {
+ Off = 0,
+ Error = 1,
+ Warning = 2,
+ Info = 3,
+ Verbose = 4,
+ }
+
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceListener.cs b/mcs/class/System/System.Diagnostics/TraceListener.cs
new file mode 100644
index 00000000000..577740a1761
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceListener.cs
@@ -0,0 +1,136 @@
+//
+// System.Diagnostics.TraceListener.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ public abstract class TraceListener : MarshalByRefObject, IDisposable {
+
+ [ThreadStatic]
+ private int indentLevel = 0;
+
+ [ThreadStatic]
+ private int indentSize = 4;
+
+ private string name = null;
+ private bool needIndent = true;
+
+ protected TraceListener () : this ("")
+ {
+ }
+
+ protected TraceListener (string name)
+ {
+ Name = name;
+ }
+
+ public int IndentLevel {
+ get {return indentLevel;}
+ set {indentLevel = value;}
+ }
+
+ public int IndentSize {
+ get {return indentSize;}
+ set {indentSize = value;}
+ }
+
+ public virtual string Name {
+ get {return name;}
+ set {name = value;}
+ }
+
+ protected bool NeedIndent {
+ get {return needIndent;}
+ set {needIndent = value;}
+ }
+
+ public virtual void Close ()
+ {
+ Dispose ();
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ }
+
+ public virtual void Fail (string message)
+ {
+ Fail (message, "");
+ }
+
+ public virtual void Fail (string message, string detailMessage)
+ {
+ WriteLine ("---- DEBUG ASSERTION FAILED ----");
+ WriteLine ("---- Assert Short Message ----");
+ WriteLine (message);
+ WriteLine ("---- Assert Long Message ----");
+ WriteLine (detailMessage);
+ WriteLine ("");
+ }
+
+ public virtual void Flush ()
+ {
+ }
+
+ public virtual void Write (object o)
+ {
+ Write (o.ToString());
+ }
+
+ public abstract void Write (string message);
+
+ public virtual void Write (object o, string category)
+ {
+ Write (o.ToString(), category);
+ }
+
+ public virtual void Write (string message, string category)
+ {
+ Write (category + ": " + message);
+ }
+
+ protected virtual void WriteIndent ()
+ {
+ // Must set NeedIndent to false before Write; otherwise, we get endless
+ // recursion with Write->WriteIndent->Write->WriteIndent...*boom*
+ NeedIndent = false;
+ String indent = new String (' ', IndentLevel*IndentSize);
+ Write (indent);
+ }
+
+ public virtual void WriteLine (object o)
+ {
+ WriteLine (o.ToString());
+ }
+
+ public abstract void WriteLine (string message);
+
+ public virtual void WriteLine (object o, string category)
+ {
+ WriteLine (o.ToString(), category);
+ }
+
+ public virtual void WriteLine (string message, string category)
+ {
+ WriteLine (category + ": " + message);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs b/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
new file mode 100644
index 00000000000..8d32414efbc
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
@@ -0,0 +1,210 @@
+//
+// System.Diagnostics.TraceListenerCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Diagnostics {
+
+ public class TraceListenerCollection : IList, ICollection, IEnumerable {
+
+ private ArrayList listeners = new ArrayList ();
+
+ internal TraceListenerCollection ()
+ {
+ Add (new DefaultTraceListener ());
+ }
+
+ public int Count{
+ get {return listeners.Count;}
+ }
+
+ public TraceListener this [string name] {
+ get {
+ foreach (TraceListener listener in listeners) {
+ if (listener.Name == name)
+ return listener;
+ }
+ return null;
+ }
+ }
+
+ public TraceListener this [int index] {
+ get {return (TraceListener) listeners[index];}
+ set {
+ InitializeListener (value);
+ listeners[index] = value;
+ }
+ }
+
+ object IList.this [int index] {
+ get {return listeners[index];}
+ set {
+ this[index] = (TraceListener) value;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {return listeners.IsSynchronized;}
+ }
+
+ object ICollection.SyncRoot {
+ get {return listeners.SyncRoot;}
+ }
+
+ bool IList.IsFixedSize {
+ get {return listeners.IsFixedSize;}
+ }
+
+ bool IList.IsReadOnly {
+ get {return listeners.IsReadOnly;}
+ }
+
+ public int Add (TraceListener listener)
+ {
+ InitializeListener (listener);
+ return listeners.Add (listener);
+ }
+
+ private void InitializeListener (TraceListener listener)
+ {
+ listener.IndentLevel = TraceImpl.IndentLevel;
+ listener.IndentSize = TraceImpl.IndentSize;
+ }
+
+ private void InitializeRange (IList listeners)
+ {
+ int e = listeners.Count;
+ for (int i = 0; i != e; ++i)
+ InitializeListener (
+ (TraceListener) listeners[i]);
+ }
+
+ public void AddRange (TraceListener[] value)
+ {
+ InitializeRange (value);
+ listeners.AddRange (value);
+ }
+
+ public void AddRange (TraceListenerCollection value)
+ {
+ InitializeRange (value);
+ listeners.AddRange (value.listeners);
+ }
+
+ public void Clear ()
+ {
+ listeners.Clear ();
+ }
+
+ public bool Contains (TraceListener listener)
+ {
+ return listeners.Contains (listener);
+ }
+
+ public void CopyTo (TraceListener[] listeners, int index)
+ {
+ listeners.CopyTo (listeners, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return listeners.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ listeners.CopyTo (array, index);
+ }
+
+ int IList.Add (object value)
+ {
+ if (value is TraceListener)
+ return Add ((TraceListener) value);
+ throw new NotSupportedException (Locale.GetText (
+ "You can only add TraceListener objects to the collection"));
+ }
+
+ bool IList.Contains (object value)
+ {
+ if (value is TraceListener)
+ return listeners.Contains (value);
+ return false;
+ }
+
+ int IList.IndexOf (object value)
+ {
+ if (value is TraceListener)
+ return listeners.IndexOf (value);
+ return -1;
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ if (value is TraceListener) {
+ Insert (index, (TraceListener) value);
+ return;
+ }
+ throw new NotSupportedException (Locale.GetText (
+ "You can only insert TraceListener objects into the collection"));
+ }
+
+ void IList.Remove (object value)
+ {
+ if (value is TraceListener)
+ listeners.Remove (value);
+ }
+
+ public int IndexOf (TraceListener listener)
+ {
+ return listeners.IndexOf (listener);
+ }
+
+ public void Insert (int index, TraceListener listener)
+ {
+ InitializeListener (listener);
+ listeners.Insert (index, listener);
+ }
+
+ public void Remove (string name)
+ {
+ TraceListener found = null;
+
+ foreach (TraceListener listener in listeners) {
+ if (listener.Name == name) {
+ found = listener;
+ break;
+ }
+ }
+
+ if (found != null)
+ listeners.Remove (found);
+ else
+ throw new ArgumentException (Locale.GetText (
+ "TraceListener " + name + " was not in the collection"));
+ }
+
+ public void Remove (TraceListener listener)
+ {
+ listeners.Remove (listener);
+ }
+
+ public void RemoveAt (int index)
+ {
+ listeners.RemoveAt (index);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceSwitch.cs b/mcs/class/System/System.Diagnostics/TraceSwitch.cs
new file mode 100755
index 00000000000..3ddc37141df
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceSwitch.cs
@@ -0,0 +1,60 @@
+//
+// System.Diagnostics.TraceSwtich.cs
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
+// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2001-2002
+//
+
+namespace System.Diagnostics
+{
+ public class TraceSwitch : Switch
+ {
+ public TraceSwitch(string displayName, string description)
+ : base(displayName, description)
+ {
+ }
+
+ public TraceLevel Level {
+ get {return (TraceLevel) SwitchSetting;}
+ set {
+ if (!Enum.IsDefined (typeof(TraceLevel), value))
+ throw new ArgumentException ("value");
+ SwitchSetting = (int) value;
+ }
+ }
+
+ public bool TraceError {
+ get {return SwitchSetting >= (int) TraceLevel.Error;}
+ }
+
+ public bool TraceWarning {
+ get {return SwitchSetting >= (int) TraceLevel.Warning;}
+ }
+
+ public bool TraceInfo {
+ get {return SwitchSetting >= (int) TraceLevel.Info;}
+ }
+
+ public bool TraceVerbose {
+ get {return SwitchSetting >= (int) TraceLevel.Verbose;}
+ }
+
+ // .NET accepts values over 4; they're equivalent to TraceLevel.Verbose
+ // For -1, .NET crashes. (Oops!) Other negative numbers work with an
+ // equivalent to setting SwitchSetting to TraceLevel.Off.
+ // The logic for the accessors will cope with values >= 4, so we'll just
+ // check for negative numbers.
+ protected override void OnSwitchSettingChanged()
+ {
+ if (SwitchSetting < 0)
+ SwitchSetting = (int) TraceLevel.Off;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Globalization/Locale.cs b/mcs/class/System/System.Globalization/Locale.cs
new file mode 100755
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/System/System.Globalization/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/System/System.IO/ChangeLog b/mcs/class/System/System.IO/ChangeLog
new file mode 100755
index 00000000000..295f20cfe64
--- /dev/null
+++ b/mcs/class/System/System.IO/ChangeLog
@@ -0,0 +1,42 @@
+2002-10-31 Dick Porter <dick@ximian.com>
+
+ * MonoIO.cs: Return the error status in a parameter, as the
+ GetLastError() value has long since been blown away if we try and
+ look it up in a subsequent internal call invocation.
+
+2002-09-15 Duncan Mak <duncan@ximian.com>
+
+ * FileSystemWatcher.cs (FileSystemWatcher): Fixed the null-param
+ constructor.
+
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileSystemWatcher.cs: IDisposable fixes.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * InternalBufferOverflowException.cs:
+ * NotifyFilters.cs:
+ * WatcherChangeTypes.cs: little fixes based on class status page.
+
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * ErrorEventArgs.cs:
+ * ErrorEventHandler.cs:
+ * FileSystemEventArgs.cs:
+ * FileSystemEventHandler.cs:
+ * FileSystemWatcher.cs:
+ * InternalBufferOverflowException.cs:
+ * IODescriptionAttribute.cs:
+ * NotifyFilters.cs:
+ * RenamedEventArgs.cs:
+ * RenamedEventHandler.cs:
+ * WaitForChangedResult.cs:
+ * WatcherChangeTypes.cs:
+ New stubs added.
+
+2002-07-20 Dick Porter <dick@ximian.com>
+
+ * MonoIO.cs: Cut down copy of corlib/System.IO/MonoIO.cs, so it
+ can be used from the System assembly but still not be exposed to
+ users.
+
diff --git a/mcs/class/System/System.IO/ErrorEventArgs.cs b/mcs/class/System/System.IO/ErrorEventArgs.cs
new file mode 100644
index 00000000000..49bc2c08677
--- /dev/null
+++ b/mcs/class/System/System.IO/ErrorEventArgs.cs
@@ -0,0 +1,39 @@
+//
+// System.IO.ErrorEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ public class ErrorEventArgs : EventArgs {
+
+ #region Fields
+
+ Exception exception;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ErrorEventArgs (Exception exception)
+ {
+ this.exception = exception;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public virtual Exception GetException ()
+ {
+ return exception;
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.IO/ErrorEventHandler.cs b/mcs/class/System/System.IO/ErrorEventHandler.cs
new file mode 100644
index 00000000000..b4efe2d5b30
--- /dev/null
+++ b/mcs/class/System/System.IO/ErrorEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.IO.ErrorEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ [Serializable]
+ public delegate void ErrorEventHandler (object sender, ErrorEventArgs e);
+}
diff --git a/mcs/class/System/System.IO/FileSystemEventArgs.cs b/mcs/class/System/System.IO/FileSystemEventArgs.cs
new file mode 100644
index 00000000000..b4595d49f1c
--- /dev/null
+++ b/mcs/class/System/System.IO/FileSystemEventArgs.cs
@@ -0,0 +1,51 @@
+//
+// System.IO.FileSystemEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ public class FileSystemEventArgs : EventArgs {
+
+ #region Fields
+
+ WatcherChangeTypes changeType;
+ string directory;
+ string name;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public FileSystemEventArgs (WatcherChangeTypes changeType, string directory, string name)
+ {
+ this.changeType = changeType;
+ this.directory = directory;
+ this.name = name;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public WatcherChangeTypes ChangeType {
+ get { return changeType; }
+ }
+
+ public string FullPath {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System/System.IO/FileSystemEventHandler.cs b/mcs/class/System/System.IO/FileSystemEventHandler.cs
new file mode 100644
index 00000000000..aa0efed9e41
--- /dev/null
+++ b/mcs/class/System/System.IO/FileSystemEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.IO.FileSystemEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ [Serializable]
+ public delegate void FileSystemEventHandler (object sender, FileSystemEventArgs e);
+}
diff --git a/mcs/class/System/System.IO/FileSystemWatcher.cs b/mcs/class/System/System.IO/FileSystemWatcher.cs
new file mode 100644
index 00000000000..3b93891619d
--- /dev/null
+++ b/mcs/class/System/System.IO/FileSystemWatcher.cs
@@ -0,0 +1,193 @@
+//
+// System.IO.FileSystemWatcher.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.IO {
+ public class FileSystemWatcher : Component, ISupportInitialize {
+
+ #region Fields
+
+ bool enableRaisingEvents;
+ string filter;
+ bool includeSubdirectories;
+ int internalBufferSize;
+ NotifyFilters notifyFilter;
+ string path;
+ ISite site;
+ ISynchronizeInvoke synchronizingObject;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public FileSystemWatcher ()
+ {
+ this.notifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
+ this.enableRaisingEvents = false;
+ this.filter = "*.*";
+ this.includeSubdirectories = false;
+ this.internalBufferSize = 8192;
+ this.path = "";
+ }
+
+ public FileSystemWatcher (string path)
+ : this (path, String.Empty)
+ {
+ }
+
+ [MonoTODO]
+ public FileSystemWatcher (string path, string filter)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (filter == null)
+ throw new ArgumentNullException ();
+ if (path == String.Empty)
+ throw new ArgumentException ();
+
+ // if the path does not exist throw an ArgumentException
+
+ this.enableRaisingEvents = false;
+ this.filter = filter;
+ this.includeSubdirectories = false;
+ this.internalBufferSize = 8192;
+ this.notifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
+ this.path = path;
+ this.synchronizingObject = null;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool EnableRaisingEvents {
+ get { return enableRaisingEvents; }
+ set { enableRaisingEvents = value; }
+ }
+
+ public string Filter {
+ get { return filter; }
+ set { filter = value; }
+ }
+
+ public bool IncludeSubdirectories {
+ get { return includeSubdirectories; }
+ set { includeSubdirectories = value; }
+ }
+
+ public int InternalBufferSize {
+ get { return internalBufferSize; }
+ set { internalBufferSize = value; }
+ }
+
+ public NotifyFilters NotifyFilter {
+ get { return notifyFilter; }
+ [MonoTODO ("Perform validation.")]
+ set { notifyFilter = value; }
+ }
+
+ public string Path {
+ get { return path; }
+ [MonoTODO ("Perform validation.")]
+ set { path = value; }
+ }
+
+ public override ISite Site {
+ get { return site; }
+ set { site = value; }
+ }
+
+ public ISynchronizeInvoke SynchronizingObject {
+ get { return synchronizingObject; }
+ set { synchronizingObject = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void BeginInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing) {
+ //
+ }
+ base.Dispose (disposing);
+ }
+
+ [MonoTODO]
+ public void EndInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void OnChanged (FileSystemEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void OnCreated (FileSystemEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void OnDeleted (FileSystemEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void OnError (ErrorEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void OnRenamed (RenamedEventArgs e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event FileSystemEventHandler Changed;
+ public event FileSystemEventHandler Created;
+ public event FileSystemEventHandler Deleted;
+ public event ErrorEventHandler Error;
+ public event RenamedEventHandler Renamed;
+
+ #endregion // Events and Delegates
+ }
+}
diff --git a/mcs/class/System/System.IO/IODescriptionAttribute.cs b/mcs/class/System/System.IO/IODescriptionAttribute.cs
new file mode 100644
index 00000000000..10e22173cc7
--- /dev/null
+++ b/mcs/class/System/System.IO/IODescriptionAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.IO.IODescriptionAttribute.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.IO {
+ [AttributeUsage (AttributeTargets.All)]
+ public class IODescriptionAttribute : DescriptionAttribute {
+
+ #region Fields
+
+ string description;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public IODescriptionAttribute (string description)
+ : base (description)
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ public override string Description {
+ get { return DescriptionValue; }
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.IO/InternalBufferOverflowException.cs b/mcs/class/System/System.IO/InternalBufferOverflowException.cs
new file mode 100644
index 00000000000..24d6b7cf760
--- /dev/null
+++ b/mcs/class/System/System.IO/InternalBufferOverflowException.cs
@@ -0,0 +1,41 @@
+//
+// System.IO.InternalBufferOverflowException.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class InternalBufferOverflowException : SystemException {
+
+ #region Constructors
+
+ public InternalBufferOverflowException ()
+ : base ("Internal buffer overflow occurred.")
+ {
+ }
+
+ public InternalBufferOverflowException (string message)
+ : base (message)
+ {
+ }
+
+ protected InternalBufferOverflowException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public InternalBufferOverflowException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ #endregion // Constructors
+ }
+}
diff --git a/mcs/class/System/System.IO/MonoIO.cs b/mcs/class/System/System.IO/MonoIO.cs
new file mode 100755
index 00000000000..8f7a73cbf12
--- /dev/null
+++ b/mcs/class/System/System.IO/MonoIO.cs
@@ -0,0 +1,52 @@
+//
+// System.IO.MonoIO.cs: static interface to native filesystem.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+// This is a heavily cut down version of the corlib class. It's here
+// because we're keeping extensions invisible, but
+// System.Diagnostics.Process needs access to some of the
+// functionality (and CVS can't do symlinks).
+
+namespace System.IO
+{
+ internal sealed class MonoIO {
+
+ // handle methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Close (IntPtr handle,
+ out MonoIOError error);
+
+ // console handles
+
+ public extern static IntPtr ConsoleOutput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleInput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleError {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ // pipe handles
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CreatePipe (out IntPtr read_handle, out IntPtr write_handle);
+ }
+}
+
diff --git a/mcs/class/System/System.IO/MonoIOError.cs b/mcs/class/System/System.IO/MonoIOError.cs
new file mode 100755
index 00000000000..e0f43fc0367
--- /dev/null
+++ b/mcs/class/System/System.IO/MonoIOError.cs
@@ -0,0 +1,1798 @@
+//
+// System.IO.MonoIOError.cs: Win32 error codes. Yuck.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal enum MonoIOError: int {
+ ERROR_SUCCESS = 0,
+ ERROR_INVALID_FUNCTION = 1,
+ ERROR_FILE_NOT_FOUND = 2,
+ ERROR_PATH_NOT_FOUND = 3,
+ ERROR_TOO_MANY_OPEN_FILES = 4,
+ ERROR_ACCESS_DENIED = 5,
+ ERROR_INVALID_HANDLE = 6,
+ ERROR_ARENA_TRASHED = 7,
+ ERROR_NOT_ENOUGH_MEMORY = 8,
+ ERROR_INVALID_BLOCK = 9,
+ ERROR_BAD_ENVIRONMENT = 10,
+ ERROR_BAD_FORMAT = 11,
+ ERROR_INVALID_ACCESS = 12,
+ ERROR_INVALID_DATA = 13,
+ ERROR_OUTOFMEMORY = 14,
+ ERROR_INVALID_DRIVE = 15,
+ ERROR_CURRENT_DIRECTORY = 16,
+ ERROR_NOT_SAME_DEVICE = 17,
+ ERROR_NO_MORE_FILES = 18,
+ ERROR_WRITE_PROTECT = 19,
+ ERROR_BAD_UNIT = 20,
+ ERROR_NOT_READY = 21,
+ ERROR_BAD_COMMAND = 22,
+ ERROR_CRC = 23,
+ ERROR_BAD_LENGTH = 24,
+ ERROR_SEEK = 25,
+ ERROR_NOT_DOS_DISK = 26,
+ ERROR_SECTOR_NOT_FOUND = 27,
+ ERROR_OUT_OF_PAPER = 28,
+ ERROR_WRITE_FAULT = 29,
+ ERROR_READ_FAULT = 30,
+ ERROR_GEN_FAILURE = 31,
+ ERROR_SHARING_VIOLATION = 32,
+ ERROR_LOCK_VIOLATION = 33,
+ ERROR_WRONG_DISK = 34,
+ ERROR_SHARING_BUFFER_EXCEEDED = 36,
+ ERROR_HANDLE_EOF = 38,
+ ERROR_HANDLE_DISK_FULL = 39,
+ ERROR_NOT_SUPPORTED = 50,
+ ERROR_REM_NOT_LIST = 51,
+ ERROR_DUP_NAME = 52,
+ ERROR_BAD_NETPATH = 53,
+ ERROR_NETWORK_BUSY = 54,
+ ERROR_DEV_NOT_EXIST = 55,
+ ERROR_TOO_MANY_CMDS = 56,
+ ERROR_ADAP_HDW_ERR = 57,
+ ERROR_BAD_NET_RESP = 58,
+ ERROR_UNEXP_NET_ERR = 59,
+ ERROR_BAD_REM_ADAP = 60,
+ ERROR_PRINTQ_FULL = 61,
+ ERROR_NO_SPOOL_SPACE = 62,
+ ERROR_PRINT_CANCELLED = 63,
+ ERROR_NETNAME_DELETED = 64,
+ ERROR_NETWORK_ACCESS_DENIED = 65,
+ ERROR_BAD_DEV_TYPE = 66,
+ ERROR_BAD_NET_NAME = 67,
+ ERROR_TOO_MANY_NAMES = 68,
+ ERROR_TOO_MANY_SESS = 69,
+ ERROR_SHARING_PAUSED = 70,
+ ERROR_REQ_NOT_ACCEP = 71,
+ ERROR_REDIR_PAUSED = 72,
+ ERROR_FILE_EXISTS = 80,
+ ERROR_CANNOT_MAKE = 82,
+ ERROR_FAIL_I24 = 83,
+ ERROR_OUT_OF_STRUCTURES = 84,
+ ERROR_ALREADY_ASSIGNED = 85,
+ ERROR_INVALID_PASSWORD = 86,
+ ERROR_INVALID_PARAMETER = 87,
+ ERROR_NET_WRITE_FAULT = 88,
+ ERROR_NO_PROC_SLOTS = 89,
+ ERROR_TOO_MANY_SEMAPHORES = 100,
+ ERROR_EXCL_SEM_ALREADY_OWNED = 101,
+ ERROR_SEM_IS_SET = 102,
+ ERROR_TOO_MANY_SEM_REQUESTS = 103,
+ ERROR_INVALID_AT_INTERRUPT_TIME = 104,
+ ERROR_SEM_OWNER_DIED = 105,
+ ERROR_SEM_USER_LIMIT = 106,
+ ERROR_DISK_CHANGE = 107,
+ ERROR_DRIVE_LOCKED = 108,
+ ERROR_BROKEN_PIPE = 109,
+ ERROR_OPEN_FAILED = 110,
+ ERROR_BUFFER_OVERFLOW = 111,
+ ERROR_DISK_FULL = 112,
+ ERROR_NO_MORE_SEARCH_HANDLES = 113,
+ ERROR_INVALID_TARGET_HANDLE = 114,
+ ERROR_INVALID_CATEGORY = 117,
+ ERROR_INVALID_VERIFY_SWITCH = 118,
+ ERROR_BAD_DRIVER_LEVEL = 119,
+ ERROR_CALL_NOT_IMPLEMENTED = 120,
+ ERROR_SEM_TIMEOUT = 121,
+ ERROR_INSUFFICIENT_BUFFER = 122,
+ ERROR_INVALID_NAME = 123,
+ ERROR_INVALID_LEVEL = 124,
+ ERROR_NO_VOLUME_LABEL = 125,
+ ERROR_MOD_NOT_FOUND = 126,
+ ERROR_PROC_NOT_FOUND = 127,
+ ERROR_WAIT_NO_CHILDREN = 128,
+ ERROR_CHILD_NOT_COMPLETE = 129,
+ ERROR_DIRECT_ACCESS_HANDLE = 130,
+ ERROR_NEGATIVE_SEEK = 131,
+ ERROR_SEEK_ON_DEVICE = 132,
+ ERROR_IS_JOIN_TARGET = 133,
+ ERROR_IS_JOINED = 134,
+ ERROR_IS_SUBSTED = 135,
+ ERROR_NOT_JOINED = 136,
+ ERROR_NOT_SUBSTED = 137,
+ ERROR_JOIN_TO_JOIN = 138,
+ ERROR_SUBST_TO_SUBST = 139,
+ ERROR_JOIN_TO_SUBST = 140,
+ ERROR_SUBST_TO_JOIN = 141,
+ ERROR_BUSY_DRIVE = 142,
+ ERROR_SAME_DRIVE = 143,
+ ERROR_DIR_NOT_ROOT = 144,
+ ERROR_DIR_NOT_EMPTY = 145,
+ ERROR_IS_SUBST_PATH = 146,
+ ERROR_IS_JOIN_PATH = 147,
+ ERROR_PATH_BUSY = 148,
+ ERROR_IS_SUBST_TARGET = 149,
+ ERROR_SYSTEM_TRACE = 150,
+ ERROR_INVALID_EVENT_COUNT = 151,
+ ERROR_TOO_MANY_MUXWAITERS = 152,
+ ERROR_INVALID_LIST_FORMAT = 153,
+ ERROR_LABEL_TOO_LONG = 154,
+ ERROR_TOO_MANY_TCBS = 155,
+ ERROR_SIGNAL_REFUSED = 156,
+ ERROR_DISCARDED = 157,
+ ERROR_NOT_LOCKED = 158,
+ ERROR_BAD_THREADID_ADDR = 159,
+ ERROR_BAD_ARGUMENTS = 160,
+ ERROR_BAD_PATHNAME = 161,
+ ERROR_SIGNAL_PENDING = 162,
+ ERROR_MAX_THRDS_REACHED = 164,
+ ERROR_LOCK_FAILED = 167,
+ ERROR_BUSY = 170,
+ ERROR_CANCEL_VIOLATION = 173,
+ ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174,
+ ERROR_INVALID_SEGMENT_NUMBER = 180,
+ ERROR_INVALID_ORDINAL = 182,
+ ERROR_ALREADY_EXISTS = 183,
+ ERROR_INVALID_FLAG_NUMBER = 186,
+ ERROR_SEM_NOT_FOUND = 187,
+ ERROR_INVALID_STARTING_CODESEG = 188,
+ ERROR_INVALID_STACKSEG = 189,
+ ERROR_INVALID_MODULETYPE = 190,
+ ERROR_INVALID_EXE_SIGNATURE = 191,
+ ERROR_EXE_MARKED_INVALID = 192,
+ ERROR_BAD_EXE_FORMAT = 193,
+ ERROR_ITERATED_DATA_EXCEEDS_64k = 194,
+ ERROR_INVALID_MINALLOCSIZE = 195,
+ ERROR_DYNLINK_FROM_INVALID_RING = 196,
+ ERROR_IOPL_NOT_ENABLED = 197,
+ ERROR_INVALID_SEGDPL = 198,
+ ERROR_AUTODATASEG_EXCEEDS_64k = 199,
+ ERROR_RING2SEG_MUST_BE_MOVABLE = 200,
+ ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201,
+ ERROR_INFLOOP_IN_RELOC_CHAIN = 202,
+ ERROR_ENVVAR_NOT_FOUND = 203,
+ ERROR_NO_SIGNAL_SENT = 205,
+ ERROR_FILENAME_EXCED_RANGE = 206,
+ ERROR_RING2_STACK_IN_USE = 207,
+ ERROR_META_EXPANSION_TOO_LONG = 208,
+ ERROR_INVALID_SIGNAL_NUMBER = 209,
+ ERROR_THREAD_1_INACTIVE = 210,
+ ERROR_LOCKED = 212,
+ ERROR_TOO_MANY_MODULES = 214,
+ ERROR_NESTING_NOT_ALLOWED = 215,
+ ERROR_EXE_MACHINE_TYPE_MISMATCH = 216,
+ ERROR_BAD_PIPE = 230,
+ ERROR_PIPE_BUSY = 231,
+ ERROR_NO_DATA = 232,
+ ERROR_PIPE_NOT_CONNECTED = 233,
+ ERROR_MORE_DATA = 234,
+ ERROR_VC_DISCONNECTED = 240,
+ ERROR_INVALID_EA_NAME = 254,
+ ERROR_EA_LIST_INCONSISTENT = 255,
+ WAIT_TIMEOUT = 258,
+ ERROR_NO_MORE_ITEMS = 259,
+ ERROR_CANNOT_COPY = 266,
+ ERROR_DIRECTORY = 267,
+ ERROR_EAS_DIDNT_FIT = 275,
+ ERROR_EA_FILE_CORRUPT = 276,
+ ERROR_EA_TABLE_FULL = 277,
+ ERROR_INVALID_EA_HANDLE = 278,
+ ERROR_EAS_NOT_SUPPORTED = 282,
+ ERROR_NOT_OWNER = 288,
+ ERROR_TOO_MANY_POSTS = 298,
+ ERROR_PARTIAL_COPY = 299,
+ ERROR_OPLOCK_NOT_GRANTED = 300,
+ ERROR_INVALID_OPLOCK_PROTOCOL = 301,
+ ERROR_DISK_TOO_FRAGMENTED = 302,
+ ERROR_DELETE_PENDING = 303,
+ ERROR_MR_MID_NOT_FOUND = 317,
+ ERROR_INVALID_ADDRESS = 487,
+ ERROR_ARITHMETIC_OVERFLOW = 534,
+ ERROR_PIPE_CONNECTED = 535,
+ ERROR_PIPE_LISTENING = 536,
+ ERROR_EA_ACCESS_DENIED = 994,
+ ERROR_OPERATION_ABORTED = 995,
+ ERROR_IO_INCOMPLETE = 996,
+ ERROR_IO_PENDING = 997,
+ ERROR_NOACCESS = 998,
+ ERROR_SWAPERROR = 999,
+ ERROR_STACK_OVERFLOW = 1001,
+ ERROR_INVALID_MESSAGE = 1002,
+ ERROR_CAN_NOT_COMPLETE = 1003,
+ ERROR_INVALID_FLAGS = 1004,
+ ERROR_UNRECOGNIZED_VOLUME = 1005,
+ ERROR_FILE_INVALID = 1006,
+ ERROR_FULLSCREEN_MODE = 1007,
+ ERROR_NO_TOKEN = 1008,
+ ERROR_BADDB = 1009,
+ ERROR_BADKEY = 1010,
+ ERROR_CANTOPEN = 1011,
+ ERROR_CANTREAD = 1012,
+ ERROR_CANTWRITE = 1013,
+ ERROR_REGISTRY_RECOVERED = 1014,
+ ERROR_REGISTRY_CORRUPT = 1015,
+ ERROR_REGISTRY_IO_FAILED = 1016,
+ ERROR_NOT_REGISTRY_FILE = 1017,
+ ERROR_KEY_DELETED = 1018,
+ ERROR_NO_LOG_SPACE = 1019,
+ ERROR_KEY_HAS_CHILDREN = 1020,
+ ERROR_CHILD_MUST_BE_VOLATILE = 1021,
+ ERROR_NOTIFY_ENUM_DIR = 1022,
+ ERROR_DEPENDENT_SERVICES_RUNNING = 1051,
+ ERROR_INVALID_SERVICE_CONTROL = 1052,
+ ERROR_SERVICE_REQUEST_TIMEOUT = 1053,
+ ERROR_SERVICE_NO_THREAD = 1054,
+ ERROR_SERVICE_DATABASE_LOCKED = 1055,
+ ERROR_SERVICE_ALREADY_RUNNING = 1056,
+ ERROR_INVALID_SERVICE_ACCOUNT = 1057,
+ ERROR_SERVICE_DISABLED = 1058,
+ ERROR_CIRCULAR_DEPENDENCY = 1059,
+ ERROR_SERVICE_DOES_NOT_EXIST = 1060,
+ ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061,
+ ERROR_SERVICE_NOT_ACTIVE = 1062,
+ ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063,
+ ERROR_EXCEPTION_IN_SERVICE = 1064,
+ ERROR_DATABASE_DOES_NOT_EXIST = 1065,
+ ERROR_SERVICE_SPECIFIC_ERROR = 1066,
+ ERROR_PROCESS_ABORTED = 1067,
+ ERROR_SERVICE_DEPENDENCY_FAIL = 1068,
+ ERROR_SERVICE_LOGON_FAILED = 1069,
+ ERROR_SERVICE_START_HANG = 1070,
+ ERROR_INVALID_SERVICE_LOCK = 1071,
+ ERROR_SERVICE_MARKED_FOR_DELETE = 1072,
+ ERROR_SERVICE_EXISTS = 1073,
+ ERROR_ALREADY_RUNNING_LKG = 1074,
+ ERROR_SERVICE_DEPENDENCY_DELETED = 1075,
+ ERROR_BOOT_ALREADY_ACCEPTED = 1076,
+ ERROR_SERVICE_NEVER_STARTED = 1077,
+ ERROR_DUPLICATE_SERVICE_NAME = 1078,
+ ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079,
+ ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080,
+ ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081,
+ ERROR_NO_RECOVERY_PROGRAM = 1082,
+ ERROR_SERVICE_NOT_IN_EXE = 1083,
+ ERROR_NOT_SAFEBOOT_SERVICE = 1084,
+ ERROR_END_OF_MEDIA = 1100,
+ ERROR_FILEMARK_DETECTED = 1101,
+ ERROR_BEGINNING_OF_MEDIA = 1102,
+ ERROR_SETMARK_DETECTED = 1103,
+ ERROR_NO_DATA_DETECTED = 1104,
+ ERROR_PARTITION_FAILURE = 1105,
+ ERROR_INVALID_BLOCK_LENGTH = 1106,
+ ERROR_DEVICE_NOT_PARTITIONED = 1107,
+ ERROR_UNABLE_TO_LOCK_MEDIA = 1108,
+ ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109,
+ ERROR_MEDIA_CHANGED = 1110,
+ ERROR_BUS_RESET = 1111,
+ ERROR_NO_MEDIA_IN_DRIVE = 1112,
+ ERROR_NO_UNICODE_TRANSLATION = 1113,
+ ERROR_DLL_INIT_FAILED = 1114,
+ ERROR_SHUTDOWN_IN_PROGRESS = 1115,
+ ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116,
+ ERROR_IO_DEVICE = 1117,
+ ERROR_SERIAL_NO_DEVICE = 1118,
+ ERROR_IRQ_BUSY = 1119,
+ ERROR_MORE_WRITES = 1120,
+ ERROR_COUNTER_TIMEOUT = 1121,
+ ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122,
+ ERROR_FLOPPY_WRONG_CYLINDER = 1123,
+ ERROR_FLOPPY_UNKNOWN_ERROR = 1124,
+ ERROR_FLOPPY_BAD_REGISTERS = 1125,
+ ERROR_DISK_RECALIBRATE_FAILED = 1126,
+ ERROR_DISK_OPERATION_FAILED = 1127,
+ ERROR_DISK_RESET_FAILED = 1128,
+ ERROR_EOM_OVERFLOW = 1129,
+ ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130,
+ ERROR_POSSIBLE_DEADLOCK = 1131,
+ ERROR_MAPPED_ALIGNMENT = 1132,
+ ERROR_SET_POWER_STATE_VETOED = 1140,
+ ERROR_SET_POWER_STATE_FAILED = 1141,
+ ERROR_TOO_MANY_LINKS = 1142,
+ ERROR_OLD_WIN_VERSION = 1150,
+ ERROR_APP_WRONG_OS = 1151,
+ ERROR_SINGLE_INSTANCE_APP = 1152,
+ ERROR_RMODE_APP = 1153,
+ ERROR_INVALID_DLL = 1154,
+ ERROR_NO_ASSOCIATION = 1155,
+ ERROR_DDE_FAIL = 1156,
+ ERROR_DLL_NOT_FOUND = 1157,
+ ERROR_NO_MORE_USER_HANDLES = 1158,
+ ERROR_MESSAGE_SYNC_ONLY = 1159,
+ ERROR_SOURCE_ELEMENT_EMPTY = 1160,
+ ERROR_DESTINATION_ELEMENT_FULL = 1161,
+ ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162,
+ ERROR_MAGAZINE_NOT_PRESENT = 1163,
+ ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164,
+ ERROR_DEVICE_REQUIRES_CLEANING = 1165,
+ ERROR_DEVICE_DOOR_OPEN = 1166,
+ ERROR_DEVICE_NOT_CONNECTED = 1167,
+ ERROR_NOT_FOUND = 1168,
+ ERROR_NO_MATCH = 1169,
+ ERROR_SET_NOT_FOUND = 1170,
+ ERROR_POINT_NOT_FOUND = 1171,
+ ERROR_NO_TRACKING_SERVICE = 1172,
+ ERROR_NO_VOLUME_ID = 1173,
+ ERROR_UNABLE_TO_REMOVE_REPLACED = 1175,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177,
+ ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178,
+ ERROR_JOURNAL_NOT_ACTIVE = 1179,
+ ERROR_POTENTIAL_FILE_FOUND = 1180,
+ ERROR_JOURNAL_ENTRY_DELETED = 1181,
+ ERROR_BAD_DEVICE = 1200,
+ ERROR_CONNECTION_UNAVAIL = 1201,
+ ERROR_DEVICE_ALREADY_REMEMBERED = 1202,
+ ERROR_NO_NET_OR_BAD_PATH = 1203,
+ ERROR_BAD_PROVIDER = 1204,
+ ERROR_CANNOT_OPEN_PROFILE = 1205,
+ ERROR_BAD_PROFILE = 1206,
+ ERROR_NOT_CONTAINER = 1207,
+ ERROR_EXTENDED_ERROR = 1208,
+ ERROR_INVALID_GROUPNAME = 1209,
+ ERROR_INVALID_COMPUTERNAME = 1210,
+ ERROR_INVALID_EVENTNAME = 1211,
+ ERROR_INVALID_DOMAINNAME = 1212,
+ ERROR_INVALID_SERVICENAME = 1213,
+ ERROR_INVALID_NETNAME = 1214,
+ ERROR_INVALID_SHARENAME = 1215,
+ ERROR_INVALID_PASSWORDNAME = 1216,
+ ERROR_INVALID_MESSAGENAME = 1217,
+ ERROR_INVALID_MESSAGEDEST = 1218,
+ ERROR_SESSION_CREDENTIAL_CONFLICT = 1219,
+ ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220,
+ ERROR_DUP_DOMAINNAME = 1221,
+ ERROR_NO_NETWORK = 1222,
+ ERROR_CANCELLED = 1223,
+ ERROR_USER_MAPPED_FILE = 1224,
+ ERROR_CONNECTION_REFUSED = 1225,
+ ERROR_GRACEFUL_DISCONNECT = 1226,
+ ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227,
+ ERROR_ADDRESS_NOT_ASSOCIATED = 1228,
+ ERROR_CONNECTION_INVALID = 1229,
+ ERROR_CONNECTION_ACTIVE = 1230,
+ ERROR_NETWORK_UNREACHABLE = 1231,
+ ERROR_HOST_UNREACHABLE = 1232,
+ ERROR_PROTOCOL_UNREACHABLE = 1233,
+ ERROR_PORT_UNREACHABLE = 1234,
+ ERROR_REQUEST_ABORTED = 1235,
+ ERROR_CONNECTION_ABORTED = 1236,
+ ERROR_RETRY = 1237,
+ ERROR_CONNECTION_COUNT_LIMIT = 1238,
+ ERROR_LOGIN_TIME_RESTRICTION = 1239,
+ ERROR_LOGIN_WKSTA_RESTRICTION = 1240,
+ ERROR_INCORRECT_ADDRESS = 1241,
+ ERROR_ALREADY_REGISTERED = 1242,
+ ERROR_SERVICE_NOT_FOUND = 1243,
+ ERROR_NOT_AUTHENTICATED = 1244,
+ ERROR_NOT_LOGGED_ON = 1245,
+ ERROR_CONTINUE = 1246,
+ ERROR_ALREADY_INITIALIZED = 1247,
+ ERROR_NO_MORE_DEVICES = 1248,
+ ERROR_NO_SUCH_SITE = 1249,
+ ERROR_DOMAIN_CONTROLLER_EXISTS = 1250,
+ ERROR_ONLY_IF_CONNECTED = 1251,
+ ERROR_OVERRIDE_NOCHANGES = 1252,
+ ERROR_BAD_USER_PROFILE = 1253,
+ ERROR_NOT_SUPPORTED_ON_SBS = 1254,
+ ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255,
+ ERROR_HOST_DOWN = 1256,
+ ERROR_NON_ACCOUNT_SID = 1257,
+ ERROR_NON_DOMAIN_SID = 1258,
+ ERROR_APPHELP_BLOCK = 1259,
+ ERROR_ACCESS_DISABLED_BY_POLICY = 1260,
+ ERROR_REG_NAT_CONSUMPTION = 1261,
+ ERROR_CSCSHARE_OFFLINE = 1262,
+ ERROR_PKINIT_FAILURE = 1263,
+ ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264,
+ ERROR_DOWNGRADE_DETECTED = 1265,
+ SEC_E_SMARTCARD_CERT_REVOKED = 1266,
+ SEC_E_ISSUING_CA_UNTRUSTED = 1267,
+ SEC_E_REVOCATION_OFFLINE_C = 1268,
+ SEC_E_PKINIT_CLIENT_FAILUR = 1269,
+ SEC_E_SMARTCARD_CERT_EXPIRED = 1270,
+ ERROR_MACHINE_LOCKED = 1271,
+ ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273,
+ ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274,
+ ERROR_DRIVER_BLOCKED = 1275,
+ ERROR_INVALID_IMPORT_OF_NON_DLL = 1276,
+ ERROR_NOT_ALL_ASSIGNED = 1300,
+ ERROR_SOME_NOT_MAPPED = 1301,
+ ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302,
+ ERROR_LOCAL_USER_SESSION_KEY = 1303,
+ ERROR_NULL_LM_PASSWORD = 1304,
+ ERROR_UNKNOWN_REVISION = 1305,
+ ERROR_REVISION_MISMATCH = 1306,
+ ERROR_INVALID_OWNER = 1307,
+ ERROR_INVALID_PRIMARY_GROUP = 1308,
+ ERROR_NO_IMPERSONATION_TOKEN = 1309,
+ ERROR_CANT_DISABLE_MANDATORY = 1310,
+ ERROR_NO_LOGON_SERVERS = 1311,
+ ERROR_NO_SUCH_LOGON_SESSION = 1312,
+ ERROR_NO_SUCH_PRIVILEGE = 1313,
+ ERROR_PRIVILEGE_NOT_HELD = 1314,
+ ERROR_INVALID_ACCOUNT_NAME = 1315,
+ ERROR_USER_EXISTS = 1316,
+ ERROR_NO_SUCH_USER = 1317,
+ ERROR_GROUP_EXISTS = 1318,
+ ERROR_NO_SUCH_GROUP = 1319,
+ ERROR_MEMBER_IN_GROUP = 1320,
+ ERROR_MEMBER_NOT_IN_GROUP = 1321,
+ ERROR_LAST_ADMIN = 1322,
+ ERROR_WRONG_PASSWORD = 1323,
+ ERROR_ILL_FORMED_PASSWORD = 1324,
+ ERROR_PASSWORD_RESTRICTION = 1325,
+ ERROR_LOGON_FAILURE = 1326,
+ ERROR_ACCOUNT_RESTRICTION = 1327,
+ ERROR_INVALID_LOGON_HOURS = 1328,
+ ERROR_INVALID_WORKSTATION = 1329,
+ ERROR_PASSWORD_EXPIRED = 1330,
+ ERROR_ACCOUNT_DISABLED = 1331,
+ ERROR_NONE_MAPPED = 1332,
+ ERROR_TOO_MANY_LUIDS_REQUESTED = 1333,
+ ERROR_LUIDS_EXHAUSTED = 1334,
+ ERROR_INVALID_SUB_AUTHORITY = 1335,
+ ERROR_INVALID_ACL = 1336,
+ ERROR_INVALID_SID = 1337,
+ ERROR_INVALID_SECURITY_DESCR = 1338,
+ ERROR_BAD_INHERITANCE_ACL = 1340,
+ ERROR_SERVER_DISABLED = 1341,
+ ERROR_SERVER_NOT_DISABLED = 1342,
+ ERROR_INVALID_ID_AUTHORITY = 1343,
+ ERROR_ALLOTTED_SPACE_EXCEEDED = 1344,
+ ERROR_INVALID_GROUP_ATTRIBUTES = 1345,
+ ERROR_BAD_IMPERSONATION_LEVEL = 1346,
+ ERROR_CANT_OPEN_ANONYMOUS = 1347,
+ ERROR_BAD_VALIDATION_CLASS = 1348,
+ ERROR_BAD_TOKEN_TYPE = 1349,
+ ERROR_NO_SECURITY_ON_OBJECT = 1350,
+ ERROR_CANT_ACCESS_DOMAIN_INFO = 1351,
+ ERROR_INVALID_SERVER_STATE = 1352,
+ ERROR_INVALID_DOMAIN_STATE = 1353,
+ ERROR_INVALID_DOMAIN_ROLE = 1354,
+ ERROR_NO_SUCH_DOMAIN = 1355,
+ ERROR_DOMAIN_EXISTS = 1356,
+ ERROR_DOMAIN_LIMIT_EXCEEDED = 1357,
+ ERROR_INTERNAL_DB_CORRUPTION = 1358,
+ ERROR_INTERNAL_ERROR = 1359,
+ ERROR_GENERIC_NOT_MAPPED = 1360,
+ ERROR_BAD_DESCRIPTOR_FORMAT = 1361,
+ ERROR_NOT_LOGON_PROCESS = 1362,
+ ERROR_LOGON_SESSION_EXISTS = 1363,
+ ERROR_NO_SUCH_PACKAGE = 1364,
+ ERROR_BAD_LOGON_SESSION_STATE = 1365,
+ ERROR_LOGON_SESSION_COLLISION = 1366,
+ ERROR_INVALID_LOGON_TYPE = 1367,
+ ERROR_CANNOT_IMPERSONATE = 1368,
+ ERROR_RXACT_INVALID_STATE = 1369,
+ ERROR_RXACT_COMMIT_FAILURE = 1370,
+ ERROR_SPECIAL_ACCOUNT = 1371,
+ ERROR_SPECIAL_GROUP = 1372,
+ ERROR_SPECIAL_USER = 1373,
+ ERROR_MEMBERS_PRIMARY_GROUP = 1374,
+ ERROR_TOKEN_ALREADY_IN_USE = 1375,
+ ERROR_NO_SUCH_ALIAS = 1376,
+ ERROR_MEMBER_NOT_IN_ALIAS = 1377,
+ ERROR_MEMBER_IN_ALIAS = 1378,
+ ERROR_ALIAS_EXISTS = 1379,
+ ERROR_LOGON_NOT_GRANTED = 1380,
+ ERROR_TOO_MANY_SECRETS = 1381,
+ ERROR_SECRET_TOO_LONG = 1382,
+ ERROR_INTERNAL_DB_ERROR = 1383,
+ ERROR_TOO_MANY_CONTEXT_IDS = 1384,
+ ERROR_LOGON_TYPE_NOT_GRANTED = 1385,
+ ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386,
+ ERROR_NO_SUCH_MEMBER = 1387,
+ ERROR_INVALID_MEMBER = 1388,
+ ERROR_TOO_MANY_SIDS = 1389,
+ ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390,
+ ERROR_NO_INHERITANCE = 1391,
+ ERROR_FILE_CORRUPT = 1392,
+ ERROR_DISK_CORRUPT = 1393,
+ ERROR_NO_USER_SESSION_KEY = 1394,
+ ERROR_LICENSE_QUOTA_EXCEEDED = 1395,
+ ERROR_WRONG_TARGET_NAME = 1396,
+ ERROR_MUTUAL_AUTH_FAILED = 1397,
+ ERROR_TIME_SKEW = 1398,
+ ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399,
+ ERROR_INVALID_WINDOW_HANDLE = 1400,
+ ERROR_INVALID_MENU_HANDLE = 1401,
+ ERROR_INVALID_CURSOR_HANDLE = 1402,
+ ERROR_INVALID_ACCEL_HANDLE = 1403,
+ ERROR_INVALID_HOOK_HANDLE = 1404,
+ ERROR_INVALID_DWP_HANDLE = 1405,
+ ERROR_TLW_WITH_WSCHILD = 1406,
+ ERROR_CANNOT_FIND_WND_CLASS = 1407,
+ ERROR_WINDOW_OF_OTHER_THREAD = 1408,
+ ERROR_HOTKEY_ALREADY_REGISTERED = 1409,
+ ERROR_CLASS_ALREADY_EXISTS = 1410,
+ ERROR_CLASS_DOES_NOT_EXIST = 1411,
+ ERROR_CLASS_HAS_WINDOWS = 1412,
+ ERROR_INVALID_INDEX = 1413,
+ ERROR_INVALID_ICON_HANDLE = 1414,
+ ERROR_PRIVATE_DIALOG_INDEX = 1415,
+ ERROR_LISTBOX_ID_NOT_FOUND = 1416,
+ ERROR_NO_WILDCARD_CHARACTERS = 1417,
+ ERROR_CLIPBOARD_NOT_OPEN = 1418,
+ ERROR_HOTKEY_NOT_REGISTERED = 1419,
+ ERROR_WINDOW_NOT_DIALOG = 1420,
+ ERROR_CONTROL_ID_NOT_FOUND = 1421,
+ ERROR_INVALID_COMBOBOX_MESSAGE = 1422,
+ ERROR_WINDOW_NOT_COMBOBOX = 1423,
+ ERROR_INVALID_EDIT_HEIGHT = 1424,
+ ERROR_DC_NOT_FOUND = 1425,
+ ERROR_INVALID_HOOK_FILTER = 1426,
+ ERROR_INVALID_FILTER_PROC = 1427,
+ ERROR_HOOK_NEEDS_HMOD = 1428,
+ ERROR_GLOBAL_ONLY_HOOK = 1429,
+ ERROR_JOURNAL_HOOK_SET = 1430,
+ ERROR_HOOK_NOT_INSTALLED = 1431,
+ ERROR_INVALID_LB_MESSAGE = 1432,
+ ERROR_SETCOUNT_ON_BAD_LB = 1433,
+ ERROR_LB_WITHOUT_TABSTOPS = 1434,
+ ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435,
+ ERROR_CHILD_WINDOW_MENU = 1436,
+ ERROR_NO_SYSTEM_MENU = 1437,
+ ERROR_INVALID_MSGBOX_STYLE = 1438,
+ ERROR_INVALID_SPI_VALUE = 1439,
+ ERROR_SCREEN_ALREADY_LOCKED = 1440,
+ ERROR_HWNDS_HAVE_DIFF_PARENT = 1441,
+ ERROR_NOT_CHILD_WINDOW = 1442,
+ ERROR_INVALID_GW_COMMAND = 1443,
+ ERROR_INVALID_THREAD_ID = 1444,
+ ERROR_NON_MDICHILD_WINDOW = 1445,
+ ERROR_POPUP_ALREADY_ACTIVE = 1446,
+ ERROR_NO_SCROLLBARS = 1447,
+ ERROR_INVALID_SCROLLBAR_RANGE = 1448,
+ ERROR_INVALID_SHOWWIN_COMMAND = 1449,
+ ERROR_NO_SYSTEM_RESOURCES = 1450,
+ ERROR_NONPAGED_SYSTEM_RESOURCES = 1451,
+ ERROR_PAGED_SYSTEM_RESOURCES = 1452,
+ ERROR_WORKING_SET_QUOTA = 1453,
+ ERROR_PAGEFILE_QUOTA = 1454,
+ ERROR_COMMITMENT_LIMIT = 1455,
+ ERROR_MENU_ITEM_NOT_FOUND = 1456,
+ ERROR_INVALID_KEYBOARD_HANDLE = 1457,
+ ERROR_HOOK_TYPE_NOT_ALLOWED = 1458,
+ ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459,
+ ERROR_TIMEOUT = 1460,
+ ERROR_INVALID_MONITOR_HANDLE = 1461,
+ ERROR_EVENTLOG_FILE_CORRUPT = 1500,
+ ERROR_EVENTLOG_CANT_START = 1501,
+ ERROR_LOG_FILE_FULL = 1502,
+ ERROR_EVENTLOG_FILE_CHANGED = 1503,
+ ERROR_INSTALL_SERVICE_FAILURE = 1601,
+ ERROR_INSTALL_USEREXIT = 1602,
+ ERROR_INSTALL_FAILURE = 1603,
+ ERROR_INSTALL_SUSPEND = 1604,
+ ERROR_UNKNOWN_PRODUCT = 1605,
+ ERROR_UNKNOWN_FEATURE = 1606,
+ ERROR_UNKNOWN_COMPONENT = 1607,
+ ERROR_UNKNOWN_PROPERTY = 1608,
+ ERROR_INVALID_HANDLE_STATE = 1609,
+ ERROR_BAD_CONFIGURATION = 1610,
+ ERROR_INDEX_ABSENT = 1611,
+ ERROR_INSTALL_SOURCE_ABSENT = 1612,
+ ERROR_INSTALL_PACKAGE_VERSION = 1613,
+ ERROR_PRODUCT_UNINSTALLED = 1614,
+ ERROR_BAD_QUERY_SYNTAX = 1615,
+ ERROR_INVALID_FIELD = 1616,
+ ERROR_DEVICE_REMOVED = 1617,
+ ERROR_INSTALL_ALREADY_RUNNING = 1618,
+ ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619,
+ ERROR_INSTALL_PACKAGE_INVALID = 1620,
+ ERROR_INSTALL_UI_FAILURE = 1621,
+ ERROR_INSTALL_LOG_FAILURE = 1622,
+ ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623,
+ ERROR_INSTALL_TRANSFORM_FAILURE = 1624,
+ ERROR_INSTALL_PACKAGE_REJECTED = 1625,
+ ERROR_FUNCTION_NOT_CALLED = 1626,
+ ERROR_FUNCTION_FAILED = 1627,
+ ERROR_INVALID_TABLE = 1628,
+ ERROR_DATATYPE_MISMATCH = 1629,
+ ERROR_UNSUPPORTED_TYPE = 1630,
+ ERROR_CREATE_FAILED = 1631,
+ ERROR_INSTALL_TEMP_UNWRITABLE = 1632,
+ ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633,
+ ERROR_INSTALL_NOTUSED = 1634,
+ ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635,
+ ERROR_PATCH_PACKAGE_INVALID = 1636,
+ ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637,
+ ERROR_PRODUCT_VERSION = 1638,
+ ERROR_INVALID_COMMAND_LINE = 1639,
+ ERROR_INSTALL_REMOTE_DISALLOWED = 1640,
+ ERROR_SUCCESS_REBOOT_INITIATED = 1641,
+ ERROR_PATCH_TARGET_NOT_FOUND = 1642,
+ ERROR_PATCH_PACKAGE_REJECTED = 1643,
+ ERROR_INSTALL_TRANSFORM_REJECTED = 1644,
+ RPC_S_INVALID_STRING_BINDING = 1700,
+ RPC_S_WRONG_KIND_OF_BINDING = 1701,
+ RPC_S_INVALID_BINDING = 1702,
+ RPC_S_PROTSEQ_NOT_SUPPORTED = 1703,
+ RPC_S_INVALID_RPC_PROTSEQ = 1704,
+ RPC_S_INVALID_STRING_UUID = 1705,
+ RPC_S_INVALID_ENDPOINT_FORMAT = 1706,
+ RPC_S_INVALID_NET_ADDR = 1707,
+ RPC_S_NO_ENDPOINT_FOUND = 1708,
+ RPC_S_INVALID_TIMEOUT = 1709,
+ RPC_S_OBJECT_NOT_FOUND = 1710,
+ RPC_S_ALREADY_REGISTERED = 1711,
+ RPC_S_TYPE_ALREADY_REGISTERED = 1712,
+ RPC_S_ALREADY_LISTENING = 1713,
+ RPC_S_NO_PROTSEQS_REGISTERED = 1714,
+ RPC_S_NOT_LISTENING = 1715,
+ RPC_S_UNKNOWN_MGR_TYPE = 1716,
+ RPC_S_UNKNOWN_IF = 1717,
+ RPC_S_NO_BINDINGS = 1718,
+ RPC_S_NO_PROTSEQS = 1719,
+ RPC_S_CANT_CREATE_ENDPOINT = 1720,
+ RPC_S_OUT_OF_RESOURCES = 1721,
+ RPC_S_SERVER_UNAVAILABLE = 1722,
+ RPC_S_SERVER_TOO_BUSY = 1723,
+ RPC_S_INVALID_NETWORK_OPTIONS = 1724,
+ RPC_S_NO_CALL_ACTIVE = 1725,
+ RPC_S_CALL_FAILED = 1726,
+ RPC_S_CALL_FAILED_DNE = 1727,
+ RPC_S_PROTOCOL_ERROR = 1728,
+ RPC_S_UNSUPPORTED_TRANS_SYN = 1730,
+ RPC_S_UNSUPPORTED_TYPE = 1732,
+ RPC_S_INVALID_TAG = 1733,
+ RPC_S_INVALID_BOUND = 1734,
+ RPC_S_NO_ENTRY_NAME = 1735,
+ RPC_S_INVALID_NAME_SYNTAX = 1736,
+ RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737,
+ RPC_S_UUID_NO_ADDRESS = 1739,
+ RPC_S_DUPLICATE_ENDPOINT = 1740,
+ RPC_S_UNKNOWN_AUTHN_TYPE = 1741,
+ RPC_S_MAX_CALLS_TOO_SMALL = 1742,
+ RPC_S_STRING_TOO_LONG = 1743,
+ RPC_S_PROTSEQ_NOT_FOUND = 1744,
+ RPC_S_PROCNUM_OUT_OF_RANGE = 1745,
+ RPC_S_BINDING_HAS_NO_AUTH = 1746,
+ RPC_S_UNKNOWN_AUTHN_SERVICE = 1747,
+ RPC_S_UNKNOWN_AUTHN_LEVEL = 1748,
+ RPC_S_INVALID_AUTH_IDENTITY = 1749,
+ RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750,
+ EPT_S_INVALID_ENTRY = 1751,
+ EPT_S_CANT_PERFORM_OP = 1752,
+ EPT_S_NOT_REGISTERED = 1753,
+ RPC_S_NOTHING_TO_EXPORT = 1754,
+ RPC_S_INCOMPLETE_NAME = 1755,
+ RPC_S_INVALID_VERS_OPTION = 1756,
+ RPC_S_NO_MORE_MEMBERS = 1757,
+ RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758,
+ RPC_S_INTERFACE_NOT_FOUND = 1759,
+ RPC_S_ENTRY_ALREADY_EXISTS = 1760,
+ RPC_S_ENTRY_NOT_FOUND = 1761,
+ RPC_S_NAME_SERVICE_UNAVAILABLE = 1762,
+ RPC_S_INVALID_NAF_ID = 1763,
+ RPC_S_CANNOT_SUPPORT = 1764,
+ RPC_S_NO_CONTEXT_AVAILABLE = 1765,
+ RPC_S_INTERNAL_ERROR = 1766,
+ RPC_S_ZERO_DIVIDE = 1767,
+ RPC_S_ADDRESS_ERROR = 1768,
+ RPC_S_FP_DIV_ZERO = 1769,
+ RPC_S_FP_UNDERFLOW = 1770,
+ RPC_S_FP_OVERFLOW = 1771,
+ RPC_X_NO_MORE_ENTRIES = 1772,
+ RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773,
+ RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774,
+ RPC_X_SS_IN_NULL_CONTEXT = 1775,
+ RPC_X_SS_CONTEXT_DAMAGED = 1777,
+ RPC_X_SS_HANDLES_MISMATCH = 1778,
+ RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779,
+ RPC_X_NULL_REF_POINTER = 1780,
+ RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781,
+ RPC_X_BYTE_COUNT_TOO_SMALL = 1782,
+ RPC_X_BAD_STUB_DATA = 1783,
+ ERROR_INVALID_USER_BUFFER = 1784,
+ ERROR_UNRECOGNIZED_MEDIA = 1785,
+ ERROR_NO_TRUST_LSA_SECRET = 1786,
+ ERROR_NO_TRUST_SAM_ACCOUNT = 1787,
+ ERROR_TRUSTED_DOMAIN_FAILURE = 1788,
+ ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789,
+ ERROR_TRUST_FAILURE = 1790,
+ RPC_S_CALL_IN_PROGRESS = 1791,
+ ERROR_NETLOGON_NOT_STARTED = 1792,
+ ERROR_ACCOUNT_EXPIRED = 1793,
+ ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794,
+ ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795,
+ ERROR_UNKNOWN_PORT = 1796,
+ ERROR_UNKNOWN_PRINTER_DRIVER = 1797,
+ ERROR_UNKNOWN_PRINTPROCESSOR = 1798,
+ ERROR_INVALID_SEPARATOR_FILE = 1799,
+ ERROR_INVALID_PRIORITY = 1800,
+ ERROR_INVALID_PRINTER_NAME = 1801,
+ ERROR_PRINTER_ALREADY_EXISTS = 1802,
+ ERROR_INVALID_PRINTER_COMMAND = 1803,
+ ERROR_INVALID_DATATYPE = 1804,
+ ERROR_INVALID_ENVIRONMENT = 1805,
+ RPC_S_NO_MORE_BINDINGS = 1806,
+ ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807,
+ ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808,
+ ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809,
+ ERROR_DOMAIN_TRUST_INCONSISTENT = 1810,
+ ERROR_SERVER_HAS_OPEN_HANDLES = 1811,
+ ERROR_RESOURCE_DATA_NOT_FOUND = 1812,
+ ERROR_RESOURCE_TYPE_NOT_FOUND = 1813,
+ ERROR_RESOURCE_NAME_NOT_FOUND = 1814,
+ ERROR_RESOURCE_LANG_NOT_FOUND = 1815,
+ ERROR_NOT_ENOUGH_QUOTA = 1816,
+ RPC_S_NO_INTERFACES = 1817,
+ RPC_S_CALL_CANCELLED = 1818,
+ RPC_S_BINDING_INCOMPLETE = 1819,
+ RPC_S_COMM_FAILURE = 1820,
+ RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821,
+ RPC_S_NO_PRINC_NAME = 1822,
+ RPC_S_NOT_RPC_ERROR = 1823,
+ RPC_S_UUID_LOCAL_ONLY = 1824,
+ RPC_S_SEC_PKG_ERROR = 1825,
+ RPC_S_NOT_CANCELLED = 1826,
+ RPC_X_INVALID_ES_ACTION = 1827,
+ RPC_X_WRONG_ES_VERSION = 1828,
+ RPC_X_WRONG_STUB_VERSION = 1829,
+ RPC_X_INVALID_PIPE_OBJECT = 1830,
+ RPC_X_WRONG_PIPE_ORDER = 1831,
+ RPC_X_WRONG_PIPE_VERSION = 1832,
+ RPC_S_GROUP_MEMBER_NOT_FOUND = 1898,
+ EPT_S_CANT_CREATE = 1899,
+ RPC_S_INVALID_OBJECT = 1900,
+ ERROR_INVALID_TIME = 1901,
+ ERROR_INVALID_FORM_NAME = 1902,
+ ERROR_INVALID_FORM_SIZE = 1903,
+ ERROR_ALREADY_WAITING = 1904,
+ ERROR_PRINTER_DELETED = 1905,
+ ERROR_INVALID_PRINTER_STATE = 1906,
+ ERROR_PASSWORD_MUST_CHANGE = 1907,
+ ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908,
+ ERROR_ACCOUNT_LOCKED_OUT = 1909,
+ OR_INVALID_OXID = 1910,
+ OR_INVALID_OID = 1911,
+ OR_INVALID_SET = 1912,
+ RPC_S_SEND_INCOMPLETE = 1913,
+ RPC_S_INVALID_ASYNC_HANDLE = 1914,
+ RPC_S_INVALID_ASYNC_CALL = 1915,
+ RPC_X_PIPE_CLOSED = 1916,
+ RPC_X_PIPE_DISCIPLINE_ERROR = 1917,
+ RPC_X_PIPE_EMPTY = 1918,
+ ERROR_NO_SITENAME = 1919,
+ ERROR_CANT_ACCESS_FILE = 1920,
+ ERROR_CANT_RESOLVE_FILENAME = 1921,
+ RPC_S_ENTRY_TYPE_MISMATCH = 1922,
+ RPC_S_NOT_ALL_OBJS_EXPORTED = 1923,
+ RPC_S_INTERFACE_NOT_EXPORTED = 1924,
+ RPC_S_PROFILE_NOT_ADDED = 1925,
+ RPC_S_PRF_ELT_NOT_ADDED = 1926,
+ RPC_S_PRF_ELT_NOT_REMOVED = 1927,
+ RPC_S_GRP_ELT_NOT_ADDED = 1928,
+ RPC_S_GRP_ELT_NOT_REMOVED = 1929,
+ ERROR_KM_DRIVER_BLOCKED = 1930,
+ ERROR_CONTEXT_EXPIRED = 1931,
+ ERROR_INVALID_PIXEL_FORMAT = 2000,
+ ERROR_BAD_DRIVER = 2001,
+ ERROR_INVALID_WINDOW_STYLE = 2002,
+ ERROR_METAFILE_NOT_SUPPORTED = 2003,
+ ERROR_TRANSFORM_NOT_SUPPORTED = 2004,
+ ERROR_CLIPPING_NOT_SUPPORTED = 2005,
+ ERROR_INVALID_CMM = 2010,
+ ERROR_INVALID_PROFILE = 2011,
+ ERROR_TAG_NOT_FOUND = 2012,
+ ERROR_TAG_NOT_PRESENT = 2013,
+ ERROR_DUPLICATE_TAG = 2014,
+ ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015,
+ ERROR_PROFILE_NOT_FOUND = 2016,
+ ERROR_INVALID_COLORSPACE = 2017,
+ ERROR_ICM_NOT_ENABLED = 2018,
+ ERROR_DELETING_ICM_XFORM = 2019,
+ ERROR_INVALID_TRANSFORM = 2020,
+ ERROR_COLORSPACE_MISMATCH = 2021,
+ ERROR_INVALID_COLORINDEX = 2022,
+ ERROR_CONNECTED_OTHER_PASSWORD = 2108,
+ ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109,
+ ERROR_BAD_USERNAME = 2202,
+ ERROR_NOT_CONNECTED = 2250,
+ ERROR_OPEN_FILES = 2401,
+ ERROR_ACTIVE_CONNECTIONS = 2402,
+ ERROR_DEVICE_IN_USE = 2404,
+ ERROR_UNKNOWN_PRINT_MONITOR = 3000,
+ ERROR_PRINTER_DRIVER_IN_USE = 3001,
+ ERROR_SPOOL_FILE_NOT_FOUND = 3002,
+ ERROR_SPL_NO_STARTDOC = 3003,
+ ERROR_SPL_NO_ADDJOB = 3004,
+ ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005,
+ ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006,
+ ERROR_INVALID_PRINT_MONITOR = 3007,
+ ERROR_PRINT_MONITOR_IN_USE = 3008,
+ ERROR_PRINTER_HAS_JOBS_QUEUED = 3009,
+ ERROR_SUCCESS_REBOOT_REQUIRED = 3010,
+ ERROR_SUCCESS_RESTART_REQUIRED = 3011,
+ ERROR_PRINTER_NOT_FOUND = 3012,
+ ERROR_PRINTER_DRIVER_WARNED = 3013,
+ ERROR_PRINTER_DRIVER_BLOCKED = 3014,
+ ERROR_WINS_INTERNAL = 4000,
+ ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001,
+ ERROR_STATIC_INIT = 4002,
+ ERROR_INC_BACKUP = 4003,
+ ERROR_FULL_BACKUP = 4004,
+ ERROR_REC_NON_EXISTENT = 4005,
+ ERROR_RPL_NOT_ALLOWED = 4006,
+ ERROR_DHCP_ADDRESS_CONFLICT = 4100,
+ ERROR_WMI_GUID_NOT_FOUND = 4200,
+ ERROR_WMI_INSTANCE_NOT_FOUND = 4201,
+ ERROR_WMI_ITEMID_NOT_FOUND = 4202,
+ ERROR_WMI_TRY_AGAIN = 4203,
+ ERROR_WMI_DP_NOT_FOUND = 4204,
+ ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205,
+ ERROR_WMI_ALREADY_ENABLED = 4206,
+ ERROR_WMI_GUID_DISCONNECTED = 4207,
+ ERROR_WMI_SERVER_UNAVAILABLE = 4208,
+ ERROR_WMI_DP_FAILED = 4209,
+ ERROR_WMI_INVALID_MOF = 4210,
+ ERROR_WMI_INVALID_REGINFO = 4211,
+ ERROR_WMI_ALREADY_DISABLED = 4212,
+ ERROR_WMI_READ_ONLY = 4213,
+ ERROR_WMI_SET_FAILURE = 4214,
+ ERROR_INVALID_MEDIA = 4300,
+ ERROR_INVALID_LIBRARY = 4301,
+ ERROR_INVALID_MEDIA_POOL = 4302,
+ ERROR_DRIVE_MEDIA_MISMATCH = 4303,
+ ERROR_MEDIA_OFFLINE = 4304,
+ ERROR_LIBRARY_OFFLINE = 4305,
+ ERROR_EMPTY = 4306,
+ ERROR_NOT_EMPTY = 4307,
+ ERROR_MEDIA_UNAVAILABLE = 4308,
+ ERROR_RESOURCE_DISABLED = 4309,
+ ERROR_INVALID_CLEANER = 4310,
+ ERROR_UNABLE_TO_CLEAN = 4311,
+ ERROR_OBJECT_NOT_FOUND = 4312,
+ ERROR_DATABASE_FAILURE = 4313,
+ ERROR_DATABASE_FULL = 4314,
+ ERROR_MEDIA_INCOMPATIBLE = 4315,
+ ERROR_RESOURCE_NOT_PRESENT = 4316,
+ ERROR_INVALID_OPERATION = 4317,
+ ERROR_MEDIA_NOT_AVAILABLE = 4318,
+ ERROR_DEVICE_NOT_AVAILABLE = 4319,
+ ERROR_REQUEST_REFUSED = 4320,
+ ERROR_INVALID_DRIVE_OBJECT = 4321,
+ ERROR_LIBRARY_FULL = 4322,
+ ERROR_MEDIUM_NOT_ACCESSIBLE = 4323,
+ ERROR_UNABLE_TO_LOAD_MEDIUM = 4324,
+ ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325,
+ ERROR_UNABLE_TO_INVENTORY_SLOT = 4326,
+ ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327,
+ ERROR_TRANSPORT_FULL = 4328,
+ ERROR_CONTROLLING_IEPORT = 4329,
+ ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330,
+ ERROR_CLEANER_SLOT_SET = 4331,
+ ERROR_CLEANER_SLOT_NOT_SET = 4332,
+ ERROR_CLEANER_CARTRIDGE_SPENT = 4333,
+ ERROR_UNEXPECTED_OMID = 4334,
+ ERROR_CANT_DELETE_LAST_ITEM = 4335,
+ ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336,
+ ERROR_VOLUME_CONTAINS_SYS_FILES = 4337,
+ ERROR_INDIGENOUS_TYPE = 4338,
+ ERROR_NO_SUPPORTING_DRIVES = 4339,
+ ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340,
+ ERROR_FILE_OFFLINE = 4350,
+ ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351,
+ ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352,
+ ERROR_NOT_A_REPARSE_POINT = 4390,
+ ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391,
+ ERROR_INVALID_REPARSE_DATA = 4392,
+ ERROR_REPARSE_TAG_INVALID = 4393,
+ ERROR_REPARSE_TAG_MISMATCH = 4394,
+ ERROR_VOLUME_NOT_SIS_ENABLED = 4500,
+ ERROR_DEPENDENT_RESOURCE_EXISTS = 5001,
+ ERROR_DEPENDENCY_NOT_FOUND = 5002,
+ ERROR_DEPENDENCY_ALREADY_EXISTS = 5003,
+ ERROR_RESOURCE_NOT_ONLINE = 5004,
+ ERROR_HOST_NODE_NOT_AVAILABLE = 5005,
+ ERROR_RESOURCE_NOT_AVAILABLE = 5006,
+ ERROR_RESOURCE_NOT_FOUND = 5007,
+ ERROR_SHUTDOWN_CLUSTER = 5008,
+ ERROR_CANT_EVICT_ACTIVE_NODE = 5009,
+ ERROR_OBJECT_ALREADY_EXISTS = 5010,
+ ERROR_OBJECT_IN_LIST = 5011,
+ ERROR_GROUP_NOT_AVAILABLE = 5012,
+ ERROR_GROUP_NOT_FOUND = 5013,
+ ERROR_GROUP_NOT_ONLINE = 5014,
+ ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015,
+ ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016,
+ ERROR_RESMON_CREATE_FAILED = 5017,
+ ERROR_RESMON_ONLINE_FAILED = 5018,
+ ERROR_RESOURCE_ONLINE = 5019,
+ ERROR_QUORUM_RESOURCE = 5020,
+ ERROR_NOT_QUORUM_CAPABLE = 5021,
+ ERROR_CLUSTER_SHUTTING_DOWN = 5022,
+ ERROR_INVALID_STATE = 5023,
+ ERROR_RESOURCE_PROPERTIES_STORED = 5024,
+ ERROR_NOT_QUORUM_CLASS = 5025,
+ ERROR_CORE_RESOURCE = 5026,
+ ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027,
+ ERROR_QUORUMLOG_OPEN_FAILED = 5028,
+ ERROR_CLUSTERLOG_CORRUPT = 5029,
+ ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030,
+ ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031,
+ ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032,
+ ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033,
+ ERROR_QUORUM_OWNER_ALIVE = 5034,
+ ERROR_NETWORK_NOT_AVAILABLE = 5035,
+ ERROR_NODE_NOT_AVAILABLE = 5036,
+ ERROR_ALL_NODES_NOT_AVAILABLE = 5037,
+ ERROR_RESOURCE_FAILED = 5038,
+ ERROR_CLUSTER_INVALID_NODE = 5039,
+ ERROR_CLUSTER_NODE_EXISTS = 5040,
+ ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041,
+ ERROR_CLUSTER_NODE_NOT_FOUND = 5042,
+ ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043,
+ ERROR_CLUSTER_NETWORK_EXISTS = 5044,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045,
+ ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046,
+ ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047,
+ ERROR_CLUSTER_INVALID_REQUEST = 5048,
+ ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049,
+ ERROR_CLUSTER_NODE_DOWN = 5050,
+ ERROR_CLUSTER_NODE_UNREACHABLE = 5051,
+ ERROR_CLUSTER_NODE_NOT_MEMBER = 5052,
+ ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053,
+ ERROR_CLUSTER_INVALID_NETWORK = 5054,
+ ERROR_CLUSTER_NODE_UP = 5056,
+ ERROR_CLUSTER_IPADDR_IN_USE = 5057,
+ ERROR_CLUSTER_NODE_NOT_PAUSED = 5058,
+ ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059,
+ ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060,
+ ERROR_CLUSTER_NODE_ALREADY_UP = 5061,
+ ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062,
+ ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063,
+ ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064,
+ ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065,
+ ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066,
+ ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067,
+ ERROR_INVALID_OPERATION_ON_QUORUM = 5068,
+ ERROR_DEPENDENCY_NOT_ALLOWED = 5069,
+ ERROR_CLUSTER_NODE_PAUSED = 5070,
+ ERROR_NODE_CANT_HOST_RESOURCE = 5071,
+ ERROR_CLUSTER_NODE_NOT_READY = 5072,
+ ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073,
+ ERROR_CLUSTER_JOIN_ABORTED = 5074,
+ ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075,
+ ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076,
+ ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077,
+ ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078,
+ ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079,
+ ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080,
+ ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081,
+ ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082,
+ ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083,
+ ERROR_RESMON_INVALID_STATE = 5084,
+ ERROR_CLUSTER_GUM_NOT_LOCKER = 5085,
+ ERROR_QUORUM_DISK_NOT_FOUND = 5086,
+ ERROR_DATABASE_BACKUP_CORRUPT = 5087,
+ ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088,
+ ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089,
+ ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890,
+ ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891,
+ ERROR_CLUSTER_MEMBERSHIP_HALT = 5892,
+ ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894,
+ ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895,
+ ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896,
+ ERROR_CLUSTER_PARAMETER_MISMATCH = 5897,
+ ERROR_NODE_CANNOT_BE_CLUSTERED = 5898,
+ ERROR_CLUSTER_WRONG_OS_VERSION = 5899,
+ ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900,
+ ERROR_ENCRYPTION_FAILED = 6000,
+ ERROR_DECRYPTION_FAILED = 6001,
+ ERROR_FILE_ENCRYPTED = 6002,
+ ERROR_NO_RECOVERY_POLICY = 6003,
+ ERROR_NO_EFS = 6004,
+ ERROR_WRONG_EFS = 6005,
+ ERROR_NO_USER_KEYS = 6006,
+ ERROR_FILE_NOT_ENCRYPTED = 6007,
+ ERROR_NOT_EXPORT_FORMAT = 6008,
+ ERROR_FILE_READ_ONLY = 6009,
+ ERROR_DIR_EFS_DISALLOWED = 6010,
+ ERROR_EFS_SERVER_NOT_TRUSTED = 6011,
+ ERROR_BAD_RECOVERY_POLICY = 6012,
+ ERROR_EFS_ALG_BLOB_TOO_BIG = 6013,
+ ERROR_VOLUME_NOT_SUPPORT_EFS = 6014,
+ ERROR_EFS_DISABLED = 6015,
+ ERROR_EFS_VERSION_NOT_SUPPORT = 6016,
+ ERROR_NO_BROWSER_SERVERS_FOUND = 6118,
+ SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200,
+ ERROR_CTX_WINSTATION_NAME_INVALID = 7001,
+ ERROR_CTX_INVALID_PD = 7002,
+ ERROR_CTX_PD_NOT_FOUND = 7003,
+ ERROR_CTX_WD_NOT_FOUND = 7004,
+ ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005,
+ ERROR_CTX_SERVICE_NAME_COLLISION = 7006,
+ ERROR_CTX_CLOSE_PENDING = 7007,
+ ERROR_CTX_NO_OUTBUF = 7008,
+ ERROR_CTX_MODEM_INF_NOT_FOUND = 7009,
+ ERROR_CTX_INVALID_MODEMNAME = 7010,
+ ERROR_CTX_MODEM_RESPONSE_ERROR = 7011,
+ ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012,
+ ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013,
+ ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014,
+ ERROR_CTX_MODEM_RESPONSE_BUSY = 7015,
+ ERROR_CTX_MODEM_RESPONSE_VOICE = 7016,
+ ERROR_CTX_TD_ERROR = 7017,
+ ERROR_CTX_WINSTATION_NOT_FOUND = 7022,
+ ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023,
+ ERROR_CTX_WINSTATION_BUSY = 7024,
+ ERROR_CTX_BAD_VIDEO_MODE = 7025,
+ ERROR_CTX_GRAPHICS_INVALID = 7035,
+ ERROR_CTX_LOGON_DISABLED = 7037,
+ ERROR_CTX_NOT_CONSOLE = 7038,
+ ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040,
+ ERROR_CTX_CONSOLE_DISCONNECT = 7041,
+ ERROR_CTX_CONSOLE_CONNECT = 7042,
+ ERROR_CTX_SHADOW_DENIED = 7044,
+ ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045,
+ ERROR_CTX_INVALID_WD = 7049,
+ ERROR_CTX_SHADOW_INVALID = 7050,
+ ERROR_CTX_SHADOW_DISABLED = 7051,
+ ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052,
+ ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053,
+ ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054,
+ ERROR_CTX_LICENSE_CLIENT_INVALID = 7055,
+ ERROR_CTX_LICENSE_EXPIRED = 7056,
+ ERROR_CTX_SHADOW_NOT_RUNNING = 7057,
+ ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058,
+ FRS_ERR_INVALID_API_SEQUENCE = 8001,
+ FRS_ERR_STARTING_SERVICE = 8002,
+ FRS_ERR_STOPPING_SERVICE = 8003,
+ FRS_ERR_INTERNAL_API = 8004,
+ FRS_ERR_INTERNAL = 8005,
+ FRS_ERR_SERVICE_COMM = 8006,
+ FRS_ERR_INSUFFICIENT_PRIV = 8007,
+ FRS_ERR_AUTHENTICATION = 8008,
+ FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009,
+ FRS_ERR_PARENT_AUTHENTICATION = 8010,
+ FRS_ERR_CHILD_TO_PARENT_COMM = 8011,
+ FRS_ERR_PARENT_TO_CHILD_COMM = 8012,
+ FRS_ERR_SYSVOL_POPULATE = 8013,
+ FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014,
+ FRS_ERR_SYSVOL_IS_BUSY = 8015,
+ FRS_ERR_SYSVOL_DEMOTE = 8016,
+ FRS_ERR_INVALID_SERVICE_PARAMETER = 8017,
+ ERROR_DS_NOT_INSTALLED = 8200,
+ ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201,
+ ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202,
+ ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203,
+ ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204,
+ ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205,
+ ERROR_DS_BUSY = 8206,
+ ERROR_DS_UNAVAILABLE = 8207,
+ ERROR_DS_NO_RIDS_ALLOCATED = 8208,
+ ERROR_DS_NO_MORE_RIDS = 8209,
+ ERROR_DS_INCORRECT_ROLE_OWNER = 8210,
+ ERROR_DS_RIDMGR_INIT_ERROR = 8211,
+ ERROR_DS_OBJ_CLASS_VIOLATION = 8212,
+ ERROR_DS_CANT_ON_NON_LEAF = 8213,
+ ERROR_DS_CANT_ON_RDN = 8214,
+ ERROR_DS_CANT_MOD_OBJ_CLASS = 8215,
+ ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216,
+ ERROR_DS_GC_NOT_AVAILABLE = 8217,
+ ERROR_SHARED_POLICY = 8218,
+ ERROR_POLICY_OBJECT_NOT_FOUND = 8219,
+ ERROR_POLICY_ONLY_IN_DS = 8220,
+ ERROR_PROMOTION_ACTIVE = 8221,
+ ERROR_NO_PROMOTION_ACTIVE = 8222,
+ ERROR_DS_OPERATIONS_ERROR = 8224,
+ ERROR_DS_PROTOCOL_ERROR = 8225,
+ ERROR_DS_TIMELIMIT_EXCEEDED = 8226,
+ ERROR_DS_SIZELIMIT_EXCEEDED = 8227,
+ ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228,
+ ERROR_DS_COMPARE_FALSE = 8229,
+ ERROR_DS_COMPARE_TRUE = 8230,
+ ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231,
+ ERROR_DS_STRONG_AUTH_REQUIRED = 8232,
+ ERROR_DS_INAPPROPRIATE_AUTH = 8233,
+ ERROR_DS_AUTH_UNKNOWN = 8234,
+ ERROR_DS_REFERRAL = 8235,
+ ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236,
+ ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237,
+ ERROR_DS_INAPPROPRIATE_MATCHING = 8238,
+ ERROR_DS_CONSTRAINT_VIOLATION = 8239,
+ ERROR_DS_NO_SUCH_OBJECT = 8240,
+ ERROR_DS_ALIAS_PROBLEM = 8241,
+ ERROR_DS_INVALID_DN_SYNTAX = 8242,
+ ERROR_DS_IS_LEAF = 8243,
+ ERROR_DS_ALIAS_DEREF_PROBLEM = 8244,
+ ERROR_DS_UNWILLING_TO_PERFORM = 8245,
+ ERROR_DS_LOOP_DETECT = 8246,
+ ERROR_DS_NAMING_VIOLATION = 8247,
+ ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248,
+ ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249,
+ ERROR_DS_SERVER_DOWN = 8250,
+ ERROR_DS_LOCAL_ERROR = 8251,
+ ERROR_DS_ENCODING_ERROR = 8252,
+ ERROR_DS_DECODING_ERROR = 8253,
+ ERROR_DS_FILTER_UNKNOWN = 8254,
+ ERROR_DS_PARAM_ERROR = 8255,
+ ERROR_DS_NOT_SUPPORTED = 8256,
+ ERROR_DS_NO_RESULTS_RETURNED = 8257,
+ ERROR_DS_CONTROL_NOT_FOUND = 8258,
+ ERROR_DS_CLIENT_LOOP = 8259,
+ ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260,
+ ERROR_DS_SORT_CONTROL_MISSING = 8261,
+ ERROR_DS_OFFSET_RANGE_ERROR = 8262,
+ ERROR_DS_ROOT_MUST_BE_NC = 8301,
+ ERROR_DS_ADD_REPLICA_INHIBITED = 8302,
+ ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303,
+ ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304,
+ ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305,
+ ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306,
+ ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307,
+ ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308,
+ ERROR_DS_USER_BUFFER_TO_SMALL = 8309,
+ ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310,
+ ERROR_DS_ILLEGAL_MOD_OPERATION = 8311,
+ ERROR_DS_OBJ_TOO_LARGE = 8312,
+ ERROR_DS_BAD_INSTANCE_TYPE = 8313,
+ ERROR_DS_MASTERDSA_REQUIRED = 8314,
+ ERROR_DS_OBJECT_CLASS_REQUIRED = 8315,
+ ERROR_DS_MISSING_REQUIRED_ATT = 8316,
+ ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317,
+ ERROR_DS_ATT_ALREADY_EXISTS = 8318,
+ ERROR_DS_CANT_ADD_ATT_VALUES = 8320,
+ ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321,
+ ERROR_DS_RANGE_CONSTRAINT = 8322,
+ ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323,
+ ERROR_DS_CANT_REM_MISSING_ATT = 8324,
+ ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325,
+ ERROR_DS_ROOT_CANT_BE_SUBREF = 8326,
+ ERROR_DS_NO_CHAINING = 8327,
+ ERROR_DS_NO_CHAINED_EVAL = 8328,
+ ERROR_DS_NO_PARENT_OBJECT = 8329,
+ ERROR_DS_PARENT_IS_AN_ALIAS = 8330,
+ ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331,
+ ERROR_DS_CHILDREN_EXIST = 8332,
+ ERROR_DS_OBJ_NOT_FOUND = 8333,
+ ERROR_DS_ALIASED_OBJ_MISSING = 8334,
+ ERROR_DS_BAD_NAME_SYNTAX = 8335,
+ ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336,
+ ERROR_DS_CANT_DEREF_ALIAS = 8337,
+ ERROR_DS_OUT_OF_SCOPE = 8338,
+ ERROR_DS_OBJECT_BEING_REMOVED = 8339,
+ ERROR_DS_CANT_DELETE_DSA_OBJ = 8340,
+ ERROR_DS_GENERIC_ERROR = 8341,
+ ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342,
+ ERROR_DS_CLASS_NOT_DSA = 8343,
+ ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344,
+ ERROR_DS_ILLEGAL_SUPERIOR = 8345,
+ ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346,
+ ERROR_DS_NAME_TOO_MANY_PARTS = 8347,
+ ERROR_DS_NAME_TOO_LONG = 8348,
+ ERROR_DS_NAME_VALUE_TOO_LONG = 8349,
+ ERROR_DS_NAME_UNPARSEABLE = 8350,
+ ERROR_DS_NAME_TYPE_UNKNOWN = 8351,
+ ERROR_DS_NOT_AN_OBJECT = 8352,
+ ERROR_DS_SEC_DESC_TOO_SHORT = 8353,
+ ERROR_DS_SEC_DESC_INVALID = 8354,
+ ERROR_DS_NO_DELETED_NAME = 8355,
+ ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356,
+ ERROR_DS_NCNAME_MUST_BE_NC = 8357,
+ ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358,
+ ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359,
+ ERROR_DS_INVALID_DMD = 8360,
+ ERROR_DS_OBJ_GUID_EXISTS = 8361,
+ ERROR_DS_NOT_ON_BACKLINK = 8362,
+ ERROR_DS_NO_CROSSREF_FOR_NC = 8363,
+ ERROR_DS_SHUTTING_DOWN = 8364,
+ ERROR_DS_UNKNOWN_OPERATION = 8365,
+ ERROR_DS_INVALID_ROLE_OWNER = 8366,
+ ERROR_DS_COULDNT_CONTACT_FSMO = 8367,
+ ERROR_DS_CROSS_NC_DN_RENAME = 8368,
+ ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369,
+ ERROR_DS_REPLICATOR_ONLY = 8370,
+ ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371,
+ ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372,
+ ERROR_DS_NAME_REFERENCE_INVALID = 8373,
+ ERROR_DS_CROSS_REF_EXISTS = 8374,
+ ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375,
+ ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376,
+ ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377,
+ ERROR_DS_DUP_RDN = 8378,
+ ERROR_DS_DUP_OID = 8379,
+ ERROR_DS_DUP_MAPI_ID = 8380,
+ ERROR_DS_DUP_SCHEMA_ID_GUID = 8381,
+ ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382,
+ ERROR_DS_SEMANTIC_ATT_TEST = 8383,
+ ERROR_DS_SYNTAX_MISMATCH = 8384,
+ ERROR_DS_EXISTS_IN_MUST_HAVE = 8385,
+ ERROR_DS_EXISTS_IN_MAY_HAVE = 8386,
+ ERROR_DS_NONEXISTENT_MAY_HAVE = 8387,
+ ERROR_DS_NONEXISTENT_MUST_HAVE = 8388,
+ ERROR_DS_AUX_CLS_TEST_FAIL = 8389,
+ ERROR_DS_NONEXISTENT_POSS_SUP = 8390,
+ ERROR_DS_SUB_CLS_TEST_FAIL = 8391,
+ ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392,
+ ERROR_DS_EXISTS_IN_AUX_CLS = 8393,
+ ERROR_DS_EXISTS_IN_SUB_CLS = 8394,
+ ERROR_DS_EXISTS_IN_POSS_SUP = 8395,
+ ERROR_DS_RECALCSCHEMA_FAILED = 8396,
+ ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397,
+ ERROR_DS_CANT_DELETE = 8398,
+ ERROR_DS_ATT_SCHEMA_REQ_ID = 8399,
+ ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400,
+ ERROR_DS_CANT_CACHE_ATT = 8401,
+ ERROR_DS_CANT_CACHE_CLASS = 8402,
+ ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403,
+ ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404,
+ ERROR_DS_CANT_RETRIEVE_DN = 8405,
+ ERROR_DS_MISSING_SUPREF = 8406,
+ ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407,
+ ERROR_DS_CODE_INCONSISTENCY = 8408,
+ ERROR_DS_DATABASE_ERROR = 8409,
+ ERROR_DS_GOVERNSID_MISSING = 8410,
+ ERROR_DS_MISSING_EXPECTED_ATT = 8411,
+ ERROR_DS_NCNAME_MISSING_CR_REF = 8412,
+ ERROR_DS_SECURITY_CHECKING_ERROR = 8413,
+ ERROR_DS_SCHEMA_NOT_LOADED = 8414,
+ ERROR_DS_SCHEMA_ALLOC_FAILED = 8415,
+ ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416,
+ ERROR_DS_GCVERIFY_ERROR = 8417,
+ ERROR_DS_DRA_SCHEMA_MISMATCH = 8418,
+ ERROR_DS_CANT_FIND_DSA_OBJ = 8419,
+ ERROR_DS_CANT_FIND_EXPECTED_NC = 8420,
+ ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421,
+ ERROR_DS_CANT_RETRIEVE_CHILD = 8422,
+ ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423,
+ ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424,
+ ERROR_DS_BAD_HIERARCHY_FILE = 8425,
+ ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426,
+ ERROR_DS_CONFIG_PARAM_MISSING = 8427,
+ ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428,
+ ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429,
+ ERROR_DS_INTERNAL_FAILURE = 8430,
+ ERROR_DS_UNKNOWN_ERROR = 8431,
+ ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432,
+ ERROR_DS_REFUSING_FSMO_ROLES = 8433,
+ ERROR_DS_MISSING_FSMO_SETTINGS = 8434,
+ ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435,
+ ERROR_DS_DRA_GENERIC = 8436,
+ ERROR_DS_DRA_INVALID_PARAMETER = 8437,
+ ERROR_DS_DRA_BUSY = 8438,
+ ERROR_DS_DRA_BAD_DN = 8439,
+ ERROR_DS_DRA_BAD_NC = 8440,
+ ERROR_DS_DRA_DN_EXISTS = 8441,
+ ERROR_DS_DRA_INTERNAL_ERROR = 8442,
+ ERROR_DS_DRA_INCONSISTENT_DIT = 8443,
+ ERROR_DS_DRA_CONNECTION_FAILED = 8444,
+ ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445,
+ ERROR_DS_DRA_OUT_OF_MEM = 8446,
+ ERROR_DS_DRA_MAIL_PROBLEM = 8447,
+ ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448,
+ ERROR_DS_DRA_REF_NOT_FOUND = 8449,
+ ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450,
+ ERROR_DS_DRA_DB_ERROR = 8451,
+ ERROR_DS_DRA_NO_REPLICA = 8452,
+ ERROR_DS_DRA_ACCESS_DENIED = 8453,
+ ERROR_DS_DRA_NOT_SUPPORTED = 8454,
+ ERROR_DS_DRA_RPC_CANCELLED = 8455,
+ ERROR_DS_DRA_SOURCE_DISABLED = 8456,
+ ERROR_DS_DRA_SINK_DISABLED = 8457,
+ ERROR_DS_DRA_NAME_COLLISION = 8458,
+ ERROR_DS_DRA_SOURCE_REINSTALLED = 8459,
+ ERROR_DS_DRA_MISSING_PARENT = 8460,
+ ERROR_DS_DRA_PREEMPTED = 8461,
+ ERROR_DS_DRA_ABANDON_SYNC = 8462,
+ ERROR_DS_DRA_SHUTDOWN = 8463,
+ ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464,
+ ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465,
+ ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466,
+ ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467,
+ ERROR_DS_DUP_LINK_ID = 8468,
+ ERROR_DS_NAME_ERROR_RESOLVING = 8469,
+ ERROR_DS_NAME_ERROR_NOT_FOUND = 8470,
+ ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471,
+ ERROR_DS_NAME_ERROR_NO_MAPPING = 8472,
+ ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473,
+ ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474,
+ ERROR_DS_CONSTRUCTED_ATT_MOD = 8475,
+ ERROR_DS_WRONG_OM_OBJ_CLASS = 8476,
+ ERROR_DS_DRA_REPL_PENDING = 8477,
+ ERROR_DS_DS_REQUIRED = 8478,
+ ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479,
+ ERROR_DS_NON_BASE_SEARCH = 8480,
+ ERROR_DS_CANT_RETRIEVE_ATTS = 8481,
+ ERROR_DS_BACKLINK_WITHOUT_LINK = 8482,
+ ERROR_DS_EPOCH_MISMATCH = 8483,
+ ERROR_DS_SRC_NAME_MISMATCH = 8484,
+ ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485,
+ ERROR_DS_DST_NC_MISMATCH = 8486,
+ ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487,
+ ERROR_DS_SRC_GUID_MISMATCH = 8488,
+ ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489,
+ ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490,
+ ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491,
+ ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492,
+ ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493,
+ ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494,
+ ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496,
+ ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497,
+ ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498,
+ ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499,
+ ERROR_DS_INVALID_SEARCH_FLAG = 8500,
+ ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501,
+ ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502,
+ ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503,
+ ERROR_DS_SAM_INIT_FAILURE = 8504,
+ ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505,
+ ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506,
+ ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507,
+ ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508,
+ ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509,
+ ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510,
+ ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511,
+ ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512,
+ ERROR_DS_INVALID_GROUP_TYPE = 8513,
+ ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514,
+ ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515,
+ ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516,
+ ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517,
+ ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518,
+ ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519,
+ ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520,
+ ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521,
+ ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522,
+ ERROR_DS_NAMING_MASTER_GC = 8523,
+ ERROR_DS_LOOKUP_FAILURE = 8524,
+ ERROR_DS_COULDNT_UPDATE_SPNS = 8525,
+ ERROR_DS_CANT_RETRIEVE_SD = 8526,
+ ERROR_DS_KEY_NOT_UNIQUE = 8527,
+ ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528,
+ ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529,
+ ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530,
+ ERROR_DS_CANT_START = 8531,
+ ERROR_DS_INIT_FAILURE = 8532,
+ ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533,
+ ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534,
+ ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535,
+ ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536,
+ ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537,
+ ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538,
+ ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539,
+ ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540,
+ ERROR_SAM_INIT_FAILURE = 8541,
+ ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542,
+ ERROR_DS_DRA_SCHEMA_CONFLICT = 8543,
+ ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT = 8544,
+ ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545,
+ ERROR_DS_NC_STILL_HAS_DSAS = 8546,
+ ERROR_DS_GC_REQUIRED = 8547,
+ ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548,
+ ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549,
+ ERROR_DS_CANT_ADD_TO_GC = 8550,
+ ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551,
+ ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552,
+ ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553,
+ ERROR_DS_INVALID_NAME_FOR_SPN = 8554,
+ ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555,
+ ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556,
+ ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557,
+ ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558,
+ ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559,
+ ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560,
+ ERROR_DS_INIT_FAILURE_CONSOLE = 8561,
+ ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562,
+ ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563,
+ ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564,
+ ERROR_DS_FOREST_VERSION_TOO_LOW = 8565,
+ ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566,
+ ERROR_DS_INCOMPATIBLE_VERSION = 8567,
+ ERROR_DS_LOW_DSA_VERSION = 8568,
+ ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569,
+ ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570,
+ ERROR_DS_NAME_NOT_UNIQUE = 8571,
+ ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572,
+ ERROR_DS_OUT_OF_VERSION_STORE = 8573,
+ ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574,
+ ERROR_DS_NO_REF_DOMAIN = 8575,
+ ERROR_DS_RESERVED_LINK_ID = 8576,
+ ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577,
+ ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579,
+ ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581,
+ ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582,
+ ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583,
+ ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584,
+ ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585,
+ ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8586,
+ ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587,
+ ERROR_DS_NOT_CLOSEST = 8588,
+ ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589,
+ ERROR_DS_SINGLE_USER_MODE_FAILED = 8590,
+ ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591,
+ ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592,
+ ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593,
+ ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594,
+ ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595,
+ ERROR_DS_NO_MSDS_INTID = 8596,
+ ERROR_DS_DUP_MSDS_INTID = 8597,
+ ERROR_DS_EXISTS_IN_RDNATTID = 8598,
+ ERROR_DS_AUTHORIZATION_FAILED = 8599,
+ ERROR_DS_INVALID_SCRIPT = 8600,
+ ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601,
+ DNS_ERROR_RCODE_FORMAT_ERROR = 9001,
+ DNS_ERROR_RCODE_SERVER_FAILURE = 9002,
+ DNS_ERROR_RCODE_NAME_ERROR = 9003,
+ DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004,
+ DNS_ERROR_RCODE_REFUSED = 9005,
+ DNS_ERROR_RCODE_YXDOMAIN = 9006,
+ DNS_ERROR_RCODE_YXRRSET = 9007,
+ DNS_ERROR_RCODE_NXRRSET = 9008,
+ DNS_ERROR_RCODE_NOTAUTH = 9009,
+ DNS_ERROR_RCODE_NOTZONE = 9010,
+ DNS_ERROR_RCODE_BADSIG = 9016,
+ DNS_ERROR_RCODE_BADKEY = 9017,
+ DNS_ERROR_RCODE_BADTIME = 9018,
+ DNS_INFO_NO_RECORDS = 9501,
+ DNS_ERROR_BAD_PACKET = 9502,
+ DNS_ERROR_NO_PACKET = 9503,
+ DNS_ERROR_RCODE = 9504,
+ DNS_ERROR_UNSECURE_PACKET = 9505,
+ DNS_ERROR_INVALID_TYPE = 9551,
+ DNS_ERROR_INVALID_IP_ADDRESS = 9552,
+ DNS_ERROR_INVALID_PROPERTY = 9553,
+ DNS_ERROR_TRY_AGAIN_LATER = 9554,
+ DNS_ERROR_NOT_UNIQUE = 9555,
+ DNS_ERROR_NON_RFC_NAME = 9556,
+ DNS_STATUS_FQDN = 9557,
+ DNS_STATUS_DOTTED_NAME = 9558,
+ DNS_STATUS_SINGLE_PART_NAME = 9559,
+ DNS_ERROR_INVALID_NAME_CHAR = 9560,
+ DNS_ERROR_NUMERIC_NAME = 9561,
+ DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562,
+ DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601,
+ DNS_ERROR_NO_ZONE_INFO = 9602,
+ DNS_ERROR_INVALID_ZONE_OPERATION = 9603,
+ DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604,
+ DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605,
+ DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606,
+ DNS_ERROR_ZONE_LOCKED = 9607,
+ DNS_ERROR_ZONE_CREATION_FAILED = 9608,
+ DNS_ERROR_ZONE_ALREADY_EXISTS = 9609,
+ DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610,
+ DNS_ERROR_INVALID_ZONE_TYPE = 9611,
+ DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612,
+ DNS_ERROR_ZONE_NOT_SECONDARY = 9613,
+ DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614,
+ DNS_ERROR_WINS_INIT_FAILED = 9615,
+ DNS_ERROR_NEED_WINS_SERVERS = 9616,
+ DNS_ERROR_NBSTAT_INIT_FAILED = 9617,
+ DNS_ERROR_SOA_DELETE_INVALID = 9618,
+ DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619,
+ DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620,
+ DNS_ERROR_ZONE_IS_SHUTDOWN = 9621,
+ DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651,
+ DNS_ERROR_INVALID_DATAFILE_NAME = 9652,
+ DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653,
+ DNS_ERROR_FILE_WRITEBACK_FAILED = 9654,
+ DNS_ERROR_DATAFILE_PARSING = 9655,
+ DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701,
+ DNS_ERROR_RECORD_FORMAT = 9702,
+ DNS_ERROR_NODE_CREATION_FAILED = 9703,
+ DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704,
+ DNS_ERROR_RECORD_TIMED_OUT = 9705,
+ DNS_ERROR_NAME_NOT_IN_ZONE = 9706,
+ DNS_ERROR_CNAME_LOOP = 9707,
+ DNS_ERROR_NODE_IS_CNAME = 9708,
+ DNS_ERROR_CNAME_COLLISION = 9709,
+ DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710,
+ DNS_ERROR_RECORD_ALREADY_EXISTS = 9711,
+ DNS_ERROR_SECONDARY_DATA = 9712,
+ DNS_ERROR_NO_CREATE_CACHE_DATA = 9713,
+ DNS_ERROR_NAME_DOES_NOT_EXIST = 9714,
+ DNS_WARNING_PTR_CREATE_FAILED = 9715,
+ DNS_WARNING_DOMAIN_UNDELETED = 9716,
+ DNS_ERROR_DS_UNAVAILABLE = 9717,
+ DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718,
+ DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719,
+ DNS_INFO_AXFR_COMPLETE = 9751,
+ DNS_ERROR_AXFR = 9752,
+ DNS_INFO_ADDED_LOCAL_WINS = 9753,
+ DNS_STATUS_CONTINUE_NEEDED = 9801,
+ DNS_ERROR_NO_TCPIP = 9851,
+ DNS_ERROR_NO_DNS_SERVERS = 9852,
+ DNS_ERROR_DP_DOES_NOT_EXIST = 9901,
+ DNS_ERROR_DP_ALREADY_EXISTS = 9902,
+ DNS_ERROR_DP_NOT_ENLISTED = 9903,
+ DNS_ERROR_DP_ALREADY_ENLISTED = 9904,
+ WSAEINTR = 10004,
+ WSAEBADF = 10009,
+ WSAEACCES = 10013,
+ WSAEFAULT = 10014,
+ WSAEINVAL = 10022,
+ WSAEMFILE = 10024,
+ WSAEWOULDBLOCK = 10035,
+ WSAEINPROGRESS = 10036,
+ WSAEALREADY = 10037,
+ WSAENOTSOCK = 10038,
+ WSAEDESTADDRREQ = 10039,
+ WSAEMSGSIZE = 10040,
+ WSAEPROTOTYPE = 10041,
+ WSAENOPROTOOPT = 10042,
+ WSAEPROTONOSUPPORT = 10043,
+ WSAESOCKTNOSUPPORT = 10044,
+ WSAEOPNOTSUPP = 10045,
+ WSAEPFNOSUPPORT = 10046,
+ WSAEAFNOSUPPORT = 10047,
+ WSAEADDRINUSE = 10048,
+ WSAEADDRNOTAVAIL = 10049,
+ WSAENETDOWN = 10050,
+ WSAENETUNREACH = 10051,
+ WSAENETRESET = 10052,
+ WSAECONNABORTED = 10053,
+ WSAECONNRESET = 10054,
+ WSAENOBUFS = 10055,
+ WSAEISCONN = 10056,
+ WSAENOTCONN = 10057,
+ WSAESHUTDOWN = 10058,
+ WSAETOOMANYREFS = 10059,
+ WSAETIMEDOUT = 10060,
+ WSAECONNREFUSED = 10061,
+ WSAELOOP = 10062,
+ WSAENAMETOOLONG = 10063,
+ WSAEHOSTDOWN = 10064,
+ WSAEHOSTUNREACH = 10065,
+ WSAENOTEMPTY = 10066,
+ WSAEPROCLIM = 10067,
+ WSAEUSERS = 10068,
+ WSAEDQUOT = 10069,
+ WSAESTALE = 10070,
+ WSAEREMOTE = 10071,
+ WSASYSNOTREADY = 10091,
+ WSAVERNOTSUPPORTED = 10092,
+ WSANOTINITIALISED = 10093,
+ WSAEDISCON = 10101,
+ WSAENOMORE = 10102,
+ WSAECANCELLED = 10103,
+ WSAEINVALIDPROCTABLE = 10104,
+ WSAEINVALIDPROVIDER = 10105,
+ WSAEPROVIDERFAILEDINIT = 10106,
+ WSASYSCALLFAILURE = 10107,
+ WSASERVICE_NOT_FOUND = 10108,
+ WSATYPE_NOT_FOUND = 10109,
+ WSA_E_NO_MORE = 10110,
+ WSA_E_CANCELLED = 10111,
+ WSAEREFUSED = 10112,
+ WSAHOST_NOT_FOUND = 11001,
+ WSATRY_AGAIN = 11002,
+ WSANO_RECOVERY = 11003,
+ WSANO_DATA = 11004,
+ WSA_QOS_RECEIVERS = 11005,
+ WSA_QOS_SENDERS = 11006,
+ WSA_QOS_NO_SENDERS = 11007,
+ WSA_QOS_NO_RECEIVERS = 11008,
+ WSA_QOS_REQUEST_CONFIRMED = 11009,
+ WSA_QOS_ADMISSION_FAILURE = 11010,
+ WSA_QOS_POLICY_FAILURE = 11011,
+ WSA_QOS_BAD_STYLE = 11012,
+ WSA_QOS_BAD_OBJECT = 11013,
+ WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
+ WSA_QOS_GENERIC_ERROR = 11015,
+ WSA_QOS_ESERVICETYPE = 11016,
+ WSA_QOS_EFLOWSPEC = 11017,
+ WSA_QOS_EPROVSPECBUF = 11018,
+ WSA_QOS_EFILTERSTYLE = 11019,
+ WSA_QOS_EFILTERTYPE = 11020,
+ WSA_QOS_EFILTERCOUNT = 11021,
+ WSA_QOS_EOBJLENGTH = 11022,
+ WSA_QOS_EFLOWCOUNT = 11023,
+ WSA_QOS_EUNKNOWNPSOBJ = 11024,
+ WSA_QOS_EPOLICYOBJ = 11025,
+ WSA_QOS_EFLOWDESC = 11026,
+ WSA_QOS_EPSFLOWSPEC = 11027,
+ WSA_QOS_EPSFILTERSPEC = 11028,
+ WSA_QOS_ESDMODEOBJ = 11029,
+ WSA_QOS_ESHAPERATEOBJ = 11030,
+ WSA_QOS_RESERVED_PETYPE = 11031,
+ ERROR_IPSEC_QM_POLICY_EXISTS = 13000,
+ ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001,
+ ERROR_IPSEC_QM_POLICY_IN_USE = 13002,
+ ERROR_IPSEC_MM_POLICY_EXISTS = 13003,
+ ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004,
+ ERROR_IPSEC_MM_POLICY_IN_USE = 13005,
+ ERROR_IPSEC_MM_FILTER_EXISTS = 13006,
+ ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007,
+ ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008,
+ ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009,
+ ERROR_IPSEC_MM_AUTH_EXISTS = 13010,
+ ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011,
+ ERROR_IPSEC_MM_AUTH_IN_USE = 13012,
+ ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013,
+ ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014,
+ ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015,
+ ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016,
+ ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017,
+ ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018,
+ ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019,
+ ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020,
+ ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021,
+ ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022,
+ ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023,
+ ERROR_IPSEC_IKE_AUTH_FAIL = 13801,
+ ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802,
+ ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803,
+ ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804,
+ ERROR_IPSEC_IKE_TIMED_OUT = 13805,
+ ERROR_IPSEC_IKE_NO_CERT = 13806,
+ ERROR_IPSEC_IKE_SA_DELETED = 13807,
+ ERROR_IPSEC_IKE_SA_REAPED = 13808,
+ ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809,
+ ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810,
+ ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811,
+ ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812,
+ ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813,
+ ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814,
+ ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815,
+ ERROR_IPSEC_IKE_ERROR = 13816,
+ ERROR_IPSEC_IKE_CRL_FAILED = 13817,
+ ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818,
+ ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819,
+ ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820,
+ ERROR_IPSEC_IKE_DH_FAIL = 13822,
+ ERROR_IPSEC_IKE_INVALID_HEADER = 13824,
+ ERROR_IPSEC_IKE_NO_POLICY = 13825,
+ ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826,
+ ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827,
+ ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828,
+ ERROR_IPSEC_IKE_PROCESS_ERR = 13829,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830,
+ ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831,
+ ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832,
+ ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833,
+ ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836,
+ ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840,
+ ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841,
+ ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842,
+ ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843,
+ ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844,
+ ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845,
+ ERROR_IPSEC_IKE_INVALID_COOKIE = 13846,
+ ERROR_IPSEC_IKE_NO_PEER_CERT = 13847,
+ ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848,
+ ERROR_IPSEC_IKE_POLICY_CHANGE = 13849,
+ ERROR_IPSEC_IKE_NO_MM_POLICY = 13850,
+ ERROR_IPSEC_IKE_NOTCBPRIV = 13851,
+ ERROR_IPSEC_IKE_SECLOADFAIL = 13852,
+ ERROR_IPSEC_IKE_FAILSSPINIT = 13853,
+ ERROR_IPSEC_IKE_FAILQUERYSSP = 13854,
+ ERROR_IPSEC_IKE_SRVACQFAIL = 13855,
+ ERROR_IPSEC_IKE_SRVQUERYCRED = 13856,
+ ERROR_IPSEC_IKE_GETSPIFAIL = 13857,
+ ERROR_IPSEC_IKE_INVALID_FILTER = 13858,
+ ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859,
+ ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860,
+ ERROR_IPSEC_IKE_INVALID_POLICY = 13861,
+ ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862,
+ ERROR_IPSEC_IKE_INVALID_SITUATION = 13863,
+ ERROR_IPSEC_IKE_DH_FAILURE = 13864,
+ ERROR_IPSEC_IKE_INVALID_GROUP = 13865,
+ ERROR_IPSEC_IKE_ENCRYPT = 13866,
+ ERROR_IPSEC_IKE_DECRYPT = 13867,
+ ERROR_IPSEC_IKE_POLICY_MATCH = 13868,
+ ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869,
+ ERROR_IPSEC_IKE_INVALID_HASH = 13870,
+ ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871,
+ ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872,
+ ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873,
+ ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874,
+ ERROR_IPSEC_IKE_INVALID_SIG = 13875,
+ ERROR_IPSEC_IKE_LOAD_FAILED = 13876,
+ ERROR_IPSEC_IKE_RPC_DELETE = 13877,
+ ERROR_IPSEC_IKE_BENIGN_REINIT = 13878,
+ ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879,
+ ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881,
+ ERROR_IPSEC_IKE_MM_LIMIT = 13882,
+ ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883,
+ ERROR_IPSEC_IKE_NEG_STATUS_END = 13884,
+ ERROR_SXS_SECTION_NOT_FOUND = 14000,
+ ERROR_SXS_CANT_GEN_ACTCTX = 14001,
+ ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002,
+ ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003,
+ ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004,
+ ERROR_SXS_MANIFEST_PARSE_ERROR = 14005,
+ ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006,
+ ERROR_SXS_KEY_NOT_FOUND = 14007,
+ ERROR_SXS_VERSION_CONFLICT = 14008,
+ ERROR_SXS_WRONG_SECTION_TYPE = 14009,
+ ERROR_SXS_THREAD_QUERIES_DISABLED = 14010,
+ ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011,
+ ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012,
+ ERROR_SXS_UNKNOWN_ENCODING = 14013,
+ ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014,
+ ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015,
+ ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017,
+ ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018,
+ ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019,
+ ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020,
+ ERROR_SXS_DUPLICATE_DLL_NAME = 14021,
+ ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022,
+ ERROR_SXS_DUPLICATE_CLSID = 14023,
+ ERROR_SXS_DUPLICATE_IID = 14024,
+ ERROR_SXS_DUPLICATE_TLBID = 14025,
+ ERROR_SXS_DUPLICATE_PROGID = 14026,
+ ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027,
+ ERROR_SXS_FILE_HASH_MISMATCH = 14028,
+ ERROR_SXS_POLICY_PARSE_ERROR = 14029,
+ ERROR_SXS_XML_E_MISSINGQUOTE = 14030,
+ ERROR_SXS_XML_E_COMMENTSYNTAX = 14031,
+ ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032,
+ ERROR_SXS_XML_E_BADNAMECHAR = 14033,
+ ERROR_SXS_XML_E_BADCHARINSTRING = 14034,
+ ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035,
+ ERROR_SXS_XML_E_BADCHARDATA = 14036,
+ ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037,
+ ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038,
+ ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039,
+ ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040,
+ ERROR_SXS_XML_E_INTERNALERROR = 14041,
+ ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042,
+ ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043,
+ ERROR_SXS_XML_E_MISSING_PAREN = 14044,
+ ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045,
+ ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046,
+ ERROR_SXS_XML_E_INVALID_DECIMAL = 14047,
+ ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048,
+ ERROR_SXS_XML_E_INVALID_UNICODE = 14049,
+ ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050,
+ ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051,
+ ERROR_SXS_XML_E_UNCLOSEDTAG = 14052,
+ ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053,
+ ERROR_SXS_XML_E_MULTIPLEROOTS = 14054,
+ ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055,
+ ERROR_SXS_XML_E_BADXMLDECL = 14056,
+ ERROR_SXS_XML_E_MISSINGROOT = 14057,
+ ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058,
+ ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059,
+ ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060,
+ ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061,
+ ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062,
+ ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063,
+ ERROR_SXS_XML_E_UNCLOSEDDECL = 14064,
+ ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065,
+ ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066,
+ ERROR_SXS_XML_E_INVALIDENCODING = 14067,
+ ERROR_SXS_XML_E_INVALIDSWITCH = 14068,
+ ERROR_SXS_XML_E_BADXMLCASE = 14069,
+ ERROR_SXS_XML_E_INVALID_STANDALONE = 14070,
+ ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071,
+ ERROR_SXS_XML_E_INVALID_VERSION = 14072,
+ ERROR_SXS_XML_E_MISSINGEQUALS = 14073,
+ ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074,
+ ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075,
+ ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076,
+ ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077,
+ ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078,
+ ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080
+ }
+}
diff --git a/mcs/class/System/System.IO/NotifyFilters.cs b/mcs/class/System/System.IO/NotifyFilters.cs
new file mode 100644
index 00000000000..17ae0951563
--- /dev/null
+++ b/mcs/class/System/System.IO/NotifyFilters.cs
@@ -0,0 +1,25 @@
+//
+// System.IO.NotifyFilters.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ [Flags]
+ [Serializable]
+ public enum NotifyFilters {
+ Attributes = 4,
+ CreationTime = 64,
+ DirectoryName = 2,
+ FileName = 1,
+ LastAccess = 32,
+ LastWrite = 16,
+ Security = 256,
+ Size = 8
+ }
+}
diff --git a/mcs/class/System/System.IO/RenamedEventArgs.cs b/mcs/class/System/System.IO/RenamedEventArgs.cs
new file mode 100644
index 00000000000..134dca7a4b1
--- /dev/null
+++ b/mcs/class/System/System.IO/RenamedEventArgs.cs
@@ -0,0 +1,44 @@
+//
+// System.IO.RenamedEventArgs.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ public class RenamedEventArgs : FileSystemEventArgs {
+
+ #region Fields
+
+ string oldName;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public RenamedEventArgs (WatcherChangeTypes changeType, string directory, string name, string oldName)
+ : base (changeType, directory, name)
+ {
+ this.oldName = oldName;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public string OldFullPath {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public string OldName {
+ get { return oldName; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System/System.IO/RenamedEventHandler.cs b/mcs/class/System/System.IO/RenamedEventHandler.cs
new file mode 100644
index 00000000000..50b28412391
--- /dev/null
+++ b/mcs/class/System/System.IO/RenamedEventHandler.cs
@@ -0,0 +1,15 @@
+//
+// System.IO.FileSystemEventHandler.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ [Serializable]
+ public delegate void RenamedEventHandler (object sender, RenamedEventArgs e);
+}
diff --git a/mcs/class/System/System.IO/WaitForChangedResult.cs b/mcs/class/System/System.IO/WaitForChangedResult.cs
new file mode 100644
index 00000000000..e2e33cd95d7
--- /dev/null
+++ b/mcs/class/System/System.IO/WaitForChangedResult.cs
@@ -0,0 +1,48 @@
+//
+// System.IO.WaitForChangedResult.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ public struct WaitForChangedResult {
+
+ #region Fields
+
+ WatcherChangeTypes changeType;
+ string name;
+ string oldName;
+ bool timedOut;
+
+ #endregion // Fields
+
+ #region Properties
+
+ public WatcherChangeTypes ChangeType {
+ get { return changeType; }
+ set { changeType = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string OldName {
+ get { return oldName; }
+ set { oldName = value; }
+ }
+
+ public bool TimedOut {
+ get { return timedOut; }
+ set { timedOut = value; }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System/System.IO/WatcherChangeTypes.cs b/mcs/class/System/System.IO/WatcherChangeTypes.cs
new file mode 100644
index 00000000000..cb4d175dd9c
--- /dev/null
+++ b/mcs/class/System/System.IO/WatcherChangeTypes.cs
@@ -0,0 +1,22 @@
+//
+// System.IO.WatcherChangeTypes.cs
+//
+// Author:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.IO {
+ [Flags]
+ [Serializable]
+ public enum WatcherChangeTypes {
+ All = 0xF,
+ Changed = 4,
+ Created = 1,
+ Deleted = 2,
+ Renamed = 8
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/AddressFamily.cs b/mcs/class/System/System.Net.Sockets/AddressFamily.cs
new file mode 100644
index 00000000000..c53fd8835b1
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/AddressFamily.cs
@@ -0,0 +1,50 @@
+// AddressFamily.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:59 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ [Serializable]
+ public enum AddressFamily {
+ Unknown = -1,
+ Unspecified = 0,
+ Unix = 1,
+ InterNetwork = 2,
+ ImpLink = 3,
+ Pup = 4,
+ Chaos = 5,
+ NS = 6,
+ Ipx = 6,
+ Iso = 7,
+ Osi = 7,
+ Ecma = 8,
+ DataKit = 9,
+ Ccitt = 10,
+ Sna = 11,
+ DecNet = 12,
+ DataLink = 13,
+ Lat = 14,
+ HyperChannel = 15,
+ AppleTalk = 16,
+ NetBios = 17,
+ VoiceView = 18,
+ FireFox = 19,
+ Banyan = 21,
+ Atm = 22,
+ InterNetworkV6 = 23,
+ Cluster = 24,
+ Ieee12844 = 25,
+ Irda = 26,
+ NetworkDesigners = 28,
+ Max = 29,
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog
new file mode 100644
index 00000000000..2bc6584d6a9
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/ChangeLog
@@ -0,0 +1,107 @@
+2003-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UdpClient.cs: fixed bug #36226.
+
+2002-11-13 Dick Porter <dick@ximian.com>
+
+ * Socket.cs: Only close the socket in one place, ie the Dispose
+ method. Fixes bug 32054.
+
+2002-11-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Socket.cs: offset == size == 0 it's ok in Send ().
+
+2002-11-03 Phillip Pearson <pp@myelin.co.nz>
+
+ * TcpClient.cs: Fixed SetTcpClient() to pass through to the Client
+ property, which now sets stream to null (it's set by GetStream()). This
+ should make GetStream() work on a TcpClient which has had the socket set
+ by assignment to the Client property, not only one that has been created
+ by TcpListener.AcceptTcpClient().
+
+2002-10-08 Dick Porter <dick@ximian.com>
+
+ * Socket.cs:
+ * NetworkStream.cs: Bounds checking fixes, and better exception
+ texts. Changes by timothyjmills@hotmail.com (Timothy J. Mills).
+
+2002-10-03 Dick Porter <dick@ximian.com>
+
+ * TcpClient.cs: NoDelay is a TCP option, not Socket
+
+2002-09-16 Miguel de Icaza <miguel@ximian.com>
+
+ * SocketFlags.cs: Add missing enumeration.
+
+ * UdpClient.cs: Make Dispose private.
+
+2002-08-20 Dick Porter <dick@ximian.com>
+
+ * Socket.cs: Fix deadlock when the AsyncResult callback calls
+ End*(). Set the async request's worker property so it can return
+ results. These two fixes combined fix bug 28092.
+
+2002-06-24 Dick Porter <dick@ximian.com>
+
+ * Socket.cs: Make SetSocketOption cope with boolean values (they
+ are passed as objects, not the ints the runtime was expecting)
+
+2002-05-17 Lawrence Pit <loz@cable.a2000.nl>
+ * TcpListener.cs: Renamed LocalEndPoint to LocalEndpoint
+ * NetworkStream.cs, UdpClient.cs and TcpClient.cs: modified disposable
+ routines, added checks for disposed state.
+ * UdpClient.cs: commented out GetHashCode and Equals as it's not
+ overriden in ms.net implementation.
+
+2002-05-17 Jaroslaw Kowalski <jarek@atm.com.pl>
+ * TcpClient.cs: fixed SetTcpClient so that
+ TcpListener.AcceptTcpClient works and allows
+ you to call GetStream() on its result
+
+2002-04-24 Dick Porter <dick@ximian.com>
+
+ * Socket.cs (Poll): Give correct argument to Select(), as spotted
+ by Jaroslaw Kowalski <jarek@atm.com.pl>
+
+2002-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UdpClient.cs: implemented.
+
+2002-04-02 Dick Porter <dick@ximian.com>
+
+ * TcpListener.cs: in Start(), set the socket listen backlog value
+ to a sane value (noticed by Jonathan Stowe <gellyfish@gellyfish.com>)
+
+2002-02-13 Dick Porter <dick@ximian.com>
+
+ * Socket.cs: Implemenent Select, Blocking, Connected,
+ GetSocketOption, Poll, SetSocketOption and Shutdown
+
+ * MulticastOption.cs:
+ * LingerOption.cs: Delete override methods that don't need to be
+ implemented
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * NetworkStream.cs: Implement class.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * SocketException.cs: Implemented
+
+ * Socket.cs: Implemented most methods
+
+ * LingerOption.cs: Made compile
+
+ * AddressFamily.cs: Removed empty auto-generated comments
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * SocketException.cs: Reimplemented.
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * ChangeLog : Add to this directory.
+
+ * SocketException.cs, TcpClient.cs, TcpListener.cs : MonoTODO
+ attribute decoration.
diff --git a/mcs/class/System/System.Net.Sockets/LingerOption.cs b/mcs/class/System/System.Net.Sockets/LingerOption.cs
new file mode 100644
index 00000000000..4c6117f5035
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/LingerOption.cs
@@ -0,0 +1,42 @@
+//
+// System.Net.Sockets.LingerOption.cs
+//
+// Author:
+// Andrew Sutton
+//
+// (C) Andrew Sutton
+//
+
+using System;
+
+namespace System.Net.Sockets
+{
+ // <remarks>
+ // Encapsulates a linger option.
+ // </remarks>
+ public class LingerOption
+ {
+ // Don't change the names of these fields without also
+ // changing socket-io.c in the runtime
+ private bool enabled;
+ protected int seconds;
+
+ public LingerOption (bool enable, int secs)
+ {
+ enabled = enable;
+ seconds = secs;
+ }
+
+ public bool Enabled
+ {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public int LingerTime
+ {
+ get { return seconds; }
+ set { seconds = value; }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/MulticastOption.cs b/mcs/class/System/System.Net.Sockets/MulticastOption.cs
new file mode 100644
index 00000000000..759cd48f314
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/MulticastOption.cs
@@ -0,0 +1,48 @@
+//
+// System.Net.Sockets.MulticastOption.cs
+//
+// Author:
+// Andrew Sutton
+//
+// (C) Andrew Sutton
+//
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ // <remarks>
+ // Encapsulates a multicast option
+ // </remarks>
+ public class MulticastOption
+ {
+ // Don't change the names of these fields without also
+ // changing socket-io.c in the runtime
+ private IPAddress group;
+ protected IPAddress local;
+
+ public MulticastOption (IPAddress grp)
+ {
+ group = grp;
+ }
+
+ public MulticastOption (IPAddress grp, IPAddress addr)
+ {
+ group = grp;
+ local = addr;
+ }
+
+ public IPAddress Group
+ {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public IPAddress LocalAddress
+ {
+ get { return local; }
+ set { local = value; }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/NetworkStream.cs b/mcs/class/System/System.Net.Sockets/NetworkStream.cs
new file mode 100644
index 00000000000..ea74bb6e254
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/NetworkStream.cs
@@ -0,0 +1,324 @@
+//
+// System.Net.Sockets.NetworkStream.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+
+namespace System.Net.Sockets
+{
+ public class NetworkStream : Stream, IDisposable {
+ FileAccess access;
+ Socket socket;
+ bool owns_socket;
+ bool readable, writeable;
+ bool disposed = false;
+
+ public NetworkStream (Socket socket)
+ : this (socket, FileAccess.ReadWrite, false)
+ {
+ }
+
+ public NetworkStream (Socket socket, bool owns_socket)
+ : this (socket, FileAccess.ReadWrite, owns_socket)
+ {
+ }
+
+ public NetworkStream (Socket socket, FileAccess access)
+ : this (socket, access, false)
+ {
+ }
+
+ public NetworkStream (Socket socket, FileAccess access, bool owns_socket)
+ {
+ if (socket == null)
+ throw new ArgumentNullException ("socket is null");
+ if (!socket.Connected)
+ throw new ArgumentException ("Not connected", "socket");
+ if (socket.SocketType != SocketType.Stream)
+ throw new ArgumentException ("Socket is not of type Stream", "socket");
+ if (!socket.Blocking)
+ throw new IOException ();
+
+ this.socket = socket;
+ this.owns_socket = owns_socket;
+ this.access = access;
+
+ readable = CanRead;
+ writeable = CanWrite;
+ }
+
+ public override bool CanRead {
+ get {
+ return access == FileAccess.ReadWrite || access == FileAccess.Read;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ // network sockets cant seek.
+ return false;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return access == FileAccess.ReadWrite || access == FileAccess.Write;
+ }
+ }
+
+ public virtual bool DataAvailable {
+ get {
+ try {
+ return socket.Available > 0;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+ }
+
+ public override long Length {
+ get {
+ // Network sockets always throw an exception
+ throw new NotSupportedException ();
+ }
+ }
+
+ public override long Position {
+ get {
+ // Network sockets always throw an exception
+ throw new NotSupportedException ();
+ }
+
+ set {
+ // Network sockets always throw an exception
+ throw new NotSupportedException ();
+ }
+ }
+
+ protected bool Readable {
+ get {
+ return readable;
+ }
+
+ set {
+ readable = value;
+ }
+ }
+
+ protected Socket Socket {
+ get {
+ return socket;
+ }
+ }
+
+ protected bool Writeable {
+ get {
+ return writeable;
+ }
+
+ set {
+ writeable = value;
+ }
+ }
+
+ public override IAsyncResult BeginRead (byte [] buffer, int offset, int size,
+ AsyncCallback callback, object state)
+ {
+ try {
+ IAsyncResult retval;
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer is null");
+ int len = buffer.Length;
+ if(offset<0 || offset>=len) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size<0 || offset+size>len) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ try {
+ retval = socket.BeginReceive (buffer, offset, size, 0, callback, state);
+ } catch {
+ throw new IOException ("BeginReceive failure");
+ }
+
+ return retval;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public override IAsyncResult BeginWrite (byte [] buffer, int offset, int size,
+ AsyncCallback callback, object state)
+ {
+ try {
+ IAsyncResult retval;
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer is null");
+
+ int len = buffer.Length;
+ if(offset<0 || offset>=len) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size<0 || offset+size>len) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ try {
+ retval = socket.BeginSend (buffer, offset, size, 0, callback, state);
+ } catch {
+ throw new IOException ("BeginWrite failure");
+ }
+
+ return retval;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ ~NetworkStream ()
+ {
+ Dispose (false);
+ }
+
+ public override void Close ()
+ {
+ ((IDisposable) this).Dispose ();
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposed)
+ return;
+ disposed = true;
+
+ if (owns_socket) {
+ Socket s = socket;
+ if (s != null)
+ s.Close ();
+ }
+ socket = null;
+ }
+
+ public override int EndRead (IAsyncResult ar)
+ {
+ try {
+ int res;
+
+ if (ar == null)
+ throw new ArgumentNullException ("async result is null");
+
+ try {
+ res = socket.EndReceive (ar);
+ } catch {
+ throw new IOException ("EndRead failure");
+ }
+ return res;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public override void EndWrite (IAsyncResult ar)
+ {
+ try {
+ if (ar == null)
+ throw new ArgumentNullException ("async result is null");
+
+ try {
+ socket.EndSend (ar);
+ } catch {
+ throw new IOException ("EndWrite failure");
+ }
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public override void Flush ()
+ {
+ // network streams are non-buffered, this is a no-op
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public override int Read (byte [] buffer, int offset, int size)
+ {
+ try {
+ int res;
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer is null");
+ if(offset<0 || offset>=buffer.Length) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size < 0 || offset+size>buffer.Length) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ try {
+ res = socket.Receive (buffer, offset, size, 0);
+ } catch {
+ throw new IOException ("Read failure");
+ }
+ return res;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ // NetworkStream objects do not support seeking.
+
+ throw new NotSupportedException ();
+ }
+
+ public override void SetLength (long value)
+ {
+ // NetworkStream objects do not support SetLength
+
+ throw new NotSupportedException ();
+ }
+
+ public override void Write (byte [] buffer, int offset, int size)
+ {
+ try {
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer is null");
+ if(offset<0 || offset>=buffer.Length) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size<0 || offset+size>buffer.Length) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ try {
+ socket.Send (buffer, offset, size, 0);
+ } catch {
+ throw new IOException ("Write failure");
+ }
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ private void CheckDisposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException (GetType().FullName);
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/ProtocolFamily.cs b/mcs/class/System/System.Net.Sockets/ProtocolFamily.cs
new file mode 100644
index 00000000000..cf6d59acfc2
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/ProtocolFamily.cs
@@ -0,0 +1,47 @@
+//
+// System.Net.Sockets.ProtocolFamily.cs
+//
+// Author:
+// Andrew Sutton
+//
+// (C) Andrew Sutton
+//
+
+namespace System.Net.Sockets
+{
+ public enum ProtocolFamily
+ {
+ Unknown = -1,
+ Unspecified = 0,
+ Unix,
+ InterNetwork,
+ ImpLink,
+ Pup,
+ Chaos,
+ Ipx,
+ Iso,
+ Ecma,
+ DataKit,
+ Ccitt,
+ Sna,
+ DecNet,
+ DataLink,
+ Lat,
+ HyperChannel,
+ AppleTalk,
+ NetBios,
+ VoiceView,
+ FireFox,
+ Banyan = 0x15,
+ Atm,
+ InterNetworkV6,
+ Cluster,
+ Ieee12844,
+ Irda,
+ NetworkDesigners = 0x1c,
+ Max,
+
+ NS = Ipx,
+ Osi = Iso,
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/ProtocolType.cs b/mcs/class/System/System.Net.Sockets/ProtocolType.cs
new file mode 100644
index 00000000000..0b106e5f946
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/ProtocolType.cs
@@ -0,0 +1,81 @@
+// ProtocolType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:24 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ProtocolType {
+
+ /// <summary>
+ /// </summary>
+ IP = 0,
+
+ /// <summary>
+ /// </summary>
+ Icmp = 1,
+
+ /// <summary>
+ /// </summary>
+ Igmp = 2,
+
+ /// <summary>
+ /// </summary>
+ Ggp = 3,
+
+ /// <summary>
+ /// </summary>
+ Tcp = 6,
+
+ /// <summary>
+ /// </summary>
+ Pup = 12,
+
+ /// <summary>
+ /// </summary>
+ Udp = 17,
+
+ /// <summary>
+ /// </summary>
+ Idp = 22,
+
+ /// <summary>
+ /// </summary>
+ ND = 77,
+
+ /// <summary>
+ /// </summary>
+ Raw = 255,
+
+ /// <summary>
+ /// </summary>
+ Unspecified = 0,
+
+ /// <summary>
+ /// </summary>
+ Ipx = 1000,
+
+ /// <summary>
+ /// </summary>
+ Spx = 1256,
+
+ /// <summary>
+ /// </summary>
+ SpxII = 1257,
+
+ /// <summary>
+ /// </summary>
+ Unknown = -1,
+ } // ProtocolType
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SelectMode.cs b/mcs/class/System/System.Net.Sockets/SelectMode.cs
new file mode 100644
index 00000000000..587f2a1d1b6
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SelectMode.cs
@@ -0,0 +1,33 @@
+// SelectMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:30 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SelectMode {
+
+ /// <summary>
+ /// </summary>
+ SelectRead = 0,
+
+ /// <summary>
+ /// </summary>
+ SelectWrite = 1,
+
+ /// <summary>
+ /// </summary>
+ SelectError = 2,
+ } // SelectMode
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs
new file mode 100644
index 00000000000..36086ef24b5
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/Socket.cs
@@ -0,0 +1,983 @@
+// System.Net.Sockets.Socket.cs
+//
+// Authors:
+// Phillip Pearson (pp@myelin.co.nz)
+// Dick Porter <dick@ximian.com>
+//
+// Copyright (C) 2001, 2002 Phillip Pearson and Ximian, Inc.
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+namespace System.Net.Sockets
+{
+ public class Socket : IDisposable
+ {
+ private sealed class SocketAsyncResult: IAsyncResult
+ {
+ private object state;
+ private WaitHandle waithandle;
+ private bool completed_sync, completed;
+ private Worker worker;
+
+ public SocketAsyncResult(object state) {
+ this.state=state;
+ waithandle=new ManualResetEvent(false);
+ completed_sync=completed=false;
+ }
+
+ public object AsyncState {
+ get {
+ return(state);
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ get {
+ return(waithandle);
+ }
+ set {
+ waithandle=value;
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get {
+ return(completed_sync);
+ }
+ }
+
+ public bool IsCompleted {
+ get {
+ return(completed);
+ }
+ set {
+ completed=value;
+ }
+ }
+
+ public Worker Worker {
+ get {
+ return(worker);
+ }
+ set {
+ worker=value;
+ }
+ }
+ }
+
+ private sealed class Worker
+ {
+ private AsyncCallback callback;
+ private SocketAsyncResult result;
+ private Socket socket;
+
+ // Parameters
+ private EndPoint endpoint; // Connect,ReceiveFrom,SendTo
+ private byte[] buffer; // Receive,ReceiveFrom,Send,SendTo
+ private int offset; // Receive,ReceiveFrom,Send,SendTo
+ private int size; // Receive,ReceiveFrom,Send,SendTo
+ private SocketFlags sockflags; // Receive,ReceiveFrom,Send,SendTo
+
+ // Return values
+ private Socket acc_socket;
+ private int total;
+
+
+ // For Accept
+ public Worker(Socket req_sock,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result)
+ : this(req_sock, null, 0, 0, SocketFlags.None,
+ null, req_callback, req_result) {}
+
+ // For Connect
+ public Worker(Socket req_sock, EndPoint req_endpoint,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result)
+ : this(req_sock, null, 0, 0, SocketFlags.None,
+ req_endpoint, req_callback,
+ req_result) {}
+
+ // For Receive and Send
+ public Worker(Socket req_sock, byte[] req_buffer,
+ int req_offset, int req_size,
+ SocketFlags req_sockflags,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result)
+ : this(req_sock, req_buffer, req_offset,
+ req_size, req_sockflags, null,
+ req_callback, req_result) {}
+
+ // For ReceiveFrom and SendTo
+ public Worker(Socket req_sock, byte[] req_buffer,
+ int req_offset, int req_size,
+ SocketFlags req_sockflags,
+ EndPoint req_endpoint,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result) {
+ socket=req_sock;
+ buffer=req_buffer;
+ offset=req_offset;
+ size=req_size;
+ sockflags=req_sockflags;
+ endpoint=req_endpoint;
+ callback=req_callback;
+ result=req_result;
+ }
+
+ private void End() {
+ ((ManualResetEvent)result.AsyncWaitHandle).Set();
+ callback(result);
+ result.IsCompleted=true;
+ }
+
+ public void Accept() {
+ lock(result) {
+ acc_socket=socket.Accept();
+ End();
+ }
+ }
+
+ public void Connect() {
+ lock(result) {
+ socket.Connect(endpoint);
+ End();
+ }
+ }
+
+ public void Receive() {
+ lock(result) {
+ total=socket.Receive(buffer, offset,
+ size, sockflags);
+ End();
+ }
+ }
+
+ public void ReceiveFrom() {
+ lock(result) {
+ total=socket.ReceiveFrom(buffer,
+ offset, size,
+ sockflags,
+ ref endpoint);
+ End();
+ }
+ }
+
+ public void Send() {
+ lock(result) {
+ total=socket.Send(buffer, offset, size,
+ sockflags);
+ End();
+ }
+ }
+
+ public void SendTo() {
+ lock(result) {
+ total=socket.SendTo(buffer, offset,
+ size, sockflags,
+ endpoint);
+ End();
+ }
+ }
+
+ public EndPoint EndPoint {
+ get {
+ return(endpoint);
+ }
+ }
+
+ public Socket Socket {
+ get {
+ return(acc_socket);
+ }
+ }
+
+ public int Total {
+ get {
+ return(total);
+ }
+ }
+ }
+
+ /* the field "socket" is looked up by name by the runtime */
+ private IntPtr socket;
+ private AddressFamily address_family;
+ private SocketType socket_type;
+ private ProtocolType protocol_type;
+ private bool blocking=true;
+
+ /* When true, the socket was connected at the time of
+ * the last IO operation
+ */
+ private bool connected=false;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Select_internal(ref Socket[] read,
+ ref Socket[] write,
+ ref Socket[] err,
+ int timeout);
+
+ public static void Select(IList read_list, IList write_list,
+ IList err_list, int time_us) {
+ if(read_list==null &&
+ write_list==null &&
+ err_list==null) {
+ throw new ArgumentNullException();
+ }
+
+ int read_count, write_count, err_count;
+
+ if(read_list!=null) {
+ read_count=read_list.Count;
+ } else {
+ read_count=0;
+ }
+
+ if(write_list!=null) {
+ write_count=write_list.Count;
+ } else {
+ write_count=0;
+ }
+
+ if(err_list!=null) {
+ err_count=err_list.Count;
+ } else {
+ err_count=0;
+ }
+
+ Socket[] read_arr=new Socket[read_count];
+ Socket[] write_arr=new Socket[write_count];
+ Socket[] err_arr=new Socket[err_count];
+
+ int i;
+
+ if(read_list!=null) {
+ i=0;
+
+ foreach (Socket s in read_list) {
+ read_arr[i]=s;
+ i++;
+ }
+ }
+
+ if(write_list!=null) {
+ i=0;
+ foreach (Socket s in write_list) {
+ write_arr[i]=s;
+ i++;
+ }
+ }
+
+ if(err_list!=null) {
+ i=0;
+ foreach (Socket s in err_list) {
+ err_arr[i]=s;
+ i++;
+ }
+ }
+
+ Select_internal(ref read_arr, ref write_arr,
+ ref err_arr, time_us);
+
+ if(read_list!=null) {
+ read_list.Clear();
+ for(i=0; i<read_arr.Length; i++) {
+ read_list.Add(read_arr[i]);
+ }
+ }
+
+ if(write_list!=null) {
+ write_list.Clear();
+ for(i=0; i<write_arr.Length; i++) {
+ write_list.Add(write_arr[i]);
+ }
+ }
+
+ if(err_list!=null) {
+ err_list.Clear();
+ for(i=0; i<err_arr.Length; i++) {
+ err_list.Add(err_arr[i]);
+ }
+ }
+ }
+
+ // private constructor used by Accept, which already
+ // has a socket handle to use
+ private Socket(AddressFamily family, SocketType type,
+ ProtocolType proto, IntPtr sock) {
+ address_family=family;
+ socket_type=type;
+ protocol_type=proto;
+
+ socket=sock;
+ connected=true;
+ }
+
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern IntPtr Socket_internal(AddressFamily family,
+ SocketType type,
+ ProtocolType proto);
+
+ public Socket(AddressFamily family, SocketType type,
+ ProtocolType proto) {
+ address_family=family;
+ socket_type=type;
+ protocol_type=proto;
+
+ socket=Socket_internal(family, type, proto);
+ }
+
+ public AddressFamily AddressFamily {
+ get {
+ return(address_family);
+ }
+ }
+
+ // Returns the amount of data waiting to be read on socket
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Available_internal(IntPtr socket);
+
+ public int Available {
+ get {
+ return(Available_internal(socket));
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Blocking_internal(IntPtr socket,
+ bool block);
+
+ public bool Blocking {
+ get {
+ return(blocking);
+ }
+ set {
+ Blocking_internal(socket, value);
+ blocking=value;
+ }
+ }
+
+ public bool Connected {
+ get {
+ return(connected);
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return(socket);
+ }
+ }
+
+ // Returns the local endpoint details in addr and port
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static SocketAddress LocalEndPoint_internal(IntPtr socket);
+
+ [MonoTODO("Support non-IP endpoints")]
+ public EndPoint LocalEndPoint {
+ get {
+ SocketAddress sa;
+
+ sa=LocalEndPoint_internal(socket);
+
+ if(sa.Family==AddressFamily.InterNetwork) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ return new IPEndPoint(0, 0).Create(sa);
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public ProtocolType ProtocolType {
+ get {
+ return(protocol_type);
+ }
+ }
+
+ // Returns the remote endpoint details in addr and port
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static SocketAddress RemoteEndPoint_internal(IntPtr socket);
+
+ [MonoTODO("Support non-IP endpoints")]
+ public EndPoint RemoteEndPoint {
+ get {
+ SocketAddress sa;
+
+ sa=RemoteEndPoint_internal(socket);
+
+ if(sa.Family==AddressFamily.InterNetwork) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ return new IPEndPoint(0, 0).Create(sa);
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public SocketType SocketType {
+ get {
+ return(socket_type);
+ }
+ }
+
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static IntPtr Accept_internal(IntPtr sock);
+
+ public Socket Accept() {
+ IntPtr sock=Accept_internal(socket);
+
+ return(new Socket(this.AddressFamily, this.SocketType,
+ this.ProtocolType, sock));
+ }
+
+ public IAsyncResult BeginAccept(AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, callback, req);
+ req.Worker=worker;
+ Thread child=new Thread(new ThreadStart(worker.Accept));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginConnect(EndPoint end_point,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, end_point, callback,
+ req);
+ req.Worker=worker;
+ Thread child=new Thread(new ThreadStart(worker.Connect));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginReceive(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, callback, req);
+ req.Worker=worker;
+ Thread child=new Thread(new ThreadStart(worker.Receive));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginReceiveFrom(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ ref EndPoint remote_end,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, remote_end,
+ callback, req);
+ req.Worker=worker;
+ Thread child=new Thread(new ThreadStart(worker.ReceiveFrom));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginSend(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, callback, req);
+ req.Worker=worker;
+ Thread child=new Thread(new ThreadStart(worker.Send));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginSendTo(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ EndPoint remote_end,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, remote_end,
+ callback, req);
+ req.Worker=worker;
+ Thread child=new Thread(new ThreadStart(worker.SendTo));
+ child.Start();
+ return(req);
+ }
+
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Bind_internal(IntPtr sock,
+ SocketAddress sa);
+
+ public void Bind(EndPoint local_end) {
+ if(local_end==null) {
+ throw new ArgumentNullException();
+ }
+
+ Bind_internal(socket, local_end.Serialize());
+ }
+
+ // Closes the socket
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Close_internal(IntPtr socket);
+
+ public void Close() {
+ this.Dispose();
+ }
+
+ // Connects to the remote address
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Connect_internal(IntPtr sock,
+ SocketAddress sa);
+
+ public void Connect(EndPoint remote_end) {
+ if(remote_end==null) {
+ throw new ArgumentNullException();
+ }
+
+ Connect_internal(socket, remote_end.Serialize());
+ connected=true;
+ }
+
+ public Socket EndAccept(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Socket);
+ }
+
+ public void EndConnect(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ }
+
+ public int EndReceive(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Total);
+ }
+
+ public int EndReceiveFrom(IAsyncResult result,
+ ref EndPoint end_point) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ end_point=req.Worker.EndPoint;
+ return(req.Worker.Total);
+ }
+
+ public int EndSend(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Total);
+ }
+
+ public int EndSendTo(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Total);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void GetSocketOption_obj_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, out object obj_val);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void GetSocketOption_arr_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, ref byte[] byte_val);
+
+ public object GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name) {
+ object obj_val;
+
+ GetSocketOption_obj_internal(socket, level, name,
+ out obj_val);
+
+ if(name==SocketOptionName.Linger) {
+ return((LingerOption)obj_val);
+ } else if (name==SocketOptionName.AddMembership ||
+ name==SocketOptionName.DropMembership) {
+ return((MulticastOption)obj_val);
+ } else {
+ return((int)obj_val);
+ }
+ }
+
+ public void GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ byte[] opt_value) {
+ int opt_value_len=opt_value.Length;
+
+ GetSocketOption_arr_internal(socket, level, name,
+ ref opt_value);
+ }
+
+ public byte[] GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ int length) {
+ byte[] byte_val=new byte[length];
+
+ GetSocketOption_arr_internal(socket, level, name,
+ ref byte_val);
+
+ return(byte_val);
+ }
+
+ [MonoTODO("Totally undocumented")]
+ public int IOControl(int ioctl_code, byte[] in_value,
+ byte[] out_value) {
+ throw new NotImplementedException();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Listen_internal(IntPtr sock,
+ int backlog);
+
+ public void Listen(int backlog) {
+ Listen_internal(socket, backlog);
+ }
+
+ /* The docs for Poll() are a bit lightweight too, but
+ * it seems to be just a simple wrapper around Select.
+ */
+ public bool Poll(int time_us, SelectMode mode) {
+ ArrayList socketlist=new ArrayList(1);
+
+ socketlist.Add(this);
+
+ switch(mode) {
+ case SelectMode.SelectError:
+ Select(null, null, socketlist, time_us);
+ break;
+ case SelectMode.SelectRead:
+ Select(socketlist, null, null, time_us);
+ break;
+ case SelectMode.SelectWrite:
+ Select(null, socketlist, null, time_us);
+ break;
+ default:
+ throw new NotSupportedException();
+ }
+
+ if(socketlist.Contains(this)) {
+ return(true);
+ } else {
+ return(false);
+ }
+ }
+
+ public int Receive(byte[] buf) {
+ return(Receive(buf, 0, buf.Length, SocketFlags.None));
+ }
+
+ public int Receive(byte[] buf, SocketFlags flags) {
+ return(Receive(buf, 0, buf.Length, flags));
+ }
+
+ public int Receive(byte[] buf, int size, SocketFlags flags) {
+ return(Receive(buf, 0, size, flags));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Receive_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags);
+
+ public int Receive(byte[] buf, int offset, int size,
+ SocketFlags flags) {
+ if(buf==null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if(offset<0 || offset >= buf.Length) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size<0 || offset+size > buf.Length) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ int ret;
+
+ try {
+ ret=Receive_internal(socket, buf, offset,
+ size, flags);
+ } catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ return(ret);
+ }
+
+ public int ReceiveFrom(byte[] buf, ref EndPoint remote_end) {
+ return(ReceiveFrom(buf, 0, buf.Length,
+ SocketFlags.None, ref remote_end));
+ }
+
+ public int ReceiveFrom(byte[] buf, SocketFlags flags,
+ ref EndPoint remote_end) {
+ return(ReceiveFrom(buf, 0, buf.Length, flags,
+ ref remote_end));
+ }
+
+ public int ReceiveFrom(byte[] buf, int size, SocketFlags flags,
+ ref EndPoint remote_end) {
+ return(ReceiveFrom(buf, 0, size, flags,
+ ref remote_end));
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int RecvFrom_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ ref SocketAddress sockaddr);
+
+ public int ReceiveFrom(byte[] buf, int offset, int size,
+ SocketFlags flags,
+ ref EndPoint remote_end) {
+ if(buf==null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if(remote_end==null) {
+ throw new ArgumentNullException("remote endpoint is null");
+ }
+ if(offset<0 || offset>=buf.Length) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size<0 || offset+size>buf.Length) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ SocketAddress sockaddr=remote_end.Serialize();
+ int count;
+
+ try {
+ count=RecvFrom_internal(socket, buf, offset,
+ size, flags,
+ ref sockaddr);
+ } catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ remote_end=remote_end.Create(sockaddr);
+
+ return(count);
+ }
+
+ public int Send(byte[] buf) {
+ return(Send(buf, 0, buf.Length, SocketFlags.None));
+ }
+
+ public int Send(byte[] buf, SocketFlags flags) {
+ return(Send(buf, 0, buf.Length, flags));
+ }
+
+ public int Send(byte[] buf, int size, SocketFlags flags) {
+ return(Send(buf, 0, size, flags));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Send_internal(IntPtr sock,
+ byte[] buf, int offset,
+ int count,
+ SocketFlags flags);
+
+ public int Send (byte[] buf, int offset, int size, SocketFlags flags)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0 || offset > buf.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (size < 0 || offset + size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ if (size == 0)
+ return 0;
+
+ int ret;
+
+ try {
+ ret = Send_internal (socket, buf, offset, size, flags);
+ } catch (SocketException) {
+ connected = false;
+ throw;
+ }
+ connected = true;
+
+ return ret;
+ }
+
+ public int SendTo(byte[] buffer, EndPoint remote_end) {
+ return(SendTo(buffer, 0, buffer.Length,
+ SocketFlags.None, remote_end));
+ }
+
+ public int SendTo(byte[] buffer, SocketFlags flags,
+ EndPoint remote_end) {
+ return(SendTo(buffer, 0, buffer.Length, flags,
+ remote_end));
+ }
+
+ public int SendTo(byte[] buffer, int size, SocketFlags flags,
+ EndPoint remote_end) {
+ return(SendTo(buffer, size, buffer.Length, flags,
+ remote_end));
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int SendTo_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ SocketAddress sa);
+
+ public int SendTo(byte[] buffer, int offset, int size,
+ SocketFlags flags, EndPoint remote_end) {
+ if(buffer==null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if(remote_end==null) {
+ throw new ArgumentNullException("remote endpoint is null");
+ }
+ if(offset<0 || offset>=buffer.Length) {
+ throw new ArgumentOutOfRangeException("offset exceeds the size of buffer");
+ }
+ if(offset+size<0 || offset+size>buffer.Length) {
+ throw new ArgumentOutOfRangeException("offset+size exceeds the size of buffer");
+ }
+
+ SocketAddress sockaddr=remote_end.Serialize();
+
+ int ret;
+
+ try {
+ ret=SendTo_internal(socket, buffer, offset,
+ size, flags, sockaddr);
+ }
+ catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ return(ret);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void SetSocketOption_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, object obj_val, byte[] byte_val, int int_val);
+
+ public void SetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ byte[] opt_value) {
+ SetSocketOption_internal(socket, level, name, null,
+ opt_value, 0);
+ }
+
+ public void SetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ int opt_value) {
+ SetSocketOption_internal(socket, level, name, null,
+ null, opt_value);
+ }
+
+ public void SetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ object opt_value) {
+ if(opt_value==null) {
+ throw new ArgumentNullException();
+ }
+
+ /* Passing a bool as the third parameter to
+ * SetSocketOption causes this overload to be
+ * used when in fact we want to pass the value
+ * to the runtime as an int.
+ */
+ if(opt_value is System.Boolean) {
+ bool bool_val=(bool)opt_value;
+
+ /* Stupid casting rules :-( */
+ if(bool_val==true) {
+ SetSocketOption_internal(socket, level,
+ name, null,
+ null, 1);
+ } else {
+ SetSocketOption_internal(socket, level,
+ name, null,
+ null, 0);
+ }
+ } else {
+ SetSocketOption_internal(socket, level, name,
+ opt_value, null, 0);
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Shutdown_internal(IntPtr socket, SocketShutdown how);
+
+ public void Shutdown(SocketShutdown how) {
+ Shutdown_internal(socket, how);
+ }
+
+ private bool disposed = false;
+
+ protected virtual void Dispose(bool explicitDisposing) {
+ // Check to see if Dispose has already been called
+ if(!this.disposed) {
+ // If this is a call to Dispose,
+ // dispose all managed resources.
+ if(explicitDisposing) {
+ // Free up stuff here
+ }
+
+ // Release unmanaged resources
+ this.disposed=true;
+
+ connected=false;
+ Close_internal(socket);
+ }
+ }
+
+ public void Dispose() {
+ Dispose(true);
+ // Take yourself off the Finalization queue
+ GC.SuppressFinalize(this);
+ }
+
+ ~Socket () {
+ Dispose(false);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/SocketException.cs b/mcs/class/System/System.Net.Sockets/SocketException.cs
new file mode 100644
index 00000000000..161a7cf27ae
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketException.cs
@@ -0,0 +1,41 @@
+//
+// System.Net.Sockets.NetworkStream.cs
+//
+// Author:
+// Dick Porter <dick@ximian.com>
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.Serialization;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.Sockets
+{
+ [Serializable]
+ public class SocketException : Win32Exception
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int WSAGetLastError_internal();
+
+ public SocketException ()
+ : base (WSAGetLastError_internal()) {
+ }
+
+ public SocketException (int error)
+ : base (error) {
+ }
+
+ protected SocketException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context) {
+ }
+
+ public override int ErrorCode {
+ get {
+ return NativeErrorCode;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/SocketFlags.cs b/mcs/class/System/System.Net.Sockets/SocketFlags.cs
new file mode 100644
index 00000000000..12b0906b1ee
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketFlags.cs
@@ -0,0 +1,46 @@
+// SocketFlags.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:49 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SocketFlags {
+
+ /// <summary>
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ OutOfBand = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ MaxIOVectorLength = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ Peek = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ DontRoute = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Partial = 0x00008000,
+ } // SocketFlags
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs b/mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs
new file mode 100644
index 00000000000..657a4532154
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs
@@ -0,0 +1,37 @@
+// SocketOptionLevel.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:55 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketOptionLevel {
+
+ /// <summary>
+ /// </summary>
+ Socket = 65535,
+
+ /// <summary>
+ /// </summary>
+ IP = 0,
+
+ /// <summary>
+ /// </summary>
+ Tcp = 6,
+
+ /// <summary>
+ /// </summary>
+ Udp = 17,
+ } // SocketOptionLevel
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketOptionName.cs b/mcs/class/System/System.Net.Sockets/SocketOptionName.cs
new file mode 100644
index 00000000000..117c7fc0225
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketOptionName.cs
@@ -0,0 +1,181 @@
+// SocketOptionName.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:02 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketOptionName {
+
+ /// <summary>
+ /// </summary>
+ Debug = 1,
+
+ /// <summary>
+ /// </summary>
+ AcceptConnection = 2,
+
+ /// <summary>
+ /// </summary>
+ ReuseAddress = 4,
+
+ /// <summary>
+ /// </summary>
+ KeepAlive = 8,
+
+ /// <summary>
+ /// </summary>
+ DontRoute = 16,
+
+ /// <summary>
+ /// </summary>
+ Broadcast = 32,
+
+ /// <summary>
+ /// </summary>
+ UseLoopback = 64,
+
+ /// <summary>
+ /// </summary>
+ Linger = 128,
+
+ /// <summary>
+ /// </summary>
+ OutOfBandInline = 256,
+
+ /// <summary>
+ /// </summary>
+ DontLinger = -129,
+
+ /// <summary>
+ /// </summary>
+ ExclusiveAddressUse = -5,
+
+ /// <summary>
+ /// </summary>
+ SendBuffer = 4097,
+
+ /// <summary>
+ /// </summary>
+ ReceiveBuffer = 4098,
+
+ /// <summary>
+ /// </summary>
+ SendLowWater = 4099,
+
+ /// <summary>
+ /// </summary>
+ ReceiveLowWater = 4100,
+
+ /// <summary>
+ /// </summary>
+ SendTimeout = 4101,
+
+ /// <summary>
+ /// </summary>
+ ReceiveTimeout = 4102,
+
+ /// <summary>
+ /// </summary>
+ Error = 4103,
+
+ /// <summary>
+ /// </summary>
+ Type = 4104,
+
+ /// <summary>
+ /// </summary>
+ MaxConnections = 2147483647,
+
+ /// <summary>
+ /// </summary>
+ IPOptions = 1,
+
+ /// <summary>
+ /// </summary>
+ HeaderIncluded = 2,
+
+ /// <summary>
+ /// </summary>
+ TypeOfService = 3,
+
+ /// <summary>
+ /// </summary>
+ IpTimeToLive = 4,
+
+ /// <summary>
+ /// </summary>
+ MulticastInterface = 9,
+
+ /// <summary>
+ /// </summary>
+ MulticastTimeToLive = 10,
+
+ /// <summary>
+ /// </summary>
+ MulticastLoopback = 11,
+
+ /// <summary>
+ /// </summary>
+ AddMembership = 12,
+
+ /// <summary>
+ /// </summary>
+ DropMembership = 13,
+
+ /// <summary>
+ /// </summary>
+ DontFragment = 14,
+
+ /// <summary>
+ /// </summary>
+ AddSourceMembership = 15,
+
+ /// <summary>
+ /// </summary>
+ DropSourceMembership = 16,
+
+ /// <summary>
+ /// </summary>
+ BlockSource = 17,
+
+ /// <summary>
+ /// </summary>
+ UnblockSource = 18,
+
+ /// <summary>
+ /// </summary>
+ PacketInformation = 19,
+
+ /// <summary>
+ /// </summary>
+ NoDelay = 1,
+
+ /// <summary>
+ /// </summary>
+ BsdUrgent = 2,
+
+ /// <summary>
+ /// </summary>
+ Expedited = 2,
+
+ /// <summary>
+ /// </summary>
+ NoChecksum = 1,
+
+ /// <summary>
+ /// </summary>
+ ChecksumCoverage = 20,
+ } // SocketOptionName
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketShutdown.cs b/mcs/class/System/System.Net.Sockets/SocketShutdown.cs
new file mode 100644
index 00000000000..0f9e5f269dc
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketShutdown.cs
@@ -0,0 +1,33 @@
+// SocketShutdown.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:43 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketShutdown {
+
+ /// <summary>
+ /// </summary>
+ Receive = 0,
+
+ /// <summary>
+ /// </summary>
+ Send = 1,
+
+ /// <summary>
+ /// </summary>
+ Both = 2,
+ } // SocketShutdown
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketType.cs b/mcs/class/System/System.Net.Sockets/SocketType.cs
new file mode 100644
index 00000000000..bdb6c54d3c2
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketType.cs
@@ -0,0 +1,45 @@
+// SocketType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:37 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketType {
+
+ /// <summary>
+ /// </summary>
+ Stream = 1,
+
+ /// <summary>
+ /// </summary>
+ Dgram = 2,
+
+ /// <summary>
+ /// </summary>
+ Raw = 3,
+
+ /// <summary>
+ /// </summary>
+ Rdm = 4,
+
+ /// <summary>
+ /// </summary>
+ Seqpacket = 5,
+
+ /// <summary>
+ /// </summary>
+ Unknown = -1,
+ } // SocketType
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.cs b/mcs/class/System/System.Net.Sockets/TcpClient.cs
new file mode 100755
index 00000000000..1ef74a648fc
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/TcpClient.cs
@@ -0,0 +1,346 @@
+// System.Net.Sockets.TcpClient.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+// NB: This is untested (probably buggy) code - take care if using it
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <remarks>
+ /// A slightly more abstracted way to create an
+ /// outgoing network connections than a Socket.
+ /// </remarks>
+ public class TcpClient : IDisposable
+ {
+ // private data
+
+ private NetworkStream stream;
+ private bool active;
+ private Socket client;
+ private bool disposed = false;
+
+ // constructor
+
+ /// <summary>
+ /// Some code that is shared between the constructors.
+ /// </summary>
+ private void Init ()
+ {
+ active = false;
+ client = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpClient with no connection set up
+ /// </summary>
+ public TcpClient ()
+ {
+ Init();
+ client.Bind(new IPEndPoint(IPAddress.Any, 0));
+ }
+
+ /// <summary>
+ /// Constructs a new TcpClient with a specified local endpoint.
+ /// Use this if you want to have your connections originating
+ /// from a certain port, or a certain IP (on a multi homed
+ /// system).
+ /// </summary>
+ /// <param name="local_end_point">The aforementioned local endpoint</param>
+ public TcpClient (IPEndPoint local_end_point)
+ {
+ Init();
+ client.Bind(local_end_point);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpClient and connects to a specified
+ /// host on a specified port. A quick way to set up a network
+ /// connection.
+ /// </summary>
+ /// <param name="hostname">The host to connect to, e.g.
+ /// 192.168.0.201 or www.myelin.co.nz</param>
+ /// <param name="port">The port to connect to, e.g. 80 for HTTP</param>
+ public TcpClient (string hostname, int port)
+ {
+ Init();
+ client.Bind(new IPEndPoint(IPAddress.Any, 0));
+ Connect(hostname, port);
+ }
+
+ /// <summary>
+ /// A flag that is 'true' if the TcpClient has an active connection
+ /// </summary>
+ protected bool Active
+ {
+ get { return active; }
+ set { active = value; }
+ }
+
+ /// <summary>
+ /// The socket that all network comms passes through
+ /// </summary>
+ protected Socket Client
+ {
+ get { return client; }
+ set {
+ client = value;
+ stream = null;
+ }
+ }
+
+ /// <summary>
+ /// Internal function to allow TcpListener.AcceptTcpClient
+ /// to work (it needs to be able to set protected property
+ /// 'Client')
+ /// </summary>
+ /// <param name="s"></param>
+ internal void SetTcpClient (Socket s)
+ {
+ Client = s;
+ }
+
+ /// <summary>
+ /// If set, the socket will remain open after it has been
+ /// instructed to close, in order to send data that remains
+ /// in the buffer.
+ /// </summary>
+ public LingerOption LingerState
+ {
+ get {
+ return (LingerOption)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.Linger);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.Linger, value);
+ }
+ }
+
+ /// <summary>
+ /// <p>If set, outbound data will be sent at once rather than collected
+ /// until enough is available to fill a packet.</p>
+ ///
+ /// <p>This is the TCP_NODELAY sockopt from BSD sockets and WinSock.
+ /// For more information, look up the Nagle algorithm.</p>
+ /// </summary>
+ public bool NoDelay
+ {
+ get {
+ return (bool)client.GetSocketOption(
+ SocketOptionLevel.Tcp,
+ SocketOptionName.NoDelay);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Tcp,
+ SocketOptionName.NoDelay, value);
+ }
+ }
+
+ /// <summary>
+ /// How big the receive buffer is (from the connection socket)
+ /// </summary>
+ public int ReceiveBufferSize
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveBuffer);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveBuffer, value);
+ }
+ }
+
+ /// <summary>
+ /// How long before the socket will time out on a
+ /// Receive() call
+ /// </summary>
+ public int ReceiveTimeout
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveTimeout);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveTimeout, value);
+ }
+ }
+
+ /// <summary>
+ /// How big the send buffer is (from the connection socket)
+ /// </summary>
+ public int SendBufferSize
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendBuffer);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendBuffer, value);
+ }
+ }
+
+ /// <summary>
+ /// How long before the socket will time out on a
+ /// Send() call
+ /// </summary>
+ public int SendTimeout
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendTimeout);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendTimeout, value);
+ }
+ }
+
+
+ // methods
+
+ /// <summary>
+ /// Closes the socket and disposes of all managed resources.
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// closing the socket.
+ /// </summary>
+ public void Close ()
+ {
+ ((IDisposable) this).Dispose ();
+ }
+
+ /// <summary>
+ /// Connects to a specified remote endpoint
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// connecting.
+ /// </summary>
+ /// <param name="remote_end_point">The aforementioned endpoint</param>
+ public void Connect (IPEndPoint remote_end_point)
+ {
+ try {
+ client.Connect(remote_end_point);
+ stream = new NetworkStream(client, true);
+ active = true;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ /// <summary>
+ /// Connects to an IP address on a port
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// connecting.
+ /// </summary>
+ /// <param name="address">The IP address (get it from Dns.GetHostByName)</param>
+ /// <param name="port">The port to connect to, e.g. 80 for HTTP</param>
+ public void Connect (IPAddress address, int port)
+ {
+ Connect(new IPEndPoint(address, port));
+ }
+
+ /// <summary>
+ /// Resolves a fully qualified domain name to an IP address
+ /// and connects to it on a specified port
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// connecting.
+ /// </summary>
+ /// <param name="hostname">The hostname, e.g. www.myelin.co.nz</param>
+ /// <param name="port">The port, e.g. 80 for HTTP</param>
+ [MonoTODO]
+ public void Connect (string hostname, int port)
+ {
+ CheckDisposed ();
+ IPHostEntry host = Dns.GetHostByName(hostname);
+ /* TODO: This will connect to the first IP address returned
+ from GetHostByName. Is that right? */
+ Connect(new IPEndPoint(host.AddressList[0], port));
+ }
+
+ /// <summary>
+ /// Gets rid of all managed resources
+ /// </summary>
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ /// <summary>
+ /// Gets rid of all unmanaged resources
+ /// </summary>
+ /// <param name="disposing">If this is true, it gets rid of all
+ /// managed resources as well</param>
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposed)
+ return;
+ disposed = true;
+
+ // release unmanaged resources
+ NetworkStream s = stream;
+ stream = null;
+ if (s != null) {
+ // This closes the socket as well, as the NetworkStream
+ // owns the socket.
+ s.Close();
+ active = false;
+ s = null;
+ }
+ client = null;
+ }
+
+ /// <summary>
+ /// Destructor - just calls Dispose()
+ /// </summary>
+ ~TcpClient ()
+ {
+ Dispose (false);
+ }
+
+ /// <returns>A NetworkStream object connected to the
+ /// connection socket</returns>
+ public NetworkStream GetStream()
+ {
+ try {
+ if (stream == null)
+ {
+ stream = new NetworkStream (client, true);
+ }
+ return stream;
+ }
+ finally { CheckDisposed (); }
+ }
+
+ private void CheckDisposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException (GetType().FullName);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.cs b/mcs/class/System/System.Net.Sockets/TcpListener.cs
new file mode 100755
index 00000000000..feedae68b90
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/TcpListener.cs
@@ -0,0 +1,171 @@
+// System.Net.Sockets.TcpListener.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+// NB: This is untested (probably buggy) code - take care using it
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <remarks>
+ /// A slightly more abstracted way to listen for incoming
+ /// network connections than a Socket.
+ /// </remarks>
+ public class TcpListener
+ {
+ // private data
+
+ private bool active;
+ private Socket server;
+
+ // constructor
+
+ /// <summary>
+ /// Some code that is shared between the constructors.
+ /// </summary>
+ private void Init ()
+ {
+ active = false;
+ server = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpListener to listen on a specified port
+ /// </summary>
+ /// <param name="port">The port to listen on, e.g. 80 if you
+ /// are a web server</param>
+ public TcpListener (int port)
+ {
+ Init();
+ server.Bind(new IPEndPoint(IPAddress.Any, port));
+ }
+
+ /// <summary>
+ /// Constructs a new TcpListener with a specified local endpoint
+ /// </summary>
+ /// <param name="local_end_point">The endpoint</param>
+ public TcpListener (IPEndPoint local_end_point)
+ {
+ Init();
+ server.Bind(local_end_point);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpListener, listening on a specified port
+ /// and IP (for use on a multi-homed machine)
+ /// </summary>
+ /// <param name="listen_ip">The IP to listen on</param>
+ /// <param name="port">The port to listen on</param>
+ public TcpListener (IPAddress listen_ip, int port)
+ {
+ Init();
+ server.Bind(new IPEndPoint(listen_ip, port));
+ }
+
+
+ // properties
+
+ /// <summary>
+ /// A flag that is 'true' if the TcpListener is listening,
+ /// or 'false' if it is not listening
+ /// </summary>
+ protected bool Active
+ {
+ get { return active; }
+ }
+
+ /// <summary>
+ /// The local end point
+ /// </summary>
+ public EndPoint LocalEndpoint
+ {
+ get { return server.LocalEndPoint; }
+ }
+
+ /// <summary>
+ /// The listening socket
+ /// </summary>
+ protected Socket Server
+ {
+ get { return server; }
+ }
+
+
+ // methods
+
+ /// <summary>
+ /// Accepts a pending connection
+ /// <returns>A Socket object for the new connection</returns>
+ public Socket AcceptSocket ()
+ {
+ return server.Accept();
+ }
+
+ /// <summary>
+ /// Accepts a pending connection
+ /// </summary>
+ /// <returns>A TcpClient
+ /// object made from the new socket.</returns>
+ public TcpClient AcceptTcpClient ()
+ {
+ TcpClient client = new TcpClient();
+ // use internal method SetTcpClient to make a
+ // client with the specified socket
+ client.SetTcpClient(AcceptSocket());
+ return client;
+ }
+
+ /// <summary>
+ /// Destructor - stops the listener listening
+ /// </summary>
+ ~TcpListener ()
+ {
+ if (active == true) {
+ Stop();
+ }
+ }
+
+ /// <returns>
+ /// Returns 'true' if there is a connection waiting to be accepted
+ /// with AcceptSocket() or AcceptTcpClient().
+ /// </returns>
+ public bool Pending ()
+ {
+ return server.Poll(1000, SelectMode.SelectRead);
+ }
+
+ /// <summary>
+ /// Tells the TcpListener to start listening.
+ /// </summary>
+ [MonoTODO]
+ public void Start ()
+ {
+ server.Listen(5); // According to the
+ // man page some BSD
+ // and BSD-derived
+ // systems limit the
+ // backlog to 5. This
+ // should really be
+ // configurable though
+ active = true;
+ }
+
+ /// <summary>
+ /// Tells the TcpListener to stop listening and dispose
+ /// of all managed resources.
+ /// </summary>
+ public void Stop ()
+ {
+ server.Close();
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.cs b/mcs/class/System/System.Net.Sockets/UdpClient.cs
new file mode 100644
index 00000000000..1c9a9709fdb
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/UdpClient.cs
@@ -0,0 +1,269 @@
+//
+// System.Net.Sockets.UdpClient.cs
+//
+// Author:
+// Gonzalo Paniagua Javier <gonzalo@ximian.com>
+//
+// Copyright (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ public class UdpClient : IDisposable
+ {
+ private bool disposed = false;
+ private bool active = false;
+ private Socket socket;
+ private IPEndPoint localEP;
+
+#region Constructors
+ public UdpClient ()
+ {
+ localEP = new IPEndPoint (IPAddress.Any, 0);
+ InitSocket ();
+ }
+
+ public UdpClient (int port)
+ {
+ // IPEndPoint throws ArgumentException when port is invalid
+ localEP = new IPEndPoint (IPAddress.Any, port);
+ InitSocket ();
+ }
+
+ public UdpClient (IPEndPoint localEP)
+ {
+ if (localEP == null)
+ throw new ArgumentNullException ("IPEndPoint cannot be null");
+
+ this.localEP = localEP;
+ InitSocket ();
+ }
+
+ public UdpClient (string hostname, int port)
+ {
+ if (hostname == null)
+ throw new ArgumentNullException ("hostname cannot be null");
+
+ if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
+ throw new ArgumentException ("Invalid port");
+
+ localEP = new IPEndPoint (IPAddress.Any, 0);
+ InitSocket ();
+ Connect (hostname, port);
+ }
+
+ private void InitSocket ()
+ {
+ active = false;
+ socket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+ socket.Bind (localEP);
+ }
+
+#endregion // Constructors
+#region Public methods
+#region Close
+ public void Close ()
+ {
+ ((IDisposable) this).Dispose ();
+ }
+#endregion
+#region Connect
+ public void Connect (IPEndPoint endPoint)
+ {
+ try {
+ socket.Connect (endPoint);
+ active = true;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public void Connect (IPAddress addr, int port)
+ {
+ Connect (new IPEndPoint (addr, port));
+ }
+
+ public void Connect (string hostname, int port)
+ {
+ Connect (new IPEndPoint (Dns.Resolve (hostname).AddressList [0], port));
+ }
+#endregion
+#region Multicast methods
+ public void DropMulticastGroup (IPAddress multicastAddr)
+ {
+ try {
+ socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DropMembership,
+ new MulticastOption (multicastAddr));
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public void JoinMulticastGroup (IPAddress multicastAddr)
+ {
+ try {
+ socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
+ new MulticastOption (multicastAddr));
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)
+ {
+ JoinMulticastGroup (multicastAddr);
+ try {
+ socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive,
+ timeToLive);
+ } finally {
+ CheckDisposed ();
+ }
+ }
+#endregion
+#region Data I/O
+ public byte [] Receive (ref IPEndPoint remoteEP)
+ {
+ try {
+ // Length of the array for receiving data??
+ byte [] recBuffer;
+ int available = socket.Available;
+ if (available < 512)
+ available = 512;
+
+ recBuffer = new byte [available];
+ EndPoint endPoint = new IPEndPoint (IPAddress.Any, 0);
+ int dataRead = socket.ReceiveFrom (recBuffer, ref endPoint);
+ if (dataRead < recBuffer.Length)
+ recBuffer = CutArray (recBuffer, dataRead);
+
+ remoteEP = (IPEndPoint) endPoint;
+ return recBuffer;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public int Send (byte [] dgram, int bytes)
+ {
+ try {
+ if (dgram == null)
+ throw new ArgumentNullException ("dgram is null");
+
+ byte [] realDgram;
+ if (dgram.Length <= bytes)
+ realDgram = dgram;
+ else
+ realDgram = CutArray (dgram, (bytes >= dgram.Length) ? bytes : dgram.Length);
+
+ // the socket should be connected already, so I use Send instead of SendTo
+ return socket.Send (realDgram);
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
+ {
+ try {
+ if (dgram == null)
+ throw new ArgumentNullException ("dgram is null");
+
+ byte [] realDgram;
+ if (dgram.Length <= bytes)
+ realDgram = dgram;
+ else
+ realDgram = CutArray (dgram, (bytes >= dgram.Length) ? bytes : dgram.Length);
+
+ // the socket should not be connected
+ return socket.SendTo (realDgram, endPoint);
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public int Send (byte [] dgram, int bytes, string hostname, int port)
+ {
+ return Send (dgram, bytes,
+ new IPEndPoint (Dns.Resolve (hostname).AddressList [0], port));
+ }
+
+ private byte [] CutArray (byte [] orig, int length)
+ {
+ byte [] newArray = new byte [length];
+ Array.Copy (orig, 0, newArray, 0, length);
+
+ return newArray;
+ }
+#endregion
+#region Properties
+ protected bool Active {
+ get { return active; }
+ set { active = value; }
+ }
+
+ protected Socket Client {
+ get { return socket; }
+ set { socket = value; }
+ }
+#endregion
+
+/*
+// commented because in the ms.net implementation these are not overriden. -- LP
+#region Overrides
+ public override bool Equals (object obj)
+ {
+ if (obj is UdpClient)
+ return (((UdpClient) obj).socket == socket &&
+ ((UdpClient) obj).localEP == localEP);
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (socket.GetHashCode () + localEP.GetHashCode () + (active ? 1 : 0));
+ }
+#endregion
+*/
+
+#region Disposing
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ void Dispose (bool disposing)
+ {
+ if (disposed)
+ return;
+ disposed = true;
+ if (disposing) {
+ // release managed resources
+ localEP = null;
+ }
+ // release unmanaged resources
+ Socket s = socket;
+ socket = null;
+ if (s != null)
+ s.Close ();
+ }
+
+ ~UdpClient ()
+ {
+ Dispose (false);
+ }
+
+ private void CheckDisposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException (GetType().FullName);
+ }
+#endregion
+#endregion
+ }
+}
+
diff --git a/mcs/class/System/System.Net/AuthenticationManager.cs b/mcs/class/System/System.Net/AuthenticationManager.cs
index d1c3e48b291..b67ff556817 100755
--- a/mcs/class/System/System.Net/AuthenticationManager.cs
+++ b/mcs/class/System/System.Net/AuthenticationManager.cs
@@ -7,6 +7,8 @@
// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Collections;
+
namespace System.Net {
public class AuthenticationManager {
@@ -15,41 +17,37 @@ namespace System.Net {
public static IEnumerator RegisteredModules {
get {
- if (!modules)
+ if (modules == null)
modules = new ArrayList ();
- return modules;
+ return modules as IEnumerator;
}
}
+ [MonoTODO]
public static Authorization PreAuthenticate (WebRequest request,
- ICredentialLookup credentials)
+ ICredentials credentials)
{
// FIXME: implement
+ return null;
}
public static void Register (IAuthenticationModule authenticationModule)
{
- if (!modules)
+ if (modules == null)
modules = new ArrayList ();
modules.Add (authenticationModule);
}
- public static Authorization Respond (WebHeaders ResponseHeaders,
- WebRequest Request,
- ICredentialLookup credentials)
- {
- // FIXME: implement
- return null;
- }
-
+ [MonoTODO]
public static void Unregister (IAuthenticationModule authenticationModule)
{
// FIXME: implement
}
- pubilc static void Unregister (string authenticationScheme)
+ [MonoTODO]
+ public static void Unregister (string authenticationScheme)
{
// FIXME: implement
}
diff --git a/mcs/class/System/System.Net/Authorization.cs b/mcs/class/System/System.Net/Authorization.cs
index e3866b0119e..1c21c85f0bc 100755
--- a/mcs/class/System/System.Net/Authorization.cs
+++ b/mcs/class/System/System.Net/Authorization.cs
@@ -3,6 +3,7 @@
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
+// Lawrence Pit (loz@cable.a2000.nl)
//
// (C) Ximian, Inc. http://www.ximian.com
//
@@ -12,25 +13,40 @@ namespace System.Net {
public class Authorization {
string token;
bool complete;
+ string connectionGroupId;
+ string [] protectionRealm;
- public Authorization (string token)
+ public Authorization (string token) : this (token, true)
{
- this.complete = true;
- this.token = token;
}
- public Authorization (string token, bool complete)
+ public Authorization (string token, bool complete)
+ : this (token, complete, null)
+ {
+ }
+
+ public Authorization (string token, bool complete, string connectionGroupId)
{
- this.complete = complete;
this.token = token;
+ this.complete = complete;
+ this.connectionGroupId = connectionGroupId;
+ }
+
+ public string Message {
+ get { return token; }
}
public bool Complete {
- get {
- return finished;
- }
+ get { return complete; }
}
+ public string ConnectionGroupId {
+ get { return connectionGroupId; }
+ }
+ public string[] ProtectionRealm {
+ get { return protectionRealm; }
+ set { protectionRealm = value; }
+ }
}
}
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
new file mode 100644
index 00000000000..6409dec9278
--- /dev/null
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -0,0 +1,258 @@
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWebRequest.cs: applied patch from Tim Haynes
+ (thaynes@openlinksw.com).
+
+ Avoided double-sending of the request to the server when both
+ GetRequestStream() and GetResponse() are called.
+ System Header attributes survive the Headers attribute set.
+ Added handling of Connection: KeepAlive/Close
+
+2002-10-03 Dick Porter <dick@ximian.com>
+
+ * Dns.cs: Fixed GetHostName()
+
+2002-09-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWebRequest.cs:
+ * HttpWebResponse.cs: applied another patch from Shahms E. King
+ (shahms@shahms.com).
+
+2002-09-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpWebRequest.cs:
+ * HttpWebResponse.cs: applied patch from Shahms E. King
+ (shahms@shahms.com).
+
+2002-05-29 Lawrence Pit <loz@cable.a2000.nl>
+
+ * MonoHttpDate.cs: added
+ * HttpWebRequest.cs: using MonoHttpDate
+ * HttpWebResponse.cs: using MonoHttpDate
+ * DnsPermission.cs: correct XML output
+ * SocketPermission.cs: correct XML output
+
+2002-05-21 Lawrence Pit <loz@cable.a2000.nl>
+
+ * WebClient.cs: stubbed
+ * WebProxy.cs: fixed bug; had to change internal representation
+ of bypasslist to ArrayList, different implementation of checking
+ regex's.
+
+2002-05-20 Lawrence Pit <loz@cable.a2000.nl>
+
+ * WebProxy.cs: added, implemented
+ * ServicePoint.cs: implemented most
+ * ServicePointManager.cs: implemented
+ * HttpWebRequest.cs: started implementation
+ * HttpWebResponse.cs: improved disposable routines
+ * FileWebRequest.cs: slight improvement of Close method
+
+2002-05-19 Lawrence Pit <loz@cable.a2000.nl>
+
+ * FileWebRequest.cs: finished implementation of async methods.
+ * FileWebResponse.cs: improved disposable routines.
+ * IPEndPoint.cs: fixed bug #24666 in Serialize and Create methods,
+ byte ordering of address was backwards.
+
+2002-05-13 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Dns.cs: Reimplemented (simplified and fixed) asynchronous methods by
+ relying on standard asynchronous delegate features. Added checks for
+ null strings.
+ * HttpWebResponse.cs: implemented properties
+ * FileWebResponse.cs: improved the way resources are disposed.
+ * FileWebRequest.cs: started implementation of asynchronous methods
+ * ServicePointManager.cs: implemented properties
+
+2002-05-12 Lawrence Pit <loz@cable.a2000.nl>
+
+ * HttpWebRequest.cs: properties implemented
+ * HttpWebResponse.cs: added
+ * GlobalProxySelection.cs: implemented
+ * FileWebResponse.cs: added
+ * FileWebRequest.cs: some methods implemented
+
+2002-05-11 Lawrence Pit <loz@cable.a2000.nl>
+
+ * WebHeaderCollection.cs: implemented
+ * WebRequest.cs: implemented
+ * FileWebRequest.cs and HttpWebRequest.cs stubs added
+
+2002-05-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Rewrote IPAddress.Parse method, passing all unit tests
+
+2002-05-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * fixed bug in IPEndPoint.Equals method
+ * fixed bug in IPAddress.Parse method
+ * fixed bug in IPAddress.SwapLong method
+ * fixed several bugs in Cookie.cs
+
+2002-05-06 Lawrence Pit <loz@cable.a2000.nl>
+
+ * WebRequest.cs: added
+ * WebResponse.cs: implemented
+ * WebException.cs: implemented
+ * WebHeaderCollection.cs: added
+ * HttpVersion.cs: implemented
+ * HttpContinueDelegate.cs: added
+ * IWebProxy.cs: added
+ * IWebRequestCreate.cs: added
+ * ICertificatePolicy.cs: added
+ * ServicePoint.cs: stubbed
+ * ServicePointManager.cs: stubbed
+ * CookieContainer.cs: added
+ * Authorization.cs: implemented
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * CredentialCache.cs: implemented
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * IPAddress.cs: fixed IsLoopback, address was already in host order
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * IPv6Address.cs: added (note: not part of .net spec)
+
+2002-05-01 Lawrence Pit <loz@cable.a2000.nl>
+
+ * DnsPermission.cs: implemented
+ * DnsPermissionAttribute.cs: implemented
+
+2002-04-28 Lawrence Pit <loz@cable.a2000.nl>
+
+ * EndpointPermission.cs: implemented
+ * SocketPermission.cs: implemented
+ * SocketPermissionAttribute.cs: implemented
+ * ProtocolViolationException.cs: implemented
+ * Dns.c: passing w32 error code when no host found
+
+2002-04-27 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Cookie.cs: implemented
+ * CookieCollection.cs: implemented
+ * CookieException.cs: implemented
+
+2002-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: initialize the read only fields with Parse().
+
+2002-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: little changes to behave as MS.
+
+2002-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Dns.cs (Resolve): behave as MS. Agreed with Mads.
+
+2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: the icalls for sockets are endianness-aware. So I
+ changed a few things. Also included a workaround for bug #23547.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: use System.BitConverter.IsLittleEndian (suggested
+ by Paolo) instead of guessing the endianness.
+
+ * SocketAddress.cs: implemented Equals() and GetHashcode().
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPEndPoint.cs: modifications to constructors according to the
+ specifications (suggested by Lawrence Pit).
+
+2002-04-15 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * IPEndPoint.cs: Fixed build breaker.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPEndPoint.cs: implemented Equals() and GetHashCode(). Now 100%
+ complete.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: finished all MonoTODO's. Use network order to store
+ the address. Check for max and min values in Address:set. IsLoopback()
+ returns now true for all 127.x.y.z. Some more checks in Parse ().
+ Some changes to behave as MS does.
+
+2002-02-24 Duncan Mak <duncan@ximian.com>
+
+ * ICredentialLookup.cs: Added the GetCredential method to the
+ interface. The interface is named "ICredentials", should this file
+ be renamed?
+
+ * NetworkCredential.cs: Added to CVS. Need to investigate on how
+ GetCredential() works
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * SocketAddress.cs: Implemented.
+
+ * IPEndPoint.cs: Turned 'Address' field into a real property.
+ Implemented Create() and Serialize() methods.
+
+ * IPAddress.cs: Fixed class constructor, turned 'Address' field
+ into a real property. Removed undocumented "public
+ IPAddress(string)" constructor.
+
+ * EndPoint.cs: Implemented. All methods return
+ NotSupportedException to enforce subclass overriding.
+
+ * Dns.cs: Replaced fixed-layout Hostent struct and cygwin
+ P/Invokes with portable internal calls.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * Dns.cs: Updated to API changes.
+
+ * IPAddress.cs: Updated API. Much left to implement.
+
+ * Dns.cs: Remove IPToString method
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * Dns.cs, AuthenticationManager.cs, SocketAddress.cs : MonoTODO
+ attribute insertion.
+
+2001-11-22 Nick Drochak <ndrochak@gol.com>
+
+ * IPAddress.cs: Fix constructor bug, properly name Address property,
+ and use triple-slash for comments.
+
+2001-11-20 Miguel de Icaza <miguel@ximian.com>
+
+ * IPAddress.cs: Updated to contain Any, Broadcast, Loopback and
+ None as suggested by Phillip.
+
+2001-09-26 Mads Pultz <mpultz@get2net.dk>
+ * Dns.cs: Initial work on BeginGetHostByName and EndGetHostByName implemented.
+
+2001-09-24 Mads Pultz <mpultz@get2net.dk>
+
+ * Dns.cs: Minor changes (some print statements removed)
+
+2001-09-23 Mads Pultz <mpultz@get2net.dk>
+
+ * Dns.cs: Initial work submitted to repository.
+ * IPHostEntry.cs: Initial work submitted to repository.
+
+2001-07-12 Sean MacIsaac <macisaac@ximian.com>
+
+ * Authorization.cs: Fixed compiler error.
+
+ * IAuthenticationModule.cs: Changes for Beta2.
+
+ * IPAddress.cs: Internal storage changed to be uint not int.
+
+ * IPEndPoint.cs: Fixed compiler error.
+
+ * EndPoint.cs: Fixed compiler error.
+
+ * AuthenticationManager.cs: Fixed typo.
diff --git a/mcs/class/System/System.Net/ConnectionModes.cs b/mcs/class/System/System.Net/ConnectionModes.cs
new file mode 100755
index 00000000000..3a1cc437702
--- /dev/null
+++ b/mcs/class/System/System.Net/ConnectionModes.cs
@@ -0,0 +1,37 @@
+// ConnectionModes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:39 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ConnectionModes {
+
+ /// <summary>
+ /// </summary>
+ Single = 0,
+
+ /// <summary>
+ /// </summary>
+ Persistent = 1,
+
+ /// <summary>
+ /// </summary>
+ Pipeline = 2,
+
+ /// <summary>
+ /// </summary>
+ Mux = 3,
+ } // ConnectionModes
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/Cookie.cs b/mcs/class/System/System.Net/Cookie.cs
new file mode 100644
index 00000000000..b3acb2b5d6f
--- /dev/null
+++ b/mcs/class/System/System.Net/Cookie.cs
@@ -0,0 +1,276 @@
+//
+// System.Net.Cookie.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Text;
+
+namespace System.Net {
+
+ // Supported cookie formats are:
+ // Netscape: http://home.netscape.com/newsref/std/cookie_spec.html
+ // RFC 2109: http://www.ietf.org/rfc/rfc2109.txt
+ // RFC 2965: http://www.ietf.org/rfc/rfc2965.txt
+ [Serializable]
+ public sealed class Cookie
+ {
+ private string comment;
+ private Uri commentUri;
+ private bool discard;
+ private string domain;
+ private bool expired;
+ private DateTime expires;
+ private string name;
+ private string path;
+ private string port;
+ private int [] ports;
+ private bool secure;
+ private DateTime timestamp;
+ private string val;
+ private int version;
+
+ private static char [] reservedCharsName = new char [] {' ', '=', ';', ',', '\n', '\r', '\t'};
+ private static char [] reservedCharsValue = new char [] {';', ','};
+ private static char [] portSeparators = new char [] {'"', ','};
+ private static string tspecials = "()<>@,;:\\\"/[]?={} \t"; // from RFC 2965, 2068
+
+ public Cookie ()
+ : this (String.Empty, String.Empty) {}
+
+ public Cookie (string name, string value)
+ {
+ Name = name;
+ Value = value;
+
+ discard = false;
+ expired = false;
+ secure = false;
+ expires = DateTime.MinValue;
+ timestamp = DateTime.Now;
+ version = 0;
+ }
+
+ public Cookie (string name, string value, string path)
+ : this (name, value)
+ {
+ Path = path;
+ }
+
+ public Cookie (string name, string value, string path, string domain)
+ : this (name, value, path)
+ {
+ Domain = domain;
+ }
+
+ public string Comment {
+ get { return comment; }
+ set { comment = value == null ? String.Empty : value; }
+ }
+
+ public Uri CommentUri {
+ get { return commentUri; }
+ set { commentUri = value; }
+ }
+
+ public bool Discard {
+ get { return discard; }
+ set { discard = value; }
+ }
+
+ public string Domain {
+ get { return domain; }
+ set { domain = value == null ? String.Empty : value; }
+ }
+
+ public bool Expired {
+ get {
+ return expires <= DateTime.Now &&
+ expires != DateTime.MinValue;
+ }
+ set {
+ expired = value;
+ if (expired) {
+ expires = DateTime.Now;
+ }
+ }
+ }
+
+ public DateTime Expires {
+ get { return expires; }
+ set { expires = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set {
+ if (value == null || value.Length == 0) {
+ throw new CookieException ("Name cannot be empty");
+ }
+
+ if (value [0] == '$' || value.IndexOfAny (reservedCharsName) != -1) {
+ // see CookieTest, according to MS implementation
+ // the name value changes even though it's incorrect
+ name = String.Empty;
+ throw new CookieException ("Name contains invalid characters");
+ }
+
+ name = value;
+ }
+ }
+
+ public string Path {
+ get { return (path == null) ? "/" : path; }
+ set { path = (value == null) ? String.Empty : value; }
+ }
+
+ public string Port {
+ get { return port; }
+ set {
+ if (value == null || value.Length == 0) {
+ port = String.Empty;
+ return;
+ }
+ if (value [0] != '"' || value [value.Length - 1] != '"') {
+ throw new CookieException("The 'Port'='" + value + "' part of the cookie is invalid. Port must be enclosed by double quotes.");
+ }
+ port = value;
+ string [] values = port.Split (portSeparators);
+ ports = new int[values.Length];
+ for (int i = 0; i < ports.Length; i++) {
+ ports [i] = Int32.MinValue;
+ if (values [i].Length == 0)
+ continue;
+ try {
+ ports [i] = Int32.Parse (values [i]);
+ } catch (Exception e) {
+ throw new CookieException("The 'Port'='" + value + "' part of the cookie is invalid. Invalid value: " + values [i], e);
+ }
+ }
+ }
+ }
+
+ int[] Ports {
+ get { return ports; }
+ }
+
+ public bool Secure {
+ get { return secure; }
+ set { secure = value; }
+ }
+
+ public DateTime TimeStamp {
+ get { return timestamp; }
+ }
+
+ public string Value {
+ get { return val; }
+ set {
+ if (value == null) {
+ val = String.Empty;
+ return;
+ }
+
+ // LAMESPEC: According to .Net specs the Value property should not accept
+ // the semicolon and comma characters, yet it does. For now we'll follow
+ // the behaviour of MS.Net instead of the specs.
+ /*
+ if (value.IndexOfAny(reservedCharsValue) != -1)
+ throw new CookieException("Invalid value. Value cannot contain semicolon or comma characters.");
+ */
+
+ val = value;
+ }
+ }
+
+ public int Version {
+ get { return version; }
+ set {
+ if ((value < 0) || (value > 10))
+ version = 0;
+ else
+ version = value;
+ }
+ }
+
+ public override bool Equals (Object obj)
+ {
+ System.Net.Cookie c = obj as System.Net.Cookie;
+
+ return c != null &&
+ String.Compare (this.name, c.name, true) == 0 &&
+ String.Compare (this.val, c.val, false) == 0 &&
+ String.Compare (this.path, c.path, false) == 0 &&
+ String.Compare (this.domain, c.domain, true) == 0 &&
+ this.version == c.version;
+ }
+
+ public override int GetHashCode ()
+ {
+ return hash(name.ToLower ().GetHashCode (),
+ val.GetHashCode (),
+ path.GetHashCode (),
+ domain.ToLower ().GetHashCode (),
+ version);
+ }
+
+ private static int hash (int i, int j, int k, int l, int m)
+ {
+ return i ^ (j << 13 | j >> 19) ^ (k << 26 | k >> 6) ^ (l << 7 | l >> 25) ^ (m << 20 | m >> 12);
+ }
+
+ // returns a string that can be used to send a cookie to an Origin Server
+ // i.e., only used for clients
+ // see also para 3.3.4 of RFC 1965
+ public override string ToString ()
+ {
+ if (name.Length == 0)
+ return String.Empty;
+
+ StringBuilder result = new StringBuilder (64);
+
+ if (version > 0) {
+ result.Append ("$Version=").Append (version).Append (";");
+ }
+
+ result.Append (name).Append ("=").Append (val);
+
+ // in the MS.Net implementation path and domain don't show up in
+ // the result, I guess that's a bug in their implementation...
+ if (path != null && path.Length != 0)
+ result.Append (";$Path=").Append (QuotedString (path));
+
+ if (domain != null && domain.Length != 0)
+ result.Append (";$Domain=").Append (QuotedString (domain));
+
+ if (port != null && port.Length != 0)
+ result.Append (";$Port=").Append (port);
+
+ return result.ToString ();
+ }
+
+ // See par 3.6 of RFC 2616
+ private string QuotedString (string value)
+ {
+ if (version == 0 || IsToken (value))
+ return value;
+ else
+ return "\"" + value.Replace("\"", "\\\"") + "\"";
+ }
+
+ private bool IsToken (string value)
+ {
+ int len = value.Length;
+ for (int i = 0; i < len; i++) {
+ char c = value [i];
+ if (c < 0x20 || c >= 0x7f || tspecials.IndexOf (c) != -1)
+ return false;
+ }
+ return true;
+ }
+
+ }
+}
+
diff --git a/mcs/class/System/System.Net/CookieCollection.cs b/mcs/class/System/System.Net/CookieCollection.cs
new file mode 100644
index 00000000000..b26645f78e2
--- /dev/null
+++ b/mcs/class/System/System.Net/CookieCollection.cs
@@ -0,0 +1,110 @@
+//
+// System.Net.CookieCollection
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class CookieCollection : ICollection, IEnumerable
+ {
+ private ArrayList list = new ArrayList ();
+
+ // ctor
+ public CookieCollection ()
+ {
+ }
+
+ // ICollection
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public Object SyncRoot {
+ get { return this; }
+ }
+
+ public void CopyTo (Array array, int arrayIndex)
+ {
+ list.CopyTo (array, arrayIndex);
+ }
+
+
+ // IEnumerable
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+
+ // This
+
+ // LAMESPEC: So how is one supposed to create a writable CookieCollection
+ // instance?? We simply ignore this property, as this collection is always
+ // writable.
+ public bool IsReadOnly {
+ get { return true; }
+ }
+
+ // LAMESPEC: Which exception should we throw when the read only
+ // property is set to true??
+ public void Add (Cookie cookie)
+ {
+ if (cookie == null)
+ throw new ArgumentNullException ("cookie");
+ int pos = list.IndexOf (cookie);
+ if (pos == -1)
+ list.Add (cookie);
+ else
+ list [pos] = cookie;
+ }
+
+ // LAMESPEC: Which exception should we throw when the read only
+ // property is set to true??
+ public void Add (CookieCollection cookies)
+ {
+ if (cookies == null)
+ throw new ArgumentNullException ("cookies");
+
+ IEnumerator enumerator = cookies.list.GetEnumerator ();
+ while (enumerator.MoveNext ())
+ Add ((Cookie) enumerator.Current);
+ }
+
+ public Cookie this [int index] {
+ get {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("index");
+ return (Cookie) list [index];
+ }
+ }
+
+ public Cookie this [string name] {
+ get {
+ lock (this) {
+ IEnumerator enumerator = list.GetEnumerator ();
+ while (enumerator.MoveNext ())
+ if (String.Compare (((Cookie) enumerator.Current).Name, name, true) == 0)
+ return (Cookie) enumerator.Current;
+ }
+ return null;
+ }
+ }
+
+
+ } // CookieCollection
+
+} // System.Net
+
diff --git a/mcs/class/System/System.Net/CookieContainer.cs b/mcs/class/System/System.Net/CookieContainer.cs
new file mode 100644
index 00000000000..4058b9fd67e
--- /dev/null
+++ b/mcs/class/System/System.Net/CookieContainer.cs
@@ -0,0 +1,130 @@
+//
+// System.Net.CookieContainer
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class CookieContainer
+ {
+ private int count;
+ private int capacity;
+ private int perDomainCapacity;
+ private int maxCookieSize;
+
+ // ctors
+ public CookieContainer () : this (DefaultCookieLimit)
+ {
+ }
+
+ public CookieContainer (int capacity) :
+ this (capacity, DefaultPerDomainCookieLimit, DefaultCookieLengthLimit)
+ {
+ }
+
+ public CookieContainer (int capacity, int perDomainCapacity, int maxCookieSize)
+ {
+ this.capacity = capacity;
+ this.perDomainCapacity = perDomainCapacity;
+ this.maxCookieSize = maxCookieSize;
+ this.count = 0;
+ }
+
+ // fields
+
+ public const int DefaultCookieLengthLimit = 4096;
+ public const int DefaultCookieLimit = 300;
+ public const int DefaultPerDomainCookieLimit = 20;
+
+ // properties
+
+ public int Count {
+ get { return count; }
+ }
+
+ public int Capacity {
+ get { return capacity; }
+ set {
+ if ((value <= 0) ||
+ (value < perDomainCapacity && perDomainCapacity != Int32.MaxValue))
+ throw new ArgumentOutOfRangeException ("value");
+ if (value < maxCookieSize)
+ maxCookieSize = value;
+ capacity = value;
+ }
+ }
+
+ public int MaxCookieSize {
+ get { return maxCookieSize; }
+ set {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ("value");
+ maxCookieSize = value;
+ }
+ }
+
+ public int PerDomainCapacity {
+ get { return perDomainCapacity; }
+ set {
+ if ((value <= 0) ||
+ (value > DefaultCookieLimit && value != Int32.MaxValue))
+ throw new ArgumentOutOfRangeException ("value");
+ if (value < perDomainCapacity)
+ perDomainCapacity = value;
+ perDomainCapacity = value;
+ }
+ }
+
+ [MonoTODO]
+ public void Add (Cookie cookie)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Add (CookieCollection cookies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Add (Uri uri, Cookie cookie)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Add (Uri uri, CookieCollection cookies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetCookieHeader (Uri uri)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public CookieCollection GetCookies (Uri uri)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetCookies (Uri uri, string cookieHeader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ } // CookieContainer
+
+} // System.Net
+
diff --git a/mcs/class/System/System.Net/CookieException.cs b/mcs/class/System/System.Net/CookieException.cs
new file mode 100644
index 00000000000..09fd80601ce
--- /dev/null
+++ b/mcs/class/System/System.Net/CookieException.cs
@@ -0,0 +1,42 @@
+//
+// System.Net.CookieException.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class CookieException : FormatException, ISerializable
+ {
+
+ // Constructors
+ public CookieException () : base ()
+ {
+ }
+
+ internal CookieException (string msg) : base (msg)
+ {
+ }
+
+ internal CookieException (string msg, Exception e) : base (msg, e)
+ {
+ }
+
+ protected CookieException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // Methods
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net/CredentialCache.cs b/mcs/class/System/System.Net/CredentialCache.cs
new file mode 100644
index 00000000000..02557cb46ae
--- /dev/null
+++ b/mcs/class/System/System.Net/CredentialCache.cs
@@ -0,0 +1,170 @@
+//
+// System.Net.CredentialCache
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class CredentialCache : ICredentials, IEnumerable
+ {
+ // Fields
+ private Hashtable cache;
+
+ // Constructors
+ public CredentialCache ()
+ {
+ cache = new Hashtable ();
+ }
+
+ // Properties
+
+ [MonoTODO ("Need EnvironmentPermission implementation first")]
+ public static ICredentials DefaultCredentials {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+
+ // ICredentials
+
+ public NetworkCredential GetCredential (Uri uriPrefix, string authType)
+ {
+ int longestPrefix = -1;
+ NetworkCredential result = null;
+
+ if (uriPrefix == null || authType == null)
+ return null;
+
+ string absPath = uriPrefix.AbsolutePath;
+ absPath = absPath.Substring (0, absPath.LastIndexOf ('/'));
+
+ IDictionaryEnumerator e = cache.GetEnumerator ();
+ while (e.MoveNext ()) {
+ CredentialCacheKey key = e.Key as CredentialCacheKey;
+
+ if (key.Length <= longestPrefix)
+ continue;
+
+ if (String.Compare (key.AuthType, authType, true) != 0)
+ continue;
+
+ Uri cachedUri = key.UriPrefix;
+
+ if (cachedUri.Scheme != uriPrefix.Scheme)
+ continue;
+
+ if (cachedUri.Port != uriPrefix.Port)
+ continue;
+
+ if (cachedUri.Host != uriPrefix.Host)
+ continue;
+
+ if (!absPath.StartsWith (key.AbsPath))
+ continue;
+
+ longestPrefix = key.Length;
+ result = (NetworkCredential) e.Value;
+ }
+
+ return result;
+ }
+
+ // IEnumerable
+
+ public IEnumerator GetEnumerator ()
+ {
+ return cache.Values.GetEnumerator ();
+ }
+
+ // Methods
+
+ public void Add (Uri uriPrefix, string authType, NetworkCredential cred)
+ {
+ if (uriPrefix == null)
+ throw new ArgumentNullException ("uriPrefix");
+
+ if (authType == null)
+ throw new ArgumentNullException ("authType");
+
+ // throws ArgumentException when same key already exists.
+ cache.Add (new CredentialCacheKey (uriPrefix, authType), cred);
+ }
+
+ public void Remove (Uri uriPrefix, string authType)
+ {
+ if (uriPrefix == null)
+ throw new ArgumentNullException ("uriPrefix");
+
+ if (authType == null)
+ throw new ArgumentNullException ("authType");
+
+ cache.Remove (new CredentialCacheKey (uriPrefix, authType));
+ }
+
+ // Inner Classes
+
+ internal class CredentialCacheKey
+ {
+ private Uri uriPrefix;
+ private string authType;
+
+ private string absPath;
+ private int len;
+ private int hash;
+
+ internal CredentialCacheKey (Uri uriPrefix, string authType)
+ {
+ this.uriPrefix = uriPrefix;
+ this.authType = authType;
+
+ this.absPath = uriPrefix.AbsolutePath;
+ this.absPath = absPath.Substring (0, absPath.LastIndexOf ('/'));
+
+ this.len = uriPrefix.AbsoluteUri.Length;
+ this.hash = uriPrefix.GetHashCode ()
+ + authType.ToString ().GetHashCode ();
+ }
+
+ public int Length {
+ get { return len; }
+ }
+
+ public string AbsPath {
+ get { return absPath; }
+ }
+
+ public Uri UriPrefix {
+ get { return uriPrefix; }
+ }
+
+ public string AuthType {
+ get { return authType; }
+ }
+
+ public override int GetHashCode ()
+ {
+ return hash;
+ }
+
+ public override bool Equals (object obj)
+ {
+ CredentialCacheKey key = obj as CredentialCacheKey;
+ return ((key != null) && (this.hash == key.hash));
+ }
+
+ public override string ToString ()
+ {
+ return absPath + " : " + authType + " : len=" + len;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net/Dns.cs b/mcs/class/System/System.Net/Dns.cs
new file mode 100644
index 00000000000..60eddad1468
--- /dev/null
+++ b/mcs/class/System/System.Net/Dns.cs
@@ -0,0 +1,155 @@
+// System.Net.Dns.cs
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+// Author: Lawrence Pit (loz@cable.a2000.nl)
+//
+// (C) Mads Pultz, 2001
+
+using System;
+using System.Net.Sockets;
+using System.Text;
+using System.Collections;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Net {
+ public sealed class Dns {
+
+ private Dns () {}
+
+ private delegate IPHostEntry GetHostByNameCallback (string hostName);
+ private delegate IPHostEntry ResolveCallback (string hostName);
+
+ public static IAsyncResult BeginGetHostByName (string hostName,
+ AsyncCallback requestCallback, object stateObject)
+ {
+ if (hostName == null)
+ throw new ArgumentNullException();
+ GetHostByNameCallback c = new GetHostByNameCallback (GetHostByName);
+ return c.BeginInvoke (hostName, requestCallback, stateObject);
+ }
+
+ public static IAsyncResult BeginResolve (string hostName,
+ AsyncCallback requestCallback, object stateObject)
+ {
+ if (hostName == null)
+ throw new ArgumentNullException();
+ ResolveCallback c = new ResolveCallback (Resolve);
+ return c.BeginInvoke (hostName, requestCallback, stateObject);
+ }
+
+ public static IPHostEntry EndGetHostByName (IAsyncResult asyncResult) {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+ AsyncResult async = (AsyncResult) asyncResult;
+ GetHostByNameCallback cb = (GetHostByNameCallback) async.AsyncDelegate;
+ asyncResult.AsyncWaitHandle.WaitOne ();
+ return cb.EndInvoke(asyncResult);
+ }
+
+ public static IPHostEntry EndResolve (IAsyncResult asyncResult) {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+ AsyncResult async = (AsyncResult) asyncResult;
+ ResolveCallback cb = (ResolveCallback) async.AsyncDelegate;
+ asyncResult.AsyncWaitHandle.WaitOne ();
+ return cb.EndInvoke(asyncResult);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool GetHostByName_internal(string host, out string h_name, out string[] h_aliases, out string[] h_addr_list);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool GetHostByAddr_internal(string addr, out string h_name, out string[] h_aliases, out string[] h_addr_list);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool GetHostName_internal(out string h_name);
+
+ private static IPHostEntry hostent_to_IPHostEntry(string h_name, string[] h_aliases, string[] h_addrlist) {
+ IPHostEntry he = new IPHostEntry();
+ IPAddress[] addrlist = new IPAddress[h_addrlist.Length];
+
+ he.HostName=h_name;
+ he.Aliases=h_aliases;
+ for(int i=0; i<h_addrlist.Length; i++) {
+ addrlist[i]=IPAddress.Parse(h_addrlist[i]);
+ }
+ he.AddressList=addrlist;
+
+ return(he);
+ }
+
+ public static IPHostEntry GetHostByAddress(IPAddress address) {
+ if (address == null)
+ throw new ArgumentNullException();
+ return GetHostByAddress(address.ToString());
+ }
+
+ public static IPHostEntry GetHostByAddress(string address) {
+ if (address == null) {
+ throw new ArgumentNullException();
+ }
+
+ string h_name;
+ string[] h_aliases, h_addrlist;
+
+ bool ret = GetHostByAddr_internal(address, out h_name,
+ out h_aliases,
+ out h_addrlist);
+ if (ret == false) {
+ throw new SocketException(11001);
+ }
+
+ return(hostent_to_IPHostEntry(h_name, h_aliases,
+ h_addrlist));
+ }
+
+ public static IPHostEntry GetHostByName(string hostName) {
+ if (hostName == null)
+ throw new ArgumentNullException();
+
+ string h_name;
+ string[] h_aliases, h_addrlist;
+
+ bool ret = GetHostByName_internal(hostName, out h_name,
+ out h_aliases,
+ out h_addrlist);
+ if (ret == false)
+ throw new SocketException(11001);
+
+ return(hostent_to_IPHostEntry(h_name, h_aliases,
+ h_addrlist));
+ }
+
+ /// <summary>
+ /// This method returns the host name associated with the local host.
+ /// </summary>
+ public static string GetHostName() {
+ string hostName;
+
+ bool ret = GetHostName_internal(out hostName);
+
+ if (ret == false)
+ throw new SocketException(11001);
+
+ return hostName;
+ }
+
+ /// <summary>
+ /// This method resolves a DNS-style host name or IP
+ /// address.
+ /// </summary>
+ /// <param name=hostName>
+ /// A string containing either a DNS-style host name (e.g.
+ /// www.go-mono.com) or IP address (e.g. 129.250.184.233).
+ /// </param>
+ public static IPHostEntry Resolve(string hostName) {
+ if (hostName == null)
+ throw new ArgumentNullException();
+
+ return GetHostByName (hostName);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net/DnsPermission.cs b/mcs/class/System/System.Net/DnsPermission.cs
new file mode 100644
index 00000000000..e60a0fca65d
--- /dev/null
+++ b/mcs/class/System/System.Net/DnsPermission.cs
@@ -0,0 +1,139 @@
+//
+// System.Net.DnsPermission.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Net
+{
+ [Serializable]
+ public sealed class DnsPermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ // Fields
+ bool m_noRestriction;
+
+ // Constructors
+ public DnsPermission (PermissionState state) : base ()
+ {
+ m_noRestriction = (state == PermissionState.Unrestricted);
+ }
+
+ // Methods
+
+ public override IPermission Copy ()
+ {
+ // this is immutable.
+ return this;
+ }
+
+ public override IPermission Intersect (IPermission target)
+ {
+ // LAMESPEC: says to throw an exception when null
+ // but at same time it says to return null. We'll
+ // follow MS behaviour.
+ if (target == null)
+ return null;
+
+ DnsPermission perm = target as DnsPermission;
+
+ if (perm == null)
+ throw new ArgumentException ("Argument not of type DnsPermission");
+
+ if (this.m_noRestriction && perm.m_noRestriction)
+ return this;
+
+ return this.m_noRestriction ? perm : this;
+ }
+
+ public override bool IsSubsetOf (IPermission target)
+ {
+ if (target == null)
+ return !m_noRestriction;
+
+ DnsPermission perm = target as DnsPermission;
+
+ if (perm == null)
+ throw new ArgumentException ("Argument not of type DnsPermission");
+
+ return !this.m_noRestriction || perm.m_noRestriction;
+ }
+
+ public bool IsUnrestricted ()
+ {
+ return this.m_noRestriction;
+ }
+
+ /*
+
+ DnsPermission dns1 = new DnsPermission (PermissionState.None);
+ Console.WriteLine (dns1.ToXml ().ToString ());
+
+ DnsPermission dns2 = new DnsPermission (PermissionState.Unrestricted);
+ Console.WriteLine (dns2.ToXml ().ToString ());
+
+ This is the sample xml output:
+
+ <IPermission class="System.Net.DnsPermission, System, Version=1.0.3300.0, Cultur
+ e=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1"/>
+
+ <IPermission class="System.Net.DnsPermission, System, Version=1.0.3300.0, Cultur
+ e=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1"
+ Unrestricted="true"/>
+ */
+ public override SecurityElement ToXml ()
+ {
+
+ SecurityElement root = new SecurityElement ("IPermission");
+ root.AddAttribute ("class", this.GetType ().AssemblyQualifiedName);
+ root.AddAttribute ("version", "1");
+ if (m_noRestriction)
+ root.AddAttribute ("Unrestricted", "true");
+
+ return root;
+ }
+
+ public override void FromXml (SecurityElement securityElement)
+ {
+ if (securityElement == null)
+ throw new ArgumentNullException ("securityElement");
+
+ // LAMESPEC: it says to throw an ArgumentNullException in this case
+ if (securityElement.Tag != "IPermission")
+ throw new ArgumentException ("securityElement");
+
+ string classStr = securityElement.Attribute ("class");
+ if (classStr == null || !classStr.StartsWith (this.GetType ().FullName + ","))
+ throw new ArgumentException ("securityElement");
+
+ string unrestricted = securityElement.Attribute ("Unrestricted");
+ if (unrestricted != null)
+ this.m_noRestriction = (String.Compare (unrestricted, "true", true) == 0);
+ }
+
+ public override IPermission Union (IPermission target)
+ {
+ // LAMESPEC: according to spec we should throw an
+ // exception when target is null. We'll follow the
+ // behaviour of MS.Net instead of the spec.
+ if (target == null)
+ return this;
+ // throw new ArgumentNullException ("target");
+
+ DnsPermission perm = target as DnsPermission;
+
+ if (perm == null)
+ throw new ArgumentException ("Argument not of type DnsPermission");
+
+ return this.m_noRestriction ? this : perm;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net/DnsPermissionAttribute.cs b/mcs/class/System/System.Net/DnsPermissionAttribute.cs
new file mode 100644
index 00000000000..5b8a3a18f45
--- /dev/null
+++ b/mcs/class/System/System.Net/DnsPermissionAttribute.cs
@@ -0,0 +1,38 @@
+//
+// System.Net.DnsPermissionAttribute.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Net
+{
+ [AttributeUsage (AttributeTargets.Assembly
+ | AttributeTargets.Class
+ | AttributeTargets.Struct
+ | AttributeTargets.Constructor
+ | AttributeTargets.Method)
+ ]
+ [Serializable]
+ public sealed class DnsPermissionAttribute : CodeAccessSecurityAttribute
+ {
+
+ // Constructors
+ public DnsPermissionAttribute (SecurityAction action) : base (action)
+ {
+ }
+
+ // Methods
+
+ public override IPermission CreatePermission () {
+ return new DnsPermission (
+ this.Unrestricted ?
+ PermissionState.Unrestricted :
+ PermissionState.None);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/EndPoint.cs b/mcs/class/System/System.Net/EndPoint.cs
index d35cad86757..5e1d81f98dc 100755
--- a/mcs/class/System/System.Net/EndPoint.cs
+++ b/mcs/class/System/System.Net/EndPoint.cs
@@ -2,32 +2,39 @@
// System.Net.EndPoint.cs
//
// Author:
-// Miguel de Icaza (miguel@ximian.com)
+// Dick Porter (dick@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Net.Sockets;
+
namespace System.Net {
+ [Serializable]
+ public abstract class EndPoint {
- public class EndPoint {
+ // NB: These methods really do nothing but throw
+ // NotSupportedException
+
+ public virtual AddressFamily AddressFamily {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
public virtual EndPoint Create (SocketAddress address)
{
+ throw new NotSupportedException();
}
public virtual SocketAddress Serialize ()
{
+ throw new NotSupportedException();
}
protected EndPoint ()
{
}
-
- public int AddressFamily {
- virtual get {
- }
- }
-
-
}
}
diff --git a/mcs/class/System/System.Net/EndpointPermission.cs b/mcs/class/System/System.Net/EndpointPermission.cs
new file mode 100644
index 00000000000..ca895c75694
--- /dev/null
+++ b/mcs/class/System/System.Net/EndpointPermission.cs
@@ -0,0 +1,326 @@
+//
+// System.Net.EndpointPermission.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Net
+{
+ [Serializable]
+ public class EndpointPermission // too bad about the lowercase p, not consistent with IPEndPoint ;)
+ {
+ private static char [] dot_char = new char [] { '.' };
+
+ // Fields
+ private string hostname;
+ private int port;
+ private TransportType transport;
+
+ private bool resolved;
+ private bool hasWildcard;
+ private IPAddress [] addresses;
+
+ // Constructors
+ internal EndpointPermission (string hostname,
+ int port,
+ TransportType transport) : base ()
+ {
+ if (hostname == null)
+ throw new ArgumentNullException ("hostname");
+ this.hostname = hostname;
+ this.port = port;
+ this.transport = transport;
+ this.resolved = false;
+ this.hasWildcard = false;
+ this.addresses = null;
+ }
+
+ // Properties
+
+ public string Hostname {
+ get { return hostname; }
+ }
+
+ public int Port {
+ get { return port; }
+ }
+
+ public TransportType Transport {
+ get { return transport; }
+ }
+
+ // Methods
+
+ public override bool Equals (object obj)
+ {
+ EndpointPermission epp = obj as EndpointPermission;
+ return ((epp != null) &&
+ (this.port == epp.port) &&
+ (this.transport == epp.transport) &&
+ (String.Compare (this.hostname, epp.hostname, true) == 0));
+ }
+
+ public override int GetHashCode ()
+ {
+ return ToString ().GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return hostname + "#" + port + "#" + (int) transport;
+ }
+
+ // Internal & Private Methods
+
+ internal bool IsSubsetOf (EndpointPermission perm)
+ {
+ if (perm == null)
+ return false;
+
+ if (perm.port != SocketPermission.AllPorts &&
+ this.port != perm.port)
+ return false;
+
+ if (perm.transport != TransportType.All &&
+ this.transport != perm.transport)
+ return false;
+
+ this.Resolve ();
+ perm.Resolve ();
+
+ if (this.hasWildcard) {
+ if (perm.hasWildcard)
+ return IsSubsetOf (this.hostname, perm.hostname);
+ else
+ return false;
+ }
+
+ if (this.addresses == null)
+ return false;
+
+ if (perm.hasWildcard)
+ // a bit dubious... should they all be a subset or is one
+ // enough in this case?
+ foreach (IPAddress addr in this.addresses)
+ if (IsSubsetOf (addr.ToString (), perm.hostname))
+ return true;
+
+ if (perm.addresses == null)
+ return false;
+
+ // a bit dubious... should they all be a subset or is one
+ // enough in this case?
+ foreach (IPAddress addr in perm.addresses)
+ if (IsSubsetOf (this.hostname, addr.ToString ()))
+ return true;
+
+ return false;
+ }
+
+ private bool IsSubsetOf (string addr1, string addr2)
+ {
+ string [] h1 = addr1.Split (dot_char);
+ string [] h2 = addr2.Split (dot_char);
+
+ for (int i = 0; i < 4; i++) {
+ int part1 = ToNumber (h1 [i]);
+ if (part1 == -1)
+ return false;
+
+ int part2 = ToNumber (h2 [i]);
+ if (part2 == -1)
+ return false;
+ if (part1 != part2 && part2 != 256)
+ return false;
+ }
+ return true;
+ }
+
+ internal EndpointPermission Intersect (EndpointPermission perm)
+ {
+ if (perm == null)
+ return null;
+
+ int _port;
+ if (this.port == perm.port)
+ _port = this.port;
+ else if (this.port == SocketPermission.AllPorts)
+ _port = perm.port;
+ else if (perm.port == SocketPermission.AllPorts)
+ _port = this.port;
+ else
+ return null;
+
+ TransportType _transport;
+ if (this.transport == perm.transport)
+ _transport = this.transport;
+ else if (this.transport == TransportType.All)
+ _transport = perm.transport;
+ else if (perm.transport == TransportType.All)
+ _transport = this.transport;
+ else
+ return null;
+
+ string _hostname = IntersectHostname (perm);
+
+ if (_hostname == null)
+ return null;
+
+ if (!this.hasWildcard)
+ return this;
+
+ if (!perm.hasWildcard)
+ return perm;
+
+ EndpointPermission newperm = new EndpointPermission (_hostname, _port, _transport);
+ newperm.hasWildcard = true;
+ newperm.resolved = true;
+ return newperm;
+ }
+
+ private string IntersectHostname (EndpointPermission perm)
+ {
+ if (this.hostname == perm.hostname)
+ return this.hostname;
+
+ this.Resolve ();
+ perm.Resolve ();
+
+ string _hostname = null;
+
+ if (this.hasWildcard) {
+ if (perm.hasWildcard) {
+ _hostname = Intersect (this.hostname, perm.hostname);
+ } else if (perm.addresses != null) {
+ for (int j = 0; j < perm.addresses.Length; j++) {
+ _hostname = Intersect (this.hostname, perm.addresses [j].ToString ());
+ if (_hostname != null)
+ break;
+ }
+ }
+ } else if (this.addresses != null) {
+ for (int i = 0; i < this.addresses.Length; i++) {
+ string thisaddr = this.addresses [i].ToString ();
+ if (perm.hasWildcard) {
+ _hostname = Intersect (thisaddr, perm.hostname);
+ } else if (perm.addresses != null) {
+ for (int j = 0; j < perm.addresses.Length; j++) {
+ _hostname = Intersect (thisaddr, perm.addresses [j].ToString ());
+ if (_hostname != null)
+ break;
+ }
+ }
+ }
+ }
+
+ return _hostname;
+ }
+
+ // alas, currently we'll only support IPv4 as that's MS.Net behaviour
+ // returns null when both host strings do not intersect
+ private string Intersect (string addr1, string addr2)
+ {
+ string [] h1 = addr1.Split (dot_char);
+ string [] h2 = addr2.Split (dot_char);
+
+ string [] s = new string [7];
+ for (int i = 0; i < 4; i++) {
+ int part1 = ToNumber (h1 [i]);
+ if (part1 == -1)
+ return null;
+
+ int part2 = ToNumber (h2 [i]);
+ if (part2 == -1)
+ return null;
+
+ if (part1 == 256)
+ s [i << 1] = (part2 == 256) ? "*" : String.Empty + part2;
+ else if (part2 == 256)
+ s [i << 1] = (part1 == 256) ? "*" : String.Empty + part1;
+ else if (part1 == part2)
+ s [i << 1] = String.Empty + part1;
+ else
+ return null;
+ }
+
+ s [1] = s [3] = s [5] = ".";
+ return String.Concat (s);
+ }
+
+ // returns 256 if value is a '*' character
+ // returns -1 if value isn't a number between 0 and 255
+ private int ToNumber (string value)
+ {
+ if (value == "*")
+ return 256;
+
+ int len = value.Length;
+ if (len < 1 || len > 3)
+ return -1;
+
+ int val = 0;
+ for (int i = 0; i < len; i++) {
+ char c = value [i];
+ if ('0' <= c && c <= '9')
+ val = checked (val * 10 + (c - '0'));
+ else
+ return -1;
+ }
+
+ return val <= 255 ? val : -1;
+ }
+
+ internal void Resolve ()
+ {
+ if (resolved)
+ return;
+
+ bool isHostname = false;
+ bool hasWildcard = false;
+ this.addresses = null;
+
+ string [] s = hostname.Split (dot_char);
+
+ if (s.Length != 4) {
+ isHostname = true;
+ } else {
+ for (int i = 0; i < 4; i++) {
+ int quad = ToNumber (s [i]);
+ if (quad == -1) {
+ isHostname = true;
+ break;
+ }
+ if (quad == 256)
+ hasWildcard = true;
+ }
+ }
+
+ if (isHostname) {
+ this.hasWildcard = false;
+ try {
+ this.addresses = Dns.GetHostByName (hostname).AddressList;
+ } catch (System.Net.Sockets.SocketException) {
+ }
+ } else {
+ this.hasWildcard = hasWildcard;
+ if (!hasWildcard) {
+ addresses = new IPAddress [1];
+ addresses [0] = IPAddress.Parse (hostname);
+ }
+ }
+
+ this.resolved = true;
+ }
+
+ internal void UndoResolve ()
+ {
+ resolved = false;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/FileWebRequest.cs b/mcs/class/System/System.Net/FileWebRequest.cs
new file mode 100644
index 00000000000..899c10f7676
--- /dev/null
+++ b/mcs/class/System/System.Net/FileWebRequest.cs
@@ -0,0 +1,295 @@
+//
+// System.Net.FileWebRequest
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Remoting.Messaging;
+using System.Threading;
+
+namespace System.Net
+{
+ [Serializable]
+ public class FileWebRequest : WebRequest, ISerializable
+ {
+ private Uri uri;
+ private WebHeaderCollection webHeaders;
+
+ private ICredentials credentials;
+ private string connectionGroup;
+ private string method;
+ private int timeout;
+
+ private Stream requestStream = null;
+ private FileWebResponse webResponse = null;
+ private AutoResetEvent requestEndEvent = null;
+ private bool requesting = false;
+ private bool asyncResponding = false;
+
+ // Constructors
+
+ internal FileWebRequest (Uri uri)
+ {
+ this.uri = uri;
+ this.webHeaders = new WebHeaderCollection ();
+ this.method = "GET";
+ this.timeout = System.Threading.Timeout.Infinite;
+ }
+
+ [MonoTODO]
+ protected FileWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Properties
+
+ // currently not used according to spec
+ public override string ConnectionGroupName {
+ get { return connectionGroup; }
+ set { connectionGroup = value; }
+ }
+
+ public override long ContentLength {
+ get {
+ try {
+ return Int64.Parse (webHeaders ["Content-Length"]);
+ } catch (Exception) {
+ return 0;
+ }
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("value");
+ webHeaders ["Content-Length"] = Convert.ToString (value);
+ }
+ }
+
+ public override string ContentType {
+ get { return webHeaders ["Content-Type"]; }
+ set { webHeaders ["Content-Type"] = value; }
+ }
+
+ public override ICredentials Credentials {
+ get { return credentials; }
+ set { credentials = value; }
+ }
+
+ public override WebHeaderCollection Headers {
+ get { return webHeaders; }
+ }
+
+ // currently not used according to spec
+ public override string Method {
+ get { return this.method; }
+ set { this.method = value; }
+ }
+
+ // currently not used according to spec
+ public override bool PreAuthenticate {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ // currently not used according to spec
+ public override IWebProxy Proxy {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public override Uri RequestUri {
+ get { return this.uri; }
+ }
+
+ public override int Timeout {
+ get { return timeout; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("value");
+ timeout = value;
+ }
+ }
+
+ // Methods
+
+ private delegate Stream GetRequestStreamCallback ();
+ private delegate WebResponse GetResponseCallback ();
+
+ public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+ {
+ if (method == null || (!method.Equals ("PUT") && !method.Equals ("POST")))
+ throw new ProtocolViolationException ("Cannot send file when method is: " + this.method + ". Method must be PUT.");
+ // workaround for bug 24943
+ Exception e = null;
+ lock (this) {
+ if (asyncResponding || webResponse != null)
+ e = new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");
+ else if (requesting)
+ e = new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ else
+ requesting = true;
+ }
+ if (e != null)
+ throw e;
+ /*
+ lock (this) {
+ if (asyncResponding || webResponse != null)
+ throw new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");
+ if (requesting)
+ throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ requesting = true;
+ }
+ */
+ GetRequestStreamCallback c = new GetRequestStreamCallback (this.GetRequestStreamInternal);
+ return c.BeginInvoke (callback, state);
+ }
+
+ public override Stream EndGetRequestStream (IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+ if (!asyncResult.IsCompleted)
+ asyncResult.AsyncWaitHandle.WaitOne ();
+ AsyncResult async = (AsyncResult) asyncResult;
+ GetRequestStreamCallback cb = (GetRequestStreamCallback) async.AsyncDelegate;
+ return cb.EndInvoke (asyncResult);
+ }
+
+ public override Stream GetRequestStream()
+ {
+ IAsyncResult asyncResult = BeginGetRequestStream (null, null);
+ if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {
+ throw new WebException("The request timed out", WebExceptionStatus.Timeout);
+ }
+ return EndGetRequestStream (asyncResult);
+ }
+
+ internal Stream GetRequestStreamInternal ()
+ {
+ this.requestStream = new FileWebStream (
+ this,
+ FileMode.CreateNew,
+ FileAccess.Write,
+ FileShare.Read);
+ return this.requestStream;
+ }
+
+ public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+ {
+ // workaround for bug 24943
+ Exception e = null;
+ lock (this) {
+ if (asyncResponding)
+ e = new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ else
+ asyncResponding = true;
+ }
+ if (e != null)
+ throw e;
+ /*
+ lock (this) {
+ if (asyncResponding)
+ throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ asyncResponding = true;
+ }
+ */
+ GetResponseCallback c = new GetResponseCallback (this.GetResponseInternal);
+ return c.BeginInvoke (callback, state);
+ }
+
+ public override WebResponse EndGetResponse (IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+ if (!asyncResult.IsCompleted)
+ asyncResult.AsyncWaitHandle.WaitOne ();
+ AsyncResult async = (AsyncResult) asyncResult;
+ GetResponseCallback cb = (GetResponseCallback) async.AsyncDelegate;
+ WebResponse webResponse = cb.EndInvoke(asyncResult);
+ asyncResponding = false;
+ return webResponse;
+ }
+
+ public override WebResponse GetResponse ()
+ {
+ IAsyncResult asyncResult = BeginGetResponse (null, null);
+ if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {
+ throw new WebException("The request timed out", WebExceptionStatus.Timeout);
+ }
+ return EndGetResponse (asyncResult);
+ }
+
+ public WebResponse GetResponseInternal ()
+ {
+ if (webResponse != null)
+ return webResponse;
+ lock (this) {
+ if (requesting) {
+ requestEndEvent = new AutoResetEvent (false);
+ }
+ }
+ if (requestEndEvent != null) {
+ requestEndEvent.WaitOne ();
+ }
+ FileStream fileStream = new FileWebStream (
+ this,
+ FileMode.Open,
+ FileAccess.Read,
+ FileShare.Read);
+ this.webResponse = new FileWebResponse (this.uri, fileStream);
+ return (WebResponse) this.webResponse;
+ }
+
+ [MonoTODO]
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal void Close ()
+ {
+ // already done in class below
+ // if (requestStream != null) {
+ // requestStream.Close ();
+ // }
+
+ lock (this) {
+ requesting = false;
+ if (requestEndEvent != null)
+ requestEndEvent.Set ();
+ // requestEndEvent = null;
+ }
+ }
+
+ // to catch the Close called on the FileStream
+ internal class FileWebStream : FileStream
+ {
+ FileWebRequest webRequest;
+
+ internal FileWebStream (FileWebRequest webRequest,
+ FileMode mode,
+ FileAccess access,
+ FileShare share)
+ : base (webRequest.RequestUri.LocalPath,
+ mode, access, share)
+ {
+ this.webRequest = webRequest;
+ }
+
+ public override void Close()
+ {
+ base.Close ();
+ FileWebRequest req = webRequest;
+ webRequest = null;
+ if (req != null)
+ req.Close ();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/FileWebResponse.cs b/mcs/class/System/System.Net/FileWebResponse.cs
new file mode 100644
index 00000000000..d4acb6e79e9
--- /dev/null
+++ b/mcs/class/System/System.Net/FileWebResponse.cs
@@ -0,0 +1,139 @@
+//
+// System.Net.FileWebResponse
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class FileWebResponse : WebResponse, ISerializable, IDisposable
+ {
+ private Uri responseUri;
+ private FileStream fileStream;
+ private long contentLength;
+ private WebHeaderCollection webHeaders;
+ private bool disposed = false;
+
+ // Constructors
+
+ protected FileWebResponse () { }
+
+ internal FileWebResponse (Uri responseUri, FileStream fileStream)
+ {
+ try {
+ this.responseUri = responseUri;
+ this.fileStream = fileStream;
+ this.contentLength = fileStream.Length;
+ this.webHeaders = new WebHeaderCollection ();
+ this.webHeaders.Add ("Content-Length", Convert.ToString (contentLength));
+ this.webHeaders.Add ("Content-Type", "binary/octet-stream");
+ } catch (Exception e) {
+ throw new WebException (e.Message, e);
+ }
+ }
+
+ [MonoTODO]
+ protected FileWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Properties
+
+ public override long ContentLength {
+ get {
+ try { return this.contentLength; }
+ finally { CheckDisposed (); }
+ }
+ }
+
+ public override string ContentType {
+ get {
+ try { return "binary/octet-stream"; }
+ finally { CheckDisposed (); }
+ }
+ }
+
+ public override WebHeaderCollection Headers {
+ get {
+ try { return this.webHeaders; }
+ finally { CheckDisposed (); }
+ }
+ }
+
+ public override Uri ResponseUri {
+ get {
+ try { return this.responseUri; }
+ finally { CheckDisposed (); }
+ }
+ }
+
+ // Methods
+
+ [MonoTODO]
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ try {
+ throw new NotImplementedException ();
+ } finally { CheckDisposed (); }
+ }
+
+ public override Stream GetResponseStream()
+ {
+ try { return this.fileStream; }
+ finally { CheckDisposed (); }
+ }
+
+ // Cleaning up stuff
+
+ ~FileWebResponse ()
+ {
+ Dispose (false);
+ }
+
+ public override void Close()
+ {
+ ((IDisposable) this).Dispose ();
+ }
+
+ void IDisposable.Dispose()
+ {
+ Dispose (true);
+
+ // see spec, suppress finalization of this object.
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (this.disposed)
+ return;
+ this.disposed = true;
+
+ if (disposing) {
+ // release managed resources
+ this.responseUri = null;
+ this.webHeaders = null;
+ }
+
+ // release unmanaged resources
+ FileStream stream = fileStream;
+ fileStream = null;
+ if (stream != null)
+ stream.Close (); // also closes webRequest
+ }
+
+ private void CheckDisposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException (GetType ().FullName);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/GlobalProxySelection.cs b/mcs/class/System/System.Net/GlobalProxySelection.cs
new file mode 100644
index 00000000000..d17683ced5b
--- /dev/null
+++ b/mcs/class/System/System.Net/GlobalProxySelection.cs
@@ -0,0 +1,74 @@
+//
+// System.Net.GlobalProxySelection
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ public class GlobalProxySelection
+ {
+ private static IWebProxy proxy;
+
+ // Static Initializer
+
+ static GlobalProxySelection ()
+ {
+ proxy = GetEmptyWebProxy ();
+
+ // TODO: create proxy object based on information from
+ // the global or application configuration file.
+ }
+
+ // Constructors
+
+ public GlobalProxySelection() { }
+
+ // Properties
+
+ public static IWebProxy Select {
+ get { return proxy; }
+ set {
+ proxy = (value == null) ? GetEmptyWebProxy () : value;
+ }
+ }
+
+ // Methods
+
+ public static IWebProxy GetEmptyWebProxy()
+ {
+ // must return a new one each time, as the credentials
+ // can be set
+ return new EmptyWebProxy ();
+ }
+
+ // Internal Classes
+
+ internal class EmptyWebProxy : IWebProxy {
+ private ICredentials credentials = null;
+
+ internal EmptyWebProxy () { }
+
+ public ICredentials Credentials {
+ get { return credentials; }
+ set { credentials = value; }
+ }
+
+ public Uri GetProxy (Uri destination)
+ {
+ return destination;
+ }
+
+ public bool IsBypassed (Uri host)
+ {
+ return true; // pass directly to host
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/HttpContinueDelegate.cs b/mcs/class/System/System.Net/HttpContinueDelegate.cs
new file mode 100644
index 00000000000..a8f4d1f4aaa
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpContinueDelegate.cs
@@ -0,0 +1,13 @@
+//
+// System.Net.HttpContinueDelegate.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+namespace System.Net
+{
+ public delegate void HttpContinueDelegate (
+ int StatusCode,
+ WebHeaderCollection httpHeaders);
+}
diff --git a/mcs/class/System/System.Net/HttpStatusCode.cs b/mcs/class/System/System.Net/HttpStatusCode.cs
new file mode 100755
index 00000000000..6688853fafc
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpStatusCode.cs
@@ -0,0 +1,205 @@
+// HttpStatusCode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:05 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum HttpStatusCode {
+
+ /// <summary>
+ /// </summary>
+ Continue = 100,
+
+ /// <summary>
+ /// </summary>
+ SwitchingProtocols = 101,
+
+ /// <summary>
+ /// </summary>
+ OK = 200,
+
+ /// <summary>
+ /// </summary>
+ Created = 201,
+
+ /// <summary>
+ /// </summary>
+ Accepted = 202,
+
+ /// <summary>
+ /// </summary>
+ NonAuthoritativeInformation = 203,
+
+ /// <summary>
+ /// </summary>
+ NoContent = 204,
+
+ /// <summary>
+ /// </summary>
+ ResetContent = 205,
+
+ /// <summary>
+ /// </summary>
+ PartialContent = 206,
+
+ /// <summary>
+ /// </summary>
+ MultipleChoices = 300,
+
+ /// <summary>
+ /// </summary>
+ Ambiguous = 300,
+
+ /// <summary>
+ /// </summary>
+ MovedPermanently = 301,
+
+ /// <summary>
+ /// </summary>
+ Moved = 301,
+
+ /// <summary>
+ /// </summary>
+ Found = 302,
+
+ /// <summary>
+ /// </summary>
+ Redirect = 302,
+
+ /// <summary>
+ /// </summary>
+ SeeOther = 303,
+
+ /// <summary>
+ /// </summary>
+ RedirectMethod = 303,
+
+ /// <summary>
+ /// </summary>
+ NotModified = 304,
+
+ /// <summary>
+ /// </summary>
+ UseProxy = 305,
+
+ /// <summary>
+ /// </summary>
+ Unused = 306,
+
+ /// <summary>
+ /// </summary>
+ TemporaryRedirect = 307,
+
+ /// <summary>
+ /// </summary>
+ RedirectKeepVerb = 307,
+
+ /// <summary>
+ /// </summary>
+ BadRequest = 400,
+
+ /// <summary>
+ /// </summary>
+ Unauthorized = 401,
+
+ /// <summary>
+ /// </summary>
+ PaymentRequired = 402,
+
+ /// <summary>
+ /// </summary>
+ Forbidden = 403,
+
+ /// <summary>
+ /// </summary>
+ NotFound = 404,
+
+ /// <summary>
+ /// </summary>
+ MethodNotAllowed = 405,
+
+ /// <summary>
+ /// </summary>
+ NotAcceptable = 406,
+
+ /// <summary>
+ /// </summary>
+ ProxyAuthenticationRequired = 407,
+
+ /// <summary>
+ /// </summary>
+ RequestTimeout = 408,
+
+ /// <summary>
+ /// </summary>
+ Conflict = 409,
+
+ /// <summary>
+ /// </summary>
+ Gone = 410,
+
+ /// <summary>
+ /// </summary>
+ LengthRequired = 411,
+
+ /// <summary>
+ /// </summary>
+ PreconditionFailed = 412,
+
+ /// <summary>
+ /// </summary>
+ RequestEntityTooLarge = 413,
+
+ /// <summary>
+ /// </summary>
+ RequestUriTooLong = 414,
+
+ /// <summary>
+ /// </summary>
+ UnsupportedMediaType = 415,
+
+ /// <summary>
+ /// </summary>
+ RequestedRangeNotSatisfiable = 416,
+
+ /// <summary>
+ /// </summary>
+ ExpectationFailed = 417,
+
+ /// <summary>
+ /// </summary>
+ InternalServerError = 500,
+
+ /// <summary>
+ /// </summary>
+ NotImplemented = 501,
+
+ /// <summary>
+ /// </summary>
+ BadGateway = 502,
+
+ /// <summary>
+ /// </summary>
+ ServiceUnavailable = 503,
+
+ /// <summary>
+ /// </summary>
+ GatewayTimeout = 504,
+
+ /// <summary>
+ /// </summary>
+ HttpVersionNotSupported = 505,
+ } // HttpStatusCode
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/HttpVersion.cs b/mcs/class/System/System.Net/HttpVersion.cs
new file mode 100644
index 00000000000..7172fbce27e
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpVersion.cs
@@ -0,0 +1,22 @@
+//
+// System.Net.HttpVersion.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+
+namespace System.Net {
+
+ // <remarks>
+ // </remarks>
+ public class HttpVersion {
+
+ public static readonly Version Version10 = new Version (1, 0);
+ public static readonly Version Version11 = new Version (1, 1);
+
+ // pretty useless..
+ public HttpVersion () {}
+ }
+}
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs
new file mode 100644
index 00000000000..f83ee2a1e37
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -0,0 +1,606 @@
+//
+// System.Net.HttpWebRequest
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Net.Sockets;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading;
+
+namespace System.Net
+{
+ [Serializable]
+ public class HttpWebRequest : WebRequest, ISerializable
+ {
+ private Uri requestUri;
+ private Uri actualUri = null;
+ private bool allowAutoRedirect = true;
+ private bool allowBuffering = true;
+ private X509CertificateCollection certificate = null;
+ private string connectionGroup = null;
+ private long contentLength = -1;
+ private HttpContinueDelegate continueDelegate = null;
+ private CookieContainer cookieContainer = null;
+ private ICredentials credentials = null;
+ private bool haveResponse = false;
+ private WebHeaderCollection webHeaders;
+ private bool keepAlive = true;
+ private int maxAutoRedirect = 50;
+ private string mediaType = String.Empty;
+ private string method;
+ private bool pipelined = true;
+ private bool preAuthenticate = false;
+ private Version version;
+ private IWebProxy proxy;
+ private bool sendChunked = false;
+ private ServicePoint servicePoint = null;
+ private int timeout = System.Threading.Timeout.Infinite;
+
+ private Stream requestStream = null;
+ private HttpWebResponse webResponse = null;
+ private AutoResetEvent requestEndEvent = null;
+ private bool requesting = false;
+ private bool asyncResponding = false;
+
+ // Constructors
+
+ internal HttpWebRequest (Uri uri)
+ {
+ this.requestUri = uri;
+ this.actualUri = uri;
+ this.webHeaders = new WebHeaderCollection (true);
+ this.webHeaders.SetInternal ("Host", uri.Authority);
+ this.webHeaders.SetInternal ("Date", DateTime.Now.ToUniversalTime ().ToString ("r", null));
+ this.webHeaders.SetInternal ("Expect", "100-continue");
+ this.method = "GET";
+ this.version = HttpVersion.Version11;
+ this.proxy = GlobalProxySelection.Select;
+ }
+
+ [MonoTODO]
+ protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Properties
+
+ public string Accept {
+ get { return webHeaders ["Accept"]; }
+ set {
+ CheckRequestStarted ();
+ webHeaders.SetInternal ("Accept", value);
+ }
+ }
+
+ public Uri Address {
+ get { return actualUri; }
+ }
+
+ public bool AllowAutoRedirect {
+ get { return allowAutoRedirect; }
+ set { this.allowAutoRedirect = value; }
+ }
+
+ public bool AllowWriteStreamBuffering {
+ get { return allowBuffering; }
+ set { this.allowBuffering = value; }
+ }
+
+ public X509CertificateCollection ClientCertificates {
+ get { return certificate; }
+ }
+
+ public string Connection {
+ get { return webHeaders ["Connection"]; }
+ set {
+ CheckRequestStarted ();
+ string val = value;
+ if (val != null)
+ val = val.Trim ().ToLower ();
+ if (val == null || val.Length == 0) {
+ webHeaders.RemoveInternal ("Connection");
+ return;
+ }
+ if (val == "keep-alive" || val == "close")
+ throw new ArgumentException ("value");
+ if (KeepAlive && val.IndexOf ("keep-alive") == -1)
+ value = value + ", Keep-Alive";
+
+ webHeaders.SetInternal ("Connection", value);
+ }
+ }
+
+ public override string ConnectionGroupName {
+ get { return connectionGroup; }
+ set { connectionGroup = value; }
+ }
+
+ public override long ContentLength {
+ get { return contentLength; }
+ set {
+ CheckRequestStarted ();
+ if (value < 0)
+ throw new ArgumentException ("value");
+ contentLength = value;
+ webHeaders.SetInternal ("Content-Length", Convert.ToString (value));
+ }
+ }
+
+ public override string ContentType {
+ get { return webHeaders ["Content-Type"]; }
+ set {
+ CheckRequestStarted ();
+ if (value == null || value.Trim().Length == 0) {
+ webHeaders.RemoveInternal ("Content-Type");
+ return;
+ }
+ webHeaders.SetInternal ("Content-Type", value);
+ }
+ }
+
+ public HttpContinueDelegate ContinueDelegate {
+ get { return continueDelegate; }
+ set { continueDelegate = value; }
+ }
+
+ public CookieContainer CookieContainer {
+ get { return cookieContainer; }
+ set { cookieContainer = value; }
+ }
+
+ public override ICredentials Credentials {
+ get { return credentials; }
+ set { credentials = value; }
+ }
+
+ public string Expect {
+ get { return webHeaders ["Expect"]; }
+ set {
+ CheckRequestStarted ();
+ string val = value;
+ if (val != null)
+ val = val.Trim ().ToLower ();
+ if (val == null || val.Length == 0) {
+ webHeaders.RemoveInternal ("Expect");
+ return;
+ }
+ if (val == "100-continue")
+ throw new ArgumentException ("value");
+ webHeaders.SetInternal ("Expect", value);
+ }
+ }
+
+ public bool HaveResponse {
+ get { return haveResponse; }
+ }
+
+ public override WebHeaderCollection Headers {
+ get { return webHeaders; }
+ set {
+ CheckRequestStarted ();
+ WebHeaderCollection newHeaders = new WebHeaderCollection (true);
+ int count = value.Count;
+ for (int i = 0; i < count; i++)
+ newHeaders.Add (value.GetKey (i), value.Get (i));
+ newHeaders.SetInternal ("Host", this.webHeaders["Host"]);
+ newHeaders.SetInternal ("Date", this.webHeaders["Date"]);
+ newHeaders.SetInternal ("Expect", this.webHeaders["Expect"]);
+ newHeaders.SetInternal ("Connection", this.webHeaders["Connection"]);
+ webHeaders = newHeaders;
+ }
+ }
+
+ public DateTime IfModifiedSince {
+ get {
+ string str = webHeaders ["If-Modified-Since"];
+ if (str == null)
+ return DateTime.Now;
+ try {
+ return MonoHttpDate.Parse (str);
+ } catch (Exception) {
+ return DateTime.Now;
+ }
+ }
+ set {
+ CheckRequestStarted ();
+ // rfc-1123 pattern
+ webHeaders.SetInternal ("If-Modified-Since",
+ value.ToUniversalTime ().ToString ("r", null));
+ // TODO: check last param when using different locale
+ }
+ }
+
+ public bool KeepAlive {
+ get {
+ CheckRequestStarted ();
+ return keepAlive;
+ }
+ set {
+ CheckRequestStarted ();
+ keepAlive = value;
+ if (Connection == null)
+ webHeaders.SetInternal ("Connection", value ? "Keep-Alive" : "Close");
+ }
+ }
+
+ public int MaximumAutomaticRedirections {
+ get { return maxAutoRedirect; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("value");
+ maxAutoRedirect = value;
+ }
+ }
+
+ public string MediaType {
+ get { return mediaType; }
+ set {
+ CheckRequestStarted ();
+ mediaType = value;
+ }
+ }
+
+ public override string Method {
+ get { return this.method; }
+ set {
+ CheckRequestStarted ();
+
+ if (value == null ||
+ (value != "GET" &&
+ value != "HEAD" &&
+ value != "POST" &&
+ value != "PUT" &&
+ value != "DELETE" &&
+ value != "TRACE" &&
+ value != "OPTIONS"))
+ throw new ArgumentException ("not a valid method");
+ if (contentLength != -1 &&
+ value != "POST" &&
+ value != "PUT")
+ throw new ArgumentException ("method must be PUT or POST");
+
+ method = value;
+ }
+ }
+
+ public bool Pipelined {
+ get { return pipelined; }
+ set { this.pipelined = value; }
+ }
+
+ public override bool PreAuthenticate {
+ get { return preAuthenticate; }
+ set { preAuthenticate = value; }
+ }
+
+ public Version ProtocolVersion {
+ get { return version; }
+ set {
+ if (value != HttpVersion.Version10 && value != HttpVersion.Version11)
+ throw new ArgumentException ("value");
+ version = (Version) value;
+ }
+ }
+
+ public override IWebProxy Proxy {
+ get { return proxy; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ proxy = value;
+ }
+ }
+
+ public string Referer {
+ get { return webHeaders ["Referer" ]; }
+ set {
+ CheckRequestStarted ();
+ if (value == null || value.Trim().Length == 0) {
+ webHeaders.RemoveInternal ("Referer");
+ return;
+ }
+ webHeaders.SetInternal ("Referer", value);
+ }
+ }
+
+ public override Uri RequestUri {
+ get { return requestUri; }
+ }
+
+ public bool SendChunked {
+ get { return sendChunked; }
+ set {
+ CheckRequestStarted ();
+ sendChunked = value;
+ }
+ }
+
+ public ServicePoint ServicePoint {
+ get { return servicePoint; }
+ }
+
+ public override int Timeout {
+ get { return timeout; }
+ set { timeout = value; }
+ }
+
+ public string TransferEncoding {
+ get { return webHeaders ["Transfer-Encoding"]; }
+ set {
+ CheckRequestStarted ();
+ if (!sendChunked)
+ throw new InvalidOperationException ("SendChunked must be True");
+ string val = value;
+ if (val != null)
+ val = val.Trim ().ToLower ();
+ if (val == null || val.Length == 0) {
+ webHeaders.RemoveInternal ("Transfer-Encoding");
+ return;
+ }
+ if (val == "chunked")
+ throw new ArgumentException ("Cannot set value to Chunked");
+ webHeaders.SetInternal ("Transfer-Encoding", value);
+ }
+ }
+
+ public string UserAgent {
+ get { return webHeaders ["User-Agent"]; }
+ set { webHeaders.SetInternal ("User-Agent", value); }
+ }
+
+ // Methods
+
+ public void AddRange (int range)
+ {
+ AddRange ("bytes", range);
+ }
+
+ public void AddRange (int from, int to)
+ {
+ AddRange ("bytes", from, to);
+ }
+
+ public void AddRange (string rangeSpecifier, int range)
+ {
+ if (rangeSpecifier == null)
+ throw new ArgumentNullException ("rangeSpecifier");
+ string value = webHeaders ["Range"];
+ if (value == null || value.Length == 0)
+ value = rangeSpecifier + "=";
+ else if (value.ToLower ().StartsWith (rangeSpecifier.ToLower () + "="))
+ value += ",";
+ else
+ throw new InvalidOperationException ("rangeSpecifier");
+ webHeaders.SetInternal ("Range", value + range + "-");
+ }
+
+ public void AddRange (string rangeSpecifier, int from, int to)
+ {
+ if (rangeSpecifier == null)
+ throw new ArgumentNullException ("rangeSpecifier");
+ if (from < 0 || to < 0 || from > to)
+ throw new ArgumentOutOfRangeException ();
+ string value = webHeaders ["Range"];
+ if (value == null || value.Length == 0)
+ value = rangeSpecifier + "=";
+ else if (value.ToLower ().StartsWith (rangeSpecifier.ToLower () + "="))
+ value += ",";
+ else
+ throw new InvalidOperationException ("rangeSpecifier");
+ webHeaders.SetInternal ("Range", value + from + "-" + to);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ private delegate Stream GetRequestStreamCallback ();
+ private delegate WebResponse GetResponseCallback ();
+
+ public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+ {
+ if (method == null || (!method.Equals ("PUT") && !method.Equals ("POST")))
+ throw new ProtocolViolationException ("Cannot send file when method is: " + this.method + ". Method must be PUT.");
+ // workaround for bug 24943
+ Exception e = null;
+ lock (this) {
+ if (asyncResponding || webResponse != null)
+ e = new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");
+ else if (requesting)
+ e = new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ else
+ requesting = true;
+ }
+ if (e != null)
+ throw e;
+ /*
+ lock (this) {
+ if (asyncResponding || webResponse != null)
+ throw new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");
+ if (requesting)
+ throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ requesting = true;
+ }
+ */
+ GetRequestStreamCallback c = new GetRequestStreamCallback (this.GetRequestStreamInternal);
+ return c.BeginInvoke (callback, state);
+ }
+
+ public override Stream EndGetRequestStream (IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+ if (!asyncResult.IsCompleted)
+ asyncResult.AsyncWaitHandle.WaitOne ();
+ AsyncResult async = (AsyncResult) asyncResult;
+ GetRequestStreamCallback cb = (GetRequestStreamCallback) async.AsyncDelegate;
+ return cb.EndInvoke (asyncResult);
+ }
+
+ public override Stream GetRequestStream()
+ {
+ IAsyncResult asyncResult = BeginGetRequestStream (null, null);
+ if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {
+ throw new WebException("The request timed out", WebExceptionStatus.Timeout);
+ }
+ return EndGetRequestStream (asyncResult);
+ }
+
+ internal Stream GetRequestStreamInternal ()
+ {
+ if (this.requestStream == null)
+ this.requestStream = new HttpWebStream (this);
+ return this.requestStream;
+ }
+
+ public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+ {
+ // workaround for bug 24943
+ Exception e = null;
+ lock (this) {
+ if (asyncResponding)
+ e = new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ else
+ asyncResponding = true;
+ }
+ if (e != null)
+ throw e;
+ /*
+ lock (this) {
+ if (asyncResponding)
+ throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");
+ asyncResponding = true;
+ }
+ */
+ GetResponseCallback c = new GetResponseCallback (this.GetResponseInternal);
+ return c.BeginInvoke (callback, state);
+ }
+
+ public override WebResponse EndGetResponse (IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+ if (!asyncResult.IsCompleted)
+ asyncResult.AsyncWaitHandle.WaitOne ();
+ AsyncResult async = (AsyncResult) asyncResult;
+ GetResponseCallback cb = (GetResponseCallback) async.AsyncDelegate;
+ WebResponse webResponse = cb.EndInvoke(asyncResult);
+ asyncResponding = false;
+ return webResponse;
+ }
+
+ public override WebResponse GetResponse()
+ {
+ IAsyncResult asyncResult = BeginGetResponse (null, null);
+ if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {
+ throw new WebException("The request timed out", WebExceptionStatus.Timeout);
+ }
+ return EndGetResponse (asyncResult);
+ }
+
+ public WebResponse GetResponseInternal ()
+ {
+ if (webResponse != null)
+ return webResponse;
+
+ Stream responseStream = this.requestStream == null ?
+ new HttpWebStream (this) : this.requestStream;
+ do {
+ this.webResponse = new HttpWebResponse (this.actualUri, method, responseStream);
+ } while (this.webResponse.StatusCode == HttpStatusCode.Continue);
+ return (WebResponse) this.webResponse;
+ }
+
+ [MonoTODO]
+ public override void Abort()
+ {
+ this.haveResponse = true;
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Private Methods
+
+ private void CheckRequestStarted ()
+ {
+ if (requesting)
+ throw new InvalidOperationException ("request started");
+ }
+
+ internal void Close ()
+ {
+ // already done in class below
+ // if (requestStream != null) {
+ // requestStream.Close ();
+ // }
+
+ lock (this) {
+ requesting = false;
+ if (requestEndEvent != null)
+ requestEndEvent.Set ();
+ // requestEndEvent = null;
+ }
+ }
+
+ // Private Classes
+
+ // to catch the Close called on the NetworkStream
+ internal class HttpWebStream : NetworkStream
+ {
+ HttpWebRequest webRequest;
+
+ internal HttpWebStream (HttpWebRequest webRequest)
+ : base (HttpWebStream.CreateSocket (webRequest), true)
+ {
+ StreamWriter webWriter = null;
+
+ webWriter = new StreamWriter (this);
+
+ webWriter.Write (webRequest.Method + " " +
+ webRequest.actualUri.PathAndQuery + " HTTP/" + webRequest.version.ToString(2) + "\r\n");
+
+ foreach (string header in webRequest.webHeaders)
+ webWriter.Write (header + ": " + webRequest.webHeaders[header] + "\r\n");
+
+ // FIXME: write cookie headers (CookieContainer not yet implemented)
+
+ webWriter.Write ("\r\n");
+ webWriter.Flush();
+
+ this.webRequest = webRequest;
+ }
+
+ private static Socket CreateSocket (HttpWebRequest webRequest)
+ {
+ IPAddress hostAddr = Dns.Resolve (webRequest.actualUri.Host).AddressList[0];
+ IPEndPoint endPoint = new IPEndPoint (hostAddr, webRequest.actualUri.Port);
+ Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
+ ProtocolType.Tcp);
+
+ socket.Connect (endPoint);
+ return socket;
+ }
+
+ public override void Close()
+ {
+ base.Close ();
+ webRequest.Close ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/HttpWebResponse.cs b/mcs/class/System/System.Net/HttpWebResponse.cs
new file mode 100644
index 00000000000..10d66d87d09
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpWebResponse.cs
@@ -0,0 +1,401 @@
+//
+// System.Net.HttpWebResponse
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class HttpWebResponse : WebResponse, ISerializable, IDisposable
+ {
+ private Uri uri;
+ private WebHeaderCollection webHeaders;
+ private CookieCollection cookieCollection = null;
+ private string method = null;
+ private Version version = null;
+ private HttpStatusCode statusCode;
+ private string statusDescription = null;
+
+ private Stream responseStream;
+ private bool disposed = false;
+
+ // Constructors
+
+ internal HttpWebResponse (Uri uri, string method, Stream responseStream)
+ {
+ Text.StringBuilder value = null;
+ string last = null;
+ string line = null;
+ string[] protocol, header;
+
+ this.uri = uri;
+ this.method = method;
+ this.responseStream = responseStream;
+ this.webHeaders = new WebHeaderCollection();
+
+ line = ReadHttpLine(responseStream);
+ protocol = line.Split (' ');
+
+ switch (protocol[0]) {
+ case "HTTP/1.0":
+ this.version = HttpVersion.Version10;
+ break;
+ case "HTTP/1.1":
+ this.version = HttpVersion.Version11;
+ break;
+ default:
+ throw new WebException ("Unrecognized HTTP Version");
+ }
+
+ this.statusCode = (HttpStatusCode) Int32.Parse (protocol[1]);
+ while ((line = ReadHttpLine(responseStream)).Length != 0) {
+ if (!Char.IsWhiteSpace (line[0])) { // new header
+ header = line.Split (new char[] {':'}, 2);
+ if (header.Length != 2)
+ throw new WebException ("Bad HTTP Header");
+ if (last != null) { // not the first header
+ if (last.Equals ("Set-Cookie"))
+ SetCookie (value.ToString());
+ else if (last.Equals ("Set-Cookie2"))
+ SetCookie2 (value.ToString());
+ else //don't save Set-Cookie headers
+ this.webHeaders[last] = value.ToString();
+ }
+ last = header[0];
+ value = new Text.StringBuilder (header[1].Trim());
+ }
+ else
+ value.Append (line.Trim());
+ }
+
+ this.webHeaders[last] = value.ToString(); // otherwise we miss the last header
+ }
+
+ protected HttpWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotSupportedException ();
+ }
+
+ // Properties
+
+ public string CharacterSet {
+ // Content-Type = "Content-Type" ":" media-type
+ // media-type = type "/" subtype *( ";" parameter )
+ // parameter = attribute "=" value
+ // 3.7.1. default is ISO-8859-1
+ get {
+ try {
+ string contentType = ContentType;
+ if (contentType == null)
+ return "ISO-8859-1";
+ string val = contentType.ToLower ();
+ int pos = val.IndexOf ("charset=");
+ if (pos == -1)
+ return "ISO-8859-1";
+ pos += 8;
+ int pos2 = val.IndexOf (';', pos);
+ return (pos2 == -1)
+ ? contentType.Substring (pos)
+ : contentType.Substring (pos, pos2 - pos);
+ } finally {
+ CheckDisposed ();
+ }
+ }
+ }
+
+ public string ContentEncoding {
+ get {
+ try { return webHeaders ["Content-Encoding"]; }
+ finally { CheckDisposed (); }
+ }
+ }
+
+ public override long ContentLength {
+ get {
+ try {
+ return Int64.Parse (webHeaders ["Content-Length"]);
+ } catch (Exception) {
+ return -1;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+ }
+
+ public override string ContentType {
+ get {
+ try { return webHeaders ["Content-Type"]; }
+ finally { CheckDisposed (); }
+ }
+ }
+
+ public CookieCollection Cookies {
+ get {
+ CheckDisposed ();
+
+ if (cookieCollection == null)
+ cookieCollection = new CookieCollection ();
+ return cookieCollection;
+ }
+ set {
+ CheckDisposed ();
+ // ?? don't understand how you can set cookies on a response.
+ throw new NotSupportedException ();
+ }
+ }
+
+ public override WebHeaderCollection Headers {
+ get {
+ CheckDisposed ();
+ return webHeaders;
+ }
+ }
+
+ public DateTime LastModified {
+ get {
+ CheckDisposed ();
+ try {
+ string dtStr = webHeaders ["Last-Modified"];
+ return MonoHttpDate.Parse (dtStr);
+ } catch (Exception) {
+ return DateTime.Now;
+ }
+ }
+ }
+
+ public string Method {
+ get {
+ CheckDisposed ();
+ return method;
+ }
+ }
+
+ public Version ProtocolVersion {
+ get {
+ CheckDisposed ();
+ return version;
+ }
+ }
+
+ public override Uri ResponseUri {
+ get {
+ CheckDisposed ();
+ return uri;
+ }
+ }
+
+ public string Server {
+ get {
+ try {
+ return webHeaders ["Server"];
+ } finally {
+ CheckDisposed ();
+ }
+ }
+ }
+
+ public HttpStatusCode StatusCode {
+ get {
+ CheckDisposed ();
+ return statusCode;
+ }
+ }
+
+ public string StatusDescription {
+ get {
+ CheckDisposed ();
+ return statusDescription;
+ }
+ }
+
+ // Methods
+
+ public override int GetHashCode ()
+ {
+ try {
+ return base.GetHashCode ();
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public string GetResponseHeader (string headerName)
+ {
+ try {
+ return webHeaders [headerName];
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ public override Stream GetResponseStream ()
+ {
+ try {
+ if (method.Equals ("HEAD")) // see par 4.3 & 9.4
+ return Stream.Null;
+ return responseStream;
+ } finally {
+ CheckDisposed ();
+ }
+ }
+
+ [MonoTODO]
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ CheckDisposed ();
+ throw new NotImplementedException ();
+ }
+
+
+ // Cleaning up stuff
+
+ ~HttpWebResponse ()
+ {
+ Dispose (false);
+ }
+
+ public override void Close ()
+ {
+ ((IDisposable) this).Dispose ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (this.disposed)
+ return;
+ this.disposed = true;
+
+ if (disposing) {
+ // release managed resources
+ uri = null;
+ webHeaders = null;
+ cookieCollection = null;
+ method = null;
+ version = null;
+ // statusCode = null;
+ statusDescription = null;
+ }
+
+ // release unmanaged resources
+ Stream stream = responseStream;
+ responseStream = null;
+ if (stream != null)
+ stream.Close (); // also closes webRequest
+ }
+
+ private void CheckDisposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException (GetType ().FullName);
+ }
+
+ private static string ReadHttpLine (Stream stream)
+ {
+ Text.StringBuilder line = new Text.StringBuilder();
+ byte last = (byte)'\n';
+ bool read_last = false;
+ byte[] buf = new byte[1]; // one at a time to not snarf too much
+
+ while (stream.Read (buf, 0, buf.Length) != 0) {
+ if (buf[0] == '\r') {
+ if ((last = (byte)stream.ReadByte ()) == '\n') // headers; not at EOS
+ break;
+ read_last = true;
+ }
+
+ line.Append (Convert.ToChar(buf[0]));
+ if (read_last) {
+ line.Append (Convert.ToChar (last));
+ read_last = false;
+ }
+ }
+
+ return line.ToString();
+ }
+
+ private void SetCookie (string cookie_str)
+ {
+ string[] parts = null;
+ Collections.Queue options = null;
+ Cookie cookie = null;
+
+ options = new Collections.Queue (cookie_str.Split (';'));
+ parts = ((string)options.Dequeue()).Split ('='); // NAME=VALUE must be first
+
+ cookie = new Cookie (parts[0], parts[1]);
+
+ while (options.Count > 0) {
+ parts = ((string)options.Dequeue()).Split ('=');
+ switch (parts[0].ToUpper()) { // cookie options are case-insensitive
+ case "COMMENT":
+ if (cookie.Comment == null)
+ cookie.Comment = parts[1];
+ break;
+ case "COMMENTURL":
+ if (cookie.CommentUri == null)
+ cookie.CommentUri = new Uri(parts[1]);
+ break;
+ case "DISCARD":
+ cookie.Discard = true;
+ break;
+ case "DOMAIN":
+ if (cookie.Domain == null)
+ cookie.Domain = parts[1];
+ break;
+ case "MAX-AGE": // RFC Style Set-Cookie2
+ if (cookie.Expires == DateTime.MinValue)
+ cookie.Expires = cookie.TimeStamp.AddSeconds (Int32.Parse (parts[1]));
+ break;
+ case "EXPIRES": // Netscape Style Set-Cookie
+ if (cookie.Expires == DateTime.MinValue)
+ cookie.Expires = DateTime.Parse (parts[1]);
+ break;
+ case "PATH":
+ if (cookie.Path == null)
+ cookie.Path = parts[1];
+ break;
+ case "PORT":
+ if (cookie.Port == null)
+ cookie.Port = parts[1];
+ break;
+ case "SECURE":
+ cookie.Secure = true;
+ break;
+ case "VERSION":
+ cookie.Version = Int32.Parse (parts[1]);
+ break;
+ } // switch
+ } // while
+
+ if (cookieCollection == null)
+ cookieCollection = new CookieCollection();
+
+ if (cookie.Domain == null)
+ cookie.Domain = uri.Host;
+
+ cookieCollection.Add (cookie);
+ }
+
+ private void SetCookie2 (string cookies_str)
+ {
+ string[] cookies = cookies_str.Split (',');
+
+ foreach (string cookie_str in cookies)
+ SetCookie (cookie_str);
+
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/IAuthenticationModule.cs b/mcs/class/System/System.Net/IAuthenticationModule.cs
index 089cdd9d930..15119f74da3 100755
--- a/mcs/class/System/System.Net/IAuthenticationModule.cs
+++ b/mcs/class/System/System.Net/IAuthenticationModule.cs
@@ -23,8 +23,8 @@ namespace System.Net {
bool CanRespond (string challenge);
- Authorization PreAuthenticate (WebRequest request, ICredentialLookup credentials);
+ Authorization PreAuthenticate (WebRequest request, ICredentials credentials);
- Authorization Respond (string challenge, WebRequest request, ICredentialLookup credentials);
+ Authorization Respond (string challenge, WebRequest request, ICredentials credentials);
}
}
diff --git a/mcs/class/System/System.Net/ICertificatePolicy.cs b/mcs/class/System/System.Net/ICertificatePolicy.cs
new file mode 100644
index 00000000000..37d2405a3ec
--- /dev/null
+++ b/mcs/class/System/System.Net/ICertificatePolicy.cs
@@ -0,0 +1,22 @@
+//
+// System.Net.ICertificatePolicy.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net {
+
+ // <remarks>
+ // </remarks>
+ public interface ICertificatePolicy {
+ bool CheckValidationResult (
+ ServicePoint srvPoint,
+ X509Certificate certificate,
+ WebRequest request,
+ int certificateProblem
+ );
+ }
+}
diff --git a/mcs/class/System/System.Net/ICredentialLookup.cs b/mcs/class/System/System.Net/ICredentialLookup.cs
index 3e68efe955a..26b48ba9860 100755
--- a/mcs/class/System/System.Net/ICredentialLookup.cs
+++ b/mcs/class/System/System.Net/ICredentialLookup.cs
@@ -3,6 +3,7 @@
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
//
namespace System.Net {
@@ -10,8 +11,8 @@ namespace System.Net {
// <remarks>
// Base authentication interface for Web clients.
// </remarks>
- public interface ICredential {
-
- NetworkCredential GetCredential (string uri, string AuthType);
+ public interface ICredentials
+ {
+ NetworkCredential GetCredential (Uri uri, string authType);
}
}
diff --git a/mcs/class/System/System.Net/IPAddress.cs b/mcs/class/System/System.Net/IPAddress.cs
new file mode 100755
index 00000000000..86041acb862
--- /dev/null
+++ b/mcs/class/System/System.Net/IPAddress.cs
@@ -0,0 +1,231 @@
+//
+// System.Net.IPAddress.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+// Note: the address is stored in host order
+
+using System;
+using System.Globalization;
+using System.Net.Sockets;
+using System.Runtime.InteropServices;
+
+namespace System.Net {
+
+ /// <remarks>
+ /// Encapsulates an IP Address.
+ /// </remarks>
+ [Serializable]
+ public class IPAddress {
+ // Don't change the name of this field without also
+ // changing socket-io.c in the runtime
+ private long address;
+
+ public static readonly IPAddress Any = new IPAddress(0);
+ public static readonly IPAddress Broadcast = IPAddress.Parse ("255.255.255.255");
+ public static readonly IPAddress Loopback = IPAddress.Parse ("127.0.0.1");
+ public static readonly IPAddress None = IPAddress.Parse ("255.255.255.255");
+
+ private static short SwapShort (short number)
+ {
+ return (short) ( ((number >> 8) & 0xFF) + ((number << 8) & 0xFF00) );
+ }
+
+ private static int SwapInt (int number)
+ {
+ byte b0 = (byte) ((number >> 24) & 0xFF);
+ byte b1 = (byte) ((number >> 16) & 0xFF);
+ byte b2 = (byte) ((number >> 8) & 0xFF);
+ byte b3 = (byte) (number & 0xFF);
+ return b0 + (b1 << 8) + (b2 << 16) + (b3 << 24);
+ }
+
+ private static long SwapLong (long number)
+ {
+ byte b0 = (byte) ((number >> 56) & 0xFF);
+ byte b1 = (byte) ((number >> 48) & 0xFF);
+ byte b2 = (byte) ((number >> 40) & 0xFF);
+ byte b3 = (byte) ((number >> 32) & 0xFF);
+ byte b4 = (byte) ((number >> 24) & 0xFF);
+ byte b5 = (byte) ((number >> 16) & 0xFF);
+ byte b6 = (byte) ((number >> 8) & 0xFF);
+ byte b7 = (byte) (number & 0xFF);
+ return (long) b0 + ((long) b1 << 8) + ((long) b2 << 16) + ((long) b3 << 24) + ((long) b4 << 32) + ((long) b5 << 40) + ((long) b6 << 48) + ((long) b7 << 56);
+ }
+
+ public static short HostToNetworkOrder(short host) {
+ if (!BitConverter.IsLittleEndian)
+ return(host);
+
+ return SwapShort (host);
+ }
+
+ public static int HostToNetworkOrder(int host) {
+ if (!BitConverter.IsLittleEndian)
+ return(host);
+
+ return SwapInt (host);
+ }
+
+ public static long HostToNetworkOrder(long host) {
+ if (!BitConverter.IsLittleEndian)
+ return(host);
+
+ return SwapLong (host);
+ }
+
+ public static short NetworkToHostOrder(short network) {
+ if (!BitConverter.IsLittleEndian)
+ return(network);
+
+ return SwapShort (network);
+ }
+
+ public static int NetworkToHostOrder(int network) {
+ if (!BitConverter.IsLittleEndian)
+ return(network);
+
+ return SwapInt (network);
+ }
+
+ public static long NetworkToHostOrder(long network) {
+ if (!BitConverter.IsLittleEndian)
+ return(network);
+
+ return SwapLong (network);
+ }
+
+ /// <summary>
+ /// Constructor from a 32-bit constant with its bytes
+ /// in network order.
+ /// </summary>
+ public IPAddress (long addr)
+ {
+ Address = addr;
+ }
+
+ public static IPAddress Parse (string ip)
+ {
+ if (ip == null)
+ throw new ArgumentNullException ("null ip string");
+
+ if (ip.Length == 0 || ip [0] == ' ')
+ return new IPAddress (0);
+
+ int pos = ip.IndexOf (' ');
+ if (pos != -1)
+ ip = ip.Substring (0, pos);
+ else if (ip [ip.Length - 1] == '.')
+ throw new FormatException ("An invalid IP address was specified");
+
+ string [] ips = ip.Split (new char [] {'.'});
+ if (ips.Length > 4)
+ throw new FormatException ("An invalid IP address was specified");
+
+ // Make the number in network order
+ try {
+ long a = 0;
+ byte val = 0;
+ for (int i = 0; i < ips.Length; i++) {
+ string subnet = ips [i];
+ if ((3 <= subnet.Length && subnet.Length <= 4) &&
+ (subnet [0] == '0') &&
+ (subnet [1] == 'x' || subnet [2] == 'X')) {
+ if (subnet.Length == 3)
+ val = (byte) Uri.FromHex (subnet [2]);
+ else
+ val = (byte) ((Uri.FromHex (subnet [2]) << 4) | Uri.FromHex (subnet [3]));
+ } else if (subnet.Length == 0)
+ val = 0;
+ else
+ val = Byte.Parse (subnet, NumberStyles.None);
+
+ if (ips.Length < 4 && i == (ips.Length - 1))
+ i = 3;
+
+ a |= (long) val << (i << 3);
+ }
+
+ return (new IPAddress (a));
+ } catch (Exception) {
+ throw new FormatException ("An invalid IP address was specified");
+ }
+ }
+
+ public long Address {
+ get {
+ return address;
+ }
+ set {
+ /* no need to do this test, ms.net accepts any value.
+ if (value < 0 || value > 0x00000000FFFFFFFF)
+ throw new ArgumentOutOfRangeException (
+ "the address must be between 0 and 0xFFFFFFFF");
+ */
+
+ address = value;
+ }
+ }
+
+ public AddressFamily AddressFamily {
+ get {
+ return(AddressFamily.InterNetwork);
+ }
+ }
+
+
+ /// <summary>
+ /// Used to tell whether an address is a loopback.
+ /// All IP addresses of the form 127.X.Y.Z, where X, Y, and Z are in
+ /// the range 0-255, are loopback addresses.
+ /// </summary>
+ /// <param name="addr">Address to compare</param>
+ /// <returns></returns>
+ public static bool IsLoopback (IPAddress addr)
+ {
+ return (addr.address & 0xFF) == 127;
+ }
+
+ /// <summary>
+ /// Overrides System.Object.ToString to return
+ /// this object rendered in a quad-dotted notation
+ /// </summary>
+ public override string ToString ()
+ {
+ return ToString (address);
+ }
+
+ /// <summary>
+ /// Returns this object rendered in a quad-dotted notation
+ /// </summary>
+ static string ToString (long addr)
+ {
+ // addr is in network order
+ return (addr & 0xff).ToString () + "." +
+ ((addr >> 8) & 0xff).ToString () + "." +
+ ((addr >> 16) & 0xff).ToString () + "." +
+ ((addr >> 24) & 0xff).ToString ();
+ }
+
+ /// <returns>
+ /// Whether both objects are equal.
+ /// </returns>
+ public override bool Equals (object other)
+ {
+ if (other is System.Net.IPAddress){
+ return Address == ((System.Net.IPAddress) other).Address;
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)Address;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/IPAdress.cs b/mcs/class/System/System.Net/IPAdress.cs
deleted file mode 100755
index fc4e2d8e79f..00000000000
--- a/mcs/class/System/System.Net/IPAdress.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// System.Net.IPAddress.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-namespace System.Net {
-
- // <remarks>
- // Encapsulates an IP Address.
- // </remarks>
- public class IPAddress {
- public int Address;
-
- public const int InaddrAny = 0;
- public const int InaddrBroadcast = 0xffffffff;
- public const int InaddrLoopback = 0x7f000001;
- public const int InaddrNone = 0xffffffff;
-
- // <summary>
- // Constructor from a 32-bit constant.
- // </summary>
- public IPAddress (int address)
- {
- this.address = address;
- }
-
- // <summary>
- // Constructor from a dotted quad notation.
- // </summary>
- public IPAddress (string ip)
- {
- string ips = ip.Split (".");
- int i, a = 0;
-
- for (i = 0; i < ips.Count; i++)
- a = (a << 8) | (ips [i].ToInt16 ());
-
- Address = a;
- }
-
- // <summary>
- // Used to tell whether an address is a loopback.
- // </summary>
- // <param name="addr">Address to compare</param>
- // <returns></returns>
- public static bool IsLoopback (IPAddress addr)
- {
- return addr.Address == InaddrLoopback;
- }
-
- // <summary>
- // Overrides System.Object.ToString to return
- // this object rendered in a quad-dotted notation
- // </summary>
- public override string ToString ()
- {
- System.Net.IPAddress.ToString (Address);
- }
-
- // <summary>
- // Returns this object rendered in a quad-dotted notation
- // </summary>
- public static string ToString (int addr)
- {
- return (addr >> 24).ToString () + "." +
- ((addr >> 16) & 0xff).ToString () + "." +
- ((addr >> 8) & 0xff).ToString () + "." +
- (addr & 0xff).ToString ();
- }
-
- // <returns>
- // Whether both objects are equal.
- // </returns>
- public override bool Equal (object other)
- {
- if (typeof (other) is System.Net.IPAddress){
- return Address == ((System.Net.IPAddress) other).Address;
- }
- return false;
- }
- }
-
-}
diff --git a/mcs/class/System/System.Net/IPEndPoint.cs b/mcs/class/System/System.Net/IPEndPoint.cs
index 3d3809faade..a52539faf79 100755
--- a/mcs/class/System/System.Net/IPEndPoint.cs
+++ b/mcs/class/System/System.Net/IPEndPoint.cs
@@ -7,33 +7,123 @@
// (C) Ximian, Inc. http://www.ximian.com
//
-namespace System.Net {
+using System.Net.Sockets;
+namespace System.Net {
+ [Serializable]
public class IPEndPoint : EndPoint {
- public IPAddress Address;
+
+ private IPAddress address;
+ private int port;
public const int MaxPort = 65535;
public const int MinPort = 0;
-
- public short Port;
public IPEndPoint (IPAddress address, int port)
{
+ if (address == null)
+ throw new ArgumentNullException ("Value cannot be null");
+
Address = address;
Port = port;
}
- public IPEndPoint (int iaddr, int port)
+ public IPEndPoint (long iaddr, int port) : this (new IPAddress (iaddr), port)
{
- IPAddress address = new IPAddress (iaddr);
+ }
+
+ public IPAddress Address {
+ get {
+ return (address);
+ }
+ set {
+ address=value;
+ }
+ }
+
+ public override AddressFamily AddressFamily {
+ get {
+ return AddressFamily.InterNetwork;
+ }
+ }
+
+ public int Port {
+ get {
+ return port;
+ }
+ set {
+ // LAMESPEC: no mention of sanity checking
+ // PS: MS controls the range when setting the value
+ if (value < MinPort || value > MaxPort)
+ throw new ArgumentOutOfRangeException ("Invalid port");
- IPEndPoint (address, port);
+ port = value;
+ }
}
- public int AddressFamily {
- override get {
- return 2;
+ // bytes 2 and 3 store the port, the rest
+ // stores the address
+ public override EndPoint Create(SocketAddress sockaddr) {
+ int size=sockaddr.Size;
+
+ // LAMESPEC: no mention of what to do if
+ // sockaddr is bogus
+ if(size<8) {
+ // absolute minimum amount needed for
+ // an address family, buffer size,
+ // port and address
+ return(null);
}
+ AddressFamily family=(AddressFamily)sockaddr[0];
+ if(family!=AddressFamily.InterNetwork) {
+ return(null);
+ }
+
+ int port=(((int)sockaddr[2])<<8) + (int)sockaddr[3];
+ long address=(((long)sockaddr[7])<<24) +
+ (((long)sockaddr[6])<<16) +
+ (((long)sockaddr[5])<<8) +
+ (long)sockaddr[4];
+
+ IPEndPoint ipe = new IPEndPoint(address, port);
+
+ return(ipe);
+ }
+
+ public override SocketAddress Serialize() {
+ // .net produces a 16 byte buffer, even though
+ // only 8 bytes are used. I guess its just a
+ // holdover from struct sockaddr padding.
+ SocketAddress sockaddr = new SocketAddress(AddressFamily.InterNetwork, 16);
+
+ // bytes 2 and 3 store the port, the rest
+ // stores the address
+ sockaddr [2] = (byte) ((port>>8) & 0xff);
+ sockaddr [3] = (byte) (port & 0xff);
+
+ sockaddr [4] = (byte) (address.Address & 0xff);
+ sockaddr [5] = (byte) ((address.Address >> 8) & 0xff);
+ sockaddr [6] = (byte) ((address.Address >> 16) & 0xff);
+ sockaddr [7] = (byte) ((address.Address >> 24) & 0xff);
+
+ return(sockaddr);
+ }
+
+ public override string ToString() {
+ return(address.ToString() + ":" + port);
+ }
+
+ public override bool Equals (Object obj)
+ {
+ IPEndPoint p = obj as IPEndPoint;
+ return p != null &&
+ p.port == port &&
+ p.address.Equals (address);
+ }
+
+ public override int GetHashCode ()
+ {
+ return address.GetHashCode () + port;
}
}
}
diff --git a/mcs/class/System/System.Net/IPHostEntry.cs b/mcs/class/System/System.Net/IPHostEntry.cs
new file mode 100644
index 00000000000..dd24e48b19b
--- /dev/null
+++ b/mcs/class/System/System.Net/IPHostEntry.cs
@@ -0,0 +1,75 @@
+// System.Net.IPHostEntry.cs
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+//
+// (C) Mads Pultz, 2001
+
+using System;
+
+namespace System.Net {
+
+ public class IPHostEntry {
+ private IPAddress[] addressList;
+ private String[] aliases;
+ private String hostName;
+
+ public IPHostEntry() {
+ hostName = "localhost";
+ addressList = new IPAddress[1];
+ addressList[0] = IPAddress.Loopback;
+ aliases = new String[0];
+ }
+
+ public IPAddress[] AddressList {
+ get { return addressList; }
+ set { addressList = value; }
+ }
+
+ public string[] Aliases {
+ get { return aliases; }
+ set { aliases = value; }
+ }
+
+ public string HostName {
+ get { return hostName; }
+ set { hostName = value; }
+ }
+
+/* According to the .NET Framework SDK Documentation (beta 2) the following
+ methods from Object are not overrided. I implemented them before realizing
+ this but I leave the implementation here if needed in the future.
+
+ public override string ToString() {
+ string res = hostName;
+ if (addressList != null && addressList.Length > 0)
+ res += " [" + addressList[0] + "]";
+ return res;
+ }
+
+ public override bool Equals(object obj) {
+ if (obj is IPHostEntry) {
+ IPHostEntry h = (IPHostEntry)obj;
+ return hostName.Equals(h.HostName) && aliases.Equals(h.Aliases) &&
+ addressList.Equals(h.AddressList);
+ }
+ else
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return hostName.GetHashCode();
+ }
+
+ protected new object MemberwiseClone() {
+ IPHostEntry res = new IPHostEntry();
+ res.AddressList = new IPAddress[addressList.Length];
+ Array.Copy(addressList, res.AddressList, addressList.Length);
+ res.Aliases = new String[aliases.Length];
+ Array.Copy(aliases, res.Aliases, aliases.Length);
+ res.HostName = hostName;
+ return res;
+ }
+*/
+ }
+}
+
diff --git a/mcs/class/System/System.Net/IPv6Address.cs b/mcs/class/System/System.Net/IPv6Address.cs
new file mode 100644
index 00000000000..96ed983f7dd
--- /dev/null
+++ b/mcs/class/System/System.Net/IPv6Address.cs
@@ -0,0 +1,278 @@
+//
+// System.Net.IPv6Address.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+// Note I: This class is not defined in the specs of .Net
+//
+// Note II : The name of this class is perhaps unfortunate as it turns
+// out that in ms.net there's an internal class called
+// IPv6Address in namespace System.
+//
+
+
+using System;
+using System.Net.Sockets;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace System.Net {
+
+ /// <remarks>
+ /// Encapsulates an IPv6 Address.
+ /// See RFC 2373 for more info on IPv6 addresses.
+ /// </remarks>
+ [Serializable]
+ public class IPv6Address {
+ private ushort [] address;
+ private int prefixLength;
+
+ public static readonly IPv6Address Loopback = IPv6Address.Parse ("::1");
+ public static readonly IPv6Address Unspecified = IPv6Address.Parse ("::");
+
+ /// <summary>
+ /// Constructor from a 32-bit constant with its bytes
+ /// in network order.
+ /// </summary>
+ public IPv6Address (ushort [] addr)
+ {
+ if (addr == null)
+ throw new ArgumentNullException ("addr");
+ if (addr.Length != 8)
+ throw new ArgumentException ("addr");
+ address = addr;
+ }
+
+ public IPv6Address (ushort [] addr, int prefixLength) : this (addr)
+ {
+ if (prefixLength < 0 || prefixLength > 128)
+ throw new ArgumentException ("prefixLength");
+ this.prefixLength = prefixLength;
+ }
+
+ public static IPv6Address Parse (string ipString)
+ {
+ if (ipString == null)
+ throw new ArgumentNullException ("ipString");
+
+ if (ipString.Length > 2 &&
+ ipString [0] == '[' &&
+ ipString [ipString.Length - 1] == ']')
+ ipString = ipString.Substring (1, ipString.Length - 2);
+
+ if (ipString.Length < 2)
+ throw new FormatException ("Not a valid IPv6 address");
+
+ int prefixLen = 0;
+ int pos = ipString.LastIndexOf ('/');
+ if (pos != -1) {
+ string prefix = ipString.Substring (pos + 1);
+ try {
+ prefixLen = Int32.Parse (prefix);
+ } catch (Exception) {
+ prefixLen = -1;
+ }
+ if (prefixLen < 0 || prefixLen > 128)
+ throw new FormatException ("Not a valid prefix length");;
+ ipString = ipString.Substring (0, pos);
+ }
+
+ ushort [] addr = new ushort [8];
+
+ bool ipv4 = false;
+ int pos2 = ipString.LastIndexOf (":");
+ if (pos2 == -1)
+ throw new FormatException ("Not a valid IPv6 address");
+ if (pos2 < (ipString.Length - 1)) {
+ string ipv4Str = ipString.Substring (pos2 + 1);
+ if (ipv4Str.IndexOf ('.') != -1) {
+ try {
+ long a = IPAddress.Parse (ipv4Str).Address;
+ addr [6] = (ushort) (((int) (a & 0xff) << 8) + ((int) ((a >> 8) & 0xff)));
+ addr [7] = (ushort) (((int) ((a >> 16) & 0xff) << 8) + ((int) ((a >> 24) & 0xff)));
+ if (ipString [pos2 - 1] == ':')
+ ipString = ipString.Substring (0, pos2 + 1);
+ else
+ ipString = ipString.Substring (0, pos2);
+ ipv4 = true;
+ } catch (Exception) {
+ throw new FormatException ("Not a valid IPv6 address");
+ }
+ }
+ }
+
+ int origLen = ipString.Length;
+ if (origLen < 2)
+ throw new FormatException ("Not a valid IPv6 address");
+ ipString = ipString.Replace ("::", ":!:");
+ int len = ipString.Length;
+ if ((len - origLen) > 1)
+ throw new FormatException ("Not a valid IPv6 address");
+
+ if (ipString [1] == '!')
+ ipString = ipString.Remove (0, 1);
+ if (ipString [len - 2] == '!')
+ ipString = ipString.Remove (len - 1, 1);
+ if ((ipString.Length > 2) &&
+ ((ipString [0] == ':') || (ipString [ipString.Length - 1] == ':')))
+ throw new FormatException ("Not a valid IPv6 address");
+
+ string [] pieces = ipString.Split (new char [] {':'});
+ len = pieces.Length;
+ if (len > (ipv4 ? 6 : 8))
+ throw new FormatException ("Not a valid IPv6 address");
+ int piecedouble = -1;
+ for (int i = 0; i < len; i++) {
+ string piece = pieces [i];
+ if (piece == "!")
+ piecedouble = i;
+ else {
+ int plen = piece.Length;
+ if (plen > 4)
+ throw new FormatException ("Not a valid IPv6 address");
+ int p = 0;
+ for (int j = 0; j < plen; j++)
+ try {
+ p = (p << 4) + Uri.FromHex (piece [j]);
+ } catch (ArgumentException) {
+ throw new FormatException ("Not a valid IPv6 address");
+ }
+ addr [i] = (ushort) p;
+ }
+ }
+
+ //expand the :: token
+ if (piecedouble != -1) {
+ int totallen = (ipv4 ? 5 : 7);
+ int i = totallen;
+ for (i = totallen; i >= (totallen - (len - piecedouble - 1)); i--) {
+ addr [i] = addr [(len - 1) + i - totallen];
+ }
+ for (; i >= piecedouble; i--) {
+ addr [i] = 0;
+ }
+ } else if (len != (ipv4 ? 6 : 8))
+ throw new FormatException ("Not a valid IPv6 address");
+
+ // check IPv4 validity
+ if (ipv4) {
+ for (int i = 0; i < 5; i++)
+ if (addr [i] != 0)
+ throw new FormatException ("Not a valid IPv6 address");
+ if (addr [5] != 0 && addr [5] != 0xffff)
+ throw new FormatException ("Not a valid IPv6 address");
+ }
+
+ return new IPv6Address (addr, prefixLen);
+ }
+
+ public ushort [] Address {
+ get { return address; }
+ }
+
+ public int PrefixLength {
+ get { return this.prefixLength; }
+ }
+
+ public ushort this [int index] {
+ get { return address [index]; }
+ }
+
+ public AddressFamily AddressFamily {
+ get { return AddressFamily.InterNetworkV6; }
+ }
+
+ /// <summary>
+ /// Used to tell whether the given address is the loopback address.
+ /// </summary>
+ public static bool IsLoopback (IPv6Address addr)
+ {
+ for (int i = 0; i < 4; i++)
+ if (addr.address [i] != 0)
+ return false;
+ if ((addr.address [5] != 0) && (addr.address [5] != 0xffff))
+ return false;
+ if ((addr.address [6] >> 8) == 0x7f)
+ return true;
+ return ((addr.address [5] == 0) &&
+ (addr.address [6] == 0) &&
+ (addr.address [7] == 1));
+ }
+
+ public bool IsIPv4Compatible ()
+ {
+ for (int i = 0; i < 6; i++)
+ if (address [i] != 0)
+ return false;
+ return true;
+ }
+
+ public bool IsIPv4Mapped ()
+ {
+ for (int i = 0; i < 5; i++)
+ if (address [i] != 0)
+ return false;
+ return address [5] == 0xffff;
+ }
+
+ /// <summary>
+ /// Overrides System.Object.ToString to return
+ /// this object rendered in a canonicalized notation
+ /// </summary>
+ public override string ToString ()
+ {
+ StringBuilder s = new StringBuilder ();
+ for (int i = 0; i < 7; i++)
+ s.Append (String.Format ("{0:X4}", address [i])).Append (':');
+ s.Append (String.Format ("{0:X4}", address [7]));
+ return s.ToString ();
+ }
+
+ /// <returns>
+ /// Whether both objects are equal.
+ /// </returns>
+ public override bool Equals (object other)
+ {
+ System.Net.IPv6Address ipv6 = other as System.Net.IPv6Address;
+ if (ipv6 != null) {
+ for (int i = 0; i < 8; i++)
+ if (this.address [i] != ipv6.address [i])
+ return false;
+ return true;
+ }
+
+ System.Net.IPAddress ipv4 = other as System.Net.IPAddress;
+ if (ipv4 != null) {
+ for (int i = 0; i < 5; i++)
+ if (address [i] != 0)
+ return false;
+
+ if (address [5] != 0 && address [5] != 0xffff)
+ return false;
+
+ long a = ipv4.Address;
+ if (address [6] != (ushort) (((int) (a & 0xff) << 8) + ((int) ((a >> 8) & 0xff))) ||
+ address [7] != (ushort) (((int) ((a >> 16) & 0xff) << 8) + ((int) ((a >> 24) & 0xff))))
+ return false;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return Hash (((((int) address [0]) << 16) + address [1]),
+ ((((int) address [2]) << 16) + address [3]),
+ ((((int) address [4]) << 16) + address [5]),
+ ((((int) address [6]) << 16) + address [7]));
+ }
+
+ private static int Hash (int i, int j, int k, int l)
+ {
+ return i ^ (j << 13 | j >> 19) ^ (k << 26 | k >> 6) ^ (l << 7 | l >> 25);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/IWebProxy.cs b/mcs/class/System/System.Net/IWebProxy.cs
new file mode 100644
index 00000000000..00f10e32da1
--- /dev/null
+++ b/mcs/class/System/System.Net/IWebProxy.cs
@@ -0,0 +1,24 @@
+//
+// System.Net.IWebProxy.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+
+namespace System.Net {
+
+ // <remarks>
+ // </remarks>
+ public interface IWebProxy {
+ ICredentials Credentials {
+ get;
+ set;
+ }
+
+ Uri GetProxy (Uri destination);
+
+ bool IsBypassed (Uri host);
+ }
+}
diff --git a/mcs/class/System/System.Net/IWebRequestCreate.cs b/mcs/class/System/System.Net/IWebRequestCreate.cs
new file mode 100644
index 00000000000..85eb452abf4
--- /dev/null
+++ b/mcs/class/System/System.Net/IWebRequestCreate.cs
@@ -0,0 +1,15 @@
+//
+// System.Net.IWebRequestCreate.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+namespace System.Net {
+
+ // <remarks>
+ // </remarks>
+ public interface IWebRequestCreate {
+ WebRequest Create (Uri uri);
+ }
+}
diff --git a/mcs/class/System/System.Net/MonoHttpDate.cs b/mcs/class/System/System.Net/MonoHttpDate.cs
new file mode 100644
index 00000000000..e7ebfe419f5
--- /dev/null
+++ b/mcs/class/System/System.Net/MonoHttpDate.cs
@@ -0,0 +1,33 @@
+//
+// System.Net.MonoHttpDate
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Globalization;
+
+namespace System.Net
+{
+ /// <summary>
+ /// See RFC 2068 3.3.1
+ /// </summary>
+ internal class MonoHttpDate
+ {
+ private static readonly string rfc1123_date = "r";
+ private static readonly string rfc850_date = "dddd, dd-MMM-yy HH:mm:ss G\\MT";
+ private static readonly string asctime_date = "ddd MMM d HH:mm:ss yyyy";
+ private static readonly string [] formats =
+ new string [] {rfc1123_date, rfc850_date, asctime_date};
+ private static readonly CultureInfo enUS = new CultureInfo("en-US", false);
+
+ internal static DateTime Parse (string dateStr)
+ {
+ return DateTime.ParseExact (dateStr,
+ formats,
+ enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/NetworkAccess.cs b/mcs/class/System/System.Net/NetworkAccess.cs
new file mode 100755
index 00000000000..7d20e93aa2c
--- /dev/null
+++ b/mcs/class/System/System.Net/NetworkAccess.cs
@@ -0,0 +1,29 @@
+// NetworkAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:58 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum NetworkAccess {
+
+ /// <summary>
+ /// </summary>
+ Accept = 128,
+
+ /// <summary>
+ /// </summary>
+ Connect = 64,
+ } // NetworkAccess
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/NetworkCredential.cs b/mcs/class/System/System.Net/NetworkCredential.cs
new file mode 100755
index 00000000000..8f62cdbe292
--- /dev/null
+++ b/mcs/class/System/System.Net/NetworkCredential.cs
@@ -0,0 +1,63 @@
+//
+// System.Net.NetworkCredential.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Net
+{
+ public class NetworkCredential : ICredentials
+ {
+ // Fields
+ string userName;
+ string password;
+ string domain;
+
+ // Constructors
+ public NetworkCredential ()
+ : base ()
+ {
+ }
+
+ public NetworkCredential (string userName, string password)
+ {
+ this.userName = userName;
+ this.password = password;
+ }
+
+ public NetworkCredential (string userName, string password, string domain)
+ {
+ this.userName = userName;
+ this.password = password;
+ this.domain = domain;
+ }
+
+ // Properties
+
+ public string Domain
+ {
+ get { return domain; }
+ set { domain = value; }
+ }
+
+ public string UserName
+ {
+ get { return userName; }
+ set { userName = value; }
+ }
+
+ public string Password
+ {
+ get { return password; }
+ set { password = value; }
+ }
+
+ [MonoTODO]
+ public NetworkCredential GetCredential (Uri uri, string authType)
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/ProtocolViolationException.cs b/mcs/class/System/System.Net/ProtocolViolationException.cs
new file mode 100644
index 00000000000..cb201ce0d63
--- /dev/null
+++ b/mcs/class/System/System.Net/ProtocolViolationException.cs
@@ -0,0 +1,38 @@
+//
+// System.Net.ProtocolViolationException.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class ProtocolViolationException : InvalidOperationException, ISerializable
+ {
+
+ // Constructors
+ public ProtocolViolationException () : base ()
+ {
+ }
+
+ public ProtocolViolationException (string message) : base (message)
+ {
+ }
+
+ protected ProtocolViolationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // Methods
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net/ProxyUseType.cs b/mcs/class/System/System.Net/ProxyUseType.cs
new file mode 100755
index 00000000000..fc878e6c09a
--- /dev/null
+++ b/mcs/class/System/System.Net/ProxyUseType.cs
@@ -0,0 +1,37 @@
+// ProxyUseType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:36:08 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ProxyUseType {
+
+ /// <summary>
+ /// </summary>
+ Standard = 0,
+
+ /// <summary>
+ /// </summary>
+ Tunnel = 1,
+
+ /// <summary>
+ /// </summary>
+ FtpGateway = 2,
+
+ /// <summary>
+ /// </summary>
+ Socks = 3,
+ } // ProxyUseType
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs
new file mode 100644
index 00000000000..5800434edfc
--- /dev/null
+++ b/mcs/class/System/System.Net/ServicePoint.cs
@@ -0,0 +1,105 @@
+//
+// System.Net.ServicePoint
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading;
+
+namespace System.Net
+{
+ public class ServicePoint
+ {
+ private Uri uri;
+ private int connectionLimit;
+ private int maxIdleTime;
+ private int currentConnections;
+ private DateTime idleSince;
+ private Version protocolVersion;
+
+ // Constructors
+
+ internal ServicePoint (Uri uri, int connectionLimit, int maxIdleTime)
+ {
+ this.uri = uri;
+ this.connectionLimit = connectionLimit;
+ this.maxIdleTime = maxIdleTime;
+ this.currentConnections = 0;
+ this.idleSince = DateTime.Now;
+ }
+
+ // Properties
+
+ public Uri Address {
+ get { return this.uri; }
+ }
+
+ [MonoTODO]
+ public X509Certificate Certificate {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public X509Certificate ClientCertificate {
+ get { throw new NotImplementedException (); }
+ }
+
+ public int ConnectionLimit {
+ get { return connectionLimit; }
+ set {
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ();
+ connectionLimit = value;
+ }
+ }
+
+ public string ConnectionName {
+ get { return uri.Scheme; }
+ }
+
+ public int CurrentConnections {
+ get { return currentConnections; }
+ }
+
+ public DateTime IdleSince {
+ get { return idleSince; }
+ }
+
+ public int MaxIdleTime {
+ get { return maxIdleTime; }
+ set {
+ if (value < Timeout.Infinite || value > Int32.MaxValue)
+ throw new ArgumentOutOfRangeException ();
+ this.maxIdleTime = value;
+ }
+ }
+
+ public virtual Version ProtocolVersion {
+ get { return protocolVersion; }
+ }
+
+ public bool SupportsPipelining {
+ get { return HttpVersion.Version11.Equals (protocolVersion); }
+ }
+
+ // Methods
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode ();
+ }
+
+ // Internal Methods
+
+ internal bool AvailableForRecycling {
+ get {
+ return CurrentConnections == 0
+ && maxIdleTime != Timeout.Infinite
+ && DateTime.Now >= IdleSince.AddMilliseconds (maxIdleTime);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/ServicePointManager.cs b/mcs/class/System/System.Net/ServicePointManager.cs
new file mode 100644
index 00000000000..2dc6831761d
--- /dev/null
+++ b/mcs/class/System/System.Net/ServicePointManager.cs
@@ -0,0 +1,169 @@
+//
+// System.Net.ServicePointManager
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Security.Cryptography.X509Certificates;
+
+//
+// notes:
+// A service point manager manages service points (duh!).
+// A service point maintains a list of connections (per scheme + authority).
+// According to HttpWebRequest.ConnectionGroupName each connection group
+// creates additional connections. therefor, a service point has a hashtable
+// of connection groups where each value is a list of connections.
+//
+// when we need to make an HttpWebRequest, we need to do the following:
+// 1. find service point, given Uri and Proxy
+// 2. find connection group, given service point and group name
+// 3. find free connection in connection group, or create one (if ok due to limits)
+// 4. lease connection
+// 5. execute request
+// 6. when finished, return connection
+//
+
+
+namespace System.Net
+{
+ public class ServicePointManager
+ {
+ private static HybridDictionary servicePoints = new HybridDictionary ();
+
+ // Static properties
+
+ private static ICertificatePolicy policy = null;
+ private static int defaultConnectionLimit = DefaultPersistentConnectionLimit;
+ private static int maxServicePointIdleTime = 900000; // 15 minutes
+ private static int maxServicePoints = 0;
+
+ // Fields
+
+ public const int DefaultNonPersistentConnectionLimit = 4;
+ public const int DefaultPersistentConnectionLimit = 2;
+
+ // Constructors
+ private ServicePointManager ()
+ {
+ }
+
+ // Properties
+
+ public static ICertificatePolicy CertificatePolicy {
+ get { return policy; }
+ set { policy = value; }
+ }
+
+ public static int DefaultConnectionLimit {
+ get { return defaultConnectionLimit; }
+ set {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException ("value");
+ defaultConnectionLimit = value;
+ }
+ }
+
+ public static int MaxServicePointIdleTime {
+ get {
+ return maxServicePointIdleTime;
+ }
+ set {
+ if (value < -2 || value > Int32.MaxValue)
+ throw new ArgumentOutOfRangeException ("value");
+ maxServicePointIdleTime = value;
+ }
+ }
+
+ public static int MaxServicePoints {
+ get {
+ return maxServicePoints;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("value");
+ maxServicePoints = value;
+ RecycleServicePoints ();
+ }
+ }
+
+ // Methods
+
+ public static ServicePoint FindServicePoint (Uri address)
+ {
+ return FindServicePoint (address, GlobalProxySelection.Select);
+ }
+
+ public static ServicePoint FindServicePoint (string uriString, IWebProxy proxy)
+ {
+ return FindServicePoint (new Uri(uriString), proxy);
+ }
+
+ public static ServicePoint FindServicePoint (Uri address, IWebProxy proxy)
+ {
+ RecycleServicePoints ();
+
+ if (address == null)
+ throw new ArgumentNullException ("address");
+
+ if (proxy != null && !proxy.IsBypassed(address)) {
+ address = proxy.GetProxy (address);
+ }
+
+ address = new Uri (address.Scheme + "://" + address.Authority);
+
+ ServicePoint sp = null;
+ lock (servicePoints) {
+ sp = (ServicePoint) servicePoints [address];
+ if (sp != null)
+ return sp;
+ if (maxServicePoints > 0 && servicePoints.Count >= maxServicePoints)
+ throw new InvalidOperationException ("maximum number of service points reached");
+ sp = new ServicePoint (address, defaultConnectionLimit, maxServicePointIdleTime);
+ servicePoints.Add (address, sp);
+ }
+
+ return sp;
+ }
+
+ // Internal Methods
+
+ internal static void RecycleServicePoints ()
+ {
+ ArrayList toRemove = new ArrayList ();
+ lock (servicePoints) {
+ IDictionaryEnumerator e = servicePoints.GetEnumerator ();
+ while (e.MoveNext ()) {
+ ServicePoint sp = (ServicePoint) e.Value;
+ if (sp.AvailableForRecycling) {
+ toRemove.Add (e.Key);
+ }
+ }
+
+ for (int i = 0; i < toRemove.Count; i++)
+ servicePoints.Remove (toRemove [i]);
+
+ if (maxServicePoints == 0 || servicePoints.Count <= maxServicePoints)
+ return;
+
+ // get rid of the ones with the longest idle time
+ SortedList list = new SortedList (servicePoints.Count);
+ e = servicePoints.GetEnumerator ();
+ while (e.MoveNext ()) {
+ ServicePoint sp = (ServicePoint) e.Value;
+ if (sp.CurrentConnections == 0) {
+ while (list.ContainsKey (sp.IdleSince))
+ sp.IdleSince.AddMilliseconds (1);
+ list.Add (sp.IdleSince, sp.Address);
+ }
+ }
+
+ for (int i = 0; i < list.Count && servicePoints.Count > maxServicePoints; i++)
+ servicePoints.Remove (list.GetByIndex (i));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/SocketAddress.cs b/mcs/class/System/System.Net/SocketAddress.cs
index 78a384dbc25..757a71fd7f4 100755
--- a/mcs/class/System/System.Net/SocketAddress.cs
+++ b/mcs/class/System/System.Net/SocketAddress.cs
@@ -3,48 +3,99 @@
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
+// Dick Porter (dick@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Net.Sockets;
+
namespace System.Net {
public class SocketAddress {
- short family;
- int size;
+ private byte[] data;
- public SocketAddress (short family, int size)
+ public SocketAddress (AddressFamily family, int size)
{
- this.family = family;
- this.size = size;
+ if(size<2) {
+ throw new ArgumentOutOfRangeException("size is too small");
+ }
+
+ data=new byte[size];
+ data[0]=(byte)family;
+ data[1]=(byte)size;
}
- public SocketAddress (short family)
+ public SocketAddress (AddressFamily family)
{
- this.family = family;
+ data=new byte[32];
+ data[0]=(byte)family;
+ data[1]=(byte)32;
}
- public short Family {
+ public AddressFamily Family {
get {
- return family;
+ return((AddressFamily)data[0]);
}
}
public int Size {
get {
- return size;
+ return((int)data[1]);
}
}
public byte this [ int offset ] {
get {
- // FIXME; Unimplemented.
- return 0;
+ return(data[offset]);
}
set {
- // FIXME: Unimplemented.
+ data[offset]=value;
+ }
+ }
+
+ public override string ToString() {
+ string af=((AddressFamily)data[0]).ToString();
+ int size=(int)data[1];
+ string ret=af+":"+size+":{";
+
+ for(int i=2; i<size; i++) {
+ int val=(int)data[i];
+ ret=ret+val;
+ if(i<size-1) {
+ ret=ret+",";
+ }
+ }
+
+ ret=ret+"}";
+
+ return(ret);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is System.Net.SocketAddress &&
+ ((System.Net.SocketAddress) obj).data.Length == data.Length){
+ byte [] otherData = ((System.Net.SocketAddress) obj).data;
+ for (int i = 0; i < data.Length; i++)
+ if (otherData [i] != data [i])
+ return false;
+
+ return true;
}
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ int code = 0;
+
+ for (int i = 0; i < data.Length; i++)
+ code += data [i] + i;
+
+ return code;
}
}
}
diff --git a/mcs/class/System/System.Net/SocketPermission.cs b/mcs/class/System/System.Net/SocketPermission.cs
new file mode 100644
index 00000000000..56faa80056f
--- /dev/null
+++ b/mcs/class/System/System.Net/SocketPermission.cs
@@ -0,0 +1,339 @@
+//
+// System.Net.SocketPermission.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Net
+{
+ [Serializable]
+ public sealed class SocketPermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ // Fields
+ ArrayList m_acceptList = new ArrayList ();
+ ArrayList m_connectList = new ArrayList ();
+ bool m_noRestriction;
+
+ // Constructors
+ public SocketPermission (PermissionState state) : base ()
+ {
+ m_noRestriction = (state == PermissionState.Unrestricted);
+ }
+
+ public SocketPermission (NetworkAccess access, TransportType transport,
+ string hostName, int portNumber) : base ()
+ {
+ m_noRestriction = false;
+ AddPermission (access, transport, hostName, portNumber);
+ }
+
+ // Fields
+ public const int AllPorts = -1;
+
+ // Properties
+
+ public IEnumerator AcceptList {
+ get { return m_acceptList.GetEnumerator (); }
+ }
+
+ public IEnumerator ConnectList {
+ get { return m_connectList.GetEnumerator (); }
+ }
+
+ // Methods
+
+ public void AddPermission (NetworkAccess access, TransportType transport,
+ string hostName, int portNumber)
+ {
+ if (m_noRestriction)
+ return;
+
+ EndpointPermission permission = new EndpointPermission (hostName, portNumber, transport);
+
+ if (access == NetworkAccess.Accept)
+ m_acceptList.Add (permission);
+ else
+ m_connectList.Add (permission);
+ }
+
+ public override IPermission Copy ()
+ {
+ SocketPermission permission;
+
+ permission = new SocketPermission (m_noRestriction ?
+ PermissionState.Unrestricted :
+ PermissionState.None);
+
+ // as EndpointPermission's are immutable it's safe to do a shallow copy.
+ permission.m_connectList = (ArrayList) this.m_connectList.Clone ();
+ permission.m_acceptList = (ArrayList) this.m_acceptList.Clone ();
+
+ return permission;
+ }
+
+ public override IPermission Intersect (IPermission target)
+ {
+ if (target == null)
+ return null;
+
+ SocketPermission perm = target as SocketPermission;
+ if (perm == null)
+ throw new ArgumentException ("Argument not of type SocketPermission");
+
+ if (m_noRestriction)
+ return IntersectEmpty (perm) ? null : perm.Copy ();
+
+ if (perm.m_noRestriction)
+ return IntersectEmpty (this) ? null : this.Copy ();
+
+ SocketPermission newperm = new SocketPermission (PermissionState.None);
+ Intersect (this.m_connectList, perm.m_connectList, newperm.m_connectList);
+ Intersect (this.m_acceptList, perm.m_acceptList, newperm.m_acceptList);
+ return IntersectEmpty (newperm) ? null : newperm;
+ }
+
+ private bool IntersectEmpty (SocketPermission permission)
+ {
+ return !permission.m_noRestriction &&
+ (permission.m_connectList.Count == 0) &&
+ (permission.m_acceptList.Count == 0);
+ }
+
+ private void Intersect (ArrayList list1, ArrayList list2, ArrayList result)
+ {
+ foreach (EndpointPermission perm1 in list1) {
+ foreach (EndpointPermission perm2 in list2) {
+ EndpointPermission perm = perm1.Intersect (perm2);
+ if (perm != null) {
+ // instead of the below it's also okay to simply do:
+ // result.Add (perm);
+ // below is only done to avoid double entries
+ bool replaced = false;
+ for (int i = 0; i < result.Count; i++) {
+ EndpointPermission res = (EndpointPermission) result [i];
+ EndpointPermission resperm = perm.Intersect (res);
+ if (resperm != null) {
+ result [i] = resperm;
+ replaced = true;
+ break;
+ }
+ }
+ if (!replaced)
+ result.Add (perm);
+ }
+ }
+ }
+ }
+
+ public override bool IsSubsetOf (IPermission target)
+ {
+ if (target == null)
+ return (!m_noRestriction && m_connectList.Count == 0 && m_acceptList.Count == 0);
+
+ SocketPermission perm = target as SocketPermission;
+
+ if (perm == null)
+ throw new ArgumentException ("Parameter target must be of type SocketPermission");
+
+ if (perm.m_noRestriction)
+ return true;
+
+ if (this.m_noRestriction)
+ return false;
+
+ if (this.m_acceptList.Count == 0 && this.m_connectList.Count == 0)
+ return true;
+
+ if (perm.m_acceptList.Count == 0 && perm.m_connectList.Count == 0)
+ return false;
+
+ return IsSubsetOf (this.m_connectList, perm.m_connectList)
+ && IsSubsetOf (this.m_acceptList, perm.m_acceptList);
+ }
+
+ private bool IsSubsetOf (ArrayList list1, ArrayList list2)
+ {
+ foreach (EndpointPermission perm1 in list1) {
+ bool issubset = false;
+ foreach (EndpointPermission perm2 in list2)
+ if (perm1.IsSubsetOf (perm2)) {
+ issubset = true;
+ break;
+ }
+ if (!issubset)
+ return false;
+ }
+ return true;
+ }
+
+ public bool IsUnrestricted ()
+ {
+ return m_noRestriction;
+ }
+
+ /*
+
+ SocketPermission s = new SocketPermission (NetworkAccess.Connect, TransportType.Tcp, "www.google.com", 80);
+ s.AddPermission (NetworkAccess.Accept, TransportType.All, "localhost", 8080);
+ s.AddPermission (NetworkAccess.Accept, TransportType.All, "localhost", SocketPermission.AllPorts);
+ // s = new SocketPermission (PermissionState.None);
+ SecurityElement sec = s.ToXml ();
+ Console.WriteLine (sec.ToString ());
+
+ This is sample xml output:
+
+ <IPermission class="System.Net.SocketPermission, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1">
+ <ConnectAccess>
+ <ENDPOINT host="www.google.com"
+ transport="Tcp"
+ port="80"/>
+ </ConnectAccess>
+ <AcceptAccess>
+ <ENDPOINT host="localhost"
+ transport="All"
+ port="8080"/>
+ <ENDPOINT host="localhost"
+ transport="All"
+ port="All"/>
+ </AcceptAccess>
+ </IPermission>
+
+
+
+ This is a sample unrestricted socketpermission, no matter how many permissions you add:
+
+ <IPermission class="System.Net.SocketPermission, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1"
+ Unrestricted="true"/>
+
+
+ This is a sample constructed restricted socketpermission with no permissions added:
+
+ <IPermission class="System.Net.SocketPermission, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1"/>
+ */
+ public override SecurityElement ToXml ()
+ {
+
+ SecurityElement root = new SecurityElement ("IPermission");
+
+ root.AddAttribute ("class", this.GetType ().AssemblyQualifiedName);
+ root.AddAttribute ("version", "1");
+ if (m_noRestriction) {
+ root.AddAttribute ("Unrestricted", "true");
+ return root;
+ }
+
+ if (this.m_connectList.Count > 0)
+ ToXml (root, "ConnectAccess", m_connectList.GetEnumerator ());
+
+ if (this.m_acceptList.Count > 0)
+ ToXml (root, "AcceptAccess", m_acceptList.GetEnumerator ());
+
+ return root;
+ }
+
+ private void ToXml (SecurityElement root, string childName, IEnumerator enumerator)
+ {
+ SecurityElement child = new SecurityElement (childName);
+ while (enumerator.MoveNext ()) {
+ EndpointPermission perm = enumerator.Current as EndpointPermission;
+ SecurityElement grandchild = new SecurityElement ("ENDPOINT");
+ grandchild.AddAttribute ("host", perm.Hostname);
+ grandchild.AddAttribute ("transport", perm.Transport.ToString ());
+ grandchild.AddAttribute ("port",
+ perm.Port == AllPorts
+ ? "All"
+ : ((Int32) perm.Port).ToString ());
+ child.AddChild (grandchild);
+ }
+ root.AddChild (child);
+ }
+
+ public override void FromXml (SecurityElement securityElement)
+ {
+ if (securityElement == null)
+ throw new ArgumentNullException ("securityElement");
+
+ // LAMESPEC: it says to throw an ArgumentNullException in this case
+ if (securityElement.Tag != "IPermission")
+ throw new ArgumentException ("securityElement");
+
+ string classStr = securityElement.Attribute ("class");
+ if (classStr == null || !classStr.StartsWith (this.GetType ().FullName + ","))
+ throw new ArgumentException ("securityElement");
+
+ string unrestricted = securityElement.Attribute ("Unrestricted");
+ if (unrestricted != null) {
+ this.m_noRestriction = (String.Compare (unrestricted, "true", true) == 0);
+ if (this.m_noRestriction)
+ return;
+ }
+
+ this.m_noRestriction = false;
+ this.m_connectList = new ArrayList ();
+ this.m_acceptList = new ArrayList ();
+
+ ArrayList children = securityElement.Children;
+ foreach (SecurityElement child in children) {
+ if (child.Tag == "ConnectAccess")
+ FromXml (child.Children, NetworkAccess.Connect);
+ else if (child.Tag == "AcceptAccess")
+ FromXml (child.Children, NetworkAccess.Accept);
+ }
+ }
+
+ private void FromXml (ArrayList endpoints, NetworkAccess access)
+ {
+ foreach (SecurityElement endpoint in endpoints) {
+ if (endpoint.Tag != "ENDPOINT")
+ continue;
+ string hostname = endpoint.Attribute ("host");
+ TransportType transport =
+ (TransportType) Enum.Parse (typeof (TransportType),
+ endpoint.Attribute ("transport"),
+ true);
+ string p = endpoint.Attribute ("port");
+ int port = 0;
+ if (p == "All")
+ port = SocketPermission.AllPorts;
+ else
+ port = Int32.Parse (p);
+
+ AddPermission (access, transport, hostname, port);
+ }
+ }
+
+ public override IPermission Union (IPermission target)
+ {
+ // LAMESPEC: according to spec we should throw an
+ // exception when target is null. We'll follow the
+ // behaviour of MS.Net instead of the spec, also
+ // because it matches the Intersect behaviour.
+ if (target == null)
+ return null;
+ // throw new ArgumentNullException ("target");
+
+ SocketPermission perm = target as SocketPermission;
+ if (perm == null)
+ throw new ArgumentException ("Argument not of type SocketPermission");
+
+ if (this.m_noRestriction || perm.m_noRestriction)
+ return new SocketPermission (PermissionState.Unrestricted);
+
+ SocketPermission copy = (SocketPermission) perm.Copy ();
+ copy.m_acceptList.InsertRange (copy.m_acceptList.Count, this.m_acceptList);
+ copy.m_connectList.InsertRange (copy.m_connectList.Count, this.m_connectList);
+
+ return copy;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net/SocketPermissionAttribute.cs b/mcs/class/System/System.Net/SocketPermissionAttribute.cs
new file mode 100644
index 00000000000..80a4a2c625b
--- /dev/null
+++ b/mcs/class/System/System.Net/SocketPermissionAttribute.cs
@@ -0,0 +1,127 @@
+//
+// System.Net.SocketPermissionAttribute.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Net
+{
+ [AttributeUsage (AttributeTargets.Assembly
+ | AttributeTargets.Class
+ | AttributeTargets.Struct
+ | AttributeTargets.Constructor
+ | AttributeTargets.Method)
+ ]
+ [Serializable]
+ public sealed class SocketPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ string m_access;
+ string m_host;
+ string m_port;
+ string m_transport;
+
+ // Constructors
+ public SocketPermissionAttribute (SecurityAction action) : base (action)
+ {
+ }
+
+ // Properties
+
+ public string Access {
+ get { return m_access; }
+ set {
+ if (m_access != null)
+ throw new ArgumentException ("The parameter 'Access' can be set only once.");
+ if (value == null)
+ throw new ArgumentException ("The parameter 'Access' cannot be null.");
+ m_access = value;
+ }
+ }
+
+ public string Host {
+ get { return m_host; }
+ set {
+ if (m_host != null)
+ throw new ArgumentException ("The parameter 'Host' can be set only once.");
+ if (value == null)
+ throw new ArgumentException ("The parameter 'Host' cannot be null.");
+ m_host = value;
+ }
+ }
+
+ public string Port {
+ get { return m_port; }
+ set {
+ if (m_port != null)
+ throw new ArgumentException ("The parameter 'Port' can be set only once.");
+ if (value == null)
+ throw new ArgumentException ("The parameter 'Port' cannot be null.");
+ m_port = value;
+ }
+ }
+
+ public string Transport {
+ get { return m_transport; }
+ set {
+ if (m_transport != null)
+ throw new ArgumentException ("The parameter 'Transport' can be set only once.");
+ if (value == null)
+ throw new ArgumentException ("The parameter 'Transport' cannot be null.");
+ m_transport = value;
+ }
+ }
+
+ // Methods
+
+ public override IPermission CreatePermission () {
+ if (this.Unrestricted)
+ return new SocketPermission (PermissionState.Unrestricted);
+
+ if (m_access == null)
+ throw new ArgumentException ("The value for 'Access' must be specified.");
+ if (m_host == null)
+ throw new ArgumentException ("The value for 'Host' must be specified.");
+ if (m_port == null)
+ throw new ArgumentException ("The value for 'Port' must be specified.");
+ if (m_transport == null)
+ throw new ArgumentException ("The value for 'Transport' must be specified.");
+
+ NetworkAccess access;
+ TransportType transport;
+ int port = SocketPermission.AllPorts;
+
+ if (String.Compare (m_access, "Connect", true) == 0)
+ access = NetworkAccess.Connect;
+ else if (String.Compare (m_access, "Accept", true) == 0)
+ access = NetworkAccess.Accept;
+ else
+ throw new ArgumentException ("The parameter value 'Access=" + m_access + "' is invalid.");
+
+ if (String.Compare (m_port, "All", true) != 0) {
+ try {
+ port = Int32.Parse (m_port);
+ } catch (Exception) {
+ throw new ArgumentException ("The parameter value 'Port=" + port + "' is invalid.");
+ }
+ // test whether port number is valid..
+ new IPEndPoint (1, port);
+ }
+
+ try {
+ transport = (TransportType) Enum.Parse (typeof (TransportType), m_transport, true);
+ } catch (Exception) {
+ throw new ArgumentException ("The parameter value 'Transport=" + m_transport + "' is invalid.");
+ }
+
+ SocketPermission perm = new SocketPermission (PermissionState.None);
+ perm.AddPermission (access, transport, m_host, port);
+ return perm;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/TransportType.cs b/mcs/class/System/System.Net/TransportType.cs
new file mode 100755
index 00000000000..b9e5822fcff
--- /dev/null
+++ b/mcs/class/System/System.Net/TransportType.cs
@@ -0,0 +1,41 @@
+// TransportType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:18 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum TransportType {
+
+ /// <summary>
+ /// </summary>
+ Udp = 1,
+
+ /// <summary>
+ /// </summary>
+ Connectionless = 1,
+
+ /// <summary>
+ /// </summary>
+ Tcp = 2,
+
+ /// <summary>
+ /// </summary>
+ ConnectionOriented = 2,
+
+ /// <summary>
+ /// </summary>
+ All = 3,
+ } // TransportType
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/WebClient.cs b/mcs/class/System/System.Net/WebClient.cs
new file mode 100644
index 00000000000..17c5895ee3e
--- /dev/null
+++ b/mcs/class/System/System.Net/WebClient.cs
@@ -0,0 +1,123 @@
+//
+// System.Net.WebClient
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [ComVisible(true)]
+ public sealed class WebClient : Component
+ {
+
+ // Constructors
+
+ public WebClient ()
+ {
+ }
+
+ // Properties
+
+ [MonoTODO]
+ public string BaseAddress {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public ICredentials Credentials {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public WebHeaderCollection Headers {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public NameValueCollection QueryString {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public WebHeaderCollection ResponseHeaders {
+ get { throw new NotImplementedException (); }
+ }
+
+ // Methods
+
+ [MonoTODO]
+ public byte [] DownloadData (string address)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DownloadFile (string address, string fileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream OpenRead (string address)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream OpenWrite (string address)
+ {
+ return OpenWrite (address, "POST");
+ }
+
+ [MonoTODO]
+ public Stream OpenWrite (string address, string method)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public byte [] UploadData (string address, byte [] data)
+ {
+ return UploadData (address, "POST", data);
+ }
+
+ [MonoTODO]
+ public byte [] UploadData (string address, string method, byte [] data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public byte [] UploadFile (string address, string fileName)
+ {
+ return UploadFile (address, "POST", fileName);
+ }
+
+ [MonoTODO]
+ public byte[] UploadFile (string address, string method, string fileName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public byte[] UploadValues (string address, NameValueCollection data)
+ {
+ return UploadValues (address, "POST", data);
+ }
+
+ [MonoTODO]
+ public byte[] UploadValues (string address, string method, NameValueCollection data)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/WebException.cs b/mcs/class/System/System.Net/WebException.cs
new file mode 100644
index 00000000000..e3607a15a43
--- /dev/null
+++ b/mcs/class/System/System.Net/WebException.cs
@@ -0,0 +1,74 @@
+//
+// System.Net.WebException.cs
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class WebException : InvalidOperationException, ISerializable
+ {
+ private WebResponse response;
+ private WebExceptionStatus status;
+
+
+ // Constructors
+
+ public WebException () : base ()
+ {
+ }
+
+ public WebException (string message) : base (message)
+ {
+ }
+
+ protected WebException (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ : base (serializationInfo, streamingContext)
+ {
+ }
+
+ public WebException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ public WebException (string message, WebExceptionStatus status)
+ : base (message)
+ {
+ this.status = status;
+ }
+
+ public WebException(string message,
+ Exception innerException,
+ WebExceptionStatus status,
+ WebResponse response)
+ : base (message, innerException)
+ {
+ this.status = status;
+ this.response = response;
+ }
+
+ // Properties
+
+ public WebResponse Response {
+ get { return this.response; }
+ }
+
+ public WebExceptionStatus Status {
+ get { return this.status; }
+ }
+
+ // Methods
+
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net/WebExceptionStatus.cs b/mcs/class/System/System.Net/WebExceptionStatus.cs
new file mode 100755
index 00000000000..05dd876bac0
--- /dev/null
+++ b/mcs/class/System/System.Net/WebExceptionStatus.cs
@@ -0,0 +1,85 @@
+// WebExceptionStatus.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:08 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WebExceptionStatus {
+
+ /// <summary>
+ /// </summary>
+ Success = 0,
+
+ /// <summary>
+ /// </summary>
+ NameResolutionFailure = 1,
+
+ /// <summary>
+ /// </summary>
+ ConnectFailure = 2,
+
+ /// <summary>
+ /// </summary>
+ ReceiveFailure = 3,
+
+ /// <summary>
+ /// </summary>
+ SendFailure = 4,
+
+ /// <summary>
+ /// </summary>
+ PipelineFailure = 5,
+
+ /// <summary>
+ /// </summary>
+ RequestCanceled = 6,
+
+ /// <summary>
+ /// </summary>
+ ProtocolError = 7,
+
+ /// <summary>
+ /// </summary>
+ ConnectionClosed = 8,
+
+ /// <summary>
+ /// </summary>
+ TrustFailure = 9,
+
+ /// <summary>
+ /// </summary>
+ SecureChannelFailure = 10,
+
+ /// <summary>
+ /// </summary>
+ ServerProtocolViolation = 11,
+
+ /// <summary>
+ /// </summary>
+ KeepAliveFailure = 12,
+
+ /// <summary>
+ /// </summary>
+ Pending = 13,
+
+ /// <summary>
+ /// </summary>
+ Timeout = 14,
+
+ /// <summary>
+ /// </summary>
+ ProxyNameResolutionFailure = 15,
+ } // WebExceptionStatus
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/WebHeaderCollection.cs b/mcs/class/System/System.Net/WebHeaderCollection.cs
new file mode 100644
index 00000000000..5b4b2217943
--- /dev/null
+++ b/mcs/class/System/System.Net/WebHeaderCollection.cs
@@ -0,0 +1,310 @@
+//
+// System.Net.WebHeaderCollection
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Text;
+
+// See RFC 2068 par 4.2 Message Headers
+
+namespace System.Net
+{
+ [Serializable]
+ [ComVisible(true)]
+ public class WebHeaderCollection : NameValueCollection, ISerializable
+ {
+ private static readonly int [] restricted;
+ private static readonly int [] multiValue;
+ private bool internallyCreated = false;
+
+ // Static Initializer
+
+ static WebHeaderCollection ()
+ {
+ // For performance reasons we initialize the following
+ // tables by taking the hashcode of header names.
+ // When you add a header make sure all characters are in
+ // lowercase.
+
+ // the list of restricted header names as defined
+ // by the ms.net spec
+ ArrayList a = new ArrayList ();
+ a.Add ("accept".GetHashCode ());
+ a.Add ("connection".GetHashCode ());
+ a.Add ("content-length".GetHashCode ());
+ a.Add ("content-type".GetHashCode ());
+ a.Add ("date".GetHashCode ());
+ a.Add ("expect".GetHashCode ()); // ??? What is this anyway?
+ a.Add ("host".GetHashCode ());
+ a.Add ("range".GetHashCode ());
+ a.Add ("referer".GetHashCode ());
+ a.Add ("transfer-encoding".GetHashCode ());
+ a.Add ("user-agent".GetHashCode ());
+ restricted = (int []) a.ToArray (typeof (int));
+
+ // see par 14 of RFC 2068 to see which header names
+ // accept multiple values each separated by a comma
+ a = new ArrayList ();
+ a.Add ("accept".GetHashCode ());
+ a.Add ("accept-charset".GetHashCode ());
+ a.Add ("accept-encoding".GetHashCode ());
+ a.Add ("accept-language".GetHashCode ());
+ a.Add ("accept-ranges".GetHashCode ());
+ a.Add ("allow".GetHashCode ());
+ a.Add ("authorization".GetHashCode ());
+ a.Add ("cache-control".GetHashCode ());
+ a.Add ("connection".GetHashCode ());
+ a.Add ("content-encoding".GetHashCode ());
+ a.Add ("content-language".GetHashCode ());
+ a.Add ("expect".GetHashCode ());
+ a.Add ("if-match".GetHashCode ());
+ a.Add ("if-none-match".GetHashCode ());
+ a.Add ("proxy-authenticate".GetHashCode ());
+ a.Add ("public".GetHashCode ());
+ a.Add ("range".GetHashCode ());
+ a.Add ("transfer-encoding".GetHashCode ());
+ a.Add ("upgrade".GetHashCode ());
+ a.Add ("vary".GetHashCode ());
+ a.Add ("via".GetHashCode ());
+ a.Add ("warning".GetHashCode ());
+ multiValue = (int []) a.ToArray (typeof (int));
+ }
+
+ // Constructors
+
+ public WebHeaderCollection () { }
+
+ protected WebHeaderCollection (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ // TODO: test for compatibility with ms.net
+ int count = serializationInfo.GetInt32("count");
+ for (int i = 0; i < count; i++)
+ this.Add (serializationInfo.GetString ("k" + i),
+ serializationInfo.GetString ("v" + i));
+ }
+
+ internal WebHeaderCollection (bool dummy) : base ()
+ {
+ this.internallyCreated = true;
+ }
+
+ // Methods
+
+ public void Add (string header)
+ {
+ if (header == null)
+ throw new ArgumentNullException ("header");
+ int pos = header.IndexOf (':');
+ if (pos == -1)
+ throw new ArgumentException ("no colon found");
+ this.Add (header.Substring (0, pos),
+ header.Substring (pos + 1));
+ }
+
+ public override void Add (string name, string value)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (internallyCreated && IsRestricted (name))
+ throw new ArgumentException ("restricted header");
+ this.AddWithoutValidate (name, value);
+ }
+
+ protected void AddWithoutValidate (string headerName, string headerValue)
+ {
+ if (!IsHeaderName (headerName))
+ throw new ArgumentException ("invalid header name");
+ if (headerValue == null)
+ headerValue = String.Empty;
+ else
+ headerValue = headerValue.Trim ();
+ if (!IsHeaderValue (headerValue))
+ throw new ArgumentException ("invalid header value");
+ base.Add (headerName, headerValue);
+ }
+
+ public override string [] GetValues (string header)
+ {
+ if (header == null)
+ throw new ArgumentNullException ("header");
+ string [] values = base.GetValues (header);
+ if (values == null || values.Length == 0)
+ return null;
+ if (!IsMultiValue (header))
+ return values;
+ StringCollection col = new StringCollection ();
+ for (int i = 0; i < values.Length; i++) {
+ string [] s = values [i].Split (new char [] {','});
+ for (int j = 0; j < s.Length; j++)
+ s [j] = s [j].Trim ();
+ col.AddRange (s);
+ }
+ values = new string [col.Count];
+ col.CopyTo (values, 0);
+ return values;
+ }
+
+ public static bool IsRestricted (string headerName)
+ {
+ int hashCode = headerName.ToLower ().GetHashCode ();
+ for (int i = 0; i < restricted.Length; i++)
+ if (restricted [i] == hashCode)
+ return true;
+ return false;
+ }
+
+ [MonoTODO]
+ public override void OnDeserialization (object sender)
+ {
+ // no idea what to do here... spec doesn't say much
+ throw new NotImplementedException ();
+ }
+
+ public override void Remove (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (internallyCreated && IsRestricted (name))
+ throw new ArgumentException ("restricted header");
+ base.Remove (name);
+ }
+
+ public override void Set (string name, string value)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (internallyCreated && IsRestricted (name))
+ throw new ArgumentException ("restricted header");
+ if (!IsHeaderName (name))
+ throw new ArgumentException ("invalid header name");
+ if (value == null)
+ value = String.Empty;
+ else
+ value = value.Trim ();
+ if (!IsHeaderValue (value))
+ throw new ArgumentException ("invalid header value");
+ base.Set (name, value);
+ }
+
+ public byte[] ToByteArray ()
+ {
+ return Encoding.UTF8.GetBytes(ToString ());
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ int count = base.Count;
+ for (int i = 0; i < count ; i++)
+ sb.Append (GetKey (i))
+ .Append (": ")
+ .Append (Get (i))
+ .Append ("\r\n");
+
+ return sb.Append("\r\n").ToString();
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ int count = base.Count;
+ serializationInfo.AddValue ("count", count);
+ for (int i = 0; i < count ; i++) {
+ serializationInfo.AddValue ("k" + i, GetKey (i));
+ serializationInfo.AddValue ("v" + i, Get (i));
+ }
+ }
+
+ // Internal Methods
+
+ internal void SetInternal (string name, string value)
+ {
+ if (value == null)
+ value = String.Empty;
+ else
+ value = value.Trim ();
+ if (!IsHeaderValue (value))
+ throw new ArgumentException ("invalid header value");
+ base.Set (name, value);
+ }
+
+ internal void RemoveInternal (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ base.Remove (name);
+ }
+
+ // Private Methods
+
+ private static bool IsMultiValue (string headerName)
+ {
+ int hashCode = headerName.ToLower ().GetHashCode ();
+ for (int i = 0; i < multiValue.Length; i++)
+ if (multiValue [i] == hashCode)
+ return true;
+ return false;
+ }
+
+ private bool IsHeaderValue (string value)
+ {
+ // TEXT any 8 bit value except CTL's (0-31 and 127)
+ // but including \r\n space and \t
+ // after a newline at least one space or \t must follow
+ // certain header fields allow comments ()
+
+ int len = value.Length;
+ for (int i = 0; i < len; i++) {
+ char c = value [i];
+ if (c == 127)
+ return false;
+ if (c < 0x20 && (c != '\r' && c != '\n' && c != '\t'))
+ return false;
+ if (c == '\n' && ++i < len) {
+ c = value [i];
+ if (c != ' ' && c != '\t')
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private bool IsHeaderName (string name)
+ {
+ // token = 1*<any CHAR except CTLs or tspecials>
+ // tspecials = "(" | ")" | "<" | ">" | "@"
+ // | "," | ";" | ":" | "\" | <">
+ // | "/" | "[" | "]" | "?" | "="
+ // | "{" | "}" | SP | HT
+
+ if (name == null || name.Length == 0)
+ return false;
+
+ int len = name.Length;
+ for (int i = 0; i < len; i++) {
+ char c = name [i];
+ if (c < 0x20 || c >= 0x7f)
+ return false;
+ }
+
+ return name.IndexOfAny (tspecials) == -1;
+ }
+
+ private static char [] tspecials =
+ new char [] {'(', ')', '<', '>', '@',
+ ',', ';', ':', '\\', '"',
+ '/', '[', ']', '?', '=',
+ '{', '}', ' ', '\t'};
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/WebProxy.cs b/mcs/class/System/System.Net/WebProxy.cs
new file mode 100644
index 00000000000..05fde3d4d6d
--- /dev/null
+++ b/mcs/class/System/System.Net/WebProxy.cs
@@ -0,0 +1,194 @@
+//
+// System.Net.WebProxy
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+using System.Text.RegularExpressions;
+
+namespace System.Net
+{
+ [Serializable]
+ public class WebProxy : IWebProxy, ISerializable
+ {
+ private Uri address;
+ private bool bypassOnLocal;
+ private ArrayList bypassList;
+ private ICredentials credentials;
+
+ // Constructors
+
+ public WebProxy ()
+ : this ((Uri) null, false, null, null) {}
+
+ public WebProxy (string address)
+ : this (ToUri (address), false, null, null) {}
+
+ public WebProxy (Uri address)
+ : this (address, false, null, null) {}
+
+ public WebProxy (string address, bool bypassOnLocal)
+ : this (ToUri (address), bypassOnLocal, null, null) {}
+
+ public WebProxy (string host, int port)
+ : this (new Uri ("http://" + host + ":" + port)) {}
+
+ public WebProxy (Uri address, bool bypassOnLocal)
+ : this (address, bypassOnLocal, null, null) {}
+
+ public WebProxy (string address, bool bypassOnLocal, string [] bypassList)
+ : this (ToUri (address), bypassOnLocal, bypassList, null) {}
+
+ public WebProxy (Uri address, bool bypassOnLocal, string [] bypassList)
+ : this (address, bypassOnLocal, bypassList, null) {}
+
+ public WebProxy (string address, bool bypassOnLocal,
+ string[] bypassList, ICredentials credentials)
+ : this (ToUri (address), bypassOnLocal, bypassList, null) {}
+
+ public WebProxy (Uri address, bool bypassOnLocal,
+ string[] bypassList, ICredentials credentials)
+ {
+ this.address = address;
+ this.bypassOnLocal = bypassOnLocal;
+ if (bypassList == null)
+ bypassList = new string [] {};
+ this.bypassList = new ArrayList (bypassList);
+ this.credentials = credentials;
+ CheckBypassList ();
+ }
+
+ [MonoTODO]
+ protected WebProxy (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Properties
+
+ public Uri Address {
+ get { return address; }
+ set { address = value; }
+ }
+
+ public ArrayList BypassArrayList {
+ get {
+ return bypassList;
+ }
+ }
+
+ public string [] BypassList {
+ get { return (string []) bypassList.ToArray (typeof (string)); }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ bypassList = new ArrayList (value);
+ CheckBypassList ();
+ }
+ }
+
+ public bool BypassProxyOnLocal {
+ get { return bypassOnLocal; }
+ set { bypassOnLocal = value; }
+ }
+
+ public ICredentials Credentials {
+ get { return credentials; }
+ set { credentials = value; }
+ }
+
+ // Methods
+
+ [MonoTODO]
+ public static WebProxy GetDefaultProxy ()
+ {
+ // for Mono we should probably read in these settings
+ // from the global application configuration file
+
+ // for now, return the empty WebProxy to indicate
+ // no proxy is used
+ // return GlobalProxySelection.GetEmptyWebProxy ();
+ // ??
+
+ throw new NotImplementedException ();
+ }
+
+ public Uri GetProxy (Uri destination)
+ {
+ if (IsBypassed (destination))
+ return destination;
+
+ return address;
+ }
+
+ public bool IsBypassed (Uri host)
+ {
+ if (address == null)
+ return true;
+
+ if (host.IsLoopback)
+ return true;
+
+ if (bypassOnLocal && host.Host.IndexOf ('.') == -1)
+ return true;
+
+ try {
+ string hostStr = host.Scheme + "://" + host.Authority;
+ int i = 0;
+ for (; i < bypassList.Count; i++) {
+ Regex regex = new Regex ((string) bypassList [i],
+ // TODO: RegexOptions.Compiled | // not implemented yet by Regex
+ RegexOptions.IgnoreCase |
+ RegexOptions.Singleline);
+
+ if (regex.IsMatch (hostStr))
+ break;
+ }
+
+ if (i == bypassList.Count)
+ return false;
+
+ // continue checking correctness of regular expressions..
+ // will throw expression when an invalid one is found
+ for (; i < bypassList.Count; i++)
+ new Regex ((string) bypassList [i]);
+
+ return true;
+ } catch (ArgumentException) {
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // Private Methods
+
+ // this compiles the regular expressions, and will throw
+ // an exception when an invalid one is found.
+ private void CheckBypassList ()
+ {
+ for (int i = 0; i < bypassList.Count; i++)
+ new Regex ((string) bypassList [i]);
+ }
+
+ private static Uri ToUri (string address)
+ {
+ if (address == null)
+ return null;
+
+ if (address.IndexOf (':') == -1)
+ address = "http://" + address;
+
+ return new Uri (address);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/WebRequest.cs b/mcs/class/System/System.Net/WebRequest.cs
new file mode 100644
index 00000000000..0be53a781ef
--- /dev/null
+++ b/mcs/class/System/System.Net/WebRequest.cs
@@ -0,0 +1,216 @@
+//
+// System.Net.WebRequest
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public abstract class WebRequest : MarshalByRefObject, ISerializable
+ {
+ private static HybridDictionary prefixes;
+
+ static WebRequest () {
+ prefixes = new HybridDictionary (3, true);
+ RegisterPrefix ("file", new FileWebRequestCreator ());
+ RegisterPrefix ("http", new HttpWebRequestCreator ());
+ RegisterPrefix ("https", new HttpWebRequestCreator ());
+ }
+
+ internal class HttpWebRequestCreator : IWebRequestCreate
+ {
+ internal HttpWebRequestCreator () { }
+
+ public WebRequest Create (Uri uri)
+ {
+ return new HttpWebRequest (uri);
+ }
+ }
+
+ internal class FileWebRequestCreator : IWebRequestCreate
+ {
+ internal FileWebRequestCreator () { }
+
+ public WebRequest Create (Uri uri)
+ {
+ return new FileWebRequest (uri);
+ }
+ }
+
+
+ // Constructors
+
+ protected WebRequest () { }
+
+ protected WebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotSupportedException ();
+ }
+
+ // Properties
+
+ public virtual string ConnectionGroupName {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual long ContentLength {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual string ContentType {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual ICredentials Credentials {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual WebHeaderCollection Headers {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual string Method {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual bool PreAuthenticate {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual IWebProxy Proxy {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual Uri RequestUri {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual int Timeout {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ // Methods
+
+ public virtual void Abort()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public static WebRequest Create (string requestUriString)
+ {
+ if (requestUriString == null)
+ throw new ArgumentNullException ("requestUriString");
+ return Create (new Uri (requestUriString));
+ }
+
+ public static WebRequest Create (Uri requestUri)
+ {
+ if (requestUri == null)
+ throw new ArgumentNullException ("requestUri");
+ return GetCreator (requestUri.AbsoluteUri).Create (requestUri);
+ }
+
+ public static WebRequest CreateDefault (Uri requestUri)
+ {
+ if (requestUri == null)
+ throw new ArgumentNullException ("requestUri");
+ return GetCreator (requestUri.Scheme).Create (requestUri);
+ }
+
+ public virtual Stream EndGetRequestStream (IAsyncResult asyncResult)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual WebResponse EndGetResponse (IAsyncResult asyncResult)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual Stream GetRequestStream()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual WebResponse GetResponse()
+ {
+ throw new NotSupportedException ();
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public static bool RegisterPrefix (string prefix, IWebRequestCreate creator)
+ {
+ if (prefix == null)
+ throw new ArgumentNullException("prefix");
+ if (creator == null)
+ throw new ArgumentNullException("creator");
+
+ lock (prefixes.SyncRoot) {
+ if (prefixes.Contains (prefix))
+ return false;
+ prefixes.Add (prefix.ToLower (), creator);
+ }
+ return true;
+ }
+
+ private static IWebRequestCreate GetCreator (string prefix)
+ {
+ int longestPrefix = -1;
+ IWebRequestCreate creator = null;
+
+ prefix = prefix.ToLower ();
+
+ IDictionaryEnumerator e = prefixes.GetEnumerator ();
+ while (e.MoveNext ()) {
+ string key = e.Key as string;
+
+ if (key.Length <= longestPrefix)
+ continue;
+
+ if (!prefix.StartsWith (key))
+ continue;
+
+ longestPrefix = key.Length;
+ creator = (IWebRequestCreate) e.Value;
+ }
+
+ if (creator == null)
+ throw new NotSupportedException (prefix);
+
+ return creator;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/WebResponse.cs b/mcs/class/System/System.Net/WebResponse.cs
new file mode 100644
index 00000000000..e3b2285e88f
--- /dev/null
+++ b/mcs/class/System/System.Net/WebResponse.cs
@@ -0,0 +1,69 @@
+//
+// System.Net.WebResponse
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public abstract class WebResponse : MarshalByRefObject, ISerializable, IDisposable
+ {
+ // Constructors
+
+ protected WebResponse () { }
+
+ protected WebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new NotSupportedException ();
+ }
+
+ // Properties
+
+ public virtual long ContentLength {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual string ContentType {
+ get { throw new NotSupportedException (); }
+ set { throw new NotSupportedException (); }
+ }
+
+ public virtual WebHeaderCollection Headers {
+ get { throw new NotSupportedException (); }
+ }
+
+ public virtual Uri ResponseUri {
+ get { throw new NotSupportedException (); }
+ }
+
+ // Methods
+
+ public virtual void Close()
+ {
+ throw new NotSupportedException ();
+ }
+
+ public virtual Stream GetResponseStream()
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IDisposable.Dispose()
+ {
+ Close ();
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo,
+ StreamingContext streamingContext)
+ {
+ throw new NotSupportedException ();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/WebStatus.cs b/mcs/class/System/System.Net/WebStatus.cs
new file mode 100755
index 00000000000..5ad5450a738
--- /dev/null
+++ b/mcs/class/System/System.Net/WebStatus.cs
@@ -0,0 +1,77 @@
+// WebStatus.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:37:37 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WebStatus {
+
+ /// <summary>
+ /// </summary>
+ Success = 0,
+
+ /// <summary>
+ /// </summary>
+ NameResolutionFailure = 1,
+
+ /// <summary>
+ /// </summary>
+ ConnectFailure = 2,
+
+ /// <summary>
+ /// </summary>
+ ReceiveFailure = 3,
+
+ /// <summary>
+ /// </summary>
+ SendFailure = 4,
+
+ /// <summary>
+ /// </summary>
+ PipelineFailure = 5,
+
+ /// <summary>
+ /// </summary>
+ RequestCanceled = 6,
+
+ /// <summary>
+ /// </summary>
+ ProtocolError = 7,
+
+ /// <summary>
+ /// </summary>
+ ConnectionClosed = 8,
+
+ /// <summary>
+ /// </summary>
+ TrustFailure = 9,
+
+ /// <summary>
+ /// </summary>
+ SecureChannelFailure = 10,
+
+ /// <summary>
+ /// </summary>
+ ServerProtocolViolation = 11,
+
+ /// <summary>
+ /// </summary>
+ KeepAliveFailure = 12,
+
+ /// <summary>
+ /// </summary>
+ Pending = 13,
+ } // WebStatus
+
+} // System.Net
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
new file mode 100644
index 00000000000..0642777be8a
--- /dev/null
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -0,0 +1,8 @@
+2002-10-21 Miguel de Icaza <miguel@ximian.com>
+
+ * X509CertificateCollection.cs (Add): New method.
+
+2002-05-12 Lawrence Pit <loz@cable.a2000.nl>
+
+ * X509CertificateCollection.cs: implemented
+
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs
new file mode 100644
index 00000000000..c414ec8ab7a
--- /dev/null
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs
@@ -0,0 +1,154 @@
+//
+// System.Security.Cryptography.X509Certificates.X509CertificateCollection
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+ [Serializable]
+ public class X509CertificateCollection : CollectionBase, IEnumerable {
+
+ private ArrayList list = new ArrayList ();
+
+ // Constructors
+
+ public X509CertificateCollection () { }
+
+ public X509CertificateCollection (X509Certificate [] value)
+ {
+ AddRange (value);
+ }
+
+ public X509CertificateCollection (X509CertificateCollection value)
+ {
+ AddRange (value);
+ }
+
+ // Properties
+
+ public X509Certificate this [int index] {
+ get { return (X509Certificate) list [index]; }
+ set { list [index] = value; }
+ }
+
+ // Methods
+
+ public int Add (X509Certificate value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ return list.Add (value);
+ }
+
+ public void AddRange (X509Certificate [] value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ for (int i = 0; i < value.Length; i++)
+ list.Add (value);
+ }
+
+ public void AddRange (X509CertificateCollection value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ int len = value.list.Count;
+ for (int i = 0; i < len; i++)
+ this.list.Add (value);
+ }
+
+ public bool Contains (X509Certificate value)
+ {
+ return list.Contains (value);
+ }
+
+
+ public void CopyTo (X509Certificate [] array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public new X509CertificateEnumerator GetEnumerator()
+ {
+ return new X509CertificateEnumerator (this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public override int GetHashCode()
+ {
+ return list.GetHashCode ();
+ }
+
+ public int IndexOf (X509Certificate value)
+ {
+ return list.IndexOf (value);
+ }
+
+ public void Insert (int index, X509Certificate value)
+ {
+ list.Insert (index, value);
+ }
+
+ public void Remove (X509Certificate value)
+ {
+ list.Remove (value);
+ }
+
+ // Inner Class
+
+ public class X509CertificateEnumerator : IEnumerator {
+ private IEnumerator enumerator;
+
+ // Constructors
+
+ public X509CertificateEnumerator (X509CertificateCollection mappings)
+ {
+ enumerator = ((IEnumerable) mappings).GetEnumerator ();
+ }
+
+ // Properties
+
+ public X509Certificate Current {
+ get { return (X509Certificate) enumerator.Current; }
+ }
+
+ object IEnumerator.Current {
+ get { return (X509Certificate) enumerator.Current; }
+ }
+
+ // Methods
+
+ bool IEnumerator.MoveNext ()
+ {
+ return enumerator.MoveNext ();
+ }
+
+ void IEnumerator.Reset ()
+ {
+ enumerator.Reset ();
+ }
+
+ public bool MoveNext ()
+ {
+ return enumerator.MoveNext ();
+ }
+
+ public void Reset ()
+ {
+ enumerator.Reset ();
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Security.Permissions/ResourcePermissionBase.cs b/mcs/class/System/System.Security.Permissions/ResourcePermissionBase.cs
new file mode 100755
index 00000000000..dade994b5cd
--- /dev/null
+++ b/mcs/class/System/System.Security.Permissions/ResourcePermissionBase.cs
@@ -0,0 +1,118 @@
+//
+// System.Security.Permissions.ResourcePermissionBase.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+
+ [Serializable]
+ public class ResourcePermissionBase
+ : CodeAccessPermission, IUnrestrictedPermission {
+
+ [MonoTODO]
+ protected ResourcePermissionBase ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected ResourcePermissionBase (PermissionState state)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public const string Any = "any?";
+
+ [MonoTODO]
+ public const string Local = "local?";
+
+ [MonoTODO]
+ protected Type PermissionAccessType {
+ get {throw new NotImplementedException ();}
+ set {throw new NotImplementedException ();}
+ }
+
+ [MonoTODO]
+ protected string[] TagNames {
+ get {throw new NotImplementedException ();}
+ set {throw new NotImplementedException ();}
+ }
+
+ [MonoTODO]
+ protected void AddPermissionAccess (
+ ResourcePermissionBaseEntry entry)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void Clear ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement securityElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected ResourcePermissionBaseEntry[] GetPermissionEntries ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsUnrestricted ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void RemovePermissionAccess (
+ ResourcePermissionBaseEntry entry)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Security.Permissions/ResourcePermissionBaseEntry.cs b/mcs/class/System/System.Security.Permissions/ResourcePermissionBaseEntry.cs
new file mode 100755
index 00000000000..7bc09d5912f
--- /dev/null
+++ b/mcs/class/System/System.Security.Permissions/ResourcePermissionBaseEntry.cs
@@ -0,0 +1,42 @@
+//
+// System.Security.Permissions.ResourcePermissionBaseEntry.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+
+ [Serializable]
+ public class ResourcePermissionBaseEntry {
+
+ private int permissionAccess;
+ private string[] permissionAccessPath;
+
+ public ResourcePermissionBaseEntry ()
+ {
+ }
+
+ public ResourcePermissionBaseEntry (int permissionAccess,
+ string[] permissionAccessPath)
+ {
+ if (permissionAccessPath == null)
+ throw new ArgumentNullException (
+ "permissionAccessPath");
+ }
+
+ public int PermissionAccess {
+ get {return permissionAccess;}
+ }
+
+ public string[] PermissionAccessPath {
+ get {return permissionAccessPath;}
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Text.RegularExpressions/.cvsignore b/mcs/class/System/System.Text.RegularExpressions/.cvsignore
new file mode 100644
index 00000000000..0c2ee6906fa
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/.cvsignore
@@ -0,0 +1,4 @@
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog
new file mode 100644
index 00000000000..6fefb153305
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog
@@ -0,0 +1,77 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * collections.cs: fixed bug #30091.
+
+2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * regex.cs: fixed little mistake (closes #35860).
+
+2002-11-12 Jackson Harper <jackson@latitudegeo.com>
+
+ * arch.cs compiler.cs regex.cs: Added mapping attribute to MachineFactories
+
+2002-11-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * parser.cs: detect illegal \ at end of pattern. Fixes 31334.
+
+2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * parser.cs: applied fix from Tim Haynes (thaynes@openlinksw.com) to
+ solve bug #32807. Also modified GetMapping to return the same as MS.
+
+2002-08-28 Juli Mallett <jmallett@FreeBSD.org>
+
+ * arch.cs, compiler.cs: Give the interpreter machine a property
+ for the retrieval of the group count.
+
+ * regex.cs: Use the new GroupCount property of the factory to
+ initialise the current group count, and restructure code to compile
+ the pattern only the first time it is needed (essentially backing
+ out the previous revision of regex.cs, to use the new code.)
+
+2002-08-14 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * regex.cs: Added the ctr for ISerializable implementation and
+ implemented the GetObjectData function.
+
+2002-07-30 Juli Mallett <jmallett@FreeBSD.org>
+
+ * regex.cs: Fixed bug where the expression would not be
+ re-evaluated for grouping purposes when factory caches were
+ used, resulting in no groups being recognised after one call
+ with a given pattern and no change in options.
+
+2002-05-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * regex.cs: Fixed bug in split.
+
+2002-05-08 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * interpreter.cs: Moved to an array-based stack representation
+ for faster captures.
+
+ * match.cs, collections.cs: Decoupled capture representation from
+ interpreter internals.
+
+ * cache.cs: Changed Key type from struct to class for speed.
+
+2002-04-06 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * cache.cs: Object methods should be overridden with "override".
+
+2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * RegexRunner.cs, RegexRunnerFactory.cs: MS support classes. Stubs
+ added for completeness.
+
+ * regex.cs, match.cs, collections.cs: Serializable attribute.
+
+2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * regex.cs: Added static Matches and IsMatch methods.
+
+2002-04-03 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * ChangeLog: Added changelog.
+
+ * cache.cs: Fixed bug in MRUList.Evict.
diff --git a/mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs b/mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs
new file mode 100644
index 00000000000..dfed1ad2479
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs
@@ -0,0 +1,92 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: RegexRunner.cs
+//
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ public abstract class RegexRunner {
+ // constructor
+
+ protected internal RegexRunner () {
+ throw new NotImplementedException ("RegexRunner is not supported by Mono.");
+ }
+
+ // protected abstract
+
+ protected abstract bool FindFirstChar ();
+
+ protected abstract void Go ();
+
+ protected abstract void InitTrackCount ();
+
+ // protected methods
+
+ protected void Capture (int capnum, int start, int end) {
+ }
+
+ protected static bool CharInSet (char ch, string set, string category) {
+ return false;
+ }
+
+ protected void Crawl (int i) {
+ }
+
+ protected int CrawlPos () {
+ return 0;
+ }
+
+ protected void DoubleCrawl () {
+ }
+
+ protected void DoubleStack () {
+ }
+
+ protected void DoubleTrack () {
+ }
+
+ protected void EnsureStorage () {
+ }
+
+ protected bool IsBoundary (int index, int startpos, int endpos) {
+ return false;
+ }
+
+ protected bool IsECMABoundary (int index, int startpos, int endpos) {
+ return false;
+ }
+
+ protected bool IsMatched (int cap) {
+ return false;
+ }
+
+ protected int MatchIndex (int cap) {
+ return 0;
+ }
+
+ protected int MatchLength (int cap) {
+ return 0;
+ }
+
+ protected int PopCrawl () {
+ return 0;
+ }
+
+ protected void TransferCapture (int capnum, int uncapnum, int start, int end) {
+ }
+
+ protected void Uncapture () {
+ }
+
+ // internal
+
+ protected internal Match Scan (Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick) {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs b/mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs
new file mode 100644
index 00000000000..895ff165607
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs
@@ -0,0 +1,20 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: RegexRunnerFactory.cs
+//
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ public abstract class RegexRunnerFactory {
+ protected RegexRunnerFactory () {
+ throw new NotImplementedException ("RegexRunnerFactory is not supported by Mono.");
+ }
+
+ protected internal abstract RegexRunner CreateInstance ();
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/arch.cs b/mcs/class/System/System.Text.RegularExpressions/arch.cs
new file mode 100644
index 00000000000..ac3c94f559e
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/arch.cs
@@ -0,0 +1,336 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: arch.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ enum OpCode : ushort {
+ False = 0, // always fails
+ True, // always succeeds
+
+ // matching
+
+ Position, // zero-width position assertion
+ String, // match string literal
+ Reference, // back reference
+
+ // character matching
+
+ Character, // match character exactly
+ Category, // match character from category
+ Range, // match character from range
+ Set, // match character from set
+ In, // match character from group of tests
+
+ // capturing
+
+ Open, // open group
+ Close, // close group
+ Balance, // balance groups
+
+ // control flow
+
+ IfDefined, // conditional on capture
+ Sub, // non-backtracking subexpression
+ Test, // non-backtracking lookahead/behind
+ Branch, // alternative expression
+ Jump, // unconditional goto
+ Repeat, // new repeat context
+ Until, // repeat subexpression within context
+ FastRepeat, // repeat simple subexpression
+ Anchor, // anchoring expression
+
+ // miscellaneous
+
+ Info // pattern information
+ }
+
+ [Flags]
+ enum OpFlags : ushort {
+ None = 0x000,
+ Negate = 0x100, // succeed on mismatch
+ IgnoreCase = 0x200, // case insensitive matching
+ RightToLeft = 0x400, // right-to-left matching
+ Lazy = 0x800 // minimizing repeat
+ }
+
+ enum Position : ushort {
+ Any, // anywhere
+ Start, // start of string \A
+ StartOfString, // start of string \A
+ StartOfLine, // start of line ^
+ StartOfScan, // start of scan \G
+ End, // end or before newline at end \Z
+ EndOfString, // end of string \z
+ EndOfLine, // end of line $
+ Boundary, // word boundary \b
+ NonBoundary // not word boundary \B
+ };
+
+ // see category.cs for Category enum
+
+ interface IMachine {
+ Match Scan (Regex regex, string text, int start, int end);
+ }
+
+ interface IMachineFactory {
+ IMachine NewInstance ();
+ IDictionary Mapping { get; set; }
+ int GroupCount { get; }
+ }
+
+ // Anchor SKIP OFFSET
+ //
+ // Flags: [RightToLeft] ??
+ // SKIP: relative address of tail expression
+ // OFFSET: offset of anchor from start of pattern
+ //
+ // Usage:
+ //
+ // Anchor :1 OFFSET
+ // <expr>
+ // True
+ // 1: <tail>
+ //
+ // Notes:
+ //
+ // In practice, the anchoring expression is only going to be
+ // Position (StartOfString, StartOfLine, StartOfScan) or String.
+ // This is because the optimizer looks for position anchors at the
+ // start of the expression, and if that fails it looks for the
+ // longest substring. If an expression has neither a position
+ // anchor or a longest substring anchor, then the anchoring expression
+ // is left empty. Since an empty expression will anchor at any
+ // position in any string, the entire input string will be scanned.
+
+ // String LEN STR...
+ //
+ // Flags: [RightToLeft, IgnoreCase]
+ // LEN: length of string
+ // STR: string characters
+
+ // Branch SKIP
+ //
+ // SKIP: relative address of next branch
+ //
+ // Branch :1
+ // <alt expr 1>
+ // Jump :4
+ // 1: Branch :2
+ // <alt expr 2>
+ // Jump :4
+ // 2: Branch :3
+ // <alt expr 3>
+ // Jump :4
+ // 3: False
+ // 4: <tail>
+
+ // Repeat SKIP MIN MAX
+ //
+ // Flags: [Lazy]
+ // SKIP: relative address of Until instruction
+ // MIN: minimum iterations
+ // MAX: maximum iterations (0xffff is infinity)
+ //
+ // Repeat :1 MIN MAX
+ // <expr>
+ // Until
+ // 1: <tail>
+
+ // FastRepeat SKIP MIN MAX
+ //
+ // Flags: [Lazy]
+ // SKIP: relative address of tail expression
+ // MIN: minimum iterations
+ // MAX: maximum iterations (0xffff is infinity)
+ //
+ // FastRepeat :1 MIN MAX
+ // <expr>
+ // True
+ // 1: <tail>
+ //
+ // Notes:
+ //
+ // The subexpression of a FastRepeat construct must not contain any
+ // complex operators. These include: Open, Close, Balance, Repeat,
+ // FastRepeat, Sub, Test. In addition, the subexpression must have
+ // been determined to have a fixed width.
+
+ // Sub SKIP
+ //
+ // SKIP: relative address of tail expression
+ //
+ // Sub :1
+ // <expr>
+ // 1: <tail>
+ //
+ // Notes:
+ //
+ // The Sub operator invokes an independent subexpression. This means
+ // that the subexpression will match only once and so will not
+ // participate in any backtracking.
+
+ // Test TSKIP FSKIP
+ //
+ // TSKIP: relative address of true expression
+ // FSKIP: relative address of false expression
+ //
+ // Usage: (?(?=test)true|false)
+ //
+ // Test :1 :2
+ // <test expr>
+ // 1: <true expr>
+ // Jump
+ // 2: <false epxr>
+ // <tail>
+ //
+ // Usage: (?(?=test)true)
+ //
+ // Test :1 :2
+ // <test expr>
+ // 1: <true expr>
+ // 2: <tail>
+ //
+ // Usage: (?=test)
+ //
+ // Test :1 :2
+ // <test expr>
+ // 1: <true expr>
+ // Jump 3:
+ // 2: False
+ // 3: <tail>
+ //
+ // Notes:
+ //
+ // For negative lookaheads, just swap the values of TSKIP and
+ // FSKIP. For lookbehinds, the test expression must be compiled
+ // in reverse. The test expression is always executed as an
+ // independent subexpression, so its behaviour is non-backtracking
+ // (like a Sub clause.)
+
+ // IfDefined SKIP GID
+ //
+ // SKIP: relative address of else expression
+ // GID: number of group to check
+ //
+ // Usage: (?(gid)true)
+ //
+ // IfDefined :1
+ // <true expr>
+ // 1: <tail>
+ //
+ // Usage: (?(gid)true|false)
+ //
+ // IfDefined :1
+ // <true expr>
+ // Jump :2
+ // 1: <false expr>
+ // 2: <tail>
+
+ // Jump SKIP
+ //
+ // SKIP: relative address of target expression
+ //
+ // Jump :1
+ // ...
+ // :1 <target expr>
+
+ // Character CHAR
+ //
+ // Flags: [Negate, IgnoreCase, RightToLeft]
+ // CHAR: exact character to match
+
+ // Category CAT
+ //
+ // Flags: [Negate, RightToLeft]
+ // CAT: category to match (see Category enum)
+
+ // Range LO HI
+ //
+ // Flags: [Negate, IgnoreCase, RightToLeft]
+ // LO: lowest character in range
+ // HI: higest character in range
+
+ // Set LO LEN SET...
+ //
+ // Flags: [Negate, IgnoreCase, RightToLeft]
+ // LO: lowest character in set
+ // LEN: number of words in set
+ // SET: bit array representing characters in set
+ //
+ // Notes:
+ //
+ // Each word in the set represents 16 characters, so the first word
+ // defines membership for characters LO to LO + 15, the second for
+ // LO + 16 to LO + 31, and so on up to LO + (LEN * 16 - 1). It is
+ // up to the compiler to provide a compact representation for sparse
+ // unicode sets. The simple way is to use Set 0 4096. Other methods
+ // involve paritioning the set and placing the components into an
+ // In block.
+
+ // In SKIP
+ //
+ // SKIP: relative address of tail expression
+ //
+ // Usage: [expr]
+ //
+ // In :1
+ // <expr>
+ // True
+ // :1 <tail>
+ //
+ // Usage: [^expr]
+ //
+ // In :1
+ // <expr>
+ // False
+ // :1 <tail>
+ //
+ // Notes:
+ //
+ // The In instruction consumes a single character, using the flags
+ // of the first instruction in the subexpression to determine its
+ // IgnoreCase and RightToLeft properties. The subexpression is then
+ // applied to the single character as a disjunction. If any instruction
+ // in the subexpression succeeds, the entire In construct succeeds
+ // and matching continues with the tail.
+
+ // Position POS
+ //
+ // POS: position to match (see Position enum)
+
+ // Open GID
+ //
+ // GID: number of group to open
+
+ // Close GID
+ //
+ // GID: number of group to close
+
+ // Balance GID BAL
+ //
+ // GID: number of capturing group (0 if none)
+ // BAL: number of group to undefine
+
+ // Info GROUPS MIN MAX
+ //
+ // GROUPS: number of capturing groups
+ // MIN: minimum width of pattern
+ // MAX: maximum width of pattern (0xffff means undefined)
+
+ // False
+
+ // True
+
+ // Reference GID
+ //
+ // Flags: [IgnoreCase, RightToLeft]
+ // GID: number of group to reference
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/cache.cs b/mcs/class/System/System.Text.RegularExpressions/cache.cs
new file mode 100644
index 00000000000..b77278fee80
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/cache.cs
@@ -0,0 +1,143 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: cache.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ class FactoryCache {
+ public FactoryCache (int capacity) {
+ this.capacity = capacity;
+ this.factories = new Hashtable (capacity);
+ this.mru_list = new MRUList ();
+ }
+
+ public void Add (string pattern, RegexOptions options, IMachineFactory factory) {
+ lock (this) {
+ Key k = new Key (pattern, options);
+
+ while (factories.Count >= capacity) {
+ object victim = mru_list.Evict ();
+ if (victim != null)
+ factories.Remove ((Key)victim);
+ }
+
+ factories[k] = factory;
+ mru_list.Use (k);
+ }
+ }
+
+ public IMachineFactory Lookup (string pattern, RegexOptions options) {
+ lock (this) {
+ Key k = new Key (pattern, options);
+ if (factories.Contains (k)) {
+ mru_list.Use (k);
+ return (IMachineFactory)factories[k];
+ }
+ }
+
+ return null;
+ }
+
+ private int capacity;
+ private Hashtable factories;
+ private MRUList mru_list;
+
+ class Key {
+ public string pattern;
+ public RegexOptions options;
+
+ public Key (string pattern, RegexOptions options) {
+ this.pattern = pattern;
+ this.options = options;
+ }
+
+ public override int GetHashCode () {
+ return pattern.GetHashCode () ^ (int)options;
+ }
+
+ public override bool Equals (object o) {
+ if (o == null || !(o is Key))
+ return false;
+
+ Key k = (Key)o;
+ return options == k.options && pattern.Equals (k.pattern);
+ }
+
+ public override string ToString () {
+ return "('" + pattern + "', [" + options + "])";
+ }
+ }
+ }
+
+ class MRUList {
+ public MRUList () {
+ head = tail = null;
+ }
+
+ public void Use (object o) {
+ Node node;
+
+ if (head == null) {
+ node = new Node (o);
+ head = tail = node;
+ return;
+ }
+
+ node = head;
+ while (node != null && !o.Equals (node.value))
+ node = node.previous;
+
+ if (node == null)
+ node = new Node (o);
+ else {
+ if (node == head)
+ return;
+
+ if (node == tail)
+ tail = node.next;
+ else
+ node.previous.next = node.next;
+
+ node.next.previous = node.previous;
+ }
+
+ head.next = node;
+ node.previous = head;
+ node.next = null;
+ head = node;
+ }
+
+ public object Evict () {
+ if (tail == null)
+ return null;
+
+ object o = tail.value;
+ tail = tail.next;
+
+ if (tail == null)
+ head = null;
+ else
+ tail.previous = null;
+
+ return o;
+ }
+
+ private Node head, tail;
+
+ private class Node {
+ public object value;
+ public Node previous, next;
+
+ public Node (object value) {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/category.cs b/mcs/class/System/System.Text.RegularExpressions/category.cs
new file mode 100644
index 00000000000..763712cb581
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/category.cs
@@ -0,0 +1,637 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: category.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Globalization;
+
+namespace System.Text.RegularExpressions {
+
+ enum Category : ushort {
+ None,
+
+ // canonical classes
+
+ Any, // any character except newline .
+ AnySingleline, // any character . (s option)
+ Word, // any word character \w
+ Digit, // any digit character \d
+ WhiteSpace, // any whitespace character \s
+
+ // ECMAScript classes
+
+
+ EcmaAny,
+ EcmaAnySingleline,
+ EcmaWord, // [a-zA-Z_0-9]
+ EcmaDigit, // [0-9]
+ EcmaWhiteSpace, // [ \f\n\r\t\v]
+
+ // unicode categories
+
+ UnicodeL, // Letter
+ UnicodeM, // Mark
+ UnicodeN, // Number
+ UnicodeZ, // Separator
+ UnicodeP, // Punctuation
+ UnicodeS, // Symbol
+ UnicodeC, // Other
+
+ UnicodeLu, // UppercaseLetter
+ UnicodeLl, // LowercaseLetter
+ UnicodeLt, // TitlecaseLetter
+ UnicodeLm, // ModifierLetter
+ UnicodeLo, // OtherLetter
+ UnicodeMn, // NonspacingMark
+ UnicodeMe, // EnclosingMark
+ UnicodeMc, // SpacingMark
+ UnicodeNd, // DecimalNumber
+ UnicodeNl, // LetterNumber
+ UnicodeNo, // OtherNumber
+ UnicodeZs, // SpaceSeparator
+ UnicodeZl, // LineSeparator
+ UnicodeZp, // ParagraphSeparator
+ UnicodePd, // DashPunctuation
+ UnicodePs, // OpenPunctuation
+ UnicodePi, // InitialPunctuation
+ UnicodePe, // ClosePunctuation
+ UnicodePf, // FinalPunctuation
+ UnicodePc, // ConnectorPunctuation
+ UnicodePo, // OtherPunctuation
+ UnicodeSm, // MathSymbol
+ UnicodeSc, // CurrencySymbol
+ UnicodeSk, // ModifierSymbol
+ UnicodeSo, // OtherSymbol
+ UnicodeCc, // Control
+ UnicodeCf, // Format
+ UnicodeCo, // PrivateUse
+ UnicodeCs, // Surrogate
+ UnicodeCn, // Unassigned
+
+ // unicode block ranges
+
+ // notes: the categories marked with a star are valid unicode block ranges,
+ // but don't seem to be accepted by the MS parser using the /p{...} format.
+ // any ideas?
+
+ UnicodeBasicLatin,
+ UnicodeLatin1Supplement, // *
+ UnicodeLatinExtendedA, // *
+ UnicodeLatinExtendedB, // *
+ UnicodeIPAExtensions,
+ UnicodeSpacingModifierLetters,
+ UnicodeCombiningDiacriticalMarks,
+ UnicodeGreek,
+ UnicodeCyrillic,
+ UnicodeArmenian,
+ UnicodeHebrew,
+ UnicodeArabic,
+ UnicodeSyriac,
+ UnicodeThaana,
+ UnicodeDevanagari,
+ UnicodeBengali,
+ UnicodeGurmukhi,
+ UnicodeGujarati,
+ UnicodeOriya,
+ UnicodeTamil,
+ UnicodeTelugu,
+ UnicodeKannada,
+ UnicodeMalayalam,
+ UnicodeSinhala,
+ UnicodeThai,
+ UnicodeLao,
+ UnicodeTibetan,
+ UnicodeMyanmar,
+ UnicodeGeorgian,
+ UnicodeHangulJamo,
+ UnicodeEthiopic,
+ UnicodeCherokee,
+ UnicodeUnifiedCanadianAboriginalSyllabics,
+ UnicodeOgham,
+ UnicodeRunic,
+ UnicodeKhmer,
+ UnicodeMongolian,
+ UnicodeLatinExtendedAdditional,
+ UnicodeGreekExtended,
+ UnicodeGeneralPunctuation,
+ UnicodeSuperscriptsandSubscripts,
+ UnicodeCurrencySymbols,
+ UnicodeCombiningMarksforSymbols,
+ UnicodeLetterlikeSymbols,
+ UnicodeNumberForms,
+ UnicodeArrows,
+ UnicodeMathematicalOperators,
+ UnicodeMiscellaneousTechnical,
+ UnicodeControlPictures,
+ UnicodeOpticalCharacterRecognition,
+ UnicodeEnclosedAlphanumerics,
+ UnicodeBoxDrawing,
+ UnicodeBlockElements,
+ UnicodeGeometricShapes,
+ UnicodeMiscellaneousSymbols,
+ UnicodeDingbats,
+ UnicodeBraillePatterns,
+ UnicodeCJKRadicalsSupplement,
+ UnicodeKangxiRadicals,
+ UnicodeIdeographicDescriptionCharacters,
+ UnicodeCJKSymbolsandPunctuation,
+ UnicodeHiragana,
+ UnicodeKatakana,
+ UnicodeBopomofo,
+ UnicodeHangulCompatibilityJamo,
+ UnicodeKanbun,
+ UnicodeBopomofoExtended,
+ UnicodeEnclosedCJKLettersandMonths,
+ UnicodeCJKCompatibility,
+ UnicodeCJKUnifiedIdeographsExtensionA,
+ UnicodeCJKUnifiedIdeographs,
+ UnicodeYiSyllables,
+ UnicodeYiRadicals,
+ UnicodeHangulSyllables,
+ UnicodeHighSurrogates,
+ UnicodeHighPrivateUseSurrogates,
+ UnicodeLowSurrogates,
+ UnicodePrivateUse,
+ UnicodeCJKCompatibilityIdeographs,
+ UnicodeAlphabeticPresentationForms,
+ UnicodeArabicPresentationFormsA, // *
+ UnicodeCombiningHalfMarks,
+ UnicodeCJKCompatibilityForms,
+ UnicodeSmallFormVariants,
+ UnicodeArabicPresentationFormsB, // *
+ UnicodeSpecials,
+ UnicodeHalfwidthandFullwidthForms,
+
+ UnicodeOldItalic,
+ UnicodeGothic,
+ UnicodeDeseret,
+ UnicodeByzantineMusicalSymbols,
+ UnicodeMusicalSymbols,
+ UnicodeMathematicalAlphanumericSymbols,
+ UnicodeCJKUnifiedIdeographsExtensionB,
+ UnicodeCJKCompatibilityIdeographsSupplement,
+ UnicodeTags
+ }
+
+ class CategoryUtils {
+ public static Category CategoryFromName (string name) {
+ try {
+ if (name.Substring (0, 2).Equals ("Is")) // remove prefix from block range
+ name = name.Substring (2);
+
+ return (Category)Enum.Parse (typeof (Category), "Unicode" + name);
+ }
+ catch (ArgumentException) {
+ return Category.None;
+ }
+ }
+
+ public static bool IsCategory (Category cat, char c) {
+ switch (cat) {
+ case Category.None:
+ return false;
+
+ case Category.Any:
+ return c != '\n';
+
+ case Category.AnySingleline:
+ return true;
+
+ case Category.Word:
+ return
+ Char.IsLetterOrDigit (c) ||
+ IsCategory (UnicodeCategory.ConnectorPunctuation, c);
+
+ case Category.Digit:
+ return Char.IsDigit (c);
+
+ case Category.WhiteSpace:
+ return Char.IsWhiteSpace (c);
+
+ // ECMA categories
+
+ case Category.EcmaAny:
+ return c != '\n';
+
+ case Category.EcmaAnySingleline:
+ return true;
+
+ case Category.EcmaWord:
+ return
+ 'a' <= c && c <= 'z' ||
+ 'A' <= c && c <= 'Z' ||
+ '0' <= c && c <= '9' ||
+ '_' == c;
+
+ case Category.EcmaDigit:
+ return
+ '0' <= c && c <= 9;
+
+ case Category.EcmaWhiteSpace:
+ return
+ c == ' ' ||
+ c == '\f' ||
+ c == '\n' ||
+ c == '\r' ||
+ c == '\t' ||
+ c == '\v';
+
+ // Unicode categories...
+
+ // letter
+
+ case Category.UnicodeLu: return IsCategory (UnicodeCategory.UppercaseLetter, c);
+ case Category.UnicodeLl: return IsCategory (UnicodeCategory.LowercaseLetter, c);
+ case Category.UnicodeLt: return IsCategory (UnicodeCategory.TitlecaseLetter, c);
+ case Category.UnicodeLm: return IsCategory (UnicodeCategory.ModifierLetter, c);
+ case Category.UnicodeLo: return IsCategory (UnicodeCategory.OtherLetter, c);
+
+ // mark
+
+ case Category.UnicodeMn: return IsCategory (UnicodeCategory.NonSpacingMark, c);
+ case Category.UnicodeMe: return IsCategory (UnicodeCategory.EnclosingMark, c);
+ case Category.UnicodeMc: return IsCategory (UnicodeCategory.SpacingCombiningMark, c);
+ case Category.UnicodeNd: return IsCategory (UnicodeCategory.DecimalDigitNumber, c);
+
+ // number
+
+ case Category.UnicodeNl: return IsCategory (UnicodeCategory.LetterNumber, c);
+ case Category.UnicodeNo: return IsCategory (UnicodeCategory.OtherNumber, c);
+
+ // separator
+
+ case Category.UnicodeZs: return IsCategory (UnicodeCategory.SpaceSeparator, c);
+ case Category.UnicodeZl: return IsCategory (UnicodeCategory.LineSeparator, c);
+ case Category.UnicodeZp: return IsCategory (UnicodeCategory.ParagraphSeparator, c);
+
+ // punctuation
+
+ case Category.UnicodePd: return IsCategory (UnicodeCategory.DashPunctuation, c);
+ case Category.UnicodePs: return IsCategory (UnicodeCategory.OpenPunctuation, c);
+ case Category.UnicodePi: return IsCategory (UnicodeCategory.InitialQuotePunctuation, c);
+ case Category.UnicodePe: return IsCategory (UnicodeCategory.ClosePunctuation, c);
+ case Category.UnicodePf: return IsCategory (UnicodeCategory.FinalQuotePunctuation, c);
+ case Category.UnicodePc: return IsCategory (UnicodeCategory.ConnectorPunctuation, c);
+ case Category.UnicodePo: return IsCategory (UnicodeCategory.OtherPunctuation, c);
+
+ // symbol
+
+ case Category.UnicodeSm: return IsCategory (UnicodeCategory.MathSymbol, c);
+ case Category.UnicodeSc: return IsCategory (UnicodeCategory.CurrencySymbol, c);
+ case Category.UnicodeSk: return IsCategory (UnicodeCategory.ModifierSymbol, c);
+ case Category.UnicodeSo: return IsCategory (UnicodeCategory.OtherSymbol, c);
+
+ // other
+
+ case Category.UnicodeCc: return IsCategory (UnicodeCategory.Control, c);
+ case Category.UnicodeCf: return IsCategory (UnicodeCategory.Format, c);
+ case Category.UnicodeCo: return IsCategory (UnicodeCategory.PrivateUse, c);
+ case Category.UnicodeCs: return IsCategory (UnicodeCategory.Surrogate, c);
+ case Category.UnicodeCn: return IsCategory (UnicodeCategory.OtherNotAssigned, c);
+
+ case Category.UnicodeL: // letter
+ return
+ IsCategory (UnicodeCategory.UppercaseLetter, c) ||
+ IsCategory (UnicodeCategory.LowercaseLetter, c) ||
+ IsCategory (UnicodeCategory.TitlecaseLetter, c) ||
+ IsCategory (UnicodeCategory.ModifierLetter, c) ||
+ IsCategory (UnicodeCategory.OtherLetter, c);
+
+ case Category.UnicodeM: // mark
+ return
+ IsCategory (UnicodeCategory.NonSpacingMark, c) ||
+ IsCategory (UnicodeCategory.EnclosingMark, c) ||
+ IsCategory (UnicodeCategory.SpacingCombiningMark, c);
+
+ case Category.UnicodeN: // number
+ return
+ IsCategory (UnicodeCategory.DecimalDigitNumber, c) ||
+ IsCategory (UnicodeCategory.LetterNumber, c) ||
+ IsCategory (UnicodeCategory.OtherNumber, c);
+
+ case Category.UnicodeZ: // separator
+ return
+ IsCategory (UnicodeCategory.SpaceSeparator, c) ||
+ IsCategory (UnicodeCategory.LineSeparator, c) ||
+ IsCategory (UnicodeCategory.ParagraphSeparator, c);
+
+ case Category.UnicodeP: // punctuation
+ return
+ IsCategory (UnicodeCategory.DashPunctuation, c) ||
+ IsCategory (UnicodeCategory.OpenPunctuation, c) ||
+ IsCategory (UnicodeCategory.InitialQuotePunctuation, c) ||
+ IsCategory (UnicodeCategory.ClosePunctuation, c) ||
+ IsCategory (UnicodeCategory.FinalQuotePunctuation, c) ||
+ IsCategory (UnicodeCategory.ConnectorPunctuation, c) ||
+ IsCategory (UnicodeCategory.OtherPunctuation, c);
+
+ case Category.UnicodeS: // symbol
+ return
+ IsCategory (UnicodeCategory.MathSymbol, c) ||
+ IsCategory (UnicodeCategory.CurrencySymbol, c) ||
+ IsCategory (UnicodeCategory.ModifierSymbol, c) ||
+ IsCategory (UnicodeCategory.OtherSymbol, c);
+
+ case Category.UnicodeC: // other
+ return
+ IsCategory (UnicodeCategory.Control, c) ||
+ IsCategory (UnicodeCategory.Format, c) ||
+ IsCategory (UnicodeCategory.PrivateUse, c) ||
+ IsCategory (UnicodeCategory.Surrogate, c) ||
+ IsCategory (UnicodeCategory.OtherNotAssigned, c);
+
+ // Unicode block ranges...
+
+ case Category.UnicodeBasicLatin:
+ return '\u0000' <= c && c <= '\u007F';
+
+ case Category.UnicodeLatin1Supplement:
+ return '\u0080' <= c && c <= '\u00FF';
+
+ case Category.UnicodeLatinExtendedA:
+ return '\u0100' <= c && c <= '\u017F';
+
+ case Category.UnicodeLatinExtendedB:
+ return '\u0180' <= c && c <= '\u024F';
+
+ case Category.UnicodeIPAExtensions:
+ return '\u0250' <= c && c <= '\u02AF';
+
+ case Category.UnicodeSpacingModifierLetters:
+ return '\u02B0' <= c && c <= '\u02FF';
+
+ case Category.UnicodeCombiningDiacriticalMarks:
+ return '\u0300' <= c && c <= '\u036F';
+
+ case Category.UnicodeGreek:
+ return '\u0370' <= c && c <= '\u03FF';
+
+ case Category.UnicodeCyrillic:
+ return '\u0400' <= c && c <= '\u04FF';
+
+ case Category.UnicodeArmenian:
+ return '\u0530' <= c && c <= '\u058F';
+
+ case Category.UnicodeHebrew:
+ return '\u0590' <= c && c <= '\u05FF';
+
+ case Category.UnicodeArabic:
+ return '\u0600' <= c && c <= '\u06FF';
+
+ case Category.UnicodeSyriac:
+ return '\u0700' <= c && c <= '\u074F';
+
+ case Category.UnicodeThaana:
+ return '\u0780' <= c && c <= '\u07BF';
+
+ case Category.UnicodeDevanagari:
+ return '\u0900' <= c && c <= '\u097F';
+
+ case Category.UnicodeBengali:
+ return '\u0980' <= c && c <= '\u09FF';
+
+ case Category.UnicodeGurmukhi:
+ return '\u0A00' <= c && c <= '\u0A7F';
+
+ case Category.UnicodeGujarati:
+ return '\u0A80' <= c && c <= '\u0AFF';
+
+ case Category.UnicodeOriya:
+ return '\u0B00' <= c && c <= '\u0B7F';
+
+ case Category.UnicodeTamil:
+ return '\u0B80' <= c && c <= '\u0BFF';
+
+ case Category.UnicodeTelugu:
+ return '\u0C00' <= c && c <= '\u0C7F';
+
+ case Category.UnicodeKannada:
+ return '\u0C80' <= c && c <= '\u0CFF';
+
+ case Category.UnicodeMalayalam:
+ return '\u0D00' <= c && c <= '\u0D7F';
+
+ case Category.UnicodeSinhala:
+ return '\u0D80' <= c && c <= '\u0DFF';
+
+ case Category.UnicodeThai:
+ return '\u0E00' <= c && c <= '\u0E7F';
+
+ case Category.UnicodeLao:
+ return '\u0E80' <= c && c <= '\u0EFF';
+
+ case Category.UnicodeTibetan:
+ return '\u0F00' <= c && c <= '\u0FFF';
+
+ case Category.UnicodeMyanmar:
+ return '\u1000' <= c && c <= '\u109F';
+
+ case Category.UnicodeGeorgian:
+ return '\u10A0' <= c && c <= '\u10FF';
+
+ case Category.UnicodeHangulJamo:
+ return '\u1100' <= c && c <= '\u11FF';
+
+ case Category.UnicodeEthiopic:
+ return '\u1200' <= c && c <= '\u137F';
+
+ case Category.UnicodeCherokee:
+ return '\u13A0' <= c && c <= '\u13FF';
+
+ case Category.UnicodeUnifiedCanadianAboriginalSyllabics:
+ return '\u1400' <= c && c <= '\u167F';
+
+ case Category.UnicodeOgham:
+ return '\u1680' <= c && c <= '\u169F';
+
+ case Category.UnicodeRunic:
+ return '\u16A0' <= c && c <= '\u16FF';
+
+ case Category.UnicodeKhmer:
+ return '\u1780' <= c && c <= '\u17FF';
+
+ case Category.UnicodeMongolian:
+ return '\u1800' <= c && c <= '\u18AF';
+
+ case Category.UnicodeLatinExtendedAdditional:
+ return '\u1E00' <= c && c <= '\u1EFF';
+
+ case Category.UnicodeGreekExtended:
+ return '\u1F00' <= c && c <= '\u1FFF';
+
+ case Category.UnicodeGeneralPunctuation:
+ return '\u2000' <= c && c <= '\u206F';
+
+ case Category.UnicodeSuperscriptsandSubscripts:
+ return '\u2070' <= c && c <= '\u209F';
+
+ case Category.UnicodeCurrencySymbols:
+ return '\u20A0' <= c && c <= '\u20CF';
+
+ case Category.UnicodeCombiningMarksforSymbols:
+ return '\u20D0' <= c && c <= '\u20FF';
+
+ case Category.UnicodeLetterlikeSymbols:
+ return '\u2100' <= c && c <= '\u214F';
+
+ case Category.UnicodeNumberForms:
+ return '\u2150' <= c && c <= '\u218F';
+
+ case Category.UnicodeArrows:
+ return '\u2190' <= c && c <= '\u21FF';
+
+ case Category.UnicodeMathematicalOperators:
+ return '\u2200' <= c && c <= '\u22FF';
+
+ case Category.UnicodeMiscellaneousTechnical:
+ return '\u2300' <= c && c <= '\u23FF';
+
+ case Category.UnicodeControlPictures:
+ return '\u2400' <= c && c <= '\u243F';
+
+ case Category.UnicodeOpticalCharacterRecognition:
+ return '\u2440' <= c && c <= '\u245F';
+
+ case Category.UnicodeEnclosedAlphanumerics:
+ return '\u2460' <= c && c <= '\u24FF';
+
+ case Category.UnicodeBoxDrawing:
+ return '\u2500' <= c && c <= '\u257F';
+
+ case Category.UnicodeBlockElements:
+ return '\u2580' <= c && c <= '\u259F';
+
+ case Category.UnicodeGeometricShapes:
+ return '\u25A0' <= c && c <= '\u25FF';
+
+ case Category.UnicodeMiscellaneousSymbols:
+ return '\u2600' <= c && c <= '\u26FF';
+
+ case Category.UnicodeDingbats:
+ return '\u2700' <= c && c <= '\u27BF';
+
+ case Category.UnicodeBraillePatterns:
+ return '\u2800' <= c && c <= '\u28FF';
+
+ case Category.UnicodeCJKRadicalsSupplement:
+ return '\u2E80' <= c && c <= '\u2EFF';
+
+ case Category.UnicodeKangxiRadicals:
+ return '\u2F00' <= c && c <= '\u2FDF';
+
+ case Category.UnicodeIdeographicDescriptionCharacters:
+ return '\u2FF0' <= c && c <= '\u2FFF';
+
+ case Category.UnicodeCJKSymbolsandPunctuation:
+ return '\u3000' <= c && c <= '\u303F';
+
+ case Category.UnicodeHiragana:
+ return '\u3040' <= c && c <= '\u309F';
+
+ case Category.UnicodeKatakana:
+ return '\u30A0' <= c && c <= '\u30FF';
+
+ case Category.UnicodeBopomofo:
+ return '\u3100' <= c && c <= '\u312F';
+
+ case Category.UnicodeHangulCompatibilityJamo:
+ return '\u3130' <= c && c <= '\u318F';
+
+ case Category.UnicodeKanbun:
+ return '\u3190' <= c && c <= '\u319F';
+
+ case Category.UnicodeBopomofoExtended:
+ return '\u31A0' <= c && c <= '\u31BF';
+
+ case Category.UnicodeEnclosedCJKLettersandMonths:
+ return '\u3200' <= c && c <= '\u32FF';
+
+ case Category.UnicodeCJKCompatibility:
+ return '\u3300' <= c && c <= '\u33FF';
+
+ case Category.UnicodeCJKUnifiedIdeographsExtensionA:
+ return '\u3400' <= c && c <= '\u4DB5';
+
+ case Category.UnicodeCJKUnifiedIdeographs:
+ return '\u4E00' <= c && c <= '\u9FFF';
+
+ case Category.UnicodeYiSyllables:
+ return '\uA000' <= c && c <= '\uA48F';
+
+ case Category.UnicodeYiRadicals:
+ return '\uA490' <= c && c <= '\uA4CF';
+
+ case Category.UnicodeHangulSyllables:
+ return '\uAC00' <= c && c <= '\uD7A3';
+
+ case Category.UnicodeHighSurrogates:
+ return '\uD800' <= c && c <= '\uDB7F';
+
+ case Category.UnicodeHighPrivateUseSurrogates:
+ return '\uDB80' <= c && c <= '\uDBFF';
+
+ case Category.UnicodeLowSurrogates:
+ return '\uDC00' <= c && c <= '\uDFFF';
+
+ case Category.UnicodePrivateUse:
+ return '\uE000' <= c && c <= '\uF8FF';
+
+ case Category.UnicodeCJKCompatibilityIdeographs:
+ return '\uF900' <= c && c <= '\uFAFF';
+
+ case Category.UnicodeAlphabeticPresentationForms:
+ return '\uFB00' <= c && c <= '\uFB4F';
+
+ case Category.UnicodeArabicPresentationFormsA:
+ return '\uFB50' <= c && c <= '\uFDFF';
+
+ case Category.UnicodeCombiningHalfMarks:
+ return '\uFE20' <= c && c <= '\uFE2F';
+
+ case Category.UnicodeCJKCompatibilityForms:
+ return '\uFE30' <= c && c <= '\uFE4F';
+
+ case Category.UnicodeSmallFormVariants:
+ return '\uFE50' <= c && c <= '\uFE6F';
+
+ case Category.UnicodeArabicPresentationFormsB:
+ return '\uFE70' <= c && c <= '\uFEFE';
+
+ case Category.UnicodeHalfwidthandFullwidthForms:
+ return '\uFF00' <= c && c <= '\uFFEF';
+
+ case Category.UnicodeSpecials:
+ return
+ '\uFEFF' <= c && c <= '\uFEFF' ||
+ '\uFFF0' <= c && c <= '\uFFFD';
+
+ // these block ranges begin above 0x10000
+
+ case Category.UnicodeOldItalic:
+ case Category.UnicodeGothic:
+ case Category.UnicodeDeseret:
+ case Category.UnicodeByzantineMusicalSymbols:
+ case Category.UnicodeMusicalSymbols:
+ case Category.UnicodeMathematicalAlphanumericSymbols:
+ case Category.UnicodeCJKUnifiedIdeographsExtensionB:
+ case Category.UnicodeCJKCompatibilityIdeographsSupplement:
+ case Category.UnicodeTags:
+ return false;
+
+ default:
+ return false;
+ }
+ }
+
+ private static bool IsCategory (UnicodeCategory uc, char c) {
+ if (Char.GetUnicodeCategory (c) == uc)
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/collections.cs b/mcs/class/System/System.Text.RegularExpressions/collections.cs
new file mode 100644
index 00000000000..a5195b31a40
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/collections.cs
@@ -0,0 +1,138 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: collections.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+ public abstract class RegexCollectionBase : ICollection, IEnumerable {
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return true; } // FIXME
+ }
+
+ public bool IsSynchronized {
+ get { return false; } // FIXME
+ }
+
+ public object SyncRoot {
+ get { return list; } // FIXME
+ }
+
+ public void CopyTo (Array array, int index) {
+ foreach (Object o in list) {
+ if (index > array.Length)
+ break;
+
+ array.SetValue (o, index ++);
+ }
+ }
+
+ public IEnumerator GetEnumerator () {
+ return new Enumerator (list);
+ }
+
+ // internal methods
+
+ internal RegexCollectionBase () {
+ list = new ArrayList ();
+ }
+
+ internal void Add (Object o) {
+ list.Add (o);
+ }
+
+ internal void Reverse () {
+ list.Reverse ();
+ }
+
+ // IEnumerator implementation
+
+ private class Enumerator : IEnumerator {
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count)
+ throw new InvalidOperationException ();
+
+ return list[ptr];
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count)
+ throw new InvalidOperationException ();
+
+ return ++ ptr < list.Count;
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+
+ private IList list;
+ private int ptr;
+ }
+
+ // protected fields
+
+ protected ArrayList list;
+ }
+
+ [Serializable]
+ public class CaptureCollection : RegexCollectionBase, ICollection, IEnumerable {
+ public Capture this[int i] {
+ get { return (Capture)list[i]; }
+ }
+
+ internal CaptureCollection () {
+ }
+ }
+
+ [Serializable]
+ public class GroupCollection : RegexCollectionBase, ICollection, IEnumerable {
+ public Group this[int i] {
+ get { return (Group)list[i]; }
+ }
+
+ public Group this[string groupName] {
+ get {
+ foreach (object o in list) {
+ if (!(o is Match))
+ continue;
+
+ int index = ((Match) o).Regex.GroupNumberFromName (groupName);
+ if (index != -1)
+ return this [index];
+ }
+
+ return null;
+ }
+ }
+
+ internal GroupCollection () {
+ }
+ }
+
+ [Serializable]
+ public class MatchCollection : RegexCollectionBase, ICollection, IEnumerable {
+ public virtual Match this[int i] {
+ get { return (Match)list[i]; }
+ }
+
+ internal MatchCollection () {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/compiler.cs b/mcs/class/System/System.Text.RegularExpressions/compiler.cs
new file mode 100644
index 00000000000..2227568f6e8
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/compiler.cs
@@ -0,0 +1,378 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: compiler.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+ abstract class LinkRef {
+ // empty
+ }
+
+ interface ICompiler {
+ void Reset ();
+ IMachineFactory GetMachineFactory ();
+
+ // instruction emission
+
+ void EmitFalse ();
+ void EmitTrue ();
+
+ // character matching
+
+ void EmitCharacter (char c, bool negate, bool ignore, bool reverse);
+ void EmitCategory (Category cat, bool negate, bool reverse);
+ void EmitRange (char lo, char hi, bool negate, bool ignore, bool reverse);
+ void EmitSet (char lo, BitArray set, bool negate, bool ignore, bool reverse);
+
+ // other operators
+
+ void EmitString (string str, bool ignore, bool reverse);
+ void EmitPosition (Position pos);
+ void EmitOpen (int gid);
+ void EmitClose (int gid);
+ void EmitBalance (int gid, int balance);
+ void EmitReference (int gid, bool ignore, bool reverse);
+
+ // constructs
+
+ void EmitIfDefined (int gid, LinkRef tail);
+ void EmitSub (LinkRef tail);
+ void EmitTest (LinkRef yes, LinkRef tail);
+ void EmitBranch (LinkRef next);
+ void EmitJump (LinkRef target);
+ void EmitRepeat (int min, int max, bool lazy, LinkRef until);
+ void EmitUntil (LinkRef repeat);
+ void EmitIn (LinkRef tail);
+ void EmitInfo (int count, int min, int max);
+ void EmitFastRepeat (int min, int max, bool lazy, LinkRef tail);
+ void EmitAnchor (int offset, LinkRef tail);
+
+ LinkRef NewLink ();
+ void ResolveLink (LinkRef link);
+ }
+
+ class InterpreterFactory : IMachineFactory {
+ public InterpreterFactory (ushort[] pattern) {
+ this.pattern = pattern;
+ }
+
+ public IMachine NewInstance () {
+ return new Interpreter (pattern);
+ }
+
+ public int GroupCount {
+ get { return pattern[0]; }
+ }
+
+ public IDictionary Mapping {
+ get { return mapping; }
+ set { mapping = value; }
+ }
+
+ private IDictionary mapping;
+ private ushort[] pattern;
+ }
+
+ class PatternCompiler : ICompiler {
+ public static ushort EncodeOp (OpCode op, OpFlags flags) {
+ return (ushort)((int)op | ((int)flags & 0xff00));
+ }
+
+ public static void DecodeOp (ushort word, out OpCode op, out OpFlags flags) {
+ op = (OpCode)(word & 0x00ff);
+ flags = (OpFlags)(word & 0xff00);
+ }
+
+ public PatternCompiler () {
+ pgm = new ArrayList ();
+ }
+
+ // ICompiler implementation
+
+ public void Reset () {
+ pgm.Clear ();
+ }
+
+ public IMachineFactory GetMachineFactory () {
+ ushort[] image = new ushort[pgm.Count];
+ pgm.CopyTo (image);
+
+ return new InterpreterFactory (image);
+ }
+
+ public void EmitFalse () {
+ Emit (OpCode.False);
+ }
+
+ public void EmitTrue () {
+ Emit (OpCode.True);
+ }
+
+ public void EmitCharacter (char c, bool negate, bool ignore, bool reverse) {
+ Emit (OpCode.Character, MakeFlags (negate, ignore, reverse, false));
+
+ if (ignore)
+ c = Char.ToLower (c);
+
+ Emit ((ushort)c);
+ }
+
+ public void EmitCategory (Category cat, bool negate, bool reverse) {
+ Emit (OpCode.Category, MakeFlags (negate, false, reverse, false));
+ Emit ((ushort)cat);
+ }
+
+ public void EmitRange (char lo, char hi, bool negate, bool ignore, bool reverse) {
+ Emit (OpCode.Range, MakeFlags (negate, ignore, reverse, false));
+ Emit ((ushort)lo);
+ Emit ((ushort)hi);
+ }
+
+ public void EmitSet (char lo, BitArray set, bool negate, bool ignore, bool reverse) {
+ Emit (OpCode.Set, MakeFlags (negate, ignore, reverse, false));
+ Emit ((ushort)lo);
+
+ int len = (set.Length + 0xf) >> 4;
+ Emit ((ushort)len);
+
+ int b = 0;
+ while (len -- != 0) {
+ ushort word = 0;
+ for (int i = 0; i < 16; ++ i) {
+ if (b >= set.Length)
+ break;
+
+ if (set[b ++])
+ word |= (ushort)(1 << i);
+ }
+
+ Emit (word);
+ }
+ }
+
+ public void EmitString (string str, bool ignore, bool reverse) {
+ Emit (OpCode.String, MakeFlags (false, ignore, reverse, false));
+ int len = str.Length;
+ Emit ((ushort)len);
+
+ if (ignore)
+ str = str.ToLower ();
+
+ for (int i = 0; i < len; ++ i)
+ Emit ((ushort)str[i]);
+ }
+
+ public void EmitPosition (Position pos) {
+ Emit (OpCode.Position, 0);
+ Emit ((ushort)pos);
+ }
+
+ public void EmitOpen (int gid) {
+ Emit (OpCode.Open);
+ Emit ((ushort)gid);
+ }
+
+ public void EmitClose (int gid) {
+ Emit (OpCode.Close);
+ Emit ((ushort)gid);
+ }
+
+ public void EmitBalance (int gid, int balance) {
+ Emit (OpCode.Balance);
+ Emit ((ushort)gid);
+ Emit ((ushort)balance);
+ }
+
+ public void EmitReference (int gid, bool ignore, bool reverse) {
+ Emit (OpCode.Reference, MakeFlags (false, ignore, reverse, false));
+ Emit ((ushort)gid);
+ }
+
+ public void EmitIfDefined (int gid, LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.IfDefined);
+ EmitLink (tail);
+ Emit ((ushort)gid);
+ }
+
+ public void EmitSub (LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.Sub);
+ EmitLink (tail);
+ }
+
+ public void EmitTest (LinkRef yes, LinkRef tail) {
+ BeginLink (yes);
+ BeginLink (tail);
+ Emit (OpCode.Test);
+ EmitLink (yes);
+ EmitLink (tail);
+ }
+
+ public void EmitBranch (LinkRef next) {
+ BeginLink (next);
+ Emit (OpCode.Branch, 0);
+ EmitLink (next);
+ }
+
+ public void EmitJump (LinkRef target) {
+ BeginLink (target);
+ Emit (OpCode.Jump, 0);
+ EmitLink (target);
+ }
+
+ public void EmitRepeat (int min, int max, bool lazy, LinkRef until) {
+ BeginLink (until);
+ Emit (OpCode.Repeat, MakeFlags (false, false, false, lazy));
+ EmitLink (until);
+ Emit ((ushort)min);
+ Emit ((ushort)max);
+ }
+
+ public void EmitUntil (LinkRef repeat) {
+ ResolveLink (repeat);
+ Emit (OpCode.Until);
+ }
+
+ public void EmitFastRepeat (int min, int max, bool lazy, LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.FastRepeat, MakeFlags (false, false, false, lazy));
+ EmitLink (tail);
+ Emit ((ushort)min);
+ Emit ((ushort)max);
+ }
+
+ public void EmitIn (LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.In);
+ EmitLink (tail);
+ }
+
+ public void EmitAnchor (int offset, LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.Anchor);
+ EmitLink (tail);
+ Emit ((ushort)offset);
+ }
+
+ public void EmitInfo (int count, int min, int max) {
+ Emit (OpCode.Info);
+ Emit ((ushort)count);
+ Emit ((ushort)min);
+ Emit ((ushort)max);
+ }
+
+ public LinkRef NewLink () {
+ return new PatternLinkStack ();
+ }
+
+ public void ResolveLink (LinkRef lref) {
+ PatternLinkStack stack = (PatternLinkStack)lref;
+
+ while (stack.Pop ())
+ pgm[stack.OffsetAddress] = (ushort)stack.GetOffset (CurrentAddress);
+ }
+
+ // private members
+
+ private static OpFlags MakeFlags (bool negate, bool ignore, bool reverse, bool lazy) {
+ OpFlags flags = 0;
+ if (negate) flags |= OpFlags.Negate;
+ if (ignore) flags |= OpFlags.IgnoreCase;
+ if (reverse) flags |= OpFlags.RightToLeft;
+ if (lazy) flags |= OpFlags.Lazy;
+
+ return flags;
+ }
+
+ private void Emit (OpCode op) {
+ Emit (op, (OpFlags)0);
+ }
+
+ private void Emit (OpCode op, OpFlags flags) {
+ Emit (EncodeOp (op, flags));
+ }
+
+ private void Emit (ushort word) {
+ pgm.Add (word);
+ }
+
+ private int CurrentAddress {
+ get { return pgm.Count; }
+ }
+
+ private void BeginLink (LinkRef lref) {
+ PatternLinkStack stack = (PatternLinkStack)lref;
+ stack.BaseAddress = CurrentAddress;
+ }
+
+ private void EmitLink (LinkRef lref) {
+ PatternLinkStack stack = (PatternLinkStack)lref;
+ stack.OffsetAddress = CurrentAddress;
+ Emit ((ushort)0); // placeholder
+ stack.Push ();
+ }
+
+ private class PatternLinkStack : LinkStack {
+ public PatternLinkStack () {
+ }
+
+ public int BaseAddress {
+ set { link.base_addr = value; }
+ }
+
+ public int OffsetAddress {
+ get { return link.offset_addr; }
+ set { link.offset_addr = value; }
+ }
+
+ public int GetOffset (int target_addr) {
+ return target_addr - link.base_addr;
+ }
+
+ // LinkStack implementation
+
+ protected override object GetCurrent () { return link; }
+ protected override void SetCurrent (object l) { link = (Link)l; }
+
+ private struct Link {
+ public int base_addr;
+ public int offset_addr;
+ }
+
+ Link link;
+ }
+
+ private ArrayList pgm;
+ }
+
+ abstract class LinkStack : LinkRef {
+ public LinkStack () {
+ stack = new Stack ();
+ }
+
+ public void Push () {
+ stack.Push (GetCurrent ());
+ }
+
+ public bool Pop () {
+ if (stack.Count > 0) {
+ SetCurrent (stack.Pop ());
+ return true;
+ }
+
+ return false;
+ }
+
+ protected abstract object GetCurrent ();
+ protected abstract void SetCurrent (object l);
+
+ private Stack stack;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/debug.cs b/mcs/class/System/System.Text.RegularExpressions/debug.cs
new file mode 100644
index 00000000000..fdc3ab87bc3
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/debug.cs
@@ -0,0 +1,208 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: debug.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ class Disassembler {
+ public static void DisassemblePattern (ushort[] image) {
+ DisassembleBlock (image, 0, 0);
+ }
+
+ public static void DisassembleBlock (ushort[] image, int pc, int depth) {
+ OpCode op;
+ OpFlags flags;
+
+ for (;;) {
+ if (pc >= image.Length)
+ return;
+
+ PatternCompiler.DecodeOp (image[pc], out op, out flags);
+ Console.Write (FormatAddress (pc) + ": "); // address
+ Console.Write (new string (' ', depth * 2)); // indent
+ Console.Write (DisassembleOp (image, pc)); // instruction
+ Console.WriteLine ();
+
+ int skip;
+ switch (op) {
+ case OpCode.False: case OpCode.True: case OpCode.Until:
+ skip = 1;
+ break;
+
+ case OpCode.Character: case OpCode.Category: case OpCode.Position:
+ case OpCode.Open: case OpCode.Close: case OpCode.Reference:
+ case OpCode.Sub: case OpCode.Branch: case OpCode.Jump: case OpCode.In:
+ skip = 2;
+ break;
+
+ case OpCode.Balance: case OpCode.IfDefined: case OpCode.Range:
+ case OpCode.Test: case OpCode.Anchor:
+ skip = 3;
+ break;
+
+ case OpCode.Repeat: case OpCode.FastRepeat: case OpCode.Info:
+ skip = 4;
+ break;
+
+ case OpCode.String: skip = image[pc + 1] + 2; break;
+ case OpCode.Set: skip = image[pc + 2] + 3; break;
+
+ default:
+ skip = 1;
+ break;
+ }
+
+ pc += skip;
+ }
+ }
+
+ public static string DisassembleOp (ushort[] image, int pc) {
+ OpCode op;
+ OpFlags flags;
+
+ PatternCompiler.DecodeOp (image[pc], out op, out flags);
+ string str = op.ToString ();
+ if (flags != 0)
+ str += "[" + flags.ToString ("f") + "]";
+
+ switch (op) {
+ case OpCode.False: case OpCode.True: case OpCode.Until:
+ default:
+ break;
+
+ case OpCode.Info:
+ str += " " + image[pc + 1];
+ str += " (" + image[pc + 2] + ", " + image[pc + 3] + ")";
+ break;
+
+ case OpCode.Character:
+ str += " '" + FormatChar ((char)image[pc + 1]) + "'";
+ break;
+
+ case OpCode.Category:
+ str += " /" + (Category)image[pc + 1];
+ break;
+
+ case OpCode.Range:
+ str += " '" + FormatChar ((char)image[pc + 1]) + "', ";
+ str += " '" + FormatChar ((char)image[pc + 2]) + "'";
+ break;
+
+ case OpCode.Set:
+ str += " " + FormatSet (image, pc + 1);
+ break;
+
+ case OpCode.String:
+ str += " '" + ReadString (image, pc + 1) + "'";
+ break;
+
+ case OpCode.Position:
+ str += " /" + (Position)image[pc + 1];
+ break;
+
+ case OpCode.Open: case OpCode.Close: case OpCode.Reference:
+ str += " " + image[pc + 1];
+ break;
+
+ case OpCode.Balance:
+ str += " " + image[pc + 1] + " " + image[pc + 2];
+ break;
+
+ case OpCode.IfDefined: case OpCode.Anchor:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ str += " " + image[pc + 2];
+ break;
+
+ case OpCode.Sub: case OpCode.Branch: case OpCode.Jump:
+ case OpCode.In:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ break;
+
+ case OpCode.Test:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ str += ", :" + FormatAddress (pc + image[pc + 2]);
+ break;
+
+ case OpCode.Repeat: case OpCode.FastRepeat:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ str += " (" + image[pc + 2] + ", ";
+ if (image[pc + 3] == 0xffff)
+ str += "Inf";
+ else
+ str += image[pc + 3];
+ str += ")";
+ break;
+
+ }
+
+ return str;
+ }
+
+ // private static members
+
+ private static string ReadString (ushort[] image, int pc) {
+ int len = image[pc];
+ char[] chars = new char[len];
+
+ for (int i = 0; i < len; ++ i)
+ chars[i] = (char)image[pc + i + 1];
+
+ return new string (chars);
+ }
+
+ private static string FormatAddress (int pc) {
+ return pc.ToString ("x4");
+ }
+
+ private static string FormatSet (ushort[] image, int pc) {
+ int lo = image[pc ++];
+ int hi = (image[pc ++] << 4) - 1;
+
+ string str = "[";
+
+ bool hot = false;
+ char a = (char)0, b;
+ for (int i = 0; i <= hi; ++ i) {
+ bool m = (image[pc + (i >> 4)] & (1 << (i & 0xf))) != 0;
+
+ if (m & !hot) { // start of range
+ a = (char)(lo + i);
+ hot = true;
+ }
+ else if (hot & (!m || i == hi)) { // end of range
+ b = (char)(lo + i - 1);
+
+ str += FormatChar (a);
+ if (b != a)
+ str += "-" + FormatChar (b);
+
+ hot = false;
+ }
+ }
+
+ str += "]";
+ return str;
+ }
+
+ private static string FormatChar (char c) {
+ if (c == '-' || c == ']')
+ return "\\" + c;
+
+ if (Char.IsLetterOrDigit (c) || Char.IsSymbol (c))
+ return c.ToString ();
+
+ if (Char.IsControl (c)) {
+ return "^" + (char)('@' + c);
+ }
+
+ return "\\u" + ((int)c).ToString ("x4");
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/interpreter.cs b/mcs/class/System/System.Text.RegularExpressions/interpreter.cs
new file mode 100644
index 00000000000..1be1a36b2ee
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/interpreter.cs
@@ -0,0 +1,953 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: interpreter.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Text.RegularExpressions {
+
+ class Interpreter : IMachine {
+ public Interpreter (ushort[] program) {
+ this.program = program;
+ this.qs = null;
+
+ // process info block
+
+ Debug.Assert ((OpCode)program[0] == OpCode.Info, "Regex", "Cant' find info block");
+
+ this.group_count = program[1] + 1;
+ this.match_min = program[2];
+ this.match_max = program[3];
+
+ // setup
+
+ this.program_start = 4;
+ this.groups = new int [group_count];
+ }
+
+ // IMachine implementation
+
+ public Match Scan (Regex regex, string text, int start, int end) {
+ this.text = text;
+ this.text_end = end;
+ this.scan_ptr = start;
+
+ if (Eval (Mode.Match, ref scan_ptr, program_start))
+ return GenerateMatch (regex);
+
+ return Match.Empty;
+ }
+
+ // private methods
+
+ private void Reset () {
+ ResetGroups ();
+ fast = repeat = null;
+ }
+
+ private bool Eval (Mode mode, ref int ref_ptr, int pc) {
+ int ptr = ref_ptr;
+ Begin:
+ for (;;) {
+ ushort word = program[pc];
+ OpCode op = (OpCode)(word & 0x00ff);
+ OpFlags flags = (OpFlags)(word & 0xff00);
+
+ switch (op) {
+ case OpCode.Anchor: {
+ int skip = program[pc + 1];
+
+ int anch_offset = program[pc + 2];
+ int anch_ptr = ptr + anch_offset;
+ int anch_end = text_end - match_min + anch_offset; // maximum anchor position
+
+ // the general case for an anchoring expression is at the bottom, however we
+ // do some checks for the common cases before to save processing time. the current
+ // optimizer only outputs three types of anchoring expressions: fixed position,
+ // fixed substring, and no anchor.
+
+ OpCode anch_op = (OpCode)(program[pc + 3] & 0x00ff);
+ if (anch_op == OpCode.Position && skip == 6) { // position anchor
+ // Anchor
+ // Position
+ // True
+
+ switch ((Position)program[pc + 4]) {
+ case Position.StartOfString:
+ if (anch_ptr == 0) {
+ ptr = 0;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+ break;
+
+ case Position.StartOfLine:
+ if (anch_ptr == 0) {
+ ptr = 0;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+
+ ++ anch_ptr;
+ }
+
+ while (anch_ptr <= anch_end) {
+ if (text[anch_ptr - 1] == '\n') {
+ ptr = anch_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+
+ ++ anch_ptr;
+ }
+ break;
+
+ case Position.StartOfScan:
+ if (anch_ptr == scan_ptr) {
+ ptr = scan_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+ break;
+
+ default:
+ // FIXME
+ break;
+ }
+ }
+ else if (qs != null ||
+ (anch_op == OpCode.String && skip == 6 + program[pc + 4])) { // substring anchor
+ // Anchor
+ // String
+ // True
+
+ if (qs == null) {
+ bool ignore = ((OpFlags)program[pc + 3] & OpFlags.IgnoreCase) != 0;
+ string substring = GetString (pc + 3);
+
+ qs = new QuickSearch (substring, ignore);
+ }
+
+ while (anch_ptr <= anch_end) {
+ anch_ptr = qs.Search (text, anch_ptr, anch_end);
+ if (anch_ptr < 0)
+ break;
+
+ ptr = anch_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+
+ ++ anch_ptr;
+ }
+ }
+ else if (anch_op == OpCode.True) { // no anchor
+ // Anchor
+ // True
+
+ while (anch_ptr <= anch_end) {
+ ptr = anch_ptr;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+
+ ++ anch_ptr;
+ }
+ }
+ else { // general case
+ // Anchor
+ // <expr>
+ // True
+
+ while (anch_ptr <= anch_end) {
+ ptr = anch_ptr;
+ if (Eval (Mode.Match, ref ptr, pc + 3)) {
+ // anchor expression passed: try real expression at the correct offset
+
+ ptr = anch_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+
+ ++ anch_ptr;
+ }
+ }
+
+ goto Fail;
+ }
+
+ case OpCode.False: {
+ goto Fail;
+ }
+
+ case OpCode.True: {
+ goto Pass;
+ }
+
+ case OpCode.Position: {
+ if (!IsPosition ((Position)program[pc + 1], ptr))
+ goto Fail;
+ pc += 2;
+ break;
+ }
+
+ case OpCode.String: {
+ bool reverse = (flags & OpFlags.RightToLeft) != 0;
+ bool ignore = (flags & OpFlags.IgnoreCase) != 0;
+ int len = program[pc + 1];
+
+ if (reverse) {
+ ptr -= len;
+ if (ptr < 0)
+ goto Fail;
+ }
+ else if (ptr + len > text_end)
+ goto Fail;
+
+ pc += 2;
+ for (int i = 0; i < len; ++ i) {
+ char c = text[ptr + i];
+ if (ignore)
+ c = Char.ToLower (c);
+
+ if (c != (char)program[pc ++])
+ goto Fail;
+ }
+
+ if (!reverse)
+ ptr += len;
+ break;
+ }
+
+ case OpCode.Reference: {
+ bool reverse = (flags & OpFlags.RightToLeft) != 0;
+ bool ignore = (flags & OpFlags.IgnoreCase) != 0;
+ int m = GetLastDefined (program [pc + 1]);
+ if (m < 0)
+ goto Fail;
+
+ int str = marks [m].Index;
+ int len = marks [m].Length;
+
+ if (reverse) {
+ ptr -= len;
+ if (ptr < 0)
+ goto Fail;
+ }
+ else if (ptr + len > text_end)
+ goto Fail;
+
+ pc += 2;
+ for (int i = 0; i < len; ++ i) {
+ if (ignore) {
+ if (Char.ToLower (text[ptr + i]) != Char.ToLower (text[str + i]))
+ goto Fail;
+ }
+ else {
+ if (text[ptr + i] != text[str + i])
+ goto Fail;
+ }
+ }
+
+ if (!reverse)
+ ptr += len;
+ break;
+ }
+
+ case OpCode.Character: case OpCode.Category:
+ case OpCode.Range: case OpCode.Set: {
+ if (!EvalChar (mode, ref ptr, ref pc, false))
+ goto Fail;
+ break;
+ }
+
+ case OpCode.In: {
+ int target = pc + program[pc + 1];
+ pc += 2;
+ if (!EvalChar (mode, ref ptr, ref pc, true))
+ goto Fail;
+
+ pc = target;
+ break;
+ }
+
+ case OpCode.Open: {
+ Open (program[pc + 1], ptr);
+ pc += 2;
+ break;
+ }
+
+ case OpCode.Close: {
+ Close (program[pc + 1], ptr);
+ pc += 2;
+ break;
+ }
+
+ case OpCode.Balance: {
+ Balance (program[pc + 1], program[pc + 2], ptr);
+ break;
+ }
+
+ case OpCode.IfDefined: {
+ int m = GetLastDefined (program [pc + 2]);
+ if (m < 0)
+ pc += program[pc + 1];
+ else
+ pc += 3;
+ break;
+ }
+
+ case OpCode.Sub: {
+ if (!Eval (Mode.Match, ref ptr, pc + 2))
+ goto Fail;
+
+ pc += program[pc + 1];
+ break;
+ }
+
+ case OpCode.Test: {
+ int cp = Checkpoint ();
+ int test_ptr = ptr;
+ if (Eval (Mode.Match, ref test_ptr, pc + 3))
+ pc += program[pc + 1];
+ else {
+ Backtrack (cp);
+ pc += program[pc + 2];
+ }
+ break;
+ }
+
+ case OpCode.Branch: {
+ OpCode branch_op;
+ do {
+ int cp = Checkpoint ();
+ if (Eval (Mode.Match, ref ptr, pc + 2))
+ goto Pass;
+
+ Backtrack (cp);
+
+ pc += program[pc + 1];
+ branch_op = (OpCode)(program[pc] & 0xff);
+ } while (branch_op != OpCode.False);
+
+ goto Fail;
+ }
+
+ case OpCode.Jump: {
+ pc += program[pc + 1];
+ break;
+ }
+
+ case OpCode.Repeat: {
+ this.repeat = new RepeatContext (
+ this.repeat, // previous context
+ program[pc + 2], // minimum
+ program[pc + 3], // maximum
+ (flags & OpFlags.Lazy) != 0, // lazy
+ pc + 4 // subexpression
+ );
+
+ if (Eval (Mode.Match, ref ptr, pc + program[pc + 1]))
+ goto Pass;
+ else {
+ this.repeat = this.repeat.Previous;
+ goto Fail;
+ }
+ }
+
+ case OpCode.Until: {
+ RepeatContext current = this.repeat;
+ int start = current.Start;
+
+ if (!current.IsMinimum) {
+ ++ current.Count;
+ current.Start = ptr;
+ if (Eval (Mode.Match, ref ptr, repeat.Expression))
+ goto Pass;
+
+ current.Start = start;
+ -- current.Count;
+ goto Fail;
+ }
+
+ if (ptr == current.Start) {
+ // degenerate match ... match tail or fail
+
+ this.repeat = current.Previous;
+ if (Eval (Mode.Match, ref ptr, pc + 1))
+ goto Pass;
+
+ goto Fail;
+ }
+
+ if (current.IsLazy) {
+ // match tail first ...
+
+ this.repeat = current.Previous;
+ int cp = Checkpoint ();
+ if (Eval (Mode.Match, ref ptr, pc + 1))
+ goto Pass;
+
+ Backtrack (cp);
+
+ // ... then match more
+
+ this.repeat = current;
+ if (!current.IsMaximum) {
+ ++ current.Count;
+ current.Start = ptr;
+ if (Eval (Mode.Match, ref ptr, current.Expression))
+ goto Pass;
+
+ current.Start = start;
+ -- current.Count;
+ goto Fail;
+ }
+
+ return false;
+ }
+ else {
+ // match more first ...
+
+ if (!current.IsMaximum) {
+ int cp = Checkpoint ();
+ ++ current.Count;
+ current.Start = ptr;
+ if (Eval (Mode.Match, ref ptr, current.Expression))
+ goto Pass;
+
+ current.Start = start;
+ -- current.Count;
+ Backtrack (cp);
+ }
+
+ // ... then match tail
+
+ this.repeat = current.Previous;
+ if (Eval (Mode.Match, ref ptr, pc + 1))
+ goto Pass;
+
+ this.repeat = current;
+ goto Fail;
+ }
+ }
+
+ case OpCode.FastRepeat: {
+ this.fast = new RepeatContext (
+ fast,
+ program[pc + 2], // minimum
+ program[pc + 3], // maximum
+ (flags & OpFlags.Lazy) != 0, // lazy
+ pc + 4 // subexpression
+ );
+ fast.Start = ptr;
+
+ int cp = Checkpoint ();
+
+ pc += program[pc + 1]; // tail expression
+ ushort tail_word = program[pc];
+
+ int c1, c2; // first character of tail operator
+ int coff; // 0 or -1 depending on direction
+
+ OpCode tail_op = (OpCode)(tail_word & 0xff);
+ if (tail_op == OpCode.Character || tail_op == OpCode.String) {
+ OpFlags tail_flags = (OpFlags)(tail_word & 0xff00);
+
+ if (tail_op == OpCode.String)
+ c1 = program[pc + 2]; // first char of string
+ else
+ c1 = program[pc + 1]; // character
+
+ if ((tail_flags & OpFlags.IgnoreCase) != 0)
+ c2 = Char.ToUpper ((char)c1); // ignore case
+ else
+ c2 = c1;
+
+ if ((tail_flags & OpFlags.RightToLeft) != 0)
+ coff = -1; // reverse
+ else
+ coff = 0;
+ }
+ else {
+ c1 = c2 = -1;
+ coff = 0;
+ }
+
+ if (fast.IsLazy) {
+ if (!fast.IsMinimum && !Eval (Mode.Count, ref ptr, fast.Expression)) {
+ //Console.WriteLine ("lazy fast: failed mininum.");
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ while (true) {
+ int p = ptr + coff;
+ if ((c1 < 0 || (p >= 0 && p < text_end && (c1 == text[p] || c2 == text[p]))) &&
+ Eval (Mode.Match, ref ptr, pc))
+ break;
+
+ if (fast.IsMaximum) {
+ //Console.WriteLine ("lazy fast: failed with maximum.");
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ Backtrack (cp);
+ if (!Eval (Mode.Count, ref ptr, fast.Expression)) {
+ //Console.WriteLine ("lazy fast: no more.");
+ fast = fast.Previous;
+ goto Fail;
+ }
+ }
+ fast = fast.Previous;
+ goto Pass;
+ }
+ else {
+ if (!Eval (Mode.Count, ref ptr, fast.Expression)) {
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ int width;
+ if (fast.Count > 0)
+ width = (ptr - fast.Start) / fast.Count;
+ else
+ width = 0;
+
+ while (true) {
+ int p = ptr + coff;
+ if ((c1 < 0 || (p >= 0 && p < text_end && (c1 == text[p] || c2 == text[p]))) &&
+ Eval (Mode.Match, ref ptr, pc))
+ break;
+
+ -- fast.Count;
+ if (!fast.IsMinimum) {
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ ptr -= width;
+ Backtrack (cp);
+ }
+ fast = fast.Previous;
+ goto Pass;
+ }
+ }
+
+ case OpCode.Info: {
+ Debug.Assert (false, "Regex", "Info block found in pattern");
+ goto Fail;
+ }
+ }
+ }
+ Pass:
+ ref_ptr = ptr;
+
+ switch (mode) {
+ case Mode.Match:
+ return true;
+
+ case Mode.Count: {
+ ++ fast.Count;
+ if (fast.IsMaximum || (fast.IsLazy && fast.IsMinimum))
+ return true;
+
+ pc = fast.Expression;
+ goto Begin;
+ }
+ }
+
+ Fail:
+ switch (mode) {
+ case Mode.Match:
+ return false;
+
+ case Mode.Count: {
+ if (!fast.IsLazy && fast.IsMinimum)
+ return true;
+
+ ref_ptr = fast.Start;
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ private bool EvalChar (Mode mode, ref int ptr, ref int pc, bool multi) {
+ bool consumed = false;
+ char c = '\0';
+ bool negate;
+ bool ignore;
+ do {
+ ushort word = program[pc];
+ OpCode op = (OpCode)(word & 0x00ff);
+ OpFlags flags = (OpFlags)(word & 0xff00);
+
+ ++ pc;
+
+ ignore = (flags & OpFlags.IgnoreCase) != 0;
+
+ // consume character: the direction of an In construct is
+ // determined by the direction of its first op
+
+ if (!consumed) {
+ if ((flags & OpFlags.RightToLeft) != 0) {
+ if (ptr <= 0)
+ return false;
+
+ c = text[-- ptr];
+ }
+ else {
+ if (ptr >= text_end)
+ return false;
+
+ c = text[ptr ++];
+ }
+
+ if (ignore)
+ c = Char.ToLower (c);
+
+ consumed = true;
+ }
+
+ // negate flag
+
+ negate = (flags & OpFlags.Negate) != 0;
+
+ // execute op
+
+ switch (op) {
+ case OpCode.True:
+ return true;
+
+ case OpCode.False:
+ return false;
+
+ case OpCode.Character: {
+ if (c == (char)program[pc ++])
+ return !negate;
+ break;
+ }
+
+ case OpCode.Category: {
+ if (CategoryUtils.IsCategory ((Category)program[pc ++], c))
+ return !negate;
+
+ break;
+ }
+
+ case OpCode.Range: {
+ int lo = (char)program[pc ++];
+ int hi = (char)program[pc ++];
+ if (lo <= c && c <= hi)
+ return !negate;
+ break;
+ }
+
+ case OpCode.Set: {
+ int lo = (char)program[pc ++];
+ int len = (char)program[pc ++];
+ int bits = pc;
+ pc += len;
+
+ int i = (int)c - lo;
+ if (i < 0 || i >= len << 4)
+ break;
+
+ if ((program[bits + (i >> 4)] & (1 << (i & 0xf))) != 0)
+ return !negate;
+ break;
+ }
+ }
+ } while (multi);
+
+ return negate;
+ }
+
+ private bool TryMatch (ref int ref_ptr, int pc) {
+ Reset ();
+
+ int ptr = ref_ptr;
+ marks [groups [0]].Start = ptr;
+ if (Eval (Mode.Match, ref ptr, pc)) {
+ marks [groups [0]].End = ptr;
+ ref_ptr = ptr;
+ return true;
+ }
+
+ return false;
+ }
+
+ private bool IsPosition (Position pos, int ptr) {
+ switch (pos) {
+ case Position.Start: case Position.StartOfString:
+ return ptr == 0;
+
+ case Position.StartOfLine:
+ return ptr == 0 || text[ptr - 1] == '\n';
+
+ case Position.StartOfScan:
+ return ptr == scan_ptr;
+
+ case Position.End:
+ return ptr == text_end ||
+ (ptr == text_end - 1 && text[ptr] == '\n');
+
+ case Position.EndOfLine:
+ return ptr == text_end || text[ptr] == '\n';
+
+ case Position.EndOfString:
+ return ptr == text_end;
+
+ case Position.Boundary:
+ if (text_end == 0)
+ return false;
+
+ if (ptr == 0)
+ return IsWordChar (text[ptr]);
+ else if (ptr == text_end)
+ return IsWordChar (text[ptr - 1]);
+ else
+ return IsWordChar (text[ptr]) != IsWordChar (text[ptr - 1]);
+
+ case Position.NonBoundary:
+ if (text_end == 0)
+ return false;
+
+ if (ptr == 0)
+ return !IsWordChar (text[ptr]);
+ else if (ptr == text_end)
+ return !IsWordChar (text[ptr - 1]);
+ else
+ return IsWordChar (text[ptr]) == IsWordChar (text[ptr - 1]);
+
+ default:
+ return false;
+ }
+ }
+
+ private bool IsWordChar (char c) {
+ return CategoryUtils.IsCategory (Category.Word, c);
+ }
+
+ private string GetString (int pc) {
+ int len = program[pc + 1];
+ int str = pc + 2;
+
+ char[] cs = new char[len];
+ for (int i = 0; i < len; ++ i)
+ cs[i] = (char)program[str ++];
+
+ return new string (cs);
+ }
+
+ // capture management
+
+ private void Open (int gid, int ptr) {
+ int m = groups [gid];
+ if (m < mark_start || marks [m].IsDefined) {
+ m = CreateMark (m);
+ groups [gid] = m;
+ }
+
+ marks [m].Start = ptr;
+ }
+
+ private void Close (int gid, int ptr) {
+ marks [groups [gid]].End = ptr;
+ }
+
+ private void Balance (int gid, int balance_gid, int ptr) {
+ int b = groups [balance_gid];
+ Debug.Assert (marks [b].IsDefined, "Regex", "Balancing group not closed");
+
+ if (gid > 0) {
+ Open (gid, marks [b].Index + marks [b].Length);
+ Close (gid, ptr);
+ }
+
+ groups [balance_gid] = marks [b].Previous;
+ }
+
+ private int Checkpoint () {
+ mark_start = mark_end;
+ return mark_start;
+ }
+
+ private void Backtrack (int cp) {
+ Debug.Assert (cp > mark_start, "Regex", "Attempt to backtrack forwards");
+
+ for (int i = 0; i < groups.Length; ++ i) {
+ int m = groups [i];
+ while (cp <= m)
+ m = marks [m].Previous;
+
+ groups [i] = m;
+ }
+ }
+
+ private void ResetGroups () {
+ int n = groups.Length;
+ if (marks == null)
+ marks = new Mark [n * 10];
+
+ for (int i = 0; i < n; ++ i) {
+ groups [i] = i;
+
+ marks [i].Start = -1;
+ marks [i].End = -1;
+ marks [i].Previous = -1;
+ }
+
+ mark_start = 0;
+ mark_end = n;
+ }
+
+ private int GetLastDefined (int gid) {
+ int m = groups [gid];
+ while (m >= 0 && !marks [m].IsDefined)
+ m = marks [m].Previous;
+
+ return m;
+ }
+
+ private int CreateMark (int previous) {
+ if (mark_end == marks.Length) {
+ Mark [] dest = new Mark [marks.Length * 2];
+ marks.CopyTo (dest, 0);
+ marks = dest;
+ }
+
+ int m = mark_end ++;
+ marks [m].Start = marks [m].End = -1;
+ marks [m].Previous = previous;
+
+ return m;
+ }
+
+ private Match GenerateMatch (Regex regex) {
+ int[][] grps = new int[groups.Length][];
+ ArrayList caps = new ArrayList ();
+
+ for (int gid = 0; gid < groups.Length; ++ gid) {
+ caps.Clear ();
+ for (int m = groups[gid]; m >= 0; m = marks[m].Previous) {
+ if (!marks[m].IsDefined)
+ continue;
+
+ caps.Add (marks[m].Index);
+ caps.Add (marks[m].Length);
+ }
+
+ grps[gid] = (int[])caps.ToArray (typeof (int));
+ }
+
+ return new Match (regex, this, text, text_end, grps);
+ }
+
+ // interpreter attributes
+
+ private ushort[] program; // regex program
+ private int program_start; // first instruction after info block
+ private string text; // input text
+ private int text_end; // end of input text (last character + 1)
+ private int group_count; // number of capturing groups
+ private int match_min, match_max; // match width information
+ private QuickSearch qs; // fast substring matcher
+
+ // match state
+
+ private int scan_ptr; // start of scan
+
+ private RepeatContext repeat; // current repeat context
+ private RepeatContext fast; // fast repeat context
+
+ private Mark[] marks = null; // mark stack
+ private int mark_start; // start of current checkpoint
+ private int mark_end; // end of checkpoint/next free mark
+
+ private int[] groups; // current group definitions
+
+ // private classes
+
+ private struct Mark {
+ public int Start, End;
+ public int Previous;
+
+ public bool IsDefined {
+ get { return Start >= 0 && End >= 0; }
+ }
+
+ public int Index {
+ get { return Start < End ? Start : End; }
+ }
+
+ public int Length {
+ get { return Start < End ? End - Start : Start - End; }
+ }
+ }
+
+ private class RepeatContext {
+ public RepeatContext (RepeatContext previous, int min, int max, bool lazy, int expr_pc) {
+ this.previous = previous;
+ this.min = min;
+ this.max = max;
+ this.lazy = lazy;
+ this.expr_pc = expr_pc;
+
+ this.start = -1;
+ this.count = 0;
+ }
+
+ public int Count {
+ get { return count; }
+ set { count = value; }
+ }
+
+ public int Start {
+ get { return start; }
+ set { start = value; }
+ }
+
+ public bool IsMinimum {
+ get { return min <= count; }
+ }
+
+ public bool IsMaximum {
+ get { return max <= count; }
+ }
+
+ public bool IsLazy {
+ get { return lazy; }
+ }
+
+ public int Expression {
+ get { return expr_pc; }
+ }
+
+ public RepeatContext Previous {
+ get { return previous; }
+ }
+
+ private int start;
+ private int min, max;
+ private bool lazy;
+ private int expr_pc;
+ private RepeatContext previous;
+
+ private int count;
+ }
+
+ private enum Mode {
+ Search,
+ Match,
+ Count
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/interval.cs b/mcs/class/System/System.Text.RegularExpressions/interval.cs
new file mode 100644
index 00000000000..4c8d19f5b15
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/interval.cs
@@ -0,0 +1,305 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: interval.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ struct Interval : IComparable {
+ public int low;
+ public int high;
+ public bool contiguous;
+
+ public static Interval Empty {
+ get {
+ Interval i;
+ i.low = 0;
+ i.high = i.low - 1;
+ i.contiguous = true;
+
+ return i;
+ }
+ }
+
+ public static Interval Entire {
+ get { return new Interval (Int32.MinValue, Int32.MaxValue); }
+ }
+
+ public Interval (int low, int high) {
+ if (low > high) {
+ int t = low;
+ low = high;
+ high = t;
+ }
+
+ this.low = low;
+ this.high = high;
+ this.contiguous = true;
+ }
+
+ public bool IsDiscontiguous {
+ get { return !contiguous; }
+ }
+
+ public bool IsSingleton {
+ get { return contiguous && low == high; }
+ }
+
+ public bool IsRange {
+ get { return !IsSingleton && !IsEmpty; }
+ }
+
+ public bool IsEmpty {
+ get { return low > high; }
+ }
+
+ public int Size {
+ get {
+ if (IsEmpty)
+ return 0;
+
+ return high - low + 1;
+ }
+ }
+
+ public bool IsDisjoint (Interval i) {
+ if (IsEmpty || i.IsEmpty)
+ return true;
+
+ return !(low <= i.high && i.low <= high);
+ }
+
+ public bool IsAdjacent (Interval i) {
+ if (IsEmpty || i.IsEmpty)
+ return false;
+
+ return low == i.high + 1 || high == i.low - 1;
+ }
+
+ public bool Contains (Interval i) {
+ if (!IsEmpty && i.IsEmpty)
+ return true;
+ if (IsEmpty)
+ return false;
+
+ return low <= i.low && i.high <= high;
+ }
+
+ public bool Contains (int i) {
+ return low <= i && i <= high;
+ }
+
+ public void Merge (Interval i) {
+ if (i.IsEmpty)
+ return;
+ if (IsEmpty) {
+ this.low = i.low;
+ this.high = i.high;
+ }
+
+ if (i.low < low)
+ low = i.low;
+ if (i.high > high)
+ high = i.high;
+ }
+
+ public void Intersect (Interval i) {
+ if (IsDisjoint (i)) {
+ low = 0;
+ high = low - 1;
+ return;
+ }
+
+ if (i.low > low)
+ low = i.low;
+ if (i.high > high)
+ high = i.high;
+ }
+
+ public int CompareTo (object o) {
+ return low - ((Interval)o).low;
+ }
+
+ public new string ToString () {
+ if (IsEmpty)
+ return "(EMPTY)";
+ else if (!contiguous)
+ return "{" + low + ", " + high + "}";
+ else if (IsSingleton)
+ return "(" + low + ")";
+ else
+ return "(" + low + ", " + high + ")";
+ }
+ }
+
+ class IntervalCollection : ICollection, IEnumerable {
+ public IntervalCollection () {
+ intervals = new ArrayList ();
+ }
+
+ public Interval this[int i] {
+ get { return (Interval)intervals[i]; }
+ set { intervals[i] = value; }
+ }
+
+ public void Add (Interval i) {
+ intervals.Add (i);
+ }
+
+ public void Clear () {
+ intervals.Clear ();
+ }
+
+ public void Sort () {
+ intervals.Sort ();
+ }
+
+ public void Normalize () {
+ intervals.Sort ();
+
+ int j = 0;
+ while (j < intervals.Count - 1) {
+ Interval a = (Interval)intervals[j];
+ Interval b = (Interval)intervals[j + 1];
+
+ if (!a.IsDisjoint (b) || a.IsAdjacent (b)) {
+ a.Merge (b);
+ intervals[j] = a;
+ intervals.RemoveAt (j + 1);
+ }
+ else
+ ++ j;
+ }
+
+ }
+
+ public delegate double CostDelegate (Interval i);
+
+ public IntervalCollection GetMetaCollection (CostDelegate cost_del) {
+ IntervalCollection meta = new IntervalCollection ();
+
+ Normalize ();
+ Optimize (0, Count - 1, meta, cost_del);
+ meta.intervals.Sort ();
+
+ return meta;
+ }
+
+ private void Optimize (int begin, int end, IntervalCollection meta, CostDelegate cost_del) {
+ Interval set;
+ set.contiguous = false;
+
+ int best_set_begin = -1;
+ int best_set_end = -1;
+ double best_set_cost = 0;
+
+ for (int i = begin; i <= end; ++ i) {
+ set.low = this[i].low;
+
+ double cost = 0.0;
+ for (int j = i; j <= end; ++ j) {
+ set.high = this[j].high;
+ cost += cost_del (this[j]);
+
+ double set_cost = cost_del (set);
+ if (set_cost < cost && cost > best_set_cost) {
+ best_set_begin = i;
+ best_set_end = j;
+ best_set_cost = cost;
+ }
+ }
+ }
+
+ if (best_set_begin < 0) {
+ // didn't find an optimal set: add original members
+
+ for (int i = begin; i <= end; ++ i)
+ meta.Add (this[i]);
+ }
+ else {
+ // found set: add it ...
+
+ set.low = this[best_set_begin].low;
+ set.high = this[best_set_end].high;
+
+ meta.Add (set);
+
+ // ... and optimize to the left and right
+
+ if (best_set_begin > begin)
+ Optimize (begin, best_set_begin - 1, meta, cost_del);
+ if (best_set_end < end)
+ Optimize (best_set_end + 1, end, meta, cost_del);
+ }
+ }
+
+ // ICollection implementation
+
+ public int Count {
+ get { return intervals.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return intervals; }
+ }
+
+ public void CopyTo (Array array, int index) {
+ foreach (Interval i in intervals) {
+ if (index > array.Length)
+ break;
+
+ array.SetValue (i, index ++);
+ }
+ }
+
+ // IEnumerator implementation
+
+ public IEnumerator GetEnumerator () {
+ return new Enumerator (intervals);
+ }
+
+ private class Enumerator : IEnumerator {
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count)
+ throw new InvalidOperationException ();
+
+ return list[ptr];
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count)
+ throw new InvalidOperationException ();
+
+ return ++ ptr < list.Count;
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+
+ private IList list;
+ private int ptr;
+ }
+
+ // private fields
+
+ private ArrayList intervals;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/match.cs b/mcs/class/System/System.Text.RegularExpressions/match.cs
new file mode 100644
index 00000000000..aa2d3f0a4b3
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/match.cs
@@ -0,0 +1,157 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: match.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ [Serializable]
+ public class Capture {
+ public int Index {
+ get { return index; }
+ }
+
+ public int Length {
+ get { return length; }
+ }
+
+ public string Value {
+ get { return text.Substring (index, length); }
+ }
+
+ public override string ToString () {
+ return Value;
+ }
+
+ // internal members
+
+ internal Capture (string text) : this (text, 0, 0) { }
+
+ internal Capture (string text, int index, int length) {
+ this.text = text;
+ this.index = index;
+ this.length = length;
+ }
+
+ internal string Text {
+ get { return text; }
+ }
+
+ // private
+
+ internal int index, length;
+ internal string text;
+ }
+
+ [Serializable]
+ public class Group : Capture {
+ public static Group Synchronized (Group inner) {
+ return inner; // is this enough?
+ }
+
+ public CaptureCollection Captures {
+ get { return captures; }
+ }
+
+ public bool Success {
+ get { return success; }
+ }
+
+ // internal
+
+ internal Group (string text, int[] caps) : base (text) {
+ this.captures = new CaptureCollection ();
+
+ if (caps == null || caps.Length == 0) {
+ this.success = false;
+ return;
+ }
+
+ this.success = true;
+ this.index = caps[0];
+ this.length = caps[1];
+ captures.Add (this);
+ for (int i = 2; i < caps.Length; i += 2)
+ captures.Add (new Capture (text, caps[i], caps[i + 1]));
+ captures.Reverse ();
+ }
+
+ private bool success;
+ private CaptureCollection captures;
+ }
+
+ [Serializable]
+ public class Match : Group {
+ public static Match Empty {
+ get { return empty; }
+ }
+
+ public static Match Synchronized (Match inner) {
+ return inner; // FIXME need to sync on machine access
+ }
+
+ public virtual GroupCollection Groups {
+ get { return groups; }
+ }
+
+ public Match NextMatch () {
+ if (this == Empty)
+ return Empty;
+
+ int scan_ptr = regex.RightToLeft ? Index : Index + Length;
+
+ // next match after an empty match: make sure scan ptr makes progress
+
+ if (Length == 0)
+ scan_ptr += regex.RightToLeft ? -1 : +1;
+
+ return machine.Scan (regex, Text, scan_ptr, text_length);
+ }
+
+ public virtual string Result (string replacement) {
+ return ReplacementEvaluator.Evaluate (replacement, this);
+ }
+
+ // internal
+
+ internal Match () : base (null, null) {
+ this.regex = null;
+ this.machine = null;
+ this.text_length = 0;
+ this.groups = new GroupCollection ();
+
+ groups.Add (this);
+ }
+
+ internal Match (Regex regex, IMachine machine, string text, int text_length, int[][] grps) :
+ base (text, grps[0])
+ {
+ this.regex = regex;
+ this.machine = machine;
+ this.text_length = text_length;
+
+ this.groups = new GroupCollection ();
+ groups.Add (this);
+ for (int i = 1; i < grps.Length; ++ i)
+ groups.Add (new Group (text, grps[i]));
+ }
+
+ internal Regex Regex {
+ get { return regex; }
+ }
+
+ // private
+
+ private Regex regex;
+ private IMachine machine;
+ private int text_length;
+ private GroupCollection groups;
+
+ private static Match empty = new Match ();
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/notes.txt b/mcs/class/System/System.Text.RegularExpressions/notes.txt
new file mode 100644
index 00000000000..56b047ec76e
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/notes.txt
@@ -0,0 +1,45 @@
+TODO:
+
+* Need to go through everything and square it with RightToLeft matching.
+ The support for this was built into an early version, and lots of things built
+ afterwards are not savvy about bi-directional matching. Things that spring to
+ mind: Regex match methods should start at 0 or text.Length depending on
+ direction. Do split and replace need changes? Match should be aware of its
+ direction (already applied some of this to NextMatch logic). The interpreter
+ needs to check left and right bounds. Anchoring and substring discovery need
+ to be reworked. RTL matches are going to have anchors on the right - ie $, \Z
+ and \z. This should be added to the anchor logic. QuickSearch needs to work in
+ reverse. There may be other stuff.... work through the code.
+
+* Add ECMAScript support to the parser. For example, [.\w\s\d] map to ECMA
+ categories instead of canonical ones [DONE]. There's different behaviour on
+ backreference/octal disambiguation. Find out what the runtime behavioural
+ difference is for cyclic backreferences eg (?(1)abc\1) - this is only briefly
+ mentioned in the spec. I couldn't find much on this in the ECMAScript
+ specification either.
+
+* Octal/backreference parsing needs a big fix. The rules are ridiculously complex.
+
+* Add a check in QuickSearch for single character substrings. This is likely to
+ be a common case. There's no need to go through a shift table. Also, have a
+ look at just computing a relevant subset of the shift table and using an
+ (offset, size) pair to help test inclusion. Characters not in the table get
+ the default len + 1 shift.
+
+* Improve the perl test suite. Run under MS runtime to generate checksums for
+ each trial. Checksums should incorporate: all captures (index, length) for all
+ groups; names of explicit capturing groups, and the numbers they map to. Any
+ other state? RegexTrial.Execute() will then compare result and checksum.
+
+* The pattern (?(1?)a|b). It should fail: Perl fails, the MS implementation
+ fails, but I pass. The documentation says that the construct (?(X)...) can be
+ processed in two ways. If X is a valid group number, or a valid group name,
+ then the expression becomes a capture conditional - the (...) part is
+ executed only if X has been captured. If X is not a group number or name, then
+ it is treated as a positive lookahead., and (...) is only executed if the
+ lookahead succeeds. My code does the latter, but on further investigation it
+ appears that both Perl and MS fail to recognize an expression assertion if the
+ first character of the assertion is a number - which instead suggests a
+ capture conditional. The exception raised is something like "invalid group
+ number". I get the feeling the my behaviour seems more correct, but it's not
+ consistent with the other implementations, so it should probably be changed.
diff --git a/mcs/class/System/System.Text.RegularExpressions/parser.cs b/mcs/class/System/System.Text.RegularExpressions/parser.cs
new file mode 100644
index 00000000000..1804b9289e0
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/parser.cs
@@ -0,0 +1,1120 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: parser.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Text.RegularExpressions.Syntax {
+
+ class Parser {
+ public static int ParseDecimal (string str, ref int ptr) {
+ return ParseNumber (str, ref ptr, 10, 1, Int32.MaxValue);
+ }
+
+ public static int ParseOctal (string str, ref int ptr) {
+ return ParseNumber (str, ref ptr, 8, 1, 3);
+ }
+
+ public static int ParseHex (string str, ref int ptr, int digits) {
+ return ParseNumber (str, ref ptr, 16, digits, digits);
+ }
+
+ public static int ParseNumber (string str, ref int ptr, int b, int min, int max) {
+ int p = ptr, n = 0, digits = 0, d;
+ if (max < min)
+ max = Int32.MaxValue;
+
+ while (digits < max && p < str.Length) {
+ d = ParseDigit (str[p ++], b, digits);
+ if (d < 0) {
+ -- p;
+ break;
+ }
+
+ n = n * b + d;
+ ++ digits;
+ }
+
+ if (digits < min)
+ return -1;
+
+ ptr = p;
+ return n;
+ }
+
+ public static string ParseName (string str, ref int ptr) {
+ if (Char.IsDigit (str[ptr])) {
+ int gid = ParseNumber (str, ref ptr, 10, 1, 0);
+ if (gid > 0)
+ return gid.ToString ();
+
+ return null;
+ }
+
+ int start = ptr;
+ for (;;) {
+ if (!IsNameChar (str[ptr]))
+ break;
+ ++ ptr;
+ }
+
+ if (ptr - start > 0)
+ return str.Substring (start, ptr - start);
+
+ return null;
+ }
+
+ public static string Escape (string str) {
+ string result = "";
+ for (int i = 0; i < str.Length; ++ i) {
+ char c = str[i];
+ switch (c) {
+ case '\\': case '*': case '+': case '?': case '|':
+ case '{': case '[': case '(': case ')': case '^':
+ case '$': case '.': case '#': case ' ':
+ result += "\\" + c;
+ break;
+
+ case '\t': result += "\\t"; break;
+ case '\n': result += "\\n"; break;
+ case '\r': result += "\\r"; break;
+ case '\f': result += "\\f"; break;
+
+ default: result += c; break;
+ }
+ }
+
+ return result;
+ }
+
+ public static string Unescape (string str) {
+ return new Parser ().ParseString (str);
+ }
+
+ // public instance
+
+ public Parser () {
+ this.caps = new ArrayList ();
+ this.refs = new Hashtable ();
+ }
+
+ public RegularExpression ParseRegularExpression (string pattern, RegexOptions options) {
+ this.pattern = pattern;
+ this.ptr = 0;
+
+ caps.Clear ();
+ refs.Clear ();
+ this.num_groups = 0;
+
+ try {
+ RegularExpression re = new RegularExpression ();
+ ParseGroup (re, options, null);
+ ResolveReferences ();
+
+ re.GroupCount = num_groups;
+
+ return re;
+ }
+ catch (IndexOutOfRangeException) {
+ throw NewParseException ("Unexpected end of pattern.");
+ }
+ }
+
+ public IDictionary GetMapping () {
+ Hashtable mapping = new Hashtable ();
+ int end = caps.Count;
+ mapping.Add ("0", 0);
+ for (int i = 0; i < end;) {
+ CapturingGroup group = (CapturingGroup) caps [i];
+ i++;
+ if (group.Name != null && !mapping.Contains (group.Name))
+ mapping.Add (group.Name, group.Number);
+ else
+ mapping.Add (i.ToString (), i);
+ }
+
+ return mapping;
+ }
+
+ // private methods
+
+ private void ParseGroup (Group group, RegexOptions options, Assertion assertion) {
+ bool is_top_level = group is RegularExpression;
+
+ Alternation alternation = null;
+ string literal = null;
+
+ Group current = new Group ();
+ Expression expr = null;
+ bool closed = false;
+
+ while (true) {
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ if (ptr >= pattern.Length)
+ break;
+
+ // (1) Parse for Expressions
+
+ char ch = pattern[ptr ++];
+
+ switch (ch) {
+ case '^': {
+ Position pos =
+ IsMultiline (options) ? Position.StartOfLine : Position.Start;
+ expr = new PositionAssertion (pos);
+ break;
+ }
+
+ case '$': {
+ Position pos =
+ IsMultiline (options) ? Position.EndOfLine : Position.End;
+ expr = new PositionAssertion (pos);
+ break;
+ }
+
+ case '.': {
+ Category cat =
+ IsSingleline (options) ? Category.AnySingleline : Category.Any;
+ expr = new CharacterClass (cat, false);
+ break;
+ }
+
+ case '\\': {
+ int c = ParseEscape ();
+ if (c >= 0)
+ ch = (char)c;
+ else {
+ expr = ParseSpecial (options);
+
+ if (expr == null)
+ ch = pattern[ptr ++]; // default escape
+ }
+ break;
+ }
+
+ case '[': {
+ expr = ParseCharacterClass (options);
+ break;
+ }
+
+ case '(': {
+ bool ignore = IsIgnoreCase (options);
+ expr = ParseGroupingConstruct (ref options);
+ if (expr == null) {
+ if (literal != null && IsIgnoreCase (options) != ignore) {
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+ literal = null;
+ }
+
+ continue;
+ }
+ break;
+ }
+
+ case ')': {
+ closed = true;
+ goto EndOfGroup;
+ }
+
+ case '|': {
+ if (literal != null) {
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+ literal = null;
+ }
+
+ if (assertion != null) {
+ if (assertion.TrueExpression == null)
+ assertion.TrueExpression = current;
+ else if (assertion.FalseExpression == null)
+ assertion.FalseExpression = current;
+ else
+ throw NewParseException ("Too many | in (?()|).");
+ }
+ else {
+ if (alternation == null)
+ alternation = new Alternation ();
+
+ alternation.AddAlternative (current);
+ }
+
+ current = new Group ();
+ continue;
+ }
+
+ case '*': case '+': case '?': case '{': {
+ throw NewParseException ("Bad quantifier.");
+ }
+
+ default:
+ break; // literal character
+ }
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+
+ // (2) Check for Repetitions
+
+ if (ptr < pattern.Length) {
+ char k = pattern[ptr];
+
+ if (k == '?' || k == '*' || k == '+' || k == '{') {
+ ++ ptr;
+
+ int min = 0, max = 0;
+ bool lazy = false;
+
+ switch (k) {
+ case '?': min = 0; max = 1; break;
+ case '*': min = 0; max = 0xffff; break;
+ case '+': min = 1; max = 0xffff; break;
+ case '{': ParseRepetitionBounds (out min, out max, options); break;
+ }
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ if (ptr < pattern.Length && pattern[ptr] == '?') {
+ ++ ptr;
+ lazy = true;
+ }
+
+ Repetition repetition = new Repetition (min, max, lazy);
+
+ if (expr == null)
+ repetition.Expression = new Literal (ch.ToString (), IsIgnoreCase (options));
+ else
+ repetition.Expression = expr;
+
+ expr = repetition;
+ }
+ }
+
+ // (3) Append Expression and/or Literal
+
+ if (expr == null) {
+ if (literal == null)
+ literal = "";
+ literal += ch;
+ }
+ else {
+ if (literal != null) {
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+ literal = null;
+ }
+
+ current.AppendExpression (expr);
+ expr = null;
+ }
+
+ if (is_top_level && ptr >= pattern.Length)
+ goto EndOfGroup;
+ }
+
+ EndOfGroup:
+ if (is_top_level && closed)
+ throw NewParseException ("Too many )'s.");
+ if (!is_top_level && !closed)
+ throw NewParseException ("Not enough )'s.");
+
+
+ // clean up literals and alternations
+
+ if (literal != null)
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+
+ if (assertion != null) {
+ if (assertion.TrueExpression == null)
+ assertion.TrueExpression = current;
+ else
+ assertion.FalseExpression = current;
+
+ group.AppendExpression (assertion);
+ }
+ else if (alternation != null) {
+ alternation.AddAlternative (current);
+ group.AppendExpression (alternation);
+ }
+ else
+ group.AppendExpression (current);
+ }
+
+ private Expression ParseGroupingConstruct (ref RegexOptions options) {
+ if (pattern[ptr] != '?') {
+ Group group;
+
+ if (IsExplicitCapture (options))
+ group = new Group ();
+ else {
+ group = new CapturingGroup ();
+ caps.Add (group);
+ }
+
+ ParseGroup (group, options, null);
+ return group;
+ }
+ else
+ ++ ptr;
+
+ switch (pattern[ptr]) {
+ case ':': { // non-capturing group
+ ++ ptr;
+ Group group = new Group ();
+ ParseGroup (group, options, null);
+
+ return group;
+ }
+
+ case '>': { // non-backtracking group
+ ++ ptr;
+ Group group = new NonBacktrackingGroup ();
+ ParseGroup (group, options, null);
+
+ return group;
+ }
+
+ case 'i': case 'm': case 'n':
+ case 's': case 'x': case '-': { // options
+ RegexOptions o = options;
+ ParseOptions (ref o, false);
+ if (pattern[ptr] == '-') {
+ ++ ptr;
+ ParseOptions (ref o, true);
+ }
+
+ if (pattern[ptr] == ':') { // pass options to child group
+ ++ ptr;
+ Group group = new Group ();
+ ParseGroup (group, o, null);
+ return group;
+ }
+ else if (pattern[ptr] == ')') { // change options of enclosing group
+ ++ ptr;
+ options = o;
+ return null;
+ }
+ else
+ throw NewParseException ("Bad options");
+ }
+
+ case '<': case '=': case '!': { // lookahead/lookbehind
+ ExpressionAssertion asn = new ExpressionAssertion ();
+ if (!ParseAssertionType (asn))
+ goto case '\''; // it's a (?<name> ) construct
+
+ Group test = new Group ();
+ ParseGroup (test, options, null);
+
+ asn.TestExpression = test;
+ return asn;
+ }
+
+ case '\'': { // named/balancing group
+ char delim;
+ if (pattern[ptr] == '<')
+ delim = '>';
+ else
+ delim = '\'';
+
+ ++ ptr;
+ string name = ParseName ();
+
+ if (pattern[ptr] == delim) {
+ // capturing group
+
+ if (name == null)
+ throw NewParseException ("Bad group name.");
+
+ ++ ptr;
+ CapturingGroup cap = new CapturingGroup ();
+ cap.Name = name;
+ caps.Add (cap);
+ ParseGroup (cap, options, null);
+
+ return cap;
+ }
+ else if (pattern[ptr] == '-') {
+ // balancing group
+
+ ++ ptr;
+ string balance_name = ParseName ();
+ if (balance_name == null || pattern[ptr] != delim)
+ throw NewParseException ("Bad balancing group name.");
+
+ ++ ptr;
+ BalancingGroup bal = new BalancingGroup ();
+ bal.Name = name;
+ caps.Add (bal);
+ refs.Add (bal, balance_name);
+
+ return bal;
+ }
+ else
+ throw NewParseException ("Bad group name.");
+ }
+
+ case '(': { // expression/capture test
+ Assertion asn;
+
+ ++ ptr;
+ int p = ptr;
+ string name = ParseName ();
+ if (name == null || pattern[ptr] != ')') { // expression test
+ // FIXME MS implementation doesn't seem to
+ // implement this version of (?(x) ...)
+
+ ptr = p;
+ ExpressionAssertion expr_asn = new ExpressionAssertion ();
+
+ if (pattern[ptr] == '?') {
+ ++ ptr;
+ if (!ParseAssertionType (expr_asn))
+ throw NewParseException ("Bad conditional.");
+ }
+ else {
+ expr_asn.Negate = false;
+ expr_asn.Reverse = false;
+ }
+
+ Group test = new Group ();
+ ParseGroup (test, options, null);
+ expr_asn.TestExpression = test;
+ asn = expr_asn;
+ }
+ else { // capture test
+ ++ ptr;
+ asn = new CaptureAssertion ();
+ refs.Add (asn, name);
+ }
+
+ Group group = new Group ();
+ ParseGroup (group, options, asn);
+ return group;
+ }
+
+ case '#': { // comment
+ ++ ptr;
+ while (pattern[ptr ++] != ')') {
+ if (ptr >= pattern.Length)
+ throw NewParseException ("Unterminated (?#...) comment.");
+ }
+ return null;
+ }
+
+ default: // error
+ throw NewParseException ("Bad grouping construct.");
+ }
+ }
+
+ private bool ParseAssertionType (ExpressionAssertion assertion) {
+ if (pattern[ptr] == '<') {
+ switch (pattern[ptr + 1]) {
+ case '=':
+ assertion.Negate = false;
+ break;
+ case '!':
+ assertion.Negate = true;
+ break;
+ default:
+ return false;
+ }
+
+ assertion.Reverse = true;
+ ptr += 2;
+ }
+ else {
+ switch (pattern[ptr]) {
+ case '=':
+ assertion.Negate = false;
+ break;
+ case '!':
+ assertion.Negate = true;
+ break;
+ default:
+ return false;
+ }
+
+ assertion.Reverse = false;
+ ptr += 1;
+ }
+
+ return true;
+ }
+
+ private void ParseOptions (ref RegexOptions options, bool negate) {
+ for (;;) {
+ switch (pattern[ptr]) {
+ case 'i':
+ if (negate)
+ options &= ~RegexOptions.IgnoreCase;
+ else
+ options |= RegexOptions.IgnoreCase;
+ break;
+
+ case 'm':
+ if (negate)
+ options &= ~RegexOptions.Multiline;
+ else
+ options |= RegexOptions.Multiline;
+ break;
+
+ case 'n':
+ if (negate)
+ options &= ~RegexOptions.ExplicitCapture;
+ else
+ options |= RegexOptions.ExplicitCapture;
+ break;
+
+ case 's':
+ if (negate)
+ options &= ~RegexOptions.Singleline;
+ else
+ options |= RegexOptions.Singleline;
+ break;
+
+ case 'x':
+ if (negate)
+ options &= ~RegexOptions.IgnorePatternWhitespace;
+ else
+ options |= RegexOptions.IgnorePatternWhitespace;
+ break;
+
+ default:
+ return;
+ }
+
+ ++ ptr;
+ }
+ }
+
+ private Expression ParseCharacterClass (RegexOptions options) {
+ bool negate, ecma;
+ if (pattern[ptr] == '^') {
+ negate = true;
+ ++ ptr;
+ }
+ else
+ negate = false;
+
+ ecma = IsECMAScript (options);
+ CharacterClass cls = new CharacterClass (negate, IsIgnoreCase (options));
+
+ if (pattern[ptr] == ']') {
+ cls.AddCharacter (']');
+ ++ ptr;
+ }
+
+ int c = -1;
+ int last = -1;
+ bool range = false;
+ bool closed = false;
+ while (ptr < pattern.Length) {
+ c = pattern[ptr ++];
+
+ if (c == ']') {
+ closed = true;
+ break;
+ }
+
+ if (c == '-') {
+ range = true;
+ continue;
+ }
+
+ if (c == '\\') {
+ c = ParseEscape ();
+ if (c < 0) {
+ // didn't recognize escape
+
+ c = pattern[ptr ++];
+ switch (c) {
+ case 'b': c = '\b'; break;
+
+ case 'd':
+ cls.AddCategory (ecma ? Category.EcmaDigit : Category.Digit, false);
+ last = -1;
+ continue;
+
+ case 'w':
+ cls.AddCategory (ecma ? Category.EcmaWord : Category.Word, false);
+ last = -1;
+ continue;
+
+ case 's':
+ cls.AddCategory (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, false);
+ last = -1;
+ continue;
+
+ case 'p':
+ cls.AddCategory (ParseUnicodeCategory (), false); // ignore ecma
+ last = -1;
+ continue;
+
+ case 'D':
+ cls.AddCategory (ecma ? Category.EcmaDigit : Category.Digit, true);
+ last = -1;
+ continue;
+
+ case 'W':
+ cls.AddCategory (ecma ? Category.EcmaWord : Category.Word, true);
+ last = -1;
+ continue;
+
+ case 'S':
+ cls.AddCategory (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, true);
+ last = -1;
+ continue;
+
+ case 'P':
+ cls.AddCategory (ParseUnicodeCategory (), true);
+ last = -1;
+ continue;
+
+ default: break; // add escaped character
+ }
+ }
+ }
+
+ if (range) {
+ if (c < last)
+ throw NewParseException ("[x-y] range in reverse order.");
+
+ if (last >=0 )
+ cls.AddRange ((char)last, (char)c);
+ else {
+ cls.AddCharacter ((char)c);
+ cls.AddCharacter ('-');
+ }
+
+ range = false;
+ last = -1;
+ }
+ else {
+ cls.AddCharacter ((char)c);
+ last = c;
+ }
+ }
+
+ if (!closed)
+ throw NewParseException ("Unterminated [] set.");
+
+ if (range)
+ cls.AddCharacter ('-');
+
+ return cls;
+ }
+
+ private void ParseRepetitionBounds (out int min, out int max, RegexOptions options) {
+ int n, m;
+
+ /* check syntax */
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ n = ParseNumber (10, 1, 0);
+ if (n < 0)
+ throw NewParseException ("Illegal {x,y} - bad value of x.");
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ switch (pattern[ptr ++]) {
+ case '}':
+ m = n;
+ break;
+ case ',':
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ m = ParseNumber (10, 1, 0);
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ if (pattern[ptr ++] != '}')
+ throw NewParseException ("Illegal {x,y} - bad value of y.");
+ break;
+ default:
+ throw NewParseException ("Illegal {x,y}");
+ }
+
+ /* check bounds and ordering */
+
+ if (n >= 0xffff || m >= 0xffff)
+ throw NewParseException ("Illegal {x, y} - maximum of 65535.");
+ if (m >= 0 && m < n)
+ throw NewParseException ("Illegal {x, y} with x > y.");
+
+ /* assign min and max */
+
+ min = n;
+ if (m > 0)
+ max = m;
+ else
+ max = 0xffff;
+ }
+
+ private Category ParseUnicodeCategory () {
+ if (pattern[ptr ++] != '{')
+ throw NewParseException ("Incomplete \\p{X} character escape.");
+
+ string name = ParseName (pattern, ref ptr);
+ if (name == null)
+ throw NewParseException ("Incomplete \\p{X} character escape.");
+
+ Category cat = CategoryUtils.CategoryFromName (name);
+ if (cat == Category.None)
+ throw NewParseException ("Unknown property '" + name + "'.");
+
+ if (pattern[ptr ++] != '}')
+ throw NewParseException ("Incomplete \\p{X} character escape.");
+
+ return cat;
+ }
+
+ private Expression ParseSpecial (RegexOptions options) {
+ int p = ptr;
+ bool ecma = IsECMAScript (options);
+ Expression expr = null;
+
+ switch (pattern[ptr ++]) {
+
+ // categories
+
+ case 'd':
+ expr = new CharacterClass (ecma ? Category.EcmaDigit : Category.Digit, false);
+ break;
+
+ case 'w':
+ expr = new CharacterClass (ecma ? Category.EcmaWord : Category.Word, false);
+ break;
+
+ case 's':
+ expr = new CharacterClass (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, false);
+ break;
+
+ case 'p':
+ // this is odd - ECMAScript isn't supposed to support Unicode,
+ // yet \p{..} compiles and runs under the MS implementation
+ // identically to canonical mode. That's why I'm ignoring the
+ // value of ecma here.
+
+ expr = new CharacterClass (ParseUnicodeCategory (), false);
+ break;
+
+ case 'D':
+ expr = new CharacterClass (ecma ? Category.EcmaDigit : Category.Digit, true);
+ break;
+
+ case 'W':
+ expr = new CharacterClass (ecma ? Category.EcmaWord : Category.Word, true);
+ break;
+
+ case 'S':
+ expr = new CharacterClass (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, true);
+ break;
+
+ case 'P':
+ expr = new CharacterClass (ParseUnicodeCategory (), true);
+ break;
+
+ // positions
+
+ case 'A': expr = new PositionAssertion (Position.StartOfString); break;
+ case 'Z': expr = new PositionAssertion (Position.End); break;
+ case 'z': expr = new PositionAssertion (Position.EndOfString); break;
+ case 'G': expr = new PositionAssertion (Position.StartOfScan); break;
+ case 'b': expr = new PositionAssertion (Position.Boundary); break;
+ case 'B': expr = new PositionAssertion (Position.NonBoundary); break;
+
+ // references
+
+ case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9': {
+ ptr --;
+ int n = ParseNumber (10, 1, 0);
+ if (n < 0) {
+ ptr = p;
+ return null;
+ }
+
+ // FIXME test if number is within number of assigned groups
+ // this may present a problem for right-to-left matching
+
+ Reference reference = new Reference (IsIgnoreCase (options));
+ refs.Add (reference, n.ToString ());
+ expr = reference;
+ break;
+ }
+
+ case 'k': {
+ char delim = pattern[ptr ++];
+ if (delim == '<')
+ delim = '>';
+ else if (delim != '\'')
+ throw NewParseException ("Malformed \\k<...> named backreference.");
+
+ string name = ParseName ();
+ if (name == null || pattern[ptr] != delim)
+ throw NewParseException ("Malformed \\k<...> named backreference.");
+
+ ++ ptr;
+ Reference reference = new Reference (IsIgnoreCase (options));
+ refs.Add (reference, name);
+ expr = reference;
+ break;
+ }
+
+ default:
+ expr = null;
+ break;
+ }
+
+ if (expr == null)
+ ptr = p;
+
+ return expr;
+ }
+
+ private int ParseEscape () {
+ int p = ptr;
+ int c;
+
+ if (p >= pattern.Length)
+ throw new ArgumentException (
+ String.Format ("Parsing \"{0}\" - Illegal \\ at end of " +
+ "pattern.", pattern), pattern);
+
+ switch (pattern[ptr ++]) {
+
+ // standard escapes (except \b)
+
+ case 'a': return '\u0007';
+ case 't': return '\u0009';
+ case 'r': return '\u000d';
+ case 'v': return '\u000b';
+ case 'f': return '\u000c';
+ case 'n': return '\u000a';
+ case 'e': return '\u001b';
+ case '\\': return '\\';
+
+ // character codes
+
+ case '0': return ParseOctal (pattern, ref ptr);
+
+ case 'x':
+ c = ParseHex (pattern, ref ptr, 2);
+ if (c < 0)
+ throw NewParseException ("Insufficient hex digits");
+
+ return c;
+
+ case 'u':
+ c = ParseHex (pattern, ref ptr, 4);
+ if (c < 0)
+ throw NewParseException ("Insufficient hex digits");
+
+ return c;
+
+ // control characters
+
+ case 'c':
+ c = pattern[p ++];
+ if (c >= 'A' && c <= 'Z')
+ return c - 'A';
+ else if (c >= '@' && c <= '_')
+ return c - '@';
+ else
+ throw NewParseException ("Unrecognized control character.");
+
+ // unknown escape
+
+ default:
+ ptr = p;
+ return -1;
+ }
+ }
+
+ private string ParseName () {
+ return Parser.ParseName (pattern, ref ptr);
+ }
+
+ private static bool IsNameChar (char c) {
+ UnicodeCategory cat = Char.GetUnicodeCategory (c);
+ if (cat == UnicodeCategory.ModifierLetter)
+ return false;
+ if (cat == UnicodeCategory.ConnectorPunctuation)
+ return true;
+ return Char.IsLetterOrDigit (c);
+ }
+
+ private int ParseNumber (int b, int min, int max) {
+ return Parser.ParseNumber (pattern, ref ptr, b, min, max);
+ }
+
+ private int ParseDecimal () {
+ return Parser.ParseDecimal (pattern, ref ptr);
+ }
+
+ private static int ParseDigit (char c, int b, int n) {
+ switch (b) {
+ case 8:
+ if (c >= '0' && c <= '7')
+ return c - '0';
+ else
+ return -1;
+ case 10:
+ if (c >= '0' && c <= '9')
+ return c - '0';
+ else
+ return -1;
+ case 16:
+ if (c >= '0' && c <= '9')
+ return c - '0';
+ else if (c >= 'a' && c <= 'f')
+ return 10 + c - 'a';
+ else if (c >= 'A' && c <= 'F')
+ return 10 + c - 'A';
+ else
+ return -1;
+ default:
+ return -1;
+ }
+ }
+
+ private void ConsumeWhitespace (bool ignore) {
+ while (true) {
+ if (ptr >= pattern.Length)
+ break;
+
+ if (pattern[ptr] == '(') {
+ if (ptr + 3 >= pattern.Length)
+ return;
+
+ if (pattern[ptr + 1] != '?' || pattern[ptr + 2] != '#')
+ return;
+
+ ptr += 3;
+ while (pattern[ptr ++] != ')')
+ /* ignore */ ;
+ }
+ else if (ignore && pattern[ptr] == '#') {
+ while (ptr < pattern.Length && pattern[ptr ++] != '\n')
+ /* ignore */ ;
+ }
+ else if (ignore && Char.IsWhiteSpace (pattern[ptr])) {
+ while (ptr < pattern.Length && Char.IsWhiteSpace (pattern[ptr]))
+ ++ ptr;
+ }
+ else
+ return;
+ }
+ }
+
+ private string ParseString (string pattern) {
+ this.pattern = pattern;
+ this.ptr = 0;
+
+ string result = "";
+ while (ptr < pattern.Length) {
+ int c = pattern[ptr ++];
+ if (c == '\\')
+ c = ParseEscape ();
+
+ result += (char)c;
+ }
+
+ return result;
+ }
+
+ private void ResolveReferences () {
+ int gid = 1;
+ Hashtable dict = new Hashtable ();
+
+ // number unnamed groups
+
+ foreach (CapturingGroup group in caps) {
+ if (group.Name == null) {
+ dict.Add (gid.ToString (), group);
+ group.Number = gid ++;
+
+ ++ num_groups;
+ }
+ }
+
+ // number named groups
+
+ foreach (CapturingGroup group in caps) {
+ if (group.Name != null) {
+ if (!dict.Contains (group.Name)) {
+ dict.Add (group.Name, group);
+ group.Number = gid ++;
+
+ ++ num_groups;
+ }
+ else {
+ CapturingGroup prev = (CapturingGroup)dict[group.Name];
+ group.Number = prev.Number;
+ }
+ }
+ }
+
+ // resolve references
+
+ foreach (Expression expr in refs.Keys) {
+ string name = (string)refs[expr];
+ if (!dict.Contains (name)) {
+ throw NewParseException ("Reference to undefined group " +
+ (Char.IsDigit (name[0]) ? "number " : "name ") +
+ name);
+ }
+
+ CapturingGroup group = (CapturingGroup)dict[name];
+ if (expr is Reference)
+ ((Reference)expr).CapturingGroup = group;
+ else if (expr is CaptureAssertion)
+ ((CaptureAssertion)expr).CapturingGroup = group;
+ else if (expr is BalancingGroup)
+ ((BalancingGroup)expr).Balance = group;
+ }
+ }
+
+ // flag helper functions
+
+ private static bool IsIgnoreCase (RegexOptions options) {
+ return (options & RegexOptions.IgnoreCase) != 0;
+ }
+
+ private static bool IsMultiline (RegexOptions options) {
+ return (options & RegexOptions.Multiline) != 0;
+ }
+
+ private static bool IsExplicitCapture (RegexOptions options) {
+ return (options & RegexOptions.ExplicitCapture) != 0;
+ }
+
+ private static bool IsSingleline (RegexOptions options) {
+ return (options & RegexOptions.Singleline) != 0;
+ }
+
+ private static bool IsIgnorePatternWhitespace (RegexOptions options) {
+ return (options & RegexOptions.IgnorePatternWhitespace) != 0;
+ }
+
+ private static bool IsRightToLeft (RegexOptions options) {
+ return (options & RegexOptions.RightToLeft) != 0;
+ }
+
+ private static bool IsECMAScript (RegexOptions options) {
+ return (options & RegexOptions.ECMAScript) != 0;
+ }
+
+ // exception creation
+
+ private ArgumentException NewParseException (string msg) {
+ msg = "parsing \"" + pattern + "\" - " + msg;
+ return new ArgumentException (msg, pattern);
+ }
+
+ private string pattern;
+ private int ptr;
+
+ private ArrayList caps;
+ private Hashtable refs;
+ private int num_groups;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/quicksearch.cs b/mcs/class/System/System.Text.RegularExpressions/quicksearch.cs
new file mode 100644
index 00000000000..65665a2518b
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/quicksearch.cs
@@ -0,0 +1,108 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: quicksearch.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ // TODO use simple test for single character strings
+
+ class QuickSearch {
+ // simplified boyer-moore for fast substring matching
+
+ public QuickSearch (string str, bool ignore) {
+ this.str = str;
+ this.len = str.Length;
+ this.ignore = ignore;
+
+ Setup ();
+ }
+
+ public string String {
+ get { return str; }
+ }
+
+ public int Length {
+ get { return len; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ }
+
+ public int Search (string text, int start, int end) {
+ if (end > text.Length - len)
+ end = text.Length - len;
+
+ int ptr = start;
+ if (!ignore) {
+ while (ptr <= end) {
+ int i = len - 1;
+ while (str[i] == text[ptr + i]) {
+ if (-- i < 0)
+ return ptr;
+ }
+
+ if (ptr < end)
+ ptr += shift[text[ptr + len]];
+ else
+ break;
+ }
+ }
+ else {
+ // ignore case: same as above, but we convert text
+ // to lower case before doing the string compare
+
+ while (ptr <= end) {
+ int i = len - 1;
+ while (str[i] == Char.ToLower (text[ptr + i])) {
+ if (-- i < 0)
+ return ptr;
+ }
+
+ if (ptr < end)
+ ptr += shift[text[ptr + len]];
+ else
+ break;
+ }
+ }
+
+ return -1;
+ }
+
+ // private
+
+ private void Setup () {
+ if (ignore)
+ str = str.ToLower ();
+
+ // this is a 64k entry shift table. that's 128kb per pattern!
+ // is it worth compressing this by only storing shifts within
+ // a (lo, hi) character range? for most substrings this would
+ // be around 50 bytes...
+
+ shift = new int[0x1000];
+ for (int i = 0; i < 0x1000; ++ i)
+ shift[i] = len + 1;
+
+ for (int i = 0; i < len; ++ i) {
+ char c = str[i];
+
+ shift[c] = len - i;
+ if (ignore)
+ shift[Char.ToUpper (c)] = len - i;
+ }
+ }
+
+ private string str;
+ private int len;
+ private bool ignore;
+
+ private int[] shift;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/regex.cs b/mcs/class/System/System.Text.RegularExpressions/regex.cs
new file mode 100644
index 00000000000..901ed70df4c
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/regex.cs
@@ -0,0 +1,414 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: regex.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.Serialization;
+
+using RegularExpression = System.Text.RegularExpressions.Syntax.RegularExpression;
+using Parser = System.Text.RegularExpressions.Syntax.Parser;
+
+namespace System.Text.RegularExpressions {
+
+ public delegate string MatchEvaluator (Match match);
+
+ [Flags]
+ public enum RegexOptions {
+ None = 0x000,
+ IgnoreCase = 0x001,
+ Multiline = 0x002,
+ ExplicitCapture = 0x004,
+ Compiled = 0x008,
+ Singleline = 0x010,
+ IgnorePatternWhitespace = 0x020,
+ RightToLeft = 0x040,
+ ECMAScript = 0x100
+ }
+
+ [Serializable]
+ public class Regex : ISerializable {
+ public static void CompileToAssembly
+ (RegexCompilationInfo[] regexes, AssemblyName aname)
+ {
+ throw new Exception ("Not implemented.");
+ }
+
+ public static void CompileToAssembly
+ (RegexCompilationInfo[] regexes, AssemblyName aname,
+ CustomAttributeBuilder[] attribs)
+ {
+ throw new Exception ("Not implemented.");
+ }
+
+ public static void CompileToAssembly
+ (RegexCompilationInfo[] regexes, AssemblyName aname,
+ CustomAttributeBuilder[] attribs, string resourceFile)
+ {
+ throw new Exception ("Not implemented.");
+ }
+
+ public static string Escape (string str) {
+ return Parser.Escape (str);
+ }
+
+ public static string Unescape (string str) {
+ return Parser.Unescape (str);
+ }
+
+ public static bool IsMatch (string input, string pattern) {
+ return IsMatch (input, pattern, RegexOptions.None);
+ }
+
+ public static bool IsMatch (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.IsMatch (input);
+ }
+
+ public static Match Match (string input, string pattern) {
+ return Regex.Match (input, pattern, RegexOptions.None);
+ }
+
+ public static Match Match (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.Match (input);
+ }
+
+ public static MatchCollection Matches (string input, string pattern) {
+ return Matches (input, pattern, RegexOptions.None);
+ }
+
+ public static MatchCollection Matches (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.Matches (input);
+ }
+
+ public static string Replace
+ (string input, string pattern, MatchEvaluator evaluator)
+ {
+ return Regex.Replace (input, pattern, evaluator, RegexOptions.None);
+ }
+
+ public static string Replace
+ (string input, string pattern, MatchEvaluator evaluator,
+ RegexOptions options)
+ {
+ Regex re = new Regex (pattern, options);
+ return re.Replace (input, evaluator);
+ }
+
+ public static string Replace
+ (string input, string pattern, string replacement)
+ {
+ return Regex.Replace (input, pattern, replacement, RegexOptions.None);
+ }
+
+ public static string Replace
+ (string input, string pattern, string replacement,
+ RegexOptions options)
+ {
+ Regex re = new Regex (pattern, options);
+ return re.Replace (input, replacement);
+ }
+
+ public static string[] Split (string input, string pattern) {
+ return Regex.Split (input, pattern, RegexOptions.None);
+ }
+
+ public static string[] Split (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.Split (input);
+ }
+
+ // private
+
+ private static FactoryCache cache = new FactoryCache (200); // TODO put some meaningful number here
+
+ // constructors
+
+ protected Regex () {
+ // XXX what's this constructor for?
+ }
+
+ public Regex (string pattern) : this (pattern, RegexOptions.None) {
+ }
+
+ public Regex (string pattern, RegexOptions options) {
+ this.pattern = pattern;
+ this.options = options;
+
+ this.factory = cache.Lookup (pattern, options);
+
+ if (this.factory == null) {
+ // parse and install group mapping
+
+ Parser psr = new Parser ();
+ RegularExpression re = psr.ParseRegularExpression (pattern, options);
+ this.group_count = re.GroupCount;
+ this.mapping = psr.GetMapping ();
+
+ // compile
+
+ ICompiler cmp;
+ //if ((options & RegexOptions.Compiled) != 0)
+ // throw new Exception ("Not implemented.");
+ //cmp = new CILCompiler ();
+ //else
+ cmp = new PatternCompiler ();
+
+ re.Compile (cmp, RightToLeft);
+
+ // install machine factory and add to pattern cache
+
+ this.factory = cmp.GetMachineFactory ();
+ this.factory.Mapping = mapping;
+ cache.Add (pattern, options, this.factory);
+ } else {
+ this.group_count = this.factory.GroupCount;
+ this.mapping = this.factory.Mapping;
+ }
+ }
+
+ protected Regex (SerializationInfo info, StreamingContext context) :
+ this (info.GetString ("pattern"),
+ (RegexOptions) info.GetValue ("options", typeof (RegexOptions))) {
+ }
+
+
+ // public instance properties
+
+ public RegexOptions Options {
+ get { return options; }
+ }
+
+ public bool RightToLeft {
+ get { return (options & RegexOptions.RightToLeft) != 0; }
+ }
+
+ // public instance methods
+
+ public string[] GetGroupNames () {
+ string[] names = new string[mapping.Count];
+ mapping.Keys.CopyTo (names, 0);
+
+ return names;
+ }
+
+ public int[] GetGroupNumbers () {
+ int[] numbers = new int[mapping.Count];
+ mapping.Values.CopyTo (numbers, 0);
+
+ return numbers;
+ }
+
+ public string GroupNameFromNumber (int i) {
+ if (i >= group_count)
+ return "";
+
+ foreach (string name in mapping.Keys) {
+ if ((int)mapping[name] == i)
+ return name;
+ }
+
+ return "";
+ }
+
+ public int GroupNumberFromName (string name) {
+ if (mapping.Contains (name))
+ return (int)mapping[name];
+
+ return -1;
+ }
+
+ // match methods
+
+ public bool IsMatch (string input) {
+ return IsMatch (input, 0);
+ }
+
+ public bool IsMatch (string input, int startat) {
+ return Match (input, startat).Success;
+ }
+
+ public Match Match (string input) {
+ return Match (input, 0);
+ }
+
+ public Match Match (string input, int startat) {
+ return CreateMachine ().Scan (this, input, startat, input.Length);
+ }
+
+ public Match Match (string input, int startat, int length) {
+ return CreateMachine ().Scan (this, input, startat, startat + length);
+ }
+
+ public MatchCollection Matches (string input) {
+ return Matches (input, 0);
+ }
+
+ public MatchCollection Matches (string input, int startat) {
+ MatchCollection ms = new MatchCollection ();
+ Match m = Match (input, startat);
+ while (m.Success) {
+ ms.Add (m);
+ m = m.NextMatch ();
+ }
+
+ return ms;
+ }
+
+ // replace methods
+
+ public string Replace (string input, MatchEvaluator evaluator) {
+ return Replace (input, evaluator, Int32.MaxValue, 0);
+ }
+
+ public string Replace (string input, MatchEvaluator evaluator, int count) {
+ return Replace (input, evaluator, count, 0);
+ }
+
+ public string Replace (string input, MatchEvaluator evaluator, int count, int startat)
+ {
+ StringBuilder result = new StringBuilder ();
+ int ptr = startat;
+
+ Match m = Match (input, startat);
+ while (m.Success && count -- > 0) {
+ result.Append (input.Substring (ptr, m.Index - ptr));
+ result.Append (evaluator (m));
+
+ ptr = m.Index + m.Length;
+ m = m.NextMatch ();
+ }
+ result.Append (input.Substring (ptr));
+
+ return result.ToString ();
+ }
+
+ public string Replace (string input, string replacement) {
+ return Replace (input, replacement, Int32.MaxValue, 0);
+ }
+
+ public string Replace (string input, string replacement, int count) {
+ return Replace (input, replacement, count, 0);
+ }
+
+ public string Replace (string input, string replacement, int count, int startat) {
+ ReplacementEvaluator ev = new ReplacementEvaluator (this, replacement);
+ return Replace (input, new MatchEvaluator (ev.Evaluate), count, startat);
+ }
+
+ // split methods
+
+ public string[] Split (string input) {
+ return Split (input, Int32.MaxValue, 0);
+ }
+
+ public string[] Split (string input, int count) {
+ return Split (input, count, 0);
+ }
+
+ public string[] Split (string input, int count, int startat) {
+ ArrayList splits = new ArrayList ();
+ if (count == 0)
+ count = Int32.MaxValue;
+
+ int ptr = startat;
+ while (count -- > 0) {
+ Match m = Match (input, ptr);
+ if (!m.Success)
+ break;
+
+ splits.Add (input.Substring (ptr, m.Index - ptr));
+ ptr = m.Index + m.Length;
+ }
+
+ if (count > 0)
+ splits.Add (input.Substring (ptr));
+
+ string[] result = new string[splits.Count];
+ splits.CopyTo (result);
+ return result;
+ }
+
+ // object methods
+
+ public override string ToString () {
+ return pattern;
+ }
+
+ // ISerializable interface
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context) {
+ info.AddValue ("pattern", this.ToString (), typeof (string));
+ info.AddValue ("options", this.Options, typeof (RegexOptions));
+ }
+
+ // internal
+
+ internal int GroupCount {
+ get { return group_count; }
+ }
+
+ // private
+
+ private IMachine CreateMachine () {
+ return factory.NewInstance ();
+ }
+
+ protected internal string pattern;
+ private RegexOptions options;
+
+ private IMachineFactory factory;
+ private IDictionary mapping;
+ private int group_count;
+ }
+
+ [Serializable]
+ public class RegexCompilationInfo {
+ public RegexCompilationInfo (string pattern, RegexOptions options, string name, string full_namespace, bool is_public) {
+ this.pattern = pattern;
+ this.options = options;
+ this.name = name;
+ this.full_namespace = full_namespace;
+ this.is_public = is_public;
+ }
+
+ public bool IsPublic {
+ get { return is_public; }
+ set { is_public = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string Namespace {
+ get { return full_namespace; }
+ set { full_namespace = value; }
+ }
+
+ public RegexOptions Options {
+ get { return options; }
+ set { options = value; }
+ }
+
+ public string Pattern {
+ get { return pattern; }
+ set { pattern = value; }
+ }
+
+ // private
+
+ private string pattern, name, full_namespace;
+ private RegexOptions options;
+ private bool is_public;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/replace.cs b/mcs/class/System/System.Text.RegularExpressions/replace.cs
new file mode 100644
index 00000000000..88b99f394bc
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/replace.cs
@@ -0,0 +1,181 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: replace.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Text;
+using System.Collections;
+
+using Parser = System.Text.RegularExpressions.Syntax.Parser;
+
+namespace System.Text.RegularExpressions {
+
+ class ReplacementEvaluator {
+ public static string Evaluate (string replacement, Match match) {
+ ReplacementEvaluator ev = new ReplacementEvaluator (match.Regex, replacement);
+ return ev.Evaluate (match);
+ }
+
+ public ReplacementEvaluator (Regex regex, string replacement) {
+ this.regex = regex;
+ terms = new ArrayList ();
+ Compile (replacement);
+ }
+
+ public string Evaluate (Match match) {
+ StringBuilder result = new StringBuilder ();
+ foreach (Term term in terms)
+ result.Append (term.GetResult (match));
+
+ return result.ToString ();
+ }
+
+ // private
+
+ private void Compile (string replacement) {
+ replacement = Parser.Unescape (replacement);
+ string literal = "";
+
+ int ptr = 0;
+ char c;
+ Term term = null;
+ while (ptr < replacement.Length) {
+ c = replacement[ptr ++];
+
+ if (c == '$') {
+ if (replacement[ptr] == '$') {
+ ++ ptr;
+ break;
+ }
+
+ term = CompileTerm (replacement, ref ptr);
+ }
+
+ if (term != null) {
+ term.Literal = literal;
+ terms.Add (term);
+
+ term = null;
+ literal = "";
+ }
+ else
+ literal += c;
+ }
+
+ if (term == null && literal.Length > 0) {
+ terms.Add (new Term (literal));
+ }
+ }
+
+ private Term CompileTerm (string str, ref int ptr) {
+ char c = str[ptr];
+
+ if (Char.IsDigit (c)) { // numbered group
+ int n = Parser.ParseDecimal (str, ref ptr);
+ if (n < 0 || n > regex.GroupCount)
+ throw new ArgumentException ("Bad group number.");
+
+ return new Term (TermOp.Match, n);
+ }
+
+ ++ ptr;
+
+ switch (c) {
+ case '{': { // named group
+ string name = Parser.ParseName (str, ref ptr);
+ if (str[ptr ++] != '}' || name == null)
+ throw new ArgumentException ("Bad group name.");
+
+ int n = regex.GroupNumberFromName (name);
+
+ if (n < 0)
+ throw new ArgumentException ("Bad group name.");
+
+ return new Term (TermOp.Match, n);
+ }
+
+ case '&': // entire match
+ return new Term (TermOp.Match, 0);
+
+ case '`': // text before match
+ return new Term (TermOp.PreMatch, 0);
+
+ case '\'': // text after match
+ return new Term (TermOp.PostMatch, 0);
+
+ case '+': // last group
+ return new Term (TermOp.Match, regex.GroupCount - 1);
+
+ case '_': // entire text
+ return new Term (TermOp.All, 0);
+
+ default:
+ throw new ArgumentException ("Bad replacement pattern.");
+ }
+ }
+
+ private Regex regex;
+ private ArrayList terms;
+
+ private enum TermOp {
+ None, // no action
+ Match, // input within group
+ PreMatch, // input before group
+ PostMatch, // input after group
+ All // entire input
+ }
+
+ private class Term {
+ public Term (TermOp op, int arg) {
+ this.op = op;
+ this.arg = arg;
+ this.literal = "";
+ }
+
+ public Term (string literal) {
+ this.op = TermOp.None;
+ this.arg = 0;
+ this.literal = literal;
+ }
+
+ public string Literal {
+ set { literal = value; }
+ }
+
+ public string GetResult (Match match) {
+ Group group = match.Groups[arg];
+
+ switch (op) {
+ case TermOp.None:
+ return literal;
+
+ case TermOp.Match:
+ return literal + group.Value;
+
+ case TermOp.PreMatch:
+ return literal + group.Text.Substring (0, group.Index);
+
+ case TermOp.PostMatch:
+ return literal + group.Text.Substring (group.Index + group.Length);
+
+ case TermOp.All:
+ return literal + group.Text;
+ }
+
+ return "";
+ }
+
+ public TermOp op; // term type
+ public int arg; // group argument
+ public string literal; // literal to prepend
+
+ public override string ToString () {
+ return op.ToString () + "(" + arg + ") " + literal;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/syntax.cs b/mcs/class/System/System.Text.RegularExpressions/syntax.cs
new file mode 100644
index 00000000000..f0d0bc4ef78
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/syntax.cs
@@ -0,0 +1,976 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: syntax.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions.Syntax {
+ // collection classes
+
+ class ExpressionCollection : CollectionBase {
+ public void Add (Expression e) {
+ List.Add (e);
+ }
+
+ public Expression this[int i] {
+ get { return (Expression)List[i]; }
+ set { List[i] = value; }
+ }
+
+ protected override void OnValidate (object o) {
+ // allow null elements
+ }
+ }
+
+ // abstract classes
+
+ abstract class Expression {
+ public abstract void Compile (ICompiler cmp, bool reverse);
+ public abstract void GetWidth (out int min, out int max);
+
+ public int GetFixedWidth () {
+ int min, max;
+ GetWidth (out min, out max);
+
+ if (min == max)
+ return min;
+
+ return -1;
+ }
+
+ public virtual AnchorInfo GetAnchorInfo () {
+ return new AnchorInfo (this, GetFixedWidth ());
+ }
+
+ public virtual bool IsComplex () {
+ return true;
+ }
+ }
+
+ // composite expressions
+
+ abstract class CompositeExpression : Expression {
+ public CompositeExpression () {
+ expressions = new ExpressionCollection ();
+ }
+
+ protected ExpressionCollection Expressions {
+ get { return expressions; }
+ }
+
+ protected void GetWidth (out int min, out int max, int count) {
+ min = Int32.MaxValue;
+ max = 0;
+ bool empty = true;
+
+ for (int i = 0; i < count; ++ i) {
+ Expression e = Expressions[i];
+ if (e == null)
+ continue;
+
+ empty = false;
+ int a, b;
+ e.GetWidth (out a, out b);
+ if (a < min) min = a;
+ if (b > max) max = b;
+ }
+
+ if (empty)
+ min = max = 0;
+ }
+
+ private ExpressionCollection expressions;
+ }
+
+ // groups
+
+ class Group : CompositeExpression {
+ public Group () {
+ }
+
+ public Expression Expression {
+ get { return Expressions[0]; }
+ set { Expressions[0] = value; }
+ }
+
+ public void AppendExpression (Expression e) {
+ Expressions.Add (e);
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ int count = Expressions.Count;
+ for (int i = 0; i < count; ++ i) {
+ Expression e;
+ if (reverse)
+ e = Expressions[count - i - 1];
+ else
+ e = Expressions[i];
+
+ e.Compile (cmp, reverse);
+ }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = 0;
+ max = 0;
+
+ foreach (Expression e in Expressions) {
+ int a, b;
+ e.GetWidth (out a, out b);
+ min += a;
+ if (max == Int32.MaxValue || b == Int32.MaxValue)
+ max = Int32.MaxValue;
+ else
+ max += b;
+ }
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ int ptr;
+ int width = GetFixedWidth ();
+
+ ArrayList infos = new ArrayList ();
+ IntervalCollection segments = new IntervalCollection ();
+
+ // accumulate segments
+
+ ptr = 0;
+ foreach (Expression e in Expressions) {
+ AnchorInfo info = e.GetAnchorInfo ();
+ infos.Add (info);
+
+ if (info.IsPosition)
+ return new AnchorInfo (this, ptr + info.Offset, width, info.Position);
+
+ if (info.IsSubstring)
+ segments.Add (info.GetInterval (ptr));
+
+ if (info.IsUnknownWidth)
+ break;
+
+ ptr += info.Width;
+ }
+
+ // normalize and find the longest segment
+
+ segments.Normalize ();
+
+ Interval longest = Interval.Empty;
+ foreach (Interval segment in segments) {
+ if (segment.Size > longest.Size)
+ longest = segment;
+ }
+
+ // now chain the substrings that made this segment together
+
+ if (!longest.IsEmpty) {
+ string str = "";
+ bool ignore = false;
+
+ ptr = 0;
+ foreach (AnchorInfo info in infos) {
+ if (info.IsSubstring && longest.Contains (info.GetInterval (ptr))) {
+ str += info.Substring; // TODO mark subexpressions
+ ignore |= info.IgnoreCase;
+ }
+
+ if (info.IsUnknownWidth)
+ break;
+
+ ptr += info.Width;
+ }
+
+ return new AnchorInfo (this, longest.low, width, str, ignore);
+ }
+
+ return new AnchorInfo (this, width);
+ }
+
+ public override bool IsComplex () {
+ bool comp = false;
+ foreach (Expression e in Expressions) {
+ comp |= e.IsComplex ();
+ }
+
+ return comp | GetFixedWidth () <= 0;
+ }
+ }
+
+ class RegularExpression : Group {
+ public RegularExpression () {
+ group_count = 0;
+ }
+
+ public int GroupCount {
+ get { return group_count; }
+ set { group_count = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ // info block
+
+ int min, max;
+ GetWidth (out min, out max);
+ cmp.EmitInfo (group_count, min, max);
+
+ // anchoring expression
+
+ AnchorInfo info = GetAnchorInfo ();
+ if (reverse)
+ info = new AnchorInfo (this, GetFixedWidth ()); // FIXME
+
+ LinkRef pattern = cmp.NewLink ();
+ cmp.EmitAnchor (info.Offset, pattern);
+
+ if (info.IsPosition)
+ cmp.EmitPosition (info.Position);
+ else if (info.IsSubstring)
+ cmp.EmitString (info.Substring, info.IgnoreCase, reverse);
+
+ cmp.EmitTrue ();
+
+ // pattern
+
+ cmp.ResolveLink (pattern);
+ base.Compile (cmp, reverse);
+ cmp.EmitTrue ();
+ }
+
+ private int group_count;
+ }
+
+ class CapturingGroup : Group {
+ public CapturingGroup () {
+ this.gid = 0;
+ this.name = null;
+ }
+
+ public int Number {
+ get { return gid; }
+ set { gid = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public bool IsNamed {
+ get { return name != null; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ cmp.EmitOpen (gid);
+ base.Compile (cmp, reverse);
+ cmp.EmitClose (gid);
+ }
+
+ public override bool IsComplex () {
+ return true;
+ }
+
+ private int gid;
+ private string name;
+ }
+
+ class BalancingGroup : CapturingGroup {
+ public BalancingGroup () {
+ this.balance = null;
+ }
+
+ public CapturingGroup Balance {
+ get { return balance; }
+ set { balance = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ // can't invoke Group.Compile from here :(
+ // so I'll just repeat the code
+
+ int count = Expressions.Count;
+ for (int i = 0; i < count; ++ i) {
+ Expression e;
+ if (reverse)
+ e = Expressions[count - i - 1];
+ else
+ e = Expressions[i];
+
+ e.Compile (cmp, reverse);
+ }
+
+ cmp.EmitBalance (this.Number, balance.Number);
+ }
+
+ private CapturingGroup balance;
+ }
+
+ class NonBacktrackingGroup : Group {
+ public NonBacktrackingGroup () {
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ LinkRef tail = cmp.NewLink ();
+
+ cmp.EmitSub (tail);
+ base.Compile (cmp, reverse);
+ cmp.EmitTrue ();
+ cmp.ResolveLink (tail);
+ }
+
+ public override bool IsComplex () {
+ return true;
+ }
+ }
+
+ // repetition
+
+ class Repetition : CompositeExpression {
+ public Repetition (int min, int max, bool lazy) {
+ Expressions.Add (null);
+
+ this.min = min;
+ this.max = max;
+ this.lazy = lazy;
+ }
+
+ public Expression Expression {
+ get { return Expressions[0]; }
+ set { Expressions[0] = value; }
+ }
+
+ public int Minimum {
+ get { return min; }
+ set { min = value; }
+ }
+
+ public int Maximum {
+ get { return max; }
+ set { max = value; }
+ }
+
+ public bool Lazy {
+ get { return lazy; }
+ set { lazy = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ if (Expression.IsComplex ()) {
+ LinkRef until = cmp.NewLink ();
+
+ cmp.EmitRepeat (min, max, lazy, until);
+ Expression.Compile (cmp, reverse);
+ cmp.EmitUntil (until);
+ }
+ else {
+ LinkRef tail = cmp.NewLink ();
+
+ cmp.EmitFastRepeat (min, max, lazy, tail);
+ Expression.Compile (cmp, reverse);
+ cmp.EmitTrue ();
+ cmp.ResolveLink (tail);
+ }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ Expression.GetWidth (out min, out max);
+ min = min * this.min;
+ if (max == Int32.MaxValue || this.max == 0xffff)
+ max = Int32.MaxValue;
+ else
+ max = max * this.max;
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ int width = GetFixedWidth ();
+ if (Minimum == 0)
+ return new AnchorInfo (this, width);
+
+ AnchorInfo info = Expression.GetAnchorInfo ();
+ if (info.IsPosition)
+ return new AnchorInfo (this, info.Offset, width, info.Position);
+
+ if (info.IsSubstring) {
+ if (info.IsComplete) {
+ string str = "";
+ for (int i = 0; i < Minimum; ++ i)
+ str += info.Substring;
+
+ return new AnchorInfo (this, 0, width, str, info.IgnoreCase);
+ }
+
+ return new AnchorInfo (this, info.Offset, width, info.Substring, info.IgnoreCase);
+ }
+
+ return new AnchorInfo (this, width);
+ }
+
+ private int min, max;
+ private bool lazy;
+ }
+
+ // assertions
+
+ abstract class Assertion : CompositeExpression {
+ public Assertion () {
+ Expressions.Add (null); // true expression
+ Expressions.Add (null); // false expression
+ }
+
+ public Expression TrueExpression {
+ get { return Expressions[0]; }
+ set { Expressions[0] = value; }
+ }
+
+ public Expression FalseExpression {
+ get { return Expressions[1]; }
+ set { Expressions[1] = value; }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ GetWidth (out min, out max, 2);
+
+ if (TrueExpression == null || FalseExpression == null)
+ min = 0;
+ }
+ }
+
+ class CaptureAssertion : Assertion {
+ public CaptureAssertion () {
+ }
+
+ public CapturingGroup CapturingGroup {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ int gid = group.Number;
+ LinkRef tail = cmp.NewLink ();
+
+ if (FalseExpression == null) {
+ // IfDefined :1
+ // <yes_exp>
+ // 1: <tail>
+
+ cmp.EmitIfDefined (gid, tail);
+ TrueExpression.Compile (cmp, reverse);
+ }
+ else {
+ // IfDefined :1
+ // <yes_expr>
+ // Jump :2
+ // 1: <no_expr>
+ // 2: <tail>
+
+ LinkRef false_expr = cmp.NewLink ();
+ cmp.EmitIfDefined (gid, false_expr);
+ TrueExpression.Compile (cmp, reverse);
+ cmp.EmitJump (tail);
+ cmp.ResolveLink (false_expr);
+ FalseExpression.Compile (cmp, reverse);
+ }
+
+ cmp.ResolveLink (tail);
+ }
+
+ public override bool IsComplex () {
+ bool comp = false;
+ if (TrueExpression != null)
+ comp |= TrueExpression.IsComplex ();
+ if (FalseExpression != null)
+ comp |= FalseExpression.IsComplex ();
+
+ return comp | GetFixedWidth () <= 0;
+ }
+
+ private CapturingGroup group;
+ }
+
+ class ExpressionAssertion : Assertion {
+ public ExpressionAssertion () {
+ Expressions.Add (null); // test expression
+ }
+
+ public bool Reverse {
+ get { return reverse; }
+ set { reverse = value; }
+ }
+
+ public bool Negate {
+ get { return negate; }
+ set { negate = value; }
+ }
+
+ public Expression TestExpression {
+ get { return Expressions[2]; }
+ set { Expressions[2] = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ LinkRef true_expr = cmp.NewLink ();
+ LinkRef false_expr = cmp.NewLink ();
+
+ // test op: positive / negative
+
+ if (!negate)
+ cmp.EmitTest (true_expr, false_expr);
+ else
+ cmp.EmitTest (false_expr, true_expr);
+
+ // test expression: lookahead / lookbehind
+
+ TestExpression.Compile (cmp, reverse ^ this.reverse);
+ cmp.EmitTrue ();
+
+ // target expressions
+
+ if (TrueExpression == null) { // (?= ...)
+ // Test :1, :2
+ // <test_expr>
+ // :2 False
+ // :1 <tail>
+
+ cmp.ResolveLink (false_expr);
+ cmp.EmitFalse ();
+ cmp.ResolveLink (true_expr);
+ }
+ else {
+ cmp.ResolveLink (true_expr);
+ TrueExpression.Compile (cmp, reverse);
+
+ if (FalseExpression == null) { // (?(...) ...)
+ // Test :1, :2
+ // <test_expr>
+ // :1 <yes_expr>
+ // :2 <tail>
+
+ cmp.ResolveLink (false_expr);
+ }
+ else { // (?(...) ... | ...)
+ // Test :1, :2
+ // <test_expr>
+ // :1 <yes_expr>
+ // Jump :3
+ // :2 <no_expr>
+ // :3 <tail>
+
+ LinkRef tail = cmp.NewLink ();
+
+ cmp.EmitJump (tail);
+ cmp.ResolveLink (false_expr);
+ FalseExpression.Compile (cmp, reverse);
+ cmp.ResolveLink (tail);
+ }
+ }
+ }
+
+ private bool reverse, negate;
+ }
+
+ // alternation
+
+ class Alternation : CompositeExpression {
+ public Alternation () {
+ }
+
+ public ExpressionCollection Alternatives {
+ get { return Expressions; }
+ }
+
+ public void AddAlternative (Expression e) {
+ Alternatives.Add (e);
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ LinkRef next = cmp.NewLink ();
+ LinkRef tail = cmp.NewLink ();
+
+ foreach (Expression e in Alternatives) {
+ cmp.EmitBranch (next);
+ e.Compile (cmp, reverse);
+ cmp.EmitJump (tail);
+ cmp.ResolveLink (next);
+ }
+
+ cmp.EmitFalse ();
+ cmp.ResolveLink (tail);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ GetWidth (out min, out max, Alternatives.Count);
+ }
+
+ public override bool IsComplex () {
+ bool comp = false;
+ foreach (Expression e in Alternatives) {
+ comp |= e.IsComplex ();
+ }
+
+ return comp | GetFixedWidth () <= 0;
+ }
+ }
+
+ // terminal expressions
+
+ class Literal : Expression {
+ public Literal (string str, bool ignore) {
+ this.str = str;
+ this.ignore = ignore;
+ }
+
+ public string String {
+ get { return str; }
+ set { str = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ set { ignore = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ if (str.Length == 0)
+ return;
+
+ if (str.Length == 1)
+ cmp.EmitCharacter (str[0], false, ignore, reverse);
+ else
+ cmp.EmitString (str, ignore, reverse);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = max = str.Length;
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ return new AnchorInfo (this, 0, str.Length, str, ignore);
+ }
+
+ public override bool IsComplex () {
+ return false;
+ }
+
+ private string str;
+ private bool ignore;
+ }
+
+ class PositionAssertion : Expression {
+ public PositionAssertion (Position pos) {
+ this.pos = pos;
+ }
+
+ public Position Position {
+ get { return pos; }
+ set { pos = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ cmp.EmitPosition (pos);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = max = 0;
+ }
+
+ public override bool IsComplex () {
+ return false;
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ switch (pos) {
+ case Position.StartOfString: case Position.StartOfLine: case Position.StartOfScan:
+ return new AnchorInfo (this, 0, 0, pos);
+
+ default:
+ return new AnchorInfo (this, 0);
+ }
+ }
+
+ private Position pos;
+ }
+
+ class Reference : Expression {
+ public Reference (bool ignore) {
+ this.ignore = ignore;
+ }
+
+ public CapturingGroup CapturingGroup {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ set { ignore = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ cmp.EmitReference (group.Number, ignore, reverse);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ //group.GetWidth (out min, out max);
+ // TODO set width to referenced group for non-cyclical references
+ min = 0;
+ max = Int32.MaxValue;
+ }
+
+ public override bool IsComplex () {
+ return true; // FIXME incorporate cyclic check
+ }
+
+ private CapturingGroup group;
+ private bool ignore;
+ }
+
+ class CharacterClass : Expression {
+ public CharacterClass (bool negate, bool ignore) {
+ this.negate = negate;
+ this.ignore = ignore;
+
+ intervals = new IntervalCollection ();
+
+ // initialize pos/neg category arrays
+
+ Array cat_values = Enum.GetValues (typeof (Category));
+ int cat_size = (int)(Category)cat_values.GetValue (cat_values.Length - 1) + 1;
+ pos_cats = new bool[cat_size];
+ neg_cats = new bool[cat_size];
+ for (int i = 0; i < cat_size; ++ i) {
+ pos_cats[i] = false;
+ neg_cats[i] = false;
+ }
+ }
+
+ public CharacterClass (Category cat, bool negate) : this (false, false) {
+ this.AddCategory (cat, negate);
+ }
+
+ public bool Negate {
+ get { return negate; }
+ set { negate = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ set { ignore = value; }
+ }
+
+ public void AddCategory (Category cat, bool negate) {
+ int n = (int)cat;
+
+ if (negate) {
+ if (pos_cats[n])
+ pos_cats[n] = false;
+
+ neg_cats[n] = true;
+ }
+ else {
+ if (neg_cats[n])
+ neg_cats[n] = false;
+
+ pos_cats[n] = true;
+ }
+ }
+
+ public void AddCharacter (char c) {
+ intervals.Add (new Interval (c, c));
+ }
+
+ public void AddRange (char lo, char hi) {
+ intervals.Add (new Interval (lo, hi));
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ // create the meta-collection
+
+ IntervalCollection meta =
+ intervals.GetMetaCollection (new IntervalCollection.CostDelegate (GetIntervalCost));
+
+ // count ops
+
+ int count = meta.Count;
+ for (int i = 0; i < pos_cats.Length; ++ i) {
+ if (pos_cats[i]) ++ count;
+ if (neg_cats[i]) ++ count;
+ }
+
+ if (count == 0)
+ return;
+
+ // emit in op for |meta| > 1
+
+ LinkRef tail = cmp.NewLink ();
+ if (count > 1)
+ cmp.EmitIn (tail);
+
+ // emit categories
+
+ for (int i = 0; i < pos_cats.Length; ++ i) {
+ if (pos_cats[i])
+ cmp.EmitCategory ((Category)i, negate, reverse);
+ else if (neg_cats[i])
+ cmp.EmitCategory ((Category)i, !negate, reverse);
+ }
+
+ // emit character/range/sets from meta-collection
+
+ foreach (Interval a in meta) {
+ if (a.IsDiscontiguous) { // Set
+ BitArray bits = new BitArray (a.Size);
+ foreach (Interval b in intervals) {
+ if (a.Contains (b)) {
+ for (int i = b.low; i <= b.high; ++ i)
+ bits[i - a.low] = true;
+ }
+ }
+
+ cmp.EmitSet ((char)a.low, bits, negate, ignore, reverse);
+ }
+ else if (a.IsSingleton) // Character
+ cmp.EmitCharacter ((char)a.low, negate, ignore, reverse);
+ else // Range
+ cmp.EmitRange ((char)a.low, (char)a.high, negate, ignore, reverse);
+ }
+
+ // finish up
+
+ if (count > 1) {
+ if (negate)
+ cmp.EmitTrue ();
+ else
+ cmp.EmitFalse ();
+
+ cmp.ResolveLink (tail);
+ }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = max = 1;
+ }
+
+ public override bool IsComplex () {
+ return false;
+ }
+
+ // private
+
+ private static double GetIntervalCost (Interval i) {
+ // use op length as cost metric (=> optimize for space)
+
+ if (i.IsDiscontiguous)
+ return 3 + ((i.Size + 0xf) >> 4); // Set
+ else if (i.IsSingleton)
+ return 2; // Character
+ else
+ return 3; // Range
+ }
+
+ private bool negate, ignore;
+ private bool[] pos_cats, neg_cats;
+ private IntervalCollection intervals;
+ }
+
+ class AnchorInfo {
+ private Expression expr;
+
+ private Position pos;
+ private int offset;
+
+ private string str;
+ private int width;
+ private bool ignore;
+
+ public AnchorInfo (Expression expr, int width) {
+ this.expr = expr;
+ this.offset = 0;
+ this.width = width;
+
+ this.str = null;
+ this.ignore = false;
+ this.pos = Position.Any;
+ }
+
+ public AnchorInfo (Expression expr, int offset, int width, string str, bool ignore) {
+ this.expr = expr;
+ this.offset = offset;
+ this.width = width;
+
+ this.str = ignore ? str.ToLower () : str;
+
+ this.ignore = ignore;
+ this.pos = Position.Any;
+ }
+
+ public AnchorInfo (Expression expr, int offset, int width, Position pos) {
+ this.expr = expr;
+ this.offset = offset;
+ this.width = width;
+
+ this.pos = pos;
+
+ this.str = null;
+ this.ignore = false;
+ }
+
+ public Expression Expression {
+ get { return expr; }
+ }
+
+ public int Offset {
+ get { return offset; }
+ }
+
+ public int Width {
+ get { return width; }
+ }
+
+ public int Length {
+ get { return (str != null) ? str.Length : 0; }
+ }
+
+ public bool IsUnknownWidth {
+ get { return width < 0; }
+ }
+
+ public bool IsComplete {
+ get { return Length == Width; }
+ }
+
+ public string Substring {
+ get { return str; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ }
+
+ public Position Position {
+ get { return pos; }
+ }
+
+ public bool IsSubstring {
+ get { return str != null; }
+ }
+
+ public bool IsPosition {
+ get { return pos != Position.Any; }
+ }
+
+ public Interval GetInterval () {
+ return GetInterval (0);
+ }
+
+ public Interval GetInterval (int start) {
+ if (!IsSubstring)
+ return Interval.Empty;
+
+ return new Interval (start + Offset, start + Offset + Length - 1);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Threading/ChangeLog b/mcs/class/System/System.Threading/ChangeLog
new file mode 100755
index 00000000000..2f7f43e9fc6
--- /dev/null
+++ b/mcs/class/System/System.Threading/ChangeLog
@@ -0,0 +1,9 @@
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * ThreadExceptionEventArgs.cs: Implemented
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * ThreadExceptionEventArgs.cs, ThreadExceptionEventHandler.cs:
+ More System.Threading stubs, in the System assembly.
+
diff --git a/mcs/class/System/System.Threading/ThreadExceptionEventArgs.cs b/mcs/class/System/System.Threading/ThreadExceptionEventArgs.cs
new file mode 100755
index 00000000000..002324fe2db
--- /dev/null
+++ b/mcs/class/System/System.Threading/ThreadExceptionEventArgs.cs
@@ -0,0 +1,27 @@
+//
+// System.Threading.ThreadExceptionEventArgs.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public class ThreadExceptionEventArgs : EventArgs
+ {
+ private Exception exception;
+
+ public ThreadExceptionEventArgs(Exception t) {
+ exception=t;
+ }
+
+ public Exception Exception {
+ get {
+ return(exception);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Threading/ThreadExceptionEventHandler.cs b/mcs/class/System/System.Threading/ThreadExceptionEventHandler.cs
new file mode 100755
index 00000000000..6f47d2bdd96
--- /dev/null
+++ b/mcs/class/System/System.Threading/ThreadExceptionEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.ThreadExceptionEventHandler.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void ThreadExceptionEventHandler(object sender, ThreadExceptionEventArgs e);
+}
diff --git a/mcs/class/System/System.Timers/ChangeLog b/mcs/class/System/System.Timers/ChangeLog
new file mode 100644
index 00000000000..bbfd5e59eb8
--- /dev/null
+++ b/mcs/class/System/System.Timers/ChangeLog
@@ -0,0 +1,10 @@
+2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog:
+ * ElapsedEventArgs.cs:
+ * ElapsedEventHandler.cs:
+ * Timer.cs:
+ * TimersDescriptionAttribute.cs: New files.
+
+ Don't use timers yet. If you do, your program will never end.
+
diff --git a/mcs/class/System/System.Timers/ElapsedEventArgs.cs b/mcs/class/System/System.Timers/ElapsedEventArgs.cs
new file mode 100644
index 00000000000..6f14eb7f0ab
--- /dev/null
+++ b/mcs/class/System/System.Timers/ElapsedEventArgs.cs
@@ -0,0 +1,29 @@
+//
+// System.Timers.ElapsedEventArgs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Timers
+{
+ public class ElapsedEventArgs : EventArgs
+ {
+ DateTime time;
+
+ internal ElapsedEventArgs (DateTime time)
+ {
+ this.time = time;
+ }
+
+ public DateTime SignalTime
+ {
+ get { return time; }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Timers/ElapsedEventHandler.cs b/mcs/class/System/System.Timers/ElapsedEventHandler.cs
new file mode 100644
index 00000000000..6a30f6a266e
--- /dev/null
+++ b/mcs/class/System/System.Timers/ElapsedEventHandler.cs
@@ -0,0 +1,17 @@
+//
+// System.Timers.ElapsedEventHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Timers
+{
+ [Serializable]
+ public delegate void ElapsedEventHandler (object sender, ElapsedEventArgs e);
+}
+
diff --git a/mcs/class/System/System.Timers/Timer.cs b/mcs/class/System/System.Timers/Timer.cs
new file mode 100644
index 00000000000..56bcaa7dbda
--- /dev/null
+++ b/mcs/class/System/System.Timers/Timer.cs
@@ -0,0 +1,172 @@
+//
+// System.Timers.Timer
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+// The docs talk about server timers and such...
+
+using System;
+using System.ComponentModel;
+using System.Threading;
+
+namespace System.Timers
+{
+ [DefaultEventAttribute("Elapsed")]
+ [DefaultProperty("Interval")]
+ public class Timer : Component, ISupportInitialize
+ {
+ bool autoReset;
+ bool enabled;
+ double interval;
+ ISynchronizeInvoke so;
+ ManualResetEvent wait;
+
+ [TimersDescription("Occurs when the Interval has elapsed.")]
+ public ElapsedEventHandler Elapsed;
+
+ public Timer () : this (100)
+ {
+ }
+
+ public Timer (double interval)
+ {
+ autoReset = true;
+ enabled = false;
+ Interval = interval;
+ so = null;
+ wait = null;
+ }
+
+
+ [DefaultValue(true)]
+ [TimersDescription("Indicates whether the timer will be restarted when it is enabled.")]
+ public bool AutoReset
+ {
+ get { return autoReset; }
+ set { autoReset = value; }
+ }
+
+ [DefaultValue(false)]
+ [TimersDescription("Indicates whether the timer is enabled to fire events at a defined interval.")]
+ public bool Enabled
+ {
+ get { return enabled; }
+ set {
+ if (enabled == value)
+ return;
+
+ enabled = value;
+ if (value) {
+ // May be we can use ThreadPool for these once i figure out how to finalize
+ // the ThreadPool main thread on program termination.
+ Thread t = new Thread (new ThreadStart (StartTimer));
+ t.Start ();
+ } else {
+ StopTimer ();
+ }
+ }
+ }
+
+ [DefaultValue(100)]
+ [RecommendedAsConfigurable(true)]
+ [TimersDescription( "The number of milliseconds between timer events.")]
+ public double Interval
+ {
+ get { return interval; }
+ set {
+ // The doc says 'less than 0', but 0 also throws the exception
+ if (value <= 0)
+ throw new ArgumentException ("Invalid value: " + interval, "interval");
+
+ interval = value;
+ }
+ }
+
+ public override ISite Site
+ {
+ get { return base.Site; }
+ set { base.Site = value; }
+ }
+
+ [DefaultValue(null)]
+ [TimersDescriptionAttribute("The object used to marshal the event handler calls issued " +
+ "when an interval has elapsed.")]
+ public ISynchronizeInvoke SynchronizingObject
+ {
+ get { return so; }
+ set { so = value; }
+ }
+
+ public void BeginInit ()
+ {
+ // Nothing to do
+ }
+
+ public void Close ()
+ {
+ StopTimer ();
+ }
+
+ public void EndInit ()
+ {
+ // Nothing to do
+ }
+
+ public void Start ()
+ {
+ Enabled = true;
+ }
+
+ public void Stop ()
+ {
+ Enabled = false;
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ Close ();
+ base.Dispose (disposing);
+ }
+
+ static void Callback (object state)
+ {
+ Timer timer = (Timer) state;
+ if (timer.autoReset == false)
+ timer.enabled = false;
+
+ if (timer.Elapsed == null)
+ return;
+
+ ElapsedEventArgs arg = new ElapsedEventArgs (DateTime.Now);
+
+ if (timer.so != null && timer.so.InvokeRequired) {
+ timer.so.BeginInvoke (timer.Elapsed, new object [2] {timer, arg});
+ } else {
+ timer.Elapsed (timer, arg);
+ }
+ }
+
+ void StartTimer ()
+ {
+ wait = new ManualResetEvent (false);
+
+ WaitCallback wc = new WaitCallback (Callback);
+ while (enabled && wait.WaitOne ((int) interval, false) == false)
+ ThreadPool.QueueUserWorkItem (wc, this);
+
+ wc = null;
+ ((IDisposable) wait).Dispose ();
+ wait = null;
+ }
+
+ void StopTimer ()
+ {
+ if (wait != null)
+ wait.Set ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Timers/TimersDescriptionAttribute.cs b/mcs/class/System/System.Timers/TimersDescriptionAttribute.cs
new file mode 100644
index 00000000000..ed245603abd
--- /dev/null
+++ b/mcs/class/System/System.Timers/TimersDescriptionAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Timers.TimersDescriptionAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Timers
+{
+ [AttributeUsage(AttributeTargets.All)]
+ public class TimersDescriptionAttribute : DescriptionAttribute
+ {
+ public TimersDescriptionAttribute (string description)
+ : base (description)
+ {
+ }
+
+ public override string Description
+ {
+ get {
+ return base.Description;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.build b/mcs/class/System/System.build
new file mode 100644
index 00000000000..2473c69866e
--- /dev/null
+++ b/mcs/class/System/System.build
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+
+ <!-- cor compare dies with these currently -->
+ <!--arg value="/nostdlib"/--> <!-- don't reference mscorlib -->
+ <!--arg value="/r:corlib.dll"/-->
+ <arg value="/r:System.Xml.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="System.CodeDom/Code-X-Collection.cs"/>
+ <excludes name="System.Net/IAuthenticationModule.cs"/>
+ <excludes name="System.Net/AuthenticationManager.cs"/>
+ </sources>
+ </csc>
+ <copy file="../lib/System.dll" tofile="Test/System.dll"/>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System/System/ChangeLog b/mcs/class/System/System/ChangeLog
new file mode 100644
index 00000000000..208a463d433
--- /dev/null
+++ b/mcs/class/System/System/ChangeLog
@@ -0,0 +1,53 @@
+2002-09-16 Duncan Mak <duncan@ximian.com>
+
+ * Uri.cs (GetObjectData):
+ (Uri): The key should be "AbsoluteUri", not "Uri".
+
+2002-09-16 Miguel de Icaza <miguel@ximian.com>
+
+ * Uri.cs: Implemented a few of the protected methods.
+
+Mon Jun 17 15:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Uri.cs: workaround for mcs bug.
+
+2002-05-28 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Uri.cs: Implemented ctor UriTest (baseUri, relativeUri)
+ * Uri.cs: Fixed bug in internal method GetSchemeDelimiter
+
+2002-05-22 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Uri.cs: implemented MakeRelative, improved GetLeftPart
+ * UriBuilder.cs: removed Serializable attribute
+ * UriHostNameType.cs: added Basic
+
+2002-05-12 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Uri.LocalPath and Uri.AbsoluteUri modified to support both w32
+ and *nix filepaths
+
+2002-05-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Uri.GetLeftPart fixed for mailto and news schemes.
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * UriBuilder.cs: Implemented.
+
+ * Uri.cs: Complete new reimplementation.
+
+2002-02-08 Duncan Mak <duncan@ximian.com>
+
+ * UriFormatException.cs: Removed TODO attribute, the docs are
+ probably wrong here. In any case, this code compiles and should work.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * UriFormatException.cs: Added bits for serialization.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ChangeLog : Add to this directory.
+
+ * Uri.cs, UriFormatException.cs : Decorate bits with MonoTODO attribute.
diff --git a/mcs/class/System/System/TODOAttribute.cs b/mcs/class/System/System/TODOAttribute.cs
new file mode 100644
index 00000000000..e14b61a2649
--- /dev/null
+++ b/mcs/class/System/System/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System/System/Uri.cs b/mcs/class/System/System/Uri.cs
new file mode 100755
index 00000000000..219f865a398
--- /dev/null
+++ b/mcs/class/System/System/Uri.cs
@@ -0,0 +1,850 @@
+//
+// System.Uri
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+// Author:
+// Garrett Rooney (rooneg@electricjellyfish.net)
+//
+// (C) 2001 Garrett Rooney
+//
+
+using System.Net;
+using System.Runtime.Serialization;
+using System.Text;
+
+// See RFC 2396 for more info on URI's.
+
+// TODO: optimize by parsing host string only once
+
+namespace System
+{
+ [Serializable]
+ public class Uri : MarshalByRefObject, ISerializable
+ {
+ // NOTES:
+ // o scheme excludes the scheme delimiter
+ // o port is -1 to indicate no port is defined
+ // o path is empty or starts with / when scheme delimiter == "://"
+ // o query is empty or starts with ? char
+ // o fragment is empty or starts with # char
+ // o all class variables are in escaped format when they are escapable,
+ // except cachedToString.
+
+ private string scheme = String.Empty;
+ private string host = String.Empty;
+ private int port = -1;
+ private string path = String.Empty;
+ private string query = String.Empty;
+ private string fragment = String.Empty;
+ private string userinfo = String.Empty;
+
+ private bool userEscaped = false;
+ private string cachedAbsoluteUri = null;
+ private string cachedToString = null;
+ private int cachedHashCode = 0;
+
+ private static readonly string hexUpperChars = "0123456789ABCDEF";
+
+ // Fields
+
+ public static readonly string SchemeDelimiter = "://";
+ public static readonly string UriSchemeFile = "file";
+ public static readonly string UriSchemeFtp = "ftp";
+ public static readonly string UriSchemeGopher = "gopher";
+ public static readonly string UriSchemeHttp = "http";
+ public static readonly string UriSchemeHttps = "https";
+ public static readonly string UriSchemeMailto = "mailto";
+ public static readonly string UriSchemeNews = "news";
+ public static readonly string UriSchemeNntp = "nntp";
+
+ // Constructors
+
+ public Uri (string uriString) : this (uriString, false)
+ {
+ }
+
+ protected Uri (SerializationInfo serializationInfo,
+ StreamingContext streamingContext) :
+ this (serializationInfo.GetString ("AbsoluteUri"), true)
+ {
+ }
+
+ public Uri (string uriString, bool dontEscape)
+ {
+ userEscaped = dontEscape;
+ Parse (uriString);
+
+ if (userEscaped)
+ return;
+
+ host = EscapeString (host, false, true, false);
+ path = EscapeString (path);
+ query = EscapeString (query);
+ fragment = EscapeString (fragment, false, false, true);
+ }
+
+ public Uri (Uri baseUri, string relativeUri)
+ : this (baseUri, relativeUri, false)
+ {
+ }
+
+ public Uri (Uri baseUri, string relativeUri, bool dontEscape)
+ {
+ // See RFC 2396 Par 5.2 and Appendix C
+
+ userEscaped = dontEscape;
+
+ this.scheme = baseUri.scheme;
+ this.host = baseUri.host;
+ this.port = baseUri.port;
+ this.userinfo = baseUri.userinfo;
+
+ if (relativeUri == null)
+ throw new NullReferenceException ("relativeUri");
+
+ if (relativeUri == String.Empty) {
+ this.path = baseUri.path;
+ this.query = baseUri.query;
+ this.fragment = baseUri.fragment;
+ return;
+ }
+
+ int pos = relativeUri.IndexOf (':');
+ if (pos != -1) {
+ int pos2 = relativeUri.IndexOfAny (new char [] {'/', '\\'});
+ if (pos2 > pos) {
+ // equivalent to new Uri (relativeUri, dontEscape)
+ Parse (relativeUri);
+
+ if (userEscaped)
+ return;
+
+ host = EscapeString (host, false, true, false);
+ path = EscapeString (path);
+ query = EscapeString (query);
+ fragment = EscapeString (fragment, false, false, true);
+ return;
+ }
+ }
+
+ // 8 fragment
+ pos = relativeUri.IndexOf ('#');
+ if (pos != -1) {
+ fragment = relativeUri.Substring (pos);
+ if (!userEscaped)
+ fragment = EscapeString (fragment, false, false, true);
+ relativeUri = relativeUri.Substring (0, pos);
+ }
+
+ // 6 query
+ pos = relativeUri.IndexOf ('?');
+ if (pos != -1) {
+ query = relativeUri.Substring (pos);
+ if (!userEscaped)
+ query = EscapeString (query);
+ relativeUri = relativeUri.Substring (0, pos);
+ }
+
+ if (relativeUri[0] == '/') {
+ path = relativeUri;
+ if (!userEscaped)
+ path = EscapeString (path);
+ return;
+ }
+
+ // par 5.2 step 6 a)
+ path = baseUri.path;
+ pos = path.LastIndexOf ('/');
+ if (pos > 0)
+ path = path.Substring (0, pos + 1);
+
+ // 6 b)
+ path += relativeUri;
+
+ // 6 c)
+ int startIndex = 0;
+ while (true) {
+ pos = path.IndexOf ("./", startIndex);
+ if (pos == -1)
+ break;
+ if (pos == 0)
+ path = path.Remove (0, 2);
+ else if (path [pos - 1] != '.')
+ path = path.Remove (pos, 2);
+ else
+ startIndex = pos + 1;
+ }
+
+ // 6 d)
+ if (path.Length > 1 &&
+ path [path.Length - 1] == '.' &&
+ path [path.Length - 2] == '/')
+ path = path.Remove (path.Length - 1, 1);
+
+ // 6 e)
+ startIndex = 0;
+ while (true) {
+ pos = path.IndexOf ("/../", startIndex);
+ if (pos == -1)
+ break;
+ if (pos == 0) {
+ startIndex = 3;
+ continue;
+ }
+ int pos2 = path.LastIndexOf ('/', pos - 1);
+ if (pos2 == -1) {
+ startIndex = pos + 1;
+ } else {
+ if (path.Substring (pos2 + 1, pos - pos2 - 1) != "..")
+ path = path.Remove (pos2 + 1, pos - pos2 + 3);
+ else
+ startIndex = pos + 1;
+ }
+ }
+
+ // 6 f)
+ if (path.Length > 3 && path.EndsWith ("/..")) {
+ pos = path.LastIndexOf ('/', path.Length - 4);
+ Console.WriteLine ("6f " + pos);
+ if (pos != -1)
+ if (path.Substring (pos + 1, path.Length - pos - 4) != "..")
+ path = path.Remove (pos + 1, path.Length - pos - 1);
+ }
+
+ if (!userEscaped)
+ path = EscapeString (path);
+ }
+
+ // Properties
+
+ public string AbsolutePath {
+ get { return path; }
+ }
+
+ public string AbsoluteUri {
+ get {
+ if (cachedAbsoluteUri == null)
+ cachedAbsoluteUri = GetLeftPart (UriPartial.Path) + query + fragment;
+ return cachedAbsoluteUri;
+ }
+ }
+
+ public string Authority {
+ get {
+ return (GetDefaultPort (scheme) == port)
+ ? host : host + ":" + port;
+ }
+ }
+
+ public string Fragment {
+ get { return fragment; }
+ }
+
+ public string Host {
+ get { return host; }
+ }
+
+ public UriHostNameType HostNameType {
+ get { return CheckHostName (host); }
+ }
+
+ public bool IsDefaultPort {
+ get { return GetDefaultPort (scheme) == port; }
+ }
+
+ public bool IsFile {
+ get { return (scheme == UriSchemeFile); }
+ }
+
+ public bool IsLoopback {
+ get {
+ if (host == String.Empty)
+ return false;
+
+ if (host == "loopback" || host == "localhost")
+ return true;
+
+ try {
+ return IPAddress.IsLoopback (IPAddress.Parse (host));
+ } catch (FormatException) {}
+
+ try {
+ return IPv6Address.IsLoopback (IPv6Address.Parse (host));
+ } catch (FormatException) {}
+
+ return false;
+ }
+ }
+
+ public bool IsUnc {
+ get { return (scheme == Uri.UriSchemeFile); }
+ }
+
+ public string LocalPath {
+ get {
+ if (!IsUnc)
+ return path;
+
+ // support *nix and W32 styles
+ if (path.Length > 1 && path [1] == ':')
+ return path.Replace ('/', '\\');
+
+ if (System.IO.Path.DirectorySeparatorChar == '\\')
+ return "\\\\" + host + path.Replace ('/', '\\');
+ else
+ return "/" + host + path;
+ }
+ }
+
+ public string PathAndQuery {
+ get { return path + query; }
+ }
+
+ public int Port {
+ get { return port; }
+ }
+
+ public string Query {
+ get { return query; }
+ }
+
+ public string Scheme {
+ get { return scheme; }
+ }
+
+ public string [] Segments {
+ get {
+ string p = path.EndsWith ("/")
+ ? path.Remove (path.Length - 1, 1)
+ : path;
+ string [] segments = p.Split ('/');
+ int len = segments.Length - 1;
+ for (int i = 0; i < len; i++)
+ segments [i] += '/';
+ if (path.EndsWith ("/"))
+ segments [len] += '/';
+ return segments;
+ }
+ }
+
+ public bool UserEscaped {
+ get { return userEscaped; }
+ }
+
+ public string UserInfo {
+ get { return userinfo; }
+ }
+
+
+ // Methods
+
+ public static UriHostNameType CheckHostName (string name)
+ {
+ if (name == null || name.Length == 0)
+ return UriHostNameType.Unknown;
+
+ if (IsIPv4Address (name))
+ return UriHostNameType.IPv4;
+
+ if (IsDomainAddress (name))
+ return UriHostNameType.Dns;
+
+ try {
+ IPv6Address.Parse (name);
+ return UriHostNameType.IPv6;
+ } catch (FormatException) {}
+
+ return UriHostNameType.Unknown;
+ }
+
+ internal static bool IsIPv4Address (string name)
+ {
+ string [] captures = name.Split (new char [] {'.'});
+ if (captures.Length != 4)
+ return false;
+ for (int i = 0; i < 4; i++) {
+ try {
+ int d = Int32.Parse (captures [i]);
+ if (d < 0 || d > 255)
+ return false;
+ } catch (Exception) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ internal static bool IsDomainAddress (string name)
+ {
+ int len = name.Length;
+
+ if (name [len - 1] == '.')
+ return false;
+
+ int count = 0;
+ for (int i = 0; i < len; i++) {
+ char c = name [i];
+ if (count == 0) {
+ if (!Char.IsLetterOrDigit (c))
+ return false;
+ } else if (c == '.') {
+ count = 0;
+ } else if (!Char.IsLetterOrDigit (c) && c != '-' && c != '_') {
+ return false;
+ }
+ if (++count == 64)
+ return false;
+ }
+
+ return true;
+ }
+
+ public static bool CheckSchemeName (string schemeName)
+ {
+ if (schemeName == null || schemeName.Length == 0)
+ return false;
+
+ if (!Char.IsLetter (schemeName [0]))
+ return false;
+
+ int len = schemeName.Length;
+ for (int i = 1; i < len; i++) {
+ char c = schemeName [i];
+ if (!Char.IsLetterOrDigit (c) || c != ',' || c != '+' || c != '-')
+ return false;
+ }
+
+ return true;
+ }
+
+ public override bool Equals (object comparant)
+ {
+ if (comparant == null)
+ return false;
+
+ Uri uri = comparant as Uri;
+ if (uri == null) {
+ string s = comparant as String;
+ if (s == null)
+ return false;
+ uri = new Uri (s);
+ }
+
+ return ((this.scheme == uri.scheme) &&
+ (this.userinfo == uri.userinfo) &&
+ (this.host == uri.host) &&
+ (this.port == uri.port) &&
+ (this.path == uri.path) &&
+ (this.query == uri.query));
+ }
+
+ public override int GetHashCode ()
+ {
+ if (cachedHashCode == 0)
+ cachedHashCode = scheme.GetHashCode ()
+ + userinfo.GetHashCode ()
+ + host.GetHashCode ()
+ + port
+ + path.GetHashCode ()
+ + query.GetHashCode ();
+ return cachedHashCode;
+ }
+
+ public string GetLeftPart (UriPartial part)
+ {
+ int defaultPort;
+ switch (part) {
+ case UriPartial.Scheme :
+ return scheme + GetSchemeDelimiter (scheme);
+ case UriPartial.Authority :
+ if (host == String.Empty ||
+ scheme == Uri.UriSchemeMailto ||
+ scheme == Uri.UriSchemeNews)
+ return String.Empty;
+
+ StringBuilder s = new StringBuilder ();
+ s.Append (scheme);
+ s.Append (GetSchemeDelimiter (scheme));
+ if (path.Length > 1 && path [1] == ':' && "file".Equals (scheme))
+ s.Append ('/'); // win32 file
+ if (userinfo.Length > 0)
+ s.Append (userinfo).Append ('@');
+ s.Append (host);
+ defaultPort = GetDefaultPort (scheme);
+ if ((port != -1) && (port != defaultPort))
+ s.Append (':').Append (port);
+ return s.ToString ();
+ case UriPartial.Path :
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (scheme);
+ sb.Append (GetSchemeDelimiter (scheme));
+ if (path.Length > 1 && path [1] == ':' && "file".Equals (scheme))
+ sb.Append ('/'); // win32 file
+ if (userinfo.Length > 0)
+ sb.Append (userinfo).Append ('@');
+ sb.Append (host);
+ defaultPort = GetDefaultPort (scheme);
+ if ((port != -1) && (port != defaultPort))
+ sb.Append (':').Append (port);
+ sb.Append (path);
+ return sb.ToString ();
+ }
+ return null;
+ }
+
+ public static int FromHex (char digit)
+ {
+ if ('0' <= digit && digit <= '9') {
+ return (int) (digit - '0');
+ }
+
+ if ('a' <= digit && digit <= 'f')
+ return (int) (digit - 'a' + 10);
+
+ if ('A' <= digit && digit <= 'F')
+ return (int) (digit - 'A' + 10);
+
+ throw new ArgumentException ("digit");
+ }
+
+ public static string HexEscape (char character)
+ {
+ if (character > 255) {
+ throw new ArgumentOutOfRangeException ("character");
+ }
+
+ return "%" + hexUpperChars [((character & 0xf0) >> 4)]
+ + hexUpperChars [((character & 0x0f))];
+ }
+
+ public static char HexUnescape (string pattern, ref int index)
+ {
+ if (pattern == null)
+ throw new ArgumentException ("pattern");
+
+ if (index < 0 || index >= pattern.Length)
+ throw new ArgumentOutOfRangeException ("index");
+
+ if (((index + 3) > pattern.Length) ||
+ (pattern [index] != '%') ||
+ !IsHexDigit (pattern [index + 1]) ||
+ !IsHexDigit (pattern [index + 2]))
+ {
+ return pattern[index++];
+ }
+
+ index++;
+ return (char) ((FromHex (pattern [index++]) << 4) + FromHex (pattern [index++]));
+ }
+
+ public static bool IsHexDigit (char digit)
+ {
+ return (('0' <= digit && digit <= '9') ||
+ ('a' <= digit && digit <= 'f') ||
+ ('A' <= digit && digit <= 'F'));
+ }
+
+ public static bool IsHexEncoding (string pattern, int index)
+ {
+ if ((index + 3) > pattern.Length)
+ return false;
+
+ return ((pattern [index++] == '%') &&
+ IsHexDigit (pattern [index++]) &&
+ IsHexDigit (pattern [index]));
+ }
+
+ public string MakeRelative (Uri toUri)
+ {
+ if ((this.Scheme != toUri.Scheme) ||
+ (this.Authority != toUri.Authority))
+ return toUri.ToString ();
+
+ if (this.path == toUri.path)
+ return String.Empty;
+
+ string [] segments = this.Segments;
+ string [] segments2 = toUri.Segments;
+
+ int k = 0;
+ int max = Math.Max (segments.Length, segments2.Length);
+ for (; k < max; k++)
+ if (segments [k] != segments2 [k])
+ break;
+
+ string result = String.Empty;
+ for (int i = k + 1; i < segments.Length; i++)
+ result += "../";
+ for (int i = k; i < segments2.Length; i++)
+ result += segments2 [i];
+
+ return result;
+ }
+
+ public override string ToString ()
+ {
+ if (cachedToString != null)
+ return cachedToString;
+
+ cachedToString = Unescape (AbsoluteUri);
+
+ return cachedToString;
+ }
+
+ public void GetObjectData (SerializationInfo info,
+ StreamingContext context)
+ {
+ info.AddValue ("AbsoluteUri", this.AbsoluteUri);
+ }
+
+
+ // Internal Methods
+
+ protected static string EscapeString (string str)
+ {
+ return EscapeString (str, false, true, true);
+ }
+
+ internal static string EscapeString (string str, bool escapeReserved, bool escapeHex, bool escapeBrackets)
+ {
+ if (str == null)
+ return String.Empty;
+
+ StringBuilder s = new StringBuilder ();
+ int len = str.Length;
+ for (int i = 0; i < len; i++) {
+ char c = str [i];
+ // reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
+ // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
+ // control = <US-ASCII coded characters 00-1F and 7F hexadecimal>
+ // space = <US-ASCII coded character 20 hexadecimal>
+ // delims = "<" | ">" | "#" | "%" | <">
+ // unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
+
+ if ((c <= 0x20) || (c >= 0x7f) ||
+ ("<>%\"{}|\\^`".IndexOf (c) != -1) ||
+ (escapeHex && (c == '#')) ||
+ (escapeBrackets && (c == '[' || c == ']')) ||
+ (escapeReserved && (";/?:@&=+$,".IndexOf (c) != -1))) {
+ s.Append (HexEscape (c));
+ continue;
+ }
+
+ s.Append (c);
+ }
+
+ return s.ToString ();
+ }
+
+ protected virtual string Unescape (string str)
+ {
+ if (str == null)
+ return String.Empty;
+ StringBuilder s = new StringBuilder ();
+ int len = str.Length;
+ for (int i = 0; i < len; i++) {
+ char c = str [i];
+ if (c == '%') {
+ s.Append (HexUnescape (str, ref i));
+ i--;
+ } else
+ s.Append (c);
+ }
+ return s.ToString ();
+ }
+
+
+ // Private Methods
+
+ // this parse method is as relaxed as possible about the format
+ // it will hardly ever throw a UriFormatException
+ private void Parse (string uriString)
+ {
+ //
+ // From RFC 2396 :
+ //
+ // ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
+ // 12 3 4 5 6 7 8 9
+ //
+
+ if (uriString == null)
+ throw new ArgumentNullException ("uriString");
+
+ int len = uriString.Length;
+ if (len <= 1)
+ throw new UriFormatException ();
+
+ // 1
+ char c = 'x';
+ int pos = 0;
+ for (; pos < len; pos++) {
+ c = uriString [pos];
+ if ((c == ':') || (c == '/') || (c == '\\') || (c == '?') || (c == '#'))
+ break;
+ }
+
+ // 2 scheme
+ if (c == ':') {
+ if (pos == 1) {
+ // a windows filepath
+ scheme = "file";
+ path = uriString.Replace ('\\', '/');
+ return;
+ }
+
+ scheme = uriString.Substring (0, pos).ToLower ();
+ uriString = uriString.Remove (0, pos + 1);
+ } else
+ scheme = "file";
+
+ // 3
+ if ((uriString.Length >= 2) &&
+ ((uriString [0] == '/') || (uriString [0] == '\\')) &&
+ ((uriString [1] == '/') || (uriString [1] == '\\')))
+ if ("file".Equals (scheme))
+ uriString = uriString.TrimStart (new char [] {'/', '\\'});
+ else
+ uriString = uriString.Remove (0, 2);
+
+ // 8 fragment
+ pos = uriString.IndexOf ('#');
+ if (pos != -1) {
+ fragment = uriString.Substring (pos);
+ uriString = uriString.Substring (0, pos);
+ }
+
+ // 6 query
+ pos = uriString.IndexOf ('?');
+ if (pos != -1) {
+ query = uriString.Substring (pos);
+ uriString = uriString.Substring (0, pos);
+ }
+
+ // 5 path
+ pos = uriString.IndexOfAny (new char[] {'/', '\\'});
+ if (pos == -1) {
+ if ((scheme != Uri.UriSchemeMailto) &&
+ (scheme != Uri.UriSchemeNews))
+ path = "/";
+ } else {
+ path = uriString.Substring (pos).Replace ('\\', '/');
+ uriString = uriString.Substring (0, pos);
+ }
+
+ // 4.a user info
+ pos = uriString.IndexOf ("@");
+ if (pos != -1) {
+ userinfo = uriString.Substring (0, pos);
+ uriString = uriString.Remove (0, pos + 1);
+ }
+
+ // 4.b port
+ port = -1;
+ pos = uriString.LastIndexOf (":");
+ if (pos != -1 && pos != (uriString.Length - 1)) {
+ string portStr = uriString.Remove (0, pos + 1);
+ if (portStr.Length > 1 && portStr [portStr.Length - 1] != ']') {
+ try {
+ port = Int32.Parse (portStr);
+ new System.Net.IPEndPoint (0, port); // test validity port
+ uriString = uriString.Substring (0, pos);
+ } catch (Exception) {
+ throw new UriFormatException ("Invalid URI: invalid port number");
+ }
+ }
+ }
+ if (port == -1) {
+ port = GetDefaultPort (scheme);
+ }
+
+ // 4 authority
+ host = uriString;
+ if (host.Length > 1 && host [0] == '[' && host [host.Length - 1] == ']')
+ try {
+ host = "[" + IPv6Address.Parse (host).ToString () + "]";
+ } catch (Exception) {
+ throw new UriFormatException ("Invalid URI: The hostname could not be parsed");
+ }
+ if (host.Length == 2 && host [1] == ':') {
+ // windows filepath
+ path = host + path;
+ host = String.Empty;
+ }
+ }
+
+
+ private struct UriScheme
+ {
+ public string scheme;
+ public string delimiter;
+ public int defaultPort;
+
+ public UriScheme (string s, string d, int p)
+ {
+ scheme = s;
+ delimiter = d;
+ defaultPort = p;
+ }
+ };
+
+ static UriScheme [] schemes = new UriScheme [] {
+ new UriScheme (UriSchemeHttp, SchemeDelimiter, 80),
+ new UriScheme (UriSchemeHttps, SchemeDelimiter, 223),
+ new UriScheme (UriSchemeFtp, SchemeDelimiter, 23),
+ new UriScheme (UriSchemeFile, SchemeDelimiter, -1),
+ new UriScheme (UriSchemeMailto, ":", 25),
+ new UriScheme (UriSchemeNews, ":", -1),
+ new UriScheme (UriSchemeNntp, SchemeDelimiter, 119),
+ new UriScheme (UriSchemeGopher, SchemeDelimiter, 70),
+ };
+
+ internal static string GetSchemeDelimiter (string scheme)
+ {
+ for (int i = 0; i < schemes.Length; i++)
+ if (schemes [i].scheme == scheme)
+ return schemes [i].delimiter;
+ return Uri.SchemeDelimiter;
+ }
+
+ internal static int GetDefaultPort (string scheme)
+ {
+ for (int i = 0; i < schemes.Length; i++)
+ if (schemes [i].scheme == scheme)
+ return schemes [i].defaultPort;
+ return -1;
+ }
+
+ protected virtual bool IsBadFileSystemCharacter (char ch)
+ {
+ foreach (char c in System.IO.Path.InvalidPathChars)
+ if (c == ch)
+ return true;
+ return false;
+ }
+
+
+ protected static bool IsExcludedCharacter (char ch)
+ {
+ if (ch <= 32 || ch >= 127)
+ return true;
+
+ if (ch == '"' || ch == '#' || ch == '%' || ch == '<' ||
+ ch == '>' || ch == '[' || ch == '\\' || ch == ']' ||
+ ch == '^' || ch == '`' || ch == '{' || ch == '|' ||
+ ch == '}')
+ return true;
+ return false;
+ }
+
+ protected virtual bool IsReservedCharacter (char ch)
+ {
+ if (ch == '$' || ch == '&' || ch == '+' || ch == ',' ||
+ ch == '/' || ch == ':' || ch == ';' || ch == '=' ||
+ ch == '@')
+ return true;
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System/System/UriBuilder.cs b/mcs/class/System/System/UriBuilder.cs
new file mode 100644
index 00000000000..241909fef87
--- /dev/null
+++ b/mcs/class/System/System/UriBuilder.cs
@@ -0,0 +1,247 @@
+//
+// System.UriBuilder
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+using System.Text;
+
+// See RFC 2396 for more info on URI's.
+
+namespace System
+{
+ public class UriBuilder
+ {
+ private string scheme;
+ private string host;
+ private int port;
+ private string path;
+ private string query;
+ private string fragment;
+ private string username;
+ private string password;
+
+ private Uri uri;
+ private bool modified;
+
+
+ // Constructors
+
+ public UriBuilder () : this (Uri.UriSchemeHttp, "loopback")
+ {
+ }
+
+ public UriBuilder (string uri) : this (new Uri (uri))
+ {
+ }
+
+ public UriBuilder (Uri uri)
+ {
+ scheme = uri.Scheme;
+ host = uri.Host;
+ port = uri.Port;
+ path = uri.AbsolutePath;
+ query = uri.Query;
+ fragment = uri.Fragment;
+ username = uri.UserInfo;
+ int pos = username.IndexOf (':');
+ if (pos != -1) {
+ password = username.Substring (pos + 1);
+ username = username.Substring (0, pos);
+ }
+ modified = true;
+ }
+
+ public UriBuilder (string schemeName, string hostName)
+ {
+ Scheme = schemeName;
+ Host = hostName;
+ port = -1;
+ Path = String.Empty; // dependent on scheme it may set path to "/"
+ query = String.Empty;
+ fragment = String.Empty;
+ username = String.Empty;
+ password = String.Empty;
+ modified = true;
+ }
+
+ public UriBuilder (string scheme, string host, int portNumber)
+ : this (scheme, host)
+ {
+ Port = portNumber;
+ }
+
+ public UriBuilder (string scheme, string host, int port, string pathValue)
+ : this (scheme, host, port)
+ {
+ Path = pathValue;
+ }
+
+ public UriBuilder (string scheme, string host, int port, string pathValue, string extraValue)
+ : this (scheme, host, port, pathValue)
+ {
+ if (extraValue == null || extraValue.Length == 0)
+ return;
+
+ if (extraValue [0] == '#')
+ Fragment = extraValue.Remove (0, 1);
+ else if (extraValue [0] == '?')
+ Query = extraValue.Remove (0, 1);
+ else
+ throw new ArgumentException ("extraValue");
+ }
+
+
+ // Properties
+
+ public string Fragment {
+ get { return fragment; }
+ set {
+ fragment = value;
+ if (fragment == null)
+ fragment = String.Empty;
+ else if (fragment.Length > 0)
+ fragment = "#" + Uri.EscapeString (fragment, false, true, true).Replace ("%23", "#");
+ query = String.Empty;
+ modified = true;
+ }
+ }
+
+ public string Host {
+ get { return host; }
+ set {
+ host = (value == null) ? String.Empty : value;;
+ modified = true;
+ }
+ }
+
+ public string Password {
+ get { return password; }
+ set {
+ password = (value == null) ? String.Empty : value;;
+ modified = true;
+ }
+ }
+
+ public string Path {
+ get { return path; }
+ set {
+ if (value == null || value.Length == 0) {
+ if ((scheme != Uri.UriSchemeMailto) &&
+ (scheme != Uri.UriSchemeNews))
+ path = "/";
+ } else {
+ path = Uri.EscapeString (value.Replace ('\\', '/'), false, true, true);
+ if ((scheme != Uri.UriSchemeMailto) &&
+ (scheme != Uri.UriSchemeNews) &&
+ path [0] != '/')
+ path = "/" + path;
+ }
+ modified = true;
+ }
+ }
+
+ public int Port {
+ get { return port; }
+ set {
+ if (value == -1) {
+ port = -1;
+ return;
+ }
+
+ // checks whether port number is valid
+ new System.Net.IPEndPoint (0, value);
+
+ // apparently it is
+ port = value;
+ modified = true;
+ }
+ }
+
+ public string Query {
+ get { return query; }
+ set {
+ // LAMESPEC: it doesn't say to always prepend a
+ // question mark to the value.. it does say this
+ // for fragment.
+ query = value;
+ if (query == null)
+ query = String.Empty;
+ else if (query.Length > 0)
+ query = "?" + Uri.EscapeString (query, false, true, true);
+ fragment = String.Empty;
+ modified = true;
+ }
+ }
+
+ public string Scheme {
+ get { return scheme; }
+ set {
+ if (value == null)
+ value = String.Empty;
+ int colonPos = value.IndexOf (':');
+ if (colonPos != -1)
+ value = value.Substring (0, colonPos);
+ scheme = value.ToLower ();
+ modified = true;
+ }
+ }
+
+ public Uri Uri {
+ get {
+ if (!modified)
+ return uri;
+
+ StringBuilder s = new StringBuilder ();
+ s.Append (scheme);
+ s.Append (Uri.GetSchemeDelimiter (scheme));
+ if (username.Length > 0) {
+ string userinfo = username;
+ if (password.Length > 0)
+ userinfo += ":" + password;
+ s.Append (userinfo).Append ('@');
+ }
+ s.Append (host);
+ if (port != -1)
+ s.Append (':').Append (port);
+ s.Append (path);
+ s.Append (query);
+ s.Append (fragment);
+
+ uri = new Uri (s.ToString (), true);
+ modified = false;
+ return uri;
+ }
+ }
+
+ public string UserName {
+ get { return username; }
+ set {
+ username = (value == null) ? String.Empty : value;;
+ modified = true;
+ }
+ }
+
+ // Methods
+
+ public override bool Equals (object rparam)
+ {
+ return (rparam == null) ? false : this.Uri.Equals (rparam.ToString ());
+ }
+
+ public override int GetHashCode ()
+ {
+ return this.Uri.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return this.Uri.ToString ();
+ }
+ }
+}
+
diff --git a/mcs/class/System/System/UriFormatException.cs b/mcs/class/System/System/UriFormatException.cs
new file mode 100755
index 00000000000..8bd1813602f
--- /dev/null
+++ b/mcs/class/System/System/UriFormatException.cs
@@ -0,0 +1,43 @@
+//
+// System.UriFormatException.cs
+//
+// Author:
+// Scott Sanders (scott@stonecobra.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Scott Sanders
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class UriFormatException : FormatException, ISerializable
+ {
+
+ // Constructors
+ public UriFormatException ()
+ : base (Locale.GetText ("Invalid URI format"))
+ {
+ }
+
+ public UriFormatException (string message)
+ : base (message)
+ {
+ }
+
+ protected UriFormatException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // Methods
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System/UriHostNameType.cs b/mcs/class/System/System/UriHostNameType.cs
new file mode 100755
index 00000000000..e2e57d4f33b
--- /dev/null
+++ b/mcs/class/System/System/UriHostNameType.cs
@@ -0,0 +1,41 @@
+// UriHostNameType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:14 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UriHostNameType {
+
+ /// <summary>
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// </summary>
+ Basic = 1,
+
+ /// <summary>
+ /// </summary>
+ Dns = 2,
+
+ /// <summary>
+ /// </summary>
+ IPv4 = 3,
+
+ /// <summary>
+ /// </summary>
+ IPv6 = 4,
+ } // UriHostNameType
+
+} // System
diff --git a/mcs/class/System/System/UriPartial.cs b/mcs/class/System/System/UriPartial.cs
new file mode 100755
index 00000000000..21cb52f8dbe
--- /dev/null
+++ b/mcs/class/System/System/UriPartial.cs
@@ -0,0 +1,33 @@
+// UriPartial.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:21 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UriPartial {
+
+ /// <summary>
+ /// </summary>
+ Scheme = 0,
+
+ /// <summary>
+ /// </summary>
+ Authority = 1,
+
+ /// <summary>
+ /// </summary>
+ Path = 2,
+ } // UriPartial
+
+} // System
diff --git a/mcs/class/System/Test/.cvsignore b/mcs/class/System/Test/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/System/Test/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/System/Test/AllTests.cs b/mcs/class/System/Test/AllTests.cs
new file mode 100644
index 00000000000..7f9965286d3
--- /dev/null
+++ b/mcs/class/System/Test/AllTests.cs
@@ -0,0 +1,35 @@
+// MonoTests.AllTests, System.dll
+//
+// Author:
+// Mario Martinez (mariom925@home.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+namespace MonoTests
+{
+ /// <summary>
+ /// Combines all unit tests for the System.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (System.AllTests.Suite);
+ suite.AddTest (System.Collections.Specialized.AllTests.Suite);
+ suite.AddTest (System.ComponentModel.AllTests.Suite);
+ suite.AddTest (Microsoft.CSharp.AllTests.Suite);
+ suite.AddTest (System.Diagnostics.AllTests.Suite);
+ suite.AddTest (System.Net.AllTests.Suite);
+ suite.AddTest (System.Net.Sockets.AllTests.Suite);
+ suite.AddTest (System.Text.RegularExpressions.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/Test/BasicOperationsTest.cs b/mcs/class/System/Test/BasicOperationsTest.cs
new file mode 100755
index 00000000000..2b078956790
--- /dev/null
+++ b/mcs/class/System/Test/BasicOperationsTest.cs
@@ -0,0 +1,165 @@
+// created on 7/21/2001 at 2:36 PM
+
+
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections.Specialized {
+
+
+ public class BasicOperationsTest : TestCase {
+
+ protected NameValueCollection nvc;
+ private static Random rnd;
+
+ public BasicOperationsTest() : base("MonoTests.System.Collections.Specialized.BasicOperationsTest testsuite") {}
+ public BasicOperationsTest(String name) : base(name) {}
+
+ protected override void SetUp() {
+ nvc = new NameValueCollection();
+ rnd=new Random();
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(BasicOperationsTest));
+ }
+ }
+
+
+
+ private void SetDefaultData() {
+ nvc.Clear();
+ nvc.Add("k1","this");
+ nvc.Add("k2","test");
+ nvc.Add("k3","is");
+ nvc.Add("k4","silly");
+ }
+ private static string FormatForPrinting(NameValueCollection nv)
+ {
+ if (nv==null)
+ return null;
+ int max = nv.Count;
+ StringBuilder sb = new StringBuilder("-\t-Key-\t-Value-\n");
+ for (int i=0; i<max; i++){
+
+ sb.Append("\t"+nv.GetKey(i)+"\t"+nv[i]+"\n");
+ }
+ return sb.ToString();
+ }
+
+
+ public void TestAddRemoveClearSetGet()
+ {
+ nvc.Clear();
+ Assert(nvc.Count==0&& !nvc.HasKeys());
+
+ SetDefaultData();
+ Assert(nvc.Count==4);
+ Assert("Get operation returns wrong result.\n"+FormatForPrinting(nvc),(nvc.Get(0).Equals("this"))&&(nvc.Get("k1").Equals("this")));
+
+
+ nvc.Add("k2","programmer");
+ Assert(nvc["k2"].Equals("test,programmer"));
+
+ nvc["k2"]="project";
+ nvc.Add("k2","project");
+ Assert(nvc.Count==4);
+ Assert("Wrong effect of add(samekey,samevalue)\n"+FormatForPrinting(nvc),nvc["k2"].Equals("project"));
+ // TODO: add Remove test
+ nvc.Remove("k4");
+ Assert("wrong nvc.Count="+nvc.Count,nvc.Count==3);
+ Assert(nvc["k4"]==null);
+
+ NameValueCollection nvc1 = new NameValueCollection();
+ nvc1["k1"]="these";
+ nvc1["k5"]="!";
+ nvc.Add(nvc1);
+ Assert(FormatForPrinting(nvc)+"Count is wrong after Add(nvc1) Count="+nvc.Count,nvc.Count==4);
+ Assert("Values are wrong after Add(nvc1)",(nvc["k1"].Equals("this,these"))&&(nvc["k5"].Equals("!")));
+
+ nvc.Set("k3","accomplished");
+ Assert("Wrong result of Set operation",nvc["k3"].Equals("accomplished"));
+
+ }
+
+ public void TestGetKeyGetValues()
+ {
+ SetDefaultData();
+ Assert(nvc.GetKey(0).Equals("k1"));
+ string[] values = nvc.GetValues(0);
+ Assert(values[0].Equals("this"));
+
+ }
+
+ public void TestCopyTo() {
+ SetDefaultData();
+ string[] entries=new string[nvc.Count];
+ nvc.CopyTo(entries,0);
+ //Message(FormatForPrinting(nvc));
+ //Assert("Not an entry.",entries[0] is DictionaryEntry);
+ }
+
+ public void TestUnderHeavyLoad() {
+
+ //TODO: add memory and time measurement
+
+ nvc.Clear();
+ int max=10000;
+ String[] cache=new String[max*2];
+ int n=0;
+
+ for (int i=0;i<max;i++) {
+ int id=rnd.Next()&0xFFFF;
+ String key=""+id+"-key-"+id;
+ String val="value-"+id;
+ if (nvc[key]==null) {
+ nvc[key]=val;
+ cache[n]=key;
+ cache[n+max]=val;
+ n++;
+ }
+ }
+
+ Assert(nvc.Count==n);
+
+ for (int i=0;i<n;i++) {
+ String key=cache[i];
+ String val=nvc[key] as String;
+ String err="nvc[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+
+ int r1=(n/3);
+ int r2=r1+(n/5);
+
+ for (int i=r1;i<r2;i++) {
+ nvc.Remove(cache[i]);
+ }
+
+
+ for (int i=0;i<n;i++) {
+ if (i>=r1 && i<r2) {
+ Assert(nvc[cache[i]]==null);
+ } else {
+ String key=cache[i];
+ String val=nvc[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+ }
+
+ }
+
+ }
+}
+
diff --git a/mcs/class/System/Test/ChangeLog b/mcs/class/System/Test/ChangeLog
new file mode 100644
index 00000000000..5ba53187af5
--- /dev/null
+++ b/mcs/class/System/Test/ChangeLog
@@ -0,0 +1,118 @@
+2002-12-23 Nick Drochak <ndrochak@gol.com>
+
+ * System_test.build: Fix build. Need to link with System.Xml.dll
+
+2002-12-20 Jonathan Pryor <jonpryor@vt.edu>
+
+ * makefile.gnu: Add System.Xml.dll to list of referenced assemblies
+ * system_linux_test.args: Add System.Xml, new test cases
+ * test-config-file: new file; sample .config file that
+ System.Diagnostics/SwitchesTest.cs would use to test .config file
+ operations.
+ I'm not sure what this file should be named, much less it's proper
+ location. In CVS so it's stored in a "safe" location.
+
+2002-12-08 Jackson Harper <jackson@latitudegeo.com>
+
+ * system_linux_test.args: Remove Compiler tests
+
+2002-11-6 Jackson Harper <jackson@latitudegeo.com>
+
+ * AllTests.cs system_linux_test.args: Added Microsft.CSharp tests
+
+2002-10-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs:
+ * system_linux_test.args: added System.ComponentModel and
+ EventHandlerListTests to the build.
+
+2002-09-17 Nick Drochak <ndrochak@gol.com>
+
+ * TheTests.cs: Removed. Not needed anymore since NUnit runs on linux.
+ * System_test.build: Build a linux version of the unit tests (just a
+ different linking of dll's)
+
+2002/05/17 Lawrence Pit <loz@cable.a2000.nl>
+
+ * AllTests.cs: added call to System.Net.Sockets.AllTests.cs
+
+2002/05/14 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Dnstest.cs: added test for asynchronous methods
+
+2002/05/09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * AllTests.cs: added System.AllTests
+ * Moved 2 files to the System.Collections.Specialized dir
+
+2002/05/07 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Run the System.Net tests from here.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Update build file to run correct class in the test dll.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs:
+ * BasicOperationsTest.cs:
+ * DnsTest.cs:
+ * NameValueCollectionTest.cs:
+ * StringCollectionTest.cs:
+ * TheTests.cs:
+ * System.Text.RegularExpressions/AllTests.cs:
+ * System.Text.RegularExpressions/PerlTest.cs:
+ * System.Text.RegularExpressions/PerlTrials.cs:
+ * System.Text.RegularExpressions/RegexTrial.cs: Fix Namespace
+ inconsistancies. Use MonoTests instead of Ximian.Mono.Tests
+
+2002-04-07 Jonathan Pryor <jonpryor@vt.edu>
+
+ * AllTests.cs: Added System.Diagnostics tests, as they work now.
+
+2002/03/08 Nick Drochak <ndrochak@gol.com>
+
+ * System.XML_test.build: Don't build test dll by default. Only build
+ it when 'make test' is specified.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * System.Text.RegularExpressions/*.cs: Put everything into namespace
+ Ximian.Mono.Tests.System.Text.RegularExpressions.
+
+ * System_test.build: Build new executable RunTests.System.exe which you can
+ use to run the tests on Linux.
+
+ * NameValueCollectionTest.cs: Split out BasicOperationTest into
+ BasicOperationTest.cs.
+
+ * AllTests.cs: Use namespace Ximian.Mono.Tests.System instead of
+ Ximian.Mono.Tests.
+
+ * DnsTest.cs: Put this into namespace Ximian.Mono.Tests.Systeam.
+ * NameValueCollectionTest.cs: Likewise.
+ * StringCollectionTest.cs: Likewise.
+
+2002-02-11 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs: Removed entry for IPHostEntryTest.cs because Mads
+ removed it and included it in the new DnsTest.cs. This fixes the build.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * DnsTest.cs: Updated test.
+
+2001-09-26 Mads Pultz <mpultz@get2net.dk>
+ * DnsTest.cs: initial tests of BeginGetHostByName and EndGetHostByName implemented.
+
+2001-09-24 Mads Pultz <mpultz@get2net.dk>
+
+ * DnsTest.cs: now tests GetHostByAddress, GetHostByName,
+ IpToString and Resolve.
+
+2001-09-23 Mads Pultz <mpultz@get2net.dk>
+
+ * DnsTest.cs: Initial work submitted to repository.
+ * IPHostEntryTest.cs: Initial work submitted to repository.
+
diff --git a/mcs/class/System/Test/Microsoft.CSharp/AllTests.cs b/mcs/class/System/Test/Microsoft.CSharp/AllTests.cs
new file mode 100644
index 00000000000..c355c25dbc0
--- /dev/null
+++ b/mcs/class/System/Test/Microsoft.CSharp/AllTests.cs
@@ -0,0 +1,30 @@
+//
+// MonoTests.Microsoft.CSharp.AllTests
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.CSharp {
+
+ public class AllTests : TestCase
+ {
+
+ public AllTests (string name) : base (name)
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/Microsoft.CSharp/ChangeLog b/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
new file mode 100644
index 00000000000..69b55955193
--- /dev/null
+++ b/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
@@ -0,0 +1,19 @@
+2002-12-08 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerTest.cs CompilerErrorTest.cs: Removed files
+
+2002-12-08 Jackson Harper <jackson@latitudegeo.com>
+
+ * AllTests.cs: Remove references to soon to be removed Tests
+
+2002-11-13 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerTest.cs: Added more tests
+
+2002-11-11 Jackson Harper <jackson@latitudegeo.com>
+
+ * CompilerErrorTest.cs AllTests.cs: Added tests for the Microsoft.CSharp.CompilerError class
+
+2002-11-06 Jackson Harper <jackson@latitudegeo.com>
+
+ * AllTests.cs CompilerTest.cs: Added files \ No newline at end of file
diff --git a/mcs/class/System/Test/System.Collections.Specialized/AllTests.cs b/mcs/class/System/Test/System.Collections.Specialized/AllTests.cs
new file mode 100644
index 00000000000..5956415bda7
--- /dev/null
+++ b/mcs/class/System/Test/System.Collections.Specialized/AllTests.cs
@@ -0,0 +1,31 @@
+//
+// MonoTests.System.Collections.Specialized.AllTests, System.dll
+//
+// Author:
+// Lawrence Pit <loz@cable.a2000nl>
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System.Collections.Specialized {
+
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name)
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (BitVector32Test.Suite);
+ suite.AddTest (HybridDictionaryTest.Suite);
+ suite.AddTest (NameValueCollectionTest.Suite);
+ suite.AddTest (StringCollectionTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs b/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs
new file mode 100644
index 00000000000..883deed976f
--- /dev/null
+++ b/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs
@@ -0,0 +1,140 @@
+//
+// BitVector32Test.cs - NUnit Test Cases for System.Net.BitVector32
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace MonoTests.System.Collections.Specialized
+{
+ public class BitVector32Test : TestCase
+ {
+ public BitVector32Test () :
+ base ("[MonoTests.System.Net.BitVector32Test]") {}
+
+ public BitVector32Test (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (BitVector32Test));
+ }
+ }
+
+ public void TestConstructors ()
+ {
+ BitVector32 b = new BitVector32 (31);
+ }
+
+ public void TestIndexers ()
+ {
+ BitVector32 b = new BitVector32 (7);
+ Assert ("#1", b [0]);
+ Assert ("#2", b [1]);
+ Assert ("#3", b [2]);
+ Assert ("#4", b [4]);
+ Assert ("#5", !b [8]);
+ Assert ("#6", !b [16]);
+ b [8] = true;
+ Assert ("#7", b [4]);
+ Assert ("#8", b [8]);
+ Assert ("#9", !b [16]);
+ b [8] = false;
+ Assert ("#10", b [4]);
+ Assert ("#11", !b [8]);
+ Assert ("#12", !b [16]);
+
+ BitVector32.Section s = BitVector32.CreateSection (31);
+ s = BitVector32.CreateSection (64, s);
+ // Print (s);
+
+ // b = new BitVector32 (0x777777);
+ BitVector32 b1 = new BitVector32 (0xffff77);
+ BitVector32 b2 = new BitVector32 (b1 [s]);
+ //Console.WriteLine (b1.ToString ());
+ //Console.WriteLine (b2.ToString ());
+ AssertEquals ("#14", 123, b1 [s]);
+
+ // b1 [s] = 15;
+ //Console.WriteLine (b1.ToString ());
+ }
+
+ public void TestCreateMask ()
+ {
+ AssertEquals ("#1", 1, BitVector32.CreateMask ());
+ AssertEquals ("#2", 1, BitVector32.CreateMask (0));
+ AssertEquals ("#3", 2, BitVector32.CreateMask (1));
+ AssertEquals ("#4", 32, BitVector32.CreateMask (16));
+ AssertEquals ("#6", -2, BitVector32.CreateMask (Int32.MaxValue));
+ AssertEquals ("#5", -4, BitVector32.CreateMask (-2));
+ try {
+ BitVector32.CreateMask (Int32.MinValue);
+ Fail ("#7");
+ } catch (InvalidOperationException) {}
+ }
+
+ public void TestCreateSection ()
+ {
+ BitVector32.Section s = BitVector32.CreateSection (1);
+ AssertEquals ("#1", (short) 1, s.Mask);
+
+ s = BitVector32.CreateSection (2);
+ AssertEquals ("#2", (short) 3, s.Mask);
+
+ s = BitVector32.CreateSection (3);
+ AssertEquals ("#3", (short) 3, s.Mask);
+
+ s = BitVector32.CreateSection (5);
+ AssertEquals ("#4", (short) 7, s.Mask);
+
+ s = BitVector32.CreateSection (20);
+ AssertEquals ("#4", (short) 0x1f, s.Mask);
+
+ s = BitVector32.CreateSection (Int16.MaxValue);
+ AssertEquals ("#5", (short) 0x7fff, s.Mask);
+
+ s = BitVector32.CreateSection (Int16.MaxValue - 100);
+ AssertEquals ("#6", (short) 0x7fff, s.Mask);
+
+ try {
+ BitVector32.Section s2 = BitVector32.CreateSection (0);
+ Fail ("#7");
+ } catch (ArgumentException) {}
+
+ try {
+ BitVector32.Section s2 = BitVector32.CreateSection (-1);
+ Fail ("#8");
+ } catch (ArgumentException) {}
+
+ try {
+ BitVector32.Section s2 = BitVector32.CreateSection (Int16.MinValue);
+ Fail ("#9");
+ } catch (ArgumentException) {}
+
+ s = BitVector32.CreateSection (20);
+ AssertEquals ("#10a", (short) 0x1f, s.Mask);
+ AssertEquals ("#10b", (short) 0x00, s.Offset);
+ s = BitVector32.CreateSection (120, s);
+ AssertEquals ("#10c", (short) 0x7f, s.Mask);
+ AssertEquals ("#10d", (short) 0x05, s.Offset);
+ s = BitVector32.CreateSection (1000, s);
+ AssertEquals ("#10e", (short) 0x3ff, s.Mask);
+ AssertEquals ("#10f", (short) 0x0c, s.Offset);
+ }
+
+
+ private void Print (BitVector32.Section s)
+ {
+ Console.WriteLine (s.ToString () + " : "+ s.Mask + " : " + s.Offset);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/Test/System.Collections.Specialized/ChangeLog b/mcs/class/System/Test/System.Collections.Specialized/ChangeLog
new file mode 100644
index 00000000000..c16d19e343e
--- /dev/null
+++ b/mcs/class/System/Test/System.Collections.Specialized/ChangeLog
@@ -0,0 +1,11 @@
+2002-06-24 Andrew Birkett <adb@tardis.ed.ac.uk>
+
+ * BitVector32Test.cs: New tests for sections and removed ^M's.
+
+2002-05-11 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added NameValueCollectionTest.TestGetValues
+
+2002-05-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Moved StringCollectionTest.cs and NameValueCollectionTest to this dir
diff --git a/mcs/class/System/Test/System.Collections.Specialized/HybridDictionaryTest.cs b/mcs/class/System/Test/System.Collections.Specialized/HybridDictionaryTest.cs
new file mode 100644
index 00000000000..cdcc74c4e31
--- /dev/null
+++ b/mcs/class/System/Test/System.Collections.Specialized/HybridDictionaryTest.cs
@@ -0,0 +1,57 @@
+//
+// HybridDictionaryTest.cs - NUnit Test Cases for System.Net.HybridDictionary
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace MonoTests.System.Collections.Specialized
+{
+ public class HybridDictionaryTest : TestCase
+ {
+ public HybridDictionaryTest () :
+ base ("[MonoTests.System.Net.HybridDictionaryTest]") {}
+
+ public HybridDictionaryTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (HybridDictionaryTest));
+ }
+ }
+
+ public void TestAll ()
+ {
+ HybridDictionary dict = new HybridDictionary (true);
+ dict.Add ("CCC", "ccc");
+ dict.Add ("BBB", "bbb");
+ dict.Add ("fff", "fff");
+ dict ["EEE"] = "eee";
+ dict ["ddd"] = "ddd";
+
+ AssertEquals ("#1", 5, dict.Count);
+ AssertEquals ("#2", "eee", dict ["eee"]);
+
+ dict.Add ("CCC2", "ccc");
+ dict.Add ("BBB2", "bbb");
+ dict.Add ("fff2", "fff");
+ dict ["EEE2"] = "eee";
+ dict ["ddd2"] = "ddd";
+ dict ["xxx"] = "xxx";
+ dict ["yyy"] = "yyy";
+
+ AssertEquals ("#3", 12, dict.Count);
+ AssertEquals ("#4", "eee", dict ["eee"]);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs b/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs
new file mode 100644
index 00000000000..dd066f4d225
--- /dev/null
+++ b/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs
@@ -0,0 +1,35 @@
+// created on 7/21/2001 at 2:36 PM
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections.Specialized {
+
+
+ /// <summary>Microsoft NameValueCollection test.</summary>
+ public class NameValueCollectionTest : TestCase {
+
+ public NameValueCollectionTest() : base("MonoTests.System.Collections.Specialized.NameValueCollectionTest testsuite") {}
+ public NameValueCollectionTest(String name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(NameValueCollectionTest));
+ }
+ }
+
+ public void TestGetValues ()
+ {
+ NameValueCollection col = new NameValueCollection ();
+ col.Add ("foo1", "bar1");
+ AssertEquals ("#1", null, col.GetValues (null));
+ AssertEquals ("#2", null, col.GetValues (""));
+ AssertEquals ("#3", null, col.GetValues ("NotExistent"));
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Collections.Specialized/StringCollectionTest.cs b/mcs/class/System/Test/System.Collections.Specialized/StringCollectionTest.cs
new file mode 100644
index 00000000000..839970cd786
--- /dev/null
+++ b/mcs/class/System/Test/System.Collections.Specialized/StringCollectionTest.cs
@@ -0,0 +1,157 @@
+/* System.Collections.Specialized.StringCollection.cs
+ * Authors:
+ * John Barnette (jbarn@httcb.net)
+ *
+ * Copyright (C) 2001 John Barnette
+*/
+
+using NUnit.Framework;
+using System.Collections.Specialized;
+
+namespace MonoTests.System.Collections.Specialized {
+ public class StringCollectionTest : TestCase {
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (StringCollectionTest));
+ }
+ }
+
+ private StringCollection sc;
+ string[] strings = {
+ "foo",
+ "bar",
+ "baz",
+ "john",
+ "paul",
+ "george",
+ "ringo"
+ };
+
+ public StringCollectionTest() : base("MonoTests.System.Collections.Specialized.StringCollectionTest testsuite") {}
+ public StringCollectionTest(string name) : base(name) {}
+
+ protected override void SetUp() {
+ sc = new StringCollection();
+ sc.AddRange(strings);
+ }
+
+ // Simple Tests
+
+ public void TestSimpleCount() {
+ Assert(sc.Count == 7);
+ }
+
+ public void TestSimpleIsReadOnly() {
+ Assert(!sc.IsReadOnly);
+ }
+
+ public void TestSimpleIsSynchronized() {
+ Assert(!sc.IsSynchronized);
+ }
+
+ public void TestSimpleItemGet() {
+ for(int i = 0; i < strings.Length; i++) {
+ Assert(strings[i].Equals(sc[i]));
+ }
+ }
+
+ public void TestSimpleItemSet() {
+ sc[0] = "bob";
+ Assert(sc[0].Equals("bob"));
+ }
+
+ public void TestSimpleSyncRoot() {
+ Assert(sc.Equals(sc.SyncRoot));
+ }
+
+ public void TestSimpleAdd() {
+ int index = sc.Add("chuck");
+ Assert(index == strings.Length);
+ Assert(sc[strings.Length].Equals("chuck"));
+
+ }
+
+ public void TestSimpleAddRange() {
+ string[] newStrings = {
+ "peter",
+ "paul",
+ "mary"
+ };
+
+ int index = sc.Count;
+ sc.AddRange(newStrings);
+
+ Assert(sc.Count == index + newStrings.Length);
+
+ for (int i = 0; i+index <= sc.Count-1; i++) {
+ Assert(newStrings[i].Equals(sc[i+index]));
+ }
+ }
+
+ public void TestSimpleClear() {
+ sc.Clear();
+ Assert(sc.Count == 0);
+ }
+
+ public void TestSimpleContains() {
+ Assert(sc.Contains(strings[0]));
+ Assert(!sc.Contains("NOT CONTAINED"));
+ }
+
+ public void TestSimpleCopyTo() {
+ string[] copyArray = new string[sc.Count];
+ sc.CopyTo(copyArray, 0);
+ for (int i = 0; i < copyArray.Length; i++) {
+ Assert(copyArray[i] == sc[i]);
+ }
+ }
+
+ public void TestSimpleGetEnumerator() {
+ int index = 0;
+ foreach(string s in sc) {
+ Assert(s.Equals(strings[index]));
+ index++;
+ }
+ }
+
+ public void TestSimpleIndexOf() {
+ Assert(sc.IndexOf(strings[0]) == 0);
+ }
+
+ public void TestSimpleInsert() {
+ int index = 3;
+ int oldCount = sc.Count;
+ string before = sc[index - 1];
+ string current = sc[index];
+ string after = sc[index + 1];
+ string newStr = "paco";
+
+ sc.Insert(index, newStr);
+
+ Assert(sc.Count == oldCount + 1);
+ Assert(sc[index].Equals(newStr));
+ Assert(sc[index-1].Equals(before));
+ Assert(sc[index+1].Equals(current));
+ Assert(sc[index+2].Equals(after));
+ }
+
+ public void TestSimpleRemove() {
+ int oldCount = sc.Count;
+ sc.Remove(strings[0]);
+ Assert(oldCount == sc.Count + 1);
+ Assert(!sc.Contains(strings[0]));
+ }
+
+ public void TestSimpleRemoveAt() {
+ int index = 3;
+ int oldCount = sc.Count;
+ string after = sc[index+1];
+
+ sc.RemoveAt(index);
+ Assert(oldCount == sc.Count + 1);
+ Assert(sc[index].Equals(after));
+ }
+
+ }
+}
diff --git a/mcs/class/System/Test/System.ComponentModel/AllTests.cs b/mcs/class/System/Test/System.ComponentModel/AllTests.cs
new file mode 100644
index 00000000000..b62f3948fcc
--- /dev/null
+++ b/mcs/class/System/Test/System.ComponentModel/AllTests.cs
@@ -0,0 +1,33 @@
+//
+// MonoTests.System.ComponentModel.AllTests
+//
+// Author:
+// Gonzalo Panigua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using NUnit.Framework;
+using System.ComponentModel;
+
+namespace MonoTests.System.ComponentModel
+{
+ public class AllTests : TestCase
+ {
+ public AllTests () : base ("MonoTests.System.ComponentModel testcase") { }
+
+ public AllTests (string name) : base (name)
+ {
+ }
+
+ public static ITest Suite
+ {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (EventHandlerListTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.ComponentModel/ChangeLog b/mcs/class/System/Test/System.ComponentModel/ChangeLog
new file mode 100644
index 00000000000..6954d9ff6f9
--- /dev/null
+++ b/mcs/class/System/Test/System.ComponentModel/ChangeLog
@@ -0,0 +1,6 @@
+2002-10-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs:
+ * ChangeLog:
+ * EventHandlerListTests.cs: new test.
+
diff --git a/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs b/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs
new file mode 100644
index 00000000000..7777f567c2e
--- /dev/null
+++ b/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs
@@ -0,0 +1,168 @@
+//
+// System.ComponentModel.EventHandlerList test cases
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+#define NUNIT // Comment out this one if you wanna play with the test without using NUnit
+
+#if NUNIT
+using NUnit.Framework;
+#else
+using System.Reflection;
+#endif
+
+using System;
+using System.ComponentModel;
+
+namespace MonoTests.System.ComponentModel
+{
+#if NUNIT
+ public class EventHandlerListTests : TestCase
+ {
+#else
+ public class EventHandlerListTests
+ {
+#endif
+#if NUNIT
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (EventHandlerListTests));
+ }
+ }
+
+ public EventHandlerListTests () :
+ base ("MonoTests.System.ComponentModel.EventHandlerListTests testcase") { }
+
+ public EventHandlerListTests (string name) : base (name) { }
+
+ protected override void SetUp ()
+ {
+#else
+ static EventHandlerListTests ()
+ {
+#endif
+ }
+
+ int calls = 0;
+
+ void Deleg1 (object o, EventArgs e)
+ {
+ calls++;
+ }
+
+ void Deleg2 (object o, EventArgs e)
+ {
+ calls <<= 1;
+ }
+
+ public void TestAll ()
+ {
+ EventHandlerList list = new EventHandlerList ();
+ string i1 = "i1";
+ string i2 = "i2";
+ EventHandler one = new EventHandler (Deleg1);
+ EventHandler two = new EventHandler (Deleg2);
+ EventHandler d;
+
+ AssertEquals ("TestAll #01", null, list [i1]);
+ AssertEquals ("TestAll #02", null, list [i2]);
+
+ list.AddHandler (i1, one);
+ d = list [i1] as EventHandler;
+ Assert ("TestAll #03", d != null);
+
+ d (this, EventArgs.Empty);
+ AssertEquals ("TestAll #04", 1, calls);
+
+ list.AddHandler (i2, two);
+ d = list [i1] as EventHandler;
+ Assert ("TestAll #05", d != null);
+
+ d (this, EventArgs.Empty);
+ AssertEquals ("TestAll #06", 2, calls);
+
+ d = list [i2] as EventHandler;
+ Assert ("TestAll #07", d != null);
+
+ d (this, EventArgs.Empty);
+ AssertEquals ("TestAll #08", 4, calls);
+
+ list.AddHandler (i2, two);
+ d = list [i2] as EventHandler;
+ Assert ("TestAll #08", d != null);
+
+ d (this, EventArgs.Empty);
+ AssertEquals ("TestAll #09", 16, calls);
+
+ list.RemoveHandler (i1, one);
+ d = list [i1] as EventHandler;
+ Assert ("TestAll #10", d == null);
+
+ list.RemoveHandler (i2, two);
+ d = list [i2] as EventHandler;
+ Assert ("TestAll #11", d != null);
+
+ list.RemoveHandler (i2, two);
+ d = list [i2] as EventHandler;
+ Assert ("TestAll #12", d == null);
+
+ list.AddHandler (i1, one);
+ d = list [i1] as EventHandler;
+ Assert ("TestAll #13", d != null);
+
+ list.AddHandler (i2, two);
+ d = list [i2] as EventHandler;
+ Assert ("TestAll #14", d != null);
+
+ list.AddHandler (i1, null);
+ Assert ("TestAll #15", list [i1] != null);
+
+ list.AddHandler (i2, null);
+ Assert ("TestAll #16", list [i2] != null);
+
+ list.Dispose ();
+ }
+
+#if !NUNIT
+ void Assert (string msg, bool result)
+ {
+ if (!result)
+ Console.WriteLine (msg);
+ }
+
+ void AssertEquals (string msg, object expected, object real)
+ {
+ if (expected == null && real == null)
+ return;
+
+ if (expected != null && expected.Equals (real))
+ return;
+
+ Console.WriteLine ("{0}: expected: '{1}', got: '{2}'", msg, expected, real);
+ }
+
+ void Fail (string msg)
+ {
+ Console.WriteLine ("Failed: {0}", msg);
+ }
+
+ static void Main ()
+ {
+ EventHandlerListTests p = new EventHandlerListTests ();
+ Type t = p.GetType ();
+ MethodInfo [] methods = t.GetMethods ();
+ foreach (MethodInfo m in methods) {
+ if (m.Name.Substring (0, 4) == "Test") {
+ m.Invoke (p, null);
+ }
+ }
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Diagnostics/AllTests.cs b/mcs/class/System/Test/System.Diagnostics/AllTests.cs
new file mode 100644
index 00000000000..f3fa0b38d65
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/AllTests.cs
@@ -0,0 +1,31 @@
+//
+// MonoTests.System.Diagnostics.AllTests, System.dll
+//
+// Author:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System.Diagnostics {
+
+ public class AllTests : TestCase {
+
+ public AllTests(string name) : base(name)
+ {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (MonoTests.System.Diagnostics.TraceTest.Suite);
+ suite.AddTest (MonoTests.System.Diagnostics.SwitchesTest.Suite);
+ suite.AddTest (MonoTests.System.Diagnostics.DiagnosticsConfigurationHandlerTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Diagnostics/ChangeLog b/mcs/class/System/Test/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..be7edf401fc
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/ChangeLog
@@ -0,0 +1,35 @@
+2002-12-20 Jonathan Pryor <jonpryor@vt.edu>
+
+ * AllTests.cs: Add new tests
+ * SwitchesTest.cs: new file to test switches
+ * DiagnosticsConfigurationHandlerTest.cs: new file to test
+ DiagnosticsConfigurationHandler
+ * TraceTest.cs: Make sure that IndentLevel and IndentSize are set
+ appropriately before testing output.
+
+2002-09-23 Nick Drochak <ndrochak@gol.com>
+
+ * TraceTest.cs: Default level and size are 0 & 4, respectively.
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * TraceTest.cs: Clear list of listeners before each test.
+
+2002-09-17 Nick Drochak <ndrochak@gol.com>
+
+ * TraceTest.cs: Remove extraneous Console.WriteLine().
+
+2002-06-16 Jonathan Pryor <jonpryor@vt.edu>
+ * TraceTest.cs: Added additional test cases.
+
+2002-04-07 Jonathan Pryor <jonpryor@vt.edu>
+
+ * TraceTest.cs: Removed extraneous output; renamed test case so that NUnit
+ would find it.
+
+2002-03-10 Jonathan Pryor <jonpryor@vt.edu>
+
+ * Initial creation of System.Diagnostics test directory
+ * AllTests.cs: file added
+ * TraceTest.cs: Test System.Diagnostics.Trace class
+
diff --git a/mcs/class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs b/mcs/class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
new file mode 100644
index 00000000000..f7e850fa608
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
@@ -0,0 +1,231 @@
+//
+// DiagnosticsConfigurationHandlerTest.cs:
+// NUnit Test Cases for System.Diagnostics.DiagnosticsConfigurationHandler
+//
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) Jonathan Pryor
+//
+
+using NUnit.Framework;
+using System;
+using System.Configuration;
+using System.Diagnostics;
+using System.Xml;
+
+namespace MonoTests.System.Diagnostics {
+
+ public class DiagnosticsConfigurationHandlerTest : TestCase {
+
+ private const string XmlFormat =
+ "{0}";
+ /*
+ "<system.diagnostics>" +
+ "{0}" +
+ "</system.diagnostics>";
+ */
+
+ private DiagnosticsConfigurationHandler handler = new DiagnosticsConfigurationHandler ();
+
+ public DiagnosticsConfigurationHandlerTest ()
+ : base ("System.Diagnostics.DiagnosticsConfigurationHandler testsuite")
+ {
+ }
+
+ public DiagnosticsConfigurationHandlerTest (string name)
+ : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (DiagnosticsConfigurationHandlerTest));
+ }
+ }
+
+ public void TestSwitchesTag_Attributes ()
+ {
+ string[] attrs = {"invalid=\"yes\""};
+ ValidateExceptions ("#TST:A", "<switches {0}></switches>", attrs);
+ }
+
+ private void ValidateExceptions (string name, string format, string[] args)
+ {
+ foreach (string arg in args) {
+ string xml = string.Format (XmlFormat,
+ string.Format (format, arg));
+ try {
+ CreateHandler (xml);
+ Fail (string.Format ("{0}:{1}: no exception generated", name, arg));
+ }
+ catch (ConfigurationException ce) {
+ }
+ catch (AssertionFailedError afe) {
+ // This is generated by the Fail() statement in the try block.
+ throw;
+ }
+ catch (Exception e) {
+ Fail (string.Format ("{0}:{1}: wrong exception generated: {2} ({3}).",
+ // name, arg, e.Message,
+ name, arg, e.ToString(),
+ // e.InnerException == null ? "" : e.InnerException.Message));
+ e.InnerException == null ? "" : e.InnerException.ToString()));
+ }
+ }
+ }
+
+ private void ValidateSuccess (string name, string format, string[] args)
+ {
+ foreach (string arg in args) {
+ string xml = string.Format (XmlFormat,
+ string.Format (format, arg));
+ try {
+ CreateHandler (xml);
+ }
+ catch (Exception e) {
+ Fail (string.Format ("{0}:{1}: exception generated: {2} ({3}).",
+ // name, arg, e.Message,
+ name, arg, e.ToString(),
+ // e.InnerException == null ? "" : e.InnerException.Message));
+ e.InnerException == null ? "" : e.InnerException.ToString()));
+ }
+ }
+ }
+
+ private object CreateHandler (string xml)
+ {
+ XmlDocument d = new XmlDocument ();
+ d.LoadXml (xml);
+ return handler.Create (null, null, d);
+ }
+
+ public void TestSwitchesTag_Elements ()
+ {
+ string[] badElements = {
+ // not enough arguments
+ "<add />",
+ "<add value=\"b\"/>",
+ // too many arguments
+ "<add name=\"a\" value=\"b\" extra=\"c\"/>",
+ // wrong casing
+ "<add Name=\"a\" value=\"b\"/>",
+ "<Add Name=\"a\" value=\"b\"/>",
+ // missing args
+ "<remove />",
+ "<remove value=\"b\"/>",
+ // too many args
+ "<remove name=\"a\" value=\"b\"/>",
+ "<clear name=\"a\"/>",
+ // invalid element
+ "<invalid element=\"a\" here=\"b\"/>"
+ };
+ ValidateExceptions ("#TST:IE:Bad", "<switches>{0}</switches>", badElements);
+
+ string[] goodElements = {
+ "<add name=\"a\" value=\"b\"/>",
+ "<add name=\"a\"/>",
+ "<remove name=\"a\"/>",
+ "<clear/>"
+ };
+ ValidateSuccess ("#TST:IE:Good", "<switches>{0}</switches>", goodElements);
+ }
+
+ public void TestAssertTag ()
+ {
+ string[] goodAttributes = {
+ "",
+ "assertuienabled=\"true\"",
+ "assertuienabled=\"false\" logfilename=\"some file name\"",
+ "logfilename=\"some file name\""
+ };
+ ValidateSuccess ("#TAT:Good", "<assert {0}/>", goodAttributes);
+
+ string[] badAttributes = {
+ "AssertUiEnabled=\"true\"",
+ "LogFileName=\"foo\"",
+ "assertuienabled=\"\"",
+ "assertuienabled=\"non-boolean-value\""
+ };
+ ValidateExceptions ("#TAT:BadAttrs", "<assert {0}/>", badAttributes);
+
+ string[] badChildren = {
+ "<any element=\"here\"/>"
+ };
+ ValidateExceptions ("#TAT:BadChildren", "<assert>{0}</assert>", badChildren);
+ }
+
+ public void TestTraceTag_Attributes ()
+ {
+ string[] good = {
+ "",
+ "autoflush=\"true\"",
+ "indentsize=\"4\"",
+ "autoflush=\"false\" indentsize=\"10\""
+ };
+ ValidateSuccess ("#TTT:A:Good", "<trace {0}/>", good);
+
+ string[] bad = {
+ "AutoFlush=\"true\"",
+ "IndentSize=\"false\"",
+ "autoflush=\"non-boolean-value\"",
+ "autoflush=\"\"",
+ "indentsize=\"non-integral-value\"",
+ "indentsize=\"\"",
+ "extra=\"invalid\""
+ };
+ ValidateExceptions ("#TTT:A:Bad", "<trace {0}/>", bad);
+ }
+
+ public void TestTraceTag_Children ()
+ {
+ string[] good = {
+ // more about listeners in a different function...
+ "<listeners />"
+ };
+ ValidateSuccess ("#TTT:C:Good", "<trace>{0}</trace>", good);
+
+ string[] bad = {
+ "<listeners with=\"attribute\"/>",
+ "<invalid element=\"here\"/>"
+ };
+ ValidateExceptions ("#TTT:C:Bad", "<trace>{0}</trace>", bad);
+ }
+
+ public void TestTraceTag_Listeners ()
+ {
+ const string format = "<trace><listeners>{0}</listeners></trace>";
+ string[] good = {
+ "<clear/>",
+ "<add name=\"foo\" " +
+ "type=\"System.Diagnostics.TextWriterTraceListener, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" " +
+ "initializeData=\"argument.txt\"/>",
+ "<remove name=\"foo\"/>",
+ "<add name=\"foo\"" +
+ "type=\"System.Diagnostics.TextWriterTraceListener, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />",
+ "<remove name=\"foo\"/>"
+ };
+ ValidateSuccess ("#TTT:L:Good", format, good);
+
+ string[] bad = {
+ "<invalid tag=\"here\"/>",
+ "<clear with=\"args\"/>",
+ "<remove/>",
+ "<add/>",
+ "<remove name=\"foo\" extra=\"arg\"/>",
+ "<add name=\"foo\"/>",
+ "<add type=\"foo\"/>",
+ "<add name=\"foo\" type=\"invalid-type\"/>",
+ };
+ ValidateExceptions ("#TTT:L:Bad", format, bad);
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Diagnostics/SwitchesTest.cs b/mcs/class/System/Test/System.Diagnostics/SwitchesTest.cs
new file mode 100644
index 00000000000..401da7c6d95
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/SwitchesTest.cs
@@ -0,0 +1,161 @@
+//
+// SwitchesTest.cs:
+// NUnit Test Cases for System.Diagnostics.BooleanSwitch and
+// System.Diagnostics.TraceSwitch
+//
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+// README:
+// Tests in this file are expected to fail until a decent strategy to test
+// .config files is found. See the mono-list archives for more information
+// (assuming anybody ever answers the initial requests for help...).
+//
+
+using NUnit.Framework;
+using System;
+using System.Text;
+using System.Collections;
+using System.Configuration;
+using System.Diagnostics;
+
+namespace MonoTests.System.Diagnostics {
+
+ class TestNewSwitch : Switch {
+ private string v;
+ private StringBuilder ops = new StringBuilder ();
+ private const string expected =
+ ".ctor\n" +
+ "get_Value\n" +
+ "OnSwitchSettingChanged\n" +
+ "GetSetting";
+
+ public TestNewSwitch (string name, string desc)
+ : base (name, desc)
+ {
+ ops.Append (".ctor\n");
+ }
+
+ public string Value {
+ get {
+ ops.Append ("get_Value\n");
+ // ensure that the .config file is read in
+ int n = base.SwitchSetting;
+ return v;
+ }
+ }
+
+ public bool Validate ()
+ {
+ return expected == ops.ToString();
+ }
+
+ private void GetSetting ()
+ {
+ ops.Append ("GetSetting\n");
+ IDictionary d = (IDictionary) ConfigurationSettings.GetConfig ("system.diagnostics");
+ if (d != null) {
+ d = (IDictionary) d ["switches"];
+ if (d != null) {
+ v = d [DisplayName].ToString();
+ }
+ }
+ }
+
+ protected override void OnSwitchSettingChanged ()
+ {
+ ops.Append ("OnSwitchSettingChanged\n");
+
+ GetSetting ();
+ }
+ }
+
+ public class SwitchesTest : TestCase {
+
+ private static BooleanSwitch bon = new BooleanSwitch ("bool-true", "");
+ private static BooleanSwitch bon2 = new BooleanSwitch ("bool-true-2", "");
+ private static BooleanSwitch bon3 = new BooleanSwitch ("bool-true-3", "");
+ private static BooleanSwitch boff = new BooleanSwitch ("bool-false", "");
+ private static BooleanSwitch boff2 = new BooleanSwitch ("bool-default", "");
+
+ private static TraceSwitch toff = new TraceSwitch ("trace-off", "");
+ private static TraceSwitch terror = new TraceSwitch ("trace-error", "");
+ private static TraceSwitch twarning = new TraceSwitch ("trace-warning", "");
+ private static TraceSwitch tinfo = new TraceSwitch ("trace-info", "");
+ private static TraceSwitch tverbose = new TraceSwitch ("trace-verbose", "");
+ private static TraceSwitch tdefault = new TraceSwitch ("no-value", "");
+ private static TraceSwitch tsv = new TraceSwitch ("string-value", "");
+ private static TraceSwitch tnegative = new TraceSwitch ("trace-negative", "");
+
+ private static TestNewSwitch tns = new TestNewSwitch ("string-value", "");
+
+ public SwitchesTest ()
+ : base ("System.Diagnostics.Trace testsuite")
+ {
+ }
+
+ public SwitchesTest (string name)
+ : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (SwitchesTest));
+ }
+ }
+
+ public void TestBooleanSwitches ()
+ {
+ AssertEquals ("#BS:T:1", true, bon.Enabled);
+ AssertEquals ("#BS:T:2", true, bon2.Enabled);
+ AssertEquals ("#BS:T:3", true, bon3.Enabled);
+ AssertEquals ("#BS:F:1", false, boff.Enabled);
+ AssertEquals ("#BS:F:2", false, boff2.Enabled);
+ }
+
+ public void TestTraceSwitches ()
+ {
+ // The levels 0..4:
+ CheckTraceSwitch (toff, false, false, false, false);
+ CheckTraceSwitch (terror, true, false, false, false);
+ CheckTraceSwitch (twarning, true, true, false, false);
+ CheckTraceSwitch (tinfo, true, true, true, false);
+ CheckTraceSwitch (tverbose, true, true, true, true);
+
+ // Default value is 0
+ CheckTraceSwitch (tdefault, false, false, false, false);
+
+ // string value can't be converted to int, so default is 0
+ CheckTraceSwitch (tsv, false, false, false, false);
+
+ // negative number is < 0, so all off
+ CheckTraceSwitch (tnegative, false, false, false, false);
+ }
+
+ private void CheckTraceSwitch (TraceSwitch ts, bool te, bool tw, bool ti, bool tv)
+ {
+ string desc = string.Format ("#TS:{0}", ts.DisplayName);
+ AssertEquals (desc + ":TraceError", te, ts.TraceError);
+ AssertEquals (desc + ":TraceWarning", tw, ts.TraceWarning);
+ AssertEquals (desc + ":TraceInfo", ti, ts.TraceInfo);
+ AssertEquals (desc + ":TraceVerbose", tv, ts.TraceVerbose);
+ }
+
+ public void TestNewSwitch ()
+ {
+ AssertEquals ("#NS:Validate", true, tns.Validate());
+ AssertEquals ("#NS:Value", "string-value", tns.Value);
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Diagnostics/TraceTest.cs b/mcs/class/System/Test/System.Diagnostics/TraceTest.cs
new file mode 100644
index 00000000000..c824987a39e
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/TraceTest.cs
@@ -0,0 +1,157 @@
+//
+// TraceTest.cs - NUnit Test Cases for System.Diagnostics.Trace
+//
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) Jonathan Pryor
+//
+
+// We want tracing enabled, so...
+#define TRACE
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Diagnostics;
+
+namespace MonoTests.System.Diagnostics {
+
+ public class TraceTest : TestCase {
+
+ private StringWriter buffer;
+ private TraceListener listener;
+
+ public TraceTest ()
+ : base ("System.Diagnostics.Trace testsuite")
+ {
+ }
+
+ public TraceTest (string name)
+ : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ // We don't want to deal with the default listener, which can send the
+ // output to various places (Debug stream, Console.Out, ...)
+ // Trace.Listeners.Remove ("Default");
+
+ buffer = new StringWriter ();
+ listener = new TextWriterTraceListener (buffer, "TestOutput");
+ Trace.Listeners.Clear ();
+ Trace.Listeners.Add (listener);
+ Trace.AutoFlush = true;
+ }
+
+ protected override void TearDown ()
+ {
+ // Trace.Listeners.Add (new DefaultTraceListener ());
+ Trace.Listeners.Remove (listener);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (TraceTest));
+ }
+ }
+
+ // Make sure that when we get the output we expect....
+ public void TestTracing ()
+ {
+ Trace.IndentLevel = 0;
+ Trace.IndentSize = 4;
+
+ string value =
+ "Entering Main" + Environment.NewLine +
+ "Exiting Main" + Environment.NewLine;
+
+ Trace.WriteLine ("Entering Main");
+ Trace.WriteLine ("Exiting Main");
+
+ AssertEquals ("#Tr01", value, buffer.ToString ());
+ }
+
+ // Make sure we get the output we expect in the presence of indenting...
+ public void TestIndent ()
+ {
+ Trace.IndentLevel = 0;
+ Trace.IndentSize = 4;
+
+ string value =
+ "List of errors:" + Environment.NewLine +
+ " Error 1: File not found" + Environment.NewLine +
+ " Error 2: Directory not found" + Environment.NewLine +
+ "End of list of errors" + Environment.NewLine;
+
+ Trace.WriteLine ("List of errors:");
+ Trace.Indent ();
+ Trace.WriteLine ("Error 1: File not found");
+ Trace.WriteLine ("Error 2: Directory not found");
+ Trace.Unindent ();
+ Trace.WriteLine ("End of list of errors");
+
+ AssertEquals ("#In01", value, buffer.ToString());
+ }
+
+ // Make sure that TraceListener properties (IndentLevel, IndentSize) are
+ // modified when the corresponding Trace properties are changed.
+ public void TestAddedTraceListenerProperties ()
+ {
+ TraceListener t1 = new TextWriterTraceListener (Console.Out);
+ TraceListener t2 = new TextWriterTraceListener (Console.Error);
+ Trace.Listeners.Add(t1);
+ Trace.Listeners.Add(t2);
+
+ const int ExpectedSize = 5;
+ const int ExpectedLevel = 2;
+
+ Trace.IndentSize = ExpectedSize;
+ Trace.IndentLevel = ExpectedLevel;
+
+ foreach (TraceListener t in Trace.Listeners) {
+ string ids = "#TATLP-S-" + t.Name;
+ string idl = "#TATLP-L-" + t.Name;
+ AssertEquals (ids, ExpectedSize, t.IndentSize);
+ AssertEquals (idl, ExpectedLevel, t.IndentLevel);
+ }
+
+ Trace.Listeners.Remove(t1);
+ Trace.Listeners.Remove(t2);
+ }
+
+ // Make sure that the TraceListener properties (IndentLevel, IndentSize)
+ // are properly modified when the TraceListener is added to the
+ // collection.
+ public void TestListeners_Add_Values()
+ {
+ const int ExpectedLevel = 0;
+ const int ExpectedSize = 4;
+ Trace.IndentLevel = ExpectedLevel;
+ Trace.IndentSize = ExpectedSize;
+ TraceListener tl = new TextWriterTraceListener(Console.Out);
+
+ tl.IndentLevel = 2*ExpectedLevel;
+ tl.IndentSize = 2*ExpectedSize;
+
+ Trace.Listeners.Add(tl);
+
+ // Assert that the listener we added has been set to the correct indent
+ // level.
+ AssertEquals ("#LATL-L", ExpectedLevel, tl.IndentLevel);
+ AssertEquals ("#LATL-S", ExpectedSize, tl.IndentSize);
+
+ // Assert that all listeners in the collection have the same level.
+ foreach (TraceListener t in Trace.Listeners)
+ {
+ string idl = "#LATL-L:" + t.Name;
+ string ids = "#LATL-S:" + t.Name;
+ AssertEquals(idl, ExpectedLevel, t.IndentLevel);
+ AssertEquals(ids, ExpectedSize, t.IndentSize);
+ }
+ }
+
+ // IndentSize, IndentLevel are thread-static
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Net.Sockets/AllTests.cs b/mcs/class/System/Test/System.Net.Sockets/AllTests.cs
new file mode 100644
index 00000000000..afe17fd1302
--- /dev/null
+++ b/mcs/class/System/Test/System.Net.Sockets/AllTests.cs
@@ -0,0 +1,33 @@
+//
+// MonoTests.System.Net.Sockets.AllTests, System.dll
+//
+// Author:
+// Lawrence Pit <loz@cable.a2000.nl>
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite ();
+ #if NETWORKTEST
+ suite.AddTest (TcpListenerTest.Suite);
+ suite.AddTest (TcpClientTest.Suite);
+ //suite.AddTest (UdpClientTest.Suite);
+ #endif
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Net.Sockets/ChangeLog b/mcs/class/System/Test/System.Net.Sockets/ChangeLog
new file mode 100644
index 00000000000..f92ab87baf1
--- /dev/null
+++ b/mcs/class/System/Test/System.Net.Sockets/ChangeLog
@@ -0,0 +1,10 @@
+2002-11-03 Phillip Pearson <pp@myelin.co.nz>
+
+ * AllTests.cs: Fixed Lawrence's e-mail address.
+
+2002-05-17 Lawrence Pit <loz@cable.a2000.nl>
+
+ * AllTests.cs: added
+
+
+
diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
new file mode 100755
index 00000000000..f7b39fd5050
--- /dev/null
+++ b/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
@@ -0,0 +1,82 @@
+// System.Net.Sockets.TcpClientTest.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+
+ /// <summary>
+ /// Tests System.Net.Sockets.TcpClient
+ /// </summary>
+ public class TcpClientTest : TestCase {
+
+ public TcpClientTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (TcpClientTest));
+ }
+ }
+
+ /// <summary>
+ /// Tests the TcpClient object
+ /// (from System.Net.Sockets)
+ /// </summary>
+ public void test_TcpClient()
+ {
+ // set up a listening Socket
+ Socket lSock = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+
+ lSock.Bind(new IPEndPoint(IPAddress.Any, 1234));
+ lSock.Listen(-1);
+
+
+ // connect to it with a TcpClient
+ TcpClient outClient = new TcpClient("localhost", 1234);
+ Socket inSock = lSock.Accept();
+
+
+ // now try exchanging data
+ NetworkStream stream = outClient.GetStream();
+
+ const int len = 1024;
+ byte[] outBuf = new Byte[len];
+ for (int i=0; i<len; i++)
+ {
+ outBuf[i] = (byte)(i % 256);
+ }
+
+ // send it
+ stream.Write(outBuf,0,len);
+
+ // and see if it comes back
+ byte[] inBuf = new Byte[len];
+ int ret = inSock.Receive(inBuf, 0, len, 0);
+ Assert(ret != 0);
+
+ for (int i=0; i<len; i++)
+ {
+ Assert(inBuf[i] == outBuf[i]);
+ }
+
+
+ // tidy up
+ inSock.Close();
+ outClient.Close();
+ lSock.Close();
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs
new file mode 100755
index 00000000000..a07d6bfcb9e
--- /dev/null
+++ b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs
@@ -0,0 +1,85 @@
+// System.Net.Sockets.TcpListenerTest.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+
+ /// <summary>
+ /// Tests System.Net.Sockets.TcpListener
+ /// </summary>
+ public class TcpListenerTest : TestCase {
+
+ public TcpListenerTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (TcpListenerTest));
+ }
+ }
+
+ /// <summary>
+ /// Tests the TcpListener object
+ /// (from System.Net.Sockets)
+ /// </summary>
+ public void test_TcpListener()
+ {
+ // listen with a new listener
+ TcpListener inListener = new TcpListener(1234);
+ inListener.Start();
+
+
+ // connect to it from a new socket
+ Socket outSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
+ ProtocolType.IP);
+ IPHostEntry hostent = Dns.GetHostByAddress("127.0.0.1");
+ IPEndPoint remote = new IPEndPoint(hostent.AddressList[0], 1234);
+ outSock.Connect(remote);
+
+
+ // make sure the connection arrives
+ Assert(inListener.Pending());
+ Socket inSock = inListener.AcceptSocket();
+
+
+ // now send some data and see if it comes out the other end
+ const int len = 1024;
+ byte[] outBuf = new Byte[len];
+ for (int i=0; i<len; i++)
+ {
+ outBuf[i] = (byte)(i % 256);
+ }
+
+ outSock.Send(outBuf, 0, len, 0);
+
+ byte[] inBuf = new Byte[len];
+ int ret = inSock.Receive(inBuf, 0, len, 0);
+
+
+ // let's see if it arrived OK
+ Assert(ret != 0);
+ for (int i=0; i<len; i++)
+ {
+ Assert(inBuf[i] == outBuf[i]);
+ }
+
+
+ // tidy up after ourselves
+ inSock.Close();
+
+ inListener.Stop();
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/System/Test/System.Net/AllTests.cs b/mcs/class/System/Test/System.Net/AllTests.cs
new file mode 100644
index 00000000000..ed2c8f1e78b
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/AllTests.cs
@@ -0,0 +1,47 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (CookieTest.Suite);
+ suite.AddTest (CookieCollectionTest.Suite);
+ //suite.AddTest (CookieContainerTest.Suite);
+ suite.AddTest (CredentialCacheTest.Suite);
+ suite.AddTest (FileWebRequestTest.Suite);
+ suite.AddTest (IPAddressTest.Suite);
+ suite.AddTest (IPEndPointTest.Suite);
+ suite.AddTest (SocketPermissionTest.Suite);
+ suite.AddTest (WebHeaderCollectionTest.Suite);
+ suite.AddTest (WebProxyTest.Suite);
+ suite.AddTest (WebRequestTest.Suite);
+
+ #if NETWORKTEST
+ suite.AddTest (DnsTest.Suite);
+ suite.AddTest (HttpWebRequestTest.Suite);
+ suite.AddTest (ServicePointTest.Suite);
+ suite.AddTest (ServicePointManagerTest.Suite);
+ #endif
+
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Net/ChangeLog b/mcs/class/System/Test/System.Net/ChangeLog
new file mode 100644
index 00000000000..8e8632072e1
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/ChangeLog
@@ -0,0 +1,82 @@
+2002-09-17 Nick Drochak <ndrochak@gol.com>
+
+ * ServicePointManagerTest.cs: Convert Console.WriteLine() into a Fail()
+
+2002-05-21 Lawrence Pit <loz@cable.a2000.nl>
+
+ * WebClientTest.cs: added
+ * WebProxyTest.cs: more tests
+
+2002-05-20 Lawrence Pit <loz@cable.a2000.nl>
+
+ * ServicePointTest.cs: added
+ * ServicePointManagerTest.cs: added
+ * WebProxyTest.cs: added
+ * AllTests.cs: added the above tests
+ * WebHeaderCollection.cs: added TestIndexers.
+
+2002-05-19 Lawrence Pit <loz@cable.a2000.nl>
+
+ * FileWebRequestTest.cs: all the async methods tests to behave the same
+ as in ms.net
+
+2002-05-12 Lawrence Pit <loz@cable.a2000.nl>
+
+ * FileWebRequestTest.cs: added
+
+2002-05-11 Lawrence Pit <loz@cable.a2000.nl>
+
+ * WebRequestTest.cs: added
+ * WebHeaderCollectionTest.cs: added
+
+2002-05-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added tests to IPAddressTest.cs
+ * Fixed tests in CookieTest.cs, SocketPermissionsTest.cs, IPEndPointTest.cs
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * CredentialCacheTest.cs: added
+ * AllTests.cs: added CredentialCacheTest
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * IPAddressTest.cs: added test for loopback
+
+2002-04-30 Nick Drochak <ndrochak@gol.com>
+
+ * IPAddressTest.cs: Remove unused code to eliminate compiler warnings.
+
+2002-04-27 Lawrence Pit <loz@cable.a2000.nl>
+
+ * CookieTest.cs: added
+ * CookieCollectionTest.cs: added
+ * AllTests.cs: added
+
+2002-04-24 Nick Drochak <ndrochak@gol.com>
+
+ * IPAddressTest.cs: Make test conform to MS behavior. Also, if wrong
+ exception is thrown, let eveyone know which one.
+
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddressTest.cs: use BitConverter to set localhost, catch
+ OverflowException in TestParseWrong() and changed some constants.
+
+2002-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: added IPEndPointTest.
+ * IPEndPointTest.cs: added file (author: Lawrence Pit).
+ * IPAdressTest.cs: use Fail is expected exception are not raised.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddressTest.cs: use System.BitConverter.IsLittleEndian (suggested
+ by Paolo) instead of guessing the endianness.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog:
+ * AllTests.cs:
+ * IPAddressTest.cs: added files.
+
diff --git a/mcs/class/System/Test/System.Net/CookieCollectionTest.cs b/mcs/class/System/Test/System.Net/CookieCollectionTest.cs
new file mode 100644
index 00000000000..9d5e53eb64b
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/CookieCollectionTest.cs
@@ -0,0 +1,123 @@
+//
+// CookieCollectionTest.cs - NUnit Test Cases for System.Net.CookieCollection
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Collections;
+
+namespace MonoTests.System.Net
+{
+
+public class CookieCollectionTest : TestCase
+{
+ CookieCollection col;
+
+ public CookieCollectionTest () :
+ base ("[MonoTests.System.Net.CookieCollectionTest]") {}
+
+ public CookieCollectionTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ col = new CookieCollection ();
+ col.Add (new Cookie ("name1", "value1"));
+ col.Add (new Cookie ("name2", "value2", "path2"));
+ col.Add (new Cookie ("name3", "value3", "path3", "domain3"));
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (CookieCollectionTest));
+ }
+ }
+
+ public void TestCount ()
+ {
+ AssertEquals ("#1", col.Count, 3);
+ }
+
+ public void TestIndexer ()
+ {
+ Cookie c = null;
+ try {
+ c = col [-1];
+ Fail ("#1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ c = col [col.Count];
+ Fail ("#2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ c = col ["name1"];
+ AssertEquals ("#3", c.Name, "name1");
+ c = col ["NAME2"];
+ AssertEquals ("#4", c.Name, "name2");
+ }
+
+ public void TestAdd ()
+ {
+ try {
+ Cookie c = null;
+ col.Add (c);
+ Fail ("#1");
+ } catch (ArgumentNullException) {
+ }
+
+ // in the microsoft implementation this will fail,
+ // so we'll have to fail to.
+ try {
+ col.Add (col);
+ Fail ("#2");
+ } catch (Exception) {
+ }
+ AssertEquals ("#3", col.Count, 3);
+
+ col.Add (new Cookie("name1", "value1"));
+ AssertEquals ("#4", col.Count, 3);
+
+ CookieCollection col2 = new CookieCollection();
+ Cookie c4 = new Cookie("name4", "value4");
+ Cookie c5 = new Cookie("name5", "value5");
+ col2.Add (c4);
+ col2.Add (c5);
+ col.Add (col2);
+ AssertEquals ("#5", col.Count, 5);
+ AssertEquals ("#6", col ["NAME4"], c4);
+ AssertEquals ("#7", col [4], c5);
+ }
+
+ public void TestCopyTo ()
+ {
+ Array a = Array.CreateInstance (typeof (Cookie), 3);
+ col.CopyTo (a, 0);
+ AssertEquals ("#1", a.GetValue (0), col [0]);
+ AssertEquals ("#2", a.GetValue (1), col [1]);
+ AssertEquals ("#3", a.GetValue (2), col [2]);
+ }
+
+ public void TestEnumerator ()
+ {
+ IEnumerator enumerator = col.GetEnumerator ();
+ enumerator.MoveNext ();
+ Cookie c = (Cookie) enumerator.Current;
+ AssertEquals ("#1", c, col [0]);
+ col.Add (new Cookie ("name6", "value6"));
+ try {
+ enumerator.MoveNext ();
+ Fail ("#2");
+ } catch (InvalidOperationException) {
+ }
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/CookieTest.cs b/mcs/class/System/Test/System.Net/CookieTest.cs
new file mode 100644
index 00000000000..d00d38421e4
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/CookieTest.cs
@@ -0,0 +1,165 @@
+//
+// CookieTest.cs - NUnit Test Cases for System.Net.Cookie
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+
+namespace MonoTests.System.Net
+{
+
+public class CookieTest : TestCase
+{
+ public CookieTest () :
+ base ("[MonoTests.System.Net.CookieTest]") {}
+
+ public CookieTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (CookieTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ }
+
+ public void TestConstructors ()
+ {
+ Cookie c = new Cookie ("somename", null, null, null);
+ try {
+ c = new Cookie (null, null, null, null);
+ Fail ("#1: Name cannot be null");
+ } catch (CookieException) {
+ }
+ }
+
+ public void TestName ()
+ {
+ Cookie c = new Cookie ("SomeName", "SomeValue");
+ AssertEquals ("#1", c.Name, "SomeName");
+ try {
+ c.Name = null;
+ Fail ("#2a");
+ } catch (CookieException) {
+ AssertEquals ("#2b", "SomeName", c.Name);
+ }
+ try {
+ c.Name = "";
+ Fail ("#2c");
+ } catch (CookieException) {
+ AssertEquals ("#2d", "SomeName", c.Name);
+ }
+ try {
+ c.Name = " ";
+ Fail ("#2e");
+ } catch (CookieException) {
+ // bah! this fails, yet the name is changed..
+ // inconsistent with previous test
+ AssertEquals ("#2f", String.Empty, c.Name);
+ }
+ try {
+ c.Name = "xxx\r\n";
+ Fail ("#2g");
+ } catch (CookieException) {
+ AssertEquals ("#2h", String.Empty, c.Name);
+ }
+ try {
+ c.Name = "xxx" + (char) 0x80;
+ } catch (CookieException) {
+ Fail ("#2i");
+ }
+ try {
+ c.Name = "$omeName";
+ Fail ("#3a: Name cannot start with '$' character");
+ } catch (CookieException) {
+ AssertEquals ("#3b", String.Empty, c.Name);
+ }
+ c.Name = "SomeName$";
+ AssertEquals ("#4", c.Name, "SomeName$");
+ try {
+ c.Name = "Some=Name";
+ Fail ("#5a: Name cannot contain '=' character");
+ } catch (CookieException) {
+ AssertEquals ("#5b", String.Empty, c.Name);
+ }
+ c.Name = "domain";
+ AssertEquals ("#6", c.Name, "domain");
+ }
+
+ public void TestValue ()
+ {
+ // LAMESPEC: According to .Net specs the Value property should not accept
+ // the semicolon and comma characters, yet it does
+ /*
+ Cookie c = new Cookie("SomeName", "SomeValue");
+ try {
+ c.Value = "Some;Value";
+ Fail ("#1: semicolon should not be accepted");
+ } catch (CookieException) {
+ }
+ try {
+ c.Value = "Some,Value";
+ Fail ("#2: comma should not be accepted");
+ } catch (CookieException) {
+ }
+ c.Value = "Some\tValue";
+ AssertEquals ("#3", c.Value, "Some\tValue");
+ */
+ }
+
+ public void TestPort ()
+ {
+ Cookie c = new Cookie ("SomeName", "SomeValue");
+ try {
+ c.Port = "123";
+ Fail ("#1: port must start and end with double quotes");
+ } catch (CookieException) {
+ }
+ try {
+ c.Port = "\"123\"";
+ } catch (CookieException) {
+ Fail ("#2");
+ }
+ try {
+ c.Port = "\"123;124\"";
+ Fail ("#3");
+ } catch (CookieException) {
+ }
+ try {
+ c.Port = "\"123,123,124\"";
+ } catch (CookieException) {
+ Fail ("#4");
+ }
+ try {
+ c.Port = "\"123,124\"";
+ } catch (CookieException) {
+ Fail ("#5");
+ }
+ }
+
+ public void TestEquals ()
+ {
+ Cookie c1 = new Cookie ("NAME", "VALUE", "PATH", "DOMAIN");
+ Cookie c2 = new Cookie ("name", "value", "path", "domain");
+ Assert("#1", !c1.Equals (c2));
+ c2.Value = "VALUE";
+ c2.Path = "PATH";
+ Assert("#2", c1.Equals (c2));
+ c2.Version = 1;
+ Assert("#3", !c1.Equals (c2));
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/CredentialCacheTest.cs b/mcs/class/System/Test/System.Net/CredentialCacheTest.cs
new file mode 100644
index 00000000000..1509f280087
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/CredentialCacheTest.cs
@@ -0,0 +1,120 @@
+//
+// CredentialCacheTest.cs - NUnit Test Cases for System.Net.CredentialCache
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Net
+{
+
+public class CredentialCacheTest : TestCase
+{
+ public CredentialCacheTest () :
+ base ("[MonoTests.System.Net.CredentialCacheTest]") {}
+
+ public CredentialCacheTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (CredentialCacheTest));
+ }
+ }
+
+ public void TestAll ()
+ {
+ CredentialCache c = new CredentialCache ();
+
+ NetworkCredential cred1 = new NetworkCredential ("user1", "pwd1");
+ NetworkCredential cred2 = new NetworkCredential ("user2", "pwd2");
+ NetworkCredential cred3 = new NetworkCredential ("user3", "pwd3");
+ NetworkCredential cred4 = new NetworkCredential ("user4", "pwd4");
+ NetworkCredential cred5 = new NetworkCredential ("user5", "pwd5");
+
+ c.Add (new Uri ("http://www.ximian.com"), "Basic", cred1);
+ c.Add (new Uri ("http://www.ximian.com"), "Kerberos", cred2);
+
+ c.Add (new Uri ("http://www.contoso.com/portal/news/index.aspx"), "Basic", cred1);
+ c.Add (new Uri ("http://www.contoso.com/portal/news/index.aspx?item=1"), "Basic", cred2);
+ c.Add (new Uri ("http://www.contoso.com/portal/news/index.aspx?item=12"), "Basic", cred3);
+ c.Add (new Uri ("http://www.contoso.com/portal/"), "Basic", cred4);
+ c.Add (new Uri ("http://www.contoso.com"), "Basic", cred5);
+
+ NetworkCredential result = null;
+
+ try {
+ c.Add (new Uri("http://www.ximian.com"), "Basic", cred1);
+ Fail ("#1: should have failed");
+ } catch (ArgumentException) { }
+
+ c.Add (new Uri("http://www.contoso.com/"), "**Unknown**", cred1);
+ result = c.GetCredential (new Uri("http://www.contoso.com/"), "**Unknown**");
+ AssertEquals ("#3", result, cred1);
+ c.Remove (new Uri("http://www.contoso.com/"), "**Unknown**");
+ result = c.GetCredential (new Uri("http://www.contoso.com/"), "**Unknown**");
+ Assert ("#4", result == null);
+
+ c.Add (new Uri("http://www.contoso.com/"), "**Unknown**", cred1);
+ result = c.GetCredential (new Uri("http://www.contoso.com"), "**Unknown**");
+ AssertEquals ("#5", result, cred1);
+ c.Remove (new Uri("http://www.contoso.com"), "**Unknown**");
+ result = c.GetCredential (new Uri("http://www.contoso.com"), "**Unknown**");
+ Assert ("#6", result == null);
+
+ c.Add (new Uri("http://www.contoso.com/portal/"), "**Unknown**", cred1);
+ result = c.GetCredential (new Uri("http://www.contoso.com/portal/foo/bar.html"), "**Unknown**");
+ AssertEquals ("#7", result, cred1);
+ c.Remove (new Uri("http://www.contoso.com"), "**Unknown**");
+ result = c.GetCredential (new Uri("http://www.contoso.com"), "**Unknown**");
+ Assert ("#8", result == null);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news/index.aspx"), "Basic");
+ AssertEquals ("#9", result, cred3);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news/index"), "Basic");
+ AssertEquals ("#10", result, cred3);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news/"), "Basic");
+ AssertEquals ("#11", result, cred3);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/news"), "Basic");
+ AssertEquals ("#12", result, cred4);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/ne"), "Basic");
+ AssertEquals ("#13", result, cred4);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal/"), "Basic");
+ AssertEquals ("#14", result, cred4);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/portal"), "Basic");
+ AssertEquals ("#15", result, cred5);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com:80/"), "Basic");
+ AssertEquals ("#16", result, cred5);
+
+ result = c.GetCredential (new Uri("http://www.contoso.com"), "Basic");
+ AssertEquals ("#17", result, cred5);
+
+ /*
+ IEnumerator e = c.GetEnumerator ();
+ while (e.MoveNext ()) {
+ Console.WriteLine (e.Current.GetType () + " : " + e.Current.ToString ());
+ }
+ */
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/DnsTest.cs b/mcs/class/System/Test/System.Net/DnsTest.cs
new file mode 100644
index 00000000000..804351a8bb7
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/DnsTest.cs
@@ -0,0 +1,172 @@
+// DnsTest.cs - NUnit Test Cases for the System.Net.Dns class
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+//
+// (C) Mads Pultz, 2001
+//
+// This test assumes the following:
+// 1) The following Internet sites exist:
+// www.go-mono.com with IP address 129.250.184.233
+// info.diku.dk with IP address 130.225.96.4
+// 2) The following DNS name does not exist:
+// www.hopefullydoesnotexist.dk
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+using System.Collections;
+
+namespace MonoTests.System.Net {
+
+public class DnsTest: TestCase {
+
+ private String site1Name = "www.go-mono.com",
+ site1Dot = "129.250.184.233",
+ site2Name = "info.diku.dk",
+ site2Dot = "130.225.96.4",
+ noneExistingSite = "www.hopefullydoesnotexist.dk";
+ private uint site1IP = 2180692201, site2IP = 2195808260; // Big-Endian
+
+ public DnsTest(): base("MonoTests.System.Net.DnsTest testsuite") { }
+ public DnsTest(String name): base(name) { }
+
+ public static ITest Suite {
+ get { return new TestSuite(typeof(DnsTest)); }
+ }
+
+ private void Callback(IAsyncResult ar) {
+ IPHostEntry h;
+ h = Dns.EndGetHostByName(ar);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestAsyncGetHostByName(){
+ IAsyncResult r;
+ r = Dns.BeginGetHostByName(site1Name, new AsyncCallback(Callback), null);
+
+ IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);
+ IPHostEntry entry = Dns.EndGetHostByName (async);
+ SubTestValidIPHostEntry(entry);
+ AssertEquals ("#1", "www.go-mono.com", entry.HostName);
+ }
+
+ public void TestAsyncResolve() {
+ IAsyncResult r;
+ r = Dns.BeginResolve(site1Name, new AsyncCallback(Callback), null);
+
+ IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);
+ IPHostEntry entry = Dns.EndResolve (async);
+ SubTestValidIPHostEntry(entry);
+ AssertEquals ("#1", "129.250.184.233", entry.HostName);
+ }
+
+ public void TestGetHostName() {
+ string hostName = Dns.GetHostName();
+ Assert(hostName != null);
+ }
+
+ private void SubTestGetHostByName(string siteName, string siteDot) {
+ IPHostEntry h = Dns.GetHostByName(siteName);
+ SubTestValidIPHostEntry(h);
+ Assert(h.HostName.Equals(siteName));
+ Assert(h.AddressList[0].ToString() == siteDot);
+ }
+
+ public void TestGetHostByName() {
+ SubTestGetHostByName(site1Name, site1Dot);
+ SubTestGetHostByName(site2Name, site2Dot);
+ try {
+ Dns.GetHostByName(noneExistingSite);
+ Fail("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");
+ } catch (SocketException) {
+ }
+ try {
+ Dns.GetHostByName(null);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ }
+
+ private void SubTestGetHostByAddressStringFormatException(string addr) {
+ try {
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise a FormatException");
+ } catch (FormatException) {
+ }
+ }
+
+ private void SubTestGetHostByAddressString(string addr) {
+ IPHostEntry h = Dns.GetHostByAddress(addr);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestGetHostByAddressString() {
+ try {
+ String addr = null;
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ SubTestGetHostByAddressStringFormatException("123.255.23");
+ SubTestGetHostByAddressStringFormatException("123.256.34.10");
+ SubTestGetHostByAddressStringFormatException("not an IP address");
+ SubTestGetHostByAddressString(site1Dot);
+ SubTestGetHostByAddressString(site2Dot);
+ }
+
+ private void SubTestGetHostByAddressIPAddress(IPAddress addr) {
+ IPHostEntry h = Dns.GetHostByAddress(addr);
+ SubTestValidIPHostEntry(h);
+ Assert(h.AddressList[0].ToString() == addr.ToString());
+ }
+
+ public void TestGetHostByAddressIPAddress() {
+ try {
+ IPAddress addr = null;
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site1IP)));
+ SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site2IP)));
+ }
+
+ private void SubTestResolve(string addr) {
+ IPHostEntry h = Dns.Resolve(addr);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestResolve() {
+ SubTestResolve(site1Name);
+ SubTestResolve(site2Name);
+ SubTestResolve(site1Dot);
+ SubTestResolve(site2Dot);
+ }
+
+ private void SubTestValidIPHostEntry(IPHostEntry h) {
+ Assert(h.HostName != null);
+ Assert(h.AddressList != null);
+ Assert(h.AddressList.Length > 0);
+ }
+
+ private static void printIPHostEntry(IPHostEntry h)
+ {
+ Console.WriteLine("----------------------------------------------------");
+ Console.WriteLine("Host name:");
+ Console.WriteLine(h.HostName);
+ Console.WriteLine("IP addresses:");
+ IPAddress[] list = h.AddressList;
+ for(int i = 0; i < list.Length; ++i)
+ Console.WriteLine(list[i]);
+ Console.WriteLine("Aliases:");
+ string[] aliases = h.Aliases;
+ for(int i = 0; i < aliases.Length; ++i)
+ Console.WriteLine(aliases[i]);
+ Console.WriteLine("----------------------------------------------------");
+ }
+}
+
+}
diff --git a/mcs/class/System/Test/System.Net/FileWebRequestTest.cs b/mcs/class/System/Test/System.Net/FileWebRequestTest.cs
new file mode 100644
index 00000000000..ae99aa076a0
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/FileWebRequestTest.cs
@@ -0,0 +1,306 @@
+//
+// FileWebRequestTest.cs - NUnit Test Cases for System.Net.FileWebRequest
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Net;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Net
+{
+
+public class FileWebRequestTest : TestCase
+{
+ public FileWebRequestTest () :
+ base ("[MonoTests.System.Net.FileWebRequestTest]") {}
+
+ public FileWebRequestTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (FileWebRequestTest));
+ }
+ }
+
+
+ public void TestAsync ()
+ {
+ string tmpFilename = GetFilename ();
+ if (tmpFilename == null) {
+ Console.WriteLine ("\n\nSet environment variable TMPDIR to a temporary directory to test FileWebRequest\n");
+ return;
+ }
+
+ try {
+ if (File.Exists (tmpFilename))
+ File.Delete (tmpFilename);
+
+ Uri uri = new Uri ("file:///" + tmpFilename);
+
+ WebRequest req = WebRequest.Create (uri);
+ req.Method = "PUT";
+
+ req.Timeout = 2 * 1000;
+ IAsyncResult async = req.BeginGetRequestStream (null, null);
+ try {
+ req.BeginGetRequestStream (null, null);
+ Fail ("#1 should've failed");
+ } catch (InvalidOperationException) {
+ //Console.WriteLine ("GOT1: " + e.Message + "\n" + e.StackTrace);
+ // Cannot re-call BeginGetRequestStream/BeginGetResponse while
+ // a previous call is still in progress
+ }
+ /*
+ try {
+ req.BeginGetResponse (null, null);
+ Fail ("#2 should've failed");
+ } catch (InvalidOperationException) { }
+ */
+ try {
+ req.GetRequestStream ();
+ Fail ("#3 should've failed");
+ } catch (InvalidOperationException) {
+ // Console.WriteLine ("GOT3: " + e.Message + "\n" + e.StackTrace);
+ // Cannot re-call BeginGetRequestStream/BeginGetResponse while
+ // a previous call is still in progress
+ }
+
+ try {
+ req.GetResponse ();
+ Fail ("#4 should've failed");
+ } catch (WebException) {
+ // Console.WriteLine ("4: " + e.Message + "\n" + e.StackTrace);
+ // The operation has timed out
+ }
+
+ try {
+ IAsyncResult async0 = req.BeginGetResponse (null, null);
+ req.EndGetResponse (async0);
+ // Console.WriteLine ("X5c");
+ Fail ("#5 should've failed");
+ } catch (InvalidOperationException) {
+ // Console.WriteLine ("5e: " + e.Message + "\n" + e.StackTrace);
+ // Cannot re-call BeginGetRequestStream/BeginGetResponse while
+ // a previous call is still in progress
+ }
+
+ // Console.WriteLine ("WEBHEADERS: " + req.Headers);
+
+ Stream wstream = req.EndGetRequestStream (async);
+ AssertEquals ("#1r", false, wstream.CanRead);
+ AssertEquals ("#1w", true, wstream.CanWrite);
+ AssertEquals ("#1s", true, wstream.CanSeek);
+
+ wstream.WriteByte (72);
+ wstream.WriteByte (101);
+ wstream.WriteByte (108);
+ wstream.WriteByte (108);
+ wstream.WriteByte (111);
+ wstream.Close ();
+
+ // stream written
+
+ req = WebRequest.Create (uri);
+ WebResponse res = req.GetResponse ();
+
+ try {
+ req.BeginGetRequestStream (null, null);
+ Fail ("#20: should've failed");
+ } catch (InvalidOperationException) {
+ // Console.WriteLine ("20: " + e.Message + "\n" + e.StackTrace);
+ // Cannot send a content-body with this verb-type
+ }
+
+ try {
+ req.Method = "PUT";
+ req.BeginGetRequestStream (null, null);
+ Fail ("#21: should've failed");
+ } catch (InvalidOperationException) {
+ // Console.WriteLine ("21: " + e.Message + "\n" + e.StackTrace);
+ // This operation cannot be perfomed after the request has been submitted.
+ }
+
+ try {
+ //IAsyncResult async2 = req.BeginGetResponse (null, null);
+ //Console.WriteLine ("OK!");
+ req.GetResponse ();
+ //Fail ("#22: should've failed");
+ } catch (InvalidOperationException) {
+ //Console.WriteLine ("22: " + e.Message + "\n" + e.StackTrace);
+ // Cannot re-call BeginGetRequestStream/BeginGetResponse while
+ // a previous call is still in progress
+ Fail ("#22: should not have failed");
+ }
+
+ try {
+ IAsyncResult async2 = req.BeginGetResponse (null, null);
+
+ // this succeeds !!
+
+ try {
+ WebResponse res2 = req.EndGetResponse (async2);
+
+ // and this succeeds
+
+ AssertEquals ("#23", res, res2) ;
+
+ //Fail ("#23: should've failed");
+ } catch (InvalidOperationException) {
+ //Console.WriteLine ("22: " + e.Message + "\n" + e.StackTrace);
+ // Cannot re-call BeginGetRequestStream/BeginGetResponse while
+ // a previous call is still in progress
+ }
+
+ // Fail ("#22: should've failed");
+ } catch (InvalidOperationException) {
+ }
+
+ AssertEquals ("#2 len", (long) 5, res.ContentLength);
+ AssertEquals ("#2 type", "binary/octet-stream", res.ContentType);
+ AssertEquals ("#2 scheme", "file", res.ResponseUri.Scheme);
+
+ Stream rstream = res.GetResponseStream ();
+ AssertEquals ("#3r", true, rstream.CanRead);
+ AssertEquals ("#3w", false, rstream.CanWrite);
+ AssertEquals ("#3s", true, rstream.CanSeek);
+
+ AssertEquals ("#4a", 72, rstream.ReadByte ());
+ AssertEquals ("#4b", 101, rstream.ReadByte ());
+ AssertEquals ("#4c", 108, rstream.ReadByte ());
+
+ rstream.Close ();
+ // res.Close ();
+
+ try {
+ long len = res.ContentLength;
+ AssertEquals ("#5", (long) 5, len);
+ } catch (ObjectDisposedException) {
+ Fail ("#disposed contentlength");
+ }
+ try {
+ WebHeaderCollection w = res.Headers;
+ } catch (ObjectDisposedException) {
+ Fail ("#disposed headers");
+ }
+ try {
+ res.Close ();
+ } catch (ObjectDisposedException) {
+ Fail ("#disposed close");
+ }
+ } catch (Exception) {
+ // Console.WriteLine ("ERROR! : " + ee.Message + "\n" + ee.StackTrace);
+ } finally {
+ try {
+ // known bug #24940
+ File.Delete (tmpFilename);
+ } catch (Exception) {
+ // Console.WriteLine ("ERROR2! : " + ee2.Message + "\n" + ee2.StackTrace);
+ }
+ }
+ }
+
+ public void TestSync ()
+ {
+ string tmpFilename = GetFilename ();
+ if (tmpFilename == null)
+ return;
+
+ try {
+ if (File.Exists (tmpFilename))
+ File.Delete (tmpFilename);
+
+ Uri uri = new Uri ("file:///" + tmpFilename);
+
+ WebRequest req = WebRequest.Create (uri);
+
+ try {
+ Stream stream = req.GetRequestStream ();
+ Fail ("should throw exception");
+ } catch (ProtocolViolationException) {}
+
+ req.Method = "PUT";
+
+ Stream wstream = req.GetRequestStream ();
+ AssertEquals ("#1r", false, wstream.CanRead);
+ AssertEquals ("#1w", true, wstream.CanWrite);
+ AssertEquals ("#1s", true, wstream.CanSeek);
+
+ wstream.WriteByte (72);
+ wstream.WriteByte (101);
+ wstream.WriteByte (108);
+ wstream.WriteByte (108);
+ wstream.WriteByte (111);
+ wstream.Close ();
+
+ // stream written
+
+ req = WebRequest.Create (uri);
+ WebResponse res = req.GetResponse ();
+ AssertEquals ("#2 len", (long) 5, res.ContentLength);
+ AssertEquals ("#2 type", "binary/octet-stream", res.ContentType);
+ AssertEquals ("#2 scheme", "file", res.ResponseUri.Scheme);
+
+ Stream rstream = res.GetResponseStream ();
+ AssertEquals ("#3r", true, rstream.CanRead);
+ AssertEquals ("#3w", false, rstream.CanWrite);
+ AssertEquals ("#3s", true, rstream.CanSeek);
+
+ AssertEquals ("#4a", 72, rstream.ReadByte ());
+ AssertEquals ("#4b", 101, rstream.ReadByte ());
+ AssertEquals ("#4c", 108, rstream.ReadByte ());
+
+ rstream.Close ();
+ // res.Close ();
+
+ try {
+ long len = res.ContentLength;
+ AssertEquals ("#5", (long) 5, len);
+ } catch (ObjectDisposedException) {
+ Fail ("#disposed contentlength");
+ }
+ try {
+ WebHeaderCollection w = res.Headers;
+ } catch (ObjectDisposedException) {
+ Fail ("#disposed headers");
+ }
+ try {
+ res.Close ();
+ } catch (ObjectDisposedException) {
+ Fail ("#disposed close");
+ }
+
+ } finally {
+ try {
+ File.Delete (tmpFilename);
+ } catch (Exception) { }
+ }
+ }
+
+ private string GetFilename ()
+ {
+ string tmpdir = Environment.GetEnvironmentVariable ("TMPDIR");
+ if (tmpdir == null || tmpdir.Length == 0) {
+ return null;
+ }
+
+ tmpdir = tmpdir.Replace ('\\', '/');
+ if (tmpdir [tmpdir.Length - 1] != '/')
+ tmpdir += "/";
+ return tmpdir + "FileWebRequestTest.tmp";
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
new file mode 100644
index 00000000000..bbbba624b7f
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
@@ -0,0 +1,101 @@
+//
+// HttpWebRequestTest.cs - NUnit Test Cases for System.Net.HttpWebRequest
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Collections;
+
+namespace MonoTests.System.Net
+{
+
+public class HttpWebRequestTest : TestCase
+{
+ public HttpWebRequestTest () :
+ base ("[MonoTests.System.Net.HttpWebRequestTest]") {}
+
+ public HttpWebRequestTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (HttpWebRequestTest));
+ }
+ }
+
+ public void TestSync ()
+ {
+ try {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ req.UserAgent = "MonoClient v1.0";
+ Console.WriteLine ("req:If Modified Since: " + req.IfModifiedSince);
+ WriteHeaders ("req:", req.Headers);
+
+ HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
+ Console.WriteLine ("res:HttpStatusCode: " + res.StatusCode);
+ Console.WriteLine ("res:HttpStatusDescription: " + res.StatusDescription);
+
+ WriteHeaders ("res:", res.Headers);
+ Console.WriteLine("Last Modified: " + res.LastModified);
+
+ WriteCookies ("res:", res.Cookies);
+
+ WriteHeaders ("req:", req.Headers);
+
+ res.Close ();
+ } catch (WebException e) {
+ Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);
+ }
+ }
+
+ public void TestAsync ()
+ {
+ }
+
+ public void TestAddRange ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ req.AddRange (10);
+ req.AddRange (50, 90);
+ req.AddRange ("bytes", 100);
+ req.AddRange ("bytes", 100, 120);
+ AssertEquals ("#1", "bytes=10-,50-90,100-,100-120", req.Headers ["Range"]);
+ try {
+ req.AddRange ("bits", 2000);
+ Fail ("#2");
+ } catch (InvalidOperationException) {}
+ }
+
+ private void WriteHeaders (string label, WebHeaderCollection col)
+ {
+ label += "Headers";
+ if (col.Count == 0)
+ Console.WriteLine (label + "Nothing in web headers collection\n");
+ else
+ Console.WriteLine (label);
+ for (int i = 0; i < col.Count; i++)
+ Console.WriteLine ("\t" + col.GetKey (i) + ": " + col.Get (i));
+ }
+
+ private void WriteCookies (string label, CookieCollection col)
+ {
+ label += "Cookies";
+ if (col.Count == 0)
+ Console.WriteLine (label + "Nothing in cookies collection\n");
+ else
+ Console.WriteLine (label);
+ for (int i = 0; i < col.Count; i++)
+ Console.WriteLine ("\t" + col [i]);
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/IPAddressTest.cs b/mcs/class/System/Test/System.Net/IPAddressTest.cs
new file mode 100644
index 00000000000..6e82828ad22
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/IPAddressTest.cs
@@ -0,0 +1,234 @@
+//
+// IPAddressTest.cs - NUnit Test Cases for System.Net.IPAddress
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace MonoTests.System.Net
+{
+
+public class IPAddressTest : TestCase
+{
+ public IPAddressTest () :
+ base ("[MonoTests.System.Net.IPAddressTest]") {}
+
+ public IPAddressTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(IPAddressTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals ("Any", IPAddress.Any.Address, (long) 0);
+ AssertEquals ("Broadcast", IPAddress.Broadcast.Address, (long) 0xFFFFFFFF);
+ long loopback = IPAddress.HostToNetworkOrder (BitConverter.IsLittleEndian ?
+ 0x7f000001 :
+ 0x0100007f);
+ AssertEquals ("Loopback", IPAddress.Loopback.Address, loopback);
+ AssertEquals ("None", IPAddress.None.Address, (long) 0xFFFFFFFF);
+ }
+
+ public void TestToString ()
+ {
+ IPAddress ip = IPAddress.Parse ("192.168.1.1");
+ AssertEquals ("ToString #1", "192.168.1.1", ip.ToString ());
+ AssertEquals ("ToString #2", "0.0.0.0", IPAddress.Any.ToString ());
+ AssertEquals ("ToString #3", "255.255.255.255", IPAddress.Broadcast.ToString ());
+ AssertEquals ("ToString #4", "127.0.0.1", IPAddress.Loopback.ToString ());
+ AssertEquals ("ToString #5", "255.255.255.255", IPAddress.None.ToString ());
+ }
+
+ public void TestIsLoopback ()
+ {
+ IPAddress ip = IPAddress.Parse ("127.0.0.1");
+ AssertEquals ("IsLoopback #1", true, IPAddress.IsLoopback (ip));
+ }
+
+ public void TestAddress ()
+ {
+ // hm, lame, anything is accepted by ms.net
+ /*
+ try {
+ IPAddress ip1 = new IPAddress (0x0000000100000000);
+ Fail ("#1");
+ } catch (ArgumentOutOfRangeException) {}
+ IPAddress ip = IPAddress.Parse ("127.0.0.1");
+ ip.Address = 0;
+ ip.Address = 0xffffffff;
+ try {
+ ip.Address = -1;
+ Fail ("#2");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ ip.Address = 0x0000000100000000;
+ Fail ("#3");
+ } catch (ArgumentOutOfRangeException) {}
+ */
+ }
+
+ public void TestParseOk ()
+ {
+ IPAddress ip = IPAddress.Parse ("192.168.1.1");
+ Assert ("Parse #1", ip.ToString () == "192.168.1.1");
+
+ ip = IPAddress.Parse ("0xff.0x7f.0x20.0x01");
+ Assert ("Parse #1b", ip.ToString () == "255.127.32.1");
+
+ ip = IPAddress.Parse ("0xff.0x7f.0x20.0xf");
+ Assert ("Parse #1c", ip.ToString () == "255.127.32.15");
+
+ ip = IPAddress.Parse ("0.0.0.0");
+ AssertEquals ("Parse #2", ip, IPAddress.Any);
+
+ ip = IPAddress.Parse ("255.255.255.255");
+ AssertEquals ("Parse #3", ip, IPAddress.Broadcast);
+ AssertEquals ("Parse #4", ip, IPAddress.None);
+
+ ip = IPAddress.Parse ("127.0.0.1");
+ AssertEquals ("Parse #5", IPAddress.IsLoopback (ip), true);
+
+ ip = IPAddress.Parse ("12.1.1.3 ");
+ AssertEquals ("Parse #6", IPAddress.Parse ("12.1.1.3"), ip);
+
+ ip = IPAddress.Parse (" 12.1.1.1");
+ AssertEquals ("Parse #7", IPAddress.Parse ("0.0.0.0"), ip);
+
+ ip = IPAddress.Parse ("12.1 .1.2");
+ AssertEquals ("Parse #8", IPAddress.Parse ("12.0.0.1"), ip);
+
+ ip = IPAddress.Parse (".1.1.6");
+ AssertEquals ("Parse #9", IPAddress.Parse ("0.1.1.6"), ip);
+
+ ip = IPAddress.Parse ("12.1.7");
+ AssertEquals ("Parse #10", IPAddress.Parse ("12.1.0.7"), ip);
+
+ ip = IPAddress.Parse ("12.1.8. ");
+ AssertEquals ("Parse #11", IPAddress.Parse ("12.1.8.0"), ip);
+
+ ip = IPAddress.Parse ("12");
+ AssertEquals ("Parse #12", IPAddress.Parse ("0.0.0.12"), ip);
+
+ ip = IPAddress.Parse ("12.1 foo.1.2.3.4.5.bar");
+ AssertEquals ("Parse #13", IPAddress.Parse ("12.0.0.1"), ip);
+
+ ip = IPAddress.Parse ("12.1.2. ");
+ AssertEquals ("Parse #14", IPAddress.Parse ("12.1.2.0"), ip);
+
+ ip = IPAddress.Parse ("12.. .");
+ AssertEquals ("Parse #15", IPAddress.Parse ("12.0.0.0"), ip);
+
+ ip = IPAddress.Parse (" ");
+ AssertEquals ("Parse #16", IPAddress.Parse ("0.0.0.0"), ip);
+
+ ip = IPAddress.Parse (" foo");
+ AssertEquals ("Parse #17", IPAddress.Parse ("0.0.0.0"), ip);
+ }
+
+ public void TestParseWrong ()
+ {
+ IPAddress ip = IPAddress.None;
+ try {
+ ip = IPAddress.Parse ("12.+1.1.4");
+ Fail("Should raise a FormatException #1");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #1:" + e.ToString());
+ }
+
+ try {
+ ip = IPAddress.Parse ("12.1.-1.5");
+ Fail("Should raise a FormatException #2");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #2:" + e.ToString());
+ }
+
+ try {
+ ip = IPAddress.Parse ("257.1.1.9");
+ Fail("Should raise a FormatException #3");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #3:" + e.ToString());
+ }
+
+ try {
+ ip = IPAddress.Parse (null);
+ Fail("Should raise a ArgumentNullException #1");
+ } catch (ArgumentNullException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #4:" + e.ToString());
+ }
+
+ try {
+ ip = IPAddress.Parse ("12.");
+ Fail ("ParseWrong #5: Should raise a FormatException");
+ } catch (FormatException) {}
+
+ try {
+ ip = IPAddress.Parse ("12.1.2.");
+ Fail ("ParseWrong #6: Should raise a FormatException");
+ } catch (FormatException) {}
+
+ try {
+ ip = IPAddress.Parse ("12...");
+ Fail ("ParseWrong #7: Should raise a FormatException");
+ } catch (FormatException) {}
+ }
+
+ public void TestNetworkHost ()
+ {
+ long [] tested = new long [] { 0, 1, 1, 1};
+ long [] expectedLE = new long [] {0, 256, 16777216, 72057594037927936 };
+ long [] expected;
+
+ expected = BitConverter.IsLittleEndian ? expectedLE : tested;
+
+ short short0 = IPAddress.NetworkToHostOrder ((short) tested [0]);
+ AssertEquals ("NetworkToHostOrder #1", short0, (short) expected [0]);
+ short0 = IPAddress.HostToNetworkOrder (short0);
+ AssertEquals ("HostToNetworkOrder #1", short0, (short) tested [0]);
+
+ int int0 = IPAddress.NetworkToHostOrder ((int) tested [0]);
+ AssertEquals ("NetworkToHostOrder #2", int0, (int) expected [0]);
+ int0 = IPAddress.HostToNetworkOrder (int0);
+ AssertEquals ("HostToNetworkOrder #2", int0, (int) tested [0]);
+
+ long long0 = IPAddress.NetworkToHostOrder (tested [0]);
+ AssertEquals ("NetworkToHostOrder #3", long0, expected [0]);
+ long0 = IPAddress.HostToNetworkOrder (long0);
+ AssertEquals ("HostToNetworkOrder #3", long0, tested [0]);
+
+ short0 = IPAddress.NetworkToHostOrder ((short) tested [1]);
+ AssertEquals ("NetworkToHostOrder #4", short0, (short) expected [1]);
+ short0 = IPAddress.HostToNetworkOrder (short0);
+ AssertEquals ("HostToNetworkOrder #4", short0, (short) tested [1]);
+
+ int0 = IPAddress.NetworkToHostOrder ((int) tested [2]);
+ AssertEquals ("NetworkToHostOrder #5", int0, (int) expected [2]);
+ int0 = IPAddress.HostToNetworkOrder (int0);
+ AssertEquals ("HostToNetworkOrder #5", int0, (int) tested [2]);
+
+ long0 = IPAddress.NetworkToHostOrder (tested [3]);
+ AssertEquals ("NetworkToHostOrder #6", long0, expected [3]);
+ long0 = IPAddress.HostToNetworkOrder (long0);
+ AssertEquals ("HostToNetworkOrder #6", long0, tested [3]);
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/IPEndPointTest.cs b/mcs/class/System/Test/System.Net/IPEndPointTest.cs
new file mode 100644
index 00000000000..fd29c5cac05
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/IPEndPointTest.cs
@@ -0,0 +1,134 @@
+//
+// IPEndPointTest.cs - NUnit Test Cases for System.Net.IPEndPoint
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace MonoTests.System.Net
+{
+
+public class IPEndPointTest : TestCase
+{
+ private const int MyPort = 42;
+ private const int MyMaxPort = 65535;
+ private const int MyMinPort = 0;
+ private const string MyIPAddressString = "192.168.1.1";
+
+ private IPAddress ipAddress;
+ private long ip;
+ private IPEndPoint endPoint1;
+ private IPEndPoint endPoint2;
+
+ public IPEndPointTest () :
+ base ("[MonoTests.System.Net.IPEndPointTest]") {}
+
+ public IPEndPointTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ ipAddress = IPAddress.Parse (MyIPAddressString);
+ ip = ipAddress.Address;
+ endPoint1 = new IPEndPoint (ipAddress, MyPort);
+ endPoint2 = new IPEndPoint (ip, MyPort);
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (IPEndPointTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals ("MinPort", IPEndPoint.MinPort, MyMinPort);
+ AssertEquals ("MaxPort", IPEndPoint.MaxPort, MyMaxPort);
+ }
+
+ public void TestConstructors ()
+ {
+ try {
+ new IPEndPoint (null, 0);
+ Fail ("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ new IPEndPoint (ipAddress, MyMinPort - 1);
+ Fail ("Should raise an ArgumentOutOfRangeException #1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ new IPEndPoint (ipAddress, MyMaxPort + 1);
+ Fail ("Should raise an ArgumentOutOfRangeException #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ try {
+ new IPEndPoint (ip, MyMinPort -1);
+ Fail ("Should raise an ArgumentOutOfRangeException #3");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ new IPEndPoint (ip, MyMaxPort + 1);
+ Fail ("Should raise an ArgumentOutOfRangeException #4");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ }
+
+ public void TestPortProperty ()
+ {
+ try {
+ endPoint1.Port = MyMinPort - 1;
+ Fail ("Should raise an ArgumentOutOfRangeException #1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ endPoint1.Port = MyMaxPort + 1;
+ Fail ("Should raise an ArgumentOutOfRangeException #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ }
+
+ public void TestCreateAndSerialize()
+ {
+ SocketAddress addr = endPoint1.Serialize ();
+ EndPoint endPoint3 = endPoint2.Create (addr);
+ Assert ("#1", endPoint1.Equals (endPoint3));
+
+ IPAddress ipAddress = IPAddress.Parse ("255.255.255.255");
+ IPEndPoint endPoint4 = new IPEndPoint (ipAddress, MyMaxPort);
+ addr = endPoint4.Serialize ();
+ EndPoint endPoint5 = endPoint2.Create(addr);
+ Assert ("#2", endPoint4.Equals (endPoint5));
+ AssertEquals ("#3", endPoint5.ToString (), "255.255.255.255:" + MyMaxPort);
+ }
+
+ public void TestEquals ()
+ {
+ Assert("Equals", endPoint1.Equals (endPoint2));
+ Assert("Not Equals", !endPoint1.Equals (new IPEndPoint (ip, MyPort + 1)));
+ }
+
+ public void TestGetHashCode ()
+ {
+ AssertEquals(endPoint1.GetHashCode(), endPoint2.GetHashCode());
+ }
+
+ public void TestToString ()
+ {
+ AssertEquals("ToString #1", endPoint1.ToString (), MyIPAddressString + ":" + MyPort);
+ AssertEquals("ToString #2", endPoint2.ToString (), MyIPAddressString + ":" + MyPort);
+ }
+
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs b/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs
new file mode 100644
index 00000000000..4dc129a557f
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/ServicePointManagerTest.cs
@@ -0,0 +1,113 @@
+//
+// ServicePointManagerTest.cs - NUnit Test Cases for System.Net.ServicePointManager
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Threading;
+
+namespace MonoTests.System.Net
+{
+
+public class ServicePointManagerTest : TestCase
+{
+ private Uri googleUri;
+ private Uri yahooUri;
+ private Uri apacheUri;
+
+ public ServicePointManagerTest () :
+ base ("[MonoTests.System.Net.ServicePointManagerTest]") {}
+
+ public ServicePointManagerTest (string name) : base (name) {}
+
+ protected override void SetUp () {
+ googleUri = new Uri ("http://www.google.com");
+ yahooUri = new Uri ("http://www.yahoo.com");
+ apacheUri = new Uri ("http://www.apache.org");
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (ServicePointManagerTest));
+ }
+ }
+
+ public void TestMaxServicePointManagers ()
+ {
+ try {
+ AssertEquals ("#1", 0, ServicePointManager.MaxServicePoints);
+
+ DoWebRequest (googleUri);
+ Thread.Sleep (100);
+ DoWebRequest (yahooUri);
+ Thread.Sleep (100);
+ DoWebRequest (apacheUri);
+ Thread.Sleep (100);
+
+ ServicePoint sp = ServicePointManager.FindServicePoint (googleUri);
+ WriteServicePoint (sp);
+ sp = ServicePointManager.FindServicePoint (yahooUri);
+ WriteServicePoint (sp);
+ sp = ServicePointManager.FindServicePoint (apacheUri);
+ WriteServicePoint (sp);
+
+ ServicePointManager.MaxServicePoints = 1;
+
+ sp = ServicePointManager.FindServicePoint (googleUri);
+ WriteServicePoint (sp);
+ sp = ServicePointManager.FindServicePoint (yahooUri);
+ WriteServicePoint (sp);
+ sp = ServicePointManager.FindServicePoint (apacheUri);
+ WriteServicePoint (sp);
+
+ GC.Collect ();
+
+ // hmm... aparently ms.net still has the service points even
+ // though I set it to a max of 1.
+
+ // this should force an exception then...
+ sp = ServicePointManager.FindServicePoint (new Uri ("http://www.microsoft.com"));
+ WriteServicePoint (sp);
+
+ } catch (Exception e) {
+ Fail("The following unexpected Exception was thrown : " + e);
+ }
+ }
+
+ public void TestFindServicePoint ()
+ {
+ ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri));
+ AssertEquals ("#1", apacheUri, sp.Address);
+ AssertEquals ("#2", 2, sp.ConnectionLimit);
+ AssertEquals ("#3", "http", sp.ConnectionName);
+ }
+
+ private void DoWebRequest (Uri uri)
+ {
+ WebRequest.Create (uri).GetResponse ().Close ();
+ }
+
+ private void WriteServicePoint (ServicePoint sp)
+ {
+ Console.WriteLine ("\nAddress: " + sp.Address);
+ Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);
+ Console.WriteLine ("ConnectionName: " + sp.ConnectionName);
+ Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);
+ Console.WriteLine ("IdleSince: " + sp.IdleSince);
+ Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);
+ Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);
+ Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/ServicePointTest.cs b/mcs/class/System/Test/System.Net/ServicePointTest.cs
new file mode 100644
index 00000000000..92290f1854d
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/ServicePointTest.cs
@@ -0,0 +1,171 @@
+//
+// ServicePointTest.cs - NUnit Test Cases for System.Net.ServicePoint
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Threading;
+
+namespace MonoTests.System.Net
+{
+
+public class ServicePointTest : TestCase
+{
+ public ServicePointTest () :
+ base ("[MonoTests.System.Net.ServicePointTest]") {}
+
+ public ServicePointTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (ServicePointTest));
+ }
+ }
+
+ public void TestAll ()
+ {
+ try {
+ ServicePoint p = ServicePointManager.FindServicePoint (new Uri ("mailto:xx@yyy.com"));
+ WriteServicePoint ("A servicepoint that isn't really", p);
+
+ ServicePointManager.MaxServicePoints = 2;
+ ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));
+ try {
+ ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));
+ Fail ("#1");
+ } catch (InvalidOperationException) { }
+ ServicePointManager.MaxServicePoints = 0;
+
+ WriteServicePoint ("google before getting a webrequest", google);
+
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
+
+ WriteServicePoint ("google after getting a response", google);
+ ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));
+ AssertEquals ("#equals", google, google2);
+ res.Close ();
+
+ // in both instances property CurrentConnections is 0 according to ms.net.
+ // let's see what it says when we do async operations...
+
+ HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ req2.Method = "PUT";
+ IAsyncResult async = req2.BeginGetRequestStream (null, null);
+ WriteServicePoint ("after async BeginGetRequestStream", google);
+ // CurrentConnections: 1
+ Stream stream2 = req2.EndGetRequestStream (async);
+ WriteServicePoint ("after async EndGetRequestStream", google);
+ // CurrentConnections: 1
+ stream2.Close ();
+
+ req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+ async = req2.BeginGetResponse (null, null);
+ WriteServicePoint ("after async BeginGetResponse", google);
+ // CurrentConnections: 2
+ WebResponse res2 = req2.EndGetResponse (async);
+ WriteServicePoint ("after async EndGetResponse", google);
+ // CurrentConnections: 0
+ // curious that after you get the webresponse object CurrentConnections is set to 0.
+ // you'd think that you'd still be connected until you close the webresponse..
+ Console.WriteLine ("ContentLength: " + res2.ContentLength);
+ res2.Close ();
+
+
+ // unless of course some buffering is taking place.. let's check
+ Uri uri2 = new Uri ("http://www.apache.org/dist/httpd/httpd-2.0.36.tar.gz");
+ ServicePoint sp2 = ServicePointManager.FindServicePoint (uri2);
+ req2 = (HttpWebRequest) WebRequest.Create (uri2);
+ async = req2.BeginGetResponse (null, null);
+ WriteServicePoint ("Large file: after async BeginGetResponse", sp2);
+ // CurrentConnections: 1
+ res2 = req2.EndGetResponse (async);
+ WriteServicePoint ("Large file: after async EndGetResponse", sp2);
+ // CurrentConnections: 1
+ // and so it shows
+ Console.WriteLine ("ContentLength: " + res2.ContentLength);
+ res2.Close ();
+
+
+ // what's the limit of the cache?
+ req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");
+ res2 = req2.GetResponse ();
+ sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));
+ WriteServicePoint ("apache", sp2);
+ Console.WriteLine ("ContentLength: " + res2.ContentLength);
+ // CurrentConnections: 1
+ res2.Close ();
+ // curious other effect: address is actually the full Uri of the previous request
+ // anyways, buffer is probably 4096 bytes
+
+
+ } catch (WebException e) {
+ Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);
+ }
+ }
+
+ // try getting the stream to 5 web response objects
+ // while ConnectionLimit equals 2
+ /*
+ public void TestConnectionLimit ()
+ {
+ try {
+ // the default is already 2, just in case it isn't..
+ ServicePointManager.DefaultConnectionLimit = 2;
+
+ Uri uri = new Uri ("http://www.apache.org/dist/httpd/httpd-2.0.36.tar.gz");
+ ServicePoint sp = ServicePointManager.FindServicePoint (uri);
+ WebResponse [] res = new WebResponse [5];
+ for (int i = 0; i < 5; i++) {
+ Console.WriteLine ("GOT1 : " + i);
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
+ Console.WriteLine ("GOT2 : " + i);
+ res [i] = req.GetResponse ();
+ WriteServicePoint ("after getting " + (i + 1) + " web response objects", sp);
+ }
+
+ for (int i = 0; i < 5; i++) {
+ Stream stream = res [i].GetResponseStream();
+ Console.WriteLine ("Reading stream: " + i + " : " + stream);
+ int len = 0;
+ while (stream.ReadByte () != -1)
+ len++;
+ Console.WriteLine ("Finished reading: " + len + " bytes");
+ }
+
+ for (int i = 0; i < 5; i++) {
+ res [i].Close ();
+ }
+ } catch (WebException e) {
+ Console.WriteLine("\nThe following Exception was raised : {0}", e.Message);
+ }
+ }
+ */
+
+ private void WriteServicePoint (string label, ServicePoint sp)
+ {
+ Console.WriteLine ("\n" + label);
+ Console.WriteLine ("Address: " + sp.Address);
+ Console.WriteLine ("ConnectionLimit: " + sp.ConnectionLimit);
+ Console.WriteLine ("ConnectionName: " + sp.ConnectionName);
+ Console.WriteLine ("CurrentConnections: " + sp.CurrentConnections);
+ Console.WriteLine ("IdleSince: " + sp.IdleSince);
+ Console.WriteLine ("MaxIdletime: " + sp.MaxIdleTime);
+ Console.WriteLine ("ProtocolVersion: " + sp.ProtocolVersion);
+ Console.WriteLine ("SupportsPipelining: " + sp.SupportsPipelining);
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/SocketPermissionTest.cs b/mcs/class/System/Test/System.Net/SocketPermissionTest.cs
new file mode 100644
index 00000000000..36137fdee8d
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/SocketPermissionTest.cs
@@ -0,0 +1,113 @@
+//
+// SocketPermissionTest.cs - NUnit Test Cases for System.Net.SocketPermission
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Net
+{
+
+public class SocketPermissionTest : TestCase
+{
+ SocketPermission s1;
+ SocketPermission s2;
+
+ public SocketPermissionTest () :
+ base ("[MonoTests.System.Net.SocketPermissionTest]") {}
+
+ public SocketPermissionTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ s1 = new SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "12.13.14.15", 80);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "localhost", 8080);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "123", SocketPermission.AllPorts);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "www.ximian.com", SocketPermission.AllPorts);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "120.4.3.2", SocketPermission.AllPorts);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.google.com", 80);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "1.*.10.*.99", SocketPermission.AllPorts);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "128.0.0.1", SocketPermission.AllPorts);
+ //s1.AddPermission(NetworkAccess.Accept, TransportType.All, "0.0.0.0", SocketPermission.AllPorts);
+ s1.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.4.*", SocketPermission.AllPorts);
+
+ s2 = new SocketPermission(NetworkAccess.Connect, TransportType.All, "12.13.14.15", 80);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "localhost", 8080);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "123", 8080);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.google.com", SocketPermission.AllPorts);
+ s2.AddPermission(NetworkAccess.Accept, TransportType.All, "213.*.*.*", SocketPermission.AllPorts);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "128.0.0.1", 9090);
+ s2.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "216.239.*.*", SocketPermission.AllPorts);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "128.0.0.1", SocketPermission.AllPorts);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "120.4.3.2", 80);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "196.*.*.*", SocketPermission.AllPorts);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "1.*.*.*.99", SocketPermission.AllPorts);
+ s2.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.*.*", 9090);
+ //s2.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.4.7", SocketPermission.AllPorts);
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (SocketPermissionTest));
+ }
+ }
+
+ public void TestIsSubsetOf ()
+ {
+ s1 = new SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "12.13.14.15", 80);
+ s1.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.4.*", SocketPermission.AllPorts);
+ s2 = new SocketPermission(NetworkAccess.Connect, TransportType.All, "12.13.14.15", 80);
+ s2.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.*.*", 9090);
+
+ Assert ("#1", !s1.IsSubsetOf (s2));
+ Assert ("#2", !s2.IsSubsetOf (s1));
+
+ s1 = new SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "12.13.14.15", 80);
+ s1.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.4.*", 9090);
+ s2 = new SocketPermission(NetworkAccess.Connect, TransportType.All, "12.13.14.15", 80);
+ s2.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.*.*", 9090);
+
+ Assert ("#3: bug in MS.Net", s1.IsSubsetOf (s2));
+ Assert ("#4", !s2.IsSubsetOf (s1));
+
+ s1 = new SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "12.13.*.*", 80);
+ s2 = new SocketPermission(NetworkAccess.Connect, TransportType.All, "12.13.14.*", 80);
+ Assert ("#5", !s1.IsSubsetOf (s2));
+ Assert ("#6", !s2.IsSubsetOf (s1));
+
+ s1 = new SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "12.13.14.15", 80);
+ s1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "10.11.*.*", 9090);
+ s2 = new SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "12.13.14.15", 80);
+ s2.AddPermission(NetworkAccess.Accept, TransportType.All, "10.11.4.*", SocketPermission.AllPorts);
+ Assert ("#7", !s1.IsSubsetOf (s2));
+ Assert ("#8", !s2.IsSubsetOf (s1));
+ }
+
+ public void TestIntersect ()
+ {
+ }
+
+ public void TestUnion ()
+ {
+ }
+
+ public void TestXml ()
+ {
+ SecurityElement elem = s2.ToXml ();
+ s1.FromXml (elem);
+ Assert ("#1", s2.IsSubsetOf (s1) && s1.IsSubsetOf (s2));
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs b/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs
new file mode 100644
index 00000000000..32d22cb30f3
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs
@@ -0,0 +1,213 @@
+//
+// WebHeaderCollectionTest.cs - NUnit Test Cases for System.Net.WebHeaderCollection
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Collections;
+
+namespace MonoTests.System.Net
+{
+
+public class WebHeaderCollectionTest : TestCase
+{
+ WebHeaderCollection col;
+
+ public WebHeaderCollectionTest () :
+ base ("[MonoTests.System.Net.WebHeaderCollectionTest]") {}
+
+ public WebHeaderCollectionTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ col = new WebHeaderCollection ();
+ col.Add ("Name1: Value1");
+ col.Add ("Name2: Value2");
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (WebHeaderCollectionTest));
+ }
+ }
+
+ public void TestAdd ()
+ {
+ try {
+ col.Add (null);
+ Fail ("#1");
+ } catch (ArgumentNullException) {}
+ try {
+ col.Add ("");
+ Fail ("#2");
+ } catch (ArgumentException) {}
+ try {
+ col.Add (" ");
+ Fail ("#3");
+ } catch (ArgumentException) {}
+ try {
+ col.Add (":");
+ Fail ("#4");
+ } catch (ArgumentException) {}
+ try {
+ col.Add (" : ");
+ Fail ("#5");
+ } catch (ArgumentException) {}
+
+ try {
+ col.Add ("XHost: foo");
+ } catch (ArgumentException) {
+ Fail ("#7");
+ }
+
+ // invalid values
+ try {
+ col.Add ("XHost" + ((char) 0xa9) + ": foo");
+ Fail ("#8");
+ } catch (ArgumentException) {}
+ try {
+ col.Add ("XHost: foo" + (char) 0xa9);
+ } catch (ArgumentException) {
+ Fail ("#9");
+ }
+ try {
+ col.Add ("XHost: foo" + (char) 0x7f);
+ Fail ("#10");
+ } catch (ArgumentException) {
+
+ }
+
+ try {
+ col.Add ("XHost", null);
+ } catch (ArgumentException) {
+ Fail ("#11");
+ }
+ try {
+ col.Add ("XHost:");
+ } catch (ArgumentException) {
+ Fail ("#12");
+ }
+
+ // restricted
+ /*
+ // this can only be tested in namespace System.Net
+ try {
+ WebHeaderCollection col2 = new WebHeaderCollection (true);
+ col2.Add ("Host: foo");
+ Fail ("#13: should fail according to spec");
+ } catch (ArgumentException) {}
+ */
+ }
+
+ public void TestGetValues ()
+ {
+ WebHeaderCollection w = new WebHeaderCollection ();
+ w.Add ("Hello", "H1");
+ w.Add ("Hello", "H2");
+ w.Add ("Hello", "H3,H4");
+
+ string [] sa = w.GetValues ("Hello");
+ AssertEquals ("#1", 3, sa.Length);
+ AssertEquals ("#2", "H1,H2,H3,H4", w.Get ("Hello"));
+
+ w = new WebHeaderCollection ();
+ w.Add ("Accept", "H1");
+ w.Add ("Accept", "H2");
+ w.Add ("Accept", "H3,H4");
+ AssertEquals ("#3a", 3, w.GetValues (0).Length);
+ AssertEquals ("#3b", 4, w.GetValues ("Accept").Length);
+ AssertEquals ("#4", "H1,H2,H3,H4", w.Get ("Accept"));
+
+ w = new WebHeaderCollection ();
+ w.Add ("Allow", "H1");
+ w.Add ("Allow", "H2");
+ w.Add ("Allow", "H3,H4");
+ sa = w.GetValues ("Allow");
+ AssertEquals ("#5", 4, sa.Length);
+ AssertEquals ("#6", "H1,H2,H3,H4", w.Get ("Allow"));
+
+ w = new WebHeaderCollection ();
+ w.Add ("AUTHorization", "H1, H2, H3");
+ sa = w.GetValues ("authorization");
+ AssertEquals ("#9", 3, sa.Length);
+
+ w = new WebHeaderCollection ();
+ w.Add ("proxy-authenticate", "H1, H2, H3");
+ sa = w.GetValues ("Proxy-Authenticate");
+ AssertEquals ("#9", 3, sa.Length);
+
+ w = new WebHeaderCollection ();
+ w.Add ("expect", "H1,\tH2, H3 ");
+ sa = w.GetValues ("EXPECT");
+ AssertEquals ("#10", 3, sa.Length);
+ AssertEquals ("#11", "H2", sa [1]);
+ AssertEquals ("#12", "H3", sa [2]);
+
+ try {
+ w.GetValues (null);
+ Fail ("#13");
+ } catch (ArgumentNullException) {}
+ AssertEquals ("#14", null, w.GetValues (""));
+ AssertEquals ("#15", null, w.GetValues ("NotExistent"));
+ }
+
+ public void TestIndexers ()
+ {
+ AssertEquals ("#1", "Value1", col [0]);
+ AssertEquals ("#2", "Value1", col ["Name1"]);
+ AssertEquals ("#3", "Value1", col ["NAME1"]);
+ }
+
+ public void TestRemove ()
+ {
+ col.Remove ("Name1");
+ col.Remove ("NameNotExist");
+ AssertEquals ("#1", 1, col.Count);
+
+ /*
+ // this can only be tested in namespace System.Net
+ try {
+ WebHeaderCollection col2 = new WebHeaderCollection (true);
+ col2.Add ("Host", "foo");
+ col2.Remove ("Host");
+ Fail ("#2: should fail according to spec");
+ } catch (ArgumentException) {}
+ */
+ }
+
+ public void TestSet ()
+ {
+ col.Add ("Name1", "Value1b");
+ col.Set ("Name1", "\t X \t");
+ AssertEquals ("#1", "X", col.Get ("Name1"));
+ }
+
+ public void TestIsRestricted ()
+ {
+ Assert ("#1", !WebHeaderCollection.IsRestricted ("Xhost"));
+ Assert ("#2", WebHeaderCollection.IsRestricted ("Host"));
+ Assert ("#3", WebHeaderCollection.IsRestricted ("HOST"));
+ Assert ("#4", WebHeaderCollection.IsRestricted ("Transfer-Encoding"));
+ Assert ("#5", WebHeaderCollection.IsRestricted ("user-agent"));
+ Assert ("#6", WebHeaderCollection.IsRestricted ("accept"));
+ Assert ("#7", !WebHeaderCollection.IsRestricted ("accept-charset"));
+ }
+
+ public void TestToString ()
+ {
+ col.Add ("Name1", "Value1b");
+ col.Add ("Name3", "Value3a\r\n Value3b");
+ col.Add ("Name4", " Value4 ");
+ AssertEquals ("#1", "Name1: Value1,Value1b\r\nName2: Value2\r\nName3: Value3a\r\n Value3b\r\nName4: Value4\r\n\r\n", col.ToString ());
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/WebProxyTest.cs b/mcs/class/System/Test/System.Net/WebProxyTest.cs
new file mode 100644
index 00000000000..866a7a414a3
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/WebProxyTest.cs
@@ -0,0 +1,180 @@
+//
+// WebProxyTest.cs - NUnit Test Cases for System.Net.WebProxy
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Threading;
+
+namespace MonoTests.System.Net
+{
+
+public class WebProxyTest : TestCase
+{
+ private Uri googleUri;
+ private Uri yahooUri;
+ private Uri apacheUri;
+
+ public WebProxyTest () :
+ base ("[MonoTests.System.Net.WebProxyTest]") {}
+
+ public WebProxyTest (string name) : base (name) {}
+
+ protected override void SetUp () {
+ googleUri = new Uri ("http://www.google.com");
+ yahooUri = new Uri ("http://www.yahoo.com");
+ apacheUri = new Uri ("http://www.apache.org");
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (WebProxyTest));
+ }
+ }
+
+ public void TestConstructors ()
+ {
+ WebProxy p = new WebProxy ();
+ Assert("#1", p.Address == null);
+ AssertEquals ("#2", 0, p.BypassArrayList.Count);
+ AssertEquals ("#3", 0, p.BypassList.Length);
+ AssertEquals ("#4", false, p.BypassProxyOnLocal);
+ try {
+ p.BypassList = null;
+ Fail ("#5 not spec'd, but should follow ms.net implementation");
+ } catch (ArgumentNullException) {}
+
+ p = new WebProxy ("webserver.com", 8080);
+ AssertEquals ("#6", new Uri ("http://webserver.com:8080/"), p.Address);
+
+ p = new WebProxy ("webserver");
+ AssertEquals ("#7", new Uri ("http://webserver"), p.Address);
+
+ p = new WebProxy ("webserver.com");
+ AssertEquals ("#8", new Uri ("http://webserver.com"), p.Address);
+
+ p = new WebProxy ("http://webserver.com");
+ AssertEquals ("#9", new Uri ("http://webserver.com"), p.Address);
+
+ p = new WebProxy ("file://webserver");
+ AssertEquals ("#10", new Uri ("file://webserver"), p.Address);
+
+ p = new WebProxy ("http://www.contoso.com", true, null, null);
+ AssertEquals ("#11", 0, p.BypassList.Length);
+ AssertEquals ("#12", 0, p.BypassArrayList.Count);
+
+ try {
+ p = new WebProxy ("http://contoso.com", true,
+ new string [] {"?^!@#$%^&}{]["}, null);
+ Fail ("#13: illegal regular expression");
+ } catch (ArgumentException) {
+ }
+ }
+
+ public void TestBypassArrayList ()
+ {
+ Uri proxy1 = new Uri("http://proxy.contoso.com");
+ Uri proxy2 = new Uri ("http://proxy2.contoso.com");
+
+ WebProxy p = new WebProxy (proxy1, true);
+ p.BypassArrayList.Add ("http://proxy2.contoso.com");
+ p.BypassArrayList.Add ("http://proxy2.contoso.com");
+ AssertEquals ("#1", 2, p.BypassList.Length);
+ Assert ("#2", !p.IsBypassed (new Uri ("http://www.google.com")));
+ Assert ("#3", p.IsBypassed (proxy2));
+ AssertEquals ("#4", proxy2, p.GetProxy (proxy2));
+
+ p.BypassArrayList.Add ("?^!@#$%^&}{][");
+ AssertEquals ("#10", 3, p.BypassList.Length);
+ try {
+ Assert ("#11", !p.IsBypassed (proxy2));
+ Assert ("#12", !p.IsBypassed (new Uri ("http://www.x.com")));
+ AssertEquals ("#13", proxy1, p.GetProxy (proxy2));
+ // hmm... although #11 and #13 succeeded before (#3 resp. #4),
+ // it now fails to bypass, and the IsByPassed and GetProxy
+ // methods do not fail.. so when an illegal regular
+ // expression is added through this property it's ignored.
+ // probably an ms.net bug?? :(
+ } catch (ArgumentException) {
+ Fail ("#15: illegal regular expression");
+ }
+ }
+
+ public void TestBypassList ()
+ {
+ Uri proxy1 = new Uri("http://proxy.contoso.com");
+ Uri proxy2 = new Uri ("http://proxy2.contoso.com");
+
+ WebProxy p = new WebProxy (proxy1, true);
+ try {
+ p.BypassList = new string [] {"http://proxy2.contoso.com", "?^!@#$%^&}{]["};
+ Fail ("#1");
+ } catch (ArgumentException) {
+ // weird, this way invalid regex's fail again..
+ }
+
+ AssertEquals ("#2", 2, p.BypassList.Length);
+ // but it did apparenly store the regex's !
+
+ p.BypassList = new string [] {"http://www.x.com"};
+ AssertEquals ("#3", 1, p.BypassList.Length);
+
+ try {
+ p.BypassList = null;
+ Fail ("#4");
+ } catch (ArgumentNullException) {}
+
+ AssertEquals ("#4", 1, p.BypassList.Length);
+ }
+
+ public void TestGetProxy ()
+ {
+ }
+
+ public void TestIsByPassed ()
+ {
+ WebProxy p = new WebProxy ("http://proxy.contoso.com", true);
+ Assert ("#1", !p.IsBypassed (new Uri ("http://www.google.com")));
+ Assert ("#2", p.IsBypassed (new Uri ("http://localhost/index.html")));
+ Assert ("#3", p.IsBypassed (new Uri ("http://localhost:8080/index.html")));
+ Assert ("#4", p.IsBypassed (new Uri ("http://loopback:8080/index.html")));
+ Assert ("#5", p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")));
+ Assert ("#6", p.IsBypassed (new Uri ("http://webserver/index.html")));
+ Assert ("#7", !p.IsBypassed (new Uri ("http://webserver.com/index.html")));
+ try {
+ p.IsBypassed (null);
+ Fail ("#8 not spec'd, but should follow ms.net implementation");
+ } catch (NullReferenceException) {}
+
+ p = new WebProxy ("http://proxy.contoso.com", false);
+ Assert ("#11", !p.IsBypassed (new Uri ("http://www.google.com")));
+ Assert ("#12: lamespec of ms.net", p.IsBypassed (new Uri ("http://localhost/index.html")));
+ Assert ("#13: lamespec of ms.net", p.IsBypassed (new Uri ("http://localhost:8080/index.html")));
+ Assert ("#14: lamespec of ms.net", p.IsBypassed (new Uri ("http://loopback:8080/index.html")));
+ Assert ("#15: lamespec of ms.net", p.IsBypassed (new Uri ("http://127.0.0.01:8080/index.html")));
+ Assert ("#16", !p.IsBypassed (new Uri ("http://webserver/index.html")));
+
+ p.BypassList = new string [] { "google.com", "contoso.com" };
+ Assert ("#20", p.IsBypassed (new Uri ("http://www.google.com")));
+ Assert ("#21", p.IsBypassed (new Uri ("http://www.GOOGLE.com")));
+ Assert ("#22", p.IsBypassed (new Uri ("http://www.contoso.com:8080/foo/bar/index.html")));
+ Assert ("#23", !p.IsBypassed (new Uri ("http://www.contoso2.com:8080/foo/bar/index.html")));
+ Assert ("#24", !p.IsBypassed (new Uri ("http://www.foo.com:8080/contoso.com.html")));
+
+ p.BypassList = new string [] { "https" };
+ Assert ("#30", !p.IsBypassed (new Uri ("http://www.google.com")));
+ Assert ("#31", p.IsBypassed (new Uri ("https://www.google.com")));
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/WebRequestTest.cs b/mcs/class/System/Test/System.Net/WebRequestTest.cs
new file mode 100644
index 00000000000..e3f640e936d
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/WebRequestTest.cs
@@ -0,0 +1,122 @@
+//
+// WebRequestTest.cs - NUnit Test Cases for System.Net.WebRequest
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Net
+{
+
+public class WebRequestTest : TestCase
+{
+ public WebRequestTest () :
+ base ("[MonoTests.System.Net.WebRequestTest]") {}
+
+ public WebRequestTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (WebRequestTest));
+ }
+ }
+
+ public void TestAll ()
+ {
+ WebRequest req = WebRequest.Create ("http://www.contoso.com");
+ Assert ("#1", req is HttpWebRequest);
+ req = WebRequest.Create ("https://www.contoso.com");
+ Assert ("#2", req is HttpWebRequest);
+ req = WebRequest.Create ("file://www.contoso.com");
+ Assert ("#3", req is FileWebRequest);
+
+ WebRequest.RegisterPrefix ("http://www.contoso.com", new TestWebRequestCreator ());
+ bool ret = WebRequest.RegisterPrefix ("http://WWW.contoso.com", new TestWebRequestCreator ());
+ AssertEquals ("#4a", false, ret);
+ ret = WebRequest.RegisterPrefix ("http://www.contoso.com/foo/bar", new TestWebRequestCreator2 ());
+ AssertEquals ("#4b", true, ret);
+ ret = WebRequest.RegisterPrefix ("http://www", new TestWebRequestCreator3 ());
+ AssertEquals ("#4c", true, ret);
+
+ req = WebRequest.Create ("http://WWW.contoso.com");
+ Assert ("#5", req is TestWebRequest);
+
+ req = WebRequest.Create ("http://WWW.contoso.com/foo/bar/index.html");
+ Assert ("#6", req is TestWebRequest2);
+
+ req = WebRequest.Create ("http://WWW.x.com");
+ Assert ("#7", req is TestWebRequest3);
+
+ req = WebRequest.Create ("http://WWW.c");
+ Assert ("#8", req is TestWebRequest3);
+
+ req = WebRequest.CreateDefault (new Uri("http://WWW.contoso.com"));
+ Assert ("#9", req is HttpWebRequest);
+
+ try {
+ req = WebRequest.Create ("tcp://www.contoso.com");
+ Fail ("#10 should have failed with NotSupportedException");
+ } catch (NotSupportedException) {
+ }
+ }
+
+ internal class TestWebRequestCreator : IWebRequestCreate
+ {
+ internal TestWebRequestCreator () { }
+
+ public WebRequest Create (Uri uri)
+ {
+ return new TestWebRequest ();
+ }
+ }
+
+ internal class TestWebRequest : WebRequest
+ {
+ internal TestWebRequest () { }
+ }
+
+ internal class TestWebRequestCreator2 : IWebRequestCreate
+ {
+ internal TestWebRequestCreator2 () { }
+
+ public WebRequest Create (Uri uri)
+ {
+ return new TestWebRequest2 ();
+ }
+ }
+
+ internal class TestWebRequest2 : WebRequest
+ {
+ internal TestWebRequest2 () { }
+ }
+
+ internal class TestWebRequestCreator3 : IWebRequestCreate
+ {
+ internal TestWebRequestCreator3 () { }
+
+ public WebRequest Create (Uri uri)
+ {
+ return new TestWebRequest3 ();
+ }
+ }
+
+ internal class TestWebRequest3 : WebRequest
+ {
+ internal TestWebRequest3 () { }
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs b/mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs
new file mode 100644
index 00000000000..6016eeef70a
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs
@@ -0,0 +1,26 @@
+//
+// assembly: System_test
+// namespace: MonoTests.System.Text.RegularExpressions
+// file: AllTests.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Text.RegularExpressions {
+
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) { }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (PerlTest.Suite);
+
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
new file mode 100644
index 00000000000..f09681a91cc
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
@@ -0,0 +1,40 @@
+//
+// assembly: System_test
+// namespace: MonoTests.System.Text.RegularExpressions
+// file: PerlTest.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Text.RegularExpressions;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Text.RegularExpressions {
+
+ public class PerlTest : TestCase {
+ public static ITest Suite {
+ get { return new TestSuite (typeof (PerlTest)); }
+ }
+
+ public PerlTest () : this ("System.Text.RegularExpressions Perl testsuite") { }
+ public PerlTest (string name) : base (name) { }
+
+ public void TestTrials () {
+ foreach (RegexTrial trial in PerlTrials.trials) {
+ string actual = trial.Execute ();
+ if (actual != trial.Expected) {
+ Assertion.Fail (
+ trial.ToString () +
+ "Expected " + trial.Expected +
+ " but got " + actual
+ );
+ }
+ }
+ }
+
+ protected override void SetUp () { }
+ protected override void TearDown () { }
+ }
+}
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
new file mode 100644
index 00000000000..eecb7a454c5
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
@@ -0,0 +1,746 @@
+//
+// assembly: System_test
+// namespace: MonoTests.System.Text.RegularExpressions
+// file: PerlTrials.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System.Text.RegularExpressions;
+
+namespace MonoTests.System.Text.RegularExpressions {
+
+ class PerlTrials {
+ // ported from perl-5.6.1/t/op/re_tests
+
+ public static RegexTrial[] trials = new RegexTrial[] {
+ new RegexTrial (@"abc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.None, "xbc", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.None, "axc", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.None, "abx", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.None, "xabcy", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"abc", RegexOptions.None, "ababc", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"ab*c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.None, "abbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab*bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@".{1}", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@".{3,4}", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab{0,}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abc", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abq", "Fail."),
+ new RegexTrial (@"ab{1,}bc", RegexOptions.None, "abq", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,3}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{3,4}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{4,5}bc", RegexOptions.None, "abbbbc", "Fail."),
+ new RegexTrial (@"ab?bc", RegexOptions.None, "abbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab?bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab?bc", RegexOptions.None, "abbbbc", "Fail."),
+ new RegexTrial (@"ab?c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.None, "abcc", "Fail."),
+ new RegexTrial (@"^abc", RegexOptions.None, "abcc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.None, "aabc", "Fail."),
+ new RegexTrial (@"abc$", RegexOptions.None, "aabc", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"abc$", RegexOptions.None, "aabcd", "Fail."),
+ new RegexTrial (@"^", RegexOptions.None, "abc", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "abc", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"a.c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.c", RegexOptions.None, "axc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.*c", RegexOptions.None, "axyzc", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"a.*c", RegexOptions.None, "axyzd", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.None, "abc", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.None, "abd", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]e", RegexOptions.None, "abd", "Fail."),
+ new RegexTrial (@"a[b-d]e", RegexOptions.None, "ace", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]", RegexOptions.None, "aac", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"a[-b]", RegexOptions.None, "a-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-]", RegexOptions.None, "a-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-a]", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a[]b", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a[", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a]", RegexOptions.None, "a]", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[]]b", RegexOptions.None, "a]b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.None, "aed", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.None, "abd", "Fail."),
+ new RegexTrial (@"a[^-b]c", RegexOptions.None, "adc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^-b]c", RegexOptions.None, "a-c", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.None, "a]c", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.None, "adc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"\ba\b", RegexOptions.None, "a-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\ba\b", RegexOptions.None, "-a", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\ba\b", RegexOptions.None, "-a-", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\by\b", RegexOptions.None, "xy", "Fail."),
+ new RegexTrial (@"\by\b", RegexOptions.None, "yz", "Fail."),
+ new RegexTrial (@"\by\b", RegexOptions.None, "xyz", "Fail."),
+ new RegexTrial (@"\Ba\B", RegexOptions.None, "a-", "Fail."),
+ new RegexTrial (@"\Ba\B", RegexOptions.None, "-a", "Fail."),
+ new RegexTrial (@"\Ba\B", RegexOptions.None, "-a-", "Fail."),
+ new RegexTrial (@"\By\b", RegexOptions.None, "xy", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\by\B", RegexOptions.None, "yz", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\By\B", RegexOptions.None, "xyz", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\w", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\w", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"\W", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"\W", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"a\sb", RegexOptions.None, "a b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a\sb", RegexOptions.None, "a-b", "Fail."),
+ new RegexTrial (@"a\Sb", RegexOptions.None, "a b", "Fail."),
+ new RegexTrial (@"a\Sb", RegexOptions.None, "a-b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"\d", RegexOptions.None, "1", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\d", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"\D", RegexOptions.None, "1", "Fail."),
+ new RegexTrial (@"\D", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"[\w]", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"[\w]", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"[\W]", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"[\W]", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"a[\s]b", RegexOptions.None, "a b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[\s]b", RegexOptions.None, "a-b", "Fail."),
+ new RegexTrial (@"a[\S]b", RegexOptions.None, "a b", "Fail."),
+ new RegexTrial (@"a[\S]b", RegexOptions.None, "a-b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"[\d]", RegexOptions.None, "1", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"[\d]", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"[\D]", RegexOptions.None, "1", "Fail."),
+ new RegexTrial (@"[\D]", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"ab|cd", RegexOptions.None, "abc", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"ab|cd", RegexOptions.None, "abcd", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"()ef", RegexOptions.None, "def", "Pass. Group[0]=(1,2) Group[1]=(1,0)"),
+ new RegexTrial (@"*a", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(*)b", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"$b", RegexOptions.None, "b", "Fail."),
+ new RegexTrial (@"a\", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a\(b", RegexOptions.None, "a(b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a\(*b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a\(*b", RegexOptions.None, "a((b", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a\\b", RegexOptions.None, "a\\b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc)", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(abc", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"((a))", RegexOptions.None, "abc", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"(a)b(c)", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)"),
+ new RegexTrial (@"a+b+c", RegexOptions.None, "aabbabc", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a{1,}b{1,}c", RegexOptions.None, "aabbabc", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a**", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a.+?c", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"(a+|b)*", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){0,}", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)+", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){1,}", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)?", RegexOptions.None, "ab", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a+|b){0,1}", RegexOptions.None, "ab", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@")(", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"[^ab]*", RegexOptions.None, "cde", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.None, "", "Fail."),
+ new RegexTrial (@"a*", RegexOptions.None, "", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"([abc])*d", RegexOptions.None, "abbbcd", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)"),
+ new RegexTrial (@"([abc])*bcd", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(0,1)"),
+ new RegexTrial (@"a|b|c|d|e", RegexOptions.None, "e", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(a|b|c|d|e)f", RegexOptions.None, "ef", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"abcd*efg", RegexOptions.None, "abcdefg", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"ab*", RegexOptions.None, "xabyabbbz", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"ab*", RegexOptions.None, "xayabbbz", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(ab|cd)e", RegexOptions.None, "abcde", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"[abhgefdc]ij", RegexOptions.None, "hij", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^(ab|cd)e", RegexOptions.None, "abcde", "Fail."),
+ new RegexTrial (@"(abc|)ef", RegexOptions.None, "abcdef", "Pass. Group[0]=(4,2) Group[1]=(4,0)"),
+ new RegexTrial (@"(a|b)c*d", RegexOptions.None, "abcd", "Pass. Group[0]=(1,3) Group[1]=(1,1)"),
+ new RegexTrial (@"(ab|ab*)bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,1)"),
+ new RegexTrial (@"a([bc]*)c*", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(1,2)"),
+ new RegexTrial (@"a([bc]*)(c*d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]+)(c*d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]*)(c+d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)"),
+ new RegexTrial (@"a[bcd]*dcdcde", RegexOptions.None, "adcdcde", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"a[bcd]+dcdcde", RegexOptions.None, "adcdcde", "Fail."),
+ new RegexTrial (@"(ab|a)b*c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,2)"),
+ new RegexTrial (@"((a)(b)c)(d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)"),
+ new RegexTrial (@"[a-zA-Z_][a-zA-Z0-9_]*", RegexOptions.None, "alpha", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^a(bc+|b[eh])g|.h$", RegexOptions.None, "abh", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "effgz", "Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "ij", "Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)"),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "effg", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "bcdd", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "reffgz", "Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]="),
+ new RegexTrial (@"((((((((((a))))))))))", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))\10", RegexOptions.None, "aa", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.None, "aa", "Fail."),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.None, "a!", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"(((((((((a)))))))))", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)"),
+ new RegexTrial (@"multiple words of text", RegexOptions.None, "uh-uh", "Fail."),
+ new RegexTrial (@"multiple words", RegexOptions.None, "multiple words, yeah", "Pass. Group[0]=(0,14)"),
+ new RegexTrial (@"(.*)c(.*)", RegexOptions.None, "abcde", "Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)"),
+ new RegexTrial (@"\((.*), (.*)\)", RegexOptions.None, "(a, b)", "Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)"),
+ new RegexTrial (@"[k]", RegexOptions.None, "ab", "Fail."),
+ new RegexTrial (@"abcd", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a(bc)d", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2)"),
+ new RegexTrial (@"a[-]?c", RegexOptions.None, "ac", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"(abc)\1", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"([a-c]*)\1", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"\1", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"\2", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(a)|\1", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a)|\1", RegexOptions.None, "x", "Fail."),
+ new RegexTrial (@"(a)|\2", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(([a-c])b*?\2)*", RegexOptions.None, "ababbbcbc", "Pass. Group[0]=(0,5) Group[1]=(0,3)(3,2) Group[2]=(0,1)(3,1)"),
+ new RegexTrial (@"(([a-c])b*?\2){3}", RegexOptions.None, "ababbbcbc", "Pass. Group[0]=(0,9) Group[1]=(0,3)(3,3)(6,3) Group[2]=(0,1)(3,1)(6,1)"),
+ new RegexTrial (@"((\3|b)\2(a)x)+", RegexOptions.None, "aaxabxbaxbbx", "Fail."),
+ new RegexTrial (@"((\3|b)\2(a)x)+", RegexOptions.None, "aaaxabaxbaaxbbax", "Pass. Group[0]=(12,4) Group[1]=(12,4) Group[2]=(12,1) Group[3]=(14,1)"),
+ new RegexTrial (@"((\3|b)\2(a)){2,}", RegexOptions.None, "bbaababbabaaaaabbaaaabba", "Pass. Group[0]=(15,9) Group[1]=(15,3)(18,3)(21,3) Group[2]=(15,1)(18,1)(21,1) Group[3]=(17,1)(20,1)(23,1)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "XBC", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "AXC", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "ABX", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "XABCY", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "ABABC", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"ab*c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab*?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{0,}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab+?bc", RegexOptions.IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab+bc", RegexOptions.IgnoreCase, "ABC", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.IgnoreCase, "ABQ", "Fail."),
+ new RegexTrial (@"ab{1,}bc", RegexOptions.IgnoreCase, "ABQ", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,3}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{3,4}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{4,5}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Fail."),
+ new RegexTrial (@"ab??bc", RegexOptions.IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab??bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}?bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab??bc", RegexOptions.IgnoreCase, "ABBBBC", "Fail."),
+ new RegexTrial (@"ab??c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}?c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.IgnoreCase, "ABCC", "Fail."),
+ new RegexTrial (@"^abc", RegexOptions.IgnoreCase, "ABCC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.IgnoreCase, "AABC", "Fail."),
+ new RegexTrial (@"abc$", RegexOptions.IgnoreCase, "AABC", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"^", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"$", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"a.c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.c", RegexOptions.IgnoreCase, "AXC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.*?c", RegexOptions.IgnoreCase, "AXYZC", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"a.*c", RegexOptions.IgnoreCase, "AXYZD", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.IgnoreCase, "ABC", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.IgnoreCase, "ABD", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]e", RegexOptions.IgnoreCase, "ABD", "Fail."),
+ new RegexTrial (@"a[b-d]e", RegexOptions.IgnoreCase, "ACE", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]", RegexOptions.IgnoreCase, "AAC", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"a[-b]", RegexOptions.IgnoreCase, "A-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-]", RegexOptions.IgnoreCase, "A-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-a]", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a[]b", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a[", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a]", RegexOptions.IgnoreCase, "A]", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[]]b", RegexOptions.IgnoreCase, "A]B", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.IgnoreCase, "AED", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.IgnoreCase, "ABD", "Fail."),
+ new RegexTrial (@"a[^-b]c", RegexOptions.IgnoreCase, "ADC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^-b]c", RegexOptions.IgnoreCase, "A-C", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.IgnoreCase, "A]C", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.IgnoreCase, "ADC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab|cd", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"ab|cd", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"()ef", RegexOptions.IgnoreCase, "DEF", "Pass. Group[0]=(1,2) Group[1]=(1,0)"),
+ new RegexTrial (@"*a", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"(*)b", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"$b", RegexOptions.IgnoreCase, "B", "Fail."),
+ new RegexTrial (@"a\", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a\(b", RegexOptions.IgnoreCase, "A(B", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a\(*b", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a\(*b", RegexOptions.IgnoreCase, "A((B", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a\\b", RegexOptions.IgnoreCase, "A\\B", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc)", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"(abc", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"((a))", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"(a)b(c)", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)"),
+ new RegexTrial (@"a+b+c", RegexOptions.IgnoreCase, "AABBABC", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a{1,}b{1,}c", RegexOptions.IgnoreCase, "AABBABC", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a**", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a.+?c", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.*?c", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.{0,5}?c", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"(a+|b)*", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){0,}", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)+", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){1,}", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)?", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a+|b){0,1}", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a+|b){0,1}?", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,0) Group[1]="),
+ new RegexTrial (@")(", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"[^ab]*", RegexOptions.IgnoreCase, "CDE", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "", "Fail."),
+ new RegexTrial (@"a*", RegexOptions.IgnoreCase, "", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"([abc])*d", RegexOptions.IgnoreCase, "ABBBCD", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)"),
+ new RegexTrial (@"([abc])*bcd", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(0,1)"),
+ new RegexTrial (@"a|b|c|d|e", RegexOptions.IgnoreCase, "E", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(a|b|c|d|e)f", RegexOptions.IgnoreCase, "EF", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"abcd*efg", RegexOptions.IgnoreCase, "ABCDEFG", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"ab*", RegexOptions.IgnoreCase, "XABYABBBZ", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"ab*", RegexOptions.IgnoreCase, "XAYABBBZ", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(ab|cd)e", RegexOptions.IgnoreCase, "ABCDE", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"[abhgefdc]ij", RegexOptions.IgnoreCase, "HIJ", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^(ab|cd)e", RegexOptions.IgnoreCase, "ABCDE", "Fail."),
+ new RegexTrial (@"(abc|)ef", RegexOptions.IgnoreCase, "ABCDEF", "Pass. Group[0]=(4,2) Group[1]=(4,0)"),
+ new RegexTrial (@"(a|b)c*d", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(1,3) Group[1]=(1,1)"),
+ new RegexTrial (@"(ab|ab*)bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,1)"),
+ new RegexTrial (@"a([bc]*)c*", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(1,2)"),
+ new RegexTrial (@"a([bc]*)(c*d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]+)(c*d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]*)(c+d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)"),
+ new RegexTrial (@"a[bcd]*dcdcde", RegexOptions.IgnoreCase, "ADCDCDE", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"a[bcd]+dcdcde", RegexOptions.IgnoreCase, "ADCDCDE", "Fail."),
+ new RegexTrial (@"(ab|a)b*c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,2)"),
+ new RegexTrial (@"((a)(b)c)(d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)"),
+ new RegexTrial (@"[a-zA-Z_][a-zA-Z0-9_]*", RegexOptions.IgnoreCase, "ALPHA", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^a(bc+|b[eh])g|.h$", RegexOptions.IgnoreCase, "ABH", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "EFFGZ", "Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "IJ", "Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)"),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "EFFG", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "BCDD", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "REFFGZ", "Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]="),
+ new RegexTrial (@"((((((((((a))))))))))", RegexOptions.IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))\10", RegexOptions.IgnoreCase, "AA", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.IgnoreCase, "AA", "Fail."),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.IgnoreCase, "A!", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"(((((((((a)))))))))", RegexOptions.IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)"),
+ new RegexTrial (@"(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))", RegexOptions.IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))", RegexOptions.IgnoreCase, "C", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"multiple words of text", RegexOptions.IgnoreCase, "UH-UH", "Fail."),
+ new RegexTrial (@"multiple words", RegexOptions.IgnoreCase, "MULTIPLE WORDS, YEAH", "Pass. Group[0]=(0,14)"),
+ new RegexTrial (@"(.*)c(.*)", RegexOptions.IgnoreCase, "ABCDE", "Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)"),
+ new RegexTrial (@"\((.*), (.*)\)", RegexOptions.IgnoreCase, "(A, B)", "Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)"),
+ new RegexTrial (@"[k]", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"abcd", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a(bc)d", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2)"),
+ new RegexTrial (@"a[-]?c", RegexOptions.IgnoreCase, "AC", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"(abc)\1", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"([a-c]*)\1", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"a(?!b).", RegexOptions.None, "abad", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"a(?=d).", RegexOptions.None, "abad", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"a(?=c|d).", RegexOptions.None, "abad", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"a(?:b|c|d)(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)*(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)+?(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)+?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)+(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){2}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,4) Group[1]=(3,1)"),
+ new RegexTrial (@"a(?:b|c|d){4,5}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)"),
+ new RegexTrial (@"a(?:b|c|d){4,5}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,6) Group[1]=(5,1)"),
+ new RegexTrial (@"((foo)|(bar))*", RegexOptions.None, "foobar", "Pass. Group[0]=(0,6) Group[1]=(0,3)(3,3) Group[2]=(0,3) Group[3]=(3,3)"),
+ new RegexTrial (@":(?:", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a(?:b|c|d){6,7}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){6,7}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,6}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,6}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,7}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,7}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)"),
+ new RegexTrial (@"a(?:b|(c|e){1,2}?|d)+?(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(1,1) Group[2]=(2,1)"),
+ new RegexTrial (@"^(.+)?B", RegexOptions.None, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"^([^a-z])|(\^)$", RegexOptions.None, ".", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]="),
+ new RegexTrial (@"^[<>]&", RegexOptions.None, "<&OUT", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)"),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaaaaa", "Fail."),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaaaaaaa", "Fail."),
+ new RegexTrial (@"^(a(?(1)\1)){4}$", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)"),
+ new RegexTrial (@"^(a(?(1)\1)){4}$", RegexOptions.None, "aaaaaaaaa", "Fail."),
+ new RegexTrial (@"^(a(?(1)\1)){4}$", RegexOptions.None, "aaaaaaaaaaa", "Fail."),
+ new RegexTrial (@"((a{4})+)", RegexOptions.None, "aaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4)"),
+ new RegexTrial (@"(((aa){2})+)", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)"),
+ new RegexTrial (@"(((a{2}){2})+)", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)"),
+ new RegexTrial (@"(?:(f)(o)(o)|(b)(a)(r))*", RegexOptions.None, "foobar", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,1) Group[3]=(2,1) Group[4]=(3,1) Group[5]=(4,1) Group[6]=(5,1)"),
+ new RegexTrial (@"(?<=a)b", RegexOptions.None, "ab", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(?<=a)b", RegexOptions.None, "cb", "Fail."),
+ new RegexTrial (@"(?<=a)b", RegexOptions.None, "b", "Fail."),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "ab", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "cb", "Fail."),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "b", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "b", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?<%)b", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(?:..)*a", RegexOptions.None, "aba", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"(?:..)*?a", RegexOptions.None, "aba", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"^(?:b|a(?=(.)))*\1", RegexOptions.None, "abc", "Pass. Group[0]=(0,2) Group[1]=(1,1)"),
+ new RegexTrial (@"^(){3,5}", RegexOptions.None, "abc", "Pass. Group[0]=(0,0) Group[1]=(0,0)(0,0)(0,0)"),
+ new RegexTrial (@"^(a+)*ax", RegexOptions.None, "aax", "Pass. Group[0]=(0,3) Group[1]=(0,1)"),
+ new RegexTrial (@"^((a|b)+)*ax", RegexOptions.None, "aax", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"^((a|bc)+)*ax", RegexOptions.None, "aax", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"(a|x)*ab", RegexOptions.None, "cab", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(a)*ab", RegexOptions.None, "cab", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(?:(?i)a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i)a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?i)a)b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i)a)b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?i)a)b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"((?i)a)b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"(?i:a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i:a))b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?i:a)b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i:a))b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?i:a)b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"((?i:a))b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"((?-i:a.))b", RegexOptions.IgnoreCase, "a\nB", "Fail."),
+ new RegexTrial (@"((?s-i:a.))b", RegexOptions.IgnoreCase, "a\nB", "Pass. Group[0]=(0,3) Group[1]=(0,2)"),
+ new RegexTrial (@"((?s-i:a.))b", RegexOptions.IgnoreCase, "B\nB", "Fail."),
+ new RegexTrial (@"(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))", RegexOptions.None, "cabbbb", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))", RegexOptions.None, "caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "Pass. Group[0]=(0,41)"),
+ new RegexTrial (@"(ab)\d\1", RegexOptions.IgnoreCase, "Ab4ab", "Pass. Group[0]=(0,5) Group[1]=(0,2)"),
+ new RegexTrial (@"(ab)\d\1", RegexOptions.IgnoreCase, "ab4Ab", "Pass. Group[0]=(0,5) Group[1]=(0,2)"),
+ new RegexTrial (@"foo\w*\d{4}baz", RegexOptions.None, "foobar1234baz", "Pass. Group[0]=(0,13)"),
+ new RegexTrial (@"x(~~)*(?:(?:F)?)?", RegexOptions.None, "x~~", "Pass. Group[0]=(0,3) Group[1]=(1,2)"),
+ new RegexTrial (@"^a(?#xxx){3}c", RegexOptions.None, "aaac", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"(?<![cd])b", RegexOptions.None, "dbcb", "Fail."),
+ new RegexTrial (@"(?<![cd])[ab]", RegexOptions.None, "dbaacb", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"(?<!(c|d))b", RegexOptions.None, "dbcb", "Fail."),
+ new RegexTrial (@"(?<!(c|d))[ab]", RegexOptions.None, "dbaacb", "Pass. Group[0]=(2,1) Group[1]="),
+ new RegexTrial (@"(?<!cd)[ab]", RegexOptions.None, "cdaccb", "Pass. Group[0]=(5,1)"),
+ new RegexTrial (@"^(?:a?b?)*$", RegexOptions.None, "a--", "Fail."),
+ new RegexTrial (@"((?s)^a(.))((?m)^b$)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(0,3) Group[1]=(0,2) Group[2]=(1,1) Group[3]=(2,1)"),
+ new RegexTrial (@"((?m)^b$)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"(?m)^b", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"(?m)^(b)", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"((?m)^b)", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"\n((?m)^b)", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(1,2) Group[1]=(2,1)"),
+ new RegexTrial (@"((?s).)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(3,2) Group[1]=(3,1)"),
+ new RegexTrial (@"((?s).)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(3,2) Group[1]=(3,1)"),
+ new RegexTrial (@"((?s)b.)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"((?s)b.)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"^b", RegexOptions.None, "a\nb\nc\n", "Fail."),
+ new RegexTrial (@"()^b", RegexOptions.None, "a\nb\nc\n", "Fail."),
+ new RegexTrial (@"((?m)^b)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"(x)?(?(1)a|b)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"(x)?(?(1)b|a)", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]="),
+ new RegexTrial (@"()?(?(1)b|a)", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]="),
+ new RegexTrial (@"()(?(1)b|a)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"()?(?(1)a|b)", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,0)"),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "(blah)", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(5,1)"),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "blah", "Pass. Group[0]=(0,4) Group[1]= Group[2]="),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "blah)", "Fail."),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "(blah", "Fail."),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "(blah)", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(5,1)"),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "blah", "Pass. Group[0]=(0,4) Group[1]= Group[2]="),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "blah)", "Fail."),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "(blah", "Fail."),
+ new RegexTrial (@"(?(1)a|b|c)", RegexOptions.None, "a", "Error."),
+ new RegexTrial (@"(?(?!a)a|b)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"(?(?!a)b|a)", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?(?=a)b|a)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"(?(?=a)a|b)", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?=(a+?))(\1ab)", RegexOptions.None, "aaab", "Pass. Group[0]=(1,3) Group[1]=(1,1) Group[2]=(1,3)"),
+ new RegexTrial (@"^(?=(a+?))\1ab", RegexOptions.None, "aaab", "Fail."),
+ new RegexTrial (@"(\w+:)+", RegexOptions.None, "one:", "Pass. Group[0]=(0,4) Group[1]=(0,4)"),
+ new RegexTrial (@"$(?<=^(a))", RegexOptions.None, "a", "Pass. Group[0]=(1,0) Group[1]=(0,1)"),
+ new RegexTrial (@"(?=(a+?))(\1ab)", RegexOptions.None, "aaab", "Pass. Group[0]=(1,3) Group[1]=(1,1) Group[2]=(1,3)"),
+ new RegexTrial (@"^(?=(a+?))\1ab", RegexOptions.None, "aaab", "Fail."),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd:", "Fail."),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]= Group[2]=(0,4)"),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "xy:z:::abcd", "Pass. Group[0]=(0,11) Group[1]=(0,7) Group[2]=(7,4)"),
+ new RegexTrial (@"^[^bcd]*(c+)", RegexOptions.None, "aexycd", "Pass. Group[0]=(0,5) Group[1]=(4,1)"),
+ new RegexTrial (@"(a*)b+", RegexOptions.None, "caab", "Pass. Group[0]=(1,3) Group[1]=(1,2)"),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd:", "Fail."),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]= Group[2]=(0,4)"),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "xy:z:::abcd", "Pass. Group[0]=(0,11) Group[1]=(0,7) Group[2]=(7,4)"),
+ new RegexTrial (@"^[^bcd]*(c+)", RegexOptions.None, "aexycd", "Pass. Group[0]=(0,5) Group[1]=(4,1)"),
+ new RegexTrial (@"(>a+)ab", RegexOptions.None, "aaab", "Fail."),
+ new RegexTrial (@"(?>a+)b", RegexOptions.None, "aaab", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"([[:]+)", RegexOptions.None, "a:[b]:", "Pass. Group[0]=(1,2) Group[1]=(1,2)"),
+ new RegexTrial (@"([[=]+)", RegexOptions.None, "a=[b]=", "Pass. Group[0]=(1,2) Group[1]=(1,2)"),
+ new RegexTrial (@"([[.]+)", RegexOptions.None, "a.[b].", "Pass. Group[0]=(1,2) Group[1]=(1,2)"),
+ new RegexTrial (@"[a[:]b[:c]", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"[a[:]b[:c]", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"((?>a+)b)", RegexOptions.None, "aaab", "Pass. Group[0]=(0,4) Group[1]=(0,4)"),
+ new RegexTrial (@"(?>(a+))b", RegexOptions.None, "aaab", "Pass. Group[0]=(0,4) Group[1]=(0,3)"),
+ new RegexTrial (@"((?>[^()]+)|\([^()]*\))+", RegexOptions.None, "((abc(ade)ufh()()x", "Pass. Group[0]=(2,16) Group[1]=(2,3)(5,5)(10,3)(13,2)(15,2)(17,1)"),
+ new RegexTrial (@"(?<=x+)", RegexOptions.None, "xxxxy", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"a{37,17}", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"\Z", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\Z", RegexOptions.None, "b\na\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.None, "b\na\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "b\na\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\Z", RegexOptions.None, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.None, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\Z", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"\Z", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"\Z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"$", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"a\Z", RegexOptions.None, "a\nb\n", "Fail."),
+ new RegexTrial (@"a\z", RegexOptions.None, "a\nb\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.None, "a\nb\n", "Fail."),
+ new RegexTrial (@"a\Z", RegexOptions.None, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.None, "b\na\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.None, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\Z", RegexOptions.None, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.None, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a$", RegexOptions.None, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.Multiline, "a\nb\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"a\Z", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.Multiline, "b\na\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\Z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a$", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\naa\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "aa\nb\n", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\naa\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nab\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "ab\nb\n", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nab\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nabb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "abb\nb\n", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nabb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"(^|x)(c)", RegexOptions.None, "ca", "Pass. Group[0]=(0,1) Group[1]=(0,0) Group[2]=(0,1)"),
+ new RegexTrial (@"a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", RegexOptions.None, "x", "Fail."),
+ new RegexTrial (@"round\(((?>[^()]+))\)", RegexOptions.None, "_I(round(xs * sz),1)", "Pass. Group[0]=(3,14) Group[1]=(9,7)"),
+ new RegexTrial (@"foo.bart", RegexOptions.None, "foo.bart", "Pass. Group[0]=(0,8)"),
+ new RegexTrial (@"^d[x][x][x]", RegexOptions.Multiline, "abcd\ndxxx", "Pass. Group[0]=(5,4)"),
+ new RegexTrial (@".X(.+)+X", RegexOptions.None, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)"),
+ new RegexTrial (@".X(.+)+XX", RegexOptions.None, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)"),
+ new RegexTrial (@".XX(.+)+X", RegexOptions.None, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)"),
+ new RegexTrial (@".X(.+)+X", RegexOptions.None, "bbbbXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".X(.+)+XX", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".XX(.+)+X", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".X(.+)+[X]", RegexOptions.None, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)"),
+ new RegexTrial (@".X(.+)+[X][X]", RegexOptions.None, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)"),
+ new RegexTrial (@".XX(.+)+[X]", RegexOptions.None, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)"),
+ new RegexTrial (@".X(.+)+[X]", RegexOptions.None, "bbbbXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".X(.+)+[X][X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".XX(.+)+[X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".[X](.+)+[X]", RegexOptions.None, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)"),
+ new RegexTrial (@".[X](.+)+[X][X]", RegexOptions.None, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)"),
+ new RegexTrial (@".[X][X](.+)+[X]", RegexOptions.None, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)"),
+ new RegexTrial (@".[X](.+)+[X]", RegexOptions.None, "bbbbXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".[X](.+)+[X][X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".[X][X](.+)+[X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@"tt+$", RegexOptions.None, "xxxtt", "Pass. Group[0]=(3,2)"),
+ new RegexTrial (@"([\d-z]+)", RegexOptions.None, "a0-za", "Pass. Group[0]=(1,3) Group[1]=(1,3)"),
+ new RegexTrial (@"([\d-\s]+)", RegexOptions.None, "a0- z", "Pass. Group[0]=(1,3) Group[1]=(1,3)"),
+ new RegexTrial (@"\GX.*X", RegexOptions.None, "aaaXbX", "Fail."),
+ new RegexTrial (@"(\d+\.\d+)", RegexOptions.None, "3.1415926", "Pass. Group[0]=(0,9) Group[1]=(0,9)"),
+ new RegexTrial (@"(\ba.{0,10}br)", RegexOptions.None, "have a web browser", "Pass. Group[0]=(5,8) Group[1]=(5,8)"),
+ new RegexTrial (@"\.c(pp|xx|c)?$", RegexOptions.IgnoreCase, "Changes", "Fail."),
+ new RegexTrial (@"\.c(pp|xx|c)?$", RegexOptions.IgnoreCase, "IO.c", "Pass. Group[0]=(2,2) Group[1]="),
+ new RegexTrial (@"(\.c(pp|xx|c)?$)", RegexOptions.IgnoreCase, "IO.c", "Pass. Group[0]=(2,2) Group[1]=(2,2) Group[2]="),
+ new RegexTrial (@"^([a-z]:)", RegexOptions.None, "C:/", "Fail."),
+ new RegexTrial (@"^\S\s+aa$", RegexOptions.Multiline, "\nx aa", "Pass. Group[0]=(1,4)"),
+ new RegexTrial (@"(^|a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"^([ab]*?)(b)?(c)$", RegexOptions.None, "abac", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]= Group[3]=(3,1)"),
+ new RegexTrial (@"(\w)?(abc)\1b", RegexOptions.None, "abcab", "Fail."),
+ new RegexTrial (@"^(?:.,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^(.,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)"),
+ new RegexTrial (@"^(?:[^,]*,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^([^,]*,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)"),
+ new RegexTrial (@"^([^,]*,){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]*,){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]*,){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,3},){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,3},){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,3},){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,},){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,},){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,},){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{0,3},){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{0,3},){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{0,3},){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"(?i)", RegexOptions.None, "", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"(?!\A)x", RegexOptions.Multiline, "a\nxb\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"^(a(b)?)+$", RegexOptions.None, "aba", "Pass. Group[0]=(0,3) Group[1]=(0,2)(2,1) Group[2]=(1,1)"),
+ new RegexTrial (@"^(aa(bb)?)+$", RegexOptions.None, "aabbaa", "Pass. Group[0]=(0,6) Group[1]=(0,4)(4,2) Group[2]=(2,2)"),
+ new RegexTrial (@"^.{9}abc.*\n", RegexOptions.Multiline, "123\nabcabcabcabc\n", "Pass. Group[0]=(4,13)"),
+ new RegexTrial (@"^(a)?a$", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]="),
+ new RegexTrial (@"^(a)?(?(1)a|b)+$", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"^(a\1?)(a\1?)(a\2?)(a\3?)$", RegexOptions.None, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,2) Group[3]=(3,1) Group[4]=(4,2)"),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,2)(3,1)(4,2)"),
+ new RegexTrial (@"^(0+)?(?:x(1))?", RegexOptions.None, "x1", "Pass. Group[0]=(0,2) Group[1]= Group[2]=(1,1)"),
+ new RegexTrial (@"^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?", RegexOptions.None, "012cxx0190", "Pass. Group[0]=(0,10) Group[1]=(0,4) Group[2]= Group[3]=(6,4)"),
+ new RegexTrial (@"^(b+?|a){1,2}c", RegexOptions.None, "bbbac", "Pass. Group[0]=(0,5) Group[1]=(0,3)(3,1)"),
+ new RegexTrial (@"^(b+?|a){1,2}c", RegexOptions.None, "bbbbac", "Pass. Group[0]=(0,6) Group[1]=(0,4)(4,1)"),
+ new RegexTrial (@"\((\w\. \w+)\)", RegexOptions.None, "cd. (A. Tw)", "Pass. Group[0]=(4,7) Group[1]=(5,5)"),
+ new RegexTrial (@"((?:aaaa|bbbb)cccc)?", RegexOptions.None, "aaaacccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)"),
+ new RegexTrial (@"((?:aaaa|bbbb)cccc)?", RegexOptions.None, "bbbbcccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)")
+ };
+ }
+}
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs b/mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs
new file mode 100644
index 00000000000..73fc6876f09
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Text.RegularExpressions;
+
+namespace MonoTests.System.Text.RegularExpressions {
+
+ class RegexTrial {
+ public string pattern;
+ public RegexOptions options;
+ public string input;
+
+ public string expected;
+
+ public RegexTrial (string pattern, RegexOptions options, string input, string expected) {
+ this.pattern = pattern;
+ this.options = options;
+ this.input = input;
+ this.expected = expected;
+ }
+
+ public string Expected {
+ get { return expected; }
+ }
+
+ public string Execute () {
+ string result;
+ try {
+ Regex re = new Regex (pattern, options);
+ Match m = re.Match (input);
+
+ if (m.Success) {
+ result = "Pass.";
+
+ for (int i = 0; i < m.Groups.Count; ++ i) {
+ Group group = m.Groups[i];
+
+ result += " Group[" + i + "]=";
+ foreach (Capture cap in group.Captures) {
+ result += "(" + cap.Index + "," + cap.Length + ")";
+ }
+ }
+ }
+ else
+ result = "Fail.";
+ }
+ catch (Exception) {
+ result = "Error.";
+ }
+
+ return result;
+ }
+
+ public override string ToString () {
+ return
+ "Matching input '" + input +
+ "' against pattern '" + pattern +
+ "' with options '" + options + "'.";
+ }
+ }
+
+ class Checksum {
+ public Checksum () {
+ this.sum = 0;
+ }
+
+ public uint Value {
+ get { return sum; }
+ }
+
+ public void Add (string str) {
+ for (int i = 0; i < str.Length; ++ i)
+ Add (str[i], 16);
+ }
+
+ public void Add (uint n) {
+ Add (n, 32);
+ }
+
+ public void Add (ulong n, int bits) {
+ ulong mask = 1ul << (bits - 1);
+ for (int i = 0; i < bits; ++ i) {
+ Add ((n & mask) != 0);
+ mask >>= 1;
+ }
+ }
+
+ public void Add (bool bit) {
+ bool top = (sum & 0x80000000) != 0;
+ sum <<= 1;
+ sum ^= bit ? (uint)1 : (uint)0;
+
+ if (top)
+ sum ^= key;
+ }
+
+ private uint sum;
+ private readonly uint key = 0x04c11db7;
+ }
+}
diff --git a/mcs/class/System/Test/System/AllTests.cs b/mcs/class/System/Test/System/AllTests.cs
new file mode 100644
index 00000000000..9a4718fbda6
--- /dev/null
+++ b/mcs/class/System/Test/System/AllTests.cs
@@ -0,0 +1,29 @@
+//
+// MonoTests.System.AllTests, System.dll
+//
+// Author:
+// Lawrence Pit <loz@cable.a2000nl>
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System {
+
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name)
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (UriTest.Suite);
+ suite.AddTest (UriBuilderTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System/ChangeLog b/mcs/class/System/Test/System/ChangeLog
new file mode 100644
index 00000000000..ab3f180eb01
--- /dev/null
+++ b/mcs/class/System/Test/System/ChangeLog
@@ -0,0 +1,22 @@
+2002-09-17 Nick Drochak <ndrochak@gol.com>
+
+ * UriTest.cs: Fixed some path separator issues for the tests running on
+ linux.
+
+2002-05-28 Lawrence Pit <loz@cable.a2000.nl>
+
+ * UriTest.cs: added tests ctor UriTest (baseUri, relativeUri)
+
+2002-05-22 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added UriTest.MakeRelative
+
+2002-05-12 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Added UriTest.TestLocalPath
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * UriTest.cs: added
+ * UriBuilderTest.cs: added
+ * AllTests.cs: added
diff --git a/mcs/class/System/Test/System/UriBuilderTest.cs b/mcs/class/System/Test/System/UriBuilderTest.cs
new file mode 100644
index 00000000000..53c9a8970c7
--- /dev/null
+++ b/mcs/class/System/Test/System/UriBuilderTest.cs
@@ -0,0 +1,147 @@
+//
+// UriBuilderTest.cs - NUnit Test Cases for System.UriBuilder
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+ public class UriBuilderTest : TestCase
+ {
+ private UriBuilder b, b2, b3;
+
+ public UriBuilderTest () :
+ base ("[MonoTests.System.UriBuilderTest]") {}
+
+ public UriBuilderTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html");
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (UriBuilderTest));
+ }
+ }
+
+ public void TestConstructors ()
+ {
+ b = new UriBuilder ();
+ AssertEquals ("#1", "http", b.Scheme);
+ AssertEquals ("#2", "loopback", b.Host);
+ AssertEquals ("#3", -1, b.Port);
+
+ try {
+ b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html", "extras");
+ Fail ("#4 should have thrown an ArgumentException because extraValue must start with '?' or '#' character.");
+ } catch (ArgumentException) {}
+
+ b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html", "#extras");
+ }
+
+ public void TestUserInfo ()
+ {
+ b = new UriBuilder ("mailto://myname:mypwd@contoso.com?subject=hello");
+ AssertEquals ("#1", "myname", b.UserName);
+ AssertEquals ("#2", "mypwd", b.Password);
+
+ b = new UriBuilder ("mailto:", "contoso.com");
+ b.UserName = "myname";
+ b.Password = "mypwd";
+ AssertEquals ("#3: known to fail with ms.net.", "myname:mypwd", b.Uri.UserInfo);
+ }
+
+ public void TestPath ()
+ {
+ b.Path = ((char) 0xa9) + " 2002";
+ AssertEquals ("#1: known to fail with ms.net, should at least return a slash.", "/%A9%202002", b.Path);
+ }
+
+ public void TestPort ()
+ {
+ try {
+ b.Port = -12345;
+ Fail ("#1 should've failed, illegal port.");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ b.Port = 123456789;
+ Fail ("#2 should've failed, illegal port.");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ b.Port = -1;
+ AssertEquals ("#3", -1, b.Port);
+ } catch (ArgumentOutOfRangeException) {
+ Fail ("#4: spec should allow -1 as value.");
+ }
+ }
+
+ public void TestQuery ()
+ {
+ b.Query = ((char) 0xa9) + " 2002";
+ AssertEquals ("#1: known to fail with ms.net, should've been escaped.", "?%A9%202002", b.Query);
+ AssertEquals ("#2", String.Empty, b.Fragment);
+ b.Query = "?test";
+ AssertEquals ("#3", "??test", b.Query);
+ b.Query = null;
+ AssertEquals ("#4", String.Empty, b.Query);
+ }
+
+ public void TestFragment ()
+ {
+ b.Fragment = ((char) 0xa9) + " 2002";
+ AssertEquals ("#1: known to fail with ms.net, should've been escaped.", "#%A9%202002", b.Fragment);
+ AssertEquals ("#2", String.Empty, b.Query);
+ b.Fragment = "#test";
+ AssertEquals ("#3", "##test", b.Fragment);
+ b.Fragment = null;
+ AssertEquals ("#4", String.Empty, b.Fragment);
+ }
+
+ public void TestScheme ()
+ {
+ b.Scheme = "http";
+ AssertEquals ("#1", b.Scheme, "http");
+ b.Scheme = "http:";
+ AssertEquals ("#2", b.Scheme, "http");
+ b.Scheme = "http://";
+ AssertEquals ("#3", b.Scheme, "http");
+ b.Scheme = "http://foo/bar";
+ AssertEquals ("#4", b.Scheme, "http");
+ b.Scheme = "mailto:";
+ AssertEquals ("#5", b.Scheme, "mailto");
+ b.Scheme = "unknown";
+ AssertEquals ("#6", b.Scheme, "unknown");
+ b.Scheme = "unknown://";
+ AssertEquals ("#7", b.Scheme, "unknown");
+ }
+
+ public void TestEquals ()
+ {
+ b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html?item=1");
+ b2 = new UriBuilder ("http", "www.ximian.com", 80, "/foo/bar/index.html", "?item=1");
+ b3 = new UriBuilder (new Uri ("http://www.ximian.com/foo/bar/index.html?item=1"));
+
+ Assert ("#1", b.Equals (b2));
+ Assert ("#2", b.Uri.Equals (b2.Uri));
+ Assert ("#3", b.Equals (b3));
+ Assert ("#4", b2.Equals (b3));
+ Assert ("#5", b3.Equals (b));
+ }
+
+ public void TestToString ()
+ {
+ AssertEquals ("#1 known to fail with ms.net, should've been canonicalized.", b.Uri.ToString (), b.ToString ());
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System/UriTest.cs b/mcs/class/System/Test/System/UriTest.cs
new file mode 100644
index 00000000000..4dc79b68b9c
--- /dev/null
+++ b/mcs/class/System/Test/System/UriTest.cs
@@ -0,0 +1,544 @@
+//
+// UriTest.cs - NUnit Test Cases for System.Uri
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace MonoTests.System
+{
+
+ public class UriTest : TestCase
+ {
+ public UriTest () :
+ base ("[MonoTests.System.UriTest]") {}
+
+ public UriTest (string name) : base (name) {}
+
+ protected bool isWin32 = false;
+
+ protected override void SetUp () {
+ isWin32 = (Path.DirectorySeparatorChar == '\\');
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof (UriTest));
+ }
+ }
+
+ public void TestConstructors ()
+ {
+ Uri uri = null;
+
+ /*
+ uri = new Uri ("http://www.ximian.com/foo" + ((char) 0xa9) + "/bar/index.cgi?a=1&b=" + ((char) 0xa9) + "left#fragm?ent2");
+ Print (uri);
+
+ uri = new Uri ("http://www.ximian.com/foo/xxx\"()-._;<=>@{|}~-,.`_^]\\[xx/" + ((char) 0xa9) + "/bar/index.cgi#fra+\">=@[gg]~gment2");
+ Print (uri);
+
+ uri = new Uri("http://11.22.33.588:9090");
+ Print (uri);
+
+ uri = new Uri("http://[11:22:33::88]:9090");
+ Print (uri);
+
+ uri = new Uri("http://[::127.11.22.33]:8080");
+ Print (uri);
+
+ uri = new Uri("http://[abcde::127.11.22.33]:8080");
+ Print (uri);
+ */
+
+ /*
+ uri = new Uri ("http://www.contoso.com:1234/foo/bar/");
+ Print (uri);
+
+ uri = new Uri ("http://www.contoso.com:1234/foo/bar");
+ Print (uri);
+
+ uri = new Uri ("http://www.contoso.com:1234/");
+ Print (uri);
+
+ uri = new Uri ("http://www.contoso.com:1234");
+ Print (uri);
+ */
+
+ uri = new Uri ("http://contoso.com?subject=uri");
+ AssertEquals ("#k1", "/", uri.AbsolutePath);
+ AssertEquals ("#k2", "http://contoso.com/?subject=uri", uri.AbsoluteUri);
+ AssertEquals ("#k3", "contoso.com", uri.Authority);
+ AssertEquals ("#k4", "", uri.Fragment);
+ AssertEquals ("#k5", "contoso.com", uri.Host);
+ AssertEquals ("#k6", UriHostNameType.Dns, uri.HostNameType);
+ AssertEquals ("#k7", true, uri.IsDefaultPort);
+ AssertEquals ("#k8", false, uri.IsFile);
+ AssertEquals ("#k9", false, uri.IsLoopback);
+ AssertEquals ("#k10", false, uri.IsUnc);
+ AssertEquals ("#k11", "/", uri.LocalPath);
+ AssertEquals ("#k12", "/?subject=uri", uri.PathAndQuery);
+ AssertEquals ("#k13", 80, uri.Port);
+ AssertEquals ("#k14", "?subject=uri", uri.Query);
+ AssertEquals ("#k15", "http", uri.Scheme);
+ AssertEquals ("#k16", false, uri.UserEscaped);
+ AssertEquals ("#k17", "", uri.UserInfo);
+
+ uri = new Uri ("mailto:user:pwd@contoso.com?subject=uri");
+ AssertEquals ("#m1", "", uri.AbsolutePath);
+ AssertEquals ("#m2", "mailto:user:pwd@contoso.com?subject=uri", uri.AbsoluteUri);
+ AssertEquals ("#m3", "contoso.com", uri.Authority);
+ AssertEquals ("#m4", "", uri.Fragment);
+ AssertEquals ("#m5", "contoso.com", uri.Host);
+ AssertEquals ("#m6", UriHostNameType.Dns, uri.HostNameType);
+ AssertEquals ("#m7", true, uri.IsDefaultPort);
+ AssertEquals ("#m8", false, uri.IsFile);
+ AssertEquals ("#m9", false, uri.IsLoopback);
+ AssertEquals ("#m10", false, uri.IsUnc);
+ AssertEquals ("#m11", "", uri.LocalPath);
+ AssertEquals ("#m12", "?subject=uri", uri.PathAndQuery);
+ AssertEquals ("#m13", 25, uri.Port);
+ AssertEquals ("#m14", "?subject=uri", uri.Query);
+ AssertEquals ("#m15", "mailto", uri.Scheme);
+ AssertEquals ("#m16", false, uri.UserEscaped);
+ AssertEquals ("#m17", "user:pwd", uri.UserInfo);
+
+ uri = new Uri (@"\\myserver\mydir\mysubdir\myfile.ext");
+ AssertEquals ("#n1", "/mydir/mysubdir/myfile.ext", uri.AbsolutePath);
+ AssertEquals ("#n2", "file://myserver/mydir/mysubdir/myfile.ext", uri.AbsoluteUri);
+ AssertEquals ("#n3", "myserver", uri.Authority);
+ AssertEquals ("#n4", "", uri.Fragment);
+ AssertEquals ("#n5", "myserver", uri.Host);
+ AssertEquals ("#n6", UriHostNameType.Dns, uri.HostNameType);
+ AssertEquals ("#n7", true, uri.IsDefaultPort);
+ AssertEquals ("#n8", true, uri.IsFile);
+ AssertEquals ("#n9", false, uri.IsLoopback);
+ AssertEquals ("#n10", true, uri.IsUnc);
+
+ if (isWin32)
+ AssertEquals ("#n11", @"\\myserver\mydir\mysubdir\myfile.ext", uri.LocalPath);
+ else
+ AssertEquals ("#n11", "/myserver/mydir/mysubdir/myfile.ext", uri.LocalPath);
+
+ AssertEquals ("#n12", "/mydir/mysubdir/myfile.ext", uri.PathAndQuery);
+ AssertEquals ("#n13", -1, uri.Port);
+ AssertEquals ("#n14", "", uri.Query);
+ AssertEquals ("#n15", "file", uri.Scheme);
+ AssertEquals ("#n16", false, uri.UserEscaped);
+ AssertEquals ("#n17", "", uri.UserInfo);
+
+ uri = new Uri (new Uri("http://www.contoso.com"), "Hello World.htm", true);
+ AssertEquals ("#rel1a", "http://www.contoso.com/Hello World.htm", uri.AbsoluteUri);
+ AssertEquals ("#rel1b", true, uri.UserEscaped);
+ uri = new Uri (new Uri("http://www.contoso.com"), "Hello World.htm", false);
+ AssertEquals ("#rel2a", "http://www.contoso.com/Hello%20World.htm", uri.AbsoluteUri);
+ AssertEquals ("#rel2b", false, uri.UserEscaped);
+ uri = new Uri (new Uri("http://www.contoso.com"), "http://www.xxx.com/Hello World.htm", false);
+ AssertEquals ("#rel3", "http://www.xxx.com/Hello%20World.htm", uri.AbsoluteUri);
+ //uri = new Uri (new Uri("http://www.contoso.com"), "foo:8080/bar/Hello World.htm", false);
+ //AssertEquals ("#rel4", "foo:8080/bar/Hello%20World.htm", uri.AbsoluteUri);
+ uri = new Uri (new Uri("http://www.contoso.com"), "foo/bar/Hello World.htm?x=0:8", false);
+ AssertEquals ("#rel5", "http://www.contoso.com/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "foo/bar/Hello World.htm?x=0:8", false);
+ AssertEquals ("#rel6", "http://www.contoso.com/xxx/yyy/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "/foo/bar/Hello World.htm?x=0:8", false);
+ AssertEquals ("#rel7", "http://www.contoso.com/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "../foo/bar/Hello World.htm?x=0:8", false);
+ AssertEquals ("#rel8", "http://www.contoso.com/xxx/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "../../../foo/bar/Hello World.htm?x=0:8", false);
+ AssertEquals ("#rel9", "http://www.contoso.com/../foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "./foo/bar/Hello World.htm?x=0:8", false);
+ AssertEquals ("#rel10", "http://www.contoso.com/xxx/yyy/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+
+ try {
+ uri = new Uri (null, "http://www.contoso.com/index.htm", false);
+ Fail ("#rel20");
+ } catch (NullReferenceException) {
+ }
+ try {
+ uri = new Uri (new Uri("http://www.contoso.com"), null, false);
+ Fail ("#rel21");
+ } catch (NullReferenceException) {
+ }
+ try {
+ uri = new Uri (new Uri("http://www.contoso.com/foo/bar/index.html?x=0"), String.Empty, false);
+ AssertEquals("#22", "http://www.contoso.com/foo/bar/index.html?x=0", uri.ToString ());
+ } catch (NullReferenceException) {
+ }
+ try {
+ uri = new Uri ("http://www.contoso.com:12345678/foo/bar/");
+ Fail ("#30: known to fail with ms.net, should have failed because of invalid port");
+ } catch (UriFormatException) { }
+ }
+
+ public void TestLocalPath ()
+ {
+ Uri uri = new Uri ("c:\\tmp\\hello.txt");
+ AssertEquals ("#1a", "file:///c:/tmp/hello.txt", uri.ToString ());
+ AssertEquals ("#1b", "c:\\tmp\\hello.txt", uri.LocalPath);
+ AssertEquals ("#1c", "file", uri.Scheme);
+ AssertEquals ("#1d", "", uri.Host);
+ AssertEquals ("#1e", "c:/tmp/hello.txt", uri.AbsolutePath);
+
+ uri = new Uri ("file:////////cygwin/tmp/hello.txt");
+ AssertEquals ("#3a", "file://cygwin/tmp/hello.txt", uri.ToString ());
+ if (isWin32)
+ AssertEquals ("#3b win32", "\\\\cygwin\\tmp\\hello.txt", uri.LocalPath);
+ else
+ AssertEquals ("#3b *nix", "/cygwin/tmp/hello.txt", uri.LocalPath);
+ AssertEquals ("#3c", "file", uri.Scheme);
+ AssertEquals ("#3d", "cygwin", uri.Host);
+ AssertEquals ("#3e", "/tmp/hello.txt", uri.AbsolutePath);
+
+ uri = new Uri ("file://mymachine/cygwin/tmp/hello.txt");
+ AssertEquals ("#4a", "file://mymachine/cygwin/tmp/hello.txt", uri.ToString ());
+ if (isWin32)
+ AssertEquals ("#4b win32", "\\\\mymachine\\cygwin\\tmp\\hello.txt", uri.LocalPath);
+ else
+ AssertEquals ("#4b *nix", "/mymachine/cygwin/tmp/hello.txt", uri.LocalPath);
+ AssertEquals ("#4c", "file", uri.Scheme);
+ AssertEquals ("#4d", "mymachine", uri.Host);
+ AssertEquals ("#4e", "/cygwin/tmp/hello.txt", uri.AbsolutePath);
+
+ uri = new Uri ("file://///c:/cygwin/tmp/hello.txt");
+ AssertEquals ("#5a", "file:///c:/cygwin/tmp/hello.txt", uri.ToString ());
+ AssertEquals ("#5b", "c:\\cygwin\\tmp\\hello.txt", uri.LocalPath);
+ AssertEquals ("#5c", "file", uri.Scheme);
+ AssertEquals ("#5d", "", uri.Host);
+ AssertEquals ("#5e", "c:/cygwin/tmp/hello.txt", uri.AbsolutePath);
+ }
+
+ public void TestUnc ()
+ {
+ Uri uri = new Uri ("http://www.contoso.com");
+ Assert ("#1", !uri.IsUnc);
+
+ uri = new Uri ("news:123456@contoso.com");
+ Assert ("#2", !uri.IsUnc);
+
+ uri = new Uri ("file://server/filename.ext");
+ Assert ("#3", uri.IsUnc);
+
+ try {
+ uri = new Uri ("file:/filename.ext");
+ Assert ("#4", uri.IsUnc);
+ } catch (UriFormatException) {
+ Fail ("#5: known to fail with ms.net");
+ }
+
+ uri = new Uri (@"\\server\share\filename.ext");
+ Assert ("#6", uri.IsUnc);
+ }
+
+ public void TestFromHex ()
+ {
+ AssertEquals ("#1", 0, Uri.FromHex ('0'));
+ AssertEquals ("#2", 9, Uri.FromHex ('9'));
+ AssertEquals ("#3", 10, Uri.FromHex ('a'));
+ AssertEquals ("#4", 15, Uri.FromHex ('f'));
+ AssertEquals ("#5", 10, Uri.FromHex ('A'));
+ AssertEquals ("#6", 15, Uri.FromHex ('F'));
+ try {
+ Uri.FromHex ('G');
+ Fail ("#7");
+ } catch (ArgumentException) {}
+ try {
+ Uri.FromHex (' ');
+ Fail ("#8");
+ } catch (ArgumentException) {}
+ try {
+ Uri.FromHex ('%');
+ Fail ("#8");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestHexEscape ()
+ {
+ AssertEquals ("#1","%20", Uri.HexEscape (' '));
+ AssertEquals ("#2","%A9", Uri.HexEscape ((char) 0xa9));
+ AssertEquals ("#3","%41", Uri.HexEscape ('A'));
+ try {
+ Uri.HexEscape ((char) 0x0369);
+ Fail ("#4");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestHexUnescape ()
+ {
+ int i = 0;
+ AssertEquals ("#1", ' ', Uri.HexUnescape ("%20", ref i));
+ AssertEquals ("#2", 3, i);
+ i = 4;
+ AssertEquals ("#3", (char) 0xa9, Uri.HexUnescape ("test%a9test", ref i));
+ AssertEquals ("#4", 7, i);
+ AssertEquals ("#5", 't', Uri.HexUnescape ("test%a9test", ref i));
+ AssertEquals ("#6", 8, i);
+ i = 4;
+ AssertEquals ("#5", '%', Uri.HexUnescape ("test%a", ref i));
+ AssertEquals ("#6", 5, i);
+ AssertEquals ("#7", '%', Uri.HexUnescape ("testx%xx", ref i));
+ AssertEquals ("#8", 6, i);
+ }
+
+ public void TestIsHexDigit ()
+ {
+ Assert ("#1", Uri.IsHexDigit ('a'));
+ Assert ("#2", Uri.IsHexDigit ('f'));
+ Assert ("#3", !Uri.IsHexDigit ('g'));
+ Assert ("#4", Uri.IsHexDigit ('0'));
+ Assert ("#5", Uri.IsHexDigit ('9'));
+ Assert ("#6", Uri.IsHexDigit ('A'));
+ Assert ("#7", Uri.IsHexDigit ('F'));
+ Assert ("#8", !Uri.IsHexDigit ('G'));
+ }
+
+ public void TestIsHexEncoding ()
+ {
+ Assert ("#1", Uri.IsHexEncoding ("test%a9test", 4));
+ Assert ("#2", !Uri.IsHexEncoding ("test%a9test", 3));
+ Assert ("#3", Uri.IsHexEncoding ("test%a9", 4));
+ Assert ("#4", !Uri.IsHexEncoding ("test%a", 4));
+ }
+
+ public void TestGetLeftPart ()
+ {
+ Uri uri = new Uri ("http://www.contoso.com/index.htm#main");
+ AssertEquals ("#1", "http://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#2", "http://www.contoso.com", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#3", "http://www.contoso.com/index.htm", uri.GetLeftPart (UriPartial.Path));
+
+ uri = new Uri ("mailto:user@contoso.com?subject=uri");
+ AssertEquals ("#4", "mailto:", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#5", "", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#6", "mailto:user@contoso.com", uri.GetLeftPart (UriPartial.Path));
+
+ uri = new Uri ("nntp://news.contoso.com/123456@contoso.com");
+ AssertEquals ("#7", "nntp://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#8", "nntp://news.contoso.com", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#9", "nntp://news.contoso.com/123456@contoso.com", uri.GetLeftPart (UriPartial.Path));
+
+ uri = new Uri ("news:123456@contoso.com");
+ AssertEquals ("#10", "news:", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#11", "", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#12", "news:123456@contoso.com", uri.GetLeftPart (UriPartial.Path));
+
+ uri = new Uri ("file://server/filename.ext");
+ AssertEquals ("#13", "file://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#14", "file://server", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#15", "file://server/filename.ext", uri.GetLeftPart (UriPartial.Path));
+
+ try {
+ uri = new Uri ("file:/filename.ext");
+ AssertEquals ("#16", "file://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#17", "", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#18", "file:///filename.ext", uri.GetLeftPart (UriPartial.Path));
+ } catch (UriFormatException) {
+ Fail ("#19: known to fail with ms.net (it's their own example!)");
+ }
+
+ uri = new Uri (@"\\server\share\filename.ext");
+ AssertEquals ("#20", "file://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#21", "file://server", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#22", "file://server/share/filename.ext", uri.GetLeftPart (UriPartial.Path));
+
+ uri = new Uri ("http://www.contoso.com:8080/index.htm#main");
+ AssertEquals ("#23", "http://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#24", "http://www.contoso.com:8080", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#25", "http://www.contoso.com:8080/index.htm", uri.GetLeftPart (UriPartial.Path));
+ }
+
+ public void TestCheckHostName ()
+ {
+ AssertEquals ("#1", UriHostNameType.Unknown, Uri.CheckHostName (null));
+ AssertEquals ("#2", UriHostNameType.Unknown, Uri.CheckHostName (""));
+ AssertEquals ("#3", UriHostNameType.Unknown, Uri.CheckHostName ("^&()~`!@"));
+ AssertEquals ("#4", UriHostNameType.Dns, Uri.CheckHostName ("x"));
+ AssertEquals ("#5", UriHostNameType.IPv4, Uri.CheckHostName ("1.2.3.4"));
+ AssertEquals ("#6", UriHostNameType.IPv4, Uri.CheckHostName ("0001.002.03.4"));
+ AssertEquals ("#7", UriHostNameType.Dns, Uri.CheckHostName ("0001.002.03.256"));
+ AssertEquals ("#8", UriHostNameType.Dns, Uri.CheckHostName ("9001.002.03.4"));
+ AssertEquals ("#9", UriHostNameType.Dns, Uri.CheckHostName ("www.contoso.com"));
+ AssertEquals ("#10", UriHostNameType.Unknown, Uri.CheckHostName (".www.contoso.com"));
+ AssertEquals ("#11: known to fail with ms.net: this is not a valid domain address", UriHostNameType.Unknown, Uri.CheckHostName ("www.contoso.com."));
+ AssertEquals ("#12", UriHostNameType.Dns, Uri.CheckHostName ("www.con-toso.com"));
+ AssertEquals ("#13", UriHostNameType.Dns, Uri.CheckHostName ("www.con_toso.com"));
+ AssertEquals ("#14", UriHostNameType.Unknown, Uri.CheckHostName ("www.con,toso.com"));
+
+ // test IPv6
+ AssertEquals ("#15", UriHostNameType.IPv6, Uri.CheckHostName ("11:22:33:44:55:66:77:88"));
+ AssertEquals ("#16", UriHostNameType.IPv6, Uri.CheckHostName ("11::33:44:55:66:77:88"));
+ AssertEquals ("#17", UriHostNameType.IPv6, Uri.CheckHostName ("::22:33:44:55:66:77:88"));
+ AssertEquals ("#18", UriHostNameType.IPv6, Uri.CheckHostName ("11:22:33:44:55:66:77::"));
+ AssertEquals ("#19", UriHostNameType.IPv6, Uri.CheckHostName ("11::88"));
+ AssertEquals ("#20", UriHostNameType.IPv6, Uri.CheckHostName ("11::77:88"));
+ AssertEquals ("#21", UriHostNameType.IPv6, Uri.CheckHostName ("11:22::88"));
+ AssertEquals ("#22", UriHostNameType.IPv6, Uri.CheckHostName ("11::"));
+ AssertEquals ("#23", UriHostNameType.IPv6, Uri.CheckHostName ("::88"));
+ AssertEquals ("#24", UriHostNameType.IPv6, Uri.CheckHostName ("::1"));
+ AssertEquals ("#25", UriHostNameType.IPv6, Uri.CheckHostName ("::"));
+ AssertEquals ("#26", UriHostNameType.IPv6, Uri.CheckHostName ("0:0:0:0:0:0:127.0.0.1"));
+ AssertEquals ("#27", UriHostNameType.IPv6, Uri.CheckHostName ("::127.0.0.1"));
+ AssertEquals ("#28", UriHostNameType.IPv6, Uri.CheckHostName ("::ffFF:169.32.14.5"));
+ AssertEquals ("#29", UriHostNameType.IPv6, Uri.CheckHostName ("2001:03A0::/35"));
+ AssertEquals ("#30", UriHostNameType.IPv6, Uri.CheckHostName ("[2001:03A0::/35]"));
+
+ AssertEquals ("#31", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0::/35"));
+ AssertEquals ("#32", UriHostNameType.Unknown, Uri.CheckHostName ("2001:03A0::/35a"));
+ AssertEquals ("#33 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0:1.2.3.4"));
+ AssertEquals ("#34", UriHostNameType.Unknown, Uri.CheckHostName ("::ffff:123.256.155.43"));
+ AssertEquals ("#35", UriHostNameType.Unknown, Uri.CheckHostName (":127.0.0.1"));
+ AssertEquals ("#36 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName (":11:22:33:44:55:66:77:88"));
+ AssertEquals ("#37", UriHostNameType.Unknown, Uri.CheckHostName ("::11:22:33:44:55:66:77:88"));
+ AssertEquals ("#38", UriHostNameType.Unknown, Uri.CheckHostName ("11:22:33:44:55:66:77:88::"));
+ AssertEquals ("#39", UriHostNameType.Unknown, Uri.CheckHostName ("11:22:33:44:55:66:77:88:"));
+ AssertEquals ("#40", UriHostNameType.Unknown, Uri.CheckHostName ("::acbde"));
+ AssertEquals ("#41", UriHostNameType.Unknown, Uri.CheckHostName ("::abce:"));
+ AssertEquals ("#42", UriHostNameType.Unknown, Uri.CheckHostName ("::abcg"));
+ AssertEquals ("#43", UriHostNameType.Unknown, Uri.CheckHostName (":::"));
+ AssertEquals ("#44", UriHostNameType.Unknown, Uri.CheckHostName (":"));
+ }
+
+ public void TestIsLoopback ()
+ {
+ Uri uri = new Uri("http://loopback:8080");
+ AssertEquals ("#1", true, uri.IsLoopback);
+ uri = new Uri("http://localhost:8080");
+ AssertEquals ("#2", true, uri.IsLoopback);
+ uri = new Uri("http://127.0.0.1:8080");
+ AssertEquals ("#3", true, uri.IsLoopback);
+ uri = new Uri("http://127.0.0.001:8080");
+ AssertEquals ("#4", true, uri.IsLoopback);
+ uri = new Uri("http://[::1]");
+ AssertEquals ("#5", true, uri.IsLoopback);
+ uri = new Uri("http://[::1]:8080");
+ AssertEquals ("#6", true, uri.IsLoopback);
+ uri = new Uri("http://[::0001]:8080");
+ AssertEquals ("#7", true, uri.IsLoopback);
+ uri = new Uri("http://[0:0:0:0::1]:8080");
+ AssertEquals ("#8", true, uri.IsLoopback);
+ uri = new Uri("http://[0:0:0:0::127.0.0.1]:8080");
+ AssertEquals ("#9", true, uri.IsLoopback);
+ uri = new Uri("http://[0:0:0:0::127.11.22.33]:8080");
+ AssertEquals ("#10: known to fail with ms.net", true, uri.IsLoopback);
+ uri = new Uri("http://[::ffff:127.11.22.33]:8080");
+ AssertEquals ("#11: known to fail with ms.net", true, uri.IsLoopback);
+ uri = new Uri("http://[::ff00:7f11:2233]:8080");
+ AssertEquals ("#12", false, uri.IsLoopback);
+ uri = new Uri("http://[1:0:0:0::1]:8080");
+ AssertEquals ("#13", false, uri.IsLoopback);
+ }
+
+ public void TestEquals ()
+ {
+ Uri uri1 = new Uri ("http://www.contoso.com/index.htm#main");
+ Uri uri2 = new Uri ("http://www.contoso.com/index.htm#fragment");
+ Assert ("#1", uri1.Equals (uri2));
+ uri2 = new Uri ("http://www.contoso.com/index.htm?x=1");
+ Assert ("#2 known to fail with ms.net", !uri1.Equals (uri2));
+ Assert ("#3", !uri2.Equals ("http://www.contoso.com/index.html?x=1"));
+ Assert ("#4: known to fail with ms.net", !uri1.Equals ("http://www.contoso.com:8080/index.htm?x=1"));
+ }
+
+ public void TestGetHashCode ()
+ {
+ Uri uri1 = new Uri ("http://www.contoso.com/index.htm#main");
+ Uri uri2 = new Uri ("http://www.contoso.com/index.htm#fragment");
+ AssertEquals ("#1", uri1.GetHashCode (), uri2.GetHashCode ());
+ uri2 = new Uri ("http://www.contoso.com/index.htm?x=1");
+ Assert ("#2", uri1.GetHashCode () != uri2.GetHashCode ());
+ uri2 = new Uri ("http://www.contoso.com:80/index.htm");
+ AssertEquals ("#3", uri1.GetHashCode (), uri2.GetHashCode ());
+ uri2 = new Uri ("http://www.contoso.com:8080/index.htm");
+ Assert ("#4", uri1.GetHashCode () != uri2.GetHashCode ());
+ }
+
+ public void TestMakeRelative ()
+ {
+ Uri uri1 = new Uri ("http://www.contoso.com/index.htm?x=2");
+ Uri uri2 = new Uri ("http://www.contoso.com/foo/bar/index.htm#fragment");
+ Uri uri3 = new Uri ("http://www.contoso.com/bar/foo/index.htm?y=1");
+ Uri uri4 = new Uri ("http://www.contoso.com/bar/foo2/index.htm?x=0");
+ Uri uri5 = new Uri ("https://www.contoso.com/bar/foo/index.htm?y=1");
+ Uri uri6 = new Uri ("http://www.contoso2.com/bar/foo/index.htm?x=0");
+ Uri uri7 = new Uri ("http://www.contoso2.com/bar/foo/foobar.htm?z=0&y=5");
+ Uri uri8 = new Uri ("http://www.xxx.com/bar/foo/foobar.htm?z=0&y=5" + (char) 0xa9);
+
+ AssertEquals ("#1", "foo/bar/index.htm", uri1.MakeRelative (uri2));
+ AssertEquals ("#2", "../../index.htm", uri2.MakeRelative (uri1));
+
+ AssertEquals ("#3", "../../bar/foo/index.htm", uri2.MakeRelative (uri3));
+ AssertEquals ("#4", "../../foo/bar/index.htm", uri3.MakeRelative (uri2));
+
+ AssertEquals ("#5", "../foo2/index.htm", uri3.MakeRelative (uri4));
+ AssertEquals ("#6", "../foo/index.htm", uri4.MakeRelative (uri3));
+
+ AssertEquals ("#7", "https://www.contoso.com/bar/foo/index.htm?y=1",
+ uri4.MakeRelative (uri5));
+
+ AssertEquals ("#8", "http://www.contoso2.com/bar/foo/index.htm?x=0",
+ uri4.MakeRelative (uri6));
+
+ AssertEquals ("#9", "", uri6.MakeRelative (uri6));
+ AssertEquals ("#10", "foobar.htm", uri6.MakeRelative (uri7));
+
+ Uri uri10 = new Uri ("mailto:xxx@xxx.com");
+ Uri uri11 = new Uri ("mailto:xxx@xxx.com?subject=hola");
+ AssertEquals ("#11", "", uri10.MakeRelative (uri11));
+
+ Uri uri12 = new Uri ("mailto:xxx@mail.xxx.com?subject=hola");
+ AssertEquals ("#12", "mailto:xxx@mail.xxx.com?subject=hola", uri10.MakeRelative (uri12));
+
+ Uri uri13 = new Uri ("mailto:xxx@xxx.com/foo/bar");
+ AssertEquals ("#13", "/foo/bar", uri10.MakeRelative (uri13));
+
+ AssertEquals ("#14", "http://www.xxx.com/bar/foo/foobar.htm?z=0&y=5" + (char) 0xa9, uri1.MakeRelative (uri8));
+ }
+
+ public void TestToString ()
+ {
+ Uri uri = new Uri ("dummy://xxx");
+ AssertEquals ("#1", "dummy://xxx/", uri.ToString ());
+ }
+
+ public static void Print (Uri uri)
+ {
+ Console.WriteLine ("ToString: " + uri.ToString ());
+
+ Console.WriteLine ("AbsolutePath: " + uri.AbsolutePath);
+ Console.WriteLine ("AbsoluteUri: " + uri.AbsoluteUri);
+ Console.WriteLine ("Authority: " + uri.Authority);
+ Console.WriteLine ("Fragment: " + uri.Fragment);
+ Console.WriteLine ("Host: " + uri.Host);
+ Console.WriteLine ("HostNameType: " + uri.HostNameType);
+ Console.WriteLine ("IsDefaultPort: " + uri.IsDefaultPort);
+ Console.WriteLine ("IsFile: " + uri.IsFile);
+ Console.WriteLine ("IsLoopback: " + uri.IsLoopback);
+ Console.WriteLine ("IsUnc: " + uri.IsUnc);
+ Console.WriteLine ("LocalPath: " + uri.LocalPath);
+ Console.WriteLine ("PathAndQuery: " + uri.PathAndQuery);
+ Console.WriteLine ("Port: " + uri.Port);
+ Console.WriteLine ("Query: " + uri.Query);
+ Console.WriteLine ("Scheme: " + uri.Scheme);
+ Console.WriteLine ("UserEscaped: " + uri.UserEscaped);
+ Console.WriteLine ("UserInfo: " + uri.UserInfo);
+
+ Console.WriteLine ("Segments:");
+ string [] segments = uri.Segments;
+ if (segments == null)
+ Console.WriteLine ("\tNo Segments");
+ else
+ for (int i = 0; i < segments.Length; i++)
+ Console.WriteLine ("\t" + segments[i]);
+ Console.WriteLine ("");
+ }
+
+ }
+}
+
diff --git a/mcs/class/System/Test/System_test.build b/mcs/class/System/Test/System_test.build
new file mode 100644
index 00000000000..70e12095154
--- /dev/null
+++ b/mcs/class/System/Test/System_test.build
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System_linux_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore_mono.dll"/>
+ </references>
+
+ <arg value="/r:..\..\lib\System.dll"/>
+ <arg value="/r:..\..\lib\corlib.dll"/>
+ <arg value="/r:..\..\lib\System.Xml.dll"/>
+ <arg value="/nowarn:1595"/>
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ </csc>
+
+ <csc target="library" output="System_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+
+ <arg value="/noconfig"/>
+ <arg value="/r:..\..\lib\System.dll"/>
+ <arg value="/r:..\..\lib\System.Xml.dll"/>
+ </csc>
+
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.AllTests,System_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System_test.dll" failonerror="false"/>
+ <delete file="System_linux_test.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System/Test/makefile.gnu b/mcs/class/System/Test/makefile.gnu
new file mode 100644
index 00000000000..723b72b923f
--- /dev/null
+++ b/mcs/class/System/Test/makefile.gnu
@@ -0,0 +1,30 @@
+topdir = ../../..
+
+LIBRARY = system_linux_test.dll
+
+LIB_LIST = system_linux_test.args
+LIB_FLAGS = \
+ -r $(topdir)/class/lib/corlib.dll \
+ -r $(topdir)/class/lib/System.dll \
+ -r $(topdir)/class/lib/System.Xml.dll \
+ -r $(topdir)/class/lib/NUnitCore_mono.dll
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=_DUMMY_
+
+include $(topdir)/class/library.make
+
+MCS_FLAGS = --target library --noconfig
+
+TEST_SUITE_PREFIX = MonoTests.
+TEST_SUITE = AllTests
+NUNITCONSOLE=$(topdir)/class/lib/NUnitConsole_mono.exe
+MONO_PATH = $(topdir)/class/lib:.
+
+
+test: $(LIBRARY) run_test
+
+.PHONY: run_test
+
+run_test:
+ -MONO_PATH=$(MONO_PATH) mono $(NUNITCONSOLE) $(TEST_SUITE_PREFIX)$(TEST_SUITE),system_linux_test.dll
diff --git a/mcs/class/System/Test/system_linux_test.args b/mcs/class/System/Test/system_linux_test.args
new file mode 100644
index 00000000000..fc16c573402
--- /dev/null
+++ b/mcs/class/System/Test/system_linux_test.args
@@ -0,0 +1,46 @@
+--target library
+-o corlib_linux_test.dll
+--noconfig
+-r ../../lib/corlib.dll
+-r ../../lib/System.dll
+-r ../../lib/System.Xml.dll
+-r ../../../nunit/NUnitCore_mono.dll
+AllTests.cs
+BasicOperationsTest.cs
+System/AllTests.cs
+System/UriBuilderTest.cs
+System/UriTest.cs
+System.Collections.Specialized/AllTests.cs
+System.Collections.Specialized/BitVector32Test.cs
+System.Collections.Specialized/HybridDictionaryTest.cs
+System.Collections.Specialized/NameValueCollectionTest.cs
+System.Collections.Specialized/StringCollectionTest.cs
+System.ComponentModel/AllTests.cs
+System.ComponentModel/EventHandlerListTests.cs
+System.Diagnostics/AllTests.cs
+System.Diagnostics/TraceTest.cs
+System.Diagnostics/SwitchesTest.cs
+System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
+System.Net/AllTests.cs
+System.Net/CookieCollectionTest.cs
+System.Net/CookieTest.cs
+System.Net/CredentialCacheTest.cs
+System.Net/DnsTest.cs
+System.Net/FileWebRequestTest.cs
+System.Net/HttpWebRequestTest.cs
+System.Net/IPAddressTest.cs
+System.Net/IPEndPointTest.cs
+System.Net/ServicePointManagerTest.cs
+System.Net/ServicePointTest.cs
+System.Net/SocketPermissionTest.cs
+System.Net/WebHeaderCollectionTest.cs
+System.Net/WebProxyTest.cs
+System.Net/WebRequestTest.cs
+System.Net.Sockets/AllTests.cs
+System.Net.Sockets/TcpClientTest.cs
+System.Net.Sockets/TcpListenerTest.cs
+System.Text.RegularExpressions/AllTests.cs
+System.Text.RegularExpressions/PerlTest.cs
+System.Text.RegularExpressions/PerlTrials.cs
+System.Text.RegularExpressions/RegexTrial.cs
+Microsoft.CSharp/AllTests.cs
diff --git a/mcs/class/System/Test/test-config-file b/mcs/class/System/Test/test-config-file
new file mode 100644
index 00000000000..ab02e7cab7d
--- /dev/null
+++ b/mcs/class/System/Test/test-config-file
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <system.diagnostics>
+ <switches>
+ <!-- Boolean switches: any non-zero value is true -->
+ <add name="bool-true" value="1"/>
+ <add name="bool-true-2" value="4"/>
+ <add name="bool-true-3" value="-2"/>
+ <add name="bool-false" value="0"/>
+ <add name="bool-default"/>
+
+ <!-- trace switches: -->
+ <add name="trace-off" value="0"/>
+ <add name="trace-error" value="1"/>
+ <add name="trace-warning" value="2"/>
+ <add name="trace-info" value="3"/>
+ <add name="trace-verbose" value="4"/>
+
+ <!-- this should have a default value of 0 -->
+ <add name="no-value"/>
+
+ <!-- this should be read in as 0 for Switches -->
+ <add name="string-value" value="string-value"/>
+
+ <!-- this causes problems on .NET -->
+ <add name="trace-negative" value="-1"/>
+ </switches>
+ </system.diagnostics>
+</configuration>
+
diff --git a/mcs/class/System/list b/mcs/class/System/list
new file mode 100755
index 00000000000..1df12bb6dc2
--- /dev/null
+++ b/mcs/class/System/list
@@ -0,0 +1,150 @@
+-r System.Xml --noconfig
+System\TODOAttribute.cs
+System\Uri.cs
+System\UriFormatException.cs
+System\UriHostNameType.cs
+System\UriPartial.cs
+System.Collections.Specialized\BitVector32.cs
+System.Collections.Specialized\ListDictionary.cs
+System.Collections.Specialized\NameObjectCollectionBase.cs
+System.Collections.Specialized\NameValueCollection.cs
+System.Collections.Specialized\StringCollection.cs
+System.Collections.Specialized\StringDictionary.cs
+System.Collections.Specialized\StringEnumerator.cs
+System.ComponentModel\BrowsableAttribute.cs
+System.ComponentModel\CancelEventArgs.cs
+System.ComponentModel\CancelEventHandler.cs
+System.ComponentModel\CategoryAttribute.cs
+System.ComponentModel\CollectionChangeAction.cs
+System.ComponentModel\CollectionChangeEventArgs.cs
+System.ComponentModel\CollectionChangeEventHandler.cs
+System.ComponentModel\Component.cs
+System.ComponentModel\ComponentCollection.cs
+System.ComponentModel\Container.cs
+System.ComponentModel\DerivedPropertyDescriptor.cs
+System.ComponentModel\DescriptionAttribute.cs
+System.ComponentModel\DesignerSerializationVisibility.cs
+System.ComponentModel\DesignerSerializationVisibilityAttribute.cs
+System.ComponentModel\DesignOnlyAttribute.cs
+System.ComponentModel\DesignTimeVisibleAttribute.cs
+System.ComponentModel\EnumConverter.cs
+System.ComponentModel\EventHandlerList.cs
+System.ComponentModel\IBindingList.cs
+System.ComponentModel\IComponent.cs
+System.ComponentModel\IContainer.cs
+System.ComponentModel\IExtenderProvider.cs
+System.ComponentModel\IListSource.cs
+System.ComponentModel\ISite.cs
+System.ComponentModel\ISupportInitialize.cs
+System.ComponentModel\ISynchronizeInvoke.cs
+System.ComponentModel\ITypeDescriptorContext.cs
+System.ComponentModel\ITypedList.cs
+System.ComponentModel\ListChangedEventArgs.cs
+System.ComponentModel\ListChangedEventHandler.cs
+System.ComponentModel\ListChangedType.cs
+System.ComponentModel\ListSortDirection.cs
+System.ComponentModel\LocalizableAttribute.cs
+System.ComponentModel\MarshalByValueComponent.cs
+System.ComponentModel\MemberDescriptor.cs
+System.ComponentModel\PropertyChangedEventArgs.cs
+System.ComponentModel\PropertyChangedEventHandler.cs
+System.ComponentModel\PropertyDescriptor.cs
+System.ComponentModel\PropertyDescriptorCollection.cs
+System.ComponentModel\TypeConverter.cs
+System.ComponentModel\WarningException.cs
+System.ComponentModel\Win32Exception.cs
+System.Configuration\ConfigurationException.cs
+System.Configuration\ConfigurationSettings.cs
+System.Configuration\DictionarySectionHandler.cs
+System.Configuration\IConfigurationSectionHandler.cs
+System.Configuration\IgnoreSectionHandler.cs
+System.Configuration\NameValueSectionHandler.cs
+System.Configuration\SingleTagSectionHandler.cs
+System.Diagnostics\BooleanSwitch.cs
+System.Diagnostics\Debug.cs
+System.Diagnostics\DefaultTraceListener.cs
+System.Diagnostics\DiagnosticsConfigurationHandler.cs
+System.Diagnostics\FileVersionInfo.cs
+System.Diagnostics\Process.cs
+System.Diagnostics\ProcessModule.cs
+System.Diagnostics\ProcessModuleCollection.cs
+System.Diagnostics\ProcessPriorityClass.cs
+System.Diagnostics\ProcessStartInfo.cs
+System.Diagnostics\ProcessThread.cs
+System.Diagnostics\ProcessThreadCollection.cs
+System.Diagnostics\ProcessWindowStyle.cs
+System.Diagnostics\TextWriterTraceListener.cs
+System.Diagnostics\ThreadPriorityLevel.cs
+System.Diagnostics\ThreadState.cs
+System.Diagnostics\ThreadWaitReason.cs
+System.Diagnostics\Trace.cs
+System.Diagnostics\TraceImpl.cs
+System.Diagnostics\TraceLevel.cs
+System.Diagnostics\TraceListenerCollection.cs
+System.Diagnostics\TraceSwitch.cs
+System.Globalization\Locale.cs
+System.Net\Authorization.cs
+System.Net\ConnectionModes.cs
+System.Net\Cookie.cs
+System.Net\CookieCollection.cs
+System.Net\CookieException.cs
+System.Net\Dns.cs
+System.Net\DnsPermission.cs
+System.Net\DnsPermissionAttribute.cs
+System.Net\EndPoint.cs
+System.Net\EndpointPermission.cs
+System.Net\HttpStatusCode.cs
+System.Net\ICredentialLookup.cs
+System.Net\IPAddress.cs
+System.Net\IPEndPoint.cs
+System.Net\IPHostEntry.cs
+System.Net\NetworkAccess.cs
+System.Net\NetworkCredential.cs
+System.Net\ProtocolViolationException.cs
+System.Net\ProxyUseType.cs
+System.Net\SocketAddress.cs
+System.Net\SocketPermission.cs
+System.Net\SocketPermissionAttribute.cs
+System.Net\TransportType.cs
+System.Net\WebExceptionStatus.cs
+System.Net\WebStatus.cs
+System.Net.Sockets\AddressFamily.cs
+System.Net.Sockets\LingerOption.cs
+System.Net.Sockets\MulticastOption.cs
+System.Net.Sockets\NetworkStream.cs
+System.Net.Sockets\ProtocolFamily.cs
+System.Net.Sockets\ProtocolType.cs
+System.Net.Sockets\SelectMode.cs
+System.Net.Sockets\Socket.cs
+System.Net.Sockets\SocketException.cs
+System.Net.Sockets\SocketFlags.cs
+System.Net.Sockets\SocketOptionLevel.cs
+System.Net.Sockets\SocketOptionName.cs
+System.Net.Sockets\SocketShutdown.cs
+System.Net.Sockets\SocketType.cs
+System.Net.Sockets\TcpClient.cs
+System.Net.Sockets\TcpListener.cs
+System.Net.Sockets\UdpClient.cs
+System.Text.RegularExpressions\arch.cs
+System.Text.RegularExpressions\cache.cs
+System.Text.RegularExpressions\category.cs
+System.Text.RegularExpressions\collections.cs
+System.Text.RegularExpressions\compiler.cs
+System.Text.RegularExpressions\debug.cs
+System.Text.RegularExpressions\interpreter.cs
+System.Text.RegularExpressions\interval.cs
+System.Text.RegularExpressions\match.cs
+System.Text.RegularExpressions\parser.cs
+System.Text.RegularExpressions\quicksearch.cs
+System.Text.RegularExpressions\regex.cs
+System.Text.RegularExpressions\RegexRunner.cs
+System.Text.RegularExpressions\RegexRunnerFactory.cs
+System.Text.RegularExpressions\replace.cs
+System.Text.RegularExpressions\syntax.cs
+System.Threading\ThreadExceptionEventArgs.cs
+System.Threading\ThreadExceptionEventHandler.cs
+System.Diagnostics\Switch.cs
+System.Diagnostics\TraceListener.cs
+System.Net\IPv6Address.cs
+Microsoft.CSharp\CSharpCodeProvider.cs
+Microsoft.CSharp\CSharpCodeGenerator.cs
diff --git a/mcs/class/System/list.unix b/mcs/class/System/list.unix
new file mode 100755
index 00000000000..21fe9b3b56c
--- /dev/null
+++ b/mcs/class/System/list.unix
@@ -0,0 +1,353 @@
+-r mscorlib -r System.Xml -r System.Drawing --noconfig --target library -o System.dll
+System.Collections.Specialized/StringEnumerator.cs
+System.Collections.Specialized/StringDictionary.cs
+System.Collections.Specialized/StringCollection.cs
+System.Collections.Specialized/NameObjectCollectionBase.cs
+System.Collections.Specialized/BitVector32.cs
+System.Collections.Specialized/CollectionsUtil.cs
+System.Collections.Specialized/HybridDictionary.cs
+System.Collections.Specialized/ListDictionary.cs
+System.Collections.Specialized/NameValueCollection.cs
+System.CodeDom/CodeAssignStatement.cs
+System.CodeDom/CodeStatementCollection.cs
+System.CodeDom/CodeAttributeDeclaration.cs
+System.CodeDom/CodeParameterDeclarationExpressionCollection.cs
+System.CodeDom/CodeComment.cs
+System.CodeDom/CodeBinaryOperatorType.cs
+System.CodeDom/CodeBaseReferenceExpression.cs
+System.CodeDom/CodeBinaryOperatorExpression.cs
+System.CodeDom/CodeCompileUnit.cs
+System.CodeDom/CodeTypeConstructor.cs
+System.CodeDom/CodeTypeDeclaration.cs
+System.CodeDom/CodeDirectionExpression.cs
+System.CodeDom/CodeExpressionStatement.cs
+System.CodeDom/CodeDelegateCreateExpression.cs
+System.CodeDom/CodeCommentStatement.cs
+System.CodeDom/CodeTypeDelegate.cs
+System.CodeDom/CodeConditionStatement.cs
+System.CodeDom/CodeTypeReference.cs
+System.CodeDom/CodeDelegateInvokeExpression.cs
+System.CodeDom/CodeEntryPointMethod.cs
+System.CodeDom/CodeIterationStatement.cs
+System.CodeDom/CodeObject.cs
+System.CodeDom/CodeFieldReferenceExpression.cs
+System.CodeDom/CodeMemberEvent.cs
+System.CodeDom/CodeExpression.cs
+System.CodeDom/CodeEventReferenceExpression.cs
+System.CodeDom/CodeMemberField.cs
+System.CodeDom/CodeTypeDeclarationCollection.cs
+System.CodeDom/CodeMemberProperty.cs
+System.CodeDom/CodeGotoStatement.cs
+System.CodeDom/CodeIndexerExpression.cs
+System.CodeDom/CodeTypeMemberCollection.cs
+System.CodeDom/MemberAttributes.cs
+System.CodeDom/CodeMethodInvokeExpression.cs
+System.CodeDom/CodeMethodReferenceExpression.cs
+System.CodeDom/CodePrimitiveExpression.cs
+System.CodeDom/CodeMethodReturnStatement.cs
+System.CodeDom/CodeNamespaceImport.cs
+System.CodeDom/CodeSnippetCompileUnit.cs
+System.CodeDom/CodeNamespaceImportCollection.cs
+System.CodeDom/CodeObjectCreateExpression.cs
+System.CodeDom/CodeParameterDeclarationExpression.cs
+System.CodeDom/CodeTypeReferenceCollection.cs
+System.CodeDom/CodePropertyReferenceExpression.cs
+System.CodeDom/CodePropertySetValueReferenceExpression.cs
+System.CodeDom/CodeRemoveEventStatement.cs
+System.CodeDom/CodeThisReferenceExpression.cs
+System.CodeDom/CodeThrowExceptionStatement.cs
+System.CodeDom/CodeTryCatchFinallyStatement.cs
+System.CodeDom/CodeCastExpression.cs
+System.CodeDom/CodeArgumentReferenceExpression.cs
+System.CodeDom/CodeArrayIndexerExpression.cs
+System.CodeDom/CodeAttributeArgument.cs
+System.CodeDom/CodeAttachEventStatement.cs
+System.CodeDom/CodeLabeledStatement.cs
+System.CodeDom/CodeLinePragma.cs
+System.CodeDom/CodeSnippetExpression.cs
+System.CodeDom/CodeSnippetStatement.cs
+System.CodeDom/CodeSnippetTypeMember.cs
+System.CodeDom/CodeStatement.cs
+System.CodeDom/CodeTypeMember.cs
+System.CodeDom/CodeTypeOfExpression.cs
+System.CodeDom/CodeTypeReferenceExpression.cs
+System.CodeDom/CodeVariableDeclarationStatement.cs
+System.CodeDom/CodeVariableReferenceExpression.cs
+System.CodeDom/FieldDirection.cs
+System.CodeDom/CodeArrayCreateExpression.cs
+System.CodeDom/CodeAttributeArgumentCollection.cs
+System.CodeDom/CodeAttributeDeclarationCollection.cs
+System.CodeDom/CodeCatchClause.cs
+System.CodeDom/CodeCatchClauseCollection.cs
+System.CodeDom/CodeCommentStatementCollection.cs
+System.CodeDom/CodeConstructor.cs
+System.CodeDom/CodeExpressionCollection.cs
+System.CodeDom/CodeMemberMethod.cs
+System.CodeDom/CodeNamespace.cs
+System.CodeDom/CodeNamespaceCollection.cs
+System.CodeDom.Compiler/CodeDomProvider.cs
+System.CodeDom.Compiler/CodeGenerator.cs
+System.CodeDom.Compiler/CodeGeneratorOptions.cs
+System.CodeDom.Compiler/CompilerError.cs
+System.CodeDom.Compiler/CompilerErrorCollection.cs
+System.CodeDom.Compiler/CompilerOptions.cs
+System.CodeDom.Compiler/CompilerParameters.cs
+System.CodeDom.Compiler/CompilerResults.cs
+System.CodeDom.Compiler/GeneratorSupport.cs
+System.CodeDom.Compiler/ICodeCompiler.cs
+System.CodeDom.Compiler/ICodeGenerator.cs
+System.CodeDom.Compiler/ICodeParser.cs
+System.CodeDom.Compiler/IndentedTextWriter.cs
+System.CodeDom.Compiler/LanguageOptions.cs
+System.CodeDom.Compiler/TempFileCollection.cs
+System.Net/CookieContainer.cs
+System.Net/EndPoint.cs
+System.Net/CookieCollection.cs
+System.Net/IPAddress.cs
+System.Net/Cookie.cs
+System.Net/CookieException.cs
+System.Net/HttpStatusCode.cs
+System.Net/NetworkAccess.cs
+System.Net/TransportType.cs
+System.Net/WebExceptionStatus.cs
+System.Net/ConnectionModes.cs
+System.Net/ProxyUseType.cs
+System.Net/WebStatus.cs
+System.Net/IPHostEntry.cs
+System.Net/EndpointPermission.cs
+System.Net/Dns.cs
+System.Net/ProtocolViolationException.cs
+System.Net/IWebProxy.cs
+System.Net/ICredentialLookup.cs
+System.Net/NetworkCredential.cs
+System.Net/SocketPermissionAttribute.cs
+System.Net/DnsPermissionAttribute.cs
+System.Net/Authorization.cs
+System.Net/CredentialCache.cs
+System.Net/HttpContinueDelegate.cs
+System.Net/HttpVersion.cs
+System.Net/ICertificatePolicy.cs
+System.Net/IPv6Address.cs
+System.Net/SocketAddress.cs
+System.Net/IWebRequestCreate.cs
+System.Net/WebException.cs
+System.Net/GlobalProxySelection.cs
+System.Net/WebHeaderCollection.cs
+System.Net/WebRequest.cs
+System.Net/WebResponse.cs
+System.Net/IPEndPoint.cs
+System.Net/FileWebRequest.cs
+System.Net/FileWebResponse.cs
+System.Net/ServicePoint.cs
+System.Net/ServicePointManager.cs
+System.Net/WebClient.cs
+System.Net/WebProxy.cs
+System.Net/DnsPermission.cs
+System.Net/HttpWebRequest.cs
+System.Net/HttpWebResponse.cs
+System.Net/MonoHttpDate.cs
+System.Net/SocketPermission.cs
+System.Net.Sockets/AddressFamily.cs
+System.Net.Sockets/TcpListener.cs
+System.Net.Sockets/TcpClient.cs
+System.Net.Sockets/UdpClient.cs
+System.Net.Sockets/ProtocolType.cs
+System.Net.Sockets/SelectMode.cs
+System.Net.Sockets/SocketException.cs
+System.Net.Sockets/SocketFlags.cs
+System.Net.Sockets/SocketOptionLevel.cs
+System.Net.Sockets/SocketOptionName.cs
+System.Net.Sockets/SocketShutdown.cs
+System.Net.Sockets/SocketType.cs
+System.Net.Sockets/LingerOption.cs
+System.Net.Sockets/MulticastOption.cs
+System.Net.Sockets/Socket.cs
+System.Net.Sockets/ProtocolFamily.cs
+System.Net.Sockets/NetworkStream.cs
+System.ComponentModel/ITypedList.cs
+System.ComponentModel/BaseNumberConverter.cs
+System.ComponentModel/Component.cs
+System.ComponentModel/ComponentCollection.cs
+System.ComponentModel/DefaultEventAttribute.cs
+System.ComponentModel/DefaultPropertyAttribute.cs
+System.ComponentModel/IContainer.cs
+System.ComponentModel/BindableAttribute.cs
+System.ComponentModel/BindableSupport.cs
+System.ComponentModel/BrowsableAttribute.cs
+System.ComponentModel/DescriptionAttribute.cs
+System.ComponentModel/ExpandableObjectConverter.cs
+System.ComponentModel/IBindingList.cs
+System.ComponentModel/Int32Converter.cs
+System.ComponentModel/DesignerSerializationVisibility.cs
+System.ComponentModel/PropertyChangedEventArgs.cs
+System.ComponentModel/LocalizableAttribute.cs
+System.ComponentModel/ListChangedEventArgs.cs
+System.ComponentModel/ListChangedEventHandler.cs
+System.ComponentModel/ListChangedType.cs
+System.ComponentModel/ListSortDirection.cs
+System.ComponentModel/NotifyParentPropertyAttribute.cs
+System.ComponentModel/AttributeCollection.cs
+System.ComponentModel/DesignerSerializationVisibilityAttribute.cs
+System.ComponentModel/PropertyDescriptor.cs
+System.ComponentModel/Container.cs
+System.ComponentModel/DesignerAttribute.cs
+System.ComponentModel/DesignOnlyAttribute.cs
+System.ComponentModel/EventHandlerList.cs
+System.ComponentModel/MemberDescriptor.cs
+System.ComponentModel/PropertyDescriptorCollection.cs
+System.ComponentModel/RecommendedAsConfigurableAttribute.cs
+System.ComponentModel/ISynchronizeInvoke.cs
+System.ComponentModel/CancelEventArgs.cs
+System.ComponentModel/CancelEventHandler.cs
+System.ComponentModel/CategoryAttribute.cs
+System.ComponentModel/CollectionChangeAction.cs
+System.ComponentModel/CollectionChangeEventArgs.cs
+System.ComponentModel/CollectionChangeEventHandler.cs
+System.ComponentModel/DerivedPropertyDescriptor.cs
+System.ComponentModel/DesignTimeVisibleAttribute.cs
+System.ComponentModel/EnumConverter.cs
+System.ComponentModel/IListSource.cs
+System.ComponentModel/ISupportInitialize.cs
+System.ComponentModel/ICustomTypeDescriptor.cs
+System.ComponentModel/IDataErrorInfo.cs
+System.ComponentModel/IEditableObject.cs
+System.ComponentModel/IExtenderProvider.cs
+System.ComponentModel/EventDescriptor.cs
+System.ComponentModel/DefaultValueAttribute.cs
+System.ComponentModel/EditorAttribute.cs
+System.ComponentModel/EditorBrowsableAttribute.cs
+System.ComponentModel/EditorBrowsableState.cs
+System.ComponentModel/EventDescriptorCollection.cs
+System.ComponentModel/IComponent.cs
+System.ComponentModel/ISite.cs
+System.ComponentModel/ListBindableAttribute.cs
+System.ComponentModel/MarshalByValueComponent.cs
+System.ComponentModel/PropertyChangedEventHandler.cs
+System.ComponentModel/PropertyTabScope.cs
+System.ComponentModel/ReadOnlyAttribute.cs
+System.ComponentModel/RefreshProperties.cs
+System.ComponentModel/RefreshPropertiesAttribute.cs
+System.ComponentModel/Win32Exception.cs
+System.ComponentModel/ITypeDescriptorContext.cs
+System.ComponentModel/ToolboxItemAttribute.cs
+System.ComponentModel/TypeConverter.cs
+System.ComponentModel/TypeConverterAttribute.cs
+System.ComponentModel/TypeDescriptor.cs
+System.ComponentModel/RefreshEventHandler.cs
+System.ComponentModel/RefreshEventArgs.cs
+System.ComponentModel/StringConverter.cs
+System.ComponentModel/WarningException.cs
+System.ComponentModel/InvalidEnumArgumentException.cs
+System.ComponentModel.Design/ActiveDesignerEventArgs.cs
+System.ComponentModel.Design/ActiveDesignerEventHandler.cs
+System.ComponentModel.Design/CommandID.cs
+System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs
+System.ComponentModel.Design/DesignerTransactionCloseEventHandler.cs
+System.ComponentModel.Design/DesignerTransaction.cs
+System.ComponentModel.Design/DesignerVerbCollection.cs
+System.ComponentModel.Design/DesignerVerb.cs
+System.ComponentModel.Design/IDesigner.cs
+System.ComponentModel.Design/IDesignerHost.cs
+System.ComponentModel.Design/IResourceService.cs
+System.ComponentModel.Design/ISelectionService.cs
+System.ComponentModel.Design/IServiceContainer.cs
+System.ComponentModel.Design/MenuCommand.cs
+System.ComponentModel.Design/ServiceCreatorCallback.cs
+System/UriPartial.cs
+System/TODOAttribute.cs
+System/UriFormatException.cs
+System/UriBuilder.cs
+System/UriHostNameType.cs
+System/Uri.cs
+System.Configuration/AppSettingsReader.cs
+System.Configuration/ConfigHelper.cs
+System.Configuration/IConfigurationSectionHandler.cs
+System.Configuration/IConfigurationSystem.cs
+System.Configuration/IConfigXmlNode.cs
+System.Configuration/IgnoreSectionHandler.cs
+System.Configuration/NameValueFileSectionHandler.cs
+System.Configuration/NameValueSectionHandler.cs
+System.Configuration/ConfigurationException.cs
+System.Configuration/ConfigurationSettings.cs
+System.Configuration/ConfigXmlDocument.cs
+System.Configuration/DictionarySectionHandler.cs
+System.Configuration/SingleTagSectionHandler.cs
+System.Diagnostics/BooleanSwitch.cs
+System.Diagnostics/Switch.cs
+System.Diagnostics/TraceLevel.cs
+System.Diagnostics/EntryWrittenEventArgs.cs
+System.Diagnostics/TraceSwitch.cs
+System.Diagnostics/Debug.cs
+System.Diagnostics/DiagnosticsConfigurationHandler.cs
+System.Diagnostics/ProcessStartInfo.cs
+System.Diagnostics/DefaultTraceListener.cs
+System.Diagnostics/TextWriterTraceListener.cs
+System.Diagnostics/Trace.cs
+System.Diagnostics/TraceListenerCollection.cs
+System.Diagnostics/EventLogEntry.cs
+System.Diagnostics/EventLog.cs
+System.Diagnostics/TraceImpl.cs
+System.Diagnostics/EntryWrittenEventHandler.cs
+System.Diagnostics/EventLogEntryCollection.cs
+System.Diagnostics/EventLogEntryType.cs
+System.Diagnostics/EventLogInstaller.cs
+System.Diagnostics/EventLogPermission.cs
+System.Diagnostics/EventLogPermissionEntry.cs
+System.Diagnostics/ProcessModule.cs
+System.Diagnostics/ProcessPriorityClass.cs
+System.Diagnostics/EventLogPermissionAccess.cs
+System.Diagnostics/FileVersionInfo.cs
+System.Diagnostics/EventLogPermissionAttribute.cs
+System.Diagnostics/EventLogTraceListener.cs
+System.Diagnostics/Process.cs
+System.Diagnostics/ProcessModuleCollection.cs
+System.Diagnostics/ICollectData.cs
+System.Diagnostics/ProcessThread.cs
+System.Diagnostics/ProcessThreadCollection.cs
+System.Diagnostics/ProcessWindowStyle.cs
+System.Diagnostics/ThreadPriorityLevel.cs
+System.Diagnostics/ThreadState.cs
+System.Diagnostics/ThreadWaitReason.cs
+System.Diagnostics/EventLogPermissionEntryCollection.cs
+System.Diagnostics/TraceListener.cs
+System.IO/ErrorEventArgs.cs
+System.IO/ErrorEventHandler.cs
+System.IO/FileSystemEventArgs.cs
+System.IO/FileSystemEventHandler.cs
+System.IO/FileSystemWatcher.cs
+System.IO/InternalBufferOverflowException.cs
+System.IO/IODescriptionAttribute.cs
+System.IO/NotifyFilters.cs
+System.IO/MonoIO.cs
+System.IO/MonoIOError.cs
+System.IO/RenamedEventArgs.cs
+System.IO/RenamedEventHandler.cs
+System.IO/WaitForChangedResult.cs
+System.IO/WatcherChangeTypes.cs
+System.Threading/ThreadExceptionEventArgs.cs
+System.Threading/ThreadExceptionEventHandler.cs
+System.Globalization/Locale.cs
+System.Text.RegularExpressions/arch.cs
+System.Text.RegularExpressions/collections.cs
+System.Text.RegularExpressions/interpreter.cs
+System.Text.RegularExpressions/category.cs
+System.Text.RegularExpressions/match.cs
+System.Text.RegularExpressions/regex.cs
+System.Text.RegularExpressions/compiler.cs
+System.Text.RegularExpressions/debug.cs
+System.Text.RegularExpressions/interval.cs
+System.Text.RegularExpressions/quicksearch.cs
+System.Text.RegularExpressions/replace.cs
+System.Text.RegularExpressions/syntax.cs
+System.Text.RegularExpressions/parser.cs
+System.Text.RegularExpressions/RegexRunner.cs
+System.Text.RegularExpressions/RegexRunnerFactory.cs
+System.Text.RegularExpressions/cache.cs
+System.Timers/ElapsedEventArgs.cs
+System.Timers/ElapsedEventHandler.cs
+System.Timers/Timer.cs
+System.Timers/TimersDescriptionAttribute.cs
+System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs
+Microsoft.CSharp/CSharpCodeProvider.cs
+Microsoft.CSharp/CSharpCodeGenerator.cs
+Microsoft.CSharp/CSharpCodeCompiler.cs
diff --git a/mcs/class/System/makefile.gnu b/mcs/class/System/makefile.gnu
new file mode 100644
index 00000000000..f951f19ca78
--- /dev/null
+++ b/mcs/class/System/makefile.gnu
@@ -0,0 +1,22 @@
+topdir = ../..
+
+TEST_DIR= Test
+LIBRARY = $(topdir)/class/lib/System.dll
+
+LIB_LIST = list.unix
+LIB_FLAGS = -r corlib -r System.Xml -r mscorlib
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ ./System.CodeDom/Code-X-Collection.cs \
+ ./System.Net/IAuthenticationModule.cs \
+ ./System.Net/AuthenticationManager.cs \
+ ./System.Diagnostics/Performance*.cs \
+ ./System.Diagnostics/Counter*.cs \
+ ./System.Diagnostics/InstanceData*.cs
+
+
+export MONO_PATH_PREFIX = $(topdir)/class/lib:
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/corlib/.cvsignore b/mcs/class/corlib/.cvsignore
new file mode 100644
index 00000000000..8bf76152f10
--- /dev/null
+++ b/mcs/class/corlib/.cvsignore
@@ -0,0 +1,5 @@
+corlib.dll
+corlib.pdb
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/corlib/ChangeLog b/mcs/class/corlib/ChangeLog
new file mode 100644
index 00000000000..b7ea3093a8f
--- /dev/null
+++ b/mcs/class/corlib/ChangeLog
@@ -0,0 +1,233 @@
+2003-01-18 Jonathan Pryor <jonpryor@vt.edu>
+
+ * unix.args: Added IsolatedStorageFile.cs and IsolatedStorageInfo.cs in
+ System.IO.IsolatedStorage
+
+
+2003-01-17
+ * unix.args: Added System/DelegateSerializationHolder.cs,
+ System/UnitySerializationHolder.cs,
+ System.Runtime.Serialization/ObjectManager.cs,
+ System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs,
+ System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs and
+ System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
+
+2003-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * unix.args: added COMException.cs in System.Runtime.InteropServices
+
+2003-01-01 Jaime Anguiano Olarra <jaime@gnome.org>
+
+ * unix.args: added System.Diagnostics.Process.cs
+
+2002-12-28 Duncan Mak <duncan@ximian.com>
+
+ * unix.args (ASN1.cs): Sebastien forgot to include this file.
+
+2002-12-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * unix.args: added CryptoTools.cs file.
+
+2002-12-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * unix.args: added StrongName.cs, StrongNamePublicKeyBlob.cs
+ and StrongNameIdentityPermission.cs files.
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * unix.args: added PublisherIdentityPermission.cs,
+ Publisher.cs and PublisherMembershipCondition.cs
+
+2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
+
+ * updated .build file(s) to correctly contain required buildfile
+ attribute for nant
+
+2002-11-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * unix.args: added missing files from System.Security.Cryptography
+ namespace.
+
+2002-10-28 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+
+ * unix.args: added missing files from System.Security.Cryptography
+ namespace.
+
+2002-10-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib.build: Removed all excluded cryptographic source code as the
+ cyclic dependency was removed (well commented)
+
+2002-10-11 Duncan Mak <duncan@ximian.com>
+
+ * unix.args: Added System.Security.Cryptography.CryptoConfig.
+
+2002-10-08 Miguel de Icaza <miguel@ximian.com>
+
+ * Mono/Runtime.cs: New file.
+
+2002-10-05 Andrew Birkett <andy@nobugs.org>
+
+ * unix.args: Added System.Security.Cryptography.RC2
+
+2002-09-12 Dick Porter <dick@ximian.com>
+
+ * unix.args: Add System.Globalization.SortKey,
+ System.Globalization.StringInfo and
+ System.Globalizaton.TextElementEnumerator
+
+2002-09-12 Dick Porter <dick@ximian.com>
+
+ * unix.args: Add System.ArgIterator and System.TypedReference
+
+ * corlib.build: Adding DecimalConstantAttribute to Decimal (which
+ corcompare showed as missing) causes a SecurityException in
+ corcompare, so exclude Decimal from the corlib_cmp build.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * unix.args: added a couple of new files in System.Security.Principal.
+
+2002-08-15 Tim Coleman <tim@timcoleman.com>
+ * unix.args:
+ Add System.Globalization/TextInfo.cs
+ Add System.Runtime.Serialization/FormatterConverter.cs
+
+2002-07-31 Rodrigo Moya <rodrigo@ximian.com>
+
+ * unix.args: added new files from System.Runtime.Remoting.Channels.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * unix.args: Added interfaces and enumerations from
+ System.Runtime.Remoting.Channels.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * unix.args: Added new classes in
+ System.Runtime.Remoting.Contexts.
+
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * unix.args: Added new Exceptions, Interfaces and various
+ TypeEntries from System.Runtime.Remoting.
+
+2002-07-29 Martin Baulig <martin@gnome.org>
+
+ * list: Removed, this isn't used anymore and people are already
+ getting confused which file to use.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * unix.args: Added files from Remoting.Lifetime and
+ Remoting.Metadata.
+
+ * ChangeLog: Moved entries from System.Runtime.Remoting.Activation
+ and System.Runtime.Remoting.Proxies to their own ChangeLog.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * list:
+ * unix.args: Added new Attributes in
+ System.Runtime.CompilerServices and System.Runtime.Remoting.Messaging.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * list:
+ * unix.args:
+ Added System.Security.Permission/ReflectionPermission.cs and
+ System.Security.Permission/EnvironmentPermission.cs and
+
+2002-07-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * list:
+ * unix.args: added IObjectHandle.cs.
+
+2002-06-20 Martin Baulig <martin@gnome.org>
+
+ * unix.args: New file. This is a mcs response file to compile
+ corlib on GNU/Linux (which doesn't work yet).
+
+2002-04-30 Daniel Stodden <stodden@in.tum.de>
+
+ * System/Delegate.cs: Implemented Remove()
+ * System/MulticastDelegate.cs: Implementation of RemoveImpl()
+ done. Plus a fix for Equals().
+ * Test/System/MulticastDelegate.cs: Added. Should reflect above
+ changes.
+
+2002-04-27 Martin Baulig <martin@gnome.org>
+
+ * corlib.build: Added new "mcs-build" target to compile corlib
+ with mcs. This doesn't work yet - it's just to test mcs to find
+ and fix the remaining bugs.
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * corlib.build: removed seperate windows/linux builds. excluded
+ wrapper and PAL classes from all builds.
+
+2002-03-03 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Exclude a bunch of interfaces from corlib_res.dll
+ that were preventing the tests from running on Windows.
+
+2002-01-25 Mark Crichton <crichton@gimp.org>
+
+ * System.Security.Cryptography/RijndaelManaged.cs: added
+
+ * System.Security.Cryptography/Rijndael.cs: changed constructor
+ to set default values. Hopefully I did it correctly.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * Unix/Errno.cs: Added
+
+ * Unix/Wrapper.cs: Updated to new Wrapper
+
+2002-01-19 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: exclude Delegate from corlib_cmp.
+
+2002-01-09 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Exclude Security Attribute classes that need mcs
+ magic to get them to compile.
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * corlib.build: Removed <excludes> for System.Resources
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Have the clean target remove any .pdb files that
+ might be around if we compiled with debug on.
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Make new build of corlib_cmp.dll. This is the same
+ as corlib.dll without Object and ValueType. It is used by
+ /mcs/tools/corcompare.exe to compare with mscorlib.
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Put the linux target at the top. I keep changing the
+ build for windows 'cause it's at the top. Then when I do make, nothing
+ changes. It seems like it always takes me half a day to remember
+ that the linux target comes second. Old age I guess.
+
+ * .cvsignore: ignore corlib.pdb for times when it's built with debug on.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Removed "exclude CodeAccessPermission.cs"
+
+2001-12-11 Duncan Mak <duncan@ximian.com>
+
+ * ChangeLog: Added "System.Resources" to the exclude list.
+
+2001-12-05 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * corlib.build: Add dependancy on linux target to test target. Need to have the dll before we can test it, right? Plus is encourages other to try 'make test'.
+
diff --git a/mcs/class/corlib/Linux/ChangeLog b/mcs/class/corlib/Linux/ChangeLog
new file mode 100644
index 00000000000..96eb5e7cded
--- /dev/null
+++ b/mcs/class/corlib/Linux/ChangeLog
@@ -0,0 +1,27 @@
+2002-03-18 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Linux.cs: Removed math methods (now in System.Math).
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * Linux.cs: GetFileTime and SetFileTime need to be static
+
+Tue Jan 22 22:50:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Linux.cs: comment out call to Debug.Assert(): stuff from the System
+ assembly cannot be used in corlib.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * Linux.cs: IO implemented with file handles with internal calls,
+ rather than casting file descriptors for C library p/invokes.
+ Implemented Get/Set Creation/LastAccess/LastWrite TimeFile
+ functions.
+
+Wed Nov 14 16:30:27 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Linux.cs: a '/' is a valid char in a file path.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * Linux.cs (GetCurrentDirectory): implemented
diff --git a/mcs/class/corlib/Linux/Linux.cs b/mcs/class/corlib/Linux/Linux.cs
new file mode 100644
index 00000000000..86a1cfc475a
--- /dev/null
+++ b/mcs/class/corlib/Linux/Linux.cs
@@ -0,0 +1,484 @@
+/*---------------------------------------------------------------------
+
+ XX X XXX
+ XX XX
+ XXX XX XXX XXXXX XX
+ XX XXX XX XX XX
+ XX XX XX XX XXXXX XX
+ XX XX XX XX XX XX X XX
+ XXXX XX XX XXX XXXXXXX XXXX
+ XX
+ XXXXX
+
+Copyright (c) 2001 Intel Corporation. All Rights Reserved.
+
+CREATED: August 22, 2001
+OWNER: Scott D Smith, Joel Marcey
+VERSION: 1.0
+---------------------------------------------------------------------*/
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System.PAL
+{
+ /// <summary>
+ /// Class that implements IOperatingSystem, providing the requested functionality through calls into APIs available in Linux
+ /// </summary>
+ internal class OpSys
+ {
+ private Hashtable _environment = null;
+
+ //----------------------------------
+ // Class Constants
+ //----------------------------------
+ private const int EOF = -1; // TODO: Linux: Is this true?
+
+
+ // For StdInputStream and StdOutputStream
+ private IntPtr Stdin;
+ private IntPtr Stdout;
+ private IntPtr Stderr;
+
+ //----------------------------------
+ // Class Fields
+ //----------------------------------
+
+ //----------------------------------
+ // Class Constructor
+ //----------------------------------
+ public OpSys()
+ {
+ Stdin=GetStdHandle(0);
+ Stdout=GetStdHandle(1);
+ Stderr=GetStdHandle(2);
+ }
+
+
+ //-------------------------------------------------
+ // Environment Services
+ //-------------------------------------------------
+
+ public string NewLineSequence
+ {
+ get
+ {
+ return "\n";
+ }
+ }
+
+ public char DirectorySeparator
+ {
+ get
+ {
+ return '/';
+ }
+ }
+
+ public char AltDirectorySeparator
+ {
+ get
+ {
+ return '\\';
+ }
+ }
+
+ public char VolumeSeparator
+ {
+ get
+ {
+ return '/';
+ }
+ }
+
+ public char PathSeparator
+ {
+ get
+ {
+ return ':';
+ }
+ }
+
+ public char[] InvalidPathChars
+ {
+ get
+ {
+ return new char[] { '\0' };
+ }
+ }
+
+ public char[] DirVolSeparatorChars
+ {
+ get
+ {
+ return new char[] { this.DirectorySeparator, this.AltDirectorySeparator, this.VolumeSeparator};
+ }
+ }
+ public char ExtensionCharacter
+ {
+ get
+ {
+ return '.';
+ }
+ }
+
+ public string GetEnvironmentVariable(string eVar)
+ {
+ return EnvironmentVariables[eVar].ToString();
+ }
+
+ public IDictionary EnvironmentVariables
+ {
+ get
+ {
+ if (_environment == null) {
+ IntPtr pp = _getEnviron(); // pointer to an array of char*
+ _environment = new Hashtable();
+
+ if (pp != IntPtr.Zero) {
+ IntPtr p;
+ bool done = false;
+ char[] delimiter = { '=' };
+
+ while (!done)
+ {
+ p = Marshal.ReadIntPtr(pp);
+ if (p != IntPtr.Zero)
+ {
+ string str = Marshal.PtrToStringAuto(p);
+ string[] ar = str.Split(delimiter, 2);
+ switch(ar.Length)
+ {
+ case 1:
+ _environment.Add(ar[0], "");
+ break;
+ case 2:
+ _environment.Add(ar[0], ar[1]);
+ break;
+ default:
+ //System.Diagnostics/.Debug.Assert(false); // this shouldn't happen
+ break;
+ }
+ }
+ else
+ {
+ done = true;
+ }
+ }
+ }
+ }
+ return _environment;
+ }
+ }
+
+ public string CommandLine
+ {
+ get
+ {
+ string path = Path.Combine(Path.Combine("/proc", _getPid().ToString()), "cmdline");
+ StreamReader stream = File.OpenText(path);
+ string res = stream.ReadToEnd();
+ stream.Close();
+ return res;
+ }
+ }
+
+ public string MachineName
+ {
+ get
+ {
+ return GetEnvironmentVariable("HOSTNAME");
+ }
+ }
+
+ public OperatingSystem OSVersion
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ // System.Path services
+
+ public string ChangeExtension(string path, string extension)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:ChangeExtension(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public string GetExtension(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetExtension(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetFileName(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFileName(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetFileNameWithoutExtension(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFileNameWithoutExtension(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetFullPath(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFullPath(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetPathRoot(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetPathRoot(System.String): Stub Method");
+ return null;
+
+ }
+
+ public string GetTempFileName()
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetTempFileName(): Stub Method");
+ return null;
+ }
+
+ public string GetTempPath()
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetTempPath(): Stub Method");
+ return null;
+ }
+
+ public bool HasExtension(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:HasExtension(System.String): Stub Method");
+ return false;
+ }
+
+ public bool IsPathRooted(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:IsPathRooted(System.String): Stub Method");
+ return false;
+ }
+
+
+
+ // System.Directory services
+
+ public void DeleteDirectory(string path, bool recursive)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:DeleteDirectory(System.String, System.Boolean): Stub Method");
+ }
+
+ public bool ExistsDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:ExistsDirectory(System.String): Stub Method");
+ return false;
+ }
+
+ public DateTime GetCreationTimeDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetCreationTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public extern string GetCurrentDirectory();
+
+ public string[] GetDirectories(string path, string searchPattern)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetDirectories(System.String,System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFiles(string path, string searchPattern)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFiles(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFileSystemEntries(string path, string searchPattern)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFileSystemEntries(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public DateTime GetLastAccessTimeDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetLastAccessTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastWriteTimeDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetLastWriteTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public void MoveDirectory(string sourceDirName, string destDirName)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:MoveDirectory(System.String, System.String): Stub Method");
+ }
+
+ public void SetCreationTimeDirectory(string path, DateTime creationTime)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetCreationTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetCurrentDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetCurrentDirectory(System.String): Stub Method");
+ }
+
+ public void SetLastAccessTimeDirectory(string path, DateTime lastAccessTime)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetLastAccessTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastWriteTimeDirectory(string path, DateTime lastWriteTime)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetLastWriteTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ //-----------------------------------
+ // I/O Services
+ //-----------------------------------
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ private extern IntPtr GetStdHandle(int fd);
+
+ public IntPtr StdinHandle {
+ get {
+ return(Stdin);
+ }
+ }
+
+ public IntPtr StdoutHandle {
+ get {
+ return(Stdout);
+ }
+ }
+
+ public IntPtr StderrHandle {
+ get {
+ return(Stderr);
+ }
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public extern void DeleteFile(string path);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public extern bool ExistsFile(string path);
+
+ /* The long time parameters in GetFileTime and
+ * SetFileTime correspond to Windows file times (ticks
+ * from DateTime(1/1/1601 00:00 GMT))
+ */
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ private extern static bool GetFileTime(IntPtr handle, out long creat, out long lastaccess, out long lastwrite);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ private extern static bool SetFileTime(IntPtr handle, long creat, long lastaccess, long lastwrite);
+
+ public DateTime GetCreationTimeFile(string path)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.Read);
+
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+ s.Close();
+
+ return DateTime.FromFileTime(creat);
+ }
+
+ public DateTime GetLastAccessTimeFile(string path)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.Read);
+
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+ s.Close();
+
+ return DateTime.FromFileTime(lastaccess);
+ }
+
+ public DateTime GetLastWriteTimeFile(string path)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.Read);
+
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+ s.Close();
+
+ return DateTime.FromFileTime(lastwrite);
+ }
+
+ public void SetCreationTimeFile(string path, DateTime creationTime)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
+
+ // Get the existing times first
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+
+ creat=creationTime.ToFileTime();
+
+ ret=SetFileTime(s.Handle, creat, lastaccess, lastwrite);
+ s.Close();
+ }
+
+ public void SetLastAccessTimeFile(string path, DateTime lastAccessTime)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
+
+ // Get the existing times first
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+
+ lastaccess=lastAccessTime.ToFileTime();
+
+ ret=SetFileTime(s.Handle, creat, lastaccess, lastwrite);
+ s.Close();
+ }
+
+ public void SetLastWriteTimeFile(string path, DateTime lastWriteTime)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
+
+ // Get the existing times first
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+
+ lastwrite=lastWriteTime.ToFileTime();
+
+ ret=SetFileTime(s.Handle, creat, lastaccess, lastwrite);
+ s.Close();
+ }
+
+
+ public long FileLength(string path)
+ {
+ return 0;
+ }
+
+ // Private implementation details
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_environ", CharSet=CharSet.Ansi)]
+ private unsafe static extern IntPtr _getEnviron();
+
+ [DllImport("libc", EntryPoint="getpid")]
+ private unsafe static extern int _getPid();
+ }
+}
diff --git a/mcs/class/corlib/Microsoft.Win32/ChangeLog b/mcs/class/corlib/Microsoft.Win32/ChangeLog
new file mode 100755
index 00000000000..637edc4ca09
--- /dev/null
+++ b/mcs/class/corlib/Microsoft.Win32/ChangeLog
@@ -0,0 +1,24 @@
+2002-11-28 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * Registry.cs: Added missed field.
+
+
+2002-11-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RegistryHive.cs: patch from Jackson Harper that fixes compilation.
+
+2002-11-27 DennisHayes <dennish@raytek.com>
+
+ * checkin for Alexandre Pigolkine (pigolkine@gmx.de) with minor changes
+ * needed for System.Windows.Forms
+
+ * RegistryHive.cs
+ * Registry.cs
+ * added files, fully implmented?
+
+ * RegistryKey.cs
+ * added more iplmentation
+
+2002-11-20 Nick Drochak <ndrochak@gol.com>
+
+ * RegistryKey.cs: Fix typo.
diff --git a/mcs/class/corlib/Microsoft.Win32/Registry.cs b/mcs/class/corlib/Microsoft.Win32/Registry.cs
new file mode 100644
index 00000000000..1d2bef2f6f2
--- /dev/null
+++ b/mcs/class/corlib/Microsoft.Win32/Registry.cs
@@ -0,0 +1,21 @@
+//
+// Microsoft.Win32.Registry.cs
+//
+// Author:
+// stubbed out by Alexandre Pigolkine (pigolkine@gmx.de)
+
+using System;
+
+namespace Microsoft.Win32
+{
+ public class Registry
+ {
+ public static readonly RegistryKey ClassesRoot;
+ public static readonly RegistryKey CurrentConfig;
+ public static readonly RegistryKey CurrentUser;
+ public static readonly RegistryKey DynData;
+ public static readonly RegistryKey LocalMachine;
+ public static readonly RegistryKey PerformanceData;
+ public static readonly RegistryKey Users;
+ }
+}
diff --git a/mcs/class/corlib/Microsoft.Win32/RegistryHive.cs b/mcs/class/corlib/Microsoft.Win32/RegistryHive.cs
new file mode 100644
index 00000000000..0d90cbfe474
--- /dev/null
+++ b/mcs/class/corlib/Microsoft.Win32/RegistryHive.cs
@@ -0,0 +1,25 @@
+//
+// Microsoft.Win32.RegistryHive.cs
+//
+// Author:
+// Alexandre Pigolkine (pigolkine@gmx.de)
+
+using System;
+
+namespace Microsoft.Win32
+{
+
+ [Serializable]
+ public enum RegistryHive
+ {
+
+ ClassesRoot = -2147483648,
+ CurrentConfig = -2147483643,
+ CurrentUser = -2147483647,
+ DynData = -2147483642,
+ LocalMachine = -2147483646,
+ PerformanceData = -2147483644,
+ Users = -2147483645
+ }
+
+}
diff --git a/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs b/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs
new file mode 100644
index 00000000000..dde5c71ddf4
--- /dev/null
+++ b/mcs/class/corlib/Microsoft.Win32/RegistryKey.cs
@@ -0,0 +1,133 @@
+//
+// RegistryKey.cs: a single node in the Windows registry
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+
+using System;
+
+namespace Microsoft.Win32 {
+
+ public sealed class RegistryKey : MarshalByRefObject, IDisposable {
+
+ void IDisposable.Dispose ()
+ {
+ }
+
+ [MonoTODO]
+ public string Name
+ {
+ get {
+ return String.Empty;
+ }
+ }
+
+ [MonoTODO]
+ public int SubKeyCount
+ {
+ get {
+ return 0;
+ }
+ }
+
+ [MonoTODO]
+ public int ValueCount
+ {
+ get {
+ return 0;
+ }
+ }
+
+ [MonoTODO]
+ public void SetValue (string name, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public RegistryKey OpenSubKey (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public RegistryKey OpenSubKey (string name, bool writtable)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetValue (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetValue (string name, object defaultvalue)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public RegistryKey CreateSubKey (string subkey)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DeleteSubKey(string subkey)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DeleteSubKeyTree(string subkey)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void DeleteValue(string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Flush()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Close()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string[] GetSubKeyNames()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string[] GetValueNames()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey,string machineName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/Mono.Math/BigInteger.cs b/mcs/class/corlib/Mono.Math/BigInteger.cs
new file mode 100644
index 00000000000..b292bf223c9
--- /dev/null
+++ b/mcs/class/corlib/Mono.Math/BigInteger.cs
@@ -0,0 +1,2643 @@
+//
+// BigInteger.cs - Big Integer implementation
+//
+// Authors:
+// Chew Keong TAN
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright (c) 2002 Chew Keong TAN
+// All rights reserved.
+//
+// Modifications from original
+// - Removed all reference to Random class (not secure enough)
+// - Moved all static Test function into BigIntegerTest.cs (for NUnit)
+//
+
+//************************************************************************************
+// BigInteger Class Version 1.03
+//
+// Copyright (c) 2002 Chew Keong TAN
+// All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, provided that the above
+// copyright notice(s) and this permission notice appear in all copies of
+// the Software and that both the above copyright notice(s) and this
+// permission notice appear in supporting documentation.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+// OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+// HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+// INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+// FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+// WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+//
+//
+// Disclaimer
+// ----------
+// Although reasonable care has been taken to ensure the correctness of this
+// implementation, this code should never be used in any application without
+// proper verification and testing. I disclaim all liability and responsibility
+// to any person or entity with respect to any loss or damage caused, or alleged
+// to be caused, directly or indirectly, by the use of this BigInteger class.
+//
+// Comments, bugs and suggestions to
+// (http://www.codeproject.com/csharp/biginteger.asp)
+//
+//
+// Overloaded Operators +, -, *, /, %, >>, <<, ==, !=, >, <, >=, <=, &, |, ^, ++, --, ~
+//
+// Features
+// --------
+// 1) Arithmetic operations involving large signed integers (2's complement).
+// 2) Primality test using Fermat little theorm, Rabin Miller's method,
+// Solovay Strassen's method and Lucas strong pseudoprime.
+// 3) Modulo exponential with Barrett's reduction.
+// 4) Inverse modulo.
+// 5) Pseudo prime generation.
+// 6) Co-prime generation.
+//
+//
+// Known Problem
+// -------------
+// This pseudoprime passes my implementation of
+// primality test but failed in JDK's isProbablePrime test.
+//
+// byte[] pseudoPrime1 = { (byte)0x00,
+// (byte)0x85, (byte)0x84, (byte)0x64, (byte)0xFD, (byte)0x70, (byte)0x6A,
+// (byte)0x9F, (byte)0xF0, (byte)0x94, (byte)0x0C, (byte)0x3E, (byte)0x2C,
+// (byte)0x74, (byte)0x34, (byte)0x05, (byte)0xC9, (byte)0x55, (byte)0xB3,
+// (byte)0x85, (byte)0x32, (byte)0x98, (byte)0x71, (byte)0xF9, (byte)0x41,
+// (byte)0x21, (byte)0x5F, (byte)0x02, (byte)0x9E, (byte)0xEA, (byte)0x56,
+// (byte)0x8D, (byte)0x8C, (byte)0x44, (byte)0xCC, (byte)0xEE, (byte)0xEE,
+// (byte)0x3D, (byte)0x2C, (byte)0x9D, (byte)0x2C, (byte)0x12, (byte)0x41,
+// (byte)0x1E, (byte)0xF1, (byte)0xC5, (byte)0x32, (byte)0xC3, (byte)0xAA,
+// (byte)0x31, (byte)0x4A, (byte)0x52, (byte)0xD8, (byte)0xE8, (byte)0xAF,
+// (byte)0x42, (byte)0xF4, (byte)0x72, (byte)0xA1, (byte)0x2A, (byte)0x0D,
+// (byte)0x97, (byte)0xB1, (byte)0x31, (byte)0xB3,
+// };
+//
+//
+// Change Log
+// ----------
+// 1) September 23, 2002 (Version 1.03)
+// - Fixed operator- to give correct data length.
+// - Added Lucas sequence generation.
+// - Added Strong Lucas Primality test.
+// - Added integer square root method.
+// - Added setBit/unsetBit methods.
+// - New isProbablePrime() method which do not require the
+// confident parameter.
+//
+// 2) August 29, 2002 (Version 1.02)
+// - Fixed bug in the exponentiation of negative numbers.
+// - Faster modular exponentiation using Barrett reduction.
+// - Added getBytes() method.
+// - Fixed bug in ToHexString method.
+// - Added overloading of ^ operator.
+// - Faster computation of Jacobi symbol.
+//
+// 3) August 19, 2002 (Version 1.01)
+// - Big integer is stored and manipulated as unsigned integers (4 bytes) instead of
+// individual bytes this gives significant performance improvement.
+// - Updated Fermat's Little Theorem test to use a^(p-1) mod p = 1
+// - Added isProbablePrime method.
+// - Updated documentation.
+//
+// 4) August 9, 2002 (Version 1.0)
+// - Initial Release.
+//
+//
+// References
+// [1] D. E. Knuth, "Seminumerical Algorithms", The Art of Computer Programming Vol. 2,
+// 3rd Edition, Addison-Wesley, 1998.
+//
+// [2] K. H. Rosen, "Elementary Number Theory and Its Applications", 3rd Ed,
+// Addison-Wesley, 1993.
+//
+// [3] B. Schneier, "Applied Cryptography", 2nd Ed, John Wiley & Sons, 1996.
+//
+// [4] A. Menezes, P. van Oorschot, and S. Vanstone, "Handbook of Applied Cryptography",
+// CRC Press, 1996, www.cacr.math.uwaterloo.ca/hac
+//
+// [5] A. Bosselaers, R. Govaerts, and J. Vandewalle, "Comparison of Three Modular
+// Reduction Functions," Proc. CRYPTO'93, pp.175-186.
+//
+// [6] R. Baillie and S. S. Wagstaff Jr, "Lucas Pseudoprimes", Mathematics of Computation,
+// Vol. 35, No. 152, Oct 1980, pp. 1391-1417.
+//
+// [7] H. C. Williams, "Édouard Lucas and Primality Testing", Canadian Mathematical
+// Society Series of Monographs and Advance Texts, vol. 22, John Wiley & Sons, New York,
+// NY, 1998.
+//
+// [8] P. Ribenboim, "The new book of prime number records", 3rd edition, Springer-Verlag,
+// New York, NY, 1995.
+//
+// [9] M. Joye and J.-J. Quisquater, "Efficient computation of full Lucas sequences",
+// Electronics Letters, 32(6), 1996, pp 537-538.
+//
+//************************************************************************************
+
+using System;
+
+namespace System.Security.Cryptography {
+
+internal class BigRandom {
+ RandomNumberGenerator rng;
+
+ public BigRandom ()
+ {
+ rng = RandomNumberGenerator.Create ();
+ }
+
+ public void Get (uint[] data)
+ {
+ byte[] random = new byte [4 * data.Length];
+ rng.GetBytes (random);
+ int n = 0;
+ for (int i=0; i < data.Length; i++) {
+ data[i] = BitConverter.ToUInt32 (random, n);
+ n+=4;
+ }
+ }
+
+ public int GetInt (int maxValue)
+ {
+ // calculate mask
+ int mask = Int32.MaxValue;
+ while ((mask & maxValue) == maxValue)
+ mask >>= 1;
+ // undo last iteration
+ mask <<= 1;
+ mask |= 0x01;
+ byte[] data = new byte [4];
+ int result = -1;
+ while ((result < 0) || (result > maxValue)) {
+ rng.GetBytes (data);
+ result = (BitConverter.ToInt32 (data, 0) & mask);
+ }
+ return result;
+ }
+
+ public byte GetByte()
+ {
+ byte[] data = new byte [1];
+ rng.GetBytes (data);
+ return data [0];
+ }
+}
+
+internal class BigInteger {
+ // maximum length of the BigInteger in uint (4 bytes)
+ // change this to suit the required level of precision.
+
+ //private const int maxLength = 70;
+ // FIXME: actually this limit us to approx. 2048 bits keypair for RSA
+ private const int maxLength = 140;
+
+ private BigRandom random;
+
+ // primes smaller than 2000 to test the generated prime number
+
+ public static readonly int[] primesBelow2000 = {
+ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
+ 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
+ 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,
+ 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,
+ 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499,
+ 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599,
+ 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691,
+ 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797,
+ 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887,
+ 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,
+ 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097,
+ 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193,
+ 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297,
+ 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399,
+ 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499,
+ 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597,
+ 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699,
+ 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789,
+ 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889,
+ 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999 };
+
+ private uint[] data = null; // stores bytes from the Big Integer
+ public int dataLength; // number of actual chars used
+
+ // Constructor (Default value for BigInteger is 0
+ public BigInteger()
+ {
+ data = new uint[maxLength];
+ dataLength = 1;
+ }
+
+ // Constructor (Default value provided by long)
+ public BigInteger(long value)
+ {
+ data = new uint[maxLength];
+ long tempVal = value;
+ // copy bytes from long to BigInteger without any assumption of
+ // the length of the long datatype
+ dataLength = 0;
+ while(value != 0 && dataLength < maxLength) {
+ data[dataLength] = (uint)(value & 0xFFFFFFFF);
+ value >>= 32;
+ dataLength++;
+ }
+
+ if(tempVal > 0) { // overflow check for +ve value
+ if(value != 0 || (data[maxLength-1] & 0x80000000) != 0)
+ throw(new ArithmeticException("Positive overflow in constructor."));
+ }
+ else if(tempVal < 0) { // underflow check for -ve value
+ if(value != -1 || (data[dataLength-1] & 0x80000000) == 0)
+ throw(new ArithmeticException("Negative underflow in constructor."));
+ }
+
+ if(dataLength == 0)
+ dataLength = 1;
+ }
+
+ // Constructor (Default value provided by ulong)
+ public BigInteger(ulong value)
+ {
+ data = new uint[maxLength];
+ // copy bytes from ulong to BigInteger without any assumption of
+ // the length of the ulong datatype
+
+ dataLength = 0;
+ while(value != 0 && dataLength < maxLength) {
+ data[dataLength] = (uint)(value & 0xFFFFFFFF);
+ value >>= 32;
+ dataLength++;
+ }
+
+ if(value != 0 || (data[maxLength-1] & 0x80000000) != 0)
+ throw(new ArithmeticException("Positive overflow in constructor."));
+
+ if(dataLength == 0)
+ dataLength = 1;
+ }
+
+ // Constructor (Default value provided by BigInteger)
+ public BigInteger(BigInteger bi)
+ {
+ data = new uint[maxLength];
+ dataLength = bi.dataLength;
+ for(int i = 0; i < dataLength; i++)
+ data[i] = bi.data[i];
+ }
+
+ // Constructor (Default value provided by a string of digits of the
+ // specified base)
+ // Example (base 10)
+ // -----------------
+ // To initialize "a" with the default value of 1234 in base 10
+ // BigInteger a = new BigInteger("1234", 10)
+ //
+ // To initialize "a" with the default value of -1234
+ // BigInteger a = new BigInteger("-1234", 10)
+ //
+ // Example (base 16)
+ // -----------------
+ // To initialize "a" with the default value of 0x1D4F in base 16
+ // BigInteger a = new BigInteger("1D4F", 16)
+ //
+ // To initialize "a" with the default value of -0x1D4F
+ // BigInteger a = new BigInteger("-1D4F", 16)
+ //
+ // Note that string values are specified in the <sign><magnitude>
+ // format.
+ public BigInteger(string value, int radix)
+ {
+ BigInteger multiplier = new BigInteger(1);
+ BigInteger result = new BigInteger();
+ value = (value.ToUpper()).Trim();
+ int limit = 0;
+
+ if(value[0] == '-')
+ limit = 1;
+
+ for(int i = value.Length - 1; i >= limit ; i--) {
+ int posVal = (int)value[i];
+
+ if(posVal >= '0' && posVal <= '9')
+ posVal -= '0';
+ else if(posVal >= 'A' && posVal <= 'Z')
+ posVal = (posVal - 'A') + 10;
+ else
+ posVal = 9999999; // arbitrary large
+
+
+ if(posVal >= radix)
+ throw(new ArithmeticException("Invalid string in constructor."));
+ else {
+ if(value[0] == '-')
+ posVal = -posVal;
+
+ result = result + (multiplier * posVal);
+
+ if((i - 1) >= limit)
+ multiplier = multiplier * radix;
+ }
+ }
+
+ if(value[0] == '-') { // negative values
+ if((result.data[maxLength-1] & 0x80000000) == 0)
+ throw(new ArithmeticException("Negative underflow in constructor."));
+ }
+ else { // positive values
+ if((result.data[maxLength-1] & 0x80000000) != 0)
+ throw(new ArithmeticException("Positive overflow in constructor."));
+ }
+
+ data = new uint[maxLength];
+ for(int i = 0; i < result.dataLength; i++)
+ data[i] = result.data[i];
+
+ dataLength = result.dataLength;
+ }
+
+
+ // Constructor (Default value provided by an array of bytes)
+ //
+ // The lowest index of the input byte array (i.e [0]) should contain the
+ // most significant byte of the number, and the highest index should
+ // contain the least significant byte.
+ //
+ // E.g.
+ // To initialize "a" with the default value of 0x1D4F in base 16
+ // byte[] temp = { 0x1D, 0x4F };
+ // BigInteger a = new BigInteger(temp)
+ //
+ // Note that this method of initialization does not allow the
+ // sign to be specified.
+ public BigInteger(byte[] inData)
+ {
+ dataLength = inData.Length >> 2;
+
+ int leftOver = inData.Length & 0x3;
+ if(leftOver != 0) // length not multiples of 4
+ dataLength++;
+
+
+ if(dataLength > maxLength)
+ throw(new ArithmeticException("Byte overflow in constructor."));
+
+ data = new uint[maxLength];
+
+ for(int i = inData.Length - 1, j = 0; i >= 3; i -= 4, j++) {
+ data[j] = (uint)((inData[i-3] << 24) + (inData[i-2] << 16) +
+ (inData[i-1] << 8) + inData[i]);
+ }
+
+ if(leftOver == 1)
+ data[dataLength-1] = (uint)inData[0];
+ else if(leftOver == 2)
+ data[dataLength-1] = (uint)((inData[0] << 8) + inData[1]);
+ else if(leftOver == 3)
+ data[dataLength-1] = (uint)((inData[0] << 16) + (inData[1] << 8) + inData[2]);
+
+
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ //Console.WriteLine("Len = " + dataLength);
+ }
+
+ // Constructor (Default value provided by an array of bytes of the
+ // specified length.)
+ public BigInteger(byte[] inData, int inLen)
+ {
+ dataLength = inLen >> 2;
+
+ int leftOver = inLen & 0x3;
+ if(leftOver != 0) // length not multiples of 4
+ dataLength++;
+
+ if(dataLength > maxLength || inLen > inData.Length)
+ throw(new ArithmeticException("Byte overflow in constructor."));
+
+
+ data = new uint[maxLength];
+
+ for(int i = inLen - 1, j = 0; i >= 3; i -= 4, j++) {
+ data[j] = (uint)((inData[i-3] << 24) + (inData[i-2] << 16) +
+ (inData[i-1] << 8) + inData[i]);
+ }
+
+ if(leftOver == 1)
+ data[dataLength-1] = (uint)inData[0];
+ else if(leftOver == 2)
+ data[dataLength-1] = (uint)((inData[0] << 8) + inData[1]);
+ else if(leftOver == 3)
+ data[dataLength-1] = (uint)((inData[0] << 16) + (inData[1] << 8) + inData[2]);
+
+
+ if(dataLength == 0)
+ dataLength = 1;
+
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ //Console.WriteLine("Len = " + dataLength);
+ }
+
+
+ // Constructor (Default value provided by an array of unsigned integers)
+ public BigInteger(uint[] inData)
+ {
+ dataLength = inData.Length;
+
+ if(dataLength > maxLength)
+ throw(new ArithmeticException("Byte overflow in constructor."));
+
+ data = new uint[maxLength];
+
+ for(int i = dataLength - 1, j = 0; i >= 0; i--, j++)
+ data[j] = inData[i];
+
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ //Console.WriteLine("Len = " + dataLength);
+ }
+
+ private BigRandom rng {
+ get {
+ if (random == null)
+ random = new BigRandom ();
+ return random;
+ }
+ }
+
+ // Overloading of the typecast operator.
+ // For BigInteger bi = 10;
+ public static implicit operator BigInteger (long value)
+ {
+ return (new BigInteger (value));
+ }
+
+ public static implicit operator BigInteger (ulong value)
+ {
+ return (new BigInteger (value));
+ }
+
+ public static implicit operator BigInteger (int value)
+ {
+ return (new BigInteger ( (long)value));
+ }
+
+ public static implicit operator BigInteger (uint value)
+ {
+ return (new BigInteger ( (ulong)value));
+ }
+
+ // Overloading of addition operator
+ public static BigInteger operator + (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger ();
+
+ result.dataLength = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ long carry = 0;
+ for(int i = 0; i < result.dataLength; i++) {
+ long sum = (long)bi1.data[i] + (long)bi2.data[i] + carry;
+ carry = sum >> 32;
+ result.data[i] = (uint)(sum & 0xFFFFFFFF);
+ }
+
+ if(carry != 0 && result.dataLength < maxLength) {
+ result.data[result.dataLength] = (uint)(carry);
+ result.dataLength++;
+ }
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+
+ // overflow check
+ int lastPos = maxLength - 1;
+ if((bi1.data[lastPos] & 0x80000000) == (bi2.data[lastPos] & 0x80000000) &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException());
+ }
+
+ return result;
+ }
+
+ // Overloading of the unary ++ operator
+ public static BigInteger operator ++ (BigInteger bi1)
+ {
+ BigInteger result = new BigInteger (bi1);
+
+ long val, carry = 1;
+ int index = 0;
+
+ while(carry != 0 && index < maxLength) {
+ val = (long)(result.data[index]);
+ val++;
+
+ result.data[index] = (uint)(val & 0xFFFFFFFF);
+ carry = val >> 32;
+
+ index++;
+ }
+
+ if(index > result.dataLength)
+ result.dataLength = index;
+ else {
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+ }
+
+ // overflow check
+ int lastPos = maxLength - 1;
+
+ // overflow if initial value was +ve but ++ caused a sign
+ // change to negative.
+
+ if((bi1.data[lastPos] & 0x80000000) == 0 &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException("Overflow in ++."));
+ }
+ return result;
+ }
+
+ // Overloading of subtraction operator
+ public static BigInteger operator - (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger ();
+
+ result.dataLength = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ long carryIn = 0;
+ for(int i = 0; i < result.dataLength; i++) {
+ long diff;
+
+ diff = (long)bi1.data[i] - (long)bi2.data[i] - carryIn;
+ result.data[i] = (uint)(diff & 0xFFFFFFFF);
+
+ if(diff < 0)
+ carryIn = 1;
+ else
+ carryIn = 0;
+ }
+
+ // roll over to negative
+ if(carryIn != 0) {
+ for(int i = result.dataLength; i < maxLength; i++)
+ result.data[i] = 0xFFFFFFFF;
+ result.dataLength = maxLength;
+ }
+
+ // fixed in v1.03 to give correct datalength for a - (-b)
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ // overflow check
+
+ int lastPos = maxLength - 1;
+ if((bi1.data[lastPos] & 0x80000000) != (bi2.data[lastPos] & 0x80000000) &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException());
+ }
+
+ return result;
+ }
+
+
+ // Overloading of the unary -- operator
+ public static BigInteger operator -- (BigInteger bi1)
+ {
+ BigInteger result = new BigInteger (bi1);
+
+ long val;
+ bool carryIn = true;
+ int index = 0;
+
+ while(carryIn && index < maxLength) {
+ val = (long)(result.data[index]);
+ val--;
+
+ result.data[index] = (uint)(val & 0xFFFFFFFF);
+
+ if(val >= 0)
+ carryIn = false;
+
+ index++;
+ }
+
+ if(index > result.dataLength)
+ result.dataLength = index;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ // overflow check
+ int lastPos = maxLength - 1;
+
+ // overflow if initial value was -ve but -- caused a sign
+ // change to positive.
+
+ if((bi1.data[lastPos] & 0x80000000) != 0 &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException("Underflow in --."));
+ }
+
+ return result;
+ }
+
+ // Overloading of multiplication operator
+ public static BigInteger operator * (BigInteger bi1, BigInteger bi2)
+ {
+ int lastPos = maxLength-1;
+ bool bi1Neg = false, bi2Neg = false;
+
+ // take the absolute value of the inputs
+ try {
+ if((bi1.data[lastPos] & 0x80000000) != 0) { // bi1 negative
+ bi1Neg = true; bi1 = -bi1;
+ }
+ if((bi2.data[lastPos] & 0x80000000) != 0) { // bi2 negative
+ bi2Neg = true; bi2 = -bi2;
+ }
+ }
+ catch(Exception) {}
+
+ BigInteger result = new BigInteger();
+
+ // multiply the absolute values
+ try {
+ for(int i = 0; i < bi1.dataLength; i++) {
+ if(bi1.data[i] == 0) continue;
+
+ ulong mcarry = 0;
+ for(int j = 0, k = i; j < bi2.dataLength; j++, k++) {
+ // k = i + j
+ ulong val = ((ulong)bi1.data[i] * (ulong)bi2.data[j]) +
+ (ulong)result.data[k] + mcarry;
+
+ result.data[k] = (uint)(val & 0xFFFFFFFF);
+ mcarry = (val >> 32);
+ }
+
+ if(mcarry != 0)
+ result.data[i+bi2.dataLength] = (uint)mcarry;
+ }
+ }
+ catch(Exception) {
+ throw(new ArithmeticException("Multiplication overflow."));
+ }
+
+
+ result.dataLength = bi1.dataLength + bi2.dataLength;
+ if(result.dataLength > maxLength)
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ // overflow check (result is -ve)
+ if((result.data[lastPos] & 0x80000000) != 0) {
+ if(bi1Neg != bi2Neg && result.data[lastPos] == 0x80000000) { // different sign
+ // handle the special case where multiplication produces
+ // a max negative number in 2's complement.
+
+ if(result.dataLength == 1)
+ return result;
+ else {
+ bool isMaxNeg = true;
+ for(int i = 0; i < result.dataLength - 1 && isMaxNeg; i++) {
+ if(result.data[i] != 0)
+ isMaxNeg = false;
+ }
+
+ if(isMaxNeg)
+ return result;
+ }
+ }
+
+ throw(new ArithmeticException("Multiplication overflow."));
+ }
+
+ // if input has different signs, then result is -ve
+ if(bi1Neg != bi2Neg)
+ return -result;
+
+ return result;
+ }
+
+ // Overloading of unary << operators
+ public static BigInteger operator << (BigInteger bi1, int shiftVal)
+ {
+ BigInteger result = new BigInteger (bi1);
+ result.dataLength = shiftLeft(result.data, shiftVal);
+
+ return result;
+ }
+
+ // least significant bits at lower part of buffer
+ private static int shiftLeft (uint[] buffer, int shiftVal)
+ {
+ int shiftAmount = 32;
+ int bufLen = buffer.Length;
+
+ while(bufLen > 1 && buffer[bufLen-1] == 0)
+ bufLen--;
+
+ for(int count = shiftVal; count > 0;) {
+ if(count < shiftAmount)
+ shiftAmount = count;
+
+ //Console.WriteLine("shiftAmount = {0}", shiftAmount);
+
+ ulong carry = 0;
+ for(int i = 0; i < bufLen; i++) {
+ ulong val = ((ulong)buffer[i]) << shiftAmount;
+ val |= carry;
+
+ buffer[i] = (uint)(val & 0xFFFFFFFF);
+ carry = val >> 32;
+ }
+
+ if(carry != 0) {
+ if(bufLen + 1 <= buffer.Length) {
+ buffer[bufLen] = (uint)carry;
+ bufLen++;
+ }
+ }
+ count -= shiftAmount;
+ }
+ return bufLen;
+ }
+
+ // Overloading of unary >> operators
+ public static BigInteger operator >> (BigInteger bi1, int shiftVal)
+ {
+ BigInteger result = new BigInteger(bi1);
+ result.dataLength = shiftRight(result.data, shiftVal);
+
+ if((bi1.data[maxLength-1] & 0x80000000) != 0) { // negative
+ for(int i = maxLength - 1; i >= result.dataLength; i--)
+ result.data[i] = 0xFFFFFFFF;
+
+ uint mask = 0x80000000;
+ for(int i = 0; i < 32; i++) {
+ if((result.data[result.dataLength-1] & mask) != 0)
+ break;
+
+ result.data[result.dataLength-1] |= mask;
+ mask >>= 1;
+ }
+ result.dataLength = maxLength;
+ }
+
+ return result;
+ }
+
+ private static int shiftRight (uint[] buffer, int shiftVal)
+ {
+ int shiftAmount = 32;
+ int invShift = 0;
+ int bufLen = buffer.Length;
+
+ while(bufLen > 1 && buffer[bufLen-1] == 0)
+ bufLen--;
+
+ //Console.WriteLine("bufLen = " + bufLen + " buffer.Length = " + buffer.Length);
+
+ for(int count = shiftVal; count > 0;) {
+ if(count < shiftAmount) {
+ shiftAmount = count;
+ invShift = 32 - shiftAmount;
+ }
+
+ //Console.WriteLine("shiftAmount = {0}", shiftAmount);
+
+ ulong carry = 0;
+ for(int i = bufLen - 1; i >= 0; i--) {
+ ulong val = ((ulong)buffer[i]) >> shiftAmount;
+ val |= carry;
+
+ carry = ((ulong)buffer[i]) << invShift;
+ buffer[i] = (uint)(val);
+ }
+
+ count -= shiftAmount;
+ }
+
+ while(bufLen > 1 && buffer[bufLen-1] == 0)
+ bufLen--;
+
+ return bufLen;
+ }
+
+
+ // Overloading of the NOT operator (1's complement)
+ public static BigInteger operator ~ (BigInteger bi1)
+ {
+ BigInteger result = new BigInteger (bi1);
+
+ for(int i = 0; i < maxLength; i++)
+ result.data[i] = (uint)(~(bi1.data[i]));
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Overloading of the NEGATE operator (2's complement)
+ public static BigInteger operator - (BigInteger bi1)
+ {
+ // handle neg of zero separately since it'll cause an overflow
+ // if we proceed.
+ if(bi1.dataLength == 1 && bi1.data[0] == 0)
+ return (new BigInteger ());
+
+ BigInteger result = new BigInteger (bi1);
+
+ // 1's complement
+ for(int i = 0; i < maxLength; i++)
+ result.data[i] = (uint)(~(bi1.data[i]));
+
+ // add one to result of 1's complement
+ long val, carry = 1;
+ int index = 0;
+
+ while(carry != 0 && index < maxLength) {
+ val = (long)(result.data[index]);
+ val++;
+
+ result.data[index] = (uint)(val & 0xFFFFFFFF);
+ carry = val >> 32;
+
+ index++;
+ }
+
+ if((bi1.data[maxLength-1] & 0x80000000) == (result.data[maxLength-1] & 0x80000000))
+ throw (new ArithmeticException("Overflow in negation.\n"));
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+ return result;
+ }
+
+
+ // Overloading of equality operator
+ public static bool operator == (BigInteger bi1, BigInteger bi2)
+ {
+ return bi1.Equals (bi2);
+ }
+
+ public static bool operator !=( BigInteger bi1, BigInteger bi2)
+ {
+ return !(bi1.Equals (bi2));
+ }
+
+ public override bool Equals (object o)
+ {
+ BigInteger bi = (BigInteger) o;
+
+ if(this.dataLength != bi.dataLength)
+ return false;
+
+ for(int i = 0; i < this.dataLength; i++) {
+ if(this.data [i] != bi.data [i])
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode ()
+ {
+ return this.ToString ().GetHashCode ();
+ }
+
+ // Overloading of inequality operator
+ public static bool operator > (BigInteger bi1, BigInteger bi2)
+ {
+ int pos = maxLength - 1;
+
+ // bi1 is negative, bi2 is positive
+ if((bi1.data[pos] & 0x80000000) != 0 && (bi2.data[pos] & 0x80000000) == 0)
+ return false;
+
+ // bi1 is positive, bi2 is negative
+ else if((bi1.data[pos] & 0x80000000) == 0 && (bi2.data[pos] & 0x80000000) != 0)
+ return true;
+
+ // same sign
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+ for(pos = len - 1; pos >= 0 && bi1.data[pos] == bi2.data[pos]; pos--);
+
+ if(pos >= 0) {
+ if(bi1.data[pos] > bi2.data[pos])
+ return true;
+ return false;
+ }
+ return false;
+ }
+
+ public static bool operator < (BigInteger bi1, BigInteger bi2)
+ {
+ int pos = maxLength - 1;
+
+ // bi1 is negative, bi2 is positive
+ if((bi1.data[pos] & 0x80000000) != 0 && (bi2.data[pos] & 0x80000000) == 0)
+ return true;
+
+ // bi1 is positive, bi2 is negative
+ else if((bi1.data[pos] & 0x80000000) == 0 && (bi2.data[pos] & 0x80000000) != 0)
+ return false;
+
+ // same sign
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+ for(pos = len - 1; pos >= 0 && bi1.data[pos] == bi2.data[pos]; pos--);
+
+ if(pos >= 0) {
+ if(bi1.data[pos] < bi2.data[pos])
+ return true;
+ return false;
+ }
+ return false;
+ }
+
+ public static bool operator >= (BigInteger bi1, BigInteger bi2)
+ {
+ return (bi1 == bi2 || bi1 > bi2);
+ }
+
+ public static bool operator <= (BigInteger bi1, BigInteger bi2)
+ {
+ return (bi1 == bi2 || bi1 < bi2);
+ }
+
+ // Private function that supports the division of two numbers with
+ // a divisor that has more than 1 digit.
+ // Algorithm taken from [1]
+ private static void multiByteDivide (BigInteger bi1, BigInteger bi2,
+ BigInteger outQuotient, BigInteger outRemainder)
+ {
+ uint[] result = new uint[maxLength];
+
+ int remainderLen = bi1.dataLength + 1;
+ uint[] remainder = new uint[remainderLen];
+
+ uint mask = 0x80000000;
+ uint val = bi2.data[bi2.dataLength - 1];
+ int shift = 0, resultPos = 0;
+
+ while(mask != 0 && (val & mask) == 0) {
+ shift++; mask >>= 1;
+ }
+
+ //Console.WriteLine("shift = {0}", shift);
+ //Console.WriteLine("Before bi1 Len = {0}, bi2 Len = {1}", bi1.dataLength, bi2.dataLength);
+
+ for (int i = 0; i < bi1.dataLength; i++)
+ remainder[i] = bi1.data[i];
+ shiftLeft (remainder, shift);
+ bi2 = bi2 << shift;
+
+ /*
+ Console.WriteLine("bi1 Len = {0}, bi2 Len = {1}", bi1.dataLength, bi2.dataLength);
+ Console.WriteLine("dividend = " + bi1 + "\ndivisor = " + bi2);
+ for(int q = remainderLen - 1; q >= 0; q--)
+ Console.Write("{0:x2}", remainder[q]);
+ Console.WriteLine();
+ */
+
+ int j = remainderLen - bi2.dataLength;
+ int pos = remainderLen - 1;
+
+ ulong firstDivisorByte = bi2.data[bi2.dataLength-1];
+ ulong secondDivisorByte = bi2.data[bi2.dataLength-2];
+
+ int divisorLen = bi2.dataLength + 1;
+ uint[] dividendPart = new uint[divisorLen];
+
+ while(j > 0) {
+ ulong dividend = ((ulong)remainder[pos] << 32) + (ulong)remainder[pos-1];
+ //Console.WriteLine("dividend = {0}", dividend);
+
+ ulong q_hat = dividend / firstDivisorByte;
+ ulong r_hat = dividend % firstDivisorByte;
+
+ //Console.WriteLine("q_hat = {0:X}, r_hat = {1:X}", q_hat, r_hat);
+
+ bool done = false;
+ while(!done) {
+ done = true;
+
+ if(q_hat == 0x100000000 ||
+ (q_hat * secondDivisorByte) > ((r_hat << 32) + remainder[pos-2])) {
+ q_hat--;
+ r_hat += firstDivisorByte;
+
+ if(r_hat < 0x100000000)
+ done = false;
+ }
+ }
+
+ for (int h = 0; h < divisorLen; h++)
+ dividendPart[h] = remainder[pos-h];
+
+ BigInteger kk = new BigInteger (dividendPart);
+ BigInteger ss = bi2 * (long)q_hat;
+
+ //Console.WriteLine("ss before = " + ss);
+ while(ss > kk) {
+ q_hat--;
+ ss -= bi2;
+ //Console.WriteLine(ss);
+ }
+ BigInteger yy = kk - ss;
+
+ //Console.WriteLine("ss = " + ss);
+ //Console.WriteLine("kk = " + kk);
+ //Console.WriteLine("yy = " + yy);
+
+ for(int h = 0; h < divisorLen; h++)
+ remainder[pos-h] = yy.data[bi2.dataLength-h];
+
+ /*
+ Console.WriteLine("dividend = ");
+ for(int q = remainderLen - 1; q >= 0; q--)
+ Console.Write("{0:x2}", remainder[q]);
+ Console.WriteLine("\n************ q_hat = {0:X}\n", q_hat);
+ */
+
+ result[resultPos++] = (uint)q_hat;
+
+ pos--;
+ j--;
+ }
+
+ outQuotient.dataLength = resultPos;
+ int y = 0;
+ for(int x = outQuotient.dataLength - 1; x >= 0; x--, y++)
+ outQuotient.data[y] = result[x];
+ for(; y < maxLength; y++)
+ outQuotient.data[y] = 0;
+
+ while(outQuotient.dataLength > 1 && outQuotient.data[outQuotient.dataLength-1] == 0)
+ outQuotient.dataLength--;
+
+ if(outQuotient.dataLength == 0)
+ outQuotient.dataLength = 1;
+
+ outRemainder.dataLength = shiftRight(remainder, shift);
+
+ for(y = 0; y < outRemainder.dataLength; y++)
+ outRemainder.data[y] = remainder[y];
+ for(; y < maxLength; y++)
+ outRemainder.data[y] = 0;
+ }
+
+ // Private function that supports the division of two numbers with
+ // a divisor that has only 1 digit.
+ private static void singleByteDivide (BigInteger bi1, BigInteger bi2,
+ BigInteger outQuotient, BigInteger outRemainder)
+ {
+ uint[] result = new uint[maxLength];
+ int resultPos = 0;
+
+ // copy dividend to reminder
+ for(int i = 0; i < maxLength; i++)
+ outRemainder.data[i] = bi1.data[i];
+ outRemainder.dataLength = bi1.dataLength;
+
+ while(outRemainder.dataLength > 1 && outRemainder.data[outRemainder.dataLength-1] == 0)
+ outRemainder.dataLength--;
+
+ ulong divisor = (ulong)bi2.data[0];
+ int pos = outRemainder.dataLength - 1;
+ ulong dividend = (ulong)outRemainder.data[pos];
+
+ //Console.WriteLine("divisor = " + divisor + " dividend = " + dividend);
+ //Console.WriteLine("divisor = " + bi2 + "\ndividend = " + bi1);
+
+ if(dividend >= divisor) {
+ ulong quotient = dividend / divisor;
+ result[resultPos++] = (uint)quotient;
+
+ outRemainder.data[pos] = (uint)(dividend % divisor);
+ }
+ pos--;
+
+ while(pos >= 0) {
+ //Console.WriteLine(pos);
+
+ dividend = ((ulong)outRemainder.data[pos+1] << 32) + (ulong)outRemainder.data[pos];
+ ulong quotient = dividend / divisor;
+ result[resultPos++] = (uint)quotient;
+
+ outRemainder.data[pos+1] = 0;
+ outRemainder.data[pos--] = (uint)(dividend % divisor);
+ //Console.WriteLine(">>>> " + bi1);
+ }
+
+ outQuotient.dataLength = resultPos;
+ int j = 0;
+ for(int i = outQuotient.dataLength - 1; i >= 0; i--, j++)
+ outQuotient.data[j] = result[i];
+ for(; j < maxLength; j++)
+ outQuotient.data[j] = 0;
+
+ while(outQuotient.dataLength > 1 && outQuotient.data[outQuotient.dataLength-1] == 0)
+ outQuotient.dataLength--;
+
+ if(outQuotient.dataLength == 0)
+ outQuotient.dataLength = 1;
+
+ while(outRemainder.dataLength > 1 && outRemainder.data[outRemainder.dataLength-1] == 0)
+ outRemainder.dataLength--;
+ }
+
+ // Overloading of division operator
+ public static BigInteger operator / (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger();
+
+ int lastPos = maxLength-1;
+ bool divisorNeg = false, dividendNeg = false;
+
+ if((bi1.data[lastPos] & 0x80000000) != 0) { // bi1 negative
+ bi1 = -bi1;
+ dividendNeg = true;
+ }
+ if((bi2.data[lastPos] & 0x80000000) != 0) { // bi2 negative
+ bi2 = -bi2;
+ divisorNeg = true;
+ }
+
+ if(bi1 < bi2) {
+ return quotient;
+ }
+
+ else {
+ if(bi2.dataLength == 1)
+ singleByteDivide(bi1, bi2, quotient, remainder);
+ else
+ multiByteDivide(bi1, bi2, quotient, remainder);
+
+ if(dividendNeg != divisorNeg)
+ return -quotient;
+
+ return quotient;
+ }
+ }
+
+ // Overloading of modulus operator
+ public static BigInteger operator % (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger(bi1);
+
+ int lastPos = maxLength-1;
+ bool dividendNeg = false;
+
+ if((bi1.data[lastPos] & 0x80000000) != 0) { // bi1 negative
+ bi1 = -bi1;
+ dividendNeg = true;
+ }
+ if((bi2.data[lastPos] & 0x80000000) != 0) // bi2 negative
+ bi2 = -bi2;
+
+ if(bi1 < bi2) {
+ return remainder;
+ }
+
+ else {
+ if(bi2.dataLength == 1)
+ singleByteDivide(bi1, bi2, quotient, remainder);
+ else
+ multiByteDivide(bi1, bi2, quotient, remainder);
+
+ if(dividendNeg)
+ return -remainder;
+
+ return remainder;
+ }
+ }
+
+ // Overloading of bitwise AND operator
+ public static BigInteger operator & (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger();
+
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ for(int i = 0; i < len; i++) {
+ uint sum = (uint)(bi1.data[i] & bi2.data[i]);
+ result.data[i] = sum;
+ }
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Overloading of bitwise OR operator
+ public static BigInteger operator | (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger();
+
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ for(int i = 0; i < len; i++) {
+ uint sum = (uint)(bi1.data[i] | bi2.data[i]);
+ result.data[i] = sum;
+ }
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Overloading of bitwise XOR operator
+ public static BigInteger operator ^ (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger();
+
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ for(int i = 0; i < len; i++) {
+ uint sum = (uint)(bi1.data[i] ^ bi2.data[i]);
+ result.data[i] = sum;
+ }
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Returns max(this, bi)
+ public BigInteger max (BigInteger bi)
+ {
+ if(this > bi)
+ return (new BigInteger(this));
+ else
+ return (new BigInteger(bi));
+ }
+
+ // Returns min(this, bi)
+ public BigInteger min (BigInteger bi)
+ {
+ if (this < bi)
+ return (new BigInteger (this));
+ else
+ return (new BigInteger (bi));
+ }
+
+ // Returns the absolute value
+ public BigInteger abs ()
+ {
+ if((this.data[maxLength - 1] & 0x80000000) != 0)
+ return (-this);
+ else
+ return (new BigInteger (this));
+ }
+
+ // Returns a string representing the BigInteger in base 10.
+ public override string ToString ()
+ {
+ return ToString (10);
+ }
+
+ // Returns a string representing the BigInteger in sign-and-magnitude
+ // format in the specified radix.
+ //
+ // Example
+ // -------
+ // If the value of BigInteger is -255 in base 10, then
+ // ToString(16) returns "-FF"
+ public string ToString (int radix)
+ {
+ if(radix < 2 || radix > 36)
+ throw (new ArgumentException("Radix must be >= 2 and <= 36"));
+
+ string charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ string result = "";
+
+ BigInteger a = this;
+
+ bool negative = false;
+ if((a.data[maxLength-1] & 0x80000000) != 0) {
+ negative = true;
+ try {
+ a = -a;
+ }
+ catch(Exception) {}
+ }
+
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger();
+ BigInteger biRadix = new BigInteger(radix);
+
+ if(a.dataLength == 1 && a.data[0] == 0)
+ result = "0";
+ else {
+ while(a.dataLength > 1 || (a.dataLength == 1 && a.data[0] != 0)) {
+ singleByteDivide(a, biRadix, quotient, remainder);
+
+ if(remainder.data[0] < 10)
+ result = remainder.data[0] + result;
+ else
+ result = charSet[(int)remainder.data[0] - 10] + result;
+
+ a = quotient;
+ }
+ if(negative)
+ result = "-" + result;
+ }
+
+ return result;
+ }
+
+
+ // Returns a hex string showing the contains of the BigInteger
+ //
+ // Examples
+ // -------
+ // 1) If the value of BigInteger is 255 in base 10, then
+ // ToHexString() returns "FF"
+ //
+ // 2) If the value of BigInteger is -255 in base 10, then
+ // ToHexString() returns ".....FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01",
+ // which is the 2's complement representation of -255.
+ public string ToHexString ()
+ {
+ string result = data[dataLength - 1].ToString("X");
+
+ for(int i = dataLength - 2; i >= 0; i--) {
+ result += data[i].ToString("X8");
+ }
+
+ return result;
+ }
+
+ // Modulo Exponentiation
+ public BigInteger modPow(BigInteger exp, BigInteger n)
+ {
+ if((exp.data[maxLength-1] & 0x80000000) != 0)
+ throw (new ArithmeticException("Positive exponents only."));
+
+ BigInteger resultNum = 1;
+ BigInteger tempNum;
+ bool thisNegative = false;
+
+ if((this.data[maxLength-1] & 0x80000000) != 0) { // negative this
+ tempNum = -this % n;
+ thisNegative = true;
+ }
+ else
+ tempNum = this % n; // ensures (tempNum * tempNum) < b^(2k)
+
+ if((n.data[maxLength-1] & 0x80000000) != 0) // negative n
+ n = -n;
+
+ // calculate constant = b^(2k) / m
+ BigInteger constant = new BigInteger ();
+
+ int i = n.dataLength << 1;
+ constant.data[i] = 0x00000001;
+ constant.dataLength = i + 1;
+
+ constant = constant / n;
+ int totalBits = exp.bitCount ();
+ int count = 0;
+
+ // perform squaring and multiply exponentiation
+ for(int pos = 0; pos < exp.dataLength; pos++) {
+ uint mask = 0x01;
+ //Console.WriteLine("pos = " + pos);
+
+ for(int index = 0; index < 32; index++) {
+ if((exp.data[pos] & mask) != 0)
+ resultNum = BarrettReduction(resultNum * tempNum, n, constant);
+
+ mask <<= 1;
+
+ tempNum = BarrettReduction(tempNum * tempNum, n, constant);
+
+
+ if(tempNum.dataLength == 1 && tempNum.data[0] == 1) {
+ if(thisNegative && (exp.data[0] & 0x1) != 0) //odd exp
+ return -resultNum;
+ return resultNum;
+ }
+ count++;
+ if(count == totalBits)
+ break;
+ }
+ }
+
+ if(thisNegative && (exp.data[0] & 0x1) != 0) //odd exp
+ return -resultNum;
+
+ return resultNum;
+ }
+
+ // Fast calculation of modular reduction using Barrett's reduction.
+ // Requires x < b^(2k), where b is the base. In this case, base is
+ // 2^32 (uint).
+ // Reference [4]
+ private BigInteger BarrettReduction(BigInteger x, BigInteger n, BigInteger constant)
+ {
+ int k = n.dataLength,
+ kPlusOne = k+1,
+ kMinusOne = k-1;
+
+ BigInteger q1 = new BigInteger ();
+
+ // q1 = x / b^(k-1)
+ for(int i = kMinusOne, j = 0; i < x.dataLength; i++, j++)
+ q1.data[j] = x.data[i];
+ q1.dataLength = x.dataLength - kMinusOne;
+ if(q1.dataLength <= 0)
+ q1.dataLength = 1;
+
+
+ BigInteger q2 = q1 * constant;
+ BigInteger q3 = new BigInteger();
+
+ // q3 = q2 / b^(k+1)
+ for(int i = kPlusOne, j = 0; i < q2.dataLength; i++, j++)
+ q3.data[j] = q2.data[i];
+ q3.dataLength = q2.dataLength - kPlusOne;
+ if(q3.dataLength <= 0)
+ q3.dataLength = 1;
+
+ // r1 = x mod b^(k+1)
+ // i.e. keep the lowest (k+1) words
+ BigInteger r1 = new BigInteger();
+ int lengthToCopy = (x.dataLength > kPlusOne) ? kPlusOne : x.dataLength;
+ for(int i = 0; i < lengthToCopy; i++)
+ r1.data[i] = x.data[i];
+ r1.dataLength = lengthToCopy;
+
+ // r2 = (q3 * n) mod b^(k+1)
+ // partial multiplication of q3 and n
+
+ BigInteger r2 = new BigInteger();
+ for(int i = 0; i < q3.dataLength; i++) {
+ if(q3.data[i] == 0) continue;
+
+ ulong mcarry = 0;
+ int t = i;
+ for(int j = 0; j < n.dataLength && t < kPlusOne; j++, t++) {
+ // t = i + j
+ ulong val = ((ulong)q3.data[i] * (ulong)n.data[j]) +
+ (ulong)r2.data[t] + mcarry;
+
+ r2.data[t] = (uint)(val & 0xFFFFFFFF);
+ mcarry = (val >> 32);
+ }
+
+ if(t < kPlusOne)
+ r2.data[t] = (uint)mcarry;
+ }
+ r2.dataLength = kPlusOne;
+ while(r2.dataLength > 1 && r2.data[r2.dataLength-1] == 0)
+ r2.dataLength--;
+
+ r1 -= r2;
+ if((r1.data[maxLength-1] & 0x80000000) != 0) { // negative
+ BigInteger val = new BigInteger();
+ val.data[kPlusOne] = 0x00000001;
+ val.dataLength = kPlusOne + 1;
+ r1 += val;
+ }
+
+ while(r1 >= n)
+ r1 -= n;
+
+ return r1;
+ }
+
+ // Returns gcd(this, bi)
+ public BigInteger gcd(BigInteger bi)
+ {
+ BigInteger x;
+ BigInteger y;
+
+ if((data[maxLength-1] & 0x80000000) != 0) // negative
+ x = -this;
+ else
+ x = this;
+
+ if((bi.data[maxLength-1] & 0x80000000) != 0) // negative
+ y = -bi;
+ else
+ y = bi;
+
+ BigInteger g = y;
+
+ while(x.dataLength > 1 || (x.dataLength == 1 && x.data[0] != 0)) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+
+ return g;
+ }
+
+ // Populates "this" with the specified amount of random bits
+ public void genRandomBits (int bits)
+ {
+ genRandomBits (bits, new BigRandom ());
+ }
+
+ public void genRandomBits (int bits, BigRandom rng)
+ {
+ int dwords = bits >> 5;
+ int remBits = bits & 0x1F;
+
+ if (remBits != 0)
+ dwords++;
+
+ if (dwords > maxLength)
+ throw (new ArithmeticException("Number of required bits > maxLength."));
+
+ rng.Get (data);
+ for (int i = dwords; i < maxLength; i++)
+ data[i] = 0;
+
+ if (remBits != 0) {
+ uint mask = (uint)(0x01 << (remBits-1));
+ data[dwords-1] |= mask;
+
+ mask = (uint)(0xFFFFFFFF >> (32 - remBits));
+ data[dwords-1] &= mask;
+ }
+ else
+ data[dwords-1] |= 0x80000000;
+
+ dataLength = dwords;
+
+ if (dataLength == 0)
+ dataLength = 1;
+ }
+
+ // Returns the position of the most significant bit in the BigInteger.
+ // Eg. The result is 0, if the value of BigInteger is 0...0000 0000
+ // The result is 1, if the value of BigInteger is 0...0000 0001
+ // The result is 2, if the value of BigInteger is 0...0000 0010
+ // The result is 2, if the value of BigInteger is 0...0000 0011
+ public int bitCount ()
+ {
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ uint value = data[dataLength - 1];
+ uint mask = 0x80000000;
+ int bits = 32;
+
+ while(bits > 0 && (value & mask) == 0) {
+ bits--;
+ mask >>= 1;
+ }
+ bits += ((dataLength - 1) << 5);
+
+ return bits;
+ }
+
+ // Probabilistic prime test based on Fermat's little theorem
+ //
+ // for any a < p (p does not divide a) if
+ // a^(p-1) mod p != 1 then p is not prime.
+ //
+ // Otherwise, p is probably prime (pseudoprime to the chosen base).
+ //
+ // Returns
+ // -------
+ // True if "this" is a pseudoprime to randomly chosen
+ // bases. The number of chosen bases is given by the "confidence"
+ // parameter.
+ //
+ // False if "this" is definitely NOT prime.
+ //
+ // Note - this method is fast but fails for Carmichael numbers except
+ // when the randomly chosen base is a factor of the number.
+ public bool FermatLittleTest (int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = new BigInteger();
+ BigInteger p_sub1 = thisVal - (new BigInteger(1));
+
+ for(int round = 0; round < confidence; round++) {
+ bool done = false;
+
+ while(!done) { // generate a < n
+ int testBits = 0;
+
+ // make sure "a" has at least 2 bits
+ while(testBits < 2)
+ testBits = rng.GetInt (bits);
+
+ a.genRandomBits (testBits);
+
+ int byteLen = a.dataLength;
+
+ // make sure "a" is not 0
+ if(byteLen > 1 || (byteLen == 1 && a.data[0] != 1))
+ done = true;
+ }
+
+ // check whether a factor exists (fix for version 1.03)
+ BigInteger gcdTest = a.gcd(thisVal);
+ if(gcdTest.dataLength == 1 && gcdTest.data[0] != 1)
+ return false;
+
+ // calculate a^(p-1) mod p
+ BigInteger expResult = a.modPow(p_sub1, thisVal);
+
+ int resultLen = expResult.dataLength;
+
+ // is NOT prime is a^(p-1) mod p != 1
+
+ if(resultLen > 1 || (resultLen == 1 && expResult.data[0] != 1)) {
+ //Console.WriteLine("a = " + a.ToString());
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Probabilistic prime test based on Rabin-Miller's
+ //
+ // for any p > 0 with p - 1 = 2^s * t
+ //
+ // p is probably prime (strong pseudoprime) if for any a < p,
+ // 1) a^t mod p = 1 or
+ // 2) a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
+ //
+ // Otherwise, p is composite.
+ //
+ // Returns
+ // -------
+ // True if "this" is a strong pseudoprime to randomly chosen
+ // bases. The number of chosen bases is given by the "confidence"
+ // parameter.
+ //
+ // False if "this" is definitely NOT prime.
+ public bool RabinMillerTest(int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ // calculate values of s and t
+ BigInteger p_sub1 = thisVal - (new BigInteger(1));
+ int s = 0;
+
+ for(int index = 0; index < p_sub1.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((p_sub1.data[index] & mask) != 0) {
+ index = p_sub1.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = p_sub1 >> s;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = new BigInteger();
+
+ for(int round = 0; round < confidence; round++) {
+ bool done = false;
+
+ while(!done) { // generate a < n
+ int testBits = 0;
+
+ // make sure "a" has at least 2 bits
+ while(testBits < 2)
+ testBits = rng.GetInt (bits);
+
+ a.genRandomBits (testBits);
+
+ int byteLen = a.dataLength;
+
+ // make sure "a" is not 0
+ if(byteLen > 1 || (byteLen == 1 && a.data[0] != 1))
+ done = true;
+ }
+
+ // check whether a factor exists (fix for version 1.03)
+ BigInteger gcdTest = a.gcd(thisVal);
+ if(gcdTest.dataLength == 1 && gcdTest.data[0] != 1)
+ return false;
+
+ BigInteger b = a.modPow(t, thisVal);
+
+ /*
+ Console.WriteLine("a = " + a.ToString(10));
+ Console.WriteLine("b = " + b.ToString(10));
+ Console.WriteLine("t = " + t.ToString(10));
+ Console.WriteLine("s = " + s);
+ */
+
+ bool result = false;
+
+ if(b.dataLength == 1 && b.data[0] == 1) // a^t mod p = 1
+ result = true;
+
+ for(int j = 0; result == false && j < s; j++) {
+ if(b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
+ result = true;
+ break;
+ }
+
+ b = (b * b) % thisVal;
+ }
+
+ if(result == false)
+ return false;
+ }
+ return true;
+ }
+
+ // Probabilistic prime test based on Solovay-Strassen (Euler Criterion)
+ //
+ // p is probably prime if for any a < p (a is not multiple of p),
+ // a^((p-1)/2) mod p = J(a, p)
+ //
+ // where J is the Jacobi symbol.
+ //
+ // Otherwise, p is composite.
+ //
+ // Returns
+ // -------
+ // True if "this" is a Euler pseudoprime to randomly chosen
+ // bases. The number of chosen bases is given by the "confidence"
+ // parameter.
+ //
+ // False if "this" is definitely NOT prime.
+ public bool SolovayStrassenTest(int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = new BigInteger();
+ BigInteger p_sub1 = thisVal - 1;
+ BigInteger p_sub1_shift = p_sub1 >> 1;
+
+ for(int round = 0; round < confidence; round++) {
+ bool done = false;
+
+ while(!done) { // generate a < n
+ int testBits = 0;
+
+ // make sure "a" has at least 2 bits
+ while(testBits < 2)
+ testBits = rng.GetInt (bits);
+
+ a.genRandomBits (testBits);
+
+ int byteLen = a.dataLength;
+
+ // make sure "a" is not 0
+ if(byteLen > 1 || (byteLen == 1 && a.data[0] != 1))
+ done = true;
+ }
+
+ // check whether a factor exists (fix for version 1.03)
+ BigInteger gcdTest = a.gcd(thisVal);
+ if(gcdTest.dataLength == 1 && gcdTest.data[0] != 1)
+ return false;
+
+ // calculate a^((p-1)/2) mod p
+
+ BigInteger expResult = a.modPow(p_sub1_shift, thisVal);
+ if(expResult == p_sub1)
+ expResult = -1;
+
+ // calculate Jacobi symbol
+ BigInteger jacob = Jacobi(a, thisVal);
+
+ //Console.WriteLine("a = " + a.ToString(10) + " b = " + thisVal.ToString(10));
+ //Console.WriteLine("expResult = " + expResult.ToString(10) + " Jacob = " + jacob.ToString(10));
+
+ // if they are different then it is not prime
+ if(expResult != jacob)
+ return false;
+ }
+
+ return true;
+ }
+
+ // Implementation of the Lucas Strong Pseudo Prime test.
+ //
+ // Let n be an odd number with gcd(n,D) = 1, and n - J(D, n) = 2^s * d
+ // with d odd and s >= 0.
+ //
+ // If Ud mod n = 0 or V2^r*d mod n = 0 for some 0 <= r < s, then n
+ // is a strong Lucas pseudoprime with parameters (P, Q). We select
+ // P and Q based on Selfridge.
+ //
+ // Returns True if number is a strong Lucus pseudo prime.
+ // Otherwise, returns False indicating that number is composite.
+ public bool LucasStrongTest()
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ return LucasStrongTestHelper(thisVal);
+ }
+
+ private bool LucasStrongTestHelper(BigInteger thisVal)
+ {
+ // Do the test (selects D based on Selfridge)
+ // Let D be the first element of the sequence
+ // 5, -7, 9, -11, 13, ... for which J(D,n) = -1
+ // Let P = 1, Q = (1-D) / 4
+
+ long D = 5, sign = -1, dCount = 0;
+ bool done = false;
+
+ while(!done) {
+ int Jresult = BigInteger.Jacobi(D, thisVal);
+
+ if(Jresult == -1)
+ done = true; // J(D, this) = 1
+ else {
+ if(Jresult == 0 && System.Math.Abs(D) < thisVal) // divisor found
+ return false;
+
+ if(dCount == 20) {
+ // check for square
+ BigInteger root = thisVal.sqrt();
+ if(root * root == thisVal)
+ return false;
+ }
+
+ //Console.WriteLine(D);
+ D = (System.Math.Abs(D) + 2) * sign;
+ sign = -sign;
+ }
+ dCount++;
+ }
+
+ long Q = (1 - D) >> 2;
+
+ /*
+ Console.WriteLine("D = " + D);
+ Console.WriteLine("Q = " + Q);
+ Console.WriteLine("(n,D) = " + thisVal.gcd(D));
+ Console.WriteLine("(n,Q) = " + thisVal.gcd(Q));
+ Console.WriteLine("J(D|n) = " + BigInteger.Jacobi(D, thisVal));
+ */
+
+ BigInteger p_add1 = thisVal + 1;
+ int s = 0;
+
+ for(int index = 0; index < p_add1.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((p_add1.data[index] & mask) != 0) {
+ index = p_add1.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = p_add1 >> s;
+
+ // calculate constant = b^(2k) / m
+ // for Barrett Reduction
+ BigInteger constant = new BigInteger();
+
+ int nLen = thisVal.dataLength << 1;
+ constant.data[nLen] = 0x00000001;
+ constant.dataLength = nLen + 1;
+
+ constant = constant / thisVal;
+
+ BigInteger[] lucas = LucasSequenceHelper(1, Q, t, thisVal, constant, 0);
+ bool isPrime = false;
+
+ if((lucas[0].dataLength == 1 && lucas[0].data[0] == 0) ||
+ (lucas[1].dataLength == 1 && lucas[1].data[0] == 0)) {
+ // u(t) = 0 or V(t) = 0
+ isPrime = true;
+ }
+
+ for(int i = 1; i < s; i++) {
+ if(!isPrime) {
+ // doubling of index
+ lucas[1] = thisVal.BarrettReduction(lucas[1] * lucas[1], thisVal, constant);
+ lucas[1] = (lucas[1] - (lucas[2] << 1)) % thisVal;
+
+ //lucas[1] = ((lucas[1] * lucas[1]) - (lucas[2] << 1)) % thisVal;
+
+ if((lucas[1].dataLength == 1 && lucas[1].data[0] == 0))
+ isPrime = true;
+ }
+
+ lucas[2] = thisVal.BarrettReduction(lucas[2] * lucas[2], thisVal, constant); //Q^k
+ }
+
+
+ if(isPrime) { // additional checks for composite numbers
+ // If n is prime and gcd(n, Q) == 1, then
+ // Q^((n+1)/2) = Q * Q^((n-1)/2) is congruent to (Q * J(Q, n)) mod n
+
+ BigInteger g = thisVal.gcd(Q);
+ if(g.dataLength == 1 && g.data[0] == 1) { // gcd(this, Q) == 1
+ if((lucas[2].data[maxLength-1] & 0x80000000) != 0)
+ lucas[2] += thisVal;
+
+ BigInteger temp = (Q * BigInteger.Jacobi(Q, thisVal)) % thisVal;
+ if((temp.data[maxLength-1] & 0x80000000) != 0)
+ temp += thisVal;
+
+ if(lucas[2] != temp)
+ isPrime = false;
+ }
+ }
+
+ return isPrime;
+ }
+
+ // Determines whether a number is probably prime, using the Rabin-Miller's
+ // test. Before applying the test, the number is tested for divisibility
+ // by primes < 2000
+ //
+ // Returns true if number is probably prime.
+ public bool isProbablePrime(int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+
+ // test for divisibility by primes < 2000
+ for(int p = 0; p < primesBelow2000.Length; p++) {
+ BigInteger divisor = primesBelow2000[p];
+
+ if(divisor >= thisVal)
+ break;
+
+ BigInteger resultNum = thisVal % divisor;
+ if(resultNum.IntValue() == 0) {
+ /*
+ Console.WriteLine("Not prime! Divisible by {0}\n",
+ primesBelow2000[p]);
+ */
+ return false;
+ }
+ }
+
+ if(thisVal.RabinMillerTest(confidence))
+ return true;
+ else {
+ //Console.WriteLine("Not prime! Failed primality test\n");
+ return false;
+ }
+ }
+
+ // Determines whether this BigInteger is probably prime using a
+ // combination of base 2 strong pseudoprime test and Lucas strong
+ // pseudoprime test.
+ //
+ // The sequence of the primality test is as follows,
+ //
+ // 1) Trial divisions are carried out using prime numbers below 2000.
+ // if any of the primes divides this BigInteger, then it is not prime.
+ //
+ // 2) Perform base 2 strong pseudoprime test. If this BigInteger is a
+ // base 2 strong pseudoprime, proceed on to the next step.
+ //
+ // 3) Perform strong Lucas pseudoprime test.
+ //
+ // Returns True if this BigInteger is both a base 2 strong pseudoprime
+ // and a strong Lucas pseudoprime.
+ //
+ // For a detailed discussion of this primality test, see [6].
+ public bool isProbablePrime()
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ // test for divisibility by primes < 2000
+ for(int p = 0; p < primesBelow2000.Length; p++) {
+ BigInteger divisor = primesBelow2000[p];
+
+ if(divisor >= thisVal)
+ break;
+
+ BigInteger resultNum = thisVal % divisor;
+ if(resultNum.IntValue() == 0) {
+ //Console.WriteLine("Not prime! Divisible by {0}\n",
+ // primesBelow2000[p]);
+
+ return false;
+ }
+ }
+
+ // Perform BASE 2 Rabin-Miller Test
+
+ // calculate values of s and t
+ BigInteger p_sub1 = thisVal - (new BigInteger(1));
+ int s = 0;
+
+ for(int index = 0; index < p_sub1.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((p_sub1.data[index] & mask) != 0) {
+ index = p_sub1.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = p_sub1 >> s;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = 2;
+
+ // b = a^t mod p
+ BigInteger b = a.modPow(t, thisVal);
+ bool result = false;
+
+ if(b.dataLength == 1 && b.data[0] == 1) // a^t mod p = 1
+ result = true;
+
+ for(int j = 0; result == false && j < s; j++) {
+ if(b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
+ result = true;
+ break;
+ }
+
+ b = (b * b) % thisVal;
+ }
+
+ // if number is strong pseudoprime to base 2, then do a strong lucas test
+ if(result)
+ result = LucasStrongTestHelper(thisVal);
+
+ return result;
+ }
+
+ // Returns the lowest 4 bytes of the BigInteger as an int.
+ public int IntValue ()
+ {
+ return (int)data[0];
+ }
+
+ // Returns the lowest 8 bytes of the BigInteger as a long.
+ public long LongValue ()
+ {
+ long val = 0;
+
+ val = (long)data[0];
+ try {
+ // exception if maxLength = 1
+ val |= (long)data[1] << 32;
+ }
+ catch(Exception) {
+ if((data[0] & 0x80000000) != 0) // negative
+ val = (int)data[0];
+ }
+
+ return val;
+ }
+
+ // Computes the Jacobi Symbol for a and b.
+ // Algorithm adapted from [3] and [4] with some optimizations
+ public static int Jacobi (BigInteger a, BigInteger b)
+ {
+ // Jacobi defined only for odd integers
+ if((b.data[0] & 0x1) == 0)
+ throw (new ArgumentException("Jacobi defined only for odd integers."));
+
+ if(a >= b) a %= b;
+ if(a.dataLength == 1 && a.data[0] == 0) return 0; // a == 0
+ if(a.dataLength == 1 && a.data[0] == 1) return 1; // a == 1
+
+ if(a < 0) {
+ if( (((b-1).data[0]) & 0x2) == 0) //if( (((b-1) >> 1).data[0] & 0x1) == 0)
+ return Jacobi(-a, b);
+ else
+ return -Jacobi(-a, b);
+ }
+
+ int e = 0;
+ for(int index = 0; index < a.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((a.data[index] & mask) != 0) {
+ index = a.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ e++;
+ }
+ }
+
+ BigInteger a1 = a >> e;
+
+ int s = 1;
+ if((e & 0x1) != 0 && ((b.data[0] & 0x7) == 3 || (b.data[0] & 0x7) == 5))
+ s = -1;
+
+ if((b.data[0] & 0x3) == 3 && (a1.data[0] & 0x3) == 3)
+ s = -s;
+
+ if(a1.dataLength == 1 && a1.data[0] == 1)
+ return s;
+ else
+ return (s * Jacobi(b % a1, a1));
+ }
+
+ // Generates a positive BigInteger that is probably prime.
+ public static BigInteger genPseudoPrime (int bits, int confidence)
+ {
+ BigInteger result = new BigInteger ();
+ bool done = false;
+
+ while (!done) {
+ result.genRandomBits (bits);
+ result.data[0] |= 0x01; // make it odd
+ // prime test
+ done = result.isProbablePrime(confidence);
+ }
+ return result;
+ }
+
+ // Generates a random number with the specified number of bits such
+ // that gcd(number, this) = 1
+ public BigInteger genCoPrime (int bits)
+ {
+ bool done = false;
+ BigInteger result = new BigInteger ();
+
+ while(!done) {
+ result.genRandomBits (bits);
+ //Console.WriteLine(result.ToString(16));
+
+ // gcd test
+ BigInteger g = result.gcd(this);
+ if (g.dataLength == 1 && g.data[0] == 1)
+ done = true;
+ }
+
+ return result;
+ }
+
+ // Returns the modulo inverse of this. Throws ArithmeticException if
+ // the inverse does not exist. (i.e. gcd(this, modulus) != 1)
+ public BigInteger modInverse (BigInteger modulus)
+ {
+ BigInteger[] p = { 0, 1 };
+ BigInteger[] q = new BigInteger[2]; // quotients
+ BigInteger[] r = { 0, 0 }; // remainders
+
+ int step = 0;
+
+ BigInteger a = modulus;
+ BigInteger b = this;
+
+ while(b.dataLength > 1 || (b.dataLength == 1 && b.data[0] != 0)) {
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger();
+
+ if(step > 1) {
+ BigInteger pval = (p[0] - (p[1] * q[0])) % modulus;
+ p[0] = p[1];
+ p[1] = pval;
+ }
+
+ if(b.dataLength == 1)
+ singleByteDivide(a, b, quotient, remainder);
+ else
+ multiByteDivide(a, b, quotient, remainder);
+
+ /*
+ Console.WriteLine(quotient.dataLength);
+ Console.WriteLine("{0} = {1}({2}) + {3} p = {4}", a.ToString(10),
+ b.ToString(10), quotient.ToString(10), remainder.ToString(10),
+ p[1].ToString(10));
+ */
+
+ q[0] = q[1];
+ r[0] = r[1];
+ q[1] = quotient; r[1] = remainder;
+
+ a = b;
+ b = remainder;
+
+ step++;
+ }
+
+ if(r[0].dataLength > 1 || (r[0].dataLength == 1 && r[0].data[0] != 1))
+ throw (new ArithmeticException("No inverse!"));
+
+ BigInteger result = ((p[0] - (p[1] * q[0])) % modulus);
+
+ if((result.data[maxLength - 1] & 0x80000000) != 0)
+ result += modulus; // get the least positive modulus
+
+ return result;
+ }
+
+ // Returns the value of the BigInteger as a byte array. The lowest
+ // index contains the MSB.
+ public byte[] getBytes()
+ {
+ int numBits = bitCount();
+ byte[] result = null;
+ if(numBits == 0) {
+ result = new byte[1];
+ result[0] = 0;
+ }
+ else {
+ int numBytes = numBits >> 3;
+ if((numBits & 0x7) != 0)
+ numBytes++;
+ result = new byte[numBytes];
+ //Console.WriteLine(result.Length);
+ int numBytesInWord = numBytes & 0x3;
+ if(numBytesInWord == 0)
+ numBytesInWord = 4;
+ int pos = 0;
+ for(int i = dataLength - 1; i >= 0; i--) {
+ uint val = data[i];
+ for(int j = numBytesInWord - 1; j >= 0; j--) {
+ result[pos+j] = (byte)(val & 0xFF);
+ val >>= 8;
+ }
+ pos += numBytesInWord;
+ numBytesInWord = 4;
+ }
+ }
+ return result;
+ }
+
+ // Return true if the value of the specified bit is 1, false otherwise
+ public bool testBit (uint bitNum)
+ {
+ uint bytePos = bitNum >> 5; // divide by 32
+ byte bitPos = (byte)(bitNum & 0x1F); // get the lowest 5 bits
+
+ uint mask = (uint)1 << bitPos;
+ return ((this.data[bytePos] | mask) == this.data[bytePos]);
+ }
+
+ // Sets the value of the specified bit to 1
+ // The Least Significant Bit position is 0.
+ public void setBit(uint bitNum)
+ {
+ uint bytePos = bitNum >> 5; // divide by 32
+ byte bitPos = (byte)(bitNum & 0x1F); // get the lowest 5 bits
+
+ uint mask = (uint)1 << bitPos;
+ this.data[bytePos] |= mask;
+
+ if(bytePos >= this.dataLength)
+ this.dataLength = (int)bytePos + 1;
+ }
+
+ // Sets the value of the specified bit to 0
+ // The Least Significant Bit position is 0.
+ public void unsetBit(uint bitNum)
+ {
+ uint bytePos = bitNum >> 5;
+
+ if(bytePos < this.dataLength) {
+ byte bitPos = (byte)(bitNum & 0x1F);
+
+ uint mask = (uint)1 << bitPos;
+ uint mask2 = 0xFFFFFFFF ^ mask;
+
+ this.data[bytePos] &= mask2;
+
+ if(this.dataLength > 1 && this.data[this.dataLength - 1] == 0)
+ this.dataLength--;
+ }
+ }
+
+ // Returns a value that is equivalent to the integer square root
+ // of the BigInteger.
+ // The integer square root of "this" is defined as the largest integer n
+ // such that (n * n) <= this
+ public BigInteger sqrt ()
+ {
+ uint numBits = (uint)this.bitCount();
+
+ if((numBits & 0x1) != 0) // odd number of bits
+ numBits = (numBits >> 1) + 1;
+ else
+ numBits = (numBits >> 1);
+
+ uint bytePos = numBits >> 5;
+ byte bitPos = (byte)(numBits & 0x1F);
+
+ uint mask;
+
+ BigInteger result = new BigInteger();
+ if(bitPos == 0)
+ mask = 0x80000000;
+ else {
+ mask = (uint)1 << bitPos;
+ bytePos++;
+ }
+ result.dataLength = (int)bytePos;
+
+ for(int i = (int)bytePos - 1; i >= 0; i--) {
+ while(mask != 0) {
+ // guess
+ result.data[i] ^= mask;
+
+ // undo the guess if its square is larger than this
+ if((result * result) > this)
+ result.data[i] ^= mask;
+
+ mask >>= 1;
+ }
+ mask = 0x80000000;
+ }
+ return result;
+ }
+
+ // Returns the k_th number in the Lucas Sequence reduced modulo n.
+ //
+ // Uses index doubling to speed up the process. For example, to calculate V(k),
+ // we maintain two numbers in the sequence V(n) and V(n+1).
+ //
+ // To obtain V(2n), we use the identity
+ // V(2n) = (V(n) * V(n)) - (2 * Q^n)
+ // To obtain V(2n+1), we first write it as
+ // V(2n+1) = V((n+1) + n)
+ // and use the identity
+ // V(m+n) = V(m) * V(n) - Q * V(m-n)
+ // Hence,
+ // V((n+1) + n) = V(n+1) * V(n) - Q^n * V((n+1) - n)
+ // = V(n+1) * V(n) - Q^n * V(1)
+ // = V(n+1) * V(n) - Q^n * P
+ //
+ // We use k in its binary expansion and perform index doubling for each
+ // bit position. For each bit position that is set, we perform an
+ // index doubling followed by an index addition. This means that for V(n),
+ // we need to update it to V(2n+1). For V(n+1), we need to update it to
+ // V((2n+1)+1) = V(2*(n+1))
+ //
+ // This function returns
+ // [0] = U(k)
+ // [1] = V(k)
+ // [2] = Q^n
+ //
+ // Where U(0) = 0 % n, U(1) = 1 % n
+ // V(0) = 2 % n, V(1) = P % n
+ public static BigInteger[] LucasSequence (BigInteger P, BigInteger Q,
+ BigInteger k, BigInteger n)
+ {
+ if(k.dataLength == 1 && k.data[0] == 0) {
+ BigInteger[] result = new BigInteger[3];
+
+ result[0] = 0; result[1] = 2 % n; result[2] = 1 % n;
+ return result;
+ }
+
+ // calculate constant = b^(2k) / m
+ // for Barrett Reduction
+ BigInteger constant = new BigInteger();
+
+ int nLen = n.dataLength << 1;
+ constant.data[nLen] = 0x00000001;
+ constant.dataLength = nLen + 1;
+
+ constant = constant / n;
+
+ // calculate values of s and t
+ int s = 0;
+
+ for(int index = 0; index < k.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((k.data[index] & mask) != 0) {
+ index = k.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = k >> s;
+
+ //Console.WriteLine("s = " + s + " t = " + t);
+ return LucasSequenceHelper(P, Q, t, n, constant, s);
+ }
+
+ // Performs the calculation of the kth term in the Lucas Sequence.
+ // For details of the algorithm, see reference [9].
+ // k must be odd. i.e LSB == 1
+ private static BigInteger[] LucasSequenceHelper(BigInteger P, BigInteger Q,
+ BigInteger k, BigInteger n, BigInteger constant, int s)
+ {
+ BigInteger[] result = new BigInteger[3];
+
+ if((k.data[0] & 0x00000001) == 0)
+ throw (new ArgumentException("Argument k must be odd."));
+
+ int numbits = k.bitCount();
+ uint mask = (uint)0x1 << ((numbits & 0x1F) - 1);
+
+ // v = v0, v1 = v1, u1 = u1, Q_k = Q^0
+
+ BigInteger v = 2 % n, Q_k = 1 % n,
+ v1 = P % n, u1 = Q_k;
+ bool flag = true;
+
+ for(int i = k.dataLength - 1; i >= 0 ; i--) { // iterate on the binary expansion of k
+ //Console.WriteLine("round");
+ while(mask != 0) {
+ if(i == 0 && mask == 0x00000001) // last bit
+ break;
+
+ if((k.data[i] & mask) != 0) { // bit is set
+ // index doubling with addition
+
+ u1 = (u1 * v1) % n;
+
+ v = ((v * v1) - (P * Q_k)) % n;
+ v1 = n.BarrettReduction(v1 * v1, n, constant);
+ v1 = (v1 - ((Q_k * Q) << 1)) % n;
+
+ if(flag)
+ flag = false;
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+
+ Q_k = (Q_k * Q) % n;
+ }
+ else {
+ // index doubling
+ u1 = ((u1 * v) - Q_k) % n;
+
+ v1 = ((v * v1) - (P * Q_k)) % n;
+ v = n.BarrettReduction(v * v, n, constant);
+ v = (v - (Q_k << 1)) % n;
+
+ if(flag) {
+ Q_k = Q % n;
+ flag = false;
+ }
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+ }
+
+ mask >>= 1;
+ }
+ mask = 0x80000000;
+ }
+
+ // at this point u1 = u(n+1) and v = v(n)
+ // since the last bit always 1, we need to transform u1 to u(2n+1) and v to v(2n+1)
+
+ u1 = ((u1 * v) - Q_k) % n;
+ v = ((v * v1) - (P * Q_k)) % n;
+ if(flag)
+ flag = false;
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+
+ Q_k = (Q_k * Q) % n;
+
+
+ for (int i = 0; i < s; i++) {
+ // index doubling
+ u1 = (u1 * v) % n;
+ v = ((v * v) - (Q_k << 1)) % n;
+
+ if(flag) {
+ Q_k = Q % n;
+ flag = false;
+ }
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+ }
+
+ result[0] = u1;
+ result[1] = v;
+ result[2] = Q_k;
+
+ return result;
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Mono.Security.Cryptography/CryptoTools.cs b/mcs/class/corlib/Mono.Security.Cryptography/CryptoTools.cs
new file mode 100644
index 00000000000..0462bf4b27c
--- /dev/null
+++ b/mcs/class/corlib/Mono.Security.Cryptography/CryptoTools.cs
@@ -0,0 +1,107 @@
+//
+// System.Security.Cryptography.CryptoTools
+// Shared class for common cryptographic functionalities
+//
+// Authors:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+internal class KeyBuilder {
+
+ static private RandomNumberGenerator rng;
+
+ static KeyBuilder ()
+ {
+ rng = RandomNumberGenerator.Create ();
+ }
+
+ static public byte[] Key (int size)
+ {
+ byte[] key = new byte [size];
+ rng.GetBytes (key);
+ return key;
+ }
+
+ static public byte[] IV (int size)
+ {
+ byte[] iv = new byte [size];
+ rng.GetBytes (iv);
+ return iv;
+ }
+}
+
+// Process an array as a sequence of blocks
+internal class BlockProcessor {
+ private ICryptoTransform transform;
+ private byte[] block;
+ private int blockSize; // in bytes (not in bits)
+ private int blockCount;
+
+ public BlockProcessor (ICryptoTransform transform)
+ : this (transform, transform.InputBlockSize) {}
+
+ // some Transforms (like HashAlgorithm descendant) return 1 for
+ // block size (which isn't their real internal block size)
+ public BlockProcessor (ICryptoTransform transform, int blockSize)
+ {
+ this.transform = transform;
+ this.blockSize = blockSize;
+ block = new byte [blockSize];
+ }
+
+ ~BlockProcessor ()
+ {
+ // zeroize our block (so we don't retain any information)
+ Array.Clear (block, 0, blockSize);
+ }
+
+ public void Initialize ()
+ {
+ Array.Clear (block, 0, blockSize);
+ blockCount = 0;
+ }
+
+ public void Core (byte[] rgb)
+ {
+ Core (rgb, 0, rgb.Length);
+ }
+
+ public void Core (byte[] rgb, int ib, int cb)
+ {
+ // 1. fill the rest of the "block"
+ int n = Math.Min (blockSize - blockCount, cb);
+ Array.Copy (rgb, ib, block, blockCount, n);
+ blockCount += n;
+
+ // 2. if block is full then transform it
+ if (blockCount == blockSize) {
+ transform.TransformBlock (block, 0, blockSize, block, 0);
+
+ // 3. transform any other full block in specified buffer
+ int b = (int) ((cb - n) / blockSize);
+ for (int i=0; i < b; i++) {
+ transform.TransformBlock (rgb, n, blockSize, block, 0);
+ n += blockSize;
+ }
+
+ // 4. if data is still present fill the "block" with the remainder
+ blockCount = cb - n;
+ if (blockCount > 0)
+ Array.Copy (rgb, n, block, 0, blockCount);
+ }
+ }
+
+ public byte[] Final ()
+ {
+ return transform.TransformFinalBlock (block, 0, blockCount);
+ }
+}
+
+
+}
diff --git a/mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs b/mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs
new file mode 100644
index 00000000000..43bcff51a15
--- /dev/null
+++ b/mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs
@@ -0,0 +1,384 @@
+//
+// PKCS1.cs - Implements PKCS#1 primitives.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. PKCS#1: RSA Cryptography Standard
+// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
+
+internal class PKCS1 {
+
+ private static bool Compare (byte[] array1, byte[] array2)
+ {
+ bool result = (array1.Length == array2.Length);
+ if (result) {
+ for (int i=0; i < array1.Length; i++)
+ if (array1[i] != array2[i])
+ return false;
+ }
+ return result;
+ }
+
+ private static byte[] xor (byte[] array1, byte[] array2)
+ {
+ byte[] result = new byte [array1.Length];
+ for (int i=0; i < result.Length; i++)
+ result[i] = (byte) (array1[i] ^ array2[i]);
+ return result;
+ }
+
+ private static byte[] emptySHA1 = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09 };
+ private static byte[] emptySHA256 = { 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55 };
+ private static byte[] emptySHA384 = { 0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38, 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a, 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43, 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda, 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb, 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b };
+ private static byte[] emptySHA512 = { 0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd, 0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07, 0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc, 0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce, 0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0, 0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f, 0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81, 0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e };
+
+ private static byte[] GetEmptyHash (HashAlgorithm hash)
+ {
+ if (hash is SHA1)
+ return emptySHA1;
+ else if (hash is SHA256)
+ return emptySHA256;
+ else if (hash is SHA384)
+ return emptySHA384;
+ else if (hash is SHA512)
+ return emptySHA512;
+ else
+ return null;
+ }
+
+ // PKCS #1 v.2.1, Section 4.1
+ // I2OSP converts a nonnegative integer to an octet string of a specified length.
+ public static byte[] I2OSP (int x, int size)
+ {
+ byte[] array = BitConverter.GetBytes (x);
+ return I2OSP (array, size);
+ }
+
+ public static byte[] I2OSP (byte[] x, int size)
+ {
+ byte[] result = new byte [size];
+ Array.Copy (x, 0, result, (result.Length - x.Length), x.Length);
+ return result;
+ }
+
+ // PKCS #1 v.2.1, Section 4.2
+ // OS2IP converts an octet string to a nonnegative integer.
+ public static byte[] OS2IP (byte[] x)
+ {
+ int i = 0;
+ while ((x[i++] == 0x00) && (i < x.Length));
+ i--;
+ if (i > 0) {
+ byte[] result = new byte [x.Length - i];
+ Array.Copy (x, i, result, 0, result.Length);
+ return result;
+ }
+ else
+ return x;
+ }
+
+ // PKCS #1 v.2.1, Section 5.1.1
+ public static byte[] RSAEP (RSA rsa, byte[] m)
+ {
+ // c = m^e mod n
+ return rsa.EncryptValue (m);
+ }
+
+ // PKCS #1 v.2.1, Section 5.1.2
+ public static byte[] RSADP (RSA rsa, byte[] c)
+ {
+ // m = c^d mod n
+ // Decrypt value may apply CRT optimizations
+ return rsa.DecryptValue (c);
+ }
+
+ // PKCS #1 v.2.1, Section 5.2.1
+ public static byte[] RSASP1 (RSA rsa, byte[] m)
+ {
+ // first form: s = m^d mod n
+ // Decrypt value may apply CRT optimizations
+ return rsa.DecryptValue (m);
+ }
+
+ // PKCS #1 v.2.1, Section 5.2.2
+ public static byte[] RSAVP1 (RSA rsa, byte[] s)
+ {
+ // m = s^e mod n
+ return rsa.EncryptValue (s);
+ }
+
+ // PKCS #1 v.2.1, Section 7.1.1
+ // RSAES-OAEP-ENCRYPT ((n, e), M, L)
+ public static byte[] Encrypt_OAEP (RSA rsa, HashAlgorithm hash, RandomNumberGenerator rng, byte[] M)
+ {
+ int size = rsa.KeySize / 8;
+ int hLen = hash.HashSize / 8;
+ if (M.Length > size - 2 * hLen - 2)
+ throw new CryptographicException ("message too long");
+ // empty label L SHA1 hash
+ byte[] lHash = GetEmptyHash (hash);
+ int PSLength = (size - M.Length - 2 * hLen - 2);
+ // DB = lHash || PS || 0x01 || M
+ byte[] DB = new byte [lHash.Length + PSLength + 1 + M.Length];
+ Array.Copy (lHash, 0, DB, 0, lHash.Length);
+ DB [(lHash.Length + PSLength)] = 0x01;
+ Array.Copy (M, 0, DB, (DB.Length - M.Length), M.Length);
+
+ byte[] seed = new byte [hLen];
+ rng.GetBytes (seed);
+
+ byte[] dbMask = MGF1 (hash, seed, size - hLen - 1);
+ byte[] maskedDB = xor (DB, dbMask);
+ byte[] seedMask = MGF1 (hash, maskedDB, hLen);
+ byte[] maskedSeed = xor (seed, seedMask);
+ // EM = 0x00 || maskedSeed || maskedDB
+ byte[] EM = new byte [maskedSeed.Length + maskedDB.Length + 1];
+ Array.Copy (maskedSeed, 0, EM, 1, maskedSeed.Length);
+ Array.Copy (maskedDB, 0, EM, maskedSeed.Length + 1, maskedDB.Length);
+
+ byte[] m = OS2IP (EM);
+ byte[] c = RSAEP (rsa, m);
+ return I2OSP (c, size);
+ }
+
+ // PKCS #1 v.2.1, Section 7.1.2
+ // RSAES-OAEP-DECRYPT (K, C, L)
+ public static byte[] Decrypt_OAEP (RSA rsa, HashAlgorithm hash, byte[] C)
+ {
+ int size = rsa.KeySize / 8;
+ int hLen = hash.HashSize / 8;
+ if ((size < (2 * hLen + 2)) || (C.Length != size))
+ throw new CryptographicException ("decryption error");
+
+ byte[] c = OS2IP (C);
+ byte[] m = RSADP (rsa, c);
+ byte[] EM = I2OSP (m, size);
+
+ // split EM = Y || maskedSeed || maskedDB
+ byte[] maskedSeed = new byte [hLen];
+ Array.Copy (EM, 1, maskedSeed, 0, maskedSeed.Length);
+ byte[] maskedDB = new byte [size - hLen - 1];
+ Array.Copy (EM, (EM.Length - maskedDB.Length), maskedDB, 0, maskedDB.Length);
+
+ byte[] seedMask = MGF1 (hash, maskedDB, hLen);
+ byte[] seed = xor (maskedSeed, seedMask);
+ byte[] dbMask = MGF1 (hash, seed, size - hLen - 1);
+ byte[] DB = xor (maskedDB, dbMask);
+
+ byte[] lHash = GetEmptyHash (hash);
+ // split DB = lHash’ || PS || 0x01 || M
+ byte[] dbHash = new byte [lHash.Length];
+ Array.Copy (DB, 0, dbHash, 0, dbHash.Length);
+ bool h = Compare (lHash, dbHash);
+
+ // find separator 0x01
+ int nPos = lHash.Length;
+ while (DB[nPos] == 0)
+ nPos++;
+
+ int Msize = DB.Length - nPos - 1;
+ byte[] M = new byte [Msize];
+ Array.Copy (DB, (nPos + 1), M, 0, Msize);
+
+ // we could have returned EM[0] sooner but would be helping a timing attack
+ if ((EM[0] != 0) || (!h) || (DB[nPos] != 0x01))
+ return null;
+ return M;
+ }
+
+ // PKCS #1 v.2.1, Section 7.2.1
+ // RSAES-PKCS1-V1_5-ENCRYPT ((n, e), M)
+ public static byte[] Encrypt_v15 (RSA rsa, RandomNumberGenerator rng, byte[] M)
+ {
+ int size = rsa.KeySize / 8;
+ if (M.Length > size - 11)
+ throw new CryptographicException ("message too long");
+ int PSLength = Math.Max (8, (size - M.Length - 3));
+ byte[] PS = new byte [PSLength];
+ rng.GetNonZeroBytes (PS);
+ byte[] EM = new byte [size];
+ EM [1] = 0x02;
+ Array.Copy (PS, 0, EM, 2, PSLength);
+ Array.Copy (M, 0, EM, (size - M.Length), M.Length);
+
+ byte[] m = OS2IP (EM);
+ byte[] c = RSAEP (rsa, m);
+ byte[] C = I2OSP (c, size);
+ return C;
+ }
+
+ // PKCS #1 v.2.1, Section 7.2.2
+ // RSAES-PKCS1-V1_5-DECRYPT (K, C)
+ public static byte[] Decrypt_v15 (RSA rsa, byte[] C)
+ {
+ int size = rsa.KeySize / 8;
+ if ((size < 11) || (C.Length != size))
+ throw new CryptographicException ("decryption error");
+ byte[] c = OS2IP (C);
+ byte[] m = RSADP (rsa, c);
+ byte[] EM = I2OSP (m, size);
+
+ if ((EM [0] != 0x00) || (EM [1] != 0x02))
+ return null;
+
+ int mPos = 10;
+ // PS is a minimum of 8 bytes + 2 bytes for header
+ while ((EM [mPos] != 0x00) && (mPos < EM.Length))
+ mPos++;
+ if (EM [mPos] != 0x00)
+ return null;
+ mPos++;
+ byte[] M = new byte [EM.Length - mPos];
+ Array.Copy (EM, mPos, M, 0, M.Length);
+ return M;
+ }
+
+ // PKCS #1 v.2.1, Section 8.2.1
+ // RSASSA-PKCS1-V1_5-SIGN (K, M)
+ public static byte[] Sign_v15 (RSA rsa, string oid, byte[] hash)
+ {
+ int size = rsa.KeySize / 8;
+ byte[] EM = Encode_v15 (oid, hash, size);
+ byte[] m = OS2IP (EM);
+ byte[] s = RSASP1 (rsa, m);
+ byte[] S = I2OSP (s, size);
+ return S;
+ }
+
+ // PKCS #1 v.2.1, Section 8.2.2
+ // RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S)
+ public static bool Verify_v15 (RSA rsa, string oid, byte[] hash, byte[] signature)
+ {
+ int size = rsa.KeySize / 8;
+ byte[] s = OS2IP (signature);
+ byte[] m = RSAVP1 (rsa, signature);
+ byte[] EM2 = I2OSP (m, size);
+ byte[] EM = Encode_v15 (oid, hash, size);
+ return Compare(EM, EM2);
+ }
+
+ // Note: MD2 isn't supported in .NET framework
+ private static byte[] md2const = { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x02, 0x05, 0x00, 0x04, 0x10 };
+ private static byte[] md5const = { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 };
+ private static byte[] sha1const = { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 };
+ private static byte[] sha256const = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20 };
+ private static byte[] sha384const = { 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30 };
+ private static byte[] sha512const = { 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 };
+
+ // PKCS #1 v.2.1, Section 9.2
+ // EMSA-PKCS1-v1_5-Encode
+ public static byte[] Encode_v15 (string oid, byte[] hash, int emLength)
+ {
+ string e = "bad hash length for ";
+ byte[] t = null;
+ switch (oid) {
+ case "1.3.14.3.2.26":
+ // SHA1
+ if (hash.Length != 20)
+ throw new CryptographicException (e + oid);
+ t = new byte [35];
+ Array.Copy (sha1const, 0, t, 0, sha1const.Length);
+ break;
+ case "1.2.840.113549.2.2":
+ // MD2
+ if (hash.Length != 16)
+ throw new CryptographicException (e + oid);
+ t = new byte [34];
+ Array.Copy (md2const, 0, t, 0, md2const.Length);
+ break;
+ case "1.2.840.113549.2.5":
+ // MD5
+ if (hash.Length != 16)
+ throw new CryptographicException (e + oid);
+ t = new byte [34];
+ Array.Copy (md5const, 0, t, 0, md5const.Length);
+ break;
+ case "2.16.840.1.101.3.4.1":
+ // SHA256
+ if (hash.Length != 32)
+ throw new CryptographicException (e + oid);
+ t = new byte [51];
+ Array.Copy (sha256const, 0, t, 0, sha256const.Length);
+ break;
+ case "2.16.840.1.101.3.4.2":
+ // SHA384
+ if (hash.Length != 48)
+ throw new CryptographicException (e + oid);
+ t = new byte [67];
+ Array.Copy (sha384const, 0, t, 0, sha384const.Length);
+ break;
+ case "2.16.840.1.101.3.4.3":
+ // SHA512
+ if (hash.Length != 64)
+ throw new CryptographicException (e + oid);
+ t = new byte [83];
+ Array.Copy (sha512const, 0, t, 0, sha512const.Length);
+ break;
+ default:
+ return null;
+ }
+ Array.Copy (hash, 0, t, t.Length - hash.Length, hash.Length);
+
+ int PSLength = Math.Max (8, emLength - t.Length - 3);
+ // PS = PSLength of 0xff
+
+ // EM = 0x00 | 0x01 | PS | 0x00 | T
+ byte[] EM = new byte [PSLength + t.Length + 3];
+ EM [1] = 0x01;
+ for (int i=2; i < PSLength + 2; i++)
+ EM[i] = 0xff;
+ Array.Copy (t, 0, EM, PSLength + 3, t.Length);
+
+ return EM;
+ }
+
+ // PKCS #1 v.2.1, Section B.2.1
+ public static byte[] MGF1 (HashAlgorithm hash, byte[] mgfSeed, int maskLen)
+ {
+ // 1. If maskLen > 2^32 hLen, output “mask too long” and stop.
+ // easy - this is impossible by using a int (31bits) as parameter ;-)
+ // BUT with a signed int we do have to check for negative values!
+ if (maskLen < 0)
+ throw new OverflowException();
+
+ int mgfSeedLength = mgfSeed.Length;
+ int hLen = (hash.HashSize >> 3); // from bits to bytes
+ int iterations = (maskLen / hLen);
+ if (maskLen % hLen != 0)
+ iterations++;
+ // 2. Let T be the empty octet string.
+ byte[] T = new byte [iterations * hLen];
+
+ byte[] toBeHashed = new byte [mgfSeedLength + 4];
+ int pos = 0;
+ // 3. For counter from 0 to (maskLen / hLen) – 1, do the following:
+ for (int counter = 0; counter < iterations; counter++) {
+ // a. Convert counter to an octet string C of length 4 octets
+ byte[] C = I2OSP (counter, 4);
+
+ // b. Concatenate the hash of the seed mgfSeed and C to the octet string T:
+ // T = T || Hash (mgfSeed || C)
+ Array.Copy (mgfSeed, 0, toBeHashed, 0, mgfSeedLength);
+ Array.Copy (C, 0, toBeHashed, mgfSeedLength, 4);
+ byte[] output = hash.ComputeHash (toBeHashed);
+ Array.Copy (output, 0, T, pos, hLen);
+ pos += mgfSeedLength;
+ }
+
+ // 4. Output the leading maskLen octets of T as the octet string mask.
+ byte[] mask = new byte [maskLen];
+ Array.Copy (T, 0, mask, 0, maskLen);
+ return mask;
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Mono.Security/ASN1.cs b/mcs/class/corlib/Mono.Security/ASN1.cs
new file mode 100644
index 00000000000..abc9309cfe1
--- /dev/null
+++ b/mcs/class/corlib/Mono.Security/ASN1.cs
@@ -0,0 +1,234 @@
+//
+// ASN1.cs: Abstract Syntax Notation 1 - micro-parser and generator
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+
+namespace Mono.Security.ASN1 {
+
+// References:
+// a. ITU ASN.1 standards (free download)
+// http://www.itu.int/ITU-T/studygroups/com17/languages/
+
+internal class ASN1 {
+ protected byte m_nTag;
+ protected byte[] m_aValue;
+ protected ArrayList elist;
+
+ public ASN1 () : this (0x00, null) {}
+
+ public ASN1 (byte tag) : this (tag, null) {}
+
+ public ASN1 (byte tag, byte[] data)
+ {
+ m_nTag = tag;
+ m_aValue = data;
+ elist = new ArrayList ();
+ }
+
+ public ASN1 (byte[] data)
+ {
+ elist = new ArrayList ();
+ m_nTag = data [0];
+
+ int nLenLength = 0;
+ int nLength = data [1];
+
+ if (nLength > 0x80) {
+ // composed length
+ nLenLength = nLength - 0x80;
+ nLength = 0;
+ for (int i = 0; i < nLenLength; i++) {
+ nLength *= 256;
+ nLength += data [i + 2];
+ }
+ }
+
+ m_aValue = new byte [nLength];
+ Array.Copy (data, (2 + nLenLength), m_aValue, 0, nLength);
+
+ int nStart = 0;
+ Decode (data, ref nStart, data.Length);
+ }
+
+ public int Count {
+ get { return elist.Count; }
+ }
+
+ public byte Tag {
+ get { return m_nTag; }
+ }
+
+ public int Length {
+ get {
+ if (m_aValue != null)
+ return m_aValue.Length;
+ else
+ return 0;
+ }
+ }
+
+ public byte[] Value {
+ get { return (byte[]) m_aValue.Clone (); }
+ set {
+ if (value != null)
+ m_aValue = (byte[]) value.Clone ();
+ }
+ }
+
+ public bool CompareValue (byte[] aValue)
+ {
+ bool bResult = (m_aValue.Length == aValue.Length);
+ if (bResult) {
+ for (int i = 0; i < m_aValue.Length; i++) {
+ if (m_aValue[i] != aValue[i])
+ return false;
+ }
+ }
+ return bResult;
+ }
+
+ public virtual void Add (ASN1 asn1)
+ {
+ if (asn1 != null)
+ elist.Add (asn1);
+ }
+
+ public virtual byte[] GetBytes ()
+ {
+ byte[] val = null;
+ if (m_aValue != null) {
+ val = m_aValue;
+ }
+ else if (elist.Count > 0) {
+ int esize = 0;
+ ArrayList al = new ArrayList ();
+ foreach (ASN1 a in elist) {
+ byte[] item = a.GetBytes ();
+ al.Add (item);
+ esize += item.Length;
+ }
+ val = new byte [esize];
+ int pos = 0;
+ for (int i=0; i < elist.Count; i++) {
+ byte[] item = (byte[]) al[i];
+ Array.Copy (item, 0, val, pos, item.Length);
+ pos += item.Length;
+ }
+ }
+
+ byte[] der;
+ int nLengthLen = 0;
+
+ if (val != null) {
+ int nLength = val.Length;
+ // special for length > 127
+ if (nLength > 127) {
+ if (nLength < 256) {
+ der = new byte [3 + nLength];
+ Array.Copy (val, 0, der, 3, nLength);
+ nLengthLen += 0x81;
+ der[2] = (byte)(nLength);
+ }
+ else {
+ der = new byte [4 + nLength];
+ Array.Copy (val, 0, der, 4, nLength);
+ nLengthLen += 0x82;
+ der[2] = (byte)(nLength / 256);
+ der[3] = (byte)(nLength % 256);
+ }
+ }
+ else {
+ der = new byte [2 + nLength];
+ Array.Copy (val, 0, der, 2, nLength);
+ nLengthLen = nLength;
+ }
+ }
+ else
+ der = new byte[2];
+
+ der[0] = m_nTag;
+ der[1] = (byte)nLengthLen;
+
+ return der;
+ }
+
+ // Note: Recursive
+ protected void Decode (byte[] asn1, ref int anPos, int anLength)
+ {
+ byte nTag;
+ int nLength;
+ byte[] aValue;
+
+ // minimum is 2 bytes (tag + length of 0)
+ while (anPos < anLength - 1) {
+ int nPosOri = anPos;
+ DecodeTLV (asn1, ref anPos, out nTag, out nLength, out aValue);
+
+ ASN1 elm = new ASN1 (nTag, aValue);
+ elist.Add (elm);
+
+ if ((nTag & 0x20) == 0x20) {
+ int nConstructedPos = anPos;
+ elm.Decode (asn1, ref nConstructedPos, nConstructedPos + nLength);
+ }
+ anPos += nLength; // value length
+ }
+ }
+
+ // TLV : Tag - Length - Value
+ protected void DecodeTLV (byte[] asn1, ref int anPos, out byte anTag, out int anLength, out byte[] aValue)
+ {
+ anTag = asn1 [anPos++];
+ anLength = asn1 [anPos++];
+
+ // special case where L contains the Length of the Length + 0x80
+ if ((anLength & 0x80) == 0x80) {
+ int nLengthLen = anLength & 0x7F;
+ anLength = 0;
+ for (int i = 0; i < nLengthLen; i++) {
+ anLength = anLength * 256 + asn1 [anPos++];
+ }
+ }
+
+ aValue = new byte [anLength];
+ Array.Copy (asn1, anPos, aValue, 0, anLength);
+ }
+
+ public ASN1 Element (int index)
+ {
+ try {
+ return (ASN1) elist [index];
+ }
+ catch {
+ return null;
+ }
+ }
+
+ public ASN1 Element (int anIndex, byte anTag)
+ {
+ try {
+ ASN1 elm = (ASN1) elist [anIndex];
+ if (elm.Tag == anTag)
+ return elm;
+ else
+ return null;
+ }
+ catch {
+ return null;
+ }
+ }
+}
+
+internal class OID : ASN1 {
+ public OID (string oid) : base (CryptoConfig.EncodeOID (oid)) {}
+}
+
+}
diff --git a/mcs/class/corlib/Mono.Xml/MiniParser.cs b/mcs/class/corlib/Mono.Xml/MiniParser.cs
new file mode 100644
index 00000000000..31c56113f6d
--- /dev/null
+++ b/mcs/class/corlib/Mono.Xml/MiniParser.cs
@@ -0,0 +1,624 @@
+//
+// System.Security.Cryptography.MiniParser: Internal XML parser implementation
+//
+// Authors:
+// Sergey Chaban
+//
+
+/*
+ * Copyright (c) 2001, 2002 Wild West Software
+ * Copyright (c) 2002 Sergey Chaban
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Security.Cryptography {
+
+internal class MiniParser {
+
+ public interface IReader {
+ int Read();
+ }
+
+ public interface IAttrList {
+ int Length {get;}
+ bool IsEmpty {get;}
+ string GetName(int i);
+ string GetValue(int i);
+ string GetValue(string name);
+ void ChangeValue(string name, string newValue);
+ string[] Names {get;}
+ string[] Values {get;}
+ }
+
+ public interface IMutableAttrList : IAttrList {
+ void Clear();
+ void Add(string name, string value);
+ void CopyFrom(IAttrList attrs);
+ void Remove(int i);
+ void Remove(string name);
+ }
+
+ public interface IHandler {
+ void OnStartParsing(MiniParser parser);
+ void OnStartElement(string name, IAttrList attrs);
+ void OnEndElement(string name);
+ void OnChars(string ch);
+ void OnEndParsing(MiniParser parser);
+ }
+
+ public class HandlerAdapter : IHandler {
+ public HandlerAdapter() {}
+ public void OnStartParsing(MiniParser parser) {}
+ public void OnStartElement(string name, IAttrList attrs) {}
+ public void OnEndElement(string name) {}
+ public void OnChars(string ch) {}
+ public void OnEndParsing(MiniParser parser) {}
+ }
+
+ private enum CharKind : byte {
+ LEFT_BR = 0,
+ RIGHT_BR = 1,
+ SLASH = 2,
+ PI_MARK = 3,
+ EQ = 4,
+ AMP = 5,
+ SQUOTE = 6,
+ DQUOTE = 7,
+ BANG = 8,
+ LEFT_SQBR = 9,
+ SPACE = 0xA,
+ RIGHT_SQBR = 0xB,
+ TAB = 0xC,
+ CR = 0xD,
+ EOL = 0xE,
+ CHARS = 0xF,
+ UNKNOWN = 0x1F
+ }
+
+ private enum ActionCode : byte {
+ START_ELEM = 0,
+ END_ELEM = 1,
+ END_NAME = 2,
+ SET_ATTR_NAME = 3,
+ SET_ATTR_VAL = 4,
+ SEND_CHARS = 5,
+ START_CDATA = 6,
+ END_CDATA = 7,
+ ERROR = 8,
+ STATE_CHANGE = 9,
+ FLUSH_CHARS_STATE_CHANGE = 0xA,
+ ACC_CHARS_STATE_CHANGE = 0xB,
+ ACC_CDATA = 0xC,
+ PROC_CHAR_REF = 0xD,
+ UNKNOWN = 0xF
+ }
+
+ public class AttrListImpl : IMutableAttrList {
+ protected ArrayList names;
+ protected ArrayList values;
+
+ public AttrListImpl() : this(0) {}
+
+ public AttrListImpl(int initialCapacity) {
+ if (initialCapacity <= 0) {
+ names = new ArrayList();
+ values = new ArrayList();
+ } else {
+ names = new ArrayList(initialCapacity);
+ values = new ArrayList(initialCapacity);
+ }
+ }
+
+ public AttrListImpl(IAttrList attrs)
+ : this(attrs != null ? attrs.Length : 0) {
+ if (attrs != null) this.CopyFrom(attrs);
+ }
+
+ public int Length {
+ get {return names.Count;}
+ }
+
+ public bool IsEmpty {
+ get {return this.Length != 0;}
+ }
+
+ public string GetName(int i) {
+ string res = null;
+ if (i >= 0 && i < this.Length) {
+ res = names[i] as string;
+ }
+ return res;
+ }
+
+ public string GetValue(int i) {
+ string res = null;
+ if (i >= 0 && i < this.Length) {
+ res = values[i] as string;
+ }
+ return res;
+ }
+
+ public string GetValue(string name) {
+ return this.GetValue(names.IndexOf(name));
+ }
+
+ public void ChangeValue(string name, string newValue) {
+ int i = names.IndexOf(name);
+ if (i >= 0 && i < this.Length) {
+ values[i] = newValue;
+ }
+ }
+
+ public string[] Names {
+ get {return names.ToArray(typeof(string)) as string[];}
+ }
+
+ public string[] Values {
+ get {return values.ToArray(typeof(string)) as string[];}
+ }
+
+ public void Clear() {
+ names.Clear();
+ values.Clear();
+ }
+
+ public void Add(string name, string value) {
+ names.Add(name);
+ values.Add(value);
+ }
+
+ public void Remove(int i) {
+ if (i >= 0) {
+ names.RemoveAt(i);
+ values.RemoveAt(i);
+ }
+ }
+
+ public void Remove(string name) {
+ this.Remove(names.IndexOf(name));
+ }
+
+ public void CopyFrom(IAttrList attrs) {
+ if (attrs != null && ((object)this == (object)attrs)) {
+ this.Clear();
+ int n = attrs.Length;
+ for (int i = 0; i < n; i++) {
+ this.Add(attrs.GetName(i), attrs.GetValue(i));
+ }
+ }
+ }
+ }
+
+ public class XMLError : Exception {
+ protected string descr;
+ protected int line, column;
+ public XMLError() : this("Unknown") {}
+ public XMLError(string descr) : this(descr, -1, -1) {}
+ public XMLError(string descr, int line, int column)
+ : base(descr) {
+ this.descr = descr;
+ this.line = line;
+ this.column = column;
+ }
+ public int Line {get {return line;}}
+ public int Column {get {return column;}}
+ public override string ToString() {
+ return (String.Format("{0} @ (line = {1}, col = {2})", descr, line, column));
+ }
+ }
+
+ private static readonly int INPUT_RANGE = 13;
+ private static readonly ushort[] tbl = {
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 1), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 128),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 2), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 133), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 16), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.FLUSH_CHARS_STATE_CHANGE << 8) | 4),
+ (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.END_ELEM << 8) | 0), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 2), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 2), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 5), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 4), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.END_NAME << 8) | 6), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.END_NAME << 8) | 7), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.END_NAME << 8) | 8), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3),
+ (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.FLUSH_CHARS_STATE_CHANGE << 8) | 1), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 10), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 7), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 9), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.START_ELEM << 8) | 6), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.START_ELEM << 8) | 7), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 8), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 9), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.SET_ATTR_NAME << 8) | 11), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 12), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 13), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 10), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10),
+ (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 11), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 132),
+ (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.SET_ATTR_NAME << 8) | 11), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 12), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 130),
+ (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.SEND_CHARS << 8) | 2), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 16), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 134),
+ (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.SET_ATTR_VAL << 8) | 17), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 14), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14),
+ (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.SET_ATTR_VAL << 8) | 17), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 15), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15),
+ (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.START_CDATA << 8) | 18), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19),
+ (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.START_ELEM << 8) | 6), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.START_ELEM << 8) | 7), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 17), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 9), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.END_CDATA << 8) | 10), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.UNKNOWN << 8) | 255),
+ 0xFFFF
+ };
+
+ protected static string[] errors = {
+ /* 0 */ "Expected element",
+ /* 1 */ "Invalid character in tag",
+ /* 2 */ "No '='",
+ /* 3 */ "Invalid character entity",
+ /* 4 */ "Invalid attr value",
+ /* 5 */ "Empty tag",
+ /* 6 */ "No end tag",
+ /* 7 */ "Bad entity ref"
+ };
+
+ protected int line;
+ protected int col;
+ protected int[] twoCharBuff;
+ protected bool splitCData;
+
+ public MiniParser() {
+ twoCharBuff = new int[2];
+ splitCData = false;
+ Reset();
+ }
+
+ public void Reset() {
+ line = 0;
+ col = 0;
+ }
+
+ protected static bool StrEquals(string str, StringBuilder sb, int sbStart, int len) {
+ if (len != str.Length) return false;
+ for (int i = 0; i < len; i++) {
+ if (str[i] != sb[sbStart + i]) return false;
+ }
+ return true;
+ }
+
+ protected void FatalErr(string descr) {
+ throw new XMLError(descr, this.line, this.col);
+ }
+
+ protected static int Xlat(int charCode, int state) {
+ int p = state * INPUT_RANGE;
+ int n = Math.Min(tbl.Length - p, INPUT_RANGE);
+ for (;--n >= 0;) {
+ ushort code = tbl[p];
+ if (charCode == (code >> 12)) return (code & 0xFFF);
+ p++;
+ }
+ return 0xFFF;
+ }
+
+ public void Parse(IReader reader, IHandler handler) {
+ if (reader == null) throw new ArgumentNullException("reader");
+ if (handler == null) handler = new HandlerAdapter();
+
+ AttrListImpl attrList = new AttrListImpl();
+ string lastAttrName = null;
+ Stack tagStack = new Stack();
+ string elementName = null;
+ line = 1;
+ col = 0;
+ int currCh = 0;
+ int stateCode = 0;
+ StringBuilder sbChars = new StringBuilder();
+ bool seenCData = false;
+ bool isComment = false;
+ bool isDTD = false;
+ int bracketSwitch = 0;
+
+ handler.OnStartParsing(this);
+
+ while (true) {
+ ++this.col;
+ int prevCh = currCh;
+
+ currCh = reader.Read();
+
+ if (currCh == -1) {
+ if (stateCode != 0) {
+ FatalErr("Unexpected EOF");
+ }
+ break;
+ }
+
+ int charCode = "<>/?=&'\"![ ]\t\r\n".IndexOf((char)currCh) & 0xF;
+ if (charCode == (int)CharKind.CR) continue; // ignore
+ // whitepace ::= (#x20 | #x9 | #xd | #xa)+
+ if (charCode == (int)CharKind.TAB) charCode = (int)CharKind.SPACE; // tab == space
+ if (charCode == (int)CharKind.EOL) {
+ this.col = 0;
+ this.line++;
+ charCode = (int)CharKind.SPACE;
+ }
+
+ int actionCode = MiniParser.Xlat(charCode, stateCode);
+ stateCode = actionCode & 0xFF;
+ // Ignore newline inside attribute value.
+ if (currCh == '\n' && (stateCode == 0xE || stateCode == 0xF)) continue;
+ actionCode >>= 8;
+
+ if (stateCode >= 0x80) {
+ if (stateCode == 0xFF) {
+ FatalErr("State dispatch error.");
+ } else {
+ FatalErr(errors[stateCode ^ 0x80]);
+ }
+ }
+
+ switch (actionCode) {
+ case (int)ActionCode.START_ELEM:
+ handler.OnStartElement(elementName, attrList);
+ if (currCh != '/') {
+ tagStack.Push(elementName);
+ } else {
+ handler.OnEndElement(elementName);
+ }
+ attrList.Clear();
+ break;
+
+ case (int)ActionCode.END_ELEM:
+ elementName = sbChars.ToString();
+ sbChars = new StringBuilder();
+ string endName = null;
+ if (tagStack.Count == 0 ||
+ elementName != (endName = tagStack.Pop() as string)) {
+ if (endName == null) {
+ FatalErr("Tag stack underflow");
+ } else {
+ FatalErr(String.Format("Expected end tag '{0}' but found '{1}'", elementName, endName));
+ }
+ }
+ handler.OnEndElement(elementName);
+ break;
+
+ case (int)ActionCode.END_NAME:
+ elementName = sbChars.ToString();
+ sbChars = new StringBuilder();
+ if (currCh != '/' && currCh != '>') break;
+ goto case (int)ActionCode.START_ELEM;
+
+ case (int)ActionCode.SET_ATTR_NAME:
+ lastAttrName = sbChars.ToString();
+ sbChars = new StringBuilder();
+ break;
+
+ case (int)ActionCode.SET_ATTR_VAL:
+ if (lastAttrName == null) FatalErr("Internal error.");
+ attrList.Add(lastAttrName, sbChars.ToString());
+ sbChars = new StringBuilder();
+ lastAttrName = null;
+ break;
+
+ case (int)ActionCode.SEND_CHARS:
+ handler.OnChars(sbChars.ToString());
+ sbChars = new StringBuilder();
+ break;
+
+ case (int)ActionCode.START_CDATA:
+ string cdata = "CDATA[";
+ isComment = false;
+ isDTD = false;
+
+ if (currCh == '-') {
+ currCh = reader.Read();
+
+ if (currCh != '-') FatalErr("Invalid comment");
+
+ this.col++;
+ isComment = true;
+ twoCharBuff[0] = -1;
+ twoCharBuff[1] = -1;
+ } else {
+ if (currCh != '[') {
+ isDTD = true;
+ bracketSwitch = 0;
+ break;
+ }
+
+ for (int i = 0; i < cdata.Length; i++) {
+ if (reader.Read() != cdata[i]) {
+ this.col += i+1;
+ break;
+ }
+ }
+ this.col += cdata.Length;
+ seenCData = true;
+ }
+ break;
+
+ case (int)ActionCode.END_CDATA:
+ int n = 0;
+ currCh = ']';
+
+ while (currCh == ']') {
+ currCh = reader.Read();
+ n++;
+ }
+
+ if (currCh != '>') {
+ for (int i = 0; i < n; i++) sbChars.Append(']');
+ sbChars.Append((char)currCh);
+ stateCode = 0x12;
+ } else {
+ for (int i = 0; i < n-2; i++) sbChars.Append(']');
+ seenCData = false;
+ }
+
+ this.col += n;
+ break;
+
+ case (int)ActionCode.ERROR:
+ FatalErr(String.Format("Error {0}", stateCode));
+ break;
+
+ case (int)ActionCode.STATE_CHANGE:
+ break;
+
+ case (int)ActionCode.FLUSH_CHARS_STATE_CHANGE:
+ sbChars = new StringBuilder();
+ if (currCh != '<') goto case (int)ActionCode.ACC_CHARS_STATE_CHANGE;
+ break;
+
+ case (int)ActionCode.ACC_CHARS_STATE_CHANGE:
+ sbChars.Append((char)currCh);
+ break;
+
+ case (int)ActionCode.ACC_CDATA:
+ if (isComment) {
+ if (currCh == '>'
+ && twoCharBuff[0] == '-'
+ && twoCharBuff[1] == '-') {
+ isComment = false;
+ stateCode = 0;
+ } else {
+ twoCharBuff[0] = twoCharBuff[1];
+ twoCharBuff[1] = currCh;
+ }
+ } else if (isDTD) {
+ if (currCh == '<' || currCh == '>') bracketSwitch ^= 1;
+ if (currCh == '>' && bracketSwitch != 0) {
+ isDTD = false;
+ stateCode = 0;
+ }
+ } else {
+ if (this.splitCData
+ && sbChars.Length > 0
+ && seenCData) {
+ handler.OnChars(sbChars.ToString());
+ sbChars = new StringBuilder();
+ }
+ seenCData = false;
+ sbChars.Append((char)currCh);
+ }
+ break;
+
+ case (int)ActionCode.PROC_CHAR_REF:
+ currCh = reader.Read();
+ int cl = this.col + 1;
+ if (currCh == '#') { // character reference
+ int r = 10;
+ int chCode = 0;
+ int nDigits = 0;
+ currCh = reader.Read();
+ cl++;
+
+ if (currCh == 'x') {
+ currCh = reader.Read();
+ cl++;
+ r=16;
+ }
+
+ NumberStyles style = r == 16 ? NumberStyles.HexNumber : NumberStyles.Integer;
+
+ while (true) {
+ int x = -1;
+ if (Char.IsNumber((char)currCh) || "abcdef".IndexOf(Char.ToLower((char)currCh)) != -1) {
+ try {
+ x = Int32.Parse(new string((char)currCh, 1), style);
+ } catch (FormatException) {x = -1;}
+ }
+ if (x == -1) break;
+ chCode *= r;
+ chCode += x;
+ nDigits++;
+ currCh = reader.Read();
+ cl++;
+ }
+
+ if (currCh == ';' && nDigits > 0) {
+ sbChars.Append((char)chCode);
+ } else {
+ FatalErr("Bad char ref");
+ }
+ } else {
+ // entity reference
+ string entityRefChars = "aglmopqstu"; // amp | apos | quot | gt | lt
+ string entities = "&'\"><";
+
+ int pos = 0;
+ int entIdx = 0xF;
+ int pred = 0;
+ int predShift = 0;
+
+ int sbLen = sbChars.Length;
+
+ while (true) {
+ if (pos != 0xF) pos = entityRefChars.IndexOf((char)currCh) & 0xF;
+ if (pos == 0xF) FatalErr(errors[7]);
+ sbChars.Append((char)currCh);
+
+ int path = "\uFF35\u3F8F\u4F8F\u0F5F\uFF78\uE1F4\u2299\uEEFF\uEEFF\uFF4F"[pos];
+ int lBr = (path >> 4) & 0xF;
+ int rBr = path & 0xF;
+ int lPred = path >> 12;
+ int rPred = (path >> 8) & 0xF;
+ currCh = reader.Read();
+ cl++;
+ pos = 0xF;
+ if (lBr != 0xF && currCh == entityRefChars[lBr]) {
+ if (lPred < 0xE) entIdx = lPred;
+ pred = lPred;
+ predShift = 12; // left
+ } else if (rBr != 0xF && currCh == entityRefChars[rBr]) {
+ if (rPred < 0xE) entIdx = rPred;
+ pred = rPred;
+ predShift = 8; // right
+ } else if (currCh == ';') {
+ if (entIdx != 0xF
+ && predShift != 0
+ && ((path >> predShift) & 0xF) == 0xE) break;
+ continue; // pos == 0xF
+ }
+
+ pos=0;
+
+ }
+
+ int l = cl - this.col - 1;
+
+ if ((l > 0 && l < 5)
+ &&(StrEquals("amp", sbChars, sbLen, l)
+ || StrEquals("apos", sbChars, sbLen, l)
+ || StrEquals("quot", sbChars, sbLen, l)
+ || StrEquals("lt", sbChars, sbLen, l)
+ || StrEquals("gt", sbChars, sbLen, l))
+ ) {
+ sbChars.Length = sbLen;
+ sbChars.Append(entities[entIdx]);
+ } else FatalErr(errors[7]);
+ }
+
+ this.col = cl;
+ break;
+
+ default:
+ FatalErr(String.Format("Unexpected action code - {0}.", actionCode));
+ break;
+ }
+ } // while (true)
+
+ handler.OnEndParsing(this);
+
+ } // Parse
+
+}
+
+}
diff --git a/mcs/class/corlib/Mono/ChangeLog b/mcs/class/corlib/Mono/ChangeLog
new file mode 100644
index 00000000000..529e5929de4
--- /dev/null
+++ b/mcs/class/corlib/Mono/ChangeLog
@@ -0,0 +1,4 @@
+2002-10-08 Miguel de Icaza <miguel@ximian.com>
+
+ * Runtime.cs: New file.
+
diff --git a/mcs/class/corlib/Mono/Runtime.cs b/mcs/class/corlib/Mono/Runtime.cs
new file mode 100644
index 00000000000..7ec3aa93a86
--- /dev/null
+++ b/mcs/class/corlib/Mono/Runtime.cs
@@ -0,0 +1,23 @@
+//
+// Mono Runtime gateway functions
+//
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+
+ public class Runtime
+ {
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private static extern void mono_runtime_install_handlers ();
+
+ static public void InstallSignalHandlers ()
+ {
+ mono_runtime_install_handlers ();
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Collections/ArrayList.cs b/mcs/class/corlib/System.Collections/ArrayList.cs
new file mode 100644
index 00000000000..50337026964
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ArrayList.cs
@@ -0,0 +1,1205 @@
+//
+// System.Collections.ArrayList
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+// Duncan Mak (duncan@ximian.com)
+// Patrik Torstensson (totte@crepundia.net)
+//
+// (C) 2001 Vladimir Vukicevic
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+
+namespace System.Collections {
+
+ [MonoTODO ("add versioning, changing the arraylist should invalidate all enumerators")]
+ [Serializable]
+ public class ArrayList : IList, ICollection, IEnumerable, ICloneable {
+
+ // Keep these three fields in sync with mono-reflection.h.
+ private int count = 0;
+ private int capacity = defaultCapacity;
+ private object[] dataArray;
+
+ // constructors
+ public ArrayList () {
+ dataArray = new object[capacity];
+ }
+
+ public ArrayList (ICollection c) {
+ if (null == c)
+ throw new ArgumentNullException();
+
+ //Emulate MS.NET behavior. Throw RankException when passed a
+ // multi-dimensional Array.
+ Array arr = c as Array;
+ if (null != arr && arr.Rank > 1)
+ throw new RankException ();
+
+ this.capacity = (c.Count == 0) ? defaultCapacity : c.Count;
+ dataArray = new object [capacity];
+ foreach (object o in c)
+ Add (o);
+ }
+
+ public ArrayList (int capacity) {
+ if (capacity < 0)
+ throw new ArgumentOutOfRangeException ("capacity", capacity, "Value must be greater than or equal to zero.");
+
+ if (capacity > 0)
+ this.capacity = capacity;
+ // else if capacity == 0 then use defaultCapacity
+
+ dataArray = new object[this.capacity];
+ }
+
+ private ArrayList (object[] dataArray, int count, int capacity,
+ bool fixedSize, bool readOnly, bool synchronized) {
+ this.dataArray = new object [capacity];
+ dataArray.CopyTo (this.dataArray, 0);
+ this.count = count;
+ this.capacity = capacity;
+ this.fixedSize = fixedSize;
+ this.readOnly = readOnly;
+ this.synchronized = synchronized;
+ }
+
+ public static ArrayList ReadOnly (ArrayList list) {
+ if (list == null)
+ throw new ArgumentNullException ();
+
+ if (list.IsSynchronized)
+ return ArrayList.Synchronized (list);
+ else
+ return new ArrayList (list.ToArray (), list.Count, list.Capacity, list.IsFixedSize, true, list.IsSynchronized);
+ }
+
+ public static IList ReadOnly (IList list) {
+ if (list == null)
+ throw new ArgumentNullException ();
+
+ ArrayList al = new ArrayList ();
+
+ foreach (object o in list)
+ al.Add (o);
+
+ return (IList) ArrayList.ReadOnly (al);
+ }
+
+ public static ArrayList Synchronized (ArrayList list) {
+ if (list == null)
+ throw new ArgumentNullException ();
+
+ return new SyncArrayList(new ArrayList (list.ToArray (), list.Count, list.Capacity, list.IsFixedSize, list.IsReadOnly, true));
+ }
+
+ public static IList Synchronized (IList list) {
+ if (list == null)
+ throw new ArgumentNullException ();
+
+ ArrayList al = new ArrayList ();
+
+ foreach (object o in list)
+ al.Add (o);
+
+ return (IList) ArrayList.Synchronized (al);
+ }
+
+ public static ArrayList FixedSize (ArrayList list) {
+ if (list == null)
+ throw new ArgumentNullException ();
+
+ if (list.IsSynchronized)
+ return Synchronized(list);
+
+ return new ArrayList (list.ToArray (), list.Count, list.Capacity, true, list.IsReadOnly, list.IsSynchronized);
+ }
+
+ public static IList FixedSize (IList list) {
+ if (list == null)
+ throw new ArgumentNullException ();
+
+ if (list.IsSynchronized)
+ return Synchronized(list);
+
+ ArrayList al = new ArrayList ();
+
+ foreach (object o in list)
+ al.Add (o);
+
+ return (IList) ArrayList.FixedSize (al);
+ }
+
+ public static ArrayList Repeat (object value, int count) {
+ ArrayList al = new ArrayList (count);
+ for (int i = 0; i < count; i++) {
+ al.dataArray[i] = value;
+ }
+ al.count = count;
+
+ return al;
+ }
+
+ [Serializable]
+ private class ListWrapper : ArrayList {
+ IList list;
+
+ public ListWrapper (IList list) {
+ if (null == list)
+ throw new ArgumentNullException();
+
+ this.list = list;
+ count = ((ICollection) list).Count;
+ }
+
+ // ArrayList
+ [MonoTODO]
+ public override int Capacity {
+ get { return list.Count; }
+ set { throw new NotSupportedException (); }
+ }
+
+ [MonoTODO]
+ public override void AddRange (ICollection collection) {
+ if (collection == null)
+ throw new ArgumentNullException ("colllection");
+ if (IsFixedSize || IsReadOnly)
+ throw new NotSupportedException ();
+ }
+
+ [MonoTODO]
+ public override int BinarySearch (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int BinarySearch (object value, IComparer comparer) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int BinarySearch (int index, int count, object value,
+ IComparer comparer) {
+ throw new NotImplementedException ();
+ }
+
+ public override void CopyTo (Array array) {
+ if (null == array)
+ throw new ArgumentNullException("array");
+ if (array.Rank > 1)
+ throw new ArgumentException("array cannot be multidimensional");
+
+ CopyTo (array, 0);
+ }
+
+ [MonoTODO]
+ public override void CopyTo (int index, Array array,
+ int arrayIndex, int count) {
+ if (array == null)
+ throw new ArgumentNullException ();
+ if (index < 0 || arrayIndex < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+ if (array.Rank > 1 || index >= Count || Count > (array.Length - arrayIndex))
+ throw new ArgumentException ();
+ // FIXME: handle casting error here
+ }
+
+ public override ArrayList GetRange (int index, int count) {
+ if (index < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+ if (Count < (index + count))
+ throw new ArgumentException ();
+
+ ArrayList result = new ArrayList (count);
+
+ for (int i = 0; i < count; i++)
+ result.Add (list [i]);
+
+ return result;
+ }
+
+ [MonoTODO]
+ public override void InsertRange (int index, ICollection col) {
+ if (col == null)
+ throw new ArgumentNullException ();
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ();
+ if (IsReadOnly || IsFixedSize)
+ throw new NotSupportedException ();
+
+ if (index == Count) {
+ foreach (object element in col)
+ list.Add (element);
+
+ } //else if ((index + count) < Count) {
+ // for (int i = index; i < (index + count); i++)
+ // list [i] = col [i];
+
+ // } else {
+ // int added = Count - (index + count);
+ // for (int i = index; i < Count; i++)
+ // list [i] = col [i];
+ // for (int i = 0; i < added; i++)
+ // list.Add (col [Count +i]);
+ // }
+ }
+
+ public override int LastIndexOf (object value) {
+ return LastIndexOf (value, Count, 0);
+ }
+
+ public override int LastIndexOf (object value, int startIndex) {
+ return LastIndexOf (value, startIndex, 0);
+ }
+
+ public override int LastIndexOf (object value, int startIndex, int count) {
+ if (null == value){
+ return -1;
+ }
+
+ if (startIndex > Count || count < 0 || (startIndex + count > Count))
+ throw new ArgumentOutOfRangeException ();
+
+ int length = startIndex - count + 1;
+
+ for (int i = startIndex; i >= length; i--)
+ if (list [i] == value)
+ return i;
+ return -1;
+ }
+
+ public override void RemoveRange (int index, int count) {
+ if ((index < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+ if ((index > Count) || (index + count) > Count)
+ throw new ArgumentException ();
+ if (IsReadOnly || IsFixedSize)
+ throw new NotSupportedException ();
+
+ for (int i = 0; i < count; i++)
+ list.RemoveAt (index);
+ }
+
+ public override void Reverse () {
+ Reverse (0, Count);
+ }
+
+ public override void Reverse (int index, int count) {
+ if ((index < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+ if ((index > Count) || (index + count) > Count)
+ throw new ArgumentException ();
+ if (IsReadOnly)
+ throw new NotSupportedException ();
+
+ object tmp = null;
+
+ for (int i = index; i < count; i++) {
+ tmp = list [i];
+ list [i] = list [count - i];
+ list [count - i] = tmp;
+ }
+ }
+
+ public override void SetRange (int index, ICollection col) {
+ if (index < 0 || (index + col.Count) > Count)
+ throw new ArgumentOutOfRangeException ();
+ if (col == null)
+ throw new ArgumentNullException ();
+ if (IsReadOnly)
+ throw new NotSupportedException ();
+
+ for (int i = index; i < col.Count; i++)
+ foreach (object o in col)
+ list [i] = o;
+ }
+
+ [MonoTODO]
+ public override void Sort () {
+ }
+
+ [MonoTODO]
+ public override void Sort (IComparer comparer) {
+ }
+
+ [MonoTODO]
+ public override void Sort (int index, int count, IComparer comparer) {
+ }
+
+ public override object [] ToArray () {
+ return (object []) ToArray (typeof (object));
+ }
+
+ public override Array ToArray (Type type) {
+ int count = Count;
+ Array result = Array.CreateInstance (type, count);
+
+ for (int i = 0; i < count; i++)
+ result.SetValue (list [i], i);
+
+ return result;
+ }
+
+ [MonoTODO]
+ public override void TrimToSize () {
+ }
+
+ // IList
+ public override bool IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ public override bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public override object this [int index] {
+ get { return list [index]; }
+ set { list [index] = value; }
+ }
+
+ public override int Add (object value) {
+ return list.Add (value);
+ }
+
+ public override void Clear () {
+ list.Clear ();
+ }
+
+ public override bool Contains (object value) {
+ return list.Contains (value);
+ }
+
+ public override int IndexOf (object value) {
+ return list.IndexOf (value);
+ }
+
+ public override void Insert (int index, object value) {
+ list.Insert (index, value);
+ }
+
+ public override void Remove (object value) {
+ list.Remove (value);
+ }
+
+ public override void RemoveAt (int index) {
+ list.RemoveAt (index);
+ }
+
+ // ICollection
+ public override int Count {
+ get { return count; }
+ }
+
+ public override bool IsSynchronized {
+ get { return ((ICollection) list).IsSynchronized; }
+ }
+
+ public override object SyncRoot {
+ get { return ((ICollection) list).SyncRoot; }
+ }
+
+ public override void CopyTo (Array array, int index) {
+ ((ICollection) list).CopyTo (array, index);
+ }
+
+ // ICloneable
+ public override object Clone () {
+ return new ListWrapper (list);
+ }
+
+ // IEnumerable
+ public override IEnumerator GetEnumerator () {
+ return ((IEnumerable) list).GetEnumerator ();
+ }
+ }
+
+ [MonoTODO]
+ public static ArrayList Adapter (IList list) {
+ return new ListWrapper (list);
+ }
+
+ // properties
+
+ private bool fixedSize = false;
+ private bool readOnly = false;
+ private bool synchronized = false;
+
+ private long version = 0;
+ private ArrayList source = null;
+
+ private const int defaultCapacity = 16;
+
+ private void copyDataArray (object[] outArray) {
+ for (int i = 0; i < count; i++) {
+ outArray[i] = dataArray[i];
+ }
+ }
+
+ private void setSize (int newSize) {
+ if (newSize == capacity)
+ return;
+
+ capacity = (newSize == 0) ? defaultCapacity : newSize;
+
+ // note that this assumes that we've already sanity-checked
+ // the new size
+ object[] newDataArray = new object[newSize];
+ copyDataArray (newDataArray);
+ dataArray = newDataArray;
+ }
+
+ // note that this DOES NOT update count
+ private void shiftElements (int startIndex, int numshift) {
+ if (numshift == 0) {
+ return;
+ }
+
+ if (count + numshift > capacity) {
+ setSize (capacity * 2);
+ shiftElements (startIndex, numshift);
+ } else {
+ if (numshift > 0) {
+ int numelts = count - startIndex;
+ for (int i = numelts-1; i >= 0; i--) {
+ dataArray[startIndex + numshift + i] = dataArray[startIndex + i];
+ }
+
+ for (int i = startIndex; i < startIndex + numshift; i++) {
+ dataArray[i] = null;
+ }
+ } else {
+ int numelts = count - startIndex + numshift;
+ for (int i = 0; i < numelts; i++) {
+ dataArray [i + startIndex] = dataArray [i + startIndex - numshift];
+ }
+ for (int i = count + numshift; i < count; i++) {
+ dataArray[i] = null;
+ }
+ }
+ }
+ }
+
+ public virtual int Capacity {
+ get {
+ return capacity;
+ }
+
+ set {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (value < count) {
+ throw new ArgumentOutOfRangeException
+ ("ArrayList Capacity being set to less than Count");
+ }
+
+ if (fixedSize && value != capacity) {
+ throw new NotSupportedException
+ ("Collection is fixed size.");
+ }
+
+ setSize (value);
+ }
+ }
+
+ private void CheckSourceVersion() {
+ if (null != this.source && this.version != this.source.version) {
+ throw new InvalidOperationException();
+ }
+ }
+
+ public virtual int Count {
+ get {
+ CheckSourceVersion();
+ return count;
+ }
+ }
+
+ public virtual bool IsFixedSize {
+ get {
+ return fixedSize;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return readOnly;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return synchronized;
+ }
+ }
+
+ public virtual object this[int index] {
+ get {
+ CheckSourceVersion();
+
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException ("index < 0");
+ }
+
+ if (index >= count) {
+ throw new ArgumentOutOfRangeException ("index out of range");
+ }
+
+ return dataArray[index];
+ }
+ set {
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException ("index < 0");
+ }
+
+ if (index >= count) {
+ throw new ArgumentOutOfRangeException ("index out of range");
+ }
+
+ if (readOnly) {
+ throw new NotSupportedException ("Collection is read-only.");
+ }
+
+ dataArray[index] = value;
+ version++;
+ }
+ }
+
+ public virtual object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+ // methods
+ public virtual int Add (object value) {
+ if (readOnly)
+ throw new NotSupportedException ("ArrayList is read-only.");
+ if (fixedSize)
+ throw new NotSupportedException ("ArrayList is fixed size.");
+
+ if (count + 1 >= capacity)
+ setSize (capacity * 2);
+
+ dataArray[count] = value;
+ version++;
+ return count++;
+ }
+
+ public virtual void AddRange (ICollection c) {
+ if (null == c)
+ throw new ArgumentNullException ("c");
+ if (readOnly || fixedSize)
+ throw new NotSupportedException ();
+
+ int cc = c.Count;
+ if (count + cc >= capacity)
+ Capacity = cc < count? count * 2: count + cc + 1;
+ c.CopyTo (dataArray, count);
+ count += cc;
+ version++;
+ }
+
+ public virtual int BinarySearch (object value) {
+ return BinarySearch (0, count, value, null);
+ }
+
+ public virtual int BinarySearch (object value, IComparer comparer) {
+ return BinarySearch (0, count, value, comparer);
+ }
+
+ public virtual int BinarySearch (int index, int count,
+ object value, IComparer comparer) {
+ return Array.BinarySearch (dataArray, index, count, value, comparer);
+ }
+
+ public virtual void Clear () {
+ if (readOnly || fixedSize)
+ throw new NotSupportedException();
+
+ count = 0;
+ version++;
+ }
+
+ public virtual object Clone () {
+ return new ArrayList (dataArray, count, capacity,
+ fixedSize, readOnly, synchronized);
+ }
+
+ public virtual bool Contains (object item) {
+ for (int i = 0; i < count; i++) {
+ if (Object.Equals (dataArray[i], item)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public virtual void CopyTo (Array array) {
+ if (null == array)
+ throw new ArgumentNullException("array");
+ if (array.Rank > 1)
+ throw new ArgumentException("array cannot be multidimensional");
+
+ Array.Copy (dataArray, 0, array, 0, this.count);
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex) {
+ if (null == array)
+ throw new ArgumentNullException("array");
+ if (arrayIndex < 0)
+ throw new ArgumentOutOfRangeException("arrayIndex");
+ if (array.Rank > 1)
+ throw new ArgumentException("array cannot be multidimensional");
+ if (this.count > array.Length - arrayIndex)
+ throw new ArgumentException("this ArrayList has more items than the space available in array from arrayIndex to the end of array");
+
+ Array.Copy (dataArray, 0, array, arrayIndex, this.count);
+ }
+
+ public virtual void CopyTo (int index, Array array,
+ int arrayIndex, int count) {
+ if (null == array)
+ throw new ArgumentNullException("array");
+ if (arrayIndex < 0)
+ throw new ArgumentOutOfRangeException("arrayIndex");
+ if (index < 0)
+ throw new ArgumentOutOfRangeException("index");
+ if (count < 0)
+ throw new ArgumentOutOfRangeException("count");
+ if (index >= this.count)
+ throw new ArgumentException("index is greater than or equal to the source ArrayList.Count");
+ if (array.Rank > 1)
+ throw new ArgumentException("array cannot be multidimensional");
+ if (arrayIndex >= array.Length)
+ throw new ArgumentException("arrayIndex is greater than or equal to array's length");
+ if (this.count > array.Length - arrayIndex)
+ throw new ArgumentException("this ArrayList has more items than the space available in array from arrayIndex to the end of array");
+
+ Array.Copy (dataArray, index, array, arrayIndex, count);
+ }
+
+ [Serializable]
+ private class ArrayListEnumerator : IEnumerator, ICloneable {
+ private object[] data;
+ private int idx;
+ private int start;
+ private int num;
+ private ArrayList enumeratee;
+ private long version;
+
+ internal ArrayListEnumerator(int index, int count, object[] items, ArrayList al, long ver) {
+ data = items;
+ start = index;
+ num = count;
+ idx = start - 1;
+ enumeratee = al;
+ version = ver;
+ }
+
+ public object Clone () {
+ return new ArrayListEnumerator (start, num, data, enumeratee, version);
+ }
+
+ public virtual object Current {
+ get {
+ return data [idx];
+ }
+ }
+ public virtual bool MoveNext() {
+ if (enumeratee.version != version)
+ throw new InvalidOperationException();
+ if (++idx < start + num)
+ return true;
+ return false;
+ }
+ public virtual void Reset() {
+ idx = start - 1;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator () {
+ return new ArrayListEnumerator(0, this.Count, dataArray, this, this.version);
+ }
+
+ private void ValidateRange(int index, int count) {
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException("index", index, "Must be equal to or greater than zero");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count", count, "Must be equal to or greater than zero");
+ }
+ if (index > this.count - 1) {
+ throw new ArgumentException();
+ }
+ if (index + count > this.count - 1) {
+ throw new ArgumentException();
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator (int index, int count) {
+ ValidateRange(index, count);
+ return new ArrayListEnumerator(index, count, dataArray, this, this.version);
+ }
+
+ public virtual ArrayList GetRange (int index, int count) {
+ ValidateRange(index, count);
+ ArrayList retVal = new ArrayList(count);
+
+ for (int i = index; i < count + index; i++) {
+ retVal.Add(this[i]);
+ }
+ retVal.version = this.version;
+ retVal.source = this;
+ return retVal;
+ }
+
+ public virtual int IndexOf (object value) {
+ return IndexOf (value, 0, count);
+ }
+
+ public virtual int IndexOf (object value, int startIndex) {
+ return IndexOf (value, startIndex, count - startIndex);
+ }
+
+ public virtual int IndexOf (object value, int startIndex, int count) {
+ if (startIndex < 0 || startIndex + count > this.count || count < 0) {
+ throw new ArgumentOutOfRangeException ("IndexOf arguments out of range");
+ }
+ for (int i = startIndex; i < (startIndex + count); i++) {
+ if (Object.Equals (dataArray[i], value)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ public virtual void Insert (int index, object value) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (fixedSize) {
+ throw new NotSupportedException
+ ("Collection is fixed size.");
+ }
+
+ if (index < 0 || index > count) {
+ throw new ArgumentOutOfRangeException ("index < 0 or index >= capacity");
+ }
+
+ shiftElements (index, 1);
+ dataArray[index] = value;
+ count++;
+ version++;
+ }
+
+ public virtual void InsertRange (int index, ICollection c) {
+
+ if (c == null)
+ throw new ArgumentNullException ();
+
+ if (index < 0 || index > count)
+ throw new ArgumentOutOfRangeException ();
+
+ if (IsReadOnly || IsFixedSize)
+ throw new NotSupportedException ();
+
+ // Get a copy of the collection before the shift in case the collection
+ // is this. Otherwise the enumerator will be confused.
+ Array source = Array.CreateInstance(typeof(object), c.Count);
+ c.CopyTo(source, 0);
+
+ shiftElements (index, c.Count);
+ count += c.Count;
+
+ foreach (object o in source)
+ dataArray[index++] = o;
+
+ version++;
+ }
+
+ public virtual int LastIndexOf (object value) {
+ return LastIndexOf (value, count - 1, count);
+ }
+
+ public virtual int LastIndexOf (object value, int startIndex) {
+ if (startIndex < 0 || startIndex > count - 1) {
+ throw new ArgumentOutOfRangeException("startIndex", startIndex, "");
+ }
+ return LastIndexOf (value, startIndex, startIndex + 1);
+ }
+
+ public virtual int LastIndexOf (object value, int startIndex,
+ int count) {
+ if (null == value){
+ return -1;
+ }
+ if (startIndex >= this.count)
+ throw new ArgumentOutOfRangeException ("startIndex >= Count");
+ if (count < 0)
+ throw new ArgumentOutOfRangeException ("count < 0");
+ if (startIndex + 1 < count)
+ throw new ArgumentOutOfRangeException ("startIndex + 1 < count");
+
+ int EndIndex = startIndex - count + 1;
+ for (int i = startIndex; i >= EndIndex; i--) {
+ if (Object.Equals (dataArray[i], value)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ public virtual void Remove (object obj) {
+
+ if (IsFixedSize || IsReadOnly)
+ throw new NotSupportedException ();
+
+ int objIndex = IndexOf (obj);
+
+ if (objIndex == -1) {
+ // shouldn't an exception be thrown here??
+ // the MS docs don't indicate one, and testing
+ // with the MS .net framework doesn't indicate one
+ return;
+ }
+
+ RemoveRange (objIndex, 1);
+ }
+
+ public virtual void RemoveAt (int index) {
+ RemoveRange (index, 1);
+ }
+
+ public virtual void RemoveRange (int index, int count) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (fixedSize) {
+ throw new NotSupportedException
+ ("Collection is fixed size.");
+ }
+
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ("index", "Non-negative number required.");
+
+ if (count < 0)
+ throw new ArgumentOutOfRangeException ("count", "Non-negative number required.");
+
+ if (index + count > this.count)
+ throw new ArgumentException ("Offset and length were out of bounds for the array " +
+ "or count is greater than the number of elements from index " +
+ "to the end of the source collection.");
+
+ shiftElements (index, - count);
+ this.count -= count;
+ version++;
+ }
+
+ public virtual void Reverse () {
+ Reverse (0, count);
+ }
+
+ public virtual void Reverse (int index, int count) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (index < 0 || index + count > this.count) {
+ throw new ArgumentOutOfRangeException
+ ("index/count out of range");
+ }
+
+ Array.Reverse (dataArray, index, count);
+ version++;
+ }
+
+ public virtual void SetRange (int index, ICollection c) {
+ if (c == null)
+ throw new ArgumentNullException ();
+ if (readOnly)
+ throw new NotSupportedException ();
+ if (index < 0 || (index + c.Count) > count)
+ throw new ArgumentOutOfRangeException ();
+
+ c.CopyTo(dataArray, index);
+ }
+
+ public virtual void Sort () {
+ Sort (0, count, null);
+ }
+
+ public virtual void Sort (IComparer comparer) {
+ Sort (0, count, comparer);
+ }
+
+ public virtual void Sort (int index, int count, IComparer comparer) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (index < 0 || index + count > this.count) {
+ throw new ArgumentOutOfRangeException
+ ("index/count out of range");
+ }
+
+ Array.Sort (dataArray, index, count, comparer);
+ version++;
+ }
+
+ public virtual object[] ToArray() {
+ object[] outArray = new object[count];
+ Array.Copy (dataArray, outArray, count);
+ return outArray;
+ }
+
+ public virtual Array ToArray (Type type) {
+ Array outArray = Array.CreateInstance (type, count);
+ Array.Copy (dataArray, outArray, count);
+ return outArray;
+ }
+
+ public virtual void TrimToSize () {
+
+ if (IsReadOnly || IsFixedSize)
+ throw new NotSupportedException ();
+
+ setSize(count);
+
+ version++;
+ }
+
+ private class SyncArrayList : ArrayList {
+ private ArrayList _list;
+
+ // constructors
+ public SyncArrayList(ArrayList list) {
+ _list = list;
+ }
+
+ // properties
+ public override int Capacity {
+ get {
+ lock (_list.SyncRoot) {
+ return _list.Capacity;
+ }
+ }
+ set {
+ lock (_list.SyncRoot) {
+ _list.Capacity = value;
+ }
+ }
+ }
+
+ public override int Count {
+ get {
+ lock (_list.SyncRoot) {
+ return _list.Count;
+ }
+ }
+ }
+
+ public override bool IsFixedSize {
+ get {
+ lock (_list.SyncRoot) {
+ return _list.IsFixedSize;
+ }
+ }
+ }
+
+ public override bool IsReadOnly {
+ get {
+ lock (_list.SyncRoot) {
+ return _list.IsReadOnly;
+ }
+ }
+ }
+
+ public override bool IsSynchronized {
+ get {
+ lock (_list.SyncRoot) {
+ return _list.IsSynchronized;
+ }
+ }
+ }
+
+ public override object this[int index] {
+ get {
+ lock (_list.SyncRoot) {
+ return _list[index];
+ }
+ }
+ set {
+ lock (_list.SyncRoot) {
+ _list[index] = value;
+ }
+ }
+ }
+
+ // methods
+ public override int Add (object value) {
+ lock (_list.SyncRoot) {
+ return _list.Add(value);
+ }
+ }
+
+ public override void AddRange (ICollection c) {
+ lock (_list.SyncRoot) {
+ _list.AddRange(c);
+ }
+ }
+
+ public override int BinarySearch (int index, int count, object value, IComparer comparer) {
+ lock (_list.SyncRoot) {
+ return Array.BinarySearch (dataArray, index, count, value, comparer);
+ }
+ }
+
+ public override void Clear () {
+ lock (_list.SyncRoot) {
+ _list.Clear();
+ }
+ }
+
+ public override object Clone () {
+ lock (_list.SyncRoot) {
+ return new SyncArrayList((ArrayList) _list.Clone());
+ }
+ }
+
+ public override bool Contains (object item) {
+ lock (_list.SyncRoot) {
+ return _list.Contains(item);
+ }
+ }
+
+ public override void CopyTo (Array array) {
+ lock (_list.SyncRoot) {
+ _list.CopyTo(array);
+ }
+ }
+
+ public override void CopyTo (Array array, int arrayIndex) {
+ lock (_list.SyncRoot) {
+ _list.CopyTo(array, arrayIndex);
+ }
+ }
+
+ public override void CopyTo (int index, Array array, int arrayIndex, int count) {
+ lock (_list.SyncRoot) {
+ _list.CopyTo(index, array, arrayIndex, count);
+ }
+ }
+
+ public override IEnumerator GetEnumerator () {
+ lock (_list.SyncRoot) {
+ return _list.GetEnumerator();
+ }
+ }
+
+ public override IEnumerator GetEnumerator (int index, int count) {
+ lock (_list.SyncRoot) {
+ return _list.GetEnumerator(index, count);
+ }
+ }
+
+ public override ArrayList GetRange (int index, int count) {
+ lock (_list.SyncRoot) {
+ return new SyncArrayList(_list.GetRange(index, count));
+ }
+ }
+
+ public override int IndexOf (object value, int startIndex, int count) {
+ lock (_list.SyncRoot) {
+ return _list.IndexOf(value, startIndex, count);
+ }
+ }
+
+ public override void Insert (int index, object value) {
+ lock (_list.SyncRoot) {
+ _list.Insert(index, value);
+ }
+ }
+
+ public override void InsertRange (int index, ICollection c) {
+ lock (_list.SyncRoot) {
+ _list.InsertRange(index, c);
+ }
+ }
+
+ public override int LastIndexOf (object value, int startIndex) {
+ lock (_list.SyncRoot) {
+ return _list.LastIndexOf(value, startIndex);
+ }
+ }
+
+ public override int LastIndexOf (object value, int startIndex, int count) {
+ lock (_list.SyncRoot) {
+ return _list.LastIndexOf(value, startIndex, count);
+ }
+ }
+
+ public override void Remove (object obj) {
+ lock (_list.SyncRoot) {
+ _list.Remove(obj);
+ }
+ }
+
+ public override void RemoveRange (int index, int count) {
+ lock (_list.SyncRoot) {
+ _list.RemoveRange(index, count);
+ }
+ }
+
+ public override void Reverse (int index, int count) {
+ lock (_list.SyncRoot) {
+ _list.Reverse(index, count);
+ }
+ }
+
+ public override void SetRange (int index, ICollection c) {
+ lock (_list.SyncRoot) {
+ _list.SetRange(index, c);
+ }
+ }
+
+ public override void Sort (int index, int count, IComparer comparer) {
+ lock (_list.SyncRoot) {
+ _list.Sort(index, count, comparer);
+ }
+ }
+
+ public override object[] ToArray() {
+ lock (_list.SyncRoot) {
+ return _list.ToArray();
+ }
+ }
+
+ public override Array ToArray (Type type) {
+ lock (_list.SyncRoot) {
+ return _list.ToArray(type);
+ }
+ }
+
+ public override void TrimToSize () {
+ lock (_list.SyncRoot) {
+ _list.TrimToSize();
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/BitArray.cs b/mcs/class/corlib/System.Collections/BitArray.cs
new file mode 100644
index 00000000000..551479e2e15
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/BitArray.cs
@@ -0,0 +1,500 @@
+using System;
+
+namespace System.Collections
+{
+ // do we really need to specify IEnumerable since ICollection extends it?
+ [Serializable]
+ public sealed class BitArray : ICollection, IEnumerable, ICloneable
+ {
+ private Int32[] m_array;
+ private int m_length;
+ private int m_modCount = 0;
+
+ private static void clearJunk(Int32[] arr, int numbits)
+ {
+ int numjunkbits = 32 - (numbits%32);
+ UInt32 mask = (~0U >> numjunkbits);
+ arr[arr.Length - 1] &= (int)mask;
+ }
+
+ private static int bitsToInts(int bits)
+ {
+ int retval = bits/32;
+ if (bits % 32 != 0)
+ retval++;
+
+ return retval;
+ }
+
+ private static int bitsToBytes(int bits)
+ {
+ int retval = bits/8;
+ if (bits % 8 != 0)
+ retval++;
+
+ return retval;
+ }
+
+
+ private void setBit(int bitIndex, bool value)
+ {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+
+ Int32 theBit = 1 << shift;
+
+ if(value)
+ m_array[index] |= theBit;
+ else
+ m_array[index] &= ~theBit;
+
+ m_modCount++;
+ }
+
+ private bool getBit(int bitIndex)
+ {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+
+ Int32 theBit = m_array[index] & (1 << shift);
+
+ return (theBit == 0) ? false : true;
+ }
+
+ private byte getByte(int byteIndex)
+ {
+ int index = byteIndex/4;
+ int shift = (byteIndex%4)*8;
+
+ Int32 theByte = m_array[index] & (0xff << shift);
+
+ return (byte)((theByte >> shift)&0xff);
+ }
+
+ private void setByte(int byteIndex, byte value)
+ {
+ int index = byteIndex/4;
+ int shift = (byteIndex%4)*8;
+
+ Int32 orig = m_array[index];
+
+ // clear the byte
+ orig &= ~(0xff << shift);
+ // or in the new byte
+ orig |= value << shift;
+
+ m_array[index] = orig;
+
+ m_modCount++;
+ }
+
+ /* --- Constructors --- */
+ public BitArray(BitArray orig)
+ {
+ m_length = orig.m_length;
+
+ int numInts = bitsToInts(m_length);
+ m_array = new Int32[numInts];
+ Array.Copy(orig.m_array, m_array, numInts);
+ }
+
+ public BitArray(bool[] bits)
+ {
+ m_length = bits.Length;
+
+ int numInts = bitsToInts(m_length);
+ m_array = new Int32[numInts];
+ for (int i=0; i < bits.Length; i++)
+ setBit(i, bits[i]);
+ }
+
+ public BitArray(byte[] bytes)
+ {
+ m_length = bytes.Length * 8;
+
+ m_array = new Int32[bitsToInts(m_length)];
+ for (int i=0; i < bytes.Length; i++)
+ setByte(i, bytes[i]);
+ }
+
+ public BitArray(int capacity)
+ {
+ m_length = capacity;
+ m_array = new Int32[bitsToInts(m_length)];
+ }
+
+ public BitArray(int[] words)
+ {
+ int arrlen = words.Length;
+ m_length = arrlen*32;
+ m_array = new Int32[arrlen];
+ Array.Copy(words, m_array, arrlen);
+ }
+
+ public BitArray(int capacity, bool value) : this(capacity)
+ {
+ if (value)
+ {
+ // FIXME: Maybe you can create an array pre filled?
+ for (int i = 0; i < m_array.Length; i++)
+ m_array[i] = ~0;
+ }
+ }
+
+ private BitArray(Int32 [] array, int length)
+ {
+ m_array = array;
+ m_length = length;
+ }
+
+
+ /* --- Public properties --- */
+ public int Count
+ {
+ get
+ {
+ return m_length;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool this[int index]
+ {
+ get
+ {
+ return Get(index);
+ }
+ set
+ {
+ Set(index, value);
+ }
+
+ }
+
+ public int Length
+ {
+ get
+ {
+ return m_length;
+ }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException();
+
+ int newLen = value;
+ if (m_length != newLen)
+ {
+ int numints = bitsToInts(newLen);
+ Int32 [] newArr = new Int32[numints];
+ int copylen = (numints > m_array.Length ? m_array.Length : numints);
+ Array.Copy(m_array, newArr, copylen);
+
+ // clear out the junk bits at the end:
+ clearJunk(newArr, newLen);
+
+ // set the internal state
+ m_array = newArr;
+ m_length = newLen;
+ m_modCount++;
+ }
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ /* --- Public methods --- */
+ public BitArray And(BitArray operand)
+ {
+ if (operand == null)
+ throw new ArgumentNullException();
+ if (operand.m_length != m_length)
+ throw new ArgumentException();
+
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = m_array[i] & operand.m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ public object Clone()
+ {
+ // FIXME: according to the doc, this should be a shallow copy.
+ // But the MS implementation seems to do a deep copy.
+ return new BitArray((Int32 [])m_array.Clone(), m_length);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+ if (index < 0)
+ throw new ArgumentOutOfRangeException("index");
+
+ if (array.Rank != 1)
+ throw new ArgumentException ("Array rank must be 1", "array");
+
+ if (index >= array.Length)
+ throw new ArgumentException("index is greater than array.Length", "index");
+
+ // in each case, check to make sure enough space in array
+
+ if (array is bool[])
+ {
+ if (index + m_length >= array.Length)
+ throw new ArgumentException();
+
+ bool [] barray = (bool []) array;
+
+ // Copy the bits into the array
+ for (int i = 0; i < m_length; i++)
+ barray[index + i] = getBit(i);
+ }
+ else if (array is byte[])
+ {
+ int numbytes = bitsToBytes(m_length);
+ if (index + numbytes >= array.Length)
+ throw new ArgumentException();
+
+ byte [] barray = (byte []) array;
+ // Copy the bytes into the array
+ for (int i = 0; i < numbytes; i++)
+ barray[index + i] = getByte(i);
+ }
+ else if (array is int[])
+ {
+ int numints = bitsToInts(m_length);
+ if (index + numints >= array.Length)
+ throw new ArgumentException();
+ Array.Copy(m_array, 0, array, index, numints);
+ }
+ else
+ {
+ throw new ArgumentException("Unsupported type", "array");
+ }
+ }
+
+
+ /*
+ * All this code for nothing... Apparently, The MS BitArray doesn't
+ * override Equals!
+ *public override bool Equals(object obj)
+ {
+ // If it's not a BitArray, then it can't be equal to us.
+ if (!(obj is BitArray))
+ return false;
+
+ // If the references are equal, then clearly the instances are equal
+ if (this == obj)
+ return true;
+
+ // If its length is different, than it can't be equal.
+ BitArray b = (BitArray) obj;
+ if (m_length != b.m_length)
+ return false;
+
+
+ // Now compare the bits.
+ // This is a little tricky, because if length doesn't divide 32,
+ // then we shouldn't compare the unused bits in the last element
+ // of m_array.
+
+ // Compare all full ints. If any differ, then we are not equal.
+ int numints = m_length/32;
+ for (int i = 0; i < numints; i++)
+ {
+ if (b.m_array[i] != m_array[i])
+ return false;
+ }
+
+ // Compare the left over bits (if any)
+ int extrabits = m_length%32;
+ if (extrabits != 0)
+ {
+ // our mask is the "extrabits" least significant bits set to 1.
+ UInt32 comparemask = ~0U >> (32 - extrabits);
+
+ // numints is rounded down, so it's safe to use as an index here,
+ // as long as extrabits > 0.
+ if ((b.m_array[numints] & comparemask)
+ != (m_array[numints] & comparemask))
+ return false;
+ }
+
+ // We passed through all the above, so we are equal.
+ return true;
+
+ }
+ * End comment out of Equals()
+ */
+
+ public bool Get(int index)
+ {
+ if (index < 0 || index >= m_length)
+ throw new ArgumentOutOfRangeException();
+ return getBit(index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return new BitArrayEnumerator(this);
+ }
+
+ /*
+ * Since MS doesn't appear to override Equals/GetHashCode, we don't.
+ *public override int GetHashCode()
+ {
+ // We could make this a constant time function
+ // by just picking a constant number of bits, spread out
+ // evenly across the entire array. For now, this will suffice.
+
+ int retval = m_length;
+
+ // Add in each array element, except for the leftover bits.
+ int numints = m_length/32;
+ for (int i = 0; i < numints; i++)
+ retval += (int)m_array[i];
+
+ // That's enough. Adding in the leftover bits is tiring.
+
+ return retval;
+ }
+ * End comment out of GetHashCode()
+ */
+
+ public BitArray Not()
+ {
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = ~m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ public BitArray Or(BitArray operand)
+ {
+ if (operand == null)
+ throw new ArgumentNullException();
+ if (operand.m_length != m_length)
+ throw new ArgumentException();
+
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = m_array[i] | operand.m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ public void Set(int index, bool value)
+ {
+ if (index < 0 || index >= m_length)
+ throw new ArgumentOutOfRangeException();
+ setBit(index, value);
+ }
+
+ public void SetAll(bool value)
+ {
+ if (value)
+ {
+ for (int i = 0; i < m_array.Length; i++)
+ m_array[i] = ~0;
+
+ // clear out the junk bits that we might have set
+ clearJunk(m_array, m_length);
+ }
+ else
+ Array.Clear(m_array, 0, m_array.Length);
+
+
+ m_modCount++;
+ }
+
+ public BitArray Xor(BitArray operand)
+ {
+ if (operand == null)
+ throw new ArgumentNullException();
+ if (operand.m_length != m_length)
+ throw new ArgumentException();
+
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = m_array[i] ^ operand.m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ class BitArrayEnumerator : IEnumerator
+ {
+ BitArray m_bitArray;
+ private bool m_current;
+ private int m_index;
+ private int m_max;
+ private int m_modCount;
+
+ public BitArrayEnumerator(BitArray ba)
+ {
+ m_index = -1;
+ m_bitArray = ba;
+ m_max = ba.m_length;
+ m_modCount = ba.m_modCount;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if (m_index < 0 || m_index >= m_max)
+ throw new InvalidOperationException();
+ return m_current;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ if (m_modCount != m_bitArray.m_modCount)
+ throw new InvalidOperationException();
+
+ if (m_index + 1 >= m_max)
+ return false;
+
+ m_index++;
+ m_current = m_bitArray[m_index];
+ return true;
+ }
+
+ public void Reset()
+ {
+ if (m_modCount != m_bitArray.m_modCount)
+ throw new InvalidOperationException();
+ m_index = -1;
+ }
+ }
+ }
+}
+
+
+
+
+
diff --git a/mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs b/mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs
new file mode 100644
index 00000000000..7e56f67c884
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs
@@ -0,0 +1,83 @@
+//
+// System.Collections.CaseInsensitiveComparer
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+
+
+namespace System.Collections {
+
+ [Serializable]
+ public class CaseInsensitiveComparer : IComparer {
+
+ private static CaseInsensitiveComparer singleton;
+
+
+ // Class constructor
+
+ static CaseInsensitiveComparer ()
+ {
+ singleton=new CaseInsensitiveComparer ();
+ }
+
+
+ // Public instance constructor
+
+ public CaseInsensitiveComparer ()
+ {
+ }
+
+ [MonoTODO]
+ public CaseInsensitiveComparer (CultureInfo culture)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ //
+ // Public static properties
+ //
+
+ public static CaseInsensitiveComparer Default {
+ get {
+ return singleton;
+ }
+ }
+
+
+ //
+ // Instance methods
+ //
+
+ //
+ // IComparer
+ //
+
+ public int Compare (object a, object b)
+ {
+ string str1 = a as string;
+ string str2 = b as string;
+
+
+ int res = 0;
+
+ if (str1 != null && str2 != null) {
+ res = String.Compare (str1, str2, true);
+ }
+
+ return res;
+ }
+
+
+
+ } // CaseInsensitiveComparer
+}
+
diff --git a/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs b/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs
new file mode 100644
index 00000000000..1909d4aaa13
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs
@@ -0,0 +1,94 @@
+//
+// System.Collections.CaseInsensitiveHashCodeProvider
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Collections {
+
+ [Serializable]
+ public class CaseInsensitiveHashCodeProvider : IHashCodeProvider {
+
+ private static CaseInsensitiveHashCodeProvider singleton;
+
+
+ // Class constructor
+
+ static CaseInsensitiveHashCodeProvider ()
+ {
+ singleton=new CaseInsensitiveHashCodeProvider ();
+ }
+
+
+
+ // Public instance constructor
+
+ public CaseInsensitiveHashCodeProvider ()
+ {
+ }
+
+ [MonoTODO]
+ public CaseInsensitiveHashCodeProvider (CultureInfo culture)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+
+ //
+ // Public static properties
+ //
+
+ public static CaseInsensitiveHashCodeProvider Default {
+ get {
+ return singleton;
+ }
+ }
+
+
+ //
+ // Instance methods
+ //
+
+ //
+ // IHashCodeProvider
+ //
+
+ public int GetHashCode (object obj)
+ {
+ if (obj == null) {
+ throw new ArgumentNullException ("obj is null");
+ }
+
+ string str = obj as string;
+
+ if (str == null)
+ return obj.GetHashCode ();
+
+ int h = 0;
+ char c;
+
+ if (str.Length > 0) {
+ for (int i = 0;i<str.Length;i++) {
+ c = str [i];
+
+ if (Char.IsLetter (c))
+ c = Char.ToLower (c);
+
+ h = h * 31 + c;
+ }
+ }
+
+ return h;
+ }
+
+ } // CaseInsensitiveHashCodeProvider
+}
+
diff --git a/mcs/class/corlib/System.Collections/ChangeLog b/mcs/class/corlib/System.Collections/ChangeLog
new file mode 100644
index 00000000000..bba8a524b85
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ChangeLog
@@ -0,0 +1,348 @@
+2003-01-12 Varga Zoltan <vargaz@freemail.hu>
+
+ * ArrayList.cs (RemoveRange): Patch for allowing zero-size
+ removal at the end of a list. It also cleans up the argument
+ checking code so the raised exceptions have the same message as
+ under MS.NET.
+
+2003-01-10 Duncan Mak <duncan@ximian.com>
+
+ * ArrayList.cs (Insert): Patch from Zoltan
+ (Zoltan.2.Varga@nokia.com).
+
+2002-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Hashtable.cs: add the key to the error message when
+ 'key duplication'.
+
+2002-10-15 Vladimir Vukicevic <vladimir@pobox.com>
+
+ * Queue.cs: update new capacity in grow(), preventing queue from
+ constantly looping over old elements in Dequeue(). Also use
+ capacity instead of contents.Length in Enqueue().
+
+2002-09-24 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs: Make enumerator throw exception if the ArrayList is
+ mutated (Insert, Delete, etc.). Also, fix bug in InsertRange() when
+ this was passed as parameter.
+
+2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ArrayList.cs: fixed bug #29658.
+
+2002-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ArrayList.cs:
+ * BitArray.cs:
+ * CaseInsensitiveComparer.cs:
+ * CaseInsensitiveHashCodeProvider.cs:
+ * IEnumerable.cs:
+ * Queue.cs: misc. fixes based on class status page.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * CaseInsensitiveHashCodeProvider.cs: Added missing constructor
+ which was breaking System.Web build on linux
+
+2002-07-05 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * SortedList.cs: Implemented thread-safe wrapper. Changed some
+ args to camelCase.
+
+2002-07-02 Nick Drochak <ndrochak@gol.com>
+
+ * SortedList.cs: Constructors should use the capacity given regardless
+ how small. After a Clear() the Capacit should be 16. Since a Dictionary
+ might be used in the constructor, make sure we trap exceptions thrown
+ by the Comparer, like in Add().
+
+2002-06-30 Nick Drochak <ndrochak@gol.com>
+
+ * SortedList.cs: Many fixed. A lot of checking for null and throwing
+ exceptions. A few logic bugs fixed as well
+
+2002-06-25 Nick Drochak <ndrochak@gol.com>
+
+ * Queue.cs (CopyTo): Fix logic for copying the circular array.
+ (Enqueue): Use actual length of array to determine when to grow
+ (QueueEnumerator) Fixed Current to use array length, not capacity, and
+ fixed off-by-one errror in MoveNext().
+
+Tue Jun 4 13:08:43 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: fixed RemoveAt() implementation.
+
+2002-05-27 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (LastIndexOf): Return -1 if searching for null, also
+ fix check of parameters sent to make sure we don't search beyond the
+ beginning of the list.
+ (ListWrapper): Throw exception if called with null.
+ We now pass all unit tests.
+
+2002-05-23 Duncan Mak <duncan@ximian.com>
+
+ * ArrayList.cs (Wrapper): Preliminary implementation of
+ ArrayList.Wrapper (IList).
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * ArrayList.cs: Made count, capacity and dataArray the first three
+ fields in the class. They're read by the reflection library.
+
+2002-05-21 Lawrence Pit <loz@cable.a2000.nl>
+
+ * ArrayList.cs: Fixed bug where a capacity of 0 could be reached,
+ thereby causing problems when trying to add elements.
+
+2002-05-06 Duncan Mak <duncan@ximian.com>
+
+ * Queue.cs (TrimToSize): Implemented.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs: Throw RankException when constructing from a
+ multi-dimensional array. Confirmed behavior from MS.NET
+
+Thu May 2 15:18:11 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: make mcs compile again: it's allowed to
+ call arraylist.CopyTo(array, 0) when the length of the array
+ is also 0.
+
+Wed May 1 17:05:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * SortedList.cs: fix RemoveAt () to use the correct length in
+ Array.Copy.
+
+2002-05-01 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (Add & AddRange) : Throw exceptions where needed.
+
+2002/05/01 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (CopyTo) : Check parameters and throw exceptions
+ where needed.
+
+2002/04/30 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (Clear) : Throw exception if ReadOnly or FixedSize.
+ (InsertRange) : Implement.
+ (SetRange) : Implement.
+
+2002-04-30 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (TrimToSize) : Implement.
+
+2002-04-28 Duncan Mak <duncan@ximian.com>
+
+ * ArrayList.cs (InsertRange):
+ (SetRange):
+ (Remove):
+ (TrimToSize): Throw exceptions where needed.
+
+2002-04-29 Nick Drochak <ndrochak@gol.com>
+
+ * Hashtable.cs (CopyTo): Throw exceptions where needed.
+
+2002-04-28 Duncan Mak <duncan@ximian.com>
+
+ * ArrayList.cs (ReadOnly):
+ (IList.ReadOnly): Implemented.
+
+ (Synchronized):
+ (IList.Synchronized): Implemented.
+
+ (ixedSize):
+ (IList.FixedSize): Implemented.
+
+2002-03-24 Duncan Mak <duncan@ximian.com>
+
+ * SortedList.cs (Synchronized): Stubbed out a missing method
+ pointed out by Jakk Simm's test suite.
+
+2002-03-14 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (FixedSize(ArrayList)): should return an ArrayList. The
+ other FixedSize() methods returns an IList.
+
+2002-03-13 Duncan Mak <duncan@ximian.com>
+
+ * ArrayList.cs (FixedSize): Changed the return type to IList if
+ the argument is an IList.
+ (Synchronized): Ditto here.
+
+2002-03-08 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * Hashtable.cs: Fixed ToPrime () bug. Removed ALLOC_GRAIN.
+ Removed unused code from static constructor.
+ GetObjectData () - Version is the same as modificationCount.
+
+2002-02-20 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs: Add MonoTODO's where necessary. Fix bugs discovered
+ by Bucky's tests. Implement a couple of things that were left undone.
+
+Mon Feb 11 19:49:25 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: Dick's fix to contructor.
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * Hashtable.cs: Implemented parts of the ISerializable
+ interface. GetObjectData () is good, but serialization constructor
+ needs some more love.
+
+Sat Jan 5 15:56:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Hashtable.cs: the IDictionaryEnumerator returns DictionaryEntries.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * Correct name to MonoTODO everywhere.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * ArrayList.cs : Setting an index does not implicitly
+ extend the arraylist : remove FIXME.
+
+ Decorate incomplete elements with the TODO attribute.
+
+ * BitArray.cs : Insert TODO attributes where appropriate.
+
+ * CaseInsensitiveHashcodeProvider.cs: Ditto.
+
+ * Hashtable.cs, SortedList.cs : Ditto.
+
+Thu Dec 13 20:17:08 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: implemented AddRange(), CopyTo().
+
+2001-11-19 Miguel de Icaza <miguel@ximian.com>
+
+ * DictionaryBase.cs: Implemented.
+
+Wed Nov 14 16:45:49 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: implement ArrayListEnumerator.
+ * Hashtable.cs: hardcode the prime number table.
+
+2001-11-06 Nick Drochak <ndrochak@gol.com>
+ * Queue.cs: Fixes from Ricardardo. QueueTest also updated.
+
+2001-11-04 Nick Drochak <ndrochak@gol.com>
+ * Queue.cs: Fixed small syntax errors that were preventing the compile.
+ I changed the build file to include Queue.cs as well.
+
+2001-11-04 Nick Drochak <ndrochak@gol.com>
+ * ArrayList.cs: Fixed "off by one" error when shifting left the array when
+ items are removed.
+
+ * CollectionBase.cs: Added OnValidate(), OnRemove() and OnRemoveComplete()
+ hook methods to the RemoveAt() method.
+
+2001-11-04 Nick Drochak <ndrochak@gol.com>
+ * ArrayList.cs: Added private enumerator class and make GetEnumerator()
+ methods return an instance of it.
+
+Tue Sep 25 18:52:48 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: fix Insert () to check capacity, not count.
+
+Tue Sep 25 16:54:54 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DictionaryEntry.cs: added.
+
+2001-08-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * common.src: removed duplicate entries
+
+2001-08-08 Nick Drochak <ndrochak@gol.com>
+
+ * ReadOnlyCollectionBase.cs: Initialized private member.
+ * CollectionBase.cs: Initialized private member.
+ * common.src : Added ReadOnlyCollectionBase.cs and CollectionBase.cs
+ * /mcs/class/makefile: Used $(SYSTEMROOT) instead of hard coded //c/winnt
+ * /mcs/makefile: Used $(SYSTEMROOT) instead of hard coded //c/winnt
+
+2001-08-08 Nick Drochak <nick@jobdragon.com>
+
+ * CollectionBase.cs: Add
+ * ReadOnlyCollectionBase.cs: Add
+ * CollectionBaseTest.cs: Add
+ * ReadOnlyCollectionBaseTest.cs: Add
+
+2001-07-31 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * StackTest.cs: Add Test case for System.Collections.Stack.
+ Contributed by Chris Hynes <chrish@assistedsolutions.com>
+
+2001-07-30 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * Stack.cs: Clone() doesn't need to check if it's synchronized, since
+ we override it in SyncStack anyway...
+
+ * Stack.cs: Pop() now shrinks the array if we drop below 1/4 full, to
+ avoid using massive amounts of memory that are not necessary. We only
+ drop to half the current size, which I hope will avoid the 'ping-pong'
+ effect.
+
+ * Stack.cs: SyncStack.IsReadOnly should return stack.IsReadOnly
+ instead of just returning false, since we may have a ReadOnly wrapper
+ in the future (although i can't imagine why). Thanks to David
+ Menestrina <dmenest@yahoo.com> for pointing this out.
+
+2001-07-23 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * Hashtable.cs: Fixed bug in Clear(), the Count wasn't zeroed.
+ From now, Clear() increases modification count.
+ Fixed HCP bug in GetHash(object) - hcp.GetHashCode() was used
+ instead of hcp.GetHashCode(key). This was resulted in the
+ insanely long lookup times when HashCodeProvider was used to
+ construct Hashtable. Added thread-safe wrapper.
+
+2001-07-16 David Menestrina <dmenest@yahoo.com>
+
+ * BitArray.cs: Add
+ * BitArrayTest.cs: Add
+
+2001-07-18 Miguel de Icaza <miguel@ximian.com>
+
+ * IDictionary.cs (Collections): IDictionary implements ICollection
+ as well. Thanks Sergey!
+
+2001-07-18 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * Stack.cs Removed unnecessary locking from many methods of
+ SyncStack, removed SyncEnumerator because it was unnecessary,
+ added a modCount member to Stack and Stack.Enumerator, to
+ ensure that the Stack has not been modified out form under the
+ Enumerator, and changed the Enumerator to use a reference to the
+ stack rather than copying over the contents array.
+
+2001-07-17 David Menestrina <dmenest@yahoo.com>
+
+ * Added implementation of BitArray.
+
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * Hashtable.cs: Removed call to d.Count in the Hashtable
+ constructor that takes an IDictionary as IDictionary does not
+ provide a Count field.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * IDictionary.cs: Clear was clear.
+
+2001-07-13 Miguel de Icaza <miguel@ximian.com>
+
+ * All files: Renamespace things to System.
+
+2001-07-05 Vladimir Vukicevic <vladimir@ximian.com>
+
+ * ArrayList.cs: initial checkin and implementation
+
+ * ICollection.cs, IComprarer.cs, IDictionary.cs,
+ IDictionaryEnumerator.cs, IEnumerable.cs, IHashCodeProvider.cs,
+ IList.cs: initial checkin
+
diff --git a/mcs/class/corlib/System.Collections/CollectionBase.cs b/mcs/class/corlib/System.Collections/CollectionBase.cs
new file mode 100644
index 00000000000..743888a3849
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/CollectionBase.cs
@@ -0,0 +1,137 @@
+//
+// System.Collections.CollectionBase.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+
+namespace System.Collections {
+
+ [Serializable]
+ public abstract class CollectionBase : IList, ICollection, IEnumerable {
+
+ // private instance properties
+ private ArrayList myList;
+
+ // public instance properties
+ public int Count { get { return InnerList.Count; } }
+
+ // Public Instance Methods
+ public IEnumerator GetEnumerator() { return InnerList.GetEnumerator(); }
+ public void Clear() {
+ OnClear();
+ InnerList.Clear();
+ OnClearComplete();
+ }
+ public void RemoveAt (int index) {
+ object objectToRemove;
+ objectToRemove = InnerList[index];
+ OnValidate(objectToRemove);
+ OnRemove(index, objectToRemove);
+ InnerList.RemoveAt(index);
+ OnRemoveComplete(index, objectToRemove);
+ }
+
+ // Protected Instance Constructors
+ protected CollectionBase() {
+ this.myList = new ArrayList();
+ }
+
+ // Protected Instance Properties
+ protected ArrayList InnerList {get { return this.myList; } }
+ protected IList List {get { return this; } }
+
+ // Protected Instance Methods
+ protected virtual void OnClear() { }
+ protected virtual void OnClearComplete() { }
+
+ protected virtual void OnInsert(int index, object value) { }
+ protected virtual void OnInsertComplete(int index, object value) { }
+
+ protected virtual void OnRemove(int index, object value) { }
+ protected virtual void OnRemoveComplete(int index, object value) { }
+
+ protected virtual void OnSet(int index, object oldValue, object newValue) { }
+ protected virtual void OnSetComplete(int index, object oldValue, object newValue) { }
+
+ protected virtual void OnValidate(object value) {
+ if (null == value) {
+ throw new System.ArgumentNullException("CollectionBase.OnValidate: Invalid parameter value passed to method: null");
+ }
+ }
+
+ // ICollection methods
+ void ICollection.CopyTo(Array array, int index) {
+ InnerList.CopyTo(array, index);
+ }
+ object ICollection.SyncRoot {
+ get { return InnerList.SyncRoot; }
+ }
+ bool ICollection.IsSynchronized {
+ get { return InnerList.IsSynchronized; }
+ }
+
+ // IList methods
+ int IList.Add (object value) {
+ int newPosition;
+ OnValidate(value);
+ newPosition = InnerList.Count;
+ OnInsert(newPosition, value);
+ InnerList.Add(value);
+ OnInsertComplete(newPosition, value);
+ return newPosition;
+ }
+
+ bool IList.Contains (object value) {
+ return InnerList.Contains(value);
+ }
+
+ int IList.IndexOf (object value) {
+ return InnerList.IndexOf(value);
+ }
+
+ void IList.Insert (int index, object value) {
+ OnValidate(value);
+ OnInsert(index, value);
+ InnerList.Insert(index, value);
+ OnInsertComplete(index, value);
+ }
+
+ void IList.Remove (object value) {
+ int removeIndex;
+ OnValidate(value);
+ removeIndex = InnerList.IndexOf(value);
+ OnRemove(removeIndex, value);
+ InnerList.Remove(value);
+ OnRemoveComplete(removeIndex, value);
+ }
+
+ // IList properties
+ bool IList.IsFixedSize {
+ get { return InnerList.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return InnerList.IsReadOnly; }
+ }
+
+ object IList.this[int index] {
+ get { return InnerList[index]; }
+ set {
+ object oldValue;
+ // make sure we have been given a valid value
+ OnValidate(value);
+ // save a reference to the object that is in the list now
+ oldValue = InnerList[index];
+
+ OnSet(index, oldValue, value);
+ InnerList[index] = value;
+ OnSetComplete(index, oldValue, value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/Comparer.cs b/mcs/class/corlib/System.Collections/Comparer.cs
new file mode 100644
index 00000000000..6591c70334c
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Comparer.cs
@@ -0,0 +1,56 @@
+//
+// System.Collections.Comparer
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+using System;
+using System.Collections;
+
+
+namespace System.Collections {
+
+ [Serializable]
+ public sealed class Comparer : IComparer {
+
+ public static readonly Comparer Default;
+
+
+ // Class constructor
+
+ static Comparer ()
+ {
+ Default = new Comparer ();
+ }
+
+
+
+ // Public instance constructor
+
+ private Comparer ()
+ {
+ }
+
+
+
+ // IComparer
+
+ public int Compare (object a, object b)
+ {
+ if (a == b)
+ return 0;
+ else if (a == null)
+ return -1;
+ else if (b == null)
+ return 1;
+ else if (a is IComparable)
+ return (a as IComparable).CompareTo (b);
+ else if (b is IComparable)
+ return -(b as IComparable).CompareTo (a);
+
+ throw new ArgumentException ("Neither a nor b IComparable");
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/DictionaryBase.cs b/mcs/class/corlib/System.Collections/DictionaryBase.cs
new file mode 100755
index 00000000000..ba01e9cdace
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/DictionaryBase.cs
@@ -0,0 +1,372 @@
+//
+// System.Collections.DictionaryBase.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Collections {
+
+ /// <summary>
+ /// An abstract class that provides a simple way to monitor changes to a
+ /// Hashtable. Derived classes overwrite one or more of the `On' methods
+ /// to track the changes to the Hashtable.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This class is a base class that can simplify the development of
+ /// strongly typed collections. The idea being that the insertion of elements
+ /// into the Hashtable can be forced to be of a given type.
+ ///
+ /// The `On' members are protected and designed to be used only by derived
+ /// classes.
+ /// </remarks>
+ [Serializable]
+ public abstract class DictionaryBase : IDictionary, ICollection, IEnumerable {
+
+ Hashtable dictionary;
+
+ protected DictionaryBase ()
+ {
+ dictionary = new Hashtable ();
+ }
+
+ /// <summary>
+ /// Clears the contents of the dictionary
+ /// </summary>
+ public void Clear ()
+ {
+ OnClear ();
+ dictionary.Clear ();
+ OnClearComplete ();
+ }
+
+ /// <summary>
+ /// Returns the number of items in the dictionary
+ /// </summary>
+ public int Count {
+ get {
+ return dictionary.Count;
+ }
+ }
+
+ /// <summary>
+ /// The collection contained as an IDictionary
+ /// </summary>
+ protected IDictionary Dictionary {
+ get {
+ return dictionary;
+ }
+ }
+
+ /// <summary>
+ /// The internal Hashtable representation for this dictionary
+ /// </summary>
+ protected Hashtable InnerHashtable {
+ get {
+ return dictionary;
+ }
+ }
+
+ /// <summary>
+ /// Copies the contents of the Dictionary into the target array
+ /// </summary>
+ /// <param name="array">
+ /// The array to copy the contents of the dictionary to. The
+ /// array must have a zero-based indexing
+ /// </param>
+ /// <param name="index">
+ /// Starting index within the array where to copy the objects
+ /// to.
+ /// </param>
+ public void CopyTo (Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ("array");
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ("index must be possitive");
+ if (array.Rank > 1)
+ throw new ArgumentException ("array is multidimensional");
+ int size = array.Length;
+ if (index > size)
+ throw new ArgumentException ("index is larger than array size");
+ if (index + Count > size)
+ throw new ArgumentException ("Copy will overlflow array");
+
+ DoCopy (array, index);
+ }
+
+ /// <summary>
+ /// Internal routine called by CopyTo to perform the actual
+ /// copying of the data
+ /// </summary>
+ private void DoCopy (Array array, int index)
+ {
+ foreach (DictionaryEntry de in dictionary)
+ array.SetValue (de, index++);
+ }
+
+ /// <summary>
+ /// Returns an enumerator for the dictionary
+ /// </summary>
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ return dictionary.GetEnumerator ();
+ }
+
+ /// <summary>
+ /// Hook invoked before the clear operation
+ /// is performed on the DictionaryBase
+ /// </summary>
+ protected virtual void OnClear ()
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after the clear operation
+ /// is performed on the DictionaryBase
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ protected virtual void OnClearComplete ()
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked while fetching data from the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This method is provided as a simple way to override the values
+ /// returned by the DictionaryBase.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to retrieve</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual object OnGet (object key, object current_value)
+ {
+ return current_value;
+ }
+
+ /// <summary>
+ /// Hook invoked before inserting data into the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Derived classes can override this method and perform some
+ /// action before the <paramref name="current_value"/> is inserted
+ /// into the dictionary.
+ ///
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to insert</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnInsert (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after inserting the data into the DictionaryBase
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to insert</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnInsertComplete (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked before changing a value for a key in the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Derived classes can override this method and perform some
+ /// action before the <paramref name="current_value"/> is changed
+ /// in the dictionary.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to change</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnSet (object key, object current_value, object new_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after changing a value for a key in the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to change</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnSetComplete (object key, object current_value, object new_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked before removing a key/value from the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Derived classes can override this method and perform some
+ /// action before the <paramref name="current_value"/> is removed
+ /// from the dictionary.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to remove</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnRemove (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after removing a key/value from the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to remove</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnRemoveComplete (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after the value has been validated
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to monitor the DictionaryBase.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to retrieve</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnValidate (object key, object current_value)
+ {
+ }
+
+ bool IDictionary.IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ bool IDictionary.IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ object IDictionary.this [object key] {
+ get {
+ object value = dictionary [key];
+
+ OnGet (key, value);
+ return value;
+ }
+
+ set {
+ if (dictionary.ContainsKey (key)){
+ object current_value = dictionary [key];
+ OnSet (key, current_value, value);
+ dictionary [key] = value;
+ OnSetComplete (key, current_value, value);
+ } else {
+ OnInsert (key, value);
+ dictionary [key] = value;
+ OnInsertComplete (key, value);
+ }
+ }
+ }
+
+ ICollection IDictionary.Keys {
+ get {
+ return dictionary.Keys;
+ }
+ }
+
+ ICollection IDictionary.Values {
+ get {
+ return dictionary.Values;
+ }
+ }
+
+ /// <summary>
+ /// Adds a key/value pair to the dictionary.
+ /// </summary>
+ void IDictionary.Add (object key, object value)
+ {
+ OnInsert (key, value);
+ dictionary.Add (key, value);
+ OnInsertComplete (key, value);
+ }
+
+ /// <summary>
+ /// Removes a Dictionary Entry based on its key
+ /// </summary>
+ void IDictionary.Remove (object key)
+ {
+ if (! dictionary.ContainsKey (key))
+ return;
+
+ object value = dictionary [key];
+ OnRemove (key, value);
+ dictionary.Remove (key);
+ OnRemoveComplete (key, value);
+ }
+
+ /// <summary>
+ /// Tests whether the dictionary contains an entry
+ /// </summary>
+ bool IDictionary.Contains (object key)
+ {
+ return dictionary.Contains (key);
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return dictionary.IsSynchronized;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return dictionary.SyncRoot;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return dictionary.GetEnumerator ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/DictionaryEntry.cs b/mcs/class/corlib/System.Collections/DictionaryEntry.cs
new file mode 100644
index 00000000000..e6cafab7cda
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/DictionaryEntry.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace System.Collections {
+
+ [Serializable]
+ public struct DictionaryEntry {
+ private object key;
+ private object val;
+
+ public DictionaryEntry( object k, object value) {
+ key = k;
+ val = value;
+ }
+
+ public object Key {
+ get {return key;}
+ set {key = value;}
+ }
+ public object Value {
+ get {return val;}
+ set {val = value;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/Hashtable.cs b/mcs/class/corlib/System.Collections/Hashtable.cs
new file mode 100644
index 00000000000..b3b654591cc
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Hashtable.cs
@@ -0,0 +1,1047 @@
+//
+// System.Collections.Hashtable
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+
+// TODO: Interfaces to implement: ISerializable and IDeserializationCallback;
+
+
+namespace System.Collections {
+
+ [MonoTODO]
+ [Serializable]
+ public class Hashtable : IDictionary, ICollection,
+ IEnumerable, ICloneable, ISerializable, IDeserializationCallback
+ {
+
+ internal struct Slot {
+ internal Object key;
+
+ internal Object value;
+
+ // Hashcode. Chains are also marked through this.
+ internal int hashMix;
+ }
+
+ //
+ // Private data
+ //
+
+ private readonly static int CHAIN_MARKER = ~Int32.MaxValue;
+
+
+ // Used as indicator for the removed parts of a chain.
+ private readonly static Object REMOVED_MARKER = new Object ();
+
+
+ private int inUse;
+ private int modificationCount;
+ private float loadFactor;
+ private Slot [] table;
+ private int threshold;
+
+ private IHashCodeProvider hcpRef;
+ private IComparer comparerRef;
+
+ private static int [] primeTbl = {
+ 11,
+ 19,
+ 37,
+ 73,
+ 109,
+ 163,
+ 251,
+ 367,
+ 557,
+ 823,
+ 1237,
+ 1861,
+ 2777,
+ 4177,
+ 6247,
+ 9371,
+ 14057,
+ 21089,
+ 31627,
+ 47431,
+ 71143,
+ 106721,
+ 160073,
+ 240101,
+ 360163,
+ 540217,
+ 810343,
+ 1215497,
+ 1823231,
+ 2734867,
+ 4102283,
+ 6153409,
+ 9230113,
+ 13845163
+ };
+
+ // Class constructor
+
+ static Hashtable () {
+ // NOTE: previously this static constructor was used
+ // to calculate primeTbl, now primeTbl is
+ // hardcoded and constructor does nothing
+ // useful except for forcing compiler to
+ // eliminate beforefieldinit from signature.
+ }
+
+
+ //
+ // Constructors
+ //
+
+ public Hashtable () : this (0, 1.0f) {}
+
+
+ public Hashtable (int capacity, float loadFactor, IHashCodeProvider hcp, IComparer comparer) {
+ if (capacity<0)
+ throw new ArgumentOutOfRangeException ("negative capacity");
+
+ if (loadFactor<0.1 || loadFactor>1)
+ throw new ArgumentOutOfRangeException ("load factor");
+
+ if (capacity == 0) ++capacity;
+ this.loadFactor = 0.75f*loadFactor;
+ int size = (int) (capacity/this.loadFactor);
+ size = ToPrime (size);
+ this.SetTable (new Slot [size]);
+
+ this.hcp = hcp;
+ this.comparer = comparer;
+
+ this.inUse = 0;
+ this.modificationCount = 0;
+
+ }
+
+ public Hashtable (int capacity, float loadFactor) :
+ this (capacity, loadFactor, null, null)
+ {
+ }
+
+ public Hashtable (int capacity) : this (capacity, 1.0f)
+ {
+ }
+
+ public Hashtable (int capacity,
+ IHashCodeProvider hcp,
+ IComparer comparer)
+ : this (capacity, 1.0f, hcp, comparer)
+ {
+ }
+
+
+ public Hashtable (IDictionary d, float loadFactor,
+ IHashCodeProvider hcp, IComparer comparer)
+ : this (d!=null ? d.Count : 0,
+ loadFactor, hcp, comparer)
+ {
+
+ if (d == null)
+ throw new ArgumentNullException ("dictionary");
+
+ IDictionaryEnumerator it = d.GetEnumerator ();
+ while (it.MoveNext ()) {
+ Add (it.Key, it.Value);
+ }
+
+ }
+
+ public Hashtable (IDictionary d, float loadFactor)
+ : this (d, loadFactor, null, null)
+ {
+ }
+
+
+ public Hashtable (IDictionary d) : this (d, 1.0f)
+ {
+ }
+
+ public Hashtable (IDictionary d, IHashCodeProvider hcp, IComparer comparer)
+ : this (d, 1.0f, hcp, comparer)
+ {
+ }
+
+ public Hashtable (IHashCodeProvider hcp, IComparer comparer)
+ : this (1, 1.0f, hcp, comparer)
+ {
+ }
+
+ [MonoTODO]
+ protected Hashtable (SerializationInfo info, StreamingContext context)
+ {
+// loadFactor = info.GetValue ("LoadFactor", Type.GetType ("System.Float"));
+// comparerRef = info.GetValue ("Comparer", typeof (object));
+// hcpRef = info.GetValue ("HashCodeProvider", typeof (object));
+// this.Count = info.GetValue ("HashSize");
+// this.Keys = info.GetValue ("Keys");
+// this.Values = info.GetValue ("Values");
+ }
+
+ //
+ // Properties
+ //
+
+ protected IComparer comparer {
+ set {
+ comparerRef = value;
+ }
+ get {
+ return comparerRef;
+ }
+ }
+
+ protected IHashCodeProvider hcp {
+ set {
+ hcpRef = value;
+ }
+ get {
+ return hcpRef;
+ }
+ }
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return inUse;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+
+
+ // IDictionary
+
+ public virtual bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+
+ public virtual bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public virtual ICollection Keys {
+ get {
+ return new HashKeys (this);
+ }
+ }
+
+ public virtual ICollection Values {
+ get {
+ return new HashValues (this);
+ }
+ }
+
+
+
+ public virtual Object this [Object key] {
+ get {
+ return GetImpl (key);
+ }
+ set {
+ PutImpl (key, value, true);
+ }
+ }
+
+
+
+
+ //
+ // Interface methods
+ //
+
+
+ // IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.KEY_MODE);
+ }
+
+
+ // ICollection
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ if (null == array)
+ throw new ArgumentNullException ("array");
+
+ if (arrayIndex < 0)
+ throw new ArgumentOutOfRangeException ("arrayIndex");
+
+ if (array.Rank > 1)
+ throw new ArgumentException ("array is multidimensional");
+
+ if (arrayIndex >= array.Length)
+ throw new ArgumentException ("arrayIndex is equal to or greater than array.Length");
+
+ if (arrayIndex + this.inUse > array.Length)
+ throw new ArgumentException ("Not enough room from arrayIndex to end of array for this Hashtable");
+
+ IDictionaryEnumerator it = GetEnumerator ();
+ int i = arrayIndex;
+
+ while (it.MoveNext ()) {
+ array.SetValue (it.Entry, i++);
+ }
+ }
+
+
+ // IDictionary
+
+ public virtual void Add (Object key, Object value)
+ {
+ PutImpl (key, value, false);
+ }
+
+ public virtual void Clear ()
+ {
+ for (int i = 0;i<table.Length;i++) {
+ table [i].key = null;
+ table [i].value = null;
+ table [i].hashMix = 0;
+ }
+
+ inUse = 0;
+ modificationCount++;
+ }
+
+ public virtual bool Contains (Object key)
+ {
+ return (Find (key) >= 0);
+ }
+
+ public virtual IDictionaryEnumerator GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.ENTRY_MODE);
+ }
+
+ public virtual void Remove (Object key)
+ {
+ int i = Find (key);
+ Slot [] table = this.table;
+ if (i >= 0) {
+ int h = table [i].hashMix;
+ h &= CHAIN_MARKER;
+ table [i].hashMix = h;
+ table [i].key = (h != 0)
+ ? REMOVED_MARKER
+ : null;
+ table [i].value = null;
+ --inUse;
+ ++modificationCount;
+ }
+ }
+
+
+
+
+ public virtual bool ContainsKey (object key)
+ {
+ return Contains (key);
+ }
+
+ public virtual bool ContainsValue (object value)
+ {
+ int size = this.table.Length;
+ Slot [] table = this.table;
+
+ for (int i = 0; i < size; i++) {
+ Slot entry = table [i];
+ if (entry.key != null && entry.key!= REMOVED_MARKER
+ && value.Equals (entry.value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ // ICloneable
+
+ public virtual object Clone ()
+ {
+ Hashtable ht = new Hashtable (Count, hcp, comparer);
+ ht.modificationCount = this.modificationCount;
+ ht.inUse = this.inUse;
+ ht.AdjustThreshold ();
+
+ // FIXME: maybe it's faster to simply
+ // copy the back-end array?
+
+ IDictionaryEnumerator it = GetEnumerator ();
+ while (it.MoveNext ()) {
+ ht [it.Key] = it.Value;
+ }
+
+ return ht;
+ }
+
+ [MonoTODO]
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("LoadFactor", loadFactor);
+ info.AddValue ("Version", modificationCount);
+ info.AddValue ("Comparer", comparerRef);
+ info.AddValue ("HashCodeProvider", hcpRef);
+ info.AddValue ("HashSize", this.Count );
+ info.AddValue ("Keys", this.Keys);
+ info.AddValue ("Values", this.Values);
+ }
+
+ [MonoTODO]
+ public virtual void OnDeserialization (object sender)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Returns a synchronized (thread-safe)
+ /// wrapper for the Hashtable.
+ /// </summary>
+ public static Hashtable Synchronized (Hashtable table)
+ {
+ return new SynchedHashtable (table);
+ }
+
+
+
+ //
+ // Protected instance methods
+ //
+
+ /// <summary>Returns the hash code for the specified key.</summary>
+ protected virtual int GetHash (Object key)
+ {
+ IHashCodeProvider hcp = this.hcp;
+ return (hcp!= null)
+ ? hcp.GetHashCode (key)
+ : key.GetHashCode ();
+ }
+
+ /// <summary>
+ /// Compares a specific Object with a specific key
+ /// in the Hashtable.
+ /// </summary>
+ protected virtual bool KeyEquals (Object item, Object key)
+ {
+ IComparer c = this.comparer;
+ if (c!= null)
+ return (c.Compare (item, key) == 0);
+ else
+ return item.Equals (key);
+ }
+
+
+
+ //
+ // Private instance methods
+ //
+
+ private void AdjustThreshold ()
+ {
+ int size = table.Length;
+
+ threshold = (int) (size*loadFactor);
+ if (this.threshold >= size)
+ threshold = size-1;
+ }
+
+ private void SetTable (Slot [] table)
+ {
+ if (table == null)
+ throw new ArgumentNullException ("table");
+
+ this.table = table;
+ AdjustThreshold ();
+ }
+
+ private Object GetImpl (Object key)
+ {
+ int i = Find (key);
+
+ if (i >= 0)
+ return table [i].value;
+ else
+ return null;
+ }
+
+
+ private int Find (Object key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("null key");
+
+ uint size = (uint) this.table.Length;
+ int h = this.GetHash (key) & Int32.MaxValue;
+ uint spot = (uint)h;
+ uint step = (uint) ((h >> 5)+1) % (size-1)+1;
+ Slot[] table = this.table;
+
+ for (int i = 0; i < size;i++) {
+ int indx = (int) (spot % size);
+ Slot entry = table [indx];
+ Object k = entry.key;
+ if (k == null)
+ return -1;
+ if ((entry.hashMix & Int32.MaxValue) == h
+ && this.KeyEquals (key, k)) {
+ return indx;
+ }
+
+ if ((entry.hashMix & CHAIN_MARKER) == 0)
+ return -1;
+
+ spot+= step;
+ }
+ return -1;
+ }
+
+
+ private void Rehash ()
+ {
+ int oldSize = this.table.Length;
+
+ // From the SDK docs:
+ // Hashtable is automatically increased
+ // to the smallest prime number that is larger
+ // than twice the current number of Hashtable buckets
+ uint newSize = (uint)ToPrime ((oldSize<<1)|1);
+
+
+ Slot [] newTable = new Slot [newSize];
+ Slot [] table = this.table;
+
+ for (int i = 0;i<oldSize;i++) {
+ Slot s = table [i];
+ if (s.key!= null) {
+ int h = s.hashMix & Int32.MaxValue;
+ uint spot = (uint)h;
+ uint step = ((uint) (h>>5)+1)% (newSize-1)+1;
+ for (uint j = spot%newSize;;spot+= step, j = spot%newSize) {
+ // No check for REMOVED_MARKER here,
+ // because the table is just allocated.
+ if (newTable [j].key == null) {
+ newTable [j].key = s.key;
+ newTable [j].value = s.value;
+ newTable [j].hashMix |= h;
+ break;
+ } else {
+ newTable [j].hashMix |= CHAIN_MARKER;
+ }
+ }
+ }
+ }
+
+ ++this.modificationCount;
+
+ this.SetTable (newTable);
+ }
+
+
+ private void PutImpl (Object key, Object value, bool overwrite)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("null key");
+
+ uint size = (uint)this.table.Length;
+ if (this.inUse >= this.threshold) {
+ this.Rehash ();
+ size = (uint)this.table.Length;
+ }
+
+ int h = this.GetHash (key) & Int32.MaxValue;
+ uint spot = (uint)h;
+ uint step = (uint) ((spot>>5)+1)% (size-1)+1;
+ Slot [] table = this.table;
+ Slot entry;
+
+ int freeIndx = -1;
+ for (int i = 0; i < size; i++) {
+ int indx = (int) (spot % size);
+ entry = table [indx];
+
+ if (freeIndx == -1
+ && entry.key == REMOVED_MARKER
+ && (entry.hashMix & CHAIN_MARKER)!= 0)
+ freeIndx = indx;
+
+ if (entry.key == null ||
+ (entry.key == REMOVED_MARKER
+ && (entry.hashMix & CHAIN_MARKER)!= 0)) {
+
+ if (freeIndx == -1)
+ freeIndx = indx;
+ break;
+ }
+
+ if ((entry.hashMix & Int32.MaxValue) == h && KeyEquals (key, entry.key)) {
+ if (overwrite) {
+ table [indx].value = value;
+ ++this.modificationCount;
+ } else {
+ // Handle Add ():
+ // An entry with the same key already exists in the Hashtable.
+ throw new ArgumentException (
+ "Key duplication when adding: " + key);
+ }
+ return;
+ }
+
+ if (freeIndx == -1) {
+ table [indx].hashMix |= CHAIN_MARKER;
+ }
+
+ spot+= step;
+
+ }
+
+ if (freeIndx!= -1) {
+ table [freeIndx].key = key;
+ table [freeIndx].value = value;
+ table [freeIndx].hashMix |= h;
+
+ ++this.inUse;
+ ++this.modificationCount;
+ }
+
+ }
+
+ private void CopyToArray (Array arr, int i,
+ EnumeratorMode mode)
+ {
+ IEnumerator it = new Enumerator (this, mode);
+
+ while (it.MoveNext ()) {
+ arr.SetValue (it.Current, i++);
+ }
+ }
+
+
+
+ //
+ // Private static methods
+ //
+ private static bool TestPrime (int x)
+ {
+ if ((x & 1) != 0) {
+ for (int n = 3; n< (int)Math.Sqrt (x); n += 2) {
+ if ((x % n) == 0)
+ return false;
+ }
+ return true;
+ }
+ // There is only one even prime - 2.
+ return (x == 2);
+ }
+
+ private static int CalcPrime (int x)
+ {
+ for (int i = (x & (~1))-1; i< Int32.MaxValue; i += 2) {
+ if (TestPrime (i)) return i;
+ }
+ return x;
+ }
+
+ private static int ToPrime (int x)
+ {
+ for (int i = 0; i < primeTbl.Length; i++) {
+ if (x <= primeTbl [i])
+ return primeTbl [i];
+ }
+ return CalcPrime (x);
+ }
+
+
+
+
+ //
+ // Inner classes
+ //
+
+ public enum EnumeratorMode : int {KEY_MODE = 0, VALUE_MODE, ENTRY_MODE};
+
+ protected sealed class Enumerator : IDictionaryEnumerator, IEnumerator {
+
+ private Hashtable host;
+ private int stamp;
+ private int pos;
+ private int size;
+ private EnumeratorMode mode;
+
+ private Object currentKey;
+ private Object currentValue;
+
+ private readonly static string xstr = "Hashtable.Enumerator: snapshot out of sync.";
+
+ public Enumerator (Hashtable host, EnumeratorMode mode) {
+ this.host = host;
+ stamp = host.modificationCount;
+ size = host.table.Length;
+ this.mode = mode;
+ Reset ();
+ }
+
+ public Enumerator (Hashtable host)
+ : this (host, EnumeratorMode.KEY_MODE) {}
+
+
+ private void FailFast ()
+ {
+ if (host.modificationCount != stamp) {
+ throw new InvalidOperationException (xstr);
+ }
+ }
+
+ public void Reset ()
+ {
+ FailFast ();
+
+ pos = -1;
+ currentKey = null;
+ currentValue = null;
+ }
+
+ public bool MoveNext ()
+ {
+ FailFast ();
+
+ if (pos < size) {
+ while (++pos < size) {
+ Slot entry = host.table [pos];
+
+ if (entry.key != null && entry.key != REMOVED_MARKER) {
+ currentKey = entry.key;
+ currentValue = entry.value;
+ return true;
+ }
+ }
+ }
+
+ currentKey = null;
+ currentValue = null;
+ return false;
+ }
+
+ public DictionaryEntry Entry
+ {
+ get {
+ FailFast ();
+ return new DictionaryEntry (currentKey, currentValue);
+ }
+ }
+
+ public Object Key {
+ get {
+ FailFast ();
+ return currentKey;
+ }
+ }
+
+ public Object Value {
+ get {
+ FailFast ();
+ return currentValue;
+ }
+ }
+
+ public Object Current {
+ get {
+ FailFast ();
+ switch (mode) {
+ case EnumeratorMode.KEY_MODE:
+ return currentKey;
+ case EnumeratorMode.VALUE_MODE:
+ return currentValue;
+ case EnumeratorMode.ENTRY_MODE:
+ return new DictionaryEntry (currentKey, currentValue);
+ }
+ throw new Exception ("should never happen");
+ }
+ }
+ }
+
+
+
+ protected class HashKeys : ICollection, IEnumerable {
+
+ private Hashtable host;
+ private int count;
+
+ public HashKeys (Hashtable host) {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ this.count = host.Count;
+ }
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {return host.SyncRoot;}
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.KEY_MODE);
+ }
+
+ // IEnumerable
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new Hashtable.Enumerator (host, EnumeratorMode.KEY_MODE);
+ }
+ }
+
+
+ protected class HashValues : ICollection, IEnumerable {
+
+ private Hashtable host;
+ private int count;
+
+ public HashValues (Hashtable host) {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ this.count = host.Count;
+ }
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.VALUE_MODE);
+ }
+
+ // IEnumerable
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new Hashtable.Enumerator (host, EnumeratorMode.VALUE_MODE);
+ }
+ }
+
+
+
+ protected class SynchedHashtable : Hashtable, IEnumerable {
+
+ private Hashtable host;
+
+ public SynchedHashtable (Hashtable host) {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ }
+
+ // ICollection
+
+ public override int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public override bool IsSynchronized {
+ get {
+ return true;
+ }
+ }
+
+ public override Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+
+
+ // IDictionary
+
+ public override bool IsFixedSize {
+ get {
+ return host.IsFixedSize;
+ }
+ }
+
+
+ public override bool IsReadOnly {
+ get {
+ return host.IsReadOnly;
+ }
+ }
+
+ public override ICollection Keys {
+ get {
+ ICollection keys = null;
+ lock (host.SyncRoot) {
+ keys = host.Keys;
+ }
+ return keys;
+ }
+ }
+
+ public override ICollection Values {
+ get {
+ ICollection vals = null;
+ lock (host.SyncRoot) {
+ vals = host.Values;
+ }
+ return vals;
+ }
+ }
+
+
+
+ public override Object this [Object key] {
+ get {
+ return host.GetImpl (key);
+ }
+ set {
+ lock (host.SyncRoot) {
+ host.PutImpl (key, value, true);
+ }
+ }
+ }
+
+ // IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new Enumerator (host, EnumeratorMode.KEY_MODE);
+ }
+
+
+
+
+ // ICollection
+
+ public override void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyTo (array, arrayIndex);
+ }
+
+
+ // IDictionary
+
+ public override void Add (Object key, Object value)
+ {
+ lock (host.SyncRoot) {
+ host.PutImpl (key, value, false);
+ }
+ }
+
+ public override void Clear ()
+ {
+ lock (host.SyncRoot) {
+ host.Clear ();
+ }
+ }
+
+ public override bool Contains (Object key)
+ {
+ return (host.Find (key) >= 0);
+ }
+
+ public override IDictionaryEnumerator GetEnumerator ()
+ {
+ return new Enumerator (host, EnumeratorMode.ENTRY_MODE);
+ }
+
+ public override void Remove (Object key)
+ {
+ lock (host.SyncRoot) {
+ host.Remove (key);
+ }
+ }
+
+
+
+ public override bool ContainsKey (object key)
+ {
+ return host.Contains (key);
+ }
+
+ public override bool ContainsValue (object value)
+ {
+ return host.ContainsValue (value);
+ }
+
+
+ // ICloneable
+
+ public override object Clone ()
+ {
+ return (host.Clone () as Hashtable);
+ }
+
+ } // SynchedHashtable
+
+
+ } // Hashtable
+
+}
+
diff --git a/mcs/class/corlib/System.Collections/ICollection.cs b/mcs/class/corlib/System.Collections/ICollection.cs
new file mode 100644
index 00000000000..2189931cae8
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ICollection.cs
@@ -0,0 +1,24 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.ICollection
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface ICollection : IEnumerable {
+ int Count { get; }
+
+ bool IsSynchronized { get; }
+
+ object SyncRoot { get; }
+
+ void CopyTo (Array array, int index);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IComparer.cs b/mcs/class/corlib/System.Collections/IComparer.cs
new file mode 100644
index 00000000000..3d1ee2ef609
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IComparer.cs
@@ -0,0 +1,19 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IComparer
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IComparer {
+ int Compare (object x, object y);
+ }
+
+}
diff --git a/mcs/class/corlib/System.Collections/IDictionary.cs b/mcs/class/corlib/System.Collections/IDictionary.cs
new file mode 100644
index 00000000000..a03ab07d904
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IDictionary.cs
@@ -0,0 +1,40 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IDictionary
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IDictionary : ICollection {
+ // properties
+
+ bool IsFixedSize { get; }
+
+ bool IsReadOnly { get; }
+
+ object this[object key] { get; set; }
+
+ ICollection Keys { get; }
+
+ ICollection Values { get; }
+
+ // methods
+
+ void Add (object key, object value);
+
+ void Clear ();
+
+ bool Contains (object key);
+
+ new IDictionaryEnumerator GetEnumerator ();
+
+ void Remove (object key);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs b/mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs
new file mode 100644
index 00000000000..fb1998d55f0
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs
@@ -0,0 +1,20 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IDictionaryEnumerator
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IDictionaryEnumerator : IEnumerator {
+ DictionaryEntry Entry { get; }
+ object Key { get; }
+ object Value { get; }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IEnumerable.cs b/mcs/class/corlib/System.Collections/IEnumerable.cs
new file mode 100644
index 00000000000..c5b51fb3715
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IEnumerable.cs
@@ -0,0 +1,20 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IEnumerable
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Collections {
+ [Guid("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
+ public interface IEnumerable {
+ [DispId(-4)]
+ IEnumerator GetEnumerator();
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IEnumerator.cs b/mcs/class/corlib/System.Collections/IEnumerator.cs
new file mode 100644
index 00000000000..06d250c8b7e
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IEnumerator.cs
@@ -0,0 +1,22 @@
+//
+// System.Collections.IEnumerator
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IEnumerator {
+ object Current { get; }
+
+ bool MoveNext ();
+
+ void Reset ();
+ }
+
+}
diff --git a/mcs/class/corlib/System.Collections/IHashCodeProvider.cs b/mcs/class/corlib/System.Collections/IHashCodeProvider.cs
new file mode 100644
index 00000000000..15fc4df45bf
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IHashCodeProvider.cs
@@ -0,0 +1,18 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IHashCodeProvider
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IHashCodeProvider {
+ int GetHashCode (object obj);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IList.cs b/mcs/class/corlib/System.Collections/IList.cs
new file mode 100644
index 00000000000..e039a8358c3
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IList.cs
@@ -0,0 +1,40 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IList
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IList : ICollection, IEnumerable {
+ // properties
+
+ bool IsFixedSize { get; }
+
+ bool IsReadOnly { get; }
+
+ object this[int index] { get; set; }
+
+ // methods
+
+ int Add (object value);
+
+ void Clear ();
+
+ bool Contains (object value);
+
+ int IndexOf (object value);
+
+ void Insert (int index, object value);
+
+ void Remove (object value);
+
+ void RemoveAt (int index);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/Queue.cs b/mcs/class/corlib/System.Collections/Queue.cs
new file mode 100644
index 00000000000..f640dfc4a36
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Queue.cs
@@ -0,0 +1,350 @@
+//
+// System.Collections.Queue
+//
+// Author:
+// Ricardo Fernández Pascual
+//
+// (C) 2001 Ricardo Fernández Pascual
+//
+
+using System;
+using System.Collections;
+
+namespace System.Collections {
+
+ [Serializable]
+ public class Queue : ICollection, IEnumerable, ICloneable {
+
+ private object[] contents;
+ private int head = 0; // points to the first used slot
+ private int count = 0;
+ private int capacity = 16;
+ private float growFactor = 2.0F;
+ private int modCount = 0;
+
+ public Queue () {
+ contents = new object[capacity];
+ }
+
+ public Queue (ICollection collection) {
+ capacity = collection.Count;
+ contents = new object[capacity];
+ count = capacity;
+ collection.CopyTo (contents, 0);
+ }
+
+ public Queue (int initialCapacity) {
+ capacity = initialCapacity;
+ contents = new object[capacity];
+ }
+
+ public Queue (int initialCapacity, float growFactor) {
+ capacity = initialCapacity;
+ contents = new object[capacity];
+ // LAMESPEC: The spec says nothing, but I think this
+ // should throw an exception if growFactor <= 1.0
+ this.growFactor = growFactor;
+ }
+
+ // from ICollection
+
+ public virtual int Count {
+ get { return count; }
+ }
+
+ public virtual bool IsSynchronized {
+ get { return false; }
+ }
+
+ public virtual object SyncRoot {
+ get { return this; }
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException ();
+ }
+
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ if (array.Rank > 1
+ || index >= array.Length
+ || count > array.Length - index) {
+ throw new ArgumentException ();
+ }
+
+ int contents_length = contents.Length;
+ int length_from_head = contents_length - head;
+ // copy the contents of the circular array
+ Array.Copy (contents, head, array, index,
+ Math.Min (count, length_from_head));
+ if (count > length_from_head)
+ Array.Copy (contents, 0, array,
+ index + length_from_head,
+ count - length_from_head);
+ }
+
+ // from IEnumerable
+
+ public virtual IEnumerator GetEnumerator () {
+ return new QueueEnumerator (this);
+ }
+
+ // from ICloneable
+
+ public virtual object Clone () {
+ Queue newQueue;
+
+ newQueue = new Queue (); // FIXME: improve this...
+
+ newQueue.contents = new object[this.contents.Length];
+ Array.Copy (this.contents, 0, newQueue.contents, 0,
+ this.contents.Length);
+ newQueue.head = this.head;
+ newQueue.count = this.count;
+ newQueue.capacity = this.capacity;
+ newQueue.growFactor = this.growFactor;
+
+ return newQueue;
+ }
+
+ // FIXME: should override Equals?
+
+ // from Queue spec
+
+/*
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+*/
+
+ public virtual void Clear () {
+ modCount++;
+ head = 0;
+ count = 0;
+ // FIXME: Should allocate a new contents array?
+ // Should null the current array?
+ }
+
+ public virtual bool Contains (object obj) {
+ int tail = head + count;
+ if (obj == null) {
+ for (int i = head; i < tail; i++) {
+ if (contents[i % capacity] == null)
+ return true;
+ }
+ } else {
+ for (int i = head; i < tail; i++) {
+ if (obj.Equals (contents[i % capacity]))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public virtual object Dequeue ()
+ {
+ modCount++;
+ if (count < 1)
+ throw new InvalidOperationException ();
+ object result = contents[head];
+ head = (head + 1) % capacity;
+ count--;
+ return result;
+ }
+
+ public virtual void Enqueue (object obj) {
+ modCount++;
+ if (count == capacity)
+ grow ();
+ contents[(head + count) % capacity] = obj;
+ count++;
+
+ }
+
+ public virtual object Peek () {
+ if (count < 1)
+ throw new InvalidOperationException ();
+ return contents[head];
+ }
+
+ public static Queue Synchronized (Queue queue) {
+ if (queue == null) {
+ throw new ArgumentNullException ();
+ }
+ return new SyncQueue (queue);
+ }
+
+ public virtual object[] ToArray () {
+ object[] ret = new object[count];
+ CopyTo (ret, 0);
+ return ret;
+ }
+
+ public virtual void TrimToSize() {
+ object[] trimmed = new object [count];
+ CopyTo (trimmed, 0);
+ contents = trimmed;
+ }
+
+ // private methods
+
+ private void grow () {
+ int newCapacity = (int) Math.Ceiling
+ (contents.Length * growFactor);
+ object[] newContents = new object[newCapacity];
+ CopyTo (newContents, 0);
+ contents = newContents;
+ capacity = newCapacity;
+ head = 0;
+ }
+
+ // private classes
+
+ private class SyncQueue : Queue {
+ Queue queue;
+
+ internal SyncQueue (Queue queue) {
+ this.queue = queue;
+ }
+
+ public override int Count {
+ get {
+ lock (queue) {
+ return queue.count;
+ }
+ }
+ }
+
+ public override bool IsSynchronized {
+ get {
+ return true;
+ }
+ }
+
+ public override object SyncRoot {
+ get {
+ return queue.SyncRoot;
+ }
+ }
+
+ public override void CopyTo (Array array, int index) {
+ lock (queue) {
+ queue.CopyTo (array, index);
+ }
+ }
+
+ public override IEnumerator GetEnumerator () {
+ lock (queue) {
+ return queue.GetEnumerator ();
+ }
+ }
+
+ public override object Clone () {
+ lock (queue) {
+ return queue.Clone ();
+ }
+ }
+
+/*
+ public override bool IsReadOnly {
+ get {
+ lock (queue) {
+ return queue.IsReadOnly;
+ }
+ }
+ }
+*/
+
+ public override void Clear () {
+ lock (queue) {
+ queue.Clear ();
+ }
+ }
+
+ public override bool Contains (object obj) {
+ lock (queue) {
+ return queue.Contains (obj);
+ }
+ }
+
+ public override object Dequeue () {
+ lock (queue) {
+ return queue.Dequeue ();
+ }
+ }
+
+ public override void Enqueue (object obj) {
+ lock (queue) {
+ queue.Enqueue (obj);
+ }
+ }
+
+ public override object Peek () {
+ lock (queue) {
+ return queue.Peek ();
+ }
+ }
+
+ public override object[] ToArray () {
+ lock (queue) {
+ return queue.ToArray ();
+ }
+ }
+ }
+
+ [Serializable]
+ private class QueueEnumerator : IEnumerator, ICloneable {
+ Queue queue;
+ private int modCount;
+ private int current;
+
+ internal QueueEnumerator (Queue q) {
+ queue = q;
+ modCount = q.modCount;
+ current = -1; // one element before the head
+ }
+
+ public object Clone ()
+ {
+ QueueEnumerator q = new QueueEnumerator (queue);
+ q.modCount = modCount;
+ q.current = current;
+ return q;
+ }
+
+ public virtual object Current {
+ get {
+ if (modCount != queue.modCount
+ || current < 0
+ || current >= queue.count)
+ throw new InvalidOperationException ();
+ return queue.contents[(queue.head + current) % queue.contents.Length];
+ }
+ }
+
+ public virtual bool MoveNext () {
+ if (modCount != queue.modCount) {
+ throw new InvalidOperationException ();
+ }
+
+ if (current >= queue.count - 1) {
+ return false;
+ } else {
+ current++;
+ return true;
+ }
+ }
+
+ public virtual void Reset () {
+ if (modCount != queue.modCount) {
+ throw new InvalidOperationException();
+ }
+ current = -1;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs b/mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs
new file mode 100644
index 00000000000..9aafb5ff282
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs
@@ -0,0 +1,45 @@
+//
+// System.Collections.ReadOnlyCollectionBase.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+
+namespace System.Collections {
+
+ [Serializable]
+ public abstract class ReadOnlyCollectionBase : ICollection, IEnumerable {
+
+ // private instance properties
+ private System.Collections.ArrayList myList;
+
+ // public instance properties
+ public int Count { get { return InnerList.Count; } }
+
+ // Public Instance Methods
+ public System.Collections.IEnumerator GetEnumerator() { return InnerList.GetEnumerator(); }
+
+ // Protected Instance Constructors
+ protected ReadOnlyCollectionBase() {
+ this.myList = new System.Collections.ArrayList();
+ }
+
+ // Protected Instance Properties
+ protected System.Collections.ArrayList InnerList {get { return this.myList; } }
+
+ // ICollection methods
+ void ICollection.CopyTo(Array array, int index) {
+ lock (InnerList) { InnerList.CopyTo(array, index); }
+ }
+ object ICollection.SyncRoot {
+ get { return InnerList.SyncRoot; }
+ }
+ bool ICollection.IsSynchronized {
+ get { return InnerList.IsSynchronized; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/SortedList.cs b/mcs/class/corlib/System.Collections/SortedList.cs
new file mode 100644
index 00000000000..e36500a2845
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/SortedList.cs
@@ -0,0 +1,1134 @@
+//
+// System.Collections.SortedList
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Collections {
+
+ /// <summary>
+ /// Represents a collection of associated keys and values
+ /// that are sorted by the keys and are accessible by key
+ /// and by index.
+ /// </summary>
+ [Serializable]
+ public class SortedList : IDictionary, ICollection,
+ IEnumerable, ICloneable {
+
+
+ internal struct Slot {
+ internal Object key;
+ internal Object value;
+ }
+
+ private readonly static int INITIAL_SIZE = 16;
+
+ public enum EnumeratorMode : int {KEY_MODE = 0, VALUE_MODE}
+
+ private int inUse;
+ private int modificationCount;
+ private Slot[] table;
+ private IComparer comparer;
+
+ //
+ // Constructors
+ //
+ public SortedList () : this (INITIAL_SIZE)
+ {
+ }
+
+ public SortedList (int initialCapacity)
+ : this (null, initialCapacity)
+ {
+ }
+
+ public SortedList (IComparer comparer, int initialCapacity)
+ {
+ if (initialCapacity < 0)
+ throw new ArgumentOutOfRangeException();
+
+ this.comparer = comparer;
+ InitTable (initialCapacity, true);
+ }
+
+ public SortedList (IComparer comparer)
+ {
+ this.comparer = comparer;
+ InitTable (INITIAL_SIZE, true);
+ }
+
+
+ public SortedList (IDictionary d) : this (d, null)
+ {
+ }
+
+ public SortedList (IDictionary d, IComparer comparer)
+ {
+ if (d == null)
+ throw new ArgumentNullException ("dictionary");
+
+ InitTable (d.Count, true);
+ this.comparer = comparer;
+
+ IDictionaryEnumerator it = d.GetEnumerator ();
+ while (it.MoveNext ()) {
+ if (it.Key is IComparable) {
+ Add (it.Key, it.Value);
+ } else {
+ throw new InvalidCastException("!IComparable");
+ }
+ }
+ }
+
+ //
+ // Properties
+ //
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return inUse;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+
+ // IDictionary
+
+ public virtual bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+
+ public virtual bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public virtual ICollection Keys {
+ get {
+ return new ListKeys (this);
+ }
+ }
+
+ public virtual ICollection Values {
+ get {
+ return new ListValues (this);
+ }
+ }
+
+
+
+ public virtual Object this [Object key] {
+ get {
+ if (key == null)
+ throw new ArgumentNullException();
+ return GetImpl (key);
+ }
+ set {
+ if (key == null)
+ throw new ArgumentNullException();
+ if (IsReadOnly)
+ throw new NotSupportedException("SortedList is Read Only.");
+ if (Find(key) < 0 && IsFixedSize)
+ throw new NotSupportedException("Key not found and SortedList is fixed size.");
+
+ PutImpl (key, value, true);
+ }
+ }
+
+ public virtual int Capacity {
+ get {
+ return table.Length;
+ }
+ set {
+ Slot [] table = this.table;
+ int current = table.Length;
+
+ if (inUse > value)
+ throw new ArgumentOutOfRangeException("capacity too small");
+
+ if (value > current) {
+ Slot [] newTable = new Slot [value];
+ Array.Copy (table, newTable, current);
+ this.table = newTable;
+ }
+ }
+ }
+
+ //
+ // Public instance methods.
+ //
+
+ // IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.KEY_MODE);
+ }
+
+
+ // IDictionary
+
+ public virtual void Add (object key, object value)
+ {
+ PutImpl (key, value, false);
+ }
+
+
+ public virtual void Clear ()
+ {
+ this.table = new Slot [INITIAL_SIZE];
+ inUse = 0;
+ modificationCount++;
+ }
+
+ public virtual bool Contains (object key)
+ {
+ if (null == key)
+ throw new ArgumentNullException();
+
+ try {
+ return (Find (key) >= 0);
+ } catch (Exception) {
+ throw new InvalidOperationException();
+ }
+ }
+
+
+ public virtual IDictionaryEnumerator GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.KEY_MODE);
+ }
+
+ public virtual void Remove (object key)
+ {
+ int i = IndexOfKey (key);
+ if (i >= 0) RemoveAt (i);
+ }
+
+
+ // ICollection
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ if (null == array)
+ throw new ArgumentNullException();
+
+ if (arrayIndex < 0)
+ throw new ArgumentOutOfRangeException();
+
+ if (array.Rank > 1)
+ throw new ArgumentException("array is multi-dimensional");
+ if (arrayIndex >= array.Length)
+ throw new ArgumentNullException("arrayIndex is greater than or equal to array.Length");
+ if (Count > (array.Length - arrayIndex))
+ throw new ArgumentNullException("Not enough space in array from arrayIndex to end of array");
+
+ IDictionaryEnumerator it = GetEnumerator ();
+ int i = arrayIndex;
+
+ while (it.MoveNext ()) {
+ array.SetValue (it.Entry, i++);
+ }
+ }
+
+
+
+ // ICloneable
+
+ public virtual object Clone ()
+ {
+ SortedList sl = new SortedList (this, comparer);
+ sl.modificationCount = this.modificationCount;
+ return sl;
+ }
+
+
+
+
+ //
+ // SortedList
+ //
+
+ public virtual IList GetKeyList ()
+ {
+ return new ListKeys (this);
+ }
+
+
+ public virtual IList GetValueList ()
+ {
+ return new ListValues (this);
+ }
+
+
+ public virtual void RemoveAt (int index)
+ {
+ Slot [] table = this.table;
+ int cnt = Count;
+ if (index >= 0 && index < cnt) {
+ if (index != cnt - 1) {
+ Array.Copy (table, index+1, table, index, cnt-1-index);
+ } else {
+ table [index].key = null;
+ table [index].value = null;
+ }
+ --inUse;
+ ++modificationCount;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+ public virtual int IndexOfKey (object key)
+ {
+ if (null == key)
+ throw new ArgumentNullException();
+
+ int indx = 0;
+ try {
+ indx = Find (key);
+ } catch (Exception) {
+ throw new InvalidOperationException();
+ }
+
+ return (indx | (indx >> 31));
+ }
+
+
+ public virtual int IndexOfValue (object value)
+ {
+ if (null == value)
+ return -1;
+
+ Slot [] table = this.table;
+ int len = table.Length;
+
+ for (int i=0; i < len; i++) {
+ object trialValue = table[i].value;
+ if ((null != trialValue) && (trialValue.Equals (value))) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+
+ public virtual bool ContainsKey (object key)
+ {
+ if (null == key)
+ throw new ArgumentNullException();
+
+ try {
+ return Contains (key);
+ } catch (Exception) {
+ throw new InvalidOperationException();
+ }
+ }
+
+
+ public virtual bool ContainsValue (object value)
+ {
+ return IndexOfValue (value) >= 0;
+ }
+
+
+ public virtual object GetByIndex (int index)
+ {
+ if (index >= 0 && index < Count) {
+ return table [index].value;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+
+ public virtual void SetByIndex (int index, object value)
+ {
+ if (index >= 0 && index < Count) {
+ table [index].value = value;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+
+ public virtual object GetKey (int index)
+ {
+ if (index >= 0 && index < Count) {
+ return table [index].key;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+ public static SortedList Synchronized (SortedList list)
+ {
+ if (list == null)
+ throw new ArgumentNullException (Locale.GetText ("Base list is null."));
+ return new SynchedSortedList (list);
+ }
+
+ public virtual void TrimToSize ()
+ {
+ // From Beta2:
+ // Trimming an empty SortedList sets the capacity
+ // of the SortedList to the default capacity,
+ // not zero.
+ if (Count == 0) Resize (INITIAL_SIZE, false);
+ else Resize (Count, true);
+ }
+
+
+ //
+ // Private methods
+ //
+
+
+ private void Resize (int n, bool copy)
+ {
+ Slot [] table = this.table;
+ Slot [] newTable = new Slot [n];
+ if (copy) Array.Copy (table, 0, newTable, 0, n);
+ this.table = newTable;
+ }
+
+
+ private void EnsureCapacity (int n, int free)
+ {
+ Slot [] table = this.table;
+ Slot [] newTable = null;
+ int cap = Capacity;
+ bool gap = (free >=0 && free < Count);
+
+ if (n > cap) {
+ newTable = new Slot [n << 1];
+ }
+
+ if (newTable != null) {
+ if (gap) {
+ int copyLen = free;
+ if (copyLen > 0) {
+ Array.Copy (table, 0, newTable, 0, copyLen);
+ }
+ copyLen = Count - free;
+ if (copyLen > 0) {
+ Array.Copy (table, free, newTable, free+1, copyLen);
+ }
+ } else {
+ // Just a resizing, copy the entire table.
+ Array.Copy (table, newTable, Count);
+ }
+ this.table = newTable;
+ } else if (gap) {
+ Array.Copy (table, free, table, free+1, Count - free);
+ }
+ }
+
+
+ private void PutImpl (object key, object value, bool overwrite)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("null key");
+
+ Slot [] table = this.table;
+
+ int freeIndx = -1;
+
+ try {
+ freeIndx = Find (key);
+ } catch (Exception) {
+ throw new InvalidOperationException();
+ }
+
+ if (freeIndx >= 0) {
+ if (!overwrite)
+ throw new ArgumentException("element already exists");
+
+ table [freeIndx].value = value;
+ return;
+ }
+
+ freeIndx = ~freeIndx;
+
+ if (freeIndx > Capacity + 1)
+ throw new Exception ("SortedList::internal error ("+key+", "+value+") at ["+freeIndx+"]");
+
+
+ EnsureCapacity (Count+1, freeIndx);
+
+ table = this.table;
+ table [freeIndx].key = key;
+ table [freeIndx].value = value;
+
+ ++inUse;
+ ++modificationCount;
+
+ }
+
+
+ private object GetImpl (object key)
+ {
+ int i = Find (key);
+
+ if (i >= 0)
+ return table [i].value;
+ else
+ return null;
+ }
+
+ private void InitTable (int capacity)
+ {
+ InitTable (capacity, false);
+ }
+
+ private void InitTable (int capacity, bool forceSize) {
+ if (!forceSize && (capacity < INITIAL_SIZE)) capacity = INITIAL_SIZE;
+ this.table = new Slot [capacity];
+ this.inUse = 0;
+ this.modificationCount = 0;
+ }
+
+ private void CopyToArray (Array arr, int i,
+ EnumeratorMode mode)
+ {
+ IEnumerator it = new Enumerator (this, mode);
+
+ while (it.MoveNext ()) {
+ arr.SetValue (it.Current, i++);
+ }
+ }
+
+
+ private int Find (object key)
+ {
+ Slot [] table = this.table;
+ int len = Count;
+
+ if (len == 0) return ~0;
+
+ IComparer comparer = (this.comparer == null)
+ ? Comparer.Default
+ : this.comparer;
+
+ int left = 0;
+ int right = len-1;
+
+ while (left <= right) {
+ int guess = (left + right) >> 1;
+
+ int cmp = comparer.Compare (key, table[guess].key);
+ if (cmp == 0) return guess;
+
+ if (cmp > 0) left = guess+1;
+ else right = guess-1;
+ }
+
+ return ~left;
+ }
+
+
+
+ //
+ // Inner classes
+ //
+
+
+ protected sealed class Enumerator : IDictionaryEnumerator,
+ IEnumerator {
+
+ private SortedList host;
+ private int stamp;
+ private int pos;
+ private int size;
+ private EnumeratorMode mode;
+
+ private object currentKey;
+ private object currentValue;
+
+ private readonly static string xstr = "SortedList.Enumerator: snapshot out of sync.";
+
+ public Enumerator (SortedList host, EnumeratorMode mode)
+ {
+ this.host = host;
+ stamp = host.modificationCount;
+ size = host.Count;
+ this.mode = mode;
+ Reset ();
+ }
+
+ public Enumerator (SortedList host)
+ : this (host, EnumeratorMode.KEY_MODE)
+ {
+ }
+
+
+ private void FailFast ()
+ {
+ if (host.modificationCount != stamp) {
+ throw new InvalidOperationException (xstr);
+ }
+ }
+
+ public void Reset ()
+ {
+ FailFast ();
+
+ pos = -1;
+ currentKey = null;
+ currentValue = null;
+ }
+
+ public bool MoveNext ()
+ {
+ FailFast ();
+
+ Slot [] table = host.table;
+
+ if (++pos < size) {
+ Slot entry = table [pos];
+
+ currentKey = entry.key;
+ currentValue = entry.value;
+ return true;
+ }
+
+ currentKey = null;
+ currentValue = null;
+ return false;
+ }
+
+ public DictionaryEntry Entry
+ {
+ get {
+ FailFast ();
+ return new DictionaryEntry (currentKey,
+ currentValue);
+ }
+ }
+
+ public Object Key {
+ get {
+ FailFast ();
+ return currentKey;
+ }
+ }
+
+ public Object Value {
+ get {
+ FailFast ();
+ return currentValue;
+ }
+ }
+
+ public Object Current {
+ get {
+ FailFast ();
+ return (mode == EnumeratorMode.KEY_MODE)
+ ? currentKey
+ : currentValue;
+ }
+ }
+ }
+
+
+ protected class ListKeys : IList, IEnumerable {
+
+ private SortedList host;
+
+
+ public ListKeys (SortedList host)
+ {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ }
+
+ //
+ // ICollection
+ //
+
+ public virtual int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.KEY_MODE);
+ }
+
+
+ //
+ // IList
+ //
+
+ public virtual bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+
+ public virtual object this [int index] {
+ get {
+ return host.GetKey (index);
+ }
+ set {
+ throw new NotSupportedException("attempt to modify a key");
+ }
+ }
+
+ public virtual int Add (object value)
+ {
+ throw new NotSupportedException("IList::Add not supported");
+ }
+
+ public virtual void Clear ()
+ {
+ throw new NotSupportedException("IList::Clear not supported");
+ }
+
+ public virtual bool Contains (object key)
+ {
+ return host.Contains (key);
+ }
+
+
+ public virtual int IndexOf (object key)
+ {
+ return host.IndexOfKey (key);
+ }
+
+
+ public virtual void Insert (int index, object value)
+ {
+ throw new NotSupportedException("IList::Insert not supported");
+ }
+
+
+ public virtual void Remove (object value)
+ {
+ throw new NotSupportedException("IList::Remove not supported");
+ }
+
+
+ public virtual void RemoveAt (int index)
+ {
+ throw new NotSupportedException("IList::RemoveAt not supported");
+ }
+
+
+ //
+ // IEnumerable
+ //
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new SortedList.Enumerator (host, EnumeratorMode.KEY_MODE);
+ }
+
+
+ }
+
+
+ protected class ListValues : IList, IEnumerable {
+
+ private SortedList host;
+
+
+ public ListValues (SortedList host)
+ {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ }
+
+ //
+ // ICollection
+ //
+
+ public virtual int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.VALUE_MODE);
+ }
+
+
+ //
+ // IList
+ //
+
+ public virtual bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+
+ [MonoTODO]
+ public virtual object this [int index] {
+ get {
+ return host.GetByIndex (index);
+ }
+ set {
+ // FIXME: It seems (according to tests)
+ // that modifications are allowed
+ // in Beta2.
+ // ? host.SetByIndex (index, value);
+ throw new NotSupportedException("attempt to modify a value");
+ }
+ }
+
+ public virtual int Add (object value)
+ {
+ throw new NotSupportedException("IList::Add not supported");
+ }
+
+ public virtual void Clear ()
+ {
+ throw new NotSupportedException("IList::Clear not supported");
+ }
+
+ public virtual bool Contains (object value)
+ {
+ return host.ContainsValue (value);
+ }
+
+
+ public virtual int IndexOf (object value)
+ {
+ return host.IndexOfValue (value);
+ }
+
+
+ public virtual void Insert (int index, object value)
+ {
+ throw new NotSupportedException("IList::Insert not supported");
+ }
+
+
+ public virtual void Remove (object value)
+ {
+ throw new NotSupportedException("IList::Remove not supported");
+ }
+
+
+ public virtual void RemoveAt (int index)
+ {
+ throw new NotSupportedException("IList::RemoveAt not supported");
+ }
+
+
+ //
+ // IEnumerable
+ //
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new SortedList.Enumerator (host, EnumeratorMode.VALUE_MODE);
+ }
+
+ }
+
+ protected class SynchedSortedList : SortedList {
+
+ private SortedList host;
+
+ public SynchedSortedList (SortedList host)
+ {
+ if (host == null)
+ throw new ArgumentNullException ();
+ this.host = host;
+ }
+
+ // ICollection
+
+ public override int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public override bool IsSynchronized {
+ get {
+ return true;
+ }
+ }
+
+ public override Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+
+
+ // IDictionary
+
+ public override bool IsFixedSize {
+ get {
+ return host.IsFixedSize;
+ }
+ }
+
+
+ public override bool IsReadOnly {
+ get {
+ return host.IsReadOnly;
+ }
+ }
+
+ public override ICollection Keys {
+ get {
+ ICollection keys = null;
+ lock (host.SyncRoot) {
+ keys = host.Keys;
+ }
+ return keys;
+ }
+ }
+
+ public override ICollection Values {
+ get {
+ ICollection vals = null;
+ lock (host.SyncRoot) {
+ vals = host.Values;
+ }
+ return vals;
+ }
+ }
+
+
+
+ public override Object this [object key] {
+ get {
+ lock (host.SyncRoot) {
+ return host.GetImpl (key);
+ }
+ }
+ set {
+ lock (host.SyncRoot) {
+ host.PutImpl (key, value, true);
+ }
+ }
+ }
+
+
+
+ // ICollection
+
+ public override void CopyTo (Array array, int arrayIndex)
+ {
+ lock (host.SyncRoot) {
+ host.CopyTo (array, arrayIndex);
+ }
+ }
+
+
+ // IDictionary
+
+ public override void Add (object key, object value)
+ {
+ lock (host.SyncRoot) {
+ host.PutImpl (key, value, false);
+ }
+ }
+
+ public override void Clear ()
+ {
+ lock (host.SyncRoot) {
+ host.Clear ();
+ }
+ }
+
+ public override bool Contains (object key)
+ {
+ lock (host.SyncRoot) {
+ return (host.Find (key) >= 0);
+ }
+ }
+
+ public override IDictionaryEnumerator GetEnumerator ()
+ {
+ lock (host.SyncRoot) {
+ return host.GetEnumerator();
+ }
+ }
+
+ public override void Remove (object key)
+ {
+ lock (host.SyncRoot) {
+ host.Remove (key);
+ }
+ }
+
+
+
+ public override bool ContainsKey (object key)
+ {
+ lock (host.SyncRoot) {
+ return host.Contains (key);
+ }
+ }
+
+ public override bool ContainsValue (object value)
+ {
+ lock (host.SyncRoot) {
+ return host.ContainsValue (value);
+ }
+ }
+
+
+ // ICloneable
+
+ public override object Clone ()
+ {
+ lock (host.SyncRoot) {
+ return (host.Clone () as SortedList);
+ }
+ }
+
+
+
+ //
+ // SortedList overrides
+ //
+
+ public override Object GetByIndex (int index)
+ {
+ lock (host.SyncRoot) {
+ return host.GetByIndex (index);
+ }
+ }
+
+ public override Object GetKey (int index)
+ {
+ lock (host.SyncRoot) {
+ return host.GetKey (index);
+ }
+ }
+
+ public override IList GetKeyList ()
+ {
+ lock (host.SyncRoot) {
+ return new ListKeys (host);
+ }
+ }
+
+
+ public override IList GetValueList ()
+ {
+ lock (host.SyncRoot) {
+ return new ListValues (host);
+ }
+ }
+
+ public override void RemoveAt (int index)
+ {
+ lock (host.SyncRoot) {
+ host.RemoveAt (index);
+ }
+ }
+
+ public override int IndexOfKey (object key)
+ {
+ lock (host.SyncRoot) {
+ return host.IndexOfKey (key);
+ }
+ }
+
+ public override int IndexOfValue (Object val)
+ {
+ lock (host.SyncRoot) {
+ return host.IndexOfValue (val);
+ }
+ }
+
+ public override void SetByIndex (int index, object value)
+ {
+ lock (host.SyncRoot) {
+ host.SetByIndex (index, value);
+ }
+ }
+
+ public override void TrimToSize()
+ {
+ lock (host.SyncRoot) {
+ host.TrimToSize();
+ }
+ }
+
+
+ } // SynchedSortedList
+
+ } // SortedList
+
+} // System.Collections
diff --git a/mcs/class/corlib/System.Collections/Stack.cs b/mcs/class/corlib/System.Collections/Stack.cs
new file mode 100644
index 00000000000..392ab6fcd00
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Stack.cs
@@ -0,0 +1,321 @@
+//
+// System.Collections.Stack
+//
+// Author:
+// Garrett Rooney (rooneg@electricjellyfish.net)
+//
+// (C) 2001 Garrett Rooney
+//
+
+namespace System.Collections {
+
+ [Serializable]
+ public class Stack : ICollection, IEnumerable, ICloneable {
+
+ // properties
+ private object[] contents;
+ private int current = -1;
+ private int count = 0;
+ private int capacity = 16;
+ private int modCount = 0;
+
+ private void Resize(int ncapacity) {
+ object[] ncontents = new object[ncapacity];
+
+ Array.Copy(contents, ncontents, count);
+
+ capacity = ncapacity;
+ contents = ncontents;
+ }
+
+ public Stack() {
+ contents = new object[capacity];
+ }
+
+ public Stack(ICollection collection) {
+ capacity = collection.Count;
+ contents = new object[capacity];
+ current = capacity - 1;
+ count = capacity;
+
+ collection.CopyTo(contents, 0);
+ }
+
+ public Stack(int c) {
+ capacity = c;
+ contents = new object[capacity];
+ }
+
+ [Serializable]
+ private class SyncStack : Stack {
+
+ Stack stack;
+
+ internal SyncStack(Stack s) {
+ stack = s;
+ }
+
+ public override int Count {
+ get {
+ lock (stack) {
+ return stack.Count;
+ }
+ }
+ }
+
+/*
+ public override bool IsReadOnly {
+ get {
+ lock (stack) {
+ return stack.IsReadOnly;
+ }
+ }
+ }
+*/
+
+ public override bool IsSynchronized {
+ get { return true; }
+ }
+
+ public override object SyncRoot {
+ get { return stack.SyncRoot; }
+ }
+
+ public override void Clear() {
+ lock(stack) { stack.Clear(); }
+ }
+
+ public override object Clone() {
+ lock (stack) {
+ return Stack.Synchronized((Stack)stack.Clone());
+ }
+ }
+
+ public override bool Contains(object obj) {
+ lock (stack) { return stack.Contains(obj); }
+ }
+
+ public override void CopyTo(Array array, int index) {
+ lock (stack) { stack.CopyTo(array, index); }
+ }
+
+ public override IEnumerator GetEnumerator() {
+ lock (stack) {
+ return new Enumerator(stack);
+ }
+ }
+
+ public override object Peek() {
+ lock (stack) { return stack.Peek(); }
+ }
+
+ public override object Pop() {
+ lock (stack) { return stack.Pop(); }
+ }
+
+ public override void Push(object obj) {
+ lock (stack) { stack.Push(obj); }
+ }
+
+ public override object[] ToArray() {
+ lock (stack) { return stack.ToArray(); }
+ }
+ }
+
+ public static Stack Synchronized(Stack s) {
+ if (s == null) {
+ throw new ArgumentNullException();
+ }
+
+ return new SyncStack(s);
+ }
+
+ public virtual int Count {
+ get { return count; }
+ }
+
+/*
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+*/
+
+ public virtual bool IsSynchronized {
+ get { return false; }
+ }
+
+ public virtual object SyncRoot {
+ get { return this; }
+ }
+
+ public virtual void Clear() {
+ modCount++;
+
+ for (int i = 0; i < count; i++) {
+ contents[i] = null;
+ }
+
+ count = 0;
+ current = -1;
+ }
+
+ public virtual object Clone() {
+ Stack stack;
+
+ stack = new Stack();
+
+ stack.current = current;
+ stack.contents = contents;
+ stack.count = count;
+ stack.capacity = capacity;
+
+ return stack;
+ }
+
+ public virtual bool Contains(object obj) {
+ if (count == 0)
+ return false;
+
+ for (int i = 0; i < count; i++) {
+ if (contents[i].Equals(obj))
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException();
+ }
+
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if (array.Rank > 1 ||
+ index >= array.Length ||
+ count > array.Length - index) {
+ throw new ArgumentException();
+ }
+
+ for (int i = current; i != -1; i--) {
+ array.SetValue(contents[i],
+ count - (i + 1) + index);
+ }
+ }
+
+ private class Enumerator : IEnumerator {
+
+ Stack stack;
+ private int modCount;
+ private int current;
+
+ internal Enumerator(Stack s) {
+ // this is odd. it seems that you need to
+ // start one further ahead than current, since
+ // MoveNext() gets called first when using an
+ // Enumeration...
+ stack = s;
+ modCount = s.modCount;
+ current = s.current + 1;
+ }
+
+ public virtual object Current {
+ get {
+ if (modCount != stack.modCount
+ || current == -1
+ || current > stack.count)
+ throw new InvalidOperationException();
+ return stack.contents[current];
+ }
+ }
+
+ public virtual bool MoveNext() {
+ if (modCount != stack.modCount
+ || current == -1) {
+ throw new InvalidOperationException();
+ }
+
+ current--;
+
+ if (current == -1) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public virtual void Reset() {
+ if (modCount != stack.modCount) {
+ throw new InvalidOperationException();
+ }
+
+ // start one ahead of stack.current, so the
+ // first MoveNext() will put us at the top
+ current = stack.current + 1;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator() {
+ return new Enumerator(this);
+ }
+
+ public virtual object Peek() {
+ if (current == -1) {
+ throw new InvalidOperationException();
+ } else {
+ return contents[current];
+ }
+ }
+
+ public virtual object Pop() {
+ if (current == -1) {
+ throw new InvalidOperationException();
+ } else {
+ modCount++;
+
+ object ret = contents[current];
+
+ count--;
+ current--;
+
+ // if we're down to capacity/4, go back to a
+ // lower array size. this should keep us from
+ // sucking down huge amounts of memory when
+ // putting large numbers of items in the Stack.
+ // if we're lower than 16, don't bother, since
+ // it will be more trouble than it's worth.
+ if (count <= (capacity/4) && count > 16) {
+ Resize(capacity/2);
+ }
+
+ return ret;
+ }
+ }
+
+ public virtual void Push(Object o) {
+ modCount++;
+
+ if (capacity == count) {
+ Resize(capacity * 2);
+ }
+
+ count++;
+ current++;
+
+ contents[current] = o;
+ }
+
+ public virtual object[] ToArray() {
+ object[] ret = new object[count];
+
+ Array.Copy(contents, ret, count);
+
+ // ret needs to be in LIFO order
+ Array.Reverse(ret);
+
+ return ret;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs
new file mode 100644
index 00000000000..ffa152e6399
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs
@@ -0,0 +1,71 @@
+
+//
+// AssemblyHash.cs
+//
+// Implementation of the
+// System.Configuration.Assemblies.AssemblyHash
+// class for the Mono Class Library
+//
+// Author:
+// Tomas Restrepo (tomasr@mvps.org)
+//
+
+namespace System.Configuration.Assemblies {
+
+ [Serializable]
+ public struct AssemblyHash : System.ICloneable
+ {
+ private AssemblyHashAlgorithm _algorithm;
+ private byte[] _value;
+
+ public static readonly AssemblyHash Empty =
+ new AssemblyHash(AssemblyHashAlgorithm.None,null);
+
+
+ //
+ // properties
+ //
+ public AssemblyHashAlgorithm Algorithm {
+ get { return _algorithm; }
+ set { _algorithm = value; }
+ }
+
+
+ //
+ // construction
+ //
+ public AssemblyHash ( AssemblyHashAlgorithm algorithm, byte[] value )
+ {
+ _algorithm = algorithm;
+ _value = null;
+ if ( value != null )
+ {
+ int size = value.Length;
+ _value = new byte[size];
+ System.Array.Copy ( value, _value, size );
+ }
+ }
+
+ public AssemblyHash ( byte[] value )
+ : this(AssemblyHashAlgorithm.SHA1, value)
+ {
+ }
+
+ public object Clone()
+ {
+ return new AssemblyHash(_algorithm,_value);
+ }
+
+ public byte[] GetValue()
+ {
+ return _value;
+ }
+ public void SetValue ( byte[] value )
+ {
+ _value = value;
+ }
+
+ } // class AssemblyHash
+
+} // namespace System.Configuration.Assemblies
+
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs
new file mode 100644
index 00000000000..f144df7bf79
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs
@@ -0,0 +1,33 @@
+// AssemblyHashAlgorithm.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:03 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Configuration.Assemblies {
+
+
+ /// <summary>
+ /// </summary>
+ public enum AssemblyHashAlgorithm {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ MD5 = 32771,
+
+ /// <summary>
+ /// </summary>
+ SHA1 = 32772,
+ } // AssemblyHashAlgorithm
+
+} // System.Configuration.Assemblies
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs
new file mode 100644
index 00000000000..5e13d56fdf1
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs
@@ -0,0 +1,33 @@
+// AssemblyVersionCompatibility.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:13 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Configuration.Assemblies {
+
+
+ /// <summary>
+ /// </summary>
+ public enum AssemblyVersionCompatibility {
+
+ /// <summary>
+ /// </summary>
+ SameMachine = 1,
+
+ /// <summary>
+ /// </summary>
+ SameProcess = 2,
+
+ /// <summary>
+ /// </summary>
+ SameDomain = 3,
+ } // AssemblyVersionCompatibility
+
+} // System.Configuration.Assemblies
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/ChangeLog b/mcs/class/corlib/System.Configuration.Assemblies/ChangeLog
new file mode 100644
index 00000000000..d9e7f8ea889
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/ChangeLog
@@ -0,0 +1,6 @@
+2001-07-13 Tomas Restrepo (tomasr@mvps.org)
+
+ * AssemblyHash finished
+ * AssemblyHashAlgorithm finished
+ * AssemblyVersion finished
+ \ No newline at end of file
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs b/mcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs
new file mode 100755
index 00000000000..10cb2e9fe5d
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs
@@ -0,0 +1,101 @@
+// ProcessorID.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:23 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Configuration.Assemblies {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ProcessorID {
+
+ /// <summary>
+ /// </summary>
+ INTEL_386 = 386,
+
+ /// <summary>
+ /// </summary>
+ INTEL_486 = 486,
+
+ /// <summary>
+ /// </summary>
+ INTEL_PENTIUM = 586,
+
+ /// <summary>
+ /// </summary>
+ MIPS_R4000 = 4000,
+
+ /// <summary>
+ /// </summary>
+ ALPHA_21064 = 21064,
+
+ /// <summary>
+ /// </summary>
+ PPC_601 = 601,
+
+ /// <summary>
+ /// </summary>
+ PPC_603 = 603,
+
+ /// <summary>
+ /// </summary>
+ PPC_604 = 604,
+
+ /// <summary>
+ /// </summary>
+ PPC_620 = 620,
+
+ /// <summary>
+ /// </summary>
+ HITACHI_SH3 = 10003,
+
+ /// <summary>
+ /// </summary>
+ HITACHI_SH3E = 10004,
+
+ /// <summary>
+ /// </summary>
+ HITACHI_SH4 = 10005,
+
+ /// <summary>
+ /// </summary>
+ MOTOROLA_821 = 821,
+
+ /// <summary>
+ /// </summary>
+ SHx_SH3 = 103,
+
+ /// <summary>
+ /// </summary>
+ SHx_SH4 = 104,
+
+ /// <summary>
+ /// </summary>
+ STRONGARM = 2577,
+
+ /// <summary>
+ /// </summary>
+ ARM720 = 1824,
+
+ /// <summary>
+ /// </summary>
+ ARM820 = 2080,
+
+ /// <summary>
+ /// </summary>
+ ARM920 = 2336,
+
+ /// <summary>
+ /// </summary>
+ ARM_7TDMI = 70001,
+ } // ProcessorID
+
+} // System.Configuration.Assemblies
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog b/mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog
new file mode 100644
index 00000000000..4c57a305185
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog
@@ -0,0 +1,29 @@
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * SymbolToken.cs (GetToken): Implemented.
+
+2002-03-05 Duncan Mak <duncan@ximian.com>
+
+ * ISymbolWriter.cs:
+ (DefineParameter) corrected typo in argument type.
+ (SetMethodSourceRange): Fixed typo in method name.
+
+ * ISymbolDocument.cs:
+ (CheckSumAlgorithmId) Fixed typo.
+
+ * ISymbolNamespace.cs:
+ (GetVariable) Added missing method.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * SymDocumentType.cs:
+ * SymLanguageType.cs:
+ * SymLanguageVendor.cs: Added to CVS.
+
+2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Finilized SymAddressKind enum
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created SymAddressKind enum
+ * Created all interfaces
+ * Created dummy implementation for SymbolToken struct
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs
new file mode 100755
index 00000000000..ea1779ca15c
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs
@@ -0,0 +1,19 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolBinder
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolBinder {
+
+ ISymbolReader GetReader (int importer, string filename, string searchPath);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs
new file mode 100755
index 00000000000..4725e34db06
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs
@@ -0,0 +1,30 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolDocument
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolDocument {
+
+ Guid CheckSumAlgorithmId {get; }
+ Guid DocumentType {get; }
+ bool HasEmbeddedSource {get; }
+ Guid Language {get; }
+ Guid LanguageVendor {get; }
+ int SourceLength {get; }
+ string URL {get; }
+
+
+ int FindClosestLine (int line);
+ byte[] GetCheckSum ();
+ byte[] GetSourceRange (int startLine, int startColumn, int endLine, int endColumn);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs
new file mode 100755
index 00000000000..855b1a5cefc
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolDocumentWriter {
+
+ void SetCheckSum (Guid algorithmId, byte[] checkSum);
+ void SetSource (byte[] source);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs
new file mode 100755
index 00000000000..768ace15710
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs
@@ -0,0 +1,38 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolMethod
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolMethod {
+
+ ISymbolScope RootScope {get; }
+ int SequencePointCount {get; }
+ SymbolToken Token {get; }
+
+ ISymbolNamespace GetNamespace ();
+ int GetOffset (ISymbolDocument document, int line, int column);
+ ISymbolVariable[] GetParameters ();
+ int[] GetRanges (ISymbolDocument document, int line, int column);
+ ISymbolScope GetScope (int offset);
+ void GetSequencePoints (
+ int[] offsets,
+ ISymbolDocument[] documents,
+ int[] lines,
+ int[] columns,
+ int[] endLines,
+ int[] endColumns);
+ bool GetSourceStartEnd (
+ ISymbolDocument[] docs,
+ int[] lines,
+ int[] columns);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs
new file mode 100755
index 00000000000..394fecddc01
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolNamespace
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolNamespace {
+
+ string Name {get ;}
+
+ ISymbolNamespace[] GetNamespaces ();
+ ISymbolVariable[] GetVariables ();
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs
new file mode 100755
index 00000000000..ee04f2b64b1
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs
@@ -0,0 +1,38 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolReader
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolReader {
+
+ SymbolToken UserEntryPoint {get; }
+
+ ISymbolDocument GetDocument (
+ string url,
+ Guid language,
+ Guid languageVendor,
+ Guid documentType);
+ ISymbolDocument[] GetDocuments ();
+ ISymbolVariable[] GetGlobalVariables ();
+
+ ISymbolMethod GetMethod (SymbolToken method);
+ ISymbolMethod GetMethod (SymbolToken method, int version);
+
+ ISymbolMethod GetMethodFromDocumentPosition (
+ ISymbolDocument document,
+ int line,
+ int column);
+ ISymbolNamespace[] GetNamespaces ();
+ byte[] GetSymAttribute (SymbolToken parent, string name);
+ ISymbolVariable[] GetVariables (SymbolToken parent);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs
new file mode 100755
index 00000000000..6c3179ba67a
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs
@@ -0,0 +1,26 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolScope
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolScope {
+
+ int EndOffset {get ;}
+ ISymbolMethod Method {get; }
+ ISymbolScope Parent {get ;}
+ int StartOffset {get ;}
+
+ ISymbolScope[] GetChildren ();
+ ISymbolVariable[] GetLocals ();
+ ISymbolNamespace[] GetNamespaces ();
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs
new file mode 100755
index 00000000000..11d4ee5f25d
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs
@@ -0,0 +1,28 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolVariable
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolVariable {
+
+ int AddressField1 {get; }
+ int AddressField2 {get; }
+ int AddressField3 {get; }
+ SymAddressKind AddressKind {get ;}
+ object Attributes {get ;}
+ int EndOffset {get; }
+ string Name {get; }
+ int StartOffset {get; }
+
+ byte[] GetSignature ();
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs
new file mode 100755
index 00000000000..ee347fbfbfa
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs
@@ -0,0 +1,88 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolWriter
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+using System.Reflection;
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolWriter {
+
+ void Close ();
+ void CloseMethod ();
+ void CloseNamespace ();
+ void CloseScope (int endOffset);
+ ISymbolDocumentWriter DefineDocument(
+ string url,
+ Guid language,
+ Guid languageVendor,
+ Guid documentType);
+ void DefineField (
+ SymbolToken parent,
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3);
+ void DefineGlobalVariable (
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3);
+ void DefineLocalVariable (
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3,
+ int startOffset,
+ int endOffset);
+ void DefineParameter (
+ string name,
+ ParameterAttributes attributes,
+ int sequence,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3);
+ void DefineSequencePoints (
+ ISymbolDocumentWriter document,
+ int[] offsets,
+ int[] lines,
+ int[] columns,
+ int[] endLines,
+ int[] endColumns);
+ void Initialize (IntPtr emitter, string filename, bool fFullBuild);
+ void OpenMethod (SymbolToken method);
+ void OpenNamespace (string name);
+ int OpenScope (int startOffset);
+ void SetMethodSourceRange (
+ ISymbolDocumentWriter startDoc,
+ int startLine,
+ int startColumn,
+ ISymbolDocumentWriter endDoc,
+ int endLine,
+ int endColumn);
+ void SetScopeRange (int scopeID, int startOffset, int endOffset);
+ void SetSymAttribute (SymbolToken parent, string name, byte[] data);
+ void SetUnderlyingWriter (IntPtr underlyingWriter);
+ void SetUserEntryPoint (SymbolToken entryMethod);
+ void UsingNamespace (string fullName);
+
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs
new file mode 100755
index 00000000000..af3e5b32ef5
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs
@@ -0,0 +1,25 @@
+//
+// System.Diagnostics.SymbolStore.SymAddressKind
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public enum SymAddressKind {
+ ILOffset = 1,
+ NativeRVA = 2,
+ NativeRegister = 3,
+ NativeRegisterRelative = 4,
+ NativeOffset = 5,
+ NativeRegisterRegister = 6,
+ NativeRegisterStack = 7,
+ NativeStackRegister = 8,
+ BitField = 9
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs
new file mode 100644
index 00000000000..6bbabef32d6
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.SymbolStore.SymDocumentType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+ public class SymDocumentType
+ {
+ // Constructors
+ public SymDocumentType ()
+ {
+ }
+
+ // Fields
+ public static readonly Guid Text;
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs
new file mode 100644
index 00000000000..6dd232f081e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs
@@ -0,0 +1,31 @@
+//
+// System.Diagnostics.SymbolStore.SymLanguageType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+ public class SymLanguageType
+ {
+ // Constructors
+ public SymLanguageType ()
+ {
+ }
+
+ // Fields
+ public static readonly Guid Basic;
+ public static readonly Guid C;
+ public static readonly Guid Cobol;
+ public static readonly Guid CPlusPlus;
+ public static readonly Guid CSharp;
+ public static readonly Guid ILAssembly;
+ public static readonly Guid Java;
+ public static readonly Guid JScript;
+ public static readonly Guid MCPlusPlus;
+ public static readonly Guid Pascal;
+ public static readonly Guid SMC;
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs
new file mode 100644
index 00000000000..a9b439eb3e5
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.SymbolStore.SymLanguageVendor.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+ public class SymLanguageVendor
+ {
+ // Constructors
+ public SymLanguageVendor ()
+ {
+ }
+
+ // Fields
+ public static readonly Guid Microsoft;
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs
new file mode 100755
index 00000000000..7d355ac244e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs
@@ -0,0 +1,29 @@
+//
+// System.Diagnostics.SymbolStore.SymbolToken
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public struct SymbolToken {
+
+ private int _val;
+
+ public SymbolToken (int val) { _val = val; }
+
+ [MonoTODO]
+ public override bool Equals (object obj) { return false; }
+
+ [MonoTODO]
+ public override int GetHashCode() { return 0; }
+
+ public int GetToken() { return _val; }
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics/ChangeLog b/mcs/class/corlib/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..100adce0eda
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/ChangeLog
@@ -0,0 +1,71 @@
+2003-01-01 Jaime Anguiano Olarra <jaime@gnome.org>
+
+ * Process.cs: skeleton for use in Remoting.
+
+2002-06-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * StackTrace.cs: impl. remaining constructors.
+
+2002-06-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * StackTrace.cs: use new internal call for constructors, use MS like
+ trace format.
+
+ * StackFrame.cs: impl. constructors using a new internal call.
+
+2002-05-01 Duncan Mak <duncan@ximian.com>
+
+ * DebuggableAttribute.cs: Added missing AttributeUsage attribute.
+
+2002-04-08 Jonathan Pryor <jonpryor@vt.edu>
+
+ * Debugger.cs: Added [MonoTODO] attribute to methods; modified IsLogging()
+ and Log() so that System.Diagnostics.DefaultTraceListener could use them
+ without having NotImplementedException's thrown, as the functionality
+ DefaultTraceListener is using is non-critical.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * ConditionalAttribute.cs: Add AttributeUsage attribute for methods.
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * DebuggerStepThroughAttribute.cs:
+ * DebuggerHiddenAttribte.cs: Add to CVS.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * StackFrame.cs : Use the MonoTODO attribute to mark
+ incomplete code.
+
+ StackTrace.cs : Ditto.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Moved TraceListener, TextWriterTraceListener, and
+ DefaultTraceListener to System assembly....oops.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+
+ * Added TextWriterTraceListener.cs, TraceListener.cs, and
+ DefaultTraceListener.cs to the build.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+
+ * Added Debugger.cs to the build.
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * Moved BooleanSwitch, Switch, TraceLevel and TraceSwitch to the
+ System assembly.
+
+ * Added StackFrame.cs and StackTrace.cs to the build.
+
+2001-08-21 Nick Drochak <ndrochak@gol.com>
+
+ * Implemented ConditionalAttribute.cs and DebuggableAttribute.cs
+
+2001-08-29 Alexander Klyubin <klyubin@aqris.com>
+
+ * Skeletal implementation of StackFrame and StackTrace classes.
+ The classes must be somehow connected to runtime environment in
+ order to generate proper traces.
diff --git a/mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs b/mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs
new file mode 100644
index 00000000000..ea808ac500e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs
@@ -0,0 +1,30 @@
+//
+// System.Collections.DebuggableAttribute.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+namespace System.Diagnostics
+{
+
+ [Serializable]
+ [AttributeUsage(AttributeTargets.Method)]
+ public sealed class ConditionalAttribute : System.Attribute
+ {
+
+ private string myCondition;
+
+ // Public Instance Constructors
+ public ConditionalAttribute(string conditionString)
+ {
+ myCondition = conditionString;
+ }
+
+ // Public Instance Properties
+ public string ConditionString { get { return myCondition; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs
new file mode 100644
index 00000000000..08ede85557c
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Collections.DebuggableAttribute.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+namespace System.Diagnostics {
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Module)]
+ public sealed class DebuggableAttribute : System.Attribute {
+
+ private bool JITTrackingEnabledFlag;
+ private bool JITOptimizerDisabledFlag;
+
+ // Public Instance Constructors
+ public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) {
+ JITTrackingEnabledFlag = isJITTrackingEnabled;
+ JITOptimizerDisabledFlag = isJITOptimizerDisabled;
+ }
+
+ // Public Instance Properties
+ public bool IsJITTrackingEnabled { get { return JITTrackingEnabledFlag; } }
+
+ public bool IsJITOptimizerDisabled { get { return JITOptimizerDisabledFlag; } }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/Debugger.cs b/mcs/class/corlib/System.Diagnostics/Debugger.cs
new file mode 100644
index 00000000000..8b5c6789799
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/Debugger.cs
@@ -0,0 +1,94 @@
+//
+// System.Diagnostics.Debugger.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+//
+using System;
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Enables communication with a debugger.
+ /// </summary>
+ [MonoTODO]
+ public sealed class Debugger
+ {
+ private static bool isAttached;
+
+ /// <summary>
+ /// Represents the default category of a message with a constant.
+ /// </summary>
+ public static readonly string DefaultCategory = "";
+
+ /// <summary>
+ /// Returns a Boolean indicating whether a debugger is attached to a process.
+ /// </summary>
+ /// <value>
+ /// true if debugger is attached; otherwise, false.
+ /// </value>
+ public static bool IsAttached
+ {
+ get
+ {
+ return isAttached;
+ }
+ }
+
+ /// <summary>
+ /// Causes a breakpoint to be signaled to an attached debugger.
+ /// </summary>
+ [MonoTODO]
+ public static void Break()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Checks to see if logging is enabled by an attached debugger.
+ /// </summary>
+ [MonoTODO]
+ public static bool IsLogging()
+ {
+ // Return false. DefaultTraceListener invokes this method, so throwing
+ // a NotImplementedException wouldn't be appropriate.
+ return false;
+
+ }
+
+ /// <summary>
+ /// Launches and attaches a debugger to the process.
+ /// </summary>
+ [MonoTODO]
+ public static bool Launch()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Posts a message for the attached debugger.
+ /// </summary>
+ /// <param name="level">
+ /// A description of the importance of this message
+ /// </param>
+ /// <param name="category">
+ /// A string describing the category of this message.
+ /// </param>
+ /// <param name="message">
+ /// A string representing the message to show.
+ /// </param>
+ [MonoTODO]
+ public static void Log(int level, string category, string message)
+ {
+ // Do nothing. DefaultTraceListener invokes this method, so throwing
+ // a NotImplementedException wouldn't be appropriate.
+ }
+
+ public Debugger()
+ {
+ isAttached = false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs
new file mode 100644
index 00000000000..b57db27cb8b
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Diagnostics.DebuggerHiddenAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Diagnostics
+{
+ [AttributeUsage (AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Property)]
+ [Serializable]
+ public sealed class DebuggerHiddenAttribute : Attribute
+ {
+ public DebuggerHiddenAttribute ()
+ : base ()
+ {
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs
new file mode 100644
index 00000000000..27d81891a1d
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs
@@ -0,0 +1,23 @@
+//
+// System.Diagnostics.DebuggerStepThroughAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Diagnostics
+{
+ [AttributeUsage (AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Property)]
+ [Serializable]
+ public sealed class DebuggerStepThroughAttribute : Attribute
+ {
+ public DebuggerStepThroughAttribute ()
+ : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/StackFrame.cs b/mcs/class/corlib/System.Diagnostics/StackFrame.cs
new file mode 100644
index 00000000000..f27256fbde5
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/StackFrame.cs
@@ -0,0 +1,321 @@
+//
+// System.Diagnostics.StackFrame.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System.Diagnostics {
+ /// <summary>
+ /// Stack frame.
+ /// </summary>
+
+ [Serializable]
+ public class StackFrame {
+ /// <value>
+ /// Constant returned when the native or IL offset is unknown.
+ /// </value>
+ public const int OFFSET_UNKNOWN = -1;
+
+ /// <value>
+ /// Offset from the start of the IL code for the method
+ /// being executed.
+ /// </value>
+ private int ilOffset = OFFSET_UNKNOWN;
+
+ /// <value>
+ /// Offset from the start of the native code for the method
+ /// being executed.
+ /// </value>
+ private int nativeOffset = OFFSET_UNKNOWN;
+
+ /// <value>
+ /// Method associated with this stack frame.
+ /// </value>
+ private MethodBase methodBase;
+
+ /// <value>
+ /// File name.
+ /// </value>
+ private string fileName;
+
+ /// <value>
+ /// Line number.
+ /// </value>
+ private int lineNumber;
+
+ /// <value>
+ /// Column number.
+ /// </value>
+ private int columnNumber;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static bool get_frame_info (int skip, bool needFileInfo, out MethodBase method,
+ out int iloffset, out int native_offset,
+ out string file, out int line, out int column);
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ public StackFrame() {
+ get_frame_info (2, false, out methodBase, out ilOffset,
+ out nativeOffset, out fileName, out lineNumber,
+ out columnNumber);
+ }
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackFrame(bool needFileInfo) : this() {
+ get_frame_info (2, needFileInfo, out methodBase, out ilOffset,
+ out nativeOffset, out fileName, out lineNumber,
+ out columnNumber);
+ }
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to skip.
+ /// </param>
+ public StackFrame(int skipFrames) {
+ get_frame_info (skipFrames + 2, false, out methodBase, out ilOffset,
+ out nativeOffset, out fileName, out lineNumber,
+ out columnNumber);
+ }
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to skip.
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackFrame(int skipFrames, bool needFileInfo) {
+ get_frame_info (skipFrames + 2, needFileInfo, out methodBase, out ilOffset,
+ out nativeOffset, out fileName, out lineNumber,
+ out columnNumber);
+ }
+
+ /// <summary>
+ /// Constructs a fake stack frame that just contains the
+ /// given file name and line number. Use this constructor
+ /// when you do not want to use the debugger's line mapping
+ /// logic.
+ /// </summary>
+ /// <param name="fileName">
+ /// The given file name.
+ /// </param>
+ /// <param name="lineNumber">
+ /// The line number in the specified file.
+ /// </param>
+ public StackFrame(string fileName, int lineNumber)
+ : this (fileName, lineNumber, 0) {}
+
+ /// <summary>
+ /// Constructs a fake stack frame that just contains the
+ /// given file name and line number. Use this constructor
+ /// when you do not want to use the debugger's line mapping
+ /// logic.
+ /// </summary>
+ /// <param name="fileName">
+ /// The given file name.
+ /// </param>
+ /// <param name="lineNumber">
+ /// The line number in the specified file.
+ /// </param>
+ /// <param name="colNumber">
+ /// The column number in the specified file.
+ /// </param>
+ public StackFrame(string fileName,
+ int lineNumber,
+ int colNumber) {
+ this.methodBase = null;
+ this.fileName = fileName;
+ this.lineNumber = lineNumber;
+ this.columnNumber = colNumber;
+ }
+
+
+ /// <summary>
+ /// Gets the line number in the file containing the code
+ /// being executed. This information is typically extracted
+ /// from the debugging symbols for the executable.
+ /// </summary>
+ /// <returns>
+ /// The file line number or zero if it cannot be determined.
+ /// </returns>
+ public virtual int GetFileLineNumber()
+ {
+ return lineNumber;
+ }
+
+ /// <summary>
+ /// Gets the column number in the file containing the code
+ /// being executed. This information is typically extracted
+ /// from the debugging symbols for the executable.
+ /// </summary>
+ /// <returns>
+ /// The file column number or zero if it cannot be determined.
+ /// </returns>
+ public virtual int GetFileColumnNumber()
+ {
+ return columnNumber;
+ }
+
+ /// <summary>
+ /// Gets the file name containing the code being executed.
+ /// This information is typically extracted from the
+ /// debugging symbols for the executable.
+ /// </summary>
+ /// <returns>
+ /// The file name or null if it cannot be determined.
+ /// </returns>
+ public virtual string GetFileName()
+ {
+ return fileName;
+ }
+
+ /// <summary>
+ /// Gets the offset from the start of the IL code for the
+ /// method being executed. This offset may be approximate
+ /// depending on whether the JIT compiler is generating
+ /// debugging code or not.
+ /// </summary>
+ /// <returns>
+ /// The offset from the start of the IL code for the method
+ /// being executed.
+ /// </returns>
+ public virtual int GetILOffset()
+ {
+ return ilOffset;
+ }
+
+ /// <summary>
+ /// Gets the method in which the frame is executing.
+ /// </summary>
+ /// <returns>
+ /// The method the frame is executing in.
+ /// </returns>
+ public virtual MethodBase GetMethod()
+ {
+ return methodBase;
+ }
+
+ /// <summary>
+ /// Gets the offset from the start of the native
+ /// (JIT-compiled) code for the method being executed.
+ /// </summary>
+ /// <returns>
+ /// The offset from the start of the native (JIT-compiled)
+ /// code or the method being executed.
+ /// </returns>
+ public virtual int GetNativeOffset()
+ {
+ return nativeOffset;
+ }
+
+ /// <summary>
+ /// Builds a readable representation of the stack frame.
+ /// </summary>
+ /// <returns>
+ /// A readable representation of the stack frame.
+ /// </returns>
+ public override string ToString() {
+ string methodNameString =
+ (GetMethod() == null)
+ ? "<unknown method>"
+ : GetMethod().Name;
+ string offsetString =
+ (GetILOffset() == OFFSET_UNKNOWN)
+ ? "<unknown offset>"
+ : "offset " + GetILOffset();
+ string fileNameString =
+ (GetFileName() == null)
+ ? "<filename unknown>" : GetFileName();
+ return methodNameString + " at " + offsetString
+ + " in file:line:column " + fileNameString
+ + ":" + GetFileLineNumber()
+ + ":" + GetFileColumnNumber();
+ }
+
+ public override bool Equals(Object obj) {
+ if ((obj == null) || (!(obj is StackFrame))) {
+ return false;
+ }
+
+ StackFrame rhs = (StackFrame) obj;
+
+ if (!ObjectsEqual(GetMethod(), rhs.GetMethod())) {
+ return false;
+ }
+
+ if (!ObjectsEqual(GetFileName(), rhs.GetFileName())) {
+ return false;
+ }
+
+ if (GetFileLineNumber() != rhs.GetFileLineNumber()) {
+ return false;
+ }
+
+ if (GetFileColumnNumber() != rhs.GetFileColumnNumber()) {
+ return false;
+ }
+
+ if (GetILOffset() != rhs.GetILOffset()) {
+ return false;
+ }
+
+ if (GetNativeOffset() != rhs.GetNativeOffset()) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+ public override int GetHashCode() {
+ return GetFileLineNumber();
+ }
+
+ /// <summary>
+ /// Checks whether two objects are equal.
+ /// The objects are assumed equal if and only if either
+ /// both of the references are <code>null</code> or they
+ /// equal via <code>Equals</code> method.
+ /// </summary>
+ /// <param name="obj1">
+ /// First object.
+ /// </param>
+ /// <param name="obj2">
+ /// Second object.
+ /// </param>
+ /// <returns>
+ /// <code>true</code> if the two objects are equal,
+ /// </code>false</code> otherwise.
+ /// </returns>
+ private static bool ObjectsEqual(Object obj1, Object obj2) {
+ if (obj1 == null) {
+ return (obj2 == null);
+ } else {
+ return obj1.Equals(obj2);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs
new file mode 100644
index 00000000000..c8ac9ca51bd
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs
@@ -0,0 +1,281 @@
+//
+// System.Diagnostics.StackTrace.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Reflection;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Collections;
+
+namespace System.Diagnostics {
+ /// <summary>
+ /// Stack trace.
+ /// TODO: more information.
+ /// </summary>
+ [Serializable]
+ public class StackTrace {
+ /// <value>
+ /// Uses a constant to define the number of methods that are
+ /// to be omitted from the stack trace.
+ /// </value>
+ public const int METHODS_TO_SKIP = 0;
+
+ /// <value>
+ /// Frames. First frame is the last stack frame pushed.
+ /// </value>
+ private StackFrame[] frames;
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ [MonoTODO]
+ public StackTrace() {
+ init_frames (METHODS_TO_SKIP, false);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(bool needFileInfo) {
+ init_frames (METHODS_TO_SKIP, needFileInfo);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class
+ /// from the current location, in a caller's frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ public StackTrace(int skipFrames) {
+ init_frames (skipFrames, false);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class
+ /// from the current location, in a caller's frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(int skipFrames, bool needFileInfo) {
+ init_frames (skipFrames, needFileInfo);
+ }
+
+ void init_frames (int skipFrames, bool needFileInfo)
+ {
+ StackFrame sf;
+ ArrayList al = new ArrayList ();
+
+ skipFrames += 2;
+
+ while ((sf = new StackFrame (skipFrames, needFileInfo)) != null &&
+ sf.GetMethod () != null) {
+
+ al.Add (sf);
+ skipFrames++;
+ };
+
+ frames = (StackFrame [])al.ToArray (typeof (StackFrame));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static StackFrame [] get_trace (Exception e, int skipFrames, bool needFileInfo);
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ /// <param name="e">
+ /// TODO:
+ /// </param>
+ public StackTrace(Exception e) {
+ frames = get_trace (e, METHODS_TO_SKIP, false);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class,
+ /// using the provided exception object. The resulting stack
+ /// trace describes the stack at the time of the exception.
+ /// </summary>
+ /// <param name="e">
+ /// TODO:
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(Exception e, bool needFileInfo) {
+ frames = get_trace (e, METHODS_TO_SKIP, needFileInfo);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class,
+ /// using the provided exception object. The resulting stack
+ /// trace describes the stack at the time of the exception.
+ /// </summary>
+ /// <param name="e">
+ /// Exception.
+ /// </param>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ public StackTrace(Exception e, int skipFrames) {
+ frames = get_trace (e, skipFrames, false);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class,
+ /// using the provided exception object. The resulting stack
+ /// trace describes the stack at the time of the exception.
+ /// </summary>
+ /// <param name="e">
+ /// Exception.
+ /// </param>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(Exception e, int skipFrames, bool needFileInfo) {
+ frames = get_trace (e, skipFrames, needFileInfo);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class
+ /// containing a single frame.
+ /// </summary>
+ /// <param name="frame">
+ /// The frame that the StackTrace object should contain.
+ /// </param>
+ public StackTrace(StackFrame frame) {
+ this.frames = new StackFrame[1];
+ this.frames[0] = frame;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ /// <param name="targetThread">
+ /// TODO:
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ [MonoTODO]
+ public StackTrace(Thread targetThread, bool needFileInfo) {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Holds the number of frames in the stack trace.
+ /// </summary>
+ public virtual int FrameCount {
+ get {
+ return (frames == null) ? 0 : frames.Length;
+ }
+ }
+
+ /// <summary>
+ /// Gets the specified stack frame.
+ /// </summary>
+ /// <param name="index">
+ /// The index of the stack frame requested.
+ /// </param>
+ /// <returns>
+ /// The specified stack frame. Returns <code>null</code> if
+ /// frame with specified index does not exist in this stack
+ /// trace.
+ /// </returns>
+ /// <remarks>
+ /// Stack frames are numbered starting at zero, which is the
+ /// last stack frame pushed.
+ /// </remarks>
+ public virtual StackFrame GetFrame(int index) {
+ if ((index < 0) || (index >= FrameCount)) {
+ return null;
+ }
+
+ return frames[index];
+ }
+
+ /// <summary>
+ /// Builds a readable representation of the stack trace.
+ /// </summary>
+ /// <returns>
+ /// A readable representation of the stack trace.
+ /// </returns>
+ public override string ToString() {
+ string result = "";
+ for (int i = 0; i < FrameCount; i++) {
+ StackFrame frame = GetFrame(i);
+ result += "\n\tat " + FrameToString(frame);
+ }
+
+ return result;
+ }
+
+ public override bool Equals(Object obj) {
+ if ((obj == null) || (!(obj is StackTrace))) {
+ return false;
+ }
+
+ StackTrace rhs = (StackTrace) obj;
+
+ if (FrameCount != rhs.FrameCount) {
+ return false;
+ }
+
+ for (int i = 0; i < FrameCount; i++) {
+ if (!GetFrame(i).Equals(rhs.GetFrame(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public override int GetHashCode() {
+ return FrameCount;
+ }
+
+ /// <summary>
+ /// Converts single stack frame to string to be used in
+ /// ToString method.
+ /// </summary>
+ /// <param name="frame">
+ /// Frame to convert.
+ /// </param>
+ /// <returns>
+ /// A readable representation of stack frame for using
+ /// ToString.
+ /// </returns>
+ private static String FrameToString(StackFrame frame) {
+ MethodBase method = frame.GetMethod();
+ if (method != null) {
+ // Method information available
+ return method.DeclaringType.FullName
+ + "." + method.Name + "()";
+ } else {
+ // Method information not available
+ return "<unknown method>";
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/Calendar.cs b/mcs/class/corlib/System.Globalization/Calendar.cs
new file mode 100644
index 00000000000..8b36614dd27
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/Calendar.cs
@@ -0,0 +1,917 @@
+// Calendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+using System.IO;
+
+/// <remarks>
+/// The class serves as a base class for calendar classes.
+/// </remarks>
+[Serializable]
+public abstract class Calendar {
+ /// <value>An protected integer property that gives the number of
+ /// days in a week. It might be overridden.</value>
+ internal virtual int M_DaysInWeek
+ {
+ get { return 7; }
+ }
+
+ /// <summary>
+ /// The protected method creates the string used in the
+ /// <see cref="T:System.ArgumentOutOfRangeException"/>
+ /// </summary>
+ /// <param name="a">An object that represents the smallest
+ /// allowable value.</param>
+ /// <param name="b">An object that represents the greatest allowable
+ /// value.</param>
+ /// <returns>The string used in the
+ /// <see cref="T:System.ArgumentOutOfRangeException"/>
+ /// </returns>
+ internal string M_ValidValues(object a, object b)
+ {
+ StringWriter sw = new StringWriter();
+ sw.Write("Valid values are between {0} and {1}, inclusive.",
+ a, b);
+ return sw.ToString();
+ }
+
+ /// <summary>
+ /// The protected method checks wether the parameter
+ /// <paramref name="arg"/> is in the allowed range.
+ /// </summary>
+ /// <param name="param">A string that gives the name of the
+ /// parameter to check.</param>
+ /// <param name="arg">An integer that gives the value to check.
+ /// </param>
+ /// <param name="a">An integer that represents the smallest allowed
+ /// value.</param>
+ /// <param name="b">An integer that represents the greatest allowed
+ /// value.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the <paramref name="arg"/> is outside
+ /// the allowed range.
+ /// </exception>
+ internal void M_ArgumentInRange(string param, int arg, int a, int b)
+ {
+ if (a <= arg && arg <= b)
+ return;
+ throw new ArgumentOutOfRangeException(param, M_ValidValues(a, b));
+ }
+
+ /// <summary>
+ /// The protected method, that checks whether
+ /// <paramref name="hour"/>, <paramref name="minute"/>,
+ /// <paramref name="second"/>, and <parameref name="millisecond"/>
+ /// are in their valid ranges
+ /// </summary>
+ /// <param name="hour">An integer that represents a hour,
+ /// should be between 0 and 23.</param>
+ /// <param name="minute">An integer that represents a minute,
+ /// should be between 0 and 59.</param>
+ /// <param name="second">An integer that represents a second,
+ /// should be between 0 and 59.</param>
+ /// <param name="milliseconds">An integer that represents a number
+ /// of milliseconds, should be between 0 and 999999.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The Exception is thrown, if one of the parameter is outside the
+ /// allowed the range.
+ /// </exception>
+ internal void M_CheckHMSM(int hour, int minute, int second,
+ int milliseconds)
+ {
+ M_ArgumentInRange("hour", hour, 0, 23);
+ M_ArgumentInRange("minute", minute, 0, 59);
+ M_ArgumentInRange("second", second, 0, 59);
+ M_ArgumentInRange("milliseconds", milliseconds, 0, 999999);
+ }
+
+ /// <value>
+ /// A represantation of the CurrentEra.
+ /// </value>
+ public const int CurrentEra = 0;
+
+ /// <value>When overridden gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public abstract int[] Eras { get; }
+
+ /// <summary>
+ /// The protected member stores the value for the
+ /// <see cref="P:TwoDigitYearMax"/>
+ /// property.
+ /// </summary>
+ internal int M_TwoDigitYearMax;
+
+
+ /// <summary>
+ /// Private field containing the maximum year for the calendar.
+ /// </summary>
+ private int M_MaxYearValue = 0;
+
+ /// <value>
+ /// Get-only property returing the maximum allowed year for this
+ /// class.
+ /// </value>
+ internal virtual int M_MaxYear {
+ get {
+ if (M_MaxYearValue == 0) {
+ M_MaxYearValue = GetYear(DateTime.MaxValue);
+ }
+ return M_MaxYearValue;
+ }
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal abstract void M_CheckYE(int year, ref int era);
+
+ /// <value>
+ /// <para>The property gives the maximum value for years with two
+ /// digits. If the property has the value 2029, than the two-digit
+ /// integer 29 results in the year 2029 and 30 in the
+ /// year 1930.</para>
+ /// <para>It might be overridden.</para>
+ /// </value>
+ public virtual int TwoDigitYearMax {
+ get { return M_TwoDigitYearMax; }
+ set {
+ M_ArgumentInRange("year", value, 100, M_MaxYear);
+ int era = CurrentEra;
+ M_CheckYE(value, ref era);
+ M_TwoDigitYearMax = value;
+ }
+ }
+
+ /// <summary>
+ /// The virtual method adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddDays(DateTime time, int days) {
+ return time.Add(TimeSpan.FromDays(days));
+ }
+
+ /// <summary>
+ /// The virtual method adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddHours(DateTime time, int hours) {
+ return time.Add(TimeSpan.FromHours(hours));
+ }
+
+ /// <summary>
+ /// The virtual method adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ return time.Add(TimeSpan.FromMilliseconds(milliseconds));
+ }
+
+ /// <summary>
+ /// The virtual method adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddMinutes(DateTime time, int minutes) {
+ return time.Add(TimeSpan.FromMinutes(minutes));
+ }
+
+ /// <summary>
+ /// When overrideden adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public abstract DateTime AddMonths(DateTime time, int months);
+
+ /// <summary>
+ /// The virtual method adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddSeconds(DateTime time, int seconds) {
+ return time.Add(TimeSpan.FromSeconds(seconds));
+ }
+
+ /// <summary>
+ /// A wirtual method that adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddWeeks(DateTime time, int weeks) {
+ return time.AddDays(weeks * M_DaysInWeek);
+ }
+
+ /// <summary>
+ /// When overrideden adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public abstract DateTime AddYears(DateTime time, int years);
+
+ /// <summary>
+ /// When overriden gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public abstract int GetDayOfMonth(DateTime time);
+
+ /// <summary>
+ /// When overriden gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public abstract DayOfWeek GetDayOfWeek(DateTime time);
+
+ /// <summary>
+ /// When overridden gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public abstract int GetDayOfYear(DateTime time);
+
+ /// <summary>
+ /// A virtual method that gives the number of days of the specified
+ /// month of the <paramref name="year"/> and the
+ /// <see cref="P:CurrentEra"/>.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the current
+ /// era.</param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/> or
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public virtual int GetDaysInMonth(int year, int month) {
+ return GetDaysInMonth(year, month, CurrentEra);
+ }
+
+ /// <summary>
+ /// When overridden gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public abstract int GetDaysInMonth(int year, int month, int era);
+
+ /// <summary>
+ /// A virtual method that gives the number of days of the specified
+ /// year of the <see cref="P:CurrentEra"/>.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the current
+ /// era.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public virtual int GetDaysInYear(int year) {
+ return GetDaysInYear(year, CurrentEra);
+ }
+
+ /// <summary>
+ /// When overridden gives the number of days of the specified
+ /// year of the given era..
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public abstract int GetDaysInYear(int year, int era);
+
+ /// <summary>
+ /// When overridden gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public abstract int GetEra(DateTime time);
+
+ /// <summary>
+ /// Virtual method that gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ public virtual int GetHour(DateTime time) {
+ return time.TimeOfDay.Hours;
+ }
+
+ /// <summary>
+ /// Virtual method that gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ public virtual double GetMilliseconds(DateTime time) {
+ return time.TimeOfDay.Milliseconds;
+ }
+
+ /// <summary>
+ /// Virtual method that gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ public virtual int GetMinute(DateTime time) {
+ return time.TimeOfDay.Minutes;
+ }
+
+ /// <summary>
+ /// When overridden gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public abstract int GetMonth(DateTime time);
+
+ /// <summary>
+ /// Virtual method that gives the number of months of the specified
+ /// year of the <see cref="M:CurrentEra"/>.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year is not allowed in the
+ /// current era.
+ /// </exception>
+ public virtual int GetMonthsInYear(int year) {
+ return GetMonthsInYear(year, CurrentEra);
+ }
+
+ /// <summary>
+ /// When overridden gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public abstract int GetMonthsInYear(int year, int era);
+
+ /// <summary>
+ /// Virtual method that gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ public virtual int GetSecond(DateTime time) {
+ return time.TimeOfDay.Seconds;
+ }
+
+ /// <summary>
+ /// A protected method to calculate the number of days between two
+ /// dates.
+ /// </summary>
+ /// <param name="timeA">A <see cref="T:System.DateTime"/>
+ /// representing the first date.
+ /// </param>
+ /// <param name="timeB">A <see cref="T:System.DateTime"/>
+ /// representing the second date.
+ /// </param>
+ /// <returns>An integer that represents the difference of days
+ /// between <paramref name="timeA"/> and <paramref name="timeB"/>.
+ /// </returns>
+ internal int M_DiffDays(DateTime timeA, DateTime timeB) {
+ long diff = timeA.Ticks - timeB.Ticks;
+
+ if (diff >= 0) {
+ return (int)(diff/TimeSpan.TicksPerDay);
+ }
+
+ diff += 1;
+ return -1 + (int)(diff/TimeSpan.TicksPerDay);
+ }
+
+ /// <summary>
+ /// A protected method that gives the first day of the second week of
+ /// the year.
+ /// </summary>
+ /// <param name="year">An integer that represents the year.</param>
+ /// <param name="rule">The
+ /// <see cref="T:System.Globalization.CalendarWeekRule"/>
+ /// to be used for the calculation.
+ /// </param>
+ /// <param name="firstDayOfWeek">
+ /// The <see cref="T:System.Globalization.DayOfWeek"/>
+ /// specifying the first day in a week.
+ /// </param>
+ /// <returns>The <see cref="T:System.DateTime"/> representing
+ /// the first day of the second week of the year.
+ /// </returns>
+ internal DateTime M_GetFirstDayOfSecondWeekOfYear(
+ int year, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
+ {
+ DateTime d1 = ToDateTime(year, 1, 1, 0, 0, 0, 0);
+ int dow1 = (int)GetDayOfWeek(d1);
+ int fdow = (int)firstDayOfWeek;
+ int d = 0;
+
+ switch (rule) {
+ case CalendarWeekRule.FirstDay:
+ if (fdow > dow1) {
+ d += fdow - dow1;
+ }
+ else {
+ d += fdow + M_DaysInWeek - dow1;
+ }
+ break;
+ case CalendarWeekRule.FirstFullWeek:
+ d = M_DaysInWeek;
+ if (fdow >= dow1) {
+ d += fdow - dow1;
+ }
+ else {
+ d += fdow + M_DaysInWeek - dow1;
+ }
+ break;
+ case CalendarWeekRule.FirstFourDayWeek:
+ int dow4 = (dow1 + 3)%M_DaysInWeek;
+
+ d = 3;
+ if (fdow > dow4) {
+ d += fdow - dow4;
+ }
+ else {
+ d += fdow + M_DaysInWeek - dow4;
+ }
+ break;
+ }
+
+ return AddDays(d1, d);
+ }
+
+ /// <summary>
+ /// A virtual method that gives the number of the week in the year.
+ /// </summary>
+ /// <param name="time">A
+ /// <see cref="T:System.DateTime"/> representing the date.
+ /// </param>
+ /// <param name="rule">The
+ /// <see cref="T:System.Globalization.CalendarWeekRule"/>
+ /// to be used for the calculation.
+ /// </param>
+ /// <param name="firstDayOfWeek">
+ /// The <see cref="T:System.Globalization.DayOfWeek"/>
+ /// specifying the first day in a week.
+ /// </param>
+ /// <returns>An integer representing the number of the week in the
+ /// year, starting with 1.
+ /// </returns>
+ public virtual int GetWeekOfYear(DateTime time,
+ CalendarWeekRule rule,
+ DayOfWeek firstDayOfWeek)
+ {
+ if (firstDayOfWeek < DayOfWeek.Sunday ||
+ DayOfWeek.Saturday < firstDayOfWeek)
+ {
+ throw new ArgumentOutOfRangeException("firstDayOfWeek",
+ "Value is not a valid day of week.");
+ }
+ int year = GetYear(time);
+
+ int days;
+
+ while (true) {
+ DateTime secondWeek = M_GetFirstDayOfSecondWeekOfYear(
+ year, rule, firstDayOfWeek);
+ days = M_DiffDays(time, secondWeek) + M_DaysInWeek;
+ if (days >= 0)
+ break;
+ year -= 1;
+ }
+
+ return 1 + days/M_DaysInWeek;
+ }
+
+ /// <summary>
+ /// When overridden gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public abstract int GetYear(DateTime time);
+
+ /// <summary>
+ /// A virtual method that tells whether the given day in the
+ /// <see cref="M:CurrentEra"/> is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month or day is not valid
+ /// the current era.
+ /// </exception>
+ public virtual bool IsLeapDay(int year, int month, int day) {
+ return IsLeapDay(year, month, day, CurrentEra);
+ }
+
+ /// <summary>
+ /// Tells when overridden whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public abstract bool IsLeapDay(int year, int month, int day, int era);
+
+ /// <summary>
+ /// A virtual method that tells whether the given month of the
+ /// specified year in the
+ /// <see cref="M:CurrentEra"/> is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or month is not valid
+ /// the current era.
+ /// </exception>
+ public virtual bool IsLeapMonth(int year, int month) {
+ return IsLeapMonth(year, month, CurrentEra);
+ }
+
+ /// <summary>
+ /// Tells when overridden whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public abstract bool IsLeapMonth(int year, int month, int era);
+
+ /// <summary>
+ /// A virtual method that tells whether the given year
+ /// in the
+ /// <see cref="M:CurrentEra"/> is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year is not valid
+ /// the current era.
+ /// </exception>
+ public virtual bool IsLeapYear(int year) {
+ return IsLeapYear(year, CurrentEra);
+ }
+
+ /// <summary>
+ /// Tells when overridden whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public abstract bool IsLeapYear(int year, int era);
+
+ /// <summary>
+ /// A virtual method that creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <see cref="M:CurrentEra"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public virtual DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds)
+ {
+ return ToDateTime(year, month, day, hour, minute, second,
+ milliseconds, CurrentEra);
+ }
+
+
+ /// <summary>
+ /// When overridden creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public abstract DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era);
+
+ /// <summary>
+ /// A virtual method that converts a two-digit year to a four-digit
+ /// year. It uses the <see cref="M:TwoDigitYearMax"/> property.
+ /// </summary>
+ /// <param name="year">An integer that gives the two-digit year.
+ /// </param>
+ /// <returns>An integer giving the four digit year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year is negative or the resulting
+ /// year is invalid.
+ /// </exception>
+ public virtual int ToFourDigitYear(int year) {
+ if (year < 0)
+ throw new ArgumentOutOfRangeException(
+ "year", "Non-negative number required.");
+ /* seems not to be the right thing to do, but .NET is
+ * doing it this way.
+ */
+ if (year <= 99) {
+ int year2 = TwoDigitYearMax%100;
+ int d = year - year2;
+ year = TwoDigitYearMax + d + (d <= 0 ? 0 : -100);
+ }
+ int era = CurrentEra;
+ M_CheckYE(year, ref era);
+ return year;
+ }
+
+ // TwoDigitYearMax: Windows reads it from the Registry, we
+ // should have an XML file with the defaults
+ /// <summary>
+ /// The default constructor, is sets the TwoDigitYearMax to 2029.
+ /// </summary>
+ /// <remarks>
+ /// The .NET framework reads the value from the registry.
+ /// We should implement it here. Currently I set the default values
+ /// in the ctors of the derived classes, if it is 99.
+ /// </remarks>
+ protected Calendar() {
+ M_TwoDigitYearMax = 99;
+ }
+
+ /// <summary>Protected field storing the abbreviated era names.
+ /// </summary>
+ internal string[] M_AbbrEraNames;
+ /// <summary>Protected field storing the era names.
+ /// </summary>
+ internal string[] M_EraNames;
+
+ /// <value>
+ /// The property stores the era names. It might be overwritten by
+ /// CultureInfo.
+ /// </value>
+ internal string[] AbbreviatedEraNames {
+ get {
+ if (M_AbbrEraNames == null ||
+ M_AbbrEraNames.Length != Eras.Length)
+ throw new Exception(
+ "Internal: M_AbbrEraNames " +
+ "wrong initialized!");
+ return (string[])M_AbbrEraNames.Clone();
+ }
+ set {
+ if (value.Length != Eras.Length) {
+ StringWriter sw = new StringWriter();
+ sw.Write("Array length must be equal Eras " +
+ "length {0}.", Eras.Length);
+ throw new ArgumentException(
+ sw.ToString());
+ }
+ M_AbbrEraNames = (string[])value.Clone();
+ }
+ }
+
+ /// <value>
+ /// The property stores the era names. It might be overwritten by
+ /// CultureInfo.
+ /// </value>
+ internal string[] EraNames {
+ get {
+ if (M_EraNames == null ||
+ M_EraNames.Length != Eras.Length)
+ throw new Exception(
+ "Internal: M_EraNames " +
+ "not initialized!");
+ return (string[])M_EraNames.Clone();
+ }
+ set {
+ if (value.Length != Eras.Length) {
+ StringWriter sw = new StringWriter();
+ sw.Write("Array length must be equal Eras " +
+ "length {0}.", Eras.Length);
+ throw new ArgumentException(
+ sw.ToString());
+ }
+ M_EraNames = (string[])value.Clone();
+ }
+ }
+} // class Calendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs b/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs
new file mode 100644
index 00000000000..936a56e8469
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs
@@ -0,0 +1,28 @@
+// ::MONO
+//
+// System.Globalization.CalendarWeekRule.cs
+//
+// Copyright (C) Wictor Wilén 2001 (wictor@iBizkit.se)
+//
+// Contributors: Wictor Wilén
+//
+// Revisions
+// 2001-09-14: First draft
+// 2001-09-15: First release
+
+using System;
+
+namespace System.Globalization
+{
+ /// <summary>
+ /// The System.Globalization.CalendarWeekRule enumeration
+ /// </summary>
+ public enum CalendarWeekRule
+ {
+ FirstDay = 0,
+ FirstFullWeek = 1,
+ FirstFourDayWeek = 2
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs b/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs
new file mode 100644
index 00000000000..3f493f2cc2e
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs
@@ -0,0 +1,2120 @@
+// CalendricalCalculations.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System.Collections;
+
+/// <summary>A class that provides mathematical functions.</summary>
+/// <remarks>
+/// <para>
+/// We are breaking the .Net
+/// naming conventions to be compatible to the "Calendrical Calculations"
+/// bool.
+/// </para>
+/// </remarks>
+internal class CCMath {
+ /// <summary>
+ /// A static method which rounds a double value.
+ /// </summary>
+ /// <param name="x">The double value to round.</param>
+ /// <returns>The rounded double.</returns>
+ public static double round(double x) {
+ return System.Math.Floor(x+0.5);
+ }
+
+ /// <summary>
+ /// A static method that computes the remainder of the division
+ /// of two doubles.
+ /// </summary>
+ /// <param name="x">The double value which is divided.</param>
+ /// <param name="y">The divisor.</param>
+ /// <returns>The remainder as double value.</returns>
+ public static double mod(double x, double y) {
+ return x - y * System.Math.Floor(x/y);
+ }
+
+ /// <summary>
+ /// The static method divides two integers.
+ /// </summary>
+ /// <param name="x">The integer x value.</param>
+ /// <param name="y">The integer y value.</param>
+ /// <returns>The qotient of x and y defined by floor(x/y).
+ /// </returns>
+ /// <remarks>
+ /// Please notify that the function is not compatible to the standard
+ /// integer divide operation /.
+ /// </remarks>
+ public static int div(int x, int y) {
+ return (int)System.Math.Floor((double)x/(double)y);
+ }
+
+ /// <summary>
+ /// The static method computes the remainder of two integers.
+ /// </summary>
+ /// <param name="x">The integer value which will be divided.</param>
+ /// <param name="y">The divisor integer value.</param>
+ /// <returns> The remainder as integer value.</returns>
+ /// <remarks>
+ /// Please notify that the method is not compatible to the C#
+ /// remainder operation %.
+ /// </remarks>
+ public static int mod(int x, int y) {
+ return x - y * div(x, y);
+ }
+
+ /// <summary>
+ /// A static method that combines integer division and remainder
+ /// computation.
+ /// </summary>
+ /// <param name="remainder">Remainder integer output value.
+ /// </param>
+ /// <param name="x">Integer to be divided.</param>
+ /// <param name="y">Divisor integer value.</param>
+ /// <returns>The quotient as integer.</returns>
+ /// <seealso cref="M:div"/>
+ /// <seealso cref="M:mod"/>
+ public static int div_mod(out int remainder, int x, int y) {
+ int d = div(x, y);
+ remainder = x - y * d;
+ return d;
+ }
+
+ /// <summary>
+ /// A static method returning the sign of the argument.
+ /// </summary>
+ /// <param name="x">The double argument.</param>
+ /// <returns>An integer value: -1 for a negative argument;
+ /// 0 for a zero argument, and 1 for a positive argument.
+ /// </returns>
+ public static int signum(double x) {
+ if (x < 0.0)
+ return -1;
+ if (x == 0.0)
+ return 0;
+ return 1;
+ }
+
+ /// <summary>
+ /// A static method returning the sign of the integer
+ /// argument.
+ /// </summary>
+ /// <param name="x">The integer argument.</param>
+ /// <returns>An integer value: -1 for a negative argument;
+ /// 0 for a zero argument, and 1 for a positive argument.
+ /// </returns>
+ public static int signum(int x) {
+ if (x < 0)
+ return -1;
+ if (x == 0)
+ return 0;
+ return 1;
+ }
+
+ /// <summary>
+ /// An adjusted remainder function as defined in "Calendrical
+ /// Calculations".
+ /// </summary>
+ /// <param name="x">The double x argument.</param>
+ /// <param name="y">The double y argument, the divisor.</param>
+ /// <returns>A double value representing remainder; but instead 0.0
+ /// the divisor y is returned.
+ /// </returns>
+ public static double amod(double x, double y) {
+ double d = mod(x, y);
+ return (d == 0.0) ? y : d;
+ }
+
+ /// <summary>
+ /// The adjusted remainder functions for integers as defined in
+ /// "Calendrical Calculations".
+ /// </summary>
+ /// <param name="x">The integer argument to be divided.</param>
+ /// <param name="y">The integer divisor argument.</param>
+ /// <returns>The remainder as an integer; however instead 0
+ /// is the divisor y returned.
+ /// </returns>
+ public static int amod(int x, int y) {
+ int i = mod(x, y);
+ return (i == 0) ? y : i;
+ }
+}
+
+/// <summary>The class implements methods to handle the fixed date value from
+/// the "Calendrical Calculations" books.
+/// </summary>
+/// <remarks>
+/// <para>
+/// For implementing the Calendar classes I used the algorithms from the
+/// book "Calendrical Calculations" by Nachum Dershowitz and Edward M.
+/// Rheingold, second reprint 1998. Trying to prevent the introduction of new
+/// bugs, I implemented their algorithms in the
+/// <see cref="N:CalendricalCalculations"/>
+/// namespace and wrapped it in the calendar classes.
+/// </para>
+/// <para>
+/// The fixed day number is also known as R.D. - rata die.
+/// Midnight at the onset of Monday,
+/// January 1, year 1 (Gregorian) is R.D. 1.
+/// </para>
+/// <para>Here are all my references:</para>
+/// <list type="table">
+/// <item><description>
+/// [1] Nachum Dershowitz and Edward M. Rheingold: "Calendrical Calculations";
+/// Cambridge University Press; second reprint 1998.
+/// </description></item>
+/// <item><description>
+/// [2] P. Kenneth Seidelmann (ed.): "Explanatory Supplement to the Astronomical
+/// Almanac"; University Science Books, Sausalito; 1992
+/// </description></item>
+/// <item><description>
+/// [3] F. Richard Stephenson: "Historical Eclipses and Earth Rotation";
+/// Cambridge University Press; 1997
+/// </description></item>
+/// </list>
+/// </remarks>
+internal class CCFixed {
+ /// <summary>The method computes the
+ /// <see cref="T:System.DateTime"/>
+ /// from a fixed day number.
+ /// </summary>
+ /// <param name="date">A integer representing the fixed day number.
+ /// </param>
+ /// <returns>The <see cref="T:System.DateTime"/> representing
+ /// the date.
+ /// </returns>
+ public static System.DateTime ToDateTime(int date) {
+ long ticks = (date - 1) * System.TimeSpan.TicksPerDay;
+ return new System.DateTime(ticks);
+ }
+
+ /// <summary>The method computes the
+ /// <see cref="T:System.DateTime"/>
+ /// from a fixed day number and time arguments.
+ /// </summary>
+ /// <param name="date">An integer representing the fixed day number.
+ /// </param>
+ /// <param name="hour">An integer argument specifying the hour.
+ /// </param>
+ /// <param name="minute">An integer argument specifying the minute.
+ /// </param>
+ /// <param name="second">An integer argument giving the second.
+ /// </param>
+ /// <param name="milliseconds">An double argument specifying
+ /// the milliseconds. Notice that
+ /// <see cref="T:System.DateTime"/> has 100 nanosecond resolution.
+ /// </param>
+ /// <returns>The <see cref="T:System.DateTime"/> representing
+ /// the date.
+ /// </returns>
+ public static System.DateTime ToDateTime(int date,
+ int hour, int minute, int second, double milliseconds)
+ {
+ System.DateTime time = ToDateTime(date);
+ time = time.AddHours(hour);
+ time = time.AddMinutes(minute);
+ time = time.AddSeconds(second);
+ return time.AddMilliseconds(milliseconds);
+ }
+
+ /// <summary>
+ /// A static method computing the fixed day number from a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">A
+ /// <see cref="T:System.DateTime"/> value representing the date.
+ /// </param>
+ /// <returns>The fixed day number as integer representing the date.
+ /// </returns>
+ public static int FromDateTime(System.DateTime time) {
+ return 1 + (int)(time.Ticks / System.TimeSpan.TicksPerDay);
+ }
+
+ /// <summary>
+ /// The static method computes the <see cref="T:DayOfWeek"/>.
+ /// </summary>
+ /// <param name="date">An integer representing the fixed day number.
+ /// </param>
+ /// <returns>The day of week.</returns>
+ public static DayOfWeek day_of_week(int date) {
+ return (DayOfWeek)CCMath.mod(date, 7);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week on or before
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// on or before the given date.
+ /// </returns>
+ public static int kday_on_or_before(int date, int k) {
+ return date - (int)day_of_week(date-k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week on or after
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// on or after the given date.
+ /// </returns>
+ public static int kday_on_or_after(int date, int k) {
+ return kday_on_or_before(date+6, k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week that is
+ /// nearest to a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week neares to the
+ /// given date.
+ /// </returns>
+ public static int kd_nearest(int date, int k) {
+ return kday_on_or_before(date+3, k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week after
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// after the given date.
+ /// </returns>
+ public static int kday_after(int date, int k) {
+ return kday_on_or_before(date+7, k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week before
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// before the given date.
+ /// </returns>
+ public static int kday_before(int date, int k) {
+ return kday_on_or_before(date-1, k);
+ }
+} // class CCFixed
+
+/// <summary>
+/// A class encapsulating the functions of the Gregorian calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.GregorianCalendar"/>.
+/// </para>
+/// <para>
+/// The fixed day number is also known as R.D. - rata die.
+/// Midnight at the onset of Monday,
+/// January 1, year 1 (Gregorian) is R.D. 1.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+internal class CCGregorianCalendar {
+ /// <summary>An integer defining the epoch of the Gregorian calendar
+ /// as fixed day number.</summary>
+ /// <remarks>The epoch is January 3, 1 C.E. (Julian).</remarks>
+ const int epoch = 1;
+
+ /// <summary>The enumeration defines the months of the Gregorian
+ /// calendar.
+ /// </summary>
+ public enum Month {
+ /// <summary>
+ /// January.
+ /// </summary>
+ january = 1,
+ /// <summary>
+ /// February.
+ /// </summary>
+ february,
+ /// <summary>
+ /// March.
+ /// </summary>
+ march,
+ /// <summary>
+ /// April.
+ /// </summary>
+ april,
+ /// <summary>
+ /// May.
+ /// </summary>
+ may,
+ /// <summary>
+ /// June.
+ /// </summary>
+ june,
+ /// <summary>
+ /// July.
+ /// </summary>
+ july,
+ /// <summary>
+ /// August.
+ /// </summary>
+ august,
+ /// <summary>
+ /// September.
+ /// </summary>
+ september,
+ /// <summary>
+ /// October.
+ /// </summary>
+ october,
+ /// <summary>
+ /// November.
+ /// </summary>
+ november,
+ /// <summary>
+ /// December.
+ /// </summary>
+ december
+ };
+
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ if (CCMath.mod(year, 4) != 0)
+ return false;
+ switch (CCMath.mod(year, 400)) {
+ case 100:
+ return false;
+ case 200:
+ return false;
+ case 300:
+ return false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Gregorian
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Gregorian year.
+ /// </param>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int k = epoch - 1;
+ k += 365 * (year-1);
+ k += CCMath.div(year-1, 4);
+ k -= CCMath.div(year-1, 100);
+ k += CCMath.div(year-1, 400);
+ k += CCMath.div(367*month-362, 12);
+ if (month > 2) {
+ k += is_leap_year(year) ? -1 : -2;
+ }
+
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Gregorian year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Gregorian year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ int d = date - epoch;
+ int n_400 = CCMath.div_mod(out d, d, 146097);
+ int n_100 = CCMath.div_mod(out d, d, 36524);
+ int n_4 = CCMath.div_mod(out d, d, 1461);
+ int n_1 = CCMath.div(d, 365);
+
+ int year = 400*n_400 + 100*n_100 + 4*n_4 + n_1;
+ return (n_100 == 4 || n_1 == 4) ? year : year + 1;
+ }
+
+ /// <summary>
+ /// The method computes the Gregorian year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Gregorian month.
+ /// </param>
+ /// <param name="year">The output value giving the Gregorian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year,
+ int date)
+ {
+ year = year_from_fixed(date);
+
+ int prior_days = date - fixed_from_dmy(1, (int)Month.january,
+ year);
+
+ int correction;
+ if (date < fixed_from_dmy(1, (int)Month.march, year)) {
+ correction = 0;
+ } else if (is_leap_year(year)) {
+ correction = 1;
+ } else {
+ correction = 2;
+ }
+
+ month = CCMath.div(12 * (prior_days + correction) + 373, 367);
+
+ }
+
+ /// <summary>
+ /// The method computes the Gregorian year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Gregorian month.
+ /// </param>
+ /// <param name="year">The output value giving the Gregorian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year,
+ int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Gregorian month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Gregorian month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day, month, year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Gregorian dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Gregorian
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Gregorian
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Gregorian
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Gregorian
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Gregorian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Gregorian year.
+ /// </param>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Gregorian year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(31, (int)Month.december, year-1,
+ day, month, year);
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Gregorian
+ /// year from a Gregorian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Gregorian year.
+ /// </param>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Gregorian year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,
+ 31, (int)Month.december, year);
+ }
+
+ // Helper functions for the Gregorian calendars.
+
+ /// <summary>
+ /// Adds months to the given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public static System.DateTime AddMonths(System.DateTime time,
+ int months)
+ {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ dmy_from_fixed(out day, out month, out year, rd);
+ month += months;
+ rd = fixed_from_dmy(day, month, year);
+ System.DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Adds years to the given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public static System.DateTime AddYears(System.DateTime time,
+ int years)
+ {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ dmy_from_fixed(out day, out month, out year, rd);
+ year += years;
+ rd = fixed_from_dmy(day, month, year);
+ System.DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Gets the of the month from <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public static int GetDayOfMonth(System.DateTime time) {
+ return day_from_fixed(CCFixed.FromDateTime(time));
+ }
+
+ /// <summary>
+ /// The method gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public static int GetDayOfYear(System.DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int year = year_from_fixed(rd);
+ int rd1_1 = fixed_from_dmy(1, 1, year);
+ return rd - rd1_1 + 1;
+ }
+
+ /// <summary>
+ /// A method that gives the number of days of the specified
+ /// month of the <paramref name="year"/>.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the current
+ /// era.</param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ public static int GetDaysInMonth(int year, int month) {
+ int rd1 = fixed_from_dmy(1, month, year);
+ int rd2 = fixed_from_dmy(1, month+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// The method gives the number of days in the specified year.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ public static int GetDaysInYear(int year) {
+ int rd1 = fixed_from_dmy(1, 1, year);
+ int rd2 = fixed_from_dmy(1, 1, year+1);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// The method gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public static int GetMonth(System.DateTime time) {
+ return month_from_fixed(CCFixed.FromDateTime(time));
+ }
+
+ /// <summary>
+ /// The method gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year.
+ /// </returns>
+ public static int GetYear(System.DateTime time) {
+ return year_from_fixed(CCFixed.FromDateTime(time));
+ }
+
+ /// <summary>
+ /// A virtual method that tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ public static bool IsLeapDay(int year, int month, int day) {
+ return is_leap_year(year) && month == 2 && day == 29;
+ }
+
+ /// <summary>
+ /// A method that creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ public static System.DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds)
+ {
+ return CCFixed.ToDateTime(fixed_from_dmy(day, month, year),
+ hour, minute, second, milliseconds);
+ }
+} // class CCGregorianCalendar
+
+/// <summary>
+/// A class encapsulating the functions of the Julian calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>The algorithms don't support a year 0. Years before Common Era
+/// (B.C.E. or B.C.) are negative and years of Common Era (C.E. or A.D.)
+/// are positive.
+/// </para>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.JulianCalendar"/>.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+internal class CCJulianCalendar {
+ /// <summary>An integer defining the epoch of the Julian calendar
+ /// as fixed day number.</summary>
+ /// <remarks>The epoch is December 30, 0 (Gregorian).</remarks>
+ const int epoch = -1; // 30. 12. 0 Gregorian
+
+ /// <summary>The enumeration defines the months of the Julian
+ /// calendar.
+ /// </summary>
+ public enum Month {
+ /// <summary>
+ /// January.
+ /// </summary>
+ january = 1,
+ /// <summary>
+ /// February.
+ /// </summary>
+ february,
+ /// <summary>
+ /// March.
+ /// </summary>
+ march,
+ /// <summary>
+ /// April.
+ /// </summary>
+ april,
+ /// <summary>
+ /// May.
+ /// </summary>
+ may,
+ /// <summary>
+ /// June.
+ /// </summary>
+ june,
+ /// <summary>
+ /// July.
+ /// </summary>
+ july,
+ /// <summary>
+ /// August.
+ /// </summary>
+ august,
+ /// <summary>
+ /// September.
+ /// </summary>
+ september,
+ /// <summary>
+ /// October.
+ /// </summary>
+ october,
+ /// <summary>
+ /// November.
+ /// </summary>
+ november,
+ /// <summary>
+ /// December.
+ /// </summary>
+ december
+ };
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Julian year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ return CCMath.mod(year, 4) == (year > 0 ? 0 : 3);
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Julian
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Julian year.
+ /// </param>
+ /// <param name="year">An integer representing the Julian year.
+ /// Positive and Negative values are allowed.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int y = year < 0 ? year+1 : year;
+ int k = epoch - 1;
+ k += 365 * (y-1);
+ k += CCMath.div(y-1, 4);
+ k += CCMath.div(367*month-362, 12);
+ if (month > 2) {
+ k += is_leap_year(year) ? -1 : -2;
+ }
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Julian year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Julian year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ int approx = CCMath.div(4*(date-epoch)+1464, 1461);
+ return approx <= 0 ? approx - 1 : approx;
+ }
+
+ /// <summary>
+ /// The method computes the Julian year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Julian month.
+ /// </param>
+ /// <param name="year">The output value giving the Julian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year, int date)
+ {
+ year = year_from_fixed(date);
+
+ int prior_days = date - fixed_from_dmy(1, (int)Month.january,
+ year);
+
+ int correction;
+ if (date < fixed_from_dmy(1, (int)Month.march, year)) {
+ correction = 0;
+ } else if (is_leap_year(year)) {
+ correction = 1;
+ } else {
+ correction = 2;
+ }
+
+ month = CCMath.div(12 * (prior_days + correction) + 373, 367);
+ }
+
+
+ /// <summary>
+ /// The method computes the Julian year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Julian month.
+ /// </param>
+ /// <param name="year">The output value giving the Julian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year, int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Julian month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Julian month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day;
+ int month;
+ int year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Julian dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Julian
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Julian
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Julian
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Julian
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Julian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Julian year.
+ /// </param>
+ /// <param name="year">An integer representing the Julian year.
+ /// Negative values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Julian year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(31, (int)Month.december, year-1,
+ day, month, year);
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Julian
+ /// year from a Julian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Julian year.
+ /// </param>
+ /// <param name="year">An integer representing the Julian year.
+ /// Negative values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Julian year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,
+ 31, (int)Month.december, year);
+ }
+} // class CCJulianCalendar
+
+/// <summary>
+/// A class encapsulating the functions of the Hebrew calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.HebrewCalendar"/>.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+internal class CCHebrewCalendar {
+ /// <summary>An integer defining the epoch of the Hebrew calendar
+ /// as fixed day number.</summary>
+ /// <remarks>The epoch is October 10, 3761 B.C.E. (Julian).</remarks>
+ const int epoch = -1373427;
+
+ /// <summary>The enumeration defines the months of the Gregorian
+ /// calendar.
+ /// </summary>
+ /// <remarks>
+ /// The enumaration differs from .NET which defines Tishri as month 1.
+ /// </remarks>
+ public enum Month {
+ /// <summary>
+ /// Nisan.
+ /// </summary>
+ nisan = 1,
+ /// <summary>
+ /// Iyyar.
+ /// </summary>
+ iyyar,
+ /// <summary>
+ /// Sivan.
+ /// </summary>
+ sivan,
+ /// <summary>
+ /// Tammuz.
+ /// </summary>
+ tammuz,
+ /// <summary>
+ /// Av.
+ /// </summary>
+ av,
+ /// <summary>
+ /// Elul.
+ /// </summary>
+ elul,
+ /// <summary>
+ /// Tishri.
+ /// </summary>
+ tishri,
+ /// <summary>
+ /// Heshvan.
+ /// </summary>
+ heshvan,
+ /// <summary>
+ /// Kislev.
+ /// </summary>
+ kislev,
+ /// <summary>
+ /// Teveth.
+ /// </summary>
+ teveth,
+ /// <summary>
+ /// Shevat.
+ /// </summary>
+ shevat,
+ /// <summary>
+ /// Adar.
+ /// </summary>
+ adar,
+ /// <summary>
+ /// Adar I. Only in years with Adar II.
+ /// </summary>
+ adar_I = 12,
+ /// <summary>
+ /// Adar II. Only in years wirh Adar I.
+ /// </summary>
+ adar_II = 13,
+ };
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ return CCMath.mod(7*year+1, 19) < 7;
+ }
+
+ /// <summary>
+ /// The Method gives the number of the last month in a year, which
+ /// is equal with the number of month in a Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>An integer giving the number of the last month of the
+ /// Hebrew year, which is the same as the numbers of month in the
+ /// year.
+ /// </returns>
+ public static int last_month_of_year(int year) {
+ return is_leap_year(year) ? 13 : 12;
+ }
+
+
+ /// <summary>The method is a helper function.</summary>
+ /// <param name="year">An integer specifying the Hebrew year.
+ /// </param>
+ /// <returns>An integer representing the number of elapsed days
+ /// until the Hebrew year.</returns>
+ public static int elapsed_days(int year) {
+ int months_elapsed = CCMath.div(235*year-234, 19);
+ int r;
+ int d = CCMath.div_mod(out r, months_elapsed, 1080);
+ int parts_elapsed = 204 + 793 * r;
+ int hours_elapsed = 11 + 12 * months_elapsed +
+ 793 * d + CCMath.div(parts_elapsed, 1080);
+
+ int day = 29*months_elapsed + CCMath.div(hours_elapsed, 24);
+
+ if (CCMath.mod(3*(day+1), 7) < 3) {
+ day += 1;
+ }
+
+ return day;
+ }
+
+ /// <summary>A method computing the delay of new year for the given
+ /// Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>The new year delay in days of the given Hebrew year.
+ /// </returns>
+ public static int new_year_delay(int year) {
+ int ny1 = elapsed_days(year);
+ int ny2 = elapsed_days(year+1);
+
+ if (ny2 - ny1 == 356) {
+ return 2;
+ }
+ int ny0 = elapsed_days(year-1);
+ if (ny1 - ny0 == 382) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /// <summary>
+ /// The method computes the last day of month (nummer of days in a
+ /// month) of the given Hebrew year.
+ /// </summary>
+ /// <param name="month">The Hebrew month, allowed value between
+ /// One and Thirteen.
+ /// </param>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>The number of the last day of the month of the given
+ /// Hebrew year, which gives automatically the number of days in the
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRange.Exception">
+ /// The exception is thrown if month not between One and Thirteen.
+ /// </exception>
+ public static int last_day_of_month(int month, int year) {
+ if (month < 1 || month > 13)
+ throw new System.ArgumentOutOfRangeException("month",
+ "Month should be between One and Thirteen.");
+ switch (month) {
+ case 2: return 29;
+ case 4: return 29;
+ case 6: return 29;
+ case 8:
+ if (!long_heshvan(year))
+ return 29;
+ break;
+ case 9:
+ if (short_kislev(year))
+ return 29;
+ break;
+ case 10: return 29;
+ case 12:
+ if (!is_leap_year(year))
+ return 29;
+ break;
+ case 13: return 29;
+ }
+ return 30;
+ }
+
+ /// <summary>
+ /// The functions checks whether the month Heshvan is a long one
+ /// in the given Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>A boolean value: true if there is a long Heshvan
+ /// in the given Hebrew year; false otherwise.
+ /// </returns>
+ public static bool long_heshvan(int year) {
+ return CCMath.mod(days_in_year(year), 10) == 5;
+ }
+
+ /// <summary>
+ /// The functions checks whether the month Kislev is a short one
+ /// in the given Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>A boolean value: true if there is a short Kislev
+ /// in the given Hebrew year; false otherwise.
+ /// </returns>
+ public static bool short_kislev(int year) {
+ return CCMath.mod(days_in_year(year), 10) == 3;
+ }
+
+ /// <summary>
+ /// The functions gives the number of days in the specified Hebrew
+ /// year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>The days of the Hebrew year as integer.
+ /// </returns>
+ public static int days_in_year(int year) {
+ return fixed_from_dmy(1, 7, year+1) -
+ fixed_from_dmy(1, 7, year);
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Hebrew
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Hebrew year.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int m;
+ int k = epoch-1;
+ k += elapsed_days(year);
+ k += new_year_delay(year);
+
+ if (month < 7) {
+ int l = last_month_of_year(year);
+ for (m = 7; m <= l; m++) {
+ k += last_day_of_month(m, year);
+ }
+ for (m = 1; m < month; m++) {
+ k += last_day_of_month(m, year);
+ }
+ }
+ else {
+ for (m = 7; m < month; m++) {
+ k += last_day_of_month(m, year);
+ }
+ }
+
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Hebrew year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Hebrew year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ int approx = (int)System.Math.Floor(
+ ((double)(date - epoch))/(35975351.0/98496.0));
+ int y;
+ for (y = approx; date >= fixed_from_dmy(1, 7, y); y++) {}
+ return y-1;
+ }
+
+ /// <summary>
+ /// The method computes the Hebrew year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Hebrew month.
+ /// </param>
+ /// <param name="year">The output value giving the Hebrew year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year,
+ int date)
+ {
+ year = year_from_fixed(date);
+
+ int start = date < fixed_from_dmy(1, 1, year) ? 7 : 1;
+
+ for (month = start;
+ date > fixed_from_dmy(last_day_of_month(month, year),
+ month, year);
+ month++)
+ {}
+ }
+
+ /// <summary>
+ /// The method computes the Hebrew year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Hebrew month.
+ /// </param>
+ /// <param name="year">The output value giving the Hebrew year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year, int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Hebrew month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Hebrew month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day, month, year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Hebrew dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Hebrew
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Hebrew
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Hebrew
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Hebrew
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Hebrew date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Hebrew year.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Hebrew year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(1, 7, year,
+ day, month, year) + 1;
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Hebrew
+ /// year from a Hebrew date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Hebrew year.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Hebrew year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,
+ 1, 7, year+1)-1;
+ }
+} // class HebrewCalendar
+
+
+/// <summary>
+/// A class encapsulating the functions of the Islamic calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>There is no difference here in using Hijri or Islamic calendar.
+/// </para>
+/// <para>The epoch of the Islamic calendar isn't fixed, because we cannot
+/// surely say today, when the crescent of the new moon has been observed
+/// around the July 16, 622 C.E. Julian. Even today the start and end of
+/// the month Ramadan is defined by religous authorities. So the calendar
+/// can be offset by two days.
+/// </para>
+/// <para>
+/// We don't support the offset here, however we changed the epoch from
+/// "Calendrical Calculations" to value, that .Net seems to be using.
+/// </para>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.HijriCalendar"/>.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+public class CCHijriCalendar {
+ /// <summary>An integer defining the epoch of the Gregorian calendar
+ /// as fixed day number.</summary>
+ /// <remarks>
+ /// <para>
+ /// The epoch is given as 16 July 622 C.E. Julian (R.D. 227015)
+ /// in Calendrical Calculations, the approximate date of
+ /// the emigration of
+ /// Muhammed to Medina. However there is no way to determine today
+ /// the observation of the crescent of the new moon in July 622 C.E.
+ /// (Julian). So there is some variability in the epoch.
+ /// Religous authorities determine the epoch by observing the
+ /// crescent of the new moon for the month Ramadan, so there might
+ /// be an offsets by two days of the epoch.
+ /// </para>
+ /// <para>Windows
+ /// supports an AddHijriDate parameter in the registry to adapt
+ /// for it. It seems that the .NET implementation of
+ /// HijriCalendar uses an epoch of 227014, so we use it here. The
+ /// ArgumentOutOfRangeException gives July, 18 622 as epoch,
+ /// which is 227014 supporting our theory.
+ /// </para>
+ /// </remarks>
+ const int epoch = 227014;
+
+ /// <summary>The enumeration defines the months of the Islamic
+ /// calendar.
+ /// </summary>
+ public enum Month {
+ /// <summary>
+ /// Muharram.
+ /// </summary>
+ muharram = 1,
+ /// <summary>
+ /// Safar.
+ /// </summary>
+ safar,
+ /// <summary>
+ /// Rabi I.
+ /// </summary>
+ rabi_I,
+ /// <summary>
+ /// Rabi II.
+ /// </summary>
+ rabi_II,
+ /// <summary>
+ /// Jumada I.
+ /// </summary>
+ jumada_I,
+ /// <summary>
+ /// Jumada II.
+ /// </summary>
+ jumada_II,
+ /// <summary>
+ /// Rajab.
+ /// </summary>
+ rajab,
+ /// <summary>
+ /// Shaban.
+ /// </summary>
+ shaban,
+ /// <summary>
+ /// Ramadan.
+ /// </summary>
+ ramadan,
+ /// <summary>
+ /// Shawwal.
+ /// </summary>
+ shawwal,
+ /// <summary>
+ /// Dhu Al-Quada.
+ /// </summary>
+ dhu_al_quada,
+ /// <summary>
+ /// Dhu Al-Hijja.
+ /// </summary>
+ dhu_al_hijja,
+ };
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Islamic year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ return CCMath.mod(14+11*year, 30) < 11;
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Islamic
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Islamic year.
+ /// </param>
+ /// <param name="year">An integer representing the Islamic year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int k = epoch - 1;
+ k += 354 * (year-1);
+ k += CCMath.div(3+11*year, 30);
+ k += (int)System.Math.Ceiling(29.5 * (double)(month-1));
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Islamic year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Islamic year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ return CCMath.div(30*(date-epoch)+10646, 10631);
+ }
+
+ /// <summary>
+ /// The method computes the Islamic year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Islamic month.
+ /// </param>
+ /// <param name="year">The output value giving the Islamic year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year, int date)
+ {
+ year = year_from_fixed(date);
+
+ int m = 1+(int)System.Math.Ceiling(
+ ((double)(date-29-fixed_from_dmy(1,1,year)))/29.5);
+
+ month = m < 12 ? m : 12;
+ }
+
+ /// <summary>
+ /// The method computes the Islamic year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Islamic month.
+ /// </param>
+ /// <param name="year">The output value giving the Islamic year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year, int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Islamic month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Islamic month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day;
+ int month;
+ int year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Islamic dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Islamic
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Islamic
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Islamic
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Islamic
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Islamic date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Islamic year.
+ /// </param>
+ /// <param name="year">An integer representing the Islamic year.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Islamic year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(31, 12, year-1, day, month, year);
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Islamic
+ /// year from a Islamic date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Islamic year.
+ /// </param>
+ /// <param name="year">An integer representing the Islamic year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Islamic year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,31, 12, year);
+ }
+} // class CCHijriCalendar
+
+/// <summary>
+/// A class that supports the Gregorian based calendars with other eras
+/// (e.g. <see cref="T:System.Gloablization.JapaneseCalendar"/>).
+/// </summary>
+[System.Serializable]
+public class CCGregorianEraHandler {
+ /// <summary>
+ /// A struct that represents a single era.
+ /// </summary>
+ [System.Serializable]
+ struct Era {
+ /// <summary>
+ /// The integer number identifying the era.
+ /// </summary>
+ private int _nr;
+
+ /// <value>
+ /// A get-only property that gives the era integer number.
+ /// </value>
+ public int Nr { get { return _nr; } }
+
+ /// <summary>This integer gives the first day of the era as
+ /// fixed day number.
+ /// </summary>
+ private int _start; // inclusive
+ /// <summary>
+ /// This integer gives the gregorian year of the
+ /// <see cref="M:_start"/> value.
+ /// </summary>
+ private int _gregorianYearStart;
+ /// <summary>
+ /// This integer gives the last day of the era as fixed day
+ /// number.
+ /// </summary>
+ private int _end; // inclusive
+ /// <summary>
+ /// This integer gives the largest year number of this era.
+ /// </summary>
+ private int _maxYear;
+
+ /// <summary>
+ /// This constructor creates the era structure.
+ /// </summary>
+ /// <param name="nr">The integer number of the era.
+ /// </param>
+ /// <param name="start">The fixed day number defining the
+ /// first day of the era.
+ /// </param>
+ /// <param name="end">The fixed day number that defines the
+ /// last day of the era.
+ /// </param>
+ public Era(int nr, int start, int end) {
+ if (nr == 0)
+ throw new System.ArgumentException(
+ "Era number shouldn't be zero.");
+ _nr = nr;
+ if (start > end) {
+ throw new System.ArgumentException(
+ "Era should start before end.");
+ }
+ _start = start;
+ _end = end;
+
+ _gregorianYearStart =
+ CCGregorianCalendar.year_from_fixed(_start);
+ int gregorianYearEnd =
+ CCGregorianCalendar.year_from_fixed(_end);
+ _maxYear = gregorianYearEnd - _gregorianYearStart + 1;
+ }
+
+ /// <summary>
+ /// This method computes the Gregorian year from the year
+ /// of this era.
+ /// </summary>
+ /// <param name="year">An integer giving the year in the
+ /// era.
+ /// </param>
+ /// <returns>
+ /// The Gregorian year as integer.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year isn't valid in this
+ /// era.
+ /// </exception>
+ public int GregorianYear(int year) {
+ if (year < 1 || year > _maxYear) {
+ System.IO.StringWriter sw =
+ new System.IO.StringWriter();
+ sw.Write(
+ "Valid Values are between " +
+ "{0} and {1}, inclusive.",
+ 1, _maxYear);
+ throw new System.ArgumentOutOfRangeException(
+ "year", sw.ToString());
+ }
+ return year + _gregorianYearStart - 1;
+ }
+
+ /// <summary>
+ /// This function checks wether the given fixed day number is
+ /// ion the time span of the era.
+ /// </summary>
+ /// <param name="date">An integer giving the fixed day
+ /// number.
+ /// </param>
+ /// <returns>A boolean: true if the argument is in the time
+ /// span of the era.
+ /// </returns>
+ public bool Covers(int date) {
+ return _start <= date && date <= _end;
+ }
+
+ /// <summary>
+ /// This function returns the year of the era and sets
+ /// the era in an output parameter.
+ /// </summary>
+ /// <param name="era">An output parameter returning the
+ /// era number.
+ /// </param>
+ /// <param name="date">An integer giving the fixed day
+ /// number.
+ /// </param>
+ /// <returns>An integer giving the year of the era.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if date is outside of the time
+ /// span of the era.
+ /// </exception>
+ public int EraYear(out int era, int date) {
+ if (!Covers(date))
+ throw new System.ArgumentOutOfRangeException(
+ "date",
+ "Time was out of Era range.");
+ int gregorianYear =
+ CCGregorianCalendar.year_from_fixed(date);
+ era = _nr;
+ return gregorianYear - _gregorianYearStart + 1;
+ }
+ } // struct Era
+
+ /// <summary>
+ /// A private member storing the eras in a
+ /// <see cref="T:System.Collections.SortedList"/>.
+ /// </summary>
+ private SortedList _Eras;
+
+ /// <value>
+ /// The property returns the era numbers as an array of integers.
+ /// </value>
+ public int[] Eras {
+ get {
+ int[] a = new int[_Eras.Count];
+
+ for (int i = 0; i < _Eras.Count; i++) {
+ Era e = (Era)_Eras.GetByIndex(i);
+ a[i] = e.Nr;
+ }
+
+ return a;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public CCGregorianEraHandler() {
+ _Eras = new SortedList();
+ }
+
+ /// <summary>
+ /// Method adds an era to the GregorianEraHandler instance.
+ /// </summary>
+ /// <param name="nr">The integer number of the era.
+ /// </param>
+ /// <param name="rd_start">The fixed day number defining the
+ /// first day of the era.
+ /// </param>
+ /// <param name="rd_end">The fixed day number that defines the
+ /// last day of the era.
+ /// </param>
+ public void appendEra(int nr, int rd_start, int rd_end) {
+ Era era = new Era(nr, rd_start, rd_end);
+ _Eras[(System.Object)nr] = era;
+ }
+ /// <summary>
+ /// Method adds a yet not-ended era to the GregorianEraHandler
+ /// instance.
+ /// </summary>
+ /// <param name="nr">The integer number of the era.
+ /// </param>
+ /// <param name="rd_start">The fixed day number defining the
+ /// first day of the era.
+ /// </param>
+ public void appendEra(int nr, int rd_start) {
+ appendEra(nr, rd_start,
+ CCFixed.FromDateTime(DateTime.MaxValue));
+ }
+
+ /// <summary>
+ /// This method computes the Gregorian year from the year
+ /// of the given era.
+ /// </summary>
+ /// <param name="year">An integer giving the year in the
+ /// era.
+ /// </param>
+ /// <param name="era">An integer giving the era number.
+ /// </param>
+ /// <returns>
+ /// The Gregorian year as integer.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year isn't valid in this
+ /// era.
+ /// </exception>
+ public int GregorianYear(int year, int era) {
+ Era e = (Era)_Eras[(System.Object)era];
+ return e.GregorianYear(year);
+ }
+
+ /// <summary>
+ /// This function returns the year of the era and sets
+ /// the era in an output parameter.
+ /// </summary>
+ /// <param name="era">An output parameter returning the
+ /// era number.
+ /// </param>
+ /// <param name="date">An integer giving the fixed day
+ /// number.
+ /// </param>
+ /// <returns>An integer giving the year of the era.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the fixed day number is outside of the
+ /// time spans of all eras.
+ /// </exception>
+ public int EraYear(out int era, int date)
+ {
+ IList list = _Eras.GetValueList();
+
+ foreach (Era e in list) {
+ if (e.Covers(date))
+ return e.EraYear(out era, date);
+ }
+
+ throw new System.ArgumentOutOfRangeException("date",
+ "Time value was out of era range.");
+ }
+
+ /// <summary>
+ /// The method checks whether a given
+ /// <see cref="T:System.DateTime"/> is covered by any era.
+ /// </summary>
+ /// <param name="time">A
+ /// <see cref="T:System.DateTime"/> giving the date and time.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the argument isn't inside the time
+ /// span of any era.
+ /// </exception>
+ public void CheckDateTime(System.DateTime time) {
+ int date = CCFixed.FromDateTime(time);
+
+ if (!ValidDate(date))
+ throw new System.ArgumentOutOfRangeException("time",
+ "Time value was out of era range.");
+ }
+
+ /// <summary>
+ /// The method tests whether a given
+ /// fixed day number is covered by any era.
+ /// </summary>
+ /// <param name="date">An integer representing the fixed day number.
+ /// </param>
+ /// <returns> A boolean is returned: true if the argument is inside
+ /// the time span of one era; false otherwise.
+ /// </returns>
+ public bool ValidDate(int date) {
+ IList list = _Eras.GetValueList();
+
+ foreach (Era e in list) {
+ if (e.Covers(date))
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// The method tests, whether the era number does exist.
+ /// </summary>
+ /// <param name="era">An integer giving the era number.
+ /// </param>
+ /// <returns>A boole value: True if the era number does exist;
+ /// false otherwise.
+ /// </returns>
+ public bool ValidEra(int era) {
+ return _Eras.Contains((System.Object)era);
+ }
+} // class CCGregorianEraHandler
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog
new file mode 100644
index 00000000000..6f9eb8e85e6
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/ChangeLog
@@ -0,0 +1,147 @@
+
+Mon Nov 18 13:02:09 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * CultureInfo.cs: implemented Equals and GetHashCode.
+
+2002-10-17 Duncan Mak <duncan@ximian.com>
+
+ * CultureInfo.cs (TextInfo): return a TextInfo in the property.
+
+ * TextInfo.cs (ToLower):
+ (ToTitleCase): Implemented.
+
+2002-09-12 Dick Porter <dick@ximian.com>
+
+ * ThaiBuddhistCalendar.cs:
+ * TextInfo.cs:
+ * TaiwanCalendar.cs:
+ * RegionInfo.cs:
+ * KoreanCalendar.cs:
+ * JulianCalendar.cs:
+ * JapaneseCalendar.cs:
+ * HijriCalendar.cs:
+ * HebrewCalendar.cs:
+ * GregorianCalendar.cs:
+ * CultureInfo.cs:
+ * CompareInfo.cs: Stub out missing methods
+
+2002-08-15 Tim Coleamn <tim@timcoleman.com>
+ * CompareInfo.cs:
+ Stubbed out some methods.
+
+2002-08-14 Dick Porter <dick@ximian.com>
+
+ * CultureInfo.cs: Implement Name, stub out all the other missing
+ methods.
+
+ * TextInfo.cs: Stubbed out this class
+
+2002-06-12 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeFormatInfo.cs: Reformat.
+
+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * NumberFormatInfo.cs: Make NumberNegativePattern = 1 for the ctor
+
+2002-06-07 Nick Drochak <ndrochak@gol.com>
+
+ * NumberFormatInfo.cs: Make InvariantInfo.NumberNegativePattern = 1
+
+2002-05-07 Rodrigo Moya <rodrigo@ximian.com>
+
+ * CompareInfo.cs: new basic stub (compiles on Linux, so I assume
+ it does not break the build on windows. Sorry if it does).
+
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * NumberFormatInfo.cs: always set the values for the invariant culture
+ until there are more cultures supported.
+
+2002-04-22 Nick Drochak <ndrochak@gol.com>
+
+ * NumberStyles.cs: Add [Serializable].
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * UnicodeCategory.cs: Fix typos in enum names.
+
+2002-03-04 Nick Drochak <ndrochak@gol.com>
+
+ * JulianCalendar.cs: JulianEra should be field, not a property.
+ Thanks CorCompare (and Piers).
+
+2002-02-12 Duncan Mak <duncan@ximian.com>
+
+ * CultureInfo.cs: Added the Calendar property to make the TimeZone
+ class build. It's marked as MonoTODO.
+
+2002-02-12 Nick Drochak <ndrochak@gol.com>
+
+ * UnicodeCategory.cs: Fix typo.
+
+2002-02-01 Radek Doulik <rodo@ximian.com>
+
+ * RegionInfo.cs: started work on RegionInfo
+ implemented RegionInfo (string) constructor
+
+ * CultureInfo.cs: added internal static function,
+ which could be used from RegionInfo.cs
+
+2002-01-16 Miguel de Icaza <miguel@ximian.com>
+
+ * CultureInfo.cs: Completed the tables. Now we need to actually
+ fill it in.
+
+2002-01-15 Duncan Mak <duncan@ximian.com>
+
+ * CultureInfo.cs: Convert it to unix text.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * GreogrianCalendar.cs : The same old MonoTODO attribute.
+
+2001-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Locale.cs: New file, a place holder for Locale.GetText.
+
+Wed Nov 14 16:47:07 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Calendar.cs: CLSCompliant updates.
+
+2001-11-04 Martin Weindel <martin.weindel@t-online.de>
+ * NumberFormatInfo.cs: fixed minor bug in Clone with readonly flag
+
+ * DateTimeFormatInfo.cs: added
+
+ * CultureInfo.cs: some changed needed for compiling DateTimeFormatInfo.cs
+
+2001-10-26 Miguel de Icaza <miguel@ximian.com>
+
+ * NumberFormatInfo.cs: Provide an internal constructor that takes
+ as an argument a CultureInfo ID (LCID) so that we can construct
+ different ones here.
+
+ * CultureInfo.cs: Begun implementation.
+
+2001-10-09 Derek Holden <dholden@draper.com>
+
+ * NumberFormatInfo.cs: Small typo in PercentPositivePattern
+ and CurrencyPositivePattern
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * Calendar.cs: Implement a bunch of missing features.
+
+2001-07-24 Derek Holden <dholden@draper.com>
+
+ * NumberStyles.cs: Added ECMA values for Allow types and default
+ styles.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * DateTimeStyles.cs, NumberStyles.cs: Add.
+
+2001-07-06 Joe Shaw <joe@ximian.com>
+
+ * UnicodeCategory.cs: Added.
diff --git a/mcs/class/corlib/System.Globalization/CompareInfo.cs b/mcs/class/corlib/System.Globalization/CompareInfo.cs
new file mode 100644
index 00000000000..063efa6f9c4
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CompareInfo.cs
@@ -0,0 +1,437 @@
+//
+// System.Globalization.CompareInfo
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Globalization
+{
+ [Serializable]
+ public class CompareInfo : IDeserializationCallback
+ {
+
+ /* Hide the .ctor() */
+ CompareInfo() {}
+
+ public virtual int Compare (string string1, string string2)
+ {
+ return Compare (string1, string2, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int Compare (string string1, string string2, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual int Compare (string string1, int offset1, string string2, int offset2)
+ {
+ return Compare (string1, offset1, string2, offset2, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int Compare (string string1, int offset1, string string2, int offset2, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual int Compare (string string1, int offset1, int length1, string string2, int offset2, int length2)
+ {
+ return Compare (string1, offset1, length1, string2, offset2, length2, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int Compare (string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static CompareInfo GetCompareInfo(int culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static CompareInfo GetCompareInfo(string name)
+ {
+ if(name == null) {
+ throw new ArgumentNullException("name is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static CompareInfo GetCompareInfo(int culture, Assembly assembly)
+ {
+ if(assembly == null) {
+ throw new ArgumentNullException("assembly is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static CompareInfo GetCompareInfo(string name, Assembly assembly)
+ {
+ if(name == null) {
+ throw new ArgumentNullException("name is null");
+ }
+ if(assembly == null) {
+ throw new ArgumentNullException("assembly is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public virtual SortKey GetSortKey(string source)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public virtual SortKey GetSortKey(string source,
+ CompareOptions options)
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual int IndexOf (string source, char value)
+ {
+ if (source == null)
+ throw new ArgumentNullException ();
+ return IndexOf (source, value, CompareOptions.None);
+ }
+
+ public virtual int IndexOf (string source, string value)
+ {
+ if (source == null)
+ throw new ArgumentNullException ();
+ if (value == null)
+ throw new ArgumentNullException ();
+ return IndexOf (source, value, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, char value, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, char value, int startIndex)
+ {
+ if (source == null)
+ throw new ArgumentNullException ();
+ if (startIndex < 0 || startIndex > source.Length)
+ throw new ArgumentOutOfRangeException ();
+ return IndexOf (source, value, startIndex, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, string value, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual int IndexOf (string source, string value, int startIndex)
+ {
+ if (source == null)
+ throw new ArgumentNullException ();
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (startIndex < 0 || startIndex > source.Length)
+ throw new ArgumentOutOfRangeException ();
+ return IndexOf (source, value, startIndex, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, char value, int startIndex, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, char value, int startIndex, int count)
+ {
+ if (source == null)
+ throw new ArgumentNullException ();
+ if (startIndex < 0 || startIndex > source.Length)
+ throw new ArgumentOutOfRangeException ();
+ if (count < 0)
+ throw new ArgumentOutOfRangeException ();
+ return IndexOf (source, value, startIndex, count, CompareOptions.None);
+ }
+
+ public virtual int IndexOf (string source, string value, int startIndex, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual int IndexOf (string source, string value, int startIndex, int count)
+ {
+ if (source == null)
+ throw new ArgumentNullException ();
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (startIndex < 0 || startIndex > source.Length)
+ throw new ArgumentOutOfRangeException ();
+ if (count < 0)
+ throw new ArgumentOutOfRangeException ();
+ return IndexOf (source, value, startIndex, count, CompareOptions.None);
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, char value, int startIndex, int count, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int IndexOf (string source, string value, int startIndex, int count, CompareOptions options)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsPrefix(string source, string prefix)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(prefix == null) {
+ throw new ArgumentNullException("prefix is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsPrefix(string source, string prefix, CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(prefix == null) {
+ throw new ArgumentNullException("prefix is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsSuffix(string source, string suffix)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(suffix == null) {
+ throw new ArgumentNullException("suffix is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsSuffix(string source, string suffix, CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(suffix == null) {
+ throw new ArgumentNullException("suffix is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, char value)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, string value)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(value == null) {
+ throw new ArgumentNullException("value is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, char value,
+ CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, char value,
+ int startIndex)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, string value,
+ CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(value == null) {
+ throw new ArgumentNullException("value is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, string value,
+ int startIndex)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(value == null) {
+ throw new ArgumentNullException("value is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, char value,
+ int startIndex,
+ CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, char value,
+ int startIndex, int count)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than zero");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, string value,
+ int startIndex,
+ CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(value == null) {
+ throw new ArgumentNullException("value is null");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, string value,
+ int startIndex, int count)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(value == null) {
+ throw new ArgumentNullException("value is null");
+ }
+ if(count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than zero");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, char value,
+ int startIndex, int count,
+ CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than zero");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int LastIndexOf(string source, string value,
+ int startIndex, int count,
+ CompareOptions options)
+ {
+ if(source == null) {
+ throw new ArgumentNullException("source is null");
+ }
+ if(value == null) {
+ throw new ArgumentNullException("value is null");
+ }
+ if(count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than zero");
+ }
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IDeserializationCallback.OnDeserialization(object sender)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /* LAMESPEC: not mentioned in the spec, but corcompare
+ * shows it. Some documentation about what it does
+ * would be nice.
+ */
+ [MonoTODO]
+ public Int32 LCID
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/CompareOptions.cs b/mcs/class/corlib/System.Globalization/CompareOptions.cs
new file mode 100755
index 00000000000..81be8d94504
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CompareOptions.cs
@@ -0,0 +1,54 @@
+// CompareOptions.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:34:52 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum CompareOptions {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ IgnoreCase = 1,
+
+ /// <summary>
+ /// </summary>
+ IgnoreNonSpace = 2,
+
+ /// <summary>
+ /// </summary>
+ IgnoreSymbols = 4,
+
+ /// <summary>
+ /// </summary>
+ IgnoreKanaType = 8,
+
+ /// <summary>
+ /// </summary>
+ IgnoreWidth = 16,
+
+ /// <summary>
+ /// </summary>
+ StringSort = 536870912,
+
+ /// <summary>
+ /// </summary>
+ Ordinal = 1073741824,
+ } // CompareOptions
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/CultureInfo.cs b/mcs/class/corlib/System.Globalization/CultureInfo.cs
new file mode 100644
index 00000000000..f00298ba955
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CultureInfo.cs
@@ -0,0 +1,1411 @@
+//
+// System.Globalization.CultureInfo
+//
+// Miguel de Icaza (miguel@ximian.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System.Threading;
+
+namespace System.Globalization
+{
+ [Serializable]
+ public class CultureInfo : ICloneable, IFormatProvider
+ {
+ static CultureInfo invariant_culture_info;
+ bool is_read_only;
+ int lcid;
+ bool use_user_override;
+ NumberFormatInfo number_format;
+ DateTimeFormatInfo datetime_format;
+ TextInfo textinfo;
+
+ private static readonly string MSG_READONLY = "This instance is read only";
+
+ // <summary>
+ // Returns the Invariant Culture Information ("iv")
+ // </summary>
+ static public CultureInfo InvariantCulture {
+ get {
+ if (invariant_culture_info != null)
+ return invariant_culture_info;
+
+ invariant_culture_info = new CultureInfo (0x07f, false);
+ invariant_culture_info.is_read_only = true;
+
+ return invariant_culture_info;
+ }
+ }
+
+ //
+ // Initializes the CultureInfo object for the specific culture_id
+ //
+ void InitializeByID (int culture_id, bool use_user_override)
+ {
+ switch (culture_id){
+ case 0x0001: // ar Arabic
+ case 0x0401: // ar-SA Arabic (Saudi Arabia)
+ case 0x0801: // ar-IQ Arabic (Iraq)
+ case 0x0C01: // ar-EG Arabic (Egypt)
+ case 0x1001: // ar-LY Arabic (Libya)
+ case 0x1401: // ar-DZ Arabic (Algeria)
+ case 0x1801: // ar-MA Arabic (Morocco)
+ case 0x1C01: // ar-TN Arabic (Tunisia)
+ case 0x2001: // ar-OM Arabic (Oman)
+ case 0x2401: // ar-YE Arabic (Yemen)
+ case 0x2801: // ar-SY Arabic (Syria)
+ case 0x2C01: // ar-JO Arabic (Jordan)
+ case 0x3001: // ar-LB Arabic (Lebanon)
+ case 0x3401: // ar-KW Arabic (Kuwait)
+ case 0x3801: // ar-AE Arabic (U.A.E.)
+ case 0x3C01: // ar-BH Arabic (Bahrain)
+ case 0x4001: // ar-QA Arabic (Qatar)
+ case 0x0002: // bg Bulgarian
+ case 0x0402: // bg-BG Bulgarian (Bulgaria)
+ case 0x0003: // ca Catalan
+ case 0x0403: // ca-ES Catalan (Spain)
+ case 0x0004: // zh-CHS Chinese (Simplified)
+ case 0x0404: // zh-TW Chinese (Taiwan)
+ case 0x0804: // zh-CN Chinese (People's Republic of China)
+ case 0x0C04: // zh-HK Chinese (Hong Kong S.A.R.)
+ case 0x1004: // zh-SG Chinese (Singapore)
+ case 0x1404: // zh-MO Chinese (Macau S.A.R.)
+ case 0x7C04: // zh-CHT Chinese (Traditional)
+ case 0x0005: // cs Czech
+ case 0x0405: // cs-CZ Czech (Czech Republic)
+ case 0x0006: // da Danish
+ case 0x0406: // da-DK Danish (Denmark)
+ case 0x0007: // de German
+ case 0x0407: // de-DE German (Germany)
+ case 0x0807: // de-CH German (Switzerland)
+ case 0x0C07: // de-AT German (Austria)
+ case 0x1007: // de-LU German (Luxembourg)
+ case 0x1407: // de-LI German (Liechtenstein)
+ case 0x0008: // el Greek
+ case 0x0408: // el-GR Greek (Greece)
+ case 0x0009: // en English
+ case 0x0409: // en-US English (United States)
+ case 0x0809: // en-GB English (United Kingdom)
+ case 0x0C09: // en-AU English (Australia)
+ case 0x1009: // en-CA English (Canada)
+ case 0x1409: // en-NZ English (New Zealand)
+ case 0x1809: // en-IE English (Ireland)
+ case 0x1C09: // en-ZA English (South Africa)
+ case 0x2009: // en-JM English (Jamaica)
+ case 0x2409: // en-CB English (Caribbean)
+ case 0x2809: // en-BZ English (Belize)
+ case 0x2C09: // en-TT English (Trinidad and Tobago)
+ case 0x3009: // en-ZW English (Zimbabwe)
+ case 0x3409: // en-PH English (Republic of the Philippines)
+ case 0x000A: // es Spanish
+ case 0x080A: // es-MX Spanish (Mexico)
+ case 0x0C0A: // es-ES Spanish (Spain)
+ case 0x100A: // es-GT Spanish (Guatemala)
+ case 0x140A: // es-CR Spanish (Costa Rica)
+ case 0x180A: // es-PA Spanish (Panama)
+ case 0x1C0A: // es-DO Spanish (Dominican Republic)
+ case 0x200A: // es-VE Spanish (Venezuela)
+ case 0x240A: // es-CO Spanish (Colombia)
+ case 0x280A: // es-PE Spanish (Peru)
+ case 0x2C0A: // es-AR Spanish (Argentina)
+ case 0x300A: // es-EC Spanish (Ecuador)
+ case 0x340A: // es-CL Spanish (Chile)
+ case 0x380A: // es-UY Spanish (Uruguay)
+ case 0x3C0A: // es-PY Spanish (Paraguay)
+ case 0x400A: // es-BO Spanish (Bolivia)
+ case 0x440A: // es-SV Spanish (El Salvador)
+ case 0x480A: // es-HN Spanish (Honduras)
+ case 0x4C0A: // es-NI Spanish (Nicaragua)
+ case 0x500A: // es-PR Spanish (Puerto Rico)
+ case 0x000B: // fi Finnish
+ case 0x040B: // fi-FI Finnish (Finland)
+ case 0x000C: // fr French
+ case 0x040C: // fr-FR French (France)
+ case 0x080C: // fr-BE French (Belgium)
+ case 0x0C0C: // fr-CA French (Canada)
+ case 0x100C: // fr-CH French (Switzerland)
+ case 0x140C: // fr-LU French (Luxembourg)
+ case 0x180C: // fr-MC French (Principality of Monaco)
+ case 0x000D: // he Hebrew
+ case 0x040D: // he-IL Hebrew (Israel)
+ case 0x000E: // hu Hungarian
+ case 0x040E: // hu-HU Hungarian (Hungary)
+ case 0x000F: // is Icelandic
+ case 0x040F: // is-IS Icelandic (Iceland)
+ case 0x0010: // it Italian
+ case 0x0410: // it-IT Italian (Italy)
+ case 0x0810: // it-CH Italian (Switzerland)
+ case 0x0011: // ja Japanese
+ case 0x0411: // ja-JP Japanese (Japan)
+ case 0x0012: // ko Korean
+ case 0x0412: // ko-KR Korean (Korea)
+ case 0x0013: // nl Dutch
+ case 0x0413: // nl-NL Dutch (Netherlands)
+ case 0x0813: // nl-BE Dutch (Belgium)
+ case 0x0014: // no Norwegian
+ case 0x0414: // nb-NO Norwegian (Bokmål) (Norway)
+ case 0x0814: // nn-NO Norwegian (Nynorsk) (Norway)
+ case 0x0015: // pl Polish
+ case 0x0415: // pl-PL Polish (Poland)
+ case 0x0016: // pt Portuguese
+ case 0x0416: // pt-BR Portuguese (Brazil)
+ case 0x0816: // pt-PT Portuguese (Portugal)
+ case 0x0018: // ro Romanian
+ case 0x0418: // ro-RO Romanian (Romania)
+ case 0x0019: // ru Russian
+ case 0x0419: // ru-RU Russian (Russia)
+ case 0x001A: // hr Croatian
+ case 0x041A: // hr-HR Croatian (Croatia)
+ case 0x081A: // Lt-sr-SP Serbian (Latin) (Serbia)
+ case 0x0C1A: // Cy-sr-SP Serbian (Cyrillic) (Serbia)
+ case 0x001B: // sk Slovak
+ case 0x041B: // sk-SK Slovak (Slovakia)
+ case 0x001C: // sq Albanian
+ case 0x041C: // sq-AL Albanian (Albania)
+ case 0x001D: // sv Swedish
+ case 0x041D: // sv-SE Swedish (Sweden)
+ case 0x081D: // sv-FI Swedish (Finland)
+ case 0x001E: // th Thai
+ case 0x041E: // th-TH Thai (Thailand)
+ case 0x001F: // tr Turkish
+ case 0x041F: // tr-TR Turkish (Turkey)
+ case 0x0020: // ur Urdu
+ case 0x0420: // ur-PK Urdu (Islamic Republic of Pakistan)
+ case 0x0021: // id Indonesian
+ case 0x0421: // id-ID Indonesian (Indonesia)
+ case 0x0022: // uk Ukrainian
+ case 0x0422: // uk-UA Ukrainian (Ukraine)
+ case 0x0023: // be Belarusian
+ case 0x0423: // be-BY Belarusian (Belarus)
+ case 0x0024: // sl Slovenian
+ case 0x0424: // sl-SI Slovenian (Slovenia)
+ case 0x0025: // et Estonian
+ case 0x0425: // et-EE Estonian (Estonia)
+ case 0x0026: // lv Latvian
+ case 0x0426: // lv-LV Latvian (Latvia)
+ case 0x0027: // lt Lithuanian
+ case 0x0427: // lt-LT Lithuanian (Lithuania)
+ case 0x0029: // fa Farsi
+ case 0x0429: // fa-IR Farsi (Iran)
+ case 0x002A: // vi Vietnamese
+ case 0x042A: // vi-VN Vietnamese (Viet Nam)
+ case 0x002B: // hy Armenian
+ case 0x042B: // hy-AM Armenian (Armenia)
+ case 0x002C: // az Azeri
+ case 0x042C: // Lt-az-AZ Azeri (Latin) (Azerbaijan)
+ case 0x082C: // Cy-az-AZ Azeri (Cyrillic) (Azerbaijan)
+ case 0x002D: // eu Basque
+ case 0x042D: // eu-ES Basque (Spain)
+ case 0x002F: // mk FYRO Macedonian
+ case 0x042F: // mk-MK FYRO Macedonian (Former Yugoslav Republic of Macedonia)
+ case 0x0036: // af Afrikaans
+ case 0x0436: // af-ZA Afrikaans (South Africa)
+ case 0x0037: // ka Georgian
+ case 0x0437: // ka-GE Georgian (Georgia)
+ case 0x0038: // fo Faeroese
+ case 0x0438: // fo-FO Faeroese (Faeroe Islands)
+ case 0x0039: // hi Hindi
+ case 0x0439: // hi-IN Hindi (India)
+ case 0x003E: // ms Malay
+ case 0x043E: // ms-MY Malay (Malaysia)
+ case 0x083E: // ms-BN Malay (Brunei Darussalam)
+ case 0x003F: // kk Kazakh
+ case 0x043F: // kk-KZ Kazakh (Kazakhstan)
+ case 0x0040: // ky Kyrgyz
+ case 0x0440: // ky-KZ Kyrgyz (Kyrgyzstan)
+ case 0x0041: // sw Swahili
+ case 0x0441: // sw-KE Swahili (Kenya)
+ case 0x0043: // uz Uzbek
+ case 0x0443: // Lt-uz-UZ Uzbek (Latin) (Uzbekistan)
+ case 0x0843: // Cy-uz-UZ Uzbek (Cyrillic) (Uzbekistan)
+ case 0x0044: // tt Tatar
+ case 0x0444: // tt-TA Tatar (Tatarstan)
+ case 0x0046: // pa Punjabi
+ case 0x0446: // pa-IN Punjabi (India)
+ case 0x0047: // gu Gujarati
+ case 0x0447: // gu-IN Gujarati (India)
+ case 0x0049: // ta Tamil
+ case 0x0449: // ta-IN Tamil (India)
+ case 0x004A: // te Telugu
+ case 0x044A: // te-IN Telugu (India)
+ case 0x004B: // kn Kannada
+ case 0x044B: // kn-IN Kannada (India)
+ case 0x004E: // mr Marathi
+ case 0x044E: // mr-IN Marathi (India)
+ case 0x004F: // sa Sanskrit
+ case 0x044F: // sa-IN Sanskrit (India)
+ case 0x0050: // mn Mongolian
+ case 0x0450: // mn-MN Mongolian (Mongolia)
+ case 0x0056: // gl Galician
+ case 0x0456: // gl-ES Galician (Spain)
+ case 0x0057: // kok Konkani
+ case 0x0457: // kok-IN Konkani (India)
+ case 0x005A: // syr Syriac
+ case 0x045A: // syr-SY Syriac (Syria)
+ case 0x0065: // div Divehi
+ case 0x0465: // div-MV Divehi (Maldives)
+ case 0x007F: // Invariant Language (Invariant Country)
+ break;
+
+ default:
+ throw new ArgumentException ("CultureInfoCode " + culture_id);
+ }
+ lcid = culture_id;
+ this.use_user_override = use_user_override;
+ }
+
+ //
+ // Maps a name to a culture id
+ //
+ static int NameToID (string name)
+ {
+ switch (name){
+ case "ar":
+ return 0x0001;
+ case "ar-SA":
+ return 0x0401;
+ case "ar-IQ":
+ return 0x0801;
+ case "ar-EG":
+ return 0x0C01;
+ case "ar-LY":
+ return 0x1001;
+ case "ar-DZ":
+ return 0x1401;
+ case "ar-MA":
+ return 0x1801;
+ case "ar-TN":
+ return 0x1C01;
+ case "ar-OM":
+ return 0x2001;
+ case "ar-YE":
+ return 0x2401;
+ case "ar-SY":
+ return 0x2801;
+ case "ar-JO":
+ return 0x2C01;
+ case "ar-LB":
+ return 0x3001;
+ case "ar-KW":
+ return 0x3401;
+ case "ar-AE":
+ return 0x3801;
+ case "ar-BH":
+ return 0x3C01;
+ case "ar-QA":
+ return 0x4001;
+ case "bg":
+ return 0x0002;
+ case "bg-BG":
+ return 0x0402;
+ case "ca":
+ return 0x0003;
+ case "ca-ES":
+ return 0x0403;
+ case "zh-CHS":
+ return 0x0004;
+ case "zh-TW":
+ return 0x0404;
+ case "zh-CN":
+ return 0x0804;
+ case "zh-HK":
+ return 0x0C04;
+ case "zh-SG":
+ return 0x1004;
+ case "zh-MO":
+ return 0x1404;
+ case "zh-CHT":
+ return 0x7C04;
+ case "cs":
+ return 0x0005;
+ case "cs-CZ":
+ return 0x0405;
+ case "da":
+ return 0x0006;
+ case "da-DK":
+ return 0x0406;
+ case "de":
+ return 0x0007;
+ case "de-DE":
+ return 0x0407;
+ case "de-CH":
+ return 0x0807;
+ case "de-AT":
+ return 0x0C07;
+ case "de-LU":
+ return 0x1007;
+ case "de-LI":
+ return 0x1407;
+ case "el":
+ return 0x0008;
+ case "el-GR":
+ return 0x0408;
+ case "en":
+ return 0x0009;
+ case "en-US":
+ return 0x0409;
+ case "en-GB":
+ return 0x0809;
+ case "en-AU":
+ return 0x0C09;
+ case "en-CA":
+ return 0x1009;
+ case "en-NZ":
+ return 0x1409;
+ case "en-IE":
+ return 0x1809;
+ case "en-ZA":
+ return 0x1C09;
+ case "en-JM":
+ return 0x2009;
+ case "en-CB":
+ return 0x2409;
+ case "en-BZ":
+ return 0x2809;
+ case "en-TT":
+ return 0x2C09;
+ case "en-ZW":
+ return 0x3009;
+ case "en-PH":
+ return 0x3409;
+ case "es":
+ return 0x000A;
+ case "es-MX":
+ return 0x080A;
+ case "es-ES":
+ return 0x0C0A;
+ case "es-GT":
+ return 0x100A;
+ case "es-CR":
+ return 0x140A;
+ case "es-PA":
+ return 0x180A;
+ case "es-DO":
+ return 0x1C0A;
+ case "es-VE":
+ return 0x200A;
+ case "es-CO":
+ return 0x240A;
+ case "es-PE":
+ return 0x280A;
+ case "es-AR":
+ return 0x2C0A;
+ case "es-EC":
+ return 0x300A;
+ case "es-CL":
+ return 0x340A;
+ case "es-UY":
+ return 0x380A;
+ case "es-PY":
+ return 0x3C0A;
+ case "es-BO":
+ return 0x400A;
+ case "es-SV":
+ return 0x440A;
+ case "es-HN":
+ return 0x480A;
+ case "es-NI":
+ return 0x4C0A;
+ case "es-PR":
+ return 0x500A;
+ case "fi":
+ return 0x000B;
+ case "fi-FI":
+ return 0x040B;
+ case "fr":
+ return 0x000C;
+ case "fr-FR":
+ return 0x040C;
+ case "fr-BE":
+ return 0x080C;
+ case "fr-CA":
+ return 0x0C0C;
+ case "fr-CH":
+ return 0x100C;
+ case "fr-LU":
+ return 0x140C;
+ case "fr-MC":
+ return 0x180C;
+ case "he":
+ return 0x000D;
+ case "he-IL":
+ return 0x040D;
+ case "hu":
+ return 0x000E;
+ case "hu-HU":
+ return 0x040E;
+ case "is":
+ return 0x000F;
+ case "is-IS":
+ return 0x040F;
+ case "it":
+ return 0x0010;
+ case "it-IT":
+ return 0x0410;
+ case "it-CH":
+ return 0x0810;
+ case "ja":
+ return 0x0011;
+ case "ja-JP":
+ return 0x0411;
+ case "ko":
+ return 0x0012;
+ case "ko-KR":
+ return 0x0412;
+ case "nl":
+ return 0x0013;
+ case "nl-NL":
+ return 0x0413;
+ case "nl-BE":
+ return 0x0813;
+ case "no":
+ return 0x0014;
+ case "nb-NO":
+ return 0x0414;
+ case "nn-NO":
+ return 0x0814;
+ case "pl":
+ return 0x0015;
+ case "pl-PL":
+ return 0x0415;
+ case "pt":
+ return 0x0016;
+ case "pt-BR":
+ return 0x0416;
+ case "pt-PT":
+ return 0x0816;
+ case "ro":
+ return 0x0018;
+ case "ro-RO":
+ return 0x0418;
+ case "ru":
+ return 0x0019;
+ case "ru-RU":
+ return 0x0419;
+ case "hr":
+ return 0x001A;
+ case "hr-HR":
+ return 0x041A;
+ case "Lt-sr-SP":
+ return 0x081A;
+ case "Cy-sr-SP":
+ return 0x0C1A;
+ case "sk":
+ return 0x001B;
+ case "sk-SK":
+ return 0x041B;
+ case "sq":
+ return 0x001C;
+ case "sq-AL":
+ return 0x041C;
+ case "sv":
+ return 0x001D;
+ case "sv-SE":
+ return 0x041D;
+ case "sv-FI":
+ return 0x081D;
+ case "th":
+ return 0x001E;
+ case "th-TH":
+ return 0x041E;
+ case "tr":
+ return 0x001F;
+ case "tr-TR":
+ return 0x041F;
+ case "ur":
+ return 0x0020;
+ case "ur-PK":
+ return 0x0420;
+ case "id":
+ return 0x0021;
+ case "id-ID":
+ return 0x0421;
+ case "uk":
+ return 0x0022;
+ case "uk-UA":
+ return 0x0422;
+ case "be":
+ return 0x0023;
+ case "be-BY":
+ return 0x0423;
+ case "sl":
+ return 0x0024;
+ case "sl-SI":
+ return 0x0424;
+ case "et":
+ return 0x0025;
+ case "et-EE":
+ return 0x0425;
+ case "lv":
+ return 0x0026;
+ case "lv-LV":
+ return 0x0426;
+ case "lt":
+ return 0x0027;
+ case "lt-LT":
+ return 0x0427;
+ case "fa":
+ return 0x0029;
+ case "fa-IR":
+ return 0x0429;
+ case "vi":
+ return 0x002A;
+ case "vi-VN":
+ return 0x042A;
+ case "hy":
+ return 0x002B;
+ case "hy-AM":
+ return 0x042B;
+ case "az":
+ return 0x002C;
+ case "Lt-az-AZ":
+ return 0x042C;
+ case "Cy-az-AZ":
+ return 0x082C;
+ case "eu":
+ return 0x002D;
+ case "eu-ES":
+ return 0x042D;
+ case "mk":
+ return 0x002F;
+ case "mk-MK":
+ return 0x042F;
+ case "af":
+ return 0x0036;
+ case "af-ZA":
+ return 0x0436;
+ case "ka":
+ return 0x0037;
+ case "ka-GE":
+ return 0x0437;
+ case "fo":
+ return 0x0038;
+ case "fo-FO":
+ return 0x0438;
+ case "hi":
+ return 0x0039;
+ case "hi-IN":
+ return 0x0439;
+ case "ms":
+ return 0x003E;
+ case "ms-MY":
+ return 0x043E;
+ case "ms-BN":
+ return 0x083E;
+ case "kk":
+ return 0x003F;
+ case "kk-KZ":
+ return 0x043F;
+ case "ky":
+ return 0x0040;
+ case "ky-KZ":
+ return 0x0440;
+ case "sw":
+ return 0x0041;
+ case "sw-KE":
+ return 0x0441;
+ case "uz":
+ return 0x0043;
+ case "Lt-uz-UZ":
+ return 0x0443;
+ case "Cy-uz-UZ":
+ return 0x0843;
+ case "tt":
+ return 0x0044;
+ case "tt-TA":
+ return 0x0444;
+ case "pa":
+ return 0x0046;
+ case "pa-IN":
+ return 0x0446;
+ case "gu":
+ return 0x0047;
+ case "gu-IN":
+ return 0x0447;
+ case "ta":
+ return 0x0049;
+ case "ta-IN":
+ return 0x0449;
+ case "te":
+ return 0x004A;
+ case "te-IN":
+ return 0x044A;
+ case "kn":
+ return 0x004B;
+ case "kn-IN":
+ return 0x044B;
+ case "mr":
+ return 0x004E;
+ case "mr-IN":
+ return 0x044E;
+ case "sa":
+ return 0x004F;
+ case "sa-IN":
+ return 0x044F;
+ case "mn":
+ return 0x0050;
+ case "mn-MN":
+ return 0x0450;
+ case "gl":
+ return 0x0056;
+ case "gl-ES":
+ return 0x0456;
+ case "kok":
+ return 0x0057;
+ case "kok-IN":
+ return 0x0457;
+ case "syr":
+ return 0x005A;
+ case "syr-SY":
+ return 0x045A;
+ case "div":
+ return 0x0065;
+ case "div-MV":
+ return 0x0465;
+ case "":
+ return 0x007F;
+ }
+ return -1;
+ }
+
+ // <summary>
+ // Creates a CultureInfo for a specific ID
+ // </summary>
+ public static CultureInfo CreateSpecificCulture (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ int id = NameToID (name);
+
+ if (id == -1)
+ throw new ArgumentException ("name");
+
+ return new CultureInfo (id, false);
+ }
+
+ /// <summary>
+ /// CultureInfo instance that represents the culture used by the current thread
+ /// </summary>
+ public static CultureInfo CurrentCulture
+ {
+ get
+ {
+ return Thread.CurrentThread.CurrentCulture;
+ }
+
+ /* FIXME: the set method isnt listed in the spec */
+ set
+ {
+ Thread.CurrentThread.CurrentCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// CultureInfo instance that represents the current culture used by the ResourceManager to look up culture-specific resources at run time
+ /// </summary>
+ public static CultureInfo CurrentUICulture
+ {
+ get
+ {
+ return Thread.CurrentThread.CurrentUICulture;
+ }
+
+ /* FIXME: the set method isnt listed in the spec */
+ set
+ {
+ Thread.CurrentThread.CurrentUICulture = value;
+ }
+ }
+
+
+ public virtual int LCID {
+ get {
+ return lcid;
+ }
+ }
+
+ // <summary>
+ // Gets the string-encoded name of the culture
+ // </summary>
+ public virtual string Name {
+ get {
+ /* FIXME: This long switch should be
+ * moved into a hash, initialised in
+ * the static class constructor
+ */
+ switch (lcid){
+ case 0x007f:
+ return "iv";
+ case 0x0036:
+ return "af";
+ case 0x0436:
+ return "af-ZA";
+ case 0x001c:
+ return "sq";
+ case 0x041c:
+ return "sq-AL";
+ case 0x0001:
+ return "ar";
+ case 0x1401:
+ return "ar-DZ";
+ case 0x3c01:
+ return "ar-BH";
+ case 0x0c01:
+ return "ar-EG";
+ case 0x0801:
+ return "ar-IQ";
+ case 0x2c01:
+ return "ar-JO";
+ case 0x3401:
+ return "ar-KW";
+ case 0x3001:
+ return "ar-LB";
+ case 0x1001:
+ return "ar-LY";
+ case 0x1801:
+ return "ar-MA";
+ case 0x2001:
+ return "ar-OM";
+ case 0x4001:
+ return "ar-QA";
+ case 0x0401:
+ return "ar-SA";
+ case 0x2801:
+ return "ar-SY";
+ case 0x1c01:
+ return "ar-TN";
+ case 0x3801:
+ return "ar-AE";
+ case 0x2401:
+ return "ar-YE";
+ case 0x002b:
+ return "hy";
+ case 0x042b:
+ return "hy-AM";
+ case 0x002c:
+ return "az";
+ case 0x082c:
+ return "Cy-az-AZ";
+ case 0x042c:
+ return "Lt-az-AZ";
+ case 0x002d:
+ return "eu";
+ case 0x042d:
+ return "eu-ES";
+ case 0x0023:
+ return "be";
+ case 0x0423:
+ return "be-BY";
+ case 0x0002:
+ return "bg";
+ case 0x0402:
+ return "bg-BG";
+ case 0x0003:
+ return "ca";
+ case 0x0403:
+ return "ca-ES";
+ case 0x0c04:
+ return "zh-HK";
+ case 0x1404:
+ return "zh-MO";
+ case 0x0804:
+ return "zh-CN";
+ case 0x0004:
+ return "zh-CHS";
+ case 0x1004:
+ return "zh-SG";
+ case 0x0404:
+ return "zh-TW";
+ case 0x7c04:
+ return "zh-CHT";
+ case 0x001a:
+ return "hr";
+ case 0x041a:
+ return "hr-HR";
+ case 0x0005:
+ return "cs";
+ case 0x0405:
+ return "cs-CZ";
+ case 0x0006:
+ return "da";
+ case 0x0406:
+ return "da-DK";
+ case 0x0065:
+ return "div";
+ case 0x0465:
+ return "div-MV";
+ case 0x0013:
+ return "nl";
+ case 0x0813:
+ return "nl-BE";
+ case 0x0413:
+ return "nl-NL";
+ case 0x0009:
+ return "en";
+ case 0x0c09:
+ return "en-AU";
+ case 0x2809:
+ return "en-BZ";
+ case 0x1009:
+ return "en-CA";
+ case 0x2409:
+ return "en-CB";
+ case 0x1809:
+ return "en-IE";
+ case 0x2009:
+ return "en-JM";
+ case 0x1409:
+ return "en-NZ";
+ case 0x3409:
+ return "en-PH";
+ case 0x1c09:
+ return "en-ZA";
+ case 0x2c09:
+ return "en-TT";
+ case 0x0809:
+ return "en-GB";
+ case 0x0409:
+ return "en-US";
+ case 0x3009:
+ return "en-ZW";
+ case 0x0025:
+ return "et";
+ case 0x0425:
+ return "et-EE";
+ case 0x0038:
+ return "fo";
+ case 0x0438:
+ return "fo-FO";
+ case 0x0029:
+ return "fa";
+ case 0x0429:
+ return "fa-IR";
+ case 0x000b:
+ return "fi";
+ case 0x040b:
+ return "fi-FI";
+ case 0x000c:
+ return "fr";
+ case 0x080c:
+ return "fr-BE";
+ case 0x0c0c:
+ return "fr-CA";
+ case 0x040c:
+ return "fr-FR";
+ case 0x140c:
+ return "fr-LU";
+ case 0x180c:
+ return "fr-MC";
+ case 0x100c:
+ return "fr-CH";
+ case 0x0056:
+ return "gl";
+ case 0x0456:
+ return "gl-ES";
+ case 0x0037:
+ return "ka";
+ case 0x0437:
+ return "ka-GE";
+ case 0x0007:
+ return "de";
+ case 0x0c07:
+ return "de-AT";
+ case 0x0407:
+ return "de-DE";
+ case 0x1407:
+ return "de-LI";
+ case 0x1007:
+ return "de-LU";
+ case 0x0807:
+ return "de-CH";
+ case 0x0008:
+ return "el";
+ case 0x0408:
+ return "el-GR";
+ case 0x0047:
+ return "gu";
+ case 0x0447:
+ return "gu-IN";
+ case 0x000d:
+ return "he";
+ case 0x040d:
+ return "he-IL";
+ case 0x0039:
+ return "hi";
+ case 0x0439:
+ return "hi-IN";
+ case 0x000e:
+ return "hu";
+ case 0x040e:
+ return "hu-HU";
+ case 0x000f:
+ return "is";
+ case 0x040f:
+ return "is-IS";
+ case 0x0021:
+ return "id";
+ case 0x0421:
+ return "id-ID";
+ case 0x0010:
+ return "it";
+ case 0x0410:
+ return "it-IT";
+ case 0x0810:
+ return "it-CH";
+ case 0x0011:
+ return "ja";
+ case 0x0411:
+ return "ja-JP";
+ case 0x004b:
+ return "kn";
+ case 0x044b:
+ return "kn-IN";
+ case 0x003f:
+ return "kk";
+ case 0x043f:
+ return "kk-KZ";
+ case 0x0057:
+ return "kok";
+ case 0x0457:
+ return "kok-IN";
+ case 0x0012:
+ return "ko";
+ case 0x0412:
+ return "ko-KR";
+ case 0x0040:
+ return "ky";
+ case 0x0440:
+ return "ky-KZ";
+ case 0x0026:
+ return "lv";
+ case 0x0426:
+ return "lv-LV";
+ case 0x0027:
+ return "lt";
+ case 0x0427:
+ return "lt-LT";
+ case 0x002f:
+ return "mk";
+ case 0x042f:
+ return "mk-MK";
+ case 0x003e:
+ return "ms";
+ case 0x083e:
+ return "ms-BN";
+ case 0x043e:
+ return "ms-MY";
+ case 0x004e:
+ return "mr";
+ case 0x044e:
+ return "mr-IN";
+ case 0x0050:
+ return "mn";
+ case 0x0450:
+ return "mn-MN";
+ case 0x0014:
+ return "no";
+ case 0x0414:
+ return "nb-NO";
+ case 0x0814:
+ return "nn-NO";
+ case 0x0015:
+ return "pl";
+ case 0x0415:
+ return "pl-PL";
+ case 0x0016:
+ return "pt";
+ case 0x0416:
+ return "pt-BR";
+ case 0x0816:
+ return "pt-PT";
+ case 0x0046:
+ return "pa";
+ case 0x0446:
+ return "pa-IN";
+ case 0x0018:
+ return "ro";
+ case 0x0418:
+ return "ro-RO";
+ case 0x0019:
+ return "ru";
+ case 0x0419:
+ return "ru-RU";
+ case 0x004f:
+ return "sa";
+ case 0x044f:
+ return "sa-IN";
+ case 0x0c1a:
+ return "Cy-sr-SP";
+ case 0x081a:
+ return "Lt-sr-SP";
+ case 0x001b:
+ return "sk";
+ case 0x041b:
+ return "sk-SK";
+ case 0x0024:
+ return "sl";
+ case 0x0424:
+ return "sl-SI";
+ case 0x000a:
+ return "es";
+ case 0x2c0a:
+ return "es-AR";
+ case 0x400a:
+ return "es-BO";
+ case 0x340a:
+ return "es-CL";
+ case 0x240a:
+ return "es-CO";
+ case 0x140a:
+ return "es-CR";
+ case 0x1c0a:
+ return "es-DO";
+ case 0x300a:
+ return "es-EC";
+ case 0x440a:
+ return "es-SV";
+ case 0x100a:
+ return "es-GT";
+ case 0x480a:
+ return "es-HN";
+ case 0x080a:
+ return "es-MX";
+ case 0x4c0a:
+ return "es-NI";
+ case 0x180a:
+ return "es-PA";
+ case 0x3c0a:
+ return "es-PY";
+ case 0x280a:
+ return "es-PE";
+ case 0x500a:
+ return "es-PR";
+ case 0x0c0a:
+ return "es-ES";
+ case 0x380a:
+ return "es-UY";
+ case 0x200a:
+ return "es-VE";
+ case 0x0041:
+ return "sw";
+ case 0x0441:
+ return "sw-KE";
+ case 0x001d:
+ return "sv";
+ case 0x081d:
+ return "sv-FI";
+ case 0x041d:
+ return "sv-SE";
+ case 0x005a:
+ return "syr";
+ case 0x045a:
+ return "syr-SY";
+ case 0x0049:
+ return "ta";
+ case 0x0449:
+ return "ta-IN";
+ case 0x0044:
+ return "tt";
+ case 0x0444:
+ return "tt-RU";
+ case 0x004a:
+ return "te";
+ case 0x044a:
+ return "te-IN";
+ case 0x001e:
+ return "th";
+ case 0x041e:
+ return "th-TH";
+ case 0x001f:
+ return "tr";
+ case 0x041f:
+ return "tr-TR";
+ case 0x0022:
+ return "uk";
+ case 0x0422:
+ return "uk-UA";
+ case 0x0020:
+ return "ur";
+ case 0x0420:
+ return "ur-PK";
+ case 0x0043:
+ return "uz";
+ case 0x0843:
+ return "Cy-uz-UZ";
+ case 0x0443:
+ return "Lt-uz-UZ";
+ case 0x002a:
+ return "vi";
+ case 0x042a:
+ return "vi-VN";
+ }
+ throw new Exception ("Miss constructed object for LCID: " + lcid);
+ }
+ }
+
+ [MonoTODO]
+ public virtual string NativeName
+ {
+ get {
+ return("");
+ }
+ }
+
+
+ [MonoTODO]
+ public virtual Calendar Calendar
+ {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public virtual Calendar[] OptionalCalendars
+ {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public virtual CultureInfo Parent
+ {
+ get {
+ return(CultureInfo.InvariantCulture);
+ }
+ }
+
+ [MonoTODO]
+ public virtual TextInfo TextInfo
+ {
+ get {
+ if (textinfo == null)
+ textinfo = new TextInfo ();
+ return textinfo;
+ }
+ }
+
+ [MonoTODO]
+ public virtual string ThreeLetterISOLanguageName
+ {
+ get {
+ return("");
+ }
+ }
+
+ [MonoTODO]
+ public virtual string ThreeLetterWindowsLanguageName
+ {
+ get {
+ return("");
+ }
+ }
+
+ [MonoTODO]
+ public virtual string TwoLetterISOLanguageName
+ {
+ get {
+ return("");
+ }
+ }
+
+ public bool UseUserOverride
+ {
+ get {
+ return use_user_override;
+ }
+ }
+
+ [MonoTODO]
+ public void ClearCachedData()
+ {
+ }
+
+ [MonoTODO]
+ public virtual object Clone()
+ {
+ return(null);
+ }
+
+ public override bool Equals (object value)
+ {
+ CultureInfo b = value as CultureInfo;
+ if (b != null)
+ return b.lcid == lcid;
+ return false;
+ }
+
+ [MonoTODO]
+ public static CultureInfo[] GetCultures(CultureTypes types)
+ {
+ return(null);
+ }
+
+ public override int GetHashCode()
+ {
+ return lcid;
+ }
+
+ [MonoTODO]
+ public static CultureInfo ReadOnly(CultureInfo ci)
+ {
+ if(ci==null) {
+ throw new ArgumentNullException("CultureInfo is null");
+ }
+
+ return(null);
+ }
+
+ public override string ToString()
+ {
+ return(this.Name);
+ }
+
+
+ [MonoTODO]
+ public virtual CompareInfo CompareInfo
+ {
+ get {
+ return null;
+ }
+ }
+
+ internal static bool IsIDNeutralCulture (int lcid) {
+ return (lcid & 0xff00) == 0;
+ }
+
+ // <summary>
+ // Returns whether the current culture is neutral (neutral cultures
+ // only specify a language, not a country.
+ // </summary>
+ public virtual bool IsNeutralCulture {
+ get {
+ return IsIDNeutralCulture (lcid);
+ }
+ }
+ // <summary>
+ // Returns the NumberFormat for the current lcid
+ // </summary>
+ public virtual NumberFormatInfo NumberFormat {
+ get {
+ if (number_format == null){
+ lock (this){
+ if (number_format == null)
+ number_format = new NumberFormatInfo (lcid);
+ }
+ }
+
+ return number_format;
+ }
+
+ set {
+ if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
+
+ if (value == null)
+ throw new ArgumentNullException ("NumberFormat");
+
+ number_format = value;
+ }
+ }
+
+ public virtual DateTimeFormatInfo DateTimeFormat
+ {
+ get
+ {
+ if (datetime_format == null)
+ {
+ lock (this)
+ {
+ if (datetime_format == null)
+ datetime_format = new DateTimeFormatInfo();
+ }
+ }
+
+ return datetime_format;
+ }
+
+ set
+ {
+ if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
+
+ if (value == null)
+ throw new ArgumentNullException ("DateTimeFormat");
+
+ datetime_format = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual string DisplayName
+ {
+ get {
+ return("");
+ }
+ }
+
+ [MonoTODO]
+ public virtual string EnglishName
+ {
+ get {
+ return("");
+ }
+ }
+
+ [MonoTODO]
+ public static CultureInfo InstalledUICulture
+ {
+ get {
+ return(null);
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get {
+ return(is_read_only);
+ }
+ }
+
+
+ //
+ // IFormatProvider implementation
+ //
+ public virtual object GetFormat( Type formatType )
+ {
+ object format = null;
+
+ if ( formatType == typeof(NumberFormatInfo) )
+ format = NumberFormat;
+ else if ( formatType == typeof(DateTimeFormatInfo) )
+ format = DateTimeFormat;
+
+ return format;
+ }
+
+ //
+ // Constructors
+ //
+ public CultureInfo (int culture, bool use_user_override)
+ {
+ if (culture < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ InitializeByID (culture, use_user_override);
+ }
+
+ public CultureInfo (int culture) : this (culture, false)
+ {
+ }
+
+ public CultureInfo (string name, bool use_user_override)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+ InitializeByID (NameToID (name), use_user_override);
+ }
+
+ public CultureInfo (string name) : this (name, false) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/CultureTypes.cs b/mcs/class/corlib/System.Globalization/CultureTypes.cs
new file mode 100755
index 00000000000..7218b10150e
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CultureTypes.cs
@@ -0,0 +1,39 @@
+// CultureTypes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:02 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum CultureTypes {
+
+ /// <summary>
+ /// </summary>
+ NeutralCultures = 1,
+
+ /// <summary>
+ /// </summary>
+ SpecificCultures = 2,
+
+ /// <summary>
+ /// </summary>
+ InstalledWin32Cultures = 4,
+
+ /// <summary>
+ /// </summary>
+ AllCultures = 7,
+
+ } // CultureTypes
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs b/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
new file mode 100644
index 00000000000..82ecd5ec3fe
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
@@ -0,0 +1,609 @@
+// System.Globalization.DateTimeFormatInfo
+//
+// Some useful functions are missing in the ECMA specs.
+// They have been added following MS SDK Beta2
+//
+// Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel (martin.weindel@t-online.de)
+
+using System;
+
+using System.Threading;
+
+
+namespace System.Globalization
+{
+
+ [Serializable]
+
+ public sealed class DateTimeFormatInfo : ICloneable, IFormatProvider {
+
+ private static readonly string MSG_READONLY = "This instance is read only";
+ private static readonly string MSG_ARRAYSIZE_MONTH = "An array with exactly 13 elements is needed";
+ private static readonly string MSG_ARRAYSIZE_DAY = "An array with exactly 7 elements is needed";
+ private static readonly string[] INVARIANT_ABBREVIATED_DAY_NAMES
+ = new string[7] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+ private static readonly string[] INVARIANT_DAY_NAMES
+ = new string[7] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+ private static readonly string[] INVARIANT_ABBREVIATED_MONTH_NAMES
+ = new string[13] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""};
+ private static readonly string[] INVARIANT_MONTH_NAMES
+ = new string[13] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""};
+
+ public static DateTimeFormatInfo theInvariantDateTimeFormatInfo;
+
+ private bool readOnly;
+
+ private string _AMDesignator;
+
+ private string _PMDesignator;
+
+ private string _DateSeparator;
+
+ private string _TimeSeparator;
+
+ private string _ShortDatePattern;
+
+ private string _LongDatePattern;
+
+ private string _ShortTimePattern;
+
+ private string _LongTimePattern;
+
+ private string _MonthDayPattern;
+
+ private string _YearMonthPattern;
+
+ private string _FullDateTimePattern;
+
+ private string _RFC1123Pattern;
+
+ private string _SortableDateTimePattern;
+
+ private string _UniversalSortableDateTimePattern;
+
+ private DayOfWeek _FirstDayOfWeek;
+
+ private Calendar _Calendar;
+
+ private CalendarWeekRule _CalendarWeekRule;
+
+ private string[] _AbbreviatedDayNames;
+
+ private string[] _DayNames;
+
+ private string[] _MonthNames;
+
+ private string[] _AbbreviatedMonthNames;
+
+
+ public DateTimeFormatInfo()
+
+ {
+
+ readOnly = false;
+
+ _AMDesignator = "AM";
+
+ _PMDesignator = "PM";
+
+ _DateSeparator = "/";
+
+ _TimeSeparator = ":";
+
+ _ShortDatePattern = "MM/dd/yyyy";
+
+ _LongDatePattern = "dddd, dd MMMM yyyy";
+
+ _ShortTimePattern = "HH:mm";
+
+ _LongTimePattern = "HH:mm:ss";
+
+ _MonthDayPattern = "MMMM dd";
+
+ _YearMonthPattern = "yyyy MMMM";
+
+ _FullDateTimePattern = "dddd, dd MMMM yyyy HH:mm:ss";
+
+ // FIXME for the following three pattern: "The default value of this property is
+ //derived from the calendar that is set for CultureInfo.CurrentCulture or the default
+ //calendar of CultureInfo.CurrentCulture."
+
+ _RFC1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
+
+ _SortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
+
+ _UniversalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
+
+
+
+ _FirstDayOfWeek = DayOfWeek.Sunday;
+
+ _Calendar = new GregorianCalendar();
+
+ _CalendarWeekRule = CalendarWeekRule.FirstDay;
+
+
+ _AbbreviatedDayNames = INVARIANT_ABBREVIATED_DAY_NAMES;
+
+ _DayNames = INVARIANT_DAY_NAMES;
+
+ _AbbreviatedMonthNames = INVARIANT_ABBREVIATED_MONTH_NAMES;
+
+ _MonthNames = INVARIANT_MONTH_NAMES;
+
+ }
+
+
+
+ // LAMESPEC: this is not in ECMA specs
+
+ public static DateTimeFormatInfo GetInstance(IFormatProvider provider)
+
+ {
+
+ if (provider != null) {
+
+ DateTimeFormatInfo dtfi;
+
+ dtfi = (DateTimeFormatInfo)provider.GetFormat(typeof(DateTimeFormatInfo));
+
+ if (dtfi != null)
+
+ return dtfi;
+
+ }
+
+
+ return CurrentInfo;
+
+ }
+
+
+
+ public bool IsReadOnly {
+
+ get {
+
+ return readOnly;
+
+ }
+
+ }
+
+
+
+ public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi)
+
+ {
+
+ DateTimeFormatInfo copy = (DateTimeFormatInfo)dtfi.Clone();
+
+ copy.readOnly = true;
+
+ return copy;
+
+ }
+
+
+
+ public object Clone ()
+
+ {
+
+ DateTimeFormatInfo clone = (DateTimeFormatInfo) MemberwiseClone();
+
+ // clone is not read only
+
+ clone.readOnly = false;
+
+ return clone;
+
+ }
+
+
+
+ public object GetFormat(Type formatType)
+ {
+ return (formatType == GetType()) ? this : null;
+ }
+
+ public string GetAbbreviatedEraName(int era)
+ {
+ if (era < _Calendar.Eras.Length || era >= _Calendar.Eras.Length)
+ throw new ArgumentOutOfRangeException();
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ public string GetAbbreviatedMonthName(int month)
+ {
+ if (month < 1 || month > 13) throw new ArgumentOutOfRangeException();
+ return _AbbreviatedMonthNames[month-1];
+ }
+
+ public int GetEra(string eraName)
+ {
+ if (eraName == null) throw new ArgumentNullException();
+ eraName = eraName.ToUpper();
+ notImplemented();
+ //FIXME: implement me
+ return -1;
+ }
+
+ public string GetEraName(int era)
+ {
+ if (era < _Calendar.Eras.Length || era >= _Calendar.Eras.Length)
+ throw new ArgumentOutOfRangeException();
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ public string GetMonthName(int month)
+ {
+ if (month < 1 || month > 13) throw new ArgumentOutOfRangeException();
+ return _MonthNames[month-1];
+ }
+
+ public string[] AbbreviatedDayNames
+ {
+ get
+ {
+ return (string[]) _AbbreviatedDayNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 7) throw new ArgumentException(MSG_ARRAYSIZE_DAY);
+ _AbbreviatedDayNames = (string[]) value.Clone();
+ }
+ }
+
+ public string[] AbbreviatedMonthNames
+ {
+ get
+ {
+ return (string[]) _AbbreviatedMonthNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 13) throw new ArgumentException(MSG_ARRAYSIZE_MONTH);
+ _AbbreviatedMonthNames = (string[]) value.Clone();
+ }
+ }
+
+ public string[] DayNames
+ {
+ get
+ {
+ return (string[]) _DayNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 7) throw new ArgumentException(MSG_ARRAYSIZE_DAY);
+ _DayNames = (string[]) value.Clone();
+ }
+ }
+
+ public string[] MonthNames
+ {
+ get
+ {
+ return (string[]) _MonthNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 13) throw new ArgumentException(MSG_ARRAYSIZE_MONTH);
+ _MonthNames = (string[]) value.Clone();
+ }
+ }
+
+ public string AMDesignator
+ {
+ get
+ {
+ return _AMDesignator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _AMDesignator = value;
+ }
+ }
+
+ public string PMDesignator
+ {
+ get
+ {
+ return _PMDesignator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _PMDesignator = value;
+ }
+ }
+
+ public string DateSeparator
+ {
+ get
+ {
+ return _DateSeparator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _DateSeparator = value;
+ }
+ }
+
+ public string TimeSeparator
+ {
+ get
+ {
+ return _TimeSeparator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _TimeSeparator = value;
+ }
+ }
+
+ public string LongDatePattern
+ {
+ get
+ {
+ return _LongDatePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _LongDatePattern = value;
+ }
+ }
+
+ public string ShortDatePattern
+ {
+ get
+ {
+ return _ShortDatePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _ShortDatePattern = value;
+ }
+ }
+
+ public string ShortTimePattern
+ {
+ get
+ {
+ return _ShortTimePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _ShortTimePattern = value;
+ }
+ }
+
+ public string LongTimePattern
+ {
+ get
+ {
+ return _LongTimePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _LongTimePattern = value;
+ }
+ }
+
+ public string MonthDayPattern
+ {
+ get
+ {
+ return _MonthDayPattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _MonthDayPattern = value;
+ }
+ }
+
+ public string YearMonthPattern
+ {
+ get
+ {
+ return _YearMonthPattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _YearMonthPattern = value;
+ }
+ }
+
+ public string FullDateTimePattern
+ {
+ get
+ {
+ return _FullDateTimePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _FullDateTimePattern = value;
+ }
+ }
+
+ public static DateTimeFormatInfo CurrentInfo
+ {
+ get
+ {
+ return Thread.CurrentThread.CurrentCulture.DateTimeFormat;
+ }
+ }
+
+ public static DateTimeFormatInfo InvariantInfo
+ {
+ get
+ {
+ if (theInvariantDateTimeFormatInfo == null)
+ {
+ theInvariantDateTimeFormatInfo =
+ DateTimeFormatInfo.ReadOnly(new DateTimeFormatInfo());
+ }
+ return theInvariantDateTimeFormatInfo;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public DayOfWeek FirstDayOfWeek
+ {
+ get
+ {
+ return _FirstDayOfWeek;
+ }
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if ((int) value < 0 || (int) value > 6) throw new ArgumentOutOfRangeException();
+ _FirstDayOfWeek = value;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public Calendar Calendar
+ {
+ get
+ {
+ return _Calendar;
+ }
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _Calendar = value;
+ }
+ }
+
+ public CalendarWeekRule CalendarWeekRule
+ {
+ get
+ {
+ return _CalendarWeekRule;
+ }
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ _CalendarWeekRule = value;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string RFC1123Pattern
+ {
+ get
+ {
+ return _RFC1123Pattern;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string SortableDateTimePattern
+ {
+ get
+ {
+ return _SortableDateTimePattern;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string UniversalSortableDateTimePattern
+ {
+ get
+ {
+ return _UniversalSortableDateTimePattern;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string[] GetAllDateTimePatterns()
+ {
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string[] GetAllDateTimePatterns(char format)
+ {
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string GetDayName(DayOfWeek dayofweek)
+ {
+ int index = (int) dayofweek;
+ if (index < 0 || index > 6) throw new ArgumentOutOfRangeException();
+ return _DayNames[index];
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string GetAbbreviatedDayName(DayOfWeek dayofweek)
+ {
+ int index = (int) dayofweek;
+ if (index < 0 || index > 6) throw new ArgumentOutOfRangeException();
+ return _AbbreviatedDayNames[index];
+ }
+
+ private static void notImplemented()
+ {
+ throw new Exception("Not implemented");
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Globalization/DateTimeStyles.cs b/mcs/class/corlib/System.Globalization/DateTimeStyles.cs
new file mode 100644
index 00000000000..0e65c4d966d
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/DateTimeStyles.cs
@@ -0,0 +1,50 @@
+// DateTimeStyles.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:07 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum DateTimeStyles {
+
+ /// <summary>
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ AllowLeadingWhite = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ AllowTrailingWhite = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ AllowInnerWhite = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ AllowWhiteSpaces = AllowLeadingWhite | AllowTrailingWhite | AllowInnerWhite,
+
+ /// <summary>
+ /// </summary>
+ NoCurrentDateDefault = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ AdjustToUniversal = 0x00000010,
+ } // DateTimeStyles
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/DaylightTime.cs b/mcs/class/corlib/System.Globalization/DaylightTime.cs
new file mode 100755
index 00000000000..64fc092f94f
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/DaylightTime.cs
@@ -0,0 +1,51 @@
+//
+// System.Globalization.DaylightTime
+//
+// Author:
+// Chris Hynes (chrish@assistedsolutions.com)
+//
+// (C) 2001 Chris Hynes
+//
+
+using System.Globalization;
+
+namespace System.Globalization
+{
+ [Serializable]
+ public class DaylightTime
+ {
+ DateTime start, end;
+ TimeSpan delta;
+
+ public DaylightTime(DateTime start, DateTime end, TimeSpan delta)
+ {
+ this.start = start;
+ this.end = end;
+ this.delta = delta;
+ }
+
+ public DateTime Start
+ {
+ get
+ {
+ return start;
+ }
+ }
+
+ public DateTime End
+ {
+ get
+ {
+ return end;
+ }
+ }
+
+ public TimeSpan Delta
+ {
+ get
+ {
+ return delta;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/GregorianCalendar.cs b/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
new file mode 100644
index 00000000000..2163b5ec0d4
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
@@ -0,0 +1,471 @@
+// GregorianCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Gregorian calendar.
+/// </summary>
+/// <remarks>
+/// <para>The Gregorian calendar supports only the Common Era from
+/// the Gregorian year 1 to the Gregorian year 9999.
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class GregorianCalendar : Calendar {
+ /// <summary>
+ /// The era number for the Common Era (C.E.) or Anno Domini (A.D.)
+ /// respective.
+ /// </summary>
+ public const int ADEra = 1;
+
+ /// <value>Overridden. Gives the eras supported by the Gregorian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { ADEra };
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected member storing the
+ /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>.
+ /// </summary>
+ internal GregorianCalendarTypes M_CalendarType;
+
+ /// <value>
+ /// The property stores the
+ /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>.
+ /// </value>
+ public virtual GregorianCalendarTypes CalendarType {
+ get { return M_CalendarType; }
+ set {
+ // mscorlib 1:0:33000:0 doesn't check anything here
+ M_CalendarType = value;
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = ADEra;
+ if (era != ADEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ M_ArgumentInRange("year", year, 1, 9999);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day, ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ }
+
+ /// <summary>
+ /// Overridden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ return CCGregorianCalendar.AddMonths(time, months);
+ }
+
+ [MonoTODO]
+ public override DateTime AddWeeks(DateTime time, int weeks)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ return CCGregorianCalendar.AddYears(time, years);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ // mscorlib doesn't check year, probably a bug; we do
+ M_CheckYME(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(year, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(year);
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ return ADEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ return CCGregorianCalendar.GetYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(year, month, day);
+ }
+
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCGregorianCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ year, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+ [MonoTODO]
+ public override int ToFourDigitYear(int year)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Constructor that sets the
+ /// Gregorian calendar type (
+ /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>).
+ /// </summary>
+ /// <param name="type">The parameter specifies the Gregorian
+ /// calendar type.
+ /// </param>
+ public GregorianCalendar(GregorianCalendarTypes type) {
+ CalendarType = type;
+ M_AbbrEraNames = new string[] {"C.E."};
+ M_EraNames = new string[] {"Common Era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 2029;
+ }
+
+ /// <summary>
+ /// Default constructor. Sets the Gregorian calendar type to
+ /// <see
+ /// cref="F:System.Globalization.GregorianCalendarTypes.Localized"/>.
+ /// </summary>
+ public GregorianCalendar() : this(GregorianCalendarTypes.Localized) {}
+} // class GregorianCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs b/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs
new file mode 100755
index 00000000000..2d571fdd13b
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs
@@ -0,0 +1,45 @@
+// GregorianCalendarTypes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:19 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ public enum GregorianCalendarTypes {
+
+ /// <summary>
+ /// </summary>
+ Localized = 1,
+
+ /// <summary>
+ /// </summary>
+ USEnglish = 2,
+
+ /// <summary>
+ /// </summary>
+ MiddleEastFrench = 9,
+
+ /// <summary>
+ /// </summary>
+ Arabic = 10,
+
+ /// <summary>
+ /// </summary>
+ TransliteratedEnglish = 11,
+
+ /// <summary>
+ /// </summary>
+ TransliteratedFrench = 12,
+ } // GregorianCalendarTypes
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/HebrewCalendar.cs b/mcs/class/corlib/System.Globalization/HebrewCalendar.cs
new file mode 100644
index 00000000000..066b14e1b8b
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/HebrewCalendar.cs
@@ -0,0 +1,879 @@
+// HebrewCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+using System.IO;
+
+/// <summary>
+/// This is the Hebrew calendar.
+/// </summary>
+/// <remarks>
+/// <para>The Hebrew calendar supports only years between 5343 A.M. and
+/// 6000 A.M. This has been done to be compatible with .NET.
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class HebrewCalendar : Calendar {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public HebrewCalendar() {
+ M_AbbrEraNames = new string[] {"A.M."};
+ M_EraNames = new string[] {"Anno Mundi"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 5790;
+ }
+
+ /// <summary>
+ /// The era number for the Anno Mundi (A.M.) era, called
+ /// plain HebrewEra.
+ /// </summary>
+ public static readonly int HebrewEra = 1;
+
+ /// <summary>
+ /// The
+ /// <see cref="T:System.DateTime"/> ticks for first day of year
+ /// 5343 A.M.
+ /// </summary>
+ internal const long M_MinTicks = 499147488000000000L;
+ /// <summary>
+ /// The number of
+ /// <see cref="T:System.DateTime"/> ticks for the last day of year
+ /// 6000 A.M.
+ /// </summary>
+ internal const long M_MaxTicks = 706783967999999999L;
+ /// <summary>
+ /// The minimum year in the A.M. era supported.
+ /// </summary>
+ internal const int M_MinYear = 5343;
+ /// <summary>
+ /// The maximum year supported in the A.M. era.
+ /// </summary>
+ internal override int M_MaxYear {
+ get { return 6000; }
+ }
+
+ /// <value>Overridden. Gives the eras supported by the Gregorian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { HebrewEra };
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ if (time.Ticks < M_MinTicks || time.Ticks > M_MaxTicks)
+ throw new ArgumentOutOfRangeException(
+ "time",
+ "Only hebrew years between 5343 and 6000," +
+ " inclusive, are supported.");
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = HebrewEra;
+ if (era != HebrewEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ if (year < M_MinYear || year > M_MaxYear)
+ throw new ArgumentOutOfRangeException(
+ "year",
+ "Only hebrew years between 5343 and 6000," +
+ " inclusive, are supported.");
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ int l = CCHebrewCalendar.last_month_of_year(year);
+ if (month < 1 || month > l) {
+ StringWriter sw = new StringWriter();
+ sw.Write("Month must be between 1 and {0}.", l);
+ throw new ArgumentOutOfRangeException("month",
+ sw.ToString());
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day,
+ ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month,
+ era));
+ }
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ int y, m, d;
+ DateTime t;
+
+ if (months == 0) {
+ t = time;
+ } else {
+ int rd = CCFixed.FromDateTime(time);
+ CCHebrewCalendar.dmy_from_fixed(
+ out d, out m, out y, rd);
+ m = M_Month(m, y);
+ if (months < 0) {
+ while (months < 0) {
+ if (m+months > 0) {
+ m += months;
+ months = 0;
+ } else {
+ months += m;
+ y -= 1;
+ m = GetMonthsInYear(y);
+ }
+ }
+ }
+ else {
+ while (months > 0) {
+ int my = GetMonthsInYear(y);
+ if (m+months <= my) {
+ m += months;
+ months = 0;
+ } else {
+ months -= my-m+1;
+ m = 1;
+ y += 1;
+ }
+ }
+ }
+ t = ToDateTime(y, m, d, 0, 0, 0, 0);
+ t = t.Add(time.TimeOfDay);
+ }
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ CCHebrewCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ year += years;
+ rd = CCHebrewCalendar.fixed_from_dmy(day, month, year);
+ DateTime t = CCFixed.ToDateTime(rd);
+ t = t.Add(time.TimeOfDay);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return CCHebrewCalendar.day_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ int year = CCHebrewCalendar.year_from_fixed(rd);
+ int rd1_7 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
+ return rd - rd1_7 + 1;
+ }
+
+ /// <summary>
+ /// The method maps a .NET Hebrew month to a Calencdrical
+ /// Calculations Hebrew month.
+ /// </summary>
+ /// <param name="month">An integer representing a month in .NET
+ /// counting (starting with Tishri).
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>The Hebrew month in Calendrical Calculations counting,
+ /// staring with the Hebrew month Nisan.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// In .NET the month counting starts with the Hebrew month Tishri.
+ /// Calendrical Calculations starts with the month Tisan. So we must
+ /// map here.
+ /// </para>
+ /// </remarks>
+ internal int M_CCMonth(int month, int year) {
+ if (month <= 6) {
+ return 6+month;
+ }
+ else {
+ int l = CCHebrewCalendar.last_month_of_year(year);
+ if (l == 12) {
+ return month-6;
+ }
+ else {
+ return month <= 7 ? 6+month : month-7;
+ }
+ }
+ }
+
+ /// <summary>
+ /// The method maps a Calendrical Calculations Hebrew month
+ /// to a .NET Hebrew month.
+ /// </summary>
+ /// <param name="ccmonth">An integer representing a month in
+ /// Calendrical Calculations counting, starting with Nisan.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>The Hebrew month in .NET counting,
+ /// staring with the Hebrew month Tishri.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// In .NET the month counting starts with the Hebrew month Tishri.
+ /// Calendrical Calculations starts with the month Tisan. So we must
+ /// map here.
+ /// </para>
+ /// </remarks>
+ internal int M_Month(int ccmonth, int year) {
+ if (ccmonth >= 7) {
+ return ccmonth - 6;
+ } else {
+ int l = CCHebrewCalendar.last_month_of_year(year);
+ return ccmonth + (l == 12 ? 6 : 7);
+ }
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ int ccmonth = M_CCMonth(month, year);
+ int rd1 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth, year);
+ int rd2 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ int rd1 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
+ int rd2 = CCHebrewCalendar.fixed_from_dmy(1, 7, year+1);
+ return rd2 - rd1;
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ M_CheckDateTime(time);
+ return HebrewEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ int ccmonth, year;
+ CCHebrewCalendar.my_from_fixed(out ccmonth, out year, rd);
+ return M_Month(ccmonth, year);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCHebrewCalendar.last_month_of_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return CCHebrewCalendar.year_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ /// <remarks>All days in Adar II are viewed as leap days and the
+ /// last day of Adar I.
+ /// </remarks>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return IsLeapYear(year) &&
+ (month == 7 || (month == 6 && day == 30));
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ /// <remarks>
+ /// Adar II is viewed as leap month.
+ /// </remarks>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return IsLeapYear(year) && month == 7;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCHebrewCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ int ccm = M_CCMonth(month, year);
+ int rd = CCHebrewCalendar.fixed_from_dmy(day, ccm, year);
+ return CCFixed.ToDateTime(rd,
+ hour, minute, second, milliseconds);
+ }
+
+ [MonoTODO]
+ public override int ToFourDigitYear(int year)
+ {
+ throw new NotImplementedException();
+ }
+
+} // class HebrewCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/HijriCalendar.cs b/mcs/class/corlib/System.Globalization/HijriCalendar.cs
new file mode 100644
index 00000000000..136540ec859
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/HijriCalendar.cs
@@ -0,0 +1,888 @@
+// HijriCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+using System.IO;
+
+/// <summary>
+/// This is the Hijri calendar which might be called Islamic calendar.
+/// </summary>
+/// <remarks>
+/// <para>The calendar supports only dates in the HijriEra starting with the
+/// epoch.
+/// </para>
+/// <para>
+/// The epoch of the Hijri Calendar might be adjusted by the
+/// <see cref="F:System.Globalization.HijriCalendar.AddHijriDate"/>
+/// property. See the discussion of the
+/// <see cref="F:CalendricalCalculations.HijriCalendar.epoch">
+/// epoch
+/// </see>
+/// of the Hijri calendar.
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class HijriCalendar : Calendar {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public HijriCalendar() {
+ M_AbbrEraNames = new string[] {"A.H."};
+ M_EraNames = new string[] {"Anno Hegirae"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 1451;
+ }
+
+ /// <summary>
+ /// The era number for the Anno Hegirae (A.H.) era.
+ /// </summary>
+ public static readonly int HijriEra = 1;
+
+ /// <summary>
+ /// The minimum fixed day number supported by the Hijri calendar.
+ /// </summary>
+ internal static readonly int M_MinFixed =
+ CCHijriCalendar.fixed_from_dmy(1, 1, 1);
+ /// <summary>
+ /// The maximum fixed day number supported by the Hijri calendar.
+ /// </summary>
+ internal static readonly int M_MaxFixed =
+ CCGregorianCalendar.fixed_from_dmy(31, 12, 9999);
+
+ /// <value>Overridden. Gives the eras supported by the Gregorian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { HijriEra };
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// Protected field storing the
+ /// <see cref="F:AddHijriDate"/>.
+ /// </summary>
+ internal int M_AddHijriDate = 0;
+
+ // TODO: I don't know currently, which sign to use with the parameter.
+ /// <value>An integer property representing the adjustment to the epoch
+ /// of the Hijri calendar. Not supported by .NET.
+ /// </value>
+ public virtual int AddHijriDate {
+ get {
+ return M_AddHijriDate;
+ }
+ set {
+ if (value < -3 && value > 3)
+ throw new ArgumentOutOfRangeException(
+ "AddHijriDate",
+ "Value should be between -3 and 3.");
+ M_AddHijriDate = value;
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking an
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </summary>
+ /// <param name="param">A string giving the name of the parameter
+ /// to check.</param>
+ /// <param name="rdHijri">An integer giving the AddHijriDate adjusted
+ /// fixed day number.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// Exception is thrown, if the AddHijriDate adjusted fixed day
+ /// number is outside the supported range.
+ /// </exception>
+ internal void M_CheckFixedHijri(string param, int rdHijri) {
+ if (rdHijri < M_MinFixed || rdHijri > M_MaxFixed-AddHijriDate) {
+ StringWriter sw = new StringWriter();
+ int day, month, year;
+ CCHijriCalendar.dmy_from_fixed(out day, out month,
+ out year, M_MaxFixed-AddHijriDate);
+ if (AddHijriDate != 0) {
+ sw.Write("This HijriCalendar " +
+ "(AddHijriDate {0})" +
+ " allows dates from 1. 1. 1 to " +
+ "{1}. {2}. {3}.",
+ AddHijriDate,
+ day, month, year);
+ } else {
+ sw.Write("HijriCalendar allows dates from " +
+ "1.1.1 to {0}.{1}.{2}.",
+ day, month, year);
+ }
+ throw new ArgumentOutOfRangeException(param,
+ sw.ToString());
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the supported
+ /// range of the Hijri calendar.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ int rd = CCFixed.FromDateTime(time) - AddHijriDate;
+ M_CheckFixedHijri("time", rd);
+ }
+
+ /// <summary>
+ /// Protected member which computes the
+ /// <see cref="F:AddHijriDate"/>
+ /// adjusted fixed day number from a
+ /// <see cref="T:System.DateTime"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to convert.
+ /// </param>
+ /// <returns>The
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </returns>
+ internal int M_FromDateTime(DateTime time) {
+ return CCFixed.FromDateTime(time) - AddHijriDate;
+ }
+
+ /// <summary>
+ /// Protected member which converts the
+ /// <see cref="F:AddHijriDate"/>
+ /// adjusted fixed day number the a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="rd">The
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </param>
+ /// <returns>The converted
+ /// <see cref="T:System.DateTime"/> value.
+ /// </returns>
+ internal DateTime M_ToDateTime(int rd) {
+ return CCFixed.ToDateTime(rd+AddHijriDate);
+ }
+
+ /// <summary>
+ /// Protected member which converts the
+ /// <see cref="F:AddHijriDate"/>
+ /// adjusted fixed day number the a
+ /// <see cref="T:System.DateTime"/> value using a number
+ /// of time parameters.
+ /// </summary>
+ /// <param name="date">The
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <returns>The converted
+ /// <see cref="T:System.DateTime"/> value.
+ /// </returns>
+ internal DateTime M_ToDateTime(int date,
+ int hour, int minute, int second, int milliseconds)
+ {
+ return CCFixed.ToDateTime(date+AddHijriDate,
+ hour, minute, second, milliseconds);
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = HijriEra;
+ if (era != HijriEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ M_ArgumentInRange("year", year, 1, 9666);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ if (year == 9666) {
+ int rd = CCHijriCalendar.fixed_from_dmy(1, month, year);
+ M_CheckFixedHijri("month", rd);
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day, ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, HijriEra));
+ if (year == 9666) {
+ int rd = CCHijriCalendar.fixed_from_dmy(day, month,
+ year);
+ M_CheckFixedHijri("day", rd);
+ }
+ }
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ int rd = M_FromDateTime(time);
+ int day, month, year;
+ CCHijriCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ month += months;
+ year += CCMath.div_mod(out month, month, 12);
+ rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
+ M_CheckFixedHijri("time", rd);
+ DateTime t = M_ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ int rd = M_FromDateTime(time);
+ int day, month, year;
+ CCHijriCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ year += years;
+ rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
+ M_CheckFixedHijri("time", rd);
+ DateTime t = M_ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return CCHijriCalendar.day_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ int year = CCHijriCalendar.year_from_fixed(rd);
+ int rd1_1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);
+ return rd - rd1_1 + 1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ int rd1 = CCHijriCalendar.fixed_from_dmy(1, month, year);
+ int rd2 = CCHijriCalendar.fixed_from_dmy(1, month+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ int rd1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);
+ int rd2 = CCHijriCalendar.fixed_from_dmy(1, 1, year+1);
+ return rd2 - rd1;
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ M_CheckDateTime(time);
+ return HijriEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return CCHijriCalendar.month_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return CCHijriCalendar.year_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return IsLeapYear(year) && month == 12 && day == 30;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCHijriCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ int rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
+ return M_ToDateTime(rd,
+ hour, minute, second, milliseconds);
+ }
+
+ [MonoTODO]
+ public override int ToFourDigitYear(int year)
+ {
+ throw new NotImplementedException();
+ }
+
+} // class HijriCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs b/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs
new file mode 100644
index 00000000000..e2e7124a599
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs
@@ -0,0 +1,794 @@
+// JapaneseCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Japanese calendar. It differs from the Gregorian calendar
+/// only in the years.
+/// </summary>
+/// <remarks>
+/// <para>The Japanese calendar support four eras.</para>
+/// <list type="table">
+/// <listheader>
+/// <term>era number</term>
+/// <term>Gregorian start date</term>
+/// <term>Gregorian end date</term>
+/// </listheader>
+/// <item>
+/// <term>1</term>
+/// <term>September 8, 1868</term>
+/// <term>July 29, 1912</term>
+/// </item>
+/// <item>
+/// <term>2</term>
+/// <term>July 30, 1912</term>
+/// <term>December 24, 1926</term>
+/// </item>
+/// <item>
+/// <term>3</term>
+/// <term>December 25, 1926</term>
+/// <term>January 7, 1989</term>
+/// </item>
+/// <item>
+/// <term>4</term>
+/// <term>January 8, 1989</term>
+/// <term>present</term>
+/// </item>
+/// </list>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class JapaneseCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static JapaneseCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(1,
+ CCGregorianCalendar.fixed_from_dmy(8, 9, 1868),
+ CCGregorianCalendar.fixed_from_dmy(29, 7, 1912));
+ M_EraHandler.appendEra(2,
+ CCGregorianCalendar.fixed_from_dmy(30, 7, 1912),
+ CCGregorianCalendar.fixed_from_dmy(24, 12, 1926));
+ M_EraHandler.appendEra(3,
+ CCGregorianCalendar.fixed_from_dmy(25, 12, 1926),
+ CCGregorianCalendar.fixed_from_dmy(7, 1, 1989));
+ M_EraHandler.appendEra(4,
+ CCGregorianCalendar.fixed_from_dmy(8, 1, 1989));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public JapaneseCalendar() {
+ M_AbbrEraNames = new string[] { "M", "T", "S", "H" };
+ M_EraNames = new string[] { "Meiji", "Taisho", "Showa",
+ "Heisei" };
+ }
+
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ M_EraHandler.CheckDateTime(time);
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = 4;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ DateTime t = CCGregorianCalendar.AddMonths(time, months);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ DateTime t = CCGregorianCalendar.AddYears(time, years);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ // M_CheckDateTime not needed, because EraYear does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ // M_CheckDateTime not needed, because EraYeat does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ gregorianYear, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+
+ /// <summary>
+ /// This functions returns simply the year for the Japanese calendar.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <returns>The same argument as the year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year is negative or the resulting
+ /// year is invalid.
+ /// </exception>
+ public override int ToFourDigitYear(int year) {
+ if (year < 0)
+ throw new ArgumentOutOfRangeException(
+ "year", "Non-negative number required.");
+ int era = CurrentEra;
+ M_CheckYE(year, ref era);
+ return year;
+ }
+} // class JapaneseCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/JulianCalendar.cs b/mcs/class/corlib/System.Globalization/JulianCalendar.cs
new file mode 100644
index 00000000000..25514fd6361
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/JulianCalendar.cs
@@ -0,0 +1,461 @@
+// JulianCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Julian calendar.
+/// </summary>
+/// <remarks>
+/// <para>The Julian calendar supports only the Common Era from
+/// January 1, 1 (Gregorian) to December 31, 9999 (Gregorian).
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class JulianCalendar : Calendar {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public JulianCalendar() {
+ M_AbbrEraNames = new string[] {"C.E."};
+ M_EraNames = new string[] {"Common Era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 2029;
+ }
+
+ /// <summary>
+ /// The era number for the Common Era (C.E.) or Anno Domini (A.D.)
+ /// respective.
+ /// </summary>
+ public static readonly int JulianEra = 1;
+
+ /// <value>Overridden. Gives the eras supported by the Julian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { JulianEra };
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = JulianEra;
+ if (era != JulianEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ M_ArgumentInRange("year", year, 1, 9999);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day, ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ if (year == 9999 && ((month == 10 && day > 19) || month > 10))
+ throw new ArgumentOutOfRangeException(
+ "The maximum Julian date is 19. 10. 9999.");
+ }
+
+ /// <summary>
+ /// Overridden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ CCJulianCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ month += months;
+ rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
+ DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ CCJulianCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ year += years;
+ rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
+ DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return CCJulianCalendar.day_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int year = CCJulianCalendar.year_from_fixed(rd);
+ int rd1_1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);
+ return rd - rd1_1 + 1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ int rd1 = CCJulianCalendar.fixed_from_dmy(1, month, year);
+ int rd2 = CCJulianCalendar.fixed_from_dmy(1, month+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ int rd1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);
+ int rd2 = CCJulianCalendar.fixed_from_dmy(1, 1, year+1);
+ return rd2 - rd1;
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ // should change, if more than one era is supported
+ return JulianEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return CCJulianCalendar.month_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return CCJulianCalendar.year_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return IsLeapYear(year) && month == 2 && day == 29;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCJulianCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ int rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
+ return CCFixed.ToDateTime(rd,
+ hour, minute, second, milliseconds);
+ }
+
+ [MonoTODO]
+ public override int ToFourDigitYear(int year)
+ {
+ throw new NotImplementedException();
+ }
+
+} // class JulianCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/KoreanCalendar.cs b/mcs/class/corlib/System.Globalization/KoreanCalendar.cs
new file mode 100644
index 00000000000..8f2d16cdc58
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/KoreanCalendar.cs
@@ -0,0 +1,462 @@
+// KoreanCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Korean calendar. It differs from the Gegorian calendar only
+/// in the year counting.
+/// </summary>
+/// <remarks>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class KoreanCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <variable>
+ /// The standard era for the <see cref="T:KoreanCalendar"/>.
+ /// </variable>
+ public const int KoreanEra = 1;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static KoreanCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(KoreanEra,
+ CCGregorianCalendar.fixed_from_dmy(1, 1, -2332));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public KoreanCalendar() {
+ M_AbbrEraNames = new string[] {"K.C.E."};
+ M_EraNames = new string[] {"Korean Current Era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 4362;
+ }
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = KoreanEra;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ return CCGregorianCalendar.AddMonths(time, months);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ return CCGregorianCalendar.AddYears(time, years);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYEG(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(gregorianYear,
+ month, day, hour, minute, second, milliseconds);
+ }
+
+ [MonoTODO]
+ public override int ToFourDigitYear(int year)
+ {
+ throw new NotImplementedException();
+ }
+
+} // class KoreanCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/Locale.cs b/mcs/class/corlib/System.Globalization/Locale.cs
new file mode 100755
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
new file mode 100644
index 00000000000..5e6b21c479d
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
@@ -0,0 +1,676 @@
+//
+// System.Globalization.NumberFormatInfo.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+// Bob Smith (bob@thestuff.net)
+//
+// (C) Derek Holden
+// (C) Bob Smith http://www.thestuff.net
+//
+
+//
+// NumberFormatInfo. One can only assume it is the class gotten
+// back from a GetFormat() method from an IFormatProvider /
+// IFormattable implementer. There are some discrepencies with the
+// ECMA spec and the SDK docs, surprisingly. See my conversation
+// with myself on it at:
+// http://lists.ximian.com/archives/public/mono-list/2001-July/000794.html
+//
+// Other than that this is totally ECMA compliant.
+//
+
+namespace System.Globalization {
+
+ [Serializable]
+ public sealed class NumberFormatInfo : ICloneable, IFormatProvider {
+ private bool readOnly;
+
+ // Currency Related Format Info
+ private int currencyDecimalDigits;
+ private string currencyDecimalSeparator;
+ private string currencyGroupSeparator;
+ private int[] currencyGroupSizes;
+ private int currencyNegativePattern;
+ private int currencyPositivePattern;
+ private string currencySymbol;
+
+ private string naNSymbol;
+ private string negativeInfinitySymbol;
+ private string negativeSign;
+
+ // Number Related Format Info
+ private int numberDecimalDigits;
+ private string numberDecimalSeparator;
+ private string numberGroupSeparator;
+ private int[] numberGroupSizes;
+ private int numberNegativePattern;
+
+ // Percent Related Format Info
+ private int percentDecimalDigits;
+ private string percentDecimalSeparator;
+ private string percentGroupSeparator;
+ private int[] percentGroupSizes;
+ private int percentNegativePattern;
+ private int percentPositivePattern;
+ private string percentSymbol;
+
+ private string perMilleSymbol;
+ private string positiveInfinitySymbol;
+ private string positiveSign;
+
+ internal NumberFormatInfo (int lcid)
+ {
+ //FIXME: should add more LCID
+ // CultureInfo uses this one also.
+ if (lcid != 0x007F)
+ lcid = 0x007F;
+
+ switch (lcid){
+
+ // The Invariant Culture Info ID.
+ case 0x007f:
+ readOnly = false;
+
+ // Currency Related Format Info
+ currencyDecimalDigits = 2;
+ currencyDecimalSeparator = ".";
+ currencyGroupSeparator = ",";
+ currencyGroupSizes = new int[1] { 3 };
+ currencyNegativePattern = 0;
+ currencyPositivePattern = 0;
+ currencySymbol = "$";
+
+ naNSymbol = "NaN";
+ negativeInfinitySymbol = "-Infinity";
+ negativeSign = "-";
+
+ // Number Related Format Info
+ numberDecimalDigits = 2;
+ numberDecimalSeparator = ".";
+ numberGroupSeparator = ",";
+ numberGroupSizes = new int[1] { 3 };
+ numberNegativePattern = 1;
+
+ // Percent Related Format Info
+ percentDecimalDigits = 2;
+ percentDecimalSeparator = ".";
+ percentGroupSeparator = ",";
+ percentGroupSizes = new int[1] { 3 };
+ percentNegativePattern = 0;
+ percentPositivePattern = 0;
+ percentSymbol= "%";
+
+ perMilleSymbol = "\u2030";
+ positiveInfinitySymbol = "Infinity";
+ positiveSign = "+";
+ break;
+ }
+ }
+
+ public NumberFormatInfo () : this (0x007f)
+ {
+ }
+
+ // =========== Currency Format Properties =========== //
+
+ public int CurrencyDecimalDigits {
+ get {
+ return currencyDecimalDigits;
+ }
+
+ set {
+ if (value < 0 || value > 99)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 99");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyDecimalDigits = value;
+ }
+ }
+
+ public string CurrencyDecimalSeparator {
+ get {
+ return currencyDecimalSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyDecimalSeparator = value;
+ }
+ }
+
+
+ public string CurrencyGroupSeparator {
+ get {
+ return currencyGroupSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyGroupSeparator = value;
+ }
+ }
+
+ public int[] CurrencyGroupSizes {
+ get {
+ return currencyGroupSizes;
+ }
+
+ set {
+ if (value == null || value.Length == 0)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ // All elements except last need to be in range 1 - 9, last can be 0.
+ int last = value.Length - 1;
+
+ for (int i = 0; i < last; i++)
+ if (value[i] < 1 || value[i] > 9)
+ throw new ArgumentOutOfRangeException
+ ("One of the elements in the array specified is not between 1 and 9");
+
+ if (value[last] < 0 || value[last] > 9)
+ throw new ArgumentOutOfRangeException
+ ("Last element in the array specified is not between 0 and 9");
+
+ currencyGroupSizes = (int[]) value.Clone();
+ }
+ }
+
+ public int CurrencyNegativePattern {
+ get {
+ // See ECMA NumberFormatInfo page 8
+ return currencyNegativePattern;
+ }
+
+ set {
+ if (value < 0 || value > 15)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 15");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyNegativePattern = value;
+ }
+ }
+
+ public int CurrencyPositivePattern {
+ get {
+ // See ECMA NumberFormatInfo page 11
+ return currencyPositivePattern;
+ }
+
+ set {
+ if (value < 0 || value > 3)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 3");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyPositivePattern = value;
+ }
+ }
+
+ public string CurrencySymbol {
+ get {
+ return currencySymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencySymbol = value;
+ }
+ }
+
+ // =========== Static Read-Only Properties =========== //
+
+ public static NumberFormatInfo CurrentInfo {
+ get {
+ // This should be culture specific
+ NumberFormatInfo nfi = new NumberFormatInfo ();
+ nfi.readOnly = true;
+ return nfi;
+ }
+ }
+
+ public static NumberFormatInfo InvariantInfo {
+ get {
+ // This uses invariant info, which is same as in the constructor
+ NumberFormatInfo nfi = new NumberFormatInfo ();
+ nfi.NumberNegativePattern = 1;
+ nfi.readOnly = true;
+ return nfi;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return readOnly;
+ }
+ }
+
+
+
+ public string NaNSymbol {
+ get {
+ return naNSymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ naNSymbol = value;
+ }
+ }
+
+ public string NegativeInfinitySymbol {
+ get {
+ return negativeInfinitySymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ negativeInfinitySymbol = value;
+ }
+ }
+
+ public string NegativeSign {
+ get {
+ return negativeSign;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ negativeSign = value;
+ }
+ }
+
+ // =========== Number Format Properties =========== //
+
+ public int NumberDecimalDigits {
+ get {
+ return numberDecimalDigits;
+ }
+
+ set {
+ if (value < 0 || value > 99)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 99");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberDecimalDigits = value;
+ }
+ }
+
+ public string NumberDecimalSeparator {
+ get {
+ return numberDecimalSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberDecimalSeparator = value;
+ }
+ }
+
+
+ public string NumberGroupSeparator {
+ get {
+ return numberGroupSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberGroupSeparator = value;
+ }
+ }
+
+ public int[] NumberGroupSizes {
+ get {
+ return numberGroupSizes;
+ }
+
+ set {
+ if (value == null || value.Length == 0)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ // All elements except last need to be in range 1 - 9, last can be 0.
+ int last = value.Length - 1;
+
+ for (int i = 0; i < last; i++)
+ if (value[i] < 1 || value[i] > 9)
+ throw new ArgumentOutOfRangeException
+ ("One of the elements in the array specified is not between 1 and 9");
+
+ if (value[last] < 0 || value[last] > 9)
+ throw new ArgumentOutOfRangeException
+ ("Last element in the array specified is not between 0 and 9");
+
+ numberGroupSizes = (int[]) value.Clone();
+ }
+ }
+
+ public int NumberNegativePattern {
+ get {
+ // See ECMA NumberFormatInfo page 27
+ return numberNegativePattern;
+ }
+
+ set {
+ if (value < 0 || value > 4)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 15");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberNegativePattern = value;
+ }
+ }
+
+ // =========== Percent Format Properties =========== //
+
+ public int PercentDecimalDigits {
+ get {
+ return percentDecimalDigits;
+ }
+
+ set {
+ if (value < 0 || value > 99)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 99");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentDecimalDigits = value;
+ }
+ }
+
+ public string PercentDecimalSeparator {
+ get {
+ return percentDecimalSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentDecimalSeparator = value;
+ }
+ }
+
+
+ public string PercentGroupSeparator {
+ get {
+ return percentGroupSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentGroupSeparator = value;
+ }
+ }
+
+ public int[] PercentGroupSizes {
+ get {
+ return percentGroupSizes;
+ }
+
+ set {
+ if (value == null || value.Length == 0)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ // All elements except last need to be in range 1 - 9, last can be 0.
+ int last = value.Length - 1;
+
+ for (int i = 0; i < last; i++)
+ if (value[i] < 1 || value[i] > 9)
+ throw new ArgumentOutOfRangeException
+ ("One of the elements in the array specified is not between 1 and 9");
+
+ if (value[last] < 0 || value[last] > 9)
+ throw new ArgumentOutOfRangeException
+ ("Last element in the array specified is not between 0 and 9");
+
+ percentGroupSizes = (int[]) value.Clone();
+ }
+ }
+
+ public int PercentNegativePattern {
+ get {
+ // See ECMA NumberFormatInfo page 8
+ return percentNegativePattern;
+ }
+
+ set {
+ if (value < 0 || value > 2)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 15");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentNegativePattern = value;
+ }
+ }
+
+ public int PercentPositivePattern {
+ get {
+ // See ECMA NumberFormatInfo page 11
+ return percentPositivePattern;
+ }
+
+ set {
+ if (value < 0 || value > 2)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 3");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentPositivePattern = value;
+ }
+ }
+
+ public string PercentSymbol {
+ get {
+ return percentSymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentSymbol = value;
+ }
+ }
+
+ public string PerMilleSymbol {
+ get {
+ return perMilleSymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ perMilleSymbol = value;
+ }
+ }
+
+ public string PositiveInfinitySymbol {
+ get {
+ return positiveInfinitySymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ positiveInfinitySymbol = value;
+ }
+ }
+
+ public string PositiveSign {
+ get {
+ return positiveSign;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ positiveSign = value;
+ }
+ }
+
+ public object GetFormat (Type formatType)
+ {
+ return (formatType == GetType()) ? this : null;
+ }
+
+ public object Clone ()
+ {
+ NumberFormatInfo clone = (NumberFormatInfo) MemberwiseClone();
+ // clone is not read only
+ clone.readOnly = false;
+ return clone;
+ }
+
+ public static NumberFormatInfo ReadOnly (NumberFormatInfo nfi)
+ {
+ NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone();
+ copy.readOnly = true;
+ return copy;
+ }
+
+ public static NumberFormatInfo GetInstance(IFormatProvider provider)
+ {
+ if (provider != null) {
+ NumberFormatInfo nfi;
+ nfi = (NumberFormatInfo)provider.GetFormat(typeof(NumberFormatInfo));
+ if (nfi != null)
+ return nfi;
+ }
+
+ return CurrentInfo;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/NumberStyles.cs b/mcs/class/corlib/System.Globalization/NumberStyles.cs
new file mode 100644
index 00000000000..fbbccc86427
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/NumberStyles.cs
@@ -0,0 +1,46 @@
+//------------------------------------------------------------------------------
+//
+// System.Globalization.NumberStyles.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Thu 07/18/2001
+//
+// Modified: 7/20/01, Derek Holden (dholden@draper.com)
+// Added ECMA values for allows and masks for data types
+//
+//------------------------------------------------------------------------------
+
+namespace System.Globalization {
+
+ [Flags]
+ [Serializable]
+ public enum NumberStyles {
+ None = 0x00000000,
+ AllowLeadingWhite = 0x00000001,
+ AllowTrailingWhite = 0x00000002,
+ AllowLeadingSign = 0x00000004,
+ AllowTrailingSign = 0x00000008,
+ AllowParentheses = 0x00000010,
+ AllowDecimalPoint = 0x00000020,
+ AllowThousands = 0x00000040,
+ AllowExponent = 0x00000080,
+ AllowCurrencySymbol = 0x00000100,
+ AllowHexSpecifier = 0x00000200,
+
+ Integer = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign ),
+ HexNumber = ( AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier ),
+ Number = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowTrailingSign | AllowDecimalPoint | AllowThousands ),
+ Float = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowDecimalPoint | AllowExponent ),
+ Currency = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
+ AllowThousands | AllowCurrencySymbol ),
+ Any = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
+ AllowThousands | AllowExponent | AllowCurrencySymbol ),
+ }
+
+} // Namespace
diff --git a/mcs/class/corlib/System.Globalization/RegionInfo.cs b/mcs/class/corlib/System.Globalization/RegionInfo.cs
new file mode 100644
index 00000000000..b95e869941a
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/RegionInfo.cs
@@ -0,0 +1,1728 @@
+using System.Globalization;
+
+namespace System.Globalization {
+
+ [Serializable]
+ public class RegionInfo {
+ int NLS_id;
+
+ public RegionInfo (int culture) {
+
+ if (CultureInfo.IsIDNeutralCulture (culture))
+ throw new ArgumentException ("Culture ID " + culture
+ + " (0x" + culture.ToString ("X4")
+ + ") is a neutral culture. A region can not be created from it.");
+
+ switch (culture) {
+ case 0x0401: // ar-SA Arabic (Saudi Arabia)
+ NLS_id = 682;
+ break;
+ case 0x0801: // ar-IQ Arabic (Iraq)
+ NLS_id = 368;
+ break;
+ case 0x0C01: // ar-EG Arabic (Egypt)
+ NLS_id = 818;
+ break;
+ case 0x1001: // ar-LY Arabic (Libya)
+ NLS_id = 434;
+ break;
+ case 0x1401: // ar-DZ Arabic (Algeria)
+ NLS_id = 12;
+ break;
+ case 0x1801: // ar-MA Arabic (Morocco)
+ NLS_id = 504;
+ break;
+ case 0x1C01: // ar-TN Arabic (Tunisia)
+ NLS_id = 788;
+ break;
+ case 0x2001: // ar-OM Arabic (Oman)
+ NLS_id = 512;
+ break;
+ case 0x2401: // ar-YE Arabic (Yemen)
+ NLS_id = 887;
+ break;
+ case 0x2801: // ar-SY Arabic (Syria)
+ NLS_id = 760;
+ break;
+ case 0x2C01: // ar-JO Arabic (Jordan)
+ NLS_id = 400;
+ break;
+ case 0x3001: // ar-LB Arabic (Lebanon)
+ NLS_id = 422;
+ break;
+ case 0x3401: // ar-KW Arabic (Kuwait)
+ NLS_id = 414;
+ break;
+ case 0x3801: // ar-AE Arabic (U.A.E.)
+ NLS_id = 784;
+ break;
+ case 0x3C01: // ar-BH Arabic (Bahrain)
+ NLS_id = 48;
+ break;
+ case 0x4001: // ar-QA Arabic (Qatar)
+ NLS_id = 634;
+ break;
+ case 0x0402: // bg-BG Bulgarian (Bulgaria)
+ NLS_id = 100;
+ break;
+ case 0x0403: // ca-ES Catalan (Spain)
+ NLS_id = 724;
+ break;
+ case 0x0404: // zh-TW Chinese (Taiwan)
+ NLS_id = 158;
+ break;
+ case 0x0804: // zh-CN Chinese (People's Republic of China)
+ NLS_id = 156;
+ break;
+ case 0x0C04: // zh-HK Chinese (Hong Kong S.A.R.)
+ NLS_id = 344;
+ break;
+ case 0x1004: // zh-SG Chinese (Singapore)
+ NLS_id = 702;
+ break;
+ case 0x1404: // zh-MO Chinese (Macau S.A.R.)
+ NLS_id = 446;
+ break;
+ case 0x0405: // cs-CZ Czech (Czech Republic)
+ NLS_id = 203;
+ break;
+ case 0x0406: // da-DK Danish (Denmark)
+ NLS_id = 208;
+ break;
+ case 0x0407: // de-DE German (Germany)
+ NLS_id = 276;
+ break;
+ case 0x0807: // de-CH German (Switzerland)
+ NLS_id = 756;
+ break;
+ case 0x0C07: // de-AT German (Austria)
+ NLS_id = 40;
+ break;
+ case 0x1007: // de-LU German (Luxembourg)
+ NLS_id = 442;
+ break;
+ case 0x1407: // de-LI German (Liechtenstein)
+ NLS_id = 438;
+ break;
+ case 0x0408: // el-GR Greek (Greece)
+ NLS_id = 300;
+ break;
+ case 0x0409: // en-US English (United States)
+ NLS_id = 840;
+ break;
+ case 0x0809: // en-GB English (United Kingdom)
+ NLS_id = 826;
+ break;
+ case 0x0C09: // en-AU English (Australia)
+ NLS_id = 36;
+ break;
+ case 0x1009: // en-CA English (Canada)
+ NLS_id = 124;
+ break;
+ case 0x1409: // en-NZ English (New Zealand)
+ NLS_id = 554;
+ break;
+ case 0x1809: // en-IE English (Ireland)
+ NLS_id = 372;
+ break;
+ case 0x1C09: // en-ZA English (South Africa)
+ NLS_id = 710;
+ break;
+ case 0x2009: // en-JM English (Jamaica)
+ NLS_id = 388;
+ break;
+ case 0x2809: // en-BZ English (Belize)
+ NLS_id = 84;
+ break;
+ case 0x2C09: // en-TT English (Trinidad and Tobago)
+ NLS_id = 780;
+ break;
+ case 0x3009: // en-ZW English (Zimbabwe)
+ NLS_id = 716;
+ break;
+ case 0x3409: // en-PH English (Republic of the Philippines)
+ NLS_id = 608;
+ break;
+ case 0x080A: // es-MX Spanish (Mexico)
+ NLS_id = 484;
+ break;
+ case 0x0C0A: // es-ES Spanish (Spain)
+ NLS_id = 724;
+ break;
+ case 0x100A: // es-GT Spanish (Guatemala)
+ NLS_id = 320;
+ break;
+ case 0x140A: // es-CR Spanish (Costa Rica)
+ NLS_id = 188;
+ break;
+ case 0x180A: // es-PA Spanish (Panama)
+ NLS_id = 591;
+ break;
+ case 0x1C0A: // es-DO Spanish (Dominican Republic)
+ NLS_id = 214;
+ break;
+ case 0x200A: // es-VE Spanish (Venezuela)
+ NLS_id = 862;
+ break;
+ case 0x240A: // es-CO Spanish (Colombia)
+ NLS_id = 170;
+ break;
+ case 0x280A: // es-PE Spanish (Peru)
+ NLS_id = 604;
+ break;
+ case 0x2C0A: // es-AR Spanish (Argentina)
+ NLS_id = 32;
+ break;
+ case 0x300A: // es-EC Spanish (Ecuador)
+ NLS_id = 218;
+ break;
+ case 0x340A: // es-CL Spanish (Chile)
+ NLS_id = 152;
+ break;
+ case 0x380A: // es-UY Spanish (Uruguay)
+ NLS_id = 858;
+ break;
+ case 0x3C0A: // es-PY Spanish (Paraguay)
+ NLS_id = 600;
+ break;
+ case 0x400A: // es-BO Spanish (Bolivia)
+ NLS_id = 68;
+ break;
+ case 0x440A: // es-SV Spanish (El Salvador)
+ NLS_id = 222;
+ break;
+ case 0x480A: // es-HN Spanish (Honduras)
+ NLS_id = 340;
+ break;
+ case 0x4C0A: // es-NI Spanish (Nicaragua)
+ NLS_id = 558;
+ break;
+ case 0x500A: // es-PR Spanish (Puerto Rico)
+ NLS_id = 630;
+ break;
+ case 0x040B: // fi-FI Finnish (Finland)
+ NLS_id = 246;
+ break;
+ case 0x040C: // fr-FR French (France)
+ NLS_id = 250;
+ break;
+ case 0x080C: // fr-BE French (Belgium)
+ NLS_id = 56;
+ break;
+ case 0x0C0C: // fr-CA French (Canada)
+ NLS_id = 124;
+ break;
+ case 0x100C: // fr-CH French (Switzerland)
+ NLS_id = 756;
+ break;
+ case 0x140C: // fr-LU French (Luxembourg)
+ NLS_id = 442;
+ break;
+ case 0x180C: // fr-MC French (Principality of Monaco)
+ NLS_id = 492;
+ break;
+ case 0x040D: // he-IL Hebrew (Israel)
+ NLS_id = 376;
+ break;
+ case 0x040E: // hu-HU Hungarian (Hungary)
+ NLS_id = 348;
+ break;
+ case 0x040F: // is-IS Icelandic (Iceland)
+ NLS_id = 352;
+ break;
+ case 0x0410: // it-IT Italian (Italy)
+ NLS_id = 380;
+ break;
+ case 0x0810: // it-CH Italian (Switzerland)
+ NLS_id = 756;
+ break;
+ case 0x0411: // ja-JP Japanese (Japan)
+ NLS_id = 392;
+ break;
+ case 0x0412: // ko-KR Korean (Korea)
+ NLS_id = 410;
+ break;
+ case 0x0413: // nl-NL Dutch (Netherlands)
+ NLS_id = 528;
+ break;
+ case 0x0813: // nl-BE Dutch (Belgium)
+ NLS_id = 56;
+ break;
+ case 0x0414: // nb-NO Norwegian (Bokm†l) (Norway)
+ NLS_id = 578;
+ break;
+ case 0x0814: // nn-NO Norwegian (Nynorsk) (Norway)
+ NLS_id = 578;
+ break;
+ case 0x0415: // pl-PL Polish (Poland)
+ NLS_id = 616;
+ break;
+ case 0x0416: // pt-BR Portuguese (Brazil)
+ NLS_id = 76;
+ break;
+ case 0x0816: // pt-PT Portuguese (Portugal)
+ NLS_id = 620;
+ break;
+ case 0x0418: // ro-RO Romanian (Romania)
+ NLS_id = 642;
+ break;
+ case 0x0419: // ru-RU Russian (Russia)
+ NLS_id = 643;
+ break;
+ case 0x041A: // hr-HR Croatian (Croatia)
+ NLS_id = 191;
+ break;
+ case 0x041B: // sk-SK Slovak (Slovakia)
+ NLS_id = 703;
+ break;
+ case 0x041C: // sq-AL Albanian (Albania)
+ NLS_id = 8;
+ break;
+ case 0x041D: // sv-SE Swedish (Sweden)
+ NLS_id = 752;
+ break;
+ case 0x081D: // sv-FI Swedish (Finland)
+ NLS_id = 246;
+ break;
+ case 0x041E: // th-TH Thai (Thailand)
+ NLS_id = 764;
+ break;
+ case 0x041F: // tr-TR Turkish (Turkey)
+ NLS_id = 792;
+ break;
+ case 0x0420: // ur-PK Urdu (Islamic Republic of Pakistan)
+ NLS_id = 586;
+ break;
+ case 0x0421: // id-ID Indonesian (Indonesia)
+ NLS_id = 360;
+ break;
+ case 0x0422: // uk-UA Ukrainian (Ukraine)
+ NLS_id = 804;
+ break;
+ case 0x0423: // be-BY Belarusian (Belarus)
+ NLS_id = 112;
+ break;
+ case 0x0424: // sl-SI Slovenian (Slovenia)
+ NLS_id = 705;
+ break;
+ case 0x0425: // et-EE Estonian (Estonia)
+ NLS_id = 233;
+ break;
+ case 0x0426: // lv-LV Latvian (Latvia)
+ NLS_id = 428;
+ break;
+ case 0x0427: // lt-LT Lithuanian (Lithuania)
+ NLS_id = 440;
+ break;
+ case 0x0429: // fa-IR Farsi (Iran)
+ NLS_id = 364;
+ break;
+ case 0x042A: // vi-VN Vietnamese (Viet Nam)
+ NLS_id = 704;
+ break;
+ case 0x042B: // hy-AM Armenian (Armenia)
+ NLS_id = 51;
+ break;
+ case 0x042C: // Lt-az-AZ Azeri (Latin) (Azerbaijan)
+ NLS_id = 31;
+ break;
+ case 0x082C: // Cy-az-AZ Azeri (Cyrillic) (Azerbaijan)
+ NLS_id = 31;
+ break;
+ case 0x042D: // eu-ES Basque (Spain)
+ NLS_id = 724;
+ break;
+ case 0x042F: // mk-MK FYRO Macedonian (Former Yugoslav Republic of Macedonia)
+ NLS_id = 807;
+ break;
+ case 0x0436: // af-ZA Afrikaans (South Africa)
+ NLS_id = 710;
+ break;
+ case 0x0437: // ka-GE Georgian (Georgia)
+ NLS_id = 268;
+ break;
+ case 0x0438: // fo-FO Faeroese (Faeroe Islands)
+ NLS_id = 234;
+ break;
+ case 0x0439: // hi-IN Hindi (India)
+ NLS_id = 356;
+ break;
+ case 0x043E: // ms-MY Malay (Malaysia)
+ NLS_id = 458;
+ break;
+ case 0x083E: // ms-BN Malay (Brunei Darussalam)
+ NLS_id = 96;
+ break;
+ case 0x043F: // kk-KZ Kazakh (Kazakhstan)
+ NLS_id = 398;
+ break;
+ case 0x0440: // ky-KZ Kyrgyz (Kyrgyzstan)
+ NLS_id = 398;
+ break;
+ case 0x0441: // sw-KE Swahili (Kenya)
+ NLS_id = 404;
+ break;
+ case 0x0443: // Lt-uz-UZ Uzbek (Latin) (Uzbekistan)
+ NLS_id = 860;
+ break;
+ case 0x0843: // Cy-uz-UZ Uzbek (Cyrillic) (Uzbekistan)
+ NLS_id = 860;
+ break;
+ case 0x0446: // pa-IN Punjabi (India)
+ NLS_id = 356;
+ break;
+ case 0x0447: // gu-IN Gujarati (India)
+ NLS_id = 356;
+ break;
+ case 0x0449: // ta-IN Tamil (India)
+ NLS_id = 356;
+ break;
+ case 0x044A: // te-IN Telugu (India)
+ NLS_id = 356;
+ break;
+ case 0x044B: // kn-IN Kannada (India)
+ NLS_id = 356;
+ break;
+ case 0x044E: // mr-IN Marathi (India)
+ NLS_id = 356;
+ break;
+ case 0x044F: // sa-IN Sanskrit (India)
+ NLS_id = 356;
+ break;
+ case 0x0450: // mn-MN Mongolian (Mongolia)
+ NLS_id = 496;
+ break;
+ case 0x0456: // gl-ES Galician (Spain)
+ NLS_id = 724;
+ break;
+ case 0x0457: // kok-IN Konkani (India)
+ NLS_id = 356;
+ break;
+ case 0x045A: // syr-SY Syriac (Syria)
+ NLS_id = 760;
+ break;
+ case 0x0465: // div-MV Divehi (Maldives)
+ NLS_id = 462;
+ break;
+ case 0x007F: // Invariant Language (Invariant Country)
+ throw new ArgumentException ("There is no region associated with the Invariant Culture (Culture ID: 0x7F).");
+ default:
+ throw new ArgumentException ("Culture ID " + culture + " (0x" + culture.ToString ("X4")
+ + ") is not a supported culture.");
+ }
+ }
+
+ public RegionInfo (string name) {
+ switch (name.ToUpper ()) {
+ case "AF": // Afghanistan
+ NLS_id = 004;
+ break;
+ case "AL": // Albania
+ NLS_id = 008;
+ break;
+ case "DZ": // Algeria
+ NLS_id = 012;
+ break;
+ case "AS": // American Samoa
+ NLS_id = 016;
+ break;
+ case "AD": // Andorra
+ NLS_id = 020;
+ break;
+ case "AO": // Angola
+ NLS_id = 024;
+ break;
+ case "AI": // Anguilla
+ NLS_id = 660;
+ break;
+ case "AQ": // Antarctica
+ NLS_id = 010;
+ break;
+ case "AG": // Antigua and Barbuda
+ NLS_id = 028;
+ break;
+ case "AR": // Argentina
+ NLS_id = 032;
+ break;
+ case "AM": // Armenia
+ NLS_id = 051;
+ break;
+ case "AW": // Aruba
+ NLS_id = 533;
+ break;
+ case "AU": // Australia
+ NLS_id = 036;
+ break;
+ case "AT": // Austria
+ NLS_id = 040;
+ break;
+ case "AZ": // Azerbaijan
+ NLS_id = 031;
+ break;
+ case "BS": // Bahamas
+ NLS_id = 044;
+ break;
+ case "BH": // Bahrain
+ NLS_id = 048;
+ break;
+ case "BD": // Bangladesh
+ NLS_id = 050;
+ break;
+ case "BB": // Barbados
+ NLS_id = 052;
+ break;
+ case "BY": // Belarus
+ NLS_id = 112;
+ break;
+ case "BE": // Belgium
+ NLS_id = 056;
+ break;
+ case "BZ": // Belize
+ NLS_id = 084;
+ break;
+ case "BJ": // Benin
+ NLS_id = 204;
+ break;
+ case "BM": // Bermuda
+ NLS_id = 060;
+ break;
+ case "BT": // Bhutan
+ NLS_id = 064;
+ break;
+ case "BO": // Bolivia
+ NLS_id = 068;
+ break;
+ case "BA": // Bosnia and Herzegowina
+ NLS_id = 070;
+ break;
+ case "BW": // Botswana
+ NLS_id = 072;
+ break;
+ case "BV": // Bouvet Island
+ NLS_id = 074;
+ break;
+ case "BR": // Brazil
+ NLS_id = 076;
+ break;
+ case "IO": // British Indian Ocean Territory
+ NLS_id = 086;
+ break;
+ case "BN": // Brunei Darussalam
+ NLS_id = 096;
+ break;
+ case "BG": // Bulgaria
+ NLS_id = 100;
+ break;
+ case "BF": // Burkina Faso
+ NLS_id = 854;
+ break;
+ case "BI": // Burundi
+ NLS_id = 108;
+ break;
+ case "KH": // Cambodia
+ NLS_id = 116;
+ break;
+ case "CM": // Cameroon
+ NLS_id = 120;
+ break;
+ case "CA": // Canada
+ NLS_id = 124;
+ break;
+ case "CV": // Cape Verde
+ NLS_id = 132;
+ break;
+ case "KY": // Cayman Islands
+ NLS_id = 136;
+ break;
+ case "CF": // Central African Republic
+ NLS_id = 140;
+ break;
+ case "TD": // Chad
+ NLS_id = 148;
+ break;
+ case "CL": // Chile
+ NLS_id = 152;
+ break;
+ case "CN": // China
+ NLS_id = 156;
+ break;
+ case "CX": // Christmas Island
+ NLS_id = 162;
+ break;
+ case "CC": // Cocos (Keeling) Islands
+ NLS_id = 166;
+ break;
+ case "CO": // Colombia
+ NLS_id = 170;
+ break;
+ case "KM": // Comoros
+ NLS_id = 174;
+ break;
+ case "CG": // Congo
+ NLS_id = 178;
+ break;
+ case "CK": // Cook Islands
+ NLS_id = 184;
+ break;
+ case "CR": // Costa Rica
+ NLS_id = 188;
+ break;
+ case "CI": // Cote D'Ivoire
+ NLS_id = 384;
+ break;
+ case "HR": // Croatia (Local Name: Hrvatska)
+ NLS_id = 191;
+ break;
+ case "CU": // Cuba
+ NLS_id = 192;
+ break;
+ case "CY": // Cyprus
+ NLS_id = 196;
+ break;
+ case "CZ": // Czech Republic
+ NLS_id = 203;
+ break;
+ case "DK": // Denmark
+ NLS_id = 208;
+ break;
+ case "DJ": // Djibouti
+ NLS_id = 262;
+ break;
+ case "DM": // Dominica
+ NLS_id = 212;
+ break;
+ case "DO": // Dominican Republic
+ NLS_id = 214;
+ break;
+ case "TP": // East Timor
+ NLS_id = 626;
+ break;
+ case "EC": // Ecuador
+ NLS_id = 218;
+ break;
+ case "EG": // Egypt
+ NLS_id = 818;
+ break;
+ case "SV": // El Salvador
+ NLS_id = 222;
+ break;
+ case "GQ": // Equatorial Guinea
+ NLS_id = 226;
+ break;
+ case "ER": // Eritrea
+ NLS_id = 232;
+ break;
+ case "EE": // Estonia
+ NLS_id = 233;
+ break;
+ case "ET": // Ethiopia
+ NLS_id = 231;
+ break;
+ case "FK": // Falkland Islands (Malvinas)
+ NLS_id = 238;
+ break;
+ case "FO": // Faroe Islands
+ NLS_id = 234;
+ break;
+ case "FJ": // Fiji
+ NLS_id = 242;
+ break;
+ case "FI": // Finland
+ NLS_id = 246;
+ break;
+ case "FR": // France
+ NLS_id = 250;
+ break;
+ case "FX": // France, Metropolitan
+ NLS_id = 249;
+ break;
+ case "GF": // French Guiana
+ NLS_id = 254;
+ break;
+ case "PF": // French Polynesia
+ NLS_id = 258;
+ break;
+ case "TF": // French Southern Territories
+ NLS_id = 260;
+ break;
+ case "GA": // Gabon
+ NLS_id = 266;
+ break;
+ case "GM": // Gambia
+ NLS_id = 270;
+ break;
+ case "GE": // Georgia
+ NLS_id = 268;
+ break;
+ case "DE": // Germany
+ NLS_id = 276;
+ break;
+ case "GH": // Ghana
+ NLS_id = 288;
+ break;
+ case "GI": // Gibraltar
+ NLS_id = 292;
+ break;
+ case "GR": // Greece
+ NLS_id = 300;
+ break;
+ case "GL": // Greenland
+ NLS_id = 304;
+ break;
+ case "GD": // Grenada
+ NLS_id = 308;
+ break;
+ case "GP": // Guadeloupe
+ NLS_id = 312;
+ break;
+ case "GU": // Guam
+ NLS_id = 316;
+ break;
+ case "GT": // Guatemala
+ NLS_id = 320;
+ break;
+ case "GN": // Guinea
+ NLS_id = 324;
+ break;
+ case "GW": // Guinea-Bissau
+ NLS_id = 624;
+ break;
+ case "GY": // Guyana
+ NLS_id = 328;
+ break;
+ case "HT": // Haiti
+ NLS_id = 332;
+ break;
+ case "HM": // Heard and Mc Donald Islands
+ NLS_id = 334;
+ break;
+ case "VA": // Holy See (Vatican City State)
+ NLS_id = 336;
+ break;
+ case "HN": // Honduras
+ NLS_id = 340;
+ break;
+ case "HK": // Hong Kong
+ NLS_id = 344;
+ break;
+ case "HU": // Hungary
+ NLS_id = 348;
+ break;
+ case "IS": // Iceland
+ NLS_id = 352;
+ break;
+ case "IN": // India
+ NLS_id = 356;
+ break;
+ case "ID": // Indonesia
+ NLS_id = 360;
+ break;
+ case "IR": // Iran (Islamic Republic of)
+ NLS_id = 364;
+ break;
+ case "IQ": // Iraq
+ NLS_id = 368;
+ break;
+ case "IE": // Ireland
+ NLS_id = 372;
+ break;
+ case "IL": // Israel
+ NLS_id = 376;
+ break;
+ case "IT": // Italy
+ NLS_id = 380;
+ break;
+ case "JM": // Jamaica
+ NLS_id = 388;
+ break;
+ case "JP": // Japan
+ NLS_id = 392;
+ break;
+ case "JO": // Jordan
+ NLS_id = 400;
+ break;
+ case "KZ": // Kazakhstan
+ NLS_id = 398;
+ break;
+ case "KE": // Kenya
+ NLS_id = 404;
+ break;
+ case "KI": // Kiribati
+ NLS_id = 296;
+ break;
+ case "KP": // Korea, Democratic People's Republic of
+ NLS_id = 408;
+ break;
+ case "KR": // Korea, Republic of
+ NLS_id = 410;
+ break;
+ case "KW": // Kuwait
+ NLS_id = 414;
+ break;
+ case "KG": // Kyrgyzstan
+ NLS_id = 417;
+ break;
+ case "LA": // Lao People's Democratic Republic
+ NLS_id = 418;
+ break;
+ case "LV": // Latvia
+ NLS_id = 428;
+ break;
+ case "LB": // Lebanon
+ NLS_id = 422;
+ break;
+ case "LS": // Lesotho
+ NLS_id = 426;
+ break;
+ case "LR": // Liberia
+ NLS_id = 430;
+ break;
+ case "LY": // Libyan Arab Jamahiriya
+ NLS_id = 434;
+ break;
+ case "LI": // Liechtenstein
+ NLS_id = 438;
+ break;
+ case "LT": // Lithuania
+ NLS_id = 440;
+ break;
+ case "LU": // Luxembourg
+ NLS_id = 442;
+ break;
+ case "MO": // Macau
+ NLS_id = 446;
+ break;
+ case "MK": // Macedonia, The Former Yugoslav Republic of
+ NLS_id = 807;
+ break;
+ case "MG": // Madagascar
+ NLS_id = 450;
+ break;
+ case "MW": // Malawi
+ NLS_id = 454;
+ break;
+ case "MY": // Malaysia
+ NLS_id = 458;
+ break;
+ case "MV": // Maldives
+ NLS_id = 462;
+ break;
+ case "ML": // Mali
+ NLS_id = 466;
+ break;
+ case "MT": // Malta
+ NLS_id = 470;
+ break;
+ case "MH": // Marshall Islands
+ NLS_id = 584;
+ break;
+ case "MQ": // Martinique
+ NLS_id = 474;
+ break;
+ case "MR": // Mauritania
+ NLS_id = 478;
+ break;
+ case "MU": // Mauritius
+ NLS_id = 480;
+ break;
+ case "YT": // Mayotte
+ NLS_id = 175;
+ break;
+ case "MX": // Mexico
+ NLS_id = 484;
+ break;
+ case "FM": // Micronesia, Federated States of
+ NLS_id = 583;
+ break;
+ case "MD": // Moldova, Republic of
+ NLS_id = 498;
+ break;
+ case "MC": // Monaco
+ NLS_id = 492;
+ break;
+ case "MN": // Mongolia
+ NLS_id = 496;
+ break;
+ case "MS": // Montserrat
+ NLS_id = 500;
+ break;
+ case "MA": // Morocco
+ NLS_id = 504;
+ break;
+ case "MZ": // Mozambique
+ NLS_id = 508;
+ break;
+ case "MM": // Myanmar
+ NLS_id = 104;
+ break;
+ case "NA": // Namibia
+ NLS_id = 516;
+ break;
+ case "NR": // Nauru
+ NLS_id = 520;
+ break;
+ case "NP": // Nepal
+ NLS_id = 524;
+ break;
+ case "NL": // Netherlands
+ NLS_id = 528;
+ break;
+ case "AN": // Netherlands Antilles
+ NLS_id = 530;
+ break;
+ case "NC": // New Caledonia
+ NLS_id = 540;
+ break;
+ case "NZ": // New Zealand
+ NLS_id = 554;
+ break;
+ case "NI": // Nicaragua
+ NLS_id = 558;
+ break;
+ case "NE": // Niger
+ NLS_id = 562;
+ break;
+ case "NG": // Nigeria
+ NLS_id = 566;
+ break;
+ case "NU": // Niue
+ NLS_id = 570;
+ break;
+ case "NF": // Norfolk Island
+ NLS_id = 574;
+ break;
+ case "MP": // Northern Mariana Islands
+ NLS_id = 580;
+ break;
+ case "NO": // Norway
+ NLS_id = 578;
+ break;
+ case "OM": // Oman
+ NLS_id = 512;
+ break;
+ case "PK": // Pakistan
+ NLS_id = 586;
+ break;
+ case "PW": // Palau
+ NLS_id = 585;
+ break;
+ case "PA": // Panama
+ NLS_id = 591;
+ break;
+ case "PG": // Papua New Guinea
+ NLS_id = 598;
+ break;
+ case "PY": // Paraguay
+ NLS_id = 600;
+ break;
+ case "PE": // Peru
+ NLS_id = 604;
+ break;
+ case "PH": // Philippines
+ NLS_id = 608;
+ break;
+ case "PN": // Pitcairn
+ NLS_id = 612;
+ break;
+ case "PL": // Poland
+ NLS_id = 616;
+ break;
+ case "PT": // Portugal
+ NLS_id = 620;
+ break;
+ case "PR": // Puerto Rico
+ NLS_id = 630;
+ break;
+ case "QA": // Qatar
+ NLS_id = 634;
+ break;
+ case "RE": // Reunion
+ NLS_id = 638;
+ break;
+ case "RO": // Romania
+ NLS_id = 642;
+ break;
+ case "RU": // Russian Federation
+ NLS_id = 643;
+ break;
+ case "RW": // Rwanda
+ NLS_id = 646;
+ break;
+ case "KN": // Saint Kitts and Nevis
+ NLS_id = 659;
+ break;
+ case "LC": // Saint Lucia
+ NLS_id = 662;
+ break;
+ case "VC": // Saint Vincent and The Grenadines
+ NLS_id = 670;
+ break;
+ case "WS": // Samoa
+ NLS_id = 882;
+ break;
+ case "SM": // San Marino
+ NLS_id = 674;
+ break;
+ case "ST": // Sao Tome and Principe
+ NLS_id = 678;
+ break;
+ case "SA": // Saudi Arabia
+ NLS_id = 682;
+ break;
+ case "SN": // Senegal
+ NLS_id = 686;
+ break;
+ case "SC": // Seychelles
+ NLS_id = 690;
+ break;
+ case "SL": // Sierra Leone
+ NLS_id = 694;
+ break;
+ case "SG": // Singapore
+ NLS_id = 702;
+ break;
+ case "SK": // Slovakia (Slovak Republic)
+ NLS_id = 703;
+ break;
+ case "SI": // Slovenia
+ NLS_id = 705;
+ break;
+ case "SB": // Solomon Islands
+ NLS_id = 090;
+ break;
+ case "SO": // Somalia
+ NLS_id = 706;
+ break;
+ case "ZA": // South Africa
+ NLS_id = 710;
+ break;
+ case "GS": // South Georgia and The South Sandwich Islands
+ NLS_id = 239;
+ break;
+ case "ES": // Spain
+ NLS_id = 724;
+ break;
+ case "LK": // Sri Lanka
+ NLS_id = 144;
+ break;
+ case "SH": // St. Helena
+ NLS_id = 654;
+ break;
+ case "PM": // St. Pierre and Miquelon
+ NLS_id = 666;
+ break;
+ case "SD": // Sudan
+ NLS_id = 736;
+ break;
+ case "SR": // Suriname
+ NLS_id = 740;
+ break;
+ case "SJ": // Svalbard and Jan Mayen Islands
+ NLS_id = 744;
+ break;
+ case "SZ": // Swaziland
+ NLS_id = 748;
+ break;
+ case "SE": // Sweden
+ NLS_id = 752;
+ break;
+ case "CH": // Switzerland
+ NLS_id = 756;
+ break;
+ case "SY": // Syrian Arab Republic
+ NLS_id = 760;
+ break;
+ case "TW": // Taiwan, Province of China
+ NLS_id = 158;
+ break;
+ case "TJ": // Tajikistan
+ NLS_id = 762;
+ break;
+ case "TZ": // Tanzania, United Republic of
+ NLS_id = 834;
+ break;
+ case "TH": // Thailand
+ NLS_id = 764;
+ break;
+ case "TG": // Togo
+ NLS_id = 768;
+ break;
+ case "TK": // Tokelau
+ NLS_id = 772;
+ break;
+ case "TO": // Tonga
+ NLS_id = 776;
+ break;
+ case "TT": // Trinidad and Tobago
+ NLS_id = 780;
+ break;
+ case "TN": // Tunisia
+ NLS_id = 788;
+ break;
+ case "TR": // Turkey
+ NLS_id = 792;
+ break;
+ case "TM": // Turkmenistan
+ NLS_id = 795;
+ break;
+ case "TC": // Turks and Caicos Islands
+ NLS_id = 796;
+ break;
+ case "TV": // Tuvalu
+ NLS_id = 798;
+ break;
+ case "UG": // Uganda
+ NLS_id = 800;
+ break;
+ case "UA": // Ukraine
+ NLS_id = 804;
+ break;
+ case "AE": // United Arab Emirates
+ NLS_id = 784;
+ break;
+ case "GB": // United Kingdom
+ NLS_id = 826;
+ break;
+ case "US": // United States
+ NLS_id = 840;
+ break;
+ case "UM": // United States Minor Outlying Islands
+ NLS_id = 581;
+ break;
+ case "UY": // Uruguay
+ NLS_id = 858;
+ break;
+ case "UZ": // Uzbekistan
+ NLS_id = 860;
+ break;
+ case "VU": // Vanuatu
+ NLS_id = 548;
+ break;
+ case "VE": // Venezuela
+ NLS_id = 862;
+ break;
+ case "VN": // Viet Nam
+ NLS_id = 704;
+ break;
+ case "VG": // Virgin Islands (British)
+ NLS_id = 092;
+ break;
+ case "VI": // Virgin Islands (U.S.)
+ NLS_id = 850;
+ break;
+ case "WF": // Wallis and Futuna Islands
+ NLS_id = 876;
+ break;
+ case "EH": // Western Sahara
+ NLS_id = 732;
+ break;
+ case "YE": // Yemen
+ NLS_id = 887;
+ break;
+ case "YU": // Yugoslavia
+ NLS_id = 891;
+ break;
+ case "ZR": // Zaire
+ NLS_id = 180;
+ break;
+ case "ZM": // Zambia
+ NLS_id = 894;
+ break;
+ case "ZW": // Zimbabwe
+ NLS_id = 716;
+ break;
+ default:
+ throw new ArgumentException ("Region name " + name + " is not supported.");
+ }
+ }
+
+ public virtual string CurrencySymbol {
+ get {
+ switch (NLS_id) {
+ default:
+ throw new Exception ("Dunno what is currency symbol for " + NLS_id + " Region. FIXME.");
+ }
+ }
+ }
+
+ [MonoTODO]
+ public static RegionInfo CurrentRegion {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string DisplayName {
+ get {
+ switch (NLS_id) {
+ case 203: // Czech republic
+ return "Èeská republika";
+ case 840: // United States
+ return "United States";
+ default:
+ throw new Exception ("FIXME. Please add your region name in language used in this region.");
+ }
+ }
+ }
+
+ public virtual string EnglishName {
+ get {
+ switch (NLS_id) {
+ case 004:
+ return "Afghanistan";
+ case 008:
+ return "Albania";
+ case 012:
+ return "Algeria";
+ case 016:
+ return "American Samoa";
+ case 020:
+ return "Andorra";
+ case 024:
+ return "Angola";
+ case 660:
+ return "Anguilla";
+ case 010:
+ return "Antarctica";
+ case 028:
+ return "Antigua and Barbuda";
+ case 032:
+ return "Argentina";
+ case 051:
+ return "Armenia";
+ case 533:
+ return "Aruba";
+ case 036:
+ return "Australia";
+ case 040:
+ return "Austria";
+ case 031:
+ return "Azerbaijan";
+ case 044:
+ return "Bahamas";
+ case 048:
+ return "Bahrain";
+ case 050:
+ return "Bangladesh";
+ case 052:
+ return "Barbados";
+ case 112:
+ return "Belarus";
+ case 056:
+ return "Belgium";
+ case 084:
+ return "Belize";
+ case 204:
+ return "Benin";
+ case 060:
+ return "Bermuda";
+ case 064:
+ return "Bhutan";
+ case 068:
+ return "Bolivia";
+ case 070:
+ return "Bosnia and Herzegowina";
+ case 072:
+ return "Botswana";
+ case 074:
+ return "Bouvet Island";
+ case 076:
+ return "Brazil";
+ case 086:
+ return "British Indian Ocean Territory";
+ case 096:
+ return "Brunei Darussalam";
+ case 100:
+ return "Bulgaria";
+ case 854:
+ return "Burkina Faso";
+ case 108:
+ return "Burundi";
+ case 116:
+ return "Cambodia";
+ case 120:
+ return "Cameroon";
+ case 124:
+ return "Canada";
+ case 132:
+ return "Cape Verde";
+ case 136:
+ return "Cayman Islands";
+ case 140:
+ return "Central African Republic";
+ case 148:
+ return "Chad";
+ case 152:
+ return "Chile";
+ case 156:
+ return "China";
+ case 162:
+ return "Christmas Island";
+ case 166:
+ return "Cocos (Keeling) Islands";
+ case 170:
+ return "Colombia";
+ case 174:
+ return "Comoros";
+ case 178:
+ return "Congo";
+ case 184:
+ return "Cook Islands";
+ case 188:
+ return "Costa Rica";
+ case 384:
+ return "Cote D'Ivoire";
+ case 191:
+ return "Croatia (Local Name: Hrvatska)";
+ case 192:
+ return "Cuba";
+ case 196:
+ return "Cyprus";
+ case 203:
+ return "Czech Republic";
+ case 208:
+ return "Denmark";
+ case 262:
+ return "Djibouti";
+ case 212:
+ return "Dominica";
+ case 214:
+ return "Dominican Republic";
+ case 626:
+ return "East Timor";
+ case 218:
+ return "Ecuador";
+ case 818:
+ return "Egypt";
+ case 222:
+ return "El Salvador";
+ case 226:
+ return "Equatorial Guinea";
+ case 232:
+ return "Eritrea";
+ case 233:
+ return "Estonia";
+ case 231:
+ return "Ethiopia";
+ case 238:
+ return "Falkland Islands (Malvinas)";
+ case 234:
+ return "Faroe Islands";
+ case 242:
+ return "Fiji";
+ case 246:
+ return "Finland";
+ case 250:
+ return "France";
+ case 249:
+ return "France, Metropolitan";
+ case 254:
+ return "French Guiana";
+ case 258:
+ return "French Polynesia";
+ case 260:
+ return "French Southern Territories";
+ case 266:
+ return "Gabon";
+ case 270:
+ return "Gambia";
+ case 268:
+ return "Georgia";
+ case 276:
+ return "Germany";
+ case 288:
+ return "Ghana";
+ case 292:
+ return "Gibraltar";
+ case 300:
+ return "Greece";
+ case 304:
+ return "Greenland";
+ case 308:
+ return "Grenada";
+ case 312:
+ return "Guadeloupe";
+ case 316:
+ return "Guam";
+ case 320:
+ return "Guatemala";
+ case 324:
+ return "Guinea";
+ case 624:
+ return "Guinea-Bissau";
+ case 328:
+ return "Guyana";
+ case 332:
+ return "Haiti";
+ case 334:
+ return "Heard and Mc Donald Islands";
+ case 336:
+ return "Holy See (Vatican City State)";
+ case 340:
+ return "Honduras";
+ case 344:
+ return "Hong Kong";
+ case 348:
+ return "Hungary";
+ case 352:
+ return "Iceland";
+ case 356:
+ return "India";
+ case 360:
+ return "Indonesia";
+ case 364:
+ return "Iran (Islamic Republic of)";
+ case 368:
+ return "Iraq";
+ case 372:
+ return "Ireland";
+ case 376:
+ return "Israel";
+ case 380:
+ return "Italy";
+ case 388:
+ return "Jamaica";
+ case 392:
+ return "Japan";
+ case 400:
+ return "Jordan";
+ case 398:
+ return "Kazakhstan";
+ case 404:
+ return "Kenya";
+ case 296:
+ return "Kiribati";
+ case 408:
+ return "Korea, Democratic People's Republic of";
+ case 410:
+ return "Korea, Republic of";
+ case 414:
+ return "Kuwait";
+ case 417:
+ return "Kyrgyzstan";
+ case 418:
+ return "Lao People's Democratic Republic";
+ case 428:
+ return "Latvia";
+ case 422:
+ return "Lebanon";
+ case 426:
+ return "Lesotho";
+ case 430:
+ return "Liberia";
+ case 434:
+ return "Libyan Arab Jamahiriya";
+ case 438:
+ return "Liechtenstein";
+ case 440:
+ return "Lithuania";
+ case 442:
+ return "Luxembourg";
+ case 446:
+ return "Macau";
+ case 807:
+ return "Macedonia, The Former Yugoslav Republic of";
+ case 450:
+ return "Madagascar";
+ case 454:
+ return "Malawi";
+ case 458:
+ return "Malaysia";
+ case 462:
+ return "Maldives";
+ case 466:
+ return "Mali";
+ case 470:
+ return "Malta";
+ case 584:
+ return "Marshall Islands";
+ case 474:
+ return "Martinique";
+ case 478:
+ return "Mauritania";
+ case 480:
+ return "Mauritius";
+ case 175:
+ return "Mayotte";
+ case 484:
+ return "Mexico";
+ case 583:
+ return "Micronesia, Federated States of";
+ case 498:
+ return "Moldova, Republic of";
+ case 492:
+ return "Monaco";
+ case 496:
+ return "Mongolia";
+ case 500:
+ return "Montserrat";
+ case 504:
+ return "Morocco";
+ case 508:
+ return "Mozambique";
+ case 104:
+ return "Myanmar";
+ case 516:
+ return "Namibia";
+ case 520:
+ return "Nauru";
+ case 524:
+ return "Nepal";
+ case 528:
+ return "Netherlands";
+ case 530:
+ return "Netherlands Antilles";
+ case 540:
+ return "New Caledonia";
+ case 554:
+ return "New Zealand";
+ case 558:
+ return "Nicaragua";
+ case 562:
+ return "Niger";
+ case 566:
+ return "Nigeria";
+ case 570:
+ return "Niue";
+ case 574:
+ return "Norfolk Island";
+ case 580:
+ return "Northern Mariana Islands";
+ case 578:
+ return "Norway";
+ case 512:
+ return "Oman";
+ case 586:
+ return "Pakistan";
+ case 585:
+ return "Palau";
+ case 591:
+ return "Panama";
+ case 598:
+ return "Papua New Guinea";
+ case 600:
+ return "Paraguay";
+ case 604:
+ return "Peru";
+ case 608:
+ return "Philippines";
+ case 612:
+ return "Pitcairn";
+ case 616:
+ return "Poland";
+ case 620:
+ return "Portugal";
+ case 630:
+ return "Puerto Rico";
+ case 634:
+ return "Qatar";
+ case 638:
+ return "Reunion";
+ case 642:
+ return "Romania";
+ case 643:
+ return "Russian Federation";
+ case 646:
+ return "Rwanda";
+ case 659:
+ return "Saint Kitts and Nevis";
+ case 662:
+ return "Saint Lucia";
+ case 670:
+ return "Saint Vincent and The Grenadines";
+ case 882:
+ return "Samoa";
+ case 674:
+ return "San Marino";
+ case 678:
+ return "Sao Tome and Principe";
+ case 682:
+ return "Saudi Arabia";
+ case 686:
+ return "Senegal";
+ case 690:
+ return "Seychelles";
+ case 694:
+ return "Sierra Leone";
+ case 702:
+ return "Singapore";
+ case 703:
+ return "Slovakia (Slovak Republic)";
+ case 705:
+ return "Slovenia";
+ case 090:
+ return "Solomon Islands";
+ case 706:
+ return "Somalia";
+ case 710:
+ return "South Africa";
+ case 239:
+ return "South Georgia and The South Sandwich Islands";
+ case 724:
+ return "Spain";
+ case 144:
+ return "Sri Lanka";
+ case 654:
+ return "St. Helena";
+ case 666:
+ return "St. Pierre and Miquelon";
+ case 736:
+ return "Sudan";
+ case 740:
+ return "Suriname";
+ case 744:
+ return "Svalbard and Jan Mayen Islands";
+ case 748:
+ return "Swaziland";
+ case 752:
+ return "Sweden";
+ case 756:
+ return "Switzerland";
+ case 760:
+ return "Syrian Arab Republic";
+ case 158:
+ return "Taiwan, Province of China";
+ case 762:
+ return "Tajikistan";
+ case 834:
+ return "Tanzania, United Republic of";
+ case 764:
+ return "Thailand";
+ case 768:
+ return "Togo";
+ case 772:
+ return "Tokelau";
+ case 776:
+ return "Tonga";
+ case 780:
+ return "Trinidad and Tobago";
+ case 788:
+ return "Tunisia";
+ case 792:
+ return "Turkey";
+ case 795:
+ return "Turkmenistan";
+ case 796:
+ return "Turks and Caicos Islands";
+ case 798:
+ return "Tuvalu";
+ case 800:
+ return "Uganda";
+ case 804:
+ return "Ukraine";
+ case 784:
+ return "United Arab Emirates";
+ case 826:
+ return "United Kingdom";
+ case 840:
+ return "United States";
+ case 581:
+ return "United States Minor Outlying Islands";
+ case 858:
+ return "Uruguay";
+ case 860:
+ return "Uzbekistan";
+ case 548:
+ return "Vanuatu";
+ case 862:
+ return "Venezuela";
+ case 704:
+ return "Viet Nam";
+ case 092:
+ return "Virgin Islands (British)";
+ case 850:
+ return "Virgin Islands (U.S.)";
+ case 876:
+ return "Wallis and Futuna Islands";
+ case 732:
+ return "Western Sahara";
+ case 887:
+ return "Yemen";
+ case 891:
+ return "Yugoslavia";
+ case 180:
+ return "Zaire";
+ case 894:
+ return "Zambia";
+ case 716:
+ return "Zimbabwe";
+ default:
+ throw new Exception ("This code should not be reached.");
+ }
+ }
+ }
+
+ public virtual bool IsMetric {
+ get {
+ switch (NLS_id) {
+ case 203: // Czech Republic
+ return true;
+ case 840: // United States
+ return false;
+ default:
+ throw new Exception ("FIXME. Please define.");
+ }
+ }
+ }
+
+ public virtual string ISOCurrencySymbol {
+ get {
+ switch (NLS_id) {
+ default:
+ throw new Exception ("This code should not be reached.");
+ }
+ }
+ }
+
+ [MonoTODO]
+ public virtual string Name
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string ThreeLetterISORegionName
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string ThreeLetterWindowsRegionName
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string TwoLetterISORegionName
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ //
+ // methods
+
+ public override bool Equals(object value) {
+ return value == this;
+ }
+
+ public override int GetHashCode () {
+ return NLS_id.GetHashCode ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Globalization/SortKey.cs b/mcs/class/corlib/System.Globalization/SortKey.cs
new file mode 100755
index 00000000000..fbfc6c1fe44
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/SortKey.cs
@@ -0,0 +1,57 @@
+//
+// System.Globalization.SortKey.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.Globalization {
+
+ [Serializable]
+ public class SortKey {
+ /* Hide the .ctor() */
+ SortKey() {}
+
+ [MonoTODO]
+ public virtual byte[] KeyData
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string OriginalString
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static int Compare(SortKey sortkey1, SortKey sortkey2)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object value)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/StringInfo.cs b/mcs/class/corlib/System.Globalization/StringInfo.cs
new file mode 100755
index 00000000000..0517db29248
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/StringInfo.cs
@@ -0,0 +1,65 @@
+//
+// System.Globalization.StringInfo.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.Globalization {
+
+ [Serializable]
+ public class StringInfo {
+ [MonoTODO]
+ public StringInfo()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static string GetNextTextElement(string str)
+ {
+ if(str == null) {
+ throw new ArgumentNullException("string is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static string GetNextTextElement(string str, int index)
+ {
+ if(str == null) {
+ throw new ArgumentNullException("string is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static TextElementEnumerator GetTextElementEnumerator(string str)
+ {
+ if(str == null) {
+ throw new ArgumentNullException("string is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static TextElementEnumerator GetTextElementEnumerator(string str, int index)
+ {
+ if(str == null) {
+ throw new ArgumentNullException("string is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static int[] ParseCombiningCharacters(string str)
+ {
+ if(str == null) {
+ throw new ArgumentNullException("string is null");
+ }
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs b/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs
new file mode 100644
index 00000000000..e9e6f663310
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs
@@ -0,0 +1,756 @@
+// TaiwanCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Japanese calendar. It differs from the Gregorian calendar
+/// only in the years.
+/// </summary>
+/// <remarks>
+/// <para>The Japanese calendar support a single era starting at January 1,
+/// 1912</para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class TaiwanCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static TaiwanCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(1,
+ CCGregorianCalendar.fixed_from_dmy(1, 1, 1912));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public TaiwanCalendar() {
+ M_AbbrEraNames = new string[] {"T.C.E."};
+ M_EraNames = new string[] {"Taiwan current era"};
+ }
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ M_EraHandler.CheckDateTime(time);
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = 1;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ DateTime t = CCGregorianCalendar.AddMonths(time, months);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ DateTime t = CCGregorianCalendar.AddYears(time, years);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ // M_CheckDateTime not needed, because EraYear does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYEG(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ // M_CheckDateTime not needed, because EraYeat does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ gregorianYear, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+ /// <summary>
+ /// This functions returns simply the year for the Taiwan calendar.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <returns>The same argument as the year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year is negative or the resulting
+ /// year is invalid.
+ /// </exception>
+ public override int ToFourDigitYear(int year) {
+ if (year < 0)
+ throw new ArgumentOutOfRangeException(
+ "year", "Non-negative number required.");
+ int era = CurrentEra;
+ M_CheckYE(year, ref era);
+ return year;
+ }
+} // class TaiwanCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/TextElementEnumerator.cs b/mcs/class/corlib/System.Globalization/TextElementEnumerator.cs
new file mode 100755
index 00000000000..a7f2fbecd9a
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/TextElementEnumerator.cs
@@ -0,0 +1,53 @@
+//
+// System.Globalization.TextElementEnumerator.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Globalization {
+
+ [Serializable]
+ public class TextElementEnumerator: IEnumerator {
+ /* Hide the .ctor() */
+ TextElementEnumerator() {}
+
+ [MonoTODO]
+ public object Current
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public int ElementIndex
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public string GetTextElement()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public bool MoveNext()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public void Reset()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/TextInfo.cs b/mcs/class/corlib/System.Globalization/TextInfo.cs
new file mode 100755
index 00000000000..dd4de5560de
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/TextInfo.cs
@@ -0,0 +1,140 @@
+//
+// System.Globalization.TextInfo.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Globalization {
+
+ [Serializable]
+ public class TextInfo: IDeserializationCallback
+ {
+ public TextInfo ()
+ {
+ }
+
+ [MonoTODO]
+ public virtual int ANSICodePage
+ {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public virtual int EBCDICCodePage
+ {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public virtual string ListSeparator
+ {
+ get {
+ return(",");
+ }
+ }
+
+ [MonoTODO]
+ public virtual int MacCodePage
+ {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public virtual int OEMCodePage
+ {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public override bool Equals(object obj)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public virtual char ToLower(char c)
+ {
+ return Char.ToLower (c);
+ }
+
+ [MonoTODO]
+ public virtual string ToLower(string str)
+ {
+ if(str==null) {
+ throw new ArgumentNullException("string is null");
+ }
+
+ Text.StringBuilder s = new Text.StringBuilder ();
+
+ foreach (char c in str) {
+ s.Append (Char.ToLower (c));
+ }
+
+ return s.ToString ();
+ }
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ return("TextInfo");
+ }
+
+ public string ToTitleCase (string str)
+ {
+ if(str == null)
+ throw new ArgumentNullException("string is null");
+
+ Text.StringBuilder s = new Text.StringBuilder ();
+
+ s.Append (Char.ToUpper (str [0]));
+
+ for (int i = 1; i < str.Length; i ++)
+ s.Append (str [i]);
+
+ return s.ToString ();
+ }
+
+ [MonoTODO]
+ public virtual char ToUpper(char c)
+ {
+ return('X');
+ }
+
+ [MonoTODO]
+ public virtual string ToUpper(string str)
+ {
+ if(str==null) {
+ throw new ArgumentNullException("string is null");
+ }
+
+ return("");
+ }
+
+ /* IDeserialization interface */
+ [MonoTODO]
+ void IDeserializationCallback.OnDeserialization(object sender)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs b/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs
new file mode 100644
index 00000000000..34725903f82
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs
@@ -0,0 +1,463 @@
+// ThaiBuddhistCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the ThaiBudhist calendar. It differs from the Gegorian calendar
+/// only in the year counting.
+/// </summary>
+/// <remarks>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class ThaiBuddhistCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <value>
+ /// The standard era for this calendar.
+ /// </value>
+ public const int ThaiBuddhistEra = 1;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static ThaiBuddhistCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(ThaiBuddhistEra,
+ CCGregorianCalendar.fixed_from_dmy(1, 1, -542));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ThaiBuddhistCalendar() {
+ M_AbbrEraNames = new string[] {"T.B.C.E."};
+ M_EraNames = new string[] {"ThaiBuddhist current era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 2572;
+ }
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ [MonoTODO]
+ public override int TwoDigitYearMax
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = ThaiBuddhistEra;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ return CCGregorianCalendar.AddMonths(time, months);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ return CCGregorianCalendar.AddYears(time, years);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ gregorianYear, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+ [MonoTODO]
+ public override int ToFourDigitYear(int year)
+ {
+ throw new NotImplementedException();
+ }
+
+} // class ThaiBuddhistCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/UnicodeCategory.cs b/mcs/class/corlib/System.Globalization/UnicodeCategory.cs
new file mode 100644
index 00000000000..2db258b3743
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/UnicodeCategory.cs
@@ -0,0 +1,44 @@
+//
+// System.Globalization.UnicodeCategory.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Globalization {
+
+ public enum UnicodeCategory {
+ UppercaseLetter = 0,
+ LowercaseLetter = 1,
+ TitlecaseLetter = 2,
+ ModifierLetter = 3,
+ OtherLetter = 4,
+ NonSpacingMark = 5,
+ SpacingCombiningMark = 6,
+ EnclosingMark = 7,
+ DecimalDigitNumber = 8,
+ LetterNumber = 9,
+ OtherNumber = 10,
+ SpaceSeparator = 11,
+ LineSeparator = 12,
+ ParagraphSeparator = 13,
+ Control = 14,
+ Format = 15,
+ Surrogate = 16,
+ PrivateUse = 17,
+ ConnectorPunctuation = 18,
+ DashPunctuation = 19,
+ OpenPunctuation = 20,
+ ClosePunctuation = 21,
+ InitialQuotePunctuation = 22,
+ FinalQuotePunctuation = 23,
+ OtherPunctuation = 24,
+ MathSymbol = 25,
+ CurrencySymbol = 26,
+ ModifierSymbol = 27,
+ OtherSymbol = 28,
+ OtherNotAssigned = 29,
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog b/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog
new file mode 100644
index 00000000000..dd138407daa
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog
@@ -0,0 +1,46 @@
+2003-01-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * IsolatedStorageFile.cs: Added missing [CLSCompliant(false)]
+ to CurrentSize and MaximumSize to fix compilation (at least
+ under Windows/csc).
+
+2003-01-18 Jonathan Pryor <jonpryor@vt.edu>
+
+ - General: Get a simple implementation working. Simple, not-all-there, but
+ sufficient to get "Programming C#" example 21-17 working under Mono. This
+ doesn't say much, as it's not a stress-test by any means.
+ * INormalizeForIsolatedStorage.cs: re-indent to fit mono code style
+ * IsolatedStorage.cs: match mono coding guidelines
+ * IsolatedStorageFileStream.cs: Add members that "C# In A Nutshell" claims
+ the class should override. Most of these members just delegate to the
+ base class, though. CreateIsolatedPath is used to get the actual filename
+ for the IsolatedStorageFileStream.
+ * IsolatedStorageScope.cs: Documentation goes in monodoc, so there's no
+ point in having C# doc-tags. Add "Roaming" member, which "C# In A
+ Nutshell" lists.
+ * IsolatedStorageFile.cs: Public class documented in "C# In A Nutshell".
+ Simple implementation. Will probably need work to conform with .NET,
+ address security concerns.
+ * IsolatedStorageInfo.cs: Abstract IsolatedStorage information used by other
+ classes, such as the directory isolated storage is located under, how to
+ calculate the size of isolated storage, etc.
+
+2002-02-19 Duncan Mak <duncan@ximian.com>
+
+ * IsolatedStorageFileStream.cs: Added MonoTODO here. This class
+ is completely stubbed out (over the summer) and didn't get
+ properly MonoTODO'd.
+
+2002-02-08 Duncan Mak <duncan@ximian.com>
+
+ * IsolatedStorage.cs: Looked at MemberInfo.cs, another fellow
+ abstract class. Oh, that's what it means! Removed unnesscessary
+ MonoTODO attributes.
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * IsolatedStorage.cs: Added to CVS, stubbed out the API.
+ * IsolatedStorageException.cs: Implemented.
+
+2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created INormalizeForIsolatedStorage
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs b/mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs
new file mode 100644
index 00000000000..ccc0c361c11
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs
@@ -0,0 +1,18 @@
+//
+// System.IO.IsolatedStorage.INormalizeForIsolatedStorage
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.IO.IsolatedStorage {
+
+ public interface INormalizeForIsolatedStorage {
+
+ object Normalize ();
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs
new file mode 100644
index 00000000000..f163efff277
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs
@@ -0,0 +1,71 @@
+//
+// System.IO.IsolatedStorage.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.IO.IsolatedStorage
+{
+ public abstract class IsolatedStorage : MarshalByRefObject
+ {
+ // Constructor
+ protected IsolatedStorage ()
+ : base ()
+ {
+ }
+
+ // Properties
+ [MonoTODO]
+ public object AssemblyIdentity {
+ get {return null;}
+ }
+
+ [CLSCompliant (false)]
+ [MonoTODO]
+ public virtual ulong CurrentSize {
+ get {return 0;}
+ }
+
+ [MonoTODO]
+ public object DomainIdentity {
+ get {return null;}
+ }
+
+ [CLSCompliant (false)]
+ [MonoTODO]
+ public virtual ulong MaximumSize {
+ get {return 0;}
+ }
+
+ [MonoTODO]
+ public IsolatedStorageScope Scope {
+ get {return 0;}
+ }
+
+ [MonoTODO]
+ protected virtual char SeparatorExternal {
+ get {return Char.MinValue;}
+ }
+
+ [MonoTODO]
+ protected virtual char SeparatorInternal {
+ get {return Char.MinValue;}
+ }
+
+ // Methods
+ protected abstract IsolatedStoragePermission GetPermission (PermissionSet ps);
+
+ [MonoTODO]
+ protected void InitStore (IsolatedStorageScope scope, Type domainEvidenceType,
+ Type assemblyEvidenceType)
+ {
+ }
+
+ public abstract void Remove ();
+ }
+}
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs
new file mode 100644
index 00000000000..51268d65550
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs
@@ -0,0 +1,37 @@
+//
+// System.IO.IsolatedStorage.IsolatedstorageException
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002, Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.IO.IsolatedStorage
+{
+ [Serializable]
+ public class IsolatedStorageException : Exception
+ {
+ public IsolatedStorageException ()
+ : base (Locale.GetText ("An Isolated storage operation failed."))
+ {
+ }
+
+ public IsolatedStorageException (string message)
+ : base (message)
+ {
+ }
+
+ public IsolatedStorageException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected IsolatedStorageException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs
new file mode 100644
index 00000000000..8edf602a28c
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs
@@ -0,0 +1,173 @@
+// System.IO.IsolatedStorage.IsolatedStorageFile
+//
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2003 Jonathan Pryor
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.IO.IsolatedStorage
+{
+ // This is a terribly named class. It doesn't actually represent a file as
+ // much as a directory
+ [MonoTODO]
+ public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable
+ {
+ private DirectoryInfo directory;
+
+ private IsolatedStorageFile (string directory)
+ {
+ this.directory = new DirectoryInfo (directory);
+ this.directory.Create ();
+ }
+
+ [CLSCompliant(false)]
+ public override ulong CurrentSize {
+ get {return IsolatedStorageInfo.GetDirectorySize(directory);}
+ }
+
+ [CLSCompliant(false)]
+ [MonoTODO("The IsolatedStorage area should be limited, to prevent DOS attacks. What's a reasonable size?")]
+ public override ulong MaximumSize {
+ get {return ulong.MaxValue;}
+ }
+
+ [MonoTODO ("Pay attention to scope")]
+ public static IEnumerator GetEnumerator (IsolatedStorageScope scope)
+ {
+ Array a = Directory.GetFileSystemEntries (IsolatedStorageInfo.GetIsolatedStorageDirectory());
+ return a.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public static IsolatedStorageFile GetStore (
+ IsolatedStorageScope scope,
+ System.Security.Policy.Evidence domainEvidence,
+ Type domainEvidenceType,
+ System.Security.Policy.Evidence assemblyEvidence,
+ Type assemblyEvidenceType)
+ {
+ return GetStore (scope);
+ }
+
+ [MonoTODO]
+ public static IsolatedStorageFile GetStore (
+ IsolatedStorageScope scope,
+ object domainIdentity,
+ object assemblyIdentity)
+ {
+ return GetStore (scope);
+ }
+
+ [MonoTODO]
+ public static IsolatedStorageFile GetStore (
+ IsolatedStorageScope scope,
+ Type domainEvidenceType,
+ Type assemblyEvidenceType)
+ {
+ return GetStore (scope);
+ }
+
+ private static IsolatedStorageFile GetStore (IsolatedStorageScope scope)
+ {
+ string dir = GetScopeDirectory (scope);
+ return new IsolatedStorageFile (dir);
+ }
+
+ private static string GetScopeDirectory (IsolatedStorageScope scope)
+ {
+ string dir = "";
+
+ if ((scope & IsolatedStorageScope.Domain) != 0)
+ dir = IsolatedStorageInfo.CreateDomainFilename (
+ Assembly.GetEntryAssembly (),
+ AppDomain.CurrentDomain);
+ else
+ dir = IsolatedStorageInfo.CreateAssemblyFilename (
+ Assembly.GetEntryAssembly ());
+
+ return dir;
+ }
+
+ public static IsolatedStorageFile GetUserStoreForAssembly ()
+ {
+ return GetStore (IsolatedStorageScope.Assembly);
+ }
+
+ public static IsolatedStorageFile GetUseStoreForDomain ()
+ {
+ return GetStore (IsolatedStorageScope.Domain);
+ }
+
+ public static void Remove (IsolatedStorageScope scope)
+ {
+ string dir = GetScopeDirectory (scope);
+ Directory.Delete (dir, true);
+ }
+
+ public void Close ()
+ {
+ }
+
+ public void CreateDirectory (string dir)
+ {
+ directory.CreateSubdirectory (dir);
+ }
+
+ public void DeleteDirectory (string dir)
+ {
+ DirectoryInfo subdir = directory.CreateSubdirectory (dir);
+ subdir.Delete ();
+ }
+
+ public void DeleteFile (string file)
+ {
+ File.Delete (directory.Name + "/" + file);
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ public string[] GetDirectoryNames (string searchPattern)
+ {
+ DirectoryInfo[] adi = directory.GetDirectories (searchPattern);
+ return GetNames (adi);
+ }
+
+ private string[] GetNames (FileSystemInfo[] afsi)
+ {
+ string[] r = new string[afsi.Length];
+ for (int i = 0; i != afsi.Length; ++i)
+ r[i] = afsi[i].Name;
+ return r;
+ }
+
+ public string[] GetFileNames (string searchPattern)
+ {
+ FileInfo[] afi = directory.GetFiles (searchPattern);
+ return GetNames (afi);
+ }
+
+ public override void Remove ()
+ {
+ directory.Delete (true);
+ }
+
+ ~IsolatedStorageFile ()
+ {
+ }
+
+ [MonoTODO]
+ protected override IsolatedStoragePermission GetPermission (PermissionSet ps)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
new file mode 100644
index 00000000000..090deb38ca8
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
@@ -0,0 +1,165 @@
+// System.IO.IsolatedStorage.IsolatedStorageFileStream
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace System.IO.IsolatedStorage {
+
+ [MonoTODO]
+ public class IsolatedStorageFileStream : FileStream
+ {
+ private static string CreateIsolatedPath (string path)
+ {
+ string dir = IsolatedStorageInfo.CreateAssemblyFilename (Assembly.GetEntryAssembly());
+
+ string file = dir + "/" + path;
+
+ // Ensure that the file can be created.
+ FileInfo fi = new FileInfo (file);
+ if (!fi.Directory.Exists)
+ fi.Directory.Create ();
+
+ return file;
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode)
+ : base(CreateIsolatedPath (path), mode)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access)
+ : base (CreateIsolatedPath (path), mode, access)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share)
+ : base (CreateIsolatedPath (path), mode, access, share)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)
+ : base (CreateIsolatedPath (path), mode, access, share, bufferSize)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, IsolatedStorageFile isf)
+ : base (CreateIsolatedPath (path), mode, access, share, bufferSize)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
+ : base (CreateIsolatedPath (path), mode, access, share)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, IsolatedStorageFile isf)
+ : base (CreateIsolatedPath (path), mode, access)
+ {
+ }
+
+ public IsolatedStorageFileStream (string path, FileMode mode, IsolatedStorageFile isf)
+ : base (CreateIsolatedPath (path), mode)
+ {
+ }
+
+ public override bool CanRead {
+ get {return base.CanRead;}
+ }
+
+ public override bool CanSeek {
+ get {return base.CanSeek;}
+ }
+
+ public override bool CanWrite {
+ get {return base.CanWrite;}
+ }
+
+ public override IntPtr Handle {
+ get {return base.Handle;}
+ }
+
+ public override bool IsAsync {
+ get {return base.IsAsync;}
+ }
+
+ public override long Length {
+ get {return base.Length;}
+ }
+
+ public override long Position {
+ get {return base.Position;}
+ set {base.Position = value;}
+ }
+
+ public override IAsyncResult BeginRead (byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
+ {
+ return base.BeginRead (buffer, offset, numBytes, userCallback, stateObject);
+ }
+
+ public override IAsyncResult BeginWrite (byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
+ {
+ return base.BeginWrite (buffer, offset, numBytes, userCallback, stateObject);
+ }
+
+ public override void Close ()
+ {
+ base.Close ();
+ }
+
+ public override int EndRead (IAsyncResult asyncResult)
+ {
+ return base.EndRead (asyncResult);
+ }
+
+ public override void EndWrite (IAsyncResult asyncResult)
+ {
+ base.EndWrite (asyncResult);
+ }
+
+ public override void Flush ()
+ {
+ base.Flush ();
+ }
+
+ public override int Read (byte[] buffer, int offset, int count)
+ {
+ return base.Read (buffer, offset, count);
+ }
+
+ public override int ReadByte ()
+ {
+ return base.ReadByte ();
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ return base.Seek (offset, origin);
+ }
+
+ public override void SetLength (long value)
+ {
+ base.SetLength (value);
+ }
+
+ public override void Write (byte[] buffer, int offset, int count)
+ {
+ base.Write (buffer, offset, count);
+ }
+
+ public override void WriteByte (byte value)
+ {
+ base.WriteByte (value);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs
new file mode 100644
index 00000000000..b16f52142ff
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageInfo.cs
@@ -0,0 +1,51 @@
+// System.IO.IsolatedStorage.IsolatedStorageInfo.cs:
+//
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2003 Jonathan Pryor
+
+using System;
+using System.IO;
+
+namespace System.IO.IsolatedStorage {
+
+ internal sealed class IsolatedStorageInfo {
+
+ [MonoTODO("Unix Specific; generalize for Win32")]
+ public static string GetIsolatedStorageDirectory ()
+ {
+ string home = Environment.GetEnvironmentVariable ("HOME");
+
+ if (home == null)
+ home = "~";
+
+ return home + "/.mono/isolated-storage";
+ }
+
+ public static string CreateAssemblyFilename (object assembly)
+ {
+ return string.Format ("{0}/{1}", GetIsolatedStorageDirectory (),
+ assembly.ToString());
+ }
+
+ public static string CreateDomainFilename (object assembly, object domain)
+ {
+ return string.Format ("{0}/{1}/{2}", GetIsolatedStorageDirectory (),
+ assembly.ToString(), domain.ToString());
+ }
+
+ public static ulong GetDirectorySize (DirectoryInfo di)
+ {
+ ulong size = 0;
+
+ foreach (FileInfo fi in di.GetFiles ())
+ size += (ulong) fi.Length;
+
+ foreach (DirectoryInfo d in di.GetDirectories())
+ size += GetDirectorySize (d);
+
+ return size;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs
new file mode 100755
index 00000000000..28e18515a92
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs
@@ -0,0 +1,28 @@
+// IsolatedStorageScope.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:21 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO.IsolatedStorage {
+
+
+ [Flags]
+ public enum IsolatedStorageScope {
+
+ None = 0,
+ User = 1,
+ Domain = 2,
+ Assembly = 4,
+
+ // Documented in "C# In A Nutshell"
+ Roaming = 8
+ } // IsolatedStorageScope
+
+} // System.IO.IsolatedStorage
diff --git a/mcs/class/corlib/System.IO/BinaryReader.cs b/mcs/class/corlib/System.IO/BinaryReader.cs
new file mode 100644
index 00000000000..747f67817ac
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BinaryReader.cs
@@ -0,0 +1,388 @@
+//
+// System.IO.BinaryReader
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+// Dick Porter (dick@ximian.com)
+//
+
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace System.IO {
+ public class BinaryReader : IDisposable {
+ Stream m_stream;
+ Encoding m_encoding;
+ int m_encoding_max_byte;
+
+ byte[] m_buffer;
+
+ public BinaryReader(Stream input) : this(input, Encoding.UTF8Unmarked) {
+ }
+
+ public BinaryReader(Stream input, Encoding encoding) {
+ if (input == null || encoding == null)
+ throw new ArgumentNullException(Locale.GetText ("Input or Encoding is a null reference."));
+ if (!input.CanRead)
+ throw new ArgumentException(Locale.GetText ("The stream doesn't support reading."));
+
+ m_stream = input;
+ m_encoding = encoding;
+ m_encoding_max_byte = m_encoding.GetMaxByteCount(1);
+ m_buffer = new byte [32];
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return m_stream;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing && m_stream != null)
+ m_stream.Close ();
+
+ m_buffer = null;
+ m_encoding = null;
+ m_stream = null;
+ }
+
+ void IDisposable.Dispose()
+ {
+ Dispose (true);
+ }
+
+ protected virtual void FillBuffer(int bytes) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ CheckBuffer(bytes);
+
+ /* Cope with partial reads */
+ int pos=0;
+ while(pos<bytes) {
+ int n=m_stream.Read(m_buffer, pos, bytes-pos);
+ if(n==0) {
+ throw new EndOfStreamException();
+ }
+
+ pos+=n;
+ }
+ }
+
+ public virtual int PeekChar() {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if(!m_stream.CanSeek) {
+ return(-1);
+ }
+
+ long pos=m_stream.Position;
+ int ch=Read();
+ m_stream.Position=pos;
+
+ return(ch);
+ }
+
+ public virtual int Read() {
+ char[] decode = new char[1];
+
+ int count=Read(decode, 0, 1);
+ if(count==0) {
+ /* No chars available */
+ return(-1);
+ }
+
+ return decode[0];
+ }
+
+ public virtual int Read(byte[] buffer, int index, int count) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if (buffer == null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if (buffer.Length - index < count) {
+ throw new ArgumentException("buffer is too small");
+ }
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException("index is less than 0");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ int bytes_read=m_stream.Read(buffer, index, count);
+
+ return(bytes_read);
+ }
+
+ public virtual int Read(char[] buffer, int index, int count) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if (buffer == null) {
+ throw new ArgumentNullException("buffer is null");
+ }
+ if (buffer.Length - index < count) {
+ throw new ArgumentException("buffer is too small");
+ }
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException("index is less than 0");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ int chars_read=0;
+ int bytes_read=0;
+
+ while(chars_read < count) {
+ CheckBuffer(bytes_read);
+
+ int read_byte=m_stream.ReadByte();
+ if(read_byte==-1) {
+ /* EOF */
+ return(chars_read);
+ }
+
+ m_buffer[bytes_read]=(byte)read_byte;
+ bytes_read++;
+
+ chars_read=m_encoding.GetChars(m_buffer, 0,
+ bytes_read,
+ buffer, index);
+
+ }
+
+ return(chars_read);
+ }
+
+ protected int Read7BitEncodedInt() {
+ int ret = 0;
+ int shift = 0;
+ byte b;
+
+ do {
+ b = ReadByte();
+
+ ret = ret | ((b & 0x7f) << shift);
+ shift += 7;
+ } while ((b & 0x80) == 0x80);
+
+ return ret;
+ }
+
+ public virtual bool ReadBoolean() {
+ FillBuffer(1);
+
+ // Return value:
+ // true if the byte is non-zero; otherwise false.
+ return(m_buffer[0] != 0);
+ }
+
+ public virtual byte ReadByte() {
+ FillBuffer(1);
+
+ return(m_buffer[0]);
+ }
+
+ public virtual byte[] ReadBytes(int count) {
+ if(m_stream==null) {
+ throw new IOException("Stream is invalid");
+ }
+
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ /* Can't use FillBuffer() here, because it's OK to
+ * return fewer bytes than were requested
+ */
+
+ byte[] buf = new byte[count];
+ int pos=0;
+
+ while(pos < count) {
+ int n=m_stream.Read(buf, pos, count-pos);
+ if(n==0) {
+ /* EOF */
+ break;
+ }
+
+ pos+=n;
+ }
+
+ if (pos!=count) {
+ byte[] new_buffer=new byte[pos];
+ Array.Copy(buf, new_buffer, pos);
+ return(new_buffer);
+ }
+
+ return(buf);
+ }
+
+ public virtual char ReadChar() {
+ int ch=Read();
+
+ if(ch==-1) {
+ throw new EndOfStreamException();
+ }
+
+ return((char)ch);
+ }
+
+ public virtual char[] ReadChars(int count) {
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count is less than 0");
+ }
+
+ char[] full = new char[count];
+ int chars = Read(full, 0, count);
+
+ if (chars == 0) {
+ throw new EndOfStreamException();
+ } else if (chars != full.Length) {
+ char[] ret = new char[chars];
+ Array.Copy(full, 0, ret, 0, chars);
+ return ret;
+ } else {
+ return full;
+ }
+ }
+
+ unsafe public virtual decimal ReadDecimal() {
+ FillBuffer(16);
+
+ decimal ret;
+ byte* ret_ptr = (byte *)&ret;
+ for (int i = 0; i < 16; i++) {
+ ret_ptr[i] = m_buffer[i];
+ }
+
+ return ret;
+ }
+
+ public virtual double ReadDouble() {
+ FillBuffer(8);
+
+ return(BitConverter.ToDouble(m_buffer, 0));
+ }
+
+ public virtual short ReadInt16() {
+ FillBuffer(2);
+
+ return((short) (m_buffer[0] | (m_buffer[1] << 8)));
+ }
+
+ public virtual int ReadInt32() {
+ FillBuffer(4);
+
+ return(m_buffer[0] | (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) | (m_buffer[3] << 24));
+ }
+
+ public virtual long ReadInt64() {
+ FillBuffer(8);
+
+ uint ret_low = (uint) (m_buffer[0] |
+ (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) |
+ (m_buffer[3] << 24)
+ );
+ uint ret_high = (uint) (m_buffer[4] |
+ (m_buffer[5] << 8) |
+ (m_buffer[6] << 16) |
+ (m_buffer[7] << 24)
+ );
+ return (long) ((((ulong) ret_high) << 32) | ret_low);
+ }
+
+ [CLSCompliant(false)]
+ public virtual sbyte ReadSByte() {
+ FillBuffer(1);
+
+ return((sbyte)m_buffer[0]);
+ }
+
+ public virtual string ReadString() {
+ /* Inspection of BinaryWriter-written files
+ * shows that the length is given in bytes,
+ * not chars
+ */
+ int len = Read7BitEncodedInt();
+
+ FillBuffer(len);
+
+ char[] str = m_encoding.GetChars(m_buffer, 0, len);
+
+ return(new String(str));
+ }
+
+ public virtual float ReadSingle() {
+ FillBuffer(4);
+
+ return(BitConverter.ToSingle(m_buffer, 0));
+ }
+
+ [CLSCompliant(false)]
+ public virtual ushort ReadUInt16() {
+ FillBuffer(2);
+
+ return((ushort) (m_buffer[0] | (m_buffer[1] << 8)));
+ }
+
+ [CLSCompliant(false)]
+ public virtual uint ReadUInt32() {
+ FillBuffer(4);
+
+
+ return((uint) (m_buffer[0] |
+ (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) |
+ (m_buffer[3] << 24)));
+ }
+
+ [CLSCompliant(false)]
+ public virtual ulong ReadUInt64() {
+ FillBuffer(8);
+
+ uint ret_low = (uint) (m_buffer[0] |
+ (m_buffer[1] << 8) |
+ (m_buffer[2] << 16) |
+ (m_buffer[3] << 24)
+ );
+ uint ret_high = (uint) (m_buffer[4] |
+ (m_buffer[5] << 8) |
+ (m_buffer[6] << 16) |
+ (m_buffer[7] << 24)
+ );
+ return (((ulong) ret_high) << 32) | ret_low;
+ }
+
+ /* Ensures that m_buffer is at least length bytes
+ * long, growing it if necessary
+ */
+ private void CheckBuffer(int length)
+ {
+ if(m_buffer.Length <= length) {
+ byte[] new_buffer=new byte[length];
+ Array.Copy(m_buffer, new_buffer,
+ m_buffer.Length);
+ m_buffer=new_buffer;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/BinaryWriter.cs b/mcs/class/corlib/System.IO/BinaryWriter.cs
new file mode 100755
index 00000000000..2ff0e1f5d41
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BinaryWriter.cs
@@ -0,0 +1,207 @@
+//
+// System.IO.BinaryWriter
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace System.IO {
+ [Serializable]
+ public class BinaryWriter : IDisposable {
+
+ // Null is a BinaryWriter with no backing store.
+ public static readonly BinaryWriter Null;
+
+ protected Stream OutStream;
+ private Encoding m_encoding;
+ private byte [] buffer;
+
+ static BinaryWriter() {
+ Null = new BinaryWriter();
+ }
+
+ protected BinaryWriter() : this (Stream.Null, Encoding.UTF8Unmarked) {
+ }
+
+ public BinaryWriter(Stream output) : this(output, Encoding.UTF8Unmarked) {
+ }
+
+ public BinaryWriter(Stream output, Encoding encoding) {
+ if (output == null || encoding == null)
+ throw new ArgumentNullException(Locale.GetText ("Output or Encoding is a null reference."));
+ if (!output.CanWrite)
+ throw new ArgumentException(Locale.GetText ("Stream does not support writing or already closed."));
+
+ OutStream = output;
+ m_encoding = encoding;
+ buffer = new byte [16];
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return OutStream;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose (true);
+ }
+
+ void IDisposable.Dispose() {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing && OutStream != null)
+ OutStream.Close();
+
+ buffer = null;
+ m_encoding = null;
+ OutStream = null;
+ }
+
+ public virtual void Flush() {
+ OutStream.Flush();
+ }
+
+ public virtual long Seek(int offset, SeekOrigin origin) {
+ return OutStream.Seek(offset, origin);
+ }
+
+ public virtual void Write(bool value) {
+ buffer [0] = (byte) (value ? 1 : 0);
+ OutStream.Write(buffer, 0, 1);
+ }
+
+ public virtual void Write(byte value) {
+ OutStream.WriteByte(value);
+ }
+
+ public virtual void Write(byte[] value) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Byte buffer is a null reference."));
+ OutStream.Write(value, 0, value.Length);
+ }
+
+ public virtual void Write(byte[] value, int offset, int length) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Byte buffer is a null reference."));
+ OutStream.Write(value, offset, length);
+ }
+
+ public virtual void Write(char value) {
+ char[] dec = new char[1];
+ dec[0] = value;
+ byte[] enc = m_encoding.GetBytes(dec, 0, 1);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ public virtual void Write(char[] value) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Chars is a null reference."));
+ byte[] enc = m_encoding.GetBytes(value, 0, value.Length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ public virtual void Write(char[] value, int offset, int length) {
+ if (value == null)
+ throw new ArgumentNullException(Locale.GetText ("Chars is a null reference."));
+ byte[] enc = m_encoding.GetBytes(value, offset, length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ unsafe public virtual void Write(decimal value) {
+ byte* value_ptr = (byte *)&value;
+ for (int i = 0; i < 16; i++) {
+ buffer [i] = value_ptr [i];
+ }
+
+ OutStream.Write(buffer, 0, 16);
+ }
+
+ public virtual void Write(double value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 8);
+ }
+
+ public virtual void Write(short value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ OutStream.Write(buffer, 0, 2);
+ }
+
+ public virtual void Write(int value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ buffer [2] = (byte) (value >> 16);
+ buffer [3] = (byte) (value >> 24);
+ OutStream.Write(buffer, 0, 4);
+ }
+
+ public virtual void Write(long value) {
+ for (int i = 0, sh = 0; i < 8; i++, sh += 8)
+ buffer [i] = (byte) (value >> sh);
+ OutStream.Write(buffer, 0, 8);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(sbyte value) {
+ buffer [0] = (byte) value;
+ OutStream.Write(buffer, 0, 1);
+ }
+
+ public virtual void Write(float value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 4);
+ }
+
+ public virtual void Write(string value) {
+ /* The length field is the byte count, not the
+ * char count
+ */
+ byte[] enc = m_encoding.GetBytes(value);
+ Write7BitEncodedInt(enc.Length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(ushort value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ OutStream.Write(buffer, 0, 2);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(uint value) {
+ buffer [0] = (byte) value;
+ buffer [1] = (byte) (value >> 8);
+ buffer [2] = (byte) (value >> 16);
+ buffer [3] = (byte) (value >> 24);
+ OutStream.Write(buffer, 0, 4);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(ulong value) {
+ for (int i = 0, sh = 0; i < 8; i++, sh += 8)
+ buffer [i] = (byte) (value >> sh);
+ OutStream.Write(buffer, 0, 8);
+ }
+
+ protected void Write7BitEncodedInt(int value) {
+ do {
+ int high = (value >> 7) & 0x01ffffff;
+ byte b = (byte)(value & 0x7f);
+
+ if (high != 0) {
+ b = (byte)(b | 0x80);
+ }
+
+ Write(b);
+ value = high;
+ } while(value != 0);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/BufferedStream.cs b/mcs/class/corlib/System.IO/BufferedStream.cs
new file mode 100644
index 00000000000..ac7d17a5e23
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BufferedStream.cs
@@ -0,0 +1,163 @@
+//
+// System.IO.BufferedStream
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+namespace System.IO {
+ public sealed class BufferedStream : Stream {
+ Stream m_stream;
+ byte[] m_buffer;
+ int m_buffer_pos;
+ int m_buffer_read_ahead;
+ bool m_buffer_reading;
+
+ public BufferedStream(Stream stream) : this(stream, 4096) {
+ }
+
+ public BufferedStream(Stream stream, int buffer_size) {
+ m_stream = stream;
+ m_buffer = new byte[buffer_size];
+ }
+
+ public override bool CanRead {
+ get {
+ return m_stream.CanRead;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return m_stream.CanWrite;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return m_stream.CanSeek;
+ }
+ }
+
+ public override long Length {
+ get {
+ return m_stream.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ return m_stream.Position - m_buffer_read_ahead + m_buffer_pos;
+ }
+
+ set {
+ Flush();
+ m_stream.Position = value;
+ }
+ }
+
+ public override void Close() {
+ Flush();
+ m_stream.Close();
+ m_stream = null;
+ m_buffer = null;
+ }
+
+ public override void Flush() {
+ if (m_buffer_reading) {
+ if (CanSeek)
+ m_stream.Position = Position;
+ } else {
+ m_stream.Write(m_buffer, 0, m_buffer_pos);
+ }
+
+ m_buffer_read_ahead = 0;
+ m_buffer_pos = 0;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ Flush();
+ return m_stream.Seek(offset, origin);
+ }
+
+ public override void SetLength(long value) {
+ m_stream.SetLength(value);
+ }
+
+ public override int ReadByte() {
+ byte[] b = new byte[1];
+
+ if (Read(b, 0, 1) == 1) {
+ return b[0];
+ } else {
+ return -1;
+ }
+ }
+
+ public override void WriteByte(byte value) {
+ byte[] b = new byte[1];
+
+ b[0] = value;
+ Write(b, 0, 1);
+ }
+
+ public override int Read(byte[] array, int offset, int count) {
+ if (!m_buffer_reading) {
+ Flush();
+ m_buffer_reading = true;
+ }
+
+ if (count <= m_buffer_read_ahead - m_buffer_pos) {
+ Array.Copy(m_buffer, m_buffer_pos, array, offset, count);
+
+ m_buffer_pos += count;
+ if (m_buffer_pos == m_buffer_read_ahead) {
+ m_buffer_pos = 0;
+ m_buffer_read_ahead = 0;
+ }
+
+ return count;
+ }
+
+ int ret = m_buffer_read_ahead - m_buffer_pos;
+ Array.Copy(m_buffer, m_buffer_pos, array, offset, ret);
+ m_buffer_pos = 0;
+ m_buffer_read_ahead = 0;
+ offset += ret;
+ count -= ret;
+
+ if (count >= m_buffer.Length) {
+ ret += m_stream.Read(array, offset, count);
+ } else {
+ m_buffer_read_ahead = m_stream.Read(m_buffer, 0, m_buffer.Length);
+
+ if (count < m_buffer_read_ahead) {
+ Array.Copy(m_buffer, 0, array, offset, count);
+ m_buffer_pos = count;
+ ret += count;
+ } else {
+ Array.Copy(m_buffer, 0, array, offset, m_buffer_read_ahead);
+ ret += m_buffer_read_ahead;
+ m_buffer_read_ahead = 0;
+ }
+ }
+
+ return ret;
+ }
+
+ public override void Write(byte[] array, int offset, int count) {
+ if (m_buffer_reading) {
+ Flush();
+ m_buffer_reading = false;
+ }
+
+ if (m_buffer_pos + count >= m_buffer.Length) {
+ Flush();
+ m_stream.Write(array, offset, count);
+ } else {
+ Array.Copy(array, offset, m_buffer, m_buffer_pos, count);
+ m_buffer_pos += count;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog
new file mode 100644
index 00000000000..90b58635de2
--- /dev/null
+++ b/mcs/class/corlib/System.IO/ChangeLog
@@ -0,0 +1,685 @@
+2003-01-18 Jonathan Pryor <jonpryor@vt.edu>
+
+ * FileStream.cs: Add IsAsync property. (Documented in "C# In A Nutshell".)
+
+2003-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MemoryStream.cs: fixed bug #36319.
+
+2002-12-16 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Some fixes to SMB shares handling, and not compiling
+ with csc, mcs compiles it correctly (mcs bug 35652)
+
+2002-12-14 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Some fixes related to correct some exceptions thrown
+
+2002-12-11 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Some Exceptions added, fixed GetParent(),
+ CreateDirectory() should work with unix, native windows and
+ windows samba shares. Converted end-lines from dos-mode to unix-mode
+
+2002-12-08 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: CreateDirectory works now with Absolute paths
+ too, not only with relative ones.
+
+2002-12-07 Peter Williams <peterw@ximian.com>
+
+ * Directory.cs: Don't use the uninitialized pathsumm here.
+ Don't try and create "" if we're using an absolute path.
+
+2002-12-07 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * Directory.cs: Now the creation of a new directory works recursively
+ it will make parents as needed.
+
+2002-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BufferedStream.cs: applied patch from <carlosga@telefonica.net> that
+ fixes Flush ().
+
+Tue Nov 19 13:01:22 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StreamWriter.cs: output the encoding preamble at the start of a
+ stream if needed.
+
+2002-11-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: Changed all Encoding.UTF8 to Encoding.UTF8Unmarked.
+
+2002-11-06 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamWriter.cs: Changed all Encoding.UTF8 to Encoding.UTF8Unmarked.
+
+2002-10-31 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Fix buffering properly this time. Also kludge
+ around broken pipe errors, treating them as EOF instead of
+ throwing an IO exception.
+
+ * MonoIO.cs: Return the error status in a parameter, as the
+ GetLastError() value has long since been blown away if we try and
+ look it up in a subsequent internal call invocation.
+
+ * FileSystemInfo.cs:
+ * FileInfo.cs:
+ * File.cs:
+ * Directory.cs: MonoIO methods now have an error parameter
+
+2002-10-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TextReader.cs: implemented ReadBlock ().
+
+2002-10-30 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamWriter.cs: Ditto for Null stream.
+
+ * BinaryReader.cs: Use Unmarked here too.
+
+ * BinaryWriter.cs: Use the UTF8Unmarker encoding by default, this
+ is what .NET does.
+
+2002-10-23 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Implemented CanSeek, and used it around all the
+ calls to MonoIO.Seek. Fixed buffering in Read() so that it
+ doesn't block forever on short reads.
+
+ * MonoFileType.cs: New enum for GetFileType
+
+ * MonoIO.cs: Added GetFileType
+
+2002-10-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: ReadLine now treats a \r not followed by a \n as a
+ \n (this is what MS does).
+
+2002-10-18 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: SeekOrigin.End still calculates the offset from
+ the end of the file with positive values extending the length.
+ Fixes bug 32471.
+
+2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: some cleanup. Thanks to Martin Aliger.
+
+2002-10-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileStream.cs: throw an exception if trying to open a directory.
+ Thanks to Martin Aliger.
+
+2002-10-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: fixes bug #28046.
+
+2002-09-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: give more information when wrong parameters passed.
+
+2002-09-21 Miguel de Icaza <miguel@ximian.com>
+
+ * FileStream.cs: Do not call FSync on the file.
+
+2002-09-16 Miguel de Icaza <miguel@ximian.com>
+
+ * TextWriter.cs (Null): The Null field should be an instance of a
+ TextWriter class that does nothing, so it is an instance of the
+ NullTextWriter class.
+
+2002-09-16 Nick Drochak <ndrochak@gol.com>
+
+ * MemoryStream.cs (Close): Don't throw an exception if the stream
+ is already closed.
+
+2002-09-15 Miguel de Icaza <miguel@ximian.com>
+
+ * FileStream.cs (Dispose): Call FlushBuffer(), and not Flush, as
+ Flush calls fsync().
+
+ The API docs show no explicit mention that Flush() should even do
+ an fsync, I am thinking that we should drop that from the
+ runtime.
+
+2002-09-09 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamWriter.cs: When no encoding is provided, create an
+ encoding without markers, this is what MS does.
+
+2002-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamReader.cs: Implement detection of byte marks and skipping
+ of byte marks at the beginning of the stream.
+
+ (ReadToEnd): Use buffered read instead of char-by-char
+ processing.
+
+ Correct the default arguments for creating the StreamReader.
+
+2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CheckArgument.cs: fixed check for empty string.
+ * Path.cs: various fixes. It passes all the tests in new PathTest.
+
+2002-08-29 Duncan Mak <duncan@ximian.com>
+
+ * StreamWriter.cs: Set DisposedAlready after calling flush. Fixes
+ the build for gtk#.
+
+2002-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BinaryReader.cs:
+ * BinaryWriter.cs:
+ * MemoryStream.cs:
+ * StreamReader.cs:
+ * StreamWriter.cs:
+ * StringReader.cs:
+ * StringWriter.cs:
+ * TextWriter.cs: IDisposable fixes.
+
+2002-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * StreamReader.cs: Removed TODOs, as the code seems to be
+ complete.
+
+ * Path.cs (GetTempFileName): Make this routine atomic by not
+ testing and then creating, but using the create call to ensure
+ that we own the filename.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileLoadException.cs: implemented ToString.
+
+ * StreamWriter.cs: added Null field and implemented Write (char) and
+ Write (char []).
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs: implemented NullStreamReader.
+
+2002-08-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Path.cs (GetDirectoryName): Fix for filenames with size = 1
+
+ * File.cs: Removed all references that threw exceptions when the
+ paths contains a colon, as this is a valid part of an identifier
+ on Unix.
+
+ Everywhere: The String.Empty return from GetDirectoryName means
+ that there is no directory information about the path.
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileNotFoundException.cs: use Message and InnerException from base
+ class. Changed Message and ToString ().
+
+2002-08-19 Dick Porter <dick@ximian.com>
+
+ * BinaryWriter.cs: The length of a string is counted in bytes, not
+ chars
+
+2002-08-18 Dick Porter <dick@ximian.com>
+
+ * BinaryReader.cs: Fixed buffering
+
+2002-08-09 Nick Drochak <ndrochak@gol.com>
+
+ * BinaryReader.cs: added virtual to Dispose(bool).
+
+2002-08-03 Jason Diamond <jason@injektilo.org>
+
+ * StringWriter.cs: Return UnicodeEncoding for Encoding property.
+
+2002-08-03 Jason Diamond <jason@injektilo.org>
+
+ * StreamWriter.cs: Use GetByteCount() to get exact length instead
+ of GetMaxByteCount when converting chars to bytes.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * StreamReader.cs:
+ (Dispose): Added and implmented.
+
+ * StreamWriter.cs:
+ (Dispose): Fixed visibility.
+ (Initialize): Fixed visibility, made internal.
+
+ * BinaryReader.cs:
+ (Dispose): Fixed visibility.
+
+2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * File.cs:
+ (Create): allow file names without path.
+
+Fri Jul 26 15:45:04 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * FileStream.cs: patch from erik@bagfors.nu to add
+ Name property support.
+
+2002-07-20 Dick Porter <dick@ximian.com>
+
+ * MonoIO.cs: Added icall to CreatePipe
+
+2002-07-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileInfo.cs: fixes buglet #27940
+
+2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: removed unneeded line from GetExtension.
+
+2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileStream.cs:
+ (.ctor): call MonoIO.GetException with the file name.
+
+2002-07-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs: Guard against ^\n lines as pointed out by Gonzalo.
+
+2002-07-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs: Revert the last Peek change and fix the ReadLine
+ end of line detection code instead.
+
+2002-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StreamReader.cs:
+ (Peek): no need to have seek capabilitites.
+
+2002-06-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * Path.cs (ChangeExtension): handle some special cases (fixes bug #25319)
+
+ * File.cs (Delete): only call Directory.Exists() if DirName != ""
+
+2002-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Directory.cs: fixed bug #26133 and also test if the directory exist
+ before performing the search.
+
+2002-06-12 Nick Drochak <ndrochak@gol.com>
+
+ * StringReader.cs (ReadLine): Return null when we get to end of the
+ string.
+
+2002-05-22 Lawrence Pit <loz@cable.a2000.nl>
+
+ * StreamWriter.cs: added ability to write null value
+
+2002-05-19 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Stream.cs: NullStream.ReadByte now returns -1 instead of 0 to
+ prevent endless loops.
+
+2002-05-17 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * FileStream.cs: Enforce lower bound on buffer size.
+
+2002-05-16 Piers Haken <piersh@friskit.com>
+
+ * Stream.cs: Implement synchronous {Begin|End}{Read|Write}() methods.
+
+2002-05-17 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs: Implement buffering. Also implemented dispose
+ pattern as recommended by the MS docs. Must call Close() now
+ to ensure the buffer is flushed.
+
+2002-05-15 Nick Drochak <ndrochak@gol.com>
+
+ * Path.cs (GetDirectoryName): Return String.Empty if there is no
+ directory
+
+ * StreamReader.cs: Add some parameter checking on file names.
+
+ * StreamWriter.cs: Add some parameter checking on file names.
+
+2002-05-14 Nick Drochak <ndrochak@gol.com>
+
+ * File.cs: Add parameter checks to most methods. Not completely done,
+ but all current unit tests pass.
+
+ * Path.cs: Implement GetTempFileName().
+
+2002-05-10 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs (Flush): Throw proper exception if internal stream
+ has already been closed when we try to flush.
+
+2002/05/10 Nick Drochak <ndrochak@gol.com>
+
+ * FileNotFoundException.cs (ToString): Don't try to use the inner
+ exception, because it might be null. Use the message instead.
+
+2002-05-09 Nick Drochak <ndrochak@gol.com>
+
+ * File.cs (Delete): Do not throw an exception if the file does not
+ exist.
+
+2002-05-08 Mike Gray <mikeg@mikegray.org>
+
+ * File.cs: According to ECMA spec and MS docs Copy(src, dest)
+ should not overwrite dest by default.
+
+2002-05-08 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs: Add paramter check to constructors and throw
+ exceptions where appropriate.
+
+Tue May 7 11:47:46 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StreamReader.cs: return the number of chars read even if we diddn't
+ fill the whole buffer (makes Sergey's ilasm work with mono).
+
+2002-05-07 Mike Gray <mikeg_us@hotmail.com>
+
+ * FileInfo.cs (Create): Implement missing method.
+
+2002-05-07 Mike Gray <mikeg_us@hotmail.com>
+
+ * File.cs: Implemented CreateText method, and fixed dst compares
+ to compare against "" instead of null twice.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * StreamReader.cs: Throw exceptions where needed. Changed Null field to
+ use new internal class since null cannot be passed to constructor
+ anymore. Also, fix a coule of small bugs.
+
+2002-05-03 Nick Drochak <ndrochak@gol.com>
+
+ * MemoryStream.cs: Refrain from allocating array until the space is
+ really needed. This fixes a bug in the Length property when the
+ constructor without the byte array is used.
+
+2002-05-01 Duncan Mak <duncan@ximian.com>
+
+ * DirectoryNotFoundException.cs (constructor): Added missing
+ serialization constructor.
+
+2002-04-30 Duncan Mak <duncan@ximian.com>
+
+ * FileLoadException.cs (constructors): Added missing (string,
+ string) ctor, as well as (string, string, Exception) ctor.
+
+ (Message): Added more info to the error message
+
+ (ToString): Added. We'll need to add the StackTrace stuff when
+ that works.
+
+ * FileShare.cs: Add a missing field, Inheritable.
+
+ * TextReader.cs: Renamed Synchronised method to Synchronized.
+
+ * TextWriter.cs: Renamed Synchronised method to Synchronized.
+ Renamed protected member coreNewLine to CoreNewLine.
+
+2002-04-30 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * BinaryReader.cs: Allocate buffer before its first use.
+ Handle end of stream properly. Methods to read native types
+ (ReadInt* etc.) are little-endian (see Compact Framework docs).
+
+ * BinaryWriter.cs: Store data in little-endian format.
+ Use internal buffer for conversions.
+
+2002-03-31 Dick Porter <dick@ximian.com>
+
+ * Directory.cs: Strip out "." and ".." from returned list
+
+ * FileAttributes.cs: Get the right enum values
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * TextWriter.cs (write): added check for null
+
+2002-03-28 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Directory.cs: Throws DirectoryNotFoundException.
+ * MonoIO.cs: Fixed to work around enum problem.
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * StreamReader.cs: Implemented ReadLine() and ReadEnd().
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Directory.cs, File.cs, FileSystemInfo.cs, FileInfo.cs,
+ DirectoryInfo.cs, Path.cs: Modified to use MonoIO class instead of
+ wrapper and PAL classes.
+
+ * MonoIO.cs, MonoIOStat.cs, MonoIOError.cs: Added.
+
+2002-03-25 Mike Kestner <mkestner@speakeasy.net>
+
+ * MemoryStream.cs (Read): Fixed bug in exception throw.
+
+2002-03-24 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs (ReadBuffer): Fix buffer merging bugs.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * StreamReader.cs: Always do buffered reading, use 4k blocks.
+ (Read (char[], int, int)): Implemented.
+ (DiscardBufferedData): Implemented.
+
+2002-03-21 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs : Fill out, add buffering, and use encoding.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ * StreamWriter.cs (StreamWriter (string)): The default is to override
+ the file, not to append to it.
+ (StreamWriter (string path, bool append)): When appending, seek to the
+ end of the file, otherwise truncate the file to zero length.
+ (Dispose (bool)): Close the internalStream.
+ (Flush): Flush the interalStream.
+ (Write (char[], int, int)): Flush the internalStream in auto-flush-mode.
+
+2002-03-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * FileStream.cs: Flush buffer before FileSetLength.
+
+2002-02-28 Miguel de Icaza <miguel@ximian.com>
+
+ * Stream.cs (NullStream): Do not track position, this beast does
+ nothing in practice.
+
+2002-03-15 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SearchPattern.cs: New class. Glob matching code for Directory.
+ * Directory.cs: Changed to use SearchPattern instead of mono_glob_*()
+
+2002/03/15 Nick Drochak <ndrochak@gol.com>
+
+ * DirectoryInfo.cs: Fixed the overloaded GetDirectories and GetFiles.
+ This code seemed to be copied from somewhere, and it was close,
+ but didn't match the docs. This was the last bit needed to get
+ NAnt to compile with our class libs.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * EndOfStreamException.cs:
+ * FileLoadException.cs:
+ * FileNotFoundException.cs:
+ * PathTooLongException.cs: Changed the base classes to IOException
+ instead of SystemException.
+
+ * IOException.cs: Added missing constructors.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * FileMode.cs: Docs don't say this should be explicitly derived from
+ int, so just make it a normal Enum.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * StringReader.cs: Fixed off-by-one error in Peek() and Read().
+
+2002-02-12 Nick Drochak <ndrochak@gol.com>
+
+ * PathTooLongException.cs: put it in the correct namespace
+ * EndOfStreamException.cs: put it in the correct namespace
+
+Thu Jan 31 17:32:32 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Directory.cs: handle opendir() return NULL and absolute filenames.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * FileLoadException.cs:
+ * FileNotFoundException: Added missing bits for serialization.
+
+Thu Jan 24 17:42:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Directory.cs: allow directories in GetFiles() mask.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * FileInfo.c (CopyTo, MoveTo): Implement.
+
+ * FileStream.cs: Add argument checking to the constructor.
+
+ * File.cs: Rewrote most of the file. Implement Copy, Open, Create,
+ OpenText, OpenWrite, Move. Made pending methods flagged as MonoTODO.
+
+ * Directory.cs (Delete): reimplement without using DirectoryInfo.
+ (Delete): Implement the recursive version.
+ (GetCreationTime, GetLastWriteTime, GetLastAccessTime): Implement.
+ (Move): Reimplement.
+ (getNames): dead code removal.
+
+ * Path.cs: define an internal DirectorySeparatorStr that we use in
+ a few spots.
+
+ * Wrapper.cs: Updated to new version.
+
+ * DirectoryInfo (Delete): Implement using the Directory API.
+
+ * DirectoryInfo.cs (GetFiles, GetDirectories, GetFileSystemInfos,
+ Delete, Create, Parent, Exists, MoveTo): Implement.
+
+ * Directory.cs (GetListing): implement new utility function.
+ (GetDirectories): Implement.
+ (GetFileSystemEntries): Implement.
+ (GetFiles): Implement.
+
+ * CheckArgument.cs (Path): Do not allow null by default.
+
+Tue Jan 22 22:53:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * DirectoryInfo.cs, FileInfo.cs: do not use Debug from the system
+ assembly in corlib.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * SeekOrigin.cs: Added Serializable attribute.
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * PathTooLongException.cs:
+ * EndOfStreamException.cs: Added to CVS.
+
+Thu Jan 10 12:06:46 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * BufferedStream.cs: Initial implemenation. The synchronous
+ methods for both reading and writing are implemented. I'll do the
+ asynchronous methods in a bit.
+
+Wed Jan 9 16:04:39 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * BinaryWriter.cs: Initial implementation. And it's all there.
+
+ * BinaryReader.cs: The constructor now uses the passed in encoding,
+ not UTF8 always.
+
+Wed Jan 9 13:54:28 MST 2002 Matt Kimball <matt@kimbal.net>
+
+ * BinaryReader.cs: Initial implementation. I think it's complete.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * CheckArgument.cs, CheckPermission.cs, Directory.cs: MonoTODO
+ attribute decorations.
+
+ * DirectoryInfo.cs, File.cs, FileInfo.cs, FileSystemInfo.cs,
+ Path.cs, TextReader.cs, TextWriter.cs : Ditto.
+
+ * FileLoadException.cs, FileNotFoundException.cs, StreamReader.cs:
+ Ditto.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Use handles rather than casting file descriptors.
+ Added Handle property.
+
+Wed Nov 14 16:47:47 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * CheckPermission.cs: disable ModeAccess() code: it's wrong.
+ * FileStream.cs: only trow an exception if the read failed in ReadByte().
+ * StreamReader.cs: implement Peek and Read.
+ * TextWriter.cs: CLSCompliant updates.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * FileNotFoundException.cs: Added some constructors
+
+ * Path.cs (GetFullPath): Fixed implementation
+
+Fri Nov 2 18:27:58 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DirectoryNotFoundException.cs: implemented.
+
+Tue Sep 25 18:54:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * File.cs: fix signatures of the Open() and OpenRead() functions
+ (they are static).
+
+Thu Sep 13 18:04:23 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FileLoadException.cs, FileNotFoundException.cs: added.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * TextReader.cs: implemented the Read method
+
+ * StreamReader.cs: impl. stubs
+
+ * StreamWriter.cs: impl.
+
+ * TextWriter.cs: implemented Write and WriteLine methods
+
+Sun Aug 26 23:01:41 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FileAccess.cs, FileMode.cs: change values to be compatible with
+ the ms ones.
+
+Sun Aug 26 11:47:56 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * IOException.cs: Implemented System.IO.Exception.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ *SeekOrigin.cs.cs, FileShare.cs, FileMode.cs, FileAccess.cs: Add.
+
+2001-07-19 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * System.IO.MemoryStream.cs: Added. Had quite a few cases of
+ "LAMESPEC", but the tests work against the MS implementation so
+ the major functions are right (ie. Read/Write/Seek). Some more
+ tests required for the various constructors and exceptions.
+
+2001-07-16 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringReader.cs, StringWriter.cs, TextReader.cs, TextWriter.cs:
+ New class implemenations.
+
+ * StringReaderTest.cs, StringWriterTest.cs: Test suite for the above.
+
diff --git a/mcs/class/corlib/System.IO/CheckArgument.cs b/mcs/class/corlib/System.IO/CheckArgument.cs
new file mode 100644
index 00000000000..0e879cf3cc8
--- /dev/null
+++ b/mcs/class/corlib/System.IO/CheckArgument.cs
@@ -0,0 +1,166 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.CheckArgument.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 25, 2001
+//
+// NOTE: All contributors can freely add to this class or make modifications
+// that do not break existing usage of methods
+//------------------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace System.IO
+{
+ /// <summary>
+ /// A utility class to assist with various argument validations in System.IO
+ /// </summary>
+ internal sealed class CheckArgument
+ {
+ /// <summary>
+ /// Generates and exception if arg contains whitepace only
+ /// </summary>
+ public static void WhitespaceOnly (string arg, string desc)
+ {
+ if (arg != null && arg.Length > 0)
+ {
+ string temp = arg.Trim ();
+ if (temp.Length == 0)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg contains whitepace only
+ /// </summary>
+ public static void WhitespaceOnly (string arg)
+ {
+ WhitespaceOnly (arg, "Argument string consists of whitespace characters only.");
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is empty
+ /// </summary>
+ public static void Empty (string arg, string desc)
+ {
+ if (arg != null && arg.Length == 0)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is empty
+ /// </summary>
+ public static void Empty (string arg)
+ {
+ Empty (arg, "Argument string is empty.");
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is null
+ /// </summary>
+ public static void Null (Object arg, string desc)
+ {
+ if (arg == null)
+ {
+ throw new ArgumentNullException (desc);
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is null
+ /// </summary>
+ public static void Null (Object arg)
+ {
+ if (arg == null)
+ {
+ throw new ArgumentNullException ();
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path contains invalid path characters
+ /// </summary>
+ public static void PathChars (string path, string desc)
+ {
+ if (path != null)
+ {
+ if (path.IndexOfAny (System.IO.Path.InvalidPathChars) > -1)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path contains invalid path characters
+ /// </summary>
+ public static void PathChars (string path)
+ {
+ PathChars (path, "Path contains invalid characters");
+ }
+
+ /// <summary>
+ /// Generates and exception if path too long
+ /// </summary>
+ [MonoTODO]
+ public static void PathLength (string path, string desc)
+ {
+ //TODO: find out how long is too long
+ }
+
+ /// <summary>
+ /// Generates and exception if path too long
+ /// </summary>
+ public static void PathLength (string path)
+ {
+ PathLength (path);
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path, bool bAllowNull, bool bLength)
+ {
+ if (path != null) //allow null
+ {
+ Empty (path, "Path cannot be the empty string"); // path can't be empty
+ WhitespaceOnly (path, "Path cannot be all whitespace"); // path can't be all whitespace
+ PathChars (path); // path can't contain invalid characters
+ if (bLength)
+ {
+ PathLength ("Path too long");
+ }
+ }
+ else if (!bAllowNull)
+ {
+ throw new ArgumentNullException ("Parameter name: path");
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path, bool bAllowNull)
+ {
+ Path (path, bAllowNull, false);
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path)
+ {
+ Path (path, false, false);
+ }
+
+ }
+} // namespace System.IO.Private
diff --git a/mcs/class/corlib/System.IO/CheckPermission.cs b/mcs/class/corlib/System.IO/CheckPermission.cs
new file mode 100644
index 00000000000..3418850c065
--- /dev/null
+++ b/mcs/class/corlib/System.IO/CheckPermission.cs
@@ -0,0 +1,87 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.CheckPermission.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 25, 2001
+//
+// NOTE: All contributors can freely add to this class or make modifications
+// that do not break existing usage of methods
+//------------------------------------------------------------------------------
+
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.IO
+{
+ /// <summary>
+ /// A utility class to assist with various permission validation in System.IO
+ /// </summary>
+ internal sealed class CheckPermission
+ {
+ /// <summary>
+ /// Generates and exception if caller doesn't have flags access to filesystem item specified by path
+ /// </summary>
+ [MonoTODO]
+ public static void Demand(FileIOPermissionAccess flags, string path)
+ {
+ FileIOPermission ioPerm = new FileIOPermission(flags, path);
+ // FIXME: FileIOPermission is not yet implemented
+ //ioPerm.Demand();
+ }
+
+ public static void Access(FileAccess access, string path)
+ {
+ switch(access)
+ {
+ case FileAccess.Read:
+ Demand(FileIOPermissionAccess.Read, path);
+ break;
+ case FileAccess.Write:
+ Demand(FileIOPermissionAccess.Write, path);
+ break;
+ case FileAccess.ReadWrite:
+ Demand(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, path);
+ break;
+ default:
+ // TODO: determine what best to do here
+ throw new ArgumentException("Invalid FileAccess parameter");
+ }
+ }
+
+ [MonoTODO]
+ public static void ModeAccess(FileMode mode, FileAccess access, string path, bool exists)
+ {
+#if false
+ // TODO: this logic isn't entirely complete and accurate, yet
+ if((mode & (FileMode.CreateNew | FileMode.Create)) != 0)
+ {
+ CheckPermission.Demand(FileIOPermissionAccess.Write, Path.GetDirectoryName(path));
+ }
+ else if((mode & FileMode.OpenOrCreate) != 0)
+ {
+ if(!exists)
+ {
+ CheckPermission.Demand(FileIOPermissionAccess.Write, Path.GetDirectoryName(path));
+ }
+ else
+ {
+ CheckPermission.Access(access, path);
+ }
+ }
+ else if(exists)
+ {
+ CheckPermission.Access(access, path);
+ }
+ else
+ {
+ throw new FileNotFoundException();
+ }
+#endif
+ }
+ }
+} // namespace System.IO.Private
diff --git a/mcs/class/corlib/System.IO/Directory.cs b/mcs/class/corlib/System.IO/Directory.cs
new file mode 100644
index 00000000000..d55ec3e9e87
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Directory.cs
@@ -0,0 +1,416 @@
+//
+// System.IO.Directory.cs
+//
+// Authors:
+// Jim Richardson (develop@wtfo-guru.com)
+// Miguel de Icaza (miguel@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Eduardo Garcia (kiwnix@yahoo.es)
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+// Copyright (C) 2002 Ximian, Inc.
+//
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security.Permissions;
+using System.Collections;
+using System.Text;
+
+namespace System.IO
+{
+ public sealed class Directory : Object
+ {
+ private Directory () {}
+
+ public static DirectoryInfo CreateDirectory (string path)
+ {
+ DirectoryInfo tmpinfo = null;
+
+ if (path == null) {
+ throw new ArgumentNullException ("path");
+ }
+
+ if (path == "") {
+ throw new ArgumentException ("Path is empty");
+ }
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Path contains invalid chars");
+ }
+
+ if (path.Trim().Length == 0){
+ throw new ArgumentException ("Only blank characters in path");
+ }
+
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+ string[] pathcomponents = path.Split(new char[] { Path.DirectorySeparatorChar });
+
+
+ if (pathcomponents.Length == 1){
+ tmpinfo = Directory.RealCreateDirectory(path);
+ return tmpinfo;
+ }
+ else {
+ if ((path[0]== Path.DirectorySeparatorChar) ||
+ ((path[1] == ':') && (path[2] == Path.DirectorySeparatorChar))) //Absolute Path
+ {
+ //Should Work in Unix, Win* native Directoryes and Samba Shares
+ //FIXME: This is not thread safe
+
+
+ string actual_path = Directory.GetCurrentDirectory();
+
+ if (Environment.OSVersion.Platform == PlatformID.Unix) //Is Unix
+ {
+ StringBuilder pathsumm = new StringBuilder(path);
+ Directory.SetCurrentDirectory ("/");
+ pathsumm.Remove (0,1);
+ tmpinfo = Directory.CreateDirectory(pathsumm.ToString());
+ }
+ else //We asume is Win*
+ {
+ if ((path[1] == ':') || (path[0] == Path.DirectorySeparatorChar)) //Is a regular path
+ {
+ StringBuilder pathsumm = new StringBuilder(path);
+ Directory.SetCurrentDirectory(path.Substring(0,2));
+ pathsumm.Remove(0,2);
+ tmpinfo = Directory.CreateDirectory(pathsumm.ToString());
+ }
+ else if((path[0] == '\\') && (path[1] == '\\')) //Is a Samba Share
+ {
+ if (Directory.Exists(pathcomponents[0] + "\\"
+ + pathcomponents[1] + "\\"
+ + pathcomponents[2]))
+ {
+ StringBuilder pathsumm = new StringBuilder();
+ Directory.SetCurrentDirectory(pathcomponents[0] +
+ "\\" + pathcomponents[1] +
+ "\\" + pathcomponents[2] +
+ "\\" + pathcomponents[3]);
+ pathcomponents[0] = ""; pathcomponents[1] = ""; pathcomponents[2] = "";
+ pathcomponents[3] = "";
+ foreach(string dir in pathcomponents)
+ {
+ if (dir != "")
+ pathsumm.Append(dir + "\\");
+ }
+ Directory.CreateDirectory(pathsumm.ToString());
+ }
+ else
+ {
+ throw new DirectoryNotFoundException("The samba share do not Exists");
+ }
+ }
+
+ }
+ Directory.SetCurrentDirectory(actual_path);
+ }
+ else //Relative Path
+ {
+ StringBuilder pathsumm = new StringBuilder();
+
+ foreach(string dir in pathcomponents)
+ {
+ if (dir.Length != 0) {
+ if (pathsumm.Length == 0) {
+ pathsumm.Append (dir);
+ }
+ else {
+ pathsumm.Append (Path.DirectorySeparatorChar + dir);
+ }
+
+ if (!Directory.Exists (pathsumm.ToString())) {
+ tmpinfo = Directory.RealCreateDirectory (pathsumm.ToString());
+ }
+ }
+ }
+ }
+ }
+ return tmpinfo;
+ }
+
+ private static DirectoryInfo RealCreateDirectory (string path)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.CreateDirectory (path, out error)) {
+ throw MonoIO.GetException (error);
+ }
+
+ return new DirectoryInfo (path);
+ }
+
+ public static void Delete (string path)
+ {
+ if (path == null) {
+ throw new ArgumentNullException ("path");
+ }
+
+ if (path == "") {
+ throw new ArgumentException ("Path is empty");
+ }
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Path contains invalid chars");
+ }
+ if (path.Trim().Length == 0)
+ throw new ArgumentException ("Only blank characters in path");
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+
+
+ MonoIOError error;
+
+ if (!MonoIO.RemoveDirectory (path, out error)) {
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ static void RecursiveDelete (string path)
+ {
+ foreach (string dir in GetDirectories (path))
+ RecursiveDelete (dir);
+
+ foreach (string file in GetFiles (path))
+ File.Delete (file);
+
+ Directory.Delete (path);
+ }
+
+ public static void Delete (string path, bool recurse)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path == "")
+ throw new System.ArgumentException("Path is Empty");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+ if (path.Trim().Length == 0)
+ throw new ArgumentException ("Only blank characters in path");
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+
+ if (recurse == false){
+ Delete (path);
+ return;
+ }
+
+ RecursiveDelete (path);
+ }
+
+ public static bool Exists (string path)
+ {
+ if (path == null)
+ return false;
+
+ MonoIOError error;
+
+ return MonoIO.ExistsDirectory (path, out error);
+ }
+
+ public static DateTime GetLastAccessTime (string path)
+ {
+ return File.GetLastAccessTime (path);
+ }
+
+ public static DateTime GetLastWriteTime (string path)
+ {
+ return File.GetLastWriteTime (path);
+ }
+
+ public static DateTime GetCreationTime (string path)
+ {
+ if (path == null)
+ throw new System.ArgumentNullException("Path is Null");
+ if (path == "")
+ throw new System.ArgumentException("Path is Empty");
+ if (path.Trim().Length == 0)
+ throw new ArgumentException ("Only blank characters in path");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid chars");
+ if (path == ":")
+ throw new NotSupportedException ("Only ':' In path");
+
+
+
+ return File.GetLastWriteTime (path);
+ }
+
+ public static string GetCurrentDirectory ()
+ {
+ /*
+ // Implementation complete 08/25/2001 14:24 except for
+ // LAMESPEC: documentation specifies invalid exceptions (i think)
+ // also shouldn't need Write to getcurrrent should we?
+ string str = Environment.CurrentDirectory;
+ CheckPermission.Demand (FileIOPermissionAccess.Read & FileIOPermissionAccess.Write, str);
+ */
+ return Environment.CurrentDirectory;
+ }
+
+ public static string [] GetDirectories (string path)
+ {
+ return GetDirectories (path, "*");
+ }
+
+ public static string [] GetDirectories (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, FileAttributes.Directory, FileAttributes.Directory);
+ }
+
+ public static string GetDirectoryRoot (string path)
+ {
+ return new String(Path.DirectorySeparatorChar,1);
+ }
+
+ public static string [] GetFiles (string path)
+ {
+ return GetFiles (path, "*");
+ }
+
+ public static string [] GetFiles (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, FileAttributes.Directory, 0);
+ }
+
+ public static string [] GetFileSystemEntries (string path)
+ {
+ return GetFileSystemEntries (path, "*");
+ }
+
+ public static string [] GetFileSystemEntries (string path, string pattern)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+ if (path == "")
+ throw new ArgumentException ("The Path do not have a valid format");
+
+ return GetFileSystemEntries (path, pattern, 0, 0);
+ }
+
+ public static string[] GetLogicalDrives ()
+ {
+ //FIXME: Hardcoded Paths
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ return new string[] { "/" };
+ else
+ return new string [] { "A:\\", "C:\\" };
+ }
+
+ public static DirectoryInfo GetParent (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+ if (path == "")
+ throw new ArgumentException ("The Path do not have a valid format");
+
+ return new DirectoryInfo (Path.GetDirectoryName (path + Path.DirectorySeparatorChar + ".."));
+ }
+
+ public static void Move (string src, string dest)
+ {
+ File.Move (src, dest);
+ }
+
+ public static void SetCreationTime (string path, DateTime creation_time)
+ {
+ File.SetCreationTime (path, creation_time);
+ }
+
+ public static void SetCurrentDirectory (string path)
+ {
+ /*
+ // Implementation complete 08/25/2001 14:24 except for
+ // LAMESPEC: documentation specifies invalid exceptions IOException (i think)
+ CheckArgument.Path (path, true);
+ CheckPermission.Demand (FileIOPermissionAccess.Read & FileIOPermissionAccess.Write, path);
+ */
+ if (!Exists (path))
+ {
+ throw new DirectoryNotFoundException ("Directory \"" + path + "\" not found.");
+ }
+ Environment.CurrentDirectory = path;
+ }
+
+ public static void SetLastAccessTime (string path, DateTime last_access_time)
+ {
+ File.SetLastAccessTime (path, last_access_time);
+ }
+
+ public static void SetLastWriteTime (string path, DateTime last_write_time)
+ {
+ File.SetLastWriteTime (path, last_write_time);
+ }
+
+ // private
+
+ private static string [] GetFileSystemEntries (string path, string pattern, FileAttributes mask, FileAttributes attrs)
+ {
+ SearchPattern search;
+ MonoIOStat stat;
+ IntPtr find;
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Path contains invalid characters.");
+ }
+
+ if (!Directory.Exists (path)) {
+ throw new DirectoryNotFoundException ("Directory '" + path + "' not found.");
+ }
+
+ search = new SearchPattern (pattern);
+
+ MonoIOError error;
+
+ find = MonoIO.FindFirstFile (Path.Combine (path , "*"), out stat, out error);
+ if (find == MonoIO.InvalidHandle) {
+ switch (error) {
+ case MonoIOError.ERROR_FILE_NOT_FOUND:
+ case MonoIOError.ERROR_PATH_NOT_FOUND:
+ string message = String.Format ("Could not find a part of the path \"{0}\"", path);
+ throw new DirectoryNotFoundException (message);
+ case MonoIOError.ERROR_NO_MORE_FILES:
+ return new string [0];
+
+ default:
+ throw MonoIO.GetException (path,
+ error);
+ }
+ }
+
+ ArrayList entries = new ArrayList ();
+
+ while (true) {
+ // Ignore entries of "." and ".." -
+ // the documentation doesn't mention
+ // it (surprise!) but empirical
+ // testing indicates .net never
+ // returns "." or ".." in a
+ // GetDirectories() list.
+ if ((stat.Attributes & mask) == attrs &&
+ search.IsMatch (stat.Name) &&
+ stat.Name != "." &&
+ stat.Name != "..")
+ entries.Add (Path.Combine (path, stat.Name));
+
+ if (!MonoIO.FindNextFile (find, out stat,
+ out error))
+ break;
+ }
+ MonoIO.FindClose (find, out error);
+
+ return (string []) entries.ToArray (typeof (string));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/DirectoryInfo.cs b/mcs/class/corlib/System.IO/DirectoryInfo.cs
new file mode 100644
index 00000000000..21d0329b5a9
--- /dev/null
+++ b/mcs/class/corlib/System.IO/DirectoryInfo.cs
@@ -0,0 +1,135 @@
+//
+// System.IO.DirectoryInfo.cs
+//
+// Author:
+// Miguel de Icaza, miguel@ximian.com
+// Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis, dihlewis@yahoo.co.uk
+//
+// Copyright (C) 2002 Ximian, Inc.
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+
+using System;
+using System.Collections;
+
+namespace System.IO {
+
+ [Serializable]
+ public sealed class DirectoryInfo : FileSystemInfo {
+
+ public DirectoryInfo (string path) {
+ CheckPath (path);
+
+ OriginalPath = path;
+ FullPath = Path.GetFullPath (path);
+ }
+
+ // properties
+
+ public override bool Exists {
+ get {
+ Refresh (false);
+
+ if (stat.Attributes == MonoIO.InvalidFileAttributes)
+ return false;
+
+ if ((stat.Attributes & FileAttributes.Directory) == 0)
+ return false;
+
+ return true;
+ }
+ }
+
+ public override string Name {
+ get {
+ return Path.GetFileName (FullPath);
+ }
+ }
+
+ public DirectoryInfo Parent {
+ get {
+ return new DirectoryInfo (Path.GetDirectoryName (FullPath));
+ }
+ }
+
+ public DirectoryInfo Root {
+ get {
+ return new DirectoryInfo (Path.GetPathRoot (FullPath));
+ }
+ }
+
+ // creational methods
+
+ public void Create () {
+ Directory.CreateDirectory (FullPath);
+ }
+
+ public DirectoryInfo CreateSubdirectory (string name) {
+ string path = Path.Combine (FullPath, Path.GetFileName (name));
+ Directory.CreateDirectory (path);
+
+ return new DirectoryInfo (path);
+ }
+
+ // directory listing methods
+
+ public FileInfo [] GetFiles () {
+ return GetFiles ("*");
+ }
+
+ public FileInfo [] GetFiles (string pattern) {
+ string [] names = Directory.GetFiles (FullPath, pattern);
+
+ ArrayList infos = new ArrayList ();
+ foreach (string name in names)
+ infos.Add (new FileInfo (name));
+
+ return (FileInfo []) infos.ToArray (typeof (FileInfo));
+ }
+
+ public DirectoryInfo [] GetDirectories () {
+ return GetDirectories ("*");
+ }
+
+ public DirectoryInfo [] GetDirectories (string pattern) {
+ string [] names = Directory.GetDirectories (FullPath, pattern);
+
+ ArrayList infos = new ArrayList ();
+ foreach (string name in names)
+ infos.Add (new DirectoryInfo (name));
+
+ return (DirectoryInfo []) infos.ToArray (typeof (DirectoryInfo));
+ }
+
+ public FileSystemInfo [] GetFileSystemInfos () {
+ return GetFileSystemInfos ("*");
+ }
+
+ public FileSystemInfo [] GetFileSystemInfos (string pattern) {
+ ArrayList infos = new ArrayList ();
+ infos.AddRange (GetDirectories (pattern));
+ infos.AddRange (GetFiles (pattern));
+
+ return (FileSystemInfo []) infos.ToArray (typeof (FileSystemInfo));
+ }
+
+ // directory management methods
+
+ public override void Delete () {
+ Delete (false);
+ }
+
+ public void Delete (bool recurse) {
+ Directory.Delete (FullPath, recurse);
+ }
+
+ public void MoveTo (string dest) {
+ Directory.Move (FullPath, dest);
+ }
+
+ public override string ToString () {
+ return OriginalPath;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs b/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs
new file mode 100755
index 00000000000..1332758d48f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs
@@ -0,0 +1,38 @@
+//
+// System.IO.DirectoryNotFoundException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.IO {
+
+ [Serializable]
+ public class DirectoryNotFoundException : IOException {
+
+ // Constructors
+ public DirectoryNotFoundException ()
+ : base ("Directory not found")
+ {
+ }
+
+ public DirectoryNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ public DirectoryNotFoundException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected DirectoryNotFoundException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/EndOfStreamException.cs b/mcs/class/corlib/System.IO/EndOfStreamException.cs
new file mode 100644
index 00000000000..88f8460d87a
--- /dev/null
+++ b/mcs/class/corlib/System.IO/EndOfStreamException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.EndOfStreamException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+ [Serializable]
+ public class EndOfStreamException : IOException
+ {
+ // Constructors
+ public EndOfStreamException ()
+ : base (Locale.GetText ("Failed to read past end of stream."))
+ {
+ }
+
+ public EndOfStreamException (string message)
+ : base (message)
+ {
+ }
+
+ protected EndOfStreamException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public EndOfStreamException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/File.cs b/mcs/class/corlib/System.IO/File.cs
new file mode 100644
index 00000000000..e9e90e575e4
--- /dev/null
+++ b/mcs/class/corlib/System.IO/File.cs
@@ -0,0 +1,297 @@
+//
+// System.IO.FIle.cs
+//
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com)
+// Jim Richardson (develop@wtfo-guru.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// Copyright 2002 Ximian, Inc. http://www.ximian.com
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+
+using System;
+
+namespace System.IO
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public sealed class File
+ {
+ private File () {}
+
+
+
+ public static StreamWriter AppendText (string path)
+ {
+ return new StreamWriter (path, true);
+ }
+
+ [MonoTODO("Security Permision Checks")]
+ public static void Copy (string sourceFilename, string destFilename)
+ {
+ Copy (sourceFilename, destFilename, false);
+ }
+
+ public static void Copy (string src, string dest, bool overwrite)
+ {
+ if (src == null)
+ throw new ArgumentNullException ("src");
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+ if (src.Trim () == "" || src.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("src");
+ if (dest.Trim () == "" || dest.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("dest");
+ if (!Exists (src))
+ throw new FileNotFoundException (src + " does not exist");
+
+ if ((GetAttributes(src) & FileAttributes.Directory) == FileAttributes.Directory){
+ throw new ArgumentException(src + " is a directory");
+ }
+
+ if (Exists (dest)) {
+ if ((GetAttributes(dest) & FileAttributes.Directory) == FileAttributes.Directory){
+ throw new ArgumentException(dest + " is a directory");
+ }
+ if (!overwrite)
+ throw new IOException (dest + " already exists");
+ }
+
+ string DirName = Path.GetDirectoryName(dest);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+
+ MonoIOError error;
+
+ if (!MonoIO.CopyFile (src, dest, overwrite, out error))
+ throw MonoIO.GetException (error);
+ }
+
+ public static FileStream Create (string path)
+ {
+ return Create (path, 8192);
+ }
+
+ public static FileStream Create (string path, int buffersize)
+ {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path.Trim() || path.IndexOfAny(Path.InvalidPathChars) >= 0)
+ throw new ArgumentException("path");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+ if (Exists(path)){
+ if ((GetAttributes(path) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly){
+ throw new UnauthorizedAccessException(path + " is a read-only");
+ }
+ }
+
+ return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
+ FileShare.None, buffersize);
+ }
+
+ public static StreamWriter CreateText(string path)
+
+ {
+ return new StreamWriter (path, false);
+
+ }
+
+
+
+ public static void Delete (string path)
+ {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path.Trim() || path.IndexOfAny(Path.InvalidPathChars) >= 0)
+ throw new ArgumentException("path");
+ if (Directory.Exists (path))
+ throw new UnauthorizedAccessException("path is a directory");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+
+ MonoIOError error;
+
+ if (!MonoIO.DeleteFile (path, out error)){
+ Exception e = MonoIO.GetException (error);
+ if (! (e is FileNotFoundException))
+ throw e;
+ }
+ }
+
+ public static bool Exists (string path)
+ {
+ // For security reasons no exceptions are
+ // thrown, only false is returned if there is
+ // any problem with the path or permissions.
+ // Minimizes what information can be
+ // discovered by using this method.
+ if (null == path || String.Empty == path.Trim()
+ || path.IndexOfAny(Path.InvalidPathChars) >= 0) {
+ return false;
+ }
+
+ MonoIOError error;
+
+ return MonoIO.ExistsFile (path, out error);
+ }
+
+ public static FileAttributes GetAttributes (string path)
+ {
+ if (null == path) {
+ throw new ArgumentNullException("path");
+ }
+
+ if (String.Empty == path.Trim()) {
+ throw new ArgumentException("Path is empty");
+ }
+
+ if (path.IndexOfAny(Path.InvalidPathChars) >= 0) {
+ throw new ArgumentException("Path contains invalid chars");
+ }
+
+ MonoIOError error;
+
+ return MonoIO.GetFileAttributes (path, out error);
+ }
+
+ public static DateTime GetCreationTime (string path)
+ {
+ MonoIOStat stat;
+ MonoIOError error;
+
+ MonoIO.GetFileStat (path, out stat, out error);
+ return DateTime.FromFileTime (stat.CreationTime);
+ }
+
+ public static DateTime GetLastAccessTime (string path)
+ {
+ MonoIOStat stat;
+ MonoIOError error;
+
+ MonoIO.GetFileStat (path, out stat, out error);
+ return DateTime.FromFileTime (stat.LastAccessTime);
+ }
+
+ public static DateTime GetLastWriteTime (string path)
+ {
+ MonoIOStat stat;
+ MonoIOError error;
+
+ MonoIO.GetFileStat (path, out stat, out error);
+ return DateTime.FromFileTime (stat.LastWriteTime);
+ }
+
+ public static void Move (string src, string dest)
+ {
+ if (src == null)
+ throw new ArgumentNullException ("src");
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+ if (src.Trim () == "" || src.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("src");
+ if (dest.Trim () == "" || dest.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("dest");
+ if (!Exists (src))
+ throw new FileNotFoundException (src + " does not exist");
+ if (Exists (dest) && ((GetAttributes(dest) & FileAttributes.Directory) == FileAttributes.Directory))
+ throw new ArgumentException(dest + " is a directory");
+
+ string DirName;
+ DirName = Path.GetDirectoryName(src);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Source directory not found: " + DirName);
+ DirName = Path.GetDirectoryName(dest);
+ if (DirName != String.Empty && !Directory.Exists (DirName))
+ throw new DirectoryNotFoundException("Destination directory not found: " + DirName);
+
+ MonoIOError error;
+
+ if (!MonoIO.MoveFile (src, dest, out error))
+ throw MonoIO.GetException (error);
+ }
+
+ public static FileStream Open (string path, FileMode mode)
+ {
+ return new FileStream (path, mode, FileAccess.ReadWrite, FileShare.None);
+ }
+
+ public static FileStream Open (string path, FileMode mode, FileAccess access)
+ {
+ return new FileStream (path, mode, access, FileShare.None);
+ }
+
+ public static FileStream Open (string path, FileMode mode, FileAccess access,
+ FileShare share)
+ {
+ return new FileStream (path, mode, access, share);
+ }
+
+ public static FileStream OpenRead (string path)
+ {
+ return new FileStream (path, FileMode.Open, FileAccess.Read, FileShare.Read);
+ }
+
+ public static StreamReader OpenText (string path)
+ {
+ return new StreamReader (path);
+ }
+
+ public static FileStream OpenWrite (string path)
+ {
+ return new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
+ }
+
+ public static void SetAttributes (string path,
+ FileAttributes attributes)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileAttributes (path, attributes,
+ out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+
+ public static void SetCreationTime (string path,
+ DateTime creation_time)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (path, creation_time.Ticks,
+ -1, -1, out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+
+ public static void SetLastAccessTime (string path,DateTime last_access_time)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (path, -1,
+ last_access_time.Ticks, -1,
+ out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+
+ public static void SetLastWriteTime (string path,
+ DateTime last_write_time)
+ {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (path, -1, -1,
+ last_write_time.Ticks,
+ out error)) {
+ throw MonoIO.GetException (path, error);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileAccess.cs b/mcs/class/corlib/System.IO/FileAccess.cs
new file mode 100644
index 00000000000..c6eefb3aa6f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileAccess.cs
@@ -0,0 +1,34 @@
+// FileAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:20 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileAccess : int {
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ ReadWrite = Read | Write,
+ } // FileAccess
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileAttributes.cs b/mcs/class/corlib/System.IO/FileAttributes.cs
new file mode 100644
index 00000000000..3f187be6910
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileAttributes.cs
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileAttributes.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+
+namespace System.IO
+{
+ [Flags]
+ [Serializable]
+ public enum FileAttributes : int
+ {
+ Archive = 0x00020,
+ Compressed = 0x00800,
+ Device = 0x00040, // Reserved for future use (NOT the w32 value).
+ Directory = 0x00010,
+ Encrypted = 0x04000, // NOT the w32 value
+ Hidden = 0x00002,
+ Normal = 0x00080,
+ NotContentIndexed = 0x02000,
+ Offline = 0x01000,
+ ReadOnly = 0x00001,
+ ReparsePoint = 0x00400,
+ SparseFile = 0x00200,
+ System = 0x00004,
+ Temporary = 0x00100
+ }
+
+}
diff --git a/mcs/class/corlib/System.IO/FileInfo.cs b/mcs/class/corlib/System.IO/FileInfo.cs
new file mode 100644
index 00000000000..4cb45ca8a69
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileInfo.cs
@@ -0,0 +1,147 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileInfo.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public sealed class FileInfo : FileSystemInfo {
+
+ public FileInfo (string path) {
+ CheckPath (path);
+
+ OriginalPath = path;
+ FullPath = Path.GetFullPath (path);
+ }
+
+ // public properties
+
+ public override bool Exists {
+ get {
+ Refresh (false);
+
+ if (stat.Attributes == MonoIO.InvalidFileAttributes)
+ return false;
+
+ if ((stat.Attributes & FileAttributes.Directory) != 0)
+ return false;
+
+ return File.Exists (FullPath);
+ }
+ }
+
+ public override string Name {
+ get {
+ return Path.GetFileName (FullPath);
+ }
+ }
+
+ public long Length {
+ get {
+ if (!Exists)
+ throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".");
+
+ return stat.Length;
+ }
+ }
+
+ public string DirectoryName {
+ get {
+ return Path.GetDirectoryName (FullPath);
+ }
+ }
+
+ public DirectoryInfo Directory {
+ get {
+ return new DirectoryInfo (DirectoryName);
+ }
+ }
+
+ // streamreader methods
+
+ public StreamReader OpenText () {
+ return new StreamReader (Open (FileMode.Open, FileAccess.Read));
+ }
+
+ public StreamWriter CreateText () {
+ return new StreamWriter (Open (FileMode.Create, FileAccess.Write));
+ }
+
+ public StreamWriter AppendText () {
+ return new StreamWriter (Open (FileMode.Append, FileAccess.Write));
+ }
+
+ // filestream methods
+
+ public FileStream Create ()
+ {
+ return File.Create (FullPath);
+ }
+
+
+ public FileStream OpenRead () {
+ return Open (FileMode.Open, FileAccess.Read);
+ }
+
+ public FileStream OpenWrite () {
+ return Open (FileMode.OpenOrCreate, FileAccess.Write);
+ }
+
+ public FileStream Open (FileMode mode) {
+ return Open (mode, FileAccess.ReadWrite);
+ }
+
+ public FileStream Open (FileMode mode, FileAccess access) {
+ return Open (mode, access, FileShare.None);
+ }
+
+ public FileStream Open (FileMode mode, FileAccess access, FileShare share) {
+ return new FileStream (FullPath, mode, access, share);
+ }
+
+ // file methods
+
+ public override void Delete () {
+ MonoIOError error;
+
+ if (!MonoIO.Exists (FullPath, out error)) {
+ // a weird MS.NET behaviour
+ return;
+ }
+
+ if (!MonoIO.DeleteFile (FullPath, out error)) {
+ throw MonoIO.GetException (OriginalPath,
+ error);
+ }
+ }
+
+ public void MoveTo (string dest) {
+ File.Move (FullPath, dest);
+ }
+
+ public FileInfo CopyTo (string path) {
+ return CopyTo (path, false);
+ }
+
+ public FileInfo CopyTo (string path, bool overwrite) {
+ string dest = Path.GetFullPath (path);
+ File.Copy (FullPath, dest);
+
+ return new FileInfo (dest);
+ }
+
+ public override string ToString () {
+ return OriginalPath;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileLoadException.cs b/mcs/class/corlib/System.IO/FileLoadException.cs
new file mode 100755
index 00000000000..2ee1546b36c
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileLoadException.cs
@@ -0,0 +1,106 @@
+//
+// System.IO.FileLoadException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class FileLoadException : IOException {
+
+ // Fields
+ string msg;
+ Exception inner;
+ string fileName;
+ string fusionLog;
+
+ // Constructors
+ public FileLoadException ()
+ : base (Locale.GetText ("I/O Error"))
+ {
+ msg = Locale.GetText ("I/O Error");
+ }
+
+ public FileLoadException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ public FileLoadException (string message, string fileName)
+ : base (message)
+ {
+ this.msg = message;
+ this.fileName = fileName;
+ }
+
+ public FileLoadException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ }
+
+ public FileLoadException (string message, string fileName, Exception inner)
+ : base (message, inner)
+ {
+ this.msg = message;
+ this.fileName = fileName;
+ this.inner = inner;
+ }
+
+ protected FileLoadException (SerializationInfo info, StreamingContext context)
+ {
+ fileName = info.GetString ("FileLoad_FileName");
+ fusionLog = info.GetString ("FileLoad_FusionLog");
+ }
+
+ // Properties
+ public override string Message
+ {
+ get {
+ if (fileName != null)
+ return Locale.GetText (msg + ": " + fileName);
+ else
+ return msg;
+ }
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("FileLoad_FileName", fileName);
+ info.AddValue ("FileLoad_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ string result = GetType ().FullName + ": " + Message;
+ if (this.InnerException != null)
+ result +=" ----> " + InnerException;
+ if (this.StackTrace != null)
+ result += '\n' + StackTrace;
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileMode.cs b/mcs/class/corlib/System.IO/FileMode.cs
new file mode 100644
index 00000000000..c32a53408bf
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileMode.cs
@@ -0,0 +1,45 @@
+// FileMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:13 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FileMode {
+
+ /// <summary>
+ /// </summary>
+ CreateNew = 1,
+
+ /// <summary>
+ /// </summary>
+ Create = 2,
+
+ /// <summary>
+ /// </summary>
+ Open = 3,
+
+ /// <summary>
+ /// </summary>
+ OpenOrCreate = 4,
+
+ /// <summary>
+ /// </summary>
+ Truncate = 5,
+
+ /// <summary>
+ /// </summary>
+ Append = 6,
+ } // FileMode
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileNotFoundException.cs b/mcs/class/corlib/System.IO/FileNotFoundException.cs
new file mode 100755
index 00000000000..e6b8f75a5ce
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileNotFoundException.cs
@@ -0,0 +1,97 @@
+//
+// System.IO.FileNotFoundException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+
+ [Serializable]
+ public class FileNotFoundException : IOException {
+ private string fileName;
+ private string fusionLog;
+
+ // Constructors
+ public FileNotFoundException ()
+ : base (Locale.GetText ("File not found"))
+ {
+ }
+
+ public FileNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ public FileNotFoundException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public FileNotFoundException (string message, string fileName)
+ : base (message)
+ {
+ this.fileName = fileName;
+ }
+
+ public FileNotFoundException (string message, string fileName, Exception innerException)
+ : base (message, innerException)
+ {
+ this.fileName = fileName;
+ }
+
+ protected FileNotFoundException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ fileName = info.GetString ("FileNotFound_FileName");
+ fusionLog = info.GetString ("FileNotFound_FusionLog");
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ public override string Message
+ {
+ get {
+ if (base.Message == null)
+ return "File not found";
+
+ if (fileName == null)
+ return base.Message;
+
+ return "File '" + fileName + "' not found.";
+ }
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("FileNotFound_FileName", fileName);
+ info.AddValue ("FileNotFound_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ string result = GetType ().FullName + ": " + Message;
+ if (InnerException != null)
+ result += " ----> " + InnerException.ToString ();
+
+ if (StackTrace != null)
+ result += "\n" + StackTrace;
+
+ return result;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileShare.cs b/mcs/class/corlib/System.IO/FileShare.cs
new file mode 100644
index 00000000000..8e4fac4eef7
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileShare.cs
@@ -0,0 +1,28 @@
+// FileShare.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:26 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileShare : int {
+
+ None = 0,
+ Read = 1,
+ Write = 2,
+ ReadWrite = 3,
+ Inheritable = 16,
+ } // FileShare
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs
new file mode 100644
index 00000000000..b5fef581589
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileStream.cs
@@ -0,0 +1,487 @@
+//
+// System.IO/FileStream.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+// FIXME: emit the correct exceptions everywhere. add error handling.
+
+namespace System.IO
+{
+
+ public class FileStream : Stream
+ {
+ // construct from handle
+
+ public FileStream (IntPtr handle, FileAccess access)
+ : this (handle, access, true, DefaultBufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle)
+ : this (handle, access, ownsHandle, DefaultBufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
+ : this (handle, access, ownsHandle, bufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
+ {
+ this.handle = handle;
+ this.access = access;
+ this.owner = ownsHandle;
+ this.async = isAsync;
+
+ MonoIOError error;
+
+ if(MonoIO.GetFileType (handle, out error) ==
+ MonoFileType.Disk) {
+ this.canseek = true;
+ } else {
+ this.canseek = false;
+ }
+
+ InitBuffer (bufferSize);
+ }
+
+ // construct from filename
+
+ public FileStream (string name, FileMode mode)
+ : this (name, mode, FileAccess.ReadWrite, FileShare.ReadWrite, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access)
+ : this (name, mode, access, FileShare.ReadWrite, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share)
+ : this (name, mode, access, share, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize)
+ : this (name, mode, access, share, bufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync)
+ {
+ if (name == null) {
+ throw new ArgumentNullException ("Name is null");
+ }
+
+ if (name == "") {
+ throw new ArgumentException ("Name is empty");
+ }
+
+ if (name.IndexOfAny (Path.InvalidPathChars) != -1) {
+ throw new ArgumentException ("Name has invalid chars");
+ }
+
+ if (Directory.Exists (name)) {
+ throw new UnauthorizedAccessException ("Access to the path '" + Path.GetFullPath (name) + "' is denied.");
+ }
+
+ this.name = name;
+
+ // TODO: demand permissions
+
+ MonoIOError error;
+
+ this.handle = MonoIO.Open (name, mode, access, share,
+ out error);
+ if (handle == MonoIO.InvalidHandle) {
+ throw MonoIO.GetException (name, error);
+ }
+
+ this.access = access;
+ this.owner = true;
+ this.async = isAsync;
+
+ /* Can we open non-files by name? */
+
+ if (MonoIO.GetFileType (handle, out error) ==
+ MonoFileType.Disk) {
+ this.canseek = true;
+ } else {
+ this.canseek = false;
+ }
+
+ InitBuffer (bufferSize);
+ }
+
+ // properties
+
+ public override bool CanRead {
+ get {
+ return access == FileAccess.Read ||
+ access == FileAccess.ReadWrite;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return access == FileAccess.Write ||
+ access == FileAccess.ReadWrite;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return(canseek);
+ }
+ }
+
+ public virtual bool IsAsync {
+ get {
+ return (async);
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override long Length {
+ get {
+ MonoIOError error;
+
+ return MonoIO.GetLength (handle, out error);
+ }
+ }
+
+ public override long Position {
+ get {
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ return(buf_start + buf_offset);
+ }
+ set {
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ if(value < 0) {
+ throw new ArgumentOutOfRangeException("Attempt to set the position to a negative value");
+ }
+
+ Seek (value, SeekOrigin.Begin);
+ }
+ }
+
+ public virtual IntPtr Handle {
+ get { return handle; }
+ }
+
+ // methods
+
+ public override int ReadByte ()
+ {
+ if (buf_offset >= buf_length) {
+ RefillBuffer ();
+
+ if (buf_length == 0)
+ return -1;
+ }
+
+ return buf [buf_offset ++];
+ }
+
+ public override void WriteByte (byte value)
+ {
+ if (buf_offset == buf_size)
+ FlushBuffer ();
+
+ buf [buf_offset ++] = value;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
+
+ buf_dirty = true;
+ }
+
+ public override int Read (byte[] dest, int dest_offset, int count)
+ {
+ int copied = 0;
+
+ int n = ReadSegment (dest, dest_offset, count);
+ copied += n;
+ count -= n;
+
+ if (count == 0) {
+ /* If there was already enough
+ * buffered, no need to read more from
+ * the file.
+ */
+ return (copied);
+ }
+
+ if (count > buf_size) {
+ /* Read as much as we can, up to count
+ * bytes
+ */
+ FlushBuffer();
+ n = ReadData (handle, dest,
+ dest_offset+copied, count);
+
+ /* Make the next buffer read start
+ * from the right place
+ */
+ buf_start += n;
+ } else {
+ RefillBuffer ();
+ n = ReadSegment (dest, dest_offset+copied,
+ count);
+ }
+
+ copied += n;
+
+ return(copied);
+ }
+
+ public override void Write (byte[] src, int src_offset, int count)
+ {
+ int copied = 0;
+ while (count > 0) {
+ int n = WriteSegment (src, src_offset + copied, count);
+ copied += n;
+ count -= n;
+
+ if (count == 0)
+ break;
+
+ FlushBuffer ();
+
+ if (count > buf_size) {
+ // shortcut for long writes
+ MonoIOError error;
+
+ MonoIO.Write (handle, src, src_offset + copied, count, out error);
+ buf_start += count;
+ break;
+ }
+ }
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ long pos;
+
+ // make absolute
+
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ switch (origin) {
+ case SeekOrigin.End:
+ pos = Length + offset;
+ break;
+
+ case SeekOrigin.Current:
+ pos = Position + offset;
+ break;
+
+ case SeekOrigin.Begin: default:
+ pos = offset;
+ break;
+ }
+
+ if (pos < 0) {
+ /* LAMESPEC: shouldn't this be
+ * ArgumentOutOfRangeException?
+ */
+ throw new ArgumentException("Attempted to Seek before the beginning of the stream");
+ }
+
+ if (pos >= buf_start && pos <= buf_start + buf_length) {
+ buf_offset = (int) (pos - buf_start);
+ return pos;
+ }
+
+ FlushBuffer ();
+
+ MonoIOError error;
+
+ buf_start = MonoIO.Seek (handle, pos,
+ SeekOrigin.Begin, out error);
+
+ return buf_start;
+ }
+
+ public override void SetLength (long length)
+ {
+ if(CanSeek == false) {
+ throw new NotSupportedException("The stream does not support seeking");
+ }
+
+ if(CanWrite == false) {
+ throw new NotSupportedException("The stream does not support writing");
+ }
+
+ if(length < 0) {
+ throw new ArgumentOutOfRangeException("Length is less than 0");
+ }
+
+ Flush ();
+
+ MonoIOError error;
+
+ MonoIO.SetLength (handle, length, out error);
+ }
+
+ public override void Flush ()
+ {
+ FlushBuffer ();
+
+ //
+ // The flushing is not actually required, in the mono runtime we were
+ // mapping flush to `fsync' which is not the same.
+ //
+ //MonoIO.Flush (handle);
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // remove from finalize queue
+ }
+
+ // protected
+
+ ~FileStream ()
+ {
+ Dispose (false);
+ }
+
+ protected virtual void Dispose (bool disposing) {
+ if (handle != MonoIO.InvalidHandle) {
+ FlushBuffer ();
+
+ MonoIOError error;
+
+ MonoIO.Close (handle, out error);
+
+ handle = MonoIO.InvalidHandle;
+ }
+
+ if (disposing) {
+ buf = null;
+ }
+ }
+
+ // private
+
+ private int ReadSegment (byte [] dest, int dest_offset, int count)
+ {
+ if (count > buf_length - buf_offset)
+ count = buf_length - buf_offset;
+
+ if (count > 0) {
+ Buffer.BlockCopy (buf, buf_offset, dest, dest_offset, count);
+ buf_offset += count;
+ }
+
+ return count;
+ }
+
+ private int WriteSegment (byte [] src, int src_offset, int count)
+ {
+ if (count > buf_size - buf_offset)
+ count = buf_size - buf_offset;
+
+ if (count > 0) {
+ Buffer.BlockCopy (src, src_offset, buf, buf_offset, count);
+ buf_offset += count;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
+
+ buf_dirty = true;
+ }
+
+ return count;
+ }
+
+ private void FlushBuffer ()
+ {
+ if (buf_dirty) {
+ MonoIOError error;
+
+ if (CanSeek == true) {
+ MonoIO.Seek (handle, buf_start,
+ SeekOrigin.Begin,
+ out error);
+ }
+ MonoIO.Write (handle, buf, 0, buf_length,
+ out error);
+ }
+
+ buf_start += buf_length;
+ buf_offset = buf_length = 0;
+ buf_dirty = false;
+ }
+
+ private void RefillBuffer ()
+ {
+ FlushBuffer();
+
+ buf_length = ReadData (handle, buf, 0, buf_size);
+ }
+
+ private int ReadData (IntPtr handle, byte[] buf, int offset,
+ int count)
+ {
+ MonoIOError error;
+
+ int amount = MonoIO.Read (handle, buf, offset, count,
+ out error);
+
+ /* Check for read error */
+ if(amount == -1) {
+ /* Kludge around broken pipes */
+ if(error == MonoIOError.ERROR_BROKEN_PIPE) {
+ amount = 0;
+ } else {
+ throw new IOException ();
+ }
+ }
+
+ return(amount);
+ }
+
+
+ private void InitBuffer (int size)
+ {
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("Buffer size cannot be negative.");
+ if (size < 8)
+ size = 8;
+
+ buf = new byte [size];
+ buf_size = size;
+ buf_start = 0;
+ buf_offset = buf_length = 0;
+ buf_dirty = false;
+ }
+
+ // fields
+
+ private static int DefaultBufferSize = 8192;
+
+ private FileAccess access;
+ private bool owner;
+ private bool async;
+ private bool canseek;
+
+ private byte [] buf; // the buffer
+ private int buf_size; // capacity in bytes
+ private int buf_length; // number of valid bytes in buffer
+ private int buf_offset; // position of next byte
+ private bool buf_dirty; // true if buffer has been written to
+ private long buf_start; // location of buffer in file
+ private string name = "[Unknown]"; // name of file.
+
+ IntPtr handle; // handle to underlying file
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileSystemInfo.cs b/mcs/class/corlib/System.IO/FileSystemInfo.cs
new file mode 100644
index 00000000000..80f481b04f1
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileSystemInfo.cs
@@ -0,0 +1,149 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileSystemInfo.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class FileSystemInfo : MarshalByRefObject {
+ // public properties
+
+ public abstract bool Exists { get; }
+
+ public abstract string Name { get; }
+
+ public virtual string FullName {
+ get {
+ return FullPath;
+ }
+ }
+
+ public string Extension {
+ get {
+ return Path.GetExtension (Name);
+ }
+ }
+
+ public FileAttributes Attributes {
+ get {
+ Refresh (false);
+ return stat.Attributes;
+ }
+
+ set {
+ MonoIOError error;
+
+ if (!MonoIO.SetFileAttributes (FullName,
+ value,
+ out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ public DateTime CreationTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.CreationTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (FullName, filetime,
+ -1, -1, out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ public DateTime LastAccessTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.LastAccessTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (FullName, -1,
+ filetime, -1,
+ out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ public DateTime LastWriteTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.LastWriteTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ MonoIOError error;
+
+ if (!MonoIO.SetFileTime (FullName, -1, -1,
+ filetime, out error))
+ throw MonoIO.GetException (error);
+ }
+ }
+
+ // public methods
+
+ public abstract void Delete ();
+
+ public void Refresh ()
+ {
+ Refresh (true);
+ }
+
+ // protected
+
+ protected FileSystemInfo ()
+ {
+ this.valid = false;
+ this.FullPath = null;
+ }
+
+ protected string FullPath;
+ protected string OriginalPath;
+
+ // internal
+
+ internal void Refresh (bool force)
+ {
+ if (valid && !force)
+ return;
+
+ MonoIOError error;
+
+ MonoIO.GetFileStat (FullName, out stat, out error);
+ valid = true;
+ }
+
+ internal void CheckPath (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Invalid characters in path.");
+ }
+
+ internal MonoIOStat stat;
+ internal bool valid;
+ }
+}
diff --git a/mcs/class/corlib/System.IO/IOException.cs b/mcs/class/corlib/System.IO/IOException.cs
new file mode 100644
index 00000000000..74593cd03cf
--- /dev/null
+++ b/mcs/class/corlib/System.IO/IOException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.IOException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class IOException : SystemException {
+
+ // Constructors
+ public IOException ()
+ : base ("I/O Error")
+ {
+ }
+
+ public IOException (string message)
+ : base (message)
+ {
+ }
+
+ public IOException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected IOException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public IOException (string message, int hresult)
+ : base (message)
+ {
+ this.HResult = hresult;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs
new file mode 100644
index 00000000000..3d703db8e7f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MemoryStream.cs
@@ -0,0 +1,398 @@
+//
+// System.IO.MemoryStream
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Clarify some of the lamespec issues
+//
+
+namespace System.IO {
+ [Serializable]
+ public class MemoryStream : Stream {
+ private bool canRead;
+ private bool canSeek;
+ private bool canWrite;
+
+ private bool allowGetBuffer;
+
+ private int capacity;
+
+ private byte[] internalBuffer;
+
+ private int initialLength;
+ private bool expandable;
+
+ private bool streamClosed = false;
+
+ private long position = 0;
+
+ public MemoryStream() {
+ canRead = true;
+ canSeek = true;
+ canWrite = true;
+
+ capacity = 0;
+
+ internalBuffer = new byte[0];
+
+ allowGetBuffer = true;
+ expandable = true;
+ }
+
+ public MemoryStream( byte[] buffer ) {
+ InternalConstructor( buffer, 0, buffer.Length, true, false );
+ }
+
+ public MemoryStream( int capacity ) {
+
+ canRead = true;
+ canSeek = true;
+ canWrite = true;
+
+ this.capacity = capacity;
+ initialLength = 0;
+ internalBuffer = new byte[ 0 ];
+
+ expandable = true;
+ allowGetBuffer = true;
+ }
+
+ public MemoryStream( byte[] buffer, bool writeable ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, 0, buffer.Length, writeable, true );
+
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, index, count, true, false );
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count, bool writeable ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, index, count, writeable, true );
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count, bool writeable, bool publicallyVisible ) {
+ InternalConstructor( buffer, index, count, writeable, publicallyVisible );
+ }
+
+ private void InternalConstructor( byte[] buffer, int index, int count, bool writeable, bool publicallyVisible ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if ( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if ( buffer.Length - index < count ) {
+ throw new ArgumentException();
+ }
+
+ // LAMESPEC: The spec says to throw an UnauthorisedAccessException if
+ // publicallyVisibile is fale?! Doesn't that defy the point of having
+ // it there in the first place. I'll leave it out for now.
+
+ canRead = true;
+ canSeek = true;
+ canWrite = writeable;
+
+ initialLength = count;
+
+ internalBuffer = new byte[ count ];
+ capacity = count;
+
+ Array.Copy( buffer, index, internalBuffer, 0, count );
+
+ allowGetBuffer = publicallyVisible;
+ expandable = false;
+ }
+
+ public override bool CanRead {
+ get {
+ return this.canRead;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return this.canSeek;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return this.canWrite;
+ }
+ }
+
+ public virtual int Capacity {
+ get {
+ return this.capacity;
+ }
+
+ set {
+ if( value < 0 || value < capacity ) {
+ throw new ArgumentOutOfRangeException("value",
+ "New capacity cannot be negative or less than the current capacity" );
+ } else if( !expandable ) {
+ throw new NotSupportedException( "Cannot expand this MemoryStream" );
+ }
+
+ byte[] newBuffer = new byte[ value ];
+ Array.Copy( internalBuffer, 0, newBuffer, 0, capacity );
+ capacity = value;
+ }
+ }
+
+ public override long Length {
+ get {
+ // LAMESPEC: The spec says to throw an IOException if the
+ // stream is closed and an ObjectDisposedException if
+ // "methods were called after the stream was closed". What
+ // is the difference?
+
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ return internalBuffer.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ return position;
+ }
+
+ set {
+
+ if( position < 0 ) {
+ throw new ArgumentOutOfRangeException ("value", "Position cannot be negative" );
+ } else if (position > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException ("value",
+ "Length must be non-negative and less than 2^31 - 1 - origin");
+ } else if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ position = value;
+ }
+ }
+
+ public override void Close() {
+ if( streamClosed ) {
+ return;
+ }
+
+ streamClosed = true;
+ internalBuffer = null;
+ }
+
+ public override void Flush() { }
+
+ public virtual byte[] GetBuffer() {
+ if( !allowGetBuffer ) {
+ throw new UnauthorizedAccessException();
+ }
+
+ return internalBuffer;
+ }
+
+ public override int Read( byte[] buffer, int offset, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( offset < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( buffer.Length - offset < count ) {
+ throw new ArgumentException();
+ } else if ( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ long ReadTo;
+
+ if( position + count > internalBuffer.Length ) {
+ ReadTo = internalBuffer.Length;
+ } else {
+ ReadTo = position + (long)count;
+ }
+
+ Array.Copy( internalBuffer, (int)position, buffer, offset, (int)(ReadTo - position) );
+
+ int bytesRead = (int)(ReadTo - position);
+
+ position = ReadTo;
+
+ return bytesRead;
+ }
+
+ public override int ReadByte( ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+
+ // LAMESPEC: What happens if we're at the end of the stream? It's unspecified in the
+ // docs but tests against the MS impl. show it returns -1
+ //
+
+ if( position >= internalBuffer.Length ) {
+ return -1;
+ } else {
+ return internalBuffer[ position++ ];
+ }
+ }
+
+ public override long Seek( long offset, SeekOrigin loc ) {
+ long refPoint;
+
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ switch( loc ) {
+ case SeekOrigin.Begin:
+ refPoint = 0;
+ break;
+ case SeekOrigin.Current:
+ refPoint = position;
+ break;
+ case SeekOrigin.End:
+ refPoint = internalBuffer.Length;
+ break;
+ default:
+ throw new ArgumentException( "Invalid SeekOrigin" );
+ }
+
+ // LAMESPEC: My goodness, how may LAMESPECs are there in this
+ // class! :) In the spec for the Position property it's stated
+ // "The position must not be more than one byte beyond the end of the stream."
+ // In the spec for seek it says "Seeking to any location beyond the length of the
+ // stream is supported." That's a contradiction i'd say.
+ // I guess seek can go anywhere but if you use position it may get moved back.
+
+ if( refPoint + offset < 0 ) {
+ throw new IOException( "Attempted to seek before start of MemoryStream" );
+ } else if( offset > internalBuffer.Length ) {
+ throw new ArgumentOutOfRangeException("offset",
+ "Offset cannot be greater than length of MemoryStream" );
+ }
+
+ position = refPoint + offset;
+
+ return position;
+ }
+
+
+ public override void SetLength( long value ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ } else if( !expandable && value > capacity ) {
+ throw new NotSupportedException( "Expanding this MemoryStream is not supported" );
+ } else if( !canWrite ) {
+ throw new IOException( "Cannot write to this MemoryStream" );
+ } else if( value < 0 ) {
+
+ // LAMESPEC: AGAIN! It says to throw this exception if value is
+ // greater than "the maximum length of the MemoryStream". I haven't
+ // seen anywhere mention what the maximum length of a MemoryStream is and
+ // since we're this far this memory stream is expandable.
+
+ throw new ArgumentOutOfRangeException();
+ }
+
+ byte[] newBuffer;
+ newBuffer = new byte[ value ];
+
+ if (value < internalBuffer.Length) {
+ // truncate
+ Array.Copy( internalBuffer, 0, newBuffer, 0, (int)value );
+ } else {
+ // expand
+ Array.Copy( internalBuffer, 0, newBuffer, 0, internalBuffer.Length );
+ }
+ internalBuffer = newBuffer;
+ capacity = (int)value;
+
+ }
+
+
+ public virtual byte[] ToArray() {
+ byte[] outBuffer = new byte[capacity];
+ Array.Copy( internalBuffer, 0, outBuffer, 0, capacity);
+ return outBuffer;
+ }
+
+ public override void Write( byte[] buffer, int offset, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( !canWrite ) {
+ throw new NotSupportedException();
+ } else if( buffer.Length - offset < count ) {
+ throw new ArgumentException();
+ } else if( offset < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ if( position + count > capacity ) {
+ if( expandable ) {
+ // expand the buffer
+ SetLength( position + count );
+ } else {
+ // only write as many bytes as will fit
+ count = (int)((long)capacity - position);
+ }
+ }
+
+ // internal buffer may not be allocated all the way up to capacity
+ // count will already be limited to capacity above if non-expandable
+ if( position + count >= internalBuffer.Length )
+ SetLength( position + count );
+
+ Array.Copy( buffer, offset, internalBuffer, (int)position, count );
+ position += count;
+ }
+
+
+ public override void WriteByte( byte value ) {
+ if ( streamClosed )
+ throw new ObjectDisposedException( "MemoryStream" );
+ else if( !canWrite || (position >= capacity && !expandable))
+ throw new NotSupportedException();
+
+ if( position >= internalBuffer.Length )
+ SetLength ( position + 1 );
+
+ internalBuffer[ position++ ] = value;
+ }
+
+
+ public virtual void WriteTo( Stream stream ) {
+ if( stream == null ) {
+ throw new ArgumentNullException();
+ }
+
+ stream.Write( internalBuffer, 0, internalBuffer.Length );
+
+ }
+
+
+ }
+
+
+}
diff --git a/mcs/class/corlib/System.IO/MonoFileType.cs b/mcs/class/corlib/System.IO/MonoFileType.cs
new file mode 100755
index 00000000000..6194c6476a8
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoFileType.cs
@@ -0,0 +1,20 @@
+//
+// System.IO.MonoFileType.cs: enum for GetFileType return
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+namespace System.IO
+{
+ internal enum MonoFileType {
+ Unknown=0x0000,
+ Disk=0x0001,
+ Char=0x0002,
+ Pipe=0x0003,
+ Remote=0x8000,
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO/MonoIO.cs b/mcs/class/corlib/System.IO/MonoIO.cs
new file mode 100644
index 00000000000..6615306c24f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIO.cs
@@ -0,0 +1,267 @@
+//
+// System.IO.MonoIO.cs: static interface to native filesystem.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.IO
+{
+ internal sealed class MonoIO {
+ public static readonly FileAttributes
+ InvalidFileAttributes = (FileAttributes)(-1);
+
+ public static readonly IntPtr
+ InvalidHandle = (IntPtr)(-1);
+
+ // error methods
+
+ public static Exception GetException (MonoIOError error)
+ {
+ return GetException (String.Empty, error);
+ }
+
+ public static Exception GetException (string path,
+ MonoIOError error)
+ {
+ string message;
+
+ switch (error) {
+ // FIXME: add more exception mappings here
+ case MonoIOError.ERROR_FILE_NOT_FOUND:
+ message = String.Format ("Could not find file \"{0}\"", path);
+ return new FileNotFoundException (message);
+
+ case MonoIOError.ERROR_PATH_NOT_FOUND:
+ message = String.Format ("Could not find a part of the path \"{0}\"", path);
+ return new DirectoryNotFoundException (message);
+
+ case MonoIOError.ERROR_ACCESS_DENIED:
+ message = String.Format ("Access to the path \"{0}\" is denied.", path);
+ return new UnauthorizedAccessException (message);
+
+ default:
+ message = String.Format ("Win32 IO returned {0}", error);
+ return new IOException (message);
+ }
+ }
+
+ // directory methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CreateDirectory (string path, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool RemoveDirectory (string path, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static IntPtr FindFirstFile (string path, out MonoIOStat stat, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool FindNextFile (IntPtr find, out MonoIOStat stat, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool FindClose (IntPtr find,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static string GetCurrentDirectory (out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetCurrentDirectory (string path, out MonoIOError error);
+
+ // file methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool MoveFile (string path, string dest,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CopyFile (string path, string dest,
+ bool overwrite,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool DeleteFile (string path,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static FileAttributes GetFileAttributes (string path, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetFileAttributes (string path, FileAttributes attrs, out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static MonoFileType GetFileType (IntPtr handle, out MonoIOError error);
+
+ public static bool Exists (string path, out MonoIOError error)
+ {
+ FileAttributes attrs = GetFileAttributes (path,
+ out error);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ return true;
+ }
+
+ public static bool ExistsFile (string path,
+ out MonoIOError error)
+ {
+ FileAttributes attrs = GetFileAttributes (path,
+ out error);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ if ((attrs & FileAttributes.Directory) != 0)
+ return false;
+
+ return true;
+ }
+
+ public static bool ExistsDirectory (string path,
+ out MonoIOError error)
+ {
+ FileAttributes attrs = GetFileAttributes (path,
+ out error);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ if ((attrs & FileAttributes.Directory) == 0)
+ return false;
+
+ return true;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool GetFileStat (string path,
+ out MonoIOStat stat,
+ out MonoIOError error);
+
+ // handle methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static IntPtr Open (string filename,
+ FileMode mode,
+ FileAccess access,
+ FileShare share,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Close (IntPtr handle,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static int Read (IntPtr handle, byte [] dest,
+ int dest_offset, int count,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static int Write (IntPtr handle, byte [] src,
+ int src_offset, int count,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long Seek (IntPtr handle, long offset,
+ SeekOrigin origin,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Flush (IntPtr handle,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long GetLength (IntPtr handle,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetLength (IntPtr handle,
+ long length,
+ out MonoIOError error);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetFileTime (IntPtr handle,
+ long creation_time,
+ long last_access_time,
+ long last_write_time,
+ out MonoIOError error);
+
+ public static bool SetFileTime (string path,
+ long creation_time,
+ long last_access_time,
+ long last_write_time,
+ out MonoIOError error)
+ {
+ IntPtr handle;
+ bool result;
+
+ handle = Open (path, FileMode.Open,
+ FileAccess.ReadWrite,
+ FileShare.ReadWrite, out error);
+ if (handle == IntPtr.Zero)
+ return false;
+
+ result = SetFileTime (handle, creation_time,
+ last_access_time,
+ last_write_time, out error);
+ Close (handle, out error);
+
+ return result;
+ }
+
+ // console handles
+
+ public extern static IntPtr ConsoleOutput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleInput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleError {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ // pipe handles
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CreatePipe (out IntPtr read_handle, out IntPtr write_handle);
+
+ // path characters
+
+ public extern static char VolumeSeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char DirectorySeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char AltDirectorySeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char PathSeparator {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char [] InvalidPathChars {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.IO/MonoIOError.cs b/mcs/class/corlib/System.IO/MonoIOError.cs
new file mode 100644
index 00000000000..e0f43fc0367
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIOError.cs
@@ -0,0 +1,1798 @@
+//
+// System.IO.MonoIOError.cs: Win32 error codes. Yuck.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal enum MonoIOError: int {
+ ERROR_SUCCESS = 0,
+ ERROR_INVALID_FUNCTION = 1,
+ ERROR_FILE_NOT_FOUND = 2,
+ ERROR_PATH_NOT_FOUND = 3,
+ ERROR_TOO_MANY_OPEN_FILES = 4,
+ ERROR_ACCESS_DENIED = 5,
+ ERROR_INVALID_HANDLE = 6,
+ ERROR_ARENA_TRASHED = 7,
+ ERROR_NOT_ENOUGH_MEMORY = 8,
+ ERROR_INVALID_BLOCK = 9,
+ ERROR_BAD_ENVIRONMENT = 10,
+ ERROR_BAD_FORMAT = 11,
+ ERROR_INVALID_ACCESS = 12,
+ ERROR_INVALID_DATA = 13,
+ ERROR_OUTOFMEMORY = 14,
+ ERROR_INVALID_DRIVE = 15,
+ ERROR_CURRENT_DIRECTORY = 16,
+ ERROR_NOT_SAME_DEVICE = 17,
+ ERROR_NO_MORE_FILES = 18,
+ ERROR_WRITE_PROTECT = 19,
+ ERROR_BAD_UNIT = 20,
+ ERROR_NOT_READY = 21,
+ ERROR_BAD_COMMAND = 22,
+ ERROR_CRC = 23,
+ ERROR_BAD_LENGTH = 24,
+ ERROR_SEEK = 25,
+ ERROR_NOT_DOS_DISK = 26,
+ ERROR_SECTOR_NOT_FOUND = 27,
+ ERROR_OUT_OF_PAPER = 28,
+ ERROR_WRITE_FAULT = 29,
+ ERROR_READ_FAULT = 30,
+ ERROR_GEN_FAILURE = 31,
+ ERROR_SHARING_VIOLATION = 32,
+ ERROR_LOCK_VIOLATION = 33,
+ ERROR_WRONG_DISK = 34,
+ ERROR_SHARING_BUFFER_EXCEEDED = 36,
+ ERROR_HANDLE_EOF = 38,
+ ERROR_HANDLE_DISK_FULL = 39,
+ ERROR_NOT_SUPPORTED = 50,
+ ERROR_REM_NOT_LIST = 51,
+ ERROR_DUP_NAME = 52,
+ ERROR_BAD_NETPATH = 53,
+ ERROR_NETWORK_BUSY = 54,
+ ERROR_DEV_NOT_EXIST = 55,
+ ERROR_TOO_MANY_CMDS = 56,
+ ERROR_ADAP_HDW_ERR = 57,
+ ERROR_BAD_NET_RESP = 58,
+ ERROR_UNEXP_NET_ERR = 59,
+ ERROR_BAD_REM_ADAP = 60,
+ ERROR_PRINTQ_FULL = 61,
+ ERROR_NO_SPOOL_SPACE = 62,
+ ERROR_PRINT_CANCELLED = 63,
+ ERROR_NETNAME_DELETED = 64,
+ ERROR_NETWORK_ACCESS_DENIED = 65,
+ ERROR_BAD_DEV_TYPE = 66,
+ ERROR_BAD_NET_NAME = 67,
+ ERROR_TOO_MANY_NAMES = 68,
+ ERROR_TOO_MANY_SESS = 69,
+ ERROR_SHARING_PAUSED = 70,
+ ERROR_REQ_NOT_ACCEP = 71,
+ ERROR_REDIR_PAUSED = 72,
+ ERROR_FILE_EXISTS = 80,
+ ERROR_CANNOT_MAKE = 82,
+ ERROR_FAIL_I24 = 83,
+ ERROR_OUT_OF_STRUCTURES = 84,
+ ERROR_ALREADY_ASSIGNED = 85,
+ ERROR_INVALID_PASSWORD = 86,
+ ERROR_INVALID_PARAMETER = 87,
+ ERROR_NET_WRITE_FAULT = 88,
+ ERROR_NO_PROC_SLOTS = 89,
+ ERROR_TOO_MANY_SEMAPHORES = 100,
+ ERROR_EXCL_SEM_ALREADY_OWNED = 101,
+ ERROR_SEM_IS_SET = 102,
+ ERROR_TOO_MANY_SEM_REQUESTS = 103,
+ ERROR_INVALID_AT_INTERRUPT_TIME = 104,
+ ERROR_SEM_OWNER_DIED = 105,
+ ERROR_SEM_USER_LIMIT = 106,
+ ERROR_DISK_CHANGE = 107,
+ ERROR_DRIVE_LOCKED = 108,
+ ERROR_BROKEN_PIPE = 109,
+ ERROR_OPEN_FAILED = 110,
+ ERROR_BUFFER_OVERFLOW = 111,
+ ERROR_DISK_FULL = 112,
+ ERROR_NO_MORE_SEARCH_HANDLES = 113,
+ ERROR_INVALID_TARGET_HANDLE = 114,
+ ERROR_INVALID_CATEGORY = 117,
+ ERROR_INVALID_VERIFY_SWITCH = 118,
+ ERROR_BAD_DRIVER_LEVEL = 119,
+ ERROR_CALL_NOT_IMPLEMENTED = 120,
+ ERROR_SEM_TIMEOUT = 121,
+ ERROR_INSUFFICIENT_BUFFER = 122,
+ ERROR_INVALID_NAME = 123,
+ ERROR_INVALID_LEVEL = 124,
+ ERROR_NO_VOLUME_LABEL = 125,
+ ERROR_MOD_NOT_FOUND = 126,
+ ERROR_PROC_NOT_FOUND = 127,
+ ERROR_WAIT_NO_CHILDREN = 128,
+ ERROR_CHILD_NOT_COMPLETE = 129,
+ ERROR_DIRECT_ACCESS_HANDLE = 130,
+ ERROR_NEGATIVE_SEEK = 131,
+ ERROR_SEEK_ON_DEVICE = 132,
+ ERROR_IS_JOIN_TARGET = 133,
+ ERROR_IS_JOINED = 134,
+ ERROR_IS_SUBSTED = 135,
+ ERROR_NOT_JOINED = 136,
+ ERROR_NOT_SUBSTED = 137,
+ ERROR_JOIN_TO_JOIN = 138,
+ ERROR_SUBST_TO_SUBST = 139,
+ ERROR_JOIN_TO_SUBST = 140,
+ ERROR_SUBST_TO_JOIN = 141,
+ ERROR_BUSY_DRIVE = 142,
+ ERROR_SAME_DRIVE = 143,
+ ERROR_DIR_NOT_ROOT = 144,
+ ERROR_DIR_NOT_EMPTY = 145,
+ ERROR_IS_SUBST_PATH = 146,
+ ERROR_IS_JOIN_PATH = 147,
+ ERROR_PATH_BUSY = 148,
+ ERROR_IS_SUBST_TARGET = 149,
+ ERROR_SYSTEM_TRACE = 150,
+ ERROR_INVALID_EVENT_COUNT = 151,
+ ERROR_TOO_MANY_MUXWAITERS = 152,
+ ERROR_INVALID_LIST_FORMAT = 153,
+ ERROR_LABEL_TOO_LONG = 154,
+ ERROR_TOO_MANY_TCBS = 155,
+ ERROR_SIGNAL_REFUSED = 156,
+ ERROR_DISCARDED = 157,
+ ERROR_NOT_LOCKED = 158,
+ ERROR_BAD_THREADID_ADDR = 159,
+ ERROR_BAD_ARGUMENTS = 160,
+ ERROR_BAD_PATHNAME = 161,
+ ERROR_SIGNAL_PENDING = 162,
+ ERROR_MAX_THRDS_REACHED = 164,
+ ERROR_LOCK_FAILED = 167,
+ ERROR_BUSY = 170,
+ ERROR_CANCEL_VIOLATION = 173,
+ ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174,
+ ERROR_INVALID_SEGMENT_NUMBER = 180,
+ ERROR_INVALID_ORDINAL = 182,
+ ERROR_ALREADY_EXISTS = 183,
+ ERROR_INVALID_FLAG_NUMBER = 186,
+ ERROR_SEM_NOT_FOUND = 187,
+ ERROR_INVALID_STARTING_CODESEG = 188,
+ ERROR_INVALID_STACKSEG = 189,
+ ERROR_INVALID_MODULETYPE = 190,
+ ERROR_INVALID_EXE_SIGNATURE = 191,
+ ERROR_EXE_MARKED_INVALID = 192,
+ ERROR_BAD_EXE_FORMAT = 193,
+ ERROR_ITERATED_DATA_EXCEEDS_64k = 194,
+ ERROR_INVALID_MINALLOCSIZE = 195,
+ ERROR_DYNLINK_FROM_INVALID_RING = 196,
+ ERROR_IOPL_NOT_ENABLED = 197,
+ ERROR_INVALID_SEGDPL = 198,
+ ERROR_AUTODATASEG_EXCEEDS_64k = 199,
+ ERROR_RING2SEG_MUST_BE_MOVABLE = 200,
+ ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201,
+ ERROR_INFLOOP_IN_RELOC_CHAIN = 202,
+ ERROR_ENVVAR_NOT_FOUND = 203,
+ ERROR_NO_SIGNAL_SENT = 205,
+ ERROR_FILENAME_EXCED_RANGE = 206,
+ ERROR_RING2_STACK_IN_USE = 207,
+ ERROR_META_EXPANSION_TOO_LONG = 208,
+ ERROR_INVALID_SIGNAL_NUMBER = 209,
+ ERROR_THREAD_1_INACTIVE = 210,
+ ERROR_LOCKED = 212,
+ ERROR_TOO_MANY_MODULES = 214,
+ ERROR_NESTING_NOT_ALLOWED = 215,
+ ERROR_EXE_MACHINE_TYPE_MISMATCH = 216,
+ ERROR_BAD_PIPE = 230,
+ ERROR_PIPE_BUSY = 231,
+ ERROR_NO_DATA = 232,
+ ERROR_PIPE_NOT_CONNECTED = 233,
+ ERROR_MORE_DATA = 234,
+ ERROR_VC_DISCONNECTED = 240,
+ ERROR_INVALID_EA_NAME = 254,
+ ERROR_EA_LIST_INCONSISTENT = 255,
+ WAIT_TIMEOUT = 258,
+ ERROR_NO_MORE_ITEMS = 259,
+ ERROR_CANNOT_COPY = 266,
+ ERROR_DIRECTORY = 267,
+ ERROR_EAS_DIDNT_FIT = 275,
+ ERROR_EA_FILE_CORRUPT = 276,
+ ERROR_EA_TABLE_FULL = 277,
+ ERROR_INVALID_EA_HANDLE = 278,
+ ERROR_EAS_NOT_SUPPORTED = 282,
+ ERROR_NOT_OWNER = 288,
+ ERROR_TOO_MANY_POSTS = 298,
+ ERROR_PARTIAL_COPY = 299,
+ ERROR_OPLOCK_NOT_GRANTED = 300,
+ ERROR_INVALID_OPLOCK_PROTOCOL = 301,
+ ERROR_DISK_TOO_FRAGMENTED = 302,
+ ERROR_DELETE_PENDING = 303,
+ ERROR_MR_MID_NOT_FOUND = 317,
+ ERROR_INVALID_ADDRESS = 487,
+ ERROR_ARITHMETIC_OVERFLOW = 534,
+ ERROR_PIPE_CONNECTED = 535,
+ ERROR_PIPE_LISTENING = 536,
+ ERROR_EA_ACCESS_DENIED = 994,
+ ERROR_OPERATION_ABORTED = 995,
+ ERROR_IO_INCOMPLETE = 996,
+ ERROR_IO_PENDING = 997,
+ ERROR_NOACCESS = 998,
+ ERROR_SWAPERROR = 999,
+ ERROR_STACK_OVERFLOW = 1001,
+ ERROR_INVALID_MESSAGE = 1002,
+ ERROR_CAN_NOT_COMPLETE = 1003,
+ ERROR_INVALID_FLAGS = 1004,
+ ERROR_UNRECOGNIZED_VOLUME = 1005,
+ ERROR_FILE_INVALID = 1006,
+ ERROR_FULLSCREEN_MODE = 1007,
+ ERROR_NO_TOKEN = 1008,
+ ERROR_BADDB = 1009,
+ ERROR_BADKEY = 1010,
+ ERROR_CANTOPEN = 1011,
+ ERROR_CANTREAD = 1012,
+ ERROR_CANTWRITE = 1013,
+ ERROR_REGISTRY_RECOVERED = 1014,
+ ERROR_REGISTRY_CORRUPT = 1015,
+ ERROR_REGISTRY_IO_FAILED = 1016,
+ ERROR_NOT_REGISTRY_FILE = 1017,
+ ERROR_KEY_DELETED = 1018,
+ ERROR_NO_LOG_SPACE = 1019,
+ ERROR_KEY_HAS_CHILDREN = 1020,
+ ERROR_CHILD_MUST_BE_VOLATILE = 1021,
+ ERROR_NOTIFY_ENUM_DIR = 1022,
+ ERROR_DEPENDENT_SERVICES_RUNNING = 1051,
+ ERROR_INVALID_SERVICE_CONTROL = 1052,
+ ERROR_SERVICE_REQUEST_TIMEOUT = 1053,
+ ERROR_SERVICE_NO_THREAD = 1054,
+ ERROR_SERVICE_DATABASE_LOCKED = 1055,
+ ERROR_SERVICE_ALREADY_RUNNING = 1056,
+ ERROR_INVALID_SERVICE_ACCOUNT = 1057,
+ ERROR_SERVICE_DISABLED = 1058,
+ ERROR_CIRCULAR_DEPENDENCY = 1059,
+ ERROR_SERVICE_DOES_NOT_EXIST = 1060,
+ ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061,
+ ERROR_SERVICE_NOT_ACTIVE = 1062,
+ ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063,
+ ERROR_EXCEPTION_IN_SERVICE = 1064,
+ ERROR_DATABASE_DOES_NOT_EXIST = 1065,
+ ERROR_SERVICE_SPECIFIC_ERROR = 1066,
+ ERROR_PROCESS_ABORTED = 1067,
+ ERROR_SERVICE_DEPENDENCY_FAIL = 1068,
+ ERROR_SERVICE_LOGON_FAILED = 1069,
+ ERROR_SERVICE_START_HANG = 1070,
+ ERROR_INVALID_SERVICE_LOCK = 1071,
+ ERROR_SERVICE_MARKED_FOR_DELETE = 1072,
+ ERROR_SERVICE_EXISTS = 1073,
+ ERROR_ALREADY_RUNNING_LKG = 1074,
+ ERROR_SERVICE_DEPENDENCY_DELETED = 1075,
+ ERROR_BOOT_ALREADY_ACCEPTED = 1076,
+ ERROR_SERVICE_NEVER_STARTED = 1077,
+ ERROR_DUPLICATE_SERVICE_NAME = 1078,
+ ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079,
+ ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080,
+ ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081,
+ ERROR_NO_RECOVERY_PROGRAM = 1082,
+ ERROR_SERVICE_NOT_IN_EXE = 1083,
+ ERROR_NOT_SAFEBOOT_SERVICE = 1084,
+ ERROR_END_OF_MEDIA = 1100,
+ ERROR_FILEMARK_DETECTED = 1101,
+ ERROR_BEGINNING_OF_MEDIA = 1102,
+ ERROR_SETMARK_DETECTED = 1103,
+ ERROR_NO_DATA_DETECTED = 1104,
+ ERROR_PARTITION_FAILURE = 1105,
+ ERROR_INVALID_BLOCK_LENGTH = 1106,
+ ERROR_DEVICE_NOT_PARTITIONED = 1107,
+ ERROR_UNABLE_TO_LOCK_MEDIA = 1108,
+ ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109,
+ ERROR_MEDIA_CHANGED = 1110,
+ ERROR_BUS_RESET = 1111,
+ ERROR_NO_MEDIA_IN_DRIVE = 1112,
+ ERROR_NO_UNICODE_TRANSLATION = 1113,
+ ERROR_DLL_INIT_FAILED = 1114,
+ ERROR_SHUTDOWN_IN_PROGRESS = 1115,
+ ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116,
+ ERROR_IO_DEVICE = 1117,
+ ERROR_SERIAL_NO_DEVICE = 1118,
+ ERROR_IRQ_BUSY = 1119,
+ ERROR_MORE_WRITES = 1120,
+ ERROR_COUNTER_TIMEOUT = 1121,
+ ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122,
+ ERROR_FLOPPY_WRONG_CYLINDER = 1123,
+ ERROR_FLOPPY_UNKNOWN_ERROR = 1124,
+ ERROR_FLOPPY_BAD_REGISTERS = 1125,
+ ERROR_DISK_RECALIBRATE_FAILED = 1126,
+ ERROR_DISK_OPERATION_FAILED = 1127,
+ ERROR_DISK_RESET_FAILED = 1128,
+ ERROR_EOM_OVERFLOW = 1129,
+ ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130,
+ ERROR_POSSIBLE_DEADLOCK = 1131,
+ ERROR_MAPPED_ALIGNMENT = 1132,
+ ERROR_SET_POWER_STATE_VETOED = 1140,
+ ERROR_SET_POWER_STATE_FAILED = 1141,
+ ERROR_TOO_MANY_LINKS = 1142,
+ ERROR_OLD_WIN_VERSION = 1150,
+ ERROR_APP_WRONG_OS = 1151,
+ ERROR_SINGLE_INSTANCE_APP = 1152,
+ ERROR_RMODE_APP = 1153,
+ ERROR_INVALID_DLL = 1154,
+ ERROR_NO_ASSOCIATION = 1155,
+ ERROR_DDE_FAIL = 1156,
+ ERROR_DLL_NOT_FOUND = 1157,
+ ERROR_NO_MORE_USER_HANDLES = 1158,
+ ERROR_MESSAGE_SYNC_ONLY = 1159,
+ ERROR_SOURCE_ELEMENT_EMPTY = 1160,
+ ERROR_DESTINATION_ELEMENT_FULL = 1161,
+ ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162,
+ ERROR_MAGAZINE_NOT_PRESENT = 1163,
+ ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164,
+ ERROR_DEVICE_REQUIRES_CLEANING = 1165,
+ ERROR_DEVICE_DOOR_OPEN = 1166,
+ ERROR_DEVICE_NOT_CONNECTED = 1167,
+ ERROR_NOT_FOUND = 1168,
+ ERROR_NO_MATCH = 1169,
+ ERROR_SET_NOT_FOUND = 1170,
+ ERROR_POINT_NOT_FOUND = 1171,
+ ERROR_NO_TRACKING_SERVICE = 1172,
+ ERROR_NO_VOLUME_ID = 1173,
+ ERROR_UNABLE_TO_REMOVE_REPLACED = 1175,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177,
+ ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178,
+ ERROR_JOURNAL_NOT_ACTIVE = 1179,
+ ERROR_POTENTIAL_FILE_FOUND = 1180,
+ ERROR_JOURNAL_ENTRY_DELETED = 1181,
+ ERROR_BAD_DEVICE = 1200,
+ ERROR_CONNECTION_UNAVAIL = 1201,
+ ERROR_DEVICE_ALREADY_REMEMBERED = 1202,
+ ERROR_NO_NET_OR_BAD_PATH = 1203,
+ ERROR_BAD_PROVIDER = 1204,
+ ERROR_CANNOT_OPEN_PROFILE = 1205,
+ ERROR_BAD_PROFILE = 1206,
+ ERROR_NOT_CONTAINER = 1207,
+ ERROR_EXTENDED_ERROR = 1208,
+ ERROR_INVALID_GROUPNAME = 1209,
+ ERROR_INVALID_COMPUTERNAME = 1210,
+ ERROR_INVALID_EVENTNAME = 1211,
+ ERROR_INVALID_DOMAINNAME = 1212,
+ ERROR_INVALID_SERVICENAME = 1213,
+ ERROR_INVALID_NETNAME = 1214,
+ ERROR_INVALID_SHARENAME = 1215,
+ ERROR_INVALID_PASSWORDNAME = 1216,
+ ERROR_INVALID_MESSAGENAME = 1217,
+ ERROR_INVALID_MESSAGEDEST = 1218,
+ ERROR_SESSION_CREDENTIAL_CONFLICT = 1219,
+ ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220,
+ ERROR_DUP_DOMAINNAME = 1221,
+ ERROR_NO_NETWORK = 1222,
+ ERROR_CANCELLED = 1223,
+ ERROR_USER_MAPPED_FILE = 1224,
+ ERROR_CONNECTION_REFUSED = 1225,
+ ERROR_GRACEFUL_DISCONNECT = 1226,
+ ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227,
+ ERROR_ADDRESS_NOT_ASSOCIATED = 1228,
+ ERROR_CONNECTION_INVALID = 1229,
+ ERROR_CONNECTION_ACTIVE = 1230,
+ ERROR_NETWORK_UNREACHABLE = 1231,
+ ERROR_HOST_UNREACHABLE = 1232,
+ ERROR_PROTOCOL_UNREACHABLE = 1233,
+ ERROR_PORT_UNREACHABLE = 1234,
+ ERROR_REQUEST_ABORTED = 1235,
+ ERROR_CONNECTION_ABORTED = 1236,
+ ERROR_RETRY = 1237,
+ ERROR_CONNECTION_COUNT_LIMIT = 1238,
+ ERROR_LOGIN_TIME_RESTRICTION = 1239,
+ ERROR_LOGIN_WKSTA_RESTRICTION = 1240,
+ ERROR_INCORRECT_ADDRESS = 1241,
+ ERROR_ALREADY_REGISTERED = 1242,
+ ERROR_SERVICE_NOT_FOUND = 1243,
+ ERROR_NOT_AUTHENTICATED = 1244,
+ ERROR_NOT_LOGGED_ON = 1245,
+ ERROR_CONTINUE = 1246,
+ ERROR_ALREADY_INITIALIZED = 1247,
+ ERROR_NO_MORE_DEVICES = 1248,
+ ERROR_NO_SUCH_SITE = 1249,
+ ERROR_DOMAIN_CONTROLLER_EXISTS = 1250,
+ ERROR_ONLY_IF_CONNECTED = 1251,
+ ERROR_OVERRIDE_NOCHANGES = 1252,
+ ERROR_BAD_USER_PROFILE = 1253,
+ ERROR_NOT_SUPPORTED_ON_SBS = 1254,
+ ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255,
+ ERROR_HOST_DOWN = 1256,
+ ERROR_NON_ACCOUNT_SID = 1257,
+ ERROR_NON_DOMAIN_SID = 1258,
+ ERROR_APPHELP_BLOCK = 1259,
+ ERROR_ACCESS_DISABLED_BY_POLICY = 1260,
+ ERROR_REG_NAT_CONSUMPTION = 1261,
+ ERROR_CSCSHARE_OFFLINE = 1262,
+ ERROR_PKINIT_FAILURE = 1263,
+ ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264,
+ ERROR_DOWNGRADE_DETECTED = 1265,
+ SEC_E_SMARTCARD_CERT_REVOKED = 1266,
+ SEC_E_ISSUING_CA_UNTRUSTED = 1267,
+ SEC_E_REVOCATION_OFFLINE_C = 1268,
+ SEC_E_PKINIT_CLIENT_FAILUR = 1269,
+ SEC_E_SMARTCARD_CERT_EXPIRED = 1270,
+ ERROR_MACHINE_LOCKED = 1271,
+ ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273,
+ ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274,
+ ERROR_DRIVER_BLOCKED = 1275,
+ ERROR_INVALID_IMPORT_OF_NON_DLL = 1276,
+ ERROR_NOT_ALL_ASSIGNED = 1300,
+ ERROR_SOME_NOT_MAPPED = 1301,
+ ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302,
+ ERROR_LOCAL_USER_SESSION_KEY = 1303,
+ ERROR_NULL_LM_PASSWORD = 1304,
+ ERROR_UNKNOWN_REVISION = 1305,
+ ERROR_REVISION_MISMATCH = 1306,
+ ERROR_INVALID_OWNER = 1307,
+ ERROR_INVALID_PRIMARY_GROUP = 1308,
+ ERROR_NO_IMPERSONATION_TOKEN = 1309,
+ ERROR_CANT_DISABLE_MANDATORY = 1310,
+ ERROR_NO_LOGON_SERVERS = 1311,
+ ERROR_NO_SUCH_LOGON_SESSION = 1312,
+ ERROR_NO_SUCH_PRIVILEGE = 1313,
+ ERROR_PRIVILEGE_NOT_HELD = 1314,
+ ERROR_INVALID_ACCOUNT_NAME = 1315,
+ ERROR_USER_EXISTS = 1316,
+ ERROR_NO_SUCH_USER = 1317,
+ ERROR_GROUP_EXISTS = 1318,
+ ERROR_NO_SUCH_GROUP = 1319,
+ ERROR_MEMBER_IN_GROUP = 1320,
+ ERROR_MEMBER_NOT_IN_GROUP = 1321,
+ ERROR_LAST_ADMIN = 1322,
+ ERROR_WRONG_PASSWORD = 1323,
+ ERROR_ILL_FORMED_PASSWORD = 1324,
+ ERROR_PASSWORD_RESTRICTION = 1325,
+ ERROR_LOGON_FAILURE = 1326,
+ ERROR_ACCOUNT_RESTRICTION = 1327,
+ ERROR_INVALID_LOGON_HOURS = 1328,
+ ERROR_INVALID_WORKSTATION = 1329,
+ ERROR_PASSWORD_EXPIRED = 1330,
+ ERROR_ACCOUNT_DISABLED = 1331,
+ ERROR_NONE_MAPPED = 1332,
+ ERROR_TOO_MANY_LUIDS_REQUESTED = 1333,
+ ERROR_LUIDS_EXHAUSTED = 1334,
+ ERROR_INVALID_SUB_AUTHORITY = 1335,
+ ERROR_INVALID_ACL = 1336,
+ ERROR_INVALID_SID = 1337,
+ ERROR_INVALID_SECURITY_DESCR = 1338,
+ ERROR_BAD_INHERITANCE_ACL = 1340,
+ ERROR_SERVER_DISABLED = 1341,
+ ERROR_SERVER_NOT_DISABLED = 1342,
+ ERROR_INVALID_ID_AUTHORITY = 1343,
+ ERROR_ALLOTTED_SPACE_EXCEEDED = 1344,
+ ERROR_INVALID_GROUP_ATTRIBUTES = 1345,
+ ERROR_BAD_IMPERSONATION_LEVEL = 1346,
+ ERROR_CANT_OPEN_ANONYMOUS = 1347,
+ ERROR_BAD_VALIDATION_CLASS = 1348,
+ ERROR_BAD_TOKEN_TYPE = 1349,
+ ERROR_NO_SECURITY_ON_OBJECT = 1350,
+ ERROR_CANT_ACCESS_DOMAIN_INFO = 1351,
+ ERROR_INVALID_SERVER_STATE = 1352,
+ ERROR_INVALID_DOMAIN_STATE = 1353,
+ ERROR_INVALID_DOMAIN_ROLE = 1354,
+ ERROR_NO_SUCH_DOMAIN = 1355,
+ ERROR_DOMAIN_EXISTS = 1356,
+ ERROR_DOMAIN_LIMIT_EXCEEDED = 1357,
+ ERROR_INTERNAL_DB_CORRUPTION = 1358,
+ ERROR_INTERNAL_ERROR = 1359,
+ ERROR_GENERIC_NOT_MAPPED = 1360,
+ ERROR_BAD_DESCRIPTOR_FORMAT = 1361,
+ ERROR_NOT_LOGON_PROCESS = 1362,
+ ERROR_LOGON_SESSION_EXISTS = 1363,
+ ERROR_NO_SUCH_PACKAGE = 1364,
+ ERROR_BAD_LOGON_SESSION_STATE = 1365,
+ ERROR_LOGON_SESSION_COLLISION = 1366,
+ ERROR_INVALID_LOGON_TYPE = 1367,
+ ERROR_CANNOT_IMPERSONATE = 1368,
+ ERROR_RXACT_INVALID_STATE = 1369,
+ ERROR_RXACT_COMMIT_FAILURE = 1370,
+ ERROR_SPECIAL_ACCOUNT = 1371,
+ ERROR_SPECIAL_GROUP = 1372,
+ ERROR_SPECIAL_USER = 1373,
+ ERROR_MEMBERS_PRIMARY_GROUP = 1374,
+ ERROR_TOKEN_ALREADY_IN_USE = 1375,
+ ERROR_NO_SUCH_ALIAS = 1376,
+ ERROR_MEMBER_NOT_IN_ALIAS = 1377,
+ ERROR_MEMBER_IN_ALIAS = 1378,
+ ERROR_ALIAS_EXISTS = 1379,
+ ERROR_LOGON_NOT_GRANTED = 1380,
+ ERROR_TOO_MANY_SECRETS = 1381,
+ ERROR_SECRET_TOO_LONG = 1382,
+ ERROR_INTERNAL_DB_ERROR = 1383,
+ ERROR_TOO_MANY_CONTEXT_IDS = 1384,
+ ERROR_LOGON_TYPE_NOT_GRANTED = 1385,
+ ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386,
+ ERROR_NO_SUCH_MEMBER = 1387,
+ ERROR_INVALID_MEMBER = 1388,
+ ERROR_TOO_MANY_SIDS = 1389,
+ ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390,
+ ERROR_NO_INHERITANCE = 1391,
+ ERROR_FILE_CORRUPT = 1392,
+ ERROR_DISK_CORRUPT = 1393,
+ ERROR_NO_USER_SESSION_KEY = 1394,
+ ERROR_LICENSE_QUOTA_EXCEEDED = 1395,
+ ERROR_WRONG_TARGET_NAME = 1396,
+ ERROR_MUTUAL_AUTH_FAILED = 1397,
+ ERROR_TIME_SKEW = 1398,
+ ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399,
+ ERROR_INVALID_WINDOW_HANDLE = 1400,
+ ERROR_INVALID_MENU_HANDLE = 1401,
+ ERROR_INVALID_CURSOR_HANDLE = 1402,
+ ERROR_INVALID_ACCEL_HANDLE = 1403,
+ ERROR_INVALID_HOOK_HANDLE = 1404,
+ ERROR_INVALID_DWP_HANDLE = 1405,
+ ERROR_TLW_WITH_WSCHILD = 1406,
+ ERROR_CANNOT_FIND_WND_CLASS = 1407,
+ ERROR_WINDOW_OF_OTHER_THREAD = 1408,
+ ERROR_HOTKEY_ALREADY_REGISTERED = 1409,
+ ERROR_CLASS_ALREADY_EXISTS = 1410,
+ ERROR_CLASS_DOES_NOT_EXIST = 1411,
+ ERROR_CLASS_HAS_WINDOWS = 1412,
+ ERROR_INVALID_INDEX = 1413,
+ ERROR_INVALID_ICON_HANDLE = 1414,
+ ERROR_PRIVATE_DIALOG_INDEX = 1415,
+ ERROR_LISTBOX_ID_NOT_FOUND = 1416,
+ ERROR_NO_WILDCARD_CHARACTERS = 1417,
+ ERROR_CLIPBOARD_NOT_OPEN = 1418,
+ ERROR_HOTKEY_NOT_REGISTERED = 1419,
+ ERROR_WINDOW_NOT_DIALOG = 1420,
+ ERROR_CONTROL_ID_NOT_FOUND = 1421,
+ ERROR_INVALID_COMBOBOX_MESSAGE = 1422,
+ ERROR_WINDOW_NOT_COMBOBOX = 1423,
+ ERROR_INVALID_EDIT_HEIGHT = 1424,
+ ERROR_DC_NOT_FOUND = 1425,
+ ERROR_INVALID_HOOK_FILTER = 1426,
+ ERROR_INVALID_FILTER_PROC = 1427,
+ ERROR_HOOK_NEEDS_HMOD = 1428,
+ ERROR_GLOBAL_ONLY_HOOK = 1429,
+ ERROR_JOURNAL_HOOK_SET = 1430,
+ ERROR_HOOK_NOT_INSTALLED = 1431,
+ ERROR_INVALID_LB_MESSAGE = 1432,
+ ERROR_SETCOUNT_ON_BAD_LB = 1433,
+ ERROR_LB_WITHOUT_TABSTOPS = 1434,
+ ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435,
+ ERROR_CHILD_WINDOW_MENU = 1436,
+ ERROR_NO_SYSTEM_MENU = 1437,
+ ERROR_INVALID_MSGBOX_STYLE = 1438,
+ ERROR_INVALID_SPI_VALUE = 1439,
+ ERROR_SCREEN_ALREADY_LOCKED = 1440,
+ ERROR_HWNDS_HAVE_DIFF_PARENT = 1441,
+ ERROR_NOT_CHILD_WINDOW = 1442,
+ ERROR_INVALID_GW_COMMAND = 1443,
+ ERROR_INVALID_THREAD_ID = 1444,
+ ERROR_NON_MDICHILD_WINDOW = 1445,
+ ERROR_POPUP_ALREADY_ACTIVE = 1446,
+ ERROR_NO_SCROLLBARS = 1447,
+ ERROR_INVALID_SCROLLBAR_RANGE = 1448,
+ ERROR_INVALID_SHOWWIN_COMMAND = 1449,
+ ERROR_NO_SYSTEM_RESOURCES = 1450,
+ ERROR_NONPAGED_SYSTEM_RESOURCES = 1451,
+ ERROR_PAGED_SYSTEM_RESOURCES = 1452,
+ ERROR_WORKING_SET_QUOTA = 1453,
+ ERROR_PAGEFILE_QUOTA = 1454,
+ ERROR_COMMITMENT_LIMIT = 1455,
+ ERROR_MENU_ITEM_NOT_FOUND = 1456,
+ ERROR_INVALID_KEYBOARD_HANDLE = 1457,
+ ERROR_HOOK_TYPE_NOT_ALLOWED = 1458,
+ ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459,
+ ERROR_TIMEOUT = 1460,
+ ERROR_INVALID_MONITOR_HANDLE = 1461,
+ ERROR_EVENTLOG_FILE_CORRUPT = 1500,
+ ERROR_EVENTLOG_CANT_START = 1501,
+ ERROR_LOG_FILE_FULL = 1502,
+ ERROR_EVENTLOG_FILE_CHANGED = 1503,
+ ERROR_INSTALL_SERVICE_FAILURE = 1601,
+ ERROR_INSTALL_USEREXIT = 1602,
+ ERROR_INSTALL_FAILURE = 1603,
+ ERROR_INSTALL_SUSPEND = 1604,
+ ERROR_UNKNOWN_PRODUCT = 1605,
+ ERROR_UNKNOWN_FEATURE = 1606,
+ ERROR_UNKNOWN_COMPONENT = 1607,
+ ERROR_UNKNOWN_PROPERTY = 1608,
+ ERROR_INVALID_HANDLE_STATE = 1609,
+ ERROR_BAD_CONFIGURATION = 1610,
+ ERROR_INDEX_ABSENT = 1611,
+ ERROR_INSTALL_SOURCE_ABSENT = 1612,
+ ERROR_INSTALL_PACKAGE_VERSION = 1613,
+ ERROR_PRODUCT_UNINSTALLED = 1614,
+ ERROR_BAD_QUERY_SYNTAX = 1615,
+ ERROR_INVALID_FIELD = 1616,
+ ERROR_DEVICE_REMOVED = 1617,
+ ERROR_INSTALL_ALREADY_RUNNING = 1618,
+ ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619,
+ ERROR_INSTALL_PACKAGE_INVALID = 1620,
+ ERROR_INSTALL_UI_FAILURE = 1621,
+ ERROR_INSTALL_LOG_FAILURE = 1622,
+ ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623,
+ ERROR_INSTALL_TRANSFORM_FAILURE = 1624,
+ ERROR_INSTALL_PACKAGE_REJECTED = 1625,
+ ERROR_FUNCTION_NOT_CALLED = 1626,
+ ERROR_FUNCTION_FAILED = 1627,
+ ERROR_INVALID_TABLE = 1628,
+ ERROR_DATATYPE_MISMATCH = 1629,
+ ERROR_UNSUPPORTED_TYPE = 1630,
+ ERROR_CREATE_FAILED = 1631,
+ ERROR_INSTALL_TEMP_UNWRITABLE = 1632,
+ ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633,
+ ERROR_INSTALL_NOTUSED = 1634,
+ ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635,
+ ERROR_PATCH_PACKAGE_INVALID = 1636,
+ ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637,
+ ERROR_PRODUCT_VERSION = 1638,
+ ERROR_INVALID_COMMAND_LINE = 1639,
+ ERROR_INSTALL_REMOTE_DISALLOWED = 1640,
+ ERROR_SUCCESS_REBOOT_INITIATED = 1641,
+ ERROR_PATCH_TARGET_NOT_FOUND = 1642,
+ ERROR_PATCH_PACKAGE_REJECTED = 1643,
+ ERROR_INSTALL_TRANSFORM_REJECTED = 1644,
+ RPC_S_INVALID_STRING_BINDING = 1700,
+ RPC_S_WRONG_KIND_OF_BINDING = 1701,
+ RPC_S_INVALID_BINDING = 1702,
+ RPC_S_PROTSEQ_NOT_SUPPORTED = 1703,
+ RPC_S_INVALID_RPC_PROTSEQ = 1704,
+ RPC_S_INVALID_STRING_UUID = 1705,
+ RPC_S_INVALID_ENDPOINT_FORMAT = 1706,
+ RPC_S_INVALID_NET_ADDR = 1707,
+ RPC_S_NO_ENDPOINT_FOUND = 1708,
+ RPC_S_INVALID_TIMEOUT = 1709,
+ RPC_S_OBJECT_NOT_FOUND = 1710,
+ RPC_S_ALREADY_REGISTERED = 1711,
+ RPC_S_TYPE_ALREADY_REGISTERED = 1712,
+ RPC_S_ALREADY_LISTENING = 1713,
+ RPC_S_NO_PROTSEQS_REGISTERED = 1714,
+ RPC_S_NOT_LISTENING = 1715,
+ RPC_S_UNKNOWN_MGR_TYPE = 1716,
+ RPC_S_UNKNOWN_IF = 1717,
+ RPC_S_NO_BINDINGS = 1718,
+ RPC_S_NO_PROTSEQS = 1719,
+ RPC_S_CANT_CREATE_ENDPOINT = 1720,
+ RPC_S_OUT_OF_RESOURCES = 1721,
+ RPC_S_SERVER_UNAVAILABLE = 1722,
+ RPC_S_SERVER_TOO_BUSY = 1723,
+ RPC_S_INVALID_NETWORK_OPTIONS = 1724,
+ RPC_S_NO_CALL_ACTIVE = 1725,
+ RPC_S_CALL_FAILED = 1726,
+ RPC_S_CALL_FAILED_DNE = 1727,
+ RPC_S_PROTOCOL_ERROR = 1728,
+ RPC_S_UNSUPPORTED_TRANS_SYN = 1730,
+ RPC_S_UNSUPPORTED_TYPE = 1732,
+ RPC_S_INVALID_TAG = 1733,
+ RPC_S_INVALID_BOUND = 1734,
+ RPC_S_NO_ENTRY_NAME = 1735,
+ RPC_S_INVALID_NAME_SYNTAX = 1736,
+ RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737,
+ RPC_S_UUID_NO_ADDRESS = 1739,
+ RPC_S_DUPLICATE_ENDPOINT = 1740,
+ RPC_S_UNKNOWN_AUTHN_TYPE = 1741,
+ RPC_S_MAX_CALLS_TOO_SMALL = 1742,
+ RPC_S_STRING_TOO_LONG = 1743,
+ RPC_S_PROTSEQ_NOT_FOUND = 1744,
+ RPC_S_PROCNUM_OUT_OF_RANGE = 1745,
+ RPC_S_BINDING_HAS_NO_AUTH = 1746,
+ RPC_S_UNKNOWN_AUTHN_SERVICE = 1747,
+ RPC_S_UNKNOWN_AUTHN_LEVEL = 1748,
+ RPC_S_INVALID_AUTH_IDENTITY = 1749,
+ RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750,
+ EPT_S_INVALID_ENTRY = 1751,
+ EPT_S_CANT_PERFORM_OP = 1752,
+ EPT_S_NOT_REGISTERED = 1753,
+ RPC_S_NOTHING_TO_EXPORT = 1754,
+ RPC_S_INCOMPLETE_NAME = 1755,
+ RPC_S_INVALID_VERS_OPTION = 1756,
+ RPC_S_NO_MORE_MEMBERS = 1757,
+ RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758,
+ RPC_S_INTERFACE_NOT_FOUND = 1759,
+ RPC_S_ENTRY_ALREADY_EXISTS = 1760,
+ RPC_S_ENTRY_NOT_FOUND = 1761,
+ RPC_S_NAME_SERVICE_UNAVAILABLE = 1762,
+ RPC_S_INVALID_NAF_ID = 1763,
+ RPC_S_CANNOT_SUPPORT = 1764,
+ RPC_S_NO_CONTEXT_AVAILABLE = 1765,
+ RPC_S_INTERNAL_ERROR = 1766,
+ RPC_S_ZERO_DIVIDE = 1767,
+ RPC_S_ADDRESS_ERROR = 1768,
+ RPC_S_FP_DIV_ZERO = 1769,
+ RPC_S_FP_UNDERFLOW = 1770,
+ RPC_S_FP_OVERFLOW = 1771,
+ RPC_X_NO_MORE_ENTRIES = 1772,
+ RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773,
+ RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774,
+ RPC_X_SS_IN_NULL_CONTEXT = 1775,
+ RPC_X_SS_CONTEXT_DAMAGED = 1777,
+ RPC_X_SS_HANDLES_MISMATCH = 1778,
+ RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779,
+ RPC_X_NULL_REF_POINTER = 1780,
+ RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781,
+ RPC_X_BYTE_COUNT_TOO_SMALL = 1782,
+ RPC_X_BAD_STUB_DATA = 1783,
+ ERROR_INVALID_USER_BUFFER = 1784,
+ ERROR_UNRECOGNIZED_MEDIA = 1785,
+ ERROR_NO_TRUST_LSA_SECRET = 1786,
+ ERROR_NO_TRUST_SAM_ACCOUNT = 1787,
+ ERROR_TRUSTED_DOMAIN_FAILURE = 1788,
+ ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789,
+ ERROR_TRUST_FAILURE = 1790,
+ RPC_S_CALL_IN_PROGRESS = 1791,
+ ERROR_NETLOGON_NOT_STARTED = 1792,
+ ERROR_ACCOUNT_EXPIRED = 1793,
+ ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794,
+ ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795,
+ ERROR_UNKNOWN_PORT = 1796,
+ ERROR_UNKNOWN_PRINTER_DRIVER = 1797,
+ ERROR_UNKNOWN_PRINTPROCESSOR = 1798,
+ ERROR_INVALID_SEPARATOR_FILE = 1799,
+ ERROR_INVALID_PRIORITY = 1800,
+ ERROR_INVALID_PRINTER_NAME = 1801,
+ ERROR_PRINTER_ALREADY_EXISTS = 1802,
+ ERROR_INVALID_PRINTER_COMMAND = 1803,
+ ERROR_INVALID_DATATYPE = 1804,
+ ERROR_INVALID_ENVIRONMENT = 1805,
+ RPC_S_NO_MORE_BINDINGS = 1806,
+ ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807,
+ ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808,
+ ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809,
+ ERROR_DOMAIN_TRUST_INCONSISTENT = 1810,
+ ERROR_SERVER_HAS_OPEN_HANDLES = 1811,
+ ERROR_RESOURCE_DATA_NOT_FOUND = 1812,
+ ERROR_RESOURCE_TYPE_NOT_FOUND = 1813,
+ ERROR_RESOURCE_NAME_NOT_FOUND = 1814,
+ ERROR_RESOURCE_LANG_NOT_FOUND = 1815,
+ ERROR_NOT_ENOUGH_QUOTA = 1816,
+ RPC_S_NO_INTERFACES = 1817,
+ RPC_S_CALL_CANCELLED = 1818,
+ RPC_S_BINDING_INCOMPLETE = 1819,
+ RPC_S_COMM_FAILURE = 1820,
+ RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821,
+ RPC_S_NO_PRINC_NAME = 1822,
+ RPC_S_NOT_RPC_ERROR = 1823,
+ RPC_S_UUID_LOCAL_ONLY = 1824,
+ RPC_S_SEC_PKG_ERROR = 1825,
+ RPC_S_NOT_CANCELLED = 1826,
+ RPC_X_INVALID_ES_ACTION = 1827,
+ RPC_X_WRONG_ES_VERSION = 1828,
+ RPC_X_WRONG_STUB_VERSION = 1829,
+ RPC_X_INVALID_PIPE_OBJECT = 1830,
+ RPC_X_WRONG_PIPE_ORDER = 1831,
+ RPC_X_WRONG_PIPE_VERSION = 1832,
+ RPC_S_GROUP_MEMBER_NOT_FOUND = 1898,
+ EPT_S_CANT_CREATE = 1899,
+ RPC_S_INVALID_OBJECT = 1900,
+ ERROR_INVALID_TIME = 1901,
+ ERROR_INVALID_FORM_NAME = 1902,
+ ERROR_INVALID_FORM_SIZE = 1903,
+ ERROR_ALREADY_WAITING = 1904,
+ ERROR_PRINTER_DELETED = 1905,
+ ERROR_INVALID_PRINTER_STATE = 1906,
+ ERROR_PASSWORD_MUST_CHANGE = 1907,
+ ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908,
+ ERROR_ACCOUNT_LOCKED_OUT = 1909,
+ OR_INVALID_OXID = 1910,
+ OR_INVALID_OID = 1911,
+ OR_INVALID_SET = 1912,
+ RPC_S_SEND_INCOMPLETE = 1913,
+ RPC_S_INVALID_ASYNC_HANDLE = 1914,
+ RPC_S_INVALID_ASYNC_CALL = 1915,
+ RPC_X_PIPE_CLOSED = 1916,
+ RPC_X_PIPE_DISCIPLINE_ERROR = 1917,
+ RPC_X_PIPE_EMPTY = 1918,
+ ERROR_NO_SITENAME = 1919,
+ ERROR_CANT_ACCESS_FILE = 1920,
+ ERROR_CANT_RESOLVE_FILENAME = 1921,
+ RPC_S_ENTRY_TYPE_MISMATCH = 1922,
+ RPC_S_NOT_ALL_OBJS_EXPORTED = 1923,
+ RPC_S_INTERFACE_NOT_EXPORTED = 1924,
+ RPC_S_PROFILE_NOT_ADDED = 1925,
+ RPC_S_PRF_ELT_NOT_ADDED = 1926,
+ RPC_S_PRF_ELT_NOT_REMOVED = 1927,
+ RPC_S_GRP_ELT_NOT_ADDED = 1928,
+ RPC_S_GRP_ELT_NOT_REMOVED = 1929,
+ ERROR_KM_DRIVER_BLOCKED = 1930,
+ ERROR_CONTEXT_EXPIRED = 1931,
+ ERROR_INVALID_PIXEL_FORMAT = 2000,
+ ERROR_BAD_DRIVER = 2001,
+ ERROR_INVALID_WINDOW_STYLE = 2002,
+ ERROR_METAFILE_NOT_SUPPORTED = 2003,
+ ERROR_TRANSFORM_NOT_SUPPORTED = 2004,
+ ERROR_CLIPPING_NOT_SUPPORTED = 2005,
+ ERROR_INVALID_CMM = 2010,
+ ERROR_INVALID_PROFILE = 2011,
+ ERROR_TAG_NOT_FOUND = 2012,
+ ERROR_TAG_NOT_PRESENT = 2013,
+ ERROR_DUPLICATE_TAG = 2014,
+ ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015,
+ ERROR_PROFILE_NOT_FOUND = 2016,
+ ERROR_INVALID_COLORSPACE = 2017,
+ ERROR_ICM_NOT_ENABLED = 2018,
+ ERROR_DELETING_ICM_XFORM = 2019,
+ ERROR_INVALID_TRANSFORM = 2020,
+ ERROR_COLORSPACE_MISMATCH = 2021,
+ ERROR_INVALID_COLORINDEX = 2022,
+ ERROR_CONNECTED_OTHER_PASSWORD = 2108,
+ ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109,
+ ERROR_BAD_USERNAME = 2202,
+ ERROR_NOT_CONNECTED = 2250,
+ ERROR_OPEN_FILES = 2401,
+ ERROR_ACTIVE_CONNECTIONS = 2402,
+ ERROR_DEVICE_IN_USE = 2404,
+ ERROR_UNKNOWN_PRINT_MONITOR = 3000,
+ ERROR_PRINTER_DRIVER_IN_USE = 3001,
+ ERROR_SPOOL_FILE_NOT_FOUND = 3002,
+ ERROR_SPL_NO_STARTDOC = 3003,
+ ERROR_SPL_NO_ADDJOB = 3004,
+ ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005,
+ ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006,
+ ERROR_INVALID_PRINT_MONITOR = 3007,
+ ERROR_PRINT_MONITOR_IN_USE = 3008,
+ ERROR_PRINTER_HAS_JOBS_QUEUED = 3009,
+ ERROR_SUCCESS_REBOOT_REQUIRED = 3010,
+ ERROR_SUCCESS_RESTART_REQUIRED = 3011,
+ ERROR_PRINTER_NOT_FOUND = 3012,
+ ERROR_PRINTER_DRIVER_WARNED = 3013,
+ ERROR_PRINTER_DRIVER_BLOCKED = 3014,
+ ERROR_WINS_INTERNAL = 4000,
+ ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001,
+ ERROR_STATIC_INIT = 4002,
+ ERROR_INC_BACKUP = 4003,
+ ERROR_FULL_BACKUP = 4004,
+ ERROR_REC_NON_EXISTENT = 4005,
+ ERROR_RPL_NOT_ALLOWED = 4006,
+ ERROR_DHCP_ADDRESS_CONFLICT = 4100,
+ ERROR_WMI_GUID_NOT_FOUND = 4200,
+ ERROR_WMI_INSTANCE_NOT_FOUND = 4201,
+ ERROR_WMI_ITEMID_NOT_FOUND = 4202,
+ ERROR_WMI_TRY_AGAIN = 4203,
+ ERROR_WMI_DP_NOT_FOUND = 4204,
+ ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205,
+ ERROR_WMI_ALREADY_ENABLED = 4206,
+ ERROR_WMI_GUID_DISCONNECTED = 4207,
+ ERROR_WMI_SERVER_UNAVAILABLE = 4208,
+ ERROR_WMI_DP_FAILED = 4209,
+ ERROR_WMI_INVALID_MOF = 4210,
+ ERROR_WMI_INVALID_REGINFO = 4211,
+ ERROR_WMI_ALREADY_DISABLED = 4212,
+ ERROR_WMI_READ_ONLY = 4213,
+ ERROR_WMI_SET_FAILURE = 4214,
+ ERROR_INVALID_MEDIA = 4300,
+ ERROR_INVALID_LIBRARY = 4301,
+ ERROR_INVALID_MEDIA_POOL = 4302,
+ ERROR_DRIVE_MEDIA_MISMATCH = 4303,
+ ERROR_MEDIA_OFFLINE = 4304,
+ ERROR_LIBRARY_OFFLINE = 4305,
+ ERROR_EMPTY = 4306,
+ ERROR_NOT_EMPTY = 4307,
+ ERROR_MEDIA_UNAVAILABLE = 4308,
+ ERROR_RESOURCE_DISABLED = 4309,
+ ERROR_INVALID_CLEANER = 4310,
+ ERROR_UNABLE_TO_CLEAN = 4311,
+ ERROR_OBJECT_NOT_FOUND = 4312,
+ ERROR_DATABASE_FAILURE = 4313,
+ ERROR_DATABASE_FULL = 4314,
+ ERROR_MEDIA_INCOMPATIBLE = 4315,
+ ERROR_RESOURCE_NOT_PRESENT = 4316,
+ ERROR_INVALID_OPERATION = 4317,
+ ERROR_MEDIA_NOT_AVAILABLE = 4318,
+ ERROR_DEVICE_NOT_AVAILABLE = 4319,
+ ERROR_REQUEST_REFUSED = 4320,
+ ERROR_INVALID_DRIVE_OBJECT = 4321,
+ ERROR_LIBRARY_FULL = 4322,
+ ERROR_MEDIUM_NOT_ACCESSIBLE = 4323,
+ ERROR_UNABLE_TO_LOAD_MEDIUM = 4324,
+ ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325,
+ ERROR_UNABLE_TO_INVENTORY_SLOT = 4326,
+ ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327,
+ ERROR_TRANSPORT_FULL = 4328,
+ ERROR_CONTROLLING_IEPORT = 4329,
+ ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330,
+ ERROR_CLEANER_SLOT_SET = 4331,
+ ERROR_CLEANER_SLOT_NOT_SET = 4332,
+ ERROR_CLEANER_CARTRIDGE_SPENT = 4333,
+ ERROR_UNEXPECTED_OMID = 4334,
+ ERROR_CANT_DELETE_LAST_ITEM = 4335,
+ ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336,
+ ERROR_VOLUME_CONTAINS_SYS_FILES = 4337,
+ ERROR_INDIGENOUS_TYPE = 4338,
+ ERROR_NO_SUPPORTING_DRIVES = 4339,
+ ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340,
+ ERROR_FILE_OFFLINE = 4350,
+ ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351,
+ ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352,
+ ERROR_NOT_A_REPARSE_POINT = 4390,
+ ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391,
+ ERROR_INVALID_REPARSE_DATA = 4392,
+ ERROR_REPARSE_TAG_INVALID = 4393,
+ ERROR_REPARSE_TAG_MISMATCH = 4394,
+ ERROR_VOLUME_NOT_SIS_ENABLED = 4500,
+ ERROR_DEPENDENT_RESOURCE_EXISTS = 5001,
+ ERROR_DEPENDENCY_NOT_FOUND = 5002,
+ ERROR_DEPENDENCY_ALREADY_EXISTS = 5003,
+ ERROR_RESOURCE_NOT_ONLINE = 5004,
+ ERROR_HOST_NODE_NOT_AVAILABLE = 5005,
+ ERROR_RESOURCE_NOT_AVAILABLE = 5006,
+ ERROR_RESOURCE_NOT_FOUND = 5007,
+ ERROR_SHUTDOWN_CLUSTER = 5008,
+ ERROR_CANT_EVICT_ACTIVE_NODE = 5009,
+ ERROR_OBJECT_ALREADY_EXISTS = 5010,
+ ERROR_OBJECT_IN_LIST = 5011,
+ ERROR_GROUP_NOT_AVAILABLE = 5012,
+ ERROR_GROUP_NOT_FOUND = 5013,
+ ERROR_GROUP_NOT_ONLINE = 5014,
+ ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015,
+ ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016,
+ ERROR_RESMON_CREATE_FAILED = 5017,
+ ERROR_RESMON_ONLINE_FAILED = 5018,
+ ERROR_RESOURCE_ONLINE = 5019,
+ ERROR_QUORUM_RESOURCE = 5020,
+ ERROR_NOT_QUORUM_CAPABLE = 5021,
+ ERROR_CLUSTER_SHUTTING_DOWN = 5022,
+ ERROR_INVALID_STATE = 5023,
+ ERROR_RESOURCE_PROPERTIES_STORED = 5024,
+ ERROR_NOT_QUORUM_CLASS = 5025,
+ ERROR_CORE_RESOURCE = 5026,
+ ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027,
+ ERROR_QUORUMLOG_OPEN_FAILED = 5028,
+ ERROR_CLUSTERLOG_CORRUPT = 5029,
+ ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030,
+ ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031,
+ ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032,
+ ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033,
+ ERROR_QUORUM_OWNER_ALIVE = 5034,
+ ERROR_NETWORK_NOT_AVAILABLE = 5035,
+ ERROR_NODE_NOT_AVAILABLE = 5036,
+ ERROR_ALL_NODES_NOT_AVAILABLE = 5037,
+ ERROR_RESOURCE_FAILED = 5038,
+ ERROR_CLUSTER_INVALID_NODE = 5039,
+ ERROR_CLUSTER_NODE_EXISTS = 5040,
+ ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041,
+ ERROR_CLUSTER_NODE_NOT_FOUND = 5042,
+ ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043,
+ ERROR_CLUSTER_NETWORK_EXISTS = 5044,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045,
+ ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046,
+ ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047,
+ ERROR_CLUSTER_INVALID_REQUEST = 5048,
+ ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049,
+ ERROR_CLUSTER_NODE_DOWN = 5050,
+ ERROR_CLUSTER_NODE_UNREACHABLE = 5051,
+ ERROR_CLUSTER_NODE_NOT_MEMBER = 5052,
+ ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053,
+ ERROR_CLUSTER_INVALID_NETWORK = 5054,
+ ERROR_CLUSTER_NODE_UP = 5056,
+ ERROR_CLUSTER_IPADDR_IN_USE = 5057,
+ ERROR_CLUSTER_NODE_NOT_PAUSED = 5058,
+ ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059,
+ ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060,
+ ERROR_CLUSTER_NODE_ALREADY_UP = 5061,
+ ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062,
+ ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063,
+ ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064,
+ ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065,
+ ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066,
+ ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067,
+ ERROR_INVALID_OPERATION_ON_QUORUM = 5068,
+ ERROR_DEPENDENCY_NOT_ALLOWED = 5069,
+ ERROR_CLUSTER_NODE_PAUSED = 5070,
+ ERROR_NODE_CANT_HOST_RESOURCE = 5071,
+ ERROR_CLUSTER_NODE_NOT_READY = 5072,
+ ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073,
+ ERROR_CLUSTER_JOIN_ABORTED = 5074,
+ ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075,
+ ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076,
+ ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077,
+ ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078,
+ ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079,
+ ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080,
+ ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081,
+ ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082,
+ ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083,
+ ERROR_RESMON_INVALID_STATE = 5084,
+ ERROR_CLUSTER_GUM_NOT_LOCKER = 5085,
+ ERROR_QUORUM_DISK_NOT_FOUND = 5086,
+ ERROR_DATABASE_BACKUP_CORRUPT = 5087,
+ ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088,
+ ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089,
+ ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890,
+ ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891,
+ ERROR_CLUSTER_MEMBERSHIP_HALT = 5892,
+ ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894,
+ ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895,
+ ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896,
+ ERROR_CLUSTER_PARAMETER_MISMATCH = 5897,
+ ERROR_NODE_CANNOT_BE_CLUSTERED = 5898,
+ ERROR_CLUSTER_WRONG_OS_VERSION = 5899,
+ ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900,
+ ERROR_ENCRYPTION_FAILED = 6000,
+ ERROR_DECRYPTION_FAILED = 6001,
+ ERROR_FILE_ENCRYPTED = 6002,
+ ERROR_NO_RECOVERY_POLICY = 6003,
+ ERROR_NO_EFS = 6004,
+ ERROR_WRONG_EFS = 6005,
+ ERROR_NO_USER_KEYS = 6006,
+ ERROR_FILE_NOT_ENCRYPTED = 6007,
+ ERROR_NOT_EXPORT_FORMAT = 6008,
+ ERROR_FILE_READ_ONLY = 6009,
+ ERROR_DIR_EFS_DISALLOWED = 6010,
+ ERROR_EFS_SERVER_NOT_TRUSTED = 6011,
+ ERROR_BAD_RECOVERY_POLICY = 6012,
+ ERROR_EFS_ALG_BLOB_TOO_BIG = 6013,
+ ERROR_VOLUME_NOT_SUPPORT_EFS = 6014,
+ ERROR_EFS_DISABLED = 6015,
+ ERROR_EFS_VERSION_NOT_SUPPORT = 6016,
+ ERROR_NO_BROWSER_SERVERS_FOUND = 6118,
+ SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200,
+ ERROR_CTX_WINSTATION_NAME_INVALID = 7001,
+ ERROR_CTX_INVALID_PD = 7002,
+ ERROR_CTX_PD_NOT_FOUND = 7003,
+ ERROR_CTX_WD_NOT_FOUND = 7004,
+ ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005,
+ ERROR_CTX_SERVICE_NAME_COLLISION = 7006,
+ ERROR_CTX_CLOSE_PENDING = 7007,
+ ERROR_CTX_NO_OUTBUF = 7008,
+ ERROR_CTX_MODEM_INF_NOT_FOUND = 7009,
+ ERROR_CTX_INVALID_MODEMNAME = 7010,
+ ERROR_CTX_MODEM_RESPONSE_ERROR = 7011,
+ ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012,
+ ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013,
+ ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014,
+ ERROR_CTX_MODEM_RESPONSE_BUSY = 7015,
+ ERROR_CTX_MODEM_RESPONSE_VOICE = 7016,
+ ERROR_CTX_TD_ERROR = 7017,
+ ERROR_CTX_WINSTATION_NOT_FOUND = 7022,
+ ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023,
+ ERROR_CTX_WINSTATION_BUSY = 7024,
+ ERROR_CTX_BAD_VIDEO_MODE = 7025,
+ ERROR_CTX_GRAPHICS_INVALID = 7035,
+ ERROR_CTX_LOGON_DISABLED = 7037,
+ ERROR_CTX_NOT_CONSOLE = 7038,
+ ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040,
+ ERROR_CTX_CONSOLE_DISCONNECT = 7041,
+ ERROR_CTX_CONSOLE_CONNECT = 7042,
+ ERROR_CTX_SHADOW_DENIED = 7044,
+ ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045,
+ ERROR_CTX_INVALID_WD = 7049,
+ ERROR_CTX_SHADOW_INVALID = 7050,
+ ERROR_CTX_SHADOW_DISABLED = 7051,
+ ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052,
+ ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053,
+ ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054,
+ ERROR_CTX_LICENSE_CLIENT_INVALID = 7055,
+ ERROR_CTX_LICENSE_EXPIRED = 7056,
+ ERROR_CTX_SHADOW_NOT_RUNNING = 7057,
+ ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058,
+ FRS_ERR_INVALID_API_SEQUENCE = 8001,
+ FRS_ERR_STARTING_SERVICE = 8002,
+ FRS_ERR_STOPPING_SERVICE = 8003,
+ FRS_ERR_INTERNAL_API = 8004,
+ FRS_ERR_INTERNAL = 8005,
+ FRS_ERR_SERVICE_COMM = 8006,
+ FRS_ERR_INSUFFICIENT_PRIV = 8007,
+ FRS_ERR_AUTHENTICATION = 8008,
+ FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009,
+ FRS_ERR_PARENT_AUTHENTICATION = 8010,
+ FRS_ERR_CHILD_TO_PARENT_COMM = 8011,
+ FRS_ERR_PARENT_TO_CHILD_COMM = 8012,
+ FRS_ERR_SYSVOL_POPULATE = 8013,
+ FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014,
+ FRS_ERR_SYSVOL_IS_BUSY = 8015,
+ FRS_ERR_SYSVOL_DEMOTE = 8016,
+ FRS_ERR_INVALID_SERVICE_PARAMETER = 8017,
+ ERROR_DS_NOT_INSTALLED = 8200,
+ ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201,
+ ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202,
+ ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203,
+ ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204,
+ ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205,
+ ERROR_DS_BUSY = 8206,
+ ERROR_DS_UNAVAILABLE = 8207,
+ ERROR_DS_NO_RIDS_ALLOCATED = 8208,
+ ERROR_DS_NO_MORE_RIDS = 8209,
+ ERROR_DS_INCORRECT_ROLE_OWNER = 8210,
+ ERROR_DS_RIDMGR_INIT_ERROR = 8211,
+ ERROR_DS_OBJ_CLASS_VIOLATION = 8212,
+ ERROR_DS_CANT_ON_NON_LEAF = 8213,
+ ERROR_DS_CANT_ON_RDN = 8214,
+ ERROR_DS_CANT_MOD_OBJ_CLASS = 8215,
+ ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216,
+ ERROR_DS_GC_NOT_AVAILABLE = 8217,
+ ERROR_SHARED_POLICY = 8218,
+ ERROR_POLICY_OBJECT_NOT_FOUND = 8219,
+ ERROR_POLICY_ONLY_IN_DS = 8220,
+ ERROR_PROMOTION_ACTIVE = 8221,
+ ERROR_NO_PROMOTION_ACTIVE = 8222,
+ ERROR_DS_OPERATIONS_ERROR = 8224,
+ ERROR_DS_PROTOCOL_ERROR = 8225,
+ ERROR_DS_TIMELIMIT_EXCEEDED = 8226,
+ ERROR_DS_SIZELIMIT_EXCEEDED = 8227,
+ ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228,
+ ERROR_DS_COMPARE_FALSE = 8229,
+ ERROR_DS_COMPARE_TRUE = 8230,
+ ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231,
+ ERROR_DS_STRONG_AUTH_REQUIRED = 8232,
+ ERROR_DS_INAPPROPRIATE_AUTH = 8233,
+ ERROR_DS_AUTH_UNKNOWN = 8234,
+ ERROR_DS_REFERRAL = 8235,
+ ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236,
+ ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237,
+ ERROR_DS_INAPPROPRIATE_MATCHING = 8238,
+ ERROR_DS_CONSTRAINT_VIOLATION = 8239,
+ ERROR_DS_NO_SUCH_OBJECT = 8240,
+ ERROR_DS_ALIAS_PROBLEM = 8241,
+ ERROR_DS_INVALID_DN_SYNTAX = 8242,
+ ERROR_DS_IS_LEAF = 8243,
+ ERROR_DS_ALIAS_DEREF_PROBLEM = 8244,
+ ERROR_DS_UNWILLING_TO_PERFORM = 8245,
+ ERROR_DS_LOOP_DETECT = 8246,
+ ERROR_DS_NAMING_VIOLATION = 8247,
+ ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248,
+ ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249,
+ ERROR_DS_SERVER_DOWN = 8250,
+ ERROR_DS_LOCAL_ERROR = 8251,
+ ERROR_DS_ENCODING_ERROR = 8252,
+ ERROR_DS_DECODING_ERROR = 8253,
+ ERROR_DS_FILTER_UNKNOWN = 8254,
+ ERROR_DS_PARAM_ERROR = 8255,
+ ERROR_DS_NOT_SUPPORTED = 8256,
+ ERROR_DS_NO_RESULTS_RETURNED = 8257,
+ ERROR_DS_CONTROL_NOT_FOUND = 8258,
+ ERROR_DS_CLIENT_LOOP = 8259,
+ ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260,
+ ERROR_DS_SORT_CONTROL_MISSING = 8261,
+ ERROR_DS_OFFSET_RANGE_ERROR = 8262,
+ ERROR_DS_ROOT_MUST_BE_NC = 8301,
+ ERROR_DS_ADD_REPLICA_INHIBITED = 8302,
+ ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303,
+ ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304,
+ ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305,
+ ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306,
+ ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307,
+ ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308,
+ ERROR_DS_USER_BUFFER_TO_SMALL = 8309,
+ ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310,
+ ERROR_DS_ILLEGAL_MOD_OPERATION = 8311,
+ ERROR_DS_OBJ_TOO_LARGE = 8312,
+ ERROR_DS_BAD_INSTANCE_TYPE = 8313,
+ ERROR_DS_MASTERDSA_REQUIRED = 8314,
+ ERROR_DS_OBJECT_CLASS_REQUIRED = 8315,
+ ERROR_DS_MISSING_REQUIRED_ATT = 8316,
+ ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317,
+ ERROR_DS_ATT_ALREADY_EXISTS = 8318,
+ ERROR_DS_CANT_ADD_ATT_VALUES = 8320,
+ ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321,
+ ERROR_DS_RANGE_CONSTRAINT = 8322,
+ ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323,
+ ERROR_DS_CANT_REM_MISSING_ATT = 8324,
+ ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325,
+ ERROR_DS_ROOT_CANT_BE_SUBREF = 8326,
+ ERROR_DS_NO_CHAINING = 8327,
+ ERROR_DS_NO_CHAINED_EVAL = 8328,
+ ERROR_DS_NO_PARENT_OBJECT = 8329,
+ ERROR_DS_PARENT_IS_AN_ALIAS = 8330,
+ ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331,
+ ERROR_DS_CHILDREN_EXIST = 8332,
+ ERROR_DS_OBJ_NOT_FOUND = 8333,
+ ERROR_DS_ALIASED_OBJ_MISSING = 8334,
+ ERROR_DS_BAD_NAME_SYNTAX = 8335,
+ ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336,
+ ERROR_DS_CANT_DEREF_ALIAS = 8337,
+ ERROR_DS_OUT_OF_SCOPE = 8338,
+ ERROR_DS_OBJECT_BEING_REMOVED = 8339,
+ ERROR_DS_CANT_DELETE_DSA_OBJ = 8340,
+ ERROR_DS_GENERIC_ERROR = 8341,
+ ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342,
+ ERROR_DS_CLASS_NOT_DSA = 8343,
+ ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344,
+ ERROR_DS_ILLEGAL_SUPERIOR = 8345,
+ ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346,
+ ERROR_DS_NAME_TOO_MANY_PARTS = 8347,
+ ERROR_DS_NAME_TOO_LONG = 8348,
+ ERROR_DS_NAME_VALUE_TOO_LONG = 8349,
+ ERROR_DS_NAME_UNPARSEABLE = 8350,
+ ERROR_DS_NAME_TYPE_UNKNOWN = 8351,
+ ERROR_DS_NOT_AN_OBJECT = 8352,
+ ERROR_DS_SEC_DESC_TOO_SHORT = 8353,
+ ERROR_DS_SEC_DESC_INVALID = 8354,
+ ERROR_DS_NO_DELETED_NAME = 8355,
+ ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356,
+ ERROR_DS_NCNAME_MUST_BE_NC = 8357,
+ ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358,
+ ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359,
+ ERROR_DS_INVALID_DMD = 8360,
+ ERROR_DS_OBJ_GUID_EXISTS = 8361,
+ ERROR_DS_NOT_ON_BACKLINK = 8362,
+ ERROR_DS_NO_CROSSREF_FOR_NC = 8363,
+ ERROR_DS_SHUTTING_DOWN = 8364,
+ ERROR_DS_UNKNOWN_OPERATION = 8365,
+ ERROR_DS_INVALID_ROLE_OWNER = 8366,
+ ERROR_DS_COULDNT_CONTACT_FSMO = 8367,
+ ERROR_DS_CROSS_NC_DN_RENAME = 8368,
+ ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369,
+ ERROR_DS_REPLICATOR_ONLY = 8370,
+ ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371,
+ ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372,
+ ERROR_DS_NAME_REFERENCE_INVALID = 8373,
+ ERROR_DS_CROSS_REF_EXISTS = 8374,
+ ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375,
+ ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376,
+ ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377,
+ ERROR_DS_DUP_RDN = 8378,
+ ERROR_DS_DUP_OID = 8379,
+ ERROR_DS_DUP_MAPI_ID = 8380,
+ ERROR_DS_DUP_SCHEMA_ID_GUID = 8381,
+ ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382,
+ ERROR_DS_SEMANTIC_ATT_TEST = 8383,
+ ERROR_DS_SYNTAX_MISMATCH = 8384,
+ ERROR_DS_EXISTS_IN_MUST_HAVE = 8385,
+ ERROR_DS_EXISTS_IN_MAY_HAVE = 8386,
+ ERROR_DS_NONEXISTENT_MAY_HAVE = 8387,
+ ERROR_DS_NONEXISTENT_MUST_HAVE = 8388,
+ ERROR_DS_AUX_CLS_TEST_FAIL = 8389,
+ ERROR_DS_NONEXISTENT_POSS_SUP = 8390,
+ ERROR_DS_SUB_CLS_TEST_FAIL = 8391,
+ ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392,
+ ERROR_DS_EXISTS_IN_AUX_CLS = 8393,
+ ERROR_DS_EXISTS_IN_SUB_CLS = 8394,
+ ERROR_DS_EXISTS_IN_POSS_SUP = 8395,
+ ERROR_DS_RECALCSCHEMA_FAILED = 8396,
+ ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397,
+ ERROR_DS_CANT_DELETE = 8398,
+ ERROR_DS_ATT_SCHEMA_REQ_ID = 8399,
+ ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400,
+ ERROR_DS_CANT_CACHE_ATT = 8401,
+ ERROR_DS_CANT_CACHE_CLASS = 8402,
+ ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403,
+ ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404,
+ ERROR_DS_CANT_RETRIEVE_DN = 8405,
+ ERROR_DS_MISSING_SUPREF = 8406,
+ ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407,
+ ERROR_DS_CODE_INCONSISTENCY = 8408,
+ ERROR_DS_DATABASE_ERROR = 8409,
+ ERROR_DS_GOVERNSID_MISSING = 8410,
+ ERROR_DS_MISSING_EXPECTED_ATT = 8411,
+ ERROR_DS_NCNAME_MISSING_CR_REF = 8412,
+ ERROR_DS_SECURITY_CHECKING_ERROR = 8413,
+ ERROR_DS_SCHEMA_NOT_LOADED = 8414,
+ ERROR_DS_SCHEMA_ALLOC_FAILED = 8415,
+ ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416,
+ ERROR_DS_GCVERIFY_ERROR = 8417,
+ ERROR_DS_DRA_SCHEMA_MISMATCH = 8418,
+ ERROR_DS_CANT_FIND_DSA_OBJ = 8419,
+ ERROR_DS_CANT_FIND_EXPECTED_NC = 8420,
+ ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421,
+ ERROR_DS_CANT_RETRIEVE_CHILD = 8422,
+ ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423,
+ ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424,
+ ERROR_DS_BAD_HIERARCHY_FILE = 8425,
+ ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426,
+ ERROR_DS_CONFIG_PARAM_MISSING = 8427,
+ ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428,
+ ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429,
+ ERROR_DS_INTERNAL_FAILURE = 8430,
+ ERROR_DS_UNKNOWN_ERROR = 8431,
+ ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432,
+ ERROR_DS_REFUSING_FSMO_ROLES = 8433,
+ ERROR_DS_MISSING_FSMO_SETTINGS = 8434,
+ ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435,
+ ERROR_DS_DRA_GENERIC = 8436,
+ ERROR_DS_DRA_INVALID_PARAMETER = 8437,
+ ERROR_DS_DRA_BUSY = 8438,
+ ERROR_DS_DRA_BAD_DN = 8439,
+ ERROR_DS_DRA_BAD_NC = 8440,
+ ERROR_DS_DRA_DN_EXISTS = 8441,
+ ERROR_DS_DRA_INTERNAL_ERROR = 8442,
+ ERROR_DS_DRA_INCONSISTENT_DIT = 8443,
+ ERROR_DS_DRA_CONNECTION_FAILED = 8444,
+ ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445,
+ ERROR_DS_DRA_OUT_OF_MEM = 8446,
+ ERROR_DS_DRA_MAIL_PROBLEM = 8447,
+ ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448,
+ ERROR_DS_DRA_REF_NOT_FOUND = 8449,
+ ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450,
+ ERROR_DS_DRA_DB_ERROR = 8451,
+ ERROR_DS_DRA_NO_REPLICA = 8452,
+ ERROR_DS_DRA_ACCESS_DENIED = 8453,
+ ERROR_DS_DRA_NOT_SUPPORTED = 8454,
+ ERROR_DS_DRA_RPC_CANCELLED = 8455,
+ ERROR_DS_DRA_SOURCE_DISABLED = 8456,
+ ERROR_DS_DRA_SINK_DISABLED = 8457,
+ ERROR_DS_DRA_NAME_COLLISION = 8458,
+ ERROR_DS_DRA_SOURCE_REINSTALLED = 8459,
+ ERROR_DS_DRA_MISSING_PARENT = 8460,
+ ERROR_DS_DRA_PREEMPTED = 8461,
+ ERROR_DS_DRA_ABANDON_SYNC = 8462,
+ ERROR_DS_DRA_SHUTDOWN = 8463,
+ ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464,
+ ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465,
+ ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466,
+ ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467,
+ ERROR_DS_DUP_LINK_ID = 8468,
+ ERROR_DS_NAME_ERROR_RESOLVING = 8469,
+ ERROR_DS_NAME_ERROR_NOT_FOUND = 8470,
+ ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471,
+ ERROR_DS_NAME_ERROR_NO_MAPPING = 8472,
+ ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473,
+ ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474,
+ ERROR_DS_CONSTRUCTED_ATT_MOD = 8475,
+ ERROR_DS_WRONG_OM_OBJ_CLASS = 8476,
+ ERROR_DS_DRA_REPL_PENDING = 8477,
+ ERROR_DS_DS_REQUIRED = 8478,
+ ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479,
+ ERROR_DS_NON_BASE_SEARCH = 8480,
+ ERROR_DS_CANT_RETRIEVE_ATTS = 8481,
+ ERROR_DS_BACKLINK_WITHOUT_LINK = 8482,
+ ERROR_DS_EPOCH_MISMATCH = 8483,
+ ERROR_DS_SRC_NAME_MISMATCH = 8484,
+ ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485,
+ ERROR_DS_DST_NC_MISMATCH = 8486,
+ ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487,
+ ERROR_DS_SRC_GUID_MISMATCH = 8488,
+ ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489,
+ ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490,
+ ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491,
+ ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492,
+ ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493,
+ ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494,
+ ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496,
+ ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497,
+ ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498,
+ ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499,
+ ERROR_DS_INVALID_SEARCH_FLAG = 8500,
+ ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501,
+ ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502,
+ ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503,
+ ERROR_DS_SAM_INIT_FAILURE = 8504,
+ ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505,
+ ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506,
+ ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507,
+ ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508,
+ ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509,
+ ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510,
+ ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511,
+ ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512,
+ ERROR_DS_INVALID_GROUP_TYPE = 8513,
+ ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514,
+ ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515,
+ ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516,
+ ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517,
+ ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518,
+ ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519,
+ ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520,
+ ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521,
+ ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522,
+ ERROR_DS_NAMING_MASTER_GC = 8523,
+ ERROR_DS_LOOKUP_FAILURE = 8524,
+ ERROR_DS_COULDNT_UPDATE_SPNS = 8525,
+ ERROR_DS_CANT_RETRIEVE_SD = 8526,
+ ERROR_DS_KEY_NOT_UNIQUE = 8527,
+ ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528,
+ ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529,
+ ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530,
+ ERROR_DS_CANT_START = 8531,
+ ERROR_DS_INIT_FAILURE = 8532,
+ ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533,
+ ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534,
+ ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535,
+ ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536,
+ ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537,
+ ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538,
+ ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539,
+ ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540,
+ ERROR_SAM_INIT_FAILURE = 8541,
+ ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542,
+ ERROR_DS_DRA_SCHEMA_CONFLICT = 8543,
+ ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT = 8544,
+ ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545,
+ ERROR_DS_NC_STILL_HAS_DSAS = 8546,
+ ERROR_DS_GC_REQUIRED = 8547,
+ ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548,
+ ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549,
+ ERROR_DS_CANT_ADD_TO_GC = 8550,
+ ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551,
+ ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552,
+ ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553,
+ ERROR_DS_INVALID_NAME_FOR_SPN = 8554,
+ ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555,
+ ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556,
+ ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557,
+ ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558,
+ ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559,
+ ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560,
+ ERROR_DS_INIT_FAILURE_CONSOLE = 8561,
+ ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562,
+ ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563,
+ ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564,
+ ERROR_DS_FOREST_VERSION_TOO_LOW = 8565,
+ ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566,
+ ERROR_DS_INCOMPATIBLE_VERSION = 8567,
+ ERROR_DS_LOW_DSA_VERSION = 8568,
+ ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569,
+ ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570,
+ ERROR_DS_NAME_NOT_UNIQUE = 8571,
+ ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572,
+ ERROR_DS_OUT_OF_VERSION_STORE = 8573,
+ ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574,
+ ERROR_DS_NO_REF_DOMAIN = 8575,
+ ERROR_DS_RESERVED_LINK_ID = 8576,
+ ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577,
+ ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579,
+ ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581,
+ ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582,
+ ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583,
+ ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584,
+ ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585,
+ ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8586,
+ ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587,
+ ERROR_DS_NOT_CLOSEST = 8588,
+ ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589,
+ ERROR_DS_SINGLE_USER_MODE_FAILED = 8590,
+ ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591,
+ ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592,
+ ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593,
+ ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594,
+ ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595,
+ ERROR_DS_NO_MSDS_INTID = 8596,
+ ERROR_DS_DUP_MSDS_INTID = 8597,
+ ERROR_DS_EXISTS_IN_RDNATTID = 8598,
+ ERROR_DS_AUTHORIZATION_FAILED = 8599,
+ ERROR_DS_INVALID_SCRIPT = 8600,
+ ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601,
+ DNS_ERROR_RCODE_FORMAT_ERROR = 9001,
+ DNS_ERROR_RCODE_SERVER_FAILURE = 9002,
+ DNS_ERROR_RCODE_NAME_ERROR = 9003,
+ DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004,
+ DNS_ERROR_RCODE_REFUSED = 9005,
+ DNS_ERROR_RCODE_YXDOMAIN = 9006,
+ DNS_ERROR_RCODE_YXRRSET = 9007,
+ DNS_ERROR_RCODE_NXRRSET = 9008,
+ DNS_ERROR_RCODE_NOTAUTH = 9009,
+ DNS_ERROR_RCODE_NOTZONE = 9010,
+ DNS_ERROR_RCODE_BADSIG = 9016,
+ DNS_ERROR_RCODE_BADKEY = 9017,
+ DNS_ERROR_RCODE_BADTIME = 9018,
+ DNS_INFO_NO_RECORDS = 9501,
+ DNS_ERROR_BAD_PACKET = 9502,
+ DNS_ERROR_NO_PACKET = 9503,
+ DNS_ERROR_RCODE = 9504,
+ DNS_ERROR_UNSECURE_PACKET = 9505,
+ DNS_ERROR_INVALID_TYPE = 9551,
+ DNS_ERROR_INVALID_IP_ADDRESS = 9552,
+ DNS_ERROR_INVALID_PROPERTY = 9553,
+ DNS_ERROR_TRY_AGAIN_LATER = 9554,
+ DNS_ERROR_NOT_UNIQUE = 9555,
+ DNS_ERROR_NON_RFC_NAME = 9556,
+ DNS_STATUS_FQDN = 9557,
+ DNS_STATUS_DOTTED_NAME = 9558,
+ DNS_STATUS_SINGLE_PART_NAME = 9559,
+ DNS_ERROR_INVALID_NAME_CHAR = 9560,
+ DNS_ERROR_NUMERIC_NAME = 9561,
+ DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562,
+ DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601,
+ DNS_ERROR_NO_ZONE_INFO = 9602,
+ DNS_ERROR_INVALID_ZONE_OPERATION = 9603,
+ DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604,
+ DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605,
+ DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606,
+ DNS_ERROR_ZONE_LOCKED = 9607,
+ DNS_ERROR_ZONE_CREATION_FAILED = 9608,
+ DNS_ERROR_ZONE_ALREADY_EXISTS = 9609,
+ DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610,
+ DNS_ERROR_INVALID_ZONE_TYPE = 9611,
+ DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612,
+ DNS_ERROR_ZONE_NOT_SECONDARY = 9613,
+ DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614,
+ DNS_ERROR_WINS_INIT_FAILED = 9615,
+ DNS_ERROR_NEED_WINS_SERVERS = 9616,
+ DNS_ERROR_NBSTAT_INIT_FAILED = 9617,
+ DNS_ERROR_SOA_DELETE_INVALID = 9618,
+ DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619,
+ DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620,
+ DNS_ERROR_ZONE_IS_SHUTDOWN = 9621,
+ DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651,
+ DNS_ERROR_INVALID_DATAFILE_NAME = 9652,
+ DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653,
+ DNS_ERROR_FILE_WRITEBACK_FAILED = 9654,
+ DNS_ERROR_DATAFILE_PARSING = 9655,
+ DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701,
+ DNS_ERROR_RECORD_FORMAT = 9702,
+ DNS_ERROR_NODE_CREATION_FAILED = 9703,
+ DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704,
+ DNS_ERROR_RECORD_TIMED_OUT = 9705,
+ DNS_ERROR_NAME_NOT_IN_ZONE = 9706,
+ DNS_ERROR_CNAME_LOOP = 9707,
+ DNS_ERROR_NODE_IS_CNAME = 9708,
+ DNS_ERROR_CNAME_COLLISION = 9709,
+ DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710,
+ DNS_ERROR_RECORD_ALREADY_EXISTS = 9711,
+ DNS_ERROR_SECONDARY_DATA = 9712,
+ DNS_ERROR_NO_CREATE_CACHE_DATA = 9713,
+ DNS_ERROR_NAME_DOES_NOT_EXIST = 9714,
+ DNS_WARNING_PTR_CREATE_FAILED = 9715,
+ DNS_WARNING_DOMAIN_UNDELETED = 9716,
+ DNS_ERROR_DS_UNAVAILABLE = 9717,
+ DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718,
+ DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719,
+ DNS_INFO_AXFR_COMPLETE = 9751,
+ DNS_ERROR_AXFR = 9752,
+ DNS_INFO_ADDED_LOCAL_WINS = 9753,
+ DNS_STATUS_CONTINUE_NEEDED = 9801,
+ DNS_ERROR_NO_TCPIP = 9851,
+ DNS_ERROR_NO_DNS_SERVERS = 9852,
+ DNS_ERROR_DP_DOES_NOT_EXIST = 9901,
+ DNS_ERROR_DP_ALREADY_EXISTS = 9902,
+ DNS_ERROR_DP_NOT_ENLISTED = 9903,
+ DNS_ERROR_DP_ALREADY_ENLISTED = 9904,
+ WSAEINTR = 10004,
+ WSAEBADF = 10009,
+ WSAEACCES = 10013,
+ WSAEFAULT = 10014,
+ WSAEINVAL = 10022,
+ WSAEMFILE = 10024,
+ WSAEWOULDBLOCK = 10035,
+ WSAEINPROGRESS = 10036,
+ WSAEALREADY = 10037,
+ WSAENOTSOCK = 10038,
+ WSAEDESTADDRREQ = 10039,
+ WSAEMSGSIZE = 10040,
+ WSAEPROTOTYPE = 10041,
+ WSAENOPROTOOPT = 10042,
+ WSAEPROTONOSUPPORT = 10043,
+ WSAESOCKTNOSUPPORT = 10044,
+ WSAEOPNOTSUPP = 10045,
+ WSAEPFNOSUPPORT = 10046,
+ WSAEAFNOSUPPORT = 10047,
+ WSAEADDRINUSE = 10048,
+ WSAEADDRNOTAVAIL = 10049,
+ WSAENETDOWN = 10050,
+ WSAENETUNREACH = 10051,
+ WSAENETRESET = 10052,
+ WSAECONNABORTED = 10053,
+ WSAECONNRESET = 10054,
+ WSAENOBUFS = 10055,
+ WSAEISCONN = 10056,
+ WSAENOTCONN = 10057,
+ WSAESHUTDOWN = 10058,
+ WSAETOOMANYREFS = 10059,
+ WSAETIMEDOUT = 10060,
+ WSAECONNREFUSED = 10061,
+ WSAELOOP = 10062,
+ WSAENAMETOOLONG = 10063,
+ WSAEHOSTDOWN = 10064,
+ WSAEHOSTUNREACH = 10065,
+ WSAENOTEMPTY = 10066,
+ WSAEPROCLIM = 10067,
+ WSAEUSERS = 10068,
+ WSAEDQUOT = 10069,
+ WSAESTALE = 10070,
+ WSAEREMOTE = 10071,
+ WSASYSNOTREADY = 10091,
+ WSAVERNOTSUPPORTED = 10092,
+ WSANOTINITIALISED = 10093,
+ WSAEDISCON = 10101,
+ WSAENOMORE = 10102,
+ WSAECANCELLED = 10103,
+ WSAEINVALIDPROCTABLE = 10104,
+ WSAEINVALIDPROVIDER = 10105,
+ WSAEPROVIDERFAILEDINIT = 10106,
+ WSASYSCALLFAILURE = 10107,
+ WSASERVICE_NOT_FOUND = 10108,
+ WSATYPE_NOT_FOUND = 10109,
+ WSA_E_NO_MORE = 10110,
+ WSA_E_CANCELLED = 10111,
+ WSAEREFUSED = 10112,
+ WSAHOST_NOT_FOUND = 11001,
+ WSATRY_AGAIN = 11002,
+ WSANO_RECOVERY = 11003,
+ WSANO_DATA = 11004,
+ WSA_QOS_RECEIVERS = 11005,
+ WSA_QOS_SENDERS = 11006,
+ WSA_QOS_NO_SENDERS = 11007,
+ WSA_QOS_NO_RECEIVERS = 11008,
+ WSA_QOS_REQUEST_CONFIRMED = 11009,
+ WSA_QOS_ADMISSION_FAILURE = 11010,
+ WSA_QOS_POLICY_FAILURE = 11011,
+ WSA_QOS_BAD_STYLE = 11012,
+ WSA_QOS_BAD_OBJECT = 11013,
+ WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
+ WSA_QOS_GENERIC_ERROR = 11015,
+ WSA_QOS_ESERVICETYPE = 11016,
+ WSA_QOS_EFLOWSPEC = 11017,
+ WSA_QOS_EPROVSPECBUF = 11018,
+ WSA_QOS_EFILTERSTYLE = 11019,
+ WSA_QOS_EFILTERTYPE = 11020,
+ WSA_QOS_EFILTERCOUNT = 11021,
+ WSA_QOS_EOBJLENGTH = 11022,
+ WSA_QOS_EFLOWCOUNT = 11023,
+ WSA_QOS_EUNKNOWNPSOBJ = 11024,
+ WSA_QOS_EPOLICYOBJ = 11025,
+ WSA_QOS_EFLOWDESC = 11026,
+ WSA_QOS_EPSFLOWSPEC = 11027,
+ WSA_QOS_EPSFILTERSPEC = 11028,
+ WSA_QOS_ESDMODEOBJ = 11029,
+ WSA_QOS_ESHAPERATEOBJ = 11030,
+ WSA_QOS_RESERVED_PETYPE = 11031,
+ ERROR_IPSEC_QM_POLICY_EXISTS = 13000,
+ ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001,
+ ERROR_IPSEC_QM_POLICY_IN_USE = 13002,
+ ERROR_IPSEC_MM_POLICY_EXISTS = 13003,
+ ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004,
+ ERROR_IPSEC_MM_POLICY_IN_USE = 13005,
+ ERROR_IPSEC_MM_FILTER_EXISTS = 13006,
+ ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007,
+ ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008,
+ ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009,
+ ERROR_IPSEC_MM_AUTH_EXISTS = 13010,
+ ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011,
+ ERROR_IPSEC_MM_AUTH_IN_USE = 13012,
+ ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013,
+ ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014,
+ ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015,
+ ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016,
+ ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017,
+ ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018,
+ ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019,
+ ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020,
+ ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021,
+ ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022,
+ ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023,
+ ERROR_IPSEC_IKE_AUTH_FAIL = 13801,
+ ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802,
+ ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803,
+ ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804,
+ ERROR_IPSEC_IKE_TIMED_OUT = 13805,
+ ERROR_IPSEC_IKE_NO_CERT = 13806,
+ ERROR_IPSEC_IKE_SA_DELETED = 13807,
+ ERROR_IPSEC_IKE_SA_REAPED = 13808,
+ ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809,
+ ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810,
+ ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811,
+ ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812,
+ ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813,
+ ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814,
+ ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815,
+ ERROR_IPSEC_IKE_ERROR = 13816,
+ ERROR_IPSEC_IKE_CRL_FAILED = 13817,
+ ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818,
+ ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819,
+ ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820,
+ ERROR_IPSEC_IKE_DH_FAIL = 13822,
+ ERROR_IPSEC_IKE_INVALID_HEADER = 13824,
+ ERROR_IPSEC_IKE_NO_POLICY = 13825,
+ ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826,
+ ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827,
+ ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828,
+ ERROR_IPSEC_IKE_PROCESS_ERR = 13829,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830,
+ ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831,
+ ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832,
+ ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833,
+ ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836,
+ ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840,
+ ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841,
+ ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842,
+ ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843,
+ ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844,
+ ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845,
+ ERROR_IPSEC_IKE_INVALID_COOKIE = 13846,
+ ERROR_IPSEC_IKE_NO_PEER_CERT = 13847,
+ ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848,
+ ERROR_IPSEC_IKE_POLICY_CHANGE = 13849,
+ ERROR_IPSEC_IKE_NO_MM_POLICY = 13850,
+ ERROR_IPSEC_IKE_NOTCBPRIV = 13851,
+ ERROR_IPSEC_IKE_SECLOADFAIL = 13852,
+ ERROR_IPSEC_IKE_FAILSSPINIT = 13853,
+ ERROR_IPSEC_IKE_FAILQUERYSSP = 13854,
+ ERROR_IPSEC_IKE_SRVACQFAIL = 13855,
+ ERROR_IPSEC_IKE_SRVQUERYCRED = 13856,
+ ERROR_IPSEC_IKE_GETSPIFAIL = 13857,
+ ERROR_IPSEC_IKE_INVALID_FILTER = 13858,
+ ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859,
+ ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860,
+ ERROR_IPSEC_IKE_INVALID_POLICY = 13861,
+ ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862,
+ ERROR_IPSEC_IKE_INVALID_SITUATION = 13863,
+ ERROR_IPSEC_IKE_DH_FAILURE = 13864,
+ ERROR_IPSEC_IKE_INVALID_GROUP = 13865,
+ ERROR_IPSEC_IKE_ENCRYPT = 13866,
+ ERROR_IPSEC_IKE_DECRYPT = 13867,
+ ERROR_IPSEC_IKE_POLICY_MATCH = 13868,
+ ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869,
+ ERROR_IPSEC_IKE_INVALID_HASH = 13870,
+ ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871,
+ ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872,
+ ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873,
+ ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874,
+ ERROR_IPSEC_IKE_INVALID_SIG = 13875,
+ ERROR_IPSEC_IKE_LOAD_FAILED = 13876,
+ ERROR_IPSEC_IKE_RPC_DELETE = 13877,
+ ERROR_IPSEC_IKE_BENIGN_REINIT = 13878,
+ ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879,
+ ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881,
+ ERROR_IPSEC_IKE_MM_LIMIT = 13882,
+ ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883,
+ ERROR_IPSEC_IKE_NEG_STATUS_END = 13884,
+ ERROR_SXS_SECTION_NOT_FOUND = 14000,
+ ERROR_SXS_CANT_GEN_ACTCTX = 14001,
+ ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002,
+ ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003,
+ ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004,
+ ERROR_SXS_MANIFEST_PARSE_ERROR = 14005,
+ ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006,
+ ERROR_SXS_KEY_NOT_FOUND = 14007,
+ ERROR_SXS_VERSION_CONFLICT = 14008,
+ ERROR_SXS_WRONG_SECTION_TYPE = 14009,
+ ERROR_SXS_THREAD_QUERIES_DISABLED = 14010,
+ ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011,
+ ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012,
+ ERROR_SXS_UNKNOWN_ENCODING = 14013,
+ ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014,
+ ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015,
+ ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017,
+ ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018,
+ ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019,
+ ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020,
+ ERROR_SXS_DUPLICATE_DLL_NAME = 14021,
+ ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022,
+ ERROR_SXS_DUPLICATE_CLSID = 14023,
+ ERROR_SXS_DUPLICATE_IID = 14024,
+ ERROR_SXS_DUPLICATE_TLBID = 14025,
+ ERROR_SXS_DUPLICATE_PROGID = 14026,
+ ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027,
+ ERROR_SXS_FILE_HASH_MISMATCH = 14028,
+ ERROR_SXS_POLICY_PARSE_ERROR = 14029,
+ ERROR_SXS_XML_E_MISSINGQUOTE = 14030,
+ ERROR_SXS_XML_E_COMMENTSYNTAX = 14031,
+ ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032,
+ ERROR_SXS_XML_E_BADNAMECHAR = 14033,
+ ERROR_SXS_XML_E_BADCHARINSTRING = 14034,
+ ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035,
+ ERROR_SXS_XML_E_BADCHARDATA = 14036,
+ ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037,
+ ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038,
+ ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039,
+ ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040,
+ ERROR_SXS_XML_E_INTERNALERROR = 14041,
+ ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042,
+ ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043,
+ ERROR_SXS_XML_E_MISSING_PAREN = 14044,
+ ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045,
+ ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046,
+ ERROR_SXS_XML_E_INVALID_DECIMAL = 14047,
+ ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048,
+ ERROR_SXS_XML_E_INVALID_UNICODE = 14049,
+ ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050,
+ ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051,
+ ERROR_SXS_XML_E_UNCLOSEDTAG = 14052,
+ ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053,
+ ERROR_SXS_XML_E_MULTIPLEROOTS = 14054,
+ ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055,
+ ERROR_SXS_XML_E_BADXMLDECL = 14056,
+ ERROR_SXS_XML_E_MISSINGROOT = 14057,
+ ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058,
+ ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059,
+ ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060,
+ ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061,
+ ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062,
+ ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063,
+ ERROR_SXS_XML_E_UNCLOSEDDECL = 14064,
+ ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065,
+ ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066,
+ ERROR_SXS_XML_E_INVALIDENCODING = 14067,
+ ERROR_SXS_XML_E_INVALIDSWITCH = 14068,
+ ERROR_SXS_XML_E_BADXMLCASE = 14069,
+ ERROR_SXS_XML_E_INVALID_STANDALONE = 14070,
+ ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071,
+ ERROR_SXS_XML_E_INVALID_VERSION = 14072,
+ ERROR_SXS_XML_E_MISSINGEQUALS = 14073,
+ ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074,
+ ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075,
+ ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076,
+ ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077,
+ ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078,
+ ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MonoIOStat.cs b/mcs/class/corlib/System.IO/MonoIOStat.cs
new file mode 100644
index 00000000000..caf4ccc6e5c
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIOStat.cs
@@ -0,0 +1,22 @@
+//
+// System.IO.MonoIOStat.cs: Idealized structure for file information.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal struct MonoIOStat {
+ public string Name;
+ public FileAttributes Attributes;
+ public long Length;
+ public long CreationTime;
+ public long LastAccessTime;
+ public long LastWriteTime;
+ }
+}
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
new file mode 100644
index 00000000000..c1f4d303601
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -0,0 +1,277 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.Path.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+// Copyright (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.IO
+{
+ public sealed class Path
+ {
+ public static readonly char AltDirectorySeparatorChar;
+ public static readonly char DirectorySeparatorChar;
+ public static readonly char[] InvalidPathChars;
+ public static readonly char PathSeparator;
+ internal static readonly string DirectorySeparatorStr;
+ public static readonly char VolumeSeparatorChar;
+
+ private static readonly char[] PathSeparatorChars;
+ private static bool dirEqualsVolume;
+
+ private Path () {}
+
+ // class methods
+ public static string ChangeExtension (string path, string extension)
+ {
+ if (path == null)
+ {
+ return null;
+ }
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ int iExt = findExtension (path);
+
+ if (extension != null) {
+ if (extension [0] != '.')
+ extension = "." + extension;
+ } else
+ extension = String.Empty;
+
+ if (iExt < 0) {
+ return path + extension;
+ } else if (iExt > 0) {
+ string temp = path.Substring (0, iExt);
+ return temp + extension;
+ }
+
+ return extension;
+ }
+
+ public static string Combine (string path1, string path2)
+ {
+ if (path1 == null)
+ throw new ArgumentNullException ("path1");
+
+ if (path2 == null)
+ throw new ArgumentNullException ("path2");
+
+ if (path1 == String.Empty)
+ return path2;
+
+ if (path2 == String.Empty)
+ return path1;
+
+ if (path1.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path1");
+
+ if (path2.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path2");
+
+ //TODO???: UNC names
+ // LAMESPEC: MS says that if path1 is not empty and path2 is a full path
+ // it should throw ArgumentException
+ if (IsPathRooted (path2))
+ return path2;
+
+ if (Array.IndexOf (PathSeparatorChars, path1 [path1.Length - 1]) == -1)
+ return path1 + DirectorySeparatorChar + path2;
+
+ return path1 + path2;
+ }
+
+ public static string GetDirectoryName (string path)
+ {
+ if (path != null)
+ {
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+ CheckArgument.PathChars (path);
+
+ if (path.Length > 0)
+ {
+ int nLast = path.LastIndexOfAny (PathSeparatorChars);
+
+ if (nLast > 0)
+ return path.Substring (0, nLast);
+ else
+ return String.Empty;
+ }
+ }
+ return path;
+ }
+
+ public static string GetExtension (string path)
+ {
+ if (path == null)
+ return null;
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ int iExt = findExtension (path);
+
+ if (iExt > -1)
+ { // okay it has an extension
+ return path.Substring (iExt);
+ }
+ return string.Empty;
+ }
+
+ public static string GetFileName (string path)
+ {
+ if (path == null || path == String.Empty)
+ return path;
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ int nLast = path.LastIndexOfAny (PathSeparatorChars);
+ if (nLast > 0)
+ return path.Substring (nLast + 1);
+
+ return nLast == 0 ? null : path;
+ }
+
+ public static string GetFileNameWithoutExtension (string path)
+ {
+ return ChangeExtension (GetFileName (path), null);
+ }
+
+ public static string GetFullPath (string path)
+ {
+ if (path == null)
+ throw (new ArgumentNullException (
+ "path",
+ "You must specify a path when calling System.IO.Path.GetFullPath"));
+
+ if (path == String.Empty)
+ throw new ArgumentException ("The path is not of a legal form", "path");
+
+ if (IsPathRooted (path))
+ return path;
+
+ return Directory.GetCurrentDirectory () + DirectorySeparatorStr + path;
+ }
+
+ public static string GetPathRoot (string path)
+ {
+ if (path == null)
+ return null;
+
+ if (!IsPathRooted (path))
+ return String.Empty;
+
+ int i = path.IndexOfAny (new char [] {DirectorySeparatorChar, AltDirectorySeparatorChar});
+ if (i == -1)
+ return null; // This should never happen, cause IsPathRooted returned true
+
+ return path.Substring (0, i + 1);
+ }
+
+ public static string GetTempFileName ()
+ {
+ FileStream f = null;
+ string path;
+ Random rnd;
+ int num = 0;
+
+ rnd = new Random ();
+ do {
+ num = rnd.Next ();
+ num++;
+ path = GetTempPath() + DirectorySeparatorChar + "tmp" + num.ToString("x");
+
+ try {
+ f = new FileStream (path, FileMode.CreateNew);
+ } catch {
+ }
+ } while (f == null);
+
+ f.Close();
+ return path;
+ }
+
+ /// <summary>
+ /// Returns the path of the current systems temp directory
+ /// </summary>
+ public static string GetTempPath ()
+ {
+ return get_temp_path ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern string get_temp_path ();
+
+ public static bool HasExtension (string path)
+ {
+ CheckArgument.Null (path);
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+
+ return findExtension (path) > -1;
+ }
+
+ public static bool IsPathRooted (string path)
+ {
+ if (path == null || path.Length == 0)
+ return false;
+
+ if (path.IndexOfAny (InvalidPathChars) != -1)
+ throw new ArgumentException ("Illegal characters in path", "path");
+
+ char c = path [0];
+ return (c == DirectorySeparatorChar ||
+ c == AltDirectorySeparatorChar ||
+ (!dirEqualsVolume && path.Length > 1 && path [1] == VolumeSeparatorChar));
+ }
+
+ // private class methods
+
+ private static int findExtension (string path)
+ {
+ // method should return the index of the path extension
+ // start or -1 if no valid extension
+ if (path != null){
+ int iLastDot = path.LastIndexOf (".");
+ int iLastSep = path.LastIndexOfAny ( PathSeparatorChars );
+
+ if (iLastDot > iLastSep)
+ return iLastDot;
+ }
+ return -1;
+ }
+
+ static Path () {
+ VolumeSeparatorChar = MonoIO.VolumeSeparatorChar;
+ DirectorySeparatorChar = MonoIO.DirectorySeparatorChar;
+ AltDirectorySeparatorChar = MonoIO.AltDirectorySeparatorChar;
+
+ PathSeparator = MonoIO.PathSeparator;
+ InvalidPathChars = MonoIO.InvalidPathChars;
+
+ // internal fields
+
+ DirectorySeparatorStr = DirectorySeparatorChar.ToString ();
+ PathSeparatorChars = new char [] {
+ DirectorySeparatorChar,
+ AltDirectorySeparatorChar,
+ VolumeSeparatorChar
+ };
+
+ dirEqualsVolume = (DirectorySeparatorChar == VolumeSeparatorChar);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/PathTooLongException.cs b/mcs/class/corlib/System.IO/PathTooLongException.cs
new file mode 100644
index 00000000000..5f5f5229a18
--- /dev/null
+++ b/mcs/class/corlib/System.IO/PathTooLongException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.PathTooLongException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+ [Serializable]
+ public class PathTooLongException : IOException
+ {
+ // Constructors
+ public PathTooLongException ()
+ : base (Locale.GetText ("Pathname is longer than the maximum length"))
+ {
+ }
+
+ public PathTooLongException (string message)
+ : base (message)
+ {
+ }
+
+ protected PathTooLongException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PathTooLongException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/SearchPattern.cs b/mcs/class/corlib/System.IO/SearchPattern.cs
new file mode 100644
index 00000000000..4db60d2fadc
--- /dev/null
+++ b/mcs/class/corlib/System.IO/SearchPattern.cs
@@ -0,0 +1,169 @@
+//
+// System.IO.SearchPattern.cs: Filename glob support.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO {
+
+ // FIXME: there's a complication with this algorithm under windows.
+ // the pattern '*.*' matches all files (i think . matches the extension),
+ // whereas under UNIX it should only match files containing the '.' character.
+
+ class SearchPattern {
+ public SearchPattern (string pattern) : this (pattern, false) { }
+
+ public SearchPattern (string pattern, bool ignore)
+ {
+ this.ignore = ignore;
+ Compile (pattern);
+ }
+
+ public bool IsMatch (string text)
+ {
+ return Match (ops, text, 0);
+ }
+
+ // private
+
+ private Op ops; // the compiled pattern
+ private bool ignore; // ignore case
+
+ private void Compile (string pattern)
+ {
+ if (pattern == null || pattern.IndexOfAny (InvalidChars) >= 0)
+ throw new ArgumentException ("Invalid search pattern.");
+
+ if (pattern == "*") { // common case
+ ops = new Op (OpCode.True);
+ return;
+ }
+
+ ops = null;
+
+ int ptr = 0;
+ Op last_op = null;
+ while (ptr < pattern.Length) {
+ Op op;
+
+ switch (pattern [ptr]) {
+ case '?':
+ op = new Op (OpCode.AnyChar);
+ ++ ptr;
+ break;
+
+ case '*':
+ op = new Op (OpCode.AnyString);
+ ++ ptr;
+ break;
+
+ default:
+ op = new Op (OpCode.ExactString);
+ int end = pattern.IndexOfAny (WildcardChars, ptr);
+ if (end < 0)
+ end = pattern.Length;
+
+ op.Argument = pattern.Substring (ptr, end - ptr);
+ if (ignore)
+ op.Argument = op.Argument.ToLower ();
+
+ ptr = end;
+ break;
+ }
+
+ if (last_op == null)
+ ops = op;
+ else
+ last_op.Next = op;
+
+ last_op = op;
+ }
+
+ if (last_op == null)
+ ops = new Op (OpCode.End);
+ else
+ last_op.Next = new Op (OpCode.End);
+ }
+
+ private bool Match (Op op, string text, int ptr)
+ {
+ while (op != null) {
+ switch (op.Code) {
+ case OpCode.True:
+ return true;
+
+ case OpCode.End:
+ if (ptr == text.Length)
+ return true;
+
+ return false;
+
+ case OpCode.ExactString:
+ int length = op.Argument.Length;
+ if (ptr + length > text.Length)
+ return false;
+
+ string str = text.Substring (ptr, length);
+ if (ignore)
+ str = str.ToLower ();
+
+ if (str != op.Argument)
+ return false;
+
+ ptr += length;
+ break;
+
+ case OpCode.AnyChar:
+ if (++ ptr > text.Length)
+ return false;
+ break;
+
+ case OpCode.AnyString:
+ while (ptr <= text.Length) {
+ if (Match (op.Next, text, ptr))
+ return true;
+
+ ++ ptr;
+ }
+
+ return false;
+ }
+
+ op = op.Next;
+ }
+
+ return true;
+ }
+
+ // private static
+
+ private static readonly char [] WildcardChars = { '*', '?' };
+ private static readonly char [] InvalidChars = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
+
+ private class Op {
+ public Op (OpCode code)
+ {
+ this.Code = code;
+ this.Argument = null;
+ this.Next = null;
+ }
+
+ public OpCode Code;
+ public string Argument;
+ public Op Next;
+ }
+
+ private enum OpCode {
+ ExactString, // literal
+ AnyChar, // ?
+ AnyString, // *
+ End, // end of pattern
+ True // always succeeds
+ };
+ }
+}
diff --git a/mcs/class/corlib/System.IO/SeekOrigin.cs b/mcs/class/corlib/System.IO/SeekOrigin.cs
new file mode 100644
index 00000000000..1cd2cf84165
--- /dev/null
+++ b/mcs/class/corlib/System.IO/SeekOrigin.cs
@@ -0,0 +1,34 @@
+// SeekOrigin.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:32 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Serializable]
+ public enum SeekOrigin : int {
+
+ /// <summary>
+ /// </summary>
+ Begin = 0,
+
+ /// <summary>
+ /// </summary>
+ Current = 1,
+
+ /// <summary>
+ /// </summary>
+ End = 2,
+ } // SeekOrigin
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/Stream.cs b/mcs/class/corlib/System.IO/Stream.cs
new file mode 100755
index 00000000000..244585e8e96
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Stream.cs
@@ -0,0 +1,323 @@
+//
+// System.IO/Stream.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Threading;
+
+namespace System.IO
+{
+ [Serializable]
+ public abstract class Stream : MarshalByRefObject, IDisposable
+ {
+ public static readonly Stream Null;
+
+ static Stream ()
+ {
+ Null = new NullStream ();
+ }
+
+ protected Stream ()
+ {
+ }
+
+ public abstract bool CanRead
+ {
+ get;
+ }
+
+ public abstract bool CanSeek
+ {
+ get;
+ }
+
+ public abstract bool CanWrite
+ {
+ get;
+ }
+
+ public abstract long Length
+ {
+ get;
+ }
+
+ public abstract long Position
+ {
+ get;
+ set;
+ }
+
+
+ public virtual void Close ()
+ {
+ Flush ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Close ();
+ }
+
+ protected virtual WaitHandle CreateWaitHandle()
+ {
+ return new ManualResetEvent (false);
+ }
+
+ public abstract void Flush ();
+
+ public abstract int Read (byte[] buffer,
+ int offset,
+ int count);
+
+ public virtual int ReadByte ()
+ {
+ byte[] buffer = new byte [1];
+
+ if (Read (buffer, 0, 1) == 1)
+ return buffer [0];
+
+ return -1;
+ }
+
+ public abstract long Seek (long offset,
+ SeekOrigin origin);
+
+ public abstract void SetLength (long value);
+
+ public abstract void Write (byte[] buffer,
+ int offset,
+ int count);
+
+ public virtual void WriteByte (byte value)
+ {
+ byte[] buffer = new byte [1];
+
+ buffer [0] = value;
+
+ Write (buffer, 0, 1);
+ }
+
+ delegate int ReadDelegate (byte [] buffer, int offset, int count);
+
+ public virtual IAsyncResult
+ BeginRead (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+ {
+ if (!CanRead)
+ throw new NotSupportedException ("This stream does not support reading");
+
+ SyncReadResult srr = new SyncReadResult (state);
+ try
+ {
+ srr.Complete (Read (buffer, offset, count));
+ }
+ catch (IOException e)
+ {
+ srr._exception = e;
+ }
+
+ if (cback != null)
+ cback (srr);
+
+ return srr;
+ }
+
+ public virtual IAsyncResult
+ BeginWrite (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+ {
+ if (!CanWrite)
+ throw new NotSupportedException ("This stream does not support reading");
+
+ SyncWriteResult swr = new SyncWriteResult (state);
+ try
+ {
+ Write (buffer, offset, count);
+ swr.Complete ();
+ }
+ catch (IOException e)
+ {
+ swr._exception = e;
+ }
+
+ if (cback != null)
+ cback (swr);
+
+ return swr;
+ }
+
+ public virtual int EndRead (IAsyncResult async_result)
+ {
+ if (async_result == null)
+ throw new ArgumentNullException ("async_result");
+ SyncReadResult srr = async_result as SyncReadResult;
+ if (srr == null)
+ throw new ArgumentException ("async_result is invalid");
+ if (srr._fEndCalled)
+ throw new InvalidOperationException ("EndRead called twice");
+ srr._fEndCalled = true;
+ if (srr._exception != null)
+ throw srr._exception;
+ return srr._cbRead;
+ }
+
+ public virtual void EndWrite (IAsyncResult async_result)
+ {
+ if (async_result == null)
+ throw new ArgumentNullException ("async_result");
+ SyncWriteResult swr = async_result as SyncWriteResult;
+ if (swr == null)
+ throw new ArgumentException ("async_result is invalid");
+ if (swr._fEndCalled)
+ throw new InvalidOperationException ("EndRead called twice");
+ swr._fEndCalled = true;
+ if (swr._exception != null)
+ throw swr._exception;
+ }
+
+ // this class implements the synchronous IASyncResult for the obove methods
+ private class SyncResult : IAsyncResult
+ {
+ object _objState; // client-supplied state
+ bool _fComplete; // if the IO operation completed successfully
+ ManualResetEvent _hWait; // the wait event
+ public bool _fEndCalled; // true iff the End method was called already
+ public Exception _exception; // holds any exception throw during IO operation
+
+ public SyncResult (object objState)
+ {
+ _objState = objState;
+ _hWait = new ManualResetEvent (false);
+ }
+
+ public void Complete ()
+ {
+ _fComplete = true;
+ _hWait.Set ();
+ }
+
+ // IAsyncResult members
+ object IAsyncResult.AsyncState
+ {
+ get { return _objState; }
+ }
+
+ WaitHandle IAsyncResult.AsyncWaitHandle
+ {
+ get { return _hWait; }
+ }
+
+ bool IAsyncResult.CompletedSynchronously
+ {
+ get { return true; }
+ }
+
+ bool IAsyncResult.IsCompleted
+ {
+ get { return _fComplete; }
+ }
+ }
+ private class SyncReadResult : SyncResult
+ {
+ public int _cbRead; // the number of bytes read
+
+ public SyncReadResult (object objState) : base (objState) {}
+
+ public void Complete (int cbRead)
+ {
+ _cbRead = cbRead;
+ Complete ();
+ }
+ }
+ private class SyncWriteResult : SyncResult
+ {
+ public SyncWriteResult (object objState) : base (objState) {}
+ }
+ }
+
+ class NullStream : Stream
+ {
+ public override bool CanRead
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanSeek
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length
+ {
+ get {
+ return 0;
+ }
+ }
+
+ public override long Position
+ {
+ get {
+ return 0;
+ }
+ set {
+ }
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public override int Read (byte[] buffer,
+ int offset,
+ int count)
+ {
+ return 0;
+ }
+
+ public override int ReadByte ()
+ {
+ return -1;
+ }
+
+ public override long Seek (long offset,
+ SeekOrigin origin)
+ {
+ return 0;
+ }
+
+ public override void SetLength (long value)
+ {
+ }
+
+ public override void Write (byte[] buffer,
+ int offset,
+ int count)
+ {
+ }
+
+ public override void WriteByte (byte value)
+ {
+ }
+ }
+}
+
+
+
+
+
+
+
diff --git a/mcs/class/corlib/System.IO/StreamReader.cs b/mcs/class/corlib/System.IO/StreamReader.cs
new file mode 100644
index 00000000000..7293b5ec95b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StreamReader.cs
@@ -0,0 +1,388 @@
+//
+// System.IO.StreamReader.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Text;
+
+
+namespace System.IO {
+ [Serializable]
+ public class StreamReader : TextReader {
+
+ private const int DefaultBufferSize = 1024;
+ private const int DefaultFileBufferSize = 4096;
+ private const int MinimumBufferSize = 128;
+
+ //
+ // The input buffer
+ //
+ private byte [] input_buffer;
+
+ //
+ // The decoded buffer from the above input buffer
+ //
+ private char [] decoded_buffer;
+
+ //
+ // Decoded bytes in decoded_buffer.
+ //
+ private int decoded_count;
+
+ //
+ // Current position in the decoded_buffer
+ //
+ private int pos;
+
+ //
+ // The buffer size that we are using
+ //
+ private int buffer_size;
+
+ //
+ // Index into `input_buffer' where we start decoding
+ //
+ private int parse_start;
+
+ int do_checks;
+
+ private Encoding encoding;
+ private Decoder decoder;
+
+ private Stream base_stream;
+
+ private class NullStreamReader : StreamReader {
+ public override int Peek ()
+ {
+ return -1;
+ }
+
+ public override int Read ()
+ {
+ return -1;
+ }
+
+ public override int Read (char[] buffer, int index, int count)
+ {
+ return 0;
+ }
+
+ public override string ReadLine ()
+ {
+ return null;
+ }
+
+ public override string ReadToEnd ()
+ {
+ return String.Empty;
+ }
+
+ public override Stream BaseStream
+ {
+ get { return Stream.Null; }
+ }
+
+ public override Encoding CurrentEncoding
+ {
+ get { return Encoding.Unicode; }
+ }
+ }
+
+ public new static readonly StreamReader Null = (StreamReader)(new NullStreamReader());
+
+ internal StreamReader() {}
+
+ public StreamReader(Stream stream)
+ : this (stream, Encoding.UTF8Unmarked, true, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, bool detect_encoding_from_bytemarks)
+ : this (stream, Encoding.UTF8Unmarked, detect_encoding_from_bytemarks, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding)
+ : this (stream, encoding, true, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks)
+ : this (stream, encoding, detect_encoding_from_bytemarks, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
+ {
+ Initialize (stream, encoding, detect_encoding_from_bytemarks, buffer_size);
+ }
+
+ public StreamReader(string path)
+ : this (path, Encoding.UTF8Unmarked, true, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, bool detect_encoding_from_bytemarks)
+ : this (path, Encoding.UTF8Unmarked, detect_encoding_from_bytemarks, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding)
+ : this (path, encoding, true, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks)
+ : this (path, encoding, detect_encoding_from_bytemarks, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
+ {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path)
+ throw new ArgumentException("Empty path not allowed");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException("path contains invalid characters");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists(DirName))
+ throw new DirectoryNotFoundException ("Directory '" + DirName + "' not found.");
+ if (!File.Exists(path))
+ throw new FileNotFoundException(path);
+
+ Stream stream = (Stream) File.OpenRead (path);
+ Initialize (stream, encoding, detect_encoding_from_bytemarks, buffer_size);
+ }
+
+ protected void Initialize (Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
+ {
+ if (null == stream)
+ throw new ArgumentNullException("stream");
+ if (!stream.CanRead)
+ throw new ArgumentException("Cannot read stream");
+
+ if (buffer_size < MinimumBufferSize)
+ buffer_size = MinimumBufferSize;
+
+ base_stream = stream;
+ input_buffer = new byte [buffer_size];
+ this.buffer_size = buffer_size;
+ this.encoding = encoding;
+ decoder = encoding.GetDecoder ();
+
+ byte [] preamble = encoding.GetPreamble ();
+ do_checks = detect_encoding_from_bytemarks ? 1 : 0;
+ do_checks += (preamble.Length == 0) ? 0 : 2;
+
+ decoded_buffer = new char [encoding.GetMaxCharCount (buffer_size)];
+ decoded_count = 0;
+ pos = 0;
+ }
+
+ public virtual Stream BaseStream
+ {
+ get {
+ return base_stream;
+ }
+ }
+
+ public virtual Encoding CurrentEncoding
+ {
+ get {
+ if (encoding == null)
+ throw new Exception ();
+ return encoding;
+ }
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing && base_stream != null)
+ base_stream.Close ();
+
+ input_buffer = null;
+ decoded_buffer = null;
+ encoding = null;
+ decoder = null;
+ base_stream = null;
+ base.Dispose (disposing);
+ }
+
+ //
+ // Provides auto-detection of the encoding, as well as skipping over
+ // byte marks at the beginning of a stream.
+ //
+ int DoChecks (int count)
+ {
+ if ((do_checks & 2) == 2){
+ byte [] preamble = encoding.GetPreamble ();
+ int c = preamble.Length;
+ if (count >= c){
+ int i;
+
+ for (i = 0; i < c; i++)
+ if (input_buffer [i] != preamble [i])
+ break;
+
+ if (i == c)
+ return i;
+ }
+ }
+
+ if ((do_checks & 1) == 1){
+ if (count < 2)
+ return 0;
+
+ if (input_buffer [0] == 0xfe && input_buffer [1] == 0xff){
+ this.encoding = Encoding.BigEndianUnicode;
+ return 2;
+ }
+
+ if (input_buffer [0] == 0xff && input_buffer [1] == 0xfe){
+ this.encoding = Encoding.Unicode;
+ return 2;
+ }
+
+ if (count < 3)
+ return 0;
+
+ if (input_buffer [0] == 0xef && input_buffer [1] == 0xbb && input_buffer [2] == 0xbf){
+ this.encoding = Encoding.UTF8Unmarked;
+ return 3;
+ }
+ }
+
+ return 0;
+ }
+
+ // the buffer is empty, fill it again
+ private int ReadBuffer ()
+ {
+ pos = 0;
+ int cbEncoded = 0;
+
+ // keep looping until the decoder gives us some chars
+ decoded_count = 0;
+ int parse_start = 0;
+ do
+ {
+ cbEncoded = base_stream.Read (input_buffer, 0, buffer_size);
+
+ if (cbEncoded == 0)
+ return 0;
+
+ if (do_checks > 0){
+ Encoding old = encoding;
+ parse_start = DoChecks (cbEncoded);
+ if (old != encoding){
+ decoder = encoding.GetDecoder ();
+ }
+ do_checks = 0;
+ cbEncoded -= parse_start;
+ }
+
+ decoded_count += decoder.GetChars (input_buffer, parse_start, cbEncoded, decoded_buffer, 0);
+ parse_start = 0;
+ } while (decoded_count == 0);
+
+ return decoded_count;
+ }
+
+ public override int Peek ()
+ {
+ if (!base_stream.CanSeek)
+ return -1;
+
+ if (pos >= decoded_count && ReadBuffer () == 0)
+ return -1;
+
+ return decoded_buffer [pos];
+ }
+
+ public override int Read ()
+ {
+ if (pos >= decoded_count && ReadBuffer () == 0)
+ return -1;
+
+ return decoded_buffer [pos++];
+ }
+
+ public override int Read (char[] dest_buffer, int index, int count)
+ {
+ if (dest_buffer == null)
+ throw new ArgumentException ();
+
+ if ((index < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+
+ if (index + count > dest_buffer.Length)
+ throw new ArgumentException ();
+
+ int chars_read = 0;
+ while (count > 0)
+ {
+ if (pos >= decoded_count && ReadBuffer () == 0)
+ return chars_read > 0 ? chars_read : 0;
+
+ int cch = Math.Min (decoded_count - pos, count);
+ Array.Copy (decoded_buffer, pos, dest_buffer, index, cch);
+ pos += cch;
+ index += cch;
+ count -= cch;
+ chars_read += cch;
+ }
+ return chars_read;
+ }
+
+ public override string ReadLine()
+ {
+ bool foundCR = false;
+ StringBuilder text = new StringBuilder ();
+
+ while (true) {
+ int c = Read ();
+
+ if (c == -1) { // end of stream
+ if (text.Length == 0)
+ return null;
+
+ if (foundCR)
+ text.Length--;
+
+ break;
+ }
+
+ if (c == '\n') { // newline
+ if ((text.Length > 0) && (text [text.Length - 1] == '\r'))
+ text.Length--;
+
+ foundCR = false;
+ break;
+ } else if (foundCR) {
+ pos--;
+ text.Length--;
+ break;
+ }
+
+ if (c == '\r')
+ foundCR = true;
+
+
+ text.Append ((char) c);
+ }
+
+ return text.ToString ();
+ }
+
+ public override string ReadToEnd()
+ {
+ StringBuilder text = new StringBuilder ();
+
+ int size = decoded_buffer.Length;
+ char [] buffer = new char [size];
+ int len;
+
+ while ((len = Read (buffer, 0, size)) != 0)
+ text.Append (buffer, 0, len);
+
+ return text.ToString ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs
new file mode 100644
index 00000000000..93d5931775b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StreamWriter.cs
@@ -0,0 +1,219 @@
+//
+// System.IO.StreamWriter.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Text;
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public class StreamWriter : TextWriter {
+
+ private Encoding internalEncoding;
+
+ private Stream internalStream;
+ private bool closed = false;
+
+ private bool iflush;
+
+ private const int DefaultBufferSize = 1024;
+ private const int DefaultFileBufferSize = 4096;
+ private const int MinimumBufferSize = 2;
+
+ private int pos;
+ private int BufferSize;
+ private byte[] TheBuffer;
+
+ private bool DisposedAlready = false;
+ private bool preamble_done = false;
+
+ public new static readonly StreamWriter Null = new StreamWriter (Stream.Null, Encoding.UTF8Unmarked, 0);
+
+ public StreamWriter (Stream stream)
+ : this (stream, Encoding.UTF8Unmarked, DefaultBufferSize) {}
+
+ public StreamWriter (Stream stream, Encoding encoding)
+ : this (stream, encoding, DefaultBufferSize) {}
+
+ internal void Initialize(Encoding encoding, int bufferSize) {
+ internalEncoding = encoding;
+ pos = 0;
+ BufferSize = Math.Max(bufferSize, MinimumBufferSize);
+ TheBuffer = new byte[BufferSize];
+ }
+
+ //[MonoTODO("Nothing is done with bufferSize")]
+ public StreamWriter (Stream stream, Encoding encoding, int bufferSize) {
+ if (null == stream)
+ throw new ArgumentNullException("stream");
+ if (null == encoding)
+ throw new ArgumentNullException("encoding");
+ if (bufferSize < 0)
+ throw new ArgumentOutOfRangeException("bufferSize");
+ if (!stream.CanWrite)
+ throw new ArgumentException("bufferSize");
+
+ internalStream = stream;
+
+ Initialize(encoding, bufferSize);
+ }
+
+ public StreamWriter (string path)
+ : this (path, false, Encoding.UTF8Unmarked, DefaultFileBufferSize) {}
+
+ public StreamWriter (string path, bool append)
+ : this (path, append, Encoding.UTF8Unmarked, DefaultFileBufferSize) {}
+
+ public StreamWriter (string path, bool append, Encoding encoding)
+ : this (path, append, encoding, DefaultFileBufferSize) {}
+
+ public StreamWriter (string path, bool append, Encoding encoding, int bufferSize) {
+ if (null == path)
+ throw new ArgumentNullException("path");
+ if (String.Empty == path)
+ throw new ArgumentException("path cannot be empty string");
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException("path contains invalid characters");
+
+ if (null == encoding)
+ throw new ArgumentNullException("encoding");
+ if (bufferSize < 0)
+ throw new ArgumentOutOfRangeException("bufferSize");
+
+ string DirName = Path.GetDirectoryName(path);
+ if (DirName != String.Empty && !Directory.Exists(DirName))
+ throw new DirectoryNotFoundException();
+
+ FileMode mode;
+
+ if (append)
+ mode = FileMode.Append;
+ else
+ mode = FileMode.Create;
+
+ internalStream = new FileStream (path, mode, FileAccess.Write);
+
+ if (append)
+ internalStream.Position = internalStream.Length;
+ else
+ internalStream.SetLength (0);
+
+ Initialize(encoding, bufferSize);
+ }
+
+ public virtual bool AutoFlush {
+ get {
+ return iflush;
+ }
+ set {
+ iflush = value;
+ }
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return internalStream;
+ }
+ }
+
+ public override Encoding Encoding {
+ get {
+ return internalEncoding;
+ }
+ }
+
+ protected override void Dispose (bool disposing) {
+ if (!DisposedAlready && disposing && internalStream != null) {
+ Flush();
+ DisposedAlready = true;
+ internalStream.Close ();
+ }
+
+ internalStream = null;
+ TheBuffer = null;
+ internalEncoding = null;
+ }
+
+ public override void Flush () {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ if (pos > 0) {
+ internalStream.Write (TheBuffer, 0, pos);
+ internalStream.Flush ();
+ pos = 0;
+ }
+ }
+
+ public override void Write (char[] buffer, int index, int count) {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ byte[] res = new byte [internalEncoding.GetByteCount (buffer)];
+ int len;
+ int BytesToBuffer;
+ int resPos = 0;
+
+ len = internalEncoding.GetBytes (buffer, index, count, res, 0);
+ // write the encoding preamble only at the start of the stream
+ if (!preamble_done && len > 0) {
+ byte[] preamble = internalEncoding.GetPreamble ();
+ if (preamble.Length > 0)
+ internalStream.Write (preamble, 0, preamble.Length);
+ preamble_done = true;
+ }
+
+ // if they want AutoFlush, don't bother buffering
+ if (iflush) {
+ Flush();
+ internalStream.Write (res, 0, len);
+ internalStream.Flush ();
+ } else {
+ // otherwise use the buffer.
+ // NOTE: this logic is not optimized for performance.
+ while (resPos < len) {
+ // fill the buffer if we've got more bytes than will fit
+ BytesToBuffer = Math.Min(BufferSize - pos, len - resPos);
+ Array.Copy(res, resPos, TheBuffer, pos, BytesToBuffer);
+ resPos += BytesToBuffer;
+ pos += BytesToBuffer;
+ // if the buffer is full, flush it out.
+ if (pos == BufferSize) Flush();
+ }
+ }
+ }
+
+ public override void Write (char value)
+ {
+ Write (new char [] {value}, 0, 1);
+ }
+
+ public override void Write (char [] value)
+ {
+ Write (value, 0, value.Length);
+ }
+
+ public override void Write(string value) {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ if (value != null)
+ Write (value.ToCharArray (), 0, value.Length);
+ }
+
+ public override void Close()
+ {
+ Dispose (true);
+ }
+
+ ~StreamWriter() {
+ Dispose(false);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StringReader.cs b/mcs/class/corlib/System.IO/StringReader.cs
new file mode 100644
index 00000000000..47c4d3f7346
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StringReader.cs
@@ -0,0 +1,133 @@
+//
+// System.IO.StringReader
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+
+
+using System;
+
+namespace System.IO {
+ [Serializable]
+ public class StringReader : TextReader {
+
+ private string source;
+ private char[] sourceChars;
+
+ private int nextChar;
+ private int sourceLength;
+
+ public StringReader( string s ) {
+ this.source = s;
+ nextChar = 0;
+ sourceLength = s.Length;
+ sourceChars = s.ToCharArray();
+ }
+
+ public override void Close() {
+ Dispose( true );
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ sourceChars = null;
+ base.Dispose (disposing);
+ }
+
+ public override int Peek() {
+ if( nextChar >= sourceLength ) {
+ return -1;
+ } else {
+ return (int)source[ nextChar ];
+ }
+ }
+
+ public override int Read() {
+ if( nextChar >= sourceLength ) {
+ return -1;
+ } else {
+ return (int)source[ nextChar++ ];
+ }
+ }
+
+
+ // The method will read up to count characters from the StringReader
+ // into the buffer character array starting at position index. Returns
+ // the actual number of characters read, or zero if the end of the string
+ // has been reached and no characters are read.
+
+ public override int Read( char[] buffer, int index, int count ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( buffer.Length - index < count ) {
+ throw new ArgumentException();
+ } else if( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ int charsToRead;
+
+ if( nextChar + count > sourceLength ) {
+ charsToRead = sourceLength - nextChar;
+ } else {
+ charsToRead = count;
+ }
+
+ Array.Copy(sourceChars, nextChar, buffer, index, charsToRead );
+
+ nextChar += count;
+
+ return charsToRead;
+ }
+
+ public override string ReadLine() {
+ // Reads until next \r or \n or \r\n, otherwise return null
+
+ // LAMESPEC:
+ // The Beta 2 SDK help says that the ReadLine method returns
+ // "The next line from the input stream [...] A line is defined as a sequence of
+ // characters followed by a carriage return (\r), a line feed (\n), or a carriage
+ // return immediately followed by a line feed (\r\n). [...]
+ // The returned value is a null reference if the end of the input stream has been reached."
+ //
+ // HOWEVER, the MS implementation returns the rest of the string if no \r and/or \n is found
+ // in the string
+
+ if (nextChar == source.Length)
+ return null;
+
+ int nextCR = source.IndexOf( '\r', nextChar );
+ int nextLF = source.IndexOf( '\n', nextChar );
+
+ if( nextCR == -1 && nextLF == -1 ) {
+ return ReadToEnd();
+ }
+
+ int readTo;
+
+ if( nextCR == -1 ) {
+ readTo = nextLF;
+ } else {
+ readTo = nextCR;
+ }
+
+ string nextLine = source.Substring( nextChar, readTo - nextChar );
+
+ if( nextLF == nextCR + 1 ) {
+ nextChar = readTo + 2;
+ } else {
+ nextChar = readTo + 1;
+ }
+
+ return nextLine;
+ }
+
+ public override string ReadToEnd() {
+ string toEnd = source.Substring( nextChar, sourceLength - nextChar );
+ nextChar = sourceLength;
+ return toEnd;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StringWriter.cs b/mcs/class/corlib/System.IO/StringWriter.cs
new file mode 100644
index 00000000000..7cb175c482b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StringWriter.cs
@@ -0,0 +1,83 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+
+using System.Text;
+
+namespace System.IO {
+ [Serializable]
+ public class StringWriter : TextWriter {
+
+ private StringBuilder internalString;
+
+ public StringWriter() {
+ internalString = new StringBuilder();
+ }
+
+ public StringWriter( IFormatProvider formatProvider ) {
+ internalFormatProvider = formatProvider;
+ }
+
+ public StringWriter( StringBuilder sb ) {
+ internalString = sb;
+ }
+
+ public StringWriter( StringBuilder sb, IFormatProvider formatProvider ) {
+ internalString = sb;
+ internalFormatProvider = formatProvider;
+ }
+
+ public override System.Text.Encoding Encoding {
+ get {
+ return System.Text.Encoding.Unicode;
+ }
+ }
+
+ public override void Close() {
+ Dispose( true );
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ internalString = null;
+ base.Dispose (disposing);
+ }
+
+ public virtual StringBuilder GetStringBuilder() {
+ return internalString;
+ }
+
+ public override string ToString() {
+ return internalString.ToString();
+ }
+
+ public override void Write( char value ) {
+ internalString.Append( value );
+ }
+
+ public override void Write( string value ) {
+ internalString.Append( value );
+ }
+
+ public override void Write( char[] buffer, int index, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( index > buffer.Length || index + count > buffer.Length ) {
+ throw new ArgumentException();
+ }
+
+ char[] writeBuffer = new char[ count ];
+
+ Array.Copy( buffer, index, writeBuffer, 0, count );
+
+ internalString.Append( writeBuffer );
+ }
+
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.IO/TextReader.cs b/mcs/class/corlib/System.IO/TextReader.cs
new file mode 100644
index 00000000000..07eaa717015
--- /dev/null
+++ b/mcs/class/corlib/System.IO/TextReader.cs
@@ -0,0 +1,87 @@
+//
+// System.IO.TextReader
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the Thread Safe stuff
+//
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class TextReader : MarshalByRefObject, IDisposable {
+
+ protected TextReader() { }
+
+ public static readonly TextReader Null;
+
+ public virtual void Close()
+ {
+ Dispose(true);
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected virtual void Dispose( bool disposing )
+ {
+ return;
+ }
+
+ public virtual int Peek()
+ {
+ return -1;
+ }
+
+ public virtual int Read()
+ {
+ return -1;
+ }
+
+ public virtual int Read (char[] buffer, int index, int count)
+ {
+ int c, i;
+
+ for (i = 0; i < count; i++) {
+ if ((c = Read ()) == -1)
+ return i;
+ buffer [index + i] = (char)c;
+ }
+
+ return i;
+ }
+
+ public virtual int ReadBlock (char [] buffer, int index, int count)
+ {
+ int read_count = 0;
+ do {
+ read_count = Read (buffer, index, count);
+ index += read_count;
+ count -= read_count;
+ } while (read_count != 0 && count > 0);
+
+ return read_count;
+ }
+
+ public virtual string ReadLine()
+ {
+ return String.Empty;
+ }
+
+ public virtual string ReadToEnd()
+ {
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ public static TextReader Synchronized( TextReader reader )
+ {
+ // TODO: Implement
+ return Null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/TextWriter.cs b/mcs/class/corlib/System.IO/TextWriter.cs
new file mode 100644
index 00000000000..59e221ef1fa
--- /dev/null
+++ b/mcs/class/corlib/System.IO/TextWriter.cs
@@ -0,0 +1,289 @@
+//
+// System.IO.TextWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the Thread Safe stuff
+
+using System.Text;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class TextWriter : MarshalByRefObject, IDisposable {
+
+ protected TextWriter() {
+ CoreNewLine = "\n".ToCharArray ();
+ }
+
+ protected TextWriter( IFormatProvider formatProvider ) {
+ internalFormatProvider = formatProvider;
+ }
+
+ protected char[] CoreNewLine;
+
+ internal IFormatProvider internalFormatProvider;
+
+ public static readonly TextWriter Null = new NullTextWriter ();
+
+ public abstract Encoding Encoding { get; }
+
+ public virtual IFormatProvider FormatProvider {
+ get {
+ return internalFormatProvider;
+ }
+ }
+
+ public virtual string NewLine {
+ get {
+ return new String(CoreNewLine);
+ }
+
+ set {
+ CoreNewLine = value.ToCharArray();
+ }
+ }
+
+ public virtual void Close () {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing) { }
+
+ void System.IDisposable.Dispose () {
+ Dispose (true);
+ }
+
+
+ public virtual void Flush()
+ {
+ // do nothing
+ }
+
+ [MonoTODO]
+ public static TextWriter Synchronized (TextWriter writer)
+ {
+ // TODO: Implement.
+
+ return Null;
+ }
+
+ public virtual void Write (bool value)
+ {
+ Write (value.ToString ());
+ }
+
+ public virtual void Write (char value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (char[] value)
+ {
+ if (value != null)
+ Write (new String (value));
+ }
+
+ public virtual void Write (decimal value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (double value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (int value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (long value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (object value)
+ {
+ if (value != null)
+ Write (value.ToString ());
+ }
+
+ public virtual void Write (float value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (string value)
+ {
+ // do nothing
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write (uint value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write (ulong value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (string format, object arg0)
+ {
+ Write (String.Format (format, arg0));
+ }
+
+ public virtual void Write (string format, params object[] arg)
+ {
+ Write (String.Format (format, arg));
+ }
+
+ public virtual void Write (char[] buffer, int index, int count)
+ {
+ Write (new String (buffer, index, count));
+ }
+
+ public virtual void Write (string format, object arg0, object arg1)
+ {
+ Write (String.Format (format, arg0, arg1));
+ }
+
+ public virtual void Write (string format, object arg0, object arg1, object arg2 )
+ {
+ Write (String.Format (format, arg0, arg1, arg2));
+ }
+
+ public virtual void WriteLine ()
+ {
+ Write (NewLine);
+ }
+
+ public virtual void WriteLine (bool value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char[] value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (decimal value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (double value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (int value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (long value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (object value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (float value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public virtual void WriteLine (uint value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public virtual void WriteLine (ulong value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0)
+ {
+ Write (format, arg0);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, params object[] arg)
+ {
+ Write (format, arg);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char[] buffer, int index, int count)
+ {
+ Write (buffer, index, count);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0, object arg1)
+ {
+ Write (format, arg0, arg1);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0, object arg1, object arg2)
+ {
+ Write (format, arg0, arg1, arg2);
+ WriteLine();
+ }
+
+ //
+ // Null version of the TextWriter, for the `Null' instance variable
+ //
+ sealed class NullTextWriter : TextWriter {
+ public override Encoding Encoding {
+ get {
+ return Encoding.Default;
+ }
+ }
+
+ public override void Write (string s)
+ {
+ }
+ }
+ }
+}
+
+
+
+
+
diff --git a/mcs/class/corlib/System.PAL/IOperatingSystem.cs b/mcs/class/corlib/System.PAL/IOperatingSystem.cs
new file mode 100644
index 00000000000..15c57faae36
--- /dev/null
+++ b/mcs/class/corlib/System.PAL/IOperatingSystem.cs
@@ -0,0 +1,194 @@
+/*---------------------------------------------------------------------
+
+ XX X XXX
+ XX XX
+ XXX XX XXX XXXXX XX
+ XX XXX XX XX XX
+ XX XX XX XX XXXXX XX
+ XX XX XX XX XX XX X XX
+ XXXX XX XX XXX XXXXXXX XXXX
+ XX
+ XXXXX
+
+Copyright (c) 2001 Intel Corporation. All Rights Reserved.
+
+CREATED: August 08, 2001
+OWNER: Scott D Smith, Joel Marcey
+VERSION: 1.0
+---------------------------------------------------------------------*/
+
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace System.PlatformAbstractionLayer
+{
+ /// <summary>
+ /// Definition of functionality needed by the library that can only be provided by the underlying OS.
+ /// </summary>
+ internal interface IOperatingSystem
+ {
+
+ // System.IO services
+
+ int ReadStdInput(byte[] buffer, int offset, int count);
+
+ void FlushStdOutput(byte[] byteBuf);
+
+
+
+ // System.File services
+
+ int ReadFile(IntPtr handle, byte[] buffer, int offset, int count);
+
+ int WriteFile(IntPtr handle, byte[] buffer, int offset, int count);
+
+ void FlushFile(IntPtr handle, byte[] byteBuf);
+
+ int SetLengthFile(IntPtr handle, long length);
+
+ IntPtr OpenFile(string path, FileMode mode, FileAccess access, FileShare share);
+
+ void CloseFile(IntPtr handle);
+
+ long SeekFile(IntPtr handle, long offset, SeekOrigin origin);
+
+ IntPtr CreateFile(string path, FileMode mode, FileAccess access, FileShare share);
+
+ void DeleteFile(string path);
+
+ bool ExistsFile(string path);
+
+ DateTime GetCreationTimeFile(string path);
+
+ DateTime GetLastAccessTimeFile(string path);
+
+ DateTime GetLastWriteTimeFile(string path);
+
+ void SetCreationTimeFile(string path, DateTime creationTime);
+
+ void SetLastAccessTimeFile(string path, DateTime lastAccessTime);
+
+ void SetLastWriteTimeFile(string path, DateTime lastWriteTime);
+
+ long FileLength(string path);
+
+ long FileLength(IntPtr handle);
+
+
+ // System.Environment services
+
+ string NewLineSequence {get;}
+
+ char DirectorySeparator {get;}
+
+ char AltDirectorySeparator {get;}
+
+ char PathSeparator {get;}
+
+ char VolumeSeparator {get;}
+
+ char[] DirVolSeparatorChars {get;}
+
+ char[] InvalidPathChars {get;}
+
+ string GetEnvironmentVariable(string eVar);
+
+ char ExtensionCharacter {get;}
+
+ string CommandLine {get;}
+
+ IDictionary EnvironmentVariables {get;}
+
+ string MachineName {get;}
+
+ OperatingSystem OSVersion {get;}
+
+ // System.Path services
+ // Note: Although some of these do not require direct acccess to the OS,
+ // some platforms don't support some of these methods
+
+ string ChangeExtension(string path, string extension);
+
+ string GetExtension(string path);
+
+ string GetFileName(string path);
+
+ string GetFileNameWithoutExtension(string path);
+
+ string GetPathRoot(string path);
+
+ string GetTempFileName();
+
+ string GetTempPath();
+
+ bool HasExtension(string path);
+
+ bool IsPathRooted(string path);
+
+ string GetFullPath(string path);
+
+
+ // System.Directory services
+
+ void DeleteDirectory(string path, bool recursive);
+
+ bool ExistsDirectory(string path);
+
+ DateTime GetCreationTimeDirectory(string path);
+
+ string GetCurrentDirectory();
+
+ string[] GetDirectories(string path, string searchPattern);
+
+ string[] GetFiles(string path, string searchPattern);
+
+ string[] GetFileSystemEntries(string path, string searchPattern);
+
+ DateTime GetLastAccessTimeDirectory(string path);
+
+ DateTime GetLastWriteTimeDirectory(string path);
+
+ void MoveDirectory(string sourceDirName, string destDirName);
+
+ void SetCreationTimeDirectory(string path, DateTime creationTime);
+
+ void SetCurrentDirectory(string path);
+
+ void SetLastAccessTimeDirectory(string path, DateTime lastAccessTime);
+
+ void SetLastWriteTimeDirectory(string path, DateTime lastWriteTime);
+
+ double Acos(double d);
+
+ double Asin(double d);
+
+ double Atan(double d);
+
+ double Atan2(double y, double x);
+
+ double Cos(double d);
+
+ double Cosh(double value);
+
+ double Exp(dobule d);
+
+ double Log(double d);
+
+ double Log10(double d);
+
+ double Pow(double x, double y);
+
+ double Sin(double d);
+
+ double Sinh(double d);
+
+ double Sqrt(double d);
+
+ double Tan(double d);
+
+ double Tanh(double d);
+
+ }
+}
diff --git a/mcs/class/corlib/System.PAL/Platform.cs b/mcs/class/corlib/System.PAL/Platform.cs
new file mode 100644
index 00000000000..bfaa276dbc5
--- /dev/null
+++ b/mcs/class/corlib/System.PAL/Platform.cs
@@ -0,0 +1,23 @@
+// Sean MacIsaac
+// Only want to have 1 OperatingSystemObject around.
+// We get the correct one from compile time.
+
+namespace System.PAL
+{
+ internal class Platform
+ {
+ private static OpSys _os;
+
+ public static OpSys OS
+ {
+
+ get
+ {
+ if (_os == null) {
+ _os = new OpSys ();
+ }
+ return _os;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
new file mode 100755
index 00000000000..4241be02826
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
@@ -0,0 +1,351 @@
+//
+// System.Reflection.Emit/AssemblyBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.IO;
+using System.Security.Policy;
+using System.Runtime.Serialization;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Collections;
+
+namespace System.Reflection.Emit {
+
+ internal struct MonoResource {
+ public byte[] data;
+ public string name;
+ public string filename;
+ public ResourceAttributes attrs;
+ }
+
+ public sealed class AssemblyBuilder : Assembly {
+ private IntPtr dynamic_assembly;
+ private MethodInfo entry_point;
+ private ModuleBuilder[] modules;
+ private string name;
+ private string dir;
+ private CustomAttributeBuilder[] cattrs;
+ private MonoResource[] resources;
+ string keyfile;
+ string version;
+ string culture;
+ uint algid;
+ uint flags;
+ PEFileKinds pekind = PEFileKinds.Dll;
+ bool delay_sign;
+ internal Type corlib_object_type = typeof (System.Object);
+ internal Type corlib_value_type = typeof (System.ValueType);
+ internal Type corlib_enum_type = typeof (System.Enum);
+ private int[] table_indexes;
+ internal ArrayList methods;
+ Hashtable us_string_cache = new Hashtable ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void basic_init (AssemblyBuilder ab);
+
+ internal AssemblyBuilder (AssemblyName n, string directory, AssemblyBuilderAccess access) {
+ name = n.Name;
+ dir = directory;
+ basic_init (this);
+ }
+
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ if (table_indexes == null) {
+ table_indexes = new int [64];
+ for (int i=0; i < 64; ++i)
+ table_indexes [i] = 1;
+ /* allow room for .<Module> in TypeDef table */
+ table_indexes [0x02] = 2;
+ }
+ // Console.WriteLine ("getindex for table "+table.ToString()+" got "+table_indexes [table].ToString());
+ if (inc) {
+ if ((table == 0x06) && (methods != null))
+ methods.Add (obj);
+ return table_indexes [table]++;
+ }
+ return table_indexes [table];
+ }
+
+ public override string CodeBase {
+ get {
+ return null;
+ }
+ }
+
+ public override MethodInfo EntryPoint {
+ get {
+ return entry_point;
+ }
+ }
+
+ public override string Location {
+ get {
+ return null;
+ }
+ }
+
+ public void AddResourceFile (string name, string fileName)
+ {
+ AddResourceFile (name, fileName, ResourceAttributes.Public);
+ }
+
+ public void AddResourceFile (string name, string fileName, ResourceAttributes attribute)
+ {
+ if (resources != null) {
+ MonoResource[] new_r = new MonoResource [resources.Length + 1];
+ System.Array.Copy(resources, new_r, resources.Length);
+ resources = new_r;
+ } else {
+ resources = new MonoResource [1];
+ }
+ int p = resources.Length - 1;
+ resources [p].name = name;
+ resources [p].filename = fileName;
+ resources [p].attrs = attribute;
+ }
+
+ public void EmbedResourceFile (string name, string fileName)
+ {
+ EmbedResourceFile (name, fileName, ResourceAttributes.Public);
+ }
+
+ public void EmbedResourceFile (string name, string fileName, ResourceAttributes attribute)
+ {
+ if (resources != null) {
+ MonoResource[] new_r = new MonoResource [resources.Length + 1];
+ System.Array.Copy(resources, new_r, resources.Length);
+ resources = new_r;
+ } else {
+ resources = new MonoResource [1];
+ }
+ int p = resources.Length - 1;
+ resources [p].name = name;
+ resources [p].attrs = attribute;
+ try {
+ FileStream s = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+ long len = s.Length;
+ resources [p].data = new byte [len];
+ s.Read (resources [p].data, 0, (int)len);
+ s.Close ();
+ } catch {
+ /* do something */
+ }
+ }
+
+ public ModuleBuilder DefineDynamicModule (string name)
+ {
+ return DefineDynamicModule (name, name, false);
+ }
+
+ public ModuleBuilder DefineDynamicModule (string name, bool emitSymbolInfo)
+ {
+ return DefineDynamicModule (name, name, emitSymbolInfo);
+ }
+
+ public ModuleBuilder DefineDynamicModule(string name, string fileName)
+ {
+ return DefineDynamicModule (name, fileName, false);
+ }
+
+ public ModuleBuilder DefineDynamicModule (string name, string fileName,
+ bool emitSymbolInfo)
+ {
+ ModuleBuilder r = new ModuleBuilder (this, name, fileName, emitSymbolInfo);
+
+ if (modules != null) {
+ ModuleBuilder[] new_modules = new ModuleBuilder [modules.Length + 1];
+ System.Array.Copy(modules, new_modules, modules.Length);
+ new_modules [modules.Length] = r;
+ modules = new_modules;
+ } else {
+ modules = new ModuleBuilder [1];
+ modules [0] = r;
+ }
+ return r;
+ }
+
+ public IResourceWriter DefineResource (string name, string description, string fileName)
+ {
+ return DefineResource (name, description, fileName, ResourceAttributes.Public);
+ }
+
+ public IResourceWriter DefineResource (string name, string description,
+ string fileName, ResourceAttributes attribute)
+ {
+ return null;
+ }
+
+ public void DefineUnmanagedResource (byte[] resource)
+ {
+ }
+
+ public void DefineUnmanagedResource (string resourceFileName)
+ {
+ }
+
+ public void DefineVersionInfoResource ()
+ {
+ }
+
+ public void DefineVersionInfoResource (string product, string productVersion,
+ string company, string copyright, string trademark)
+ {
+ }
+
+ public ModuleBuilder GetDynamicModule (string name)
+ {
+ return null;
+ }
+
+ public override Type[] GetExportedTypes ()
+ {
+ return null;
+ }
+
+ public override FileStream GetFile (string name)
+ {
+ return null;
+ }
+
+ /*public virtual FileStream[] GetFiles() {
+ return null;
+ }
+ public override FileStream[] GetFiles(bool getResourceModules) {
+ return null;
+ }*/
+
+ /*public virtual ManifestResourceInfo GetManifestResourceInfo(string resourceName)
+ {
+ return null;
+ }
+ public virtual string[] GetManifestResourceNames() {
+ return null;
+ }
+ public virtual Stream GetManifestResourceStream(string name) {
+ return null;
+ }
+ public virtual Stream GetManifestResourceStream(Type type, string name) {
+ return null;
+ }*/
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getUSIndex (AssemblyBuilder ab, string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getToken (AssemblyBuilder ab, MemberInfo member);
+
+ internal int GetToken (string str) {
+ if (us_string_cache.Contains (str))
+ return (int)us_string_cache [str];
+ int result = getUSIndex (this, str);
+ us_string_cache [str] = result;
+ return result;
+ }
+
+ internal int GetToken (MemberInfo member) {
+ return getToken (this, member);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getDataChunk (AssemblyBuilder ab, byte[] buf, int offset);
+
+ public void Save (string assemblyFileName)
+ {
+ byte[] buf = new byte [65536];
+ FileStream file;
+ int count, offset;
+
+ if (dir != null) {
+ assemblyFileName = String.Format ("{0}{1}{2}", dir, System.IO.Path.DirectorySeparatorChar, assemblyFileName);
+ }
+
+ file = new FileStream (assemblyFileName, FileMode.Create, FileAccess.Write);
+
+ offset = 0;
+ while ((count = getDataChunk (this, buf, offset)) != 0) {
+ file.Write (buf, 0, count);
+ offset += count;
+ }
+ file.Close ();
+ }
+
+ public void SetEntryPoint (MethodInfo entryMethod)
+ {
+ SetEntryPoint (entryMethod, PEFileKinds.ConsoleApplication);
+ }
+
+ public void SetEntryPoint (MethodInfo entryMethod, PEFileKinds fileKind)
+ {
+ entry_point = entryMethod;
+ pekind = fileKind;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ byte[] data;
+ int len, pos;
+ if (attrname == "System.Reflection.AssemblyVersionAttribute") {
+ data = customBuilder.Data;
+ pos = 2;
+ len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+ version = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+ return;
+ } else if (attrname == "System.Reflection.AssemblyKeyFileAttribute") {
+ data = customBuilder.Data;
+ pos = 2;
+ len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+ keyfile = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+ } else if (attrname == "System.Reflection.AssemblyCultureAttribute") {
+ data = customBuilder.Data;
+ pos = 2;
+ len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+ culture = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+ } else if (attrname == "System.Reflection.AssemblyAlgorithmIdAttribute") {
+ data = customBuilder.Data;
+ pos = 2;
+ algid = (uint)data [pos];
+ algid |= ((uint)data [pos + 1]) << 8;
+ algid |= ((uint)data [pos + 2]) << 16;
+ algid |= ((uint)data [pos + 3]) << 24;
+ } else if (attrname == "System.Reflection.AssemblyFlagsAttribute") {
+ data = customBuilder.Data;
+ pos = 2;
+ flags = (uint)data [pos];
+ flags |= ((uint)data [pos + 1]) << 8;
+ flags |= ((uint)data [pos + 2]) << 16;
+ flags |= ((uint)data [pos + 3]) << 24;
+ return;
+ } else if (attrname == "System.Reflection.AssemblyDelaySignAttribute") {
+ data = customBuilder.Data;
+ pos = 2;
+ delay_sign = data [2] != 0;
+ }
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public void SetCorlibTypeBuilders (Type corlib_object_type, Type corlib_value_type, Type corlib_enum_type) {
+ this.corlib_object_type = corlib_object_type;
+ this.corlib_value_type = corlib_value_type;
+ this.corlib_enum_type = corlib_enum_type;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
new file mode 100644
index 00000000000..2c6a97d9aca
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
@@ -0,0 +1,16 @@
+//--------------------------
+// System.Reflection.Emit
+// Author: Mandar Nanivadekar
+//
+// Created: 29/08/2001
+//------------------------------
+
+namespace System.Reflection.Emit
+{
+ public enum AssemblyBuilderAccess
+ {
+ Run = 1,
+ Save = 2,
+ RunAndSave = 3
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
new file mode 100644
index 00000000000..c8e0916bc0f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
@@ -0,0 +1,560 @@
+2003-01-17 Zoltan Varga <vargaz@freemail.hu>
+
+ * MethodBuilder.cs ConstructorBuilder.cs: modify GetParameters() so it
+ returns information even when the app did not use DefineParameter() to
+ define the parameters.
+
+ * ConstructorBuilder.cs (ctor): allways define SpecialName attribute
+ for constructors as done by MS.
+
+Mon Jan 13 11:37:14 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs, ModuleBuilder.cs: better type name cache.
+
+2003-01-10 Zoltan Varga <vargaz@freemail.hu>
+
+ * ILGenerator.cs: Implemented EmitWriteLine(string).
+
+ * TypeBuilder.cs (DefineInitializedData): Call DefineNestedType()
+ instead of DefineType() so the auxiliary types do not pollute the
+ global namespace. This is consistent with the behaviour of MS .NET.
+
+Fri Jan 10 16:03:30 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs, MethodBuilder.cs, TypeBuilder.cs,
+ ConstructorBuilder.cs: some tweaks to reduce memory usage.
+
+Thu Jan 2 18:46:09 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * ModuleBuilder.cs, TypeBuilder.cs: support global fields and methods.
+
+Thu Dec 19 00:06:57 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: remove duplicated user string entries.
+
+2002-12-11 Zoltan Varga <vargaz@freemail.hu>
+
+ * FieldBuilder.cs: added 'handle' field which is needed by some new
+ code in reflection.c.
+
+2002-12-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeBuilder.cs: implemented GetInterfaceMap () when the Type has been
+ created.
+
+Fri Nov 8 14:53:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: account for the exception object being passed to the
+ catch handler to calc max_stack.
+
+2002-09-21 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (ModuleBuilder.symbol_writer): Make this
+ field internal, not private.
+ (ModuleBuilder.SymWriter_DefineLocalVariable): Removed.
+
+ * LocalBuilder.cs (LocalBuilder.SetLocalSymInfo): Use the
+ ISymbolWriter's DefineLocalVariable() method instead of the
+ IMonoSymbolWriter hack.
+
+Mon Sep 16 19:02:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.c: special case some custom attributes.
+
+2002-09-12 Dick Porter <dick@ximian.com>
+
+ * TypeBuilder.cs: Say _which_ Type has already been created
+
+2002-09-11 Miguel de Icaza <miguel@ximian.com>
+
+ * ModuleBuilder.cs (GetTypes): Implement.
+
+Tue Sep 10 12:12:51 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorBuilder.cs: added a field to hold the handle.
+
+Mon Sep 9 17:31:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: prepare for the real CreateType implementation.
+
+Tue Aug 27 16:57:18 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: remove duplicate code and fix
+ named field reading in custom attr.
+
+2002-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TypeBuilder.cs: UnspecifiedTypeSize is 0.
+
+Wed Aug 14 17:38:41 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: ReflectedType and CreateType fixes.
+
+Thu Aug 8 10:25:51 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: added API to embed managed resources.
+
+2002-08-03 Martin Baulig <martin@gnome.org>
+
+ * TypeBuilder.cs (TypeBuilder.DeclaringType): Implemented.
+
+Thu Jul 25 13:57:46 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: support linking external resources.
+
+2002-07-19 Martin Baulig <martin@gnome.org>
+
+ * ILGenerator.cs (Emit (OpCode, LocalBuilder)): Throw an exception
+ when trying to emit a local that was defined in a different ILGenerator.
+
+ * LocalBuilder.cs (LocalBuilder): Added `ILGenetator' argument to
+ the constructor.
+
+Tue Jul 16 19:32:08 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: stack size check fix.
+
+Sat Jul 13 17:30:51 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: add also the enum_type for compiling corlib.
+ * TypeBuilder.cs: complete IsValueType.
+
+Sat Jul 13 15:08:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: better IsValueType.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CustomAttributeBuilder.cs: removed compile warning.
+
+Fri Jul 12 11:34:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: fixup typebuilder tokens as well.
+
+Tue Jul 9 19:03:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: special case SerializarionAttribute.
+ Tweaks to get correct code in corlib.
+
+2002-07-06 Miguel de Icaza <miguel@ximian.com>
+
+ * ILGenerator.cs (ILGenerator.Emit): For doubles and floats, swap
+ the bytes on big endian systems.
+
+2002-07-03 Martin Baulig <martin@gnome.org>
+
+ * AssemblyBuilder.cs (corlib_object_type, corlib_value_type): Moved
+ these fields up after the last entry in MonoReflectionAssemblyBuilder
+ in reflection.h.
+
+ * TypeBuilder.cs (IsValueTypeImpl): Use the AssemblyBuilder's
+ `corlib_value_type' instead of `typeof (System.ValueType)'.
+ (DefineNestedType): Use the AssemblyBuilder's `corlib_object_type'
+ instead of `typeof (object)'.
+
+2002-07-02 Martin Baulig <martin@gnome.org>
+
+ * AssemblyBuilder.cs (corlib_object_type, corlib_value_type): New
+ internal fields. When compiling corlib, they point to the newly
+ created System.Object and System.ValueType types.
+ (SetCorlibTypeBuilders): New public function. This will be
+ dynamically called from MCS when compiling corlib.
+
+ * TypeBuilder.cs (DefineInitializedData): Use the AssemblyBuilder's
+ `corlib_value_type' as parent type instead of `typeof (System.ValueType)'
+ to make it work when compiling corlib.
+
+ * ModuleBuilder.cs (assemblyb): Made this field internal, not private.
+
+Tue Jul 2 18:34:49 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: implemented AssemblyQualifiedName.
+ * MethodBuilder.cs, ConstructorBuilder.cs: special case custom attr.
+
+Mon Jul 1 16:17:29 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: implemented AddInterfaceImplementation().
+
+2002-06-28 Martin Baulig <martin@gnome.org>
+
+ * MethodBuilder.cs (GetParameters): Return all parameters, not all
+ but the last one.
+
+2002-06-27 Martin Baulig <martin@gnome.org>
+
+ * ConstructorBuilder.cs (GetParameters): Implemented.
+
+Mon Jun 17 14:55:43 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ModuleBuilder.cs, TypeBuilder.cs: fixes for nested types handling.
+
+Fri Jun 14 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * CustomAttributeBuilder.cs: added custom attribute related internal
+ helper methods.
+ * FieldBuilder.cs, ParameterBuilder.cs: handle MarshalAs attribute.
+ * UnmanagedMarshal.cs: implemented.
+
+Mon Jun 10 18:58:18 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * PropertyBuilder.cs: implemented ReflectedType and DeclaringType
+ properties.
+
+2002-06-07 Martin Baulig <martin@gnome.org>
+
+ * TypeBuilder.cs (TypeBuilder): Added `PackingSize packing_size' and
+ `int type_size' fields to the constructor.
+ (DefineNestedType): Pass packing_size and type_size to the constructor.
+
+ * ModuleBuilder.cs (DefineType): Pass the packing_size and type_size
+ fields to the TypeBuilder's constructor.
+
+2002-06-07 Martin Baulig <martin@gnome.org>
+
+ * TypeBuilder.cs (DefineNestedType): There is no overload for this
+ method which takes 5 args in the specs, removed it.
+
+Fri Jun 7 17:04:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: updates for PE/COFF rewrite.
+
+2002-05-30 Martin Baulig <martin@gnome.org>
+
+ * AssemblyBuilder.cs (methods): Made this internal and don't
+ initialize it. It will be initialized by the ModuleBuilder's
+ GetSymbolWriter() method.
+ (get_next_table_index): Only store the method in the `methods'
+ array if it's not null.
+
+ * ModuleBuilder.cs (GetSymbolWriter): Initialize the AssemblyBuilder's
+ `methods' field if necessary and pass it as third argument to the
+ symbol writer's constructor.
+
+2002-05-25 Martin Baulig <martin@gnome.org>
+
+ * TypeBuilder.cs (TypeToken): Implemented.
+
+2002-05-24 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (symwriter_define_local): New private variable.
+ (GetSymbolWriter): Look for a custom version of "DefineLocalVariable"
+ and store it in `symwriter_define_local'.
+ (SymWriter_DefineLocalVariable): New internal method to call the
+ symbol writer's custom DefineLocalVariable() method. It is safe to
+ call this method if there's no symbol writer.
+
+ * LocalBuilder.cs (SetLocalSymInfo): Use the MethodBuilder'snew
+ SymWriter_DefineLocalVariable().
+
+ * MethodBuilder.cs (GetParameters): Implemented.
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (GetSymbolWriter): Pass the this pointer to the
+ symbol writer's constructor.
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * AssemblyBuilder.cs (methods): New field.
+ (get_next_table_index): Record all methods and constructors
+ (table 0x06) in the `methods' array. This is read by the
+ Mono.CSharp.Debugger.MonoSymbolWriter::get_method interncall to
+ get the MethodBuilder / ConstructorBuilder back from the token.
+
+ * *Builder.cs (get_next_table_index): Added `object obj' argument.
+ (<constructors>): pass the this pointer to get_next_table_index ().
+
+2002-05-20 Martin Baulig <martin@gnome.org>
+
+ * TypeBuilder.cs (DefineField): Call the new `create_internal_class'
+ interncall after adding the first field. This is used when creating
+ enum types to set `klass->enum_basetype'.
+
+Thu May 16 16:09:51 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: complete special acse support for CharSet, Size and
+ Pack named args in StructLayout attribute.
+
+Tue May 14 17:13:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBuilder.cs: revert change in accessibility of
+ GetILGenerator(int).
+
+Tue May 14 13:31:17 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * FieldBuilder.cs, ParameterBuilder.cs: more special-casing of
+ attributes.
+
+Fri May 10 20:57:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * CustomAttributeBuilder.cs: expose internal data for use in
+ reflection.
+ * FieldBuilder.cs, TypeBuilder.cs: special case FieldOffset and
+ StructLayout attributes.
+
+Fri May 10 16:30:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBuilder.cs, ConstructorBuilder.cs: implemented InitLocals
+ property.
+
+2002-04-26 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (DefineDocument): Implemented.
+
+Tue Apr 16 13:02:28 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: pad output file to file alignment.
+ * FieldBuilder.cs: ReflectedType.
+ * ModuleBuilder.cs: added guid generation and array method creation.
+ * MonoArrayMethod.cs: array method support code.
+
+Wed Apr 10 12:57:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: use a stack to keep track of exception blocks.
+
+Mon Apr 8 06:19:01 2002 Piers Haken <piersh@friskit.com>
+
+ * ILGenerator.cs: added LabelField.label_base to allow for
+ arbitrary offsets (for switch statement)
+
+Fri Apr 5 15:41:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: simpler protocol wih the runtime to
+ get the assembly data.
+
+Tue Mar 26 20:10:24 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: use FileMode.Create.
+ * ILGenerator.cs: optimize localbuilder related opcodes.
+ Track parameters to adjust maxstack.
+ * LocalBuilder.cS: use unsigned for position.
+
+2002-03-23 Miguel de Icaza <miguel@ximian.com>
+
+ * LocalBuilder.cs: Drop the symbol_writer as LocalBuilder fields.
+ Do this lazily in SetLocalSymInfo.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (GetSymbolWriter): The MonoSymbolWriter's constructor
+ now takes a `string assembly_filename' argument, pass it our fully
+ qualified assembly name.
+
+2002-03-24 Nick Drochak <ndrochak@gol.com>
+
+ * ILGenerator.cs: Use #if-#endif instead of if(false){} to disable
+ code. This way there is no compiler warning.
+
+ * TypeBuilder.cs: Removed the returns that came after the throws.
+ This removes a few more compiler warnings. Also marked with MonoTODO
+ all places where we throw NotImplemented exceptions.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * SignatureHelper.cs (GetFieldSignatureHelper, GetLocalSignatureHelper):
+ Implemented.
+
+ * LocalBuilder.cs (LocalBuilder): This internal constructor now takes
+ a ModuleBuilder argument instead of a ISymbolWriter one.
+ (SetLocalSymInfo): Create and pass type signature to DefineLocalVariable.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * ILGenerator.cs (BeginScope, EndScope): Implemented.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (GetSymbolWriter): New internal function. Dynamically
+ loads the default symbol writer, catch all possible exceptions and return
+ null on failure.
+ (ModuleBuilder): Added `bool emitSymbolInfo' argument to this internal
+ constructor; if set, call GetSymbolWriter ().
+ (GetSymWriter): Implemented.
+
+ * LocalBuilder.cs (LocalBuilder): Added ISymbolWriter argument to this
+ internal method.
+ (SetLocalSymInfo): Implemented, call ISymbolWriter.DefineLocalVariable ()
+ if the symbol writer is not null.
+
+ * ILGenerator.cs (ILGenerator): Call ModuleBuilder.GetSymWriter () to get
+ and store the symbol writer.
+ (DeclareLocal): Pass the symbol writer to LocalBuilder's constructor.
+ (MarkSequencePoint): Implemented, call ISymbolWriter.DefineSequencePoints ()
+ if the symbol writer is not null.
+
+ * AssemblyBuilder.cs (DefineDynamicModule): Pass the `bool emitSymbolInfo'
+ to ModuleBuilder's constructor.
+
+Sat Mar 16 19:11:47 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ModuleBuilder.cs: handle modified types correctly.
+
+Thu Mar 7 17:10:42 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: allow saving bigger assemblies.
+ * ILGenerator.cs: add fixup table for fields and methods, since
+ at the end of the compile they may end up with a different table
+ index.
+ * ModuleBuilder.cs: add cache for type names to speed up the type
+ lookups from the compiler.
+ * TypeBuilder.cs: GetInterfaces () returns only interfaces in the
+ current type, not in parents (the docs are wrong).
+
+Tue Mar 5 18:09:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EventBuilder.cs: implemented.
+ * TypeBuilder.cs: implemented DefineEvent() method and UnderlyingSystemType
+ property.
+
+Mon Mar 4 20:34:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: make enough room in the byte array for string
+ tokens.
+ * TypeBuilder.cs: fixed GetInterfaces().
+
+Mon Mar 4 11:30:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: implemented GetConstructors(), GetFields(),
+ GetMethods(), GetProperties().
+
+Thu Feb 28 19:15:10 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: call into the runtime to init some basic
+ assembly stuff. Reserve slot 1 of typedef table for .<Module>.
+ * ModuleBuilder.cs: call into the runtime if we need to create a
+ modief type, such as arrays, byref etc.
+ * TypeBuilder.cs: call into the runtime to create the MonoClass
+ representation for the type. Throw exceptions with not implemented
+ stuff.
+
+Wed Feb 27 18:48:47 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: fix nested exception blocks.
+
+Wed Feb 20 22:30:49 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: upped compiled assembly size limit.
+ Implemented SetCustomAttribute () methods.
+ * CustomAttributeBuilder.cs: implemented the needed constructor
+ stuff.
+ * Cosntructorbuilder.cs, EnumBuilder.cs, FieldBuilder.cs,
+ MethodBuilder.cs, ModuleBuilder.cs, ParameterBuilder.cs,
+ PropertyBuilder.cs, TypeBuilder.cs: Implemented SetCustomAttribute () methods.
+
+Wed Feb 20 14:54:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: add SetCustomAttribute () to keep the compiler
+ going.
+
+Fri Feb 15 18:15:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: finally block support and fixes.
+
+Thu Feb 14 18:55:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * FieldBuilder.cs: Add SetRVAData().
+ * ILGenerator.cs: speed up code array growth.
+ * TypeBuilder.cs: fix IsValueTypeImpl(). Add class_size member.
+ Implement DefineInitializedData().
+
+Tue Jan 22 23:01:11 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EnumBuilder.cs, TypeBuilder.cs: updates for changes in Type.cs.
+ * ModuleBuilder.cs: fix lookup of nested types.
+
+Tue Jan 15 22:46:21 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: implement some of the exception support methods.
+
+Mon Jan 14 17:07:32 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ModulerBuilder.cs: search also for subtypes in GetTypes().
+ * TypeBuilder.cs: bugfix in FullName. Implemented DefineNestedType().
+
+Fri Jan 11 19:00:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBuilder.cs, ConstructorBuilder.cs: save parameter info.
+
+Thu Jan 10 21:07:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: handle type tokens (used for box opcode).
+
+Wed Jan 9 19:37:55 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: emit float and doubles.
+ * ModuleBuilder.cs: off-by-one error fix and GetType()
+ implementations.
+ * TypeBuilder.cs: AttributesImpl added.
+ * UnmanagedMarshal.cs: stubbed out class.
+
+Sat Jan 5 15:59:05 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: fix emission of two-bytes opcodes.
+ Missing slot for locals array. Throw exceptions on unimplemented
+ methods.
+ * OpCode.cs: add a comment: the Value property is useless.
+ * OpCodes.cs: fix name of tail opcode (Tail -> Tailcall).
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ConstructorBuilder.cs : Use the MonoTODO attribute.
+
+ * ILGenerator.cs, Label.cs, MethodBuilder.cs, ModuleBuilder.cs,
+ ParameterBuilder.cs, TypeBuilder.cs : Ditto.
+
+Thu Jan 3 23:26:15 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: typo fix.
+
+Mon Dec 24 17:21:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: added DefineMethodOverride().
+ * MethodBuilder.cs: add override_method member and setter.
+
+Mon Nov 19 13:58:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: add method to register a string in the "#US"
+ stream.
+ * EnumBuilder.cs, SignatureHelper.cs: added stubs.
+ * ILGenerator.cs: more stuff implemented.
+ * LocalBuilder.cs: keep track of local var index.
+
+Thu Nov 15 18:11:23 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorBuilder.cs: implement the interesting methods.
+ * ILGenerator.cs: adapt for use with both a MethodBuilder and a
+ ConstructorBuilder.
+ * MethodBuilder.cs: add ImplAttributes.
+ * ParameterBuilder.cs: adapt for ConstructorBuilder.
+ * TypeBuilder.cs: add constructors handling.
+
+Wed Nov 14 17:01:45 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorBuilder.cs: added missing stubs and some implementation.
+ * CustomAttributeBuilder.cs: added.
+ * EventBuilder.cs: added.
+ * FieldBuilder.cs: updates.
+ * MethodBuilder.cs: stuff to implement P/Invoke methods.
+ * ModuleBuilder.cs: added GetArrayMethod() stub.
+ * ParameterBuilder.cs, PropertyBuilder.cs: updates.
+ * TypeBuilder.cs: updates and stubs.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * TypeBuilder.cs: Added implementation for TypeHandle.
+
+Tue Nov 6 09:13:45 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: define an internal constructor.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * AssemblyBuilder.cs: Reformatted.
+
+ Added override keywords to those that needed them.
+
+ Removed methods that we do not override, but just inherit
+
+Tue Sep 25 16:53:08 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs, ConstructorBuilder.cs, ModuleBuilder.cs: added.
diff --git a/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
new file mode 100644
index 00000000000..a577f0d3036
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
@@ -0,0 +1,161 @@
+//
+// System.Reflection.Emit/ConstructorBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Reflection.Emit {
+ public sealed class ConstructorBuilder : ConstructorInfo {
+ private RuntimeMethodHandle mhandle;
+ private ILGenerator ilgen;
+ private Type[] parameters;
+ private MethodAttributes attrs;
+ private MethodImplAttributes iattrs;
+ private int table_idx;
+ private CallingConventions call_conv;
+ private TypeBuilder type;
+ private ParameterBuilder[] pinfo;
+ private CustomAttributeBuilder[] cattrs;
+ private bool init_locals = true;
+
+ internal ConstructorBuilder (TypeBuilder tb, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes) {
+ attrs = attributes | MethodAttributes.SpecialName;
+ call_conv = callingConvention;
+ if (parameterTypes != null) {
+ this.parameters = new Type [parameterTypes.Length];
+ System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
+ }
+ type = tb;
+ table_idx = get_next_table_index (this, 0x06, true);
+ }
+
+ public bool InitLocals {
+ get {return init_locals;}
+ set {init_locals = value;}
+ }
+
+ internal TypeBuilder TypeBuilder {
+ get {return type;}
+ }
+
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ return iattrs;
+ }
+ public override ParameterInfo[] GetParameters() {
+ if (parameters == null)
+ return null;
+
+ ParameterInfo[] retval = new ParameterInfo [parameters.Length];
+ for (int i = 0; i < parameters.Length; i++) {
+ retval [i] = new ParameterInfo (pinfo == null ? null : pinfo [i+1], parameters [i], this, i + 1);
+ }
+
+ return retval;
+ }
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ return null;
+ }
+ public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) {
+ return null;
+ }
+
+ public override RuntimeMethodHandle MethodHandle { get {return new RuntimeMethodHandle ();} }
+ public override MethodAttributes Attributes {
+ get {return attrs;}
+ }
+ public override Type ReflectedType { get {return type;}}
+ public override Type DeclaringType { get {return type;}}
+ public Type ReturnType { get {return null;}}
+ public override string Name {
+ get {return (attrs & MethodAttributes.Static) != 0 ? ".cctor" : ".ctor";}
+ }
+ public string Signature {
+ get {return "constructor signature";}
+ }
+
+ public void AddDeclarativeSecurity( SecurityAction action, PermissionSet pset) {
+ }
+
+ [MonoTODO]
+ public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, string strParamName)
+ {
+ ParameterBuilder pb = new ParameterBuilder (this, iSequence, attributes, strParamName);
+ // check iSequence
+ if (pinfo == null)
+ pinfo = new ParameterBuilder [parameters.Length + 1];
+ pinfo [iSequence] = pb;
+ return pb;
+ }
+
+ public override bool IsDefined (Type attribute_type, bool inherit) {return false;}
+
+ public override object [] GetCustomAttributes (bool inherit) {return null;}
+
+ public override object [] GetCustomAttributes (Type attribute_type, bool inherit) {return null;}
+
+ public ILGenerator GetILGenerator () {
+ return GetILGenerator (64);
+ }
+ internal ILGenerator GetILGenerator (int size) {
+ ilgen = new ILGenerator (this, size);
+ return ilgen;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ if (attrname == "System.Runtime.CompilerServices.MethodImplAttribute") {
+ byte[] data = customBuilder.Data;
+ int impla; // the (stupid) ctor takes a short or an int ...
+ impla = (int)data [2];
+ impla |= ((int)data [3]) << 8;
+ SetImplementationFlags ((MethodImplAttributes)impla);
+ return;
+ }
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetImplementationFlags( MethodImplAttributes attributes) {
+ iattrs = attributes;
+ }
+ public Module GetModule() {
+ return null;
+ }
+ public MethodToken GetToken() {
+ return new MethodToken (0x06000000 | table_idx);
+ }
+ public void SetSymCustomAttribute( string name, byte[] data) {
+ }
+ public override string ToString() {
+ return "constructor";
+ }
+
+ internal void fixup () {
+ if (ilgen != null)
+ ilgen.label_fixup ();
+ }
+ internal override int get_next_table_index (object obj, int table, bool inc) {
+ return type.get_next_table_index (obj, table, inc);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
new file mode 100755
index 00000000000..c77bec598fe
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
@@ -0,0 +1,123 @@
+
+//
+// System.Reflection.Emit/CustomAttributeBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public class CustomAttributeBuilder {
+ ConstructorInfo ctor;
+ byte[] data;
+
+ internal ConstructorInfo Ctor {
+ get {return ctor;}
+ }
+
+ internal byte[] Data {
+ get {return data;}
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern byte[] GetBlob(ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues);
+
+ internal CustomAttributeBuilder( ConstructorInfo con, byte[] cdata) {
+ ctor = con;
+ data = (byte[])cdata.Clone ();
+ /* should we check that the user supplied data is correct? */
+ }
+
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs)
+ : this (con, constructorArgs, null, null, null, null) {
+ }
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, FieldInfo[] namedFields, object[] fieldValues)
+ : this (con, constructorArgs, null, null, namedFields, fieldValues) {
+ }
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues)
+ : this (con, constructorArgs, namedProperties, propertyValues, null, null) {
+ }
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues) {
+ ctor = con;
+ data = GetBlob (con, constructorArgs, namedProperties, propertyValues, namedFields, fieldValues);
+ }
+
+ /* helper methods */
+ internal static int decode_len (byte[] data, int pos, out int rpos) {
+ int len = 0;
+ if ((data [pos] & 0x80) == 0) {
+ len = (int)(data [pos++] & 0x7f);
+ } else if ((data [pos] & 0x40) == 0) {
+ len = ((data [pos] & 0x3f) << 8) + data [pos + 1];
+ pos += 2;
+ } else {
+ len = ((data [pos] & 0x1f) << 24) + (data [pos + 1] << 16) + (data [pos + 2] << 8) + data [pos + 3];
+ pos += 4;
+ }
+ rpos = pos;
+ return len;
+ }
+
+ internal static string string_from_bytes (byte[] data, int pos, int len) {
+ char[] chars = new char [len];
+ // FIXME: use a utf8 decoder here
+ for (int i = 0; i < len; ++i)
+ chars [i] = (char)data [pos + i];
+ return new String (chars);
+ }
+
+ internal static UnmanagedMarshal get_umarshal (CustomAttributeBuilder customBuilder, bool is_field) {
+ byte[] data = customBuilder.Data;
+ UnmanagedType subtype = UnmanagedType.I4;
+ int value;
+ int utype; /* the (stupid) ctor takes a short or an enum ... */
+ utype = (int)data [2];
+ utype |= ((int)data [3]) << 8;
+
+ string first_type_name = customBuilder.Ctor.GetParameters()[0].ParameterType.FullName;
+ int pos = 6;
+ if (first_type_name == "System.Int16")
+ pos = 4;
+ int nnamed = (int)data [pos++];
+ nnamed |= ((int)data [pos++]) << 8;
+
+ for (int i = 0; i < nnamed; ++i) {
+ byte type = data [pos++];
+ int len = decode_len (data, pos, out pos);
+ string named_name = string_from_bytes (data, pos, len);
+ pos += len;
+ switch (named_name) {
+ case "ArraySubType":
+ value = (int)data [pos++];
+ value |= ((int)data [pos++]) << 8;
+ value |= ((int)data [pos++]) << 16;
+ value |= ((int)data [pos++]) << 24;
+ subtype = (UnmanagedType)value;
+ break;
+ default:
+ break;
+ }
+ }
+
+ switch ((UnmanagedType)utype) {
+ case UnmanagedType.LPArray:
+ return UnmanagedMarshal.DefineLPArray (subtype);
+ case UnmanagedType.SafeArray:
+ return UnmanagedMarshal.DefineSafeArray (subtype);
+ case UnmanagedType.ByValArray:
+ case UnmanagedType.ByValTStr:
+ default:
+ return UnmanagedMarshal.DefineUnmanagedMarshal ((UnmanagedType)utype);
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
new file mode 100755
index 00000000000..d82d116ad84
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
@@ -0,0 +1,188 @@
+
+//
+// System.Reflection.Emit/EnumBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public sealed class EnumBuilder : Type {
+ CustomAttributeBuilder[] cattrs;
+
+ public override Assembly Assembly {
+ get {return null;}
+ }
+ public override string AssemblyQualifiedName {
+ get {return null;}
+ }
+ public override Type BaseType {
+ get {return null;}
+ }
+ public override Type DeclaringType {
+ get {return null;}
+ }
+ public override string FullName {
+ get {return null;}
+ }
+ public override Guid GUID {
+ get {return Guid.Empty;}
+ }
+ public override Module Module {
+ get {return null;}
+ }
+ public override string Name {
+ get {return null;}
+ }
+ public override string Namespace {
+ get {return null;}
+ }
+ public override Type ReflectedType {
+ get {return null;}
+ }
+ public override RuntimeTypeHandle TypeHandle {
+ get {return new RuntimeTypeHandle ();}
+ }
+ public TypeToken TypeToken {
+ get {return new TypeToken ();}
+ }
+ public FieldBuilder UnderlyingField {
+ get {return null;}
+ }
+ public override Type UnderlyingSystemType {
+ get {return null;}
+ }
+/* no need to override
+ public override MemberTypes MemberType {
+ get {return MemberTypes.TypeInfo;}
+ }
+*/
+
+ internal EnumBuilder (ModuleBuilder mb, string name, TypeAttributes visibility, Type underlyingType) {
+ }
+ public Type CreateType() {
+ return null;
+ }
+ public FieldBuilder DefineLiteral( string literalName, object literalValue) {
+ return null;
+ }
+ protected override TypeAttributes GetAttributeFlagsImpl() {
+ return (TypeAttributes)0;
+ }
+ protected override ConstructorInfo GetConstructorImpl( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+ public override Type GetElementType() {
+ throw new NotSupportedException ();
+ }
+ public override EventInfo GetEvent( string name, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override EventInfo[] GetEvents() {
+ return null;
+ }
+ public override EventInfo[] GetEvents( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override FieldInfo[] GetFields( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override Type GetInterface( string name, bool ignoreCase) {
+ return null;
+ }
+ public override InterfaceMapping GetInterfaceMap( Type interfaceType) {
+ throw new NotImplementedException ();
+ }
+ public override Type[] GetInterfaces() {
+ return null;
+ }
+ public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ return null;
+ }
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ return null;
+ }
+
+ public override MethodInfo[] GetMethods( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override Type[] GetNestedTypes( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+ return null;
+ }
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ protected override bool HasElementTypeImpl() {
+ throw new NotSupportedException ();
+ }
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ return null;
+ }
+ protected override bool IsArrayImpl() {
+ return false;
+ }
+ protected override bool IsByRefImpl() {
+ return false;
+ }
+ protected override bool IsCOMObjectImpl() {
+ return false;
+ }
+ protected override bool IsPointerImpl() {
+ return false;
+ }
+ protected override bool IsPrimitiveImpl() {
+ return false;
+ }
+ protected override bool IsValueTypeImpl() {
+ return true;
+ }
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
new file mode 100755
index 00000000000..507620a4764
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
@@ -0,0 +1,85 @@
+
+//
+// System.Reflection.Emit/EventBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public sealed class EventBuilder {
+ string name;
+ Type type;
+ TypeBuilder typeb;
+ CustomAttributeBuilder[] cattrs;
+ MethodBuilder add_method;
+ MethodBuilder remove_method;
+ MethodBuilder raise_method;
+ MethodBuilder[] other_methods;
+ EventAttributes attrs;
+ int table_idx;
+
+ internal EventBuilder (TypeBuilder tb, string eventName, EventAttributes eventAttrs, Type eventType) {
+ name = eventName;
+ attrs = eventAttrs;
+ type = eventType;
+ typeb = tb;
+ table_idx = get_next_table_index (this, 0x14, true);
+ }
+
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ return typeb.get_next_table_index (obj, table, inc);
+ }
+
+ public void AddOtherMethod( MethodBuilder mdBuilder) {
+ if (other_methods != null) {
+ MethodBuilder[] newv = new MethodBuilder [other_methods.Length + 1];
+ other_methods.CopyTo (newv, 0);
+ other_methods = newv;
+ } else {
+ other_methods = new MethodBuilder [1];
+ }
+ other_methods [other_methods.Length - 1] = mdBuilder;
+ }
+
+ public EventToken GetEventToken () {
+ return new EventToken (0x14000000 | table_idx);
+ }
+ public void SetAddOnMethod( MethodBuilder mdBuilder) {
+ add_method = mdBuilder;
+ }
+ public void SetRaiseMethod( MethodBuilder mdBuilder) {
+ raise_method = mdBuilder;
+ }
+ public void SetRemoveOnMethod( MethodBuilder mdBuilder) {
+ remove_method = mdBuilder;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/EventToken.cs b/mcs/class/corlib/System.Reflection.Emit/EventToken.cs
new file mode 100644
index 00000000000..4cc97be7ea1
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/EventToken.cs
@@ -0,0 +1,70 @@
+// EventToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Event.
+ /// </summary>
+ [Serializable]
+ public struct EventToken {
+
+ internal int tokValue;
+
+ public static readonly EventToken Empty;
+
+
+ static EventToken ()
+ {
+ Empty = new EventToken ();
+ }
+
+
+ internal EventToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is EventToken;
+
+ if (res) {
+ EventToken that = (EventToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// EventToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Event.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
new file mode 100755
index 00000000000..5f876b1743e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
@@ -0,0 +1,129 @@
+
+//
+// System.Reflection.Emit/FieldBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001-2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public sealed class FieldBuilder : FieldInfo {
+ private FieldAttributes attrs;
+ private Type type;
+ private String name;
+ private object def_value;
+ private int offset;
+ private int table_idx;
+ internal TypeBuilder typeb;
+ private byte[] rva_data;
+ private CustomAttributeBuilder[] cattrs;
+ private UnmanagedMarshal marshal_info;
+ private RuntimeFieldHandle handle;
+
+ internal FieldBuilder (TypeBuilder tb, string fieldName, Type type, FieldAttributes attributes) {
+ attrs = attributes;
+ name = fieldName;
+ this.type = type;
+ offset = -1;
+ typeb = tb;
+ table_idx = tb.get_next_table_index (this, 0x04, true);
+ }
+
+ public override FieldAttributes Attributes {
+ get {return attrs;}
+ }
+ public override Type DeclaringType {
+ get {return typeb;}
+ }
+ public override RuntimeFieldHandle FieldHandle {
+ get {return new RuntimeFieldHandle();}
+ }
+ public override Type FieldType {
+ get {return type;}
+ }
+ public override string Name {
+ get {return name;}
+ }
+ public override Type ReflectedType {
+ get {return typeb;}
+ }
+
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+ public FieldToken GetToken() {
+ return new FieldToken (0x04000000 | table_idx);
+ }
+ public override object GetValue(object obj) {
+ return null;
+ }
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ internal void SetRVAData (byte[] data) {
+ rva_data = (byte[])data.Clone ();
+ }
+ public void SetConstant( object defaultValue) {
+ /*if (defaultValue.GetType() != type)
+ throw new ArgumentException ("Constant doesn't match field type");*/
+ def_value = defaultValue;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ if (attrname == "System.Runtime.InteropServices.FieldOffsetAttribute") {
+ byte[] data = customBuilder.Data;
+ offset = (int)data [2];
+ offset |= ((int)data [3]) << 8;
+ offset |= ((int)data [4]) << 16;
+ offset |= ((int)data [5]) << 24;
+ return;
+ } else if (attrname == "System.NonSerializedAttribute") {
+ attrs |= FieldAttributes.NotSerialized;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.MarshalAsAttribute") {
+ marshal_info = CustomAttributeBuilder.get_umarshal (customBuilder, true);
+ /* FIXME: check for errors */
+ return;
+ }
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public void SetMarshal( UnmanagedMarshal unmanagedMarshal) {
+ marshal_info = unmanagedMarshal;
+ attrs |= FieldAttributes.HasFieldMarshal;
+ }
+
+ public void SetOffset( int iOffset) {
+ offset = iOffset;
+ }
+ public override void SetValue( object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture) {
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/FieldToken.cs b/mcs/class/corlib/System.Reflection.Emit/FieldToken.cs
new file mode 100644
index 00000000000..b3f5a5dade1
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/FieldToken.cs
@@ -0,0 +1,70 @@
+// FieldToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Field.
+ /// </summary>
+ [Serializable]
+ public struct FieldToken {
+
+ internal int tokValue;
+
+ public static readonly FieldToken Empty;
+
+
+ static FieldToken ()
+ {
+ Empty = new FieldToken ();
+ }
+
+
+ internal FieldToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is FieldToken;
+
+ if (res) {
+ FieldToken that = (FieldToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// FieldToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Field.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/FlowControl.cs b/mcs/class/corlib/System.Reflection.Emit/FlowControl.cs
new file mode 100644
index 00000000000..b714362cb11
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/FlowControl.cs
@@ -0,0 +1,63 @@
+// FlowControl.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes how an instruction alters the flow of control.
+ /// </summary>
+ public enum FlowControl {
+
+ /// <summary>
+ /// Branch instruction (ex: br, leave).
+ /// </summary>
+ Branch = 0,
+
+ /// <summary>
+ /// Break instruction (ex: break).
+ /// </summary>
+ Break = 1,
+
+ /// <summary>
+ /// Call instruction (ex: jmp, call, callvirt).
+ /// </summary>
+ Call = 2,
+
+ /// <summary>
+ /// Conditional branch instruction (ex: brtrue, brfalse).
+ /// </summary>
+ Cond_Branch = 3,
+
+ /// <summary>
+ /// Changes the behaviour of or provides additional
+ /// about a subsequent instruction.
+ /// (ex: prefixes such as volatile, unaligned).
+ /// </summary>
+ Meta = 4,
+
+ /// <summary>
+ /// Transition to the next instruction.
+ /// </summary>
+ Next = 5,
+
+ /// <summary>
+ /// Annotation for ann.phi instruction.
+ /// </summary>
+ Phi = 6,
+
+ /// <summary>
+ /// Return instruction.
+ /// </summary>
+ Return = 7,
+
+ /// <summary>
+ /// Throw instruction.
+ /// </summary>
+ Throw = 8
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
new file mode 100644
index 00000000000..6276b3677e0
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
@@ -0,0 +1,645 @@
+
+//
+// System.Reflection.Emit/ILGenerator.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics.SymbolStore;
+
+namespace System.Reflection.Emit {
+
+ internal struct ILExceptionBlock {
+ public const int CATCH = 0;
+ public const int FILTER = 1;
+ public const int FINALLY = 2;
+ public const int FAULT = 4;
+
+ internal Type extype;
+ internal int type;
+ internal int start;
+ internal int len;
+ internal int filter_offset;
+
+ internal void Debug () {
+#if NO
+ System.Console.Write ("\ttype="+type.ToString()+" start="+start.ToString()+" len="+len.ToString());
+ if (extype != null)
+ System.Console.WriteLine (" extype="+extype.ToString());
+ else
+ System.Console.WriteLine ("");
+#endif
+ }
+ }
+ internal struct ILExceptionInfo {
+ ILExceptionBlock[] handlers;
+ internal int start;
+ int len;
+ internal Label end;
+
+ internal int NumHandlers () {
+ return handlers.Length;
+ }
+
+ internal void AddCatch (Type extype, int offset) {
+ int i;
+ End (offset);
+ add_block (offset);
+ i = handlers.Length - 1;
+ handlers [i].type = ILExceptionBlock.CATCH;
+ handlers [i].start = offset;
+ handlers [i].extype = extype;
+ }
+
+ internal void AddFinally (int offset) {
+ int i;
+ End (offset);
+ add_block (offset);
+ i = handlers.Length - 1;
+ handlers [i].type = ILExceptionBlock.FINALLY;
+ handlers [i].start = offset;
+ handlers [i].extype = null;
+ }
+
+ internal void End (int offset) {
+ if (handlers == null)
+ return;
+ int i = handlers.Length - 1;
+ if (i >= 0)
+ handlers [i].len = offset - handlers [i].start;
+ }
+
+ internal int LastClauseType () {
+ if (handlers != null)
+ return handlers [handlers.Length-1].type;
+ else
+ return ILExceptionBlock.CATCH;
+ }
+
+ internal void Debug (int b) {
+#if NO
+ System.Console.WriteLine ("Handler {0} at {1}, len: {2}", b, start, len);
+ for (int i = 0; i < handlers.Length; ++i)
+ handlers [i].Debug ();
+#endif
+ }
+
+ void add_block (int offset) {
+ if (handlers != null) {
+ int i = handlers.Length;
+ ILExceptionBlock[] new_b = new ILExceptionBlock [i + 1];
+ System.Array.Copy (handlers, new_b, i);
+ handlers = new_b;
+ handlers [i].len = offset - handlers [i].start;
+ } else {
+ handlers = new ILExceptionBlock [1];
+ len = offset - start;
+ }
+ }
+ }
+
+ internal struct ILTokenInfo {
+ public MemberInfo member;
+ public int code_pos;
+ }
+
+ public class ILGenerator: Object {
+ private struct LabelFixup {
+ public int size;
+ public int pos; // the location of the fixup
+ public int label_base; // the base address for this fixup
+ public int label_idx;
+ };
+ static Type void_type = typeof (void);
+ private byte[] code;
+ private MethodBase mbuilder; /* a MethodBuilder or ConstructorBuilder */
+ private int code_len;
+ private int max_stack;
+ private int cur_stack;
+ private LocalBuilder[] locals;
+ private ILExceptionInfo[] ex_handlers;
+ private int num_token_fixups;
+ private ILTokenInfo[] token_fixups;
+ private int[] label_to_addr;
+ private int num_labels;
+ private LabelFixup[] fixups;
+ private int num_fixups;
+ private ModuleBuilder module;
+ private AssemblyBuilder abuilder;
+ private ISymbolWriter sym_writer;
+ private Stack scopes;
+ private int cur_block;
+ private Stack open_blocks;
+
+ internal ILGenerator (MethodBase mb, int size) {
+ if (size < 0)
+ size = 128;
+ code_len = 0;
+ code = new byte [size];
+ mbuilder = mb;
+ cur_stack = max_stack = 0;
+ num_fixups = num_labels = 0;
+ label_to_addr = new int [8];
+ fixups = new LabelFixup [8];
+ token_fixups = new ILTokenInfo [8];
+ num_token_fixups = 0;
+ if (mb is MethodBuilder) {
+ module = (ModuleBuilder)((MethodBuilder)mb).TypeBuilder.Module;
+ } else if (mb is ConstructorBuilder) {
+ module = (ModuleBuilder)((ConstructorBuilder)mb).TypeBuilder.Module;
+ }
+ abuilder = (AssemblyBuilder)module.Assembly;
+ sym_writer = module.GetSymWriter ();
+ open_blocks = new Stack ();
+ }
+
+ private void add_token_fixup (MemberInfo mi) {
+ if (num_token_fixups == token_fixups.Length) {
+ ILTokenInfo[] ntf = new ILTokenInfo [num_token_fixups * 2];
+ token_fixups.CopyTo (ntf, 0);
+ token_fixups = ntf;
+ }
+ token_fixups [num_token_fixups].member = mi;
+ token_fixups [num_token_fixups++].code_pos = code_len;
+ }
+
+ private void make_room (int nbytes) {
+ if (code_len + nbytes < code.Length)
+ return;
+ byte[] new_code = new byte [(code_len + nbytes) * 2 + 128];
+ System.Array.Copy (code, 0, new_code, 0, code.Length);
+ code = new_code;
+ }
+ private void emit_int (int val) {
+ code [code_len++] = (byte) (val & 0xFF);
+ code [code_len++] = (byte) ((val >> 8) & 0xFF);
+ code [code_len++] = (byte) ((val >> 16) & 0xFF);
+ code [code_len++] = (byte) ((val >> 24) & 0xFF);
+ }
+ /* change to pass by ref to avoid copy */
+ private void ll_emit (OpCode opcode) {
+ /*
+ * there is already enough room allocated in code.
+ */
+ // access op1 and op2 directly since the Value property is useless
+ if (opcode.Size == 2)
+ code [code_len++] = opcode.op1;
+ code [code_len++] = opcode.op2;
+ /*
+ * We should probably keep track of stack needs here.
+ * Or we may want to run the verifier on the code before saving it
+ * (this may be needed anyway when the ILGenerator is not used...).
+ */
+ switch (opcode.StackBehaviourPush) {
+ case StackBehaviour.Push1:
+ case StackBehaviour.Pushi:
+ case StackBehaviour.Pushi8:
+ case StackBehaviour.Pushr4:
+ case StackBehaviour.Pushr8:
+ case StackBehaviour.Pushref:
+ case StackBehaviour.Varpush: /* again we are conservative and assume it pushes 1 */
+ cur_stack ++;
+ break;
+ case StackBehaviour.Push1_push1:
+ cur_stack += 2;
+ break;
+ }
+ if (max_stack < cur_stack)
+ max_stack = cur_stack;
+ /*
+ * Note that we adjust for the pop behaviour _after_ setting max_stack.
+ */
+ switch (opcode.StackBehaviourPop) {
+ case StackBehaviour.Varpop:
+ break; /* we are conservative and assume it doesn't decrease the stack needs */
+ case StackBehaviour.Pop1:
+ case StackBehaviour.Popi:
+ case StackBehaviour.Popref:
+ cur_stack --;
+ break;
+ case StackBehaviour.Pop1_pop1:
+ case StackBehaviour.Popi_pop1:
+ case StackBehaviour.Popi_popi:
+ case StackBehaviour.Popi_popi8:
+ case StackBehaviour.Popi_popr4:
+ case StackBehaviour.Popi_popr8:
+ case StackBehaviour.Popref_pop1:
+ case StackBehaviour.Popref_popi:
+ cur_stack -= 2;
+ break;
+ case StackBehaviour.Popi_popi_popi:
+ case StackBehaviour.Popref_popi_popi:
+ case StackBehaviour.Popref_popi_popi8:
+ case StackBehaviour.Popref_popi_popr4:
+ case StackBehaviour.Popref_popi_popr8:
+ case StackBehaviour.Popref_popi_popref:
+ cur_stack -= 3;
+ break;
+ }
+ }
+
+ private static int target_len (OpCode opcode) {
+ if (opcode.operandType == OperandType.InlineBrTarget)
+ return 4;
+ return 1;
+ }
+
+ private void InternalEndClause () {
+ switch (ex_handlers [cur_block].LastClauseType ()) {
+ case ILExceptionBlock.CATCH:
+ // how could we optimize code size here?
+ Emit (OpCodes.Leave, ex_handlers [cur_block].end);
+ break;
+ case ILExceptionBlock.FAULT:
+ case ILExceptionBlock.FINALLY:
+ Emit (OpCodes.Endfinally);
+ break;
+ case ILExceptionBlock.FILTER:
+ Emit (OpCodes.Endfilter);
+ break;
+ }
+ }
+
+ public virtual void BeginCatchBlock (Type exceptionType) {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ InternalEndClause ();
+ ex_handlers [cur_block].AddCatch (exceptionType, code_len);
+ cur_stack = 1; // the exception object is on the stack by default
+ if (max_stack < cur_stack)
+ max_stack = cur_stack;
+ //System.Console.WriteLine ("Begin catch Block: {0} {1}",exceptionType.ToString(), max_stack);
+ //throw new NotImplementedException ();
+ }
+ public virtual void BeginExceptFilterBlock () {
+ throw new NotImplementedException ();
+ }
+ public virtual Label BeginExceptionBlock () {
+ //System.Console.WriteLine ("Begin Block");
+
+ if (ex_handlers != null) {
+ cur_block = ex_handlers.Length;
+ ILExceptionInfo[] new_ex = new ILExceptionInfo [cur_block + 1];
+ System.Array.Copy (ex_handlers, new_ex, cur_block);
+ ex_handlers = new_ex;
+ } else {
+ ex_handlers = new ILExceptionInfo [1];
+ cur_block = 0;
+ }
+ open_blocks.Push (cur_block);
+ ex_handlers [cur_block].start = code_len;
+ return ex_handlers [cur_block].end = DefineLabel ();
+ }
+ public virtual void BeginFaultBlock() {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ //System.Console.WriteLine ("Begin fault Block");
+ //throw new NotImplementedException ();
+ }
+ public virtual void BeginFinallyBlock() {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ InternalEndClause ();
+ //System.Console.WriteLine ("Begin finally Block");
+ ex_handlers [cur_block].AddFinally (code_len);
+ }
+ public virtual void BeginScope () {
+ if (sym_writer != null) {
+ if (scopes == null)
+ scopes = new Stack ();
+ scopes.Push (sym_writer.OpenScope (code_len));
+ }
+ }
+ public LocalBuilder DeclareLocal (Type localType) {
+ LocalBuilder res = new LocalBuilder (module, localType, this);
+ if (locals != null) {
+ LocalBuilder[] new_l = new LocalBuilder [locals.Length + 1];
+ System.Array.Copy (locals, new_l, locals.Length);
+ new_l [locals.Length] = res;
+ locals = new_l;
+ } else {
+ locals = new LocalBuilder [1];
+ locals [0] = res;
+ }
+ res.position = (uint)(locals.Length - 1);
+ return res;
+ }
+ public virtual Label DefineLabel () {
+ if (num_labels >= label_to_addr.Length) {
+ int[] new_l = new int [label_to_addr.Length * 2];
+ System.Array.Copy (label_to_addr, new_l, label_to_addr.Length);
+ label_to_addr = new_l;
+ }
+ label_to_addr [num_labels] = -1;
+ return new Label (num_labels++);
+ }
+ public virtual void Emit (OpCode opcode) {
+ make_room (2);
+ ll_emit (opcode);
+ }
+ public virtual void Emit (OpCode opcode, Byte val) {
+ make_room (3);
+ ll_emit (opcode);
+ code [code_len++] = val;
+ }
+ public virtual void Emit (OpCode opcode, ConstructorInfo constructor) {
+ int token = abuilder.GetToken (constructor);
+ make_room (6);
+ ll_emit (opcode);
+ if (constructor is ConstructorBuilder)
+ add_token_fixup (constructor);
+ emit_int (token);
+ ParameterInfo[] mparams = constructor.GetParameters();
+ if (mparams != null)
+ cur_stack -= mparams.Length;
+ }
+ public virtual void Emit (OpCode opcode, double val) {
+ byte[] s = System.BitConverter.GetBytes (val);
+ make_room (10);
+ ll_emit (opcode);
+ if (BitConverter.IsLittleEndian){
+ System.Array.Copy (s, 0, code, code_len, 8);
+ code_len += 8;
+ } else {
+ code [code_len++] = s [7];
+ code [code_len++] = s [6];
+ code [code_len++] = s [5];
+ code [code_len++] = s [4];
+ code [code_len++] = s [3];
+ code [code_len++] = s [2];
+ code [code_len++] = s [1];
+ code [code_len++] = s [0];
+ }
+ }
+ public virtual void Emit (OpCode opcode, FieldInfo field) {
+ int token = abuilder.GetToken (field);
+ make_room (6);
+ ll_emit (opcode);
+ if (field is FieldBuilder)
+ add_token_fixup (field);
+ emit_int (token);
+ }
+ public virtual void Emit (OpCode opcode, Int16 val) {
+ make_room (4);
+ ll_emit (opcode);
+ code [code_len++] = (byte) (val & 0xFF);
+ code [code_len++] = (byte) ((val >> 8) & 0xFF);
+ }
+ public virtual void Emit (OpCode opcode, int val) {
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (val);
+ }
+ public virtual void Emit (OpCode opcode, long val) {
+ make_room (10);
+ ll_emit (opcode);
+ code [code_len++] = (byte) (val & 0xFF);
+ code [code_len++] = (byte) ((val >> 8) & 0xFF);
+ code [code_len++] = (byte) ((val >> 16) & 0xFF);
+ code [code_len++] = (byte) ((val >> 24) & 0xFF);
+ code [code_len++] = (byte) ((val >> 32) & 0xFF);
+ code [code_len++] = (byte) ((val >> 40) & 0xFF);
+ code [code_len++] = (byte) ((val >> 48) & 0xFF);
+ code [code_len++] = (byte) ((val >> 56) & 0xFF);
+ }
+ public virtual void Emit (OpCode opcode, Label label) {
+ int tlen = target_len (opcode);
+ make_room (6);
+ ll_emit (opcode);
+ if (num_fixups >= fixups.Length) {
+ LabelFixup[] newf = new LabelFixup [fixups.Length + 16];
+ System.Array.Copy (fixups, newf, fixups.Length);
+ fixups = newf;
+ }
+ fixups [num_fixups].size = tlen;
+ fixups [num_fixups].pos = code_len;
+ fixups [num_fixups].label_base = code_len;
+ fixups [num_fixups].label_idx = label.label;
+ num_fixups++;
+ code_len += tlen;
+
+ }
+ public virtual void Emit (OpCode opcode, Label[] labels) {
+ /* opcode needs to be switch. */
+ int count = labels.Length;
+ make_room (6 + count * 4);
+ ll_emit (opcode);
+ int switch_base = code_len + count*4;
+ emit_int (count);
+ if (num_fixups + count >= fixups.Length) {
+ LabelFixup[] newf = new LabelFixup [fixups.Length + count + 16];
+ System.Array.Copy (fixups, newf, fixups.Length);
+ fixups = newf;
+ }
+ for (int i = 0; i < count; ++i) {
+ fixups [num_fixups].size = 4;
+ fixups [num_fixups].pos = code_len;
+ fixups [num_fixups].label_base = switch_base;
+ fixups [num_fixups].label_idx = labels [i].label;
+ num_fixups++;
+ code_len += 4;
+ }
+ }
+ public virtual void Emit (OpCode opcode, LocalBuilder lbuilder) {
+ uint pos = lbuilder.position;
+ bool load_addr = false;
+ bool is_store = false;
+ make_room (6);
+
+ if (lbuilder.ilgen != this)
+ throw new Exception ("Trying to emit a local from a different ILGenerator.");
+
+ /* inline the code from ll_emit () to optimize il code size */
+ if (opcode.StackBehaviourPop == StackBehaviour.Pop1) {
+ cur_stack --;
+ is_store = true;
+ } else {
+ cur_stack++;
+ if (cur_stack > max_stack)
+ max_stack = cur_stack;
+ load_addr = opcode.StackBehaviourPush == StackBehaviour.Pushi;
+ }
+ if (load_addr) {
+ if (pos < 256) {
+ code [code_len++] = (byte)0x12;
+ code [code_len++] = (byte)pos;
+ } else {
+ code [code_len++] = (byte)0xfe;
+ code [code_len++] = (byte)0x0d;
+ code [code_len++] = (byte)(pos & 0xff);
+ code [code_len++] = (byte)((pos >> 8) & 0xff);
+ }
+ } else {
+ if (is_store) {
+ if (pos < 4) {
+ code [code_len++] = (byte)(0x0a + pos);
+ } else if (pos < 256) {
+ code [code_len++] = (byte)0x13;
+ code [code_len++] = (byte)pos;
+ } else {
+ code [code_len++] = (byte)0xfe;
+ code [code_len++] = (byte)0x0e;
+ code [code_len++] = (byte)(pos & 0xff);
+ code [code_len++] = (byte)((pos >> 8) & 0xff);
+ }
+ } else {
+ if (pos < 4) {
+ code [code_len++] = (byte)(0x06 + pos);
+ } else if (pos < 256) {
+ code [code_len++] = (byte)0x11;
+ code [code_len++] = (byte)pos;
+ } else {
+ code [code_len++] = (byte)0xfe;
+ code [code_len++] = (byte)0x0c;
+ code [code_len++] = (byte)(pos & 0xff);
+ code [code_len++] = (byte)((pos >> 8) & 0xff);
+ }
+ }
+ }
+ }
+ public virtual void Emit (OpCode opcode, MethodInfo method) {
+ int token = abuilder.GetToken (method);
+ make_room (6);
+ ll_emit (opcode);
+ if (method is MethodBuilder)
+ add_token_fixup (method);
+ emit_int (token);
+ if (method.ReturnType != void_type)
+ cur_stack ++;
+ ParameterInfo[] mparams = method.GetParameters();
+ if (mparams != null)
+ cur_stack -= mparams.Length;
+ }
+ [CLSCompliant(false)]
+ public void Emit (OpCode opcode, sbyte val) {
+ make_room (3);
+ ll_emit (opcode);
+ code [code_len++] = (byte)val;
+ }
+
+ [MonoTODO]
+ public virtual void Emit (OpCode opcode, SignatureHelper shelper) {
+ int token = 0; // FIXME: request a token from the modulebuilder
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (token);
+ }
+ public virtual void Emit (OpCode opcode, float val) {
+ byte[] s = System.BitConverter.GetBytes (val);
+ make_room (6);
+ ll_emit (opcode);
+ if (BitConverter.IsLittleEndian){
+ System.Array.Copy (s, 0, code, code_len, 4);
+ code_len += 4;
+ } else {
+ code [code_len++] = s [3];
+ code [code_len++] = s [2];
+ code [code_len++] = s [1];
+ code [code_len++] = s [0];
+ }
+ }
+ public virtual void Emit (OpCode opcode, string val) {
+ int token = abuilder.GetToken (val);
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (token);
+ }
+ public virtual void Emit (OpCode opcode, Type type) {
+ make_room (6);
+ ll_emit (opcode);
+ if (type is TypeBuilder)
+ add_token_fixup (type);
+ emit_int (abuilder.GetToken (type));
+ }
+
+ public void EmitCall (OpCode opcode, MethodInfo methodinfo, Type[] optionalParamTypes) {
+ throw new NotImplementedException ();
+ }
+ public void EmitCalli (OpCode opcode, CallingConventions call_conv, Type returnType, Type[] paramTypes, Type[] optionalParamTypes) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void EmitWriteLine (FieldInfo field) {
+ throw new NotImplementedException ();
+ }
+ public virtual void EmitWriteLine (LocalBuilder lbuilder) {
+ throw new NotImplementedException ();
+ }
+ public virtual void EmitWriteLine (string val) {
+ Emit (OpCodes.Ldstr, val);
+ Emit (OpCodes.Call,
+ typeof (Console).GetMethod ("WriteLine",
+ new Type[1] { typeof(string)}));
+ }
+
+ public virtual void EndExceptionBlock () {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ InternalEndClause ();
+ MarkLabel (ex_handlers [cur_block].end);
+ ex_handlers [cur_block].End (code_len);
+ ex_handlers [cur_block].Debug (cur_block);
+ //System.Console.WriteLine ("End Block {0} (handlers: {1})", cur_block, ex_handlers [cur_block].NumHandlers ());
+ open_blocks.Pop ();
+ if (open_blocks.Count > 0)
+ cur_block = (int)open_blocks.Peek ();
+ //Console.WriteLine ("curblock restored to {0}", cur_block);
+ //throw new NotImplementedException ();
+ }
+ public virtual void EndScope () {
+ if (sym_writer != null) {
+ sym_writer.CloseScope (code_len);
+ if (scopes == null)
+ throw new InvalidOperationException ();
+ scopes.Pop ();
+ }
+ }
+ public virtual void MarkLabel (Label loc) {
+ if (loc.label < 0 || loc.label >= num_labels)
+ throw new System.ArgumentException ("The label is not valid");
+ if (label_to_addr [loc.label] >= 0)
+ throw new System.ArgumentException ("The label was already defined");
+ label_to_addr [loc.label] = code_len;
+ }
+ public virtual void MarkSequencePoint (ISymbolDocumentWriter document, int startLine,
+ int startColumn, int endLine, int endColumn) {
+ if (sym_writer == null)
+ return;
+
+ int[] offsets = { code_len };
+ int[] startLines = { startLine };
+ int[] startColumns = { startColumn };
+ int[] endLines = { endLine };
+ int[] endColumns = { endColumn };
+
+ sym_writer.DefineSequencePoints (document, offsets, startLines, startColumns,
+ endLines, endColumns);
+ }
+ public virtual void ThrowException (Type exceptionType) {
+ throw new NotImplementedException ();
+ }
+ public void UsingNamespace (String usingNamespace) {
+ throw new NotImplementedException ();
+ }
+
+ internal void label_fixup () {
+ int i;
+ for (i = 0; i < num_fixups; ++i) {
+ int diff = label_to_addr [fixups [i].label_idx] - fixups [i].label_base;
+ if (fixups [i].size == 1) {
+ code [fixups [i].pos] = (byte)((sbyte) diff - 1);
+ } else {
+ int old_cl = code_len;
+ code_len = fixups [i].pos;
+ emit_int (diff - 4);
+ code_len = old_cl;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/Label.cs b/mcs/class/corlib/System.Reflection.Emit/Label.cs
new file mode 100644
index 00000000000..19be26c6dea
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/Label.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.Emit/Label.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection.Emit {
+ [Serializable]
+ public struct Label {
+ internal int label;
+
+ internal Label (int val) {
+ label = val;
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj) {
+ /* FIXME */
+ return false;
+ }
+
+ public override int GetHashCode () {
+ return label.GetHashCode ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
new file mode 100755
index 00000000000..6ab80c7f2a7
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
@@ -0,0 +1,70 @@
+
+//
+// System.Reflection.Emit/LocalBuilder.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Martin Baulig (martin@gnome.org)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.SymbolStore;
+
+namespace System.Reflection.Emit {
+ public sealed class LocalBuilder {
+ //
+ // These are kept in sync with reflection.h
+ //
+ #region Sync with reflection.h
+ private Type type;
+ private string name;
+ #endregion
+
+ //
+ // Order does not matter after here
+ //
+ private ModuleBuilder module;
+ internal uint position;
+ internal ILGenerator ilgen;
+
+ internal LocalBuilder (ModuleBuilder m, Type t, ILGenerator ilgen)
+ {
+ this.module = m;
+ this.type = t;
+ this.ilgen = ilgen;
+ }
+ public void SetLocalSymInfo (string lname, int startOffset, int endOffset)
+ {
+ this.name = lname;
+
+ SignatureHelper sighelper = SignatureHelper.GetLocalVarSigHelper (module);
+ sighelper.AddArgument (type);
+ byte[] signature = sighelper.GetSignature ();
+
+ module.symbol_writer.DefineLocalVariable (lname, FieldAttributes.Private,
+ signature, SymAddressKind.ILOffset,
+ (int) position, 0, 0,
+ startOffset, endOffset);
+ }
+
+ public void SetLocalSymInfo (string lname)
+ {
+ SetLocalSymInfo (lname, 0, 0);
+ }
+
+
+ public Type LocalType
+ {
+ get {
+ return type;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
new file mode 100755
index 00000000000..b8190f13e6b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
@@ -0,0 +1,178 @@
+
+//
+// System.Reflection.Emit/MethodBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public sealed class MethodBuilder : MethodInfo {
+ private RuntimeMethodHandle mhandle;
+ private Type rtype;
+ private Type[] parameters;
+ private MethodAttributes attrs;
+ private MethodImplAttributes iattrs;
+ private string name;
+ private int table_idx;
+ private byte[] code;
+ private ILGenerator ilgen;
+ private TypeBuilder type;
+ private ParameterBuilder[] pinfo;
+ private CustomAttributeBuilder[] cattrs;
+ private MethodInfo override_method;
+ private string pi_dll;
+ private string pi_entry;
+ private CharSet ncharset;
+ private CallingConvention native_cc;
+ private CallingConventions call_conv;
+ private bool init_locals = true;
+
+ internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ this.name = name;
+ this.attrs = attributes;
+ this.call_conv = callingConvention;
+ this.rtype = returnType;
+ if (parameterTypes != null) {
+ this.parameters = new Type [parameterTypes.Length];
+ System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
+ }
+ type = tb;
+ table_idx = get_next_table_index (this, 0x06, true);
+ //Console.WriteLine ("index for "+name+" set to "+table_idx.ToString());
+ }
+
+ internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes,
+ CallingConventions callingConvention, Type returnType, Type[] parameterTypes,
+ String dllName, String entryName, CallingConvention nativeCConv, CharSet nativeCharset)
+ : this (tb, name, attributes, callingConvention, returnType, parameterTypes) {
+ pi_dll = dllName;
+ pi_entry = entryName;
+ native_cc = nativeCConv;
+ ncharset = nativeCharset;
+ }
+
+ public bool InitLocals {
+ get {return init_locals;}
+ set {init_locals = value;}
+ }
+
+ internal TypeBuilder TypeBuilder {
+ get {return type;}
+ }
+
+ public override Type ReturnType {get {return rtype;}}
+ public override Type ReflectedType {get {return type;}}
+ public override Type DeclaringType {get {return type;}}
+ public override string Name {get {return name;}}
+ public override RuntimeMethodHandle MethodHandle {get {return mhandle;}}
+ public override MethodAttributes Attributes {get {return attrs;}}
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes {
+ get {return null;}
+ }
+ public MethodToken GetToken() {
+ return new MethodToken(0x06000000 | table_idx);
+ }
+
+ public override MethodInfo GetBaseDefinition() {
+ return null;
+ }
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ return iattrs;
+ }
+ public override ParameterInfo[] GetParameters() {
+ if (parameters == null)
+ return null;
+
+ ParameterInfo[] retval = new ParameterInfo [parameters.Length];
+ for (int i = 0; i < parameters.Length; i++) {
+ retval [i] = new ParameterInfo (pinfo == null ? null : pinfo [i + 1], parameters [i], this, i + 1);
+ }
+ return retval;
+ }
+
+ public void CreateMethodBody( byte[] il, int count) {
+ code = new byte [count];
+ System.Array.Copy(il, code, count);
+ }
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ return null;
+ }
+ public override bool IsDefined (Type attribute_type, bool inherit) {
+ return false;
+ }
+ public override object[] GetCustomAttributes( bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return null;
+ }
+ public ILGenerator GetILGenerator () {
+ return GetILGenerator (64);
+ }
+ public ILGenerator GetILGenerator (int size) {
+ ilgen = new ILGenerator (this, size);
+ return ilgen;
+ }
+
+ [MonoTODO]
+ public ParameterBuilder DefineParameter (int position, ParameterAttributes attributes, string strParamName)
+ {
+ ParameterBuilder pb = new ParameterBuilder (this, position, attributes, strParamName);
+ // check position
+ if (pinfo == null)
+ pinfo = new ParameterBuilder [parameters.Length + 1];
+ pinfo [position] = pb;
+ return pb;
+ }
+
+ internal void fixup () {
+ if (ilgen != null)
+ ilgen.label_fixup ();
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ if (attrname == "System.Runtime.CompilerServices.MethodImplAttribute") {
+ byte[] data = customBuilder.Data;
+ int impla; // the (stupid) ctor takes a short or an int ...
+ impla = (int)data [2];
+ impla |= ((int)data [3]) << 8;
+ SetImplementationFlags ((MethodImplAttributes)impla);
+ return;
+ }
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetImplementationFlags( MethodImplAttributes attributes) {
+ iattrs = attributes;
+ }
+ internal override int get_next_table_index (object obj, int table, bool inc) {
+ return type.get_next_table_index (obj, table, inc);
+ }
+
+ internal void set_override (MethodInfo mdecl) {
+ override_method = mdecl;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodToken.cs b/mcs/class/corlib/System.Reflection.Emit/MethodToken.cs
new file mode 100644
index 00000000000..a08d4247571
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/MethodToken.cs
@@ -0,0 +1,70 @@
+// MethodToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Method.
+ /// </summary>
+ [Serializable]
+ public struct MethodToken {
+
+ internal int tokValue;
+
+ public static readonly MethodToken Empty;
+
+
+ static MethodToken ()
+ {
+ Empty = new MethodToken ();
+ }
+
+
+ internal MethodToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is MethodToken;
+
+ if (res) {
+ MethodToken that = (MethodToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// MethodToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Method.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
new file mode 100644
index 00000000000..0e35694a361
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
@@ -0,0 +1,363 @@
+
+//
+// System.Reflection.Emit/ModuleBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Diagnostics.SymbolStore;
+using System.IO;
+
+namespace System.Reflection.Emit {
+ public class ModuleBuilder : Module {
+ private TypeBuilder[] types;
+ private CustomAttributeBuilder[] cattrs;
+ private byte[] guid;
+ private int table_idx;
+ internal AssemblyBuilder assemblyb;
+ private MethodBuilder[] global_methods;
+ private FieldBuilder[] global_fields;
+ private TypeBuilder global_type;
+ private Type global_type_created;
+ internal ISymbolWriter symbol_writer;
+ Hashtable name_cache;
+
+ internal ModuleBuilder (AssemblyBuilder assb, string name, string fullyqname, bool emitSymbolInfo) {
+ this.name = this.scopename = name;
+ this.fqname = fullyqname;
+ this.assembly = this.assemblyb = assb;
+ guid = Guid.NewGuid().ToByteArray ();
+ table_idx = get_next_table_index (this, 0x00, true);
+ name_cache = new Hashtable ();
+
+ if (emitSymbolInfo)
+ GetSymbolWriter (fullyqname);
+ }
+
+ internal void GetSymbolWriter (string filename)
+ {
+ Assembly assembly;
+ try {
+ assembly = Assembly.Load ("Mono.CSharp.Debugger");
+ } catch (FileNotFoundException) {
+ return;
+ }
+
+ Type type = assembly.GetType ("Mono.CSharp.Debugger.MonoSymbolWriter");
+ if (type == null)
+ return;
+
+ if (assemblyb.methods == null)
+ assemblyb.methods = new ArrayList ();
+
+ // First get the constructor.
+ {
+ Type[] arg_types = new Type [3];
+ arg_types [0] = typeof (ModuleBuilder);
+ arg_types [1] = typeof (string);
+ arg_types [2] = typeof (ArrayList);
+ ConstructorInfo constructor = type.GetConstructor (arg_types);
+
+ object[] args = new object [3];
+ args [0] = this;
+ args [1] = filename;
+ args [2] = assemblyb.methods;
+
+ if (constructor == null)
+ return;
+
+ Object instance = constructor.Invoke (args);
+ if (instance == null)
+ return;
+
+ if (!(instance is ISymbolWriter))
+ return;
+
+ symbol_writer = (ISymbolWriter) instance;
+ }
+ }
+
+ public override string FullyQualifiedName {get { return fqname;}}
+
+ public void CreateGlobalFunctions ()
+ {
+ if (global_type_created != null)
+ throw new InvalidOperationException ("global methods already created");
+ if (global_type != null)
+ global_type_created = global_type.CreateType ();
+ }
+
+
+ public FieldBuilder DefineInitializedData( string name, byte[] data, FieldAttributes attributes) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (global_type_created != null)
+ throw new InvalidOperationException ("global fields already created");
+ if (global_type == null)
+ global_type = new TypeBuilder (this, 0);
+
+ FieldBuilder fb = global_type.DefineInitializedData (name, data, attributes);
+
+ if (global_fields != null) {
+ FieldBuilder[] new_fields = new FieldBuilder [global_fields.Length+1];
+ System.Array.Copy (global_fields, new_fields, global_fields.Length);
+ new_fields [global_fields.Length] = fb;
+ global_fields = new_fields;
+ } else {
+ global_fields = new FieldBuilder [1];
+ global_fields [0] = fb;
+ }
+ return fb;
+ }
+
+ public FieldBuilder DefineUninitializedData( string name, int size, FieldAttributes attributes) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (global_type_created != null)
+ throw new InvalidOperationException ("global fields already created");
+ if (global_type == null)
+ global_type = new TypeBuilder (this, 0);
+
+ FieldBuilder fb = global_type.DefineUninitializedData (name, size, attributes);
+
+ if (global_fields != null) {
+ FieldBuilder[] new_fields = new FieldBuilder [global_fields.Length+1];
+ System.Array.Copy (global_fields, new_fields, global_fields.Length);
+ new_fields [global_fields.Length] = fb;
+ global_fields = new_fields;
+ } else {
+ global_fields = new FieldBuilder [1];
+ global_fields [0] = fb;
+ }
+ return fb;
+ }
+
+ public MethodBuilder DefineGlobalMethod (string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
+ {
+ return DefineGlobalMethod (name, attributes, CallingConventions.Standard, returnType, parameterTypes);
+ }
+
+ public MethodBuilder DefineGlobalMethod (string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if ((attributes & MethodAttributes.Static) == 0)
+ throw new ArgumentException ("global methods must be static");
+ if (global_type_created != null)
+ throw new InvalidOperationException ("global methods already created");
+ if (global_type == null)
+ global_type = new TypeBuilder (this, 0);
+ MethodBuilder mb = global_type.DefineMethod (name, attributes, callingConvention, returnType, parameterTypes);
+
+ if (global_methods != null) {
+ MethodBuilder[] new_methods = new MethodBuilder [global_methods.Length+1];
+ System.Array.Copy (global_methods, new_methods, global_methods.Length);
+ new_methods [global_methods.Length] = mb;
+ global_methods = new_methods;
+ } else {
+ global_methods = new MethodBuilder [1];
+ global_methods [0] = mb;
+ }
+ return mb;
+ }
+
+ [MonoTODO]
+ public TypeBuilder DefineType (string name) {
+ // FIXME: LAMESPEC: what other attributes should we use here as default?
+ return DefineType (name, TypeAttributes.Public, typeof(object), null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr) {
+ return DefineType (name, attr, typeof(object), null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent) {
+ return DefineType (name, attr, parent, null);
+ }
+
+ private TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packsize, int typesize) {
+ TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces, packsize, typesize);
+ if (types != null) {
+ TypeBuilder[] new_types = new TypeBuilder [types.Length + 1];
+ System.Array.Copy (types, new_types, types.Length);
+ new_types [types.Length] = res;
+ types = new_types;
+ } else {
+ types = new TypeBuilder [1];
+ types [0] = res;
+ }
+ name_cache.Add (name, res);
+ return res;
+ }
+
+ internal void RegisterTypeName (TypeBuilder tb, string name) {
+ name_cache.Add (name, tb);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces) {
+ return DefineType (name, attr, parent, interfaces, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, int typesize) {
+ return DefineType (name, attr, parent, null, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize) {
+ return DefineType (name, attr, parent, null, packsize, TypeBuilder.UnspecifiedTypeSize);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize, int typesize) {
+ return DefineType (name, attr, parent, null, packsize, typesize);
+ }
+
+ public MethodInfo GetArrayMethod( Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ return new MonoArrayMethod (arrayClass, methodName, callingConvention, returnType, parameterTypes);
+ }
+
+ public EnumBuilder DefineEnum( string name, TypeAttributes visibility, Type underlyingType) {
+ EnumBuilder eb = new EnumBuilder (this, name, visibility, underlyingType);
+ return eb;
+ }
+
+ public override Type GetType( string className) {
+ return GetType (className, false, false);
+ }
+
+ public override Type GetType( string className, bool ignoreCase) {
+ return GetType (className, false, ignoreCase);
+ }
+
+ private TypeBuilder search_in_array (TypeBuilder[] arr, string className) {
+ int i;
+ for (i = 0; i < arr.Length; ++i) {
+ if (String.Compare (className, arr [i].FullName, true) == 0) {
+ return arr [i];
+ }
+ }
+ return null;
+ }
+
+ private TypeBuilder search_nested_in_array (TypeBuilder[] arr, string className) {
+ int i;
+ for (i = 0; i < arr.Length; ++i) {
+ if (String.Compare (className, arr [i].Name, true) == 0)
+ return arr [i];
+ }
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type create_modified_type (TypeBuilder tb, string modifiers);
+
+ static char[] type_modifiers = {'&', '[', '*'};
+
+ private TypeBuilder GetMaybeNested (TypeBuilder t, string className) {
+ int subt;
+ string pname, rname;
+
+ subt = className.IndexOf ('+');
+ if (subt < 0) {
+ if (t.subtypes != null)
+ return search_nested_in_array (t.subtypes, className);
+ return null;
+ }
+ if (t.subtypes != null) {
+ pname = className.Substring (0, subt);
+ rname = className.Substring (subt + 1);
+ TypeBuilder result = search_nested_in_array (t.subtypes, pname);
+ if (result != null)
+ return GetMaybeNested (result, rname);
+ }
+ return null;
+ }
+
+ public override Type GetType (string className, bool throwOnError, bool ignoreCase) {
+ int subt;
+ string orig = className;
+ string modifiers;
+ TypeBuilder result = null;
+
+ if (types == null && throwOnError)
+ throw new TypeLoadException (className);
+
+ subt = className.IndexOfAny (type_modifiers);
+ if (subt >= 0) {
+ modifiers = className.Substring (subt);
+ className = className.Substring (0, subt);
+ } else
+ modifiers = null;
+
+ if (!ignoreCase) {
+ result = name_cache [className] as TypeBuilder;
+ } else {
+ subt = className.IndexOf ('+');
+ if (subt < 0) {
+ if (types != null)
+ result = search_in_array (types, className);
+ } else {
+ string pname, rname;
+ pname = className.Substring (0, subt);
+ rname = className.Substring (subt + 1);
+ result = search_in_array (types, pname);
+ if (result != null)
+ result = GetMaybeNested (result, rname);
+ }
+ }
+ if ((result == null) && throwOnError)
+ throw new TypeLoadException (orig);
+ if (result != null && (modifiers != null))
+ return create_modified_type (result, modifiers);
+ return result;
+ }
+
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ return assemblyb.get_next_table_index (obj, table, inc);
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public ISymbolWriter GetSymWriter () {
+ return symbol_writer;
+ }
+
+ public ISymbolDocumentWriter DefineDocument (string url, Guid language, Guid languageVendor, Guid documentType) {
+ if (symbol_writer == null)
+ throw new InvalidOperationException ();
+
+ return symbol_writer.DefineDocument (url, language, languageVendor, documentType);
+ }
+
+ public override Type [] GetTypes ()
+ {
+ if (types == null)
+ return new TypeBuilder [0];
+
+ int n = types.Length;
+ TypeBuilder [] copy = new TypeBuilder [n];
+ Array.Copy (types, copy, n);
+
+ return copy;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs b/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
new file mode 100755
index 00000000000..130cd3e5623
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
@@ -0,0 +1,111 @@
+//
+// System.Reflection/MonoMethod.cs
+// The class used to represent methods from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+ internal class MonoArrayMethod: MethodInfo {
+ internal RuntimeMethodHandle mhandle;
+ internal Type parent;
+ internal Type ret;
+ internal Type[] parameters;
+ internal string name;
+ internal int table_idx;
+ internal CallingConventions call_conv;
+
+ internal MonoArrayMethod (Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ name = methodName;
+ parent = arrayClass;
+ ret = returnType;
+ parameters = (Type[])parameterTypes.Clone();
+ call_conv = callingConvention;
+ }
+
+ [MonoTODO]
+ public override MethodInfo GetBaseDefinition() {
+ return this; /* FIXME */
+ }
+ public override Type ReturnType {
+ get {
+ return ret;
+ }
+ }
+ [MonoTODO]
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes {
+ get {return null;}
+ }
+
+ [MonoTODO]
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ return (MethodImplAttributes)0;
+ }
+
+ [MonoTODO]
+ public override ParameterInfo[] GetParameters() {
+ return new ParameterInfo [0];
+ }
+
+ [MonoTODO]
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ throw new NotImplementedException ();
+ }
+
+ public override RuntimeMethodHandle MethodHandle {
+ get {return mhandle;}
+ }
+ [MonoTODO]
+ public override MethodAttributes Attributes {
+ get {
+ return (MethodAttributes)0;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ return parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ return parent;
+ }
+ }
+ public override string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override string ToString () {
+ string parms = "";
+ ParameterInfo[] p = GetParameters ();
+ for (int i = 0; i < p.Length; ++i) {
+ if (i > 0)
+ parms = parms + ", ";
+ parms = parms + p [i].ParameterType.Name;
+ }
+ return ReturnType.Name+" "+Name+"("+parms+")";
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/OpCode.cs b/mcs/class/corlib/System.Reflection.Emit/OpCode.cs
new file mode 100644
index 00000000000..239091fbaa2
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OpCode.cs
@@ -0,0 +1,129 @@
+//
+// System.Reflection.Emit.OpCode
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+
+namespace System.Reflection.Emit {
+
+ public struct OpCode {
+
+ internal string name;
+ internal int size;
+ internal OpCodeType type;
+ internal OperandType operandType;
+ internal StackBehaviour pop;
+ internal StackBehaviour push;
+ internal FlowControl flowCtrl;
+ internal byte op1;
+ internal byte op2;
+
+ internal OpCode (string name, int size,
+ OpCodeType opcodeType,
+ OperandType operandType,
+ StackBehaviour pop,
+ StackBehaviour push,
+ FlowControl flowCtrl,
+ byte op1, byte op2)
+ {
+ this.name = name;
+ this.size = size;
+ this.type = opcodeType;
+ this.operandType = operandType;
+ this.pop = pop;
+ this.push = push;
+ this.flowCtrl = flowCtrl;
+ this.op1 = op1;
+ this.op2 = op2;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public int Size {
+ get {
+ return size;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public OpCodeType OpCodeType {
+ get {
+ return type;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public OperandType OperandType {
+ get {
+ return operandType;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public FlowControl FlowControl {
+ get {
+ return flowCtrl;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public StackBehaviour StackBehaviourPop {
+ get {
+ return pop;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public StackBehaviour StackBehaviourPush {
+ get {
+ return push;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public short Value {
+ get {
+ if (size == 1) {
+ return op2;
+ } else {
+ // two byte instruction - combine
+ // give the same values as the mscorlib impl
+ // this makes the Value property useless
+ return (short) ((op1 << 2) | op2);
+ }
+ }
+ }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ } // OpCode
+
+} // System.Reflection.Emit
diff --git a/mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs b/mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs
new file mode 100644
index 00000000000..2733369ecbe
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs
@@ -0,0 +1,49 @@
+// OpCodeType.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes the types of MSIL instructions.
+ /// </summary>
+ public enum OpCodeType {
+
+ /// <summary>
+ /// "Ignorable" instruction.
+ /// Such instruction are used to supply
+ /// additional information to particular
+ /// MSIL processor.
+ /// </summary>
+ Annotation = 0,
+
+ /// <summary>
+ /// Denotes "shorthand" instruction.
+ /// Such instructions take less space
+ /// than their full-size equivalents
+ /// (ex. ldarg.0 vs. ldarg 0).
+ /// </summary>
+ Macro = 1,
+
+ /// <summary>
+ /// Denotes instruction reserved for internal use.
+ /// </summary>
+ Nternal = 2,
+
+ /// <summary>
+ /// Denotes instruction to deal with objects.
+ /// (ex. ldobj).
+ /// </summary>
+ Objmodel = 3,
+
+ /// <summary>
+ /// </summary>
+ Prefix = 4,
+
+ /// <summary>
+ /// </summary>
+ Primitive = 5
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/OpCodes.cs b/mcs/class/corlib/System.Reflection.Emit/OpCodes.cs
new file mode 100644
index 00000000000..1626d3f4ddb
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OpCodes.cs
@@ -0,0 +1,486 @@
+// OpCodes.cs
+// Mechanically generated - DO NOT EDIT!
+//
+// (C) Sergey Chaban (serge@wildwestsoftware.com)
+
+using System;
+using System.Reflection.Emit;
+
+namespace System.Reflection.Emit {
+
+
+ public class OpCodes {
+ public static readonly OpCode Add;
+ public static readonly OpCode Add_Ovf;
+ public static readonly OpCode Add_Ovf_Un;
+ public static readonly OpCode And;
+ public static readonly OpCode Arglist;
+ public static readonly OpCode Beq;
+ public static readonly OpCode Beq_S;
+ public static readonly OpCode Bge;
+ public static readonly OpCode Bge_S;
+ public static readonly OpCode Bge_Un;
+ public static readonly OpCode Bge_Un_S;
+ public static readonly OpCode Bgt;
+ public static readonly OpCode Bgt_S;
+ public static readonly OpCode Bgt_Un;
+ public static readonly OpCode Bgt_Un_S;
+ public static readonly OpCode Ble;
+ public static readonly OpCode Ble_S;
+ public static readonly OpCode Ble_Un;
+ public static readonly OpCode Ble_Un_S;
+ public static readonly OpCode Blt;
+ public static readonly OpCode Blt_S;
+ public static readonly OpCode Blt_Un;
+ public static readonly OpCode Blt_Un_S;
+ public static readonly OpCode Bne_Un;
+ public static readonly OpCode Bne_Un_S;
+ public static readonly OpCode Box;
+ public static readonly OpCode Boxval;
+ public static readonly OpCode Br;
+ public static readonly OpCode Br_S;
+ public static readonly OpCode Break;
+ public static readonly OpCode Brfalse;
+ public static readonly OpCode Brfalse_S;
+ public static readonly OpCode Brtrue;
+ public static readonly OpCode Brtrue_S;
+ public static readonly OpCode Call;
+ public static readonly OpCode Calli;
+ public static readonly OpCode Callvirt;
+ public static readonly OpCode Castclass;
+ public static readonly OpCode Ceq;
+ public static readonly OpCode Cgt;
+ public static readonly OpCode Cgt_Un;
+ public static readonly OpCode Ckfinite;
+ public static readonly OpCode Clt;
+ public static readonly OpCode Clt_Un;
+ public static readonly OpCode Conv_I;
+ public static readonly OpCode Conv_I1;
+ public static readonly OpCode Conv_I2;
+ public static readonly OpCode Conv_I4;
+ public static readonly OpCode Conv_I8;
+ public static readonly OpCode Conv_Ovf_I;
+ public static readonly OpCode Conv_Ovf_I_Un;
+ public static readonly OpCode Conv_Ovf_I1;
+ public static readonly OpCode Conv_Ovf_I1_Un;
+ public static readonly OpCode Conv_Ovf_I2;
+ public static readonly OpCode Conv_Ovf_I2_Un;
+ public static readonly OpCode Conv_Ovf_I4;
+ public static readonly OpCode Conv_Ovf_I4_Un;
+ public static readonly OpCode Conv_Ovf_I8;
+ public static readonly OpCode Conv_Ovf_I8_Un;
+ public static readonly OpCode Conv_Ovf_U;
+ public static readonly OpCode Conv_Ovf_U_Un;
+ public static readonly OpCode Conv_Ovf_U1;
+ public static readonly OpCode Conv_Ovf_U1_Un;
+ public static readonly OpCode Conv_Ovf_U2;
+ public static readonly OpCode Conv_Ovf_U2_Un;
+ public static readonly OpCode Conv_Ovf_U4;
+ public static readonly OpCode Conv_Ovf_U4_Un;
+ public static readonly OpCode Conv_Ovf_U8;
+ public static readonly OpCode Conv_Ovf_U8_Un;
+ public static readonly OpCode Conv_R_Un;
+ public static readonly OpCode Conv_R4;
+ public static readonly OpCode Conv_R8;
+ public static readonly OpCode Conv_U;
+ public static readonly OpCode Conv_U1;
+ public static readonly OpCode Conv_U2;
+ public static readonly OpCode Conv_U4;
+ public static readonly OpCode Conv_U8;
+ public static readonly OpCode Cpblk;
+ public static readonly OpCode Cpobj;
+ public static readonly OpCode Div;
+ public static readonly OpCode Div_Un;
+ public static readonly OpCode Dup;
+ public static readonly OpCode Endfilter;
+ public static readonly OpCode Endfinally;
+ public static readonly OpCode Initblk;
+ public static readonly OpCode Initobj;
+ public static readonly OpCode Isinst;
+ public static readonly OpCode Jmp;
+ public static readonly OpCode Ldarg;
+ public static readonly OpCode Ldarg_0;
+ public static readonly OpCode Ldarg_1;
+ public static readonly OpCode Ldarg_2;
+ public static readonly OpCode Ldarg_3;
+ public static readonly OpCode Ldarg_S;
+ public static readonly OpCode Ldarga;
+ public static readonly OpCode Ldarga_S;
+ public static readonly OpCode Ldc_I4;
+ public static readonly OpCode Ldc_I4_0;
+ public static readonly OpCode Ldc_I4_1;
+ public static readonly OpCode Ldc_I4_2;
+ public static readonly OpCode Ldc_I4_3;
+ public static readonly OpCode Ldc_I4_4;
+ public static readonly OpCode Ldc_I4_5;
+ public static readonly OpCode Ldc_I4_6;
+ public static readonly OpCode Ldc_I4_7;
+ public static readonly OpCode Ldc_I4_8;
+ public static readonly OpCode Ldc_I4_M1;
+ public static readonly OpCode Ldc_I4_S;
+ public static readonly OpCode Ldc_I8;
+ public static readonly OpCode Ldc_R4;
+ public static readonly OpCode Ldc_R8;
+ public static readonly OpCode Ldelem_I;
+ public static readonly OpCode Ldelem_I1;
+ public static readonly OpCode Ldelem_I2;
+ public static readonly OpCode Ldelem_I4;
+ public static readonly OpCode Ldelem_I8;
+ public static readonly OpCode Ldelem_R4;
+ public static readonly OpCode Ldelem_R8;
+ public static readonly OpCode Ldelem_Ref;
+ public static readonly OpCode Ldelem_U1;
+ public static readonly OpCode Ldelem_U2;
+ public static readonly OpCode Ldelem_U4;
+ public static readonly OpCode Ldelema;
+ public static readonly OpCode Ldfld;
+ public static readonly OpCode Ldflda;
+ public static readonly OpCode Ldftn;
+ public static readonly OpCode Ldind_I;
+ public static readonly OpCode Ldind_I1;
+ public static readonly OpCode Ldind_I2;
+ public static readonly OpCode Ldind_I4;
+ public static readonly OpCode Ldind_I8;
+ public static readonly OpCode Ldind_R4;
+ public static readonly OpCode Ldind_R8;
+ public static readonly OpCode Ldind_Ref;
+ public static readonly OpCode Ldind_U1;
+ public static readonly OpCode Ldind_U2;
+ public static readonly OpCode Ldind_U4;
+ public static readonly OpCode Ldlen;
+ public static readonly OpCode Ldloc;
+ public static readonly OpCode Ldloc_0;
+ public static readonly OpCode Ldloc_1;
+ public static readonly OpCode Ldloc_2;
+ public static readonly OpCode Ldloc_3;
+ public static readonly OpCode Ldloc_S;
+ public static readonly OpCode Ldloca;
+ public static readonly OpCode Ldloca_S;
+ public static readonly OpCode Ldnull;
+ public static readonly OpCode Ldobj;
+ public static readonly OpCode Ldsfld;
+ public static readonly OpCode Ldsflda;
+ public static readonly OpCode Ldstr;
+ public static readonly OpCode Ldtoken;
+ public static readonly OpCode Ldvirtftn;
+ public static readonly OpCode Leave;
+ public static readonly OpCode Leave_S;
+ public static readonly OpCode Localloc;
+ public static readonly OpCode Mkrefany;
+ public static readonly OpCode Mul;
+ public static readonly OpCode Mul_Ovf;
+ public static readonly OpCode Mul_Ovf_Un;
+ public static readonly OpCode Neg;
+ public static readonly OpCode Newarr;
+ public static readonly OpCode Newobj;
+ public static readonly OpCode Nop;
+ public static readonly OpCode Not;
+ public static readonly OpCode Or;
+ public static readonly OpCode Pop;
+ public static readonly OpCode Prefix1;
+ public static readonly OpCode Prefix2;
+ public static readonly OpCode Prefix3;
+ public static readonly OpCode Prefix4;
+ public static readonly OpCode Prefix5;
+ public static readonly OpCode Prefix6;
+ public static readonly OpCode Prefix7;
+ public static readonly OpCode Prefixref;
+ public static readonly OpCode Refanytype;
+ public static readonly OpCode Refanyval;
+ public static readonly OpCode Rem;
+ public static readonly OpCode Rem_Un;
+ public static readonly OpCode Ret;
+ public static readonly OpCode Rethrow;
+ public static readonly OpCode Shl;
+ public static readonly OpCode Shr;
+ public static readonly OpCode Shr_Un;
+ public static readonly OpCode Sizeof;
+ public static readonly OpCode Starg;
+ public static readonly OpCode Starg_S;
+ public static readonly OpCode Stelem_I;
+ public static readonly OpCode Stelem_I1;
+ public static readonly OpCode Stelem_I2;
+ public static readonly OpCode Stelem_I4;
+ public static readonly OpCode Stelem_I8;
+ public static readonly OpCode Stelem_R4;
+ public static readonly OpCode Stelem_R8;
+ public static readonly OpCode Stelem_Ref;
+ public static readonly OpCode Stfld;
+ public static readonly OpCode Stind_I;
+ public static readonly OpCode Stind_I1;
+ public static readonly OpCode Stind_I2;
+ public static readonly OpCode Stind_I4;
+ public static readonly OpCode Stind_I8;
+ public static readonly OpCode Stind_R4;
+ public static readonly OpCode Stind_R8;
+ public static readonly OpCode Stind_Ref;
+ public static readonly OpCode Stloc;
+ public static readonly OpCode Stloc_0;
+ public static readonly OpCode Stloc_1;
+ public static readonly OpCode Stloc_2;
+ public static readonly OpCode Stloc_3;
+ public static readonly OpCode Stloc_S;
+ public static readonly OpCode Stobj;
+ public static readonly OpCode Stsfld;
+ public static readonly OpCode Sub;
+ public static readonly OpCode Sub_Ovf;
+ public static readonly OpCode Sub_Ovf_Un;
+ public static readonly OpCode Switch;
+ public static readonly OpCode Tailcall;
+ public static readonly OpCode Throw;
+ public static readonly OpCode Unaligned;
+ public static readonly OpCode Unbox;
+ public static readonly OpCode Volatile;
+ public static readonly OpCode Xor;
+
+
+ private OpCodes () {}
+
+ static OpCodes ()
+ {
+
+ Nop = new OpCode("nop", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x0);
+ Arglist = new OpCode("arglist", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x0);
+ Break = new OpCode("break", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Break, 0xFF, 0x1);
+ Ceq = new OpCode("ceq", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x1);
+ Starg_S = new OpCode("starg.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x10);
+ Ldloc_S = new OpCode("ldloc.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x11);
+ Endfilter = new OpCode("endfilter", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Return, 0xFE, 0x11);
+ Ldloca_S = new OpCode("ldloca.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x12);
+ Unaligned = new OpCode("unaligned.", 2, OpCodeType.Prefix, OperandType.ShortInlineI, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFE, 0x12);
+ Stloc_S = new OpCode("stloc.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x13);
+ Volatile = new OpCode("volatile.", 2, OpCodeType.Prefix, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFE, 0x13);
+ Ldnull = new OpCode("ldnull", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x14);
+ Tailcall = new OpCode("tail.", 2, OpCodeType.Prefix, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFE, 0x14);
+ Ldc_I4_M1 = new OpCode("ldc.i4.m1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x15);
+ Initobj = new OpCode("initobj", 2, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0x15);
+ Ldc_I4_0 = new OpCode("ldc.i4.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x16);
+ Ldc_I4_1 = new OpCode("ldc.i4.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x17);
+ Cpblk = new OpCode("cpblk", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0x17);
+ Ldc_I4_2 = new OpCode("ldc.i4.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x18);
+ Initblk = new OpCode("initblk", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0x18);
+ Ldc_I4_3 = new OpCode("ldc.i4.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x19);
+ Ldc_I4_4 = new OpCode("ldc.i4.4", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1A);
+ Rethrow = new OpCode("rethrow", 2, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Throw, 0xFE, 0x1A);
+ Ldc_I4_5 = new OpCode("ldc.i4.5", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1B);
+ Ldc_I4_6 = new OpCode("ldc.i4.6", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1C);
+ Sizeof = new OpCode("sizeof", 2, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x1C);
+ Ldc_I4_7 = new OpCode("ldc.i4.7", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1D);
+ Refanytype = new OpCode("refanytype", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x1D);
+ Ldc_I4_8 = new OpCode("ldc.i4.8", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1E);
+ Ldc_I4_S = new OpCode("ldc.i4.s", 1, OpCodeType.Macro, OperandType.ShortInlineI, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1F);
+ Ldarg_0 = new OpCode("ldarg.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x2);
+ Cgt = new OpCode("cgt", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x2);
+ Ldc_I4 = new OpCode("ldc.i4", 1, OpCodeType.Primitive, OperandType.InlineI, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x20);
+ Ldc_I8 = new OpCode("ldc.i8", 1, OpCodeType.Primitive, OperandType.InlineI8, StackBehaviour.Pop0, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x21);
+ Ldc_R4 = new OpCode("ldc.r4", 1, OpCodeType.Primitive, OperandType.ShortInlineR, StackBehaviour.Pop0, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x22);
+ Ldc_R8 = new OpCode("ldc.r8", 1, OpCodeType.Primitive, OperandType.InlineR, StackBehaviour.Pop0, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x23);
+ Dup = new OpCode("dup", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push1_push1, FlowControl.Next, 0xFF, 0x25);
+ Pop = new OpCode("pop", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x26);
+ Jmp = new OpCode("jmp", 1, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Call, 0xFF, 0x27);
+ Call = new OpCode("call", 1, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Varpop, StackBehaviour.Varpush, FlowControl.Call, 0xFF, 0x28);
+ Calli = new OpCode("calli", 1, OpCodeType.Primitive, OperandType.InlineSig, StackBehaviour.Varpop, StackBehaviour.Varpush, FlowControl.Call, 0xFF, 0x29);
+ Ret = new OpCode("ret", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Varpop, StackBehaviour.Push0, FlowControl.Return, 0xFF, 0x2A);
+ Br_S = new OpCode("br.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0x2B);
+ Brfalse_S = new OpCode("brfalse.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2C);
+ Brtrue_S = new OpCode("brtrue.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2D);
+ Beq_S = new OpCode("beq.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2E);
+ Bge_S = new OpCode("bge.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2F);
+ Ldarg_1 = new OpCode("ldarg.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x3);
+ Cgt_Un = new OpCode("cgt.un", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x3);
+ Bgt_S = new OpCode("bgt.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x30);
+ Ble_S = new OpCode("ble.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x31);
+ Blt_S = new OpCode("blt.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x32);
+ Bne_Un_S = new OpCode("bne.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x33);
+ Bge_Un_S = new OpCode("bge.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x34);
+ Bgt_Un_S = new OpCode("bgt.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x35);
+ Ble_Un_S = new OpCode("ble.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x36);
+ Blt_Un_S = new OpCode("blt.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x37);
+ Br = new OpCode("br", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0x38);
+ Brfalse = new OpCode("brfalse", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x39);
+ Brtrue = new OpCode("brtrue", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3A);
+ Beq = new OpCode("beq", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3B);
+ Bge = new OpCode("bge", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3C);
+ Bgt = new OpCode("bgt", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3D);
+ Ble = new OpCode("ble", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3E);
+ Blt = new OpCode("blt", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3F);
+ Ldarg_2 = new OpCode("ldarg.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x4);
+ Clt = new OpCode("clt", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x4);
+ Bne_Un = new OpCode("bne.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x40);
+ Bge_Un = new OpCode("bge.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x41);
+ Bgt_Un = new OpCode("bgt.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x42);
+ Ble_Un = new OpCode("ble.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x43);
+ Blt_Un = new OpCode("blt.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x44);
+ Switch = new OpCode("switch", 1, OpCodeType.Primitive, OperandType.InlineSwitch, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x45);
+ Ldind_I1 = new OpCode("ldind.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x46);
+ Ldind_U1 = new OpCode("ldind.u1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x47);
+ Ldind_I2 = new OpCode("ldind.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x48);
+ Ldind_U2 = new OpCode("ldind.u2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x49);
+ Ldind_I4 = new OpCode("ldind.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x4A);
+ Ldind_U4 = new OpCode("ldind.u4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x4B);
+ Ldind_I8 = new OpCode("ldind.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x4C);
+ Ldind_I = new OpCode("ldind.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x4D);
+ Ldind_R4 = new OpCode("ldind.r4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x4E);
+ Ldind_R8 = new OpCode("ldind.r8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x4F);
+ Ldarg_3 = new OpCode("ldarg.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5);
+ Clt_Un = new OpCode("clt.un", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x5);
+ Ldind_Ref = new OpCode("ldind.ref", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x50);
+ Stind_Ref = new OpCode("stind.ref", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x51);
+ Stind_I1 = new OpCode("stind.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x52);
+ Stind_I2 = new OpCode("stind.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x53);
+ Stind_I4 = new OpCode("stind.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x54);
+ Stind_I8 = new OpCode("stind.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x55);
+ Stind_R4 = new OpCode("stind.r4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popr4, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x56);
+ Stind_R8 = new OpCode("stind.r8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popr8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x57);
+ Add = new OpCode("add", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x58);
+ Sub = new OpCode("sub", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x59);
+ Mul = new OpCode("mul", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5A);
+ Div = new OpCode("div", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5B);
+ Div_Un = new OpCode("div.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5C);
+ Rem = new OpCode("rem", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5D);
+ Rem_Un = new OpCode("rem.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5E);
+ And = new OpCode("and", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5F);
+ Ldloc_0 = new OpCode("ldloc.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x6);
+ Ldftn = new OpCode("ldftn", 2, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x6);
+ Or = new OpCode("or", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x60);
+ Xor = new OpCode("xor", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x61);
+ Shl = new OpCode("shl", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x62);
+ Shr = new OpCode("shr", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x63);
+ Shr_Un = new OpCode("shr.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x64);
+ Neg = new OpCode("neg", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x65);
+ Not = new OpCode("not", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x66);
+ Conv_I1 = new OpCode("conv.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x67);
+ Conv_I2 = new OpCode("conv.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x68);
+ Conv_I4 = new OpCode("conv.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x69);
+ Conv_I8 = new OpCode("conv.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x6A);
+ Conv_R4 = new OpCode("conv.r4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x6B);
+ Conv_R8 = new OpCode("conv.r8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x6C);
+ Conv_U4 = new OpCode("conv.u4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x6D);
+ Conv_U8 = new OpCode("conv.u8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x6E);
+ Callvirt = new OpCode("callvirt", 1, OpCodeType.Objmodel, OperandType.InlineMethod, StackBehaviour.Varpop, StackBehaviour.Varpush, FlowControl.Call, 0xFF, 0x6F);
+ Ldloc_1 = new OpCode("ldloc.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x7);
+ Ldvirtftn = new OpCode("ldvirtftn", 2, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x7);
+ Cpobj = new OpCode("cpobj", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x70);
+ Ldobj = new OpCode("ldobj", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x71);
+ Ldstr = new OpCode("ldstr", 1, OpCodeType.Objmodel, OperandType.InlineString, StackBehaviour.Pop0, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x72);
+ Newobj = new OpCode("newobj", 1, OpCodeType.Objmodel, OperandType.InlineMethod, StackBehaviour.Varpop, StackBehaviour.Pushref, FlowControl.Call, 0xFF, 0x73);
+ Castclass = new OpCode("castclass", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popref, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x74);
+ Isinst = new OpCode("isinst", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x75);
+ Conv_R_Un = new OpCode("conv.r.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x76);
+ Unbox = new OpCode("unbox", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x79);
+ Throw = new OpCode("throw", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref, StackBehaviour.Push0, FlowControl.Throw, 0xFF, 0x7A);
+ Ldfld = new OpCode("ldfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Popref, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x7B);
+ Ldflda = new OpCode("ldflda", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x7C);
+ Stfld = new OpCode("stfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Popref_pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x7D);
+ Ldsfld = new OpCode("ldsfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x7E);
+ Ldsflda = new OpCode("ldsflda", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x7F);
+ Ldloc_2 = new OpCode("ldloc.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x8);
+ Stsfld = new OpCode("stsfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x80);
+ Stobj = new OpCode("stobj", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Popi_pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x81);
+ Conv_Ovf_I1_Un = new OpCode("conv.ovf.i1.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x82);
+ Conv_Ovf_I2_Un = new OpCode("conv.ovf.i2.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x83);
+ Conv_Ovf_I4_Un = new OpCode("conv.ovf.i4.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x84);
+ Conv_Ovf_I8_Un = new OpCode("conv.ovf.i8.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x85);
+ Conv_Ovf_U1_Un = new OpCode("conv.ovf.u1.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x86);
+ Conv_Ovf_U2_Un = new OpCode("conv.ovf.u2.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x87);
+ Conv_Ovf_U4_Un = new OpCode("conv.ovf.u4.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x88);
+ Conv_Ovf_U8_Un = new OpCode("conv.ovf.u8.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x89);
+ Conv_Ovf_I_Un = new OpCode("conv.ovf.i.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8A);
+ Conv_Ovf_U_Un = new OpCode("conv.ovf.u.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8B);
+ Boxval = new OpCode("boxval", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop1, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x8C);
+ Box = new OpCode("box", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop1, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x8C);
+ Newarr = new OpCode("newarr", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x8D);
+ Ldlen = new OpCode("ldlen", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8E);
+ Ldelema = new OpCode("ldelema", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8F);
+ Ldloc_3 = new OpCode("ldloc.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x9);
+ Ldarg = new OpCode("ldarg", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFE, 0x9);
+ Ldelem_I1 = new OpCode("ldelem.i1", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x90);
+ Ldelem_U1 = new OpCode("ldelem.u1", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x91);
+ Ldelem_I2 = new OpCode("ldelem.i2", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x92);
+ Ldelem_U2 = new OpCode("ldelem.u2", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x93);
+ Ldelem_I4 = new OpCode("ldelem.i4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x94);
+ Ldelem_U4 = new OpCode("ldelem.u4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x95);
+ Ldelem_I8 = new OpCode("ldelem.i8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x96);
+ Ldelem_I = new OpCode("ldelem.i", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x97);
+ Ldelem_R4 = new OpCode("ldelem.r4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x98);
+ Ldelem_R8 = new OpCode("ldelem.r8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x99);
+ Ldelem_Ref = new OpCode("ldelem.ref", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x9A);
+ Stelem_I = new OpCode("stelem.i", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9B);
+ Stelem_I1 = new OpCode("stelem.i1", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9C);
+ Stelem_I2 = new OpCode("stelem.i2", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9D);
+ Stelem_I4 = new OpCode("stelem.i4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9E);
+ Stelem_I8 = new OpCode("stelem.i8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9F);
+ Stloc_0 = new OpCode("stloc.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA);
+ Ldarga = new OpCode("ldarga", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0xA);
+ Stelem_R4 = new OpCode("stelem.r4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popr4, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA0);
+ Stelem_R8 = new OpCode("stelem.r8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popr8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA1);
+ Stelem_Ref = new OpCode("stelem.ref", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popref, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA2);
+ Stloc_1 = new OpCode("stloc.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xB);
+ Starg = new OpCode("starg", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0xB);
+ Conv_Ovf_I1 = new OpCode("conv.ovf.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB3);
+ Conv_Ovf_U1 = new OpCode("conv.ovf.u1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB4);
+ Conv_Ovf_I2 = new OpCode("conv.ovf.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB5);
+ Conv_Ovf_U2 = new OpCode("conv.ovf.u2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB6);
+ Conv_Ovf_I4 = new OpCode("conv.ovf.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB7);
+ Conv_Ovf_U4 = new OpCode("conv.ovf.u4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB8);
+ Conv_Ovf_I8 = new OpCode("conv.ovf.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0xB9);
+ Conv_Ovf_U8 = new OpCode("conv.ovf.u8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0xBA);
+ Stloc_2 = new OpCode("stloc.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xC);
+ Ldloc = new OpCode("ldloc", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFE, 0xC);
+ Refanyval = new OpCode("refanyval", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xC2);
+ Ckfinite = new OpCode("ckfinite", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0xC3);
+ Mkrefany = new OpCode("mkrefany", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xC6);
+ Stloc_3 = new OpCode("stloc.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xD);
+ Ldloca = new OpCode("ldloca", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0xD);
+ Ldtoken = new OpCode("ldtoken", 1, OpCodeType.Primitive, OperandType.InlineTok, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD0);
+ Conv_U2 = new OpCode("conv.u2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD1);
+ Conv_U1 = new OpCode("conv.u1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD2);
+ Conv_I = new OpCode("conv.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD3);
+ Conv_Ovf_I = new OpCode("conv.ovf.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD4);
+ Conv_Ovf_U = new OpCode("conv.ovf.u", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD5);
+ Add_Ovf = new OpCode("add.ovf", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD6);
+ Add_Ovf_Un = new OpCode("add.ovf.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD7);
+ Mul_Ovf = new OpCode("mul.ovf", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD8);
+ Mul_Ovf_Un = new OpCode("mul.ovf.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD9);
+ Sub_Ovf = new OpCode("sub.ovf", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xDA);
+ Sub_Ovf_Un = new OpCode("sub.ovf.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xDB);
+ Endfinally = new OpCode("endfinally", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Return, 0xFF, 0xDC);
+ Leave = new OpCode("leave", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0xDD);
+ Leave_S = new OpCode("leave.s", 1, OpCodeType.Primitive, OperandType.ShortInlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0xDE);
+ Stind_I = new OpCode("stind.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xDF);
+ Ldarg_S = new OpCode("ldarg.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xE);
+ Stloc = new OpCode("stloc", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0xE);
+ Conv_U = new OpCode("conv.u", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xE0);
+ Ldarga_S = new OpCode("ldarga.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xF);
+ Localloc = new OpCode("localloc", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0xF);
+ Prefix7 = new OpCode("prefix7", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xF8);
+ Prefix6 = new OpCode("prefix6", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xF9);
+ Prefix5 = new OpCode("prefix5", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFA);
+ Prefix4 = new OpCode("prefix4", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFB);
+ Prefix3 = new OpCode("prefix3", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFC);
+ Prefix2 = new OpCode("prefix2", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFD);
+ Prefix1 = new OpCode("prefix1", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFE);
+ Prefixref = new OpCode("prefixref", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFF);
+
+
+ }
+
+ public static bool TakesSingleByteArgument (OpCode inst)
+ {
+ OperandType t = inst.OperandType;
+
+ // check for short-inline instructions
+ return ( t == OperandType.ShortInlineBrTarget
+ || t == OperandType.ShortInlineI
+ || t == OperandType.ShortInlineR
+ || t == OperandType.ShortInlineVar
+ );
+ }
+ }
+
+
+
+
+
+
+} // namespace System.Reflection.Emit
diff --git a/mcs/class/corlib/System.Reflection.Emit/OperandType.cs b/mcs/class/corlib/System.Reflection.Emit/OperandType.cs
new file mode 100644
index 00000000000..669ca53277e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OperandType.cs
@@ -0,0 +1,87 @@
+// OperandType.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes the operand types of MSIL instructions.
+ /// </summary>
+ public enum OperandType {
+
+ /// <summary>
+ /// </summary>
+ InlineBrTarget = 0,
+
+ /// <summary>
+ /// </summary>
+ InlineField = 1,
+
+ /// <summary>
+ /// </summary>
+ InlineI = 2,
+
+ /// <summary>
+ /// </summary>
+ InlineI8 = 3,
+
+ /// <summary>
+ /// </summary>
+ InlineMethod = 4,
+
+ /// <summary>
+ /// </summary>
+ InlineNone = 5,
+
+ /// <summary>
+ /// </summary>
+ InlinePhi = 6,
+
+ /// <summary>
+ /// </summary>
+ InlineR = 7,
+
+ /// <summary>
+ /// </summary>
+ InlineSig = 9,
+
+ /// <summary>
+ /// </summary>
+ InlineString = 0x0A,
+
+ /// <summary>
+ /// </summary>
+ InlineSwitch = 0x0B,
+
+ /// <summary>
+ /// </summary>
+ InlineTok = 0x0C,
+
+ /// <summary>
+ /// </summary>
+ InlineType = 0x0D,
+
+ /// <summary>
+ /// </summary>
+ InlineVar = 0x0E,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineBrTarget = 0x0F,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineI = 0x10,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineR = 0x11,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineVar = 0x12
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs b/mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs
new file mode 100644
index 00000000000..0677897bc82
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs
@@ -0,0 +1,8 @@
+namespace System.Reflection.Emit {
+ public enum PEFileKinds {
+ Dll = 1,
+ ConsoleApplication = 2,
+ WindowApplication = 3
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PackingSize.cs b/mcs/class/corlib/System.Reflection.Emit/PackingSize.cs
new file mode 100644
index 00000000000..82c74276386
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PackingSize.cs
@@ -0,0 +1,41 @@
+// PackingSize.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Specifies the packing size (data alignment) of a type.
+ /// </summary>
+ public enum PackingSize {
+
+ /// <summary>
+ /// The packing size is unspecified.
+ /// </summary>
+ Unspecified = 0,
+
+ /// <summary>
+ /// </summary>
+ Size1 = 1,
+
+ /// <summary>
+ /// </summary>
+ Size2 = 2,
+
+ /// <summary>
+ /// </summary>
+ Size4 = 4,
+
+ /// <summary>
+ /// </summary>
+ Size8 = 8,
+
+ /// <summary>
+ /// </summary>
+ Size16 = 16
+ }
+
+}
+
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs
new file mode 100755
index 00000000000..02ba64986cd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs
@@ -0,0 +1,102 @@
+
+
+//
+// System.Reflection.Emit/ParameterBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public class ParameterBuilder {
+ private MethodBase methodb; /* MethodBuilder or ConstructorBuilder */
+ private string name;
+ private CustomAttributeBuilder[] cattrs;
+ private UnmanagedMarshal marshal_info;
+ private ParameterAttributes attrs;
+ private int position;
+ private int table_idx;
+
+ internal ParameterBuilder (MethodBase mb, int pos, ParameterAttributes attributes, string strParamName) {
+ name = strParamName;
+ position = pos;
+ attrs = attributes;
+ methodb = mb;
+ table_idx = mb.get_next_table_index (this, 0x08, true);
+ }
+
+ public virtual int Attributes {
+ get {return (int)attrs;}
+ }
+ public bool IsIn {
+ get {return ((int)attrs & (int)ParameterAttributes.In) != 0;}
+ }
+ public bool IsOut {
+ get {return ((int)attrs & (int)ParameterAttributes.Out) != 0;}
+ }
+ public bool IsOptional {
+ get {return ((int)attrs & (int)ParameterAttributes.Optional) != 0;}
+ }
+ public virtual string Name {
+ get {return name;}
+ }
+ public virtual int Position {
+ get {return position;}
+ }
+
+ public virtual ParameterToken GetToken() {
+ return new ParameterToken (0x08 | table_idx);
+ }
+
+ [MonoTODO]
+ public virtual void SetConstant( object defaultValue) {
+ /* FIXME */
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ if (attrname == "System.Runtime.InteropServices.InAttribute") {
+ attrs |= ParameterAttributes.In;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.OutAttribute") {
+ attrs |= ParameterAttributes.Out;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.OptionalAttribute") {
+ attrs |= ParameterAttributes.Optional;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.MarshalAsAttribute") {
+ marshal_info = CustomAttributeBuilder.get_umarshal (customBuilder, true);
+ /* FIXME: check for errors */
+ return;
+ }
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public virtual void SetMarshal( UnmanagedMarshal unmanagedMarshal) {
+ marshal_info = unmanagedMarshal;
+ attrs |= ParameterAttributes.HasFieldMarshal;
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs b/mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs
new file mode 100644
index 00000000000..21d1895747d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs
@@ -0,0 +1,70 @@
+// ParameterToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Parameter.
+ /// </summary>
+ [Serializable]
+ public struct ParameterToken {
+
+ internal int tokValue;
+
+ public static readonly ParameterToken Empty;
+
+
+ static ParameterToken ()
+ {
+ Empty = new ParameterToken ();
+ }
+
+
+ internal ParameterToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is ParameterToken;
+
+ if (res) {
+ ParameterToken that = (ParameterToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// ParameterToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Parameter.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
new file mode 100755
index 00000000000..d006a4ac142
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
@@ -0,0 +1,124 @@
+
+//
+// System.Reflection.Emit/PropertyBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public sealed class PropertyBuilder : PropertyInfo {
+ private PropertyAttributes attrs;
+ private string name;
+ private Type type;
+ private Type[] parameters;
+ private CustomAttributeBuilder[] cattrs;
+ private object def_value;
+ private MethodBuilder set_method;
+ private MethodBuilder get_method;
+ private int table_idx = 0;
+ internal TypeBuilder typeb;
+
+ internal PropertyBuilder (TypeBuilder tb, string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes) {
+ this.name = name;
+ this.attrs = attributes;
+ this.type = returnType;
+ if (parameterTypes != null) {
+ this.parameters = new Type [parameterTypes.Length];
+ System.Array.Copy (parameterTypes, this.parameters, this.parameters.Length);
+ }
+ typeb = tb;
+ table_idx = tb.get_next_table_index (this, 0x17, true);
+ }
+
+ public override PropertyAttributes Attributes {
+ get {return attrs;}
+ }
+ public override bool CanRead {
+ get {return get_method != null;}
+ }
+ public override bool CanWrite {
+ get {return set_method != null;}
+ }
+ public override Type DeclaringType {
+ get {return typeb;}
+ }
+ public override string Name {
+ get {return name;}
+ }
+ public PropertyToken PropertyToken {
+ get {return new PropertyToken ();}
+ }
+ public override Type PropertyType {
+ get {return type;}
+ }
+ public override Type ReflectedType {
+ get {return typeb;}
+ }
+ public void AddOtherMethod( MethodBuilder mdBuilder) {
+ }
+ public override MethodInfo[] GetAccessors( bool nonPublic) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+ public override MethodInfo GetGetMethod( bool nonPublic) {
+ return get_method;
+ }
+ public override ParameterInfo[] GetIndexParameters() {
+ return null;
+ }
+ public override MethodInfo GetSetMethod( bool nonPublic) {
+ return set_method;
+ }
+ public override object GetValue(object obj, object[] index) {
+ return null;
+ }
+ public override object GetValue( object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+ return null;
+ }
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ public void SetConstant( object defaultValue) {
+ def_value = defaultValue;
+ }
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetGetMethod( MethodBuilder mdBuilder) {
+ get_method = mdBuilder;
+ }
+ public void SetSetMethod( MethodBuilder mdBuilder) {
+ set_method = mdBuilder;
+ }
+ public override void SetValue( object obj, object value, object[] index) {
+ }
+ public override void SetValue( object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs b/mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs
new file mode 100644
index 00000000000..38216a23996
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs
@@ -0,0 +1,70 @@
+// PropertyToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Property.
+ /// </summary>
+ [Serializable]
+ public struct PropertyToken {
+
+ internal int tokValue;
+
+ public static readonly PropertyToken Empty;
+
+
+ static PropertyToken ()
+ {
+ Empty = new PropertyToken ();
+ }
+
+
+ internal PropertyToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is PropertyToken;
+
+ if (res) {
+ PropertyToken that = (PropertyToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// PropertyToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Property.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs b/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
new file mode 100755
index 00000000000..40e3b566a22
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
@@ -0,0 +1,121 @@
+
+//
+// System.Reflection.Emit/SignatureHelper.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ [Serializable]
+ public sealed class SignatureHelper {
+ internal enum SignatureHelperType {
+ HELPER_FIELD,
+ HELPER_LOCAL,
+ HELPER_METHOD,
+ HELPER_PROPERTY
+ }
+
+ private ModuleBuilder module;
+ private Type[] arguments;
+ private SignatureHelperType type;
+
+ internal SignatureHelper (ModuleBuilder module, SignatureHelperType type)
+ {
+ this.type = type;
+ this.module = module;
+ }
+
+ public static SignatureHelper GetFieldSigHelper (Module mod)
+ {
+ if (!(mod is ModuleBuilder))
+ throw new NotImplementedException ();
+
+ return new SignatureHelper ((ModuleBuilder) mod, SignatureHelperType.HELPER_FIELD);
+ }
+ public static SignatureHelper GetLocalVarSigHelper (Module mod)
+ {
+ if (!(mod is ModuleBuilder))
+ throw new NotImplementedException ();
+
+ return new SignatureHelper ((ModuleBuilder) mod, SignatureHelperType.HELPER_LOCAL);
+ }
+ [MonoTODO]
+ public static SignatureHelper GetMethodSigHelper( Module mod, CallingConventions callingConvention, Type returnType)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static SignatureHelper GetMethodSigHelper( Module mod, Type returnType, Type[] parameterTypes)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static SignatureHelper GetPropertySigHelper( Module mod, Type returnType, Type[] parameterTypes)
+ {
+ throw new NotImplementedException ();
+ }
+ public void AddArgument (Type clsArgument)
+ {
+ if (arguments != null) {
+ Type[] new_a = new Type [arguments.Length + 1];
+ System.Array.Copy (arguments, new_a, arguments.Length);
+ new_a [arguments.Length] = clsArgument;
+ arguments = new_a;
+ } else {
+ arguments = new Type [1];
+ arguments [0] = clsArgument;
+ }
+ }
+ [MonoTODO]
+ public void AddSentinel ()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern byte[] get_signature_local ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern byte[] get_signature_field ();
+
+ public byte[] GetSignature ()
+ {
+ switch (type) {
+ case SignatureHelperType.HELPER_LOCAL:
+ return get_signature_local ();
+ case SignatureHelperType.HELPER_FIELD:
+ return get_signature_field ();
+ default:
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override string ToString() {
+ return "SignatureHelper";
+ }
+
+
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs b/mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs
new file mode 100644
index 00000000000..b8e7aa67bb5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs
@@ -0,0 +1,70 @@
+// SignatureToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Signature.
+ /// </summary>
+ [Serializable]
+ public struct SignatureToken {
+
+ internal int tokValue;
+
+ public static readonly SignatureToken Empty;
+
+
+ static SignatureToken ()
+ {
+ Empty = new SignatureToken ();
+ }
+
+
+ internal SignatureToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is SignatureToken;
+
+ if (res) {
+ SignatureToken that = (SignatureToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// SignatureToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Signature.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs b/mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs
new file mode 100644
index 00000000000..78cb915e7a6
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs
@@ -0,0 +1,126 @@
+// StackBehaviour.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes how values are pushed onto or popped off a stack.
+ /// </summary>
+ public enum StackBehaviour {
+
+ /// <summary>
+ /// </summary>
+ Pop0 = 0,
+
+ /// <summary>
+ /// </summary>
+ Pop1 = 1,
+
+ /// <summary>
+ /// </summary>
+ Pop1_pop1 = 2,
+
+ /// <summary>
+ /// </summary>
+ Popi = 3,
+
+ /// <summary>
+ /// </summary>
+ Popi_pop1 = 4,
+
+ /// <summary>
+ /// </summary>
+ Popi_popi = 5,
+
+ /// <summary>
+ /// </summary>
+ Popi_popi8 = 6,
+
+ /// <summary>
+ /// </summary>
+ Popi_popi_popi = 7,
+
+ /// <summary>
+ /// </summary>
+ Popi_popr4 = 8,
+
+ /// <summary>
+ /// </summary>
+ Popi_popr8 = 9,
+
+ /// <summary>
+ /// </summary>
+ Popref = 0x0A,
+
+ /// <summary>
+ /// </summary>
+ Popref_pop1 = 0x0B,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi = 0x0C,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popi = 0x0D,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popi8 = 0x0E,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popr4 = 0x0F,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popr8 = 0x10,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popref = 0x11,
+
+ /// <summary>
+ /// </summary>
+ Push0 = 0x12,
+
+ /// <summary>
+ /// </summary>
+ Push1 = 0x13,
+
+ /// <summary>
+ /// </summary>
+ Push1_push1 = 0x14,
+
+ /// <summary>
+ /// </summary>
+ Pushi = 0x15,
+
+ /// <summary>
+ /// </summary>
+ Pushi8 = 0x16,
+
+ /// <summary>
+ /// </summary>
+ Pushr4 = 0x17,
+
+ /// <summary>
+ /// </summary>
+ Pushr8 = 0x18,
+
+ /// <summary>
+ /// </summary>
+ Pushref = 0x19,
+
+ /// <summary>
+ /// </summary>
+ Varpop = 0x1A,
+
+ /// <summary>
+ /// </summary>
+ Varpush = 0x1B
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/StringToken.cs b/mcs/class/corlib/System.Reflection.Emit/StringToken.cs
new file mode 100644
index 00000000000..a872b8967bd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/StringToken.cs
@@ -0,0 +1,70 @@
+// StringToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a String.
+ /// </summary>
+ [Serializable]
+ public struct StringToken {
+
+ internal int tokValue;
+
+ public static readonly StringToken Empty;
+
+
+ static StringToken ()
+ {
+ Empty = new StringToken ();
+ }
+
+
+ internal StringToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is StringToken;
+
+ if (res) {
+ StringToken that = (StringToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// StringToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this String.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
new file mode 100644
index 00000000000..75d231ee448
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
@@ -0,0 +1,748 @@
+//
+// System.Reflection.Emit/TypeBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Reflection.Emit {
+ public sealed class TypeBuilder : Type {
+ private string tname;
+ private string nspace;
+ private Type parent;
+ private Type nesting_type;
+ private Type[] interfaces;
+ private MethodBuilder[] methods;
+ private ConstructorBuilder[] ctors;
+ private PropertyBuilder[] properties;
+ private FieldBuilder[] fields;
+ private EventBuilder[] events;
+ private CustomAttributeBuilder[] cattrs;
+ internal TypeBuilder[] subtypes;
+ private TypeAttributes attrs;
+ private int table_idx;
+ private ModuleBuilder pmodule;
+ private int class_size;
+ private PackingSize packing_size;
+ private Type created;
+ string fullname;
+
+ public const int UnspecifiedTypeSize = 0;
+
+ protected override TypeAttributes GetAttributeFlagsImpl () {
+ return attrs;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void setup_internal_class (TypeBuilder tb);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void create_internal_class (TypeBuilder tb);
+
+ internal TypeBuilder (ModuleBuilder mb, TypeAttributes attr) {
+ this.parent = null;
+ this.attrs = attr;
+ this.class_size = -1;
+ fullname = this.tname = "<Module>";
+ this.nspace = "";
+ pmodule = mb;
+ setup_internal_class (this);
+ }
+
+ internal TypeBuilder (ModuleBuilder mb, string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packing_size, int type_size) {
+ int sep_index;
+ this.parent = parent;
+ this.attrs = attr;
+ this.class_size = type_size;
+ this.packing_size = packing_size;
+ sep_index = name.LastIndexOf('.');
+ if (sep_index != -1) {
+ this.tname = name.Substring (sep_index + 1);
+ this.nspace = name.Substring (0, sep_index);
+ } else {
+ this.tname = name;
+ this.nspace = "";
+ }
+ if (interfaces != null) {
+ this.interfaces = new Type[interfaces.Length];
+ System.Array.Copy (interfaces, this.interfaces, interfaces.Length);
+ }
+ pmodule = mb;
+ // skip .<Module> ?
+ table_idx = mb.get_next_table_index (this, 0x02, true);
+ setup_internal_class (this);
+ fullname = GetFullName ();
+ }
+
+ public override Assembly Assembly {
+ get {return pmodule.Assembly;}
+ }
+ public override string AssemblyQualifiedName {
+ get {
+ return fullname + ", " + Assembly.ToString();
+ }
+ }
+ public override Type BaseType {
+ get {
+ return parent;
+ }
+ }
+ public override Type DeclaringType {get {return nesting_type;}}
+ public override Type UnderlyingSystemType {
+ get {
+ if (fields != null) {
+ foreach (FieldBuilder f in fields) {
+ if ((f.Attributes & FieldAttributes.Static) == 0)
+ return f.FieldType;
+ }
+ }
+ throw new InvalidOperationException (String.Format ("typebuilder: {0}", this));
+ }
+ }
+
+ string GetFullName () {
+ if (nesting_type != null)
+ return String.Concat (nesting_type.FullName, "+", tname);
+ if ((nspace != null) && (nspace.Length > 0))
+ return String.Concat (nspace, ".", tname);
+ return tname;
+ }
+
+ public override string FullName {
+ get {
+ return fullname;
+ }
+ }
+
+ public override Guid GUID {
+ get {return Guid.Empty;}
+ }
+
+ public override Module Module {
+ get {return pmodule;}
+ }
+ public override string Name {
+ get {return tname;}
+ }
+ public override string Namespace {
+ get {return nspace;}
+ }
+ public PackingSize PackingSize {
+ get {return packing_size;}
+ }
+ public override Type ReflectedType {get {return nesting_type;}}
+ public override MemberTypes MemberType {
+ get {return MemberTypes.TypeInfo;}
+ }
+
+ [MonoTODO]
+ public void AddDeclarativeSecurity( SecurityAction action, PermissionSet pset) {
+ throw new NotImplementedException ();
+ }
+
+ public void AddInterfaceImplementation( Type interfaceType) {
+ if (interfaces != null) {
+ Type[] ifnew = new Type [interfaces.Length + 1];
+ interfaces.CopyTo (ifnew, 0);
+ ifnew [interfaces.Length] = interfaceType;
+ interfaces = ifnew;
+ } else {
+ interfaces = new Type [1];
+ interfaces [0] = interfaceType;
+ }
+ }
+
+ [MonoTODO]
+ protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ }
+
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+
+ [MonoTODO]
+ public TypeBuilder DefineNestedType (string name) {
+ // FIXME: LAMESPEC: what other attributes should we use here as default?
+ return DefineNestedType (name, TypeAttributes.Public, pmodule.assemblyb.corlib_object_type, null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr) {
+ return DefineNestedType (name, attr, pmodule.assemblyb.corlib_object_type, null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent) {
+ return DefineNestedType (name, attr, parent, null);
+ }
+
+ private TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packsize, int typesize) {
+ TypeBuilder res = new TypeBuilder (pmodule, name, attr, parent, interfaces, packsize, typesize);
+ res.nesting_type = this;
+ res.fullname = res.GetFullName ();
+ pmodule.RegisterTypeName (res, res.fullname);
+ if (subtypes != null) {
+ TypeBuilder[] new_types = new TypeBuilder [subtypes.Length + 1];
+ System.Array.Copy (subtypes, new_types, subtypes.Length);
+ new_types [subtypes.Length] = res;
+ subtypes = new_types;
+ } else {
+ subtypes = new TypeBuilder [1];
+ subtypes [0] = res;
+ }
+ return res;
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, Type[] interfaces) {
+ return DefineNestedType (name, attr, parent, interfaces, PackingSize.Unspecified, UnspecifiedTypeSize);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, int typesize) {
+ return DefineNestedType (name, attr, parent, null, PackingSize.Unspecified, typesize);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, PackingSize packsize) {
+ return DefineNestedType (name, attr, parent, null, packsize, UnspecifiedTypeSize);
+ }
+
+ public ConstructorBuilder DefineConstructor( MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes) {
+ ConstructorBuilder cb = new ConstructorBuilder (this, attributes, callingConvention, parameterTypes);
+ if (ctors != null) {
+ ConstructorBuilder[] new_ctors = new ConstructorBuilder [ctors.Length+1];
+ System.Array.Copy (ctors, new_ctors, ctors.Length);
+ new_ctors [ctors.Length] = cb;
+ ctors = new_ctors;
+ } else {
+ ctors = new ConstructorBuilder [1];
+ ctors [0] = cb;
+ }
+ return cb;
+ }
+
+ public ConstructorBuilder DefineDefaultConstructor( MethodAttributes attributes) {
+ return DefineConstructor (attributes, CallingConventions.Standard, null);
+ }
+
+ public MethodBuilder DefineMethod( string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes) {
+ return DefineMethod (name, attributes, CallingConventions.Standard, returnType, parameterTypes);
+ }
+
+ private void append_method (MethodBuilder mb) {
+ if (methods != null) {
+ MethodBuilder[] new_methods = new MethodBuilder [methods.Length+1];
+ System.Array.Copy (methods, new_methods, methods.Length);
+ new_methods [methods.Length] = mb;
+ methods = new_methods;
+ } else {
+ methods = new MethodBuilder [1];
+ methods [0] = mb;
+ }
+ }
+
+ public MethodBuilder DefineMethod( string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ MethodBuilder res = new MethodBuilder (this, name, attributes, callingConvention, returnType, parameterTypes);
+ append_method (res);
+ return res;
+ }
+
+ public MethodBuilder DefinePInvokeMethod (string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) {
+ MethodBuilder res = new MethodBuilder (this, name, attributes, callingConvention, returnType, parameterTypes,
+ dllName, entryName, nativeCallConv, nativeCharSet);
+ append_method (res);
+ return res;
+ }
+
+ public MethodBuilder DefinePInvokeMethod (string name, string dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) {
+ return DefinePInvokeMethod (name, dllName, name, attributes, callingConvention, returnType, parameterTypes,
+ nativeCallConv, nativeCharSet);
+ }
+
+ public void DefineMethodOverride( MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration) {
+ if (methodInfoBody is MethodBuilder) {
+ MethodBuilder mb = (MethodBuilder)methodInfoBody;
+ mb.set_override (methodInfoDeclaration);
+ }
+ }
+
+ public FieldBuilder DefineField( string fieldName, Type type, FieldAttributes attributes) {
+ FieldBuilder res = new FieldBuilder (this, fieldName, type, attributes);
+ if (fields != null) {
+ FieldBuilder[] new_fields = new FieldBuilder [fields.Length+1];
+ System.Array.Copy (fields, new_fields, fields.Length);
+ new_fields [fields.Length] = res;
+ fields = new_fields;
+ } else {
+ fields = new FieldBuilder [1];
+ fields [0] = res;
+ create_internal_class (this);
+ }
+ return res;
+ }
+
+ public PropertyBuilder DefineProperty( string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes) {
+ PropertyBuilder res = new PropertyBuilder (this, name, attributes, returnType, parameterTypes);
+
+ if (properties != null) {
+ PropertyBuilder[] new_properties = new PropertyBuilder [properties.Length+1];
+ System.Array.Copy (properties, new_properties, properties.Length);
+ new_properties [properties.Length] = res;
+ properties = new_properties;
+ } else {
+ properties = new PropertyBuilder [1];
+ properties [0] = res;
+ }
+ return res;
+ }
+
+ [MonoTODO]
+ public ConstructorBuilder DefineTypeInitializer() {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern Type create_runtime_class (TypeBuilder tb);
+
+ public Type CreateType() {
+ /* handle nesting_type */
+ if (created != null) {
+ string err="type already created: " + created.ToString();
+ throw new InvalidOperationException (err);
+ }
+ if (methods != null) {
+ foreach (MethodBuilder method in methods) {
+ method.fixup ();
+ }
+ }
+ if (ctors != null) {
+ foreach (ConstructorBuilder ctor in ctors) {
+ ctor.fixup ();
+ }
+ }
+ created = create_runtime_class (this);
+ if (created != null)
+ return created;
+ return this;
+ }
+
+ public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr) {
+ if (ctors == null)
+ return new ConstructorInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ MethodAttributes mattrs;
+
+ foreach (ConstructorBuilder c in ctors) {
+ match = false;
+ mattrs = c.Attributes;
+ if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & MethodAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ ConstructorInfo[] result = new ConstructorInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ public override Type GetElementType () { return null; }
+
+ [MonoTODO]
+ public override EventInfo GetEvent (string name, BindingFlags bindingAttr) {
+ throw new NotImplementedException ();
+ }
+
+ public override EventInfo[] GetEvents (BindingFlags bindingAttr) {
+ return new EventInfo [0];
+ }
+
+ [MonoTODO]
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ //FIXME
+ throw new NotImplementedException ();
+ }
+
+ public override FieldInfo[] GetFields (BindingFlags bindingAttr) {
+ if (fields == null)
+ return new FieldInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ FieldAttributes mattrs;
+
+ foreach (FieldInfo c in fields) {
+ match = false;
+ mattrs = c.Attributes;
+ if ((mattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & FieldAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ FieldInfo[] result = new FieldInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ public override Type GetInterface (string name, bool ignoreCase) {
+ throw new NotImplementedException ();
+ }
+
+ public override Type[] GetInterfaces () {
+ if (interfaces != null) {
+ Type[] ret = new Type [interfaces.Length];
+ interfaces.CopyTo (ret, 0);
+ return ret;
+ } else {
+ return Type.EmptyTypes;
+ }
+ }
+
+ [MonoTODO]
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ public override MethodInfo[] GetMethods (BindingFlags bindingAttr) {
+ if (methods == null)
+ return new MethodInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ MethodAttributes mattrs;
+
+ foreach (MethodInfo c in methods) {
+ match = false;
+ mattrs = c.Attributes;
+ if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & MethodAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ MethodInfo[] result = new MethodInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ public override Type[] GetNestedTypes (BindingFlags bindingAttr) {
+ bool match;
+ ArrayList result = new ArrayList ();
+
+ if (subtypes == null)
+ return Type.EmptyTypes;
+ foreach (TypeBuilder t in subtypes) {
+ match = false;
+ if ((t.attrs & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ result.Add (t);
+ }
+ Type[] r = new Type [result.Count];
+ result.CopyTo (r);
+ return r;
+ }
+
+ public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+ if (properties == null)
+ return new PropertyInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ MethodAttributes mattrs;
+ MethodInfo accessor;
+
+ foreach (PropertyInfo c in properties) {
+ match = false;
+ accessor = c.GetGetMethod (true);
+ if (accessor == null)
+ accessor = c.GetSetMethod (true);
+ if (accessor == null)
+ continue;
+ mattrs = accessor.Attributes;
+ if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & MethodAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ PropertyInfo[] result = new PropertyInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ protected override bool HasElementTypeImpl () {
+ return IsArrayImpl() || IsByRefImpl() || IsPointerImpl ();
+ }
+
+ [MonoTODO]
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ protected override bool IsArrayImpl () {
+ return type_is_subtype_of (this, typeof (System.Array), false);
+ }
+ protected override bool IsByRefImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsCOMObjectImpl () {
+ return false;
+ }
+ protected override bool IsPointerImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsPrimitiveImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsValueTypeImpl () {
+ return ((type_is_subtype_of (this, pmodule.assemblyb.corlib_value_type, false) || type_is_subtype_of (this, typeof(System.ValueType), false)) &&
+ this != pmodule.assemblyb.corlib_value_type &&
+ this != pmodule.assemblyb.corlib_enum_type);
+ }
+
+ public override RuntimeTypeHandle TypeHandle { get { return _impl; } }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ if (attrname == "System.Runtime.InteropServices.StructLayoutAttribute") {
+ byte[] data = customBuilder.Data;
+ int layout_kind; /* the (stupid) ctor takes a short or an int ... */
+ layout_kind = (int)data [2];
+ layout_kind |= ((int)data [3]) << 8;
+ attrs &= ~TypeAttributes.LayoutMask;
+ switch ((LayoutKind)layout_kind) {
+ case LayoutKind.Auto:
+ attrs |= TypeAttributes.AutoLayout;
+ break;
+ case LayoutKind.Explicit:
+ attrs |= TypeAttributes.ExplicitLayout;
+ break;
+ case LayoutKind.Sequential:
+ attrs |= TypeAttributes.SequentialLayout;
+ break;
+ default:
+ // we should ignore it since it can be any value anyway...
+ throw new Exception ("Error in customattr");
+ }
+ string first_type_name = customBuilder.Ctor.GetParameters()[0].ParameterType.FullName;
+ int pos = 6;
+ if (first_type_name == "System.Int16")
+ pos = 4;
+ int nnamed = (int)data [pos++];
+ nnamed |= ((int)data [pos++]) << 8;
+ for (int i = 0; i < nnamed; ++i) {
+ byte named_type = data [pos++];
+ byte type = data [pos++];
+ int len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+ string named_name = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+ pos += len;
+ /* all the fields are integers in StructLayout */
+ int value = (int)data [pos++];
+ value |= ((int)data [pos++]) << 8;
+ value |= ((int)data [pos++]) << 16;
+ value |= ((int)data [pos++]) << 24;
+ switch (named_name) {
+ case "CharSet":
+ switch ((CharSet)value) {
+ case CharSet.None:
+ case CharSet.Ansi:
+ break;
+ case CharSet.Unicode:
+ attrs |= TypeAttributes.UnicodeClass;
+ break;
+ case CharSet.Auto:
+ attrs |= TypeAttributes.AutoClass;
+ break;
+ default:
+ break; // error out...
+ }
+ break;
+ case "Pack":
+ packing_size = (PackingSize)value;
+ break;
+ case "Size":
+ class_size = value;
+ break;
+ default:
+ break; // error out...
+ }
+ }
+ return;
+ } else if (attrname == "System.SerializableAttribute") {
+ attrs |= TypeAttributes.Serializable;
+ return;
+ }
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public EventBuilder DefineEvent( string name, EventAttributes attributes, Type eventtype) {
+ EventBuilder res = new EventBuilder (this, name, attributes, eventtype);
+ if (events != null) {
+ EventBuilder[] new_events = new EventBuilder [events.Length+1];
+ System.Array.Copy (events, new_events, events.Length);
+ new_events [events.Length] = res;
+ events = new_events;
+ } else {
+ events = new EventBuilder [1];
+ events [0] = res;
+ }
+ return res;
+ }
+
+ static int InitializedDataCount = 0;
+
+ public FieldBuilder DefineInitializedData( string name, byte[] data, FieldAttributes attributes) {
+ TypeBuilder datablobtype = DefineNestedType ("$ArrayType$"+InitializedDataCount.ToString(),
+ TypeAttributes.NestedPrivate|TypeAttributes.ExplicitLayout|TypeAttributes.Sealed,
+ pmodule.assemblyb.corlib_value_type, null, PackingSize.Size1, data.Length);
+ datablobtype.packing_size = PackingSize.Size1;
+ datablobtype.class_size = data.Length;
+ datablobtype.CreateType ();
+ FieldBuilder res = DefineField (name, datablobtype, attributes|FieldAttributes.Assembly|FieldAttributes.Static|FieldAttributes.HasFieldRVA);
+ res.SetRVAData (data);
+ InitializedDataCount++;
+ return res;
+ }
+
+ [MonoTODO]
+ public FieldBuilder DefineUninitializedData( string name, int size, FieldAttributes attributes) {
+ throw new NotImplementedException ();
+ }
+
+ public TypeToken TypeToken {
+ get {
+ return new TypeToken (0x02000000 | table_idx);
+ }
+ }
+ public void SetParent (Type parentType) {
+ parent = parentType;
+ }
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ return pmodule.get_next_table_index (obj, table, inc);
+ }
+
+ public override InterfaceMapping GetInterfaceMap (Type interfaceType)
+ {
+ if (created == null)
+ throw new NotSupportedException ("This method is not implemented for incomplete types.");
+
+ return created.GetInterfaceMap (interfaceType);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeToken.cs b/mcs/class/corlib/System.Reflection.Emit/TypeToken.cs
new file mode 100644
index 00000000000..8fd6ae493b3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeToken.cs
@@ -0,0 +1,70 @@
+// TypeToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Type.
+ /// </summary>
+ [Serializable]
+ public struct TypeToken {
+
+ internal int tokValue;
+
+ public static readonly TypeToken Empty;
+
+
+ static TypeToken ()
+ {
+ Empty = new TypeToken ();
+ }
+
+
+ internal TypeToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is TypeToken;
+
+ if (res) {
+ TypeToken that = (TypeToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// TypeToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Type.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs b/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
new file mode 100755
index 00000000000..1c0d8bf5280
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
@@ -0,0 +1,75 @@
+
+//
+// System.Reflection.Emit/UnmanagedMarshal.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001-2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System;
+
+namespace System.Reflection.Emit {
+
+ [Serializable]
+ public sealed class UnmanagedMarshal {
+ private int count;
+ private UnmanagedType t;
+ private UnmanagedType tbase;
+
+ private UnmanagedMarshal (UnmanagedType maint, int cnt) {
+ count = cnt;
+ t = maint;
+ tbase = maint;
+ }
+ private UnmanagedMarshal (UnmanagedType maint, UnmanagedType elemt) {
+ count = 0;
+ t = maint;
+ tbase = elemt;
+ }
+
+ public UnmanagedType BaseType {
+ get {
+ if (t == UnmanagedType.LPArray || t == UnmanagedType.SafeArray)
+ throw new ArgumentException ();
+ return tbase;
+ }
+ }
+
+ public int ElementCount {
+ get {return count;}
+ }
+
+ public UnmanagedType GetUnmanagedType {
+ get {return t;}
+ }
+
+ public Guid IIDGuid {
+ get {return Guid.Empty;}
+ }
+
+ public static UnmanagedMarshal DefineByValArray( int elemCount) {
+ return new UnmanagedMarshal (UnmanagedType.ByValArray, elemCount);
+ }
+
+ public static UnmanagedMarshal DefineByValTStr( int elemCount) {
+ return new UnmanagedMarshal (UnmanagedType.ByValTStr, elemCount);
+ }
+
+ public static UnmanagedMarshal DefineLPArray( UnmanagedType elemType) {
+ return new UnmanagedMarshal (UnmanagedType.LPArray, elemType);
+ }
+
+ public static UnmanagedMarshal DefineSafeArray( UnmanagedType elemType) {
+ return new UnmanagedMarshal (UnmanagedType.SafeArray, elemType);
+ }
+
+ public static UnmanagedMarshal DefineUnmanagedMarshal( UnmanagedType unmanagedType) {
+ return new UnmanagedMarshal (unmanagedType, unmanagedType);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AmbiguousMatchException.cs b/mcs/class/corlib/System.Reflection/AmbiguousMatchException.cs
new file mode 100755
index 00000000000..3bfc25fccd2
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AmbiguousMatchException.cs
@@ -0,0 +1,32 @@
+//
+// System.Reflection.AmbiguousMatchException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public sealed class AmbiguousMatchException : SystemException {
+ // Constructors
+ public AmbiguousMatchException ()
+ : base ("Ambiguous matching in method resolution")
+ {
+ }
+
+ public AmbiguousMatchException (string message)
+ : base (message)
+ {
+ }
+
+ public AmbiguousMatchException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/Assembly.cs b/mcs/class/corlib/System.Reflection/Assembly.cs
new file mode 100644
index 00000000000..27d4e78586d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Assembly.cs
@@ -0,0 +1,343 @@
+//
+// System.Reflection/Assembly.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Policy;
+using System.Runtime.Serialization;
+using System.Reflection.Emit;
+using System.IO;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public class Assembly : System.Reflection.ICustomAttributeProvider,
+ System.Security.IEvidenceFactory, System.Runtime.Serialization.ISerializable {
+ private IntPtr _mono_assembly;
+
+ internal Assembly () {}
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern string get_code_base ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern string get_location ();
+
+ public virtual string CodeBase {
+ get {
+ return get_code_base ();
+ }
+ }
+
+ internal virtual string CopiedCodeBase {
+ get {
+ return get_code_base ();
+ }
+ }
+
+ public virtual string FullName {
+ get {
+ //
+ // FIXME: This is wrong, but it gets us going
+ // in the compiler for now
+ //
+ return GetName (false).ToString ();
+ }
+ }
+
+ public virtual extern MethodInfo EntryPoint {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public virtual Evidence Evidence {
+ get {
+ return null;
+ }
+ }
+
+ public virtual String Location {
+ get {
+ return get_location ();
+ }
+ }
+
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ UnitySerializationHolder.GetAssemblyData (this, info, context);
+ }
+
+ public virtual bool IsDefined (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public virtual object [] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern object GetFilesInternal (String name);
+
+ public virtual FileStream[] GetFiles ()
+ {
+ string[] names = (string[])GetFilesInternal (null);
+ FileStream[] res = new FileStream [names.Length];
+ for (int i = 0; i < names.Length; ++i)
+ res [i] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
+ return res;
+ }
+
+ public virtual FileStream GetFile (String name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ string filename = (string)GetFilesInternal (name);
+ if (filename != null)
+ return new FileStream (filename, FileMode.Open, FileAccess.Read);
+ else
+ return null;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern object GetManifestResourceInternal (String name);
+
+ public virtual Stream GetManifestResourceStream (String name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ object data = GetManifestResourceInternal (name);
+ string filename = data as string;
+ if (data == null)
+ return null;
+ if (filename != null) {
+ return new FileStream (filename, FileMode.Open, FileAccess.Read);
+ } else {
+ return new MemoryStream ((byte[])data, false);
+ }
+ }
+
+ public virtual Stream GetManifestResourceStream (Type type, String name)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+ string ns = type.Namespace;
+ if (ns == null)
+ return GetManifestResourceStream (name);
+ else
+ return GetManifestResourceStream (ns + "." + name);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern Type[] GetTypes (bool exportedOnly);
+
+ public virtual Type[] GetTypes ()
+ {
+ return GetTypes (false);
+ }
+
+ public virtual Type[] GetExportedTypes ()
+ {
+ return GetTypes (true);
+ }
+
+ public virtual Type GetType (String name, Boolean throwOnError)
+ {
+ return GetType (name, throwOnError, false);
+ }
+
+ public virtual Type GetType (String name) {
+ return GetType (name, false, false);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern Type InternalGetType (String name, Boolean throwOnError, Boolean ignoreCase);
+
+ public Type GetType (string name, bool throwOnError, bool ignoreCase)
+ {
+ if (name == null)
+ throw new ArgumentNullException (name);
+
+ return InternalGetType (name, throwOnError, ignoreCase);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ static extern void FillName (Assembly ass, AssemblyName aname);
+
+ public virtual AssemblyName GetName (Boolean copiedName)
+ {
+ AssemblyName aname = new AssemblyName ();
+ FillName (this, aname);
+ return aname;
+ }
+
+ public virtual AssemblyName GetName ()
+ {
+ return GetName (false);
+ }
+
+ public override String ToString ()
+ {
+ return GetName ().Name;
+ }
+
+ [MonoTODO]
+ public static String CreateQualifiedName (String assemblyName, String typeName)
+ {
+ return typeName + "," + assemblyName;
+ }
+
+ public static Assembly GetAssembly (Type type)
+ {
+ if (type != null)
+ return type.Assembly;
+ throw new ArgumentNullException ("type");
+ }
+
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public static extern Assembly GetEntryAssembly();
+
+ [MonoTODO]
+ public Assembly GetSatelliteAssembly (CultureInfo culture)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static Assembly LoadFrom (String assemblyFile);
+
+ public static Assembly Load (String assemblyString)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyString);
+ }
+
+ public static Assembly Load (String assemblyString, Evidence assemblySecurity)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
+ }
+
+ public static Assembly Load (AssemblyName assemblyRef)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyRef);
+ }
+
+ public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
+ }
+
+ public static Assembly Load (Byte[] rawAssembly)
+ {
+ return AppDomain.CurrentDomain.Load (rawAssembly);
+ }
+
+ public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
+ {
+ return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
+ }
+
+ public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
+ Evidence securityEvidence)
+ {
+ return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
+ }
+
+ public static Assembly LoadWithPartialName (string partialName)
+ {
+ return LoadWithPartialName (partialName, null);
+ }
+
+ [MonoTODO]
+ public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
+ {
+ return AppDomain.CurrentDomain.Load (partialName, securityEvidence);
+ }
+
+
+ public Object CreateInstance (String typeName)
+ {
+ return CreateInstance (typeName, false);
+ }
+
+ public Object CreateInstance (String typeName, Boolean ignoreCase)
+ {
+ Type t = GetType (typeName, true, ignoreCase);
+ return Activator.CreateInstance (t);
+ }
+
+ public Object CreateInstance (String typeName, Boolean ignoreCase,
+ BindingFlags bindingAttr, Binder binder,
+ Object[] args, CultureInfo culture,
+ Object[] activationAttributes)
+ {
+ Type t = GetType (typeName, true, ignoreCase);
+ return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
+ }
+
+ public Module[] GetLoadedModules ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Module[] GetModules ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Module GetModule (String name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern virtual String[] GetManifestResourceNames ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static Assembly GetExecutingAssembly ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static Assembly GetCallingAssembly ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern AssemblyName[] GetReferencedAssemblies ();
+
+ public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ //
+ // The following functions are only for the Mono Debugger.
+ //
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern MethodBase MonoDebugger_GetMethod (int token);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern Type MonoDebugger_GetLocalTypeFromSignature (byte[] signature);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern Type MonoDebugger_GetType (int token);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs
new file mode 100644
index 00000000000..39bd0c369a4
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection.AssemblyAlgorithmIdAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Configuration.Assemblies;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyAlgorithmIdAttribute : Attribute
+ {
+ // Field
+ private uint id;
+
+ // Constructor
+ public AssemblyAlgorithmIdAttribute (AssemblyHashAlgorithm algorithmId)
+ {
+ id = (uint) algorithmId;
+ }
+
+ [CLSCompliant (false)]
+ public AssemblyAlgorithmIdAttribute (uint algorithmId)
+ {
+ id = algorithmId;
+ }
+
+ // Property
+ [CLSCompliant (false)]
+ public uint AlgorithmId
+ {
+ get { return id; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs
new file mode 100644
index 00000000000..b6dc24687a9
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyCompanyAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyCompanyAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyCompanyAttribute (string company)
+ {
+ name = company;
+ }
+
+ // Properties
+ public string Company
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs
new file mode 100644
index 00000000000..8e48b485d2d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyConfigurationAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyConfigurationAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyConfigurationAttribute (string configuration)
+ {
+ name = configuration;
+ }
+
+ // Properties
+ public string Configuration
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs
new file mode 100644
index 00000000000..264a905f0ef
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyCopyrightAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyCopyrightAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyCopyrightAttribute (string copyright)
+ {
+ name = copyright;
+ }
+
+ // Properties
+ public string Copyright
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs
new file mode 100644
index 00000000000..16ce1f96cc4
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyCultureAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyCultureAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyCultureAttribute (string culture)
+ {
+ name = culture;
+ }
+
+ // Properties
+ public string Culture
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs
new file mode 100644
index 00000000000..f91c9314917
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyDefaultAliasAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyDefaultAliasAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyDefaultAliasAttribute (string defaultAlias)
+ {
+ name = defaultAlias;
+ }
+
+ // Properties
+ public string DefaultAlias
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs
new file mode 100644
index 00000000000..cec22e69659
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Reflection.AssemblyDelaySignAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyDelaySignAttribute : Attribute
+ {
+ // Field
+ private bool delay;
+
+ // Constructor
+ public AssemblyDelaySignAttribute (bool delaySign)
+ {
+ delay = delaySign;
+ }
+
+ // Property
+ public bool DelaySign
+ {
+ get { return delay; }
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs
new file mode 100644
index 00000000000..00beee47ec4
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs
@@ -0,0 +1,30 @@
+//
+// System.Reflection.AssemblyDescriptionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyDescriptionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyDescriptionAttribute (string description)
+ {
+ name = description;
+ }
+
+ // Property
+ public string Description
+ {
+ get { return name; }
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs
new file mode 100644
index 00000000000..c94407ff708
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyFileVersionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyFileVersionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyFileVersionAttribute (string version)
+ {
+ name = version;
+ }
+
+ // Property
+ public string Version
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs
new file mode 100644
index 00000000000..7a9589dde9f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyFlagsAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyFlagsAttribute : Attribute
+ {
+ // Field
+ private uint flags;
+
+ // Constructor
+ [CLSCompliant (false)]
+ public AssemblyFlagsAttribute (uint flags)
+ {
+ this.flags = flags;
+ }
+
+ // Property
+ [CLSCompliant (false)]
+ public uint Flags
+ {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs
new file mode 100644
index 00000000000..e3a5742f539
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyInformationalVersionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyInformationalVersionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyInformationalVersionAttribute (string informationalVersion)
+ {
+ name = informationalVersion;
+ }
+
+ // Property
+ public string InformationalVersion
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs
new file mode 100644
index 00000000000..0e92688493e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyKeyFileAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyKeyFileAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyKeyFileAttribute (string keyFile)
+ {
+ name = keyFile;
+ }
+
+ // Property
+ public string KeyFile
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs
new file mode 100644
index 00000000000..3323b14ed79
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyKeyNameAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyKeyNameAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyKeyNameAttribute (string keyName)
+ {
+ name = keyName;
+ }
+
+ // Property
+ public string KeyName
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyName.cs b/mcs/class/corlib/System.Reflection/AssemblyName.cs
new file mode 100755
index 00000000000..33c3424b346
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyName.cs
@@ -0,0 +1,216 @@
+//
+// System.Reflection/AssemblyName.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Configuration.Assemblies;
+using System.Globalization;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace System.Reflection {
+
+// References:
+// a. Uniform Resource Identifiers (URI): Generic Syntax
+// http://www.ietf.org/rfc/rfc2396.txt
+
+ [Serializable]
+ public sealed class AssemblyName : ICloneable, ISerializable, IDeserializationCallback {
+ string name;
+ string codebase;
+ int major, minor, build, revision;
+ CultureInfo cultureinfo;
+ AssemblyNameFlags flags;
+ AssemblyHashAlgorithm hashalg;
+ StrongNameKeyPair keypair;
+ byte[] publicKey;
+ byte[] keyToken;
+ AssemblyVersionCompatibility versioncompat;
+
+ public AssemblyName ()
+ {
+ // defaults
+ versioncompat = AssemblyVersionCompatibility.SameMachine;
+ }
+
+ internal AssemblyName (SerializationInfo si, StreamingContext sc)
+ {
+ name = si.GetString ("_Name");
+ codebase = si.GetString ("_CodeBase");
+ Version = (Version)si.GetValue ("_Version", typeof (Version));
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string CodeBase {
+ get { return codebase; }
+ set { codebase = value; }
+ }
+
+ [MonoTODO("RFC 2396")]
+ private string Escape (string url)
+ {
+ // we already have code in mcs\class\System\System\Uri.cs
+ // but Uri class ins't part of corlib !
+ // TODO
+ return url;
+ }
+
+ public string EscapedCodeBase {
+ get { return Escape (codebase); }
+ }
+
+ public CultureInfo CultureInfo {
+ get { return cultureinfo; }
+ set { cultureinfo = value; }
+ }
+
+ public AssemblyNameFlags Flags {
+ get { return flags; }
+ set { flags = value; }
+ }
+
+ [MonoTODO("incomplete")]
+ public string FullName {
+ get {
+ if (name == null)
+ return null;
+ StringBuilder fname = new StringBuilder ();
+ fname.Append (name);
+ fname.Append (", Version=");
+ fname.Append (Version.ToString ());
+ fname.Append (", Culture=");
+ if ((cultureinfo == null) || (cultureinfo.LCID == CultureInfo.InvariantCulture.LCID))
+ fname.Append ("neutral");
+ else
+ fname.Append (cultureinfo.ToString ()); // ???
+ if (keypair == null)
+ fname.Append (", PublicKeyToken=null");
+ // TODO
+ return fname.ToString ();
+ }
+ }
+
+ public AssemblyHashAlgorithm HashAlgorithm {
+ get { return hashalg; }
+ set { hashalg = value; }
+ }
+
+ public StrongNameKeyPair KeyPair {
+ get { return keypair; }
+ set { keypair = value; }
+ }
+
+ public Version Version {
+ get {
+ if (name == null)
+ return null;
+ return new Version (major, minor, build, revision);
+ }
+
+ set {
+ major = value.Major;
+ minor = value.Minor;
+ build = value.Build;
+ revision = value.Revision;
+ }
+ }
+
+ public AssemblyVersionCompatibility VersionCompatibility {
+ get { return versioncompat; }
+ set { versioncompat = value; }
+ }
+
+ public override string ToString ()
+ {
+ string name = FullName;
+ return (name != null) ? name : base.ToString ();
+ }
+
+ public byte[] GetPublicKey()
+ {
+ // to match MS implementation -- funny one
+ if (publicKey != null)
+ return publicKey;
+ else if (name == null)
+ return null;
+ else
+ return new byte [0];
+ }
+
+ public byte[] GetPublicKeyToken()
+ {
+ if (keyToken != null)
+ return keyToken;
+ else if (publicKey == null)
+ return null;
+ else {
+ HashAlgorithm ha = null;
+ switch (hashalg) {
+ case AssemblyHashAlgorithm.MD5:
+ ha = MD5.Create ();
+ break;
+ default:
+ // None default to SHA1
+ ha = SHA1.Create ();
+ break;
+ }
+ byte[] hash = ha.ComputeHash (publicKey);
+ // we need the last 8 bytes in reverse order
+ keyToken = new byte [8];
+ Array.Copy (hash, (hash.Length - 8), keyToken, 0, 8);
+ Array.Reverse (keyToken, 0, 8);
+ return keyToken;
+ }
+ }
+
+ public void SetPublicKey (byte[] publicKey)
+ {
+ flags = AssemblyNameFlags.PublicKey;
+ this.publicKey = publicKey;
+ }
+
+ public void SetPublicKeyToken (byte[] publicKeyToken)
+ {
+ keyToken = publicKeyToken;
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("_Name", name);
+ info.AddValue ("_CodeBase", codebase);
+ info.AddValue ("_Version", Version);
+ }
+
+ // required to implement ICloneable
+ [MonoTODO()]
+ public object Clone()
+ {
+ return null;
+ }
+
+ // required to implement IDeserializationCallback
+ [MonoTODO()]
+ public void OnDeserialization (object sender)
+ {
+ }
+
+ public static AssemblyName GetAssemblyName (string assemblyFile)
+ {
+ Assembly a = Assembly.LoadFrom (assemblyFile);
+ return a.GetName ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyNameFlags.cs b/mcs/class/corlib/System.Reflection/AssemblyNameFlags.cs
new file mode 100755
index 00000000000..daa3cd97148
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyNameFlags.cs
@@ -0,0 +1,33 @@
+// AssemblyNameFlags.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:33 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum AssemblyNameFlags {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// Not sure about the ECMA spec, but this is what is in mscorlib...
+ /// Perhaps this has changed since the beta.
+ /// </summary>
+ PublicKey = 1,
+ } // AssemblyNameFlags
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs b/mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs
new file mode 100644
index 00000000000..cc02533a741
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs
@@ -0,0 +1,27 @@
+//
+// System.Reflection.AssemblyNameProxy.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ public class AssemblyNameProxy : MarshalByRefObject
+ {
+ // Constructor
+ public AssemblyNameProxy ()
+ {
+ }
+
+ // Method
+ [MonoTODO]
+ public AssemblyName GetAssemblyName (string assemblyFile)
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs
new file mode 100644
index 00000000000..67c85f9421b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyProductAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyProductAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyProductAttribute (string product)
+ {
+ name = product;
+ }
+
+ // Property
+ public string Product
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs
new file mode 100644
index 00000000000..f3ac196a789
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyTitleAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyTitleAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyTitleAttribute (string title)
+ {
+ name = title;
+ }
+
+ // Property
+ public string Title
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs
new file mode 100644
index 00000000000..7c2bcc8e712
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyTrademarkAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyTrademarkAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyTrademarkAttribute (string trademark)
+ {
+ name = trademark;
+ }
+
+ // Property
+ public string Trademark
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs
new file mode 100644
index 00000000000..d5f46894698
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyVersionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyVersionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyVersionAttribute (string version)
+ {
+ name = version;
+ }
+
+ // Property
+ public string Version
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/Binder.cs b/mcs/class/corlib/System.Reflection/Binder.cs
new file mode 100644
index 00000000000..5660bd84491
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Binder.cs
@@ -0,0 +1,254 @@
+// System.Reflection.Binder
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. 2001 - 2002
+
+using System.Globalization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public abstract class Binder
+ {
+ protected Binder () {}
+
+ public abstract FieldInfo BindToField (BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);
+ public abstract MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state);
+ public abstract object ChangeType (object value, Type type, CultureInfo culture);
+ public abstract void ReorderArgumentArray( ref object[] args, object state);
+ public abstract MethodBase SelectMethod (BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
+ public abstract PropertyInfo SelectProperty( BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
+
+ static Binder default_binder;
+
+ internal static Binder DefaultBinder {
+ get {
+ lock (typeof (Binder)) {
+ if (default_binder == null)
+ default_binder = new Default ();
+ return default_binder;
+ }
+ }
+ }
+
+ internal static bool ConvertArgs (Binder binder, object[] args, ParameterInfo[] pinfo, CultureInfo culture) {
+ if (args == null) {
+ if ( pinfo.Length == 0)
+ return true;
+ else
+ throw new TargetParameterCountException ();
+ }
+ if (pinfo.Length != args.Length)
+ throw new TargetParameterCountException ();
+ for (int i = 0; i < args.Length; ++i) {
+ object v = binder.ChangeType (args [i], pinfo[i].ParameterType, culture);
+ if ((v == null) && (args [i] != null))
+ return false;
+ args [i] = v;
+ }
+ return true;
+ }
+
+ internal sealed class Default : Binder {
+ public override FieldInfo BindToField (BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture)
+ {
+ if (match == null)
+ throw new ArgumentNullException ("match");
+ foreach (FieldInfo f in match) {
+ if (check_type (value.GetType (), f.FieldType))
+ return f;
+ }
+ return null;
+ }
+
+ [MonoTODO]
+ public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state)
+ {
+ Type[] types;
+ if (args == null)
+ types = Type.EmptyTypes;
+ else {
+ types = new Type [args.Length];
+ for (int i = 0; i < args.Length; ++i) {
+ if (args [i] != null)
+ types [i] = args [i].GetType ();
+ }
+ }
+ MethodBase selected = SelectMethod (bindingAttr, match, types, modifiers);
+ state = null;
+ return selected;
+ }
+
+ public override object ChangeType (object value, Type type, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+ Type vtype = value.GetType ();
+ if (vtype == type || type.IsAssignableFrom (vtype))
+ return value;
+ if (check_type (vtype, type))
+ return Convert.ChangeType (value, type);
+ return null;
+ }
+
+ [MonoTODO]
+ public override void ReorderArgumentArray (ref object[] args, object state)
+ {
+ //do nothing until we support named arguments
+ //throw new NotImplementedException ();
+ }
+
+ private static bool check_type (Type from, Type to) {
+ if (from == to)
+ return true;
+ TypeCode fromt = Type.GetTypeCode (from);
+ TypeCode tot = Type.GetTypeCode (to);
+
+ switch (fromt) {
+ case TypeCode.Char:
+ switch (tot) {
+ case TypeCode.UInt16:
+ case TypeCode.UInt32:
+ case TypeCode.Int32:
+ case TypeCode.UInt64:
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.Byte:
+ switch (tot) {
+ case TypeCode.Char:
+ case TypeCode.UInt16:
+ case TypeCode.Int16:
+ case TypeCode.UInt32:
+ case TypeCode.Int32:
+ case TypeCode.UInt64:
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.SByte:
+ switch (tot) {
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.UInt16:
+ switch (tot) {
+ case TypeCode.UInt32:
+ case TypeCode.Int32:
+ case TypeCode.UInt64:
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.Int16:
+ switch (tot) {
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.UInt32:
+ switch (tot) {
+ case TypeCode.UInt64:
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.Int32:
+ switch (tot) {
+ case TypeCode.Int64:
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.UInt64:
+ case TypeCode.Int64:
+ switch (tot) {
+ case TypeCode.Single:
+ case TypeCode.Double:
+ return true;
+ }
+ return false;
+ case TypeCode.Single:
+ return tot == TypeCode.Double;
+ default:
+ /* TODO: handle valuetype -> byref */
+ return to.IsAssignableFrom (from);
+ }
+ }
+
+ private static bool check_arguments (Type[] types, ParameterInfo[] args) {
+ for (int i = 0; i < types.Length; ++i) {
+ if (!check_type (types [i], args [i].ParameterType))
+ return false;
+ }
+ return true;
+ }
+
+ public override MethodBase SelectMethod (BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
+ {
+ MethodBase m;
+ int i, j;
+ if (match == null)
+ throw new ArgumentNullException ("match");
+ /* first look for an exact match... */
+ for (i = 0; i < match.Length; ++i) {
+ m = match [i];
+ ParameterInfo[] args = m.GetParameters ();
+ if (args.Length != types.Length)
+ continue;
+ for (j = 0; j < types.Length; ++j) {
+ if (types [j] != args [j].ParameterType)
+ break;
+ }
+ if (j == types.Length)
+ return m;
+ }
+ for (i = 0; i < match.Length; ++i) {
+ m = match [i];
+ ParameterInfo[] args = m.GetParameters ();
+ if (args.Length != types.Length)
+ continue;
+ if (!check_arguments (types, args))
+ continue;
+ return m;
+ }
+ return null;
+ }
+
+ public override PropertyInfo SelectProperty (BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers)
+ {
+ if (match == null)
+ throw new ArgumentNullException ("match");
+ foreach (PropertyInfo m in match) {
+ ParameterInfo[] args = m.GetIndexParameters ();
+ if (args.Length != indexes.Length)
+ continue;
+ if (!check_arguments (indexes, args))
+ continue;
+ return m;
+ }
+ return null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/BindingFlags.cs b/mcs/class/corlib/System.Reflection/BindingFlags.cs
new file mode 100644
index 00000000000..6d02cfeb196
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/BindingFlags.cs
@@ -0,0 +1,92 @@
+// BindingFlags.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:54 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum BindingFlags {
+
+ Default = 0,
+
+ /// <summary>
+ /// </summary>
+ IgnoreCase = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ DeclaredOnly = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Instance = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Static = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ Public = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ NonPublic = 0x00000020,
+
+ FlattenHierarchy = 0x00000040,
+
+ /// <summary>
+ /// </summary>
+ InvokeMethod = 0x00000100,
+
+ /// <summary>
+ /// </summary>
+ CreateInstance = 0x00000200,
+
+ /// <summary>
+ /// </summary>
+ GetField = 0x00000400,
+
+ /// <summary>
+ /// </summary>
+ SetField = 0x00000800,
+
+ /// <summary>
+ /// </summary>
+ GetProperty = 0x00001000,
+
+ /// <summary>
+ /// </summary>
+ SetProperty = 0x00002000,
+
+ PutDispProperty = 0x00004000,
+
+ PutRefDispProperty = 0x00008000,
+
+ /// <summary>
+ /// </summary>
+ ExactBinding = 0x00010000,
+
+ /// <summary>
+ /// </summary>
+ SuppressChangeType = 0x00020000,
+
+ /// <summary>
+ /// </summary>
+ OptionalParamBinding = 0x00040000,
+
+ IgnoreReturn = 0x01000000
+ } // BindingFlags
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/CallingConventions.cs b/mcs/class/corlib/System.Reflection/CallingConventions.cs
new file mode 100755
index 00000000000..c42c2471c9d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/CallingConventions.cs
@@ -0,0 +1,42 @@
+// CallingConventions.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:43 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum CallingConventions {
+
+ /// <summary>
+ /// </summary>
+ Standard = 1,
+
+ /// <summary>
+ /// </summary>
+ VarArgs = 2,
+
+ /// <summary>
+ /// </summary>
+ Any = 3,
+
+ /// <summary>
+ /// </summary>
+ HasThis = 32,
+
+ /// <summary>
+ /// </summary>
+ ExplicitThis = 64,
+ } // CallingConventions
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/ChangeLog b/mcs/class/corlib/System.Reflection/ChangeLog
new file mode 100644
index 00000000000..ca9c4f93288
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ChangeLog
@@ -0,0 +1,439 @@
+2003-01-17 Zoltan Varga <vargaz@freemail.hu>
+
+ * ParameterInfo.cs: modified constructor so it allows the
+ ParameterBuilder to be null and add a 'position' argument which will
+ be used when pb is null.
+
+2003-01-16 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * Assembly.cs: added serialization support.
+
+Sat Jan 4 18:26:41 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: propagate exceptions from the internal invoke
+ code that need to be propagated.
+
+Sat Jan 4 18:04:07 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * Binder.cs: throw an exception if the number of arguments
+ when invoking a method is incorrect.
+
+Thu Jan 2 19:04:58 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * Binder.cs: In SelectMethod() look for an exact match first.
+
+2003-01-01 Rachel Hestilow <hestilow@ximian.com>
+
+ * MonoField.cs (SetValue): Fix logic typo. Check that obj is
+ non-null only for the non-static case.
+
+2002-12-30 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyName.cs: Fixed null cultureinfo in FullName (as reported by
+ Zoltan).
+
+2002-12-23 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyName.cs: GetPublicKey now return an empty array (not null)
+ when an assembly isn't signed with a StrongName (to match MS
+ implementation) and null when no assembly is referenced. Also removed
+ commented code (no bug reported so it was probably not used).
+
+Thu Dec 19 16:43:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs, ParameterInfo.cs: return a custom attribute
+ provider for the return type of a method.
+
+2002-12-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AssemblyName.cs: little fix in FullName.
+
+2002-12-07 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyName.cs: Added missing methods/interfaces. Fixed some
+ code to match the MS Framework.
+ * StrongNameKeyPair.cs: Completed the "visible" implementation.
+ There must be some internal methods to allow signing with the key.
+
+2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * EventInfo.cs: implemented (Add|Remove)EventHandler.
+
+Mon Nov 18 17:52:56 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implemented GetManifestResourceStream (Type type,
+ * String name).
+
+2002-11-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Assembly.cs: changed name of GetType (string, bool, bool) to
+ InternalGetType.
+
+2002-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TargetInvocationException.cs: modified default message.
+
+2002-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoProperty.cs:
+ * PropertyInfo.cs: fixed bug #31535.
+
+2002-09-27 Martin Baulig <martin@gnome.org>
+
+ * Assembly.cs (Assembly.GetReferencedAssemblies): Implemented.
+
+2002-09-24 Martin Baulig <martin@gnome.org>
+
+ * Assembly.cs (MonoDebugger_GetType): New method to get a Type
+ from its metadata token. This should only be used by the debugger.
+
+2002-09-21 Martin Baulig <martin@gnome.org>
+
+ * Assembly.cs (MonoDebugger_GetLocalTypeFromSignature): New method to
+ get the type of a local variable from its signature. This should only
+ be used by the debugger.
+
+2002-09-20 Martin Baulig <martin@gnome.org>
+
+ * Assembly.cs (MonoDebugger_GetMethod): New method to get a MethodBase
+ from its metadata token. This should only be used by the debugger.
+
+Wed Sep 11 12:50:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Binder.cs: more default binder implementation.
+
+ * FieldInfo.cs, MonoField.cs: fixed SetValue () implementation.
+ * MonoMethod.cs: use the binder in the Invoke () implementation.
+ Implemented custom attributes methods and ToString for constructors.
+
+Thu Sep 5 20:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Binder.cs: finished the Binder class and implemented the default
+ binder.
+
+2002-09-03 Martin Baulig <martin@gnome.org>
+
+ * Assembly.cs (Assembly.Location): Implemented.
+
+2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoField.cs:
+ (GetValue): allow obj to be null (used for static fields).
+
+2002-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoField.cs: GetValue renamed to GetValueInternal. Added check for
+ null.
+
+Wed Aug 21 13:03:25 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: GetEntryAssembly patch by Tomi Pakarinen
+ <tomi.pakarinen@welho.com>.
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Assembly.cs: FullName now returns a proper string instead of
+ something like 'file://...'.
+
+ * AssemblyName.cs: added missing ToString method.
+
+2002-08-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FieldInfo.cs: implemented SetValue.
+
+Wed Aug 14 17:37:30 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoEvent.cs, MonoMethod.cs: implemented ReflectedType.
+
+2002-08-14 Dick Porter <dick@ximian.com>
+
+ * Assembly.cs: Stub out GetSatelliteAssembly
+
+2002-08-12 Tim Coleman <tim@timcoleman.com>
+ * MonoProperty.cs:
+ Allow multiple parameters for GetValue ()
+
+Thu Aug 8 13:05:44 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implemented GetFile() and GetFiles().
+
+Mon Aug 5 21:19:41 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implemented EntryPoint and a few
+ resource related methods.
+
+Wed Jul 24 13:08:56 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBase.cs: implemented GetCurrentMethod.
+ * Assembly.cs: implemented GetExecutingAssembly and
+ GetCallingassembly.
+
+Mon Jul 1 18:01:49 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoProperty.cs: handle properties with only a set method.
+
+2002-05-24 Martin Baulig <martin@gnome.org>
+
+ * ParameterInfo.cs: Added internal constructor.
+
+Thu May 23 17:18:46 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implemented CreateInstance ().
+
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * MethodBase.cs (get_next_table_index): Added `object obj' argument.
+
+Tue May 21 12:07:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EventInfo.cs: more implementation.
+
+Mon May 20 17:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoEvent.cs: fill-in the implementation.
+
+Sat May 4 15:00:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs, AssemblyName.cs: updates and fixes.
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * MonoProperty.cs (GetValue) : basic implementation to support nunit
+ * PropertyInfo.cs (GetValue) : call MonoProperty::GetValue instead of returning null
+
+Thu Apr 18 16:40:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.c: cache the method name.
+
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * AssemblyAlgorithmIdAttribute.cs: Fixed typo in AlgorithmId
+ property.
+
+ * AssemblyDelaySignAttribute.cs: Fixed type in DelaySign
+ attribute.
+
+ * AssemblyFileVersionAttribute.cs: Renamed FileVersion property to
+ Version.
+
+ * BindingFlags.cs: Added missing value "PutRefDispProperty".
+
+ * FieldAttributes.cs: Removed value "HasSecurity".
+
+ * ManifestResourceInfo.cs: Added missing properties FileName,
+ ReferencedAssembly and ResourceLocation.
+
+ * TargetInvocationException.cs: Added the missing constructors.
+
+Fri Apr 12 18:32:34 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: make Name property an icall.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * DefaultMemberAttribute.cs: Add AttributeUsage attribute for class,
+ struct and interface.
+
+Fri Apr 5 15:40:24 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoEvent.cs: remove unused code.
+ * MonoProperty: implement ToString().
+
+Wed Apr 3 17:59:26 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implement GetTypes() and GetExportedTypes().
+
+Mon Mar 25 18:54:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoEvent.cs: added the needed fields.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * ConstructorInfo.cs (Invoke): Implemented, call the abstract Invoke.
+
+ * MonoMethod.cs (MonoCMethod.Invoke): Implemented, call InternalInvoke.
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * MonoMethod.cs (Invoke): call InternalInvoke
+
+ * MethodBase.cs (Invoke): call virtual invoke function
+
+Thu Mar 7 17:14:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EventInfo.cs: add compiler needed methods.
+ * MonoMethod.cs: make ToString() return the return type name, too.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * BindingFlags.cs: Add missing enum values. Thanks CorCompare.
+
+Tue Mar 5 20:33:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeAttributes.cs, MethodImplAttributes.cs: updates to latest spec.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * StrongNameKeyPair.cs: Committed for Kevin Winchester (kwin@ns.sympatico.ca>.
+
+2002-02-24 Nick Drochak <ndrochak@gol.com>
+
+ * AssemblyNameFlags.cs: Use proper member name. Thanks corcompare!
+
+Fri Feb 22 18:54:13 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoField.cs: implement GetValue as an internalcall.
+ Implemented ToString().
+
+Tue Feb 19 20:36:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs, Module.cs, MonoField.cs, MonoMethod.cs,
+ MonoProperty.cs, ParameterInfo.cs: Implemented custom attributes
+ related methods.
+
+Thu Feb 14 18:55:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeAttributes.cs: update to latest spec.
+
+Mon Feb 11 19:50:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: handle throwOnError in GetType() call.
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * AssemblyName.cs: Implemented ISerializable interface for the
+ fields that we have.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * Missing.cs:
+ * TargetException.cs: Added in CVS.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * ReflectionTypeLoadException.cs: Added missing bits.
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * AssemblyAlgorithmIdAttribute.cs:
+ * AssemblyCompanyAttribute.cs:
+ * AssemblyConfigurationAttribute.cs:
+ * AssemblyCopyrightAttribute.cs:
+ * AssemblyCultureAttribute.cs:
+ * AssemblyDefaultAliasAttribute.cs:
+ * AssemblyDelaySignAttribute.cs:
+ * AssemblyDescriptionAttribute.cs:
+ * AssemblyFileVersionAttribute.cs:
+ * AssemblyFlagsAttribute.cs:
+ * AssemblyInformationalVersionAttribute.cs:
+ * AssemblyKeyFileAttribute.cs:
+ * AssemblyKeyNameAttribute.cs:
+ * AssemblyNameProxy.cs:
+ * AssemblyProductAttribute.cs:
+ * AssemblyTitleAttribute.cs:
+ * AssemblyTradeMarkAttribute.cs:
+ * AssemblyVersionAttribute.cs:
+ * CustomAttributeFormatException.cs:
+ * InvalidFilterCriteriaException.cs:
+ * TargetParameterCountException.cs: Added.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * Assembly.cs (Assembly.CodeBase): Implement.
+ (Assembly.FullName): simplistic and broken implementation. Gets
+ us where we were yesterday.
+
+ Code style fix.
+
+Tue Jan 22 22:54:18 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * IReflect.cs: corrected GetMember() return type.
+ * InterfaceMapping.cs, TypeDelegator.cs: implemented.
+
+Wed Jan 9 19:37:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: ToString () implementation.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * Assembly.cs : Decorate missing bits with the MonoTODO
+ attribute.
+
+ * ConstructorInfo.cs, MonoMethod.cs, MonoProperty.cs, ParameterInfo.cs,
+ ReflectionTypeLoadException.cs : Ditto.
+
+ * FieldInfo.cs : Ditto.
+
+Thu Jan 3 23:25:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: trow unimplemented exceptions.
+
+Tue Dec 18 18:46:22 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: implemented GetParameters().
+ * MonoProperty.cs: PropertyInfo implementation.
+ * ParameterInfo.cs: implemented.
+ * PropertyInfo.cs: fixes.
+
+Thu Dec 13 20:18:05 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FieldInfo.cs: implemented some Is* propeties.
+ * MethodBase.cs: fixed attribute accessors.
+ * MonoField.cs: runtime object to represent a field.
+ * MonoMethod.cs: runtime object to represent a method.
+ * AssemblyBuilder.cs: GetToken() methods to get tokens for
+ strings, fields, methods...
+ * ILGenerator.cs: handle tokens for methods.
+
+Mon Nov 19 13:56:55 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBase.cs: add internal get_next_table_index() for use in
+ Reflection.Emit.
+
+Wed Nov 14 16:53:28 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implement some of the Load() methods.
+ * ConstructorInfo.cs: some missing stubs and fields.
+ * FieldInfo.cs: IsInitOnly property.
+ * ParameterInfo.cs: stubs for missing properties.
+ * ParameterModifier.cs: implemented class.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * Assembly.cs: Filled in some stub implementations
+
+ * ConstructorInfo.cs: Added some stub functions for NUnit
+
+Fri Nov 2 18:29:36 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AmbiguousMatchException.cs,
+ * Assembly.cs, Module.cs: updates.
+ * FieldInfo.cs: better compliance to the spec.
+ * MethodBase.cs: move call_conv out of the way.
+ * AssemblyBuilder.cs: don't use internalcalls, more stuff supported.
+ * FieldBuilder.cs: implemented.
+ * ILGenerator.cs: implemented some opcode handling.
+ * Label.cs: add constructor.
+ * LocalBuilder.cs: implemented.
+ * MethodBuilder.cs: don't use internalcalls, more implemented stuff.
+ * ModuleBuilder.cs: don't use internalcalls, more meat here, too.
+ * ParameterBuilder.cs: implemented.
+ * PropertyBuilder.cs: implemented.
+ * TypeBuilder.cs: don't use internalcalls, more stuff working.
+
+Tue Sep 25 16:48:50 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorInfo.cs, MemberFilter.cs, Module.cs: added.
+
+Fri Sep 14 16:12:08 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBase.cs, MethodInfo.cs: added.
+
+Thu Sep 13 18:05:16 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: added stub code.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * BindingFlags.cs: Add.
+>>>>>>> 1.52
diff --git a/mcs/class/corlib/System.Reflection/ConstructorInfo.cs b/mcs/class/corlib/System.Reflection/ConstructorInfo.cs
new file mode 100644
index 00000000000..936f50ef8df
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ConstructorInfo.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection/ConstructorInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Reflection {
+ [Serializable]
+ public abstract class ConstructorInfo : MethodBase {
+ public static readonly string ConstructorName = ".ctor";
+ public static readonly string TypeConstructorName = ".cctor";
+
+ protected ConstructorInfo() {
+ }
+
+ public override MemberTypes MemberType {
+ get {return MemberTypes.Constructor;}
+ }
+
+ public object Invoke (object[] parameters)
+ {
+ if (parameters == null)
+ parameters = new object [0];
+
+ return Invoke (BindingFlags.CreateInstance, null, parameters, null);
+ }
+
+ public abstract object Invoke (BindingFlags invokeAttr, Binder binder, object[] parameters,
+ CultureInfo culture);
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs b/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs
new file mode 100644
index 00000000000..0e1c5c3692e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs
@@ -0,0 +1,38 @@
+//
+// System.Reflection.CustomAttributeFormatException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class CustomAttributeFormatException : FormatException
+ {
+ // Constructors
+ public CustomAttributeFormatException ()
+ : base (Locale.GetText ("The Binary format of the custom attribute is invalid."))
+ {
+ }
+ public CustomAttributeFormatException (string message)
+ : base (message)
+ {
+ }
+
+ public CustomAttributeFormatException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected CustomAttributeFormatException (SerializationInfo info,
+ StreamingContext context)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs b/mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs
new file mode 100644
index 00000000000..855cff8ed7d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.DefaultMemberAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection {
+
+ [Serializable]
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Interface)]
+ public sealed class DefaultMemberAttribute : Attribute {
+ string member_name;
+
+ public DefaultMemberAttribute (string member_name)
+ {
+ this.member_name = member_name;
+ }
+
+ public string MemberName {
+ get {
+ return member_name;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/EventAttributes.cs b/mcs/class/corlib/System.Reflection/EventAttributes.cs
new file mode 100755
index 00000000000..efb1154e21c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/EventAttributes.cs
@@ -0,0 +1,37 @@
+// EventAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:03 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum EventAttributes {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 512,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 1024,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 1024,
+ } // EventAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/EventInfo.cs b/mcs/class/corlib/System.Reflection/EventInfo.cs
new file mode 100755
index 00000000000..e0c4b243cd8
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/EventInfo.cs
@@ -0,0 +1,101 @@
+//
+// System.Reflection/EventInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Reflection {
+ public abstract class EventInfo : MemberInfo {
+
+ public abstract EventAttributes Attributes {get;}
+
+ public Type EventHandlerType {
+ get {
+ ParameterInfo[] p;
+ MethodInfo add = GetAddMethod (true);
+ p = add.GetParameters ();
+ if (p.Length > 0) {
+ Type t = p [0].ParameterType;
+ /* is it alwasys the first arg?
+ if (!t.IsSubclassOf (typeof (System.Delegate)))
+ throw new Exception ("no delegate in event");*/
+ return t;
+ } else
+ return null;
+ }
+ }
+ public bool IsMulticast {get {return true;}}
+ public bool IsSpecialName {get {return false;}}
+ public override MemberTypes MemberType {
+ get {return MemberTypes.Event;}
+ }
+
+ protected EventInfo() {
+ }
+
+ public void AddEventHandler (object target, Delegate handler)
+ {
+ MethodInfo add = GetAddMethod ();
+ if (add == null)
+ throw new Exception ("No add method!?");
+
+ add.Invoke (target, new object [] {handler});
+ }
+
+ public MethodInfo GetAddMethod() {
+ return GetAddMethod (false);
+ }
+ public abstract MethodInfo GetAddMethod(bool nonPublic);
+ public MethodInfo GetRaiseMethod() {
+ return GetRaiseMethod (false);
+ }
+ public abstract MethodInfo GetRaiseMethod( bool nonPublic);
+ public MethodInfo GetRemoveMethod() {
+ return GetRemoveMethod (false);
+ }
+ public abstract MethodInfo GetRemoveMethod( bool nonPublic);
+
+ public void RemoveEventHandler (object target, Delegate handler)
+ {
+ MethodInfo remove = GetRemoveMethod ();
+ if (remove == null)
+ throw new Exception ("No remove method!?");
+
+ remove.Invoke (target, new object [] {handler});
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+ public override Type ReflectedType {
+ get {
+ return null;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ return null;
+ }
+ }
+
+ public override String Name {
+ get {
+ return "Eventname";
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/FieldAttributes.cs b/mcs/class/corlib/System.Reflection/FieldAttributes.cs
new file mode 100755
index 00000000000..5462fc2b102
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/FieldAttributes.cs
@@ -0,0 +1,102 @@
+// FieldAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:12 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FieldAttributes {
+
+ /// <summary>
+ /// </summary>
+ FieldAccessMask = 7,
+
+ /// <summary>
+ /// </summary>
+ PrivateScope = 0x0,
+
+ /// <summary>
+ /// </summary>
+ Private = 0x1,
+
+ /// <summary>
+ /// </summary>
+ FamANDAssem = 0x2,
+
+ /// <summary>
+ /// </summary>
+ Assembly = 0x3,
+
+ /// <summary>
+ /// </summary>
+ Family = 0x4,
+
+ /// <summary>
+ /// </summary>
+ FamORAssem = 0x5,
+
+ /// <summary>
+ /// </summary>
+ Public = 0x6,
+
+ /// <summary>
+ /// </summary>
+ Static = 0x10,
+
+ /// <summary>
+ /// </summary>
+ InitOnly = 0x20,
+
+ /// <summary>
+ /// </summary>
+ Literal = 0x40,
+
+ /// <summary>
+ /// </summary>
+ NotSerialized = 0x80,
+
+ /// <summary>
+ /// </summary>
+ HasFieldRVA = 0x100,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 0x200,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 0x400,
+
+ /// <summary>
+ /// </summary>
+ HasFieldMarshal = 0x1000,
+
+ /// <summary>
+ /// </summary>
+ PinvokeImpl = 0x2000,
+
+ /// <summary>
+ /// </summary>
+ // HasSecurity = 0x4000,
+
+ /// <summary>
+ /// </summary>
+ HasDefault = 0x8000,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = HasDefault | HasFieldMarshal | RTSpecialName | HasFieldRVA,
+
+ } // FieldAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/FieldInfo.cs b/mcs/class/corlib/System.Reflection/FieldInfo.cs
new file mode 100755
index 00000000000..418690c4fa0
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/FieldInfo.cs
@@ -0,0 +1,118 @@
+//
+// System.Reflection.FieldInfo.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class FieldInfo : MemberInfo {
+
+ public abstract FieldAttributes Attributes {get;}
+ public abstract RuntimeFieldHandle FieldHandle {get;}
+
+ public abstract Type FieldType { get; }
+
+ public abstract object GetValue(object obj);
+
+ public override MemberTypes MemberType {
+ get { return MemberTypes.Field;}
+ }
+
+ public bool IsLiteral
+ {
+ get {return (Attributes & FieldAttributes.Literal) != 0;}
+ }
+
+ public bool IsStatic
+ {
+ get {return (Attributes & FieldAttributes.Static) != 0;}
+ }
+
+ public bool IsInitOnly
+ {
+ get {return (Attributes & FieldAttributes.InitOnly) != 0;}
+ }
+ public Boolean IsPublic
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public;
+ }
+ }
+ public Boolean IsPrivate
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private;
+ }
+ }
+ public Boolean IsFamily
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family;
+ }
+ }
+ public Boolean IsAssembly
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly;
+ }
+ }
+ public Boolean IsFamilyAndAssembly
+ {
+ get {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem;
+ }
+ }
+ public Boolean IsFamilyOrAssembly
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem;
+ }
+ }
+ public Boolean IsPinvokeImpl
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.PinvokeImpl) == FieldAttributes.PinvokeImpl;
+ }
+ }
+ public Boolean IsSpecialName
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.SpecialName) == FieldAttributes.SpecialName;
+ }
+ }
+ public Boolean IsNotSerialized
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
+ }
+ }
+
+ public abstract void SetValue (object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
+
+ public void SetValue (object obj, object value)
+ {
+ SetValue (obj, value, 0, null, null);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs b/mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs
new file mode 100755
index 00000000000..c0c06c274ac
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs
@@ -0,0 +1,25 @@
+//
+// System.Reflection.ICustomAttributeProvider.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+namespace System.Reflection {
+
+ public interface ICustomAttributeProvider {
+
+ object [] GetCustomAttributes (bool inherit);
+ object [] GetCustomAttributes (Type attribute_type, bool inherit);
+
+ /// <summary>
+ /// Probes whether one or more `attribute_type' types are
+ /// defined by this member
+ /// </summary>
+ bool IsDefined (Type attribute_type, bool inherit);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/IReflect.cs b/mcs/class/corlib/System.Reflection/IReflect.cs
new file mode 100755
index 00000000000..e89c3298a69
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/IReflect.cs
@@ -0,0 +1,44 @@
+//
+// System.Reflection.IReflect.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System.Globalization;
+
+namespace System.Reflection {
+
+ public interface IReflect {
+
+ Type UnderlyingSystemType {
+ get;
+ }
+
+ FieldInfo GetField (string name, BindingFlags binding_attr);
+ FieldInfo [] GetFields (BindingFlags binding_attr);
+ MemberInfo[] GetMember (string name, BindingFlags binding_attr);
+ MemberInfo[] GetMembers (BindingFlags binding_attr);
+ MethodInfo GetMethod (string name, BindingFlags binding_attr);
+ MethodInfo GetMethod (string name, BindingFlags binding_attr,
+ Binder binder, Type [] types, ParameterModifier [] modifiers);
+ MethodInfo[] GetMethods (BindingFlags binding_attr);
+
+ PropertyInfo [] GetProperties (BindingFlags binding_attr);
+ PropertyInfo GetProperty (string name, BindingFlags binding_attr);
+ PropertyInfo GetProperty (string name, BindingFlags binding_attr,
+ Binder binder, Type return_type, Type [] types,
+ ParameterModifier [] modifiers);
+
+ object InvokeMember (string name, BindingFlags invoke_attr,
+ Binder binder, object target, object [] args,
+ ParameterModifier [] modifiers,
+ CultureInfo culture,
+ string [] named_parameters);
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/InterfaceMapping.cs b/mcs/class/corlib/System.Reflection/InterfaceMapping.cs
new file mode 100755
index 00000000000..8da05148398
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/InterfaceMapping.cs
@@ -0,0 +1,10 @@
+
+namespace System.Reflection {
+
+ public struct InterfaceMapping {
+ public MethodInfo[] InterfaceMethods;
+ public Type InterfaceType;
+ public MethodInfo[] TargetMethods;
+ public Type TargetType;
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs b/mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs
new file mode 100644
index 00000000000..f1a73377a28
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs
@@ -0,0 +1,37 @@
+//
+// System.Reflection.InvalidFilterCriteriaException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class InvalidFilterCriteriaException : ApplicationException
+ {
+ public InvalidFilterCriteriaException ()
+ : base (Locale.GetText ("Filter Criteria is not valid."))
+ {
+ }
+ public InvalidFilterCriteriaException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidFilterCriteriaException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected InvalidFilterCriteriaException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs b/mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs
new file mode 100644
index 00000000000..76a359fa5a1
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs
@@ -0,0 +1,37 @@
+// System.Reflection.ManifestResourceInfo
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+namespace System.Reflection
+{
+ public class ManifestResourceInfo
+ {
+ private Assembly _assembly;
+ private string _filename;
+ private ResourceLocation _location;
+
+ internal ManifestResourceInfo (Assembly assembly, string filename, ResourceLocation location)
+ {
+ _assembly = assembly;
+ _filename = filename;
+ _location = location;
+ }
+ [MonoTODO]
+ public virtual string FileName {
+ get { return _filename; }
+ }
+
+ [MonoTODO]
+ public virtual Assembly ReferencedAssembly {
+ get { return _assembly; }
+ }
+
+ [MonoTODO]
+ public virtual ResourceLocation ResourceLocation {
+ get { return _location; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MemberFilter.cs b/mcs/class/corlib/System.Reflection/MemberFilter.cs
new file mode 100644
index 00000000000..74e73a69ce3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MemberFilter.cs
@@ -0,0 +1,7 @@
+using System;
+using System.Reflection;
+
+namespace System.Reflection {
+ public delegate bool MemberFilter( MemberInfo m, object filterCriteria);
+
+}
diff --git a/mcs/class/corlib/System.Reflection/MemberInfo.cs b/mcs/class/corlib/System.Reflection/MemberInfo.cs
new file mode 100755
index 00000000000..9e3c52b8038
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MemberInfo.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection.MemberInfo.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class MemberInfo : ICustomAttributeProvider {
+
+ public abstract Type DeclaringType {
+ get;
+ }
+
+ public abstract MemberTypes MemberType {
+ get;
+ }
+
+ public abstract string Name {
+ get;
+ }
+
+ public abstract Type ReflectedType {
+ get;
+ }
+
+ public abstract bool IsDefined (Type attribute_type, bool inherit);
+
+ public abstract object [] GetCustomAttributes (bool inherit);
+
+ public abstract object [] GetCustomAttributes (Type attribute_type, bool inherit);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MemberTypes.cs b/mcs/class/corlib/System.Reflection/MemberTypes.cs
new file mode 100755
index 00000000000..00a1234ef36
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MemberTypes.cs
@@ -0,0 +1,57 @@
+// MemberTypes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:53 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MemberTypes {
+
+ /// <summary>
+ /// </summary>
+ Constructor = 1,
+
+ /// <summary>
+ /// </summary>
+ Event = 2,
+
+ /// <summary>
+ /// </summary>
+ Field = 4,
+
+ /// <summary>
+ /// </summary>
+ Method = 8,
+
+ /// <summary>
+ /// </summary>
+ Property = 16,
+
+ /// <summary>
+ /// </summary>
+ TypeInfo = 32,
+
+ /// <summary>
+ /// </summary>
+ Custom = 64,
+
+ /// <summary>
+ /// </summary>
+ NestedType = 128,
+
+ /// <summary>
+ /// </summary>
+ All = 191,
+ } // MemberTypes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/MethodAttributes.cs b/mcs/class/corlib/System.Reflection/MethodAttributes.cs
new file mode 100755
index 00000000000..51ac6f18a6a
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodAttributes.cs
@@ -0,0 +1,113 @@
+// MethodAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:32 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MethodAttributes {
+
+ /// <summary>
+ /// </summary>
+ MemberAccessMask = 7,
+
+ /// <summary>
+ /// </summary>
+ PrivateScope = 0,
+
+ /// <summary>
+ /// </summary>
+ Private = 1,
+
+ /// <summary>
+ /// </summary>
+ FamANDAssem = 2,
+
+ /// <summary>
+ /// </summary>
+ Assembly = 3,
+
+ /// <summary>
+ /// </summary>
+ Family = 4,
+
+ /// <summary>
+ /// </summary>
+ FamORAssem = 5,
+
+ /// <summary>
+ /// </summary>
+ Public = 6,
+
+ /// <summary>
+ /// </summary>
+ Static = 16,
+
+ /// <summary>
+ /// </summary>
+ Final = 32,
+
+ /// <summary>
+ /// </summary>
+ Virtual = 64,
+
+ /// <summary>
+ /// </summary>
+ HideBySig = 128,
+
+ /// <summary>
+ /// </summary>
+ VtableLayoutMask = 256,
+
+ /// <summary>
+ /// </summary>
+ ReuseSlot = 0,
+
+ /// <summary>
+ /// </summary>
+ NewSlot = 256,
+
+ /// <summary>
+ /// </summary>
+ Abstract = 1024,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 2048,
+
+ /// <summary>
+ /// </summary>
+ PinvokeImpl = 8192,
+
+ /// <summary>
+ /// </summary>
+ UnmanagedExport = 8,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 4096,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 53248,
+
+ /// <summary>
+ /// </summary>
+ HasSecurity = 16384,
+
+ /// <summary>
+ /// </summary>
+ RequireSecObject = 32768,
+ } // MethodAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/MethodBase.cs b/mcs/class/corlib/System.Reflection/MethodBase.cs
new file mode 100644
index 00000000000..fda971d8d95
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodBase.cs
@@ -0,0 +1,126 @@
+//
+// System.Reflection/MethodBase.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class MethodBase: MemberInfo {
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static MethodBase GetCurrentMethod ();
+
+ public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle)
+ {
+ return null;
+ }
+
+ public abstract MethodImplAttributes GetMethodImplementationFlags();
+
+ public abstract ParameterInfo[] GetParameters();
+
+ public Object Invoke(Object obj, Object[] parameters) {
+ return Invoke (obj, 0, null, parameters, null);
+ }
+
+ public abstract Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
+
+ protected MethodBase()
+ {
+ }
+
+ public abstract RuntimeMethodHandle MethodHandle { get; }
+ public abstract MethodAttributes Attributes { get; }
+ public virtual CallingConventions CallingConvention { get {return CallingConventions.Standard;} }
+ public Boolean IsPublic {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public;
+ }
+ }
+ public Boolean IsPrivate {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private;
+ }
+ }
+ public Boolean IsFamily {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family;
+ }
+ }
+ public Boolean IsAssembly {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly;
+ }
+ }
+ public Boolean IsFamilyAndAssembly {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem;
+ }
+ }
+ public Boolean IsFamilyOrAssembly {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem;
+ }
+ }
+ public Boolean IsStatic {
+ get {
+ return (Attributes & MethodAttributes.Static) != 0;
+ }
+ }
+ public Boolean IsFinal {
+ get {
+ return (Attributes & MethodAttributes.Final) != 0;
+ }
+ }
+ public Boolean IsVirtual {
+ get {
+ return (Attributes & MethodAttributes.Virtual) != 0;
+ }
+ }
+ public Boolean IsHideBySig {
+ get {
+ return (Attributes & MethodAttributes.HideBySig) != 0;
+ }
+ }
+ public Boolean IsAbstract {
+ get {
+ return (Attributes & MethodAttributes.Abstract) != 0;
+ }
+ }
+ public Boolean IsSpecialName {
+ get {
+ int attr = (int)Attributes;
+ return (attr & (int)MethodAttributes.SpecialName) != 0;
+ }
+ }
+ public Boolean IsConstructor {
+ get {
+ int attr = (int)Attributes;
+ return ((attr & (int)MethodAttributes.RTSpecialName) != 0
+ && (Name == ".ctor"));
+ }
+ }
+
+ internal virtual int get_next_table_index (object obj, int table, bool inc) {
+ if (this is MethodBuilder) {
+ MethodBuilder mb = (MethodBuilder)this;
+ return mb.get_next_table_index (obj, table, inc);
+ }
+ if (this is ConstructorBuilder) {
+ ConstructorBuilder mb = (ConstructorBuilder)this;
+ return mb.get_next_table_index (obj, table, inc);
+ }
+ throw new Exception ("Method is not a builder method");
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MethodImplAttributes.cs b/mcs/class/corlib/System.Reflection/MethodImplAttributes.cs
new file mode 100755
index 00000000000..aaa243ab6d3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodImplAttributes.cs
@@ -0,0 +1,77 @@
+// MethodImplAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:42 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MethodImplAttributes {
+
+ /// <summary>
+ /// </summary>
+ CodeTypeMask = 3,
+
+ /// <summary>
+ /// </summary>
+ IL = 0,
+
+ /// <summary>
+ /// </summary>
+ Native = 1,
+
+ /// <summary>
+ /// </summary>
+ OPTIL = 2,
+
+ /// <summary>
+ /// </summary>
+ Runtime = 3,
+
+ /// <summary>
+ /// </summary>
+ ManagedMask = 4,
+
+ /// <summary>
+ /// </summary>
+ Unmanaged = 4,
+
+ /// <summary>
+ /// </summary>
+ Managed = 0,
+
+ /// <summary>
+ /// </summary>
+ ForwardRef = 16,
+
+ /// <summary>
+ /// </summary>
+ PreserveSig = 128,
+
+ /// <summary>
+ /// </summary>
+ InternalCall = 4096,
+
+ /// <summary>
+ /// </summary>
+ Synchronized = 32,
+
+ /// <summary>
+ /// </summary>
+ NoInlining = 8,
+
+ /// <summary>
+ /// </summary>
+ MaxMethodImplVal = 65535,
+ } // MethodImplAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/MethodInfo.cs b/mcs/class/corlib/System.Reflection/MethodInfo.cs
new file mode 100644
index 00000000000..505a9b626bd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodInfo.cs
@@ -0,0 +1,26 @@
+//
+// System.Reflection/MethodInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class MethodInfo: MethodBase {
+
+ public abstract MethodInfo GetBaseDefinition();
+
+ protected MethodInfo() {
+ }
+ public override MemberTypes MemberType { get {return MemberTypes.Method;} }
+ public abstract Type ReturnType { get; }
+ public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/Missing.cs b/mcs/class/corlib/System.Reflection/Missing.cs
new file mode 100644
index 00000000000..dfce32dae3e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Missing.cs
@@ -0,0 +1,17 @@
+//
+// System.Reflection.Missing.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ public sealed class Missing
+ {
+ public static readonly Missing Value;
+
+ internal Missing () {}
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/Module.cs b/mcs/class/corlib/System.Reflection/Module.cs
new file mode 100644
index 00000000000..2d1c8005446
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Module.cs
@@ -0,0 +1,103 @@
+//
+// System.Reflection/Module.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Reflection {
+ [Serializable]
+ public class Module : ISerializable, ICustomAttributeProvider {
+
+ public static readonly TypeFilter FilterTypeName;
+ public static readonly TypeFilter FilterTypeNameIgnoreCase;
+
+ private IntPtr _impl; /* a pointer to a MonoImage */
+ internal Assembly assembly;
+ internal string fqname;
+ internal string name;
+ internal string scopename;
+
+ internal Module () {}
+
+ public Assembly Assembly {get {return assembly;}}
+ public virtual string FullyQualifiedName {get {return fqname;}}
+ public string Name {get {return name;}}
+ public string ScopeName {get {return scopename;}}
+
+
+ public virtual Type[] FindTypes(TypeFilter filter, object filterCriteria) {
+ return null;
+ }
+ public virtual object[] GetCustomAttributes(bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+ public FieldInfo GetField(string name) {
+ return null;
+ }
+ public FieldInfo GetField(string name, BindingFlags flags) {
+ return null;
+ }
+ public FieldInfo[] GetFields() {
+ return null;
+ }
+
+ public MethodInfo GetMethod(string name) {
+ return null;
+ }
+ public MethodInfo GetMethod(string name, Type[] types) {
+ return null;
+ }
+ public MethodInfo GetMethod( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ protected virtual MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ public MethodInfo[] GetMethods() {
+ return null;
+ }
+ public virtual void GetObjectData( SerializationInfo info, StreamingContext context) {}
+ public X509Certificate GetSignerCertificate() {
+ return null;
+ }
+ public virtual Type GetType(string className) {
+ return null;
+ }
+ public virtual Type GetType(string className, bool ignoreCase) {
+ return null;
+ }
+ public virtual Type GetType(string className, bool throwOnError, bool ignoreCase) {
+ return null;
+ }
+ public virtual Type[] GetTypes() {
+ return null;
+ }
+ public virtual bool IsDefined( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+ public bool IsResource() {
+ return false;
+ }
+ public override string ToString() {
+ return "Reflection.Module: " + name;
+ }
+
+
+
+
+
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoEvent.cs b/mcs/class/corlib/System.Reflection/MonoEvent.cs
new file mode 100755
index 00000000000..9fc6b3d8b2c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoEvent.cs
@@ -0,0 +1,85 @@
+//
+// System.Reflection/MonoEvent.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+ internal struct MonoEventInfo {
+ public Type parent;
+ public String name;
+ public MethodInfo add_method;
+ public MethodInfo remove_method;
+ public MethodInfo raise_method;
+ public EventAttributes attrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_event_info (MonoEvent ev, out MonoEventInfo info);
+ }
+
+ internal sealed class MonoEvent: EventInfo {
+ IntPtr klass;
+ IntPtr handle;
+
+ public override EventAttributes Attributes {
+ get {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.attrs;
+ }
+ }
+
+ public override MethodInfo GetAddMethod(bool nonPublic) {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.add_method;
+ }
+ public override MethodInfo GetRaiseMethod( bool nonPublic) {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.raise_method;
+ }
+ public override MethodInfo GetRemoveMethod( bool nonPublic) {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.remove_method;
+ }
+
+ public override Type DeclaringType {
+ get {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.parent;
+ }
+ }
+ public override Type ReflectedType {
+ get {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ MonoEventInfo info;
+ MonoEventInfo.get_event_info (this, out info);
+
+ return info.name;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoField.cs b/mcs/class/corlib/System.Reflection/MonoField.cs
new file mode 100755
index 00000000000..1adf2e1b8ca
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoField.cs
@@ -0,0 +1,112 @@
+
+//
+// System.Reflection/MonoField.cs
+// The class used to represent Fields from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+
+ internal struct MonoFieldInfo {
+ public Type parent;
+ public Type type;
+ public String name;
+ public FieldAttributes attrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_field_info (MonoField field, out MonoFieldInfo info);
+ }
+
+ internal class MonoField : FieldInfo {
+ internal IntPtr klass;
+ internal RuntimeFieldHandle fhandle;
+
+ public override FieldAttributes Attributes {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.attrs;
+ }
+ }
+ public override RuntimeFieldHandle FieldHandle {
+ get {return fhandle;}
+ }
+
+ public override Type FieldType {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.type;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern object GetValueInternal (object obj);
+
+ public override object GetValue (object obj)
+ {
+ return GetValueInternal (obj);
+ }
+
+ public override string ToString () {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return String.Format ("{0} {1}", info.type, info.name);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void SetValueInternal (FieldInfo fi, object obj, object value);
+
+ public override void SetValue (object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
+ {
+ if (!IsStatic && obj == null)
+ throw new ArgumentNullException ("obj");
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ object realval = binder.ChangeType (val, FieldType, culture);
+ SetValueInternal (this, obj, realval);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs
new file mode 100755
index 00000000000..f258c9cf0fe
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs
@@ -0,0 +1,233 @@
+//
+// System.Reflection/MonoMethod.cs
+// The class used to represent methods from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+ internal struct MonoMethodInfo {
+ internal Type parent;
+ internal Type ret;
+ internal MethodAttributes attrs;
+ internal MethodImplAttributes iattrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_method_info (IntPtr handle, out MonoMethodInfo info);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern ParameterInfo[] get_parameter_info (IntPtr handle);
+ };
+
+ /*
+ * Note: most of this class needs to be duplicated for the contructor, since
+ * the .NET reflection class hierarchy is so broken.
+ */
+ internal class MonoMethod : MethodInfo {
+ internal IntPtr mhandle;
+ string name;
+ Type reftype;
+
+ [MonoTODO]
+ public override MethodInfo GetBaseDefinition() {
+ return this; /* FIXME */
+ }
+ public override Type ReturnType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.ret;
+ }
+ }
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes {
+ get {
+ return new ParameterInfo (ReturnType, this);
+ }
+ }
+
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.iattrs;
+ }
+
+ public override ParameterInfo[] GetParameters() {
+ return MonoMethodInfo.get_parameter_info (mhandle);
+ }
+
+ /*
+ * InternalInvoke() receives the parameters corretcly converted by the binder
+ * to match the types of the method signature.
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern Object InternalInvoke (Object obj, Object[] parameters);
+
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ ParameterInfo[] pinfo = GetParameters ();
+ if (!Binder.ConvertArgs (binder, parameters, pinfo, culture))
+ throw new ArgumentException ("parameters");
+ try {
+ return InternalInvoke (obj, parameters);
+ } catch (TargetException e) {
+ throw;
+ } catch (Exception e) {
+ throw new TargetInvocationException (e);
+ }
+ }
+
+ public override RuntimeMethodHandle MethodHandle {
+ get {return new RuntimeMethodHandle (mhandle);}
+ }
+ public override MethodAttributes Attributes {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.attrs;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ return reftype;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override string ToString () {
+ string parms = "";
+ ParameterInfo[] p = GetParameters ();
+ for (int i = 0; i < p.Length; ++i) {
+ if (i > 0)
+ parms = parms + ", ";
+ parms = parms + p [i].ParameterType.Name;
+ }
+ return ReturnType.Name+" "+Name+"("+parms+")";
+ }
+ }
+
+ internal class MonoCMethod : ConstructorInfo {
+ internal IntPtr mhandle;
+ string name;
+ Type reftype;
+
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.iattrs;
+ }
+
+ public override ParameterInfo[] GetParameters() {
+ return MonoMethodInfo.get_parameter_info (mhandle);
+ }
+
+ /*
+ * InternalInvoke() receives the parameters corretcly converted by the binder
+ * to match the types of the method signature.
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern Object InternalInvoke (Object obj, Object[] parameters);
+
+ public override Object Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ ParameterInfo[] pinfo = GetParameters ();
+ if (!Binder.ConvertArgs (binder, parameters, pinfo, culture))
+ throw new ArgumentException ("parameters");
+ try {
+ return InternalInvoke (obj, parameters);
+ } catch (TargetException e) {
+ throw;
+ } catch (Exception e) {
+ throw new TargetInvocationException (e);
+ }
+ }
+
+ public override Object Invoke (BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ return Invoke (null, invokeAttr, binder, parameters, culture);
+ }
+
+ public override RuntimeMethodHandle MethodHandle {
+ get {return new RuntimeMethodHandle (mhandle);}
+ }
+ public override MethodAttributes Attributes {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.attrs;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ return reftype;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override string ToString () {
+ string parms = "";
+ ParameterInfo[] p = GetParameters ();
+ for (int i = 0; i < p.Length; ++i) {
+ if (i > 0)
+ parms = parms + ", ";
+ parms = parms + p [i].ParameterType.Name;
+ }
+ return "Void "+Name+"("+parms+")";
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoProperty.cs b/mcs/class/corlib/System.Reflection/MonoProperty.cs
new file mode 100755
index 00000000000..74f21d226de
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoProperty.cs
@@ -0,0 +1,198 @@
+//
+// System.Reflection/MonoProperty.cs
+// The class used to represent Properties from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+
+ internal struct MonoPropertyInfo {
+ public Type parent;
+ public String name;
+ public MethodInfo get_method;
+ public MethodInfo set_method;
+ public PropertyAttributes attrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_property_info (MonoProperty prop, out MonoPropertyInfo info);
+ }
+
+ internal class MonoProperty : PropertyInfo {
+ internal IntPtr klass;
+ internal IntPtr prop;
+
+ public override PropertyAttributes Attributes {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.attrs;
+ }
+ }
+
+ public override bool CanRead {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return (info.get_method != null);
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return (info.set_method != null);
+ }
+ }
+
+ public override Type PropertyType {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+
+ if (info.get_method != null) {
+ return info.get_method.ReturnType;
+ } else {
+ ParameterInfo[] parameters = info.set_method.GetParameters();
+
+ return parameters [parameters.Length - 1].ParameterType;
+ }
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.parent;
+ }
+ }
+
+ public override Type DeclaringType {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.parent;
+ }
+ }
+
+ public override string Name {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.name;
+ }
+ }
+
+ [MonoTODO]
+ public override MethodInfo[] GetAccessors (bool nonPublic)
+ {
+ // FIXME: check nonPublic
+ MonoPropertyInfo info;
+ int n = 0;
+ MonoPropertyInfo.get_property_info (this, out info);
+ if (info.set_method != null)
+ n++;
+ if (info.get_method != null)
+ n++;
+ MethodInfo[] res = new MethodInfo [n];
+ n = 0;
+ if (info.set_method != null)
+ res [n++] = info.set_method;
+ if (info.get_method != null)
+ res [n++] = info.get_method;
+ return res;
+ }
+
+ [MonoTODO]
+ public override MethodInfo GetGetMethod (bool nonPublic)
+ {
+ // FIXME: check nonPublic
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.get_method;
+ }
+
+ public override ParameterInfo[] GetIndexParameters()
+ {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ if (info.get_method != null)
+ return info.get_method.GetParameters ();
+ return new ParameterInfo [0];
+ }
+
+ public override MethodInfo GetSetMethod (bool nonPublic)
+ {
+ // FIXME: check nonPublic
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.set_method;
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public override object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override object GetValue (object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
+ {
+ object ret = null;
+
+ MethodInfo method = GetGetMethod (false);
+ if (method == null)
+ throw new ArgumentException ("Get Method not found for '" + Name + "'");
+
+ if (index == null || index.Length == 0)
+ ret = method.Invoke (obj, invokeAttr, binder, null, culture);
+ else
+ ret = method.Invoke (obj, invokeAttr, binder, index, culture);
+
+ return ret;
+ }
+
+ public override void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
+ {
+ MethodInfo method = GetSetMethod (false);
+ if (method == null)
+ throw new ArgumentException ("Set Method not found for '" + Name + "'");
+
+ object [] parms;
+ if (index == null || index.Length == 0)
+ parms = new object [] {value};
+ else {
+ int ilen = index.Length;
+ parms = new object [ilen+ 1];
+ index.CopyTo (parms, 0);
+ parms [ilen] = value;
+ }
+
+ method.Invoke (obj, invokeAttr, binder, parms, culture);
+ }
+
+ public override string ToString () {
+ return PropertyType.ToString () + " " + Name;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection/ParameterAttributes.cs b/mcs/class/corlib/System.Reflection/ParameterAttributes.cs
new file mode 100755
index 00000000000..eaf409d8b1c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ParameterAttributes.cs
@@ -0,0 +1,66 @@
+// ParameterAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:52 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ParameterAttributes {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ In = 1,
+
+ /// <summary>
+ /// </summary>
+ Out = 2,
+
+ /// <summary>
+ /// </summary>
+ Lcid = 4,
+
+ /// <summary>
+ /// </summary>
+ Retval = 8,
+
+ /// <summary>
+ /// </summary>
+ Optional = 16,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 61440,
+
+ /// <summary>
+ /// </summary>
+ HasDefault = 4096,
+
+ /// <summary>
+ /// </summary>
+ HasFieldMarshal = 8192,
+
+ /// <summary>
+ /// </summary>
+ Reserved3 = 16384,
+
+ /// <summary>
+ /// </summary>
+ Reserved4 = 32768,
+ } // ParameterAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/ParameterInfo.cs b/mcs/class/corlib/System.Reflection/ParameterInfo.cs
new file mode 100644
index 00000000000..3cb20fcc4b6
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ParameterInfo.cs
@@ -0,0 +1,103 @@
+// System.Reflection.ParameterInfo
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.Reflection.Emit;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class ParameterInfo : ICustomAttributeProvider
+ {
+ protected Type ClassImpl;
+ protected object DefaultValueImpl;
+ protected MemberInfo MemberImpl;
+ protected string NameImpl;
+ protected int PositionImpl;
+ protected ParameterAttributes AttrsImpl;
+
+ protected ParameterInfo () {
+ }
+
+ internal ParameterInfo (ParameterBuilder pb, Type type, MemberInfo member, int position) {
+ this.ClassImpl = type;
+ this.MemberImpl = member;
+ if (pb != null) {
+ this.NameImpl = pb.Name;
+ this.PositionImpl = pb.Position;
+ this.AttrsImpl = (ParameterAttributes) pb.Attributes;
+ } else {
+ this.NameImpl = "";
+ this.PositionImpl = position;
+ this.AttrsImpl = ParameterAttributes.None;
+ }
+ }
+
+ /* to build a ParameterInfo for the return type of a method */
+ internal ParameterInfo (Type type, MemberInfo member) {
+ this.ClassImpl = type;
+ this.MemberImpl = member;
+ this.NameImpl = "";
+ this.PositionImpl = 0;
+ this.AttrsImpl = ParameterAttributes.Retval;
+ }
+
+ public virtual Type ParameterType {
+ get {return ClassImpl;}
+ }
+ public virtual ParameterAttributes Attributes {
+ get {return AttrsImpl;}
+ }
+ public virtual object DefaultValue {
+ get {return DefaultValueImpl;}
+ }
+
+ public bool IsIn {
+ get {return (AttrsImpl & ParameterAttributes.In) != 0;}
+ }
+
+ public bool IsLcid {
+ get {return (AttrsImpl & ParameterAttributes.Lcid) != 0;}
+ }
+
+ public bool IsOptional {
+ get {return (AttrsImpl & ParameterAttributes.Optional) != 0;}
+ }
+
+ public bool IsOut {
+ get {return (AttrsImpl & ParameterAttributes.Out) != 0;}
+ }
+
+ public bool IsRetval {
+ get {return (AttrsImpl & ParameterAttributes.Retval) != 0;}
+ }
+
+ public virtual MemberInfo Member {
+ get {return MemberImpl;}
+ }
+
+ public virtual string Name {
+ get {return NameImpl;}
+ }
+
+ public virtual int Position {
+ get {return PositionImpl;}
+ }
+
+ public virtual object[] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public virtual object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public virtual bool IsDefined( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ParameterModifier.cs b/mcs/class/corlib/System.Reflection/ParameterModifier.cs
new file mode 100755
index 00000000000..4615e1931dd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ParameterModifier.cs
@@ -0,0 +1,26 @@
+//
+// System.Reflection/ParameterModifier.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// Copyright (c) 2001 Ximian, Inc
+
+using System;
+
+namespace System.Reflection {
+ public struct ParameterModifier {
+ private bool[] data;
+
+ public ParameterModifier (int paramaterCount) {
+ data = new bool [paramaterCount];
+ }
+
+ public bool this [int index] {
+ get {return data [index];}
+ set {data [index] = value;}
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/PropertyAttributes.cs b/mcs/class/corlib/System.Reflection/PropertyAttributes.cs
new file mode 100755
index 00000000000..7cb7359dba0
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/PropertyAttributes.cs
@@ -0,0 +1,54 @@
+// PropertyAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:02 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum PropertyAttributes {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 512,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 62464,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 1024,
+
+ /// <summary>
+ /// </summary>
+ HasDefault = 4096,
+
+ /// <summary>
+ /// </summary>
+ Reserved2 = 8192,
+
+ /// <summary>
+ /// </summary>
+ Reserved3 = 16384,
+
+ /// <summary>
+ /// </summary>
+ Reserved4 = 32768,
+ } // PropertyAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/PropertyInfo.cs b/mcs/class/corlib/System.Reflection/PropertyInfo.cs
new file mode 100755
index 00000000000..cad58c2a604
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/PropertyInfo.cs
@@ -0,0 +1,69 @@
+//
+// System.Reflection/PropertyInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Reflection {
+ [Serializable]
+ public abstract class PropertyInfo : MemberInfo {
+
+ public abstract PropertyAttributes Attributes { get; }
+ public abstract bool CanRead { get; }
+ public abstract bool CanWrite { get; }
+
+ public bool IsSpecialName {
+ get {return (Attributes & PropertyAttributes.SpecialName) != 0;}
+ }
+
+ public override MemberTypes MemberType {
+ get {return MemberTypes.Property;}
+ }
+ public abstract Type PropertyType { get; }
+
+ protected PropertyInfo () { }
+
+ public MethodInfo[] GetAccessors ()
+ {
+ return GetAccessors (false);
+ }
+
+ public abstract MethodInfo[] GetAccessors (bool nonPublic);
+
+ public MethodInfo GetGetMethod()
+ {
+ return GetGetMethod (false);
+ }
+ public abstract MethodInfo GetGetMethod(bool nonPublic);
+
+ public abstract ParameterInfo[] GetIndexParameters();
+
+ public MethodInfo GetSetMethod()
+ {
+ return GetSetMethod (false);
+ }
+
+ public abstract MethodInfo GetSetMethod (bool nonPublic);
+
+ public virtual object GetValue (object obj, object[] index)
+ {
+ return GetValue(obj, BindingFlags.Default, null, index, null);
+ }
+
+ public abstract object GetValue (object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
+
+ public virtual void SetValue (object obj, object value, object[] index)
+ {
+ SetValue (obj, value, BindingFlags.Default, null, index, null);
+ }
+
+ public abstract void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs b/mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs
new file mode 100644
index 00000000000..7680b4c37b5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs
@@ -0,0 +1,62 @@
+//
+// System.Reflection.ReflectionTypeLoadException
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Dunan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class ReflectionTypeLoadException : SystemException
+ {
+ // Fields
+ private Exception[] loaderExceptions;
+ private Type[] types;
+
+ // Constructors
+ public ReflectionTypeLoadException (Type[] classes, Exception[] exceptions)
+ : base (Locale.GetText ("The classes in the module cannot be loaded."))
+ {
+ loaderExceptions = exceptions;
+ types = classes;
+ }
+
+ public ReflectionTypeLoadException (Type[] classes, Exception[] exceptions, string message)
+ : base (message)
+ {
+ loaderExceptions = exceptions;
+ types = classes;
+ }
+
+ // Properties
+ public Type[] Types
+ {
+ get { return types; }
+ }
+
+ public Exception[] LoaderExceptions
+ {
+ get { return loaderExceptions; }
+ }
+
+ // Method
+ [MonoTODO]
+ //
+ // This one is a bit tough because need to serialize two arrays.
+ // The serialization output comes out as
+ // <Types href="#ref-4" />
+ // <Exceptions href="#ref-5" />
+ // and then goes on and appends new SOAP-ENCs, etc...
+ //
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ResourceAttributes.cs b/mcs/class/corlib/System.Reflection/ResourceAttributes.cs
new file mode 100755
index 00000000000..ab02d11805d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ResourceAttributes.cs
@@ -0,0 +1,30 @@
+// ResourceAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:12 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ResourceAttributes {
+
+ /// <summary>
+ /// </summary>
+ Public = 1,
+
+ /// <summary>
+ /// </summary>
+ Private = 2,
+ } // ResourceAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/ResourceLocation.cs b/mcs/class/corlib/System.Reflection/ResourceLocation.cs
new file mode 100755
index 00000000000..611c61828b5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ResourceLocation.cs
@@ -0,0 +1,34 @@
+// ResourceLocation.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:22 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ResourceLocation {
+
+ /// <summary>
+ /// </summary>
+ Embedded = 1,
+
+ /// <summary>
+ /// </summary>
+ ContainedInAnotherAssembly = 2,
+
+ /// <summary>
+ /// </summary>
+ ContainedInManifestFile = 4,
+ } // ResourceLocation
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs b/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs
new file mode 100755
index 00000000000..7be6735377a
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs
@@ -0,0 +1,114 @@
+//
+// System.Reflection.StrongNameKeyPair.cs
+//
+// Authors:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Kevin Winchester
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+
+namespace System.Reflection {
+
+[Serializable]
+public class StrongNameKeyPair
+{
+ private byte[] keyPair;
+ private byte[] publicKey;
+ private int bitLen;
+ private bool keypairValid;
+
+ public StrongNameKeyPair (byte[] keyPairArray)
+ {
+ if (keyPairArray == null)
+ throw new ArgumentNullException ("keyPairArray");
+ keypairValid = Validate (keyPairArray);
+ }
+
+ public StrongNameKeyPair (FileStream keyPairFile)
+ {
+ if (keyPairFile == null)
+ throw new ArgumentNullException ("keyPairFile");
+ byte[] input = new byte [keyPairFile.Length];
+ keyPairFile.Read (input, 0, input.Length);
+ keypairValid = Validate (input);
+ }
+
+ [MonoTODO("We do not, yet, support keypair persistance")]
+ public StrongNameKeyPair (string keyPairContainer)
+ {
+ // named key container
+ if (keyPairContainer == null)
+ throw new ArgumentNullException ("keyPairContainer");
+ // only RSA ? or both RSA and DSA ?
+ throw new NotImplementedException ();
+ }
+
+ private bool Validate (byte[] keypair) {
+ // Type - PRIVATEKEYBLOB (0x07)
+ if (keypair[0] != 0x07)
+ return false;
+ // Version - Always CUR_BLOB_VERSION (0x02)
+ if (keypair[1] != 0x02)
+ return false;
+ // RESERVED - Always 0
+ if ((keypair[2] != 0x00) || (keypair[3] != 0x00))
+ return false;
+ // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
+ if ((keypair[4] != 0x00) || (keypair[5] != 0x24) || (keypair[6] != 0x00) || (keypair[7] != 0x00))
+ return false;
+ // Magic - RSA2 (ASCII in hex)
+ if ((keypair[8] != 0x52) || (keypair[9] != 0x53) || (keypair[10] != 0x41) || (keypair[11] != 0x32))
+ return false;
+ // bitlen - ex: 1024 - must be a multiple of 8
+ bitLen = (keypair[15] << 24) + (keypair[14] << 16) + (keypair[13] << 8) + keypair[12];
+ if (bitLen % 8 != 0)
+ return false;
+ // public exponent (DWORD)
+ // modulus
+ // private key
+ keyPair = keypair;
+ return true;
+ }
+
+ public byte[] PublicKey {
+ get {
+ if (!keypairValid)
+ throw new ArgumentException ("invalid keypair");
+ // first call (will be cached for all subsequent calls)
+ if (publicKey == null) {
+ publicKey = new byte [(bitLen >> 3) + 32];
+ // The first 12 bytes are documented at:
+ // http://msdn.microsoft.com/library/en-us/cprefadd/html/grfungethashfromfile.asp
+ // ALG_ID - Signature
+ publicKey[0] = keyPair[4];
+ publicKey[1] = keyPair[5];
+ publicKey[2] = keyPair[6];
+ publicKey[3] = keyPair[7];
+ // ALG_ID - Hash
+ publicKey[4] = 0x04;
+ publicKey[5] = 0x80;
+ publicKey[6] = 0x00;
+ publicKey[7] = 0x00;
+ // Length of Public Key (in bytes)
+ int lastPart = publicKey.Length - 12;
+ publicKey[8] = (byte)(lastPart % 256);
+ publicKey[9] = (byte)(lastPart / 256); // just in case
+ publicKey[10] = 0x00;
+ publicKey[11] = 0x00;
+ // Ok from here - Same structure as keypair - expect for public key
+ publicKey[12] = 0x06; // PUBLICKEYBLOB
+ // we can copy this part
+ Array.Copy (keyPair, 1, publicKey, 13, publicKey.Length - 13);
+ // and make a small adjustment
+ publicKey[23] = 0x31; // (RSA1 not RSA2)
+ }
+ return publicKey;
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Reflection/TargetException.cs b/mcs/class/corlib/System.Reflection/TargetException.cs
new file mode 100644
index 00000000000..58e4f2dae6f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TargetException.cs
@@ -0,0 +1,37 @@
+//
+// System.Reflection.TargetException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class TargetException : ApplicationException
+ {
+ public TargetException ()
+ : base (Locale.GetText ("Unable to invoke an invalid target."))
+ {
+ }
+
+ public TargetException (string message)
+ : base (message)
+ {
+ }
+
+ public TargetException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ protected TargetException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TargetInvocationException.cs b/mcs/class/corlib/System.Reflection/TargetInvocationException.cs
new file mode 100644
index 00000000000..bb8143c087b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TargetInvocationException.cs
@@ -0,0 +1,23 @@
+// System.Reflection.TargetInvocationException
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class TargetInvocationException : ApplicationException
+ {
+ public TargetInvocationException (Exception inner)
+ : base ("Exception has been thrown by the target of an invocation.", inner)
+ {
+ }
+
+ public TargetInvocationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs b/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs
new file mode 100644
index 00000000000..38a4528743f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs
@@ -0,0 +1,38 @@
+//
+// System.Reflection.TargetParameterCountException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class TargetParameterCountException : ApplicationException
+ {
+ public TargetParameterCountException ()
+ : base (Locale.GetText ("Number of parameter does not match expected count."))
+ {
+ }
+
+ public TargetParameterCountException (string message)
+ : base (message)
+ {
+ }
+
+ public TargetParameterCountException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ internal TargetParameterCountException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TypeAttributes.cs b/mcs/class/corlib/System.Reflection/TypeAttributes.cs
new file mode 100755
index 00000000000..5647b709857
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TypeAttributes.cs
@@ -0,0 +1,138 @@
+// TypeAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:22 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum TypeAttributes {
+
+ /// <summary>
+ /// </summary>
+ VisibilityMask = 7,
+
+ /// <summary>
+ /// </summary>
+ NotPublic = 0,
+
+ /// <summary>
+ /// </summary>
+ Public = 1,
+
+ /// <summary>
+ /// </summary>
+ NestedPublic = 2,
+
+ /// <summary>
+ /// </summary>
+ NestedPrivate = 3,
+
+ /// <summary>
+ /// </summary>
+ NestedFamily = 4,
+
+ /// <summary>
+ /// </summary>
+ NestedAssembly = 5,
+
+ /// <summary>
+ /// </summary>
+ NestedFamANDAssem = 6,
+
+ /// <summary>
+ /// </summary>
+ NestedFamORAssem = 7,
+
+ /// <summary>
+ /// </summary>
+ LayoutMask = 24,
+
+ /// <summary>
+ /// </summary>
+ AutoLayout = 0,
+
+ /// <summary>
+ /// </summary>
+ SequentialLayout = 8,
+
+ /// <summary>
+ /// </summary>
+ ExplicitLayout = 16,
+
+ /// <summary>
+ /// </summary>
+ ClassSemanticsMask = 32,
+
+ /// <summary>
+ /// </summary>
+ Class = 0,
+
+ /// <summary>
+ /// </summary>
+ Interface = 32,
+
+ /// <summary>
+ /// </summary>
+ Abstract = 128,
+
+ /// <summary>
+ /// </summary>
+ Sealed = 256,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 1024,
+
+ /// <summary>
+ /// </summary>
+ Import = 4096,
+
+ /// <summary>
+ /// </summary>
+ Serializable = 8192,
+
+ /// <summary>
+ /// </summary>
+ StringFormatMask = 196608,
+
+ /// <summary>
+ /// </summary>
+ AnsiClass = 0,
+
+ /// <summary>
+ /// </summary>
+ UnicodeClass = 65536,
+
+ /// <summary>
+ /// </summary>
+ AutoClass = 131072,
+
+ /// <summary>
+ /// </summary>
+ BeforeFieldInit = 1048576,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 264192,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 2048,
+
+ /// <summary>
+ /// </summary>
+ HasSecurity = 262144,
+ } // TypeAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/TypeDelegator.cs b/mcs/class/corlib/System.Reflection/TypeDelegator.cs
new file mode 100755
index 00000000000..b25962a4660
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TypeDelegator.cs
@@ -0,0 +1,204 @@
+// System.Reflection/TypeDelegator.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public class TypeDelegator : Type {
+ protected Type typeImpl;
+
+ protected TypeDelegator () {
+ }
+
+ public TypeDelegator( Type delegatingType) {
+ if (delegatingType == null)
+ throw new ArgumentNullException ("delegatingType must be non-null");
+ typeImpl = delegatingType;
+ }
+
+ public override Assembly Assembly {
+ get {return typeImpl.Assembly;}
+ }
+
+ public override string AssemblyQualifiedName {
+ get {return typeImpl.AssemblyQualifiedName;}
+ }
+
+ public override Type BaseType {
+ get {return typeImpl.BaseType;}
+ }
+
+ public override string FullName {
+ get {return typeImpl.FullName;}
+ }
+
+ public override Guid GUID {
+ get {return typeImpl.GUID;}
+ }
+
+ public override Module Module {
+ get {return typeImpl.Module;}
+ }
+
+ public override string Name {
+ get {return typeImpl.Name;}
+ }
+
+ public override string Namespace {
+ get {return typeImpl.Namespace;}
+ }
+
+ public override RuntimeTypeHandle TypeHandle {
+ get {return typeImpl.TypeHandle;}
+ }
+
+ public override Type UnderlyingSystemType {
+ get {return typeImpl.UnderlyingSystemType;}
+ }
+
+ protected override TypeAttributes GetAttributeFlagsImpl () {
+ throw new NotImplementedException ();
+ //return typeImpl.GetAttributeFlagsImpl ();
+ }
+
+ protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ //return typeImpl.GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr) {
+ return typeImpl.GetConstructors (bindingAttr);
+ }
+
+ public override object[] GetCustomAttributes (bool inherit)
+ {
+ return typeImpl.GetCustomAttributes (inherit);
+ }
+
+ public override object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return typeImpl.GetCustomAttributes (attributeType, inherit);
+ }
+
+ public override Type GetElementType() {
+ return typeImpl.GetElementType ();
+ }
+
+ public override EventInfo GetEvent( string name, BindingFlags bindingAttr) {
+ return typeImpl.GetEvent (name, bindingAttr);
+ }
+
+ public override EventInfo[] GetEvents() {
+ return GetEvents (BindingFlags.Public);
+ }
+
+ public override EventInfo[] GetEvents( BindingFlags bindingAttr) {
+ return typeImpl.GetEvents (bindingAttr);
+ }
+
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ return typeImpl.GetField (name, bindingAttr);
+ }
+
+ public override FieldInfo[] GetFields( BindingFlags bindingAttr) {
+ return typeImpl.GetFields (bindingAttr);
+ }
+
+ public override Type GetInterface( string name, bool ignoreCase) {
+ return typeImpl.GetInterface (name, ignoreCase);
+ }
+
+ public override InterfaceMapping GetInterfaceMap( Type interfaceType) {
+ return typeImpl.GetInterfaceMap (interfaceType);
+ }
+
+ public override Type[] GetInterfaces() {
+ return typeImpl.GetInterfaces ();
+ }
+
+ public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr) {
+ return typeImpl.GetMember (name, type, bindingAttr);
+ }
+
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ return typeImpl.GetMembers (bindingAttr);
+ }
+
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ //return typeImpl.GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ public override MethodInfo[] GetMethods( BindingFlags bindingAttr) {
+ return typeImpl.GetMethods (bindingAttr);
+ }
+
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ return typeImpl.GetNestedType (name, bindingAttr);
+ }
+
+ public override Type[] GetNestedTypes( BindingFlags bindingAttr) {
+ return typeImpl.GetNestedTypes (bindingAttr);
+ }
+
+ public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+ return typeImpl.GetProperties (bindingAttr);
+ }
+
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ //return typeImpl.GetPropertyImpl (name, bindingAttr, bindingAttr, returnType, types, modifiers);
+ }
+
+ protected override bool HasElementTypeImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.HasElementTypeImpl ();
+ }
+
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ return typeImpl.InvokeMember (name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
+ }
+
+ protected override bool IsArrayImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsArrayImpl ();
+ }
+
+ protected override bool IsByRefImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsByRefImpl ();
+ }
+
+ protected override bool IsCOMObjectImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsCOMObjectImpl ();
+ }
+
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return typeImpl.IsDefined (attributeType, inherit);
+ }
+
+ protected override bool IsPointerImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsPointerImpl ();
+ }
+
+ protected override bool IsPrimitiveImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsPrimitiveImpl ();
+ }
+
+ protected override bool IsValueTypeImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsValueTypeImpl ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TypeFilter.cs b/mcs/class/corlib/System.Reflection/TypeFilter.cs
new file mode 100644
index 00000000000..a7fb8baf957
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TypeFilter.cs
@@ -0,0 +1,13 @@
+// TypeAttributes.cs
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ public delegate bool TypeFilter (Type m, object filterCriteria);
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Resources/ChangeLog b/mcs/class/corlib/System.Resources/ChangeLog
new file mode 100644
index 00000000000..9026a5a93f8
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ChangeLog
@@ -0,0 +1,146 @@
+2002-08-19 Dick Porter <dick@ximian.com>
+
+ * ResourceWriter.cs: Implemented all methods
+
+ * ResourceReader.cs: Cope with our ResourceSet class name, as well
+ as theirs
+
+2002-08-18 Dick Porter <dick@ximian.com>
+
+ * ResourceReader.cs: Finished basic implementation. Some
+ optimisation in conjunction with ResourceSet still possible though
+
+2002-08-14 Dick Porter <dick@ximian.com>
+
+ * ResourceSet.cs: Throw the correct exceptions
+
+ * ResourceManager.cs: Implemented all unfinished methods
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * MissingManifestResourceException.cs: This should inherit from
+ SystemException, not Exception.
+
+2002-01-26 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReader.cs: Finsished reading resource files with just strings
+ in them. Need to figure out other types, and also resources with
+ multiple types in the same file.
+
+2002-01-24 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReader.cs: Implemented constructors. Started on the
+ GetEnumerator() method. Not done yet, but comitting for
+ 'disaster recovery' purposes.
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * *.cs: Fixed indentation. There was a stupid bug in my .emacs file.
+
+2002-1-17 Duncan Mak <duncan@duncan@ximian.com>
+
+ * ResourceSet.cs: Implemented GetObject (string, bool) and GetString
+ (string, bool). ResourceSet has no more MonoTODOs! Also added in the
+ Serializable attribute.
+
+ * *.cs: convert to Miguel's brace style.
+
+2002-01-17 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: Fixed GetNeutralResourcesLanguage () and added
+ new attributes documented in 1.0 SDK.
+
+2002-01-17 Duncan Mak <duncan@ximian.com>
+
+ * ResourceWriter.cs: Added MonoTODO decorations.
+
+ * SatelliteContractVersionAttribute.cs: added new attributes in 1.0 SDK.
+
+ * NeutralResoucesLanguageAttribute.cs: added new attributes in 1.0 SDK
+
+2002-01-16 Duncan Mak <duncan@ximian.com>
+
+ * ResourceReader.cs: Fixed some typos.
+
+ * ResourceManager.cs: After reading the tutorial from the SDK,
+ finished all the ResourceManager constructors and removed those
+ MonoTODO tags.
+
+ Removed MonoTODO from GetNeutralResourcesLanguage (Assembly)
+ because Miguel just implemented the whole class, including the
+ constructor that I needed (CultureInfo (string)).
+
+ Updated fields after reading the new docs from the final SDK.
+
+ * ResXFileRef.cs, ResXResourceReader.cs: Removed. They are part of
+ Windows.Forms and require System.Xml, which we don't have access to.
+
+2002-01-13 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: Added more MonoTODOs and cleaned up some
+ indenting.
+
+2002-01-09 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: Fixed the GetSatelliteContractVersion()
+ method. It was missing a cast before. Removed MonoTODO
+ attribute. ;-) It was tested by John Barnette, so this shouldn't break
+ the build.
+
+ * ResourceManager.cs: Removed MonoTODO attribute on GetString
+ (string), as I believe it's correct. However, GetString
+ (string, CultureInfo) is definitely broken, so I'm marking it with
+ MonoTODO there. I also added MonoTODO to IntenalGetResourceSet().
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Finalizing IResourceReader and IResourceWriter interfaces:
+ Added "new"-modifier to IResourceReader.GetEnumerator
+ * Fixed compilation issues in other *.cs, so that the
+ System.Resources namespaces can be included in the corlib build.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ResourceManager.cs : MonoTODO attribute decoration.
+
+Tue Dec 18 13:18:32 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * *.cs: fixed some of the compilation issues: missing
+ using directives, typos.
+
+2001-12-11 Duncan Mak <duncan@ximian.com>
+
+ * Checked in to CVS.
+
+2001-12-10 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs (GetNeutralResourcesLanguage):
+ (GetSatelliteContractVersion): Implemented.
+
+2001-12-09 Duncan Mak <duncan@ximian.com>
+
+ * ResXResourceReader.cs: Initial attempt.
+
+ * ResXFileRef.cs: Initial attempt.
+
+ * ResourceWriter.cs: Initial attempt.
+
+ * ResourceSet.cs (ReadResources): Implemented, with help from Radek Doulik.
+
+2001-11-28 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: First attempt.
+
+2001-11-27 Duncan Mak <duncan@ximian.com>
+
+ * ResourceSet.cs:
+ First attempt, can't continue until ResourceReader and ResourceWriter are implemented.
+
+ * SatelliteContractVersionAttribute.cs: First attempt. The spec is quite amibiguous here.
+
+ * NeutralResoucesLanguageAttribute.cs: Complete.
+
+ * MissingManifestResourceException.cs: Complete.
+
+ * IResourceReader.cs: Complete.
+
+ * IResourceWriter.cs: Complete.
diff --git a/mcs/class/corlib/System.Resources/IResourceReader.cs b/mcs/class/corlib/System.Resources/IResourceReader.cs
new file mode 100644
index 00000000000..871f202cfff
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/IResourceReader.cs
@@ -0,0 +1,20 @@
+//
+// System.Resources.IResourceReader.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.Resources
+{
+ public interface IResourceReader : IEnumerable, IDisposable
+ {
+ void Close();
+ new IDictionaryEnumerator GetEnumerator();
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/IResourceWriter.cs b/mcs/class/corlib/System.Resources/IResourceWriter.cs
new file mode 100644
index 00000000000..ec847784749
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/IResourceWriter.cs
@@ -0,0 +1,25 @@
+//
+// System.Resources.IResourceWriter.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Resources
+{
+
+ public interface IResourceWriter : IDisposable
+ {
+ void AddResource (string name, byte[] value);
+ void AddResource (string name, object value);
+ void AddResource (string name, string value);
+
+ void Close();
+
+ void Generate();
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/MissingManifestResourceException.cs b/mcs/class/corlib/System.Resources/MissingManifestResourceException.cs
new file mode 100644
index 00000000000..de7c6bbb771
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/MissingManifestResourceException.cs
@@ -0,0 +1,42 @@
+//
+// System.Resources.MissingManifestResourceException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Resources
+{
+
+ [Serializable]
+ public class MissingManifestResourceException: SystemException
+ {
+ private string param;
+
+ // Constructors
+ public MissingManifestResourceException ()
+ : base (Locale.GetText ("The assembly does not contain the resources for the required culture."))
+ {
+ }
+
+ public MissingManifestResourceException (string message)
+ :base (message)
+ {
+ }
+
+ protected MissingManifestResourceException (SerializationInfo info, StreamingContext context)
+ :base (info, context)
+ {
+ }
+
+ public MissingManifestResourceException (String message, Exception e)
+ :base (message, e)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/NeutralResourcesLanguageAttribute.cs b/mcs/class/corlib/System.Resources/NeutralResourcesLanguageAttribute.cs
new file mode 100755
index 00000000000..74e2e11776b
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/NeutralResourcesLanguageAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Resources.NeutralResourcesLanguageAttribute.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Resources
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class NeutralResourcesLanguageAttribute : Attribute
+ {
+
+ private string culture;
+
+ // Constructors
+ public NeutralResourcesLanguageAttribute (string cultureName)
+ {
+ if(cultureName==null) {
+ throw new ArgumentNullException("culture is null");
+ }
+
+ culture = cultureName;
+ }
+ public string CultureName
+ {
+ get { return culture; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/ResourceManager.cs b/mcs/class/corlib/System.Resources/ResourceManager.cs
new file mode 100644
index 00000000000..7e55ff27a99
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceManager.cs
@@ -0,0 +1,359 @@
+//
+// System.Resources.ResourceManager.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.Reflection;
+using System.Globalization;
+using System.IO;
+
+namespace System.Resources
+{
+ [Serializable]
+ public class ResourceManager
+ {
+ public static readonly int HeaderVersionNumber = 1;
+ public static readonly int MagicNumber = unchecked((int)0xBEEFCACE);
+
+ protected string BaseNameField;
+ protected Assembly MainAssembly;
+ // Maps cultures to ResourceSet objects
+ protected Hashtable ResourceSets;
+
+ private bool ignoreCase;
+ private Type resourceSetType;
+ private String resourceDir;
+
+ /* Recursing through culture parents stops here */
+ private CultureInfo neutral_culture;
+
+ // constructors
+ protected ResourceManager () {
+ ResourceSets=new Hashtable();
+ ignoreCase=false;
+ resourceSetType=typeof(ResourceSet);
+ resourceDir=null;
+ neutral_culture=null;
+ }
+
+ public ResourceManager (Type resourceSource) : this()
+ {
+ if (resourceSource == null)
+ throw new ArgumentNullException ("resourceSource is null.");
+
+ BaseNameField = resourceSource.FullName;
+ MainAssembly = resourceSource.Assembly;
+ resourceSetType = resourceSource;
+ neutral_culture = GetNeutralResourcesLanguage(MainAssembly);
+ }
+
+ public ResourceManager (string baseName, Assembly assembly) : this()
+ {
+ if (baseName == null)
+ throw new ArgumentNullException ("baseName is null.");
+ if(assembly == null)
+ throw new ArgumentNullException ("assembly is null.");
+
+ BaseNameField = baseName;
+ MainAssembly = assembly;
+ neutral_culture = GetNeutralResourcesLanguage(MainAssembly);
+ }
+
+ private Type CheckResourceSetType(Type usingResourceSet)
+ {
+ if(usingResourceSet==null) {
+ return(typeof(ResourceSet));
+ } else {
+ if (!usingResourceSet.IsSubclassOf (typeof (ResourceSet)))
+ throw new ArgumentException ("Type must be from ResourceSet.");
+
+ return(usingResourceSet);
+ }
+ }
+
+ public ResourceManager (string baseName, Assembly assembly, Type usingResourceSet) : this()
+ {
+ if (baseName == null)
+ throw new ArgumentNullException ("baseName is null.");
+ if(assembly == null)
+ throw new ArgumentNullException ("assembly is null.");
+
+ BaseNameField = baseName;
+ MainAssembly = assembly;
+ resourceSetType = CheckResourceSetType(usingResourceSet);
+ neutral_culture = GetNeutralResourcesLanguage(MainAssembly);
+ }
+
+ /* Private constructor for CreateFileBasedResourceManager */
+ private ResourceManager(String baseName, String resourceDir, Type usingResourceSet) : this()
+ {
+ if(baseName==null) {
+ throw new ArgumentNullException("The base name is null");
+ }
+ if(baseName.EndsWith(".resources")) {
+ throw new ArgumentException("The base name ends in '.resources'");
+ }
+ if(resourceDir==null) {
+ throw new ArgumentNullException("The resourceDir is null");
+ }
+
+ BaseNameField = baseName;
+ MainAssembly = null;
+ resourceSetType = CheckResourceSetType(usingResourceSet);
+ this.resourceDir = resourceDir;
+ }
+
+ public static ResourceManager CreateFileBasedResourceManager (string baseName,
+ string resourceDir, Type usingResourceSet)
+ {
+ return new ResourceManager(baseName, resourceDir, usingResourceSet);
+ }
+
+ public virtual string BaseName
+ {
+ get { return BaseNameField; }
+ }
+
+ public virtual bool IgnoreCase
+ {
+ get { return ignoreCase; }
+ set { ignoreCase = value; }
+ }
+
+ public virtual Type ResourceSetType
+ {
+ get { return resourceSetType; }
+ }
+
+ public virtual object GetObject(string name)
+ {
+ return(GetObject(name, null));
+ }
+
+ public virtual object GetObject(string name, CultureInfo culture)
+ {
+ if(name==null) {
+ throw new ArgumentNullException("name is null");
+ }
+
+ if(culture==null) {
+ culture=CultureInfo.CurrentUICulture;
+ }
+
+ lock(this) {
+ ResourceSet set=InternalGetResourceSet(culture, true, true);
+ object obj=null;
+
+ if(set != null) {
+ obj=set.GetObject(name, ignoreCase);
+ if(obj != null) {
+ return(obj);
+ }
+ }
+
+ /* Try parent cultures */
+
+ do {
+ culture=culture.Parent;
+
+ set=InternalGetResourceSet(culture, true, true);
+ if(set!=null) {
+ obj=set.GetObject(name, ignoreCase);
+ if(obj != null) {
+ return(obj);
+ }
+ }
+ } while(!culture.Equals(neutral_culture) &&
+ !culture.Equals(CultureInfo.InvariantCulture));
+ }
+
+ return(null);
+ }
+
+
+ public virtual ResourceSet GetResourceSet (CultureInfo culture,
+ bool createIfNotExists, bool tryParents)
+
+ {
+ if (culture == null) {
+ throw new ArgumentNullException ("CultureInfo is a null reference.");
+ }
+
+ lock(this) {
+ return(InternalGetResourceSet(culture, createIfNotExists, tryParents));
+ }
+ }
+
+ public virtual string GetString (string name)
+ {
+ return(GetString(name, null));
+ }
+
+ public virtual string GetString (string name, CultureInfo culture)
+ {
+ if (name == null) {
+ throw new ArgumentNullException ("Name is null.");
+ }
+
+ if(culture==null) {
+ culture=CultureInfo.CurrentUICulture;
+ }
+
+ lock(this) {
+ ResourceSet set=InternalGetResourceSet(culture, true, true);
+ string str=null;
+
+ if(set!=null) {
+ str=set.GetString(name, ignoreCase);
+ if(str!=null) {
+ return(str);
+ }
+ }
+
+ /* Try parent cultures */
+
+ do {
+ culture=culture.Parent;
+
+ set=InternalGetResourceSet(culture, true, true);
+ if(set!=null) {
+ str=set.GetString(name, ignoreCase);
+ if(str!=null) {
+ return(str);
+ }
+ }
+ } while(!culture.Equals(neutral_culture) &&
+ !culture.Equals(CultureInfo.InvariantCulture));
+ }
+
+ return(null);
+ }
+
+ protected virtual string GetResourceFileName (CultureInfo culture)
+ {
+ if(culture.Equals(CultureInfo.InvariantCulture)) {
+ return(BaseNameField + ".resources");
+ } else {
+ return(BaseNameField + culture.Name + ".resources");
+ }
+ }
+
+ protected virtual ResourceSet InternalGetResourceSet (CultureInfo culture, bool Createifnotexists, bool tryParents)
+ {
+ ResourceSet set;
+
+ /* if we already have this resource set, return it */
+ set=(ResourceSet)ResourceSets[culture];
+ if(set!=null) {
+ return(set);
+ }
+
+ if(MainAssembly != null) {
+ /* Assembly resources */
+ Stream stream;
+ string filename=GetResourceFileName(culture);
+
+ stream=MainAssembly.GetManifestResourceStream(filename);
+ if(stream==null) {
+ /* Try a satellite assembly */
+ Version sat_version=GetSatelliteContractVersion(MainAssembly);
+ Assembly a=MainAssembly.GetSatelliteAssembly(culture, sat_version);
+ stream=a.GetManifestResourceStream(filename);
+ }
+
+ if(stream!=null && Createifnotexists==true) {
+ object[] args=new Object[1];
+
+ args[0]=stream;
+
+ /* should we catch
+ * MissingMethodException, or
+ * just let someone else deal
+ * with it?
+ */
+ set=(ResourceSet)Activator.CreateInstance(resourceSetType, args);
+ }
+ } else if(resourceDir != null) {
+ /* File resources */
+ string filename=Path.Combine(resourceDir, this.GetResourceFileName(culture));
+ if(File.Exists(filename) &&
+ Createifnotexists==true) {
+ object[] args=new Object[1];
+
+ args[0]=filename;
+
+ /* should we catch
+ * MissingMethodException, or
+ * just let someone else deal
+ * with it?
+ */
+ set=(ResourceSet)Activator.CreateInstance(resourceSetType, args);
+ }
+ }
+
+ if(set==null && tryParents==true) {
+ set=this.InternalGetResourceSet(culture.Parent, Createifnotexists, tryParents);
+ }
+
+ if(set!=null) {
+ ResourceSets.Add(culture, set);
+ }
+
+ return(set);
+ }
+
+ public virtual void ReleaseAllResources ()
+ {
+ lock(this)
+ {
+ foreach (ResourceSet r in ResourceSets)
+ r.Close();
+ ResourceSets.Clear();
+ }
+ }
+
+ protected static CultureInfo GetNeutralResourcesLanguage (Assembly a)
+ {
+ object[] attrs;
+
+ attrs=a.GetCustomAttributes(typeof(NeutralResourcesLanguageAttribute), false);
+
+ if(attrs.Length==0) {
+ return(CultureInfo.InvariantCulture);
+ } else {
+ NeutralResourcesLanguageAttribute res_attr=(NeutralResourcesLanguageAttribute)attrs[0];
+
+ return(new CultureInfo(res_attr.CultureName));
+ }
+ }
+
+ protected static Version GetSatelliteContractVersion (Assembly a)
+ {
+ object[] attrs;
+
+ attrs=a.GetCustomAttributes(typeof(SatelliteContractVersionAttribute), false);
+
+ if(attrs.Length==0) {
+ return(null);
+ } else {
+ SatelliteContractVersionAttribute sat_attr=(SatelliteContractVersionAttribute)attrs[0];
+
+ /* Version(string) can throw
+ * ArgumentException if the version is
+ * invalid, but the spec for
+ * GetSatelliteContractVersion says we
+ * can throw the same exception for
+ * the same reason, so dont bother to
+ * catch it.
+ */
+ return(new Version(sat_attr.Version));
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/ResourceReader.cs b/mcs/class/corlib/System.Resources/ResourceReader.cs
new file mode 100644
index 00000000000..33acd8e18af
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceReader.cs
@@ -0,0 +1,401 @@
+//
+// System.Resources.ResourceReader.cs
+//
+// Authors:
+// Duncan Mak <duncan@ximian.com>
+// Nick Drochak <ndrochak@gol.com>
+// Dick Porter <dick@ximian.com>
+//
+// (C) 2001, 2002 Ximian Inc, http://www.ximian.com
+//
+
+using System.Collections;
+using System.Resources;
+using System.IO;
+using System.Text;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace System.Resources
+{
+ public sealed class ResourceReader : IResourceReader, IEnumerable, IDisposable
+ {
+ BinaryReader reader;
+ IFormatter formatter;
+ internal int resourceCount = 0;
+ int typeCount = 0;
+ Type[] types;
+ int[] hashes;
+ long[] positions;
+ int dataSectionOffset;
+ long nameSectionOffset;
+
+ // Constructors
+ public ResourceReader (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+
+ if (!stream.CanRead)
+ throw new ArgumentException ("Stream was not readable.");
+
+ reader = new BinaryReader(stream, Encoding.UTF8);
+ formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File|StreamingContextStates.Persistence));
+
+ ReadHeaders();
+ }
+
+ public ResourceReader (string fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("Path cannot be null.");
+
+ if (!System.IO.File.Exists (fileName))
+ throw new FileNotFoundException ("Could not find file " + Path.GetFullPath(fileName));
+
+ reader = new BinaryReader (new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read));
+ formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File|StreamingContextStates.Persistence));
+
+ ReadHeaders();
+ }
+
+ /* Read the ResourceManager header and the
+ * ResourceReader header.
+ */
+ private void ReadHeaders()
+ {
+ try {
+ int manager_magic = reader.ReadInt32();
+
+ if(manager_magic != ResourceManager.MagicNumber) {
+ throw new ArgumentException("Stream is not a valid .resources file!");
+ }
+
+ int manager_ver = reader.ReadInt32();
+ int manager_len = reader.ReadInt32();
+
+ /* We know how long the header is, even if
+ * the version number is too new
+ */
+ if(manager_ver > ResourceManager.HeaderVersionNumber) {
+ reader.BaseStream.Seek(manager_len, SeekOrigin.Current);
+ } else {
+ string reader_class=reader.ReadString();
+ if(!reader_class.StartsWith("System.Resources.ResourceReader")) {
+ throw new NotSupportedException("This .resources file requires reader class " + reader_class);
+ }
+
+ string set_class=reader.ReadString();
+ if(!set_class.StartsWith(typeof(ResourceSet).FullName) && !set_class.StartsWith("System.Resources.RuntimeResourceSet")) {
+ throw new NotSupportedException("This .resources file requires set class " + set_class);
+ }
+ }
+
+ /* Now read the ResourceReader header */
+ int reader_ver = reader.ReadInt32();
+
+ if(reader_ver != 1) {
+ throw new NotSupportedException("This .resources file requires unsupported set class version: " + reader_ver.ToString());
+ }
+
+ resourceCount = reader.ReadInt32();
+ typeCount = reader.ReadInt32();
+
+ types=new Type[typeCount];
+ for(int i=0; i<typeCount; i++) {
+ string type_name=reader.ReadString();
+
+ /* FIXME: Should we ask for
+ * type loading exceptions
+ * here?
+ */
+ types[i]=Type.GetType(type_name);
+ if(types[i]==null) {
+ throw new ArgumentException("Could not load type {0}", type_name);
+ }
+ }
+
+ /* There are between 0 and 7 bytes of
+ * padding here, consisting of the
+ * letters PAD. The next item (Hash
+ * values for each resource name) need
+ * to be aligned on an 8-byte
+ * boundary.
+ */
+
+ int pad_align=(int)(reader.BaseStream.Position & 7);
+ int pad_chars=0;
+
+ if(pad_align!=0) {
+ pad_chars=8-pad_align;
+ }
+
+ for(int i=0; i<pad_chars; i++) {
+ byte pad_byte=reader.ReadByte();
+ if(pad_byte!="PAD"[i%3]) {
+ throw new ArgumentException("Malformed .resources file (padding values incorrect)");
+ }
+ }
+
+ /* Read in the hash values for each
+ * resource name. These can be used
+ * by ResourceSet (calling internal
+ * methods) to do a fast compare on
+ * resource names without doing
+ * expensive string compares (but we
+ * dont do that yet, so far we only
+ * implement the Enumerator interface)
+ */
+ hashes=new int[resourceCount];
+ for(int i=0; i<resourceCount; i++) {
+ hashes[i]=reader.ReadInt32();
+ }
+
+ /* Read in the virtual offsets for
+ * each resource name
+ */
+ positions=new long[resourceCount];
+ for(int i=0; i<resourceCount; i++) {
+ positions[i]=reader.ReadInt32();
+ }
+
+ dataSectionOffset = reader.ReadInt32();
+ nameSectionOffset = reader.BaseStream.Position;
+ } catch(EndOfStreamException e) {
+ throw new ArgumentException("Stream is not a valied .resources file! It was possibly truncated.", e);
+ }
+ }
+
+ /* Cut and pasted from BinaryReader, because it's
+ * 'protected' there
+ */
+ private int Read7BitEncodedInt() {
+ int ret = 0;
+ int shift = 0;
+ byte b;
+
+ do {
+ b = reader.ReadByte();
+
+ ret = ret | ((b & 0x7f) << shift);
+ shift += 7;
+ } while ((b & 0x80) == 0x80);
+
+ return ret;
+ }
+
+ private string ResourceName(int index)
+ {
+ lock(this)
+ {
+ long pos=positions[index]+nameSectionOffset;
+ reader.BaseStream.Seek(pos, SeekOrigin.Begin);
+
+ /* Read a 7-bit encoded byte length field */
+ int len=Read7BitEncodedInt();
+ byte[] str=new byte[len];
+
+ reader.Read(str, 0, len);
+ return Encoding.Unicode.GetString(str);
+ }
+ }
+
+ private object ResourceValue(int index)
+ {
+ lock(this)
+ {
+ long pos=positions[index]+nameSectionOffset;
+ reader.BaseStream.Seek(pos, SeekOrigin.Begin);
+
+ /* Read a 7-bit encoded byte length field */
+ long len=Read7BitEncodedInt();
+ /* ... and skip that data to the info
+ * we want, the offset into the data
+ * section
+ */
+ reader.BaseStream.Seek(len, SeekOrigin.Current);
+
+ long data_offset=reader.ReadInt32();
+ reader.BaseStream.Seek(data_offset+dataSectionOffset, SeekOrigin.Begin);
+ int type_index=Read7BitEncodedInt();
+ Type type=types[type_index];
+
+ if (type==typeof(Byte)) {
+ return(reader.ReadByte());
+ /* for some reason Char is serialized */
+ /*} else if (type==typeof(Char)) {
+ return(reader.ReadChar());*/
+ } else if (type==typeof(Decimal)) {
+ return(reader.ReadDecimal());
+ } else if (type==typeof(DateTime)) {
+ return(new DateTime(reader.ReadInt64()));
+ } else if (type==typeof(Double)) {
+ return(reader.ReadDouble());
+ } else if (type==typeof(Int16)) {
+ return(reader.ReadInt16());
+ } else if (type==typeof(Int32)) {
+ return(reader.ReadInt32());
+ } else if (type==typeof(Int64)) {
+ return(reader.ReadInt64());
+ } else if (type==typeof(SByte)) {
+ return(reader.ReadSByte());
+ } else if (type==typeof(Single)) {
+ return(reader.ReadSingle());
+ } else if (type==typeof(String)) {
+ return(reader.ReadString());
+ } else if (type==typeof(TimeSpan)) {
+ return(new TimeSpan(reader.ReadInt64()));
+ } else if (type==typeof(UInt16)) {
+ return(reader.ReadUInt16());
+ } else if (type==typeof(UInt32)) {
+ return(reader.ReadUInt32());
+ } else if (type==typeof(UInt64)) {
+ return(reader.ReadUInt64());
+ } else {
+ /* non-intrinsic types are
+ * serialized
+ */
+ object obj=formatter.Deserialize(reader.BaseStream);
+ if(obj.GetType() != type) {
+ /* We got a bogus
+ * object. This
+ * exception is the
+ * best match I could
+ * find. (.net seems
+ * to throw
+ * BadImageFormatException,
+ * which the docs
+ * state is used when
+ * file or dll images
+ * cant be loaded by
+ * the runtime.)
+ */
+ throw new InvalidOperationException("Deserialized object is wrong type");
+ }
+
+ return(obj);
+ }
+ }
+ }
+
+ public void Close ()
+ {
+ Dispose(true);
+ }
+
+ public IDictionaryEnumerator GetEnumerator () {
+ if (reader == null){
+ throw new InvalidOperationException("ResourceReader is closed.");
+ }
+ else {
+ return new ResourceEnumerator (this);
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return ((IResourceReader) this).GetEnumerator();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose(true);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if(disposing) {
+ if(reader!=null) {
+ reader.Close();
+ }
+ }
+
+ reader=null;
+ hashes=null;
+ positions=null;
+ types=null;
+ }
+
+ internal class ResourceEnumerator : IDictionaryEnumerator
+ {
+ private ResourceReader reader;
+ private int index = -1;
+ private bool finished = false;
+
+ internal ResourceEnumerator(ResourceReader readerToEnumerate){
+ reader = readerToEnumerate;
+ }
+
+ public virtual DictionaryEntry Entry
+ {
+ get {
+ if (reader.reader == null)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+
+ DictionaryEntry entry = new DictionaryEntry();
+ entry.Key = Key;
+ entry.Value = Value;
+ return entry;
+ }
+ }
+
+ public virtual object Key
+ {
+ get {
+ if (reader.reader == null)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+ return (reader.ResourceName(index));
+ }
+ }
+
+ public virtual object Value
+ {
+ get {
+ if (reader.reader == null)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+ return(reader.ResourceValue(index));
+ }
+ }
+
+ public virtual object Current
+ {
+ get {
+ /* Entry does the checking, no
+ * need to repeat it here
+ */
+ return Entry;
+ }
+ }
+
+ public virtual bool MoveNext ()
+ {
+ if (reader.reader == null)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (finished) {
+ return false;
+ }
+
+ if (++index < reader.resourceCount){
+ return true;
+ }
+ else {
+ finished=true;
+ return false;
+ }
+ }
+
+ public void Reset () {
+ if (reader.reader == null)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ index = -1;
+ finished = false;
+ }
+ } // internal class ResourceEnumerator
+ } // public sealed class ResourceReader
+} // namespace System.Resources
diff --git a/mcs/class/corlib/System.Resources/ResourceSet.cs b/mcs/class/corlib/System.Resources/ResourceSet.cs
new file mode 100644
index 00000000000..14a954c8e2e
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceSet.cs
@@ -0,0 +1,148 @@
+//
+// System.Resources.ResourceSet.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.IO;
+
+namespace System.Resources
+{
+ [Serializable]
+ public class ResourceSet : IDisposable
+ {
+
+ protected IResourceReader Reader;
+ protected Hashtable Table;
+
+ // Constructors
+ protected ResourceSet () {}
+
+ public ResourceSet (IResourceReader reader)
+ {
+ if (reader == null)
+ throw new ArgumentNullException ("The reader is null.");
+ Reader = reader;
+ }
+
+ public ResourceSet (Stream stream)
+ {
+ if(stream==null) {
+ throw new ArgumentNullException("stream is null");
+ }
+
+ if(!stream.CanRead) {
+ throw new ArgumentException("stream is not readable");
+ }
+
+ Reader = new ResourceReader (stream);
+ }
+
+ public ResourceSet (String fileName)
+ {
+ if(fileName==null) {
+ throw new ArgumentNullException("filename is null");
+ }
+
+ Reader = new ResourceReader (fileName);
+ }
+
+ public virtual void Close ()
+ {
+ Dispose (true);
+ }
+
+ public void Dispose()
+ {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing) {
+ if(Reader!=null) {
+ Reader.Close();
+ }
+ }
+
+ Reader = null;
+ Table = null;
+ }
+
+ public virtual Type GetDefaultReader ()
+ {
+ return (typeof (ResourceReader));
+ }
+ public virtual Type GetDefaultWriter ()
+ {
+ return (typeof (ResourceWriter));
+ }
+
+ public virtual object GetObject (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("The name parameter is null.");
+ if (Reader == null)
+ throw new InvalidOperationException ("The ResourceSet has been closed.");
+
+ if (Table == null) {
+ ReadResources ();
+ }
+
+ return(Table[name]);
+ }
+
+ public virtual object GetObject (string name, bool ignoreCase)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("The name parameter is null.");
+ if (Reader == null)
+ throw new InvalidOperationException ("ResourceSet has been closed.");
+ if (Table == null)
+ ReadResources ();
+
+ if (ignoreCase) {
+ foreach (DictionaryEntry de in Table) {
+ string key = (string) de.Key;
+ if (String.Compare (key, name, true) == 0)
+ return de.Value;
+ }
+ return null;
+ } else
+ return Table[name];
+ }
+
+ public virtual string GetString (string name)
+ {
+ Object o = GetObject (name);
+ if (o is string)
+ return (string) o;
+ throw new InvalidOperationException("Not a string");
+ }
+
+ public virtual string GetString (string name, bool ignoreCase)
+ {
+ Object o = GetObject (name, ignoreCase);
+ if (o is string)
+ return (string) o;
+ throw new InvalidOperationException("Not a string");
+ }
+
+ protected virtual void ReadResources ()
+ {
+ IDictionaryEnumerator i = Reader.GetEnumerator();
+
+ if (Table == null)
+ Table = new Hashtable ();
+ i.Reset ();
+
+ while (i.MoveNext ())
+ Table.Add (i.Key, i.Value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/ResourceWriter.cs b/mcs/class/corlib/System.Resources/ResourceWriter.cs
new file mode 100644
index 00000000000..1875b2b995c
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceWriter.cs
@@ -0,0 +1,335 @@
+//
+// System.Resources.ResourceWriter.cs
+//
+// Authors:
+// Duncan Mak <duncan@ximian.com>
+// Dick Porter <dick@ximian.com>
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+using System.Collections;
+using System.Text;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace System.Resources
+{
+ public sealed class ResourceWriter : IResourceWriter, IDisposable
+ {
+ Hashtable resources;
+ Stream stream;
+
+ public ResourceWriter (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream is null");
+ if (stream.CanWrite == false)
+ throw new ArgumentException ("stream is not writable.");
+
+ this.stream=stream;
+ resources=new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
+ }
+
+ public ResourceWriter (String fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName is null.");
+
+ stream=new FileStream(fileName, FileMode.Create, FileAccess.Write);
+ resources=new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
+ }
+
+ public void AddResource (string name, byte[] value)
+ {
+ if (name == null) {
+ throw new ArgumentNullException ("name is null");
+ }
+ if (value == null) {
+ throw new ArgumentNullException ("value is null");
+ }
+ if(resources==null) {
+ throw new InvalidOperationException ("ResourceWriter has been closed");
+ }
+ if(resources[name]!=null) {
+ throw new ArgumentException ("Resource already present: " + name);
+ }
+
+ resources.Add(name, value);
+ }
+
+ public void AddResource (string name, object value)
+ {
+ if (name == null) {
+ throw new ArgumentNullException ("name is null");
+ }
+ if (value == null) {
+ throw new ArgumentNullException ("value is null");
+ }
+ if(resources==null) {
+ throw new InvalidOperationException ("ResourceWriter has been closed");
+ }
+ if(resources[name]!=null) {
+ throw new ArgumentException ("Resource already present: " + name);
+ }
+
+ resources.Add(name, value);
+ }
+
+ public void AddResource (string name, string value)
+ {
+ if (name == null) {
+ throw new ArgumentNullException ("name is null");
+ }
+ if (value == null) {
+ throw new ArgumentNullException ("value is null");
+ }
+ if(resources==null) {
+ throw new InvalidOperationException ("ResourceWriter has been closed");
+ }
+ if(resources[name]!=null) {
+ throw new ArgumentException ("Resource already present: " + name);
+ }
+
+ resources.Add(name, value);
+ }
+
+ public void Close () {
+ Dispose(true);
+ }
+
+ public void Dispose ()
+ {
+ Dispose(true);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if(disposing) {
+ if(resources.Count>0 && generated==false) {
+ Generate();
+ }
+ if(stream!=null) {
+ stream.Close();
+ }
+ }
+ resources=null;
+ stream=null;
+ }
+
+ private bool generated=false;
+
+ public void Generate () {
+ BinaryWriter writer;
+ IFormatter formatter;
+
+ if(resources==null) {
+ throw new InvalidOperationException ("ResourceWriter has been closed");
+ }
+
+ if(generated) {
+ throw new InvalidOperationException ("ResourceWriter can only Generate() once");
+ }
+ generated=true;
+
+ writer=new BinaryWriter(stream, Encoding.UTF8);
+ formatter=new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File|StreamingContextStates.Persistence));
+
+ /* The ResourceManager header */
+
+ writer.Write(ResourceManager.MagicNumber);
+ writer.Write(ResourceManager.HeaderVersionNumber);
+
+ /* Build the rest of the ResourceManager
+ * header in memory, because we need to know
+ * how long it is in advance
+ */
+ MemoryStream resman_stream=new MemoryStream();
+ BinaryWriter resman=new BinaryWriter(resman_stream,
+ Encoding.UTF8);
+
+ resman.Write(typeof(ResourceReader).AssemblyQualifiedName);
+ resman.Write(typeof(ResourceSet).AssemblyQualifiedName);
+
+ /* Only space for 32 bits of header len in the
+ * resource file format
+ */
+ int resman_len=(int)resman_stream.Length;
+ writer.Write(resman_len);
+ writer.Write(resman_stream.GetBuffer(), 0, resman_len);
+
+ /* We need to build the ResourceReader name
+ * and data sections simultaneously
+ */
+ MemoryStream res_name_stream=new MemoryStream();
+ BinaryWriter res_name=new BinaryWriter(res_name_stream, Encoding.Unicode);
+
+ MemoryStream res_data_stream=new MemoryStream();
+ BinaryWriter res_data=new BinaryWriter(res_data_stream,
+ Encoding.UTF8);
+
+ /* Not sure if this is the best collection to
+ * use, I just want an unordered list of
+ * objects with fast lookup, but without
+ * needing a key. (I suppose a hashtable with
+ * key==value would work, but I need to find
+ * the index of each item later)
+ */
+ ArrayList types=new ArrayList();
+ int[] hashes=new int[resources.Count];
+ int[] name_offsets=new int[resources.Count];
+ int count=0;
+
+ IDictionaryEnumerator res_enum=resources.GetEnumerator();
+ while(res_enum.MoveNext()) {
+ Type type=res_enum.Value.GetType();
+
+ /* Keep a list of unique types */
+ if(!types.Contains(type)) {
+ types.Add(type);
+ }
+
+ /* Hash the name */
+ hashes[count]=GetHash((string)res_enum.Key);
+
+ /* Record the offsets */
+ name_offsets[count]=(int)res_name.BaseStream.Position;
+
+ /* Write the name section */
+ res_name.Write((string)res_enum.Key);
+ res_name.Write((int)res_data.BaseStream.Position);
+
+ /* Write the data section */
+ Write7BitEncodedInt(res_data, types.IndexOf(type));
+ /* Strangely, Char is serialized
+ * rather than just written out
+ */
+ if(type==typeof(Byte)) {
+ res_data.Write((Byte)res_enum.Value);
+ } else if (type==typeof(Decimal)) {
+ res_data.Write((Decimal)res_enum.Value);
+ } else if (type==typeof(DateTime)) {
+ res_data.Write(((DateTime)res_enum.Value).Ticks);
+ } else if (type==typeof(Double)) {
+ res_data.Write((Double)res_enum.Value);
+ } else if (type==typeof(Int16)) {
+ res_data.Write((Int16)res_enum.Value);
+ } else if (type==typeof(Int32)) {
+ res_data.Write((Int32)res_enum.Value);
+ } else if (type==typeof(Int64)) {
+ res_data.Write((Int64)res_enum.Value);
+ } else if (type==typeof(SByte)) {
+ res_data.Write((SByte)res_enum.Value);
+ } else if (type==typeof(Single)) {
+ res_data.Write((Single)res_enum.Value);
+ } else if (type==typeof(String)) {
+ res_data.Write((String)res_enum.Value);
+ } else if (type==typeof(TimeSpan)) {
+ res_data.Write(((TimeSpan)res_enum.Value).Ticks);
+ } else if (type==typeof(UInt16)) {
+ res_data.Write((UInt16)res_enum.Value);
+ } else if (type==typeof(UInt32)) {
+ res_data.Write((UInt32)res_enum.Value);
+ } else if (type==typeof(UInt64)) {
+ res_data.Write((UInt64)res_enum.Value);
+ } else {
+ /* non-intrinsic types are
+ * serialized
+ */
+ formatter.Serialize(res_data.BaseStream, res_enum.Value);
+ }
+
+ count++;
+ }
+
+ /* Sort the hashes, keep the name offsets
+ * matching up
+ */
+ Array.Sort(hashes, name_offsets);
+
+ /* now do the ResourceReader header */
+
+ writer.Write(1);
+ writer.Write(resources.Count);
+ writer.Write(types.Count);
+
+ /* Write all of the unique types */
+ foreach(Type type in types) {
+ writer.Write(type.AssemblyQualifiedName);
+ }
+
+ /* Pad the next fields (hash values) on an 8
+ * byte boundary, using the letters "PAD"
+ */
+ int pad_align=(int)(writer.BaseStream.Position & 7);
+ int pad_chars=0;
+
+ if(pad_align!=0) {
+ pad_chars=8-pad_align;
+ }
+
+ for(int i=0; i<pad_chars; i++) {
+ writer.Write((byte)"PAD"[i%3]);
+ }
+
+ /* Write the hashes */
+ for(int i=0; i<resources.Count; i++) {
+ writer.Write(hashes[i]);
+ }
+
+ /* and the name offsets */
+ for(int i=0; i<resources.Count; i++) {
+ writer.Write(name_offsets[i]);
+ }
+
+ /* Write the data section offset */
+ int data_offset=(int)writer.BaseStream.Position +
+ (int)res_name_stream.Length + 4;
+ writer.Write(data_offset);
+
+ /* The name section goes next */
+ writer.Write(res_name_stream.GetBuffer(), 0,
+ (int)res_name_stream.Length);
+ /* The data section is last */
+ writer.Write(res_data_stream.GetBuffer(), 0,
+ (int)res_data_stream.Length);
+
+ res_name.Close();
+ res_data.Close();
+
+ /* Don't close writer, according to the spec */
+ writer.Flush();
+ }
+
+ private int GetHash(string name)
+ {
+ uint hash=5381;
+
+ for(int i=0; i<name.Length; i++) {
+ hash=((hash<<5)+hash)^name[i];
+ }
+
+ return((int)hash);
+ }
+
+ /* Cut and pasted from BinaryWriter, because it's
+ * 'protected' there.
+ */
+ private void Write7BitEncodedInt(BinaryWriter writer,
+ int value)
+ {
+ do {
+ int high = (value >> 7) & 0x01ffffff;
+ byte b = (byte)(value & 0x7f);
+
+ if (high != 0) {
+ b = (byte)(b | 0x80);
+ }
+
+ writer.Write(b);
+ value = high;
+ } while(value != 0);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs b/mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs
new file mode 100644
index 00000000000..a0bf1bd0614
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Resources.SatelliteContractVersionAttribute.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Resources
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class SatelliteContractVersionAttribute : Attribute
+ {
+ private Version ver;
+
+ // Constructor
+ public SatelliteContractVersionAttribute (string version)
+ {
+ ver = new Version(version);
+ }
+ public string Version
+ {
+ get { return ver.ToString(); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.cs
new file mode 100644
index 00000000000..8343f11197a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.CompilerServices.AccessedThroughPropertyAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage (AttributeTargets.Field)]
+ public sealed class AccessedThroughPropertyAttribute : Attribute
+ {
+ string name;
+ public AccessedThroughPropertyAttribute (string propertyName)
+ {
+ name = propertyName;
+ }
+
+ public string PropertyName {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CallConvCdecl.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvCdecl.cs
new file mode 100644
index 00000000000..939584d895e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvCdecl.cs
@@ -0,0 +1,14 @@
+//
+// System.Runtime.CompilerServices.CallConvCdecl.cs
+//
+// Author: Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ public class CallConvCdecl {
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CallConvFastcall.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvFastcall.cs
new file mode 100644
index 00000000000..9a7ef264d75
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvFastcall.cs
@@ -0,0 +1,14 @@
+//
+// System.Runtime.CompilerServices.CallConvFastcall.cs
+//
+// Author: Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ public class CallConvFastcall {
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CallConvStdcall.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvStdcall.cs
new file mode 100644
index 00000000000..7d96d02e095
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvStdcall.cs
@@ -0,0 +1,14 @@
+//
+// System.Runtime.CompilerServices.CallConvStdcall.cs
+//
+// Author: Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ public class CallConvStdcall {
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CallConvThiscall.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvThiscall.cs
new file mode 100644
index 00000000000..b651b18edc5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CallConvThiscall.cs
@@ -0,0 +1,14 @@
+//
+// System.Runtime.CompilerServices.CallConvThiscall.cs
+//
+// Author: Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ public class CallConvThiscall {
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog b/mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog
new file mode 100644
index 00000000000..9fde826cb64
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog
@@ -0,0 +1,66 @@
+2002-09-21 Zoltan Varga <vargaz@freemail.hu>
+
+ * CallConvCdecl.cs: new file
+
+ * CallConvFastcall.cs: new file
+
+ * CallConvThiscall.cs: new file
+
+ * CallConvStdcall.cs: new file
+
+ * RuntimeHelpers.cs: Implemented OffsetToStringData, GetObjectValue and
+ RunClassConstructor.
+
+2002-08-23 Nick Drochak <ndrochak@gol.com>
+
+ * IsVolatile.cs: No _public_ members, but if we don't put a private
+ ctor, the complier will give us a public one.
+
+2002-08-23 Nick Drochak <ndrochak@gol.com>
+
+ * IsVolatile.cs: This class has no members, not even an empty ctor.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * AccessedThroughPropertyAttribute.cs:
+ * CompilationRelaxationsAttribute.cs:
+ * CompilerGlobalScopeAttribute.cs:
+ * DateTimeConstantAttribute.cs:
+ * DecimalConstantAttribute.cs:
+ * IDispatchConstantAttribute.cs:
+ * IsVolatile.cs:
+ * IUnknownConstantAttribute.cs:
+ * RequiredAttributeAttribute.cs: Visibility changes.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * AccessedThroughPropertyAttribute.cs:
+ * CompilationRelaxationsAttribute.cs:
+ * CompilerGlobalScopeAttribute.cs:
+ * CustomConstantAttribute.cs:
+ * DateTimeConstantAttribute.cs:
+ * DecimalConstantAttribute.cs:
+ * DiscardableAttribute.cs:
+ * IDispatchConstantAttribute.cs:
+ * IUnknownConstantAttribute.cs:
+ * RequiredAttributeAttribute.cs: Added all the missing Attributes
+
+ * IsVolatile.cs: Added to CVS.
+
+ * MethodImplOptions.cs: Added the PreserveSig flag.
+
+2002-04-15 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * MethodImplAttribute.cs: added constructor usage.
+
+Fri Feb 22 15:36:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * RuntimeHelpers.cs: added OffsetToStringData() property.
+
+Mon Nov 5 19:50:11 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * RuntimeHelpers.cs: make InitializeArray an internalcall.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * MethodCodeType.cs, MethodImplOptions.cs: Add.
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CompilationRelaxationsAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CompilationRelaxationsAttribute.cs
new file mode 100644
index 00000000000..71e3e4835d9
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CompilationRelaxationsAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.CompilerServices.CompilationRelaxationsAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage (AttributeTargets.Module)] [Serializable]
+ public class CompilationRelaxationsAttribute : Attribute
+ {
+ int relax;
+ public CompilationRelaxationsAttribute (int relaxations)
+ {
+ relax = relaxations;
+ }
+
+ public int CompilationRelaxations {
+ get { return relax; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CompilerGlobalScopeAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CompilerGlobalScopeAttribute.cs
new file mode 100644
index 00000000000..a317cb52b0d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CompilerGlobalScopeAttribute.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.CompilerServices.CompilerGlobalScopeAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage (AttributeTargets.Class)] [Serializable]
+ public class CompilerGlobalScopeAttribute : Attribute
+ {
+ public CompilerGlobalScopeAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/CustomConstantAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/CustomConstantAttribute.cs
new file mode 100644
index 00000000000..cdfadad31ec
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/CustomConstantAttribute.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.CompilerServices.CustomConstantAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage (AttributeTargets.Class)] [Serializable]
+ public abstract class CustomConstantAttribute : Attribute
+ {
+ protected CustomConstantAttribute ()
+ {
+ }
+
+ public abstract object Value { get; }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/DateTimeConstantAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/DateTimeConstantAttribute.cs
new file mode 100644
index 00000000000..7bb937e3bf6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/DateTimeConstantAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Runtime.CompilerServices.DateTimeConstantAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [Serializable]
+ [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter)]
+ public sealed class DateTimeConstantAttribute : CustomConstantAttribute
+ {
+ long ticks;
+
+ public DateTimeConstantAttribute (long ticks)
+ {
+ this.ticks = ticks;
+ }
+
+ public override object Value {
+ get { return ticks; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/DecimalConstantAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/DecimalConstantAttribute.cs
new file mode 100644
index 00000000000..0d242a55484
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/DecimalConstantAttribute.cs
@@ -0,0 +1,35 @@
+//
+// System.Runtime.CompilerServices.DecimalConstantAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [Serializable] [CLSCompliant (false)]
+ [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter)]
+ public sealed class DecimalConstantAttribute : Attribute
+ {
+ byte scale;
+ bool sign;
+ int hi;
+ int mid;
+ int low;
+
+ public DecimalConstantAttribute (byte scale, byte sign, uint hi, uint mid, uint low)
+ {
+ this.scale = scale;
+ this.sign = Convert.ToBoolean (sign);
+ this.hi = (int) hi;
+ this.mid = (int) mid;
+ this.low = (int) low;
+ }
+
+ public Decimal Value {
+ get { return new Decimal (low, mid, hi, sign, scale); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/DiscardableAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/DiscardableAttribute.cs
new file mode 100644
index 00000000000..2271065ad98
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/DiscardableAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.CompilerServices.DiscardableAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ public class DiscardableAttribute : Attribute
+ {
+ public DiscardableAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/IDispatchConstantAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/IDispatchConstantAttribute.cs
new file mode 100644
index 00000000000..f0a2cad5b1b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/IDispatchConstantAttribute.cs
@@ -0,0 +1,24 @@
+//
+// System.Runtime.CompilerServices.IDispatchConstantAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [Serializable]
+ [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter)]
+ public sealed class IDispatchConstantAttribute : CustomConstantAttribute
+ {
+ public IDispatchConstantAttribute ()
+ {
+ }
+
+ public override object Value {
+ get { return null; } // this is correct.
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/IUnknownConstantAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/IUnknownConstantAttribute.cs
new file mode 100644
index 00000000000..c8808ff4ba5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/IUnknownConstantAttribute.cs
@@ -0,0 +1,24 @@
+//
+// System.Runtime.CompilerServices.IUnknownConstantAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [Serializable]
+ [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter)]
+ public sealed class IUnknownConstantAttribute : CustomConstantAttribute
+ {
+ public IUnknownConstantAttribute ()
+ {
+ }
+
+ public override object Value {
+ get { return null; } // this is correct.
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs
new file mode 100755
index 00000000000..cf61a66b979
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.CompilerServices.IndexerNameAttributecs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage(AttributeTargets.Property, Inherited=false)] [Serializable]
+ public sealed class IndexerNameAttribute : Attribute {
+ public IndexerNameAttribute (string indexer_name)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/IsVolatile.cs b/mcs/class/corlib/System.Runtime.CompilerServices/IsVolatile.cs
new file mode 100644
index 00000000000..f8a26c17dd0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/IsVolatile.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.CompilerServices.IsVolatile.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+ public sealed class IsVolatile
+ {
+ private IsVolatile()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs b/mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs
new file mode 100644
index 00000000000..3608120e516
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs
@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+//
+// System.Runtime.CompilerServices.MethodCodeType.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Thu 07/18/2001
+//
+//------------------------------------------------------------------------------
+
+namespace System.Runtime.CompilerServices
+{
+
+public enum MethodCodeType
+{
+ IL,
+ Native,
+ OPTIL,
+ Runtime,
+}
+
+} // Namespace
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs
new file mode 100644
index 00000000000..41aed97dcab
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.Runtime.CompilerServices.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited=false)] [Serializable]
+ public sealed class MethodImplAttribute : Attribute {
+ MethodImplOptions impl_options;
+
+ public MethodImplAttribute ()
+ {
+ }
+
+ public MethodImplAttribute (short options)
+ {
+ impl_options = (MethodImplOptions) options;
+ }
+
+ public MethodImplAttribute (MethodImplOptions options)
+ {
+ impl_options = options;
+ }
+
+ public MethodCodeType MethodCodeType;
+
+ public MethodImplOptions Value {
+ get {
+ return impl_options;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs
new file mode 100644
index 00000000000..45a98baeb79
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs
@@ -0,0 +1,46 @@
+// MethodImplOptions.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:23 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.CompilerServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MethodImplOptions {
+
+ /// <summary>
+ /// </summary>
+ Unmanaged = 4,
+
+ /// <summary>
+ /// </summary>
+ ForwardRef = 16,
+
+ /// <summary>
+ /// </summary>
+ InternalCall = 4096,
+
+ /// <summary>
+ /// </summary>
+ Synchronized = 32,
+
+ /// <summary>
+ /// </summary>
+ NoInlining = 8,
+
+ /// <summary>
+ /// </summary>
+ PreserveSig = 128,
+
+ } // MethodImplOptions
+
+} // System.Runtime.CompilerServices
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/RequiredAttributeAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/RequiredAttributeAttribute.cs
new file mode 100644
index 00000000000..1489b1b32f3
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/RequiredAttributeAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.CompilerServices.RequiredAttributeAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian Inc.
+
+using System;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface)]
+ [Serializable]
+ public sealed class RequiredAttributeAttribute : Attribute
+ {
+ public RequiredAttributeAttribute (Type requiredContract)
+ {
+ }
+
+ public Type RequiredContract {
+ get { throw new NotSupportedException (); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs b/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs
new file mode 100644
index 00000000000..9f0836d9c22
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs
@@ -0,0 +1,39 @@
+// System.Runtime.CompilerServices.RuntimeHelpers
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+namespace System.Runtime.CompilerServices
+{
+ [Serializable]
+ public sealed class RuntimeHelpers
+ {
+ private static int offset_to_string_data;
+
+ static RuntimeHelpers () {
+ offset_to_string_data = GetOffsetToStringData();
+ }
+
+ private RuntimeHelpers () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void InitializeArray (Array array, RuntimeFieldHandle fldHandle);
+
+ public static int OffsetToStringData {
+ get {
+ return offset_to_string_data;
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern object GetObjectValue (object obj);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void RunClassConstructor (RuntimeTypeHandle type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int GetOffsetToStringData();
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.Expando/Changelog b/mcs/class/corlib/System.Runtime.InteropServices.Expando/Changelog
new file mode 100644
index 00000000000..81e31e8744c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices.Expando/Changelog
@@ -0,0 +1,3 @@
+2002-11-20 Alejandro Sánchez Acosta <raciel@es.gnu.org>
+
+ * IExpando.cs added.
diff --git a/mcs/class/corlib/System.Runtime.InteropServices.Expando/IExpando.cs b/mcs/class/corlib/System.Runtime.InteropServices.Expando/IExpando.cs
new file mode 100644
index 00000000000..98c3b8015ac
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices.Expando/IExpando.cs
@@ -0,0 +1,26 @@
+//
+// System.Runtime.InteropServices.Expando.IExpando.cs
+//
+// Author:
+// Alejandro Sánchez Acosta (raciel@es.gnu.org)
+//
+// (C) Alejandro Sánchez Acosta
+//
+
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace System.Runtime.InteropServices.Expando
+{
+ //[Guid("")]
+ public interface IExpando : IReflect
+ {
+ FieldInfo AddField (string name);
+
+ MethodInfo AddMethod (string name, Delegate method);
+
+ PropertyInfo AddProperty(string name);
+
+ void RemoveMember(MemberInfo m);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs
new file mode 100755
index 00000000000..479122692c7
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.AssemblyRegistrationFlags.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Flags]
+ [Serializable]
+ public enum AssemblyRegistrationFlags {
+ None = 0,
+ SetCodeBase,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs
new file mode 100755
index 00000000000..3dfdc572adb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.InteropServices.AutomationProxyAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Interface)]
+ public sealed class AutomationProxyAttribute : Attribute
+ {
+ bool val;
+
+ public AutomationProxyAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ public bool Value {
+ get { return val; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/BINDPTR.cs b/mcs/class/corlib/System.Runtime.InteropServices/BINDPTR.cs
new file mode 100755
index 00000000000..7bb93ac6769
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/BINDPTR.cs
@@ -0,0 +1,20 @@
+
+// System.Runtime.InteropServices/BINDPTR.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ [ComVisible(false)]
+ public struct BINDPTR {
+ public IntPtr lpfuncdesc;
+ public IntPtr lptcomp;
+ public IntPtr lpvardesc;
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/COMException.cs b/mcs/class/corlib/System.Runtime.InteropServices/COMException.cs
new file mode 100644
index 00000000000..0d720b04967
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/COMException.cs
@@ -0,0 +1,39 @@
+//
+// COMException.cs - COM Exception
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Runtime.InteropServices {
+
+[Serializable]
+public class COMException : ExternalException {
+
+ public COMException ()
+ : base () {}
+
+ public COMException (string message)
+ : base (message) {}
+
+ public COMException (string message, Exception inner)
+ : base (message, inner) {}
+
+ public COMException (string message, int errorCode)
+ : base (message, errorCode) {}
+
+ protected COMException (SerializationInfo info, StreamingContext context)
+ : base (info, context) {}
+
+ [MonoTODO()]
+ public override string ToString ()
+ {
+ return null;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs b/mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs
new file mode 100644
index 00000000000..7f2c24d2b0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs
@@ -0,0 +1,41 @@
+// CallingConvention.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:29 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum CallingConvention {
+
+ /// <summary>
+ /// </summary>
+ Winapi = 1,
+
+ /// <summary>
+ /// </summary>
+ Cdecl = 2,
+
+ /// <summary>
+ /// </summary>
+ StdCall = 3,
+
+ /// <summary>
+ /// </summary>
+ ThisCall = 4,
+
+ /// <summary>
+ /// </summary>
+ FastCall = 5,
+ } // CallingConvention
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
new file mode 100644
index 00000000000..e446fca55c9
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
@@ -0,0 +1,172 @@
+2003-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * COMException.cs: New. Minimal (incomplete - i'm not using COM)
+ implementation because this is thrown when dealing with Software
+ Publisher Certificates (SPC) in X509Certificate.
+
+2002-08-22 Nick Drochak <ndrochak@gol.com>
+
+ * OutAttribute.cs: TypeID isn't overriden from Attribute here.
+ * PInvokeMap.cs: Non-existent enum. Must be from beta days.
+
+2002-06-24 root <dietmar@ximian.com>
+
+ * Marshal.cs: impl. Copy()
+
+Fri Jun 14 16:18:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * UnmanagedType.cs, Marshal.cs: minor fixes.
+
+Wed Jun 12 16:32:13 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Marshal.c: stubbed out all the methods and filled in some
+ implementation.
+ * BINDPTR.cs, ComMemberType.cs, DESCKIND.cs, DISPPARAMS.cs,
+ EXCEPINFO.cs, INVOKEKIND.cs, TYPEKIND.cs, UCOMTypeInfo.cs,
+ UCOMTypeLib.cs: enums, interfaces and structs needed in Marshal class.
+
+Tue Jun 4 18:05:30 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * GCHandle.cs: changed to fit spec and implementation needs.
+
+Tue May 14 16:35:13 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * CharSet.cs: added missing None enum item.
+
+2002-04-26 Joe Shaw <joe@ximian.com>
+
+ * Marshal.cs (StructureToPtr): stub this out.
+
+2002-04-23 Joe Shaw <joe@ximian.com>
+
+ * Marshal.cs: Stub out a few functions to get gtk# to build.
+
+2002-04-22 Duncan Mak <duncan@ximian.com>
+
+ * ImporterEventKind.cs:
+ * TypeLibFuncFlags.cs:
+ * TypeLibTypeFlags.cs:
+ * TypeLibVarFlags.cs: Fixed various typos and added missing elements.
+
+ * ComConventionLossAttribute.cs: Removed, there's a typo.
+ * ComConversionLossAttribute.cs: Same attribute, slight change of name.
+
+ * PreserveSigAttribute.cs:
+ * ImportedFromTypeLibAttribute.cs: Added missing AttributeUsage
+ attribute.
+
+ * TypeLibFuncAttribute.cs:
+ * TypeLibTypeAttribute.cs:
+ * TypeLibVarAttribute.cs: Added missing constructors.
+
+
+2002-04-22 Duncan Mak <duncan@ximian.com>
+
+ * AutomationProxyAttribute.cs:
+ * CoClassAttribute.cs:
+ * ComAliasNameAttribute.cs:
+ * ComConventionLossAttribute.cs:
+ * ComEventInterfaceAttribute.cs:
+ * ComImportAttribute.cs:
+ * ComRegisterFunctionAttribute.cs:
+ * ComUnregisterFunctionAttribute.cs:
+ * DispIdAttribute.cs:
+ * ImportedFromTypeLibAttribute.cs:
+ * LCIDConversionAttribute.cs:
+ * PreserveSigAttribute.cs:
+ * PrimaryInteropAssemblyAttribute.cs:
+ * ProgIdAttribute.cs:
+ * TypeLibFuncAttribute.cs:
+ * TypeLibFuncFlags.cs:
+ * TypeLibTypeAttribute.cs:
+ * TypeLibTypeFlags.cs:
+ * TypeLibVarAttribute.cs:
+ * TypeLibVarFlags.cs: Added to CVS.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * Marshal.cs: Make class public.
+ * ComVisible.cs: New File.
+
+2002-03-24 Nick Drochak <ndrochak@gol.com>
+
+ * ClassInterfaceAttribute.cs:
+ * ClassInterfaceType.cs: New Files.
+
+2002-02-27 Duncan Mak <duncan@ximian.com>
+
+ * ExporterEventKind.cs:
+ * ITypeLibConverter.cs:
+ * ITypeLibImporterNotifySink.cs: Added to CVS for Kevin Winchester <kwin@ns.sympatico.ca>.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * ComInterfaceType.cs: Added to CVS.
+
+ * AssemblyRegistrationFlags.cs:
+ * GuidAttribute.cs:
+ * ICustomAdapter.cs:
+ * ICustomFactory.cs:
+ * ICustomMarshaler.cs:
+ * IRegistrationServices.cs:
+ * ITypeLibExporterNameProvider.cs:
+ * ITypeLibImporterNotifySink.cs:
+ * InterfaceTypeAttribute.cs:
+ * TypeLibExporterFlags.cs: Committed for Kevin Winchester <kwin@ns.sympatico.ca>.
+
+ * GCHandle.cs: Added to CVS. Patch from Ajay kumar Dwivedi.
+
+ * GCHandleType.cs: Committed patch from Ajay.
+
+ * ImporterEventKind.cs: Added to CVS.
+
+2002-01-24 Miguel de Icaza <miguel@ximian.com>
+
+ * StructLayoutAttribute.cs: Flag attribute as targetting structs
+ or classes.
+
+ * InAttribute.cs: Flag attribute as targettting a paramter
+
+ * OutAttribute.cs: ditto.
+
+ * DllImportAttribute.cs: Flag attribute as targetting methods.
+
+ * MarshalAsAttribute.cs: Flag attribute as targetting fields,
+ parameters and returnvalues.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * Marshal.cs: Added GetLastWin32Error()
+
+ * ExternalException.cs: Implemented
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * ExternalException.cs: Add ExternalException.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * OutAttribute.cs : Decorate with MonoTODO.
+
+Thu Dec 20 15:46:31 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FieldOffsetAttribute.cs, InAttribute.cs, MarshalAsAttribute.cs,
+ OptionalAttribute.cs, StructLayoutAttribute.cs, VarEnum.cs:
+ more stuff needed by the compiler.
+
+Thu Dec 13 20:22:18 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DllImportAttribute.cs: added.
+ * MethodImplOptions.cs: removed: this is already in CompilerServices.
+
+Wed Nov 14 17:02:57 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * CallingConvention.cs: add missing Winapi.
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * OutAttribute.cs: New file.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * CallingConvention.cs.cs, CharSet.cs, GCHandleType.cs, LayoutKind.cs: Add.
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs b/mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs
new file mode 100644
index 00000000000..27ae60765e6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs
@@ -0,0 +1,35 @@
+// CharSet.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:35 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum CharSet {
+
+ None = 1,
+
+ /// <summary>
+ /// </summary>
+ Ansi = 2,
+
+ /// <summary>
+ /// </summary>
+ Unicode = 3,
+
+ /// <summary>
+ /// </summary>
+ Auto = 4,
+ } // CharSet
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs
new file mode 100644
index 00000000000..47aa4ebed92
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs
@@ -0,0 +1,30 @@
+//
+// System.Runtime.InteropServices.ClassInterfaceAttribute.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class)]
+ public sealed class ClassInterfaceAttribute : Attribute {
+ private ClassInterfaceType ciType;
+
+ public ClassInterfaceAttribute ( short classInterfaceType ) {
+ ciType = (ClassInterfaceType)classInterfaceType;
+ }
+
+ public ClassInterfaceAttribute ( ClassInterfaceType classInterfaceType ) {
+ ciType = classInterfaceType;
+ }
+
+ public ClassInterfaceType Value {
+ get {return ciType;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs
new file mode 100644
index 00000000000..963c2880a1a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs
@@ -0,0 +1,24 @@
+//
+// System.Runtime.InteropServices.ClassInterfaceType.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+
+namespace System.Runtime.InteropServices {
+
+ [Serializable]
+ public enum ClassInterfaceType
+ {
+ None = 0,
+
+ AutoDispatch = 1,
+
+ AutoDual = 2
+
+ } // ClassInterfaceType
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs
new file mode 100755
index 00000000000..c947887612d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs
@@ -0,0 +1,26 @@
+//
+// System.Runtime.InteropServices.CoClassAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Interface)]
+ public sealed class CoClassAttribute : Attribute
+ {
+
+ Type klass;
+
+ public CoClassAttribute (Type coClass)
+ {
+ klass = coClass;
+ }
+
+ public Type CoClass {
+ get { return klass; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs
new file mode 100755
index 00000000000..60119849175
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Runtime.InteropServices.ComAliasNameAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field |
+ AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public sealed class ComAliasNameAttribute : Attribute
+ {
+ string val;
+
+ public ComAliasNameAttribute (string alias)
+ {
+ val = alias;
+ }
+
+ public string Value {
+ get { return val; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs
new file mode 100755
index 00000000000..2260d5ae488
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.InteropServices.ComConversionLossAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class ComConversionLossAttribute : Attribute
+ {
+ public ComConversionLossAttribute ()
+ {
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs
new file mode 100755
index 00000000000..f03e371c898
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.Runtime.InteropServices.ComEventInterfaceAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Interface)]
+ public sealed class ComEventInterfaceAttribute : Attribute
+ {
+ Type si, ep;
+
+ public ComEventInterfaceAttribute (Type SourceInterface,
+ Type EventProvider)
+ {
+ si = SourceInterface;
+ ep = EventProvider;
+ }
+
+ public Type EventProvider {
+ get { return ep; }
+ }
+
+ public Type SourceInterface {
+ get { return si; }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
new file mode 100755
index 00000000000..325c5091f7b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.InteropServices.ComImportAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Class |
+ AttributeTargets.Interface)]
+ public sealed class ComImportAttribute : Attribute
+ {
+ public ComImportAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs
new file mode 100755
index 00000000000..8d7c7a6b669
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.InteropServices.ComInterfaceType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable] public enum ComInterfaceType
+ {
+ InterfaceIsDual = 0,
+ InterfaceIsIUnknown = 1,
+ InterfaceIsIDispatch = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComMemberType.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComMemberType.cs
new file mode 100755
index 00000000000..8e66ff211d1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComMemberType.cs
@@ -0,0 +1,19 @@
+
+// System.Runtime.InteropServices/ComMemberType.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable]
+ public enum ComMemberType {
+ Method = 0,
+ PropGet = 1,
+ PropSet = 2
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs
new file mode 100755
index 00000000000..27a27076213
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.ComRegisterFunctionAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class ComRegisterFunctionAttribute : Attribute
+ {
+ public ComRegisterFunctionAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs
new file mode 100755
index 00000000000..6d2fc1ed2e1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.InteropServices.ComUnregisterFunctionAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class ComUnregisterFunctionAttribute : Attribute
+ {
+ public ComUnregisterFunctionAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs
new file mode 100644
index 00000000000..ad22b254c23
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.ComVisible.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Enum |
+ AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Interface |
+ AttributeTargets.Delegate)]
+ public sealed class ComVisibleAttribute : Attribute
+ {
+ private bool Visible = false;
+ public ComVisibleAttribute(bool value) {Visible = value;}
+ public bool Value { get {return Visible;} }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DESCKIND.cs b/mcs/class/corlib/System.Runtime.InteropServices/DESCKIND.cs
new file mode 100755
index 00000000000..b312119c6f1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/DESCKIND.cs
@@ -0,0 +1,24 @@
+
+// System.Runtime.InteropServices/DESCKIND.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ [Serializable]
+ [ComVisible(false)]
+ public enum DESCKIND {
+ DESCKIND_NONE = 0,
+ DESCKIND_FUNCDESC = 1,
+ DESCKIND_VARDESC = 2,
+ DESCKIND_TYPECOMP = 3,
+ DESCKIND_IMPLICITAPPOBJ = 4,
+ DESCKIND_MAX = 5
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs b/mcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs
new file mode 100755
index 00000000000..c84dde79aa8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs
@@ -0,0 +1,21 @@
+
+// System.Runtime.InteropServices/DISPPARAMS.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ [ComVisible(false)]
+ public struct DISPPARAMS {
+ public int cArgs;
+ public int cNamedArgs;
+ public IntPtr rgdispidNamedArgs;
+ public IntPtr rgvarg;
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs
new file mode 100755
index 00000000000..139c331bb53
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.DispIdAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Event)]
+ public sealed class DispIdAttribute : Attribute
+ {
+ int id;
+
+ public DispIdAttribute (int dispId)
+ {
+ id = dispId;
+ }
+
+ public int Value {
+ get { return id; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs
new file mode 100755
index 00000000000..9d6466527ea
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs
@@ -0,0 +1,33 @@
+//
+// System.Runtime.InteropServices/DllImportAttribute.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class DllImportAttribute: Attribute {
+ public CallingConvention CallingConvention;
+ public CharSet CharSet;
+ public string EntryPoint;
+ public bool ExactSpelling;
+ public bool PreserveSig;
+ public bool SetLastError;
+ private string Dll;
+
+ public string Value {
+ get {return Dll;}
+ }
+
+ public DllImportAttribute (string dllName) {
+ Dll = dllName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs b/mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs
new file mode 100755
index 00000000000..1c29b3223a6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs
@@ -0,0 +1,25 @@
+
+// System.Runtime.InteropServices/EXCEPINFO.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ [ComVisible(false)]
+ public struct EXCEPINFO {
+ public string bstrDescription;
+ public string bstrHelpFile;
+ public string bstrSource;
+ public int dwHelpContext;
+ public IntPtr pfnDeferredFillIn;
+ public IntPtr pvReserved;
+ public short wCode;
+ public short wReserved;
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs b/mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs
new file mode 100644
index 00000000000..d80e2ed847d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.ExporterEventKind.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable] public enum ExporterEventKind
+ {
+ NOTIF_TYPECONVERTED = 0,
+ NOTIF_CONVERTWARNING = 1,
+ ERROR_REFTOINVALIDASSEMBLY = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs b/mcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs
new file mode 100755
index 00000000000..014074cef21
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs
@@ -0,0 +1,50 @@
+//
+// System.Runtime.InteropServices.ExternalException.cs
+//
+// Author:
+// Miguel De Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Runtime.InteropServices {
+ [Serializable]
+ public class ExternalException : SystemException {
+ private int error_code;
+
+ // Constructors
+ public ExternalException ()
+ : base (Locale.GetText ("External exception"))
+ {
+ }
+
+ public ExternalException (string message)
+ : base (message)
+ {
+ }
+
+ protected ExternalException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public ExternalException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public ExternalException (string message, int errorCode)
+ : base (message)
+ {
+ error_code = errorCode;
+ }
+
+ public virtual int ErrorCode {
+ get {
+ return error_code;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs
new file mode 100755
index 00000000000..a5deebb0675
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Field)]
+ public sealed class FieldOffsetAttribute : Attribute {
+ private int val;
+
+ public FieldOffsetAttribute( int offset) {
+ val = offset;
+ }
+ public int Value {
+ get {return val;}
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs b/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs
new file mode 100755
index 00000000000..cd277c63a53
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs
@@ -0,0 +1,108 @@
+//
+// System.Runtime.InteropServices/GCHandle.cs
+//
+// Authors:
+// Ajay kumar Dwivedi (adwiv@yahoo.com) ??
+// Paolo Molaro (lupus@ximian.com)
+//
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Runtime.InteropServices
+{
+ /// <summary>
+ /// Summary description for GCHandle.
+ /// </summary>
+ public struct GCHandle
+ {
+ // fields
+ private int handle;
+
+ private GCHandle(IntPtr h)
+ {
+ handle = (int)h;
+ }
+
+ // Constructors
+ private GCHandle(object obj)
+ : this(obj, GCHandleType.Normal)
+ {}
+
+ private GCHandle(object value, GCHandleType type)
+ {
+ handle = GetTargetHandle (value, 0, type);
+ }
+
+ // Properties
+
+ public bool IsAllocated
+ {
+ get
+ {
+ return (handle != 0);
+ }
+ }
+
+ public object Target
+ {
+ get
+ {
+ return GetTarget (handle);
+ }
+ set
+ {
+ handle = GetTargetHandle (value, handle, (GCHandleType)(-1));
+ }
+ }
+
+ // Methods
+ public IntPtr AddrOfPinnedObject()
+ {
+ IntPtr res = GetAddrOfPinnedObject(handle);
+ if (res == IntPtr.Zero)
+ throw new InvalidOperationException("The handle is not of Pinned type");
+ return res;
+ }
+
+ public static System.Runtime.InteropServices.GCHandle Alloc(object value)
+ {
+ return new GCHandle (value);
+ }
+
+ public static System.Runtime.InteropServices.GCHandle Alloc(object value, GCHandleType type)
+ {
+ return new GCHandle (value,type);
+ }
+
+ public void Free()
+ {
+ FreeHandle(handle);
+ handle = 0;
+ }
+
+ public static explicit operator IntPtr (GCHandle value)
+ {
+ return (IntPtr) value.handle;
+ }
+
+ public static explicit operator GCHandle(IntPtr value)
+ {
+ return new GCHandle (value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static object GetTarget(int handle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int GetTargetHandle(object obj, int handle, GCHandleType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void FreeHandle(int handle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static IntPtr GetAddrOfPinnedObject(int handle);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs b/mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs
new file mode 100644
index 00000000000..bee7c8b8436
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs
@@ -0,0 +1,38 @@
+// GCHandleType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:42 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum GCHandleType {
+
+
+ /// <summary>
+ /// </summary>
+ Weak = 0,
+
+ /// <summary>
+ /// </summary>
+ WeakTrackResurrection = 1,
+
+ /// <summary>
+ /// </summary>
+ Normal = 2,
+
+ /// <summary>
+ /// </summary>
+ Pinned = 3,
+ } // GCHandleType
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs
new file mode 100755
index 00000000000..1fd1a44f85e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.InAttribute.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate)]
+ public sealed class GuidAttribute : Attribute {
+
+ private string guidValue;
+
+ public GuidAttribute (string guid) {
+ guidValue = guid;
+ }
+
+ public string Value {
+ get {return guidValue;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs b/mcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs
new file mode 100755
index 00000000000..edde7b22cc0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.InteropServices.ICustomAdapter.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ public interface ICustomAdapter {
+ object GetUnderlyingObject ();
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs b/mcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs
new file mode 100755
index 00000000000..c5f1cb23eea
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.InteropServices.ICustomFactory.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ public interface ICustomFactory {
+ MarshalByRefObject CreateInstance (Type serverType);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs b/mcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs
new file mode 100755
index 00000000000..90a2b29b619
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.InteropServices.ICustomMarshaler.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ public interface ICustomMarshaler {
+ void CleanUpManagedData (object ManagedObj);
+ void CleanUpNativeData (IntPtr pNativeData);
+ int GetNativeDataSize ();
+ IntPtr MarshalManagedToNative (object ManagedObj);
+ object MarshalNativeToManaged (IntPtr pNativeData);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs b/mcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs
new file mode 100755
index 00000000000..4c318507e5f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs
@@ -0,0 +1,22 @@
+
+// System.Runtime.InteropServices/INVOKEKIND.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ [Serializable]
+ [ComVisible(false)]
+ public enum INVOKEKIND {
+ INVOKE_FUNC = 1,
+ INVOKE_PROPERTYGET = 2,
+ INVOKE_PROPERTYPUT = 4,
+ INVOKE_PROPERTYPUTREF = 8
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs b/mcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs
new file mode 100755
index 00000000000..a42e935895c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.IRegistrationServices.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ public interface IRegistrationServices {
+ Guid GetManagedCategoryGuid ();
+ string GetProgIdForType (Type type);
+ Type[] GetRegistrableTypesInAssembly (Assembly assembly);
+ bool RegisterAssembly (Assembly assembly, AssemblyRegistrationFlags flags);
+ void RegisterTypeForComClients (Type type, ref Guid g);
+ bool TypeRepresentsComType (Type type);
+ bool TypeRequiresRegistration (Type type);
+ bool UnregisterAssembly (Assembly assembly);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs
new file mode 100644
index 00000000000..78be2912f6b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.InteropServices.ITypeLibConverter.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibConverter {
+ object ConvertAssemblyToTypeLib (Assembly assembly, string typeLibName, TypeLibExporterFlags flags, ITypeLibExporterNotifySink notifySink);
+ AssemblyBuilder ConvertTypeLibToAssembly (object typeLib, string asmFileName, int flags, ITypeLibImporterNotifySink notifySink, byte[] publicKey, StrongNameKeyPair keyPair, bool unsafeInterfaces);
+ bool GetPrimaryInteropAssembly (Guid g, int major, int minor, int lcid, out string asmName, out string asmCodeBase);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
new file mode 100755
index 00000000000..3e937ae4b22
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.ITypeLibExporterNameProvider.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibExporterNameProvider {
+ string[] GetNames ();
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
new file mode 100644
index 00000000000..547b87d73d3
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.InteropServices.ITypeLibExporterNotifySink.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibExporterNotifySink {
+ void ReportEvent (ExporterEventKind eventKind, int eventCode, string eventMsg);
+ object ResolveRef (Assembly assembly);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
new file mode 100755
index 00000000000..3c9199e4063
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.InteropServices.ITypeLibImporterNotifySink.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibImporterNotifySink {
+ void ReportEvent(ImporterEventKind eventKind, int eventCode, string eventMsg);
+ Assembly ResolveRef(object typeLib);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs
new file mode 100755
index 00000000000..f4403eb8c27
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs
@@ -0,0 +1,26 @@
+//
+// System.Runtime.InteropServices.ImportedFromTypeLibAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ImportedFromTypeLibAttribute : Attribute
+ {
+ string TlbFile;
+ public ImportedFromTypeLibAttribute (string tlbFile)
+ {
+ TlbFile = tlbFile;
+ }
+
+ public string Value {
+ get { return TlbFile; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs b/mcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs
new file mode 100755
index 00000000000..c896b7e053f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.InteropServices.ImporterEventKind.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable] public enum ImporterEventKind
+ {
+ NOTIF_TYPECONVERTED = 0,
+ NOTIF_CONVERTWARNING = 1,
+ ERROR_REFTOINVALIDTYPELIB = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs
new file mode 100755
index 00000000000..b141d9dbc49
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.InAttribute.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class InAttribute : Attribute {
+ public InAttribute () {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs
new file mode 100755
index 00000000000..e8cbd5ae9b7
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Runtime.InteropServices.InterfaceTypeAttribute.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Interface)]
+ public sealed class InterfaceTypeAttribute : Attribute {
+
+ private ComInterfaceType intType;
+
+ public InterfaceTypeAttribute (ComInterfaceType interfaceType){
+ intType = interfaceType;
+ }
+
+ public InterfaceTypeAttribute (short interfaceType) {
+ intType = (ComInterfaceType)interfaceType;
+ }
+
+ public ComInterfaceType Value {
+ get {return intType;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs
new file mode 100755
index 00000000000..af04cccc1e4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Runtime.InteropServices.LCIDConversionAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class LCIDConversionAttribute : Attribute
+ {
+ int id;
+
+ public LCIDConversionAttribute (int lcid)
+ {
+ id = lcid;
+ }
+
+ public int Value {
+ get { return id; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs b/mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs
new file mode 100644
index 00000000000..960cc3d551e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs
@@ -0,0 +1,33 @@
+// LayoutKind.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:48 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum LayoutKind {
+
+ /// <summary>
+ /// </summary>
+ Sequential = 0,
+
+ /// <summary>
+ /// </summary>
+ Explicit = 2,
+
+ /// <summary>
+ /// </summary>
+ Auto = 3,
+ } // LayoutKind
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
new file mode 100644
index 00000000000..57f67135308
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
@@ -0,0 +1,556 @@
+// System.Runtime.InteropServices.Marshal
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001-2002 Ximian, Inc.
+
+using System.Runtime.CompilerServices;
+using System;
+using System.Reflection;
+using System.Threading;
+
+namespace System.Runtime.InteropServices
+{
+ public sealed class Marshal
+ {
+ /* fields */
+ public static readonly int SystemMaxDBCSCharSize = 2; // don't know what this is
+ public static readonly int SystemDefaultCharSize = 2;
+
+ private Marshal () {}
+
+ [MonoTODO]
+ public static int AddRef (IntPtr pUnk) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static IntPtr AllocCoTaskMem (int cb) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr AllocHGlobal (IntPtr cb);
+
+ public static IntPtr AllocHGlobal (int cb) {
+ return AllocHGlobal ((IntPtr)cb);
+ }
+
+ [MonoTODO]
+ public static object BindToMoniker (string monikerName) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void ChangeWrapperHandleStrength (object otp, bool fIsWeak) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static void copy_to_unmanaged (Array source, int startIndex,
+ IntPtr destination, int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static void copy_from_unmanaged (IntPtr source, int startIndex,
+ Array destination, int length);
+
+ public static void Copy (byte[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (char[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (short[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (int[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (long[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (float[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (double[] source, int startIndex, IntPtr destination, int length) {
+ copy_to_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, byte[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, char[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, short[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, int[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, long[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, float[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ public static void Copy (IntPtr source, double[] destination, int startIndex, int length) {
+ copy_from_unmanaged (source, startIndex, destination, length);
+ }
+
+ [MonoTODO]
+ public static object CreateWrapperOfType (object o, Type t) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void DestroyStructure (IntPtr ptr, Type structuretype);
+
+ [MonoTODO]
+ public static void FreeBSTR (IntPtr ptr) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void FreeCoTaskMem (IntPtr ptr) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void FreeHGlobal (IntPtr hglobal);
+
+ [MonoTODO]
+ public static Guid GenerateGuidForType (Type type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GenerateProgIdForType (Type type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetActiveObject (string progID) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetComInterfaceForObject (object o, Type T) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetComObjectData (object obj, object key) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetComSlotForMethodInfo (MemberInfo m) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetEndComSlot (Type t) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetExceptionCode() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetExceptionPointers() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetHINSTANCE (Module m) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetHRForException (Exception e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetHRForLastWin32Error() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetIDispatchForObject (object o) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetITypeInfoForType (Type t) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetIUnknownForObject (object o) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern int GetLastWin32Error();
+
+ [MonoTODO]
+ public static IntPtr GetManagedThunkForUnmanagedMethodPtr (IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static MemberInfo GetMethodInfoForComSlot (Type t, int slot, ref ComMemberType memberType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void GetNativeVariantForObject (object obj, IntPtr pDstNativeVariant) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetObjectForIUnknown (IntPtr pUnk) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object[] GetObjectsForNativeVariants (IntPtr aSrcNativeVariant, int cVars) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetStartComSlot (Type t) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Thread GetThreadFromFiberCookie (int cookie) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetTypedObjectForIUnknown (IntPtr pUnk, Type t) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeForITypeInfo (IntPtr piTypeInfo) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GetTypeInfoName (UCOMITypeInfo pTI) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Guid GetTypeLibGuid (UCOMITypeLib pTLB) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Guid GetTypeLibGuidForAssembly (Assembly asm) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int GetTypeLibLcid (UCOMITypeLib pTLB) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string GetTypeLibName (UCOMITypeLib pTLB) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr GetUnmanagedThunkForManagedMethodPtr (IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsComObject (object o) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool IsTypeVisibleFromCom (Type t) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int NumParamBytes (MethodInfo m) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr OffsetOf (Type t, string fieldName);
+
+ [MonoTODO]
+ public static void Prelink (MethodInfo m) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void PrelinkAll (Type c) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringAnsi (IntPtr ptr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringAnsi (IntPtr ptr, int len);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringAuto (IntPtr ptr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringAuto (IntPtr ptr, int len);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringUni (IntPtr ptr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringUni (IntPtr ptr, int len);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static string PtrToStringBSTR (IntPtr ptr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void PtrToStructure (IntPtr ptr, object structure);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static object PtrToStructure (IntPtr ptr, Type structureType);
+
+ [MonoTODO]
+ public static int QueryInterface (IntPtr pUnk, ref Guid iid, out IntPtr ppv) {
+ throw new NotImplementedException ();
+ }
+
+ public static byte ReadByte (IntPtr ptr) {
+ return ReadByte (ptr, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static byte ReadByte (IntPtr ptr, int ofs);
+
+ [MonoTODO]
+ public static byte ReadByte (object ptr, int ofs) {
+ throw new NotImplementedException ();
+ }
+
+ public static short ReadInt16 (IntPtr ptr) {
+ return ReadInt16 (ptr, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static short ReadInt16 (IntPtr ptr, int ofs);
+
+ [MonoTODO]
+ public static short ReadInt16 (object ptr, int ofs) {
+ throw new NotImplementedException ();
+ }
+
+ public static int ReadInt32 (IntPtr ptr) {
+ return ReadInt32 (ptr, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int ReadInt32 (IntPtr ptr, int ofs);
+
+ [MonoTODO]
+ public static int ReadInt32 (object ptr, int ofs) {
+ throw new NotImplementedException ();
+ }
+
+ public static long ReadInt64 (IntPtr ptr) {
+ return ReadInt64 (ptr, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static long ReadInt64 (IntPtr ptr, int ofs);
+
+ [MonoTODO]
+ public static long ReadInt64(object ptr, int ofs) {
+ throw new NotImplementedException ();
+ }
+
+ public static IntPtr ReadIntPtr (IntPtr ptr) {
+ return ReadIntPtr (ptr, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr ReadIntPtr (IntPtr ptr, int ofs);
+
+ [MonoTODO]
+ public static IntPtr ReadIntPtr(object ptr, int ofs) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr ReAllocCoTaskMem (IntPtr pv, int cb) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr ReAllocHGlobal (IntPtr pv, IntPtr cb);
+
+ [MonoTODO]
+ public static int Release (IntPtr pUnk) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static int ReleaseComObject (object o) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void ReleaseThreadCache() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static bool SetComObjectData (object obj, object key, object data) {
+ throw new NotImplementedException ();
+ }
+
+ public static int SizeOf (object structure) {
+ return SizeOf (structure.GetType ());
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int SizeOf (Type t);
+
+ [MonoTODO]
+ public static IntPtr StringToBSTR (string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr StringToCoTaskMemAnsi (string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr StringToCoTaskMemAuto (string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr StringToCoTaskMemUni (string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr StringToHGlobalAnsi (string s);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr StringToHGlobalAuto (string s);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr StringToHGlobalUni (string s);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void StructureToPtr (object structure, IntPtr ptr, bool fDeleteOld);
+
+ [MonoTODO]
+ public static void ThrowExceptionForHR (int errorCode) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void ThrowExceptionForHR (int errorCode, IntPtr errorInfo) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr UnsafeAddrOfPinnedArrayElement (Array arr, int index) {
+ throw new NotImplementedException ();
+ }
+
+ public static void WriteByte (IntPtr ptr, byte val) {
+ WriteByte (ptr, 0, val);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void WriteByte (IntPtr ptr, int ofs, byte val);
+
+ [MonoTODO]
+ public static void WriteByte(object ptr, int ofs, byte val) {
+ throw new NotImplementedException ();
+ }
+
+ public static void WriteInt16 (IntPtr ptr, short val) {
+ WriteInt16 (ptr, 0, val);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void WriteInt16 (IntPtr ptr, int ofs, short val);
+
+ [MonoTODO]
+ public static void WriteInt16(object ptr, int ofs, short val) {
+ throw new NotImplementedException ();
+ }
+
+ public static void WriteInt32 (IntPtr ptr, int val) {
+ WriteInt32 (ptr, 0, val);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void WriteInt32 (IntPtr ptr, int ofs, int val);
+
+ [MonoTODO]
+ public static void WriteInt32(object ptr, int ofs, int val) {
+ throw new NotImplementedException ();
+ }
+
+ public static void WriteInt64 (IntPtr ptr, long val) {
+ WriteInt64 (ptr, 0, val);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void WriteInt64 (IntPtr ptr, int ofs, long val);
+
+ [MonoTODO]
+ public static void WriteInt64(object ptr, int ofs, long val) {
+ throw new NotImplementedException ();
+ }
+
+ public static void WriteIntPtr (IntPtr ptr, IntPtr val) {
+ WriteIntPtr (ptr, 0, val);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void WriteIntPtr (IntPtr ptr, int ofs, IntPtr val);
+
+ [MonoTODO]
+ public static void WriteIntPtr(object ptr, int ofs, IntPtr val) {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs
new file mode 100755
index 00000000000..48e9f523d07
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs
@@ -0,0 +1,27 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public sealed class MarshalAsAttribute : Attribute {
+ private UnmanagedType utype;
+ public UnmanagedType ArraySubType;
+ public string MarshalCookie;
+ public string MarshalType;
+ public Type MarshalTypeRef;
+ public VarEnum SafeArraySubType;
+ public int SizeConst;
+ public short SizeParamIndex;
+
+ public MarshalAsAttribute (short unmanagedType) {
+ utype = (UnmanagedType)unmanagedType;
+ }
+ public MarshalAsAttribute( UnmanagedType unmanagedType) {
+ utype = unmanagedType;
+ }
+ public UnmanagedType Value {
+ get {return utype;}
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs
new file mode 100755
index 00000000000..d53f5291fa0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class OptionalAttribute : Attribute {
+ public OptionalAttribute () {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs
new file mode 100644
index 00000000000..98b843497ac
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.InteropServices.OutAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class OutAttribute : Attribute {
+
+ public OutAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs
new file mode 100755
index 00000000000..691cef7c7df
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs
@@ -0,0 +1,19 @@
+// System.Runtime.InteropServices.PreserveSigAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class PreserveSigAttribute : Attribute
+ {
+ public PreserveSigAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs
new file mode 100755
index 00000000000..b39858e6cde
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class PrimaryInteropAssemblyAttribute : Attribute
+ {
+ int major, minor;
+
+ public PrimaryInteropAssemblyAttribute (int major, int minor)
+ {
+ this.major = major;
+ this.minor = minor;
+ }
+
+ public int MajorVersion {
+ get { return major; }
+ }
+
+ public int MinorVersion {
+ get { return minor; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs
new file mode 100755
index 00000000000..7db764fef0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.InteropServices.ProgIdAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ProgIdAttribute : Attribute
+ {
+ string pid;
+
+ public ProgIdAttribute (string progId)
+ {
+ pid = progId;
+ }
+
+ public string Value {
+ get { return pid; }
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs
new file mode 100755
index 00000000000..420e70efa0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs
@@ -0,0 +1,23 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct)]
+ public sealed class StructLayoutAttribute : Attribute {
+ public CharSet CharSet = CharSet.Auto;
+ public int Pack = 8;
+ public int Size = 0;
+ private LayoutKind lkind;
+
+ public StructLayoutAttribute( short layoutKind) {
+ lkind = (LayoutKind)layoutKind;
+ }
+ public StructLayoutAttribute( LayoutKind layoutKind) {
+ lkind = layoutKind;
+ }
+ public LayoutKind Value {
+ get {return lkind;}
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TYPEKIND.cs b/mcs/class/corlib/System.Runtime.InteropServices/TYPEKIND.cs
new file mode 100755
index 00000000000..58c91af6788
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TYPEKIND.cs
@@ -0,0 +1,27 @@
+
+// System.Runtime.InteropServices/TYPEKIND.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ [Serializable]
+ [ComVisible(false)]
+ public enum TYPEKIND {
+ TKIND_ENUM = 0,
+ TKIND_RECORD = 1,
+ TKIND_MODULE = 2,
+ TKIND_INTERFACE = 3,
+ TKIND_DISPATCH = 4,
+ TKIND_COCLASS = 5,
+ TKIND_ALIAS = 6,
+ TKIND_UNION = 7,
+ TKIND_MAX = 8
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs
new file mode 100755
index 00000000000..7f7c7695412
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs
@@ -0,0 +1,16 @@
+//
+// System.Runtime.InteropServices.TypeLibExporterFlags.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Flags] [Serializable]
+ public enum TypeLibExporterFlags {
+ OnlyReferenceRegistered = 1,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs
new file mode 100755
index 00000000000..c58eaccbec2
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.TypeLibFuncAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class TypeLibFuncAttribute : Attribute
+ {
+ TypeLibFuncFlags flags;
+
+ public TypeLibFuncAttribute (short flags)
+ {
+ this.flags = (TypeLibFuncFlags) flags;
+ }
+
+ public TypeLibFuncAttribute (TypeLibFuncFlags flags)
+ {
+ this.flags = flags;
+ }
+
+ public TypeLibFuncFlags Value {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs
new file mode 100755
index 00000000000..b0768bca301
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs
@@ -0,0 +1,25 @@
+// System.Runtime.InteropServices.TypeLibFuncFlags.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+ [Flags] [Serializable]
+ public enum TypeLibFuncFlags {
+ FRestricted = 1,
+ FSource = 2,
+ FBindable = 4,
+ FRequestEdit = 8,
+ FDisplayBind = 16,
+ FDefaultBind = 32,
+ FHidden = 64,
+ FUsesGetLastError = 128,
+ FDefaultCollelem = 256,
+ FUiDefault = 512,
+ FNonBrowsable = 1024,
+ FReplaceable = 2048,
+ FImmediateBind = 4096,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs
new file mode 100755
index 00000000000..d76bfcd814b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.TypeLibTypeAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class TypeLibTypeAttribute : Attribute
+ {
+ TypeLibTypeFlags flags;
+
+ public TypeLibTypeAttribute (short flags)
+ {
+ this.flags = (TypeLibTypeFlags) flags;
+ }
+
+ public TypeLibTypeAttribute (TypeLibTypeFlags flags)
+ {
+ this.flags = flags;
+ }
+
+ public TypeLibTypeFlags Value {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs
new file mode 100755
index 00000000000..adf5297698a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs
@@ -0,0 +1,26 @@
+// System.Runtime.InteropServices.TypeLibTypeFlags.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+ [Flags] [Serializable]
+ public enum TypeLibTypeFlags {
+ FAppObject = 1,
+ FCanCreate = 2,
+ FLicensed = 4,
+ FPreDeclId = 8,
+ FHidden= 16,
+ FControl = 32,
+ FDual = 64,
+ FNonExtensible = 128,
+ FOleAutomation = 256,
+ FRestricted = 512,
+ FAggregatable = 1024,
+ FReplaceable = 2048,
+ FDispatchable = 4096,
+ FReverseBind = 8192,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs
new file mode 100755
index 00000000000..1e5f2a4792c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.TypeLibTypeAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class TypeLibVarAttribute : Attribute
+ {
+ TypeLibVarFlags flags;
+
+ public TypeLibVarAttribute (short flags)
+ {
+ this.flags = (TypeLibVarFlags) flags;
+ }
+
+ public TypeLibVarAttribute (TypeLibVarFlags flags)
+ {
+ this.flags = flags;
+ }
+
+ public TypeLibVarFlags Value {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs
new file mode 100755
index 00000000000..5bf60e5a03a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs
@@ -0,0 +1,26 @@
+// System.Runtime.InteropServices.TypeLibVarFlags.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+
+ [Flags] [Serializable]
+ public enum TypeLibVarFlags {
+ FReadOnly = 1,
+ FSource = 2,
+ FBindable = 4,
+ FRequestEdit = 8,
+ FDisplayBind = 16,
+ FDefaultBind = 32,
+ FHidden = 64,
+ FRestricted = 128,
+ FDefaultCollelem = 256,
+ FUiDefault = 512,
+ FNonBrowsable = 1024,
+ FReplaceable = 2048,
+ FImmediateBind = 4096,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeComp.cs b/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeComp.cs
new file mode 100755
index 00000000000..8bb02c82f49
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeComp.cs
@@ -0,0 +1,20 @@
+
+// System.Runtime.InteropServices/UCOMITypeComp.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface UCOMITypeComp {
+ void Bind( string szName, int lHashVal, short wFlags, out UCOMITypeInfo ppTInfo, out DESCKIND pDescKind, out BINDPTR pBindPtr);
+ void BindType( string szName, int lHashVal, out UCOMITypeInfo ppTInfo, out UCOMITypeComp ppTComp);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeInfo.cs b/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeInfo.cs
new file mode 100755
index 00000000000..1e36703c46d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeInfo.cs
@@ -0,0 +1,37 @@
+
+// System.Runtime.InteropServices/UCOMITypeInfo.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface UCOMITypeInfo {
+ void AddressOfMember (int memid, INVOKEKIND invKind, out IntPtr ppv);
+ void CreateInstance (object pUnkOuter, ref Guid riid, out object ppvObj);
+ void GetContainingTypeLib (out UCOMITypeLib ppTLB, out int pIndex);
+ void GetDllEntry (int memid, INVOKEKIND invKind, out string pBstrDllName, out string pBstrName, out short pwOrdinal);
+ void GetDocumentation (int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
+ void GetFuncDesc (int index, out IntPtr ppFuncDesc);
+ void GetIDsOfNames (string[] rgszNames, int cNames, int[] pMemId);
+ void GetImplTypeFlags (int index, out int pImplTypeFlags);
+ void GetMops (int memid, out string pBstrMops);
+ void GetNames (int memid, string[] rgBstrNames, int cMaxNames, out int pcNames);
+ void GetRefTypeInfo (int hRef, out UCOMITypeInfo ppTI);
+ void GetRefTypeOfImplType (int index, out int href);
+ void GetTypeAttr (out IntPtr ppTypeAttr);
+ void GetTypeComp (out UCOMITypeComp ppTComp);
+ void GetVarDesc (int index, out IntPtr ppVarDesc);
+ void Invoke (object pvInstance, int memid, short wFlags, ref DISPPARAMS pDispParams, out object pVarResult, out EXCEPINFO pExcepInfo, out int puArgErr);
+ void ReleaseFuncDesc (IntPtr pFuncDesc);
+ void ReleaseTypeAttr (IntPtr pTypeAttr);
+ void ReleaseVarDesc (IntPtr pVarDesc);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeLib.cs b/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeLib.cs
new file mode 100755
index 00000000000..73a2d29570f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/UCOMTypeLib.cs
@@ -0,0 +1,27 @@
+
+// System.Runtime.InteropServices/UCOMITypeLib.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface UCOMITypeLib {
+ void FindName( string szNameBuf, int lHashVal, UCOMITypeInfo[] ppTInfo, int[] rgMemId, ref short pcFound);
+ void GetDocumentation( int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
+ void GetLibAttr( out IntPtr ppTLibAttr);
+ void GetTypeComp( out UCOMITypeComp ppTComp);
+ void GetTypeInfo( int index, out UCOMITypeInfo ppTI);
+ void GetTypeInfoOfGuid( ref Guid guid, out UCOMITypeInfo ppTInfo);
+ void GetTypeInfoType( int index, out TYPEKIND pTKind);
+ bool IsName( string szNameBuf, int lHashVal);
+ void ReleaseTLibAttr( IntPtr pTLibAttr);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs b/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs
new file mode 100755
index 00000000000..b6f0fe5a7c8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs
@@ -0,0 +1,170 @@
+// UnmanagedType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UnmanagedType {
+
+ /// <summary>
+ /// </summary>
+ Bool = 2,
+
+ /// <summary>
+ /// </summary>
+ I1 = 3,
+
+ /// <summary>
+ /// </summary>
+ U1 = 4,
+
+ /// <summary>
+ /// </summary>
+ I2 = 5,
+
+ /// <summary>
+ /// </summary>
+ U2 = 6,
+
+ /// <summary>
+ /// </summary>
+ I4 = 7,
+
+ /// <summary>
+ /// </summary>
+ U4 = 8,
+
+ /// <summary>
+ /// </summary>
+ I8 = 9,
+
+ /// <summary>
+ /// </summary>
+ U8 = 10,
+
+ /// <summary>
+ /// </summary>
+ R4 = 11,
+
+ /// <summary>
+ /// </summary>
+ R8 = 12,
+
+ Currency = 15,
+
+ /// <summary>
+ /// </summary>
+ BStr = 19,
+
+ /// <summary>
+ /// </summary>
+ LPStr = 20,
+
+ /// <summary>
+ /// </summary>
+ LPWStr = 21,
+
+ /// <summary>
+ /// </summary>
+ LPTStr = 22,
+
+ /// <summary>
+ /// </summary>
+ ByValTStr = 23,
+
+ /// <summary>
+ /// </summary>
+ IUnknown = 25,
+
+ /// <summary>
+ /// </summary>
+ IDispatch = 26,
+
+ /// <summary>
+ /// </summary>
+ Struct = 27,
+
+ /// <summary>
+ /// </summary>
+ Interface = 28,
+
+ /// <summary>
+ /// </summary>
+ SafeArray = 29,
+
+ /// <summary>
+ /// </summary>
+ ByValArray = 30,
+
+ /// <summary>
+ /// </summary>
+ SysInt = 31,
+
+ /// <summary>
+ /// </summary>
+ SysUInt = 32,
+
+ /// <summary>
+ /// </summary>
+ VBByRefStr = 34,
+
+ /// <summary>
+ /// </summary>
+ AnsiBStr = 35,
+
+ /// <summary>
+ /// </summary>
+ TBStr = 36,
+
+ /// <summary>
+ /// </summary>
+ VariantBool = 37,
+
+ /// <summary>
+ /// </summary>
+ FunctionPtr = 38,
+
+ /// <summary>
+ /// </summary>
+ // LPVoid = 39,
+
+ /// <summary>
+ /// </summary>
+ AsAny = 40,
+
+ /// <summary>
+ /// </summary>
+ //RPrecise = 41,
+
+ /// <summary>
+ /// </summary>
+ LPArray = 42,
+
+ /// <summary>
+ /// </summary>
+ LPStruct = 43,
+
+ /// <summary>
+ /// </summary>
+ CustomMarshaler = 44,
+
+ /// <summary>
+ /// </summary>
+ Error = 45,
+
+ /// <summary>
+ /// </summary>
+ //NativeTypeMax = 80,
+ } // UnmanagedType
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs b/mcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs
new file mode 100755
index 00000000000..4a8dc4168c1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs
@@ -0,0 +1,50 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+ public enum VarEnum {
+ VT_EMPTY = 0,
+ VT_NULL = 1,
+ VT_I2 = 2,
+ VT_I4 = 3,
+ VT_R4 = 4,
+ VT_R8 = 5,
+ VT_CY = 6,
+ VT_DATE = 7,
+ VT_BSTR = 8,
+ VT_DISPATCH = 9,
+ VT_ERROR = 10,
+ VT_BOOL = 11,
+ VT_VARIANT = 12,
+ VT_UNKNOWN = 13,
+ VT_DECIMAL = 14,
+ VT_I1 = 16,
+ VT_UI1 = 17,
+ VT_UI2 = 18,
+ VT_UI4 = 19,
+ VT_I8 = 20,
+ VT_UI8 = 21,
+ VT_INT = 22,
+ VT_UINT = 23,
+ VT_VOID = 24,
+ VT_HRESULT = 25,
+ VT_PTR = 26,
+ VT_SAFEARRAY = 27,
+ VT_CARRAY = 28,
+ VT_USERDEFINED = 29,
+ VT_LPSTR = 30,
+ VT_LPWSTR = 31,
+ VT_RECORD = 36,
+ VT_FILETIME = 64,
+ VT_BLOB = 65,
+ VT_STREAM = 66,
+ VT_STORAGE = 67,
+ VT_STREAMED_OBJECT = 68,
+ VT_STORED_OBJECT = 69,
+ VT_BLOB_OBJECT = 70,
+ VT_CF = 71,
+ VT_CLSID = 72,
+ VT_VECTOR = 4096,
+ VT_ARRAY = 8192,
+ VT_BYREF = 16384
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs
new file mode 100644
index 00000000000..574f2de52bf
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Contexts.ActivatorLevel..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting.Activation {
+
+ public enum ActivatorLevel {
+ Construction = 4,
+ Context = 8,
+ AppDomain = 12,
+ Process = 16,
+ Machine = 20,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog
new file mode 100644
index 00000000000..8aeaa9634f8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog
@@ -0,0 +1,10 @@
+2002-12-06 Duncan Mak <duncan@ximian.com>
+
+ * UrlAttribute.cs (GetHashCode): Implemented.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * System.Runtime.Remoting.Activation/UrlAttribute.cs: Add to CVS.
+
+ * System.Runtime.Remoting.Activation/IConstructionCallMessage.cs:
+ This implements IMessage, IMethodCallMessage and IMethodMessage.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs
new file mode 100644
index 00000000000..60bf6be961c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs
@@ -0,0 +1,24 @@
+//
+// System.Runtime.Remoting.Contexts.IActivator..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting.Activation {
+
+ public interface IActivator {
+ ActivatorLevel Level {
+ get;
+ }
+
+ IActivator NextActivator {
+ get; set;
+ }
+
+ IConstructionReturnMessage Activate (IConstructionCallMessage msg);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs
new file mode 100644
index 00000000000..3405967465d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs
@@ -0,0 +1,37 @@
+//
+// System.Runtime.Remoting.Activation.IConstructionCallMessage.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Activation {
+
+ public interface IConstructionCallMessage : IMessage, IMethodCallMessage, IMethodMessage {
+ Type ActivationType {
+ get;
+ }
+
+ string ActivationTypeName {
+ get;
+ }
+
+ IActivator Activator {
+ get;
+ set;
+ }
+
+ object [] CallSiteActivationAttributes {
+ get;
+ }
+
+ IList ContextProperties {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs
new file mode 100644
index 00000000000..495736f8c44
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Contexts.IConstructionReturnMessage..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Activation {
+
+ public interface IConstructionReturnMessage :IMethodReturnMessage, IMethodMessage, IMessage {
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/UrlAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/UrlAttribute.cs
new file mode 100644
index 00000000000..409767f292a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/UrlAttribute.cs
@@ -0,0 +1,53 @@
+//
+// System.Runtime.Remoting.Activation.UrlAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting.Activation {
+
+ [Serializable]
+ public sealed class UrlAttribute : ContextAttribute
+ {
+ string url;
+
+ public UrlAttribute (string callsiteURL)
+ : base (callsiteURL)
+ {
+ url = callsiteURL;
+ }
+
+ public string UrlValue {
+ get { return url; }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is UrlAttribute))
+ return false;
+
+ return (((UrlAttribute) o).UrlValue == url);
+ }
+
+ public override int GetHashCode ()
+ {
+ return url.GetHashCode ();
+ }
+
+ [MonoTODO]
+ public override void GetPropertiesForNewContext (IConstructionCallMessage ctorMsg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsContextOK (Context ctx, IConstructionCallMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.cs
new file mode 100644
index 00000000000..e5959dd7803
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.cs
@@ -0,0 +1,113 @@
+//
+// System.Runtime.Remoting.Channels.BaseChannelObjectWithProperties.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+
+ public abstract class BaseChannelObjectWithProperties :
+ IDictionary, ICollection, IEnumerable
+ {
+ Hashtable table;
+
+ public BaseChannelObjectWithProperties ()
+ {
+ table = new Hashtable ();
+ }
+
+ public virtual int Count
+ {
+ get { return table.Count; }
+ }
+
+ public virtual bool IsFixedSize
+ {
+ get { return true; }
+ }
+
+ public virtual bool IsReadOnly
+ {
+ get { return false; }
+ }
+
+ public virtual bool IsSynchronized
+ {
+ get { return false; }
+ }
+
+ //
+ // This is explicitly not implemented.
+ //
+ public virtual object this [object key]
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public virtual ICollection Keys
+ {
+ get { return table.Keys; }
+ }
+
+ public virtual IDictionary Properties
+ {
+ get { return this as IDictionary; }
+ }
+
+ public virtual object SyncRoot
+ {
+ get { return this; }
+ }
+
+ public virtual ICollection Values
+ {
+ get { return table.Values; }
+ }
+
+ public virtual void Add (object key, object value)
+ {
+ // .NET says this method must not implemented
+ throw new NotSupportedException ();
+ }
+
+ public virtual void Clear ()
+ {
+ // .NET says this method must not implemented
+ throw new NotSupportedException ();
+ }
+
+ public virtual bool Contains (object key)
+ {
+ return table.Contains (key);
+ }
+
+ public virtual void CopyTo (Array array, int index)
+ {
+ // .NET says this method must not implemented
+ throw new NotSupportedException ();
+ }
+
+ public virtual IDictionaryEnumerator GetEnumerator ()
+ {
+ return table.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return table.GetEnumerator ();
+ }
+
+ public virtual void Remove (object key)
+ {
+ // .NET says this method must not implemented
+ throw new NotSupportedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.cs
new file mode 100644
index 00000000000..25dc3260dfa
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Remoting.Channels.BaseChannelSyncWithProperties.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels
+{
+
+ public abstract class BaseChannelSinkWithProperties
+ : BaseChannelObjectWithProperties
+ {
+
+ protected BaseChannelSinkWithProperties ()
+ : base ()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelWithProperties.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelWithProperties.cs
new file mode 100644
index 00000000000..24738ff1438
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/BaseChannelWithProperties.cs
@@ -0,0 +1,30 @@
+//
+// System.Runtime.Remoting.Channels.BaseChannelWithProperties.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public abstract class BaseChannelWithProperties :
+ BaseChannelObjectWithProperties
+ {
+ protected IChannelSinkBase SinksWithProperties;
+
+ [MonoTODO]
+ protected BaseChannelWithProperties ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override IDictionary Properties
+ {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
new file mode 100644
index 00000000000..acf437dd381
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
@@ -0,0 +1,106 @@
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * ChannelServices.cs: added internal method for creating client
+ channel sink. Implemented some other methods.
+ * ClientChannelSinkStack.cs: implemented most of methods.
+ * ServerChannelSinkStack.cs: implemented most of methods.
+ * ChannelSinkStackEntry.cs: added
+ * ServerDispatchSink.cs: ProcessMessage now forwards messages
+ to ChannelServices.DispatchMessage
+
+2002-12-06 Duncan Mak <duncan@ximian.com>
+
+ * BaseChannelObjectWithProperties.cs :
+ Implemented the Count, IsFixedSize, IsReadOnly, IsSynchronized,
+ Keys, Properties, SyncRoot, Values properties.
+
+ Implemented the Contains and GetEnumerator methods.
+
+ Removed the unnecessary TODO attribute on the constructor, and the
+ Add method.
+
+ * BaseChannelSinkWithProperties.cs (constructor): Implemented by
+ chaining on to the base constructor.
+
+2002-08-31 Dietmar Maurer <dietmar@ximian.com>
+
+ * ChannelDataStore.cs: use a hash to store other keys
+
+2002-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChannelServices.cs: added private .ctor
+
+2002-08-13 Rodrigo Moya <rodrigo@ximian.com>
+
+ * SoapClientFormatterSink.cs:
+ * SoapServerFormatterSinkProvider.cs:
+ * SinkProviderData.cs: new classes.
+
+2002-08-10 Rodrigo Moya <rodrigo@ximian.com>
+
+ * CommonTransportKeys.cs:
+ * ServerChannelSinkStack.cs: new classes.
+
+2002-08-05 Rodrigo Moya <rodrigo@ximian.com>
+
+ * ChannelServices.cs:
+ * ChannelDataStore.cs:
+ * ClientChannelSinkStack.cs: new classes with some implementation.
+
+2002-08-03 Rodrigo Moya <rodrigo@ximian.com>
+
+ * BinaryServerFormatterSinkProvider.cs:
+ * BinaryClientFormatterSinkProvider.cs: new stubs.
+
+2002-08-03 Duncan Mak <duncan@ximian.com>
+
+ * BinaryClientFormatterSink.cs:
+ * IClientChannelSink.cs: Fixed signature for AsyncProcessResponse.
+
+2002-08-01 Rodrigo Moya <rodrigo@ximian.com>
+
+ * BinaryClientFormatterSink.cs:
+ * BaseChannelWithProperties.cs: new stubs.
+
+2002-08-02 Duncan Mak <duncan@ximian.com>
+
+ * IChannel.cs:
+ * IChannelReceiver.cs:
+ * IChannelReceiverHook.cs:
+ * IClientChannelSink.cs:
+ * IClientChannelSinkStack.cs:
+ * IServerChannelSink.cs:
+ * IServerChannelSinkProvider.cs:
+ * IServerChannelSinkStack.cs: Fixed various typos, cut-n-paste
+ errors.
+
+2002-07-31 Rodrigo Moya <rodrigo@ximian.com>
+
+ * BaseChannelSinkWithProperties.cs:
+ * BaseChannelObjectWithProperties.cs: new stubs.
+
+2002-08-01 Duncan Mak <duncan@ximian.com>
+
+ * IChannel.cs:
+ (Parse): Added.
+
+ * BinaryServerFormatterSink.cs:
+ * SoapServerFormatterSink.cs: Fixed typo.
+
+ * IServerChannelSink.cs:
+ (ProcessMessage): Fixed definition.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * BinaryServerFormatterSink.cs:
+ * SoapServerFormatterSink.cs: Added.
+
+ * IChannelReceiverHook.cs:
+ * IClientFormatterSink.cs: Various compilation fixes.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * *.cs: Added all the interfaces in this namespace.
+
+ * ServerProcessing.cs: Added.
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelDataStore.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelDataStore.cs
new file mode 100644
index 00000000000..4911fedefaf
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelDataStore.cs
@@ -0,0 +1,51 @@
+//
+// System.Runtime.Remoting.Channels.ChannelDataStore.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class ChannelDataStore : IChannelDataStore
+ {
+ string[] channelUris;
+ Hashtable hash;
+
+ public ChannelDataStore (string[] uris)
+ {
+ channelUris = uris;
+ }
+
+ public string[] ChannelUris
+ {
+ get {
+ return channelUris;
+ }
+ set {
+ channelUris = value;
+ }
+ }
+
+ public object this[object key]
+ {
+ get {
+ if (hash == null)
+ hash = new Hashtable ();
+
+ return hash [key];
+ }
+
+ set {
+ if (hash == null)
+ hash = new Hashtable ();
+
+ hash [key] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
new file mode 100644
index 00000000000..3e52559c483
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
@@ -0,0 +1,178 @@
+//
+// System.Runtime.Remoting.Channels.ChannelServices.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels
+{
+ internal class ChannelInfoStore : IChannelInfo
+ {
+ object [] data = null;
+
+ public ChannelInfoStore ()
+ {
+ this.data = ChannelServices.GetCurrentChannelInfo ();
+ }
+
+ public object[] ChannelData {
+
+ get {
+ return data;
+ }
+
+ set {
+ data = value;
+ }
+ }
+ }
+
+ public sealed class ChannelServices
+ {
+ private static ArrayList registeredChannels = new ArrayList ();
+
+ private ChannelServices ()
+ {
+ }
+
+ public static IMessageSink CreateClientChannelSinkChain(string url, object remoteChannelData, out string objectUri)
+ {
+ // Locate a channel that can parse the url. This channel will be used to
+ // create the sink chain.
+
+ foreach (IChannel c in registeredChannels)
+ {
+ IChannelSender sender = c as IChannelSender;
+
+ if (sender != null)
+ {
+ IMessageSink sink = sender.CreateMessageSink (url, remoteChannelData, out objectUri);
+ if (sink != null) return sink; // URL is ok, this is the channel and the sink
+ }
+ }
+ objectUri = null;
+ return null;
+ }
+
+ public static IChannel[] RegisteredChannels
+ {
+ get {
+ IChannel[] channels = new IChannel[registeredChannels.Count];
+
+ for (int i = 0; i < registeredChannels.Count; i++)
+ channels[i] = (IChannel) registeredChannels[i];
+
+ return channels;
+ }
+ }
+
+ [MonoTODO]
+ public static IMessageCtrl AsyncDispatchMessage (IMessage msg,
+ IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static IServerChannelSink CreateServerChannelSinkChain (
+ IServerChannelSinkProvider provider, IChannelReceiver channel)
+ {
+ IServerChannelSinkProvider tmp = provider;
+ while (tmp.Next != null) tmp = tmp.Next;
+ tmp.Next = new ServerDispatchSinkProvider ();
+
+ // Every provider has to call CreateSink() of its next provider
+ return provider.CreateSink (channel);
+ }
+
+ [MonoTODO]
+ public static ServerProcessing DispatchMessage (
+ IServerChannelSinkStack sinkStack,
+ IMessage msg,
+ out IMessage replyMsg)
+ {
+ // TODO: put Identity in message
+ // TODO: Async processing
+
+ IMethodMessage call = (IMethodMessage)msg;
+ Identity identity = RemotingServices.GetIdentityForUri(call.Uri);
+ if (identity == null) throw new RemotingException ("No receiver for uri " + call.Uri);
+
+ replyMsg = identity.Context.GetServerContextSinkChain().SyncProcessMessage (msg);
+
+ return ServerProcessing.Complete;
+ }
+
+ [MonoTODO]
+ public static IChannel GetChannel (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IDictionary GetChannelSinkProperties (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static string[] GetUrlsForObject (MarshalByRefObject obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterChannel (IChannel chnl)
+ {
+ // Put the channel in the correct place according to its priority.
+ // Since there are not many channels, a linear search is ok.
+
+ for (int n = 0; n < registeredChannels.Count; n++) {
+ if ( ((IChannel)registeredChannels[n]).ChannelPriority < chnl.ChannelPriority)
+ {
+ registeredChannels.Insert (n, chnl);
+ return;
+ }
+ }
+ registeredChannels.Add (chnl);
+ }
+
+ [MonoTODO]
+ public static IMessage SyncDispatchMessage (IMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static void UnregisterChannel (IChannel chnl)
+ {
+ if (chnl == null)
+ throw new ArgumentNullException ();
+ if (!registeredChannels.Contains ((object) chnl))
+ throw new RemotingException ();
+
+ registeredChannels.Remove ((object) chnl);
+ }
+
+ internal static object [] GetCurrentChannelInfo ()
+ {
+ ArrayList list = new ArrayList ();
+
+ foreach (object chnl_obj in registeredChannels) {
+ IChannelReceiver chnl = chnl_obj as IChannelReceiver;
+
+ if (chnl != null) {
+ object chnl_data = chnl.ChannelData;
+ if (chnl_data != null)
+ list.Add (chnl_data);
+ }
+ }
+
+ return list.ToArray ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelSinkStackEntry.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelSinkStackEntry.cs
new file mode 100644
index 00000000000..3e6d1094228
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelSinkStackEntry.cs
@@ -0,0 +1,29 @@
+//
+// System.Runtime.Remoting.ChanelSinkStackEntry.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002, Lluis Sanchez Gual
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Channels
+{
+ /// <summary>
+ /// Used to store sink information in a SinkStack
+ /// </summary>
+ internal class ChanelSinkStackEntry
+ {
+ public IChannelSinkBase Sink;
+ public object State;
+ public ChanelSinkStackEntry Next;
+
+ public ChanelSinkStackEntry(IChannelSinkBase sink, object state, ChanelSinkStackEntry next)
+ {
+ Sink = sink;
+ State = state;
+ Next = next;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs
new file mode 100644
index 00000000000..03195b54316
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs
@@ -0,0 +1,71 @@
+//
+// System.Runtime.Remoting.Channels.ClientChannelSinkStack.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class ClientChannelSinkStack : IClientChannelSinkStack, IClientResponseChannelSinkStack
+ {
+ // The sink where to send the result of the async call
+ private IMessageSink _replySink = null;
+
+ // The stack. It is a chain of ChanelSinkStackEntry.
+ ChanelSinkStackEntry _sinkStack = null;
+
+ public ClientChannelSinkStack (IMessageSink sink)
+ {
+ _replySink = sink;
+ }
+
+ public void AsyncProcessResponse (ITransportHeaders headers, Stream stream)
+ {
+ if (_sinkStack == null) throw new RemotingException ("The current sink stack is empty");
+
+ ChanelSinkStackEntry stackEntry = _sinkStack;
+ _sinkStack = _sinkStack.Next;
+
+ ((IClientChannelSink)stackEntry.Sink).AsyncProcessResponse (this, stackEntry.State, headers, stream);
+
+ // Do not call AsyncProcessResponse for each sink in the stack.
+ // The sink must recursively call IClientChannelSinkStack.AsyncProcessResponse
+ // after its own processing
+ }
+
+ [MonoTODO]
+ public void DispatchException (Exception e)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void DispatchReplyMessage (IMessage msg)
+ {
+ if (_replySink != null) _replySink.SyncProcessMessage(msg);
+ }
+
+ public object Pop (IClientChannelSink sink)
+ {
+ // Pops until the sink is found
+
+ while (_sinkStack != null)
+ {
+ ChanelSinkStackEntry stackEntry = _sinkStack;
+ _sinkStack = _sinkStack.Next;
+ if (stackEntry.Sink == sink) return stackEntry.State;
+ }
+ throw new RemotingException ("The current sink stack is empty, or the specified sink was never pushed onto the current stack");
+ }
+
+ public void Push (IClientChannelSink sink, object state)
+ {
+ _sinkStack = new ChanelSinkStackEntry (sink, state, _sinkStack);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannel.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannel.cs
new file mode 100644
index 00000000000..19edea45586
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannel.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Channels.IChannel.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IChannel
+ {
+ string ChannelName { get; }
+
+ int ChannelPriority { get; }
+
+ string Parse (string url, out string objectURI);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelDataStore.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelDataStore.cs
new file mode 100644
index 00000000000..39646636392
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelDataStore.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Channels.IChannelDataStore.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IChannelDataStore
+ {
+ string [] ChannelUris { get;}
+
+ object this [object key] { get; set; }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiver.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiver.cs
new file mode 100644
index 00000000000..a976caaedb1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiver.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.Remoting.Channels.IChannelReceiver.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IChannelReceiver : IChannel
+ {
+ object ChannelData { get; }
+
+ string [] GetUrlsForUri (string objectUri);
+
+ void StartListening (object data);
+
+ void StopListening (object data);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiverHook.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiverHook.cs
new file mode 100644
index 00000000000..11540e74716
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelReceiverHook.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Remoting.Channels.IChannelReceiverHook.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IChannelReceiverHook
+ {
+ string ChannelScheme { get; }
+
+ IServerChannelSink ChannelSinkChain { get; }
+
+ bool WantsToListen { get; }
+
+ void AddHookChannelUri (string channelUri);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSender.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSender.cs
new file mode 100644
index 00000000000..5f5d4b00362
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSender.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Channels.IChannelSender.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IChannelSender : IChannel
+ {
+ IMessageSink CreateMessageSink (string url, object remoteChannelData, out string objectURI);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSinkBase.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSinkBase.cs
new file mode 100644
index 00000000000..7c4445a8236
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IChannelSinkBase.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Channels.IChannelSinkBase.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IChannelSinkBase
+ {
+ IDictionary Properties { get; }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSink.cs
new file mode 100644
index 00000000000..f4413f9e3e5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSink.cs
@@ -0,0 +1,29 @@
+//
+// System.Runtime.Remoting.Channels.IClientChannelSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IClientChannelSink : IChannelSinkBase
+ {
+ IClientChannelSink NextChannelSink { get; }
+
+ void AsyncProcessRequest (IClientChannelSinkStack sinkStack, IMessage msg,
+ ITransportHeaders headers, Stream stream);
+
+ void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack, object state,
+ ITransportHeaders headers, Stream stream);
+
+ Stream GetRequestStream (IMessage msg, ITransportHeaders headers);
+
+ void ProcessMessage (IMessage msg, ITransportHeaders requestHeaders, Stream requestStream,
+ out ITransportHeaders responseHeaders, out Stream responseStream);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkProvider.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkProvider.cs
new file mode 100644
index 00000000000..8876858bf90
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkProvider.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Channels.IClientChannelSinkProvider.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IClientChannelSinkProvider
+ {
+ IClientChannelSinkProvider Next { get; set; }
+
+ IClientChannelSink CreateSink (IChannelSender channel, string url, object remoteChannelData);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkStack.cs
new file mode 100644
index 00000000000..b7ad75737e9
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientChannelSinkStack.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Channels.IClientChannelSinkStack.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IClientChannelSinkStack : IClientResponseChannelSinkStack
+ {
+ object Pop (IClientChannelSink sink);
+
+ void Push (IClientChannelSink sink, object state);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSink.cs
new file mode 100644
index 00000000000..a43eee1a7b6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSink.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Channels.IClientFormatterSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IClientFormatterSink : IMessageSink, IClientChannelSink, IChannelSinkBase
+ {
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.cs
new file mode 100644
index 00000000000..312d7835158
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.Remoting.Channels.IClientFormatterSinkProvider.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IClientFormatterSinkProvider : IClientChannelSinkProvider
+ {
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.cs
new file mode 100644
index 00000000000..d9d5c583376
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.cs
@@ -0,0 +1,23 @@
+//
+// System.Runtime.Remoting.Channels.IClientResponseChannelSinkStack.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IClientResponseChannelSinkStack
+ {
+ void AsyncProcessResponse (ITransportHeaders headers, Stream stream);
+
+ void DispatchException (Exception e);
+
+ void DispatchReplyMessage (IMessage msg);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSink.cs
new file mode 100644
index 00000000000..aee55502b4d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSink.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.Remoting.Channels.IServerChannelSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IServerChannelSink : IChannelSinkBase
+ {
+ IServerChannelSink NextChannelSink { get; }
+
+ void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream);
+
+ Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers);
+
+ ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream,
+ out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkProvider.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkProvider.cs
new file mode 100644
index 00000000000..1accfd56d0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkProvider.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IServerChannelSinkProvider
+ {
+ IServerChannelSinkProvider Next { get; set; }
+
+ IServerChannelSink CreateSink (IChannelReceiver channel);
+
+ void GetChannelData (IChannelDataStore channelData);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkStack.cs
new file mode 100644
index 00000000000..cb5b64ce00e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerChannelSinkStack.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.Remoting.Channels.IServerChannelSinkStack.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IServerChannelSinkStack : IServerResponseChannelSinkStack
+ {
+ object Pop (IServerChannelSink sink);
+
+ void Push (IServerChannelSink sink, object state);
+
+ void ServerCallback (IAsyncResult ar);
+
+ void Store (IServerChannelSink sink, object state);
+
+ void StoreAndDispatch (IServerChannelSink sink, object state);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.cs
new file mode 100644
index 00000000000..c352de9de78
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.Remoting.Channels.IServerFormatterSinkProvider.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IServerFormatterSinkProvider : IServerChannelSinkProvider
+ {
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.cs
new file mode 100644
index 00000000000..63f1c35d8d7
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface IServerResponseChannelSinkStack
+ {
+ void AsyncProcessResponse (IMessage msg, ITransportHeaders headers, Stream stream);
+
+ Stream GetResponseStream (IMessage msg, ITransportHeaders headers);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ITransportHeaders.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ITransportHeaders.cs
new file mode 100644
index 00000000000..f81446a25dc
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ITransportHeaders.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Channels.ITransportHeaders.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels {
+
+ public interface ITransportHeaders
+ {
+ object this [object key] { get; set; }
+
+ IEnumerator GetEnumerator();
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerChannelSinkStack.cs
new file mode 100644
index 00000000000..59b658b7b99
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerChannelSinkStack.cs
@@ -0,0 +1,80 @@
+//
+// System.Runtime.Remoting.Channels.ServerChannelSinkStack.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class ServerChannelSinkStack : IServerChannelSinkStack, IServerResponseChannelSinkStack
+ {
+ // The stack. It is a chain of ChanelSinkStackEntry.
+ ChanelSinkStackEntry _sinkStack = null;
+
+ public ServerChannelSinkStack ()
+ {
+ }
+
+ public Stream GetResponseStream (IMessage msg, ITransportHeaders headers)
+ {
+ if (_sinkStack == null) throw new RemotingException ("The sink stack is empty");
+ return ((IServerChannelSink)_sinkStack.Sink).GetResponseStream (this, _sinkStack.State, msg, headers);
+ }
+
+ public object Pop (IServerChannelSink sink)
+ {
+ // Pops until the sink is found
+
+ while (_sinkStack != null)
+ {
+ ChanelSinkStackEntry stackEntry = _sinkStack;
+ _sinkStack = _sinkStack.Next;
+ if (stackEntry.Sink == sink) return stackEntry.State;
+ }
+ throw new RemotingException ("The current sink stack is empty, or the specified sink was never pushed onto the current stack");
+ }
+
+ public void Push (IServerChannelSink sink, object state)
+ {
+ _sinkStack = new ChanelSinkStackEntry (sink, state, _sinkStack);
+ }
+
+ [MonoTODO]
+ public void ServerCallback (IAsyncResult ar)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Store (IServerChannelSink sink, object state)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void StoreAndDispatch (IServerChannelSink sink, object state)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AsyncProcessResponse (IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ if (_sinkStack == null) throw new RemotingException ("The current sink stack is empty");
+
+ ChanelSinkStackEntry stackEntry = _sinkStack;
+ _sinkStack = _sinkStack.Next;
+ ((IServerChannelSink)stackEntry.Sink).AsyncProcessResponse (this, stackEntry.State, msg, headers, stream);
+
+ // Do not call AsyncProcessResponse for each sink in the stack.
+ // The sink must recursively call IServerChannelSinkStack.AsyncProcessResponse
+ // after its own processing
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSink.cs
new file mode 100644
index 00000000000..26be2551474
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSink.cs
@@ -0,0 +1,61 @@
+//
+// System.Runtime.Remoting.Channels/ServerDispatchSink.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Channels {
+
+ internal class ServerDispatchSink : IServerChannelSink, IChannelSinkBase
+ {
+ public ServerDispatchSink ()
+ {
+ }
+
+ public IServerChannelSink NextChannelSink {
+ get {
+ return null;
+ }
+ }
+
+ public IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack, object state,
+ IMessage msg, ITransportHeaders headers)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
+ IMessage requestMsg,
+ ITransportHeaders requestHeaders,
+ Stream requestStream,
+ out IMessage responseMsg,
+ out ITransportHeaders responseHeaders,
+ out Stream responseStream)
+ {
+ responseHeaders = null;
+ responseStream = null;
+
+ return ChannelServices.DispatchMessage(sinkStack, requestMsg, out responseMsg);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSinkProvider.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSinkProvider.cs
new file mode 100644
index 00000000000..57ccdb460cc
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerDispatchSinkProvider.cs
@@ -0,0 +1,48 @@
+//
+// System.Runtime.Remoting.Channels.ServerDispatchSinkProvider.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ internal class ServerDispatchSinkProvider :
+ IServerFormatterSinkProvider, IServerChannelSinkProvider
+ {
+ public ServerDispatchSinkProvider ()
+ {
+ }
+
+ [MonoTODO]
+ public ServerDispatchSinkProvider (IDictionary properties,
+ ICollection providerData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IServerChannelSinkProvider Next
+ {
+ get {
+ return null;
+ }
+
+ set {
+ throw new NotSupportedException ();
+ }
+ }
+
+ public IServerChannelSink CreateSink (IChannelReceiver channel)
+ {
+ return new ServerDispatchSink ();
+ }
+
+ public void GetChannelData (IChannelDataStore channelData)
+ {
+ // no idea why we need this
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerProcessing.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerProcessing.cs
new file mode 100644
index 00000000000..01056192294
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ServerProcessing.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.Remoting.Channels.ServerProcessing.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Channels {
+
+ [Serializable]
+ public enum ServerProcessing
+ {
+ Complete = 0,
+ OneWay = 1,
+ Async = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/SinkProviderData.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/SinkProviderData.cs
new file mode 100644
index 00000000000..02882ef4c4a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/SinkProviderData.cs
@@ -0,0 +1,45 @@
+//
+// System.Runtime.Remoting.Channels.SinkProviderData.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class SinkProviderData
+ {
+ private string sinkName;
+
+ public SinkProviderData (string name)
+ {
+ sinkName = name;
+ }
+
+ public IList Children
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string Name
+ {
+ get {
+ return sinkName;
+ }
+ }
+
+ public IDictionary Properties
+ {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/TransportHeaders.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/TransportHeaders.cs
new file mode 100644
index 00000000000..09f1c24c8d5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/TransportHeaders.cs
@@ -0,0 +1,39 @@
+//
+// System.Runtime.Remoting.Channels.TransportHeaders.cs
+//
+// Author: Rodrigo Moya (rodrigo@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Channels
+{
+ public class TransportHeaders : ITransportHeaders
+ {
+ Hashtable hash_table;
+
+ public TransportHeaders ()
+ {
+ hash_table = new Hashtable ();
+ }
+
+ public object this [object key]
+ {
+ get {
+ return hash_table [key];
+ }
+
+ set {
+ hash_table [key] = value;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return hash_table.GetEnumerator ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/.cvsignore b/mcs/class/corlib/System.Runtime.Remoting.Contexts/.cvsignore
new file mode 100644
index 00000000000..ddede4bae3e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/.cvsignore
@@ -0,0 +1 @@
+library-deps.stamp
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ChangeLog
new file mode 100644
index 00000000000..1daed87acaa
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ChangeLog
@@ -0,0 +1,30 @@
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * Context.cs: Added creation of default server context and
+ object context sinks.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * SynchronizationAttribute.cs: Added more interfaces, it
+ implements them (via CorCompare), but they're not listed in the docs.
+
+ * ContextProperty.cs:
+ * CrossContextDelegate.cs: Added to CVS.
+
+ * ContextAttribute.cs: Added missing constructor.
+
+2002-07-29 Duncan Mak <duncan@ximian.com>
+
+ * IContributeServerContentSink.cs: Removed.
+ * IContributeServerContextSink.cs: Replaces IContributeServerContentSink.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * SynchronizationAttribute.cs: Added missing attributes.
+
+ * IContextPropertyActivator.cs:
+ * IContributeClientContextSink.cs:
+ * IContributeDynamicSink.cs:
+ * IContributeEnvoySink.cs:
+ * IContributeObjectSink.cs:
+ * IContributeServerContentSink.cs: Added the missing interfaces.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
new file mode 100644
index 00000000000..0b5a1a31691
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
@@ -0,0 +1,111 @@
+//
+// System.Runtime.Remoting.Contexts.Context..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Lifetime;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public class Context {
+ static Context default_context;
+ static ArrayList domain_contexts = new ArrayList();
+
+ // Default server object sink chain
+ static IMessageSink default_object_sink;
+
+ // Default server context sink chain
+ static IMessageSink default_context_sink;
+
+ // The sink chain that has to be used by all calls entering the context
+ IMessageSink server_context_sink_chain = null;
+
+ ArrayList context_properties;
+ int context_id;
+ bool frozen;
+ static int global_count;
+
+ static Context ()
+ {
+ // Creates the default context sink chain
+ default_context_sink = new ServerContextTerminatorSink();
+
+ // Creates the default object sink chain
+ default_object_sink = new StackBuilderSink();
+ default_object_sink = new ServerObjectTerminatorSink(default_object_sink);
+ default_object_sink = new Lifetime.LeaseSink(default_object_sink);
+
+ default_context = new Context ();
+ default_context.frozen = true;
+ }
+
+ public Context ()
+ {
+ context_id = global_count++;
+ }
+
+ public static Context DefaultContext {
+ get {
+ return default_context;
+ }
+ }
+
+ public virtual int ContextID {
+ get {
+ return context_id;
+ }
+ }
+
+ public virtual IContextProperty GetProperty (string name)
+ {
+ if (context_properties == null)
+ return null;
+
+ foreach (IContextProperty p in context_properties)
+ if (p.Name == name)
+ return p;
+
+ return null;
+ }
+
+ public virtual void SetProperty (IContextProperty prop)
+ {
+ if (prop == null)
+ throw new ArgumentNullException ("IContextProperty");
+ if (this == default_context)
+ throw new InvalidOperationException ("Can not add properties to " +
+ "default context");
+ if (frozen)
+ throw new InvalidOperationException ("Context is Frozen");
+
+ if (context_properties == null)
+ context_properties = new ArrayList ();
+
+ context_properties.Add (prop);
+ }
+
+ [MonoTODO("Create sinks from contributor properties")]
+ internal IMessageSink GetServerContextSinkChain()
+ {
+ if (server_context_sink_chain == null)
+ {
+ server_context_sink_chain = default_context_sink;
+ }
+ return server_context_sink_chain;
+ }
+
+
+ [MonoTODO("Create object sinks from contributor properties")]
+ internal IMessageSink CreateServerObjectSinkChain (MarshalByRefObject obj)
+ {
+ return default_object_sink;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs
new file mode 100644
index 00000000000..761bcbc7a5a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs
@@ -0,0 +1,105 @@
+//
+// System.Runtime.Remoting.Contexts.ContextAttribute..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Activation;
+using System.Collections;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ [Serializable]
+ public class ContextAttribute : Attribute, IContextAttribute, IContextProperty {
+ protected string AttributeName;
+
+ public ContextAttribute ()
+ {
+ }
+
+ public ContextAttribute (string name)
+ {
+ AttributeName = name;
+ }
+
+ public virtual string Name {
+ get {
+ return AttributeName;
+ }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (o == null)
+ return false;
+
+ if (!(o is ContextAttribute))
+ return false;
+
+ ContextAttribute ca = (ContextAttribute) o;
+
+ if (ca.AttributeName != AttributeName)
+ return false;
+
+ return true;
+ }
+
+ public virtual void Freeze (Context ctx)
+ {
+ }
+
+ public override int GetHashCode ()
+ {
+ if (AttributeName == null)
+ return 0;
+
+ return AttributeName.GetHashCode ();
+ }
+
+ /// <summary>
+ /// Adds the current context property to the IConstructionCallMessage
+ /// </summary>
+ public virtual void GetPropertiesForNewContext (IConstructionCallMessage msg)
+ {
+ if (msg == null)
+ throw new ArgumentNullException ("IConstructionCallMessage");
+
+ IList list = msg.ContextProperties;
+
+ list.Add (this);
+ }
+
+ // <summary>
+ // True whether the context arguments satisfies the requirements
+ // of the current context.
+ // </summary>
+ public virtual bool IsContextOK (Context ctx, IConstructionCallMessage msg)
+ {
+ if (msg == null)
+ throw new ArgumentNullException ("IConstructionCallMessage");
+ if (ctx == null)
+ throw new ArgumentNullException ("Context");
+
+ if (!msg.ActivationType.IsContextful)
+ return true;
+
+ IContextProperty p = ctx.GetProperty (AttributeName);
+ if (p == null)
+ return false;
+
+ if (this != p)
+ return false;
+
+ return true;
+ }
+
+ public virtual bool IsNewContextOK (Context ctx)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextProperty.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextProperty.cs
new file mode 100644
index 00000000000..a053cef5b45
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextProperty.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.Remoting.Contexts.ContextProperty..cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public class ContextProperty
+ {
+ [MonoTODO]
+ public virtual string Name {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object Property {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/CrossContextDelegate.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/CrossContextDelegate.cs
new file mode 100644
index 00000000000..2d16213f2de
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/CrossContextDelegate.cs
@@ -0,0 +1,13 @@
+//
+// System.Runtime.Remoting.Contexts.CrossContextDelegate.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Contexts {
+
+ [Serializable]
+ public delegate void CrossContextDelegate ();
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs
new file mode 100644
index 00000000000..b998062642c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Contexts.IContextAttribute..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Activation;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContextAttribute {
+
+ void GetPropertiesForNewContext (IConstructionCallMessage msg);
+
+ bool IsContextOK (Context ctx, IConstructionCallMessage msg);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs
new file mode 100644
index 00000000000..7230c19b029
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs
@@ -0,0 +1,23 @@
+//
+// System.Runtime.Remoting.Contexts.IContextProperty..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContextProperty {
+
+ string Name {
+ get;
+ }
+
+ void Freeze (Context ctx);
+
+ bool IsNewContextOK (Context ctx);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextPropertyActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextPropertyActivator.cs
new file mode 100644
index 00000000000..69efa1d3151
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextPropertyActivator.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.Remoting.Contexts.IContextPropertyActivator..cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Activation;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContextPropertyActivator
+ {
+ void CollectFromClientContext (IConstructionCallMessage msg);
+ void CollectFromServerContext (IConstructionReturnMessage msg);
+ bool DeliverClientContextToServerContext (IConstructionCallMessage msg);
+ bool DeliverServerContextToClientContext (IConstructionReturnMessage msg);
+ bool IsOKToActivate (IConstructionCallMessage msg);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeClientContextSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeClientContextSink.cs
new file mode 100644
index 00000000000..a18c8b04961
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeClientContextSink.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Contexts.IContributeClientContextSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContributeClientContextSink
+ {
+ IMessageSink GetClientContextSink (IMessageSink nextSink);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeDynamicSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeDynamicSink.cs
new file mode 100644
index 00000000000..a215e7e40c9
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeDynamicSink.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Contexts.IContributeDynamicSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContributeDynamicSink
+ {
+ IDynamicMessageSink GetDynamicSink ();
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeEnvoySink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeEnvoySink.cs
new file mode 100644
index 00000000000..13e118ec35d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeEnvoySink.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.Remoting.Contexts.IContributeEnvoySink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContributeEnvoySink
+ {
+ IMessageSink GetEnvoySink (MarshalByRefObject obj, IMessageSink nextSink);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeObjectSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeObjectSink.cs
new file mode 100644
index 00000000000..a33df42617b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeObjectSink.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.Remoting.Contexts.IContributeObjectSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContributeObjectSink
+ {
+ IMessageSink GetObjectSink (MarshalByRefObject obj, IMessageSink nextSink);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeServerContextSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeServerContextSink.cs
new file mode 100644
index 00000000000..dbe0dddda31
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContributeServerContextSink.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.Remoting.Contexts.IContributeServerContextSink.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContributeServerContextSink
+ {
+ IMessageSink GetServerContextSink (IMessageSink nextSink);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs
new file mode 100644
index 00000000000..daf169559d8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Contexts.IDynamicMessageSink..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IDynamicMessageSink {
+
+ void ProcessMessageFinish (IMessage reply_msg, bool client_site, bool async);
+
+ void ProcessMessageStart (IMessage req_msg, bool client_site, bool async);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs
new file mode 100644
index 00000000000..e469e24b6f1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Contexts.IDynamicProperty..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IDynamicProperty {
+
+ string Name {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog
new file mode 100644
index 00000000000..e97a1604d60
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog
@@ -0,0 +1,28 @@
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * LeaseSink.cs: Added
+
+2002-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LifetimeServices.cs: the class is sealed.
+
+2002-07-30 Duncan Mak <duncan@ximian.com>
+
+ * LeaseState.cs: Fixed namespace.
+
+2002-07-29 Duncan Mak <duncan@ximian.com>
+
+ * ILease.cs: Add the method part of the interface and renamed the
+ CurrentState property to it proper name.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * LeaseState.cs: Moved here from System.Runtime.Remoting.
+
+ * ClientSponsor.cs:
+ * LifetimeServices.cs: Stubbed out
+
+ * ILease.cs:
+ * ISponsor.cs: Added to CVS.
+
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs
new file mode 100644
index 00000000000..c6400477f75
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs
@@ -0,0 +1,73 @@
+//
+// System.Runtime.Remoting.Lifetime.ClientSponsor.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Lifetime;
+
+namespace System.Runtime.Remoting.Lifetime {
+
+ public class ClientSponsor : MarshalByRefObject, ISponsor
+ {
+ TimeSpan renewal_time;
+
+ public ClientSponsor ()
+ {
+ renewal_time = new TimeSpan (0, 2, 0); // default is 2 mins
+ }
+
+ public ClientSponsor (TimeSpan time)
+ {
+ renewal_time = time;
+ }
+
+ public TimeSpan RenewalTime {
+ get {
+ return renewal_time;
+ }
+
+ set {
+ renewal_time = value;
+ }
+ }
+
+ [MonoTODO]
+ public void Close ()
+ {
+ }
+
+ [MonoTODO]
+ ~ClientSponsor ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object InitializeLifetimeService ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Register (MarshalByRefObject obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public TimeSpan Renewal (ILease lease)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Unregister (MarshalByRefObject obj)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ILease.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ILease.cs
new file mode 100644
index 00000000000..b8d86e30370
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ILease.cs
@@ -0,0 +1,27 @@
+//
+// System.Runtime.Remoting.Lifetime.ILease.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Lifetime;
+
+namespace System.Runtime.Remoting.Lifetime {
+
+ public interface ILease
+ {
+ TimeSpan CurrentLeaseTime { get; }
+ LeaseState CurrentState { get; }
+ TimeSpan InitialLeaseTime { get; set; }
+ TimeSpan RenewOnCallTime { get; set; }
+ TimeSpan SponsorshipTimeout {get; set; }
+
+ void Register (ISponsor obj);
+ void Register (ISponsor obj, TimeSpan renewalTime);
+ TimeSpan Renew (TimeSpan renewalTime);
+ void Unregister (ISponsor obj);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ISponsor.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ISponsor.cs
new file mode 100644
index 00000000000..68ae88e3fe3
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ISponsor.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.Remoting.Lifetime.ISponsor.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Lifetime;
+
+namespace System.Runtime.Remoting.Lifetime {
+
+ public interface ISponsor
+ {
+ TimeSpan Renewal (ILease lease);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseSink.cs
new file mode 100644
index 00000000000..c50c98f3dd2
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseSink.cs
@@ -0,0 +1,43 @@
+//
+// System.Runtime.Remoting.LeaseSink.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002, Lluis Sanchez Gual
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Lifetime
+{
+ // This sink updates lifetime information
+ // about an object
+
+ internal class LeaseSink: IMessageSink
+ {
+ IMessageSink _nextSink;
+
+ public LeaseSink (IMessageSink nextSink)
+ {
+ _nextSink = nextSink;
+ }
+
+ [MonoTODO("Manage leases")]
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ return _nextSink.SyncProcessMessage (msg);
+ }
+
+ [MonoTODO("Manage leases")]
+ public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ return _nextSink.AsyncProcessMessage (msg, replySink);
+ }
+
+ public IMessageSink NextSink
+ {
+ get { return _nextSink; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseState.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseState.cs
new file mode 100644
index 00000000000..4e8218699fd
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LeaseState.cs
@@ -0,0 +1,41 @@
+// LeaseState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:41 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting.Lifetime {
+
+
+ /// <summary>
+ /// </summary>
+ public enum LeaseState {
+
+ /// <summary>
+ /// </summary>
+ Null = 0,
+
+ /// <summary>
+ /// </summary>
+ Initial = 1,
+
+ /// <summary>
+ /// </summary>
+ Active = 2,
+
+ /// <summary>
+ /// </summary>
+ Renewing = 3,
+
+ /// <summary>
+ /// </summary>
+ Expired = 4,
+ } // LeaseState
+
+} // System.Runtime.Remoting.Lifetime
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LifetimeServices.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LifetimeServices.cs
new file mode 100644
index 00000000000..8a90f8af4e6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/LifetimeServices.cs
@@ -0,0 +1,66 @@
+//
+// System.Runtime.Remoting.Lifetime.LifetimeServices.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Lifetime {
+
+ //LAMESPEC: MS docs don't say that this class is sealed.
+ public sealed class LifetimeServices
+ {
+ [MonoTODO]
+ public LifetimeServices ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static TimeSpan LeaseManagerPollTime {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static TimeSpan LeaseTime {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static TimeSpan RenewOnCallTime {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static TimeSpan SponsorshipTimeout {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
new file mode 100644
index 00000000000..7c619950c0d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
@@ -0,0 +1,105 @@
+//
+// System.Runtime.Remoting.Messaging/AsyncResult.cs
+//
+// Authors:
+// Joe Shaw (joe@ximian.com)
+// Martin Baulig (martin@gnome.org)
+// Dietmar Maurer (dietmar@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.Remoting.Messaging {
+
+public class AsyncResult : IAsyncResult, IMessageSink {
+
+ object async_state;
+ WaitHandle handle;
+ object async_delegate;
+ IntPtr data;
+ bool sync_completed;
+ bool completed;
+ bool endinvoke_called;
+
+ public virtual object AsyncState
+ {
+ get {
+ return async_state;
+ }
+ }
+
+ public virtual WaitHandle AsyncWaitHandle
+ {
+ get {
+ return handle;
+ }
+ }
+
+ public virtual bool CompletedSynchronously
+ {
+ get {
+ return sync_completed;
+ }
+ }
+
+ public virtual bool IsCompleted
+ {
+ get {
+ return completed;
+ }
+ }
+
+ public bool EndInvokeCalled
+ {
+ get {
+ return endinvoke_called;
+ }
+ set {
+ endinvoke_called = value;
+ }
+ }
+
+ public virtual object AsyncDelegate
+ {
+ get {
+ return async_delegate;
+ }
+ }
+
+ [MonoTODO]
+ public IMessageSink NextSink {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual IMessage GetReplyMessage()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void SetMessageCtrl (IMessageCtrl mc)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual IMessage SyncProcessMessage (IMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+}
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs
new file mode 100644
index 00000000000..b3b1dee70ad
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs
@@ -0,0 +1,53 @@
+//
+// System.Runtime.Remoting.Messaging.CallContext.cs
+//
+// Author: Jaime Anguiano Olarra (jaime@gnome.org)
+//
+// (c) 2002, Jaime Anguiano Olarra
+//
+// FIXME: This is just a skeleton for practical purposes.
+///<summary>
+///Provides several properties that come with the execution code path.
+///This class is sealed.
+///</summary>
+
+using System;
+
+namespace System.Runtime.Remoting.Messaging
+{
+
+ [Serializable]
+ public sealed class CallContext
+ {
+ // public methods
+ [MonoTODO]
+ public static void FreeNamedDataSlot (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static object GetData (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Header[] GetHeaders ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SetData (string name, object data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void SetHeaders (Header[] headers)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
new file mode 100644
index 00000000000..754f90fc214
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
@@ -0,0 +1,84 @@
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * MonoMethodMessage.cs: Implemented property Uri
+
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * ServerContextTerminatorSink.cs: Added
+ * ServerObjectTerminatorSink.cs: Added
+ * StackBuilderSink.cs: Added
+
+2002-12-10 Jaime Anguiano Olarra <jaime@gnome.org>
+
+ * CallContext.c: Added to the CVS.
+
+2002-08-22 Nick Drochak <ndrochak@gol.com>
+
+ * RemotingSurrogateSelector.cs (SetRootObject): Function should return
+ void, not object.
+
+2002-08-03 Duncan Mak <duncan@ximian.com>
+
+ * MethodCall.cs:
+ * MethodResponse.cs: More visibility fixes. Hopefully this is the
+ last of it.
+
+2002-08-02 Duncan Mak <duncan@ximian.com>
+
+ * MethodCall.cs:
+ * MethodCallMessageWrapper.cs:
+ * MethodReturnMessageWrapper.cs: Various visibility fixes.
+
+ * RemotingSurrogateSelector.cs: Added, replaced RemoteSurrogateSelector.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * MethodCallMessageWrapper.cs:
+ * MethodReturnMessageWrapper.cs: Revert the last patch and made it
+ work. Thanks to Gonzalo for reminding me to chain the constructors.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * MethodCallMessageWrapper.cs:
+ * MethodReturnMessageWrapper.cs: Remove reference to
+ InternalMessageWrapper. It's probably an MS private class, even
+ though it's visible in the documentation.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * InternalMessageWrapper.cs:
+ * MessageSurrogateFilter.cs:
+ * MethodCall.cs:
+ * MethodCallMessageWrapper.cs:
+ * MethodResponse.cs:
+ * MethodReturnMessageWrapper.cs:
+
+ * RemoteSurrogateSelector.cs: Added to CVS.
+
+ * MonoMethodMessage.cs:
+ * ReturnMessage.cs: Add set in the Uri property.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * OneWayAttribute.cs: Added to CVS.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * HeaderHandler.cs: Added.
+
+ * IRemotingFormatter.cs: Added to CVS.
+
+ * IMethodMessage.cs: IMethodMessage inherits from IMessage.
+
+Thu Apr 4 13:13:20 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * IMethodReturnMessage.cs: added IMethodMessage, IMessage interfaces.
+ * ReturnMessage.cs: stubbed out Properties property.
+
+2002-03-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * AsyncResult.cs: impl.
+
+2002/03/04 Nick Drochak <ndrochak@gol.com>
+
+ * Header.cs: Change properties into fields where they should be.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs
new file mode 100644
index 00000000000..0b08bfd3eb8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs
@@ -0,0 +1,50 @@
+//
+// System.Runtime.Remoting.Messaging.Header.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [Serializable]
+ public class Header {
+ public Header (string name, object value) :
+ this (name, value, true)
+ {
+ }
+
+ public Header (string name, object value, bool must_understand) :
+ this (name, value, must_understand, null)
+ {
+ }
+
+ public Header (string name, object value, bool must_understand, string header_namespace) {
+ this.name = name;
+ this.value = value;
+ this.must_understand = must_understand;
+ this.header_namespace = header_namespace;
+ }
+
+ // fields
+
+ public string HeaderNamespace;
+
+ public bool MustUnderstand;
+
+ public string Name;
+
+ public object Value;
+
+ // private
+
+ private string name;
+ private object value;
+ private bool must_understand;
+ private string header_namespace;
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/HeaderHandler.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/HeaderHandler.cs
new file mode 100644
index 00000000000..bb482f559a6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/HeaderHandler.cs
@@ -0,0 +1,13 @@
+//
+// System.Runtime.Remoting.Messaging.HeaderHandler.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Copyright Ximian, Inc. 2002
+//
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [Serializable]
+ public delegate object HeaderHandler (Header[] headers);
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs
new file mode 100644
index 00000000000..d1a5c0c1207
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Messaging.IMessage.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMessage {
+
+ IDictionary Properties {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs
new file mode 100644
index 00000000000..5fe21c32232
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Messaging.IMessageSink.cs
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ public interface IMessageCtrl
+ {
+ void Cancel (int msToCancel);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs
new file mode 100644
index 00000000000..8c25aac6b24
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.Remoting.Messaging.IMessageSink.cs
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ public interface IMessageSink
+ {
+ IMessage SyncProcessMessage (IMessage msg);
+ IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink);
+ IMessageSink NextSink { get; }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs
new file mode 100644
index 00000000000..4bbeef904f9
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.Remoting.Messaging.IMethodCallMessage.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMethodCallMessage : IMethodMessage {
+
+ int InArgCount {
+ get;
+ }
+
+ object [] InArgs {
+ get;
+ }
+
+ object GetInArg (int arg_num);
+ string GetInArgName (int arg_num);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs
new file mode 100644
index 00000000000..4bb33473022
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs
@@ -0,0 +1,55 @@
+//
+// System.Runtime.Remoting.Messaging.IMethodMessage..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMethodMessage : IMessage {
+ int ArgCount {
+ get;
+ }
+
+ object [] Args {
+ get;
+ }
+
+ bool HasVarArgs {
+ get;
+ }
+
+ LogicalCallContext LogicalCallContext {
+ get;
+ }
+
+ MethodBase MethodBase {
+ get;
+ }
+
+ string MethodName {
+ get;
+ }
+
+ object MethodSignature {
+ get;
+ }
+
+ string TypeName {
+ get;
+ }
+
+ string Uri {
+ get;
+ }
+
+ object GetArg (int arg_num);
+ string GetArgName (int arg_num);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs
new file mode 100644
index 00000000000..d059ce9b5fc
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Remoting.Messaging.IMethodReturnMessage..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMethodReturnMessage : IMethodMessage, IMessage {
+
+ Exception Exception { get; }
+ int OutArgCount { get; }
+ object [] OutArgs { get; }
+ object ReturnValue { get; }
+
+ object GetOutArg (int arg_num);
+ string GetOutArgName (int arg_num);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IRemotingFormatter.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IRemotingFormatter.cs
new file mode 100644
index 00000000000..ac3af52b2dd
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IRemotingFormatter.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Messaging.IRemotingFormatter..cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IRemotingFormatter : IFormatter {
+ object Deserialize (Stream serializationStream, HeaderHandler handler);
+ void Serialize (Stream serializationStream, object graph, Header [] handlers);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/InternalMessageWrapper.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/InternalMessageWrapper.cs
new file mode 100644
index 00000000000..1303f595c77
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/InternalMessageWrapper.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Remoting.Messaging.InternalMessageWrapper.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public class InternalMessageWrapper
+ {
+ public InternalMessageWrapper (IMessage msg)
+ {
+ WrappedMessage = msg;
+ }
+
+ protected IMessage WrappedMessage;
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
new file mode 100644
index 00000000000..a9e44a0ca4b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
@@ -0,0 +1,43 @@
+//
+// System.Runtime.Remoting.Messaging.LogicalCallContext.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class LogicalCallContext : ISerializable, ICloneable {
+
+ internal LogicalCallContext () {}
+
+ public bool HasInfo {
+ get { return false; }
+ }
+
+ public void FreeNamedDataSlot (string name) {
+ }
+
+ public object GetData (string name) {
+ return null;
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context) {
+ }
+
+ public void SetData (string name, object data) {
+ }
+
+ public object Clone () {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MessageSurrogateFilter.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MessageSurrogateFilter.cs
new file mode 100644
index 00000000000..df77f3b30d0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MessageSurrogateFilter.cs
@@ -0,0 +1,13 @@
+//
+// System.Runtime.Remoting.Messaging.MessageSurrogateFilter.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002, Copyright. Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [Serializable]
+ public delegate bool MessageSurrogateFilter (string key, object value);
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
new file mode 100644
index 00000000000..3c007d4ec15
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
@@ -0,0 +1,145 @@
+//
+// System.Runtime.Remoting.Messaging.MethodCall.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [Serializable] [CLSCompliant (false)]
+ public class MethodCall : IMethodCallMessage, IMethodMessage, IMessage, ISerializable
+ {
+ public MethodCall (Header [] headers)
+ {
+ }
+
+ public MethodCall (IMessage msg)
+ {
+ }
+
+ protected IDictionary ExternalProperties;
+ protected IDictionary InternalProperties;
+
+ [MonoTODO]
+ public int ArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object[] Args {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool HasVarArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int InArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object[] InArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public LogicalCallContext LogicalCallContext {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public MethodBase MethodBase {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string MethodName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object MethodSignature {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual IDictionary Properties {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string TypeName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string Uri {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object GetArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetInArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetInArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object HeaderHandler (Header[] h)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Init ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResolveMethod ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RootSetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.cs
new file mode 100644
index 00000000000..382e730a100
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.cs
@@ -0,0 +1,109 @@
+//
+// System.Runtime.Remoting.Messaging.MethodCallMessageWrapper.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public class MethodCallMessageWrapper : InternalMessageWrapper, IMethodCallMessage, IMethodMessage, IMessage
+ {
+ public MethodCallMessageWrapper (IMethodCallMessage msg)
+ : base (msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int ArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object [] Args {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual bool HasVarArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual int InArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object [] InArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual LogicalCallContext LogicalCallContext {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual MethodBase MethodBase {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string MethodName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object MethodSignature {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual IDictionary Properties {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string TypeName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string Uri {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object GetArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GetArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object GetInArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GetInArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
new file mode 100644
index 00000000000..5aed0278e78
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
@@ -0,0 +1,139 @@
+//
+// System.Runtime.Remoting.Messaging.MethodResponse.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [Serializable] [CLSCompliant (false)]
+ public class MethodResponse : IMethodReturnMessage, IMethodMessage, IMessage, ISerializable
+ {
+ public MethodResponse (Header[] headers, IMethodCallMessage mcm)
+ {
+ }
+
+ protected IDictionary ExternalProperties;
+ protected IDictionary InternalProperties;
+
+ [MonoTODO]
+ public int ArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object[] Args {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Exception Exception {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool HasVarArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public LogicalCallContext LogicalCallContext {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public MethodBase MethodBase {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string MethodName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object MethodSignature {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int OutArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object[] OutArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual IDictionary Properties {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object ReturnValue {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string TypeName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string Uri {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object GetArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetOutArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetOutArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object HeaderHandler (Header[] h)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RootSetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs
new file mode 100644
index 00000000000..a6058e512f7
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs
@@ -0,0 +1,142 @@
+//
+// System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public class MethodReturnMessageWrapper : InternalMessageWrapper, IMethodReturnMessage, IMethodMessage, IMessage
+ {
+
+ [MonoTODO]
+ public MethodReturnMessageWrapper (IMethodReturnMessage msg)
+ : base (msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual int ArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object[] Args {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual Exception Exception {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual bool HasVarArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual LogicalCallContext LogicalCallContext {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual MethodBase MethodBase {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string MethodName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object MethodSignature {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual int OutArgCount {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object[] OutArgs {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual IDictionary Properties {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object ReturnValue {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual string TypeName {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string Uri {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual object GetArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GetArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object GetOutArg (int argNum)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GetOutArgName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object HeaderHandler (Header[] h)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RootSetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
new file mode 100644
index 00000000000..150cd72784b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
@@ -0,0 +1,251 @@
+//
+// System.Runtime.Remoting.Messaging.MonoMethodMessage.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public class MonoMethodMessage : IMethodCallMessage, IMethodReturnMessage {
+
+ MonoMethod method;
+
+ object [] args;
+
+ string [] names;
+
+ byte [] arg_types; /* 1 == IN; 2 == OUT ; 3 = INOUT */
+
+ public LogicalCallContext ctx;
+
+ public object rval;
+
+ public Exception exc;
+
+ string uri;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern void InitMessage (MonoMethod method, object [] out_args);
+
+ public MonoMethodMessage (MethodBase method, object [] out_args)
+ {
+ InitMessage ((MonoMethod)method, out_args);
+ }
+
+ public MonoMethodMessage (Type type, string method_name, object [] in_args)
+ {
+ // fixme: consider arg types
+ MethodInfo minfo = type.GetMethod (method_name);
+
+ InitMessage ((MonoMethod)minfo, null);
+
+ int len = in_args.Length;
+ for (int i = 0; i < len; i++) {
+ args [i] = in_args [i];
+ }
+ }
+
+ public IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ public int ArgCount {
+ get {
+ return args.Length;
+ }
+ }
+
+ public object [] Args {
+ get {
+ return args;
+ }
+ }
+
+ public bool HasVarArgs {
+ get {
+ return false;
+ }
+ }
+
+ public LogicalCallContext LogicalCallContext {
+ get {
+ return ctx;
+ }
+ }
+
+ public MethodBase MethodBase {
+ get {
+ return method;
+ }
+ }
+
+ public string MethodName {
+ get {
+ return method.Name;
+ }
+ }
+
+ public object MethodSignature {
+ get {
+ return null;
+ }
+ }
+
+ public string TypeName {
+ get {
+ return null;
+ }
+ }
+
+ public string Uri {
+ get {
+ return uri;
+ }
+
+ set {
+ uri = value;
+ }
+ }
+
+ public object GetArg (int arg_num)
+ {
+ return args [arg_num];
+ }
+
+ public string GetArgName (int arg_num)
+ {
+ return names [arg_num];
+ }
+
+ public int InArgCount {
+ get {
+ int count = 0;
+
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0) count++;
+
+ }
+ return count;
+ }
+ }
+
+ public object [] InArgs {
+ get {
+ int i, j, count = InArgCount;
+ object [] inargs = new object [count];
+
+ i = j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0)
+ inargs [j++] = args [i];
+ i++;
+ }
+
+ return inargs;
+ }
+ }
+
+ public object GetInArg (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0) {
+ if (j++ == arg_num)
+ return args [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ public string GetInArgName (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0) {
+ if (j++ == arg_num)
+ return names [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ public Exception Exception {
+ get {
+ return exc;
+ }
+ }
+
+ public int OutArgCount {
+ get {
+ int count = 0;
+
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0) count++;
+
+ }
+ return count;
+ }
+ }
+
+ public object [] OutArgs {
+ get {
+ int i, j, count = OutArgCount;
+ object [] outargs = new object [count];
+
+ i = j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0)
+ outargs [j++] = args [i];
+ i++;
+ }
+
+ return outargs;
+ }
+ }
+
+ public object ReturnValue {
+ get {
+ return rval;
+ }
+ }
+
+ public object GetOutArg (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0) {
+ if (j++ == arg_num)
+ return args [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ public string GetOutArgName (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0) {
+ if (j++ == arg_num)
+ return names [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/OneWayAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/OneWayAttribute.cs
new file mode 100644
index 00000000000..54910723b0a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/OneWayAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Messaging.OneWayAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public class OneWayAttribute : Attribute
+ {
+ public OneWayAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.cs
new file mode 100644
index 00000000000..d3ae17f2914
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.cs
@@ -0,0 +1,66 @@
+//
+// System.Runtime.Remoting.Messaging.RemotingSurrogateSelector.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public class RemotingSurrogateSelector : ISurrogateSelector
+ {
+ public RemotingSurrogateSelector ()
+ {
+ }
+
+ [MonoTODO]
+ public MessageSurrogateFilter Filter {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public virtual void ChainSelector (ISurrogateSelector selector)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual ISurrogateSelector GetNextSelector()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetRootObject ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual ISerializationSurrogate GetSurrogate (
+ Type type, StreamingContext context, out ISurrogateSelector ssout)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetRootObject (object obj)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ();
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void UseSoapFormat ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
new file mode 100644
index 00000000000..7206ab6e090
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
@@ -0,0 +1,150 @@
+//
+// System.Runtime.Remoting.Messaging.ReturnMessage.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public class ReturnMessage : IMethodReturnMessage, IMethodMessage {
+
+ MonoMethodMessage msg;
+ IMethodCallMessage request;
+
+ public ReturnMessage (object returnValue, object [] outArgs,
+ int outArgCount, LogicalCallContext callCtx,
+ IMethodCallMessage request)
+ {
+ // fixme: why do we need outArgCount?
+ msg = new MonoMethodMessage ((MonoMethod)request.MethodBase, outArgs);
+ this.request = request;
+ msg.rval = returnValue;
+ msg.ctx = callCtx;
+ }
+
+ public ReturnMessage (Exception exc, IMethodCallMessage request)
+ {
+ msg = new MonoMethodMessage ((MonoMethod)request.MethodBase, null);
+ this.request = request;
+ msg.exc = exc;
+ msg.ctx = request.LogicalCallContext;
+ }
+
+ public int ArgCount {
+ get {
+ return msg.ArgCount;
+ }
+ }
+
+ public object [] Args {
+ get {
+ return msg.Args;
+ }
+ }
+
+ public bool HasVarArgs {
+ get {
+ return msg.HasVarArgs;
+ }
+ }
+
+ public LogicalCallContext LogicalCallContext {
+ get {
+ return msg.ctx;
+ }
+ }
+
+ public MethodBase MethodBase {
+ get {
+ return msg.MethodBase;
+ }
+ }
+
+ public string MethodName {
+ get {
+ return msg.MethodName;
+ }
+ }
+
+ public object MethodSignature {
+ get {
+ return msg.MethodSignature;
+ }
+ }
+
+ [MonoTODO]
+ public virtual IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ public string TypeName {
+ get {
+ return msg.TypeName;
+ }
+ }
+
+ public string Uri {
+ get {
+ return msg.Uri;
+ }
+
+ set {
+ msg.Uri = value;
+ }
+ }
+
+ public object GetArg (int arg_num)
+ {
+ return msg.GetArg (arg_num);
+ }
+
+ public string GetArgName (int arg_num)
+ {
+ return msg.GetArgName (arg_num);
+ }
+
+ public Exception Exception {
+ get {
+ return msg.exc;
+ }
+ }
+
+ public int OutArgCount {
+ get {
+ return msg.OutArgCount;
+ }
+ }
+
+ public object [] OutArgs {
+ get {
+ return msg.OutArgs;
+ }
+ }
+
+ public virtual object ReturnValue {
+ get {
+ return msg.rval;
+ }
+ }
+
+ public object GetOutArg (int arg_num)
+ {
+ return msg.GetOutArg (arg_num);
+ }
+
+ public string GetOutArgName (int arg_num)
+ {
+ return msg.GetOutArgName (arg_num);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerContextTerminatorSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerContextTerminatorSink.cs
new file mode 100644
index 00000000000..d6f276dacc3
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerContextTerminatorSink.cs
@@ -0,0 +1,36 @@
+//
+// System.Runtime.Remoting.ServerContextTerminatorSink.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002, Lluis Sanchez Gual
+//
+
+using System;
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ // The final sink of the Server Context Sink Chain.
+ // It forwards the message to the object's context sink chain.
+
+ public class ServerContextTerminatorSink: IMessageSink
+ {
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ Identity identity = RemotingServices.GetIdentityForUri(((IMethodMessage)msg).Uri);
+ return identity.ServerSink.SyncProcessMessage(msg);
+ }
+
+ public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ Identity identity = RemotingServices.GetIdentityForUri(((IMethodMessage)msg).Uri);
+ return identity.ServerSink.AsyncProcessMessage(msg, replySink);
+ }
+
+ public IMessageSink NextSink
+ {
+ get { return null; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerObjectTerminatorSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerObjectTerminatorSink.cs
new file mode 100644
index 00000000000..a688025d670
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ServerObjectTerminatorSink.cs
@@ -0,0 +1,43 @@
+//
+// System.Runtime.Remoting.ServerObjectTerminatorSink.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002, Lluis Sanchez Gual
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ // The final sink of the Server Object Sink Chain.
+ // It invokes object dynamic sinks and forwards the message
+ // to the StackBuilderSink
+
+ internal class ServerObjectTerminatorSink: IMessageSink
+ {
+ IMessageSink _nextSink;
+
+ public ServerObjectTerminatorSink(IMessageSink nextSink)
+ {
+ _nextSink = nextSink;
+ }
+
+ [MonoTODO("Invoke dynamic sinks")]
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ return _nextSink.SyncProcessMessage (msg);
+ }
+
+ [MonoTODO("Invoke dynamic sinks")]
+ public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ return _nextSink.AsyncProcessMessage (msg, replySink);
+ }
+
+ public IMessageSink NextSink
+ {
+ get { return _nextSink; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs
new file mode 100644
index 00000000000..392670b746d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs
@@ -0,0 +1,36 @@
+//
+// System.Runtime.Remoting.StackBuilderSink.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002, Lluis Sanchez Gual
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ // Sink that calls the real method of the object
+
+ public class StackBuilderSink: IMessageSink
+ {
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ // Makes the real call to the object
+
+ MarshalByRefObject obj = RemotingServices.GetServerForUri (((IMethodMessage)msg).Uri);
+ return RemotingServices.InternalExecuteMessage (obj, (IMethodCallMessage)msg);
+ }
+
+ [MonoTODO]
+ public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IMessageSink NextSink
+ {
+ get { return null; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Metadata/ChangeLog
new file mode 100644
index 00000000000..9669e4ef58a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/ChangeLog
@@ -0,0 +1,16 @@
+2002-07-29 Duncan Mak <duncan@ximian.com>
+
+ * SoapAttribute.cs: Fixed typo, renamed ReflectionInfo to ReflectInfo.
+
+ * SoapOption.cs: Fix the namespace.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * SoapAttribute.cs:
+ * SoapFieldAttribute.cs:
+ * SoapMethodAttribute.cs:
+ * SoapParameterAttribute.cs:
+ * SoapTypeAttribute.cs: Stubbed out.
+
+ * SoapOption.cs:
+ * XmlFieldOrderOption.cs: Moved here from System.Runtime.Remoting
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapAttribute.cs
new file mode 100644
index 00000000000..c84d8d8bfe4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapAttribute.cs
@@ -0,0 +1,55 @@
+//
+// System.Runtime.Remoting.Metadata.SoapAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.Remoting.Metadata {
+
+ public class SoapAttribute : Attribute
+ {
+ public SoapAttribute ()
+ {
+ }
+
+ protected string ProtXmlNamespace;
+ protected object ReflectInfo;
+
+ [MonoTODO]
+ public virtual bool Embedded {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool UseAttribute {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string XmlNamespace {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapFieldAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapFieldAttribute.cs
new file mode 100644
index 00000000000..8809748b259
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapFieldAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.Runtime.Remoting.Metadata.SoapFieldAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Metadata;
+
+namespace System.Runtime.Remoting.Metadata {
+
+ [AttributeUsage (AttributeTargets.Field)]
+ public sealed class SoapFieldAttribute : SoapAttribute
+ {
+ public SoapFieldAttribute ()
+ {
+ }
+
+ [MonoTODO]
+ public int Order {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string XmlElementName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsInteropXmlElement ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapMethodAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapMethodAttribute.cs
new file mode 100644
index 00000000000..a3b39de29fa
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapMethodAttribute.cs
@@ -0,0 +1,87 @@
+//
+// System.Runtime.Remoting.Metadata.SoapMethodAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Metadata;
+
+namespace System.Runtime.Remoting.Metadata {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class SoapMethodAttribute : SoapAttribute
+ {
+ public SoapMethodAttribute ()
+ {
+ }
+
+ [MonoTODO]
+ public string ResponseXmlElementName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string ResponseXmlNamespace {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string ReturnXmlElementName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string SoapAction {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override bool UseAttribute {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string XmlNamespace {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapOption.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapOption.cs
new file mode 100644
index 00000000000..2957bd3f66b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapOption.cs
@@ -0,0 +1,47 @@
+// SoapOption.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:11 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting.Metadata {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SoapOption {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ AlwaysIncludeTypes = 1,
+
+ /// <summary>
+ /// </summary>
+ XsdString = 2,
+
+ /// <summary>
+ /// </summary>
+ EmbedAll = 4,
+
+ /// <summary>
+ /// </summary>
+ Option1 = 8,
+
+ /// <summary>
+ /// </summary>
+ Option2 = 16,
+
+ } // SoapOption
+
+} // System.Runtime.Remoting.Metadata
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapParameterAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapParameterAttribute.cs
new file mode 100644
index 00000000000..8c53067b1f2
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapParameterAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Metadata.SoapParameterAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Metadata;
+
+namespace System.Runtime.Remoting.Metadata {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class SoapParameterAttribute : SoapAttribute
+ {
+ public SoapParameterAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapTypeAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapTypeAttribute.cs
new file mode 100644
index 00000000000..2e015537312
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/SoapTypeAttribute.cs
@@ -0,0 +1,99 @@
+//
+// System.Runtime.Remoting.Metadata.SoapTypeAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Metadata;
+
+namespace System.Runtime.Remoting.Metadata {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface)]
+ public sealed class SoapTypeAttribute : SoapAttribute
+ {
+ public SoapTypeAttribute ()
+ {
+ }
+
+ [MonoTODO]
+ public SoapOption SoapOptions {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override bool UseAttribute {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string XmlElementName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public XmlFieldOrderOption XmlFieldOrder {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string XmlNamespace {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string XmlTypeName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string XmlTypeNamespace {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Metadata/XmlFieldOrderOption.cs b/mcs/class/corlib/System.Runtime.Remoting.Metadata/XmlFieldOrderOption.cs
new file mode 100644
index 00000000000..cb7719c926a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Metadata/XmlFieldOrderOption.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Metadata.XmlFieldOrderOption.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+namespace System.Runtime.Remoting.Metadata {
+
+ public enum XmlFieldOrderOption
+ {
+ All = 0,
+ Sequence = 1,
+ Choice = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog
new file mode 100644
index 00000000000..cd00caa2b3e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog
@@ -0,0 +1,16 @@
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * RealProxy.cs: Added ObjectIdentity property.
+ Implemented CrateObjRef.
+ * RemotingProxy.cs: Added Identity parameter to constructor
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * ProxyAttribute.cs: Revert the last commit.
+
+ * System.Runtime.Remoting.Proxies/ProxyAttribute.cs: This
+ implements IContextAttribute.
+
+2002-07-23 Duncan Mak <duncan@ximian.com>
+
+ * System.Runtime.Remoting.Proxies/ProxyAttribute.cs: Added.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/ProxyAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ProxyAttribute.cs
new file mode 100644
index 00000000000..34314255574
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ProxyAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.Runtime.Remoting.Proxies.ProxyAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// Copyright (C) Ximian, Inc 2002.
+//
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Activation;
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting.Proxies {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public class ProxyAttribute : Attribute, IContextAttribute
+ {
+ public ProxyAttribute ()
+ {
+ }
+
+ [MonoTODO]
+ public virtual MarshalByRefObject CreateInstance (Type serverType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual RealProxy CreateProxy (ObjRef objref, Type serverType, object serverObject, Context serverContext)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void GetPropertiesForNewContext (IConstructionCallMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsContextOK (Context ctx, IConstructionCallMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
new file mode 100644
index 00000000000..079d8075b73
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
@@ -0,0 +1,78 @@
+//
+// System.Runtime.Remoting.Proxies.RealProxy.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.CompilerServices;
+
+
+namespace System.Runtime.Remoting.Proxies
+{
+ internal class TransparentProxy {
+ public RealProxy _rp;
+ IntPtr _class;
+ }
+
+ public abstract class RealProxy {
+
+ Type class_to_proxy;
+ Identity _objectIdentity;
+
+ protected RealProxy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected RealProxy (Type classToProxy)
+ {
+ this.class_to_proxy = classToProxy;
+ }
+
+ internal RealProxy (Type classToProxy, Identity identity)
+ {
+ this.class_to_proxy = classToProxy;
+ _objectIdentity = identity;
+ }
+
+ protected RealProxy (Type classToProxy, IntPtr stub, object stubData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual ObjRef CreateObjRef (Type requestedType)
+ {
+ return _objectIdentity.CreateObjRef (requestedType);
+ }
+
+ internal Identity ObjectIdentity
+ {
+ get { return _objectIdentity; }
+ }
+
+ public abstract IMessage Invoke (IMessage msg);
+
+ /* this is called from unmanaged code */
+ internal static object PrivateInvoke (RealProxy rp, IMessage msg, out Exception exc,
+ out object [] out_args)
+ {
+ IMethodReturnMessage res_msg = (IMethodReturnMessage)rp.Invoke (msg);
+
+ exc = res_msg.Exception;
+ out_args = res_msg.OutArgs;
+ return res_msg.ReturnValue;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern virtual object GetTransparentProxy ();
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs
new file mode 100644
index 00000000000..5e18900e2ec
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs
@@ -0,0 +1,36 @@
+//
+// System.Runtime.Remoting.Proxies.RemotingProxy.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.CompilerServices;
+
+
+namespace System.Runtime.Remoting.Proxies
+{
+
+ public class RemotingProxy : RealProxy
+ {
+ IMessageSink _sink;
+
+ internal RemotingProxy (Type type, Identity identity) : base (type, identity)
+ {
+ _sink = identity.ClientSink;
+ }
+
+ public override IMessage Invoke (IMessage request)
+ {
+ ((MonoMethodMessage)request).Uri = ObjectIdentity.ObjectUri;
+ return _sink.SyncProcessMessage (request);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Services/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Services/ChangeLog
new file mode 100644
index 00000000000..05629a69ceb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Services/ChangeLog
@@ -0,0 +1,7 @@
+2002-12-10 Jaime Anguiano Olarra <jaime@gnome.org>
+
+ * TrackingServices.cs: Added to CVS.
+
+2002-07-30 Duncan Mak <duncan@ximian.com>
+
+ * ITrackingHandler.cs: Added to CVS.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Services/ITrackingHandler.cs b/mcs/class/corlib/System.Runtime.Remoting.Services/ITrackingHandler.cs
new file mode 100644
index 00000000000..4b59184d0e9
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Services/ITrackingHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Services.ITrackingHandler.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Services {
+ public interface ITrackingHandler
+ {
+ void DisconnectedObject (object obj);
+ void MarshaledObject (object obj, ObjRef or);
+ void UnmarshaledObject (object obj, ObjRef or);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Services/TrackingServices.cs b/mcs/class/corlib/System.Runtime.Remoting.Services/TrackingServices.cs
new file mode 100644
index 00000000000..23bde0d59e7
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Services/TrackingServices.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.Remoting.Services.TrackingServices.cs
+//
+// Author:
+// Jaime Anguiano Olarra (jaime@gnome.org)
+//
+// (C) 2002, Jaime Anguiano Olarra
+//
+// FIXME: This is just a skeleton for practical purpouses.
+//
+
+using System;
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Services
+{
+ [MonoTODO]
+ public class TrackingServices
+ {
+ public TrackingServices () {
+ }
+
+ public static void RegisterTrackingHandler (ITrackingHandler handler) {
+ throw new NotImplementedException ();
+ }
+
+ public static void UnregisterTrackingHandler (ITrackingHandler handler) {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ActivatedClientTypeEntry.cs b/mcs/class/corlib/System.Runtime.Remoting/ActivatedClientTypeEntry.cs
new file mode 100644
index 00000000000..404f2f9e86c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ActivatedClientTypeEntry.cs
@@ -0,0 +1,54 @@
+//
+// System.Runtime.Remoting.ActivatedClientTypeEntry.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting {
+
+ public class ActivatedClientTypeEntry : TypeEntry
+ {
+ string applicationUrl;
+ Type obj_type;
+
+ public ActivatedClientTypeEntry (Type type, string appUrl)
+ {
+ AssemblyName = type.Assembly.FullName;
+ TypeName = type.FullName;
+ applicationUrl = appUrl;
+ obj_type = type;
+ }
+
+ public ActivatedClientTypeEntry (string typeName, string assemblyName, string appUrl)
+ {
+ AssemblyName = assemblyName;
+ TypeName = typeName;
+ applicationUrl = appUrl;
+ }
+
+ public string ApplicationUrl {
+ get { return applicationUrl; }
+ }
+
+ public IContextAttribute [] ContextAttributes {
+ get { return null; }
+ set { } // This is not implemented in the MS runtime yet.
+ }
+
+ public Type ObjectType {
+ get { return obj_type; }
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ return TypeName + AssemblyName + ApplicationUrl;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ActivatedServiceTypeEntry.cs b/mcs/class/corlib/System.Runtime.Remoting/ActivatedServiceTypeEntry.cs
new file mode 100644
index 00000000000..bf0365cbfb6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ActivatedServiceTypeEntry.cs
@@ -0,0 +1,50 @@
+//
+// System.Runtime.Remoting.ActivatedServiceTypeEntry.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting {
+
+ public class ActivatedServiceTypeEntry : TypeEntry
+ {
+ Type obj_type;
+
+ public ActivatedServiceTypeEntry (Type type)
+ {
+ AssemblyName = type.Assembly.FullName;
+ TypeName = type.FullName;
+ obj_type = type;
+ }
+
+ public ActivatedServiceTypeEntry (string typeName, string assemblyName)
+ {
+ AssemblyName = assemblyName;
+ TypeName = typeName;
+ Assembly a = Assembly.Load (assemblyName);
+ obj_type = a.GetType (typeName);
+ }
+
+ public IContextAttribute [] ContextAttributes {
+ get { return null; }
+ set { } // This is not implemented in the MS runtime yet.
+ }
+
+ public Type ObjectType {
+ get { return obj_type; }
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ return AssemblyName + TypeName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
new file mode 100755
index 00000000000..2338ac4b264
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
@@ -0,0 +1,85 @@
+2002-12-28 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * SoapServices.cs: Implemented some methods
+
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * ObjRef.cs: Implementation now based on methods of RemotingServices.
+ * RemotingServices.cs: Remoting information now kept in Identity objects.
+ All methods adapted to work with identities.
+ Renamed ExecuteMessage to InternalExecuteMessage. ExecuteMessage should
+ not make a direct call to the object.
+ * Identity.cs: added.
+
+2002-12-11 Jaime Anguiano Olarra <jaime@gnome.org>
+
+ * RemotingConfiguration.cs: added to the CVS.
+
+2002-11-29 Jaime Anguiano Olarra <jaime@gnome.org>
+
+ * ObjectHandle.cs: added implementation for InitializeLifetimeService
+ * method.
+
+
+2002-11-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SoapServices.cs: fix error CS3005.
+
+2002-09-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * RemotingServices.cs: add an unique app_id string used to generate
+ unique object uris.
+
+ * ObjRef.cs: added serialization support
+
+2002-08-31 Dietmar Maurer <dietmar@ximian.com>
+
+ * ObjRef.cs: gather the channel date at creation time.
+
+2002-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * RemotingServices.cs: Connect impl.
+
+2002-08-02 Duncan Mak <duncan@ximian.com>
+
+ * ActivatedClientTypeEntry.cs:
+ * ActivatedServiceTypeEntry.cs:
+ * WellKnownClientTypeEntry.cs:
+ * WellKnownServiceTypeEntry.cs: Various visibility fixes.
+
+2002-07-31 Duncan Mak <duncan@ximian.com>
+
+ * TypeEntry.cs:
+ * ActivatedClientTypeEntry.cs:
+ * ActivatedServiceTypeEntry.cs:
+ * WellKnownClientTypeEntry.cs:
+ * WellKnownServiceTypeEntry.cs: Added all the classes derived from TypeEntry.
+
+ * RemotingException.cs:
+ * RemotingTimeoutException.cs:
+ * ServerException.cs: Added missing exceptions.
+
+ * IChannelInfo.cs:
+ * IEnvoyInfo.cs:
+ * IRemotingTypeInfo.cs: Added missing interfaces.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * LeaseState.cs: Moved to System.Runtime.Remoting.Lifetime.
+
+ * SoapMethodOption.cs:
+ * SoapOption.cs: Removed and merged into System.Runtime.Remoting.Metadata.SoapOption.
+
+2002-07-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IObjectHandle.cs: New file.
+ * ObjectHandle.cs: implemented constructor and Unwrap.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ObjRef.cs : Strew the MonoTODO attribute.
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * ObjRef.cs: Include System.Runtime.Serialization
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/IChannelInfo.cs b/mcs/class/corlib/System.Runtime.Remoting/IChannelInfo.cs
new file mode 100644
index 00000000000..643d56955f0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/IChannelInfo.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.IChannelInfo.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.Remoting {
+
+ public interface IChannelInfo
+ {
+ object[] ChannelData { get; set; }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/IEnvoyInfo.cs b/mcs/class/corlib/System.Runtime.Remoting/IEnvoyInfo.cs
new file mode 100644
index 00000000000..d66709ae621
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/IEnvoyInfo.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.IEnvoyInfo.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting {
+
+ public interface IEnvoyInfo
+ {
+ IMessageSink EnvoySinks { get; set; }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/IObjectHandle.cs b/mcs/class/corlib/System.Runtime.Remoting/IObjectHandle.cs
new file mode 100644
index 00000000000..20bf4bc4907
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/IObjectHandle.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.Remoting.IObjectHandle.cs
+//
+// Authors:
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting
+{
+ public interface IObjectHandle
+ {
+ object Unwrap ();
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/IRemotingTypeInfo.cs b/mcs/class/corlib/System.Runtime.Remoting/IRemotingTypeInfo.cs
new file mode 100644
index 00000000000..238b55c827a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/IRemotingTypeInfo.cs
@@ -0,0 +1,64 @@
+//
+// System.Runtime.Remoting.IRemotingTypeInfo.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System.Reflection;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting {
+
+ public interface IRemotingTypeInfo
+ {
+ string TypeName { get; set; }
+ bool CanCastTo (Type fromType, object o);
+ }
+
+ // fixme: dont know if we really need this
+ internal class RemotingTypeInfo : IRemotingTypeInfo
+ {
+
+ string type_name;
+
+ public RemotingTypeInfo (Type type)
+ {
+ type_name = type.AssemblyQualifiedName;
+ }
+
+ public string TypeName {
+
+ get {
+ return type_name;
+ }
+
+ set {
+ type_name = value;
+ }
+ }
+
+ public Type GetRealType ()
+ {
+ string type_name = null;
+ Assembly assembly = null;
+
+ int pos = type_name.IndexOf (",");
+ if (pos >= 0) {
+ if (pos != 0) {
+ string ass_name = type_name.Substring (0, pos - 1);
+ assembly = Assembly.Load (ass_name);
+ }
+ type_name = type_name.Substring (pos + 1);
+ }
+ return assembly.GetType (type_name);
+ }
+
+ public bool CanCastTo (Type fromType, object o)
+ {
+ return false;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/Identity.cs b/mcs/class/corlib/System.Runtime.Remoting/Identity.cs
new file mode 100644
index 00000000000..44d343af14f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/Identity.cs
@@ -0,0 +1,102 @@
+//
+// System.Runtime.Remoting.Identity.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002, Lluis Sanchez Gual
+//
+
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting
+{
+ internal class Identity
+ {
+ // An Identity object holds remoting information about
+ // an object. It can be used to store client side information
+ // (information about how to reach the remote server),
+ // and also to store server side information (information
+ // about how to dispatch messages to the object in the server).
+
+ // The object that this identity represents. Can be a MarshalByRefObject
+ // (if it is a server object) or a transparent proxy (if it is a client
+ // proxy to a remote object).
+ object _realObject;
+
+ Type _objectType;
+
+ // URI of the object
+ string _objectUri;
+
+ // Message sink to use to send a message to the remote server
+ IMessageSink _clientSink = null;
+
+ // Message sink used in the server to dispatch a message
+ // to the server object
+ IMessageSink _serverSink = null;
+ Context _context;
+
+ ObjRef _objRef = null;
+
+ public Identity(string objectUri, Context context, Type objectType)
+ {
+ _objectUri = objectUri;
+ _context = context;
+ _objectType = objectType;
+ }
+
+ public ObjRef CreateObjRef (Type requestedType)
+ {
+ // fixme: handle requested_type
+ if (requestedType == null) requestedType = _objectType;
+ ObjRef res = new ObjRef ((MarshalByRefObject)_realObject, requestedType);
+ res.URI = _objectUri;
+ _objRef = res;
+ return res;
+ }
+
+ public bool IsFromThisAppDomain
+ {
+ get
+ {
+ // fixme: what if it is contextbound?
+ return (_clientSink == null);
+ }
+ }
+
+ public object RealObject
+ {
+ get { return _realObject; }
+ set { _realObject = value; }
+ }
+
+ public string ObjectUri
+ {
+ get { return _objectUri; }
+ }
+
+ public IMessageSink ClientSink
+ {
+ get { return _clientSink; }
+ set { _clientSink = value; }
+ }
+
+ public IMessageSink ServerSink
+ {
+ get
+ {
+ if (_serverSink == null) {
+ _serverSink = _context.CreateServerObjectSinkChain((MarshalByRefObject)_realObject);
+ }
+ return _serverSink;
+ }
+ }
+
+ public Context Context
+ {
+ get { return _context; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
new file mode 100644
index 00000000000..aab6e90277e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
@@ -0,0 +1,142 @@
+//
+// System.Runtime.Remoting.ObjRef.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+// FIXME: This is just a skeleton for practical purposes.
+//
+
+using System;
+using System.Runtime.Serialization;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+
+namespace System.Runtime.Remoting {
+
+ [Serializable]
+ public class ObjRef : IObjectReference, ISerializable
+ {
+ IChannelInfo channel_info;
+ string uri;
+ Type type;
+
+ public ObjRef ()
+ {
+ // no idea why this needs to be public
+ }
+
+ public ObjRef (MarshalByRefObject mbr, Type type)
+ {
+ if (mbr == null)
+ throw new ArgumentNullException ("mbr");
+
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ // The ObjRef can only be constructed if the given mbr
+ // has already been marshalled using RemotingServices.Marshall
+
+ this.uri = RemotingServices.GetObjectUri(mbr);
+ this.type = type;
+
+ channel_info = new ChannelInfoStore ();
+ }
+
+ protected ObjRef (SerializationInfo si, StreamingContext sc)
+ {
+ SerializationInfoEnumerator en = si.GetEnumerator();
+
+ while (en.MoveNext ()) {
+ switch (en.Name) {
+ case "uri":
+ uri = (string)en.Value;
+ break;
+ case "type":
+ type = (Type)en.Value;
+ break;
+ case "channelInfo":
+ type = (Type)en.Value;
+ break;
+ default:
+ throw new NotSupportedException ();
+ }
+ }
+ }
+
+ public virtual IChannelInfo ChannelInfo {
+
+ get {
+ return channel_info;
+ }
+
+ set {
+ channel_info = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual IEnvoyInfo EnvoyInfo {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual IRemotingTypeInfo TypeInfo {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public virtual string URI {
+ get {
+ return uri;
+ }
+ set {
+ uri = value;
+ }
+ }
+
+ public virtual void GetObjectData (SerializationInfo si, StreamingContext sc)
+ {
+ si.SetType (type);
+
+ si.AddValue ("url", uri);
+ si.AddValue ("type", type, typeof (Type));
+ si.AddValue ("channelInfo", channel_info, typeof(IChannelInfo));
+ }
+
+ public virtual object GetRealObject (StreamingContext sc)
+ {
+ return RemotingServices.GetRemoteObject(type, null, channel_info.ChannelData);
+ }
+
+ public bool IsFromThisAppDomain ()
+ {
+ Identity identity = RemotingServices.GetIdentityForUri (uri);
+ if (identity == null) return false; // URI not registered in this domain
+
+ return identity.IsFromThisAppDomain;
+ }
+
+ [MonoTODO]
+ public bool IsFromThisProcess ()
+ {
+ // as yet we do not consider this optimization
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs
new file mode 100644
index 00000000000..19d39a02c3b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs
@@ -0,0 +1,52 @@
+//
+// System.Runtime.Remoting.ObjectHandle.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+// Jaime Anguiano Olarra (jaime@gnome.org)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System;
+using System.Runtime.Serialization;
+using System.Runtime.Remoting.Lifetime;
+
+namespace System.Runtime.Remoting {
+
+ public class ObjectHandle : MarshalByRefObject, IObjectHandle {
+ private object _wrapped;
+ private object life_ctrl;
+
+ public ObjectHandle (object o)
+ {
+ _wrapped = o;
+ }
+
+ [MonoTODO]
+ public override object InitializeLifetimeService ()
+ {
+ life_ctrl = base.InitializeLifetimeService ();
+ ILease ilife_ctrl = life_ctrl as ILease;
+
+ if (ilife_ctrl != null)
+
+ // I can't see in the .NET docs if the lifetime counter
+ // must be initialized to the time the object is created
+ // or if a relativistic time is enough (as both differ in
+ // fact just in a constant. In the meantime I'll use 0.
+
+ ilife_ctrl.InitialLeaseTime = new TimeSpan ((long) 0);
+
+ return ilife_ctrl;
+ }
+
+ public object Unwrap ()
+ {
+ return _wrapped;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs
new file mode 100644
index 00000000000..08542de5c7f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs
@@ -0,0 +1,128 @@
+//
+// System.Runtime.Remoting.RemotingConfiguration.cs
+//
+// Author: Jaime Anguiano Olarra (jaime@gnome.org)
+//
+// (C) 2002, Jaime Anguiano Olarra
+//
+// FIXME: This is just the skeleton for practical purposes
+
+using System;
+using System.IO;
+using System.Security.Cryptography;
+
+namespace System.Runtime.Remoting
+{
+ [MonoTODO]
+ public class RemotingConfiguration
+ {
+ static string applicationID = null;
+ static string applicationName = null;
+ static string processId = null;
+ static string configFile = "";
+ static MiniParser parser = null;
+
+ // public properties
+ // At this time the ID will be the application name
+ public static string ApplicationId
+ {
+ get
+ {
+ applicationID = AppDomain.CurrentDomain.SetupInformation.ApplicationName;
+ return applicationID;
+ }
+ }
+
+ public static string ApplicationName
+ {
+ get {
+ try {
+ applicationName = AppDomain.CurrentDomain.SetupInformation.ApplicationName;
+ }
+ catch (Exception e) {
+ throw e;
+ }
+ // We return null if the application name has not been set.
+ return null;
+ }
+ set { applicationName = value; }
+ }
+
+ public static string ProcessId
+ {
+ get {
+ processId = AppDomain.CurrentDomain.SetupInformation.ApplicationName;
+ return processId;
+ }
+ }
+
+ // public methods
+
+ public static void Configure (string filename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static ActivatedClientTypeEntry GetRegisteredActivatedClientTypes () {
+ throw new NotImplementedException ();
+ }
+
+ public static ActivatedServiceTypeEntry GetRegisteredActivatedServiceTypes () {
+ throw new NotImplementedException ();
+ }
+
+ public static WellKnownClientTypeEntry GetRegisteredWellKnownClientTypes () {
+ throw new NotImplementedException ();
+ }
+
+ public static WellKnownServiceTypeEntry GetRegisteredWellKnownServiceTypes () {
+ throw new NotImplementedException ();
+ }
+
+ public static bool IsActivationAllowed (Type serverType) {
+ throw new NotImplementedException ();
+ }
+
+ public static ActivatedClientTypeEntry IsRemotelyActivatedClientType (Type serviceTypes) {
+ throw new NotImplementedException ();
+ }
+
+ public static ActivatedClientTypeEntry IsRemotelyActivatedClientType (string typeName, string assemblyName) {
+ throw new NotImplementedException ();
+ }
+
+ public static WellKnownClientTypeEntry IsWellKnownClientType (Type serviceType) {
+ throw new NotImplementedException ();
+ }
+
+ public static WellKnownClientTypeEntry IsWellKnownClientType (string typeName, string assemblyName) {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterActivatedClientType (ActivatedClientTypeEntry entry) {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterActivatedClientType (Type type, string appUrl) {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterActivatedServiceType (ActivatedServiceTypeEntry entry) {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterActivatedServiceType (Type type) {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterWellKnownClientType (WellKnownClientTypeEntry entry) {
+ throw new NotImplementedException ();
+ }
+
+ public static void RegisterWellKnownServiceType (Type type, string objectUrl) {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingException.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingException.cs
new file mode 100644
index 00000000000..5e099f38d89
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingException.cs
@@ -0,0 +1,37 @@
+//
+// System.Runtime.Remoting.RemotingException.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting {
+
+ [Serializable]
+ public class RemotingException : SystemException
+ {
+ public RemotingException ()
+ : base ()
+ {
+ }
+
+ public RemotingException (string message)
+ : base (message)
+ {
+ }
+
+ protected RemotingException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public RemotingException (string message, Exception ex)
+ : base (message, ex)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
new file mode 100644
index 00000000000..f27f2b4494a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
@@ -0,0 +1,246 @@
+//
+// System.Runtime.Remoting.RemotingServices.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Threading;
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Contexts;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting
+{
+ public sealed class RemotingServices
+ {
+ // Holds the identities of the objects, using uri as index
+ static Hashtable uri_hash = new Hashtable ();
+
+ internal static string app_id;
+ static int next_id = 1;
+
+ static RemotingServices ()
+ {
+ app_id = "/" + Guid.NewGuid().ToString().Replace('-', '_') + "/";
+ }
+
+ private RemotingServices () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static object InternalExecute (MonoMethod method, Object obj,
+ Object[] parameters, out object [] out_args);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static bool IsTransparentProxy (object proxy);
+
+ internal static IMethodReturnMessage InternalExecuteMessage (
+ MarshalByRefObject target, IMethodCallMessage reqMsg)
+ {
+ ReturnMessage result;
+
+ MonoMethod method = (MonoMethod)reqMsg.MethodBase;
+
+ try {
+ object [] out_args;
+ object rval = InternalExecute (method, target, reqMsg.Args, out out_args);
+ result = new ReturnMessage (rval, out_args, out_args.Length,
+ reqMsg.LogicalCallContext, reqMsg);
+
+ } catch (Exception e) {
+ result = new ReturnMessage (e, reqMsg);
+ }
+
+ return result;
+ }
+
+ public static IMethodReturnMessage ExecuteMessage (
+ MarshalByRefObject target, IMethodCallMessage reqMsg)
+ {
+ if (IsTransparentProxy(target))
+ {
+ // Message must go through all chain of sinks
+ RealProxy rp = GetRealProxy (target);
+ return (IMethodReturnMessage) rp.Invoke (reqMsg);
+ }
+ else // Direct call
+ return InternalExecuteMessage (target, reqMsg);
+ }
+
+ public static object Connect (Type classToProxy, string url)
+ {
+ return GetRemoteObject(classToProxy, url, null);
+ }
+
+ public static object Connect (Type classToProxy, string url, object data)
+ {
+ return GetRemoteObject (classToProxy, url, data);
+ }
+
+ public static Type GetServerTypeForUri (string uri)
+ {
+ object svr = GetServerForUri (uri);
+
+ if (svr == null)
+ return null;
+
+ return svr.GetType ();
+ }
+
+ public static string GetObjectUri (MarshalByRefObject obj)
+ {
+ if (IsTransparentProxy(obj))
+ {
+ return GetRealProxy (obj).ObjectIdentity.ObjectUri;
+ }
+ else
+ return obj.ObjectIdentity.ObjectUri;
+ }
+
+ internal static MarshalByRefObject GetServerForUri (string uri)
+ {
+ lock (uri_hash)
+ {
+ return (MarshalByRefObject)((Identity)uri_hash [uri]).RealObject;
+ }
+ }
+
+ internal static Identity GetIdentityForUri (string uri)
+ {
+ lock (uri_hash)
+ {
+ return (Identity)uri_hash [uri];
+ }
+ }
+
+ private static Identity GetClientIdentity(Type requiredType, string url, object channelData)
+ {
+ // This method looks for an identity for the given url.
+ // If an identity is not found, it creates the identity and
+ // assigns it a proxy to the remote object.
+
+ // Creates the client sink chain for the given url or channelData.
+ // It will also get the object uri from the url.
+
+ string objectUri;
+ IMessageSink sink = ChannelServices.CreateClientChannelSinkChain (url, channelData, out objectUri);
+ if (sink == null)
+ {
+ string msg = String.Format ("Cannot create channel sink to connect to URL {0}.", url);
+ throw new RemotingException (msg);
+ }
+
+ lock (uri_hash)
+ {
+ Identity identity = (Identity)uri_hash [objectUri];
+ if (identity != null)
+ return identity; // Object already registered
+
+ // Creates an identity and a proxy for the remote object
+
+ identity = new Identity(objectUri, null, requiredType);
+ identity.ClientSink = sink;
+
+ RemotingProxy proxy = new RemotingProxy (requiredType, identity);
+ identity.RealObject = proxy.GetTransparentProxy();
+
+ // Registers the identity
+ uri_hash [objectUri] = identity;
+ return identity;
+ }
+ }
+
+ private static Identity GetServerIdentity(MarshalByRefObject realObject, string objectUri)
+ {
+ // This method looks for an identity for the given object.
+ // If an identity is not found, it creates the identity and
+ // assigns it to the given object
+
+ lock (uri_hash)
+ {
+ Identity identity = (Identity)uri_hash [objectUri];
+ if (identity != null)
+ return identity; // Object already registered
+
+ identity = new Identity (objectUri, Context.DefaultContext, realObject.GetType());
+ identity.RealObject = realObject;
+
+ // Registers the identity
+ uri_hash[objectUri] = identity;
+ realObject.ObjectIdentity = identity;
+
+ return identity;
+ }
+ }
+
+ internal static object GetRemoteObject(Type requiredType, string url, object channelData)
+ {
+ Identity id = GetClientIdentity(requiredType, url, channelData);
+ return id.RealObject;
+ }
+
+ public static object Unmarshal (ObjRef objref)
+ {
+ return Unmarshal(objref, false);
+ }
+
+ public static object Unmarshal (ObjRef objref, bool fRefine)
+ {
+ // FIXME: use type name when fRefine==true
+ Type requiredType = Type.GetType(objref.TypeInfo.TypeName);
+ return GetRemoteObject(requiredType, null, objref.ChannelInfo.ChannelData);
+ }
+
+ public static ObjRef Marshal (MarshalByRefObject obj)
+ {
+ return Marshal (obj, null, null);
+ }
+
+ public static ObjRef Marshal (MarshalByRefObject obj, string uri)
+ {
+ return Marshal (obj, uri, null);
+ }
+
+ public static ObjRef Marshal (MarshalByRefObject obj, string uri, Type requested_type)
+ {
+ if (IsTransparentProxy (obj))
+ {
+ RealProxy proxy = RemotingServices.GetRealProxy(obj);
+ if (proxy != null && proxy.ObjectIdentity != null)
+ {
+ if (uri != null)
+ throw new RemotingException ("It is not possible marshal a proxy of a remote object");
+
+ return proxy.ObjectIdentity.CreateObjRef(requested_type);
+ }
+ }
+
+ if (uri == null) uri = app_id + Environment.TickCount + "_" + next_id++;
+
+ // It creates the identity if not found
+ Identity identity = GetServerIdentity (obj, uri);
+
+ if (obj != identity.RealObject)
+ throw new RemotingException ("uri already in use, " + uri);
+ // already registered
+
+ return identity.CreateObjRef(requested_type);
+ }
+
+ public static RealProxy GetRealProxy (object proxy)
+ {
+ if (!IsTransparentProxy(proxy)) throw new RemotingException("Cannot get the real proxy from an object that is not a transparent proxy");
+ return (RealProxy)((TransparentProxy)proxy)._rp;
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingTimeoutException.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingTimeoutException.cs
new file mode 100644
index 00000000000..af2f4462c03
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingTimeoutException.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.Remoting.RemotingTimeoutException.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting {
+
+ [Serializable]
+ public class RemotingTimeoutException : RemotingException
+ {
+ public RemotingTimeoutException ()
+ : base ()
+ {
+ }
+
+ public RemotingTimeoutException (string message)
+ : base (message)
+ {
+ }
+
+ public RemotingTimeoutException (string message, Exception ex)
+ : base (message, ex)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ServerException.cs b/mcs/class/corlib/System.Runtime.Remoting/ServerException.cs
new file mode 100644
index 00000000000..becfb5d6c6e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ServerException.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.Remoting.ServerException.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting {
+
+ [Serializable]
+ public class ServerException : SystemException
+ {
+ public ServerException ()
+ : base ()
+ {
+ }
+
+ public ServerException (string message)
+ : base (message)
+ {
+ }
+
+ public ServerException (string message, Exception ex)
+ : base (message, ex)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/SoapServices.cs b/mcs/class/corlib/System.Runtime.Remoting/SoapServices.cs
new file mode 100644
index 00000000000..d3d6a6830cc
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/SoapServices.cs
@@ -0,0 +1,243 @@
+//
+// System.Runtime.Remoting.SoapServices.cs
+//
+// Author: Jaime Anguiano Olarra (jaime@gnome.org)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (c) 2002, Jaime Anguiano Olarra
+//
+
+
+using System;
+using System.Runtime.Remoting;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.Runtime.Remoting {
+
+ [Serializable]
+ [ClassInterface (ClassInterfaceType.AutoDual)]
+ public class SoapServices
+ {
+ // properties
+
+ public static string XmlNsForClrType
+ {
+ get { return "http://schemas.microsoft.com/clr/"; }
+ }
+
+ public static string XmlNsForClrTypeWithAssembly
+ {
+ get { return "http://schemas.microsoft.com/clr/assem/"; }
+ }
+
+ public static string XmlNsForClrTypeWithNs
+ {
+ get { return "http://schemas.microsoft.com/clr/ns/"; }
+ }
+
+ public static string XmlNsForClrTypeWithMsAndAssembly
+ {
+ get { return "http://schemas.microsoft.com/clr/nsassem/"; }
+ }
+
+
+ // public methods
+
+ public static string CodeXmlNamespaceForClrTypeNamespace (string typeNamespace,
+ string assemblyName)
+ {
+ // If assemblyName is empty, then use the corlib namespace
+
+ if (assemblyName == string.Empty)
+ return XmlNsForClrTypeWithNs + typeNamespace + "/" + assemblyName;
+ else
+ return XmlNsForClrTypeWithMsAndAssembly + typeNamespace + "/" + assemblyName;
+ }
+
+ public static bool DecodeXmlNamespaceForClrTypeNamespace (string inNamespace,
+ out string typeNamespace,
+ out string assemblyName) {
+
+ if (inNamespace == null) throw new ArgumentNullException ("inNamespace");
+
+ typeNamespace = null;
+ assemblyName = null;
+
+ if (inNamespace.StartsWith(XmlNsForClrTypeWithMsAndAssembly))
+ {
+ int typePos = XmlNsForClrTypeWithMsAndAssembly.Length;
+ if (typePos >= inNamespace.Length) return false;
+ int assemPos = inNamespace.IndexOf ('/', typePos+1);
+ if (assemPos == -1) return false;
+ typeNamespace = inNamespace.Substring (typePos, assemPos - typePos);
+ assemblyName = inNamespace.Substring (assemPos+1);
+ return true;
+ }
+ else if (inNamespace.StartsWith(XmlNsForClrTypeWithNs))
+ {
+ int typePos = XmlNsForClrTypeWithNs.Length;
+ typeNamespace = inNamespace.Substring (typePos);
+ return true;
+ }
+ else
+ return false;
+ }
+
+ [MonoTODO]
+ public static void GetInteropFieldTypeAndNameFromXmlAttribute (Type containingType,
+ string xmlAttribute,
+ string xmlNamespace,
+ out Type type,
+ out string name) {
+ throw new NotImplementedException ();
+
+ }
+
+ [MonoTODO]
+ public static void GetInteropFieldTypeAndNameFromXmlElement (Type containingType,
+ string xmlElement,
+ string xmlNamespace,
+ out Type type,
+ out string name) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetInteropTypeFromXmlElement (string xmlElement, string xmlNamespace) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetInteropTypeFromXmlType (string xmlType, string xmlTypeNamespace) {
+ throw new NotImplementedException ();
+ }
+
+ private static string GetAssemblyName(MethodBase mb)
+ {
+ if (mb.DeclaringType.Assembly == typeof (object).Assembly)
+ return string.Empty;
+ else
+ return mb.DeclaringType.Assembly.GetName().Name;
+ }
+
+ public static string GetSoapActionFromMethodBase (MethodBase mb)
+ {
+ string ns = CodeXmlNamespaceForClrTypeNamespace (mb.DeclaringType.Name, GetAssemblyName(mb));
+ return ns + "#" + mb.Name;
+ }
+
+ [MonoTODO]
+ public new Type GetType () {
+ throw new NotImplementedException ();
+ }
+
+ public static bool GetTypeAndMethodNameFromSoapAction (string soapAction,
+ out string typeName,
+ out string methodName) {
+ string type;
+ string assembly;
+
+ typeName = null;
+ methodName = null;
+
+ int i = soapAction.LastIndexOf ('#');
+ if (i == -1) return false;
+
+ methodName = soapAction.Substring (i+1);
+
+ if (!DecodeXmlNamespaceForClrTypeNamespace (soapAction.Substring (0,i), out type, out assembly) )
+ return false;
+
+ if (assembly == null)
+ typeName = type + ", " + typeof (object).Assembly.GetName().Name;
+ else
+ typeName = type + ", " + assembly;
+
+ return true;
+ }
+
+ [MonoTODO]
+ public static bool GetXmlElementForInteropType (Type type,
+ out string xmlElement,
+ out string xmlNamespace) {
+ throw new NotImplementedException ();
+
+ }
+
+ public static string GetXmlNamespaceForMethodCall (MethodBase mb)
+ {
+ return CodeXmlNamespaceForClrTypeNamespace (mb.DeclaringType.Name, GetAssemblyName(mb));
+ }
+
+ public static string GetXmlNamespaceForMethodResponse (MethodBase mb)
+ {
+ return CodeXmlNamespaceForClrTypeNamespace (mb.DeclaringType.Name, GetAssemblyName(mb));
+ }
+
+ [MonoTODO]
+ public static bool GetXmlTypeForInteropType (Type type,
+ out string xmlType,
+ out string xmlTypeNamespace) {
+ throw new NotImplementedException ();
+
+ }
+
+ public static bool IsClrTypeNamespace (string namespaceString)
+ {
+ return namespaceString.StartsWith (XmlNsForClrType);
+ }
+
+ public static bool IsSoapActionValidForMethodBase (string soapAction, MethodBase mb)
+ {
+ string typeName;
+ string methodName;
+ GetTypeAndMethodNameFromSoapAction (soapAction, out typeName, out methodName);
+
+ if (methodName != mb.Name) return false;
+
+ string methodClassType = mb.DeclaringType.FullName + ", " + mb.DeclaringType.Assembly.GetName().Name;
+ return typeName == methodClassType;
+ }
+
+ [MonoTODO]
+ public static void PreLoad (Assembly assembly) {
+ throw new NotImplementedException ();
+
+ }
+
+ [MonoTODO]
+ public static void PreLoad (Type type) {
+ throw new NotImplementedException ();
+
+ }
+
+ [MonoTODO]
+ public static void RegisterInteropXmlElement (string xmlElement,
+ string xmlNamespace,
+ Type type) {
+ throw new NotImplementedException ();
+
+ }
+
+ [MonoTODO]
+ public static void RegisterInteropXmlType (string xmlType,
+ string xmlTypeNamespace,
+ Type type) {
+ throw new NotImplementedException ();
+
+ }
+
+ [MonoTODO]
+ public static void RegisterSoapActionForMethodBase (MethodBase mb) {
+ throw new NotImplementedException ();
+
+ }
+
+ [MonoTODO]
+ public static void RegisterSoapActionForMethodBase (MethodBase mb, string soapAction) {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/TypeEntry.cs b/mcs/class/corlib/System.Runtime.Remoting/TypeEntry.cs
new file mode 100644
index 00000000000..a39e848f7fc
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/TypeEntry.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.Remoting.TypeEntry.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.Remoting {
+
+ public class TypeEntry
+ {
+ string assembly_name;
+ string type_name;
+
+ protected TypeEntry ()
+ {
+ }
+
+ public string AssemblyName {
+ get { return assembly_name; }
+ set { assembly_name = value; }
+ }
+
+ public string TypeName {
+ get { return type_name; }
+ set { type_name = value; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/WellKnownClientTypeEntry.cs b/mcs/class/corlib/System.Runtime.Remoting/WellKnownClientTypeEntry.cs
new file mode 100644
index 00000000000..e361bb5a758
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/WellKnownClientTypeEntry.cs
@@ -0,0 +1,57 @@
+//
+// System.Runtime.Remoting.WellKnownClientTypeEntry.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Runtime.Remoting {
+
+ public class WellKnownClientTypeEntry : TypeEntry
+ {
+ Type obj_type;
+ string obj_url;
+ string app_url = null;
+
+ public WellKnownClientTypeEntry (Type type, string objectUrl )
+ {
+ AssemblyName = type.Assembly.FullName;
+ TypeName = type.FullName;
+ obj_type = type;
+ obj_url = objectUrl;
+ }
+
+ public WellKnownClientTypeEntry (string typeName, string assemblyName, string objectUrl)
+ {
+ AssemblyName = assemblyName;
+ TypeName = typeName;
+ Assembly a = Assembly.Load (assemblyName);
+ obj_type = a.GetType (typeName);
+ }
+
+ public string ApplicationUrl {
+ get { return app_url; }
+ set { app_url = value; }
+ }
+
+ public Type ObjectType {
+ get { return obj_type; }
+ }
+
+ public string ObjectUrl {
+ get { return obj_url; }
+ }
+
+ public override string ToString ()
+ {
+ if (ApplicationUrl != null)
+ return TypeName + AssemblyName + ObjectUrl + ApplicationUrl;
+ else
+ return TypeName + AssemblyName + ObjectUrl;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs b/mcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs
new file mode 100755
index 00000000000..24898ead85e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs
@@ -0,0 +1,29 @@
+// WellKnownObjectMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:51 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WellKnownObjectMode {
+
+ /// <summary>
+ /// </summary>
+ Singleton = 1,
+
+ /// <summary>
+ /// </summary>
+ SingleCall = 2,
+ } // WellKnownObjectMode
+
+} // System.Runtime.Remoting
diff --git a/mcs/class/corlib/System.Runtime.Remoting/WellKnownServiceTypeEntry.cs b/mcs/class/corlib/System.Runtime.Remoting/WellKnownServiceTypeEntry.cs
new file mode 100644
index 00000000000..e97b5038ba5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/WellKnownServiceTypeEntry.cs
@@ -0,0 +1,64 @@
+//
+// System.Runtime.Remoting.WellKnownServiceTypeEntry.cs
+//
+// AUthor: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright. Ximian, Inc.
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.Remoting.Contexts;
+
+namespace System.Runtime.Remoting {
+
+ public class WellKnownServiceTypeEntry : TypeEntry
+ {
+ Type obj_type;
+ string obj_uri;
+ WellKnownObjectMode obj_mode;
+
+ public WellKnownServiceTypeEntry (Type type, string objectUri, WellKnownObjectMode mode)
+ {
+ AssemblyName = type.Assembly.FullName;
+ TypeName = type.FullName;
+ obj_type = type;
+ obj_uri = objectUri;
+ obj_mode = mode;
+ }
+
+ public WellKnownServiceTypeEntry (string typeName, string assemblyName,
+ string objectUri, WellKnownObjectMode mode)
+ {
+ AssemblyName = assemblyName;
+ TypeName = typeName;
+ Assembly a = Assembly.Load (assemblyName);
+ obj_type = a.GetType (typeName);
+ obj_uri = objectUri;
+ obj_mode = mode;
+ }
+
+ public IContextAttribute [] ContextAttributes {
+ get { return null; }
+ set { } // This is not implemented in the MS runtime yet.
+ }
+
+ public WellKnownObjectMode Mode {
+ get { return obj_mode; }
+ }
+
+ public Type ObjectType {
+ get { return obj_type; }
+ }
+
+ public string ObjectUri {
+ get { return obj_uri; }
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ return TypeName + AssemblyName + ObjectUri;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
new file mode 100644
index 00000000000..bf4737e7154
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
@@ -0,0 +1,68 @@
+// BinaryCommon.cs
+//
+// Author:
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2003 Lluis Sanchez Gual
+
+using System;
+
+namespace System.Runtime.Serialization.Formatters.Binary
+{
+ internal class BinaryCommon
+ {
+ // Header present in all binary serializations
+ public static byte[] BinaryHeader = new Byte[] {0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0};
+
+ public static bool IsPrimitive (Type type)
+ {
+ return type.IsPrimitive || type == typeof (DateTime) || type == typeof (Decimal);
+ }
+
+ }
+
+ internal enum BinaryElement : byte
+ {
+ RefTypeObject = 1,
+ _Unknown1 = 2,
+ _Unknown2 = 3,
+ RuntimeObject = 4,
+ ExternalObject = 5,
+ String = 6,
+ GenericArray = 7,
+ BoxedPrimitiveTypeValue = 8,
+ ObjectReference = 9,
+ NullValue = 10,
+ End = 11,
+ Assembly = 12,
+ ArrayFiller8b = 13,
+ ArrayFiller32b = 14,
+ ArrayOfPrimitiveType = 15,
+ ArrayOfObject = 16,
+ ArrayOfString = 17,
+ Method = 18,
+ _Unknown4 = 19,
+ _Unknown5 = 20,
+ MethodCall = 21,
+ MethodResponse = 22
+ }
+
+ internal enum TypeTag : byte
+ {
+ PrimitiveType = 0,
+ String = 1,
+ ObjectType = 2,
+ RuntimeType = 3,
+ GenericType = 4,
+ ArrayOfObject = 5,
+ ArrayOfString = 6,
+ ArrayOfPrimitiveType = 7
+ }
+
+ internal enum ArrayStructure : byte
+ {
+ SingleDimensional = 0,
+ Jagged = 1,
+ MultiDimensional = 2
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
new file mode 100755
index 00000000000..e63faf878b6
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
@@ -0,0 +1,153 @@
+// BinaryFormatter.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+
+using System.Runtime.Serialization.Formatters;
+using System.Runtime.Serialization;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Serialization.Formatters.Binary {
+ public sealed class BinaryFormatter : IRemotingFormatter, IFormatter
+ {
+ private FormatterAssemblyStyle assembly_format;
+ private SerializationBinder binder;
+ private StreamingContext context;
+ private ISurrogateSelector surrogate_selector;
+ private FormatterTypeStyle type_format;
+
+ public BinaryFormatter()
+ {
+ surrogate_selector=null;
+ context=new StreamingContext(StreamingContextStates.All);
+ }
+
+ public BinaryFormatter(ISurrogateSelector selector, StreamingContext context)
+ {
+ surrogate_selector=selector;
+ this.context=context;
+ }
+
+ public FormatterAssemblyStyle AssemblyFormat
+ {
+ get {
+ return(assembly_format);
+ }
+ set {
+ assembly_format=value;
+ }
+ }
+
+ public SerializationBinder Binder
+ {
+ get {
+ return(binder);
+ }
+ set {
+ binder=value;
+ }
+ }
+
+ public StreamingContext Context
+ {
+ get {
+ return(context);
+ }
+ set {
+ context=value;
+ }
+ }
+
+ public ISurrogateSelector SurrogateSelector
+ {
+ get {
+ return(surrogate_selector);
+ }
+ set {
+ surrogate_selector=value;
+ }
+ }
+
+ public FormatterTypeStyle TypeFormat
+ {
+ get {
+ return(type_format);
+ }
+ set {
+ type_format=value;
+ }
+ }
+
+ public object Deserialize(Stream serializationStream)
+ {
+ if(serializationStream==null) {
+ throw new ArgumentNullException("serializationStream is null");
+ }
+ if(serializationStream.CanSeek &&
+ serializationStream.Length==0) {
+ throw new SerializationException("serializationStream supports seeking, but its length is 0");
+ }
+
+ ObjectReader serializer = new ObjectReader (surrogate_selector, context);
+ BinaryReader reader = new BinaryReader (serializationStream);
+ return serializer.ReadObjectGraph (reader);
+ }
+
+ [MonoTODO]
+ public object Deserialize(Stream serializationStream, HeaderHandler handler)
+ {
+ if(serializationStream==null) {
+ throw new ArgumentNullException("serializationStream is null");
+ }
+ if(serializationStream.CanSeek &&
+ serializationStream.Length==0) {
+ throw new SerializationException("serializationStream supports seeking, but its length is 0");
+ }
+
+ return(null);
+ }
+
+ [MonoTODO]
+ public object DeserializeMethodResponse(Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallmessage)
+ {
+ if(serializationStream==null) {
+ throw new ArgumentNullException("serializationStream is null");
+ }
+ if(serializationStream.CanSeek &&
+ serializationStream.Length==0) {
+ throw new SerializationException("serializationStream supports seeking, but its length is 0");
+ }
+
+ return(null);
+ }
+
+ public void Serialize(Stream serializationStream, object graph)
+ {
+ if(serializationStream==null) {
+ throw new ArgumentNullException("serializationStream is null");
+ }
+
+ ObjectWriter serializer = new ObjectWriter (surrogate_selector, context);
+ BinaryWriter writer = new BinaryWriter (serializationStream);
+ serializer.WriteObjectGraph (writer, graph);
+ writer.Flush();
+ }
+
+ [MonoTODO]
+ public void Serialize(Stream serializationStream, object graph, Header[] headers)
+ {
+ if(serializationStream==null) {
+ throw new ArgumentNullException("serializationStream is null");
+ }
+
+ // fixme: what about headers?
+ Serialize (serializationStream, graph);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
new file mode 100755
index 00000000000..3370e81ab72
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
@@ -0,0 +1,21 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ObjectWriter.cs: make the exception message more useful.
+
+2003-01-16 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * BinaryFormatter.cs: implemented Serialize and Deserialize methods.
+ * ObjectReader.cs: added.
+ * ObjectWriter.cs: added.
+ * BinaryCommon.cs. added.
+
+2002-08-22 Nick Drochak <ndrochak@gol.com>
+
+ * BinaryArrayTypeEnum.cs: Removed Non-existent enum (must have been
+ from beta days)
+
+2002-08-18 Dick Porter <dick@ximian.com>
+
+ * BinaryFormatter.cs: Stubbed out
+
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
new file mode 100644
index 00000000000..cf3195d56f0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
@@ -0,0 +1,601 @@
+// ObjectReader.cs
+//
+// Author:
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2003 Lluis Sanchez Gual
+
+// FIXME: Implement the missing binary elements
+
+using System;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Runtime.Serialization.Formatters.Binary
+{
+ public class ObjectReader
+ {
+ ISurrogateSelector _surrogateSelector;
+ StreamingContext _context;
+
+ ObjectManager _manager;
+ Hashtable _registeredAssemblies = new Hashtable();
+ Hashtable _typeMetadataCache = new Hashtable();
+
+ static Type[] _typeCodes;
+
+ class TypeMetadata
+ {
+ public Type Type;
+ public Type[] MemberTypes;
+ public string[] MemberNames;
+ public int FieldCount;
+ public bool NeedsSerializationInfo;
+ }
+
+ class ArrayNullFiller
+ {
+ public ArrayNullFiller(int count) { NullCount = count; }
+ public int NullCount;
+ }
+
+ static ObjectReader()
+ {
+ _typeCodes = new Type [30];
+ _typeCodes[(int) TypeCode.Boolean] = typeof (Boolean);
+ _typeCodes[(int)TypeCode.Byte] = typeof (Byte);
+ _typeCodes[(int)TypeCode.Char] = typeof (Char);
+ _typeCodes[(int)TypeCode.DateTime] = typeof (DateTime);
+ _typeCodes[(int)TypeCode.Decimal] = typeof (Decimal);
+ _typeCodes[(int)TypeCode.Double] = typeof (Double);
+ _typeCodes[(int)TypeCode.Int16] = typeof (Int16);
+ _typeCodes[(int)TypeCode.Int32] = typeof (Int32);
+ _typeCodes[(int)TypeCode.Int64] = typeof (Int64);
+ _typeCodes[(int)TypeCode.SByte] = typeof (SByte);
+ _typeCodes[(int)TypeCode.Single] = typeof (Single);
+ _typeCodes[(int)TypeCode.UInt16] = typeof (UInt16);
+ _typeCodes[(int)TypeCode.UInt32] = typeof (UInt32);
+ _typeCodes[(int)TypeCode.UInt64] = typeof (UInt64);
+ }
+
+ public ObjectReader(ISurrogateSelector surrogateSelector, StreamingContext context)
+ {
+ _manager = new ObjectManager (surrogateSelector, context);
+ _surrogateSelector = surrogateSelector;
+ _context = context;
+ }
+
+ public object ReadObjectGraph (BinaryReader reader)
+ {
+ object rootObject = null;
+ object tmpObject;
+ SerializationInfo info;
+ long objectId;
+
+ // Reads the header
+
+ int headerLen = BinaryCommon.BinaryHeader.Length;
+ reader.ReadBytes (headerLen);
+
+ // Reads the objects. The first object in the stream is the
+ // root object.
+
+ BinaryElement element = (BinaryElement)reader.ReadByte ();
+ while (element != BinaryElement.End)
+ {
+ ReadObject (element, reader, out objectId, out tmpObject, out info);
+ if (objectId != 0) RegisterObject (objectId, tmpObject, info, 0, null, null);
+ if (rootObject == null && tmpObject != null) rootObject = tmpObject;
+ element = (BinaryElement)reader.ReadByte ();
+ }
+
+ _manager.DoFixups();
+
+ return rootObject;
+ }
+
+ // Reads an object from the stream. The object is registered in the ObjectManager.
+ // The result can be either the object instance
+ // or the id of the object (when what is found in the stream is an object reference).
+ // If an object instance is read, the objectId is set to 0.
+
+ private void ReadObject (BinaryElement element, BinaryReader reader, out long objectId, out object value, out SerializationInfo info)
+ {
+ switch (element)
+ {
+ case BinaryElement.RefTypeObject:
+ ReadRefTypeObjectInstance (reader, out objectId, out value, out info);
+ break;
+
+ case BinaryElement.RuntimeObject:
+ ReadObjectInstance (reader, true, out objectId, out value, out info);
+ break;
+
+ case BinaryElement.ExternalObject:
+ ReadObjectInstance (reader, false, out objectId, out value, out info);
+ break;
+
+ case BinaryElement.String:
+ info = null;
+ ReadStringIntance (reader, out objectId, out value);
+ break;
+
+ case BinaryElement.GenericArray:
+ info = null;
+ ReadGenericArray (reader, out objectId, out value);
+ break;
+
+ case BinaryElement.BoxedPrimitiveTypeValue:
+ value = ReadBoxedPrimitiveTypeValue (reader);
+ objectId = 0;
+ info = null;
+ break;
+
+ case BinaryElement.NullValue:
+ value = null;
+ objectId = 0;
+ info = null;
+ break;
+
+ case BinaryElement.Assembly:
+ ReadAssembly (reader);
+ ReadObject ((BinaryElement)reader.ReadByte (), reader, out objectId, out value, out info);
+ break;
+
+ case BinaryElement.ArrayFiller8b:
+ value = new ArrayNullFiller(reader.ReadByte());
+ objectId = 0;
+ info = null;
+ break;
+
+ case BinaryElement.ArrayFiller32b:
+ value = new ArrayNullFiller(reader.ReadInt32());
+ objectId = 0;
+ info = null;
+ break;
+
+ case BinaryElement.ArrayOfPrimitiveType:
+ ReadArrayOfPrimitiveType (reader, out objectId, out value);
+ info = null;
+ break;
+
+ case BinaryElement.ArrayOfObject:
+ ReadArrayOfObject (reader, out objectId, out value);
+ info = null;
+ break;
+
+ case BinaryElement.ArrayOfString:
+ ReadArrayOfString (reader, out objectId, out value);
+ info = null;
+ break;
+
+ default:
+ throw new SerializationException ("Unexpected binary element: " + (int)element);
+ }
+ }
+
+ private void ReadAssembly (BinaryReader reader)
+ {
+ long id = (long) reader.ReadUInt32 ();
+ string assemblyName = reader.ReadString ();
+ Assembly assembly = Assembly.Load (assemblyName);
+ _registeredAssemblies [id] = assembly;
+ }
+
+ private void ReadObjectInstance (BinaryReader reader, bool isRuntimeObject, out long objectId, out object value, out SerializationInfo info)
+ {
+ objectId = (long) reader.ReadUInt32 ();
+
+ TypeMetadata metadata = ReadTypeMetadata (reader, isRuntimeObject);
+ ReadObjectContent (reader, metadata, objectId, out value, out info);
+ }
+
+ private void ReadRefTypeObjectInstance (BinaryReader reader, out long objectId, out object value, out SerializationInfo info)
+ {
+ objectId = (long) reader.ReadUInt32 ();
+ long refTypeObjectId = (long) reader.ReadUInt32 ();
+
+ // Gets the type of the referred object and its metadata
+
+ object refObj = _manager.GetObject (refTypeObjectId);
+ if (refObj == null) throw new SerializationException ("Invalid binary format");
+ TypeMetadata metadata = (TypeMetadata)_typeMetadataCache [refObj.GetType()];
+
+ ReadObjectContent (reader, metadata, objectId, out value, out info);
+ }
+
+ private void ReadObjectContent (BinaryReader reader, TypeMetadata metadata, long objectId, out object objectInstance, out SerializationInfo info)
+ {
+ objectInstance = FormatterServices.GetUninitializedObject (metadata.Type);
+ info = metadata.NeedsSerializationInfo ? new SerializationInfo(metadata.Type, new FormatterConverter()) : null;
+
+ for (int n=0; n<metadata.FieldCount; n++)
+ ReadValue (reader, objectInstance, objectId, info, metadata.MemberTypes[n], metadata.MemberNames[n], null);
+ }
+
+ private void RegisterObject (long objectId, object objectInstance, SerializationInfo info, long parentObjectId, MemberInfo parentObjectMemeber, int[] indices)
+ {
+ if (!objectInstance.GetType().IsValueType || parentObjectId == 0)
+ _manager.RegisterObject (objectInstance, objectId, info, 0, null, indices);
+ else
+ _manager.RegisterObject (objectInstance, objectId, info, parentObjectId, parentObjectMemeber, indices);
+ }
+
+ private void ReadStringIntance (BinaryReader reader, out long objectId, out object value)
+ {
+ objectId = (long) reader.ReadUInt32 ();
+ value = reader.ReadString ();
+ }
+
+ private void ReadGenericArray (BinaryReader reader, out long objectId, out object val)
+ {
+ objectId = (long) reader.ReadUInt32 ();
+ ArrayStructure structure = (ArrayStructure) reader.ReadByte();
+
+ int rank = reader.ReadInt32();
+ int[] lengths = new int[rank];
+ for (int n=0; n<rank; n++)
+ lengths[n] = reader.ReadInt32();
+
+ TypeTag code = (TypeTag) reader.ReadByte ();
+ Type elementType = ReadType (reader, code);
+
+ Array array = Array.CreateInstance (elementType, lengths);
+
+ int[] indices = new int[rank];
+
+ // Initialize indexes
+ for (int dim = rank-1; dim >= 0; dim--)
+ indices[dim] = array.GetLowerBound (dim);
+
+ bool end = false;
+ while (!end)
+ {
+ ReadValue (reader, array, objectId, null, elementType, null, indices);
+
+ for (int dim = array.Rank-1; dim >= 0; dim--)
+ {
+ indices[dim]++;
+ if (indices[dim] > array.GetUpperBound (dim))
+ {
+ if (dim > 0)
+ {
+ indices[dim] = array.GetLowerBound (dim);
+ continue; // Increment the next dimension's index
+ }
+ end = true; // That was the last dimension. Finished.
+ }
+ break;
+ }
+ }
+ val = array;
+ }
+
+ private object ReadBoxedPrimitiveTypeValue (BinaryReader reader)
+ {
+ Type type = ReadType (reader, TypeTag.PrimitiveType);
+ return ReadPrimitiveTypeValue (reader, type);
+ }
+
+ private void ReadArrayOfPrimitiveType (BinaryReader reader, out long objectId, out object val)
+ {
+ objectId = (long) reader.ReadUInt32 ();
+ int length = reader.ReadInt32 ();
+ Type elementType = ReadType (reader, TypeTag.PrimitiveType);
+
+ Array array = Array.CreateInstance (elementType, length);
+ for (int n = 0; n < length; n++)
+ array.SetValue (ReadPrimitiveTypeValue (reader, elementType), n);
+
+ val = array;
+ }
+
+ private void ReadArrayOfObject (BinaryReader reader, out long objectId, out object array)
+ {
+ ReadSimpleArray (reader, typeof (object), out objectId, out array);
+ }
+
+ private void ReadArrayOfString (BinaryReader reader, out long objectId, out object array)
+ {
+ ReadSimpleArray (reader, typeof (string), out objectId, out array);
+ }
+
+ private void ReadSimpleArray (BinaryReader reader, Type elementType, out long objectId, out object val)
+ {
+ objectId = (long) reader.ReadUInt32 ();
+ int length = reader.ReadInt32 ();
+ int[] indices = new int[1];
+
+ Array array = Array.CreateInstance (elementType, length);
+ for (int n = 0; n < length; n++)
+ {
+ indices[0] = n;
+ ReadValue (reader, array, objectId, null, elementType, null, indices);
+ n = indices[0];
+ }
+ val = array;
+ }
+
+ private TypeMetadata ReadTypeMetadata (BinaryReader reader, bool isRuntimeObject)
+ {
+ TypeMetadata metadata = new TypeMetadata();
+
+ string className = reader.ReadString ();
+ int fieldCount = reader.ReadInt32 ();
+
+ Type[] types = new Type[fieldCount];
+ string[] names = new string[fieldCount];
+
+ TypeTag[] codes = new TypeTag[fieldCount];
+
+ for (int n=0; n<fieldCount; n++)
+ names [n] = reader.ReadString ();
+
+ for (int n=0; n<fieldCount; n++)
+ codes [n] = (TypeTag) reader.ReadByte ();
+
+ for (int n=0; n<fieldCount; n++)
+ types [n] = ReadType (reader, codes[n]);
+
+ // Gets the type
+
+ if (!isRuntimeObject)
+ {
+ long assemblyId = (long)reader.ReadUInt32();
+ Assembly asm = (Assembly)_registeredAssemblies[assemblyId];
+ metadata.Type = asm.GetType (className, true);
+ }
+ else
+ metadata.Type = Type.GetType (className, true);
+
+ metadata.MemberTypes = types;
+ metadata.MemberNames = names;
+ metadata.FieldCount = names.Length;
+
+ // Now check if this objects needs a SerializationInfo struct for deserialziation.
+ // SerializationInfo is needed if the object has to be deserialized using
+ // a serialization surrogate, or if it implements ISerializable.
+
+ if (_surrogateSelector != null)
+ {
+ // check if the surrogate selector handles objects of the given type.
+ ISurrogateSelector selector;
+ ISerializationSurrogate surrogate = _surrogateSelector.GetSurrogate (metadata.Type, _context, out selector);
+ metadata.NeedsSerializationInfo = (surrogate != null);
+ }
+
+ if (!metadata.NeedsSerializationInfo)
+ {
+ // Check if the object is marked with the Serializable attribute
+
+ if (!metadata.Type.IsSerializable)
+ throw new SerializationException("Serializable objects must be marked with the Serializable attribute");
+
+ metadata.NeedsSerializationInfo = (metadata.Type.GetInterface ("ISerializable") != null);
+ }
+
+ // Registers the type's metadata so it can be reused later if
+ // a RefTypeObject element is found
+
+ if (!_typeMetadataCache.ContainsKey (metadata.Type))
+ _typeMetadataCache [metadata.Type] = metadata;
+
+ return metadata;
+ }
+
+
+ private void ReadValue (BinaryReader reader, object parentObject, long parentObjectId, SerializationInfo info, Type valueType, string fieldName, int[] indices)
+ {
+ // Reads a value from the stream and assigns it to the member of an object
+
+ object val;
+
+ if (BinaryCommon.IsPrimitive (valueType))
+ {
+ val = ReadPrimitiveTypeValue (reader, valueType);
+ SetObjectValue (parentObject, fieldName, info, val, valueType, indices);
+ return;
+ }
+
+ // Gets the object
+
+ BinaryElement element = (BinaryElement)reader.ReadByte ();
+
+ if (element == BinaryElement.ObjectReference)
+ {
+ // Just read the id of the referred object and record a fixup
+ long childObjectId = (long) reader.ReadUInt32();
+ RecordFixup (parentObjectId, childObjectId, parentObject, info, fieldName, indices);
+ return;
+ }
+
+ long objectId;
+ SerializationInfo objectInfo;
+
+ ReadObject (element, reader, out objectId, out val, out objectInfo);
+
+ // There are two cases where the object cannot be assigned to the parent
+ // and a fixup must be used:
+ // 1) When what has been read is not an object, but an id of an object that
+ // has not been read yet (an object reference). This is managed in the
+ // previous block of code.
+ // 2) When the read object is a value type object. Value type fields hold
+ // copies of objects, not references. Thus, if the value object that
+ // has been read has pending fixups, those fixups would be made to the
+ // boxed copy in the ObjectManager, and not in the required object instance
+
+ // First of all register the fixup, and then the object. ObjectManager is more
+ // efficient if done in this order
+
+ bool hasFixup = false;
+ if (objectId != 0)
+ {
+ if (val.GetType().IsValueType)
+ {
+ RecordFixup (parentObjectId, objectId, parentObject, info, fieldName, indices);
+ hasFixup = true;
+ }
+
+ // Register the value
+
+ if (info == null && !parentObject.GetType().IsArray)
+ RegisterObject (objectId, val, objectInfo, parentObjectId, GetObjectMember(parentObject, fieldName), null);
+ else
+ RegisterObject (objectId, val, objectInfo, parentObjectId, null, indices);
+ }
+ // Assign the value to the parent object, unless there is a fixup
+
+ if (!hasFixup)
+ SetObjectValue (parentObject, fieldName, info, val, valueType, indices);
+ }
+
+ private void SetObjectValue (object parentObject, string fieldName, SerializationInfo info, object value, Type valueType, int[] indices)
+ {
+ if (value is IObjectReference)
+ value = ((IObjectReference)value).GetRealObject (_context);
+
+ if (parentObject.GetType().IsArray)
+ {
+ if (value is ArrayNullFiller)
+ {
+ // It must be a single dimension array of objects.
+ // Just increase the index. Elements are null by default.
+ int count = ((ArrayNullFiller)value).NullCount;
+ indices[0] += count - 1;
+ }
+ else
+ ((Array)parentObject).SetValue (value, indices);
+ }
+ else if (info != null) {
+ info.AddValue (fieldName, value, valueType);
+ }
+ else {
+ MemberInfo member = GetObjectMember(parentObject, fieldName);
+ if (member is FieldInfo)
+ ((FieldInfo)member).SetValue (parentObject, value);
+ else
+ ((PropertyInfo)member).SetValue (parentObject, value, null);
+ }
+ }
+
+ private void RecordFixup (long parentObjectId, long childObjectId, object parentObject, SerializationInfo info, string fieldName, int[] indices)
+ {
+ if (info != null) {
+ _manager.RecordDelayedFixup (parentObjectId, fieldName, childObjectId);
+ }
+ else if (parentObject.GetType().IsArray) {
+ if (indices.Length == 1)
+ _manager.RecordArrayElementFixup (parentObjectId, indices[0], childObjectId);
+ else
+ _manager.RecordArrayElementFixup (parentObjectId, (int[])indices.Clone(), childObjectId);
+ }
+ else {
+ _manager.RecordFixup (parentObjectId, GetObjectMember(parentObject, fieldName), childObjectId);
+ }
+ }
+
+ private MemberInfo GetObjectMember (object parentObject, string fieldName)
+ {
+ MemberInfo[] members = parentObject.GetType().GetMember (fieldName, MemberTypes.Field | MemberTypes.Property, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+ if (members.Length > 1) throw new SerializationException ("There are two public members named \"" + fieldName + "\" in the class hirearchy of " + parentObject.GetType().FullName);
+ if (members.Length == 0) throw new SerializationException ("Field \"" + fieldName + "\" not found in class " + parentObject.GetType().FullName);
+ return members[0];
+ }
+
+ private Type ReadType (BinaryReader reader, TypeTag code)
+ {
+ switch (code)
+ {
+ case TypeTag.PrimitiveType:
+ return _typeCodes [reader.ReadByte() + 1];
+
+ case TypeTag.String:
+ return typeof(string);
+
+ case TypeTag.ObjectType:
+ return typeof(object);
+
+ case TypeTag.RuntimeType:
+ {
+ string name = reader.ReadString ();
+ return Type.GetType (name, true);
+ }
+
+ case TypeTag.GenericType:
+ {
+ string name = reader.ReadString ();
+ long asmid = (long) reader.ReadUInt32();
+ Assembly asm = (Assembly)_registeredAssemblies[asmid];
+ return asm.GetType (name, true);
+ }
+
+ case TypeTag.ArrayOfObject:
+ return typeof(object[]);
+
+ case TypeTag.ArrayOfString:
+ return typeof(string[]);
+
+ case TypeTag.ArrayOfPrimitiveType:
+ Type elementType = _typeCodes [reader.ReadByte()+1];
+ return Type.GetType(elementType.FullName + "[]");
+
+ default:
+ throw new NotSupportedException ("Unknow type tag");
+ }
+ }
+
+ private object ReadPrimitiveTypeValue (BinaryReader reader, Type type)
+ {
+ switch (Type.GetTypeCode (type))
+ {
+ case TypeCode.Boolean:
+ return reader.ReadBoolean();
+
+ case TypeCode.Byte:
+ return reader.ReadByte();
+
+ case TypeCode.Char:
+ return reader.ReadChar();
+
+ case TypeCode.DateTime:
+ long ticks = reader.ReadInt64();
+ return new DateTime (ticks);
+
+ case TypeCode.Decimal:
+ return reader.ReadDecimal();
+
+ case TypeCode.Double:
+ return reader.ReadDouble();
+
+ case TypeCode.Int16:
+ return reader.ReadInt16();
+
+ case TypeCode.Int32:
+ return reader.ReadInt32();
+
+ case TypeCode.Int64:
+ return reader.ReadInt64();
+
+ case TypeCode.SByte:
+ return reader.ReadSByte();
+
+ case TypeCode.Single:
+ return reader.ReadSingle();
+
+ case TypeCode.UInt16:
+ return reader.ReadUInt16();
+
+ case TypeCode.UInt32:
+ return reader.ReadUInt32();
+
+ case TypeCode.UInt64:
+ return reader.ReadUInt64();
+
+ default:
+ throw new NotSupportedException ("Unsupported primitive type: " + type.FullName);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
new file mode 100644
index 00000000000..b402e52779d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
@@ -0,0 +1,662 @@
+// ObjectWriter.cs
+//
+// Author:
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2003 Lluis Sanchez Gual
+
+// FIXME: Implement the missing binary elements
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Runtime.Serialization;
+using System.Reflection;
+
+namespace System.Runtime.Serialization.Formatters.Binary
+{
+ internal class ObjectWriter
+ {
+ ObjectIDGenerator _idGenerator = new ObjectIDGenerator();
+ Hashtable _cachedTypes = new Hashtable();
+ Queue _pendingObjects = new Queue();
+ Assembly _corlibAssembly;
+ Hashtable _assemblyCache = new Hashtable();
+
+ ISurrogateSelector _surrogateSelector;
+ StreamingContext _context;
+
+ class TypeMetadata
+ {
+ public Type[] Types;
+ public string[] Names;
+ public Assembly TypeAssembly;
+ public Type InstanceType;
+ public long ObjectID;
+ public bool CustomSerialization;
+
+ public bool Equals (TypeMetadata other)
+ {
+ if (!CustomSerialization) return true;
+
+ TypeMetadata tm = (TypeMetadata)other;
+ if (Types.Length != tm.Types.Length) return false;
+ if (TypeAssembly != other.TypeAssembly) return false;
+ if (InstanceType != other.InstanceType) return false;
+ for (int n=0; n<Types.Length; n++)
+ {
+ if (Types[n] != tm.Types[n]) return false;
+ if (Names[n] != tm.Names[n]) return false;
+ }
+ return true;
+ }
+ }
+
+ public ObjectWriter(ISurrogateSelector surrogateSelector, StreamingContext context)
+ {
+ _surrogateSelector = surrogateSelector;
+ _context = context;
+ _corlibAssembly = GetType().Assembly;
+ }
+
+ public void WriteObjectGraph (BinaryWriter writer, object obj)
+ {
+ writer.Write (BinaryCommon.BinaryHeader);
+
+ _pendingObjects.Clear();
+
+ WriteObjectInstance (writer, obj);
+
+ while (_pendingObjects.Count > 0)
+ WriteObjectInstance (writer, _pendingObjects.Dequeue());
+
+ writer.Write ((byte) BinaryElement.End);
+ }
+
+ public void WriteObjectInstance (BinaryWriter writer, object obj)
+ {
+ bool firstTime;
+ long id = _idGenerator.GetId (obj, out firstTime);
+
+ if (obj.GetType() == typeof(string)) {
+ WriteString (writer, id, (string)obj);
+ }
+ else if (obj.GetType().IsArray) {
+ WriteArray (writer, id, (Array)obj);
+ }
+ else
+ WriteObject (writer, id, obj);
+ }
+
+ private void WriteObject (BinaryWriter writer, long id, object obj)
+ {
+ object[] values;
+ TypeMetadata metadata;
+
+ GetObjectData (obj, out metadata, out values);
+
+ TypeMetadata chachedMetadata = (TypeMetadata)_cachedTypes[metadata.InstanceType];
+
+ if (chachedMetadata != null && metadata.Equals(chachedMetadata))
+ {
+ // An object of the same type has already been serialized
+ // It is not necessary to write again type metadata
+
+ writer.Write ((byte) BinaryElement.RefTypeObject);
+ writer.Write ((int)id);
+
+ // Get the id of the object that has the same type as this
+ long refId = chachedMetadata.ObjectID;
+
+ writer.Write ((int)refId);
+ WriteObjectContent (writer, metadata.Types, values);
+ return;
+ }
+
+ if (chachedMetadata == null)
+ {
+ metadata.ObjectID = id;
+ _cachedTypes [metadata.InstanceType] = metadata;
+ }
+
+ BinaryElement objectTag;
+
+ int assemblyId;
+ if (metadata.TypeAssembly == _corlibAssembly)
+ {
+ // A corlib type
+ objectTag = BinaryElement.RuntimeObject;
+ assemblyId = -1;
+ }
+ else
+ {
+ objectTag = BinaryElement.ExternalObject;
+
+ bool firstTime;
+ assemblyId = RegisterAssembly (metadata.TypeAssembly, out firstTime);
+ if (firstTime) WriteAssembly (writer, assemblyId, metadata.TypeAssembly);
+ }
+
+ // Registers the assemblies needed for each field
+ // If there are assemblies that where not registered before this object,
+ // write them now
+
+ foreach (object value in values)
+ {
+ if (value == null) continue;
+
+ Type memberType = value.GetType();
+ while (memberType.IsArray)
+ memberType = memberType.GetElementType();
+
+ if (memberType.Assembly != _corlibAssembly)
+ {
+ bool firstTime;
+ int aid = RegisterAssembly (memberType.Assembly, out firstTime);
+ if (firstTime) WriteAssembly (writer, aid, memberType.Assembly);
+ }
+ }
+
+ // Writes the object
+
+ writer.Write ((byte) objectTag);
+ writer.Write ((int)id);
+ writer.Write (metadata.InstanceType.FullName);
+ WriteObjectMetadata (writer, metadata, assemblyId);
+ WriteObjectContent (writer, metadata.Types, values);
+ }
+
+ private void WriteObjectMetadata (BinaryWriter writer, TypeMetadata metadata, int assemblyId)
+ {
+ Type[] types = metadata.Types;
+ string[] names = metadata.Names;
+
+ writer.Write (types.Length);
+
+ // Names of fields
+ foreach (string name in names)
+ writer.Write (name);
+
+ // Types of fields
+ foreach (Type type in types)
+ WriteTypeCode (writer, type);
+
+ // Type specs of fields
+ foreach (Type type in types)
+ WriteTypeSpec (writer, type);
+
+ if (assemblyId != -1) writer.Write (assemblyId);
+ }
+
+ private void WriteObjectContent (BinaryWriter writer, Type[] types, object[] values)
+ {
+ for (int n=0; n<values.Length; n++)
+ WriteValue (writer, types[n], values[n]);
+ }
+
+ private void GetObjectData (object obj, out TypeMetadata metadata, out object[] values)
+ {
+ metadata = new TypeMetadata();
+ metadata.InstanceType = obj.GetType();
+ metadata.TypeAssembly = metadata.InstanceType.Assembly;
+
+ // Check if the formatter has a surrogate selector – if it does,
+ // check if the surrogate selector handles objects of the given type.
+
+ if (_surrogateSelector != null)
+ {
+ ISurrogateSelector selector;
+ ISerializationSurrogate surrogate = _surrogateSelector.GetSurrogate (metadata.InstanceType, _context, out selector);
+ if (surrogate != null)
+ {
+ SerializationInfo info = new SerializationInfo (metadata.InstanceType, new FormatterConverter ());
+ surrogate.GetObjectData(obj, info, _context);
+ GetDataFromSerializationInfo (info, ref metadata, out values);
+ return;
+ }
+ }
+
+ // Check if the object is marked with the Serializable attribute
+
+ if (!metadata.InstanceType.IsSerializable)
+ throw new SerializationException ("Type " + metadata.InstanceType +
+ " is not marked as Serializable " +
+ "and does not implement ISerializable.");
+
+ ISerializable ser = obj as ISerializable;
+
+ if (ser != null)
+ {
+ SerializationInfo info = new SerializationInfo (metadata.InstanceType, new FormatterConverter ());
+ ser.GetObjectData (info, _context);
+ GetDataFromSerializationInfo (info, ref metadata, out values);
+ }
+ else
+ GetDataFromObjectFields (obj, ref metadata, out values);
+ }
+
+ private void GetDataFromSerializationInfo (SerializationInfo info, ref TypeMetadata metadata, out object[] values)
+ {
+ Type[] types = types = new Type [info.MemberCount];
+ string[] names = new string [info.MemberCount];
+ values = new object [info.MemberCount];
+
+ SerializationInfoEnumerator e = info.GetEnumerator ();
+
+ int n = 0;
+ while (e.MoveNext ())
+ {
+ values[n] = e.Value;
+ types[n] = e.ObjectType;
+ names[n] = e.Name;
+ n++;
+ }
+
+ if (info.FullTypeName != metadata.InstanceType.FullName || info.AssemblyName != metadata.TypeAssembly.FullName)
+ {
+ metadata.TypeAssembly = Assembly.Load (info.AssemblyName);
+ metadata.InstanceType = metadata.TypeAssembly.GetType (info.FullTypeName);
+ }
+
+ metadata.Types = types;
+ metadata.Names = names;
+ metadata.CustomSerialization = true;
+ }
+
+ private void GetDataFromObjectFields (object obj, ref TypeMetadata metadata, out object[] values)
+ {
+ MemberInfo[] members = FormatterServices.GetSerializableMembers (obj.GetType(), _context);
+ values = FormatterServices.GetObjectData (obj, members);
+
+ Type[] types = new Type [members.Length];
+ string[] names = new string [members.Length];
+
+ for (int n=0; n<members.Length; n++)
+ {
+ MemberInfo member = members[n];
+ names[n] = member.Name;
+ if (member is FieldInfo)
+ types[n] = ((FieldInfo)member).FieldType;
+ else if (member is PropertyInfo)
+ types[n] = ((PropertyInfo)member).PropertyType;
+ }
+
+ metadata.Types = types;
+ metadata.Names = names;
+ metadata.CustomSerialization = false;
+ }
+
+ private void WriteArray (BinaryWriter writer, long id, Array array)
+ {
+ // There are 4 ways of serializing arrays:
+ // The element GenericArray (7) can be used for all arrays.
+ // The element ArrayOfPrimitiveType (15) can be used for single-dimensional
+ // arrays of primitive types
+ // The element ArrayOfObject (16) can be used for single-dimensional Object arrays
+ // The element ArrayOfString (17) can be used for single-dimensional string arrays
+
+ Type elementType = array.GetType().GetElementType();
+
+ if (elementType == typeof (object) && array.Rank == 1) {
+ WriteObjectArray (writer, id, array);
+ }
+ else if (elementType == typeof (string) && array.Rank == 1) {
+ WriteStringArray (writer, id, array);
+ }
+ else if (BinaryCommon.IsPrimitive(elementType) && array.Rank == 1) {
+ WritePrimitiveTypeArray (writer, id, array);
+ }
+ else
+ WriteGenericArray (writer, id, array);
+ }
+
+ private void WriteGenericArray (BinaryWriter writer, long id, Array array)
+ {
+ Type elementType = array.GetType().GetElementType();
+
+ // Registers and writes the assembly of the array element type if needed
+
+ if (!elementType.IsArray && elementType.Assembly != _corlibAssembly)
+ {
+ bool firstTime;
+ int aid = RegisterAssembly (elementType.Assembly, out firstTime);
+ if (firstTime) WriteAssembly (writer, aid, elementType.Assembly);
+ }
+
+ // Writes the array
+
+ writer.Write ((byte) BinaryElement.GenericArray);
+ writer.Write ((int)id);
+
+ // Write the structure of the array
+
+ if (elementType.IsArray)
+ writer.Write ((byte) ArrayStructure.Jagged);
+ else if (array.Rank == 1)
+ writer.Write ((byte) ArrayStructure.SingleDimensional);
+ else
+ writer.Write ((byte) ArrayStructure.MultiDimensional);
+
+ // Write the number of dimensions and the length
+ // of each dimension
+
+ writer.Write (array.Rank);
+ for (int n=0; n<array.Rank; n++)
+ writer.Write (array.GetUpperBound (n) + 1);
+
+ // Writes the type
+ WriteTypeCode (writer, elementType);
+ WriteTypeSpec (writer, elementType);
+
+ // Writes the values. For single-dimension array, a special tag is used
+ // to represent multiple consecutive null values. I don't know why this
+ // optimization is not used for multidimensional arrays.
+
+ if (array.Rank == 1 && !elementType.IsValueType)
+ {
+ WriteSingleDimensionArrayElements (writer, array, elementType);
+ }
+ else
+ {
+ int[] indices = new int[array.Rank];
+
+ // Initialize indexes
+ for (int dim = array.Rank-1; dim >= 0; dim--)
+ indices[dim] = array.GetLowerBound (dim);
+
+ bool end = false;
+ while (!end)
+ {
+ WriteValue (writer, elementType, array.GetValue (indices));
+
+ for (int dim = array.Rank-1; dim >= 0; dim--)
+ {
+ indices[dim]++;
+ if (indices[dim] > array.GetUpperBound (dim))
+ {
+ if (dim > 0) {
+ indices[dim] = array.GetLowerBound (dim);
+ continue; // Increment the next dimension's index
+ }
+ end = true; // That was the last dimension. Finished.
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void WriteObjectArray (BinaryWriter writer, long id, Array array)
+ {
+ writer.Write ((byte) BinaryElement.ArrayOfObject);
+ writer.Write ((int)id);
+ writer.Write (array.Length); // Single dimension. Just write the length
+ WriteSingleDimensionArrayElements (writer, array, typeof (object));
+ }
+
+ private void WriteStringArray (BinaryWriter writer, long id, Array array)
+ {
+ writer.Write ((byte) BinaryElement.ArrayOfString);
+ writer.Write ((int)id);
+ writer.Write (array.Length); // Single dimension. Just write the length
+ WriteSingleDimensionArrayElements (writer, array, typeof (string));
+ }
+
+ private void WritePrimitiveTypeArray (BinaryWriter writer, long id, Array array)
+ {
+ writer.Write ((byte) BinaryElement.ArrayOfPrimitiveType);
+ writer.Write ((int)id);
+ writer.Write (array.Length); // Single dimension. Just write the length
+
+ Type elementType = array.GetType().GetElementType();
+ WriteTypeSpec (writer, elementType);
+
+ for (int n=0; n<array.Length; n++)
+ WritePrimitiveValue (writer, array.GetValue (n));
+ }
+
+ private void WriteSingleDimensionArrayElements (BinaryWriter writer, Array array, Type elementType)
+ {
+ int numNulls = 0;
+ for (int n = array.GetLowerBound (0); n<=array.GetUpperBound(0); n++)
+ {
+ object val = array.GetValue (n);
+ if (val != null && numNulls > 0)
+ {
+ WriteNullFiller (writer, numNulls);
+ WriteValue (writer, elementType, val);
+ numNulls = 0;
+ }
+ else if (val == null)
+ numNulls++;
+ else
+ WriteValue (writer, elementType, val);
+ }
+ if (numNulls > 0)
+ WriteNullFiller (writer, numNulls);
+ }
+
+ private void WriteNullFiller (BinaryWriter writer, int numNulls)
+ {
+ if (numNulls == 1) {
+ writer.Write ((byte) BinaryElement.NullValue);
+ }
+ else if (numNulls == 2) {
+ writer.Write ((byte) BinaryElement.NullValue);
+ writer.Write ((byte) BinaryElement.NullValue);
+ }
+ else if (numNulls <= byte.MaxValue) {
+ writer.Write ((byte) BinaryElement.ArrayFiller8b);
+ writer.Write ((byte) numNulls);
+ }
+ else {
+ writer.Write ((byte) BinaryElement.ArrayFiller32b);
+ writer.Write (numNulls);
+ }
+ }
+
+ private void WriteObjectReference (BinaryWriter writer, long id)
+ {
+ writer.Write ((byte) BinaryElement.ObjectReference);
+ writer.Write ((int)id);
+ }
+
+ private void WriteValue (BinaryWriter writer, Type valueType, object val)
+ {
+ if (val == null)
+ {
+ writer.Write ((byte) BinaryElement.NullValue);
+ }
+ else if (BinaryCommon.IsPrimitive(val.GetType()))
+ {
+ if (!BinaryCommon.IsPrimitive(valueType))
+ {
+ // It is a boxed primitive type value
+ writer.Write ((byte) BinaryElement.BoxedPrimitiveTypeValue);
+ WriteTypeSpec (writer, val.GetType());
+ }
+ WritePrimitiveValue (writer, val);
+ }
+ else if (valueType.IsValueType)
+ {
+ // Value types are written embedded in the containing object
+ WriteObjectInstance (writer, val);
+ }
+ else if (val.GetType() == typeof(string))
+ {
+ // Strings are written embedded, unless already registered
+ bool firstTime;
+ long id = _idGenerator.GetId (val, out firstTime);
+
+ if (firstTime) WriteObjectInstance (writer, val);
+ else WriteObjectReference (writer, id);
+ }
+ else
+ {
+ // It is a reference type. Write a forward reference and queue the
+ // object to the pending object list (unless already written).
+
+ bool firstTime;
+ long id = _idGenerator.GetId (val, out firstTime);
+
+ if (firstTime) _pendingObjects.Enqueue (val);
+ WriteObjectReference (writer, id);
+ }
+ }
+
+ private void WriteString (BinaryWriter writer, long id, string str)
+ {
+ writer.Write ((byte) BinaryElement.String);
+ writer.Write ((int)id);
+ writer.Write (str);
+ }
+
+ private void WriteAssembly (BinaryWriter writer, int id, Assembly assembly)
+ {
+ writer.Write ((byte) BinaryElement.Assembly);
+ writer.Write (id);
+ writer.Write (assembly.GetName ().FullName);
+ }
+
+ private int GetAssemblyId (Assembly assembly)
+ {
+ return (int)_assemblyCache[assembly];
+ }
+
+ private int RegisterAssembly (Assembly assembly, out bool firstTime)
+ {
+ if (_assemblyCache.ContainsKey (assembly))
+ {
+ firstTime = false;
+ return (int)_assemblyCache[assembly];
+ }
+ else
+ {
+ int id = (int)_idGenerator.GetId (0, out firstTime);
+ _assemblyCache.Add (assembly, id);
+ return id;
+ }
+ }
+
+ private void WritePrimitiveValue (BinaryWriter writer, object value)
+ {
+ switch (Type.GetTypeCode (value.GetType()))
+ {
+ case TypeCode.Boolean:
+ writer.Write ((bool)value);
+ break;
+
+ case TypeCode.Byte:
+ writer.Write ((byte) value);
+ break;
+
+ case TypeCode.Char:
+ writer.Write ((char) value);
+ break;
+
+ case TypeCode.DateTime:
+ writer.Write ( ((DateTime)value).Ticks);
+ break;
+
+ case TypeCode.Decimal:
+ writer.Write ((decimal) value);
+ break;
+
+ case TypeCode.Double:
+ writer.Write ((double) value);
+ break;
+
+ case TypeCode.Int16:
+ writer.Write ((short) value);
+ break;
+
+ case TypeCode.Int32:
+ writer.Write ((int) value);
+ break;
+
+ case TypeCode.Int64:
+ writer.Write ((long) value);
+ break;
+
+ case TypeCode.SByte:
+ writer.Write ((sbyte) value);
+ break;
+
+ case TypeCode.Single:
+ writer.Write ((float) value);
+ break;
+
+ case TypeCode.UInt16:
+ writer.Write ((ushort) value);
+ break;
+
+ case TypeCode.UInt32:
+ writer.Write ((uint) value);
+ break;
+
+ case TypeCode.UInt64:
+ writer.Write ((ulong) value);
+ break;
+ }
+ }
+
+ private void WriteTypeCode (BinaryWriter writer, Type type)
+ {
+ writer.Write ((byte) GetTypeTag (type));
+ }
+
+ private TypeTag GetTypeTag (Type type)
+ {
+ if (type == typeof (string)) {
+ return TypeTag.String;
+ }
+ else if (BinaryCommon.IsPrimitive (type)) {
+ return TypeTag.PrimitiveType;
+ }
+ else if (type == typeof (object)) {
+ return TypeTag.ObjectType;
+ }
+ else if (type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof (object)) {
+ return TypeTag.ArrayOfObject;
+ }
+ else if (type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof (string)){
+ return TypeTag.ArrayOfString;
+ }
+ else if (type.IsArray && type.GetArrayRank() == 1 && BinaryCommon.IsPrimitive(type.GetElementType())) {
+ return TypeTag.ArrayOfPrimitiveType;
+ }
+ else if (type.Assembly == _corlibAssembly) {
+ return TypeTag.RuntimeType;
+ }
+ else
+ return TypeTag.GenericType;
+ }
+
+ private void WriteTypeSpec (BinaryWriter writer, Type type)
+ {
+ switch (GetTypeTag (type))
+ {
+ case TypeTag.PrimitiveType:
+ writer.Write ((byte) (Type.GetTypeCode (type) - 1));
+ break;
+
+ case TypeTag.RuntimeType:
+ writer.Write (type.FullName);
+ break;
+
+ case TypeTag.GenericType:
+ writer.Write (type.FullName);
+ writer.Write ((int)GetAssemblyId (type.Assembly));
+ break;
+
+ case TypeTag.ArrayOfPrimitiveType:
+ writer.Write ((byte) (Type.GetTypeCode (type.GetElementType()) - 1));
+ break;
+
+ default:
+ // Type spec not needed
+ break;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
new file mode 100644
index 00000000000..8354cf9555b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
@@ -0,0 +1,20 @@
+2002-08-22 Nick Drochak <ndrochak@gol.com>
+
+ * SoapFault.cs: Serialization ctr should be private
+
+2002-08-14 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * SoapFault.cs: Added the ctr for ISerializable implementation and
+ implemented GetObjectData.
+
+2002-07-30 Duncan Mak <duncan@ximian.com>
+
+ * ServerFault.cs:
+ * SoapFault.cs:
+ * SoapMessage.cs: Added missing classes.
+
+2002-01-21 David Dawkins <david@dawkins.st>
+
+ * IFieldInfo.cs : New file
+ * ISoapMessage.cs : New file
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
new file mode 100755
index 00000000000..944f8a68d2f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
@@ -0,0 +1,29 @@
+// FormatterAssemblyStyle.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:19 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FormatterAssemblyStyle {
+
+ /// <summary>
+ /// </summary>
+ Simple = 0,
+
+ /// <summary>
+ /// </summary>
+ Full = 1,
+ } // FormatterAssemblyStyle
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
new file mode 100755
index 00000000000..2bba90aaafa
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
@@ -0,0 +1,29 @@
+// FormatterTopObjectStyle.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:59 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FormatterTopObjectStyle {
+
+ /// <summary>
+ /// </summary>
+ Object = 0,
+
+ /// <summary>
+ /// </summary>
+ SoapMessage = 1,
+ } // FormatterTopObjectStyle
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
new file mode 100755
index 00000000000..c719b3eea56
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
@@ -0,0 +1,33 @@
+// FormatterTypeStyle.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:09 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FormatterTypeStyle {
+
+ /// <summary>
+ /// </summary>
+ TypesWhenNeeded = 0,
+
+ /// <summary>
+ /// </summary>
+ TypesAlways = 1,
+
+ /// <summary>
+ /// </summary>
+ XsdString = 2,
+ } // FormatterTypeStyle
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
new file mode 100644
index 00000000000..1aba9e2cd14
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
@@ -0,0 +1,30 @@
+//
+// System.Runtime.Serialization.Formatters.IFieldInfo
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+namespace System.Runtime.Serialization.Formatters {
+
+ /// <summary>
+ /// Interface for querying field information on serialized objects.</summary>
+ public interface IFieldInfo {
+
+ /// <summary>
+ /// Get or set the field names for serialized objects.</summary>
+ string[] FieldNames {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the field types for serialized objects.</summary>
+ Type[] FieldTypes {
+ get;
+ set;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
new file mode 100644
index 00000000000..f43d55a6a73
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
@@ -0,0 +1,60 @@
+//
+// System.Runtime.Serialization.Formatters.ISoapMessage
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Serialization.Formatters {
+
+ /// <summary>
+ /// Interface for making SOAP method calls</summary>
+ public interface ISoapMessage {
+
+ /// <summary>
+ /// Get or set the headers ("out-of-band" data) for the method call</summary>
+ Header[] Headers {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method name</summary>
+ string MethodName {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method parameter names</summary
+ string[] ParamNames {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method parameter types</summary
+ Type[] ParamTypes {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method parameter values</summary
+ object[] ParamValues {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the XML namespace for the location of the called object</summary
+ string XmlNameSpace {
+ get;
+ set;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
new file mode 100755
index 00000000000..5c8f704520e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
@@ -0,0 +1,41 @@
+// InternalArrayTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:29 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalArrayTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Single = 1,
+
+ /// <summary>
+ /// </summary>
+ Jagged = 2,
+
+ /// <summary>
+ /// </summary>
+ Rectangular = 3,
+
+ /// <summary>
+ /// </summary>
+ Base64 = 4,
+ } // InternalArrayTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
new file mode 100755
index 00000000000..2112390e67d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
@@ -0,0 +1,33 @@
+// InternalElementTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:49 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalElementTypeE {
+
+ /// <summary>
+ /// </summary>
+ ObjectBegin = 0,
+
+ /// <summary>
+ /// </summary>
+ ObjectEnd = 1,
+
+ /// <summary>
+ /// </summary>
+ Member = 2,
+ } // InternalElementTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
new file mode 100755
index 00000000000..4854703471e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
@@ -0,0 +1,37 @@
+// InternalMemberTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:09 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalMemberTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Header = 1,
+
+ /// <summary>
+ /// </summary>
+ Field = 2,
+
+ /// <summary>
+ /// </summary>
+ Item = 3,
+ } // InternalMemberTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
new file mode 100755
index 00000000000..3459d9e43b5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
@@ -0,0 +1,41 @@
+// InternalMemberValueE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:18 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalMemberValueE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ InlineValue = 1,
+
+ /// <summary>
+ /// </summary>
+ Nested = 2,
+
+ /// <summary>
+ /// </summary>
+ Reference = 3,
+
+ /// <summary>
+ /// </summary>
+ Null = 4,
+ } // InternalMemberValueE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
new file mode 100755
index 00000000000..6074981b751
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
@@ -0,0 +1,61 @@
+// InternalNameSpaceE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:28 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalNameSpaceE {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ Soap = 1,
+
+ /// <summary>
+ /// </summary>
+ XdrPrimitive = 2,
+
+ /// <summary>
+ /// </summary>
+ XdrString = 3,
+
+ /// <summary>
+ /// </summary>
+ UrtSystem = 4,
+
+ /// <summary>
+ /// </summary>
+ UrtUser = 5,
+
+ /// <summary>
+ /// </summary>
+ UserNameSpace = 6,
+
+ /// <summary>
+ /// </summary>
+ MemberName = 7,
+
+ /// <summary>
+ /// </summary>
+ Interop = 8,
+
+ /// <summary>
+ /// </summary>
+ CallElement = 9,
+ } // InternalNameSpaceE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
new file mode 100755
index 00000000000..9229202af82
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
@@ -0,0 +1,37 @@
+// InternalObjectPositionE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:38 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalObjectPositionE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Top = 1,
+
+ /// <summary>
+ /// </summary>
+ Child = 2,
+
+ /// <summary>
+ /// </summary>
+ Headers = 3,
+ } // InternalObjectPositionE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
new file mode 100755
index 00000000000..986b6bd4bc1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
@@ -0,0 +1,33 @@
+// InternalObjectTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:48 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalObjectTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Object = 1,
+
+ /// <summary>
+ /// </summary>
+ Array = 2,
+ } // InternalObjectTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
new file mode 100755
index 00000000000..87627fcc2bb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
@@ -0,0 +1,37 @@
+// InternalParseStateE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:58 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalParseStateE {
+
+ /// <summary>
+ /// </summary>
+ Initial = 0,
+
+ /// <summary>
+ /// </summary>
+ Object = 1,
+
+ /// <summary>
+ /// </summary>
+ Member = 2,
+
+ /// <summary>
+ /// </summary>
+ MemberChild = 3,
+ } // InternalParseStateE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
new file mode 100755
index 00000000000..9747bffcbe8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
@@ -0,0 +1,73 @@
+// InternalParseTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:45:08 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalParseTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ SerializedStreamHeader = 1,
+
+ /// <summary>
+ /// </summary>
+ Object = 2,
+
+ /// <summary>
+ /// </summary>
+ Member = 3,
+
+ /// <summary>
+ /// </summary>
+ ObjectEnd = 4,
+
+ /// <summary>
+ /// </summary>
+ MemberEnd = 5,
+
+ /// <summary>
+ /// </summary>
+ Headers = 6,
+
+ /// <summary>
+ /// </summary>
+ HeadersEnd = 7,
+
+ /// <summary>
+ /// </summary>
+ SerializedStreamHeaderEnd = 8,
+
+ /// <summary>
+ /// </summary>
+ Envelope = 9,
+
+ /// <summary>
+ /// </summary>
+ EnvelopeEnd = 10,
+
+ /// <summary>
+ /// </summary>
+ Body = 11,
+
+ /// <summary>
+ /// </summary>
+ BodyEnd = 12,
+ } // InternalParseTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
new file mode 100755
index 00000000000..09adef22214
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
@@ -0,0 +1,89 @@
+// InternalPrimitiveTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:39 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalPrimitiveTypeE {
+
+ /// <summary>
+ /// </summary>
+ Invalid = 0,
+
+ /// <summary>
+ /// </summary>
+ Boolean = 1,
+
+ /// <summary>
+ /// </summary>
+ Byte = 2,
+
+ /// <summary>
+ /// </summary>
+ Char = 3,
+
+ /// <summary>
+ /// </summary>
+ Currency = 4,
+
+ /// <summary>
+ /// </summary>
+ Decimal = 5,
+
+ /// <summary>
+ /// </summary>
+ Double = 6,
+
+ /// <summary>
+ /// </summary>
+ Int16 = 7,
+
+ /// <summary>
+ /// </summary>
+ Int32 = 8,
+
+ /// <summary>
+ /// </summary>
+ Int64 = 9,
+
+ /// <summary>
+ /// </summary>
+ SByte = 10,
+
+ /// <summary>
+ /// </summary>
+ Single = 11,
+
+ /// <summary>
+ /// </summary>
+ TimeSpan = 12,
+
+ /// <summary>
+ /// </summary>
+ DateTime = 13,
+
+ /// <summary>
+ /// </summary>
+ UInt16 = 14,
+
+ /// <summary>
+ /// </summary>
+ UInt32 = 15,
+
+ /// <summary>
+ /// </summary>
+ UInt64 = 16,
+ } // InternalPrimitiveTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
new file mode 100755
index 00000000000..51f70341f93
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
@@ -0,0 +1,29 @@
+// InternalSerializerTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:59 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalSerializerTypeE {
+
+ /// <summary>
+ /// </summary>
+ Soap = 1,
+
+ /// <summary>
+ /// </summary>
+ Binary = 2,
+ } // InternalSerializerTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs
new file mode 100644
index 00000000000..3da1932cd78
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs
@@ -0,0 +1,45 @@
+//
+// System.Runtime.Serialization.Formatters.ServerFault.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization.Formatters {
+
+ [Serializable]
+ public sealed class ServerFault
+ {
+ string ex_type;
+ string ex_message;
+ string stacktrace;
+ ServerFault serverFault;
+
+ public ServerFault (string exceptionType, string message,
+ string stackTrace)
+ {
+ ex_type = exceptionType;
+ ex_message = message;
+ stacktrace = stackTrace;
+ }
+
+ public string ExceptionType {
+ get { return ex_type; }
+ set { ex_type = value; }
+ }
+
+ public string ExceptionMessage {
+ get { return ex_message; }
+ set { ex_message = value; }
+ }
+
+ public string StackTrace {
+ get { return stacktrace; }
+ set { stacktrace = value; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs
new file mode 100644
index 00000000000..709d5e99efa
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs
@@ -0,0 +1,73 @@
+//
+// System.Runtime.Serialization.Formatters.SoapFault.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization.Formatters {
+
+ [Serializable]
+ public sealed class SoapFault : ISerializable
+ {
+ string code;
+ string actor;
+ string faultString;
+ ServerFault serverFault;
+
+ [MonoTODO]
+ public SoapFault ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ private SoapFault (SerializationInfo info, StreamingContext context)
+ {
+ FaultCode = info.GetString ("faultcode");
+ FaultString = info.GetString ("faultstring");
+ Detail = info.GetValue ("detail", typeof (object));
+ }
+
+ public SoapFault (string faultCode, string faultString,
+ string faultActor, ServerFault serverFault)
+ {
+ this.code = faultCode;
+ this.actor = faultActor;
+ this.faultString = faultString;
+ this.serverFault = serverFault;
+ }
+
+ [MonoTODO]
+ public object Detail {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public string FaultActor {
+ get { return actor; }
+ set { actor = value; }
+ }
+
+ public string FaultCode {
+ get { return code; }
+ set { code = value; }
+ }
+
+ public string FaultString {
+ get { return faultString; }
+ set { faultString = value; }
+ }
+
+ public void GetObjectData (SerializationInfo info,
+ StreamingContext context)
+ {
+ info.AddValue ("faultcode", FaultCode, typeof (string));
+ info.AddValue ("faultstring", FaultString, typeof (string));
+ info.AddValue ("detail", Detail, typeof (object));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs
new file mode 100644
index 00000000000..286b0644eef
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs
@@ -0,0 +1,59 @@
+//
+// System.Runtime.Serialization.Formatters.SoapMessage.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Serialization.Formatters;
+
+namespace System.Runtime.Serialization.Formatters {
+
+ [Serializable]
+ public class SoapMessage : ISoapMessage
+ {
+ [MonoTODO]
+ public SoapMessage ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Header[] Headers {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string MethodName {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string [] ParamNames {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Type [] ParamTypes {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object [] ParamValues {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string XmlNameSpace {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization/ChangeLog
new file mode 100644
index 00000000000..019307650ff
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ChangeLog
@@ -0,0 +1,137 @@
+2003-01-16 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * ObjectManager.cs: Implemented and added file
+ * SurrogateSelector.cs: completed implementation.
+ * SerializationInfo.cs: corrected a bug in GetValue method.
+ * ObjectIDGenerator.cs: corrected a bug. Now it does not give the same
+ id for two different instances that return true when calling Equal.
+
+2002-12-06 Duncan Mak <duncan@ximian.com>
+
+ * Formatter.cs (WriteValueType): Remove the erroneous CLSCompliant attribute.
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormatterServices.cs: implemented GetUninitializedObject.
+ PopulateObjectMembers needs a working FieldInfo.SetValue (it's
+ not implemented right now).
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormatterServices.cs:a implemented GetSerializableMembers ().
+
+2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormatterServices.cs: New file with some implementation.
+
+2002-08-16 Dietmar Maurer <dietmar@ximian.com>
+
+ * SerializationInfo.cs: special case for null values.
+ use the converter everywhere.
+
+2002-08-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * SerializationInfo.cs: added new function to support the runtime
+
+2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Formatter.cs: added namespace.
+
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * Formatter.cs: Addd to CVS.
+
+ * FormatterConverter.cs: Added to CVS.
+
+ * SerializationInfo.cs (AddValue): Removed extra CLSCompliant attribute.
+
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * SerializationException.cs: Added missing constructor for serialization.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * IFormatter.cs: Fix the return type of the Serialize method.
+
+2002/03/07 Nick Drochak <ndrochak@gol.com>
+
+ * StreamingContextStates.cs: Add missing value (CrossAppDomain) and
+ adjust All value accordingly.
+
+2002-03-01 Duncan Mak <duncan@ximian.com>
+
+ * ObjectIDGenerator.cs: Implemented.
+
+2002-02-19 Duncan Mak <duncan@ximian.com>
+
+ * SurrogateSelector.cs: Implemented.
+
+ * SerializationInfoEnumerator.cs: oh, and simplified the Current
+ property too.
+
+ * SerializationInfo.cs: Forgot to finish up GetEnumerator ().
+
+2002-02-18 Duncan Mak <duncan@ximian.com>
+
+ * SerializationInfo.cs: Converted Type.GetType calls to the faster
+ typeof operator.
+
+2002-02-16 Duncan Mak <duncan@ximian.com>
+
+ * SurrogateSelector.cs: Stubbed out. Gonna be working on this
+ tomorrow.
+
+2002-02-15 Duncan Mak <duncan@ximian.com>
+
+ * SerializationEntry.cs: Added internal constructor for writing
+ bits in SerializationInfoEnumerator.
+ * SerializationInfo.cs: Completed.
+ * SerializationInfoEnumerator.cs: Implemented. Piggybacking on
+ Hashtable's GetEnumerator method.
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SerializationInfoEnumerator.cs: New file (stub)
+
+2002-02-12 Duncan Mak <duncan@ximian.com>
+
+ * SerializationBinder.cs: Implemented.
+ * SerializationEntry.cs: Implemented.
+ * SerializationInfo.cs: Fixed the get portion of the AssemblyName
+ property. Implemented the FullTypename property.
+
+2002-01-06 David Dawkins <david@dawkins.st>
+
+ * IFormatter.cs : New file
+ * ISerializationSurrogate.cs : New file
+ * ISurrogateSelector.cs : New file
+
+2002-05-01 Ravi Pratap <ravi@ximian.com>
+
+ * SerializationInfo.cs : Insert MonoTODO attribute.
+
+2001-08-24 Nick Drochak <ndrochak@gol.com>
+
+ * IDeserializationCallback.cs: New File
+
+Wed Nov 14 17:03:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * IFormatterConverter.cs, SerializationInfo.cs: CLSCompliant updates.
+
+Fri Nov 2 18:40:12 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * SerializationException.cs: implemented.
+
+2001-08-24 Nick Drochak <ndrochak@gol.com>
+
+ * SerializationInfo.cs: Added all the public methods so that the compile would not break
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * SerializationInfo.cs: New file.
+
+ * IFormatterConverter.cs: New file.
+
+ * ISerializable.cs: New file.
+
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization/Formatter.cs b/mcs/class/corlib/System.Runtime.Serialization/Formatter.cs
new file mode 100755
index 00000000000..4164d5ed3b4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/Formatter.cs
@@ -0,0 +1,104 @@
+//
+// System.Runtime.Serialization.Formatter.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+
+namespace System.Runtime.Serialization
+{
+[CLSCompliant (false)]
+[Serializable]
+public abstract class Formatter : IFormatter
+{
+ protected Formatter ()
+ {
+ }
+
+ protected ObjectIDGenerator m_idGenerator;
+ protected Queue m_objectQueue;
+
+ public abstract SerializationBinder Binder {
+ get;
+ set;
+ }
+
+ public abstract StreamingContext Context {
+ get;
+ set;
+ }
+
+ public abstract ISurrogateSelector SurrogateSelector {
+ get;
+ set;
+ }
+
+ public abstract object Deserialize (Stream serializationStream);
+
+ [MonoTODO]
+ protected virtual object GetNext (out long objID)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual long Schedule (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void Serialize (Stream serializationStream, object graph);
+
+ protected abstract void WriteArray (object obj, string name, Type memberType);
+
+ protected abstract void WriteBoolean (bool val, string name);
+
+ protected abstract void WriteByte (byte val, string name);
+
+ protected abstract void WriteChar (char val, string name);
+
+ protected abstract void WriteDateTime (DateTime val, string name);
+
+ protected abstract void WriteDecimal (Decimal val, string name);
+
+ protected abstract void WriteDouble (double val, string name);
+
+ protected abstract void WriteInt16 (short val, string name);
+
+ protected abstract void WriteInt32 (int val, string name);
+
+ protected abstract void WriteInt64 (long val, string name);
+
+ [MonoTODO]
+ protected virtual void WriteMember (string memberName, object data)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract void WriteObjectRef (object obj, string name, Type memberType);
+
+
+ protected abstract void WriteSByte (sbyte val, string name);
+
+
+ protected abstract void WriteSingle (float val, string name);
+
+ protected abstract void WriteTimeSpan (TimeSpan val, string name);
+
+ [CLSCompliant (false)]
+ protected abstract void WriteUInt16 (ushort val, string name);
+
+ [CLSCompliant (false)]
+ protected abstract void WriteUInt32 (uint val, string name);
+
+ [CLSCompliant (false)]
+ protected abstract void WriteUInt64 (ulong val, string name);
+
+ protected abstract void WriteValueType (object obj, string name, Type memberType);
+}
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs b/mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs
new file mode 100755
index 00000000000..d478ac77d15
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs
@@ -0,0 +1,153 @@
+//
+// System.Runtime.Serialization.Formatter.cs
+//
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization {
+ public class FormatterConverter : IFormatterConverter {
+
+ public FormatterConverter ()
+ {
+ }
+
+ public object Convert (object value, Type type)
+ {
+ return System.Convert.ChangeType (value, type);
+ }
+
+ public object Convert (object value, TypeCode typeCode)
+ {
+ return System.Convert.ChangeType (value, typeCode);
+ }
+
+ public bool ToBoolean (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToBoolean (value);
+ }
+
+ public byte ToByte (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToByte (value);
+ }
+
+ public char ToChar (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToChar (value);
+ }
+
+ public DateTime ToDateTime (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToDateTime (value);
+ }
+
+ public decimal ToDecimal (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToDecimal (value);
+ }
+
+ public double ToDouble (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToDouble (value);
+ }
+
+ public short ToInt16 (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToInt16 (value);
+ }
+
+ public int ToInt32 (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToInt32 (value);
+ }
+
+ public long ToInt64 (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToInt64 (value);
+ }
+
+ public float ToSingle (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToSingle (value);
+ }
+
+ public string ToString (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToString (value);
+ }
+
+ [CLSCompliant (false)]
+ public sbyte ToSByte (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToSByte (value);
+ }
+
+ [CLSCompliant (false)]
+ public ushort ToUInt16 (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ public uint ToUInt32 (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ public ulong ToUInt64 (object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException ("value is null.");
+
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs b/mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
new file mode 100644
index 00000000000..6243e88d59b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
@@ -0,0 +1,142 @@
+//
+// System.Runtime.Serialization.FormatterServices
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.Serialization
+{
+ public sealed class FormatterServices
+ {
+ private const BindingFlags fieldFlags = BindingFlags.Public |
+ BindingFlags.Instance |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly;
+
+ private FormatterServices ()
+ {
+ }
+
+ public static object [] GetObjectData (object obj, MemberInfo [] members)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ("obj");
+
+ if (members == null)
+ throw new ArgumentNullException ("members");
+
+ int n = members.Length;
+ object [] result = new object [n];
+ for (int i = 0; i < n; i++) {
+ MemberInfo member = members [i];
+ if (member == null)
+ throw new ArgumentNullException (String.Format ("members[{0}]", i));
+
+ if (member.MemberType != MemberTypes.Field)
+ throw new SerializationException (
+ String.Format ("members [{0}] is not a field.", i));
+
+ FieldInfo fi = member as FieldInfo; //FIXME: Can fi be null?
+ result [i] = fi.GetValue (obj);
+ }
+
+ return result;
+ }
+
+ public static MemberInfo [] GetSerializableMembers (Type type)
+ {
+ StreamingContext st = new StreamingContext (StreamingContextStates.All);
+ return GetSerializableMembers (type, st);
+ }
+
+ public static MemberInfo [] GetSerializableMembers (Type type, StreamingContext context)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ //FIXME: context?
+ ArrayList fields = new ArrayList ();
+ Type t = type;
+ while (t != null) {
+ GetFields (t, fields);
+ t = t.BaseType;
+ }
+
+ MemberInfo [] result = new MemberInfo [fields.Count];
+ fields.CopyTo (result);
+ return result;
+ }
+
+ private static void GetFields (Type type, ArrayList fields)
+ {
+ FieldInfo [] fs = type.GetFields (fieldFlags);
+ foreach (FieldInfo field in fs)
+ if (!(field.IsNotSerialized))
+ fields.Add (field);
+ }
+
+ public static Type GetTypeFromAssembly (Assembly assem, string name)
+ {
+ if (assem == null)
+ throw new ArgumentNullException ("assem");
+
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ return assem.GetType (name);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern object GetUninitializedObjectInternal (Type type);
+
+ public static object GetUninitializedObject (Type type)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ if (type == typeof (string))
+ throw new ArgumentException ("Uninitialized Strings cannot be created.");
+
+ return GetUninitializedObjectInternal (type);
+ }
+
+ public static object PopulateObjectMembers (object obj, MemberInfo [] members, object [] data)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ("obj");
+
+ if (members == null)
+ throw new ArgumentNullException ("members");
+
+ if (data == null)
+ throw new ArgumentNullException ("data");
+
+ int length = members.Length;
+ if (length != data.Length)
+ throw new ArgumentException ("different length in members and data");
+
+ for (int i = 0; i < length; i++) {
+ MemberInfo member = members [i];
+ if (member == null)
+ throw new ArgumentNullException (String.Format ("members[{0}]", i));
+
+ if (member.MemberType != MemberTypes.Field)
+ throw new SerializationException (
+ String.Format ("members [{0}] is not a field.", i));
+
+ FieldInfo fi = member as FieldInfo; //FIXME: can fi be null?
+ fi.SetValue (obj, data [i]);
+ }
+
+ return obj;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs b/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
new file mode 100644
index 00000000000..a889303f51b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Runtime.Serialization.IDeserializationCallback.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Runtime.Serialization {
+ public interface IDeserializationCallback {
+ void OnDeserialization(object sender);
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
new file mode 100644
index 00000000000..214f720093e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
@@ -0,0 +1,66 @@
+//
+// System.Runtime.Serialization.IFormatter
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+using System.IO;
+
+namespace System.Runtime.Serialization {
+
+ /// <summary>
+ /// Formatting for serialized objects</summary>
+ public interface IFormatter {
+
+ //
+ // Properties
+ //
+
+ /// <summary>
+ /// Get or set the SerializationBinder used
+ /// for looking up types during deserialization</summary>
+ SerializationBinder Binder
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the StreamingContext used for serialization
+ /// and deserialization</summary>
+ StreamingContext Context
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the SurrogateSelector used by the current
+ /// formatter</summary>
+ ISurrogateSelector SurrogateSelector
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Deserialize data from the specified stream, rebuilding
+ /// the object hierarchy</summary>
+ object Deserialize(
+ Stream serializationStream
+ );
+
+ /// <summary>
+ /// Serialize the specified object to the specified stream.
+ /// Object may be the root of a graph of objects to be
+ /// serialized</summary>
+ void Serialize(
+ Stream serializationStream,
+ object graph
+ );
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs b/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
new file mode 100644
index 00000000000..b902ec339a5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
@@ -0,0 +1,33 @@
+//
+// System.Runtime.Serialization.IFormatterConverter.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.Runtime.Serialization {
+ [CLSCompliant(false)]
+ public interface IFormatterConverter {
+ object Convert (object o, Type t);
+ object Convert (object o, TypeCode tc);
+
+ bool ToBoolean (object o);
+ byte ToByte (object o);
+ char ToChar (object o);
+ DateTime ToDateTime (object o);
+ Decimal ToDecimal (object o);
+ double ToDouble (object o);
+ Int16 ToInt16 (object o);
+ Int32 ToInt32 (object o);
+ Int64 ToInt64 (object o);
+ sbyte ToSByte (object o);
+ float ToSingle (object o);
+ string ToString (object o);
+ UInt16 ToUInt16 (object o);
+ UInt32 ToUInt32 (object o);
+ UInt64 ToUInt64 (object o);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs b/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
new file mode 100644
index 00000000000..59f5a0200b4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
@@ -0,0 +1,16 @@
+//
+// System.Runtime.Serialization.IObjectReference.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+ public interface IObjectReference {
+ object GetRealObject (StreamingContext context);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs b/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
new file mode 100644
index 00000000000..64773514eba
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.Serialization.ISerializable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.Runtime.Serialization {
+ public interface ISerializable {
+ void GetObjectData (SerializationInfo info, StreamingContext context);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs b/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
new file mode 100644
index 00000000000..21b4ecbb7dd
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
@@ -0,0 +1,43 @@
+//
+// System.Runtime.Serialization.ISerializationSurrogate
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+namespace System.Runtime.Serialization {
+
+ /// <summary>
+ /// Interface for serialization surrogates</summary>
+ public interface ISerializationSurrogate {
+
+ /// <summary>
+ /// Get the SerializationInfo necessary to serialize
+ /// the specified object </summary>
+ /// <param name="obj">Object to be serialized</param>
+ /// <param name="info">SerializationInfo to be populated</param>
+ /// <param name="context">Destination for serialization</param>
+ void GetObjectData(
+ object obj,
+ SerializationInfo info,
+ StreamingContext context
+ );
+
+ /// <summary>
+ /// Populate an object using the specified SerializationInfo </summary>
+ /// <param name="obj">Object to be populated</param>
+ /// <param name="info">Data used for populating object</param>
+ /// <param name="context">Source for deserialization of object</param>
+ /// <param name="selector>Starting point for searching for compatible surrogates</param>
+ /// <returns>The deserialized object</returns>
+ object SetObjectData(
+ object obj,
+ SerializationInfo info,
+ StreamingContext context,
+ ISurrogateSelector selector
+ );
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs b/mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs
new file mode 100644
index 00000000000..442b01789ed
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs
@@ -0,0 +1,40 @@
+//
+// System.Runtime.Serialization.ISurrogateSelector
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+namespace System.Runtime.Serialization {
+
+ /// <summary>
+ /// Creation of serialization surrogate selectors</summary>
+ public interface ISurrogateSelector {
+
+ /// <summary>
+ /// Insert specified selector into available surrogates</summary>
+ void ChainSelector( ISurrogateSelector selector );
+
+ /// <summary>
+ /// Return next surrogate in the surrogate chain</summary>
+ ISurrogateSelector GetNextSelector();
+
+ /// <summary>
+ /// Fetch the surrogate according the specified type, starting
+ /// the search from the surrogate selector for the specified
+ /// StreamingContext</summary>
+ /// <param name="type">Type of the object to be serialized</param>
+ /// <param name="context">Context for the serialization/deserialization</para,>
+ /// <param name="selector">Upon return, contains a reference to the selector where the returned surrogate was found</param>
+ /// <returns>The surrogate for the specified type and context</returns>
+ ISerializationSurrogate GetSurrogate(
+ Type type,
+ StreamingContext context,
+ out ISurrogateSelector selector
+ );
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
new file mode 100755
index 00000000000..fa26c380aef
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
@@ -0,0 +1,100 @@
+//
+// System.Runtime.Serialization.ObjectIDGenerator.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization
+{
+ [Serializable]
+ public class ObjectIDGenerator
+ {
+ // Private field
+ Hashtable table;
+ long current; // this is the current ID, starts at 1
+
+
+ // ObjectIDGenerator must generate a new id for each object instance.
+ // If two objects have the same state (i.e. the method Equals() returns true),
+ // each one should have a different id.
+ // Thus, the object instance cannot be directly used as key of the hashtable.
+ // The key is then a wrapper of the object that compares object references
+ // instead of object content (unless the object is inmutable, like strings).
+
+ struct InstanceWrapper
+ {
+ object _instance;
+
+ public InstanceWrapper (object instance)
+ {
+ _instance = instance;
+ }
+
+ public override bool Equals (object other)
+ {
+ InstanceWrapper ow = (InstanceWrapper)other;
+ if (_instance.GetType() == typeof(string))
+ return _instance.Equals(ow._instance);
+ else
+ return (_instance == ow._instance);
+ }
+
+ public override int GetHashCode ()
+ {
+ return _instance.GetHashCode();
+ }
+ }
+
+ // constructor
+ public ObjectIDGenerator ()
+ : base ()
+ {
+ table = new Hashtable ();
+ current = 1;
+ }
+
+ // Methods
+ public virtual long GetId (object obj, out bool firstTime)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ("The obj parameter is null.");
+
+ InstanceWrapper iw = new InstanceWrapper(obj);
+
+ if (table.ContainsKey (iw)) {
+ firstTime = false;
+ return (long) table [iw];
+
+ } else {
+ firstTime = true;
+ table.Add (iw, current);
+ return current ++;
+ }
+ }
+
+ public virtual long HasId (object obj, out bool firstTime)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ("The obj parameter is null.");
+
+ InstanceWrapper iw = new InstanceWrapper(obj);
+
+ if (table.ContainsKey (iw))
+ {
+ firstTime = false;
+ return (long) table [iw];
+
+ } else {
+ firstTime = true;
+ return 0L; // 0 is the null ID
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs b/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs
new file mode 100644
index 00000000000..e8f42855cab
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs
@@ -0,0 +1,515 @@
+//
+// System.Runtime.Serialization.ObjectIDGenerator.cs
+//
+// Author: Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2003 Lluis Sanchez Gual
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Runtime.Serialization
+{
+ public class ObjectManager
+ {
+ // All objects are chained in the same order as they have been registered
+ ObjectRecord _objectRecordChain = null;
+ ObjectRecord _lastObjectRecord = null;
+
+ Hashtable _objectRecords = new Hashtable();
+ bool _finalFixup = false;
+
+ ISurrogateSelector _selector;
+ StreamingContext _context;
+ int _registeredObjectsCount = 0;
+
+ public ObjectManager(ISurrogateSelector selector, StreamingContext context)
+ {
+ _selector = selector;
+ _context = context;
+ }
+
+ public virtual void DoFixups()
+ {
+ _finalFixup = true;
+
+ try
+ {
+ if (_registeredObjectsCount < _objectRecords.Count)
+ throw new SerializationException ("There are some fixups that refer to objects that have not been registered");
+
+ // Solve al pending fixups of all objects
+
+ ObjectRecord record = _objectRecordChain;
+ while (record != null)
+ {
+ if ( record.DoFixups (true, this, true) &&
+ record.LoadData(this, _selector, _context))
+ {
+ record = record.Next;
+ }
+ else
+ {
+ // There must be an unresolved IObjectReference instance.
+ // Chain the record at the end so it is solved later
+
+ if (record.ObjectInstance is IObjectReference)
+ {
+ if (record.Status == ObjectRecordStatus.ReferenceSolvingDelayed)
+ throw new SerializationException ("The object with ID " + record.ObjectID + " could not be resolved");
+ else
+ record.Status = ObjectRecordStatus.ReferenceSolvingDelayed;
+ }
+
+ ObjectRecord next = record.Next;
+ record.Next = null;
+ _lastObjectRecord.Next = record;
+ _lastObjectRecord = record;
+ record = next;
+ }
+ }
+ }
+ finally
+ {
+ _finalFixup = false;
+ }
+ }
+
+ internal ObjectRecord GetObjectRecord (long objectID)
+ {
+ ObjectRecord rec = (ObjectRecord)_objectRecords[objectID];
+ if (rec == null)
+ {
+ if (_finalFixup) throw new SerializationException ("The object with Id " + objectID + " has not been registered");
+ rec = new ObjectRecord();
+ rec.ObjectID = objectID;
+ _objectRecords[objectID] = rec;
+ }
+ if (!rec.IsRegistered && _finalFixup) throw new SerializationException ("The object with Id " + objectID + " has not been registered");
+ return rec;
+ }
+
+ public virtual object GetObject (long objectID)
+ {
+ if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
+ ObjectRecord rec = (ObjectRecord)_objectRecords[objectID];
+ if (rec == null || !rec.IsRegistered) return null;
+ else return rec.ObjectInstance;
+ }
+
+ public virtual void RaiseDeserializationEvent ()
+ {
+ ICollection values = _objectRecords.Values;
+ foreach (ObjectRecord record in values)
+ {
+ IDeserializationCallback obj = record.OriginalObject as IDeserializationCallback;
+ if (obj != null) obj.OnDeserialization (this);
+ }
+ }
+
+ private void AddFixup (BaseFixupRecord record)
+ {
+ record.ObjectToBeFixed.ChainFixup (record, true);
+ record.ObjectRequired.ChainFixup (record, false);
+ }
+
+ public virtual void RecordArrayElementFixup (long arrayToBeFixed, int index, long objectRequired)
+ {
+ if (arrayToBeFixed <= 0) throw new ArgumentOutOfRangeException("arrayToBeFixed","The arrayToBeFixed parameter is less than or equal to zero");
+ if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
+ ArrayFixupRecord record = new ArrayFixupRecord(GetObjectRecord(arrayToBeFixed), index, GetObjectRecord(objectRequired));
+ AddFixup (record);
+ }
+
+ public virtual void RecordArrayElementFixup (long arrayToBeFixed, int[] indices, long objectRequired)
+ {
+ if (arrayToBeFixed <= 0) throw new ArgumentOutOfRangeException("arrayToBeFixed","The arrayToBeFixed parameter is less than or equal to zero");
+ if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
+ if (indices == null) throw new ArgumentNullException("indices");
+ MultiArrayFixupRecord record = new MultiArrayFixupRecord (GetObjectRecord(arrayToBeFixed), indices, GetObjectRecord(objectRequired));
+ AddFixup (record);
+ }
+
+ public virtual void RecordDelayedFixup (long objectToBeFixed, string memberName, long objectRequired)
+ {
+ if (objectToBeFixed <= 0) throw new ArgumentOutOfRangeException("objectToBeFixed","The objectToBeFixed parameter is less than or equal to zero");
+ if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
+ if (memberName == null) throw new ArgumentNullException("memberName");
+ DelayedFixupRecord record = new DelayedFixupRecord (GetObjectRecord(objectToBeFixed), memberName, GetObjectRecord(objectRequired));
+ AddFixup (record);
+ }
+
+ public virtual void RecordFixup (long objectToBeFixed, MemberInfo member, long objectRequired)
+ {
+ if (objectToBeFixed <= 0) throw new ArgumentOutOfRangeException("objectToBeFixed","The objectToBeFixed parameter is less than or equal to zero");
+ if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
+ if (member == null) throw new ArgumentNullException("member");
+ FixupRecord record = new FixupRecord (GetObjectRecord(objectToBeFixed), member, GetObjectRecord(objectRequired));
+ AddFixup (record);
+ }
+
+ private void RegisterObjectInternal (object obj, ObjectRecord record)
+ {
+ if (obj == null) throw new ArgumentNullException("obj");
+
+ if (record.IsRegistered)
+ {
+ if (record.OriginalObject != obj) throw new SerializationException ("An object with Id " + record.ObjectID + " has already been registered");
+ else return;
+ }
+
+ record.ObjectInstance = obj;
+ record.OriginalObject = obj;
+
+ if (obj is IObjectReference) record.Status = ObjectRecordStatus.ReferenceUnsolved;
+ else record.Status = ObjectRecordStatus.ReferenceSolved;
+
+ record.DoFixups (true, this, false);
+ record.DoFixups (false, this, false);
+ _registeredObjectsCount++;
+
+ // Adds the object to the chain of registered objects. This chain
+ // is needed to be able to to perform the final fixups in the right order
+
+ if (_objectRecordChain == null)
+ {
+ _objectRecordChain = record;
+ _lastObjectRecord = record;
+ }
+ else
+ {
+ _lastObjectRecord.Next = record;
+ _lastObjectRecord = record;
+ }
+ }
+
+
+ public virtual void RegisterObject (object obj, long objectID)
+ {
+ RegisterObjectInternal (obj, GetObjectRecord (objectID));
+ }
+
+ public void RegisterObject (object obj, long objectID, SerializationInfo info)
+ {
+ if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
+
+ ObjectRecord record = GetObjectRecord (objectID);
+ record.Info = info;
+ RegisterObjectInternal (obj, record);
+ }
+
+ public void RegisterObject (object obj, long objectID, SerializationInfo info, long idOfContainingObj, MemberInfo member)
+ {
+ RegisterObject (obj, objectID, info, idOfContainingObj, member, null);
+ }
+
+ public void RegisterObject( object obj, long objectID, SerializationInfo info, long idOfContainingObj, MemberInfo member, int[] arrayIndex)
+ {
+ if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
+
+ ObjectRecord record = GetObjectRecord (objectID);
+ record.Info = info;
+ record.IdOfContainingObj = idOfContainingObj;
+ record.Member = member;
+ record.ArrayIndex = arrayIndex;
+ RegisterObjectInternal (obj, record);
+ }
+ }
+
+
+
+ // Fixup types. There is a fixup class for each fixup type.
+
+ // BaseFixupRecord
+ // Base class for all fixups
+
+ internal abstract class BaseFixupRecord
+ {
+ public BaseFixupRecord(ObjectRecord objectToBeFixed, ObjectRecord objectRequired)
+ {
+ ObjectToBeFixed = objectToBeFixed;
+ ObjectRequired = objectRequired;
+ }
+
+ public bool DoFixup (ObjectManager manager, bool strict)
+ {
+ if (ObjectToBeFixed.IsRegistered && ObjectRequired.IsInstanceReady)
+ {
+ FixupImpl (manager);
+ return true;
+ }
+ else if (strict)
+ {
+ if (!ObjectToBeFixed.IsRegistered) throw new SerializationException ("An object with ID " + ObjectToBeFixed.ObjectID + " was included in a fixup, but it has not been registered");
+ else if (!ObjectRequired.IsRegistered) throw new SerializationException ("An object with ID " + ObjectRequired.ObjectID + " was included in a fixup, but it has not been registered");
+ else return false;
+ }
+ else
+ return false;
+ }
+
+ protected abstract void FixupImpl (ObjectManager manager);
+
+ internal protected ObjectRecord ObjectToBeFixed;
+ internal protected ObjectRecord ObjectRequired;
+
+ public BaseFixupRecord NextSameContainer;
+ public BaseFixupRecord NextSameRequired;
+ }
+
+ // ArrayFixupRecord
+ // Fixup for assigning a value to one position of an array
+
+ internal class ArrayFixupRecord : BaseFixupRecord
+ {
+ int _index;
+
+ public ArrayFixupRecord (ObjectRecord objectToBeFixed, int index, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
+ _index = index;
+ }
+
+ protected override void FixupImpl (ObjectManager manager) {
+ Array array = (Array)ObjectToBeFixed.ObjectInstance;
+ array.SetValue (ObjectRequired.ObjectInstance, _index);
+ }
+ }
+
+ // MultiArrayFixupRecord
+ // Fixup for assigning a value to several positions of an array
+
+ internal class MultiArrayFixupRecord : BaseFixupRecord
+ {
+ int[] _indices;
+
+ public MultiArrayFixupRecord (ObjectRecord objectToBeFixed, int[] indices, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
+ _indices = indices;
+ }
+
+ protected override void FixupImpl (ObjectManager manager) {
+ Array array = (Array)ObjectToBeFixed.ObjectInstance;
+ array.SetValue (ObjectRequired.ObjectInstance, _indices);
+ }
+ }
+
+ // FixupRecord
+ // Fixup for assigning a value to a member of an object
+
+ internal class FixupRecord: BaseFixupRecord
+ {
+ public MemberInfo _member;
+
+ public FixupRecord (ObjectRecord objectToBeFixed, MemberInfo member, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
+ _member = member;
+ }
+
+ protected override void FixupImpl (ObjectManager manager) {
+ ObjectToBeFixed.SetMemberValue (manager, _member, ObjectRequired.ObjectInstance);
+ }
+ }
+
+ // DelayedFixupRecord
+ // Fixup for assigning a value to a SerializationInfo of an object
+
+ internal class DelayedFixupRecord: BaseFixupRecord
+ {
+ public string _memberName;
+
+ public DelayedFixupRecord (ObjectRecord objectToBeFixed, string memberName, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
+ _memberName = memberName;
+ }
+
+ protected override void FixupImpl (ObjectManager manager) {
+ ObjectToBeFixed.SetMemberValue (manager, _memberName, ObjectRequired.ObjectInstance);
+ }
+ }
+
+ // Object Record
+
+ public enum ObjectRecordStatus: byte { Unregistered, ReferenceUnsolved, ReferenceSolvingDelayed, ReferenceSolved }
+
+ internal class ObjectRecord
+ {
+ public ObjectRecordStatus Status = ObjectRecordStatus.Unregistered;
+ public object OriginalObject;
+ public object ObjectInstance;
+ public long ObjectID;
+ public SerializationInfo Info;
+ public long IdOfContainingObj;
+ public MemberInfo Member;
+ public int[] ArrayIndex;
+ public BaseFixupRecord FixupChainAsContainer;
+ public BaseFixupRecord FixupChainAsRequired;
+ public ObjectRecord Next;
+
+ public void SetMemberValue (ObjectManager manager, MemberInfo member, object value)
+ {
+ if (member is FieldInfo)
+ ((FieldInfo)member).SetValue (ObjectInstance, value);
+ else if (member is PropertyInfo)
+ ((PropertyInfo)member).SetValue (ObjectInstance, value, null);
+ else throw new SerializationException ("Cannot perform fixup");
+
+ if (Member != null)
+ {
+ ObjectRecord containerRecord = manager.GetObjectRecord (IdOfContainingObj);
+ if (containerRecord.IsRegistered)
+ containerRecord.SetMemberValue (manager, Member, ObjectInstance);
+ }
+ }
+
+ public void SetMemberValue (ObjectManager manager, string memberName, object value)
+ {
+ if (Info == null) throw new SerializationException ("Cannot perform fixup");
+ Info.AddValue (memberName, value, value.GetType());
+ }
+
+ public bool IsInstanceReady
+ {
+ // Returns true if this object is ready to be assigned to a parent object.
+ get
+ {
+ if (!IsRegistered) return false;
+ if (IsUnsolvedObjectReference) return false;
+
+ // Embedded value objects cannot be assigned to their containers until fully completed
+ if (Member != null && (HasPendingFixups || Info != null))
+ return false;
+
+ return true;
+ }
+ }
+
+ public bool IsUnsolvedObjectReference
+ {
+ get {
+ return Status != ObjectRecordStatus.ReferenceSolved;
+ }
+ }
+
+ public bool IsRegistered
+ {
+ get {
+ return Status != ObjectRecordStatus.Unregistered;
+ }
+ }
+
+ public bool DoFixups (bool asContainer, ObjectManager manager, bool strict)
+ {
+ BaseFixupRecord prevFixup = null;
+ BaseFixupRecord fixup = asContainer ? FixupChainAsContainer : FixupChainAsRequired;
+ bool allFixed = true;
+
+ while (fixup != null)
+ {
+ if (fixup.DoFixup (manager, strict))
+ {
+ UnchainFixup (fixup, prevFixup, asContainer);
+ if (asContainer) fixup.ObjectRequired.RemoveFixup (fixup, false);
+ else fixup.ObjectToBeFixed.RemoveFixup (fixup, true);
+ }
+ else
+ {
+ prevFixup = fixup;
+ allFixed = false;
+ }
+
+ fixup = asContainer ? fixup.NextSameContainer : fixup.NextSameRequired;
+ }
+ return allFixed;
+ }
+
+ public void RemoveFixup (BaseFixupRecord fixupToRemove, bool asContainer)
+ {
+ BaseFixupRecord prevFixup = null;
+ BaseFixupRecord fixup = asContainer ? FixupChainAsContainer : FixupChainAsRequired;
+ while (fixup != null)
+ {
+ if (fixup == fixupToRemove)
+ {
+ UnchainFixup (fixup, prevFixup, asContainer);
+ return;
+ }
+ prevFixup = fixup;
+ fixup = asContainer ? fixup.NextSameContainer : fixup.NextSameRequired;
+ }
+ }
+
+ private void UnchainFixup (BaseFixupRecord fixup, BaseFixupRecord prevFixup, bool asContainer)
+ {
+ if (prevFixup == null) {
+ if (asContainer) FixupChainAsContainer = fixup.NextSameContainer;
+ else FixupChainAsRequired = fixup.NextSameRequired;
+ }
+ else {
+ if (asContainer) prevFixup.NextSameContainer = fixup.NextSameContainer;
+ else prevFixup.NextSameRequired = fixup.NextSameRequired;
+ }
+ }
+
+ public void ChainFixup (BaseFixupRecord fixup, bool asContainer)
+ {
+ if (asContainer)
+ {
+ fixup.NextSameContainer = FixupChainAsContainer;
+ FixupChainAsContainer = fixup;
+ }
+ else
+ {
+ fixup.NextSameRequired = FixupChainAsRequired;
+ FixupChainAsRequired = fixup;
+ }
+ }
+
+ public bool LoadData (ObjectManager manager, ISurrogateSelector selector, StreamingContext context)
+ {
+ if (Info != null)
+ {
+ if (ObjectInstance is ISerializable)
+ {
+ object[] pars = new object[] {Info, context};
+ ConstructorInfo con = ObjectInstance.GetType().GetConstructor (BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof (SerializationInfo), typeof (StreamingContext) }, null );
+ if (con == null) throw new SerializationException ("The constructor to deserialize an object of type " + ObjectInstance.GetType().FullName + " was not found.");
+ con.Invoke (ObjectInstance, pars);
+ }
+ else
+ {
+ ISurrogateSelector foundSelector;
+ ISerializationSurrogate surrogate = selector.GetSurrogate (ObjectInstance.GetType(), context, out foundSelector);
+ if (surrogate == null) throw new SerializationException ("No surrogate selector was found for type " + ObjectInstance.GetType().FullName);
+ surrogate.SetObjectData (ObjectInstance, Info, context, foundSelector);
+ }
+
+ Info = null;
+ }
+
+ if (ObjectInstance is IObjectReference && Status != ObjectRecordStatus.ReferenceSolved)
+ {
+ try {
+ ObjectInstance = ((IObjectReference)ObjectInstance).GetRealObject(context);
+ Status = ObjectRecordStatus.ReferenceSolved;
+ }
+ catch {
+ return false;
+ }
+ }
+
+ if (Member != null)
+ {
+ // If this object is a value object embedded in another object, the parent
+ // object must be updated
+
+ ObjectRecord containerRecord = manager.GetObjectRecord (IdOfContainingObj);
+ containerRecord.SetMemberValue (manager, Member, ObjectInstance);
+ }
+
+ return true;
+ }
+
+ public bool HasPendingFixups
+ {
+ get { return FixupChainAsContainer != null; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
new file mode 100644
index 00000000000..30eef514b4d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Serialization.SerializationBinder.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.Serialization
+{
+ [Serializable]
+ public abstract class SerializationBinder
+ {
+ // Constructor
+ protected SerializationBinder ()
+ : base ()
+ {
+ }
+
+ public abstract Type BindToType (string assemblyName, string typeName);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
new file mode 100644
index 00000000000..8221509892f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
@@ -0,0 +1,40 @@
+//
+// System.Runtime.Serialization.SerializationEntry.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization
+{
+ public struct SerializationEntry
+ {
+ string name;
+ Type objectType;
+ object value;
+
+ // Properties
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public Type ObjectType
+ {
+ get { return objectType; }
+ }
+
+ public object Value
+ {
+ get { return value; }
+ }
+
+ internal SerializationEntry (string name, Type type, object value)
+ {
+ this.name = name;
+ this.objectType = type;
+ this.value = value;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
new file mode 100755
index 00000000000..e5d9196745b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
@@ -0,0 +1,39 @@
+//
+// System.Runtime.Serialization/SerializationException.cd
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization {
+
+ [Serializable]
+ public class SerializationException : SystemException {
+ // Constructors
+ public SerializationException ()
+ : base ("An error occurred during (de)serialization")
+ {
+ }
+
+ public SerializationException (string message)
+ : base (message)
+ {
+ }
+
+ public SerializationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected SerializationException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
new file mode 100644
index 00000000000..e55bccb8b7f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
@@ -0,0 +1,314 @@
+//
+// System.Runtime.Serialization.SerializationInfo.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System;
+using System.Collections;
+
+namespace System.Runtime.Serialization
+{
+ public sealed class SerializationInfo
+ {
+ Hashtable serialized = new Hashtable ();
+ string assemblyName; // the assembly being serialized
+ string fullTypeName; // the type being serialized.
+
+ [CLSCompliant (false)] IFormatterConverter converter;
+
+ /* used by the runtime */
+ private SerializationInfo (Type type)
+ {
+ assemblyName = type.Assembly.FullName;
+ fullTypeName = type.FullName;
+ converter = new FormatterConverter ();
+ }
+
+ /* used by the runtime */
+ private SerializationInfo (Type type, SerializationEntry [] data)
+ {
+ int len = data.Length;
+
+ assemblyName = type.Assembly.FullName;
+ fullTypeName = type.FullName;
+ converter = new FormatterConverter ();
+
+ for (int i = 0; i < len; i++)
+ serialized.Add (data [i].Name, data [i]);
+ }
+
+ // Constructor
+ [CLSCompliant (false)]
+ public SerializationInfo (Type type, IFormatterConverter converter)
+ {
+ if (type == null && converter == null)
+ throw new ArgumentNullException ("Null arguments.");
+
+ this.converter = converter;
+ assemblyName = type.Assembly.FullName;
+ fullTypeName = type.FullName;
+ }
+
+ // Properties
+ public string AssemblyName
+ {
+ get { return assemblyName; }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("Argument is null.");
+ assemblyName = value;
+ }
+ }
+
+ public string FullTypeName
+ {
+ get { return fullTypeName; }
+
+ set {
+ if ( value == null)
+ throw new ArgumentNullException ("Argument is null.");
+ fullTypeName = value;
+ }
+ }
+
+ public int MemberCount
+ {
+ get { return serialized.Count; }
+ }
+
+ // Methods
+ public void AddValue (string name, object value, Type type)
+ {
+ if (serialized.ContainsKey (name))
+ throw new SerializationException ("Value has been serialized already.");
+
+ SerializationEntry values = new SerializationEntry (name, type, value);
+ serialized.Add (name, values);
+ }
+
+ public object GetValue (string name, Type type)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name is null.");
+ if (!serialized.ContainsKey (name))
+ throw new SerializationException ("No element named " + name + " could be found.");
+
+ SerializationEntry values = (SerializationEntry) serialized [name];
+
+ if (values.Value != null && values.Value.GetType() != type && !values.Value.GetType().IsSubclassOf (type))
+ return converter.Convert (values.Value, type);
+ else
+ return values.Value;
+ }
+
+ public void SetType (Type type)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type is null.");
+
+ fullTypeName = type.FullName;
+ assemblyName = type.Assembly.FullName;
+ }
+
+ public SerializationInfoEnumerator GetEnumerator ()
+ {
+ return new SerializationInfoEnumerator (serialized);
+ }
+
+ public void AddValue (string name, short value)
+ {
+ AddValue (name, value, typeof (System.Int16));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, UInt16 value)
+ {
+ AddValue (name, value, typeof (System.UInt16));
+ }
+
+ public void AddValue (string name, int value)
+ {
+ AddValue (name, value, typeof (System.Int32));
+ }
+
+ public void AddValue (string name, byte value)
+ {
+ AddValue (name, value, typeof (System.Byte));
+ }
+
+ public void AddValue (string name, bool value)
+ {
+ AddValue (name, value, typeof (System.Boolean));
+ }
+
+ public void AddValue (string name, char value)
+ {
+ AddValue (name, value, typeof (System.Char));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, SByte value)
+ {
+ AddValue (name, value, typeof (System.SByte));
+ }
+
+ public void AddValue (string name, double value)
+ {
+ AddValue (name, value, typeof (System.Double));
+ }
+
+ public void AddValue (string name, Decimal value)
+ {
+ AddValue (name, value, typeof (System.Decimal));
+ }
+
+ public void AddValue (string name, DateTime value)
+ {
+ AddValue (name, value, typeof (System.DateTime));
+ }
+
+ public void AddValue (string name, float value)
+ {
+ AddValue (name, value, typeof (System.Single));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, UInt32 value)
+ {
+ AddValue (name, value, typeof (System.UInt32));
+ }
+
+ public void AddValue (string name, long value)
+ {
+ AddValue (name, value, typeof (System.Int64));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, UInt64 value)
+ {
+ AddValue (name, value, typeof (System.UInt64));
+ }
+
+ public void AddValue (string name, object value)
+ {
+ if (value == null)
+ AddValue (name, value, typeof (System.Object));
+ else
+ AddValue (name, value, value.GetType ());
+ }
+
+ public bool GetBoolean (string name)
+ {
+ object value = GetValue (name, typeof (System.Boolean));
+ return converter.ToBoolean (value);
+ }
+
+ public byte GetByte (string name)
+ {
+ object value = GetValue (name, typeof (System.Byte));
+ return converter.ToByte (value);
+ }
+
+ public char GetChar (string name)
+ {
+ object value = GetValue (name, typeof (System.Char));
+ return converter.ToChar (value);
+ }
+
+ public DateTime GetDateTime (string name)
+ {
+ object value = GetValue (name, typeof (System.DateTime));
+ return converter.ToDateTime (value);
+ }
+
+ public Decimal GetDecimal (string name)
+ {
+ object value = GetValue (name, typeof (System.Decimal));
+ return converter.ToDecimal (value);
+ }
+
+ public double GetDouble (string name)
+ {
+ object value = GetValue (name, typeof (System.Double));
+ return converter.ToDouble (value);
+ }
+
+ public short GetInt16 (string name)
+ {
+ object value = GetValue (name, typeof (System.Int16));
+ return converter.ToInt16 (value);
+ }
+
+ public int GetInt32 (string name)
+ {
+ object value = GetValue (name, typeof (System.Int32));
+ return converter.ToInt32 (value);
+ }
+
+ public long GetInt64 (string name)
+ {
+ object value = GetValue (name, typeof (System.Int64));
+ return converter.ToInt64 (value);
+ }
+
+ [CLSCompliant(false)]
+ public SByte GetSByte (string name)
+ {
+ object value = GetValue (name, typeof (System.SByte));
+ return converter.ToSByte (value);
+ }
+
+ public float GetSingle (string name)
+ {
+ object value = GetValue (name, typeof (System.Single));
+ return converter.ToSingle (value);
+ }
+
+ public string GetString (string name)
+ {
+ object value = GetValue (name, typeof (System.String));
+ if (value == null) return null;
+ return converter.ToString (value);
+ }
+
+ [CLSCompliant(false)]
+ public UInt16 GetUInt16 (string name)
+ {
+ object value = GetValue (name, typeof (System.UInt16));
+ return converter.ToUInt16 (value);
+ }
+
+ [CLSCompliant(false)]
+ public UInt32 GetUInt32 (string name)
+ {
+ object value = GetValue (name, typeof (System.UInt32));
+ return converter.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ public UInt64 GetUInt64 (string name)
+ {
+ object value = GetValue (name, typeof (System.UInt64));
+ return converter.ToUInt64 (value);
+ }
+
+ /* used by the runtime */
+ private SerializationEntry [] get_entries ()
+ {
+ SerializationEntry [] res = new SerializationEntry [this.MemberCount];
+ int i = 0;
+
+ foreach (SerializationEntry e in this)
+ res [i++] = e;
+
+ return res;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
new file mode 100644
index 00000000000..a4d50af1d70
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
@@ -0,0 +1,62 @@
+//
+// System.Runtime.Serialization.SerializationInfoEnumerator.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization
+{
+ public sealed class SerializationInfoEnumerator : IEnumerator
+ {
+ IDictionaryEnumerator ide;
+
+ // Constructor
+ internal SerializationInfoEnumerator (Hashtable collection)
+ {
+ ide = collection.GetEnumerator ();
+ }
+
+ // Properties
+ public SerializationEntry Current
+ {
+ get { return (SerializationEntry) ide.Value; }
+ }
+
+ object IEnumerator.Current
+ {
+ get { return ide.Value; }
+ }
+
+ public string Name
+ {
+ get { return this.Current.Name; }
+ }
+
+ public Type ObjectType
+ {
+ get { return this.Current.ObjectType; }
+ }
+
+ public object Value
+ {
+ get { return this.Current.Value; }
+ }
+
+ // Methods
+ public bool MoveNext ()
+ {
+ return ide.MoveNext ();
+ }
+
+ public void Reset ()
+ {
+ ide.Reset ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs b/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
new file mode 100644
index 00000000000..c1b5a530fde
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
@@ -0,0 +1,58 @@
+//
+// System.Runtime.Serialization.StreamingContext.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+ [Serializable]
+ public struct StreamingContext {
+ StreamingContextStates state;
+ object additional;
+
+ public StreamingContext (StreamingContextStates state)
+ {
+ this.state = state;
+ additional = null;
+ }
+
+ public StreamingContext (StreamingContextStates state, object additional)
+ {
+ this.state = state;
+ this.additional = additional;
+ }
+
+ public object Context {
+ get {
+ return additional;
+ }
+ }
+
+ public StreamingContextStates State {
+ get {
+ return state;
+ }
+ }
+
+ override public bool Equals (Object o)
+ {
+ StreamingContext other;
+
+ if (!(o is StreamingContext))
+ return false;
+
+ other = (StreamingContext) o;
+
+ return (other.state == this.state) && (other.additional == this.additional);
+ }
+
+ override public int GetHashCode ()
+ {
+ return (int) state;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs b/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
new file mode 100644
index 00000000000..d5a3858d310
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
@@ -0,0 +1,56 @@
+// StreamingContextStates.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:45:18 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum StreamingContextStates {
+
+ /// <summary>
+ /// </summary>
+ CrossProcess = 1,
+
+ /// <summary>
+ /// </summary>
+ CrossMachine = 2,
+
+ /// <summary>
+ /// </summary>
+ File = 4,
+
+ /// <summary>
+ /// </summary>
+ Persistence = 8,
+
+ /// <summary>
+ /// </summary>
+ Remoting = 16,
+
+ /// <summary>
+ /// </summary>
+ Other = 32,
+
+ /// <summary>
+ /// </summary>
+ Clone = 64,
+
+ CrossAppDomain = 128,
+
+ /// <summary>
+ /// </summary>
+ All = 255,
+ } // StreamingContextStates
+
+} // System.Runtime.Serialization
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs b/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
new file mode 100644
index 00000000000..b0f3c619fec
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
@@ -0,0 +1,96 @@
+//
+// System.Runtime.Serialization.SurrogateSelector.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+// Lluis Sanchez (lsg@ctv.es)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Runtime.Serialization
+{
+ public class SurrogateSelector : ISurrogateSelector
+ {
+ // Fields
+ Hashtable Surrogates = new Hashtable ();
+ ISurrogateSelector nextSelector = null;
+
+ // Constructor
+ public SurrogateSelector()
+ : base ()
+ {
+ }
+
+ // Methods
+ public virtual void AddSurrogate (Type type,
+ StreamingContext context, ISerializationSurrogate surrogate)
+ {
+ if (type == null || surrogate == null)
+ throw new ArgumentNullException ("Null reference.");
+
+ string currentKey = type.FullName + "#" + context.ToString ();
+
+ if (Surrogates.ContainsKey (currentKey))
+ throw new ArgumentException ("A surrogate for " + type.FullName + " already exists.");
+
+ Surrogates.Add (currentKey, surrogate);
+ }
+
+ public virtual void ChainSelector (ISurrogateSelector selector)
+ {
+ if (selector == null)
+ throw new ArgumentNullException ("Selector is null.");
+
+ // Chain the selector at the beggining of the chain
+ // since "The last selector added to the list will be the first one checked"
+ // (from MS docs)
+
+ if (nextSelector != null)
+ selector.ChainSelector (nextSelector);
+
+ nextSelector = selector;
+ }
+
+ public virtual ISurrogateSelector GetNextSelector ()
+ {
+ return nextSelector;
+ }
+
+ public virtual ISerializationSurrogate GetSurrogate (Type type,
+ StreamingContext context, out ISurrogateSelector selector)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type is null.");
+
+ // Check this selector, and if the surrogate is not found,
+ // check the chained selectors
+
+ string key = type.FullName + "#" + context.ToString ();
+ ISerializationSurrogate surrogate = (ISerializationSurrogate) Surrogates [key];
+
+ if (surrogate != null) {
+ selector = this;
+ return surrogate;
+ }
+
+ if (nextSelector != null)
+ return nextSelector.GetSurrogate (type, context, out selector);
+ else {
+ selector = null;
+ return null;
+ }
+ }
+
+ public virtual void RemoveSurrogate (Type type, StreamingContext context)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type is null.");
+
+ string key = type.FullName + "#" + context.ToString ();
+ Surrogates.Remove (key);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ASN1.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ASN1.cs
new file mode 100644
index 00000000000..abc9309cfe1
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ASN1.cs
@@ -0,0 +1,234 @@
+//
+// ASN1.cs: Abstract Syntax Notation 1 - micro-parser and generator
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+
+namespace Mono.Security.ASN1 {
+
+// References:
+// a. ITU ASN.1 standards (free download)
+// http://www.itu.int/ITU-T/studygroups/com17/languages/
+
+internal class ASN1 {
+ protected byte m_nTag;
+ protected byte[] m_aValue;
+ protected ArrayList elist;
+
+ public ASN1 () : this (0x00, null) {}
+
+ public ASN1 (byte tag) : this (tag, null) {}
+
+ public ASN1 (byte tag, byte[] data)
+ {
+ m_nTag = tag;
+ m_aValue = data;
+ elist = new ArrayList ();
+ }
+
+ public ASN1 (byte[] data)
+ {
+ elist = new ArrayList ();
+ m_nTag = data [0];
+
+ int nLenLength = 0;
+ int nLength = data [1];
+
+ if (nLength > 0x80) {
+ // composed length
+ nLenLength = nLength - 0x80;
+ nLength = 0;
+ for (int i = 0; i < nLenLength; i++) {
+ nLength *= 256;
+ nLength += data [i + 2];
+ }
+ }
+
+ m_aValue = new byte [nLength];
+ Array.Copy (data, (2 + nLenLength), m_aValue, 0, nLength);
+
+ int nStart = 0;
+ Decode (data, ref nStart, data.Length);
+ }
+
+ public int Count {
+ get { return elist.Count; }
+ }
+
+ public byte Tag {
+ get { return m_nTag; }
+ }
+
+ public int Length {
+ get {
+ if (m_aValue != null)
+ return m_aValue.Length;
+ else
+ return 0;
+ }
+ }
+
+ public byte[] Value {
+ get { return (byte[]) m_aValue.Clone (); }
+ set {
+ if (value != null)
+ m_aValue = (byte[]) value.Clone ();
+ }
+ }
+
+ public bool CompareValue (byte[] aValue)
+ {
+ bool bResult = (m_aValue.Length == aValue.Length);
+ if (bResult) {
+ for (int i = 0; i < m_aValue.Length; i++) {
+ if (m_aValue[i] != aValue[i])
+ return false;
+ }
+ }
+ return bResult;
+ }
+
+ public virtual void Add (ASN1 asn1)
+ {
+ if (asn1 != null)
+ elist.Add (asn1);
+ }
+
+ public virtual byte[] GetBytes ()
+ {
+ byte[] val = null;
+ if (m_aValue != null) {
+ val = m_aValue;
+ }
+ else if (elist.Count > 0) {
+ int esize = 0;
+ ArrayList al = new ArrayList ();
+ foreach (ASN1 a in elist) {
+ byte[] item = a.GetBytes ();
+ al.Add (item);
+ esize += item.Length;
+ }
+ val = new byte [esize];
+ int pos = 0;
+ for (int i=0; i < elist.Count; i++) {
+ byte[] item = (byte[]) al[i];
+ Array.Copy (item, 0, val, pos, item.Length);
+ pos += item.Length;
+ }
+ }
+
+ byte[] der;
+ int nLengthLen = 0;
+
+ if (val != null) {
+ int nLength = val.Length;
+ // special for length > 127
+ if (nLength > 127) {
+ if (nLength < 256) {
+ der = new byte [3 + nLength];
+ Array.Copy (val, 0, der, 3, nLength);
+ nLengthLen += 0x81;
+ der[2] = (byte)(nLength);
+ }
+ else {
+ der = new byte [4 + nLength];
+ Array.Copy (val, 0, der, 4, nLength);
+ nLengthLen += 0x82;
+ der[2] = (byte)(nLength / 256);
+ der[3] = (byte)(nLength % 256);
+ }
+ }
+ else {
+ der = new byte [2 + nLength];
+ Array.Copy (val, 0, der, 2, nLength);
+ nLengthLen = nLength;
+ }
+ }
+ else
+ der = new byte[2];
+
+ der[0] = m_nTag;
+ der[1] = (byte)nLengthLen;
+
+ return der;
+ }
+
+ // Note: Recursive
+ protected void Decode (byte[] asn1, ref int anPos, int anLength)
+ {
+ byte nTag;
+ int nLength;
+ byte[] aValue;
+
+ // minimum is 2 bytes (tag + length of 0)
+ while (anPos < anLength - 1) {
+ int nPosOri = anPos;
+ DecodeTLV (asn1, ref anPos, out nTag, out nLength, out aValue);
+
+ ASN1 elm = new ASN1 (nTag, aValue);
+ elist.Add (elm);
+
+ if ((nTag & 0x20) == 0x20) {
+ int nConstructedPos = anPos;
+ elm.Decode (asn1, ref nConstructedPos, nConstructedPos + nLength);
+ }
+ anPos += nLength; // value length
+ }
+ }
+
+ // TLV : Tag - Length - Value
+ protected void DecodeTLV (byte[] asn1, ref int anPos, out byte anTag, out int anLength, out byte[] aValue)
+ {
+ anTag = asn1 [anPos++];
+ anLength = asn1 [anPos++];
+
+ // special case where L contains the Length of the Length + 0x80
+ if ((anLength & 0x80) == 0x80) {
+ int nLengthLen = anLength & 0x7F;
+ anLength = 0;
+ for (int i = 0; i < nLengthLen; i++) {
+ anLength = anLength * 256 + asn1 [anPos++];
+ }
+ }
+
+ aValue = new byte [anLength];
+ Array.Copy (asn1, anPos, aValue, 0, anLength);
+ }
+
+ public ASN1 Element (int index)
+ {
+ try {
+ return (ASN1) elist [index];
+ }
+ catch {
+ return null;
+ }
+ }
+
+ public ASN1 Element (int anIndex, byte anTag)
+ {
+ try {
+ ASN1 elm = (ASN1) elist [anIndex];
+ if (elm.Tag == anTag)
+ return elm;
+ else
+ return null;
+ }
+ catch {
+ return null;
+ }
+ }
+}
+
+internal class OID : ASN1 {
+ public OID (string oid) : base (CryptoConfig.EncodeOID (oid)) {}
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog
new file mode 100644
index 00000000000..351d5238977
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -0,0 +1,40 @@
+2002-12-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * ASN1.cs: New. Updated ASN1 classes for X509Certificate that can
+ now be reused for other tools (like Cert2Spc). Classes are marked
+ internal so they cannot be reused from outside corlib (for
+ compatibility with MS implementation).
+ * X509Certificate.cs: Removed all ASN1 classes from file.
+
+2002-12-26 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * X509Certificate.cs: Fixed the date issue (again). Time was
+ converted to local time then ajusted to Pacific time. Now time
+ is kept (internally) as UTC and correct (-8) to Pacific when shown.
+ Changed Authenticode signature detection and removed debugging code.
+
+2002-12-22 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * X509Certificate.cs: Completed CreateFromSignedFile. Added a new
+ internal constructor so Publisher (and the related classes) can
+ create a X509Certificate object which return null dates (for both
+ GetEffectiveDateString and GetExpirationDateString methods).
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * X509Certificate.cs: Fixed the date issue. MS implementation always
+ return the local time for Pacific (GMT-8). Added ToString() and changed
+ some protected to private to please corcompare.
+
+2002-11-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * X509Certificate.cs: Updated some DN cases and some minor time issues.
+ GetEffectiveDateString and GetExpirationDateString still don't match
+ MS implementation (however they seems, most of the time, to be on par
+ with the Windows Certificate Viewer - crtmgr.exe).
+
+2002-11-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * ChangeLog: New. First entry ;-)
+ * X509Certificates.cs: New. Almost complete - except
+ CryptoAPI link, CreateFromSignedFile and some date issues.
diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs
new file mode 100644
index 00000000000..86d5db8f761
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs
@@ -0,0 +1,615 @@
+//
+// X509Certificates.cs: Handles X.509 certificates.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+//using System.Collections;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using Mono.Security.ASN1;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+// References:
+// a. Internet X.509 Public Key Infrastructure Certificate and CRL Profile
+// http://www.ietf.org/rfc/rfc2459.txt
+
+// LAMESPEC: the MSDN docs always talks about X509v3 certificates
+// and/or Authenticode certs. However this class works with older
+// X509v1 certificates and non-authenticode (code signing) certs.
+[Serializable]
+public class X509Certificate {
+
+ static private byte[] countryName = { 0x55, 0x04, 0x06 };
+ static private byte[] organizationName = { 0x55, 0x04, 0x0A };
+ static private byte[] organizationalUnitName = { 0x55, 0x04, 0x0B };
+ static private byte[] commonName = { 0x55, 0x04, 0x03 };
+ static private byte[] localityName = { 0x55, 0x04, 0x07 };
+ static private byte[] stateOrProvinceName = { 0x55, 0x04, 0x08 };
+ static private byte[] streetAddress = { 0x55, 0x04, 0x09 };
+ static private byte[] serialNumber = { 0x55, 0x04, 0x05 };
+ static private byte[] domainComponent = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 };
+ static private byte[] userid = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01 };
+ static private byte[] email = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01 };
+
+ private byte[] m_encodedcert;
+ private byte[] m_certhash;
+ private DateTime m_from;
+ private DateTime m_until;
+ private string m_issuername;
+ private string m_keyalgo;
+ private byte[] m_keyalgoparams;
+ private string m_subject;
+ private byte[] m_publickey;
+ private byte[] m_serialnumber;
+ private bool hideDates;
+
+ // almost every byte[] returning function has a string equivalent
+ // sadly the BitConverter insert dash between bytes :-(
+ private string tostr (byte[] data)
+ {
+ if (data != null) {
+ StringBuilder sb = new StringBuilder ();
+ for (int i = 0; i < data.Length; i++)
+ sb.Append (data[i].ToString ("X2"));
+ return sb.ToString ();
+ }
+ else
+ return null;
+ }
+
+ /// <summary>
+ /// Tranform an RDN to a UTF-8 string representation
+ /// The string is reserved from what is defined in RFC2253.
+ /// </summary>
+ /// <returns>The relative distingued name (RDN) as a string</returns>
+ private string RDNToString (ASN1 seq)
+ {
+ StringBuilder sb = new StringBuilder ();
+ for (int i = 0; i < seq.Count; i++) {
+ ASN1 entry = seq.Element (i);
+ ASN1 pair = entry.Element (0);
+
+ ASN1 s = pair.Element (1);
+ if (s == null)
+ continue;
+
+ ASN1 poid = pair.Element (0);
+ if (poid == null)
+ continue;
+
+ if (poid.CompareValue (countryName))
+ sb.Append ("C=");
+ else if (poid.CompareValue (organizationName))
+ sb.Append ("O=");
+ else if (poid.CompareValue (organizationalUnitName))
+ sb.Append ("OU=");
+ else if (poid.CompareValue (commonName))
+ sb.Append ("CN=");
+ else if (poid.CompareValue (localityName))
+ sb.Append ("L=");
+ else if (poid.CompareValue (stateOrProvinceName))
+ sb.Append ("S="); // NOTE: RFC2253 uses ST=
+ else if (poid.CompareValue (streetAddress))
+ sb.Append ("STREET=");
+ else if (poid.CompareValue (domainComponent))
+ sb.Append ("DC=");
+ else if (poid.CompareValue (userid))
+ sb.Append ("UID=");
+ else if (poid.CompareValue (email))
+ sb.Append ("E="); // NOTE: Not part of RFC2253
+ else {
+ // unknown OID
+ sb.Append ("OID."); // NOTE: Not present as RFC2253
+ sb.Append (OIDToString (poid.Value));
+ sb.Append ("=");
+ }
+
+ string sValue = null;
+ // 16bits or 8bits string ? TODO not complete (+special chars!)
+ if (s.Tag == 0x1E) {
+ // BMPSTRING
+ StringBuilder sb2 = new StringBuilder ();
+ for (int j = 1; j < s.Value.Length; j+=2)
+ sb2.Append ((char) s.Value[j]);
+ sValue = sb2.ToString ();
+ }
+ else {
+ sValue = System.Text.Encoding.UTF8.GetString (s.Value);
+ // in some cases we must quote (") the value
+ // Note: this doesn't seems to conform to RFC2253
+ char[] specials = { ',', '+', '"', '\\', '<', '>', ';' };
+ if (sValue.IndexOfAny(specials, 0, sValue.Length) > 0)
+ sValue = "\"" + sValue + "\"";
+ else if (sValue.StartsWith (" "))
+ sValue = "\"" + sValue + "\"";
+ else if (sValue.EndsWith (" "))
+ sValue = "\"" + sValue + "\"";
+ }
+
+ sb.Append (sValue);
+
+ // separator (not on last iteration)
+ if (i < seq.Count - 1)
+ sb.Append (", ");
+ }
+ return sb.ToString ();
+ }
+
+ /// <summary>
+ /// Convert a binary encoded OID to human readable string representation of
+ /// an OID (IETF style). Based on DUMPASN1.C from Peter Gutmann.
+ /// </summary>
+ /// <param name="aOID">a byte array containing the value of the OID
+ /// (no tag, no length)</param>
+ /// <returns></returns>
+ private string OIDToString (byte[] aOID)
+ {
+ StringBuilder sb = new StringBuilder ();
+ // Pick apart the OID
+ byte x = (byte) (aOID[0] / 40);
+ byte y = (byte) (aOID[0] % 40);
+ if (x > 2) {
+ // Handle special case for large y if x = 2
+ y += (byte) ((x - 2) * 40);
+ x = 2;
+ }
+ sb.Append (x.ToString ());
+ sb.Append (".");
+ sb.Append (y.ToString ());
+ ulong val = 0;
+ for (x = 1; x < aOID.Length; x++) {
+ val = ((val << 7) | ((byte) (aOID [x] & 0x7F)));
+ if ( !((aOID [x] & 0x80) == 0x80)) {
+ sb.Append (".");
+ sb.Append (val.ToString ());
+ val = 0;
+ }
+ }
+ return sb.ToString ();
+ }
+
+ private DateTime UTCToDateTime (ASN1 time)
+ {
+ string t = System.Text.Encoding.ASCII.GetString (time.Value);
+ // to support both UTCTime and GeneralizedTime (and not so common format)
+ string mask = null;
+ switch (t.Length) {
+ case 11: mask = "yyMMddHHmmZ"; // illegal I think ... must check
+ break;
+ case 13: mask = "yyMMddHHmmssZ"; // UTCTime
+ break;
+ case 15: mask = "yyyyMMddHHmmssZ"; // GeneralizedTime
+ break;
+ }
+ return DateTime.ParseExact (t, mask, null).ToUniversalTime ();
+ }
+
+ // that's were the real job is!
+ // from http://www.ietf.org/rfc/rfc2459.txt
+ //
+ //Certificate ::= SEQUENCE {
+ // tbsCertificate TBSCertificate,
+ // signatureAlgorithm AlgorithmIdentifier,
+ // signature BIT STRING }
+ //
+ //TBSCertificate ::= SEQUENCE {
+ // version [0] Version DEFAULT v1,
+ // serialNumber CertificateSerialNumber,
+ // signature AlgorithmIdentifier,
+ // issuer Name,
+ // validity Validity,
+ // subject Name,
+ // subjectPublicKeyInfo SubjectPublicKeyInfo,
+ // issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
+ // -- If present, version shall be v2 or v3
+ // subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
+ // -- If present, version shall be v2 or v3
+ // extensions [3] Extensions OPTIONAL
+ // -- If present, version shall be v3 -- }
+ private void Parse(byte[] data)
+ {
+ string e = "Input data cannot be coded as a valid certificate.";
+ try {
+ ASN1 certdecoder = new ASN1 (data);
+ // select root element
+ ASN1 Certificate = certdecoder.Element (0, 0x30);
+ if (Certificate == null)
+ throw new CryptographicException (e);
+ ASN1 tbsCertificate = Certificate.Element (0, 0x30);
+ if (tbsCertificate == null)
+ throw new CryptographicException (e);
+
+ int tbs = 0;
+ // version (optional) is present only in v2+ certs
+ ASN1 version = tbsCertificate.Element (tbs, 0xA0);
+ if (version != null)
+ tbs++;
+
+ ASN1 serialnumber = tbsCertificate.Element (tbs++, 0x02);
+ if (serialnumber == null)
+ throw new CryptographicException (e);
+ m_serialnumber = serialnumber.Value;
+ Array.Reverse(m_serialnumber, 0, m_serialnumber.Length);
+
+ ASN1 signature = tbsCertificate.Element (tbs++, 0x30);
+
+ ASN1 issuer = tbsCertificate.Element (tbs++, 0x30);
+ m_issuername = RDNToString (issuer);
+
+ ASN1 validity = tbsCertificate.Element (tbs++, 0x30);
+ ASN1 notBefore = validity.Element (0);
+ m_from = UTCToDateTime (notBefore);
+ ASN1 notAfter = validity.Element (1);
+ m_until = UTCToDateTime (notAfter);
+
+ ASN1 subject = tbsCertificate.Element (tbs++, 0x30);
+ m_subject = RDNToString (subject);
+
+ ASN1 subjectPublicKeyInfo = tbsCertificate.Element (tbs++, 0x30);
+
+ ASN1 algorithm = subjectPublicKeyInfo.Element (0, 0x30);
+ ASN1 algo = algorithm.Element (0, 0x06);
+ m_keyalgo = OIDToString (algo.Value);
+ // parameters ANY DEFINED BY algorithm OPTIONAL
+ // so we dont ask for a specific (Element) type and return DER
+ ASN1 parameters = algorithm.Element (1);
+ m_keyalgoparams = parameters.GetBytes ();
+
+ ASN1 subjectPublicKey = subjectPublicKeyInfo.Element (1, 0x03);
+ // we must drop th first byte (which is the number of unused bits
+ // in the BITSTRING)
+ int n = subjectPublicKey.Length - 1;
+ m_publickey = new byte [n];
+ Array.Copy (subjectPublicKey.Value, 1, m_publickey, 0, n);
+
+ // keep original copy
+ m_encodedcert = data;
+ }
+ catch {
+ throw new CryptographicException (e);
+ }
+ }
+
+ // static methods
+
+ public static X509Certificate CreateFromCertFile (string filename)
+ {
+ byte[] data = null;
+ FileStream fs = new FileStream (filename, FileMode.Open);
+ try {
+ data = new byte [fs.Length];
+ fs.Read (data, 0, data.Length);
+ }
+ finally {
+ fs.Close ();
+ }
+
+ return new X509Certificate (data);
+ }
+
+ static private int ReadWord (Stream s)
+ {
+ int word = s.ReadByte ();
+ word = (s.ReadByte () << 8) + word;
+ return word;
+ }
+
+ static private int ReadDWord (Stream s)
+ {
+ int b1 = s.ReadByte ();
+ int b2 = s.ReadByte ();
+ int b3 = s.ReadByte ();
+ int b4 = s.ReadByte ();
+ return (b4 << 24) + (b3 << 16) + (b2 << 8) + b1;
+ }
+
+ // http://www.mycgiserver.com/~ultraschall/files/pefile.htm
+ static private byte[] GetAuthenticodeSignature (string fileName)
+ {
+ FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+ try {
+ // MZ - DOS header
+ if (ReadWord (fs) != 0x5a4d)
+ return null;
+ // find offset of PE header
+ fs.Seek (60, SeekOrigin.Begin);
+ int peOffset = ReadDWord (fs);
+
+ // PE - NT header
+ fs.Seek (peOffset, SeekOrigin.Begin);
+ if (ReadWord (fs) != 0x4550)
+ return null;
+
+ fs.Seek (150, SeekOrigin.Current);
+
+ // IMAGE_DIRECTORY_ENTRY_SECURITY
+ int secOffset = ReadDWord (fs);
+ if (secOffset == 0)
+ return null;
+ int secSize = ReadDWord (fs);
+ if (secSize == 0)
+ return null;
+
+ // Authenticode signature
+ fs.Seek (secOffset, SeekOrigin.Begin);
+ if (ReadDWord (fs) != secSize)
+ return null;
+ if (ReadDWord (fs) != 0x00020200)
+ return null;
+
+ byte[] signature = new byte [secSize - 8];
+ fs.Read (signature, 0, signature.Length);
+ fs.Close ();
+ return signature;
+ }
+ catch {
+ fs.Close ();
+ return null;
+ }
+ }
+
+ // LAMESPEC: How does it differ from CreateFromCertFile ?
+ // It seems to get the certificate inside a PE file (maybe a CAB too ?)
+ public static X509Certificate CreateFromSignedFile (string filename)
+ {
+ byte[] signature = GetAuthenticodeSignature (filename);
+ if (signature == null)
+ return null; // file isn't signed
+
+ // \/ for debugging only \/
+// FileStream debug = new FileStream (@"d:\debug.sig", FileMode.Create);
+// debug.Write (signature, 0, signature.Length);
+// debug.Close ();
+ // /\ for debugging only /\
+
+ // this is a big bad ASN.1 structure
+ // Reference: http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
+ // next we must find the last certificate inside the structure
+ try {
+ ASN1 sign = new ASN1 (signature);
+ // we don't have to understand much of it to get the certificate
+ ASN1 certs = sign.Element(0).Element(1).Element(0).Element(3);
+ byte[] lastCert = certs.Element(certs.Count - 1).GetBytes();
+ return new X509Certificate (lastCert);
+ }
+ catch {
+ return null;
+ }
+ }
+
+ // constructors
+
+ // special constructor for Publisher (and related classes).
+ // Dates strings are null
+ internal X509Certificate (byte[] data, bool dates)
+ {
+ if (data != null) {
+ Parse (data);
+ hideDates = !dates;
+ }
+ }
+
+ public X509Certificate (byte[] data) : this (data, true) {}
+
+ [MonoTODO("Handle on CryptoAPI certificate")]
+ public X509Certificate (IntPtr handle)
+ {
+ // normally a handle to CryptoAPI
+ // How does Mono "handle this handle" ???
+ throw new NotSupportedException ();
+ }
+
+ public X509Certificate (X509Certificate cert)
+ {
+ if (cert != null) {
+ byte[] data = cert.GetRawCertData ();
+ if (data != null)
+ Parse(data);
+ hideDates = false;
+ }
+ }
+
+ // public methods
+
+ public virtual bool Equals(X509Certificate cert)
+ {
+ if (cert != null) {
+ byte[] raw = cert.GetRawCertData ();
+ if (raw != null) {
+ if (raw.Length == m_encodedcert.Length) {
+ for (int i = 0; i < raw.Length; i++) {
+ if (raw[i] != m_encodedcert[i])
+ return false;
+ }
+ // well no choice must be equals!
+ return true;
+ }
+ else
+ return false;
+ }
+ }
+ return (m_encodedcert == null);
+ }
+
+ // LAMESPEC: This is the equivalent of the "thumbprint" that can be seen
+ // in the certificate viewer of Windows. This is ALWAYS the SHA1 hash of
+ // the certificate (i.e. it has nothing to do with the actual hash
+ // algorithm used to sign the certificate).
+ public virtual byte[] GetCertHash ()
+ {
+ // we'll hash the cert only once and only if required
+ if ((m_certhash == null) && (m_encodedcert != null)) {
+ SHA1 sha = SHA1.Create ();
+ m_certhash = sha.ComputeHash (m_encodedcert);
+ }
+ return m_certhash;
+ }
+
+ public virtual string GetCertHashString ()
+ {
+ // must call GetCertHash (not variable) or optimization wont work
+ return tostr (GetCertHash ());
+ }
+
+ // strangly there are no DateTime returning function
+ // LAMESPEC: Microsoft returns the local time from Pacific Time (GMT-8)
+ // BUG: This will not be corrected in Framework 1.1 and also affect WSE 1.0
+ public virtual string GetEffectiveDateString ()
+ {
+ if (hideDates)
+ return null;
+ DateTime dt = m_from.AddHours (-8);
+ return dt.ToString ("yyyy-MM-dd HH:mm:ss");
+ }
+
+ // strangly there are no DateTime returning function
+ // LAMESPEC: Microsoft returns the local time from Pacific Time (GMT-8)
+ // BUG: This will not be corrected in Framework 1.1 and also affect WSE 1.0
+ public virtual string GetExpirationDateString ()
+ {
+ if (hideDates)
+ return null;
+ DateTime dt = m_until.AddHours (-8);
+ return dt.ToString ("yyyy-MM-dd HH:mm:ss");
+ }
+
+ // well maybe someday there'll be support for PGP or SPKI ?
+ public virtual string GetFormat ()
+ {
+ return "X509"; // DO NOT TRANSLATE
+ }
+
+ public override int GetHashCode ()
+ {
+ // the cert hash may not be (yet) calculated
+ if (m_certhash == null)
+ GetCertHash();
+
+ // return the integer of the first 4 bytes of the cert hash
+ if ((m_certhash != null) && (m_certhash.Length >= 4))
+ return ((m_certhash[0] << 24) |(m_certhash[1] << 16) |
+ (m_certhash[2] << 8) | m_certhash[3]);
+ else
+ return 0;
+ }
+
+ public virtual string GetIssuerName ()
+ {
+ return m_issuername;
+ }
+
+ public virtual string GetKeyAlgorithm ()
+ {
+ return m_keyalgo;
+ }
+
+ public virtual byte[] GetKeyAlgorithmParameters ()
+ {
+ return m_keyalgoparams;
+ }
+
+ public virtual string GetKeyAlgorithmParametersString ()
+ {
+ return tostr (m_keyalgoparams);
+ }
+
+ public virtual string GetName ()
+ {
+ return m_subject;
+ }
+
+ public virtual byte[] GetPublicKey ()
+ {
+ return m_publickey;
+ }
+
+ public virtual string GetPublicKeyString ()
+ {
+ return tostr (m_publickey);
+ }
+
+ public virtual byte[] GetRawCertData ()
+ {
+ return m_encodedcert;
+ }
+
+ public virtual string GetRawCertDataString ()
+ {
+ return tostr (m_encodedcert);
+ }
+
+ public virtual byte[] GetSerialNumber ()
+ {
+ return m_serialnumber;
+ }
+
+ public virtual string GetSerialNumberString ()
+ {
+ return tostr (m_serialnumber);
+ }
+
+ // to please corcompare ;-)
+ public override string ToString()
+ {
+ return base.ToString ();
+ }
+
+ public virtual string ToString (bool details)
+ {
+ if (details) {
+ string nl = Environment.NewLine;
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("CERTIFICATE:");
+ sb.Append (nl);
+ sb.Append ("\tFormat: ");
+ sb.Append (GetFormat ());
+ if (m_subject != null) {
+ sb.Append (nl);
+ sb.Append ("\tName: ");
+ sb.Append (GetName ());
+ }
+ if (m_issuername != null) {
+ sb.Append (nl);
+ sb.Append ("\tIssuing CA: ");
+ sb.Append (GetIssuerName ());
+ }
+ if (m_keyalgo != null) {
+ sb.Append (nl);
+ sb.Append ("\tKey Algorithm: ");
+ sb.Append (GetKeyAlgorithm ());
+ }
+ if (m_serialnumber != null) {
+ sb.Append (nl);
+ sb.Append ("\tSerial Number: ");
+ sb.Append (GetSerialNumberString ());
+ }
+ // Note: Algorithm is not spelled right as the actual
+ // MS implementation (we do exactly the same for the
+ // comparison in the unit tests)
+ if (m_keyalgoparams != null) {
+ sb.Append (nl);
+ sb.Append ("\tKey Alogrithm Parameters: ");
+ sb.Append (GetKeyAlgorithmParametersString ());
+ }
+ if (m_publickey != null) {
+ sb.Append (nl);
+ sb.Append ("\tPublic Key: ");
+ sb.Append (GetPublicKeyString ());
+ }
+ sb.Append (nl);
+ sb.Append (nl);
+ return sb.ToString ();
+ }
+ else
+ return ToString ();
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs
new file mode 100755
index 00000000000..bb2986470dc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs
@@ -0,0 +1,134 @@
+//
+// System.Security.Cryptography.AsymmetricAlgorithm Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ // to import keypairs parameters using MiniParser
+ internal class AsymmetricParameters : MiniParser.IReader {
+ private string xml;
+ private int pos;
+
+ public AsymmetricParameters (string xml)
+ {
+ this.xml = xml;
+ pos = 0;
+ }
+
+ public int Read ()
+ {
+ try {
+ return (int) xml [pos++];
+ }
+ catch {
+ return -1;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Abstract base class for all cryptographic asymmetric algorithms.
+ /// Available algorithms include:
+ /// RSA, DSA
+ /// </summary>
+ public abstract class AsymmetricAlgorithm : IDisposable {
+
+ protected int KeySizeValue; // The size of the secret key used by the symmetric algorithm in bits.
+ protected KeySizes[] LegalKeySizesValue; // Specifies the key sizes that are supported by the symmetric algorithm.
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected AsymmetricAlgorithm () {}
+
+ /// <summary>
+ /// Gets the key exchange algorithm
+ /// </summary>
+ public abstract string KeyExchangeAlgorithm {get;}
+
+ /// <summary>
+ /// Gets or sets the actual key size
+ /// </summary>
+ public virtual int KeySize {
+ get { return this.KeySizeValue; }
+ set {
+ if (!IsLegalKeySize (this.LegalKeySizesValue, value))
+ throw new CryptographicException("key size not supported by algorithm");
+
+ this.KeySizeValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets all legal key sizes
+ /// </summary>
+ public virtual KeySizes[] LegalKeySizes {
+ get { return this.LegalKeySizesValue; }
+ }
+
+ /// <summary>
+ /// Gets the signature algorithm
+ /// </summary>
+ public abstract string SignatureAlgorithm {get;}
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ public void Clear ()
+ {
+ Dispose (false);
+ }
+
+ protected abstract void Dispose (bool disposing);
+
+ /// <summary>
+ /// Reconstructs the AsymmetricAlgorithm Object from an XML-string
+ /// </summary>
+ public abstract void FromXmlString (string xmlString);
+
+ /// <summary>
+ /// Returns an XML string representation the current AsymmetricAlgorithm object
+ /// </summary>
+ public abstract string ToXmlString (bool includePrivateParameters);
+
+ private bool IsLegalKeySize (KeySizes[] LegalKeys, int Size)
+ {
+ foreach (KeySizes LegalKeySize in LegalKeys) {
+ for (int i=LegalKeySize.MinSize; i<=LegalKeySize.MaxSize; i+=LegalKeySize.SkipSize) {
+ if (i == Size)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Creates the default implementation of the default asymmetric algorithm (RSA).
+ /// </summary>
+ public static AsymmetricAlgorithm Create ()
+ {
+ return Create ("System.Security.Cryptography.AsymmetricAlgorithm");
+ }
+
+ /// <summary>
+ /// Creates a specific implementation of the given asymmetric algorithm.
+ /// </summary>
+ /// <param name="algo">Specifies which derived class to create</param>
+ public static AsymmetricAlgorithm Create (string algName)
+ {
+ return (AsymmetricAlgorithm) CryptoConfig.CreateFromName (algName);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs
new file mode 100755
index 00000000000..78ee4ce669c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography AsymmetricKeyExchangeDeformatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric key exchange deformatter.
+ /// Available derived classes:
+ /// RSAOAEPKeyExchangeDeformatter, RSAPKCS1KeyExchangeDeformatter
+ /// </summary>
+ public abstract class AsymmetricKeyExchangeDeformatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricKeyExchangeDeformatter() {
+ }
+
+ /// <summary>
+ /// XML string containing the parameters of an asymmetric key exchange operation
+ /// </summary>
+ public abstract string Parameters {get; set;}
+
+ /// <summary>
+ /// get secret data
+ /// </summary>
+ public abstract byte[] DecryptKeyExchange(byte[] rgb);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ } // AsymmetricKeyExchangeDeformatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs
new file mode 100755
index 00000000000..e1b5c0f16de
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs
@@ -0,0 +1,50 @@
+//
+// System.Security.Cryptography AsymmetricKeyExchangeFormatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric key exchange formatter.
+ /// Available derived classes:
+ /// RSAOAEPKeyExchangeFormatter, RSAPKCS1KeyExchangeFormatter
+ /// </summary>
+ public abstract class AsymmetricKeyExchangeFormatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricKeyExchangeFormatter() {
+ }
+
+ /// <summary>
+ /// XML string containing the parameters of an asymmetric key exchange operation
+ /// </summary>
+ public abstract string Parameters {get;}
+
+ /// <summary>
+ /// create encrypted key exchange data
+ /// </summary>
+ public abstract byte[] CreateKeyExchange(byte[] data);
+
+ /// <summary>
+ /// create encrypted key exchange data
+ /// </summary>
+ public abstract byte[] CreateKeyExchange(byte[] data, Type symAlgType);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ } // AsymmetricKeyExchangeFormatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs
new file mode 100755
index 00000000000..1fd632a8f62
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs
@@ -0,0 +1,54 @@
+//
+// System.Security.Cryptography AsymmetricSignatureDeformatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric signature deformatter.
+ /// Available derived classes:
+ /// DSASignatureDeformatter, RSAPKCS1SignatureDeformatter
+ /// </summary>
+ public abstract class AsymmetricSignatureDeformatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricSignatureDeformatter () {}
+
+ /// <summary>
+ /// Sets the hash algorithm used for verifying a signature
+ /// </summary>
+ public abstract void SetHashAlgorithm (string strName);
+
+ /// <summary>
+ /// set the keypair
+ /// </summary>
+ public abstract void SetKey (AsymmetricAlgorithm key);
+
+ /// <summary>
+ /// Verifies the given Signature
+ /// </summary>
+ public abstract bool VerifySignature (byte[] rgbHash, byte[] rgbSignature);
+
+ /// <summary>
+ /// Verifies the given Signature with the given hash algorithm
+ /// </summary>
+ public virtual bool VerifySignature (HashAlgorithm hash, byte[] rgbSignature)
+ {
+ if (hash == null)
+ throw new ArgumentNullException ("hash");
+ return VerifySignature (hash.Hash, rgbSignature);
+ }
+
+ } // AsymmetricSignatureDeformatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs
new file mode 100755
index 00000000000..725cc46b1df
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs
@@ -0,0 +1,56 @@
+//
+// System.Security.Cryptography AsymmetricSignatureFormatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric signature formatter.
+ /// Available derived classes:
+ /// DSASignatureFormatter, RSAPKCS1SignatureFormatter
+ /// </summary>
+ public abstract class AsymmetricSignatureFormatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricSignatureFormatter()
+ {
+ }
+
+ /// <summary>
+ /// Sets the hash algorithm used for verifying a signature
+ /// </summary>
+ public abstract void SetHashAlgorithm(string strName);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ /// <summary>
+ /// Create a signature from the given data
+ /// </summary>
+ public abstract byte[] CreateSignature(byte[] rgbHash);
+
+ /// <summary>
+ /// Create a signature from data with the specified hash algorithm
+ /// </summary>
+ public virtual byte[] CreateSignature(HashAlgorithm hash)
+ {
+ if (hash == null)
+ throw new ArgumentNullException ("hash");
+ return CreateSignature (hash.Hash);
+ }
+
+ } // AsymmetricSignatureFormatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/BigInteger.cs b/mcs/class/corlib/System.Security.Cryptography/BigInteger.cs
new file mode 100644
index 00000000000..b292bf223c9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/BigInteger.cs
@@ -0,0 +1,2643 @@
+//
+// BigInteger.cs - Big Integer implementation
+//
+// Authors:
+// Chew Keong TAN
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright (c) 2002 Chew Keong TAN
+// All rights reserved.
+//
+// Modifications from original
+// - Removed all reference to Random class (not secure enough)
+// - Moved all static Test function into BigIntegerTest.cs (for NUnit)
+//
+
+//************************************************************************************
+// BigInteger Class Version 1.03
+//
+// Copyright (c) 2002 Chew Keong TAN
+// All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, provided that the above
+// copyright notice(s) and this permission notice appear in all copies of
+// the Software and that both the above copyright notice(s) and this
+// permission notice appear in supporting documentation.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+// OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+// HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+// INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+// FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+// WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+//
+//
+// Disclaimer
+// ----------
+// Although reasonable care has been taken to ensure the correctness of this
+// implementation, this code should never be used in any application without
+// proper verification and testing. I disclaim all liability and responsibility
+// to any person or entity with respect to any loss or damage caused, or alleged
+// to be caused, directly or indirectly, by the use of this BigInteger class.
+//
+// Comments, bugs and suggestions to
+// (http://www.codeproject.com/csharp/biginteger.asp)
+//
+//
+// Overloaded Operators +, -, *, /, %, >>, <<, ==, !=, >, <, >=, <=, &, |, ^, ++, --, ~
+//
+// Features
+// --------
+// 1) Arithmetic operations involving large signed integers (2's complement).
+// 2) Primality test using Fermat little theorm, Rabin Miller's method,
+// Solovay Strassen's method and Lucas strong pseudoprime.
+// 3) Modulo exponential with Barrett's reduction.
+// 4) Inverse modulo.
+// 5) Pseudo prime generation.
+// 6) Co-prime generation.
+//
+//
+// Known Problem
+// -------------
+// This pseudoprime passes my implementation of
+// primality test but failed in JDK's isProbablePrime test.
+//
+// byte[] pseudoPrime1 = { (byte)0x00,
+// (byte)0x85, (byte)0x84, (byte)0x64, (byte)0xFD, (byte)0x70, (byte)0x6A,
+// (byte)0x9F, (byte)0xF0, (byte)0x94, (byte)0x0C, (byte)0x3E, (byte)0x2C,
+// (byte)0x74, (byte)0x34, (byte)0x05, (byte)0xC9, (byte)0x55, (byte)0xB3,
+// (byte)0x85, (byte)0x32, (byte)0x98, (byte)0x71, (byte)0xF9, (byte)0x41,
+// (byte)0x21, (byte)0x5F, (byte)0x02, (byte)0x9E, (byte)0xEA, (byte)0x56,
+// (byte)0x8D, (byte)0x8C, (byte)0x44, (byte)0xCC, (byte)0xEE, (byte)0xEE,
+// (byte)0x3D, (byte)0x2C, (byte)0x9D, (byte)0x2C, (byte)0x12, (byte)0x41,
+// (byte)0x1E, (byte)0xF1, (byte)0xC5, (byte)0x32, (byte)0xC3, (byte)0xAA,
+// (byte)0x31, (byte)0x4A, (byte)0x52, (byte)0xD8, (byte)0xE8, (byte)0xAF,
+// (byte)0x42, (byte)0xF4, (byte)0x72, (byte)0xA1, (byte)0x2A, (byte)0x0D,
+// (byte)0x97, (byte)0xB1, (byte)0x31, (byte)0xB3,
+// };
+//
+//
+// Change Log
+// ----------
+// 1) September 23, 2002 (Version 1.03)
+// - Fixed operator- to give correct data length.
+// - Added Lucas sequence generation.
+// - Added Strong Lucas Primality test.
+// - Added integer square root method.
+// - Added setBit/unsetBit methods.
+// - New isProbablePrime() method which do not require the
+// confident parameter.
+//
+// 2) August 29, 2002 (Version 1.02)
+// - Fixed bug in the exponentiation of negative numbers.
+// - Faster modular exponentiation using Barrett reduction.
+// - Added getBytes() method.
+// - Fixed bug in ToHexString method.
+// - Added overloading of ^ operator.
+// - Faster computation of Jacobi symbol.
+//
+// 3) August 19, 2002 (Version 1.01)
+// - Big integer is stored and manipulated as unsigned integers (4 bytes) instead of
+// individual bytes this gives significant performance improvement.
+// - Updated Fermat's Little Theorem test to use a^(p-1) mod p = 1
+// - Added isProbablePrime method.
+// - Updated documentation.
+//
+// 4) August 9, 2002 (Version 1.0)
+// - Initial Release.
+//
+//
+// References
+// [1] D. E. Knuth, "Seminumerical Algorithms", The Art of Computer Programming Vol. 2,
+// 3rd Edition, Addison-Wesley, 1998.
+//
+// [2] K. H. Rosen, "Elementary Number Theory and Its Applications", 3rd Ed,
+// Addison-Wesley, 1993.
+//
+// [3] B. Schneier, "Applied Cryptography", 2nd Ed, John Wiley & Sons, 1996.
+//
+// [4] A. Menezes, P. van Oorschot, and S. Vanstone, "Handbook of Applied Cryptography",
+// CRC Press, 1996, www.cacr.math.uwaterloo.ca/hac
+//
+// [5] A. Bosselaers, R. Govaerts, and J. Vandewalle, "Comparison of Three Modular
+// Reduction Functions," Proc. CRYPTO'93, pp.175-186.
+//
+// [6] R. Baillie and S. S. Wagstaff Jr, "Lucas Pseudoprimes", Mathematics of Computation,
+// Vol. 35, No. 152, Oct 1980, pp. 1391-1417.
+//
+// [7] H. C. Williams, "Édouard Lucas and Primality Testing", Canadian Mathematical
+// Society Series of Monographs and Advance Texts, vol. 22, John Wiley & Sons, New York,
+// NY, 1998.
+//
+// [8] P. Ribenboim, "The new book of prime number records", 3rd edition, Springer-Verlag,
+// New York, NY, 1995.
+//
+// [9] M. Joye and J.-J. Quisquater, "Efficient computation of full Lucas sequences",
+// Electronics Letters, 32(6), 1996, pp 537-538.
+//
+//************************************************************************************
+
+using System;
+
+namespace System.Security.Cryptography {
+
+internal class BigRandom {
+ RandomNumberGenerator rng;
+
+ public BigRandom ()
+ {
+ rng = RandomNumberGenerator.Create ();
+ }
+
+ public void Get (uint[] data)
+ {
+ byte[] random = new byte [4 * data.Length];
+ rng.GetBytes (random);
+ int n = 0;
+ for (int i=0; i < data.Length; i++) {
+ data[i] = BitConverter.ToUInt32 (random, n);
+ n+=4;
+ }
+ }
+
+ public int GetInt (int maxValue)
+ {
+ // calculate mask
+ int mask = Int32.MaxValue;
+ while ((mask & maxValue) == maxValue)
+ mask >>= 1;
+ // undo last iteration
+ mask <<= 1;
+ mask |= 0x01;
+ byte[] data = new byte [4];
+ int result = -1;
+ while ((result < 0) || (result > maxValue)) {
+ rng.GetBytes (data);
+ result = (BitConverter.ToInt32 (data, 0) & mask);
+ }
+ return result;
+ }
+
+ public byte GetByte()
+ {
+ byte[] data = new byte [1];
+ rng.GetBytes (data);
+ return data [0];
+ }
+}
+
+internal class BigInteger {
+ // maximum length of the BigInteger in uint (4 bytes)
+ // change this to suit the required level of precision.
+
+ //private const int maxLength = 70;
+ // FIXME: actually this limit us to approx. 2048 bits keypair for RSA
+ private const int maxLength = 140;
+
+ private BigRandom random;
+
+ // primes smaller than 2000 to test the generated prime number
+
+ public static readonly int[] primesBelow2000 = {
+ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
+ 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
+ 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,
+ 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,
+ 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499,
+ 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599,
+ 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691,
+ 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797,
+ 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887,
+ 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,
+ 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097,
+ 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193,
+ 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297,
+ 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399,
+ 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499,
+ 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597,
+ 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699,
+ 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789,
+ 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889,
+ 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999 };
+
+ private uint[] data = null; // stores bytes from the Big Integer
+ public int dataLength; // number of actual chars used
+
+ // Constructor (Default value for BigInteger is 0
+ public BigInteger()
+ {
+ data = new uint[maxLength];
+ dataLength = 1;
+ }
+
+ // Constructor (Default value provided by long)
+ public BigInteger(long value)
+ {
+ data = new uint[maxLength];
+ long tempVal = value;
+ // copy bytes from long to BigInteger without any assumption of
+ // the length of the long datatype
+ dataLength = 0;
+ while(value != 0 && dataLength < maxLength) {
+ data[dataLength] = (uint)(value & 0xFFFFFFFF);
+ value >>= 32;
+ dataLength++;
+ }
+
+ if(tempVal > 0) { // overflow check for +ve value
+ if(value != 0 || (data[maxLength-1] & 0x80000000) != 0)
+ throw(new ArithmeticException("Positive overflow in constructor."));
+ }
+ else if(tempVal < 0) { // underflow check for -ve value
+ if(value != -1 || (data[dataLength-1] & 0x80000000) == 0)
+ throw(new ArithmeticException("Negative underflow in constructor."));
+ }
+
+ if(dataLength == 0)
+ dataLength = 1;
+ }
+
+ // Constructor (Default value provided by ulong)
+ public BigInteger(ulong value)
+ {
+ data = new uint[maxLength];
+ // copy bytes from ulong to BigInteger without any assumption of
+ // the length of the ulong datatype
+
+ dataLength = 0;
+ while(value != 0 && dataLength < maxLength) {
+ data[dataLength] = (uint)(value & 0xFFFFFFFF);
+ value >>= 32;
+ dataLength++;
+ }
+
+ if(value != 0 || (data[maxLength-1] & 0x80000000) != 0)
+ throw(new ArithmeticException("Positive overflow in constructor."));
+
+ if(dataLength == 0)
+ dataLength = 1;
+ }
+
+ // Constructor (Default value provided by BigInteger)
+ public BigInteger(BigInteger bi)
+ {
+ data = new uint[maxLength];
+ dataLength = bi.dataLength;
+ for(int i = 0; i < dataLength; i++)
+ data[i] = bi.data[i];
+ }
+
+ // Constructor (Default value provided by a string of digits of the
+ // specified base)
+ // Example (base 10)
+ // -----------------
+ // To initialize "a" with the default value of 1234 in base 10
+ // BigInteger a = new BigInteger("1234", 10)
+ //
+ // To initialize "a" with the default value of -1234
+ // BigInteger a = new BigInteger("-1234", 10)
+ //
+ // Example (base 16)
+ // -----------------
+ // To initialize "a" with the default value of 0x1D4F in base 16
+ // BigInteger a = new BigInteger("1D4F", 16)
+ //
+ // To initialize "a" with the default value of -0x1D4F
+ // BigInteger a = new BigInteger("-1D4F", 16)
+ //
+ // Note that string values are specified in the <sign><magnitude>
+ // format.
+ public BigInteger(string value, int radix)
+ {
+ BigInteger multiplier = new BigInteger(1);
+ BigInteger result = new BigInteger();
+ value = (value.ToUpper()).Trim();
+ int limit = 0;
+
+ if(value[0] == '-')
+ limit = 1;
+
+ for(int i = value.Length - 1; i >= limit ; i--) {
+ int posVal = (int)value[i];
+
+ if(posVal >= '0' && posVal <= '9')
+ posVal -= '0';
+ else if(posVal >= 'A' && posVal <= 'Z')
+ posVal = (posVal - 'A') + 10;
+ else
+ posVal = 9999999; // arbitrary large
+
+
+ if(posVal >= radix)
+ throw(new ArithmeticException("Invalid string in constructor."));
+ else {
+ if(value[0] == '-')
+ posVal = -posVal;
+
+ result = result + (multiplier * posVal);
+
+ if((i - 1) >= limit)
+ multiplier = multiplier * radix;
+ }
+ }
+
+ if(value[0] == '-') { // negative values
+ if((result.data[maxLength-1] & 0x80000000) == 0)
+ throw(new ArithmeticException("Negative underflow in constructor."));
+ }
+ else { // positive values
+ if((result.data[maxLength-1] & 0x80000000) != 0)
+ throw(new ArithmeticException("Positive overflow in constructor."));
+ }
+
+ data = new uint[maxLength];
+ for(int i = 0; i < result.dataLength; i++)
+ data[i] = result.data[i];
+
+ dataLength = result.dataLength;
+ }
+
+
+ // Constructor (Default value provided by an array of bytes)
+ //
+ // The lowest index of the input byte array (i.e [0]) should contain the
+ // most significant byte of the number, and the highest index should
+ // contain the least significant byte.
+ //
+ // E.g.
+ // To initialize "a" with the default value of 0x1D4F in base 16
+ // byte[] temp = { 0x1D, 0x4F };
+ // BigInteger a = new BigInteger(temp)
+ //
+ // Note that this method of initialization does not allow the
+ // sign to be specified.
+ public BigInteger(byte[] inData)
+ {
+ dataLength = inData.Length >> 2;
+
+ int leftOver = inData.Length & 0x3;
+ if(leftOver != 0) // length not multiples of 4
+ dataLength++;
+
+
+ if(dataLength > maxLength)
+ throw(new ArithmeticException("Byte overflow in constructor."));
+
+ data = new uint[maxLength];
+
+ for(int i = inData.Length - 1, j = 0; i >= 3; i -= 4, j++) {
+ data[j] = (uint)((inData[i-3] << 24) + (inData[i-2] << 16) +
+ (inData[i-1] << 8) + inData[i]);
+ }
+
+ if(leftOver == 1)
+ data[dataLength-1] = (uint)inData[0];
+ else if(leftOver == 2)
+ data[dataLength-1] = (uint)((inData[0] << 8) + inData[1]);
+ else if(leftOver == 3)
+ data[dataLength-1] = (uint)((inData[0] << 16) + (inData[1] << 8) + inData[2]);
+
+
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ //Console.WriteLine("Len = " + dataLength);
+ }
+
+ // Constructor (Default value provided by an array of bytes of the
+ // specified length.)
+ public BigInteger(byte[] inData, int inLen)
+ {
+ dataLength = inLen >> 2;
+
+ int leftOver = inLen & 0x3;
+ if(leftOver != 0) // length not multiples of 4
+ dataLength++;
+
+ if(dataLength > maxLength || inLen > inData.Length)
+ throw(new ArithmeticException("Byte overflow in constructor."));
+
+
+ data = new uint[maxLength];
+
+ for(int i = inLen - 1, j = 0; i >= 3; i -= 4, j++) {
+ data[j] = (uint)((inData[i-3] << 24) + (inData[i-2] << 16) +
+ (inData[i-1] << 8) + inData[i]);
+ }
+
+ if(leftOver == 1)
+ data[dataLength-1] = (uint)inData[0];
+ else if(leftOver == 2)
+ data[dataLength-1] = (uint)((inData[0] << 8) + inData[1]);
+ else if(leftOver == 3)
+ data[dataLength-1] = (uint)((inData[0] << 16) + (inData[1] << 8) + inData[2]);
+
+
+ if(dataLength == 0)
+ dataLength = 1;
+
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ //Console.WriteLine("Len = " + dataLength);
+ }
+
+
+ // Constructor (Default value provided by an array of unsigned integers)
+ public BigInteger(uint[] inData)
+ {
+ dataLength = inData.Length;
+
+ if(dataLength > maxLength)
+ throw(new ArithmeticException("Byte overflow in constructor."));
+
+ data = new uint[maxLength];
+
+ for(int i = dataLength - 1, j = 0; i >= 0; i--, j++)
+ data[j] = inData[i];
+
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ //Console.WriteLine("Len = " + dataLength);
+ }
+
+ private BigRandom rng {
+ get {
+ if (random == null)
+ random = new BigRandom ();
+ return random;
+ }
+ }
+
+ // Overloading of the typecast operator.
+ // For BigInteger bi = 10;
+ public static implicit operator BigInteger (long value)
+ {
+ return (new BigInteger (value));
+ }
+
+ public static implicit operator BigInteger (ulong value)
+ {
+ return (new BigInteger (value));
+ }
+
+ public static implicit operator BigInteger (int value)
+ {
+ return (new BigInteger ( (long)value));
+ }
+
+ public static implicit operator BigInteger (uint value)
+ {
+ return (new BigInteger ( (ulong)value));
+ }
+
+ // Overloading of addition operator
+ public static BigInteger operator + (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger ();
+
+ result.dataLength = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ long carry = 0;
+ for(int i = 0; i < result.dataLength; i++) {
+ long sum = (long)bi1.data[i] + (long)bi2.data[i] + carry;
+ carry = sum >> 32;
+ result.data[i] = (uint)(sum & 0xFFFFFFFF);
+ }
+
+ if(carry != 0 && result.dataLength < maxLength) {
+ result.data[result.dataLength] = (uint)(carry);
+ result.dataLength++;
+ }
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+
+ // overflow check
+ int lastPos = maxLength - 1;
+ if((bi1.data[lastPos] & 0x80000000) == (bi2.data[lastPos] & 0x80000000) &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException());
+ }
+
+ return result;
+ }
+
+ // Overloading of the unary ++ operator
+ public static BigInteger operator ++ (BigInteger bi1)
+ {
+ BigInteger result = new BigInteger (bi1);
+
+ long val, carry = 1;
+ int index = 0;
+
+ while(carry != 0 && index < maxLength) {
+ val = (long)(result.data[index]);
+ val++;
+
+ result.data[index] = (uint)(val & 0xFFFFFFFF);
+ carry = val >> 32;
+
+ index++;
+ }
+
+ if(index > result.dataLength)
+ result.dataLength = index;
+ else {
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+ }
+
+ // overflow check
+ int lastPos = maxLength - 1;
+
+ // overflow if initial value was +ve but ++ caused a sign
+ // change to negative.
+
+ if((bi1.data[lastPos] & 0x80000000) == 0 &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException("Overflow in ++."));
+ }
+ return result;
+ }
+
+ // Overloading of subtraction operator
+ public static BigInteger operator - (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger ();
+
+ result.dataLength = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ long carryIn = 0;
+ for(int i = 0; i < result.dataLength; i++) {
+ long diff;
+
+ diff = (long)bi1.data[i] - (long)bi2.data[i] - carryIn;
+ result.data[i] = (uint)(diff & 0xFFFFFFFF);
+
+ if(diff < 0)
+ carryIn = 1;
+ else
+ carryIn = 0;
+ }
+
+ // roll over to negative
+ if(carryIn != 0) {
+ for(int i = result.dataLength; i < maxLength; i++)
+ result.data[i] = 0xFFFFFFFF;
+ result.dataLength = maxLength;
+ }
+
+ // fixed in v1.03 to give correct datalength for a - (-b)
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ // overflow check
+
+ int lastPos = maxLength - 1;
+ if((bi1.data[lastPos] & 0x80000000) != (bi2.data[lastPos] & 0x80000000) &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException());
+ }
+
+ return result;
+ }
+
+
+ // Overloading of the unary -- operator
+ public static BigInteger operator -- (BigInteger bi1)
+ {
+ BigInteger result = new BigInteger (bi1);
+
+ long val;
+ bool carryIn = true;
+ int index = 0;
+
+ while(carryIn && index < maxLength) {
+ val = (long)(result.data[index]);
+ val--;
+
+ result.data[index] = (uint)(val & 0xFFFFFFFF);
+
+ if(val >= 0)
+ carryIn = false;
+
+ index++;
+ }
+
+ if(index > result.dataLength)
+ result.dataLength = index;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ // overflow check
+ int lastPos = maxLength - 1;
+
+ // overflow if initial value was -ve but -- caused a sign
+ // change to positive.
+
+ if((bi1.data[lastPos] & 0x80000000) != 0 &&
+ (result.data[lastPos] & 0x80000000) != (bi1.data[lastPos] & 0x80000000)) {
+ throw (new ArithmeticException("Underflow in --."));
+ }
+
+ return result;
+ }
+
+ // Overloading of multiplication operator
+ public static BigInteger operator * (BigInteger bi1, BigInteger bi2)
+ {
+ int lastPos = maxLength-1;
+ bool bi1Neg = false, bi2Neg = false;
+
+ // take the absolute value of the inputs
+ try {
+ if((bi1.data[lastPos] & 0x80000000) != 0) { // bi1 negative
+ bi1Neg = true; bi1 = -bi1;
+ }
+ if((bi2.data[lastPos] & 0x80000000) != 0) { // bi2 negative
+ bi2Neg = true; bi2 = -bi2;
+ }
+ }
+ catch(Exception) {}
+
+ BigInteger result = new BigInteger();
+
+ // multiply the absolute values
+ try {
+ for(int i = 0; i < bi1.dataLength; i++) {
+ if(bi1.data[i] == 0) continue;
+
+ ulong mcarry = 0;
+ for(int j = 0, k = i; j < bi2.dataLength; j++, k++) {
+ // k = i + j
+ ulong val = ((ulong)bi1.data[i] * (ulong)bi2.data[j]) +
+ (ulong)result.data[k] + mcarry;
+
+ result.data[k] = (uint)(val & 0xFFFFFFFF);
+ mcarry = (val >> 32);
+ }
+
+ if(mcarry != 0)
+ result.data[i+bi2.dataLength] = (uint)mcarry;
+ }
+ }
+ catch(Exception) {
+ throw(new ArithmeticException("Multiplication overflow."));
+ }
+
+
+ result.dataLength = bi1.dataLength + bi2.dataLength;
+ if(result.dataLength > maxLength)
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ // overflow check (result is -ve)
+ if((result.data[lastPos] & 0x80000000) != 0) {
+ if(bi1Neg != bi2Neg && result.data[lastPos] == 0x80000000) { // different sign
+ // handle the special case where multiplication produces
+ // a max negative number in 2's complement.
+
+ if(result.dataLength == 1)
+ return result;
+ else {
+ bool isMaxNeg = true;
+ for(int i = 0; i < result.dataLength - 1 && isMaxNeg; i++) {
+ if(result.data[i] != 0)
+ isMaxNeg = false;
+ }
+
+ if(isMaxNeg)
+ return result;
+ }
+ }
+
+ throw(new ArithmeticException("Multiplication overflow."));
+ }
+
+ // if input has different signs, then result is -ve
+ if(bi1Neg != bi2Neg)
+ return -result;
+
+ return result;
+ }
+
+ // Overloading of unary << operators
+ public static BigInteger operator << (BigInteger bi1, int shiftVal)
+ {
+ BigInteger result = new BigInteger (bi1);
+ result.dataLength = shiftLeft(result.data, shiftVal);
+
+ return result;
+ }
+
+ // least significant bits at lower part of buffer
+ private static int shiftLeft (uint[] buffer, int shiftVal)
+ {
+ int shiftAmount = 32;
+ int bufLen = buffer.Length;
+
+ while(bufLen > 1 && buffer[bufLen-1] == 0)
+ bufLen--;
+
+ for(int count = shiftVal; count > 0;) {
+ if(count < shiftAmount)
+ shiftAmount = count;
+
+ //Console.WriteLine("shiftAmount = {0}", shiftAmount);
+
+ ulong carry = 0;
+ for(int i = 0; i < bufLen; i++) {
+ ulong val = ((ulong)buffer[i]) << shiftAmount;
+ val |= carry;
+
+ buffer[i] = (uint)(val & 0xFFFFFFFF);
+ carry = val >> 32;
+ }
+
+ if(carry != 0) {
+ if(bufLen + 1 <= buffer.Length) {
+ buffer[bufLen] = (uint)carry;
+ bufLen++;
+ }
+ }
+ count -= shiftAmount;
+ }
+ return bufLen;
+ }
+
+ // Overloading of unary >> operators
+ public static BigInteger operator >> (BigInteger bi1, int shiftVal)
+ {
+ BigInteger result = new BigInteger(bi1);
+ result.dataLength = shiftRight(result.data, shiftVal);
+
+ if((bi1.data[maxLength-1] & 0x80000000) != 0) { // negative
+ for(int i = maxLength - 1; i >= result.dataLength; i--)
+ result.data[i] = 0xFFFFFFFF;
+
+ uint mask = 0x80000000;
+ for(int i = 0; i < 32; i++) {
+ if((result.data[result.dataLength-1] & mask) != 0)
+ break;
+
+ result.data[result.dataLength-1] |= mask;
+ mask >>= 1;
+ }
+ result.dataLength = maxLength;
+ }
+
+ return result;
+ }
+
+ private static int shiftRight (uint[] buffer, int shiftVal)
+ {
+ int shiftAmount = 32;
+ int invShift = 0;
+ int bufLen = buffer.Length;
+
+ while(bufLen > 1 && buffer[bufLen-1] == 0)
+ bufLen--;
+
+ //Console.WriteLine("bufLen = " + bufLen + " buffer.Length = " + buffer.Length);
+
+ for(int count = shiftVal; count > 0;) {
+ if(count < shiftAmount) {
+ shiftAmount = count;
+ invShift = 32 - shiftAmount;
+ }
+
+ //Console.WriteLine("shiftAmount = {0}", shiftAmount);
+
+ ulong carry = 0;
+ for(int i = bufLen - 1; i >= 0; i--) {
+ ulong val = ((ulong)buffer[i]) >> shiftAmount;
+ val |= carry;
+
+ carry = ((ulong)buffer[i]) << invShift;
+ buffer[i] = (uint)(val);
+ }
+
+ count -= shiftAmount;
+ }
+
+ while(bufLen > 1 && buffer[bufLen-1] == 0)
+ bufLen--;
+
+ return bufLen;
+ }
+
+
+ // Overloading of the NOT operator (1's complement)
+ public static BigInteger operator ~ (BigInteger bi1)
+ {
+ BigInteger result = new BigInteger (bi1);
+
+ for(int i = 0; i < maxLength; i++)
+ result.data[i] = (uint)(~(bi1.data[i]));
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Overloading of the NEGATE operator (2's complement)
+ public static BigInteger operator - (BigInteger bi1)
+ {
+ // handle neg of zero separately since it'll cause an overflow
+ // if we proceed.
+ if(bi1.dataLength == 1 && bi1.data[0] == 0)
+ return (new BigInteger ());
+
+ BigInteger result = new BigInteger (bi1);
+
+ // 1's complement
+ for(int i = 0; i < maxLength; i++)
+ result.data[i] = (uint)(~(bi1.data[i]));
+
+ // add one to result of 1's complement
+ long val, carry = 1;
+ int index = 0;
+
+ while(carry != 0 && index < maxLength) {
+ val = (long)(result.data[index]);
+ val++;
+
+ result.data[index] = (uint)(val & 0xFFFFFFFF);
+ carry = val >> 32;
+
+ index++;
+ }
+
+ if((bi1.data[maxLength-1] & 0x80000000) == (result.data[maxLength-1] & 0x80000000))
+ throw (new ArithmeticException("Overflow in negation.\n"));
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+ return result;
+ }
+
+
+ // Overloading of equality operator
+ public static bool operator == (BigInteger bi1, BigInteger bi2)
+ {
+ return bi1.Equals (bi2);
+ }
+
+ public static bool operator !=( BigInteger bi1, BigInteger bi2)
+ {
+ return !(bi1.Equals (bi2));
+ }
+
+ public override bool Equals (object o)
+ {
+ BigInteger bi = (BigInteger) o;
+
+ if(this.dataLength != bi.dataLength)
+ return false;
+
+ for(int i = 0; i < this.dataLength; i++) {
+ if(this.data [i] != bi.data [i])
+ return false;
+ }
+ return true;
+ }
+
+ public override int GetHashCode ()
+ {
+ return this.ToString ().GetHashCode ();
+ }
+
+ // Overloading of inequality operator
+ public static bool operator > (BigInteger bi1, BigInteger bi2)
+ {
+ int pos = maxLength - 1;
+
+ // bi1 is negative, bi2 is positive
+ if((bi1.data[pos] & 0x80000000) != 0 && (bi2.data[pos] & 0x80000000) == 0)
+ return false;
+
+ // bi1 is positive, bi2 is negative
+ else if((bi1.data[pos] & 0x80000000) == 0 && (bi2.data[pos] & 0x80000000) != 0)
+ return true;
+
+ // same sign
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+ for(pos = len - 1; pos >= 0 && bi1.data[pos] == bi2.data[pos]; pos--);
+
+ if(pos >= 0) {
+ if(bi1.data[pos] > bi2.data[pos])
+ return true;
+ return false;
+ }
+ return false;
+ }
+
+ public static bool operator < (BigInteger bi1, BigInteger bi2)
+ {
+ int pos = maxLength - 1;
+
+ // bi1 is negative, bi2 is positive
+ if((bi1.data[pos] & 0x80000000) != 0 && (bi2.data[pos] & 0x80000000) == 0)
+ return true;
+
+ // bi1 is positive, bi2 is negative
+ else if((bi1.data[pos] & 0x80000000) == 0 && (bi2.data[pos] & 0x80000000) != 0)
+ return false;
+
+ // same sign
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+ for(pos = len - 1; pos >= 0 && bi1.data[pos] == bi2.data[pos]; pos--);
+
+ if(pos >= 0) {
+ if(bi1.data[pos] < bi2.data[pos])
+ return true;
+ return false;
+ }
+ return false;
+ }
+
+ public static bool operator >= (BigInteger bi1, BigInteger bi2)
+ {
+ return (bi1 == bi2 || bi1 > bi2);
+ }
+
+ public static bool operator <= (BigInteger bi1, BigInteger bi2)
+ {
+ return (bi1 == bi2 || bi1 < bi2);
+ }
+
+ // Private function that supports the division of two numbers with
+ // a divisor that has more than 1 digit.
+ // Algorithm taken from [1]
+ private static void multiByteDivide (BigInteger bi1, BigInteger bi2,
+ BigInteger outQuotient, BigInteger outRemainder)
+ {
+ uint[] result = new uint[maxLength];
+
+ int remainderLen = bi1.dataLength + 1;
+ uint[] remainder = new uint[remainderLen];
+
+ uint mask = 0x80000000;
+ uint val = bi2.data[bi2.dataLength - 1];
+ int shift = 0, resultPos = 0;
+
+ while(mask != 0 && (val & mask) == 0) {
+ shift++; mask >>= 1;
+ }
+
+ //Console.WriteLine("shift = {0}", shift);
+ //Console.WriteLine("Before bi1 Len = {0}, bi2 Len = {1}", bi1.dataLength, bi2.dataLength);
+
+ for (int i = 0; i < bi1.dataLength; i++)
+ remainder[i] = bi1.data[i];
+ shiftLeft (remainder, shift);
+ bi2 = bi2 << shift;
+
+ /*
+ Console.WriteLine("bi1 Len = {0}, bi2 Len = {1}", bi1.dataLength, bi2.dataLength);
+ Console.WriteLine("dividend = " + bi1 + "\ndivisor = " + bi2);
+ for(int q = remainderLen - 1; q >= 0; q--)
+ Console.Write("{0:x2}", remainder[q]);
+ Console.WriteLine();
+ */
+
+ int j = remainderLen - bi2.dataLength;
+ int pos = remainderLen - 1;
+
+ ulong firstDivisorByte = bi2.data[bi2.dataLength-1];
+ ulong secondDivisorByte = bi2.data[bi2.dataLength-2];
+
+ int divisorLen = bi2.dataLength + 1;
+ uint[] dividendPart = new uint[divisorLen];
+
+ while(j > 0) {
+ ulong dividend = ((ulong)remainder[pos] << 32) + (ulong)remainder[pos-1];
+ //Console.WriteLine("dividend = {0}", dividend);
+
+ ulong q_hat = dividend / firstDivisorByte;
+ ulong r_hat = dividend % firstDivisorByte;
+
+ //Console.WriteLine("q_hat = {0:X}, r_hat = {1:X}", q_hat, r_hat);
+
+ bool done = false;
+ while(!done) {
+ done = true;
+
+ if(q_hat == 0x100000000 ||
+ (q_hat * secondDivisorByte) > ((r_hat << 32) + remainder[pos-2])) {
+ q_hat--;
+ r_hat += firstDivisorByte;
+
+ if(r_hat < 0x100000000)
+ done = false;
+ }
+ }
+
+ for (int h = 0; h < divisorLen; h++)
+ dividendPart[h] = remainder[pos-h];
+
+ BigInteger kk = new BigInteger (dividendPart);
+ BigInteger ss = bi2 * (long)q_hat;
+
+ //Console.WriteLine("ss before = " + ss);
+ while(ss > kk) {
+ q_hat--;
+ ss -= bi2;
+ //Console.WriteLine(ss);
+ }
+ BigInteger yy = kk - ss;
+
+ //Console.WriteLine("ss = " + ss);
+ //Console.WriteLine("kk = " + kk);
+ //Console.WriteLine("yy = " + yy);
+
+ for(int h = 0; h < divisorLen; h++)
+ remainder[pos-h] = yy.data[bi2.dataLength-h];
+
+ /*
+ Console.WriteLine("dividend = ");
+ for(int q = remainderLen - 1; q >= 0; q--)
+ Console.Write("{0:x2}", remainder[q]);
+ Console.WriteLine("\n************ q_hat = {0:X}\n", q_hat);
+ */
+
+ result[resultPos++] = (uint)q_hat;
+
+ pos--;
+ j--;
+ }
+
+ outQuotient.dataLength = resultPos;
+ int y = 0;
+ for(int x = outQuotient.dataLength - 1; x >= 0; x--, y++)
+ outQuotient.data[y] = result[x];
+ for(; y < maxLength; y++)
+ outQuotient.data[y] = 0;
+
+ while(outQuotient.dataLength > 1 && outQuotient.data[outQuotient.dataLength-1] == 0)
+ outQuotient.dataLength--;
+
+ if(outQuotient.dataLength == 0)
+ outQuotient.dataLength = 1;
+
+ outRemainder.dataLength = shiftRight(remainder, shift);
+
+ for(y = 0; y < outRemainder.dataLength; y++)
+ outRemainder.data[y] = remainder[y];
+ for(; y < maxLength; y++)
+ outRemainder.data[y] = 0;
+ }
+
+ // Private function that supports the division of two numbers with
+ // a divisor that has only 1 digit.
+ private static void singleByteDivide (BigInteger bi1, BigInteger bi2,
+ BigInteger outQuotient, BigInteger outRemainder)
+ {
+ uint[] result = new uint[maxLength];
+ int resultPos = 0;
+
+ // copy dividend to reminder
+ for(int i = 0; i < maxLength; i++)
+ outRemainder.data[i] = bi1.data[i];
+ outRemainder.dataLength = bi1.dataLength;
+
+ while(outRemainder.dataLength > 1 && outRemainder.data[outRemainder.dataLength-1] == 0)
+ outRemainder.dataLength--;
+
+ ulong divisor = (ulong)bi2.data[0];
+ int pos = outRemainder.dataLength - 1;
+ ulong dividend = (ulong)outRemainder.data[pos];
+
+ //Console.WriteLine("divisor = " + divisor + " dividend = " + dividend);
+ //Console.WriteLine("divisor = " + bi2 + "\ndividend = " + bi1);
+
+ if(dividend >= divisor) {
+ ulong quotient = dividend / divisor;
+ result[resultPos++] = (uint)quotient;
+
+ outRemainder.data[pos] = (uint)(dividend % divisor);
+ }
+ pos--;
+
+ while(pos >= 0) {
+ //Console.WriteLine(pos);
+
+ dividend = ((ulong)outRemainder.data[pos+1] << 32) + (ulong)outRemainder.data[pos];
+ ulong quotient = dividend / divisor;
+ result[resultPos++] = (uint)quotient;
+
+ outRemainder.data[pos+1] = 0;
+ outRemainder.data[pos--] = (uint)(dividend % divisor);
+ //Console.WriteLine(">>>> " + bi1);
+ }
+
+ outQuotient.dataLength = resultPos;
+ int j = 0;
+ for(int i = outQuotient.dataLength - 1; i >= 0; i--, j++)
+ outQuotient.data[j] = result[i];
+ for(; j < maxLength; j++)
+ outQuotient.data[j] = 0;
+
+ while(outQuotient.dataLength > 1 && outQuotient.data[outQuotient.dataLength-1] == 0)
+ outQuotient.dataLength--;
+
+ if(outQuotient.dataLength == 0)
+ outQuotient.dataLength = 1;
+
+ while(outRemainder.dataLength > 1 && outRemainder.data[outRemainder.dataLength-1] == 0)
+ outRemainder.dataLength--;
+ }
+
+ // Overloading of division operator
+ public static BigInteger operator / (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger();
+
+ int lastPos = maxLength-1;
+ bool divisorNeg = false, dividendNeg = false;
+
+ if((bi1.data[lastPos] & 0x80000000) != 0) { // bi1 negative
+ bi1 = -bi1;
+ dividendNeg = true;
+ }
+ if((bi2.data[lastPos] & 0x80000000) != 0) { // bi2 negative
+ bi2 = -bi2;
+ divisorNeg = true;
+ }
+
+ if(bi1 < bi2) {
+ return quotient;
+ }
+
+ else {
+ if(bi2.dataLength == 1)
+ singleByteDivide(bi1, bi2, quotient, remainder);
+ else
+ multiByteDivide(bi1, bi2, quotient, remainder);
+
+ if(dividendNeg != divisorNeg)
+ return -quotient;
+
+ return quotient;
+ }
+ }
+
+ // Overloading of modulus operator
+ public static BigInteger operator % (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger(bi1);
+
+ int lastPos = maxLength-1;
+ bool dividendNeg = false;
+
+ if((bi1.data[lastPos] & 0x80000000) != 0) { // bi1 negative
+ bi1 = -bi1;
+ dividendNeg = true;
+ }
+ if((bi2.data[lastPos] & 0x80000000) != 0) // bi2 negative
+ bi2 = -bi2;
+
+ if(bi1 < bi2) {
+ return remainder;
+ }
+
+ else {
+ if(bi2.dataLength == 1)
+ singleByteDivide(bi1, bi2, quotient, remainder);
+ else
+ multiByteDivide(bi1, bi2, quotient, remainder);
+
+ if(dividendNeg)
+ return -remainder;
+
+ return remainder;
+ }
+ }
+
+ // Overloading of bitwise AND operator
+ public static BigInteger operator & (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger();
+
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ for(int i = 0; i < len; i++) {
+ uint sum = (uint)(bi1.data[i] & bi2.data[i]);
+ result.data[i] = sum;
+ }
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Overloading of bitwise OR operator
+ public static BigInteger operator | (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger();
+
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ for(int i = 0; i < len; i++) {
+ uint sum = (uint)(bi1.data[i] | bi2.data[i]);
+ result.data[i] = sum;
+ }
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Overloading of bitwise XOR operator
+ public static BigInteger operator ^ (BigInteger bi1, BigInteger bi2)
+ {
+ BigInteger result = new BigInteger();
+
+ int len = (bi1.dataLength > bi2.dataLength) ? bi1.dataLength : bi2.dataLength;
+
+ for(int i = 0; i < len; i++) {
+ uint sum = (uint)(bi1.data[i] ^ bi2.data[i]);
+ result.data[i] = sum;
+ }
+
+ result.dataLength = maxLength;
+
+ while(result.dataLength > 1 && result.data[result.dataLength-1] == 0)
+ result.dataLength--;
+
+ return result;
+ }
+
+ // Returns max(this, bi)
+ public BigInteger max (BigInteger bi)
+ {
+ if(this > bi)
+ return (new BigInteger(this));
+ else
+ return (new BigInteger(bi));
+ }
+
+ // Returns min(this, bi)
+ public BigInteger min (BigInteger bi)
+ {
+ if (this < bi)
+ return (new BigInteger (this));
+ else
+ return (new BigInteger (bi));
+ }
+
+ // Returns the absolute value
+ public BigInteger abs ()
+ {
+ if((this.data[maxLength - 1] & 0x80000000) != 0)
+ return (-this);
+ else
+ return (new BigInteger (this));
+ }
+
+ // Returns a string representing the BigInteger in base 10.
+ public override string ToString ()
+ {
+ return ToString (10);
+ }
+
+ // Returns a string representing the BigInteger in sign-and-magnitude
+ // format in the specified radix.
+ //
+ // Example
+ // -------
+ // If the value of BigInteger is -255 in base 10, then
+ // ToString(16) returns "-FF"
+ public string ToString (int radix)
+ {
+ if(radix < 2 || radix > 36)
+ throw (new ArgumentException("Radix must be >= 2 and <= 36"));
+
+ string charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ string result = "";
+
+ BigInteger a = this;
+
+ bool negative = false;
+ if((a.data[maxLength-1] & 0x80000000) != 0) {
+ negative = true;
+ try {
+ a = -a;
+ }
+ catch(Exception) {}
+ }
+
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger();
+ BigInteger biRadix = new BigInteger(radix);
+
+ if(a.dataLength == 1 && a.data[0] == 0)
+ result = "0";
+ else {
+ while(a.dataLength > 1 || (a.dataLength == 1 && a.data[0] != 0)) {
+ singleByteDivide(a, biRadix, quotient, remainder);
+
+ if(remainder.data[0] < 10)
+ result = remainder.data[0] + result;
+ else
+ result = charSet[(int)remainder.data[0] - 10] + result;
+
+ a = quotient;
+ }
+ if(negative)
+ result = "-" + result;
+ }
+
+ return result;
+ }
+
+
+ // Returns a hex string showing the contains of the BigInteger
+ //
+ // Examples
+ // -------
+ // 1) If the value of BigInteger is 255 in base 10, then
+ // ToHexString() returns "FF"
+ //
+ // 2) If the value of BigInteger is -255 in base 10, then
+ // ToHexString() returns ".....FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF01",
+ // which is the 2's complement representation of -255.
+ public string ToHexString ()
+ {
+ string result = data[dataLength - 1].ToString("X");
+
+ for(int i = dataLength - 2; i >= 0; i--) {
+ result += data[i].ToString("X8");
+ }
+
+ return result;
+ }
+
+ // Modulo Exponentiation
+ public BigInteger modPow(BigInteger exp, BigInteger n)
+ {
+ if((exp.data[maxLength-1] & 0x80000000) != 0)
+ throw (new ArithmeticException("Positive exponents only."));
+
+ BigInteger resultNum = 1;
+ BigInteger tempNum;
+ bool thisNegative = false;
+
+ if((this.data[maxLength-1] & 0x80000000) != 0) { // negative this
+ tempNum = -this % n;
+ thisNegative = true;
+ }
+ else
+ tempNum = this % n; // ensures (tempNum * tempNum) < b^(2k)
+
+ if((n.data[maxLength-1] & 0x80000000) != 0) // negative n
+ n = -n;
+
+ // calculate constant = b^(2k) / m
+ BigInteger constant = new BigInteger ();
+
+ int i = n.dataLength << 1;
+ constant.data[i] = 0x00000001;
+ constant.dataLength = i + 1;
+
+ constant = constant / n;
+ int totalBits = exp.bitCount ();
+ int count = 0;
+
+ // perform squaring and multiply exponentiation
+ for(int pos = 0; pos < exp.dataLength; pos++) {
+ uint mask = 0x01;
+ //Console.WriteLine("pos = " + pos);
+
+ for(int index = 0; index < 32; index++) {
+ if((exp.data[pos] & mask) != 0)
+ resultNum = BarrettReduction(resultNum * tempNum, n, constant);
+
+ mask <<= 1;
+
+ tempNum = BarrettReduction(tempNum * tempNum, n, constant);
+
+
+ if(tempNum.dataLength == 1 && tempNum.data[0] == 1) {
+ if(thisNegative && (exp.data[0] & 0x1) != 0) //odd exp
+ return -resultNum;
+ return resultNum;
+ }
+ count++;
+ if(count == totalBits)
+ break;
+ }
+ }
+
+ if(thisNegative && (exp.data[0] & 0x1) != 0) //odd exp
+ return -resultNum;
+
+ return resultNum;
+ }
+
+ // Fast calculation of modular reduction using Barrett's reduction.
+ // Requires x < b^(2k), where b is the base. In this case, base is
+ // 2^32 (uint).
+ // Reference [4]
+ private BigInteger BarrettReduction(BigInteger x, BigInteger n, BigInteger constant)
+ {
+ int k = n.dataLength,
+ kPlusOne = k+1,
+ kMinusOne = k-1;
+
+ BigInteger q1 = new BigInteger ();
+
+ // q1 = x / b^(k-1)
+ for(int i = kMinusOne, j = 0; i < x.dataLength; i++, j++)
+ q1.data[j] = x.data[i];
+ q1.dataLength = x.dataLength - kMinusOne;
+ if(q1.dataLength <= 0)
+ q1.dataLength = 1;
+
+
+ BigInteger q2 = q1 * constant;
+ BigInteger q3 = new BigInteger();
+
+ // q3 = q2 / b^(k+1)
+ for(int i = kPlusOne, j = 0; i < q2.dataLength; i++, j++)
+ q3.data[j] = q2.data[i];
+ q3.dataLength = q2.dataLength - kPlusOne;
+ if(q3.dataLength <= 0)
+ q3.dataLength = 1;
+
+ // r1 = x mod b^(k+1)
+ // i.e. keep the lowest (k+1) words
+ BigInteger r1 = new BigInteger();
+ int lengthToCopy = (x.dataLength > kPlusOne) ? kPlusOne : x.dataLength;
+ for(int i = 0; i < lengthToCopy; i++)
+ r1.data[i] = x.data[i];
+ r1.dataLength = lengthToCopy;
+
+ // r2 = (q3 * n) mod b^(k+1)
+ // partial multiplication of q3 and n
+
+ BigInteger r2 = new BigInteger();
+ for(int i = 0; i < q3.dataLength; i++) {
+ if(q3.data[i] == 0) continue;
+
+ ulong mcarry = 0;
+ int t = i;
+ for(int j = 0; j < n.dataLength && t < kPlusOne; j++, t++) {
+ // t = i + j
+ ulong val = ((ulong)q3.data[i] * (ulong)n.data[j]) +
+ (ulong)r2.data[t] + mcarry;
+
+ r2.data[t] = (uint)(val & 0xFFFFFFFF);
+ mcarry = (val >> 32);
+ }
+
+ if(t < kPlusOne)
+ r2.data[t] = (uint)mcarry;
+ }
+ r2.dataLength = kPlusOne;
+ while(r2.dataLength > 1 && r2.data[r2.dataLength-1] == 0)
+ r2.dataLength--;
+
+ r1 -= r2;
+ if((r1.data[maxLength-1] & 0x80000000) != 0) { // negative
+ BigInteger val = new BigInteger();
+ val.data[kPlusOne] = 0x00000001;
+ val.dataLength = kPlusOne + 1;
+ r1 += val;
+ }
+
+ while(r1 >= n)
+ r1 -= n;
+
+ return r1;
+ }
+
+ // Returns gcd(this, bi)
+ public BigInteger gcd(BigInteger bi)
+ {
+ BigInteger x;
+ BigInteger y;
+
+ if((data[maxLength-1] & 0x80000000) != 0) // negative
+ x = -this;
+ else
+ x = this;
+
+ if((bi.data[maxLength-1] & 0x80000000) != 0) // negative
+ y = -bi;
+ else
+ y = bi;
+
+ BigInteger g = y;
+
+ while(x.dataLength > 1 || (x.dataLength == 1 && x.data[0] != 0)) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+
+ return g;
+ }
+
+ // Populates "this" with the specified amount of random bits
+ public void genRandomBits (int bits)
+ {
+ genRandomBits (bits, new BigRandom ());
+ }
+
+ public void genRandomBits (int bits, BigRandom rng)
+ {
+ int dwords = bits >> 5;
+ int remBits = bits & 0x1F;
+
+ if (remBits != 0)
+ dwords++;
+
+ if (dwords > maxLength)
+ throw (new ArithmeticException("Number of required bits > maxLength."));
+
+ rng.Get (data);
+ for (int i = dwords; i < maxLength; i++)
+ data[i] = 0;
+
+ if (remBits != 0) {
+ uint mask = (uint)(0x01 << (remBits-1));
+ data[dwords-1] |= mask;
+
+ mask = (uint)(0xFFFFFFFF >> (32 - remBits));
+ data[dwords-1] &= mask;
+ }
+ else
+ data[dwords-1] |= 0x80000000;
+
+ dataLength = dwords;
+
+ if (dataLength == 0)
+ dataLength = 1;
+ }
+
+ // Returns the position of the most significant bit in the BigInteger.
+ // Eg. The result is 0, if the value of BigInteger is 0...0000 0000
+ // The result is 1, if the value of BigInteger is 0...0000 0001
+ // The result is 2, if the value of BigInteger is 0...0000 0010
+ // The result is 2, if the value of BigInteger is 0...0000 0011
+ public int bitCount ()
+ {
+ while(dataLength > 1 && data[dataLength-1] == 0)
+ dataLength--;
+
+ uint value = data[dataLength - 1];
+ uint mask = 0x80000000;
+ int bits = 32;
+
+ while(bits > 0 && (value & mask) == 0) {
+ bits--;
+ mask >>= 1;
+ }
+ bits += ((dataLength - 1) << 5);
+
+ return bits;
+ }
+
+ // Probabilistic prime test based on Fermat's little theorem
+ //
+ // for any a < p (p does not divide a) if
+ // a^(p-1) mod p != 1 then p is not prime.
+ //
+ // Otherwise, p is probably prime (pseudoprime to the chosen base).
+ //
+ // Returns
+ // -------
+ // True if "this" is a pseudoprime to randomly chosen
+ // bases. The number of chosen bases is given by the "confidence"
+ // parameter.
+ //
+ // False if "this" is definitely NOT prime.
+ //
+ // Note - this method is fast but fails for Carmichael numbers except
+ // when the randomly chosen base is a factor of the number.
+ public bool FermatLittleTest (int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = new BigInteger();
+ BigInteger p_sub1 = thisVal - (new BigInteger(1));
+
+ for(int round = 0; round < confidence; round++) {
+ bool done = false;
+
+ while(!done) { // generate a < n
+ int testBits = 0;
+
+ // make sure "a" has at least 2 bits
+ while(testBits < 2)
+ testBits = rng.GetInt (bits);
+
+ a.genRandomBits (testBits);
+
+ int byteLen = a.dataLength;
+
+ // make sure "a" is not 0
+ if(byteLen > 1 || (byteLen == 1 && a.data[0] != 1))
+ done = true;
+ }
+
+ // check whether a factor exists (fix for version 1.03)
+ BigInteger gcdTest = a.gcd(thisVal);
+ if(gcdTest.dataLength == 1 && gcdTest.data[0] != 1)
+ return false;
+
+ // calculate a^(p-1) mod p
+ BigInteger expResult = a.modPow(p_sub1, thisVal);
+
+ int resultLen = expResult.dataLength;
+
+ // is NOT prime is a^(p-1) mod p != 1
+
+ if(resultLen > 1 || (resultLen == 1 && expResult.data[0] != 1)) {
+ //Console.WriteLine("a = " + a.ToString());
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Probabilistic prime test based on Rabin-Miller's
+ //
+ // for any p > 0 with p - 1 = 2^s * t
+ //
+ // p is probably prime (strong pseudoprime) if for any a < p,
+ // 1) a^t mod p = 1 or
+ // 2) a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
+ //
+ // Otherwise, p is composite.
+ //
+ // Returns
+ // -------
+ // True if "this" is a strong pseudoprime to randomly chosen
+ // bases. The number of chosen bases is given by the "confidence"
+ // parameter.
+ //
+ // False if "this" is definitely NOT prime.
+ public bool RabinMillerTest(int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ // calculate values of s and t
+ BigInteger p_sub1 = thisVal - (new BigInteger(1));
+ int s = 0;
+
+ for(int index = 0; index < p_sub1.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((p_sub1.data[index] & mask) != 0) {
+ index = p_sub1.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = p_sub1 >> s;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = new BigInteger();
+
+ for(int round = 0; round < confidence; round++) {
+ bool done = false;
+
+ while(!done) { // generate a < n
+ int testBits = 0;
+
+ // make sure "a" has at least 2 bits
+ while(testBits < 2)
+ testBits = rng.GetInt (bits);
+
+ a.genRandomBits (testBits);
+
+ int byteLen = a.dataLength;
+
+ // make sure "a" is not 0
+ if(byteLen > 1 || (byteLen == 1 && a.data[0] != 1))
+ done = true;
+ }
+
+ // check whether a factor exists (fix for version 1.03)
+ BigInteger gcdTest = a.gcd(thisVal);
+ if(gcdTest.dataLength == 1 && gcdTest.data[0] != 1)
+ return false;
+
+ BigInteger b = a.modPow(t, thisVal);
+
+ /*
+ Console.WriteLine("a = " + a.ToString(10));
+ Console.WriteLine("b = " + b.ToString(10));
+ Console.WriteLine("t = " + t.ToString(10));
+ Console.WriteLine("s = " + s);
+ */
+
+ bool result = false;
+
+ if(b.dataLength == 1 && b.data[0] == 1) // a^t mod p = 1
+ result = true;
+
+ for(int j = 0; result == false && j < s; j++) {
+ if(b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
+ result = true;
+ break;
+ }
+
+ b = (b * b) % thisVal;
+ }
+
+ if(result == false)
+ return false;
+ }
+ return true;
+ }
+
+ // Probabilistic prime test based on Solovay-Strassen (Euler Criterion)
+ //
+ // p is probably prime if for any a < p (a is not multiple of p),
+ // a^((p-1)/2) mod p = J(a, p)
+ //
+ // where J is the Jacobi symbol.
+ //
+ // Otherwise, p is composite.
+ //
+ // Returns
+ // -------
+ // True if "this" is a Euler pseudoprime to randomly chosen
+ // bases. The number of chosen bases is given by the "confidence"
+ // parameter.
+ //
+ // False if "this" is definitely NOT prime.
+ public bool SolovayStrassenTest(int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = new BigInteger();
+ BigInteger p_sub1 = thisVal - 1;
+ BigInteger p_sub1_shift = p_sub1 >> 1;
+
+ for(int round = 0; round < confidence; round++) {
+ bool done = false;
+
+ while(!done) { // generate a < n
+ int testBits = 0;
+
+ // make sure "a" has at least 2 bits
+ while(testBits < 2)
+ testBits = rng.GetInt (bits);
+
+ a.genRandomBits (testBits);
+
+ int byteLen = a.dataLength;
+
+ // make sure "a" is not 0
+ if(byteLen > 1 || (byteLen == 1 && a.data[0] != 1))
+ done = true;
+ }
+
+ // check whether a factor exists (fix for version 1.03)
+ BigInteger gcdTest = a.gcd(thisVal);
+ if(gcdTest.dataLength == 1 && gcdTest.data[0] != 1)
+ return false;
+
+ // calculate a^((p-1)/2) mod p
+
+ BigInteger expResult = a.modPow(p_sub1_shift, thisVal);
+ if(expResult == p_sub1)
+ expResult = -1;
+
+ // calculate Jacobi symbol
+ BigInteger jacob = Jacobi(a, thisVal);
+
+ //Console.WriteLine("a = " + a.ToString(10) + " b = " + thisVal.ToString(10));
+ //Console.WriteLine("expResult = " + expResult.ToString(10) + " Jacob = " + jacob.ToString(10));
+
+ // if they are different then it is not prime
+ if(expResult != jacob)
+ return false;
+ }
+
+ return true;
+ }
+
+ // Implementation of the Lucas Strong Pseudo Prime test.
+ //
+ // Let n be an odd number with gcd(n,D) = 1, and n - J(D, n) = 2^s * d
+ // with d odd and s >= 0.
+ //
+ // If Ud mod n = 0 or V2^r*d mod n = 0 for some 0 <= r < s, then n
+ // is a strong Lucas pseudoprime with parameters (P, Q). We select
+ // P and Q based on Selfridge.
+ //
+ // Returns True if number is a strong Lucus pseudo prime.
+ // Otherwise, returns False indicating that number is composite.
+ public bool LucasStrongTest()
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ return LucasStrongTestHelper(thisVal);
+ }
+
+ private bool LucasStrongTestHelper(BigInteger thisVal)
+ {
+ // Do the test (selects D based on Selfridge)
+ // Let D be the first element of the sequence
+ // 5, -7, 9, -11, 13, ... for which J(D,n) = -1
+ // Let P = 1, Q = (1-D) / 4
+
+ long D = 5, sign = -1, dCount = 0;
+ bool done = false;
+
+ while(!done) {
+ int Jresult = BigInteger.Jacobi(D, thisVal);
+
+ if(Jresult == -1)
+ done = true; // J(D, this) = 1
+ else {
+ if(Jresult == 0 && System.Math.Abs(D) < thisVal) // divisor found
+ return false;
+
+ if(dCount == 20) {
+ // check for square
+ BigInteger root = thisVal.sqrt();
+ if(root * root == thisVal)
+ return false;
+ }
+
+ //Console.WriteLine(D);
+ D = (System.Math.Abs(D) + 2) * sign;
+ sign = -sign;
+ }
+ dCount++;
+ }
+
+ long Q = (1 - D) >> 2;
+
+ /*
+ Console.WriteLine("D = " + D);
+ Console.WriteLine("Q = " + Q);
+ Console.WriteLine("(n,D) = " + thisVal.gcd(D));
+ Console.WriteLine("(n,Q) = " + thisVal.gcd(Q));
+ Console.WriteLine("J(D|n) = " + BigInteger.Jacobi(D, thisVal));
+ */
+
+ BigInteger p_add1 = thisVal + 1;
+ int s = 0;
+
+ for(int index = 0; index < p_add1.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((p_add1.data[index] & mask) != 0) {
+ index = p_add1.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = p_add1 >> s;
+
+ // calculate constant = b^(2k) / m
+ // for Barrett Reduction
+ BigInteger constant = new BigInteger();
+
+ int nLen = thisVal.dataLength << 1;
+ constant.data[nLen] = 0x00000001;
+ constant.dataLength = nLen + 1;
+
+ constant = constant / thisVal;
+
+ BigInteger[] lucas = LucasSequenceHelper(1, Q, t, thisVal, constant, 0);
+ bool isPrime = false;
+
+ if((lucas[0].dataLength == 1 && lucas[0].data[0] == 0) ||
+ (lucas[1].dataLength == 1 && lucas[1].data[0] == 0)) {
+ // u(t) = 0 or V(t) = 0
+ isPrime = true;
+ }
+
+ for(int i = 1; i < s; i++) {
+ if(!isPrime) {
+ // doubling of index
+ lucas[1] = thisVal.BarrettReduction(lucas[1] * lucas[1], thisVal, constant);
+ lucas[1] = (lucas[1] - (lucas[2] << 1)) % thisVal;
+
+ //lucas[1] = ((lucas[1] * lucas[1]) - (lucas[2] << 1)) % thisVal;
+
+ if((lucas[1].dataLength == 1 && lucas[1].data[0] == 0))
+ isPrime = true;
+ }
+
+ lucas[2] = thisVal.BarrettReduction(lucas[2] * lucas[2], thisVal, constant); //Q^k
+ }
+
+
+ if(isPrime) { // additional checks for composite numbers
+ // If n is prime and gcd(n, Q) == 1, then
+ // Q^((n+1)/2) = Q * Q^((n-1)/2) is congruent to (Q * J(Q, n)) mod n
+
+ BigInteger g = thisVal.gcd(Q);
+ if(g.dataLength == 1 && g.data[0] == 1) { // gcd(this, Q) == 1
+ if((lucas[2].data[maxLength-1] & 0x80000000) != 0)
+ lucas[2] += thisVal;
+
+ BigInteger temp = (Q * BigInteger.Jacobi(Q, thisVal)) % thisVal;
+ if((temp.data[maxLength-1] & 0x80000000) != 0)
+ temp += thisVal;
+
+ if(lucas[2] != temp)
+ isPrime = false;
+ }
+ }
+
+ return isPrime;
+ }
+
+ // Determines whether a number is probably prime, using the Rabin-Miller's
+ // test. Before applying the test, the number is tested for divisibility
+ // by primes < 2000
+ //
+ // Returns true if number is probably prime.
+ public bool isProbablePrime(int confidence)
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+
+ // test for divisibility by primes < 2000
+ for(int p = 0; p < primesBelow2000.Length; p++) {
+ BigInteger divisor = primesBelow2000[p];
+
+ if(divisor >= thisVal)
+ break;
+
+ BigInteger resultNum = thisVal % divisor;
+ if(resultNum.IntValue() == 0) {
+ /*
+ Console.WriteLine("Not prime! Divisible by {0}\n",
+ primesBelow2000[p]);
+ */
+ return false;
+ }
+ }
+
+ if(thisVal.RabinMillerTest(confidence))
+ return true;
+ else {
+ //Console.WriteLine("Not prime! Failed primality test\n");
+ return false;
+ }
+ }
+
+ // Determines whether this BigInteger is probably prime using a
+ // combination of base 2 strong pseudoprime test and Lucas strong
+ // pseudoprime test.
+ //
+ // The sequence of the primality test is as follows,
+ //
+ // 1) Trial divisions are carried out using prime numbers below 2000.
+ // if any of the primes divides this BigInteger, then it is not prime.
+ //
+ // 2) Perform base 2 strong pseudoprime test. If this BigInteger is a
+ // base 2 strong pseudoprime, proceed on to the next step.
+ //
+ // 3) Perform strong Lucas pseudoprime test.
+ //
+ // Returns True if this BigInteger is both a base 2 strong pseudoprime
+ // and a strong Lucas pseudoprime.
+ //
+ // For a detailed discussion of this primality test, see [6].
+ public bool isProbablePrime()
+ {
+ BigInteger thisVal;
+ if((this.data[maxLength-1] & 0x80000000) != 0) // negative
+ thisVal = -this;
+ else
+ thisVal = this;
+
+ if(thisVal.dataLength == 1) {
+ // test small numbers
+ if(thisVal.data[0] == 0 || thisVal.data[0] == 1)
+ return false;
+ else if(thisVal.data[0] == 2 || thisVal.data[0] == 3)
+ return true;
+ }
+
+ if((thisVal.data[0] & 0x1) == 0) // even numbers
+ return false;
+
+ // test for divisibility by primes < 2000
+ for(int p = 0; p < primesBelow2000.Length; p++) {
+ BigInteger divisor = primesBelow2000[p];
+
+ if(divisor >= thisVal)
+ break;
+
+ BigInteger resultNum = thisVal % divisor;
+ if(resultNum.IntValue() == 0) {
+ //Console.WriteLine("Not prime! Divisible by {0}\n",
+ // primesBelow2000[p]);
+
+ return false;
+ }
+ }
+
+ // Perform BASE 2 Rabin-Miller Test
+
+ // calculate values of s and t
+ BigInteger p_sub1 = thisVal - (new BigInteger(1));
+ int s = 0;
+
+ for(int index = 0; index < p_sub1.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((p_sub1.data[index] & mask) != 0) {
+ index = p_sub1.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = p_sub1 >> s;
+
+ int bits = thisVal.bitCount();
+ BigInteger a = 2;
+
+ // b = a^t mod p
+ BigInteger b = a.modPow(t, thisVal);
+ bool result = false;
+
+ if(b.dataLength == 1 && b.data[0] == 1) // a^t mod p = 1
+ result = true;
+
+ for(int j = 0; result == false && j < s; j++) {
+ if(b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
+ result = true;
+ break;
+ }
+
+ b = (b * b) % thisVal;
+ }
+
+ // if number is strong pseudoprime to base 2, then do a strong lucas test
+ if(result)
+ result = LucasStrongTestHelper(thisVal);
+
+ return result;
+ }
+
+ // Returns the lowest 4 bytes of the BigInteger as an int.
+ public int IntValue ()
+ {
+ return (int)data[0];
+ }
+
+ // Returns the lowest 8 bytes of the BigInteger as a long.
+ public long LongValue ()
+ {
+ long val = 0;
+
+ val = (long)data[0];
+ try {
+ // exception if maxLength = 1
+ val |= (long)data[1] << 32;
+ }
+ catch(Exception) {
+ if((data[0] & 0x80000000) != 0) // negative
+ val = (int)data[0];
+ }
+
+ return val;
+ }
+
+ // Computes the Jacobi Symbol for a and b.
+ // Algorithm adapted from [3] and [4] with some optimizations
+ public static int Jacobi (BigInteger a, BigInteger b)
+ {
+ // Jacobi defined only for odd integers
+ if((b.data[0] & 0x1) == 0)
+ throw (new ArgumentException("Jacobi defined only for odd integers."));
+
+ if(a >= b) a %= b;
+ if(a.dataLength == 1 && a.data[0] == 0) return 0; // a == 0
+ if(a.dataLength == 1 && a.data[0] == 1) return 1; // a == 1
+
+ if(a < 0) {
+ if( (((b-1).data[0]) & 0x2) == 0) //if( (((b-1) >> 1).data[0] & 0x1) == 0)
+ return Jacobi(-a, b);
+ else
+ return -Jacobi(-a, b);
+ }
+
+ int e = 0;
+ for(int index = 0; index < a.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((a.data[index] & mask) != 0) {
+ index = a.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ e++;
+ }
+ }
+
+ BigInteger a1 = a >> e;
+
+ int s = 1;
+ if((e & 0x1) != 0 && ((b.data[0] & 0x7) == 3 || (b.data[0] & 0x7) == 5))
+ s = -1;
+
+ if((b.data[0] & 0x3) == 3 && (a1.data[0] & 0x3) == 3)
+ s = -s;
+
+ if(a1.dataLength == 1 && a1.data[0] == 1)
+ return s;
+ else
+ return (s * Jacobi(b % a1, a1));
+ }
+
+ // Generates a positive BigInteger that is probably prime.
+ public static BigInteger genPseudoPrime (int bits, int confidence)
+ {
+ BigInteger result = new BigInteger ();
+ bool done = false;
+
+ while (!done) {
+ result.genRandomBits (bits);
+ result.data[0] |= 0x01; // make it odd
+ // prime test
+ done = result.isProbablePrime(confidence);
+ }
+ return result;
+ }
+
+ // Generates a random number with the specified number of bits such
+ // that gcd(number, this) = 1
+ public BigInteger genCoPrime (int bits)
+ {
+ bool done = false;
+ BigInteger result = new BigInteger ();
+
+ while(!done) {
+ result.genRandomBits (bits);
+ //Console.WriteLine(result.ToString(16));
+
+ // gcd test
+ BigInteger g = result.gcd(this);
+ if (g.dataLength == 1 && g.data[0] == 1)
+ done = true;
+ }
+
+ return result;
+ }
+
+ // Returns the modulo inverse of this. Throws ArithmeticException if
+ // the inverse does not exist. (i.e. gcd(this, modulus) != 1)
+ public BigInteger modInverse (BigInteger modulus)
+ {
+ BigInteger[] p = { 0, 1 };
+ BigInteger[] q = new BigInteger[2]; // quotients
+ BigInteger[] r = { 0, 0 }; // remainders
+
+ int step = 0;
+
+ BigInteger a = modulus;
+ BigInteger b = this;
+
+ while(b.dataLength > 1 || (b.dataLength == 1 && b.data[0] != 0)) {
+ BigInteger quotient = new BigInteger();
+ BigInteger remainder = new BigInteger();
+
+ if(step > 1) {
+ BigInteger pval = (p[0] - (p[1] * q[0])) % modulus;
+ p[0] = p[1];
+ p[1] = pval;
+ }
+
+ if(b.dataLength == 1)
+ singleByteDivide(a, b, quotient, remainder);
+ else
+ multiByteDivide(a, b, quotient, remainder);
+
+ /*
+ Console.WriteLine(quotient.dataLength);
+ Console.WriteLine("{0} = {1}({2}) + {3} p = {4}", a.ToString(10),
+ b.ToString(10), quotient.ToString(10), remainder.ToString(10),
+ p[1].ToString(10));
+ */
+
+ q[0] = q[1];
+ r[0] = r[1];
+ q[1] = quotient; r[1] = remainder;
+
+ a = b;
+ b = remainder;
+
+ step++;
+ }
+
+ if(r[0].dataLength > 1 || (r[0].dataLength == 1 && r[0].data[0] != 1))
+ throw (new ArithmeticException("No inverse!"));
+
+ BigInteger result = ((p[0] - (p[1] * q[0])) % modulus);
+
+ if((result.data[maxLength - 1] & 0x80000000) != 0)
+ result += modulus; // get the least positive modulus
+
+ return result;
+ }
+
+ // Returns the value of the BigInteger as a byte array. The lowest
+ // index contains the MSB.
+ public byte[] getBytes()
+ {
+ int numBits = bitCount();
+ byte[] result = null;
+ if(numBits == 0) {
+ result = new byte[1];
+ result[0] = 0;
+ }
+ else {
+ int numBytes = numBits >> 3;
+ if((numBits & 0x7) != 0)
+ numBytes++;
+ result = new byte[numBytes];
+ //Console.WriteLine(result.Length);
+ int numBytesInWord = numBytes & 0x3;
+ if(numBytesInWord == 0)
+ numBytesInWord = 4;
+ int pos = 0;
+ for(int i = dataLength - 1; i >= 0; i--) {
+ uint val = data[i];
+ for(int j = numBytesInWord - 1; j >= 0; j--) {
+ result[pos+j] = (byte)(val & 0xFF);
+ val >>= 8;
+ }
+ pos += numBytesInWord;
+ numBytesInWord = 4;
+ }
+ }
+ return result;
+ }
+
+ // Return true if the value of the specified bit is 1, false otherwise
+ public bool testBit (uint bitNum)
+ {
+ uint bytePos = bitNum >> 5; // divide by 32
+ byte bitPos = (byte)(bitNum & 0x1F); // get the lowest 5 bits
+
+ uint mask = (uint)1 << bitPos;
+ return ((this.data[bytePos] | mask) == this.data[bytePos]);
+ }
+
+ // Sets the value of the specified bit to 1
+ // The Least Significant Bit position is 0.
+ public void setBit(uint bitNum)
+ {
+ uint bytePos = bitNum >> 5; // divide by 32
+ byte bitPos = (byte)(bitNum & 0x1F); // get the lowest 5 bits
+
+ uint mask = (uint)1 << bitPos;
+ this.data[bytePos] |= mask;
+
+ if(bytePos >= this.dataLength)
+ this.dataLength = (int)bytePos + 1;
+ }
+
+ // Sets the value of the specified bit to 0
+ // The Least Significant Bit position is 0.
+ public void unsetBit(uint bitNum)
+ {
+ uint bytePos = bitNum >> 5;
+
+ if(bytePos < this.dataLength) {
+ byte bitPos = (byte)(bitNum & 0x1F);
+
+ uint mask = (uint)1 << bitPos;
+ uint mask2 = 0xFFFFFFFF ^ mask;
+
+ this.data[bytePos] &= mask2;
+
+ if(this.dataLength > 1 && this.data[this.dataLength - 1] == 0)
+ this.dataLength--;
+ }
+ }
+
+ // Returns a value that is equivalent to the integer square root
+ // of the BigInteger.
+ // The integer square root of "this" is defined as the largest integer n
+ // such that (n * n) <= this
+ public BigInteger sqrt ()
+ {
+ uint numBits = (uint)this.bitCount();
+
+ if((numBits & 0x1) != 0) // odd number of bits
+ numBits = (numBits >> 1) + 1;
+ else
+ numBits = (numBits >> 1);
+
+ uint bytePos = numBits >> 5;
+ byte bitPos = (byte)(numBits & 0x1F);
+
+ uint mask;
+
+ BigInteger result = new BigInteger();
+ if(bitPos == 0)
+ mask = 0x80000000;
+ else {
+ mask = (uint)1 << bitPos;
+ bytePos++;
+ }
+ result.dataLength = (int)bytePos;
+
+ for(int i = (int)bytePos - 1; i >= 0; i--) {
+ while(mask != 0) {
+ // guess
+ result.data[i] ^= mask;
+
+ // undo the guess if its square is larger than this
+ if((result * result) > this)
+ result.data[i] ^= mask;
+
+ mask >>= 1;
+ }
+ mask = 0x80000000;
+ }
+ return result;
+ }
+
+ // Returns the k_th number in the Lucas Sequence reduced modulo n.
+ //
+ // Uses index doubling to speed up the process. For example, to calculate V(k),
+ // we maintain two numbers in the sequence V(n) and V(n+1).
+ //
+ // To obtain V(2n), we use the identity
+ // V(2n) = (V(n) * V(n)) - (2 * Q^n)
+ // To obtain V(2n+1), we first write it as
+ // V(2n+1) = V((n+1) + n)
+ // and use the identity
+ // V(m+n) = V(m) * V(n) - Q * V(m-n)
+ // Hence,
+ // V((n+1) + n) = V(n+1) * V(n) - Q^n * V((n+1) - n)
+ // = V(n+1) * V(n) - Q^n * V(1)
+ // = V(n+1) * V(n) - Q^n * P
+ //
+ // We use k in its binary expansion and perform index doubling for each
+ // bit position. For each bit position that is set, we perform an
+ // index doubling followed by an index addition. This means that for V(n),
+ // we need to update it to V(2n+1). For V(n+1), we need to update it to
+ // V((2n+1)+1) = V(2*(n+1))
+ //
+ // This function returns
+ // [0] = U(k)
+ // [1] = V(k)
+ // [2] = Q^n
+ //
+ // Where U(0) = 0 % n, U(1) = 1 % n
+ // V(0) = 2 % n, V(1) = P % n
+ public static BigInteger[] LucasSequence (BigInteger P, BigInteger Q,
+ BigInteger k, BigInteger n)
+ {
+ if(k.dataLength == 1 && k.data[0] == 0) {
+ BigInteger[] result = new BigInteger[3];
+
+ result[0] = 0; result[1] = 2 % n; result[2] = 1 % n;
+ return result;
+ }
+
+ // calculate constant = b^(2k) / m
+ // for Barrett Reduction
+ BigInteger constant = new BigInteger();
+
+ int nLen = n.dataLength << 1;
+ constant.data[nLen] = 0x00000001;
+ constant.dataLength = nLen + 1;
+
+ constant = constant / n;
+
+ // calculate values of s and t
+ int s = 0;
+
+ for(int index = 0; index < k.dataLength; index++) {
+ uint mask = 0x01;
+
+ for(int i = 0; i < 32; i++) {
+ if((k.data[index] & mask) != 0) {
+ index = k.dataLength; // to break the outer loop
+ break;
+ }
+ mask <<= 1;
+ s++;
+ }
+ }
+
+ BigInteger t = k >> s;
+
+ //Console.WriteLine("s = " + s + " t = " + t);
+ return LucasSequenceHelper(P, Q, t, n, constant, s);
+ }
+
+ // Performs the calculation of the kth term in the Lucas Sequence.
+ // For details of the algorithm, see reference [9].
+ // k must be odd. i.e LSB == 1
+ private static BigInteger[] LucasSequenceHelper(BigInteger P, BigInteger Q,
+ BigInteger k, BigInteger n, BigInteger constant, int s)
+ {
+ BigInteger[] result = new BigInteger[3];
+
+ if((k.data[0] & 0x00000001) == 0)
+ throw (new ArgumentException("Argument k must be odd."));
+
+ int numbits = k.bitCount();
+ uint mask = (uint)0x1 << ((numbits & 0x1F) - 1);
+
+ // v = v0, v1 = v1, u1 = u1, Q_k = Q^0
+
+ BigInteger v = 2 % n, Q_k = 1 % n,
+ v1 = P % n, u1 = Q_k;
+ bool flag = true;
+
+ for(int i = k.dataLength - 1; i >= 0 ; i--) { // iterate on the binary expansion of k
+ //Console.WriteLine("round");
+ while(mask != 0) {
+ if(i == 0 && mask == 0x00000001) // last bit
+ break;
+
+ if((k.data[i] & mask) != 0) { // bit is set
+ // index doubling with addition
+
+ u1 = (u1 * v1) % n;
+
+ v = ((v * v1) - (P * Q_k)) % n;
+ v1 = n.BarrettReduction(v1 * v1, n, constant);
+ v1 = (v1 - ((Q_k * Q) << 1)) % n;
+
+ if(flag)
+ flag = false;
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+
+ Q_k = (Q_k * Q) % n;
+ }
+ else {
+ // index doubling
+ u1 = ((u1 * v) - Q_k) % n;
+
+ v1 = ((v * v1) - (P * Q_k)) % n;
+ v = n.BarrettReduction(v * v, n, constant);
+ v = (v - (Q_k << 1)) % n;
+
+ if(flag) {
+ Q_k = Q % n;
+ flag = false;
+ }
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+ }
+
+ mask >>= 1;
+ }
+ mask = 0x80000000;
+ }
+
+ // at this point u1 = u(n+1) and v = v(n)
+ // since the last bit always 1, we need to transform u1 to u(2n+1) and v to v(2n+1)
+
+ u1 = ((u1 * v) - Q_k) % n;
+ v = ((v * v1) - (P * Q_k)) % n;
+ if(flag)
+ flag = false;
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+
+ Q_k = (Q_k * Q) % n;
+
+
+ for (int i = 0; i < s; i++) {
+ // index doubling
+ u1 = (u1 * v) % n;
+ v = ((v * v) - (Q_k << 1)) % n;
+
+ if(flag) {
+ Q_k = Q % n;
+ flag = false;
+ }
+ else
+ Q_k = n.BarrettReduction(Q_k * Q_k, n, constant);
+ }
+
+ result[0] = u1;
+ result[1] = v;
+ result[2] = Q_k;
+
+ return result;
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
new file mode 100644
index 00000000000..28d45365de1
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
@@ -0,0 +1,483 @@
+2003-01-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CipherMode.cs: Added missing [Serializable] to enum.
+ * CspProviderFlags.cs: Added missing [Serializable] to enum.
+ * FromBase64Transform.cs: Added missing [Serializable] to enum.
+ * PaddingMode.cs: Added missing [Serializable] to enum.
+
+2003-01-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoTools.cs: Added internal class BlockProcessor to help
+ implementation of block-based algorithms (like MAC and HMAC).
+ * HMACSHA1.cs: Refactored to remove dependencies on CryptoStream,
+ better constructors and Dispose support.
+ * MACTripleDES.cs: Refactored to reuse new HMACSHA1 stuff, better
+ constructors.
+
+2003-01-18 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * HMACSHA1.cs: Now use KeyBuilder to build the default key.
+
+2003-01-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * MACTripleDES.cs: Now working (the problem was with my stream usage
+ which was removed for performance reason).
+ * TripleDES.cs: Fixed key generation (wasn't called and returned
+ null).
+
+2003-01-09 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * RNGCryptoServiceProvider.cs: Changed methods interacting with
+ the runtime as Internal<MethodName>. This will allow to make the
+ class Windows-compatible by doing a switch at runtime.
+
+2003-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoAPITransform.cs: Removed all TODO. This class will not be
+ used by Mono. MS uses it with <algo>CryptoServiceProvider classes
+ to provide a common ICryptoTransform access to CryptoAPI.
+
+2003-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * RC2CryptoServiceProvider.cs: Now about 2 time faster by inlining
+ methods and changing to UInt16 (instead of UInt32).
+
+2003-01-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * RijndaelManaged.cs: Now 7 (encrypt) to 10 (decrypt) times faster
+ by removing allocation inside intensively called methods, using pre-
+ calculated tables instead of Mult_GF methods and inlining most methods.
+
+2002-12-31 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AsymmetricAlgorithm.cs: Removed ValidKeySize (method only present
+ in SymmetricAlgorithm).
+ * DSA.cs: Change ZeroizePrivateKey from protected to internal.
+ * DSACryptoServiceProvider.cs: Added some case where we need to check
+ for keypairGenerated.
+ * RSA.cs: Change ZeroizePrivateKey from protected to internal.
+ * RSACryptoServiceProvider.cs: Key were never generated with the default
+ (no parameter) constructor. Now checks for keypairGenerated in methods.
+ * SignatureDescription.cs: Added CreateDeformatter in RSAPKCS1SHA1-
+ SignatureDescription to please corcompare (it just call it's ancestor).
+
+2002-12-30 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoStream.cs: Implemented core. Not sure about many details -
+ but it run the samples now (#30256).
+ * CryptoStreamMode.cs: Added [Serializable] to enum declaration.
+ * SymmetricAlgorithm.cs: Made some changes required for CryptoStream
+ and to match more closely MS implementation. Also added little
+ optimizations in TransformBlock.
+
+2002-12-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoTools.cs: New. Shared classes for cryptography. Now
+ includes a KeyBuilder to generate symmetric keys and IV.
+ * DES.cs: Modified Key validation.
+ * DESCryptoServiceProvider.cs: Implemented Key and IV using
+ KeyBuilder.
+ * RC2CryptoServiceProvider.cs: Implemented Key and IV using
+ KeyBuilder (and removed TODO).
+ * RijndaelManaged.cs: Implemented Key and IV using KeyBuilder
+ (and removed TODO).
+ * SHA384Managed.cs: Changed code to remove compiler warning.
+ * SHA512Managed.cs: Changed code to remove compiler warning.
+ * SymmetricAlgorithm.cs: Removed TODO on IV.
+ * TripleDESCryptoServiceProvider.cs: Implemented Key and IV
+ using KeyBuilder (and removed TODO).
+
+2002-11-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AsymmetricSignatureDeformatter.cs: Added exception handling in
+ VerifySignature (moved from RSAPKCS1SignatureDeformatter).
+ * AsymmetricSignatureFormatter.cs: Added exception handling in
+ CreateSignature (moved from RSAPKCS1SignatureFormatter).
+ * CryptoAPITransform.cs: Removed "= false" assignation from a private
+ member (because this created an unwanted "ghost" constructor) and
+ modified Dispose declaration.
+ * HashAlgorithm.cs: Removed destructor. Disposing unmanaged
+ ressources is the responsability of each class (not an abstract class).
+ * RSAPKCS1SignatureDeformatter.cs: Removed a VerifySignature method
+ which was present in the base class AsymmetricSignatureDeformatter.
+ * RSAPKCS1SignatureFormatter.cs: Removed a CreateSignature method
+ which was present in the base class AsymmetricSignatureFormatter.
+ * SHA1Managed.cs: Removed sealed from class declaration. Removed
+ destructor and Dispose method as class is fully managed.
+ * ToBase64Transform.cs: Added virtual to property CanReuseTransform.
+
+2002-11-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoConfig.cs: Added full classes name for MapNameToOID.
+ * PKCS1.cs: New. Internal class for the various primitives defined
+ in PKCS#1 v.2.1.
+ * PKCS1MaskGenerationFunction.cs: Modified to use PKCS1.cs.
+ * RSA.cs: Added internal class RSAHandler (which implements IHandler
+ interface for MiniParser) to import RSA keypairs from XML strings.
+ * RSACryptoServiceProvider.cs: Crypto implemented using BigInteger.
+ Key generation is VERY LONG.
+ * RSAOAEPKeyExchangeDeformatter.cs: Completed using PKCS1. Not sure
+ of the results as this is not available in all versions of Windows.
+ * RSAOAEPKeyExchangeFormatter.cs: Completed using PKCS1. Not sure
+ of the results as this is not available in all versions of Windows.
+ * RSAPKCS1KeyExchangeDeformatter.cs: Completed using PKCS1.
+ * RSAPKCS1KeyExchangeFormatter.cs: Completed using PKCS1.
+ * RSAPKCS1SignatureDeformatter.cs: Completed using PKCS1.
+ * RSAPKCS1SignatureFormatter.cs: Completed using PKCS1.
+
+2002-11-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * MiniParser.cs: Added explicit cast in order to compile with mcs.
+
+2002-11-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AsymmetricAlgorithm.cs: Added internal class AsymmetricParameters
+ (which implements the IReader interface for MiniParser). Corrected
+ Dispose declaration.
+ * BigInteger.cs: New. Internal class for handling BIG integers for
+ asymmetric crypto (both RSA and DSA). Thanks to Chew Keong TAN !
+ * CryptoConfig.cs: Added XMLDSIG URLs in CreateFromName.
+ Will dynamically load System.Security.dll, when required,
+ to return instance of those classes. Also CryptoConfig can now
+ create any object (e.g. System.IO.MemoryStream) !
+ * DSA.cs: Added internal class DSAHandler (which implements IHandler
+ interface for MiniParser) to import DSA keypairs from XML strings.
+ * DSACryptoServiceProvider.cs: Crypto fully implemented using
+ BigInteger. Key generation (group) is VERY long.
+ * MiniParser.cs: New. Minimal XML parser by Sergey Chaban. Used to
+ import keypairs in XML strings.
+ * SignatureDescription.cs: Removed local CreateFromName (to use
+ CryptoConfig - which actually can create anything). Added internal
+ classes DSASignatureDescription and RSAPKCS1SHA1SignatureDescription.
+
+2002-11-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptographicUnexpectedOperationException.cs: Forgot it last time!
+ * FromBase64Transform.cs: Added missing virtual to CanReuseTransform.
+ Changed Dispose().
+ * HashAlgorithm.cs: Changed Dispose().
+ * MD5CryptoServiceProvider.cs: Added destructor and Dipose(bool).
+ * PasswordDeriveBytes.cs: Changed some declaration from
+ protected to private.
+ * RC2.cs: Added valid keysize check in EffectiveKeySize.
+ * RC2CryptoServiceProvider.cs: Overriden EffectiveKeySize to match
+ corlib declarations.
+ * RSAOAEPKeyExchangeDeformatter.cs: Changed some declaration from
+ protected to private.
+ * RSAOAEPKeyExchangeFormatter.cs: Changed some declaration from
+ protected to private.
+ * RSAPKCS1KeyExchangeDeformatter.cs: Changed some declaration from
+ protected to private.
+ * RSAPKCS1KeyExchangeFormatter.cs: Changed some declaration from
+ protected to private.
+ * RSAPKCS1SignatureDeformatter.cs: Changed some declaration from
+ protected to private.
+ * RSAPKCS1SignatureFormatter.cs: Changed some declaration from
+ protected to private.
+ * SHA1CryptoServiceProvider.cs: Moved SHA1 code to SHA1Internal.
+ SHA1CryptoServiceProvider now use SHA1Internal. Added Dispose and
+ destructor.
+ * SHA1Managed.cs: New. Use SHA1Internal. Same as
+ SHA1CryptoServiceProvider but is required for binary compatibility.
+ * SHA256Managed.cs: Changed some declaration from protected to private.
+ * SHA384Managed.cs: Changed some declaration from protected to private.
+ * SHA512Managed.cs: Changed some declaration from protected to private.
+ * SymmetricAlgorithm.cs: Added Clear(), changed Dispose() and added
+ virtual to Dispose(bool).
+ * ToBase64Transform.cs: Added missing virtual to CanReuseTransform.
+ Changed Dispose().
+ * TripleDESCryptoServiceProvider.cs: Added missing sealed to class
+ declaration.
+
+2002-11-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoAPITransform.cs: Added missing CanReuseTransform property,
+ Clear method, destructor and IDisposable support.
+ * CryptographicException.cs: Added missing protected constructor.
+ * CryptographicUnexpectedOperationException.cs: Added missing
+ protected constructor.
+ * ICryptoTransform.cs: Added missing CanReuseTransform property.
+ * FromBase64Transform.cs: Added missing CanReuseTransform property,
+ Clear method, destructor and IDisposable support.
+ * SymmetricAlgorithm.cs: Implement IDisposable.
+ * ToBase64Transform.cs: Added missing CanReuseTransform property,
+ Clear method, destructor and IDisposable support.
+
+2002-11-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SignatureDescription.cs: Updated class to match unit test results
+ * X509Certificate.cs: REMOVED! Wrong namespace. An almost complete
+ implementation is now in System.Security.Cryptography.X509Certificates
+
+2002-11-01 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * bouncycastle.txt: Bouncy Castle JCE License.
+ * SHA384Managed.cs: Hash implementation based on BouncyCastle JCE.
+ * SHA512Managed.cs: Hash implementation based on BouncyCastle JCE.
+
+2002-10-30 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DSASignatureDeformatter.cs: Fully implemented - however it
+ requires a functionnal DSA implementation to work.
+ * DSASignatureFormatter.cs: Fully implemented - however it
+ requires a functionnal DSA implementation to work.
+
+2002-10-25 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * PasswordDeriveBytes.cs: New. PKCS#5 key derivation (PBKDF1) works up to
+ HashSize length (but MS support longer keys)
+
+2002-10-24 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * RSACryptoServiceProvider.cs: New. Implemented most logic expect crypto
+ * RSAOAEPKeyExchangeDeformatter.cs: New. Stub.
+ * RSAOAEPKeyExchangeFormatter.cs: New. Stub.
+ * RSAPKCS1KeyExchangeDeformatter.cs: New. Stub.
+ * RSAPKCS1KeyExchangeFormatter.cs: New. 98% implemented but still
+ require RSA.DecryptValue (not supported in MS .NET Framework)
+ * RSAPKCS1SignatureDeformatter.cs: New. Stub.
+ * RSAPKCS1SignatureFormatter.cs: New. Stub.
+
+2002-10-23 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SymmetricAlgorithm.cs: Fixed CFB mode (do encryption while decrypting!)
+ * TripleDESCryptoServiceProvider.cs: Ajusted for CFB.
+
+2002-10-22 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * RjindaelManaged.cs: Fixed decryption for 192 and 256 bit block size
+
+2002-10-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RC2CryptoServiceProvider.cs: fixed end of lines (changed from \r
+ to \n).
+
+2002-10-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SymmetricAlgorithm.cs: Added better Dispose support
+ * DES.cs: Now only contains the abstract DES class.
+ * DESCryptoServiceProvider.cs: Added the DESTransform class (inherited
+ from SymmetricTransform) based the old DESCore and DESTransformBase code
+ * RC2.cs: Fixed EffectiveKeySize == 0
+ * RC2CryptoServiceProvider.cs: Added the RC2Transform class (inherited
+ from SymmetricTransform) based on the old RC2lImpl code. Unrolled some loops.
+ * RjindaelManaged.cs: Few more optimizations while looking for decrypting bug
+ * TripleDESCryptoServiceProvider.cs: New. Implement TripleDESTransform from
+ DESTransform (non-optimal but working :-).
+
+2002-10-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SymmetricAlgorithm.cs: Added new class SymmetricTransform to avoid
+ duplicating CipherMode (currently ECB, CBC) and PaddingMode functionalities
+ in every crytographic algorithm implementation.
+ * RijndaelManaged.cs: Added the RjindaelTransform class (inherited
+ from SymmetricTransform) based the old RijndaelImpl / RijndaelController
+ code. Fixed encryption for block size 192, 256, there is still a problem
+ decrypting block size 192, 256. Unrolled some loops + littl'optimizations
+ * PKCS1MaskGenerationMethod.cs: Removed Array.Reverse in I2OSP to be
+ compatible with MS implementation (however we are now failing the PKCS#1
+ test vector) + added some more checks (null, overflow, ...)
+ * AsymmetricAlgorithm.cs: Commented XMLDocument stuff to end the cyclic
+ dependency (corlib->System.Xml->corlib)
+ * RSA.cs: Commented FromXmlString stuff to end the cyclic dependency
+ * DSA.cs: Commented FromXmlString stuff to end the cyclic dependency
+ * RC2.cs: Create using CryptoConfig
+ * TripleDES.cs: Marked class public. Added LegalKeySizes and LegalBlockSizes
+
+2002-10-14 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * MD5.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * Rijndael.cs: Create using CryptoConfig. Removed TODO.
+ * RSAParameters.cs: Modulus must be serialized. Removed TODO.
+ * SHA256.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * SHA384.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * SHA512.cs: Create using CryptoConfig, set HashSizeValue, removed TODO.
+ * FromBase64Transform.cs: Removed ToString()
+ * ToBase64Transform.cs: Removed ToString()
+ * SymmetricAlgorithm.cs: Create using CryptoConfig, set default Mode and
+ Padding, added Clear, Dispose
+ * TripleDES.cs: New. Abstract class.
+ * MaskGenerationMethod.cs: New. Abstract class.
+ * PKCS1MaskGenerationMethod.cs: New. Implement PKCS#1 MGF (currently not
+ compatible with MS implementation - but not sure the bug is mine!).
+
+2002-10-13 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * HashAlgorithm.cs: Added Dispose() to HashAlgorithm because it
+ inherits ICryptoTransform
+ * KeyedHashAlgorithm.cs: New implementation
+ * HMACSHA1.cs: New (include a generic HMACAlgorithm as internal class)
+ * MACTripleDES.cs: New (missing core implementation on generic MACAlgorithm)
+ * CryptoStream.cs: Added limited functionalities to support HMACSHA1
+
+2002-10-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DSA.cs: changed constructor to public from internal (like MS)
+ * HashAlgorithm.cs: Completed ComputeHash methods
+ * SHA1.cs: Added HashSizeValue = 160
+
+2002-10-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * ICryptoTransform.cs: Now inherits from IDisposable
+ * RC2CryptoServiceProvider.cs: Added Dispose() to RC2Impl because it inherits ICryptoTransform
+ * CryptoAPITransform.cs: Added Dispose() to CryptoAPITransform... ICryptoTransform
+ * RijndaelManaged.cs: Added Dispose() to RijndaelController...ICryptoTransform
+ * FromBase64Transform.cs: Added Dispose() to FromBase64Transform...ICryptoTransform
+ * ToBase64Transform.cs: Added Dispose() to ToBase64Transform...ICryptoTransform
+ * DESCryptoServiceProvider.cs: Added Dispose() to DESTransformBase...ICryptoTransform
+
+2002-10-11 Duncan Mak <duncan@ximian.com>
+
+ * DESCryptoServiceProvider.cs: Removed unnecessary Dispose ().
+
+2002-10-11 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DES.cs: Create() using CryptoConfig, fix #30256
+ * DESCryptoServiceProvider.cs: fix #30256
+ * RandomNumberGenerator.cs: uncomment in Create(rng) for CryptoConfig
+
+2002-10-10 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AsymmetricAlgorithm.cs: Inherit from IDisposable, common support from XML import
+ * DSA.cs: FromXmlString() keypair import, Create() using CryptoConfig
+ * RSA.cs: FromXmlString() keypair import, Create() using CryptoConfig
+ * DSACryptoServiceProvider.cs: Added Dispose()
+
+2002-10-09 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoConfig.cs: New implementation
+
+2002-10-05 Andrew Birkett <andy@nobugs.org>
+
+ * RC2CryptoServiceProvider.cs: New implementation
+ * RC2.cs: New implementation
+
+2002-09-22 Andrew Birkett <andy@nobugs.org>
+
+ * RijndaelManaged.cs: Added faster case for multiplication by 2 in GF(8)
+
+2002-09-22 Andrew Birkett <andy@nobugs.org>
+
+ * RijndaelManaged.cs: BlockSize now reports size in bytes.
+ * ICryptoTransform.cs: Updated comments - BlockSizes are in bytes, unlike elsewhere.
+
+2002-09-19 Andrew Birkett <andy@nobugs.org>
+
+ * Rijndael.cs: Create() now gives you a RijndaelManaged object
+ * RijndaelManaged.cs: Added dummy GenerateKey until we have a proper RNG.
+ * SymmetricAlgorithm.cs: Updated comments
+
+2002-09-15 Andrew Birkett <andy@nobugs.org>
+
+ * RijndaelManaged.cs: Added support for CBC-mode, PKCS7/Zero padding.
+ * SymmetricAlgorithm.cs: IV size must match block size, not key size.
+ Key property now sets KeySizeValue correctly in bits.
+
+2002-09-11 Andrew Birkett <andy@nobugs.org>
+
+ * RijndaelManaged.cs: Implemented ECB-mode Rijndael cipher.
+ * Rijndael.cs: Set valid key/block sizes.
+ * SymmetricAlgorithm.cs: Remove throw from ctr so we can instantiate
+ derived classes. Fixes to key sizes so they are measured in bits.
+ * KeySizes.cs: Updated comments to emphasize that sizes are in bits.
+
+2002-06-29 Martin Baulig <martin@gnome.org>
+
+ * AsymmetricAlgorithm.cs: Removed a duplicate semicolon to make it compile.
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * FromBase64Transform.cs (TransformFinalBlock): The return value of
+ `DoTransform' tells us the number of bytes actually written - if it's
+ smaller than `res', copy it to a smaller array.
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * RNGCryptoServiceProvider.cs: New file.
+ * RandomNumberGenerator.cs: Constructor is now marked public.
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * DSACryptoServiceProvider.cs, SHA384Managed.cs, SHA512Managed.cs,
+ Rijndael.cs, RSA.cs, RSAParameters.cs : New files (stubs)
+
+Mon Feb 11 13:26:17 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * X509Certificates: dummy class.
+
+2002-01-10 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Create (trivial) implementation of RandomNumberGenerator
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * CryptoAPITransform.cs, DESCryptoProvider.cs : MonoTODO attribute
+ decoration.
+
+ * HashAlgorithm.cs, MD5.cs, SHA1.cs, SHA256.cs, SHA384.cs : Ditto.
+
+ * SHA512.cs, SymmetricAlgorithm.cs, ToBase64Transform.cs,
+ AsymmetricAlgorithm.cs, CryptoStream.cs, DSA.cs, DSASignatureDeformatter.cs,
+ DSASignatureFormatter.cs, SignatureDescription.cs : Ditto.
+
+Wed Nov 14 17:04:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MD5CryptoServiceProvider.cs, SHA1CryptoServiceProvider.cs,
+ SHA256Managed.cs: CLSCompliant updates.
+
+2001-10-11 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * CryptoAPITransform.cs: Initial version
+ * CryptoStream.cs: Initial version
+ * CspParameter.cs: Initial version
+ * CspProviderFlags.cs: Initial version
+ * DSA.cs: Initial version
+ * DSAParameters.cs: Initial version
+ * DSASignatureDeformatter.cs: Initial version
+ * DSASignatureFormatter.cs: Initial version
+ * DeriveBytes.cs: Initial version
+
+2001-10-06 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * AsymmetricAlgorithm.cs: Inital version
+ * AsymmetricKeyExchangeDeformatter.cs: Initial version
+ * AsymmetricKeyExchangeFormatter.cs: Initial version
+ * AsymmetricSignatureDeformatter.cs: Initial version
+ * AsymmetricSignatureFormatter.cs: Initial version
+ * PaddingMode.cs: Added PaddingMode.None
+ * SignatureDescription.cs: Initial version
+ * CryptographicException.cs: Initial version
+ * CryptographicUnknownOperationException.cs: Initial version
+ * SymmetricAlgorithm.cs: Implemented CreateDecryptor, CreateEncryptor
+ and Create() methods.
+
+2001-08-20 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * DES.cs encryption core is about 30% faster than previous version.
+ * DESCryptoServiceProvider.cs added PKCS-5 padding.
+
+2001-08-09 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * ToBase64Transform.cs: Base64Table now supports both encoding
+ and decoding tables. As a result Table was renamed to EncodeTable
+ and DecodeTable was added.
+ * FromBase64Transform.cs: Initial check-in.
+ * DES.cs: Initial check-in.
+ * DESCryptoServiceProvider.cs: Initial check-in.
+
+2001-08-01 Matthew S. Ford <Matthew.S.Ford@Rose-Hulman.Edu>
+
+ * CipherMode.cs: Initial version.
+ * CryptoStreamMode.cs: Initial version.
+ * HashAlgorithm.cs: Initial version.
+ * ICryptoTransform.cs: Initial version.
+ * KeySizes.cs: Initial version.
+ * MD5.cs: Initial version.
+ * MD5CryptoServiceProvider.cs: Initial version.
+ * PaddingMode.cs: Initial version.
+ * SHA1.cs: Initial version.
+ * SHA1CryptoServiceProvider.cs: Initial version.
+ * SHA256.cs: Initial version.
+ * SHA256Managed.cs: Initial version.
+ * SHA384.cs: Initial version.
+ * SHA512.cs: Initial version.
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CipherMode.cs b/mcs/class/corlib/System.Security.Cryptography/CipherMode.cs
new file mode 100644
index 00000000000..f154590dc99
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CipherMode.cs
@@ -0,0 +1,25 @@
+//
+// System.Security.Cryptography CipherMode enumeration
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Block cipher modes of operation.
+ /// </summary>
+ [Serializable]
+ public enum CipherMode {
+ CBC = 0x1, // Cipher Block Chaining
+ ECB, // Electronic Codebook
+ OFB, // Output Feedback
+ CFB, // Cipher Feedback
+ CTS, // Cipher Text Stealing
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs
new file mode 100755
index 00000000000..c9341339e1c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs
@@ -0,0 +1,85 @@
+//
+// System.Security.Cryptography CryptoAPITransform.cs
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography {
+
+// Note: This class isn't used by Mono as all algorithms are provided with
+// 100% managed implementations.
+
+public sealed class CryptoAPITransform : ICryptoTransform {
+
+ private bool m_disposed;
+
+ internal CryptoAPITransform ()
+ {
+ m_disposed = false;
+ }
+
+ ~CryptoAPITransform ()
+ {
+ Dispose (false);
+ }
+
+ public bool CanReuseTransform {
+ get { return true; }
+ }
+
+ public bool CanTransformMultipleBlocks {
+ get { return true; }
+ }
+
+ public int InputBlockSize {
+ get { return 0; }
+ }
+
+ public IntPtr KeyHandle {
+ get { return IntPtr.Zero; }
+ }
+
+ public int OutputBlockSize {
+ get { return 0; }
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ public void Clear()
+ {
+ Dispose (false);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // dispose unmanaged objects
+ if (disposing) {
+ // dispose managed objects
+ }
+ m_disposed = true;
+ }
+ }
+
+ public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
+ {
+ return 0;
+ }
+
+ public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ return null;
+ }
+
+} // CryptoAPITransform
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
new file mode 100644
index 00000000000..20d2234525b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
@@ -0,0 +1,352 @@
+//
+// CryptoConfig.cs: Handles cryptographic implementations and OIDs.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Security.Cryptography
+{
+
+public class CryptoConfig
+{
+ static private Hashtable algorithms;
+ static private Hashtable oid;
+ static Assembly xmldsig;
+
+ private const string defaultNamespace = "System.Security.Cryptography.";
+ private const string defaultSHA1 = defaultNamespace + "SHA1CryptoServiceProvider";
+ private const string defaultMD5 = defaultNamespace + "MD5CryptoServiceProvider";
+ private const string defaultSHA256 = defaultNamespace + "SHA256Managed";
+ private const string defaultSHA384 = defaultNamespace + "SHA384Managed";
+ private const string defaultSHA512 = defaultNamespace + "SHA512Managed";
+ private const string defaultRSA = defaultNamespace + "RSACryptoServiceProvider";
+ private const string defaultDSA = defaultNamespace + "DSACryptoServiceProvider";
+ private const string defaultDES = defaultNamespace + "DESCryptoServiceProvider";
+ private const string default3DES = defaultNamespace + "TripleDESCryptoServiceProvider";
+ private const string defaultRC2 = defaultNamespace + "RC2CryptoServiceProvider";
+ private const string defaultAES = defaultNamespace + "RijndaelManaged";
+ // LAMESPEC: undocumented names in CryptoConfig
+ private const string defaultRNG = defaultNamespace + "RNGCryptoServiceProvider";
+ private const string defaultHMAC = defaultNamespace + "HMACSHA1";
+ private const string defaultMAC3DES = defaultNamespace + "MACTripleDES";
+ // LAMESPEC: undocumented classes (also undocumented in CryptoConfig ;-)
+ private const string defaultDSASigDesc = defaultNamespace + "DSASignatureDescription";
+ private const string defaultRSASigDesc = defaultNamespace + "RSAPKCS1SHA1SignatureDescription";
+ // LAMESPEC: undocumented names in CryptoConfig
+ private const string defaultC14N = defaultNamespace + "Xml.XmlDsigC14NTransform";
+ private const string defaultC14NWithComments = defaultNamespace + "Xml.XmlDsigC14NWithCommentsTransform";
+ private const string defaultBase64 = defaultNamespace + "Xml.XmlDsigBase64Transform";
+ private const string defaultXPath = defaultNamespace + "Xml.XmlDsigXPathTransform";
+ private const string defaultXslt = defaultNamespace + "Xml.XmlDsigXsltTransform";
+ private const string defaultEnveloped = defaultNamespace + "Xml.XmlDsigEnvelopedSignatureTransform";
+
+ private const string managedSHA1 = defaultNamespace + "SHA1Managed";
+
+
+ // Oddly OID seems only available for hash algorithms
+ private const string oidSHA1 = "1.3.14.3.2.26";
+ private const string oidMD5 = "1.2.840.113549.2.5";
+ private const string oidSHA256 = "2.16.840.1.101.3.4.1";
+ private const string oidSHA384 = "2.16.840.1.101.3.4.2";
+ private const string oidSHA512 = "2.16.840.1.101.3.4.3";
+
+ private const string nameSHA1a = "SHA";
+ private const string nameSHA1b = "SHA1";
+ private const string nameSHA1c = "System.Security.Cryptography.SHA1";
+ private const string nameSHA1d = "System.Security.Cryptography.HashAlgorithm";
+ private const string nameMD5a = "MD5";
+ private const string nameMD5b = "System.Security.Cryptography.MD5";
+ private const string nameSHA256a = "SHA256";
+ private const string nameSHA256b = "SHA-256";
+ private const string nameSHA256c = "System.Security.Cryptography.SHA256";
+ private const string nameSHA384a = "SHA384";
+ private const string nameSHA384b = "SHA-384";
+ private const string nameSHA384c = "System.Security.Cryptography.SHA384";
+ private const string nameSHA512a = "SHA512";
+ private const string nameSHA512b = "SHA-512";
+ private const string nameSHA512c = "System.Security.Cryptography.SHA512";
+ private const string nameRSAa = "RSA";
+ private const string nameRSAb = "System.Security.Cryptography.RSA";
+ private const string nameRSAc = "System.Security.Cryptography.AsymmetricAlgorithm";
+ private const string nameDSAa = "DSA";
+ private const string nameDSAb = "System.Security.Cryptography.DSA";
+ private const string nameDESa = "DES";
+ private const string nameDESb = "System.Security.Cryptography.DES";
+ private const string name3DESa = "3DES";
+ private const string name3DESb = "TripleDES";
+ private const string name3DESc = "Triple DES";
+ private const string name3DESd = "System.Security.Cryptography.TripleDES";
+ private const string nameRC2a = "RC2";
+ private const string nameRC2b = "System.Security.Cryptography.RC2";
+ private const string nameAESa = "Rijndael";
+ private const string nameAESb = "System.Security.Cryptography.Rijndael";
+ private const string nameAESc = "System.Security.Cryptography.SymmetricAlgorithm";
+ // LAMESPEC: undocumented names in CryptoConfig
+ private const string nameRNGa = "RandomNumberGenerator";
+ private const string nameRNGb = "System.Security.Cryptography.RandomNumberGenerator";
+ private const string nameKeyHasha = "System.Security.Cryptography.KeyedHashAlgorithm";
+ private const string nameHMACa = "HMACSHA1";
+ private const string nameHMACb = "System.Security.Cryptography.HMACSHA1";
+ private const string nameMAC3DESa = "MACTripleDES";
+ private const string nameMAC3DESb = "System.Security.Cryptography.MACTripleDES";
+ // LAMESPEC: undocumented URLs in CryptoConfig
+ private const string urlDSASHA1 = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
+ private const string urlRSASHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+ private const string urlSHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
+ private const string urlC14N = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+ private const string urlC14NWithComments = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
+ private const string urlBase64 = "http://www.w3.org/2000/09/xmldsig#base64";
+ private const string urlXPath = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+ private const string urlXslt = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+ private const string urlEnveloped = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
+
+ // ??? must we read from the machine.config each time or just at startup ???
+ [MonoTODO ("support machine.config")]
+ static CryptoConfig()
+ {
+ algorithms = new Hashtable ();
+ // see list @ http://msdn.microsoft.com/library/en-us/cpref/html/
+ // frlrfSystemSecurityCryptographyCryptoConfigClassTopic.asp
+ algorithms.Add (nameSHA1a, defaultSHA1);
+ algorithms.Add (nameSHA1b, defaultSHA1);
+ algorithms.Add (nameSHA1c, defaultSHA1);
+ algorithms.Add (nameSHA1d, defaultSHA1);
+
+ algorithms.Add (nameMD5a, defaultMD5);
+ algorithms.Add (nameMD5b, defaultMD5);
+
+ algorithms.Add (nameSHA256a, defaultSHA256);
+ algorithms.Add (nameSHA256b, defaultSHA256);
+ algorithms.Add (nameSHA256c, defaultSHA256);
+
+ algorithms.Add (nameSHA384a, defaultSHA384);
+ algorithms.Add (nameSHA384b, defaultSHA384);
+ algorithms.Add (nameSHA384c, defaultSHA384);
+
+ algorithms.Add (nameSHA512a, defaultSHA512);
+ algorithms.Add (nameSHA512b, defaultSHA512);
+ algorithms.Add (nameSHA512c, defaultSHA512);
+
+ algorithms.Add (nameRSAa, defaultRSA);
+ algorithms.Add (nameRSAb, defaultRSA);
+ algorithms.Add (nameRSAc, defaultRSA);
+
+ algorithms.Add (nameDSAa, defaultDSA);
+ algorithms.Add (nameDSAb, defaultDSA);
+
+ algorithms.Add (nameDESa, defaultDES);
+ algorithms.Add (nameDESb, defaultDES);
+
+ algorithms.Add (name3DESa, default3DES);
+ algorithms.Add (name3DESb, default3DES);
+ algorithms.Add (name3DESc, default3DES);
+ algorithms.Add (name3DESd, default3DES);
+
+ algorithms.Add (nameRC2a, defaultRC2);
+ algorithms.Add (nameRC2b, defaultRC2);
+
+ algorithms.Add (nameAESa, defaultAES);
+ algorithms.Add (nameAESb, defaultAES);
+ // LAMESPEC SymmetricAlgorithm documented as TripleDESCryptoServiceProvider
+ algorithms.Add (nameAESc, defaultAES);
+
+ // LAMESPEC These names aren't documented but (hint) the classes also have
+ // static Create methods. So logically they should (and are) here.
+ algorithms.Add (nameRNGa, defaultRNG);
+ algorithms.Add (nameRNGb, defaultRNG);
+ algorithms.Add (nameKeyHasha, defaultHMAC);
+ algorithms.Add (nameHMACa, defaultHMAC);
+ algorithms.Add (nameHMACb, defaultHMAC);
+ algorithms.Add (nameMAC3DESa, defaultMAC3DES);
+ algorithms.Add (nameMAC3DESb, defaultMAC3DES);
+
+ // LAMESPEC These URLs aren't documented but (hint) installing the WSDK
+ // add some of the XMLDSIG urls into machine.config (and they make a LOT
+ // of sense for implementing XMLDSIG in System.Security.Cryptography.Xml)
+ algorithms.Add (urlDSASHA1, defaultDSASigDesc);
+ algorithms.Add (urlRSASHA1, defaultRSASigDesc);
+ algorithms.Add (urlSHA1, defaultSHA1);
+ algorithms.Add (urlC14N, defaultC14N);
+ algorithms.Add (urlC14NWithComments, defaultC14NWithComments);
+ algorithms.Add (urlBase64, defaultBase64);
+ algorithms.Add (urlXPath, defaultXPath);
+ algorithms.Add (urlXslt, defaultXslt);
+ algorithms.Add (urlEnveloped, defaultEnveloped);
+
+ oid = new Hashtable ();
+ // comments here are to match with MS implementation (but not with doc)
+ // LAMESPEC: only HashAlgorithm seems to have their OID included
+ oid.Add (defaultSHA1, oidSHA1);
+ oid.Add (managedSHA1, oidSHA1);
+ // oid.Add (nameSHA1a, oidSHA1);
+ oid.Add (nameSHA1b, oidSHA1);
+ oid.Add (nameSHA1c, oidSHA1);
+ // oid.Add (nameSHA1d, oidSHA1);
+
+ oid.Add (defaultMD5, oidMD5);
+ oid.Add (nameMD5a, oidMD5);
+ oid.Add (nameMD5b, oidMD5);
+
+ oid.Add (defaultSHA256, oidSHA256);
+ oid.Add (nameSHA256a, oidSHA256);
+ // oid.Add (nameSHA256b, oidSHA256);
+ oid.Add (nameSHA256c, oidSHA256);
+
+ oid.Add (defaultSHA384, oidSHA384);
+ oid.Add (nameSHA384a, oidSHA384);
+ // oid.Add (nameSHA384b, oidSHA384);
+ oid.Add (nameSHA384c, oidSHA384);
+
+ oid.Add (defaultSHA512, oidSHA512);
+ oid.Add (nameSHA512a, oidSHA512);
+ // oid.Add (nameSHA512b, oidSHA512);
+ oid.Add (nameSHA512c, oidSHA512);
+ }
+
+ public static object CreateFromName (string name)
+ {
+ return CreateFromName (name, null);
+ }
+
+ public static object CreateFromName (string name, object[] args)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ try {
+ Type algoClass = null;
+ string algo = (string)algorithms [name];
+ // do we have an entry
+ if (algo != null) {
+ algoClass = Type.GetType (algo);
+ // some classes are in assembly System.Security.Cryptography.Xml
+ if ((algoClass == null) && (algo.StartsWith ("System.Security.Cryptography.Xml."))) {
+ // second chance !
+ if (xmldsig == null)
+ xmldsig = Assembly.LoadWithPartialName ("System.Security");
+ if (xmldsig != null)
+ algoClass = xmldsig.GetType (algo);
+ }
+ }
+ else
+ algoClass = Type.GetType (name);
+ // call the constructor for the type
+ return Activator.CreateInstance (algoClass, args);
+ }
+ catch {
+ return null;
+ }
+ }
+
+ // Note: Couldn't access private in DefaultConfig so I copied the
+ // two required functions.
+/* [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern private static string get_machine_config_path ();
+
+ private static string GetMachineConfigPath ()
+ {
+ return get_machine_config_path ();
+ }*/
+
+ // encode (7bits array) number greater than 127
+ private static byte[] EncodeLongNumber (long x)
+ {
+ // for MS BCL compatibility
+ // comment next two lines to remove restriction
+ if ((x > Int32.MaxValue) || (x < Int32.MinValue))
+ throw new OverflowException("part of OID doesn't fit in Int32");
+
+ long y = x;
+ // number of bytes required to encode this number
+ int n = 1;
+ while (y > 0x7F) {
+ y = y >> 7;
+ n++;
+ }
+ byte[] num = new byte [n];
+ // encode all bytes
+ for (int i = 0; i < n; i++) {
+ y = x >> (7 * i);
+ y = y & 0x7F;
+ if (i != 0)
+ y += 0x80;
+ num[n-i-1] = Convert.ToByte (y);
+ }
+ return num;
+ }
+
+ public static byte[] EncodeOID (string str)
+ {
+ char[] delim = { '.' };
+ string[] parts = str.Split (delim);
+ // according to X.208 n is always at least 2
+ if (parts.Length < 2)
+ throw new CryptographicUnexpectedOperationException ();
+ // we're sure that the encoded OID is shorter than its string representation
+ byte[] oid = new byte [str.Length];
+ // now encoding value
+ try {
+ byte part0 = Convert.ToByte (parts [0]);
+ // OID[0] > 2 is invalid but "supported" in MS BCL
+ // uncomment next line to trap this error
+ // if (part0 > 2) throw new CryptographicUnexpectedOperationException ();
+ byte part1 = Convert.ToByte (parts [1]);
+ // OID[1] >= 40 is illegal for OID[0] < 2 because of the % 40
+ // however the syntax is "supported" in MS BCL
+ // uncomment next 2 lines to trap this error
+ //if ((part0 < 2) && (part1 >= 40))
+ // throw new CryptographicUnexpectedOperationException ();
+ oid[2] = Convert.ToByte (part0 * 40 + part1);
+ }
+ catch {
+ throw new CryptographicUnexpectedOperationException ();
+ }
+ int j = 3;
+ for (int i = 2; i < parts.Length; i++) {
+ long x = Convert.ToInt64( parts [i]);
+ if (x > 0x7F) {
+ byte[] num = EncodeLongNumber (x);
+ Array.Copy(num, 0, oid, j, num.Length);
+ j += num.Length;
+ }
+ else
+ oid[j++] = Convert.ToByte (x);
+ }
+
+ int k = 2;
+ // copy the exact number of byte required
+ byte[] oid2 = new byte [j];
+ oid2[0] = 0x06; // always - this tag means OID
+ // Length (of value)
+ if (j > 0x7F) {
+ // for compatibility with MS BCL
+ throw new CryptographicUnexpectedOperationException ("OID > 127 bytes");
+ // comment exception and uncomment next 3 lines to remove restriction
+ //byte[] num = EncodeLongNumber (j);
+ //Array.Copy (num, 0, oid, j, num.Length);
+ //k = num.Length + 1;
+ }
+ else
+ oid2 [1] = Convert.ToByte (j - 2);
+
+ System.Array.Copy (oid, k, oid2, k, j - k);
+ return oid2;
+ }
+
+ public static string MapNameToOID (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ return (string)oid [name];
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
new file mode 100755
index 00000000000..eea6ae0e809
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
@@ -0,0 +1,185 @@
+//
+// System.Security.Cryptography CryptoStream.cs
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography {
+
+public class CryptoStream : Stream {
+ private Stream _stream;
+ private ICryptoTransform _transform;
+ private CryptoStreamMode _mode;
+ private byte[] work;
+ private int workPos;
+ private bool disposed;
+
+ public CryptoStream (Stream stream, ICryptoTransform transform, CryptoStreamMode mode)
+ {
+ _stream = stream;
+ _transform = transform;
+ _mode = mode;
+ disposed = false;
+ if (mode == CryptoStreamMode.Read)
+ work = new byte [transform.InputBlockSize];
+ else if (mode == CryptoStreamMode.Write)
+ work = new byte [transform.OutputBlockSize];
+ workPos = 0;
+ }
+
+ ~CryptoStream ()
+ {
+ Dispose (false);
+ }
+
+ public override bool CanRead {
+ get { return (_mode == CryptoStreamMode.Read); }
+ }
+
+ public override bool CanSeek {
+ get { return false; }
+ }
+
+ public override bool CanWrite {
+ get { return (_mode == CryptoStreamMode.Write); }
+ }
+
+ public override long Length {
+ get {
+ throw new NotSupportedException ("Length property not supported by CryptoStream");
+ }
+ }
+
+ public override long Position {
+ get {
+ throw new NotSupportedException ("Position property not supported by CryptoStream");
+ }
+ set {
+ throw new NotSupportedException ("Position property not supported by CryptoStream");
+ }
+ }
+
+ public void Clear ()
+ {
+ Dispose (true);
+ }
+
+ public override void Close ()
+ {
+ if (_mode != CryptoStreamMode.Write)
+ throw new NotSupportedException ();
+
+ byte[] finalBuffer = _transform.TransformFinalBlock (work, 0, workPos);
+ if (_stream != null) {
+ _stream.Write (finalBuffer, 0, finalBuffer.Length);
+ _stream.Close ();
+ }
+ }
+
+ public override int Read (byte[] buffer, int offset, int count)
+ {
+ if (_mode != CryptoStreamMode.Read)
+ throw new NotSupportedException ();
+ if ((offset < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+ if (offset + count > buffer.Length)
+ throw new ArgumentException ();
+ // reached end of stream ?
+ if (_stream.Position == _stream.Length)
+ return 0;
+
+ int result = 0;
+ int bufferPos = offset;
+ while (count > 0) {
+ int len = Math.Min (work.Length - workPos, count);
+ _stream.Read (work, workPos, len);
+ workPos += len;
+ count -= len;
+ if (_stream.Position == _stream.Length) {
+ byte[] input = _transform.TransformFinalBlock (work, 0, work.Length);
+ Array.Copy (input, 0, buffer, bufferPos, input.Length);
+ result += input.Length;
+ break;
+ } else if (workPos == work.Length) {
+ workPos = 0;
+ result += _transform.TransformBlock (work, 0, work.Length, buffer, bufferPos);
+ }
+ bufferPos += len;
+ }
+ return result;
+ }
+
+ public override void Write (byte[] buffer, int offset, int count)
+ {
+ if (_mode != CryptoStreamMode.Write)
+ throw new NotSupportedException ();
+ if ((offset < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+ if (offset + count > buffer.Length)
+ throw new ArgumentException ();
+
+ int bufferPos = offset;
+ while (count > 0) {
+ int len = Math.Min (work.Length - workPos, count);
+ Array.Copy (buffer, bufferPos, work, workPos, len);
+ bufferPos += len;
+ workPos += len;
+ count -= len;
+ if (workPos == work.Length) {
+ workPos = 0;
+ byte[] output = new byte[_transform.OutputBlockSize];
+ _transform.TransformBlock (work, 0, work.Length, output, 0);
+ _stream.Write (output, 0, output.Length);
+ }
+ }
+ }
+
+ public override void Flush ()
+ {
+ if (_mode != CryptoStreamMode.Write)
+ throw new NotSupportedException ("cannot flush a non-writeable CryptoStream");
+
+ if (_stream != null)
+ _stream.Flush ();
+ }
+
+ public void FlushFinalBlock ()
+ {
+ if (_mode != CryptoStreamMode.Write)
+ throw new NotSupportedException ("cannot flush a non-writeable CryptoStream");
+
+ if (_stream != null) {
+ _stream.Flush ();
+ Close ();
+ }
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ throw new NotSupportedException ("cannot Seek a CryptoStream");
+ }
+
+ // LAMESPEC: Exception NotSupportedException not documented
+ public override void SetLength (long value)
+ {
+ throw new NotSupportedException ("cannot SetLength a CryptoStream");
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ if (_stream != null)
+ _stream.Close ();
+ }
+ }
+
+} // CryptoStream
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs
new file mode 100644
index 00000000000..a87d1dee89f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.Cryptography CryptoStreamMode enumeration
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by authors.
+//
+
+namespace System.Security.Cryptography {
+
+ [Serializable]
+ public enum CryptoStreamMode {
+ Read,
+ Write
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoTools.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoTools.cs
new file mode 100644
index 00000000000..0462bf4b27c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoTools.cs
@@ -0,0 +1,107 @@
+//
+// System.Security.Cryptography.CryptoTools
+// Shared class for common cryptographic functionalities
+//
+// Authors:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+internal class KeyBuilder {
+
+ static private RandomNumberGenerator rng;
+
+ static KeyBuilder ()
+ {
+ rng = RandomNumberGenerator.Create ();
+ }
+
+ static public byte[] Key (int size)
+ {
+ byte[] key = new byte [size];
+ rng.GetBytes (key);
+ return key;
+ }
+
+ static public byte[] IV (int size)
+ {
+ byte[] iv = new byte [size];
+ rng.GetBytes (iv);
+ return iv;
+ }
+}
+
+// Process an array as a sequence of blocks
+internal class BlockProcessor {
+ private ICryptoTransform transform;
+ private byte[] block;
+ private int blockSize; // in bytes (not in bits)
+ private int blockCount;
+
+ public BlockProcessor (ICryptoTransform transform)
+ : this (transform, transform.InputBlockSize) {}
+
+ // some Transforms (like HashAlgorithm descendant) return 1 for
+ // block size (which isn't their real internal block size)
+ public BlockProcessor (ICryptoTransform transform, int blockSize)
+ {
+ this.transform = transform;
+ this.blockSize = blockSize;
+ block = new byte [blockSize];
+ }
+
+ ~BlockProcessor ()
+ {
+ // zeroize our block (so we don't retain any information)
+ Array.Clear (block, 0, blockSize);
+ }
+
+ public void Initialize ()
+ {
+ Array.Clear (block, 0, blockSize);
+ blockCount = 0;
+ }
+
+ public void Core (byte[] rgb)
+ {
+ Core (rgb, 0, rgb.Length);
+ }
+
+ public void Core (byte[] rgb, int ib, int cb)
+ {
+ // 1. fill the rest of the "block"
+ int n = Math.Min (blockSize - blockCount, cb);
+ Array.Copy (rgb, ib, block, blockCount, n);
+ blockCount += n;
+
+ // 2. if block is full then transform it
+ if (blockCount == blockSize) {
+ transform.TransformBlock (block, 0, blockSize, block, 0);
+
+ // 3. transform any other full block in specified buffer
+ int b = (int) ((cb - n) / blockSize);
+ for (int i=0; i < b; i++) {
+ transform.TransformBlock (rgb, n, blockSize, block, 0);
+ n += blockSize;
+ }
+
+ // 4. if data is still present fill the "block" with the remainder
+ blockCount = cb - n;
+ if (blockCount > 0)
+ Array.Copy (rgb, n, block, 0, blockCount);
+ }
+ }
+
+ public byte[] Final ()
+ {
+ return transform.TransformFinalBlock (block, 0, blockCount);
+ }
+}
+
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptographicException.cs b/mcs/class/corlib/System.Security.Cryptography/CryptographicException.cs
new file mode 100755
index 00000000000..e7edd39b335
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptographicException.cs
@@ -0,0 +1,48 @@
+//
+// System.Security.Cryptography.CryptographicException.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Security.Cryptography {
+
+[Serializable]
+public class CryptographicException : SystemException {
+
+ // Constructors
+ public CryptographicException ()
+ : base ("Error occured during a cryptographic operation.")
+ {
+ }
+
+ public CryptographicException (int hr)
+ {
+ HResult = hr;
+ }
+
+ public CryptographicException (string message)
+ : base (message)
+ {
+ }
+
+ public CryptographicException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public CryptographicException (string format, string insert)
+ : base (String.Format(format, insert))
+ {
+ }
+
+ protected CryptographicException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs b/mcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
new file mode 100755
index 00000000000..279b1814224
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
@@ -0,0 +1,42 @@
+//
+// System.Security.Cryptography.CryptographicUnexpectedOperationException.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Security.Cryptography {
+
+[Serializable]
+public class CryptographicUnexpectedOperationException : CryptographicException {
+ // Constructors
+ public CryptographicUnexpectedOperationException ()
+ : base ("Error occured during a cryptographic operation.")
+ {
+ }
+
+ public CryptographicUnexpectedOperationException (string message)
+ : base (message)
+ {
+ }
+
+ public CryptographicUnexpectedOperationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public CryptographicUnexpectedOperationException (string format, string insert)
+ : base (String.Format(format, insert))
+ {
+ }
+
+ protected CryptographicUnexpectedOperationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/CspParameters.cs b/mcs/class/corlib/System.Security.Cryptography/CspParameters.cs
new file mode 100755
index 00000000000..7c84eaff8af
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CspParameters.cs
@@ -0,0 +1,57 @@
+//
+// System.Security.Cryptography CspParameters.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// Contains information passed to Crypto Service Providers (CSP)
+ /// </summary>
+ public sealed class CspParameters
+ {
+ private CspProviderFlags _Flags;
+
+ public CspParameters() : this(1) {}
+
+ public CspParameters(int dwTypeIn) : this(dwTypeIn, null) {}
+
+ public CspParameters(int dwTypeIn, string strProviderNameIn) : this(dwTypeIn, null, null) {}
+
+ public CspParameters(int dwTypeIn, string strProviderNameIn, string strContainerNameIn)
+ {
+ ProviderType = dwTypeIn;
+ ProviderName = strProviderNameIn;
+ KeyContainerName = strContainerNameIn;
+
+ // not defined in specs, only tested from M$ impl
+ KeyNumber = -1;
+ }
+
+ public string KeyContainerName;
+
+ public int KeyNumber;
+
+ public string ProviderName;
+
+ public int ProviderType;
+
+ public CspProviderFlags Flags
+ {
+ get {
+ return _Flags;
+ }
+
+ set {
+ _Flags = value;
+ }
+ }
+
+ } // CspParameters
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs b/mcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs
new file mode 100755
index 00000000000..29393fc9607
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.Cryptography CspProviderFlags enumeration
+//
+// Authors:
+// Thomas Neidhart <tome@sbox.tugraz.at>
+//
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// CSP Provider Flags
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum CspProviderFlags {
+ UseMachineKeyStore = 1,
+ UseDefaultKeyContainer,
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/DES.cs b/mcs/class/corlib/System.Security.Cryptography/DES.cs
new file mode 100644
index 00000000000..16cc456f1f0
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DES.cs
@@ -0,0 +1,120 @@
+//
+// System.Security.Cryptography.DES
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+// References:
+// a. FIPS PUB 46-3: Data Encryption Standard
+// http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
+
+namespace System.Security.Cryptography {
+
+public abstract class DES : SymmetricAlgorithm {
+
+ private static int blockSizeByte = 8;
+
+ public DES ()
+ {
+ KeySizeValue = 64;
+ BlockSizeValue = 64;
+ FeedbackSizeValue = 64;
+
+ LegalKeySizesValue = new KeySizes[1];
+ LegalKeySizesValue[0] = new KeySizes(64, 64, 0);
+
+ LegalBlockSizesValue = new KeySizes[1];
+ LegalBlockSizesValue[0] = new KeySizes(64, 64, 0);
+ }
+
+ public static new DES Create ()
+ {
+ return Create ("System.Security.Cryptography.DES");
+ }
+
+ public static new DES Create (string algo)
+ {
+ return (DES) CryptoConfig.CreateFromName (algo);
+ }
+
+ internal static ulong PackKey (byte [] key)
+ {
+ ulong res = 0;
+ for (int i = 0, sh = 8*blockSizeByte; (sh = sh - 8) >= 0; i++) {
+ res |= (ulong) key [i] << sh;
+ }
+ return res;
+ }
+
+ internal static byte [] UnpackKey (ulong key)
+ {
+ byte [] res = new byte [blockSizeByte];
+ for (int i = 0, sh = 8*blockSizeByte; (sh = sh - 8) >= 0; i++) {
+ res [i] = (byte) (key >> sh);
+ }
+ return res;
+ }
+
+ // Ek(Ek(m)) = m
+ internal static ulong [] weakKeys = {
+ 0x0101010101010101, /* 0000000 0000000 */
+ 0xFEFEFEFEFEFEFEFE, /* FFFFFFF FFFFFFF */
+ 0x1F1F1F1FE0E0E0E0, /* 0000000 FFFFFFF */
+ 0xE0E0E0E01F1F1F1F /* FFFFFFF 0000000 */
+ };
+
+ // Ek1(Ek2(m)) = m
+ internal static ulong [] semiweakKeys = {
+ 0x01FE01FE01FE01FE, 0xFE01FE01FE01FE01,
+ 0x1FE01FE00EF10EF1, 0xE01FE01FF10EF10E,
+ 0x01E001E001F101F1, 0xE001E001F101F101,
+ 0x1FFE1FFE0EFE0EFE, 0xFE1FFE1FFE0EFE0E,
+ 0x011F011F010E010E, 0x1F011F010E010E01,
+ 0xE0FEE0FEF1FEF1FE, 0xFEE0FEE0FEF1FEF1
+ };
+
+ public static bool IsWeakKey (byte [] rgbKey)
+ {
+ if (rgbKey.Length == (blockSizeByte >> 3))
+ throw new CryptographicException ("Wrong Key Length");
+
+ ulong lk = PackKey (rgbKey);
+ foreach (ulong wk in weakKeys) {
+ if (lk == wk) return true;
+ }
+ return false;
+ }
+
+ public static bool IsSemiWeakKey (byte [] rgbKey)
+ {
+ if (rgbKey.Length == (blockSizeByte >> 3))
+ throw new CryptographicException ("Wrong Key Length");
+
+ ulong lk = PackKey (rgbKey);
+ foreach (ulong swk in semiweakKeys) {
+ if (lk == swk) return true;
+ }
+ return false;
+ }
+
+ public override byte[] Key {
+ get { return base.Key; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (IsWeakKey (value) || IsSemiWeakKey (value))
+ throw new CryptographicException ();
+ base.Key = value;
+ }
+ }
+
+} // DES
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs
new file mode 100644
index 00000000000..f5846fcd180
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs
@@ -0,0 +1,464 @@
+//
+// System.Security.Cryptography.DESCryptoServiceProvider
+//
+// Authors:
+// Sergey Chaban (serge@wildwestsoftware.com)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+
+using System;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 46-3: Data Encryption Standard
+// http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
+
+internal class DESTransform : SymmetricTransform {
+
+ internal static readonly int KEY_BIT_SIZE = 64;
+ internal static readonly int KEY_BYTE_SIZE = KEY_BIT_SIZE / 8;
+ internal static readonly int BLOCK_BIT_SIZE = 64;
+ internal static readonly int BLOCK_BYTE_SIZE = BLOCK_BIT_SIZE / 8;
+
+ private byte [] keySchedule;
+ private byte [] byteBuff;
+ private uint [] dwordBuff;
+
+ // S-boxes from FIPS 46-3, Appendix 1, page 17
+ private static byte [] sBoxes = {
+ /* S1 */
+ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
+ 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
+ 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
+ 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,
+
+ /* S2 */
+ 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
+ 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
+ 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
+ 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,
+
+ /* S3 */
+ 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
+ 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
+ 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
+ 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,
+
+ /* S4 */
+ 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
+ 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
+ 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
+ 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,
+
+ /* S5 */
+ 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
+ 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
+ 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
+ 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,
+
+ /* S6 */
+ 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
+ 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
+ 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
+ 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,
+
+ /* S7 */
+ 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
+ 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
+ 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
+ 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,
+
+ /* S8 */
+ 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
+ 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
+ 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
+ 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
+ };
+
+
+ // P table from page 15, also in Appendix 1, page 18
+ private static byte [] pTab = {
+ 16-1, 7-1, 20-1, 21-1,
+ 29-1, 12-1, 28-1, 17-1,
+ 1-1, 15-1, 23-1, 26-1,
+ 5-1, 18-1, 31-1, 10-1,
+ 2-1, 8-1, 24-1, 14-1,
+ 32-1, 27-1, 3-1, 9-1,
+ 19-1, 13-1, 30-1, 6-1,
+ 22-1, 11-1, 4-1, 25-1
+ };
+
+
+ // Permuted choice 1 table, PC-1, page 19
+ // Translated to zero-based format.
+ private static byte [] PC1 = {
+ 57-1, 49-1, 41-1, 33-1, 25-1, 17-1, 9-1,
+ 1-1, 58-1, 50-1, 42-1, 34-1, 26-1, 18-1,
+ 10-1, 2-1, 59-1, 51-1, 43-1, 35-1, 27-1,
+ 19-1, 11-1, 3-1, 60-1, 52-1, 44-1, 36-1,
+
+ 63-1, 55-1, 47-1, 39-1, 31-1, 23-1, 15-1,
+ 7-1, 62-1, 54-1, 46-1, 38-1, 30-1, 22-1,
+ 14-1, 6-1, 61-1, 53-1, 45-1, 37-1, 29-1,
+ 21-1, 13-1, 5-1, 28-1, 20-1, 12-1, 4-1
+ };
+
+
+ private static byte [] leftRot = {
+ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
+ };
+
+ private static byte [] leftRotTotal;
+
+ // Permuted choice 2 table, PC-2, page 21
+ // Translated to zero-based format.
+ private static byte [] PC2 = {
+ 14-1, 17-1, 11-1, 24-1, 1-1, 5-1,
+ 3-1, 28-1, 15-1, 6-1, 21-1, 10-1,
+ 23-1, 19-1, 12-1, 4-1, 26-1, 8-1,
+ 16-1, 7-1, 27-1, 20-1, 13-1, 2-1,
+ 41-1, 52-1, 31-1, 37-1, 47-1, 55-1,
+ 30-1, 40-1, 51-1, 45-1, 33-1, 48-1,
+ 44-1, 49-1, 39-1, 56-1, 34-1, 53-1,
+ 46-1, 42-1, 50-1, 36-1, 29-1, 32-1
+ };
+
+
+ // Initial permutation IP, page 10.
+ // Transposed to 0-based format.
+ private static byte [] ipBits = {
+ 58-1, 50-1, 42-1, 34-1, 26-1, 18-1, 10-1, 2-1,
+ 60-1, 52-1, 44-1, 36-1, 28-1, 20-1, 12-1, 4-1,
+ 62-1, 54-1, 46-1, 38-1, 30-1, 22-1, 14-1, 6-1,
+ 64-1, 56-1, 48-1, 40-1, 32-1, 24-1, 16-1, 8-1,
+ 57-1, 49-1, 41-1, 33-1, 25-1, 17-1, 9-1, 1-1,
+ 59-1, 51-1, 43-1, 35-1, 27-1, 19-1, 11-1, 3-1,
+ 61-1, 53-1, 45-1, 37-1, 29-1, 21-1, 13-1, 5-1,
+ 63-1, 55-1, 47-1, 39-1, 31-1, 23-1, 15-1, 7-1
+ };
+
+
+ // Final permutation FP = IP^(-1), page 10.
+ // Transposed to 0-based format.
+ private static byte [] fpBits = {
+ 40-1, 8-1, 48-1, 16-1, 56-1, 24-1, 64-1, 32-1,
+ 39-1, 7-1, 47-1, 15-1, 55-1, 23-1, 63-1, 31-1,
+ 38-1, 6-1, 46-1, 14-1, 54-1, 22-1, 62-1, 30-1,
+ 37-1, 5-1, 45-1, 13-1, 53-1, 21-1, 61-1, 29-1,
+ 36-1, 4-1, 44-1, 12-1, 52-1, 20-1, 60-1, 28-1,
+ 35-1, 3-1, 43-1, 11-1, 51-1, 19-1, 59-1, 27-1,
+ 34-1, 2-1, 42-1, 10-1, 50-1, 18-1, 58-1, 26-1,
+ 33-1, 1-1, 41-1, 9-1, 49-1, 17-1, 57-1, 25-1
+ };
+
+ private static uint [] spBoxes;
+ private static int [] ipTab;
+ private static int [] fpTab;
+
+ static DESTransform ()
+ {
+ spBoxes = new uint [64 * 8];
+
+ int [] pBox = new int [32];
+
+ for (int p = 0; p < 32; p++) {
+ for (int i = 0; i < 32; i++) {
+ if (p == pTab [i]) {
+ pBox [p] = i;
+ break;
+ }
+ }
+ }
+
+ for (int s = 0; s < 8; s++) { // for each S-box
+ int sOff = s << 6;
+
+ for (int i = 0; i < 64; i++) { // inputs
+ uint sp=0;
+
+ int indx = (i & 0x20) | ((i & 1) << 4) | ((i >> 1) & 0xF);
+
+ for (int j = 0; j < 4; j++) { // for each bit in the output
+ if ((sBoxes [sOff + indx] & (8 >> j)) != 0) {
+ sp |= (uint) (1 << (31 - pBox [(s << 2) + j]));
+ }
+ }
+
+ spBoxes [sOff + i] = sp;
+ }
+ }
+
+ leftRotTotal = new byte [leftRot.Length];
+
+ for (int i = 0; i < leftRot.Length; i++) {
+ int r = 0;
+ for (int j = 0; j <= i; r += leftRot [j++]);
+ leftRotTotal [i] = (byte) r;
+ }
+
+ InitPermutationTable (ipBits, out ipTab);
+ InitPermutationTable (fpBits, out fpTab);
+ } // class constructor
+
+ // Default constructor.
+ internal DESTransform (SymmetricAlgorithm symmAlgo, bool encryption, byte[] key, byte[] iv) : base (symmAlgo, encryption, iv)
+ {
+ keySchedule = new byte [KEY_BYTE_SIZE * 16];
+ byteBuff = new byte [BLOCK_BYTE_SIZE];
+ dwordBuff = new uint [BLOCK_BYTE_SIZE / 4];
+ SetKey (key);
+ }
+
+ private static void InitPermutationTable (byte [] pBits, out int [] permTab)
+ {
+ permTab = new int [8*2 * 8*2 * (64/32)];
+
+ for (int i = 0; i < 16; i++) {
+ for (int j = 0; j < 16; j++) {
+ int offs = (i << 5) + (j << 1);
+ for (int n = 0; n < 64; n++) {
+ int bitNum = (int) pBits [n];
+ if ((bitNum >> 2 == i) &&
+ 0 != (j & (8 >> (bitNum & 3)))) {
+ permTab [offs + (n >> (3+2))] |= (int) ((0x80808080 & (0xFF << (n & (3 << 3)))) >> (n & 7));
+ }
+ }
+ }
+ }
+ }
+
+ private uint CipherFunct(uint r, int n)
+ {
+ uint res = 0;
+ byte [] subkey = keySchedule;
+ int i = n << 3;
+
+ uint rt = (r >> 1) | (r << 31); // ROR32(r)
+ res |= spBoxes [0*64 + (((rt >> 26) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [1*64 + (((rt >> 22) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [2*64 + (((rt >> 18) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [3*64 + (((rt >> 14) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [4*64 + (((rt >> 10) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [5*64 + (((rt >> 6) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [6*64 + (((rt >> 2) ^ subkey [i++]) & 0x3F)];
+ rt = (r << 1) | (r >> 31); // ROL32(r)
+ res |= spBoxes [7*64 + ((rt ^ subkey [i]) & 0x3F)];
+
+ return res;
+ }
+
+
+ private static void Permutation (byte [] input, byte [] _output, int [] permTab, bool preSwap)
+ {
+ if (preSwap) BSwap (input);
+
+ byte [] output = _output;
+
+ int offs1 = (((int)(input [0]) >> 4)) << 1;
+ int offs2 = (1 << 5) + ((((int)input [0]) & 0xF) << 1);
+
+ int d1 = permTab [offs1++] | permTab [offs2++];
+ int d2 = permTab [offs1] | permTab [offs2];
+
+
+ int max = BLOCK_BYTE_SIZE << 1;
+ for (int i = 2, indx = 1; i < max; i += 2, indx++) {
+ int ii = (int) input [indx];
+ offs1 = (i << 5) + ((ii >> 4) << 1);
+ offs2 = ((i + 1) << 5) + ((ii & 0xF) << 1);
+
+ d1 |= permTab [offs1++] | permTab [offs2++];
+ d2 |= permTab [offs1] | permTab [offs2];
+ }
+
+ if (preSwap) {
+ output [0] = (byte) (d1);
+ output [1] = (byte) (d1 >> 8);
+ output [2] = (byte) (d1 >> 16);
+ output [3] = (byte) (d1 >> 24);
+ output [4] = (byte) (d2);
+ output [5] = (byte) (d2 >> 8);
+ output [6] = (byte) (d2 >> 16);
+ output [7] = (byte) (d2 >> 24);
+ } else {
+ output [0] = (byte) (d1 >> 24);
+ output [1] = (byte) (d1 >> 16);
+ output [2] = (byte) (d1 >> 8);
+ output [3] = (byte) (d1);
+ output [4] = (byte) (d2 >> 24);
+ output [5] = (byte) (d2 >> 16);
+ output [6] = (byte) (d2 >> 8);
+ output [7] = (byte) (d2);
+ }
+ }
+
+ private static void BSwap (byte [] byteBuff)
+ {
+ byte t;
+
+ t = byteBuff [0];
+ byteBuff [0] = byteBuff [3];
+ byteBuff [3] = t;
+
+ t = byteBuff [1];
+ byteBuff [1] = byteBuff [2];
+ byteBuff [2] = t;
+
+ t = byteBuff [4];
+ byteBuff [4] = byteBuff [7];
+ byteBuff [7] = t;
+
+ t = byteBuff [5];
+ byteBuff [5] = byteBuff [6];
+ byteBuff [6] = t;
+ }
+
+ internal void SetKey (byte[] key)
+ {
+ // NOTE: see Fig. 3, Key schedule calculation, at page 20.
+ Array.Clear (keySchedule, 0, keySchedule.Length);
+
+ int keyBitSize = PC1.Length;
+
+ byte [] keyPC1 = new byte [keyBitSize]; // PC1-permuted key
+ byte [] keyRot = new byte [keyBitSize]; // PC1 & rotated
+
+ int indx = 0;
+
+ foreach (byte bitPos in PC1) {
+ keyPC1 [indx++] = (byte)((key [(int)bitPos >> 3] >> (7 ^ (bitPos & 7))) & 1);
+ }
+
+ int j;
+ for (int i = 0; i < KEY_BYTE_SIZE*2; i++) {
+ int b = keyBitSize >> 1;
+
+ for (j = 0; j < b; j++) {
+ int s = j + (int) leftRotTotal [i];
+ keyRot [j] = keyPC1 [s < b ? s : s - b];
+ }
+
+ for (j = b; j < keyBitSize; j++) {
+ int s = j + (int) leftRotTotal [i];
+ keyRot [j] = keyPC1 [s < keyBitSize ? s : s - b];
+ }
+
+ int keyOffs = i * KEY_BYTE_SIZE;
+
+ j = 0;
+ foreach (byte bitPos in PC2) {
+ if (keyRot [(int)bitPos] != 0) {
+ keySchedule [keyOffs + (j/6)] |= (byte) (0x80 >> ((j % 6) + 2));
+ }
+ j++;
+ }
+ }
+ }
+
+ // public helper for TripleDES
+ public void ProcessBlock (byte[] input, byte[] output)
+ {
+ ECB (input, output);
+ }
+
+ protected override void ECB (byte[] input, byte[] output)
+ {
+ byte [] byteBuff = this.byteBuff;
+ uint [] dwordBuff = this.dwordBuff;
+
+ Permutation (input, byteBuff, ipTab, false);
+ Buffer.BlockCopy (byteBuff, 0, dwordBuff, 0, BLOCK_BYTE_SIZE);
+
+ if (encrypt) {
+ uint d0 = dwordBuff[0];
+ uint d1 = dwordBuff[1];
+
+ // 16 rounds
+ d0 ^= CipherFunct (d1, 0);
+ d1 ^= CipherFunct (d0, 1);
+ d0 ^= CipherFunct (d1, 2);
+ d1 ^= CipherFunct (d0, 3);
+ d0 ^= CipherFunct (d1, 4);
+ d1 ^= CipherFunct (d0, 5);
+ d0 ^= CipherFunct (d1, 6);
+ d1 ^= CipherFunct (d0, 7);
+ d0 ^= CipherFunct (d1, 8);
+ d1 ^= CipherFunct (d0, 9);
+ d0 ^= CipherFunct (d1, 10);
+ d1 ^= CipherFunct (d0, 11);
+ d0 ^= CipherFunct (d1, 12);
+ d1 ^= CipherFunct (d0, 13);
+ d0 ^= CipherFunct (d1, 14);
+ d1 ^= CipherFunct (d0, 15);
+
+ dwordBuff [0] = d1;
+ dwordBuff [1] = d0;
+ }
+ else {
+ uint d1 = dwordBuff [0];
+ uint d0 = dwordBuff [1];
+
+ // 16 rounds in reverse order
+ d1 ^= CipherFunct (d0, 15);
+ d0 ^= CipherFunct (d1, 14);
+ d1 ^= CipherFunct (d0, 13);
+ d0 ^= CipherFunct (d1, 12);
+ d1 ^= CipherFunct (d0, 11);
+ d0 ^= CipherFunct (d1, 10);
+ d1 ^= CipherFunct (d0, 9);
+ d0 ^= CipherFunct (d1, 8);
+ d1 ^= CipherFunct (d0, 7);
+ d0 ^= CipherFunct (d1, 6);
+ d1 ^= CipherFunct (d0, 5);
+ d0 ^= CipherFunct (d1, 4);
+ d1 ^= CipherFunct (d0, 3);
+ d0 ^= CipherFunct (d1, 2);
+ d1 ^= CipherFunct (d0, 1);
+ d0 ^= CipherFunct (d1, 0);
+
+ dwordBuff [0] = d0;
+ dwordBuff [1] = d1;
+ }
+
+ Buffer.BlockCopy (dwordBuff, 0, byteBuff, 0, BLOCK_BYTE_SIZE);
+ Permutation (byteBuff, output, fpTab, true);
+ }
+}
+
+public sealed class DESCryptoServiceProvider : DES {
+
+ public DESCryptoServiceProvider () : base () {}
+
+ public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new DESTransform (this, false, rgbKey, rgbIV);
+ }
+
+ public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new DESTransform (this, true, rgbKey, rgbIV);
+ }
+
+ public override void GenerateIV ()
+ {
+ IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
+ }
+
+ public override void GenerateKey ()
+ {
+ KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
+ while (IsWeakKey (KeyValue) || IsSemiWeakKey (KeyValue))
+ KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
+ }
+
+} // DESCryptoServiceProvider
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSA.cs b/mcs/class/corlib/System.Security.Cryptography/DSA.cs
new file mode 100755
index 00000000000..8b023cab64b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSA.cs
@@ -0,0 +1,201 @@
+//
+// System.Security.Cryptography.DSA.cs class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Text;
+
+// References:
+// a. FIPS PUB 186-2: Digital Signature Standard (DSS)
+// http://csrc.nist.gov/publications/fips/fips186-2/fips186-2-change1.pdf
+
+namespace System.Security.Cryptography
+{
+ internal class DSAHandler : MiniParser.IHandler {
+
+ private DSAParameters dsa;
+ private bool unknown;
+ private byte[] temp;
+
+ public DSAHandler ()
+ {
+ dsa = new DSAParameters();
+ }
+
+ public DSAParameters GetParams ()
+ {
+ return dsa;
+ }
+
+ public void OnStartParsing (MiniParser parser) {}
+
+ public void OnStartElement (string name, MiniParser.IAttrList attrs) {}
+
+ public void OnEndElement (string name)
+ {
+ switch (name) {
+ case "P":
+ dsa.P = temp;
+ break;
+ case "Q":
+ dsa.Q = temp;
+ break;
+ case "G":
+ dsa.G = temp;
+ break;
+ case "J":
+ dsa.J = temp;
+ break;
+ case "Y":
+ dsa.Y = temp;
+ break;
+ case "X":
+ dsa.X = temp;
+ break;
+ case "Seed":
+ dsa.Seed = temp;
+ break;
+ case "PgenCounter":
+ byte[] counter4b = new byte[4];
+ Array.Copy (temp, 0, counter4b, 0, temp.Length);
+ dsa.Counter = BitConverter.ToInt32 (counter4b, 0);
+ break;
+ default:
+ // unknown tag in parameters
+ break;
+ }
+ }
+
+ public void OnChars (string ch)
+ {
+ temp = Convert.FromBase64String (ch);
+ }
+
+ public void OnEndParsing (MiniParser parser) {}
+ }
+
+ /// <summary>
+ /// Abstract base class for all implementations of the DSA algorithm
+ /// </summary>
+ public abstract class DSA : AsymmetricAlgorithm
+ {
+ // LAMESPEC: It says to derive new DSA implemenation from DSA class.
+ // Well it's aint gonna be easy this way.
+ // RSA constructor is public
+ internal DSA () {}
+
+ public static new DSA Create ()
+ {
+ return Create ("System.Security.Cryptography.DSA");
+ }
+
+ public static new DSA Create (string algName)
+ {
+ return (DSA) CryptoConfig.CreateFromName (algName);
+ }
+
+ public abstract byte[] CreateSignature (byte[] rgbHash);
+
+ public abstract DSAParameters ExportParameters (bool includePrivateParameters);
+
+ internal void ZeroizePrivateKey (DSAParameters parameters)
+ {
+ if (parameters.X != null)
+ Array.Clear (parameters.X, 0, parameters.X.Length);
+ }
+
+ public override void FromXmlString (string xmlString)
+ {
+ if (xmlString == null)
+ throw new ArgumentNullException ();
+
+ DSAParameters dsaParams = new DSAParameters ();
+ try {
+ MiniParser parser = new MiniParser ();
+ AsymmetricParameters reader = new AsymmetricParameters (xmlString);
+ DSAHandler handler = new DSAHandler ();
+ parser.Parse(reader, handler);
+ ImportParameters (handler.GetParams ());
+ }
+ catch {
+ ZeroizePrivateKey (dsaParams);
+ throw;
+ }
+ finally {
+ ZeroizePrivateKey (dsaParams);
+ }
+ }
+
+ public abstract void ImportParameters (DSAParameters parameters);
+
+ public override string ToXmlString (bool includePrivateParameters)
+ {
+ StringBuilder sb = new StringBuilder ();
+ DSAParameters dsaParams = ExportParameters (includePrivateParameters);
+ try {
+ sb.Append ("<DSAKeyValue>");
+
+ sb.Append ("<P>");
+ sb.Append (Convert.ToBase64String (dsaParams.P));
+ sb.Append ("</P>");
+
+ sb.Append ("<Q>");
+ sb.Append (Convert.ToBase64String (dsaParams.Q));
+ sb.Append ("</Q>");
+
+ sb.Append ("<G>");
+ sb.Append (Convert.ToBase64String (dsaParams.G));
+ sb.Append ("</G>");
+
+ sb.Append ("<Y>");
+ sb.Append (Convert.ToBase64String (dsaParams.Y));
+ sb.Append( "</Y>");
+
+ sb.Append ("<J>");
+ sb.Append (Convert.ToBase64String (dsaParams.J));
+ sb.Append ("</J>");
+
+ sb.Append ("<Seed>");
+ sb.Append (Convert.ToBase64String (dsaParams.Seed));
+ sb.Append ("</Seed>");
+
+ sb.Append ("<PgenCounter>");
+ // the number of bytes is important (no matter == 0x00)
+ byte[] inArr = BitConverter.GetBytes (dsaParams.Counter);
+ int l = inArr.Length;
+ while (inArr[l-1] == 0x00)
+ l--;
+ byte[] c = new byte[l];
+ Array.Copy (inArr, 0, c, 0, l);
+ sb.Append (Convert.ToBase64String (c));
+ sb.Append ("</PgenCounter>");
+
+ if (dsaParams.X != null) {
+ sb.Append ("<X>");
+ sb.Append (Convert.ToBase64String (dsaParams.X));
+ sb.Append ("</X>");
+ }
+ else if (includePrivateParameters)
+ throw new CryptographicException();
+
+ sb.Append ("</DSAKeyValue>");
+ }
+ catch {
+ ZeroizePrivateKey (dsaParams);
+ throw;
+ }
+
+ return sb.ToString ();
+ }
+
+ public abstract bool VerifySignature (byte[] rgbHash, byte[] rgbSignature);
+
+ } // DSA
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs
new file mode 100644
index 00000000000..ab14af82572
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs
@@ -0,0 +1,463 @@
+//
+// System.Security.Cryptography.DSACryptoServiceProvider.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+// Key generation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
+// See bouncycastle.txt for license.
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography {
+
+public class DSACryptoServiceProvider : DSA {
+
+ private CspParameters cspParams;
+ private RandomNumberGenerator rng;
+
+ private bool privateKeyExportable = true;
+ private bool m_disposed = false;
+ private bool keypairGenerated = false;
+ private bool persistKey = false;
+
+ private BigInteger p;
+ private BigInteger q;
+ private BigInteger g;
+ private BigInteger x; // private key
+ private BigInteger y;
+ private BigInteger j;
+ private BigInteger seed;
+ private int counter;
+
+ public DSACryptoServiceProvider ()
+ {
+ // Here it's not clear if we need to generate a keypair
+ // (note: MS implementation generates a keypair in this case).
+ // However we:
+ // (a) often use this constructor to import an existing keypair.
+ // (b) take a LOT of time to generate the DSA group
+ // So we'll generate the keypair only when (and if) it's being
+ // used (or exported). This should save us a lot of time (at
+ // least in the unit tests).
+ Common (null);
+ }
+
+ public DSACryptoServiceProvider (CspParameters parameters)
+ {
+ Common (parameters);
+ // no keypair generation done at this stage
+ }
+
+ // This constructor will generate a new keypair
+ public DSACryptoServiceProvider (int dwKeySize)
+ {
+ // Here it's clear that we need to generate a new keypair
+ Common (null);
+ Generate (dwKeySize);
+ }
+
+ // This constructor will generate a new keypair
+ public DSACryptoServiceProvider (int dwKeySize, CspParameters parameters)
+ {
+ Common (parameters);
+ Generate (dwKeySize);
+ }
+
+ ~DSACryptoServiceProvider ()
+ {
+ Dispose (false);
+ }
+
+ [MonoTODO("Persistance")]
+ private void Common (CspParameters p)
+ {
+ rng = RandomNumberGenerator.Create ();
+ cspParams = new CspParameters ();
+ if (p == null) {
+ // TODO: set default values (for keypair persistance)
+ }
+ else {
+ cspParams = p;
+ // FIXME: We'll need this to support some kind of persistance
+ throw new NotSupportedException ("CspParameters not supported");
+ }
+ LegalKeySizesValue = new KeySizes [1];
+ LegalKeySizesValue [0] = new KeySizes (512, 1024, 64);
+ }
+
+ // generate both the group and the keypair
+ private void Generate (int keyLength)
+ {
+ // will throw an exception is key size isn't supported
+ base.KeySize = keyLength;
+ GenerateParams (keyLength);
+ GenerateKeyPair ();
+ keypairGenerated = true;
+ }
+
+ // this part is quite fast
+ private void GenerateKeyPair ()
+ {
+ x = new BigInteger ();
+ do {
+ // size of x (private key) isn't affected by the keysize (512-1024)
+ x.genRandomBits (160);
+ }
+ while ((x == 0) || (x >= q));
+
+ // calculate the public key y = g^x % p
+ y = g.modPow (x, p);
+ }
+
+ private void add (byte[] a, byte[] b, int value)
+ {
+ uint x = (uint) ((b [b.Length - 1] & 0xff) + value);
+
+ a [b.Length - 1] = (byte)x;
+ x >>= 8;
+
+ for (int i = b.Length - 2; i >= 0; i--) {
+ x += (uint) (b [i] & 0xff);
+ a [i] = (byte)x;
+ x >>= 8;
+ }
+ }
+
+ private void GenerateParams (int keyLength)
+ {
+ byte[] seed = new byte[20];
+ byte[] part1 = new byte[20];
+ byte[] part2 = new byte[20];
+ byte[] u = new byte[20];
+
+ SHA1 sha = SHA1.Create ();
+
+ int n = (keyLength - 1) / 160;
+ byte[] w = new byte [keyLength / 8];
+ bool primesFound = false;
+ int certainty = 80; // FIPS186-2
+
+ while (!primesFound) {
+ do {
+ rng.GetBytes (seed);
+ part1 = sha.ComputeHash (seed);
+ Array.Copy(seed, 0, part2, 0, seed.Length);
+
+ add (part2, seed, 1);
+
+ part2 = sha.ComputeHash (part2);
+
+ for (int i = 0; i != u.Length; i++)
+ u [i] = (byte)(part1 [i] ^ part2 [i]);
+
+ // first bit must be set (to respect key length)
+ u[0] |= (byte)0x80;
+ // last bit must be set (prime are all odds - except 2)
+ u[19] |= (byte)0x01;
+
+ q = new BigInteger (u);
+ }
+ while (!q.isProbablePrime (certainty));
+
+ counter = 0;
+ int offset = 2;
+ while (counter < 4096) {
+ for (int k = 0; k < n; k++) {
+ add(part1, seed, offset + k);
+ part1 = sha.ComputeHash (part1);
+ Array.Copy (part1, 0, w, w.Length - (k + 1) * part1.Length, part1.Length);
+ }
+
+ add(part1, seed, offset + n);
+ part1 = sha.ComputeHash (part1);
+ Array.Copy (part1, part1.Length - ((w.Length - (n) * part1.Length)), w, 0, w.Length - n * part1.Length);
+
+ w[0] |= (byte)0x80;
+ BigInteger x = new BigInteger (w);
+
+ BigInteger c = x % (q * 2);
+
+ p = x - (c - 1);
+
+ if (p.testBit ((uint)(keyLength - 1))) {
+ if (p.isProbablePrime (certainty)) {
+ primesFound = true;
+ break;
+ }
+ }
+
+ counter += 1;
+ offset += n + 1;
+ }
+ }
+
+ // calculate the generator g
+ BigInteger pMinusOneOverQ = (p - 1) / q;
+ for (;;) {
+ BigInteger h = new BigInteger ();
+ h.genRandomBits (keyLength);
+ if ((h <= 1) || (h >= (p - 1)))
+ continue;
+
+ g = h.modPow (pMinusOneOverQ, p);
+ if (g <= 1)
+ continue;
+ break;
+ }
+
+ this.seed = new BigInteger (seed);
+ j = (p - 1) / q;
+ }
+
+ [MonoTODO()]
+ private bool Validate ()
+ {
+ // J is optional
+ bool okJ = ((j == 0) || (j == ((p - 1) / q)));
+ // TODO: Validate the key parameters (P, Q, G, J) using the Seed and Counter
+ return okJ;
+ }
+
+ // DSA isn't used for key exchange
+ public override string KeyExchangeAlgorithm {
+ get { return ""; }
+ }
+
+ public override int KeySize {
+ get { return p.bitCount (); }
+ }
+
+ public override KeySizes[] LegalKeySizes {
+ get { return LegalKeySizesValue; }
+ }
+
+ public override string SignatureAlgorithm {
+ get { return "http://www.w3.org/2000/09/xmldsig#dsa-sha1"; }
+ }
+
+ [MonoTODO("Persistance")]
+ public bool PersistKeyInCsp {
+ get { return persistKey; }
+ set {
+ persistKey = value;
+ // FIXME: We'll need this to support some kind of persistance
+ if (value)
+ throw new NotSupportedException ("CspParameters not supported");
+ }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // TODO: always zeroize private key
+ if(disposing) {
+ // TODO: Dispose managed resources
+ }
+
+ // TODO: Dispose unmanaged resources
+ }
+ // call base class
+ // no need as they all are abstract before us
+ m_disposed = true;
+ }
+
+ public override byte[] CreateSignature (byte[] rgbHash)
+ {
+ return SignHash (rgbHash, "SHA1");
+ }
+
+ public byte[] SignData (byte[] data)
+ {
+ return SignData (data, 0, data.Length);
+ }
+
+ public byte[] SignData (byte[] data, int offset, int count)
+ {
+ // right now only SHA1 is supported by FIPS186-2
+ HashAlgorithm hash = SHA1.Create ();
+ byte[] toBeSigned = hash.ComputeHash (data, offset, count);
+ return SignHash (toBeSigned, "SHA1");
+ }
+
+ public byte[] SignData (Stream inputStream)
+ {
+ // right now only SHA1 is supported by FIPS186-2
+ HashAlgorithm hash = SHA1.Create ();
+ byte[] toBeSigned = hash.ComputeHash (inputStream);
+ return SignHash (toBeSigned, "SHA1");
+ }
+
+ public byte[] SignHash (byte[] rgbHash, string str)
+ {
+ if (rgbHash == null)
+ throw new ArgumentNullException ();
+ // right now only SHA1 is supported by FIPS186-2
+ if (str.ToUpper () != "SHA1")
+ throw new Exception( ); // not documented
+ if (rgbHash.Length != 20)
+ throw new Exception (); // not documented
+
+ if (!keypairGenerated)
+ Generate (1024);
+
+ BigInteger m = new BigInteger (rgbHash);
+ // (a) Select a random secret integer k; 0 < k < q.
+ BigInteger k = new BigInteger ();
+ k.genRandomBits (160);
+ while (k >= q)
+ k.genRandomBits (160);
+ // (b) Compute r = ( k mod p) mod q
+ BigInteger r = (g.modPow (k, p)) % q;
+ // (c) Compute k -1 mod q (e.g., using Algorithm 2.142).
+ // (d) Compute s = k -1 fh(m) +arg mod q.
+ BigInteger s = (k.modInverse (q) * (m + x * r)) % q;
+ // (e) A’s signature for m is the pair (r; s).
+ byte[] signature = new byte [40];
+ byte[] part1 = r.getBytes ();
+ byte[] part2 = s.getBytes ();
+ Array.Copy (part1, 0, signature, 0, 20);
+ Array.Copy (part2, 0, signature, 20, 20);
+ return signature;
+ }
+
+ public bool VerifyData (byte[] rgbData, byte[] rgbSignature)
+ {
+ // signature is always 40 bytes (no matter the size of the
+ // public key). In fact it is 2 times the size of the private
+ // key (which is 20 bytes for 512 to 1024 bits DSA keypairs)
+ if (rgbSignature.Length != 40)
+ throw new Exception(); // not documented
+ // right now only SHA1 is supported by FIPS186-2
+ HashAlgorithm hash = SHA1.Create();
+ byte[] toBeVerified = hash.ComputeHash (rgbData);
+ return VerifyHash (toBeVerified, "SHA1", rgbSignature);
+ }
+
+ // LAMESPEC: MD5 isn't allowed with DSA
+ public bool VerifyHash (byte[] rgbHash, string str, byte[] rgbSignature)
+ {
+ if (rgbHash == null)
+ throw new ArgumentNullException ("rgbHash");
+ if (rgbSignature == null)
+ throw new ArgumentNullException ("rgbSignature");
+ if (str == null)
+ str = "SHA1"; // default value
+ if (str != "SHA1")
+ throw new CryptographicException ();
+
+ // it would be stupid to verify a signature with a newly
+ // generated keypair - so we return false
+ if (!keypairGenerated)
+ return false;
+
+ try {
+ BigInteger m = new BigInteger (rgbHash);
+ byte[] half = new byte [20];
+ Array.Copy (rgbSignature, 0, half, 0, 20);
+ BigInteger r = new BigInteger (half);
+ Array.Copy (rgbSignature, 20, half, 0, 20);
+ BigInteger s = new BigInteger (half);
+
+ if ((r < 0) || (q <= r))
+ return false;
+
+ if ((s < 0) || (q <= s))
+ return false;
+
+ BigInteger w = s.modInverse(q);
+ BigInteger u1 = m * w % q;
+ BigInteger u2 = r * w % q;
+
+ u1 = g.modPow(u1, p);
+ u2 = y.modPow(u2, p);
+
+ BigInteger v = ((u1 * u2 % p) % q);
+ return (v == r);
+ }
+ catch {
+ throw new CryptographicException ();
+ }
+ }
+
+ public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
+ {
+ return VerifyHash (rgbHash, "SHA1", rgbSignature);
+ }
+
+ private byte[] NormalizeArray (byte[] array)
+ {
+ int n = (array.Length % 4);
+ if (n > 0) {
+ byte[] temp = new byte [array.Length + 4 - n];
+ Array.Copy (array, 0, temp, (4 - n), array.Length);
+ return temp;
+ }
+ else
+ return array;
+ }
+
+ public override DSAParameters ExportParameters (bool includePrivateParameters)
+ {
+ if ((includePrivateParameters) && (!privateKeyExportable))
+ throw new CryptographicException ("cannot export private key");
+ if (!keypairGenerated)
+ Generate (1024);
+
+ DSAParameters param = new DSAParameters();
+ // all parameters must be in multiple of 4 bytes arrays
+ // this isn't (generally) a problem for most of the parameters
+ // except for J (but we won't take a chance)
+ param.P = NormalizeArray (p.getBytes ());
+ param.Q = NormalizeArray (q.getBytes ());
+ param.G = NormalizeArray (g.getBytes ());
+ param.Y = NormalizeArray (y.getBytes ());
+ param.J = NormalizeArray (j.getBytes ());
+ if (seed != 0) {
+ param.Seed = NormalizeArray (seed.getBytes ());
+ param.Counter = counter;
+ }
+ if (includePrivateParameters)
+ param.X = NormalizeArray (x.getBytes ());
+ return param;
+ }
+
+ public override void ImportParameters (DSAParameters parameters)
+ {
+ // if missing "mandatory" parameters
+ if ((parameters.P == null) || (parameters.Q == null) || (parameters.G == null) || (parameters.Y == null))
+ throw new CryptographicException ();
+
+ p = new BigInteger (parameters.P);
+ q = new BigInteger (parameters.Q);
+ g = new BigInteger (parameters.G);
+ y = new BigInteger (parameters.Y);
+ // optional parameter - private key
+ if (parameters.X != null)
+ x = new BigInteger (parameters.X);
+ else
+ x = new BigInteger (0);
+ // optional parameter - pre-computation
+ if (parameters.J != null)
+ j = new BigInteger (parameters.J);
+ else
+ j = (p - 1) / q;
+ // optional - seed and counter must both be present (or absent)
+ if (parameters.Seed != null) {
+ seed = new BigInteger (parameters.Seed);
+ counter = parameters.Counter;
+ }
+ else
+ seed = new BigInteger (0);
+
+ // we now have a keypair
+ keypairGenerated = true;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSAParameters.cs b/mcs/class/corlib/System.Security.Cryptography/DSAParameters.cs
new file mode 100755
index 00000000000..cc8560ddcf2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSAParameters.cs
@@ -0,0 +1,38 @@
+//
+// System.Security.Cryptography DSAParameters.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// DSA Parameters
+ /// </summary>
+ [Serializable]
+ public struct DSAParameters
+ {
+ public int Counter;
+
+ public byte[] G;
+
+ public byte[] J;
+
+ public byte[] P;
+
+ public byte[] Q;
+
+ public byte[] Seed;
+
+ [NonSerialized]
+ public byte[] X;
+
+ public byte[] Y;
+
+ } // DSAParameters
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs
new file mode 100755
index 00000000000..34d099e0987
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs
@@ -0,0 +1,62 @@
+//
+// System.Security.Cryptography DSASignatureDeformatter.cs
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+/// <summary>
+/// DSA Signature Deformatter
+/// </summary>
+public class DSASignatureDeformatter : AsymmetricSignatureDeformatter {
+
+ private DSA dsa;
+
+ public DSASignatureDeformatter () {}
+
+ public DSASignatureDeformatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public override void SetHashAlgorithm (string strName)
+ {
+ if (strName == null)
+ throw new ArgumentNullException ("strName");
+
+ try {
+ // just to test, we don't need the object
+ SHA1 hash = SHA1.Create (strName);
+ }
+ catch {
+ throw new CryptographicUnexpectedOperationException ("DSA requires SHA1");
+ }
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key != null) {
+ // this will throw a InvalidCastException if this isn't
+ // a DSA keypair
+ dsa = (DSA) key;
+ }
+ // here null is accepted!
+ }
+
+ public override bool VerifySignature (byte[] rgbHash, byte[] rgbSignature)
+ {
+ if (dsa == null)
+ throw new CryptographicUnexpectedOperationException ("missing key");
+ return dsa.VerifySignature (rgbHash, rgbSignature);
+ }
+
+} // DSASignatureDeformatter
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs
new file mode 100755
index 00000000000..c2cc7e06fb7
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs
@@ -0,0 +1,62 @@
+//
+// System.Security.Cryptography DSASignatureFormatter.cs
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+/// <summary>
+/// DSA Signature Formatter
+/// </summary>
+public class DSASignatureFormatter : AsymmetricSignatureFormatter {
+
+ private DSA dsa;
+
+ public DSASignatureFormatter () {}
+
+ public DSASignatureFormatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public override byte[] CreateSignature (byte[] rgbHash)
+ {
+ if (dsa == null)
+ throw new CryptographicUnexpectedOperationException ("missing key");
+ return dsa.CreateSignature (rgbHash);
+ }
+
+ public override void SetHashAlgorithm (string strName)
+ {
+ if (strName == null)
+ throw new ArgumentNullException ("strName");
+
+ try {
+ // just to test, we don't need the object
+ SHA1 hash = SHA1.Create (strName);
+ }
+ catch {
+ throw new CryptographicUnexpectedOperationException ("DSA requires SHA1");
+ }
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key != null) {
+ // this will throw a InvalidCastException if this isn't
+ // a DSA keypair
+ dsa = (DSA) key;
+ }
+ // here null is accepted!
+ }
+
+} // DSASignatureFormatter
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs b/mcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs
new file mode 100755
index 00000000000..048c4182cd7
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs
@@ -0,0 +1,27 @@
+//
+// System.Security.Cryptography DeriveBytes.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// Abstract base class for all classes that derive byte information from an integer
+ /// </summary>
+ public abstract class DeriveBytes
+ {
+
+ protected DeriveBytes() {}
+
+ public abstract byte[] GetBytes(int cb);
+
+ public abstract void Reset();
+
+ } // DeriveBytes
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs b/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
new file mode 100644
index 00000000000..375c42d5510
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
@@ -0,0 +1,286 @@
+//
+// System.Security.Cryptography.FromBase64Transform
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [Serializable]
+ public enum FromBase64TransformMode : int {
+ IgnoreWhiteSpaces,
+ DoNotIgnoreWhiteSpaces
+ }
+
+ public class FromBase64Transform : ICryptoTransform {
+
+ private FromBase64TransformMode mode;
+ private byte [] accumulator;
+ private byte [] filterBuffer;
+ private int accPtr;
+ private bool m_disposed;
+
+
+ /// <summary>
+ /// Creates a new instance of the decoder
+ /// with the default transformation mode (IgnoreWhiteSpaces).
+ /// </summary>
+ public FromBase64Transform ()
+ : this (FromBase64TransformMode.IgnoreWhiteSpaces)
+ {
+ }
+
+
+ /// <summary>
+ /// Creates a new instance of the decoder
+ /// with the specified transformation mode.
+ /// </summary>
+ public FromBase64Transform (FromBase64TransformMode mode)
+ {
+ this.mode = mode;
+ accumulator = new byte [4];
+ filterBuffer = new byte [4];
+ accPtr = 0;
+ m_disposed = false;
+ }
+
+ ~FromBase64Transform ()
+ {
+ Dispose (false);
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public bool CanTransformMultipleBlocks {
+ get {
+ return false;
+ }
+ }
+
+ public virtual bool CanReuseTransform {
+ get { return false; }
+ }
+
+ /// <summary>
+ /// Returns the input block size for the Base64 decoder.
+ /// </summary>
+ /// <remarks>
+ /// The input block size for Base64 decoder is always 1 byte.
+ /// </remarks>
+ public int InputBlockSize {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Returns the output block size for the Base64 decoder.
+ /// </summary>
+ /// <remarks>
+ /// The value returned by this property is always 3.
+ /// </remarks>
+ public int OutputBlockSize {
+ get {
+ return 3;
+ }
+ }
+
+ public void Clear()
+ {
+ Dispose (true);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // dispose unmanaged objects
+ if (disposing) {
+ // dispose managed objects
+ }
+ m_disposed = true;
+ }
+ }
+
+ private int Filter (byte [] buffer, int offset, int count)
+ {
+ int end = offset + count;
+ int len = filterBuffer.Length;
+ int ptr = 0;
+ byte [] filter = this.filterBuffer;
+
+ for (int i = offset; i < end; i++) {
+ byte b = buffer [i];
+ if (!Char.IsWhiteSpace ((char) b)) {
+ if (ptr >= len) {
+ len <<= 1;
+ this.filterBuffer = new byte [len];
+ Array.Copy(filter, 0, this.filterBuffer, 0, len >> 1);
+ filter = this.filterBuffer;
+ }
+ filter [ptr++] = b;
+ }
+ }
+
+ return ptr;
+ }
+
+
+ private int DoTransform (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte [] outputBuffer,
+ int outputOffset)
+ {
+ int full = inputCount >> 2;
+ if (full == 0) return 0;
+
+ int rem = 0;
+
+ if (inputBuffer[inputCount - 1] == (byte)'=') {
+ ++rem;
+ --full;
+ }
+
+ if (inputBuffer[inputCount - 2] == (byte)'=') ++rem;
+
+ byte [] lookup = Base64Table.DecodeTable;
+ int b0,b1,b2,b3;
+
+ for (int i = 0; i < full; i++) {
+ b0 = lookup [inputBuffer [inputOffset++]];
+ b1 = lookup [inputBuffer [inputOffset++]];
+ b2 = lookup [inputBuffer [inputOffset++]];
+ b3 = lookup [inputBuffer [inputOffset++]];
+
+ outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
+ outputBuffer [outputOffset++] = (byte) ((b1 << 4) | (b2 >> 2));
+ outputBuffer [outputOffset++] = (byte) ((b2 << 6) | b3);
+ }
+
+ int res = full * 3;
+
+ switch (rem) {
+ case 0:
+ break;
+ case 1:
+ b0 = lookup [inputBuffer [inputOffset++]];
+ b1 = lookup [inputBuffer [inputOffset++]];
+ b2 = lookup [inputBuffer [inputOffset++]];
+ outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
+ outputBuffer [outputOffset++] = (byte) ((b1 << 4) | (b2 >> 2));
+ res += 2;
+ break;
+ case 2:
+ b0 = lookup [inputBuffer [inputOffset++]];
+ b1 = lookup [inputBuffer [inputOffset++]];
+ outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
+ ++res;
+ break;
+ default:
+ break;
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public int TransformBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte [] outputBuffer,
+ int outputOffset)
+ {
+ int n;
+ byte [] src;
+ int srcOff;
+ int res = 0;
+
+ if (mode == FromBase64TransformMode.IgnoreWhiteSpaces) {
+ n = Filter (inputBuffer, inputOffset, inputCount);
+ src = filterBuffer;
+ srcOff = 0;
+ } else {
+ n = inputCount;
+ src = inputBuffer;
+ srcOff = inputOffset;
+ }
+
+
+ int count = accPtr + n;
+
+ if (count < 4) {
+ Array.Copy (src, srcOff, accumulator, accPtr, n);
+ accPtr = count;
+ } else {
+ byte [] tmpBuff = new byte [count];
+ Array.Copy (accumulator, 0, tmpBuff, 0, accPtr);
+ Array.Copy (src, srcOff, tmpBuff, accPtr, n);
+ accPtr = count & 3;
+ Array.Copy (src, srcOff + (n - accPtr), accumulator, 0, accPtr);
+ res = DoTransform (tmpBuff, 0, count & (~3), outputBuffer, outputOffset);
+ }
+
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public byte [] TransformFinalBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount)
+ {
+ byte [] src;
+ int srcOff;
+ int n;
+
+ if (mode == FromBase64TransformMode.IgnoreWhiteSpaces) {
+ n = Filter (inputBuffer, inputOffset, inputCount);
+ src = filterBuffer;
+ srcOff = 0;
+ } else {
+ n = inputCount;
+ src = inputBuffer;
+ srcOff = inputOffset;
+ }
+
+
+ int dataLen = accPtr + n;
+ byte [] tmpBuf = new byte [dataLen];
+
+ int resLen = ((dataLen) >> 2) * 3;
+ byte [] res = new byte [resLen];
+
+ Array.Copy (accumulator, 0, tmpBuf, 0, accPtr);
+ Array.Copy (src, srcOff, tmpBuf, accPtr, n);
+
+ int actLen = DoTransform (tmpBuf, 0, dataLen, res, 0);
+
+ accPtr = 0;
+
+ if (actLen < resLen) {
+ byte [] newres = new byte [actLen];
+
+ Array.Copy (res, newres, actLen);
+ return newres;
+ } else
+ return res;
+ }
+
+ } // FromBase64Transform
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs b/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs
new file mode 100644
index 00000000000..71294a57cf0
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/HMACSHA1.cs
@@ -0,0 +1,205 @@
+//
+// HMACSHA1.cs: Handles HMAC with SHA-1
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 198: The Keyed-Hash Message Authentication Code (HMAC), 2002 March.
+// http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf
+// b. Internet RFC 2104, HMAC, Keyed-Hashing for Message Authentication
+// (include C source for HMAC-MD5)
+// http://www.ietf.org/rfc/rfc2104.txt
+// c. IETF RFC2202: Test Cases for HMAC-MD5 and HMAC-SHA-1
+// (include C source for HMAC-MD5 and HAMAC-SHA1)
+// http://www.ietf.org/rfc/rfc2202.txt
+// d. ANSI X9.71, Keyed Hash Message Authentication Code.
+// not free :-(
+// http://webstore.ansi.org/ansidocstore/product.asp?sku=ANSI+X9%2E71%2D2000
+
+// Generic HMAC mechanisms - most of HMAC work is done in here.
+// It should work with any hash function e.g. MD5 for HMACMD5 (RFC2104)
+internal class HMACAlgorithm {
+ private byte[] key;
+ private byte[] hash;
+ private HashAlgorithm algo;
+ private string hashName;
+ private BlockProcessor block;
+
+ public HMACAlgorithm (string algoName)
+ {
+ CreateHash (algoName);
+ }
+
+ ~HMACAlgorithm ()
+ {
+ Dispose ();
+ }
+
+ private void CreateHash (string algoName)
+ {
+ algo = HashAlgorithm.Create (algoName);
+ hashName = algoName;
+ block = new BlockProcessor (algo, 8);
+ }
+
+ public void Dispose ()
+ {
+ if (key != null)
+ Array.Clear (key, 0, key.Length);
+ }
+
+ public HashAlgorithm Algo {
+ get { return algo; }
+ }
+
+ public string HashName {
+ get { return hashName; }
+ set { CreateHash (value); }
+ }
+
+ public byte[] Key {
+ get { return key; }
+ set {
+ if ((value != null) && (value.Length > 64))
+ key = algo.ComputeHash (value);
+ else
+ key = (byte[]) value.Clone();
+ }
+ }
+
+ public void Initialize ()
+ {
+ hash = null;
+ block.Initialize ();
+ byte[] buf = KeySetup (key, 0x36);
+ algo.Initialize ();
+ block.Core (buf);
+ // zeroize key
+ Array.Clear (buf, 0, buf.Length);
+ }
+
+ private byte[] KeySetup (byte[] key, byte padding)
+ {
+ byte[] buf = new byte [64];
+
+ for (int i = 0; i < key.Length; ++i)
+ buf [i] = (byte) ((byte) key [i] ^ padding);
+
+ for (int i = key.Length; i < 64; ++i)
+ buf [i] = padding;
+
+ return buf;
+ }
+
+ public void Core (byte[] rgb, int ib, int cb)
+ {
+ block.Core (rgb, ib, cb);
+ }
+
+ public byte[] Final ()
+ {
+ block.Final ();
+ byte[] intermediate = algo.Hash;
+
+ byte[] buf = KeySetup (key, 0x5C);
+ algo.Initialize ();
+ algo.TransformBlock (buf, 0, buf.Length, buf, 0);
+ algo.TransformFinalBlock (intermediate, 0, intermediate.Length);
+ hash = algo.Hash;
+ algo.Clear ();
+ // zeroize sensitive data
+ Array.Clear (buf, 0, buf.Length);
+ Array.Clear (intermediate, 0, intermediate.Length);
+ return hash;
+ }
+}
+
+public class HMACSHA1: KeyedHashAlgorithm {
+ private HMACAlgorithm hmac;
+ private bool m_disposed;
+
+ public HMACSHA1 () : this (KeyBuilder.Key (8)) {}
+
+ public HMACSHA1 (byte[] rgbKey) : base ()
+ {
+ hmac = new HMACAlgorithm ("SHA1");
+ HashSizeValue = 160;
+ Key = rgbKey;
+ m_disposed = false;
+ }
+
+ ~HMACSHA1 ()
+ {
+ Dispose (false);
+ }
+
+ public override byte[] Key {
+ get { return base.Key; }
+ set {
+ hmac.Key = value;
+ base.Key = value;
+ }
+ }
+
+ public string HashName {
+ get { return hmac.HashName; }
+ set {
+ // only if its not too late for a change
+ if (State == 0)
+ hmac.HashName = value;
+ }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ if (hmac != null)
+ hmac.Dispose();
+ base.Dispose (disposing);
+ m_disposed = true;
+ }
+ }
+
+ public override void Initialize ()
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("HMACSHA1");
+ // let us throw an exception if hash name is invalid
+ // for HMACSHA1 (obviously this can't be done by the
+ // generic HMAC class)
+ if (! (hmac.Algo is SHA1))
+ throw new InvalidCastException ();
+ State = 0;
+ hmac.Initialize ();
+ }
+
+ protected override void HashCore (byte[] rgb, int ib, int cb)
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("HMACSHA1");
+ if (State == 0) {
+ Initialize ();
+ State = 1;
+ }
+ hmac.Core (rgb, ib, cb);
+ }
+
+ protected override byte[] HashFinal ()
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("HMACSHA1");
+ State = 0;
+ return hmac.Final ();
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs
new file mode 100644
index 00000000000..5e7580b1fdd
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs
@@ -0,0 +1,195 @@
+//
+// System.Security.Cryptography HashAlgorithm Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.IO;
+
+namespace System.Security.Cryptography {
+ public abstract class HashAlgorithm : ICryptoTransform {
+ protected byte[] HashValue; // Caches the hash after it is calculated. Accessed through the Hash property.
+ protected int HashSizeValue; // The size of the hash in bits.
+ protected int State; // nonzero when in use; zero when not in use
+ private bool disposed;
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected HashAlgorithm ()
+ {
+ disposed = false;
+ }
+
+ /// <summary>
+ /// Get whether or not the hash can transform multiple blocks at a time.
+ /// Note: MUST be overriden if descendant can transform multiple block
+ /// on a single call!
+ /// </summary>
+ public virtual bool CanTransformMultipleBlocks {
+ get { return true; }
+ }
+
+ public virtual bool CanReuseTransform {
+ get { return true; }
+ }
+
+ public void Clear()
+ {
+ // same as System.IDisposable.Dispose() which is documented
+ Dispose (true);
+ }
+
+ /// <summary>
+ /// Computes the entire hash of all the bytes in the byte array.
+ /// </summary>
+ public byte[] ComputeHash (byte[] input)
+ {
+ return ComputeHash (input, 0, input.Length);
+ }
+
+ public byte[] ComputeHash (byte[] buffer, int offset, int count)
+ {
+ if (disposed)
+ throw new ObjectDisposedException ("HashAlgorithm");
+
+ HashCore (buffer, offset, count);
+ HashValue = HashFinal ();
+ Initialize ();
+
+ return HashValue;
+ }
+
+ public byte[] ComputeHash (Stream inputStream)
+ {
+ // don't read stream unless object is ready to use
+ if (disposed)
+ throw new ObjectDisposedException ("HashAlgorithm");
+
+ int l = (int) (inputStream.Length - inputStream.Position);
+ byte[] buffer = new byte [l];
+ inputStream.Read (buffer, 0, l);
+
+ return ComputeHash (buffer, 0, l);
+ }
+
+ /// <summary>
+ /// Creates the default implementation of the default hash algorithm (SHA1).
+ /// </summary>
+ public static HashAlgorithm Create ()
+ {
+ return Create ("System.Security.Cryptography.HashAlgorithm");
+ }
+
+ /// <summary>
+ /// Creates a specific implementation of the general hash idea.
+ /// </summary>
+ /// <param name="hashName">Specifies which derived class to create.</param>
+ public static HashAlgorithm Create (string hashName)
+ {
+ return (HashAlgorithm) CryptoConfig.CreateFromName (hashName);
+ }
+
+ /// <summary>
+ /// Gets the previously computed hash.
+ /// </summary>
+ public virtual byte[] Hash {
+ get {
+ if (HashValue == null)
+ throw new CryptographicUnexpectedOperationException ();
+ return HashValue;
+ }
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, drives the hashing function.
+ /// </summary>
+ /// <param name="rgb"></param>
+ /// <param name="start"></param>
+ /// <param name="size"></param>
+ protected abstract void HashCore (byte[] rgb, int start, int size);
+
+ /// <summary>
+ /// When overridden in a derived class, this pads and hashes whatever data might be left in the buffers and then returns the hash created.
+ /// </summary>
+ protected abstract byte[] HashFinal ();
+
+ /// <summary>
+ /// Returns the size in bits of the hash.
+ /// </summary>
+ public virtual int HashSize {
+ get { return HashSizeValue; }
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, initializes the object to prepare for hashing.
+ /// </summary>
+ public abstract void Initialize ();
+
+ protected virtual void Dispose (bool disposing)
+ {
+ disposed = true;
+ }
+
+ /// <summary>
+ /// Must be overriden if not 1
+ /// </summary>
+ public virtual int InputBlockSize {
+ get { return 1; }
+ }
+
+ /// <summary>
+ /// Must be overriden if not 1
+ /// </summary>
+ public virtual int OutputBlockSize {
+ get { return 1; }
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ /// <summary>
+ /// Used for stream chaining. Computes hash as data passes through it.
+ /// </summary>
+ /// <param name="inputBuffer">The buffer from which to grab the data to be copied.</param>
+ /// <param name="inputOffset">The offset into the input buffer to start reading at.</param>
+ /// <param name="inputCount">The number of bytes to be copied.</param>
+ /// <param name="outputBuffer">The buffer to write the copied data to.</param>
+ /// <param name="outputOffset">At what point in the outputBuffer to write the data at.</param>
+ public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
+ {
+ Buffer.BlockCopy (inputBuffer, inputOffset, outputBuffer, outputOffset, inputCount);
+ HashCore (inputBuffer, inputOffset, inputCount);
+
+ return inputCount;
+ }
+
+ /// <summary>
+ /// Used for stream chaining. Computes hash as data passes through it. Finishes off the hash.
+ /// </summary>
+ /// <param name="inputBuffer">The buffer from which to grab the data to be copied.</param>
+ /// <param name="inputOffset">The offset into the input buffer to start reading at.</param>
+ /// <param name="inputCount">The number of bytes to be copied.</param>
+ public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ byte[] outputBuffer = new byte[inputCount];
+
+ Buffer.BlockCopy (inputBuffer, inputOffset, outputBuffer, 0, inputCount);
+
+ HashCore (inputBuffer, inputOffset, inputCount);
+ HashValue = HashFinal ();
+ Initialize ();
+
+ return outputBuffer;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs b/mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs
new file mode 100644
index 00000000000..18a5836fef8
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs
@@ -0,0 +1,50 @@
+//
+// System.Security.Cryptography ICryptoTransform interface
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+/// <summary>
+/// Crytographic functions that can process a stream of bytes implement this interface.
+/// This works by stringing together one or more ICryptoTransform classes with a stream.
+/// Data is passed from one to the next without the need of outside buffering/intervention.
+/// </summary>
+public interface ICryptoTransform : IDisposable {
+
+ bool CanReuseTransform {get;}
+
+ /// <summary>
+ /// Whether the function can transform multiple blocks at a time.
+ /// </summary>
+ bool CanTransformMultipleBlocks {get;}
+
+ /// <summary>
+ /// Size of input blocks for the function in bytes.
+ /// </summary>
+ int InputBlockSize {get;}
+
+ /// <summary>
+ /// Size of the output blocks of the function in bytes.
+ /// </summary>
+ int OutputBlockSize {get;}
+
+ /// <summary>
+ /// FIXME: Process some data. A block at a time? Less than a block at a time?
+ /// </summary>
+ int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset);
+
+ /// <summary>
+ /// Processes the final part of the data. Also finalizes the function if needed.
+ /// </summary>
+ byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount);
+}
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/KeySizes.cs b/mcs/class/corlib/System.Security.Cryptography/KeySizes.cs
new file mode 100644
index 00000000000..6bdb2b658f3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/KeySizes.cs
@@ -0,0 +1,61 @@
+//
+// System.Security.Cryptography KeySizes Class implementation
+//
+// Author:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// This class represents valid ranges of key sizes for ciphers. It is also used to represent block sizes in the same fashion for block ciphers.
+ /// </summary>
+ public class KeySizes {
+ private int _maxSize;
+ private int _minSize;
+ private int _skipSize;
+
+ /// <summary>
+ /// Creates a new KeySizes object.
+ /// </summary>
+ /// <param name="minSize">The minimum size key allowed for this cipher in bits.</param>
+ /// <param name="maxSize">The maximum size key allowed for this cipher in bits.</param>
+ /// <param name="skipSize">The jump/skip between the valid key sizes in bits.</param>
+ public KeySizes (int minSize, int maxSize, int skipSize) {
+ _maxSize = maxSize;
+ _minSize = minSize;
+ _skipSize = skipSize;
+ }
+
+ /// <summary>
+ /// Returns the maximum valid key size in bits;
+ /// </summary>
+ public int MaxSize {
+ get {
+ return _maxSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns the minimum valid key size in bits;
+ /// </summary>
+ public int MinSize {
+ get {
+ return _minSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns the skip between valid key sizes in bits;
+ /// </summary>
+ public int SkipSize {
+ get {
+ return _skipSize;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/KeyedHashAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/KeyedHashAlgorithm.cs
new file mode 100644
index 00000000000..682dcb3d49d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/KeyedHashAlgorithm.cs
@@ -0,0 +1,73 @@
+//
+// KeyedHashAlgorithm.cs: Handles keyed hash and MAC classes.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+public abstract class KeyedHashAlgorithm : HashAlgorithm {
+
+ protected byte[] KeyValue;
+
+ protected KeyedHashAlgorithm () : base ()
+ {
+ // create a random 64 bits key
+ }
+
+ ~KeyedHashAlgorithm ()
+ {
+ Dispose (false);
+ }
+
+ public virtual byte[] Key {
+ get {
+ return (byte[]) KeyValue.Clone ();
+ }
+ set {
+ // can't change the key during a hashing ops
+ if (State != 0)
+ throw new CryptographicException ();
+ // zeroize current key material for security
+ ZeroizeKey ();
+ // copy new key
+ KeyValue = (byte[]) value.Clone ();
+ }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ // zeroize key material for security
+ ZeroizeKey();
+ // dispose managed resources
+ // none so far
+ // dispose unmanaged resources
+ // none so far
+ // calling base class HashAlgorithm
+ base.Dispose (disposing);
+ }
+
+ private void ZeroizeKey()
+ {
+ if (KeyValue != null)
+ Array.Clear (KeyValue, 0, KeyValue.Length);
+ }
+
+ public static new KeyedHashAlgorithm Create ()
+ {
+ return Create ("System.Security.Cryptography.KeyedHashAlgorithm");
+ }
+
+ public static new KeyedHashAlgorithm Create (string algName)
+ {
+ return (KeyedHashAlgorithm) CryptoConfig.CreateFromName (algName);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/MACTripleDES.cs b/mcs/class/corlib/System.Security.Cryptography/MACTripleDES.cs
new file mode 100644
index 00000000000..a64d8dd9cf2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MACTripleDES.cs
@@ -0,0 +1,163 @@
+//
+// MACTripleDES.cs: Handles MAC with TripleDES
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 81: DES MODES OF OPERATION
+// MAC: Appendix F (MACDES not MACTripleDES but close enough ;-)
+// http://www.itl.nist.gov/fipspubs/fip81.htm
+
+// Generic MAC mechanims - most of the work is done in here
+// It should work with any symmetric algorithm function e.g. DES for MACDES (fips81)
+internal class MACAlgorithm {
+ private SymmetricAlgorithm algo;
+ private ICryptoTransform enc;
+ private BlockProcessor block;
+
+ public MACAlgorithm (SymmetricAlgorithm algorithm)
+ {
+ algo = (SymmetricAlgorithm) algorithm;
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.IV = new byte [(algo.BlockSize >> 3)];
+ }
+
+ public void Initialize (byte[] key)
+ {
+ algo.Key = key;
+ // note: the encryptor transform amy be reused - see Final
+ if (enc == null) {
+ enc = algo.CreateEncryptor ();
+ block = new BlockProcessor (enc);
+ }
+ block.Initialize ();
+ }
+
+ public void Core (byte[] rgb, int ib, int cb)
+ {
+ block.Core (rgb, ib, cb);
+ }
+
+ public byte[] Final ()
+ {
+ byte[] mac = block.Final ();
+ if (!enc.CanReuseTransform) {
+ enc.Dispose();
+ enc = null;
+ }
+ return mac;
+ }
+}
+
+// LAMESPEC: MACTripleDES == MAC-CBC using TripleDES (not MAC-CFB).
+public class MACTripleDES: KeyedHashAlgorithm {
+
+ private TripleDES tdes;
+ private MACAlgorithm mac;
+ private bool m_disposed;
+
+ public MACTripleDES ()
+ {
+ Setup ("TripleDES", null);
+ }
+
+ public MACTripleDES (byte[] rgbKey)
+ {
+ if (rgbKey == null)
+ throw new ArgumentNullException ("rgbKey");
+ Setup ("TripleDES", rgbKey);
+ }
+
+ public MACTripleDES (string strTripleDES, byte[] rgbKey)
+ {
+ if (rgbKey == null)
+ throw new ArgumentNullException ("rgbKey");
+ if (strTripleDES == null)
+ Setup ("TripleDES", rgbKey);
+ else
+ Setup (strTripleDES, rgbKey);
+ }
+
+ private void Setup (string strTripleDES, byte[] rgbKey)
+ {
+ tdes = TripleDES.Create (strTripleDES);
+ // if rgbKey is null we keep the randomly generated key
+ if (rgbKey != null) {
+ // this way we get the TripleDES key validation (like weak
+ // and semi-weak keys)
+ tdes.Key = rgbKey;
+ }
+ HashSizeValue = tdes.BlockSize;
+ // we use Key property to get the additional validations
+ // (from KeyedHashAlgorithm ancestor)
+ Key = tdes.Key;
+ mac = new MACAlgorithm (tdes);
+ m_disposed = false;
+ }
+
+ ~MACTripleDES ()
+ {
+ Dispose (false);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // note: we ALWAYS zeroize keys (disposing or not)
+
+ // clear our copy of the secret key
+ if (KeyValue != null)
+ Array.Clear (KeyValue, 0, KeyValue.Length);
+ // clear the secret key (inside TripleDES)
+ if (tdes != null)
+ tdes.Clear ();
+
+ if (disposing) {
+ // disposed managed stuff
+ KeyValue = null;
+ tdes = null;
+ }
+ // ancestor
+ base.Dispose (disposing);
+ m_disposed = true;
+ }
+ }
+
+ public override void Initialize ()
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("MACTripleDES");
+ State = 0;
+ mac.Initialize (KeyValue);
+ }
+
+ protected override void HashCore (byte[] rgb, int ib, int cb)
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("MACTripleDES");
+ if (State == 0) {
+ Initialize ();
+ State = 1;
+ }
+ mac.Core (rgb, ib, cb);
+ }
+
+ protected override byte[] HashFinal ()
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("MACTripleDES");
+ State = 0;
+ return mac.Final ();
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/MD5.cs b/mcs/class/corlib/System.Security.Cryptography/MD5.cs
new file mode 100644
index 00000000000..9a6ff54759d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MD5.cs
@@ -0,0 +1,47 @@
+//
+// System.Security.Cryptography MD5 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+ /// <summary>
+ /// Common base class for all derived MD5 implementations.
+ /// </summary>
+ public abstract class MD5 : HashAlgorithm {
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ // Why is it protected when others abstract hash classes are public ?
+ protected MD5 ()
+ {
+ HashSizeValue = 128;
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new MD5 Create ()
+ {
+ return Create ("System.Security.Cryptography.MD5");
+ }
+
+ /// <summary>
+ /// Creates a new derived implementation.
+ /// </summary>
+ /// <param name="hashName">Specifies which derived class to create</param>
+ public static new MD5 Create (string hashName)
+ {
+ return (MD5) CryptoConfig.CreateFromName (hashName);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs
new file mode 100644
index 00000000000..67bcd81fa6b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs
@@ -0,0 +1,495 @@
+//
+// System.Security.Cryptography MD5CryptoServiceProvider Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// C# implementation of the MD5 cryptographic hash function.
+ /// </summary>
+ public class MD5CryptoServiceProvider : MD5 {
+ private const int BLOCK_SIZE_BYTES = 64;
+ private const int HASH_SIZE_BYTES = 16;
+ private const int HASH_SIZE_BITS = 128;
+ [CLSCompliant(false)] private uint[] _H;
+ [CLSCompliant(false)] private uint count;
+ private byte[] _ProcessingBuffer; // Used to start data when passed less than a block worth.
+ private int _ProcessingBufferCount; // Counts how much data we have stored that still needs processed.
+
+ /// <summary>
+ /// Creates a new MD5CryptoServiceProvider.
+ /// </summary>
+ public MD5CryptoServiceProvider ()
+ {
+ _H = new uint[4];
+ HashSizeValue = HASH_SIZE_BITS;
+ _ProcessingBuffer = new byte[BLOCK_SIZE_BYTES];
+
+ Initialize();
+ }
+
+ ~MD5CryptoServiceProvider ()
+ {
+ Dispose (false);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ // nothing to do (managed implementation)
+ }
+
+ /// <summary>
+ /// Drives the hashing function.
+ /// </summary>
+ /// <param name="rgb">Byte array containing the data to hash.</param>
+ /// <param name="start">Where in the input buffer to start.</param>
+ /// <param name="size">Size in bytes of the data in the buffer to hash.</param>
+ protected override void HashCore (byte[] rgb, int start, int size)
+ {
+ int i;
+ State = 1;
+
+ if (_ProcessingBufferCount != 0) {
+ if (size < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, size);
+ _ProcessingBufferCount += size;
+ return;
+ }
+ else {
+ i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, i);
+ ProcessBlock (_ProcessingBuffer, 0);
+ _ProcessingBufferCount = 0;
+ start += i;
+ size -= i;
+ }
+ }
+
+ for (i=0; i<size-size%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, start+i);
+ }
+
+ if (size%BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, size-size%BLOCK_SIZE_BYTES+start, _ProcessingBuffer, 0, size%BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = size%BLOCK_SIZE_BYTES;
+ }
+ }
+
+ /// <summary>
+ /// This finalizes the hash. Takes the data from the chaining variables and returns it.
+ /// </summary>
+ protected override byte[] HashFinal ()
+ {
+ byte[] hash = new byte[16];
+ int i, j;
+
+ ProcessFinalBlock(_ProcessingBuffer, 0, _ProcessingBufferCount);
+
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
+ hash[i*4+j] = (byte)(_H[i] >> j*8);
+ }
+ }
+
+ return hash;
+ }
+
+ /// <summary>
+ /// Resets the class after use. Called automatically after hashing is done.
+ /// </summary>
+ public override void Initialize ()
+ {
+ count = 0;
+ _ProcessingBufferCount = 0;
+
+ _H[0] = 0x67452301;
+ _H[1] = 0xefcdab89;
+ _H[2] = 0x98badcfe;
+ _H[3] = 0x10325476;
+ }
+
+ /// <summary>
+ /// This is the meat of the hash function. It is what processes each block one at a time.
+ /// </summary>
+ /// <param name="inputBuffer">Byte array to process data from.</param>
+ /// <param name="inputOffset">Where in the byte array to start processing.</param>
+ private void ProcessBlock (byte[] inputBuffer, int inputOffset)
+ {
+ uint[] buff = new uint[16];
+ uint a, b, c, d;
+ int i;
+
+ count += BLOCK_SIZE_BYTES;
+
+ for (i=0; i<16; i++) {
+ buff[i] = (uint)(inputBuffer[inputOffset+4*i])
+ | (((uint)(inputBuffer[inputOffset+4*i+1])) << 8)
+ | (((uint)(inputBuffer[inputOffset+4*i+2])) << 16)
+ | (((uint)(inputBuffer[inputOffset+4*i+3])) << 24);
+ }
+
+ a = _H[0];
+ b = _H[1];
+ c = _H[2];
+ d = _H[3];
+
+ // This function was unrolled because it seems to be doubling our performance with current compiler/VM.
+ // Possibly roll up if this changes.
+
+
+ // ---- Round 1 --------
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C0 + buff [0];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C1 + buff [1];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C2 + buff [2];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C3 + buff [3];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C4 + buff [4];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C5 + buff [5];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C6 + buff [6];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C7 + buff [7];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C8 + buff [8];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C9 + buff [9];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C10 + buff [10];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C11 + buff [11];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C12 + buff [12];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C13 + buff [13];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C14 + buff [14];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C15 + buff [15];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+
+ // ---- Round 2 --------
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C16 + buff [1];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C17 + buff [6];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C18 + buff [11];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C19 + buff [0];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C20 + buff [5];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C21 + buff [10];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C22 + buff [15];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C23 + buff [4];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C24 + buff [9];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C25 + buff [14];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C26 + buff [3];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C27 + buff [8];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C28 + buff [13];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C29 + buff [2];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C30 + buff [7];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C31 + buff [12];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+
+ // ---- Round 3 --------
+
+ a += (b ^ c ^ d) + (uint) Constants.C32 + buff [5];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C33 + buff [8];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C34 + buff [11];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C35 + buff [14];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+ a += (b ^ c ^ d) + (uint) Constants.C36 + buff [1];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C37 + buff [4];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C38 + buff [7];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C39 + buff [10];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+ a += (b ^ c ^ d) + (uint) Constants.C40 + buff [13];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C41 + buff [0];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C42 + buff [3];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C43 + buff [6];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+ a += (b ^ c ^ d) + (uint) Constants.C44 + buff [9];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C45 + buff [12];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C46 + buff [15];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C47 + buff [2];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+
+ // ---- Round 4 --------
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C48 + buff [0];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C49 + buff [7];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C50 + buff [14];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C51 + buff [5];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C52 + buff [12];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C53 + buff [3];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C54 + buff [10];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C55 + buff [1];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C56 + buff [8];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C57 + buff [15];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C58 + buff [6];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C59 + buff [13];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C60 + buff [4];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C61 + buff [11];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C62 + buff [2];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C63 + buff [9];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+
+ _H[0] += a;
+ _H[1] += b;
+ _H[2] += c;
+ _H[3] += d;
+ }
+
+ /// <summary>
+ /// Pads and then processes the final block.
+ /// </summary>
+ /// <param name="inputBuffer">Buffer to grab data from.</param>
+ /// <param name="inputOffset">Position in buffer in bytes to get data from.</param>
+ /// <param name="inputCount">How much data in bytes in the buffer to use.</param>
+ private void ProcessFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ byte[] fooBuffer;
+ int paddingSize;
+ int i;
+ uint size;
+
+ paddingSize = (int)(56 - (inputCount + count) % BLOCK_SIZE_BYTES);
+
+ if (paddingSize < 1)
+ paddingSize += BLOCK_SIZE_BYTES;
+
+
+ fooBuffer = new byte[inputCount+paddingSize+8];
+
+ for (i=0; i<inputCount; i++) {
+ fooBuffer[i] = inputBuffer[i+inputOffset];
+ }
+
+ fooBuffer[inputCount] = 0x80;
+ for (i=inputCount+1; i<inputCount+paddingSize; i++) {
+ fooBuffer[i] = 0x00;
+ }
+
+ size = (uint)(count+inputCount);
+ size *= 8;
+ fooBuffer[inputCount+paddingSize] = (byte)((size) >> 0);
+ fooBuffer[inputCount+paddingSize+1] = (byte)((size) >> 8);
+ fooBuffer[inputCount+paddingSize+2] = (byte)((size) >> 16);
+ fooBuffer[inputCount+paddingSize+3] = (byte)((size) >> 24);
+
+ fooBuffer[inputCount+paddingSize+4] = 0x00;
+ fooBuffer[inputCount+paddingSize+5] = 0x00;
+ fooBuffer[inputCount+paddingSize+6] = 0x00;
+ fooBuffer[inputCount+paddingSize+7] = 0x00;
+
+ ProcessBlock(fooBuffer, 0);
+
+ if (inputCount+paddingSize+8 == 128) {
+ ProcessBlock(fooBuffer, 64);
+ }
+ }
+
+ private enum Constants : uint {
+ C0 = 0xd76aa478, C1 = 0xe8c7b756, C2 = 0x242070db,
+ C3 = 0xc1bdceee, C4 = 0xf57c0faf, C5 = 0x4787c62a,
+ C6 = 0xa8304613, C7 = 0xfd469501, C8 = 0x698098d8,
+ C9 = 0x8b44f7af,C10 = 0xffff5bb1,C11 = 0x895cd7be,
+ C12 = 0x6b901122,C13 = 0xfd987193,C14 = 0xa679438e,
+ C15 = 0x49b40821,C16 = 0xf61e2562,C17 = 0xc040b340,
+ C18 = 0x265e5a51,C19 = 0xe9b6c7aa,C20 = 0xd62f105d,
+ C21 = 0x02441453,C22 = 0xd8a1e681,C23 = 0xe7d3fbc8,
+ C24 = 0x21e1cde6,C25 = 0xc33707d6,C26 = 0xf4d50d87,
+ C27 = 0x455a14ed,C28 = 0xa9e3e905,C29 = 0xfcefa3f8,
+ C30 = 0x676f02d9,C31 = 0x8d2a4c8a,C32 = 0xfffa3942,
+ C33 = 0x8771f681,C34 = 0x6d9d6122,C35 = 0xfde5380c,
+ C36 = 0xa4beea44,C37 = 0x4bdecfa9,C38 = 0xf6bb4b60,
+ C39 = 0xbebfbc70,C40 = 0x289b7ec6,C41 = 0xeaa127fa,
+ C42 = 0xd4ef3085,C43 = 0x04881d05,C44 = 0xd9d4d039,
+ C45 = 0xe6db99e5,C46 = 0x1fa27cf8,C47 = 0xc4ac5665,
+ C48 = 0xf4292244,C49 = 0x432aff97,C50 = 0xab9423a7,
+ C51 = 0xfc93a039,C52 = 0x655b59c3,C53 = 0x8f0ccc92,
+ C54 = 0xffeff47d,C55 = 0x85845dd1,C56 = 0x6fa87e4f,
+ C57 = 0xfe2ce6e0,C58 = 0xa3014314,C59 = 0x4e0811a1,
+ C60 = 0xf7537e82,C61 = 0xbd3af235,C62 = 0x2ad7d2bb,
+ C63 = 0xeb86d391
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/MaskGenerationMethod.cs b/mcs/class/corlib/System.Security.Cryptography/MaskGenerationMethod.cs
new file mode 100644
index 00000000000..b35dcbc088c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MaskGenerationMethod.cs
@@ -0,0 +1,23 @@
+//
+// MaskGenerationMethod.cs: Handles mask generation.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography
+{
+
+public abstract class MaskGenerationMethod
+{
+ protected MaskGenerationMethod () {}
+
+ public abstract byte[] GenerateMask (byte[] rgbSeed, int cbReturn);
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/MiniParser.cs b/mcs/class/corlib/System.Security.Cryptography/MiniParser.cs
new file mode 100644
index 00000000000..31c56113f6d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MiniParser.cs
@@ -0,0 +1,624 @@
+//
+// System.Security.Cryptography.MiniParser: Internal XML parser implementation
+//
+// Authors:
+// Sergey Chaban
+//
+
+/*
+ * Copyright (c) 2001, 2002 Wild West Software
+ * Copyright (c) 2002 Sergey Chaban
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Security.Cryptography {
+
+internal class MiniParser {
+
+ public interface IReader {
+ int Read();
+ }
+
+ public interface IAttrList {
+ int Length {get;}
+ bool IsEmpty {get;}
+ string GetName(int i);
+ string GetValue(int i);
+ string GetValue(string name);
+ void ChangeValue(string name, string newValue);
+ string[] Names {get;}
+ string[] Values {get;}
+ }
+
+ public interface IMutableAttrList : IAttrList {
+ void Clear();
+ void Add(string name, string value);
+ void CopyFrom(IAttrList attrs);
+ void Remove(int i);
+ void Remove(string name);
+ }
+
+ public interface IHandler {
+ void OnStartParsing(MiniParser parser);
+ void OnStartElement(string name, IAttrList attrs);
+ void OnEndElement(string name);
+ void OnChars(string ch);
+ void OnEndParsing(MiniParser parser);
+ }
+
+ public class HandlerAdapter : IHandler {
+ public HandlerAdapter() {}
+ public void OnStartParsing(MiniParser parser) {}
+ public void OnStartElement(string name, IAttrList attrs) {}
+ public void OnEndElement(string name) {}
+ public void OnChars(string ch) {}
+ public void OnEndParsing(MiniParser parser) {}
+ }
+
+ private enum CharKind : byte {
+ LEFT_BR = 0,
+ RIGHT_BR = 1,
+ SLASH = 2,
+ PI_MARK = 3,
+ EQ = 4,
+ AMP = 5,
+ SQUOTE = 6,
+ DQUOTE = 7,
+ BANG = 8,
+ LEFT_SQBR = 9,
+ SPACE = 0xA,
+ RIGHT_SQBR = 0xB,
+ TAB = 0xC,
+ CR = 0xD,
+ EOL = 0xE,
+ CHARS = 0xF,
+ UNKNOWN = 0x1F
+ }
+
+ private enum ActionCode : byte {
+ START_ELEM = 0,
+ END_ELEM = 1,
+ END_NAME = 2,
+ SET_ATTR_NAME = 3,
+ SET_ATTR_VAL = 4,
+ SEND_CHARS = 5,
+ START_CDATA = 6,
+ END_CDATA = 7,
+ ERROR = 8,
+ STATE_CHANGE = 9,
+ FLUSH_CHARS_STATE_CHANGE = 0xA,
+ ACC_CHARS_STATE_CHANGE = 0xB,
+ ACC_CDATA = 0xC,
+ PROC_CHAR_REF = 0xD,
+ UNKNOWN = 0xF
+ }
+
+ public class AttrListImpl : IMutableAttrList {
+ protected ArrayList names;
+ protected ArrayList values;
+
+ public AttrListImpl() : this(0) {}
+
+ public AttrListImpl(int initialCapacity) {
+ if (initialCapacity <= 0) {
+ names = new ArrayList();
+ values = new ArrayList();
+ } else {
+ names = new ArrayList(initialCapacity);
+ values = new ArrayList(initialCapacity);
+ }
+ }
+
+ public AttrListImpl(IAttrList attrs)
+ : this(attrs != null ? attrs.Length : 0) {
+ if (attrs != null) this.CopyFrom(attrs);
+ }
+
+ public int Length {
+ get {return names.Count;}
+ }
+
+ public bool IsEmpty {
+ get {return this.Length != 0;}
+ }
+
+ public string GetName(int i) {
+ string res = null;
+ if (i >= 0 && i < this.Length) {
+ res = names[i] as string;
+ }
+ return res;
+ }
+
+ public string GetValue(int i) {
+ string res = null;
+ if (i >= 0 && i < this.Length) {
+ res = values[i] as string;
+ }
+ return res;
+ }
+
+ public string GetValue(string name) {
+ return this.GetValue(names.IndexOf(name));
+ }
+
+ public void ChangeValue(string name, string newValue) {
+ int i = names.IndexOf(name);
+ if (i >= 0 && i < this.Length) {
+ values[i] = newValue;
+ }
+ }
+
+ public string[] Names {
+ get {return names.ToArray(typeof(string)) as string[];}
+ }
+
+ public string[] Values {
+ get {return values.ToArray(typeof(string)) as string[];}
+ }
+
+ public void Clear() {
+ names.Clear();
+ values.Clear();
+ }
+
+ public void Add(string name, string value) {
+ names.Add(name);
+ values.Add(value);
+ }
+
+ public void Remove(int i) {
+ if (i >= 0) {
+ names.RemoveAt(i);
+ values.RemoveAt(i);
+ }
+ }
+
+ public void Remove(string name) {
+ this.Remove(names.IndexOf(name));
+ }
+
+ public void CopyFrom(IAttrList attrs) {
+ if (attrs != null && ((object)this == (object)attrs)) {
+ this.Clear();
+ int n = attrs.Length;
+ for (int i = 0; i < n; i++) {
+ this.Add(attrs.GetName(i), attrs.GetValue(i));
+ }
+ }
+ }
+ }
+
+ public class XMLError : Exception {
+ protected string descr;
+ protected int line, column;
+ public XMLError() : this("Unknown") {}
+ public XMLError(string descr) : this(descr, -1, -1) {}
+ public XMLError(string descr, int line, int column)
+ : base(descr) {
+ this.descr = descr;
+ this.line = line;
+ this.column = column;
+ }
+ public int Line {get {return line;}}
+ public int Column {get {return column;}}
+ public override string ToString() {
+ return (String.Format("{0} @ (line = {1}, col = {2})", descr, line, column));
+ }
+ }
+
+ private static readonly int INPUT_RANGE = 13;
+ private static readonly ushort[] tbl = {
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 1), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 128), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 128),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 2), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 133), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 16), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.FLUSH_CHARS_STATE_CHANGE << 8) | 4),
+ (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.END_ELEM << 8) | 0), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 2), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 2), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 5), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 4), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.END_NAME << 8) | 6), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.END_NAME << 8) | 7), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.END_NAME << 8) | 8), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 3),
+ (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.FLUSH_CHARS_STATE_CHANGE << 8) | 1), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 10), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 7), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 9), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.START_ELEM << 8) | 6), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.START_ELEM << 8) | 7), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 8), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 9), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.SET_ATTR_NAME << 8) | 11), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 12), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 13), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 10), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 10),
+ (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 11), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 132), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 132),
+ (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.SET_ATTR_NAME << 8) | 11), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 12), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 130), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 130),
+ (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.SEND_CHARS << 8) | 2), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 16), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 134), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ERROR << 8) | 134),
+ (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.SET_ATTR_VAL << 8) | 17), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 14), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 14),
+ (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.SET_ATTR_VAL << 8) | 17), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.PROC_CHAR_REF << 8) | 15), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 15),
+ (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.START_CDATA << 8) | 18), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 0), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.START_CDATA << 8) | 19),
+ (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.START_ELEM << 8) | 6), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.START_ELEM << 8) | 7), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.STATE_CHANGE << 8) | 17), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CHARS_STATE_CHANGE << 8) | 9), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ERROR << 8) | 129), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ERROR << 8) | 129),
+ (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.END_CDATA << 8) | 10), (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 18),
+ (ushort)(((ushort)CharKind.LEFT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SLASH << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.RIGHT_BR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.PI_MARK << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.EQ << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.AMP << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.BANG << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.LEFT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.SPACE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.RIGHT_SQBR << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.DQUOTE << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19), (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.ACC_CDATA << 8) | 19),
+ (ushort)(((ushort)CharKind.CHARS << 12) | ((ushort)ActionCode.UNKNOWN << 8) | 255),
+ 0xFFFF
+ };
+
+ protected static string[] errors = {
+ /* 0 */ "Expected element",
+ /* 1 */ "Invalid character in tag",
+ /* 2 */ "No '='",
+ /* 3 */ "Invalid character entity",
+ /* 4 */ "Invalid attr value",
+ /* 5 */ "Empty tag",
+ /* 6 */ "No end tag",
+ /* 7 */ "Bad entity ref"
+ };
+
+ protected int line;
+ protected int col;
+ protected int[] twoCharBuff;
+ protected bool splitCData;
+
+ public MiniParser() {
+ twoCharBuff = new int[2];
+ splitCData = false;
+ Reset();
+ }
+
+ public void Reset() {
+ line = 0;
+ col = 0;
+ }
+
+ protected static bool StrEquals(string str, StringBuilder sb, int sbStart, int len) {
+ if (len != str.Length) return false;
+ for (int i = 0; i < len; i++) {
+ if (str[i] != sb[sbStart + i]) return false;
+ }
+ return true;
+ }
+
+ protected void FatalErr(string descr) {
+ throw new XMLError(descr, this.line, this.col);
+ }
+
+ protected static int Xlat(int charCode, int state) {
+ int p = state * INPUT_RANGE;
+ int n = Math.Min(tbl.Length - p, INPUT_RANGE);
+ for (;--n >= 0;) {
+ ushort code = tbl[p];
+ if (charCode == (code >> 12)) return (code & 0xFFF);
+ p++;
+ }
+ return 0xFFF;
+ }
+
+ public void Parse(IReader reader, IHandler handler) {
+ if (reader == null) throw new ArgumentNullException("reader");
+ if (handler == null) handler = new HandlerAdapter();
+
+ AttrListImpl attrList = new AttrListImpl();
+ string lastAttrName = null;
+ Stack tagStack = new Stack();
+ string elementName = null;
+ line = 1;
+ col = 0;
+ int currCh = 0;
+ int stateCode = 0;
+ StringBuilder sbChars = new StringBuilder();
+ bool seenCData = false;
+ bool isComment = false;
+ bool isDTD = false;
+ int bracketSwitch = 0;
+
+ handler.OnStartParsing(this);
+
+ while (true) {
+ ++this.col;
+ int prevCh = currCh;
+
+ currCh = reader.Read();
+
+ if (currCh == -1) {
+ if (stateCode != 0) {
+ FatalErr("Unexpected EOF");
+ }
+ break;
+ }
+
+ int charCode = "<>/?=&'\"![ ]\t\r\n".IndexOf((char)currCh) & 0xF;
+ if (charCode == (int)CharKind.CR) continue; // ignore
+ // whitepace ::= (#x20 | #x9 | #xd | #xa)+
+ if (charCode == (int)CharKind.TAB) charCode = (int)CharKind.SPACE; // tab == space
+ if (charCode == (int)CharKind.EOL) {
+ this.col = 0;
+ this.line++;
+ charCode = (int)CharKind.SPACE;
+ }
+
+ int actionCode = MiniParser.Xlat(charCode, stateCode);
+ stateCode = actionCode & 0xFF;
+ // Ignore newline inside attribute value.
+ if (currCh == '\n' && (stateCode == 0xE || stateCode == 0xF)) continue;
+ actionCode >>= 8;
+
+ if (stateCode >= 0x80) {
+ if (stateCode == 0xFF) {
+ FatalErr("State dispatch error.");
+ } else {
+ FatalErr(errors[stateCode ^ 0x80]);
+ }
+ }
+
+ switch (actionCode) {
+ case (int)ActionCode.START_ELEM:
+ handler.OnStartElement(elementName, attrList);
+ if (currCh != '/') {
+ tagStack.Push(elementName);
+ } else {
+ handler.OnEndElement(elementName);
+ }
+ attrList.Clear();
+ break;
+
+ case (int)ActionCode.END_ELEM:
+ elementName = sbChars.ToString();
+ sbChars = new StringBuilder();
+ string endName = null;
+ if (tagStack.Count == 0 ||
+ elementName != (endName = tagStack.Pop() as string)) {
+ if (endName == null) {
+ FatalErr("Tag stack underflow");
+ } else {
+ FatalErr(String.Format("Expected end tag '{0}' but found '{1}'", elementName, endName));
+ }
+ }
+ handler.OnEndElement(elementName);
+ break;
+
+ case (int)ActionCode.END_NAME:
+ elementName = sbChars.ToString();
+ sbChars = new StringBuilder();
+ if (currCh != '/' && currCh != '>') break;
+ goto case (int)ActionCode.START_ELEM;
+
+ case (int)ActionCode.SET_ATTR_NAME:
+ lastAttrName = sbChars.ToString();
+ sbChars = new StringBuilder();
+ break;
+
+ case (int)ActionCode.SET_ATTR_VAL:
+ if (lastAttrName == null) FatalErr("Internal error.");
+ attrList.Add(lastAttrName, sbChars.ToString());
+ sbChars = new StringBuilder();
+ lastAttrName = null;
+ break;
+
+ case (int)ActionCode.SEND_CHARS:
+ handler.OnChars(sbChars.ToString());
+ sbChars = new StringBuilder();
+ break;
+
+ case (int)ActionCode.START_CDATA:
+ string cdata = "CDATA[";
+ isComment = false;
+ isDTD = false;
+
+ if (currCh == '-') {
+ currCh = reader.Read();
+
+ if (currCh != '-') FatalErr("Invalid comment");
+
+ this.col++;
+ isComment = true;
+ twoCharBuff[0] = -1;
+ twoCharBuff[1] = -1;
+ } else {
+ if (currCh != '[') {
+ isDTD = true;
+ bracketSwitch = 0;
+ break;
+ }
+
+ for (int i = 0; i < cdata.Length; i++) {
+ if (reader.Read() != cdata[i]) {
+ this.col += i+1;
+ break;
+ }
+ }
+ this.col += cdata.Length;
+ seenCData = true;
+ }
+ break;
+
+ case (int)ActionCode.END_CDATA:
+ int n = 0;
+ currCh = ']';
+
+ while (currCh == ']') {
+ currCh = reader.Read();
+ n++;
+ }
+
+ if (currCh != '>') {
+ for (int i = 0; i < n; i++) sbChars.Append(']');
+ sbChars.Append((char)currCh);
+ stateCode = 0x12;
+ } else {
+ for (int i = 0; i < n-2; i++) sbChars.Append(']');
+ seenCData = false;
+ }
+
+ this.col += n;
+ break;
+
+ case (int)ActionCode.ERROR:
+ FatalErr(String.Format("Error {0}", stateCode));
+ break;
+
+ case (int)ActionCode.STATE_CHANGE:
+ break;
+
+ case (int)ActionCode.FLUSH_CHARS_STATE_CHANGE:
+ sbChars = new StringBuilder();
+ if (currCh != '<') goto case (int)ActionCode.ACC_CHARS_STATE_CHANGE;
+ break;
+
+ case (int)ActionCode.ACC_CHARS_STATE_CHANGE:
+ sbChars.Append((char)currCh);
+ break;
+
+ case (int)ActionCode.ACC_CDATA:
+ if (isComment) {
+ if (currCh == '>'
+ && twoCharBuff[0] == '-'
+ && twoCharBuff[1] == '-') {
+ isComment = false;
+ stateCode = 0;
+ } else {
+ twoCharBuff[0] = twoCharBuff[1];
+ twoCharBuff[1] = currCh;
+ }
+ } else if (isDTD) {
+ if (currCh == '<' || currCh == '>') bracketSwitch ^= 1;
+ if (currCh == '>' && bracketSwitch != 0) {
+ isDTD = false;
+ stateCode = 0;
+ }
+ } else {
+ if (this.splitCData
+ && sbChars.Length > 0
+ && seenCData) {
+ handler.OnChars(sbChars.ToString());
+ sbChars = new StringBuilder();
+ }
+ seenCData = false;
+ sbChars.Append((char)currCh);
+ }
+ break;
+
+ case (int)ActionCode.PROC_CHAR_REF:
+ currCh = reader.Read();
+ int cl = this.col + 1;
+ if (currCh == '#') { // character reference
+ int r = 10;
+ int chCode = 0;
+ int nDigits = 0;
+ currCh = reader.Read();
+ cl++;
+
+ if (currCh == 'x') {
+ currCh = reader.Read();
+ cl++;
+ r=16;
+ }
+
+ NumberStyles style = r == 16 ? NumberStyles.HexNumber : NumberStyles.Integer;
+
+ while (true) {
+ int x = -1;
+ if (Char.IsNumber((char)currCh) || "abcdef".IndexOf(Char.ToLower((char)currCh)) != -1) {
+ try {
+ x = Int32.Parse(new string((char)currCh, 1), style);
+ } catch (FormatException) {x = -1;}
+ }
+ if (x == -1) break;
+ chCode *= r;
+ chCode += x;
+ nDigits++;
+ currCh = reader.Read();
+ cl++;
+ }
+
+ if (currCh == ';' && nDigits > 0) {
+ sbChars.Append((char)chCode);
+ } else {
+ FatalErr("Bad char ref");
+ }
+ } else {
+ // entity reference
+ string entityRefChars = "aglmopqstu"; // amp | apos | quot | gt | lt
+ string entities = "&'\"><";
+
+ int pos = 0;
+ int entIdx = 0xF;
+ int pred = 0;
+ int predShift = 0;
+
+ int sbLen = sbChars.Length;
+
+ while (true) {
+ if (pos != 0xF) pos = entityRefChars.IndexOf((char)currCh) & 0xF;
+ if (pos == 0xF) FatalErr(errors[7]);
+ sbChars.Append((char)currCh);
+
+ int path = "\uFF35\u3F8F\u4F8F\u0F5F\uFF78\uE1F4\u2299\uEEFF\uEEFF\uFF4F"[pos];
+ int lBr = (path >> 4) & 0xF;
+ int rBr = path & 0xF;
+ int lPred = path >> 12;
+ int rPred = (path >> 8) & 0xF;
+ currCh = reader.Read();
+ cl++;
+ pos = 0xF;
+ if (lBr != 0xF && currCh == entityRefChars[lBr]) {
+ if (lPred < 0xE) entIdx = lPred;
+ pred = lPred;
+ predShift = 12; // left
+ } else if (rBr != 0xF && currCh == entityRefChars[rBr]) {
+ if (rPred < 0xE) entIdx = rPred;
+ pred = rPred;
+ predShift = 8; // right
+ } else if (currCh == ';') {
+ if (entIdx != 0xF
+ && predShift != 0
+ && ((path >> predShift) & 0xF) == 0xE) break;
+ continue; // pos == 0xF
+ }
+
+ pos=0;
+
+ }
+
+ int l = cl - this.col - 1;
+
+ if ((l > 0 && l < 5)
+ &&(StrEquals("amp", sbChars, sbLen, l)
+ || StrEquals("apos", sbChars, sbLen, l)
+ || StrEquals("quot", sbChars, sbLen, l)
+ || StrEquals("lt", sbChars, sbLen, l)
+ || StrEquals("gt", sbChars, sbLen, l))
+ ) {
+ sbChars.Length = sbLen;
+ sbChars.Append(entities[entIdx]);
+ } else FatalErr(errors[7]);
+ }
+
+ this.col = cl;
+ break;
+
+ default:
+ FatalErr(String.Format("Unexpected action code - {0}.", actionCode));
+ break;
+ }
+ } // while (true)
+
+ handler.OnEndParsing(this);
+
+ } // Parse
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/PKCS1.cs b/mcs/class/corlib/System.Security.Cryptography/PKCS1.cs
new file mode 100644
index 00000000000..43bcff51a15
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/PKCS1.cs
@@ -0,0 +1,384 @@
+//
+// PKCS1.cs - Implements PKCS#1 primitives.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. PKCS#1: RSA Cryptography Standard
+// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
+
+internal class PKCS1 {
+
+ private static bool Compare (byte[] array1, byte[] array2)
+ {
+ bool result = (array1.Length == array2.Length);
+ if (result) {
+ for (int i=0; i < array1.Length; i++)
+ if (array1[i] != array2[i])
+ return false;
+ }
+ return result;
+ }
+
+ private static byte[] xor (byte[] array1, byte[] array2)
+ {
+ byte[] result = new byte [array1.Length];
+ for (int i=0; i < result.Length; i++)
+ result[i] = (byte) (array1[i] ^ array2[i]);
+ return result;
+ }
+
+ private static byte[] emptySHA1 = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09 };
+ private static byte[] emptySHA256 = { 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55 };
+ private static byte[] emptySHA384 = { 0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38, 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a, 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43, 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda, 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb, 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b };
+ private static byte[] emptySHA512 = { 0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd, 0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07, 0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc, 0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce, 0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0, 0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f, 0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81, 0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e };
+
+ private static byte[] GetEmptyHash (HashAlgorithm hash)
+ {
+ if (hash is SHA1)
+ return emptySHA1;
+ else if (hash is SHA256)
+ return emptySHA256;
+ else if (hash is SHA384)
+ return emptySHA384;
+ else if (hash is SHA512)
+ return emptySHA512;
+ else
+ return null;
+ }
+
+ // PKCS #1 v.2.1, Section 4.1
+ // I2OSP converts a nonnegative integer to an octet string of a specified length.
+ public static byte[] I2OSP (int x, int size)
+ {
+ byte[] array = BitConverter.GetBytes (x);
+ return I2OSP (array, size);
+ }
+
+ public static byte[] I2OSP (byte[] x, int size)
+ {
+ byte[] result = new byte [size];
+ Array.Copy (x, 0, result, (result.Length - x.Length), x.Length);
+ return result;
+ }
+
+ // PKCS #1 v.2.1, Section 4.2
+ // OS2IP converts an octet string to a nonnegative integer.
+ public static byte[] OS2IP (byte[] x)
+ {
+ int i = 0;
+ while ((x[i++] == 0x00) && (i < x.Length));
+ i--;
+ if (i > 0) {
+ byte[] result = new byte [x.Length - i];
+ Array.Copy (x, i, result, 0, result.Length);
+ return result;
+ }
+ else
+ return x;
+ }
+
+ // PKCS #1 v.2.1, Section 5.1.1
+ public static byte[] RSAEP (RSA rsa, byte[] m)
+ {
+ // c = m^e mod n
+ return rsa.EncryptValue (m);
+ }
+
+ // PKCS #1 v.2.1, Section 5.1.2
+ public static byte[] RSADP (RSA rsa, byte[] c)
+ {
+ // m = c^d mod n
+ // Decrypt value may apply CRT optimizations
+ return rsa.DecryptValue (c);
+ }
+
+ // PKCS #1 v.2.1, Section 5.2.1
+ public static byte[] RSASP1 (RSA rsa, byte[] m)
+ {
+ // first form: s = m^d mod n
+ // Decrypt value may apply CRT optimizations
+ return rsa.DecryptValue (m);
+ }
+
+ // PKCS #1 v.2.1, Section 5.2.2
+ public static byte[] RSAVP1 (RSA rsa, byte[] s)
+ {
+ // m = s^e mod n
+ return rsa.EncryptValue (s);
+ }
+
+ // PKCS #1 v.2.1, Section 7.1.1
+ // RSAES-OAEP-ENCRYPT ((n, e), M, L)
+ public static byte[] Encrypt_OAEP (RSA rsa, HashAlgorithm hash, RandomNumberGenerator rng, byte[] M)
+ {
+ int size = rsa.KeySize / 8;
+ int hLen = hash.HashSize / 8;
+ if (M.Length > size - 2 * hLen - 2)
+ throw new CryptographicException ("message too long");
+ // empty label L SHA1 hash
+ byte[] lHash = GetEmptyHash (hash);
+ int PSLength = (size - M.Length - 2 * hLen - 2);
+ // DB = lHash || PS || 0x01 || M
+ byte[] DB = new byte [lHash.Length + PSLength + 1 + M.Length];
+ Array.Copy (lHash, 0, DB, 0, lHash.Length);
+ DB [(lHash.Length + PSLength)] = 0x01;
+ Array.Copy (M, 0, DB, (DB.Length - M.Length), M.Length);
+
+ byte[] seed = new byte [hLen];
+ rng.GetBytes (seed);
+
+ byte[] dbMask = MGF1 (hash, seed, size - hLen - 1);
+ byte[] maskedDB = xor (DB, dbMask);
+ byte[] seedMask = MGF1 (hash, maskedDB, hLen);
+ byte[] maskedSeed = xor (seed, seedMask);
+ // EM = 0x00 || maskedSeed || maskedDB
+ byte[] EM = new byte [maskedSeed.Length + maskedDB.Length + 1];
+ Array.Copy (maskedSeed, 0, EM, 1, maskedSeed.Length);
+ Array.Copy (maskedDB, 0, EM, maskedSeed.Length + 1, maskedDB.Length);
+
+ byte[] m = OS2IP (EM);
+ byte[] c = RSAEP (rsa, m);
+ return I2OSP (c, size);
+ }
+
+ // PKCS #1 v.2.1, Section 7.1.2
+ // RSAES-OAEP-DECRYPT (K, C, L)
+ public static byte[] Decrypt_OAEP (RSA rsa, HashAlgorithm hash, byte[] C)
+ {
+ int size = rsa.KeySize / 8;
+ int hLen = hash.HashSize / 8;
+ if ((size < (2 * hLen + 2)) || (C.Length != size))
+ throw new CryptographicException ("decryption error");
+
+ byte[] c = OS2IP (C);
+ byte[] m = RSADP (rsa, c);
+ byte[] EM = I2OSP (m, size);
+
+ // split EM = Y || maskedSeed || maskedDB
+ byte[] maskedSeed = new byte [hLen];
+ Array.Copy (EM, 1, maskedSeed, 0, maskedSeed.Length);
+ byte[] maskedDB = new byte [size - hLen - 1];
+ Array.Copy (EM, (EM.Length - maskedDB.Length), maskedDB, 0, maskedDB.Length);
+
+ byte[] seedMask = MGF1 (hash, maskedDB, hLen);
+ byte[] seed = xor (maskedSeed, seedMask);
+ byte[] dbMask = MGF1 (hash, seed, size - hLen - 1);
+ byte[] DB = xor (maskedDB, dbMask);
+
+ byte[] lHash = GetEmptyHash (hash);
+ // split DB = lHash’ || PS || 0x01 || M
+ byte[] dbHash = new byte [lHash.Length];
+ Array.Copy (DB, 0, dbHash, 0, dbHash.Length);
+ bool h = Compare (lHash, dbHash);
+
+ // find separator 0x01
+ int nPos = lHash.Length;
+ while (DB[nPos] == 0)
+ nPos++;
+
+ int Msize = DB.Length - nPos - 1;
+ byte[] M = new byte [Msize];
+ Array.Copy (DB, (nPos + 1), M, 0, Msize);
+
+ // we could have returned EM[0] sooner but would be helping a timing attack
+ if ((EM[0] != 0) || (!h) || (DB[nPos] != 0x01))
+ return null;
+ return M;
+ }
+
+ // PKCS #1 v.2.1, Section 7.2.1
+ // RSAES-PKCS1-V1_5-ENCRYPT ((n, e), M)
+ public static byte[] Encrypt_v15 (RSA rsa, RandomNumberGenerator rng, byte[] M)
+ {
+ int size = rsa.KeySize / 8;
+ if (M.Length > size - 11)
+ throw new CryptographicException ("message too long");
+ int PSLength = Math.Max (8, (size - M.Length - 3));
+ byte[] PS = new byte [PSLength];
+ rng.GetNonZeroBytes (PS);
+ byte[] EM = new byte [size];
+ EM [1] = 0x02;
+ Array.Copy (PS, 0, EM, 2, PSLength);
+ Array.Copy (M, 0, EM, (size - M.Length), M.Length);
+
+ byte[] m = OS2IP (EM);
+ byte[] c = RSAEP (rsa, m);
+ byte[] C = I2OSP (c, size);
+ return C;
+ }
+
+ // PKCS #1 v.2.1, Section 7.2.2
+ // RSAES-PKCS1-V1_5-DECRYPT (K, C)
+ public static byte[] Decrypt_v15 (RSA rsa, byte[] C)
+ {
+ int size = rsa.KeySize / 8;
+ if ((size < 11) || (C.Length != size))
+ throw new CryptographicException ("decryption error");
+ byte[] c = OS2IP (C);
+ byte[] m = RSADP (rsa, c);
+ byte[] EM = I2OSP (m, size);
+
+ if ((EM [0] != 0x00) || (EM [1] != 0x02))
+ return null;
+
+ int mPos = 10;
+ // PS is a minimum of 8 bytes + 2 bytes for header
+ while ((EM [mPos] != 0x00) && (mPos < EM.Length))
+ mPos++;
+ if (EM [mPos] != 0x00)
+ return null;
+ mPos++;
+ byte[] M = new byte [EM.Length - mPos];
+ Array.Copy (EM, mPos, M, 0, M.Length);
+ return M;
+ }
+
+ // PKCS #1 v.2.1, Section 8.2.1
+ // RSASSA-PKCS1-V1_5-SIGN (K, M)
+ public static byte[] Sign_v15 (RSA rsa, string oid, byte[] hash)
+ {
+ int size = rsa.KeySize / 8;
+ byte[] EM = Encode_v15 (oid, hash, size);
+ byte[] m = OS2IP (EM);
+ byte[] s = RSASP1 (rsa, m);
+ byte[] S = I2OSP (s, size);
+ return S;
+ }
+
+ // PKCS #1 v.2.1, Section 8.2.2
+ // RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S)
+ public static bool Verify_v15 (RSA rsa, string oid, byte[] hash, byte[] signature)
+ {
+ int size = rsa.KeySize / 8;
+ byte[] s = OS2IP (signature);
+ byte[] m = RSAVP1 (rsa, signature);
+ byte[] EM2 = I2OSP (m, size);
+ byte[] EM = Encode_v15 (oid, hash, size);
+ return Compare(EM, EM2);
+ }
+
+ // Note: MD2 isn't supported in .NET framework
+ private static byte[] md2const = { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x02, 0x05, 0x00, 0x04, 0x10 };
+ private static byte[] md5const = { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 };
+ private static byte[] sha1const = { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 };
+ private static byte[] sha256const = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20 };
+ private static byte[] sha384const = { 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30 };
+ private static byte[] sha512const = { 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 };
+
+ // PKCS #1 v.2.1, Section 9.2
+ // EMSA-PKCS1-v1_5-Encode
+ public static byte[] Encode_v15 (string oid, byte[] hash, int emLength)
+ {
+ string e = "bad hash length for ";
+ byte[] t = null;
+ switch (oid) {
+ case "1.3.14.3.2.26":
+ // SHA1
+ if (hash.Length != 20)
+ throw new CryptographicException (e + oid);
+ t = new byte [35];
+ Array.Copy (sha1const, 0, t, 0, sha1const.Length);
+ break;
+ case "1.2.840.113549.2.2":
+ // MD2
+ if (hash.Length != 16)
+ throw new CryptographicException (e + oid);
+ t = new byte [34];
+ Array.Copy (md2const, 0, t, 0, md2const.Length);
+ break;
+ case "1.2.840.113549.2.5":
+ // MD5
+ if (hash.Length != 16)
+ throw new CryptographicException (e + oid);
+ t = new byte [34];
+ Array.Copy (md5const, 0, t, 0, md5const.Length);
+ break;
+ case "2.16.840.1.101.3.4.1":
+ // SHA256
+ if (hash.Length != 32)
+ throw new CryptographicException (e + oid);
+ t = new byte [51];
+ Array.Copy (sha256const, 0, t, 0, sha256const.Length);
+ break;
+ case "2.16.840.1.101.3.4.2":
+ // SHA384
+ if (hash.Length != 48)
+ throw new CryptographicException (e + oid);
+ t = new byte [67];
+ Array.Copy (sha384const, 0, t, 0, sha384const.Length);
+ break;
+ case "2.16.840.1.101.3.4.3":
+ // SHA512
+ if (hash.Length != 64)
+ throw new CryptographicException (e + oid);
+ t = new byte [83];
+ Array.Copy (sha512const, 0, t, 0, sha512const.Length);
+ break;
+ default:
+ return null;
+ }
+ Array.Copy (hash, 0, t, t.Length - hash.Length, hash.Length);
+
+ int PSLength = Math.Max (8, emLength - t.Length - 3);
+ // PS = PSLength of 0xff
+
+ // EM = 0x00 | 0x01 | PS | 0x00 | T
+ byte[] EM = new byte [PSLength + t.Length + 3];
+ EM [1] = 0x01;
+ for (int i=2; i < PSLength + 2; i++)
+ EM[i] = 0xff;
+ Array.Copy (t, 0, EM, PSLength + 3, t.Length);
+
+ return EM;
+ }
+
+ // PKCS #1 v.2.1, Section B.2.1
+ public static byte[] MGF1 (HashAlgorithm hash, byte[] mgfSeed, int maskLen)
+ {
+ // 1. If maskLen > 2^32 hLen, output “mask too long” and stop.
+ // easy - this is impossible by using a int (31bits) as parameter ;-)
+ // BUT with a signed int we do have to check for negative values!
+ if (maskLen < 0)
+ throw new OverflowException();
+
+ int mgfSeedLength = mgfSeed.Length;
+ int hLen = (hash.HashSize >> 3); // from bits to bytes
+ int iterations = (maskLen / hLen);
+ if (maskLen % hLen != 0)
+ iterations++;
+ // 2. Let T be the empty octet string.
+ byte[] T = new byte [iterations * hLen];
+
+ byte[] toBeHashed = new byte [mgfSeedLength + 4];
+ int pos = 0;
+ // 3. For counter from 0 to (maskLen / hLen) – 1, do the following:
+ for (int counter = 0; counter < iterations; counter++) {
+ // a. Convert counter to an octet string C of length 4 octets
+ byte[] C = I2OSP (counter, 4);
+
+ // b. Concatenate the hash of the seed mgfSeed and C to the octet string T:
+ // T = T || Hash (mgfSeed || C)
+ Array.Copy (mgfSeed, 0, toBeHashed, 0, mgfSeedLength);
+ Array.Copy (C, 0, toBeHashed, mgfSeedLength, 4);
+ byte[] output = hash.ComputeHash (toBeHashed);
+ Array.Copy (output, 0, T, pos, hLen);
+ pos += mgfSeedLength;
+ }
+
+ // 4. Output the leading maskLen octets of T as the octet string mask.
+ byte[] mask = new byte [maskLen];
+ Array.Copy (T, 0, mask, 0, maskLen);
+ return mask;
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/PKCS1MaskGenerationMethod.cs b/mcs/class/corlib/System.Security.Cryptography/PKCS1MaskGenerationMethod.cs
new file mode 100644
index 00000000000..c56fa12d38f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/PKCS1MaskGenerationMethod.cs
@@ -0,0 +1,45 @@
+//
+// PKCS1MaskGenerationMethod.cs: Handles PKCS#1 mask generation.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. PKCS#1: RSA Cryptography Standard
+// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
+
+public class PKCS1MaskGenerationMethod : MaskGenerationMethod {
+ private string hashName;
+
+ public PKCS1MaskGenerationMethod()
+ {
+ hashName = "SHA1";
+ }
+
+ public string HashName
+ {
+ get { return hashName; }
+ set {
+ if (value == null)
+ hashName = "SHA1";
+ else
+ hashName = value;
+ }
+ }
+
+ public override byte[] GenerateMask (byte[] mgfSeed, int maskLen)
+ {
+ HashAlgorithm hash = HashAlgorithm.Create (hashName);
+ return PKCS1.MGF1 (hash, mgfSeed, maskLen);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs b/mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs
new file mode 100644
index 00000000000..3c5ffbab505
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs
@@ -0,0 +1,23 @@
+//
+// System.Security.Cryptography PaddingMode enumeration
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// How to pad the message processed by block ciphers when they don't come out to the being the size of the block.
+ /// </summary>
+ [Serializable]
+ public enum PaddingMode {
+ None = 0x1,
+ PKCS7, // Each byte contains the value of the number of padding bytes.
+ Zeros // Append zeros to the message.
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/PasswordDeriveBytes.cs b/mcs/class/corlib/System.Security.Cryptography/PasswordDeriveBytes.cs
new file mode 100644
index 00000000000..2d316b9ab64
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/PasswordDeriveBytes.cs
@@ -0,0 +1,170 @@
+//
+// PasswordDeriveBytes.cs: Handles PKCS#5 key derivation using password
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Text;
+
+namespace System.Security.Cryptography {
+
+// Reference:
+// a. PKCS #5 - Password-Based Cryptography Standard
+// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html
+// b. IETF RFC2898: PKCS #5: Password-Based Cryptography Specification Version 2.0
+// http://www.rfc-editor.org/rfc/rfc2898.txt
+
+public class PasswordDeriveBytes : DeriveBytes {
+
+ private string HashNameValue;
+ private string PasswordValue;
+ private byte[] SaltValue;
+ private int IterationsValue;
+
+ private HashAlgorithm hash;
+ private int state;
+ private byte[] output;
+
+ public PasswordDeriveBytes (string strPassword, byte[] rgbSalt)
+ {
+ Prepare (strPassword, rgbSalt, "SHA1", 1);
+ }
+
+ [MonoTODO("Integrate with CAPI on Windows. Linux?")]
+ public PasswordDeriveBytes (string strPassword, byte[] rgbSalt, CspParameters cspParams)
+ {
+ throw new NotSupportedException ("CspParameters not supported");
+ }
+
+ public PasswordDeriveBytes (string strPassword, byte[] rgbSalt, string strHashName, int iterations)
+ {
+ Prepare (strPassword, rgbSalt, strHashName, iterations);
+ }
+
+ [MonoTODO("Integrate with CAPI on Windows. Linux?")]
+ public PasswordDeriveBytes (string strPassword, byte[] rgbSalt, string strHashName, int iterations, CspParameters cspParams)
+ {
+ throw new NotSupportedException ("CspParameters not supported");
+ }
+
+ [MonoTODO("Must release unmanaged resources on Windows (CAPI). Linux?")]
+ ~PasswordDeriveBytes ()
+ {
+ // zeroize buffer
+ if (output != null) {
+ Array.Clear (output, 0, output.Length);
+ output = null;
+ }
+ // FIXME: zeroize password - not easy as all string function
+ // returns a string so we never have direct access to it's
+ // content - the password :-(
+ PasswordValue = null;
+ }
+
+ private void Prepare (string strPassword, byte[] rgbSalt, string strHashName, int iterations)
+ {
+ HashNameValue = strHashName;
+ PasswordValue = strPassword;
+ SaltValue = rgbSalt;
+ IterationsValue = iterations;
+ state = 0;
+ }
+
+ public string HashName {
+ get { return HashNameValue; }
+ set {
+ if (state != 0)
+ throw new CryptographicException ();
+ HashNameValue = value;
+ }
+ }
+
+ public int IterationCount {
+ get { return IterationsValue; }
+ set {
+ if (state != 0)
+ throw new CryptographicException ();
+ IterationsValue = value;
+ }
+ }
+
+ // FIXME ??? Comments are here to simulate the strange behaviour that
+ // happens when we want to assign null to a salt ??? Do we want this
+ // "feature" in Mono ? Vote "yes" for compatibility or "no" for
+ // functionality!
+ public byte[] Salt {
+ get { return (byte[]) SaltValue.Clone (); }
+ set {
+ if (state != 0)
+ throw new CryptographicException ();
+// if (value != null)
+ SaltValue = (byte[]) value.Clone ();
+// else
+// value = null;
+ }
+ }
+
+ // for compatibility with Microsoft CryptoAPI
+ [MonoTODO("Integrate with CAPI on Windows. Linux?")]
+ public byte[] CryptDeriveKey (string algname, string alghashname, int keySize, byte[] rgbIV)
+ {
+ if (keySize > 128)
+ throw new CryptographicException ("Key Size can't be greater than 128 bits");
+ throw new NotSupportedException ("CspParameters not supported");
+ }
+
+ // note: Key is returned - we can't zeroize it ourselve :-(
+ [MonoTODO("Doesn't generate keys longer than HashSize")]
+ public override byte[] GetBytes (int cb)
+ {
+ // must be first (before NotSupportedException) as the Hash
+ // object is created in Reset()
+ if (state == 0) {
+ state = 1;
+ // it's now impossible to change the HashName, Salt
+ // and IterationCount
+ Reset ();
+ }
+
+ // FIXME: This version can generate a key up to HashSize length
+ // This is normal for PKCS#5 but MS implementation allows longer
+ // keys (note that, in this case, longer keys aren't more secure!)
+ if (cb > hash.HashSize)
+ throw new NotSupportedException ("cb > HashSize");
+
+ hash.Initialize ();
+ // the initial hash (in reset) + at least one iteration
+ int iter = Math.Max (1, IterationsValue - 1);
+ // generate new key material
+ for (int i = 0; i < iter; i++)
+ output = hash.ComputeHash (output);
+ byte[] result = new byte [cb];
+ Array.Copy (output, 0, result, 0, cb);
+ return result;
+ }
+
+ public override void Reset ()
+ {
+ // note: Reset doesn't change state
+ byte[] password = Encoding.UTF8.GetBytes (PasswordValue);
+ int len = password.Length;
+ if (SaltValue != null)
+ len += SaltValue.Length;
+ byte[] input = new byte [len];
+
+ Array.Copy (password, 0, input, 0, password.Length);
+ // zeroize temporary password storage
+ Array.Clear (password, 0, password.Length);
+ if (SaltValue != null)
+ Array.Copy (SaltValue, 0, input, password.Length, SaltValue.Length);
+
+ hash = HashAlgorithm.Create (HashNameValue);
+ output = hash.ComputeHash (input);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Cryptography/RC2.cs b/mcs/class/corlib/System.Security.Cryptography/RC2.cs
new file mode 100644
index 00000000000..02eb1f0d296
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RC2.cs
@@ -0,0 +1,62 @@
+//
+// System.Security.Cryptography.RC2.cs
+//
+// Authors:
+// Andrew Birkett (andy@nobugs.org)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ public abstract class RC2 : SymmetricAlgorithm {
+
+ public static new RC2 Create ()
+ {
+ return Create ("System.Security.Cryptography.RC2");
+ }
+
+ public static new RC2 Create (string algName)
+ {
+ return (RC2) CryptoConfig.CreateFromName (algName);
+ }
+
+ protected int EffectiveKeySizeValue;
+
+ public virtual int EffectiveKeySize {
+ get {
+ if (EffectiveKeySizeValue == 0)
+ return KeySizeValue;
+ else
+ return EffectiveKeySizeValue;
+ }
+ set {
+ if (!IsLegalKeySize (LegalKeySizesValue, value))
+ throw new CryptographicException ("key size not supported by algorithm");
+ EffectiveKeySizeValue = value;
+ }
+ }
+
+ // Overridden, which makes me suspect it changes effective keysize too?
+ public override int KeySize {
+ get { return KeySizeValue; }
+ set { KeySizeValue = value; }
+ }
+
+ public RC2 ()
+ {
+ KeySizeValue = 128;
+ BlockSizeValue = 64;
+ FeedbackSizeValue = 64;
+
+ // The RFC allows keys of 1 to 128 bytes, but MS impl only supports
+ // 40 to 128 bits, sigh.
+ LegalKeySizesValue = new KeySizes[1];
+ LegalKeySizesValue[0] = new KeySizes(40, 128, 8);
+
+ LegalBlockSizesValue = new KeySizes[1];
+ LegalBlockSizesValue[0] = new KeySizes(64, 64, 0);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RC2CryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/RC2CryptoServiceProvider.cs
new file mode 100644
index 00000000000..169035eed44
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RC2CryptoServiceProvider.cs
@@ -0,0 +1,262 @@
+//
+// System.Security.Cryptography.RC2CryptoServiceProvider.cs
+//
+// Authors:
+// Andrew Birkett (andy@nobugs.org)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. IETF RFC2286: A Description of the RC2(r) Encryption Algorithm
+// http://www.ietf.org/rfc/rfc2268.txt
+
+public sealed class RC2CryptoServiceProvider : RC2 {
+
+ public RC2CryptoServiceProvider() {}
+
+ // included to (exactly) match corlib
+ public override int EffectiveKeySize {
+ get { return base.EffectiveKeySize; }
+ set { base.EffectiveKeySize = value; }
+ }
+
+ public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new RC2Transform (this, false);
+ }
+
+ public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new RC2Transform (this, true);
+ }
+
+ public override void GenerateIV ()
+ {
+ IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
+ }
+
+ public override void GenerateKey ()
+ {
+ KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
+ }
+}
+
+internal class RC2Transform : SymmetricTransform {
+
+ private UInt16 R0, R1, R2, R3; // state
+ private UInt16[] K; // expanded key
+ private int j; // Key indexer
+
+ public RC2Transform (RC2 rc2Algo, bool encryption) : base (rc2Algo, encryption, rc2Algo.IV)
+ {
+ byte[] key = rc2Algo.Key;
+ int t1 = rc2Algo.EffectiveKeySize;
+ // Expand key into a byte array, then convert to word
+ // array since we always access the key in 16bit chunks.
+ byte[] L = new byte [128];
+
+ int t = key.Length;
+ int t8 = ((t1 + 7) >> 3); // divide by 8
+ int tm = 255 % (2 << (8 + t1 - (t8 << 3) - 1));
+
+ for (int i=0; i < t; i++)
+ L [i] = key [i];
+ for (int i=t; i < 128; i++)
+ L [i] = (byte) (pitable [(L [i-1] + L [i-t]) & 0xff]);
+
+ L [128-t8] = pitable [L [128-t8] & tm];
+
+ for (int i=127-t8; i >= 0; i--)
+ L [i] = pitable [L [i+1] ^ L [i+t8]];
+
+ K = new UInt16 [64];
+ int pos = 0;
+ for (int i=0; i < 64; i++)
+ K [i] = (UInt16) (L [pos++] + (L [pos++] << 8));
+ }
+
+ protected override void ECB (byte[] input, byte[] output)
+ {
+ // unrolled loop, eliminated mul
+ R0 = (UInt16) (input [0] | (input [1] << 8));
+ R1 = (UInt16) (input [2] | (input [3] << 8));
+ R2 = (UInt16) (input [4] | (input [5] << 8));
+ R3 = (UInt16) (input [6] | (input [7] << 8));
+
+ if (encrypt) {
+ j = 0;
+ // inline, but looped, Mix(); Mix(); Mix(); Mix(); Mix();
+ while (j <= 16) {
+ R0 += (UInt16) (K[j++] + (R3 & R2) + ((~R3) & R1));
+ R0 = (UInt16) ((R0 << 1) | (R0 >> 15));
+
+ R1 += (UInt16) (K[j++] + (R0 & R3) + ((~R0) & R2));
+ R1 = (UInt16) ((R1 << 2) | (R1 >> 14));
+
+ R2 += (UInt16) (K[j++] + (R1 & R0) + ((~R1) & R3));
+ R2 = (UInt16) ((R2 << 3) | (R2 >> 13));
+
+ R3 += (UInt16) (K[j++] + (R2 & R1) + ((~R2) & R0));
+ R3 = (UInt16) ((R3 << 5) | (R3 >> 11));
+ }
+
+ // inline Mash(); j == 20
+ R0 += K [R3 & 63];
+ R1 += K [R0 & 63];
+ R2 += K [R1 & 63];
+ R3 += K [R2 & 63];
+
+ // inline, but looped, Mix(); Mix(); Mix(); Mix(); Mix(); Mix();
+ while (j <= 40) {
+ R0 += (UInt16) (K[j++] + (R3 & R2) + ((~R3) & R1));
+ R0 = (UInt16) ((R0 << 1) | (R0 >> 15));
+
+ R1 += (UInt16) (K[j++] + (R0 & R3) + ((~R0) & R2));
+ R1 = (UInt16) ((R1 << 2) | (R1 >> 14));
+
+ R2 += (UInt16) (K[j++] + (R1 & R0) + ((~R1) & R3));
+ R2 = (UInt16) ((R2 << 3) | (R2 >> 13));
+
+ R3 += (UInt16) (K[j++] + (R2 & R1) + ((~R2) & R0));
+ R3 = (UInt16) ((R3 << 5) | (R3 >> 11));
+ }
+
+ // inline Mash(); j == 44
+ R0 += K [R3 & 63];
+ R1 += K [R0 & 63];
+ R2 += K [R1 & 63];
+ R3 += K [R2 & 63];
+
+ // inline, but looped, Mix(); Mix(); Mix(); Mix(); Mix();
+ while (j < 64) {
+ R0 += (UInt16) (K[j++] + (R3 & R2) + ((~R3) & R1));
+ R0 = (UInt16) ((R0 << 1) | (R0 >> 15));
+
+ R1 += (UInt16) (K[j++] + (R0 & R3) + ((~R0) & R2));
+ R1 = (UInt16) ((R1 << 2) | (R1 >> 14));
+
+ R2 += (UInt16) (K[j++] + (R1 & R0) + ((~R1) & R3));
+ R2 = (UInt16) ((R2 << 3) | (R2 >> 13));
+
+ R3 += (UInt16) (K[j++] + (R2 & R1) + ((~R2) & R0));
+ R3 = (UInt16) ((R3 << 5) | (R3 >> 11));
+ }
+ }
+ else {
+ j = 63;
+ // inline, but looped, RMix(); RMix(); RMix(); RMix(); RMix();
+ while (j >= 44) {
+ R3 = (UInt16) ((R3 >> 5) | (R3 << 11));
+ R3 -= (UInt16) (K[j--] + (R2 & R1) + ((~R2) & R0));
+
+ R2 = (UInt16) ((R2 >> 3) | (R2 << 13));
+ R2 -= (UInt16) (K[j--] + (R1 & R0) + ((~R1) & R3));
+
+ R1 = (UInt16) ((R1 >> 2) | (R1 << 14));
+ R1 -= (UInt16) (K[j--] + (R0 & R3) + ((~R0) & R2));
+
+ R0 = (UInt16) ((R0 >> 1) | (R0 << 15));
+ R0 -= (UInt16) (K[j--] + (R3 & R2) + ((~R3) & R1));
+ }
+
+ // inline RMash();
+ R3 -= K [R2 & 63];
+ R2 -= K [R1 & 63];
+ R1 -= K [R0 & 63];
+ R0 -= K [R3 & 63];
+
+ // inline, but looped, RMix(); RMix(); RMix(); RMix(); RMix(); RMix();
+ while (j >= 20) {
+ R3 = (UInt16) ((R3 >> 5) | (R3 << 11));
+ R3 -= (UInt16) (K[j--] + (R2 & R1) + ((~R2) & R0));
+
+ R2 = (UInt16) ((R2 >> 3) | (R2 << 13));
+ R2 -= (UInt16) (K[j--] + (R1 & R0) + ((~R1) & R3));
+
+ R1 = (UInt16) ((R1 >> 2) | (R1 << 14));
+ R1 -= (UInt16) (K[j--] + (R0 & R3) + ((~R0) & R2));
+
+ R0 = (UInt16) ((R0 >> 1) | (R0 << 15));
+ R0 -= (UInt16) (K[j--] + (R3 & R2) + ((~R3) & R1));
+ }
+
+ // inline RMash();
+ R3 -= K [R2 & 63];
+ R2 -= K [R1 & 63];
+ R1 -= K [R0 & 63];
+ R0 -= K [R3 & 63];
+
+ // inline, but looped, RMix(); RMix(); RMix(); RMix(); RMix();
+ while (j >= 0) {
+ R3 = (UInt16) ((R3 >> 5) | (R3 << 11));
+ R3 -= (UInt16) (K[j--] + (R2 & R1) + ((~R2) & R0));
+
+ R2 = (UInt16) ((R2 >> 3) | (R2 << 13));
+ R2 -= (UInt16) (K[j--] + (R1 & R0) + ((~R1) & R3));
+
+ R1 = (UInt16) ((R1 >> 2) | (R1 << 14));
+ R1 -= (UInt16) (K[j--] + (R0 & R3) + ((~R0) & R2));
+
+ R0 = (UInt16) ((R0 >> 1) | (R0 << 15));
+ R0 -= (UInt16) (K[j--] + (R3 & R2) + ((~R3) & R1));
+ }
+ }
+
+ // unrolled loop
+ output[0] = (byte) R0;
+ output[1] = (byte) (R0 >> 8);
+ output[2] = (byte) R1;
+ output[3] = (byte) (R1 >> 8);
+ output[4] = (byte) R2;
+ output[5] = (byte) (R2 >> 8);
+ output[6] = (byte) R3;
+ output[7] = (byte) (R3 >> 8);
+ }
+
+ static private byte[] pitable = {
+ 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed,
+ 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
+ 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e,
+ 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,
+ 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13,
+ 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,
+ 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b,
+ 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,
+ 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c,
+ 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,
+ 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1,
+ 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,
+ 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57,
+ 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,
+ 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7,
+ 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,
+ 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7,
+ 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,
+ 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74,
+ 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,
+ 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc,
+ 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,
+ 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a,
+ 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,
+ 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae,
+ 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,
+ 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c,
+ 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,
+ 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0,
+ 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,
+ 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77,
+ 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad
+ };
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs
new file mode 100644
index 00000000000..e5eb5e5b18a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs
@@ -0,0 +1,62 @@
+//
+// System.Security.Cryptography.RNGCryptoServiceProvider
+//
+// Author: Mark Crichton (crichton@gimp.org)
+//
+// (C) 2002
+//
+
+// "In the beginning there was Chaos,
+// and within this Chaos was Power,
+// Great Power without form."
+// -- The Verrah Rubicon of Verena, Book One
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Security.Cryptography {
+
+ public class RNGCryptoServiceProvider : RandomNumberGenerator {
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider () {
+ // This will get some meaning when I figure out what the other
+ // three constructors do.
+ }
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider (byte[] rgb) {
+ // Ok, not called by app code... someone must call it, though.
+ }
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider (CspParameters cspParams) {
+ // Why do I have this feeling this is the MS CryptAPI...
+ }
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider (string str) {
+ // More !application code. Interesting...
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void InternalGetBytes (byte[] data);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void InternalGetNonZeroBytes (byte[] data);
+
+ public override void GetBytes (byte[] data)
+ {
+ InternalGetBytes (data);
+ }
+
+ public override void GetNonZeroBytes (byte[] data)
+ {
+ InternalGetNonZeroBytes (data);
+ }
+
+ ~RNGCryptoServiceProvider () {
+ // FIN?
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSA.cs b/mcs/class/corlib/System.Security.Cryptography/RSA.cs
new file mode 100644
index 00000000000..84411b818d2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSA.cs
@@ -0,0 +1,185 @@
+//
+// System.Security.Cryptography.RSA.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Text;
+
+namespace System.Security.Cryptography
+{
+ internal class RSAHandler : MiniParser.IHandler {
+
+ private RSAParameters rsa;
+ private byte[] temp;
+
+ public RSAHandler ()
+ {
+ rsa = new RSAParameters();
+ }
+
+ public RSAParameters GetParams () {
+ return rsa;
+ }
+
+ public void OnStartParsing (MiniParser parser) {}
+
+ public void OnStartElement (string name, MiniParser.IAttrList attrs) {}
+
+ public void OnEndElement (string name) {
+ switch (name) {
+ case "P":
+ rsa.P = temp;
+ break;
+ case "Q":
+ rsa.Q = temp;
+ break;
+ case "D":
+ rsa.D = temp;
+ break;
+ case "DP":
+ rsa.DP = temp;
+ break;
+ case "DQ":
+ rsa.DQ = temp;
+ break;
+ case "Exponent":
+ rsa.Exponent = temp;
+ break;
+ case "InverseQ":
+ rsa.InverseQ = temp;
+ break;
+ case "Modulus":
+ rsa.Modulus = temp;
+ break;
+ default:
+ // unknown tag in parameters
+ break;
+ }
+ }
+
+ public void OnChars (string ch)
+ {
+ temp = Convert.FromBase64String (ch);
+ }
+
+ public void OnEndParsing (MiniParser parser) {}
+ }
+
+ public abstract class RSA : AsymmetricAlgorithm
+ {
+ public static new RSA Create ()
+ {
+ return Create ("System.Security.Cryptography.RSA");
+ }
+
+ public static new RSA Create (string algName)
+ {
+ return (RSA) CryptoConfig.CreateFromName (algName);
+ }
+
+ public RSA () { }
+
+ public abstract byte[] EncryptValue (byte[] rgb);
+ public abstract byte[] DecryptValue (byte[] rgb);
+
+ public abstract RSAParameters ExportParameters (bool include);
+ public abstract void ImportParameters (RSAParameters parameters);
+
+ internal void ZeroizePrivateKey (RSAParameters parameters)
+ {
+ if (parameters.P != null)
+ Array.Clear(parameters.P, 0, parameters.P.Length);
+ if (parameters.Q != null)
+ Array.Clear(parameters.Q, 0, parameters.Q.Length);
+ if (parameters.DP != null)
+ Array.Clear(parameters.DP, 0, parameters.DP.Length);
+ if (parameters.DQ != null)
+ Array.Clear(parameters.DQ, 0, parameters.DQ.Length);
+ if (parameters.InverseQ != null)
+ Array.Clear(parameters.InverseQ, 0, parameters.InverseQ.Length);
+ if (parameters.D != null)
+ Array.Clear(parameters.D, 0, parameters.D.Length);
+ }
+
+ public override void FromXmlString (string xmlString)
+ {
+ if (xmlString == null)
+ throw new ArgumentNullException ();
+
+ RSAParameters rsaParams = new RSAParameters ();
+ try {
+ MiniParser parser = new MiniParser ();
+ AsymmetricParameters reader = new AsymmetricParameters (xmlString);
+ RSAHandler handler = new RSAHandler ();
+ parser.Parse(reader, handler);
+ ImportParameters (handler.GetParams ());
+ }
+ catch {
+ ZeroizePrivateKey (rsaParams);
+ throw new CryptographicException ();
+ }
+ finally {
+ ZeroizePrivateKey (rsaParams);
+ }
+ }
+
+ public override string ToXmlString (bool includePrivateParameters)
+ {
+ StringBuilder sb = new StringBuilder ();
+ RSAParameters rsaParams = ExportParameters (includePrivateParameters);
+ try {
+ sb.Append ("<RSAKeyValue>");
+
+ sb.Append ("<Modulus>");
+ sb.Append (Convert.ToBase64String (rsaParams.Modulus));
+ sb.Append ("</Modulus>");
+
+ sb.Append ("<Exponent>");
+ sb.Append (Convert.ToBase64String (rsaParams.Exponent));
+ sb.Append ("</Exponent>");
+
+ if (includePrivateParameters)
+ {
+ sb.Append ("<P>");
+ sb.Append (Convert.ToBase64String (rsaParams.P));
+ sb.Append ("</P>");
+
+ sb.Append ("<Q>");
+ sb.Append (Convert.ToBase64String (rsaParams.Q));
+ sb.Append ("</Q>");
+
+ sb.Append ("<DP>");
+ sb.Append (Convert.ToBase64String (rsaParams.DP));
+ sb.Append ("</DP>");
+
+ sb.Append ("<DQ>");
+ sb.Append (Convert.ToBase64String (rsaParams.DQ));
+ sb.Append ("</DQ>");
+
+ sb.Append ("<InverseQ>");
+ sb.Append (Convert.ToBase64String (rsaParams.InverseQ));
+ sb.Append ("</InverseQ>");
+
+ sb.Append ("<D>");
+ sb.Append (Convert.ToBase64String (rsaParams.D));
+ sb.Append ("</D>");
+ }
+
+ sb.Append ("</RSAKeyValue>");
+ }
+ catch {
+ ZeroizePrivateKey (rsaParams);
+ throw;
+ }
+
+ return sb.ToString ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
new file mode 100644
index 00000000000..0efb8ce4686
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
@@ -0,0 +1,377 @@
+//
+// RSACryptoServiceProvider.cs: Handles an RSA implementation.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+// Key generation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
+// See bouncycastle.txt for license.
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography {
+
+public sealed class RSACryptoServiceProvider : RSA {
+
+ private CspParameters cspParams;
+
+ private bool privateKeyExportable = true;
+ private bool keypairGenerated = false;
+ private bool persistKey = false;
+ private bool m_disposed = false;
+
+ private BigInteger d;
+ private BigInteger p;
+ private BigInteger q;
+ private BigInteger dp;
+ private BigInteger dq;
+ private BigInteger qInv;
+ private BigInteger n; // modulus
+ private BigInteger e;
+
+ public RSACryptoServiceProvider ()
+ {
+ // Here it's not clear if we need to generate a keypair
+ // (note: MS implementation generates a keypair in this case).
+ // However we:
+ // (a) often use this constructor to import an existing keypair.
+ // (b) take a LOT of time to generate the RSA keypair
+ // So we'll generate the keypair only when (and if) it's being
+ // used (or exported). This should save us a lot of time (at
+ // least in the unit tests).
+ Common (null);
+ }
+
+ public RSACryptoServiceProvider (CspParameters parameters)
+ {
+ Common (parameters);
+ // no keypair generation done at this stage
+ }
+
+ public RSACryptoServiceProvider (int dwKeySize)
+ {
+ // Here it's clear that we need to generate a new keypair
+ Common (null);
+ GenerateKeyPair (dwKeySize);
+ }
+
+ // FIXME: We currently dont link with MS CAPI. Anyway this makes
+ // only sense in Windows - what do we do elsewhere ?
+ public RSACryptoServiceProvider (int dwKeySize, CspParameters parameters)
+ {
+ Common (parameters);
+ GenerateKeyPair (dwKeySize);
+ }
+
+ [MonoTODO("Persistance")]
+ // FIXME: We currently dont link with MS CAPI. Anyway this makes
+ // only sense in Windows - what do we do elsewhere ?
+ private void Common (CspParameters p)
+ {
+ cspParams = new CspParameters ();
+ if (p == null) {
+ // TODO: set default values (for keypair persistance)
+ }
+ else {
+ cspParams = p;
+ // FIXME: We'll need this to support some kind of persistance
+ throw new NotSupportedException ("CspParameters not supported");
+ }
+ // Microsoft RSA CSP can do between 384 and 16384 bits keypair
+ // we limit ourselve to 2048 because (a) BigInteger limits and (b) it's so SLOW
+ LegalKeySizesValue = new KeySizes [1];
+ LegalKeySizesValue [0] = new KeySizes (384, 2048, 8);
+ }
+
+ private void GenerateKeyPair (int dwKeySize)
+ {
+ // will throw an exception is key size isn't supported
+ base.KeySize = dwKeySize;
+
+ // p and q values should have a length of half the strength in bits
+ int pbitlength = ((dwKeySize + 1) >> 1);
+ int qbitlength = (dwKeySize - pbitlength);
+ e = new BigInteger (17); // fixed
+
+ // generate p, prime and (p-1) relatively prime to e
+ for (;;) {
+ p = BigInteger.genPseudoPrime (pbitlength, 80);
+ if (e.gcd (p - 1) == 1)
+ break;
+ }
+ // generate a modulus of the required length
+ for (;;) {
+ // generate q, prime and (q-1) relatively prime to e,
+ // and not equal to p
+ for (;;) {
+ q = BigInteger.genPseudoPrime (qbitlength, 80);
+ if ((e.gcd (q - 1) == 1) && (p != q))
+ break;
+ }
+
+ // calculate the modulus
+ n = p * q;
+ if (n.bitCount () == dwKeySize)
+ break;
+
+ // if we get here our primes aren't big enough, make the largest
+ // of the two p and try again
+ p = p.max (q);
+ }
+
+ BigInteger pSub1 = (p - 1);
+ BigInteger qSub1 = (q - 1);
+ BigInteger phi = pSub1 * qSub1;
+
+ // calculate the private exponent
+ d = e.modInverse (phi);
+
+ // calculate the CRT factors
+ dp = d % pSub1;
+ dq = d % qSub1;
+ qInv = q.modInverse (p);
+
+ keypairGenerated = true;
+ }
+
+ // Zeroize private key
+ ~RSACryptoServiceProvider()
+ {
+ Dispose (false);
+ }
+
+ public override string KeyExchangeAlgorithm {
+ get { return "RSA-PKCS1-KeyEx"; }
+ }
+
+ public override int KeySize {
+ get { return n.bitCount(); }
+ }
+
+ [MonoTODO("Persistance")]
+ public bool PersistKeyInCsp {
+ get { return false; }
+ set { throw new NotSupportedException (); }
+ }
+
+ public override string SignatureAlgorithm {
+ get { return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; }
+ }
+
+ public byte[] Decrypt (byte[] rgb, bool fOAEP)
+ {
+ // choose between OAEP or PKCS#1 v.1.5 padding
+ if (fOAEP) {
+ SHA1 sha1 = SHA1.Create ();
+ return PKCS1.Decrypt_OAEP (this, sha1, null);
+ }
+ else {
+ return PKCS1.Decrypt_v15 (this, rgb);
+ }
+ }
+
+ // NOTE: Unlike MS we need this method
+ // LAMESPEC: Not available from MS .NET framework but MS don't tell
+ // why! DON'T USE IT UNLESS YOU KNOW WHAT YOU ARE DOING!!! You should
+ // only encrypt/decrypt session (secret) key using asymmetric keys.
+ // Using this method to decrypt data IS dangerous (and very slow).
+ public override byte[] DecryptValue (byte[] rgb)
+ {
+ // it would be stupid to decrypt data with a newly
+ // generated keypair - so we return false
+ if (!keypairGenerated)
+ return null;
+
+ BigInteger input = new BigInteger (rgb);
+ BigInteger output = input.modPow (d, n);
+ return output.getBytes ();
+ }
+
+ public byte[] Encrypt (byte[] rgb, bool fOAEP)
+ {
+ RandomNumberGenerator rng = RandomNumberGenerator.Create ();
+ // choose between OAEP or PKCS#1 v.1.5 padding
+ if (fOAEP) {
+ SHA1 sha1 = SHA1.Create ();
+ return PKCS1.Encrypt_OAEP (this, sha1, rng, rgb);
+ }
+ else {
+ return PKCS1.Encrypt_v15 (this, rng, rgb) ;
+ }
+ }
+
+ // NOTE: Unlike MS we need this method
+ // LAMESPEC: Not available from MS .NET framework but MS don't tell
+ // why! DON'T USE IT UNLESS YOU KNOW WHAT YOU ARE DOING!!! You should
+ // only encrypt/decrypt session (secret) key using asymmetric keys.
+ // Using this method to encrypt data IS dangerous (and very slow).
+ public override byte[] EncryptValue (byte[] rgb)
+ {
+ if (!keypairGenerated)
+ GenerateKeyPair (1024);
+
+ // TODO: With CRT
+ // without CRT
+ BigInteger input = new BigInteger (rgb);
+ BigInteger output = input.modPow (e, n);
+ return output.getBytes ();
+ }
+
+ public override RSAParameters ExportParameters (bool includePrivateParameters)
+ {
+ if ((includePrivateParameters) && (!privateKeyExportable))
+ throw new CryptographicException ("cannot export private key");
+ if (!keypairGenerated)
+ GenerateKeyPair (1024);
+
+ RSAParameters param = new RSAParameters();
+ param.Exponent = e.getBytes ();
+ param.Modulus = n.getBytes ();
+ if (includePrivateParameters) {
+ param.D = d.getBytes ();
+ param.DP = dp.getBytes ();
+ param.DQ = dq.getBytes ();
+ param.InverseQ = qInv.getBytes ();
+ param.P = p.getBytes ();
+ param.Q = q.getBytes ();
+ }
+ return param;
+ }
+
+ public override void ImportParameters (RSAParameters parameters)
+ {
+ // if missing "mandatory" parameters
+ if ((parameters.Exponent == null) || (parameters.Modulus == null))
+ throw new CryptographicException ();
+
+ e = new BigInteger (parameters.Exponent);
+ n = new BigInteger (parameters.Modulus);
+ // only if the private key is present
+ if (parameters.D != null)
+ d = new BigInteger (parameters.D);
+ if (parameters.DP != null)
+ dp = new BigInteger (parameters.DP);
+ if (parameters.DQ != null)
+ dq = new BigInteger (parameters.DQ);
+ if (parameters.InverseQ != null)
+ qInv = new BigInteger (parameters.InverseQ);
+ if (parameters.P != null)
+ p = new BigInteger (parameters.P);
+ if (parameters.Q != null)
+ q = new BigInteger (parameters.Q);
+
+ // we now have a keypair
+ keypairGenerated = true;
+ }
+
+ private HashAlgorithm GetHash (object halg)
+ {
+ if (halg == null)
+ throw new ArgumentNullException ();
+
+ HashAlgorithm hash = null;
+ if (halg is String)
+ hash = HashAlgorithm.Create ((String)halg);
+ else if (halg is HashAlgorithm)
+ hash = (HashAlgorithm) halg;
+ else if (halg is Type)
+ hash = (HashAlgorithm) Activator.CreateInstance ((Type)halg);
+ else
+ throw new ArgumentException ();
+
+ return hash;
+ }
+
+ public byte[] SignData (byte[] buffer, object halg)
+ {
+ return SignData (buffer, 0, buffer.Length, halg);
+ }
+
+ public byte[] SignData (Stream inputStream, object halg)
+ {
+ HashAlgorithm hash = GetHash (halg);
+ byte[] toBeSigned = hash.ComputeHash (inputStream);
+
+ string oid = CryptoConfig.MapNameToOID (hash.ToString ());
+ return SignHash (toBeSigned, oid);
+ }
+
+ public byte[] SignData (byte[] buffer, int offset, int count, object halg)
+ {
+ HashAlgorithm hash = GetHash (halg);
+ byte[] toBeSigned = hash.ComputeHash (buffer, offset, count);
+ string oid = CryptoConfig.MapNameToOID (hash.ToString ());
+ return SignHash (toBeSigned, oid);
+ }
+
+ private void ValidateHash (string oid, int length)
+ {
+ if (oid == "1.3.14.3.2.26") {
+ if (length != 20)
+ throw new CryptographicException ("wrong hash size for SHA1");
+ }
+ else if (oid == "1.2.840.113549.2.5") {
+ if (length != 16)
+ throw new CryptographicException ("wrong hash size for MD5");
+ }
+ else
+ throw new NotSupportedException (oid + " is an unsupported hash algorithm for RSA signing");
+ }
+
+ public byte[] SignHash (byte[] rgbHash, string str)
+ {
+ if (rgbHash == null)
+ throw new ArgumentNullException ();
+
+ if (!keypairGenerated)
+ GenerateKeyPair (1024);
+
+ ValidateHash (str, rgbHash.Length);
+
+ return PKCS1.Sign_v15 (this, str, rgbHash);
+ }
+
+ public bool VerifyData (byte[] buffer, object halg, byte[] signature)
+ {
+ HashAlgorithm hash = GetHash (halg);
+ byte[] toBeVerified = hash.ComputeHash (buffer);
+ string oid = CryptoConfig.MapNameToOID (hash.ToString ());
+ return VerifyHash (toBeVerified, oid, signature);
+ }
+
+ public bool VerifyHash (byte[] rgbHash, string str, byte[] rgbSignature)
+ {
+ if ((rgbHash == null) || (rgbSignature == null))
+ throw new ArgumentNullException ();
+
+ // it would be stupid to verify a signature with a newly
+ // generated keypair - so we return false
+ if (!keypairGenerated)
+ return false;
+
+ ValidateHash (str, rgbHash.Length);
+
+ return PKCS1.Verify_v15 (this, str, rgbHash, rgbSignature);
+ }
+
+ [MonoTODO()]
+ protected override void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // TODO: always zeroize private key
+ if(disposing) {
+ // TODO: Dispose managed resources
+ }
+
+ // TODO: Dispose unmanaged resources
+ }
+ // call base class
+ // no need as they all are abstract before us
+ m_disposed = true;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.cs
new file mode 100644
index 00000000000..35932973b30
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.cs
@@ -0,0 +1,53 @@
+//
+// RSAOAEPKeyExchangeDeformatter.cs - Handles OAEP keyex decryption.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
+
+ private RSA rsa;
+ private string param;
+
+ public RSAOAEPKeyExchangeDeformatter ()
+ {
+ rsa = null;
+ }
+
+ public RSAOAEPKeyExchangeDeformatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public override string Parameters {
+ get { return param; }
+ set { param = value; }
+ }
+
+ public override byte[] DecryptKeyExchange (byte[] rgbData)
+ {
+ if (rsa == null)
+ throw new CryptographicException ();
+
+ SHA1 sha1 = SHA1.Create ();
+ return PKCS1.Decrypt_OAEP (rsa, sha1, rgbData);
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key is RSA) {
+ rsa = (RSA)key;
+ }
+ else
+ throw new CryptographicException ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.cs
new file mode 100644
index 00000000000..b7ebd2a57fa
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.cs
@@ -0,0 +1,71 @@
+//
+// RSAOAEPKeyExchangeFormatter.cs - Handles OAEP keyex encryption.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter {
+
+ private RSA rsa;
+ private RandomNumberGenerator random;
+
+ public RSAOAEPKeyExchangeFormatter ()
+ {
+ rsa = null;
+ }
+
+ public RSAOAEPKeyExchangeFormatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public byte[] Parameter {
+ get { return null; }
+ set { ; }
+ }
+
+ public override string Parameters {
+ get { return null; }
+ }
+
+ public RandomNumberGenerator Rng {
+ get { return random; }
+ set { random = value; }
+ }
+
+ public override byte[] CreateKeyExchange (byte[] rgbData)
+ {
+ if (rsa == null)
+ throw new CryptographicException ();
+ if (random == null)
+ random = RandomNumberGenerator.Create (); // create default
+
+ SHA1 sha1 = SHA1.Create ();
+ return PKCS1.Encrypt_OAEP (rsa, sha1, random, rgbData);
+ }
+
+ public override byte[] CreateKeyExchange (byte[] rgbData, Type symAlgType)
+ {
+ // documentation says that symAlgType is not used !?!
+ // FIXME: must be the same as previous method ?
+ return CreateKeyExchange (rgbData);
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key is RSA) {
+ rsa = (RSA) key;
+ }
+ else
+ throw new CryptographicException ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.cs
new file mode 100644
index 00000000000..d9ae1ccbead
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.cs
@@ -0,0 +1,57 @@
+//
+// RSAPKCS1KeyExchangeDeformatter.cs - Handles PKCS#1 v.1.5 keyex decryption.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class RSAPKCS1KeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
+
+ private RSA rsa;
+ private string param;
+ private RandomNumberGenerator random;
+
+ public RSAPKCS1KeyExchangeDeformatter ()
+ {
+ rsa = null;
+ }
+
+ public RSAPKCS1KeyExchangeDeformatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public override string Parameters {
+ get { return param; }
+ set { param = value; }
+ }
+
+ public RandomNumberGenerator RNG {
+ get { return random; }
+ set { random = value; }
+ }
+
+ public override byte[] DecryptKeyExchange (byte[] rgbData)
+ {
+ if (rsa == null)
+ throw new CryptographicException ();
+ return PKCS1.Decrypt_v15 (rsa, rgbData);
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key is RSA) {
+ rsa = (RSA)key;
+ }
+ else
+ throw new CryptographicException ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.cs
new file mode 100644
index 00000000000..c802c6dc6be
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.cs
@@ -0,0 +1,73 @@
+//
+// RSAPKCS1KeyExchangeFormatter.cs: Handles PKCS#1 v.1.5 keyex encryption.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography
+{
+
+// LAMESPEC: There seems no way to select a hash algorithm. The default
+// algorithm, is SHA1 because the class use the PKCS1MaskGenerationMethod -
+// which default to SHA1.
+public class RSAPKCS1KeyExchangeFormatter: AsymmetricKeyExchangeFormatter
+{
+ private RSA rsa;
+ private RandomNumberGenerator random;
+
+ public RSAPKCS1KeyExchangeFormatter ()
+ {
+ }
+
+ public RSAPKCS1KeyExchangeFormatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public RandomNumberGenerator Rng
+ {
+ get { return random; }
+ set { random = value; }
+ }
+
+ public override string Parameters
+ {
+ get { return "<enc:KeyEncryptionMethod enc:Algorithm=\"http://www.microsoft.com/xml/security/algorithm/PKCS1-v1.5-KeyEx\" xmlns:enc=\"http://www.microsoft.com/xml/security/encryption/v1.0\" />"; }
+ }
+
+ public override byte[] CreateKeyExchange (byte[] rgbData)
+ {
+ if (rsa == null)
+ throw new CryptographicException ();
+ if (random == null)
+ random = RandomNumberGenerator.Create (); // create default
+ return PKCS1.Encrypt_v15 (rsa, random, rgbData);
+ }
+
+ public override byte[] CreateKeyExchange (byte[] rgbData, Type symAlgType)
+ {
+ // documentation says that symAlgType is not used !?!
+ // FIXME: must be the same as previous method ?
+ return CreateKeyExchange (rgbData);
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key != null) {
+ if (key is RSA) {
+ rsa = (RSA)key;
+ }
+ else
+ throw new InvalidCastException ();
+ }
+ // here null is accepted!
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs
new file mode 100644
index 00000000000..24e1a2b8c30
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs
@@ -0,0 +1,58 @@
+//
+// RSAPKCS1SignatureDeformatter.cs - Handles PKCS#1 v.1.5 signature decryption.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class RSAPKCS1SignatureDeformatter : AsymmetricSignatureDeformatter {
+
+ private RSA rsa;
+ private HashAlgorithm hash;
+
+ public RSAPKCS1SignatureDeformatter ()
+ {
+ rsa = null;
+ }
+
+ public RSAPKCS1SignatureDeformatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public override void SetHashAlgorithm (string strName)
+ {
+ hash = HashAlgorithm.Create (strName);
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key != null) {
+ if (key is RSA) {
+ rsa = (RSA)key;
+ }
+ else
+ throw new InvalidCastException ();
+ }
+ // here null is accepted!
+ }
+
+ public override bool VerifySignature (byte[] rgbHash, byte[] rgbSignature)
+ {
+ if ((rsa == null) || (hash == null))
+ throw new CryptographicUnexpectedOperationException ();
+ if ((rgbHash == null) || (rgbSignature == null))
+ throw new ArgumentNullException ();
+
+ string oid = CryptoConfig.MapNameToOID (hash.ToString ());
+ return PKCS1.Verify_v15 (rsa, oid, rgbHash, rgbSignature);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureFormatter.cs
new file mode 100644
index 00000000000..6ed64673fc9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureFormatter.cs
@@ -0,0 +1,58 @@
+//
+// RSAPKCS1SignatureFormatter.cs - Handles PKCS#1 v.1.5 signature encryption.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class RSAPKCS1SignatureFormatter : AsymmetricSignatureFormatter {
+
+ private RSA rsa;
+ private HashAlgorithm hash;
+
+ public RSAPKCS1SignatureFormatter ()
+ {
+ rsa = null;
+ }
+
+ public RSAPKCS1SignatureFormatter (AsymmetricAlgorithm key)
+ {
+ SetKey (key);
+ }
+
+ public override byte[] CreateSignature (byte[] rgbHash)
+ {
+ if ((rsa == null) || (hash == null))
+ throw new CryptographicUnexpectedOperationException ();
+ if (rgbHash == null)
+ throw new ArgumentNullException ();
+
+ string oid = CryptoConfig.MapNameToOID (hash.ToString ());
+ return PKCS1.Sign_v15 (rsa, oid, rgbHash);
+ }
+
+ public override void SetHashAlgorithm (string strName)
+ {
+ hash = HashAlgorithm.Create (strName);
+ }
+
+ public override void SetKey (AsymmetricAlgorithm key)
+ {
+ if (key != null) {
+ if (key is RSA) {
+ rsa = (RSA)key;
+ }
+ else
+ throw new InvalidCastException ();
+ }
+ // here null is accepted!
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs b/mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs
new file mode 100644
index 00000000000..112f89124b9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs
@@ -0,0 +1,32 @@
+//
+// System.Security.Cryptography.RSAParameters.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [Serializable]
+ public struct RSAParameters {
+ [NonSerialized]
+ public byte[] P;
+ [NonSerialized]
+ public byte[] Q;
+ [NonSerialized]
+ public byte[] D;
+ [NonSerialized]
+ public byte[] DP;
+ [NonSerialized]
+ public byte[] DQ;
+ [NonSerialized]
+ public byte[] InverseQ;
+
+ public byte[] Modulus;
+ public byte[] Exponent;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs b/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
new file mode 100755
index 00000000000..a2bcace42c7
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
@@ -0,0 +1,35 @@
+//
+// System.Security.Cryptography.RandomNumberGenerator
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using System.Globalization;
+
+namespace System.Security.Cryptography {
+
+public abstract class RandomNumberGenerator {
+
+ public RandomNumberGenerator () {}
+
+ public static RandomNumberGenerator Create ()
+ {
+ // create the default random number generator
+ return Create ("System.Security.Cryptography.RandomNumberGenerator");
+ }
+
+ public static RandomNumberGenerator Create (string rngName)
+ {
+ return (RandomNumberGenerator) (CryptoConfig.CreateFromName (rngName));
+ }
+
+ public abstract void GetBytes (byte[] data);
+
+ public abstract void GetNonZeroBytes (byte[] data);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/Rijndael.cs b/mcs/class/corlib/System.Security.Cryptography/Rijndael.cs
new file mode 100644
index 00000000000..dec4cafaf54
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/Rijndael.cs
@@ -0,0 +1,39 @@
+//
+// System.Security.Cryptography.Rijndael.cs
+//
+// Authors: Dan Lewis (dihlewis@yahoo.co.uk)
+// Andrew Birkett (andy@nobugs.org)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ public abstract class Rijndael : SymmetricAlgorithm {
+
+ public static new Rijndael Create ()
+ {
+ return Create ("System.Security.Cryptography.Rijndael");
+ }
+
+ public static new Rijndael Create (string algName)
+ {
+ return (Rijndael) CryptoConfig.CreateFromName (algName);
+ }
+
+ public Rijndael ()
+ {
+ KeySizeValue = 256;
+ BlockSizeValue = 128;
+ FeedbackSizeValue = 128;
+
+ LegalKeySizesValue = new KeySizes[1];
+ LegalKeySizesValue[0] = new KeySizes(128, 256, 64);
+
+ LegalBlockSizesValue = new KeySizes[1];
+ LegalBlockSizesValue[0] = new KeySizes(128, 256, 64);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs b/mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs
new file mode 100644
index 00000000000..73b5efeef6f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs
@@ -0,0 +1,522 @@
+//
+// System.Security.Cryptography.RijndaelManaged.cs
+//
+// Authors: Mark Crichton (crichton@gimp.org)
+// Andrew Birkett (andy@nobugs.org)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002
+// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+/// <summary>
+/// Rijndael is a symmetric block cipher supporting block and key sizes
+/// of 128, 192 and 256 bits. It has been chosen as the AES cipher.
+/// </summary>
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 197: Advanced Encryption Standard
+// http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
+
+public sealed class RijndaelManaged : Rijndael {
+
+ /// <summary>
+ /// RijndaelManaged constructor.
+ /// </summary>
+ public RijndaelManaged() {}
+
+ /// <summary>
+ /// Generates a random IV for block feedback modes
+ /// </summary>
+ /// <remarks>
+ /// Method is inherited from SymmetricAlgorithm
+ /// </remarks>
+ public override void GenerateIV ()
+ {
+ IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
+ }
+
+ /// <summary>
+ /// Generates a random key for Rijndael. Uses the current KeySize.
+ /// </summary>
+ /// <remarks>
+ /// Inherited method from base class SymmetricAlgorithm
+ /// </remarks>
+ public override void GenerateKey ()
+ {
+ KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
+ }
+
+ /// <summary>
+ /// Creates a symmetric Rijndael decryptor object
+ /// </summary>
+ /// <remarks>
+ /// Inherited method from base class SymmetricAlgorithm
+ /// </remarks>
+ /// <param name='rgbKey'>Key for Rijndael</param>
+ /// <param name='rgbIV'>IV for chaining mode</param>
+ public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new RijndaelTransform (this, false, rgbKey, rgbIV);
+ }
+
+ /// <summary>
+ /// Creates a symmetric Rijndael encryptor object
+ /// </summary>
+ /// <remarks>
+ /// Inherited method from base class SymmetricAlgorithm
+ /// </remarks>
+ /// <param name='rgbKey'>Key for Rijndael</param>
+ /// <param name='rgbIV'>IV for chaining mode</param>
+ public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new RijndaelTransform (this, true, rgbKey, rgbIV);
+ }
+}
+
+
+internal class RijndaelTransform : SymmetricTransform
+{
+ private byte[] key;
+ private byte[] expandedKey;
+
+ private int Nb;
+ private int Nk;
+ private int Nr;
+ private byte[] eshifts;
+ private byte[] dshifts;
+
+ private byte[] state;
+ private byte[] shifttemp;
+
+ private static byte[] e256shifts = { 1, 3, 4 };
+ private static byte[] d256shifts = { 7, 5, 4 };
+ private static byte[] e192shifts = { 1, 2, 3 };
+ private static byte[] d192shifts = { 5, 4, 3 };
+ private static byte[] e128shifts = { 1, 2, 3 };
+ private static byte[] d128shifts = { 3, 2, 1 };
+
+ private static Int32[] rcon = { 0, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, -2147483648, 452984832, 905969664, 1811939328, -671088640, -1426063360, 1291845632, -1711276032, 788529152, 1577058304, -1140850688, 1660944384, -973078528, -1761607680, 889192448, 1778384896, -738197504, -1291845632, 2097152000, -100663296, -285212672, -989855744, -1862270976 };
+
+ public RijndaelTransform (Rijndael algo, bool encryption, byte[] key, byte[] iv) : base (algo, encryption, iv)
+ {
+ int keySize = algo.KeySize;
+ if (keySize != 128 && keySize != 192 && keySize != 256)
+ throw new ArgumentException("Illegal key size");
+
+ int blockSize = algo.BlockSize;
+ if (blockSize != 128 && blockSize != 192 && blockSize != 256)
+ throw new ArgumentException("Illegal block size");
+
+ if ((key.Length << 3) != keySize)
+ throw new ArgumentException("Key size doesn't match key");
+
+ this.key = key;
+ this.Nb = (blockSize >> 5); // div 32
+ this.Nk = (keySize >> 5); // div 32
+ state = new byte [Nb << 2];
+ shifttemp = new byte [Nb << 2];
+
+ if (Nb == 8 || Nk == 8) {
+ Nr = 14;
+ } else if (Nb == 6 || Nk == 6) {
+ Nr = 12;
+ } else {
+ Nr = 10;
+ }
+
+ switch (Nb) {
+ case 8: // 256 bits
+ eshifts = e256shifts;
+ dshifts = d256shifts;
+ break;
+ case 6: // 192 bits
+ eshifts = e192shifts;
+ dshifts = d192shifts;
+ break;
+ case 4: // 128 bits
+ eshifts = e128shifts;
+ dshifts = d128shifts;
+ break;
+ }
+
+ // Setup Expanded Key
+ int exKeySize = Nb * (Nr+1);
+ Int32[] exKey = new Int32[exKeySize];
+ int pos = 0;
+ for (int i=0; i < Nk; i++) {
+ Int32 value = (key [pos++] << 24);
+ value |= (key [pos++] << 16);
+ value |= (key [pos++] << 8);
+ value |= (key [pos++]);
+ exKey [i] = value;
+ }
+
+ for (int i = Nk; i < exKeySize; i++) {
+ Int32 temp = exKey [i-1];
+ if (i % Nk == 0) {
+ Int32 rot = (Int32) ((temp << 8) | ((temp >> 24) & 0xff));
+ temp = SubByte (rot) ^ rcon [i / Nk];
+ } else if (Nk > 6 && (i % Nk) == 4) {
+ temp = SubByte (temp);
+ }
+ exKey [i] = exKey [i-Nk] ^ temp;
+ }
+
+ // convert key to byte array (better performance)
+ // TODO: Don't convert - expand key directly in byte array
+ expandedKey = new byte [exKey.Length << 2];
+ int k = 0;
+ for (int i=0; i < exKey.Length; i++) {
+ expandedKey [k++] = (byte) (exKey[i] >> 24);
+ expandedKey [k++] = (byte) ((exKey[i] >> 16) & 0xff);
+ expandedKey [k++] = (byte) ((exKey[i] >> 8) & 0xff);
+ expandedKey [k++] = (byte) (exKey[i] & 0xff);
+ }
+ }
+
+ // note: this method is guaranteed to be called with a valid blocksize
+ // for both input and output
+ protected override void ECB (byte[] input, byte[] output)
+ {
+ int pos, ori;
+ for (pos = 0; pos < input.Length; pos++)
+ state [pos] = input [pos];
+
+ if (encrypt) {
+ // inline AddRoundKey (0, true);
+ int roundoffset = 0;
+ int p = 0;
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] ^= expandedKey [p++];
+
+ for (int round = 1; round < Nr; round++) {
+ // inline ByteSub (true);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] = sbox [state [pos]];
+
+ ShiftRow (true);
+
+ // inline MixColumn ();
+ pos = 0;
+ ori = 0;
+ for (int col = 0; col < Nb; col++) {
+ byte s0 = state [pos++];
+ byte s1 = state [pos++];
+ byte s2 = state [pos++];
+ byte s3 = state [pos++];
+ state [ori++] = (byte) (mult2 [s0] ^ mult3 [s1] ^ s2 ^ s3);
+ state [ori++] = (byte) (mult2 [s1] ^ mult3 [s2] ^ s3 ^ s0);
+ state [ori++] = (byte) (mult2 [s2] ^ mult3 [s3] ^ s0 ^ s1);
+ state [ori++] = (byte) (mult2 [s3] ^ mult3 [s0] ^ s1 ^ s2);
+ }
+
+ // inline AddRoundKey (round, true);
+ roundoffset += Nb;
+ p = (roundoffset << 2);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] ^= expandedKey [p++];
+ }
+ // inline ByteSub (true);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] = sbox [state [pos]];
+
+ ShiftRow (true);
+
+ // inline AddRoundKey (Nr, true);
+ roundoffset += Nb;
+ p = (roundoffset << 2);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] ^= expandedKey [p++];
+ }
+ else {
+ // inline AddRoundKey (0, false);
+ int roundoffset = Nb * Nr;
+ int p = (roundoffset << 2);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] ^= expandedKey [p++];
+
+ ShiftRow (false);
+ // inline ByteSub (false);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] = invSbox [state [pos]];
+
+ for (int round = 1; round < Nr; round++) {
+ // inline AddRoundKey (round, false);
+ roundoffset -= Nb;
+ p = (roundoffset << 2);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] ^= expandedKey [p++];
+
+ // inline InvMixColumn ();
+ pos = 0;
+ ori = 0;
+ for (int col = 0; col < Nb; col++) {
+ byte s0 = state [pos++];
+ byte s1 = state [pos++];
+ byte s2 = state [pos++];
+ byte s3 = state [pos++];
+ state [ori++] = (byte) (multE [s0] ^ multB [s1] ^ multD [s2] ^ mult9 [s3]);
+ state [ori++] = (byte) (multE [s1] ^ multB [s2] ^ multD [s3] ^ mult9 [s0]);
+ state [ori++] = (byte) (multE [s2] ^ multB [s3] ^ multD [s0] ^ mult9 [s1]);
+ state [ori++] = (byte) (multE [s3] ^ multB [s0] ^ multD [s1] ^ mult9 [s2]);
+ }
+
+ ShiftRow (false);
+
+ // inline ByteSub (false);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] = invSbox [state [pos]];
+ }
+
+ // inline AddRoundKey (Nr, false);
+ roundoffset -= Nb;
+ p = (roundoffset << 2);
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] ^= expandedKey [p++];
+ }
+
+ for (pos = 0; pos < input.Length; pos++)
+ output [pos] = state [pos];
+ }
+
+ private void ShiftRow (bool encrypt)
+ {
+ byte[] shifts = encrypt ? eshifts : dshifts;
+ int pos = 0;
+ for (int col = 0; col < Nb; col++) {
+ shifttemp [pos] = state [pos++];
+
+ int source_col = (col + shifts [0]);
+ if (source_col >= Nb) source_col -= Nb;
+ shifttemp [pos++] = state [(source_col << 2) + 1];
+
+ source_col = (col + shifts [1]);
+ if (source_col >= Nb) source_col -= Nb;
+ shifttemp [pos++] = state [(source_col << 2) + 2];
+
+ source_col = (col + shifts [2]);
+ if (source_col >= Nb) source_col -= Nb;
+ shifttemp [pos++] = state [(source_col << 2) + 3];
+ }
+
+ for (pos = 0; pos < state.Length; pos++)
+ state [pos] = shifttemp [pos];
+ }
+
+ private Int32 SubByte (Int32 a)
+ {
+ Int32 value = 0xff & a;
+ Int32 result = sbox [value];
+ value = 0xff & (a >> 8);
+ result |= sbox [value] << 8;
+ value = 0xff & (a >> 16);
+ result |= sbox [value] << 16;
+ value = 0xff & (a >> 24);
+ return result | (sbox [value] << 24);
+ }
+
+ // Constant tables used in the cipher
+ static byte[] sbox = {
+ 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,
+ 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192,
+ 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21,
+ 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117,
+ 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132,
+ 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207,
+ 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168,
+ 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210,
+ 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115,
+ 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219,
+ 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121,
+ 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8,
+ 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138,
+ 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158,
+ 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223,
+ 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22
+ };
+
+ static byte[] invSbox = {
+ 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251,
+ 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203,
+ 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78,
+ 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37,
+ 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146,
+ 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132,
+ 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6,
+ 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107,
+ 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115,
+ 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110,
+ 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27,
+ 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244,
+ 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95,
+ 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239,
+ 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97,
+ 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125
+ };
+
+/* Original tables - DO NOT DELETE !
+ * static byte[] logtable = {
+ 0, 0, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3,
+ 100, 4, 224, 14, 52, 141, 129, 239, 76, 113, 8, 200, 248, 105, 28, 193,
+ 125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, 114, 154, 201, 9, 120,
+ 101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142,
+ 150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56,
+ 102, 221, 253, 48, 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16,
+ 126, 110, 72, 195, 163, 182, 30, 66, 58, 107, 40, 84, 250, 133, 61, 186,
+ 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, 167, 87,
+ 175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232,
+ 44, 215, 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160,
+ 127, 12, 246, 111, 23, 196, 73, 236, 216, 67, 31, 45, 164, 118, 123, 183,
+ 204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, 170, 85, 41, 157,
+ 151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209,
+ 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171,
+ 68, 17, 146, 217, 35, 32, 46, 137, 180, 124, 184, 38, 119, 153, 227, 165,
+ 103, 74, 237, 222, 197, 49, 254, 24, 13, 99, 140, 128, 192, 247, 112, 7
+ };
+
+ static byte[] alogtable = {
+ 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53,
+ 95, 225, 56, 72, 216, 115, 149, 164, 247, 2, 6, 10, 30, 34, 102, 170,
+ 229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, 112, 144, 171, 230, 49,
+ 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205,
+ 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136,
+ 131, 158, 185, 208, 107, 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154,
+ 181, 196, 87, 249, 16, 48, 80, 240, 11, 29, 39, 105, 187, 214, 97, 163,
+ 254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, 32, 96, 160,
+ 251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65,
+ 195, 94, 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117,
+ 159, 186, 213, 100, 172, 239, 42, 126, 130, 157, 188, 223, 122, 142, 137, 128,
+ 155, 182, 193, 88, 232, 35, 101, 175, 234, 37, 111, 177, 200, 67, 197, 84,
+ 252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, 202,
+ 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14,
+ 18, 54, 90, 238, 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23,
+ 57, 75, 221, 124, 132, 151, 162, 253, 28, 36, 108, 180, 199, 82, 246, 1
+ };*/
+
+ static byte[] mult2 = {
+ 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E,
+ 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E,
+ 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E,
+ 0x60, 0x62, 0x64, 0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7A, 0x7C, 0x7E,
+ 0x80, 0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9C, 0x9E,
+ 0xA0, 0xA2, 0xA4, 0xA6, 0xA8, 0xAA, 0xAC, 0xAE, 0xB0, 0xB2, 0xB4, 0xB6, 0xB8, 0xBA, 0xBC, 0xBE,
+ 0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE,
+ 0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE, 0xF0, 0xF2, 0xF4, 0xF6, 0xF8, 0xFA, 0xFC, 0xFE,
+ 0x1B, 0x19, 0x1F, 0x1D, 0x13, 0x11, 0x17, 0x15, 0x0B, 0x09, 0x0F, 0x0D, 0x03, 0x01, 0x07, 0x05,
+ 0x3B, 0x39, 0x3F, 0x3D, 0x33, 0x31, 0x37, 0x35, 0x2B, 0x29, 0x2F, 0x2D, 0x23, 0x21, 0x27, 0x25,
+ 0x5B, 0x59, 0x5F, 0x5D, 0x53, 0x51, 0x57, 0x55, 0x4B, 0x49, 0x4F, 0x4D, 0x43, 0x41, 0x47, 0x45,
+ 0x7B, 0x79, 0x7F, 0x7D, 0x73, 0x71, 0x77, 0x75, 0x6B, 0x69, 0x6F, 0x6D, 0x63, 0x61, 0x67, 0x65,
+ 0x9B, 0x99, 0x9F, 0x9D, 0x93, 0x91, 0x97, 0x95, 0x8B, 0x89, 0x8F, 0x8D, 0x83, 0x81, 0x87, 0x85,
+ 0xBB, 0xB9, 0xBF, 0xBD, 0xB3, 0xB1, 0xB7, 0xB5, 0xAB, 0xA9, 0xAF, 0xAD, 0xA3, 0xA1, 0xA7, 0xA5,
+ 0xDB, 0xD9, 0xDF, 0xDD, 0xD3, 0xD1, 0xD7, 0xD5, 0xCB, 0xC9, 0xCF, 0xCD, 0xC3, 0xC1, 0xC7, 0xC5,
+ 0xFB, 0xF9, 0xFF, 0xFD, 0xF3, 0xF1, 0xF7, 0xF5, 0xEB, 0xE9, 0xEF, 0xED, 0xE3, 0xE1, 0xE7, 0xE5
+ };
+
+ static byte[] mult3 = {
+ 0x00, 0x03, 0x06, 0x05, 0x0C, 0x0F, 0x0A, 0x09, 0x18, 0x1B, 0x1E, 0x1D, 0x14, 0x17, 0x12, 0x11,
+ 0x30, 0x33, 0x36, 0x35, 0x3C, 0x3F, 0x3A, 0x39, 0x28, 0x2B, 0x2E, 0x2D, 0x24, 0x27, 0x22, 0x21,
+ 0x60, 0x63, 0x66, 0x65, 0x6C, 0x6F, 0x6A, 0x69, 0x78, 0x7B, 0x7E, 0x7D, 0x74, 0x77, 0x72, 0x71,
+ 0x50, 0x53, 0x56, 0x55, 0x5C, 0x5F, 0x5A, 0x59, 0x48, 0x4B, 0x4E, 0x4D, 0x44, 0x47, 0x42, 0x41,
+ 0xC0, 0xC3, 0xC6, 0xC5, 0xCC, 0xCF, 0xCA, 0xC9, 0xD8, 0xDB, 0xDE, 0xDD, 0xD4, 0xD7, 0xD2, 0xD1,
+ 0xF0, 0xF3, 0xF6, 0xF5, 0xFC, 0xFF, 0xFA, 0xF9, 0xE8, 0xEB, 0xEE, 0xED, 0xE4, 0xE7, 0xE2, 0xE1,
+ 0xA0, 0xA3, 0xA6, 0xA5, 0xAC, 0xAF, 0xAA, 0xA9, 0xB8, 0xBB, 0xBE, 0xBD, 0xB4, 0xB7, 0xB2, 0xB1,
+ 0x90, 0x93, 0x96, 0x95, 0x9C, 0x9F, 0x9A, 0x99, 0x88, 0x8B, 0x8E, 0x8D, 0x84, 0x87, 0x82, 0x81,
+ 0x9B, 0x98, 0x9D, 0x9E, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8F, 0x8C, 0x89, 0x8A,
+ 0xAB, 0xA8, 0xAD, 0xAE, 0xA7, 0xA4, 0xA1, 0xA2, 0xB3, 0xB0, 0xB5, 0xB6, 0xBF, 0xBC, 0xB9, 0xBA,
+ 0xFB, 0xF8, 0xFD, 0xFE, 0xF7, 0xF4, 0xF1, 0xF2, 0xE3, 0xE0, 0xE5, 0xE6, 0xEF, 0xEC, 0xE9, 0xEA,
+ 0xCB, 0xC8, 0xCD, 0xCE, 0xC7, 0xC4, 0xC1, 0xC2, 0xD3, 0xD0, 0xD5, 0xD6, 0xDF, 0xDC, 0xD9, 0xDA,
+ 0x5B, 0x58, 0x5D, 0x5E, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4F, 0x4C, 0x49, 0x4A,
+ 0x6B, 0x68, 0x6D, 0x6E, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7F, 0x7C, 0x79, 0x7A,
+ 0x3B, 0x38, 0x3D, 0x3E, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2F, 0x2C, 0x29, 0x2A,
+ 0x0B, 0x08, 0x0D, 0x0E, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1F, 0x1C, 0x19, 0x1A
+ };
+
+ static byte[] multE = {
+ 0x00, 0x0E, 0x1C, 0x12, 0x38, 0x36, 0x24, 0x2A, 0x70, 0x7E, 0x6C, 0x62, 0x48, 0x46, 0x54, 0x5A,
+ 0xE0, 0xEE, 0xFC, 0xF2, 0xD8, 0xD6, 0xC4, 0xCA, 0x90, 0x9E, 0x8C, 0x82, 0xA8, 0xA6, 0xB4, 0xBA,
+ 0xDB, 0xD5, 0xC7, 0xC9, 0xE3, 0xED, 0xFF, 0xF1, 0xAB, 0xA5, 0xB7, 0xB9, 0x93, 0x9D, 0x8F, 0x81,
+ 0x3B, 0x35, 0x27, 0x29, 0x03, 0x0D, 0x1F, 0x11, 0x4B, 0x45, 0x57, 0x59, 0x73, 0x7D, 0x6F, 0x61,
+ 0xAD, 0xA3, 0xB1, 0xBF, 0x95, 0x9B, 0x89, 0x87, 0xDD, 0xD3, 0xC1, 0xCF, 0xE5, 0xEB, 0xF9, 0xF7,
+ 0x4D, 0x43, 0x51, 0x5F, 0x75, 0x7B, 0x69, 0x67, 0x3D, 0x33, 0x21, 0x2F, 0x05, 0x0B, 0x19, 0x17,
+ 0x76, 0x78, 0x6A, 0x64, 0x4E, 0x40, 0x52, 0x5C, 0x06, 0x08, 0x1A, 0x14, 0x3E, 0x30, 0x22, 0x2C,
+ 0x96, 0x98, 0x8A, 0x84, 0xAE, 0xA0, 0xB2, 0xBC, 0xE6, 0xE8, 0xFA, 0xF4, 0xDE, 0xD0, 0xC2, 0xCC,
+ 0x41, 0x4F, 0x5D, 0x53, 0x79, 0x77, 0x65, 0x6B, 0x31, 0x3F, 0x2D, 0x23, 0x09, 0x07, 0x15, 0x1B,
+ 0xA1, 0xAF, 0xBD, 0xB3, 0x99, 0x97, 0x85, 0x8B, 0xD1, 0xDF, 0xCD, 0xC3, 0xE9, 0xE7, 0xF5, 0xFB,
+ 0x9A, 0x94, 0x86, 0x88, 0xA2, 0xAC, 0xBE, 0xB0, 0xEA, 0xE4, 0xF6, 0xF8, 0xD2, 0xDC, 0xCE, 0xC0,
+ 0x7A, 0x74, 0x66, 0x68, 0x42, 0x4C, 0x5E, 0x50, 0x0A, 0x04, 0x16, 0x18, 0x32, 0x3C, 0x2E, 0x20,
+ 0xEC, 0xE2, 0xF0, 0xFE, 0xD4, 0xDA, 0xC8, 0xC6, 0x9C, 0x92, 0x80, 0x8E, 0xA4, 0xAA, 0xB8, 0xB6,
+ 0x0C, 0x02, 0x10, 0x1E, 0x34, 0x3A, 0x28, 0x26, 0x7C, 0x72, 0x60, 0x6E, 0x44, 0x4A, 0x58, 0x56,
+ 0x37, 0x39, 0x2B, 0x25, 0x0F, 0x01, 0x13, 0x1D, 0x47, 0x49, 0x5B, 0x55, 0x7F, 0x71, 0x63, 0x6D,
+ 0xD7, 0xD9, 0xCB, 0xC5, 0xEF, 0xE1, 0xF3, 0xFD, 0xA7, 0xA9, 0xBB, 0xB5, 0x9F, 0x91, 0x83, 0x8D,
+ };
+
+ static byte[] multB = {
+ 0x00, 0x0B, 0x16, 0x1D, 0x2C, 0x27, 0x3A, 0x31, 0x58, 0x53, 0x4E, 0x45, 0x74, 0x7F, 0x62, 0x69,
+ 0xB0, 0xBB, 0xA6, 0xAD, 0x9C, 0x97, 0x8A, 0x81, 0xE8, 0xE3, 0xFE, 0xF5, 0xC4, 0xCF, 0xD2, 0xD9,
+ 0x7B, 0x70, 0x6D, 0x66, 0x57, 0x5C, 0x41, 0x4A, 0x23, 0x28, 0x35, 0x3E, 0x0F, 0x04, 0x19, 0x12,
+ 0xCB, 0xC0, 0xDD, 0xD6, 0xE7, 0xEC, 0xF1, 0xFA, 0x93, 0x98, 0x85, 0x8E, 0xBF, 0xB4, 0xA9, 0xA2,
+ 0xF6, 0xFD, 0xE0, 0xEB, 0xDA, 0xD1, 0xCC, 0xC7, 0xAE, 0xA5, 0xB8, 0xB3, 0x82, 0x89, 0x94, 0x9F,
+ 0x46, 0x4D, 0x50, 0x5B, 0x6A, 0x61, 0x7C, 0x77, 0x1E, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2F,
+ 0x8D, 0x86, 0x9B, 0x90, 0xA1, 0xAA, 0xB7, 0xBC, 0xD5, 0xDE, 0xC3, 0xC8, 0xF9, 0xF2, 0xEF, 0xE4,
+ 0x3D, 0x36, 0x2B, 0x20, 0x11, 0x1A, 0x07, 0x0C, 0x65, 0x6E, 0x73, 0x78, 0x49, 0x42, 0x5F, 0x54,
+ 0xF7, 0xFC, 0xE1, 0xEA, 0xDB, 0xD0, 0xCD, 0xC6, 0xAF, 0xA4, 0xB9, 0xB2, 0x83, 0x88, 0x95, 0x9E,
+ 0x47, 0x4C, 0x51, 0x5A, 0x6B, 0x60, 0x7D, 0x76, 0x1F, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2E,
+ 0x8C, 0x87, 0x9A, 0x91, 0xA0, 0xAB, 0xB6, 0xBD, 0xD4, 0xDF, 0xC2, 0xC9, 0xF8, 0xF3, 0xEE, 0xE5,
+ 0x3C, 0x37, 0x2A, 0x21, 0x10, 0x1B, 0x06, 0x0D, 0x64, 0x6F, 0x72, 0x79, 0x48, 0x43, 0x5E, 0x55,
+ 0x01, 0x0A, 0x17, 0x1C, 0x2D, 0x26, 0x3B, 0x30, 0x59, 0x52, 0x4F, 0x44, 0x75, 0x7E, 0x63, 0x68,
+ 0xB1, 0xBA, 0xA7, 0xAC, 0x9D, 0x96, 0x8B, 0x80, 0xE9, 0xE2, 0xFF, 0xF4, 0xC5, 0xCE, 0xD3, 0xD8,
+ 0x7A, 0x71, 0x6C, 0x67, 0x56, 0x5D, 0x40, 0x4B, 0x22, 0x29, 0x34, 0x3F, 0x0E, 0x05, 0x18, 0x13,
+ 0xCA, 0xC1, 0xDC, 0xD7, 0xE6, 0xED, 0xF0, 0xFB, 0x92, 0x99, 0x84, 0x8F, 0xBE, 0xB5, 0xA8, 0xA3,
+ };
+
+ static byte[] multD = {
+ 0x00, 0x0D, 0x1A, 0x17, 0x34, 0x39, 0x2E, 0x23, 0x68, 0x65, 0x72, 0x7F, 0x5C, 0x51, 0x46, 0x4B,
+ 0xD0, 0xDD, 0xCA, 0xC7, 0xE4, 0xE9, 0xFE, 0xF3, 0xB8, 0xB5, 0xA2, 0xAF, 0x8C, 0x81, 0x96, 0x9B,
+ 0xBB, 0xB6, 0xA1, 0xAC, 0x8F, 0x82, 0x95, 0x98, 0xD3, 0xDE, 0xC9, 0xC4, 0xE7, 0xEA, 0xFD, 0xF0,
+ 0x6B, 0x66, 0x71, 0x7C, 0x5F, 0x52, 0x45, 0x48, 0x03, 0x0E, 0x19, 0x14, 0x37, 0x3A, 0x2D, 0x20,
+ 0x6D, 0x60, 0x77, 0x7A, 0x59, 0x54, 0x43, 0x4E, 0x05, 0x08, 0x1F, 0x12, 0x31, 0x3C, 0x2B, 0x26,
+ 0xBD, 0xB0, 0xA7, 0xAA, 0x89, 0x84, 0x93, 0x9E, 0xD5, 0xD8, 0xCF, 0xC2, 0xE1, 0xEC, 0xFB, 0xF6,
+ 0xD6, 0xDB, 0xCC, 0xC1, 0xE2, 0xEF, 0xF8, 0xF5, 0xBE, 0xB3, 0xA4, 0xA9, 0x8A, 0x87, 0x90, 0x9D,
+ 0x06, 0x0B, 0x1C, 0x11, 0x32, 0x3F, 0x28, 0x25, 0x6E, 0x63, 0x74, 0x79, 0x5A, 0x57, 0x40, 0x4D,
+ 0xDA, 0xD7, 0xC0, 0xCD, 0xEE, 0xE3, 0xF4, 0xF9, 0xB2, 0xBF, 0xA8, 0xA5, 0x86, 0x8B, 0x9C, 0x91,
+ 0x0A, 0x07, 0x10, 0x1D, 0x3E, 0x33, 0x24, 0x29, 0x62, 0x6F, 0x78, 0x75, 0x56, 0x5B, 0x4C, 0x41,
+ 0x61, 0x6C, 0x7B, 0x76, 0x55, 0x58, 0x4F, 0x42, 0x09, 0x04, 0x13, 0x1E, 0x3D, 0x30, 0x27, 0x2A,
+ 0xB1, 0xBC, 0xAB, 0xA6, 0x85, 0x88, 0x9F, 0x92, 0xD9, 0xD4, 0xC3, 0xCE, 0xED, 0xE0, 0xF7, 0xFA,
+ 0xB7, 0xBA, 0xAD, 0xA0, 0x83, 0x8E, 0x99, 0x94, 0xDF, 0xD2, 0xC5, 0xC8, 0xEB, 0xE6, 0xF1, 0xFC,
+ 0x67, 0x6A, 0x7D, 0x70, 0x53, 0x5E, 0x49, 0x44, 0x0F, 0x02, 0x15, 0x18, 0x3B, 0x36, 0x21, 0x2C,
+ 0x0C, 0x01, 0x16, 0x1B, 0x38, 0x35, 0x22, 0x2F, 0x64, 0x69, 0x7E, 0x73, 0x50, 0x5D, 0x4A, 0x47,
+ 0xDC, 0xD1, 0xC6, 0xCB, 0xE8, 0xE5, 0xF2, 0xFF, 0xB4, 0xB9, 0xAE, 0xA3, 0x80, 0x8D, 0x9A, 0x97,
+ };
+
+ static byte[] mult9 = {
+ 0x00, 0x09, 0x12, 0x1B, 0x24, 0x2D, 0x36, 0x3F, 0x48, 0x41, 0x5A, 0x53, 0x6C, 0x65, 0x7E, 0x77,
+ 0x90, 0x99, 0x82, 0x8B, 0xB4, 0xBD, 0xA6, 0xAF, 0xD8, 0xD1, 0xCA, 0xC3, 0xFC, 0xF5, 0xEE, 0xE7,
+ 0x3B, 0x32, 0x29, 0x20, 0x1F, 0x16, 0x0D, 0x04, 0x73, 0x7A, 0x61, 0x68, 0x57, 0x5E, 0x45, 0x4C,
+ 0xAB, 0xA2, 0xB9, 0xB0, 0x8F, 0x86, 0x9D, 0x94, 0xE3, 0xEA, 0xF1, 0xF8, 0xC7, 0xCE, 0xD5, 0xDC,
+ 0x76, 0x7F, 0x64, 0x6D, 0x52, 0x5B, 0x40, 0x49, 0x3E, 0x37, 0x2C, 0x25, 0x1A, 0x13, 0x08, 0x01,
+ 0xE6, 0xEF, 0xF4, 0xFD, 0xC2, 0xCB, 0xD0, 0xD9, 0xAE, 0xA7, 0xBC, 0xB5, 0x8A, 0x83, 0x98, 0x91,
+ 0x4D, 0x44, 0x5F, 0x56, 0x69, 0x60, 0x7B, 0x72, 0x05, 0x0C, 0x17, 0x1E, 0x21, 0x28, 0x33, 0x3A,
+ 0xDD, 0xD4, 0xCF, 0xC6, 0xF9, 0xF0, 0xEB, 0xE2, 0x95, 0x9C, 0x87, 0x8E, 0xB1, 0xB8, 0xA3, 0xAA,
+ 0xEC, 0xE5, 0xFE, 0xF7, 0xC8, 0xC1, 0xDA, 0xD3, 0xA4, 0xAD, 0xB6, 0xBF, 0x80, 0x89, 0x92, 0x9B,
+ 0x7C, 0x75, 0x6E, 0x67, 0x58, 0x51, 0x4A, 0x43, 0x34, 0x3D, 0x26, 0x2F, 0x10, 0x19, 0x02, 0x0B,
+ 0xD7, 0xDE, 0xC5, 0xCC, 0xF3, 0xFA, 0xE1, 0xE8, 0x9F, 0x96, 0x8D, 0x84, 0xBB, 0xB2, 0xA9, 0xA0,
+ 0x47, 0x4E, 0x55, 0x5C, 0x63, 0x6A, 0x71, 0x78, 0x0F, 0x06, 0x1D, 0x14, 0x2B, 0x22, 0x39, 0x30,
+ 0x9A, 0x93, 0x88, 0x81, 0xBE, 0xB7, 0xAC, 0xA5, 0xD2, 0xDB, 0xC0, 0xC9, 0xF6, 0xFF, 0xE4, 0xED,
+ 0x0A, 0x03, 0x18, 0x11, 0x2E, 0x27, 0x3C, 0x35, 0x42, 0x4B, 0x50, 0x59, 0x66, 0x6F, 0x74, 0x7D,
+ 0xA1, 0xA8, 0xB3, 0xBA, 0x85, 0x8C, 0x97, 0x9E, 0xE9, 0xE0, 0xFB, 0xF2, 0xCD, 0xC4, 0xDF, 0xD6,
+ 0x31, 0x38, 0x23, 0x2A, 0x15, 0x1C, 0x07, 0x0E, 0x79, 0x70, 0x6B, 0x62, 0x5D, 0x54, 0x4F, 0x46,
+ };
+
+}
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA1.cs b/mcs/class/corlib/System.Security.Cryptography/SHA1.cs
new file mode 100644
index 00000000000..0c2b8918605
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA1.cs
@@ -0,0 +1,47 @@
+//
+// System.Security.Cryptography.SHA1 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography
+{
+ /// <summary>
+ /// Common base class for all derived SHA1 implementations.
+ /// </summary>
+ public abstract class SHA1 : HashAlgorithm
+ {
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected SHA1 ()
+ {
+ HashSizeValue = 160;
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA1 Create ()
+ {
+ return Create ("System.Security.Cryptography.SHA1");
+ }
+
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="hashName">Specifies which derived class to create</param>
+ public static new SHA1 Create (string hashName)
+ {
+ return (SHA1) CryptoConfig.CreateFromName (hashName);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs
new file mode 100644
index 00000000000..3119fce4c56
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs
@@ -0,0 +1,512 @@
+//
+// System.Security.Cryptography SHA1CryptoServiceProvider Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+// Note:
+// The MS Framework includes two (almost) identical class for SHA1.
+// SHA1Managed is a 100% managed implementation.
+// SHA1CryptoServiceProvider (this file) is a wrapper on CryptoAPI.
+// Mono must provide those two class for binayry compatibility.
+// In our case both class are wrappers around a managed internal class SHA1Internal.
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// C# implementation of the SHA1 cryptographic hash function.
+ /// LAMESPEC?: Basically the same thing as SHA1Managed except for how its implemented.
+ /// </summary>
+ internal class SHA1Internal {
+ private const int BLOCK_SIZE_BYTES = 64;
+ private const int HASH_SIZE_BYTES = 20;
+ private const int HASH_SIZE_BITS = 160;
+ [CLSCompliant(false)] private uint[] _H; // these are my chaining variables
+ [CLSCompliant(false)] private uint count;
+ private byte[] _ProcessingBuffer; // Used to start data when passed less than a block worth.
+ private int _ProcessingBufferCount; // Counts how much data we have stored that still needs processed.
+
+ /// <summary>
+ /// Creates a new SHA1CryptoServiceProvider.
+ /// </summary>
+ public SHA1Internal ()
+ {
+ _H = new uint[5];
+ _ProcessingBuffer = new byte[BLOCK_SIZE_BYTES];
+
+ Initialize();
+ }
+
+ /// <summary>
+ /// Drives the hashing function.
+ /// </summary>
+ /// <param name="rgb">Byte array containing the data to hash.</param>
+ /// <param name="start">Where in the input buffer to start.</param>
+ /// <param name="size">Size in bytes of the data in the buffer to hash.</param>
+ public void HashCore (byte[] rgb, int start, int size)
+ {
+ int i;
+
+ if (_ProcessingBufferCount != 0) {
+ if (size < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, size);
+ _ProcessingBufferCount += size;
+ return;
+ }
+ else {
+ i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, i);
+ ProcessBlock (_ProcessingBuffer, 0);
+ _ProcessingBufferCount = 0;
+ start += i;
+ size -= i;
+ }
+ }
+
+ for (i=0; i<size-size%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, start+i);
+ }
+
+ if (size%BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, size-size%BLOCK_SIZE_BYTES+start, _ProcessingBuffer, 0, size%BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = size%BLOCK_SIZE_BYTES;
+ }
+ }
+
+ /// <summary>
+ /// This finalizes the hash. Takes the data from the chaining variables and returns it.
+ /// </summary>
+ public byte[] HashFinal ()
+ {
+ byte[] hash = new byte[20];
+ int i, j;
+
+ ProcessFinalBlock(_ProcessingBuffer, 0, _ProcessingBufferCount);
+
+ for (i=0; i<5; i++) {
+ for (j=0; j<4; j++) {
+ hash[i*4+j] = (byte)(_H[i] >> (8*(3-j)));
+ }
+ }
+
+ return hash;
+ }
+
+
+ /// <summary>
+ /// Resets the class after use. Called automatically after hashing is done.
+ /// </summary>
+ public void Initialize ()
+ {
+ count = 0;
+ _ProcessingBufferCount = 0;
+
+ _H[0] = 0x67452301;
+ _H[1] = 0xefcdab89;
+ _H[2] = 0x98badcfe;
+ _H[3] = 0x10325476;
+ _H[4] = 0xC3D2E1F0;
+ }
+
+ /// <summary>
+ /// This is the meat of the hash function. It is what processes each block one at a time.
+ /// </summary>
+ /// <param name="inputBuffer">Byte array to process data from.</param>
+ /// <param name="inputOffset">Where in the byte array to start processing.</param>
+ public void ProcessBlock(byte[] inputBuffer, int inputOffset)
+ {
+ uint[] buff = new uint[80];
+ uint a, b, c, d, e;
+ int i;
+
+ count += BLOCK_SIZE_BYTES;
+
+ for (i=0; i<16; i++) {
+ buff[i] = ((uint)(inputBuffer[inputOffset+4*i]) << 24)
+ | ((uint)(inputBuffer[inputOffset+4*i+1]) << 16)
+ | ((uint)(inputBuffer[inputOffset+4*i+2]) << 8)
+ | ((uint)(inputBuffer[inputOffset+4*i+3]));
+ }
+
+ for (i=16; i<80; i++) {
+ buff[i] = ((buff[i-3] ^ buff[i-8] ^ buff[i-14] ^ buff[i-16]) << 1)
+ | ((buff[i-3] ^ buff[i-8] ^ buff[i-14] ^ buff[i-16]) >> 31);
+ }
+
+ a = _H[0];
+ b = _H[1];
+ c = _H[2];
+ d = _H[3];
+ e = _H[4];
+
+
+ // This function was unrolled because it seems to be doubling our performance with current compiler/VM.
+ // Possibly roll up if this changes.
+
+ // ---- Round 1 --------
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[0];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[1];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[2];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[3];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[4];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[5];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[6];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[7];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[8];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[9];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[10];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[11];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[12];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[13];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[14];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[15];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[16];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[17];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[18];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[19];
+ c = (c << 30) | (c >> 2);
+
+
+
+ // ---- Round 2 --------
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[20];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[21];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[22];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[23];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[24];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[25];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[26];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[27];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[28];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[29];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[30];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[31];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[32];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[33];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[34];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[35];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[36];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[37];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[38];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[39];
+ c = (c << 30) | (c >> 2);
+
+
+
+ // ---- Round 3 --------
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[40];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[41];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[42];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[43];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[44];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[45];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[46];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[47];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[48];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[49];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[50];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[51];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[52];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[53];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[54];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[55];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[56];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[57];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[58];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[59];
+ c = (c << 30) | (c >> 2);
+
+
+
+ // ---- Round 4 --------
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[60];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[61];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[62];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[63];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[64];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[65];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[66];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[67];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[68];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[69];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[70];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[71];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[72];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[73];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[74];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[75];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[76];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[77];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[78];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[79];
+ c = (c << 30) | (c >> 2);
+
+
+ _H[0] += a;
+ _H[1] += b;
+ _H[2] += c;
+ _H[3] += d;
+ _H[4] += e;
+ }
+
+ /// <summary>
+ /// Pads and then processes the final block.
+ /// Non-standard.
+ /// </summary>
+ /// <param name="inputBuffer">Buffer to grab data from.</param>
+ /// <param name="inputOffset">Position in buffer in bytes to get data from.</param>
+ /// <param name="inputCount">How much data in bytes in the buffer to use.</param>
+ public void ProcessFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ byte[] fooBuffer;
+ int paddingSize;
+ int i;
+ uint size;
+
+ paddingSize = (int)(56 - (inputCount + count) % BLOCK_SIZE_BYTES);
+
+ if (paddingSize < 1)
+ paddingSize += BLOCK_SIZE_BYTES;
+
+ fooBuffer = new byte[inputCount+paddingSize+8];
+
+ for (i=0; i<inputCount; i++) {
+ fooBuffer[i] = inputBuffer[i+inputOffset];
+ }
+
+ fooBuffer[inputCount] = 0x80;
+ for (i=inputCount+1; i<inputCount+paddingSize; i++) {
+ fooBuffer[i] = 0x00;
+ }
+
+ size = (uint)(count+inputCount);
+ size *= 8; // I deal in bytes. They algorythm deals in bits.
+
+ fooBuffer[inputCount+paddingSize] = 0x00;
+ fooBuffer[inputCount+paddingSize+1] = 0x00;
+ fooBuffer[inputCount+paddingSize+2] = 0x00;
+ fooBuffer[inputCount+paddingSize+3] = 0x00;
+
+ fooBuffer[inputCount+paddingSize+4] = (byte)((size) >> 24);
+ fooBuffer[inputCount+paddingSize+5] = (byte)((size) >> 16);
+ fooBuffer[inputCount+paddingSize+6] = (byte)((size) >> 8);
+ fooBuffer[inputCount+paddingSize+7] = (byte)((size) >> 0);
+
+ ProcessBlock(fooBuffer, 0);
+
+ if (inputCount+paddingSize+8 == 128) {
+ ProcessBlock(fooBuffer, 64);
+ }
+ }
+ }
+
+ public sealed class SHA1CryptoServiceProvider : SHA1 {
+
+ private SHA1Internal sha;
+
+ public SHA1CryptoServiceProvider ()
+ {
+ sha = new SHA1Internal ();
+ }
+
+ ~SHA1CryptoServiceProvider ()
+ {
+ Dispose (false);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ // nothing new to do (managed implementation)
+ base.Dispose (disposing);
+ }
+
+ protected override void HashCore (byte[] rgb, int start, int size)
+ {
+ State = 1;
+ sha.HashCore (rgb, start, size);
+ }
+
+ protected override byte[] HashFinal ()
+ {
+ State = 0;
+ return sha.HashFinal ();
+ }
+
+ public override void Initialize ()
+ {
+ sha.Initialize ();
+ }
+
+ private void ProcessBlock (byte[] inputBuffer, int inputOffset)
+ {
+ sha.ProcessBlock (inputBuffer, inputOffset);
+ }
+
+ private void ProcessFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ sha.ProcessFinalBlock (inputBuffer, inputOffset, inputCount);
+ }
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA1Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA1Managed.cs
new file mode 100644
index 00000000000..16fafd09d77
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA1Managed.cs
@@ -0,0 +1,57 @@
+//
+// System.Security.Cryptography SHA1Managed Class implementation
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+namespace System.Security.Cryptography {
+
+// Note:
+// The MS Framework includes two (almost) identical class for SHA1.
+// SHA1Managed (this file) is a 100% managed implementation.
+// SHA1CryptoServiceProvider is a wrapper on CryptoAPI.
+// Mono must provide those two class for binayry compatibility.
+// In our case both class are wrappers around a managed internal class SHA1Internal.
+
+public class SHA1Managed : SHA1 {
+
+ private SHA1Internal sha;
+
+ public SHA1Managed ()
+ {
+ sha = new SHA1Internal ();
+ }
+
+ protected override void HashCore (byte[] rgb, int start, int size)
+ {
+ State = 1;
+ sha.HashCore (rgb, start, size);
+ }
+
+ protected override byte[] HashFinal ()
+ {
+ State = 0;
+ return sha.HashFinal ();
+ }
+
+ public override void Initialize ()
+ {
+ sha.Initialize ();
+ }
+
+ private void ProcessBlock (byte[] inputBuffer, int inputOffset)
+ {
+ sha.ProcessBlock (inputBuffer, inputOffset);
+ }
+
+ private void ProcessFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ sha.ProcessFinalBlock (inputBuffer, inputOffset, inputCount);
+ }
+}
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA256.cs b/mcs/class/corlib/System.Security.Cryptography/SHA256.cs
new file mode 100644
index 00000000000..38fdc0b989b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA256.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography SHA256 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+ /// <summary>
+ /// Common base class for all derived SHA256 implementations.
+ /// </summary>
+ public abstract class SHA256 : HashAlgorithm {
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SHA256 ()
+ {
+ HashSizeValue = 256;
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA256 Create ()
+ {
+ return Create ("System.Security.Cryptography.SHA256");
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="hashName">Specifies which derived class to create</param>
+ public static new SHA256 Create (string hashName)
+ {
+ return (SHA256) CryptoConfig.CreateFromName (hashName);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs
new file mode 100644
index 00000000000..492d922c8d4
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs
@@ -0,0 +1,302 @@
+//
+// System.Security.Cryptography SHA256Managed Class implementation
+//
+// Author:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// (C) 2001
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// C# implementation of the SHA1 cryptographic hash function.
+ /// LAMESPEC?: Basically the same thing as SHA1Managed except for how its implemented.
+ /// </summary>
+ public class SHA256Managed : SHA256 {
+ private const int BLOCK_SIZE_BYTES = 64;
+ private const int HASH_SIZE_BYTES = 32;
+ private const int HASH_SIZE_BITS = 256;
+ [CLSCompliant(false)] private uint[] _H;
+ [CLSCompliant(false)] private uint[] K;
+ [CLSCompliant(false)] private uint count;
+ private byte[] _ProcessingBuffer; // Used to start data when passed less than a block worth.
+ private int _ProcessingBufferCount; // Counts how much data we have stored that still needs processed.
+
+ /// <summary>
+ /// Creates a new SHA256Managed class.
+ /// </summary>
+ public SHA256Managed ()
+ {
+ _H = new uint[8];
+ HashSizeValue = HASH_SIZE_BITS;
+ _ProcessingBuffer = new byte[BLOCK_SIZE_BYTES];
+
+ K = new uint[64];
+ K[0] = 0x428A2F98; K[1] = 0x71374491; K[2] = 0xB5C0FBCF; K[3] = 0xE9B5DBA5;
+ K[4] = 0x3956C25B; K[5] = 0x59F111F1; K[6] = 0x923F82A4; K[7] = 0xAB1C5ED5;
+ K[8] = 0xD807AA98; K[9] = 0x12835B01; K[10] = 0x243185BE; K[11] = 0x550C7DC3;
+ K[12] = 0x72BE5D74; K[13] = 0x80DEB1FE; K[14] = 0x9BDC06A7; K[15] = 0xC19BF174;
+ K[16] = 0xE49B69C1; K[17] = 0xEFBE4786; K[18] = 0x0FC19DC6; K[19] = 0x240CA1CC;
+ K[20] = 0x2DE92C6F; K[21] = 0x4A7484AA; K[22] = 0x5CB0A9DC; K[23] = 0x76F988DA;
+ K[24] = 0x983E5152; K[25] = 0xA831C66D; K[26] = 0xB00327C8; K[27] = 0xBF597FC7;
+ K[28] = 0xC6E00BF3; K[29] = 0xD5A79147; K[30] = 0x06CA6351; K[31] = 0x14292967;
+ K[32] = 0x27B70A85; K[33] = 0x2E1B2138; K[34] = 0x4D2C6DFC; K[35] = 0x53380D13;
+ K[36] = 0x650A7354; K[37] = 0x766A0ABB; K[38] = 0x81C2C92E; K[39] = 0x92722C85;
+ K[40] = 0xA2BFE8A1; K[41] = 0xA81A664B; K[42] = 0xC24B8B70; K[43] = 0xC76C51A3;
+ K[44] = 0xD192E819; K[45] = 0xD6990624; K[46] = 0xF40E3585; K[47] = 0x106AA070;
+ K[48] = 0x19A4C116; K[49] = 0x1E376C08; K[50] = 0x2748774C; K[51] = 0x34B0BCB5;
+ K[52] = 0x391C0CB3; K[53] = 0x4ED8AA4A; K[54] = 0x5B9CCA4F; K[55] = 0x682E6FF3;
+ K[56] = 0x748F82EE; K[57] = 0x78A5636F; K[58] = 0x84C87814; K[59] = 0x8CC70208;
+ K[60] = 0x90BEFFFA; K[61] = 0xA4506CEB; K[62] = 0xBEF9A3F7; K[63] = 0xC67178F2;
+
+ Initialize();
+ }
+
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Ch (uint u, uint v, uint w)
+ {
+ return (u&v) ^ (~u&w);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Maj (uint u, uint v, uint w)
+ {
+ return (u&v) ^ (u&w) ^ (v&w);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Ro0 (uint x)
+ {
+ return ((x >> 7) | (x << 25))
+ ^ ((x >> 18) | (x << 14))
+ ^ (x >> 3);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Ro1 (uint x)
+ {
+ return ((x >> 17) | (x << 15))
+ ^ ((x >> 19) | (x << 13))
+ ^ (x >> 10);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Sig0 (uint x)
+ {
+ return ((x >> 2) | (x << 30))
+ ^ ((x >> 13) | (x << 19))
+ ^ ((x >> 22) | (x << 10));
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Sig1 (uint x)
+ {
+ return ((x >> 6) | (x << 26))
+ ^ ((x >> 11) | (x << 21))
+ ^ ((x >> 25) | (x << 7));
+ }
+
+ /// <summary>
+ /// Drives the hashing function.
+ /// </summary>
+ /// <param name="rgb">Byte array containing the data to hash.</param>
+ /// <param name="start">Where in the input buffer to start.</param>
+ /// <param name="size">Size in bytes of the data in the buffer to hash.</param>
+ protected override void HashCore (byte[] rgb, int start, int size)
+ {
+ int i;
+ State = 1;
+
+ if (_ProcessingBufferCount != 0) {
+ if (size < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, size);
+ _ProcessingBufferCount += size;
+ return;
+ }
+ else {
+ i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, i);
+ ProcessBlock (_ProcessingBuffer, 0);
+ _ProcessingBufferCount = 0;
+ start += i;
+ size -= i;
+ }
+ }
+
+ for (i=0; i<size-size%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, start+i);
+ }
+
+ if (size%BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, size-size%BLOCK_SIZE_BYTES+start, _ProcessingBuffer, 0, size%BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = size%BLOCK_SIZE_BYTES;
+ }
+ }
+
+ /// <summary>
+ /// This finalizes the hash. Takes the data from the chaining variables and returns it.
+ /// </summary>
+ protected override byte[] HashFinal ()
+ {
+ byte[] hash = new byte[32];
+ int i, j;
+
+ ProcessFinalBlock(_ProcessingBuffer, 0, _ProcessingBufferCount);
+
+ for (i=0; i<8; i++) {
+ for (j=0; j<4; j++) {
+ hash[i*4+j] = (byte)(_H[i] >> (24-j*8));
+ }
+ }
+
+ State = 0;
+ return hash;
+ }
+
+ /// <summary>
+ /// Resets the class after use. Called automatically after hashing is done.
+ /// </summary>
+ public override void Initialize ()
+ {
+ count = 0;
+ _ProcessingBufferCount = 0;
+
+ _H[0] = 0x6A09E667;
+ _H[1] = 0xBB67AE85;
+ _H[2] = 0x3C6EF372;
+ _H[3] = 0xA54FF53A;
+ _H[4] = 0x510E527F;
+ _H[5] = 0x9B05688C;
+ _H[6] = 0x1F83D9AB;
+ _H[7] = 0x5BE0CD19;
+ }
+
+ /// <summary>
+ /// This is the meat of the hash function. It is what processes each block one at a time.
+ /// </summary>
+ /// <param name="inputBuffer">Byte array to process data from.</param>
+ /// <param name="inputOffset">Where in the byte array to start processing.</param>
+ private void ProcessBlock (byte[] inputBuffer, int inputOffset)
+ {
+ uint a, b, c, d, e, f, g, h;
+ uint t1, t2;
+ int i;
+ uint[] buff;
+
+ count += BLOCK_SIZE_BYTES;
+
+ buff = new uint[64];
+
+ for (i=0; i<16; i++) {
+ buff[i] = ((uint)(inputBuffer[inputOffset+4*i]) << 24)
+ | ((uint)(inputBuffer[inputOffset+4*i+1]) << 16)
+ | ((uint)(inputBuffer[inputOffset+4*i+2]) << 8)
+ | ((uint)(inputBuffer[inputOffset+4*i+3]));
+ }
+
+
+ for (i=16; i<64; i++) {
+ buff[i] = Ro1(buff[i-2]) + buff[i-7] + Ro0(buff[i-15]) + buff[i-16];
+ }
+
+ a = _H[0];
+ b = _H[1];
+ c = _H[2];
+ d = _H[3];
+ e = _H[4];
+ f = _H[5];
+ g = _H[6];
+ h = _H[7];
+
+ for (i=0; i<64; i++) {
+ t1 = h + Sig1(e) + Ch(e,f,g) + K[i] + buff[i];
+ t2 = Sig0(a) + Maj(a,b,c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + t1;
+ d = c;
+ c = b;
+ b = a;
+ a = t1 + t2;
+ }
+
+ _H[0] += a;
+ _H[1] += b;
+ _H[2] += c;
+ _H[3] += d;
+ _H[4] += e;
+ _H[5] += f;
+ _H[6] += g;
+ _H[7] += h;
+ }
+
+ /// <summary>
+ /// Pads and then processes the final block.
+ /// Non-standard.
+ /// </summary>
+ /// <param name="inputBuffer">Buffer to grab data from.</param>
+ /// <param name="inputOffset">Position in buffer in bytes to get data from.</param>
+ /// <param name="inputCount">How much data in bytes in the buffer to use.</param>
+ private void ProcessFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ byte[] fooBuffer;
+ int paddingSize;
+ int i;
+ uint size;
+
+ paddingSize = (int)(56 - (inputCount + count) % BLOCK_SIZE_BYTES);
+
+ if (paddingSize < 1)
+ paddingSize += BLOCK_SIZE_BYTES;
+
+ fooBuffer = new byte[inputCount+paddingSize+8];
+
+ for (i=0; i<inputCount; i++) {
+ fooBuffer[i] = inputBuffer[i+inputOffset];
+ }
+
+ fooBuffer[inputCount] = 0x80;
+ for (i=inputCount+1; i<inputCount+paddingSize; i++) {
+ fooBuffer[i] = 0x00;
+ }
+
+ size = (uint)(count+inputCount);
+ size *= 8;
+
+ fooBuffer[inputCount+paddingSize] = 0x00;
+ fooBuffer[inputCount+paddingSize+1] = 0x00;
+ fooBuffer[inputCount+paddingSize+2] = 0x00;
+ fooBuffer[inputCount+paddingSize+3] = 0x00;
+
+ fooBuffer[inputCount+paddingSize+4] = (byte)((size) >> 24);
+ fooBuffer[inputCount+paddingSize+5] = (byte)((size) >> 16);
+ fooBuffer[inputCount+paddingSize+6] = (byte)((size) >> 8);
+ fooBuffer[inputCount+paddingSize+7] = (byte)((size) >> 0);
+
+ ProcessBlock(fooBuffer, 0);
+
+ if (inputCount+paddingSize+8 == 128) {
+ ProcessBlock(fooBuffer, 64);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA384.cs b/mcs/class/corlib/System.Security.Cryptography/SHA384.cs
new file mode 100644
index 00000000000..fe649e0c03e
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA384.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography SHA384 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+ /// <summary>
+ /// Common base class for all derived SHA384 implementations.
+ /// </summary>
+ public abstract class SHA384 : HashAlgorithm {
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SHA384 ()
+ {
+ HashSizeValue = 384;
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA384 Create ()
+ {
+ return Create ("System.Security.Cryptography.SHA384");
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="hashName">Specifies which derived class to create</param>
+ public static new SHA384 Create (string hashName)
+ {
+ return (SHA384) CryptoConfig.CreateFromName (hashName);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs
new file mode 100644
index 00000000000..e6255d598ee
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs
@@ -0,0 +1,281 @@
+//
+// System.Security.Cryptography.SHA384Managed.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Sébastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002
+// Implementation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
+// See bouncycastle.txt for license.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class SHA384Managed : SHA384 {
+
+ private byte[] xBuf;
+ private int xBufOff;
+
+ [CLSCompliant(false)]
+ private ulong byteCount1;
+ [CLSCompliant(false)]
+ private ulong byteCount2;
+
+ [CLSCompliant(false)]
+ private ulong H1, H2, H3, H4, H5, H6, H7, H8;
+ [CLSCompliant(false)]
+ private ulong[] W = new ulong [80];
+ private int wOff;
+
+ public SHA384Managed ()
+ {
+ xBuf = new byte [8];
+ xBufOff = 0;
+ Initialize ();
+ }
+
+ public override void Initialize ()
+ {
+ // SHA-384 initial hash value
+ // The first 64 bits of the fractional parts of the square roots
+ // of the 9th through 16th prime numbers
+ H1 = 0xcbbb9d5dc1059ed8L;
+ H2 = 0x629a292a367cd507L;
+ H3 = 0x9159015a3070dd17L;
+ H4 = 0x152fecd8f70e5939L;
+ H5 = 0x67332667ffc00b31L;
+ H6 = 0x8eb44a8768581511L;
+ H7 = 0xdb0c2e0d64f98fa7L;
+ H8 = 0x47b5481dbefa4fa4L;
+
+ byteCount1 = 0;
+ byteCount2 = 0;
+
+ xBufOff = 0;
+ for (int i = 0; i < xBuf.Length; i++)
+ xBuf [i] = 0;
+
+ wOff = 0;
+ for (int i = 0; i != W.Length; i++)
+ W [i] = 0;
+ }
+
+ // protected
+
+ protected override void HashCore (byte[] rgb, int start, int count)
+ {
+ // fill the current word
+ while ((xBufOff != 0) && (count > 0)) {
+ update( rgb [start]);
+ start++;
+ count--;
+ }
+
+ // process whole words.
+ while (count > xBuf.Length) {
+ processWord(rgb, start);
+ start += xBuf.Length;
+ count -= xBuf.Length;
+ byteCount1 += (ulong) xBuf.Length;
+ }
+
+ // load in the remainder.
+ while (count > 0) {
+ update( rgb [start]);
+ start++;
+ count--;
+ }
+ }
+
+ protected override byte[] HashFinal ()
+ {
+ adjustByteCounts();
+
+ ulong lowBitLength = byteCount1 << 3;
+ ulong hiBitLength = byteCount2;
+
+ // add the pad bytes.
+ update ( (byte) 128);
+ while (xBufOff != 0)
+ update ( (byte)0);
+
+ processLength (lowBitLength, hiBitLength);
+ processBlock ();
+
+ byte[] output = new byte [48];
+ unpackWord(H1, output, 0);
+ unpackWord(H2, output, 8);
+ unpackWord(H3, output, 16);
+ unpackWord(H4, output, 24);
+ unpackWord(H5, output, 32);
+ unpackWord(H6, output, 40);
+
+ Initialize ();
+ return output;
+ }
+
+ private void update (byte input)
+ {
+ xBuf [xBufOff++] = input;
+ if (xBufOff == xBuf.Length) {
+ processWord(xBuf, 0);
+ xBufOff = 0;
+ }
+ byteCount1++;
+ }
+
+ private void processWord (byte[] input, int inOff)
+ {
+ W [wOff++] = ( (ulong) input [inOff] << 56)
+ | ( (ulong) input [inOff + 1] << 48)
+ | ( (ulong) input [inOff + 2] << 40)
+ | ( (ulong) input [inOff + 3] << 32)
+ | ( (ulong) input [inOff + 4] << 24)
+ | ( (ulong) input [inOff + 5] << 16)
+ | ( (ulong) input [inOff + 6] << 8)
+ | ( (ulong) input [inOff + 7]);
+ if (wOff == 16)
+ processBlock ();
+ }
+
+ private void unpackWord (ulong word, byte[] output, int outOff)
+ {
+ output[outOff] = (byte) (word >> 56);
+ output[outOff + 1] = (byte) (word >> 48);
+ output[outOff + 2] = (byte) (word >> 40);
+ output[outOff + 3] = (byte) (word >> 32);
+ output[outOff + 4] = (byte) (word >> 24);
+ output[outOff + 5] = (byte) (word >> 16);
+ output[outOff + 6] = (byte) (word >> 8);
+ output[outOff + 7] = (byte) word;
+ }
+
+ // adjust the byte counts so that byteCount2 represents the
+ // upper long (less 3 bits) word of the byte count.
+ private void adjustByteCounts()
+ {
+ if (byteCount1 > 0x1fffffffffffffffL) {
+ byteCount2 += (byteCount1 >> 61);
+ byteCount1 &= 0x1fffffffffffffffL;
+ }
+ }
+
+ private void processLength (ulong lowW, ulong hiW)
+ {
+ if (wOff > 14)
+ processBlock();
+ W[14] = hiW;
+ W[15] = lowW;
+ }
+
+ private void processBlock ()
+ {
+ adjustByteCounts ();
+ // expand 16 word block into 80 word blocks.
+ for (int t = 16; t <= 79; t++)
+ W[t] = Sigma1 (W [t - 2]) + W [t - 7] + Sigma0 (W [t - 15]) + W [t - 16];
+
+ // set up working variables.
+ ulong a = H1;
+ ulong b = H2;
+ ulong c = H3;
+ ulong d = H4;
+ ulong e = H5;
+ ulong f = H6;
+ ulong g = H7;
+ ulong h = H8;
+
+ for (int t = 0; t <= 79; t++) {
+ ulong T1 = h + Sum1 (e) + Ch (e, f, g) + K [t] + W [t];
+ ulong T2 = Sum0 (a) + Maj (a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+ }
+
+ H1 += a;
+ H2 += b;
+ H3 += c;
+ H4 += d;
+ H5 += e;
+ H6 += f;
+ H7 += g;
+ H8 += h;
+ // reset the offset and clean out the word buffer.
+ wOff = 0;
+ for (int i = 0; i != W.Length; i++)
+ W[i] = 0;
+ }
+
+ private ulong rotateRight (ulong x, int n)
+ {
+ return (x >> n) | (x << (64 - n));
+ }
+
+ /* SHA-384 and SHA-512 functions (as for SHA-256 but for longs) */
+ private ulong Ch (ulong x, ulong y, ulong z)
+ {
+ return ((x & y) ^ ((~x) & z));
+ }
+
+ private ulong Maj (ulong x, ulong y, ulong z)
+ {
+ return ((x & y) ^ (x & z) ^ (y & z));
+ }
+
+ private ulong Sum0 (ulong x)
+ {
+ return rotateRight (x, 28) ^ rotateRight (x, 34) ^ rotateRight (x, 39);
+ }
+
+ private ulong Sum1 (ulong x)
+ {
+ return rotateRight (x, 14) ^ rotateRight (x, 18) ^ rotateRight (x, 41);
+ }
+
+ private ulong Sigma0 (ulong x)
+ {
+ return rotateRight (x, 1) ^ rotateRight(x, 8) ^ (x >> 7);
+ }
+
+ private ulong Sigma1 (ulong x)
+ {
+ return rotateRight (x, 19) ^ rotateRight (x, 61) ^ (x >> 6);
+ }
+
+ // SHA-384 and SHA-512 Constants
+ // Rrepresent the first 64 bits of the fractional parts of the
+ // cube roots of the first sixty-four prime numbers
+ static ulong[] K = {
+ 0x428a2f98d728ae22L, 0x7137449123ef65cdL, 0xb5c0fbcfec4d3b2fL, 0xe9b5dba58189dbbcL,
+ 0x3956c25bf348b538L, 0x59f111f1b605d019L, 0x923f82a4af194f9bL, 0xab1c5ed5da6d8118L,
+ 0xd807aa98a3030242L, 0x12835b0145706fbeL, 0x243185be4ee4b28cL, 0x550c7dc3d5ffb4e2L,
+ 0x72be5d74f27b896fL, 0x80deb1fe3b1696b1L, 0x9bdc06a725c71235L, 0xc19bf174cf692694L,
+ 0xe49b69c19ef14ad2L, 0xefbe4786384f25e3L, 0x0fc19dc68b8cd5b5L, 0x240ca1cc77ac9c65L,
+ 0x2de92c6f592b0275L, 0x4a7484aa6ea6e483L, 0x5cb0a9dcbd41fbd4L, 0x76f988da831153b5L,
+ 0x983e5152ee66dfabL, 0xa831c66d2db43210L, 0xb00327c898fb213fL, 0xbf597fc7beef0ee4L,
+ 0xc6e00bf33da88fc2L, 0xd5a79147930aa725L, 0x06ca6351e003826fL, 0x142929670a0e6e70L,
+ 0x27b70a8546d22ffcL, 0x2e1b21385c26c926L, 0x4d2c6dfc5ac42aedL, 0x53380d139d95b3dfL,
+ 0x650a73548baf63deL, 0x766a0abb3c77b2a8L, 0x81c2c92e47edaee6L, 0x92722c851482353bL,
+ 0xa2bfe8a14cf10364L, 0xa81a664bbc423001L, 0xc24b8b70d0f89791L, 0xc76c51a30654be30L,
+ 0xd192e819d6ef5218L, 0xd69906245565a910L, 0xf40e35855771202aL, 0x106aa07032bbd1b8L,
+ 0x19a4c116b8d2d0c8L, 0x1e376c085141ab53L, 0x2748774cdf8eeb99L, 0x34b0bcb5e19b48a8L,
+ 0x391c0cb3c5c95a63L, 0x4ed8aa4ae3418acbL, 0x5b9cca4f7763e373L, 0x682e6ff3d6b2b8a3L,
+ 0x748f82ee5defb2fcL, 0x78a5636f43172f60L, 0x84c87814a1f0ab72L, 0x8cc702081a6439ecL,
+ 0x90befffa23631e28L, 0xa4506cebde82bde9L, 0xbef9a3f7b2c67915L, 0xc67178f2e372532bL,
+ 0xca273eceea26619cL, 0xd186b8c721c0c207L, 0xeada7dd6cde0eb1eL, 0xf57d4f7fee6ed178L,
+ 0x06f067aa72176fbaL, 0x0a637dc5a2c898a6L, 0x113f9804bef90daeL, 0x1b710b35131c471bL,
+ 0x28db77f523047d84L, 0x32caab7b40c72493L, 0x3c9ebe0a15c9bebcL, 0x431d67c49c100d4cL,
+ 0x4cc5d4becb3e42b6L, 0x597f299cfc657e2aL, 0x5fcb6fab3ad6faecL, 0x6c44198c4a475817L
+ };
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA512.cs b/mcs/class/corlib/System.Security.Cryptography/SHA512.cs
new file mode 100644
index 00000000000..cf119df03f1
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA512.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography SHA512 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Copyright 2001 by Matthew S. Ford.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+ /// <summary>
+ /// Common base class for all derived SHA512 implementations.
+ /// </summary>
+ public abstract class SHA512 : HashAlgorithm {
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SHA512 ()
+ {
+ HashSizeValue = 512;
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA512 Create ()
+ {
+ return Create ("System.Security.Cryptography.SHA512");
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="hashName">Specifies which derived class to create</param>
+ public static new SHA512 Create (string hashName)
+ {
+ return (SHA512) CryptoConfig.CreateFromName (hashName);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs
new file mode 100644
index 00000000000..b3e193963d3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs
@@ -0,0 +1,280 @@
+//
+// System.Security.Cryptography.SHA512Managed.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Sébastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002
+// Implementation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
+// See bouncycastle.txt for license.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+public class SHA512Managed : SHA512 {
+
+ private byte[] xBuf;
+ private int xBufOff;
+
+ private ulong byteCount1;
+ private ulong byteCount2;
+
+ private ulong H1, H2, H3, H4, H5, H6, H7, H8;
+
+ private ulong[] W = new ulong [80];
+ private int wOff;
+
+ public SHA512Managed ()
+ {
+ xBuf = new byte [8];
+ xBufOff = 0;
+ Initialize ();
+ }
+
+ public override void Initialize ()
+ {
+ // SHA-512 initial hash value
+ // The first 64 bits of the fractional parts of the square roots
+ // of the first eight prime numbers
+ H1 = 0x6a09e667f3bcc908L;
+ H2 = 0xbb67ae8584caa73bL;
+ H3 = 0x3c6ef372fe94f82bL;
+ H4 = 0xa54ff53a5f1d36f1L;
+ H5 = 0x510e527fade682d1L;
+ H6 = 0x9b05688c2b3e6c1fL;
+ H7 = 0x1f83d9abfb41bd6bL;
+ H8 = 0x5be0cd19137e2179L;
+
+ byteCount1 = 0;
+ byteCount2 = 0;
+
+ xBufOff = 0;
+ for (int i = 0; i < xBuf.Length; i++)
+ xBuf [i] = 0;
+
+ wOff = 0;
+ for (int i = 0; i != W.Length; i++)
+ W [i] = 0;
+ }
+
+ // protected
+
+ protected override void HashCore (byte[] rgb, int start, int count)
+ {
+ // fill the current word
+ while ((xBufOff != 0) && (count > 0)) {
+ update( rgb [start]);
+ start++;
+ count--;
+ }
+
+ // process whole words.
+ while (count > xBuf.Length) {
+ processWord(rgb, start);
+ start += xBuf.Length;
+ count -= xBuf.Length;
+ byteCount1 += (ulong) xBuf.Length;
+ }
+
+ // load in the remainder.
+ while (count > 0) {
+ update( rgb [start]);
+ start++;
+ count--;
+ }
+ }
+
+ protected override byte[] HashFinal ()
+ {
+ adjustByteCounts();
+
+ ulong lowBitLength = byteCount1 << 3;
+ ulong hiBitLength = byteCount2;
+
+ // add the pad bytes.
+ update ( (byte) 128);
+ while (xBufOff != 0)
+ update ( (byte)0);
+
+ processLength (lowBitLength, hiBitLength);
+ processBlock ();
+
+ byte[] output = new byte [64];
+ unpackWord(H1, output, 0);
+ unpackWord(H2, output, 8);
+ unpackWord(H3, output, 16);
+ unpackWord(H4, output, 24);
+ unpackWord(H5, output, 32);
+ unpackWord(H6, output, 40);
+ unpackWord(H7, output, 48);
+ unpackWord(H8, output, 56);
+
+ Initialize ();
+ return output;
+ }
+
+ private void update (byte input)
+ {
+ xBuf [xBufOff++] = input;
+ if (xBufOff == xBuf.Length) {
+ processWord(xBuf, 0);
+ xBufOff = 0;
+ }
+ byteCount1++;
+ }
+
+ private void processWord (byte[] input, int inOff)
+ {
+ W [wOff++] = ( (ulong) input [inOff] << 56)
+ | ( (ulong) input [inOff + 1] << 48)
+ | ( (ulong) input [inOff + 2] << 40)
+ | ( (ulong) input [inOff + 3] << 32)
+ | ( (ulong) input [inOff + 4] << 24)
+ | ( (ulong) input [inOff + 5] << 16)
+ | ( (ulong) input [inOff + 6] << 8)
+ | ( (ulong) input [inOff + 7]);
+ if (wOff == 16)
+ processBlock ();
+ }
+
+ private void unpackWord (ulong word, byte[] output, int outOff)
+ {
+ output[outOff] = (byte) (word >> 56);
+ output[outOff + 1] = (byte) (word >> 48);
+ output[outOff + 2] = (byte) (word >> 40);
+ output[outOff + 3] = (byte) (word >> 32);
+ output[outOff + 4] = (byte) (word >> 24);
+ output[outOff + 5] = (byte) (word >> 16);
+ output[outOff + 6] = (byte) (word >> 8);
+ output[outOff + 7] = (byte) word;
+ }
+
+ // adjust the byte counts so that byteCount2 represents the
+ // upper long (less 3 bits) word of the byte count.
+ private void adjustByteCounts ()
+ {
+ if (byteCount1 > 0x1fffffffffffffffL) {
+ byteCount2 += (byteCount1 >> 61);
+ byteCount1 &= 0x1fffffffffffffffL;
+ }
+ }
+
+ private void processLength (ulong lowW, ulong hiW)
+ {
+ if (wOff > 14)
+ processBlock();
+ W[14] = hiW;
+ W[15] = lowW;
+ }
+
+ private void processBlock ()
+ {
+ adjustByteCounts ();
+ // expand 16 word block into 80 word blocks.
+ for (int t = 16; t <= 79; t++)
+ W[t] = Sigma1 (W [t - 2]) + W [t - 7] + Sigma0 (W [t - 15]) + W [t - 16];
+
+ // set up working variables.
+ ulong a = H1;
+ ulong b = H2;
+ ulong c = H3;
+ ulong d = H4;
+ ulong e = H5;
+ ulong f = H6;
+ ulong g = H7;
+ ulong h = H8;
+
+ for (int t = 0; t <= 79; t++) {
+ ulong T1 = h + Sum1 (e) + Ch (e, f, g) + K [t] + W [t];
+ ulong T2 = Sum0 (a) + Maj (a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+ }
+
+ H1 += a;
+ H2 += b;
+ H3 += c;
+ H4 += d;
+ H5 += e;
+ H6 += f;
+ H7 += g;
+ H8 += h;
+ // reset the offset and clean out the word buffer.
+ wOff = 0;
+ for (int i = 0; i != W.Length; i++)
+ W[i] = 0;
+ }
+
+ private ulong rotateRight (ulong x, int n)
+ {
+ return (x >> n) | (x << (64 - n));
+ }
+
+ /* SHA-512 and SHA-512 functions (as for SHA-256 but for longs) */
+ private ulong Ch (ulong x, ulong y, ulong z)
+ {
+ return ((x & y) ^ ((~x) & z));
+ }
+
+ private ulong Maj (ulong x, ulong y, ulong z)
+ {
+ return ((x & y) ^ (x & z) ^ (y & z));
+ }
+
+ private ulong Sum0 (ulong x)
+ {
+ return rotateRight (x, 28) ^ rotateRight (x, 34) ^ rotateRight (x, 39);
+ }
+
+ private ulong Sum1 (ulong x)
+ {
+ return rotateRight (x, 14) ^ rotateRight (x, 18) ^ rotateRight (x, 41);
+ }
+
+ private ulong Sigma0 (ulong x)
+ {
+ return rotateRight (x, 1) ^ rotateRight(x, 8) ^ (x >> 7);
+ }
+
+ private ulong Sigma1 (ulong x)
+ {
+ return rotateRight (x, 19) ^ rotateRight (x, 61) ^ (x >> 6);
+ }
+
+ // SHA-384 and SHA-512 Constants
+ // Rrepresent the first 64 bits of the fractional parts of the
+ // cube roots of the first sixty-four prime numbers
+ static ulong[] K = {
+ 0x428a2f98d728ae22L, 0x7137449123ef65cdL, 0xb5c0fbcfec4d3b2fL, 0xe9b5dba58189dbbcL,
+ 0x3956c25bf348b538L, 0x59f111f1b605d019L, 0x923f82a4af194f9bL, 0xab1c5ed5da6d8118L,
+ 0xd807aa98a3030242L, 0x12835b0145706fbeL, 0x243185be4ee4b28cL, 0x550c7dc3d5ffb4e2L,
+ 0x72be5d74f27b896fL, 0x80deb1fe3b1696b1L, 0x9bdc06a725c71235L, 0xc19bf174cf692694L,
+ 0xe49b69c19ef14ad2L, 0xefbe4786384f25e3L, 0x0fc19dc68b8cd5b5L, 0x240ca1cc77ac9c65L,
+ 0x2de92c6f592b0275L, 0x4a7484aa6ea6e483L, 0x5cb0a9dcbd41fbd4L, 0x76f988da831153b5L,
+ 0x983e5152ee66dfabL, 0xa831c66d2db43210L, 0xb00327c898fb213fL, 0xbf597fc7beef0ee4L,
+ 0xc6e00bf33da88fc2L, 0xd5a79147930aa725L, 0x06ca6351e003826fL, 0x142929670a0e6e70L,
+ 0x27b70a8546d22ffcL, 0x2e1b21385c26c926L, 0x4d2c6dfc5ac42aedL, 0x53380d139d95b3dfL,
+ 0x650a73548baf63deL, 0x766a0abb3c77b2a8L, 0x81c2c92e47edaee6L, 0x92722c851482353bL,
+ 0xa2bfe8a14cf10364L, 0xa81a664bbc423001L, 0xc24b8b70d0f89791L, 0xc76c51a30654be30L,
+ 0xd192e819d6ef5218L, 0xd69906245565a910L, 0xf40e35855771202aL, 0x106aa07032bbd1b8L,
+ 0x19a4c116b8d2d0c8L, 0x1e376c085141ab53L, 0x2748774cdf8eeb99L, 0x34b0bcb5e19b48a8L,
+ 0x391c0cb3c5c95a63L, 0x4ed8aa4ae3418acbL, 0x5b9cca4f7763e373L, 0x682e6ff3d6b2b8a3L,
+ 0x748f82ee5defb2fcL, 0x78a5636f43172f60L, 0x84c87814a1f0ab72L, 0x8cc702081a6439ecL,
+ 0x90befffa23631e28L, 0xa4506cebde82bde9L, 0xbef9a3f7b2c67915L, 0xc67178f2e372532bL,
+ 0xca273eceea26619cL, 0xd186b8c721c0c207L, 0xeada7dd6cde0eb1eL, 0xf57d4f7fee6ed178L,
+ 0x06f067aa72176fbaL, 0x0a637dc5a2c898a6L, 0x113f9804bef90daeL, 0x1b710b35131c471bL,
+ 0x28db77f523047d84L, 0x32caab7b40c72493L, 0x3c9ebe0a15c9bebcL, 0x431d67c49c100d4cL,
+ 0x4cc5d4becb3e42b6L, 0x597f299cfc657e2aL, 0x5fcb6fab3ad6faecL, 0x6c44198c4a475817L
+ };
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs b/mcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs
new file mode 100755
index 00000000000..53ae8503599
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs
@@ -0,0 +1,135 @@
+//
+// System.Security.Cryptography SignatureDescription Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+// Notes:
+// There seems to be some (internal?) class inheriting from SignatureDescription
+// http://www.csharpfriends.com/Members/Main/Classes/get_class.aspx?assembly=mscorlib,%20Version=1.0.3300.0,%20Culture=neutral,%20PublicKeyToken=b77a5c561934e089&namespace=System.Security.Cryptography&class=SignatureDescription
+// Those 2 classes are returned by CryptoConfig.CreateFromName and used in XMLDSIG
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+public class SignatureDescription {
+ private string _DeformatterAlgorithm;
+ private string _DigestAlgorithm;
+ private string _FormatterAlgorithm;
+ private string _KeyAlgorithm;
+
+ public SignatureDescription () {}
+
+ /// LAMESPEC: ArgumentNullException is thrown (not CryptographicException)
+ [MonoTODO("Parse SecurityElement")]
+ public SignatureDescription (SecurityElement el)
+ {
+ if (el == null)
+ throw new ArgumentNullException ();
+ // TODO: Parse the SecurityElement
+ // Clearly it must contains Deformatter, Digest,
+ // Formatter and KeyAlgorithm...
+ // But what do the SecurityElement looks like ?
+ }
+
+ // There are no validation of the property
+ public string DeformatterAlgorithm {
+ get { return _DeformatterAlgorithm; }
+ set { _DeformatterAlgorithm = value; }
+ }
+
+ // There are no validation of the property
+ public string DigestAlgorithm {
+ get { return _DigestAlgorithm; }
+ set { _DigestAlgorithm = value; }
+ }
+
+ // There are no validation of the property
+ public string FormatterAlgorithm {
+ get { return _FormatterAlgorithm; }
+ set { _FormatterAlgorithm = value; }
+ }
+
+ // There are no validation of the property
+ public string KeyAlgorithm {
+ get { return _KeyAlgorithm; }
+ set { _KeyAlgorithm = value; }
+ }
+
+ public virtual AsymmetricSignatureDeformatter CreateDeformatter (AsymmetricAlgorithm key)
+ {
+ if (_DeformatterAlgorithm == null)
+ throw new ArgumentNullException ("DeformatterAlgorithm");
+
+ // this should throw the InvalidCastException if we have an invalid class
+ // (but not if the class doesn't exist - as null is valid for AsymmetricSignatureDeformatter)
+ AsymmetricSignatureDeformatter def = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName (_DeformatterAlgorithm);
+
+ if (_KeyAlgorithm == null)
+ throw new NullReferenceException ("KeyAlgorithm");
+
+ def.SetKey (key);
+ return def;
+ }
+
+ /// <summary>
+ /// Create the hash algorithm assigned with this object
+ /// </summary>
+ public virtual HashAlgorithm CreateDigest ()
+ {
+ if (_DigestAlgorithm == null)
+ throw new ArgumentNullException ("DigestAlgorithm");
+ return (HashAlgorithm) CryptoConfig.CreateFromName (_DigestAlgorithm);
+ }
+
+ public virtual AsymmetricSignatureFormatter CreateFormatter (AsymmetricAlgorithm key)
+ {
+ if (_FormatterAlgorithm == null)
+ throw new ArgumentNullException ("FormatterAlgorithm");
+
+ // this should throw the InvalidCastException if we have an invalid class
+ // (but not if the class doesn't exist - as null is valid for AsymmetricSignatureDeformatter)
+ AsymmetricSignatureFormatter fmt = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName (_FormatterAlgorithm);
+
+ if (_KeyAlgorithm == null)
+ throw new NullReferenceException ("KeyAlgorithm");
+
+ fmt.SetKey (key);
+ return fmt;
+ }
+
+} // SignatureDescription
+
+internal class DSASignatureDescription : SignatureDescription {
+ public DSASignatureDescription ()
+ {
+ DeformatterAlgorithm = "System.Security.Cryptography.DSASignatureDeformatter";
+ DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider";
+ FormatterAlgorithm = "System.Security.Cryptography.DSASignatureFormatter";
+ KeyAlgorithm = "System.Security.Cryptography.DSACryptoServiceProvider";
+ }
+}
+
+internal class RSAPKCS1SHA1SignatureDescription : SignatureDescription {
+ public RSAPKCS1SHA1SignatureDescription ()
+ {
+ DeformatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureDeformatter";
+ DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider";
+ FormatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureFormatter";
+ KeyAlgorithm = "System.Security.Cryptography.RSACryptoServiceProvider";
+ }
+
+ public override AsymmetricSignatureDeformatter CreateDeformatter (AsymmetricAlgorithm key)
+ {
+ // just to please corcompare
+ return base.CreateDeformatter (key);
+ }
+}
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs
new file mode 100755
index 00000000000..8e437b86006
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs
@@ -0,0 +1,568 @@
+//
+// System.Security.Cryptography SymmetricAlgorithm Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ // This class implement most of the common code required for symmetric
+ // algorithm transforms, like:
+ // - CipherMode: Builds CBC and CFB on top of (descendant supplied) ECB
+ // - PaddingMode, transform properties, multiple blocks, reuse...
+ //
+ // Descendants MUST:
+ // - intialize themselves (like key expansion, ...)
+ // - override the ECB (Electronic Code Book) method which will only be
+ // called using BlockSize byte[] array.
+ internal abstract class SymmetricTransform : ICryptoTransform {
+ protected SymmetricAlgorithm algo;
+ protected bool encrypt;
+ private int BlockSizeByte;
+ private byte[] temp;
+ private byte[] temp2;
+ private byte[] workBuff;
+ private byte[] workout;
+ private int FeedBackByte;
+ private int FeedBackIter;
+ private bool m_disposed = false;
+
+ public SymmetricTransform (SymmetricAlgorithm symmAlgo, bool encryption, byte[] rgbIV)
+ {
+ algo = symmAlgo;
+ encrypt = encryption;
+ BlockSizeByte = (algo.BlockSize >> 3);
+ // mode buffers
+ temp = new byte [BlockSizeByte];
+ Array.Copy (rgbIV, 0, temp, 0, BlockSizeByte);
+ temp2 = new byte [BlockSizeByte];
+ FeedBackByte = (algo.FeedbackSize >> 3);
+ FeedBackIter = (int) BlockSizeByte / FeedBackByte;
+ // transform buffers
+ workBuff = new byte [BlockSizeByte];
+ workout = new byte [BlockSizeByte];
+ }
+
+ ~SymmetricTransform ()
+ {
+ Dispose (false);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ // MUST be overriden by classes using unmanaged ressources
+ // the override method must call the base class
+ protected void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ if (disposing) {
+ // dispose managed object: zeroize and free
+ Array.Clear (temp, 0, BlockSizeByte);
+ temp = null;
+ Array.Clear (temp2, 0, BlockSizeByte);
+ temp2 = null;
+ }
+ m_disposed = true;
+ }
+ }
+
+ public virtual bool CanTransformMultipleBlocks {
+ get { return true; }
+ }
+
+ public bool CanReuseTransform {
+ get { return false; }
+ }
+
+ public virtual int InputBlockSize {
+ get { return BlockSizeByte; }
+ }
+
+ public virtual int OutputBlockSize {
+ get { return BlockSizeByte; }
+ }
+
+ // note: Each block MUST be BlockSizeValue in size!!!
+ // i.e. Any padding must be done before calling this method
+ protected void Transform (byte[] input, byte[] output)
+ {
+ switch (algo.Mode) {
+ case CipherMode.ECB:
+ ECB (input, output);
+ break;
+ case CipherMode.CBC:
+ CBC (input, output);
+ break;
+ case CipherMode.CFB:
+ CFB (input, output);
+ break;
+ case CipherMode.OFB:
+ OFB (input, output);
+ break;
+ case CipherMode.CTS:
+ CTS (input, output);
+ break;
+ default:
+ throw new NotImplementedException ("Unkown CipherMode" + algo.Mode.ToString ());
+ }
+ }
+
+ // Electronic Code Book (ECB)
+ protected abstract void ECB (byte[] input, byte[] output);
+
+ // Cipher-Block-Chaining (CBC)
+ protected virtual void CBC (byte[] input, byte[] output)
+ {
+ if (encrypt) {
+ for (int i = 0; i < BlockSizeByte; i++)
+ temp[i] ^= input[i];
+ ECB (temp, output);
+ Array.Copy (output, 0, temp, 0, BlockSizeByte);
+ }
+ else {
+ Array.Copy (input, 0, temp2, 0, BlockSizeByte);
+ ECB (input, output);
+ for (int i = 0; i < BlockSizeByte; i++)
+ output[i] ^= temp[i];
+ Array.Copy (temp2, 0, temp, 0, BlockSizeByte);
+ }
+ }
+
+ // Cipher-FeedBack (CFB)
+ protected virtual void CFB (byte[] input, byte[] output)
+ {
+ if (encrypt) {
+ for (int x = 0; x < FeedBackIter; x++) {
+ // temp is first initialized with the IV
+ ECB (temp, temp2);
+
+ for (int i = 0; i < FeedBackByte; i++)
+ output[i + x] = (byte)(temp2[i] ^ input[i + x]);
+ Array.Copy (temp, FeedBackByte, temp, 0, BlockSizeByte - FeedBackByte);
+ Array.Copy (output, x, temp, BlockSizeByte - FeedBackByte, FeedBackByte);
+ }
+ }
+ else {
+ for (int x = 0; x < FeedBackIter; x++) {
+ // we do not really decrypt this data!
+ encrypt = true;
+ // temp is first initialized with the IV
+ ECB (temp, temp2);
+ encrypt = false;
+
+ Array.Copy (temp, FeedBackByte, temp, 0, BlockSizeByte - FeedBackByte);
+ Array.Copy (input, x, temp, BlockSizeByte - FeedBackByte, FeedBackByte);
+ for (int i = 0; i < FeedBackByte; i++)
+ output[i + x] = (byte)(temp2[i] ^ input[i + x]);
+ }
+ }
+ }
+
+ // Output-FeedBack (OFB)
+ protected virtual void OFB (byte[] input, byte[] output)
+ {
+ throw new NotImplementedException ("OFB not yet supported");
+ }
+
+ // Cipher Text Stealing (CTS)
+ protected virtual void CTS (byte[] input, byte[] output)
+ {
+ throw new NotImplementedException ("CTS not yet supported");
+ }
+
+ // this method may get called MANY times so this is the one to optimize
+ public virtual int TransformBlock (byte [] inputBuffer, int inputOffset, int inputCount, byte [] outputBuffer, int outputOffset)
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("Object is disposed");
+
+ if (outputOffset + inputCount > outputBuffer.Length)
+ throw new CryptographicException ("Insufficient output buffer size.");
+
+ int offs = inputOffset;
+ int full;
+
+ // this way we don't do a modulo every time we're called
+ // and we may save a division
+ if (inputCount != BlockSizeByte) {
+ if ((inputCount % BlockSizeByte) != 0)
+ throw new CryptographicException ("Invalid input block size.");
+
+ full = inputCount / BlockSizeByte;
+ }
+ else
+ full = 1;
+
+ int total = 0;
+ for (int i = 0; i < full; i++) {
+ Array.Copy (inputBuffer, offs, workBuff, 0, BlockSizeByte);
+ Transform (workBuff, workout);
+ Array.Copy (workout, 0, outputBuffer, outputOffset, BlockSizeByte);
+ offs += BlockSizeByte;
+ outputOffset += BlockSizeByte;
+ total += BlockSizeByte;
+ }
+
+ return total;
+ }
+
+ private byte[] FinalEncrypt (byte [] inputBuffer, int inputOffset, int inputCount)
+ {
+ // are there still full block to process ?
+ int full = (inputCount / BlockSizeByte) * BlockSizeByte;
+ int rem = inputCount - full;
+ int total = full;
+
+ // we need to add an extra block if...
+ // a. the last block isn't complate (partial);
+ // b. the last block is complete but we use padding
+ if ((rem > 0) || (algo.Padding != PaddingMode.None))
+ total += BlockSizeByte;
+ byte[] res = new byte [total];
+
+ // process all blocks except the last (final) block
+ while (total > BlockSizeByte) {
+ TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, inputOffset);
+ inputOffset += BlockSizeByte;
+ total -= BlockSizeByte;
+ }
+
+ // now we only have a single last block to encrypt
+ int padding = BlockSizeByte - rem;
+ switch (algo.Padding) {
+ case PaddingMode.None:
+ break;
+ case PaddingMode.PKCS7:
+ for (int i = BlockSizeByte; --i >= (BlockSizeByte - padding);)
+ res [i] = (byte) padding;
+ break;
+ case PaddingMode.Zeros:
+ for (int i = BlockSizeByte; --i >= (BlockSizeByte - padding);)
+ res [i] = 0;
+ break;
+ }
+ Array.Copy (inputBuffer, inputOffset, res, full, rem);
+
+ // the last padded block will be transformed in-place
+ TransformBlock (res, full, BlockSizeByte, res, full);
+ return res;
+ }
+
+ private byte[] FinalDecrypt (byte [] inputBuffer, int inputOffset, int inputCount)
+ {
+ if ((inputCount % BlockSizeByte) > 0)
+ throw new CryptographicException ("Invalid input block size.");
+
+ int total = inputCount;
+ byte[] res = new byte [total];
+ while (inputCount > 0) {
+ TransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, inputOffset);
+ inputOffset += BlockSizeByte;
+ inputCount -= BlockSizeByte;
+ }
+
+ switch (algo.Padding) {
+ case PaddingMode.None:
+ break;
+ case PaddingMode.PKCS7:
+ total -= res [total - 1];
+ break;
+ case PaddingMode.Zeros:
+ // TODO
+ break;
+ }
+
+ // return output without padding
+ byte[] data = new byte [total];
+ Array.Copy (res, 0, data, 0, total);
+ // zeroize decrypted data (copy with padding)
+ Array.Clear (res, 0, res.Length);
+ return data;
+ }
+
+ public virtual byte [] TransformFinalBlock (byte [] inputBuffer, int inputOffset, int inputCount)
+ {
+ if (m_disposed)
+ throw new ObjectDisposedException ("Object is disposed");
+
+ if (encrypt)
+ return FinalEncrypt (inputBuffer, inputOffset, inputCount);
+ else
+ return FinalDecrypt (inputBuffer, inputOffset, inputCount);
+ }
+ }
+
+ /// <summary>
+ /// Abstract base class for all cryptographic symmetric algorithms.
+ /// Available algorithms include:
+ /// DES, RC2, Rijndael, TripleDES
+ /// </summary>
+ public abstract class SymmetricAlgorithm : IDisposable {
+ protected int BlockSizeValue; // The block size of the cryptographic operation in bits.
+ protected int FeedbackSizeValue; // The feedback size of the cryptographic operation in bits.
+ protected byte[] IVValue; // The initialization vector ( IV) for the symmetric algorithm.
+ protected int KeySizeValue; // The size of the secret key used by the symmetric algorithm in bits.
+ protected byte[] KeyValue; // The secret key for the symmetric algorithm.
+ protected KeySizes[] LegalBlockSizesValue; // Specifies the block sizes that are supported by the symmetric algorithm.
+ protected KeySizes[] LegalKeySizesValue; // Specifies the key sizes that are supported by the symmetric algorithm.
+ protected CipherMode ModeValue; // Represents the cipher mode used in the symmetric algorithm.
+ protected PaddingMode PaddingValue; // Represents the padding mode used in the symmetric algorithm.
+ private bool m_disposed;
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SymmetricAlgorithm ()
+ {
+ ModeValue = CipherMode.CBC;
+ PaddingValue = PaddingMode.PKCS7;
+ m_disposed = false;
+ }
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ ~SymmetricAlgorithm ()
+ {
+ Dispose (false);
+ }
+
+ public void Clear()
+ {
+ Dispose (true);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // always zeroize keys
+ if (KeyValue != null) {
+ // Zeroize the secret key and free
+ Array.Clear (KeyValue, 0, KeyValue.Length);
+ KeyValue = null;
+ }
+ // dispose unmanaged managed objects
+ if (disposing) {
+ // dispose managed objects
+ }
+ m_disposed = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual BlockSize
+ /// </summary>
+ public virtual int BlockSize {
+ get { return this.BlockSizeValue; }
+ set {
+ if (IsLegalKeySize(this.LegalBlockSizesValue, value))
+ this.BlockSizeValue = value;
+ else
+ throw new CryptographicException("block size not supported by algorithm");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual FeedbackSize
+ /// </summary>
+ public virtual int FeedbackSize {
+ get { return this.FeedbackSizeValue; }
+ set {
+ if (value > this.BlockSizeValue)
+ throw new CryptographicException("feedback size larger than block size");
+ else
+ this.FeedbackSizeValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual Initial Vector
+ /// </summary>
+ public virtual byte[] IV {
+ get {
+ if (this.IVValue == null)
+ GenerateIV();
+
+ return this.IVValue;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("tried setting initial vector to null");
+
+ if (value.Length * 8 != this.BlockSizeValue)
+ throw new CryptographicException ("IV length must match block size");
+
+ this.IVValue = new byte [value.Length];
+ Array.Copy (value, 0, this.IVValue, 0, value.Length);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual key
+ /// </summary>
+ public virtual byte[] Key {
+ get {
+ if (this.KeyValue == null)
+ GenerateKey();
+
+ return this.KeyValue;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("tried setting key to null");
+
+ if (!IsLegalKeySize (this.LegalKeySizesValue, value.Length * 8))
+ throw new CryptographicException ("key size not supported by algorithm");
+
+ this.KeySizeValue = value.Length * 8;
+ this.KeyValue = new byte [value.Length];
+ Array.Copy (value, 0, this.KeyValue, 0, value.Length);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual key size in bits
+ /// </summary>
+ public virtual int KeySize {
+ get { return this.KeySizeValue; }
+ set {
+ if (!IsLegalKeySize (this.LegalKeySizesValue, value))
+ throw new CryptographicException ("key size not supported by algorithm");
+
+ this.KeyValue = null;
+ this.KeySizeValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets all legal block sizes
+ /// </summary>
+ public virtual KeySizes[] LegalBlockSizes {
+ get { return this.LegalBlockSizesValue; }
+ }
+
+ /// <summary>
+ /// Gets all legal key sizes
+ /// </summary>
+ public virtual KeySizes[] LegalKeySizes {
+ get { return this.LegalKeySizesValue; }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual cipher mode
+ /// </summary>
+ public virtual CipherMode Mode {
+ get { return this.ModeValue; }
+ set {
+ if (Enum.IsDefined( ModeValue.GetType (), value))
+ this.ModeValue = value;
+ else
+ throw new CryptographicException ("padding mode not available");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual padding
+ /// </summary>
+ public virtual PaddingMode Padding {
+ get { return this.PaddingValue; }
+ set {
+ if (Enum.IsDefined (PaddingValue.GetType (), value))
+ this.PaddingValue = value;
+ else
+ throw new CryptographicException ("padding mode not available");
+ }
+ }
+
+ /// <summary>
+ /// Gets an Decryptor transform object to work with a CryptoStream
+ /// </summary>
+ public virtual ICryptoTransform CreateDecryptor ()
+ {
+ return CreateDecryptor (Key, IV);
+ }
+
+ /// <summary>
+ /// Gets an Decryptor transform object to work with a CryptoStream
+ /// </summary>
+ public abstract ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV);
+
+ /// <summary>
+ /// Gets an Encryptor transform object to work with a CryptoStream
+ /// </summary>
+ public virtual ICryptoTransform CreateEncryptor()
+ {
+ return CreateEncryptor (Key, IV);
+ }
+
+ /// <summary>
+ /// Gets an Encryptor transform object to work with a CryptoStream
+ /// </summary>
+ public abstract ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV);
+
+ /// <summary>
+ /// used to generate an inital vector if none is specified
+ /// </summary>
+ public abstract void GenerateIV ();
+
+ /// </summary>
+ /// used to generate a random key if none is specified
+ /// </summary>
+ public abstract void GenerateKey ();
+
+ internal bool IsLegalKeySize (KeySizes[] LegalKeys, int Size)
+ {
+ foreach (KeySizes LegalKeySize in LegalKeys) {
+ for (int i=LegalKeySize.MinSize; i<=LegalKeySize.MaxSize; i+=LegalKeySize.SkipSize) {
+ if (i == Size)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Checks wether the given keyLength is valid for the current algorithm
+ /// </summary>
+ /// <param name="bitLength">the given keyLength</param>
+ public bool ValidKeySize (int bitLength)
+ {
+ return IsLegalKeySize (LegalKeySizesValue, bitLength);
+ }
+
+ /// <summary>
+ /// Creates the default implementation of the default symmetric algorithm (Rijndael).
+ /// </summary>
+ // LAMESPEC: Default is Rijndael - not TripleDES
+ public static SymmetricAlgorithm Create ()
+ {
+ return Create ("System.Security.Cryptography.SymmetricAlgorithm");
+ }
+
+ /// <summary>
+ /// Creates a specific implementation of the given symmetric algorithm.
+ /// </summary>
+ /// <param name="algName">Specifies which derived class to create</param>
+ public static SymmetricAlgorithm Create (string algName)
+ {
+ return (SymmetricAlgorithm) CryptoConfig.CreateFromName (algName);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs b/mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs
new file mode 100644
index 00000000000..1bf4c60161d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs
@@ -0,0 +1,242 @@
+//
+// System.Security.Cryptography.ToBase64Transform
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ public class ToBase64Transform : ICryptoTransform {
+
+ private bool m_disposed;
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ToBase64Transform ()
+ {
+ }
+
+ ~ToBase64Transform ()
+ {
+ Dispose (false);
+ }
+
+ /// <summary>
+ /// </summary>
+ public bool CanTransformMultipleBlocks {
+ get {
+ return false;
+ }
+ }
+
+ public virtual bool CanReuseTransform {
+ get { return false; }
+ }
+
+ /// <summary>
+ /// Returns the input block size for the Base64 encoder.
+ /// </summary>
+ /// <remarks>
+ /// The returned value is always 3.
+ /// </remarks>
+ public int InputBlockSize {
+ get {
+ return 3;
+ }
+ }
+
+ /// <summary>
+ /// Returns the output block size for the Base64 encoder.
+ /// </summary>
+ /// <remarks>
+ /// The value returned by this property is always 4.
+ /// </remarks>
+ public int OutputBlockSize {
+ get {
+ return 4;
+ }
+ }
+
+ public void Clear()
+ {
+ Dispose (true);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // Finalization is now unnecessary
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!m_disposed) {
+ // dispose unmanaged objects
+ if (disposing) {
+ // dispose managed objects
+ }
+ m_disposed = true;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public int TransformBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte [] outputBuffer,
+ int outputOffset)
+ {
+ if (inputCount != this.InputBlockSize)
+ throw new CryptographicException();
+
+ byte [] lookup = Base64Table.EncodeTable;
+
+ int b1 = inputBuffer [inputOffset];
+ int b2 = inputBuffer [inputOffset + 1];
+ int b3 = inputBuffer [inputOffset + 2];
+
+ outputBuffer [outputOffset] = lookup [b1 >> 2];
+ outputBuffer [outputOffset+1] = lookup [((b1 << 4) & 0x30) | (b2 >> 4)];
+ outputBuffer [outputOffset+2] = lookup [((b2 << 2) & 0x3c) | (b3 >> 6)];
+ outputBuffer [outputOffset+3] = lookup [b3 & 0x3f];
+
+ return this.OutputBlockSize;
+ }
+
+ // LAMESPEC: It's not clear from Beta2 docs what should be
+ // happening here if inputCount > InputBlockSize.
+ // It just "Converts the specified region of the specified
+ // byte array" and that's all.
+ // Beta2 implementation throws some strange (and undocumented)
+ // exception in such case. The exception is thrown by
+ // System.Convert and not the method itself.
+ // Anyhow, this implementation just encodes blocks of any size,
+ // like any usual Base64 encoder.
+
+ /// <summary>
+ /// </summary>
+ public byte [] TransformFinalBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount)
+ {
+ int blockLen = this.InputBlockSize;
+ int outLen = this.OutputBlockSize;
+ int fullBlocks = inputCount / blockLen;
+ int tail = inputCount % blockLen;
+
+ byte [] res = new byte [(inputCount != 0)
+ ? ((inputCount + 2) / blockLen) * outLen
+ : 0];
+
+ int outputOffset = 0;
+
+ for (int i = 0; i < fullBlocks; i++) {
+
+ TransformBlock (inputBuffer, inputOffset,
+ blockLen, res, outputOffset);
+
+ inputOffset += blockLen;
+ outputOffset += outLen;
+ }
+
+
+ byte [] lookup = Base64Table.EncodeTable;
+ int b1,b2;
+
+
+ // When fewer than 24 input bits are available
+ // in an input group, zero bits are added
+ // (on the right) to form an integral number of
+ // 6-bit groups.
+ switch (tail) {
+ case 0:
+ break;
+ case 1:
+ b1 = inputBuffer [inputOffset];
+ res [outputOffset] = lookup [b1 >> 2];
+ res [outputOffset+1] = lookup [(b1 << 4) & 0x30];
+
+ // padding
+ res [outputOffset+2] = (byte)'=';
+ res [outputOffset+3] = (byte)'=';
+ break;
+
+ case 2:
+ b1 = inputBuffer [inputOffset];
+ b2 = inputBuffer [inputOffset + 1];
+ res [outputOffset] = lookup [b1 >> 2];
+ res [outputOffset+1] = lookup [((b1 << 4) & 0x30) | (b2 >> 4)];
+ res [outputOffset+2] = lookup [(b2 << 2) & 0x3c];
+
+ // one-byte padding
+ res [outputOffset+3] = (byte)'=';
+ break;
+
+ default:
+ break;
+ }
+
+ return res;
+ }
+ } // ToBase64Transform
+
+
+ [MonoTODO ("Put me in a separate file")]
+ internal sealed class Base64Table {
+
+ // This is the Base64 alphabet as described in RFC 2045
+ // (Table 1, page 25).
+ private static string ALPHABET =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ private static byte[] encodeTable;
+ private static byte[] decodeTable;
+
+
+ static Base64Table ()
+ {
+ int len = ALPHABET.Length;
+
+ encodeTable = new byte [len];
+
+ for (int i=0; i < len; i++) {
+ encodeTable [i] = (byte) ALPHABET [i];
+ }
+
+
+ decodeTable = new byte [1 + (int)'z'];
+
+ for (int i=0; i < decodeTable.Length; i++) {
+ decodeTable [i] = Byte.MaxValue;
+ }
+
+ for (int i=0; i < len; i++) {
+ char ch = ALPHABET [i];
+ decodeTable [(int)ch] = (byte) i;
+ }
+ }
+
+ private Base64Table ()
+ {
+ // Never instantiated.
+ }
+
+ internal static byte [] EncodeTable {
+ get {
+ return encodeTable;
+ }
+ }
+
+ internal static byte [] DecodeTable {
+ get {
+ return decodeTable;
+ }
+ }
+ } // Base64Table
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs b/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs
new file mode 100644
index 00000000000..33be945b723
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/TripleDES.cs
@@ -0,0 +1,110 @@
+//
+// TripleDES.cs: Handles TripleDES (abstract class)
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 46-3: TripleDES
+// http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
+// b. ANSI X9.52
+// not free :-(
+// http://webstore.ansi.org/ansidocstore/product.asp?sku=ANSI+X9%2E52%2D1998
+
+public abstract class TripleDES : SymmetricAlgorithm {
+
+ public TripleDES ()
+ {
+ // from SymmetricAlgorithm
+ KeySizeValue = 192;
+ BlockSizeValue = 64;
+ FeedbackSizeValue = 64;
+
+ LegalKeySizesValue = new KeySizes [1];
+ LegalKeySizesValue [0] = new KeySizes (128, 192, 64);
+
+ LegalBlockSizesValue = new KeySizes [1];
+ LegalBlockSizesValue [0] = new KeySizes (64, 64, 0);
+ }
+
+ public override byte[] Key {
+ get {
+ if (KeyValue == null) {
+ // generate keys as long as we get weak keys
+ GenerateKey ();
+ while (IsWeakKey (KeyValue))
+ GenerateKey ();
+ }
+ return KeyValue;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ // this will check for both key size and weak keys
+ if (IsWeakKey (value))
+ throw new CryptographicException ();
+ KeyValue = (byte[]) value.Clone ();
+ }
+ }
+
+ // Triple DES is DES in EDE = Encrypt - Decrypt - Encrypt
+ // with 2 keys (a,b)
+ // EDE = Encrypt (a) - Decrypt (b) - Encrypt (a)
+ // if a == b then TripleDES == DES(a) (hence weak key)
+ // with 3 keys (a,b,c)
+ // EDE = Encrypt (a) - Decrypt (b) - Encrypt (c)
+ // if ( a == b ) then TripleDES == DES(c) (hence weak key)
+ // if ( b == c ) then TripleDES == DES(a) (hence weak key)
+ public static bool IsWeakKey (byte[] rgbKey)
+ {
+ // 128 bits (16 bytes) is 3 DES with 2 keys
+ if (rgbKey.Length == 16) {
+ // weak if first half == second half
+ for (int i = 0; i < 8; i++)
+ if (rgbKey [i] != rgbKey [i+8])
+ return false;
+ }
+ // 192 bits (24 bytes) is 3 DES with 3 keys
+ else if (rgbKey.Length == 24) {
+ bool bFirstCase = true;
+ // weak if first third == second third
+ for (int i = 0; i < 8; i++) {
+ if (rgbKey [i] != rgbKey [i+8]) {
+ bFirstCase = false;
+ break;
+ }
+ }
+ // weak if second third == third third
+ if (!bFirstCase) {
+ for (int i = 8; i < 16; i++)
+ if (rgbKey [i] != rgbKey [i+8])
+ return false;
+ }
+ }
+ else
+ throw new CryptographicException ();
+
+ return true;
+ }
+
+ public static new TripleDES Create ()
+ {
+ return Create ("System.Security.Cryptography.TripleDES");
+ }
+
+ public static new TripleDES Create (string str)
+ {
+ return (TripleDES) CryptoConfig.CreateFromName (str);
+ }
+}
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/TripleDESCryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/TripleDESCryptoServiceProvider.cs
new file mode 100644
index 00000000000..69ee3f063a0
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/TripleDESCryptoServiceProvider.cs
@@ -0,0 +1,107 @@
+//
+// TripleDESCryptoServiceProvider.cs: Default TripleDES implementation
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 46-3: TripleDES
+// http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
+// b. ANSI X9.52
+// not free :-(
+// http://webstore.ansi.org/ansidocstore/product.asp?sku=ANSI+X9%2E52%2D1998
+
+public sealed class TripleDESCryptoServiceProvider : TripleDES {
+
+ public TripleDESCryptoServiceProvider () {}
+
+ public override void GenerateIV ()
+ {
+ IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
+ }
+
+ public override void GenerateKey ()
+ {
+ KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
+ }
+
+ public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new TripleDESTransform (this, false, rgbKey, rgbIV);
+ }
+
+ public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
+ {
+ Key = rgbKey;
+ IV = rgbIV;
+ return new TripleDESTransform (this, true, rgbKey, rgbIV);
+ }
+}
+
+// TripleDES is just DES-EDE
+internal class TripleDESTransform : SymmetricTransform {
+
+ // for encryption
+ private DESTransform E1;
+ private DESTransform D2;
+ private DESTransform E3;
+
+ // for decryption
+ private DESTransform D1;
+ private DESTransform E2;
+ private DESTransform D3;
+
+ public TripleDESTransform (TripleDES algo, bool encryption, byte[] key, byte[] iv) : base (algo, encryption, iv)
+ {
+ byte[] key1 = new byte [8];
+ byte[] key2 = new byte [8];
+ byte[] key3 = new byte [8];
+ DES des = DES.Create ();
+ Array.Copy (key, 0, key1, 0, 8);
+ Array.Copy (key, 8, key2, 0, 8);
+ if (key.Length == 16)
+ Array.Copy (key, 0, key3, 0, 8);
+ else
+ Array.Copy (key, 16, key3, 0, 8);
+
+ // note: some modes (like CFB) requires encryption when decrypting
+ if ((encryption) || (algo.Mode == CipherMode.CFB)) {
+ E1 = new DESTransform (des, true, key1, iv);
+ D2 = new DESTransform (des, false, key2, iv);
+ E3 = new DESTransform (des, true, key3, iv);
+ }
+ else {
+ D1 = new DESTransform (des, false, key3, iv);
+ E2 = new DESTransform (des, true, key2, iv);
+ D3 = new DESTransform (des, false, key1, iv);
+ }
+ }
+
+ // note: this method is garanteed to be called with a valid blocksize
+ // for both input and output
+ protected override void ECB (byte[] input, byte[] output)
+ {
+ byte[] temp = new byte [input.Length];
+ if (encrypt) {
+ E1.ProcessBlock (input, output);
+ D2.ProcessBlock (output, temp);
+ E3.ProcessBlock (temp, output);
+ }
+ else {
+ D1.ProcessBlock (input, output);
+ E2.ProcessBlock (output, temp);
+ D3.ProcessBlock (temp, output);
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/bouncycastle.txt b/mcs/class/corlib/System.Security.Cryptography/bouncycastle.txt
new file mode 100644
index 00000000000..7b9ec828f72
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/bouncycastle.txt
@@ -0,0 +1,8 @@
+Some files included translated source code from Bouncy Castle JCE.
+
+Copyright (c) 2000 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/mcs/class/corlib/System.Security.Permissions/ChangeLog b/mcs/class/corlib/System.Security.Permissions/ChangeLog
new file mode 100644
index 00000000000..25e3e1e3198
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ChangeLog
@@ -0,0 +1,98 @@
+2002-12-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * StrongNamePublicKeyBlob.cs: New. Implemented.
+ * StrongNameIdentityPermission.cs. New. Stubbed (required
+ for StrongName class).
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * PublisherIdentityPermission.cs. New. Stubbed (required
+ for Publisher class).
+
+2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ZoneIdentityPermission.cs: New file. Implemented.
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * ReflectionPermission.cs:
+ * EnvironmentPermission.cs:
+ bad place for an override keyword :(
+
+2002-07-22 Tim Coleman <tim@timcoleman.com>
+ * ReflectionPermission.cs:
+ * EnvironmentPermission.cs:
+ Stubbs added because these are referenced
+ in System.Web.
+
+2002-07-13 Jonathan Pryor <jonpryor@vt.edu>
+ * ResourcePermissionBase.cs: Stubbed out
+ * ResourcePermissionBaseEntry.cs: Implemented.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * SiteIdentityPermissionAttribute.cs:
+ * UIPermissionAttribute.cs: These should inherit from
+ CodeAccessSecurityAttribute, not IsolatedStoragePermissionAttribute.
+
+2002-02-17 Duncan Mak <duncan@ximian.com>
+
+ * FileDialogPermissionAccess.cs: Add in namespace declaration, so
+ that this one little unique enum wouldn't show up in the System
+ namespace when we ildasm corlib.dll ;-) Oops, my bad.
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SecurityPermission.cs,
+ IsolatedStoragePermissionAttribute.cs: New files
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * FileDialogPermissionAccess.cs: Add to CVS.
+
+2002-01-20 Duncan Mak <duncan@ximian.com>
+
+ * *Attribute.cs: Implemented all the properties in the attributes
+ and removed the relevent MonoTODO attributes.
+
+ * *Attribute.cs: Fixed indentation.
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * EnvironmentPermissionAttribute.cs:
+ * FileDialogPermissionAttribute.cs:
+ * FileIOPermissionAttribute.cs:
+ * IsolatedStorageAttribute.cs:
+ * IsolatedStorageFilePermissionAttribute.cs:
+ * PermissionSetAttribute.cs:
+ * PrinciplePermissionAttribute.cs:
+ * ReflectionPermissionAttribute.cs:
+ * RegistryPermissionAttribute.cs:
+ * SiteIdentityPermissionAttribute.cs:
+ * StrongNamePermissionAttribute.cs:
+ * UIPermissionAttribute.cs:
+ * UrlIdentityPermissionAttribute.cs:
+ * ZoneIdentityPermissionAttribute.cs: New files. Stubbed out with MonoTODOs
+
+ * Note: These are all the Attributes in the
+ System.Security.Permissions namespace. The only missing one is
+ PublishIdentityPermissionAttribute.cs because we don't have
+ anything for the X509Certificate class.
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermission.cs: New file. Implemented.
+
+2002-01-08 Nick Drochak <ndrochak@gol.com>
+
+ * CodeAccessSecurityAttribute.cs, SecurityAttribute.cs,
+ SecurityPermissionAttribute.cs: New Files
+
+ * SecurityPermissionFlag.cs: Add missing enum values
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * IUnrestrictedPermission.cs: Added missing interface class
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * EnvironmentPermissionAccess.cs, FileIOPermissionAccess.cs, ReflectionPermissionFlag.cs: Add.
diff --git a/mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs b/mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs
new file mode 100644
index 00000000000..ced28962930
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.SecurityPermissionAttribute.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [System.AttributeUsage(
+ System.AttributeTargets.Assembly
+ | System.AttributeTargets.Class
+ | System.AttributeTargets.Struct
+ | System.AttributeTargets.Constructor
+ | System.AttributeTargets.Method,
+ AllowMultiple=true,
+ Inherited=false)
+ ]
+ [Serializable]
+ public abstract class CodeAccessSecurityAttribute : SecurityAttribute {
+
+ public CodeAccessSecurityAttribute(SecurityAction action) : base(action) {}
+
+ } // public abstract class CodeAccessSecurityAttribute
+} // namespace System.Security.Permissions
+
diff --git a/mcs/class/corlib/System.Security.Permissions/EnvironmentPermission.cs b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermission.cs
new file mode 100644
index 00000000000..bd1b15b5f3f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermission.cs
@@ -0,0 +1,103 @@
+//
+// System.Security.Permissions.EnvironmentPermission.cs
+//
+// Tim Coleman <tim@timcoleman.com>
+//
+// Copyright (C) 2002, Tim Coleman
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [Serializable]
+ public sealed class EnvironmentPermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ #region Fields
+
+ EnvironmentPermissionAccess flags;
+ PermissionState state;
+ string pathList;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public EnvironmentPermission (PermissionState state)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public EnvironmentPermission (EnvironmentPermissionAccess flag, string pathList)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void AddPathList (EnvironmentPermissionAccess flag, string pathList)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement esd)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetPathList (EnvironmentPermissionAccess flag)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsUnrestricted ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetPathList (EnvironmentPermissionAccess flag, string pathList)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission other)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs
new file mode 100644
index 00000000000..06517ebc7c6
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs
@@ -0,0 +1,38 @@
+// EnvironmentPermissionAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:29:59 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum EnvironmentPermissionAccess {
+
+ /// <summary>
+ /// </summary>
+ NoAccess = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ AllAccess = Read | Write,
+ } // EnvironmentPermissionAccess
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs
new file mode 100644
index 00000000000..3b16e90eb16
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs
@@ -0,0 +1,53 @@
+//
+// System.Security.Permissions.EnvironmentPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class EnvironmentPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string all;
+ private string read;
+ private string write;
+
+ // Constructor
+ public EnvironmentPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string All
+ {
+ set { all = value; }
+ }
+
+ public string Read
+ {
+ get { return read; }
+ set { read = value; }
+ }
+
+ public string Write
+ {
+ get { return write; }
+ set { write = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs
new file mode 100644
index 00000000000..d2196cba0b3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs
@@ -0,0 +1,21 @@
+//
+// System.Security.Permissions.FileDialogPermissionAccess
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Security.Permissions
+{
+ [Flags] [Serializable]
+ public enum FileDialogPermissionAccess
+ {
+ None = 0,
+ Open = 1,
+ Save = 2,
+ OpenSave = 3,
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs
new file mode 100644
index 00000000000..58ee4a5fe0a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs
@@ -0,0 +1,47 @@
+//
+// System.Security.Permissions.FileDialogPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class FileDialogPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private bool canOpen;
+ private bool canSave;
+
+ // Constructor
+ public FileDialogPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public bool Open
+ {
+ get { return canOpen; }
+ set { canOpen = value; }
+ }
+
+ public bool Save
+ {
+ get { return canSave; }
+ set { canSave = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
new file mode 100644
index 00000000000..57a7ede89bc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
@@ -0,0 +1,411 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.FileIOPermission.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-09
+//
+//------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Text;
+using System.Security.Permissions;
+using System.IO;
+
+namespace System.Security.Permissions {
+
+ [SerializableAttribute()]
+ public sealed class FileIOPermission : CodeAccessPermission, IUnrestrictedPermission {
+
+ private static char[] m_badCharacters = {'\"','<', '>', '|', '*', '?'};
+ private bool m_Unrestricted = false;
+ private Hashtable m_PathList = new Hashtable();
+ private FileIOPermissionAccess m_AllFilesAccess = FileIOPermissionAccess.NoAccess;
+ private FileIOPermissionAccess m_AllLocalFilesAccess = FileIOPermissionAccess.NoAccess;
+
+ public FileIOPermission(PermissionState state) {
+ if (!Enum.IsDefined(typeof(PermissionState), state)){
+ throw new ArgumentException("Invalid permission state.", "state");
+ }
+ m_Unrestricted = (PermissionState.Unrestricted == state);
+ if (m_Unrestricted) {
+ m_AllFilesAccess = FileIOPermissionAccess.AllAccess;
+ m_AllLocalFilesAccess = FileIOPermissionAccess.AllAccess;
+ }
+ }
+
+ public FileIOPermission(FileIOPermissionAccess access, string path){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Illegal characters found in input. Security checks can not contain wild card characters.", "path");
+ }
+
+ AddPathList(access, path);
+ }
+
+ public FileIOPermission(FileIOPermissionAccess access, string[] pathList){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+
+ AddPathList(access, pathList);
+ }
+
+ public FileIOPermissionAccess AllFiles {
+ get {
+ return m_AllFilesAccess;
+ }
+ set {
+ // if we are already set to unrestricted, don't change this property
+ if (!m_Unrestricted){
+ m_AllFilesAccess = value;
+ }
+ }
+ }
+
+ public FileIOPermissionAccess AllLocalFiles {
+ get {
+ return m_AllLocalFilesAccess;
+ }
+ set {
+ // if we are already set to unrestricted, don't change this property
+ if (!m_Unrestricted){
+ m_AllLocalFilesAccess = value;
+ }
+ }
+ }
+
+ public void AddPathList(FileIOPermissionAccess access, string path){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: {0}.",access.ToString());
+ }
+
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Invalid characters in path: '{0}'", path);
+ }
+
+ // LAMESPEC: docs don't say it must be a rooted path, but the MS implementation enforces it, so we will too.
+ if(!Path.IsPathRooted(path)) {
+ throw new ArgumentException("Absolute path information is required.");
+ }
+
+ // don't add the same path twice, instead overwrite access entry for that path
+ if (m_PathList.ContainsKey(path)) {
+ FileIOPermissionAccess currentPermission = (FileIOPermissionAccess)m_PathList[path];
+ currentPermission |= access;
+ m_PathList[path] = currentPermission;
+ }
+ else {
+ m_PathList.Add(path, access);
+ }
+ }
+
+ public void AddPathList(FileIOPermissionAccess access, string[] pathList ){
+ foreach(string path in pathList){
+ AddPathList(access, path);
+ }
+
+ }
+
+ // private constructor used by Copy() method
+ private FileIOPermission(Hashtable pathList, FileIOPermissionAccess allFiles,
+ FileIOPermissionAccess allLocalFiles, bool unrestricted){
+ m_PathList = pathList;
+ m_AllFilesAccess = allFiles;
+ m_AllLocalFilesAccess = allLocalFiles;
+ m_Unrestricted = unrestricted;
+ }
+
+ public override IPermission Copy(){
+ if (m_Unrestricted) {
+ return new FileIOPermission(PermissionState.Unrestricted);
+ }
+ else{
+ FileIOPermission retVal = new FileIOPermission(m_PathList, m_AllFilesAccess, m_AllLocalFilesAccess, m_Unrestricted);
+ return retVal;
+ }
+ }
+
+ /* XML Schema for FileIOPermission
+ <IPermission class=”FileIOPermission”
+ version=”1”
+ (
+ Read=”[list of files or folders]” |
+ Write=”[list of files or folders]” |
+ Append=”[list of files or folders]”
+ ) v Unrestricted=”true”
+ />
+ */
+ public override void FromXml(SecurityElement esd){
+ if (null == esd) {
+ throw new ArgumentNullException();
+ }
+ if (esd.Tag != "IPermission" || (string)esd.Attributes["class"] != "FileIOPermission"
+ || (string)esd.Attributes["version"] != "1"){
+ throw new ArgumentException("Not a valid permission element");
+ }
+ m_PathList.Clear();
+ if ("true" == (string)esd.Attributes["Unrestricted"]){
+ m_Unrestricted = true;
+ }
+ else{
+ m_Unrestricted = false;
+ string fileList;
+ fileList = (string)esd.Attributes["Read"];
+ string[] files;
+ if (fileList != null){
+ files = fileList.Split(';');
+ AddPathList(FileIOPermissionAccess.Read, files);
+ }
+ fileList = (string)esd.Attributes["Write"];
+ if (fileList != null){
+ files = fileList.Split(';');
+ AddPathList(FileIOPermissionAccess.Write, files);
+ }
+ fileList = (string)esd.Attributes["Append"];
+ if (fileList != null){
+ files = fileList.Split(';');
+ AddPathList(FileIOPermissionAccess.Append, files);
+ }
+ }
+ }
+
+ public string[] GetPathList(FileIOPermissionAccess access){
+ //LAMESPEC: docs says it returns (semicolon separated) list, but return
+ //type is array. I think docs are wrong and it just returns an array
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+
+ ArrayList matchingPaths = new ArrayList();
+ System.Collections.IDictionaryEnumerator pathListIterator = m_PathList.GetEnumerator();
+ while (pathListIterator.MoveNext()) {
+ if (((FileIOPermissionAccess)pathListIterator.Value & access) != 0) {
+ matchingPaths.Add((string)pathListIterator.Key);
+ }
+ }
+ if (matchingPaths.Count == 0) {
+ return null;
+ }
+ else {
+ return (string[])matchingPaths.ToArray(typeof(string));
+ }
+ }
+
+ public override IPermission Intersect(IPermission target){
+ if (null == target){
+ return null;
+ }
+ else {
+ if (target.GetType() != typeof(FileIOPermission)){
+ throw new ArgumentException();
+ }
+ }
+ FileIOPermission FIOPTarget = (FileIOPermission)target;
+ if (FIOPTarget.IsUnrestricted() && m_Unrestricted){
+ return new FileIOPermission(PermissionState.Unrestricted);
+ }
+ else if (FIOPTarget.IsUnrestricted()){
+ return Copy();
+ }
+ else if (m_Unrestricted){
+ return FIOPTarget.Copy();
+ }
+ else{
+ FileIOPermission retVal = new FileIOPermission(PermissionState.None);
+ retVal.AllFiles = m_AllFilesAccess & FIOPTarget.AllFiles;
+ retVal.AllLocalFiles = m_AllLocalFilesAccess & FIOPTarget.AllLocalFiles;
+
+ string[] paths;
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Append);
+ if (null != paths) {
+ foreach (string path in paths){
+ if (m_PathList.ContainsKey(path)
+ && ((FileIOPermissionAccess)m_PathList[path] & FileIOPermissionAccess.Append) != 0){
+ retVal.AddPathList(FileIOPermissionAccess.Append, path);
+ }
+ }
+ }
+
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Read);
+ if (null != paths) {
+ foreach (string path in paths){
+ if (m_PathList.ContainsKey(path)
+ && ((FileIOPermissionAccess)m_PathList[path] & FileIOPermissionAccess.Read) != 0){
+ retVal.AddPathList(FileIOPermissionAccess.Read, path);
+ }
+ }
+ }
+
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Write);
+ if (null != paths) {
+ foreach (string path in paths){
+ if (m_PathList.ContainsKey(path)
+ && ((FileIOPermissionAccess)m_PathList[path] & FileIOPermissionAccess.Write) != 0){
+ retVal.AddPathList(FileIOPermissionAccess.Write, path);
+ }
+ }
+ }
+
+ return retVal;
+ }
+ }
+
+
+ public override bool IsSubsetOf(IPermission target){
+ // X.IsSubsetOf(Y) is true if permission Y includes everything allowed by X.
+ if (target != null && target.GetType() != typeof(FileIOPermission)){
+ throw new ArgumentException();
+ }
+ FileIOPermission FIOPTarget = (FileIOPermission)target;
+ if (FIOPTarget.IsUnrestricted()){
+ return true;
+ }
+ else if (m_Unrestricted){
+ return false;
+ }
+ else if ((m_AllFilesAccess & FIOPTarget.AllFiles) != m_AllFilesAccess) {
+ return false;
+ }
+ else if ((m_AllLocalFilesAccess & FIOPTarget.AllLocalFiles) != m_AllLocalFilesAccess) {
+ return false;
+ }
+ else{
+ string[] pathsNeeded;
+ string[] pathsInTarget;
+
+ pathsNeeded = GetPathList(FileIOPermissionAccess.Append);
+ if (null != pathsNeeded) {
+ pathsInTarget = FIOPTarget.GetPathList(FileIOPermissionAccess.Append);
+ foreach (string path in pathsNeeded){
+ if (Array.IndexOf(pathsInTarget, path) <0) {
+ return false;
+ }
+ }
+ }
+
+ pathsNeeded = GetPathList(FileIOPermissionAccess.Read);
+ if (null != pathsNeeded) {
+ pathsInTarget = FIOPTarget.GetPathList(FileIOPermissionAccess.Read);
+ foreach (string path in pathsNeeded){
+ if (Array.IndexOf(pathsInTarget, path) <0) {
+ return false;
+ }
+ }
+ }
+
+ pathsNeeded = GetPathList(FileIOPermissionAccess.Write);
+ if (null != pathsNeeded) {
+ pathsInTarget = FIOPTarget.GetPathList(FileIOPermissionAccess.Write);
+ foreach (string path in pathsNeeded){
+ if (Array.IndexOf(pathsInTarget, path) <0) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
+ public bool IsUnrestricted(){
+ return m_Unrestricted;
+ }
+
+ public void SetPathList(FileIOPermissionAccess access, string path){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Invalid characters in path: '{0}'", path);
+ }
+
+ m_PathList.Clear();
+ AddPathList(access, path);
+ }
+
+ public void SetPathList(FileIOPermissionAccess access, string[] pathList){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+ foreach(string path in pathList){
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Invalid characters in path entry: '{0}'", path);
+ }
+ }
+
+ m_PathList.Clear();
+ AddPathList(access, pathList);
+ }
+
+ public override SecurityElement ToXml(){
+ //Encode the the current permission to XML using the
+ //security element class.
+ SecurityElement element = new SecurityElement("IPermission");
+ Type type = this.GetType();
+ StringBuilder AsmName = new StringBuilder(type.Assembly.ToString());
+ AsmName.Replace('\"', '\'');
+ element.AddAttribute("class", type.FullName + ", " + AsmName);
+ element.AddAttribute("version", "1");
+ if(m_Unrestricted){
+ element.AddAttribute("Unrestricted", "true");
+ }
+ else {
+ string[] paths;
+ paths = GetPathList(FileIOPermissionAccess.Append);
+ if (null != paths && paths.Length >0){
+ element.AddAttribute("Append", String.Join(";",paths));
+ }
+ paths = GetPathList(FileIOPermissionAccess.Read);
+ if (null != paths && paths.Length >0){
+ element.AddAttribute("Read", String.Join(";",paths));
+ }
+ paths = GetPathList(FileIOPermissionAccess.Write);
+ if (null != paths && paths.Length >0){
+ element.AddAttribute("Write", String.Join(";",paths));
+ }
+ }
+ return element;
+ }
+
+ public override IPermission Union(IPermission other){
+ if (null == other){
+ return null;
+ }
+ else {
+ if (other.GetType() != typeof(FileIOPermission)){
+ throw new ArgumentException();
+ }
+ }
+ FileIOPermission FIOPTarget = (FileIOPermission)other;
+ if (FIOPTarget.IsUnrestricted() || m_Unrestricted){
+ return new FileIOPermission(PermissionState.Unrestricted);
+ }
+ else{
+ FileIOPermission retVal = (FileIOPermission)Copy();
+ retVal.AllFiles |= FIOPTarget.AllFiles;
+ retVal.AllLocalFiles |= FIOPTarget.AllLocalFiles;
+ string[] paths;
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Append);
+ if (null != paths){
+ retVal.AddPathList(FileIOPermissionAccess.Append, paths);
+ }
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Read);
+ if (null != paths){
+ retVal.AddPathList(FileIOPermissionAccess.Read, paths);
+ }
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Write);
+ if (null != paths){
+ retVal.AddPathList(FileIOPermissionAccess.Write, paths);
+ }
+ return retVal;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs
new file mode 100644
index 00000000000..dd255cd3b1c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs
@@ -0,0 +1,46 @@
+// FileIOPermissionAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:11 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileIOPermissionAccess {
+
+ /// <summary>
+ /// </summary>
+ NoAccess = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Append = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ PathDiscovery = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ AllAccess = Read | Write | Append | PathDiscovery,
+ } // FileIOPermissionAccess
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs
new file mode 100644
index 00000000000..64540caf30a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs
@@ -0,0 +1,68 @@
+//
+// System.Security.Permissions.FileIOPermissionAttribute.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class FileIOPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string all;
+ private string append;
+ private string path;
+ private string read;
+ private string write;
+
+ // Constructor
+ public FileIOPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string All
+ {
+ set { all = value; }
+ }
+
+ public string Append
+ {
+ get { return append; }
+ set { append = value; }
+ }
+
+ public string PathDiscovery
+ {
+ get { return path; }
+ set { path = value; }
+ }
+
+ public string Read
+ {
+ get { return read; }
+ set { read = value; }
+ }
+
+ public string Write
+ {
+ get { return write; }
+ set { write = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs b/mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs
new file mode 100644
index 00000000000..f9b6b9eae0e
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs
@@ -0,0 +1,15 @@
+//
+// System.Security.Permissions.IUnrestrictedPermission.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security.Permissions {
+
+ public interface IUnrestrictedPermission {
+ bool IsUnrestricted();
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs
new file mode 100755
index 00000000000..391e3e7dc7b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs
@@ -0,0 +1,27 @@
+// IsolatedStorageContainment.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:57 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+ [Serializable]
+ public enum IsolatedStorageContainment
+ {
+ None = 0x00,
+ DomainIsolationByUser = 0x10,
+ AssemblyIsolationByUser = 0x20,
+ DomainIsolationByRoamingUser = 0x50,
+ AssemblyIsolationByRoamingUser = 0x60,
+ AdministerIsolatedStorageByUser = 0x70,
+ UnrestrictedIsolatedStorage = 0xF0,
+ };
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs
new file mode 100644
index 00000000000..a9a879f06fc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.Security.Permissions.IsolatedStorageFilePermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class IsolatedStorageFilePermissionAttribute : IsolatedStoragePermissionAttribute
+ {
+ // Constructor
+ public IsolatedStorageFilePermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs
new file mode 100644
index 00000000000..907d7de3615
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs
@@ -0,0 +1,84 @@
+//
+// System.Security.Permissions.IsolatedStoragePermission.cs
+//
+// Piers Haken <piersh@friskit.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [Serializable]
+ public abstract class IsolatedStoragePermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ internal long m_userQuota;
+ internal long m_machineQuota;
+ internal long m_expirationDays;
+ internal bool m_permanentData;
+ internal IsolatedStorageContainment m_allowed;
+
+ public IsolatedStoragePermission (PermissionState state)
+ {
+ if (state == PermissionState.None)
+ {
+ m_userQuota = 0;
+ m_machineQuota = 0;
+ m_expirationDays = 0;
+ m_permanentData = false;
+ m_allowed = IsolatedStorageContainment.None;
+ }
+ else if (state == PermissionState.Unrestricted)
+ {
+ m_userQuota = Int64.MaxValue;
+ m_machineQuota = Int64.MaxValue;
+ m_expirationDays = Int64.MaxValue ;
+ m_permanentData = true;
+ m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
+ }
+ else
+ {
+ throw new ArgumentException("Invalid Permission state");
+ }
+ }
+
+ public long UserQuota
+ {
+ set { m_userQuota = value; }
+ get { return m_userQuota; }
+ }
+
+
+ public IsolatedStorageContainment UsageAllowed
+ {
+ set { m_allowed = value; }
+ get { return m_allowed; }
+ }
+
+
+ public bool IsUnrestricted ()
+ {
+ return IsolatedStorageContainment.UnrestrictedIsolatedStorage == m_allowed;
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement esd)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
+
+
+
+
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs
new file mode 100644
index 00000000000..21563b6b516
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.Security.Permissions.IsolatedStoragePermissionAttributes.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+
+ [AttributeUsage ( AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public abstract class IsolatedStoragePermissionAttribute : CodeAccessSecurityAttribute {
+
+ public IsolatedStoragePermissionAttribute (SecurityAction action) : base (action) {
+ }
+
+ public IsolatedStorageContainment UsageAllowed {
+ get { return usage_allowed; }
+ set { usage_allowed = value; }
+ }
+
+ public long UserQuota {
+ get { return user_quota; }
+ set { user_quota = value; }
+ }
+
+ [MonoTODO]
+ public override IPermission CreatePermission () {
+ return null;
+ }
+
+ // private
+
+ private IsolatedStorageContainment usage_allowed;
+ private long user_quota;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs b/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
new file mode 100644
index 00000000000..ee654f7e00b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
@@ -0,0 +1,69 @@
+//
+// System.Security.Permissions.PermissionSetAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class PermissionSetAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string file;
+ private string name;
+ private bool isUnicodeEncoded;
+ private string xml;
+
+ // Constructor
+ public PermissionSetAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Properties
+ public string File
+ {
+ get { return file; }
+ set { file = value; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public bool UnicodeEncoded
+ {
+ get { return isUnicodeEncoded; }
+ set { isUnicodeEncoded = value; }
+ }
+
+ public string XML
+ {
+ get { return xml; }
+ set { xml = value; }
+ }
+
+ // Methods
+ public override IPermission CreatePermission ()
+ {
+ return null; // Not used, used for inheritance from SecurityAttribute
+ }
+
+ [MonoTODO]
+ public PermissionSet CreatePermissionSet ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/PermissionState.cs b/mcs/class/corlib/System.Security.Permissions/PermissionState.cs
new file mode 100755
index 00000000000..66c3d03eb6f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PermissionState.cs
@@ -0,0 +1,29 @@
+// PermissionState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:05 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum PermissionState {
+
+ /// <summary>
+ /// </summary>
+ Unrestricted = 1,
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+ } // PermissionState
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs
new file mode 100644
index 00000000000..fee707d002d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs
@@ -0,0 +1,60 @@
+//
+// System.Security.Permissions.PrincipalPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class PrincipalPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private bool authenticated;
+ private string name;
+ private string role;
+
+ // Constructor
+ public PrincipalPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Properties
+ [MonoTODO]
+ public bool Authenticated
+ {
+ get { return authenticated; }
+ set { authenticated = value; }
+ }
+
+ [MonoTODO]
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [MonoTODO]
+ public string Role
+ {
+ get { return role; }
+ set { role = value; }
+ }
+
+ // Method
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/PublisherIdentityPermission.cs b/mcs/class/corlib/System.Security.Permissions/PublisherIdentityPermission.cs
new file mode 100644
index 00000000000..b3e914eaea8
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PublisherIdentityPermission.cs
@@ -0,0 +1,72 @@
+//
+// PublisherIdentityPermission.cs: Publisher Identity Permission
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Security.Permissions {
+
+public sealed class PublisherIdentityPermission : CodeAccessPermission {
+
+ private X509Certificate x509;
+
+ public PublisherIdentityPermission (PermissionState state)
+ {
+ if (state == PermissionState.Unrestricted)
+ throw new ArgumentException ("state");
+ }
+
+ public PublisherIdentityPermission (X509Certificate certificate)
+ {
+ x509 = certificate;
+ }
+
+ public X509Certificate Certificate {
+ get { return x509; }
+ set { x509 = value; }
+ }
+
+ [MonoTODO]
+ public override IPermission Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement esd)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ReflectionPermission.cs b/mcs/class/corlib/System.Security.Permissions/ReflectionPermission.cs
new file mode 100644
index 00000000000..74d74c5102d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ReflectionPermission.cs
@@ -0,0 +1,94 @@
+//
+// System.Security.Permissions.ReflectionPermission.cs
+//
+// Tim Coleman <tim@timcoleman.com>
+//
+// Copyright (C) 2002, Tim Coleman
+//
+
+using System;
+
+namespace System.Security.Permissions
+{
+ [Serializable]
+ public sealed class ReflectionPermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ #region Fields
+
+ ReflectionPermissionFlag flags;
+ PermissionState state;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ReflectionPermission (PermissionState state)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ReflectionPermission (ReflectionPermissionFlag flag)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public ReflectionPermissionFlag Flags {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override IPermission Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement esd)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsUnrestricted ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission other)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs
new file mode 100644
index 00000000000..b7a94b4c29d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs
@@ -0,0 +1,61 @@
+//
+// System.Security.Permissions.ReflectionPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class ReflectionPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private ReflectionPermissionFlag flags;
+ private bool memberAccess;
+ private bool reflectionEmit;
+ private bool typeInfo;
+
+ //Constructor
+ public ReflectionPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public ReflectionPermissionFlag Flags
+ {
+ get { return flags; }
+ set { flags = value; }
+ }
+
+ public bool MemberAccess
+ {
+ get { return memberAccess; }
+ set { memberAccess = value; }
+ }
+
+ public bool ReflectionEmit
+ {
+ get { return reflectionEmit; }
+ set { reflectionEmit = value; }
+ }
+
+ public bool TypeInformation
+ {
+ get { return typeInfo; }
+ set { typeInfo = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs
new file mode 100644
index 00000000000..21d29d46254
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs
@@ -0,0 +1,42 @@
+// ReflectionPermissionFlag.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:14 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ReflectionPermissionFlag {
+
+ /// <summary>
+ /// </summary>
+ NoFlags = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ TypeInformation = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ MemberAccess = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ ReflectionEmit = 0x4,
+
+ /// <summary>
+ /// </summary>
+ AllFlags = TypeInformation | MemberAccess | ReflectionEmit,
+ } // ReflectionPermissionFlag
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs
new file mode 100755
index 00000000000..f45f481390a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs
@@ -0,0 +1,42 @@
+// RegistryPermissionAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:13 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum RegistryPermissionAccess {
+
+ /// <summary>
+ /// </summary>
+ NoAccess = 0,
+
+ /// <summary>
+ /// </summary>
+ Read = 1,
+
+ /// <summary>
+ /// </summary>
+ Write = 2,
+
+ /// <summary>
+ /// </summary>
+ Create = 4,
+
+ /// <summary>
+ /// </summary>
+ AllAccess = 7,
+ } // RegistryPermissionAccess
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs
new file mode 100644
index 00000000000..3ab3eeb160d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs
@@ -0,0 +1,60 @@
+//
+// System.Security.Permissions.RegistryPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class RegistryPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string all;
+ private string create;
+ private string read;
+ private string write;
+
+ // Constructor
+ public RegistryPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string All
+ {
+ set { all = value; }
+ }
+
+ public string Create
+ {
+ get { return create; }
+ set { create = value; }
+ }
+
+ public string Read
+ {
+ get { return read; }
+ set { read = value; }
+ }
+
+ public string Write
+ {
+ get { return write; }
+ set { write = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityAction.cs b/mcs/class/corlib/System.Security.Permissions/SecurityAction.cs
new file mode 100755
index 00000000000..7cd81e1c500
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityAction.cs
@@ -0,0 +1,57 @@
+// SecurityAction.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:29:52 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SecurityAction {
+
+ /// <summary>
+ /// </summary>
+ Demand = 2,
+
+ /// <summary>
+ /// </summary>
+ Assert = 3,
+
+ /// <summary>
+ /// </summary>
+ Deny = 4,
+
+ /// <summary>
+ /// </summary>
+ PermitOnly = 5,
+
+ /// <summary>
+ /// </summary>
+ LinkDemand = 6,
+
+ /// <summary>
+ /// </summary>
+ InheritanceDemand = 7,
+
+ /// <summary>
+ /// </summary>
+ RequestMinimum = 8,
+
+ /// <summary>
+ /// </summary>
+ RequestOptional = 9,
+
+ /// <summary>
+ /// </summary>
+ RequestRefuse = 10,
+ } // SecurityAction
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs b/mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs
new file mode 100644
index 00000000000..d914835f140
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs
@@ -0,0 +1,59 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.SecurityPermissionAttribute.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+ [System.AttributeUsage(
+ System.AttributeTargets.Assembly
+ | System.AttributeTargets.Class
+ | System.AttributeTargets.Struct
+ | System.AttributeTargets.Constructor
+ | System.AttributeTargets.Method,
+ AllowMultiple=true,
+ Inherited=false)
+ ]
+
+ [Serializable]
+ public abstract class SecurityAttribute : Attribute {
+
+ private SecurityAction m_Action;
+ private bool m_Unrestricted;
+
+ public SecurityAttribute(SecurityAction action) {
+ if (!SecurityAction.IsDefined(typeof(SecurityAction), action)) {
+ throw new System.ArgumentException();
+ }
+ }
+
+ public abstract IPermission CreatePermission();
+
+ public bool Unrestricted {
+ get {
+ return m_Unrestricted;
+ }
+ set {
+ m_Unrestricted = value;
+ }
+ }
+
+ public SecurityAction Action {
+ get {
+ return m_Action;
+ }
+ set {
+ m_Action = value;
+ }
+ }
+ } // public abstract class SecurityAttribute
+} // namespace System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs b/mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs
new file mode 100644
index 00000000000..9a6a32ab25f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs
@@ -0,0 +1,66 @@
+//
+// System.Security.Permissions.SecurityPermission.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class SecurityPermission :
+ CodeAccessPermission, IUnrestrictedPermission
+ {
+ public SecurityPermission (PermissionState state) {
+ this.flags = SecurityPermissionFlag.NoFlags;
+ }
+
+ public SecurityPermission (SecurityPermissionFlag flags) {
+ this.flags = flags;
+ }
+
+ public SecurityPermissionFlag Flags {
+ get { return flags; }
+ set { flags = value; }
+ }
+
+ public bool IsUnrestricted () {
+ return false;
+ }
+
+ public override IPermission Copy () {
+ return null;
+ }
+
+ public override IPermission Intersect (IPermission target) {
+ return null;
+ }
+
+ public override IPermission Union (IPermission target) {
+ return null;
+ }
+
+ public override bool IsSubsetOf (IPermission target) {
+ return false;
+ }
+
+ public override void FromXml (SecurityElement e) {
+ }
+
+ public override SecurityElement ToXml () {
+ return null;
+ }
+
+ // private
+
+ private SecurityPermissionFlag flags;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs
new file mode 100644
index 00000000000..868b199f267
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs
@@ -0,0 +1,216 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.SecurityPermissionAttribute.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+ [System.AttributeUsage(
+ System.AttributeTargets.Assembly
+ | System.AttributeTargets.Class
+ | System.AttributeTargets.Struct
+ | System.AttributeTargets.Constructor
+ | System.AttributeTargets.Method,
+ AllowMultiple=true,
+ Inherited=false)
+ ]
+ public sealed class SecurityPermissionAttribute : CodeAccessSecurityAttribute {
+ private SecurityPermissionFlag m_Flags = SecurityPermissionFlag.NoFlags;
+
+ public SecurityPermissionAttribute(SecurityAction action) : base(action) {
+ if (!SecurityAction.IsDefined(typeof(SecurityAction), action)) {
+ throw new System.ArgumentException();
+ }
+ }
+
+ public bool Assertion {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.Assertion) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.Assertion;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.Assertion;
+ }
+ }
+ }
+
+ public bool ControlAppDomain {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlAppDomain) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlAppDomain;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlAppDomain;
+ }
+ }
+ }
+
+ public bool ControlDomainPolicy {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlDomainPolicy) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlDomainPolicy;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlDomainPolicy;
+ }
+ }
+ }
+
+ public bool ControlEvidence {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlEvidence) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlEvidence;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlEvidence;
+ }
+ }
+ }
+
+ public bool ControlPolicy {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlPolicy) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlPolicy;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlPolicy;
+ }
+ }
+ }
+
+ public bool ControlPrincipal {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlPrincipal) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlPrincipal;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlPrincipal;
+ }
+ }
+ }
+
+ public bool ControlThread {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlThread) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlThread;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlThread;
+ }
+ }
+ }
+
+ public bool Execution {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.Execution) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.Execution;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.Execution;
+ }
+ }
+ }
+
+ public bool Infrastructure {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.Infrastructure) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.Infrastructure;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.Infrastructure;
+ }
+ }
+ }
+
+ public bool RemotingConfiguration {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.RemotingConfiguration) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.RemotingConfiguration;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.RemotingConfiguration;
+ }
+ }
+ }
+
+ public bool SerializationFormatter {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.SerializationFormatter) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.SerializationFormatter;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.SerializationFormatter;
+ }
+ }
+ }
+
+ public bool SkipVerification {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.SkipVerification) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.SkipVerification;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.SkipVerification;
+ }
+ }
+ }
+
+ public override IPermission CreatePermission() {
+ return new SecurityPermission(m_Flags);
+ }
+
+ public SecurityPermissionFlag Flags {
+ get {
+ return m_Flags;
+ }
+ set {
+ m_Flags = value;
+ }
+ }
+ } // public sealed class SecurityPermissionAttribute
+} // namespace System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs
new file mode 100755
index 00000000000..dbd51caecfe
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs
@@ -0,0 +1,68 @@
+// SecurityPermissionFlag.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:18 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SecurityPermissionFlag {
+
+ /// <summary>
+ /// </summary>
+ NoFlags = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Assertion = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ UnmanagedCode = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ SkipVerification = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Execution = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ ControlThread = 0x00000010,
+
+ ControlEvidence = 0x00000020,
+
+ ControlPolicy = 0x00000040,
+
+ SerializationFormatter = 0x00000080,
+
+ ControlDomainPolicy = 0x00000100,
+
+ ControlPrincipal = 0x00000200,
+
+ ControlAppDomain = 0x00000400,
+
+ RemotingConfiguration = 0x00000800,
+
+ Infrastructure = 0x00001000,
+
+ /// <summary>
+ /// </summary>
+ AllFlags = Assertion | UnmanagedCode | SkipVerification | Execution | ControlThread
+ | ControlAppDomain | ControlDomainPolicy | ControlEvidence | ControlPolicy
+ | ControlPrincipal | Infrastructure | RemotingConfiguration | SerializationFormatter,
+ } // SecurityPermissionFlag
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..d5bbbe06e42
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs
@@ -0,0 +1,43 @@
+//
+// System.Security.Permissions.SiteIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SiteIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string site;
+
+ // Constructor
+ public SiteIdentityPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Properties
+ public string Site
+ {
+ get { return site; }
+ set { site = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/StrongNameIdentityPermission.cs b/mcs/class/corlib/System.Security.Permissions/StrongNameIdentityPermission.cs
new file mode 100644
index 00000000000..9df8842f1ea
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/StrongNameIdentityPermission.cs
@@ -0,0 +1,101 @@
+//
+// StrongNameIdentityPermission.cs: Strong Name Identity Permission
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+
+namespace System.Security.Permissions {
+
+public sealed class StrongNameIdentityPermission : CodeAccessPermission {
+
+ private StrongNamePublicKeyBlob publickey;
+ private string name;
+ private Version version;
+
+ public StrongNameIdentityPermission (PermissionState state)
+ {
+ if (state == PermissionState.Unrestricted)
+ throw new ArgumentException ("state");
+ }
+
+ public StrongNameIdentityPermission (StrongNamePublicKeyBlob blob, string name, Version version)
+ {
+ if (blob == null)
+ throw new ArgumentNullException ("blob");
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (version == null)
+ throw new ArgumentNullException ("version");
+
+ publickey = blob;
+ this.name = name;
+ this.version = version;
+ }
+
+ ~StrongNameIdentityPermission ()
+ {
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public StrongNamePublicKeyBlob PublicKey {
+ get { return publickey; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ publickey = value;
+ }
+ }
+
+ public Version Version {
+ get { return version; }
+ set { version = value; }
+ }
+
+ public override IPermission Copy ()
+ {
+ return new StrongNameIdentityPermission (publickey, name, version);
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement e)
+ {
+ if (e == null)
+ throw new ArgumentNullException ("e");
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target)
+ {
+ throw new NotImplementedException ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs
new file mode 100644
index 00000000000..6fa4d197bf9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs
@@ -0,0 +1,56 @@
+//
+// System.Security.Permissions.StrongNameIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class StrongNameIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string name;
+ private string key;
+ private string version;
+
+ // Constructor
+ public StrongNameIdentityPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string PublicKey
+ {
+ get { return key; }
+ set { key = value; }
+ }
+
+ public string Version
+ {
+ get { return version; }
+ set { version = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/StrongNamePublicKeyBlob.cs b/mcs/class/corlib/System.Security.Permissions/StrongNamePublicKeyBlob.cs
new file mode 100644
index 00000000000..53782084aab
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/StrongNamePublicKeyBlob.cs
@@ -0,0 +1,67 @@
+//
+// StrongNamePublicKeyBlob.cs: Strong Name Public Key Blob
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Text;
+
+namespace System.Security.Permissions {
+
+[Serializable]
+public sealed class StrongNamePublicKeyBlob {
+
+ internal byte[] pubkey;
+
+ public StrongNamePublicKeyBlob (byte[] publicKey)
+ {
+ if (publicKey == null)
+ throw new ArgumentNullException ("publicKey");
+ // Note: No sanity check ?
+ pubkey = publicKey;
+ }
+
+ public override bool Equals (object obj)
+ {
+ bool result = (obj is StrongNamePublicKeyBlob);
+ if (result) {
+ StrongNamePublicKeyBlob snpkb = (obj as StrongNamePublicKeyBlob);
+ result = (pubkey.Length == snpkb.pubkey.Length);
+ if (result) {
+ for (int i = 0; i < pubkey.Length; i++) {
+ if (pubkey[i] != snpkb.pubkey[i])
+ return false;
+ }
+ }
+ }
+ return result;
+ }
+
+ // LAMESPEC: non standard get hash code - (a) Why ??? (b) How ???
+ // It seems to be the first four bytes of the public key data
+ // which seems like non sense as all valid public key will have the same header ?
+ public override int GetHashCode ()
+ {
+ int hash = 0;
+ int i = 0;
+ // a BAD public key can be less than 4 bytes
+ int n = Math.Min (pubkey.Length, 4);
+ while (i < n)
+ hash = (hash << 8) + pubkey [i++];
+ return hash;
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ for (int i=0; i < pubkey.Length; i++)
+ sb.Append (pubkey[i].ToString ("X2"));
+ return sb.ToString ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs
new file mode 100644
index 00000000000..6b998eea3b5
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.Security.Permissions.UIPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class UIPermissionAttribute : CodeAccessSecurityAttribute
+ {
+
+ // Fields
+ private UIPermissionClipboard clipboard;
+ private UIPermissionWindow window;
+
+ // Constructor
+ public UIPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public UIPermissionClipboard Clipboard
+ {
+ get { return clipboard; }
+ set { clipboard = value; }
+ }
+
+ public UIPermissionWindow Window
+ {
+ get { return window; }
+ set { window = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs b/mcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs
new file mode 100755
index 00000000000..6ae9a795dc0
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs
@@ -0,0 +1,33 @@
+// UIPermissionClipboard.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:40 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UIPermissionClipboard {
+
+ /// <summary>
+ /// </summary>
+ NoClipboard = 0,
+
+ /// <summary>
+ /// </summary>
+ OwnClipboard = 1,
+
+ /// <summary>
+ /// </summary>
+ AllClipboard = 2,
+ } // UIPermissionClipboard
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs b/mcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs
new file mode 100755
index 00000000000..4d65080e744
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs
@@ -0,0 +1,37 @@
+// UIPermissionWindow.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:30 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UIPermissionWindow {
+
+ /// <summary>
+ /// </summary>
+ NoWindows = 0,
+
+ /// <summary>
+ /// </summary>
+ SafeSubWindows = 1,
+
+ /// <summary>
+ /// </summary>
+ SafeTopLevelWindows = 2,
+
+ /// <summary>
+ /// </summary>
+ AllWindows = 3,
+ } // UIPermissionWindow
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..29f4006cdc3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.Security.Permissions.UrlIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class UrlIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string url;
+
+ // Constructor
+ public UrlIdentityPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string Url
+ {
+ get { return url; }
+ set { url = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermission.cs b/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermission.cs
new file mode 100644
index 00000000000..d92409f1fee
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermission.cs
@@ -0,0 +1,119 @@
+//
+// System.Security.Permissions.ZoneIdentityPermission
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Security;
+
+namespace System.Security.Permissions
+{
+ public sealed class ZoneIdentityPermission : CodeAccessPermission
+ {
+ SecurityZone zone;
+
+ public ZoneIdentityPermission (PermissionState state)
+ {
+ if (state == PermissionState.Unrestricted)
+ throw new ArgumentException ("unrestricted not allowed");
+
+ if (state != PermissionState.None)
+ throw new ArgumentException ("invalid state");
+
+ zone = SecurityZone.NoZone;
+ }
+
+ public ZoneIdentityPermission (SecurityZone zone)
+ {
+ this.zone = zone;
+ }
+
+ public override IPermission Copy ()
+ {
+ return new ZoneIdentityPermission (zone);
+ }
+
+ public override bool IsSubsetOf (IPermission target)
+ {
+ if (target == null)
+ return zone == SecurityZone.NoZone;
+
+ if (!(target is ZoneIdentityPermission))
+ throw new ArgumentException ();
+
+ return zone != ((ZoneIdentityPermission) target).zone;
+ }
+
+ public override IPermission Union (IPermission target)
+ {
+ if (target == null)
+ return (zone == SecurityZone.NoZone) ? null : Copy ();
+
+ if (!(target is ZoneIdentityPermission))
+ throw new ArgumentException ();
+
+ ZoneIdentityPermission se = (ZoneIdentityPermission) target;
+ if (zone == se.zone || se.zone == SecurityZone.NoZone)
+ return Copy ();
+
+ if (zone == SecurityZone.NoZone)
+ return se.Copy ();
+
+ return null;
+ }
+
+ public override IPermission Intersect (IPermission target)
+ {
+ if (target == null || zone == SecurityZone.NoZone)
+ return null;
+
+ if (!(target is ZoneIdentityPermission))
+ throw new ArgumentException ();
+
+ if (zone == ((ZoneIdentityPermission) target).zone)
+ return Copy ();
+
+ return null;
+ }
+
+ public override void FromXml (SecurityElement esd)
+ {
+ if (esd == null)
+ throw new ArgumentException ("esd is null");
+
+ if (esd.Attribute ("version") != "1")
+ throw new ArgumentException ("version attributte is wrong");
+
+ string zoneName = esd.Attribute ("Zone");
+ zone = (SecurityZone) Enum.Parse (typeof (SecurityZone), zoneName);
+ }
+
+ public override SecurityElement ToXml ()
+ {
+ SecurityElement se = new SecurityElement ("IPermission");
+ se.AddAttribute ("version", "1");
+ Type t = GetType ();
+ se.AddAttribute("class", t.FullName + ", " + t.Module.Assembly.FullName);
+
+ return se;
+ }
+
+ public SecurityZone SecurityZone
+ {
+ get {
+ return zone;
+ }
+
+ set {
+ if (!Enum.IsDefined (typeof (SecurityZone), value))
+ throw new ArgumentException ("invalid zone");
+ zone = value;
+ }
+ }
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..48b97970ac2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.Security.Permissions.ZoneIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class ZoneIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private SecurityZone zone;
+
+ // Constructor
+ public ZoneIdentityPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public SecurityZone Zone
+ {
+ get { return zone; }
+ set { zone = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
new file mode 100755
index 00000000000..298b2a71738
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
@@ -0,0 +1,86 @@
+//
+// System.Security.Policy.AllMembershipCondition.cs
+//
+// Author:
+// Ajay kumar Dwivedi (adwiv@yahoo.com)
+//
+
+using System;
+using System.Security;
+
+
+namespace System.Security.Policy
+{
+ /// <summary>
+ /// Summary description for AllMembershipCondition.
+ /// </summary>
+ [Serializable]
+ public sealed class AllMembershipCondition : IMembershipCondition,
+ ISecurityEncodable, ISecurityPolicyEncodable
+ {
+ // Tag for Xml Data
+ private static readonly string XmlTag = "IMembershipCondition";
+
+ public AllMembershipCondition()
+ {}
+
+ //Always returns true
+ public bool Check(Evidence evidence)
+ {
+ return true;
+ }
+
+ public IMembershipCondition Copy()
+ {
+ return new AllMembershipCondition();
+ }
+
+ public override bool Equals(object o)
+ {
+ if(o is System.Security.Policy.AllMembershipCondition)
+ return true;
+ return false;
+ }
+
+ public void FromXml(SecurityElement e)
+ {
+ FromXml(e, null);
+ }
+
+ //Fixme: is there a need for all this????
+ public void FromXml(SecurityElement e, PolicyLevel level)
+ {
+ if(e == null)
+ throw new ArgumentNullException("e");
+ if(e.Tag != XmlTag)
+ throw new ArgumentException("e","The Tag of SecurityElement must be "
+ + AllMembershipCondition.XmlTag);
+ }
+
+
+ public override int GetHashCode()
+ {
+ return typeof (AllMembershipCondition).GetHashCode ();
+ }
+
+ public override string ToString()
+ {
+ return "All Code";
+ }
+
+ public SecurityElement ToXml()
+ {
+ return ToXml(null);
+ }
+
+ public SecurityElement ToXml(PolicyLevel level)
+ {
+ SecurityElement se = new SecurityElement(XmlTag);
+ Type type = this.GetType();
+ string classString = type.FullName + ", " + type.Assembly;
+ se.AddAttribute("class",classString);
+ se.AddAttribute("version","1");
+ return se;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs b/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs
new file mode 100644
index 00000000000..7dcc3d4f5dc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs
@@ -0,0 +1,79 @@
+// System.Security.Policy.ApplicationDirectory
+//
+// Author:
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+
+using System;
+
+namespace System.Security.Policy {
+
+ [MonoTODO("This class should use a URLString like class instead of just a string")]
+ public sealed class ApplicationDirectory {
+
+ private string directory;
+
+ //
+ // Public Constructors
+ //
+
+ public ApplicationDirectory(string name)
+ {
+ if (null == name)
+ throw new ArgumentNullException ();
+ directory = name;
+ }
+
+ //
+ // Public Properties
+ //
+
+ public string Directory {
+ get { return directory; }
+ }
+
+ //
+ // Public Methods
+ //
+
+ public object Copy()
+ {
+ return new ApplicationDirectory (Directory);
+ }
+
+ [MonoTODO("This needs to check for security subsets")]
+ public override bool Equals(object other)
+ {
+ if (null != other && (other is ApplicationDirectory)) {
+ ApplicationDirectory compare = (ApplicationDirectory)other;
+ return compare.directory.Equals(directory);
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// This does not return the exact same results as the MS version
+ /// </summary>
+ public override int GetHashCode()
+ {
+ return directory.GetHashCode ();
+ }
+
+ public override string ToString()
+ {
+ return ToXml ().ToString ();
+ }
+
+ private SecurityElement ToXml()
+ {
+ SecurityElement element = new SecurityElement (GetType().FullName);
+ element.AddAttribute ("version", "1");
+ element.AddAttribute ("Directory", Directory);
+
+ return element;
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
new file mode 100644
index 00000000000..1c9abd93764
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
@@ -0,0 +1,80 @@
+// System.Security.Policy.ApplicationDirectoryMembershipCondition
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Nick Drochak, All rights reserved.
+
+using System.Security;
+
+namespace System.Security.Policy
+{
+
+ [Serializable]
+ public sealed class ApplicationDirectoryMembershipCondition :
+ IMembershipCondition,
+ ISecurityEncodable,
+ ISecurityPolicyEncodable
+ {
+ // Tag for Xml Data
+ private static readonly string XmlTag = "IMembershipCondition";
+
+ // Methods
+ [MonoTODO]
+ public bool Check(Evidence evidence) {
+ throw new NotImplementedException ();
+ }
+
+ public IMembershipCondition Copy() {
+ return new ApplicationDirectoryMembershipCondition ();
+ }
+
+ public override bool Equals(object o) {
+ return o is ApplicationDirectoryMembershipCondition;
+ }
+
+ public void FromXml(SecurityElement e) {
+ FromXml (e, null);
+ }
+
+ public void FromXml(SecurityElement e, PolicyLevel level) {
+
+ if (null == e)
+ throw new ArgumentNullException ();
+ if (XmlTag != e.Tag)
+ throw new ArgumentException("e","The Tag of SecurityElement must be "
+ + ApplicationDirectoryMembershipCondition.XmlTag);
+ }
+
+ /// <summary>
+ /// All instances of ApplicationDirectoryMembershipCondition are equal so they should
+ /// have the same hashcode
+ /// </summary>
+ public override int GetHashCode()
+ {
+ return typeof (ApplicationDirectoryMembershipCondition).GetHashCode ();
+ }
+
+ public override string ToString()
+ {
+ return "ApplicationDirectory";
+ }
+
+ public SecurityElement ToXml()
+ {
+ return ToXml (null);
+ }
+
+ public SecurityElement ToXml(PolicyLevel level)
+ {
+ SecurityElement element = new SecurityElement (XmlTag);
+ Type type = GetType ();
+ string classString = type.FullName + ", " + type.Assembly;
+ element.AddAttribute ("class", classString);
+ element.AddAttribute ("version", "1");
+
+ return element;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Policy/ChangeLog b/mcs/class/corlib/System.Security.Policy/ChangeLog
new file mode 100644
index 00000000000..3657c2b418b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/ChangeLog
@@ -0,0 +1,136 @@
+2003-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * Hash.cs: Added [Serializable] and ISerializable to class declaration.
+ Changed how the hash algorithm are created (now use system default
+ implementation). Added some exception handling.
+
+2002-12-20 Jackson Harper <jackson@latitudegeo.com>
+
+ * Evidence.cs: Copy constructor does not attempt to merge if it recieves a null ref
+
+2002-12-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * StrongName.cs: New. Implemented.
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * Publisher.cs: New. Implemented.
+ * PublisherMembershipCondition.cs: New. X509 related stuff implemented.
+
+2002-11-28 Jackson Harper <jackson@latitudegeo.com>
+
+ * NetCodeGroup.cs: Added file
+
+2002-11-17 Jackson Harper <jackson@latitudegeo.com>
+
+ * FirstMatchCodeGroup.cs: Added Copyright
+
+2002-11-17 Jackson Harper <jackson@latitudegeo.com>
+
+ * HashMembershipCondition.cs: Added file
+
+2002-11-14 Jackson Harper <jackson@latitudegeo.com>
+
+ * Hash.cs: ToString now uses the SecurityElement class, Assembly byte data is cached after the first load
+
+2002-11-11 Jackson Harper <jackson@latitudegeo.com>
+
+ * FirstMatchCodeGroup.cs: Made class sealed
+
+2002-11-5 Jackson Harper <jackson@latitudegeo.com>
+
+ * ApplicationDirectory.cs: Fixed (C) in file header
+
+2002-10-29 Nick Drochak <ndrochak@gol.com>
+
+ * Hash.cs: Fix build issues. Add some using statements mostly.
+
+2002-10-28 Jackson Harper <jackson@latitudegeo.com>
+
+ * FirstMatchCodeGroup.cs, Hash.cs: New classes, somewhat finished
+
+2002-10-28 Jackson Harper <jackson@latitudegeo.com>
+
+ * ApplicationDirectoryMembershipCondition.cs: Implemented most methods
+
+2002-10-28 Jackson Harper <jackson@latitudegeo.com>
+
+ * ApplicationDirectory.cs: Added class
+
+2002-10-28 Jackson Harper <jackson@latitudegeo.com>
+
+ * AllMembershipCondition.cs: Made GetHashCode act more like
+ MS version. All AllMembershipCondition instance's will return
+ the same hashcode but this hashcode should still be unique to
+ AllMembership Condition's.
+
+
+2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IBuiltInEvidence.cs: New file.
+ * Zone.cs: New file. Implemented.
+
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * IMembershipCondition.cs (Equals): Add missing methods.
+
+2002-03-17 Nick Drochak <ndrochak@gol.com>
+
+ * ApplicationDirectoryMembershipCondition.cs: New file (stub)
+
+2002-02-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileCodeGroup.cs: Finish Equals()
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * PolicyStatement: New file (stub)
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * FileCodeGroup.cs: New file. All done except for GetHashCode and
+ Resolve.
+ * CodeGroup.cs: Fix small bug in ToXml()
+ * Evidence.cs: Added method stub needed by FileCodeGroup.cs. Added
+ MonoTODO's too.
+
+2002-02-07 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroup.cs: Went as far as I can for now. Need to look at
+ the (To|From)XML methods when I understand PolicyLevels better.
+
+2002-02-02 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroup.cs: Not done, but checking in now just in case
+
+2002-01-30 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroup.cs: New file. Not nearly done with this, but saving it
+ in cvs just in case.
+ * PolicyLevel.cs: Sarted just a bit on this then relized i need CodeGroup
+ first (among others). Checking in for disaster recovery.
+
+2002-01-29 Nick Drochak <ndrochak@gol.com>
+
+ * PolicyStatementAttribute.cs: New file.
+ * PolicyException.cs: Use correct namespace
+ * PolicyLevel.cs: Add [Serializable] to class
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * PolicyException.cs: New File.
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * IIdentityPermissionFactory.cs: New File
+ * IMembershipCondition: New File
+
+2001-12-29 Nick Drochak <ndrochak@gol.com>
+
+ * PolicyLevel.cs: New file
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * SecurityElement.cs, CodeAccessPermission.cs IPermission.cs
+ IStackWalk.cs SecurityElement.cs ISecurityEncodable.cs: New files.
+
diff --git a/mcs/class/corlib/System.Security.Policy/CodeGroup.cs b/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
new file mode 100644
index 00000000000..f2103476096
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
@@ -0,0 +1,252 @@
+// System.Security.Policy.CodeGroup
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak, All rights reserved.
+
+using System.Security.Policy;
+using System.Security.Permissions;
+using System.Collections;
+using System; // for MonoTODO attribute
+
+namespace System.Security.Policy
+{
+ [Serializable]
+ public abstract class CodeGroup
+ {
+ PolicyStatement m_policy = null;
+ IMembershipCondition m_membershipCondition = null;
+ string m_description = null;
+ string m_name = null;
+ ArrayList m_children = new ArrayList();
+ PolicyLevel m_level;
+
+ public CodeGroup(IMembershipCondition membershipCondition,
+ PolicyStatement policy)
+ {
+ if (null == membershipCondition)
+ throw new ArgumentNullException("Value cannot be null.");
+ m_policy = policy;
+ m_membershipCondition = membershipCondition;
+ }
+
+ public abstract CodeGroup Copy();
+ public abstract string MergeLogic {get;}
+ public abstract PolicyStatement Resolve( Evidence evidence);
+ public abstract CodeGroup ResolveMatchingCodeGroups(Evidence evidence);
+
+ public PolicyStatement PolicyStatement
+ {
+ get
+ {
+ return m_policy;
+ }
+ set
+ {
+ m_policy = value;
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return m_description;
+ }
+ set
+ {
+ m_description = value;
+ }
+ }
+
+ public IMembershipCondition MembershipCondition
+ {
+ get
+ {
+ return m_membershipCondition;
+ }
+ set
+ {
+ if (null == value)
+ throw new ArgumentException("Value cannot be null");
+ m_membershipCondition = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return m_name;
+ }
+ set
+ {
+ m_name = value;
+ }
+ }
+
+ public IList Children
+ {
+ get
+ {
+ return m_children;
+ }
+ set
+ {
+ if (null == value)
+ throw new ArgumentException("Value cannot be null");
+ m_children = new ArrayList(value);
+ }
+ }
+
+ public virtual string AttributeString
+ {
+ get
+ {
+ if (null != m_policy)
+ return m_policy.AttributeString;
+
+ return null;
+ }
+ }
+
+ public virtual string PermissionSetName
+ {
+ get
+ {
+ if (m_policy.PermissionSet is Security.NamedPermissionSet)
+ return ((NamedPermissionSet)(m_policy.PermissionSet)).Name;
+
+ return null;
+ }
+ }
+
+ public void AddChild(CodeGroup group)
+ {
+ if (null == group)
+ throw new ArgumentNullException("The group parameter cannot be null");
+ m_children.Add(group);
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is CodeGroup))
+ return false;
+
+ return Equals((CodeGroup)o, false);
+ }
+
+ public bool Equals(CodeGroup cg, bool compareChildren)
+ {
+ if (cg.Name != this.Name)
+ return false;
+
+ if (cg.Description != this.Description)
+ return false;
+
+ if (cg.MembershipCondition != this.MembershipCondition)
+ return false;
+
+ if (compareChildren)
+ {
+ int childCount = cg.Children.Count;
+ if (this.Children.Count != childCount)
+ return false;
+
+ for (int index = 0; index < childCount; index++)
+ {
+ // LAMESPEC: are we supposed to check child equality recursively?
+ // The docs imply 'no' but it seems natural to do a 'deep' compare.
+ // Will check the children's children, and so-on unless we find out that
+ // we shouldn't
+ if (!((CodeGroup)(this.Children[index])).Equals((CodeGroup)(cg.Children[index]), true))
+ return false;
+ }
+ }
+
+ return true;
+
+ }
+
+ public void RemoveChild(CodeGroup group)
+ {
+ if (!m_children.Contains(group))
+ throw new ArgumentException();
+
+ m_children.Remove(group);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ return 42;
+ }
+
+ public void FromXml(SecurityElement e)
+ {
+ FromXml(e, (PolicyLevel)null);
+ }
+
+ [MonoTODO]
+ public void FromXml(SecurityElement e, PolicyLevel level )
+ {
+ if (null == e)
+ throw new ArgumentNullException("e");
+
+ // Not sure what might be serialized in this XML, so just do the strings for now
+ // and null's for everything else
+ m_children = null;
+ m_policy = null;
+ m_membershipCondition = null;
+
+ m_name = e.Attribute("Name");
+ m_description = e.Attribute("Description");
+
+ // seems like we might need this to Resolve() in subclasses
+ m_level = level;
+
+ ParseXml(e, level);
+ }
+
+ protected virtual void ParseXml(SecurityElement e, PolicyLevel level)
+ {
+ }
+
+ public SecurityElement ToXml()
+ {
+ return ToXml(null);
+ }
+
+ [MonoTODO("Not sure what to do with PolicyLevel parameter")]
+ public SecurityElement ToXml(PolicyLevel level)
+ {
+ SecurityElement e = new SecurityElement("CodeGroup");
+ e.AddAttribute("class", this.GetType().AssemblyQualifiedName);
+ e.AddAttribute("version", "1");
+
+ if (null != Name)
+ e.AddAttribute("Name", Name);
+
+ if (null != Description)
+ e.AddAttribute("Description", Description);
+
+ if (null != MembershipCondition)
+ e.AddChild(MembershipCondition.ToXml());
+
+ if (null != PolicyStatement)
+ e.AddChild(PolicyStatement.PermissionSet.ToXml());
+
+ foreach (CodeGroup child in Children)
+ e.AddChild(child.ToXml());
+
+ CreateXml(e, level);
+ return e;
+ }
+
+ protected virtual void CreateXml(SecurityElement element, PolicyLevel level)
+ {
+ }
+ } // public abstract class CodeGroup
+
+} // namespace System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Policy/Evidence.cs b/mcs/class/corlib/System.Security.Policy/Evidence.cs
new file mode 100644
index 00000000000..86d520f0251
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/Evidence.cs
@@ -0,0 +1,163 @@
+// System.Security.Policy.Evidence
+//
+// Authors:
+// Sean MacIsaac (macisaac@ximian.com)
+// Nick Drochak (ndrochak@gol.com)
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System;
+using System.Collections;
+
+namespace System.Security.Policy {
+
+ [MonoTODO]
+ public sealed class Evidence : ICollection, IEnumerable {
+
+ private ArrayList hostEvidenceList = new ArrayList ();
+ private ArrayList assemblyEvidenceList = new ArrayList ();
+
+ public Evidence ()
+ {
+ }
+
+ public Evidence (Evidence evidence)
+ {
+ if (evidence != null)
+ Merge (evidence);
+ }
+
+ public Evidence (object[] hostEvidence, object[] assemblyEvidence )
+ {
+ if (null != hostEvidence)
+ hostEvidenceList.AddRange (hostEvidence);
+ if (null != assemblyEvidence)
+ assemblyEvidenceList.AddRange (assemblyEvidence);
+ }
+
+ //
+ // Public Properties
+ //
+
+ public int Count {
+ get {
+ return (hostEvidenceList.Count + assemblyEvidenceList.Count);
+ }
+ }
+
+ public bool IsReadOnly {
+ get{ return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public bool Locked {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ //
+ // Public Methods
+ //
+
+ public void AddAssembly (object id)
+ {
+ assemblyEvidenceList.Add (id);
+ }
+
+ [MonoTODO("If Locked is true and the code that calls this method does not have SecurityPermissionFlag.ControlEvidence a SecurityException should be thrown")]
+ public void AddHost (object id)
+ {
+ hostEvidenceList.Add (id);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ if (hostEvidenceList.Count > 0)
+ hostEvidenceList.CopyTo (array,index);
+ if (assemblyEvidenceList.Count > 0)
+ assemblyEvidenceList.CopyTo (array,index + hostEvidenceList.Count);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new EvidenceEnumerator (hostEvidenceList.GetEnumerator (),
+ assemblyEvidenceList.GetEnumerator ());
+ }
+
+ public IEnumerator GetAssemblyEnumerator ()
+ {
+ return assemblyEvidenceList.GetEnumerator ();
+ }
+
+ public IEnumerator GetHostEnumerator ()
+ {
+ return hostEvidenceList.GetEnumerator ();
+ }
+
+ public void Merge (Evidence evidence)
+ {
+ IEnumerator hostenum, assemblyenum;
+
+ hostenum = evidence.GetHostEnumerator ();
+ while( hostenum.MoveNext () ) {
+ AddHost (hostenum.Current);
+ }
+
+ assemblyenum = evidence.GetAssemblyEnumerator ();
+ while( assemblyenum.MoveNext () ) {
+ AddAssembly (assemblyenum.Current);
+ }
+ }
+
+ private class EvidenceEnumerator : IEnumerator {
+
+ private IEnumerator currentEnum, hostEnum, assemblyEnum;
+
+ public EvidenceEnumerator (IEnumerator hostenum, IEnumerator assemblyenum)
+ {
+ this.hostEnum = hostenum;
+ this.assemblyEnum = assemblyenum;
+ currentEnum = hostEnum;
+ }
+
+ public bool MoveNext ()
+ {
+ bool ret = currentEnum.MoveNext ();
+
+ if ( !ret && hostEnum == currentEnum ) {
+ currentEnum = assemblyEnum;
+ ret = assemblyEnum.MoveNext ();
+ }
+
+ return ret;
+ }
+
+ public void Reset ()
+ {
+ hostEnum.Reset ();
+ assemblyEnum.Reset ();
+ currentEnum = hostEnum;
+ }
+
+ public object Current {
+ get {
+ return currentEnum.Current;
+ }
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
new file mode 100644
index 00000000000..debd7d3543a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
@@ -0,0 +1,135 @@
+// System.Security.Policy.FileCodeGroup
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak, All rights reserved.
+
+using System.Security.Policy;
+using System.Security.Permissions;
+using System.Collections;
+using System; // for MonoTODO attribute
+
+namespace System.Security.Policy
+{
+ [Serializable]
+ public sealed class FileCodeGroup : CodeGroup
+ {
+ FileIOPermissionAccess m_access;
+
+ [MonoTODO("Check if membershipCondition is valid")]
+ public FileCodeGroup(IMembershipCondition membershipCondition,
+ FileIOPermissionAccess access)
+ : base(membershipCondition, null)
+ {
+ if (!Enum.IsDefined(typeof(FileIOPermissionAccess), access))
+ throw new ArgumentException("Value not defined for FileIOPermissionAccess","access");
+
+ m_access = access;
+ }
+
+ public override CodeGroup Copy()
+ {
+ FileCodeGroup copy = new FileCodeGroup(MembershipCondition, m_access);
+ foreach (CodeGroup child in Children)
+ {
+ AddChild(child.Copy());
+ }
+
+ return copy;
+ }
+
+ public override string MergeLogic
+ {
+ get
+ {
+ return "Union";
+ }
+ }
+
+ [MonoTODO]
+ public override PolicyStatement Resolve( Evidence evidence)
+ {
+ if (null == evidence)
+ throw new ArgumentNullException("evidence");
+
+ if (null == PolicyStatement)
+ throw new PolicyException();
+
+ if (!MembershipCondition.Check(evidence))
+ return null;
+
+ IEnumerator hostEnumerator = evidence.GetHostEnumerator();
+ while (hostEnumerator.MoveNext())
+ {
+ // FIXME: not sure what to do here
+ // How do we check the URL and make a PolicyStatement?
+ }
+ throw new NotImplementedException();
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
+ {
+ if (null == evidence)
+ throw new ArgumentNullException("evidence");
+
+ if (!MembershipCondition.Check(evidence))
+ return null;
+
+ FileCodeGroup matchRoot = new FileCodeGroup(MembershipCondition, m_access);
+
+ foreach (CodeGroup child in Children)
+ {
+ CodeGroup childMatchingCodeGroup = child.ResolveMatchingCodeGroups(evidence);
+ if (childMatchingCodeGroup != null)
+ AddChild(childMatchingCodeGroup);
+ }
+
+ return matchRoot;
+ }
+
+ public override string AttributeString
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public override string PermissionSetName
+ {
+ get
+ {
+ return "Same directory FileIO - " + m_access.ToString();
+ }
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is FileCodeGroup))
+ return false;
+
+ if (this.m_access != ((FileCodeGroup)o).m_access)
+ return false;
+
+ return Equals((CodeGroup)o, false);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override void ParseXml(SecurityElement e, PolicyLevel level)
+ {
+ m_access = (FileIOPermissionAccess)Enum.Parse(typeof(FileIOPermissionAccess), e.Attribute("Access"), true);
+ }
+
+ protected override void CreateXml(SecurityElement element, PolicyLevel level)
+ {
+ element.AddAttribute("Access", m_access.ToString());
+ }
+ } // public abstract class CodeGroup
+
+} // namespace System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs
new file mode 100644
index 00000000000..4fcc9fe7a5a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs
@@ -0,0 +1,106 @@
+// System.Security.Policy.FirstMatchCodeGroup
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+
+using System;
+
+namespace System.Security.Policy {
+
+ public sealed class FirstMatchCodeGroup : CodeGroup {
+
+ public FirstMatchCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy) :
+ base (membershipCondition, policy)
+ {
+ }
+
+ //
+ // Public Properties
+ //
+
+ public override string MergeLogic
+ {
+ get { return "First Match"; }
+ }
+
+ //
+ // Public Methods
+ //
+
+ public override CodeGroup Copy()
+ {
+ FirstMatchCodeGroup copy = CopyNoChildren ();
+
+ foreach (CodeGroup group in Children) {
+ copy.AddChild ( group );
+ }
+
+ return copy;
+ }
+
+ public override PolicyStatement Resolve(Evidence evidence)
+ {
+ PolicyStatement policy = null;
+ PolicyStatement child_policy;
+
+ if (null == evidence)
+ throw new ArgumentNullException ();
+
+ if (MembershipCondition.Check (evidence)) {
+ if (null != PolicyStatement) {
+ policy = PolicyStatement;
+ } else {
+ // Loop through all children breaking on the first one that resolves
+ foreach (CodeGroup child in Children) {
+ if (null == (child_policy = child.Resolve (evidence)))
+ continue;
+ policy = child_policy;
+ break;
+ }
+ }
+ }
+
+ return policy;
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
+ {
+ CodeGroup group = null;
+
+ if (null == evidence)
+ throw new ArgumentNullException ();
+
+ if (MembershipCondition.Check (evidence)) {
+ group = CopyNoChildren ();
+
+ // Add the first child that resolves
+ foreach (CodeGroup child in Children) {
+ if ( null == child.Resolve (evidence))
+ continue;
+ group.AddChild (child);
+ break;
+ }
+ }
+
+ return group;
+ }
+
+ //
+ // Private Methods
+ //
+
+ private FirstMatchCodeGroup CopyNoChildren()
+ {
+ FirstMatchCodeGroup copy = new FirstMatchCodeGroup (MembershipCondition, PolicyStatement);
+
+ copy.Name = Name;
+ copy.Description = Description;
+
+ return copy;
+ }
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/Hash.cs b/mcs/class/corlib/System.Security.Policy/Hash.cs
new file mode 100644
index 00000000000..75e7a703908
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/Hash.cs
@@ -0,0 +1,109 @@
+//
+// System.Security.Policy.Hash
+//
+// Authors:
+// Jackson Harper (Jackson@LatitudeGeo.com)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved.
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Security.Cryptography;
+
+namespace System.Security.Policy {
+
+[Serializable]
+public sealed class Hash : ISerializable {
+
+ private Assembly assembly;
+ private byte[] data = null;
+
+ public Hash (Assembly assembly)
+ {
+ if (assembly == null)
+ throw new ArgumentNullException ("assembly");
+ this.assembly = assembly;
+ }
+
+ //
+ // Public Properties
+ //
+
+ public byte[] MD5 {
+ get {
+ // fully named to avoid conflit between MD5 property and class name
+ HashAlgorithm hash = System.Security.Cryptography.MD5.Create ();
+ return GenerateHash (hash);
+ }
+ }
+
+ public byte[] SHA1 {
+ get {
+ // fully named to avoid conflit between SHA1 property and class name
+ HashAlgorithm hash = System.Security.Cryptography.SHA1.Create ();
+ return GenerateHash (hash);
+ }
+ }
+
+ //
+ // Public Methods
+ //
+
+ public byte[] GenerateHash (HashAlgorithm hashAlg)
+ {
+ if (hashAlg == null)
+ throw new ArgumentNullException ("hashAlg");
+ return hashAlg.ComputeHash (GetData ());
+ }
+
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO("The Raw data seems to be different than the raw data I have")]
+ public override string ToString ()
+ {
+ SecurityElement se = new SecurityElement (GetType ().FullName);
+ se.AddAttribute ("version", "1");
+
+ StringBuilder sb = new StringBuilder ();
+ byte[] raw = GetData ();
+ for (int i=0; i < raw.Length; i++)
+ sb.Append (raw [i].ToString ("X2"));
+
+ se.AddChild (new SecurityElement ("RawData", sb.ToString ()));
+ return se.ToString ();
+ }
+
+ //
+ // Private Methods
+ //
+
+ [MonoTODO("This doesn't match the MS version perfectly.")]
+ private byte[] GetData ()
+ {
+ if (null == data) {
+ // TODO we mustn't hash the complete assembly!
+ // ---- Look at ToString (MS version) for what to hash (and what not to)
+ // TODO we must drop the authenticode signature (if present)
+ FileStream stream = new
+ FileStream (assembly.Location, FileMode.Open, FileAccess.Read);
+ data = new byte [stream.Length];
+ stream.Read (data, 0, (int)stream.Length);
+ }
+
+ return data;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Policy/HashMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/HashMembershipCondition.cs
new file mode 100644
index 00000000000..6a7c1578085
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/HashMembershipCondition.cs
@@ -0,0 +1,176 @@
+//
+// System.Security.Policy.HashMembershipCondition
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved
+//
+
+using System.Text;
+using System.Reflection;
+using System.Security.Cryptography;
+
+namespace System.Security.Policy {
+
+ public sealed class HashMembershipCondition : IMembershipCondition,
+ ISecurityEncodable, ISecurityPolicyEncodable {
+
+ private static readonly string XmlTag = "IMembershipCondition";
+
+ private HashAlgorithm hash_algorithm;
+ private byte[] hash_value;
+
+ public HashMembershipCondition (HashAlgorithm hash_algorithm,
+ byte[] hash_value)
+ {
+ if (hash_algorithm == null || hash_value == null)
+ throw new ArgumentNullException ();
+
+ this.hash_algorithm = hash_algorithm;
+ this.hash_value = hash_value;
+ }
+
+ //
+ // Public Properties
+ //
+
+ public HashAlgorithm HashAlgorithm {
+ get { return hash_algorithm; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ hash_algorithm = value;
+ }
+ }
+
+ public byte[] HashValue {
+ get { return hash_value; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ hash_value = value;
+ }
+ }
+
+ //
+ // Public Methods
+ //
+
+ public bool Check (Evidence evidence)
+ {
+ if (evidence == null)
+ throw new ArgumentNullException ();
+
+ // Loop through evidence finding the first Hash object
+ foreach (object obj in evidence) {
+ Hash hash = obj as Hash;
+ if (hash == null)
+ continue;
+ if (EqualsHashValue (hash.GenerateHash (hash_algorithm)))
+ return true;
+ break;
+ }
+ return false;
+ }
+
+ public IMembershipCondition Copy ()
+ {
+ return new HashMembershipCondition (hash_algorithm, hash_value);
+ }
+
+ public override bool Equals (object o)
+ {
+ HashMembershipCondition other;
+ if (!(o is HashMembershipCondition))
+ return false;
+
+ other = (HashMembershipCondition)o;
+
+ return (other.HashAlgorithm == hash_algorithm &&
+ other.HashValue == hash_value);
+ }
+
+ public SecurityElement ToXml()
+ {
+ return ToXml (null);
+ }
+
+ public SecurityElement ToXml (PolicyLevel level)
+ {
+ SecurityElement se = new SecurityElement (XmlTag);
+ Type type = this.GetType ();
+ string classString = type.FullName + ", " + type.Assembly;
+ se.AddAttribute ("class", classString);
+ se.AddAttribute ("version", "1");
+ se.AddAttribute ("HashValue", Encoding.Default.GetString (hash_value));
+ se.AddAttribute ("HashAlgorithm", hash_algorithm.GetType ().FullName);
+ return se;
+ }
+
+ public void FromXml (SecurityElement element)
+ {
+ FromXml (element, null);
+ }
+
+ public void FromXml (SecurityElement e,
+ PolicyLevel level)
+ {
+ if (e == null)
+ throw new ArgumentNullException ();
+ if (e.Tag != XmlTag)
+ throw new ArgumentException(
+ "e","The Tag of SecurityElement must be " + XmlTag);
+
+ string value = (string)e.Attributes["HashValue"];
+ string algorithm = (string)e.Attributes["HashAlgorithm"];
+
+ if (value == null || algorithm == null )
+ throw new ArgumentException ();
+
+ hash_value = Encoding.Default.GetBytes (value);
+ hash_algorithm = (HashAlgorithm)Assembly.GetExecutingAssembly ().CreateInstance (algorithm);
+
+ }
+
+ [MonoTODO("This is not right")]
+ public override int GetHashCode ()
+ {
+ return hash_value.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder builder = new StringBuilder ();
+ Type alg_type = hash_algorithm.GetType ();
+
+ builder.Append ("Hash -");
+ builder.AppendFormat ("{0} {1}", alg_type.FullName,
+ alg_type.Assembly);
+ builder.AppendFormat (" = ", Encoding.Default.GetString (hash_value));
+
+ return builder.ToString ();
+ }
+
+ //
+ // Private Methods
+ //
+
+ private bool EqualsHashValue (byte[] value)
+ {
+ int len;
+
+ if (value.Length != hash_value.Length)
+ return false;
+
+ len = value.Length;
+ for (int i=0; i<len; i++ ) {
+ if (value[i] != hash_value[i])
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/IBuiltInEvidence.cs b/mcs/class/corlib/System.Security.Policy/IBuiltInEvidence.cs
new file mode 100644
index 00000000000..98a2f97d262
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/IBuiltInEvidence.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.Policy.IBuiltInEvidence
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+
+namespace System.Security.Policy
+{
+ interface IBuiltInEvidence
+ {
+ int GetRequiredSize (bool verbose);
+ int InitFromBuffer (char [] buffer, int position);
+ int OutputToBuffer (char [] buffer, int position, bool verbose);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs b/mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs
new file mode 100644
index 00000000000..5b82d9d934a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs
@@ -0,0 +1,13 @@
+// System.Security.Policy.IIdentityPermissionFactory
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+namespace System.Security.Policy
+{
+ public interface IIdentityPermissionFactory
+ {
+ IPermission CreateIdentityPermission(Evidence evidence);
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs
new file mode 100644
index 00000000000..64eb3eba352
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs
@@ -0,0 +1,17 @@
+// System.Security.Policy.IMembershipCondition.cs
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+namespace System.Security.Policy
+{
+ public interface IMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable
+ {
+ bool Check (Evidence evidence);
+ IMembershipCondition Copy ();
+ bool Equals (object obj);
+ string ToString ();
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs
new file mode 100644
index 00000000000..d77b665e83a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs
@@ -0,0 +1,88 @@
+//
+// System.Security.Policy.NetCodeGroup
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2002 Jackson Harper, All rights reserved
+//
+
+using System;
+
+namespace System.Security.Policy {
+
+ public sealed class NetCodeGroup : CodeGroup {
+
+ public NetCodeGroup (IMembershipCondition condition)
+ : base (condition,null)
+ {
+ }
+
+ //
+ // Public Properties
+ //
+
+ public override string AttributeString {
+ get { return null; }
+ }
+
+ public override string MergeLogic {
+ get { return "Union"; }
+ }
+
+ public override string PermissionSetName {
+ get { return "Same site Web"; }
+ }
+
+
+ //
+ // Public Methods
+ //
+
+ public override CodeGroup Copy ()
+ {
+ NetCodeGroup copy = new NetCodeGroup (MembershipCondition);
+
+ copy.Name = Name;
+ copy.Description = Description;
+ copy.PolicyStatement = PolicyStatement;
+
+ foreach (CodeGroup child in Children) {
+ copy.AddChild (child);
+ }
+
+ return copy;
+ }
+
+ [MonoTODO]
+ public override PolicyStatement Resolve (Evidence evidence)
+ {
+ if (evidence == null)
+ throw new ArgumentNullException ();
+
+ throw new NotImplementedException ();
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups (Evidence evidence)
+ {
+ if (evidence == null)
+ throw new ArgumentNullException ();
+
+ CodeGroup return_group = null;
+ if (MembershipCondition.Check (evidence)) {
+ return_group = Copy ();
+
+ foreach (CodeGroup child_group in Children) {
+ CodeGroup matching =
+ child_group.ResolveMatchingCodeGroups (evidence);
+ if (matching == null)
+ continue;
+ return_group.AddChild (matching);
+ }
+ }
+
+ return return_group;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyException.cs b/mcs/class/corlib/System.Security.Policy/PolicyException.cs
new file mode 100644
index 00000000000..3fc12347231
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyException.cs
@@ -0,0 +1,42 @@
+//
+// System.PolicyException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Security.Policy
+{
+ [Serializable]
+ public class PolicyException : SystemException
+ {
+ // Constructors
+ public PolicyException ()
+ : base (Locale.GetText ("Cannot run because of policy."))
+ {
+ }
+
+ public PolicyException (string message)
+ : base (message)
+ {
+ }
+
+ protected PolicyException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PolicyException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs b/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
new file mode 100644
index 00000000000..215b42c23b4
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
@@ -0,0 +1,62 @@
+// System.Security.Policy.PolicyLevel
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+using System.Collections; // for IList
+
+namespace System.Security.Policy
+{
+ [MonoTODO]
+ [Serializable]
+ public sealed class PolicyLevel
+ {
+ internal PolicyLevel () {}
+
+ public IList FullTrustAssemblies
+ {
+ get
+ {
+ return (IList)null;
+ }
+ }
+
+ public string Label
+ {
+ get
+ {
+ return "";
+ }
+ }
+
+ public IList NamedPermissionSets
+ {
+ get
+ {
+ return (IList)null;
+ }
+ }
+
+ public CodeGroup RootCodeGroup
+ {
+ get
+ {
+ return (CodeGroup)null;
+ }
+
+ set
+ {
+
+ }
+ }
+
+ public string StoreLocation
+ {
+ get
+ {
+ return "";
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyStatement.cs b/mcs/class/corlib/System.Security.Policy/PolicyStatement.cs
new file mode 100644
index 00000000000..95a37d39b56
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyStatement.cs
@@ -0,0 +1,61 @@
+//
+// System.Security.Policy.PolicyStatement
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+namespace System.Security.Policy {
+
+ [Serializable]
+ public sealed class PolicyStatement : ISecurityEncodable, ISecurityPolicyEncodable {
+ public PolicyStatement (PermissionSet perms) :
+ this (perms, PolicyStatementAttribute.Nothing)
+ {
+ }
+
+ public PolicyStatement (PermissionSet perms, PolicyStatementAttribute attrs) {
+ this.perms = perms;
+ this.attrs = attrs;
+ }
+
+ public PermissionSet PermissionSet {
+ get { return perms; }
+ set { perms = value; }
+ }
+
+ public PolicyStatementAttribute Attributes {
+ get { return attrs; }
+ set { attrs = value; }
+ }
+
+ public string AttributeString {
+ get { return attrs.ToString ("F"); }
+ }
+
+ // ISecurityEncodable
+
+ [MonoTODO]
+ public void FromXml (SecurityElement e) {
+ }
+
+ [MonoTODO]
+ public void FromXml (SecurityElement e, PolicyLevel level) {
+ }
+
+ [MonoTODO]
+ public SecurityElement ToXml () {
+ return null;
+ }
+
+ [MonoTODO]
+ public SecurityElement ToXml (PolicyLevel level) {
+ return null;
+ }
+
+ private PermissionSet perms;
+ private PolicyStatementAttribute attrs;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs b/mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs
new file mode 100644
index 00000000000..be194224be9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs
@@ -0,0 +1,17 @@
+// System.Security.Policy.PolicyStatementAttribute
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+namespace System.Security.Policy
+{
+ [Flags]
+ [Serializable]
+ public enum PolicyStatementAttribute {
+ Nothing = 0,
+ Exclusive = 1,
+ LevelFinal = 2,
+ All = 3
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/Publisher.cs b/mcs/class/corlib/System.Security.Policy/Publisher.cs
new file mode 100644
index 00000000000..19838d88883
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/Publisher.cs
@@ -0,0 +1,85 @@
+//
+// Publisher.cs: Publisher Policy using X509 Certificate
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
+using System.Text;
+
+namespace System.Security.Policy {
+
+[Serializable]
+public sealed class Publisher : IIdentityPermissionFactory {
+
+ private X509Certificate x509;
+
+ public Publisher (X509Certificate cert)
+ {
+ if (cert == null)
+ throw new ArgumentNullException ("cert");
+ x509 = cert;
+ }
+
+ ~Publisher ()
+ {
+ // X509Certificate doesn't have a Dispose
+ // (bad design as it deal with unmanaged code in Windows)
+ // not really needed but corcompare will be happier
+ }
+
+ public X509Certificate Certificate {
+ get {
+ // needed to match MS implementation
+ if (x509.GetRawCertData() == null)
+ throw new NullReferenceException ("x509");
+ return x509;
+ }
+ }
+
+ public object Copy ()
+ {
+ return (object) new Publisher (x509);
+ }
+
+ [MonoTODO("What should we do with the evidence ? nothing?")]
+ public IPermission CreateIdentityPermission (Evidence evidence)
+ {
+ return new PublisherIdentityPermission (x509);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Publisher))
+ throw new ArgumentException ("not a Publisher");
+ return x509.Equals ((o as Publisher).Certificate);
+ }
+
+ public override int GetHashCode ()
+ {
+ return x509.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<System.Security.Policy.Publisher version=\"1\">\r\n <X509v3Certificate");
+ string cert = x509.GetRawCertDataString ();
+ if (cert == null)
+ sb.Append ("/>\r\n");
+ else {
+ sb.Append (">");
+ sb.Append (cert);
+ sb.Append ("</X509v3Certificate>\r\n");
+ }
+ sb.Append ("</System.Security.Policy.Publisher>\r\n");
+ return sb.ToString ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs
new file mode 100644
index 00000000000..cbffc5655ed
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs
@@ -0,0 +1,90 @@
+//
+// PublisherMembershipCondition.cs: Publisher Membership Condition
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Security.Policy {
+
+public sealed class PublisherMembershipCondition : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable {
+
+ private X509Certificate x509;
+
+ // LAMESPEC: Undocumented ArgumentNullException exception
+ public PublisherMembershipCondition (X509Certificate certificate)
+ {
+ if (certificate == null)
+ throw new ArgumentNullException ("certificate");
+ // needed to match MS implementation
+ if (certificate.GetRawCertData() == null)
+ throw new NullReferenceException ("certificate");
+ x509 = certificate;
+ }
+
+ public X509Certificate Certificate {
+ get { return x509; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ x509 = value;
+ }
+ }
+
+ [MonoTODO()]
+ public bool Check (Evidence evidence)
+ {
+ return true;
+ }
+
+ public IMembershipCondition Copy ()
+ {
+ return new PublisherMembershipCondition (x509);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is PublisherMembershipCondition))
+ throw new ArgumentException ("not a PublisherMembershipCondition");
+ return x509.Equals ((o as PublisherMembershipCondition).Certificate);
+ }
+
+ [MonoTODO()]
+ public void FromXml (SecurityElement e)
+ {
+ }
+
+ [MonoTODO()]
+ public void FromXml (SecurityElement e, PolicyLevel level)
+ {
+ }
+
+ public override int GetHashCode ()
+ {
+ return x509.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return "Publisher - " + x509.GetPublicKeyString ();
+ }
+
+ [MonoTODO()]
+ public SecurityElement ToXml ()
+ {
+ return null;
+ }
+
+ [MonoTODO()]
+ public SecurityElement ToXml (PolicyLevel level)
+ {
+ return null;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Policy/StrongName.cs b/mcs/class/corlib/System.Security.Policy/StrongName.cs
new file mode 100644
index 00000000000..d0316a8625b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/StrongName.cs
@@ -0,0 +1,91 @@
+//
+// StrongName.cs: Strong Name
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Permissions;
+using System.Text;
+
+namespace System.Security.Policy {
+
+[Serializable]
+public sealed class StrongName : IIdentityPermissionFactory {
+
+ private StrongNamePublicKeyBlob publickey;
+ private string name;
+ private Version version;
+
+ public StrongName (StrongNamePublicKeyBlob blob, string name, Version version)
+ {
+ if (blob == null)
+ throw new ArgumentNullException ("blob");
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (version == null)
+ throw new ArgumentNullException ("version");
+
+ publickey = blob;
+ this.name = name;
+ this.version = version;
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ public StrongNamePublicKeyBlob PublicKey {
+ get { return publickey; }
+ }
+
+ public Version Version {
+ get { return version; }
+ }
+
+ public object Copy ()
+ {
+ return (object) new StrongName (publickey, name, version);
+ }
+
+ [MonoTODO("What should we do with the evidence ? nothing?")]
+ public IPermission CreateIdentityPermission (Evidence evidence)
+ {
+ return new StrongNameIdentityPermission (publickey, name, version);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is StrongName))
+ return false;
+ StrongName sn = (o as StrongName);
+ if (name != sn.Name)
+ return false;
+ if (!Version.Equals (sn.Version))
+ return false;
+ return PublicKey.Equals (sn.PublicKey);
+ }
+
+ public override int GetHashCode ()
+ {
+ return publickey.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append ("<StrongName version=\"1\"\r\n Key=\"");
+ sb.Append (publickey.ToString ());
+ sb.Append ("\"\r\n Name=\"");
+ sb.Append (name);
+ sb.Append ("\"\r\n Version=\"");
+ sb.Append (version.ToString ());
+ sb.Append ("\"/>\r\n");
+ return sb.ToString ();
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Policy/Zone.cs b/mcs/class/corlib/System.Security.Policy/Zone.cs
new file mode 100644
index 00000000000..7c62fd992c9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/Zone.cs
@@ -0,0 +1,90 @@
+//
+// System.Security.Policy.Zone
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Security.Policy
+{
+ public sealed class Zone : IIdentityPermissionFactory, IBuiltInEvidence
+ {
+ SecurityZone zone;
+
+ public Zone (SecurityZone zone)
+ {
+ if (!Enum.IsDefined (typeof (SecurityZone), zone))
+ throw new ArgumentException ("invalid zone");
+
+ this.zone = zone;
+ }
+
+ public object Copy ()
+ {
+ return new Zone (zone);
+ }
+
+ public IPermission CreateIdentityPermission (Evidence evidence)
+ {
+ return new ZoneIdentityPermission (zone);
+ }
+
+ [MonoTODO("This depends on zone configuration in IE")]
+ public static Zone CreateFromUrl (string url)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Zone))
+ return false;
+
+ return (((Zone) o).zone == zone);
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) zone;
+ }
+
+ public override string ToString ()
+ {
+ SecurityElement se = new SecurityElement (GetType ().FullName);
+ se.AddAttribute ("version", "1");
+ se.AddChild (new SecurityElement ("Zone", zone.ToString ()));
+
+ return se.ToString ();
+ }
+
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 3;
+ }
+
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position) {
+ int new_zone = (int) buffer [position++];
+ new_zone += buffer [position++];
+ return position;
+ }
+
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ buffer [position++] = '\x0003';
+ buffer [position++] = (char) (((int) zone) >> 16);
+ buffer [position++] = (char) (((int) zone) & 0x0FFFF);
+ return position;
+ }
+
+ public SecurityZone SecurityZone
+ {
+ get { return zone; }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Principal/ChangeLog b/mcs/class/corlib/System.Security.Principal/ChangeLog
new file mode 100644
index 00000000000..b41c8dba5ab
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/ChangeLog
@@ -0,0 +1,18 @@
+2002-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * GenericIdentity.cs: check arguments and fixed IsAuthenticated.
+
+2002-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WindowsIdentity.cs:
+ * WindowsImpersonationContext.cs: stubbed.
+
+2002/07/10 Nick Drochak <ndrochak@gol.com>
+
+ * WindowsAccountType.cs:
+ * WindowsBuiltInRole.cs:
+ Make these enums public instead of internal.
+
+2002-01-07 Nick Drochak <ndrochak@gol.com>
+
+ * PrincipalPolicy.cs: made enum public like it should be to get _AppDomain to compile.
diff --git a/mcs/class/corlib/System.Security.Principal/GenericIdentity.cs b/mcs/class/corlib/System.Security.Principal/GenericIdentity.cs
new file mode 100644
index 00000000000..980d3a0aa9a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/GenericIdentity.cs
@@ -0,0 +1,51 @@
+//
+// System.Security.Principal.GenericIdentity.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ [Serializable]
+ public class GenericIdentity : IIdentity {
+ string user_name;
+ string authentication_type;
+
+ public GenericIdentity (string user_name, string authentication_type)
+ {
+ if (user_name == null)
+ throw new ArgumentNullException ("user_name");
+
+ if (authentication_type == null)
+ throw new ArgumentNullException ("authentication_type");
+
+ this.user_name = user_name;
+ this.authentication_type = authentication_type;
+ }
+
+ public GenericIdentity (string name) : this (name, "")
+ {
+ }
+
+ public virtual string AuthenticationType {
+ get {
+ return authentication_type;
+ }
+ }
+
+ public virtual string Name {
+ get {
+ return user_name;
+ }
+ }
+
+ public virtual bool IsAuthenticated {
+ get {
+ return (user_name != "");
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs b/mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs
new file mode 100644
index 00000000000..5fa85b9e72b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs
@@ -0,0 +1,38 @@
+//
+// System.Security.Principal.GenericPrincipal.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ [Serializable]
+ public class GenericPrincipal : IPrincipal {
+ IIdentity identity;
+ string [] roles;
+
+ public GenericPrincipal (IIdentity identity, string [] roles)
+ {
+ this.identity = identity;
+ this.roles = roles;
+ }
+
+ public virtual IIdentity Identity {
+ get {
+ return identity;
+ }
+ }
+
+ public virtual bool IsInRole (string role)
+ {
+ foreach (string r in roles)
+ if (role == r)
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/IIdentity.cs b/mcs/class/corlib/System.Security.Principal/IIdentity.cs
new file mode 100644
index 00000000000..e31f8eddd34
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/IIdentity.cs
@@ -0,0 +1,26 @@
+//
+// System.Security.Principal.IIdentity.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public interface IIdentity {
+
+ string AuthenticationType {
+ get;
+ }
+
+ bool IsAuthenticated {
+ get;
+ }
+
+ string Name {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/IPrincipal.cs b/mcs/class/corlib/System.Security.Principal/IPrincipal.cs
new file mode 100644
index 00000000000..55aece3a4dc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/IPrincipal.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.Principal.IPrincipal.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public interface IPrincipal {
+
+ IIdentity Identity {
+ get;
+ }
+
+ bool IsInRole (string role);
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs b/mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs
new file mode 100644
index 00000000000..0fc36b14087
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs
@@ -0,0 +1,17 @@
+//
+// System.Security.Principal.PrincipalPolicy.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public enum PrincipalPolicy {
+ UnauthenticatedPrincipal,
+ NoPrincipal,
+ WindowsPrincipal
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs b/mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs
new file mode 100644
index 00000000000..4387c215ff8
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.Principal.WindowsAccountType.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public enum WindowsAccountType {
+ Normal,
+ Guest,
+ System,
+ Anonymous
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs b/mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs
new file mode 100644
index 00000000000..d2420eb2c02
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs
@@ -0,0 +1,23 @@
+//
+// System.Security.Principal.WindowsBuiltInRole.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public enum WindowsBuiltInRole {
+ Administrator = 544,
+ User = 545,
+ Guest = 546,
+ PowerUser = 547,
+ AccountOperator = 548,
+ SystemOperator = 549,
+ PrintOperator = 550,
+ BackupOperator = 551,
+ Replicator = 552,
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs b/mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs
new file mode 100644
index 00000000000..36a21854f88
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs
@@ -0,0 +1,132 @@
+//
+// System.Security.Principal.WindowsIdentity
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Security.Principal
+{
+ [Serializable]
+ public class WindowsIdentity : IIdentity, IDeserializationCallback
+ {
+ public WindowsIdentity (IntPtr userToken)
+ {
+ }
+
+ [MonoTODO]
+ public WindowsIdentity (IntPtr userToken, string type)
+ {
+ }
+
+ [MonoTODO]
+ public WindowsIdentity (IntPtr userToken, string type, WindowsAccountType acctType)
+ {
+ }
+
+ [MonoTODO]
+ public WindowsIdentity (IntPtr userToken,
+ string type,
+ WindowsAccountType acctType,
+ bool isAuthenticated)
+ {
+ }
+
+ [MonoTODO]
+ ~WindowsIdentity ()
+ {
+ }
+
+ [MonoTODO]
+ public static WindowsIdentity GetAnonymous ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static WindowsIdentity GetCurrent ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual WindowsImpersonationContext Impersonate ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static WindowsImpersonationContext Impersonate (IntPtr userToken)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string AuthenticationType
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool IsAnonymous
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool IsAuthenticated
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool IsGuest
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool IsSystem
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual string Name
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual IntPtr Token
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ void IDeserializationCallback.OnDeserialization (object sender)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Principal/WindowsImpersonationContext.cs b/mcs/class/corlib/System.Security.Principal/WindowsImpersonationContext.cs
new file mode 100644
index 00000000000..a1c4f214a60
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WindowsImpersonationContext.cs
@@ -0,0 +1,31 @@
+//
+// System.Security.Principal.WindowsImpersonationContext
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.Security.Principal
+{
+ public class WindowsImpersonationContext
+ {
+ internal WindowsImpersonationContext ()
+ {
+ }
+
+ ~WindowsImpersonationContext ()
+ {
+ }
+
+ [MonoTODO]
+ public void Undo ()
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security/ChangeLog b/mcs/class/corlib/System.Security/ChangeLog
new file mode 100755
index 00000000000..87c3fade5f0
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ChangeLog
@@ -0,0 +1,67 @@
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * IEvidenceFactory.cs (Evidence): Added missing method.
+
+ * SuppressUnmanagedCodeSecurityAttribute.cs:
+ * UnverifiableCodeAttribute.cs: Added missing
+ AttributeUsage attribute.
+
+2002-06-05 Nick Drochak <ndrochak@gol.com>
+
+ * SecurityElement.cs: Fixed couple of hard to spot typos which were
+ causing valid names and keys to be rejected.
+
+2002-04-28 Lawrence Pit <loz@cable.a2000.nl>
+
+ * CodeAccessPermission.cs : implemented ToString method
+
+2002-04-27 Lawrence Pit <loz@cable.a2000.nl>
+
+ * SecurityElement.cs: fixed bugs, implemented several methods
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * SecurityException.cs: Inherit from SystemException, not Exception.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * SecurityElement.cs: fixed typo
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * NamedPermissionSet.cs: New file (stub)
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * SecurityException.cs: Reformatted to fit the form of other
+ Exceptions. Added serialization bits.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * SecurityElement.cs : Insert MonoTODO attribute.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * CodeAccessPermission.cs: Fix syntax error hidden by exclusion in .build file
+
+2001-12-30 Nick Drochak <ndrochak@gol.com>
+
+ * PermissionSet.cs SecurityManager.cs: New Files
+ * CodeAccessPermission.cs: Add Skeleton code
+ * IPermission.cs: Make public and inherit from ISecurityEncodable
+ * ISecurityEncodable.cs: Make interface public
+ * ISecurityPolicyEncodable.cs: Ditto
+ * IStackWalk.cs: Ditto
+
+2001-12-29 Nick Drochak <ndrochak@gol.com>
+
+ * ISecurityPolicyEncodable.cs, PolicyLevelType.cs,
+ SecurityZone.cs, SecurityException.cs, UnverifiableCodeAttribute.cs,
+ SuppressUnmanagedCodeSecurityAttribute.cs,
+ VerificationException.cs, XmlSyntaxException.cs: New files
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * SecurityElement.cs, CodeAccessPermission.cs IPermission.cs
+ IStackWalk.cs SecurityElement.cs ISecurityEncodable.cs: New files.
+
diff --git a/mcs/class/corlib/System.Security/CodeAccessPermission.cs b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
new file mode 100755
index 00000000000..3994f785dcf
--- /dev/null
+++ b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
@@ -0,0 +1,86 @@
+//
+// System.Security.CodeAccessPermission.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ [Serializable]
+ public abstract class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk
+ {
+ ///<summary>Constructs a new instance of the System.Security.CodeAccessPermission class.</summary>
+ protected CodeAccessPermission(){}
+
+ ///<summary> Asserts that calling code can access the resource identified by the current instance through the code that calls this method, even if callers have not been granted permission to access the resource. </summary>
+ ///<exception cref="System.Security.SecurityException">The calling code does not have System.Security.Permissions.SecurityPermissionFlag.Assertion. </exception>
+ public void Assert()
+ {
+ }
+
+ ///<summary> Returns a System.Security.CodeAccessPermission containing the same values as the current instance.</summary>
+ ///<returns> A new System.Security.CodeAccessPermission instance that is value equal to the current instance.</returns>
+ public abstract IPermission Copy();
+
+ ///<summary>Forces a System.Security.SecurityException if all callers do not have the permission specified by the current instance.</summary>
+ ///<exception cref="System.Security.SecurityException"> A caller does not have the permission specified by the current instance. A caller has called System.Security.CodeAccessPermission.Deny for the resource protected by the current instance. </exception>
+ public void Demand()
+ {
+ }
+
+ ///<summary> Denies access to the resources specified by the current instance through the code that calls this method.</summary>
+ public void Deny(){}
+
+ ///<summary> Reconstructs the state of a System.Security.CodeAccessPermission object using the specified XML encoding.</summary>
+ ///<param name="elem">A System.Security.SecurityElement instance containing the XML encoding to use to reconstruct the state of a System.Security.CodeAccessPermission object.</param>
+ ///<exception cref="System.ArgumentException">elem does not contain the XML encoding for a instance of the same type as the current instance.The version number of elem is not valid.</exception>
+ public abstract void FromXml(SecurityElement elem);
+
+ ///<summary> Returns a System.Security.CodeAccessPermission object that is the intersection of the current instance and the specified object.</summary>
+ ///<param name="target">A System.Security.CodeAccessPermission instance to intersect with the current instance.</param>
+ ///<returns> A new System.Security.CodeAccessPermission instance that represents the intersection of the current instance andtarget. If the intersection is empty or target is null, returns null. If the current instance is unrestricted, returns a copy of target. Iftarget is unrestricted, returns a copy of the current instance.</returns>
+ ///<exception cref="System.ArgumentException">target is not null and is not a System.Security.CodeAccessPermission object.</exception>
+ public abstract IPermission Intersect(IPermission target);
+
+ ///<summary>Determines whether the current instance is a subset of the specified object.</summary>
+ ///<param name="target">A System.Security.CodeAccessPermission instance that is to be tested for the subset relationship.</param>
+ ///<returns>true if the current instance is a subset of target; otherwise, false. If the current instance is unrestricted, and target is not, returnsfalse. If target is unrestricted, returns true.</returns>
+ ///<exception cref="System.ArgumentException">target is not null and is not of type System.Security.CodeAccessPermission.</exception>
+ public abstract bool IsSubsetOf(IPermission target);
+
+ ///<summary> Returns the XML representation of the state of the current instance.</summary>
+ ///<returns> A System.String containing the XML representation of the state of the current instance.</returns>
+ public override string ToString()
+ {
+ SecurityElement elem = ToXml ();
+ return elem == null ? null : elem.ToString ();
+ }
+
+ ///<summary> Returns the XML encoding of the current instance.</summary>
+ ///<returns>A System.Security.SecurityElement containing an XML encoding of the state of the current instance.</returns>
+ public abstract SecurityElement ToXml();
+
+ ///<summary> Returns a System.Security.CodeAccessPermission object that is the union of the current instance and the specified object.</summary>
+ ///<param name="other">A System.Security.IPermission object of the same type as the current instance to be combined with the current instance.</param>
+ ///<returns>If other is null, returns a copy of the current instance using the System.Security.IPermission.Copy method.</returns>
+ ///<exception cref="System.ArgumentException">other is not of type System.Security.CodeAccessPermission.</exception>
+ ///<exception cref="System.NotSupportedException">other is not null.</exception>
+ public virtual IPermission Union(IPermission other)
+ {
+ if (!(other is System.Security.CodeAccessPermission))
+ {
+ throw new System.ArgumentException(); // other is not of type System.Security.CodeAccessPermission.
+ }
+ if (null != other)
+ {
+ throw new System.NotSupportedException(); // other is not null.
+ }
+ return null;
+ }
+
+ public void PermitOnly(){}
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IEvidenceFactory.cs b/mcs/class/corlib/System.Security/IEvidenceFactory.cs
new file mode 100644
index 00000000000..ed9fc23e2e8
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IEvidenceFactory.cs
@@ -0,0 +1,15 @@
+// System.Security.IEvidenceFactory
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+using System.Security.Policy;
+
+namespace System.Security
+{
+ public interface IEvidenceFactory
+ {
+ Evidence Evidence { get; }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IPermission.cs b/mcs/class/corlib/System.Security/IPermission.cs
new file mode 100755
index 00000000000..63aabfd4c4a
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IPermission.cs
@@ -0,0 +1,24 @@
+//
+// System.Security.IPermission.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface IPermission : ISecurityEncodable {
+
+ IPermission Copy ();
+
+ void Demand ();
+
+ IPermission Intersect (IPermission target);
+
+ bool IsSubsetOf (IPermission target);
+
+ IPermission Union (IPermission target);
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ISecurityEncodable.cs b/mcs/class/corlib/System.Security/ISecurityEncodable.cs
new file mode 100755
index 00000000000..55b9ebe2f55
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ISecurityEncodable.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.ISecurityEncodable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface ISecurityEncodable {
+
+ void FromXml (SecurityElement e);
+
+ SecurityElement ToXml ();
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs b/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs
new file mode 100644
index 00000000000..66418ab91d0
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.ISecurityPolicyEncodable.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Security.Policy;
+
+namespace System.Security {
+
+ public interface ISecurityPolicyEncodable {
+
+ void FromXml (SecurityElement e, PolicyLevel level);
+
+ SecurityElement ToXml (PolicyLevel level);
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IStackWalk.cs b/mcs/class/corlib/System.Security/IStackWalk.cs
new file mode 100755
index 00000000000..f5b717ac57a
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IStackWalk.cs
@@ -0,0 +1,22 @@
+//
+// System.Security.IStackWalk.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface IStackWalk {
+
+ void Assert ();
+
+ void Demand ();
+
+ void Deny ();
+
+ void PermitOnly ();
+ }
+}
diff --git a/mcs/class/corlib/System.Security/NamedPermissionSet.cs b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
new file mode 100644
index 00000000000..0f500e6de98
--- /dev/null
+++ b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
@@ -0,0 +1,66 @@
+//
+// System.Security.NamedPermissionSet
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class NamedPermissionSet : PermissionSet {
+ public NamedPermissionSet (string name, PermissionSet set) : base (set) {
+ this.name = name;
+ this.description = "";
+ }
+
+ public NamedPermissionSet (string name, PermissionState state) : base (state) {
+ this.name = name;
+ this.description = "";
+ }
+
+ public NamedPermissionSet (NamedPermissionSet set) : this (set.name, set) {
+ }
+
+ public NamedPermissionSet (string name) : this (name, PermissionState.None) {
+ }
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public override PermissionSet Copy () {
+ return null;
+ }
+
+ public NamedPermissionSet Copy (string name) {
+ return null;
+ }
+
+ public override void FromXml (SecurityElement e) {
+ }
+
+ public override SecurityElement ToXml () {
+ return null;
+ }
+
+ // private
+
+ private string name;
+ private string description;
+ }
+}
diff --git a/mcs/class/corlib/System.Security/PermissionSet.cs b/mcs/class/corlib/System.Security/PermissionSet.cs
new file mode 100644
index 00000000000..96c9667b9be
--- /dev/null
+++ b/mcs/class/corlib/System.Security/PermissionSet.cs
@@ -0,0 +1,202 @@
+//
+// System.Security.PermissionSet.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Security;
+using System.Runtime.Serialization;
+
+namespace System.Security
+{
+ ///<summary> Represents a collection that can contain different kinds of permissions and perform security operations.</summary>
+ [Serializable]
+ public class PermissionSet: ISecurityEncodable, ICollection, IEnumerable, IStackWalk, IDeserializationCallback
+ {
+ ///<summary> Constructs a new instance of the System.Security.PermissionSet class with the specified value.</summary>
+ ///<param name="state">A System.Security.Permissions.PermissionState value. This value is either System.Security.Permissions.PermissionState.None or System.Security.Permissions.PermissionState.Unrestricted, to specify fully restricted or fully unrestricted access. </param>
+ ///<exception cref="System.ArgumentException">state is not a valid System.Security.Permissions.PermissionState value.</exception>
+ public PermissionSet(PermissionState state)
+ {
+ if (!Enum.IsDefined(typeof(System.Security.Permissions.PermissionState), state))
+ {
+ throw new System.ArgumentException(); // state is not a valid System.Security.Permissions.PermissionState value.
+ }
+ }
+
+ ///<summary> Constructs a new instance of the System.Security.PermissionSet class with the values of the specified System.Security.PermissionSet instance. </summary>
+ ///<param name="permSet">The System.Security.PermissionSet instance with which to initialize the values of the new instance, or null to initialize an empty permission set.</param>
+ ///<exception cref="System.ArgumentException">permSet is not an instance of System.Security.PermissionSet.</exception>
+ public PermissionSet(PermissionSet permSet)
+ {
+ // LAMESPEC: This would be handled by the compiler. No way permSet is not a PermissionSet.
+ //if (false)
+ //{
+ // throw new System.ArgumentException(); // permSet is not an instance of System.Security.PermissionSet.
+ //}
+ }
+
+ ///<summary> Adds the specified System.Security.IPermission object to the current instance if that permission does not already exist in the current instance.</summary>
+ ///<param name="perm">The System.Security.IPermission object to add.</param>
+ ///<returns>The System.Security.IPermission is added if perm is notnull and a permission of the same type as perm does not already exist in the current instance. If perm is null, returns null. If a permission of the same type asperm already exists in the current instance, the union of the existing permission and perm is added to the current instance and is returned.</returns>
+ ///<exception cref="System.ArgumentException">perm is not a System.Security.IPermission object.</exception>
+ public virtual IPermission AddPermission(IPermission perm)
+ {
+ // LAMESPEC: This would be handled by the compiler. No way perm is not an IPermission.
+ //if (false)
+ //{
+ // throw new System.ArgumentException(); // perm is not a System.Security.IPermission object.
+ //}
+ return null;
+ }
+
+ ///<summary>Asserts that calling code can access the resources identified by the permissions contained in the current instance through the code that calls this method, even if callers have not been granted permission to access the resource. </summary>
+ ///<exception cref="System.Security.SecurityException">The asserting code does not have sufficient permission to call this method.-or-This method was called with permissions already asserted for the current stack frame.</exception>
+ public virtual void Assert()
+ {
+ throw new System.Security.SecurityException(); // The asserting code does not have sufficient permission to call this method.-or-This method was called with permissions already asserted for the current stack frame.
+ }
+
+ ///<summary>Returns a new System.Security.PermissionSet containing copies of the objects in the current instance.</summary>
+ ///<returns>A new System.Security.PermissionSet that is value equal to the current instance.</returns>
+ public virtual PermissionSet Copy()
+ {
+ return null;
+ }
+
+ ///<summary>Copies the permission objects in the current instance to the specified location in the specified System.Array.</summary>
+ ///<param name="array">The destination System.Array.</param>
+ ///<param name="index">A System.Int32 that specifies the zero-based starting position in the array at which to begin copying.</param>
+ ///<exception cref="System.ArgumentException">array has more than one dimension.</exception>
+ ///<exception cref="System.IndexOutOfRangeException">index is outside the range of allowable values for array.</exception>
+ ///<exception cref="System.ArgumentNullException">array is null.</exception>
+ public virtual void CopyTo(Array array, int index)
+ {
+ if (array.Rank > 1)
+ {
+ throw new System.ArgumentException("Array has more than one dimension"); // array has more than one dimension.
+ }
+ if (index < 0 || index >= array.Length)
+ {
+ throw new System.IndexOutOfRangeException(); // index is outside the range of allowable values for array.
+ }
+ if (null == array)
+ {
+ throw new System.ArgumentNullException(); // array is null.
+ }
+ }
+
+ ///<summary>Forces a System.Security.SecurityException if all callers do not have the permissions specified by the objects contained in the current instance.</summary>
+ ///<exception cref="System.Security.SecurityException">A caller does not have the permission specified by the current instance.</exception>
+ public virtual void Demand()
+ {
+ throw new System.Security.SecurityException(); // A caller does not have the permission specified by the current instance.
+ }
+
+ ///<summary>Denies access to the resources secured by the objects contained in the current instance through the code that calls this method.</summary>
+ ///<exception cref="System.Security.SecurityException">A previous call to Deny has already restricted the permissions for the current stack frame.</exception>
+ public virtual void Deny()
+ {
+ throw new System.Security.SecurityException(); // A previous call to Deny has already restricted the permissions for the current stack frame.
+ }
+
+ ///<summary>Reconstructs the state of a System.Security.PermissionSet object using the specified XML encoding.</summary>
+ ///<param name="et">A System.Security.SecurityElement instance containing the XML encoding to use to reconstruct the state of a System.Security.PermissionSet object.</param>
+ ///<exception cref="System.ArgumentNullException">et is null.</exception>
+ ///<exception cref="System.ArgumentException">et does not contain an XML encoding for a System.Security.PermissionSet instance.An error occurred while reconstructing et.</exception>
+ public virtual void FromXml(SecurityElement et)
+ {
+ if (null == et)
+ {
+ throw new System.ArgumentNullException("et"); // et is null.
+ }
+ if (true)
+ {
+ throw new System.ArgumentException("et does not contain an XML encoding for a System.Security.PermissionSet instance."); // et does not contain an XML encoding for a System.Security.PermissionSet instance.An error occurred while reconstructing et.
+ }
+ }
+
+ ///<summary> Returns an enumerator used to iterate over the permissions in the current instance.</summary>
+ ///<returns>A System.Collections.IEnumerator object for the permissions of the set.</returns>
+ public virtual IEnumerator GetEnumerator()
+ {
+ return null;
+ }
+
+ ///<summary> Determines whether the current instance is a subset of the specified object.</summary>
+ ///<param name="target">A System.Security.PermissionSet instance that is to be tested for the subset relationship. </param>
+ ///<returns>true if the current instance is a subset of target; otherwise, false. If the current instance is unrestricted, andtarget is not, returns false. If target is unrestricted, returns true.</returns>
+ public virtual bool IsSubsetOf(PermissionSet target)
+ {
+ return false;
+ }
+
+ ///<summary> Specifies that only the resources described by the current instance can be accessed by calling code, even if the code has been granted permission to access other resources.</summary>
+ ///<exception cref="System.Security.SecurityException">A previous call to PermitOnly has already set the permissions for the current stack frame.</exception>
+ public virtual void PermitOnly()
+ {
+ if (true)
+ {
+ throw new System.Security.SecurityException(); // A previous call to PermitOnly has already set the permissions for the current stack frame.
+ }
+ }
+
+ ///<summary> Returns a System.String representation of the state of the current instance.</summary>
+ ///<returns>A System.Stringcontaining the XML representation of the state of the current instance.</returns>
+ public override string ToString()
+ {
+ return null;
+ }
+
+ ///<summary>Returns the XML encoding of the current instance.</summary>
+ ///<returns>A System.Security.SecurityElement containing an XML encoding of the state of the current instance.</returns>
+ public virtual SecurityElement ToXml()
+ {
+ return null;
+ }
+
+ ///<summary> Returns a System.Security.PermissionSet object that is the union of the current instance and the specified object.</summary>
+ ///<param name="other">A System.Security.PermissionSet instance to be combined with the current instance.</param>
+ ///<returns> A new System.Security.PermissionSet instance that represents the union of the current instance and other. If the current instance or other is unrestricted, returns a System.Security.PermissionSet instance that is unrestricted.</returns>
+ public virtual PermissionSet Union(PermissionSet other)
+ {
+ return null;
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.Count.]</summary>
+ int ICollection.Count
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.IsSynchronized.]</summary>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.SyncRoot.]</summary>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ void IDeserializationCallback.OnDeserialization(object sender){}
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security/PolicyLevelType.cs b/mcs/class/corlib/System.Security/PolicyLevelType.cs
new file mode 100644
index 00000000000..a7414010104
--- /dev/null
+++ b/mcs/class/corlib/System.Security/PolicyLevelType.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.PolicyLevelType.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public enum PolicyLevelType {
+ User = 0x0,
+ Machine,
+ Enterprise,
+ AppDomain,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityElement.cs b/mcs/class/corlib/System.Security/SecurityElement.cs
new file mode 100755
index 00000000000..4aeb033328b
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityElement.cs
@@ -0,0 +1,340 @@
+//
+// System.Security.SecurityElement.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+
+using System.Globalization;
+using System.Collections;
+using System.Text;
+
+namespace System.Security
+{
+ [Serializable]
+ public sealed class SecurityElement
+ {
+ string text;
+ string tag;
+ Hashtable attributes;
+ ArrayList children;
+
+ // these values are determined by a simple test program against the MS.Net implementation:
+ // for (int i = 0; i < 256; i++) {
+ // if (!SecurityElement.IsValidTag ("" + ((char) i))) {
+ // System.Console.WriteLine ("TAG: " + i);
+ // }
+ // }
+ // note: this is actually an incorrect implementation of MS, as for example the &
+ // character is not a valid character in tag names.
+ private static char [] invalid_tag_chars = new char [] { ' ', '<', '>' };
+ private static char [] invalid_text_chars = new char [] { '<', '>' };
+ private static char [] invalid_attr_name_chars = new char [] { ' ', '<', '>' };
+ private static char [] invalid_attr_value_chars = new char [] { '"', '<', '>' };
+ private static char [] invalid_chars = new char [] { '<', '>', '"', '\'', '&' };
+
+ public SecurityElement (string tag) : this (tag, null)
+ {
+ }
+
+ public SecurityElement (string tag, string text)
+ {
+ this.Tag = tag;
+ this.Text = (text == null) ? String.Empty : text;
+ }
+
+ public Hashtable Attributes {
+ get {
+ if (attributes == null)
+ return null;
+
+ Hashtable result = new Hashtable ();
+ IDictionaryEnumerator e = attributes.GetEnumerator ();
+ while (e.MoveNext ())
+ result.Add (e.Key, e.Value);
+ return result;
+ }
+
+ set {
+ if (value == null || value.Count == 0) {
+ attributes = null;
+ return;
+ }
+
+ Hashtable result = new Hashtable ();
+ IDictionaryEnumerator e = value.GetEnumerator ();
+ while (e.MoveNext ()) {
+ string key = (string) e.Key;
+ string val = (string) e.Value;
+ if (!IsValidAttributeName (key))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + key);
+
+ if (!IsValidAttributeValue (val))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + key);
+
+ result.Add (key, val);
+ }
+ attributes = result;
+ }
+ }
+
+ public ArrayList Children {
+ get {
+ return children;
+ }
+
+ set {
+ if (value != null) {
+ foreach (object o in value) {
+ if (o == null)
+ throw new ArgumentNullException ();
+ // shouldn't we also throw an exception
+ // when o isn't an instance of SecurityElement?
+ }
+ }
+ children = value;
+ }
+ }
+
+ public string Tag {
+ get {
+ return tag;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (!IsValidTag (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + value);
+ tag = value;
+ }
+ }
+
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ if (!IsValidText (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + text);
+ text = value;
+ }
+ }
+
+ public void AddAttribute (string name, string value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ();
+
+ if (attributes == null)
+ attributes = new Hashtable ();
+
+ //
+ // The hashtable will throw ArgumentException if name is already there
+ //
+
+ if (!IsValidAttributeName (name))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + name);
+
+ if (!IsValidAttributeValue (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + value);
+
+ attributes.Add (name, value);
+ }
+
+ public void AddChild (SecurityElement child)
+ {
+ if (child == null)
+ throw new ArgumentNullException ();
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (child);
+ }
+
+ public string Attribute (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ if (attributes != null)
+ return (string) attributes [name];
+ else
+ return null;
+ }
+
+ public bool Equal (SecurityElement other)
+ {
+ if (other == null)
+ return false;
+
+ if (this == other)
+ return true;
+
+ if (this.text != other.text)
+ return false;
+
+ if (this.tag != other.tag)
+ return false;
+
+ if (this.attributes == null && other.attributes != null && other.attributes.Count != 0)
+ return false;
+
+ if (other.attributes == null && this.attributes != null && this.attributes.Count != 0)
+ return false;
+
+ if (this.attributes != null && other.attributes != null) {
+ if (this.attributes.Count != other.attributes.Count)
+ return false;
+ IDictionaryEnumerator e = attributes.GetEnumerator ();
+ while (e.MoveNext ())
+ if (other.attributes [e.Key] != e.Value)
+ return false;
+ }
+
+ if (this.children == null && other.children != null && other.children.Count != 0)
+ return false;
+
+ if (other.children == null && this.children != null && this.children.Count != 0)
+ return false;
+
+ if (this.children != null && other.children != null) {
+ if (this.children.Count != other.children.Count)
+ return false;
+ for (int i = 0; i < this.children.Count; i++)
+ if (!((SecurityElement) this.children [i]).Equal ((SecurityElement) other.children [i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ public static string Escape (string str)
+ {
+ StringBuilder sb;
+
+ if (str.IndexOfAny (invalid_chars) == -1)
+ return str;
+
+ sb = new StringBuilder ();
+ int len = str.Length;
+
+ for (int i = 0; i < len; i++) {
+ char c = str [i];
+
+ switch (c) {
+ case '<': sb.Append ("&lt;"); break;
+ case '>': sb.Append ("&gt;"); break;
+ case '"': sb.Append ("&quot;"); break;
+ case '\'': sb.Append ("&apos;"); break;
+ case '&': sb.Append ("&amp;"); break;
+ default: sb.Append (c); break;
+ }
+ }
+
+ return sb.ToString ();
+ }
+
+ public static bool IsValidAttributeName (string name)
+ {
+ return name != null && name.IndexOfAny (invalid_attr_name_chars) == -1;
+ }
+
+ public static bool IsValidAttributeValue (string value)
+ {
+ return value != null && value.IndexOfAny (invalid_attr_value_chars) == -1;
+ }
+
+ public static bool IsValidTag (string value)
+ {
+ return value != null && value.IndexOfAny (invalid_tag_chars) == -1;
+ }
+
+ public static bool IsValidText (string value)
+ {
+ return value != null && value.IndexOfAny (invalid_text_chars) == -1;
+ }
+
+ public SecurityElement SearchForChildByTag (string tag)
+ {
+ if (tag == null)
+ throw new ArgumentNullException ("tag");
+
+ if (this.children == null)
+ return null;
+
+ for (int i = 0; i < children.Count; i++) {
+ SecurityElement elem = (SecurityElement) children [i];
+ if (elem.tag == tag)
+ return elem;
+ }
+ return null;
+ }
+
+ public string SearchForTextOfTag (string tag)
+ {
+ if (tag == null)
+ throw new ArgumentNullException ("tag");
+
+ if (this.tag == tag)
+ return this.text;
+
+ if (this.children == null)
+ return null;
+
+ for (int i = 0; i < children.Count; i++) {
+ string result = ((SecurityElement) children [i]).SearchForTextOfTag (tag);
+ if (result != null)
+ return result;
+ }
+
+ return null;
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder s = new StringBuilder ();
+ ToXml (ref s, 0);
+ return s.ToString ();
+ }
+
+ private void ToXml(ref StringBuilder s, int level)
+ {
+ s.Append (' ', level << 2);
+ s.Append ("<");
+ s.Append (tag);
+
+ if (attributes != null) {
+ IDictionaryEnumerator e = attributes.GetEnumerator ();
+ while (e.MoveNext ()) {
+ s.Append (" ")
+ .Append (e.Key)
+ .Append ("=\"")
+ .Append (e.Value)
+ .Append ("\"");
+ }
+ }
+
+ if ((text == null || text == String.Empty) &&
+ (children == null || children.Count == 0))
+ s.Append ("/>");
+ else {
+ s.Append (">").Append (text);
+ if (children != null) {
+ foreach (SecurityElement child in children) {
+ s.Append (Environment.NewLine);
+ child.ToXml (ref s, level + 1);
+ }
+ }
+ s.Append (Environment.NewLine)
+ .Append (' ', level << 2)
+ .Append ("</")
+ .Append (tag)
+ .Append (">");
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityException.cs b/mcs/class/corlib/System.Security/SecurityException.cs
new file mode 100644
index 00000000000..aaa0086bbe2
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityException.cs
@@ -0,0 +1,79 @@
+//
+// System.Security.SecurityException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public class SecurityException : SystemException {
+
+ // Fields
+ string permissionState;
+ Type permissionType;
+
+ // Properties
+ public string PermissionState
+ {
+ get { return permissionState; }
+ }
+
+ public Type PermissionType
+ {
+ get { return permissionType; }
+ }
+
+ // Constructors
+ public SecurityException ()
+ : base (Locale.GetText ("A security error has been detected."))
+ {
+ }
+
+ public SecurityException (string message)
+ : base (message)
+ {
+ }
+
+ protected SecurityException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ permissionState = info.GetString ("permissionState");
+ }
+
+ public SecurityException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public SecurityException (string message, Type type)
+ : base (message)
+ {
+ permissionType = type;
+ }
+
+ public SecurityException (string message, Type type, string state)
+ : base (message)
+ {
+ permissionType = type;
+ permissionState = state;
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("PermissionState", permissionState);
+ }
+
+ public override string ToString ()
+ {
+ return permissionType.FullName + ": " + permissionState;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs
new file mode 100644
index 00000000000..d29a2845c63
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityManager.cs
@@ -0,0 +1,88 @@
+//
+// System.Security.SecurityManager.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Security.Policy;
+using System.Collections;
+
+namespace System.Security {
+
+ public sealed class SecurityManager {
+ private static bool checkExecutionRights;
+ private static bool securityEnabled;
+
+ private SecurityManager () {}
+
+ public static bool CheckExecutionRights {
+ get{
+ return checkExecutionRights;
+ }
+ set{
+ checkExecutionRights = value;
+ }
+ }
+
+ public static bool SecurityEnabled {
+ get{
+ return securityEnabled;
+ }
+ set{
+ securityEnabled = value;
+ }
+ }
+
+ public static bool IsGranted(IPermission perm){
+ return false;
+ }
+
+ public static PolicyLevel LoadPolicyLevelFromFile(
+ string path,
+ PolicyLevelType type)
+ {
+ return null;
+ }
+
+ public static PolicyLevel LoadPolicyLevelFromString(
+ string str,
+ PolicyLevelType type)
+ {
+ if (null == str){
+ throw new ArgumentNullException("str");
+ }
+ return null;
+ }
+
+ public static IEnumerator PolicyHierarchy(){
+ return null;
+ }
+
+ public static PermissionSet ResolvePolicy(Evidence evidence){
+ return null;
+ }
+
+ public static PermissionSet ResolvePolicy(
+ Evidence evidence,
+ PermissionSet reqdPset,
+ PermissionSet optPset,
+ PermissionSet denyPset,
+ out PermissionSet denied)
+ {
+ denied = null;
+ return null;
+ }
+
+ public static IEnumerator ResolvePolicyGroups(Evidence evidence){
+ return null;
+ }
+
+ public static void SavePolicy(){}
+
+ public static void SavePolicyLevel(PolicyLevel level){}
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityZone.cs b/mcs/class/corlib/System.Security/SecurityZone.cs
new file mode 100644
index 00000000000..68a7014d5d4
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityZone.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.SecurityZone.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public enum SecurityZone {
+ MyComputer = 0x0,
+ Intranet,
+ Trusted,
+ Internet,
+ Untrusted,
+ NoZone = -1,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
new file mode 100644
index 00000000000..58ac28dcec5
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
@@ -0,0 +1,15 @@
+//
+// System.Security.SuppressUnmanagedCodeSecurityAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method |
+ AttributeTargets.Interface)]
+ public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute {}
+}
diff --git a/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
new file mode 100644
index 00000000000..6cfb5bda372
--- /dev/null
+++ b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
@@ -0,0 +1,14 @@
+//
+// System.Security.UnverifiableCodeAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [AttributeUsage (AttributeTargets.Module)]
+ public sealed class UnverifiableCodeAttribute : Attribute {}
+}
diff --git a/mcs/class/corlib/System.Security/VerificationException.cs b/mcs/class/corlib/System.Security/VerificationException.cs
new file mode 100644
index 00000000000..277ea55cd37
--- /dev/null
+++ b/mcs/class/corlib/System.Security/VerificationException.cs
@@ -0,0 +1,26 @@
+//
+// System.Security.VerificationException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public class VerificationException : SystemException {
+
+ // Constructors
+ public VerificationException(){}
+ public VerificationException(string message)
+ : base (message){}
+ protected VerificationException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {}
+ public VerificationException(string message, Exception inner)
+ : base (message, inner) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Security/XmlSyntaxException.cs b/mcs/class/corlib/System.Security/XmlSyntaxException.cs
new file mode 100644
index 00000000000..91e2c5bc9fa
--- /dev/null
+++ b/mcs/class/corlib/System.Security/XmlSyntaxException.cs
@@ -0,0 +1,27 @@
+//
+// System.Security.XmlSyntaxException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public sealed class XmlSyntaxException : SystemException {
+
+ // Constructors
+ public XmlSyntaxException(){}
+ public XmlSyntaxException(int lineNumber)
+ : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + "."){}
+ public XmlSyntaxException(int lineNumber, string message)
+ : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + " - " + message ){}
+ public XmlSyntaxException(string message)
+ : base (message){}
+ public XmlSyntaxException(string message, Exception inner)
+ : base (message, inner) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Text/ASCIIEncoding.cs b/mcs/class/corlib/System.Text/ASCIIEncoding.cs
new file mode 100755
index 00000000000..192fad3f258
--- /dev/null
+++ b/mcs/class/corlib/System.Text/ASCIIEncoding.cs
@@ -0,0 +1,282 @@
+/*
+ * ASCIIEncoding.cs - Implementation of the "System.Text.ASCIIEncoding" class.
+ *
+ * Copyright (c) 2001 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+[Serializable]
+public class ASCIIEncoding : Encoding
+{
+ // Magic number used by Windows for "ASCII".
+ internal const int ASCII_CODE_PAGE = 20127;
+
+ // Constructor.
+ public ASCIIEncoding () : base(ASCII_CODE_PAGE) {}
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount (char[] chars, int index, int count)
+ {
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (index < 0 || index > chars.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (chars.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Convenience wrappers for "GetByteCount".
+ public override int GetByteCount (String s)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ return s.Length;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if (charCount < 0 || charCount > (chars.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_Array"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if ((bytes.Length - byteIndex) < charCount) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int count = charCount;
+ char ch;
+ while (count-- > 0) {
+ ch = chars [charIndex++];
+ if (ch < (char)0x80) {
+ bytes [byteIndex++] = (byte)ch;
+ } else {
+ bytes [byteIndex++] = (byte)'?';
+ }
+ }
+ return charCount;
+ }
+
+ // Convenience wrappers for "GetBytes".
+ public override int GetBytes (String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > s.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_StringIndex"));
+ }
+ if (charCount < 0 || charCount > (s.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_StringRange"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if ((bytes.Length - byteIndex) < charCount) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int count = charCount;
+ char ch;
+ while (count-- > 0) {
+ ch = s [charIndex++];
+ if (ch < (char)0x80) {
+ bytes [byteIndex++] = (byte)ch;
+ } else {
+ bytes [byteIndex++] = (byte)'?';
+ }
+ }
+ return charCount;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if (byteCount < 0 || byteCount > (bytes.Length - byteIndex)) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_Array"));
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if ((chars.Length - charIndex) < byteCount) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int count = byteCount;
+ while (count-- > 0) {
+ chars [charIndex++] = (char)(bytes [byteIndex++]);
+ }
+ return byteCount;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount (int charCount)
+ {
+ if (charCount < 0) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_NonNegative"));
+ }
+ return charCount;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount (int byteCount)
+ {
+ if (byteCount < 0) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+ // Decode a buffer of bytes into a string.
+ public override String GetString (byte[] bytes, int index, int count)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ unsafe {
+ fixed (byte *ss = &bytes [0]) {
+ return new String ((sbyte*)ss, index, count);
+ }
+ }
+ }
+ public override String GetString (byte[] bytes)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ int count = bytes.Length;
+ unsafe {
+ fixed (byte *ss = &bytes [0]) {
+ return new String ((sbyte*)ss, 0, count);
+ }
+ }
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get {
+ return "us-ascii";
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get {
+ return "US-ASCII";
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get {
+ return "us-ascii";
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public override bool IsMailNewsDisplay
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public override bool IsMailNewsSave
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get {
+ return "us-ascii";
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+}; // class ASCIIEncoding
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog
new file mode 100755
index 00000000000..8b5ca252c94
--- /dev/null
+++ b/mcs/class/corlib/System.Text/ChangeLog
@@ -0,0 +1,221 @@
+2002-12-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Encoding.cs: g_get_encoding () returns "ASCII". In Default, when the
+ encoding is not found, default to UTF8Unmarked. Removed comment in
+ UnixConsoleEncoding, because it's now Default, which gets the
+ encoding internally using g_get_encoding ().
+
+2002-12-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: fixed constructor. Thanks to marcusU for reporting.
+
+Tue Nov 19 13:03:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * UTF8Encoding.cs: fix GetByteCount (), too.
+
+2002-11-19 Miguel de Icaza <miguel@ximian.com>
+
+ * UnicodeEncoding.cs: the bytemark should only be used to return
+ information in GetPreamble, not to actually encode the information
+ on the stream. That is taken care of by the Stream classes.
+
+ * UTF8Encoding.cs: ditto.
+
+2002-11-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: only move the remaining chars in Remove.
+
+2002-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Encoding.cs: unixConsoleEncoding is now the same as Default. Avoid
+ locking whenever possible.
+
+2002-10-30 Miguel de Icaza <miguel@ximian.com>
+
+ * Encoding.cs (UTF8Unmarked): New static property, used to return
+ a no-markers UTf8 encoder, used in a few places in the class library.
+
+2002-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Encoding.cs (UTF8, Unicode): Create with a preamble, that is
+ what the Microsoft version does.
+
+ (UnixConsoleEncoding): New internal method, used to get the
+ encoding, in the future, this should pull the locale, map to
+ charset and then code page.
+
+Wed Sep 4 14:01:25 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Encoding.cs: use icall to get default codepage.
+ * DefaultEncoding.cs: remove useless class.
+
+Mon Aug 26 16:44:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * *.cs: change to conform to mono coding style.
+
+2002-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ASCIIEncoding.cs:
+ * Decoder.cs:
+ * Encoder.cs:
+ * Encoding.cs:
+ * UTF7Encoding.cs:
+ * UTF8Encoding.cs:
+ * UnicodeEncoding.cs: added Serializable attribute.
+
+2002-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: improved performace by using String.InternalCopyTo
+ instead of using ToCharArray all over the place (more that 50% of
+ speed improvement when using Append).
+
+Wed Aug 21 20:02:04 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * *.cs: imported the code donated by Rhys Weatherley
+ <rweather@southern-storm.com.au>.
+
+2002-08-18 Dick Porter <dick@ximian.com>
+
+ * Encoding.cs: Make GetString() return a useful representation of
+ the bytes, rather than "System.Char[]"
+
+2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: added IndexerName to indexer.
+
+2002-08-01 Jason Diamond <jason@injektilo.org>
+
+ * Encoding.cs: Use GetByteCount instead of GetMaxByteCount when
+ converting chars to bytes.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: updated comments. MaxCapacity always returns
+ Int32.MaxValue.
+
+2002-06-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: implemented AppendFormat methods using
+ String.Format. Thanks Paolo!
+
+ This makes xsp generate correct C# output in linux :-). I still need
+ to do more testing, though.
+
+Mon Jun 3 12:58:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ASCIIEncoding.cs: fixed handling of 0 bytecount.
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * Encoder.cs (IConvEncoder.GetByteCount, IConvEncoder.GetBytes):
+ Added exception handling.
+
+ * Decoder.cs (IConvDecoder.GetCharCount, IConvDecoder.GetChars):
+ Added exception handling.
+
+2002/04/02 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs (Append): Removed obsolete overload.
+
+2002-03-21 Mike Kestner <mkestner@speakeasy.net>
+
+ * ASCIIEncoding.cs : Fix off by one error in Get(Char|Byte)Count.
+
+Thu Mar 21 17:38:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: no need to intern the string returned by ToString().
+
+2002-03-17 Mike Kestner <mkestner@speakeasy.net>
+
+ * ASCIIEncoding.cs: Implement all the overridden methods. No longer
+ dependent on iconv icalls.
+ * Encoding.cs: Fix count bugs in GetBytes and GetChars. Add virtual
+ to GetBytes.
+
+Wed Mar 13 00:26:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: make ToString() return a interned string, this
+ seems to be required to make switch on string work.
+
+Fri Mar 8 17:29:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: make Append(char) do the smart thing.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ASCIIEncoding.cs, Encoding.cs, UTF7Encoding.cs,
+ UnicodeEncoding.cs: MonoTODO attribute marking.
+
+ * StringBuilder.cs : Ditto.
+
+Wed Nov 14 17:05:22 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Encoding.cs: renamed some fields.
+ * StringBuilder.cs: CLSCompliant updates.
+
+2001-10-29 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs: Throw exceptions when constructor paramter(s) are
+ invalid. Just like MS does (as best as I can tell).
+
+ Tests for these exceptions are now added to the unit tests as well.
+
+2001-10-25 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs: Throw exception if they try to make a StringBuilder
+ whose capacity is greater than the MaxCapacity.
+
+ I added some tests for the constructors and the above exception. More
+ coming soon.
+
+2001-10-23 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs: Refactored constructor code into just one
+ constructor. All the other construtors call it. Also supplied missing
+ constructors so the class has all those in the spec.
+
+ Added the MaxCapacity property as well, however this needs to be
+ completed to return a value is related to the available system memory.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * Encoding.cs, UTF8Encoding.cs, UTF7Encoding.cs, ASCIIEncoding.cs,
+ UnicodeEncoding.cs: Corrected API.
+
+ * UTF8Encoding.cs: Checked in changes from Rafael.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * UTF8Encoding.cs: impl. clumsy GetBytes
+
+2001-07-16 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringBuilder.cs (Text): Fixed.
+
+ * StringBuilderTest.cs: Implement Test suite.
+
+2001-07-12 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringBuilder.cs: Implemented.
+
+ The only methods left unimplemented are the AppendFormat( ... )
+ ones just because it's probably better to wait until some of the
+ Format related classes are implemented. I've put that as a TODO
+ comment at the top and created the methods with a "nop" body.
+
+2001-06-26 Sean MacIsaac <macisaac@ximian.com>
+
+ * UnicodeEncoding.cs: Members added so that a clean compile is
+ possible.
+
+ * ASCIIEncoding.cs: Members added so that a clean compile is
+ possible.
+
+ * UTF7Encoding.cs: Members added so that a clean compile is
+ possible.
+
+ * UTF8Encoding.cs: Members added so that a clean compile is
+ possible.
+
+ * Encoding.cs: All public members included. Most members
+ unimplemented.
diff --git a/mcs/class/corlib/System.Text/Decoder.cs b/mcs/class/corlib/System.Text/Decoder.cs
new file mode 100644
index 00000000000..d8d4c5bfad1
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Decoder.cs
@@ -0,0 +1,46 @@
+/*
+ * Decoder.cs - Implementation of the "System.Text.Decoder" class.
+ *
+ * Copyright (c) 2001 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+[Serializable]
+public abstract class Decoder
+{
+
+ // Constructor.
+ protected Decoder () {}
+
+ // Get the number of characters needed to decode a buffer.
+ public abstract int GetCharCount (byte[] bytes, int index, int count);
+
+ // Get the characters that result from decoding a buffer.
+ public abstract int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex);
+
+}; // class Decoder
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/Encoder.cs b/mcs/class/corlib/System.Text/Encoder.cs
new file mode 100644
index 00000000000..4fbe69b87a4
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Encoder.cs
@@ -0,0 +1,47 @@
+/*
+ * Encoder.cs - Implementation of the "System.Text.Encoder" class.
+ *
+ * Copyright (c) 2001 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+[Serializable]
+public abstract class Encoder
+{
+
+ // Constructor.
+ protected Encoder() {}
+
+ // Get the number of bytes needed to encode a buffer.
+ public abstract int GetByteCount(char[] chars, int index,
+ int count, bool flush);
+
+ // Get the bytes that result from decoding a buffer.
+ public abstract int GetBytes(char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex, bool flush);
+
+}; // class Encoder
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/Encoding.cs b/mcs/class/corlib/System.Text/Encoding.cs
new file mode 100755
index 00000000000..ffd71e0499d
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Encoding.cs
@@ -0,0 +1,767 @@
+/*
+ * Encoding.cs - Implementation of the "System.Text.Encoding" class.
+ *
+ * Copyright (c) 2001, 2002 Southern Storm Software, Pty Ltd
+ * Copyright (c) 2002, Ximian, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+using System.Reflection;
+using System.Globalization;
+using System.Security;
+using System.Runtime.CompilerServices;
+
+[Serializable]
+public abstract class Encoding
+{
+ // Code page used by this encoding.
+ internal int codePage;
+
+ // Constructor.
+ protected Encoding ()
+ {
+ codePage = 0;
+ }
+#if ECMA_COMPAT
+ protected internal
+#else
+ protected
+#endif
+ Encoding (int codePage)
+ {
+ this.codePage = codePage;
+ }
+
+ // until we change the callers:
+ internal static string _ (string arg) {
+ return arg;
+ }
+
+ // Convert between two encodings.
+ public static byte[] Convert (Encoding srcEncoding, Encoding dstEncoding,
+ byte[] bytes)
+ {
+ if (srcEncoding == null) {
+ throw new ArgumentNullException ("srcEncoding");
+ }
+ if (dstEncoding == null) {
+ throw new ArgumentNullException ("dstEncoding");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ return dstEncoding.GetBytes (srcEncoding.GetChars (bytes, 0, bytes.Length));
+ }
+ public static byte[] Convert (Encoding srcEncoding, Encoding dstEncoding,
+ byte[] bytes, int index, int count)
+ {
+ if (srcEncoding == null) {
+ throw new ArgumentNullException ("srcEncoding");
+ }
+ if (dstEncoding == null) {
+ throw new ArgumentNullException ("dstEncoding");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException
+ ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || (bytes.Length - index) < count) {
+ throw new ArgumentOutOfRangeException
+ ("count", _("ArgRange_Array"));
+ }
+ return dstEncoding.GetBytes (srcEncoding.GetChars (bytes, index, count));
+ }
+
+ // Determine if two Encoding objects are equal.
+ public override bool Equals (Object obj)
+ {
+ Encoding enc = (obj as Encoding);
+ if (enc != null) {
+ return (codePage == enc.codePage);
+ } else {
+ return false;
+ }
+ }
+
+ // Get the number of characters needed to encode a character buffer.
+ public abstract int GetByteCount (char[] chars, int index, int count);
+
+ // Convenience wrappers for "GetByteCount".
+ public virtual int GetByteCount (String s)
+ {
+ if (s != null) {
+ char[] chars = s.ToCharArray ();
+ return GetByteCount (chars, 0, chars.Length);
+ } else {
+ throw new ArgumentNullException ("s");
+ }
+ }
+ public virtual int GetByteCount (char[] chars)
+ {
+ if (chars != null) {
+ return GetByteCount (chars, 0, chars.Length);
+ } else {
+ throw new ArgumentNullException ("chars");
+ }
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public abstract int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex);
+
+ // Convenience wrappers for "GetBytes".
+ public virtual int GetBytes (String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ return GetBytes (s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
+ }
+ public virtual byte[] GetBytes (String s)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ char[] chars = s.ToCharArray ();
+ int numBytes = GetByteCount (chars, 0, chars.Length);
+ byte[] bytes = new byte [numBytes];
+ GetBytes (chars, 0, chars.Length, bytes, 0);
+ return bytes;
+ }
+ public virtual byte[] GetBytes (char[] chars, int index, int count)
+ {
+ int numBytes = GetByteCount (chars, index, count);
+ byte[] bytes = new byte [numBytes];
+ GetBytes (chars, index, count, bytes, 0);
+ return bytes;
+ }
+ public virtual byte[] GetBytes (char[] chars)
+ {
+ int numBytes = GetByteCount (chars, 0, chars.Length);
+ byte[] bytes = new byte [numBytes];
+ GetBytes (chars, 0, chars.Length, bytes, 0);
+ return bytes;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public abstract int GetCharCount (byte[] bytes, int index, int count);
+
+ // Convenience wrappers for "GetCharCount".
+ public virtual int GetCharCount (byte[] bytes)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ return GetCharCount (bytes, 0, bytes.Length);
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public abstract int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex);
+
+ // Convenience wrappers for "GetChars".
+ public virtual char[] GetChars (byte[] bytes, int index, int count)
+ {
+ int numChars = GetCharCount (bytes, index, count);
+ char[] chars = new char [numChars];
+ GetChars (bytes, index, count, chars, 0);
+ return chars;
+ }
+ public virtual char[] GetChars (byte[] bytes)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ int numChars = GetCharCount (bytes, 0, bytes.Length);
+ char[] chars = new char [numChars];
+ GetChars (bytes, 0, bytes.Length, chars, 0);
+ return chars;
+ }
+
+ // Get a decoder that forwards requests to this object.
+ public virtual Decoder GetDecoder ()
+ {
+ return new ForwardingDecoder (this);
+ }
+
+ // Get an encoder that forwards requests to this object.
+ public virtual Encoder GetEncoder ()
+ {
+ return new ForwardingEncoder (this);
+ }
+
+ // Loaded copy of the "I18N" assembly. We need to move
+ // this into a class in "System.Private" eventually.
+ private static Assembly i18nAssembly;
+ private static bool i18nDisabled;
+
+ // Invoke a specific method on the "I18N" manager object.
+ // Returns NULL if the method failed.
+ private static Object InvokeI18N (String name, params Object[] args)
+ {
+ lock (typeof(Encoding)) {
+ // Bail out if we previously detected that there
+ // is insufficent engine support for I18N handling.
+ if (i18nDisabled) {
+ return null;
+ }
+
+ // Find or load the "I18N" assembly.
+ if (i18nAssembly == null) {
+ try {
+ try {
+ i18nAssembly = Assembly.Load ("I18N");
+ } catch (NotImplementedException) {
+ // Assembly loading unsupported by the engine.
+ i18nDisabled = true;
+ return null;
+ }
+ if (i18nAssembly == null) {
+ return null;
+ }
+ } catch (SystemException) {
+ return null;
+ }
+ }
+
+ // Find the "I18N.Common.Manager" class.
+ Type managerClass;
+ try {
+ managerClass = i18nAssembly.GetType ("I18N.Common.Manager");
+ } catch (NotImplementedException) {
+ // "GetType" is not supported by the engine.
+ i18nDisabled = true;
+ return null;
+ }
+ if (managerClass == null) {
+ return null;
+ }
+
+ // Get the value of the "PrimaryManager" property.
+ Object manager;
+ try {
+ manager = managerClass.InvokeMember
+ ("PrimaryManager",
+ BindingFlags.GetProperty |
+ BindingFlags.Static |
+ BindingFlags.Public,
+ null, null, null, null, null, null);
+ if (manager == null) {
+ return null;
+ }
+ } catch (MissingMethodException) {
+ return null;
+ } catch (SecurityException) {
+ return null;
+ } catch (NotImplementedException) {
+ // "InvokeMember" is not supported by the engine.
+ i18nDisabled = true;
+ return null;
+ }
+
+ // Invoke the requested method on the manager.
+ try {
+ return managerClass.InvokeMember
+ (name,
+ BindingFlags.InvokeMethod |
+ BindingFlags.Instance |
+ BindingFlags.Public,
+ null, manager, args, null, null, null);
+ } catch (MissingMethodException) {
+ return null;
+ } catch (SecurityException) {
+ return null;
+ }
+ }
+ }
+
+ // Get an encoder for a specific code page.
+#if ECMA_COMPAT
+ private
+#else
+ public
+#endif
+ static Encoding GetEncoding (int codePage)
+ {
+ // Check for the builtin code pages first.
+ switch (codePage) {
+ case 0: return Default;
+
+ case ASCIIEncoding.ASCII_CODE_PAGE:
+ return ASCII;
+
+ case UTF7Encoding.UTF7_CODE_PAGE:
+ return UTF7;
+
+ case UTF8Encoding.UTF8_CODE_PAGE:
+ return UTF8;
+
+ case UnicodeEncoding.UNICODE_CODE_PAGE:
+ return Unicode;
+
+ case UnicodeEncoding.BIG_UNICODE_CODE_PAGE:
+ return BigEndianUnicode;
+
+ case Latin1Encoding.ISOLATIN_CODE_PAGE:
+ return ISOLatin1;
+
+ default: break;
+ }
+
+ // Try to obtain a code page handler from the I18N handler.
+ Encoding enc = (Encoding)(InvokeI18N ("GetEncoding", codePage));
+ if (enc != null) {
+ return enc;
+ }
+
+#if false
+ // Build a code page class name.
+ String cpName = "System.Text.CP" + codePage.ToString ();
+
+ // Look for a code page converter in this assembly.
+ Assembly assembly = Assembly.GetExecutingAssembly ();
+ Type type = assembly.GetType (cpName);
+ if (type != null) {
+ return (Encoding)(Activator.CreateInstance (type));
+ }
+
+ // Look in any assembly, in case the application
+ // has provided its own code page handler.
+ type = Type.GetType (cpName);
+ if (type != null) {
+ return (Encoding)(Activator.CreateInstance (type));
+ }
+#endif
+
+ // We have no idea how to handle this code page.
+ throw new NotSupportedException
+ (String.Format (_("NotSupp_CodePage"), codePage.ToString ()));
+ }
+
+#if !ECMA_COMPAT
+
+ // Table of builtin web encoding names and the corresponding code pages.
+ private static readonly String[] encodingNames =
+ {"ascii", "us-ascii", "utf-7", "utf-8", "utf-16",
+ "unicodeFFFE", "iso-8859-1"};
+ private static readonly int[] encodingCodePages =
+ {ASCIIEncoding.ASCII_CODE_PAGE,
+ ASCIIEncoding.ASCII_CODE_PAGE,
+ UTF7Encoding.UTF7_CODE_PAGE,
+ UTF8Encoding.UTF8_CODE_PAGE,
+ UnicodeEncoding.UNICODE_CODE_PAGE,
+ UnicodeEncoding.BIG_UNICODE_CODE_PAGE,
+ Latin1Encoding.ISOLATIN_CODE_PAGE};
+
+ // Get an encoding object for a specific web encoding name.
+ public static Encoding GetEncoding (String name)
+ {
+ // Validate the parameters.
+ if (name == null) {
+ throw new ArgumentNullException ("name");
+ }
+
+ // Search the table for a name match.
+ int posn;
+ for (posn = 0; posn < encodingNames.Length; ++posn) {
+ if (String.Compare(name, encodingNames[posn], true,
+ CultureInfo.InvariantCulture) == 0) {
+ return GetEncoding (encodingCodePages[posn]);
+ }
+ }
+
+ // Try to obtain a web encoding handler from the I18N handler.
+ Encoding enc = (Encoding)(InvokeI18N ("GetEncoding", name));
+ if (enc != null) {
+ return enc;
+ }
+
+#if false
+ // Build a web encoding class name.
+ String encName = "System.Text.ENC" +
+ name.ToLower (CultureInfo.InvariantCulture)
+ .Replace ('-', '_');
+
+ // Look for a code page converter in this assembly.
+ Assembly assembly = Assembly.GetExecutingAssembly ();
+ Type type = assembly.GetType (encName);
+ if (type != null) {
+ return (Encoding)(Activator.CreateInstance (type));
+ }
+
+ // Look in any assembly, in case the application
+ // has provided its own code page handler.
+ type = Type.GetType (encName);
+ if (type != null) {
+ return (Encoding)(Activator.CreateInstance (type));
+ }
+#endif
+
+ // We have no idea how to handle this encoding name.
+ throw new NotSupportedException (String.Format (_("NotSupp_EncodingName"), name));
+ }
+
+#endif // !ECMA_COMPAT
+
+ // Get a hash code for this instance.
+ public override int GetHashCode ()
+ {
+ return codePage;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public abstract int GetMaxByteCount (int charCount);
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public abstract int GetMaxCharCount (int byteCount);
+
+ // Get the identifying preamble for this encoding.
+ public virtual byte[] GetPreamble ()
+ {
+ return new byte [0];
+ }
+
+ // Decode a buffer of bytes into a string.
+ public virtual String GetString (byte[] bytes, int index, int count)
+ {
+ return new String (GetChars(bytes, index, count));
+ }
+ public virtual String GetString (byte[] bytes)
+ {
+ return new String (GetChars(bytes));
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public virtual String BodyName
+ {
+ get {
+ return null;
+ }
+ }
+
+ // Get the code page represented by this object.
+ public virtual int CodePage
+ {
+ get {
+ return codePage;
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public virtual String EncodingName
+ {
+ get {
+ return null;
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public virtual String HeaderName
+ {
+ get {
+ return null;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a Web browser.
+ public virtual bool IsBrowserDisplay
+ {
+ get {
+ return false;
+ }
+ }
+
+ // Determine if this encoding can be saved from a Web browser.
+ public virtual bool IsBrowserSave
+ {
+ get {
+ return false;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public virtual bool IsMailNewsDisplay
+ {
+ get {
+ return false;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public virtual bool IsMailNewsSave
+ {
+ get {
+ return false;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public virtual String WebName
+ {
+ get {
+ return null;
+ }
+ }
+
+ // Get the Windows code page represented by this object.
+ public virtual int WindowsCodePage
+ {
+ get {
+ // We make no distinction between normal and
+ // Windows code pages in this implementation.
+ return codePage;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+ // Storage for standard encoding objects.
+ private static Encoding asciiEncoding = null;
+ private static Encoding bigEndianEncoding = null;
+ private static Encoding defaultEncoding = null;
+ private static Encoding utf7Encoding = null;
+ private static Encoding utf8EncodingWithMarkers = null;
+ private static Encoding utf8EncodingWithoutMarkers = null;
+ private static Encoding unicodeEncoding = null;
+ private static Encoding isoLatin1Encoding = null;
+ private static Encoding unixConsoleEncoding = null;
+
+ // Get the standard ASCII encoding object.
+ public static Encoding ASCII
+ {
+ get {
+ if (asciiEncoding == null) {
+ lock (typeof(Encoding)) {
+ if (asciiEncoding == null) {
+ asciiEncoding = new ASCIIEncoding ();
+ }
+ }
+ }
+
+ return asciiEncoding;
+ }
+ }
+
+ // Get the standard big-endian Unicode encoding object.
+ public static Encoding BigEndianUnicode
+ {
+ get {
+ if (bigEndianEncoding == null) {
+ lock (typeof(Encoding)) {
+ if (bigEndianEncoding == null) {
+ bigEndianEncoding = new UnicodeEncoding (true, true);
+ }
+ }
+ }
+
+ return bigEndianEncoding;
+ }
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ extern private static string InternalCodePage ();
+
+ // Get the default encoding object.
+ public static Encoding Default
+ {
+ get {
+ if (defaultEncoding == null) {
+ lock (typeof(Encoding)) {
+ if (defaultEncoding == null) {
+ // See if the underlying system knows what
+ // code page handler we should be using.
+ string codePage = InternalCodePage ();
+ try {
+ defaultEncoding = GetEncoding (codePage);
+ } catch (NotSupportedException) {
+ defaultEncoding = UTF8Unmarked;
+ }
+ }
+ }
+ }
+
+ return defaultEncoding;
+ }
+ }
+
+ // Get the ISO Latin1 encoding object.
+ private static Encoding ISOLatin1
+ {
+ get {
+ if (isoLatin1Encoding == null) {
+ lock (typeof(Encoding)) {
+ if (isoLatin1Encoding == null) {
+ isoLatin1Encoding = new Latin1Encoding ();
+ }
+ }
+ }
+
+ return isoLatin1Encoding;
+ }
+ }
+
+ // Get the standard UTF-7 encoding object.
+#if ECMA_COMPAT
+ private
+#else
+ public
+#endif
+ static Encoding UTF7
+ {
+ get {
+ if (utf7Encoding == null) {
+ lock (typeof(Encoding)) {
+ if (utf7Encoding == null) {
+ utf7Encoding = new UTF7Encoding ();
+ }
+ }
+ }
+
+ return utf7Encoding;
+ }
+ }
+
+ // Get the standard UTF-8 encoding object.
+ public static Encoding UTF8
+ {
+ get {
+ if (utf8EncodingWithMarkers == null) {
+ lock (typeof(Encoding)) {
+ if (utf8EncodingWithMarkers == null) {
+ utf8EncodingWithMarkers = new UTF8Encoding (true);
+ }
+ }
+ }
+
+ return utf8EncodingWithMarkers;
+ }
+ }
+
+ //
+ // Only internal, to be used by the class libraries
+ //
+ internal static Encoding UTF8Unmarked {
+ get {
+ if (utf8EncodingWithoutMarkers == null) {
+ lock (typeof (Encoding)){
+ if (utf8EncodingWithoutMarkers == null){
+ utf8EncodingWithoutMarkers = new UTF8Encoding (false, true);
+ }
+ }
+ }
+
+ return utf8EncodingWithoutMarkers;
+ }
+ }
+
+ // Get the standard little-endian Unicode encoding object.
+ public static Encoding Unicode
+ {
+ get {
+ if (unicodeEncoding == null) {
+ lock (typeof(Encoding)) {
+ if (unicodeEncoding == null) {
+ unicodeEncoding = new UnicodeEncoding (false, true);
+ }
+ }
+ }
+
+ return unicodeEncoding;
+ }
+ }
+
+ internal static Encoding UnixConsoleEncoding {
+ get {
+ if (unixConsoleEncoding == null) {
+ lock (typeof(Encoding)){
+ if (unixConsoleEncoding == null)
+ unixConsoleEncoding = Default;
+ }
+ }
+
+ return unixConsoleEncoding;
+ }
+ }
+
+ // Forwarding decoder implementation.
+ private sealed class ForwardingDecoder : Decoder
+ {
+ private Encoding encoding;
+
+ // Constructor.
+ public ForwardingDecoder (Encoding enc)
+ {
+ encoding = enc;
+ }
+
+ // Override inherited methods.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return encoding.GetCharCount (bytes, index, count);
+ }
+ public override int GetChars (byte[] bytes, int byteIndex,
+ int byteCount, char[] chars,
+ int charIndex)
+ {
+ return encoding.GetChars (bytes, byteIndex, byteCount, chars, charIndex);
+ }
+
+ } // class ForwardingDecoder
+
+ // Forwarding encoder implementation.
+ private sealed class ForwardingEncoder : Encoder
+ {
+ private Encoding encoding;
+
+ // Constructor.
+ public ForwardingEncoder (Encoding enc)
+ {
+ encoding = enc;
+ }
+
+ // Override inherited methods.
+ public override int GetByteCount (char[] chars, int index, int count, bool flush)
+ {
+ return encoding.GetByteCount (chars, index, count);
+ }
+ public override int GetBytes (char[] chars, int charIndex,
+ int charCount, byte[] bytes,
+ int byteCount, bool flush)
+ {
+ return encoding.GetBytes (chars, charIndex, charCount, bytes, byteCount);
+ }
+
+ } // class ForwardingEncoder
+
+}; // class Encoding
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/Latin1Encoding.cs b/mcs/class/corlib/System.Text/Latin1Encoding.cs
new file mode 100644
index 00000000000..4546920c0dc
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Latin1Encoding.cs
@@ -0,0 +1,305 @@
+/*
+ * Latin1Encoding.cs - Implementation of the
+ * "System.Text.Latin1Encoding" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+internal class Latin1Encoding : Encoding
+{
+ // Magic number used by Windows for the ISO Latin1 code page.
+ internal const int ISOLATIN_CODE_PAGE = 28591;
+
+ // Constructor.
+ public Latin1Encoding () : base (ISOLATIN_CODE_PAGE)
+ {
+ // Nothing to do here.
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount (char[] chars, int index, int count)
+ {
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (index < 0 || index > chars.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (chars.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Convenience wrappers for "GetByteCount".
+ public override int GetByteCount (String s)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ return s.Length;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if (charCount < 0 || charCount > (chars.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_Array"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if ((bytes.Length - byteIndex) < charCount) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int count = charCount;
+ char ch;
+ while (count-- > 0) {
+ ch = chars [charIndex++];
+ if (ch < (char)0x0100) {
+ bytes [byteIndex++] = (byte)ch;
+ } else if (ch >= '\uFF01' && ch <= '\uFF5E') {
+ bytes [byteIndex++] = (byte)(ch - 0xFEE0);
+ } else {
+ bytes [byteIndex++] = (byte)'?';
+ }
+ }
+ return charCount;
+ }
+
+ // Convenience wrappers for "GetBytes".
+ public override int GetBytes (String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > s.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_StringIndex"));
+ }
+ if (charCount < 0 || charCount > (s.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_StringRange"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if ((bytes.Length - byteIndex) < charCount) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int count = charCount;
+ char ch;
+ while (count-- > 0) {
+ ch = s [charIndex++];
+ if (ch < (char)0x0100) {
+ bytes [byteIndex++] = (byte)ch;
+ } else if (ch >= '\uFF01' && ch <= '\uFF5E') {
+ bytes [byteIndex++] = (byte)(ch - 0xFEE0);
+ } else {
+ bytes [byteIndex++] = (byte)'?';
+ }
+ }
+ return charCount;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ return count;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if (byteCount < 0 || byteCount > (bytes.Length - byteIndex)) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_Array"));
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if ((chars.Length - charIndex) < byteCount) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int count = byteCount;
+ while (count-- > 0) {
+ chars [charIndex++] = (char)(bytes [byteIndex++]);
+ }
+ return byteCount;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount (int charCount)
+ {
+ if (charCount < 0) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_NonNegative"));
+ }
+ return charCount;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount (int byteCount)
+ {
+ if (byteCount < 0) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+ // Decode a buffer of bytes into a string.
+ public override String GetString (byte[] bytes, int index, int count)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ unsafe {
+ fixed (byte *ss = &bytes [0]) {
+ return new String ((sbyte*)ss, index, count);
+ }
+ }
+ }
+ public override String GetString (byte[] bytes)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ int count = bytes.Length;
+ unsafe {
+ fixed (byte *ss = &bytes [0]) {
+ return new String ((sbyte*)ss, 0, count);
+ }
+ }
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get {
+ return "iso-8859-1";
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get {
+ return "Western European (ISO)";
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get {
+ return "iso-8859-1";
+ }
+ }
+
+ // Determine if this encoding can be displayed in a Web browser.
+ public override bool IsBrowserDisplay
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a Web browser.
+ public override bool IsBrowserSave
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public override bool IsMailNewsDisplay
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public override bool IsMailNewsSave
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get {
+ return "iso-8859-1";
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+}; // class Latin1Encoding
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs
new file mode 100644
index 00000000000..598a3a82293
--- /dev/null
+++ b/mcs/class/corlib/System.Text/StringBuilder.cs
@@ -0,0 +1,619 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Text.StringBuilder
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Make sure the coding complies to the ECMA draft, there's some
+// variable names that probably don't (like sString)
+//
+using System.Runtime.CompilerServices;
+
+namespace System.Text {
+
+ [Serializable]
+ public sealed class StringBuilder {
+
+ private const int defaultCapacity = 16;
+
+ private int sCapacity;
+ private int sLength;
+ private char[] sString;
+ private int sMaxCapacity = Int32.MaxValue;
+
+ public StringBuilder(string value, int startIndex, int length, int capacity) {
+ // first, check the parameters and throw appropriate exceptions if needed
+ if(null==value) {
+ throw new System.ArgumentNullException("value");
+ }
+
+ // make sure startIndex is zero or positive
+ if(startIndex < 0) {
+ throw new System.ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
+ }
+
+ // make sure length is zero or positive
+ if(length < 0) {
+ throw new System.ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
+ }
+
+ // make sure startIndex and length give a valid substring of value
+ if(startIndex + (length -1) > (value.Length - 1) ) {
+ throw new System.ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex and length must refer to a location within the string.");
+ }
+
+ // the capacity must be at least as big as the default capacity
+ sCapacity = Math.Max(capacity, defaultCapacity);
+
+ // LAMESPEC: what to do if capacity is too small to hold the substring?
+ // Like the MS implementation, double the capacity until it is large enough
+ while (sCapacity < length) {
+ // However, take care not to double if that would make the number
+ // larger than what an int can hold
+ if (sCapacity <= Int32.MaxValue / 2) {
+ sCapacity *= 2;
+ }
+ else{
+ sCapacity = Int32.MaxValue;
+ }
+ }
+
+ sString = new char[sCapacity];
+ sLength = length;
+
+ // if the length is not zero, then we have to copy some characters
+ if (sLength > 0) {
+ // Copy the correct number of characters into the internal array
+ value.CopyTo (startIndex, sString, 0, sLength);
+ }
+ }
+
+ public StringBuilder () : this(String.Empty, 0, 0, 0) {}
+
+ public StringBuilder( int capacity ) : this(String.Empty, 0, 0, capacity) {}
+
+ public StringBuilder( int capacity, int maxCapacity ) : this(String.Empty, 0, 0, capacity) {
+ if(capacity > maxCapacity) {
+ throw new System.ArgumentOutOfRangeException("capacity", "Capacity exceeds maximum capacity.");
+ }
+ sMaxCapacity = maxCapacity;
+ }
+
+ public StringBuilder( string value ) : this(value, 0, value == null ? 0 : value.Length, value == null? 0 : value.Length) {
+ }
+
+ public StringBuilder( string value, int capacity) : this(value, 0, value.Length, capacity) {}
+
+ public int MaxCapacity {
+ get {
+ // MS runtime always returns Int32.MaxValue.
+ return sMaxCapacity;
+ }
+ }
+
+ public int Capacity {
+ get {
+ return sCapacity;
+ }
+
+ set {
+ if( value < sLength ) {
+ throw new ArgumentException( "Capacity must be > length" );
+ } else {
+ char[] tString = new char[value];
+ Array.Copy( sString, tString, sLength );
+ sString = tString;
+ sCapacity = sString.Length;
+ }
+ }
+ }
+
+
+ public int Length {
+ get {
+ return sLength;
+ }
+
+ set {
+ if( value < 0 || value > MaxCapacity) {
+ throw new ArgumentOutOfRangeException();
+ } else {
+
+ if( value < sLength ) {
+ // Truncate current string at value
+
+ // LAMESPEC: The spec is unclear as to what to do
+ // with the capacity when truncating the string.
+ //
+ // Don't change the capacity, as this is what
+ // the MS implementation does.
+
+ sLength = value;
+ } else {
+ // Expand the capacity to the new length and
+ // pad the string with spaces.
+
+ // LAMESPEC: The spec says to put the spaces on the
+ // left of the string however the MS implementation
+ // puts them on the right. We'll do that for
+ // compatibility (!)
+
+ char[] tString = new char[ value ];
+ int padLength = value - sLength;
+
+ string padding = new String( ' ', padLength );
+ Array.Copy( sString, tString, sLength );
+ padding.CopyTo (0, sString, sLength, padLength);
+ sString = tString;
+ sLength = sString.Length;
+ sCapacity = value;
+ }
+ }
+ }
+ }
+
+ [IndexerName("Chars")]
+ public char this[ int index ] {
+ get {
+
+ if( index >= sLength || index < 0 ) {
+ throw new IndexOutOfRangeException();
+ }
+ return sString[ index ];
+ }
+
+ set {
+ if( index >= sLength || index < 0 ) {
+ throw new IndexOutOfRangeException();
+ }
+ sString[ index ] = value;
+ }
+ }
+
+ public override string ToString() {
+ return ToString(0, sLength);
+ }
+
+ public string ToString( int startIndex, int length ) {
+ if( startIndex < 0 || length < 0 || startIndex + length > sLength ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ return new String( sString, startIndex, length );
+ }
+
+ public int EnsureCapacity( int capacity ) {
+ if( capacity < 0 ) {
+ throw new ArgumentOutOfRangeException(
+ "Capacity must be greater than 0." );
+ }
+
+ if( capacity <= sCapacity ) {
+ return sCapacity;
+ } else {
+ Capacity = capacity;
+ return sCapacity;
+ }
+ }
+
+ public bool Equals( StringBuilder sb ) {
+ if(sLength == sb.Length && this.ToString() == sb.ToString() ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public StringBuilder Remove (int startIndex, int length)
+ {
+ if( startIndex < 0 || length < 0 || startIndex + length > sLength )
+ throw new ArgumentOutOfRangeException();
+
+ // Copy everything after the 'removed' part to the start
+ // of the removed part and truncate the sLength
+
+ Array.Copy (sString, startIndex + length, sString, startIndex,
+ sLength - (startIndex + length));
+
+ sLength -= length;
+ return this;
+ }
+
+ public StringBuilder Replace( char oldChar, char newChar ) {
+
+ return Replace( oldChar, newChar, 0, sLength);
+ }
+
+ public StringBuilder Replace( char oldChar, char newChar, int startIndex, int count ) {
+ if( startIndex + count > sLength || startIndex < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ for( int replaceIterate = startIndex; replaceIterate < startIndex + count; replaceIterate++ ) {
+ if( this[replaceIterate] == oldChar ) {
+ this[replaceIterate] = newChar;
+ }
+ }
+
+ return this;
+ }
+
+ public StringBuilder Replace( string oldValue, string newValue ) {
+ return Replace( oldValue, newValue, 0, sLength );
+ }
+
+ public StringBuilder Replace( string oldValue, string newValue, int startIndex, int count ) {
+ string startString = this.ToString();
+ StringBuilder newStringB = new StringBuilder();
+
+ if( oldValue == null ) {
+ throw new ArgumentNullException(
+ "The old value cannot be null.");
+ }
+
+ if( startIndex < 0 || count < 0 || startIndex + count > sLength ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if( oldValue.Length == 0 ) {
+ throw new ArgumentException(
+ "The old value cannot be zero length.");
+ }
+
+ int nextIndex = startIndex; // Where to start the next search
+ int lastIndex = nextIndex; // Where the last search finished
+
+ while( nextIndex != -1 ) {
+ nextIndex = startString.IndexOf( oldValue, lastIndex);
+ if( nextIndex != -1 ) {
+ // The MS implementation won't replace a substring
+ // if that substring goes over the "count"
+ // boundary, so we'll make sure the behaviour
+ // here is the same.
+
+ if( nextIndex + oldValue.Length <= startIndex + count ) {
+
+ // Add everything to the left of the old
+ // string
+ newStringB.Append( startString.Substring( lastIndex, nextIndex - lastIndex ) );
+
+ // Add the replacement string
+ newStringB.Append( newValue );
+
+ // Set the next start point to the
+ // end of the last match
+ lastIndex = nextIndex + oldValue.Length;
+ } else {
+ // We're past the "count" we're supposed to replace within
+ nextIndex = -1;
+ newStringB.Append(
+ startString.Substring( lastIndex ) );
+ }
+
+ } else {
+ // Append everything left over
+ newStringB.Append( startString.Substring( lastIndex ) );
+ }
+ }
+
+ sCapacity = newStringB.sCapacity;
+ sString = newStringB.sString;
+ sLength = newStringB.sLength;
+ return this;
+ }
+
+
+ /* The Append Methods */
+
+ public StringBuilder Append( char[] value ) {
+ if( sLength + value.Length > sCapacity ) {
+ // Need more capacity, double the capacity StringBuilder
+ // and make sure we have at least enough for the value
+ // if that's going to go over double.
+
+ Capacity = value.Length + ( sCapacity + sCapacity);
+ }
+
+ Array.Copy( value, 0, sString, sLength, value.Length );
+ sLength += value.Length;
+
+ return this;
+ }
+
+ public StringBuilder Append( string value ) {
+ if( value != null ) {
+ int new_size = sLength + value.Length;
+ if (new_size > sCapacity)
+ Capacity = value.Length + sCapacity * 2;
+
+ value.CopyTo (0, sString, sLength, value.Length);
+ sLength = new_size;
+ return this;
+ } else {
+ return null;
+ }
+ }
+
+ public StringBuilder Append( bool value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( byte value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( decimal value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( double value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( short value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( int value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( long value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( object value ) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( sbyte value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( float value ) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( ushort value ) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( uint value ) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( ulong value ) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append( char value ) {
+ if( sLength + 1 > sCapacity ) {
+ // Need more capacity, double the capacity StringBuilder
+ // and make sure we have at least enough for the value
+ // if that's going to go over double.
+
+ Capacity = 1 + ( sCapacity + sCapacity);
+ }
+ sString [sLength] = value;
+ sLength++;
+
+ return this;
+ }
+
+ public StringBuilder Append( char value, int repeatCount ) {
+ if( repeatCount < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ return Append( new String( value, repeatCount) );
+ }
+
+ public StringBuilder Append( char[] value, int startIndex, int charCount ) {
+
+ if( (charCount < 0 || startIndex < 0) ||
+ ( charCount + startIndex > value.Length ) ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if( value == null ) {
+ if( !(startIndex == 0 && charCount == 0) ) {
+ throw new ArgumentNullException();
+ } else {
+ return this;
+ }
+ } else {
+ char[] appendChars = new char[ charCount ];
+
+ Array.Copy( value, startIndex, appendChars, 0, charCount );
+ return Append( appendChars );
+ }
+ }
+
+ public StringBuilder Append( string value, int startIndex, int count ) {
+ if( (count < 0 || startIndex < 0) ||
+ ( startIndex + count > value.Length ) ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ return Append (value.Substring (startIndex, count));
+ }
+
+ public StringBuilder AppendFormat (string format, object arg0 )
+ {
+ string result = String.Format (format, arg0);
+ return Append (result);
+ }
+
+ public StringBuilder AppendFormat (string format, params object[] args )
+ {
+ string result = String.Format (format, args);
+ return Append (result);
+ }
+
+ public StringBuilder AppendFormat (IFormatProvider provider,
+ string format,
+ params object[] args)
+ {
+ string result = String.Format (provider, format, args);
+ return Append (result);
+ }
+
+ public StringBuilder AppendFormat (string format, object arg0, object arg1 )
+ {
+ string result = String.Format (format, arg0, arg1);
+ return Append (result);
+ }
+
+ public StringBuilder AppendFormat (string format, object arg0, object arg1, object arg2 )
+ {
+ string result = String.Format (format, arg0, arg1, arg2);
+ return Append (result);
+ }
+
+ /* The Insert Functions */
+
+ public StringBuilder Insert( int index, char[] value ) {
+ if( index > sLength || index < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if( value == null || value.Length == 0 ) {
+ return this;
+ } else {
+ // Check we have the capacity to insert this array
+ if( sCapacity < sLength + value.Length ) {
+ Capacity = value.Length + ( sCapacity + sCapacity );
+ }
+
+ // Move everything to the right of the insert point across
+ Array.Copy( sString, index, sString, index + value.Length, sLength - index);
+
+ // Copy in stuff from the insert buffer
+ Array.Copy( value, 0, sString, index, value.Length );
+
+ sLength += value.Length;
+ return this;
+ }
+ }
+
+ public StringBuilder Insert( int index, string value ) {
+ if (index > sLength || index < 0)
+ throw new ArgumentOutOfRangeException ("index");
+
+ if (value == null || value.Length == 0)
+ return this;
+
+ int len = value.Length;
+ // Check we have the capacity to insert this array
+ if (sCapacity < sLength + len)
+ Capacity = len + ( sCapacity + sCapacity );
+
+ // Move everything to the right of the insert point across
+ Array.Copy (sString, index, sString, index + len, sLength - index);
+
+ value.CopyTo (0, sString, index, len);
+
+ sLength += len;
+ return this;
+ }
+
+ public StringBuilder Insert( int index, bool value ) {
+ return Insert( index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, byte value ) {
+ return Insert( index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, char value) {
+ char[] insertChar = new char[1];
+
+ insertChar[0] = value;
+ return Insert( index, insertChar );
+ }
+
+ public StringBuilder Insert( int index, decimal value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, double value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, short value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, int value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, long value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, object value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, sbyte value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, float value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, ushort value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, uint value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, ulong value ) {
+ return Insert( index, value.ToString() );
+ }
+
+ public StringBuilder Insert( int index, string value, int count ) {
+ if ( count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if( value != null ) {
+ if( value != "" ) {
+ for( int insertCount = 0; insertCount < count;
+ insertCount++ ) {
+ Insert( index, value );
+ }
+ }
+ }
+ return this;
+ }
+
+ public StringBuilder Insert( int index, char[] value, int startIndex,
+ int charCount ) {
+
+ if( value != null ) {
+ if( charCount < 0 || startIndex < 0 || startIndex + charCount > value.Length ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ char[] insertChars = new char[ charCount ];
+ Array.Copy( value, startIndex, insertChars, 0, charCount );
+ return Insert( index, insertChars );
+ } else {
+ return this;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Text/UTF7Encoding.cs b/mcs/class/corlib/System.Text/UTF7Encoding.cs
new file mode 100755
index 00000000000..f8a34c2072c
--- /dev/null
+++ b/mcs/class/corlib/System.Text/UTF7Encoding.cs
@@ -0,0 +1,647 @@
+/*
+ * UTF7Encoding.cs - Implementation of the
+ * "System.Text.UTF7Encoding" class.
+ *
+ * Copyright (c) 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+[Serializable]
+#if ECMA_COMPAT
+internal
+#else
+public
+#endif
+class UTF7Encoding : Encoding
+{
+ // Magic number used by Windows for UTF-7.
+ internal const int UTF7_CODE_PAGE = 65000;
+
+ // Internal state.
+ private bool allowOptionals;
+
+ // Encoding rule table for 0x00-0x7F.
+ // 0 - full encode, 1 - direct, 2 - optional, 3 - encode plus.
+ private static readonly byte[] encodingRules = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, // 00
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10
+ 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 3, 1, 1, 1, 1, // 20
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, // 30
+
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 40
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 2, 2, // 50
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 60
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0, 0, // 70
+ };
+
+ // Characters to use to encode 6-bit values in base64.
+ private const String base64Chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ // Map bytes in base64 to 6-bit values.
+ private static readonly sbyte[] base64Values = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 00
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 63, // 20
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, // 30
+
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 40
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, // 50
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, // 60
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, // 70
+
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 80
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 90
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // A0
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // B0
+
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // C0
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // D0
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // E0
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // F0
+ };
+
+ // Constructors.
+ public UTF7Encoding ()
+ : base (UTF7_CODE_PAGE)
+ {
+ allowOptionals = false;
+ }
+ public UTF7Encoding (bool allowOptionals)
+ : base (UTF7_CODE_PAGE)
+ {
+ this.allowOptionals = allowOptionals;
+ }
+
+ // Internal version of "GetByteCount" that can handle
+ // a rolling state between calls.
+ private static int InternalGetByteCount
+ (char[] chars, int index, int count, bool flush,
+ int leftOver, bool allowOptionals)
+ {
+ // Validate the parameters.
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (index < 0 || index > chars.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (chars.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+
+ // Determine the length of the output.
+ int length = 0;
+ int leftOverSize = (leftOver >> 8);
+ byte[] rules = encodingRules;
+ int ch, rule;
+ while (count > 0) {
+ ch = (int)(chars[index++]);
+ --count;
+ if (ch < 0x0080) {
+ rule = rules[ch];
+ } else {
+ rule = 0;
+ }
+ switch (rule) {
+ case 0:
+ // Handle characters that must be fully encoded.
+ if (leftOverSize == 0) {
+ ++length;
+ }
+ leftOverSize += 16;
+ while (leftOverSize >= 6) {
+ ++length;
+ leftOverSize -= 6;
+ }
+ break;
+ case 1:
+ // The character is encoded as itself.
+ if (leftOverSize != 0) {
+ // Flush the previous encoded sequence.
+ length += 2;
+ leftOverSize = 0;
+ }
+ ++length;
+ break;
+ case 2:
+ // The character may need to be encoded.
+ if (allowOptionals) {
+ goto case 1;
+ } else {
+ goto case 0;
+ }
+ // Not reached.
+ case 3:
+ // Encode the plus sign as "+-".
+ if (leftOverSize != 0) {
+ // Flush the previous encoded sequence.
+ length += 2;
+ leftOverSize = 0;
+ }
+ length += 2;
+ break;
+ }
+ }
+ if (leftOverSize != 0 && flush) {
+ length += 2;
+ }
+
+ // Return the length to the caller.
+ return length;
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount (char[] chars, int index, int count)
+ {
+ return InternalGetByteCount (chars, index, count, true, 0, allowOptionals);
+ }
+
+ // Internal version of "GetBytes" that can handle a
+ // rolling state between calls.
+ private static int InternalGetBytes
+ (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex, bool flush,
+ ref int leftOver, bool allowOptionals)
+ {
+ // Validate the parameters.
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if (charCount < 0 || charCount > (chars.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_Array"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+
+ // Convert the characters.
+ int posn = byteIndex;
+ int byteLength = bytes.Length;
+ int leftOverSize = (leftOver >> 8);
+ int leftOverBits = (leftOver & 0xFF);
+ byte[] rules = encodingRules;
+ String base64 = base64Chars;
+ int ch, rule;
+ while (charCount > 0) {
+ ch = (int)(chars[charIndex++]);
+ --charCount;
+ if (ch < 0x0080) {
+ rule = rules[ch];
+ } else {
+ rule = 0;
+ }
+ switch (rule) {
+ case 0:
+ // Handle characters that must be fully encoded.
+ if (leftOverSize == 0) {
+ if (posn >= byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)'+';
+ }
+ leftOverBits = ((leftOverBits << 16) | ch);
+ leftOverSize += 16;
+ while (leftOverSize >= 6) {
+ if (posn >= byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ leftOverSize -= 6;
+ bytes[posn++] = (byte)(base64 [leftOverBits >> leftOverSize]);
+ leftOverBits &= ((1 << leftOverSize) - 1);
+ }
+ break;
+ case 1:
+ // The character is encoded as itself.
+ if (leftOverSize != 0) {
+ // Flush the previous encoded sequence.
+ if ((posn + 2) > byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(base64 [leftOverBits << (6 - leftOverSize)]);
+ bytes[posn++] = (byte)'-';
+ leftOverSize = 0;
+ leftOverBits = 0;
+ }
+ if (posn >= byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)ch;
+ break;
+ case 2:
+ // The character may need to be encoded.
+ if (allowOptionals) {
+ goto case 1;
+ } else {
+ goto case 0;
+ }
+ // Not reached.
+ case 3:
+ // Encode the plus sign as "+-".
+ if (leftOverSize != 0) {
+ // Flush the previous encoded sequence.
+ if ((posn + 2) > byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(base64 [leftOverBits << (6 - leftOverSize)]);
+ bytes[posn++] = (byte)'-';
+ leftOverSize = 0;
+ leftOverBits = 0;
+ }
+ if ((posn + 2) > byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)'+';
+ bytes[posn++] = (byte)'-';
+ break;
+ }
+ }
+ if (leftOverSize != 0 && flush) {
+ if ((posn + 2) > byteLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(base64 [leftOverBits << (6 - leftOverSize)]);
+ bytes[posn++] = (byte)'-';
+ leftOverSize = 0;
+ leftOverBits = 0;
+ }
+ leftOver = ((leftOverSize << 8) | leftOverBits);
+
+ // Return the length to the caller.
+ return posn - byteIndex;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ int leftOver = 0;
+ return InternalGetBytes (chars, charIndex, charCount, bytes, byteIndex, true,
+ ref leftOver, allowOptionals);
+ }
+
+ // Internal version of "GetCharCount" that can handle
+ // a rolling state between call.s
+ private static int InternalGetCharCount
+ (byte[] bytes, int index, int count, int leftOver)
+ {
+ // Validate the parameters.
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+
+ // Determine the length of the result.
+ int length = 0;
+ int byteval, b64value;
+ bool normal = ((leftOver & 0x01000000) == 0);
+ bool prevIsPlus = ((leftOver & 0x02000000) != 0);
+ int leftOverSize = ((leftOver >> 16) & 0xFF);
+ sbyte[] base64 = base64Values;
+ while (count > 0) {
+ byteval = (int)(bytes[index++]);
+ --count;
+ if (normal) {
+ if (byteval != '+') {
+ // Directly-encoded character.
+ ++length;
+ } else {
+ // Start of a base64-encoded character.
+ normal = false;
+ prevIsPlus = true;
+ }
+ } else {
+ // Process the next byte in a base64 sequence.
+ if (byteval == (int)'-') {
+ // End of a base64 sequence.
+ if (prevIsPlus || leftOverSize > 0) {
+ ++length;
+ leftOverSize = 0;
+ }
+ normal = true;
+ } else if ((b64value = base64[byteval]) != -1) {
+ // Extra character in a base64 sequence.
+ leftOverSize += 6;
+ if (leftOverSize >= 16) {
+ ++length;
+ leftOverSize -= 16;
+ }
+ } else {
+ // Normal character terminating a base64 sequence.
+ if (leftOverSize > 0) {
+ ++length;
+ leftOverSize = 0;
+ }
+ ++length;
+ normal = true;
+ }
+ prevIsPlus = false;
+ }
+ }
+
+ // Return the final length to the caller.
+ return length;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return InternalGetCharCount (bytes, index, count, 0);
+ }
+
+ // Internal version of "GetChars" that can handle a
+ // rolling state between calls.
+ private static int InternalGetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex, ref int leftOver)
+ {
+ // Validate the parameters.
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if (byteCount < 0 || byteCount > (bytes.Length - byteIndex)) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_Array"));
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+
+ // Convert the bytes into characters.
+ int posn = charIndex;
+ int charLength = chars.Length;
+ int byteval, b64value;
+ bool normal = ((leftOver & 0x01000000) == 0);
+ bool prevIsPlus = ((leftOver & 0x02000000) != 0);
+ int leftOverSize = ((leftOver >> 16) & 0xFF);
+ int leftOverBits = (leftOver & 0xFFFF);
+ sbyte[] base64 = base64Values;
+ while (byteCount > 0) {
+ byteval = (int)(bytes[byteIndex++]);
+ --byteCount;
+ if (normal) {
+ if (byteval != '+') {
+ // Directly-encoded character.
+ if (posn >= charLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = (char)byteval;
+ } else {
+ // Start of a base64-encoded character.
+ normal = false;
+ prevIsPlus = true;
+ }
+ } else {
+ // Process the next byte in a base64 sequence.
+ if (byteval == (int)'-') {
+ // End of a base64 sequence.
+ if (prevIsPlus) {
+ if (posn >= charLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = '+';
+ } else if (leftOverSize > 0) {
+ if (posn >= charLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = (char)(leftOverBits << (16 - leftOverSize));
+ leftOverSize = 0;
+ leftOverBits = 0;
+ }
+ normal = true;
+ } else if ((b64value = base64[byteval]) != -1) {
+ // Extra character in a base64 sequence.
+ leftOverBits = (leftOverBits << 6) | b64value;
+ leftOverSize += 6;
+ if (leftOverSize >= 16) {
+ if (posn >= charLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ leftOverSize -= 16;
+ chars[posn++] = (char)(leftOverBits >> leftOverSize);
+ leftOverBits &= ((1 << leftOverSize) - 1);
+ }
+ } else {
+ // Normal character terminating a base64 sequence.
+ if (leftOverSize > 0) {
+ if (posn >= charLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = (char)(leftOverBits << (16 - leftOverSize));
+ leftOverSize = 0;
+ leftOverBits = 0;
+ }
+ if (posn >= charLength) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = (char)byteval;
+ normal = true;
+ }
+ prevIsPlus = false;
+ }
+ }
+ leftOver = (leftOverBits | (leftOverSize << 16) |
+ (normal ? 0 : 0x01000000) |
+ (prevIsPlus ? 0x02000000 : 0));
+
+ // Return the final length to the caller.
+ return posn - charIndex;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ int leftOver = 0;
+ return InternalGetChars (bytes, byteIndex, byteCount, chars, charIndex, ref leftOver);
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount (int charCount)
+ {
+ if (charCount < 0) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_NonNegative"));
+ }
+ return charCount * 5;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount (int byteCount)
+ {
+ if (byteCount < 0) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+ // Get a UTF7-specific decoder that is attached to this instance.
+ public override Decoder GetDecoder ()
+ {
+ return new UTF7Decoder ();
+ }
+
+ // Get a UTF7-specific encoder that is attached to this instance.
+ public override Encoder GetEncoder ()
+ {
+ return new UTF7Encoder (allowOptionals);
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get {
+ return "utf-7";
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get {
+ return "Unicode (UTF-7)";
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get {
+ return "utf-7";
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public override bool IsMailNewsDisplay
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public override bool IsMailNewsSave
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get {
+ return "utf-7";
+ }
+ }
+
+ // Get the Windows code page represented by this object.
+ public override int WindowsCodePage
+ {
+ get {
+ return UnicodeEncoding.UNICODE_CODE_PAGE;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+ // UTF-7 decoder implementation.
+ private sealed class UTF7Decoder : Decoder
+ {
+ // Internal state.
+ private int leftOver;
+
+ // Constructor.
+ public UTF7Decoder ()
+ {
+ leftOver = 0;
+ }
+
+ // Override inherited methods.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return InternalGetCharCount (bytes, index, count, leftOver);
+ }
+ public override int GetChars (byte[] bytes, int byteIndex,
+ int byteCount, char[] chars,
+ int charIndex)
+ {
+ return InternalGetChars (bytes, byteIndex, byteCount, chars, charIndex, ref leftOver);
+ }
+
+ } // class UTF7Decoder
+
+ // UTF-7 encoder implementation.
+ private sealed class UTF7Encoder : Encoder
+ {
+ private bool allowOptionals;
+ private int leftOver;
+
+ // Constructor.
+ public UTF7Encoder (bool allowOptionals)
+ {
+ this.allowOptionals = allowOptionals;
+ this.leftOver = 0;
+ }
+
+ // Override inherited methods.
+ public override int GetByteCount (char[] chars, int index,
+ int count, bool flush)
+ {
+ return InternalGetByteCount
+ (chars, index, count, flush, leftOver, allowOptionals);
+ }
+ public override int GetBytes (char[] chars, int charIndex,
+ int charCount, byte[] bytes,
+ int byteIndex, bool flush)
+ {
+ return InternalGetBytes (chars, charIndex, charCount,
+ bytes, byteIndex, flush,
+ ref leftOver, allowOptionals);
+ }
+
+ } // class UTF7Encoder
+
+}; // class UTF7Encoding
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/UTF8Encoding.cs b/mcs/class/corlib/System.Text/UTF8Encoding.cs
new file mode 100755
index 00000000000..93af816f130
--- /dev/null
+++ b/mcs/class/corlib/System.Text/UTF8Encoding.cs
@@ -0,0 +1,797 @@
+/*
+ * UTF8Encoding.cs - Implementation of the "System.Text.UTF8Encoding" class.
+ *
+ * Copyright (c) 2001, 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+[Serializable]
+public class UTF8Encoding : Encoding
+{
+ // Magic number used by Windows for UTF-8.
+ internal const int UTF8_CODE_PAGE = 65001;
+
+ // Internal state.
+ private bool emitIdentifier;
+ private bool throwOnInvalid;
+
+ // Constructors.
+ public UTF8Encoding () : this (false, false) {}
+ public UTF8Encoding (bool encoderShouldEmitUTF8Identifier)
+ : this (encoderShouldEmitUTF8Identifier, false) {}
+ public UTF8Encoding (bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes)
+ : base (UTF8_CODE_PAGE)
+ {
+ emitIdentifier = encoderShouldEmitUTF8Identifier;
+ throwOnInvalid = throwOnInvalidBytes;
+ }
+
+ // Internal version of "GetByteCount" which can handle a rolling
+ // state between multiple calls to this method.
+ private static int InternalGetByteCount (char[] chars, int index, int count, uint leftOver, bool flush)
+ {
+ // Validate the parameters.
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (index < 0 || index > chars.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (chars.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+
+ // Determine the lengths of all characters.
+ char ch;
+ int length = 0;
+ uint pair = leftOver;
+ while (count > 0) {
+ ch = chars[index];
+ if (pair == 0) {
+ if (ch < '\u0080') {
+ ++length;
+ } else if (ch < '\u0800') {
+ length += 2;
+ } else if (ch >= '\uD800' && ch <= '\uDBFF') {
+ // This is the start of a surrogate pair.
+ pair = (uint)ch;
+ } else {
+ length += 3;
+ }
+ } else if (ch >= '\uDC00' && ch <= '\uDFFF') {
+ // We have a surrogate pair.
+ length += 4;
+ pair = 0;
+ } else {
+ // We have a surrogate start followed by a
+ // regular character. Technically, this is
+ // invalid, but we have to do something.
+ // We write out the surrogate start and then
+ // re-visit the current character again.
+ length += 3;
+ pair = 0;
+ continue;
+ }
+ ++index;
+ --count;
+ }
+ if (flush && pair != 0) {
+ // Flush the left-over surrogate pair start.
+ length += 3;
+ }
+
+ // Return the final length to the caller.
+ return length;
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount (char[] chars, int index, int count)
+ {
+ return InternalGetByteCount (chars, index, count, 0, true);
+ }
+
+ // Convenience wrappers for "GetByteCount".
+ public override int GetByteCount (String s)
+ {
+ // Validate the parameters.
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+
+ // Determine the lengths of all characters.
+ char ch;
+ int index = 0;
+ int count = s.Length;
+ int length = 0;
+ uint pair;
+ while (count > 0) {
+ ch = s[index++];
+ if (ch < '\u0080') {
+ ++length;
+ } else if (ch < '\u0800') {
+ length += 2;
+ } else if (ch >= '\uD800' && ch <= '\uDBFF' && count > 1) {
+ // This may be the start of a surrogate pair.
+ pair = (uint)(s[index]);
+ if (pair >= (uint)0xDC00 && pair <= (uint)0xDFFF) {
+ length += 4;
+ ++index;
+ --count;
+ } else {
+ length += 3;
+ }
+ } else {
+ length += 3;
+ }
+ --count;
+ }
+
+ // Return the final length to the caller.
+ return length;
+ }
+
+ // Internal version of "GetBytes" which can handle a rolling
+ // state between multiple calls to this method.
+ private static int InternalGetBytes (char[] chars, int charIndex,
+ int charCount, byte[] bytes,
+ int byteIndex, ref uint leftOver,
+ bool flush)
+ {
+ // Validate the parameters.
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if (charCount < 0 || charCount > (chars.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_Array"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+
+ // Convert the characters into bytes.
+ char ch;
+ int length = bytes.Length;
+ uint pair;
+ uint left = leftOver;
+ int posn = byteIndex;
+ while (charCount > 0) {
+ // Fetch the next UTF-16 character pair value.
+ ch = chars[charIndex++];
+ --charCount;
+ if (left == 0) {
+ if (ch >= '\uD800' && ch <= '\uDBFF') {
+ // This is the start of a surrogate pair.
+ left = (uint)ch;
+ continue;
+ } else {
+ // This is a regular character.
+ pair = (uint)ch;
+ }
+ } else if (ch >= '\uDC00' && ch <= '\uDFFF') {
+ // We have a surrogate pair.
+ pair = ((left - (uint)0xD800) << 10) +
+ (((uint)ch) - (uint)0xDC00) +
+ (uint)0x10000;
+ left = 0;
+ } else {
+ // We have a surrogate start followed by a
+ // regular character. Technically, this is
+ // invalid, but we have to do something.
+ // We write out the surrogate start and then
+ // re-visit the current character again.
+ pair = (uint)left;
+ left = 0;
+ --charIndex;
+ ++charCount;
+ }
+
+ // Encode the character pair value.
+ if (pair < (uint)0x0080) {
+ if (posn >= length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)pair;
+ } else if (pair < (uint)0x0800) {
+ if ((posn + 2) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xC0 | (pair >> 6));
+ bytes[posn++] = (byte)(0x80 | (pair & 0x3F));
+ } else if (pair < (uint)0x10000) {
+ if ((posn + 3) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xE0 | (pair >> 12));
+ bytes[posn++] = (byte)(0x80 | ((pair >> 6) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | (pair & 0x3F));
+ } else {
+ if ((posn + 4) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xF0 | (pair >> 18));
+ bytes[posn++] = (byte)(0x80 | ((pair >> 12) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | ((pair >> 6) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | (pair & 0x3F));
+ }
+ }
+ if (flush && left != 0) {
+ // Flush the left-over surrogate pair start.
+ if ((posn + 3) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xE0 | (left >> 12));
+ bytes[posn++] = (byte)(0x80 | ((left >> 6) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | (left & 0x3F));
+ left = 0;
+ }
+ leftOver = left;
+
+ // Return the final count to the caller.
+ return posn - byteIndex;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ uint leftOver = 0;
+ return InternalGetBytes (chars, charIndex, charCount, bytes, byteIndex, ref leftOver, true);
+ }
+
+ // Convenience wrappers for "GetBytes".
+ public override int GetBytes (String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ // Validate the parameters.
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > s.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_StringIndex"));
+ }
+ if (charCount < 0 || charCount > (s.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_StringRange"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+
+ // Convert the characters into bytes.
+ char ch;
+ int length = bytes.Length;
+ uint pair;
+ int posn = byteIndex;
+ while (charCount > 0) {
+ // Fetch the next UTF-16 character pair value.
+ ch = s[charIndex++];
+ --charCount;
+ if (ch >= '\uD800' && ch <= '\uDBFF' && charCount > 1) {
+ // This may be the start of a surrogate pair.
+ pair = (uint)(s[charIndex]);
+ if (pair >= (uint)0xDC00 && pair <= (uint)0xDFFF) {
+ pair = (pair - (uint)0xDC00) +
+ ((((uint)ch) - (uint)0xD800) << 10) +
+ (uint)0x10000;
+ ++charIndex;
+ --charCount;
+ } else {
+ pair = (uint)ch;
+ }
+ } else {
+ pair = (uint)ch;
+ }
+
+ // Encode the character pair value.
+ if (pair < (uint)0x0080) {
+ if (posn >= length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)pair;
+ } else if (pair < (uint)0x0800) {
+ if ((posn + 2) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xC0 | (pair >> 6));
+ bytes[posn++] = (byte)(0x80 | (pair & 0x3F));
+ } else if (pair < (uint)0x10000) {
+ if ((posn + 3) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xE0 | (pair >> 12));
+ bytes[posn++] = (byte)(0x80 | ((pair >> 6) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | (pair & 0x3F));
+ } else {
+ if ((posn + 4) > length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "bytes");
+ }
+ bytes[posn++] = (byte)(0xF0 | (pair >> 18));
+ bytes[posn++] = (byte)(0x80 | ((pair >> 12) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | ((pair >> 6) & 0x3F));
+ bytes[posn++] = (byte)(0x80 | (pair & 0x3F));
+ }
+ }
+
+ // Return the final count to the caller.
+ return posn - byteIndex;
+ }
+
+ // Internal version of "GetCharCount" which can handle a rolling
+ // state between multiple calls to this method.
+ private static int InternalGetCharCount (byte[] bytes, int index, int count,
+ uint leftOverBits,
+ uint leftOverCount,
+ bool throwOnInvalid, bool flush)
+ {
+ // Validate the parameters.
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+
+ // Determine the number of characters that we have.
+ uint ch;
+ int length = 0;
+ uint leftBits = leftOverBits;
+ uint leftSoFar = (leftOverCount & (uint)0x0F);
+ uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
+ while (count > 0) {
+ ch = (uint)(bytes[index++]);
+ --count;
+ if (leftSize == 0) {
+ // Process a UTF-8 start character.
+ if (ch < (uint)0x0080) {
+ // Single-byte UTF-8 character.
+ ++length;
+ } else if ((ch & (uint)0xE0) == (uint)0xC0) {
+ // Double-byte UTF-8 character.
+ leftBits = (ch & (uint)0x1F);
+ leftSoFar = 1;
+ leftSize = 2;
+ } else if ((ch & (uint)0xF0) == (uint)0xE0) {
+ // Three-byte UTF-8 character.
+ leftBits = (ch & (uint)0x0F);
+ leftSoFar = 1;
+ leftSize = 3;
+ } else if ((ch & (uint)0xF8) == (uint)0xF0) {
+ // Four-byte UTF-8 character.
+ leftBits = (ch & (uint)0x07);
+ leftSoFar = 1;
+ leftSize = 4;
+ } else if ((ch & (uint)0xFC) == (uint)0xF8) {
+ // Five-byte UTF-8 character.
+ leftBits = (ch & (uint)0x03);
+ leftSoFar = 1;
+ leftSize = 5;
+ } else if ((ch & (uint)0xFC) == (uint)0xFC) {
+ // Six-byte UTF-8 character.
+ leftBits = (ch & (uint)0x03);
+ leftSoFar = 1;
+ leftSize = 6;
+ } else {
+ // Invalid UTF-8 start character.
+ if (throwOnInvalid) {
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ }
+ } else {
+ // Process an extra byte in a multi-byte sequence.
+ if ((ch & (uint)0xC0) == (uint)0x80) {
+ leftBits = ((leftBits << 6) | (ch & (uint)0x3F));
+ if (++leftSoFar >= leftSize) {
+ // We have a complete character now.
+ if (leftBits < (uint)0x10000) {
+ if (leftBits != (uint)0xFEFF) {
+ ++length;
+ }
+ } else if (leftBits < (uint)0x110000) {
+ length += 2;
+ } else if (throwOnInvalid) {
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ leftSize = 0;
+ }
+ } else {
+ // Invalid UTF-8 sequence: clear and restart.
+ if (throwOnInvalid) {
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ leftSize = 0;
+ --index;
+ ++count;
+ }
+ }
+ }
+ if (flush && leftSize != 0 && throwOnInvalid) {
+ // We had left-over bytes that didn't make up
+ // a complete UTF-8 character sequence.
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+
+ // Return the final length to the caller.
+ return length;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return InternalGetCharCount (bytes, index, count, 0, 0, throwOnInvalid, true);
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ private static int InternalGetChars (byte[] bytes, int byteIndex,
+ int byteCount, char[] chars,
+ int charIndex, ref uint leftOverBits,
+ ref uint leftOverCount,
+ bool throwOnInvalid, bool flush)
+ {
+ // Validate the parameters.
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if (byteCount < 0 || byteCount > (bytes.Length - byteIndex)) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_Array"));
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+
+ // Convert the bytes into the output buffer.
+ uint ch;
+ int length = chars.Length;
+ int posn = charIndex;
+ uint leftBits = leftOverBits;
+ uint leftSoFar = (leftOverCount & (uint)0x0F);
+ uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
+ while (byteCount > 0) {
+ // Fetch the next character from the byte buffer.
+ ch = (uint)(bytes[byteIndex++]);
+ --byteCount;
+ if (leftSize == 0) {
+ // Process a UTF-8 start character.
+ if (ch < (uint)0x0080) {
+ // Single-byte UTF-8 character.
+ if (posn >= length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = (char)ch;
+ } else if ((ch & (uint)0xE0) == (uint)0xC0) {
+ // Double-byte UTF-8 character.
+ leftBits = (ch & (uint)0x1F);
+ leftSoFar = 1;
+ leftSize = 2;
+ } else if ((ch & (uint)0xF0) == (uint)0xE0) {
+ // Three-byte UTF-8 character.
+ leftBits = (ch & (uint)0x0F);
+ leftSoFar = 1;
+ leftSize = 3;
+ } else if ((ch & (uint)0xF8) == (uint)0xF0) {
+ // Four-byte UTF-8 character.
+ leftBits = (ch & (uint)0x07);
+ leftSoFar = 1;
+ leftSize = 4;
+ } else if ((ch & (uint)0xFC) == (uint)0xF8) {
+ // Five-byte UTF-8 character.
+ leftBits = (ch & (uint)0x03);
+ leftSoFar = 1;
+ leftSize = 5;
+ } else if ((ch & (uint)0xFC) == (uint)0xFC) {
+ // Six-byte UTF-8 character.
+ leftBits = (ch & (uint)0x03);
+ leftSoFar = 1;
+ leftSize = 6;
+ } else {
+ // Invalid UTF-8 start character.
+ if (throwOnInvalid) {
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ }
+ } else {
+ // Process an extra byte in a multi-byte sequence.
+ if ((ch & (uint)0xC0) == (uint)0x80) {
+ leftBits = ((leftBits << 6) | (ch & (uint)0x3F));
+ if (++leftSoFar >= leftSize) {
+ // We have a complete character now.
+ if (leftBits < (uint)0x10000) {
+ if (leftBits != (uint)0xFEFF) {
+ if (posn >= length) {
+ throw new ArgumentException
+ (_("Arg_InsufficientSpace"), "chars");
+ }
+ chars[posn++] = (char)leftBits;
+ }
+ } else if (leftBits < (uint)0x110000) {
+ if ((posn + 2) > length) {
+ throw new ArgumentException
+ (_("Arg_InsufficientSpace"), "chars");
+ }
+ leftBits -= (uint)0x10000;
+ chars[posn++] = (char)((leftBits >> 10) +
+ (uint)0xD800);
+ chars[posn++] =
+ (char)((leftBits & (uint)0x3FF) + (uint)0xDC00);
+ } else if (throwOnInvalid) {
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ leftSize = 0;
+ }
+ } else {
+ // Invalid UTF-8 sequence: clear and restart.
+ if (throwOnInvalid) {
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ leftSize = 0;
+ --byteIndex;
+ ++byteCount;
+ }
+ }
+ }
+ if (flush && leftSize != 0 && throwOnInvalid) {
+ // We had left-over bytes that didn't make up
+ // a complete UTF-8 character sequence.
+ throw new ArgumentException (_("Arg_InvalidUTF8"), "bytes");
+ }
+ leftOverBits = leftBits;
+ leftOverCount = (leftSoFar | (leftSize << 4));
+
+ // Return the final length to the caller.
+ return posn - charIndex;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ uint leftOverBits = 0;
+ uint leftOverCount = 0;
+ return InternalGetChars (bytes, byteIndex, byteCount, chars,
+ charIndex, ref leftOverBits, ref leftOverCount, throwOnInvalid, true);
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount (int charCount)
+ {
+ if (charCount < 0) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_NonNegative"));
+ }
+ return charCount * 4;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount (int byteCount)
+ {
+ if (byteCount < 0) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_NonNegative"));
+ }
+ return byteCount;
+ }
+
+ // Get a UTF8-specific decoder that is attached to this instance.
+ public override Decoder GetDecoder ()
+ {
+ return new UTF8Decoder (throwOnInvalid);
+ }
+
+ // Get a UTF8-specific encoder that is attached to this instance.
+ public override Encoder GetEncoder ()
+ {
+ return new UTF8Encoder (emitIdentifier);
+ }
+
+ // Get the UTF8 preamble.
+ public override byte[] GetPreamble ()
+ {
+ if (emitIdentifier) {
+ byte[] pre = new byte [3];
+ pre[0] = (byte)0xEF;
+ pre[1] = (byte)0xBB;
+ pre[2] = (byte)0xBF;
+ return pre;
+ } else {
+ return new byte [0];
+ }
+ }
+
+ // Determine if this object is equal to another.
+ public override bool Equals (Object value)
+ {
+ UTF8Encoding enc = (value as UTF8Encoding);
+ if (enc != null) {
+ return (codePage == enc.codePage &&
+ emitIdentifier == enc.emitIdentifier &&
+ throwOnInvalid == enc.throwOnInvalid);
+ } else {
+ return false;
+ }
+ }
+
+ // Get the hash code for this object.
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get {
+ return "utf-8";
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get {
+ return "Unicode (UTF-8)";
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get {
+ return "utf-8";
+ }
+ }
+
+ // Determine if this encoding can be displayed in a Web browser.
+ public override bool IsBrowserDisplay
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a Web browser.
+ public override bool IsBrowserSave
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be displayed in a mail/news agent.
+ public override bool IsMailNewsDisplay
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Determine if this encoding can be saved from a mail/news agent.
+ public override bool IsMailNewsSave
+ {
+ get {
+ return true;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get {
+ return "utf-8";
+ }
+ }
+
+ // Get the Windows code page represented by this object.
+ public override int WindowsCodePage
+ {
+ get {
+ return UnicodeEncoding.UNICODE_CODE_PAGE;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+ // UTF-8 decoder implementation.
+ [Serializable]
+ private sealed class UTF8Decoder : Decoder
+ {
+ private bool throwOnInvalid;
+ private uint leftOverBits;
+ private uint leftOverCount;
+
+ // Constructor.
+ public UTF8Decoder (bool throwOnInvalid)
+ {
+ this.throwOnInvalid = throwOnInvalid;
+ leftOverBits = 0;
+ leftOverCount = 0;
+ }
+
+ // Override inherited methods.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return InternalGetCharCount (bytes, index, count,
+ leftOverBits, leftOverCount, throwOnInvalid, false);
+ }
+ public override int GetChars (byte[] bytes, int byteIndex,
+ int byteCount, char[] chars, int charIndex)
+ {
+ return InternalGetChars (bytes, byteIndex, byteCount,
+ chars, charIndex, ref leftOverBits, ref leftOverCount, throwOnInvalid, false);
+ }
+
+ } // class UTF8Decoder
+
+ // UTF-8 encoder implementation.
+ [Serializable]
+ private sealed class UTF8Encoder : Encoder
+ {
+ private bool emitIdentifier;
+ private uint leftOver;
+
+ // Constructor.
+ public UTF8Encoder (bool emitIdentifier)
+ {
+ this.emitIdentifier = emitIdentifier;
+ leftOver = 0;
+ }
+
+ // Override inherited methods.
+ public override int GetByteCount (char[] chars, int index,
+ int count, bool flush)
+ {
+ return InternalGetByteCount (chars, index, count, leftOver, flush);
+ }
+ public override int GetBytes (char[] chars, int charIndex,
+ int charCount, byte[] bytes, int byteCount, bool flush)
+ {
+ int result;
+ result = InternalGetBytes (chars, charIndex, charCount, bytes, byteCount, ref leftOver, flush);
+ emitIdentifier = false;
+ return result;
+ }
+
+ } // class UTF8Encoder
+
+}; // class UTF8Encoding
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Text/UnicodeEncoding.cs b/mcs/class/corlib/System.Text/UnicodeEncoding.cs
new file mode 100755
index 00000000000..405d70a139f
--- /dev/null
+++ b/mcs/class/corlib/System.Text/UnicodeEncoding.cs
@@ -0,0 +1,489 @@
+/*
+ * UnicodeEncoding.cs - Implementation of the
+ * "System.Text.UnicodeEncoding" class.
+ *
+ * Copyright (c) 2001, 2002 Southern Storm Software, Pty Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+namespace System.Text
+{
+
+using System;
+
+[Serializable]
+public class UnicodeEncoding : Encoding
+{
+ // Magic numbers used by Windows for Unicode.
+ internal const int UNICODE_CODE_PAGE = 1200;
+ internal const int BIG_UNICODE_CODE_PAGE = 1201;
+
+#if !ECMA_COMPAT
+ // Size of characters in this encoding.
+ public const int CharSize = 2;
+#endif
+
+ // Internal state.
+ private bool bigEndian;
+ private bool byteOrderMark;
+
+ // Constructors.
+ public UnicodeEncoding () : base(UNICODE_CODE_PAGE)
+ {
+ bigEndian = false;
+ byteOrderMark = true;
+ }
+ public UnicodeEncoding (bool bigEndian, bool byteOrderMark)
+ : base ((bigEndian ? BIG_UNICODE_CODE_PAGE : UNICODE_CODE_PAGE))
+ {
+ this.bigEndian = bigEndian;
+ this.byteOrderMark = byteOrderMark;
+ }
+
+ // Get the number of bytes needed to encode a character buffer.
+ public override int GetByteCount (char[] chars, int index, int count)
+ {
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (index < 0 || index > chars.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (chars.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ return count * 2;
+ }
+
+ // Convenience wrappers for "GetByteCount".
+ public override int GetByteCount (String s)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ return s.Length * 2;
+ }
+
+ // Get the bytes that result from encoding a character buffer.
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+ if (charCount < 0 || charCount > (chars.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_Array"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if ((bytes.Length - byteIndex) < (charCount * 2)) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int posn = byteIndex;
+ char ch;
+ if (bigEndian) {
+ while (charCount-- > 0) {
+ ch = chars[charIndex++];
+ bytes[posn++] = (byte)(ch >> 8);
+ bytes[posn++] = (byte)ch;
+ }
+ } else {
+ while (charCount-- > 0) {
+ ch = chars[charIndex++];
+ bytes[posn++] = (byte)ch;
+ bytes[posn++] = (byte)(ch >> 8);
+ }
+ }
+ return posn - byteIndex;
+ }
+
+ // Convenience wrappers for "GetBytes".
+ public override int GetBytes (String s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if (s == null) {
+ throw new ArgumentNullException ("s");
+ }
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (charIndex < 0 || charIndex > s.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_StringIndex"));
+ }
+ if (charCount < 0 || charCount > (s.Length - charIndex)) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_StringRange"));
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if ((bytes.Length - byteIndex) < (charCount * 2)) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ int posn = byteIndex;
+ char ch;
+ if (bigEndian) {
+ while (charCount-- > 0) {
+ ch = s[charIndex++];
+ bytes[posn++] = (byte)(ch >> 8);
+ bytes[posn++] = (byte)ch;
+ }
+ } else {
+ while (charCount-- > 0) {
+ ch = s[charIndex++];
+ bytes[posn++] = (byte)ch;
+ bytes[posn++] = (byte)(ch >> 8);
+ }
+ }
+ return posn - byteIndex;
+ }
+
+ // Get the number of characters needed to decode a byte buffer.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ if (count >= 2) {
+ if ((bytes[0] == (byte)0xFE && bytes[1] == (byte)0xFF) ||
+ (bytes[0] == (byte)0xFF && bytes[1] == (byte)0xFE)) {
+ return ((count - 1) / 2);
+ }
+ }
+ return count / 2;
+ }
+
+ // Get the characters that result from decoding a byte buffer.
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if (byteCount < 0 || byteCount > (bytes.Length - byteIndex)) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_Array"));
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+
+ // Determine the byte order in the incoming buffer.
+ bool isBigEndian;
+ if (byteCount >= 2) {
+ if (bytes[0] == (byte)0xFE && bytes[1] == (byte)0xFF) {
+ isBigEndian = true;
+ byteCount -= 2;
+ byteIndex += 2;
+ } else if (bytes[0] == (byte)0xFF && bytes[1] == (byte)0xFE) {
+ isBigEndian = false;
+ byteCount -= 2;
+ byteIndex += 2;
+ } else {
+ isBigEndian = bigEndian;
+ }
+ } else {
+ isBigEndian = bigEndian;
+ }
+
+ // Validate that we have sufficient space in "chars".
+ if ((chars.Length - charIndex) < (byteCount / 2)) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+
+ // Convert the characters.
+ int posn = charIndex;
+ if (isBigEndian) {
+ while (byteCount >= 2) {
+ chars[posn++] =
+ ((char)((((int)(bytes[byteIndex])) << 8) |
+ ((int)(bytes[byteIndex + 1]))));
+ byteIndex += 2;
+ byteCount -= 2;
+ }
+ } else {
+ while (byteCount >= 2) {
+ chars[posn++] =
+ ((char)((((int)(bytes[byteIndex + 1])) << 8) |
+ ((int)(bytes[byteIndex]))));
+ byteIndex += 2;
+ byteCount -= 2;
+ }
+ }
+ return posn - charIndex;
+ }
+
+ // Get the maximum number of bytes needed to encode a
+ // specified number of characters.
+ public override int GetMaxByteCount (int charCount)
+ {
+ if (charCount < 0) {
+ throw new ArgumentOutOfRangeException ("charCount", _("ArgRange_NonNegative"));
+ }
+ return charCount * 2;
+ }
+
+ // Get the maximum number of characters needed to decode a
+ // specified number of bytes.
+ public override int GetMaxCharCount (int byteCount)
+ {
+ if (byteCount < 0) {
+ throw new ArgumentOutOfRangeException
+ ("byteCount", _("ArgRange_NonNegative"));
+ }
+ return byteCount / 2;
+ }
+
+ // Get a Unicode-specific decoder that is attached to this instance.
+ public override Decoder GetDecoder ()
+ {
+ return new UnicodeDecoder (bigEndian);
+ }
+
+ // Get the Unicode preamble.
+ public override byte[] GetPreamble ()
+ {
+ if (byteOrderMark) {
+ byte[] preamble = new byte[2];
+ if (bigEndian) {
+ preamble[0] = (byte)0xFE;
+ preamble[1] = (byte)0xFF;
+ } else {
+ preamble[0] = (byte)0xFF;
+ preamble[1] = (byte)0xFE;
+ }
+ return preamble;
+ } else {
+ return new byte [0];
+ }
+ }
+
+ // Determine if this object is equal to another.
+ public override bool Equals (Object value)
+ {
+ UnicodeEncoding enc = (value as UnicodeEncoding);
+ if (enc != null) {
+ return (codePage == enc.codePage &&
+ bigEndian == enc.bigEndian &&
+ byteOrderMark == enc.byteOrderMark);
+ } else {
+ return false;
+ }
+ }
+
+ // Get the hash code for this object.
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+#if !ECMA_COMPAT
+
+ // Get the mail body name for this encoding.
+ public override String BodyName
+ {
+ get {
+ if (bigEndian) {
+ return "unicodeFFFE";
+ } else {
+ return "utf-16";
+ }
+ }
+ }
+
+ // Get the human-readable name for this encoding.
+ public override String EncodingName
+ {
+ get {
+ if (bigEndian) {
+ return "Unicode (Big-Endian)";
+ } else {
+ return "Unicode";
+ }
+ }
+ }
+
+ // Get the mail agent header name for this encoding.
+ public override String HeaderName
+ {
+ get {
+ if (bigEndian) {
+ return "unicodeFFFE";
+ } else {
+ return "utf-16";
+ }
+ }
+ }
+
+ // Determine if this encoding can be saved from a Web browser.
+ public override bool IsBrowserSave
+ {
+ get {
+ return !bigEndian;
+ }
+ }
+
+ // Get the IANA-preferred Web name for this encoding.
+ public override String WebName
+ {
+ get {
+ if (bigEndian) {
+ return "unicodeFFFE";
+ } else {
+ return "utf-16";
+ }
+ }
+ }
+
+ // Get the Windows code page represented by this object.
+ public override int WindowsCodePage
+ {
+ get {
+ // Windows reports the same code page number for
+ // both the little-endian and big-endian forms.
+ return UNICODE_CODE_PAGE;
+ }
+ }
+
+#endif // !ECMA_COMPAT
+
+ // Unicode decoder implementation.
+ private sealed class UnicodeDecoder : Decoder
+ {
+ private bool bigEndian;
+ private int leftOverByte;
+
+ // Constructor.
+ public UnicodeDecoder (bool bigEndian)
+ {
+ this.bigEndian = bigEndian;
+ leftOverByte = -1;
+ }
+
+ // Override inherited methods.
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (index < 0 || index > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ }
+ if (count < 0 || count > (bytes.Length - index)) {
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+ }
+ if (leftOverByte != -1) {
+ return (count + 1) / 2;
+ } else {
+ return count / 2;
+ }
+ }
+ public override int GetChars (byte[] bytes, int byteIndex,
+ int byteCount, char[] chars,
+ int charIndex)
+ {
+ if (bytes == null) {
+ throw new ArgumentNullException ("bytes");
+ }
+ if (chars == null) {
+ throw new ArgumentNullException ("chars");
+ }
+ if (byteIndex < 0 || byteIndex > bytes.Length) {
+ throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
+ }
+ if (byteCount < 0 || byteCount > (bytes.Length - byteIndex)) {
+ throw new ArgumentOutOfRangeException ("byteCount", _("ArgRange_Array"));
+ }
+ if (charIndex < 0 || charIndex > chars.Length) {
+ throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
+ }
+
+ // Convert the characters.
+ int posn = charIndex;
+ bool isBigEndian = bigEndian;
+ int leftOver = leftOverByte;
+ int length = chars.Length;
+ char ch;
+ while (byteCount > 0) {
+ if (leftOver != -1) {
+ if (isBigEndian) {
+ ch = ((char)((leftOver << 8) | ((int)(bytes[byteIndex]))));
+ } else {
+ ch = ((char)(leftOver |
+ (((int)(bytes[byteIndex])) << 8)));
+ }
+ leftOver = -1;
+ ++byteIndex;
+ --byteCount;
+ } else if (byteCount > 1) {
+ if (isBigEndian) {
+ ch = ((char)((((int)(bytes[byteIndex])) << 8) |
+ ((int)(bytes[byteIndex + 1]))));
+ } else {
+ ch = ((char)((((int)(bytes[byteIndex + 1])) << 8) |
+ ((int)(bytes[byteIndex]))));
+ }
+ byteIndex += 2;
+ byteCount -= 2;
+ } else {
+ leftOver = (int)(bytes[byteIndex]);
+ break;
+ }
+ if (ch == '\uFFFE') {
+ // Switch byte orders.
+ bigEndian = !bigEndian;
+ } else if (ch != '\uFEFF') {
+ // Ordinary character.
+ if (posn < length) {
+ chars[posn++] = ch;
+ } else {
+ throw new ArgumentException (_("Arg_InsufficientSpace"));
+ }
+ }
+ }
+ leftOverByte = leftOver;
+ bigEndian = isBigEndian;
+
+ // Finished - return the converted length.
+ return posn - charIndex;
+ }
+
+ } // class UnicodeDecoder
+
+}; // class UnicodeEncoding
+
+}; // namespace System.Text
diff --git a/mcs/class/corlib/System.Threading/ApartmentState.cs b/mcs/class/corlib/System.Threading/ApartmentState.cs
new file mode 100755
index 00000000000..0dfc50785b4
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ApartmentState.cs
@@ -0,0 +1,18 @@
+//
+// System.Threading.ApartmentState.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public enum ApartmentState {
+ STA = 0,
+ MTA = 1,
+ Unknown = 2
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/AutoResetEvent.cs b/mcs/class/corlib/System.Threading/AutoResetEvent.cs
new file mode 100755
index 00000000000..232f2d5e31d
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/AutoResetEvent.cs
@@ -0,0 +1,35 @@
+//
+// System.Threading.AutoResetEvent.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+
+ public sealed class AutoResetEvent : WaitHandle
+ {
+ // Constructor
+ public AutoResetEvent(bool initialState) {
+ Handle = NativeEventCalls.CreateEvent_internal(false,initialState,null);
+ }
+
+ // Methods
+
+ public bool Set() {
+ return(NativeEventCalls.SetEvent_internal(Handle));
+ }
+
+ public bool Reset() {
+ return(NativeEventCalls.ResetEvent_internal(Handle));
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog
new file mode 100644
index 00000000000..92414502056
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ChangeLog
@@ -0,0 +1,218 @@
+2003-01-10 Patrik Torstensson <totte@race-x-change.com>
+
+ * ThreadPool.cs: Temporary removed the usage of monitor thread, implemented a
+ model more equal to the MS one.
+
+2002-12-10 Dick Porter <dick@ximian.com>
+
+ * Monitor.cs:
+ * Thread.cs:
+ * ThreadPool.cs:
+ * Timer.cs:
+ * WaitHandle.cs: Use TotalMilliseconds to convert a TimeSpan to
+ ms, not Milliseconds.
+
+2002-12-07 Martin Baulig <martin@ximian.com>
+
+ * Timer.cs: Make it actually work; now it no longer sets your
+ application on fire if you use a zero periode and Timer.Change()
+ actually works.
+
+2002-11-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Timer.cs: implemented more stuff. It works now.
+
+2002-10-25 Zoltan Varga <vargaz@freemail.hu>
+
+ * Thread.cs: Implement GetDomain() and GetDomainID().
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ThreadPool.cs: now the monitor thread is not sleeping and checking if
+ more worker threads needed. It waits on _DataInQueue. If (and only if)
+ there's data in the queue it checks if more worker threads needed and
+ then sleeps 0.5s before waiting for queued data again.
+
+2002-09-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ThreadPool.cs: set IsThreadPoolThread before starting the worker.
+
+2002-09-11 Dick Porter <dick@ximian.com>
+
+ * Mutex.cs:
+ * ManualResetEvent.cs:
+ * AutoResetEvent.cs: Use the WaitHandle.Handle property instead of
+ the private field
+
+ * WaitHandle.cs: Hide the os_handle field and the WaitOne_internal
+ method
+
+2002-09-03 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Added thread ID field
+
+2002-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WaitHandle.cs: IDisposable fixes.
+
+2002-08-14 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Make CurrentUICulture act the same as CurrentCulture
+ for now.
+
+2002-08-12 Dietmar Maurer <dietmar@ximian.com>
+
+ * ThreadAbortException.cs: impl. ExceptionState property.
+
+ * Thread.cs: moved all instance variables to the start of the
+ class. added support for Thread::Abort()
+
+2002-04-30 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: If LocalDataStoreSlot already has data set, remove it
+ before adding a new one.
+
+ Use the Thread object destructor to tell the runtime to close the
+ thread handle.
+
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * Interlocked.cs: made all methods icalls.
+
+2002-04-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IOCompletionCallback.cs: added attributes to the delegate
+ (CLSCompliant(false) and Serializable).
+
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+ * Thread.cs: Fixed IsThreadPoolThread to use a internal property instead of extending
+ the threadstate enum.
+ * ThreadPool.cs: Now using the internal Isthreadpoolthread property
+ * ThreadState.cs: removed non-standard enum (ThreadPoolThread)
+
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * ThreadState.cs: Added enum for threadpool thread
+ * Thread.cs: changed the set/clr_state to be internal (used from threadpool)
+ * Thread.cs: Added IsThreadPoolThread
+ * ThreadPool.cs: Implementation of QueueUserWorkItem
+
+Wed Feb 13 21:51:30 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Thread.cs: implement CurrentCulture property needed by
+ Convert.ChangeType() (used when compiling enums).
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * ManualResetEvent.cs:
+ * AutoResetEvent.cs: Fixed DOS line endings
+
+2002-01-22 Veronica De Santis <veron78@interfree.it>
+
+ * NativeEventCalls : Class that contains internal calls shared by Auto
+ and Manual Reset Events
+ * AutoResetEvents.cs : Added class AutoResetEvents and its implementation
+ * ManualResetEvents.cs : Added class ManualResetEvents and its implementation
+
+2002-01-16 Veronica De Santis <veron78@interfree.it>
+
+ * WaitHandle.cs : Renamed handle to os_handle and make it protected
+ instead of private.
+ * Mutex.cs : Write the System.Threading.Mutex methods ( constructors
+ and the ReleaseMutex)
+
+2002-01-15 Dick Porter <dick@ximian.com>
+
+ * WaitHandle.cs:
+ * Thread.cs: Make the runtime's idea of infinite timeouts coincide
+ with the class library's
+
+2002-01-10 Dick Porter <dick@ximian.com>
+
+ * WaitHandle.cs: Added checks for too many handles and null
+ handles in WaitAll() and WaitAny
+
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * AutoResetEvent.cs, ManualResetEvent.cs, Monitor.cs : MonoTODO
+ decoration.
+
+ * Mutex.cs, Overlapped.cs, ReaderWriterLock.cs, RegisteredWaitHandle.cs,
+ Thread.cs, ThreadAbortException.cs, ThreadPool.cs, Timer.cs, WaitHandler.cs : Ditto.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * WaitHandle.cs: Implemented WaitAll(), WaitAny() and WaitOne() as
+ internal calls.
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: DataSlot uses a single system TLS slot, and a
+ hashtable per thread. Some minor changes to reflect the new
+ internal calls using the new IO library, and the newly-supported
+ bool returns from internal calls.
+
+ * Monitor.cs: Use bool returns from internal calls now they are
+ supported by the runtime. Coalesce enter with the try_enter
+ internal call.
+
+Wed Nov 14 17:06:18 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Overlapped.cs, ThreadPool.cs, Timer.cs: CLSCompliant updates.
+
+2001-10-03 Dick Porter <dick@ximian.com>
+
+ * Monitor.cs: Implemented all methods except the two Wait()
+ methods that take boolean parameters
+
+2001-09-28 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implemented AllocateDataSlot(),
+ AllocateNamedDataSlot(), FreeNamedDataSlot(), GetData(),
+ GetNamedDataSlot(), SetData(), IsBackground. Reworked Thread()
+ and Start() to avoid a race condition. Added thread-safe state
+ changing private operations.
+
+ * Monitor.cs: Comment out the GetType() calls because it isn't implemented yet
+
+2001-09-25 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implement Join and timed Join, set correct state
+ around Start, Join and Sleep calls, implement IsAlive and
+ ThreadState properties.
+
+ * ThreadState.cs (Threading): Added StopRequested,
+ SuspendRequested, Suspended values
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implemented CurrentThread and Sleep (both versions)
+ with internal calls, and Name.
+
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implement Thread(ThreadStart) constructor and Start()
+ with an internal call
+
+ * WaitHandle.cs: Close calls Dispose(false)
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * ApartmentState.cs (Threading): Set the correct enum values
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * ApartmentState.cs, AutoResetEvent.cs, IOCompletionCallback.cs,
+ Interlocked.cs, LockCookie.cs, ManualResetEvent.cs, Monitor.cs,
+ Mutex.cs, NativeOverlapped.cs, Overlapped.cs, ReaderWriterLock.cs,
+ RegisteredWaitHandle.cs, SynchronizationLockException.cs,
+ Thread.cs, ThreadAbortException.cs, ThreadInterruptedException.cs,
+ ThreadPool.cs, ThreadStart.cs, ThreadStateException.cs,
+ Timeout.cs, Timer.cs, TimerCallback.cs, WaitCallback.cs,
+ WaitHandle.cs, WaitOrTimerCallback.cs: System.Threading class
+ stubs.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * ThreadPriority.cs, ThreadState.cs: Add.
diff --git a/mcs/class/corlib/System.Threading/IOCompletionCallback.cs b/mcs/class/corlib/System.Threading/IOCompletionCallback.cs
new file mode 100755
index 00000000000..d384f8a29b7
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/IOCompletionCallback.cs
@@ -0,0 +1,18 @@
+//
+// System.Threading.IOCompletionCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ // 'unsafe' wasn't in the spec, but the compiler insists because of
+ // the pointer.
+ [Serializable]
+ [CLSCompliant(false)]
+ public unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP);
+}
diff --git a/mcs/class/corlib/System.Threading/Interlocked.cs b/mcs/class/corlib/System.Threading/Interlocked.cs
new file mode 100755
index 00000000000..d5d6a28df3a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Interlocked.cs
@@ -0,0 +1,51 @@
+//
+// System.Threading.Interlocked.cs
+//
+// Author:
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public sealed class Interlocked
+ {
+ private Interlocked () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int CompareExchange(ref int location1, int value, int comparand);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static object CompareExchange(ref object location1, object value, object comparand);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static float CompareExchange(ref float location1, float value, float comparand);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int Decrement(ref int location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static long Decrement(ref long location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int Increment(ref int location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static long Increment(ref long location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int Exchange(ref int location1, int value);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static object Exchange(ref object location1, object value);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static float Exchange(ref float location1, float value);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Threading/LockCookie.cs b/mcs/class/corlib/System.Threading/LockCookie.cs
new file mode 100755
index 00000000000..e3d226c8b0e
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/LockCookie.cs
@@ -0,0 +1,17 @@
+//
+// System.Threading.LockCookie.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ [Serializable]
+ public struct LockCookie
+ {
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ManualResetEvent.cs b/mcs/class/corlib/System.Threading/ManualResetEvent.cs
new file mode 100755
index 00000000000..7854e4c884b
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ManualResetEvent.cs
@@ -0,0 +1,38 @@
+//
+// System.Threading.ManualResetEvent.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+
+ public sealed class ManualResetEvent : WaitHandle
+ {
+ // Constructor
+ public ManualResetEvent (bool initialState)
+ {
+ Handle = NativeEventCalls.CreateEvent_internal (true, initialState, null);
+ }
+
+ // Methods
+
+ public bool Set()
+ {
+ return (NativeEventCalls.SetEvent_internal (Handle));
+ }
+
+ public bool Reset()
+ {
+ return(NativeEventCalls.ResetEvent_internal (Handle));
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Monitor.cs b/mcs/class/corlib/System.Threading/Monitor.cs
new file mode 100755
index 00000000000..e34fd383256
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Monitor.cs
@@ -0,0 +1,224 @@
+//
+// System.Threading.Monitor.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public sealed class Monitor
+ {
+ private Monitor () {}
+
+ // Grabs the mutex on object 'obj', with a maximum
+ // wait time 'ms' but doesn't block - if it can't get
+ // the lock it returns false, true if it can
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_try_enter(object obj, int ms);
+ public static void Enter(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ Monitor_try_enter(obj, Timeout.Infinite);
+ }
+
+ // Releases the mutex on object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Monitor_exit(object obj);
+
+ // Checks whether the current thread currently owns
+ // the lock on object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_test_owner(object obj);
+
+ public static void Exit(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ if(Monitor_test_owner(obj)==false) {
+ throw new SynchronizationLockException("The current thread does not own the lock");
+ }
+
+ Monitor_exit(obj);
+ }
+
+ // Signals one of potentially many objects waiting on
+ // object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Monitor_pulse(object obj);
+
+ // Checks whether object 'obj' is currently synchronised
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_test_synchronised(object obj);
+
+ public static void Pulse(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ Monitor_pulse(obj);
+ }
+
+ // Signals all of potentially many objects waiting on
+ // object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Monitor_pulse_all(object obj);
+
+ public static void PulseAll(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ Monitor_pulse_all(obj);
+ }
+
+ public static bool TryEnter(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ return(Monitor_try_enter(obj, 0));
+ }
+
+ public static bool TryEnter(object obj, int millisecondsTimeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ // LAMESPEC: should throw an exception when ms<0, but
+ // Timeout.Infinite is -1
+ if(millisecondsTimeout == Timeout.Infinite) {
+ Enter(obj);
+ return(true);
+ }
+
+ if(millisecondsTimeout<0) {
+ throw new ArgumentException("millisecondsTimeout negative");
+ }
+
+ return(Monitor_try_enter(obj, millisecondsTimeout));
+ }
+
+ public static bool TryEnter(object obj, TimeSpan timeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ // LAMESPEC: should throw an exception when ms<0, but
+ // Timeout.Infinite is -1
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms == Timeout.Infinite) {
+ Enter(obj);
+ return(true);
+ }
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+
+ return(Monitor_try_enter(obj, ms));
+ }
+
+ // Waits for a signal on object 'obj' with maximum
+ // wait time 'ms'. Returns true if the object was
+ // signalled, false if it timed out
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_wait(object obj, int ms);
+
+ public static bool Wait(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ return(Monitor_wait(obj, 0));
+ }
+
+ public static bool Wait(object obj, int millisecondsTimeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+ // LAMESPEC: no mention of timeout sanity checking
+
+ return(Monitor_wait(obj, millisecondsTimeout));
+ }
+
+ public static bool Wait(object obj, TimeSpan timeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ // LAMESPEC: says to throw ArgumentException too
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ return(Monitor_wait(obj, ms));
+ }
+
+ [MonoTODO]
+ public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ // FIXME when I understand what a
+ // "synchronisation domain" is and does
+ return(false);
+ }
+
+ [MonoTODO]
+ public static bool Wait(object obj, TimeSpan timeout, bool exitContext) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ // LAMESPEC: says to throw ArgumentException too
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+
+ // FIXME when I understand what a
+ // "synchronisation domain" is and does
+ return(false);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Mutex.cs b/mcs/class/corlib/System.Threading/Mutex.cs
new file mode 100755
index 00000000000..e87154b85c4
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Mutex.cs
@@ -0,0 +1,49 @@
+//
+// System.Threading.Mutex.cs
+//
+// Author:
+//
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public sealed class Mutex : WaitHandle
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern IntPtr CreateMutex_internal(
+ bool initiallyOwned,
+ string name);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void ReleaseMutex_internal(IntPtr handle);
+
+ public Mutex() {
+ Handle=CreateMutex_internal(false,null);
+ }
+
+ public Mutex(bool initiallyOwned) {
+ Handle=CreateMutex_internal(initiallyOwned,null);
+ }
+
+ public Mutex(bool initiallyOwned, string name) {
+ Handle=CreateMutex_internal(initiallyOwned,name);
+ }
+
+
+ public Mutex(bool initiallyOwned, string name, out bool gotOwnership) {
+ Handle=CreateMutex_internal(initiallyOwned,name);
+ gotOwnership=false;
+ }
+
+ public void ReleaseMutex() {
+ ReleaseMutex_internal(Handle);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/NativeEventCalls.cs b/mcs/class/corlib/System.Threading/NativeEventCalls.cs
new file mode 100755
index 00000000000..08dd8363f23
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/NativeEventCalls.cs
@@ -0,0 +1,28 @@
+//
+// System.Threading.AutoResetEvent.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ internal sealed class NativeEventCalls
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern IntPtr CreateEvent_internal(bool manual,bool initial,string name);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool SetEvent_internal(IntPtr handle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool ResetEvent_internal(IntPtr handle);
+
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/NativeOverlapped.cs b/mcs/class/corlib/System.Threading/NativeOverlapped.cs
new file mode 100755
index 00000000000..2f681fba4ba
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/NativeOverlapped.cs
@@ -0,0 +1,27 @@
+//
+// System.Threading.NativeOverlapped.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Threading
+{
+ public struct NativeOverlapped {
+ public int EventHandle;
+ public int InternalHigh;
+ public int InternalLow;
+ public int OffsetHigh;
+ public int OffsetLow;
+
+ // (fields disappeared beta2 -> 1.0)
+
+ // public GCHandle ReservedClassLib;
+ // public int ReservedCOR1;
+ // public GCHandle ReservedCOR2;
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Overlapped.cs b/mcs/class/corlib/System.Threading/Overlapped.cs
new file mode 100755
index 00000000000..25f33bf8d5d
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Overlapped.cs
@@ -0,0 +1,92 @@
+//
+// System.Threading.Overlapped.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public class Overlapped
+ {
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public static void Free(NativeOverlapped *nativeOverlappedPtr) {
+ // FIXME
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public static Overlapped Unpack(NativeOverlapped *nativeOverlappedPtr) {
+ // FIXME
+ return(new Overlapped());
+ }
+
+ [MonoTODO]
+ public Overlapped() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public Overlapped(int offsetLo, int offsetHi, int hEvent, IAsyncResult ar) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public IAsyncResult AsyncResult {
+ get {
+ // FIXME
+ return(null);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int EventHandle {
+ get {
+ // FIXME
+ return(0);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int OffsetHigh {
+ get {
+ // FIXME
+ return(0);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int OffsetLow {
+ get {
+ // FIXME
+ return(0);
+ }
+
+ set {
+ }
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public NativeOverlapped *Pack(IOCompletionCallback iocb) {
+ // FIXME
+ return(null);
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public NativeOverlapped *UnsafePack(IOCompletionCallback iocb) {
+ // FIXME
+ return(null);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ReaderWriterLock.cs b/mcs/class/corlib/System.Threading/ReaderWriterLock.cs
new file mode 100755
index 00000000000..95784811682
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ReaderWriterLock.cs
@@ -0,0 +1,109 @@
+//
+// System.Threading.ReaderWriterLock.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class ReaderWriterLock
+ {
+ [MonoTODO]
+ public ReaderWriterLock() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public bool IsReaderLockHeld {
+ get {
+ // FIXME
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public bool IsWriterLockHeld {
+ get {
+ // FIXME
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public int WriterSeqNum {
+ get {
+ // FIXME
+ return(0);
+ }
+ }
+
+
+ [MonoTODO]
+ public void AcquireReaderLock(int millisecondsTimeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void AcquireReaderLock(TimeSpan timeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void AcquireWriterLock(int millisecondsTimeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void AcquireWriterLock(TimeSpan timeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public bool AnyWritersSince(int seqNum) {
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ public void DowngradeFromWriterLock(ref LockCookie lockCookie) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public LockCookie ReleaseLock() {
+ // FIXME
+ return(new LockCookie());
+ }
+
+ [MonoTODO]
+ public void ReleaseReaderLock() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void ReleaseWriterLock() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void RestoreLock(ref LockCookie lockCookie) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public LockCookie UpgradeToWriterLock(int millisecondsTimeout) {
+ // FIXME
+ return(new LockCookie());
+ }
+
+ [MonoTODO]
+ public LockCookie UpgradeToWriterLock(TimeSpan timeout) {
+ // FIXME
+ return(new LockCookie());
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs b/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs
new file mode 100755
index 00000000000..8cf4d449da8
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs
@@ -0,0 +1,28 @@
+//
+// System.Threading.RegisteredWaitHandle.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class RegisteredWaitHandle : MarshalByRefObject
+ {
+ internal RegisteredWaitHandle () {}
+
+ [MonoTODO]
+ public bool Unregister(WaitHandle waitObject) {
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ ~RegisteredWaitHandle() {
+ // FIXME
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/SynchronizationLockException.cs b/mcs/class/corlib/System.Threading/SynchronizationLockException.cs
new file mode 100755
index 00000000000..7d5c8090e17
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/SynchronizationLockException.cs
@@ -0,0 +1,33 @@
+//
+// System.Threading.SynchronizationLockException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Threading
+{
+ [Serializable]
+ public class SynchronizationLockException : SystemException
+ {
+ public SynchronizationLockException()
+ : base ("Synchronization Error") {
+ }
+
+ public SynchronizationLockException(string message)
+ : base (message) {
+ }
+
+ protected SynchronizationLockException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public SynchronizationLockException(string message, Exception innerException)
+ : base (message, innerException) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs
new file mode 100755
index 00000000000..01996d74f65
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Thread.cs
@@ -0,0 +1,436 @@
+//
+// System.Threading.Thread.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Contexts;
+using System.Security.Principal;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Collections;
+
+namespace System.Threading
+{
+ public sealed class Thread
+ {
+ // stores a thread handle
+ private IntPtr system_thread_handle;
+
+ private CultureInfo current_culture;
+ private bool threadpool_thread = false;
+ private ThreadState state = ThreadState.Unstarted;
+ private object abort_exc;
+ internal object abort_state;
+ /* thread_id is only accessed from unmanaged code */
+ private int thread_id;
+
+ [MonoTODO]
+ public static Context CurrentContext {
+ get {
+ // FIXME -
+ // System.Runtime.Remoting.Context not
+ // yet implemented
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public static IPrincipal CurrentPrincipal {
+ get {
+ // FIXME -
+ // System.Security.Principal.IPrincipal
+ // not yet implemented
+ return(null);
+ }
+
+ set {
+ }
+ }
+
+ // Looks up the object associated with the current thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static Thread CurrentThread_internal();
+
+ public static Thread CurrentThread {
+ get {
+ return(CurrentThread_internal());
+ }
+ }
+
+ // Looks up the slot hash for the current thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static Hashtable SlotHash_lookup();
+
+ // Stores the slot hash for the current thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void SlotHash_store(Hashtable slothash);
+
+ private static Hashtable GetTLSSlotHash() {
+ Hashtable slothash=SlotHash_lookup();
+ if(slothash==null) {
+ // Not synchronised, because this is
+ // thread specific anyway.
+ slothash=new Hashtable();
+ SlotHash_store(slothash);
+ }
+
+ return(slothash);
+ }
+
+ public static LocalDataStoreSlot AllocateDataSlot() {
+ LocalDataStoreSlot slot = new LocalDataStoreSlot();
+
+ return(slot);
+ }
+
+ // Stores a hash keyed by strings of LocalDataStoreSlot objects
+ static Hashtable datastorehash = Hashtable.Synchronized(new Hashtable());
+
+ public static LocalDataStoreSlot AllocateNamedDataSlot(string name) {
+ LocalDataStoreSlot slot = (LocalDataStoreSlot)datastorehash[name];
+ if(slot!=null) {
+ // This exception isnt documented (of
+ // course) but .net throws it
+ throw new ArgumentException("Named data slot already added");
+ }
+
+ slot = new LocalDataStoreSlot();
+
+ datastorehash.Add(name, slot);
+
+ return(slot);
+ }
+
+ public static void FreeNamedDataSlot(string name) {
+ LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
+
+ if(slot!=null) {
+ datastorehash.Remove(slot);
+ }
+ }
+
+ public static object GetData(LocalDataStoreSlot slot) {
+ Hashtable slothash=GetTLSSlotHash();
+ return(slothash[slot]);
+ }
+
+ public static AppDomain GetDomain() {
+ return AppDomain.CurrentDomain;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int GetDomainID();
+
+ public static LocalDataStoreSlot GetNamedDataSlot(string name) {
+ LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
+
+ if(slot==null) {
+ slot=AllocateNamedDataSlot(name);
+ }
+
+ return(slot);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void ResetAbort();
+
+ public static void SetData(LocalDataStoreSlot slot,
+ object data) {
+ Hashtable slothash=GetTLSSlotHash();
+
+ if(slothash[slot]!=null) {
+ slothash.Remove(slot);
+ }
+
+ slothash.Add(slot, data);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Sleep_internal(int ms);
+
+ public static void Sleep(int millisecondsTimeout) {
+ if(millisecondsTimeout<0) {
+ throw new ArgumentException("Negative timeout");
+ }
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+
+ Sleep_internal(millisecondsTimeout);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+ }
+
+ public static void Sleep(TimeSpan timeout) {
+ // LAMESPEC: says to throw ArgumentException too
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Timeout out of range");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ Sleep_internal(ms);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+ }
+
+ // Returns the system thread handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern IntPtr Thread_internal(ThreadStart start);
+
+ public Thread(ThreadStart start) {
+ if(start==null) {
+ throw new ArgumentNullException("Null ThreadStart");
+ }
+
+ // This is a two-stage thread launch. Thread_internal
+ // creates the new thread, but blocks it until
+ // Start() is called later.
+ system_thread_handle=Thread_internal(start);
+
+ // Should throw an exception here if
+ // Thread_internal returns NULL
+ }
+
+ [MonoTODO]
+ public ApartmentState ApartmentState {
+ get {
+ // FIXME
+ return(ApartmentState.Unknown);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public CultureInfo CurrentCulture {
+ get {
+ if (current_culture == null)
+ current_culture = new CultureInfo ("");
+ return current_culture;
+ }
+
+ set {
+ current_culture = value;
+ }
+ }
+
+ [MonoTODO]
+ public CultureInfo CurrentUICulture {
+ get {
+ // FIXME
+ return(CurrentCulture);
+ }
+
+ set {
+ // FIXME
+ CurrentCulture=value;
+ }
+ }
+
+ public bool IsThreadPoolThread {
+ get {
+ return IsThreadPoolThreadInternal;
+ }
+ }
+
+ internal bool IsThreadPoolThreadInternal {
+ get {
+ return threadpool_thread;
+ }
+ set {
+ threadpool_thread = value;
+ }
+ }
+
+ public bool IsAlive {
+ get {
+ // LAMESPEC: is a Stopped or Suspended
+ // thread dead?
+ ThreadState curstate=state;
+
+ if((curstate & ThreadState.Aborted) != 0 ||
+ (curstate & ThreadState.AbortRequested) != 0 ||
+ (curstate & ThreadState.Unstarted) != 0) {
+ return(false);
+ } else {
+ return(true);
+ }
+ }
+ }
+
+ public bool IsBackground {
+ get {
+ if((state & ThreadState.Background) != 0) {
+ return(true);
+ } else {
+ return(false);
+ }
+ }
+
+ set {
+ if(value==true) {
+ set_state(ThreadState.Background);
+ } else {
+ clr_state(ThreadState.Background);
+ }
+ }
+ }
+
+ private string thread_name=null;
+
+ public string Name {
+ get {
+ return(thread_name);
+ }
+
+ set {
+ thread_name=value;
+ }
+ }
+
+ [MonoTODO]
+ public ThreadPriority Priority {
+ get {
+ // FIXME
+ return(ThreadPriority.Lowest);
+ }
+
+ set {
+ }
+ }
+
+ public ThreadState ThreadState {
+ get {
+ return(state);
+ }
+ }
+
+ public void Abort() {
+ Abort (null);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern void Abort (object stateInfo);
+
+ [MonoTODO]
+ public void Interrupt() {
+ // FIXME
+ }
+
+ // The current thread joins with 'this'. Set ms to 0 to block
+ // until this actually exits.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern bool Join_internal(int ms, IntPtr handle);
+
+ public void Join() {
+ if((state & ThreadState.Unstarted) != 0) {
+ throw new ThreadStateException("Thread has not been started");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ Join_internal(Timeout.Infinite, system_thread_handle);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+ }
+
+ public bool Join(int millisecondsTimeout) {
+ if(millisecondsTimeout<0) {
+ throw new ArgumentException("Timeout less than zero");
+ }
+ if((state & ThreadState.Unstarted) != 0) {
+ throw new ThreadStateException("Thread has not been started");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ bool ret=Join_internal(millisecondsTimeout,
+ system_thread_handle);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+
+ return(ret);
+ }
+
+ public bool Join(TimeSpan timeout) {
+ // LAMESPEC: says to throw ArgumentException too
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+ if((state & ThreadState.Unstarted) != 0) {
+ throw new ThreadStateException("Thread has not been started");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ bool ret=Join_internal(ms, system_thread_handle);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+
+ return(ret);
+ }
+
+ [MonoTODO]
+ public void Resume() {
+ // FIXME
+ }
+
+ // Launches the thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void Start_internal(IntPtr handle);
+
+ public void Start() {
+ if((state & ThreadState.Unstarted) == 0) {
+ throw new ThreadStateException("Thread has already been started");
+ }
+
+ // Mark the thread state as Running (which is
+ // all bits cleared). Therefore just remove
+ // the Unstarted bit
+ clr_state(ThreadState.Unstarted);
+
+ // Launch this thread
+ Start_internal(system_thread_handle);
+ }
+
+ [MonoTODO]
+ public void Suspend() {
+ if((state & ThreadState.Unstarted) != 0 || !IsAlive) {
+ throw new ThreadStateException("Thread has not been started, or is dead");
+ }
+
+ set_state(ThreadState.SuspendRequested);
+ // FIXME - somehow let the interpreter know that
+ // this thread should now suspend
+ }
+
+ // Closes the system thread handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void Thread_free_internal(IntPtr handle);
+
+ ~Thread() {
+ // Free up the handle
+ Thread_free_internal(system_thread_handle);
+ }
+
+ private void set_state(ThreadState set) {
+ lock(this) {
+ state |= set;
+ }
+ }
+ private void clr_state(ThreadState clr) {
+ lock(this) {
+ state &= ~clr;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadAbortException.cs b/mcs/class/corlib/System.Threading/ThreadAbortException.cs
new file mode 100755
index 00000000000..107dcfe1c26
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadAbortException.cs
@@ -0,0 +1,25 @@
+//
+// System.Threading.ThreadAbortException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ [Serializable]
+ public sealed class ThreadAbortException : SystemException
+ {
+ private ThreadAbortException () : base ("Thread was being aborted") {}
+
+ public object ExceptionState {
+ get {
+ return Thread.CurrentThread.abort_state;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadInterruptedException.cs b/mcs/class/corlib/System.Threading/ThreadInterruptedException.cs
new file mode 100755
index 00000000000..f6a82ec6aad
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadInterruptedException.cs
@@ -0,0 +1,33 @@
+//
+// System.Threading.ThreadInterruptedException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Threading
+{
+ [Serializable]
+ public class ThreadInterruptedException : SystemException
+ {
+ public ThreadInterruptedException()
+ : base ("Thread interrupted") {
+ }
+
+ public ThreadInterruptedException(string message)
+ : base (message) {
+ }
+
+ protected ThreadInterruptedException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public ThreadInterruptedException(string message, Exception innerException)
+ : base (message, innerException) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadPool.cs b/mcs/class/corlib/System.Threading/ThreadPool.cs
new file mode 100755
index 00000000000..ccc66c3cc1e
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadPool.cs
@@ -0,0 +1,259 @@
+//
+// System.Threading.ThreadPool
+//
+// Author:
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+// (C) Patrik Torstensson
+//
+using System;
+using System.Collections;
+
+namespace System.Threading
+{
+ /// <summary> (Patrik T notes)
+ /// This threadpool is focused on saving resources not giving max performance.
+ ///
+ /// Note, this class is not perfect but it works. ;-) Should also replace
+ /// the queue with an internal one (performance)
+ ///
+ /// This class should also use a specialized queue to increase performance..
+ /// </summary>
+ ///
+ public sealed class ThreadPool {
+ internal struct ThreadPoolWorkItem {
+ public WaitCallback _CallBack;
+ public object _Context;
+ }
+
+ private int _ThreadTimeout;
+
+ private long _MaxThreads;
+ private long _CurrentThreads;
+ private long _ThreadsInUse;
+ private long _RequestInQueue;
+ private long _ThreadCreateTriggerRequests;
+
+ private Thread _MonitorThread;
+ private Queue _RequestQueue;
+
+ private ArrayList _Threads;
+ private ManualResetEvent _DataInQueue;
+
+ static ThreadPool _Threadpool;
+
+ static ThreadPool() {
+ _Threadpool = new ThreadPool();
+ }
+
+ private ThreadPool() {
+ // 30 sec timeout default
+ _ThreadTimeout = 30 * 1000;
+
+ // Used to signal that there is data in the queue
+ _DataInQueue = new ManualResetEvent(false);
+
+ _Threads = ArrayList.Synchronized(new ArrayList());
+
+ // Holds requests..
+ _RequestQueue = Queue.Synchronized(new Queue(128));
+
+ // TODO: This should be 2 x number of CPU:s in the box
+ _MaxThreads = 16;
+ _CurrentThreads = 0;
+ _RequestInQueue = 0;
+ _ThreadsInUse = 0;
+ _ThreadCreateTriggerRequests = 5;
+
+ // TODO: This temp starts one thread, remove this..
+ CheckIfStartThread();
+
+ // Keeps track of requests in the queue and increases the number of threads if needed
+
+ // PT: Disabled - causes problems during shutdown
+ //_MonitorThread = new Thread(new ThreadStart(MonitorThread));
+ //_MonitorThread.Start();
+ }
+
+ internal void RemoveThread() {
+ Interlocked.Decrement(ref _CurrentThreads);
+ _Threads.Remove(Thread.CurrentThread);
+ }
+
+ internal void CheckIfStartThread() {
+ bool bCreateThread = false;
+
+ if (_CurrentThreads == 0) {
+ bCreateThread = true;
+ }
+
+ if (( _MaxThreads == -1 || _CurrentThreads < _MaxThreads) &&
+ _ThreadsInUse > 0 &&
+ _RequestInQueue >= _ThreadCreateTriggerRequests) {
+ bCreateThread = true;
+ }
+
+ if (bCreateThread) {
+ Interlocked.Increment(ref _CurrentThreads);
+
+ Thread Start = new Thread(new ThreadStart(WorkerThread));
+ Start.IsThreadPoolThreadInternal = true;
+ Start.Start();
+
+ _Threads.Add(Start);
+ }
+ }
+
+ internal void AddItem(ref ThreadPoolWorkItem Item) {
+ if (Interlocked.Increment(ref _RequestInQueue) == 1) {
+ _DataInQueue.Set();
+ }
+
+ _RequestQueue.Enqueue(Item);
+ }
+
+ // Work Thread main function
+ internal void WorkerThread() {
+ bool bWaitForData = true;
+
+ while (true) {
+ if (bWaitForData) {
+ if (!_DataInQueue.WaitOne(_ThreadTimeout, false)) {
+ // timeout
+ RemoveThread();
+ return;
+ }
+ }
+
+ Interlocked.Increment(ref _ThreadsInUse);
+
+ // TODO: Remove when we know how to stop the watch thread
+ CheckIfStartThread();
+
+ try {
+ ThreadPoolWorkItem oItem = (ThreadPoolWorkItem) _RequestQueue.Dequeue();
+
+ if (Interlocked.Decrement(ref _RequestInQueue) == 0) {
+ _DataInQueue.Reset();
+ }
+
+ oItem._CallBack(oItem._Context);
+ }
+ catch (InvalidOperationException) {
+ // Queue empty
+ bWaitForData = true;
+ }
+ catch (ThreadAbortException) {
+ // We will leave here.. (thread abort can't be handled)
+ RemoveThread();
+ }
+ finally {
+ Interlocked.Decrement(ref _ThreadsInUse);
+ }
+ }
+ }
+
+ /* This is not used currently
+ internal void MonitorThread() {
+ while (true) {
+ if (_DataInQueue.WaitOne ()) {
+ CheckIfStartThread();
+ }
+
+ Thread.Sleep(500);
+ }
+ }
+ */
+ internal bool QueueUserWorkItemInternal(WaitCallback callback) {
+ return QueueUserWorkItem(callback, null);
+ }
+
+ internal bool QueueUserWorkItemInternal(WaitCallback callback, object context) {
+ ThreadPoolWorkItem Item = new ThreadPoolWorkItem();
+
+ Item._CallBack = callback;
+ Item._Context = context;
+
+ AddItem(ref Item);
+
+ // LAMESPEC: Return value? should use exception here if anything goes wrong
+ return true;
+ }
+
+ public static bool BindHandle(IntPtr osHandle) {
+ throw new NotSupportedException("This is a win32 specific method, not supported Mono");
+ }
+
+ public static bool QueueUserWorkItem(WaitCallback callback) {
+ return _Threadpool.QueueUserWorkItemInternal(callback);
+ }
+
+ public static bool QueueUserWorkItem(WaitCallback callback, object state) {
+ return _Threadpool.QueueUserWorkItemInternal(callback, state);
+ }
+
+ public static bool UnsafeQueueUserWorkItem(WaitCallback callback, object state) {
+ return _Threadpool.QueueUserWorkItemInternal(callback, state);
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ if (millisecondsTimeOutInterval < -1) {
+ throw new ArgumentOutOfRangeException("timeout < -1");
+ }
+
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ if (millisecondsTimeOutInterval < -1) {
+ throw new ArgumentOutOfRangeException("timeout < -1");
+ }
+
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, TimeSpan timeout, bool executeOnlyOnce) {
+ // LAMESPEC: I assume it means "timeout" when it says "millisecondsTimeOutInterval"
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if (ms < -1) {
+ throw new ArgumentOutOfRangeException("timeout < -1");
+ }
+ if (ms > Int32.MaxValue) {
+ throw new NotSupportedException("timeout too large");
+ }
+
+ throw new NotImplementedException();
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, TimeSpan timeout, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadPriority.cs b/mcs/class/corlib/System.Threading/ThreadPriority.cs
new file mode 100644
index 00000000000..ec7a32cae26
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadPriority.cs
@@ -0,0 +1,41 @@
+// ThreadPriority.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:24 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Threading {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ThreadPriority {
+
+ /// <summary>
+ /// </summary>
+ Lowest = 0,
+
+ /// <summary>
+ /// </summary>
+ BelowNormal = 1,
+
+ /// <summary>
+ /// </summary>
+ Normal = 2,
+
+ /// <summary>
+ /// </summary>
+ AboveNormal = 3,
+
+ /// <summary>
+ /// </summary>
+ Highest = 4,
+ } // ThreadPriority
+
+} // System.Threading
diff --git a/mcs/class/corlib/System.Threading/ThreadStart.cs b/mcs/class/corlib/System.Threading/ThreadStart.cs
new file mode 100755
index 00000000000..ebd6bc9f764
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadStart.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.ThreadStart.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void ThreadStart();
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadState.cs b/mcs/class/corlib/System.Threading/ThreadState.cs
new file mode 100644
index 00000000000..7693dae3c81
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadState.cs
@@ -0,0 +1,55 @@
+// ThreadState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:30 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Threading {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ThreadState {
+
+ /// <summary>
+ /// </summary>
+ Running = 0x00000000,
+
+ StopRequested = 0x00000001,
+ SuspendRequested = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Background = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Unstarted = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ Stopped = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ WaitSleepJoin = 0x00000020,
+
+ Suspended = 0x00000040,
+
+ /// <summary>
+ /// </summary>
+ AbortRequested = 0x00000080,
+
+ /// <summary>
+ /// </summary>
+ Aborted = 0x00000100,
+ } // ThreadState
+
+} // System.Threading
diff --git a/mcs/class/corlib/System.Threading/ThreadStateException.cs b/mcs/class/corlib/System.Threading/ThreadStateException.cs
new file mode 100755
index 00000000000..c359fe011b1
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadStateException.cs
@@ -0,0 +1,33 @@
+//
+// System.Threading.ThreadStateException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Threading
+{
+ [Serializable]
+ public class ThreadStateException : SystemException
+ {
+ public ThreadStateException()
+ : base ("Thread State Error") {
+ }
+
+ public ThreadStateException(string message)
+ : base (message) {
+ }
+
+ protected ThreadStateException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public ThreadStateException(string message, Exception innerException)
+ : base (message, innerException) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Timeout.cs b/mcs/class/corlib/System.Threading/Timeout.cs
new file mode 100755
index 00000000000..397e213ddf7
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Timeout.cs
@@ -0,0 +1,18 @@
+//
+// System.Threading.Timeout.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class Timeout
+ {
+ private Timeout () {}
+ public const int Infinite=-1;
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Timer.cs b/mcs/class/corlib/System.Threading/Timer.cs
new file mode 100755
index 00000000000..1a48d38b22a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Timer.cs
@@ -0,0 +1,239 @@
+//
+// System.Threading.Timer.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class Timer : MarshalByRefObject, IDisposable
+ {
+ sealed class Runner : MarshalByRefObject, IDisposable
+ {
+ ManualResetEvent wait;
+ AutoResetEvent start_event;
+ TimerCallback callback;
+ object state;
+ int dueTime;
+ int period;
+ bool disposed;
+ bool aborted;
+
+ public Runner (TimerCallback callback, object state, AutoResetEvent start_event)
+ {
+ this.callback = callback;
+ this.state = state;
+ this.start_event = start_event;
+ this.wait = new ManualResetEvent (false);
+ }
+
+ public int DueTime {
+ get { return dueTime; }
+ set { dueTime = value; }
+ }
+
+ public int Period {
+ get { return period; }
+ set { period = value == 0 ? Timeout.Infinite : value; }
+ }
+
+ bool WaitForDueTime ()
+ {
+ if (dueTime > 0) {
+ bool signaled;
+ do {
+ wait.Reset ();
+ signaled = wait.WaitOne (dueTime, false);
+ } while (signaled == true && !disposed && !aborted);
+
+ if (!signaled)
+ callback (state);
+
+ if (disposed)
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Abort ()
+ {
+ lock (this) {
+ aborted = true;
+ wait.Set ();
+ }
+ }
+
+ public void Start ()
+ {
+ while (start_event.WaitOne ()) {
+ aborted = false;
+
+ if (dueTime == Timeout.Infinite)
+ continue;
+
+ if (!WaitForDueTime ())
+ return;
+
+ if (aborted || (period == Timeout.Infinite))
+ continue;
+
+ bool signaled = false;
+ while (true) {
+ wait.Reset ();
+ signaled = wait.WaitOne (period, false);
+ if (disposed)
+ return;
+
+ if (aborted)
+ break;
+
+ if (!signaled) {
+ callback (state);
+ } else if (!WaitForDueTime ()) {
+ return;
+ }
+ }
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ }
+
+ void Dispose (bool disposing)
+ {
+ disposed = true;
+ if (wait != null) {
+ wait.Set ();
+ Thread.Sleep (100);
+ ((IDisposable) wait).Dispose ();
+ wait = null;
+ }
+
+ if (disposing)
+ GC.SuppressFinalize (this);
+ }
+
+ ~Runner ()
+ {
+ Dispose (false);
+ }
+ }
+
+ Runner runner;
+ AutoResetEvent start_event;
+
+ public Timer (TimerCallback callback, object state, int dueTime, int period)
+ {
+ if (dueTime < -1)
+ throw new ArgumentOutOfRangeException ("dueTime");
+
+ if (period < -1)
+ throw new ArgumentOutOfRangeException ("period");
+
+ Init (callback, state, dueTime, period);
+ }
+
+ public Timer (TimerCallback callback, object state, long dueTime, long period)
+ {
+ if (dueTime < -1)
+ throw new ArgumentOutOfRangeException ("dueTime");
+
+ if (period < -1)
+ throw new ArgumentOutOfRangeException ("period");
+
+ Init (callback, state, (int) dueTime, (int) period);
+ }
+
+ public Timer (TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
+ : this (callback, state, Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds))
+ {
+ }
+
+ [CLSCompliant(false)]
+ public Timer (TimerCallback callback, object state, uint dueTime, uint period)
+ : this (callback, state, (long) dueTime, (long) period)
+ {
+ }
+
+ void Init (TimerCallback callback, object state, int dueTime, int period)
+ {
+ start_event = new AutoResetEvent (false);
+ runner = new Runner (callback, state, start_event);
+ Change (dueTime, period);
+ Thread t = new Thread (new ThreadStart (runner.Start));
+ t.Start ();
+ }
+
+ [MonoTODO("false return?")]
+ public bool Change (int dueTime, int period)
+ {
+ if (dueTime < -1)
+ throw new ArgumentOutOfRangeException ("dueTime");
+
+ if (period < -1)
+ throw new ArgumentOutOfRangeException ("period");
+
+ runner.DueTime = dueTime;
+ runner.Period = period;
+ runner.Abort ();
+ start_event.Set ();
+ return true;
+ }
+
+ public bool Change (long dueTime, long period)
+ {
+ if(dueTime > 4294967294)
+ throw new NotSupportedException ("Due time too large");
+
+ if(period > 4294967294)
+ throw new NotSupportedException ("Period too large");
+
+ return Change ((int) dueTime, (int) period);
+ }
+
+ public bool Change (TimeSpan dueTime, TimeSpan period)
+ {
+ return Change (Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds));
+ }
+
+ [CLSCompliant(false)]
+ public bool Change (uint dueTime, uint period)
+ {
+ if (dueTime > Int32.MaxValue)
+ throw new NotSupportedException ("Due time too large");
+
+ if (period > Int32.MaxValue)
+ throw new NotSupportedException ("Period too large");
+
+ return Change ((int) dueTime, (int) period);
+ }
+
+ public void Dispose ()
+ {
+ runner.Dispose ();
+ runner = null;
+ GC.SuppressFinalize (this);
+ }
+
+ [MonoTODO("How do we signal the handler?")]
+ public bool Dispose (WaitHandle notifyObject)
+ {
+ Dispose ();
+ return true; //FIXME
+ }
+
+ ~Timer ()
+ {
+ runner = null;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Threading/TimerCallback.cs b/mcs/class/corlib/System.Threading/TimerCallback.cs
new file mode 100755
index 00000000000..3afe1fc71f2
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/TimerCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.TimerCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void TimerCallback(object state);
+}
diff --git a/mcs/class/corlib/System.Threading/WaitCallback.cs b/mcs/class/corlib/System.Threading/WaitCallback.cs
new file mode 100755
index 00000000000..ed1e39c0e28
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/WaitCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.WaitCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void WaitCallback(object state);
+}
diff --git a/mcs/class/corlib/System.Threading/WaitHandle.cs b/mcs/class/corlib/System.Threading/WaitHandle.cs
new file mode 100755
index 00000000000..7cb3eef28cd
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/WaitHandle.cs
@@ -0,0 +1,203 @@
+//
+// System.Threading.WaitHandle.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public abstract class WaitHandle : MarshalByRefObject, IDisposable
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern bool WaitAll_internal(WaitHandle[] handles, int ms, bool exitContext);
+
+ public static bool WaitAll(WaitHandle[] waitHandles) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAll_internal(waitHandles, Timeout.Infinite,
+ false));
+ }
+
+ public static bool WaitAll(WaitHandle[] waitHandles,
+ int millisecondsTimeout,
+ bool exitContext) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAll_internal(waitHandles, millisecondsTimeout, false));
+ }
+
+ public static bool WaitAll(WaitHandle[] waitHandles,
+ TimeSpan timeout,
+ bool exitContext) {
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Timeout out of range");
+ }
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAll_internal(waitHandles, ms, exitContext));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int WaitAny_internal(WaitHandle[] handles, int ms, bool exitContext);
+
+ // LAMESPEC: Doesn't specify how to signal failures
+ public static int WaitAny(WaitHandle[] waitHandles) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAny_internal(waitHandles, Timeout.Infinite,
+ false));
+ }
+
+ public static int WaitAny(WaitHandle[] waitHandles,
+ int millisecondsTimeout,
+ bool exitContext) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAny_internal(waitHandles,
+ millisecondsTimeout,
+ exitContext));
+ }
+
+ public static int WaitAny(WaitHandle[] waitHandles,
+ TimeSpan timeout, bool exitContext) {
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ if(ms < 0 || ms > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Timeout out of range");
+ }
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAny_internal(waitHandles, ms, exitContext));
+ }
+
+ [MonoTODO]
+ public WaitHandle() {
+ // FIXME
+ }
+
+ public const int WaitTimeout = 258;
+
+ private IntPtr os_handle = IntPtr.Zero;
+
+ public virtual IntPtr Handle {
+ get {
+ return(os_handle);
+ }
+
+ set {
+ os_handle=value;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose(true);
+ GC.SuppressFinalize (this);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern bool WaitOne_internal(IntPtr handle, int ms, bool exitContext);
+
+ public virtual bool WaitOne() {
+ return(WaitOne_internal(os_handle, Timeout.Infinite,
+ false));
+ }
+
+ public virtual bool WaitOne(int millisecondsTimeout, bool exitContext) {
+ return(WaitOne_internal(os_handle,
+ millisecondsTimeout,
+ exitContext));
+ }
+
+ public virtual bool WaitOne(TimeSpan timeout, bool exitContext) {
+ int ms=Convert.ToInt32(timeout.TotalMilliseconds);
+
+ return(WaitOne_internal(os_handle, ms, exitContext));
+ }
+
+ protected static readonly IntPtr InvalidHandle;
+
+ private bool disposed = false;
+
+ void IDisposable.Dispose() {
+ Dispose(true);
+ // Take yourself off the Finalization queue
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool explicitDisposing) {
+ // Check to see if Dispose has already been called.
+ if(!this.disposed) {
+ this.disposed=true;
+ // If this is a call to Dispose,
+ // dispose all managed resources.
+ if(explicitDisposing) {
+ // Free up stuff here
+ //Components.Dispose();
+ }
+
+ // Release unmanaged resources
+ // Note that this is not thread safe.
+ // Another thread could start
+ // disposing the object after the
+ // managed resources are disposed, but
+ // before the disposed flag is set to
+ // true.
+ //Release(handle);
+ //handle=IntPtr.Zero;
+ }
+ }
+
+ ~WaitHandle() {
+ Dispose(false);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/WaitOrTimerCallback.cs b/mcs/class/corlib/System.Threading/WaitOrTimerCallback.cs
new file mode 100755
index 00000000000..03a03d7a318
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/WaitOrTimerCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.WaitOrTimerCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void WaitOrTimerCallback(object state, bool timedOut);
+}
diff --git a/mcs/class/corlib/System/Activator.cs b/mcs/class/corlib/System/Activator.cs
new file mode 100644
index 00000000000..a4a07e56430
--- /dev/null
+++ b/mcs/class/corlib/System/Activator.cs
@@ -0,0 +1,240 @@
+//
+// System.Activator.cs
+//
+// Authors:
+// Nick Drochak II (ndrochak@gol.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2001 Nick Drochak II
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System.Globalization;
+using System.Reflection;
+using System.Runtime.Remoting;
+using System.Runtime.CompilerServices;
+using System.Security.Policy;
+
+namespace System
+{
+ public sealed class Activator
+ {
+ private static BindingFlags _flags = BindingFlags.CreateInstance |
+ BindingFlags.Public |
+ BindingFlags.Instance;
+
+ private Activator () {}
+
+ [MonoTODO]
+ public static ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName)
+ {
+ return CreateInstanceFrom (assemblyFile, typeName, null);
+ }
+
+ public static ObjectHandle CreateInstanceFrom (string assemblyFile,
+ string typeName,
+ object [] activationAttributes)
+ {
+ return Activator.CreateInstanceFrom (assemblyFile,
+ typeName,
+ false,
+ _flags,
+ null,
+ null,
+ null,
+ activationAttributes,
+ null);
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstanceFrom (string assemblyFile,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object [] args,
+ CultureInfo culture,
+ object [] activationAttributes,
+ Evidence securityInfo)
+ {
+ //TODO: when Assembly implements security, use it.
+ //Assembly assembly = Assembly.LoadFrom (assemblyFile, securityInfo);
+ Assembly assembly = Assembly.LoadFrom (assemblyFile);
+ if (assembly == null)
+ return null;
+
+ Type type = assembly.GetType (typeName, true, ignoreCase);
+ if (type == null)
+ return null;
+
+ object obj = CreateInstance (type, bindingAttr, binder, args, culture, activationAttributes);
+ return (obj != null) ? new ObjectHandle (obj) : null;
+ }
+
+ public static ObjectHandle CreateInstance (string assemblyName, string typeName)
+ {
+ return Activator.CreateInstance (assemblyName, typeName, null);
+ }
+
+ public static ObjectHandle CreateInstance (string assemblyName,
+ string typeName,
+ object [] activationAttributes)
+ {
+ return Activator.CreateInstance (assemblyName,
+ typeName,
+ false,
+ _flags,
+ null,
+ null,
+ null,
+ activationAttributes,
+ null);
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstance (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object [] args,
+ CultureInfo culture,
+ object [] activationAttributes,
+ Evidence securityInfo)
+ {
+ //TODO: when Assembly implements security, use it.
+ //Assembly assembly = Assembly.Load (assemblyFile, securityInfo);
+ Assembly assembly = Assembly.Load (assemblyName);
+ Type type = assembly.GetType (typeName, true, ignoreCase);
+ object obj = CreateInstance (type, bindingAttr, binder, args, culture, activationAttributes);
+ return (obj != null) ? new ObjectHandle (obj) : null;
+ }
+
+ public static object CreateInstance (Type type)
+ {
+ return CreateInstance (type, false);
+ }
+
+ public static object CreateInstance (Type type, object [] args)
+ {
+ return CreateInstance (type, args, new object [0]);
+ }
+
+ [MonoTODO]
+ public static object CreateInstance (Type type, object [] args, object [] activationAttributes)
+ {
+ // activationAttributes?
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ if (type.IsAbstract)
+ throw new MemberAccessException ("Cannot create an abstract class");
+
+ int length = 0;
+ if (args != null)
+ length = args.Length;
+
+ Type [] atypes = new Type [length];
+ for (int i = 0; i < length; ++i) {
+ atypes [i] = args [i].GetType ();
+ }
+ ConstructorInfo ctor = type.GetConstructor (atypes);
+ if (ctor == null) {
+ if (type.IsValueType && atypes.Length == 0)
+ return CreateInstanceInternal (type);
+
+ throw new MissingMethodException ("Constructor not found");
+ }
+
+
+ return ctor.Invoke (args);
+ }
+
+ public static object CreateInstance (Type type,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object [] args,
+ CultureInfo culture)
+ {
+ return CreateInstance (type, bindingAttr, binder, args, culture, new object [0]);
+ }
+
+ [MonoTODO]
+ public static object CreateInstance (Type type,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object [] args,
+ CultureInfo culture,
+ object [] activationAttributes)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ if (type.IsAbstract)
+ throw new MemberAccessException ("Cannot create an abstract class");
+
+ // activationAttributes?
+ int length = 0;
+ if (args != null)
+ length = args.Length;
+
+ Type[] atypes = new Type [length];
+ for (int i = 0; i < length; ++i) {
+ atypes [i] = args [i].GetType ();
+ }
+ ConstructorInfo ctor = type.GetConstructor (bindingAttr, binder, atypes, null);
+ if (ctor == null) {
+ // Not sure about this
+ if (type.IsValueType && atypes.Length == 0) {
+ return CreateInstanceInternal (type);
+ }
+
+ throw new MissingMethodException ("Constructor not found");
+ }
+
+ return ctor.Invoke (bindingAttr, binder, args, culture);
+ }
+
+ public static object CreateInstance (Type type, bool nonPublic)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type");
+
+ if (type.IsAbstract)
+ throw new MemberAccessException ("Cannot create an abstract class");
+
+ ConstructorInfo ctor = type.GetConstructor (Type.EmptyTypes);
+ if (ctor != null && !ctor.IsPublic && nonPublic == false)
+ throw new MissingMethodException ("Default constructor not found");
+
+ if (ctor == null) {
+ if (type.IsValueType)
+ return CreateInstanceInternal (type);
+
+ throw new MissingMethodException ("Default constructor not found");
+ }
+
+ return ctor.Invoke (null);
+ }
+
+ public static object GetObject (Type type, string url)
+ {
+ return RemotingServices.Connect (type, url);
+ }
+
+ public static object GetObject (Type type, string url, object state)
+ {
+ return RemotingServices.Connect (type, url, state);
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern object CreateInstanceInternal (Type type);
+ }
+}
+
diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs
new file mode 100755
index 00000000000..e49f731d4bf
--- /dev/null
+++ b/mcs/class/corlib/System/AppDomain.cs
@@ -0,0 +1,636 @@
+//
+// System/AppDomain.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+// Gonzalo Paniagua (gonzalo@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Security.Principal;
+using System.Security.Policy;
+using System.Security;
+
+namespace System {
+
+ [ClassInterface(ClassInterfaceType.None)]
+ public sealed class AppDomain : MarshalByRefObject , _AppDomain , IEvidenceFactory {
+
+ IntPtr _mono_app_domain;
+
+ // Evidence evidence;
+
+ AppDomain () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern AppDomainSetup getSetup ();
+
+ public AppDomainSetup SetupInformation {
+
+ get {
+ return getSetup ();
+ }
+ }
+
+ public string BaseDirectory {
+
+ get {
+ return SetupInformation.ApplicationBase;
+ }
+ }
+
+ public string RelativeSearchPath {
+
+ get {
+ return SetupInformation.PrivateBinPath;
+ }
+ }
+
+ public string DynamicDirectory {
+
+ get {
+ // fixme: dont know if this is right?
+ return SetupInformation.DynamicBase;
+ }
+ }
+
+ public bool ShadowCopyFiles {
+
+ get {
+ if (SetupInformation.ShadowCopyFiles == "true")
+ return true;
+ return false;
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern string getFriendlyName ();
+
+ public string FriendlyName {
+
+ get {
+ return getFriendlyName ();
+ }
+ }
+
+ public Evidence Evidence {
+
+ get {
+ return null;
+ //return evidence;
+ }
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private static extern AppDomain getCurDomain ();
+
+ public static AppDomain CurrentDomain
+ {
+ get {
+ return getCurDomain ();
+ }
+ }
+
+ [MonoTODO]
+ public void AppendPrivatePath (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ClearPrivatePath ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ClearShadowCopyPath ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public ObjectHandle CreateComInstanceFrom (string assemblyName,
+ string typeName)
+ {
+ if(assemblyName==null) {
+ throw new ArgumentNullException("assemblyName is null");
+ }
+ if(typeName==null) {
+ throw new ArgumentNullException("typeName is null");
+ }
+
+ throw new NotImplementedException();
+ }
+
+
+ public ObjectHandle CreateInstance (string assemblyName, string typeName)
+ {
+ if (assemblyName == null)
+ throw new ArgumentNullException ("assemblyName");
+
+ return Activator.CreateInstance (assemblyName, typeName);
+ }
+
+ public ObjectHandle CreateInstance (string assemblyName, string typeName,
+ object[] activationAttributes)
+ {
+ if (assemblyName == null)
+ throw new ArgumentNullException ("assemblyName");
+
+ return Activator.CreateInstance (assemblyName, typeName, activationAttributes);
+ }
+
+ public ObjectHandle CreateInstance (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttributes)
+ {
+ if (assemblyName == null)
+ throw new ArgumentNullException ("assemblyName");
+
+ return Activator.CreateInstance (assemblyName,
+ typeName,
+ ignoreCase,
+ bindingAttr,
+ binder,
+ args,
+ culture,
+ activationAttributes,
+ securityAttributes);
+ }
+
+ public object CreateInstanceAndUnwrap (string assemblyName, string typeName)
+ {
+ ObjectHandle oh = CreateInstance (assemblyName, typeName);
+ return (oh != null) ? oh.Unwrap () : null;
+ }
+
+ public object CreateInstanceAndUnwrap (string assemblyName,
+ string typeName,
+ object [] activationAttributes)
+ {
+ ObjectHandle oh = CreateInstance (assemblyName, typeName, activationAttributes);
+ return (oh != null) ? oh.Unwrap () : null;
+ }
+
+ public object CreateInstanceAndUnwrap (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttributes)
+ {
+ ObjectHandle oh = CreateInstance (assemblyName,
+ typeName,
+ ignoreCase,
+ bindingAttr,
+ binder,
+ args,
+ culture,
+ activationAttributes,
+ securityAttributes);
+ return (oh != null) ? oh.Unwrap () : null;
+ }
+
+ public ObjectHandle CreateInstanceFrom (string assemblyName, string typeName)
+ {
+ if (assemblyName == null)
+ throw new ArgumentNullException ("assemblyName");
+
+ return Activator.CreateInstanceFrom (assemblyName, typeName);
+ }
+
+ public ObjectHandle CreateInstanceFrom (string assemblyName, string typeName,
+ object[] activationAttributes)
+ {
+ if (assemblyName == null)
+ throw new ArgumentNullException ("assemblyName");
+
+ return Activator.CreateInstanceFrom (assemblyName, typeName, activationAttributes);
+ }
+
+ public ObjectHandle CreateInstanceFrom (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttributes)
+ {
+ if (assemblyName == null)
+ throw new ArgumentNullException ("assemblyName");
+
+ return Activator.CreateInstanceFrom (assemblyName,
+ typeName,
+ ignoreCase,
+ bindingAttr,
+ binder,
+ args,
+ culture,
+ activationAttributes,
+ securityAttributes);
+ }
+
+ public object CreateInstanceFromAndUnwrap (string assemblyName, string typeName)
+ {
+ ObjectHandle oh = CreateInstanceFrom (assemblyName, typeName);
+ return (oh != null) ? oh.Unwrap () : null;
+ }
+
+ public object CreateInstanceFromAndUnwrap (string assemblyName,
+ string typeName,
+ object [] activationAttributes)
+ {
+ ObjectHandle oh = CreateInstanceFrom (assemblyName, typeName, activationAttributes);
+ return (oh != null) ? oh.Unwrap () : null;
+ }
+
+ public object CreateInstanceFromAndUnwrap (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttributes)
+ {
+ ObjectHandle oh = CreateInstanceFrom (assemblyName,
+ typeName,
+ ignoreCase,
+ bindingAttr,
+ binder,
+ args,
+ culture,
+ activationAttributes,
+ securityAttributes);
+ return (oh != null) ? oh.Unwrap () : null;
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access)
+ {
+ return DefineDynamicAssembly (name, access, null, null,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence)
+ {
+ return DefineDynamicAssembly (name, access, null, evidence,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir)
+ {
+ return DefineDynamicAssembly (name, access, dir, null,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence)
+ {
+ return DefineDynamicAssembly (name, access, dir, evidence,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, null, null,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, null, evidence,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, dir, null,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, dir, evidence,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions,
+ bool isSynchronized)
+ {
+ // FIXME: examine all other parameters
+
+ AssemblyBuilder ab = new AssemblyBuilder (name, dir, access);
+ return ab;
+ }
+
+
+ public void DoCallBack (CrossAppDomainDelegate theDelegate)
+ {
+ if (theDelegate != null)
+ theDelegate ();
+ }
+
+ public override bool Equals (object other)
+ {
+ if (!(other is AppDomain))
+ return false;
+
+ return this._mono_app_domain == ((AppDomain)other)._mono_app_domain;
+ }
+
+ public int ExecuteAssembly (string assemblyFile)
+ {
+ return ExecuteAssembly (assemblyFile, new Evidence (), null);
+ }
+
+ public int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity)
+ {
+ return ExecuteAssembly (assemblyFile, new Evidence (), null);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern Assembly [] GetAssemblies ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern object GetData (string name);
+
+ public override int GetHashCode ()
+ {
+ return (int)_mono_app_domain;
+ }
+
+ [MonoTODO("Somehow, we're supposed to implement 'public Type _AppDomain.GetType()' and still inherit 'public Type Object.GetType()")]
+ Type _AppDomain.GetType()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override object InitializeLifetimeService ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsFinalizingForUnload()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern Assembly LoadAssembly (AssemblyName assemblyRef, Evidence securityEvidence);
+
+ public Assembly Load (AssemblyName assemblyRef)
+ {
+ return Load (assemblyRef, new Evidence ());
+ }
+
+ public Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
+ {
+ return LoadAssembly (assemblyRef, assemblySecurity);
+ }
+
+ public Assembly Load (string assemblyString)
+ {
+ AssemblyName an = new AssemblyName ();
+ an.Name = assemblyString;
+
+ return Load (an, new Evidence ());
+ }
+
+ public Assembly Load (string assemblyString, Evidence assemblySecurity)
+ {
+ AssemblyName an = new AssemblyName ();
+ an.Name = assemblyString;
+
+ return Load (an, assemblySecurity);
+ }
+
+ public Assembly Load (byte[] rawAssembly)
+ {
+ return Load (rawAssembly, null, new Evidence ());
+ }
+
+ public Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore)
+ {
+ return Load (rawAssembly, rawSymbolStore, new Evidence ());
+ }
+
+ [MonoTODO]
+ public Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetAppDomainPolicy (PolicyLevel domainPolicy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetCachePath (string s)
+ {
+ SetupInformation.CachePath = s;
+ }
+
+ [MonoTODO]
+ public void SetPrincipalPolicy (PrincipalPolicy policy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetShadowCopyFiles()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetShadowCopyPath (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetThreadPrincipal (IPrincipal principal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static AppDomain CreateDomain (string friendlyName)
+ {
+ return CreateDomain (friendlyName, new Evidence (), new AppDomainSetup ());
+ }
+
+ public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo)
+ {
+ return CreateDomain (friendlyName, securityInfo, new AppDomainSetup ());
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private static extern AppDomain createDomain (string friendlyName, AppDomainSetup info);
+
+ public static AppDomain CreateDomain (string friendlyName,
+ Evidence securityInfo,
+ AppDomainSetup info)
+ {
+ //TODO: treat securityInfo (can be null)
+ if (friendlyName == null)
+ throw new System.ArgumentNullException ("friendlyName");
+
+ if (info == null)
+ throw new System.ArgumentNullException ("info");
+
+ AppDomain ad = createDomain (friendlyName, info);
+
+ // ad.evidence = securityInfo;
+
+ return ad;
+ }
+
+ public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo,
+ string appBasePath, string appRelativeSearchPath,
+ bool shadowCopyFiles)
+ {
+ AppDomainSetup info = new AppDomainSetup ();
+
+ info.ApplicationBase = appBasePath;
+ info.PrivateBinPath = appRelativeSearchPath;
+
+ if (shadowCopyFiles)
+ info.ShadowCopyFiles = "true";
+ else
+ info.ShadowCopyFiles = "false";
+
+ return CreateDomain (friendlyName, securityInfo, info);
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void Unload (AppDomain domain);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern void SetData (string name, object data);
+
+ [MonoTODO]
+ public void SetDynamicBase(string path)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static int GetCurrentThreadId ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString () {
+ return getFriendlyName ();
+ }
+
+ // This methods called from the runtime. Don't change signature.
+ private void DoAssemblyLoad (Assembly assembly)
+ {
+ if (AssemblyLoad == null)
+ return;
+
+ AssemblyLoad (this, new AssemblyLoadEventArgs (assembly));
+ }
+
+ private Assembly DoAssemblyResolve (string name)
+ {
+ if (AssemblyResolve == null)
+ return null;
+
+ ResolveEventHandler [] list = (ResolveEventHandler []) AssemblyResolve.GetInvocationList ();
+ foreach (ResolveEventHandler eh in list) {
+ Assembly assembly = eh (this, new ResolveEventArgs (name));
+ if (assembly != null)
+ return assembly;
+ }
+
+ return null;
+ }
+ // End of methods called from the runtime
+
+ public event AssemblyLoadEventHandler AssemblyLoad;
+
+ public event ResolveEventHandler AssemblyResolve;
+
+ public event EventHandler DomainUnload;
+
+ public event EventHandler ProcessExit;
+
+ public event ResolveEventHandler ResourceResolve;
+
+ public event ResolveEventHandler TypeResolve;
+
+ public event UnhandledExceptionEventHandler UnhandledException;
+
+ }
+}
diff --git a/mcs/class/corlib/System/AppDomainSetup.cs b/mcs/class/corlib/System/AppDomainSetup.cs
new file mode 100755
index 00000000000..a0cf5ab8d01
--- /dev/null
+++ b/mcs/class/corlib/System/AppDomainSetup.cs
@@ -0,0 +1,174 @@
+//
+// System/AppDomainSetup.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System {
+
+
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.None)]
+ public sealed class AppDomainSetup : IAppDomainSetup {
+ string application_base;
+ string application_name;
+ string cache_path;
+ string configuration_file;
+ string dynamic_base;
+ string license_file;
+ string private_bin_path;
+ string private_bin_path_probe;
+ string shadow_copy_directories;
+ string shadow_copy_files;
+ bool publisher_policy;
+ private LoaderOptimization loader_optimization;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern AppDomainSetup InitAppDomainSetup (AppDomainSetup setup);
+
+ public AppDomainSetup ()
+ {
+ InitAppDomainSetup (this);
+ }
+
+ public string ApplicationBase {
+
+ get {
+ return application_base;
+ }
+
+ set {
+ application_base = value;
+ }
+ }
+
+ public string ApplicationName {
+
+ get {
+ return application_name;
+ }
+
+ set {
+ application_name = value;
+ }
+ }
+
+ public string CachePath {
+
+ get {
+ return cache_path;
+ }
+
+ set {
+ cache_path = value;
+ }
+ }
+
+ public string ConfigurationFile {
+
+ get {
+ return configuration_file;
+ }
+
+ set {
+ configuration_file = value;
+ }
+ }
+
+ public bool DisallowPublisherPolicy {
+ get {
+ return publisher_policy;
+ }
+
+ set {
+ publisher_policy = value;
+ }
+ }
+
+ public string DynamicBase {
+
+ get {
+ return dynamic_base;
+ }
+
+ set {
+ dynamic_base = value;
+ }
+ }
+
+ public string LicenseFile {
+
+ get {
+ return license_file;
+ }
+
+ set {
+ license_file = value;
+ }
+ }
+
+ [MonoTODO("--share-code")]
+ public LoaderOptimization LoaderOptimization
+ {
+ get {
+ return loader_optimization;
+ }
+
+ set {
+ loader_optimization = value;
+ }
+ }
+
+ public string PrivateBinPath {
+
+ get {
+ return private_bin_path;
+ }
+
+ set {
+ private_bin_path = value;
+ }
+ }
+
+ public string PrivateBinPathProbe {
+
+ get {
+ return private_bin_path_probe;
+ }
+
+ set {
+ private_bin_path_probe = value;
+ }
+ }
+
+ public string ShadowCopyDirectories {
+
+ get {
+ return shadow_copy_directories;
+ }
+
+ set {
+ shadow_copy_directories = value;
+ }
+ }
+
+ public string ShadowCopyFiles {
+
+ get {
+ return shadow_copy_files;
+ }
+
+ set {
+ shadow_copy_files = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/AppDomainUnloadedException.cs b/mcs/class/corlib/System/AppDomainUnloadedException.cs
new file mode 100644
index 00000000000..9ca65e65c9c
--- /dev/null
+++ b/mcs/class/corlib/System/AppDomainUnloadedException.cs
@@ -0,0 +1,42 @@
+//
+// System.AppDomainUnloadedException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class AppDomainUnloadedException : SystemException
+ {
+ // Constructors
+ public AppDomainUnloadedException ()
+ : base (Locale.GetText ("Can't access an unloaded application domain."))
+ {
+ }
+
+ public AppDomainUnloadedException (string message)
+ : base (message)
+ {
+ }
+
+ protected AppDomainUnloadedException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public AppDomainUnloadedException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ApplicationException.cs b/mcs/class/corlib/System/ApplicationException.cs
new file mode 100644
index 00000000000..9420c119430
--- /dev/null
+++ b/mcs/class/corlib/System/ApplicationException.cs
@@ -0,0 +1,42 @@
+//
+// System.ApplicationException.cs
+//
+// Authors:
+// Joe Shaw (joe@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+
+ [Serializable]
+ public class ApplicationException : Exception
+ {
+ // Constructors
+ public ApplicationException ()
+ : base (Locale.GetText ("An application exception has occurred."))
+ {
+ }
+
+ public ApplicationException (string message)
+ : base (message)
+ {
+ }
+
+ public ApplicationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected ApplicationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgIterator.cs b/mcs/class/corlib/System/ArgIterator.cs
new file mode 100755
index 00000000000..73472b906c7
--- /dev/null
+++ b/mcs/class/corlib/System/ArgIterator.cs
@@ -0,0 +1,71 @@
+//
+// System.ArgIterator.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ public struct ArgIterator
+ {
+ [MonoTODO]
+ public ArgIterator(RuntimeArgumentHandle arglist)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ unsafe public ArgIterator(RuntimeArgumentHandle arglist,
+ void *ptr)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public void End()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override bool Equals(object o)
+ {
+ throw new NotSupportedException("This operation is not supported for this type");
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public TypedReference GetNextArg()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public TypedReference GetNextArg(RuntimeTypeHandle rth)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public RuntimeTypeHandle GetNextArgType()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public int GetRemainingCount()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgumentException.cs b/mcs/class/corlib/System/ArgumentException.cs
new file mode 100644
index 00000000000..c5b4f26484e
--- /dev/null
+++ b/mcs/class/corlib/System/ArgumentException.cs
@@ -0,0 +1,78 @@
+//
+// System.ArgumentException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public class ArgumentException : SystemException {
+ private string param_name;
+
+ // Constructors
+ public ArgumentException ()
+ : base (Locale.GetText ("An invalid argument was specified."))
+ {
+ }
+
+ public ArgumentException (string message)
+ : base (message)
+ {
+ }
+
+ public ArgumentException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public ArgumentException (string message, string param_name)
+ : base (message)
+ {
+ this.param_name = param_name;
+ }
+
+ public ArgumentException (string message, string param_name, Exception inner)
+ : base (message, inner)
+ {
+ this.param_name = param_name;
+ }
+
+ protected ArgumentException (SerializationInfo info, StreamingContext sc)
+ : base (info, sc)
+ {
+ param_name = info.GetString ("ParamName");
+ }
+
+ // Properties
+ public virtual string ParamName {
+ get {
+ return param_name;
+ }
+ }
+
+ public override string Message {
+ get {
+ string base_message = base.Message;
+ if (base_message == null)
+ base_message = Locale.GetText ("An invalid argument was specified.");
+
+ if (param_name == null)
+ return base_message;
+ else
+ return base_message + "\nParameter name: " + param_name;
+ }
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("ParamName", param_name);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgumentNullException.cs b/mcs/class/corlib/System/ArgumentNullException.cs
new file mode 100644
index 00000000000..40450067332
--- /dev/null
+++ b/mcs/class/corlib/System/ArgumentNullException.cs
@@ -0,0 +1,38 @@
+//
+// System.ArgumentNullException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public class ArgumentNullException : ArgumentException {
+ // Constructors
+ public ArgumentNullException ()
+ : base (Locale.GetText ("Argument cannot be null"))
+ {
+ }
+
+ public ArgumentNullException (string param_name)
+ : base (Locale.GetText ("Argument cannot be null"), param_name)
+ {
+ }
+
+ public ArgumentNullException (string param_name, string message)
+ : base (message, param_name)
+ {
+ }
+
+ protected ArgumentNullException (SerializationInfo info, StreamingContext sc)
+ : base (info, sc)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgumentOutOfRangeException.cs b/mcs/class/corlib/System/ArgumentOutOfRangeException.cs
new file mode 100644
index 00000000000..e1253bb5ad1
--- /dev/null
+++ b/mcs/class/corlib/System/ArgumentOutOfRangeException.cs
@@ -0,0 +1,72 @@
+//
+// System.ArgumentOutOfRangeException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class ArgumentOutOfRangeException : ArgumentException {
+ private object actual_value;
+
+ // Constructors
+ public ArgumentOutOfRangeException ()
+ : base (Locale.GetText ("Argument is out of range"))
+ {
+ }
+
+ public ArgumentOutOfRangeException (string param_name)
+ : base (Locale.GetText ("Argument is out of range"), param_name)
+ {
+ }
+
+ public ArgumentOutOfRangeException (string param_name, string message)
+ : base (message, param_name)
+ {
+ }
+
+ public ArgumentOutOfRangeException (string param_name, object actual_value, string message)
+ : base (message, param_name)
+ {
+ this.actual_value = actual_value;
+ }
+
+ protected ArgumentOutOfRangeException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ actual_value = info.GetString ("ActualValue");
+ }
+
+ // Properties
+ public virtual object ActualValue {
+ get {
+ return actual_value;
+ }
+ }
+
+ public override string Message {
+ get {
+ string basemsg = base.Message;
+ if (actual_value == null)
+ return basemsg;
+ return basemsg + '\n' + actual_value;
+ }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("ActualValue", actual_value);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ArithmeticException.cs b/mcs/class/corlib/System/ArithmeticException.cs
new file mode 100644
index 00000000000..ff6c98cbb35
--- /dev/null
+++ b/mcs/class/corlib/System/ArithmeticException.cs
@@ -0,0 +1,38 @@
+//
+// System.ArithmeticException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class ArithmeticException : SystemException {
+ // Constructors
+ public ArithmeticException ()
+ : base (Locale.GetText ("The arithmetic operation is not allowed"))
+ {
+ }
+
+ public ArithmeticException (string message)
+ : base (message)
+ {
+ }
+
+ public ArithmeticException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected ArithmeticException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs
new file mode 100644
index 00000000000..4b1b45b023e
--- /dev/null
+++ b/mcs/class/corlib/System/Array.cs
@@ -0,0 +1,844 @@
+
+// System.Array.cs
+//
+// Authors:
+// Joe Shaw (joe@ximian.com)
+// Martin Baulig (martin@gnome.org)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+
+ [Serializable]
+ public abstract class Array : ICloneable, ICollection, IList, IEnumerable
+ {
+ // Constructor
+ private Array ()
+ {
+ /* empty */
+ }
+
+ // Properties
+ public int Length
+ {
+ get
+ {
+ int length = this.GetLength (0);
+
+ for (int i = 1; i < this.Rank; i++) {
+ length *= this.GetLength (i);
+ }
+
+ return length;
+ }
+ }
+
+ public int Rank
+ {
+ get
+ {
+ return this.GetRank ();
+ }
+ }
+
+ // IList interface
+ object IList.this [int index] {
+ get {
+ return GetValueImpl (index);
+ }
+ set {
+ SetValueImpl (value, index);
+ }
+ }
+
+ int IList.Add (object value) {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear () {
+ Array.Clear (this, this.GetLowerBound(0), this.Length);
+ }
+
+ bool IList.Contains (object value) {
+ if (this.Rank > 1)
+ throw new RankException ("Only single dimension arrays are supported.");
+
+ int length = this.Length;
+ for (int i = 0; i < length; i++) {
+ if (Object.Equals (value, this.GetValueImpl (i)))
+ return true;
+ }
+ return false;
+ }
+
+ int IList.IndexOf (object value) {
+ if (this.Rank > 1)
+ throw new RankException ();
+
+ int length = this.Length;
+ for (int i = 0; i < length; i++) {
+ if (Object.Equals (value, this.GetValueImpl (i)))
+ // array index may not be zero-based.
+ // use lower bound
+ return i + this.GetLowerBound (0);
+ }
+
+ int retVal;
+ unchecked {
+ // lower bound may be MinValue
+ retVal = this.GetLowerBound (0) - 1;
+ }
+
+ return retVal;
+ }
+
+ void IList.Insert (int index, object value) {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value) {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index) {
+ throw new NotSupportedException ();
+ }
+
+ // InternalCall Methods
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int GetRank ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int GetLength (int dimension);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int GetLowerBound (int dimension);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern object GetValue (int[] idxs);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern void SetValue (object value, int[] idxs);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern object GetValueImpl (int pos);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern void SetValueImpl (object value, int pos);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static void FastCopy (Array source, int source_idx, Array dest, int dest_idx, int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static Array CreateInstanceImpl(Type elementType, int[] lengths, int [] bounds);
+
+ // Properties
+ int ICollection.Count {
+ get {
+ return Length;
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool IsSynchronized {
+ get {
+ // FIXME?
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ public virtual object SyncRoot {
+ get {
+ // FIXME
+ return null;
+ }
+ }
+
+ public virtual bool IsFixedSize
+ {
+ get {
+ return true;
+ }
+ }
+
+ public virtual bool IsReadOnly
+ {
+ get{
+ return false;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new SimpleEnumerator(this);
+ }
+
+ public int GetUpperBound (int dimension)
+ {
+ return GetLowerBound (dimension) +
+ GetLength (dimension) - 1;
+ }
+
+ public object GetValue (int idx)
+ {
+ int[] ind = new int [1];
+
+ ind [0] = idx;
+
+ return GetValue (ind);
+ }
+
+ public object GetValue (int idx1, int idx2)
+ {
+ int[] ind = new int [2];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+
+ return GetValue (ind);
+ }
+
+ public object GetValue (int idx1, int idx2, int idx3)
+ {
+ int[] ind = new int [3];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+ ind [2] = idx3;
+
+ return GetValue (ind);
+ }
+
+ // This function is currently unused, but just in case we need it later on ... */
+ internal int IndexToPos (int[] idxs)
+ {
+ if (idxs == null)
+ throw new ArgumentNullException ();
+
+ if ((idxs.Rank != 1) || (idxs.Length != Rank))
+ throw new ArgumentException ();
+
+ if ((idxs [0] < GetLowerBound (0)) || (idxs [0] > GetUpperBound (0)))
+ throw new IndexOutOfRangeException();
+
+ int pos = idxs [0] - GetLowerBound (0);
+ for (int i = 1; i < Rank; i++) {
+ if ((idxs [i] < GetLowerBound (i)) || (idxs [i] > GetUpperBound (i)))
+ throw new IndexOutOfRangeException();
+
+ pos *= GetLength (i);
+ pos += idxs [i] - GetLowerBound (i);
+ }
+
+ return pos;
+ }
+
+ public void SetValue (object value, int idx)
+ {
+ int[] ind = new int [1];
+
+ ind [0] = idx;
+
+ SetValue (value, ind);
+ }
+
+ public void SetValue (object value, int idx1, int idx2)
+ {
+ int[] ind = new int [2];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+
+ SetValue (value, ind);
+ }
+
+ public void SetValue (object value, int idx1, int idx2, int idx3)
+ {
+ int[] ind = new int [3];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+ ind [2] = idx3;
+
+ SetValue (value, ind);
+ }
+
+ public static Array CreateInstance(Type elementType, int length)
+ {
+ int[] lengths = new int [1];
+ int[] bounds = null;
+
+ lengths [0] = length;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int l1, int l2)
+ {
+ int[] lengths = new int [2];
+ int[] bounds = null;
+
+ lengths [0] = l1;
+ lengths [1] = l2;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int l1, int l2, int l3)
+ {
+ int[] lengths = new int [3];
+ int[] bounds = null;
+
+ lengths [0] = l1;
+ lengths [1] = l2;
+ lengths [2] = l3;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int[] lengths)
+ {
+ int[] bounds = null;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int[] lengths, int [] bounds)
+ {
+ if (bounds == null)
+ throw new ArgumentNullException("bounds");
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+
+ public static int BinarySearch (Array array, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if (array.Rank > 1)
+ throw new RankException();
+
+ if (!(value is IComparable))
+ throw new ArgumentException("value does not support IComparable");
+
+ return BinarySearch (array, array.GetLowerBound (0), array.GetLength (0),
+ value, null);
+ }
+
+ public static int BinarySearch (Array array, object value, IComparer comparer)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if (array.Rank > 1)
+ throw new RankException();
+
+ if ((comparer == null) && !(value is IComparable))
+ throw new ArgumentException("comparer is null and value does not support IComparable");
+
+ return BinarySearch (array, array.GetLowerBound (0), array.GetLength (0),
+ value, comparer);
+ }
+
+ public static int BinarySearch (Array array, int index, int length, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if (array.Rank > 1)
+ throw new RankException();
+
+ if (index < array.GetLowerBound (0))
+ throw new ArgumentOutOfRangeException("index is less than the lower bound of array.");
+ if (length < 0)
+ throw new ArgumentOutOfRangeException("length is less than zero.");
+
+ if (index + length > array.GetLowerBound (0) + array.GetLength (0))
+ throw new ArgumentException("index and length do not specify a valid range in array.");
+ if (!(value is IComparable))
+ throw new ArgumentException("value does not support IComparable");
+
+ return BinarySearch (array, index, length, value, null);
+ }
+
+ public static int BinarySearch (Array array, int index,
+ int length, object value,
+ IComparer comparer)
+ {
+ if (array == null)
+ throw new ArgumentNullException ("array");
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (index < array.GetLowerBound (0))
+ throw new ArgumentOutOfRangeException("index is less than the lower bound of array.");
+ if (length < 0)
+ throw new ArgumentOutOfRangeException("length is less than zero.");
+
+ if (index + length > array.GetLowerBound (0) + array.GetLength (0))
+ throw new ArgumentException("index and length do not specify a valid range in array.");
+
+ if ((comparer == null) && !(value is IComparable))
+ throw new ArgumentException("comparer is null and value does not support IComparable");
+
+ // cache this in case we need it
+ IComparable valueCompare = value as IComparable;
+
+ int iMin = index;
+ int iMax = index + length;
+ int iCmp = 0;
+ try
+ {
+ // there's a subtle balance here between
+ // 1) the while condition
+ // 2) the rounding down of the '/ 2'
+ // 3) the asymetrical recursion
+ // 4) the fact that iMax starts beyond the end of the array
+ while (iMin < iMax)
+ {
+ int iMid = (iMin + iMax) / 2;
+ object elt = array.GetValueImpl (iMid);
+
+ // this order is from MSDN
+ if (comparer != null)
+ iCmp = comparer.Compare (value, elt);
+ else
+ {
+ IComparable eltCompare = elt as IComparable;
+ if (eltCompare != null)
+ iCmp = -eltCompare.CompareTo (value);
+ else
+ iCmp = valueCompare.CompareTo (elt);
+ }
+
+ if (iCmp == 0)
+ return iMid;
+ else if (iCmp < 0)
+ iMax = iMid;
+ else
+ iMin = iMid + 1; // compensate for the rounding down
+ }
+ }
+ catch (InvalidCastException e)
+ {
+ throw new ArgumentException ("array", e);
+ }
+
+ if (iCmp > 0)
+ return ~iMax;
+ else
+ return ~iMin;
+ }
+
+ public static void Clear (Array array, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (index < array.GetLowerBound (0) || length < 0 ||
+ index + length > array.GetUpperBound (0) + 1)
+ throw new ArgumentOutOfRangeException ();
+
+ for (int i = 0; i < length; i++)
+ {
+ array.SetValueImpl(null, index + i);
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public virtual extern object Clone ();
+
+ public static void Copy (Array source, Array dest, int length)
+ {
+ // need these checks here because we are going to use
+ // GetLowerBound() on source and dest.
+ if (source == null)
+ throw new ArgumentNullException ("null");
+
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+
+ Copy (source, source.GetLowerBound (0), dest, dest.GetLowerBound (0), length);
+ }
+
+ public static void Copy (Array source, int source_idx, Array dest, int dest_idx, int length)
+ {
+ if (source == null)
+ throw new ArgumentNullException ("null");
+
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+
+ if (length < 0)
+ throw new ArgumentOutOfRangeException ("length");
+
+ if (source_idx < 0)
+ throw new ArgumentException ("source_idx");
+
+ if (dest_idx < 0)
+ throw new ArgumentException ("dest_idx");
+
+ int source_pos = source_idx - source.GetLowerBound (0);
+ int dest_pos = dest_idx - dest.GetLowerBound (0);
+
+
+ if (source_pos + length > source.Length || dest_pos + length > dest.Length)
+ throw new ArgumentException ("length");
+
+ if (source.Rank != dest.Rank)
+ throw new RankException ();
+
+ Type src_type = source.GetType ().GetElementType ();
+ Type dst_type = dest.GetType ().GetElementType ();
+
+ if (src_type == dst_type) {
+ FastCopy (source, source_pos, dest, dest_pos, length);
+ return;
+ }
+
+ if (!Object.ReferenceEquals (source, dest) || source_pos > dest_pos)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ Object srcval = source.GetValueImpl (source_pos + i);
+
+ try {
+ dest.SetValueImpl (srcval, dest_pos + i);
+ } catch {
+ if ((dst_type.IsValueType || dst_type.Equals (typeof (String))) &&
+ (src_type.Equals (typeof (Object))))
+ throw new InvalidCastException ();
+ else
+ throw new ArrayTypeMismatchException (
+ String.Format ("(Types: source={0}; target={1})", src_type.FullName, dst_type.FullName));
+ }
+ }
+ }
+ else
+ {
+ for (int i = length - 1; i >= 0; i--)
+ {
+ Object srcval = source.GetValueImpl (source_pos + i);
+
+ try {
+ dest.SetValueImpl (srcval, dest_pos + i);
+ } catch {
+ if ((dst_type.IsValueType || dst_type.Equals (typeof (String))) &&
+ (src_type.Equals (typeof (Object))))
+ throw new InvalidCastException ();
+ else
+ throw new ArrayTypeMismatchException (
+ String.Format ("(Types: source={0}; target={1})", src_type.FullName, dst_type.FullName));
+ }
+ }
+ }
+ }
+
+ public static int IndexOf (Array array, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return IndexOf (array, value, 0, array.Length);
+ }
+
+ public static int IndexOf (Array array, object value, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return IndexOf (array, value, index, array.Length - index);
+ }
+
+ public static int IndexOf (Array array, object value, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (length < 0 || index < array.GetLowerBound (0) ||
+ index+length-1 > array.GetUpperBound (0))
+ throw new ArgumentOutOfRangeException ();
+
+ for (int i = 0; i < length; i++)
+ {
+ if (Object.Equals (array.GetValueImpl(index + i), value))
+ return index + i;
+ }
+
+ return array.GetLowerBound (0) - 1;
+ }
+
+ [MonoTODO]
+ public void Initialize()
+ {
+ throw new NotImplementedException();
+ }
+
+ public static int LastIndexOf (Array array, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return LastIndexOf (array, value, array.Length-1);
+ }
+
+ public static int LastIndexOf (Array array, object value, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return LastIndexOf (array, value, index, index-array.GetLowerBound(0)+1);
+ }
+
+ public static int LastIndexOf (Array array, object value, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (length < 0 || index-length+1 < array.GetLowerBound (0) ||
+ index > array.GetUpperBound (0))
+ throw new ArgumentOutOfRangeException ();
+
+ for (int i = index; i >= index-length+1; i--)
+ {
+ if (Object.Equals (array.GetValueImpl(i), value))
+ return i;
+ }
+
+ return array.GetLowerBound (0) - 1;
+ }
+
+ public static void Reverse (Array array)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ Reverse (array, array.GetLowerBound (0), array.GetLength (0));
+ }
+
+ public static void Reverse (Array array, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (index < array.GetLowerBound (0) || length < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (index + length > array.GetUpperBound (0) + 1)
+ throw new ArgumentException ();
+
+ for (int i = 0; i < length/2; i++)
+ {
+ object tmp;
+
+ tmp = array.GetValueImpl (index + i);
+ array.SetValueImpl(array.GetValueImpl (index + length - i - 1), index + i);
+ array.SetValueImpl(tmp, index + length - i - 1);
+ }
+ }
+
+ public static void Sort (Array array)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ Sort (array, null, array.GetLowerBound (0), array.GetLength (0), null);
+ }
+
+ public static void Sort (Array keys, Array items)
+ {
+ if (keys == null)
+ throw new ArgumentNullException ();
+
+ Sort (keys, items, keys.GetLowerBound (0), keys.GetLength (0), null);
+ }
+
+ public static void Sort (Array array, IComparer comparer)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ Sort (array, null, array.GetLowerBound (0), array.GetLength (0), comparer);
+ }
+
+ public static void Sort (Array array, int index, int length)
+ {
+ Sort (array, null, index, length, null);
+ }
+
+ public static void Sort (Array keys, Array items, IComparer comparer)
+ {
+ if (keys == null)
+ throw new ArgumentNullException ();
+
+ Sort (keys, items, keys.GetLowerBound (0), keys.GetLength (0), comparer);
+ }
+
+ public static void Sort (Array keys, Array items, int index, int length)
+ {
+ Sort (keys, items, index, length, null);
+ }
+
+ public static void Sort (Array array, int index, int length, IComparer comparer)
+ {
+ Sort (array, null, index, length, comparer);
+ }
+
+ public static void Sort (Array keys, Array items, int index, int length, IComparer comparer)
+ {
+ int low0 = index;
+ int high0 = index + length - 1;
+
+ qsort (keys, items, index, index + length - 1, comparer);
+ }
+
+ private static void qsort (Array keys, Array items, int low0, int high0, IComparer comparer)
+ {
+ if (keys == null)
+ throw new ArgumentNullException ();
+
+ if (keys.Rank > 1 || (items != null && items.Rank > 1))
+ throw new RankException ();
+
+ if (low0 >= high0)
+ return;
+
+ int low = low0;
+ int high = high0;
+
+ object objPivot = keys.GetValueImpl ((low + high) / 2);
+
+ while (low <= high)
+ {
+ // Move the walls in
+ while (low < high0 && compare (keys.GetValueImpl (low), objPivot, comparer) < 0)
+ ++low;
+ while (high > low0 && compare (objPivot, keys.GetValueImpl (high), comparer) < 0)
+ --high;
+
+ if (low <= high)
+ {
+ swap (keys, items, low, high);
+ ++low;
+ --high;
+ }
+ }
+
+ if (low0 < high)
+ qsort (keys, items, low0, high, comparer);
+ if (low < high0)
+ qsort (keys, items, low, high0, comparer);
+ }
+
+ private static void swap (Array keys, Array items, int i, int j)
+ {
+ object tmp;
+
+ tmp = keys.GetValueImpl (i);
+ keys.SetValueImpl (keys.GetValue (j), i);
+ keys.SetValueImpl (tmp, j);
+
+ if (items != null)
+ {
+ tmp = items.GetValueImpl (i);
+ items.SetValueImpl (items.GetValueImpl (j), i);
+ items.SetValueImpl (tmp, j);
+ }
+ }
+
+ private static int compare (object value1, object value2, IComparer comparer)
+ {
+ if (comparer == null)
+ return ((IComparable) value1).CompareTo(value2);
+ else
+ return comparer.Compare(value1, value2);
+ }
+
+ public virtual void CopyTo (Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ // The order of these exception checks may look strange,
+ // but that's how the microsoft runtime does it.
+ if (this.Rank > 1)
+ throw new RankException ();
+ if (index + this.GetLength (0) > array.GetLowerBound (0) + array.GetLength (0))
+ throw new ArgumentException ();
+ if (array.Rank > 1)
+ throw new RankException ();
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ Copy (this, this.GetLowerBound(0), array, index, this.GetLength (0));
+ }
+
+ internal class SimpleEnumerator : IEnumerator {
+ Array enumeratee;
+ int currentpos;
+ int length;
+
+ public SimpleEnumerator (Array arrayToEnumerate) {
+ this.enumeratee = arrayToEnumerate;
+ this.currentpos = -1;
+ this.length = arrayToEnumerate.Length;
+ }
+
+ public object Current {
+ get {
+ // Exception messages based on MS implementation
+ if (currentpos < 0 ) {
+ throw new InvalidOperationException
+ ("Enumeration has not started");
+ }
+ if (currentpos >= length) {
+ throw new InvalidOperationException
+ ("Enumeration has already ended");
+ }
+ // Current should not increase the position. So no ++ over here.
+ return enumeratee.GetValueImpl(currentpos);
+ }
+ }
+
+ public bool MoveNext() {
+ //The docs say Current should throw an exception if last
+ //call to MoveNext returned false. This means currentpos
+ //should be set to length when returning false.
+ if (currentpos < length) {
+ currentpos++;
+ }
+ if(currentpos < length)
+ return true;
+ else
+ return false;
+ }
+
+ public void Reset() {
+ currentpos= -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArrayTypeMismatchException.cs b/mcs/class/corlib/System/ArrayTypeMismatchException.cs
new file mode 100644
index 00000000000..2938300de61
--- /dev/null
+++ b/mcs/class/corlib/System/ArrayTypeMismatchException.cs
@@ -0,0 +1,38 @@
+//
+// System.ArrayTypeMismatchException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class ArrayTypeMismatchException : SystemException {
+ // Constructors
+ public ArrayTypeMismatchException ()
+ : base (Locale.GetText ("Source array type cannot be assigned to destination array type"))
+ {
+ }
+
+ public ArrayTypeMismatchException (string message)
+ : base (message)
+ {
+ }
+
+ public ArrayTypeMismatchException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected ArrayTypeMismatchException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+
+ }
+}
diff --git a/mcs/class/corlib/System/AssemblyLoadEventArgs.cs b/mcs/class/corlib/System/AssemblyLoadEventArgs.cs
new file mode 100755
index 00000000000..dec3463c6aa
--- /dev/null
+++ b/mcs/class/corlib/System/AssemblyLoadEventArgs.cs
@@ -0,0 +1,34 @@
+//
+// System.AssemblyLoadEventArgs.cs
+//
+// Author:
+// Chris Hynes (chrish@assistedsolutions.com)
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+using System.Reflection;
+
+namespace System
+{
+ public class AssemblyLoadEventArgs: EventArgs
+ {
+ private Assembly m_loadedAssembly;
+
+ public AssemblyLoadEventArgs(Assembly loadedAssembly)
+ {
+ this.m_loadedAssembly = loadedAssembly;
+ }
+
+ public Assembly LoadedAssembly
+ {
+ get
+ {
+ return m_loadedAssembly;
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System/AssemblyLoadEventHandler.cs b/mcs/class/corlib/System/AssemblyLoadEventHandler.cs
new file mode 100755
index 00000000000..46074f9523d
--- /dev/null
+++ b/mcs/class/corlib/System/AssemblyLoadEventHandler.cs
@@ -0,0 +1,10 @@
+// System.AssemblyLoadEventHandler.cs
+//
+// Paolo Molaro
+//
+// (C) 2002 Ximian, Inc.
+
+namespace System
+{
+ public delegate void AssemblyLoadEventHandler (object sender, AssemblyLoadEventArgs args);
+}
diff --git a/mcs/class/corlib/System/AsyncCallback.cs b/mcs/class/corlib/System/AsyncCallback.cs
new file mode 100644
index 00000000000..ba9ead8e6f2
--- /dev/null
+++ b/mcs/class/corlib/System/AsyncCallback.cs
@@ -0,0 +1,13 @@
+//
+// System/AsyncCallback.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+ public delegate void AsyncCallback (IAsyncResult ar);
+}
+
diff --git a/mcs/class/corlib/System/Attribute.cs b/mcs/class/corlib/System/Attribute.cs
new file mode 100644
index 00000000000..cdad17adbda
--- /dev/null
+++ b/mcs/class/corlib/System/Attribute.cs
@@ -0,0 +1,386 @@
+//
+// System.Attribute.cs
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com) - Original
+// Nick D. Drochak II (ndrochak@gol.com) - Implemented most of the guts
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+
+namespace System {
+
+ [AttributeUsage(AttributeTargets.All)]
+ [Serializable]
+ public abstract class Attribute {
+
+ protected Attribute ()
+ {
+ }
+
+ public virtual object TypeId {
+ get {
+ // Derived classes should override this default behaviour as appropriate
+ return this.GetType ();
+ }
+ }
+
+ private static void CheckParameters (object element, Type attribute_type)
+ {
+ // neither parameter is allowed to be null
+ if (null == element)
+ {
+ throw new ArgumentNullException ("element");
+ }
+
+ if (null == attribute_type)
+ {
+ throw new ArgumentNullException ("attribute_type");
+ }
+ }
+
+ private static System.Attribute FindAttribute (object[] attributes)
+ {
+ // if there exists more than one attribute of the given type, throw an exception
+ if (attributes.Length > 1) {
+ throw new System.Reflection.AmbiguousMatchException (
+ Locale.GetText ("<element> has more than one attribute of type <attribute_type>"));
+ }
+
+ if (attributes.Length < 1)
+ return null;
+
+ // tested above for '> 1' and and '< 1', so only '== 1' is left,
+ // i.e. we found the attribute
+
+ return (System.Attribute) attributes[0];
+ }
+
+ private static void CheckAncestry (Type attribute_type)
+ {
+ // attribute_type must be derived from type System.Attribute
+ Type t = typeof (System.Attribute);
+
+ /* fixme: thgi does not work for target monolib2
+ if (!attribute_type.IsSubclassOf (t))
+ {
+ throw new ArgumentException ("Parameter is not a type derived from System.Attribute", "attribute_type");
+ }
+ */
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.ParameterInfo element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.MemberInfo element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Assembly element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Module element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Module element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // Module inheritance hierarchies CAN NOT be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is INGNORED.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Assembly element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // Assembly inheritance hierarchies CAN NOT be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is INGNORED.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.ParameterInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // ParameterInfo inheritance hierarchies CAN NOT be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is INGNORED.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.MemberInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // MemberInfo inheritance hierarchies can be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is respected.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element)
+ {
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element)
+ {
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element){
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element){
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes;
+
+ attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public override int GetHashCode ()
+ {
+ return ((Object) this).GetHashCode ();
+ }
+
+ public virtual bool IsDefaultAttribute ()
+ {
+ // Derived classes should override this default behaviour as appropriate
+ return false;
+ }
+
+ public static bool IsDefined (System.Reflection.Module element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.ParameterInfo element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.MemberInfo element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.Assembly element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.MemberInfo element, Type attribute_type,
+ bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.Assembly element, Type attribute_type,
+ bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.Module element, Type attribute_type,
+ bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.ParameterInfo element,
+ Type attribute_type, bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public virtual bool Match (object obj)
+ {
+ // default action is the same as Equals.
+ // Derived classes should override as appropriate
+
+ return this.Equals (obj);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj == null || !(obj is Attribute))
+ return false;
+
+ return ((Attribute) obj) == this;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/AttributeTargets.cs b/mcs/class/corlib/System/AttributeTargets.cs
new file mode 100644
index 00000000000..72505159938
--- /dev/null
+++ b/mcs/class/corlib/System/AttributeTargets.cs
@@ -0,0 +1,82 @@
+// AttributeTargets.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:31:48 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum AttributeTargets {
+
+ /// <summary>
+ /// </summary>
+ Assembly = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Module = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Class = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Struct = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ Enum = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ Constructor = 0x00000020,
+
+ /// <summary>
+ /// </summary>
+ Method = 0x00000040,
+
+ /// <summary>
+ /// </summary>
+ Property = 0x00000080,
+
+ /// <summary>
+ /// </summary>
+ Field = 0x00000100,
+
+ /// <summary>
+ /// </summary>
+ Event = 0x00000200,
+
+ /// <summary>
+ /// </summary>
+ Interface = 0x00000400,
+
+ /// <summary>
+ /// </summary>
+ Parameter = 0x00000800,
+
+ /// <summary>
+ /// </summary>
+ Delegate = 0x00001000,
+
+ /// <summary>
+ /// </summary>
+ ReturnValue = 0x00002000,
+
+ /// <summary>
+ /// </summary>
+ All = Assembly | Module | Class | Struct | Enum | Constructor | Method | Property | Field | Event | Interface | Parameter | Delegate | ReturnValue,
+ } // AttributeTargets
+
+} // System
diff --git a/mcs/class/corlib/System/AttributeUsageAttribute.cs b/mcs/class/corlib/System/AttributeUsageAttribute.cs
new file mode 100644
index 00000000000..c0bcb0616a2
--- /dev/null
+++ b/mcs/class/corlib/System/AttributeUsageAttribute.cs
@@ -0,0 +1,50 @@
+//
+// System.AttributeUsage.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ [AttributeUsage(AttributeTargets.All)]
+ [Serializable]
+ public sealed class AttributeUsageAttribute : Attribute {
+ AttributeTargets valid_on;
+ bool allow_multiple, inherited;
+
+ public AttributeUsageAttribute (AttributeTargets validOn)
+ {
+ valid_on = validOn;
+ }
+
+ public bool AllowMultiple {
+ get {
+ return allow_multiple;
+ }
+
+ set {
+ allow_multiple = value;
+ }
+ }
+
+ public bool Inherited {
+ get {
+ return inherited;
+ }
+
+ set {
+ inherited = value;
+ }
+ }
+
+ public AttributeTargets ValidOn {
+ get {
+ return valid_on;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System/BadImageFormatException.cs b/mcs/class/corlib/System/BadImageFormatException.cs
new file mode 100644
index 00000000000..8ea5857f5fa
--- /dev/null
+++ b/mcs/class/corlib/System/BadImageFormatException.cs
@@ -0,0 +1,93 @@
+// System.BadImageFormatException
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class BadImageFormatException : SystemException
+ {
+ // Fields
+ private string msg; // we need this because System.Exception's message is private.
+ private Exception inner;
+ private string fileName;
+ private string fusionLog;
+
+ // Constructors
+ public BadImageFormatException ()
+ : base (Locale.GetText ("Invalid file image."))
+ {
+ msg = "Invalid file image.";
+ }
+
+ public BadImageFormatException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ protected BadImageFormatException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ fileName = info.GetString ("BadImageFormat_FileName");
+ fusionLog = info.GetString ("BadImageFormat_FusionLog");
+ }
+
+ public BadImageFormatException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ }
+
+ public BadImageFormatException (string message, string fileName)
+ : base (message)
+ {
+ msg = message;
+ this.fileName = fileName;
+ }
+
+ public BadImageFormatException (string message, string fileName, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ this.fileName = fileName;
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return Locale.GetText (msg); }
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("BadImageFormat_FileName", fileName);
+ info.AddValue ("BadImageFormat_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ return inner.ToString();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/BitConverter.cs b/mcs/class/corlib/System/BitConverter.cs
new file mode 100755
index 00000000000..6b6961d4bda
--- /dev/null
+++ b/mcs/class/corlib/System/BitConverter.cs
@@ -0,0 +1,270 @@
+//
+// System.BitConverter
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+using System;
+
+namespace System {
+ public sealed class BitConverter {
+
+ private BitConverter () {}
+
+ static bool AmILittleEndian()
+ {
+ byte[] one = GetBytes((int)1);
+ return (one[0] == 1);
+ }
+
+ public static readonly bool IsLittleEndian = AmILittleEndian ();
+
+ public static long DoubleToInt64Bits(double value)
+ {
+ return ToInt64(GetBytes(value), 0);
+ }
+
+ public static double Int64BitsToDouble(long value)
+ {
+ return ToDouble(GetBytes(value), 0);
+ }
+
+ unsafe static byte[] GetBytes(byte *ptr, int count)
+ {
+ byte[] ret = new byte[count];
+
+ for (int i = 0; i < count; i++) {
+ ret[i] = ptr[i];
+ }
+
+ return ret;
+ }
+
+ unsafe public static byte[] GetBytes(bool value)
+ {
+ return GetBytes((byte *)&value, 1);
+ }
+
+ unsafe public static byte[] GetBytes(char value)
+ {
+ return GetBytes((byte *)&value, 2);
+ }
+
+ unsafe public static byte[] GetBytes(short value)
+ {
+ return GetBytes((byte *)&value, 2);
+ }
+
+ unsafe public static byte[] GetBytes(int value)
+ {
+ return GetBytes((byte *)&value, 4);
+ }
+
+ unsafe public static byte[] GetBytes(long value)
+ {
+ return GetBytes((byte *)&value, 8);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static byte[] GetBytes(ushort value)
+ {
+ return GetBytes((byte *)&value, 2);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static byte[] GetBytes(uint value)
+ {
+ return GetBytes((byte *)&value, 4);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static byte[] GetBytes(ulong value)
+ {
+ return GetBytes((byte *)&value, 8);
+ }
+
+ unsafe public static byte[] GetBytes(float value)
+ {
+ return GetBytes((byte *)&value, 4);
+ }
+
+ unsafe public static byte[] GetBytes(double value)
+ {
+ return GetBytes((byte *)&value, 8);
+ }
+
+ unsafe static void PutBytes(byte *dst, byte[] src, int start_index, int count)
+ {
+ if (src == null) {
+ throw new ArgumentNullException();
+ }
+
+ if (src.Length < start_index + count) {
+ // LAMESPEC:
+ // the docs say it should be ArgumentOutOfRangeException, but
+ // the mscorlib throws an ArgumentException.
+ throw new ArgumentException();
+ }
+
+ for (int i = 0; i < count; i++) {
+ dst[i] = src[i + start_index];
+ }
+ }
+
+ unsafe public static bool ToBoolean(byte[] value, int start_index)
+ {
+ bool ret;
+
+ PutBytes((byte *)&ret, value, start_index, 1);
+
+ return ret;
+ }
+
+ unsafe public static char ToChar(byte[] value, int start_index)
+ {
+ char ret;
+
+ PutBytes((byte *)&ret, value, start_index, 2);
+
+ return ret;
+ }
+
+ unsafe public static short ToInt16(byte[] value, int start_index)
+ {
+ short ret;
+
+ PutBytes((byte *)&ret, value, start_index, 2);
+
+ return ret;
+ }
+
+ unsafe public static int ToInt32(byte[] value, int start_index)
+ {
+ int ret;
+
+ PutBytes((byte *)&ret, value, start_index, 4);
+
+ return ret;
+ }
+
+ unsafe public static long ToInt64(byte[] value, int start_index)
+ {
+ long ret;
+
+ PutBytes((byte *)&ret, value, start_index, 8);
+
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static ushort ToUInt16(byte[] value, int start_index)
+ {
+ ushort ret;
+
+ PutBytes((byte *)&ret, value, start_index, 2);
+
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static uint ToUInt32(byte[] value, int start_index)
+ {
+ uint ret;
+
+ PutBytes((byte *)&ret, value, start_index, 4);
+
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static ulong ToUInt64(byte[] value, int start_index)
+ {
+ ulong ret;
+
+ PutBytes((byte *)&ret, value, start_index, 8);
+
+ return ret;
+ }
+
+ unsafe public static float ToSingle(byte[] value, int start_index)
+ {
+ float ret;
+
+ PutBytes((byte *)&ret, value, start_index, 4);
+
+ return ret;
+ }
+
+ unsafe public static double ToDouble(byte[] value, int start_index)
+ {
+ double ret;
+
+ PutBytes((byte *)&ret, value, start_index, 8);
+
+ return ret;
+ }
+
+ public static string ToString(byte[] value)
+ {
+ if (value == null) {
+ throw new ArgumentNullException();
+ }
+
+ return ToString(value, 0, value.Length);
+ }
+
+ public static string ToString(byte[] value, int start_index)
+ {
+ if (value == null)
+ throw new ArgumentNullException("value");
+ if (start_index < 0 || start_index > value.Length - 1)
+ throw new ArgumentOutOfRangeException("start_index");
+
+ return ToString(value, start_index, value.Length - start_index);
+ }
+
+ public static string ToString(byte[] value, int start_index, int length)
+ {
+ if (value == null) {
+ throw new ArgumentNullException();
+ }
+
+ // The 4th and last clause (start_index >= value.Length)
+ // was added as a small fix to a very obscure bug.
+ // It makes a small difference when start_index is
+ // outside the range and length==0.
+ if (start_index < 0 || length < 0 || start_index + length > value.Length || start_index >= value.Length) {
+ throw new ArgumentOutOfRangeException();
+ }
+ string ret = "";
+ int end = start_index + length;
+
+ for (int i = start_index; i < end; i++) {
+ if (i > start_index)
+ ret = ret + '-';
+
+ char high = (char)((value[i] >> 4) & 0x0f);
+ char low = (char)(value[i] & 0x0f);
+
+ if (high < 10)
+ high += '0';
+ else {
+ high -= (char) 10;
+ high += 'A';
+ }
+
+ if (low < 10)
+ low += '0';
+ else {
+ low -= (char) 10;
+ low += 'A';
+ }
+
+ ret = ret + high + low;
+ }
+
+ return ret;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Boolean.cs b/mcs/class/corlib/System/Boolean.cs
new file mode 100644
index 00000000000..e28e7cb00fa
--- /dev/null
+++ b/mcs/class/corlib/System/Boolean.cs
@@ -0,0 +1,265 @@
+//
+// System.Boolean.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+//
+// I guess this is the Boolean class. This was written word for word
+// off the Library specification for System.Boolean in the ECMA
+// TC39 TG2 and TG3 working documents.
+//
+// The XML style documentation isn't that elegant, but it seems to
+// be the standard way according to the poorly documented C#
+// Programmer's Reference section on XML Documentation.
+//
+// This header and the one above it can be formatted however, just trying
+// to keep it consistent w/ the existing mcs headers.
+//
+// Even though it's not in the ECMA docs, the .NET Framework Class Library
+// says this implements IConvertible, but if it does it has some other
+// member functions to implement.
+//
+
+using System.Globalization;
+namespace System {
+
+ /// <summary>
+ /// Represents the boolean values of logical true and false.
+ /// </summary>
+ [Serializable]
+ public struct Boolean : IComparable, IConvertible {
+
+ /// <value>
+ /// The String representation of Boolean False
+ /// </value>
+ public static readonly string FalseString;
+
+ /// <value>
+ /// The String representation of Boolean True
+ /// </value>
+ public static readonly string TrueString;
+
+ /// <value>
+ /// Internal bool value for for this instance
+ /// </value>
+
+ internal bool value;
+
+ static Boolean ()
+ {
+ FalseString = "False";
+ TrueString = "True";
+ }
+
+ /// <summary>
+ /// Compares the current Boolean instance against another object.
+ /// </summary>
+ /// <remarks>
+ /// Throws an ArgumentException if <c>obj</c> isn't null or
+ /// a Boolean.
+ /// </remarks>
+ /// <param name="obj">
+ /// The object to compare against
+ /// </param>
+ /// <returns>
+ /// An int reflecting the sort order of this instance as
+ /// compared to <c>obj</c>
+ /// -1 if this instance is false and <c>obj</c> is true
+ /// 0 if this instance is equal to <c>obj</c>
+ /// 1 if this instance is true and <c>obj</c> is false,
+ /// or <c>obj</c> is null
+ /// </returns>
+ public int CompareTo (object obj)
+ {
+ if (obj == null)
+ return 1;
+
+ if (!(obj is System.Boolean))
+ throw new ArgumentException
+ (Locale.GetText ("Object is not a Boolean and is not a null reference"));
+
+ // for case #3
+ if (obj == null || (value == true && (bool)obj == false))
+ return 1;
+
+ // for case #2, else it's #1
+ return (value == (bool)obj) ? 0 : -1;
+ }
+
+ /// <summary>
+ /// Determines whether this instance and another object represent the
+ /// same type and value.
+ /// </summary>
+ /// <param name="obj">
+ /// The object to check against
+ /// </param>
+ /// <returns>
+ /// true if this instnace and <c>obj</c> are same value,
+ /// otherwise false if it is not or null
+ /// </returns>
+ public override bool Equals (Object obj)
+ {
+ if (obj == null || !(obj is System.Boolean))
+ return false;
+
+ return ((bool)obj) == value;
+ }
+
+ /// <summary>
+ /// Generates a hashcode for this object.
+ /// </summary>
+ /// <returns>
+ /// An Int32 value holding the hash code
+ /// </returns>
+ public override int GetHashCode ()
+ {
+ // Guess there's not too many ways to hash a Boolean
+ return value ? 1 : 0;
+ }
+
+ /// <summary>
+ /// Returns a given string as a boolean value. The string must be
+ /// equivalent to either TrueString or FalseString, with leading and/or
+ /// trailing spaces, and is parsed case-insensitively.
+ /// </summary>
+ /// <remarks>
+ /// Throws an ArgumentNullException if <c>val</c> is null, or a
+ /// FormatException if <c>val</c> doesn't match <c>TrueString</c>
+ /// or <c>FalseString</c>
+ /// </remarks>
+ /// <param name="val">
+ /// The string value to parse
+ /// </param>
+ /// <returns>
+ /// true if <c>val</c> is equivalent to TrueString,
+ /// otherwise false
+ /// </returns>
+ public static bool Parse (string val)
+ {
+ if (val == null)
+ throw new ArgumentNullException (
+ Locale.GetText ("Value is a null reference"));
+
+ val = val.Trim ();
+
+ if (String.Compare (val, TrueString, true) == 0)
+ return true;
+
+ if (String.Compare (val, FalseString, true) == 0)
+ return false;
+
+ throw new FormatException (Locale.GetText (
+ "Value is not equivalent to either TrueString or FalseString"));
+ }
+
+ /// <summary>
+ /// Returns a string representation of this Boolean object.
+ /// </summary>
+ /// <returns>
+ /// <c>FalseString</c> if the instance value is false, otherwise
+ /// <c>TrueString</c>
+ /// </returns>
+ public override string ToString ()
+ {
+ return value ? TrueString : FalseString;
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Boolean;
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return value;
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte(value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal(value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble(value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle(value);
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return ToString();
+ }
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+
+ } // System.Boolean
+
+} // Namespace System
diff --git a/mcs/class/corlib/System/Buffer.cs b/mcs/class/corlib/System/Buffer.cs
new file mode 100755
index 00000000000..ac0209fbd3f
--- /dev/null
+++ b/mcs/class/corlib/System/Buffer.cs
@@ -0,0 +1,70 @@
+//
+// System/Buffer.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System {
+ public sealed class Buffer {
+
+ private Buffer () {}
+
+ public static int ByteLength (Array array) {
+ // note: the other methods in this class also use ByteLength to test for
+ // null and non-primitive arguments as a side-effect.
+
+ if (array == null)
+ throw new ArgumentNullException (); // default message
+
+ int length = ByteLengthInternal (array);
+ if (length < 0)
+ throw new ArgumentException ("Object must be array of primitives.");
+
+ return length;
+ }
+
+ public static byte GetByte (Array array, int index) {
+ if (index < 0 || index >= ByteLength (array))
+ throw new ArgumentOutOfRangeException ("Index was out of range. Must be non-negative and less than the size of the collection.");
+
+ return GetByteInternal (array, index);
+ }
+
+ public static void SetByte (Array array, int index, byte value) {
+ if (index < 0 || index >= ByteLength (array))
+ throw new ArgumentOutOfRangeException ("Index was out of range. Must be non-negative and less than the size of the collection.");
+
+ SetByteInternal (array, index, value);
+ }
+
+ public static void BlockCopy (Array src, int src_offset, Array dest, int dest_offset, int count) {
+ if (src_offset < 0 || dest_offset < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ("Non-negative number required.");
+
+ if (src_offset + count > ByteLength (src) || dest_offset + count > ByteLength (dest))
+ throw new ArgumentException ("Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");
+
+ BlockCopyInternal (src, src_offset, dest, dest_offset, count);
+ }
+
+ // private
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static int ByteLengthInternal (Array array);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static byte GetByteInternal (Array array, int index);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void SetByteInternal (Array array, int index, int value);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void BlockCopyInternal (Array src, int src_offset, Array dest, int dest_offset, int count);
+ }
+}
diff --git a/mcs/class/corlib/System/Byte.cs b/mcs/class/corlib/System/Byte.cs
new file mode 100644
index 00000000000..db2482f9818
--- /dev/null
+++ b/mcs/class/corlib/System/Byte.cs
@@ -0,0 +1,249 @@
+//
+// System.Byte.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct Byte : IComparable, IFormattable, IConvertible {
+
+ public const byte MinValue = 0;
+ public const byte MaxValue = 255;
+
+ internal byte value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Byte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Byte"));
+
+ byte xv = (byte) v;
+
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Byte))
+ return false;
+
+ return ((byte) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static byte Parse (string s)
+ {
+ byte val = 0;
+ int len;
+ int i;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ // look for the first non-whitespace character
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ // if it's all whitespace, then throw exception
+ if (i == len)
+ throw new FormatException ();
+
+ // look for the optional '+' sign
+ if (s [i] == '+')
+ i++;
+
+ // we should just have numerals followed by whitespace now
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ // shift left and accumulate every time we find a numeral
+ byte d = (byte) (c - '0');
+
+ val = checked ((byte) (val * 10 + d));
+ digits_seen = true;
+ } else {
+ // after the last numeral, only whitespace is allowed
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+
+ // if all we had was a '+' sign, then throw exception
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static byte Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static byte Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ public static byte Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ uint tmpResult = UInt32.Parse (s, style, fp);
+ if (tmpResult > Byte.MaxValue || tmpResult < Byte.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (byte) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return ToString (null, provider);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Byte;
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean(value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return value;
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar(value);
+ }
+
+ [CLSCompliant(false)]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal(value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble(value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle(value);
+ }
+
+/*
+ string IConvertible.ToString (IFormatProvider provider)
+ {
+ return ToString("G", provider);
+ }
+*/
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CLSCompliantAttribute.cs b/mcs/class/corlib/System/CLSCompliantAttribute.cs
new file mode 100755
index 00000000000..aae9120a250
--- /dev/null
+++ b/mcs/class/corlib/System/CLSCompliantAttribute.cs
@@ -0,0 +1,35 @@
+//
+// System.CLSCompliantAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// Used to indicate if an element of a program is CLS compliant.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// </remarks>
+ [AttributeUsage(AttributeTargets.All)]
+ [Serializable]
+ public sealed class CLSCompliantAttribute : Attribute {
+
+ bool is_compliant;
+
+ public CLSCompliantAttribute (bool is_compliant)
+ {
+ this.is_compliant = is_compliant;
+ }
+
+ public bool IsCompliant {
+ get {
+ return is_compliant;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CannotUnloadAppDomainException.cs b/mcs/class/corlib/System/CannotUnloadAppDomainException.cs
new file mode 100644
index 00000000000..1cd03735a35
--- /dev/null
+++ b/mcs/class/corlib/System/CannotUnloadAppDomainException.cs
@@ -0,0 +1,41 @@
+//
+// System.CannotUnloadAppDomainException
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class CannotUnloadAppDomainException : SystemException
+ {
+ // Constructors
+ public CannotUnloadAppDomainException ()
+ : base (Locale.GetText ("Attempt to unload application domain failed."))
+ {
+ }
+
+ public CannotUnloadAppDomainException (string message)
+ : base (message)
+ {
+ }
+
+ protected CannotUnloadAppDomainException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public CannotUnloadAppDomainException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog
new file mode 100644
index 00000000000..61b25b1cfb2
--- /dev/null
+++ b/mcs/class/corlib/System/ChangeLog
@@ -0,0 +1,2729 @@
+2003-01-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoType.cs: re-added lines that were removed in the previous commit.
+
+2003-01-16 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * Type.cs: corrected property IsSerializable. It should always return
+ true for enums and delegates
+ * MonoType.cs: added serialization support.
+ * Delegate.cs: added serialization support.
+ * DBNull.cs: added serialization support.
+ * UnitySerializationHolder.cs: supports serialization of Assembly,
+ MonoType and DBNull.
+ * DelegateSerializationHolder.cs: added.
+
+2003-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Exception.cs: changed default message to match MS one.
+
+2003-01-12 Patrik Torstensson <totte@race-x-change.com>
+
+ * String.cs: Fixed bug with CompareOrdinal
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Enum.cs: implements IFormattable.
+
+2003-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomain.cs: implemented DoCallBack method.
+ * MonoType.cs:
+ (GetConstructorImpl): when the flag is BindingFlags.Default, set it to
+ Public, Instance.
+
+ NUnit2 tests start moving.
+
+2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Activator.cs: fixed bug #36052. Also added checks to avoid trying to
+ instantiate an abstract class.
+
+2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Type.cs:
+ (IsSubclassOf): return false when null. Use != instead of Equals.
+
+2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Type.cs: fixed IsSubclassOf. Patch from Zoltan Varga.
+
+Fri Jan 3 20:18:51 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: fixed Namespace property for nested types.
+
+Fri Jan 3 16:18:27 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: create properly typed arrays when returning
+ arrays of attributes of a given type.
+
+Fri Jan 3 11:10:14 CET 2003 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: fixed MemberType property for nested types.
+
+2003-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * String.cs: fixed bug #36209.
+
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * Activator.cs: implemented method GetObject.
+
+2002-12-28 Marcus Urban <mathpup@mylinuxisp.com>
+
+ * Activator.cs: Since the documentation indicates the method
+ either succeeds or throws one of the listed exceptions, we weren't
+ expecting that CreateInstance might be returning null.
+
+ For more information on the bug, see http://bugs.ximian.com/show_bug.cgi?id=36109
+
+2002-12-20 Lluis Sanchez Gual <lsg@ctv.es>
+
+ * MarshalByRefObject.cs: implemented CreateObjRef.
+
+2002-12-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DateTime.cs: fixed bug #30076.
+ * TimeZone.cs: provide the parameter name in a exception.
+
+2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DecimalFormatter.cs: fixed bug #35560.
+
+Wed Dec 4 16:04:28 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: implemented GetInterfaceMap (needs an updated runtime).
+
+2002-12-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Array.cs: use Object.Equals (obj, obj) to compare objects to avoid
+ nulls. Fixes #34909.
+
+2002-12-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomain.cs: DoAssemblyResolve now returns when one of the handlers
+ returns a non-null assembly.
+
+2002-12-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MulticastDelegate.cs: make GetInvocationList work for more than 1
+ delegate.
+
+2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MulticastDelegate.cs: implemented GetInvocationList. I'll check later
+ if this is the correct order of invocation.
+
+2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Type.cs: changed the signature of internal_from_name. Modified
+ the overloads of GetType to use it and check the typeName argument.
+ Implemented FindInterfaces.
+
+2002-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MarshalByRefObject.cs: undo latest changes. It breaks the build by
+ some obscure reasons (try make -f makefile.gnu using a corlib which has
+ the modified version).
+
+2002-11-26 Miguel de Icaza <miguel@ximian.com>
+
+ * String.cs (Concat): Reduce the number of compares required.
+
+Mon Nov 18 17:54:22 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Activator.cs: throw a MissingMethodException if the default
+ constructor is not found in CreateInstance.
+
+2002-11-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * String.cs:
+ (Equals (str, str)): use 'as' instead of casting to object.
+ (Equals (obj)): check the length of the strings (until now,
+ "Hello".Equals ((object) "Hellow World!) was true!).
+
+2002-11-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoType.cs: implemented GetEvent (name, flags).
+
+2002-11-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomain.cs: implemented a couple of methods called from the runtime
+ to fire AssemblyLoad and AssemblyResolve events.
+
+2002-10-31 Dick Porter <dick@ximian.com>
+
+ * Environment.cs: MonoIO methods now have an error parameter
+
+2002-10-29 Zoltan Varga <vargaz@freemail.hu>
+
+ * Enum.cs: Added support for whitespaces in Enum:Parse().
+
+2002-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Type.cs: fixed GetProperty (string, Type []) and removed get_property
+ internal call. Closes bug #32992.
+
+2002-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Exception.cs: display the inner exception, if any, in ToString ().
+
+2002-10-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Environment.cs: fixed StackTrace property.
+
+2002-10-16 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Parse): Then fix the code so that it works too.
+
+2002-10-15 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Parse): Use unsigned casts to avoid compiler warnings.
+
+2002-10-12 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatter.cs: Fix compiler warnings.
+
+2002-10-11 Tim Haynes <thaynes@openlinksw.com>
+
+ * Type.cs (GetConstructors): Use the correct flags.
+
+2002-10-09 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatter.cs: Suppress insignificant leading zeros
+
+Fri Sep 27 15:06:29 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: applied patch by "Si Jingnan"
+ <stonewell@21cn.com> to return also derived types.
+
+2002-09-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Activator.cs: little fix in CreateInstance (Type, bool).
+
+2002-09-19 Duncan Mak <duncan@ximian.com>
+
+ * Array.cs (CopyTo): Revert back to 1.40, this is stopping
+ I18N/Common from building right now.
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs (CopyTo): Account for Object type and base (primitive) types
+ * Type.cs (IsAssignableFrom): return false for a null parameter
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs (CopyTo): Check that source type can be cast automatically
+ to the destination type.
+
+2002-09-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Type.cs: implemented IsAssignableFrom, DefaultBinder and
+ GetDefaultMembers.
+
+2002-09-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Char.cs: implemented ToString (char)
+ * IntegerFormatter.cs: made it internal.
+
+2002-09-13 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Format): handle the "d" format for both signed and unsigned
+ underlying types.
+
+2002-09-12 Dick Porter <dick@ximian.com>
+
+ * UIntPtr.cs: Remove the [StructLayout(LayoutKind.Auto)]
+ attribute, as there doesn't appear to be any struct
+ layout-depending code here (and corcompare says it should be
+ LayoutKind.Sequential)
+
+ * Decimal.cs: Stub out missing methods, add
+ [DecimalConstantAttribute] to the constant fields (as shown by
+ corcompare).
+
+ * LocalDataStoreSlot.cs:
+ * Environment.cs:
+ * Char.cs:
+ * Array.cs: Stub out missing methods.
+
+ * TypedReference.cs:
+ * ArgIterator.cs: Stub out
+
+ * AppDomainSetup.cs:
+ * AppDomain.cs: Stub out missing methods, add missing
+ ClassInterface(ClassInterfaceType.None) attribute.
+
+2002-09-12 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs (ToString): Throw exception when "X" format is passed in.
+
+Wed Sep 11 15:26:34 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: implemented Module property.
+
+Wed Sep 11 12:49:51 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs, Type.cs: implemented InvokeMember.
+
+Wed Sep 11 11:06:43 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Delegate.cs: check the type passed to CreateDelegate is a Delegate
+ type. Check the method signature matches.
+
+Sat Sep 7 10:16:52 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * RuntimeMethodHandle.cs: implemented GetFunctionPointer().
+
+2002-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Console.cs: Specify an encoder, otherwise we will get the UTF8
+ encoder that by default emits the byte markers.
+
+Fri Sep 6 20:14:04 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Delegate.cs: look also for non-public methods until we have the
+ security checks in place.
+
+Fri Sep 6 12:20:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: consider also the full name in GetInterface.
+
+Fri Sep 6 12:11:28 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: implemented GetMembers, GetConstructorImpl and
+ GetMethodImpl using the binder.
+ * Type.cs: GetConstructorImpl/GetConstructor fixes.
+
+2002-09-03 Jonathan Pryor <jonpryor@vt.edu>
+ * Enum.cs: Get rid of warning CS0162.
+
+2002-09-04 Miguel de Icaza <miguel@ximian.com>
+
+ * Double.cs, Single.cs, Char.cs, Boolean.cs: Use internal for the
+ actual value instead of public.
+
+ * LocalDataStoreSlot.cs: Make constructor internal.
+
+ * Int16.cs, UInt16.cs, Int32.cs, UInt32.cs, Int64.cs, UInt64.cs,
+ SByte.cs, Byte.cs, Char.cs: Use internal for the actual value
+ instead of public.
+
+2002-09-03 Jonathan Pryor <jonpryor@vt.edu>
+ * Enum.cs: Fixed Enum.Format so that the "x" format specifier would work
+ properly.
+
+2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DateTime.cs: fixed buglet.
+
+Tue Aug 27 16:39:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: speedup access to common data.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Double.cs: implemented TryParse.
+
+ * Math.cs: PowImpl is now private.
+
+ * MissingFieldException.cs: implemented Message.
+
+ * RuntimeMethodHandle.cs: stubbed GetFunctionPointer.
+
+ * _AppDomain.cs: Uncommented ToString.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Type.cs:
+ (IsValueTypeImpl): it's virtual, not abstract. Implemented.
+
+2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ArgumentException.cs: use the field instead of the property for
+ param_name.
+
+ * ArgumentOutOfRangeException.cs: modified Message.
+
+ * DateTime.cs:
+ (_DoParse): throw out of range exception for year. Removed check
+ for month (it's done in the constructor).
+
+2002-08-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Environment.cs: Implemented OSVersion property.
+
+2002-08-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * Exception.cs: set stack_trace to null
+
+Wed Aug 21 13:02:20 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AppDomain.cs: implemented ToString().
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomain.cs: securityInfo can be null in CreateDomain.
+
+2002-08-19 Dick Porter <dick@ximian.com>
+
+ * MonoType.cs: Add a space before the Assembly name in
+ AssemblyQualifiedName (needed for resource files so the MS runtime
+ can load types)
+
+2002-08-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomain.cs: parameter name when throwing ArgumentNullException.
+
+ * ArgumentException.cs: modified Message to do what MS does.
+
+ * ArgumentNullException.cs: don't use {0} in message.
+
+ * Exception.cs: use Message property in ToString ().
+
+2002-08-14 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * WeakReference.cs: Changed the constructor and GetObjectData
+ method needed for ISerializable implementation in order to be
+ compatible with SOAP generated by MS.
+
+Wed Aug 14 17:34:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs, Type.cs: DeclaringType/ReflectedType fixes.
+
+2002-08-12 Dietmar Maurer <dietmar@ximian.com>
+
+ * Exception.cs (ToString): changed the ouput format.
+
+2002-08-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * MonoType.cs: moved get_method icall to this class, we can
+ remove it as soon someone provides a full featured GetMethodImpl.
+
+ * Type.cs: use GetMethodImpl everywhere.
+
+ * Delegate.cs: new CreateDelegate implementations.
+
+2002-08-06 Tim Coleman <tim@timcoleman.com>
+ * MonoType.cs:
+ Fix bug #28582. Now checks parameters for properties
+ in GetPropertyImpl.
+
+2002-08-04 Nick Drochak <ndrochak@gol.com>
+
+ * Buffer.cs: Throw correct exception in GetByte() and SetByte().
+
+2002-08-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * String.cs:
+ (FormatSpecifier): allow white space between the comman and the width
+ specifier.
+
+2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * Int64.cs:
+ * UInt32.cs:
+ * UInt64.cs: fixed bug #28050. May be a MS bug?
+
+Thu Jul 18 14:47:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: fix IsArrayImpl.
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * String.cs: make ToLower (culture) and ToUpper (culture) use the
+ default ToLower and ToUpper and don't throw NotImplemented.
+
+Sat Jul 13 15:09:01 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: make GettTypeCode an icall. Test implementation of
+ GetMember().
+
+2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AppDomainSetup.cs: implemented LoaderOptimization.
+
+2002-07-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Activator.cs: some more intermediate results checking in
+ in CreateInstance and CreateInstanceFrom and use GetConstructor and
+ Invoke only with Type [] until the other overloaded versions work.
+
+2002-07-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Activator.cs: reformatted. Implemented CreateInstance* methods
+ that return ObjectHandle.
+
+ * AppDomain.cs: implemented CreateInstance*AndUnwrap methods.
+
+2002-07-03 Nick Drochak <ndrochak@gol.com>
+
+ * Decimal.cs (Divide): Short cut the case where the dividend is 0 (and
+ the divisor is not) and avoid the icall, which seems to have a bug.
+
+2002-07-03 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs (CompareTo): Correctly handle the case where the instance
+ is NaN. Also return 0 if the values are equal.
+
+2002/07/03 Nick Drochak <ndrochak@gol.com>
+
+ * MissingMethodException: Add missing Message property
+ * MissingMemberException: Add missing Message property
+
+2002-06-30 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs (CompareTo): Just see which is bigger. Don't use the
+ subtraction trick, it doesn't work when the values have a diference of
+ less than one.
+
+ * Single.cs (CompareTo): same
+
+2002-06-27 Martin Baulig <martin@gnome.org>
+
+ * UIntPtr.cs (UIntPtr.Zero): Use an explicit `u' suffix in the
+ constructor argument. [FIXME: The implicit conversion to an
+ unsigned integer doesn't work with mcs.]
+
+2002-06-26 Martin Baulig <martin@gnome.org>
+
+ * DecimalFormatter.cs: Removed MSTEST stuff, use `System',
+ not `S = System'. This file now compiles with mcs.
+
+ * String.cs: Removed the already ifdef-outed __arglist Concat function
+ to make it compile with mcs.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IntegerFormatter.cs:
+ (FormatParse.FormatNumber): fixed custom format for negative numbers.
+
+2002-06-21 Martin Baulig <martin@gnome.org>
+
+ * Double.cs: Replace the private `enum State' with constants since this
+ will avoid some bigger headaches in mcs.
+
+Thu Jun 20 17:51:44 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TimeSpan.cs: do not pollute the namespace with the
+ System.Parser name.
+
+2002-06-18 Nick Drochak <ndrochak@gol.com>
+
+ * ArgumentException.cs: Use the message given in the constructor when
+ accessing the Message property. Thanks to Dietmar for the help with
+ "base".
+
+2002-06-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * MonoType.cs: GetField is now a InternalCall
+
+2002-06-13 Nick Drochak <ndrochak@gol.com>
+
+ * DateTime.cs: (Parse): Accept dates that have no hour,min,sec. in the
+ sortable format(s), e.g. "2002-02-25"
+
+2002/06/12 Nick Drochak <ndrochak@gol.com>
+
+ * Random.cs (Next): Fix math error. Return a number within the range.
+
+2002-06-12 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (IndexOf): Return -1 if start index is equal to string
+ length.
+
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ToDouble): Remove rounding in ToDouble (float).
+ (ToType): Added null field in conversionTable to avoid
+ IndexOutOfRangeException. Changed what exceptions we throw to match
+ the spec.
+
+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * Int64.cs (Parse): Added unique strings to the messages where we throw
+ a FormatException. Needed these to debug, so just left them in since
+ they might be useful later. Fixed Currency parsing where we weren't
+ looking at CurrencyDecimalSeparator, etc.
+
+2002-06-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * DateTime.cs: fixes to pass tests M0 to M6:
+ if yy pattern then year values >= 30 are in 20th century
+ rfc1123 pattern is always in GMT, therefor useutc must be false
+ made GetNow() internal static so it can be called from TimeZone.
+ * TimeZone.cs: removed dependency on year 2002 from initialization of
+ current timezone.
+
+2002-06-09 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ToType): Rearranged what Exceptions we throw to
+ match MS behavior.
+
+2002-06-08 Duncan Mak <duncan@ximian.com>
+
+ * Decimal.cs: Added support for the IConvertible interface.
+
+2002-06-08 Martin Baulig <martin@gnome.org>
+
+ * Enum.cs (IsDefined): `value' may be of the enum's type itself, it
+ doesn't necessarily need to be of the enum's underlying type.
+
+2002/06/07 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs: Add [Serializable] to class
+ * SByte.cs (Parse): Add [CLSCompliant(false)] to all the overloads
+
+2002-06-04 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs (Parse): Recognize the group separator string, but still we
+ don't check the format for the proper number of digits between
+ separators. Also throw OverflowException when we get Pos or Neg
+ Infinity from runtime.
+
+2002-06-03 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ToDouble): Fixed ToDouble (byte value).
+
+Mon Jun 3 12:18:18 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: fixed GetTypeCode.
+
+2002-06-02 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ToInt16): use Convert.ToInt16 (int) instead of a direct
+ cast from an int so that we throw OverFlowException correctly.
+
+ (ToInt64): Use a new 64bit version of ConvertToBase.
+
+ (ConvertToBase): Add checks for overflow (checks Int32.MinValue
+ and Int32.MaxValue).
+
+ (ConvertFromBase64): New 64-bit version of ConvertFromBase.
+
+2002-06-02 Nick Drochak <ndrochak@gol.com>
+
+ * Convert.cs (ToSByte): Check for special value.
+ * Single.cs (Parse):
+ * UInt16.cs (Parse):
+ * UInt32.cs (Parse): Throw OverflowException if negative
+
+2002-06-02 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (DBNull): Point it to DBNull.Value.
+ (IsDBNull): Instead of checking typecodes, just check to see if
+ it's the same as the DBNull field.
+
+2002-06-02 Nick Drochak <ndrochak@gol.com>
+
+ * Convert.cs (ConvertFromBase): Detect bad digits correctly.
+
+2002-06-02 Duncan Mak <duncan@ximian.com>
+
+ * Char.cs (Parse): Simplify the Exception handling.
+
+ * Convert.cs (ToDecimal): Remove call to Math.Round () when
+ converting from a float.
+
+2002-05-30 Martin Baulig <martin@gnome.org>
+
+ * MonoType.cs (GetInterface): Implemented.
+
+Thu May 23 17:17:28 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Activator.cs: implemented CreateInstance ().
+
+2002-05-22 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ConvertToBase): Added new 64bit version.
+ (BuildConvertedString64): New 64bit version of
+ BuildConvertedString.
+
+ This fixes bug 25068.
+
+ (ConvertFromBase): Added additional test for checking if the
+ digits are valid. Thanks to Miguel for coming up with this test.
+
+ This fixes bug 25071.
+
+2002-05-21 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ToType): Rearranged to fit the new layout of
+ conversionTable.
+
+ (conversionTable): Rearranged to fit the layout of the
+ System.TypeCode enum.
+
+ This should fix bug 25075.
+
+2002-05-21 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs (ToString): Fixed the ToString methods. Previously I had
+ mixed up the two code paths, one for converting to a specific base
+ (this case), another from converting from a foreign base to base10
+ (used by ToInt16|32|64 (string, int)). This fixes bug 25068.
+
+ * Convert.cs (ToByte)
+ (ToSByte): Fixed bug 25074. Added more bits to ConvertFromBase so
+ that we won't confuse FormatException with OverflowException.
+
+2002-05-22 Lawrence Pit <loz@cable.a2000.nl>
+
+ * Environment.cs: CommandLine missed spaces between arguments.
+ Implemented StackTrace. Returning MachineName in UserDomainName
+ instead of null.
+
+Tue May 21 17:25:49 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: handle inherit argument.
+
+2002-05-21 Nick Drochak <ndrochak@gol.com>
+
+ * Math.cs (Pow): Change icall method name and insert parameter
+ checks in for infinities and NaN.
+
+2002-05-13 Miguel de Icaza <miguel@ximian.com>
+
+ * Double.cs (Parse): Reimplement by cleaning up the string first,
+ and then passing to strtof in the mono runtime.
+
+ * Single.cs (Parse): Use the Double implementation and cast to
+ float.
+
+2002-05-21 Nick Drochak <ndrochak@gol.com>
+
+ * Math.cs
+ (Ceiling): Check for "special" values
+ (Floor): Check for "special" values
+ (Round): Fix off-by-one error on decimal shifting
+
+2002-05-20 Lawrence Pit <loz@cable.a2000.nl>
+
+ * DateTime.cs: ToString () using "G" format specifier
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * Convert.cs (FromBase64CharArray): Do correct exception handling.
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * Convert.cs (FromBase64CharArray): Convert the char array using
+ System.Text.UTF8Encoding, not UnicodeEncoding (which is UTF-16) to
+ a byte array.
+
+2002-05-17 Miguel de Icaza <miguel@ximian.com>
+
+ * MonoType.cs: Style changes.
+
+ * Type.cs: Style changes.
+
+2002-05-16 Piers Haken <piersh@friksit.com
+
+ * UInt64.cs: fix declaration of IConvertible.To* overrides.
+
+2002-05-16 Nick Drochak <ndrochak@gol.com>
+
+ * BitConverter.cs (ToString): Add parameter check for invalid start
+ index.
+
+ * Console.cs: Use AutoFlush on the StreamWriter for stdin and stdout
+ now that StreamWriter uses buffering
+
+2002-05-14 Miguel de Icaza <miguel@ximian.com>
+
+ * Double.cs: Oops. Also handle exponents without finding a dot.
+
+2002-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog: removed empty entry at the top of the file.
+
+ * Int32.cs: made static functions used by Parse internal.
+
+ * Int64.cs:
+ * UInt32.cs:
+ * UInt64.cs: removed static fucntions used by Parse and use the ones
+ in Int32.cs
+
+2002-05-12 Daniel Morgan <danmorg@sc.rr.com>
+
+ * IServiceProvider.cs: added using System
+
+2002-05-09 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Single.cs: copied ToString() and Parse() methods from
+ Double to Single and modified a tiny bit for Single.
+ There is still a FIXME for Double and Single about
+ passing the format and provider info to the icall too.
+
+2002-05-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * Int64.cs:
+ * UInt32.cs:
+ * UInt64.cs (Parse): don't use Char.IsNumber to test for hex digits.
+ Don't use a delegate to test for valid digits.
+
+2002-05-01 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs:
+ * Math.cs: Added missing CLSCompliant attributes where necessary.
+
+2002-04-30 Duncan Mak <duncan@ximian.com>
+
+ * ArgumentException.cs (Message):
+ * ArgumentOutOfRangeException.cs (Message): Added.
+
+2002-04-30 Nick Drochak <ndrochak@gol.com>
+
+ * MonoType.cs: Remove unused variable and eliminate a compiler warning.
+
+Mon Apr 29 15:32:02 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Environment.cs: support for Exit(), CommandLine, CommandLineArgs ().
+
+2002-04-28 Duncan Mak <duncan@ximian.com>
+
+ * DivideByZeroException.cs: Added missing serialization constructor.
+
+ * UnauthorizedAccessException.cs: Added the missing Serializable attribute.
+
+2002-04-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Math.cs: fix Floor () and Round (). Closes #23960.
+
+2002-04-27 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs (IList.Contains): Should throw a RankException if this is
+ called on a Rank > 1 array. Not in the docs, but this is what the
+ MS.NET does.
+
+2002-04-26 Duncan Mak <duncan@ximian.com>
+
+ * MissingMemberException.cs: Made the message variable 'protected'
+ instead of 'private', so that we can see it in
+ MissingMethodException and MissingFieldException.
+
+ * MissingFieldException.cs:
+ * MissingMethodException.cs: Added missing (string, string)
+ constructor, and also the Message property.
+
+2002-04-26 Martin Baulig <martin@gnome.org>
+
+ * Enum.cs: Implemented the IConvertible methods.
+
+2002-04-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SByte.cs: little change in Parse (string) to avoid incorrect
+ OverflowException thrown (reported by nickd).
+
+2002-04-22 Miguel de Icaza <miguel@ximian.com>
+
+ * ValueType.cs: Add Serializable attribute.
+
+ * String.cs: ifdef-out out the __arglist Concat function until I
+ add support for that to mcs.
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * AppDomain.cs (GetValue): usage of the correct icall (bug)
+
+Wed Apr 24 21:15:44 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * GC.cs: implement most of the methods as icalls.
+
+2002-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DecimalFormatter.cs (ToString): return correct value when the
+ decimal number is 0.
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * Type.cs (GetProperty): fixed call syntax (needs an empty array not null)
+ * MonoType.cs (GetPropertyImpl) : basic implementation (ignores types, bindingAttr, modifiers)
+
+2002-04-24 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs (Parse): Handle case where there are no digits before the
+ decimal point, such as ".1".
+
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * UInt32.cs:
+ * Int64.cs:
+ * UInt64.cs: fixed bug #23738 (hex numbers parsed wrong).
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * String.cs (Split): fixed invalid split of count 0 and 1.
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * String.cs (LastIndexOf): fixed argument checking.
+ * String.cs (Equals): made internal for performace.
+
+2002-04-23 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (Join): check argument and throw exception if needed
+
+2002-04-23 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (StartsWith): check argument and throw exception if needed
+
+2002-04-22 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (IndexOfAny): check arguments and throw exceptions as
+ neccessary. ALso remove some debug WriteLines.
+
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * String.cs: use internal constructors
+ buf fix in Concat.
+
+Thu Apr 18 17:16:15 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: make GetElementType its own icall.
+
+2002-04-18 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs: Modified file. Re-add methods needed by the unit tests.
+
+Thu Apr 18 12:38:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: some code speedups and restored GetTypeCode().
+
+2002-04-17 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * String.cs: New implementation using internal calls.
+
+2002-04-16 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalFormatter.cs: Trim off excess null characters from the string
+ that decimal2string gives back.
+
+2002-04-16 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (SubString): revert my change. I can't reproduce the
+ problem anymore.
+
+2002-04-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Attribute.cs: added GetHashCode and Equals.
+
+2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Enum.cs: little improvements to Format ().
+
+Thu Apr 11 12:28:13 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: internalcall GetHashCode().
+ * Array.cS: optimize access to elements.
+
+Wed Apr 10 21:20:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: make IndexOfAny() use an internalcall.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * UInt32.cs:
+ * Int64.cs:
+ * UInt64.cs: fixed error when testing for validity of flags.
+
+2002-04-11 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs: Use an internal call for ToString(). This is just a simple
+ implementation to get away from throwing a NotImplementedException.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * UInt32.cs:
+ * Int64.cs:
+ * UInt64.cs: changed Type.GetType () by typeof (), as suggested by
+ lupus.
+
+ * Int32.cs:
+ * Int64.cs: throw an OverFlowException when parsing a string
+ containing a dot followed by any non '0' number.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Byte.cs:
+ * UInt16.cs:
+ * UInt32.cs:
+ * UInt64.cs: added complex Parse ().
+
+2002-04-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SByte.cs:
+ * Int16.cs:
+ * Int32.cs:
+ * Int64.cs: added complex Parse ().
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs (BinarySearch): Add checks on paramters before using them
+ and throw exceptions as needed.
+
+ * Enum.cs (Format): Check if [Flags] is applied to enum and convert
+ "G" format to "F" if so.
+
+Tue Apr 9 13:12:09 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: return arrays of type Attribute[]
+ instead of object[].
+
+2002/04/09 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (Substring): Copy only non-null characters to the new
+ string.
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatter.cs: Don't use a format character to indicate a
+ custom format was passed in. It was using 'z' to indicate a custom
+ format, but really it should throw a format exception if the user
+ tries to use "z" as the format string. Now it does.
+
+ * Activator.cs: New File.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (ToString): Big ugly fix for the case where [Flags] is
+ applied to an enum. Need to handle the different possible integer
+ types of an enum somehow. Can anyone say generics?
+
+Mon Apr 8 06:22:42 2002 Piers Haken <piersh@friskit.com>
+
+ * Convert.cs: switched the To*(object) methods to use
+ IConvertible directly instead of calling ChangeType
+
+Sat Apr 6 20:08:41 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ValueType.cs: make Equals() an internalcall.
+
+Fri Apr 5 15:38:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: also look for nested types in FindMembers.
+ * MonoType.cs: make GetNestedTypes() an internalcall.
+
+2002-04-05 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Parse): Handle different underlying types.
+
+2002/04/04 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (IsDefined): Throw exception when type of value to look for
+ is not the correct one. Attempt to have it work with string values
+ too, but not sure if the unit tests are getting that far yet.
+
+2002-04-04 Nick Drochak <ndrochak@gol.com>
+
+ * Decimal.cs: Fix a couple of typos.
+
+Wed Apr 3 19:46:00 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Enum.cs: the values array is of the enum and not of the underlying
+ type. Updates and some bug fixes.
+ * MonoType.cs: make the internalcall return FullName instead of the
+ assembly qualified name.
+ * Type.cs: make ToString () simply return FullName.
+
+2002-04-03 Nick Drochak <ndrochak@gol.com>
+
+ * Type.cs (GetTypeCode): provide some of the implementation for this
+ method. It's still too simplistic to be considered complete.
+
+2002-04-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * Object.cs: fixed FieldGetter/FieldSetter signature
+
+2002-04-02 Nick Drochak <ndrochak@gol.com>
+
+ * Environment.cs: add MonoTODO's on parts that should have it.
+
+2002-04-01 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs: added reality checks (check parameters to most methods that
+ need them).
+
+2002-03-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * Object.cs: added FieldGetter/FieldSetter
+
+2002-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IntegerFormatter.cs: fixed initialization error in static
+ constructor.
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * Delegate.cs: added new field to store a trampoline function
+
+2002-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IntegerFormatter.cs: added workaround for bug #22668. First patch to
+ make custom format strings work (not fully functional yet).
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatter.cs: Change class from internal to public. Add
+ necessary [CLSCompliant(false)] attributes.
+
+2002-03-27 Duco Fijma <duco@lorentz.xs4all.nl>
+ * _AppDomain.cs, AppDomain.cs: renamed method GetDate to GetData
+ (was a typo)
+
+2002-03-28 Nick Drochak <ndrochak@gol.com>
+
+ * Type.cs: Added MonoTODO tags on members that have FIXME, etc.
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Console.cs: Modified to get std handles from MonoIO.
+ * Environment.cs: removed PAL dependencies.
+
+2002-03-25 Miguel de Icaza <miguel@ximian.com>
+
+ * String.cs (System): Removed internal enumeration, because
+ bootstrapping the corlib at this point does not support
+ enumerations.
+
+ * IntPtr.cs: Temporary work-around until I fix the assembly
+ attributes bug.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * Enum.cs (GetValues): According to the docu this is sorted after
+ values, not names.
+
+ * String.cs (System): Removed enumeration, because it is pretty
+ hard to support enumerations in /nostdlib mode for the core types.
+
+Tue Mar 19 18:18:49 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: move error handling in the catch block.
+ * MulticastDelegate.cs: remove == and != operators that were
+ removed with the delegate changes (when you add stuff, please do not
+ remove existing functionality!).
+ * Type.cs: if a property is not found in a type, search for it
+ in the parent types, too.
+
+2002-03-18 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Math.cs: changed to use icall instead of PAL.
+
+2002-03-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * Double.cs: added check for NaN (Bug [22082])
+
+2002-03-19 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Equals): check for null and throw if it is.
+ * Enum.cs (Format): check for null parameters and throw if necessary.
+ This method still needs more argument checking.
+
+2002-03-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * Enum.cs (Equals): check if Enums are of the same type
+
+2002-03-18 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs: Explicitly handle comparisons in CompareTo() for
+ Positive/Negative Infinity and NaN. Unit Test now passes on Linux.
+
+ * Enum.cs(CompareTo): Check types of values before trying to compare.
+ Throw exceptions if types are invalid or don't match.
+
+2002-03-14 Miguel de Icaza <miguel@ximian.com>
+
+ * Array.cs: Add some extra debugging information.
+
+2002-03-15 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs: Added IList and IEnumerable.
+
+2002-03-14 Miguel de Icaza <miguel@ximian.com>
+
+ * UInt64.cs, UInt32.cs, UInt16.cs: Mark public parse methods as
+ NonCLSCompliant.
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * Delegate.cs (Equals): also compare method_ptr
+ (GetHashCode): returm method_ptr as hash
+
+2002-03-13 Duco Fijma <duco@lorentz.xs4all.n>
+ * TimeSpan.cs: removed the use of Custom Numeric Format Strings,
+ such as 42.ToString("0000000"), as these are (currently) not implemented
+ in System.IntegerFormatter. TimeSpan luckely can do with Standard
+ Numeric Format Strings, such as 42.ToString("D7").
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * FieldAccessException.cs:
+ * MethodAccessException.cs:
+ * PlatformNotSupportedException.cs: Inherit from
+ MemberAccessException, not SystemException.
+
+ * ObsoleteAttribute.cs: Made Message and IsError properties
+ instead of fields.
+
+Tue Mar 12 19:21:18 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * GC.cs: make SuppressFinalize() a nop.
+ * Delegate.cs: fix == operator.
+
+2002-03-13 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs: Add IConvertible methods. Cyclic dependancy fixed in the
+ runtime that goes with this patch.
+
+2002-03-10 Martin Baulig <martin@gnome.org>
+
+ * Int32.cs (Parse): Correctly parse negative numbers.
+
+2002-03-08 Martin Baulig <martin@gnome.org>
+
+ * String.cs (Split): Really fix it this time. Also adding several new
+ testcase to the testsuite.
+
+2002-03-08 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Optimized: removed duplicate null check, removed
+ two duplicate GetLowerBound() calls and one duplicate IsValueType.
+
+Fri Mar 8 18:49:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Object.cs: commit my hacked GetHashCode(): it's good enough for now.
+ * String.cs: use the dumb code for IndexOf(string): this is worth
+ 15-20 % speedup in mcs compile with mint.
+
+Fri Mar 8 12:45:44 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: revert change to Split() that broke the compiler (hi martin!:-).
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * String.cs (Join): Throw an ArgumentNullException.
+ (LastIndexOf (string,int,int)): This method does a backwards search,
+ so startIndex points to the end of value, not to its beginning. Don't
+ throw an exception if startIndex equals this.Length. Always return -1
+ if startIndex is smaller than the length of value.
+ (Replace (string,string)): Replace all occurences of oldValue.
+ If newValue is null, all occurences of oldValue are to be removed.
+ (Split (char[],int)): Return an empty array if maxCount is zero, throw
+ an ArgumentOutOfRangeException if it's less than zero. Return maxValue
+ elements, not maxValue+1.
+
+Thu Mar 7 17:16:06 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: make GetEvents() an internal call.
+ * MulticastDelegate.cs: copy the passed in array.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Use FastCopy when appropriate and do correct
+ exception handling.
+
+2002-03-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * CharEnumerator.cs: fixes to CharEnumertor.MoveNext, fixing
+ some of the failures found be new tests (see ChangeLog in
+ Test/System). Comments added to this method, based on
+ the representation invariant of this class, that (try to) explain
+ why it now should be correct.
+
+2002-03-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * Int64.cs (Parse): bug fix for max. negative value.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * RuntimeTypeHandle.cs: Add Serializable attribute as the docs say.
+ I need to understand what the difference between the attribute and
+ the interface is.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Always throw an ArrayTypeMismatchException, not
+ an InvalidCastException if the widening conversion failed. See
+ testcases #M94-#M96.
+
+ * Array.cs (CopyTo): Bug fix from Ajay Dwivedi, correctly handle
+ arrays with non-zero lower bounds. Also adding testcases #F10-#F13
+ for this.
+
+ * Array.cs (CopyTo): Reverted my last change, it was incorrect.
+ (Copy): Actually allow copying multi-dimensional arrays.
+
+2002-03-05 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs:
+ (DBNull) Added the missing field.
+ (IsDBNull) Fixed typo.
+ (ToByte (string, int)) Implemented.
+ (ToString (byte, int)) Implemented.
+ (ConvertToBase)
+ (BuildConvertedString) internal functions used for converting values to
+ a specific base.
+
+ * Int16.cs:
+ * Int32.cs:
+ * Int64.cs:
+ * Single.cs:
+ * UInt16.cs:
+ * UInt32.cs: Implemented the IConvertible interface.
+
+ * CharEnumerator.cs: Renamed to variables to be clearer and
+ changed some of the tests to conform to the 1.0 spec.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Calculate absolute array position here and use
+ GetValueImpl() and SetValueImpl() with that position. We can now
+ copy multi-dimensional arrays.
+ (CopyTo): Small bug fix.
+
+2002-03-05 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * Version.cs: CompareTo changed according the LAMESPEC discovered by
+ Nick (See VersionTest.cs).
+ * CharEnumerator.cs: fixed two bugs in MoveNext. It had an off-by-one
+ error comparing the current position (idx) against the length of the
+ string iterated and it set idx to an unrecognized special value (-2)
+
+Tue Mar 5 17:34:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * SByte.cs, UInt64.cs: implement IConvertible interface. Nobody wants
+ to do this dirty work, but someone has to do it (and I need it to pass
+ the "200 sample tests compiled on linux" mark).
+
+2002-03-06 Nick Drochak <ndrochak@gol.com>
+
+ * Attribute.cs
+ * DecimalFormatter.cs
+ * Delegate.cs
+ * Double.cs
+ * GC.cs
+ * Int16.cs
+ * Int32.cs
+ * MonoType.cs
+ * RuntimeMethodHandle.cs
+ * RuntimeTypeHandle.cs
+ * String.cs
+ * Type.cs:
+ Add [MonoTODO]'s to places where we currently throw a
+ NotImplementedException.
+
+2002-03-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * Int16.cs (Parse): do not overflow on max negative value
+
+ * Int32.cs (Parse): do not overflow on max negative value
+
+Mon Mar 4 20:36:05 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: fixed IsClass.
+ * MonoType.cs: fixed MemberType, IsPrimitiveImpl, IsPointerImpl,
+ IsByRefImpl. Added GetInterfaces().
+ * IServiceProvider.cs: compilation fix.
+
+Mon Mar 4 18:37:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: allow copying an empty array to an empty array.
+
+Mon Mar 4 17:59:16 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fixed LastIndexOf (string) to do a bit of argument
+ checking.
+
+2002-03-04 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Version.cs: many fixes to failures found by the newly created
+ test cases for this class. Specifically, the CompareTo member
+ returned wrong values due to the use of Int32.MaxValue as a special
+ value indicating an "undefined" version component. Also implemented the
+ missing operators (==, <, >, etc.), one missing constructor and
+ and some exception throwing.
+
+2002-03-04 Nick Drochak <ndrochak@gol.com>
+
+ * IServiceProvider.cs: Add missing attribute: ComVisible(false)
+ * Attribute.cs: Add missing attributes: Serializable and
+ AttributeUsage(AttributeTargets.All)
+
+Mon Mar 4 11:26:49 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: implemented GetConstructors(), GetFields(),
+ GetMethods(), GetProperties().
+ * Object.cs: added debugging icall obj_address().
+ * Type.cs: fixed the binding flags for some Get* methods.
+ Implemented FindMembers() as calls to the specific GetMember
+ methods.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+ * BitConverter.cs: fixed one little bug: ToString(s, n, 0)
+ should give an exception for n>=s.Length.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * Array.cs: More argument checking and bug fixing.
+
+2002-03-01 Miguel de Icaza <miguel@ximian.com>
+
+ * BitConverter.cs: Indentation match
+
+ * AppDomain.cs: Added MonoTODOs to this too.
+
+ * Buffer.cs: Added MonoTODOs to this.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * Array.cs: Added argument checking to all methods where it was missing.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * BitConverter.cs: Fixed bugs in ToString methods
+
+Fri Mar 1 15:20:00 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MulticastDelegate.cs: implement operators so mcs3 can be used on linux.
+
+2002-03-01 Nick Drochak <ndrochak@gol.com>
+
+ * BitConverter.cs: Throw ArgumentException like mscorlib, instead of
+ ArgumentOutOfRangeException like the docs say.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * Enum.cs (CompareTo): Correctly override this method from IComparable.
+
+ * Console.cs (setIn, setOut, setError): It's called SetIn, SetOut, SetError.
+
+2002-02-28 Martin Baulig <martin@gnome.org>
+
+ * String.cs: This file now passes the testsuite on Linux :-)
+
+ * String.cs (Intern, IsInterned): The interncalls are now called _Intern and _IsInterned;
+ make them private and provide C# wrappers which do proper argument checking.
+
+ * String.cs (Format): Correctly handle escaped brackets.
+
+ * String.cs (_CompareChar): New internal function which compares two chars.
+ (_Compare): Provide an internal compare method which can do all sorts of
+ comparision and call it from all the Compare() methods. Also fixed a lot of
+ bugs here, this code now actually passes the testsuite.
+
+2002-02-28 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Added the missing methods. The new class status page
+ kicks ass, it even found my typos! Woohoo!
+ (ConvertFromBase): Moved the Exception throwing in here and
+ removed the other occurances so it's all centralized now.
+ (ISDBNull): Implemented.
+ (GetTypeCode): Implemented.
+
+2002-02-27 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: Guid.ToString("") and Guid.ToString(null) is now understood as Guid.ToString("D")
+ just as in mscorlib. There is (probably) a documentation bug in the MS FrameWork SDK, which
+ states that a lacking format should be interpreted as "N".
+ Also added [Serializable] attribute
+ * TimeSpan.cs: some formatting and added the [Serializable] attribute
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * WeakReference.cs: Committed for Ajay Kumar Dwivedi.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * TimeZone.cs: Use an internal enum rather than magic numbers to access the
+ fields of the interncall GetTimeZoneData.
+
+ * DateTime.cs: Implemented Parse and fixed a few bugs.
+
+ * String.cs (TrimStart): Small fix.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTime.cs: ParseExact is now fully functional.
+
+ * String.cs (TrimEnd): Small fix.
+
+2002-02-26 Duco Fijma <duco@lorentz.xs4all.nl>
+ * TimeSpan.cs: Added method TimeSpan.FromMilliseconds, mysteriously
+ missing for about six months.
+
+Tue Feb 26 14:21:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * UInt64.cs: fixed Parse method () to handle some of the NumberStyle flags.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTime.cs: Miguel already committed this, but there was still a
+ ChangeLog entry for this missing ....
+ We're now reusing functionality from TimeSpan, printing dates is
+ fully implemented, currently working on parsing.
+
+ * TimeZone.cs: Fully implemented this. There's a new InternCall in the
+ runtime for this.
+
+Fri Feb 22 18:47:08 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: disable constructor.
+ * Object.cs: make GetType() an internalcall.
+ * Type.cs: added correct bindingflags to GetMethods ().
+ All such calls should be reviewed to use the correct flags.
+
+Thu Feb 21 19:23:46 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs, MonoType.cs: type_is_subtype_of () changed to include extra
+ argument.
+
+Thu Feb 21 16:56:51 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: implemented IsAssignableFrom.
+
+2002-02-21 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: fixed Guid.Guid(string) ctor. Changed format:
+ "{0xdddddddd,0xdddd,0xdddd,{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},{0xdd}}"
+ to "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}"
+ The former is documented by Microsoft. The latter is how they
+ actually implemented it in mscorlib:-)
+
+Tue Feb 19 20:34:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: hooks to get the custom attributes from the
+ runtime.
+ * MonoType.cs: Implemented custom attributes methods.
+
+
+2002-02-21 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs:
+
+Tue Feb 19 20:34:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: hooks to get the custom attributes from the
+ runtime.
+ * MonoType.cs: Implemented custom attributes methods.
+
+2002-02-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * Array.cs (CopyTo): use GetLength() instead of GetUpperBound()
+
+2002-02-19 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Finished up the missing methods in Convert. Added a
+ new private method ConvertFromBase.
+
+2002-02-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * String.cs: impl. IConvertible interface
+
+2002-02-18 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: actual implementation for Guid.Guid(string) Ctor
+
+2002-02-18 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Changed from using Type.GetType (string) to just
+ typeof (). Probably will speed things up a bit?
+
+2002-02-18 Ajay Kumar Dwivedi <AjayKumar.Dwivedi@dresdner-bank.com>
+
+ * Array.cs:
+ 1. Fix for GetUpperBound to return correct values
+ 2. made some Properties virtual
+ 3. Adds IsFixedSize and IsReadOnly properties.
+ 4. changes CreateInstance(Type,int[],int[]) to throw Exception
+ when third arg is null. InternalCall CreateInstance changed to
+ CreateInstanceImpl
+ 5. Fixed array.GetUpperBound at a couple of places
+ 6. IndexOf and LastIndexOf now use Object.Equals instead of "=="
+ 7. Added two FIXME's in BinarySearch functions.
+
+2002-02-17 Duncan Mak <duncan@ximian.com>
+
+ * TimeZone.cs: Applied the rest of Ajay's patch for
+ IsDaylightSavingTime. Thanks a lot for the nice explanation of how
+ it works!
+
+2002-02-17 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: added stub for Guid(string) ctor
+
+2002-02-17 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Near-complete implementation of Convert.cs
+
+ Added all the To* methods taking (object) and
+ (object, IFormatProvider) as parameters.
+
+ Added [CLSCompliant (false)] attributes to methods dealing with
+ unsigned types.
+
+ Added the missing section on converting to and from DateTime. Only
+ 6 missing methods, all marked with MonoTODOs. Will tackle them later.
+
+2002-02-16 Duncan Mak <duncan@ximian.com>
+
+ * TimeZone.cs: patch from Ajay Kumar Dwivedi (adwiv@yahoo.com) to
+ make IsDaylightSavingTime (DateTime) call
+ IsDaylightSavingTime (DateTime, DaylightTime).
+
+ Added internal class CurrentTimeZone from Ajay. It needs more work
+ to fill in the appropriate internal calls.
+
+Sat Feb 16 12:41:41 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: fix IsClass.
+
+Sat Feb 16 12:02:02 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix Trim().
+
+Fri Feb 15 21:02:46 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix more off by one errors.
+
+Thu Feb 14 18:54:09 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: fix IsValueTypeImpl.
+ * Type.cs: fix IsEnum. Implement Equals methods.
+
+Wed Feb 13 21:50:13 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Int32.cs: implement IConvertible interface.
+
+2002-02-12 Duncan Mak <duncan@ximian.com>
+
+ * TimeZone.cs: Implemented and added to CVS.
+
+2002-02-11 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Implemented the ChangeType () methods.
+
+Mon Feb 11 19:48:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: make Clone() an internal call.
+
+2002-02-09 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Changed Guid.NewGuid so that it can use both System.Random and
+ System.Security.Cryptography.RandomNumberGenerator
+
+2002-02-09 Duco Fijma <duco@lorentz.xs4all.nl>
+ * First version of Guid.NewGuid
+
+2002-02-08 Duncan Mak <duncan@ximian.com>
+
+ * RuntimeArgumentHandle.cs: Added to CVS.
+
+Fri Feb 8 19:14:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * CrossAppDomainDelegate.cs, AssemblyLoadEventHandler.cs,
+ UnhandledExceptionEventHandler.cs: added delegates.
+
+Fri Feb 8 18:06:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MarshalByRefObject.cs: add ToString () method
+ (apparently needed by nunit).
+ * _AppDomain.cs: uncomment ToString(): dietmar fixed the bug triggered
+ by it in the runtime.
+
+2002-02-08 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * String.cs (Format): implemented
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * DuplicateWaitObjectException:
+ * InvalidCastException:
+ * NotImplementedException:
+ * NotSupportedException:
+ * NullReferenceException:
+ * OutOfMemoryException:
+ * OverflowException:
+ * RankException:
+ * StackOverflowException.cs:
+ * UnauthorizedAccessException: Added missing constructor used for serialization.
+
+2002-02-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * String.cs (System.Compare): bug fix
+
+2002-02-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * Enum.cs (Parse, GetHashCode): impl.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * DBNull.cs: This is my first crack at the DBNull class. I think I
+ actually got most of the IConvertible methods right, but I haven't
+ done the research to test whether or not this is the correct
+ behavior. IConvertible.ToType () is the most iffy of all, IMHO.
+
+ * DllNotFoundException.cs: Inherits from TypeLoadException, not SystemException.
+
+2002-02-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * Enum.cs: added more functionality (GetName, ToObject, Equals)
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * InvalidOperationException.cs:
+ * NotFiniteNumberException.cs:
+ * ObjectDisposedException.cs:
+ * TypeInitializationException.cs: Added missing bits for serialization/
+
+ * AppDomainUnloadedException.cs:
+ * ApplicationException.cs:
+ * ArgumentOutOfRangeException.cs:
+ * ArithmeticException.cs:
+ * ArrayTypeMismatchException:
+ * BadImageFormatException.cs:
+ * Exception.cs:
+ * MissingMemberException.cs:
+ * TypeLoadException.cs: Added missing bits for serialization.
+
+2002-01-30 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: implemented everything but Guid.NewGuid
+
+Tue Jan 29 22:32:36 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * _AppDomain.cs: remove ToString() method: it doesn't seem right
+ to have it in this interface and it screws up the method vtable setup.
+
+2002-01-28 Andrei Zmievski <andrei@php.net>
+
+ * Double.cs: implemented IConvertible interface.
+
+2002-01-28 Miguel de Icaza <miguel@ximian.com>
+
+ * ArgumentException.cs: Implement serialization constructor.
+ (GetObjectData): Implement serializer.
+
+ * ArgumentNullException.cs: Implement serialization constructor.
+
+ * Exception.cs: Implement serialization constructor.
+ (GetObjectData): Implement serializer.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * DateTime.cs (UnixEpoch): The Begining of the Unix epoch.
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * EntryPointNotFoundException.cs:
+ * FormatException: Added missing constructor and related bits.
+
+ * TypeLoadException: Added missing constructor, methods and properties.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * AppDomain.cs (GetAssemblies): Use foreach construct instead of
+ manually getting the enumerator.
+
+ (AppDomain.AppDomain): Prime the loaded assemblies with the
+ assemblies loaded by the runtime in our behalf.
+
+ * AppDomainSetup.cs: Remove private keyword, that is the default.
+ Add a new property DisallowPublisherPolicy.
+
+ * AppDomain.cs (AppDomain.GetAssemblies): Implement.
+
+Tue Jan 22 22:51:48 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs, Type.cs: many updates, corrected implementation,
+ completed stubs.
+
+2002-01-20 Andrei Zmievski <andrei@php.net>
+
+ * Byte.cs:
+ * Char.cs: implemented IConvertible interface.
+
+ * Boolean.cs: use our own ToString() method directly.
+
+2002-01-20 Duncan Mak <duncan@ximian.com>
+
+ * Files I commited recently: Fixed indentation style.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * SerializableAttribute.cs: this attrib can be used on enums, structs,
+ and delegates too. Added the appropriate usage flags.
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * CharEnumerator.cs: Implemented.
+ * String.cs (System): Fixed the GetEnumerator () method(s).
+
+ * ObsoleteAttribute.cs:
+ * STAThreadAttribute.cs:
+ * MTAThreadAttribute.cs:
+ * ThreadStaticAttribute.cs:
+ * LoaderOptimizationAttribute.cs:
+ * PlatformNotSupportedException.cs:
+ * LoaderOptimization.cs: Added to CVS.
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * AppDomainUnloadedException.cs:
+ * MethodAccessException.cs:
+ * ContextMarshalException.cs:
+ * CannotUnloadAppDomainException.cs:
+ * DllNotFoundException.cs:
+ * EntryPointNotFoundException.cs:
+ * FieldAccessException.cs:
+ * TypeUnloadedException.cs:
+ * MissingFieldException.cs: Added to CVS.
+
+ * ApplicationException.cs:
+ * MemberAccessException.cs:
+ * MissingMemberException.cs
+ * MissingMethodException.cs:
+ * SystemException.cs: Added [Serializable] attribute.
+
+ * Exception.cs: Added [Serializable] attribute, made properties
+ 'Message', 'Source' and 'StackTrace' virtual methods, per 1.0
+ spec.
+
+ * ContextStaticAttribute.cs: Added [Serializable] attribute and
+ put in the missing constructor.
+
+ * Environment.cs: Commented out references to
+ EnvironmentPermissionAttribute, because they're just stubbed out
+ right now and has no implementation.
+
+2002-01-16 Andrei Zmievski <andrei@php.net>
+
+ * Boolean.cs: implemented IConvertible interface
+
+2002-01-15 Nick Drochak <ndrochak@gol.com>
+
+ * ResolveEventArgs.cs: class should derive from EventArgs.
+
+2002-01-14 Miguel de Icaza <miguel@ximian.com>
+
+ * String.cs (System): Use DefaultMemberName for the String class.
+
+Mon Jan 14 17:06:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: use IndexerName in index char accessor.
+
+Thu Jan 10 21:05:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: add rank to MonoTypeInfo and implement GetArrayRank.
+ * String.c: eliminate 64k+ method calls in search.
+ * Type.cs: handle byref and array types in ToString ().
+
+2002-01-09 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * Guid.cs: created first version
+
+2002-01-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * MonoType.cs: added missing TypeAttributes to MonoTypeInfo
+
+Wed Jan 9 19:35:07 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MulticastDelegate.cs: add == and != operator stubs.
+ * String.cs: check for null in == operator.
+ * Type.cs: use a virtual method to get TypeAttributes.
+
+Tue Jan 8 23:30:19 EST 2002 Matt Kimball <matt@kimball.net>
+ * String.cs: Fixed several off-by-one errors in LastIndexOf* methods
+
+2002-01-09 Nick Drochak <ndrochak@gol.com>
+
+ * Environment.cs: Comment out Security attribute and put a MonoTODO
+ there as a reminder. We need mcs magic to handle security attributes in
+ corlib.
+
+2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created IAppDomainSetup.cs
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created System._AppDomain interface in _AppDomain.cs
+
+2002-01-06 Nick Drochak <ndrochak@gol.com>
+
+ * ResolveEventArgs.cs: New File, completely implemented! ;)
+
+Sat Jan 5 15:53:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Enum.cs: dummy ToString impl.
+ * String.cs: dummy format implementations to get compiler errors
+ somewhat working.
+ * Type.cs: implemented filter delegates. FindMembers runs the filter, now.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * TODOAttribute.cs : Augment some more; provide two constructors
+ with support for a comment too.
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * Uncommented those MonoTODO's now that Ravi's got
+ the class in there
+
+2001-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * TODOAttribute.cs : Actually add this time ;-)
+
+ Change name to MonoTODO.
+
+2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (Trim): Fixed a few logic bugs in the code that
+ calculated how much to trim off the end of the string.
+
+2001-01-04 Nick Drochak <ndrochak@gol.com>
+
+ * Commented out the [TODO] attributes for now. We don't have the
+ class written. Also changed it to [MonoTODO]
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * TODOAttribute.cs : Add. We use this attribute to tag all bits in
+ our class libraries that are incomplete.
+
+ * Array.cs : Apply attribute wherever we find a FIXME which says
+ we need something to be implemented there.
+
+ * Int32.cs : Ditto.
+
+ * MulticastDelegate.cs : Ditto.
+
+ * RuntimeFieldHandler.cs, RuntimeMethodHandle.cs,
+ RuntimeTypeHandle.cs : Ditto.
+
+ * String.cs : Ditto.
+
+ * Type.cs : Ditto.
+
+ * Byte.cs, Char.cs, ContextBoundObject.cs, DateTime.cs, Delegate.cs : Ditto.
+
+ * Enum.cs, Environment.cs, Exception.cs, Int64.cs, SByte.cs, Single.cs,
+ UInt16.cs, UInt32.cs, ValueType.cs: Ditto.
+
+ * Byte.cs, Char.cs, ContextBoundObject.cs, DateTime.cs,
+ Delegate.cs : Ditto.
+
+ * Enum.cs, Environment.cs, Exception.cs, Int64.cs, SByte.cs,
+ Single.cs, UInt16.cs, UInt32.cs, ValueType.cs: Ditto.
+
+Thu Jan 3 23:24:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Delegate.cs: add Remove() stub.
+ * Enum.cs: add ToObject().
+ * Type.cs: add IsEnum property.
+
+2002-01-03 Kristian Rietveld <kris@gtk.org>
+
+ * Convert.cs: add non-CLS-compliant ToBoolean methods for char,
+ DateTime and object.
+
+2001-12-30 Nick Drochak <ndrochak@gol.com>
+
+ * Byte.cs (Parse): Add comments to aid in testing.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Char.cs (Parse): Implement.
+
+ * Byte.cs (Parse): Implement a fast parser.
+
+ * SByte.cs (Parse): Implement a fast parser.
+
+ * UInt16.cs (Parse): Implement a fast parser.
+
+ * Int16.cs (Parse): Implement a fast parser.
+
+ * UInt32.cs (Parse): Implement a fast parser.
+
+ * Int32.cs (Parse): Implement a fast parser.
+
+Fri Dec 21 15:14:52 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: fix null ref in sort code.
+ * UInt64.cs: add bare-bones parse.
+
+Thu Dec 20 15:29:52 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Byte.cs: removed use of Regexes.
+
+Tue Dec 18 18:39:54 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Enum.cs: implemented GetValues(), GetNames(), GetName(),
+ IsDefined(), GetUnderlyingType().
+ * String.cs: fix one instance of Compare().
+ * Type.cs: implemented GetProperties(), GetProperty().
+
+Thu Dec 13 20:10:57 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: implement CopyTo ().
+ * Char.cs: implement ToString ().
+ * Exception.cs: bugfix.
+ * Int32.cs: bare-bones Parse ().
+ * MonoType.cs: query the needed info with an internalcall.
+ * String.cs: speedups, bugfixes, reduced copies.
+ * Type.cs: added missing fields. Implemented many of the Is*
+ properties. Implemented GetMethod(), GetConstructor(), GetMethods(),
+ GetFields(), FindMembers(), ToString().
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * DateTime.cs: Implemented FromFileTime() and ToFileTime()
+
+ * Console.cs: Use handles rather than casting file descriptors
+
+2001-12-08 Nick Drochak <ndrochak@gol.com>
+
+ * Byte.cs (Parse): Start implementation. Parse(string) works, but
+ now we need to handle other formats
+
+2001-12-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * DateTime.cs: added an icall to GetNow()
+
+2001-12-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * Double.cs: added the parse method from Bob Smith
+
+2001-11-28 Miguel de Icaza <miguel@ximian.com>
+
+ * UInt64.cs: ditto.
+
+ * UInt32.cs: ditto.
+
+ * Int32.cs (Int32.CompareTo): Fix because we can not just
+ substract the values.
+
+ Return possitive value if the object is null.
+
+ * Boolean.cs: (Boolean.CompareTo): ditto.
+
+ * Int16.cs (Int16.CompareTo): ditto.
+
+ * Byte.cs (Byte.CompareTo): ditto.
+
+ * SByte.cs (SByte.CompareTo): ditto.
+
+ * Char.cs (Char.CompareTo): ditto.
+
+ * Decimal.cs (Decimal.CompareTo): ditto.
+
+ * Int64.cs (Int64.CompareTo): ditto.
+
+ * Single.cs: Ditto.
+
+ * UInt16.cs: Ditto.
+
+2001-11-28 Nick Drochak <ndrochak@gol.com>
+
+ * Byte.cs: Throw NotImplementedException for Parse.
+
+2001-11-27 Derek Holden <dholden@draper.com>
+
+ * IntegerFormatter.cs: Formatting of type "Number" was not
+ using NumberFormatInfo.NumberNegativePattern.
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * LocalDataStoreSlot.cs: No need to delete a system TLS slot in
+ the finalise routine any more
+
+2001-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ApplicationException.cs: internationalize by adding calls to
+ Locale.GetText (). And throw NotImplementedExceptions on calls
+ that we have to implement.
+
+ * Version.cs: Ditto.
+
+ * ValueType.cs: ditto.
+
+ * UnauthorizedAccessException.cs: ditto.
+
+ * UInt32.cs: ditto.
+
+ * UInt64.cs: ditto.
+
+ * UInt16.cs: ditto.
+
+ * TypeLoadException.cs: ditto
+
+ * TypeInitializationException.cs: ditto.
+
+ * Type.cs: ditto.
+
+ * TimeSpan.cs: ditto.
+
+ * SystemException.cs: ditto.
+
+ * String.cs: ditto.
+
+ * StackOverflowException.cs: ditto.x
+
+ * Single.cs: ditto.
+
+ * SByte.cs: ditto.
+
+ * RuntimeTypeHandle.cs: ditto.
+
+ * RuntimeMethodHandle.cs: ditto.
+
+ * RuntimeFieldHandle.cs: ditto.
+
+ * Random.cs: ditto.
+
+ * OutOfMemoryException.cs: ditto.
+
+ * OperatingSystem.cs: ditto.
+
+ * ObjectDisposedException.cs: ditto.
+
+ * NullReferenceException.cs: ditto.
+
+ * NotImplementedException.cs: ditto.
+
+ * NotFiniteNumberException.cs: ditto.o
+
+ * MulticastNotSupportedException.cs: ditto.
+
+ * MissingMethodException.cs: ditto.
+
+ * MemberAccessException.cs: ditto.
+
+ * Math.cs: ditto.
+
+ * InvalidCastException.cs: ditto.
+
+ * IntegerFormatter.cs: ditto.
+
+ * Int32.cs: ditto.
+
+ * Int16.cs: ditto.
+
+ * IndexOutOfRangeException.cs: ditto.
+
+ * Environment.cs: ditto
+
+ * Enum.cs: ditto.
+
+ * DuplicateWaitObjectException.cs: ditto.
+
+ * DivideByZeroException.cs: ditto.
+
+ * Delegate.cs: ditto
+
+ * DecimalFormatter.cs: ditto.
+
+ * Decimal.cs: ditto.
+
+ * DateTime.cs: ditto.
+
+ * Convert.cs: ditto.
+
+ * Char.cs: ditto.
+
+ * Byte.cs: ditto.
+
+ * Boolean.cs: ditto.
+
+ * ArrayTypeMismatchException.cs: ditto.
+
+ * ArithmeticException.cs: ditto.
+
+ * ArgumentOutOfRangeException.cs: ditto.
+
+ * ArgumentNullException.cs: ditto.
+
+ * Enum.cs: Make it derive from ValueType, add CompareTo method.
+
+ * Attribute.cs: Reformat.
+
+2001-11-14 Miguel de Icaza <miguel@ximian.com>
+
+ * Decimal.cs, Double.cs, Byte.cs, Char.cs, Int16, UInt16, Int32,
+ UInt32, Int64, UInt64, SByte, Single (CompareTo): Throw the
+ exception if the value is null too.
+
+ * Char.cs (CompareTo): ditto.
+
+ * ApplicationException.cs: Added constructor that does serialization.
+
+ * ParamArrayAttribute.cs: Define attribute correctly.
+
+Wed Nov 14 16:31:19 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AppDomain.cs: rename dummy interface _AppDomain to AppDomain_Intf.
+ * Array.cs: fix Array.Copy.
+ * AssemblyLoadEventArgs.cs: rename field.
+ * CLSCompliantAttribute.cs: use correct name for the class.
+ * Char.cs: fix IsLetter.
+ * Console.cs, DateTime.cs, Decimal.cs, IConvertible.cs, Math.cs,
+ SByte.cs, UInt16.cs, UInt32.cs, UInt64.cs, UIntPtr.cs: CLSCompliant updates.
+ * Convert.cs: CLSCompliant updates, add ChangeType() methods.
+ * Delegate.cs: renamed target field to m_target.
+ * Enum.cs: added missing methods.
+ * MonoType.cs: add a constructor and some needed properties.
+ * Object.cs: implement GetType().
+ * String.cs: CLSCompliant updates. Fixes everywhere to remove the
+ ending 0 char.
+ * Type.cs: add missing methods/properties.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * AttributeUseage.cs: Should define AttributeUsageAttribute.
+
+ * CLSCompliant.cs: Marked with AttributeUsage attribute.
+
+ * Decimal.cs: Fixed CLSCompliant attributes.
+
+ * Type.cs: changed _impl to internal (needs to be accessable by
+ subclasses).
+
+ (TypeHandle): Marked as abstract, implementation removed.
+
+ (IsNotPublic, IsPublic, GetMethods, GetPropery, GetConstructor,
+ GetMethod): Added stub implementations so NUnit would link against
+ corlib
+
+Tue Nov 6 09:11:43 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AppDomain.cs: use an internal constructor for AssemblyBuilder.
+
+2001-11-05 Miguel de Icaza <miguel@ximian.com>
+
+ * NonSerializedAttribute.cs: Add AttributeUsage rules for this
+ attribute.
+
+Fri Nov 2 18:23:15 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix a couple of bugs.
+ * AppDomain.cs: use new AppBuilder constructor.
+ * Buffer.cs, GC.cs, NonSerializedAttribute.cs,
+ NotImplementedException.cs, ObjectDisposedException.cs,
+ UnauthorizedAccessException.cs: add implementation.
+ * OverflowException.cs: fix class name.
+
+2001-10-28 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: Don't use a terminating nil char for our internal
+ array.
+
+2001-10-27 Miguel de Icaza <miguel@ximian.com>
+
+ * Delegate.cs (Delegate.CombineImpl): Implement.
+ (Delegate.Combine): Implement.
+
+ * MulticastDelegate.cs (MulticastDelegate.Equals): Implement.
+
+ (MulticastDelegate.CombineImpl): This was not as trivial as I
+ thought.
+
+ * ContextStaticAttribute.cs: Added AttributeUsage to
+ ContextStaticAttribute.
+
+ * FlagsAttribute.cs: Add AttributeUsage to FlagsAttribute
+
+2001-10-15 Martin Weindel <martin.weindel@t-online.de>
+
+ * added Decimal.cs * added DecimalFormatter.cs (internal class
+ used from System.Decimal)
+
+2001-10-11 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * Convert.cs: Added methods for Base64 transforming just used the
+ existing System.Security.Cryptography.ToBase64Transform, should
+ be changed to use a stand-alone class, e.g. Base64Encoder
+
+2001-10-10 Derek Holden <dholden@draper.com>
+
+ * IntegerFormatter.cs: Added. Implements ToString for all the
+ integer data types for all the format types.
+
+ * Byte.cs: Using IntegerFormatter for ToString's.
+
+ * SByte.cs: Using IntegerFormatter for ToString's.
+
+ * Int16.cs: Using IntegerFormatter for ToString's.
+
+ * Int32.cs: Using IntegerFormatter for ToString's.
+
+ * Int64.cs: Using IntegerFormatter for ToString's.
+
+ * UInt16.cs: Using IntegerFormatter for ToString's.
+
+ * UInt32.cs: Using IntegerFormatter for ToString's.
+
+ * UInt64.cs: Using IntegerFormatter for ToString's.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * Exception.cs: Implement bits of serialization.
+
+ * RuntimeFieldHandle.cs: Implement Serialization features.
+
+ * Type.cs: Implement TypeHandle property.
+
+2001-09-28 Dick Porter <dick@ximian.com>
+
+ * LocalDataStoreSlot.cs: Implemented
+
+Tue Sep 25 19:58:14 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix off-by-one error in Trim().
+
+Tue Sep 25 18:52:14 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: added GetType () method.
+
+Tue Sep 25 17:29:02 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MissingMethodException.cs, MissingMemberException.cs,
+ MemberAccessException.cs: added.
+
+Tue Sep 25 16:46:43 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: don't access the string array out of bounds in
+ LastIndexOf. * Type.cs: fix return type of the Assembly property.
+
+Mon Sep 24 20:35:24 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: make Intern and IsIntern internalcalls.
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * Type.cs: Added a stub for the IsValueType property.
+
+ * SystemException.cs (System): Added the other constructor, so
+ that System.Threading exceptions can inherit it.
+
+2001-09-08 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (TrimStart): Don't keep looping through the trimchars
+ once we've found a match.
+ (TrimEnd): Same here.
+ (Trim): And finally here.
+
+2001-09-07 Ravi Pratap <ravi@ximian.com>
+
+ * Char.cs (IsLetterOrDigit): Implement.
+ (IsLower): Implement, but we need to be Unicode aware.
+ (IsNumber): Implement.
+ (IsPunctuation): Implement.
+ (IsWhiteSpace): Implement.
+ (ToUpper): Fix to subtract 32 from the ASCII value, not 33 :)
+ (ToLower): Same here.
+
+2001-09-04 Miguel de Icaza <miguel@ximian.com>
+
+ * Object.cs: Shortcut, if (a == b) then return true.
+
+Fri Sep 7 18:34:48 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Delegate.cs: we need a pointer to the method thunk in
+ the delegate object.
+
+Fri Sep 7 12:28:01 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AsyncCallback.cs, common.src: add AsyncCallback delegate.
+
+2001-09-06 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (System): Don't mix uint and int.
+
+2001-09-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (BoyerMoore): Modified to not use pointers and to instead
+ use indexes.
+ (IndexOf): Use BoyerMoore.
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * All over: Use the autogenerated enumerations from the ECMA
+ documentation that Sergey wrote.
+
+ * PlatformID.cs: Add Unix definition.
+
+ * OperatingSystem.cs: Use Unix instead of Linux here.
+
+ * MarshalByRefObject.cs: Mark class as [Serializable].
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * Console.cs: impl. (write only)
+ implemented the stdin stuff
+
+ * Int32.cs: impl. real op_Equal
+
+2001-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * (common.src): Removed IAsyncResult as it is not on CVS yet.
+
+ * UIntPtr.cs: Removed CLSCompliant attribute before the namespace,
+ as it breaks the build.
+
+2001-08-23 Michael Lambert <michaellambert@email.com>
+
+ * IntPtr.cs: Optimized unsafe declaration, implemented GetObjectData,
+ added CLSCompliant attribute
+
+ * IAsyncResult.cs: Added
+
+ * common.src: Added IAsyncResult.cs
+
+2001-08-23 Michael Lambert <michaellambert@email.com>
+
+ * UIntPtr.cs: Added
+
+ * common.src: Added UIntPtr.cs
+
+2001-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * Attribute.cs: uncomment some code to make it compile again
+
+ * mono.src: removed duplicated Attribute.cs
+
+2001-08-16 Nick Drochak <ndrochak@gol.com>
+
+ * Attribute.cs: implemented all methods except GetHashCode()
+
+ * common.src: added Attribute.cs so it would compile in
+
+2001-08-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * Object.cs: changed MemberWiseClone to MemberwiseClone, and
+ marked it as InternalCall
+
+ * common.src: removed UriFormatException.cs because the file is
+ not there.
+
+ * RuntimeTypeHandle.cs: replaced IntrPtr with IntPtr
+ * Char.cs: replaced byte with char
+
+ * Array.cs: make it work with the mono interpreter
+
+2001-08-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Version.cs: Make the class sealed
+
+2001-08-08 Bob Smith <bob@thestuff.net>
+
+ * Random.cs: Many compile fixes.
+ * Random.cs: I read a bad spec. Class updated to match real spec.
+
+2001-08-06 Miguel de Icaza <miguel@ximian.com>
+
+ * IntPtr.cs: Added and Completed implementation.
+
+ * Uri.cs: Add a note.
+
+2001-08-06 Bob Smith <bob@thestuff.net>
+
+ * Random.cs: Compile fix. Needs more testing.
+
+2001-08-06 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * Uri.cs: Initial Implementation. Parsing needs to be fixed to take
+ into account IPv6 addresses, url encoding needs to be implemented, and
+ various minor methods need to be written, but this is a decent start.
+
+2001-08-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * common.src: added Object.cs
+
+ * mono.src: added ValueType.cs
+
+2001-08-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * Math.cs: replaced libc with libm
+
+2001-08-02 Bob Smith <bob@thestuff.net>
+
+ * Random.cs: Implemented. Needs testing.
+
+2001-08-02 Miguel de Icaza <miguel@ximian.com>
+
+ * IServiceProvider.cs, EventHandler.cs: New files.
+
+2001-08-02 Marcel Narings <marcel@narings.nl>
+
+ * DateTime.cs: Cleaned up a bit. Added the Add* family members.
+ Added exceptions. Added IConvertible. Still needs some platform
+ dependend stuff, the Parse and ToString members
+
+2001-08-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * Type.cs (GetTypeFromHandle): added placeholder
+
+2001-07-24 Derek Holden <dholden@draper.com>
+
+ * Boolean.cs: Formatted to code style standard. Added GetTypeCode
+ which is really an IConvertible defined method.
+
+ * Byte.cs: Added a missing Parse method. Put in Parse and ToString
+ behavior, still need to do the main Parse and ToString.
+
+ * Char.cs: Added a bunch of missing ECMA methods. Commented a
+ specification discrepency. Still didn't any unicode stuff, though
+ every IsFoo(char c) method has an IsFoo(string, index)
+ counterpart, added wrappers for those.
+
+ * Convert.cs: Fixed NaN/Inf checking and double/float
+ rounding. Added ToType for IConvertible classes
+
+ * Double.cs: Fixed ECMA min and max values. Added IsInfinity /
+ IsNaN methods. Changed Inf/NaN internals.
+
+ * IConvertible.cs: Added comments for using
+ Convert.ToType. Changed return values to draft base values.
+
+ * Int16.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * Int32.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * Int64.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * Single.cs: Put in ECMA epsilon value. Added IsInfinity / IsNaN
+ methods. Changed Inf/NaN internals.
+
+ * SByte.cs: Added a missing Parse method. Put in Parse and
+ ToString behavior, still need to do the main Parse and ToString.
+
+ * UInt16.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * UInt32.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * UInt64.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * MulticastDelegate.cs: New File.
+
+ * Delegate.cs: New file.
+
+ * Enum.cs: New file.
+
+ * Attribute.cs: New file.
+
+ * Type.cs: New file.
+
+ * ParamArrayAttribute.cs: New file.
+
+ * RuntimeTypeHandle.cs: New file.
+
+ * MulticastDelegate.cs: Added.
+
+ * DateTime.cs: Added
+
+ * Delegate.cs: Added
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * AttributeTargets.cs: Add.
+
+2001-07-19 Jeffrey Stedfast <fejj@ximian.com>
+
+ * Char.cs: Made ToUpper and ToLower public methods.
+
+ * String.cs: Lots and lots of compile fixes - just need to write
+ DateTime.cs and this should build completely now.
+
+2001-07-19 Bob Smith (bob@thestuff.net)
+
+ * Math.cs: Implemented.
+
+2001-07-19 Miguel de Icaza <miguel@ximian.com>
+
+ * String.cs: Removed tolower and toupper.
+
+ * Char.cs: Moved ToLower and ToUpper from string to here.
+
+ * Convert.cs ToByte (float value), ToByte (double value) Use IsNan
+ instead of comparing the value to Nan.
+
+2001-07-19 Duco Fijma (duco@lorentz.xs4all.nl)
+
+ * TimeSpan.cs: New implementation.
+
+2001-07-18 Scott Sanders <scott@stonecobra.com>
+
+ * UriFormatExcpetion.cs: Add - 85% complete
+
+2001-07-17 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (IndexOf): Slight optimization that allows skipping
+ over a few chars here and there. This isn't as good as using my
+ Boyer-Moore implementation, however, Boyer-Moore is only really
+ good for long strings (I plan on making the code decide which
+ string search algorithm it should use on-the-fly at some point).
+ (LastIndexOf): Fix to work correctly.
+ (BoyerMoore): Took out some unneeded code and fixed an edge-case.
+
+2001-07-16 Michael Lambert <michaellambert@email.com>
+
+ * EventArgs.cs: Add.
+
+2001-07-16 Miguel de Icaza <miguel@ximian.com>
+
+ * Version.cs: Remove my buggy comment.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * String.cs: Spelling error of IComparable, object's
+ MemberwiseClone cannot be overridden. Made indexer valid for now,
+ but not sure what to do about this in the long run. Seems to be a
+ couple bugs in csc.exe having to do with multiple pointer defs in
+ the same statement, and returning subclasses of a class in the
+ return type of an interface function implementation. Also moved
+ operators inside of class definition.
+
+2001-07-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: A tom of compile fixes, although we still don't compile.
+
+ * IConvertible.cs: The To*Int64() methods return *Int64's, not
+ *Int32's. Also, it's ToDateTime() not ToDateType().
+
+2001-07-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: Apparently I needed to at least write stubs for the
+ IConvertible interfaces. *sigh*
+
+2001-07-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: Many logic/other fixes and better usage of the
+ features of c#
+ (tolower): New convenience method to help condense code.
+ (toupper): Another new helper method.
+ (Compare): Use the new helper methods.
+ (ToLower): use tolower().
+ (ToUpper): use toupper().
+ (LastIndexOfAny): Implemented.
+ (BoyerMoore): New private helper method that implements a modified
+ version of the Boyer-Moore search algorithm. Noothing uses it yet
+ as I'm not 100% sure it even works properly with unicode strings
+ not to mention it uses a huge lookup-table :-)
+ (Split): Implemented.
+
+2001-07-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * TODO: Added things that need to be finished in System.String
+
+ * String.cs: New source file implementing the System.String class
+
+2001-07-12 Sean MacIsaac <macisaac@ximian.com>
+
+ * TypeCode.cs: UInt64 was UInt63.
+
+ * Object.cs: Fixed a numer of compiler errors.
+
+ * Array.cs: Fixed some compiler errors.
+
+ * IComparable.cs: Fixed some compiler errors.
+
+ * ICloneable.cs: Fixed some compiler errors.
+
+ * IConvertible.cs: Fixed some compiler errors.
+
+ * IFormattable.cs: Fixed a compiler error.
+
+ * IFormatProvider.cs: Fixed a compiler error.
+
+ * IDisposable.cs: Fixed a compiler error.
+
+ * IFormatProvider.cs: Added public accesability type to
+ IFormatProvider.
+
+ * Exception.cs: Added a using statement to remove compile time
+ error.
+
+ * ApplicationException.cs: Removed a ; that was causing a compiler
+ error.
+
+ * Int16.cs: Fixed some compiler errors.
+
+ * Int32.cs: Fixed some compiler errors.
+
+ * Int64.cs: Fixed some compiler errors.
+
+ * SystemException.cs: Fixed a compiler error.
+
+ * UInt16.cs: Fixed some compiler errors.
+
+ * UInt32.cs: Fixed some compiler errors.
+
+ * UInt64.cs: Fixed some compiler errors.
+
+ * Void.cs: Fixed a compiler error.
+
+2001-07-12 Joe Shaw <joe@ximian.com>
+
+ * Array.cs: Fix backwards parameters to Array.SetValue()
+ throughout.
+ (BinarySearch): Fix backward logic surrounding whether to call
+ value.CompareTo or comparer.Compare.
+ (LastIndexOf): Stop being stupid. I am so not used to strongly
+ bounded arrays...
+ (Sort): Implement a quicksort.
+
+2001-07-11 Joe Shaw <joe@ximian.com>
+
+ * Array.cs: Change all instances of trying to access an array with
+ the index operator to calls to GetValue and SetValue, and add
+ InternalGetValue and InternalSetValue which are internal calls
+ into the runtime. Ew.
+
+2001-07-10 Joe Shaw <joe@ximian.com>
+
+ * Array.cs: Implemented everything but Sort().
+
+2001-07-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * Object.cs (Object::Equals): Object variable name is `o'.
+
+2001-07-06 Joe Shaw <joe@ximian.com>
+
+ * Int16.cs, Int32.cs, Int64.cs, UInt16.cs, UInt32.cs, UInt64.cs:
+ Implement the IComparable and IFormattable interfaces. Fix a typo
+ (publig -> public)
+
+ * ApplicationException.cs, ArgumentException.cs,
+ ArgumentNullException.cs, ArgumentOutOfRangeException.cs,
+ ArtithmeticException.cs, ArrayTypeMismatchException.cs,
+ DivideByZeroException.cs, DuplicateWaitObjectException.cs,
+ ExecutionEngineException.cs, FormatException.cs,
+ IndexOutOfRangeException.cs, InvalidCastException.cs,
+ InvalidOperationException.cs, InvalidProgramException.cs,
+ MulticateNotSupportedException.cs, NotFiniteNumberException.cs,
+ NotSupportedException.cs, NullReferenceException.cs,
+ OutOfMemoryException.cs, OverflowException.cs, RankException.cs,
+ StackOverflowException.cs, SystemException.cs,
+ TypeInitializationException.cs: Added all of the exceptions
+ specified by the language spec. Mmmm... bloat.
+
+2001-07-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Int64.cs, Int32.cs: Put. Parsing and ToString missing. Should
+ do a generic routine all of these guys use.
+
+ * Int16.cs: identified missing methods.
+
+ * UInt16.cs, UInt32.cs, UInt64.cs: Add.
+
+2001-06-26 Miguel de Icaza <miguel@ximian.com>
+
+ * TypeCode.cs: Implement
+
+ * Void.cs: Implement.
+
+ * TODO: Add file to keep track of pending tasks.
+
+ * Object.cs, ValueType.cs: Implement.
diff --git a/mcs/class/corlib/System/Char.cs b/mcs/class/corlib/System/Char.cs
new file mode 100644
index 00000000000..826b97038ba
--- /dev/null
+++ b/mcs/class/corlib/System/Char.cs
@@ -0,0 +1,415 @@
+//
+// System.Char.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+// Note about the ToString()'s. ECMA says there's only a ToString() method,
+// BUT it is just a wrapper for ToString(null). However there is no other ToString
+// in the docs. Turning to the NET framework sdk reveals that there is a
+// ToString(formatprovider) method, as well as a 'static ToString (char c)' method,
+// which appears to just be a Convert.ToString(char c) type method. ECMA also
+// doesn't list this class as implementing IFormattable.
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public struct Char : IComparable, IConvertible {
+ public const char MaxValue = (char) 0xffff;
+ public const char MinValue = (char) 0;
+
+ internal char value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Char))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Char"));
+
+ char xv = (char) v;
+ if (value == xv)
+ return 0;
+
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Char))
+ return false;
+
+ return ((Char) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern double GetNumericValue (char c);
+
+ public static double GetNumericValue (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+
+ return GetNumericValue (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern UnicodeCategory GetUnicodeCategory (char c);
+
+ public static UnicodeCategory GetUnicodeCategory (string str, int index) {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText ("The value of index is less "+
+ "than zero, or greater than or equal to the length of str"));
+
+ return GetUnicodeCategory (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsControl (char c);
+
+ public static bool IsControl (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("Str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsControl (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsDigit (char c);
+
+ public static bool IsDigit (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("Str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsDigit (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsLetter (char c);
+
+ public static bool IsLetter (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsLetter (str[index]);
+ }
+
+ public static bool IsLetterOrDigit (char c)
+ {
+ if (IsLetter (c) == false && IsDigit (c) == false)
+ return false;
+ else
+ return true;
+ }
+
+ public static bool IsLetterOrDigit (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsLetterOrDigit (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsLower (char c);
+
+ public static bool IsLower (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsLower (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsNumber (char c);
+
+ public static bool IsNumber (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsNumber (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsPunctuation (char c);
+
+ public static bool IsPunctuation (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsPunctuation (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsSeparator (char c);
+
+ public static bool IsSeparator (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsSeparator (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsSurrogate (char c);
+
+ public static bool IsSurrogate (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsSurrogate (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsSymbol (char c);
+
+ public static bool IsSymbol (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsSymbol (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsUpper (char c);
+
+ public static bool IsUpper (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsUpper (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsWhiteSpace (char c);
+
+ public static bool IsWhiteSpace (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsWhiteSpace (str[index]);
+ }
+
+ public static char Parse (string str)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (str.Length != 1)
+ throw new FormatException ("string contains more than one character.");
+
+ return str [0];
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern char ToLower (char c);
+
+ [MonoTODO]
+ public static char ToLower(char c, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern char ToUpper (char c);
+
+ [MonoTODO]
+ public static char ToUpper(char c, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString ()
+ {
+ // LAMESPEC: ECMA draft lists this as returning ToString (null),
+ // However it doesn't list another ToString() method.
+ return new String (value, 1);
+ }
+
+ public static string ToString(char c)
+ {
+ return new String (new char [] {c});
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ // LAMESPEC: ECMA draft doesn't say Char implements IFormattable
+ return new String (value, 1);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Char;
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte(value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return value;
+ }
+
+ [CLSCompliant(false)]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ string IConvertible.ToString (IFormatProvider provider)
+ {
+ return ToString(provider);
+ }
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CharEnumerator.cs b/mcs/class/corlib/System/CharEnumerator.cs
new file mode 100644
index 00000000000..7689a5a3b4c
--- /dev/null
+++ b/mcs/class/corlib/System/CharEnumerator.cs
@@ -0,0 +1,90 @@
+//
+// System.CharEnumerator.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System
+{
+ [Serializable]
+ public sealed class CharEnumerator : IEnumerator, ICloneable
+ {
+ private string str;
+ private int index;
+ private int length;
+ // Representation invariant:
+ // length == str.Length
+ // -1 <= index <= length
+
+ // Constructor
+ internal CharEnumerator (string s)
+ {
+ str = s;
+ index = -1;
+ length = s.Length;
+ }
+
+ // Property
+ public char Current
+ {
+ get {
+ if (index == -1 || index == length)
+ throw new InvalidOperationException
+ ("The position is not valid.");
+
+ return str [index];
+ }
+ }
+
+ object IEnumerator.Current
+ {
+ get {
+ if (index == -1 || index == length)
+ throw new InvalidOperationException
+ ("The position is not valid");
+
+ return str [index];
+ }
+ }
+
+ // Methods
+ public object Clone ()
+ {
+ CharEnumerator x = new CharEnumerator (str);
+ x.index = index;
+ return x;
+ }
+
+ public bool MoveNext ()
+ {
+ // Representation invariant holds: -1 <= index <= length
+
+ index ++;
+
+ // Now: 0 <= index <= length+1;
+ // <=>
+ // 0 <= index < length (OK) ||
+ // length <= index <= length+1 (Out of bounds)
+
+ if (index >= length) {
+ index = length;
+ // Invariant restored:
+ // length == index
+ // =>
+ // -1 <= index <= length
+ return false;
+ }
+ else
+ return true;
+ }
+
+ public void Reset ()
+ {
+ index = -1;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs
new file mode 100644
index 00000000000..6b7b9e23dfc
--- /dev/null
+++ b/mcs/class/corlib/System/Console.cs
@@ -0,0 +1,320 @@
+//
+// System.Console.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+using System.Text;
+
+namespace System {
+
+ public sealed class Console {
+
+ private static TextWriter stdout;
+ private static TextWriter stderr;
+ private static TextReader stdin;
+
+ static Console ()
+ {
+ stderr = new StreamWriter (OpenStandardError (), Encoding.UnixConsoleEncoding);
+ ((StreamWriter)stderr).AutoFlush = true;
+ stdout = new StreamWriter (OpenStandardOutput (), Encoding.UnixConsoleEncoding);
+ ((StreamWriter)stdout).AutoFlush = true;
+ stdin = new StreamReader (OpenStandardInput (), Encoding.UnixConsoleEncoding);
+ }
+
+ private Console () {}
+
+ public static TextWriter Error
+ {
+ get {
+ return stderr;
+ }
+ }
+
+ public static TextWriter Out
+ {
+ get {
+ return stdout;
+ }
+ }
+
+ public static TextReader In
+ {
+ get {
+ return stdin;
+ }
+ }
+
+ public static Stream OpenStandardError ()
+ {
+ return OpenStandardError (0);
+ }
+
+ public static Stream OpenStandardError (int bufferSize)
+ {
+ return new FileStream (MonoIO.ConsoleError,
+ FileAccess.Write,
+ false, bufferSize);
+ }
+
+ public static Stream OpenStandardInput ()
+ {
+ return OpenStandardInput (0);
+ }
+
+ public static Stream OpenStandardInput (int bufferSize)
+ {
+ return new FileStream (MonoIO.ConsoleInput,
+ FileAccess.Read,
+ false, bufferSize);
+ }
+
+ public static Stream OpenStandardOutput ()
+ {
+ return OpenStandardOutput (0);
+ }
+
+ public static Stream OpenStandardOutput (int bufferSize)
+ {
+ return new FileStream (MonoIO.ConsoleOutput,
+ FileAccess.Write,
+ false, bufferSize);
+ }
+
+ public static void SetError (TextWriter newError)
+ {
+ if (newError == null)
+ throw new ArgumentNullException ();
+
+ stderr = newError;
+ }
+
+ public static void SetIn (TextReader newIn)
+ {
+ if (newIn == null)
+ throw new ArgumentNullException ();
+
+ stdin = newIn;
+ }
+
+ public static void SetOut (TextWriter newOut)
+ {
+ if (newOut == null)
+ throw new ArgumentNullException ();
+
+ stdout = newOut;
+ }
+
+ public static void Write (bool value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (char value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (char[] value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (decimal value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (double value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (int value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (long value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (object value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (float value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (string value)
+ {
+ stdout.Write (value);
+ }
+
+ [CLSCompliant(false)]
+ public static void Write (uint value)
+ {
+ stdout.Write (value);
+ }
+
+ [CLSCompliant(false)]
+ public static void Write (ulong value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (string format, object arg0)
+ {
+ stdout.Write (format, arg0);
+ }
+
+ public static void Write (string format, params object[] arg)
+ {
+ stdout.Write (format, arg);
+ }
+
+ public static void Write (char[] buffer, int index, int count)
+ {
+ stdout.Write (buffer, index, count);
+ }
+
+ public static void Write (string format, object arg0, object arg1)
+ {
+ stdout.Write (format, arg0, arg1);
+ }
+
+ public static void Write (string format, object arg0, object arg1, object arg2 )
+ {
+ stdout.Write (format, arg0, arg1, arg2);
+ }
+
+ public static void WriteLine ()
+ {
+ stdout.WriteLine ();
+ }
+
+ public static void WriteLine (bool value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (char value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (char[] value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (decimal value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (double value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (int value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (long value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (object value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (float value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public static void WriteLine (uint value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public static void WriteLine (ulong value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, object arg0)
+ {
+ stdout.Write (format, arg0);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, params object[] arg)
+ {
+ stdout.Write (format, arg);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (char[] buffer, int index, int count)
+ {
+ stdout.Write (buffer, index, count);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, object arg0, object arg1)
+ {
+ stdout.Write (format, arg0, arg1);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, object arg0, object arg1, object arg2)
+ {
+ stdout.Write (format, arg0, arg1, arg2);
+ stdout.WriteLine();
+ }
+
+ public static int Read ()
+ {
+ return stdin.Read ();
+ }
+
+ public static string ReadLine ()
+ {
+ return stdin.ReadLine ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ContextBoundObject.cs b/mcs/class/corlib/System/ContextBoundObject.cs
new file mode 100644
index 00000000000..92e95e454aa
--- /dev/null
+++ b/mcs/class/corlib/System/ContextBoundObject.cs
@@ -0,0 +1,25 @@
+//
+// System.ContextBoundObject.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+namespace System {
+
+ /// <summary>
+ /// Base class for all the context-bound classes
+ /// </summary>
+ [MonoTODO]
+ [Serializable]
+ public abstract class ContextBoundObject : MarshalByRefObject {
+
+ protected ContextBoundObject ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ContextMarshalException.cs b/mcs/class/corlib/System/ContextMarshalException.cs
new file mode 100644
index 00000000000..bb058cf2e09
--- /dev/null
+++ b/mcs/class/corlib/System/ContextMarshalException.cs
@@ -0,0 +1,42 @@
+//
+// System.ContextMarshalException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class ContextMarshalException : SystemException
+ {
+ // Constructors
+ public ContextMarshalException ()
+ : base (Locale.GetText ("Attempt to marshal and object across a context failed."))
+ {
+ }
+
+ public ContextMarshalException (string message)
+ : base (message)
+ {
+ }
+
+ protected ContextMarshalException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public ContextMarshalException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ContextStaticAttribute.cs b/mcs/class/corlib/System/ContextStaticAttribute.cs
new file mode 100755
index 00000000000..054c9845e6f
--- /dev/null
+++ b/mcs/class/corlib/System/ContextStaticAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.ContextStaticAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The ContextStatic attribute is used to flag fields as being unique
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.Field)]
+ [Serializable]
+ public class ContextStaticAttribute : Attribute {
+
+ public ContextStaticAttribute () : base ()
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/Convert.cs b/mcs/class/corlib/System/Convert.cs
new file mode 100644
index 00000000000..97b7800e9ac
--- /dev/null
+++ b/mcs/class/corlib/System/Convert.cs
@@ -0,0 +1,2463 @@
+//
+// System.Convert.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+//
+// System.Convert class. This was written word for word off the
+// Library specification for System.Convert in the ECMA TC39 TG2
+// and TG3 working documents. The first page of which has a table
+// for all legal conversion scenerios.
+//
+// This header and the one above it can be formatted however, just trying
+// to keep it consistent w/ the existing mcs headers.
+//
+// This Convert class could be written another way, with each type
+// implementing IConvertible and defining their own conversion functions,
+// and this class just calling the type's implementation. Or, they can
+// be defined here and the implementing type can use these functions when
+// defining their IConvertible interface. Byte's ToBoolean() calls
+// Convert.ToBoolean(byte), or Convert.ToBoolean(byte) calls
+// byte.ToBoolean(). The first case is what is done here.
+//
+// See http://lists.ximian.com/archives/public/mono-list/2001-July/000525.html
+//
+// There are also conversion functions that are not defined in
+// the ECMA draft, such as there is no bool ToBoolean(DateTime value),
+// and placing that somewhere won't compile w/ this Convert since the
+// function doesn't exist. However calling that when using Microsoft's
+// System.Convert doesn't produce any compiler errors, it just throws
+// an InvalidCastException at runtime.
+//
+// Whenever a decimal, double, or single is converted to an integer
+// based type, it is even rounded. This uses Math.Round which only
+// has Round(decimal) and Round(double), so in the Convert from
+// single cases the value is passed to Math as a double. This
+// may not be completely necessary.
+//
+// The .NET Framework SDK lists DBNull as a member of this class
+// as 'public static readonly object DBNull;'.
+//
+// It should also be decided if all the cast return values should be
+// returned as unchecked or not.
+//
+// All the XML function comments were auto generated which is why they
+// sound someone redundant.
+//
+// TYPE | BOOL BYTE CHAR DT DEC DBL I16 I32 I64 SBYT SNGL STR UI16 UI32 UI64
+// -----+--------------------------------------------------------------------
+// BOOL | X X X X X X X X X X X X X
+// BYTE | X X X X X X X X X X X X X X
+// CHAR | X X X X X X X X X X
+// DT | X X
+// DEC | X X X X X X X X X X X X X
+// DBL | X X X X X X X X X X X X X
+// I16 | X X X X X X X X X X X X X X
+// I32 | X X X X X X X X X X X X X X
+// I64 | X X X X X X X X X X X X X X
+// SBYT | X X X X X X X X X X X X X X
+// SNGL | X X X X X X X X X X X X X
+// STR | X X X X X X X X X X X X X X X
+// UI16 | X X X X X X X X X X X X X X
+// UI32 | X X X X X X X X X X X X X X
+// UI64 | X X X X X X X X X X X X X X
+//
+
+using System.Globalization;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace System {
+
+// [CLSCompliant(false)]
+ public sealed class Convert {
+
+ // Fields
+ public static readonly object DBNull = System.DBNull.Value;
+
+ private Convert () {}
+
+ // ========== BASE 64 Conversions ========== //
+ // the BASE64 convert methods are using the Base64 converting methods
+ // from System.Security.Cryptography.ToBase64Transform and
+ // System.Security.Cryptography.FromBase64Transform
+ //
+ // should be changed to a stand-alone class Base64Encoder & Base64Decoder
+
+ public static byte[] FromBase64CharArray(char[] inArray, int offset, int length)
+ {
+ if (inArray == null)
+ throw new ArgumentNullException();
+
+ if ((offset < 0) || (length < 0) || (offset + length > inArray.Length))
+ throw new ArgumentOutOfRangeException();
+
+ if (length < 4 || length % 4 != 0)
+ throw new FormatException();
+
+ byte[] inArr = new System.Text.UTF8Encoding().GetBytes(inArray, offset, length);
+ FromBase64Transform t = new FromBase64Transform();
+
+ return t.TransformFinalBlock(inArr, 0, inArr.Length);
+ }
+
+ public static byte[] FromBase64String(string s)
+ {
+ if (s == null)
+ throw new ArgumentNullException();
+
+ char[] inArr = s.ToCharArray();
+
+ return FromBase64CharArray(inArr, 0, inArr.Length);
+ }
+
+ public static TypeCode GetTypeCode (object value)
+ {
+ if (value == null)
+ return TypeCode.Empty;
+ else
+ return Type.GetTypeCode (value.GetType ());
+ }
+
+ public static bool IsDBNull (object value)
+ {
+ if (value is DBNull)
+ return true;
+ else
+ return false;
+ }
+
+ public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length,
+ char[] outArray, int offsetOut)
+ {
+ if (inArray == null || outArray == null)
+ throw new ArgumentNullException();
+
+ if (offsetIn < 0 || length < 0 || offsetOut < 0 || (offsetIn + length) > inArray.Length)
+ throw new ArgumentOutOfRangeException();
+
+ ToBase64Transform t = new ToBase64Transform();
+ byte[] outArr = t.TransformFinalBlock(inArray, offsetIn, length);
+
+ char[] cOutArr = new System.Text.ASCIIEncoding().GetChars(outArr);
+
+ if ((offsetOut + cOutArr.Length) > outArray.Length)
+ throw new ArgumentOutOfRangeException();
+
+ Array.Copy(cOutArr, 0, outArray, offsetOut, cOutArr.Length);
+
+ return cOutArr.Length;
+ }
+
+ public static string ToBase64String(byte[] inArray)
+ {
+ if (inArray == null)
+ throw new ArgumentNullException();
+
+ return ToBase64String(inArray, 0, inArray.Length);
+ }
+
+ public static string ToBase64String(byte[] inArray, int offset, int length)
+ {
+ if (inArray == null)
+ throw new ArgumentNullException();
+
+ if (offset < 0 || length < 0 || (offset + length) > inArray.Length)
+ throw new ArgumentOutOfRangeException();
+
+ // FIXME: change to stand alone Base64 Encoder class
+ ToBase64Transform t = new ToBase64Transform();
+ byte[] outArr = t.TransformFinalBlock(inArray, offset, length);
+
+ return (new System.Text.ASCIIEncoding().GetString(outArr));
+ }
+
+ // ========== Boolean Conversions ========== //
+
+ public static bool ToBoolean (bool value)
+ {
+ return value;
+ }
+
+ public static bool ToBoolean (byte value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (char value)
+ {
+ throw new InvalidCastException (Locale.GetText ("Can't convert char to bool"));
+ }
+
+ public static bool ToBoolean (DateTime value)
+ {
+ throw new InvalidCastException (Locale.GetText ("Can't convert date to bool"));
+ }
+
+ public static bool ToBoolean (decimal value)
+ {
+ return (value != 0M);
+ }
+
+ public static bool ToBoolean (double value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (float value)
+ {
+ return (value != 0f);
+ }
+
+ public static bool ToBoolean (int value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (long value)
+ {
+ return (value != 0);
+ }
+
+ [CLSCompliant (false)]
+ public static bool ToBoolean (sbyte value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (short value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (string value)
+ {
+ return Boolean.Parse (value);
+ }
+
+ public static bool ToBoolean (string value, IFormatProvider provider)
+ {
+ return Boolean.Parse (value); // provider is ignored.
+ }
+
+ [CLSCompliant (false)]
+ public static bool ToBoolean (uint value)
+ {
+ return (value != 0);
+ }
+
+ [CLSCompliant (false)]
+ public static bool ToBoolean (ulong value)
+ {
+ return (value != 0);
+ }
+
+ [CLSCompliant (false)]
+ public static bool ToBoolean (ushort value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (object value)
+ {
+ return ToBoolean (value, null);
+ }
+
+ public static bool ToBoolean (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return false;
+ return ((IConvertible) value).ToBoolean (provider);
+ }
+
+ // ========== Byte Conversions ========== //
+
+ public static byte ToByte (bool value)
+ {
+ return (byte)(value ? 1 : 0);
+ }
+
+ public static byte ToByte (byte value)
+ {
+ return value;
+ }
+
+ public static byte ToByte (char value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static byte ToByte (decimal value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ // Returned Even-Rounded
+ return (byte)(Math.Round (value));
+ }
+
+ public static byte ToByte (double value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ // This and the float version of ToByte are the only ones
+ // the spec listed as checking for .NaN and Infinity overflow
+ if (Double.IsNaN(value) || Double.IsInfinity(value))
+ throw new OverflowException (Locale.GetText (
+ "Value is equal to Double.NaN, Double.PositiveInfinity, or Double.NegativeInfinity"));
+
+ // Returned Even-Rounded
+ return (byte)(Math.Round (value));
+ }
+
+ public static byte ToByte (float value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.Minalue"));
+
+ // This and the double version of ToByte are the only ones
+ // the spec listed as checking for .NaN and Infinity overflow
+ if (Single.IsNaN(value) || Single.IsInfinity(value))
+ throw new OverflowException (Locale.GetText (
+ "Value is equal to Single.NaN, Single.PositiveInfinity, or Single.NegativeInfinity"));
+
+ // Returned Even-Rounded, pass it as a double, could have this
+ // method just call Convert.ToByte ( (double)value)
+ return (byte)(Math.Round ( (double)value));
+ }
+
+ public static byte ToByte (int value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (long value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static byte ToByte (sbyte value)
+ {
+ if (value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (short value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (string value)
+ {
+ return Byte.Parse (value);
+ }
+
+ public static byte ToByte (string value, IFormatProvider provider)
+ {
+ return Byte.Parse (value, provider);
+ }
+
+ public static byte ToByte (string value, int fromBase)
+ {
+
+ int retVal = ConvertFromBase (value, fromBase);
+
+ if (retVal < (int) Byte.MinValue || retVal > (int) Byte.MaxValue)
+ throw new OverflowException ();
+ else
+ return (byte) retVal;
+ }
+
+ [CLSCompliant (false)]
+ public static byte ToByte (uint value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static byte ToByte (ulong value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static byte ToByte (ushort value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (object value)
+ {
+ return ToByte (value, null);
+ }
+
+ public static byte ToByte (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToByte (provider);
+ }
+
+ // ========== Char Conversions ========== //
+
+ public static char ToChar (bool value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (byte value)
+ {
+ return (char)value;
+ }
+
+ public static char ToChar (char value)
+ {
+ return value;
+ }
+
+ public static char ToChar (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (decimal value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (double value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (int value)
+ {
+ if (value > Char.MaxValue || value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue or less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (long value)
+ {
+ if (value > Char.MaxValue || value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue or less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (float value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static char ToChar (sbyte value)
+ {
+ if (value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (short value)
+ {
+ if (value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (string value)
+ {
+ return Char.Parse (value);
+ }
+
+ public static char ToChar (string value, IFormatProvider provider)
+ {
+ return Char.Parse (value); // provider is ignored.
+ }
+
+ [CLSCompliant (false)]
+ public static char ToChar (uint value)
+ {
+ if (value > Char.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue"));
+
+ return (char)value;
+ }
+
+ [CLSCompliant (false)]
+ public static char ToChar (ulong value)
+ {
+ if (value > Char.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue"));
+
+ return (char)value;
+ }
+
+ [CLSCompliant (false)]
+ public static char ToChar (ushort value)
+ {
+ if (value > Char.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (object value)
+ {
+ return ToChar (value, null);
+ }
+
+ public static char ToChar (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return (char) 0;
+ return ((IConvertible) value).ToChar (provider);
+ }
+
+ // ========== DateTime Conversions ========== //
+
+ public static DateTime ToDateTime (string value)
+ {
+ return DateTime.Parse (value);
+ }
+
+ public static DateTime ToDateTime (string value, IFormatProvider provider)
+ {
+ return DateTime.Parse (value, provider);
+ }
+
+ public static DateTime ToDateTime (bool value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (byte value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (DateTime value)
+ {
+ return value;
+ }
+
+ public static DateTime ToDateTime (decimal value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (double value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (short value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (int value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (long value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (float value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (object value)
+ {
+ return ToDateTime (value, null);
+ }
+
+ public static DateTime ToDateTime (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return DateTime.MinValue;
+ return ((IConvertible) value).ToDateTime (provider);
+ }
+
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (sbyte value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (ushort value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (uint value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (ulong value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ // ========== Decimal Conversions ========== //
+
+ public static decimal ToDecimal (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static decimal ToDecimal (byte value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static decimal ToDecimal (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static decimal ToDecimal (decimal value)
+ {
+ return value;
+ }
+
+ public static decimal ToDecimal (double value)
+ {
+ if (value > (double)Decimal.MaxValue || value < (double)Decimal.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Decimal.MaxValue or less than Decimal.MinValue"));
+
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (float value)
+ {
+ return (decimal) value;
+ }
+
+ public static decimal ToDecimal (int value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (long value)
+ {
+ return (decimal)value;
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (sbyte value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (short value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (string value)
+ {
+ return Decimal.Parse (value);
+ }
+
+ public static decimal ToDecimal (string value, IFormatProvider provider)
+ {
+ return Decimal.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (uint value)
+ {
+ return (decimal)value;
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (ulong value)
+ {
+ return (decimal)value;
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (ushort value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (object value)
+ {
+ return ToDecimal (value, null);
+ }
+
+ public static decimal ToDecimal (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return new Decimal (0);
+ return ((IConvertible) value).ToDecimal (provider);
+ }
+
+
+ // ========== Double Conversions ========== //
+
+ public static double ToDouble (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static double ToDouble (byte value)
+ {
+ return (double) value;
+ }
+
+ public static double ToDouble (char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static double ToDouble (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static double ToDouble (decimal value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (double value)
+ {
+ return value;
+ }
+
+ public static double ToDouble (float value)
+ {
+ return (double) value;
+ }
+
+ public static double ToDouble (int value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (long value)
+ {
+ return (double)value;
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (sbyte value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (short value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (string value)
+ {
+ return Double.Parse (value);
+ }
+
+ public static double ToDouble (string value, IFormatProvider provider)
+ {
+ return Double.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (uint value)
+ {
+ return (double)value;
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (ulong value)
+ {
+ return (double)value;
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (ushort value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (object value)
+ {
+ return ToDouble (value, null);
+ }
+
+ public static double ToDouble (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0.0;
+ return ((IConvertible) value).ToDouble (provider);
+ }
+
+ // ========== Int16 Conversions ========== //
+
+ public static short ToInt16 (bool value)
+ {
+ return (short)(value ? 1 : 0);
+ }
+
+ public static short ToInt16 (byte value)
+ {
+ return (short)value;
+ }
+
+ public static short ToInt16 (char value)
+ {
+ if (value > Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+
+ return (short)value;
+ }
+
+ public static short ToInt16 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static short ToInt16 (decimal value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ // Returned Even-Rounded
+ return (short)(Math.Round (value));
+ }
+
+ public static short ToInt16 (double value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ // Returned Even-Rounded
+ return (short)(Math.Round (value));
+ }
+
+ public static short ToInt16 (float value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ // Returned Even-Rounded, use Math.Round pass as a double.
+ return (short)Math.Round ( (double)value);
+ }
+
+ public static short ToInt16 (int value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ return (short)value;
+ }
+
+ public static short ToInt16 (long value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ return (short)value;
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (sbyte value)
+ {
+ return (short)value;
+ }
+
+ public static short ToInt16 (short value)
+ {
+ return value;
+ }
+
+ public static short ToInt16 (string value)
+ {
+ return Int16.Parse (value);
+ }
+
+ public static short ToInt16 (string value, IFormatProvider provider)
+ {
+ return Int16.Parse (value, provider);
+ }
+
+
+ public static short ToInt16 (string value, int fromBase)
+ {
+ return Convert.ToInt16 (ConvertFromBase (value, fromBase));
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (uint value)
+ {
+ if (value > Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+
+ return (short)value;
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (ulong value)
+ {
+ if (value > (ulong)Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+ return (short)value;
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (ushort value)
+ {
+ if (value > Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+
+ return (short)value;
+ }
+
+ public static short ToInt16 (object value)
+ {
+ return ToInt16 (value, null);
+ }
+
+ public static short ToInt16 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToInt16 (provider);
+ }
+
+ // ========== Int32 Conversions ========== //
+
+ public static int ToInt32 (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static int ToInt32 (byte value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (char value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static int ToInt32 (decimal value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ // Returned Even-Rounded
+ return (int)(Math.Round (value));
+ }
+
+ public static int ToInt32 (double value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ // Returned Even-Rounded
+ return (int)(Math.Round (value));
+ }
+
+ public static int ToInt32 (float value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ // Returned Even-Rounded, pass as a double, could just call
+ // Convert.ToInt32 ( (double)value);
+ return (int)(Math.Round ( (double)value));
+ }
+
+ public static int ToInt32 (int value)
+ {
+ return value;
+ }
+
+ public static int ToInt32 (long value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ return (int)value;
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (sbyte value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (short value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (string value)
+ {
+ return Int32.Parse (value);
+ }
+
+ public static int ToInt32 (string value, IFormatProvider provider)
+ {
+ return Int32.Parse (value, provider);
+ }
+
+
+ public static int ToInt32 (string value, int fromBase)
+ {
+ return ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (uint value)
+ {
+ if (value > Int32.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue"));
+
+ return (int)value;
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (ulong value)
+ {
+ if (value > Int32.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue"));
+
+ return (int)value;
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (ushort value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (object value)
+ {
+ return ToInt32 (value, null);
+ }
+
+ public static int ToInt32 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToInt32 (provider);
+ }
+
+ // ========== Int64 Conversions ========== //
+
+ public static long ToInt64 (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static long ToInt64 (byte value)
+ {
+ return (long)(ulong)value;
+ }
+
+ public static long ToInt64 (char value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static long ToInt64 (decimal value)
+ {
+ if (value > Int64.MaxValue || value < Int64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue or less than Int64.MinValue"));
+
+ // Returned Even-Rounded
+ return (long)(Math.Round (value));
+ }
+
+ public static long ToInt64 (double value)
+ {
+ if (value > Int64.MaxValue || value < Int64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue or less than Int64.MinValue"));
+
+ // Returned Even-Rounded
+ return (long)(Math.Round (value));
+ }
+
+ public static long ToInt64 (float value)
+ {
+ if (value > Int64.MaxValue || value < Int64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue or less than Int64.MinValue"));
+
+ // Returned Even-Rounded, pass to Math as a double, could
+ // just call Convert.ToInt64 ( (double)value);
+ return (long)(Math.Round ( (double)value));
+ }
+
+ public static long ToInt64 (int value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (long value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (sbyte value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (short value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (string value)
+ {
+ return Int64.Parse (value);
+ }
+
+ public static long ToInt64 (string value, IFormatProvider provider)
+ {
+ return Int64.Parse (value, provider);
+ }
+
+ public static long ToInt64 (string value, int fromBase)
+ {
+ if (NotValidBase (fromBase))
+ throw new ArgumentException ("fromBase is not valid.");
+
+ return ConvertFromBase64 (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (uint value)
+ {
+ return (long)(ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (ulong value)
+ {
+ if (value > Int64.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue"));
+
+ return (long)value;
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (ushort value)
+ {
+ return (long)(ulong)value;
+ }
+
+ public static long ToInt64 (object value)
+ {
+ return ToInt64 (value, null);
+ }
+
+ public static long ToInt64 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToInt64 (provider);
+ }
+
+ // ========== SByte Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (bool value)
+ {
+ return (sbyte)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (byte value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (char value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (decimal value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ // Returned Even-Rounded
+ return (sbyte)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (double value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ // Returned Even-Rounded
+ return (sbyte)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (float value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.Minalue"));
+
+ // Returned Even-Rounded, pass as double to Math
+ return (sbyte)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (int value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (long value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (sbyte value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (short value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (string value)
+ {
+ return SByte.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (string value, IFormatProvider provider)
+ {
+ return SByte.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (string value, int fromBase)
+ {
+ int retVal = ConvertFromBase (value, fromBase);
+
+ if (retVal == 255)
+ return (sbyte)-1;
+
+ if (retVal < (int) SByte.MinValue || retVal > (int) SByte.MaxValue)
+ throw new OverflowException ();
+ else
+ return (sbyte) retVal;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (uint value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (ulong value)
+ {
+ if (value > (ulong)SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (ushort value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (object value)
+ {
+ return ToSByte (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToSByte (provider);
+ }
+
+ // ========== Single Conversions ========== //
+
+ public static float ToSingle (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static float ToSingle (byte value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (Char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static float ToSingle (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static float ToSingle (decimal value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (double value)
+ {
+ if (value > Single.MaxValue || value < Single.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Single.MaxValue or less than Single.MinValue"));
+
+ return (float)value;
+ }
+
+ public static float ToSingle (float value)
+ {
+ return value;
+ }
+
+ public static float ToSingle (int value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (long value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (sbyte value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (short value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (string value)
+ {
+ return Single.Parse (value);
+ }
+
+ public static float ToSingle (string value, IFormatProvider provider)
+ {
+ return Single.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (uint value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (ulong value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (ushort value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (object value)
+ {
+ return ToSingle (value, null);
+ }
+
+// [CLSCompliant (false)]
+ public static float ToSingle (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToSingle (provider);
+ }
+
+ // ========== String Conversions ========== //
+
+ public static string ToString (bool value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (bool value, IFormatProvider provider)
+ {
+ return value.ToString (); // the same as ToString (bool).
+ }
+
+ public static string ToString (byte value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (byte value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (byte value, int toBase)
+ {
+ if (NotValidBase (toBase))
+ throw new ArgumentException ("toBase is not valid.");
+
+ return ConvertToBase ((int) value, toBase);
+ }
+
+ public static string ToString (char value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (char value, IFormatProvider provider)
+ {
+ return value.ToString (); // the same as ToString (char)
+ }
+
+ public static string ToString (DateTime value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (DateTime value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (decimal value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (decimal value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (double value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (double value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (float value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (float value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (int value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (int value, int toBase)
+ {
+ if (NotValidBase (toBase))
+ throw new ArgumentException ("toBase is not valid.");
+
+ return ConvertToBase ((int) value, toBase);
+ }
+
+ public static string ToString (int value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (long value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (long value, int toBase)
+ {
+ if (NotValidBase (toBase))
+ throw new ArgumentException ("toBase is not valid.");
+
+ return ConvertToBase (value, toBase);
+ }
+
+ public static string ToString (long value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (object value)
+ {
+ return ToString (value, null);
+ }
+
+ public static string ToString (object value, IFormatProvider provider)
+ {
+ if (value is IConvertible)
+ return ((IConvertible) value).ToString (provider);
+ else if (value != null)
+ return value.ToString ();
+ return String.Empty;
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (sbyte value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (sbyte value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (short value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (short value, int toBase)
+ {
+ if (NotValidBase (toBase))
+ throw new ArgumentException ("toBase is not valid.");
+
+ return ConvertToBase ((int) value, toBase);
+ }
+
+ public static string ToString (short value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (string value)
+ {
+ return value;
+ }
+
+ public static string ToString (string value, IFormatProvider provider)
+ {
+ return value; // provider is ignored.
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (uint value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (uint value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ulong value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ulong value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ushort value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ushort value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ // ========== UInt16 Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (bool value)
+ {
+ return (ushort)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (byte value)
+ {
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (char value)
+ {
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (decimal value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ // Returned Even-Rounded
+ return (ushort)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (double value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ // Returned Even-Rounded
+ return (ushort)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (float value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ // Returned Even-Rounded, pass as double to Math
+ return (ushort)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (int value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (long value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (sbyte value)
+ {
+ if (value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (short value)
+ {
+ if (value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (string value)
+ {
+ return UInt16.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (string value, IFormatProvider provider)
+ {
+ return UInt16.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (string value, int fromBase)
+ {
+ return (ushort) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (uint value)
+ {
+ if (value > UInt16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (ulong value)
+ {
+ if (value > (ulong)UInt16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (ushort value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (object value)
+ {
+ return ToUInt16 (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToUInt16 (provider);
+ }
+
+ // ========== UInt32 Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (bool value)
+ {
+ return (uint)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (byte value)
+ {
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (char value)
+ {
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (decimal value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ // Returned Even-Rounded
+ return (uint)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (double value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ // Returned Even-Rounded
+ return (uint)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (float value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ // Returned Even-Rounded, pass as double to Math
+ return (uint)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (int value)
+ {
+ if (value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (long value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (sbyte value)
+ {
+ if (value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (short value)
+ {
+ if (value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (string value)
+ {
+ return UInt32.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (string value, IFormatProvider provider)
+ {
+ return UInt32.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (string value, int fromBase)
+ {
+ return (uint) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (uint value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (ulong value)
+ {
+ if (value > UInt32.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (ushort value)
+ {
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (object value)
+ {
+ return ToUInt32 (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToUInt32 (provider);
+ }
+
+
+ // ========== UInt64 Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (bool value)
+ {
+ return (ulong)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (byte value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (char value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (DateTime value)
+ {
+ throw new InvalidCastException ("The conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (decimal value)
+ {
+ if (value > UInt64.MaxValue || value < UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
+
+ // Returned Even-Rounded
+ return (ulong)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (double value)
+ {
+ if (value > UInt64.MaxValue || value < UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
+
+ // Returned Even-Rounded
+ return (ulong)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (float value)
+ {
+ if (value > UInt64.MaxValue || value < UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
+
+ // Returned Even-Rounded, pass as a double to Math
+ return (ulong)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (int value)
+ {
+ if (value < (int)UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt64.MinValue"));
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (long value)
+ {
+ if (value < (long)UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt64.MinValue"));
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (sbyte value)
+ {
+ if (value < (sbyte)UInt64.MinValue)
+ throw new OverflowException
+ ("Value is less than UInt64.MinValue");
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (short value)
+ {
+ if (value < (short)UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt64.MinValue"));
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (string value)
+ {
+ return UInt64.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (string value, IFormatProvider provider)
+ {
+ return UInt64.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (string value, int fromBase)
+ {
+ return (ulong) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (uint value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (ulong value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (ushort value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (object value)
+ {
+ return ToUInt64 (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToUInt64 (provider);
+ }
+
+
+ // ========== Conversion / Helper Functions ========== //
+
+ public static object ChangeType (object value, Type conversionType)
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ NumberFormatInfo number = ci.NumberFormat;
+ return ToType (value, conversionType, number);
+ }
+
+ public static object ChangeType (object value, TypeCode typeCode)
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ Type conversionType = conversionTable [(int)typeCode];
+ NumberFormatInfo number = ci.NumberFormat;
+ return ToType (value, conversionType, number);
+ }
+
+ public static object ChangeType (object value, Type conversionType, IFormatProvider provider)
+ {
+ return ToType (value, conversionType, provider);
+ }
+
+ public static object ChangeType (object value, TypeCode typeCode, IFormatProvider provider)
+ {
+ Type conversionType = conversionTable [(int)typeCode];
+ return ToType (value, conversionType, provider);
+ }
+
+ private static bool NotValidBase (int value)
+ {
+ if ((value == 2) || (value == 8) ||
+ (value == 10) || (value == 16))
+ return false;
+
+ return true;
+ }
+
+ private static int ConvertFromBase (string value, int fromBase)
+ {
+ if (NotValidBase (fromBase))
+ throw new ArgumentException ("fromBase is not valid.");
+
+ int chars = 0;
+ int result = 0;
+ int digitValue;
+
+ foreach (char c in value) {
+ if (Char.IsNumber (c))
+ digitValue = c - '0';
+ else if (Char.IsLetter (c))
+ digitValue = Char.ToLower(c) - 'a' + 10;
+ else
+ throw new FormatException ("This is an invalid string: " + value);
+
+ if (digitValue >= fromBase)
+ throw new FormatException ("the digits are invalid.");
+
+ result = (fromBase) * result + digitValue;
+ chars ++;
+ }
+
+ if (chars == 0)
+ throw new FormatException ("Could not find any digits.");
+
+ if (result > Int32.MaxValue || result < Int32.MinValue)
+ throw new OverflowException ("There is an overflow.");
+
+ return result;
+ }
+
+ private static long ConvertFromBase64 (string value, int fromBase)
+ {
+ if (NotValidBase (fromBase))
+ throw new ArgumentException ("fromBase is not valid.");
+
+ int chars = 0;
+ int digitValue;
+ long result = 0;
+
+ foreach (char c in value) {
+ if (Char.IsNumber (c))
+ digitValue = c - '0';
+ else if (Char.IsLetter (c))
+ digitValue = Char.ToLower(c) - 'a' + 10;
+ else
+ throw new FormatException ("This is an invalid string: " + value);
+
+ if (digitValue >= fromBase)
+ throw new FormatException ("the digits are invalid.");
+
+ result = (fromBase) * result + digitValue;
+ chars ++;
+ }
+
+ if (chars == 0)
+ throw new FormatException ("Could not find any digits.");
+
+ if (result > Int64.MaxValue || result < Int64.MinValue)
+ throw new OverflowException ("There is an overflow.");
+
+ return result;
+ }
+
+ private static string ConvertToBase (int value, int toBase)
+ {
+ StringBuilder sb = new StringBuilder ();
+ BuildConvertedString (sb, value, toBase);
+ return sb.ToString ();
+ }
+
+ private static string ConvertToBase (long value, int toBase)
+ {
+ StringBuilder sb = new StringBuilder ();
+ BuildConvertedString64 (sb, value, toBase);
+ return sb.ToString ();
+ }
+
+
+ internal static void BuildConvertedString (StringBuilder sb, int value, int toBase)
+ {
+ int divided = value / toBase;
+ int reminder = value % toBase;
+
+ if (divided > 0)
+ BuildConvertedString (sb, divided, toBase);
+
+ if (reminder >= 10)
+ sb.Append ((char) (reminder + 'a' - 10));
+ else
+ sb.Append ((char) (reminder + '0'));
+ }
+
+ internal static void BuildConvertedString64 (StringBuilder sb, long value, int toBase)
+ {
+ long divided = value / toBase;
+ long reminder = value % toBase;
+
+ if (divided > 0)
+ BuildConvertedString64 (sb, divided, toBase);
+
+ if (reminder >= 10)
+ sb.Append ((char) (reminder + 'a' - 10));
+ else
+ sb.Append ((char) (reminder + '0'));
+ }
+
+ // Lookup table for the conversion ToType method. Order
+ // is important! Used by ToType for comparing the target
+ // type, and uses hardcoded array indexes.
+ private static Type[] conversionTable = {
+ // Valid ICovnertible Types
+ null, // 0 empty
+ typeof (object), // 1 TypeCode.Object
+ typeof (DBNull), // 2 TypeCode.DBNull
+ typeof (Boolean), // 3 TypeCode.Boolean
+ typeof (Char), // 4 TypeCode.Char
+ typeof (SByte), // 5 TypeCode.SByte
+ typeof (Byte), // 6 TypeCode.Byte
+ typeof (Int16), // 7 TypeCode.Int16
+ typeof (UInt16), // 8 TypeCode.UInt16
+ typeof (Int32), // 9 TypeCode.Int32
+ typeof (UInt32), // 10 TypeCode.UInt32
+ typeof (Int64), // 11 TypeCode.Int64
+ typeof (UInt64), // 12 TypeCode.UInt64
+ typeof (Single), // 13 TypeCode.Single
+ typeof (Double), // 14 TypeCode.Double
+ typeof (Decimal), // 15 TypeCode.Decimal
+ typeof (DateTime), // 16 TypeCode.DateTime
+ null, // 17 null.
+ typeof (String), // 18 TypeCode.String
+ };
+
+ // Function to convert an object to another type and return
+ // it as an object. In place for the core data types to use
+ // when implementing IConvertible. Uses hardcoded indexes in
+ // the conversionTypes array, so if modify carefully.
+ internal static object ToType (object value, Type conversionType,
+ IFormatProvider provider)
+ {
+ if (value == null && conversionType == null)
+ return null;
+
+ if (value == null)
+ throw new NullReferenceException ("Value is null.");
+
+ if (value is IConvertible) {
+ IConvertible convertValue = (IConvertible) value;
+
+ if (conversionType == conversionTable[0]) // 0 Empty
+ throw new ArgumentNullException ();
+
+ else if (conversionType == conversionTable[1]) // 1 TypeCode.Object
+ return (object) value;
+
+ else if (conversionType == conversionTable[2]) // 2 TypeCode.DBNull
+ throw new InvalidCastException (); // It's not IConvertible
+
+ else if (conversionType == conversionTable[3]) // 3 TypeCode.Boolean
+ return (object) convertValue.ToBoolean (provider);
+
+ else if (conversionType == conversionTable[4]) // 4 TypeCode.Char
+ return (object) convertValue.ToChar (provider);
+
+ else if (conversionType == conversionTable[5]) // 5 TypeCode.SByte
+ return (object) convertValue.ToSByte (provider);
+
+ else if (conversionType == conversionTable[6]) // 6 TypeCode.Byte
+ return (object) convertValue.ToByte (provider);
+
+ else if (conversionType == conversionTable[7]) // 7 TypeCode.Int16
+ return (object) convertValue.ToInt16 (provider);
+
+ else if (conversionType == conversionTable[8]) // 8 TypeCode.UInt16
+ return (object) convertValue.ToUInt16 (provider);
+
+ else if (conversionType == conversionTable[9]) // 9 TypeCode.Int32
+ return (object) convertValue.ToInt32 (provider);
+
+ else if (conversionType == conversionTable[10]) // 10 TypeCode.UInt32
+ return (object) convertValue.ToUInt32 (provider);
+
+ else if (conversionType == conversionTable[11]) // 11 TypeCode.Int64
+ return (object) convertValue.ToInt64 (provider);
+
+ else if (conversionType == conversionTable[12]) // 12 TypeCode.UInt64
+ return (object) convertValue.ToUInt64 (provider);
+
+ else if (conversionType == conversionTable[13]) // 13 TypeCode.Single
+ return (object) convertValue.ToSingle (provider);
+
+ else if (conversionType == conversionTable[14]) // 14 TypeCode.Double
+ return (object) convertValue.ToDouble (provider);
+
+ else if (conversionType == conversionTable[15]) // 15 TypeCode.Decimal
+ return (object) convertValue.ToDecimal (provider);
+
+ else if (conversionType == conversionTable[16]) // 16 TypeCode.DateTime
+ return (object) convertValue.ToDateTime (provider);
+
+ else if (conversionType == conversionTable[18]) // 18 TypeCode.String
+ return (object) convertValue.ToString (provider);
+ else
+ throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
+ } else
+ // Not in the conversion table
+ throw new InvalidCastException ((Locale.GetText (
+ "Value is not a convertible object: " + value.GetType().ToString() + " to " + conversionType.FullName)));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CrossAppDomainDelegate.cs b/mcs/class/corlib/System/CrossAppDomainDelegate.cs
new file mode 100755
index 00000000000..d8cded40afa
--- /dev/null
+++ b/mcs/class/corlib/System/CrossAppDomainDelegate.cs
@@ -0,0 +1,10 @@
+// System.CrossAppDomainDelegate.cs
+//
+// Paolo Molaro
+//
+// (C) 2002 Ximian, Inc.
+
+namespace System
+{
+ public delegate void CrossAppDomainDelegate ();
+}
diff --git a/mcs/class/corlib/System/DBNull.cs b/mcs/class/corlib/System/DBNull.cs
new file mode 100644
index 00000000000..8af6929e57e
--- /dev/null
+++ b/mcs/class/corlib/System/DBNull.cs
@@ -0,0 +1,133 @@
+//
+// System.DBNull.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public sealed class DBNull : ISerializable, IConvertible
+ {
+ // Fields
+ public static readonly DBNull Value = new DBNull ();
+
+ // Private constructor
+ private DBNull () {}
+
+ // Methods
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ UnitySerializationHolder.GetDBNullData (this, info, context);
+ }
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.DBNull;
+ }
+
+ [MonoTODO]
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return Byte.MinValue;
+ }
+
+ [MonoTODO]
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return Char.MinValue;
+ }
+
+ [MonoTODO]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return DateTime.MinValue;
+ }
+
+ [MonoTODO]
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return Decimal.MinValue;
+ }
+
+ [MonoTODO]
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return Double.MinValue;
+ }
+
+ [MonoTODO]
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return Int16.MinValue;
+ }
+
+ [MonoTODO]
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return Int32.MinValue;
+ }
+
+ [MonoTODO]
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return Int64.MinValue;
+ }
+
+ [MonoTODO]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return SByte.MinValue;
+ }
+
+ [MonoTODO]
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return Single.MinValue;
+ }
+
+ [MonoTODO]
+ object IConvertible.ToType (Type type, IFormatProvider provider)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return UInt16.MinValue;
+ }
+
+ [MonoTODO]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return UInt32.MinValue;
+ }
+
+ [MonoTODO]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return UInt64.MinValue;
+ }
+
+ public override string ToString ()
+ {
+ return String.Empty;
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DateTime.cs b/mcs/class/corlib/System/DateTime.cs
new file mode 100644
index 00000000000..99aa24f3391
--- /dev/null
+++ b/mcs/class/corlib/System/DateTime.cs
@@ -0,0 +1,1473 @@
+//
+// System.DateTime.cs
+//
+// author:
+// Marcel Narings (marcel@narings.nl)
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2001 Marcel Narings
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+
+namespace System
+{
+ /// <summary>
+ /// The DateTime structure represents dates and time ranging from
+ /// 1-1-0001 12:00:00 AM to 31-12-9999 23:59:00 Common Era.
+ /// </summary>
+ ///
+ [Serializable]
+ public struct DateTime : IComparable, IFormattable, IConvertible
+ {
+ private TimeSpan ticks;
+
+ private const int dp400 = 146097;
+ private const int dp100 = 36524;
+ private const int dp4 = 1461;
+
+ // w32 file time starts counting from 1/1/1601 00:00 GMT
+ // which is the constant ticks from the .NET epoch
+ private const long w32file_epoch = 504911232000000000L;
+
+ //
+ // The UnixEpoch, it begins on Jan 1, 1970 at 0:0:0, expressed
+ // in Ticks
+ //
+ internal const long UnixEpoch = 621355968000000000L;
+
+ public static readonly DateTime MaxValue = new DateTime (false,TimeSpan.MaxValue);
+ public static readonly DateTime MinValue = new DateTime (false,0);
+
+ private enum Which
+ {
+ Day,
+ DayYear,
+ Month,
+ Year
+ };
+
+ private static int[] daysmonth = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ private static int[] daysmonthleap = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+ private static int AbsoluteDays (int year, int month, int day)
+ {
+ int[] days;
+ int temp = 0, m=1 ;
+
+ days = (IsLeapYear(year) ? daysmonthleap : daysmonth);
+
+ while (m < month)
+ temp += days[m++];
+ return ((day-1) + temp + (365* (year-1)) + ((year-1)/4) - ((year-1)/100) + ((year-1)/400));
+ }
+
+ private int FromTicks(Which what)
+ {
+ int num400, num100, num4, numyears;
+ int M =1;
+
+ int[] days = daysmonth;
+ int totaldays = this.ticks.Days;
+
+ num400 = (totaldays / dp400);
+ totaldays -= num400 * dp400;
+
+ num100 = (totaldays / dp100);
+ if (num100 == 4) // leap
+ num100 = 3;
+ totaldays -= (num100 * dp100);
+
+ num4 = totaldays / dp4;
+ totaldays -= (num4 * dp4);
+
+ numyears = totaldays / 365 ;
+
+ if (numyears == 4) //leap
+ numyears =3 ;
+ if (what == Which.Year )
+ return num400*400 + num100*100 + num4*4 + numyears + 1;
+
+ totaldays -= (numyears * 365) ;
+ if (what == Which.DayYear )
+ return totaldays + 1;
+
+ if ((numyears==3) && ((num100 == 3) || !(num4 == 24)) ) //31 dec leapyear
+ days = daysmonthleap;
+
+ while (totaldays >= days[M])
+ totaldays -= days[M++];
+
+ if (what == Which.Month )
+ return M;
+
+ return totaldays +1;
+ }
+
+
+ // Constructors
+
+ /// <summary>
+ /// Constructs a DateTime for specified ticks
+ /// </summary>
+ ///
+ public DateTime (long newticks)
+ // `local' must default to false here to avoid
+ // a recursion loop.
+ : this (false, newticks) {}
+
+ internal DateTime (bool local, long newticks)
+ : this (true, new TimeSpan (newticks))
+ {
+ if (local) {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+
+ TimeSpan utcoffset = tz.GetUtcOffset (this);
+
+ ticks = ticks + utcoffset;
+ }
+ }
+
+ public DateTime (int year, int month, int day)
+ : this (year, month, day,0,0,0,0) {}
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second)
+ : this (year, month, day, hour, minute, second, 0) {}
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond)
+ {
+ if ( year < 1 || year > 9999 ||
+ month < 1 || month >12 ||
+ day < 1 || day > DaysInMonth(year, month) ||
+ hour < 0 || hour > 23 ||
+ minute < 0 || minute > 59 ||
+ second < 0 || second > 59 )
+ throw new ArgumentOutOfRangeException ("Parameters describe an " +
+ "unrepresentable DateTime.");
+
+ ticks = new TimeSpan (AbsoluteDays(year,month,day), hour, minute, second, millisecond);
+ }
+
+ public DateTime (int year, int month, int day, Calendar calendar)
+ : this (year, month, day, 0, 0, 0, 0, calendar) {}
+
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second, Calendar calendar)
+ : this (year, month, day, hour, minute, second, 0, calendar) {}
+
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar)
+ : this (year, month, day, hour, minute, second, millisecond)
+ {
+ if (calendar == null)
+ throw new ArgumentNullException();
+ }
+
+ internal DateTime (bool check, TimeSpan value)
+ {
+ if (check && (value.Ticks < MinValue.Ticks || value.Ticks > MaxValue.Ticks))
+ throw new ArgumentOutOfRangeException ();
+
+ ticks = value;
+ }
+
+ /* Properties */
+
+ public DateTime Date
+ {
+ get
+ {
+ return new DateTime (Year, Month, Day);
+ }
+ }
+
+ public int Month
+ {
+ get
+ {
+ return FromTicks(Which.Month);
+ }
+ }
+
+
+ public int Day
+ {
+ get
+ {
+ return FromTicks(Which.Day);
+ }
+ }
+
+ public DayOfWeek DayOfWeek
+ {
+ get
+ {
+ return ( (DayOfWeek) ((ticks.Days+1) % 7) );
+ }
+ }
+
+ public int DayOfYear
+ {
+ get
+ {
+ return FromTicks(Which.DayYear);
+ }
+ }
+
+ public TimeSpan TimeOfDay
+ {
+ get
+ {
+ return new TimeSpan(ticks.Ticks % TimeSpan.TicksPerDay );
+ }
+
+ }
+
+ public int Hour
+ {
+ get
+ {
+ return ticks.Hours;
+ }
+ }
+
+ public int Minute
+ {
+ get
+ {
+ return ticks.Minutes;
+ }
+ }
+
+ public int Second
+ {
+ get
+ {
+ return ticks.Seconds;
+ }
+ }
+
+ public int Millisecond
+ {
+ get
+ {
+ return ticks.Milliseconds;
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern long GetNow ();
+
+ public static DateTime Now
+ {
+ get
+ {
+ return new DateTime (true, GetNow ());
+ }
+ }
+
+ public long Ticks
+ {
+ get
+ {
+ return ticks.Ticks;
+ }
+ }
+
+ public static DateTime Today
+ {
+ get
+ {
+ return new DateTime (false, (GetNow () / TimeSpan.TicksPerDay) * TimeSpan.TicksPerDay);
+ }
+ }
+
+ public static DateTime UtcNow
+ {
+ get {
+ return new DateTime (GetNow ());
+ }
+ }
+
+ public int Year
+ {
+ get
+ {
+ return FromTicks(Which.Year);
+ }
+ }
+
+ /* methods */
+
+ public DateTime Add (TimeSpan ts)
+ {
+ return new DateTime (true, ticks) + ts;
+ }
+
+ public DateTime AddDays (double days)
+ {
+ return AddMilliseconds (days * 86400000);
+ }
+
+ public DateTime AddTicks (long t)
+ {
+ return Add (new TimeSpan (t));
+ }
+
+ public DateTime AddHours (double hours)
+ {
+ return AddMilliseconds (hours * 3600000);
+ }
+
+ public DateTime AddMilliseconds (double ms)
+ {
+ long msticks;
+
+ msticks = (long) (ms += ms > 0 ? 0.5 : -0.5) * TimeSpan.TicksPerMillisecond ;
+
+ return AddTicks (msticks);
+ }
+
+ public DateTime AddMinutes (double minutes)
+ {
+ return AddMilliseconds (minutes * 60000);
+ }
+
+ public DateTime AddMonths (int months)
+ {
+ int day, month, year, maxday ;
+ DateTime temp ;
+
+ day = this.Day;
+ month = this.Month + (months % 12);
+ year = this.Year + months/12 ;
+
+ if (month < 1)
+ {
+ month = 12 + month ;
+ year -- ;
+ }
+ else if (month>12)
+ {
+ month = month -12;
+ year ++;
+ }
+ maxday = DaysInMonth(year, month);
+ if (day > maxday)
+ day = maxday;
+
+ temp = new DateTime (year, month, day);
+ return temp.Add (this.TimeOfDay);
+ }
+
+ public DateTime AddSeconds (double seconds)
+ {
+ return AddMilliseconds (seconds*1000);
+ }
+
+ public DateTime AddYears (int years )
+ {
+ return AddMonths(years * 12);
+ }
+
+ public static int Compare (DateTime t1, DateTime t2)
+ {
+ if (t1.ticks < t2.ticks)
+ return -1;
+ else if (t1.ticks > t2.ticks)
+ return 1;
+ else
+ return 0;
+ }
+
+ public int CompareTo (object v)
+ {
+ if ( v == null)
+ return 1;
+
+ if (!(v is System.DateTime))
+ throw new ArgumentException (Locale.GetText (
+ "Value is not a System.DateTime"));
+
+ return Compare (this, (DateTime) v);
+ }
+
+ public static int DaysInMonth (int year, int month)
+ {
+ int[] days ;
+
+ if (month < 1 || month >12)
+ throw new ArgumentOutOfRangeException ();
+
+ days = (IsLeapYear(year) ? daysmonthleap : daysmonth);
+ return days[month];
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.DateTime))
+ return false;
+
+ return ((DateTime) o).ticks == ticks;
+ }
+
+ public static bool Equals (DateTime t1, DateTime t2 )
+ {
+ return (t1.ticks == t2.ticks );
+ }
+
+ public static DateTime FromFileTime (long fileTime)
+ {
+ return new DateTime (w32file_epoch + fileTime);
+ }
+
+ // TODO: Implement me.
+ [MonoTODO]
+ public static DateTime FromOADate (double d)
+ {
+ return new DateTime(0);
+ }
+
+ // TODO: Implement me.
+ [MonoTODO]
+ public string[] GetDateTimeFormats()
+ {
+ return null;
+ }
+
+ //TODO: implement me
+ [MonoTODO]
+ public string[] GetDateTimeFormats(char format)
+ {
+ return null;
+ }
+
+ // TODO: implement me
+ [MonoTODO]
+ public string[] GetDateTimeFormats(IFormatProvider provider)
+ {
+ return null;
+ }
+
+ //TODO: implement me
+ [MonoTODO]
+ public string[] GetDateTimeFormats(char format,IFormatProvider provider )
+ {
+ return null;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) ticks.Ticks;
+ }
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.DateTime;
+ }
+
+ public static bool IsLeapYear (int year)
+ {
+ return ( (year % 4 == 0 && year % 100 != 0) || year % 400 == 0) ;
+ }
+
+ public static DateTime Parse (string s)
+ {
+ return Parse (s, null);
+ }
+
+ public static DateTime Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, null, DateTimeStyles.AllowWhiteSpaces);
+ }
+
+ public static DateTime Parse (string s, IFormatProvider fp, DateTimeStyles styles)
+ {
+ string[] formats = {
+ // Full date and time
+ "F", "G", "r", "s", "u", "U",
+ // Full date and time, but no seconds
+ "f", "g",
+ // Only date
+ "d", "D",
+ // Only time
+ "T", "t",
+ // Only date, but no year
+ "m",
+ // Only date, but no day
+ "y"
+ };
+
+ return ParseExact (s, formats, fp, styles);
+ }
+
+ public static DateTime ParseExact (string s, string format, IFormatProvider fp)
+ {
+ return ParseExact (s, format, fp, DateTimeStyles.None);
+ }
+
+ internal static int _ParseNumber (string s, int digits, bool leadingzero,
+ bool sloppy_parsing, out int num_parsed)
+ {
+ int number = 0, i;
+
+ if (sloppy_parsing)
+ leadingzero = false;
+
+ if (!leadingzero) {
+ int real_digits = 0;
+ for (i = 0; i < s.Length; i++) {
+ if (!Char.IsDigit (s[i]))
+ break;
+
+ real_digits++;
+ }
+
+ digits = real_digits;
+ }
+
+ if (s.Length < digits) {
+ num_parsed = -1;
+ return 0;
+ }
+
+ for (i = 0; i < digits; i++) {
+ char c = s[i];
+ if (!Char.IsDigit (c)) {
+ num_parsed = -1;
+ return 0;
+ }
+
+ number = number * 10 + (byte) (c - '0');
+ }
+
+ num_parsed = digits;
+ return number;
+ }
+
+ internal static int _ParseEnum (string s, string[] values, out int num_parsed)
+ {
+ int i;
+
+ for (i = 0; i < values.Length; i++) {
+ if (s.Length < values[i].Length)
+ continue;
+ String tmp = s.Substring (0, values[i].Length);
+ if (String.Compare (tmp, values[i], true) == 0) {
+ num_parsed = values[i].Length;
+ return i;
+ }
+ }
+
+ num_parsed = -1;
+ return -1;
+ }
+
+ internal static bool _ParseString (string s, int maxlength, string value, out int num_parsed)
+ {
+ if (maxlength > 0)
+ value = value.Substring (0, maxlength);
+
+ s = s.Substring (0, value.Length);
+
+ if (String.Compare (s, value, true) == 0) {
+ num_parsed = value.Length;
+ return true;
+ }
+
+ num_parsed = -1;
+ return false;
+ }
+
+ internal static bool _DoParse (string s, string format, bool exact,
+ out DateTime result,
+ DateTimeFormatInfo dfi,
+ DateTimeStyles style)
+ {
+ bool useutc = false, use_localtime = true;
+ bool sloppy_parsing = false;
+
+ if (format.Length == 1)
+ format = _GetStandardPattern (format[0], dfi, out useutc);
+
+ if ((style & DateTimeStyles.AllowLeadingWhite) != 0) {
+ format = format.TrimStart (null);
+ s = s.TrimStart (null);
+ }
+
+ if ((style & DateTimeStyles.AllowTrailingWhite) != 0) {
+ format = format.TrimEnd (null);
+ s = s.TrimEnd (null);
+ }
+
+ if ((style & DateTimeStyles.AllowInnerWhite) != 0)
+ sloppy_parsing = true;
+
+ char[] chars = format.ToCharArray ();
+ int len = format.Length, pos = 0, num = 0;
+
+ int day = -1, dayofweek = -1, month = -1, year = -1;
+ int hour = -1, minute = -1, second = -1, millisecond = -1;
+ int ampm = -1;
+ int tzsign = -1, tzoffset = -1, tzoffmin = -1;
+
+ result = new DateTime (0);
+ while (pos+num < len)
+ {
+ if (s.Length == 0)
+ break;
+
+ if (Char.IsWhiteSpace (s[0])) {
+ s = s.Substring (1);
+
+ if (Char.IsWhiteSpace (chars[pos])) {
+ pos++;
+ continue;
+ }
+
+ if ((style & DateTimeStyles.AllowInnerWhite) == 0)
+ return false;
+ }
+
+ if (chars[pos] == '\'') {
+ num = 1;
+ while (pos+num < len) {
+ if (chars[pos+num] == '\'')
+ break;
+
+ if (s.Length == 0)
+ return false;
+ if (s[0] != chars[pos+num])
+ return false;
+ s = s.Substring (1);
+
+ num++;
+ }
+ if (pos+num > len)
+ return false;
+
+ pos += num + 1;
+ num = 0;
+ continue;
+ } else if (chars[pos] == '\\') {
+ if (pos+1 >= len)
+ return false;
+
+ if (s[0] != chars[pos+num])
+ return false;
+ s = s.Substring (1);
+ if (s.Length == 0)
+ return false;
+
+ pos++;
+ continue;
+ } else if (chars[pos] == '%') {
+ pos++;
+ continue;
+ }
+
+ if ((pos+num+1 < len) && (chars[pos+num+1] == chars[pos+num])) {
+ num++;
+ continue;
+ }
+
+ int num_parsed = 0;
+
+ switch (chars[pos])
+ {
+ case 'd':
+ if (day != -1)
+ return false;
+ if (num == 0)
+ day = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else if (num == 1)
+ day = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ else if (num == 2)
+ dayofweek = _ParseEnum (s, dfi.AbbreviatedDayNames, out num_parsed);
+ else
+ {
+ dayofweek = _ParseEnum (s, dfi.DayNames, out num_parsed);
+ num = 3;
+ }
+ break;
+ case 'M':
+ if (month != -1)
+ return false;
+ if (num == 0)
+ month = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else if (num == 1)
+ month = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ else if (num == 2)
+ month = _ParseEnum (s, dfi.AbbreviatedMonthNames , out num_parsed) + 1;
+ else
+ {
+ month = _ParseEnum (s, dfi.MonthNames, out num_parsed) + 1;
+ num = 3;
+ }
+ break;
+ case 'y':
+ if (year != -1)
+ return false;
+ if (num == 0) {
+ year = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ year += (year < 30) ? 2000 : 1900;
+ } else if (num < 3) {
+ year = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ year += (year < 30) ? 2000 : 1900;
+ } else {
+ year = _ParseNumber (s, 4, false, sloppy_parsing, out num_parsed);
+ num = 3;
+ }
+
+ if (year != 0 && (year < 1 || year > 9999))
+ throw new ArgumentOutOfRangeException ("year", "Valid " +
+ "values are between 1 and 9999 inclusive");
+ break;
+ case 'h':
+ if (hour != -1)
+ return false;
+ if (num == 0)
+ hour = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ hour = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+
+ if (hour >= 12)
+ return false;
+
+ break;
+ case 'H':
+ if ((hour != -1) || (ampm >= 0))
+ return false;
+ if (num == 0)
+ hour = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ hour = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (hour >= 24)
+ return false;
+
+ ampm = -2;
+ break;
+ case 'm':
+ if (minute != -1)
+ return false;
+ if (num == 0)
+ minute = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ minute = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (minute >= 60)
+ return false;
+
+ break;
+ case 's':
+ if (second != -1)
+ return false;
+ if (num == 0)
+ second = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ second = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (second >= 60)
+ return false;
+
+ break;
+ case 'f':
+ if (millisecond != -1)
+ return false;
+ num = Math.Min (num, 6);
+ millisecond = _ParseNumber (s, num+1, true, sloppy_parsing, out num_parsed);
+ if (millisecond >= 1000)
+ return false;
+ break;
+ case 't':
+ if (ampm != -1)
+ return false;
+ if (num == 0)
+ {
+ if (_ParseString (s, 1, dfi.AMDesignator, out num_parsed))
+ ampm = 0;
+ else if (_ParseString (s, 1, dfi.PMDesignator, out num_parsed))
+ ampm = 1;
+ else
+ return false;
+ }
+ else
+ {
+ if (_ParseString (s, 0, dfi.AMDesignator, out num_parsed))
+ ampm = 0;
+ else if (_ParseString (s, 0, dfi.PMDesignator, out num_parsed))
+ ampm = 1;
+ else
+ return false;
+ num = 1;
+ }
+ break;
+ case 'z':
+ if (tzsign != -1)
+ return false;
+ if (s[0] == '+')
+ tzsign = 0;
+ else if (s[0] == '-')
+ tzsign = 1;
+ else
+ return false;
+ s = s.Substring (1);
+ if (num == 0)
+ tzoffset = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else if (num == 1)
+ tzoffset = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ else
+ {
+ tzoffset = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ if (num_parsed < 0)
+ return false;
+ s = s.Substring (num_parsed);
+ if (!_ParseString (s, 0, dfi.TimeSeparator, out num_parsed))
+ return false;
+ s = s.Substring (num_parsed);
+ tzoffmin = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ if (num_parsed < 0)
+ return false;
+ num = 2;
+ }
+ break;
+ case ':':
+ if (!_ParseString (s, 0, dfi.TimeSeparator, out num_parsed))
+ return false;
+ break;
+ case '/':
+ if (!_ParseString (s, 0, dfi.DateSeparator, out num_parsed))
+ return false;
+ break;
+ default:
+ if (s[0] != chars[pos])
+ return false;
+ num = 0;
+ num_parsed = 1;
+ break;
+ }
+
+ if (num_parsed < 0)
+ return false;
+
+ s = s.Substring (num_parsed);
+
+ pos = pos + num + 1;
+ num = 0;
+ }
+
+ if (hour == -1)
+ hour = 0;
+ if (minute == -1)
+ minute = 0;
+ if (second == -1)
+ second = 0;
+ if (millisecond == -1)
+ millisecond = 0;
+
+ // If no date was given
+ if ((day == -1) && (month == -1) && (year == -1)) {
+ if ((style & DateTimeStyles.NoCurrentDateDefault) != 0) {
+ day = 1;
+ month = 1;
+ year = 1;
+ } else {
+ day = Today.Day;
+ month = Today.Month;
+ year = Today.Year;
+ }
+ }
+
+ if (day == -1)
+ day = 1;
+ if (month == -1)
+ month = 1;
+ if (year == -1) {
+ if ((style & DateTimeStyles.NoCurrentDateDefault) != 0)
+ year = 1;
+ else
+ year = Today.Year;
+ }
+
+ if (ampm == 1)
+ hour = hour + 12;
+
+ result = new DateTime (year, month, day, hour, minute, second, millisecond);
+
+ if ((dayofweek != -1) && (dayofweek != (int) result.DayOfWeek))
+ throw new FormatException (Locale.GetText ("String was not recognized as valid DateTime because the day of week was incorrect."));
+
+ // If no timezone was specified, default to the local timezone.
+ TimeSpan utcoffset;
+ if (useutc)
+ utcoffset = new TimeSpan (0, 0, 0);
+ else if (tzsign == -1) {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+ utcoffset = tz.GetUtcOffset (result);
+ } else {
+ if ((style & DateTimeStyles.AdjustToUniversal) != 0)
+ use_localtime = false;
+
+ if (tzoffmin == -1)
+ tzoffmin = 0;
+ if (tzoffset == -1)
+ tzoffset = 0;
+ if (tzsign == 1)
+ tzoffset = -tzoffset;
+
+ utcoffset = new TimeSpan (tzoffset, tzoffmin, 0);
+ }
+
+ long newticks = (result.ticks - utcoffset).Ticks;
+
+ result = new DateTime (use_localtime, newticks);
+
+ return true;
+ }
+
+
+ public static DateTime ParseExact (string s, string format,
+ IFormatProvider fp, DateTimeStyles style)
+ {
+ string[] formats;
+
+ formats = new string [1];
+ formats[0] = format;
+
+ return ParseExact (s, formats, fp, style);
+ }
+
+ public static DateTime ParseExact (string s, string[] formats,
+ IFormatProvider fp,
+ DateTimeStyles style)
+ {
+ DateTimeFormatInfo dfi = DateTimeFormatInfo.GetInstance (fp);
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+ if (formats.Length == 0)
+ throw new ArgumentNullException (Locale.GetText ("format is null"));
+
+ int i;
+ for (i = 0; i < formats.Length; i++)
+ {
+ DateTime result;
+
+ if (_DoParse (s, formats[i], true, out result, dfi, style))
+ return result;
+ }
+
+ throw new FormatException ();
+ }
+
+ public TimeSpan Subtract(DateTime dt)
+ {
+ return new TimeSpan(ticks.Ticks) - dt.ticks;
+ }
+
+ public DateTime Subtract(TimeSpan ts)
+ {
+ TimeSpan newticks;
+
+ newticks = (new TimeSpan (ticks.Ticks)) - ts;
+ return new DateTime(true,newticks);
+ }
+
+ public long ToFileTime()
+ {
+ if(ticks.Ticks < w32file_epoch) {
+ throw new ArgumentOutOfRangeException("file time is not valid");
+ }
+
+ return(ticks.Ticks - w32file_epoch);
+ }
+
+ public string ToLongDateString()
+ {
+ return ToString ("D");
+ }
+
+ public string ToLongTimeString()
+ {
+ return ToString ("T");
+ }
+
+ [MonoTODO]
+ public double ToOADate()
+ {
+ // TODO implement me
+ return 0;
+ }
+
+ public string ToShortDateString()
+ {
+ return ToString ("d");
+ }
+
+ public string ToShortTimeString()
+ {
+ return ToString ("t");
+ }
+
+ public override string ToString ()
+ {
+ return ToString ("G", null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ internal static string _GetStandardPattern (char format, DateTimeFormatInfo dfi, out bool useutc)
+ {
+ String pattern;
+
+ useutc = false;
+
+ switch (format)
+ {
+ case 'd':
+ pattern = dfi.ShortDatePattern;
+ break;
+ case 'D':
+ pattern = dfi.LongDatePattern;
+ break;
+ case 'f':
+ pattern = dfi.LongDatePattern + " " + dfi.ShortTimePattern;
+ break;
+ case 'F':
+ pattern = dfi.FullDateTimePattern;
+ break;
+ case 'g':
+ pattern = dfi.ShortDatePattern + " " + dfi.ShortTimePattern;
+ break;
+ case 'G':
+ pattern = dfi.ShortDatePattern + " " + dfi.LongTimePattern;
+ break;
+ case 'm':
+ case 'M':
+ pattern = dfi.MonthDayPattern;
+ break;
+ case 'r':
+ case 'R':
+ pattern = dfi.RFC1123Pattern;
+ // commented by LP 09/jun/2002, rfc 1123 pattern is always in GMT
+ // useutc= true;
+ break;
+ case 's':
+ pattern = dfi.SortableDateTimePattern;
+ break;
+ case 't':
+ pattern = dfi.ShortTimePattern;
+ break;
+ case 'T':
+ pattern = dfi.LongTimePattern;
+ break;
+ case 'u':
+ pattern = dfi.UniversalSortableDateTimePattern;
+ useutc = true;
+ break;
+ case 'U':
+ pattern = dfi.LongDatePattern + " " + dfi.LongTimePattern;
+ useutc = true;
+ break;
+ case 'y':
+ case 'Y':
+ pattern = dfi.YearMonthPattern;
+ break;
+ default:
+ pattern = null;
+ break;
+ }
+
+ return pattern;
+ }
+
+ internal string _ToString (string format, DateTimeFormatInfo dfi)
+ {
+ String str = null, result = null;
+ char[] chars = format.ToCharArray ();
+ int len = format.Length, pos = 0, num = 0;
+
+ TimeZone tz = TimeZone.CurrentTimeZone;
+ TimeSpan utcoffset = tz.GetUtcOffset (this);
+
+ while (pos < len)
+ {
+ if (chars[pos] == '\'') {
+ num = 1;
+ while (pos+num <= len) {
+ if (chars[pos+num] == '\'')
+ break;
+
+ result += chars[pos+num];
+ num++;
+ }
+ if (pos+num > len)
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+
+ pos += num+1;
+ num = 0;
+ continue;
+ } else if (chars[pos] == '\\') {
+ if (pos+1 >= len)
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+
+ result += chars[pos+1];
+ pos += 2;
+ continue;
+ } else if (chars[pos] == '%') {
+ pos++;
+ continue;
+ }
+
+ if ((pos+num+1 < len) && (chars[pos+num+1] == chars[pos+num])) {
+ num++;
+ continue;
+ }
+
+ switch (chars[pos])
+ {
+ case 'd':
+ if (num == 0)
+ str = Day.ToString ("d");
+ else if (num == 1)
+ str = Day.ToString ("d02");
+ else if (num == 2)
+ str = dfi.GetAbbreviatedDayName (DayOfWeek);
+ else {
+ str = dfi.GetDayName (DayOfWeek);
+ num = 3;
+ }
+ break;
+ case 'M':
+ if (num == 0)
+ str = Month.ToString ("d");
+ else if (num == 1)
+ str = Month.ToString ("d02");
+ else if (num == 2)
+ str = dfi.GetAbbreviatedMonthName (Month);
+ else {
+ str = dfi.GetMonthName (Month);
+ num = 3;
+ }
+ break;
+ case 'y':
+ if (num == 0) {
+ int shortyear = Year % 100;
+ str = shortyear.ToString ("d");
+ } else if (num == 1) {
+ int shortyear = Year % 100;
+ str = shortyear.ToString ("d02");
+ } else {
+ str = Year.ToString ("d");
+ num = 3;
+ }
+ break;
+ case 'g':
+ // FIXME
+ break;
+ case 'f':
+ num = Math.Min (num, 6);
+
+ long ms = (long) Millisecond;
+ long exp = 10;
+ for (int i = 0; i < num; i++)
+ exp = exp * 10;
+ long maxexp = TimeSpan.TicksPerMillisecond;
+
+ exp = Math.Min (exp, maxexp);
+ ms = ms * exp / maxexp;
+
+ String prec = (num+1).ToString ("d02");
+ str = ms.ToString (String.Concat ("d", prec));
+
+ break;
+ case 'h':
+ if (num == 0) {
+ int shorthour = Hour % 12;
+ str = shorthour.ToString ("d");
+ } else {
+ int shorthour = Hour % 12;
+ str = shorthour.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 'H':
+ if (num == 0)
+ str = Hour.ToString ("d");
+ else {
+ str = Hour.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 'm':
+ if (num == 0)
+ str = Minute.ToString ("d");
+ else {
+ str = Minute.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 's':
+ if (num == 0)
+ str = Second.ToString ("d");
+ else {
+ str = Second.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 't':
+ if (Hour < 12)
+ str = dfi.AMDesignator;
+ else
+ str = dfi.PMDesignator;
+
+ if (num == 0)
+ str = str.Substring (0,1);
+ else
+ num = 1;
+ break;
+ case 'z':
+ if (num == 0) {
+ int offset = utcoffset.Hours;
+ str = offset.ToString ("d");
+ if (offset > 0)
+ str = String.Concat ("+", str);
+ } else if (num == 1) {
+ int offset = utcoffset.Hours;
+ str = offset.ToString ("d02");
+ if (offset > 0)
+ str = String.Concat ("+", str);
+ } else if (num == 2) {
+ int offhour = utcoffset.Hours;
+ int offminute = utcoffset.Minutes;
+ str = offhour.ToString ("d02");
+ str = String.Concat (str, dfi.TimeSeparator);
+ str = String.Concat (str, offminute.ToString ("d02"));
+ if (offhour > 0)
+ str = String.Concat ("+", str);
+ num = 2;
+ }
+ break;
+ case ':':
+ str = dfi.TimeSeparator;
+ num = 0;
+ break;
+ case '/':
+ str = dfi.DateSeparator;
+ num = 0;
+ break;
+ default:
+ str = String.Concat (chars [pos]);
+ num = 0;
+ break;
+ }
+
+ result = String.Concat (result, str);
+
+ pos += num + 1;
+ num = 0;
+ }
+
+ return result;
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ DateTimeFormatInfo dfi = DateTimeFormatInfo.GetInstance(fp);
+
+ if (format == null)
+ format = dfi.FullDateTimePattern;
+
+ bool useutc = false;
+
+ if (format.Length == 1) {
+ char fchar = (format.ToCharArray ())[0];
+ format = _GetStandardPattern (fchar, dfi, out useutc);
+ }
+
+ if (useutc)
+ return this.ToUniversalTime ()._ToString (format, dfi);
+ else
+ return this._ToString (format, dfi);
+ }
+
+ public DateTime ToLocalTime()
+ {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+
+ TimeSpan offset = tz.GetUtcOffset (this);
+
+ return new DateTime (true, ticks + offset);
+ }
+
+ public DateTime ToUniversalTime()
+ {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+
+ TimeSpan offset = tz.GetUtcOffset (this);
+
+ return new DateTime (true, ticks - offset);
+ }
+
+ /* OPERATORS */
+
+ public static DateTime operator +(DateTime d, TimeSpan t)
+ {
+ return new DateTime (true, d.ticks + t);
+ }
+
+ public static bool operator ==(DateTime d1, DateTime d2)
+ {
+ return (d1.ticks == d2.ticks);
+ }
+
+ public static bool operator >(DateTime t1,DateTime t2)
+ {
+ return (t1.ticks > t2.ticks);
+ }
+
+ public static bool operator >=(DateTime t1,DateTime t2)
+ {
+ return (t1.ticks >= t2.ticks);
+ }
+
+ public static bool operator !=(DateTime d1, DateTime d2)
+ {
+ return (d1.ticks != d2.ticks);
+ }
+
+ public static bool operator <(DateTime t1, DateTime t2)
+ {
+ return (t1.ticks < t2.ticks );
+ }
+
+ public static bool operator <=(DateTime t1,DateTime t2)
+ {
+ return (t1.ticks <= t2.ticks);
+ }
+
+ public static TimeSpan operator -(DateTime d1,DateTime d2)
+ {
+ return new TimeSpan((d1.ticks - d2.ticks).Ticks);
+ }
+
+ public static DateTime operator -(DateTime d,TimeSpan t)
+ {
+ return new DateTime (true, d.ticks - t);
+ }
+
+ bool IConvertible.ToBoolean(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ byte IConvertible.ToByte(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ char IConvertible.ToChar(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ // TODO Implement me
+ [MonoTODO]
+ public System.DateTime ToDateTime(IFormatProvider provider)
+ {
+ return new System.DateTime(true,this.ticks);
+ }
+
+ decimal IConvertible.ToDecimal(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ double IConvertible.ToDouble(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ Int16 IConvertible.ToInt16(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ Int32 IConvertible.ToInt32(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ Int64 IConvertible.ToInt64(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ SByte IConvertible.ToSByte(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ Single IConvertible.ToSingle(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ object IConvertible.ToType(Type conversionType,IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ UInt16 IConvertible.ToUInt16(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ UInt32 IConvertible.ToUInt32(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ UInt64 IConvertible.ToUInt64(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+ }
+}
+
+namespace System
+{
+ public enum DayOfWeek
+ {
+ Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday
+ }
+}
diff --git a/mcs/class/corlib/System/Decimal.cs b/mcs/class/corlib/System/Decimal.cs
new file mode 100644
index 00000000000..46e8a807422
--- /dev/null
+++ b/mcs/class/corlib/System/Decimal.cs
@@ -0,0 +1,1225 @@
+//
+// System.Decimal.cs
+//
+// Represents a floating-point decimal data type with up to 29
+// significant digits, suitable for financial and commercial calculations.
+//
+// Author:
+// Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) 2001 Martin Weindel
+//
+
+using System;
+using System.Globalization;
+using System.Text;
+using System.Runtime.CompilerServices;
+#if MSTEST
+using System.Runtime.InteropServices;
+#endif
+
+
+namespace System
+{
+ /// <summary>
+ /// Represents a floating-point decimal data type with up to 29 significant
+ /// digits, suitable for financial and commercial calculations
+ /// </summary>
+ [Serializable]
+ public struct Decimal: IComparable, IFormattable, IConvertible
+ {
+ // LAMESPEC: the attributes aren't mentioned, but show up in CorCompare
+ // Unfortunately, corcompare starts throwing security exceptions when
+ // these attributes are present...
+
+ [DecimalConstantAttribute(0, 1, unchecked((uint)-1), unchecked((uint)-1), unchecked((uint)-1))]
+ public static readonly Decimal MinValue = new Decimal(-1, -1, -1, true, 0);
+ [DecimalConstantAttribute(0, 0, unchecked((uint)-1), unchecked((uint)-1), unchecked((uint)-1))]
+ public static readonly Decimal MaxValue = new Decimal(-1, -1, -1, false, 0);
+ [DecimalConstantAttribute(0, 1, 0, 0, 1)]
+ public static readonly Decimal MinusOne = new Decimal(1, 0, 0, true, 0);
+ [DecimalConstantAttribute(0, 0, 0, 0, 1)]
+ public static readonly Decimal One = new Decimal(1, 0, 0, false, 0);
+ [DecimalConstantAttribute(0, 0, 0, 0, 0)]
+ public static readonly Decimal Zero = new Decimal(0, 0, 0, false, 0);
+
+ // maximal decimal value as double
+ private static readonly double dDecMaxValue = 7.922816251426433759354395033e28;
+ // epsilon decimal value as double
+ private static readonly double dDecEpsilon = 0.5e-28; // == 0.5 * 1 / 10^28
+
+ // some constants
+ private const int DECIMAL_DIVIDE_BY_ZERO = 5;
+ private const uint MAX_SCALE = 28;
+ private const int iMAX_SCALE = 28;
+ private const uint SIGN_FLAG = 0x80000000;
+ private const uint SCALE_MASK = 0x00FF0000;
+ private const int SCALE_SHIFT = 16;
+ private const uint RESERVED_SS32_BITS = 0x7F00FFFF;
+
+ // internal representation of decimal
+ private uint ss32;
+ private uint hi32;
+ private uint lo32;
+ private uint mid32;
+
+ // LAMESPEC: this constructor is missing in specification
+ // but exists in MS Csharp implementation
+ public Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
+ {
+ unchecked
+ {
+ lo32 = (uint) lo;
+ mid32 = (uint) mid;
+ hi32 = (uint) hi;
+
+ if (scale > MAX_SCALE)
+ {
+ throw new ArgumentOutOfRangeException (Locale.GetText ("scale must be between 0 and 28"));
+ }
+
+ ss32 = scale;
+ ss32 <<= SCALE_SHIFT;
+ if (isNegative) ss32 |= SIGN_FLAG;
+ }
+ }
+
+ public Decimal(int val)
+ {
+ unchecked
+ {
+ hi32 = mid32 = 0;
+ if (val < 0)
+ {
+ ss32 = SIGN_FLAG;
+ lo32 = ((uint)~val) + 1;
+ }
+ else
+ {
+ ss32 = 0;
+ lo32 = (uint) val;
+ }
+ }
+ }
+
+ [CLSCompliant(false)]
+ public Decimal(uint val)
+ {
+ lo32 = val;
+ ss32 = hi32 = mid32 = 0;
+ }
+
+ public Decimal(long val)
+ {
+ unchecked
+ {
+ hi32 = 0;
+ if (val < 0)
+ {
+ ss32 = SIGN_FLAG;
+ ulong u = ((ulong)~val) + 1;
+ lo32 = (uint)u;
+ mid32 = (uint)(u >> 32);
+ }
+ else
+ {
+ ss32 = 0;
+ ulong u = (ulong)val;
+ lo32 = (uint)u;
+ mid32 = (uint)(u >> 32);
+ }
+ }
+ }
+
+ [CLSCompliant(false)]
+ public Decimal(ulong uval)
+ {
+ unchecked
+ {
+ ss32 = hi32 = 0;
+ lo32 = (uint)uval;
+ mid32 = (uint)(uval >> 32);
+ }
+ }
+
+ public Decimal(float val)
+ {
+ if (double2decimal(out this, val, 7) != 0)
+ {
+ throw new OverflowException();
+ }
+ }
+
+ public Decimal(double val)
+ {
+ if (double2decimal(out this, val, 15) != 0)
+ {
+ throw new OverflowException();
+ }
+ }
+
+ public Decimal(int[] bits)
+ {
+ if (bits == null)
+ {
+ throw new ArgumentNullException(Locale.GetText ("Bits is a null reference"));
+ }
+
+ if (bits.GetLength(0) != 4)
+ {
+ throw new ArgumentException(Locale.GetText ("bits does not contain four values"));
+ }
+
+ unchecked {
+ lo32 = (uint) bits[0];
+ mid32 = (uint) bits[1];
+ hi32 = (uint) bits[2];
+ ss32 = (uint) bits[3];
+ byte scale = (byte)(ss32 >> SCALE_SHIFT);
+ if (scale > MAX_SCALE || (ss32 & RESERVED_SS32_BITS) != 0)
+ {
+ throw new ArgumentException(Locale.GetText ("Invalid bits[3]"));
+ }
+ }
+ }
+
+ [MonoTODO]
+ public static decimal FromOACurrency(long cy)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static int[] GetBits(Decimal d)
+ {
+ unchecked
+ {
+ return new int[] { (int)d.lo32, (int)d.mid32, (int)d.hi32,
+ (int)d.ss32 };
+ }
+ }
+
+ public static Decimal Negate(Decimal d)
+ {
+ d.ss32 ^= SIGN_FLAG;
+ return d;
+ }
+
+
+ public static Decimal Add(Decimal d1, Decimal d2)
+ {
+ if (decimalIncr(ref d1, ref d2) == 0)
+ return d1;
+ else
+ throw new OverflowException(Locale.GetText ("Overflow on adding decimal number"));
+ }
+
+ public static Decimal Subtract(Decimal d1, Decimal d2)
+ {
+ d2.ss32 ^= SIGN_FLAG;
+ int result = decimalIncr(ref d1, ref d2);
+ if (result == 0)
+ return d1;
+ else
+ throw new OverflowException(Locale.GetText ("Overflow on subtracting decimal numbers ("+result+")"));
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)lo32;
+ }
+
+ public static Decimal operator +(Decimal d1, Decimal d2)
+ {
+ return Add(d1, d2);
+ }
+
+ public static Decimal operator --(Decimal d)
+ {
+ return Add(d, MinusOne);
+ }
+
+ public static Decimal operator ++(Decimal d)
+ {
+ return Add(d, One);
+ }
+
+ public static Decimal operator -(Decimal d1, Decimal d2)
+ {
+ return Subtract(d1, d2);
+ }
+
+ public static Decimal operator -(Decimal d)
+ {
+ return Negate(d);
+ }
+
+ public static Decimal operator +(Decimal d)
+ {
+ return d;
+ }
+
+ public static Decimal operator *(Decimal d1, Decimal d2)
+ {
+ return Multiply(d1, d2);
+ }
+
+ public static Decimal operator /(Decimal d1, Decimal d2)
+ {
+ return Divide(d1, d2);
+ }
+
+ public static Decimal operator %(Decimal d1, Decimal d2)
+ {
+ return Remainder(d1, d2);
+ }
+
+ public static explicit operator byte(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Byte.MaxValue || result < Byte.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (byte) result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator sbyte(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > SByte.MaxValue || result < SByte.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (sbyte) result;
+ }
+
+ public static explicit operator char(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Char.MaxValue || result < Char.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (char) result;
+ }
+
+ public static explicit operator short(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Int16.MaxValue || result < Int16.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (short) result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator ushort(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > UInt16.MaxValue || result < UInt16.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (ushort) result;
+ }
+
+ public static explicit operator int(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Int32.MaxValue || result < Int32.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (int) result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator uint(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > UInt32.MaxValue || result < UInt32.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (uint) result;
+ }
+
+ public static explicit operator long(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ return result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator ulong(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ return result;
+ }
+
+ public static implicit operator Decimal(byte val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(sbyte val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(short val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(ushort val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(char val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(int val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(uint val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(long val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(ulong val)
+ {
+ return new Decimal(val);
+ }
+
+ public static explicit operator Decimal(float val)
+ {
+ return new Decimal(val);
+ }
+
+ public static explicit operator Decimal(double val)
+ {
+ return new Decimal(val);
+ }
+
+ public static explicit operator float(Decimal val)
+ {
+ return (float) (double) val;
+ }
+
+ public static explicit operator double(Decimal val)
+ {
+ return decimal2double(ref val);
+ }
+
+
+ public static bool operator !=(Decimal d1, Decimal d2)
+ {
+ return !Equals(d1, d2);
+ }
+
+ public static bool operator ==(Decimal d1, Decimal d2)
+ {
+ return Equals(d1, d2);
+ }
+
+ public static bool operator >(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) > 0;
+ }
+
+ public static bool operator >=(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) >= 0;
+ }
+
+ public static bool operator <(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) < 0;
+ }
+
+ public static bool operator <=(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) <= 0;
+ }
+
+ public static bool Equals(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) == 0;
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is Decimal))
+ return false;
+
+ return Equals((Decimal) o, this);
+ }
+
+ public static Decimal Floor(Decimal d)
+ {
+ decimalFloorAndTrunc(ref d, 1);
+ return d;
+ }
+
+ public static Decimal Truncate(Decimal d)
+ {
+ decimalFloorAndTrunc(ref d, 0);
+ return d;
+ }
+
+ public static Decimal Round(Decimal d, int decimals)
+ {
+ if (decimals < 0 || decimals > iMAX_SCALE)
+ {
+ throw new ArgumentOutOfRangeException(Locale.GetText ("decimals must be between 0 and 28"));
+ }
+
+ decimalRound(ref d, decimals);
+ return d;
+ }
+
+ public static Decimal Multiply(Decimal d1, Decimal d2)
+ {
+ if (decimalMult(ref d1, ref d2) != 0)
+ {
+ throw new OverflowException();
+ }
+
+ return d1;
+ }
+
+ public static Decimal Divide(Decimal d1, Decimal d2)
+ {
+ if (d1 == 0 && d2 != 0) return 0;
+
+ Decimal d3;
+ int rc = decimalDiv(out d3, ref d1, ref d2);
+
+ if (rc != 0)
+ {
+ if (rc == DECIMAL_DIVIDE_BY_ZERO)
+ throw new DivideByZeroException();
+ else
+ throw new OverflowException();
+ }
+
+ return d3;
+ }
+
+ public static Decimal Remainder(Decimal d1, Decimal d2)
+ {
+ Decimal d3;
+ int rc = decimalIntDiv(out d3, ref d1, ref d2);
+
+ if (rc != 0)
+ {
+ if (rc == DECIMAL_DIVIDE_BY_ZERO)
+ throw new DivideByZeroException();
+ else
+ throw new OverflowException();
+ }
+
+ return d1 - d3 * d2;
+ }
+
+ public static int Compare(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2);
+ }
+
+ public int CompareTo(object val)
+ {
+ if (val == null)
+ return 1;
+
+ if (!(val is Decimal))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Decimal"));
+
+ Decimal d2 = (Decimal)val;
+ return decimalCompare(ref this, ref d2);
+ }
+
+ public static Decimal Parse(string s)
+ {
+ return Parse(s, NumberStyles.Number, null);
+ }
+
+ public static Decimal Parse(string s, NumberStyles style)
+ {
+ return Parse(s, style, null);
+ }
+
+ public static Decimal Parse(string s, IFormatProvider provider)
+ {
+ return Parse(s, NumberStyles.Number, provider);
+ }
+
+ private static NumberFormatInfo GetNumberFormatInfoFromIFormatProvider(IFormatProvider provider)
+ {
+ NumberFormatInfo nfi = null;
+
+ if (provider != null)
+ {
+ nfi = (NumberFormatInfo) provider.GetFormat(typeof(System.Decimal));
+ if (nfi == null && provider is NumberFormatInfo)
+ {
+ nfi = (NumberFormatInfo) provider;
+ }
+ }
+
+ if (nfi == null)
+ {
+ nfi = NumberFormatInfo.CurrentInfo;
+ }
+
+ return nfi;
+ }
+
+ private static string stripStyles(string s, NumberStyles style, NumberFormatInfo nfi,
+ out int decPos, out bool isNegative, out bool expFlag, out int exp)
+ {
+ string invalidChar = Locale.GetText ("Invalid character at position ");
+ string invalidExponent = Locale.GetText ("Invalid exponent");
+ isNegative = false;
+ expFlag = false;
+ exp = 0;
+ decPos = -1;
+
+ bool hasSign = false;
+ bool hasOpeningParentheses = false;
+ bool hasDecimalPoint = false;
+ bool allowedLeadingWhiteSpace = ((style & NumberStyles.AllowLeadingWhite) != 0);
+ bool allowedTrailingWhiteSpace = ((style & NumberStyles.AllowTrailingWhite) != 0);
+ bool allowedLeadingSign = ((style & NumberStyles.AllowLeadingSign) != 0);
+ bool allowedTrailingSign = ((style & NumberStyles.AllowTrailingSign) != 0);
+ bool allowedParentheses = ((style & NumberStyles.AllowParentheses) != 0);
+ bool allowedThousands = ((style & NumberStyles.AllowThousands) != 0);
+ bool allowedDecimalPoint = ((style & NumberStyles.AllowDecimalPoint) != 0);
+ bool allowedExponent = ((style & NumberStyles.AllowExponent) != 0);
+
+ /* get rid of currency symbol */
+ bool hasCurrency = false;
+ if ((style & NumberStyles.AllowCurrencySymbol) != 0)
+ {
+ int index = s.IndexOf(nfi.CurrencySymbol);
+ if (index >= 0)
+ {
+ s = s.Remove(index, nfi.CurrencySymbol.Length);
+ hasCurrency = true;
+ }
+ }
+
+ string decimalSep = (hasCurrency) ? nfi.CurrencyDecimalSeparator : nfi.NumberDecimalSeparator;
+ string groupSep = (hasCurrency) ? nfi.CurrencyGroupSeparator : nfi.NumberGroupSeparator;
+
+ int pos = 0;
+ int len = s.Length;
+
+ StringBuilder sb = new StringBuilder(len);
+
+ // leading
+ while (pos < len)
+ {
+ char ch = s[pos];
+ if (Char.IsDigit(ch))
+ {
+ break; // end of leading
+ }
+ else if (allowedLeadingWhiteSpace && Char.IsWhiteSpace(ch))
+ {
+ pos++;
+ }
+ else if (allowedParentheses && ch == '(' && !hasSign && !hasOpeningParentheses)
+ {
+ hasOpeningParentheses = true;
+ hasSign = true;
+ isNegative = true;
+ pos++;
+ }
+ else if (allowedLeadingSign && ch == nfi.NegativeSign[0] && !hasSign)
+ {
+ int slen = nfi.NegativeSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.NegativeSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ isNegative = true;
+ pos += slen;
+ }
+ }
+ else if (allowedLeadingSign && ch == nfi.PositiveSign[0] && !hasSign)
+ {
+ int slen = nfi.PositiveSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.PositiveSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ pos += slen;
+ }
+ }
+ else if (allowedDecimalPoint && ch == decimalSep[0])
+ {
+ int slen = decimalSep.Length;
+ if (slen != 1 && s.IndexOf(decimalSep, pos, slen) != pos)
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ break;
+ }
+ else
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ }
+
+ if (pos == len)
+ throw new FormatException(Locale.GetText ("No digits found"));
+
+ // digits
+ while (pos < len)
+ {
+ char ch = s[pos];
+ if (Char.IsDigit(ch))
+ {
+ sb.Append(ch);
+ pos++;
+ }
+ else if (allowedThousands && ch == groupSep[0])
+ {
+ int slen = groupSep.Length;
+ if (slen != 1 && s.IndexOf(groupSep, pos, slen) != pos)
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ pos += slen;
+ }
+ else if (allowedDecimalPoint && ch == decimalSep[0] && !hasDecimalPoint)
+ {
+ int slen = decimalSep.Length;
+ if (slen == 1 || s.IndexOf(decimalSep, pos, slen) == pos)
+ {
+ decPos = sb.Length;
+ hasDecimalPoint = true;
+ pos += slen;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // exponent
+ if (pos < len)
+ {
+ char ch = s[pos];
+ if (allowedExponent && Char.ToUpper(ch) == 'E')
+ {
+ expFlag = true;
+ pos++; if (pos >= len) throw new FormatException(invalidExponent);
+ ch = s[pos];
+ bool isNegativeExp = false;
+ if (ch == nfi.PositiveSign[0])
+ {
+ int slen = nfi.PositiveSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.PositiveSign, pos, slen) == pos)
+ {
+ pos += slen; if (pos >= len) throw new FormatException(invalidExponent);
+ }
+ }
+ else if (ch == nfi.NegativeSign[0])
+ {
+ int slen = nfi.NegativeSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.NegativeSign, pos, slen) == pos)
+ {
+ pos += slen; if (pos >= len) throw new FormatException(invalidExponent);
+ isNegativeExp = true;
+ }
+ }
+ ch = s[pos];
+ if (!Char.IsDigit(ch)) throw new FormatException(invalidExponent);
+ exp = ch - '0';
+ pos++;
+ while (pos < len && Char.IsDigit(s[pos]))
+ {
+ exp *= 10;
+ exp += s[pos] - '0';
+ pos++;
+ }
+ if (isNegativeExp) exp *= -1;
+ }
+ }
+
+ // trailing
+ while (pos < len)
+ {
+ char ch = s[pos];
+ if (allowedTrailingWhiteSpace && Char.IsWhiteSpace(ch))
+ {
+ pos++;
+ }
+ else if (allowedParentheses && ch == ')' && hasOpeningParentheses)
+ {
+ hasOpeningParentheses = false;
+ pos++;
+ }
+ else if (allowedTrailingSign && ch == nfi.NegativeSign[0] && !hasSign)
+ {
+ int slen = nfi.NegativeSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.NegativeSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ isNegative = true;
+ pos += slen;
+ }
+ }
+ else if (allowedTrailingSign && ch == nfi.PositiveSign[0] && !hasSign)
+ {
+ int slen = nfi.PositiveSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.PositiveSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ pos += slen;
+ }
+ }
+ else
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ }
+
+ if (hasOpeningParentheses) throw new FormatException (
+ Locale.GetText ("Closing Parentheses not found"));
+
+ if (!hasDecimalPoint) decPos = sb.Length;
+
+ return sb.ToString();
+ }
+
+ public static Decimal Parse(string s, NumberStyles style, IFormatProvider provider)
+ {
+ NumberFormatInfo nfi = GetNumberFormatInfoFromIFormatProvider(provider);
+
+ if (s == null) throw new ArgumentNullException (Locale.GetText ("string s"));
+
+ int iDecPos, exp;
+ bool isNegative, expFlag;
+ s = stripStyles(s, style, nfi, out iDecPos, out isNegative, out expFlag, out exp);
+
+ if (iDecPos < 0)
+ throw new Exception (Locale.GetText ("Error in System.Decimal.Parse"));
+ uint decPos = (uint) iDecPos;
+
+ Decimal d;
+ int digits = s.Length;
+ int sign = (isNegative) ? 1 : 0;
+ if (string2decimal(out d, s, decPos, sign) != 0)
+ {
+ throw new OverflowException();
+ }
+
+ if (expFlag)
+ {
+ if (decimalSetExponent(ref d, exp) != 0)
+ throw new OverflowException();
+ }
+
+ return d;
+ }
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Decimal;
+ }
+
+ [MonoTODO]
+ public static byte ToByte(decimal value)
+ {
+ if(value < Byte.MinValue || value > Byte.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static double ToDouble(decimal d)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static short ToInt16(decimal value)
+ {
+ if(value < Int16.MinValue || value > Int16.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static int ToInt32(decimal d)
+ {
+ if(d < Int32.MinValue || d > Int32.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static long ToInt64(decimal d)
+ {
+ if(d < Int64.MinValue || d > Int64.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static long ToOACurrency(decimal value)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public static sbyte ToSByte(decimal value)
+ {
+ if(value < SByte.MinValue || value > SByte.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static float ToSingle(decimal d)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public static ushort ToUInt16(decimal value)
+ {
+ if(value < UInt16.MinValue || value > UInt16.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public static uint ToUInt32(decimal d)
+ {
+ if(d < 0 || d > UInt32.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public static ulong ToUInt64(decimal d)
+ {
+ if(d < 0 || d > UInt64.MaxValue) {
+ throw new OverflowException("Invalid value");
+ }
+ throw new NotImplementedException();
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return Convert.ToType (this, conversionType, provider);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return Convert.ToBoolean (this);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return Convert.ToByte (this);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ throw new InvalidCastException ();
+ }
+
+ [CLSCompliant (false)]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException ();
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return this;
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return Convert.ToDouble (this);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return Convert.ToInt16 (this);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return Convert.ToInt32 (this);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return Convert.ToInt64 (this);
+ }
+
+ [CLSCompliant (false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return Convert.ToSByte (this);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return Convert.ToSingle (this);
+ }
+
+ [CLSCompliant (false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return Convert.ToUInt16 (this);
+ }
+
+ [CLSCompliant (false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return Convert.ToUInt32 (this);
+ }
+
+ [CLSCompliant (false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return Convert.ToUInt64 (this);
+ }
+
+ public string ToString(string format, IFormatProvider provider)
+ {
+ NumberFormatInfo nfi = GetNumberFormatInfoFromIFormatProvider(provider);
+
+ if (format == null) format = "G";
+
+ return DecimalFormatter.NumberToString(format, nfi, this);
+ }
+
+ public override string ToString()
+ {
+ return ToString("G", null);
+ }
+
+ public string ToString(string format)
+ {
+ return ToString(format, null);
+ }
+
+ public string ToString(IFormatProvider provider)
+ {
+ return ToString("G", provider);
+ }
+
+#if !MSTEST
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimal2UInt64(ref Decimal val,
+ out ulong result);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimal2Int64(ref Decimal val,
+ out long result);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int double2decimal(out Decimal erg,
+ double val, int digits);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalIncr(ref Decimal d1, ref Decimal d2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int decimal2string(ref Decimal val,
+ int digits, int decimals, char[] bufDigits, int bufSize, out int decPos, out int sign);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int string2decimal(out Decimal val, String sDigits, uint decPos, int sign);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int decimalSetExponent(ref Decimal val, int exp);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern double decimal2double(ref Decimal val);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void decimalFloorAndTrunc(ref Decimal val,
+ int floorFlag);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void decimalRound(ref Decimal val, int decimals);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalMult(ref Decimal pd1, ref Decimal pd2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalIntDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalCompare(ref Decimal d1, ref Decimal d2);
+#else
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2UInt64")]
+ private static extern int decimal2UInt64(ref Decimal val,
+ out ulong result);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2Int64")]
+ private static extern int decimal2Int64(ref Decimal val,
+ out long result);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="double2decimal")]
+ private static extern int double2decimal(out Decimal erg,
+ double val, int digits);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalIncr")]
+ private static extern int decimalIncr(ref Decimal d1, ref Decimal d2);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2string")]
+ internal static extern int decimal2string(ref Decimal val,
+ int digits, int decimals,
+ [MarshalAs(UnmanagedType.LPWStr)]StringBuilder bufDigits,
+ int bufSize, out int decPos, out int sign);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="string2decimal")]
+ internal static extern int string2decimal(out Decimal val,
+ [MarshalAs(UnmanagedType.LPWStr)]String sDigits,
+ uint decPos, int sign);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalSetExponent")]
+ internal static extern int decimalSetExponent(ref Decimal val, int exp);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2double")]
+ private static extern double decimal2double(ref Decimal val);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalFloorAndTrunc")]
+ private static extern void decimalFloorAndTrunc(ref Decimal val,
+ int floorFlag);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalRound")]
+ private static extern void decimalRound(ref Decimal val, int decimals);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalMult")]
+ private static extern int decimalMult(ref Decimal pd1, ref Decimal pd2);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalDiv")]
+ private static extern int decimalDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalIntDiv")]
+ private static extern int decimalIntDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalCompare")]
+ private static extern int decimalCompare(ref Decimal d1, ref Decimal d2);
+
+#endif
+ }
+}
+
diff --git a/mcs/class/corlib/System/DecimalFormatter.cs b/mcs/class/corlib/System/DecimalFormatter.cs
new file mode 100644
index 00000000000..87d0c487fa5
--- /dev/null
+++ b/mcs/class/corlib/System/DecimalFormatter.cs
@@ -0,0 +1,382 @@
+//
+// System.DecimalFormatter.cs
+//
+// Author:
+// Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, Derek Holden dholden@draper.com
+//
+
+//
+// Internal class for formatting decimal numbers.
+
+using System.Globalization;
+using System.Text;
+using System;
+
+namespace System
+{
+
+ internal sealed class DecimalFormatter
+ {
+
+ private static bool ParseFormat (string format, out char specifier, out int precision)
+ {
+ precision = -1;
+ specifier = '\0';
+
+ int length = format.Length;
+ if (length < 1 || length > 3)
+ return false;
+
+ char[] chars = format.ToCharArray ();
+ specifier = Char.ToUpper(chars[0]);
+
+ if (length == 1)
+ return true;
+
+ if (length == 2)
+ {
+ if (chars[1] < '0' || chars[1] > '9')
+ return false;
+
+ precision = chars[1] - '0';
+ }
+ else
+ {
+ if (chars[1] < '0' || chars[2] < '0' || chars[1] > '9' || chars[2] > '9')
+ return false;
+
+ precision = (chars[1] - '0') * 10 + (chars[2] - '0');
+ }
+
+ return true;
+ }
+
+ public static string NumberToString(string format, NumberFormatInfo nfi, Decimal value)
+ {
+ char specifier;
+ int precision;
+ format = format.Trim ();
+ if (!DecimalFormatter.ParseFormat(format, out specifier, out precision))
+ {
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+ }
+
+ int digits = -1;
+ int decimals = 0;
+ // first calculate number of digits or decimals needed for format
+ switch (specifier)
+ {
+ case 'C':
+ decimals = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ break;
+ case 'F': goto case 'N';
+ case 'N':
+ decimals = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ break;
+ case 'G':
+ digits = (precision >= 0) ? precision : 0;
+ break;
+ case 'E':
+ digits = (precision >= 0) ? precision+1 : 7;
+ break;
+ case 'P':
+ decimals = (precision >= 0) ? precision+2 : nfi.PercentDecimalDigits+2;
+ break;
+ case 'Z':
+ digits = 0;
+ break;
+ }
+
+ // get digit string
+ const int bufSize = 40;
+ int decPos = 0, sign = 0;
+ char[] buf = new char[bufSize];
+ if (Decimal.decimal2string(ref value, digits, decimals, buf, bufSize, out decPos, out sign) != 0)
+ {
+ throw new FormatException(); // should never happen
+ }
+
+ string TempString = new String(buf);
+ TempString = TempString.Trim(new char[] {(char)0x0});
+ StringBuilder sb = new StringBuilder(TempString, TempString.Length);
+
+ if (sb.ToString () == String.Empty && decPos > 0 && sign == 0)
+ sb.Append ('0');
+
+ // now build the format
+ switch (specifier)
+ {
+ case 'C': return FormatCurrency(nfi, sb, decimals, decPos, sign);
+ case 'N': return FormatNumber(nfi, sb, decimals, decPos, sign);
+ case 'F': return FormatFixedPoint(nfi, sb, decimals, decPos, sign);
+ case 'G': return FormatGeneral(nfi, sb, digits, decPos, sign, format[0]);
+ case 'E': return FormatExponential(nfi, sb, digits, decPos, sign, format[0], true);
+ case 'P': return FormatPercent(nfi, sb, decimals, decPos, sign);
+ case 'Z': return FormatNormalized(nfi, sb, digits, decPos, sign);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+ }
+ }
+
+ private static string FormatFixedPoint(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ if (decimals > 0)
+ {
+ sb.Insert((decPos <= 0) ? 1 : decPos, nfi.NumberDecimalSeparator);
+ }
+
+ if (sign != 0)
+ {
+ sb.Insert(0, nfi.NegativeSign);
+ }
+
+ return sb.ToString();
+ }
+
+ private static string FormatExponential(NumberFormatInfo nfi, StringBuilder sb,
+ int digits, int decPos, int sign, char echar, bool exp3flag)
+ {
+ // insert decimal separator
+ if (digits > 1 || (digits == 0 && sb.Length > 1))
+ {
+ sb.Insert(1, nfi.NumberDecimalSeparator);
+ }
+
+ // insert sign
+ if (sign != 0)
+ {
+ sb.Insert(0, nfi.NegativeSign);
+ }
+
+ // append exponent
+ sb.Append(echar);
+ decPos--;
+ sb.Append((decPos >= 0) ? nfi.PositiveSign : nfi.NegativeSign);
+ if (decPos < 0) decPos *= -1;
+ if (exp3flag) sb.Append('0');
+ sb.Append((char)('0' + decPos/10));
+ sb.Append((char)('0' + decPos%10));
+
+ return sb.ToString();
+ }
+
+ private static string FormatGeneral(NumberFormatInfo nfi, StringBuilder sb,
+ int digits, int decPos, int sign, char gchar)
+ {
+ int dig = digits;
+ bool bFix = (digits == 0 && decPos >= -3) || (digits >= decPos && decPos >= -3 && digits != 0);
+
+ // remove trailing digits
+ while (sb.Length > 1 && (sb.Length > decPos || !bFix) && sb[sb.Length-1] == '0')
+ {
+ sb.Remove(sb.Length-1, 1);
+ if (dig != 0) dig--;
+ }
+
+ if (bFix)
+ {
+ while (decPos <= 0)
+ {
+ sb.Insert(0, '0');
+ if (dig != 0 && decPos != 0) dig++;
+ decPos++;
+ }
+ return FormatFixedPoint(nfi, sb, sb.Length - decPos, decPos, sign);
+ }
+ else
+ {
+ return FormatExponential(nfi, sb, dig, decPos, sign, (char)(gchar-2), false);
+ }
+ }
+
+ private static string FormatGroupAndDec(StringBuilder sb, int decimals, int decPos,
+ int[] groupSizes, string groupSeparator, string decSeparator)
+ {
+ int offset = 0;
+
+ // Groups
+ if (decPos > 0)
+ {
+ if (groupSizes != null)
+ {
+ int lastSize = 0;
+ int digitCount = 0;
+ for (int i = 0; i < groupSizes.GetLength(0); i++)
+ {
+ int size = groupSizes[i];
+ if (size > 0)
+ {
+ digitCount += size;
+ if (digitCount < decPos)
+ {
+ sb.Insert(decPos - digitCount, groupSeparator);
+ offset += groupSeparator.Length;
+ }
+ }
+ lastSize = size;
+ }
+
+ if (lastSize > 0)
+ {
+ while (true)
+ {
+ digitCount +=lastSize;
+ if (digitCount >= decPos) break;
+ sb.Insert(decPos - digitCount, groupSeparator);
+ offset += groupSeparator.Length;
+ }
+ }
+ }
+ }
+
+ if (decimals > 0)
+ {
+ sb.Insert(offset + ((decPos <= 0) ? 1 : decPos), decSeparator);
+ }
+
+ return sb.ToString();
+ }
+
+ private static string FormatNumber(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ string s = FormatGroupAndDec(sb, decimals, decPos,
+ nfi.NumberGroupSizes, nfi.NumberGroupSeparator, nfi.NumberDecimalSeparator);
+
+ // sign
+ if (sign != 0)
+ {
+ switch (nfi.NumberNegativePattern)
+ {
+ case 0:
+ return "(" + s + ")";
+ case 1:
+ return nfi.NegativeSign + s;
+ case 2:
+ return nfi.NegativeSign + " " + s;
+ case 3:
+ return s + nfi.NegativeSign;
+ case 4:
+ return s + " " + nfi.NegativeSign;
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid NumberNegativePattern"));
+ }
+ }
+ else
+ {
+ return s;
+ }
+ }
+
+ private static string FormatCurrency(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ string s = FormatGroupAndDec(sb, decimals, decPos,
+ nfi.CurrencyGroupSizes, nfi.CurrencyGroupSeparator, nfi.CurrencyDecimalSeparator);
+
+ if (sign != 0)
+ { // negative
+ switch (nfi.CurrencyNegativePattern)
+ {
+ case 0:
+ return "(" + nfi.CurrencySymbol + s + ")";
+ case 1:
+ return nfi.NegativeSign + nfi.CurrencySymbol + s;
+ case 2:
+ return nfi.CurrencySymbol + nfi.NegativeSign + s;
+ case 3:
+ return nfi.CurrencySymbol + s + nfi.NegativeSign;
+ case 4:
+ return "(" + s + nfi.CurrencySymbol + ")";
+ case 5:
+ return nfi.NegativeSign + s + nfi.CurrencySymbol;
+ case 6:
+ return s + nfi.NegativeSign + nfi.CurrencySymbol;
+ case 7:
+ return s + nfi.CurrencySymbol + nfi.NegativeSign;
+ case 8:
+ return nfi.NegativeSign + s + " " + nfi.CurrencySymbol;
+ case 9:
+ return nfi.NegativeSign + nfi.CurrencySymbol + " " + s;
+ case 10:
+ return s + " " + nfi.CurrencySymbol + nfi.NegativeSign;
+ case 11:
+ return nfi.CurrencySymbol + " " + s + nfi.NegativeSign;
+ case 12:
+ return nfi.CurrencySymbol + " " + nfi.NegativeSign + s;
+ case 13:
+ return s + nfi.NegativeSign + " " + nfi.CurrencySymbol;
+ case 14:
+ return "(" + nfi.CurrencySymbol + " " + s + ")";
+ case 15:
+ return "(" + s + " " + nfi.CurrencySymbol + ")";
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid CurrencyNegativePattern"));
+ }
+ }
+ else
+ {
+ switch (nfi.CurrencyPositivePattern)
+ {
+ case 0:
+ return nfi.CurrencySymbol + s;
+ case 1:
+ return s + nfi.CurrencySymbol;
+ case 2:
+ return nfi.CurrencySymbol + " " + s;
+ case 3:
+ return s + " " + nfi.CurrencySymbol;
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid CurrencyPositivePattern"));
+ }
+ }
+ }
+
+ private static string FormatPercent(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ string s = FormatGroupAndDec(sb, decimals, decPos+2,
+ nfi.PercentGroupSizes, nfi.PercentGroupSeparator, nfi.PercentDecimalSeparator);
+
+ if (sign != 0)
+ { // negative
+ switch (nfi.PercentNegativePattern)
+ {
+ case 0:
+ return nfi.NegativeSign + s + " " + nfi.PercentSymbol;
+ case 1:
+ return nfi.NegativeSign + s + nfi.PercentSymbol;
+ case 2:
+ return nfi.NegativeSign + nfi.PercentSymbol + s;
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid PercentNegativePattern"));
+ }
+ }
+ else
+ {
+ switch (nfi.PercentPositivePattern)
+ {
+ case 0:
+ return s + " " + nfi.PercentSymbol;
+ case 1:
+ return s + nfi.PercentSymbol;
+ case 2:
+ return nfi.PercentSymbol + s;
+ default:
+ throw new ArgumentException("Invalid PercentPositivePattern");
+ }
+ }
+ }
+
+ [MonoTODO]
+ private static string FormatNormalized(NumberFormatInfo nfi, StringBuilder sb,
+ int digits, int decPos, int sign)
+ {
+ //LAMESPEC: how should this format look like ? Is this a fixed point format ?
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs
new file mode 100644
index 00000000000..f945c806309
--- /dev/null
+++ b/mcs/class/corlib/System/Delegate.cs
@@ -0,0 +1,303 @@
+//
+// System.Delegate.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Runtime.CompilerServices;
+
+
+namespace System {
+
+ [MonoTODO]
+ public abstract class Delegate : ICloneable, ISerializable {
+ protected Type target_type;
+ protected object m_target;
+ protected string method_name;
+ protected IntPtr method_ptr;
+ protected IntPtr delegate_trampoline;
+ protected MethodInfo method_info;
+
+ protected Delegate (object target, string method)
+ {
+ if (target == null)
+ throw new ArgumentNullException (Locale.GetText ("Target object is null"));
+
+ if (method == null)
+ throw new ArgumentNullException (Locale.GetText ("method name is null"));
+
+ this.target_type = null;
+ this.method_ptr = IntPtr.Zero;
+ this.m_target = target;
+ this.method_name = method;
+ }
+
+ protected Delegate (Type target_type, string method)
+ {
+ if (m_target == null)
+ throw new ArgumentNullException (Locale.GetText ("Target type is null"));
+
+ if (method == null)
+ throw new ArgumentNullException (Locale.GetText ("method string is null"));
+
+ this.target_type = target_type;
+ this.method_ptr = IntPtr.Zero;
+ this.m_target = null;
+ this.method_name = method;
+ }
+
+ public MethodInfo Method {
+ get {
+ return method_info;
+ }
+ }
+
+ public object Target {
+ get {
+ return m_target;
+ }
+ }
+
+ //
+ // Methods
+ //
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern Delegate CreateDelegate_internal (Type type, object target, MethodInfo info);
+
+ public static Delegate CreateDelegate (Type type, MethodInfo info)
+ {
+ if (type == null)
+ throw new ArgumentNullException (Locale.GetText ("Type is null"));
+
+ if (info == null)
+ throw new ArgumentNullException (Locale.GetText ("MethodInfo is null"));
+
+ if (!type.IsSubclassOf (typeof (MulticastDelegate)))
+ throw new ArgumentException ("type");
+
+ ParameterInfo[] delargs = type.GetMethod ("Invoke").GetParameters ();
+ Type[] delargtypes = new Type [delargs.Length];
+ ParameterInfo[] args = info.GetParameters ();
+
+ for (int i=0; i<delargs.Length; i++)
+ delargtypes [i] = delargs [i].ParameterType;
+ if (args.Length != delargtypes.Length)
+ throw new ArgumentException ("info");
+ for (int i=0; i<delargs.Length; i++) {
+ if (delargtypes [i] != args [i].ParameterType)
+ throw new ArgumentException ("info");
+ }
+ return CreateDelegate_internal (type, null, info);
+ }
+
+ public static Delegate CreateDelegate (Type type, object target, string method)
+ {
+ return CreateDelegate(type, target, method, false);
+ }
+
+ public static Delegate CreateDelegate (Type type, Type target, string method)
+ {
+ if (type == null)
+ throw new ArgumentNullException (Locale.GetText ("Type is null"));
+
+ if (target == null)
+ throw new ArgumentNullException (Locale.GetText ("Target type is null"));
+
+ if (method == null)
+ throw new ArgumentNullException (Locale.GetText ("method string is null"));
+
+ if (!type.IsSubclassOf (typeof (MulticastDelegate)))
+ throw new ArgumentException ("type");
+
+ ParameterInfo[] delargs = type.GetMethod ("Invoke").GetParameters ();
+ Type[] delargtypes = new Type [delargs.Length];
+
+ for (int i=0; i<delargs.Length; i++)
+ delargtypes [i] = delargs [i].ParameterType;
+
+ /*
+ * FIXME: we should check the caller has reflection permission
+ * or if it lives in the same assembly...
+ */
+ BindingFlags flags = BindingFlags.ExactBinding | BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic;
+ MethodInfo info = target.GetMethod (method, flags, null, delargtypes, new ParameterModifier [0]);
+
+ if (info == null)
+ throw new ArgumentException ("Couldn't bind to method");
+
+ return CreateDelegate_internal (type, null, info);
+ }
+
+ public static Delegate CreateDelegate (Type type, object target, string method, bool ignorecase)
+ {
+ if (type == null)
+ throw new ArgumentNullException (Locale.GetText ("Type is null"));
+
+ if (target == null)
+ throw new ArgumentNullException (Locale.GetText ("Target object is null"));
+
+ if (method == null)
+ throw new ArgumentNullException (Locale.GetText ("method string is null"));
+
+ if (!type.IsSubclassOf (typeof (MulticastDelegate)))
+ throw new ArgumentException ("type");
+
+ ParameterInfo[] delargs = type.GetMethod ("Invoke").GetParameters ();
+ Type[] delargtypes = new Type [delargs.Length];
+
+ for (int i=0; i<delargs.Length; i++)
+ delargtypes [i] = delargs [i].ParameterType;
+
+ /*
+ * FIXME: we should check the caller has reflection permission
+ * or if it lives in the same assembly...
+ */
+ BindingFlags flags = BindingFlags.ExactBinding | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
+
+ if (ignorecase)
+ flags |= BindingFlags.IgnoreCase;
+
+ MethodInfo info = target.GetType ().GetMethod (method, flags, null, delargtypes, new ParameterModifier [0]);
+
+ if (info == null)
+ throw new ArgumentException ("Couldn't bind to method");
+
+ return CreateDelegate_internal (type, target, info);
+ }
+
+ public object DynamicInvoke( object[] args )
+ {
+ return DynamicInvokeImpl( args );
+ }
+
+ public virtual object DynamicInvokeImpl( object[] args )
+ {
+ if (Method == null) {
+ Type[] mtypes = new Type [args.Length];
+ for (int i = 0; i < args.Length; ++i) {
+ mtypes [i] = args [i].GetType ();
+ }
+ method_info = m_target.GetType ().GetMethod (method_name, mtypes);
+ }
+ return Method.Invoke( m_target, args );
+ }
+
+ public virtual object Clone()
+ {
+ return MemberwiseClone();
+ }
+
+ public override bool Equals (object o)
+ {
+ if ( o == null )
+ return false;
+
+ Delegate d = (Delegate) o;
+ if ((d.target_type == target_type) &&
+ (d.m_target == m_target) &&
+ (d.method_name == method_name) &&
+ (d.method_ptr == method_ptr))
+ return true;
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)method_ptr;
+ }
+
+ // This is from ISerializable
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ DelegateSerializationHolder.GetDelegateData (this, info, context);
+ }
+
+ public virtual Delegate[] GetInvocationList()
+ {
+ return new Delegate[] { this };
+ }
+
+ /// <symmary>
+ /// Returns a new MulticastDelegate holding the
+ /// concatenated invocation lists of MulticastDelegates a and b
+ /// </symmary>
+ public static Delegate Combine (Delegate a, Delegate b)
+ {
+ if (a == null){
+ if (b == null)
+ return null;
+ return b;
+ } else
+ if (b == null)
+ return a;
+
+ if (a.GetType () != b.GetType ())
+ throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types"));
+
+ return a.CombineImpl (b);
+ }
+
+ /// <symmary>
+ /// Returns a new MulticastDelegate holding the
+ /// concatenated invocation lists of an Array of MulticastDelegates
+ /// </symmary>
+ public static Delegate Combine( Delegate[] delegates )
+ {
+ Delegate retval = null;
+
+ foreach ( Delegate next in delegates )
+ retval = Combine( retval, next );
+
+ return retval;
+ }
+
+
+ protected virtual Delegate CombineImpl (Delegate d)
+ {
+ throw new MulticastNotSupportedException ("");
+ }
+
+
+ public static Delegate Remove( Delegate source, Delegate value )
+ {
+ if ( source == null )
+ return null;
+
+ return source.RemoveImpl( value );
+ }
+
+ protected virtual Delegate RemoveImpl( Delegate d )
+ {
+ if ( this.Equals( d ) )
+ return null;
+
+ return this;
+ }
+
+ public static bool operator ==( Delegate a, Delegate b )
+ {
+ if ((object)a == null) {
+ if ((object)b == null)
+ return true;
+ return false;
+ }
+ return a.Equals( b );
+ }
+
+ public static bool operator !=( Delegate a, Delegate b )
+ {
+ return !(a == b);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DelegateSerializationHolder.cs b/mcs/class/corlib/System/DelegateSerializationHolder.cs
new file mode 100644
index 00000000000..4c74198f5b5
--- /dev/null
+++ b/mcs/class/corlib/System/DelegateSerializationHolder.cs
@@ -0,0 +1,136 @@
+// DelegateSerializationHolder.cs
+//
+// Author:
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2003 Lluis Sanchez Gual
+
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class DelegateSerializationHolder: ISerializable, IObjectReference
+ {
+ Delegate _delegate; // The deserialized delegate
+
+ [Serializable]
+ class DelegateEntry
+ {
+ // A DelegateEntry holds information about a delegate that is part
+ // of an invocation list of a multicast delegate.
+
+ public DelegateEntry (Delegate del, string targetLabel)
+ {
+ type = del.GetType().FullName;
+ assembly = del.GetType().Assembly.FullName;
+ target = targetLabel;
+ targetTypeAssembly = del.Method.DeclaringType.Assembly.FullName;
+ targetTypeName = del.Method.DeclaringType.FullName;
+ methodName = del.Method.Name;
+ }
+
+ public Delegate DeserializeDelegate(SerializationInfo info)
+ {
+ object realTarget = null;
+ if (target != null)
+ realTarget = info.GetValue (target.ToString(), typeof(object));
+
+ Assembly dasm = Assembly.Load (assembly);
+ Type dt = dasm.GetType (type);
+
+ Delegate del;
+ if (realTarget != null)
+ del = Delegate.CreateDelegate (dt, realTarget, methodName);
+ else
+ {
+ Assembly tasm = Assembly.Load (targetTypeAssembly);
+ Type tt = tasm.GetType (targetTypeName);
+ del = Delegate.CreateDelegate (dt, tt, methodName);
+ }
+
+ if (!del.Method.IsPublic)
+ throw new SerializationException ("Serialization will not deserialize delegates to non-public methods.");
+
+ return del;
+ }
+
+ string type;
+ string assembly;
+ public object target;
+ string targetTypeAssembly;
+ string targetTypeName;
+ string methodName;
+ public DelegateEntry delegateEntry; // next delegate in the invocation list
+ }
+
+ DelegateSerializationHolder(SerializationInfo info, StreamingContext ctx)
+ {
+ DelegateEntry entryChain = (DelegateEntry)info.GetValue ("Delegate", typeof(DelegateEntry));
+
+ // Count the number of delegates to combine
+
+ int count = 0;
+ DelegateEntry entry = entryChain;
+ while (entry != null)
+ {
+ entry = entry.delegateEntry;
+ count++;
+ }
+
+ // Deserializes and combines the delegates
+
+ if (count == 1)
+ _delegate = entryChain.DeserializeDelegate (info);
+ else
+ {
+ Delegate[] delegates = new Delegate[count];
+ entry = entryChain;
+ for (int n=0; n<count; n++)
+ {
+ delegates[n] = entry.DeserializeDelegate (info);
+ entry = entry.delegateEntry;
+ }
+
+ _delegate = Delegate.Combine (delegates);
+ }
+ }
+
+ public static void GetDelegateData(Delegate instance, SerializationInfo info, StreamingContext ctx)
+ {
+ // Fills a SerializationInfo object with the information of the delegate.
+
+ Delegate[] delegates = instance.GetInvocationList();
+ DelegateEntry lastEntry = null;
+ for (int n=0; n<delegates.Length; n++)
+ {
+ Delegate del = delegates[n];
+ string targetLabel = (del.Target != null) ? ("target" + n) : null;
+ DelegateEntry entry = new DelegateEntry(del, targetLabel);
+
+ if (lastEntry == null)
+ info.AddValue ("Delegate", entry);
+ else
+ lastEntry.delegateEntry = entry;
+
+ lastEntry = entry;
+ if (del.Target != null)
+ info.AddValue (targetLabel, del.Target);
+ }
+ info.SetType (typeof (DelegateSerializationHolder));
+ }
+
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ // Not needed.
+ throw new NotSupportedException();
+ }
+
+ public object GetRealObject(StreamingContext context)
+ {
+ return _delegate;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DivideByZeroException.cs b/mcs/class/corlib/System/DivideByZeroException.cs
new file mode 100644
index 00000000000..74582bb361d
--- /dev/null
+++ b/mcs/class/corlib/System/DivideByZeroException.cs
@@ -0,0 +1,38 @@
+//
+// System.DivideByZeroException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class DivideByZeroException : ArithmeticException {
+ // Constructors
+ public DivideByZeroException ()
+ : base (Locale.GetText ("Division by zero"))
+ {
+ }
+
+ public DivideByZeroException (string message)
+ : base (message)
+ {
+ }
+
+ public DivideByZeroException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected DivideByZeroException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DllNotFoundException.cs b/mcs/class/corlib/System/DllNotFoundException.cs
new file mode 100644
index 00000000000..cc332020623
--- /dev/null
+++ b/mcs/class/corlib/System/DllNotFoundException.cs
@@ -0,0 +1,42 @@
+//
+// System.DllNotFoundException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class DllNotFoundException : TypeLoadException
+ {
+ // Constructors
+ public DllNotFoundException ()
+ : base (Locale.GetText ("DLL not found."))
+ {
+ }
+
+ public DllNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ protected DllNotFoundException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public DllNotFoundException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/Double.cs b/mcs/class/corlib/System/Double.cs
new file mode 100644
index 00000000000..64e07fa30b6
--- /dev/null
+++ b/mcs/class/corlib/System/Double.cs
@@ -0,0 +1,449 @@
+//
+// System.Double.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Bob Smith (bob@thestuff.net)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+// (C) Bob Smith. http://www.thestuff.net
+//
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public struct Double : IComparable, IFormattable, IConvertible {
+ public const double Epsilon = 4.9406564584124650e-324;
+ public const double MaxValue = 1.7976931348623157e308;
+ public const double MinValue = -1.7976931348623157e308;
+ public const double NaN = 0.0d / 0.0d;
+ public const double NegativeInfinity = -1.0d / 0.0d;
+ public const double PositiveInfinity = 1.0d / 0.0d;
+
+ internal double value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Double))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Double"));
+
+ double dv = (double)v;
+
+ if (IsPositiveInfinity(value) && IsPositiveInfinity(dv))
+ return 0;
+
+ if (IsNegativeInfinity(value) && IsNegativeInfinity(dv))
+ return 0;
+
+ if (IsNaN(dv))
+ if (IsNaN(value))
+ return 0;
+ else
+ return 1;
+
+ if (IsNaN(value))
+ if (IsNaN(dv))
+ return 0;
+ else
+ return -1;
+
+ if (value > dv) return 1;
+ else if (value < dv) return -1;
+ else return 0;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Double))
+ return false;
+
+ if (IsNaN ((double)o)) {
+ if (IsNaN(value))
+ return true;
+ else
+ return false;
+ }
+
+ return ((double) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ public static bool IsInfinity (double d)
+ {
+ return (d == PositiveInfinity || d == NegativeInfinity);
+ }
+
+ public static bool IsNaN (double d)
+ {
+ return (d != d);
+ }
+
+ public static bool IsNegativeInfinity (double d)
+ {
+ return (d < 0.0d && (d == NegativeInfinity || d == PositiveInfinity));
+ }
+
+ public static bool IsPositiveInfinity (double d)
+ {
+ return (d > 0.0d && (d == NegativeInfinity || d == PositiveInfinity));
+ }
+
+ public static double Parse (string s)
+ {
+ return Parse (s, (NumberStyles.Float | NumberStyles.AllowThousands), null);
+ }
+
+ public static double Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, (NumberStyles.Float | NumberStyles.AllowThousands), fp);
+ }
+
+ public static double Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ // We're intentionally using constants here to avoid some bigger headaches in mcs.
+ // This struct must be compiled before System.Enum so we can't use enums here.
+ private const int State_AllowSign = 1;
+ private const int State_Digits = 2;
+ private const int State_Decimal = 3;
+ private const int State_ExponentSign = 4;
+ private const int State_Exponent = 5;
+ private const int State_ConsumeWhiteSpace = 6;
+
+ [MonoTODO("check if digits are group in correct numbers between the group separators")]
+ public static double Parse (string s, NumberStyles style, IFormatProvider provider)
+ {
+ if (s == null) throw new ArgumentNullException();
+ if (style > NumberStyles.Any)
+ {
+ throw new ArgumentException();
+ }
+ NumberFormatInfo format = NumberFormatInfo.GetInstance(provider);
+ if (format == null) throw new Exception("How did this happen?");
+ if (s == format.NaNSymbol) return Double.NaN;
+ if (s == format.PositiveInfinitySymbol) return Double.PositiveInfinity;
+ if (s == format.NegativeInfinitySymbol) return Double.NegativeInfinity;
+
+ //
+ // validate and prepare string for C
+ //
+ int len = s.Length;
+ byte [] b = new byte [len + 1];
+ int didx = 0;
+ int sidx = 0;
+ char c;
+
+ if ((style & NumberStyles.AllowLeadingWhite) != 0){
+ while (sidx < len && Char.IsWhiteSpace (c = s [sidx]))
+ sidx++;
+
+ if (sidx == len)
+ throw new FormatException();
+ }
+
+ bool allow_trailing_white = ((style & NumberStyles.AllowTrailingWhite) != 0);
+
+ //
+ // Machine state
+ //
+ int state = State_AllowSign;
+
+ //
+ // Setup
+ //
+ string decimal_separator = null;
+ string group_separator = null;
+ int decimal_separator_len = 0;
+ int group_separator_len = 0;
+ if ((style & NumberStyles.AllowDecimalPoint) != 0){
+ decimal_separator = format.NumberDecimalSeparator;
+ decimal_separator_len = decimal_separator.Length;
+ }
+ if ((style & NumberStyles.AllowThousands) != 0){
+ group_separator = format.NumberGroupSeparator;
+ group_separator_len = group_separator.Length;
+ }
+ string positive = format.PositiveSign;
+ string negative = format.NegativeSign;
+
+ for (; sidx < len; sidx++){
+ c = s [sidx];
+
+ switch (state){
+ case State_AllowSign:
+ if ((style & NumberStyles.AllowLeadingSign) != 0){
+ if (c == positive [0] &&
+ s.Substring (sidx, positive.Length) == positive){
+ state = State_Digits;
+ sidx += positive.Length-1;
+ continue;
+ }
+
+ if (c == negative [0] &&
+ s.Substring (sidx, negative.Length) == negative){
+ state = State_Digits;
+ b [didx++] = (byte) '-';
+ sidx += negative.Length-1;
+ continue;
+ }
+ }
+ state = State_Digits;
+ goto case State_Digits;
+
+ case State_Digits:
+ if (Char.IsDigit (c)){
+ b [didx++] = (byte) c;
+ break;
+ }
+ if (c == 'e' || c == 'E')
+ goto case State_Decimal;
+
+ if (decimal_separator != null &&
+ decimal_separator [0] == c){
+ if (s.Substring (sidx, decimal_separator_len) ==
+ decimal_separator){
+ b [didx++] = (byte) '.';
+ sidx += decimal_separator_len-1;
+ state = State_Decimal;
+ break;
+ }
+ }
+ if (group_separator != null &&
+ group_separator [0] == c){
+ if (s.Substring (sidx, group_separator_len) ==
+ group_separator){
+ sidx += group_separator_len-1;
+ state = State_Digits;
+ break;
+ }
+ }
+
+ if (Char.IsWhiteSpace (c))
+ goto case State_ConsumeWhiteSpace;
+
+ throw new FormatException ("Unknown char: " + c);
+
+ case State_Decimal:
+ if (Char.IsDigit (c)){
+ b [didx++] = (byte) c;
+ break;
+ }
+
+ if (c == 'e' || c == 'E'){
+ if ((style & NumberStyles.AllowExponent) == 0)
+ throw new FormatException ("Unknown char: " + c);
+ b [didx++] = (byte) c;
+ state = State_ExponentSign;
+ break;
+ }
+
+ if (Char.IsWhiteSpace (c))
+ goto case State_ConsumeWhiteSpace;
+ throw new FormatException ("Unknown char: " + c);
+
+ case State_ExponentSign:
+ if (Char.IsDigit (c)){
+ state = State_Exponent;
+ goto case State_Exponent;
+ }
+
+ if (c == positive [0] &&
+ s.Substring (sidx, positive.Length) == positive){
+ state = State_Digits;
+ sidx += positive.Length-1;
+ continue;
+ }
+
+ if (c == negative [0] &&
+ s.Substring (sidx, negative.Length) == negative){
+ state = State_Digits;
+ b [didx++] = (byte) '-';
+ sidx += negative.Length-1;
+ continue;
+ }
+
+ if (Char.IsWhiteSpace (c))
+ goto case State_ConsumeWhiteSpace;
+
+ throw new FormatException ("Unknown char: " + c);
+
+ case State_Exponent:
+ if (Char.IsDigit (c)){
+ b [didx++] = (byte) c;
+ break;
+ }
+
+ if (Char.IsWhiteSpace (c))
+ goto case State_ConsumeWhiteSpace;
+ throw new FormatException ("Unknown char: " + c);
+
+ case State_ConsumeWhiteSpace:
+ if (allow_trailing_white && Char.IsWhiteSpace (c))
+ break;
+ throw new FormatException ("Unknown char");
+ }
+ }
+
+ b [didx] = 0;
+ unsafe {
+ fixed (byte *p = &b [0]){
+ double retVal = ParseImpl (p);
+ if (IsPositiveInfinity(retVal) || IsNegativeInfinity(retVal))
+ throw new OverflowException();
+
+ return retVal;
+ }
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe private static extern double ParseImpl (byte *byte_ptr);
+
+ public static bool TryParse (string s,
+ NumberStyles style,
+ IFormatProvider provider,
+ ref double result)
+ {
+ try {
+ result = Parse (s, style, provider);
+ return true;
+ } catch {
+ return false;
+ }
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ [MonoTODO]
+ public string ToString (string format, IFormatProvider fp)
+ {
+ // FIXME: Need to pass format and provider info to this call too.
+ if (format == "X")
+ throw new FormatException();
+
+ return ToStringImpl(value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern string ToStringImpl (double value);
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Double;
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean(value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte(value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal(value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble(value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle(value);
+ }
+
+/*
+ string IConvertible.ToString (IFormatProvider provider)
+ {
+ return ToString(provider);
+ }
+*/
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DuplicateWaitObjectException.cs b/mcs/class/corlib/System/DuplicateWaitObjectException.cs
new file mode 100644
index 00000000000..beddfd0c5ac
--- /dev/null
+++ b/mcs/class/corlib/System/DuplicateWaitObjectException.cs
@@ -0,0 +1,39 @@
+//
+// System.DuplicateWaitObjectException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class DuplicateWaitObjectException : ArgumentException {
+ // Constructors
+ public DuplicateWaitObjectException ()
+ : base (Locale.GetText ("Duplicate objects in argument"))
+ {
+ }
+
+ public DuplicateWaitObjectException (string param_name)
+ : base (Locale.GetText ("Duplicate objects in argument"), param_name)
+ {
+ }
+
+ public DuplicateWaitObjectException (string param_name, string message)
+ : base (message, param_name)
+ {
+ }
+
+ protected DuplicateWaitObjectException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/EntryPointNotFoundException.cs b/mcs/class/corlib/System/EntryPointNotFoundException.cs
new file mode 100644
index 00000000000..672d5261490
--- /dev/null
+++ b/mcs/class/corlib/System/EntryPointNotFoundException.cs
@@ -0,0 +1,42 @@
+//
+// System.EntryPointNotFoundException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class EntryPointNotFoundException : TypeLoadException
+ {
+ // Constructors
+ public EntryPointNotFoundException ()
+ : base (Locale.GetText ("Cannot load class because of missing entry method."))
+ {
+ }
+
+ public EntryPointNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ protected EntryPointNotFoundException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public EntryPointNotFoundException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/Enum.cs b/mcs/class/corlib/System/Enum.cs
new file mode 100644
index 00000000000..8c79c7f2b1f
--- /dev/null
+++ b/mcs/class/corlib/System/Enum.cs
@@ -0,0 +1,600 @@
+//
+// System.Enum.cs
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com)
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System.Collections;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ internal struct MonoEnumInfo {
+ internal Type utype;
+ internal Array values;
+ internal string[] names;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void get_enum_info (Type enumType, out MonoEnumInfo info);
+
+ internal static void GetInfo (Type enumType, out MonoEnumInfo info) {
+ get_enum_info (enumType, out info);
+ Array.Sort (info.values, info.names);
+ }
+ };
+
+ [MonoTODO]
+ public abstract class Enum : ValueType, IComparable, IConvertible, IFormattable {
+
+ // IConvertible methods Start -->
+
+ [CLSCompliant(false)]
+ public TypeCode GetTypeCode () {
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (this.GetType (), out info);
+ return Type.GetTypeCode (info.utype);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return Convert.ToBoolean (get_value (), provider);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return Convert.ToByte (get_value (), provider);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return Convert.ToChar (get_value (), provider);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return Convert.ToDateTime (get_value (), provider);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return Convert.ToDecimal (get_value (), provider);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return Convert.ToDouble (get_value (), provider);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return Convert.ToInt16 (get_value (), provider);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return Convert.ToInt32 (get_value (), provider);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return Convert.ToInt64 (get_value (), provider);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return Convert.ToSByte (get_value (), provider);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return Convert.ToSingle (get_value (), provider);
+ }
+
+ [MonoTODO]
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return Convert.ToUInt16 (get_value (), provider);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return Convert.ToUInt32 (get_value (), provider);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return Convert.ToUInt64 (get_value (), provider);
+ }
+
+ // <-- End IConvertible methods
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern object get_value ();
+
+ public static Array GetValues (Type enumType) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ return info.values;
+ }
+
+ public static string[] GetNames (Type enumType) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ return info.names;
+ }
+
+ public static string GetName (Type enumType, object value) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+ if (null == value)
+ throw new ArgumentNullException ("value cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ int i;
+ value = ToObject (enumType, value);
+ MonoEnumInfo.GetInfo (enumType, out info);
+ for (i = 0; i < info.values.Length; ++i) {
+ if (value.Equals (info.values.GetValue (i)))
+ return info.names [i];
+ }
+ return null;
+ }
+
+ public static bool IsDefined (Type enumType, object value) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+ if (null == value)
+ throw new ArgumentNullException ("value cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+
+ Type vType = value.GetType ();
+ if (vType == typeof(String)) {
+ return ((IList)(info.names)).Contains (value);
+ } else if ((vType == info.utype) || (vType == enumType)) {
+ int i;
+ value = ToObject (enumType, value);
+ MonoEnumInfo.GetInfo (enumType, out info);
+ for (i = 0; i < info.values.Length; ++i) {
+ if (value.Equals (info.values.GetValue (i)))
+ return true;
+ }
+ return false;
+ } else {
+ throw new ArgumentException("The value parameter is not the correct type."
+ + "It must be type String or the same type as the underlying type"
+ + "of the Enum.");
+ }
+
+
+ }
+
+ public static Type GetUnderlyingType (Type enumType) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ return info.utype;
+ }
+
+ public static object Parse (Type enumType, string value)
+ {
+ // Note: Parameters are checked in the other overload
+ return Parse (enumType, value, false);
+ }
+
+ public static object Parse (Type enumType, string value, bool ignoreCase)
+ {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (null == value)
+ throw new ArgumentNullException ("value cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ if (String.Empty == value.Trim())
+ throw new ArgumentException ("value cannot be empty string.");
+
+ MonoEnumInfo info;
+ int i;
+ MonoEnumInfo.GetInfo (enumType, out info);
+
+ long retVal = 0;
+ string[] names = value.Split(new char[] {','});
+ for (i = 0; i < names.Length; ++i)
+ names [i] = names [i].Trim ();
+ TypeCode typeCode = ((Enum) info.values.GetValue (0)).GetTypeCode ();
+ foreach (string name in names) {
+ bool found = false;
+ for (i = 0; i < info.values.Length; ++i) {
+ if (String.Compare (name, info.names [i], ignoreCase) == 0) {
+ switch (typeCode) {
+ case TypeCode.Byte:
+ retVal |= (long)((byte)info.values.GetValue (i));
+ break;
+ case TypeCode.SByte:
+ // use the unsigned version in the cast to avoid
+ // compiler warning
+ retVal |= (long)((byte)(SByte)info.values.GetValue (i));
+ break;
+ case TypeCode.Int16:
+ // use the unsigned version in the cast to avoid
+ // compiler warning
+ retVal |= (long)((ushort)(short)info.values.GetValue (i));
+ break;
+ case TypeCode.Int32:
+ // use the unsigned version in the cast to avoid
+ // compiler warning
+ retVal |= (long)((uint)(int)info.values.GetValue (i));
+ break;
+ case TypeCode.Int64:
+ retVal |= (long)info.values.GetValue (i);
+ break;
+ case TypeCode.UInt16:
+ retVal |= (long)((UInt16)info.values.GetValue (i));
+ break;
+ case TypeCode.UInt32:
+ retVal |= (long)((UInt32)info.values.GetValue (i));
+ break;
+ case TypeCode.UInt64:
+ retVal |= (long)((UInt64)info.values.GetValue (i));
+ break;
+ }
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ throw new ArgumentException ("The requested value was not found");
+
+ }
+ return ToObject(enumType, retVal);
+ }
+
+ /// <summary>
+ /// Compares the enum value with another enum value of the same type.
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ public int CompareTo (object obj)
+ {
+ Type thisType;
+
+ if (obj == null)
+ return 1;
+
+ thisType = this.GetType();
+ if (obj.GetType() != thisType){
+ throw new ArgumentException(
+ "Object must be the same type as the "
+ + "enum. The type passed in was "
+ + obj.GetType().ToString()
+ + "; the enum type was "
+ + thisType.ToString() + ".");
+ }
+
+ object value1, value2;
+
+ value1 = this.get_value ();
+ value2 = ((Enum)obj).get_value();
+
+ return ((IComparable)value1).CompareTo (value2);
+ }
+
+ public override string ToString ()
+ {
+ return ToString ("G", null);
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return ToString ("G", provider);
+ }
+
+ public string ToString (String format)
+ {
+ return ToString (format, null);
+ }
+
+ [MonoTODO]
+ public string ToString (String format, IFormatProvider provider)
+ {
+ // provider is not used for Enums
+
+ if (format == String.Empty || format == null){
+ format = "G";
+ }
+ return Format (this.GetType(), this.get_value (), format);
+ }
+
+ public static object ToObject(Type enumType, byte value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+
+ public static object ToObject(Type enumType, short value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ public static object ToObject(Type enumType, int value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ public static object ToObject(Type enumType, long value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern object ToObject(Type enumType, object value);
+
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, sbyte value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, ushort value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, uint value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, ulong value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (null == obj)
+ return false;
+
+ if (obj.GetType() != this.GetType())
+ return false;
+
+ object v1 = this.get_value ();
+ object v2 = ((Enum)obj).get_value ();
+
+ return v1.Equals (v2);
+ }
+
+ public override int GetHashCode ()
+ {
+ object v = this.get_value ();
+ return v.GetHashCode ();
+ }
+
+ private static string FormatSpecifier_X (Type enumType, object value)
+ {
+ // FIXME: Not sure if padding should always be with precision
+ // 8, if it's culture specific, or what. This works for me.
+ const string format = "x8";
+
+ switch (Type.GetTypeCode(enumType)) {
+ case TypeCode.Char:
+ // Char doesn't support ToString(format), so convert to an int and
+ // use that...
+ char v = (char) value;
+ return Convert.ToInt32(v).ToString(format);
+ case TypeCode.SByte:
+ return ((sbyte)value).ToString(format);
+ case TypeCode.Byte:
+ return ((byte)value).ToString(format);
+ case TypeCode.Int16:
+ return ((short)value).ToString(format);
+ case TypeCode.UInt16:
+ return ((ushort)value).ToString(format);
+ case TypeCode.Int32:
+ return ((int)value).ToString(format);
+ case TypeCode.UInt32:
+ return ((uint)value).ToString(format);
+ case TypeCode.Int64:
+ return ((long)value).ToString(format);
+ case TypeCode.UInt64:
+ return ((ulong)value).ToString(format);
+ default:
+ throw new Exception ("invalid type code for enumeration");
+ }
+ }
+
+ [MonoTODO]
+ public static string Format (Type enumType, object value, string format)
+ {
+ if (null == enumType)
+ throw new ArgumentNullException("enumType cannot be null");
+ if (null == value)
+ throw new ArgumentNullException("value cannot be null");
+ if (null == format)
+ throw new ArgumentNullException("format cannot be null");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException("enumType is not an Enum Type");
+
+ Type vType = value.GetType();
+ if (vType != enumType && vType != Enum.GetUnderlyingType(enumType))
+ throw new ArgumentException();
+
+
+ if (format.Length != 1)
+ throw new FormatException ("Format String can be only \"G\",\"g\",\"X\"," +
+ "\"x\",\"F\",\"f\",\"D\" or \"d\".");
+
+ char formatChar = format [0];
+ if ((formatChar == 'G' || formatChar == 'g')
+ && Attribute.IsDefined(enumType, typeof(FlagsAttribute)))
+ formatChar = 'F';
+
+ string retVal = "";
+ switch (formatChar) {
+ case 'G':
+ case 'g':
+ retVal = GetName (enumType, value);
+ if (retVal == null)
+ retVal = value.ToString();
+ break;
+ case 'X':
+ case 'x':
+ retVal = FormatSpecifier_X (enumType, value);
+ break;
+ case 'D':
+ case 'd':
+ if (Enum.GetUnderlyingType (enumType) == typeof (ulong)) {
+ ulong ulongValue = Convert.ToUInt64 (value);
+ retVal = ulongValue.ToString ();
+ } else {
+ long longValue = Convert.ToInt64 (value);
+ retVal = longValue.ToString ();
+ }
+ break;
+ case 'F':
+ case 'f':
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ // This is ugly, yes. We need to handle the different integer
+ // types for enums. If someone else has a better idea, be my guest.
+ switch (((Enum)info.values.GetValue (0)).GetTypeCode()) {
+ case TypeCode.Byte:
+ byte byteFlag = (byte)value;
+ byte byteenumValue;
+ for (int i = info.values.Length-1; i>=0 && byteFlag != 0; i--) {
+ byteenumValue = (byte)info.values.GetValue (i);
+ if ((byteenumValue & byteFlag) == byteenumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ byteFlag -= byteenumValue;
+ }
+ }
+ break;
+ case TypeCode.SByte:
+ SByte sbyteFlag = (SByte)value;
+ SByte sbyteenumValue;
+ for (int i = info.values.Length-1; i>=0 && sbyteFlag != 0; i--) {
+ sbyteenumValue = (SByte)info.values.GetValue (i);
+ if ((sbyteenumValue & sbyteFlag) == sbyteenumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ sbyteFlag -= sbyteenumValue;
+ }
+ }
+ break;
+ case TypeCode.Int16:
+ short Int16Flag = (short)value;
+ short Int16enumValue;
+ for (int i = info.values.Length-1; i>=0 && Int16Flag != 0; i--) {
+ Int16enumValue = (short)info.values.GetValue (i);
+ if ((Int16enumValue & Int16Flag) == Int16enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ Int16Flag -= Int16enumValue;
+ }
+ }
+ break;
+ case TypeCode.Int32:
+ int Int32Flag = (int)value;
+ int Int32enumValue;
+ for (int i = info.values.Length-1; i>=0 && Int32Flag != 0; i--) {
+ Int32enumValue = (int)info.values.GetValue (i);
+ if ((Int32enumValue & Int32Flag) == Int32enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ Int32Flag -= Int32enumValue;
+ }
+ }
+ break;
+ case TypeCode.Int64:
+ long Int64Flag = (long)value;
+ long Int64enumValue;
+ for (int i = info.values.Length-1; i>=0 && Int64Flag != 0; i--) {
+ Int64enumValue = (long)info.values.GetValue (i);
+ if ((Int64enumValue & Int64Flag) == Int64enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ Int64Flag -= Int64enumValue;
+ }
+ }
+ break;
+ case TypeCode.UInt16:
+ UInt16 UInt16Flag = (UInt16)value;
+ UInt16 UInt16enumValue;
+ for (int i = info.values.Length-1; i>=0 && UInt16Flag != 0; i--) {
+ UInt16enumValue = (UInt16)info.values.GetValue (i);
+ if ((UInt16enumValue & UInt16Flag) == UInt16enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ UInt16Flag -= UInt16enumValue;
+ }
+ }
+ break;
+ case TypeCode.UInt32:
+ UInt32 UInt32Flag = (UInt32)value;
+ UInt32 UInt32enumValue;
+ for (int i = info.values.Length-1; i>=0 && UInt32Flag != 0; i--) {
+ UInt32enumValue = (UInt32)info.values.GetValue (i);
+ if ((UInt32enumValue & UInt32Flag) == UInt32enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ UInt32Flag -= UInt32enumValue;
+ }
+ }
+ break;
+ case TypeCode.UInt64:
+ UInt64 UInt64Flag = (UInt64)value;
+ UInt64 UInt64enumValue;
+ for (int i = info.values.Length-1; i>=0 && UInt64Flag != 0; i--) {
+ UInt64enumValue = (UInt64)info.values.GetValue (i);
+ if ((UInt64enumValue & UInt64Flag) == UInt64enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ UInt64Flag -= UInt64enumValue;
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ throw new FormatException ("Format String can be only \"G\",\"g\",\"X\"," +
+ "\"x\",\"F\",\"f\",\"D\" or \"d\".");
+ }
+
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs
new file mode 100644
index 00000000000..9063180418e
--- /dev/null
+++ b/mcs/class/corlib/System/Environment.cs
@@ -0,0 +1,316 @@
+//------------------------------------------------------------------------------
+//
+// System.Environment.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.IO;
+//using System.Diagnostics;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ public sealed class Environment
+ {
+ private Environment () {}
+
+ [MonoTODO]
+ public enum SpecialFolder
+ { // TODO: Determine if these windoze style folder identifiers
+ // have unix/linux counterparts
+ Programs = 0x02,
+ Personal = 0x05,
+ Favorites = 0x06,
+ Startup = 0x07,
+ Recent = 0x08,
+ SendTo = 0x09,
+ StartMenu = 0x0b,
+ DesktopDirectory = 0x10,
+ Templates = 0x15,
+ ApplicationData = 0x1a,
+ LocalApplicationData = 0x1c,
+ InternetCache = 0x20,
+ Cookies = 0x21,
+ History = 0x22,
+ CommonApplicationData = 0x23,
+ System = 0x25,
+ ProgramFiles = 0x26,
+ CommonProgramFiles = 0x2b,
+ }
+
+ // TODO: Make sure the security attributes do what I expect
+
+ /// <summary>
+ /// Gets the command line for this process
+ /// </summary>
+ public static string CommandLine
+ { // TODO: Coordinate with implementor of EnvironmentPermissionAttribute
+ // [EnvironmentPermissionAttribute(SecurityAction.Demand, Read = "COMMANDLINE")]
+ get
+ {
+ // FIXME: we may need to quote, but any sane person
+ // should use GetCommandLineArgs () instead.
+ return String.Join (" ", GetCommandLineArgs ());
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the current directory. Actually this is supposed to get
+ /// and/or set the process start directory acording to the documentation
+ /// but actually test revealed at beta2 it is just Getting/Setting the CurrentDirectory
+ /// </summary>
+ public static string CurrentDirectory
+ {
+ // originally it was my thought that the external call would be made in
+ // the directory class however that class has additional security requirements
+ // so the Directory class will call this class for its get/set current directory
+
+ // [EnvironmentPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
+ get
+ {
+ MonoIOError error;
+
+ return MonoIO.GetCurrentDirectory (out error);
+ }
+ [MonoTODO("disabled because of compile error. Need mcs magic.")]
+ //[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ set
+ {
+ MonoIOError error;
+
+ MonoIO.SetCurrentDirectory (value, out error);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the exit code of this process
+ /// </summary>
+ [MonoTODO]
+ public static int ExitCode
+ {
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool HasShutdownStarted
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+
+ /// <summary>
+ /// Gets the name of the local computer
+ /// </summary>
+ public extern static string MachineName {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ /// <summary>
+ /// Gets the standard new line value
+ /// </summary>
+ public extern static string NewLine {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+
+ //
+ // Support methods and fields for OSVersion property
+ //
+ static OperatingSystem os;
+
+ static extern PlatformID Platform {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ /// <summary>
+ /// Gets the current OS version information
+ /// </summary>
+ public static OperatingSystem OSVersion {
+ get {
+ if (os == null)
+ os = new OperatingSystem (Platform, new Version (5,1,2600,0));
+
+ return os;
+ }
+ }
+
+ /// <summary>
+ /// Get StackTrace
+ /// </summary>
+ public static string StackTrace {
+ get {
+ System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace (1);
+ return trace.ToString ();
+ }
+ }
+
+ /// <summary>
+ /// Get a fully qualified path to the system directory
+ /// </summary>
+ public static string SystemDirectory
+ {
+ get
+ {
+ return GetFolderPath(SpecialFolder.System);
+ }
+ }
+
+ /// <summary>
+ /// Get the number of milliseconds that have elapsed since the system was booted
+ /// </summary>
+ public extern static int TickCount {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ /// <summary>
+ /// Get UserDomainName
+ /// </summary>
+ [MonoTODO]
+ public static string UserDomainName {
+ get {
+ return MachineName;
+ }
+ }
+
+ /// <summary>
+ /// Gets a flag indicating whether the process is in interactive mode
+ /// </summary>
+ [MonoTODO]
+ public static bool UserInteractive
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Get the user name of current process is running under
+ /// </summary>
+ [MonoTODO]
+ public static string UserName
+ {
+ get
+ {
+ // TODO: needs more research/work/thought
+ string result = GetEnvironmentVariable("USERNAME");
+ if(result == null || result.Equals(string.Empty))
+ {
+ result = GetEnvironmentVariable("USER");
+ }
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Get the version of the common language runtime
+ /// </summary>
+ [MonoTODO]
+ public static Version Version {
+ get {
+ return new Version();
+ }
+ }
+
+ /// <summary>
+ /// Get the amount of physical memory mapped to process
+ /// </summary>
+ [MonoTODO]
+ public static long WorkingSet
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void Exit(int exitCode);
+
+ /// <summary>
+ /// Substitute environment variables in the argument "name"
+ /// </summary>
+ [MonoTODO]
+ public static string ExpandEnvironmentVariables(string name)
+ {
+ return name;
+ }
+
+ /// <summary>
+ /// Return an array of the command line arguments of the current process
+ /// </summary>
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static string[] GetCommandLineArgs();
+
+ /// <summary>
+ /// Return a string containing the value of the environment
+ /// variable identifed by parameter "variable"
+ /// </summary>
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static string GetEnvironmentVariable (string name);
+
+ /// <summary>
+ /// Return a set of all environment variables and their values
+ /// </summary>
+
+ public static IDictionary GetEnvironmentVariables()
+ {
+ Hashtable vars = new Hashtable ();
+ foreach (string name in GetEnvironmentVariableNames ())
+ vars [name] = GetEnvironmentVariable (name);
+
+ return vars;
+ }
+
+ /// <summary>
+ /// Returns the fully qualified path of the
+ /// folder specified by the "folder" parameter
+ /// </summary>
+ [MonoTODO]
+ public static string GetFolderPath(SpecialFolder folder)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Returns an array of the logical drives
+ /// </summary>
+ [MonoTODO]
+ public static string[] GetLogicalDrives()
+ {
+ return null;
+ }
+
+ static internal string GetResourceString (string s) { return ""; }
+
+ // private methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static string [] GetEnvironmentVariableNames ();
+
+ }
+}
+
diff --git a/mcs/class/corlib/System/EventArgs.cs b/mcs/class/corlib/System/EventArgs.cs
new file mode 100644
index 00000000000..c2460152d2e
--- /dev/null
+++ b/mcs/class/corlib/System/EventArgs.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// System.EventArgs.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Mon 07/16/2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System {
+
+ [Serializable]
+ public class EventArgs
+ {
+ public static readonly EventArgs Empty = new EventArgs();
+
+ public EventArgs() { }
+ }
+
+} // System
+
+
diff --git a/mcs/class/corlib/System/EventHandler.cs b/mcs/class/corlib/System/EventHandler.cs
new file mode 100644
index 00000000000..407255b604e
--- /dev/null
+++ b/mcs/class/corlib/System/EventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.EventHandler.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public delegate void EventHandler (object sender, EventArgs e);
+
+}
+
+
diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs
new file mode 100644
index 00000000000..26848387166
--- /dev/null
+++ b/mcs/class/corlib/System/Exception.cs
@@ -0,0 +1,166 @@
+//
+// System.Exception.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Reflection;
+
+namespace System {
+
+ [Serializable]
+// [ClassInterface (ClassInterfaceType.AutoDual)] (no implementation yet)
+ [MonoTODO]
+ public class Exception : ISerializable {
+ IntPtr [] trace_ips;
+ Exception inner_exception;
+ string message;
+ string help_link;
+ string class_name;
+ string stack_trace = null;
+ string remote_stack_trace = "TODO: Implement remote stack trace";
+ int remote_stack_index;
+ int hresult;
+ string source;
+
+ public Exception ()
+ {
+ inner_exception = null;
+ message = null;
+ }
+
+ public Exception (string msg)
+ {
+ inner_exception = null;
+ message = msg;
+ }
+
+ protected Exception (SerializationInfo info, StreamingContext sc)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ class_name = info.GetString ("ClassName");
+ message = info.GetString ("Message");
+ inner_exception = (Exception) info.GetValue ("InnerException", typeof (Exception));
+ help_link = info.GetString ("HelpURL");
+ stack_trace = info.GetString ("StackTraceString");
+ remote_stack_trace = info.GetString ("RemoteStackTrace");
+ remote_stack_index = info.GetInt32 ("RemoteStackIndex");
+ hresult = info.GetInt32 ("HResult");
+ source = info.GetString ("Source");
+ }
+
+ public Exception (string msg, Exception e)
+ {
+ inner_exception = e;
+ message = msg;
+ }
+
+ public Exception InnerException {
+ get {
+ return inner_exception;
+ }
+ }
+
+ public virtual string HelpLink {
+ get {
+ return help_link;
+ }
+
+ set {
+ help_link = value;
+ }
+ }
+
+ protected int HResult {
+ get {
+ return hresult;
+ }
+
+ set {
+ hresult = value;
+ }
+ }
+
+ public virtual string Message {
+ get {
+ if (message == null)
+ message = "Exception of type " + GetType () + " was thrown.";
+
+ return message;
+ }
+ }
+
+ [MonoTODO]
+ public virtual string Source {
+ get {
+ // TODO: if source is null, we must return
+ // the name of the assembly where the error
+ // originated.
+ return source;
+ }
+
+ set {
+ source = value;
+ }
+ }
+
+ public virtual string StackTrace {
+ get {
+ return stack_trace;
+ }
+ }
+
+ [MonoTODO]
+ public MethodBase TargetSite {
+ get {
+ // TODO: Implement this.
+ return null;
+ }
+ }
+
+ public virtual Exception GetBaseException ()
+ {
+ Exception inner = inner_exception;
+
+ while (inner != null){
+ if (inner.InnerException != null)
+ inner = inner.InnerException;
+ else
+ return inner;
+ }
+
+ return this;
+ }
+
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("ClassName", class_name);
+ info.AddValue ("Message", message);
+ info.AddValue ("InnerException", inner_exception);
+ info.AddValue ("HelpURL", help_link);
+ info.AddValue ("StackTraceString", stack_trace);
+ info.AddValue ("RemoteStackTrace", remote_stack_trace);
+ info.AddValue ("RemoteStackIndex", remote_stack_index);
+ info.AddValue ("HResult", hresult);
+ info.AddValue ("Source", source);
+ }
+
+ public override string ToString ()
+ {
+ string result = this.GetType ().FullName + ": " + Message;
+ if (inner_exception != null) {
+ result += " ---> " + inner_exception.ToString ();
+ result += "--- End of inner exception stack trace ---";
+ }
+
+ return result + "\n" + stack_trace;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System/ExecutionEngineException.cs b/mcs/class/corlib/System/ExecutionEngineException.cs
new file mode 100644
index 00000000000..f005ecb70f0
--- /dev/null
+++ b/mcs/class/corlib/System/ExecutionEngineException.cs
@@ -0,0 +1,31 @@
+//
+// System.ExecutionEngineException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class ExecutionEngineException : SystemException {
+ // Constructors
+ public ExecutionEngineException ()
+ : base (Locale.GetText ("Internal error occurred")) // Haha. Nice.
+ {
+ }
+
+ public ExecutionEngineException (string message)
+ : base (message)
+ {
+ }
+
+ public ExecutionEngineException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/FieldAccessException.cs b/mcs/class/corlib/System/FieldAccessException.cs
new file mode 100644
index 00000000000..342a405ddd6
--- /dev/null
+++ b/mcs/class/corlib/System/FieldAccessException.cs
@@ -0,0 +1,41 @@
+//
+// System.FieldAccessException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class FieldAccessException : MemberAccessException
+ {
+ // Constructors
+ public FieldAccessException ()
+ : base (Locale.GetText ("Attempt to access a private/protected field failed."))
+ {
+ }
+
+ public FieldAccessException (string message)
+ : base (message)
+ {
+ }
+
+ protected FieldAccessException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public FieldAccessException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/FlagsAttribute.cs b/mcs/class/corlib/System/FlagsAttribute.cs
new file mode 100755
index 00000000000..8c2b40defa0
--- /dev/null
+++ b/mcs/class/corlib/System/FlagsAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.FlagsAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The FlagsAttribute tags enumerations as bitfields.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The FlagsAttribute can be used to tag an enumeration to be
+ /// a bit field. This will allow the compiler and visual tools
+ /// to treat the bits in an enumeration as a set of flags.
+ /// </remarks>
+
+ [AttributeUsage (AttributeTargets.Enum)]
+ [Serializable]
+ public class FlagsAttribute : Attribute {
+
+ // No methods.
+
+ }
+}
diff --git a/mcs/class/corlib/System/FormatException.cs b/mcs/class/corlib/System/FormatException.cs
new file mode 100644
index 00000000000..2140db44359
--- /dev/null
+++ b/mcs/class/corlib/System/FormatException.cs
@@ -0,0 +1,39 @@
+//
+// System.FormatException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class FormatException : SystemException {
+ // Constructors
+ public FormatException ()
+ : base (Locale.GetText ("Invalid format"))
+ {
+ }
+
+ public FormatException (string message)
+ : base (message)
+ {
+ }
+
+ public FormatException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected FormatException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/GC.cs b/mcs/class/corlib/System/GC.cs
new file mode 100755
index 00000000000..f478a1f1589
--- /dev/null
+++ b/mcs/class/corlib/System/GC.cs
@@ -0,0 +1,65 @@
+
+
+//
+// System/GC.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ public sealed class GC {
+
+ private GC () {}
+
+ /* as long as we use Boehm... */
+ public static int MaxGeneration {
+ get {return 0;}
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static void InternalCollect (int generation);
+
+ public static void Collect () {
+ InternalCollect (MaxGeneration);
+ }
+
+ public static void Collect (int generation) {
+ if (generation < 0 || generation > MaxGeneration)
+ throw new ArgumentOutOfRangeException ("generation");
+ InternalCollect (generation);
+ }
+
+ public static int GetGeneration (object obj) {
+ return 0;
+ }
+
+ public static int GetGeneration (WeakReference wo) {
+ if (!wo.IsAlive)
+ throw new ArgumentException ();
+ return 0;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long GetTotalMemory (bool forceFullCollection);
+
+ /* this icall has weird semantics check the docs... */
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void KeepAlive (object obj);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void ReRegisterForFinalize (object obj);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void SuppressFinalize (object obj);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void WaitForPendingFinalizers();
+
+ }
+}
diff --git a/mcs/class/corlib/System/Guid.cs b/mcs/class/corlib/System/Guid.cs
new file mode 100755
index 00000000000..5f15c707ce0
--- /dev/null
+++ b/mcs/class/corlib/System/Guid.cs
@@ -0,0 +1,654 @@
+//
+// System.Guid
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using System.Globalization;
+using System.Security.Cryptography;
+
+namespace System {
+
+[Serializable]
+public struct Guid : IFormattable, IComparable {
+
+ private uint _timeLow;
+ private ushort _timeMid;
+ private ushort _timeHighAndVersion;
+ private byte _clockSeqHiAndReserved;
+ private byte _clockSeqLow;
+ private byte _node0;
+ private byte _node1;
+ private byte _node2;
+ private byte _node3;
+ private byte _node4;
+ private byte _node5;
+
+ internal class GuidState {
+ protected Random _prnd; // Pseudo RNG
+ protected RandomNumberGenerator _rnd; // Strong RNG
+ protected bool _usePRnd; // 'true' for pseudo RNG
+ protected ushort _clockSeq;
+ protected ulong _lastTimestamp;
+ protected byte[] _mac;
+
+ public int NextInt(uint x)
+ {
+ if (_usePRnd) {
+ return _prnd.Next ((int) x);
+ }
+ else {
+ byte[] b = new byte[4];
+ _rnd.GetBytes (b);
+
+ uint res = BitConverter.ToUInt32 (b, 0);
+ res = (res % x);
+ return (int) res;
+ }
+ }
+
+ public void NextBytes(byte[] b)
+ {
+ if ( _usePRnd ) {
+ _prnd . NextBytes (b);
+ }
+ else {
+ _rnd . GetBytes (b);
+ }
+ }
+
+ [MonoTODO("Get real MAC address")]
+ public GuidState (bool usePRnd)
+ {
+ _usePRnd = usePRnd;
+ if ( _usePRnd ) {
+ _prnd = new Random (unchecked((int) DateTime.Now.Ticks));
+ }
+ else {
+ _rnd = RandomNumberGenerator.Create ();
+ }
+ _clockSeq = (ushort) NextInt (0x4000); // 14 bits
+ _lastTimestamp = 0ul;
+ _mac = new byte[6];
+ NextBytes (_mac);
+ _mac[0] |= 0x80;
+ }
+
+ public ulong NewTimestamp ()
+ {
+ ulong timestamp;
+
+ do {
+ timestamp = (ulong) (DateTime.UtcNow - new DateTime (1582, 10, 15, 0, 0, 0)).Ticks;
+ if (timestamp < _lastTimestamp) {
+ // clock moved backwards!
+ _clockSeq++;
+ _clockSeq = (ushort) (_clockSeq & 0x3fff);
+ return timestamp;
+ }
+ if (timestamp > _lastTimestamp) {
+ _lastTimestamp = timestamp;
+ return timestamp;
+ }
+ }
+ while (true);
+ }
+
+ public ushort ClockSeq {
+ get {
+ return _clockSeq;
+ }
+ }
+
+ public byte[] MAC {
+ get {
+ return _mac;
+ }
+
+ }
+
+ };
+
+ internal class GuidParser {
+
+ private string _src;
+ private int _length;
+ private int _cur;
+
+ public GuidParser (string src)
+ {
+ _src = src;
+ Reset ();
+ }
+
+ private void Reset ()
+ {
+ _cur = 0;
+ _length = _src.Length;
+ }
+
+ private bool AtEnd ()
+ {
+ return _cur >= _length;
+ }
+
+ private void ThrowFormatException ()
+ {
+ throw new FormatException (Locale.GetText ("Invalid format for Guid.Guid(string)"));
+ }
+
+ private ulong ParseHex(int length, bool strictLength)
+ {
+ ulong res = 0;
+ int i;
+ bool end = false;
+
+ for (i=0; (!end) && i<length; ++i) {
+ if (AtEnd ()) {
+ if (strictLength || i==0) {
+ ThrowFormatException ();
+ }
+ else {
+ end = true;
+ }
+ }
+ else {
+ char c = Char.ToLower (_src[_cur]);
+ if (Char.IsDigit (c)) {
+ res = res * 16 + c - '0';
+ _cur++;
+ }
+ else if (c >= 'a' && c <= 'f') {
+ res = res * 16 + c - 'a' + 10;
+ _cur++;
+ }
+ else {
+ if (strictLength || i==0) {
+ ThrowFormatException ();
+ }
+ else {
+ end = true;
+ }
+ }
+ }
+ }
+
+ return res;
+ }
+
+ private bool ParseOptChar (char c)
+ {
+ if (!AtEnd() && _src[_cur] == c) {
+ _cur++;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private void ParseChar (char c)
+ {
+ bool b = ParseOptChar (c);
+ if (!b) {
+ ThrowFormatException ();
+ }
+ }
+
+ private Guid ParseGuid1 ()
+ {
+ bool openBrace;
+ int a;
+ short b;
+ short c;
+ byte[] d = new byte[8];
+ int i;
+
+ openBrace = ParseOptChar ('{');
+ a = (int) ParseHex(8, true);
+ ParseChar('-');
+ b = (short) ParseHex(4, true);
+ ParseChar('-');
+ c = (short) ParseHex(4, true);
+ ParseChar('-');
+ for (i=0; i<8; ++i) {
+ d[i] = (byte) ParseHex(2, true);
+ if (i == 1) {
+ ParseChar('-');
+ }
+ }
+
+ if (openBrace && !ParseOptChar('}')) {
+ ThrowFormatException ();
+ }
+
+ return new Guid(a, b, c, d);
+ }
+
+ private void ParseHexPrefix ()
+ {
+ ParseChar ('0');
+ ParseChar ('x');
+ }
+
+ private Guid ParseGuid2 ()
+ {
+ int a;
+ short b;
+ short c;
+ byte[] d = new byte [8];
+ int i;
+
+ ParseChar ('{');
+ ParseHexPrefix ();
+ a = (int) ParseHex (8, false);
+ ParseChar (',');
+ ParseHexPrefix ();
+ b = (short) ParseHex (4, false);
+ ParseChar (',');
+ ParseHexPrefix ();
+ c = (short) ParseHex (4, false);
+ ParseChar (',');
+ ParseChar ('{');
+ for (i=0; i<8; ++i) {
+ ParseHexPrefix ();
+ d[i] = (byte) ParseHex (2, false);
+ if (i != 7) {
+ ParseChar (',');
+ }
+
+ }
+ ParseChar ('}');
+ ParseChar ('}');
+
+ return new Guid (a,b,c,d);
+
+ }
+
+ public Guid Parse ()
+ {
+ Guid g;
+
+ try {
+ g = ParseGuid1 ();
+ }
+ catch (FormatException) {
+ Reset ();
+ g = ParseGuid2 ();
+ }
+ if (!AtEnd () ) {
+ ThrowFormatException ();
+ }
+ return g;
+ }
+
+ }
+
+ private static GuidState _guidState = new GuidState ( true /* use pseudo RNG? */ );
+
+ private static void CheckNull (object o)
+ {
+ if (o == null) {
+ throw new ArgumentNullException (Locale.GetText ("Value cannot be null."));
+ }
+ }
+
+ private static void CheckLength (byte[] o, int l)
+ {
+ if (o . Length != l) {
+ throw new ArgumentException (String.Format (Locale.GetText ("Array should be exactly {0} bytes long."), l));
+ }
+ }
+
+ private static void CheckArray (byte[] o, int l)
+ {
+ CheckNull (o);
+ CheckLength (o, l);
+ }
+
+ public Guid (byte[] b)
+ {
+ CheckArray (b, 16);
+ _timeLow = System.BitConverter.ToUInt32 (b, 0);
+ _timeMid = System.BitConverter.ToUInt16 (b, 4);
+ _timeHighAndVersion = System.BitConverter.ToUInt16 (b, 6);
+ _clockSeqHiAndReserved = b[8];
+ _clockSeqLow = b[9];
+ _node0 = b[10];
+ _node1 = b[11];
+ _node2 = b[12];
+ _node3 = b[13];
+ _node4 = b[14];
+ _node5 = b[15];
+ }
+
+ public Guid (string g)
+ {
+ CheckNull (g);
+
+ GuidParser p = new GuidParser (g);
+ Guid guid = p.Parse();
+
+ this = guid;
+ }
+
+ public Guid (int a, short b, short c, byte[] d)
+ {
+ CheckArray(d, 8);
+ _timeLow = (uint) a;
+ _timeMid = (ushort) b;
+ _timeHighAndVersion = (ushort) c;
+ _clockSeqHiAndReserved = d[0];
+ _clockSeqLow = d[1];
+ _node0 = d[2];
+ _node1 = d[3];
+ _node2 = d[4];
+ _node3 = d[5];
+ _node4 = d[6];
+ _node5 = d[7];
+ }
+
+ public Guid (
+ int a,
+ short b,
+ short c,
+ byte d,
+ byte e,
+ byte f,
+ byte g,
+ byte h,
+ byte i,
+ byte j,
+ byte k)
+ : this((uint) a, (ushort) b, (ushort) c, d, e, f, g, h, i, j, k) {}
+
+ [CLSCompliant(false)]
+ public Guid (
+ uint a,
+ ushort b,
+ ushort c,
+ byte d,
+ byte e,
+ byte f,
+ byte g,
+ byte h,
+ byte i,
+ byte j,
+ byte k)
+ {
+ _timeLow = a;
+ _timeMid = b;
+ _timeHighAndVersion = c;
+ _clockSeqHiAndReserved = d;
+ _clockSeqLow = e;
+ _node0 = f;
+ _node1 = g;
+ _node2 = h;
+ _node3 = i;
+ _node4 = j;
+ _node5 = k;
+ }
+
+ public static readonly Guid Empty = new Guid(0,0,0,0,0,0,0,0,0,0,0);
+
+ private static int Compare (uint x, uint y)
+ {
+ if (x < y) {
+ return -1;
+ }
+ else {
+ return 1;
+ }
+ }
+
+ public int CompareTo (object value )
+ {
+ if (value == null )
+ return 1;
+
+ if (!(value is Guid)) {
+ throw new ArgumentException (Locale.GetText (
+ "Argument of System.Guid.CompareTo should be a Guid"));
+ }
+
+ Guid v = (Guid) value;
+
+ if (_timeLow != v._timeLow ) {
+ return Compare(_timeLow, v._timeLow);
+ }
+ else if (_timeMid != v._timeMid) {
+ return Compare(_timeMid, v._timeMid);
+ }
+ else if (_timeHighAndVersion != v._timeHighAndVersion) {
+ return Compare(_timeHighAndVersion, v._timeHighAndVersion);
+ }
+ else if (_clockSeqHiAndReserved != v._clockSeqHiAndReserved) {
+ return Compare(_clockSeqHiAndReserved, v._clockSeqHiAndReserved);
+ }
+ else if (_clockSeqLow != v._clockSeqLow) {
+ return Compare(_clockSeqLow, v._clockSeqLow);
+ }
+ else if (_node0 != v._node0) {
+ return Compare(_node0, v._node0);
+ }
+ else if (_node1 != v._node1) {
+ return Compare(_node1, v._node1);
+ }
+ else if (_node2 != v._node2) {
+ return Compare(_node2, v._node2);
+ }
+ else if (_node3 != v._node3) {
+ return Compare(_node3, v._node3);
+ }
+ else if (_node4 != v._node4) {
+ return Compare(_node4, v._node4);
+ }
+ else if (_node5 != v._node5) {
+ return Compare(_node5, v._node5);
+ }
+
+ return 0;
+ }
+
+ public override bool Equals ( object o )
+ {
+ try {
+ return CompareTo (o) == 0;
+ }
+ catch ( ArgumentException ) {
+ return false;
+ }
+ }
+
+ public override int GetHashCode ()
+ {
+ int res;
+
+ res = (int) _timeLow;
+ res = res ^ ((int) _timeMid << 16 | _timeHighAndVersion);
+ res = res ^ ((int) _clockSeqHiAndReserved << 24);
+ res = res ^ ((int) _clockSeqLow << 16);
+ res = res ^ ((int) _node0 << 8);
+ res = res ^ ((int) _node1);
+ res = res ^ ((int) _node2 << 24);
+ res = res ^ ((int) _node3 << 16);
+ res = res ^ ((int) _node4 << 8);
+ res = res ^ ((int) _node5);
+
+ return res;
+ }
+
+ private static Guid NewTimeGuid()
+ {
+ ulong timestamp = _guidState.NewTimestamp ();
+
+ // Bit [31..0] (32 bits) for timeLow
+ uint timeLow = (uint) (timestamp & 0x00000000fffffffful);
+ // Bit [47..32] (16 bits) for timeMid
+ ushort timeMid = (ushort) ((timestamp & 0x0000ffff00000000ul) >> 32);
+ // Bit [59..48] (12 bits) for timeHi
+ ushort timeHi = (ushort) ((timestamp & 0x0fff000000000000ul) >> 48);
+ // Bit [7..0] (8 bits) for clockSeqLo
+ byte clockSeqLow = (byte) (Guid._guidState.ClockSeq & 0x00ffu);
+ // Bit [13..8] (6 bits) for clockSeqHi
+ byte clockSeqHi = (byte) ((Guid._guidState.ClockSeq & 0x3f00u) >> 8);
+ byte[] mac = _guidState.MAC;
+
+ clockSeqHi = (byte) (clockSeqHi | 0x80u); // Bit[7] = 1, Bit[6] = 0 (Variant)
+ timeHi = (ushort) (timeHi | 0x1000u); // Bit[15..13] = 1 (Guid is time-based)
+
+ return new Guid(timeLow, timeMid, timeHi, clockSeqHi, clockSeqLow, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ }
+
+ private static Guid NewRandomGuid ()
+ {
+ byte[] b = new byte[16];
+
+ _guidState.NextBytes (b);
+
+ Guid res = new Guid(b);
+ // Mask in Variant 1-0 in Bit[7..6]
+ res._clockSeqHiAndReserved = (byte) ((res._clockSeqHiAndReserved & 0x3fu) | 0x80u);
+ // Mask in Version 4 (random based Guid) in Bits[15..13]
+ res._timeHighAndVersion = (ushort) ((res._timeHighAndVersion & 0x0fffu) | 0x4000u);
+ return res;
+ }
+
+ [MonoTODO]
+ public static Guid NewGuid ()
+ {
+ return NewRandomGuid();
+ }
+
+ public byte[] ToByteArray ()
+ {
+ byte[] res = new byte[16];
+ byte[] tmp;
+ int d = 0;
+ int s;
+
+ tmp = BitConverter.GetBytes(_timeLow);
+ for (s=0; s<4; ++s) {
+ res[d++] = tmp[s];
+ }
+
+ tmp = BitConverter.GetBytes(_timeMid);
+ for (s=0; s<2; ++s) {
+ res[d++] = tmp[s];
+ }
+
+ tmp = BitConverter.GetBytes(_timeHighAndVersion);
+ for (s=0; s<2; ++s) {
+ res[d++] = tmp[s];
+ }
+
+ res[8] = _clockSeqHiAndReserved;
+ res[9] = _clockSeqLow;
+ res[10] = _node0;
+ res[11] = _node1;
+ res[12] = _node2;
+ res[13] = _node3;
+ res[14] = _node4;
+ res[15] = _node5;
+
+ return res;
+ }
+
+ private string BaseToString(bool h, bool p, bool b)
+ {
+ string res = "";
+
+ if (p) {
+ res += "(";
+ }
+ else if (b) {
+ res += "{";
+ }
+
+ res += _timeLow.ToString ("x8");
+ if (h) {
+ res += "-";
+ }
+ res += _timeMid.ToString ("x4");
+ if (h) {
+ res += "-";
+ }
+ res += _timeHighAndVersion.ToString ("x4");
+ if (h) {
+ res += "-";
+ }
+ res += _clockSeqHiAndReserved.ToString ("x2");
+ res += _clockSeqLow.ToString ("x2");
+ if (h) {
+ res += "-";
+ }
+ res += _node0.ToString ("x2");
+ res += _node1.ToString ("x2");
+ res += _node2.ToString ("x2");
+ res += _node3.ToString ("x2");
+ res += _node4.ToString ("x2");
+ res += _node5.ToString ("x2");
+
+ if (p) {
+ res += ")";
+ }
+ else if (b) {
+ res += "}";
+ }
+
+ return res;
+ }
+
+ public override string ToString ()
+ {
+ return BaseToString (true, false, false);
+ }
+
+ public string ToString (string format)
+ {
+ string f;
+ bool h = true;
+ bool p = false;
+ bool b = false;
+
+ if (format != null) {
+ f = format.ToLower();
+
+ if (f == "b") {
+ b = true;
+ }
+ else if (f == "p") {
+ p = true;
+ }
+ else if (f == "n") {
+ h = false;
+ }
+ else if (f != "d" && f != "") {
+ throw new FormatException ( Locale.GetText ("Argument to Guid.ToString(string format) should be \"b\", \"B\", \"d\", \"D\", \"n\", \"N\", \"p\" or \"P\""));
+ }
+ }
+
+ return BaseToString (h, p, b);
+ }
+
+ public string ToString (string format, IFormatProvider provider)
+ {
+ return ToString (format);
+ }
+
+ public static bool operator == (Guid a, Guid b)
+ {
+ return a.Equals(b);
+ }
+
+ public static bool operator != (Guid a, Guid b)
+ {
+ return !( a.Equals (b) );
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/System/IAppDomainSetup.cs b/mcs/class/corlib/System/IAppDomainSetup.cs
new file mode 100644
index 00000000000..31eddcd62b7
--- /dev/null
+++ b/mcs/class/corlib/System/IAppDomainSetup.cs
@@ -0,0 +1,37 @@
+
+//
+// System/IAppDomainSetup.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System {
+
+ public interface IAppDomainSetup {
+
+ string ApplicationBase { get; set; }
+
+ string ApplicationName { get; set; }
+
+ string CachePath { get; set; }
+
+ string ConfigurationFile { get; set; }
+
+ string DynamicBase { get; set; }
+
+ string LicenseFile { get; set; }
+
+ string PrivateBinPath { get; set; }
+
+ string PrivateBinPathProbe { get; set; }
+
+ string ShadowCopyDirectories { get; set; }
+
+ string ShadowCopyFiles { get; set; }
+ }
+}
diff --git a/mcs/class/corlib/System/IAsyncResult.cs b/mcs/class/corlib/System/IAsyncResult.cs
new file mode 100644
index 00000000000..74ec69b8c7a
--- /dev/null
+++ b/mcs/class/corlib/System/IAsyncResult.cs
@@ -0,0 +1,43 @@
+//------------------------------------------------------------------------------
+//
+// System.IAsyncResult.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Mon 08/24/2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ public interface IAsyncResult
+ {
+ object AsyncState
+ {
+ get;
+ }
+
+ WaitHandle AsyncWaitHandle
+ {
+ get;
+ }
+
+ bool CompletedSynchronously
+ {
+ get;
+ }
+
+ bool IsCompleted
+ {
+ get;
+ }
+ }
+
+} // Namespace System
+
+
diff --git a/mcs/class/corlib/System/ICloneable.cs b/mcs/class/corlib/System/ICloneable.cs
new file mode 100644
index 00000000000..792550db1f5
--- /dev/null
+++ b/mcs/class/corlib/System/ICloneable.cs
@@ -0,0 +1,15 @@
+//
+// System.ICloneable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface ICloneable {
+ object Clone ();
+ }
+}
diff --git a/mcs/class/corlib/System/IComparable.cs b/mcs/class/corlib/System/IComparable.cs
new file mode 100644
index 00000000000..50af10d15e2
--- /dev/null
+++ b/mcs/class/corlib/System/IComparable.cs
@@ -0,0 +1,15 @@
+//
+// System.IComparable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IComparable {
+ int CompareTo (object obj);
+ }
+}
diff --git a/mcs/class/corlib/System/IConvertible.cs b/mcs/class/corlib/System/IConvertible.cs
new file mode 100644
index 00000000000..95612b04c21
--- /dev/null
+++ b/mcs/class/corlib/System/IConvertible.cs
@@ -0,0 +1,55 @@
+//
+// System.IConvertible.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+//
+// Functions Implementing this interface should check out
+// System.Convert. Most of these methods are implemented
+// there for all these data types.
+//
+// System.Convert has ToType helper method for the object
+// ToType (Type conversionType, IFormatProvider provider)
+// method. In most cases you can specify your ToType function
+// as calling
+//
+// public Type value; // value of this data type
+// public object ToType(Type conversionType, IFormatProvider provider) {
+// Convert.ToType (value, conversionType, provider);
+// }
+//
+// Which is just a wrapper for your ToType methods.
+//
+// See http://lists.ximian.com/archives/public/mono-list/2001-July/000525.html
+// for more discussion on the topic
+//
+
+namespace System {
+
+ [CLSCompliant(false)]
+ public interface IConvertible {
+
+ TypeCode GetTypeCode ();
+
+ bool ToBoolean (IFormatProvider provider);
+ byte ToByte (IFormatProvider provider);
+ char ToChar (IFormatProvider provider);
+ DateTime ToDateTime (IFormatProvider provider);
+ decimal ToDecimal (IFormatProvider provider);
+ double ToDouble (IFormatProvider provider);
+ short ToInt16 (IFormatProvider provider);
+ int ToInt32 (IFormatProvider provider);
+ long ToInt64 (IFormatProvider provider);
+ sbyte ToSByte (IFormatProvider provider);
+ float ToSingle (IFormatProvider provider);
+ string ToString (IFormatProvider provider);
+ object ToType (Type conversionType, IFormatProvider provider);
+ ushort ToUInt16 (IFormatProvider provider);
+ uint ToUInt32 (IFormatProvider provider);
+ ulong ToUInt64 (IFormatProvider provider);
+ }
+}
diff --git a/mcs/class/corlib/System/ICustomFormatter.cs b/mcs/class/corlib/System/ICustomFormatter.cs
new file mode 100644
index 00000000000..1c51ab9c025
--- /dev/null
+++ b/mcs/class/corlib/System/ICustomFormatter.cs
@@ -0,0 +1,15 @@
+//
+// System.ICustomFormatter.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface ICustomFormatter {
+ string Format (string format, object arg, IFormatProvider formatProvider);
+ }
+}
diff --git a/mcs/class/corlib/System/IDisposable.cs b/mcs/class/corlib/System/IDisposable.cs
new file mode 100644
index 00000000000..6c3ca1b6367
--- /dev/null
+++ b/mcs/class/corlib/System/IDisposable.cs
@@ -0,0 +1,17 @@
+//
+// System.IDisposable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IDisposable {
+
+ void Dispose ();
+
+ }
+}
diff --git a/mcs/class/corlib/System/IFormatProvider.cs b/mcs/class/corlib/System/IFormatProvider.cs
new file mode 100644
index 00000000000..266c62d1295
--- /dev/null
+++ b/mcs/class/corlib/System/IFormatProvider.cs
@@ -0,0 +1,15 @@
+//
+// System.IFormatProvider.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IFormatProvider {
+ object GetFormat (Type format_type);
+ }
+}
diff --git a/mcs/class/corlib/System/IFormattable.cs b/mcs/class/corlib/System/IFormattable.cs
new file mode 100644
index 00000000000..1769f4034c0
--- /dev/null
+++ b/mcs/class/corlib/System/IFormattable.cs
@@ -0,0 +1,15 @@
+//
+// System.IFormattable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IFormattable {
+ string ToString (string format, IFormatProvider format_provider);
+ }
+}
diff --git a/mcs/class/corlib/System/IServiceProvider.cs b/mcs/class/corlib/System/IServiceProvider.cs
new file mode 100644
index 00000000000..13992c20145
--- /dev/null
+++ b/mcs/class/corlib/System/IServiceProvider.cs
@@ -0,0 +1,20 @@
+//
+// System.IServiceProvider.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System {
+
+// [ComVisible(false)]
+ public interface IServiceProvider {
+
+ object GetService (Type serviceType);
+
+ }
+}
diff --git a/mcs/class/corlib/System/IndexOutOfRangeException.cs b/mcs/class/corlib/System/IndexOutOfRangeException.cs
new file mode 100644
index 00000000000..7246ddefb7e
--- /dev/null
+++ b/mcs/class/corlib/System/IndexOutOfRangeException.cs
@@ -0,0 +1,31 @@
+//
+// System.IndexOutOfRangeException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class IndexOutOfRangeException : SystemException {
+ // Constructors
+ public IndexOutOfRangeException ()
+ : base (Locale.GetText ("Array index is out of range"))
+ {
+ }
+
+ public IndexOutOfRangeException (string message)
+ : base (message)
+ {
+ }
+
+ public IndexOutOfRangeException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Int16.cs b/mcs/class/corlib/System/Int16.cs
new file mode 100644
index 00000000000..9b4c24f1d55
--- /dev/null
+++ b/mcs/class/corlib/System/Int16.cs
@@ -0,0 +1,235 @@
+//
+// System.Int16.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct Int16 : IComparable, IFormattable, IConvertible {
+
+ public const short MaxValue = 32767;
+ public const short MinValue = -32768;
+
+ internal short value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Int16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Int16"));
+
+ short xv = (short) v;
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Int16))
+ return false;
+
+ return ((short) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static short Parse (string s)
+ {
+ short val = 0;
+ int len;
+ int i, sign = 1;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ sign = -1;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked ((short) (val * 10 + (c - '0') * sign));
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static short Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static short Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ public static short Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ int tmpResult = Int32.Parse (s, style, fp);
+ if (tmpResult > Int16.MaxValue || tmpResult < Int16.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (short) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Int16;
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Int32.cs b/mcs/class/corlib/System/Int32.cs
new file mode 100644
index 00000000000..0ce48ca0461
--- /dev/null
+++ b/mcs/class/corlib/System/Int32.cs
@@ -0,0 +1,490 @@
+//
+// System.Int32.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [Serializable]
+ public struct Int32 : IComparable, IFormattable, IConvertible {
+
+ public const int MaxValue = 0x7fffffff;
+ public const int MinValue = -2147483648;
+
+ internal int value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Int32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Int32"));
+
+ int xv = (int) v;
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Int32))
+ return false;
+
+ return ((int) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static int Parse (string s)
+ {
+ int val = 0;
+ int len;
+ int i, sign = 1;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ sign = -1;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked (val * 10 + (c - '0') * sign);
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static int Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static int Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ internal static void CheckStyle (NumberStyles style)
+ {
+ if ((style & NumberStyles.AllowHexSpecifier) != 0) {
+ NumberStyles ne = style ^ NumberStyles.AllowHexSpecifier;
+ if ((ne & NumberStyles.AllowLeadingWhite) != 0)
+ ne ^= NumberStyles.AllowLeadingWhite;
+ if ((ne & NumberStyles.AllowTrailingWhite) != 0)
+ ne ^= NumberStyles.AllowTrailingWhite;
+ if (ne != 0)
+ throw new ArgumentException (
+ "With AllowHexSpecifier only " +
+ "AllowLeadingWhite and AllowTrailingWhite " +
+ "are permitted.");
+ }
+ }
+
+ internal static int JumpOverWhite (int pos, string s, bool excp)
+ {
+ while (pos < s.Length && Char.IsWhiteSpace (s [pos]))
+ pos++;
+
+ if (excp && pos >= s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ return pos;
+ }
+
+ internal static void FindSign (ref int pos, string s, NumberFormatInfo nfi,
+ ref bool foundSign, ref bool negative)
+ {
+ if ((pos + nfi.NegativeSign.Length) <= s.Length &&
+ s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign) {
+ negative = true;
+ foundSign = true;
+ pos += nfi.NegativeSign.Length;
+ }
+ else if ((pos + nfi.PositiveSign.Length) < s.Length &&
+ s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign) {
+ negative = false;
+ pos += nfi.PositiveSign.Length;
+ foundSign = true;
+ }
+ }
+
+ internal static void FindCurrency (ref int pos,
+ string s,
+ NumberFormatInfo nfi,
+ ref bool foundCurrency)
+ {
+ if ((pos + nfi.CurrencySymbol.Length) <= s.Length &&
+ s.Substring (pos, nfi.CurrencySymbol.Length) == nfi.CurrencySymbol) {
+ foundCurrency = true;
+ pos += nfi.CurrencySymbol.Length;
+ }
+ }
+
+ internal static bool FindOther (ref int pos,
+ string s,
+ string other)
+ {
+ if ((pos + other.Length) <= s.Length &&
+ s.Substring (pos, other.Length) == other) {
+ pos += other.Length;
+ return true;
+ }
+
+ return false;
+ }
+
+ internal static bool ValidDigit (char e, bool allowHex)
+ {
+ if (allowHex)
+ return Char.IsDigit (e) || (e >= 'A' && e <= 'F') || (e >= 'a' && e <= 'f');
+
+ return Char.IsDigit (e);
+ }
+
+ public static int Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not " +
+ "in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ int number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ int digitValue;
+ char hexDigit;
+
+ // Number stuff
+ do {
+
+ if (!ValidDigit (s [pos], AllowHexSpecifier)) {
+ if (AllowThousands &&
+ FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (int) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (int) (hexDigit - 'a' + 10);
+ else
+ digitValue = (int) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 - digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ // Calculations done as negative
+ // (abs (MinValue) > abs (MaxValue))
+ number = checked (
+ number * 10 -
+ (int) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length && s [pos] != '\u0000')
+ throw new FormatException ("Input string was not in the correct format.");
+
+
+ if (!negative)
+ number = -number;
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return IntegerFormatter.FormatGeneral(value, 0, null, true);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp )
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString (format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Int32;
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return value;
+ }
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Int64.cs b/mcs/class/corlib/System/Int64.cs
new file mode 100644
index 00000000000..f057aa8d87d
--- /dev/null
+++ b/mcs/class/corlib/System/Int64.cs
@@ -0,0 +1,432 @@
+//
+// System.Int64.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [Serializable]
+ public struct Int64 : IComparable, IFormattable, IConvertible {
+
+ public const long MaxValue = 0x7fffffffffffffff;
+ public const long MinValue = -9223372036854775808;
+
+ internal long value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Int64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Int64"));
+
+ if (value == (long) v)
+ return 0;
+
+ if (value < (long) v)
+ return -1;
+
+ return 1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Int64))
+ return false;
+
+ return ((long) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ public static long Parse (string s)
+ {
+ long val = 0;
+ int len;
+ int i;
+ int sign = 1;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ sign = -1;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked (val * 10 + (c - '0') * sign);
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static long Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static long Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ public static long Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not " +
+ "in the correct format: s.Length==0.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ Int32.CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format: Has Negative Sign.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format: Has Positive Sign.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ Int32.FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ Int32.FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ Int32.FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ long number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ int digitValue;
+ char hexDigit;
+
+ // Number stuff
+ do {
+
+ if (!Int32.ValidDigit (s [pos], AllowHexSpecifier)) {
+ if (AllowThousands &&
+ (Int32.FindOther (ref pos, s, nfi.NumberGroupSeparator)
+ || Int32.FindOther (ref pos, s, nfi.CurrencyGroupSeparator)))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ (Int32.FindOther (ref pos, s, nfi.NumberDecimalSeparator)
+ || Int32.FindOther (ref pos, s, nfi.CurrencyDecimalSeparator))) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (int) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (int) (hexDigit - 'a' + 10);
+ else
+ digitValue = (int) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 - digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ // Calculations done as negative
+ // (abs (MinValue) > abs (MaxValue))
+ number = checked (
+ number * 10 -
+ (long) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format: nDigits == 0.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ Int32.FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ Int32.FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ if (nfi.CurrencyPositivePattern == 3 && s[pos++] != ' ')
+ throw new FormatException ("Input string was not in the correct format: no space between number and currency symbol.");
+
+ Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency && pos < s.Length) {
+ if (AllowTrailingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ Int32.FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = Int32.JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format: No room for close parens.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = Int32.JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length && s [pos] != '\u0000')
+ throw new FormatException ("Input string was not in the correct format: Did not parse entire string. pos = "
+ + pos + " s.Length = " + s.Length);
+
+
+ if (!negative)
+ number = -number;
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString (format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Int64;
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/IntPtr.cs b/mcs/class/corlib/System/IntPtr.cs
new file mode 100644
index 00000000000..bb12f2482f1
--- /dev/null
+++ b/mcs/class/corlib/System/IntPtr.cs
@@ -0,0 +1,165 @@
+//
+// System.IntPtr.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// Maintainer:
+// Michael Lambert, michaellambert@email.com
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// Remarks: Requires '/unsafe' compiler option. This class uses void*,
+// in overloaded constructors, conversion, and cast members in
+// the public interface. Using pointers is not valid CLS and
+// the methods in question have been marked with the
+// CLSCompliant attribute that avoid compiler warnings.
+//
+// FIXME: How do you specify a native int in C#? I am going to have to do some figuring out
+//
+
+using System;
+using System.Runtime.Serialization;
+
+#if __MonoCS__
+#else
+[
+ assembly: System.CLSCompliant(true)
+]
+#endif
+
+namespace System {
+
+ [
+ CLSCompliant(true)
+ ]
+ [Serializable]
+ public unsafe struct IntPtr : ISerializable {
+
+ private void *value;
+
+ public static readonly IntPtr Zero;
+
+ static IntPtr ()
+ {
+ Zero.value = (void *) 0;
+ }
+
+ public IntPtr (int i32)
+ {
+ value = (void *) i32;
+ }
+
+ public IntPtr (long i64)
+ {
+ value = (void *) i64;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public IntPtr (void *ptr)
+ {
+ value = ptr;
+ }
+
+ public static int Size {
+ get {
+ return sizeof (void *);
+ }
+ }
+
+ public void GetObjectData (SerializationInfo si, StreamingContext sc)
+ {
+ if( si == null )
+ throw new ArgumentNullException( "si" );
+
+ si.AddValue("value", (long) value);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.IntPtr))
+ return false;
+
+ return ((IntPtr) o).value == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ public int ToInt32 ()
+ {
+ return (int) value;
+ }
+
+ public long ToInt64 ()
+ {
+ return (long) value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public void *ToPointer ()
+ {
+ return value;
+ }
+
+ override public string ToString ()
+ {
+ if (Size == 4)
+ return ((int) value).ToString ();
+ else
+ return ((long) value).ToString ();
+ }
+
+ public static bool operator == (IntPtr a, IntPtr b)
+ {
+ return (a.value == b.value);
+ }
+
+ public static bool operator != (IntPtr a, IntPtr b)
+ {
+ return (a.value != b.value);
+ }
+
+ public static explicit operator IntPtr (int value)
+ {
+ return new IntPtr (value);
+ }
+
+ public static explicit operator IntPtr (long value)
+ {
+ return new IntPtr (value);
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public static explicit operator IntPtr (void *value)
+ {
+ return new IntPtr (value);
+ }
+
+ public static explicit operator int (IntPtr value)
+ {
+ return (int) value.value;
+ }
+
+ public static explicit operator long (IntPtr value)
+ {
+ return (long) value.value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public static explicit operator void * (IntPtr value)
+ {
+ return value.value;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/IntegerFormatter.cs b/mcs/class/corlib/System/IntegerFormatter.cs
new file mode 100644
index 00000000000..fa5bdd3f80b
--- /dev/null
+++ b/mcs/class/corlib/System/IntegerFormatter.cs
@@ -0,0 +1,4041 @@
+//
+// System.IntegerFormatter.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+//
+// (C) Derek Holden dholden@draper.com
+//
+
+//
+// Format integer types. Completely based off ECMA docs
+// for IFormattable specification. Has been tested w/
+// all integral types, from boundry to boundry, w/ all
+// formats A## ("G", "G0" ... "G99", "P", "P0" ... "P99").
+//
+// If you make any changes, please make sure to check the
+// boundry format precisions (0, 99) and the min / max values
+// of the data types (Int32.[Max/Min]Value).
+//
+// Using int as an example, it is currently set up as
+//
+// Int32 {
+// int value;
+// public string ToString (string format, NumberFormatInfo nfi) {
+// return IntegerFormatter.NumberToString (format, nfi, value);
+// }
+//
+// IntegerFormatter {
+// public string NumberToString (string format, NumberFormatInfo nfi, int value) {
+// ParseFormat (format);
+// switch (format type) {
+// case 'G' FormatGeneral(value, precision);
+// case 'R' throw Exception("Invalid blah blah");
+// case 'C' FromatCurrency(value, precision, nfi);
+// etc...
+// }
+// }
+// }
+//
+// There is a property in NumberFormatInfo for NegativeSign, though the
+// definition of IFormattable just uses '-' in context. So all the
+// hardcoded uses of '-' in here may need to be changed to nfi.NegativeSign
+//
+// For every integral type.
+//
+// Before every Format<Format Type> block there is a small paragraph
+// detailing its requirements, and a blurb of what I was thinking
+// at the time.
+//
+// Some speedup suggestions to be done when after this appears
+// to be working properly:
+//
+// * Deal w/ out of range numbers better. Specifically with
+// regards to boundry cases such as Long.MinValue etc.
+// The previous way of if (value < 0) value = -value;
+// fails under this assumption, since the largest
+// possible MaxValue is < absolute value of the MinValue.
+// I do the first iteration outside of the loop, and then
+// convert the number to positive, then continue in the loop.
+//
+// * Replace all occurances of max<Type>Length with their
+// numerical values. Plus the places where things are set
+// to max<Type>Length - 1. Hardcode these to numbers.
+//
+// * Move the code for all the NumberToString()'s into the
+// the main ToString (string, NumberFormatInfo) method in
+// the data types themselves. That way they'd be throwing
+// their own exceptions on error and it'd save a function
+// call.
+//
+// * For integer to char buffer transformation, you could
+// implement the calculations of the 10's and 100's place
+// the same time w/ another table to shorten loop time.
+//
+// * Someone smarter can prolly find a much more efficient
+// way of formatting the exponential notation. It's still
+// done in pass, just may have too many repositioning
+// calculations.
+//
+// * Decide whether it be better to have functions that
+// handle formatting for all types, or just cast their
+// values out and format them. Just if library size is
+// more important than speed in saving a cast and a
+// function call.
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System {
+
+ internal sealed class IntegerFormatter {
+
+ private static int maxByteLength = 4;
+ private static int maxShortLength = 6;
+ private static int maxIntLength = 12;
+ private static int maxLongLength = 22;
+
+ private static char[] digitLowerTable;
+/**
+ * This makes a TypeNotInitialized exception be thrown.
+ * { '0', '1', '2', '3', '4', '5', '6', '7',
+ * '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ */
+
+ private static char[] digitUpperTable;
+/*
+ * { '0', '1', '2', '3', '4', '5', '6', '7',
+ * '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ */
+
+ static IntegerFormatter ()
+ {
+ int i;
+
+ digitLowerTable = new char[16];
+ digitUpperTable = new char[16];
+
+ for (i = 0; i < 10; i++){
+ digitLowerTable[i] = (char) ('0' + i);
+ digitUpperTable[i] = (char) ('0' + i);
+ }
+
+ char lc = (char ) ('a' - i);
+ char uc = (char ) ('A' - i);
+ while (i < 16){
+ digitLowerTable[i] = (char) (lc + i);
+ digitUpperTable[i] = (char) (uc + i);
+ i++;
+ }
+ }
+
+ private static bool IsDigit (char c)
+ {
+ return !(c < '0' || c > '9');
+ }
+
+ private static bool IsLetter (char c)
+ {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ }
+
+ private static bool ParseFormat (string format, out char specifier, out int precision, out bool custom)
+ {
+ precision = -1;
+ specifier = '\0';
+ custom = false;
+
+ int length = format.Length;
+ // TODO: Could an empty string be a custom format string?
+ if (length < 1)
+ return false;
+
+ char[] chars = format.ToCharArray ();
+ specifier = chars[0];
+
+ // TODO: IsLetter() and IsDigit() should be replaced by Char.Is*()
+ if (IsLetter(specifier) && length <= 3) {
+ switch (length){
+ case 1:
+ return true;
+ case 2:
+ if (IsDigit(chars[1])) {
+ precision = chars[1] - '0';
+ return true;
+ }
+ break;
+ case 3:
+ if (IsDigit(chars[1]) && IsDigit(chars[2])) {
+ precision = chars[1] - '0';
+ precision = precision * 10 + chars[2] - '0';
+ return true;
+ }
+ break;
+ }
+
+ }
+
+ // We've got a custom format string.
+ custom = true;
+ return true;
+ }
+
+ // ============ Public Interface to all the integer types ============ //
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, byte value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, short value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this insance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, int value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, long value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, sbyte value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, ushort value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, uint value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, ulong value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ // ============ Currency Type Formating ============ //
+
+ //
+ // Currency Format: Used for strings containing a monetary value. The
+ // CurrencySymbol, CurrencyGroupSizes, CurrencyGroupSeparator, and
+ // CurrencyDecimalSeparator members of a NumberFormatInfo supply
+ // the currency symbol, size and separator for digit groupings, and
+ // decimal separator, respectively.
+ // CurrencyNegativePattern and CurrencyPositivePattern determine the
+ // symbols used to represent negative and positive values. For example,
+ // a negative value may be prefixed with a minus sign, or enclosed in
+ // parentheses.
+ // If the precision specifier is omitted
+ // NumberFormatInfo.CurrencyDecimalDigits determines the number of
+ // decimal places in the string. Results are rounded to the nearest
+ // representable value when necessary.
+ //
+ // The pattern of the NumberFormatInfo determines how the output looks, where
+ // the dollar sign goes, where the negative sign goes, etc.
+ // IFormattable documentation lists the patterns and their values,
+ // I have them commented out in the large switch statement
+ //
+
+ private static string FormatCurrency (byte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((uint)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (short value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((int)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (int value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = negative ? nfi.CurrencyNegativePattern : nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -$nnn
+ // break;
+ // case 2: // $-nnn
+ // break;
+ case 3: // $nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 5: // -nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 6: // nnn-$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 7: // nnn$-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 8: // -nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ case 10: // nnn $-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 11: // $ nnn-
+ buffy[--position] = '-';
+ break;
+ // case 12: // $ -nnn
+ // break;
+ case 13: // nnn- $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ case 14: // ($ nnn)
+ buffy[--position] = ')';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // just in place to take care of the negative boundries (Int32.MinValue)
+ if (negative) {
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 1: // -$nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 2: // $-nnn
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 3: // $nnn-
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = '(';
+ break;
+ case 5: // -nnn$
+ buffy[--position] = '-';
+ break;
+ // case 6: // nnn-$
+ // break;
+ // case 7: // nnn$-
+ // break;
+ case 8: // -nnn $
+ buffy[--position] = '-';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ // case 10: // nnn $-
+ // break;
+ case 11: // $ nnn-
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 12: // $ -nnn
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 13: // nnn- $
+ // break;
+ case 14: // ($ nnn)
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = '(';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatCurrency (long value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = negative ? nfi.CurrencyNegativePattern : nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -$nnn
+ // break;
+ // case 2: // $-nnn
+ // break;
+ case 3: // $nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 5: // -nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 6: // nnn-$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 7: // nnn$-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 8: // -nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ case 10: // nnn $-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 11: // $ nnn-
+ buffy[--position] = '-';
+ break;
+ // case 12: // $ -nnn
+ // break;
+ case 13: // nnn- $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ case 14: // ($ nnn)
+ buffy[--position] = ')';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ if (negative) {
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 1: // -$nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 2: // $-nnn
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 3: // $nnn-
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = '(';
+ break;
+ case 5: // -nnn$
+ buffy[--position] = '-';
+ break;
+ // case 6: // nnn-$
+ // break;
+ // case 7: // nnn$-
+ // break;
+ case 8: // -nnn $
+ buffy[--position] = '-';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ // case 10: // nnn $-
+ // break;
+ case 11: // $ nnn-
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 12: // $ -nnn
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 13: // nnn- $
+ // break;
+ case 14: // ($ nnn)
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = '(';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatCurrency (sbyte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((int)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (ushort value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((uint)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible, no negative
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatCurrency (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible, no negative
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Format Decimal Types ============ //
+
+ //
+ // Used only for integral data types. Negative values are
+ // represented by using a '-' sign. The precision specifies
+ // how many digits are to appear in the string. If it is >
+ // how many digits we need, the left side is padded w/ 0's.
+ // If it is smaller than what we need, it is discarded.
+ //
+ // Fairly simple implementation. Fill the buffer from right
+ // to left w/ numbers, then if we still have precision left
+ // over, pad w/ zeros.
+ //
+
+ private static string FormatDecimal (byte value, int precision)
+ {
+ return FormatDecimal ((uint)value, precision);
+ }
+
+ private static string FormatDecimal (short value, int precision)
+ {
+ return FormatDecimal ((int)value, precision);
+ }
+
+ private static string FormatDecimal (int value, int precision)
+ {
+ int size = (precision > 0) ? (maxIntLength + precision) : maxIntLength;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatDecimal (long value, int precision)
+ {
+ int size = (precision > 0) ? (maxLongLength + precision) : maxLongLength;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatDecimal (sbyte value, int precision)
+ {
+ return FormatDecimal ((int)value, precision);
+ }
+
+ private static string FormatDecimal (ushort value, int precision)
+ {
+ return FormatDecimal ((uint)value, precision);
+ }
+
+ private static string FormatDecimal (uint value, int precision)
+ {
+ int size = (precision > 0) ? (maxIntLength + precision) : maxIntLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatDecimal (ulong value, int precision)
+ {
+ int size = (precision > 0) ? (maxLongLength + precision) : maxLongLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Format Exponentials ============ //
+
+ //
+ // Used for strings in the format [-]M.DDDDDDe+XXX.
+ // Exaclty one non-zero digit must appear in M, w/
+ // a '-' sign if negative. The precision determines
+ // number of decimal places, if not given go 6 places.
+ // If precision > the number of places we need, it
+ // is right padded w/ 0's. If it is smaller than what
+ // we need, we cut off and round. The format specifier
+ // decides whether we use an uppercase E or lowercase e.
+ //
+ // Tried to do this in one pass of one buffer, but it
+ // wasn't happening. Get a buffer + 7 extra slots for
+ // the -, ., E, +, and XXX. Parse the value into another
+ // temp buffer, then build the new string. For the
+ // integral data types, there are a couple things that
+ // can be hardcoded. Since an int and a long can't be
+ // larger than 20 something spaces, the first X w/
+ // always be 0, and the the exponential value will only
+ // be 2 digits long. Also integer types w/ always
+ // have a positive exponential.
+ //
+
+ private static string FormatExponential (byte value, int precision, bool upper)
+ {
+ return FormatExponential ((uint)value, precision, upper);
+ }
+
+ private static string FormatExponential (short value, int precision, bool upper)
+ {
+ return FormatExponential ((int)value, precision, upper);
+ }
+
+ private static string FormatExponential (int value, int precision, bool upper)
+ {
+ bool negative = (value < 0);
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0, position = maxIntLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ uint number = (negative) ? (uint)((-(value + 1)) + 1) : (uint)value;
+
+ // need to calculate the number of places to know if we need to round later
+ if (negative && value <= -10) {
+ value /= -10;
+ exp++;
+ }
+
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // go left to right in filling up new string
+ if (negative)
+ buffy[idx++] = '-';
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxIntLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ private static string FormatExponential (long value, int precision, bool upper)
+ {
+ bool negative = (value < 0);
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0, position = maxLongLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ ulong number = (negative) ? (ulong)((-(value + 1)) + 1) : (ulong)value;
+
+ // need to calculate the number of places to know if we need to round later
+ if (negative && value <= -10) {
+ value /= -10;
+ exp++;
+ }
+
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // go left to right in filling up new string
+ if (negative)
+ buffy[idx++] = '-';
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxLongLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ private static string FormatExponential (sbyte value, int precision, bool upper)
+ {
+ return FormatExponential ((int)value, precision, upper);
+ }
+
+ private static string FormatExponential (ushort value, int precision, bool upper)
+ {
+ return FormatExponential ((uint)value, precision, upper);
+ }
+
+ private static string FormatExponential (uint value, int precision, bool upper)
+ {
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0, position = maxIntLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+ ulong number = (ulong)value;
+
+ // need to calculate the number of places to know if we need to round later
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxIntLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ private static string FormatExponential (ulong value, int precision, bool upper)
+ {
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0, position = maxLongLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+ ulong number = value;
+
+ // need to calculate the number of places to know if we need to round later
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxLongLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ // ============ Format Fixed Points ============ //
+
+ //
+ // Used for strings in the following form "[-]M.DD...D"
+ // At least one non-zero digit precedes the '.', w/ a
+ // '-' before that if negative. Precision specifies number
+ // of decimal places 'D' to go. If not given, use
+ // NumberFormatInfo.NumbeDecimalDigits. Results are rounded
+ // if necessary.
+ //
+ // Fairly simple implementation for integral types. Going
+ // from right to left, fill up precision number of 0's,
+ // plop a . down, then go for our number.
+ //
+
+ private static string FormatFixedPoint (byte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((uint)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (short value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((int)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (int value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxIntLength) : (nfi.NumberDecimalDigits + maxIntLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+ bool negative = (value < 0);
+ // fill up w/ precision # of 0's
+ while (position > (maxIntLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ if (negative)
+ if (value <= -10) {
+ buffy[position--] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ private static string FormatFixedPoint (long value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxLongLength) : (nfi.NumberDecimalDigits + maxLongLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+ bool negative = (value < 0);
+
+ // fill up w/ precision # of 0's
+ while (position > (maxLongLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ if (negative)
+ if (value <= -10) {
+ buffy[position--] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ private static string FormatFixedPoint (sbyte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((int)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (ushort value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((uint)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxIntLength) : (nfi.NumberDecimalDigits + maxIntLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+
+ // fill up w/ precision # of 0's
+ while (position > (maxIntLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ private static string FormatFixedPoint (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxLongLength) : (nfi.NumberDecimalDigits + maxLongLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+
+ // fill up w/ precision # of 0's
+ while (position > (maxLongLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ // ============ Format General ============ //
+
+ //
+ // Strings are formatted in either Fixed Point or Exponential
+ // format. Results are rounded when needed. If no precision is
+ // given, the defaults are:
+ //
+ // short & ushort: 5
+ // int & uint: 10
+ // long & ulong: 19
+ // float: 7
+ // double: 15
+ // decimal: 29
+ //
+ // The value is formatted using fixed-point if exponent >= -4
+ // and exponent < precision, where exponent is he exponenent of
+ // the value in exponential format. The decimal point and trailing
+ // zeros are removed when possible.
+ //
+ // For all other values, exponential format is used. The case of
+ // the format specifier determines whether 'e' or 'E' prefixes
+ // the exponent.
+ //
+ // In either case, the number of digits that appear in the result
+ // (not including the exponent) will not exceed the value of the
+ // precision. The result is rounded as needed.
+ //
+ // Integral values are formatted using Fixed Point whenever
+ // precision is omitted. (This actually doesn't make sense when
+ // coupled w/ the 1st paragraph).
+ //
+ // Okay, so the decimal point is removed along with any trailing
+ // zeros. So, ignoring the last paragraph, we can consider an int
+ // ToString() to format it w/ exponential format w/ a default
+ // precision of 10, but since it will just be .00000000, it's
+ // discarded.
+ //
+
+ internal static string FormatGeneral (byte value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((uint)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (short value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((int)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (int value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ bool negative = (value < 0);
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0;
+ int position = maxIntLength;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ uint number = (negative) ? (uint)((-(value + 1)) + 1) : (uint)value;
+
+ // get number into a buffer, going to be doing this no matter what
+ if (negative)
+ if (value <= -10) {
+ tmp[--position] = digitLowerTable[-(value % 10)];
+ value /= -10;
+ exponent++;
+ } else value = -value;
+
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision) {
+ if (negative)
+ tmp[--position] = '-';
+
+ return new string (tmp, position, (maxIntLength - position));
+ }
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxIntLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)(precision + 6);
+ char[] buffy = new char[pow];
+
+ if (negative)
+ buffy[position++] = '-';
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ internal static string FormatGeneral (long value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ bool negative = (value < 0);
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0;
+ int position = maxLongLength;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ ulong number = (negative) ? (ulong)(-(value + 1) + 1) : (ulong)value;
+
+ // get number into a buffer, going to be doing this no matter what
+ if (negative)
+ if (value <= -10) {
+ tmp[--position] = digitLowerTable[-(value % 10)];
+ value /= -10;
+ } else value = -value;
+
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+ exponent = (maxLongLength - position) - 1;
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision) {
+ if (negative)
+ tmp[--position] = '-';
+
+ return new string (tmp, position, (maxLongLength - position));
+ }
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxLongLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)precision + 6;
+ char[] buffy = new char[pow];
+
+ if (negative)
+ buffy[position++] = '-';
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ internal static string FormatGeneral (sbyte value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((int)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (ushort value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((uint)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (uint value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0;
+ int position = maxIntLength;
+ ulong number = (ulong)value;
+
+ // get number into a buffer, going to be doing this no matter what
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+ exponent = (maxIntLength - position) - 1;
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision)
+ return new string (tmp, position, (maxIntLength - position));
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxIntLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)(precision + 6);
+ char[] buffy = new char[pow];
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ internal static string FormatGeneral (ulong value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0;
+ int position = maxLongLength;
+ ulong number = value;
+
+ // get number into a buffer, going to be doing this no matter what
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision)
+ return new string (tmp, position, (maxLongLength - position));
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxLongLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)precision + 6;
+ char[] buffy = new char[pow];
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ // ============ Format Number ============ //
+
+ //
+ // Used for strings in the following form "[-]d,ddd,ddd.dd...d"
+ // The minus sign only appears if it is negative. At least one
+ // non-zero digit preceeds the decimal separator. The precision
+ // specifier determines the number of decimal places. If it is
+ // not given, use NumberFormatInfo.NumberDecimalDigits.
+ // The NumberGroupSizes, NumberGroupSeparator, and NumberDecimalSeparator
+ // members of NumberFormatInfo supply the size and separator
+ // for digit groupings. See IFormattable.
+ //
+ // The group sizes is an array of ints that determine the grouping
+ // of numbers. All digits are in the range 1-9, with the last digit
+ // being between 0-9. The number formats the string backwards, with
+ // the last digit being the group size for the rest of (leftmost) the
+ // the string, 0 being none.
+ //
+ // For instance:
+ // groupSizes = { 3, 2, 1, 0 };
+ // int n = 1234567890 => "1234,5,67,890"
+ // groupSizes = { 3, 2, 1 };
+ // int n = 1234567890 => "1,2,3,4,5,67,890"
+ // groupSizes = { 2, 0 };
+ // int n = 1234567890 => "1234567,90";
+ //
+ // Not too difficult, jsut keep track of where you are in the array
+ // and when to print the separator
+ //
+ // The max size of the buffer is assume we have a separator every
+ // number, plus the precision on the end, plus a spot for the negative
+ // and a spot for decimal separator.
+ //
+
+ private static string FormatNumber (byte value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((uint)value, precision, nfi);
+ }
+
+ private static string FormatNumber (short value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((int)value, precision, nfi);
+ }
+
+ private static string FormatNumber (int value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int pattern = nfi.NumberNegativePattern;
+ int size = maxIntLength + (maxIntLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 4;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -nnn
+ // break;
+ // case 2: // - nnn
+ // break;
+ case 3: // nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // nnn -
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = '(';
+ break;
+ case 1: // -nnn
+ buffy[--position] = '-';
+ break;
+ case 2: // - nnn
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ // case 3: // nnn-
+ // break;
+ // case 4: // nnn -
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatNumber (long value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int pattern = nfi.NumberNegativePattern;
+ int size = maxLongLength + (maxLongLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 4;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -nnn
+ // break;
+ // case 2: // - nnn
+ // break;
+ case 3: // nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // nnn -
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = '(';
+ break;
+ case 1: // -nnn
+ buffy[--position] = '-';
+ break;
+ case 2: // - nnn
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ // case 3: // nnn-
+ // break;
+ // case 4: // nnn -
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatNumber (sbyte value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((int)value, precision, nfi);
+ }
+
+ private static string FormatNumber (ushort value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((uint)value, precision, nfi);
+ }
+
+ private static string FormatNumber (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int size = maxIntLength + (maxIntLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 2;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatNumber (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int size = maxLongLength + (maxLongLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 2;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Percent Formatting ============ //
+
+ //
+ // Percent Format: Used for strings containing a percentage. The
+ // PercentSymbol, PercentGroupSizes, PercentGroupSeparator, and
+ // PercentDecimalSeparator members of a NumberFormatInfo supply
+ // the Percent symbol, size and separator for digit groupings, and
+ // decimal separator, respectively.
+ // PercentNegativePattern and PercentPositivePattern determine the
+ // symbols used to represent negative and positive values. For example,
+ // a negative value may be prefixed with a minus sign, or enclosed in
+ // parentheses.
+ // If no precision is specified, the number of decimal places in the result
+ // is set by NumberFormatInfo.PercentDecimalDigits. Results are
+ // rounded to the nearest representable value when necessary.
+ // The result is scaled by 100 (.99 becomes 99%).
+ //
+ // The pattern of the number determines how the output looks, where
+ // the percent sign goes, where the negative sign goes, etc.
+ // IFormattable documentation lists the patterns and their values,
+ // I have them commented out in the switch statement
+ //
+
+ private static string FormatPercent (byte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((uint)value, precision, nfi);
+ }
+
+ private static string FormatPercent (short value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((int)value, precision, nfi);
+ }
+
+ private static string FormatPercent (int value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = negative ? nfi.PercentNegativePattern : nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // %nnn
+ // break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // all values are multiplied by 100, so tack on two 0's
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ buffy[--position] = '-';
+ break;
+ case 1: // -nnn%
+ buffy[--position] = '-';
+ break;
+ case 2: // -%nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatPercent (long value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = negative ? nfi.PercentNegativePattern : nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // %nnn
+ // break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // all values are multiplied by 100, so tack on two 0's
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ buffy[--position] = '-';
+ break;
+ case 1: // -nnn%
+ buffy[--position] = '-';
+ break;
+ case 2: // -%nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatPercent (sbyte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((int)value, precision, nfi);
+ }
+
+ private static string FormatPercent (ushort value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((uint)value, precision, nfi);
+ }
+
+ private static string FormatPercent (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatPercent (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Format Hexadecimal ============ //
+
+ //
+ // For strings in base 16. Only valid w/ integers. Precision
+ // specifies number of digits in the string, if it specifies
+ // more digits than we need, left pad w/ 0's. The case of the
+ // the format specifier 'X' or 'x' determines lowercase or
+ // capital digits in the output.
+ //
+ // Whew. Straight forward Hex formatting, however only
+ // go 8 places max when dealing with an int (not counting
+ // precision padding) and 16 when dealing with a long. This
+ // is to cut off the loop when dealing with negative values,
+ // which will loop forever when you hit -1;
+ //
+
+ private static string FormatHexadecimal (byte value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxByteLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ ushort mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (byte)(value >> 4);
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (short value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxShortLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ short mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 4 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (short)(value >> 4);
+ } while (value != 0 && position > (size - 4));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (int value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxIntLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ int mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 8 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = value >> 4;
+ } while (value != 0 && position > (size - 8));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (long value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxLongLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ long mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 16 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = value >> 4;
+ } while (value != 0 && position > (size - 16));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (sbyte value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxByteLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ short mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 2 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (sbyte)(value >> 4);
+ } while (value != 0 && position > (size - 2));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (ushort value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxShortLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ int mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (ushort)(value >> 4);
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (uint value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxIntLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ uint mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = value >> 4;
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (ulong value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxLongLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ ulong mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[value & mask];
+ value = value >> 4;
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ // ============ Format Custom ============ //
+
+ private static string FormatCustom (string format, sbyte number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, short number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, int number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, long number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, byte number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+
+ private static string FormatCustom (string format, ushort number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+
+ private static string FormatCustom (string format, uint number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+
+ private static string FormatCustom (string format, ulong number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+ }
+
+class FormatSection {
+ public int nph;
+ public int nphPreDot;
+ public int npercent;
+ public int ndividers;
+ public int ntokens;
+ public string [] tokens;
+ public int [] TokenTypes;
+ public bool HaveDot;
+ public bool HaveSci;
+ public bool sciSignAlways = false;
+ public int sciDigits;
+ public int numCommas;
+}
+
+class FormatParse {
+ const int AS_IS = 0;
+ const int PH_0 = 1;
+ const int PH_NUMBER = 2;
+ const int COMMA = 3;
+ const int PERCENT = 4;
+ const int DIVIDERS = 5;
+ const int DOT = 6;
+ const int ESCAPE_SEQ = 7;
+ const int SCIENTIFIC = 8;
+ const int NEW_SECTION = 9;
+ private FormatSection [] sections = new FormatSection[3];
+ private int nsections = 0;
+ private int pos; // Position in the format string
+ private int group = 0; // Used in FormatPlain to insert a comma between groups of digits
+ private bool isNegative;
+
+ private FormatParse ()
+ {
+ }
+
+ public FormatParse (string format)
+ {
+ parseFormat (format);
+ }
+
+ private void FormatSci (char [] digits, ArrayList outputList, FormatSection sec)
+ {
+ int tokidx = sec.ntokens - 1;
+
+ // Output everything until we get to the SCIENTIFIC
+ while (tokidx >= 0 && sec.TokenTypes [tokidx] != SCIENTIFIC){
+ outputList.Add ((string) sec.tokens [tokidx--]);
+ }
+
+ // Exponent
+ int exponent = digits.Length - sec.nph;
+ outputList.Add ((string) exponent.ToString ());
+ if (sec.sciSignAlways && exponent > 0)
+ outputList.Add ("+");
+ outputList.Add ((string) sec.tokens [tokidx--]);
+
+ if (exponent < 0) {
+ char [] newDigits;
+ exponent = -exponent;
+ newDigits = new char [digits.Length + exponent];
+ Array.Copy (digits, 0, newDigits, exponent, digits.Length);
+ for (int i = 0; i < exponent; i++)
+ newDigits[i] = '0';
+ digits = newDigits;
+ }
+
+ // Now format the rest
+ int digitIdx = 0;
+ if (sec.HaveDot)
+ FormatDot (digits, ref digitIdx, outputList, sec, tokidx, 0);
+ else
+ FormatPlain (digits, ref digitIdx, outputList, sec, tokidx, 0, sec.numCommas > 0);
+ }
+
+ private void FormatDot (char [] digits, ref int digitIdx, ArrayList outputList,
+ FormatSection sec, int lastToken, int firstToken)
+ {
+ int tokidx = lastToken;
+ int type;
+
+ while (tokidx >= firstToken) {
+ type = sec.TokenTypes [tokidx];
+ if (type == DOT || type == PH_NUMBER || type == PH_0)
+ break;
+ tokidx--;
+ }
+
+ if (tokidx > 0) {
+ char [] postDotDigits = new char [sec.nph - sec.nphPreDot];
+ int max = (postDotDigits.Length > digits.Length) ? digits.Length : postDotDigits.Length;
+ Array.Copy (digits, 0, postDotDigits, 0, max);
+ int postDotDigitsIdx = 0;
+ FormatPlain (postDotDigits, ref postDotDigitsIdx, outputList, sec, lastToken, tokidx, false);
+ tokidx--;
+ digitIdx += max;
+ FormatPlain (digits, ref digitIdx, outputList, sec, tokidx, 0, sec.numCommas > 0);
+ }
+ }
+
+ private void FormatPlain (char [] digits, ref int digitIdx, ArrayList outputList,
+ FormatSection sec, int lastToken, int firstToken, bool insertComma)
+ {
+ int tokidx = lastToken;
+ int type;
+ int leftMostZeroIdx = -1;
+
+ while (tokidx >= firstToken) {
+ type = sec.TokenTypes [tokidx];
+ if (type == PH_0 || type == PH_NUMBER) {
+ if (type == PH_0)
+ leftMostZeroIdx = tokidx;
+ // Console.WriteLine ("group : {0}", group);
+ int i = sec.tokens [tokidx].Length - 1;
+ while (i >= 0) {
+ if (insertComma && group == 3) {
+ outputList.Add (","); // FIXME: from NumberFormatInfo
+ group = 0;
+ }
+
+ if (digitIdx < digits.Length)
+ outputList.Add ((string) digits[digitIdx++].ToString ());
+ else
+ outputList.Add ("0");
+
+ i--;
+ if (insertComma)
+ group++;
+ sec.nph--;
+ while (sec.nph == 0 && digitIdx < digits.Length) {
+ // Flush the numbers left
+ if (insertComma && group == 3){
+ outputList.Add (","); // FIXME: from NumberFormatInfo
+ group = 0;
+ }
+ outputList.Add ((string) digits [digitIdx++].ToString ());
+ if (insertComma)
+ group++;
+ }
+
+ if (sec.nph == 0 && isNegative)
+ outputList.Add ("-");
+ }
+ } else {
+ outputList.Add ((string) sec.tokens [tokidx]);
+ }
+ tokidx--;
+ }
+
+ // Remove any insignificant zeros we might have at the end
+ // if we never saw any zeros in the format string, leftMostZeroIdx will be -1
+ if (leftMostZeroIdx < 0)
+ while ((string)outputList[outputList.Count-1] == "0")
+ outputList.RemoveAt (outputList.Count-1);
+ else
+ while (leftMostZeroIdx-- > 0)
+ if ((string)outputList[outputList.Count-1] == "0")
+ outputList.RemoveAt (outputList.Count-1);
+ }
+
+ private char [] AdjustDigits (string number, FormatSection sec)
+ {
+ char [] digits = number.ToCharArray ();
+ char [] newDigits = digits;
+ int decPointIdx = 0;
+ int postDot = 0;
+
+ decPointIdx -= sec.ndividers * 3;
+ decPointIdx += sec.npercent * 2;
+ if (sec.HaveDot){
+ postDot = sec.nph - sec.nphPreDot;
+ decPointIdx += postDot;
+ }
+
+ if (decPointIdx > 0) {
+ newDigits = new char [digits.Length + decPointIdx];
+ Array.Copy (digits, 0, newDigits, 0, digits.Length);
+ for (int i = 0; i < decPointIdx; i++)
+ newDigits[digits.Length + i] = '0';
+ } else if (decPointIdx < 0) {
+ decPointIdx = -decPointIdx;
+ if (decPointIdx >= digits.Length) {
+ if (sec.HaveSci){
+ } else {
+ // The numbers turns into 0 when formatting applied
+ digits = new char [1] {'0'};
+ }
+ } else {
+ int newLength = digits.Length - decPointIdx + postDot - 1;
+ newDigits = new char [newLength];
+ int max = digits.Length >= newLength ? newLength : digits.Length;
+ Array.Copy (digits, 0, newDigits, 0, max);
+ if (newLength > digits.Length)
+ for (int i = 0; i < decPointIdx; i++)
+ newDigits[digits.Length + i] = '0';
+ }
+ }
+
+ return newDigits;
+ }
+
+ public string FormatNumber (string number, int signValue)
+ {
+ char [] digits;
+
+ isNegative = signValue < 0;
+ int section = 0;
+ if (signValue < 0 && nsections > 0)
+ section = 1;
+ if (signValue == 0 && nsections > 1)
+ section = 2;
+
+ if (number [0] == '-')
+ number = number.Substring (1);
+
+ FormatSection sec = sections [section];
+ digits = AdjustDigits (number.ToString (), sec);
+ if (digits.Length == 1 && digits [0] == '0')
+ if (nsections > 2)
+ sec = sections [2]; // Format as a 0
+ else
+ sec = sections [0]; // Format as positive
+
+ ArrayList outputList = new ArrayList ();
+
+ int digitIdx = 0;
+ Array.Reverse (digits);
+
+ if (sec.HaveSci)
+ FormatSci (digits, outputList, sec);
+ else if (sec.HaveDot)
+ FormatDot (digits, ref digitIdx, outputList, sec, sec.ntokens - 1, 0);
+ else
+ FormatPlain (digits, ref digitIdx, outputList, sec, sec.ntokens - 1, 0, sec.numCommas > 0);
+
+ string result = "";
+ for (int i = outputList.Count - 1; i >= 0; i--) {
+ result += (string) outputList[i];
+ }
+
+ return result;
+ }
+
+ private void parseFormat (string format)
+ {
+ char [] fmt_chars = format.ToCharArray ();
+ int fmtlen = fmt_chars.Length;
+ int type = AS_IS;
+ int prevType = AS_IS;
+ string token;
+
+ sections[0] = new FormatSection();
+ while (pos < fmtlen) {
+
+ token = getNextToken (fmt_chars, fmtlen, out type);
+ if (type == NEW_SECTION) {
+ nsections++;
+ if (nsections > 3)
+ break;
+ sections[nsections] = new FormatSection();
+ } else {
+ prevType = AddToken (token, type, prevType);
+ }
+ }
+ }
+
+ private int AddToken (string token, int type, int prevType)
+ {
+ FormatSection sec = sections[nsections];
+ string [] newTokens = new string [sec.ntokens + 1];
+ int [] newTokenTypes = new int [sec.ntokens + 1];
+ for (int i = 0; i < sec.ntokens; i++) {
+ newTokens[i] = sec.tokens[i];
+ newTokenTypes[i] = sec.TokenTypes[i];
+ }
+
+ switch (type) {
+ case ESCAPE_SEQ :
+ type = AS_IS;
+ break;
+ case COMMA :
+ if (!sec.HaveDot && (prevType == PH_0 || prevType == PH_NUMBER)) {
+ sec.numCommas++;
+ } else
+ type = AS_IS;
+
+ token = "";
+ break;
+ case DOT :
+ if (!sec.HaveDot && (prevType == PH_0 || prevType == PH_NUMBER ||
+ prevType == DIVIDERS || prevType == COMMA)) {
+ sec.HaveDot = true;
+ sec.nphPreDot = sec.nph;
+ } else
+ type = AS_IS;
+
+ break;
+ case PERCENT :
+ sec.npercent++;
+ break;
+ case DIVIDERS :
+ token = "";
+ if (!sec.HaveDot)
+ sec.ndividers = token.Length;
+ else
+ type = AS_IS;
+ break;
+ case PH_0 :
+ if (!sec.HaveSci)
+ sec.nph += token.Length;
+ else
+ type = AS_IS;
+ break;
+ case PH_NUMBER :
+ if (!sec.HaveSci)
+ sec.nph += token.Length;
+ else
+ type = AS_IS;
+ break;
+ case SCIENTIFIC :
+ if (!sec.HaveSci && sec.nph > 0) {
+ sec.HaveSci = true;
+ char [] sci = token.ToCharArray ();
+ sec.sciSignAlways = sci[1] == '+' ? true : false;
+ int expLen = sci[1] == '0' ? token.Length - 1 : token.Length - 2;
+ sec.sciDigits = expLen;
+ token = sci[0].ToString ();
+ } else {
+ type = AS_IS;
+ }
+ break;
+ }
+
+ newTokens[sec.ntokens] = token;
+ newTokenTypes[sec.ntokens] = type;
+ sec.tokens = newTokens;
+ sec.TokenTypes = newTokenTypes;
+ sec.ntokens++;
+ return type;
+ }
+
+ private string getNextToken (char [] fmt_chars, int fmtlen, out int type)
+ {
+ int curpos = pos;
+ string result = null;
+ char current;
+
+ type = AS_IS; // Default
+ current = fmt_chars[curpos];
+ if (current == ';'){
+ type = NEW_SECTION;
+ result = "NEW_SECTION";
+ pos++;
+ }
+ else if (current == '\'' || current == '"') {
+ char Quote = current;
+ curpos++;
+ int endpos = Array.IndexOf (fmt_chars, current, curpos);
+ if (endpos == -1)
+ endpos = fmtlen;
+ result = new string (fmt_chars, curpos, endpos - curpos);
+ pos = endpos + 1;
+ }
+ else if (current == '\\') { //MS seems not to translate escape seqs!
+ type = ESCAPE_SEQ;
+ current = fmt_chars[++pos];
+ result = current.ToString ();
+ pos++;
+ }
+ else if (current == '%') {
+ type = PERCENT;
+ result = "%";
+ pos++;
+ }
+ else if (current == '.') {
+ type = DOT;
+ result = ".";
+ pos++;
+ }
+ else if (current == ',') {
+ int begpos = curpos;
+
+ while (++curpos < fmtlen && fmt_chars[curpos] == ',');
+ if (curpos == fmtlen || fmt_chars[curpos] == '.') {
+ // ,,,,
+ result = new string (fmt_chars, begpos, curpos - begpos);
+ type = DIVIDERS;
+ pos = curpos;
+ } else {
+ result = ",";
+ type = COMMA;
+ pos++;
+ }
+ }
+ else if (current == '0' || current == '#') {
+ char placeHolder = current;
+ int begpos = curpos;
+ type = placeHolder == '0' ? PH_0 : PH_NUMBER;
+ curpos++;
+ while (curpos < fmtlen && fmt_chars [curpos] == placeHolder)
+ curpos++;
+ result = new string (fmt_chars, begpos, curpos - begpos);
+ pos = curpos;
+ }
+ else if (current == 'e' || current == 'E') {
+ if (fmtlen <= curpos + 1){
+ result = current.ToString ();
+ pos++;
+ }
+ else {
+ char next1 = fmt_chars [curpos + 1];
+
+ if (next1 != '-' && next1 != '+' && next1 != '0') {
+ result = new string (fmt_chars, curpos, 2);
+ pos += 2;
+ }
+ else {
+ int begpos = curpos;
+
+ if (next1 == '-' || next1 == '+')
+ curpos++;
+
+ curpos++;
+
+ if (curpos < fmtlen && fmt_chars [curpos] == '0'){
+ type = SCIENTIFIC;
+ while (curpos < fmtlen && fmt_chars [curpos] == '0')
+ curpos++;
+ }
+
+ result = new string (fmt_chars, begpos, curpos - begpos);
+ pos = curpos;
+ }
+ }
+ }
+ else {
+ char [] format_spec = { '0', '#', ',', '.', '%', 'E', 'e', '"', '\'', '\\' };
+ int nextFE;
+
+ while (curpos < fmtlen) {
+ current = fmt_chars[curpos];
+ nextFE = Array.IndexOf (format_spec, current);
+ if (nextFE != -1)
+ break;
+ curpos++;
+ }
+
+ result = new string (fmt_chars, pos, curpos - pos);
+ pos = curpos;
+ }
+
+ return result;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System/InvalidCastException.cs b/mcs/class/corlib/System/InvalidCastException.cs
new file mode 100644
index 00000000000..1d16ad5ce4d
--- /dev/null
+++ b/mcs/class/corlib/System/InvalidCastException.cs
@@ -0,0 +1,39 @@
+//
+// System.InvalidCastException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class InvalidCastException : SystemException {
+ // Constructors
+ public InvalidCastException ()
+ : base (Locale.GetText ("Cannot cast from source type to destination type"))
+ {
+ }
+
+ public InvalidCastException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidCastException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected InvalidCastException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/InvalidOperationException.cs b/mcs/class/corlib/System/InvalidOperationException.cs
new file mode 100644
index 00000000000..fddef520eb6
--- /dev/null
+++ b/mcs/class/corlib/System/InvalidOperationException.cs
@@ -0,0 +1,38 @@
+//
+// System.InvalidOperationException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class InvalidOperationException : SystemException {
+ // Constructors
+ public InvalidOperationException ()
+ : base (Locale.GetText ("The requested operation cannot be performed"))
+ {
+ }
+
+ public InvalidOperationException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidOperationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected InvalidOperationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/InvalidProgramException.cs b/mcs/class/corlib/System/InvalidProgramException.cs
new file mode 100644
index 00000000000..da235f0bf8e
--- /dev/null
+++ b/mcs/class/corlib/System/InvalidProgramException.cs
@@ -0,0 +1,31 @@
+//
+// System.InvalidProgramException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class InvalidProgramException : SystemException {
+ // Constructors
+ public InvalidProgramException ()
+ : base (Locale.GetText ("Metadata is incorrect"))
+ {
+ }
+
+ public InvalidProgramException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidProgramException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/LoaderOptimization.cs b/mcs/class/corlib/System/LoaderOptimization.cs
new file mode 100644
index 00000000000..23b865a32e5
--- /dev/null
+++ b/mcs/class/corlib/System/LoaderOptimization.cs
@@ -0,0 +1,18 @@
+//
+// System.LoaderOptimization.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ public enum LoaderOptimization
+ {
+ NotSpecified = 0,
+ SingleDomain = 1,
+ MultiDomain = 2,
+ MultiDomainHost = 3
+ }
+}
diff --git a/mcs/class/corlib/System/LoaderOptimizationAttribute.cs b/mcs/class/corlib/System/LoaderOptimizationAttribute.cs
new file mode 100644
index 00000000000..5a531965306
--- /dev/null
+++ b/mcs/class/corlib/System/LoaderOptimizationAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.LoaderOptimizationAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class LoaderOptimizationAttribute : Attribute
+ {
+ private LoaderOptimization lo;
+
+ // Constructors
+ public LoaderOptimizationAttribute (byte value)
+ {
+ lo = (LoaderOptimization) value;
+ }
+
+ public LoaderOptimizationAttribute (LoaderOptimization value)
+ {
+ lo = value;
+ }
+
+ // Properties
+ public LoaderOptimization Value
+ {
+ get { return lo; }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/LocalDataStoreSlot.cs b/mcs/class/corlib/System/LocalDataStoreSlot.cs
new file mode 100755
index 00000000000..c191d5c7619
--- /dev/null
+++ b/mcs/class/corlib/System/LocalDataStoreSlot.cs
@@ -0,0 +1,26 @@
+//
+// System.LocalDataStoreSlot.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ public sealed class LocalDataStoreSlot
+ {
+ internal LocalDataStoreSlot ()
+ {
+ }
+
+ [MonoTODO("Spec: Finalize locks the data store manager before marking the data slot as unoccupied")]
+ ~LocalDataStoreSlot()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MTAThreadAttribute.cs b/mcs/class/corlib/System/MTAThreadAttribute.cs
new file mode 100644
index 00000000000..514bca495a4
--- /dev/null
+++ b/mcs/class/corlib/System/MTAThreadAttribute.cs
@@ -0,0 +1,19 @@
+//
+// System.MTAThreadAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class MTAThreadAttribute : Attribute
+ {
+ // Constructors
+ public MTAThreadAttribute () : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MarshalByRefObject.cs b/mcs/class/corlib/System/MarshalByRefObject.cs
new file mode 100644
index 00000000000..c32e7ef564b
--- /dev/null
+++ b/mcs/class/corlib/System/MarshalByRefObject.cs
@@ -0,0 +1,47 @@
+//
+// System.MarshalByRefObject.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting;
+
+namespace System {
+
+ [Serializable]
+ public abstract class MarshalByRefObject
+ {
+ Identity _identity; // Holds marshalling iformation of the object
+
+ internal Identity ObjectIdentity
+ {
+ get { return _identity; }
+ set { _identity = value; }
+ }
+
+ public virtual ObjRef CreateObjRef (Type type)
+ {
+ // This method can only be called when this object has been marshalled
+ if (_identity == null) throw new RemotingException ("No remoting information was found for the object");
+ return _identity.CreateObjRef (type);
+ }
+
+ public object GetLifetimeService ()
+ {
+ return null;
+ }
+
+ public virtual object InitializeLifetimeService ()
+ {
+ return null;
+ }
+
+ protected MarshalByRefObject ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Math.cs b/mcs/class/corlib/System/Math.cs
new file mode 100644
index 00000000000..6a447226db3
--- /dev/null
+++ b/mcs/class/corlib/System/Math.cs
@@ -0,0 +1,375 @@
+//
+// System.Math.cs
+//
+// Author:
+// Bob Smith (bob@thestuff.net)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Bob Smith. http://www.thestuff.net
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+// [CLSCompliant(false)]
+ public sealed class Math
+ {
+ public const double E = 2.7182818284590452354;
+ public const double PI = 3.14159265358979323846;
+
+ private Math () {}
+
+ public static decimal Abs(decimal value)
+ {
+ return (value < 0)? -value: value;
+ }
+ public static double Abs(double value)
+ {
+ return (value < 0)? -value: value;
+ }
+ public static float Abs(float value)
+ {
+ return (value < 0)? -value: value;
+ }
+ public static int Abs(int value)
+ {
+ if (value == Int32.MinValue)
+ throw new OverflowException (Locale.GetText (Locale.GetText ("Value is too small")));
+ return (value < 0)? -value: value;
+ }
+ public static long Abs(long value)
+ {
+ if (value == Int64.MinValue)
+ throw new OverflowException(Locale.GetText ("Value is too small"));
+ return (value < 0)? -value: value;
+ }
+ [CLSCompliant (false)]
+ public static sbyte Abs(sbyte value)
+ {
+ if (value == SByte.MinValue)
+ throw new OverflowException(Locale.GetText ("Value is too small"));
+ return (sbyte)((value < 0)? -value: value);
+ }
+ public static short Abs(short value)
+ {
+ if (value == Int16.MinValue)
+ throw new OverflowException(Locale.GetText ("Value is too small"));
+ return (short)((value < 0)? -value: value);
+ }
+
+ public static double Ceiling(double a)
+ {
+ if (Double.IsNaN(a)){
+ return Double.NaN;
+ }
+
+ if (Double.IsNegativeInfinity(a)){
+ return Double.NegativeInfinity;
+ }
+
+ if (Double.IsPositiveInfinity(a)){
+ return Double.PositiveInfinity;
+ }
+
+ double b = (double)((long)a);
+ return (b < a)? b+1: b;
+ }
+ public static double Floor(double d) {
+ if (Double.IsNaN(d)){
+ return Double.NaN;
+ }
+
+ if (Double.IsNegativeInfinity(d)){
+ return Double.NegativeInfinity;
+ }
+
+ if (Double.IsPositiveInfinity(d)){
+ return Double.PositiveInfinity;
+ }
+
+ double b = (double)((long)d);
+ return (d < 0 && d != b) ? --b : b;
+ }
+ public static double IEEERemainder(double x, double y)
+ {
+ double r;
+ if (y == 0) return Double.NaN;
+ r = x - (y * Math.Round(x/y));
+ if (r != 0) return r;
+ return (x > 0)? 0: -0;
+ }
+ public static double Log(double a, double newBase)
+ {
+ if (a == 0) return Double.NegativeInfinity;
+ else if (a < 0) return Double.NaN;
+ return Log(a)/Log(newBase);
+ }
+
+ public static byte Max(byte val1, byte val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static decimal Max(decimal val1, decimal val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static double Max(double val1, double val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static float Max(float val1, float val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static int Max(int val1, int val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static long Max(long val1, long val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte Max(sbyte val1, sbyte val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static short Max(short val1, short val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static uint Max(uint val1, uint val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong Max(ulong val1, ulong val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort Max(ushort val1, ushort val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static byte Min(byte val1, byte val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static decimal Min(decimal val1, decimal val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static double Min(double val1, double val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static float Min(float val1, float val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static int Min(int val1, int val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static long Min(long val1, long val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte Min(sbyte val1, sbyte val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static short Min(short val1, short val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static uint Min(uint val1, uint val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong Min(ulong val1, ulong val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort Min(ushort val1, ushort val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+
+ public static decimal Round(decimal d)
+ {
+ decimal r = (decimal)((long)d);
+ decimal a = Abs (d - r);
+ if (a > .5M) return (r >= 0 ? ++r : --r);
+ else if (a <.5M) return r;
+ else
+ {
+ if (r%2 == 0) return r;
+ else return ++r;
+ }
+ }
+ public static decimal Round(decimal d, int decimals)
+ {
+ long p = 1;
+ int c;
+ decimal retval = d;
+ if (decimals < 0 || decimals > 15)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Value is too small or too big."));
+ else if (decimals == 0)
+ return Math.Round(d);
+ for (c=0; c<decimals; c++) p*=10;
+ retval*=p;
+ retval=Math.Round(retval);
+ retval/=p;
+ return retval;
+ }
+ public static double Round(double d)
+ {
+ double r = (double)((long)d);
+ double a = Abs (d - r);
+ if (a > .5) return (r >= 0 ? ++r : --r);
+ else if (a <.5) return r;
+ else
+ {
+ if (r%2 == 0) return r;
+ else return ++r;
+ }
+ }
+ public static double Round(double value, int digits) {
+ long p = 1;
+ int c;
+ double retval = value;
+ if (digits < 0 || digits > 15)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Value is too small or too big."));
+ else if (digits == 0)
+ return Math.Round(value);
+ for (c=0; c<digits; c++) p*=10;
+ retval*=p;
+ retval=Math.Round(retval);
+ retval/=p;
+ return retval;
+ }
+ public static int Sign(decimal value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(double value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(float value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(int value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(long value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+
+ [CLSCompliant (false)]
+ public static int Sign(sbyte value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(short value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+
+ // internal calls
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Sin (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Cos (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Tan (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Sinh (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Cosh (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Tanh (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Acos (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Asin (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Atan (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Atan2 (double y, double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Exp (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Log (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Log10 (double x);
+
+ public static double Pow (double x, double y) {
+ if (Double.IsNaN (x) || Double.IsNaN (y))
+ return Double.NaN;
+ if (Double.IsNegativeInfinity (x))
+ if (((int)y & 1) == 1)
+ return Double.NegativeInfinity;
+ else
+ return Double.PositiveInfinity;
+ if (Double.IsPositiveInfinity (x))
+ if (Double.IsNegativeInfinity (y))
+ return 0;
+ else
+ return Double.PositiveInfinity;
+ if (Double.IsNegativeInfinity (y) || Double.IsPositiveInfinity (y))
+ return Double.NaN;
+
+ return PowImpl (x, y);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static double PowImpl (double x, double y);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Sqrt (double x);
+ }
+}
diff --git a/mcs/class/corlib/System/MemberAccessException.cs b/mcs/class/corlib/System/MemberAccessException.cs
new file mode 100644
index 00000000000..97a556fb7e4
--- /dev/null
+++ b/mcs/class/corlib/System/MemberAccessException.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class MemberAccessException : SystemException {
+
+ public MemberAccessException ()
+ : base (Locale.GetText ("A member access exception has occurred."))
+ {
+ }
+
+ public MemberAccessException (string message)
+ : base (message)
+ {
+ }
+
+ protected MemberAccessException (SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public MemberAccessException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MethodAccessException.cs b/mcs/class/corlib/System/MethodAccessException.cs
new file mode 100644
index 00000000000..16295606174
--- /dev/null
+++ b/mcs/class/corlib/System/MethodAccessException.cs
@@ -0,0 +1,42 @@
+//
+// System.MethodAccessException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class MethodAccessException : MemberAccessException
+ {
+ // Constructors
+ public MethodAccessException ()
+ : base (Locale.GetText ("Attempt to access a private/protected method failed."))
+ {
+ }
+
+ public MethodAccessException (string message)
+ : base (message)
+ {
+ }
+
+ protected MethodAccessException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public MethodAccessException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/MissingFieldException.cs b/mcs/class/corlib/System/MissingFieldException.cs
new file mode 100644
index 00000000000..2a5196ea1c2
--- /dev/null
+++ b/mcs/class/corlib/System/MissingFieldException.cs
@@ -0,0 +1,56 @@
+//
+// System.MissingFieldException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class MissingFieldException : MissingMemberException
+ {
+ // Constructors
+ public MissingFieldException ()
+ : base (Locale.GetText ("Field does not exist."))
+ {
+ }
+
+ public MissingFieldException (string message)
+ : base (message)
+ {
+ }
+
+ protected MissingFieldException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public MissingFieldException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ public MissingFieldException (string className, string fieldName)
+ : base (className, fieldName)
+ {
+ }
+
+ public override string Message
+ {
+ get {
+ if (ClassName == null)
+ return base.Message;
+
+ return "Field " + ClassName + "." + MemberName + " not found.";
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MissingMemberException.cs b/mcs/class/corlib/System/MissingMemberException.cs
new file mode 100644
index 00000000000..a1e2414b917
--- /dev/null
+++ b/mcs/class/corlib/System/MissingMemberException.cs
@@ -0,0 +1,70 @@
+//
+// System.MissingMemberException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class MissingMemberException : MemberAccessException {
+
+ // Fields
+ protected string ClassName;
+ protected string MemberName;
+ protected byte[] Signature;
+
+ public MissingMemberException ()
+ : base (Locale.GetText ("A missing member exception has occurred."))
+ {
+ }
+
+ public MissingMemberException (string message)
+ : base (message)
+ {
+ }
+
+ public MissingMemberException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected MissingMemberException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ ClassName = info.GetString ("MMClassName");
+ MemberName = info.GetString ("MMMemberName");
+ Signature = (byte[]) info.GetValue ("MMSignature", Signature.GetType ());
+ }
+
+ public MissingMemberException (string className, string memberName)
+ {
+ ClassName = className;
+ MemberName = memberName;
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("MMClassName", ClassName);
+ info.AddValue ("MMMemberName", MemberName);
+ info.AddValue ("MMSignature", Signature);
+ }
+
+ public override string Message {
+ get {
+ if (ClassName == null)
+ return base.Message;
+ else
+ return "Member " + ClassName + "." + MemberName + " not found.";
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/MissingMethodException.cs b/mcs/class/corlib/System/MissingMethodException.cs
new file mode 100644
index 00000000000..54e267f42e9
--- /dev/null
+++ b/mcs/class/corlib/System/MissingMethodException.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Runtime.Serialization;
+using System.Globalization;
+
+
+namespace System
+{
+ [Serializable]
+ public class MissingMethodException : MissingMemberException
+ {
+
+ public MissingMethodException ()
+ : base (Locale.GetText ("A missing method exception has occurred."))
+ {
+ }
+
+ public MissingMethodException (string message)
+ : base (message)
+ {
+ }
+
+ protected MissingMethodException (SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public MissingMethodException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public MissingMethodException (string className, string methodName)
+ : base (className, methodName)
+ {
+ }
+
+ public override string Message {
+ get {
+ if (ClassName == null)
+ return base.Message;
+ else
+ return "Method " + ClassName + "." + MemberName + " not found.";
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System/MonoCustomAttrs.cs b/mcs/class/corlib/System/MonoCustomAttrs.cs
new file mode 100755
index 00000000000..784a8b24b37
--- /dev/null
+++ b/mcs/class/corlib/System/MonoCustomAttrs.cs
@@ -0,0 +1,84 @@
+// System.MonoCustomAttrs.cs
+// Hooks into the runtime to get custom attributes for reflection handles
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (c) 2002 Ximian, Inc.
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ internal class MonoCustomAttrs {
+
+ static Hashtable handle_to_attrs = new Hashtable ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern object[] GetCustomAttributes (ICustomAttributeProvider obj);
+
+ private static object[] from_cache (ICustomAttributeProvider obj) {
+ object[] res = (object[])handle_to_attrs [obj];
+ if (res != null)
+ return res;
+ res = GetCustomAttributes (obj);
+ handle_to_attrs.Add (obj, res);
+ return res;
+ }
+
+ internal static object[] GetCustomAttributes (ICustomAttributeProvider obj, Type attributeType, bool inherit) {
+ object[] r;
+ object[] res = from_cache (obj);
+ // shortcut
+ if (res.Length == 1 && (res[0].GetType () == attributeType || res[0].GetType().IsSubclassOf(attributeType))) {
+ r = (object[])Array.CreateInstance (attributeType, 1);
+ r [0] = res [0];
+ return r;
+ }
+ ArrayList a = new ArrayList ();
+ Type btype = obj as Type;
+ do {
+ foreach (object attr in res) {
+ if (attributeType.Equals (attr.GetType ()) || attr.GetType().IsSubclassOf(attributeType))
+ a.Add (attr);
+ }
+ if (btype != null && ((btype = btype.BaseType) != null)) {
+ res = from_cache (btype);
+ } else {
+ break;
+ }
+ } while (inherit && btype != null && ((btype = btype.BaseType) != null));
+ r = (object[])Array.CreateInstance (attributeType, a.Count);
+ a.CopyTo (r);
+ return r;
+ }
+
+ internal static object[] GetCustomAttributes (ICustomAttributeProvider obj, bool inherit) {
+ Type btype = obj as Type;
+ if (!inherit || btype == null) {
+ return (Object[])from_cache (obj).Clone ();
+ } else {
+ ArrayList a = new ArrayList ();
+ a.AddRange (from_cache (obj));
+ while ((btype = btype.BaseType) != null) {
+ a.AddRange (from_cache (btype));
+ }
+ Attribute[] r = new Attribute [a.Count];
+ a.CopyTo (r);
+ return (object[])r;
+ }
+ }
+ internal static bool IsDefined (ICustomAttributeProvider obj, Type attributeType, bool inherit) {
+ object[] res = from_cache (obj);
+ foreach (object attr in res) {
+ if (attributeType.Equals (attr.GetType ()))
+ return true;
+ }
+ Type btype = obj as Type;
+ if (inherit && (btype != null) && ((btype = btype.BaseType) != null))
+ return IsDefined (btype, attributeType, inherit);
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MonoDummy.cs b/mcs/class/corlib/System/MonoDummy.cs
new file mode 100644
index 00000000000..6d79023ee44
--- /dev/null
+++ b/mcs/class/corlib/System/MonoDummy.cs
@@ -0,0 +1,20 @@
+//
+// System.MonoDummy.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public class MonoDummy {
+
+ public MonoDummy ()
+ {
+ throw new ExecutionEngineException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs
new file mode 100644
index 00000000000..833ac2e18fa
--- /dev/null
+++ b/mcs/class/corlib/System/MonoType.cs
@@ -0,0 +1,549 @@
+//
+// System.MonoType
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ internal struct MonoTypeInfo {
+ public string name;
+ public string name_space;
+ public Type etype;
+ public Type nested_in;
+ public Assembly assembly;
+ public int rank;
+ public bool isprimitive;
+ }
+
+ [Serializable]
+ internal sealed class MonoType : Type, ISerializable
+ {
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void type_from_obj (MonoType type, Object obj);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void get_type_info (RuntimeTypeHandle type, out MonoTypeInfo info);
+
+ [MonoTODO]
+ internal MonoType (Object obj)
+ {
+ // this should not be used - lupus
+ type_from_obj (this, obj);
+
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern TypeAttributes get_attributes (Type type);
+
+ protected override TypeAttributes GetAttributeFlagsImpl ()
+ {
+ return get_attributes (this);
+ }
+
+ protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
+ Binder binder,
+ CallingConventions callConvention,
+ Type[] types,
+ ParameterModifier[] modifiers)
+ {
+ if (bindingAttr == BindingFlags.Default)
+ bindingAttr = BindingFlags.Public | BindingFlags.Instance;
+
+ ConstructorInfo[] methods = GetConstructors (bindingAttr);
+ ConstructorInfo found = null;
+ MethodBase[] match;
+ int count = 0;
+ foreach (ConstructorInfo m in methods) {
+ if (callConvention != CallingConventions.Any && m.CallingConvention != callConvention)
+ continue;
+ found = m;
+ count++;
+ }
+ if (count == 0)
+ return null;
+ if (types == null) {
+ if (count > 1)
+ throw new AmbiguousMatchException ();
+ return found;
+ }
+ match = new MethodBase [count];
+ if (count == 1)
+ match [0] = found;
+ else {
+ count = 0;
+ foreach (ConstructorInfo m in methods) {
+ if (callConvention != CallingConventions.Any && m.CallingConvention != callConvention)
+ continue;
+ match [count++] = m;
+ }
+ }
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ return (ConstructorInfo)binder.SelectMethod (bindingAttr, match, types, modifiers);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern EventInfo InternalGetEvent (string name, BindingFlags bindingAttr);
+
+ public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ return InternalGetEvent (name, bindingAttr);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override EventInfo[] GetEvents (BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override FieldInfo GetField (string name, BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override FieldInfo[] GetFields (BindingFlags bindingAttr);
+
+ public override Type GetInterface (string name, bool ignoreCase)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ Type[] interfaces = GetInterfaces();
+
+ foreach (Type type in interfaces) {
+ if (String.Compare (type.Name, name, ignoreCase) == 0)
+ return type;
+ if (String.Compare (type.FullName, name, ignoreCase) == 0)
+ return type;
+ }
+
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type[] GetInterfaces();
+
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr)
+ {
+ return FindMembers (MemberTypes.All, bindingAttr, null, null);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override MethodInfo[] GetMethods (BindingFlags bindingAttr);
+
+ protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr,
+ Binder binder,
+ CallingConventions callConvention,
+ Type[] types, ParameterModifier[] modifiers)
+ {
+ MethodInfo[] methods = GetMethods (bindingAttr);
+ MethodInfo found = null;
+ MethodBase[] match;
+ int count = 0;
+ foreach (MethodInfo m in methods) {
+ if (m.Name != name)
+ continue;
+ if (callConvention != CallingConventions.Any && m.CallingConvention != callConvention)
+ continue;
+ found = m;
+ count++;
+ }
+ if (count == 0)
+ return null;
+ if (types == null) {
+ if (count > 1)
+ throw new AmbiguousMatchException ();
+ return found;
+ }
+ match = new MethodBase [count];
+ if (count == 1)
+ match [0] = found;
+ else {
+ count = 0;
+ foreach (MethodInfo m in methods) {
+ if (m.Name != name)
+ continue;
+ if (callConvention != CallingConventions.Any && m.CallingConvention != callConvention)
+ continue;
+ match [count++] = m;
+ }
+ }
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ return (MethodInfo)binder.SelectMethod (bindingAttr, match, types, modifiers);
+ }
+
+ public override Type GetNestedType( string name, BindingFlags bindingAttr)
+ {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type[] GetNestedTypes (BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override PropertyInfo[] GetProperties( BindingFlags bindingAttr);
+
+ [MonoTODO]
+ protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr,
+ Binder binder, Type returnType,
+ Type[] types,
+ ParameterModifier[] modifiers)
+ {
+ // fixme: needs to use the binder, and send the modifiers to that binder
+ if (null == name || types == null)
+ throw new ArgumentNullException ();
+
+ PropertyInfo ret = null;
+ PropertyInfo [] props = GetProperties(bindingAttr);
+
+ foreach (PropertyInfo info in props) {
+ if (info.Name != name)
+ continue;
+
+ if (returnType != null)
+ if (info.GetGetMethod().ReturnType != returnType)
+ continue;
+
+ if (types.Length > 0) {
+ ParameterInfo[] parameterInfo = info.GetIndexParameters ();
+
+ if (parameterInfo.Length != types.Length)
+ continue;
+
+ int i;
+ bool match = true;
+
+ for (i = 0; i < types.Length; i ++)
+ if (parameterInfo [i].ParameterType != types [i]) {
+ match = false;
+ break;
+ }
+
+ if (!match)
+ continue;
+ }
+
+ if (null != ret)
+ throw new AmbiguousMatchException();
+
+ ret = info;
+ }
+
+ return ret;
+ }
+
+ protected override bool HasElementTypeImpl ()
+ {
+ return IsArrayImpl() || IsByRefImpl() || IsPointerImpl ();
+ }
+
+ protected override bool IsArrayImpl ()
+ {
+ return type_is_subtype_of (this, typeof (System.Array), false) && this != typeof (System.Array);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ protected extern override bool IsByRefImpl ();
+
+ protected override bool IsCOMObjectImpl ()
+ {
+ return false;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ protected extern override bool IsPointerImpl ();
+
+ protected override bool IsPrimitiveImpl ()
+ {
+ MonoTypeInfo info;
+
+ get_type_info (_impl, out info);
+ return info.isprimitive;
+ }
+
+ protected override bool IsValueTypeImpl ()
+ {
+ return type_is_subtype_of (this, typeof (System.ValueType), false) &&
+ this != typeof (System.ValueType) &&
+ this != typeof (System.Enum);
+ }
+
+ public override object InvokeMember (string name, BindingFlags invokeAttr,
+ Binder binder, object target, object[] args,
+ ParameterModifier[] modifiers,
+ CultureInfo culture, string[] namedParameters)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ if ((invokeAttr & BindingFlags.CreateInstance) != 0) {
+ if ((invokeAttr & (BindingFlags.GetField |
+ BindingFlags.GetField | BindingFlags.GetProperty |
+ BindingFlags.SetProperty)) != 0)
+ throw new ArgumentException ("invokeAttr");
+ }
+ if ((invokeAttr & BindingFlags.GetField) != 0 && (invokeAttr & BindingFlags.SetField) != 0)
+ throw new ArgumentException ("invokeAttr");
+ if ((invokeAttr & BindingFlags.GetProperty) != 0 && (invokeAttr & BindingFlags.SetProperty) != 0)
+ throw new ArgumentException ("invokeAttr");
+ if ((invokeAttr & BindingFlags.InvokeMethod) != 0 && (invokeAttr & (BindingFlags.SetProperty|BindingFlags.SetField)) != 0)
+ throw new ArgumentException ("invokeAttr");
+ if ((invokeAttr & BindingFlags.SetField) != 0 && ((args == null) || args.Length != 1))
+ throw new ArgumentException ("invokeAttr");
+ if ((namedParameters != null) && ((args == null) || args.Length < namedParameters.Length))
+ throw new ArgumentException ("namedParameters");
+
+ /* set some defaults if none are provided :-( */
+ if ((invokeAttr & (BindingFlags.Public|BindingFlags.NonPublic)) == 0)
+ invokeAttr |= BindingFlags.Public;
+ if ((invokeAttr & (BindingFlags.Static|BindingFlags.Instance)) == 0)
+ invokeAttr |= BindingFlags.Static|BindingFlags.Instance;
+
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ if ((invokeAttr & BindingFlags.CreateInstance) != 0) {
+ /* the name is ignored */
+ invokeAttr |= BindingFlags.DeclaredOnly;
+ ConstructorInfo[] ctors = GetConstructors (invokeAttr);
+ object state = null;
+ MethodBase ctor = binder.BindToMethod (invokeAttr, ctors, ref args, modifiers, culture, namedParameters, out state);
+ if (ctor == null)
+ throw new MissingMethodException ();
+ object result = ctor.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
+ }
+ if (name == String.Empty && Attribute.IsDefined (this, typeof (DefaultMemberAttribute))) {
+ DefaultMemberAttribute attr = (DefaultMemberAttribute) Attribute.GetCustomAttribute (this, typeof (DefaultMemberAttribute));
+ name = attr.MemberName;
+ }
+ bool ignoreCase = (invokeAttr & BindingFlags.IgnoreCase) != 0;
+ if ((invokeAttr & BindingFlags.InvokeMethod) != 0) {
+ MethodInfo[] methods = GetMethods (invokeAttr);
+ object state = null;
+ int i, count = 0;
+ for (i = 0; i < methods.Length; ++i) {
+ if (String.Compare (methods [i].Name, name, ignoreCase) == 0)
+ count++;
+ }
+ MethodBase[] smethods = new MethodBase [count];
+ count = 0;
+ for (i = 0; i < methods.Length; ++i) {
+ if (String.Compare (methods [i].Name, name, ignoreCase) == 0)
+ smethods [count++] = methods [i];
+ }
+ MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
+ if (m == null)
+ throw new MissingMethodException ();
+ object result = m.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
+ }
+ if ((invokeAttr & BindingFlags.GetField) != 0) {
+ FieldInfo f = GetField (name, invokeAttr);
+ if (f != null) {
+ return f.GetValue (target);
+ } else if ((invokeAttr & BindingFlags.GetProperty) == 0) {
+ throw new MissingFieldException ();
+ }
+ /* try GetProperty */
+ } else if ((invokeAttr & BindingFlags.SetField) != 0) {
+ FieldInfo f = GetField (name, invokeAttr);
+ if (f != null) {
+ f.SetValue (target, args [0]);
+ return null;
+ } else if ((invokeAttr & BindingFlags.SetProperty) == 0) {
+ throw new MissingFieldException ();
+ }
+ /* try SetProperty */
+ }
+ if ((invokeAttr & BindingFlags.GetProperty) != 0) {
+ PropertyInfo[] properties = GetProperties (invokeAttr);
+ object state = null;
+ int i, count = 0;
+ for (i = 0; i < properties.Length; ++i) {
+ if (String.Compare (properties [i].Name, name, ignoreCase) == 0 && (properties [i].GetGetMethod () != null))
+ count++;
+ }
+ MethodBase[] smethods = new MethodBase [count];
+ count = 0;
+ for (i = 0; i < properties.Length; ++i) {
+ MethodBase mb = properties [i].GetGetMethod ();
+ if (String.Compare (properties [i].Name, name, ignoreCase) == 0 && (mb != null))
+ smethods [count++] = mb;
+ }
+ MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
+ if (m == null)
+ throw new MissingFieldException ();
+ object result = m.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
+ } else if ((invokeAttr & BindingFlags.SetProperty) != 0) {
+ PropertyInfo[] properties = GetProperties (invokeAttr);
+ object state = null;
+ int i, count = 0;
+ for (i = 0; i < properties.Length; ++i) {
+ if (String.Compare (properties [i].Name, name, ignoreCase) == 0 && (properties [i].GetSetMethod () != null))
+ count++;
+ }
+ MethodBase[] smethods = new MethodBase [count];
+ count = 0;
+ for (i = 0; i < properties.Length; ++i) {
+ MethodBase mb = properties [i].GetSetMethod ();
+ if (String.Compare (properties [i].Name, name, ignoreCase) == 0 && (mb != null))
+ smethods [count++] = mb;
+ }
+ MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
+ if (m == null)
+ throw new MissingFieldException ();
+ object result = m.Invoke (target, invokeAttr, binder, args, culture);
+ binder.ReorderArgumentArray (ref args, state);
+ return result;
+ }
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type GetElementType ();
+
+ public override Type UnderlyingSystemType {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.etype;
+ }
+ }
+
+ public override Assembly Assembly {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.assembly;
+ }
+ }
+
+ public override string AssemblyQualifiedName {
+ get {
+ return getFullName () + ", " + Assembly.ToString ();
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern string getFullName();
+
+ public extern override Type BaseType {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public override string FullName {
+ get {
+ return getFullName ();
+ }
+ }
+
+ public override Guid GUID {
+ get {
+ return Guid.Empty;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public override object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override MemberTypes MemberType {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.nested_in == null? MemberTypes.TypeInfo: MemberTypes.NestedType;
+ }
+ }
+
+ public override string Name {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.name;
+ }
+ }
+
+ public override string Namespace {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ if (info.nested_in == null)
+ return info.name_space;
+ else
+ return info.nested_in.Namespace;
+ }
+ }
+
+ public extern override Module Module {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public override Type DeclaringType {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.nested_in;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.nested_in;
+ }
+ }
+
+ public override RuntimeTypeHandle TypeHandle {
+ get {
+ return _impl;
+ }
+ }
+
+ public override int GetArrayRank ()
+ {
+ MonoTypeInfo info;
+
+ get_type_info (_impl, out info);
+ return info.rank;
+ }
+
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ UnitySerializationHolder.GetTypeData (this, info, context);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MulticastDelegate.cs b/mcs/class/corlib/System/MulticastDelegate.cs
new file mode 100644
index 00000000000..0eafad135fd
--- /dev/null
+++ b/mcs/class/corlib/System/MulticastDelegate.cs
@@ -0,0 +1,255 @@
+//
+// System.MultiCastDelegate.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Remove Missing
+//
+
+using System.Collections;
+using System.Globalization;
+
+namespace System {
+
+ public abstract class MulticastDelegate : Delegate
+ {
+ private MulticastDelegate prev;
+ private MulticastDelegate kpm_next;
+
+ protected MulticastDelegate (object target, string method)
+ : base (target, method)
+ {
+ prev = null;
+ }
+
+ protected MulticastDelegate (Type target_type, string method)
+ : base (target_type, method)
+ {
+ prev = null;
+ }
+
+#if NOTYET
+ private MulticastDelegate (Type target_type, string method, Delegate [] list)
+ : base (target_type, method)
+ {
+ invocation_list = (Delegate[])list.Clone ();
+ }
+#endif
+
+#if NOTYET
+ public MethodInfo Method {
+ get {
+ return null;
+ }
+ }
+#endif
+
+ public override object DynamicInvokeImpl( object[] args )
+ {
+ if ( prev != null )
+ prev.DynamicInvokeImpl( args );
+
+ return base.DynamicInvokeImpl( args );
+ }
+
+ // <remarks>
+ // Equals: two multicast delegates are equal if their base is equal
+ // and their invocations list is equal.
+ // </remarks>
+ public override bool Equals (object o)
+ {
+ if ( ! base.Equals( o ) )
+ return false;
+
+ MulticastDelegate d = (MulticastDelegate) o;
+
+ if ( this.prev == null ) {
+ if ( d.prev == null )
+ return true;
+ else
+ return false;
+ }
+
+ return this.prev.Equals( d.prev );
+ }
+
+ //
+ // FIXME: This could use some improvements.
+ //
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ // <summary>
+ // Return, in order of invocation, the invocation list
+ // of a MulticastDelegate
+ // </summary>
+ public override Delegate[] GetInvocationList()
+ {
+ ArrayList list = new ArrayList ();
+ MulticastDelegate d;
+ for (d = (MulticastDelegate) this.Clone (); d.prev != null; d = d.prev)
+ d.prev.kpm_next = d;
+
+ for (; d != null; d = d.kpm_next) {
+ MulticastDelegate other = (MulticastDelegate) d.Clone ();
+ other.prev = null;
+ other.kpm_next = null;
+ list.Add (other);
+ }
+
+ return (Delegate []) list.ToArray (typeof (Delegate));
+ }
+
+ // <summary>
+ // Combines this MulticastDelegate with the (Multicast)Delegate `follow'.
+ // This does _not_ combine with Delegates. ECMA states the whole delegate
+ // thing should have better been a simple System.Delegate class.
+ // Compiler generated delegates are always MulticastDelegates.
+ // </summary>
+ protected override Delegate CombineImpl( Delegate follow )
+ {
+ MulticastDelegate combined, orig, clone;
+
+ if ( this.GetType() != follow.GetType() )
+ throw new ArgumentException( Locale.GetText("Incompatible Delegate Types") );
+
+ combined = (MulticastDelegate)follow.Clone();
+
+ for ( clone = combined, orig = ((MulticastDelegate)follow).prev;
+ orig != null; orig = orig.prev ) {
+
+ clone.prev = (MulticastDelegate)orig.Clone();
+ clone = clone.prev;
+ }
+
+ clone.prev = (MulticastDelegate)this.Clone();
+
+ for ( clone = clone.prev, orig = this.prev;
+ orig != null; orig = orig.prev ) {
+
+ clone.prev = (MulticastDelegate)orig.Clone();
+ clone = clone.prev;
+ }
+
+ return combined;
+ }
+
+ private bool BaseEquals( MulticastDelegate value )
+ {
+ return base.Equals( value );
+ }
+
+ /*
+ * Perform a slightly crippled version of
+ * Knuth-Pratt-Morris over MulticastDelegate chains.
+ * Border values are set as pointers in kpm_next;
+ * Generally, KPM border arrays are length n+1 for
+ * strings of n. This one works with length n at the
+ * expense of a few additional comparisions.
+ */
+ private static MulticastDelegate KPM( MulticastDelegate needle,
+ MulticastDelegate haystack,
+ out MulticastDelegate tail )
+ {
+ MulticastDelegate nx, hx;
+
+ // preprocess
+ hx = needle;
+ nx = needle.kpm_next = null;
+ do {
+ while ( nx != null && !nx.BaseEquals(hx) )
+ nx = nx.kpm_next;
+
+ hx = hx.prev;
+ if (hx == null)
+ break;
+
+ nx = nx == null ? needle : nx.prev;
+ if ( hx.BaseEquals(nx) )
+ hx.kpm_next = nx.kpm_next;
+ else
+ hx.kpm_next = nx;
+
+ } while (true);
+
+ // match
+ MulticastDelegate match = haystack;
+ nx = needle;
+ hx = haystack;
+ do {
+ while ( nx != null && !nx.BaseEquals(hx) ) {
+ nx = nx.kpm_next;
+ match = match.prev;
+ }
+
+ nx = nx == null ? needle : nx.prev;
+ if ( nx == null ) {
+ // bingo
+ tail = hx.prev;
+ return match;
+ }
+
+ hx = hx.prev;
+ } while ( hx != null );
+
+ tail = null;
+ return null;
+ }
+
+ protected override Delegate RemoveImpl( Delegate value )
+ {
+ if ( value == null )
+ return this;
+
+ // match this with value
+ MulticastDelegate head, tail;
+ head = KPM((MulticastDelegate)value, this, out tail);
+ if ( head == null )
+ return this;
+
+ // duplicate chain without head..tail
+ MulticastDelegate prev = null, retval = null, orig;
+ for ( orig = this; (object)orig != (object)head; orig = orig.prev ) {
+ MulticastDelegate clone = (MulticastDelegate)orig.Clone();
+ if ( prev != null )
+ prev.prev = clone;
+ else
+ retval = clone;
+ prev = clone;
+ }
+ for ( orig = tail; (object)orig != null; orig = orig.prev ) {
+ MulticastDelegate clone = (MulticastDelegate)orig.Clone();
+ if ( prev != null )
+ prev.prev = clone;
+ else
+ retval = clone;
+ prev = clone;
+ }
+ if ( prev != null )
+ prev.prev = null;
+
+ return retval;
+ }
+
+ public static bool operator == (MulticastDelegate a, MulticastDelegate b)
+ {
+ if ((object)a == null) {
+ if ((object)b == null)
+ return true;
+ return false;
+ }
+ return a.Equals (b);
+ }
+
+ public static bool operator != (MulticastDelegate a, MulticastDelegate b)
+ {
+ return !(a == b);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MulticastNotSupportedException.cs b/mcs/class/corlib/System/MulticastNotSupportedException.cs
new file mode 100644
index 00000000000..6417207fa72
--- /dev/null
+++ b/mcs/class/corlib/System/MulticastNotSupportedException.cs
@@ -0,0 +1,31 @@
+//
+// System.MulticastNotSupportedException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class MulticastNotSupportedException : SystemException {
+ // Constructors
+ public MulticastNotSupportedException ()
+ : base (Locale.GetText ("This operation cannot be performed with the specified delagates"))
+ {
+ }
+
+ public MulticastNotSupportedException (string message)
+ : base (message)
+ {
+ }
+
+ public MulticastNotSupportedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NonSerializedAttribute.cs b/mcs/class/corlib/System/NonSerializedAttribute.cs
new file mode 100755
index 00000000000..7ac82dfe67a
--- /dev/null
+++ b/mcs/class/corlib/System/NonSerializedAttribute.cs
@@ -0,0 +1,18 @@
+
+//
+// System/NonSerializedAttribute.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
+ public sealed class NonSerializedAttribute : Attribute {
+ public NonSerializedAttribute() {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NotFiniteNumberException.cs b/mcs/class/corlib/System/NotFiniteNumberException.cs
new file mode 100644
index 00000000000..dd3cc054b48
--- /dev/null
+++ b/mcs/class/corlib/System/NotFiniteNumberException.cs
@@ -0,0 +1,67 @@
+//
+// System.NotFiniteNumberException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NotFiniteNumberException : ArithmeticException {
+ double offending_number;
+
+ // Constructors
+ public NotFiniteNumberException ()
+ : base (Locale.GetText ("The number encountered was not a finite quantity"))
+ {
+ }
+
+ public NotFiniteNumberException (double offending_number)
+ {
+ this.offending_number = offending_number;
+ }
+
+ public NotFiniteNumberException (string message)
+ : base (message)
+ {
+ }
+
+ public NotFiniteNumberException (string message, double offending_number)
+ {
+ this.offending_number = offending_number;
+ }
+
+ public NotFiniteNumberException (string message, double offending_number, Exception inner)
+ : base (message, inner)
+ {
+ this.offending_number = offending_number;
+ }
+
+ protected NotFiniteNumberException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ offending_number = info.GetDouble ("OffendingNumber");
+ }
+
+ // Properties
+ public double OffendingNumber {
+ get {
+ return offending_number;
+ }
+ }
+
+ // Method
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("OffendingNumber", offending_number);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NotImplementedException.cs b/mcs/class/corlib/System/NotImplementedException.cs
new file mode 100755
index 00000000000..5a7f80b3338
--- /dev/null
+++ b/mcs/class/corlib/System/NotImplementedException.cs
@@ -0,0 +1,39 @@
+//
+// System.NotImplementedException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NotImplementedException : SystemException {
+ // Constructors
+ public NotImplementedException ()
+ : base (Locale.GetText ("The requested feature is not yet implemented"))
+ {
+ }
+
+ public NotImplementedException (string message)
+ : base (message)
+ {
+ }
+
+ public NotImplementedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected NotImplementedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NotSupportedException.cs b/mcs/class/corlib/System/NotSupportedException.cs
new file mode 100644
index 00000000000..de3fb785b5b
--- /dev/null
+++ b/mcs/class/corlib/System/NotSupportedException.cs
@@ -0,0 +1,39 @@
+//
+// System.NotSupportedException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NotSupportedException : SystemException {
+ // Constructors
+ public NotSupportedException ()
+ : base (Locale.GetText ("Operation is not supported"))
+ {
+ }
+
+ public NotSupportedException (string message)
+ : base (message)
+ {
+ }
+
+ public NotSupportedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected NotSupportedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NullReferenceException.cs b/mcs/class/corlib/System/NullReferenceException.cs
new file mode 100644
index 00000000000..009732ce07b
--- /dev/null
+++ b/mcs/class/corlib/System/NullReferenceException.cs
@@ -0,0 +1,39 @@
+//
+// System.NullReferenceException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NullReferenceException : SystemException {
+ // Constructors
+ public NullReferenceException ()
+ : base (Locale.GetText ("A null value was found where an object instance was required"))
+ {
+ }
+
+ public NullReferenceException (string message)
+ : base (message)
+ {
+ }
+
+ public NullReferenceException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected NullReferenceException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Object.cs b/mcs/class/corlib/System/Object.cs
new file mode 100644
index 00000000000..54850461227
--- /dev/null
+++ b/mcs/class/corlib/System/Object.cs
@@ -0,0 +1,108 @@
+//
+// System.Object.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ public class Object {
+
+ // <summary>
+ // Compares this object to the specified object.
+ // Returns true if they are equal, false otherwise.
+ // </summary>
+ public virtual bool Equals (object o)
+ {
+ return this == o;
+ }
+
+ // <summary>
+ // Compares two objects for equality
+ // </summary>
+ public static bool Equals (object a, object b)
+ {
+ if (a == b)
+ return true;
+
+ if (a == null || b == null)
+ return false;
+
+ return a.Equals (b);
+ }
+
+ // <summary>
+ // Initializes a new instance of the object class.
+ // </summary>
+ public Object ()
+ {
+ }
+
+ // <summary>
+ // Object destructor.
+ // </summary>
+ ~Object ()
+ {
+ }
+
+ // <summary>
+ // Returns a hashcode for this object. Each derived
+ // class should return a hash code that makes sense
+ // for that particular implementation of the object.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern virtual int GetHashCode ();
+
+ // <summary>
+ // Returns the Type associated with the object.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern Type GetType ();
+
+ // <summary>
+ // Shallow copy of the object.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ protected extern object MemberwiseClone ();
+
+ // <summary>
+ // Returns a stringified representation of the object.
+ // This is not supposed to be used for user presentation,
+ // use Format() for that and IFormattable.
+ //
+ // ToString is mostly used for debugging purposes.
+ // </summary>
+ public virtual string ToString ()
+ {
+ return GetType().FullName;
+ }
+
+ // <summary>
+ // Tests whether a is equal to b.
+ // Can not figure out why this even exists
+ // </summary>
+ public static bool ReferenceEquals (object a, object b)
+ {
+ return (a == b);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern IntPtr obj_address ();
+
+ void FieldGetter (string typeName, string fieldName, ref object val)
+ {
+ /* never called */
+ }
+
+ void FieldSetter (string typeName, string fieldName, object val)
+ {
+ /* never called */
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ObjectDisposedException.cs b/mcs/class/corlib/System/ObjectDisposedException.cs
new file mode 100755
index 00000000000..b1e390aa5be
--- /dev/null
+++ b/mcs/class/corlib/System/ObjectDisposedException.cs
@@ -0,0 +1,60 @@
+//
+// System.ObjectDisposedException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class ObjectDisposedException : InvalidOperationException {
+ private string obj_name;
+ private string msg;
+
+ // Constructors
+ public ObjectDisposedException (string objectName)
+ : base (Locale.GetText ("The object was used after being disposed"))
+ {
+ obj_name = objectName;
+ msg = Locale.GetText ("The object was used after being disposed");
+ }
+
+ public ObjectDisposedException (string objectName, string message)
+ : base (message)
+ {
+ obj_name = objectName;
+ msg = message;
+ }
+
+ protected ObjectDisposedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ obj_name = info.GetString ("ObjectName");
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return msg; }
+ }
+
+ public string ObjectName
+ {
+ get { return obj_name; }
+ }
+
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("ObjectName", obj_name);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ObsoleteAttribute.cs b/mcs/class/corlib/System/ObsoleteAttribute.cs
new file mode 100644
index 00000000000..6215c9379fd
--- /dev/null
+++ b/mcs/class/corlib/System/ObsoleteAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.ObsoleteAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Event |
+ AttributeTargets.Interface | AttributeTargets.Delegate)]
+ [Serializable]
+ public sealed class ObsoleteAttribute : Attribute
+ {
+ private string message;
+ private bool isError = false;
+
+ // Constructors
+ public ObsoleteAttribute ()
+ : base ()
+ {
+ }
+
+ public ObsoleteAttribute (string message)
+ {
+ this.message = message;
+ }
+
+ public ObsoleteAttribute (string message, bool error)
+ {
+ this.message = message;
+ this.isError = error;
+ }
+
+ // Properties
+ public string Message {
+ get { return message; }
+ }
+
+ public bool IsError {
+ get { return isError; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/OperatingSystem.cs b/mcs/class/corlib/System/OperatingSystem.cs
new file mode 100644
index 00000000000..93729bb4a45
--- /dev/null
+++ b/mcs/class/corlib/System/OperatingSystem.cs
@@ -0,0 +1,106 @@
+//------------------------------------------------------------------------------
+//
+// System.OperatingSystem.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Globalization;
+
+namespace System
+{
+ /// <summary>
+ /// Class representing a specific operating system version for a specific platform
+ /// </summary>
+ [Serializable]
+ public sealed class OperatingSystem : ICloneable
+ {
+ private System.PlatformID itsPlatform;
+ private Version itsVersion;
+
+ public OperatingSystem(PlatformID platform, Version version)
+ {
+ if(version == null)
+ {
+ throw new ArgumentNullException();
+ }
+
+ itsPlatform = platform;
+ itsVersion = version;
+ }
+
+ /// <summary>
+ /// Get the PlatformID
+ /// </summary>
+ public PlatformID Platform
+ {
+ get
+ {
+ return itsPlatform;
+ }
+ }
+
+ /// <summary>
+ /// Gets the version object
+ /// </summary>
+ public Version Version
+ {
+ get
+ {
+ return itsVersion;
+ }
+ }
+
+ /// <summary>
+ /// Return a clone of this object
+ /// </summary>
+ public object Clone()
+ {
+ return new OperatingSystem(itsPlatform, itsVersion);
+ }
+
+ /// <summary>
+ /// Return true if obj equals this object
+ /// </summary>
+ public override bool Equals(object obj)
+ {
+ //Check for null and compare run-time types.
+ if (obj == null || GetType() != obj.GetType()) return false;
+ OperatingSystem os = (OperatingSystem)obj;
+ return (itsPlatform == os.itsPlatform) &&
+ (os.itsVersion.Equals(itsVersion));
+ }
+
+ /// <summary>
+ /// Return hash code
+ /// </summary>
+ public override int GetHashCode()
+ { // this leave us enuf for 256 unique platforms which should suffice for a good while
+ return ((int)itsPlatform << 24) | itsVersion.GetHashCode() >> 8;
+ }
+
+ /// <summary>
+ /// Return a string reprentation of this instance
+ /// </summary>
+ public override string ToString()
+ {
+ string str;
+
+ switch(itsPlatform)
+ {
+ case System.PlatformID.Win32NT: str = "Microsoft Windows NT"; break;
+ case System.PlatformID.Win32S: str = "Microsoft Win32S"; break;
+ case System.PlatformID.Win32Windows: str = "Microsoft Windows 98"; break;
+ case System.PlatformID.Unix: str = "Unix"; break;
+ default: str = Locale.GetText ("<unknown>"); break;
+ }
+
+ return str + " " + itsVersion.ToString();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/OutOfMemoryException.cs b/mcs/class/corlib/System/OutOfMemoryException.cs
new file mode 100644
index 00000000000..a4f2388390d
--- /dev/null
+++ b/mcs/class/corlib/System/OutOfMemoryException.cs
@@ -0,0 +1,39 @@
+//
+// System.OutOfMemoryException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class OutOfMemoryException : SystemException {
+ // Constructors
+ public OutOfMemoryException ()
+ : base (Locale.GetText ("There is insufficient memory to continue execution"))
+ {
+ }
+
+ public OutOfMemoryException (string message)
+ : base (message)
+ {
+ }
+
+ public OutOfMemoryException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected OutOfMemoryException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/OverflowException.cs b/mcs/class/corlib/System/OverflowException.cs
new file mode 100644
index 00000000000..61e63e1e3a1
--- /dev/null
+++ b/mcs/class/corlib/System/OverflowException.cs
@@ -0,0 +1,39 @@
+//
+// System.OverflowExceptionException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class OverflowException : ArithmeticException {
+ // Constructors
+ public OverflowException ()
+ : base (Locale.GetText ("Number overflow"))
+ {
+ }
+
+ public OverflowException (string message)
+ : base (message)
+ {
+ }
+
+ public OverflowException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected OverflowException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ParamArrayAttribute.cs b/mcs/class/corlib/System/ParamArrayAttribute.cs
new file mode 100644
index 00000000000..322def26b8b
--- /dev/null
+++ b/mcs/class/corlib/System/ParamArrayAttribute.cs
@@ -0,0 +1,23 @@
+//
+// System.ParamArrayAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// Used to flag that the method will take a variable number
+ /// of arguments
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Parameter)]
+ public sealed class ParamArrayAttribute : Attribute {
+
+ public ParamArrayAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/PlatformID.cs b/mcs/class/corlib/System/PlatformID.cs
new file mode 100644
index 00000000000..56d2299e9fb
--- /dev/null
+++ b/mcs/class/corlib/System/PlatformID.cs
@@ -0,0 +1,37 @@
+// PlatformID.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:29 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum PlatformID {
+
+ /// <summary>
+ /// </summary>
+ Win32S = 0,
+
+ /// <summary>
+ /// </summary>
+ Win32Windows = 1,
+
+ /// <summary>
+ /// </summary>
+ Win32NT = 2,
+
+ /// <summary>
+ /// </summary>
+ Unix = 128
+ } // PlatformID
+
+} // System
diff --git a/mcs/class/corlib/System/PlatformNotSupportedException.cs b/mcs/class/corlib/System/PlatformNotSupportedException.cs
new file mode 100644
index 00000000000..18960191d0a
--- /dev/null
+++ b/mcs/class/corlib/System/PlatformNotSupportedException.cs
@@ -0,0 +1,41 @@
+//
+// System.PlatformNotSupportedException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class PlatformNotSupportedException : NotSupportedException
+ {
+ // Constructors
+ public PlatformNotSupportedException ()
+ : base (Locale.GetText ("This platform is not supported."))
+ {
+ }
+
+ public PlatformNotSupportedException (string message)
+ : base (message)
+ {
+ }
+
+ protected PlatformNotSupportedException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PlatformNotSupportedException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Random.cs b/mcs/class/corlib/System/Random.cs
new file mode 100644
index 00000000000..03f8c5edcca
--- /dev/null
+++ b/mcs/class/corlib/System/Random.cs
@@ -0,0 +1,83 @@
+//
+// System.Random.cs
+//
+// Author:
+// Bob Smith (bob@thestuff.net)
+//
+// (C) 2001 Bob Smith. http://www.thestuff.net
+//
+
+using System;
+using System.Globalization;
+
+namespace System
+{
+ [Serializable]
+ public class Random
+ {
+ private int S = 1;
+ private const int A = 16807;
+ private const int M = 2147483647;
+ private const int Q = 127773;
+ private const int R = 2836;
+
+ public Random()
+ {
+ S = (int)(DateTime.Now.Ticks);
+ }
+
+ public Random(int Seed)
+ {
+ S = Seed;
+ }
+
+ public virtual int Next()
+ {
+ return (int)(this.Sample()*Int32.MaxValue);
+ }
+
+ public virtual int Next(int maxValue)
+ {
+ if (maxValue < 0)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Max value is less then min value."));
+ else if (maxValue == 0)
+ return 0;
+ return (int)(this.Sample()*maxValue);
+ }
+
+ public virtual int Next(int minValue, int maxValue)
+ {
+ if (minValue > maxValue)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Min value is greater then max value."));
+ else if (minValue == maxValue)
+ return minValue;
+ return (int)(this.Sample()*(maxValue - minValue))+minValue;
+ }
+ public virtual void NextBytes(byte[] buffer)
+ {
+ int i, l;
+ if (buffer == null)
+ throw new ArgumentNullException();
+ l = buffer.GetUpperBound(0);
+ for (i = buffer.GetLowerBound(0); i < l; i++)
+ {
+ buffer[i] = (byte)(this.Sample()*Byte.MaxValue);
+ }
+ }
+
+ public virtual double NextDouble ()
+ {
+ return this.Sample();
+ }
+
+ protected virtual double Sample ()
+ {
+ S = A*(S%Q)-R*(S/Q);
+ if (S < 0)
+ S+=M;
+ return S/(double)Int32.MaxValue;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/RankException.cs b/mcs/class/corlib/System/RankException.cs
new file mode 100644
index 00000000000..89813a4a123
--- /dev/null
+++ b/mcs/class/corlib/System/RankException.cs
@@ -0,0 +1,40 @@
+//
+// System.RankException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class RankException : SystemException {
+ // Constructors
+ public RankException ()
+ : base (Locale.GetText ("Two arrays must have the same number of dimensions"))
+ {
+ }
+
+ public RankException (string message)
+ : base (message)
+ {
+ }
+
+ public RankException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected RankException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ResolveEventArgs.cs b/mcs/class/corlib/System/ResolveEventArgs.cs
new file mode 100644
index 00000000000..e0c10a65950
--- /dev/null
+++ b/mcs/class/corlib/System/ResolveEventArgs.cs
@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+//
+// System.ResolveEventArgs.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System {
+
+ public class ResolveEventArgs : EventArgs
+ {
+ private string m_Name;
+ public string Name {get{return m_Name;}}
+
+ public ResolveEventArgs(string name){
+ m_Name = name;
+ }
+
+ } // ResolveEventArgs
+
+} // System
+
+
diff --git a/mcs/class/corlib/System/ResolveEventHandler.cs b/mcs/class/corlib/System/ResolveEventHandler.cs
new file mode 100644
index 00000000000..36471295a85
--- /dev/null
+++ b/mcs/class/corlib/System/ResolveEventHandler.cs
@@ -0,0 +1,10 @@
+// System.ResolveEventHandler
+//
+// Sean MacIsaac
+//
+// (C) 2001 Ximian, Inc.
+
+namespace System
+{
+ public delegate Reflection.Assembly ResolveEventHandler (object sender, ResolveEventArgs args);
+}
diff --git a/mcs/class/corlib/System/RuntimeArgumentHandle.cs b/mcs/class/corlib/System/RuntimeArgumentHandle.cs
new file mode 100644
index 00000000000..790f3c1a24d
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeArgumentHandle.cs
@@ -0,0 +1,16 @@
+//
+// System.RuntimeArgumentHandle.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ public struct RuntimeArgumentHandle
+ {
+ // This class has no members, its only use is for supporting
+ // va_args from C and C++.
+ }
+}
diff --git a/mcs/class/corlib/System/RuntimeFieldHandle.cs b/mcs/class/corlib/System/RuntimeFieldHandle.cs
new file mode 100755
index 00000000000..f4536856af9
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeFieldHandle.cs
@@ -0,0 +1,45 @@
+//
+// System.RuntimeFieldHandle.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [MonoTODO]
+ [Serializable]
+ public struct RuntimeFieldHandle : ISerializable {
+ IntPtr value;
+
+ public IntPtr Value {
+ get {
+ return (IntPtr) value;
+ }
+ }
+
+ RuntimeFieldHandle (SerializationInfo info, StreamingContext context)
+ {
+ Type t;
+
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ t = (Type) info.GetValue ("TypeObj", typeof (Type));
+
+ value = t.TypeHandle.Value;
+ if (value == (IntPtr) 0)
+ throw new SerializationException (Locale.GetText ("Insufficient state"));
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("TypeObj", value, value.GetType ());
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/RuntimeMethodHandle.cs b/mcs/class/corlib/System/RuntimeMethodHandle.cs
new file mode 100755
index 00000000000..f03c2378746
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeMethodHandle.cs
@@ -0,0 +1,46 @@
+//
+// System.RuntimeMethodHandle.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ //[MonoTODO]
+ [Serializable]
+ public struct RuntimeMethodHandle : ISerializable {
+ IntPtr value;
+
+ internal RuntimeMethodHandle (IntPtr v) {
+ value = v;
+ }
+
+ public IntPtr Value {
+ get {
+ return (IntPtr) value;
+ }
+ }
+
+ // This is from ISerializable
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ public static extern IntPtr GetFunctionPointer (IntPtr m);
+
+ public IntPtr GetFunctionPointer ()
+ {
+ return GetFunctionPointer (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/RuntimeTypeHandle.cs b/mcs/class/corlib/System/RuntimeTypeHandle.cs
new file mode 100644
index 00000000000..f81d5a3730d
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeTypeHandle.cs
@@ -0,0 +1,31 @@
+//
+// System.RuntimeTypeHandle.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct RuntimeTypeHandle : ISerializable {
+ IntPtr value;
+
+ public IntPtr Value {
+ get {
+ return (IntPtr) value;
+ }
+ }
+
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/SByte.cs b/mcs/class/corlib/System/SByte.cs
new file mode 100644
index 00000000000..98a8e7e32fd
--- /dev/null
+++ b/mcs/class/corlib/System/SByte.cs
@@ -0,0 +1,230 @@
+//
+// System.SByte.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct SByte : IComparable, IFormattable, IConvertible {
+
+ public const sbyte MinValue = -128;
+ public const sbyte MaxValue = 127;
+
+ internal sbyte value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.SByte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.SByte"));
+
+ sbyte xv = (sbyte) v;
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.SByte))
+ return false;
+
+ return ((sbyte) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ [CLSCompliant(false)]
+ public static sbyte Parse (string s)
+ {
+ int ival = 0;
+ int len;
+ int i;
+ bool neg = false;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ neg = true;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ ival = checked (ival * 10 - (int) (c - '0'));
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ ival = neg ? ival : -ival;
+ if (ival < SByte.MinValue || ival > SByte.MaxValue)
+ throw new OverflowException ();
+
+ return (sbyte) ival;
+ }
+
+ [CLSCompliant(false)]
+ public static sbyte Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static sbyte Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [CLSCompliant(false)]
+ public static sbyte Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ int tmpResult = Int32.Parse (s, style, fp);
+ if (tmpResult > SByte.MaxValue || tmpResult < SByte.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (sbyte) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== ICovnertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.SByte;
+ }
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return value;
+ }
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/STAThreadAttribute.cs b/mcs/class/corlib/System/STAThreadAttribute.cs
new file mode 100644
index 00000000000..da8e92cd0df
--- /dev/null
+++ b/mcs/class/corlib/System/STAThreadAttribute.cs
@@ -0,0 +1,19 @@
+//
+// System.STAThreadAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class STAThreadAttribute : Attribute
+ {
+ // Constructors
+ public STAThreadAttribute () : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/SerializableAttribute.cs b/mcs/class/corlib/System/SerializableAttribute.cs
new file mode 100755
index 00000000000..e283d4afc39
--- /dev/null
+++ b/mcs/class/corlib/System/SerializableAttribute.cs
@@ -0,0 +1,38 @@
+//
+// System.SerializableAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// Serialization Attribute for classes.
+ /// </summary>
+
+ /// <remarks>
+ /// Use SerializableAttribute to mark classes that do not implement
+ /// the ISerializable interface but that want to be serialized.
+ ///
+ /// Failing to do so will cause the system to throw an exception.
+ ///
+ /// When a class is market with the SerializableAttribute, all the
+ /// fields are automatically serialized with the exception of those
+ /// that are tagged with the NonSerializedAttribute.
+ ///
+ /// SerializableAttribute should only be used for classes that contain
+ /// simple data types that can be serialized and deserialized by the
+ /// runtime (typically you would use NonSerializedAttribute on data
+ /// that can be reconstructed at any point: like caches or precomputed
+ /// tables).
+ /// </remarks>
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct
+ | AttributeTargets.Enum | AttributeTargets.Delegate,
+ Inherited=false, AllowMultiple=false)]
+ public sealed class SerializableAttribute : Attribute {
+ }
+}
diff --git a/mcs/class/corlib/System/Single.cs b/mcs/class/corlib/System/Single.cs
new file mode 100644
index 00000000000..672f5999cb8
--- /dev/null
+++ b/mcs/class/corlib/System/Single.cs
@@ -0,0 +1,223 @@
+//
+// System.Single.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public struct Single : IComparable, IFormattable, IConvertible {
+ public const float Epsilon = 1.4e-45f;
+ public const float MaxValue = 3.40282346638528859e38f;
+ public const float MinValue = -3.40282346638528859e38f;
+ public const float NaN = 0.0f / 0.0f;
+ public const float PositiveInfinity = 1.0f / 0.0f;
+ public const float NegativeInfinity = -1.0f / 0.0f;
+
+ internal float value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Single))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Single"));
+
+ float fv = (float)v;
+
+ if (this.value == fv) return 0;
+ else if (this.value > fv) return 1;
+ else return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Single))
+ return false;
+
+ return ((float) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ public static bool IsInfinity (float f)
+ {
+ return (f == PositiveInfinity || f == NegativeInfinity);
+ }
+
+ public static bool IsNaN (float f)
+ {
+ return (f != f);
+ }
+
+ public static bool IsNegativeInfinity (float f)
+ {
+ return (f < 0.0f && (f == NegativeInfinity || f == PositiveInfinity));
+ }
+
+ public static bool IsPositiveInfinity (float f)
+ {
+ return (f > 0.0f && (f == NegativeInfinity || f == PositiveInfinity));
+ }
+
+ public static float Parse (string s)
+ {
+ double parsed_value = Double.Parse (
+ s, (NumberStyles.Float | NumberStyles.AllowThousands), null);
+ if (parsed_value > (double) float.MaxValue)
+ throw new OverflowException();
+
+ return (float) parsed_value;
+ }
+
+ public static float Parse (string s, IFormatProvider fp)
+ {
+ double parsed_value = Double.Parse (
+ s, (NumberStyles.Float | NumberStyles.AllowThousands), fp);
+ if (parsed_value > (double) float.MaxValue)
+ throw new OverflowException();
+
+ return (float) parsed_value;
+ }
+
+ public static float Parse (string s, NumberStyles style)
+ {
+ double parsed_value = Double.Parse (s, style, null);
+ if (parsed_value > (double) float.MaxValue)
+ throw new OverflowException();
+
+ return (float) parsed_value;
+ }
+
+ public static float Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ double parsed_value = Double.Parse (s, style, fp);
+ if (parsed_value > (double) float.MaxValue)
+ throw new OverflowException();
+
+ return (float) parsed_value;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ [MonoTODO]
+ public string ToString (string format, IFormatProvider fp)
+ {
+ // FIXME: Need to pass format and provider info to this call too.
+ return ToStringImpl(value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern string ToStringImpl (float value);
+
+ // ============= IConvertible Methods ============ //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Single;
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/StackOverflowException.cs b/mcs/class/corlib/System/StackOverflowException.cs
new file mode 100644
index 00000000000..82edf55c607
--- /dev/null
+++ b/mcs/class/corlib/System/StackOverflowException.cs
@@ -0,0 +1,39 @@
+//
+// System.StackOverflowException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public sealed class StackOverflowException : SystemException {
+ // Constructors
+ public StackOverflowException ()
+ : base (Locale.GetText ("The requested operation caused a stack overflow"))
+ {
+ }
+
+ public StackOverflowException (string message)
+ : base (message)
+ {
+ }
+
+ public StackOverflowException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ internal StackOverflowException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs
new file mode 100644
index 00000000000..4546f695148
--- /dev/null
+++ b/mcs/class/corlib/System/String.cs
@@ -0,0 +1,1145 @@
+//
+// System.String.cs
+//
+// Authors:
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Jeffrey Stedfast (fejj@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ [Serializable]
+ public sealed class String : IConvertible, IComparable, ICloneable, IEnumerable {
+ private int length;
+
+ static private int COMPARE_CASE = 0;
+ static private int COMPARE_INCASE = 1;
+ static private int COMPARE_ORDINAL = 2;
+
+ public static readonly String Empty = "";
+
+ public static bool Equals(String str1, String str2) {
+ if ((str1 as object) == (str2 as object))
+ return true;
+
+ if (null == str1 || null == str2)
+ return false;
+
+ if (str1.length != str2.length)
+ return false;
+
+ return InternalEquals(str1, str2);
+ }
+
+ public static bool operator == (String str1, String str2) {
+ return Equals(str1, str2);
+ }
+
+ public static bool operator != (String str1, String str2) {
+ return !Equals(str1, str2);
+ }
+
+ public override bool Equals(Object obj) {
+ if (null == obj)
+ return false;
+
+ if (!(obj is String))
+ return false;
+
+ string other = (string) obj;
+ if (length != other.length)
+ return false;
+
+ return InternalEquals(this, other);
+ }
+
+ public bool Equals(String value) {
+ if (null == value)
+ return false;
+
+ if (length != value.length)
+ return false;
+
+ return InternalEquals(this, value);
+ }
+
+ [IndexerName("Chars")]
+ public extern char this[int index] {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public Object Clone() {
+ return this;
+ }
+
+ public TypeCode GetTypeCode () {
+ return TypeCode.String;
+ }
+
+ public void CopyTo(int sindex, char[] dest, int dindex, int count) {
+ // LAMESPEC: should I null-terminate?
+
+ if (dest == null)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || dindex < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex + count > Length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (dindex + count > dest.Length)
+ throw new ArgumentOutOfRangeException ();
+
+ InternalCopyTo(sindex, dest, dindex, count);
+ }
+
+ public char[] ToCharArray() {
+ return ToCharArray(0, length);
+ }
+
+ public char[] ToCharArray(int sindex, int length) {
+ if (sindex < 0 || length < 0 || sindex + length > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ char [] tmp = new char[length];
+
+ InternalCopyTo(sindex, tmp, 0, length);
+
+ return tmp;
+ }
+
+ public String [] Split(params char [] separator) {
+ return Split(separator, Int32.MaxValue);
+ }
+
+ public String[] Split(char[] separator, int count) {
+ if (null == separator) {
+ separator = WhiteChars;
+ }
+
+ if (count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (count == 0)
+ return new String[0];
+
+ if (count == 1)
+ return new String[1] { ToString() };
+
+ return InternalSplit(separator, count);
+ }
+
+ public String Substring (int sindex) {
+ if (sindex < 0 || sindex > this.length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ string tmp = InternalAllocateStr(this.length - sindex);
+ InternalStrcpy(tmp, 0, this, sindex, length - sindex);
+
+ return tmp;
+ }
+
+ public String Substring (int sindex, int length) {
+ if (length < 0 || sindex < 0 || sindex + length > this.length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if (length == 0)
+ return String.Empty;
+
+ string tmp = InternalAllocateStr(length);
+ InternalStrcpy(tmp, 0, this, sindex, length);
+
+ return tmp;
+ }
+
+ private static readonly char[] WhiteChars = { (char) 0x9, (char) 0xA, (char) 0xB, (char) 0xC, (char) 0xD, (char) 0x20, (char) 0xA0, (char) 0x2000, (char) 0x2001, (char) 0x2002, (char) 0x2003, (char) 0x2004, (char) 0x2005,
+ (char) 0x2006, (char) 0x2007, (char) 0x2008, (char) 0x2009, (char) 0x200A, (char) 0x200B, (char) 0x3000, (char) 0xFEFF };
+
+ public String Trim(params char[] chars) {
+ if (null == chars || chars.Length == 0)
+ chars = WhiteChars;
+
+ return InternalTrim(chars, 0);
+ }
+
+ public String TrimStart(params char[] chars) {
+ if (null == chars || chars.Length == 0)
+ chars = WhiteChars;
+
+ return InternalTrim(chars, 1);
+ }
+
+ public String TrimEnd(params char[] chars) {
+ if (null == chars || chars.Length == 0)
+ chars = WhiteChars;
+
+ return InternalTrim(chars, 2);
+ }
+
+ public static int Compare(String s1, String s2) {
+ return Compare(s1, s2, false);
+ }
+
+ public static int Compare(String s1, String s2, bool inCase) {
+ if (null == s1) {
+ if (null == s2)
+ return 0;
+ else
+ return -1;
+ } else if (null == s2)
+ return 1;
+
+ return InternalCompare(s1, 0, s2, 0, Math.Max(s1.length, s2.length), (inCase == true) ? COMPARE_INCASE : COMPARE_CASE);
+ }
+
+ [MonoTODO()]
+ public static int Compare(String s1, String s2, bool inCase, CultureInfo culture) {
+ return Compare(s1, s2, inCase);
+ }
+
+ public static int Compare(String s1, int i1, String s2, int i2, int length) {
+ return Compare(s1, i1, s2, i2, length, false);
+ }
+
+ public static int Compare(String s1, int i1, String s2, int i2, int length, bool inCase) {
+ if (null == s1) {
+ if (null == s2)
+ return 0;
+ else
+ return -1;
+ } else if (null == s2)
+ return 1;
+
+ if (length < 0 || i1 < 0 || i2 < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (i1 > s1.length || i2 > s2.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (length == 0)
+ return 0;
+
+ return InternalCompare(s1, i1, s2, i2, length, (inCase == true) ? COMPARE_INCASE : COMPARE_CASE);
+ }
+
+ [MonoTODO()]
+ public static int Compare(String s1, int i1, String s2, int i2, int length, bool inCase, CultureInfo culture) {
+ return Compare(s1, i1, s2, i2, length, inCase);
+ }
+
+ public int CompareTo(Object value) {
+ if (null == value)
+ return 1;
+
+ if (!(value is String))
+ throw new ArgumentException();
+
+ return String.Compare(this, (String) value, false);
+ }
+
+ public int CompareTo(String str) {
+ if (null == str)
+ return 1;
+
+ return Compare(this, str, false);
+ }
+
+ public static int CompareOrdinal(String s1, String s2) {
+ if (null == s1 || null == s2) {
+ if ((Object)s1 == (Object) s2) {
+ return 0;
+ }
+
+ return (s1 == null) ? -1 : 1;
+ }
+
+ return InternalCompare(s1, 0, s2, 0, Math.Max(s1.length, s2.length), COMPARE_ORDINAL);
+ }
+
+ public static int CompareOrdinal(String s1, int i1, String s2, int i2, int length) {
+ if (null == s1 || null == s2) {
+ if ((Object)s1 == (Object) s2) {
+ return 0;
+ }
+
+ return (s1 == null) ? -1 : 1;
+ }
+
+ if (i1 < 0 || i2 < 0 || length < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (i1 > s1.length || i2 > s2.length)
+ throw new ArgumentOutOfRangeException ();
+
+ return InternalCompare(s1, i1, s2, i2, length, COMPARE_ORDINAL);
+ }
+
+ public bool EndsWith(String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (value.length > this.length) {
+ return false;
+ }
+
+ return (0 == Compare(this, length - value.length, value, 0, value.length));
+ }
+
+ public int IndexOfAny(char [] arr) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ return InternalIndexOfAny(arr, 0, this.length);
+ }
+
+ public int IndexOfAny(char [] arr, int sindex) {
+ if (null == arr)
+ throw new ArgumentNullException();
+ if (sindex < 0 || sindex >= this.length)
+ throw new ArgumentOutOfRangeException();
+
+ return InternalIndexOfAny(arr, sindex, this.length - sindex);
+ }
+
+ public int IndexOfAny(char [] arr, int sindex, int count) {
+ if (null == arr)
+ throw new ArgumentNullException();
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ return InternalIndexOfAny(arr, sindex, count);
+ }
+
+ public int IndexOf(char value) {
+ return InternalIndexOf(value, 0, this.length);
+ }
+
+ public int IndexOf(String value) {
+ return IndexOf(value, 0, this.length);
+ }
+
+ public int IndexOf(char value, int sindex) {
+ if (sindex < 0 || sindex > this.length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if (sindex == this.length)
+ return -1;
+
+ return InternalIndexOf(value, sindex, this.length - sindex);
+ }
+
+ public int IndexOf(String value, int sindex) {
+ if (sindex == this.length)
+ return -1;
+
+ return IndexOf(value, sindex, this.length - sindex);
+ }
+
+ public int IndexOf(char value, int sindex, int count) {
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalIndexOf(value, sindex, count);
+ }
+
+ public int IndexOf(String value, int sindex, int count) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalIndexOf(value, sindex, count);
+ }
+
+ public int LastIndexOfAny(char [] arr) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ return InternalLastIndexOfAny(arr, this.length - 1, this.length);
+ }
+
+ public int LastIndexOfAny(char [] arr, int sindex) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || sindex > this.length)
+ throw new ArgumentOutOfRangeException();
+
+ if (this.length == 0)
+ return -1;
+
+ return InternalLastIndexOfAny(arr, sindex, sindex + 1);
+ }
+
+ public int LastIndexOfAny(char [] arr, int sindex, int count) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || count < 0 || sindex > this.length || sindex - count < -1)
+ throw new ArgumentOutOfRangeException();
+
+ if (this.length == 0)
+ return -1;
+
+ return InternalLastIndexOfAny(arr, sindex, count);
+ }
+
+ public int LastIndexOf(char value) {
+ return InternalLastIndexOf(value, this.length - 1, this.length);
+ }
+
+ public int LastIndexOf(String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (value.length == 0)
+ return 0;
+
+ if (this.length == 0)
+ return -1;
+
+ return InternalLastIndexOf(value, this.length - 1, this.length);
+ }
+
+ public int LastIndexOf(char value, int sindex){
+ return LastIndexOf(value, sindex, sindex + 1);
+ }
+
+ public int LastIndexOf(String value, int sindex) {
+ return LastIndexOf(value, sindex, sindex + 1);
+ }
+
+ public int LastIndexOf(char value, int sindex, int count) {
+ if (sindex < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex >= this.length || sindex - count + 1 < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalLastIndexOf(value, sindex, count);
+ }
+
+ public int LastIndexOf(String value, int sindex, int count) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || sindex > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (count < 0 || sindex - count + 1 < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (value.length > sindex)
+ return -1;
+
+ if (value == String.Empty)
+ return sindex;
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalLastIndexOf(value, sindex, count);
+ }
+
+ public String PadLeft(int width) {
+ return PadLeft(width, ' ');
+ }
+
+ public String PadLeft(int width, char chr) {
+ if (width < 0)
+ throw new ArgumentException();
+
+ if (width < this.length)
+ return String.Copy(this);
+
+ return InternalPad(width, chr, false);
+ }
+
+ public String PadRight(int width) {
+ return PadRight(width, ' ');
+ }
+
+ public String PadRight(int width, char chr) {
+ if (width < 0)
+ throw new ArgumentException();
+
+ if (width < this.length)
+ return String.Copy(this);
+
+ return InternalPad(width, chr, true);
+ }
+
+ public bool StartsWith(String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (this.length < value.length)
+ return false;
+
+ return (0 == Compare(this, 0, value, 0 , value.length));
+ }
+
+
+ public String Replace (char oldChar, char newChar) {
+ return InternalReplace(oldChar, newChar);
+ }
+
+ public String Replace(String oldValue, String newValue) {
+ if (null == oldValue)
+ throw new ArgumentNullException();
+
+ return InternalReplace(oldValue, newValue);
+ }
+
+ public String Remove(int sindex, int count) {
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ return InternalRemove(sindex, count);
+ }
+
+ public String ToLower() {
+ return InternalToLower();
+ }
+
+ [MonoTODO("By now, don't use culture info")]
+ public String ToLower(CultureInfo culture) {
+ return InternalToLower();
+ }
+
+ public String ToUpper() {
+ return InternalToUpper();
+ }
+
+ [MonoTODO("By now, don't use culture info")]
+ public String ToUpper(CultureInfo culture) {
+ return InternalToUpper();
+ }
+
+ public override String ToString() {
+ return this;
+ }
+
+ public String ToString(IFormatProvider provider) {
+ return this;
+ }
+
+ public String Trim() {
+ return Trim(null);
+ }
+
+ public static String Format(String format, Object arg0) {
+ return Format(null, format, new Object[] {arg0});
+ }
+
+ public static String Format(String format, Object arg0, Object arg1) {
+ return Format(null, format, new Object[] {arg0, arg1});
+ }
+
+ public static String Format(String format, Object arg0, Object arg1, Object arg2) {
+ return Format(null, format, new Object[] {arg0, arg1, arg2});
+ }
+
+ public static string Format (string format, params object[] args) {
+ return Format (null, format, args);
+ }
+
+ public static string Format (IFormatProvider provider, string format, params object[] args) {
+ if (format == null || args == null)
+ throw new ArgumentNullException ();
+
+ StringBuilder result = new StringBuilder ();
+
+ int ptr = 0;
+ int start = ptr;
+ while (ptr < format.length) {
+ char c = format[ptr ++];
+
+ if (c == '{') {
+ result.Append (format, start, ptr - start - 1);
+
+ // check for escaped open bracket
+
+ if (format[ptr] == '{') {
+ start = ptr ++;
+ continue;
+ }
+
+ // parse specifier
+
+ int n, width;
+ bool left_align;
+ string arg_format;
+
+ ParseFormatSpecifier (format, ref ptr, out n, out width, out left_align, out arg_format);
+ if (n >= args.Length)
+ throw new FormatException ("Index (zero based) must be greater than or equal to zero and less than the size of the argument list.");
+
+ // format argument
+
+ object arg = args[n];
+
+ string str;
+ if (arg == null)
+ str = "";
+ else if (arg is IFormattable)
+ str = ((IFormattable)arg).ToString (arg_format, provider);
+ else
+ str = arg.ToString ();
+
+ // pad formatted string and append to result
+
+ if (width > str.length) {
+ string pad = new String (' ', width - str.length);
+
+ if (left_align) {
+ result.Append (str);
+ result.Append (pad);
+ }
+ else {
+ result.Append (pad);
+ result.Append (str);
+ }
+ }
+ else
+ result.Append (str);
+
+ start = ptr;
+ }
+ else if (c == '}' && ptr < format.length && format[ptr] == '}') {
+ result.Append (format, start, ptr - start - 1);
+ start = ptr ++;
+ }
+ else if (c == '}') {
+ throw new FormatException ("Input string was not in a correct format.");
+ }
+ }
+
+ if (start < format.length)
+ result.Append (format.Substring (start));
+
+ return result.ToString ();
+ }
+
+ public static String Copy (String str) {
+ if (str == null)
+ throw new ArgumentNullException ();
+
+ int length = str.length;
+
+ String tmp = InternalAllocateStr(length);
+ InternalStrcpy(tmp, 0, str);
+ return tmp;
+ }
+
+ public static String Concat(Object obj) {
+ if (null == obj)
+ return String.Empty;
+
+ return obj.ToString();
+ }
+
+ public static String Concat(Object obj1, Object obj2)
+ {
+ string s1, s2;
+
+ if (obj1 == null){
+ if (obj2 == null)
+ return String.Empty;
+ else
+ return obj2.ToString ();
+ } else if (obj2 == null)
+ return obj1.ToString ();
+
+ s1 = obj1.ToString ();
+ s2 = obj2.ToString ();
+ String tmp = InternalAllocateStr (s1.Length + s2.Length);
+ InternalStrcpy (tmp, 0, s1);
+ InternalStrcpy (tmp, s1.length, s2);
+
+ return tmp;
+ }
+
+ public static String Concat(Object obj1, Object obj2, Object obj3)
+ {
+ string s1, s2, s3;
+ if (obj1 == null)
+ s1 = String.Empty;
+ else
+ s1 = obj1.ToString ();
+
+ if (obj2 == null)
+ s2 = String.Empty;
+ else
+ s2 = obj2.ToString ();
+
+ if (obj3 == null)
+ s3 = String.Empty;
+ else
+ s3 = obj3.ToString ();
+
+ return Concat (s1, s2, s3);
+ }
+
+ public static String Concat(String s1, String s2)
+ {
+ if (s1 == null) {
+ if (s2 == null)
+ return String.Empty;
+ return s2;
+ }
+
+ if (s2 == null)
+ return s1;
+
+ String tmp = InternalAllocateStr(s1.length + s2.length);
+
+ InternalStrcpy(tmp, 0, s1);
+ InternalStrcpy(tmp, s1.length, s2);
+
+ return tmp;
+ }
+
+ public static String Concat(String s1, String s2, String s3)
+ {
+ if (s1 == null){
+ if (s2 == null){
+ if (s3 == null)
+ return String.Empty;
+ return s3;
+ } else {
+ if (s3 == null)
+ return s2;
+ }
+ s1 = String.Empty;
+ } else {
+ if (s2 == null){
+ if (s3 == null)
+ return s1;
+ else
+ s2 = String.Empty;
+ } else {
+ if (s3 == null)
+ s3 = String.Empty;
+ }
+ }
+
+ String tmp = InternalAllocateStr(s1.length + s2.length + s3.length);
+
+ InternalStrcpy(tmp, 0, s1);
+ InternalStrcpy(tmp, s1.length, s2);
+ InternalStrcpy(tmp, s1.length + s2.length, s3);
+
+ return tmp;
+ }
+
+ public static String Concat(String s1, String s2, String s3, String s4) {
+ if (null == s1 && null == s2 && null == s3 && null == s4) {
+ return String.Empty;
+ }
+
+ if (null == s1) { s1 = String.Empty; }
+ if (null == s2) { s2 = String.Empty; }
+ if (null == s3) { s3 = String.Empty; }
+ if (null == s4) { s4 = String.Empty; }
+
+ String tmp = InternalAllocateStr(s1.length + s2.length + s3.length + s4.length);
+
+ InternalStrcpy(tmp, 0, s1);
+ InternalStrcpy(tmp, s1.length, s2);
+ InternalStrcpy(tmp, s1.length + s2.length, s3);
+ InternalStrcpy(tmp, s1.length + s2.length + s3.length, s4);
+
+ return tmp;
+ }
+
+ public static String Concat(params Object[] args) {
+ string [] strings;
+ int len, i, currentpos;
+
+ if (null == args)
+ throw new ArgumentNullException ();
+
+ strings = new string [args.Length];
+ len = 0;
+ i = 0;
+ foreach (object arg in args) {
+ /* use Empty for each null argument */
+ if (arg == null)
+ strings[i] = String.Empty;
+ else
+ strings[i] = arg.ToString ();
+ len += strings[i].length;
+ i++;
+ }
+
+ if (len == 0)
+ return String.Empty;
+
+ currentpos = 0;
+
+ String tmp = InternalAllocateStr(len);
+ for (i = 0; i < strings.Length; i++) {
+ InternalStrcpy(tmp, currentpos, strings[i]);
+ currentpos += strings[i].length;
+ }
+
+ return tmp;
+ }
+
+ public static String Concat(params String[] values) {
+ int len, i, currentpos;
+
+ if (values == null)
+ throw new ArgumentNullException ();
+
+ len = 0;
+ foreach (string value in values)
+ len += value != null ? value.length : 0;
+
+ if (len == 0)
+ return String.Empty;
+
+ currentpos = 0;
+
+ String tmp = InternalAllocateStr(len);
+ for (i = 0; i < values.Length; i++) {
+ if (values[i] == null)
+ continue;
+
+ InternalStrcpy(tmp, currentpos, values[i]);
+ currentpos += values[i].length;
+ }
+
+ return tmp;
+ }
+
+ public String Insert(int sindex, String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || sindex > this.length)
+ throw new ArgumentOutOfRangeException();
+
+ return InternalInsert(sindex, value);
+ }
+
+
+ public static string Intern (string str) {
+ if (null == str)
+ throw new ArgumentNullException ();
+
+ return InternalIntern(str);
+ }
+
+ public static string IsInterned (string str) {
+ if (null == str)
+ throw new ArgumentNullException();
+
+ return InternalIsInterned(str);
+ }
+
+ public static string Join (string separator, string [] value) {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ return Join(separator, value, 0, value.Length);
+ }
+
+ public static string Join(string separator, string[] value, int sindex, int count) {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if (sindex + count > value.Length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == value.Length)
+ return String.Empty;
+
+ return InternalJoin(separator, value, sindex, count);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider) {
+ return Convert.ToBoolean (this);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider) {
+ return Convert.ToByte (this);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider) {
+ return Convert.ToChar (this);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider) {
+ return Convert.ToDateTime (this);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider) {
+ return Convert.ToDecimal (this);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider) {
+ return Convert.ToDouble (this);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider) {
+ return Convert.ToInt16 (this);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider) {
+ return Convert.ToInt32 (this);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider) {
+ return Convert.ToInt64 (this);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider) {
+ return Convert.ToSByte (this);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider) {
+ return Convert.ToSingle (this);
+ }
+ string IConvertible.ToString (IFormatProvider format) {
+ return this;
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider) {
+ return Convert.ToType (this, conversionType, provider);
+ }
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider) {
+ return Convert.ToUInt16 (this);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider) {
+ return Convert.ToUInt32 (this);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider) {
+ return Convert.ToUInt64 (this);
+ }
+
+ TypeCode IConvertible.GetTypeCode () {
+ return TypeCode.String;
+ }
+
+ public int Length {
+ get {
+ return length;
+ }
+ }
+
+ public CharEnumerator GetEnumerator () {
+ return new CharEnumerator (this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator () {
+ return new CharEnumerator (this);
+ }
+
+ private static void ParseFormatSpecifier (string str, ref int ptr, out int n, out int width, out bool left_align, out string format) {
+ // parses format specifier of form:
+ // N,[\ +[-]M][:F]}
+ //
+ // where:
+
+ try {
+ // N = argument number (non-negative integer)
+
+ n = ParseDecimal (str, ref ptr);
+ if (n < 0)
+ throw new FormatException ("Input string was not in a correct format.");
+
+ // M = width (non-negative integer)
+
+ if (str[ptr] == ',') {
+ // White space between ',' and number or sign.
+ int start = ++ptr;
+ while (Char.IsWhiteSpace (str [ptr]))
+ ++ptr;
+
+ format = str.Substring (start, ptr - start);
+
+ left_align = (str [ptr] == '-');
+ if (left_align)
+ ++ ptr;
+
+ width = ParseDecimal (str, ref ptr);
+ if (width < 0)
+ throw new FormatException ("Input string was not in a correct format.");
+ }
+ else {
+ width = 0;
+ left_align = false;
+ format = "";
+ }
+
+ // F = argument format (string)
+
+ if (str[ptr] == ':') {
+ int start = ++ ptr;
+ while (str[ptr] != '}')
+ ++ ptr;
+
+ format += str.Substring (start, ptr - start);
+ }
+ else
+ format = null;
+
+ if (str[ptr ++] != '}')
+ throw new FormatException ("Input string was not in a correct format.");
+ }
+ catch (IndexOutOfRangeException) {
+ throw new FormatException ("Input string was not in a correct format.");
+ }
+ }
+
+ private static int ParseDecimal (string str, ref int ptr) {
+ int p = ptr;
+ int n = 0;
+ while (true) {
+ char c = str[p];
+ if (c < '0' || '9' < c)
+ break;
+
+ n = n * 10 + c - '0';
+ ++ p;
+ }
+
+ if (p == ptr)
+ return -1;
+
+ ptr = p;
+ return n;
+ }
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(char *value);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(char *value, int sindex, int length);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(sbyte *value);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(sbyte *value, int sindex, int length);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(sbyte *value, int sindex, int length, Encoding enc);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern String(char [] val, int sindex, int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern String(char [] val);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern String(char c, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override int GetHashCode();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string InternalJoin(string separator, string[] value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalInsert(int sindex, String value);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalReplace(char oldChar, char newChar);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalReplace(String oldValue, String newValue);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalRemove(int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void InternalCopyTo(int sindex, char[] dest, int dindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String[] InternalSplit(char[] separator, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalTrim(char[] chars, int typ);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalIndexOf(char value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalIndexOf(string value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalIndexOfAny(char [] arr, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalLastIndexOf(char value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalLastIndexOf(String value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalLastIndexOfAny(char [] anyOf, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalPad(int width, char chr, bool right);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalToLower();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalToUpper();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static String InternalAllocateStr(int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void InternalStrcpy(String dest, int destPos, String src);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void InternalStrcpy(String dest, int destPos, String src, int startPos, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string InternalIntern(string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string InternalIsInterned(string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int InternalCompare(String s1, int i1, String s2, int i2, int length, int mode);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool InternalEquals(String s1, String s2);
+ }
+}
diff --git a/mcs/class/corlib/System/SystemException.cs b/mcs/class/corlib/System/SystemException.cs
new file mode 100644
index 00000000000..39a4f411296
--- /dev/null
+++ b/mcs/class/corlib/System/SystemException.cs
@@ -0,0 +1,39 @@
+//
+// System.SystemException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public class SystemException : Exception {
+ // Constructors
+ public SystemException ()
+ : base (Locale.GetText ("A system exception has occurred."))
+ {
+ }
+
+ public SystemException (string message)
+ : base (message)
+ {
+ }
+
+ protected SystemException(SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public SystemException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TODO b/mcs/class/corlib/System/TODO
new file mode 100644
index 00000000000..065809deedb
--- /dev/null
+++ b/mcs/class/corlib/System/TODO
@@ -0,0 +1,22 @@
+System.Object:
+ Need a mechanism for getting an object underlying type.
+
+System.ValueType:
+ Need to lock memory and "scan" the actual contents to compute
+ hash code and do comparissions. Should be simple to do with
+ C#, the problem is figuring out the size of the object.
+
+System.String:
+ Need to implement the Format() and CompareOrdinal() methods
+ as we all implement all of the methods that take into account
+ CultureInfo or Encoding stuff.
+
+System.Array:
+ It's not possible to test to see if the whole thing works, as
+ GetValue() and SetValue() make calls into the runtime. However,
+ I've tried my implementations of things like BinarySearch() and
+ Sort() on the MS-provided System.Array and they seem to work fine.
+ According to the spec, System.Array implements the IList interface.
+ The spec doesn't have the methods for those interfaces, however,
+ the class doesn't (yet) implement that interface and those methods
+ are not (yet) written.
diff --git a/mcs/class/corlib/System/TODOAttribute.cs b/mcs/class/corlib/System/TODOAttribute.cs
new file mode 100644
index 00000000000..0920ce8f92d
--- /dev/null
+++ b/mcs/class/corlib/System/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ThreadStaticAttribute.cs b/mcs/class/corlib/System/ThreadStaticAttribute.cs
new file mode 100644
index 00000000000..97d06667a6b
--- /dev/null
+++ b/mcs/class/corlib/System/ThreadStaticAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.ThreadStaticAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Field)]
+ [Serializable]
+ public class ThreadStaticAttribute : Attribute
+ {
+ // Constructors
+ public ThreadStaticAttribute () : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TimeSpan.cs b/mcs/class/corlib/System/TimeSpan.cs
new file mode 100644
index 00000000000..e9976a3173d
--- /dev/null
+++ b/mcs/class/corlib/System/TimeSpan.cs
@@ -0,0 +1,551 @@
+//
+// System.TimeSpan.cs
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2001 Duco Fijma
+//
+
+using System.Globalization;
+
+namespace System {
+
+[Serializable]
+public struct TimeSpan : IComparable {
+
+ private long _ticks;
+
+ public TimeSpan (long value) { _ticks = value; }
+ public TimeSpan (int hours, int minutes, int seconds)
+ : this(false, 0, hours, minutes, seconds, 0, 0) {}
+ public TimeSpan (int days, int hours, int minutes, int seconds)
+ : this(false, days, hours, minutes, seconds, 0, 0) {}
+ public TimeSpan (int days, int hours, int minutes, int seconds, int milliseconds)
+ : this(false, days, hours, minutes, seconds, milliseconds, 0) {}
+
+ internal TimeSpan (bool sign, int days, int hours, int minutes, int seconds, int milliseconds, long ticks)
+ {
+ checked {
+ _ticks = TicksPerDay * days +
+ TicksPerHour * hours +
+ TicksPerMinute * minutes +
+ TicksPerSecond * seconds +
+ TicksPerMillisecond * milliseconds +
+ ticks;
+ if ( sign ) {
+ _ticks = -_ticks;
+ }
+ }
+ }
+
+ public static readonly TimeSpan MaxValue = new TimeSpan (long.MaxValue);
+ public static readonly TimeSpan MinValue = new TimeSpan (long.MinValue);
+ public const long TicksPerDay = 864000000000L;
+ public const long TicksPerHour = 36000000000L;
+ public const long TicksPerMillisecond = 10000L;
+ public const long TicksPerMinute = 600000000L;
+ public const long TicksPerSecond = 10000000L;
+ public static readonly TimeSpan Zero = new TimeSpan (0L);
+
+ public int Days
+ {
+ get {
+ return (int) TotalDays;
+ }
+ }
+
+ public int Hours
+ {
+ get {
+ return (int) (_ticks % TicksPerDay / TicksPerHour);
+ }
+ }
+
+ public int Milliseconds
+ {
+ get
+ {
+ return (int) (_ticks % TicksPerSecond / TicksPerMillisecond);
+ }
+ }
+
+ public int Minutes
+ {
+ get
+ {
+ return (int) (_ticks % TicksPerHour / TicksPerMinute);
+ }
+ }
+
+ public int Seconds
+ {
+ get
+ {
+ return (int) (_ticks % TicksPerMinute / TicksPerSecond);
+ }
+ }
+
+ public long Ticks
+ {
+ get
+ {
+ return _ticks;
+ }
+ }
+
+ public double TotalDays
+ {
+ get
+ {
+ return (double) _ticks / TicksPerDay;
+ }
+ }
+
+ public double TotalHours
+ {
+ get
+ {
+ return (double) _ticks / TicksPerHour;
+ }
+ }
+
+ public double TotalMilliseconds
+ {
+ get
+ {
+ return (double) _ticks / TicksPerMillisecond;
+ }
+ }
+
+ public double TotalMinutes
+ {
+ get {
+ return (double) _ticks / TicksPerMinute;
+ }
+ }
+
+ public double TotalSeconds
+ {
+ get {
+ return (double) _ticks / TicksPerSecond;
+ }
+ }
+
+ public TimeSpan Add (TimeSpan ts)
+ {
+ checked {
+ return new TimeSpan (_ticks + ts.Ticks);
+ }
+ }
+
+ public static int Compare (TimeSpan t1, TimeSpan t2)
+ {
+ if (t1._ticks < t2._ticks) {
+ return -1;
+ }
+ else if (t1._ticks > t2._ticks) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null )
+ return 1;
+
+ if (!(value is TimeSpan)) {
+ throw new ArgumentException (Locale.GetText (
+ "Argument of System.TimeSpan.CompareTo should be a TimeSpan"));
+ }
+
+ return Compare(this, (TimeSpan) value);
+ }
+
+ public TimeSpan Duration ()
+ {
+ checked {
+ return new TimeSpan (Math.Abs (_ticks));
+ }
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TimeSpan)) {
+ return false;
+ }
+ return Equals (this, (TimeSpan) value);
+ }
+
+ public static bool Equals (TimeSpan t1, TimeSpan t2)
+ {
+ return t1._ticks == t2._ticks;
+ }
+
+ // Implementing FromDays -> FromHours -> FromMinutes -> FromSeconds ->
+ // FromMilliseconds as done here is probably not the most efficient
+ // way.
+ public static TimeSpan FromDays (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan ((int) value,0,0,0,0) + FromHours ((value - ((int) value)) * 24);
+ }
+
+ public static TimeSpan FromHours (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan ((int) value,0,0) + FromMinutes ((value - ((int) value)) * 60);
+ }
+
+ public static TimeSpan FromMinutes (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan (0, (int) value, 0) + FromSeconds((value - ((int) value)) * 60);
+ }
+
+ public static TimeSpan FromSeconds (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan (0, 0, 0, (int) value) + FromMilliseconds((value - ((int) value)) * 1000);
+
+ }
+
+ public static TimeSpan FromMilliseconds (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan (0, 0, 0, 0, (int) value);
+ }
+
+ public static TimeSpan FromTicks (long value)
+ {
+ return new TimeSpan (value);
+ }
+
+ public override int GetHashCode ()
+ {
+ return _ticks.GetHashCode ();
+ }
+
+ public TimeSpan Negate ()
+ {
+ checked {
+ return new TimeSpan (-_ticks);
+ }
+ }
+
+ public static TimeSpan Parse (string s)
+ {
+ if (s == null) {
+ throw new ArgumentNullException (
+ Locale.GetText ("null reference passed to TimeSpan.Parse"));
+ }
+
+ Parser p = new Parser (s);
+ return p.Execute ();
+ }
+
+ public TimeSpan Subtract (TimeSpan ts)
+ {
+ checked {
+ return new TimeSpan (_ticks - ts.Ticks);
+ }
+ }
+
+ public override string ToString ()
+ {
+ string res = "";
+
+ if (_ticks < 0) {
+ res += "-";
+ }
+
+ // We need to take absolute values of all components.
+ // Can't handle negative timespans by negating the TimeSpan
+ // as a whole. This would lead to an overflow for the
+ // degenerate case "TimeSpan.MinValue.ToString()".
+ if (Days != 0) {
+ res += Math.Abs (Days) + "." ;
+ }
+
+ res += string.Format ("{0:D2}:{1:D2}:{2:D2}", Math.Abs(Hours), Math.Abs(Minutes), Math.Abs(Seconds));
+
+ int fractional = (int) Math.Abs (_ticks % TicksPerSecond);
+ if (fractional != 0) {
+ res += string.Format (".{0:D7}", fractional);
+ }
+
+ return res;
+ }
+
+ public static TimeSpan operator + (TimeSpan t1, TimeSpan t2)
+ {
+ return t1.Add (t2);
+ }
+
+ public static bool operator == (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) == 0;
+ }
+
+ public static bool operator > (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) == 1;
+ }
+
+ public static bool operator >= (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) != -1;
+ }
+
+ public static bool operator != (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) != 0;
+ }
+
+ public static bool operator < (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) == -1;
+ }
+
+ public static bool operator <= (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) != 1;
+ }
+
+ public static TimeSpan operator - (TimeSpan t1, TimeSpan t2)
+ {
+ return t1.Subtract (t2);
+ }
+
+ public static TimeSpan operator - (TimeSpan t)
+ {
+ return t.Negate ();
+ }
+
+ public static TimeSpan operator + (TimeSpan t)
+ {
+ return t;
+ }
+
+// Class Parser implements simple parser for TimeSpan::Parse
+internal class Parser {
+
+ private string _src;
+ private int _cur;
+ private int _length;
+
+ public Parser (string src)
+ {
+ _src = src;
+ Reset ();
+ }
+
+ public void Reset ()
+ {
+ _cur = 0;
+ _length = _src.Length;
+ }
+
+ public bool AtEnd
+ {
+ get {
+ return _cur >= _length;
+ }
+ }
+
+ private void ThrowFormatException()
+ {
+ throw new FormatException (Locale.GetText ("Invalid format for TimeSpan.Parse"));
+ }
+
+ // All "Parse" functions throw a FormatException on syntax error.
+ // Their return value is semantic value of the item parsed.
+
+ // Range checking is spread over three different places:
+ // 1) When parsing "int" values, an exception is thrown immediately
+ // when the value parsed exceeds the maximum value for an int.
+ // 2) An explicit check is built in that checks for hours > 23 and
+ // for minutes and seconds > 59.
+ // 3) Throwing an exceptions for a final TimeSpan value > MaxValue
+ // or < MinValue is left to the TimeSpan constructor called.
+
+ // Parse zero or more whitespace chars.
+ private void ParseWhiteSpace ()
+ {
+ while (!AtEnd && Char.IsWhiteSpace (_src, _cur)) {
+ _cur++;
+ }
+ }
+
+ // Parse optional sign character.
+ private bool ParseSign ()
+ {
+ bool res = false;
+
+ if (!AtEnd && _src[_cur] == '-') {
+ res = true;
+ _cur++;
+ }
+
+ return res;
+ }
+
+ // Parse simple int value
+ private int ParseInt ()
+ {
+ int res = 0;
+ int count = 0;
+
+ while (!AtEnd && Char.IsDigit (_src, _cur)) {
+ checked {
+ res = res*10 + _src[_cur] - '0';
+ }
+ _cur++;
+ count++;
+ }
+
+ if (count == 0) {
+ ThrowFormatException ();
+ }
+
+ return res;
+ }
+
+ // Parse optional dot
+ private bool ParseOptDot ()
+ {
+ if (AtEnd) {
+ return false;
+ }
+
+ if (_src[_cur] == '.') {
+ _cur++;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ // Parse NON-optional colon
+ private void ParseColon ()
+ {
+ if (!AtEnd && _src[_cur] == ':') {
+ _cur++;
+ }
+ else {
+ ThrowFormatException ();
+ }
+ }
+
+ // Parse [1..7] digits, representing fractional seconds (ticks)
+ private long ParseTicks ()
+ {
+ long mag = 1000000;
+ long res = 0;
+ bool digitseen = false;
+
+ while ( mag > 0 && !AtEnd && Char.IsDigit (_src, _cur) ) {
+ res = res + (_src[_cur] - '0') * mag;
+ _cur++;
+ mag = mag / 10;
+ digitseen = true;
+ }
+
+ if (!digitseen) {
+ ThrowFormatException ();
+ }
+
+ return res;
+ }
+
+ public TimeSpan Execute ()
+ {
+ bool sign;
+ int days;
+ int hours;
+ int minutes;
+ int seconds;
+ long ticks;
+
+ // Parse [ws][dd.]hh:mm:ss[.ff][ws]
+ ParseWhiteSpace ();
+ sign = ParseSign ();
+ days = ParseInt ();
+ if (ParseOptDot ()) {
+ hours = ParseInt ();
+ }
+ else {
+ hours = days;
+ days = 0;
+ }
+ ParseColon();
+ minutes = ParseInt ();
+ ParseColon();
+ seconds = ParseInt ();
+ if ( ParseOptDot () ) {
+ ticks = ParseTicks ();
+ }
+ else {
+ ticks = 0;
+ }
+ ParseWhiteSpace ();
+
+ if ( !AtEnd ) {
+ ThrowFormatException ();
+ }
+
+ if ( hours > 23 || minutes > 59 || seconds > 59 ) {
+ throw new OverflowException (Locale.GetText (
+ "Value outside range in TimeSpan.Parse" ));
+ }
+
+ TimeSpan ts = new TimeSpan (sign, days, hours, minutes, seconds, 0, ticks);
+
+ return ts;
+ }
+
+}
+
+} /* TimeSpan */
+}
+
+
diff --git a/mcs/class/corlib/System/TimeZone.cs b/mcs/class/corlib/System/TimeZone.cs
new file mode 100644
index 00000000000..a7555a35eef
--- /dev/null
+++ b/mcs/class/corlib/System/TimeZone.cs
@@ -0,0 +1,198 @@
+//
+// System.TimeZone.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+// Ajay Kumar Dwivedi (adwiv@yahoo.com)
+// Martin Baulig (martin@gnome.org)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Collections;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public abstract class TimeZone
+ {
+ // Fields
+ private static TimeZone currentTimeZone;
+
+ // Constructor
+ protected TimeZone ()
+ {
+ }
+
+ // Properties
+ public static TimeZone CurrentTimeZone
+ {
+ get {
+ if (currentTimeZone == null)
+ currentTimeZone = new CurrentTimeZone ();
+
+ return currentTimeZone;
+ }
+ }
+
+ public abstract string DaylightName
+ {
+ get;
+ }
+
+ public abstract string StandardName
+ {
+ get;
+ }
+
+ // Methods
+ public abstract DaylightTime GetDaylightChanges (int year);
+
+ public abstract TimeSpan GetUtcOffset (DateTime time);
+
+ public virtual bool IsDaylightSavingTime (DateTime time)
+ {
+ return IsDaylightSavingTime (time, GetDaylightChanges (time.Year));
+ }
+
+ public static bool IsDaylightSavingTime (DateTime time, DaylightTime daylightTimes)
+ {
+ if (daylightTimes == null)
+ throw new ArgumentNullException ("daylightTimes");
+
+ // If Start == End, then DST is off
+ if (daylightTimes.Start.Ticks == daylightTimes.End.Ticks)
+ return false;
+
+ //We are in the northern hemisphere.
+ if (daylightTimes.Start.Ticks < daylightTimes.End.Ticks) {
+ if (daylightTimes.Start.Ticks < time.Ticks
+ && daylightTimes.End.Ticks > time.Ticks)
+ return true; // time lies between Start and End
+
+ } else { // We are in the southern hemisphere.
+ if (time.Year == daylightTimes.Start.Year && time.Year == daylightTimes.End.Year)
+ if (time.Ticks < daylightTimes.End.Ticks
+ || time.Ticks > daylightTimes.Start.Ticks)
+ return true; // time is less than End OR more than Start
+ }
+
+ return false;
+ }
+
+ public virtual DateTime ToLocalTime (DateTime time)
+ {
+ return time + GetUtcOffset (time);
+ }
+
+ public virtual DateTime ToUniversalTime (DateTime time)
+ {
+ return time - GetUtcOffset (time);
+ }
+ }
+
+ internal class CurrentTimeZone : TimeZone
+ {
+ // Fields
+ private static string daylightName;
+ private static string standardName;
+
+ // A yearwise cache of DaylightTime.
+ private static Hashtable daylightCache = new Hashtable (1);
+
+ // the offset when daylightsaving is not on.
+ private static TimeSpan utcOffsetWithOutDLS;
+
+ // the offset when daylightsaving is on.
+ private static TimeSpan utcOffsetWithDLS;
+
+ internal enum TimeZoneData {
+ DaylightSavingStartIdx,
+ DaylightSavingEndIdx,
+ UtcOffsetIdx,
+ AdditionalDaylightOffsetIdx
+ };
+
+ internal enum TimeZoneNames {
+ StandardNameIdx,
+ DaylightNameIdx
+ };
+
+ // Internal method to get timezone data.
+ // data[0]: start of daylight saving time (in DateTime ticks).
+ // data[1]: end of daylight saving time (in DateTime ticks).
+ // data[2]: utcoffset (in TimeSpan ticks).
+ // data[3]: additional offset when daylight saving (in TimeSpan ticks).
+ // name[0]: name of this timezone when not daylight saving.
+ // name[1]: name of this timezone when daylight saving.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern bool GetTimeZoneData (int year,
+ out Int64[] data,
+ out string[] names);
+
+ // Constructor
+ internal CurrentTimeZone ()
+ : base ()
+ {
+ Int64[] data;
+ string[] names;
+
+ DateTime now = new DateTime(DateTime.GetNow ());
+ if (!GetTimeZoneData (now.Year, out data, out names))
+ throw new NotSupportedException (Locale.GetText ("Can't get timezone name"));
+
+ standardName = Locale.GetText (names[(int)TimeZoneNames.StandardNameIdx]);
+ daylightName = Locale.GetText (names[(int)TimeZoneNames.DaylightNameIdx]);
+
+ utcOffsetWithOutDLS = new TimeSpan (data[(int)TimeZoneData.UtcOffsetIdx]);
+ utcOffsetWithDLS = new TimeSpan (data[(int)TimeZoneData.UtcOffsetIdx] + data[(int)TimeZoneData.AdditionalDaylightOffsetIdx]);
+ }
+
+ // Properties
+ public override string DaylightName
+ {
+ get { return daylightName; }
+ }
+
+ public override string StandardName
+ {
+ get { return standardName; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override DaylightTime GetDaylightChanges (int year)
+ {
+ if (year < 1 || year > 9999)
+ throw new ArgumentOutOfRangeException ("year", year + " is not in a range between 1 and 9999.");
+
+ if (daylightCache [year] == null) {
+ lock (this) {
+ if (daylightCache [year] == null) {
+ Int64[] data;
+ string[] names;
+
+ if (!GetTimeZoneData (year, out data, out names))
+ throw new ArgumentException (Locale.GetText ("Can't get timezone data for " + year));
+
+ DaylightTime dlt = new DaylightTime (new DateTime (data[(int)TimeZoneData.DaylightSavingStartIdx]),
+ new DateTime (data[(int)TimeZoneData.DaylightSavingEndIdx]),
+ new TimeSpan (data[(int)TimeZoneData.AdditionalDaylightOffsetIdx]));
+ daylightCache.Add (year, dlt);
+ };
+ };
+ }
+
+ return (DaylightTime) daylightCache [year];
+ }
+
+ public override TimeSpan GetUtcOffset (DateTime time)
+ {
+ if (IsDaylightSavingTime (time))
+ return utcOffsetWithDLS;
+
+ return utcOffsetWithOutDLS;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Type.cs b/mcs/class/corlib/System/Type.cs
new file mode 100644
index 00000000000..dd205601527
--- /dev/null
+++ b/mcs/class/corlib/System/Type.cs
@@ -0,0 +1,929 @@
+//
+// System.Type.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Globalization;
+
+namespace System {
+
+ //
+ // FIXME: Implement the various IReflect dependencies
+ //
+
+ [MonoTODO]
+ [Serializable]
+ public abstract class Type : MemberInfo, IReflect {
+
+ internal RuntimeTypeHandle _impl;
+
+ public static readonly char Delimiter = '.';
+ public static readonly Type[] EmptyTypes = {};
+ public static readonly MemberFilter FilterAttribute = new MemberFilter (FilterAttribute_impl);
+ public static readonly MemberFilter FilterName = new MemberFilter (FilterName_impl);
+ public static readonly MemberFilter FilterNameIgnoreCase = new MemberFilter (FilterNameIgnoreCase_impl);
+ public static readonly object Missing;
+
+ private const BindingFlags DefaultBindingFlags =
+ BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
+
+ /* implementation of the delegates for MemberFilter */
+ static bool FilterName_impl (MemberInfo m, object filterCriteria)
+ {
+ string name = (string) filterCriteria;
+ return name.Equals (m.Name);
+ }
+
+ static bool FilterNameIgnoreCase_impl (MemberInfo m, object filterCriteria)
+ {
+ string name = (string) filterCriteria;
+ return String.Compare (name, m.Name, true) == 0;
+ }
+
+ [MonoTODO]
+ static bool FilterAttribute_impl (MemberInfo m, object filterCriteria)
+ {
+ throw new NotImplementedException ("FilterAttribute_impl");
+ }
+
+ protected Type ()
+ {
+ }
+
+ /// <summary>
+ /// The assembly where the type is defined.
+ /// </summary>
+ public abstract Assembly Assembly {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the fully qualified name for the type including the
+ /// assembly name where the type is defined.
+ /// </summary>
+ public abstract string AssemblyQualifiedName {
+ get;
+ }
+
+ /// <summary>
+ /// Returns the Attributes associated with the type.
+ /// </summary>
+ public TypeAttributes Attributes {
+ get {
+ return GetAttributeFlagsImpl ();
+ }
+ }
+
+ /// <summary>
+ /// Returns the basetype for this type
+ /// </summary>
+ public abstract Type BaseType {
+ get;
+ }
+
+ /// <summary>
+ /// Returns the class that declares the member.
+ /// </summary>
+ public override Type DeclaringType {
+ get {
+ return null;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public static Binder DefaultBinder {
+ get {
+ return Binder.DefaultBinder;
+ }
+ }
+
+ /// <summary>
+ /// The full name of the type including its namespace
+ /// </summary>
+ public abstract string FullName {
+ get;
+ }
+
+ public abstract Guid GUID {
+ get;
+ }
+
+ public bool HasElementType {
+ get {
+ return HasElementTypeImpl ();
+ }
+ }
+
+ public bool IsAbstract {
+ get {
+ return (Attributes & TypeAttributes.Abstract) != 0;
+ }
+ }
+
+ public bool IsAnsiClass {
+ get {
+ return (Attributes & TypeAttributes.StringFormatMask)
+ == TypeAttributes.AnsiClass;
+ }
+ }
+
+ public bool IsArray {
+ get {
+ return IsArrayImpl ();
+ }
+ }
+
+ public bool IsAutoClass {
+ get {
+ return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass;
+ }
+ }
+
+ public bool IsAutoLayout {
+ get {
+ return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout;
+ }
+ }
+
+ public bool IsByRef {
+ get {
+ return IsByRefImpl ();
+ }
+ }
+
+ public bool IsClass {
+ get {
+ if (this == typeof (System.Enum) || this == typeof (System.ValueType))
+ return true;
+ if (IsInterface)
+ return false;
+ return !type_is_subtype_of (this, typeof (System.ValueType), false);
+ }
+ }
+
+ public bool IsCOMObject {
+ get {
+ return IsCOMObjectImpl ();
+ }
+ }
+
+ public bool IsContextful {
+ get {
+ return IsContextfulImpl ();
+ }
+ }
+
+ public bool IsEnum {
+ get {
+ return type_is_subtype_of (this, typeof (System.Enum), false) &&
+ this != typeof (System.Enum);
+ }
+ }
+
+ public bool IsExplicitLayout {
+ get {
+ return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout;
+ }
+ }
+
+ public bool IsImport {
+ get {
+ return (Attributes & TypeAttributes.Import) != 0;
+ }
+ }
+
+ public bool IsInterface {
+ get {
+ return (Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface;
+ }
+ }
+
+ public bool IsLayoutSequential {
+ get {
+ return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout;
+ }
+ }
+
+ public bool IsMarshalByRef {
+ get {
+ return IsMarshalByRefImpl ();
+ }
+ }
+
+ public bool IsNestedAssembly {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly;
+ }
+ }
+
+ public bool IsNestedFamANDAssem {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem;
+ }
+ }
+
+ public bool IsNestedFamily {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily;
+ }
+ }
+
+ public bool IsNestedFamORAssem {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem;
+ }
+ }
+
+ public bool IsNestedPrivate {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate;
+ }
+ }
+
+ public bool IsNestedPublic {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic;
+ }
+ }
+
+ public bool IsNotPublic {
+ get {
+ return !IsPublic;
+ }
+ }
+
+ public bool IsPointer {
+ get {
+ return IsPointerImpl ();
+ }
+ }
+
+ public bool IsPrimitive {
+ get {
+ return IsPrimitiveImpl ();
+ }
+ }
+
+ public bool IsPublic {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public;
+ }
+ }
+
+ public bool IsSealed {
+ get {
+ return (Attributes & TypeAttributes.Sealed) != 0;
+ }
+ }
+
+ public bool IsSerializable {
+ get {
+ // Enums and delegates are always serializable
+ return (Attributes & TypeAttributes.Serializable) != 0 || IsEnum ||
+ type_is_subtype_of (this, typeof (System.Delegate), false);
+ }
+ }
+
+ public bool IsSpecialName {
+ get {
+ return (Attributes & TypeAttributes.SpecialName) != 0;
+ }
+ }
+
+ public bool IsUnicodeClass {
+ get {
+ return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass;
+ }
+ }
+
+ public bool IsValueType {
+ get {
+ return IsValueTypeImpl ();
+ }
+ }
+
+ public override MemberTypes MemberType {
+ get {return MemberTypes.TypeInfo;}
+ }
+
+ public abstract Module Module {get;}
+
+ public abstract string Namespace {get;}
+
+ public override Type ReflectedType {
+ get {
+ return null;
+ }
+ }
+
+ public abstract RuntimeTypeHandle TypeHandle {get;}
+
+ public ConstructorInfo TypeInitializer {
+ get {
+ return GetConstructorImpl (
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static,
+ null,
+ CallingConventions.Any,
+ EmptyTypes,
+ null);
+ }
+ }
+
+ public abstract Type UnderlyingSystemType {get;}
+
+ public override bool Equals (object o)
+ {
+ if (o == null)
+ return false;
+
+ // TODO: return UnderlyingSystemType == o.UnderlyingSystemType;
+ Type cmp = o as Type;
+ if (cmp == null)
+ return false;
+ return Equals (cmp);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern bool Equals (Type type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type internal_from_handle (RuntimeTypeHandle handle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type internal_from_name (string name, bool throwOnError, bool ignoreCase);
+
+ public static Type GetType(string typeName)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+
+ return internal_from_name (typeName, false, false);
+ }
+
+ public static Type GetType(string typeName, bool throwOnError)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+
+ Type type = internal_from_name (typeName, throwOnError, false);
+ if (throwOnError && type == null)
+ throw new TypeLoadException ("Error loading '" + typeName + "'");
+
+ return type;
+ }
+
+ public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+
+ Type t = internal_from_name (typeName, throwOnError, ignoreCase);
+ if (throwOnError && t == null)
+ throw new TypeLoadException ("Error loading '" + typeName + "'");
+
+ return t;
+ }
+
+ public static Type[] GetTypeArray (object[] args) {
+ if (args == null)
+ throw new ArgumentNullException ("args");
+
+ Type[] ret;
+ ret = new Type [args.Length];
+ for (int i = 0; i < args.Length; ++i)
+ ret [i] = args[i].GetType ();
+ return ret;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static TypeCode GetTypeCode (Type type);
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid, bool throwOnError)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid, string server)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid, string server, bool throwOnError)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Type GetTypeFromHandle (RuntimeTypeHandle handle)
+ {
+ return internal_from_handle (handle);
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID, bool throwOnError)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID, string server)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID, string server, bool throwOnError)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static RuntimeTypeHandle GetTypeHandle (object o)
+ {
+ return o.GetType().TypeHandle;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern bool type_is_subtype_of (Type a, Type b, bool check_interfaces);
+
+ public virtual bool IsSubclassOf (Type c)
+ {
+ if (c == null)
+ return false;
+
+ return (this != c) && type_is_subtype_of (this, c, false);
+ }
+
+ public virtual Type[] FindInterfaces (TypeFilter filter, object filterCriteria)
+ {
+ if (filter == null)
+ throw new ArgumentNullException ("filter");
+
+ ArrayList ifaces = new ArrayList ();
+ foreach (Type iface in GetInterfaces ()) {
+ if (filter (iface, filterCriteria))
+ ifaces.Add (iface);
+ }
+
+ return (Type []) ifaces.ToArray (typeof (Type));
+ }
+
+ public Type GetInterface (string name) {
+ return GetInterface (name, false);
+ }
+
+ public abstract Type GetInterface (string name, bool ignoreCase);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void GetInterfaceMapData (Type t, Type iface, out MethodInfo[] targets, out MethodInfo[] methods);
+
+ public virtual InterfaceMapping GetInterfaceMap (Type interfaceType) {
+ InterfaceMapping res;
+ if (interfaceType == null)
+ throw new ArgumentNullException ("interfaceType");
+ if (!interfaceType.IsInterface)
+ throw new ArgumentException ("type argument must be an interface", "interfaceType");
+ res.TargetType = this;
+ res.InterfaceType = interfaceType;
+ GetInterfaceMapData (this, interfaceType, out res.TargetMethods, out res.InterfaceMethods);
+ if (res.TargetMethods == null)
+ throw new ArgumentException ("interface not found", "interfaceType");
+
+ return res;
+ }
+
+ public abstract Type[] GetInterfaces ();
+
+ public virtual bool IsAssignableFrom (Type c)
+ {
+ if (c == null)
+ return false;
+
+ if (Equals (c))
+ return true;
+
+ if (type_is_subtype_of (c, this, true))
+ return true;
+
+ if (!IsInterface)
+ return false;
+
+ Type [] ifaces = c.GetInterfaces ();
+ return (Array.IndexOf (ifaces, this) != -1);
+ }
+
+ public virtual bool IsInstanceOfType (object o) {
+ if (o != null) {
+ return o.GetType().IsSubclassOf (this);
+ }
+ return false;
+ }
+
+ public virtual int GetArrayRank ()
+ {
+ throw new NotSupportedException (); // according to MSDN
+ }
+
+ public abstract Type GetElementType ();
+
+ public EventInfo GetEvent (string name)
+ {
+ return GetEvent (name, DefaultBindingFlags);
+ }
+
+ public abstract EventInfo GetEvent (string name, BindingFlags bindingAttr);
+
+ public virtual EventInfo[] GetEvents ()
+ {
+ return GetEvents (DefaultBindingFlags);
+ }
+
+ public abstract EventInfo[] GetEvents (BindingFlags bindingAttr);
+
+ public FieldInfo GetField( string name)
+ {
+ return GetField (name, DefaultBindingFlags);
+ }
+
+ public abstract FieldInfo GetField( string name, BindingFlags bindingAttr);
+
+ public FieldInfo[] GetFields ()
+ {
+ return GetFields (DefaultBindingFlags);
+ }
+
+ public abstract FieldInfo[] GetFields (BindingFlags bindingAttr);
+
+ public override int GetHashCode()
+ {
+ return (int)_impl.Value;
+ }
+
+ public MemberInfo[] GetMember( string name)
+ {
+ return GetMember (name, DefaultBindingFlags);
+ }
+
+ public virtual MemberInfo[] GetMember( string name, BindingFlags bindingAttr)
+ {
+ return GetMember (name, MemberTypes.All, bindingAttr);
+ }
+
+ public virtual MemberInfo[] GetMember (string name, MemberTypes type,
+ BindingFlags bindingAttr)
+ {
+ return FindMembers (type, bindingAttr, FilterName, name);
+ }
+
+ public MemberInfo[] GetMembers()
+ {
+ return GetMembers (DefaultBindingFlags);
+ }
+
+ public abstract MemberInfo[] GetMembers (BindingFlags bindingAttr);
+
+ public MethodInfo GetMethod (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetMethodImpl (name, DefaultBindingFlags, null, CallingConventions.Any, null, null);
+ }
+
+ public MethodInfo GetMethod (string name, BindingFlags bindingAttr)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ return GetMethodImpl (name, bindingAttr, null, CallingConventions.Any, null, null);
+ }
+
+ public MethodInfo GetMethod (string name, Type[] types)
+ {
+ return GetMethod (name, DefaultBindingFlags, null, CallingConventions.Any, types, null);
+ }
+
+ public MethodInfo GetMethod( string name, Type[] types, ParameterModifier[] modifiers)
+ {
+ return GetMethod (name, DefaultBindingFlags, null,
+ CallingConventions.Any, types, modifiers);
+ }
+
+ public MethodInfo GetMethod (string name, BindingFlags bindingAttr, Binder binder,
+ Type[] types, ParameterModifier[] modifiers)
+ {
+
+ return GetMethod (name, bindingAttr, binder,
+ CallingConventions.Any, types, modifiers);
+ }
+
+ public MethodInfo GetMethod (string name, BindingFlags bindingAttr,
+ Binder binder, CallingConventions callConvention,
+ Type[] types, ParameterModifier[] modifiers)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (types == null)
+ throw new ArgumentNullException ("types");
+
+ return GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ protected abstract MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr,
+ Binder binder,
+ CallingConventions callConvention,
+ Type[] types, ParameterModifier[] modifiers);
+
+ public MethodInfo[] GetMethods ()
+ {
+ return GetMethods (DefaultBindingFlags);
+ }
+
+ public abstract MethodInfo[] GetMethods (BindingFlags bindingAttr);
+
+ public Type GetNestedType (string name)
+ {
+ return GetNestedType (name, DefaultBindingFlags);
+ }
+
+ public abstract Type GetNestedType (string name, BindingFlags bindingAttr);
+
+ public Type[] GetNestedTypes ()
+ {
+ return GetNestedTypes (DefaultBindingFlags);
+ }
+
+ public abstract Type[] GetNestedTypes (BindingFlags bindingAttr);
+
+
+ public PropertyInfo[] GetProperties ()
+ {
+ return GetProperties (DefaultBindingFlags);
+ }
+
+ public abstract PropertyInfo[] GetProperties (BindingFlags bindingAttr);
+
+
+ public PropertyInfo GetProperty (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ return GetPropertyImpl (name, DefaultBindingFlags, null, null, new Type[0], null);
+ }
+
+ public PropertyInfo GetProperty (string name, BindingFlags bindingAttr)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetPropertyImpl (name, bindingAttr, null, null, new Type[0], null);
+ }
+
+ public PropertyInfo GetProperty (string name, Type returnType)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetPropertyImpl (name, DefaultBindingFlags, null, returnType, new Type[0], null);
+ }
+
+ public PropertyInfo GetProperty (string name, Type[] types)
+ {
+ return GetProperty (name, DefaultBindingFlags, null, null, types, null);
+ }
+
+ public PropertyInfo GetProperty (string name, Type returnType, Type[] types)
+ {
+ return GetProperty (name, DefaultBindingFlags, null, returnType, types, null);
+ }
+
+ public PropertyInfo GetProperty( string name, Type returnType, Type[] types,
+ ParameterModifier[] modifiers)
+ {
+ return GetProperty (name, DefaultBindingFlags, null, returnType, types, modifiers);
+ }
+
+ public PropertyInfo GetProperty (string name, BindingFlags bindingAttr,
+ Binder binder, Type returnType,
+ Type[] types, ParameterModifier[] modifiers)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (types == null)
+ throw new ArgumentNullException ("types");
+
+ return GetPropertyImpl (name, bindingAttr, binder, returnType, types, modifiers);
+ }
+
+ protected abstract PropertyInfo GetPropertyImpl (string name,
+ BindingFlags bindingAttr,
+ Binder binder, Type returnType,
+ Type[] types,
+ ParameterModifier[] modifiers);
+
+ protected abstract ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
+ Binder binder,
+ CallingConventions callConvention,
+ Type[] types,
+ ParameterModifier[] modifiers);
+
+ protected abstract TypeAttributes GetAttributeFlagsImpl ();
+ protected abstract bool HasElementTypeImpl ();
+ protected abstract bool IsArrayImpl ();
+ protected abstract bool IsByRefImpl ();
+ protected abstract bool IsCOMObjectImpl ();
+ protected abstract bool IsPointerImpl ();
+ protected abstract bool IsPrimitiveImpl ();
+
+ protected virtual bool IsValueTypeImpl ()
+ {
+ if (this == typeof (Enum) || this == typeof (ValueType))
+ return false;
+
+ return IsSubclassOf (typeof (ValueType));
+ }
+
+ protected virtual bool IsContextfulImpl ()
+ {
+ return typeof (ContextBoundObject).IsAssignableFrom (this);
+ }
+
+ protected virtual bool IsMarshalByRefImpl ()
+ {
+ return typeof (MarshalByRefObject).IsAssignableFrom (this);
+ }
+
+ public ConstructorInfo GetConstructor (Type[] types)
+ {
+ return GetConstructorImpl (
+ DefaultBindingFlags, null, CallingConventions.Any, types, null);
+ }
+
+ public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder,
+ Type[] types, ParameterModifier[] modifiers)
+ {
+ return GetConstructorImpl (
+ bindingAttr, binder, CallingConventions.Any, types, modifiers);
+ }
+
+ public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder,
+ CallingConventions callConvention,
+ Type[] types, ParameterModifier[] modifiers)
+ {
+ if (types == null)
+ throw new ArgumentNullException ("types");
+
+ return GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ public ConstructorInfo[] GetConstructors ()
+ {
+ return GetConstructors (BindingFlags.Public | BindingFlags.Instance);
+ }
+
+ public abstract ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
+
+ public virtual MemberInfo[] GetDefaultMembers ()
+ {
+ object [] att = GetCustomAttributes (typeof (DefaultMemberAttribute), true);
+ if (att.Length == 0)
+ return new MemberInfo [0];
+
+ MemberInfo [] member = GetMember (((DefaultMemberAttribute) att [0]).MemberName);
+ return (member != null) ? member : new MemberInfo [0];
+ }
+
+ public virtual MemberInfo[] FindMembers (MemberTypes memberType, BindingFlags bindingAttr,
+ MemberFilter filter, object filterCriteria)
+ {
+ MemberInfo[] result;
+ ArrayList l = new ArrayList ();
+
+ // Console.WriteLine ("FindMembers for {0} (Type: {1}): {2}",
+ // this.FullName, this.GetType().FullName, this.obj_address());
+
+ if ((memberType & MemberTypes.Constructor) != 0) {
+ ConstructorInfo[] c = GetConstructors (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Event) != 0) {
+ EventInfo[] c = GetEvents (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Field) != 0) {
+ FieldInfo[] c = GetFields (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Method) != 0) {
+ MethodInfo[] c = GetMethods (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Property) != 0) {
+ PropertyInfo[] c;
+ int count = l.Count;
+ Type ptype;
+ if (filter != null) {
+ ptype = this;
+ while ((l.Count == count) && (ptype != null)) {
+ c = ptype.GetProperties (bindingAttr);
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ ptype = ptype.BaseType;
+ }
+ } else {
+ c = GetProperties (bindingAttr);
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.NestedType) != 0) {
+ Type[] c = GetNestedTypes (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria)) {
+ l.Add (m);
+ }
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ result = new MemberInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ public object InvokeMember (string name, BindingFlags invokeAttr, Binder binder,
+ object target, object[] args)
+ {
+ return InvokeMember (name, invokeAttr, binder, target, args, null, null, null);
+ }
+
+ public object InvokeMember (string name, BindingFlags invokeAttr, Binder binder,
+ object target, object[] args, CultureInfo culture)
+ {
+ return InvokeMember (name, invokeAttr, binder, target, args, null, culture, null);
+ }
+
+ public abstract object InvokeMember (string name, BindingFlags invokeAttr,
+ Binder binder, object target, object[] args,
+ ParameterModifier[] modifiers,
+ CultureInfo culture, string[] namedParameters);
+
+ public override string ToString()
+ {
+ return FullName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TypeCode.cs b/mcs/class/corlib/System/TypeCode.cs
new file mode 100644
index 00000000000..e2ef3f4a746
--- /dev/null
+++ b/mcs/class/corlib/System/TypeCode.cs
@@ -0,0 +1,93 @@
+// TypeCode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:34:09 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum TypeCode {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Object = 1,
+
+ /// <summary>
+ /// </summary>
+ DBNull = 2,
+
+ /// <summary>
+ /// </summary>
+ Boolean = 3,
+
+ /// <summary>
+ /// </summary>
+ Char = 4,
+
+ /// <summary>
+ /// </summary>
+ SByte = 5,
+
+ /// <summary>
+ /// </summary>
+ Byte = 6,
+
+ /// <summary>
+ /// </summary>
+ Int16 = 7,
+
+ /// <summary>
+ /// </summary>
+ UInt16 = 8,
+
+ /// <summary>
+ /// </summary>
+ Int32 = 9,
+
+ /// <summary>
+ /// </summary>
+ UInt32 = 10,
+
+ /// <summary>
+ /// </summary>
+ Int64 = 11,
+
+ /// <summary>
+ /// </summary>
+ UInt64 = 12,
+
+ /// <summary>
+ /// </summary>
+ Single = 13,
+
+ /// <summary>
+ /// </summary>
+ Double = 14,
+
+ /// <summary>
+ /// </summary>
+ Decimal = 15,
+
+ /// <summary>
+ /// </summary>
+ DateTime = 16,
+
+ /// <summary>
+ /// </summary>
+ String = 18,
+ } // TypeCode
+
+} // System
diff --git a/mcs/class/corlib/System/TypeInitializationException.cs b/mcs/class/corlib/System/TypeInitializationException.cs
new file mode 100644
index 00000000000..cae537d64b5
--- /dev/null
+++ b/mcs/class/corlib/System/TypeInitializationException.cs
@@ -0,0 +1,40 @@
+//
+// System.TypeInitializationException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+namespace System {
+
+ [Serializable]
+ public sealed class TypeInitializationException : SystemException {
+ string type_name;
+
+ // Constructors
+ public TypeInitializationException (string type_name, Exception inner)
+ : base (Locale.GetText ("An exception was thrown by the type initializer for ") + type_name, inner)
+ {
+ this.type_name = type_name;
+ }
+
+ // Properties
+ public string TypeName {
+ get {
+ return type_name;
+ }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("TypeName", type_name);
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System/TypeLoadException.cs b/mcs/class/corlib/System/TypeLoadException.cs
new file mode 100644
index 00000000000..91458786b3a
--- /dev/null
+++ b/mcs/class/corlib/System/TypeLoadException.cs
@@ -0,0 +1,73 @@
+//
+// System.TypeLoadException
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class TypeLoadException : SystemException {
+
+ // Fields
+ private string msg;
+ private string type;
+
+ // Constructors
+ public TypeLoadException ()
+ : base (Locale.GetText ("A type load exception has occurred."))
+ {
+ msg = Locale.GetText ("A type load exception has occured.");
+ }
+
+ public TypeLoadException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ public TypeLoadException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ }
+
+ protected TypeLoadException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return msg; }
+ }
+
+ public string TypeName
+ {
+ get { return type; }
+ }
+
+ // Methods
+ //
+ // It seems like this object serializes more fields than those described.
+ // Those fields are TypeLoadClassName, TypeLoadAssemblyName,
+ // TypeLoadMessageArg and TypeLoadResourceID.
+ //
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info is null.");
+ base.GetObjectData (info, context);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TypeUnloadedException.cs b/mcs/class/corlib/System/TypeUnloadedException.cs
new file mode 100644
index 00000000000..10929e3fe68
--- /dev/null
+++ b/mcs/class/corlib/System/TypeUnloadedException.cs
@@ -0,0 +1,43 @@
+//
+// System.TypeUnloadedException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class TypeUnloadedException : SystemException
+ {
+ // Constructors
+ public TypeUnloadedException ()
+ : base (Locale.GetText ("Cannot access an unloaded class."))
+ {
+ }
+
+ public TypeUnloadedException (string message)
+ : base (message)
+ {
+ }
+
+ protected TypeUnloadedException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public TypeUnloadedException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System/TypedReference.cs b/mcs/class/corlib/System/TypedReference.cs
new file mode 100755
index 00000000000..141adb4a28f
--- /dev/null
+++ b/mcs/class/corlib/System/TypedReference.cs
@@ -0,0 +1,71 @@
+//
+// System.TypedReference.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+
+namespace System
+{
+ [CLSCompliant(false)]
+ public struct TypedReference
+ {
+ public override bool Equals(object o)
+ {
+ throw new NotSupportedException("This operation is not supported for this type");
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static Type GetTargetType(TypedReference value)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static TypedReference MakeTypedReference(object target, FieldInfo[] flds)
+ {
+ if(target==null) {
+ throw new ArgumentNullException("target is null");
+ }
+ if(flds==null) {
+ throw new ArgumentNullException("flds is null");
+ }
+ if(flds.Length==0) {
+ throw new ArgumentException("flds has no elements");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static void SetTypedReference(TypedReference target,
+ object value)
+ {
+ if(value==null) {
+ throw new ArgumentNullException("value is null");
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RuntimeTypeHandle TargetTypeToken(TypedReference value)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object ToObject(TypedReference value)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UInt16.cs b/mcs/class/corlib/System/UInt16.cs
new file mode 100644
index 00000000000..65db382f86e
--- /dev/null
+++ b/mcs/class/corlib/System/UInt16.cs
@@ -0,0 +1,241 @@
+//
+// System.UInt16.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct UInt16 : IComparable, IFormattable, IConvertible {
+
+ public const ushort MaxValue = 0xffff;
+ public const ushort MinValue = 0;
+
+ internal ushort value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if(!(v is System.UInt16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt16"));
+
+ return value - ((ushort) v);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.UInt16))
+ return false;
+
+ return ((ushort) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s)
+ {
+ ushort val = 0;
+ int len;
+ int i;
+ bool digits_seen = false;
+ bool has_negative_sign = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ if (s [i] == '+')
+ i++;
+ else
+ if (s[i] == '-'){
+ i++;
+ has_negative_sign = true;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ ushort d = (ushort) (c - '0');
+
+ val = checked ((ushort) (val * 10 + d));
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ if (has_negative_sign)
+ throw new OverflowException ();
+
+ return val;
+
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ uint tmpResult = UInt32.Parse (s, style, fp);
+ if (tmpResult > UInt16.MaxValue || tmpResult < UInt16.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (ushort) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt16;
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UInt32.cs b/mcs/class/corlib/System/UInt32.cs
new file mode 100644
index 00000000000..aa409a92880
--- /dev/null
+++ b/mcs/class/corlib/System/UInt32.cs
@@ -0,0 +1,429 @@
+//
+// System.UInt32.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct UInt32 : IComparable, IFormattable, IConvertible {
+
+ public const uint MaxValue = 0xffffffff;
+ public const uint MinValue = 0;
+
+ internal uint value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.UInt32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt32"));
+
+ if (value == (uint) v)
+ return 0;
+
+ if (value < (uint) v)
+ return -1;
+
+ return 1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.UInt32))
+ return false;
+
+ return ((uint) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s)
+ {
+ uint val = 0;
+ int len;
+ int i;
+ bool digits_seen = false;
+ bool has_negative_sign = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ if (s [i] == '+')
+ i++;
+ else
+ if (s[i] == '-'){
+ i++;
+ has_negative_sign = true;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ uint d = (uint) (c - '0');
+
+ val = checked (val * 10 + d);
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ if (has_negative_sign)
+ throw new OverflowException ();
+
+ return val;
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ Int32.CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ Int32.FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ Int32.FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ Int32.FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ uint number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ uint digitValue;
+ char hexDigit;
+
+ // Number stuff
+ // Just the same as Int32, but this one adds instead of substract
+ do {
+
+ if (!Int32.ValidDigit (s [pos], AllowHexSpecifier)) {
+ if (AllowThousands &&
+ Int32.FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ Int32.FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (uint) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (uint) (hexDigit - 'a' + 10);
+ else
+ digitValue = (uint) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 + digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ number = checked (
+ number * 10 +
+ (uint) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ Int32.FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ Int32. FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ Int32.FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = Int32.JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = Int32.JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length && s [pos] != '\u0000')
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (negative)
+ throw new OverflowException ( "Value too large or too small.");
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt32;
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UInt64.cs b/mcs/class/corlib/System/UInt64.cs
new file mode 100644
index 00000000000..5f9ca517553
--- /dev/null
+++ b/mcs/class/corlib/System/UInt64.cs
@@ -0,0 +1,359 @@
+//
+// System.UInt64.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct UInt64 : IComparable, IFormattable, IConvertible {
+ public const ulong MaxValue = 0xffffffffffffffff;
+ public const ulong MinValue = 0;
+
+ internal ulong value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.UInt64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt64"));
+
+ if (value == (ulong) v)
+ return 0;
+
+ if (value < (ulong) v)
+ return -1;
+
+ return 1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.UInt64))
+ return false;
+
+ return ((ulong) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s)
+ {
+ return Parse (s, NumberStyles.Integer, null);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ Int32.CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ Int32.FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ Int32.FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ Int32.FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ ulong number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ ulong digitValue;
+ char hexDigit;
+
+ // Number stuff
+ // Just the same as Int32, but this one adds instead of substract
+ do {
+
+ if (!Int32.ValidDigit (s [pos], AllowHexSpecifier)) {
+ if (AllowThousands &&
+ Int32.FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ Int32.FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (ulong) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (ulong) (hexDigit - 'a' + 10);
+ else
+ digitValue = (ulong) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 + digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ number = checked (
+ number * 10 +
+ (ulong) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ Int32.FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ Int32.FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ Int32.FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = Int32.JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ Int32.FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = Int32.JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = Int32.JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length && s [pos] != '\u0000')
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (negative)
+ throw new OverflowException ( "Value too large or too small.");
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt64;
+ }
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return value;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UIntPtr.cs b/mcs/class/corlib/System/UIntPtr.cs
new file mode 100644
index 00000000000..1146f1da2bf
--- /dev/null
+++ b/mcs/class/corlib/System/UIntPtr.cs
@@ -0,0 +1,177 @@
+//------------------------------------------------------------------------------
+//
+// System.UIntPtr.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Thu 07/31/2001
+//
+// Remarks: Requires '/unsafe' compiler option. This class uses void*,
+// ulong, and uint in overloaded constructors, conversion, and
+// cast members in the public interface. Using pointers is not
+// valid CLS and the methods in question have been marked with
+// the CLSCompliant attribute that avoid compiler warnings.
+//
+//------------------------------------------------------------------------------
+
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+
+
+namespace System
+{
+
+[CLSCompliant(false)]
+[Serializable]
+public unsafe struct UIntPtr : ISerializable
+{
+ public static readonly UIntPtr Zero = new UIntPtr(0u);
+ private void* _pointer;
+
+ [
+ CLSCompliant(false)
+ ]
+ public UIntPtr(ulong value)
+ {
+ _pointer = (void*) value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public UIntPtr(uint value)
+ {
+ _pointer = (void*)value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe UIntPtr(void* value)
+ {
+ _pointer = value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if( obj is UIntPtr )
+ {
+ UIntPtr obj2 = (UIntPtr)obj;
+ return this._pointer == obj2._pointer;
+ }
+
+ return false;
+ }
+ public override int GetHashCode()
+ {
+ return (int)_pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public uint ToUInt32()
+ {
+ return (uint) _pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public ulong ToUInt64()
+ {
+ return (ulong) _pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe void* ToPointer()
+ {
+ return _pointer;
+ }
+ public override string ToString()
+ {
+ return ((uint) _pointer).ToString();
+ }
+
+ // Interface ISerializable
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if( info == null )
+ throw new ArgumentNullException( "info" );
+ // if( context == null ) -- context is struct can't be null.
+ // throw new ArgumentNullException( "context" );
+
+ info.AddValue("pointer", (ulong)_pointer);
+ }
+
+ public static bool operator ==(UIntPtr value1, UIntPtr value2)
+ {
+ return value1._pointer == value2._pointer;
+ }
+ public static bool operator !=(UIntPtr value1, UIntPtr value2)
+ {
+ return value1._pointer != value2._pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator ulong(UIntPtr value)
+ {
+ return (ulong)value._pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator uint(UIntPtr value)
+ {
+ return (uint)value._pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator UIntPtr(ulong value)
+ {
+ return new UIntPtr(value);
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe static explicit operator UIntPtr(void* value)
+ {
+ return new UIntPtr(value);
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe static explicit operator void*(UIntPtr value)
+ {
+ return value.ToPointer();
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator UIntPtr(uint value)
+ {
+ return new UIntPtr(value);
+ }
+
+ public static int Size
+ {
+ get
+ {
+ return sizeof(void*);
+ }
+ }
+}
+
+} // Namespace
+
diff --git a/mcs/class/corlib/System/UnauthorizedAccessException.cs b/mcs/class/corlib/System/UnauthorizedAccessException.cs
new file mode 100755
index 00000000000..6059045f76b
--- /dev/null
+++ b/mcs/class/corlib/System/UnauthorizedAccessException.cs
@@ -0,0 +1,39 @@
+//
+// System.UnauthorizedAccessException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class UnauthorizedAccessException : SystemException {
+ // Constructors
+ public UnauthorizedAccessException ()
+ : base (Locale.GetText ("Access to the requested resource is not authorized"))
+ {
+ }
+
+ public UnauthorizedAccessException (string message)
+ : base (message)
+ {
+ }
+
+ public UnauthorizedAccessException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected UnauthorizedAccessException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UnhandledExceptionEventArgs.cs b/mcs/class/corlib/System/UnhandledExceptionEventArgs.cs
new file mode 100755
index 00000000000..81e318eeec4
--- /dev/null
+++ b/mcs/class/corlib/System/UnhandledExceptionEventArgs.cs
@@ -0,0 +1,43 @@
+//
+// System.UnhandledExceptionEventArgs.cs
+//
+// Author:
+// Chris Hynes (chrish@assistedsolutions.com)
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+using System.Reflection;
+
+namespace System
+{
+ [Serializable]
+ public class UnhandledExceptionEventArgs: EventArgs
+ {
+ private object exception;
+ private bool m_isTerminating;
+
+ public UnhandledExceptionEventArgs(object exception, bool isTerminating)
+ {
+ this.exception = exception;
+ this.m_isTerminating = isTerminating;
+ }
+
+ public object ExceptionObject
+ {
+ get
+ {
+ return exception;
+ }
+ }
+
+ public bool IsTerminating
+ {
+ get
+ {
+ return m_isTerminating;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UnhandledExceptionEventHandler.cs b/mcs/class/corlib/System/UnhandledExceptionEventHandler.cs
new file mode 100755
index 00000000000..710af2b4713
--- /dev/null
+++ b/mcs/class/corlib/System/UnhandledExceptionEventHandler.cs
@@ -0,0 +1,10 @@
+// System.UnhandledExceptionEventHandler.cs
+//
+// Paolo Molaro
+//
+// (C) 2002 Ximian, Inc.
+
+namespace System
+{
+ public delegate void UnhandledExceptionEventHandler (object sender, UnhandledExceptionEventArgs args);
+}
diff --git a/mcs/class/corlib/System/UnitySerializationHolder.cs b/mcs/class/corlib/System/UnitySerializationHolder.cs
new file mode 100644
index 00000000000..63840a8e011
--- /dev/null
+++ b/mcs/class/corlib/System/UnitySerializationHolder.cs
@@ -0,0 +1,82 @@
+// UnitySerializationHolder.cs
+//
+// Author:
+// Lluis Sanchez Gual (lsg@ctv.es)
+//
+// (C) 2003 Lluis Sanchez Gual
+
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ internal class UnitySerializationHolder: IObjectReference, ISerializable
+ {
+ string _data;
+ UnityType _unityType;
+ string _assemblyName;
+
+ // FIXME: there must be other types that use UnitySerializationHolder for
+ // serialization, but I don't know yet which ones.
+
+ enum UnityType: byte { DBNull = 2, Type = 4, Assembly = 6 }
+
+ UnitySerializationHolder(SerializationInfo info, StreamingContext ctx)
+ {
+ _data = info.GetString("Data");
+ _unityType = (UnityType) info.GetInt32("UnityType");
+ _assemblyName = info.GetString("AssemblyName");
+ }
+
+ public static void GetTypeData(Type instance, SerializationInfo info, StreamingContext ctx)
+ {
+ info.AddValue ("Data", instance.FullName);
+ info.AddValue ("UnityType", (int) UnityType.Type);
+ info.AddValue ("AssemblyName", instance.Assembly.FullName);
+ info.SetType (typeof (UnitySerializationHolder));
+ }
+
+ public static void GetDBNullData(DBNull instance, SerializationInfo info, StreamingContext ctx)
+ {
+ info.AddValue ("Data", null);
+ info.AddValue ("UnityType", (int) UnityType.DBNull);
+ info.AddValue ("AssemblyName", instance.GetType().Assembly.FullName);
+ info.SetType (typeof (UnitySerializationHolder));
+ }
+
+ public static void GetAssemblyData(Assembly instance, SerializationInfo info, StreamingContext ctx)
+ {
+ info.AddValue ("Data", instance.FullName);
+ info.AddValue ("UnityType", (int) UnityType.Assembly);
+ info.AddValue ("AssemblyName", instance.FullName);
+ info.SetType (typeof (UnitySerializationHolder));
+ }
+
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ // Not needed.
+ throw new NotSupportedException();
+ }
+
+ public object GetRealObject(StreamingContext context)
+ {
+ switch (_unityType)
+ {
+ case UnityType.Type:
+ Assembly assembly = Assembly.Load (_assemblyName);
+ return assembly.GetType (_data);
+
+ case UnityType.DBNull:
+ return DBNull.Value;
+
+ case UnityType.Assembly:
+ return Assembly.Load (_data);
+
+ default:
+ throw new NotSupportedException ("UnitySerializationHolder does not support this type");
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ValueType.cs b/mcs/class/corlib/System/ValueType.cs
new file mode 100644
index 00000000000..733491f38b0
--- /dev/null
+++ b/mcs/class/corlib/System/ValueType.cs
@@ -0,0 +1,48 @@
+//
+// System.ValueType.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public abstract class ValueType {
+
+ // <summary>
+ // ValueType constructor
+ // </summary>
+ protected ValueType ()
+ {
+ }
+
+ // <summary>
+ // True if this instance and o represent the same type
+ // and have the same value.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override bool Equals (object o);
+
+ // <summary>
+ // Gets a hashcode for this value type using the
+ // bits in the structure
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override int GetHashCode ();
+
+ // <summary>
+ // Stringified representation of this ValueType.
+ // Must be overriden for better results, by default
+ // it just returns the Type name.
+ // </summary>
+ public override string ToString ()
+ {
+ return GetType().FullName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Version.cs b/mcs/class/corlib/System/Version.cs
new file mode 100644
index 00000000000..616e7d5d030
--- /dev/null
+++ b/mcs/class/corlib/System/Version.cs
@@ -0,0 +1,277 @@
+//
+// System.Version.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public sealed class Version : ICloneable, IComparable {
+
+ int major, minor, build, revision;
+
+ private const int UNDEFINED = -1;
+
+ private void CheckedSet (int defined, int major, int minor, int build, int revision)
+ {
+ // defined should be 2, 3 or 4
+
+ if (major < 0) {
+ throw new ArgumentOutOfRangeException ("major");
+ }
+ this.major = major;
+
+ if (minor < 0) {
+ throw new ArgumentOutOfRangeException ("minor");
+ }
+ this.minor = minor;
+
+ if (defined == 2) {
+ this.build = UNDEFINED;
+ this.revision = UNDEFINED;
+ return;
+ }
+
+ if (build < 0) {
+ throw new ArgumentOutOfRangeException ("build");
+ }
+ this.build = build;
+
+ if (defined == 3) {
+ this.revision = UNDEFINED;
+ return;
+ }
+
+ if (revision < 0) {
+ throw new ArgumentOutOfRangeException ("revision");
+ }
+ this.revision = revision;
+ }
+
+ public Version ()
+ {
+ CheckedSet (2, 0, 0, -1, -1);
+ }
+
+ public Version (string version)
+ {
+ int n;
+ string [] vals;
+ int major = -1, minor = -1, build = -1, revision = -1;
+
+ if (version == null) {
+ throw new ArgumentNullException ("version");
+ }
+
+ vals = version.Split (new Char [] {'.'});
+ n = vals.Length;
+
+ if (n < 2 || n > 4) {
+ throw new ArgumentException (Locale.GetText ("There must be 2, 3 or 4 components in the version string"));
+ }
+
+ if (n > 0)
+ major = int.Parse (vals [0]);
+ if (n > 1)
+ minor = int.Parse (vals [1]);
+ if (n > 2)
+ build = int.Parse (vals [2]);
+ if (n > 3)
+ revision = int.Parse (vals [3]);
+
+ CheckedSet (n, major, minor, build, revision);
+ }
+
+ public Version (int major, int minor)
+ {
+ CheckedSet (2, major, minor, 0, 0);
+ }
+
+ public Version (int major, int minor, int build)
+ {
+ CheckedSet (3, major, minor, build, 0);
+ }
+
+ public Version (int major, int minor, int build, int revision)
+ {
+ CheckedSet (4, major, minor, build, revision);
+ }
+
+ public int Build {
+ get {
+ return build;
+ }
+ }
+
+ public int Major {
+ get {
+ return major;
+ }
+ }
+
+ public int Minor {
+ get {
+ return minor;
+ }
+ }
+
+ public int Revision {
+ get {
+ return revision;
+ }
+ }
+
+ public object Clone ()
+ {
+ return new Version (major, minor, build, revision);
+ }
+
+ public int CompareTo (object version)
+ {
+ Version v;
+
+ // LAMESPEC: Docs are unclear whether an
+ // ArgumentNullException should be thrown are
+ // that a value > 0 should be returned.
+ if (version == null)
+ return 1;
+ // throw new ArgumentNullException ("version");
+
+ if (! (version is Version))
+ throw new ArgumentException (Locale.GetText ("Argument to Version.CompareTo must be a Version"));
+
+ v = version as Version;
+
+ if (this.major > v.major)
+ return 1;
+ else if (this.major < v.major)
+ return -1;
+
+ if (this.minor > v.minor)
+ return 1;
+ else if (this.minor < v.minor)
+ return -1;
+
+ if (this.build > v.build)
+ return 1;
+ else if (this.build < v.build)
+ return -1;
+
+ if (this.revision > v.revision)
+ return 1;
+ else if (this.revision < v.revision)
+ return -1;
+
+ return 0;
+ }
+
+ public override bool Equals (object obj)
+ {
+ Version x;
+
+ if (obj == null || !(obj is Version))
+ return false;
+
+ x = (Version) obj;
+
+ if ((x.major == major) &&
+ (x.minor == minor) &&
+ (x.build == build) &&
+ (x.revision == revision))
+ return true;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (revision << 24) | (build << 16) | (minor << 8) | major;
+ }
+
+ // <summary>
+ // Returns a stringified representation of the version, format:
+ // major.minor[.build[.revision]]
+ // </summary>
+ public override string ToString ()
+ {
+ string mm = major.ToString () + "." + minor.ToString ();
+
+ if (build != UNDEFINED)
+ mm = mm + "." + build.ToString ();
+ if (revision != UNDEFINED)
+ mm = mm + "." + revision.ToString ();
+
+ return mm;
+ }
+
+ // <summary>
+ // LAME: This API is lame, since there is no way of knowing
+ // how many fields a Version object has, it is unfair to throw
+ // an ArgumentException, but this is what the spec claims.
+ //
+ // ie, Version a = new Version (1, 2); a.ToString (3) should
+ // throw the expcetion.
+ // </summary>
+ public string ToString (int fields)
+ {
+ if (fields == 0)
+ return "";
+ if (fields == 1)
+ return major.ToString ();
+ if (fields == 2)
+ return major.ToString () + "." + minor.ToString ();
+ if (fields == 3){
+ if (build == UNDEFINED)
+ throw new ArgumentException (Locale.GetText ("fields is larger than the number of components defined in this instance"));
+ return major.ToString () + "." + minor.ToString () + "." +
+ build.ToString ();
+ }
+ if (fields == 4){
+ if (build == UNDEFINED || revision == UNDEFINED)
+ throw new ArgumentException (Locale.GetText ("fields is larger than the number of components defined in this instance"));
+ return major.ToString () + "." + minor.ToString () + "." +
+ build.ToString () + "." + revision.ToString ();
+ }
+ throw new ArgumentException (Locale.GetText ("Invalid fields parameter: ") + fields.ToString());
+ }
+
+ public static bool operator== (Version v1, Version v2)
+ {
+ return v1.Equals (v2);
+ }
+
+ public static bool operator!= (Version v1, Version v2)
+ {
+ return !v1.Equals (v2);
+ }
+
+ public static bool operator> (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) > 0;
+ }
+
+ public static bool operator>= (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) >= 0;
+ }
+
+ public static bool operator< (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) < 0;
+ }
+
+ public static bool operator<= (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) <= 0;
+ }
+
+ }
+}
+
+
+
diff --git a/mcs/class/corlib/System/Void.cs b/mcs/class/corlib/System/Void.cs
new file mode 100644
index 00000000000..768d75e7141
--- /dev/null
+++ b/mcs/class/corlib/System/Void.cs
@@ -0,0 +1,15 @@
+//
+// System.Void.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ [Serializable]
+ public struct Void {
+ }
+}
diff --git a/mcs/class/corlib/System/WeakReference.cs b/mcs/class/corlib/System/WeakReference.cs
new file mode 100755
index 00000000000..c689a6e4f26
--- /dev/null
+++ b/mcs/class/corlib/System/WeakReference.cs
@@ -0,0 +1,114 @@
+//
+// System.WeakReference.cs
+//
+// Author:
+// Ajay kumar Dwivedi (adwiv@yahoo.com)
+//
+
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+
+namespace System
+{
+ /// <summary>
+ /// Summary description for WeakReference.
+ /// </summary>
+ [Serializable]
+ public class WeakReference : ISerializable
+ {
+ //Fields
+ private bool isLongReference;
+ private GCHandle gcHandle;
+
+ // Helper method for constructors
+ //Should not be called from any other method.
+ private void AllocateHandle(Object target)
+ {
+ if(this.isLongReference)
+ {
+ this.gcHandle = GCHandle.Alloc(target, GCHandleType.WeakTrackResurrection);
+ }
+ else
+ {
+ this.gcHandle = GCHandle.Alloc(target, GCHandleType.Weak);
+ }
+ }
+
+
+ //Constructors
+ public WeakReference(object target)
+ : this(target,false)
+ {}
+
+
+ public WeakReference(object target, bool trackResurrection)
+ {
+ this.isLongReference = trackResurrection;
+ AllocateHandle(target);
+ }
+
+
+ protected WeakReference(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ this.isLongReference = info.GetBoolean ("TrackResurrection");
+ Object target = info.GetValue ("TrackedObject", typeof (System.Object));
+
+ AllocateHandle(target);
+ }
+
+
+ // Properties
+ public virtual bool IsAlive
+ {
+ get
+ {
+ //Target property takes care of the exception
+ return (Target != null);
+ }
+ }
+
+ public virtual object Target
+ {
+ get
+ {
+ //Exception is thrown by gcHandle's Target
+ return this.gcHandle.Target;
+ }
+ set
+ {
+ this.gcHandle.Target = value;
+ }
+ }
+
+ public virtual bool TrackResurrection
+ {
+ get
+ {
+ return this.isLongReference;
+ }
+ }
+
+ //Methods
+ ~WeakReference()
+ {
+ gcHandle.Free();
+ }
+
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ info.AddValue ("TrackResurrection", TrackResurrection);
+
+ try {
+ info.AddValue ("TrackedObject", Target);
+ } catch(Exception) {
+ info.AddValue("TrackedObject",null);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System/_AppDomain.cs b/mcs/class/corlib/System/_AppDomain.cs
new file mode 100755
index 00000000000..ceeff566375
--- /dev/null
+++ b/mcs/class/corlib/System/_AppDomain.cs
@@ -0,0 +1,161 @@
+//
+// System._AppDomain
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+
+using System.Security;
+using System.Security.Policy;
+using System.Security.Principal;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.Remoting;
+
+namespace System
+{
+
+[CLSCompliant(false)]
+public interface _AppDomain {
+
+ string BaseDirectory {get; }
+ string DynamicDirectory {get; }
+ Evidence Evidence {get; }
+ string FriendlyName {get; }
+ string RelativeSearchPath {get; }
+ bool ShadowCopyFiles {get; }
+
+ void AppendPrivatePath (string path);
+ void ClearPrivatePath ();
+ void ClearShadowCopyPath ();
+
+ ObjectHandle CreateInstance (string assemblyName, string typeName);
+ ObjectHandle CreateInstance (
+ string assemblyName,
+ string typeName,
+ object[] activationAttributes);
+ ObjectHandle CreateInstance (
+ string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttribtutes);
+
+ ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName);
+ ObjectHandle CreateInstanceFrom (
+ string assemblyName, string typeName,
+ object[] activationAttributes);
+ ObjectHandle CreateInstanceFrom (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttribtutes);
+
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access, string dir);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions,
+ bool isSynchronized);
+
+ void DoCallBack (CrossAppDomainDelegate theDelegate);
+ bool Equals (object other);
+
+ int ExecuteAssembly (string assemblyFile);
+ int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity);
+ int ExecuteAssembly (
+ string assemblyFile,
+ Evidence assemblySecurity,
+ string[] args);
+
+ Assembly[] GetAssemblies ();
+ object GetData (string name);
+ int GetHashCode();
+ object GetLifetimeService ();
+ Type GetType ();
+ object InitializeLifetimeService ();
+
+ Assembly Load (AssemblyName assemblyRef);
+ Assembly Load (byte[] rawAssembly);
+ Assembly Load (string assemblyString);
+ Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity);
+ Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore);
+ Assembly Load (string assemblyString, Evidence assemblySecurity);
+ Assembly Load (
+ byte[] rawAssembly,
+ byte[] rawSymbolStore,
+ Evidence securityEvidence);
+
+ void SetAppDomainPolicy (PolicyLevel domainPolicy);
+ void SetCachePath (string s);
+ void SetData (string name, object data);
+ void SetPrincipalPolicy (PrincipalPolicy policy);
+ void SetShadowCopyPath (string s);
+ void SetThreadPrincipal (IPrincipal principal);
+ string ToString ();
+
+ event AssemblyLoadEventHandler AssemblyLoad;
+ event ResolveEventHandler AssemblyResolve;
+ event EventHandler DomainUnload;
+ event EventHandler ProcessExit;
+ event ResolveEventHandler ResourceResolve;
+ event ResolveEventHandler TypeResolve;
+ event UnhandledExceptionEventHandler UnhandledException;
+}
+
+}
diff --git a/mcs/class/corlib/Test/.cvsignore b/mcs/class/corlib/Test/.cvsignore
new file mode 100644
index 00000000000..8128ad24ebb
--- /dev/null
+++ b/mcs/class/corlib/Test/.cvsignore
@@ -0,0 +1,6 @@
+*.dll
+*.pdb
+*.temp
+.makefrag
+.response
+NUnit.Prefs
diff --git a/mcs/class/corlib/Test/AllTests.cs b/mcs/class/corlib/Test/AllTests.cs
new file mode 100644
index 00000000000..928a68748e7
--- /dev/null
+++ b/mcs/class/corlib/Test/AllTests.cs
@@ -0,0 +1,42 @@
+//
+// Mono.Tests.AllTests.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(System.AllTests.Suite);
+ suite.AddTest(System.Collections.AllTests.Suite);
+ suite.AddTest(System.Security.AllTests.Suite);
+ suite.AddTest(System.Security.Cryptography.AllTests.Suite);
+ suite.AddTest(System.IO.AllTests.Suite);
+ suite.AddTest(System.Text.AllTests.Suite);
+ suite.AddTest(System.Security.Permissions.AllTests.Suite);
+ suite.AddTest(System.Resources.AllTests.Suite);
+ suite.AddTest(System.Runtime.Serialization.AllTests.Suite);
+ suite.AddTest(System.Runtime.CompilerServices.AllTests.Suite);
+ suite.AddTest(System.Threading.AllTests.Suite);
+ suite.AddTest(System.Reflection.AllTests.Suite);
+// suite.AddTest(System.Security.Policy.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/ChangeLog b/mcs/class/corlib/Test/ChangeLog
new file mode 100644
index 00000000000..34e994bc230
--- /dev/null
+++ b/mcs/class/corlib/Test/ChangeLog
@@ -0,0 +1,333 @@
+2003-01-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_linux_test.args: added MACTripleDES test file.
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build:
+ * makefile.gnu: build and run tests with nunit2
+
+2002-12-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_linux_test.args: added StrongNamePublicKeyBlob and
+ StrongName test files.
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_linux_test.args: added Publisher and
+ PublisherMembershipCondition test files.
+
+2002-12-08 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added System.Reflection test suite.
+ * corlib_linux_test.args: added System.Reflection test files.
+
+2002-11-09 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+ * corlib_linux_tests.args: added MutexTest.cs in System.Threading
+
+2002-11-23 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * corlib_linux_tests.args: added System.Threading and
+ ThreadTest.cs suites.
+ * AllTests.cs: Added System.Threading suite.
+
+2002-11-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_linux_test.args: added missing crypto test files.
+
+2002-11-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_test.build: removed DSATest from exclusions.
+
+2002-10-28 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
+
+ * AllTests.cs: removed System.Threading.AllTests. It does not exist.
+
+ * corlib_linux_test.args: added missing tests from s.s.c namespace.
+
+ * makefile.gnu: pass MONO_PATH correctly. Not sure if this does
+ anything because mono will load corlib from the installation dir.
+
+ * run_test.sh: NUNIT_MONO_PATH is not used.
+
+2002-10-25 Zoltan Varga <vargaz@freemail.hu>
+
+ * corlib_linux_test.args AllTests.cs: Added beginnings of
+ System.Threading testcases.
+
+ * run_test.sh: fixed paths.
+
+2002-10-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_test.build: Removed all excluded cryptographic test code as
+ the cyclic dependency was removed (well commented)
+
+2002-10-16 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Fix build. Exclude tests that depend on
+ components we are not building into corlib yet.
+
+2002-10-05 Andrew Birkett <andy@nobugs.org>
+
+ * corlib_linux_test.args: Added RC2Test
+
+2002-09-23 Andrew Birkett <andy@nobugs.org>
+
+ * corlib_linux_test.args: Added MD5Test
+
+2002-09-22 Andrew Birkett <andy@nobugs.org>
+
+ * System.Security.Cryptography/RijndaelManagedTest.cs: BlockSize
+ measured in bytes, not bits.
+
+2002-09-19 Andrew Birkett <andy@nobugs.org>
+
+ * System.Security.Cryptography/RijndaelManagedTest.cs: New test
+ * System.Security.Cryptography/AllTests.cs: Added RijndaelManagedTest
+ * corlib_linux_test.args: Added RijndaelManagedTest
+
+2002-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * makefile.gnu: little changes to integrate tests in makefile system.
+ * run_test.sh: script i use to run tests when i don't wanna run all.
+
+2002-08-10 Jason Diamond <jason@injektilo.org>
+
+ * makefile.gnu: Added test target. Please start using it.
+
+2002-07-24 Duncan Mak <duncan@ximian.com>
+
+ * corlib_linux_test.args: Add Cesar's BufferTest to the list.
+
+2002-07-19 Martin Baulig <martin@gnome.org>
+
+ * makefile.gnu: Added makefile for self-hosting compile on GNU/Linux.
+ Don't add this to the top-level makefile.gnu, this must be run after
+ everything is compiled.
+
+2002-07-19 Martin Baulig <martin@gnome.org>
+
+ The test suite now compiles with MCS on GNU/Linux :-)
+
+ * corlib_linux_test.args: Added MCS command file to compile this.
+
+2002-07-11 Nick Drochak <ndrochak@gol.com>
+
+ * .cvsignore: Ignore temp files too.
+
+2002-06-19 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add missing test: System.Runtime.Serialization.
+
+2002-06-01 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Change the order of the builds. Just makes it a
+ bit faster for my testing since I need the linux dll.
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * Added System.Security.Cryptography.FromBase64TransformTest.cs.
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * TheTests.cs: Removed.
+
+ * MartinTests.cs: Removed.
+
+ * corlib_test.build: Don't create Runtest.corlib.exe anymore.
+
+2002/05/07 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Do not run the System.Net tests from here, they belong
+ in the System assembly tests.
+
+2002-04-27 Lawrence Pit <loz@cable.a2000.nl>
+
+ * System.Security/: added directory
+ * AllTests.cs: added Syste,Security suite.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Net/: added directory.
+ * AllTests.cs: added System.Net suite.
+
+2002/04/04 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Again; disable running of NUnit tests against mono
+ corlib. There are so many icalls now, that these tests need
+ to be run inside mint and mono. Will change this soon to run
+ the tests using both. It still runs the tests against the mscorlib
+ to validate the tests themselves.
+
+2002-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * corlib_test.build: don't exclude IntegerFormatterTest.
+
+ * System/AllTests.cs: added IntegerFormatterTest suite.
+
+ * System/IntegerFormatterTest.cs: totally reworked to use NUnit. Right
+ now it fails cause I haven't implemented Parse () methods yet. With
+ corlib_reference.dll runs ok.
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Re-exclude it in a couple of places where it was
+ breaking the build. This test is not an NUnit test. So, it doesn't
+ belong in these dll's until it's made a proper NUnit test.
+
+2002-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * corlib_test.build: remove two more lines that excluded
+ IntegerFormatterTest.
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Don't exclude IntegerFormatterTest any more.
+
+2002-03-20 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: On 'clean' remove all the dll's and pdb's
+
+2002/03/19 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Re-include tests into the build.
+
+2002-03-18 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: build RunTests.corlib.exe with only mono class
+ libs. This tells what we are missing to run the tests.
+
+2002/03/18 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: disable running of NUnit tests against mono
+ corlib. There are so many icalls now, that these tests need
+ to be run inside mint and mono. Will change this soon to run
+ the tests using both. It still runs the tests against the mscorlib
+ to validate the tests themselves.
+
+2002/03/07 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: resolve chicken and egg problem. Only build and
+ execute test assemblies when 'make test' is specified. Need to do a
+ 'make' first now before 'make test'.
+
+2002-03-03 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Turn on debug flag for complier so that...well...
+ debugging is easier.
+
+2002-03-01 Duncan Mak <duncan@ximian.com>
+
+ * System.Runtime.Serialization/ObjectIDGeneratorTests.cs: Added
+ test for System.Runtime.Serialization.ObjectIDGenerator.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * RunTests.cs: Removed. This is now in the nant directory.
+
+ * corlib_test.build: Don't link TheTests.cs into the dlls, renamed
+ RunTests.exe to RunTests.corlib.exe and link it against NUnitBase.dll.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * scan-tests.pl: Moved to ../../../tools/.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: New file. This contains all the tests which already
+ work on Linux.
+
+ * RunTests.cs: A small custom testrunner to run the tests on Linux.
+
+ * scan-tests.pl: Call this perl script with either MartinTests.cs or
+ AllTests.cs as argument and redirect the output the TheTests.cs - it'll
+ create a file which calls all the tests.
+
+ * TheTests.cs: This is automatically generated from scan-tests.pl but
+ needs some manual editing, so it's in CVS.
+
+ * corlib_test.build: In addition to the libraries, create an executable
+ called RunTests.exe which contains all the tests and the custom test
+ runner. You can run this executable on Windows to test things with
+ mscorlib or on Linux using the mono runtime.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * */*.cs: added zero-args constructors for all the test classes.
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * System.Security.Cryptography.RNGCryptoServiceProviderTest.cs:
+ Fixed typo
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * Addded System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
+ * System.Security.Cryptography/AllTests.cs: Added
+ RNGCryptoServiceProviderTest.
+
+2002-02-17 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Added System/GuidTest.cs
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Remove duplicate excludes for
+ * AllTests.cs: Add System.Security.Policy tests. However, commented
+ this out because NUnit is throwing an exception. Need to figure
+ that out first.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: compile with mscorlib to test the tests. This
+ will be our "reference" check to make sure the tests work.
+
+2002-01-25 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add System.Resources.AllTests.Suite
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add System.Security.Permissions.AllTests.Suite
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * .cvsignore: ignore the debug files *.pdb
+
+2002-01-04 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Added System/TimeSpanTest.cs
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added DebugTest to System.Diagnostics tests.
+2001-11-08 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Include test for Queue in the dll
+
+2001-10-15 Martin Weindel <martin.weindel@t-online.de>
+
+ * added System/DecimalTest.cs and System/DecimalTest2.cs
+
+2001-10-11 Jeffrey Stedfast <fejj@ximian.com>
+
+ * System/StringTest.cs: Added.
+
+2001-10-10 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * added directory System.Security.Cryptography
+ * added TestSuite for all Crypto classes
+ * added tests for System.Security.Cryptography.AsymmetricAlgorithm
+ and System.Security.Cryptography.SymmetricAlgorithm
+
+2001-10-02 Martin Weindel <martin.weindel@t-online.de>
+
+ * added directory System
+ * added tests for System.Int64
+
+2001-08-29 Alexander Klyubin <klyubin@aqris.com>
+
+ * Added tests for System.Diagnostics.StackFrame and
+ System.Diagnostics.StackTrace. The tests only run against
+ Microsoft's implementation as StackTrace and StackFrame classes in
+ Mono are not yet properly implemented.
+
+ Note that StackFrameTest runs properly only if compiled with
+ /debug switch.
diff --git a/mcs/class/corlib/Test/System.Collections/AllTests.cs b/mcs/class/corlib/Test/System.Collections/AllTests.cs
new file mode 100644
index 00000000000..70f735c6b7d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/AllTests.cs
@@ -0,0 +1,39 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(ArrayListTest.Suite);
+ suite.AddTest(BitArrayTest.Suite);
+ suite.AddTest(CaseInsensitiveComparerTest.Suite);
+ suite.AddTest(CaseInsensitiveHashCodeProviderTest.Suite);
+ suite.AddTest(CollectionBaseTest.Suite);
+ suite.AddTest(ComparerTest.Suite);
+ suite.AddTest(HashtableTest.Suite);
+ suite.AddTest(QueueTest.Suite);
+ suite.AddTest(ReadOnlyCollectionBaseTest.Suite);
+ suite.AddTest(SortedListTest.Suite);
+ suite.AddTest(StackTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Collections/ArrayListTest.cs b/mcs/class/corlib/Test/System.Collections/ArrayListTest.cs
new file mode 100644
index 00000000000..bf557fcb0d3
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ArrayListTest.cs
@@ -0,0 +1,1557 @@
+// ArrayListTest.cs - NUnit Test Cases for the System.Collections.ArrayList class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+/// <summary>ArrayList test.</summary>
+public class ArrayListTest : TestCase {
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public void TestCtor() {
+ {
+ ArrayList al1 = new ArrayList();
+ AssertNotNull("no basic ArrayList", al1);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null icollection error not thrown",
+ errorThrown);
+ }
+ {
+ // what can I say? I like chars. [--DB]
+ char[] coll = {'a', 'b', 'c', 'd'};
+ ArrayList al1 = new ArrayList(coll);
+ AssertNotNull("no icollection ArrayList", al1);
+ for (int i = 0; i < coll.Length; i++) {
+ AssertEquals(i + " not ctor'ed properly.",
+ coll[i], al1[i]);
+ }
+ }
+ {
+ try {
+ Char[,] c1 = new Char[2,2];
+ ArrayList al1 = new ArrayList(c1);
+ Fail ("Should fail with multi-dimensional array in constructor.");
+ } catch (RankException) {
+ }
+ }
+
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative capacity error not thrown",
+ errorThrown);
+ }
+ }
+
+ public void TestCapacity() {
+ for (int i = 1; i < 100; i++) {
+ ArrayList al1 = new ArrayList(i);
+ AssertEquals("Bad capacity of " + i,
+ i, al1.Capacity);
+ }
+ {
+ ArrayList al1 = new ArrayList(0);
+ // LAMESPEC:
+ // AssertEquals("Bad capacity when set to 0",
+ // 16, al1.Capacity);
+ al1.Add ("?");
+ AssertEquals("Bad capacity when set to 0",
+ 16, al1.Capacity);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("Bad default capacity",
+ 16, al1.Capacity);
+ }
+ }
+
+ public void TestCount() {
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("Bad initial count",
+ 0, al1.Count);
+ for (int i = 1; i <= 100; i++) {
+ al1.Add(i);
+ AssertEquals("Bad count " + i,
+ i, al1.Count);
+ }
+ }
+ for (int i = 0; i < 100; i++) {
+ char[] coll = new Char[i];
+ ArrayList al1 = new ArrayList(coll);
+ AssertEquals("Bad count for " + i,
+ i, al1.Count);
+ }
+ }
+
+ public void TestIsFixed() {
+ ArrayList al1 = new ArrayList();
+ Assert("should not be fixed by default", !al1.IsFixedSize);
+ ArrayList al2 = ArrayList.FixedSize(al1);
+ Assert("fixed-size wrapper not working", al2.IsFixedSize);
+ }
+
+ public void TestIsReadOnly() {
+ ArrayList al1 = new ArrayList();
+ Assert("should not be ReadOnly by default", !al1.IsReadOnly);
+ ArrayList al2 = ArrayList.ReadOnly(al1);
+ Assert("read-only wrapper not working", al2.IsReadOnly);
+ }
+
+ public void TestIsSynchronized() {
+ ArrayList al1 = new ArrayList();
+ Assert("should not be synchronized by default",
+ !al1.IsSynchronized);
+ ArrayList al2 = ArrayList.Synchronized(al1);
+ Assert("synchronized wrapper not working", al2.IsSynchronized);
+ }
+
+ public void TestItem() {
+ ArrayList al1 = new ArrayList();
+ {
+ bool errorThrown = false;
+ try {
+ object o = al1[-1];
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative item error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ object o = al1[1];
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end item error not thrown",
+ errorThrown);
+ }
+ for (int i = 0; i <= 100; i++) {
+ al1.Add(i);
+ }
+ for (int i = 0; i <= 100; i++) {
+ AssertEquals("item not fetched for " + i,
+ i, al1[i]);
+ }
+ }
+
+ public void TestAdapter() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.Adapter(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("null adapter error not thrown",
+ errorThrown);
+ }
+ {
+ char[] list = {'a', 'b', 'c', 'd'};
+ ArrayList al1 = ArrayList.Adapter(list);
+ AssertNotNull("Couldn't get an adapter", al1);
+ for (int i = 0; i < list.Length; i++) {
+ AssertEquals("adapter not adapting", list[i], al1[i]);
+ }
+ list[0] = 'z';
+ for (int i = 0; i < list.Length; i++) {
+ AssertEquals("adapter not adapting", list[i], al1[i]);
+ }
+ }
+ // TODO - test other adapter types?
+ }
+
+ public void TestAdd() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ al1.Add("Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("add to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Add("Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ for (int i = 1; i <= 100; i++) {
+ al1.Add(i);
+ AssertEquals("add failed " + i,
+ i, al1.Count);
+ AssertEquals("add failed " + i,
+ i, al1[i-1]);
+
+ }
+ }
+ {
+ string [] strArray = new string [] {};
+ ArrayList al1 = new ArrayList (strArray);
+ al1.Add ("Hi!");
+ al1.Add ("Hi!");
+ AssertEquals ("add failed", 2, al1.Count);
+ }
+ }
+
+ public void TestAddRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ String[] s1 = {"Hi!"};
+ al1.AddRange(s1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("add to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ String[] s1 = {"Hi!"};
+ al1.AddRange(s1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList();
+ al1.AddRange(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+
+ {
+ ArrayList a1 = new ArrayList();
+ AssertEquals("ArrayList should start empty",
+ 0, a1.Count);
+ char[] coll = {'a', 'b', 'c'};
+ a1.AddRange(coll);
+ AssertEquals("ArrayList has wrong elements",
+ 3, a1.Count);
+ a1.AddRange(coll);
+ AssertEquals("ArrayList has wrong elements",
+ 6, a1.Count);
+ }
+ }
+
+ public void TestBinarySearch() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList();
+ String[] s1 = {"This", "is", "a", "test"};
+ al1.AddRange(s1);
+ al1.BinarySearch(42);
+ } catch (InvalidOperationException) {
+ // this is what .NET throws
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // this is what the docs say it should throw
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("search-for-wrong-type error not thrown",
+ errorThrown);
+ }
+
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ ArrayList al1 = new ArrayList(arr);
+ Assert("couldn't find elem #1",
+ al1.BinarySearch('c') >= 3);
+ Assert("couldn't find elem #2",
+ al1.BinarySearch('c') < 6);
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'd', 'd', 'd', 'e', 'e'};
+ ArrayList al1 = new ArrayList(arr);
+ AssertEquals("couldn't find next-higher elem",
+ -4, al1.BinarySearch('c'));
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ ArrayList al1 = new ArrayList(arr);
+ AssertEquals("couldn't find end",
+ -9, al1.BinarySearch('e'));
+ }
+
+ }
+
+ // TODO - BinarySearch with IComparer
+
+ public void TestClear() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ al1.Clear();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Clear();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ al1.Add('c');
+ AssertEquals("should have one element",
+ 1, al1.Count);
+ al1.Clear();
+ AssertEquals("should be empty",
+ 0, al1.Count);
+ }
+ {
+ int[] i1 = {1,2,3,4};
+ ArrayList al1 = new ArrayList(i1);
+ AssertEquals("should have elements",
+ i1.Length, al1.Count);
+ int capacity = al1.Capacity;
+ al1.Clear();
+ AssertEquals("should be empty again",
+ 0, al1.Count);
+ AssertEquals("capacity shouldn't have changed",
+ capacity, al1.Capacity);
+ }
+ }
+
+ public void TestClone() {
+ {
+ char[] c1 = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(c1);
+ ArrayList al2 = (ArrayList)al1.Clone();
+ AssertEquals("ArrayList match", al1[0], al2[0]);
+ AssertEquals("ArrayList match", al1[1], al2[1]);
+ AssertEquals("ArrayList match", al1[2], al2[2]);
+ }
+ {
+ char[] d10 = {'a', 'b'};
+ char[] d11 = {'a', 'c'};
+ char[] d12 = {'b', 'c'};
+ char[][] d1 = {d10, d11, d12};
+ ArrayList al1 = new ArrayList(d1);
+ ArrayList al2 = (ArrayList)al1.Clone();
+ AssertEquals("Array match", al1[0], al2[0]);
+ AssertEquals("Array match", al1[1], al2[1]);
+ AssertEquals("Array match", al1[2], al2[2]);
+
+ ((char[])al1[0])[0] = 'z';
+ AssertEquals("shallow copy", al1[0], al2[0]);
+ }
+ }
+
+ public void TestContains() {
+ char[] c1 = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(c1);
+ Assert("never find a null", !al1.Contains(null));
+ Assert("can't find value", al1.Contains('b'));
+ Assert("shouldn't find value", !al1.Contains('?'));
+ }
+
+ public void TestCopyTo() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ al1.CopyTo(null, 2);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("error not thrown 1", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[,] c2 = new Char[2,2];
+ al1.CopyTo(c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("error not thrown 2", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ // This appears to be a bug in the ArrayList Constructor.
+ // It throws a RankException if a multidimensional Array
+ // is passed. The docs imply that an IEnumerator is used
+ // to retrieve the items from the collection, so this should
+ // work. In anycase this test is for CopyTo, so use what
+ // works on both platforms.
+ //Char[,] c1 = new Char[2,2];
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("error not thrown 3", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("error not thrown 4", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 5: " + e.ToString());
+ }
+ Assert("error not thrown 5", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 6: " + e.ToString());
+ }
+ Assert("error not thrown 6", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String[] c1 = {"String", "array"};
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 7: " + e.ToString());
+ }
+ Assert("error not thrown 7", errorThrown);
+ }
+
+ Char[] orig = {'a', 'b', 'c', 'd'};
+ ArrayList al = new ArrayList(orig);
+ Char[] copy = new Char[10];
+ Array.Clear(copy, 0, copy.Length);
+ al.CopyTo(copy, 3);
+ AssertEquals("Wrong CopyTo 0", (char)0, copy[0]);
+ AssertEquals("Wrong CopyTo 1", (char)0, copy[1]);
+ AssertEquals("Wrong CopyTo 2", (char)0, copy[2]);
+ AssertEquals("Wrong CopyTo 3", orig[0], copy[3]);
+ AssertEquals("Wrong CopyTo 4", orig[1], copy[4]);
+ AssertEquals("Wrong CopyTo 5", orig[2], copy[5]);
+ AssertEquals("Wrong CopyTo 6", orig[3], copy[6]);
+ AssertEquals("Wrong CopyTo 7", (char)0, copy[7]);
+ AssertEquals("Wrong CopyTo 8", (char)0, copy[8]);
+ AssertEquals("Wrong CopyTo 9", (char)0, copy[9]);
+ }
+
+ public void TestFixedSize() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.FixedSize(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error not thrown", errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("arrays start un-fixed.",
+ false, al1.IsFixedSize);
+ ArrayList al2 = ArrayList.FixedSize(al1);
+ AssertEquals("should be fixed.",
+ true, al2.IsFixedSize);
+ }
+ }
+
+ public void TestEnumerator() {
+ String[] s1 = {"this", "is", "a", "test"};
+ ArrayList al1 = new ArrayList(s1);
+ IEnumerator en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.Add("something");
+ try {
+ en.MoveNext();
+ Fail("Add() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.AddRange(al1);
+ try {
+ en.MoveNext();
+ Fail("AddRange() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.Clear();
+ try {
+ en.MoveNext();
+ Fail("Clear() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ al1 = new ArrayList(s1);
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.Insert(0, "new first");
+ try {
+ en.MoveNext();
+ Fail("Insert() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.InsertRange(0, al1);
+ try {
+ en.MoveNext();
+ Fail("InsertRange() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.Remove("this");
+ try {
+ en.MoveNext();
+ Fail("Remove() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.RemoveAt(2);
+ try {
+ en.MoveNext();
+ Fail("RemoveAt() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.RemoveRange(1, 1);
+ try {
+ en.MoveNext();
+ Fail("RemoveRange() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.Reverse();
+ try {
+ en.MoveNext();
+ Fail("Reverse() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+
+ en = al1.GetEnumerator();
+ en.MoveNext();
+ al1.Sort();
+ try {
+ en.MoveNext();
+ Fail("Sort() didn't invalidate the enumerator");
+ } catch (InvalidOperationException) {
+ // do nothing...this is what we expect
+ }
+ }
+
+ public void TestGetEnumerator() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ IEnumerator en = a.GetEnumerator(-1,1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ IEnumerator en = a.GetEnumerator(1,-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ IEnumerator en = a.GetEnumerator(1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("out-of-range index error not thrown",
+ errorThrown);
+ }
+ {
+ String[] s1 = {"this", "is", "a", "test"};
+ ArrayList al1 = new ArrayList(s1);
+ IEnumerator en = al1.GetEnumerator();
+ AssertNotNull("No enumerator", en);
+
+ for (int i = 0; i < s1.Length; i++) {
+ en.MoveNext();
+ AssertEquals("Not enumerating",
+ al1[i], en.Current);
+ }
+ }
+ {
+ String[] s1 = {"this", "is", "a", "test"};
+ ArrayList al1 = new ArrayList(s1);
+ IEnumerator en = al1.GetEnumerator(1,2);
+ AssertNotNull("No enumerator", en);
+
+ for (int i = 0; i < 2; i++) {
+ en.MoveNext();
+ AssertEquals("Not enumerating",
+ al1[i+1], en.Current);
+ }
+ }
+ }
+
+ public void TestGetRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ ArrayList b = a.GetRange(-1,1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ ArrayList b = a.GetRange(1,-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ ArrayList b = a.GetRange(1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("out-of-range index error not thrown",
+ errorThrown);
+ }
+ {
+ char[] chars = {'a', 'b', 'c', 'd', 'e', 'f'};
+ ArrayList a = new ArrayList(chars);
+ ArrayList b = a.GetRange(1, 3);
+ AssertEquals("GetRange returned wrong size ArrayList", 3, b.Count);
+ for (int i = 0; i < b.Count; i++) {
+ AssertEquals("range didn't work",
+ chars[i+1], b[i]);
+ }
+
+ a[2] = '?'; // should screw up ArrayList b.
+ bool errorThrown = false;
+ try {
+ int i = b.Count;
+ } catch (InvalidOperationException) {
+ errorThrown = true;
+ }
+ AssertEquals("Munging 'a' should mess up 'b'",
+ true, errorThrown);
+ }
+ }
+
+ public void TestIndexOf() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', 0, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', 0, 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(2);
+ int i = a.IndexOf('a', 1, 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end indexof error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList a = new ArrayList(c);
+ AssertEquals("never find null",
+ -1, a.IndexOf(null));
+ AssertEquals("never find null",
+ -1, a.IndexOf(null, 0));
+ AssertEquals("never find null",
+ -1, a.IndexOf(null, 0, 5));
+ AssertEquals("can't find elem",
+ 2, a.IndexOf('c'));
+ AssertEquals("can't find elem",
+ 2, a.IndexOf('c', 2));
+ AssertEquals("can't find elem",
+ 2, a.IndexOf('c', 2, 2));
+ AssertEquals("shouldn't find elem",
+ -1, a.IndexOf('c', 3, 2));
+ AssertEquals("shouldn't find", -1, a.IndexOf('?'));
+ AssertEquals("shouldn't find", -1, a.IndexOf(3));
+ }
+ }
+
+ public void TestInsert() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ al1.Insert(0, "Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Insert(0, "Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.Insert(-1, "Hi!");
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.Insert(4, "Hi!");
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("arraylist starts empty", 0, al1.Count);
+ al1.Insert(0, 'a');
+ al1.Insert(1, 'b');
+ al1.Insert(0, 'c');
+ AssertEquals("arraylist needs stuff", 3, al1.Count);
+ AssertEquals("arraylist got stuff", 'c', al1[0]);
+ AssertEquals("arraylist got stuff", 'a', al1[1]);
+ AssertEquals("arraylist got stuff", 'b', al1[2]);
+ }
+ }
+
+ public void TestInsertRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ string[] s = {"Hi!"};
+ al1.InsertRange(0, s);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ string[] s = {"Hi!"};
+ al1.InsertRange(0, s);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ string[] s = {"Hi!"};
+ al1.InsertRange(-1, s);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index insert error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ string[] s = {"Hi!"};
+ al1.InsertRange(4, s);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out-of-range insert error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.InsertRange(0, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null insert error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList a = new ArrayList(c);
+ a.InsertRange(1, c);
+ AssertEquals("bad insert 1", 'a', a[0]);
+ AssertEquals("bad insert 2", 'a', a[1]);
+ AssertEquals("bad insert 3", 'b', a[2]);
+ AssertEquals("bad insert 4", 'c', a[3]);
+ AssertEquals("bad insert 5", 'b', a[4]);
+ AssertEquals("bad insert 6", 'c', a[5]);
+ }
+ }
+
+ public void TestLastIndexOf() {
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(1);
+ //int i = a.LastIndexOf('a', -1);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("first negative lastindexof error not thrown",
+ //errorThrown);
+ //}
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.LastIndexOf('a', 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end lastindexof error not thrown",
+ errorThrown);
+ }
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(1);
+ //int i = a.LastIndexOf('a', 0, -1);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("second negative lastindexof error not thrown",
+ //errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(1);
+ //int i = a.LastIndexOf('a', 0, 2);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("past-end lastindexof error not thrown",
+ //errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(2);
+ //int i = a.LastIndexOf('a', 0, 2);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("past-end lastindexof error not thrown",
+ //errorThrown);
+ //}
+ int iTest = 0;
+ try {
+ char[] c = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList a = new ArrayList(c);
+ AssertEquals("never find null",
+ -1, a.LastIndexOf(null));
+ iTest++;
+ AssertEquals("never find null",
+ -1, a.LastIndexOf(null, 4));
+ iTest++;
+ AssertEquals("never find null",
+ -1, a.LastIndexOf(null, 4, 5));
+ iTest++;
+ AssertEquals("can't find elem",
+ 2, a.LastIndexOf('c'));
+ iTest++;
+ AssertEquals("can't find elem",
+ 2, a.LastIndexOf('c', 4));
+ iTest++;
+ AssertEquals("can't find elem",
+ 2, a.LastIndexOf('c', 3, 2));
+ iTest++;
+ AssertEquals("shouldn't find elem",
+ -1, a.LastIndexOf('c', 4, 2));
+ iTest++;
+ AssertEquals("shouldn't find", -1, a.LastIndexOf('?'));
+ iTest++;
+ AssertEquals("shouldn't find", -1, a.LastIndexOf(1));
+ } catch (Exception e) {
+ Fail ("Unexpected exception caught when iTest=" + iTest + ". e=" + e);
+ }
+ }
+
+ public void TestReadOnly() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.ReadOnly(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error not thrown", errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("arrays start writeable.",
+ false, al1.IsReadOnly);
+ ArrayList al2 = ArrayList.ReadOnly(al1);
+ AssertEquals("should be readonly.",
+ true, al2.IsReadOnly);
+ }
+ }
+
+ public void TestRemove() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList(3));
+ al1.Remove(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.Remove(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove read only error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a','b','c'};
+ ArrayList a = new ArrayList(c);
+ a.Remove(1);
+ a.Remove('?');
+ AssertEquals("should be unchanged", c.Length, a.Count);
+ a.Remove('a');
+ AssertEquals("should be changed", 2, a.Count);
+ AssertEquals("should have shifted", 'b', a[0]);
+ AssertEquals("should have shifted", 'c', a[1]);
+ }
+ }
+
+ public void TestRemoveAt() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList(3));
+ al1.RemoveAt(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove from fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.RemoveAt(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove from read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveAt(-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("remove at negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveAt(4);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("remove at out-of-range index error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a','b','c'};
+ ArrayList a = new ArrayList(c);
+ a.RemoveAt(0);
+ AssertEquals("should be changed", 2, a.Count);
+ AssertEquals("should have shifted", 'b', a[0]);
+ AssertEquals("should have shifted", 'c', a[1]);
+ }
+ }
+
+ public void TestRemoveRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList(3));
+ al1.RemoveRange(0, 1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("removerange from fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.RemoveRange(0, 1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("removerange from read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveRange(-1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("removerange at negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveRange(0, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("removerange at negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveRange(2, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("removerange at bad range error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a','b','c'};
+ ArrayList a = new ArrayList(c);
+ a.RemoveRange(1,2);
+ AssertEquals("should be changed", 1, a.Count);
+ AssertEquals("should have shifted", 'a', a[0]);
+ }
+ }
+
+ public void TestRepeat() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.Repeat('c', -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("repeat negative copies error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = ArrayList.Repeat("huh?", 0);
+ AssertEquals("should be nothing in array",
+ 0, al1.Count);
+ }
+ {
+ ArrayList al1 = ArrayList.Repeat("huh?", 3);
+ AssertEquals("should be something in array",
+ 3, al1.Count);
+ AssertEquals("array elem doesn't check",
+ "huh?", al1[0]);
+ AssertEquals("array elem doesn't check",
+ "huh?", al1[1]);
+ AssertEquals("array elem doesn't check",
+ "huh?", al1[2]);
+ }
+ }
+
+ public void TestReverse() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Reverse();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("reverse on read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ ArrayList al1 = new ArrayList(c);
+ al1.Reverse(0, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ ArrayList al1 = new ArrayList(c);
+ al1.Reverse(3, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList al1 = new ArrayList(c);
+ al1.Reverse(2,1);
+ for (int i = 0; i < al1.Count; i++) {
+ AssertEquals("Should be no change yet",
+ c[i], al1[i]);
+ }
+ al1.Reverse();
+ for (int i = 0; i < al1.Count; i++) {
+ AssertEquals("Should be reversed",
+ c[i], al1[4-i]);
+ }
+ al1.Reverse();
+ for (int i = 0; i < al1.Count; i++) {
+ AssertEquals("Should be back to normal",
+ c[i], al1[i]);
+ }
+ al1.Reverse(1,3);
+ AssertEquals("Should be back to normal", c[0], al1[0]);
+ AssertEquals("Should be back to normal", c[3], al1[1]);
+ AssertEquals("Should be back to normal", c[2], al1[2]);
+ AssertEquals("Should be back to normal", c[1], al1[3]);
+ AssertEquals("Should be back to normal", c[4], al1[4]);
+ }
+ }
+
+ public void TestSetRange() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.SetRange(0, c);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("setrange on read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.SetRange(0, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("setrange with null error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(3);
+ al1.SetRange(-1, c);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("setrange with negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(3);
+ al1.SetRange(2, c);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("setrange with too much error not thrown",
+ errorThrown);
+ }
+
+ {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 = ArrayList.Repeat('?', 3);
+ Assert("no match yet", c[0] != (char)al1[0]);
+ Assert("no match yet", c[1] != (char)al1[1]);
+ Assert("no match yet", c[2] != (char)al1[2]);
+ al1.SetRange(0, c);
+ AssertEquals("should match", c[0], al1[0]);
+ AssertEquals("should match", c[1], al1[1]);
+ AssertEquals("should match", c[2], al1[2]);
+ }
+ }
+
+ public void TestInsertRange_this() {
+ String[] s1 = {"this", "is", "a", "test"};
+ ArrayList al = new ArrayList(s1);
+ al.InsertRange(2, al);
+ String[] s2 = {"this", "is", "this", "is", "a", "test", "a", "test"};
+ for (int i=0; i < al.Count; i++) {
+ AssertEquals("at i=" + i, s2[i], al[i]);
+ }
+ }
+
+ public void TestSort() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Sort();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("sort on read only error not thrown",
+ errorThrown);
+ }
+ {
+ char[] starter = {'d', 'b', 'f', 'e', 'a', 'c'};
+ ArrayList al1 = new ArrayList(starter);
+ al1.Sort();
+ AssertEquals("Should be sorted", 'a', al1[0]);
+ AssertEquals("Should be sorted", 'b', al1[1]);
+ AssertEquals("Should be sorted", 'c', al1[2]);
+ AssertEquals("Should be sorted", 'd', al1[3]);
+ AssertEquals("Should be sorted", 'e', al1[4]);
+ AssertEquals("Should be sorted", 'f', al1[5]);
+ }
+ }
+
+ // TODO - Sort with IComparers
+
+ // TODO - Synchronize
+
+ public void TestToArray() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.ToArray(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("toarray with null error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ string s = "huh?";
+ ArrayList al1 = new ArrayList(c);
+ al1.ToArray(s.GetType());
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("toarray with bad type error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c1 = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList al1 = new ArrayList(c1);
+ object[] o2 = al1.ToArray();
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("should be copy", c1[i], o2[i]);
+ }
+ Array c2 = al1.ToArray(c1[0].GetType());
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("should be copy",
+ c1[i], c2.GetValue(i));
+ }
+ }
+ }
+
+ public void TestTrimToSize() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.TrimToSize();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("trim read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ int capacity = al1.Capacity;
+ int size = capacity / 2;
+ for (int i = 1; i <=size; i++) {
+ al1.Add('?');
+ }
+ al1.RemoveAt(0);
+ al1.TrimToSize();
+ AssertEquals("no capacity match",
+ size - 1, al1.Capacity);
+
+ al1.Clear();
+ al1.TrimToSize();
+ AssertEquals("no default capacity",
+ capacity, al1.Capacity);
+ }
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/BitArrayTest.cs b/mcs/class/corlib/Test/System.Collections/BitArrayTest.cs
new file mode 100644
index 00000000000..e122119115e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/BitArrayTest.cs
@@ -0,0 +1,290 @@
+//
+// BitArrayTest.cs - NUnit Test Cases for the System.Collections.BitArray class
+//
+// Author: David Menestrina (dmenest@yahoo.com)
+//
+
+using NUnit.Framework;
+using System.Collections;
+using System;
+
+namespace MonoTests.System.Collections
+{
+
+public class BitArrayTest : TestCase
+{
+ private BitArray testBa;
+ private bool [] testPattern;
+ private BitArray op1;
+ private BitArray op2;
+
+ private void verifyPattern(BitArray ba, bool[] pattern)
+ {
+ AssertEquals(ba.Length, pattern.Length);
+ for (int i = 0; i < pattern.Length; i++)
+ AssertEquals(ba[i], pattern[i]);
+ }
+
+ protected override void SetUp()
+ {
+ testPattern = new bool[70];
+
+ int i;
+ for(i = 0; i < testPattern.Length/2; i++)
+ testPattern[i] = ((i % 2) == 0);
+ for(; i < testPattern.Length; i++)
+ testPattern[i] = ((i % 2) != 0);
+
+ testBa = new BitArray(70);
+ for(i = 0; i < testBa.Length/2; i++)
+ testBa[i] = ((i % 2) == 0);
+ for(; i < testBa.Length; i++)
+ testBa[i] = ((i % 2) != 0);
+
+ // for TestAnd, TestOr, TestNot, TestXor
+ op1 = new BitArray(new int[] { 0x33333333, 0x33333333 });
+ op2 = new BitArray(new int[] { 0x66666666, 0x66666666 });
+ }
+
+ public void TestBoolConstructor()
+ {
+ BitArray ba = new BitArray(testPattern);
+ verifyPattern(ba, testPattern);
+ }
+
+ public void TestCopyConstructor()
+ {
+ BitArray ba = new BitArray(testBa);
+
+ verifyPattern(ba, testPattern);
+ }
+
+ public void TestByteConstructor()
+ {
+ byte [] byteArr = new byte[] { 0xaa, 0x55, 0xaa, 0x55, 0x80 };
+ BitArray ba = new BitArray(byteArr);
+
+ AssertEquals("Lengths not equal", ba.Length, byteArr.Length * 8);
+
+ // spot check
+ Assert("7 not true", ba[7]);
+ Assert("6 not false", !ba[6]);
+ Assert("15 not false", !ba[15]);
+ Assert("14 not true", ba[14]);
+ Assert("39 not true", ba[39]);
+ Assert("35 not false", !ba[35]);
+
+ }
+
+ public void TestIntConstructor()
+ {
+ int [] intArr = new int[] { ~0x55555555, 0x55555551 };
+ BitArray ba = new BitArray(intArr);
+
+ AssertEquals(ba.Length, intArr.Length * 32);
+
+ // spot check
+
+ Assert(ba[31]);
+ Assert(!ba[30]);
+ Assert(!ba[63]);
+ Assert(ba[62]);
+ Assert(ba[32]);
+ Assert(!ba[35]);
+ }
+
+ public void TestValConstructor()
+ {
+ BitArray ba = new BitArray(64, false);
+
+ AssertEquals(ba.Length, 64);
+ foreach (bool b in ba)
+ Assert(!b);
+
+ ba = new BitArray(64, true);
+
+ AssertEquals(ba.Length, 64);
+ foreach (bool b in ba)
+ Assert(b);
+ }
+
+ public void TestClone()
+ {
+ BitArray ba = (BitArray)testBa.Clone();
+
+ verifyPattern(ba, testPattern);
+
+ // ensure that changes in ba don't get propagated to testBa
+ ba[0] = false;
+ ba[1] = false;
+ ba[2] = false;
+
+ verifyPattern(testBa, testPattern);
+ }
+
+ public void TestSetLength()
+ {
+ int origLen = testBa.Length;
+ testBa.Length += 33;
+
+ AssertEquals(origLen + 33, testBa.Length);
+ for (int i = origLen; i < testBa.Length; i++)
+ testBa[i] = true;
+
+ testBa.Length -= 33;
+ verifyPattern(testBa, testPattern);
+ }
+
+ public void TestAnd()
+ {
+ BitArray result = op1.And(op2);
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(!result[i++]);
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ Assert(!result[i++]);
+ }
+ }
+
+ public void TestOr()
+ {
+ BitArray result = op1.Or(op2);
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(result[i++]);
+ Assert(result[i++]);
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ }
+ }
+
+ public void TestNot()
+ {
+ BitArray result = op1.Not();
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(!result[i++]);
+ Assert(!result[i++]);
+ Assert(result[i++]);
+ Assert(result[i++]);
+ }
+ }
+
+ public void TestXor()
+ {
+ BitArray result = op1.Xor(op2);
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ }
+ }
+
+ public void TestSetAll()
+ {
+ testBa.SetAll(false);
+ foreach(bool b in testBa)
+ Assert(!b);
+ testBa.SetAll(true);
+ foreach(bool b in testBa)
+ Assert(b);
+ }
+
+ public void TestCopyToBool()
+ {
+ try {
+ bool[] barray = new bool[testBa.Length + 10];
+
+ testBa.CopyTo(barray, 5);
+
+ for (int i = 0; i < testBa.Length; i++)
+ AssertEquals(testBa[i], barray[i+5]);
+ }
+ catch(Exception e){
+ Fail("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ public void TestCopyToByte()
+ {
+ try {
+ testBa.Length = 34;
+ byte[] barray = new byte[5 + 10];
+
+ testBa.CopyTo(barray, 5);
+
+ for (int i = 5; i < 9; i++)
+ AssertEquals(0x55, barray[i] & 0xff);
+
+ // FIXME: MS fails on the next line. This is because
+ // we truncated testBa.Length, and MS's internal array still
+ // has the old bits set. CopyTo() doesn't say specifically
+ // whether the "junk" bits (bits past Length, but within Length
+ // rounded up to 32) will be copied as 0, or if those bits are
+ // undefined.
+ //AssertEquals(0x01, barray[9] & 0xff);
+ }
+ catch(Exception e){
+ Fail("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ public void TestCopyToInt()
+ {
+ try {
+ testBa.Length = 34;
+ int[] iarray = new int[2 + 10];
+
+ testBa.CopyTo(iarray, 5);
+
+ AssertEquals(0x55555555, iarray[5]);
+ // FIXME: Same thing here as in TestCopyToByte
+ //AssertEquals(0x01, iarray[6]);
+ }
+ catch(Exception e){
+ Fail("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ public void TestEnumerator()
+ {
+
+ try {
+ IEnumerator e = testBa.GetEnumerator();
+
+ for (int i = 0; e.MoveNext(); i++)
+ AssertEquals(e.Current, testPattern[i]);
+
+ Assert(!e.MoveNext());
+ // read, to make sure reading isn't considered a write.
+ bool b = testBa[0];
+
+ e.Reset();
+ for (int i = 0; e.MoveNext(); i++)
+ AssertEquals(e.Current, testPattern[i]);
+
+ try
+ {
+ e.Reset();
+ testBa[0] = !testBa[0];
+ e.MoveNext();
+ Fail("IEnumerator.MoveNext() should throw when collection modified.");
+ }
+ catch (InvalidOperationException)
+ {
+ }
+ }
+ catch(Exception ex){
+ Fail("Unexpected exception thrown: " + ex.ToString());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs
new file mode 100644
index 00000000000..3409d7767d2
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs
@@ -0,0 +1,38 @@
+// CaseInsensitiveComparerTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+ /// <summary>CaseInsensitiveComparer test suite.</summary>
+ public class CaseInsensitiveComparerTest : TestCase {
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestDefaultInstance ()
+ {
+ // Make sure the instance returned by Default
+ // is really a CaseInsensitiveComparer.
+ Assert((CaseInsensitiveComparer.Default
+ as CaseInsensitiveComparer) != null);
+ }
+
+ public void TestCompare () {
+ CaseInsensitiveComparer cic = new CaseInsensitiveComparer ();
+
+ Assert(cic.Compare ("WILD WEST", "Wild West") == 0);
+ Assert(cic.Compare ("WILD WEST", "wild west") == 0);
+ Assert(cic.Compare ("Zeus", "Mars") > 0);
+ Assert(cic.Compare ("Earth", "Venus") < 0);
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs
new file mode 100644
index 00000000000..08e1f7f1391
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs
@@ -0,0 +1,44 @@
+// CaseInsensitiveHashCodeProviderTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+ /// <summary>CaseInsensitiveHashCodeProvider test suite.</summary>
+ public class CaseInsensitiveHashCodeProviderTest : TestCase {
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestDefaultInstance ()
+ {
+ // Make sure the instance returned by Default
+ // is really a CaseInsensitiveHashCodeProvider.
+ Assert((CaseInsensitiveHashCodeProvider.Default
+ as CaseInsensitiveHashCodeProvider) != null);
+ }
+
+ public void TestHashCode () {
+ CaseInsensitiveHashCodeProvider cih = new CaseInsensitiveHashCodeProvider ();
+ int h1 = cih.GetHashCode ("Test String");
+ int h2 = cih.GetHashCode ("test string");
+ int h3 = cih.GetHashCode ("TEST STRING");
+
+ Assert("Mixed Case != lower case", h1 == h2);
+ Assert("Mixed Case != UPPER CASE", h1 == h3);
+
+ h1 = cih.GetHashCode ("one");
+ h2 = cih.GetHashCode ("another");
+ // Actually this is quite possible.
+ Assert(h1 != h2);
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/ChangeLog b/mcs/class/corlib/Test/System.Collections/ChangeLog
new file mode 100644
index 00000000000..c2b8c61acf1
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ChangeLog
@@ -0,0 +1,124 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-10-16 Nick Drochak <ndrochak@gol.com>
+
+ * QueueTest.cs: Add test from tetsuo via Vladimir Vukicevic
+ (vladimir@pobox.com).
+
+2002-10-09 Nick Drochak <ndrochak@gol.com>
+
+ * SortedListTest.cs: Re-enable test for IsSyncronized
+
+2002-09-24 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs: Add test for InsertRange() for the case where an
+ ArrayList is passed to itself to be insterted.
+
+2002-09-24 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs: Add check that enumerator is invalidated after a
+ method that changes the list, such as Add(), Remove(), etc.
+
+2002-07-02 Nick Drochak <ndrochak@gol.com>
+
+ * SortedListTest.cs: Fix some expected/actual value parameters for
+ AssertEquals().
+
+2002-06-30 Nick Drochak <ndrochak@gol.com>
+
+ * SortedListTest.cs: Fix some expected/actual value parameters in the
+ Assert()'s. Disable a part of test until the class is finished.
+
+2002-06-25 Nick Drochak <ndrochak@gol.com>
+
+ * QueueTest.cs: Trap some unexpected exceptions and add a bit of
+ verbosity to some assert messages.
+
+2002-06-20 Nick Drochak <ndrochak@gol.com>
+
+ * SortedListTest.cs: Make tests pass against ms.net.
+ * QueueTest.cs: Make tests pass against ms.net.
+
+2002-06-19 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Sort names and include missing tests.
+ * SortedListTest.cs: Change Console.WriteLine() into Fail().
+
+2002-05-27 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (TestLastIndexOf): Add try-catch block to report
+ where we are throwing.
+
+2002-05-21 Lawrence Pit <loz@cable.a2000.nl>
+
+ * ArrayListTest.cs: Added several tests to test for 0 capacity
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs: Test for RankException when constructing from a
+ multi-dimensional array. Confirmed behavior from MS.NET
+
+2002-05-01 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (TestBinarySearch) : accomodate possible bug in
+ .NET runtime.
+
+2002/05/01 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (TestCopyTo) : Make assert messages unique and
+ avoid possible MS.NET bug when test is run on .NET.
+
+2002/04/30 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (TestInsertRange) : Make assert messages unique.
+
+2002-04-30 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (TestTrimToSize): Change test so that it doesn't
+ rely on the specific timing of a capacity change. Our corlib doubles
+ capacity sooner than the reference system does.
+
+2002-04-30 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs: Catch unexpected exception typs and report as
+ failures.
+
+2002-04-29 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (TestBinarySearch): Catch the correct exception here.
+
+2002-04-29 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs (): Remove test on unsorted array. Behavior is
+ undefined according to docs. Re-added test that was commented out.
+
+2002-03-24 Duncan Mak <duncan@ximian.com>
+
+ * SortedListTest.cs: Committed to CVS for Jaak Simm <jaaksimm@firm.ee>.
+
+2002-02-28 Nick Drochak <ndrochak@gol.com>
+
+ * HashtableTest.cs: make the second test class public. The was showing
+ as an error whe run against the mscorlib. Might be because of the
+ new NUnit that was just checked in.
+
+2002-02-20 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs: Add a small assert for a bug that I found and fixed
+ in ArrayList. Make sure it doesn't come up again.
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * QueueTest.cs: Put in correct namespace.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * StackTest.cs: Removed test for IsReadonly. Doesn't exist in .NET 1.0
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * BitArrayTest.cs: wrapped try-catch blocks around several of the tests.
+ NUnit doesn't properly catch exception here anymore. Must be something
+ to do with upgrading to .NET.1.0.
diff --git a/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs b/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs
new file mode 100644
index 00000000000..3d274381a21
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs
@@ -0,0 +1,227 @@
+//
+// System.Collections.CollectionBase
+// Test suite for System.Collections.CollectionBase
+//
+// Author:
+// Nick D. Drochak II
+//
+// (C) 2001 Nick D. Drochak II
+//
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections
+{
+
+public class CollectionBaseTest : TestCase
+{
+ // We need a concrete class to test the abstract base class
+ public class ConcreteCollection : CollectionBase
+ {
+ // These fields are used as markers to test the On* hooks.
+ public bool onClearFired;
+ public bool onClearCompleteFired;
+
+ public bool onInsertFired;
+ public int onInsertIndex;
+ public bool onInsertCompleteFired;
+ public int onInsertCompleteIndex;
+
+ public bool onRemoveFired;
+ public int onRemoveIndex;
+ public bool onRemoveCompleteFired;
+ public int onRemoveCompleteIndex;
+
+ public bool onSetFired;
+ public int onSetOldValue;
+ public int onSetNewValue;
+ public bool onSetCompleteFired;
+ public int onSetCompleteOldValue;
+ public int onSetCompleteNewValue;
+
+ // This constructor is used to test OnValid()
+ public ConcreteCollection()
+ {
+ IList listObj;
+ listObj = this;
+ listObj.Add(null);
+ }
+
+ // This constructor puts consecutive integers into the list
+ public ConcreteCollection(int i) {
+ IList listObj;
+ listObj = this;
+
+ int j;
+ for (j = 0; j< i; j++) {
+ listObj.Add(j);
+ }
+ }
+
+ // A helper method to look at a value in the list at a specific index
+ public int PeekAt(int index)
+ {
+ IList listObj;
+ listObj = this;
+ return (int) listObj[index];
+ }
+
+ // Mark the flag if this hook is fired
+ protected override void OnClear() {
+ this.onClearFired = true;
+ }
+
+ // Mark the flag if this hook is fired
+ protected override void OnClearComplete()
+ {
+ this.onClearCompleteFired = true;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnInsert(int index, object value)
+ {
+ this.onInsertFired = true;
+ this.onInsertIndex = index;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnInsertComplete(int index, object value)
+ {
+ this.onInsertCompleteFired = true;
+ this.onInsertCompleteIndex = index;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnRemove(int index, object value)
+ {
+ this.onRemoveFired = true;
+ this.onRemoveIndex = index;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnRemoveComplete(int index, object value)
+ {
+ this.onRemoveCompleteFired = true;
+ this.onRemoveCompleteIndex = index;
+ }
+
+ // Mark the flag, and save the paramters if this hook is fired
+ protected override void OnSet(int index, object oldValue, object newValue)
+ {
+ this.onSetFired = true;
+ this.onSetOldValue = (int) oldValue;
+ this.onSetNewValue = (int) newValue;
+ }
+
+ // Mark the flag, and save the paramters if this hook is fired
+ protected override void OnSetComplete(int index, object oldValue, object newValue)
+ {
+ this.onSetCompleteFired = true;
+ this.onSetCompleteOldValue = (int) oldValue;
+ this.onSetCompleteNewValue = (int) newValue;
+ }
+ } // public class ConcreteCollection
+
+ // Check the count property
+ public void TestCount() {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection(4);
+ Assert(4 == myCollection.Count);
+ }
+
+ // Make sure GetEnumerator returns an object
+ public void TestGetEnumerator() {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection(4);
+ Assert(null != myCollection.GetEnumerator());
+ }
+
+ // OnValid disallows nulls
+ public void TestOnValid() {
+ ConcreteCollection myCollection;
+ try {
+ myCollection = new ConcreteCollection();
+ }
+ catch (ArgumentNullException) {
+ }
+ }
+
+ // Test various Insert paths
+ public void TestInsert() {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 3;
+ // The constructor inserts
+ myCollection = new ConcreteCollection(numberOfItems);
+ Assert(myCollection.onInsertFired);
+ Assert(myCollection.onInsertCompleteFired);
+
+ // Using the IList interface, check inserts in the middle
+ IList listObj = myCollection;
+ listObj.Insert(1, 9);
+ Assert(myCollection.onInsertIndex == 1);
+ Assert(myCollection.onInsertCompleteIndex == 1);
+ Assert(myCollection.PeekAt(1) == 9);
+ }
+
+ // Test Clear and it's hooks
+ public void TestClear()
+ {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 1;
+ myCollection = new ConcreteCollection(numberOfItems);
+ myCollection.Clear();
+ Assert(myCollection.Count == 0);
+ Assert(myCollection.onClearFired);
+ Assert(myCollection.onClearCompleteFired);
+ }
+
+ // Test RemoveAt, other removes and the hooks
+ public void TestRemove()
+ {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 3;
+ // Set up a test collection
+ myCollection = new ConcreteCollection(numberOfItems);
+
+ // The list is 0-based. So if we remove the second one
+ myCollection.RemoveAt(1);
+
+ // We should see the original third one in it's place
+ Assert(myCollection.PeekAt(1) == 2);
+ Assert(myCollection.onRemoveFired);
+ Assert(myCollection.onRemoveIndex == 1);
+ Assert(myCollection.onRemoveCompleteFired);
+ Assert(myCollection.onRemoveCompleteIndex == 1);
+ IList listObj = myCollection;
+ listObj.Remove(0);
+ // Confirm parameters are being passed to the hooks
+ Assert(myCollection.onRemoveIndex == 0);
+ Assert(myCollection.onRemoveCompleteIndex == 0);
+ }
+
+ // Test the random access feature
+ public void TestSet()
+ {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 3;
+ myCollection = new ConcreteCollection(numberOfItems);
+ IList listObj = myCollection;
+ listObj[0] = 99;
+ Assert((int) listObj[0] == 99);
+ Assert(myCollection.onSetFired);
+ Assert(myCollection.onSetCompleteFired);
+ Assert(myCollection.onSetOldValue == 0);
+ Assert(myCollection.onSetCompleteOldValue == 0);
+ Assert(myCollection.onSetNewValue == 99);
+ Assert(myCollection.onSetCompleteNewValue == 99);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/ComparerTest.cs b/mcs/class/corlib/Test/System.Collections/ComparerTest.cs
new file mode 100644
index 00000000000..c6353f4ec6a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ComparerTest.cs
@@ -0,0 +1,48 @@
+// ComparerTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+ /// <summary>Comparer test suite.</summary>
+ public class ComparerTest : TestCase {
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestDefaultInstance ()
+ {
+ // Make sure the instance returned by Default
+ // is really a Comparer.
+ Assert((Comparer.Default as Comparer) != null);
+ }
+
+ public void TestCompare ()
+ {
+ Comparer c = Comparer.Default;
+
+ bool thrown = false;
+
+ try {
+ c.Compare (new Object (), new Object ());
+ } catch (ArgumentException) {
+ thrown = true;
+ }
+
+ Assert("ArgumentException expected", thrown);
+
+ Assert(c.Compare (1, 2) < 0);
+ Assert(c.Compare (2, 2) == 0);
+ Assert(c.Compare (3, 2) > 0);
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/HashtableTest.cs b/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
new file mode 100644
index 00000000000..945dab589cd
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
@@ -0,0 +1,741 @@
+// HashtableTest.cs - NUnit Test Cases for the System.Collections.Hashtable class
+//
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+/// <summary>Hashtable test.</summary>
+[TestFixture]
+public class HashtableTest : TestCase {
+ public void TestCtor1() {
+ Hashtable h = new Hashtable();
+ AssertNotNull("No hash table", h);
+ }
+ public void TestCtor2() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values = {'a', 'b', 'c', 'd'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values[i];
+ }
+ Hashtable h2 = new Hashtable(h1);
+ for (int i = 0; i < keys.Length; i++) {
+ AssertEquals("No match for key " + keys[i],
+ values[i], h2[keys[i]]);
+ }
+ }
+ }
+ // TODO - Ctors for capacity and load (how to test? any access?)
+ // TODO - Ctors with IComparer, IHashCodeProvider, Serialization
+
+ public void TestCount() {
+ Hashtable h = new Hashtable();
+ AssertEquals("new table - count zero", 0, h.Count);
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h[i] = i;
+ AssertEquals("Count wrong for " + i,
+ i, h.Count);
+ }
+ for (int i = 1; i <= max; i++) {
+ h[i] = i * 2;
+ AssertEquals("Count shouldn't change at " + i,
+ max, h.Count);
+ }
+ }
+
+ public void TestIsFixedSize() {
+ Hashtable h = new Hashtable();
+ AssertEquals("hashtable not fixed by default",
+ false, h.IsFixedSize);
+ // TODO - any way to get a fixed-size hashtable?
+ }
+
+ public void TestIsReadOnly() {
+ Hashtable h = new Hashtable();
+ AssertEquals("hashtable not read-only by default",
+ false, h.IsReadOnly);
+ // TODO - any way to get a read-only hashtable?
+ }
+
+ public void TestIsSynchronized() {
+ Hashtable h = new Hashtable();
+ Assert("hashtable not synced by default", !h.IsSynchronized);
+ Hashtable h2 = Hashtable.Synchronized(h);
+ Assert("hashtable should by synced", h2.IsSynchronized);
+ }
+
+ public void TestItem() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ Object o = h[null];
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ // TODO - if read-only and/or fixed-size is possible,
+ // test 'NotSupportedException' here
+
+ {
+ Hashtable h = new Hashtable();
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h[i] = i;
+ AssertEquals("value wrong for " + i,
+ i, h[i]);
+ }
+ }
+ }
+
+ public void TestKeys() {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values1 = {'a', 'b', 'c', 'd'};
+ char[] values2 = {'e', 'f', 'g', 'h'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values1[i];
+ }
+ AssertEquals("keys wrong size",
+ keys.Length, h1.Keys.Count);
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values2[i];
+ }
+ AssertEquals("keys wrong size 2",
+ keys.Length, h1.Keys.Count);
+ }
+
+ // TODO - SyncRoot
+
+ public void TestValues() {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values1 = {'a', 'b', 'c', 'd'};
+ char[] values2 = {'e', 'f', 'g', 'h'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values1[i];
+ }
+ AssertEquals("values wrong size",
+ keys.Length, h1.Values.Count);
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values2[i];
+ }
+ AssertEquals("values wrong size 2",
+ keys.Length, h1.Values.Count);
+ }
+
+ public void TestAdd() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.Add(null, "huh?");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null add error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.Add('a', 1);
+ h.Add('a', 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("re-add error not thrown",
+ errorThrown);
+ }
+ // TODO - hit NotSupportedException
+ {
+ Hashtable h = new Hashtable();
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h.Add(i, i);
+ AssertEquals("value wrong for " + i,
+ i, h[i]);
+ }
+ }
+ }
+
+ public void TestClear() {
+ // TODO - hit NotSupportedException
+ Hashtable h = new Hashtable();
+ AssertEquals("new table - count zero", 0, h.Count);
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h[i] = i;
+ }
+ Assert("table don't gots stuff", h.Count > 0);
+ h.Clear();
+ AssertEquals("Table should be cleared",
+ 0, h.Count);
+ }
+
+ public void TestClone() {
+ {
+ char[] c1 = {'a', 'b', 'c'};
+ char[] c2 = {'d', 'e', 'f'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < c1.Length; i++) {
+ h1[c1[i]] = c2[i];
+ }
+ Hashtable h2 = (Hashtable)h1.Clone();
+ AssertNotNull("got no clone!", h2);
+ AssertNotNull("clone's got nothing!", h2[c1[0]]);
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("Hashtable match",
+ h1[c1[i]], h2[c1[i]]);
+ }
+ }
+ {
+ char[] c1 = {'a', 'b', 'c'};
+ char[] c20 = {'1', '2'};
+ char[] c21 = {'3', '4'};
+ char[] c22 = {'5', '6'};
+ char[][] c2 = {c20, c21, c22};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < c1.Length; i++) {
+ h1[c1[i]] = c2[i];
+ }
+ Hashtable h2 = (Hashtable)h1.Clone();
+ AssertNotNull("got no clone!", h2);
+ AssertNotNull("clone's got nothing!", h2[c1[0]]);
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("Hashtable match",
+ h1[c1[i]], h2[c1[i]]);
+ }
+
+ ((char[])h1[c1[0]])[0] = 'z';
+ AssertEquals("shallow copy", h1[c1[0]], h2[c1[0]]);
+ }
+ }
+
+ public void TestContains() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ bool result = h.Contains(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null add error not thrown",
+ errorThrown);
+ }
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = "blue";
+ Assert("'a'? it's in there!", h.Contains('a'));
+ Assert("'b'? no way!", !h.Contains('b'));
+ }
+ }
+
+ public void TestContainsKey() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ bool result = h.ContainsKey(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null add error not thrown",
+ errorThrown);
+ }
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = "blue";
+ Assert("'a'? it's in there!", h.ContainsKey('a'));
+ Assert("'b'? no way!", !h.ContainsKey('b'));
+ }
+ }
+
+ public void TestContainsValue() {
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = "blue";
+ Assert("blue? it's in there!",
+ h.ContainsValue("blue"));
+ Assert("green? no way!",
+ !h.ContainsValue("green"));
+ }
+ }
+
+ public void TestCopyTo() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.CopyTo(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ Object[] o = new Object[1];
+ h.CopyTo(o, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ Object[,] o = new Object[1,1];
+ h.CopyTo(o, 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("multi-dim array error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h['a'] = 1; // no error if table is empty
+ Object[] o = new Object[5];
+ h.CopyTo(o, 5);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("no room in array error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h['a'] = 1;
+ h['b'] = 2;
+ h['c'] = 2;
+ Object[] o = new Object[2];
+ h.CopyTo(o, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("table too big error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h["blue"] = 1;
+ h["green"] = 2;
+ h["red"] = 3;
+ Char[] o = new Char[3];
+ h.CopyTo(o, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("invalid cast error not thrown",
+ errorThrown);
+ }
+
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = 1;
+ h['b'] = 2;
+ DictionaryEntry[] o = new DictionaryEntry[2];
+ h.CopyTo(o,0);
+ AssertEquals("first copy fine.", 'a', o[0].Key);
+ AssertEquals("first copy fine.", 1, o[0].Value);
+ AssertEquals("second copy fine.", 'b', o[1].Key);
+ AssertEquals("second copy fine.", 2, o[1].Value);
+ }
+ }
+
+ public void TestGetEnumerator() {
+ String[] s1 = {"this", "is", "a", "test"};
+ Char[] c1 = {'a', 'b', 'c', 'd'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < s1.Length; i++) {
+ h1[s1[i]] = c1[i];
+ }
+ IDictionaryEnumerator en = h1.GetEnumerator();
+ AssertNotNull("No enumerator", en);
+
+ for (int i = 0; i < s1.Length; i++) {
+ en.MoveNext();
+ Assert("Not enumerating for " + en.Key,
+ Array.IndexOf(s1, en.Key) >= 0);
+ Assert("Not enumerating for " + en.Value,
+ Array.IndexOf(c1, en.Value) >= 0);
+ }
+ }
+
+ // TODO - GetObjectData
+ // TODO - OnDeserialization
+
+ public void TestRemove() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.Remove(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values = {'a', 'b', 'c', 'd'};
+ Hashtable h = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h[keys[i]] = values[i];
+ }
+ AssertEquals("not enough in table",
+ 4, h.Count);
+ h.Remove("huh?");
+ AssertEquals("not enough in table",
+ 4, h.Count);
+ h.Remove("this");
+ AssertEquals("Wrong count in table",
+ 3, h.Count);
+ h.Remove("this");
+ AssertEquals("Wrong count in table",
+ 3, h.Count);
+ }
+ }
+
+ public void TestSynchronized() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = Hashtable.Synchronized(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ Hashtable h = new Hashtable();
+ Assert("hashtable not synced by default",
+ !h.IsSynchronized);
+ Hashtable h2 = Hashtable.Synchronized(h);
+ Assert("hashtable should by synced",
+ h2.IsSynchronized);
+ }
+ }
+
+
+ protected Hashtable ht;
+ private static Random rnd;
+
+ [SetUp]
+ protected override void SetUp() {
+ ht=new Hashtable();
+ rnd=new Random();
+ }
+
+ private void SetDefaultData() {
+ ht.Clear();
+ ht.Add("k1","another");
+ ht.Add("k2","yet");
+ ht.Add("k3","hashtable");
+ }
+
+
+ public void TestAddRemoveClear() {
+ ht.Clear();
+ Assert(ht.Count==0);
+
+ SetDefaultData();
+ Assert(ht.Count==3);
+
+ bool thrown=false;
+ try {
+ ht.Add("k2","cool");
+ } catch (ArgumentException) {thrown=true;}
+ Assert("Must throw ArgumentException!",thrown);
+
+ ht["k2"]="cool";
+ Assert(ht.Count==3);
+ Assert(ht["k2"].Equals("cool"));
+
+ }
+
+ public void TestCopyTo2() {
+ SetDefaultData();
+ Object[] entries=new Object[ht.Count];
+ ht.CopyTo(entries,0);
+ Assert("Not an entry.",entries[0] is DictionaryEntry);
+ }
+
+
+ public void TestUnderHeavyLoad() {
+ ht.Clear();
+ int max=100000;
+ String[] cache=new String[max*2];
+ int n=0;
+
+ for (int i=0;i<max;i++) {
+ int id=rnd.Next()&0xFFFF;
+ String key=""+id+"-key-"+id;
+ String val="value-"+id;
+ if (ht[key]==null) {
+ ht[key]=val;
+ cache[n]=key;
+ cache[n+max]=val;
+ n++;
+ }
+ }
+
+ Assert(ht.Count==n);
+
+ for (int i=0;i<n;i++) {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+
+ int r1=(n/3);
+ int r2=r1+(n/5);
+
+ for (int i=r1;i<r2;i++) {
+ ht.Remove(cache[i]);
+ }
+
+
+ for (int i=0;i<n;i++) {
+ if (i>=r1 && i<r2) {
+ Assert(ht[cache[i]]==null);
+ } else {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+ }
+
+ ICollection keys=ht.Keys;
+ int nKeys=0;
+ foreach (Object key in keys) {
+ Assert((key as String) != null);
+ nKeys++;
+ }
+ Assert(nKeys==ht.Count);
+
+
+ ICollection vals=ht.Values;
+ int nVals=0;
+ foreach (Object val in vals) {
+ Assert((val as String) != null);
+ nVals++;
+ }
+ Assert(nVals==ht.Count);
+
+ }
+
+
+ [TestFixture]
+ public class HashtableTest2 : TestCase {
+
+ protected Hashtable ht;
+ private static Random rnd;
+
+ [SetUp]
+ protected override void SetUp ()
+ {
+ ht=new Hashtable ();
+ rnd=new Random ();
+ }
+
+ private void SetDefaultData ()
+ {
+ ht.Clear ();
+ ht.Add ("k1","another");
+ ht.Add ("k2","yet");
+ ht.Add ("k3","hashtable");
+ }
+
+
+ public void TestAddRemoveClear ()
+ {
+ ht.Clear ();
+ Assert (ht.Count == 0);
+
+ SetDefaultData ();
+ Assert (ht.Count == 3);
+
+ bool thrown=false;
+ try {
+ ht.Add ("k2","cool");
+ } catch (ArgumentException) {thrown=true;}
+ Assert("Must throw ArgumentException!",thrown);
+
+ ht["k2"]="cool";
+ Assert(ht.Count == 3);
+ Assert(ht["k2"].Equals("cool"));
+
+ }
+
+ public void TestCopyTo ()
+ {
+ SetDefaultData ();
+ Object[] entries=new Object[ht.Count];
+ ht.CopyTo (entries,0);
+ Assert("Not an entry.",entries[0] is DictionaryEntry);
+ }
+
+
+ public void TestUnderHeavyLoad ()
+ {
+ ht.Clear ();
+
+ int max=100000;
+ String[] cache=new String[max*2];
+ int n=0;
+
+ for (int i=0;i<max;i++) {
+ int id=rnd.Next()&0xFFFF;
+ String key=""+id+"-key-"+id;
+ String val="value-"+id;
+ if (ht[key]==null) {
+ ht[key]=val;
+ cache[n]=key;
+ cache[n+max]=val;
+ n++;
+ }
+ }
+
+ Assert(ht.Count==n);
+
+ for (int i=0;i<n;i++) {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+
+ int r1=(n/3);
+ int r2=r1+(n/5);
+
+ for (int i=r1;i<r2;i++) {
+ ht.Remove(cache[i]);
+ }
+
+
+ for (int i=0;i<n;i++) {
+ if (i>=r1 && i<r2) {
+ Assert(ht[cache[i]]==null);
+ } else {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+ }
+
+ ICollection keys=ht.Keys;
+ int nKeys=0;
+ foreach (Object key in keys) {
+ Assert((key as String) != null);
+ nKeys++;
+ }
+ Assert(nKeys==ht.Count);
+
+
+ ICollection vals=ht.Values;
+ int nVals=0;
+ foreach (Object val in vals) {
+ Assert((val as String) != null);
+ nVals++;
+ }
+ Assert(nVals==ht.Count);
+
+ }
+
+ /// <summary>
+ /// Test hashtable with CaseInsensitiveHashCodeProvider
+ /// and CaseInsensitive comparer.
+ /// </summary>
+ public void TestCaseInsensitive ()
+ {
+ // Not very meaningfull test, just to make
+ // sure that hcp is set properly set.
+ Hashtable ciHashtable = new Hashtable(11,1.0f,CaseInsensitiveHashCodeProvider.Default,CaseInsensitiveComparer.Default);
+ ciHashtable ["key1"] = "value";
+ ciHashtable ["key2"] = "VALUE";
+ Assert(ciHashtable ["key1"].Equals ("value"));
+ Assert(ciHashtable ["key2"].Equals ("VALUE"));
+
+ ciHashtable ["KEY1"] = "new_value";
+ Assert(ciHashtable ["key1"].Equals ("new_value"));
+
+ }
+
+
+ public void TestCopyConstructor ()
+ {
+ SetDefaultData ();
+
+ Hashtable htCopy = new Hashtable (ht);
+
+ Assert(ht.Count == htCopy.Count);
+ }
+
+
+ public void TestEnumerator ()
+ {
+ SetDefaultData ();
+
+ IEnumerator e = ht.GetEnumerator ();
+
+ while (e.MoveNext ()) {}
+
+ Assert (!e.MoveNext ());
+
+ }
+
+
+ }
+
+
+}
+}
diff --git a/mcs/class/corlib/Test/System.Collections/QueueTest.cs b/mcs/class/corlib/Test/System.Collections/QueueTest.cs
new file mode 100644
index 00000000000..db17bb0d342
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/QueueTest.cs
@@ -0,0 +1,188 @@
+//
+// System.Collections.QueueTest
+// Test suite for System.Collections.Queue
+//
+// Author:
+// Ricardo Fernández Pascual
+//
+// (C) 2001 Ricardo Fernández Pascual
+//
+
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections {
+
+ public class QueueTest : TestCase {
+
+ protected Queue q1;
+ protected Queue q2;
+ protected Queue emptyQueue;
+
+ protected override void SetUp () {
+ q1 = new Queue (10);
+ for (int i = 0; i < 100; i++)
+ q1.Enqueue (i);
+
+ q2 = new Queue (50, 1.5f);
+ for (int i = 50; i < 100; i++)
+ q2.Enqueue (i);
+
+ emptyQueue = new Queue ();
+ }
+
+ public void TestConstructors () {
+ Assert (q1.Count == 100);
+ Assert (q2.Count == 50);
+ Assert (emptyQueue.Count == 0);
+ // TODO: Test Queue (ICollection)
+ }
+
+ // TODO: should test all methods from ICollection,
+ // but it should be done in ICollectionTest.cs... ??
+
+ public void TestCopyTo () {
+ int[] a1 = new int[100];
+ int[] a2 = new int[60];
+
+ string progress_marker = "";
+ try {
+ progress_marker = "before first CopyTo";
+ q1.CopyTo (a1, 0);
+ for (int i = 0; i < 100; i++)
+ AssertEquals (i, a1[i]);
+
+ // Remove some items from q2 and add other
+ // items, to avoid having an "easy" just created
+ // Queue
+ for (int i = 50; i < 60; i++)
+ Assert (i == (int) q2.Dequeue ());
+ for (int i = 100; i < 110; i++)
+ q2.Enqueue (i);
+
+ progress_marker = "before second CopyTo";
+ q2.CopyTo (a2, 10);
+ for (int i = 60; i < 110; i++)
+ Assert (i == a2[i - 60 + 10]);
+
+ // Copying an empty Queue should not modify the array
+ progress_marker = "before third CopyTo";
+ emptyQueue.CopyTo (a2, 10);
+ for (int i = 60; i < 110; i++)
+ Assert (i == a2[i - 60 + 10]);
+ } catch (Exception e) {
+ Fail ("Unexpected exception at marker <" + progress_marker + ">: e = " + e);
+ }
+
+ }
+
+ public void TestEnumerator () {
+ int i;
+ IEnumerator e;
+ e = q1.GetEnumerator ();
+ i = 0;
+ while (e.MoveNext ()) {
+ AssertEquals ("q1 at i=" + i, i, ((int) e.Current));
+ i++;
+ }
+ e = q2.GetEnumerator ();
+ i = 50;
+ while (e.MoveNext ()) {
+ AssertEquals (i, ((int) e.Current));
+ i++;
+ }
+ e = emptyQueue.GetEnumerator ();
+ if (e.MoveNext ())
+ Fail ("Empty Queue enumerator returning elements!");
+
+ e = q1.GetEnumerator ();
+ try {
+ e.MoveNext ();
+ q1.Enqueue (0);
+ e.MoveNext ();
+ Fail ("#1 Should have thrown InvalidOperationException");
+ } catch (InvalidOperationException) { }
+ e = q1.GetEnumerator ();
+ }
+
+ public void TestClone () {
+ Queue q3 = (Queue) q2.Clone ();
+ Assert (q3.Count == q2.Count);
+ for (int i = 0; i < 50; i++)
+ Assert (q2.Dequeue ().Equals (q3.Dequeue ()));
+ Assert (q3.Count == 0);
+ Assert (q2.Count == 0);
+ }
+
+ public void ClearTest () {
+ q1.Clear ();
+ Assert (q1.Count == 0);
+ q2.Clear ();
+ Assert (q2.Count == 0);
+ emptyQueue.Clear ();
+ Assert (emptyQueue.Count == 0);
+ }
+
+ public void ContainsTest () {
+ for (int i = 0; i < 100; i++) {
+ Assert (q1.Contains (i));
+ Assert (!emptyQueue.Contains (i));
+ if (i < 50)
+ Assert (!q2.Contains (i));
+ else
+ Assert (q2.Contains (i));
+ }
+ }
+
+ public void EnqueueDequeuePeekTest () {
+ int q1size = q1.Count;
+ int q2size = q2.Count;
+ q2.Enqueue (null);
+ Assert (q2.Count == ++q2size);
+ for (int i = 0; i < 50; i++) {
+ int k = (int) q1.Peek ();
+ Assert (q1.Count == q1size);
+ int j = (int) q1.Dequeue ();
+ Assert (q1.Count == --q1size);
+ Assert (i == j);
+ Assert (j == k);
+ q2.Enqueue (j);
+ Assert (q2.Count == ++q2size);
+ }
+ for (int i = 50; i < 100; i++) {
+ Assert (((int) q2.Dequeue ()) == i);
+ Assert (q2.Count == --q2size);
+ }
+ Assert (q2.Peek () == null);
+ Assert (q2.Dequeue () == null);
+ Assert (q2.Count == --q2size);
+ for (int i = 0; i < 50; i++) {
+ Assert (((int) q2.Dequeue ()) == i);
+ Assert (q2.Count == --q2size);
+ }
+ }
+
+ public void DequeueTest() {
+ Queue queue = new Queue();
+ string[] tmp = new string[50];
+ int i;
+ for (i=0;i<50;i++) {
+ tmp[i] = "Data #" + i;
+ queue.Enqueue(tmp[i]);
+ }
+
+ while(queue.Count>0){
+ i--;
+ string z = (string) queue.Dequeue();
+ AssertEquals (tmp[i], tmp[i], z);
+ }
+ }
+
+ // TODO: test Syncronized operation
+
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs b/mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs
new file mode 100644
index 00000000000..0aa74804d63
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs
@@ -0,0 +1,39 @@
+//
+// System.Collections.ReadOnlyCollectionBase
+// Test suite for System.Collections.ReadOnlyCollectionBase
+//
+// Author:
+// Nick D. Drochak II
+//
+// (C) 2001 Nick D. Drochak II
+//
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections {
+ public class ReadOnlyCollectionBaseTest : TestCase {
+ // We need a concrete class to test the abstract base class
+ public class ConcreteReadOnlyCollection : ReadOnlyCollectionBase
+ {
+ }
+
+ // Make sure that the Count is 0 for a new object
+ public void TestZeroCountOnNew()
+ {
+ ConcreteReadOnlyCollection myCollection;
+ myCollection = new ConcreteReadOnlyCollection();
+ Assert(0 == myCollection.Count);
+ }
+
+ // Make sure we get an object from GetEnumerator()
+ public void TestGetEnumerator()
+ {
+ ConcreteReadOnlyCollection myCollection;
+ myCollection = new ConcreteReadOnlyCollection();
+ Assert(null != myCollection.GetEnumerator());
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Collections/SortedListTest.cs b/mcs/class/corlib/Test/System.Collections/SortedListTest.cs
new file mode 100755
index 00000000000..5f9d4ec85ae
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/SortedListTest.cs
@@ -0,0 +1,612 @@
+// SortedListTest.cs - NUnit Test Cases for the System.Collections.SortedList class
+//
+// Jaak Simm
+//
+// Thanks go to David Brandt (bucky@keystreams.com),
+// because this file is based on his ArrayListTest.cs
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// main TODO: additional tests for functions affected by
+// fixedsize and read-only properties
+
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+namespace MonoTests.System.Collections {
+
+
+/// <summary>SortedList test.</summary>
+public class SortedListTest : TestCase {
+ protected SortedList sl1;
+ protected SortedList sl2;
+ protected SortedList emptysl;
+ protected const int icap=16;
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public void TestConstructor1() {
+ SortedList temp1 = new SortedList();
+ AssertNotNull("sl.constructor-1: returns null", temp1);
+ AssertEquals("sl.constructor-1: incorrect initial capacity", icap, temp1.Capacity);
+ }
+
+ public void TestConstructor2() {
+ Comparer c = Comparer.Default;
+ SortedList temp1 = new SortedList(c);
+ AssertNotNull("sl.constructor-2: returns null", temp1);
+ AssertEquals("sl.constructor-2: incorrect initial capacity", icap, temp1.Capacity);
+ }
+
+ public void TestConstructor3() {
+ Hashtable d = new Hashtable();
+ d.Add("one", "Mircosoft");
+ d.Add("two", "will");
+ d.Add("three", "rule");
+ d.Add("four", "the world");
+
+ SortedList temp1 = new SortedList(d);
+ AssertNotNull("sl.constructor-3: returns null", temp1);
+ AssertEquals("sl.constructor-3: incorrect initial capacity", 4, temp1.Capacity);
+ AssertEquals("sl.constructor-3: incorrect count", 4, temp1.Count);
+
+ try {
+ d=null;
+ temp1 = new SortedList(d);
+ Fail ("sl.constructor-3: does not throw ArgumentNullException");
+ } catch (ArgumentNullException) {}
+ try {
+ d = new Hashtable();
+ d.Add("one", "Mircosoft");
+ d.Add("two", "will");
+ d.Add("three", "rule");
+ d.Add("four", "the world");
+ d.Add(7987,"lkj");
+ temp1 = new SortedList(d);
+ Fail ("sl.constructor-3: does not throw InvalidCastException");
+ } catch (InvalidOperationException) {
+ } catch (Exception e) {
+ Fail ("Unexpected Exception throw: e=" + e);
+ }
+ }
+
+ public void TestConstructor4() {
+ SortedList temp1 = new SortedList(17);
+ AssertNotNull("sl.constructor-4: returns null", temp1);
+ AssertEquals("sl.constructor-4: incorrect initial capacity", temp1.Capacity, 17);
+ try {
+ temp1 = new SortedList(-6);
+ Fail ("sl.constructor-4: does not throw ArgumentOutOfRangeException, with negative values");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ temp1 = new SortedList(0);
+ } catch (ArgumentOutOfRangeException) {
+ Fail ("sl.constructor-4: throws ArgumentOutOfRangeException with 0");
+ }
+ }
+
+ public void TestConstructor5() {
+ Comparer c = Comparer.Default;
+ SortedList temp1 = new SortedList(c,27);
+ AssertNotNull("sl.constructor-5: returns null", temp1);
+ AssertEquals("sl.constructor-5: incorrect initial capacity", temp1.Capacity, 27);
+ try {
+ temp1 = new SortedList(-12);
+ Fail ("sl.constructor-5: does not throw ArgumentOutOfRangeException, with negative values");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestIsSynchronized() {
+ SortedList sl1 = new SortedList();
+ Assert("sl: should not be synchronized by default",
+ !sl1.IsSynchronized);
+ SortedList sl2 = SortedList.Synchronized(sl1);
+ Assert("sl: synchronized wrapper not working", sl2.IsSynchronized);
+ }
+
+ public void TestCapacity() {
+ for (int i = 0; i < 100; i++) {
+ SortedList sl1 = new SortedList(i);
+ AssertEquals("Bad capacity of " + i,
+ i, sl1.Capacity);
+ }
+ }
+
+ public void TestCount() {
+ {
+ SortedList sl1 = new SortedList();
+ AssertEquals("Bad initial count",
+ 0, sl1.Count);
+ for (int i = 1; i <= 100; i++) {
+ sl1.Add(""+i,""+i);
+ AssertEquals("Bad count " + i,
+ i, sl1.Count);
+ }
+ }
+ }
+
+ public void TestIsFixed() {
+ SortedList sl1 = new SortedList();
+ Assert("should not be fixed by default", !sl1.IsFixedSize);
+ }
+
+ public void TestIsReadOnly() {
+ SortedList sl1 = new SortedList();
+ Assert("should not be ReadOnly by default", !sl1.IsReadOnly);
+ }
+
+
+ public void TestItem() {
+ SortedList sl1 = new SortedList();
+ string key = null;
+ {
+ try {
+ object o = sl1[-1];
+ } catch (ArgumentNullException) {
+ Fail ("sl.Item: throws ArgumentNullException with negative values");
+ }
+ try {
+ object o = sl1[key];
+ Fail ("sl.Item: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+ }
+
+ for (int i = 0; i <= 100; i++) {
+ sl1.Add("kala "+i,i);
+ }
+ for (int i = 0; i <= 100; i++) {
+ AssertEquals("sl.Item: item not fetched for " + i,
+ i, sl1["kala "+i]);
+ }
+ }
+
+ public void TestSyncRoot()
+ {
+ SortedList sl1 = new SortedList();
+ AssertEquals("sl.SyncRoot: does not function",false, sl1.SyncRoot == null);
+ /*
+ lock( sl1.SyncRoot ) {
+ foreach ( Object item in sl1 ) {
+ item="asdf";
+ Assert ("sl.SyncRoot: item not read-only",item.IsReadOnly);
+ }
+ }
+ */
+ }
+
+ public void TestValues()
+ {
+ SortedList sl1 = new SortedList();
+ ICollection ic1 = sl1.Values;
+ for (int i = 0; i <= 100; i++) {
+ sl1.Add("kala "+i,i);
+ AssertEquals("sl.Values: .Values has different count",ic1.Count,sl1.Count);
+ }
+ }
+
+
+ // TODO: Add with IComparer
+ public void TestAdd() {
+ // seems SortedList cannot be set fixedsize or readonly
+ SortedList sl1 = new SortedList();
+ string key = null;
+ {
+ try {
+ sl1.Add(key,"kala");
+ Fail ("sl.Add: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+ }
+
+ {
+ for (int i = 1; i <= 100; i++) {
+ sl1.Add("kala "+i,i);
+ AssertEquals("sl.Add: incorrect count",i,sl1.Count);
+ AssertEquals("sl.Add: incorrect value",i,sl1["kala "+i]);
+ }
+ }
+ {
+ try {
+ sl1.Add("kala",10);
+ sl1.Add("kala",11);
+ Fail ("sl.Add: does not throw ArgumentException when adding existing key");
+ } catch (ArgumentException) {}
+ }
+ }
+
+ public void TestClear() {
+ SortedList sl1 = new SortedList(10);
+ sl1.Add("kala", 'c');
+ sl1.Add("kala2", 'd');
+ AssertEquals("sl.Clear: capacity is incorrect", 10, sl1.Capacity);
+ AssertEquals("sl.Clear: should have one element", 2, sl1.Count);
+ sl1.Clear();
+ AssertEquals("sl.Clear: is not cleared", 0, sl1.Count);
+ AssertEquals("sl.Clear: capacity is altered", 16, sl1.Capacity);
+ }
+
+ public void TestClone() {
+ {
+ SortedList sl1 = new SortedList(10);
+ for (int i = 0; i <= 50; i++) {sl1.Add("kala "+i,i);}
+ SortedList sl2 = (SortedList)sl1.Clone();
+ for (int i = 0; i <= 50; i++) {
+ AssertEquals("sl.Clone: copying failed @"+i, sl1["kala "+i], sl2["kala "+i]);
+ }
+ }
+ {
+ char[] d10 = {'a', 'b'};
+ char[] d11 = {'a', 'c'};
+ char[] d12 = {'b', 'c'};
+ //char[][] d1 = {d10, d11, d12};
+ SortedList sl1 = new SortedList();
+ sl1.Add("d1",d10);
+ sl1.Add("d2",d11);
+ sl1.Add("d3",d12);
+ SortedList sl2 = (SortedList)sl1.Clone();
+ AssertEquals("sl.Clone: Array not matching", sl1["d1"], sl2["d1"]);
+ AssertEquals("sl.Clone: Array not matching", sl1["d2"], sl2["d2"]);
+ AssertEquals("sl.Clone: Array not matching", sl1["d3"], sl2["d3"]);
+
+ ((char[])sl1["d1"])[0] = 'z';
+ AssertEquals("s1.Clone: shallow copy", sl1["d1"], sl2["d1"]);
+ }
+ }
+
+ public void TestContains() {
+ SortedList sl1 = new SortedList(55);
+ for (int i = 0; i <= 50; i++) {sl1.Add("kala "+i,i);}
+
+ try {
+ if (sl1.Contains(null)){}
+ Fail ("sl.Contains: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+
+ Assert("sl.Contains: can't find existing key", sl1.Contains("kala 17"));
+ Assert("sl.Contains: finds non-existing key", !sl1.Contains("ohoo"));
+ }
+
+ public void TestContainsKey() {
+ SortedList sl1 = new SortedList(55);
+ for (int i = 0; i <= 50; i++) {sl1.Add("kala "+i,i);}
+
+ try {
+ if (sl1.ContainsKey(null)){}
+ Fail ("sl.ContainsKey: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+
+ Assert("sl.ContainsKey: can't find existing key", sl1.ContainsKey("kala 17"));
+ Assert("sl.ContainsKey: finds non-existing key", !sl1.ContainsKey("ohoo"));
+ }
+
+ public void TestContainsValue() {
+ SortedList sl1 = new SortedList(55);
+ sl1.Add(0, "zero");
+ sl1.Add(1, "one");
+ sl1.Add(2, "two");
+ sl1.Add(3, "three");
+ sl1.Add(4, "four");
+ Assert("sl.ContainsValue: can't find existing value", sl1.ContainsValue("zero"));
+ Assert("sl.ContainsValue: finds non-existing value", !sl1.ContainsValue("ohoo"));
+ Assert("sl.ContainsValue: finds non-existing value", !sl1.ContainsValue(null));
+ }
+
+ public void TestCopyTo() {
+ SortedList sl1 = new SortedList();
+ for (int i = 0; i <= 10; i++) {sl1.Add("kala "+i,i);}
+ {
+ try {
+ sl1.CopyTo(null, 2);
+ Fail("sl.CopyTo: does not throw ArgumentNullException when target null");
+ } catch (ArgumentNullException) {}
+ }
+ {
+ try {
+ Char[,] c2 = new Char[2,2];
+ sl1.CopyTo(c2, 2);
+ Fail("sl.CopyTo: does not throw ArgumentException when target is multiarray");
+ } catch (ArgumentException) {}
+ }
+ {
+ try {
+ Char[] c1 = new Char[2];
+ sl1.CopyTo(c1, -2);
+ Fail("sl.CopyTo: does not throw ArgumentOutOfRangeException when index is negative");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+ {
+ try {
+ Char[] c1 = new Char[2];
+ sl1.CopyTo(c1, 3);
+ Fail("sl.CopyTo: does not throw ArgumentException when index is too large");
+ } catch (ArgumentException) {}
+ }
+ {
+ try {
+ Char[] c1 = new Char[2];
+ sl1.CopyTo(c1, 1);
+ Fail("sl.CopyTo: does not throw ArgumentException when SortedList too big for the array");
+ } catch (ArgumentException) {}
+ }
+ {
+ try {
+ Char[] c2 = new Char[15];
+ sl1.CopyTo(c2, 0);
+ Fail("sl.CopyTo: does not throw InvalidCastException when incompatible data types");
+ } catch (InvalidCastException) {}
+ }
+
+ // CopyTo function does not work well with SortedList
+ // even example at MSDN gave InvalidCastException
+ // thus, it is NOT tested here
+ /*
+ sl1.Clear();
+ for (int i = 0; i <= 5; i++) {sl1.Add(i,""+i);}
+ Char[] copy = new Char[15];
+ Array.Clear(copy,0,copy.Length);
+ copy.SetValue( "The", 0 );
+ copy.SetValue( "quick", 1 );
+ copy.SetValue( "brown", 2 );
+ copy.SetValue( "fox", 3 );
+ copy.SetValue( "jumped", 4 );
+ copy.SetValue( "over", 5 );
+ copy.SetValue( "the", 6 );
+ copy.SetValue( "lazy", 7 );
+ copy.SetValue( "dog", 8 );
+ sl1.CopyTo(copy,1);
+ AssertEquals("sl.CopyTo: incorrect copy(1).","The", copy.GetValue(0));
+ AssertEquals("sl.CopyTo: incorrect copy(1).","quick", copy.GetValue(1));
+ for (int i=2; i<8; i++) AssertEquals("sl.CopyTo: incorrect copy(2).",sl1["kala "+(i-2)], copy.GetValue(i));
+ AssertEquals("sl.CopyTo: incorrect copy(3).","dog", copy.GetValue(8));
+ */
+ }
+
+ public SortedList DefaultSL() {
+ SortedList sl1 = new SortedList();
+ sl1.Add( 1.0, "The" );
+ sl1.Add( 1.1, "quick" );
+ sl1.Add( 34.0, "brown" );
+ sl1.Add( -100.75, "fox" );
+ sl1.Add( 1.4, "jumped" );
+ sl1.Add( 1.5, "over" );
+ sl1.Add( 1.6, "the" );
+ sl1.Add( 1.7, "lazy" );
+ sl1.Add( 1.8, "dog" );
+ return sl1;
+ }
+
+ public IList DefaultValues() {
+ IList il = new ArrayList();
+ il.Add( "fox" );
+ il.Add( "The" );
+ il.Add( "quick" );
+ il.Add( "jumped" );
+ il.Add( "over" );
+ il.Add( "the" );
+ il.Add( "lazy" );
+ il.Add( "dog" );
+ il.Add( "brown" );
+ return il;
+ }
+
+ public void TestGetByIndex() {
+ SortedList sl1 = DefaultSL();
+ AssertEquals("cl.GetByIndex: failed(1)",sl1.GetByIndex(4),"over");
+ AssertEquals("cl.GetByIndex: failed(2)",sl1.GetByIndex(8),"brown");
+ try {
+ sl1.GetByIndex(-1);
+ Fail("sl.GetByIndex: does not throw ArgumentOutOfRangeException with negative index");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.GetByIndex(100);
+ Fail("sl.GetByIndex: does not throw ArgumentOutOfRangeException with too large index");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestGetEnumerator() {
+ SortedList sl1 = DefaultSL();
+ IDictionaryEnumerator e = sl1.GetEnumerator();
+ AssertNotNull("sl.GetEnumerator: does not return enumerator", e);
+ AssertEquals("sl.GetEnumerator: enumerator not working(1)",e.MoveNext(),true);
+ AssertNotNull("sl.GetEnumerator: enumerator not working(2)",e.Current);
+ }
+
+ public void TestGetKey() {
+ SortedList sl1 = DefaultSL();
+ AssertEquals("sl.GetKey: failed(1)",sl1.GetKey(4),1.5);
+ AssertEquals("sl.GetKey: failed(2)",sl1.GetKey(8),34.0);
+ try {
+ sl1.GetKey(-1);
+ Fail("sl.GetKey: does not throw ArgumentOutOfRangeException with negative index");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.GetKey(100);
+ Fail("sl.GetKey: does not throw ArgumentOutOfRangeException with too large index");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestGetKeyList() {
+ SortedList sl1 = DefaultSL();
+ IList keys = sl1.GetKeyList();
+ AssertNotNull("sl.GetKeyList: does not return keylist", keys);
+ Assert("sl.GetKeyList: keylist is not readonly", keys.IsReadOnly);
+ AssertEquals("sl.GetKeyList: incorrect keylist size",keys.Count,9);
+ AssertEquals("sl.GetKeyList: incorrect key(1)",keys[3],1.4);
+ sl1.Add(33.9,"ehhe");
+ AssertEquals("sl.GetKeyList: incorrect keylist size",keys.Count,10);
+ AssertEquals("sl.GetKeyList: incorrect key(2)",keys[8],33.9);
+ }
+
+ public void TestGetValueList() {
+ SortedList sl1 = DefaultSL();
+ IList originalvals = DefaultValues();
+ IList vals = sl1.GetValueList();
+ AssertNotNull("sl.GetValueList: does not return valuelist", vals);
+ Assert("sl.GetValueList: valuelist is not readonly", vals.IsReadOnly);
+ AssertEquals("sl.GetValueList: incorrect valuelist size",vals.Count,sl1.Count);
+ for (int i=0; i<sl1.Count; i++) {
+ AssertEquals("sl.GetValueList: incorrect key(1)",vals[i],originalvals[i]);
+ }
+
+ sl1.Add(0.01,"ehhe");
+ AssertEquals("sl.GetValueList: incorrect valuelist size",vals.Count,10);
+ AssertEquals("sl.GetValueList: incorrect value(2)",vals[8],"dog");
+ }
+
+ // TODO: IEnumerable.GetEnumerator [Explicit Interface Implementation]
+ /*
+ public void TestIEnumerable_GetEnumerator() {
+ SortedList sl1 = DefaultSL();
+ IEnumerator e = sl1.IEnumerable.GetEnumerator();
+ AssertNotNull("sl.GetEnumerator: does not return enumerator", e);
+ AssertEquals("sl.GetEnumerator: enumerator not working(1)",e.MoveNext(),true);
+ AssertNotNull("sl.GetEnumerator: enumerator not working(2)",e.Current);
+ }
+ */
+
+ public void TestIndexOfKey() {
+ SortedList sl1 = new SortedList(24);
+ string s=null;
+ int t;
+ for (int i = 0; i <= 50; i++) {
+ s=string.Format("{0:D2}", i);
+ sl1.Add("kala "+s,i);
+ }
+ AssertEquals("sl.IndexOfKey: does not return -1 for non-existing key", -1, sl1.IndexOfKey("kala "));
+ s=null;
+ try {
+ t=sl1.IndexOfKey(s);
+ Fail("sl.IndexOfKey: ArgumentNullException not caught, when key is null");
+ }
+ catch (ArgumentNullException) {}
+ try {
+ t=sl1.IndexOfKey(10);
+ Fail("sl.IndexOfKey: InvalidOperationException not caught, when key invalid");
+ }
+ catch (InvalidOperationException) {}
+ for (int i=0; i<=50; i++) {
+ s=string.Format("{0:D2}", i);
+ AssertEquals("sl.IndexOfKey: incorrect index key", i, sl1.IndexOfKey("kala "+s));
+ }
+ }
+
+ public void TestIndexOfValue() {
+ SortedList sl1 = new SortedList(24);
+ string s=null;
+ for (int i = 0; i < 50; i++) {
+ s=string.Format("{0:D2}", i);
+ sl1.Add("kala "+s,100+i*i);
+ }
+ for (int i = 0; i < 50; i++) {
+ s=string.Format("{0:D2}", i+50);
+ sl1.Add("kala "+s,100+i*i);
+ }
+ AssertEquals("sl.IndexOfValue: does not return -1 for non-existing value(1)", -1, sl1.IndexOfValue(102));
+ AssertEquals("sl.IndexOfValue: does not return -1 for non-existing value(2)", -1, sl1.IndexOfValue(null));
+ for (int i=0; i<50; i++) {
+ AssertEquals("sl.IndexOfValue: incorrect index key", i, sl1.IndexOfValue(100+i*i));
+ }
+ }
+
+
+ public void TestRemove() {
+ SortedList sl1 = new SortedList(24);
+ string s=null;
+ int k;
+ for (int i = 0; i < 50; i++) sl1.Add("kala "+i,i);
+
+ try {
+ sl1.Remove(s);
+ Fail("sl.Remove: ArgumentNullException not caught, when key is null");
+ } catch (ArgumentNullException) {}
+ k=sl1.Count;
+ sl1.Remove("kala ");
+ AssertEquals("sl.Remove: removes an item, when non-existing key given",sl1.Count,k);
+ try {
+ sl1.Remove(15);
+ Fail("sl.Remove: IComparer exception is not thrown");
+ } catch (Exception) {}
+
+ for (int i=15; i<20; i++) sl1.Remove("kala "+i);
+ for (int i=45; i<55; i++) sl1.Remove("kala "+i);
+
+ AssertEquals("sl.Remove: removing failed",sl1.Count,40);
+ for (int i=45; i<55; i++)
+ AssertEquals("sl.Remove: removing failed(2)",sl1["kala "+i],null);
+ }
+
+ public void TestRemoveAt() {
+ SortedList sl1 = new SortedList(24);
+ int k;
+ string s=null;
+ for (int i = 0; i < 50; i++) {
+ s=string.Format("{0:D2}", i);
+ sl1.Add("kala "+s,i);
+ }
+
+ try {
+ sl1.RemoveAt(-1);
+ Fail("sl.RemoveAt: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.RemoveAt(100);
+ Fail("sl.RemoveAt: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+ k=sl1.Count;
+
+ for (int i=0; i<20; i++) sl1.RemoveAt(9);
+
+ AssertEquals("sl.RemoveAt: removing failed",sl1.Count,30);
+ for (int i=0; i<9; i++)
+ AssertEquals("sl.RemoveAt: removing failed(2)",sl1["kala "+string.Format("{0:D2}", i)],i);
+ for (int i=9; i<29; i++)
+ AssertEquals("sl.RemoveAt: removing failed(3)",sl1["kala "+string.Format("{0:D2}", i)],null);
+ for (int i=29; i<50; i++)
+ AssertEquals("sl.RemoveAt: removing failed(4)",sl1["kala "+string.Format("{0:D2}", i)],i);
+ }
+
+ public void TestSetByIndex() {
+ SortedList sl1 = new SortedList(24);
+ for (int i = 49; i>=0; i--) sl1.Add(100+i,i);
+
+ try {
+ sl1.SetByIndex(-1,77);
+ Fail("sl.SetByIndex: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.SetByIndex(100,88);
+ Fail("sl.SetByIndex: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+
+ for(int i=5; i<25; i++) sl1.SetByIndex(i,-1);
+ for(int i=0; i<5; i++)
+ AssertEquals("sl.SetByIndex: set failed(1)",sl1[100+i],i);
+ for(int i=5; i<25; i++)
+ AssertEquals("sl.SetByIndex: set failed(2)",sl1[100+i],-1);
+ for(int i=25; i<50; i++)
+ AssertEquals("sl.SetByIndex: set failed(3)",sl1[100+i],i);
+
+ }
+
+ public void TestTrimToSize() {
+ SortedList sl1 = new SortedList(24);
+
+ sl1.TrimToSize();
+ AssertEquals("sl.TrimToSize: incorrect capacity after trimming empty list",icap,sl1.Capacity);
+
+ for (int i = 72; i>=0; i--) sl1.Add(100+i,i);
+ sl1.TrimToSize();
+ AssertEquals("sl.TrimToSize: incorrect capacity after trimming a list",73,sl1.Capacity);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/StackTest.cs b/mcs/class/corlib/Test/System.Collections/StackTest.cs
new file mode 100644
index 00000000000..31b37800058
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/StackTest.cs
@@ -0,0 +1,233 @@
+//
+// StackTest.cs
+//
+// Author:
+// Chris Hynes <chrish@assistedsolutions.com>
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections
+{
+ public class StackTest: TestCase
+ {
+ private Stack stack1;
+ private Stack stack2;
+ private Stack stackInt;
+
+ public void TestConstructor()
+ {
+ AssertEquals(false, stack1 == null);
+ }
+
+ public void TestICollectionConstructor()
+ {
+ Stack stackTest = new Stack(new int[] {0, 1, 2, 3, 4});
+
+ for (int i = 4; i >= 0; i--)
+ AssertEquals(i, stackTest.Pop());
+
+ AssertEquals(0, stackTest.Count);
+ }
+
+ public void TestIntConstructor()
+ {
+ Stack stackTest = new Stack(50);
+
+ AssertEquals(false, stackTest == null);
+ }
+
+ public void TestCount()
+ {
+ Stack stackTest = new Stack();
+
+ stackTest.Push(50);
+ stackTest.Push(5);
+ stackTest.Push(0);
+ stackTest.Push(50);
+
+ AssertEquals(4, stackTest.Count);
+ }
+
+ public void TestIsSyncronized()
+ {
+ AssertEquals(false, stack1.IsSynchronized);
+ AssertEquals(true, Stack.Synchronized(stack1).IsSynchronized);
+ }
+
+ public void TestSyncRoot()
+ {
+ AssertEquals(false, stack1.SyncRoot == null);
+ }
+
+ public void TestGetEnumerator()
+ {
+ stackInt.Pop();
+
+ int j = 3;
+
+ foreach (int i in stackInt)
+ {
+ AssertEquals(j--, i);
+ }
+
+ stackInt.Clear();
+
+ IEnumerator e = stackInt.GetEnumerator();
+
+ AssertEquals(false, e.MoveNext());
+ }
+
+ public void TestClear()
+ {
+ stackInt.Clear();
+
+ AssertEquals(0, stackInt.Count);
+ }
+
+ public void TestClone()
+ {
+ Stack clone = (Stack)stackInt.Clone();
+
+ while (stackInt.Count > 0)
+ {
+ AssertEquals(stackInt.Pop(), clone.Pop());
+ }
+ }
+
+ public void TestContains()
+ {
+ string toLocate = "test";
+
+ stackInt.Push(toLocate);
+
+ stackInt.Push("chaff");
+
+ Assert(stackInt.Contains(toLocate));
+
+ stackInt.Pop();
+
+ Assert(stackInt.Contains(toLocate));
+
+ stackInt.Pop();
+
+ Assert(!stackInt.Contains(toLocate));
+ }
+
+ public void TestCopyTo()
+ {
+ int[] arr = new int[stackInt.Count - 1];
+ int[,] arrMulti;
+
+ try
+ {
+ stackInt.CopyTo(null, 0);
+ Fail("Should throw an ArgumentNullException");
+ }
+ catch (ArgumentNullException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr, -1);
+ Fail("Should throw an ArgumentOutOfRangeException");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ try
+ {
+ stackInt.CopyTo(arrMulti = new int[1, 1], 1);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr = new int[2], 3);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr = new int[3], 2);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr = new int[2], 3);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ arr = new int[stackInt.Count];
+
+ stackInt.CopyTo(arr, 0);
+
+ int j = 4;
+
+ for (int i = 0; i < 4; i++)
+ {
+ AssertEquals(j--, arr[i]);
+ }
+ }
+
+ public void TestSyncronized()
+ {
+ Stack syncStack = Stack.Synchronized(stackInt);
+
+ syncStack.Push(5);
+
+ for (int i = 5; i >= 0; i--)
+ AssertEquals(i, syncStack.Pop());
+ }
+
+ public void TestPushPeekPop()
+ {
+ stackInt.Pop();
+
+ int topVal = (int)stackInt.Peek();
+
+ AssertEquals(3, topVal);
+
+ AssertEquals(4, stackInt.Count);
+
+ AssertEquals(topVal, stackInt.Pop());
+
+ AssertEquals(2, stackInt.Pop());
+
+ Stack test = new Stack();
+ test.Push(null);
+
+ AssertEquals(null, test.Pop());
+ }
+
+ public void TestToArray()
+ {
+ object[] arr = stackInt.ToArray();
+
+ AssertEquals(stackInt.Count, arr.Length);
+
+ for (int i = 0; i < 5; i++)
+ AssertEquals(arr[i], stackInt.Pop());
+ }
+
+ protected override void SetUp()
+ {
+ stack1 = new Stack();
+ stack2 = new Stack();
+
+ stackInt = new Stack();
+
+ for (int i = 0; i < 5; i++)
+ stackInt.Push(i);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/AllTests.cs b/mcs/class/corlib/Test/System.Diagnostics/AllTests.cs
new file mode 100644
index 00000000000..d6eab84474c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/AllTests.cs
@@ -0,0 +1,32 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(DebugTest.Suite);
+ suite.AddTest(StackTraceTest.Suite);
+ suite.AddTest(StackFrameTest.Suite);
+ suite.AddTest(TextWriterTraceListenerTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Diagnostics/ChangeLog b/mcs/class/corlib/Test/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..ec5df0b50ab
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/ChangeLog
@@ -0,0 +1,12 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-06-19 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add missing test: DebugTest
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * DebugTest.cs: Put in correct namespace.
+ * TextWriterTraceListenerTest.cs: Put in correct namespace.
diff --git a/mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs b/mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs
new file mode 100644
index 00000000000..87d82145492
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs
@@ -0,0 +1,61 @@
+//
+// MonoTests.System.Diagnostics.DebugTest.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2002
+using System;
+using System.Diagnostics;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics
+{
+ public class DebugTest
+ {
+ private class DebugTest1 : TestCase
+ {
+ protected override void SetUp()
+ {
+ Debug.Listeners.Add(new TextWriterTraceListener(Console.Error));
+ }
+
+ protected override void TearDown()
+ {
+
+ }
+
+ public void TestAssert()
+ {
+ Debug.Assert(false, "Testing Assertions");
+ }
+
+ public void TestFail()
+ {
+ Debug.Fail("Testing Fail method");
+ }
+
+ public void TestWrite()
+ {
+ Debug.Write("Testing Write", "Testing the output of the Write method");
+ }
+
+ public void TestWriteIf()
+ {
+ Debug.WriteIf(true, "Testing WriteIf");
+ Debug.WriteIf(false, "Testing WriteIf", "Passed false");
+ }
+
+ public void TestWriteLine()
+ {
+ Debug.WriteLine("Testing WriteLine method");
+ }
+
+ public void TestWriteLineIf()
+ {
+ Debug.WriteLineIf(true, "Testing WriteLineIf");
+ Debug.WriteLineIf(false, "Testing WriteLineIf", "Passed false");
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs
new file mode 100644
index 00000000000..9f7c40bb901
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs
@@ -0,0 +1,304 @@
+//
+// MonoTests.System.Diagnostics.StackFrameTest.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics {
+ /// <summary>
+ /// Tests the case where StackFrame is created for specified file name and
+ /// location inside it.
+ /// </summary>
+ [TestFixture]
+ public class StackFrameTest1 : TestCase {
+ private StackFrame frame1;
+ private StackFrame frame2;
+
+ protected override void SetUp() {
+ frame1 = new StackFrame("dir/someFile", 13, 45);
+ frame2 = new StackFrame("SomeFile2.cs", 24);
+ }
+
+ protected override void TearDown() {
+ frame1 = null;
+ frame2 = null;
+ }
+
+ /// <summary>
+ /// Tests whether getting file name works.
+ /// </summary>
+ public void TestGetFileName() {
+ AssertEquals("File name (1)",
+ "dir/someFile",
+ frame1.GetFileName());
+
+ AssertEquals("File name (2)",
+ "SomeFile2.cs",
+ frame2.GetFileName());
+ }
+
+ /// <summary>
+ /// Tests whether getting file line number works.
+ /// </summary>
+ public void TestGetFileLineNumber() {
+ AssertEquals("Line number (1)",
+ 13,
+ frame1.GetFileLineNumber());
+
+ AssertEquals("Line number (2)",
+ 24,
+ frame2.GetFileLineNumber());
+ }
+
+ /// <summary>
+ /// Tests whether getting file column number works.
+ /// </summary>
+ public void TestGetFileColumnNumber() {
+ AssertEquals("Column number (1)",
+ 45,
+ frame1.GetFileColumnNumber());
+
+ AssertEquals("Column number (2)",
+ 0,
+ frame2.GetFileColumnNumber());
+ }
+
+
+ /// <summary>
+ /// Tests whether getting method associated with frame works.
+ /// </summary>
+ public void TestGetMethod() {
+ Assert("Method not null (1)", (frame1.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (1)",
+ this.GetType(),
+ frame1.GetMethod().DeclaringType);
+ AssertEquals("Method name (1)",
+ "SetUp",
+ frame1.GetMethod().Name);
+
+ Assert("Method not null (2)", (frame2.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (2)",
+ this.GetType(),
+ frame2.GetMethod().DeclaringType);
+ AssertEquals("Method name (2)",
+ "SetUp",
+ frame2.GetMethod().Name);
+ }
+ }
+
+ /// <summary>
+ /// Tests the case where StackFrame is created for current method.
+ /// </summary>
+ /// <remarks>
+ /// FIXME: Must be compiled with /debug switch. Otherwise some file
+ /// information will be incorrect for the following test cases.
+ /// What's the best way to do both types of tests with and without
+ /// debug information?
+ /// </remarks>
+ [TestFixture]
+ public class StackFrameTest2 : TestCase {
+ private StackFrame frame1;
+ private StackFrame frame2;
+ private StackFrame frame3;
+
+ protected override void SetUp() {
+ frame1 = new StackFrame();
+ frame2 = new StackFrame(true);
+ frame3 = new StackFrame(0);
+ }
+
+ protected override void TearDown() {
+ frame1 = null;
+ frame2 = null;
+ frame3 = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting file name works.
+ /// </summary>
+ public void TestGetFileName() {
+ AssertNull("File name (1)",
+ frame1.GetFileName());
+
+ Assert("File name (2) " + frame2.GetFileName()
+ + " ends with StackFrameTest.cs",
+ frame2.GetFileName().EndsWith("StackFrameTest.cs"));
+ }
+
+ /// <summary>
+ /// Tests whether getting file line number works.
+ /// </summary>
+ public void TestGetFileLineNumber() {
+ AssertEquals("Line number (1)",
+ 0,
+ frame1.GetFileLineNumber());
+
+ AssertEquals("Line number (2)",
+ 116,
+ frame2.GetFileLineNumber());
+
+ AssertEquals("Line number (3)",
+ 0,
+ frame3.GetFileLineNumber());
+ }
+
+ /// <summary>
+ /// Tests whether getting file column number works.
+ /// </summary>
+ public void TestGetFileColumnNumber() {
+ AssertEquals("Column number (1)",
+ 0,
+ frame1.GetFileColumnNumber());
+
+ AssertEquals("Column number (2)",
+ 25,
+ frame2.GetFileColumnNumber());
+
+ AssertEquals("Column number (3)",
+ 0,
+ frame3.GetFileColumnNumber());
+ }
+
+
+ /// <summary>
+ /// Tests whether getting method associated with frame works.
+ /// </summary>
+ public void TestGetMethod() {
+ Assert("Method not null (1)",
+ (frame1.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (1)",
+ this.GetType(),
+ frame1.GetMethod().DeclaringType);
+ AssertEquals("Method name (1)",
+ "SetUp",
+ frame1.GetMethod().Name);
+
+ Assert("Method not null (2)",
+ (frame2.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (2)",
+ this.GetType(),
+ frame2.GetMethod().DeclaringType);
+ AssertEquals("Method name (2)",
+ "SetUp",
+ frame2.GetMethod().Name);
+
+ Assert("Method not null (3)",
+ (frame3.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (3)",
+ this.GetType(),
+ frame3.GetMethod().DeclaringType);
+ AssertEquals("Method name (3)",
+ "SetUp",
+ frame3.GetMethod().Name);
+ }
+ }
+
+
+ /// <summary>
+ /// Tests the case where StackFrame is created for current method but
+ /// skipping some frames.
+ /// </summary>
+ /// <remarks>
+ /// FIXME: Must be compiled with /debug switch. Otherwise some file
+ /// information will be incorrect for the following test cases.
+ /// What's the best way to do both types of tests with and without
+ /// debug information?
+ /// </remarks>
+ [TestFixture]
+ public class StackFrameTest3 : TestCase {
+ private StackFrame frame1;
+ private StackFrame frame2;
+
+ protected override void SetUp() {
+ // In order to get better test cases with stack traces
+ NestedSetUp();
+ }
+
+ private void NestedSetUp() {
+ frame1 = new StackFrame(2);
+ frame2 = new StackFrame(1, true);
+ }
+
+ protected override void TearDown() {
+ frame1 = null;
+ frame2 = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting file name works.
+ /// </summary>
+ public void TestGetFileName() {
+ AssertNull("File name (1)",
+ frame1.GetFileName());
+
+ Assert("File name (2) " + frame2.GetFileName()
+ + " ends with StackFrameTest.cs",
+ frame2.GetFileName().EndsWith("StackFrameTest.cs"));
+ }
+
+ /// <summary>
+ /// Tests whether getting file line number works.
+ /// </summary>
+ public void TestGetFileLineNumber() {
+ AssertEquals("Line number (1)",
+ 0,
+ frame1.GetFileLineNumber());
+
+ AssertEquals("Line number (2)",
+ 230,
+ frame2.GetFileLineNumber());
+ }
+
+ /// <summary>
+ /// Tests whether getting file column number works.
+ /// </summary>
+ public void TestGetFileColumnNumber() {
+ AssertEquals("Column number (1)",
+ 0,
+ frame1.GetFileColumnNumber());
+
+ AssertEquals("Column number (2)",
+ 17,
+ frame2.GetFileColumnNumber());
+ }
+
+
+ /// <summary>
+ /// Tests whether getting method associated with frame works.
+ /// </summary>
+ public void TestGetMethod() {
+ Assert("Method not null (1)", (frame1.GetMethod() != null));
+
+ AssertEquals("Method name (1)",
+ "InternalInvoke",
+ frame1.GetMethod().Name);
+
+ Assert("Method not null (2)", (frame2.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (2)",
+ this.GetType(),
+ frame2.GetMethod().DeclaringType);
+
+ AssertEquals("Method name (2)",
+ "SetUp",
+ frame2.GetMethod().Name);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs b/mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs
new file mode 100644
index 00000000000..b27e97d292d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs
@@ -0,0 +1,76 @@
+//
+// MonoTests.System.Diagnostics.StackTraceTest.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics {
+ /// <summary>
+ /// Tests the case where StackTrace is created for specified
+ /// stack frame.
+ /// </summary>
+ [TestFixture]
+ public class StackTraceTest1 : TestCase {
+ private StackTrace trace;
+ private StackFrame frame;
+
+ protected override void SetUp() {
+ frame = new StackFrame("dir/someFile",
+ 13,
+ 45);
+ trace = new StackTrace(frame);
+ }
+
+ protected override void TearDown() {
+ trace = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting number of frames works.
+ /// </summary>
+ public void TestFrameCount() {
+ AssertEquals("Frame count",
+ 1,
+ trace.FrameCount);
+ }
+
+ /// <summary>
+ /// Tests whether getting frames by index which is out of
+ /// range works.
+ /// </summary>
+ public void TestGetFrameOutOfRange() {
+ Assert("Frame with index -1 == null",
+ (trace.GetFrame(-1) == null));
+
+ Assert("Frame with index -129 = null",
+ (trace.GetFrame(-129) == null));
+
+ Assert("Frame with index 1 = null",
+ (trace.GetFrame(1) == null));
+
+ Assert("Frame with index 145 = null",
+ (trace.GetFrame(145) == null));
+
+ }
+
+
+ /// <summary>
+ /// Tests whether getting frames by index works.
+ /// </summary>
+ public void TestGetFrame() {
+ AssertEquals("Frame with index 0",
+ frame,
+ trace.GetFrame(0));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs b/mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs
new file mode 100644
index 00000000000..3d5c4dc0365
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs
@@ -0,0 +1,53 @@
+//
+// MonoTests.System.Diagnostics.TextWriterTraceListenerTest.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+
+using System;
+using System.IO;
+using System.Text;
+using System.Diagnostics;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics
+{
+ [TestFixture]
+ public class TextWriterTraceListenerTest1 : TestCase
+ {
+ private TextWriterTraceListener listener;
+
+ protected override void SetUp()
+ {
+ listener = new TextWriterTraceListener();
+ listener.Writer = Console.Out;
+ }
+
+ protected override void TearDown()
+ {
+ listener = null;
+ }
+
+ public void TestWrite()
+ {
+ Assert("Null Listener", !(listener == null));
+ Assert("Null Writer", !(listener.Writer == null));
+ listener.Write("Test Message\n");
+
+ }
+
+ public void TestWriteLine()
+ {
+ Assert("Null Listener", !(listener == null));
+ Assert("Null Writer", !(listener.Writer == null));
+ listener.WriteLine("Test WriteLine Message");
+ }
+
+ public void TestFlush()
+ {
+ listener.Flush();
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Globalization/AllTests.cs b/mcs/class/corlib/Test/System.Globalization/AllTests.cs
new file mode 100644
index 00000000000..7d80e617556
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Globalization/AllTests.cs
@@ -0,0 +1,28 @@
+// System.Globalization/AllTests.cs
+//
+// (C) 2002 Ulrich Kunitz
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Globalization {
+
+/// <summary>
+/// Combines all available unit tests into one test suite.
+/// </summary>
+public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(CalendarTest.Suite);
+ return suite;
+ }
+ }
+} // class AllTests
+
+} // namespace MonoTests.System.Globalization
diff --git a/mcs/class/corlib/Test/System.Globalization/CalendarTest.cs b/mcs/class/corlib/Test/System.Globalization/CalendarTest.cs
new file mode 100644
index 00000000000..1b0ca5a332c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Globalization/CalendarTest.cs
@@ -0,0 +1,593 @@
+// CalendarTest.cs
+//
+// (C) 2002 Ulrich Kunitz
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.IO;
+
+namespace MonoTests.System.Globalization
+{
+
+sealed class Date {
+ private int _day, _month, _year, _era;
+
+ public int Day {
+ get {
+ return _day;
+ }
+ set {
+ if (value < 1 || value > 31)
+ throw new ArgumentOutOfRangeException(
+ "Day",
+ "Day must be between 1 and 31.");
+ _day = value;
+ }
+ }
+
+ public int Month {
+ get {
+ return _month;
+ }
+ set {
+ if (value < 1 || value > 13)
+ throw new ArgumentOutOfRangeException(
+ "Month",
+ "Month must be between 1 and 13.");
+ _month = value;
+ }
+ }
+
+ public int Year {
+ get {
+ return _year;
+ }
+ set {
+ _year = value;
+ }
+ }
+
+ public int Era {
+ get {
+ return _era;
+ }
+ set {
+ if (value < 1 || value > 10)
+ throw new ArgumentOutOfRangeException(
+ "Era",
+ "Era must be between 1 and 10.");
+ _era = value;
+ }
+ }
+
+ public Date(int day, int month, int year, int era) {
+ Day = day;
+ Month = month;
+ Year = year;
+ Era = era;
+ }
+ public Date(int day, int month, int year) : this(day,month,year,1) {}
+ public Date() : this(1,1,1,1) {}
+
+ public DateTime ToDateTime(Calendar cal) {
+ return cal.ToDateTime(Year,Month,Day,0,0,0,0,Era);
+ }
+
+ public void FromDateTime(Calendar cal, DateTime time) {
+ Date dmy = new Date();
+ dmy.Day = cal.GetDayOfMonth(time);
+ dmy.Month = cal.GetMonth(time);
+ dmy.Year = cal.GetYear(time);
+ dmy.Era = cal.GetEra(time);
+ Day = dmy.Day;
+ Month = dmy.Month;
+ Year = dmy.Year;
+ Era = dmy.Era;
+ }
+
+ public override string ToString() {
+ StringWriter sw = new StringWriter();
+ sw.Write("{0}.{1}.{2}", Day, Month, Year);
+ if (Era != 1) {
+ sw.Write(" era {0}", Era);
+ }
+ return sw.ToString();
+ }
+
+ public override bool Equals(Object b) {
+ if (b == null || GetType() != b.GetType())
+ return false;
+ return Equals(this, (Date)b);
+ }
+
+ public static bool Equals(Date a, Date b) {
+ if (a == b)
+ return true;
+ if (a.Year != b.Year)
+ return false;
+ if (a.Month != b.Month)
+ return false;
+ if (a.Day != b.Day)
+ return false;
+ if (a.Era != b.Era)
+ return false;
+ return true;
+ }
+
+ public override int GetHashCode() {
+ return ToString().GetHashCode();
+ }
+} // class Date
+
+public class CalendarTest : TestCase {
+ private Calendar[] acal;
+ private GregorianCalendar gcal;
+ private JulianCalendar jucal;
+ private HijriCalendar hical;
+ private HebrewCalendar hecal;
+ private JapaneseCalendar jacal;
+ private TaiwanCalendar tacal;
+ private KoreanCalendar kcal;
+ private ThaiBuddhistCalendar tbcal;
+
+ protected override void SetUp() {
+ gcal = new GregorianCalendar();
+ jucal = new JulianCalendar();
+ hical = new HijriCalendar();
+ hecal = new HebrewCalendar();
+ jacal = new JapaneseCalendar();
+ tacal = new TaiwanCalendar();
+ kcal = new KoreanCalendar();
+ tbcal = new ThaiBuddhistCalendar();
+ acal = new Calendar[] {
+ gcal, jucal, hical, hecal, jacal,
+ tacal, kcal, tbcal};
+ }
+
+ private void RowCheck(params Date[] adate) {
+ if (adate.Length != acal.Length)
+ throw new ArgumentException(
+ "Number of Date arguments doesn't match " +
+ "length of calendar array.");
+
+ DateTime timeG = adate[0].ToDateTime(gcal);
+ for (int i = 0; i < acal.Length; i++) {
+ Date date = adate[i];
+ if (date == null)
+ continue;
+ Calendar cal = acal[i];
+
+ DateTime time = date.ToDateTime(cal);
+ StringWriter sw = new StringWriter();
+ sw.Write("Calendar {0} computes wrong DateTime.",
+ cal);
+ AssertEquals(sw.ToString(), timeG, time);
+
+ sw = new StringWriter();
+ Date ndate = new Date();
+ ndate.FromDateTime(cal, time);
+ sw.Write("Calendar {0} computes wrong date", cal);
+ AssertEquals(sw.ToString(), date, ndate);
+ }
+ }
+
+ // We are testing the implementation against the reference dates in
+ // Calendrical Calcualation. Please note that the CLR uses another
+ // epoch for the HijriCalendar, which might be the perfect thing
+ // to do.
+ public void TestCCTable() {
+ // Gr Ju Hi He Ja Ta Ko TB
+ RowCheck(new Date(24,9,70,1),
+ new Date(26,9,70,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(24,9,2403,1),
+ new Date(24,9,613,1));
+ RowCheck(new Date(2,10,135,1),
+ new Date(3,10,135,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(2,10,2468,1),
+ new Date(2,10,678,1));
+ RowCheck(new Date(8,1,470,1),
+ new Date(7,1,470,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(8,1,2803,1),
+ new Date(8,1,1013,1));
+ RowCheck(new Date(20,5,576,1),
+ new Date(18,5,576,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(20,5,2909,1),
+ new Date(20,5,1119,1));
+ RowCheck(new Date(10,11,694,1),
+ new Date(7,11,694,1),
+ new Date(14,7,75,1),
+ null,
+ null,
+ null,
+ new Date(10,11,3027,1),
+ new Date(10,11,1237,1));
+ RowCheck(new Date(25,4,1013,1),
+ new Date(19,4,1013,1),
+ new Date(6,10,403,1),
+ null,
+ null,
+ null,
+ new Date(25,4,3346,1),
+ new Date(25,4,1556,1));
+ RowCheck(new Date(24,5,1096,1),
+ new Date(18,5,1096,1),
+ new Date(23,5,489,1),
+ null,
+ null,
+ null,
+ new Date(24,5,3429,1),
+ new Date(24,5,1639,1));
+ RowCheck(new Date(23,3,1190,1),
+ new Date(16,3,1190,1),
+ new Date(8,2,586,1),
+ null,
+ null,
+ null,
+ new Date(23,3,3523,1),
+ new Date(23,3,1733,1));
+ RowCheck(new Date(10,3,1240,1),
+ new Date(3,3,1240,1),
+ new Date(8,8,637,1),
+ null,
+ null,
+ null,
+ new Date(10,3,3573,1),
+ new Date(10,3,1783,1));
+ RowCheck(new Date(2,4,1288,1),
+ new Date(26,3,1288,1),
+ new Date(21,2,687,1),
+ null,
+ null,
+ null,
+ new Date(2,4,3621,1),
+ new Date(2,4,1831,1));
+ RowCheck(new Date(27,4,1298,1),
+ new Date(20,4,1298,1),
+ new Date(8,7,697,1),
+ null,
+ null,
+ null,
+ new Date(27,4,3631,1),
+ new Date(27,4,1841,1));
+ RowCheck(new Date(12,6,1391,1),
+ new Date(4,6,1391,1),
+ new Date(2,7,793,1),
+ null,
+ null,
+ null,
+ new Date(12,6,3724,1),
+ new Date(12,6,1934,1));
+ RowCheck(new Date(3,2,1436,1),
+ new Date(25,1,1436,1),
+ new Date(7,7,839,1),
+ null,
+ null,
+ null,
+ new Date(3,2,3769,1),
+ new Date(3,2,1979,1));
+ RowCheck(new Date(9,4,1492,1),
+ new Date(31,3,1492,1),
+ new Date(2,6,897,1),
+ null,
+ null,
+ null,
+ new Date(9,4,3825,1),
+ new Date(9,4,2035,1));
+ RowCheck(new Date(19,9,1553,1),
+ new Date(9,9,1553,1),
+ new Date(1,10,960,1),
+ null,
+ null,
+ null,
+ new Date(19,9,3886,1),
+ new Date(19,9,2096,1));
+ RowCheck(new Date(5,3,1560,1),
+ new Date(24,2,1560,1),
+ new Date(28,5,967,1),
+ null,
+ null,
+ null,
+ new Date(5,3,3893,1),
+ new Date(5,3,2103,1));
+ RowCheck(new Date(10,6,1648,1),
+ new Date(31,5,1648,1),
+ new Date(19,5,1058,1),
+ new Date(20,9,5408,1),
+ null,
+ null,
+ new Date(10,6,3981,1),
+ new Date(10,6,2191,1));
+ RowCheck(new Date(30,6,1680,1),
+ new Date(20,6,1680,1),
+ new Date(3,6,1091,1),
+ new Date(3,11,5440,1),
+ null,
+ null,
+ new Date(30,6,4013,1),
+ new Date(30,6,2223,1));
+ RowCheck(new Date(24,7,1716,1),
+ new Date(13,7,1716,1),
+ new Date(5,8,1128,1),
+ new Date(5,11,5476,1),
+ null,
+ null,
+ new Date(24,7,4049,1),
+ new Date(24,7,2259,1));
+ RowCheck(new Date(19,6,1768,1),
+ new Date(8,6,1768,1),
+ new Date(4,2,1182,1),
+ new Date(4,10,5528,1),
+ null,
+ null,
+ new Date(19,6,4101,1),
+ new Date(19,6,2311,1));
+ RowCheck(new Date(2,8,1819,1),
+ new Date(21,7,1819,1),
+ new Date(11,10,1234,1),
+ new Date(11,11,5579,1),
+ null,
+ null,
+ new Date(2,8,4152,1),
+ new Date(2,8,2362,1));
+ RowCheck(new Date(27,3,1839,1),
+ new Date(15,3,1839,1),
+ new Date(12,1,1255,1),
+ new Date(12,7,5599,1),
+ null,
+ null,
+ new Date(27,3,4172,1),
+ new Date(27,3,2382,1));
+ RowCheck(new Date(19,4,1903,1),
+ new Date(6,4,1903,1),
+ new Date(22,1,1321,1),
+ new Date(22,7,5663,1),
+ new Date(19,4,36,1),
+ null,
+ new Date(19,4,4236,1),
+ new Date(19,4,2446,1));
+ RowCheck(new Date(25,8,1929,1),
+ new Date(12,8,1929,1),
+ new Date(20,3,1348,1),
+ new Date(19,12,5689,1),
+ new Date(25,8,4,3),
+ new Date(25,8,18,1),
+ new Date(25,8,4262,1),
+ new Date(25,8,2472,1));
+ RowCheck(new Date(29,9,1941,1),
+ new Date(16,9,1941,1),
+ new Date(9,9,1360,1),
+ new Date(8,1,5702,1),
+ new Date(29,9,16,3),
+ new Date(29,9,30,1),
+ new Date(29,9,4274,1),
+ new Date(29,9,2484,1));
+ RowCheck(new Date(19,4,1943,1),
+ new Date(6,4,1943,1),
+ new Date(14,4,1362,1),
+ new Date(14,8,5703,1),
+ new Date(19,4,18,3),
+ new Date(19,4,32,1),
+ new Date(19,4,4276,1),
+ new Date(19,4,2486,1));
+ RowCheck(new Date(7,10,1943,1),
+ new Date(24,9,1943,1),
+ new Date(8,10,1362,1),
+ new Date(8,1,5704,1),
+ new Date(7,10,18,3),
+ new Date(7,10,32,1),
+ new Date(7,10,4276,1),
+ new Date(7,10,2486,1));
+ RowCheck(new Date(17,3,1992,1),
+ new Date(4,3,1992,1),
+ new Date(14,9,1412,1),
+ new Date(12,7,5752,1),
+ new Date(17,3,4,4),
+ new Date(17,3,81,1),
+ new Date(17,3,4325,1),
+ new Date(17,3,2535,1));
+ RowCheck(new Date(25,5,1996,1),
+ new Date(12,5,1996,1),
+ new Date(8,1,1417,1),
+ new Date(7,9,5756,1),
+ new Date(25,5,8,4),
+ new Date(25,5,85,1),
+ new Date(25,5,4329,1),
+ new Date(25,5,2539,1));
+ RowCheck(new Date(10,11,2038,1),
+ new Date(28,10,2038,1),
+ new Date(13,10,1460,1),
+ new Date(12,2,5799,1),
+ new Date(10,11,50,4),
+ new Date(10,11,127,1),
+ new Date(10,11,4371,1),
+ new Date(10,11,2581,1));
+ RowCheck(new Date(18,7,2094,1),
+ new Date(5,7,2094,1),
+ new Date(6,3,1518,1),
+ new Date(5,11,5854,1),
+ new Date(18,7,106,4),
+ new Date(18,7,183,1),
+ new Date(18,7,4427,1),
+ new Date(18,7,2637,1));
+ }
+
+ public void TestCalendarType() {
+ GregorianCalendar gc = new GregorianCalendar(
+ GregorianCalendarTypes.Arabic);
+ AssertEquals("A01 Gregorian ctor " +
+ "with GregorianCalendarTypes parameter",
+ GregorianCalendarTypes.Arabic,
+ gc.CalendarType);
+ gc.CalendarType = GregorianCalendarTypes.MiddleEastFrench;
+ AssertEquals("A02 GregorianCalendar.CalendarType",
+ GregorianCalendarTypes.MiddleEastFrench,
+ gc.CalendarType);
+ }
+
+ public void TestStandardEras() {
+ AssertEquals("B01 ADEra", 1, GregorianCalendar.ADEra);
+ AssertEquals("B02 HebrewEra", 1, HebrewCalendar.HebrewEra);
+ AssertEquals("B03 HjriEra", 1, HijriCalendar.HijriEra);
+ AssertEquals("B04 JulianEra", 1, JulianCalendar.JulianEra);
+ AssertEquals("B05 KoreanEra", 1, KoreanCalendar.KoreanEra);
+ AssertEquals("B06 ThaiBuddhistEra", 1,
+ ThaiBuddhistCalendar.ThaiBuddhistEra);
+ }
+
+ public void TestCurrentEra() {
+ AssertEquals("C01 GregorianCalendar.CurrentEra",
+ 0, GregorianCalendar.CurrentEra);
+ AssertEquals("C02 HebrewCalendar.CurrentEra",
+ 0, HebrewCalendar.CurrentEra);
+ AssertEquals("C03 HijriCalendar.CurrentEra",
+ 0, HijriCalendar.CurrentEra);
+ AssertEquals("C04 JapaneseCalendar.CurrentEra",
+ 0, JapaneseCalendar.CurrentEra);
+ AssertEquals("C05 JulianCalendar.CurrentEra",
+ 0, JulianCalendar.CurrentEra);
+ AssertEquals("C06 KoreanCalendar.CurrentEra",
+ 0, KoreanCalendar.CurrentEra);
+ AssertEquals("C07 TaiwanCalendar.CurrentEra",
+ 0, TaiwanCalendar.CurrentEra);
+ AssertEquals("C08 ThaiBuddhistCalendar.CurrentEra",
+ 0,
+ ThaiBuddhistCalendar.CurrentEra);
+ }
+
+ public void TestErasProperty() {
+ foreach (Calendar cal in acal) {
+ int check = 1;
+ if (cal is JapaneseCalendar)
+ check = 4;
+ AssertEquals(String.Format("D01 {0}.Eras.Length", cal),
+ check, cal.Eras.Length);
+ cal.Eras[0] = 29;
+ Assert(String.Format("D02 {0}.Eras readonly", cal),
+ cal.Eras[0] != 29);
+ }
+ }
+
+ public void TestTwoDigitYearMax() {
+ AssertEquals("E01 TwoDigitYearMax GregorianCalendar",
+ 2029, gcal.TwoDigitYearMax);
+ AssertEquals("E02 TwoDigitYearMax HebrewCalendar",
+ 5790, hecal.TwoDigitYearMax);
+ AssertEquals("E03 TwoDigitYearMax HijriCalendar",
+ 1451, hical.TwoDigitYearMax);
+ AssertEquals("E04 TwoDigitYearMax JapaneseCalendar",
+ 99, jacal.TwoDigitYearMax);
+ AssertEquals("E05 TwoDigitYearMax JulianCalendar",
+ 2029, jucal.TwoDigitYearMax);
+ AssertEquals("E06 TwoDigitYearMax KoreanCalendar",
+ 4362, kcal.TwoDigitYearMax);
+ AssertEquals("E07 TwoDigitYearMax TaiwanCalendar",
+ 99, tacal.TwoDigitYearMax);
+ AssertEquals("E08 TwoDigitYearMax ThaiBuddhistCalendar",
+ 2572, tbcal.TwoDigitYearMax);
+ foreach (Calendar cal in acal) {
+ bool exception = false;
+ try {
+ cal.TwoDigitYearMax = 99;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert(String.Format("E09 {0}.TwoDigitYearMax 99 " +
+ " out of range exception", cal),
+ exception);
+
+ exception = false;
+ int m = 10000;
+ try {
+ m = cal.GetYear(DateTime.MaxValue)+1;
+ cal.TwoDigitYearMax = m;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert(String.Format("E10 {0}.TwoDigitYearMax out " +
+ " of range exception value {1}",
+ cal, m),
+ exception);
+ }
+ }
+
+ /* UK TODO: breaks with current DateTime implementation.
+ * I've a newer one that works, but that requires to much changes.
+ * for now.
+ public void TestToFourDigitYear() {
+ foreach (Calendar cal in acal) {
+ bool working = true;
+ int mod = 2000;
+ if (cal is HebrewCalendar)
+ mod = 5500;
+ if (cal is KoreanCalendar)
+ mod = 3000;
+ if (cal is JapaneseCalendar)
+ working = false;
+ if (cal is TaiwanCalendar)
+ working = false;
+ cal.TwoDigitYearMax = mod + 229;
+ AssertEquals(
+ String.Format("F01 {0}.TwoDigitYearMax", cal),
+ mod+229 , cal.TwoDigitYearMax);
+ AssertEquals(
+ String.Format("F02 {0}.ToFourDigitYear(29)",
+ cal),
+ working ? mod+229 : 29,
+ cal.ToFourDigitYear(29));
+ AssertEquals(
+ String.Format("F03 {0}.ToFourDigitYear(30)",
+ cal),
+ working ? mod+130 : 30,
+ cal.ToFourDigitYear(30));
+ AssertEquals(
+ String.Format("F04 {0}.ToFourDigitYear({1})",
+ cal, mod),
+ mod, cal.ToFourDigitYear(mod));
+ bool exception = false;
+ try {
+ cal.ToFourDigitYear(-1);
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert(String.Format(
+ "F05 {0}.ToFourDigitYear(-1) exception",
+ cal), exception);
+ exception = false;
+ try {
+ cal.ToFourDigitYear(15000);
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert(String.Format(
+ "F05 {0}.ToFourDigitYear(15000) exception",
+ cal), exception);
+ }
+ }
+ */
+
+ // TODO: more tests :-)
+} // class CalendarTest
+
+} // namespace MonoTests.System.Globalization
diff --git a/mcs/class/corlib/Test/System.Globalization/ChangeLog b/mcs/class/corlib/Test/System.Globalization/ChangeLog
new file mode 100644
index 00000000000..22751349e61
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Globalization/ChangeLog
@@ -0,0 +1,3 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
diff --git a/mcs/class/corlib/Test/System.IO/AllTests.cs b/mcs/class/corlib/Test/System.IO/AllTests.cs
new file mode 100644
index 00000000000..54e40afbb03
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/AllTests.cs
@@ -0,0 +1,36 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.IO {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (BinaryReaderTest.Suite);
+ suite.AddTest (FileTest.Suite);
+ suite.AddTest (MemoryStreamTest.Suite);
+ suite.AddTest (PathTest.Suite);
+ suite.AddTest (StreamReaderTest.Suite);
+ suite.AddTest (StreamWriterTest.Suite);
+ suite.AddTest (StringReaderTest.Suite);
+ suite.AddTest (StringWriterTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.IO/BinaryReaderTest.cs b/mcs/class/corlib/Test/System.IO/BinaryReaderTest.cs
new file mode 100644
index 00000000000..349349e05ec
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/BinaryReaderTest.cs
@@ -0,0 +1,342 @@
+// BinaryReaderTest.cs - NUnit Test Cases for the SystemIO.BinaryReader class
+//
+// Eduardo Garcia Cebollero (kiwnix@yahoo.es)
+//
+// (C) Eduardo Garcia Cebollero.
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+ public class BinaryReaderTest : TestCase
+ {
+ protected override void SetUp () { }
+
+ private string _codeFileName = "resources" + Path.DirectorySeparatorChar + "AFile.txt";
+
+ public void TestCtor1()
+ {
+ {
+ bool errorThrown = false;
+ try {
+ BinaryReader r = new BinaryReader ((Stream) null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert ("#01 null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream (_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ BinaryReader r = new BinaryReader (f);
+ r.Close ();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ f.Close ();
+ Assert ("#02 no read error not thrown", errorThrown);
+ }
+ {
+ FileStream f = new FileStream (_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ BinaryReader r = new BinaryReader (f);
+ AssertNotNull ("#03 no binary reader created", r);
+ r.Close ();
+ f.Close ();
+ }
+
+ }
+
+ public void TestCtor2 ()
+ {
+ {
+ bool errorThrown = false;
+ try {
+ BinaryReader r = new BinaryReader ((Stream) null, Encoding.ASCII);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("#04 Incorrect exception thrown: " + e.ToString ());
+ }
+ Assert ("#05 null stream error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ BinaryReader r = new BinaryReader ((Stream) null, Encoding.Unicode);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("#06 Incorrect exception thrown: " + e.ToString ());
+ }
+ Assert("#07 null stream error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ BinaryReader r = new BinaryReader ((Stream) null, Encoding.UTF7);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("#08 Incorrect exception thrown: " + e.ToString ());
+ }
+ Assert ("#09 null stream error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ BinaryReader r = new BinaryReader ((Stream) null, Encoding.UTF8);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("#0A Incorrect exception thrown: " + e.ToString ());
+ }
+ Assert ("#0B null stream error not thrown", errorThrown);
+ }
+ }
+
+ public void TestCtor3 ()
+ {
+ bool errorThrown = false;
+ byte [] b = new byte [30];
+ MemoryStream m = new MemoryStream (b);
+ try {
+ BinaryReader r = new BinaryReader (m, (Encoding) null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch(Exception e) {
+ Fail ("#0C Incorrect Exception thrown: " + e.ToString ());
+ }
+ Assert ("#0D No exception trown: ", errorThrown);
+ }
+
+ //TODO: (TestCtor*) Verify the Use of a wrong Stream
+ //TODO: (TestClose*) Verify the Close Method
+ public void TestClose1 ()
+ {
+ {
+ byte [] b = new byte [30];
+ MemoryStream m = new MemoryStream (b);
+ try {
+ BinaryReader r = new BinaryReader (m);
+ r.Close ();
+ } catch (Exception e) {
+ Fail ("#0E Unhandled Exception: "+ e.ToString ());
+ }
+ }
+ }
+
+ //TODO: (TestRead*) Verify Read Method
+ public void TestReadBoolean ()
+ {
+ bool [] a = {true, true, false};
+ byte [] arr_a = new byte [3];
+ int i = 0;
+ foreach (bool a1 in a) {
+ arr_a [i] = Convert.ToByte (a1);
+ i++;
+ }
+
+ bool b;
+ MemoryStream m = new MemoryStream (arr_a);
+ try {
+ BinaryReader r = new BinaryReader (m);
+ b = r.ReadBoolean ();
+ AssertEquals ("#11 No well readed boolean: ", a [0], b);
+ } catch (Exception e) {
+ Fail ("#12 Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+
+ public void TestReadByte ()
+ {
+ byte [] a = {0, 2, 3, 1, 5, 2};
+ byte b;
+ MemoryStream m = new MemoryStream (a);
+ try {
+ BinaryReader r = new BinaryReader (m);
+ b = r.ReadByte ();
+ AssertEquals ("#13 No well readed byte: ", a [0], b);
+ } catch (Exception e) {
+ Fail ("#14 Unexpected Exception thrown: " + e.ToString ());
+ }
+ }
+
+ public void TestReadChar()
+ {
+ char [] a = {'a','b','c','d','e'};
+ byte [] arr_a = new byte [5];
+ int i = 0;
+ char c;
+
+ foreach (char a1 in a) {
+ arr_a [i] = Convert.ToByte (a1);
+ i++;
+ }
+
+ MemoryStream m = new MemoryStream (arr_a);
+ BinaryReader r = new BinaryReader (m);
+ try {
+ c = r.ReadChar ();
+ AssertEquals ("#15 No well readed Char", a [0], c);
+ } catch (Exception e) {
+ Fail ("#16 Unexpeted Exception: " + e.ToString ());
+ }
+ }
+
+ public void TestReadInt32 () //Uses BinaryWriter!!
+ {
+ int [] arr_int = {1,10,200,3000,40000,500000,6000000};
+ byte [] arr_byte = new byte [28]; //Sizeof arr_int * 4
+ int [] arr_int2 = new int [7];
+ int i;
+
+ MemoryStream mem_stream = new MemoryStream (arr_byte);
+ BinaryWriter bin_writer = new BinaryWriter (mem_stream);
+
+ foreach (int elem in arr_int) {
+ bin_writer.Write(elem);
+ }
+
+ mem_stream.Seek(0,SeekOrigin.Begin);
+ BinaryReader bin_reader = new BinaryReader (mem_stream);
+ bin_reader.BaseStream.Seek(0,SeekOrigin.Begin);
+
+ for (i=0;i<7;i++) {
+ try{
+ arr_int2 [i] = bin_reader.ReadInt32();
+ AssertEquals("#2E Wrong Readed Int32 in iteration "+ i,arr_int [i],arr_int2 [i]);
+ } catch (IOException e) {
+ Fail("#2F Unexpected IO Exception" + e.ToString());
+ }
+ }
+ }
+
+
+ //-TODO: (TestRead[Type]*) Verify the ReadBoolean, ReadByte ....
+ // ReadBoolean, ReadByte, ReadChar, ReadInt32 Done
+
+ //TODO: (TestFillBuffer*) Verify the FillBuffer Method
+ public void TestPeekChar ()
+ {
+ char char1, char2;
+ char [] b = {'A', 'B', 'C'};
+ byte [] arr_b = new byte [3];
+ int i = 0;
+
+ foreach (char b1 in b) {
+ arr_b [i] = Convert.ToByte (b1);
+ i++;
+ }
+
+ MemoryStream m = new MemoryStream (arr_b);
+ BinaryReader r = new BinaryReader (m);
+ try {
+ char1 = (char) r.PeekChar ();
+ char2 = (char) r.PeekChar ();
+ AssertEquals ("#20 the stream pointer have been altered in peek", char1, char2);
+ } catch (Exception e) {
+ Fail ("#21 Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+
+ public void TestBaseSeek1 ()
+ {
+ char char1, char2;
+ char [] b = {'A','B','C','D','E','F'};
+ byte [] arr_b = new byte[6];
+ int i = 0;
+ foreach (char b1 in b) {
+ arr_b [i] = Convert.ToByte (b1);
+ i++;
+ }
+
+ MemoryStream m = new MemoryStream (arr_b);
+ BinaryReader r = new BinaryReader (m);
+ try {
+ char1 = (char) r.PeekChar ();
+ r.BaseStream.Seek (0,SeekOrigin.Current);
+ char2 = (char) r.PeekChar ();
+ AssertEquals ("#22 the stream Has been altered in Seek", char1, char2);
+ } catch (Exception e) {
+ Fail ("#23 Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+
+ public void TestBaseSeek2 ()
+ {
+ char char1, char2;
+ char [] b = {'A','B','C','D','E','F'};
+ byte [] arr_b = new byte[6];
+ int i = 0;
+ foreach (char b1 in b) {
+ arr_b [i] = Convert.ToByte (b1);
+ i++;
+ }
+
+ MemoryStream m = new MemoryStream (arr_b);
+ BinaryReader r = new BinaryReader (m);
+ try {
+ char1 = (char) r.PeekChar ();
+ r.BaseStream.Seek (3,SeekOrigin.Current);
+ r.BaseStream.Seek (-3,SeekOrigin.Current);
+ char2 = (char) r.PeekChar ();
+ AssertEquals ("#24 the stream Has been altered in Seek", char1, char2);
+ } catch (Exception e) {
+ Fail ("#25 Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+ public void TestInterleavedSeek1 ()
+ {
+ byte int1;
+ byte [] arr_byte = {0,1,2,3,4,5,6,7,8,9};
+
+ MemoryStream m = new MemoryStream (arr_byte);
+ BinaryReader r = new BinaryReader (m);
+
+ {
+ try {
+ int1 = r.ReadByte();
+ AssertEquals("#26 Not well readed Byte", int1, arr_byte[0]);
+ } catch (Exception e) {
+ Fail ("#27 Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+ {
+ try {
+ r.BaseStream.Seek(-1,SeekOrigin.End);
+ int1 = r.ReadByte();
+ AssertEquals("#28 Not well readed Byte",int1,arr_byte[9]);
+ } catch (Exception e) {
+ Fail ("#29 Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+ {
+ try {
+ r.BaseStream.Seek(3,SeekOrigin.Begin);
+ int1 = r.ReadByte();
+ AssertEquals("#2A Not well readed Byte",int1,arr_byte[3]);
+ } catch (Exception e) {
+ Fail ("#2B Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+ {
+ try {
+ r.BaseStream.Seek(2,SeekOrigin.Current);
+ int1 = r.ReadByte();
+ AssertEquals("#2C Not well readed Int32",int1,arr_byte [6]);
+ } catch (Exception e) {
+ Fail ("#2D Unexpected exception thrown: " + e.ToString ());
+ }
+ }
+
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.IO/ChangeLog b/mcs/class/corlib/Test/System.IO/ChangeLog
new file mode 100644
index 00000000000..3c79b5bbd68
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/ChangeLog
@@ -0,0 +1,145 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-09-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathTest.cs: added test for null argument in IsPathRooted.
+
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * BinaryReaderTest.cs: added more tests.
+
+ Patch from Eduardo García Cebollero (kiwnix@yahoo.es).
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * StreamReaderTest.cs: Pinpoint error closing streams
+
+2002-09-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileTest.cs: don't leave AFile.txt open.
+
+2002-09-08 Nick Drochak <ndrochak@gol.com>
+
+ * PathTest.cs (TestCombine): XP puts it's system root in WINDOWS not
+ WINNT.
+
+2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathTest.cs: some fixes to make it work also on unix.
+
+2002-08-30 Nick Drochak <ndrochak@gol.com>
+
+ * PathTest.cs (TestGetPathRoot): Don't assume current directory will
+ be on the C: drive (mine wasn't).
+
+2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathTest.cs: improved.
+
+2002-08-26 Nick Drochak <ndrochak@gol.com>
+
+ * BinaryReaderTest.cs: Closing the stream twice doesn not throw any
+ exceptions on .NET.
+
+2002-08-17 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * AllTests.cs: added BinaryReaderTest.Suite.
+ * BinaryReaderTest.cs: New file.
+
+2002-06-12 Nick Drochak <ndrochak@gol.com>
+
+ * StringReaderTest.cs: Regression test for a bug that we had were
+ ReadLine() was not returning null when the string ended with newline.
+
+2002-05-15 Nick Drochak <ndrochak@gol.com>
+
+ * StreamReaderTest.cs:
+ * StreamWriterTest.cs:
+ Make sure invalid file name has invalid characters in it. These are
+ platform dependant.
+
+2002-05-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileTest.cs: Delete temporary files after each test method; Catch
+ unexpected exceptions and report them; Make some Assert messages
+ unique; Make sure temp files exist before trying Move and Delete, etc.
+
+2002-05-13 Mike Gray <mike@mikegray.org>
+
+ * FileTest.cs: Adding better tests for File.Delete, File.Move
+
+2002-05-12 Mike Gray <mike@mikegray.org>
+
+ * FileTest.cs: Adding better tests for File.Exists, File.Create,
+ and File.Copy
+
+2002-05-12 Nick Drochak <ndrochak@gol.com>
+
+ * StringTest.cs: Add a couple more tests.
+ * PathTest.cs: Make tests work a bit better on W32 and Linux.
+
+2002/05/10 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriterTest.cs: Use "resources" directory and use OS friendly
+ directory separator characters. This makes the tests run correctly
+ against MS.NET, but not yet in mono on Linux.
+
+2002/05/08 Nick Drochak <ndrochak@gol.com>
+
+ * FileTest.cs: Use "resources" directory and use OS friendly
+ directory separator characters. This makes the tests run correctly
+ against MS.NET, but not yet in mono on Linux.
+
+2002-05-08 Nick Drochak <ndrochak@gol.com>
+
+ * StreamWriter.cs: Wrap a try-catch around block of code to find out
+ what exception is being thrown when it shouldn't.
+
+2002-05-07 Nick Drochak <ndrochak@gol.com>
+
+ * FileTest.cs: Added TestOpen() from Mike Gray.
+ * AllTests.cs: Added missing FileTest.Suite as pointed out by Mike
+ as well.
+
+2002-05-05 Nick Drochak <ndrochak@gol.com>
+
+ * StreamReaderTest.cs: Change location of sample file. In some places,
+ use memory stream instead of file stream to eliminate reliance on file
+ io for now. That area is still a bit immature. Added a bunch of
+ markers to tell where errors were occuring.
+
+ * resources: New directory to hold files open/read, etc. by unit
+ tests.
+
+2002-05-01 Nick Drochak <ndrochak@gol.com>
+
+ * StreamReaderTest.cs:
+ * StreamWriterTest.cs: Catch and display exception info where it wasn't
+ being caught before.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * StringReader.cs: Added test for peeking and reading at the end of
+ a string.
+
+2002-02-28 Nick Drochak <ndrochak@gol.com>
+
+ * MemoryStreamTest.cs
+ * StreamWriterTest.cs
+ * StringReaderTest.cs: Fix test bugs found by running against mscorlib.
+ AssertEquals() requires the expected and atual values to be the same
+ type if they are to be considered equal.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * FileTest.cs: Added to CVS. However, this portion of the code
+ can't be tested right now.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: removed duplicate MemoryStream test
+ * MemoryStreamTest.cs: wrapped try-catch blocks around read/write/seek
+ tests. These were throwing exceptions that NUnit wasn't catching. I
+ don't think it used to behave this way before .NET.1.0.
diff --git a/mcs/class/corlib/Test/System.IO/FileTest.cs b/mcs/class/corlib/Test/System.IO/FileTest.cs
new file mode 100644
index 00000000000..17792cd0624
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/FileTest.cs
@@ -0,0 +1,427 @@
+//
+// FileTest.cs: Test cases for System.IO.File
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace MonoTests.System.IO
+{
+ public class FileTest : TestCase
+ {
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ File.Delete ("resources" + Path.DirectorySeparatorChar + "baz");
+ File.Delete ("resources" + Path.DirectorySeparatorChar + "bar");
+ File.Delete ("resources" + Path.DirectorySeparatorChar + "foo");
+ }
+
+ public void TestExists ()
+ {
+ int i = 0;
+ try {
+ Assert ("null filename should not exist", !File.Exists (null));
+ i++;
+ Assert ("empty filename should not exist", !File.Exists (""));
+ i++;
+ Assert ("whitespace filename should not exist", !File.Exists (" \t\t \t \n\t\n \n"));
+ i++;
+ Assert ("File resources" + Path.DirectorySeparatorChar + "AFile.txt should exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "AFile.txt"));
+ i++;
+ Assert ("File resources" + Path.DirectorySeparatorChar + "doesnotexist should not exist", !File.Exists ("resources" + Path.DirectorySeparatorChar + "doesnotexist"));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at i = " + i + ". e=" + e);
+ }
+ }
+
+ public void TestCreate ()
+ {
+ FileStream stream;
+
+ /* exception test: File.Create(null) */
+ try {
+ stream = File.Create (null);
+ Fail ("File.Create(null) should throw ArgumentNullException");
+ } catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Create(null) unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Create("") */
+ try {
+ stream = File.Create ("");
+ Fail ("File.Create('') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Create('') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Create(" ") */
+ try {
+ stream = File.Create (" ");
+ Fail ("File.Create(' ') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Create(' ') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Create(directory_not_found) */
+ try {
+ stream = File.Create ("directory_does_not_exist" + Path.DirectorySeparatorChar + "foo");
+ Fail ("File.Create(directory_does_not_exist) should throw DirectoryNotFoundException");
+ } catch (DirectoryNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Create(directory_does_not_exist) unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* positive test: create resources/foo */
+ try {
+ stream = File.Create ("resources" + Path.DirectorySeparatorChar + "foo");
+ Assert ("File should exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "foo"));
+ stream.Close ();
+ } catch (Exception e) {
+ Fail ("File.Create(resources/foo) unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* positive test: repeat test above again to test for overwriting file */
+ try {
+ stream = File.Create ("resources" + Path.DirectorySeparatorChar + "foo");
+ Assert ("File should exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "foo"));
+ stream.Close ();
+ } catch (Exception e) {
+ Fail ("File.Create(resources/foo) unexpected exception caught: e=" + e.ToString());
+ }
+ }
+
+ public void TestCopy ()
+ {
+ /* exception test: File.Copy(null, b) */
+ try {
+ File.Copy (null, "b");
+ Fail ("File.Copy(null, 'b') should throw ArgumentNullException");
+ } catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy(null, 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Copy(a, null) */
+ try {
+ File.Copy ("a", null);
+ Fail ("File.Copy('a', null) should throw ArgumentNullException");
+ } catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy('a', null) unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* exception test: File.Copy("", b) */
+ try {
+ File.Copy ("", "b");
+ Fail ("File.Copy('', 'b') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy('', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Copy(a, "") */
+ try {
+ File.Copy ("a", "");
+ Fail ("File.Copy('a', '') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy('a', '') unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* exception test: File.Copy(" ", b) */
+ try {
+ File.Copy (" ", "b");
+ Fail ("File.Copy(' ', 'b') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy(' ', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Copy(a, " ") */
+ try {
+ File.Copy ("a", " ");
+ Fail ("File.Copy('a', ' ') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy('a', ' ') unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* exception test: File.Copy(doesnotexist, b) */
+ try {
+ File.Copy ("doesnotexist", "b");
+ Fail ("File.Copy('doesnotexist', 'b') should throw FileNotFoundException");
+ } catch (FileNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Copy('doesnotexist', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* positive test: copy resources/AFile.txt to resources/bar */
+ try {
+ File.Delete ("resources" + Path.DirectorySeparatorChar + "bar");
+ File.Copy ("resources" + Path.DirectorySeparatorChar + "AFile.txt", "resources" + Path.DirectorySeparatorChar + "bar");
+ Assert ("File AFile.txt should still exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "AFile.txt"));
+ Assert ("File bar should exist after File.Copy", File.Exists ("resources" + Path.DirectorySeparatorChar + "bar"));
+ } catch (Exception e) {
+ Fail ("#1 File.Copy('resources/AFile.txt', 'resources/bar') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Copy(resources/AFile.txt, resources/bar) (default is overwrite == false) */
+ try {
+ File.Copy ("resources" + Path.DirectorySeparatorChar + "AFile.txt", "resources" + Path.DirectorySeparatorChar + "bar");
+ Fail ("File.Copy('resources/AFile.txt', 'resources/bar') should throw IOException");
+ } catch (IOException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("#2 File.Copy('resources/AFile.txt', 'resources/bar') unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* positive test: copy resources/AFile.txt to resources/bar, overwrite */
+ try {
+ Assert ("File bar should exist before File.Copy", File.Exists ("resources" + Path.DirectorySeparatorChar + "bar"));
+ File.Copy ("resources" + Path.DirectorySeparatorChar + "AFile.txt", "resources" + Path.DirectorySeparatorChar + "bar", true);
+ Assert ("File AFile.txt should still exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "AFile.txt"));
+ Assert ("File bar should exist after File.Copy", File.Exists ("resources" + Path.DirectorySeparatorChar + "bar"));
+ } catch (Exception e) {
+ Fail ("File.Copy('resources/AFile.txt', 'resources/bar', true) unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ }
+
+ public void TestDelete ()
+ {
+
+ /* exception test: File.Delete(null) */
+ try {
+ File.Delete (null);
+ Fail ("File.Delete(null) should throw ArgumentNullException");
+ } catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Delete(null) unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Delete("") */
+ try {
+ File.Delete ("");
+ Fail ("File.Delete('') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Delete('') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Delete(" ") */
+ try {
+ File.Delete (" ");
+ Fail ("File.Delete(' ') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Delete(' ') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Delete(directory_not_found) */
+ try {
+ File.Delete ("directory_does_not_exist" + Path.DirectorySeparatorChar + "foo");
+ Fail ("File.Delete(directory_does_not_exist) should throw DirectoryNotFoundException");
+ } catch (DirectoryNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Delete(directory_does_not_exist) unexpected exception caught: e=" + e.ToString());
+ }
+
+ if (!File.Exists ("resources" + Path.DirectorySeparatorChar + "foo")) {
+ FileStream f = File.Create("resources" + Path.DirectorySeparatorChar + "foo");
+ f.Close();
+ }
+
+ Assert ("File resources" + Path.DirectorySeparatorChar + "foo should exist for TestDelete to succeed", File.Exists ("resources" + Path.DirectorySeparatorChar + "foo"));
+ try {
+ File.Delete ("resources" + Path.DirectorySeparatorChar + "foo");
+ } catch (Exception e) {
+ Fail ("Unable to delete resources" + Path.DirectorySeparatorChar + "foo: e=" + e.ToString());
+ }
+ Assert ("File resources" + Path.DirectorySeparatorChar + "foo should not exist after File.Delete", !File.Exists ("resources" + Path.DirectorySeparatorChar + "foo"));
+ }
+
+
+ public void TestMove ()
+ {
+ /* exception test: File.Move(null, b) */
+ try {
+ File.Move (null, "b");
+ Fail ("File.Move(null, 'b') should throw ArgumentNullException");
+ } catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move(null, 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Move(a, null) */
+ try {
+ File.Move ("a", null);
+ Fail ("File.Move('a', null) should throw ArgumentNullException");
+ } catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('a', null) unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* exception test: File.Move("", b) */
+ try {
+ File.Move ("", "b");
+ Fail ("File.Move('', 'b') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Move(a, "") */
+ try {
+ File.Move ("a", "");
+ Fail ("File.Move('a', '') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('a', '') unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* exception test: File.Move(" ", b) */
+ try {
+ File.Move (" ", "b");
+ Fail ("File.Move(' ', 'b') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move(' ', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Move(a, " ") */
+ try {
+ File.Move ("a", " ");
+ Fail ("File.Move('a', ' ') should throw ArgumentException");
+ } catch (ArgumentException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('a', ' ') unexpected exception caught: e=" + e.ToString());
+ }
+
+
+ /* exception test: File.Move(doesnotexist, b) */
+ try {
+ File.Move ("doesnotexist", "b");
+ Fail ("File.Move('doesnotexist', 'b') should throw FileNotFoundException");
+ } catch (FileNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('doesnotexist', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Move(resources/foo, doesnotexist/b) */
+ File.Copy("resources" + Path.DirectorySeparatorChar + "AFile.txt", "resources" + Path.DirectorySeparatorChar + "foo", true);
+ try {
+ File.Move ("resources" + Path.DirectorySeparatorChar + "foo", "doesnotexist" + Path.DirectorySeparatorChar + "b");
+ Fail ("File.Move('resources/foo', 'b') should throw DirectoryNotFoundException");
+ } catch (DirectoryNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (FileNotFoundException) {
+ // LAMESPEC
+ // do nothing, this is (kind of) what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('resources/foo', 'doesnotexist/b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Move(doesnotexist/foo, b) */
+ try {
+ File.Move ("doesnotexist" + Path.DirectorySeparatorChar + "foo", "b");
+ Fail ("File.Move('doesnotexist/foo', 'b') should throw DirectoryNotFoundException");
+ } catch (DirectoryNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (FileNotFoundException) {
+ // LAMESPEC
+ // do nothing, this is (kind of) what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('doesnotexist/foo', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* exception test: File.Move(resources/foo, resources) */
+ try {
+ File.Move ("resources" + Path.DirectorySeparatorChar + "foo", "resources");
+ Fail ("File.Move('resources/foo', 'resources') should throw IOException");
+ } catch (IOException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("File.Move('resources/foo', 'resources') unexpected exception caught: e=" + e.ToString());
+ }
+
+ /* positive test: File.Move(a, a) shouldn't throw exception */
+ try {
+ File.Move ("resources" + Path.DirectorySeparatorChar + "foo", "resources" + Path.DirectorySeparatorChar + "foo");
+ } catch (Exception e) {
+ Fail ("File.Move('doesnotexist/foo', 'b') unexpected exception caught: e=" + e.ToString());
+ }
+
+ if (!File.Exists ("resources" + Path.DirectorySeparatorChar + "bar")) {
+ FileStream f = File.Create("resources" + Path.DirectorySeparatorChar + "bar");
+ f.Close();
+ }
+
+ Assert ("File resources" + Path.DirectorySeparatorChar + "bar should exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "bar"));
+ File.Move ("resources" + Path.DirectorySeparatorChar + "bar", "resources" + Path.DirectorySeparatorChar + "baz");
+ Assert ("File resources" + Path.DirectorySeparatorChar + "bar should not exist", !File.Exists ("resources" + Path.DirectorySeparatorChar + "bar"));
+ Assert ("File resources" + Path.DirectorySeparatorChar + "baz should exist", File.Exists ("resources" + Path.DirectorySeparatorChar + "baz"));
+ }
+
+ public void TestOpen ()
+ {
+ try {
+ FileStream stream = File.Open ("resources" + Path.DirectorySeparatorChar + "AFile.txt", FileMode.Open);
+ stream.Close ();
+ } catch (Exception e) {
+ Fail ("Unable to open resources" + Path.DirectorySeparatorChar + "AFile.txt: e=" + e.ToString());
+ }
+
+ /* Exception tests */
+ try {
+ FileStream stream = File.Open ("filedoesnotexist", FileMode.Open);
+ Fail ("File 'filedoesnotexist' should not exist");
+ } catch (FileNotFoundException) {
+ // do nothing, this is what we expect
+ } catch (Exception e) {
+ Fail ("Unexpect exception caught: e=" + e.ToString());
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs b/mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs
new file mode 100644
index 00000000000..8ac2f5b550a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs
@@ -0,0 +1,145 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add some testing for exceptions
+//
+// TODO: Add some testing for the CanXXX properties, exceptions,
+// various different constructors.
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class MemoryStreamTest : TestCase {
+
+ private MemoryStream testStream;
+ private byte[] testStreamData;
+
+ protected override void SetUp() {
+ testStreamData = new byte[100];
+
+ for( int i = 0; i < 100; i++ ) {
+ testStreamData[i] = (byte)(100 - i);
+ }
+
+ testStream = new MemoryStream( testStreamData );
+ }
+
+ //
+ // Verify that the first count bytes in testBytes are the same as
+ // the count bytes from index start in testStreamData
+ //
+ private void VerifyTestData( byte[] testBytes, int start, int count) {
+ if( testBytes == null ) {
+ throw new ArgumentNullException();
+ } else if( ( start < 0 || count < 0 ) || start + count > testStreamData.Length || start > testStreamData.Length ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ for( int test = 0; test < count; test++ ) {
+ if( testBytes[ test ] != testStreamData[ start + test ] ) {
+ string failStr = String.Format( "testByte {0} (testStream {1}) was <{2}>, expecting <{3}>", test, start+test,
+ testBytes[ test ], testStreamData[ start+test] );
+ Fail( failStr );
+ }
+ }
+ }
+
+ public void TestConstructors() {
+ MemoryStream ms = new MemoryStream();
+
+ AssertEquals("A1", 0L, ms.Length );
+ AssertEquals("A2", 0, ms.Capacity );
+ AssertEquals("A3", true, ms.CanWrite );
+
+ ms = new MemoryStream( 10 );
+
+ AssertEquals("A4", 0L, ms.Length );
+ AssertEquals("A5", 10, ms.Capacity );
+ }
+
+ public void TestRead() {
+ byte[] readBytes = new byte[20];
+
+ try {
+ /* Test simple read */
+ testStream.Read( readBytes, 0, 10 );
+ VerifyTestData( readBytes, 0, 10 );
+
+ /* Seek back to beginning */
+
+ testStream.Seek( 0, SeekOrigin.Begin );
+
+ /* Read again, bit more this time */
+ testStream.Read( readBytes, 0, 20 );
+ VerifyTestData( readBytes, 0, 20 );
+
+ /* Seek to 20 bytes from End */
+ testStream.Seek( -20, SeekOrigin.End );
+ testStream.Read( readBytes, 0, 20);
+ VerifyTestData( readBytes, 80, 20);
+
+ int readByte = testStream.ReadByte();
+ AssertEquals( -1, readByte );
+ }
+ catch(Exception e){
+ Fail("Threw an unexpected exception:"+e.ToString());
+ return;
+ }
+ }
+
+ public void TestWriteBytes() {
+ byte[] readBytes = new byte[100];
+
+ try {
+ MemoryStream ms = new MemoryStream( 100 );
+
+ for( int i = 0; i < 100; i++ ) {
+ ms.WriteByte( testStreamData[i] );
+ }
+
+ ms.Seek( 0, SeekOrigin.Begin);
+
+ testStream.Read( readBytes, 0, 100 );
+
+ VerifyTestData( readBytes, 0, 100 );
+ }
+ catch(Exception e){
+ Fail("Threw an unexpected exception:"+e.ToString());
+ return;
+ }
+ }
+
+ public void TestWriteBlock() {
+ byte[] readBytes = new byte[100];
+
+ try {
+ MemoryStream ms = new MemoryStream( 100 );
+
+ ms.Write( testStreamData, 0, 100 );
+
+ ms.Seek( 0, SeekOrigin.Begin);
+
+ testStream.Read( readBytes, 0, 100 );
+
+ VerifyTestData( readBytes, 0, 100 );
+
+ byte[] arrayBytes = testStream.ToArray();
+
+ VerifyTestData( arrayBytes, 0, 100 );
+ }
+ catch(Exception e){
+ Fail("Threw an unexpected exception:"+e.ToString());
+ return;
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.IO/PathTest.cs b/mcs/class/corlib/Test/System.IO/PathTest.cs
new file mode 100644
index 00000000000..3d4a24e9cd9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/PathTest.cs
@@ -0,0 +1,428 @@
+//
+// System.IO.Path Test Cases
+//
+// Authors:
+// Marcin Szczepanski (marcins@zipworld.com.au)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) Marcin Szczepanski
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+#define NUNIT // Comment out this one if you wanna play with the test without using NUnit
+
+#if NUNIT
+using NUnit.Framework;
+#else
+using System.Reflection;
+#endif
+
+using System.IO;
+using System;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+ enum OsType {
+ Windows,
+ Unix,
+ Mac
+ }
+
+#if NUNIT
+ public class PathTest : TestCase
+ {
+#else
+ public class PathTest
+ {
+#endif
+ static string path1;
+ static string path2;
+ static string path3;
+ static OsType OS;
+ static char DSC = Path.DirectorySeparatorChar;
+
+#if NUNIT
+ protected override void SetUp ()
+ {
+#else
+ static PathTest ()
+ {
+#endif
+ if ('/' == DSC) {
+ OS = OsType.Unix;
+ path1 = "/foo/test.txt";
+ path2 = "/etc";
+ path3 = "init.d";
+ } else if ('\\' == DSC) {
+ OS = OsType.Windows;
+ path1 = "c:\\foo\\test.txt";
+ path2 = Environment.GetEnvironmentVariable ("SYSTEMROOT");
+ path3 = "system32";
+ } else {
+ OS = OsType.Mac;
+ //FIXME: For Mac. figure this out when we need it
+ path1 = "foo:test.txt";
+ path2 = "foo";
+ path3 = "bar";
+ }
+ }
+
+ bool Windows
+ {
+ get {
+ return OS == OsType.Windows;
+ }
+ }
+
+ bool Unix
+ {
+ get {
+ return OS == OsType.Unix;
+ }
+ }
+
+ bool Mac
+ {
+ get {
+ return OS == OsType.Mac;
+ }
+ }
+
+ public void TestChangeExtension ()
+ {
+ string [] files = new string [3];
+ files [(int) OsType.Unix] = "/foo/test.doc";
+ files [(int) OsType.Windows] = "c:\\foo\\test.doc";
+ files [(int) OsType.Mac] = "foo:test.doc";
+
+ string testPath = Path.ChangeExtension (path1, "doc");
+ AssertEquals ("ChangeExtension #01", files [(int) OS], testPath);
+
+ testPath = Path.ChangeExtension ("", ".extension");
+ AssertEquals ("ChangeExtension #02", String.Empty, testPath);
+
+ testPath = Path.ChangeExtension (null, ".extension");
+ AssertEquals ("ChangeExtension #03", null, testPath);
+
+ testPath = Path.ChangeExtension ("path", null);
+ AssertEquals ("ChangeExtension #04", "path", testPath);
+
+ testPath = Path.ChangeExtension ("path.ext", "doc");
+ AssertEquals ("ChangeExtension #05", "path.doc", testPath);
+
+ testPath = Path.ChangeExtension ("path.ext1.ext2", "doc");
+ AssertEquals ("ChangeExtension #06", "path.ext1.doc", testPath);
+
+ if (Windows) {
+ try {
+ testPath = Path.ChangeExtension ("<", ".extension");
+ Fail ("ChangeException Fail #01");
+ } catch (Exception e) {
+ AssertEquals ("ChangeExtension Exc. #01", typeof (ArgumentException), e.GetType ());
+ }
+ }
+ }
+
+ public void TestCombine ()
+ {
+ string [] files = new string [3];
+ files [(int) OsType.Unix] = "/etc/init.d";
+ files [(int) OsType.Windows] = Environment.GetEnvironmentVariable ("SYSTEMROOT") + @"\system32";
+ files [(int) OsType.Mac] = "foo:bar";
+
+ string testPath = Path.Combine (path2, path3);
+ AssertEquals ("Combine #01", files [(int) OS], testPath);
+
+ testPath = Path.Combine ("one", "");
+ AssertEquals ("Combine #02", "one", testPath);
+
+ testPath = Path.Combine ("", "one");
+ AssertEquals ("Combine #03", "one", testPath);
+
+ string current = Directory.GetCurrentDirectory ();
+ testPath = Path.Combine (current, "one");
+
+ string expected = current + DSC + "one";
+ AssertEquals ("Combine #04", expected, testPath);
+
+ testPath = Path.Combine ("one", current);
+ // LAMESPEC noted in Path.cs
+ AssertEquals ("Combine #05", current, testPath);
+
+ testPath = Path.Combine (current, expected);
+ AssertEquals ("Combine #06", expected, testPath);
+
+ testPath = DSC + "one";
+ testPath = Path.Combine (testPath, "two" + DSC);
+ expected = DSC + "one" + DSC + "two" + DSC;
+ AssertEquals ("Combine #06", expected, testPath);
+
+ testPath = "one" + DSC;
+ testPath = Path.Combine (testPath, DSC + "two");
+ expected = DSC + "two";
+ AssertEquals ("Combine #06", expected, testPath);
+
+ testPath = "one" + DSC;
+ testPath = Path.Combine (testPath, "two" + DSC);
+ expected = "one" + DSC + "two" + DSC;
+ AssertEquals ("Combine #07", expected, testPath);
+
+ //TODO: Tests for UNC names
+ try {
+ testPath = Path.Combine ("one", null);
+ Fail ("Combine Fail #01");
+ } catch (Exception e) {
+ AssertEquals ("Combine Exc. #01", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ testPath = Path.Combine (null, "one");
+ Fail ("Combine Fail #02");
+ } catch (Exception e) {
+ AssertEquals ("Combine Exc. #02", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ if (Windows) {
+ try {
+ testPath = Path.Combine ("a>", "one");
+ Fail ("Combine Fail #03");
+ } catch (Exception e) {
+ AssertEquals ("Combine Exc. #03", typeof (ArgumentException), e.GetType ());
+ }
+
+ try {
+ testPath = Path.Combine ("one", "aaa<");
+ Fail ("Combine Fail #04");
+ } catch (Exception e) {
+ AssertEquals ("Combine Exc. #04", typeof (ArgumentException), e.GetType ());
+ }
+ }
+ }
+
+ public void TestDirectoryName ()
+ {
+ string [] files = new string [3];
+ files [(int) OsType.Unix] = "/foo";
+ files [(int) OsType.Windows] = "c:\\foo";
+ files [(int) OsType.Mac] = "foo";
+
+ AssertEquals ("GetDirectoryName #01", null, Path.GetDirectoryName (null));
+ string testDirName = Path.GetDirectoryName (path1);
+ AssertEquals ("GetDirectoryName #02", files [(int) OS], testDirName);
+ testDirName = Path.GetDirectoryName (files [(int) OS] + DSC);
+ AssertEquals ("GetDirectoryName #03", files [(int) OS], testDirName);
+
+ try {
+ testDirName = Path.GetDirectoryName ("");
+ Fail ("GetDirectoryName Fail #01");
+ } catch (Exception e) {
+ AssertEquals ("GetDirectoryName Exc. #01", typeof (ArgumentException), e.GetType ());
+ }
+
+ if (Windows) {
+ try {
+ testDirName = Path.GetDirectoryName ("aaa>");
+ Fail ("GetDirectoryName Fail #02");
+ } catch (Exception e) {
+ AssertEquals ("GetDirectoryName Exc. #02", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ try {
+ testDirName = Path.GetDirectoryName (" ");
+ Fail ("GetDirectoryName Fail #03");
+ } catch (Exception e) {
+ AssertEquals ("GetDirectoryName Exc. #03", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestGetExtension ()
+ {
+ string testExtn = Path.GetExtension (path1);
+
+ AssertEquals ("GetExtension #01", ".txt", testExtn);
+
+ testExtn = Path.GetExtension (path2);
+ AssertEquals ("GetExtension #02", String.Empty, testExtn);
+
+ testExtn = Path.GetExtension (String.Empty);
+ AssertEquals ("GetExtension #03", String.Empty, testExtn);
+
+ testExtn = Path.GetExtension (null);
+ AssertEquals ("GetExtension #04", null, testExtn);
+
+ testExtn = Path.GetExtension (" ");
+ AssertEquals ("GetExtension #05", String.Empty, testExtn);
+
+ testExtn = Path.GetExtension (path1 + ".doc");
+ AssertEquals ("GetExtension #06", ".doc", testExtn);
+
+ testExtn = Path.GetExtension (path1 + ".doc" + DSC + "a.txt");
+ AssertEquals ("GetExtension #07", ".txt", testExtn);
+
+ if (Windows) {
+ try {
+ testExtn = Path.GetExtension ("hi<there.txt");
+ Fail ("GetExtension Fail #01");
+ } catch (Exception e) {
+ AssertEquals ("GetExtension Exc. #01", typeof (ArgumentException), e.GetType ());
+ }
+ }
+ }
+
+ public void TestGetFileName ()
+ {
+ string testFileName = Path.GetFileName (path1);
+
+ AssertEquals ("GetFileName #01", "test.txt", testFileName);
+ testFileName = Path.GetFileName (null);
+ AssertEquals ("GetFileName #02", null, testFileName);
+ testFileName = Path.GetFileName (String.Empty);
+ AssertEquals ("GetFileName #03", String.Empty, testFileName);
+ testFileName = Path.GetFileName (" ");
+ AssertEquals ("GetFileName #04", " ", testFileName);
+
+ if (Windows) {
+ try {
+ testFileName = Path.GetFileName ("hi<");
+ Fail ("GetFileName Fail #01");
+ } catch (Exception e) {
+ AssertEquals ("GetFileName Exc. #01", typeof (ArgumentException), e.GetType ());
+ }
+ }
+ }
+
+ public void TestGetFileNameWithoutExtension ()
+ {
+ string testFileName = Path.GetFileNameWithoutExtension (path1);
+
+ AssertEquals ("GetFileNameWithoutExtension #01", "test", testFileName);
+
+ testFileName = Path.GetFileNameWithoutExtension (null);
+ AssertEquals ("GetFileNameWithoutExtension #02", null, testFileName);
+
+ testFileName = Path.GetFileNameWithoutExtension (String.Empty);
+ AssertEquals ("GetFileNameWithoutExtension #03", String.Empty, testFileName);
+ }
+
+ public void TestGetFullPath ()
+ {
+ string current = Directory.GetCurrentDirectory ();
+
+ string testFullPath = Path.GetFullPath ("foo.txt");
+ string expected = current + DSC + "foo.txt";
+ AssertEquals ("GetFullPath #01", expected, testFullPath);
+
+ try {
+ testFullPath = Path.GetFullPath (null);
+ Fail ("GetFullPath Fail #01");
+ } catch (Exception e) {
+ AssertEquals ("GetFullPath Exc. #01", typeof (ArgumentNullException), e.GetType ());
+ }
+
+ try {
+ testFullPath = Path.GetFullPath (String.Empty);
+ Fail ("GetFullPath Fail #02");
+ } catch (Exception e) {
+ AssertEquals ("GetFullPath Exc. #02", typeof (ArgumentException), e.GetType ());
+ }
+ }
+
+ public void TestGetPathRoot ()
+ {
+ string current;
+ string expected;
+ if (!Windows){
+ current = Directory.GetCurrentDirectory ();
+ expected = current [0].ToString ();
+ } else {
+ current = @"J:\Some\Strange Directory\Name";
+ expected = "J:\\";
+ }
+
+ string pathRoot = Path.GetPathRoot (current);
+ AssertEquals ("GetPathRoot #01", expected, pathRoot);
+
+ pathRoot = Path.GetPathRoot ("hola");
+ AssertEquals ("GetPathRoot #02", String.Empty, pathRoot);
+
+ pathRoot = Path.GetPathRoot (null);
+ AssertEquals ("GetPathRoot #03", null, pathRoot);
+ }
+
+ public void TestGetTempPath ()
+ {
+ string getTempPath = Path.GetTempPath ();
+ Assert ("GetTempPath #01", getTempPath != String.Empty);
+ Assert ("GetTempPath #02", Path.IsPathRooted (getTempPath));
+ }
+
+ public void TestGetTempFileName ()
+ {
+ string getTempFileName = null;
+ try {
+ getTempFileName = Path.GetTempFileName ();
+ Assert ("GetTempFileName #01", getTempFileName != String.Empty);
+ Assert ("GetTempFileName #02", File.Exists (getTempFileName));
+ } finally {
+ if (getTempFileName != null && getTempFileName != String.Empty){
+ File.Delete (getTempFileName);
+ }
+ }
+ }
+
+ public void TestHasExtension ()
+ {
+ AssertEquals ("HasExtension #01", true, Path.HasExtension ("foo.txt"));
+ AssertEquals ("HasExtension #02", false, Path.HasExtension ("foo"));
+ AssertEquals ("HasExtension #03", true, Path.HasExtension (path1));
+ AssertEquals ("HasExtension #04", false, Path.HasExtension (path2));
+ }
+
+ public void TestRooted ()
+ {
+ Assert ("IsPathRooted #01", Path.IsPathRooted (path2));
+ Assert ("IsPathRooted #02", !Path.IsPathRooted (path3));
+ Assert ("IsPathRooted #03", !Path.IsPathRooted (null));
+ }
+
+#if !NUNIT
+ void Assert (string msg, bool result)
+ {
+ if (!result)
+ Console.WriteLine (msg);
+ }
+
+ void AssertEquals (string msg, object expected, object real)
+ {
+ if (expected == null && real == null)
+ return;
+
+ if (expected != null && expected.Equals (real))
+ return;
+
+ Console.WriteLine ("{0}: expected: '{1}', got: '{2}'", msg, expected, real);
+ }
+
+ void Fail (string msg)
+ {
+ Console.WriteLine ("Failed: {0}", msg);
+ }
+
+ static void Main ()
+ {
+ PathTest p = new PathTest ();
+ Type t = p.GetType ();
+ MethodInfo [] methods = t.GetMethods ();
+ foreach (MethodInfo m in methods) {
+ if (m.Name.Substring (0, 4) == "Test") {
+ m.Invoke (p, null);
+ }
+ }
+ }
+#endif
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.IO/StreamReaderTest.cs b/mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
new file mode 100644
index 00000000000..99a0957e0ca
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
@@ -0,0 +1,551 @@
+// StreamReaderTest.cs - NUnit Test Cases for the SystemIO.StreamReader class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class StreamReaderTest : TestCase
+{
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ private string _codeFileName = "resources" + Path.DirectorySeparatorChar + "AFile.txt";
+
+ public void TestCtor1() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((Stream)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ StreamReader r = new StreamReader(f);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ f.Close();
+ }
+ }
+ public void TestCtor2() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("");
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((string)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentfile");
+ } catch (FileNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("fileNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentdir/file");
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("!$what? what? Huh? !$*#" + Path.InvalidPathChars[0]);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 5: " + e.ToString());
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ StreamReader r = new StreamReader(_codeFileName);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ }
+ }
+ public void TestCtor3() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((Stream)null, false);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("null stream error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ StreamReader r = new StreamReader(f, false);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f, false);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ f.Close();
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((Stream)null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ StreamReader r = new StreamReader(f, true);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f, true);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ f.Close();
+ }
+ }
+ public void TestCtor4() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("", false);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((string)null, false);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentfile", false);
+ } catch (FileNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("fileNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentdir/file", false);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("!$what? what? Huh? !$*#" + Path.InvalidPathChars[0], false);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 5: " + e.ToString());
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ StreamReader r = new StreamReader(_codeFileName, false);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("", true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 6: " + e.ToString());
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((string)null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 7: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentfile", true);
+ } catch (FileNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 8: " + e.ToString());
+ }
+ Assert("fileNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentdir/file", true);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 9: " + e.ToString());
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("!$what? what? Huh? !$*#" + Path.InvalidPathChars[0], true);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 10: " + e.ToString());
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ StreamReader r = new StreamReader(_codeFileName, true);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ }
+ }
+
+ // TODO - Ctor with Encoding
+
+ public void TestBaseStream() {
+ string progress = "beginning";
+ try {
+ Byte[] b = {};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ AssertEquals("wrong base stream ", m, r.BaseStream);
+ progress = "Closing StreamReader";
+ r.Close();
+ progress = "Closing MemoryStream";
+ m.Close();
+ } catch (Exception e) {
+ Fail ("At '" + progress + "' an unexpected exception was thrown: " + e.ToString());
+ }
+ }
+
+ public void TestCurrentEncoding() {
+ try {
+ Byte[] b = {};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ AssertEquals("wrong encoding",
+ Encoding.UTF8, r.CurrentEncoding);
+ } catch (Exception e) {
+ Fail ("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ // TODO - Close - annoying spec - won't commit to any exceptions. How to test?
+ // TODO - DiscardBufferedData - I have no clue how to test this function.
+
+ public void TestPeek() {
+ // FIXME - how to get an IO Exception?
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ m.Close();
+ int nothing = r.Peek();
+ } catch (ObjectDisposedException) {
+ errorThrown = true;
+ }
+ Assert("nothing-to-peek-at error not thrown", errorThrown);
+ }
+ {
+ Byte[] b = {1, 2, 3, 4, 5, 6};
+ MemoryStream m = new MemoryStream(b);
+
+ StreamReader r = new StreamReader(m);
+ for (int i = 1; i <= 6; i++) {
+ AssertEquals("peek incorrect", i, r.Peek());
+ r.Read();
+ }
+ AssertEquals("should be none left", -1, r.Peek());
+ }
+ }
+
+ public void TestRead() {
+ // FIXME - how to get an IO Exception?
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ m.Close();
+ int nothing = r.Read();
+ } catch (ObjectDisposedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("nothing-to-read error not thrown", errorThrown);
+ }
+ {
+ Byte[] b = {1, 2, 3, 4, 5, 6};
+ MemoryStream m = new MemoryStream(b);
+
+ StreamReader r = new StreamReader(m);
+ for (int i = 1; i <= 6; i++) {
+ AssertEquals("read incorrect", i, r.Read());
+ }
+ AssertEquals("Should be none left", -1, r.Read());
+ }
+
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ r.Read(null, 0, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("null buffer error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ Char[] c = new Char[1];
+ r.Read(c, 0, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("too-long range error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ Char[] c = new Char[1];
+ r.Read(c, -1, 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("out of range error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ Char[] c = new Char[1];
+ r.Read(c, 0, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 5: " + e.ToString());
+ }
+ Assert("out of range error not thrown", errorThrown);
+ }
+ {
+ int ii = 1;
+ try {
+ Byte[] b = {(byte)'a', (byte)'b', (byte)'c',
+ (byte)'d', (byte)'e', (byte)'f',
+ (byte)'g'};
+ MemoryStream m = new MemoryStream(b);
+ ii++;
+ StreamReader r = new StreamReader(m);
+ ii++;
+
+ char[] buffer = new Char[7];
+ ii++;
+ char[] target = {'g','d','e','f','b','c','a'};
+ ii++;
+ r.Read(buffer, 6, 1);
+ ii++;
+ r.Read(buffer, 4, 2);
+ ii++;
+ r.Read(buffer, 1, 3);
+ ii++;
+ r.Read(buffer, 0, 1);
+ ii++;
+ for (int i = 0; i < target.Length; i++) {
+ AssertEquals("read no work",
+ target[i], buffer[i]);
+ i++;
+ }
+
+ } catch (Exception e) {
+ Fail ("Caught when ii=" + ii + ". e:" + e.ToString());
+ }
+ }
+ }
+
+ public void TestReadLine() {
+ // TODO Out Of Memory Exc? IO Exc?
+ Byte[] b = new Byte[8];
+ b[0] = (byte)'a';
+ b[1] = (byte)'\n';
+ b[2] = (byte)'b';
+ b[3] = (byte)'\n';
+ b[4] = (byte)'c';
+ b[5] = (byte)'\n';
+ b[6] = (byte)'d';
+ b[7] = (byte)'\n';
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ AssertEquals("line doesn't match", "a", r.ReadLine());
+ AssertEquals("line doesn't match", "b", r.ReadLine());
+ AssertEquals("line doesn't match", "c", r.ReadLine());
+ AssertEquals("line doesn't match", "d", r.ReadLine());
+ AssertEquals("line doesn't match", null, r.ReadLine());
+ }
+
+ public void TestReadToEnd() {
+ // TODO Out Of Memory Exc? IO Exc?
+ Byte[] b = new Byte[8];
+ b[0] = (byte)'a';
+ b[1] = (byte)'\n';
+ b[2] = (byte)'b';
+ b[3] = (byte)'\n';
+ b[4] = (byte)'c';
+ b[5] = (byte)'\n';
+ b[6] = (byte)'d';
+ b[7] = (byte)'\n';
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ AssertEquals("line doesn't match", "a\nb\nc\nd\n", r.ReadToEnd());
+ AssertEquals("line doesn't match", "", r.ReadToEnd());
+ }
+}
+}
diff --git a/mcs/class/corlib/Test/System.IO/StreamWriterTest.cs b/mcs/class/corlib/Test/System.IO/StreamWriterTest.cs
new file mode 100644
index 00000000000..97fa755127f
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StreamWriterTest.cs
@@ -0,0 +1,343 @@
+// StreamWriterTest.cs - NUnit Test Cases for the SystemIO.StreamWriter class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class StreamWriterTest : TestCase
+{
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ private string _codeFileName = "StreamWriterTest.temp";
+ private string _thisCodeFileName = "resources" + Path.DirectorySeparatorChar + "AFile.txt";
+
+ // TODO - ctors
+ public void TestCtor1() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((Stream)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_thisCodeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ try {
+ StreamWriter r = new StreamWriter(f);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Append,
+ FileAccess.Write);
+ StreamWriter r = new StreamWriter(f);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ f.Close();
+ }
+ }
+ public void TestCtor2() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("");
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((string)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("nonexistentdir/file");
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("!$what? what? Huh? !$*#" + Path.InvalidPathChars[0]);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("1 invalid filename error not thrown", errorThrown);
+ }
+ // TODO - Security/Auth exceptions
+ {
+ StreamWriter r = new StreamWriter(_codeFileName);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ }
+ }
+ public void TestCtor3() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("", false);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((string)null, false);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 2: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("nonexistentdir/file", false);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 3: " + e.ToString());
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("!$what? what? Huh? !$*#" + Path.InvalidPathChars[0], false);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 4: " + e.ToString());
+ }
+ Assert("2 invalid filename error not thrown", errorThrown);
+ }
+ {
+ StreamWriter r = new StreamWriter(_codeFileName, false);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("", true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 5: " + e.ToString());
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((string)null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 6: " + e.ToString());
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("nonexistentdir/file", true);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 7: " + e.ToString());
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("!$what? what? Huh? !$*#" + Path.InvalidPathChars[0], true);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 8: " + e.ToString());
+ }
+ Assert("3 invalid filename error not thrown", errorThrown);
+ }
+ {
+ try {
+ StreamWriter r = new StreamWriter(_codeFileName, true);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ } catch (Exception e) {
+ Fail ("Unxpected exception e=" + e.ToString());
+ }
+ }
+ }
+
+ // TODO - ctors with Encoding
+
+ // TODO - AutoFlush
+ public void TestAutoFlush() {
+ {
+ MemoryStream m = new MemoryStream();
+ StreamWriter w = new StreamWriter(m);
+ w.AutoFlush = false;
+ w.Write(1);
+ w.Write(2);
+ w.Write(3);
+ w.Write(4);
+ AssertEquals("Should be nothing before flush",
+ 0L, m.Length);
+ w.Flush();
+ AssertEquals("Should be something after flush",
+ 4L, m.Length);
+ }
+ {
+ MemoryStream m = new MemoryStream();
+ StreamWriter w = new StreamWriter(m);
+ w.AutoFlush = true;
+ w.Write(1);
+ w.Write(2);
+ w.Write(3);
+ w.Write(4);
+ AssertEquals("Should be something before flush",
+ 4L, m.Length);
+ w.Flush();
+ AssertEquals("Should be something after flush",
+ 4L, m.Length);
+ }
+ }
+
+ public void TestBaseStream() {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Append,
+ FileAccess.Write);
+ StreamWriter r = new StreamWriter(f);
+ AssertEquals("wrong base stream ", f, r.BaseStream);
+ r.Close();
+ f.Close();
+ }
+
+ public void TestEncoding() {
+ StreamWriter r = new StreamWriter(_codeFileName);
+ AssertEquals("wrong encoding",
+ Encoding.UTF8.GetType(), r.Encoding.GetType());
+ r.Close();
+ }
+
+ // TODO - Close - not entirely sure how to test Close
+ //public void TestClose() {
+ //{
+ //MemoryStream m = new MemoryStream();
+ //StreamWriter w = new StreamWriter(m);
+ //StreamReader r = new StreamReader(m);
+ //w.Write(1);
+ //w.Write(2);
+ //w.Write(3);
+ //w.Write(4);
+ //AssertEquals("Should be nothing before close",
+ //0, m.Length);
+ //AssertEquals("Should be nothing in reader",
+ //-1, r.Peek());
+ //w.Close();
+ //AssertEquals("Should be something after close",
+ //1, r.Peek());
+ //}
+ //}
+
+ // TODO - Flush
+ public void TestFlush() {
+ {
+ bool errorThrown = false;
+ try {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Append,
+ FileAccess.Write);
+ StreamWriter r = new StreamWriter(f);
+ r.Close();
+ r.Flush();
+ } catch (ObjectDisposedException) {
+ errorThrown = true;
+ } catch (Exception e) {
+ Fail ("Incorrect exception thrown at 1: " + e.ToString());
+ }
+ Assert("can't flush closed error not thrown", errorThrown);
+ }
+ {
+ MemoryStream m = new MemoryStream();
+ StreamWriter w = new StreamWriter(m);
+ w.Write(1);
+ w.Write(2);
+ w.Write(3);
+ w.Write(4);
+ AssertEquals("Should be nothing before flush",
+ 0L, m.Length);
+ w.Flush();
+ AssertEquals("Should be something after flush",
+ 4L, m.Length);
+ }
+ }
+
+ // TODO - Write - test errors, functionality tested in TestFlush.
+}
+}
diff --git a/mcs/class/corlib/Test/System.IO/StringReaderTest.cs b/mcs/class/corlib/Test/System.IO/StringReaderTest.cs
new file mode 100644
index 00000000000..9264eda00c8
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StringReaderTest.cs
@@ -0,0 +1,123 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add some testing for exceptions
+//
+// TODO: Some of the tests could be a bit more thorough
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+
+namespace MonoTests.System.IO {
+
+public class StringReaderTest : TestCase {
+ public void TestReadLine() {
+ string testme = "a\nb\nc\n";
+ StringReader sr = new StringReader (testme);
+ string inputLine;
+ int lines = 0;
+ while ((inputLine = sr.ReadLine ()) != null)
+ lines++;
+
+ AssertEquals ("Incorrect number of lines", 3, lines);
+ }
+
+ public void TestPeekRead() {
+ StringReader reader = new StringReader( "Test String" );
+
+ char c = (char)reader.Peek();
+ AssertEquals("A1", 'T', c );
+
+ char read = (char)reader.Read();
+
+ AssertEquals("A2", 'T', read );
+
+ c = (char)reader.Peek();
+
+ AssertEquals("A3", 'e', c );
+ }
+
+ public void TestPeekAndReadAtEndOfString() {
+ StringReader reader = new StringReader("x");
+
+ char c = (char)reader.Peek();
+ AssertEquals("A1", 'x', c );
+
+ c = (char)reader.Read();
+ AssertEquals("A2", 'x', c);
+
+ int i = reader.Peek();
+ AssertEquals("A3", -1, i);
+
+ i = reader.Read();
+ AssertEquals("A4", -1, i);
+
+ i = reader.Peek();
+ AssertEquals("A5", -1, i);
+ }
+
+ public void TestPeekAndReadEmptyString() {
+ StringReader reader = new StringReader("");
+
+ int i = reader.Peek();
+ AssertEquals("A1", -1, i);
+
+ i = reader.Read();
+ AssertEquals("A2", -1, i);
+ }
+
+ public void TestRead() {
+ StringReader reader = new StringReader( "Test String" );
+
+ /* Read from start of string */
+ char[] test = new char[5];
+
+ int charsRead = reader.Read( test, 0, 5 );
+
+ AssertEquals( 5, charsRead );
+ AssertEquals( "Test ", new String(test) );
+
+ /* Read to end of string */
+ //reader = new StringReader( "Test String" );
+
+ test = new char[6];
+ charsRead = reader.Read( test, 0, 6 );
+ AssertEquals( 6, charsRead);
+ AssertEquals( "String", new String( test ) );
+
+ /* Read past end of string */
+
+ test = new char[6];
+ reader = new StringReader( "Foo" );
+ charsRead = reader.Read( test, 0, 6 );
+ AssertEquals( 3, charsRead );
+ AssertEquals( "Foo\0\0\0", new String( test ) );
+
+ }
+
+ public void TestReadEOL() {
+ StringReader reader = new StringReader( "Line1\rLine2\r\nLine3\nLine4" );
+
+ string test = reader.ReadLine();
+
+ AssertEquals( "Line1", test );
+
+ test = reader.ReadLine();
+
+ AssertEquals( "Line2", test );
+
+ test = reader.ReadLine();
+
+ AssertEquals( "Line3", test );
+
+ test = reader.ReadLine();
+
+ AssertEquals( "Line4", test );
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.IO/StringWriterTest.cs b/mcs/class/corlib/Test/System.IO/StringWriterTest.cs
new file mode 100644
index 00000000000..f128ecd5daa
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StringWriterTest.cs
@@ -0,0 +1,46 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add some testing for exceptions
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+namespace MonoTests.System.IO {
+
+public class StringWriterTest : TestCase {
+ public void TestConstructors() {
+ StringBuilder sb = new StringBuilder("Test String");
+
+ StringWriter writer = new StringWriter( sb );
+ AssertEquals( sb, writer.GetStringBuilder() );
+ }
+
+ public void TestWrite() {
+ StringWriter writer = new StringWriter();
+
+ AssertEquals( String.Empty, writer.ToString() );
+
+ writer.Write( 'A' );
+ AssertEquals( "A", writer.ToString() );
+
+ writer.Write( " foo" );
+ AssertEquals( "A foo", writer.ToString() );
+
+
+ char[] testBuffer = "Test String".ToCharArray();
+
+ writer.Write( testBuffer, 0, 4 );
+ AssertEquals( "A fooTest", writer.ToString() );
+
+ writer.Write( testBuffer, 5, 6 );
+ AssertEquals( "A fooTestString", writer.ToString() );
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Reflection/AllTests.cs b/mcs/class/corlib/Test/System.Reflection/AllTests.cs
new file mode 100644
index 00000000000..2309d4ddb13
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Reflection/AllTests.cs
@@ -0,0 +1,53 @@
+//
+// MonoTests.System.Reflection.AllTests.cs
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Reflection {
+
+public class RTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ // because most crypto stuff works with byte[] buffers
+ static public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ if ((array1 == null) && (array2 == null))
+ return;
+ if (array1 == null)
+ Fail (msg + " -> First array is NULL");
+ if (array2 == null)
+ Fail (msg + " -> Second array is NULL");
+
+ bool a = (array1.Length == array2.Length);
+ if (a) {
+ for (int i = 0; i < array1.Length; i++) {
+ if (array1 [i] != array2 [i]) {
+ a = false;
+ break;
+ }
+ }
+ }
+ msg += " -> Expected " + BitConverter.ToString (array1, 0);
+ msg += " is different than " + BitConverter.ToString (array2, 0);
+ Assert (msg, a);
+ }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (AssemblyNameTest.Suite);
+ suite.AddTest (StrongNameKeyPairTest.Suite);
+ return suite;
+ }
+ }
+}
+}
diff --git a/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs b/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs
new file mode 100644
index 00000000000..60cdba60c7a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs
@@ -0,0 +1,130 @@
+//
+// AssemblyNameTest.cs - NUnit Test Cases for AssemblyName
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Configuration.Assemblies;
+using System.IO;
+using System.Reflection;
+
+namespace MonoTests.System.Reflection {
+
+public class AssemblyNameTest : TestCase {
+ static public void AssertEqualsByteArrays (string msg, byte[] array1, byte[] array2)
+ {
+ if ((array1 == null) && (array2 == null))
+ return;
+ if (array1 == null)
+ Fail (msg + " -> First array is NULL");
+ if (array2 == null)
+ Fail (msg + " -> Second array is NULL");
+
+ bool a = (array1.Length == array2.Length);
+ if (a) {
+ for (int i = 0; i < array1.Length; i++) {
+ if (array1 [i] != array2 [i]) {
+ a = false;
+ break;
+ }
+ }
+ }
+ msg += " -> Expected " + BitConverter.ToString (array1, 0);
+ msg += " is different than " + BitConverter.ToString (array2, 0);
+ Assert (msg, a);
+ }
+
+ private AssemblyName an;
+
+ // created with "sn -o test.snk test.txt"
+ static byte[] test = { 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB, 0x73, 0xC0, 0x6A, 0x62, 0xB4, 0xB7, 0xC8, 0x92, 0x58, 0x87, 0xCD, 0x07,
+ 0x0C, 0x7D, 0x6C, 0xC1, 0x4A, 0xFC, 0x82, 0x57, 0x0E, 0x43, 0x85, 0x09, 0x75, 0x98, 0x51, 0xBB, 0x35, 0xF5, 0x64, 0x83, 0xC7, 0x79, 0x89, 0x5C, 0x55, 0x36, 0x66, 0xAB, 0x27, 0xA4, 0xD9, 0xD4, 0x7E, 0x6B, 0x67, 0x64, 0xC1, 0x54, 0x4E, 0x37, 0xF1, 0x4E, 0xCA, 0xB3, 0xE5, 0x63, 0x91, 0x57, 0x12, 0x14, 0xA6, 0xEA, 0x8F, 0x8F, 0x2B, 0xFE, 0xF3, 0xE9, 0x16, 0x08, 0x2B, 0x86, 0xBC, 0x26, 0x0D, 0xD0, 0xC6, 0xC4, 0x1A, 0x72, 0x43, 0x76, 0xDC, 0xFF, 0x28, 0x52, 0xA1, 0xDE, 0x8D, 0xFA, 0xD5, 0x1F, 0x0B, 0xB5, 0x4F, 0xAF, 0x06, 0x79, 0x11, 0xEE, 0xA8, 0xEC, 0xD3, 0x74, 0x55, 0xA2, 0x80, 0xFC, 0xF8, 0xD9, 0x50, 0x69, 0x48, 0x01, 0xC2, 0x5A, 0x04, 0x56, 0xB4, 0x3E, 0x24, 0x32, 0x20, 0xB5, 0x2C, 0xDE, 0xBB, 0xBD, 0x13, 0xFD, 0x13, 0xF7, 0x03, 0x3E, 0xE3, 0x37, 0x84, 0x74, 0xE7, 0xD0, 0x5E, 0x9E, 0xB6, 0x26, 0xAE, 0x6E, 0xB0, 0x55, 0x6A, 0x52, 0x63, 0x6F, 0x5A, 0x9D, 0xF2, 0x67, 0xD6, 0x61, 0x4F, 0x7A, 0x45, 0xEE, 0x5C, 0x3D, 0x2B, 0x7C, 0xB2, 0x40, 0x79, 0x54, 0x84, 0xD1,
+ 0xBE, 0x61, 0x3E, 0x5E, 0xD6, 0x18, 0x8E, 0x14, 0x98, 0xFC, 0x35, 0xBF, 0x5F, 0x1A, 0x20, 0x2E, 0x1A, 0xD8, 0xFF, 0xC4, 0x6B, 0xC0, 0xC9, 0x7D, 0x06, 0xEF, 0x09, 0xF9, 0xF3, 0x69, 0xFC, 0xBC, 0xA2, 0xE6, 0x80, 0x22, 0xB9, 0x79, 0x7E, 0xEF, 0x57, 0x9F, 0x49, 0xE1, 0xBC, 0x0D, 0xB6, 0xA1, 0xFE, 0x8D, 0xBC, 0xBB, 0xA3, 0x05, 0x02, 0x6B, 0x04, 0x45, 0xF7, 0x5D, 0xEE, 0x43, 0x06, 0xD6, 0x9C, 0x94, 0x48, 0x1A, 0x0B, 0x9C, 0xBC, 0xB4, 0x4E, 0x93, 0x60, 0x87, 0xCD, 0x58, 0xD6, 0x9A, 0x39, 0xA6, 0xC0, 0x7F, 0x8E, 0xFF, 0x25, 0xC1, 0xD7, 0x2C, 0xF6, 0xF4, 0x6F, 0x24, 0x52, 0x0B, 0x39, 0x42, 0x1B, 0x0D, 0x04, 0xC1, 0x93, 0x2A, 0x19, 0x1C, 0xF0, 0xB1, 0x9B, 0xC1, 0x24, 0x6D, 0x1B, 0x0B, 0xDA, 0x1C, 0x8B, 0x72, 0x48, 0xF0, 0x3E, 0x52, 0xBF, 0x0A, 0x84, 0x3A, 0x9B, 0xC8, 0x6D, 0x13, 0x1E, 0x72, 0xF4, 0x46, 0x93, 0x88, 0x1A, 0x5F, 0x4C, 0x3C, 0xE5, 0x9D, 0x6E, 0xBB, 0x4E, 0xDD, 0x5D, 0x1F, 0x11, 0x40, 0xF4, 0xD7, 0xAF, 0xB3, 0xAB, 0x9A, 0x99, 0x15, 0xF0, 0xDC, 0xAA, 0xFF,
+ 0x9F, 0x2D, 0x9E, 0x56, 0x4F, 0x35, 0x5B, 0xBA, 0x06, 0x99, 0xEA, 0xC6, 0xB4, 0x48, 0x51, 0x17, 0x1E, 0xD1, 0x95, 0x84, 0x81, 0x18, 0xC0, 0xF1, 0x71, 0xDE, 0x44, 0x42, 0x02, 0x06, 0xAC, 0x0E, 0xA8, 0xE2, 0xF3, 0x1F, 0x96, 0x1F, 0xBE, 0xB6, 0x1F, 0xB5, 0x3E, 0xF6, 0x81, 0x05, 0x20, 0xFA, 0x2E, 0x40, 0x2E, 0x4D, 0xA0, 0x0E, 0xDA, 0x42, 0x9C, 0x05, 0xAA, 0x9E, 0xAF, 0x5C, 0xF7, 0x3A, 0x3F, 0xBB, 0x91, 0x73, 0x45, 0x27, 0xA8, 0xA2, 0x07, 0x4A, 0xEF, 0x59, 0x1E, 0x97, 0x9D, 0xE0, 0x30, 0x5A, 0x83, 0xCE, 0x1E, 0x57, 0x32, 0x89, 0x43, 0x41, 0x28, 0x7D, 0x14, 0x8D, 0x8B, 0x41, 0x1A, 0x56, 0x76, 0x43, 0xDB, 0x64, 0x86, 0x41, 0x64, 0x8D, 0x4C, 0x91, 0x83, 0x4E, 0xF5, 0x6C };
+
+ static byte[] token = { 0xFF, 0xEF, 0x94, 0x53, 0x67, 0x69, 0xDA, 0x06 };
+
+ public void TestEmptyAssembly ()
+ {
+ an = new AssemblyName ();
+ AssertNull ("CodeBase", an.CodeBase);
+ AssertNull ("CultureInfo", an.CultureInfo);
+ AssertNull ("EscapedCodeBase", an.EscapedCodeBase);
+ AssertEquals ("Flags", AssemblyNameFlags.None, an.Flags);
+ AssertNull ("FullName", an.FullName);
+ AssertEquals ("HashAlgorithm", AssemblyHashAlgorithm.None, an.HashAlgorithm);
+ AssertNull ("KeyPair", an.KeyPair);
+ AssertNull ("Name", an.Name);
+ AssertNull ("Version", an.Version);
+ AssertEquals ("VersionCompatibility", AssemblyVersionCompatibility.SameMachine, an.VersionCompatibility);
+ }
+
+ public void TestPublicKey ()
+ {
+ an = new AssemblyName ();
+ AssertNull ("PublicKey(empty)", an.GetPublicKey ());
+ an.SetPublicKey (test);
+
+ AssertEquals ("Flags", AssemblyNameFlags.PublicKey, an.Flags);
+ // strangly it doesn't affect the KeyPair ?
+ AssertNull ("KeyPair", an.KeyPair);
+ AssertEqualsByteArrays ("PublicKey", test, an.GetPublicKey ());
+ AssertEqualsByteArrays ("PublicKeyToken", token, an.GetPublicKeyToken ());
+ }
+
+ public void TestPublicKeyToken ()
+ {
+ an = new AssemblyName ();
+ an.SetPublicKeyToken (token);
+
+ AssertEquals ("Flags", AssemblyNameFlags.None, an.Flags);
+ AssertNull ("KeyPair", an.KeyPair);
+ AssertNull ("PublicKey", an.GetPublicKey ());
+ AssertEqualsByteArrays ("PublicKeyToken", token, an.GetPublicKeyToken ());
+ }
+
+ public void TestKeyPair ()
+ {
+ an = new AssemblyName ();
+ an.KeyPair = new StrongNameKeyPair (test);
+
+ AssertEquals ("Flags", AssemblyNameFlags.None, an.Flags);
+ AssertNotNull ("KeyPair", an.KeyPair);
+ AssertNull ("PublicKey", an.GetPublicKey ());
+ AssertNull ("PublicKeyToken", an.GetPublicKeyToken ());
+ }
+
+ // !!! this assembly MUST NOT use a StrongName !!!
+ public void TestSelf ()
+ {
+ Assembly a = Assembly.GetExecutingAssembly ();
+ AssemblyName an = a.GetName ();
+
+ AssertNotNull ("PublicKey(self)", an.GetPublicKey ());
+ AssertEquals ("PublicKey.Length", 0, an.GetPublicKey ().Length);
+ }
+
+ public void TestFullName ()
+ {
+ AssemblyName an = typeof(int).Assembly.GetName ();
+ AssertNotNull ("FullName", an.ToString ());
+ }
+
+ private AssemblyName GetAssemblyName (string assemblyFile)
+ {
+ Assembly a = Assembly.LoadFrom (assemblyFile);
+ return a.GetName ();
+ }
+
+ public void TestStatic ()
+ {
+ /*an = GetAssemblyName ("System.Reflection.dll");*/
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Reflection/ChangeLog b/mcs/class/corlib/Test/System.Reflection/ChangeLog
new file mode 100644
index 00000000000..de3b92496ac
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Reflection/ChangeLog
@@ -0,0 +1,19 @@
+2002-12-30 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyNameTest.cs: Added test for FullName (null cultureinfo).
+
+2002-12-23 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyNameTest.cs: Added test for non-signed assembly (which
+ returns an empty array - i.e. not null like an empty assembly).
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-12-08 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added test suites for AssemblyName and
+ StrongNameKeyPair.
+ * AssemblyNameTest.cs: New. Test suite for AssemblyName.
+ * StrongNameKeyPairTest.cs: New. Test suite for StrongNameKeyPair.
diff --git a/mcs/class/corlib/Test/System.Reflection/StrongNameKeyPairTest.cs b/mcs/class/corlib/Test/System.Reflection/StrongNameKeyPairTest.cs
new file mode 100644
index 00000000000..e04029b6ac4
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Reflection/StrongNameKeyPairTest.cs
@@ -0,0 +1,158 @@
+//
+// StrongNameKeyPairTest.cs - NUnit Test Cases for StrongNameKeyPair
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace MonoTests.System.Reflection {
+
+public class StrongNameKeyPairTest : TestCase {
+
+ // created with "sn -o test.snk test.txt"
+ static byte[] test = { 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB, 0x73, 0xC0, 0x6A, 0x62, 0xB4, 0xB7, 0xC8, 0x92, 0x58, 0x87, 0xCD, 0x07,
+ 0x0C, 0x7D, 0x6C, 0xC1, 0x4A, 0xFC, 0x82, 0x57, 0x0E, 0x43, 0x85, 0x09, 0x75, 0x98, 0x51, 0xBB, 0x35, 0xF5, 0x64, 0x83, 0xC7, 0x79, 0x89, 0x5C, 0x55, 0x36, 0x66, 0xAB, 0x27, 0xA4, 0xD9, 0xD4, 0x7E, 0x6B, 0x67, 0x64, 0xC1, 0x54, 0x4E, 0x37, 0xF1, 0x4E, 0xCA, 0xB3, 0xE5, 0x63, 0x91, 0x57, 0x12, 0x14, 0xA6, 0xEA, 0x8F, 0x8F, 0x2B, 0xFE, 0xF3, 0xE9, 0x16, 0x08, 0x2B, 0x86, 0xBC, 0x26, 0x0D, 0xD0, 0xC6, 0xC4, 0x1A, 0x72, 0x43, 0x76, 0xDC, 0xFF, 0x28, 0x52, 0xA1, 0xDE, 0x8D, 0xFA, 0xD5, 0x1F, 0x0B, 0xB5, 0x4F, 0xAF, 0x06, 0x79, 0x11, 0xEE, 0xA8, 0xEC, 0xD3, 0x74, 0x55, 0xA2, 0x80, 0xFC, 0xF8, 0xD9, 0x50, 0x69, 0x48, 0x01, 0xC2, 0x5A, 0x04, 0x56, 0xB4, 0x3E, 0x24, 0x32, 0x20, 0xB5, 0x2C, 0xDE, 0xBB, 0xBD, 0x13, 0xFD, 0x13, 0xF7, 0x03, 0x3E, 0xE3, 0x37, 0x84, 0x74, 0xE7, 0xD0, 0x5E, 0x9E, 0xB6, 0x26, 0xAE, 0x6E, 0xB0, 0x55, 0x6A, 0x52, 0x63, 0x6F, 0x5A, 0x9D, 0xF2, 0x67, 0xD6, 0x61, 0x4F, 0x7A, 0x45, 0xEE, 0x5C, 0x3D, 0x2B, 0x7C, 0xB2, 0x40, 0x79, 0x54, 0x84, 0xD1,
+ 0xBE, 0x61, 0x3E, 0x5E, 0xD6, 0x18, 0x8E, 0x14, 0x98, 0xFC, 0x35, 0xBF, 0x5F, 0x1A, 0x20, 0x2E, 0x1A, 0xD8, 0xFF, 0xC4, 0x6B, 0xC0, 0xC9, 0x7D, 0x06, 0xEF, 0x09, 0xF9, 0xF3, 0x69, 0xFC, 0xBC, 0xA2, 0xE6, 0x80, 0x22, 0xB9, 0x79, 0x7E, 0xEF, 0x57, 0x9F, 0x49, 0xE1, 0xBC, 0x0D, 0xB6, 0xA1, 0xFE, 0x8D, 0xBC, 0xBB, 0xA3, 0x05, 0x02, 0x6B, 0x04, 0x45, 0xF7, 0x5D, 0xEE, 0x43, 0x06, 0xD6, 0x9C, 0x94, 0x48, 0x1A, 0x0B, 0x9C, 0xBC, 0xB4, 0x4E, 0x93, 0x60, 0x87, 0xCD, 0x58, 0xD6, 0x9A, 0x39, 0xA6, 0xC0, 0x7F, 0x8E, 0xFF, 0x25, 0xC1, 0xD7, 0x2C, 0xF6, 0xF4, 0x6F, 0x24, 0x52, 0x0B, 0x39, 0x42, 0x1B, 0x0D, 0x04, 0xC1, 0x93, 0x2A, 0x19, 0x1C, 0xF0, 0xB1, 0x9B, 0xC1, 0x24, 0x6D, 0x1B, 0x0B, 0xDA, 0x1C, 0x8B, 0x72, 0x48, 0xF0, 0x3E, 0x52, 0xBF, 0x0A, 0x84, 0x3A, 0x9B, 0xC8, 0x6D, 0x13, 0x1E, 0x72, 0xF4, 0x46, 0x93, 0x88, 0x1A, 0x5F, 0x4C, 0x3C, 0xE5, 0x9D, 0x6E, 0xBB, 0x4E, 0xDD, 0x5D, 0x1F, 0x11, 0x40, 0xF4, 0xD7, 0xAF, 0xB3, 0xAB, 0x9A, 0x99, 0x15, 0xF0, 0xDC, 0xAA, 0xFF,
+ 0x9F, 0x2D, 0x9E, 0x56, 0x4F, 0x35, 0x5B, 0xBA, 0x06, 0x99, 0xEA, 0xC6, 0xB4, 0x48, 0x51, 0x17, 0x1E, 0xD1, 0x95, 0x84, 0x81, 0x18, 0xC0, 0xF1, 0x71, 0xDE, 0x44, 0x42, 0x02, 0x06, 0xAC, 0x0E, 0xA8, 0xE2, 0xF3, 0x1F, 0x96, 0x1F, 0xBE, 0xB6, 0x1F, 0xB5, 0x3E, 0xF6, 0x81, 0x05, 0x20, 0xFA, 0x2E, 0x40, 0x2E, 0x4D, 0xA0, 0x0E, 0xDA, 0x42, 0x9C, 0x05, 0xAA, 0x9E, 0xAF, 0x5C, 0xF7, 0x3A, 0x3F, 0xBB, 0x91, 0x73, 0x45, 0x27, 0xA8, 0xA2, 0x07, 0x4A, 0xEF, 0x59, 0x1E, 0x97, 0x9D, 0xE0, 0x30, 0x5A, 0x83, 0xCE, 0x1E, 0x57, 0x32, 0x89, 0x43, 0x41, 0x28, 0x7D, 0x14, 0x8D, 0x8B, 0x41, 0x1A, 0x56, 0x76, 0x43, 0xDB, 0x64, 0x86, 0x41, 0x64, 0x8D, 0x4C, 0x91, 0x83, 0x4E, 0xF5, 0x6C };
+
+ static byte[] pk = { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB };
+
+ private StrongNameKeyPair snpk;
+
+ protected override void TearDown ()
+ {
+ File.Delete ("test.snk");
+ File.Delete ("test.bad");
+ }
+
+ public void TestConstructorByteArray ()
+ {
+ snpk = new StrongNameKeyPair (test);
+ try {
+ AssemblyNameTest.AssertEqualsByteArrays ("PublicKey", pk, snpk.PublicKey);
+ }
+ catch (ArgumentException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructorInvalidByteArray ()
+ {
+ byte[] input = { 0x00, 0x01, 0x02, 0x03 };
+ snpk = new StrongNameKeyPair (input);
+ try {
+ AssemblyNameTest.AssertEqualsByteArrays ("PublicKey", pk, snpk.PublicKey);
+ Fail ("Expected ArgumentException but got none");
+ }
+ catch (ArgumentException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructorNullByteArray ()
+ {
+ try {
+ // we don't want to confuse the compiler with the wrong null
+ byte[] input = null;
+ snpk = new StrongNameKeyPair (input);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructorFileStream ()
+ {
+ FileStream testFile = new FileStream ("test.snk", FileMode.OpenOrCreate);
+ testFile.Write (test, 0, test.Length);
+ testFile.Close ();
+
+ FileStream fs = new FileStream ("test.snk", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ snpk = new StrongNameKeyPair (fs);
+ fs.Close ();
+ try {
+ AssemblyNameTest.AssertEqualsByteArrays ("PublicKey", pk, snpk.PublicKey);
+ }
+ catch (ArgumentException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructorInvalidFileStream ()
+ {
+ FileStream testFile = new FileStream ("test.bad", FileMode.OpenOrCreate);
+ byte[] badheader = { 0xB, 0xAD };
+ testFile.Write (badheader, 0, badheader.Length);
+ testFile.Write (test, 0, test.Length);
+ testFile.Close ();
+
+ // doesn't work on DLL files (actually it works on SNK files)
+ FileStream fs = new FileStream ("test.bad", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ snpk = new StrongNameKeyPair (fs);
+ fs.Close ();
+ try {
+ AssemblyNameTest.AssertEqualsByteArrays ("PublicKey", pk, snpk.PublicKey);
+ Fail ("Expected ArgumentException but got none");
+ }
+ catch (ArgumentException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructorNullFileStream ()
+ {
+ try {
+ // we don't want to confuse the compiler with the wrong null
+ FileStream input = null;
+ snpk = new StrongNameKeyPair (input);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructorNullString ()
+ {
+ try {
+ // we don't want to confuse the compiler with the wrong null
+ string input = null;
+ snpk = new StrongNameKeyPair (input);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Resources/AllTests.cs b/mcs/class/corlib/Test/System.Resources/AllTests.cs
new file mode 100644
index 00000000000..66bbb159c4a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/AllTests.cs
@@ -0,0 +1,28 @@
+//
+// MonoTests.System.Resources.AllTests.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources {
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+//FIXME: ResourceReader is not ready yet.
+// suite.AddTest(ResourceReaderTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Resources/ChangeLog b/mcs/class/corlib/Test/System.Resources/ChangeLog
new file mode 100644
index 00000000000..aafce6ec9a0
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/ChangeLog
@@ -0,0 +1,30 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002/06/14 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Disable ResourceReaderTest for now. The class is not
+ ready yet.
+
+2002-05-22 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReaderTest.cs: Fix path name to resource files (again).
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReaderTest.cs: Fix path name to resource files
+
+2002-01-25 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs:
+ * Empty.resources:
+ * MyResources.resources: Added files
+ * ResourceReaderTest.cs: Test the enumerator
+
+2002-01-24 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReaderTest.cs: Add new file. This test is not done yet.
+ Wanted to save it in cvs for 'disaster recovery' purposes.
+ Just in case.
+
diff --git a/mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs b/mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
new file mode 100644
index 00000000000..1ff2596ee05
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
@@ -0,0 +1,134 @@
+//
+// MonoTests.System.Resources.ResourceReaderTest.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+
+using System;
+using System.Resources;
+using System.IO;
+
+using System.Collections;
+using MonoTests.System.Resources;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources {
+
+ public class ResourceReaderTest : TestCase {
+ private static string m_ResourceFile = "resources" + Path.DirectorySeparatorChar + "MyResources.resources";
+ private static string m_BadResourceFile = "resources" + Path.DirectorySeparatorChar + "Empty.resources";
+
+ protected override void SetUp() {
+ }
+
+ public void TestConstructorStringExceptions() {
+ ResourceReader r;
+ try {
+ r = new ResourceReader((String)null);
+ Fail("Should throw exception on null");
+ } catch{}
+ try {
+ r = new ResourceReader("");
+ Fail("Should throw exception on empty path");
+ } catch{}
+ try {
+ // use a file name that is *very* unlikely to exsist
+ r = new ResourceReader("j38f8axvnn9h38hfa9nxn93f8hav4zvag87vvah32o");
+ Fail("Should throw exception on file not found");
+ } catch{}
+ try {
+ r = new ResourceReader(m_BadResourceFile);
+ Fail("Should throw exception on bad resource file");
+ }
+ catch {}
+ }
+
+ public void TestConstructorString() {
+ if (!File.Exists(m_ResourceFile)) {
+ Fail("Resource file is not where it should be:" + Directory.GetCurrentDirectory()+ "\\" + m_ResourceFile);
+ }
+ ResourceReader r = null;
+ try {
+ r = new ResourceReader(m_ResourceFile);
+ }
+ catch {
+ Fail("Should have been able to open resource file.");
+ }
+ finally {
+ if (null != r)
+ r.Close();
+ }
+ Assert("String constructor should not be null", null != r);
+ }
+
+ public void TestConstructorStreamExceptions() {
+ ResourceReader r;
+ try {
+ r = new ResourceReader((Stream)null);
+ Fail("Should throw exception on null");
+ } catch{}
+
+ try {
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ stream.Close();
+ r = new ResourceReader(stream);
+ Fail("Should throw exception on cannot read");
+ } catch{}
+ }
+
+ public void TestStream(){
+ ResourceReader r = null;
+ try {
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ r = new ResourceReader(stream);
+ }
+ catch{
+ Fail("Should not throw exception constructing from stream");
+ }
+ finally {
+ if (null != r) {
+ r.Close();
+ }
+ }
+ }
+
+ public void TestClose() {
+ ResourceReader r = null;
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ r = new ResourceReader(stream);
+ r.Close();
+ try {
+ stream = new FileStream (m_ResourceFile, FileMode.Open);
+ }
+ catch{
+ Fail("Should be able to open the stream again after close");
+ }
+ finally {
+ if (null != stream) {
+ stream.Close();
+ }
+ }
+ }
+
+ public void TestEnumerator(){
+ ResourceReader reader = null;
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ reader = new ResourceReader(stream);
+ IDictionaryEnumerator en = reader.GetEnumerator();
+ // Goes through the enumerator, printing out the key and value pairs.
+ while (en.MoveNext()) {
+ DictionaryEntry de = (DictionaryEntry)en.Current;
+ Assert("Current.Key should not be empty",String.Empty != (string)de.Key);
+ Assert("Current.Value should not be empty",String.Empty != (string)de.Value);
+ Assert("Current.Value should not be empty",String.Empty != (string)de.Value);
+ Assert("Entry.Key should not be empty",String.Empty != (string)en.Key);
+ Assert("Entry.Value should not be empty",String.Empty != (string)en.Value);
+ }
+ reader.Close();
+ }
+ } // class ResourceReaderTest
+} // namespace MonoTests.System.Resources \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/AllTests.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/AllTests.cs
new file mode 100644
index 00000000000..81f960a0e19
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/AllTests.cs
@@ -0,0 +1,29 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.CompilerServices {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(RuntimeHelpersTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog
new file mode 100644
index 00000000000..d933958b79b
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog
@@ -0,0 +1,10 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-09-21 Zoltan Varga <vargaz@freemail.hu>
+
+ * AllTests.cs: new file
+
+ * RuntimeHelpersTest.cs: new file
+
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs
new file mode 100644
index 00000000000..ca1aee3a30e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs
@@ -0,0 +1,71 @@
+//
+// RuntimeHelpersTest.cs - NUnit Test Cases for the System.Runtime.CompilerServices.RuntimeHelpers class
+//
+// Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+
+using System;
+using System.Runtime.CompilerServices;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.CompilerServices {
+
+ public class RuntimeHelpersTest : TestCase {
+ struct FooStruct {
+ public int i;
+ public string j;
+ }
+
+ class FooClass {
+ public static int counter = 0;
+
+ static FooClass () {
+ counter = counter + 1;
+ }
+ }
+
+ public void TestOffsetToStringData ()
+ {
+ AssertEquals ("OffsetToStringData is not constant",
+ RuntimeHelpers.OffsetToStringData,
+ RuntimeHelpers.OffsetToStringData);
+ }
+
+ public void TestGetObjectValue ()
+ {
+ FooStruct s1;
+ FooStruct s2;
+
+ // Test null
+ AssertEquals ("",
+ RuntimeHelpers.GetObjectValue (null),
+ null);
+
+ // Test non-valuetype
+ AssertEquals ("",
+ RuntimeHelpers.GetObjectValue (this),
+ this);
+
+ // Test valuetype
+ s1.i = 42;
+ s1.j = "FOO";
+ s2 = (FooStruct)RuntimeHelpers.GetObjectValue(s1);
+ s1.i = 43;
+ s1.j = "BAR";
+ AssertEquals ("", s2.i, 42);
+ AssertEquals ("", s2.j, "FOO");
+ }
+
+ public void TestRunClassConstructor ()
+ {
+ RuntimeHelpers.RunClassConstructor (typeof(FooClass).TypeHandle);
+ AssertEquals ("", FooClass.counter, 1);
+
+ // Each static constructor should only be run once
+ RuntimeHelpers.RunClassConstructor (typeof(FooClass).TypeHandle);
+ AssertEquals ("", FooClass.counter, 1);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/AllTests.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/AllTests.cs
new file mode 100644
index 00000000000..e827b9aba08
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization/AllTests.cs
@@ -0,0 +1,29 @@
+//
+// MonoTests.System.Runtime.Serialization.AllTests
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Serialization {
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (ObjectIDGeneratorTests.Suite);
+ suite.AddTest (FormatterServicesTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/ChangeLog b/mcs/class/corlib/Test/System.Runtime.Serialization/ChangeLog
new file mode 100644
index 00000000000..921f6b4e8e3
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization/ChangeLog
@@ -0,0 +1,14 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: added FormatterServicesTests.
+ * FormatterServicesTests.cs: New file.
+
+2002-06-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: New file to make 'make test' work.
+ * ChangeLog: New file.
+
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/FormatterServicesTests.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/FormatterServicesTests.cs
new file mode 100644
index 00000000000..429068e73ad
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization/FormatterServicesTests.cs
@@ -0,0 +1,127 @@
+//
+// System.Runtime.Serialization.FormatterServicesTests: NUnit test
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2002 Ximian Inc. (http://www.ximian.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace MonoTests.System.Runtime.Serialization
+{
+ public class FormatterServicesTests : TestCase
+ {
+ public void TestClass1 ()
+ {
+ DerivedClass1 derived = new DerivedClass1 ();
+ derived.anotherInt = 69;
+ MemberInfo [] members = FormatterServices.GetSerializableMembers (derived.GetType ());
+ Assert ("#01", members != null);
+ AssertEquals ("#02", 3, members.Length);
+
+ object [] data = FormatterServices.GetObjectData (derived, members);
+ Assert ("#03", data != null);
+ AssertEquals ("#04", 3, data.Length);
+
+ DerivedClass1 o = (DerivedClass1) FormatterServices.GetUninitializedObject (derived.GetType ());
+ Assert ("#05", o != null);
+
+ o = (DerivedClass1) FormatterServices.PopulateObjectMembers (o, members, data);
+ Assert ("#06", o != null);
+ AssertEquals ("#07", "hola", o.Hello);
+ AssertEquals ("#08", 21, o.IntBase);
+ AssertEquals ("#09", 1, o.IntDerived);
+ AssertEquals ("#10", 69, o.anotherInt);
+ AssertEquals ("#11", "hey", DerivedClass1.hey);
+ }
+ }
+
+ [Serializable]
+ class BaseClass1
+ {
+ public string hello = "hola";
+ static int intBase = 21;
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ BaseClass1 bc = o as BaseClass1;
+ if (o == null)
+ return false;
+
+ if (hello != "hola")
+ return false;
+
+ return (hello == bc.hello);
+ }
+
+ public string Hello
+ {
+ get {
+ return hello;
+ }
+ }
+
+ public int IntBase
+ {
+ get {
+ return intBase;
+ }
+ }
+ }
+
+ [Serializable]
+ class DerivedClass1 : BaseClass1
+ {
+ private int intDerived = 1;
+ [NonSerialized] public int publicint = 2;
+ public int anotherInt = 22;
+ public static string hey = "hey";
+
+ public string Name
+ {
+ get {
+ return "Ahem";
+ }
+ }
+
+ public void SomeMethod ()
+ {
+ /* Does nothing */
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ DerivedClass1 dc = o as DerivedClass1;
+ if (o == null)
+ return false;
+
+ if (anotherInt != 22 || hey != "hey")
+ return false;
+
+ return (anotherInt == dc.anotherInt);
+ }
+
+ public int IntDerived
+ {
+ get {
+ return intDerived;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs
new file mode 100755
index 00000000000..d15ffd3cafb
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs
@@ -0,0 +1,82 @@
+//
+// System.Runtime.Serialization.ObjectIDGeneratorTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Serialization
+{
+ public class ObjectIDGeneratorTests : TestCase
+ {
+ ObjectIDGenerator generator;
+
+ string obj1 = "obj1";
+ int obj2 = 42;
+ long id;
+
+ protected override void SetUp ()
+ {
+ generator = new ObjectIDGenerator ();
+ }
+
+ //
+ // Tests adding an ID for a new object
+ //
+ public void TestGetId1 ()
+ {
+ bool testBool1;
+ id = generator.GetId (obj1, out testBool1);
+
+ AssertEquals ("A1", 1L, id); // should start at 1
+ AssertEquals ("A2", true, testBool1); // firstTime should be true
+ }
+
+ //
+ // Tests getting the ID for an existing object
+ //
+ public void TestGetId2 ()
+ {
+ bool testBool1;
+ bool testBool2;
+ id = generator.GetId (obj1, out testBool1);
+ long testId1 = generator.GetId (obj1, out testBool2);
+
+ AssertEquals ("B1", testId1, id); // same object, same ID
+ AssertEquals ("B2", false, testBool2); // no longer firstTime
+ }
+
+ //
+ // Tests getting the ID for an existing object
+ //
+ public void TestHasId1 ()
+ {
+ bool testBool1;
+ bool testBool3;
+ id = generator.GetId (obj1, out testBool1);
+ long testId2 = generator.HasId (obj1, out testBool3);
+
+ AssertEquals ("C1", false, testBool3); // this has been inserted before
+ AssertEquals ("C2", id, testId2); // we should get the same ID
+ }
+
+ //
+ // Tests getting the ID for a non-existent object
+ //
+ public void TestHasId2 ()
+ {
+ bool testBool4;
+ long testId3 = generator.HasId (obj2, out testBool4);
+
+ AssertEquals ("D1", 0L, testId3);
+ AssertEquals ("D2", true, testBool4);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/AllTests.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/AllTests.cs
new file mode 100644
index 00000000000..89017cc87e9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/AllTests.cs
@@ -0,0 +1,54 @@
+//
+// TestSuite.System.Security.Cryptography.X509Certificates.AllTests.cs
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography.X509Certificates {
+ /// <summary>
+ /// Combines all available X.509 unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ // because most crypto stuff works with byte[] buffers
+ static public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ if ((array1 == null) && (array2 == null))
+ return;
+ if (array1 == null)
+ Fail (msg + " -> First array is NULL");
+ if (array2 == null)
+ Fail (msg + " -> Second array is NULL");
+
+ bool a = (array1.Length == array2.Length);
+ if (a) {
+ for (int i = 0; i < array1.Length; i++) {
+ if (array1 [i] != array2 [i]) {
+ a = false;
+ break;
+ }
+ }
+ }
+ msg += " -> Expected " + BitConverter.ToString (array1, 0);
+ msg += " is different than " + BitConverter.ToString (array2, 0);
+ Assert (msg, a);
+ }
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (X509CertificateTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
new file mode 100644
index 00000000000..51354ea7f38
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -0,0 +1,21 @@
+2002-12-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * X509CertificateTest.cs: Changed how the dates are compared. This
+ should stop the nunit errors in X509Certificate.
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * X509CertificateTest.cs: Uncommented the GetEffectiveDateString and
+ GetExpirationDateString tests. Added a test for ToString(true).
+
+2002-11-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: New. Include all (1) tests files for X509Certificates.
+ * X509CertificateTest.cs: New. Generated tests using some (11 right
+ now) X.509 certificates. There is a bigger version (346 certs today)
+ to spot new problems (but once spotted they move into this small file).
+ GetEffectiveDateString and GetExpirationDateString tests are commented.
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs
new file mode 100644
index 00000000000..853dbd7c17a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs
@@ -0,0 +1,786 @@
+// !!! DO NOT EDIT - This file is generated automatically - DO NOT EDIT !!!
+//
+// X509CertificateTest.cs - NUnit Test Cases for X509Certificate
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System.Security.Cryptography.X509Certificates {
+
+public class X509CertificateTest : TestCase {
+
+private CultureInfo oldcult;
+
+protected override void SetUp() {
+ oldcult = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("EN-us");
+}
+
+
+protected override void TearDown () {
+ File.Delete("temp.cer");
+ File.Delete("temp.b64");
+}
+
+public void AssertEquals (string msg, byte[] array1, byte[] array2)
+{
+ AllTests.AssertEquals (msg, array1, array2);
+}
+
+public string ToString (byte[] data)
+{
+ StringBuilder sb = new StringBuilder ();
+ for (int i = 0; i < data.Length; i++)
+ sb.Append (data[i].ToString ("X2"));
+ return sb.ToString ();
+}
+
+//--8<-- NON GENERATED CODE STARTS HERE --8<----8<----8<----8<----8<----8<--
+
+//-->8-- NON GENERATED CODE ENDS HERE -->8---->8---->8---->8---->8---->8--
+
+// Certificate: basic\COMMERCE.cer
+// - X.509v1 (i.e. without any extensions)
+// - md2RSA (MD2 isn't part of the Cryptography namespace)
+// - Uncommon key size (RSA 680 bits)
+public void TestCertificate1 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
+ 0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x37,0x5A,0x17,0x0D,0x39,0x37,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x36,0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x31,0x14,0x30,0x12,0x06,0x03,
+ 0x55,0x04,0x0A,0x13,0x0B,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,0x13,0x1E,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x70,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x5F,0x00,0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,
+ 0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x7E,0x00,0x54,0x20,0x67,0x12,0xBB,0x66,0x14,0xC3,0x26,0x6B,0x7F,
+ 0xDA,0x4A,0x25,0x4D,0x8B,0xE0,0xFD,0x1E,0x53,0x6D,0xAC,0xA2,0xD0,0x89,0xB8,0x2E,0x90,0xA0,0x27,0x43,0xA4,0xEE,0x4A,0x26,0x86,0x40,0xFF,0xB8,0x72,0x8D,0x1E,0xE7,0xB7,0x77,0xDC,0x7D,0xD8,0x3F,0x3A,0x6E,0x55,0x10,0xA6,0x1D,0xB5,0x58,0xF2,0xF9,0x0F,0x2E,0xB4,0x10,0x55,0x48,0xDC,0x13,0x5F,0x0D,0x08,0x26,0x88,0xC9,0xAF,0x66,0xF2,0x2C,0x9C,0x6F,0x3D,0xC3,0x2B,0x69,0x28,0x89,0x40,0x6F,0x8F,0x35,0x3B,0x9E,0xF6,0x8E,0xF1,0x11,0x17,0xFB,0x0C,0x98,0x95,0xA1,0xC2,0xBA,0x89,0x48,0xEB,0xB4,0x06,0x6A,0x22,0x54,
+ 0xD7,0xBA,0x18,0x3A,0x48,0xA6,0xCB,0xC2,0xFD,0x20,0x57,0xBC,0x63,0x1C };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0xD6,0x2F,0x48,0xD0,0x13,0xEE,0x7F,0xB5,0x8B,0x79,0x07,0x45,0x12,0x67,0x0D,0x9C,0x5B,0x3A,0x5D,0xA9 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "D62F48D013EE7FB58B79074512670D9C5B3A5DA9", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-03-12 10:38:47", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "1997-03-12 10:38:46", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", -701544240, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, S=California, O=CommerceNet, OU=Server Certification Authority", x509.GetName ());
+ byte[] pubkey = { 0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "305C02552D58E9BFF031CD7906505AD59E0E2CE6C2F7F9D2CE556485B1909A92B336C1BCEAC823B7AB3AA76463775F84228EE5B645DD46AE0ADD00C21FBAD9ADC07562F89582A280B18269FAE1AF7FBC7DE27C76D5BC2A80FB0203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0xE8,0x06,0x00,0x72,0x02 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "E806007202", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x2C,0x20,0x4F,0x3D,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,
+ 0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x4B,
+ 0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x45,0x38,0x30,0x36,0x30,0x30,0x37,0x32,0x30,0x32,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,
+ 0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x35,0x43,0x30,0x32,0x35,0x35,0x32,0x44,0x35,0x38,0x45,0x39,0x42,0x46,0x46,0x30,0x33,0x31,0x43,0x44,0x37,0x39,0x30,0x36,0x35,0x30,0x35,0x41,0x44,0x35,0x39,0x45,0x30,0x45,0x32,0x43,0x45,0x36,0x43,0x32,0x46,0x37,0x46,0x39,0x44,0x32,0x43,0x45,0x35,0x35,0x36,0x34,0x38,0x35,0x42,0x31,0x39,0x30,0x39,0x41,0x39,0x32,0x42,0x33,0x33,0x36,0x43,0x31,0x42,0x43,0x45,0x41,0x43,0x38,0x32,0x33,0x42,0x37,0x41,0x42,0x33,0x41,0x41,0x37,
+ 0x36,0x34,0x36,0x33,0x37,0x37,0x35,0x46,0x38,0x34,0x32,0x32,0x38,0x45,0x45,0x35,0x42,0x36,0x34,0x35,0x44,0x44,0x34,0x36,0x41,0x45,0x30,0x41,0x44,0x44,0x30,0x30,0x43,0x32,0x31,0x46,0x42,0x41,0x44,0x39,0x41,0x44,0x43,0x30,0x37,0x35,0x36,0x32,0x46,0x38,0x39,0x35,0x38,0x32,0x41,0x32,0x38,0x30,0x42,0x31,0x38,0x32,0x36,0x39,0x46,0x41,0x45,0x31,0x41,0x46,0x37,0x46,0x42,0x43,0x37,0x44,0x45,0x32,0x37,0x43,0x37,0x36,0x44,0x35,0x42,0x43,0x32,0x41,0x38,0x30,0x46,0x42,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,
+ 0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\ATT.cer
+// - X.509v1 (i.e. without any extensions)
+// - md5RSA, RSA 1024 bits, self-signed
+// - has a ampersand (&) in its DN
+public void TestCertificate2 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x01,0xDF,0x30,0x82,0x01,0x48,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x31,0x31,0x38,0x32,0x31,0x30,0x33,0x35,0x32,
+ 0x5A,0x17,0x0D,0x30,0x31,0x30,0x31,0x31,0x36,0x32,0x31,0x30,0x33,0x35,0x32,0x5A,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,
+ 0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,0xB8,0xA4,
+ 0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x38,0x50,0x1D,0x0A,0xD3,0x1B,0xBB,0xA2,0x9F,0x6C,0x8D,0x10,0xAA,0x42,0x1B,0x05,0x8D,0xE4,0x25,0xAB,0xFB,0x55,0xAE,0x6D,0xBA,0x53,0x67,0x15,0x07,0x9A,0xEC,0x55,0x9F,0x72,0x89,0x5F,0x24,0xB0,0xDB,0xCA,0x64,0xBD,0x64,0xAA,0xC2,0x8C,
+ 0xD9,0x3D,0xA2,0x45,0xB7,0xC6,0x92,0x71,0x51,0xEF,0xED,0xE1,0x51,0x54,0x97,0x56,0x35,0xA1,0xCE,0xE4,0x44,0xC4,0x47,0x66,0xFF,0x91,0xDA,0x88,0x9C,0x23,0xC2,0xB3,0xD4,0x62,0x4A,0xBC,0x94,0x55,0x9C,0x80,0x8E,0xB3,0xDD,0x4F,0x1A,0xED,0x12,0x5A,0xB5,0x2E,0xBC,0xF8,0x4B,0xCE,0xC6,0xD4,0x70,0xB3,0xB3,0x22,0xF8,0x5E,0x5C,0x36,0x7A,0xA6,0xB8,0x39,0x73,0x46,0x43,0x5C,0x9B,0x9A,0xBD,0x1E,0x7E,0xA7,0x04,0xCF,0x25,0x36 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x9E,0x87,0x80,0x3E,0xC5,0x68,0x9A,0xEF,0xE7,0x7F,0x92,0xF9,0x1A,0xBF,0xA7,0x46,0x7C,0x76,0xED,0x02 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "9E87803EC5689AEFE77F92F91ABFA7467C76ED02", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-01-18 13:03:52", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "2001-01-16 13:03:52", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", -1635286978, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=AT&T, OU=Directory Services", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=AT&T, OU=Directory Services", x509.GetName ());
+ byte[] pubkey = { 0x30,0x81,0x87,0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,
+ 0xB8,0xA4,0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "30818702818100876472890B208F8727ACC622FE00406948AFC686CD2333E311C5311A1F7E9E9213B6A2ACE3B01F2A076CB6D4DE4BFAF1A2A07DCE4BBEBE2648098C8511DECB22E7C2EE4451FE67D55B5AE016375404B83B321294839EB14D806CA4A976ACB8A497F7AB0B6CA543BA6E4FC54E0030163C3F9914DAA220088BBAED76AC9700D56D02010F", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x00 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "00", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,
+ 0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,
+ 0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x37,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x38,0x37,0x36,0x34,0x37,0x32,0x38,0x39,0x30,0x42,0x32,0x30,0x38,0x46,0x38,0x37,0x32,0x37,0x41,0x43,0x43,0x36,0x32,0x32,0x46,0x45,0x30,0x30,0x34,0x30,0x36,0x39,0x34,0x38,0x41,0x46,0x43,0x36,0x38,0x36,0x43,0x44,0x32,0x33,0x33,0x33,0x45,0x33,0x31,0x31,0x43,0x35,0x33,
+ 0x31,0x31,0x41,0x31,0x46,0x37,0x45,0x39,0x45,0x39,0x32,0x31,0x33,0x42,0x36,0x41,0x32,0x41,0x43,0x45,0x33,0x42,0x30,0x31,0x46,0x32,0x41,0x30,0x37,0x36,0x43,0x42,0x36,0x44,0x34,0x44,0x45,0x34,0x42,0x46,0x41,0x46,0x31,0x41,0x32,0x41,0x30,0x37,0x44,0x43,0x45,0x34,0x42,0x42,0x45,0x42,0x45,0x32,0x36,0x34,0x38,0x30,0x39,0x38,0x43,0x38,0x35,0x31,0x31,0x44,0x45,0x43,0x42,0x32,0x32,0x45,0x37,0x43,0x32,0x45,0x45,0x34,0x34,0x35,0x31,0x46,0x45,0x36,0x37,0x44,0x35,0x35,0x42,0x35,0x41,0x45,0x30,0x31,0x36,0x33,
+ 0x37,0x35,0x34,0x30,0x34,0x42,0x38,0x33,0x42,0x33,0x32,0x31,0x32,0x39,0x34,0x38,0x33,0x39,0x45,0x42,0x31,0x34,0x44,0x38,0x30,0x36,0x43,0x41,0x34,0x41,0x39,0x37,0x36,0x41,0x43,0x42,0x38,0x41,0x34,0x39,0x37,0x46,0x37,0x41,0x42,0x30,0x42,0x36,0x43,0x41,0x35,0x34,0x33,0x42,0x41,0x36,0x45,0x34,0x46,0x43,0x35,0x34,0x45,0x30,0x30,0x33,0x30,0x31,0x36,0x33,0x43,0x33,0x46,0x39,0x39,0x31,0x34,0x44,0x41,0x41,0x32,0x32,0x30,0x30,0x38,0x38,0x42,0x42,0x41,0x45,0x44,0x37,0x36,0x41,0x43,0x39,0x37,0x30,0x30,0x44,
+ 0x35,0x36,0x44,0x30,0x32,0x30,0x31,0x30,0x46,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\MYSET.cer
+// - X.509v3, sha1RSA, RSA 512 bits
+// - unreadable subject name (CN)
+public void TestCertificate3 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x03,0x4E,0x30,0x82,0x02,0xB7,0xA0,0x03,0x02,0x01,0x02,0x02,0x20,0x03,0x53,0xD7,0x8B,0xDB,0x3E,0x16,0x15,0x80,0x55,0xC4,0x05,0x40,0x02,0x73,0x4D,0x0C,0x20,0xF8,0x0D,0x88,0x00,0x5F,0x65,0x7A,0xAC,0xBA,0x86,0xBD,0x1C,0xD7,0xE4,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x49,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,
+ 0x49,0x44,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x36,0x30,0x38,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x6E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x0A,0x13,0x07,0x42,0x72,0x61,0x6E,0x64,0x49,
+ 0x44,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x49,0x6E,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x03,0x13,0x1C,0x30,0x2B,0x57,0x4B,0x4A,0x78,0x2B,0x77,0x59,0x45,0x5A,0x61,0x62,0x53,0x53,0x50,0x56,0x58,0x39,0x6B,0x4C,0x73,0x6E,0x78,0x39,0x32,0x73,0x3D,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,
+ 0x30,0x48,0x02,0x41,0x00,0xAC,0xC4,0x0E,0x05,0x25,0xBC,0xEA,0xEF,0x0C,0x22,0x7F,0xC4,0x0C,0x4A,0x69,0x31,0x00,0xF9,0x3F,0xE9,0xE1,0x6C,0x54,0x97,0x77,0x4E,0x18,0xC6,0x4A,0x95,0xE0,0xD4,0x58,0x29,0x5C,0x17,0x5D,0x1D,0x1E,0x56,0xBC,0x49,0x3D,0xE0,0xF9,0x9F,0xBB,0x01,0xF9,0x86,0xB6,0xA6,0x95,0xDD,0xE1,0x04,0x32,0x01,0x52,0x4E,0x8F,0x86,0x30,0xF7,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x01,0x44,0x30,0x82,0x01,0x40,0x30,0x5C,0x06,0x03,0x55,0x1D,0x23,0x04,0x55,0x30,0x53,0x81,0x4B,0x84,0x49,0x31,0x0B,0x30,
+ 0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,0x49,0x44,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x82,0x04,0x32,0x06,0xAC,0x10,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x2E,0x06,0x03,0x55,0x1D,0x10,0x01,
+ 0x01,0xFF,0x04,0x24,0x30,0x22,0x80,0x0F,0x31,0x39,0x39,0x36,0x30,0x38,0x30,0x37,0x30,0x37,0x34,0x39,0x30,0x30,0x5A,0x81,0x0F,0x31,0x39,0x39,0x36,0x30,0x39,0x30,0x37,0x30,0x37,0x34,0x39,0x30,0x30,0x5A,0x30,0x18,0x06,0x03,0x55,0x1D,0x20,0x04,0x11,0x30,0x0F,0x30,0x0D,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x02,0x30,0x00,0x30,0x14,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x02,0x03,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,
+ 0x07,0x80,0x30,0x62,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x02,0x07,0x01,0x01,0xFF,0x04,0x52,0x30,0x50,0x04,0x14,0x33,0x39,0x38,0x32,0x33,0x39,0x38,0x37,0x32,0x33,0x37,0x38,0x39,0x31,0x33,0x34,0x39,0x37,0x38,0x32,0x30,0x09,0x06,0x05,0x2B,0x0D,0x03,0x02,0x1A,0x05,0x00,0x16,0x0F,0x74,0x65,0x72,0x73,0x65,0x20,0x73,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x1D,0x00,0x16,0x1A,0x67,0x65,0x74,0x73,0x65,0x74,0x2D,0x63,0x65,0x6E,0x74,0x65,0x72,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,
+ 0x6F,0x6D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0x1D,0x6C,0x90,0xF2,0x02,0x10,0xD5,0xA0,0x7B,0xEB,0x07,0x14,0x1D,0xAE,0x2C,0xD5,0xB1,0x4C,0x23,0x30,0xB2,0x31,0x7F,0x96,0x3C,0xD1,0x41,0x11,0xEA,0x08,0x0D,0x80,0x5F,0x46,0x66,0x9D,0x0A,0xF2,0x91,0xE8,0x7C,0xCE,0xC0,0xAD,0xE6,0x96,0x19,0x9C,0x26,0xC3,0x4E,0xEB,0x6F,0xF4,0x4A,0x69,0x4C,0xFE,0x4C,0x76,0xB3,0x51,0xCA,0x44,0x03,0xFC,0xD4,0xF4,0xF9,0x32,0x2A,0xAE,0x03,0x1B,0x5F,0xA6,0xBF,0x16,0x61,
+ 0xA0,0x07,0x86,0x85,0xA7,0xD6,0x0D,0xEF,0x88,0x9B,0x2A,0xBA,0xB8,0xD4,0x5C,0x94,0x7C,0x63,0xE1,0xE0,0x69,0xEB,0x3D,0x2F,0xC1,0x71,0x56,0x47,0x55,0x4B,0xB8,0xFD,0xCD,0xD6,0xC7,0x6F,0xA7,0x47,0xE9,0x43,0x91,0x2E,0xCF,0x93,0xA4,0x05,0x18,0xC5,0x98 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x39,0x5F,0xBB,0xFC,0x14,0x89,0x33,0x27,0x76,0x89,0xB7,0x59,0x3A,0x7D,0x1C,0xFF,0xF1,0x56,0xF1,0x62 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "395FBBFC148933277689B7593A7D1CFFF156F162", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-08-06 16:00:00", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "1996-08-31 15:59:59", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", 962575356, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=CCA - Unique ID, CN=Brand Name:Product Type", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=BrandID, OU=Issuing Financial Institution, CN=\"0+WKJx+wYEZabSSPVX9kLsnx92s=\"", x509.GetName ());
+ byte[] pubkey = { 0x30,0x48,0x02,0x41,0x00,0xAC,0xC4,0x0E,0x05,0x25,0xBC,0xEA,0xEF,0x0C,0x22,0x7F,0xC4,0x0C,0x4A,0x69,0x31,0x00,0xF9,0x3F,0xE9,0xE1,0x6C,0x54,0x97,0x77,0x4E,0x18,0xC6,0x4A,0x95,0xE0,0xD4,0x58,0x29,0x5C,0x17,0x5D,0x1D,0x1E,0x56,0xBC,0x49,0x3D,0xE0,0xF9,0x9F,0xBB,0x01,0xF9,0x86,0xB6,0xA6,0x95,0xDD,0xE1,0x04,0x32,0x01,0x52,0x4E,0x8F,0x86,0x30,0xF7,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "3048024100ACC40E0525BCEAEF0C227FC40C4A693100F93FE9E16C5497774E18C64A95E0D458295C175D1D1E56BC493DE0F99FBB01F986B6A695DDE1043201524E8F8630F70203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0xE4,0xD7,0x1C,0xBD,0x86,0xBA,0xAC,0x7A,0x65,0x5F,0x00,0x88,0x0D,0xF8,0x20,0x0C,0x4D,0x73,0x02,0x40,0x05,0xC4,0x55,0x80,0x15,0x16,0x3E,0xDB,0x8B,0xD7,0x53,0x03 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "E4D71CBD86BAAC7A655F00880DF8200C4D73024005C4558015163EDB8BD75303", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x42,0x72,0x61,0x6E,0x64,0x49,0x44,0x2C,0x20,0x4F,0x55,0x3D,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x49,0x6E,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x22,0x30,0x2B,0x57,0x4B,0x4A,0x78,0x2B,0x77,
+ 0x59,0x45,0x5A,0x61,0x62,0x53,0x53,0x50,0x56,0x58,0x39,0x6B,0x4C,0x73,0x6E,0x78,0x39,0x32,0x73,0x3D,0x22,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,0x49,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,
+ 0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x45,0x34,0x44,0x37,0x31,0x43,0x42,0x44,0x38,0x36,0x42,0x41,0x41,0x43,0x37,0x41,0x36,0x35,0x35,0x46,0x30,0x30,0x38,0x38,0x30,0x44,0x46,0x38,0x32,0x30,0x30,0x43,0x34,0x44,0x37,0x33,0x30,0x32,0x34,0x30,0x30,0x35,0x43,0x34,0x35,0x35,0x38,0x30,0x31,0x35,0x31,0x36,0x33,0x45,
+ 0x44,0x42,0x38,0x42,0x44,0x37,0x35,0x33,0x30,0x33,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x34,0x38,0x30,0x32,0x34,0x31,0x30,0x30,0x41,0x43,0x43,0x34,0x30,0x45,0x30,0x35,0x32,0x35,0x42,0x43,0x45,0x41,0x45,0x46,0x30,0x43,0x32,0x32,0x37,0x46,0x43,0x34,0x30,0x43,0x34,0x41,0x36,0x39,
+ 0x33,0x31,0x30,0x30,0x46,0x39,0x33,0x46,0x45,0x39,0x45,0x31,0x36,0x43,0x35,0x34,0x39,0x37,0x37,0x37,0x34,0x45,0x31,0x38,0x43,0x36,0x34,0x41,0x39,0x35,0x45,0x30,0x44,0x34,0x35,0x38,0x32,0x39,0x35,0x43,0x31,0x37,0x35,0x44,0x31,0x44,0x31,0x45,0x35,0x36,0x42,0x43,0x34,0x39,0x33,0x44,0x45,0x30,0x46,0x39,0x39,0x46,0x42,0x42,0x30,0x31,0x46,0x39,0x38,0x36,0x42,0x36,0x41,0x36,0x39,0x35,0x44,0x44,0x45,0x31,0x30,0x34,0x33,0x32,0x30,0x31,0x35,0x32,0x34,0x45,0x38,0x46,0x38,0x36,0x33,0x30,0x46,0x37,0x30,0x32,
+ 0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\RSA.cer
+// - X.509v1 (i.e. without any extensions) self-signed certificate
+// - md2RSA (MD2 isn't part of the Cryptography namespace)
+// - Uncommon key size (RSA 1000 bits)
+public void TestCertificate4 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x02,0x29,0x30,0x82,0x01,0x96,0x02,0x05,0x02,0x41,0x00,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
+ 0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x34,0x31,0x31,0x30,0x39,0x32,0x33,0x35,0x34,0x31,0x37,0x5A,0x17,0x0D,0x39,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x34,0x31,0x37,0x5A,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,
+ 0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x81,0x9B,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x89,0x00,0x30,0x81,0x85,0x02,0x7E,0x00,0x92,0xCE,0x7A,0xC1,0xAE,0x83,0x3E,0x5A,0xAA,0x89,0x83,0x57,0xAC,0x25,0x01,0x76,0x0C,
+ 0xAD,0xAE,0x8E,0x2C,0x37,0xCE,0xEB,0x35,0x78,0x64,0x54,0x03,0xE5,0x84,0x40,0x51,0xC9,0xBF,0x8F,0x08,0xE2,0x8A,0x82,0x08,0xD2,0x16,0x86,0x37,0x55,0xE9,0xB1,0x21,0x02,0xAD,0x76,0x68,0x81,0x9A,0x05,0xA2,0x4B,0xC9,0x4B,0x25,0x66,0x22,0x56,0x6C,0x88,0x07,0x8F,0xF7,0x81,0x59,0x6D,0x84,0x07,0x65,0x70,0x13,0x71,0x76,0x3E,0x9B,0x77,0x4C,0xE3,0x50,0x89,0x56,0x98,0x48,0xB9,0x1D,0xA7,0x29,0x1A,0x13,0x2E,0x4A,0x11,0x59,0x9C,0x1E,0x15,0xD5,0x49,0x54,0x2C,0x73,0x3A,0x69,0x82,0xB1,0x97,0x39,0x9C,0x6D,0x70,0x67,
+ 0x48,0xE5,0xDD,0x2D,0xD6,0xC8,0x1E,0x7B,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x7E,0x00,0x88,0xD1,0xD1,0x79,0x21,0xCE,0xE2,0x8B,0xE8,0xF8,0xC1,0x7D,0x34,0x53,0x3F,0x61,0x83,0xD9,0xB6,0x0B,0x38,0x17,0xB6,0xE8,0xBE,0x21,0x8D,0x8F,0x00,0xB8,0x8B,0x53,0x7E,0x44,0x67,0x1E,0x22,0xBD,0x97,0x27,0xE0,0x9C,0x85,0xCC,0x4A,0xF6,0x85,0x3B,0xB2,0xE2,0xBE,0x92,0xD3,0xE5,0x0D,0xE9,0xAF,0x5C,0x0E,0x0C,0x46,0x95,0xFF,0xA1,0x1C,0x5E,0x3E,0xE8,0x36,
+ 0x58,0x7A,0x73,0xA6,0x0A,0xF8,0x22,0x11,0x6B,0xC3,0x09,0x38,0x7E,0x26,0xBB,0x73,0xEF,0x00,0xBD,0x02,0xA4,0xF3,0x14,0x0D,0x30,0x3F,0x61,0x70,0x7B,0x20,0xFE,0x32,0xA3,0x9F,0xB3,0xF4,0x67,0x52,0xDC,0xB4,0xEE,0x84,0x8C,0x96,0x36,0x20,0xDE,0x81,0x08,0x83,0x71,0x21,0x8A,0x0F,0x9E,0xA9 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x0D,0x97,0x44,0x61,0x70,0x37,0x13,0xCB,0x74,0x93,0x2D,0x2A,0x75,0xAC,0xBC,0x71,0x4B,0x28,0x12,0x66 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "0D974461703713CB74932D2A75ACBC714B281266", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1994-11-09 15:54:17", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "1999-12-31 15:54:17", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", 228017249, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetName ());
+ byte[] pubkey = { 0x30,0x81,0x85,0x02,0x7E,0x00,0x92,0xCE,0x7A,0xC1,0xAE,0x83,0x3E,0x5A,0xAA,0x89,0x83,0x57,0xAC,0x25,0x01,0x76,0x0C,0xAD,0xAE,0x8E,0x2C,0x37,0xCE,0xEB,0x35,0x78,0x64,0x54,0x03,0xE5,0x84,0x40,0x51,0xC9,0xBF,0x8F,0x08,0xE2,0x8A,0x82,0x08,0xD2,0x16,0x86,0x37,0x55,0xE9,0xB1,0x21,0x02,0xAD,0x76,0x68,0x81,0x9A,0x05,0xA2,0x4B,0xC9,0x4B,0x25,0x66,0x22,0x56,0x6C,0x88,0x07,0x8F,0xF7,0x81,0x59,0x6D,0x84,0x07,0x65,0x70,0x13,0x71,0x76,0x3E,0x9B,0x77,0x4C,0xE3,0x50,0x89,0x56,0x98,0x48,0xB9,0x1D,0xA7,0x29,0x1A,0x13,
+ 0x2E,0x4A,0x11,0x59,0x9C,0x1E,0x15,0xD5,0x49,0x54,0x2C,0x73,0x3A,0x69,0x82,0xB1,0x97,0x39,0x9C,0x6D,0x70,0x67,0x48,0xE5,0xDD,0x2D,0xD6,0xC8,0x1E,0x7B,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "308185027E0092CE7AC1AE833E5AAA898357AC2501760CADAE8E2C37CEEB3578645403E5844051C9BF8F08E28A8208D216863755E9B12102AD7668819A05A24BC94B256622566C88078FF781596D840765701371763E9B774CE35089569848B91DA7291A132E4A11599C1E15D549542C733A6982B197399C6D706748E5DD2DD6C81E7B0203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x01,0x00,0x00,0x41,0x02 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "0100004102", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,
+ 0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,
+ 0x69,0x74,0x79,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x31,0x30,0x30,0x30,0x30,0x34,0x31,0x30,0x32,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,
+ 0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x35,0x30,0x32,0x37,0x45,0x30,0x30,0x39,0x32,0x43,0x45,0x37,0x41,0x43,0x31,0x41,0x45,0x38,0x33,0x33,0x45,0x35,0x41,0x41,0x41,0x38,0x39,0x38,0x33,0x35,0x37,0x41,0x43,0x32,0x35,0x30,0x31,0x37,0x36,0x30,0x43,0x41,0x44,0x41,0x45,0x38,0x45,0x32,0x43,0x33,0x37,0x43,0x45,0x45,0x42,0x33,0x35,0x37,0x38,0x36,0x34,0x35,0x34,0x30,0x33,0x45,0x35,0x38,0x34,0x34,0x30,0x35,0x31,0x43,
+ 0x39,0x42,0x46,0x38,0x46,0x30,0x38,0x45,0x32,0x38,0x41,0x38,0x32,0x30,0x38,0x44,0x32,0x31,0x36,0x38,0x36,0x33,0x37,0x35,0x35,0x45,0x39,0x42,0x31,0x32,0x31,0x30,0x32,0x41,0x44,0x37,0x36,0x36,0x38,0x38,0x31,0x39,0x41,0x30,0x35,0x41,0x32,0x34,0x42,0x43,0x39,0x34,0x42,0x32,0x35,0x36,0x36,0x32,0x32,0x35,0x36,0x36,0x43,0x38,0x38,0x30,0x37,0x38,0x46,0x46,0x37,0x38,0x31,0x35,0x39,0x36,0x44,0x38,0x34,0x30,0x37,0x36,0x35,0x37,0x30,0x31,0x33,0x37,0x31,0x37,0x36,0x33,0x45,0x39,0x42,0x37,0x37,0x34,0x43,0x45,
+ 0x33,0x35,0x30,0x38,0x39,0x35,0x36,0x39,0x38,0x34,0x38,0x42,0x39,0x31,0x44,0x41,0x37,0x32,0x39,0x31,0x41,0x31,0x33,0x32,0x45,0x34,0x41,0x31,0x31,0x35,0x39,0x39,0x43,0x31,0x45,0x31,0x35,0x44,0x35,0x34,0x39,0x35,0x34,0x32,0x43,0x37,0x33,0x33,0x41,0x36,0x39,0x38,0x32,0x42,0x31,0x39,0x37,0x33,0x39,0x39,0x43,0x36,0x44,0x37,0x30,0x36,0x37,0x34,0x38,0x45,0x35,0x44,0x44,0x32,0x44,0x44,0x36,0x43,0x38,0x31,0x45,0x37,0x42,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\TL-CERT.cer
+// - X.509v3 self-signed certificate
+// - sha1RSA, RSA 2048 bits
+public void TestCertificate5 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x06,0x2F,0x30,0x82,0x05,0x17,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x6A,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x20,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x39,0x37,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x34,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x20,0x31,0x0B,
+ 0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD4,0xDC,0x3E,0xBA,0xE1,0x94,0xF7,0xBE,0xCD,0xED,0x21,0x77,0xCF,0xDA,0x88,0x58,0x51,0x0E,0x8F,0xF4,0xDA,0x00,0x14,0x1E,0x0D,0xA7,0xAD,0xB6,0x96,0x5A,0xC6,0xD3,0xEC,0x25,0xED,0xD8,0x43,
+ 0x0B,0x6E,0x7F,0x3F,0x9E,0x1E,0x74,0xA0,0x1E,0x97,0x76,0x30,0xCA,0x6F,0x0A,0x63,0xC0,0xA3,0x31,0x40,0x25,0x80,0xB8,0xBD,0x28,0xEB,0x7D,0x75,0x0B,0x4E,0x41,0x34,0xC4,0x20,0x00,0xC2,0xCB,0xF4,0x9A,0x20,0x00,0x58,0xD9,0xF4,0x40,0x13,0x18,0x77,0x0C,0xB5,0x04,0xDE,0xB7,0xB6,0x43,0x8B,0xA4,0xCC,0x36,0x76,0x79,0xC5,0x0B,0x17,0xCB,0x7E,0x88,0xA1,0x33,0xB0,0xD3,0x34,0x27,0xBF,0x3B,0x61,0xDA,0xC5,0x20,0xEB,0xF9,0x94,0x9A,0x8B,0x79,0xB2,0xA8,0x8E,0xCB,0xC1,0xD9,0x94,0x4A,0x99,0x66,0x50,0x55,0xB2,0x83,0x28,
+ 0x7D,0x22,0x3D,0xEC,0xDC,0xA3,0xE8,0x39,0xDB,0x83,0x54,0xC9,0x89,0xA9,0xDF,0x59,0x52,0x9F,0x7A,0xEF,0x7C,0x11,0x62,0x52,0xEC,0xE6,0x67,0xBA,0x3D,0xEA,0xAB,0x47,0xDB,0xE4,0xF4,0x1F,0x73,0xC3,0x3D,0xEC,0x7E,0x84,0x7D,0x2F,0x29,0xFE,0x6C,0x17,0x3F,0x75,0x6D,0x56,0x6E,0xC0,0x4E,0xB5,0xBF,0x2A,0x20,0x8A,0xE4,0x57,0xAE,0xC0,0x2E,0x68,0xC9,0x09,0xCF,0x85,0x77,0x0A,0xEF,0x3A,0x37,0xCB,0x60,0x4C,0x45,0x73,0x7F,0x90,0x3E,0x86,0x1D,0xFA,0xC3,0xFC,0x50,0x8A,0xB2,0xC5,0x8A,0x34,0xF0,0xF2,0x43,0xEE,0x3C,0x56,
+ 0xBA,0x24,0xE9,0xE0,0xA5,0x87,0x1E,0x7C,0x30,0x33,0x77,0xFD,0x5D,0xE0,0x57,0x0D,0x6C,0x19,0x39,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x03,0x72,0x30,0x82,0x03,0x6E,0x30,0x12,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x08,0x30,0x06,0x01,0x01,0xFF,0x02,0x01,0x03,0x30,0x82,0x02,0xC9,0x06,0x03,0x55,0x1D,0x20,0x01,0x01,0xFF,0x04,0x82,0x02,0xBD,0x30,0x82,0x02,0xB9,0x30,0x82,0x02,0xB5,0x06,0x04,0x67,0x2A,0x05,0x00,0x30,0x82,0x02,0xAB,0x30,0x82,0x02,0xA7,0x06,0x04,0x67,0x2A,0x07,0x06,0x30,0x82,0x02,0x9D,
+ 0x30,0x82,0x02,0x99,0x1A,0x82,0x02,0x95,0x54,0x68,0x69,0x73,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x61,0x6E,0x64,0x20,0x61,0x6E,0x79,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x64,0x69,0x72,0x65,0x63,0x74,0x6C,0x79,0x20,0x6F,0x72,0x20,0x69,0x6E,0x64,0x69,0x72,0x65,0x63,0x74,0x6C,0x79,0x20,0x62,0x79,0x20,0x74,0x68,0x69,0x73,0x20,0x63,
+ 0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x2C,0x20,0x6D,0x61,0x79,0x20,0x6F,0x6E,0x6C,0x79,0x20,0x62,0x65,0x20,0x75,0x73,0x65,0x64,0x20,0x74,0x6F,0x20,0x65,0x6E,0x61,0x62,0x6C,0x65,0x20,0x22,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x54,0x72,0x61,0x6E,0x73,0x61,0x63,0x74,0x69,0x6F,0x6E,0x73,0x22,0x20,0x61,0x73,0x20,0x64,0x65,0x66,0x69,0x6E,0x65,0x64,0x20,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,
+ 0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x61,0x6E,0x64,0x2C,0x20,0x77,0x68,0x65,0x6E,0x20,0x61,0x70,0x70,0x72,0x6F,0x70,0x72,0x69,0x61,0x74,0x65,0x2C,0x20,0x69,0x6E,0x20,0x61,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x2E,0x20,0x20,
+ 0x4E,0x6F,0x20,0x50,0x61,0x72,0x74,0x79,0x20,0x6D,0x61,0x79,0x20,0x72,0x65,0x6C,0x79,0x20,0x75,0x70,0x6F,0x6E,0x20,0x74,0x68,0x65,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x66,0x6F,0x72,0x20,0x61,0x6E,0x79,0x20,0x6F,0x74,0x68,0x65,0x72,0x20,0x70,0x75,0x72,0x70,0x6F,0x73,0x65,0x2E,0x20,0x20,0x41,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x62,0x65,0x20,0x61,0x6E,0x79,0x20,0x70,0x61,0x79,
+ 0x6D,0x65,0x6E,0x74,0x20,0x62,0x72,0x61,0x6E,0x64,0x20,0x77,0x68,0x6F,0x73,0x65,0x20,0x53,0x45,0x54,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x73,0x20,0x73,0x69,0x67,0x6E,0x65,0x64,0x20,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x20,0x6B,0x65,0x79,0x20,0x63,0x6F,0x72,0x72,0x65,0x73,0x70,0x6F,0x6E,0x64,0x69,0x6E,0x67,0x20,0x74,0x6F,0x20,0x74,0x68,0x65,0x20,0x70,0x75,0x62,0x6C,0x69,0x63,0x20,0x6B,0x65,0x79,0x20,0x63,0x6F,0x6E,0x74,0x61,0x69,
+ 0x6E,0x65,0x64,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x6D,0x61,0x74,0x74,0x65,0x72,0x73,0x20,0x72,0x65,0x6C,0x61,0x74,0x69,0x6E,0x67,0x20,0x74,0x6F,0x20,0x75,0x73,0x61,0x67,0x65,0x2C,0x20,0x6C,0x69,0x61,0x62,0x69,0x6C,0x69,0x74,0x79,0x20,0x61,0x6E,0x64,0x20,0x70,0x72,0x6F,0x63,0x65,0x64,0x75,0x72,0x65,0x73,0x20,0x77,0x69,0x74,0x68,0x20,0x53,0x45,0x54,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,
+ 0x74,0x65,0x73,0x20,0x69,0x73,0x73,0x75,0x65,0x64,0x20,0x62,0x65,0x6E,0x65,0x61,0x74,0x68,0x20,0x61,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x62,0x65,0x20,0x64,0x65,0x74,0x65,0x72,0x6D,0x69,0x6E,0x65,0x64,0x20,0x62,0x79,0x20,0x74,0x68,0x61,0x74,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x2E,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x2B,0x06,0x03,0x55,0x1D,0x10,0x04,0x24,0x30,0x22,0x80,0x0F,0x31,0x39,
+ 0x39,0x37,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x81,0x0F,0x31,0x39,0x39,0x38,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x10,0x06,0x04,0x67,0x2A,0x07,0x01,0x01,0x01,0xFF,0x04,0x05,0x03,0x03,0x07,0x00,0x80,0x30,0x3C,0x06,0x04,0x67,0x2A,0x07,0x00,0x01,0x01,0xFF,0x04,0x31,0x30,0x2F,0x30,0x2D,0x02,0x01,0x00,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x30,0x07,0x06,0x05,0x67,0x2A,0x03,0x00,0x00,0x04,0x14,0xC8,0x57,0x44,0x4F,0xD7,0x91,0x56,0x3E,0xC6,0xF3,
+ 0xE0,0xE6,0x08,0x2E,0x9A,0xAF,0x61,0x11,0x43,0x5D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x91,0x6D,0x0D,0x97,0xB7,0x8D,0x44,0x23,0xB9,0x49,0xAD,0x23,0xA9,0x8B,0xED,0x93,0x33,0x97,0x4C,0xE1,0x6E,0xB1,0x34,0x96,0x18,0xF3,0x58,0xB3,0x9C,0xBF,0x63,0x0F,0x61,0x46,0xC7,0xD1,0x01,0x41,0x0C,0xC8,0x42,0x55,0x6B,0x54,0x71,0x06,0x3B,0xF7,0xD1,0x77,0x65,0xDF,0x16,0xE7,0x63,0x03,0x7B,0x23,0x26,0x28,0xEC,0x94,0xF8,0x9F,0x94,0x04,0x0F,0xE5,0x45,0x99,
+ 0x4E,0xB5,0x1B,0xBC,0xB9,0xC4,0xB0,0xE2,0x8A,0x3E,0x05,0xA6,0xE3,0x56,0x7D,0x01,0x77,0xAB,0xC2,0xA6,0x72,0x90,0x23,0xD3,0x15,0x8F,0x0F,0xEA,0x7B,0x31,0xDE,0x89,0x31,0xF0,0x1B,0x81,0x6B,0x5F,0xA8,0x13,0xC6,0x62,0x7D,0xFE,0x74,0x14,0x40,0x2A,0x14,0xC2,0xA1,0x1B,0x9C,0xB2,0xD6,0xEF,0x2A,0x6D,0xA5,0xF7,0xA6,0x38,0x8F,0xD4,0x94,0x74,0x30,0x10,0x9E,0xBA,0xA9,0xAB,0x6B,0x61,0x6B,0xFC,0xB2,0x3F,0x87,0x6B,0x19,0x82,0x83,0x70,0xE7,0xD8,0xEA,0x28,0x7B,0xB4,0x29,0x47,0xF4,0x59,0xB3,0x3E,0x4B,0x6A,0x9D,0x54,
+ 0x0D,0x4E,0x1C,0xD0,0x29,0xB4,0xD1,0xE1,0x19,0x79,0x41,0x73,0xF6,0x57,0x72,0xBE,0x75,0x03,0x94,0xD7,0x58,0xA8,0xC4,0x08,0x71,0xA2,0xE3,0x16,0x31,0xCD,0xC0,0xEE,0x1C,0x21,0x26,0x52,0x55,0x7B,0x00,0x54,0x6D,0xA6,0x44,0xC2,0x4F,0xEA,0x8F,0x04,0x1C,0x3A,0xA2,0xE3,0x5B,0xD7,0x9D,0xE2,0x57,0x30,0x2C,0xF5,0xAE,0x62,0x3B,0xB5,0x49,0x89,0xCB,0x01,0xD1,0x5A,0x38,0xDE,0x97,0x57,0x85,0x91,0x68,0x6B,0xFD,0xEC,0xD3,0x80,0xF0,0x82,0xBF,0x9A };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x63,0xDB,0x7A,0x42,0x67,0x39,0x75,0x39,0x2A,0xC6,0xA4,0xFA,0xE3,0xD7,0x84,0x46,0xB4,0x67,0xC3,0x26 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "63DB7A42673975392AC6A4FAE3D78446B467C326", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1997-07-14 16:00:00", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "2004-07-14 16:00:00", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", 1675328066, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=SET Root", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=SET Root", x509.GetName ());
+ byte[] pubkey = { 0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD4,0xDC,0x3E,0xBA,0xE1,0x94,0xF7,0xBE,0xCD,0xED,0x21,0x77,0xCF,0xDA,0x88,0x58,0x51,0x0E,0x8F,0xF4,0xDA,0x00,0x14,0x1E,0x0D,0xA7,0xAD,0xB6,0x96,0x5A,0xC6,0xD3,0xEC,0x25,0xED,0xD8,0x43,0x0B,0x6E,0x7F,0x3F,0x9E,0x1E,0x74,0xA0,0x1E,0x97,0x76,0x30,0xCA,0x6F,0x0A,0x63,0xC0,0xA3,0x31,0x40,0x25,0x80,0xB8,0xBD,0x28,0xEB,0x7D,0x75,0x0B,0x4E,0x41,0x34,0xC4,0x20,0x00,0xC2,0xCB,0xF4,0x9A,0x20,0x00,0x58,0xD9,0xF4,0x40,0x13,0x18,0x77,0x0C,0xB5,0x04,0xDE,0xB7,0xB6,0x43,
+ 0x8B,0xA4,0xCC,0x36,0x76,0x79,0xC5,0x0B,0x17,0xCB,0x7E,0x88,0xA1,0x33,0xB0,0xD3,0x34,0x27,0xBF,0x3B,0x61,0xDA,0xC5,0x20,0xEB,0xF9,0x94,0x9A,0x8B,0x79,0xB2,0xA8,0x8E,0xCB,0xC1,0xD9,0x94,0x4A,0x99,0x66,0x50,0x55,0xB2,0x83,0x28,0x7D,0x22,0x3D,0xEC,0xDC,0xA3,0xE8,0x39,0xDB,0x83,0x54,0xC9,0x89,0xA9,0xDF,0x59,0x52,0x9F,0x7A,0xEF,0x7C,0x11,0x62,0x52,0xEC,0xE6,0x67,0xBA,0x3D,0xEA,0xAB,0x47,0xDB,0xE4,0xF4,0x1F,0x73,0xC3,0x3D,0xEC,0x7E,0x84,0x7D,0x2F,0x29,0xFE,0x6C,0x17,0x3F,0x75,0x6D,0x56,0x6E,0xC0,0x4E,
+ 0xB5,0xBF,0x2A,0x20,0x8A,0xE4,0x57,0xAE,0xC0,0x2E,0x68,0xC9,0x09,0xCF,0x85,0x77,0x0A,0xEF,0x3A,0x37,0xCB,0x60,0x4C,0x45,0x73,0x7F,0x90,0x3E,0x86,0x1D,0xFA,0xC3,0xFC,0x50,0x8A,0xB2,0xC5,0x8A,0x34,0xF0,0xF2,0x43,0xEE,0x3C,0x56,0xBA,0x24,0xE9,0xE0,0xA5,0x87,0x1E,0x7C,0x30,0x33,0x77,0xFD,0x5D,0xE0,0x57,0x0D,0x6C,0x19,0x39,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "3082010A0282010100D4DC3EBAE194F7BECDED2177CFDA8858510E8FF4DA00141E0DA7ADB6965AC6D3EC25EDD8430B6E7F3F9E1E74A01E977630CA6F0A63C0A331402580B8BD28EB7D750B4E4134C42000C2CBF49A200058D9F4401318770CB504DEB7B6438BA4CC367679C50B17CB7E88A133B0D33427BF3B61DAC520EBF9949A8B79B2A88ECBC1D9944A99665055B283287D223DECDCA3E839DB8354C989A9DF59529F7AEF7C116252ECE667BA3DEAAB47DBE4F41F73C33DEC7E847D2F29FE6C173F756D566EC04EB5BF2A208AE457AEC02E68C909CF85770AEF3A37CB604C45737F903E861DFAC3FC508AB2C58A34F0F243EE3C56BA24E9E0A5871E7C303377FD5DE0570D6C19390203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x6A };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "6A", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,
+ 0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x36,0x41,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x32,0x30,
+ 0x31,0x30,0x41,0x30,0x32,0x38,0x32,0x30,0x31,0x30,0x31,0x30,0x30,0x44,0x34,0x44,0x43,0x33,0x45,0x42,0x41,0x45,0x31,0x39,0x34,0x46,0x37,0x42,0x45,0x43,0x44,0x45,0x44,0x32,0x31,0x37,0x37,0x43,0x46,0x44,0x41,0x38,0x38,0x35,0x38,0x35,0x31,0x30,0x45,0x38,0x46,0x46,0x34,0x44,0x41,0x30,0x30,0x31,0x34,0x31,0x45,0x30,0x44,0x41,0x37,0x41,0x44,0x42,0x36,0x39,0x36,0x35,0x41,0x43,0x36,0x44,0x33,0x45,0x43,0x32,0x35,0x45,0x44,0x44,0x38,0x34,0x33,0x30,0x42,0x36,0x45,0x37,0x46,0x33,0x46,0x39,0x45,0x31,0x45,0x37,
+ 0x34,0x41,0x30,0x31,0x45,0x39,0x37,0x37,0x36,0x33,0x30,0x43,0x41,0x36,0x46,0x30,0x41,0x36,0x33,0x43,0x30,0x41,0x33,0x33,0x31,0x34,0x30,0x32,0x35,0x38,0x30,0x42,0x38,0x42,0x44,0x32,0x38,0x45,0x42,0x37,0x44,0x37,0x35,0x30,0x42,0x34,0x45,0x34,0x31,0x33,0x34,0x43,0x34,0x32,0x30,0x30,0x30,0x43,0x32,0x43,0x42,0x46,0x34,0x39,0x41,0x32,0x30,0x30,0x30,0x35,0x38,0x44,0x39,0x46,0x34,0x34,0x30,0x31,0x33,0x31,0x38,0x37,0x37,0x30,0x43,0x42,0x35,0x30,0x34,0x44,0x45,0x42,0x37,0x42,0x36,0x34,0x33,0x38,0x42,0x41,
+ 0x34,0x43,0x43,0x33,0x36,0x37,0x36,0x37,0x39,0x43,0x35,0x30,0x42,0x31,0x37,0x43,0x42,0x37,0x45,0x38,0x38,0x41,0x31,0x33,0x33,0x42,0x30,0x44,0x33,0x33,0x34,0x32,0x37,0x42,0x46,0x33,0x42,0x36,0x31,0x44,0x41,0x43,0x35,0x32,0x30,0x45,0x42,0x46,0x39,0x39,0x34,0x39,0x41,0x38,0x42,0x37,0x39,0x42,0x32,0x41,0x38,0x38,0x45,0x43,0x42,0x43,0x31,0x44,0x39,0x39,0x34,0x34,0x41,0x39,0x39,0x36,0x36,0x35,0x30,0x35,0x35,0x42,0x32,0x38,0x33,0x32,0x38,0x37,0x44,0x32,0x32,0x33,0x44,0x45,0x43,0x44,0x43,0x41,0x33,0x45,
+ 0x38,0x33,0x39,0x44,0x42,0x38,0x33,0x35,0x34,0x43,0x39,0x38,0x39,0x41,0x39,0x44,0x46,0x35,0x39,0x35,0x32,0x39,0x46,0x37,0x41,0x45,0x46,0x37,0x43,0x31,0x31,0x36,0x32,0x35,0x32,0x45,0x43,0x45,0x36,0x36,0x37,0x42,0x41,0x33,0x44,0x45,0x41,0x41,0x42,0x34,0x37,0x44,0x42,0x45,0x34,0x46,0x34,0x31,0x46,0x37,0x33,0x43,0x33,0x33,0x44,0x45,0x43,0x37,0x45,0x38,0x34,0x37,0x44,0x32,0x46,0x32,0x39,0x46,0x45,0x36,0x43,0x31,0x37,0x33,0x46,0x37,0x35,0x36,0x44,0x35,0x36,0x36,0x45,0x43,0x30,0x34,0x45,0x42,0x35,0x42,
+ 0x46,0x32,0x41,0x32,0x30,0x38,0x41,0x45,0x34,0x35,0x37,0x41,0x45,0x43,0x30,0x32,0x45,0x36,0x38,0x43,0x39,0x30,0x39,0x43,0x46,0x38,0x35,0x37,0x37,0x30,0x41,0x45,0x46,0x33,0x41,0x33,0x37,0x43,0x42,0x36,0x30,0x34,0x43,0x34,0x35,0x37,0x33,0x37,0x46,0x39,0x30,0x33,0x45,0x38,0x36,0x31,0x44,0x46,0x41,0x43,0x33,0x46,0x43,0x35,0x30,0x38,0x41,0x42,0x32,0x43,0x35,0x38,0x41,0x33,0x34,0x46,0x30,0x46,0x32,0x34,0x33,0x45,0x45,0x33,0x43,0x35,0x36,0x42,0x41,0x32,0x34,0x45,0x39,0x45,0x30,0x41,0x35,0x38,0x37,0x31,
+ 0x45,0x37,0x43,0x33,0x30,0x33,0x33,0x37,0x37,0x46,0x44,0x35,0x44,0x45,0x30,0x35,0x37,0x30,0x44,0x36,0x43,0x31,0x39,0x33,0x39,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\ATT-wrongsig.cer
+// - same as ATT.cer
+// - last byte has been modified (invalidating it's signature)
+public void TestCertificate6 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x01,0xDF,0x30,0x82,0x01,0x48,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x31,0x31,0x38,0x32,0x31,0x30,0x33,0x35,0x32,
+ 0x5A,0x17,0x0D,0x30,0x31,0x30,0x31,0x31,0x36,0x32,0x31,0x30,0x33,0x35,0x32,0x5A,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,
+ 0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,0xB8,0xA4,
+ 0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x38,0x50,0x1D,0x0A,0xD3,0x1B,0xBB,0xA2,0x9F,0x6C,0x8D,0x10,0xAA,0x42,0x1B,0x05,0x8D,0xE4,0x25,0xAB,0xFB,0x55,0xAE,0x6D,0xBA,0x53,0x67,0x15,0x07,0x9A,0xEC,0x55,0x9F,0x72,0x89,0x5F,0x24,0xB0,0xDB,0xCA,0x64,0xBD,0x64,0xAA,0xC2,0x8C,
+ 0xD9,0x3D,0xA2,0x45,0xB7,0xC6,0x92,0x71,0x51,0xEF,0xED,0xE1,0x51,0x54,0x97,0x56,0x35,0xA1,0xCE,0xE4,0x44,0xC4,0x47,0x66,0xFF,0x91,0xDA,0x88,0x9C,0x23,0xC2,0xB3,0xD4,0x62,0x4A,0xBC,0x94,0x55,0x9C,0x80,0x8E,0xB3,0xDD,0x4F,0x1A,0xED,0x12,0x5A,0xB5,0x2E,0xBC,0xF8,0x4B,0xCE,0xC6,0xD4,0x70,0xB3,0xB3,0x22,0xF8,0x5E,0x5C,0x36,0x7A,0xA6,0xB8,0x39,0x73,0x46,0x43,0x5C,0x9B,0x9A,0xBD,0x1E,0x7E,0xA7,0x04,0xCF,0x25,0x35 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x95,0xD4,0xE2,0xEA,0x34,0x0B,0xBF,0x33,0x27,0x1C,0x1F,0xBA,0x8B,0x52,0x9F,0x17,0x72,0x1F,0x8A,0x99 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "95D4E2EA340BBF33271C1FBA8B529F17721F8A99", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-01-18 13:03:52", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "2001-01-16 13:03:52", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", -1781210390, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=AT&T, OU=Directory Services", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=AT&T, OU=Directory Services", x509.GetName ());
+ byte[] pubkey = { 0x30,0x81,0x87,0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,
+ 0xB8,0xA4,0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "30818702818100876472890B208F8727ACC622FE00406948AFC686CD2333E311C5311A1F7E9E9213B6A2ACE3B01F2A076CB6D4DE4BFAF1A2A07DCE4BBEBE2648098C8511DECB22E7C2EE4451FE67D55B5AE016375404B83B321294839EB14D806CA4A976ACB8A497F7AB0B6CA543BA6E4FC54E0030163C3F9914DAA220088BBAED76AC9700D56D02010F", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x00 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "00", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,
+ 0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,
+ 0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x37,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x38,0x37,0x36,0x34,0x37,0x32,0x38,0x39,0x30,0x42,0x32,0x30,0x38,0x46,0x38,0x37,0x32,0x37,0x41,0x43,0x43,0x36,0x32,0x32,0x46,0x45,0x30,0x30,0x34,0x30,0x36,0x39,0x34,0x38,0x41,0x46,0x43,0x36,0x38,0x36,0x43,0x44,0x32,0x33,0x33,0x33,0x45,0x33,0x31,0x31,0x43,0x35,0x33,
+ 0x31,0x31,0x41,0x31,0x46,0x37,0x45,0x39,0x45,0x39,0x32,0x31,0x33,0x42,0x36,0x41,0x32,0x41,0x43,0x45,0x33,0x42,0x30,0x31,0x46,0x32,0x41,0x30,0x37,0x36,0x43,0x42,0x36,0x44,0x34,0x44,0x45,0x34,0x42,0x46,0x41,0x46,0x31,0x41,0x32,0x41,0x30,0x37,0x44,0x43,0x45,0x34,0x42,0x42,0x45,0x42,0x45,0x32,0x36,0x34,0x38,0x30,0x39,0x38,0x43,0x38,0x35,0x31,0x31,0x44,0x45,0x43,0x42,0x32,0x32,0x45,0x37,0x43,0x32,0x45,0x45,0x34,0x34,0x35,0x31,0x46,0x45,0x36,0x37,0x44,0x35,0x35,0x42,0x35,0x41,0x45,0x30,0x31,0x36,0x33,
+ 0x37,0x35,0x34,0x30,0x34,0x42,0x38,0x33,0x42,0x33,0x32,0x31,0x32,0x39,0x34,0x38,0x33,0x39,0x45,0x42,0x31,0x34,0x44,0x38,0x30,0x36,0x43,0x41,0x34,0x41,0x39,0x37,0x36,0x41,0x43,0x42,0x38,0x41,0x34,0x39,0x37,0x46,0x37,0x41,0x42,0x30,0x42,0x36,0x43,0x41,0x35,0x34,0x33,0x42,0x41,0x36,0x45,0x34,0x46,0x43,0x35,0x34,0x45,0x30,0x30,0x33,0x30,0x31,0x36,0x33,0x43,0x33,0x46,0x39,0x39,0x31,0x34,0x44,0x41,0x41,0x32,0x32,0x30,0x30,0x38,0x38,0x42,0x42,0x41,0x45,0x44,0x37,0x36,0x41,0x43,0x39,0x37,0x30,0x30,0x44,
+ 0x35,0x36,0x44,0x30,0x32,0x30,0x31,0x30,0x46,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\BADCERT.cer
+// - Bad certificate (will throw an exception)
+public void TestCertificate7 ()
+{
+ // cannot be loaded - will throw an exception
+ /*System.Security.Cryptography.CryptographicException: Input data cannot be coded as a valid certificate.
+ at System.Security.Cryptography.X509Certificates.X509Certificate.SetX509Certificate(Byte[] data)
+ at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] data)
+ at System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(String filename)
+ at vx509.Class1.CreateEntry(String filename) in D:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\Solution1\vx509\Class1.cs:line 75*/
+ try {
+ byte[] cert = { 0x30,0x80,0x30,0x82,0x02,0x08,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x02,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x45,0x53,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x09,0x13,0x09,0x43,0x61,0x74,0x61,0x6C,0x75,0x6E,0x79,0x61,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x07,0x13,0x09,0x42,0x61,0x72,0x63,0x65,0x6C,0x6F,0x6E,0x61,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0A,0x13,0x03,0x55,0x50,0x43,0x31,0x13,0x30,
+ 0x11,0x06,0x03,0x55,0x04,0x0B,0x13,0x0A,0x65,0x73,0x43,0x45,0x52,0x54,0x2D,0x55,0x50,0x43,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x35,0x32,0x31,0x30,0x39,0x35,0x38,0x32,0x36,0x5A,0x17,0x0D,0x39,0x37,0x30,0x35,0x32,0x31,0x30,0x39,0x35,0x38,0x32,0x36,0x5A,0x30,0x70,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x45,0x53,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x09,0x13,0x09,0x43,0x61,0x74,0x61,0x6C,0x75,0x6E,0x79,0x61,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x07,0x13,0x09,0x42,0x61,0x72,0x63,
+ 0x65,0x6C,0x6F,0x6E,0x61,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0A,0x13,0x03,0x55,0x50,0x43,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x0B,0x13,0x0A,0x65,0x73,0x43,0x45,0x52,0x54,0x2D,0x55,0x50,0x43,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03,0x13,0x0D,0x65,0x73,0x63,0x65,0x72,0x74,0x2E,0x75,0x70,0x63,0x2E,0x65,0x73,0x30,0x7C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x6B,0x00,0x30,0x68,0x02,0x61,0x00,0xBE,0xAA,0x8B,0x77,0x54,0xA3,0xAF,0xCA,0x77,0x9F,0x2F,
+ 0xB0,0xCF,0x43,0x88,0xFF,0xA6,0x6D,0x79,0x55,0x5B,0x61,0x8C,0x68,0xEC,0x48,0x1E,0x8A,0x86,0x38,0xA4,0xFE,0x19,0xB8,0x62,0x17,0x1D,0x9D,0x0F,0x47,0x2C,0xFF,0x63,0x8F,0x29,0x91,0x04,0xD1,0x52,0xBC,0x7F,0x67,0xB6,0xB2,0x8F,0x74,0x55,0xC1,0x33,0x21,0x6C,0x8F,0xAB,0x01,0x95,0x24,0xC8,0xB2,0x73,0x93,0x9D,0x22,0x61,0x50,0xA9,0x35,0xFB,0x9D,0x57,0x50,0x32,0xEF,0x56,0x52,0x50,0x93,0xAB,0xB1,0x88,0x94,0x78,0x56,0x15,0xC6,0x1C,0x8B,0x02,0x03,0x01,0x00,0x01,0xA3,0x81,0x84,0x30,0x81,0x81,0x30,0x0B,0x06,0x03,
+ 0x55,0x1D,0x0F,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x3D,0x06,0x03,0x55,0x1D,0x11,0x04,0x36,0x30,0x34,0xA1,0x1A,0x16,0x18,0x65,0x73,0x63,0x65,0x72,0x74,0x2D,0x75,0x70,0x63,0x40,0x65,0x73,0x63,0x65,0x72,0x74,0x2E,0x75,0x70,0x63,0x2E,0x65,0x73,0xA6,0x16,0x16,0x14,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x65,0x73,0x63,0x65,0x72,0x74,0x2E,0x75,0x70,0x63,0x2E,0x65,0x73,0x30,0x28,0x06,0x03,0x55,0x1D,0x20,0x04,0x21,0x30,0x1F,0x30,0x1D,0x06,0x04,0x2A,0x84,
+ 0x80,0x00,0x30,0x15,0x30,0x07,0x06,0x05,0x2A,0x84,0x80,0x00,0x01,0x30,0x0A,0x06,0x05,0x2A,0x84,0x80,0x00,0x02,0x02,0x01,0x0A,0x30,0x80,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x00,0x00,0x03,0x81,0x81,0x00,0x5B,0xFD,0xC2,0xA7,0x04,0xD4,0x83,0x4E,0x17,0x6D,0xA6,0xFA,0x27,0xE7,0xC6,0xF8,0xAB,0xB9,0x5D,0x9F,0xD0,0xA1,0xDF,0xD7,0x97,0x9F,0xE0,0x20,0xA6,0xC5,0x7A,0x64,0xCD,0x52,0x2F,0xE9,0xAE,0xDA,0xBE,0x9C,0xE4,0xD5,0x97,0xED,0xF1,0x84,0xC0,0xD0,0xFE,0x9B,0xEF,0x54,0xB1,0x80,
+ 0xE5,0xBF,0x3C,0xC9,0xED,0x93,0x20,0x2D,0x52,0x21,0xE9,0xBC,0xB9,0xE3,0x4F,0xAC,0x11,0x65,0x0E,0x8F,0xA1,0x68,0x99,0x63,0x47,0xE5,0x3D,0xE4,0x42,0x73,0x13,0xFA,0xC5,0xC8,0x34,0x8C,0xC0,0x41,0x18,0x89,0xD5,0xE6,0xA0,0x18,0x5B,0x5D,0x86,0x1C,0x1E,0xC6,0x70,0xD8,0x0E,0x89,0x64,0x94,0x83,0x8E,0x3B,0x40,0x7C,0x59,0xCF,0x2B,0x2F,0xB7,0xCE,0x97,0x98,0x12,0x15,0xEF,0x13,0xD4,0x00,0x00 };
+
+ X509Certificate bad = new X509Certificate (cert);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got :" + e.ToString ());
+ }
+}
+
+
+// Certificate: basic\ArmedForcesDSARoot.cer
+// - X.509v3 self-signed certificate
+// - DSA 1024 bits
+public void TestCertificate8 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x03,0x04,0x30,0x82,0x02,0xC4,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x03,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,
+ 0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x31,0x30,0x32,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x33,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,
+ 0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0xB6,0x30,0x82,0x01,0x2B,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,0x30,0x82,0x01,0x1E,0x02,0x81,0x81,0x00,0x90,0x89,0x3E,0x18,0x1B,0xFE,0xA3,0x1D,0x16,0x89,0x00,0xB4,0xD5,0x40,0x82,0x4C,0x2E,0xEC,0x3D,0x66,0x0D,0x0D,0xB9,0x17,0x40,0x6E,0x3A,0x5C,0x03,0x7B,0x1B,0x93,0x28,0x0C,0xEF,0xB9,0x97,0xE3,0xA1,0xEB,0xE2,0xA3,0x7C,0x61,0xDD,0x6F,0xD5,0xAD,0x15,0x69,0x00,
+ 0x16,0xB2,0xC3,0x08,0x3D,0xC4,0x59,0xC6,0xF2,0x70,0xA5,0xB0,0xF5,0x1F,0x1D,0xF4,0xB0,0x15,0xDA,0x7E,0x28,0x39,0x24,0x99,0x36,0x5B,0xEC,0x39,0x25,0xFA,0x92,0x49,0x65,0xD2,0x43,0x05,0x6A,0x9E,0xA3,0x7B,0xF0,0xDE,0xA3,0x2F,0xD3,0x6F,0x3A,0xF9,0x35,0xC3,0x29,0xD4,0x45,0x6C,0x56,0x9A,0xDE,0x36,0x6E,0xFE,0x12,0x68,0x96,0x7B,0x45,0x1D,0x2C,0xFF,0xB9,0x2D,0xF5,0x52,0x8C,0xDF,0x3E,0x2F,0x63,0x02,0x15,0x00,0x81,0xA9,0xB5,0xD0,0x04,0xF2,0x9B,0xA7,0xD8,0x55,0x4C,0x3B,0x32,0xA1,0x45,0x32,0x4F,0xF5,0x51,0xDD,
+ 0x02,0x81,0x80,0x64,0x7A,0x88,0x0B,0xF2,0x3E,0x91,0x81,0x59,0x9C,0xF4,0xEA,0xC6,0x7B,0x0E,0xBE,0xEA,0x05,0xE8,0x77,0xFD,0x20,0x34,0x87,0xA1,0xC4,0x69,0xF6,0xC8,0x8B,0x19,0xDA,0xCD,0xFA,0x21,0x8A,0x57,0xA9,0x7A,0x26,0x0A,0x56,0xD4,0xED,0x4B,0x1B,0x7C,0x70,0xED,0xB4,0xE6,0x7A,0x6A,0xDE,0xD3,0x29,0xE2,0xE9,0x9A,0x33,0xED,0x09,0x8D,0x9E,0xDF,0xDA,0x2E,0x4A,0xC1,0x50,0x92,0xEE,0x2F,0xE5,0x5A,0xF3,0x85,0x62,0x6A,0x48,0xDC,0x1B,0x02,0x98,0xA6,0xB0,0xD1,0x09,0x4B,0x10,0xD1,0xF0,0xFA,0xE0,0xB1,0x1D,0x13,
+ 0x54,0x4B,0xC0,0xA8,0x40,0xEF,0x71,0xE8,0x56,0x6B,0xA2,0x29,0xCB,0x1E,0x09,0x7D,0x27,0x39,0x91,0x3B,0x20,0x4F,0x98,0x39,0xE8,0x39,0xCA,0x98,0xC5,0xAF,0x54,0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x54,0xA8,0x88,0xB5,0x8F,0x01,0x56,0xCE,0x18,0x8F,0xA6,0xD6,0x7C,0x29,0x29,0x75,0x45,0xE8,0x31,0xA4,0x07,0x17,0xED,0x1E,0x5D,0xB2,0x7B,0xBB,0xCE,0x3C,0x97,0x67,0x1E,0x88,0x0A,0xFE,0x7D,0x00,0x22,0x27,0x1D,0x66,0xEE,0xF6,0x1B,0xB6,0x95,0x7F,0x5A,0xFF,0x06,0x34,0x02,0x43,0xC3,0x83,0xC4,0x66,0x2C,0xA1,0x05,0x0E,
+ 0x68,0xB3,0xCA,0xDC,0xD3,0xF9,0x0C,0xC0,0x66,0xDF,0x85,0x84,0x4B,0x20,0x5D,0x41,0xAC,0xC0,0xEC,0x37,0x92,0x0E,0x97,0x19,0xBF,0x53,0x35,0x63,0x27,0x18,0x33,0x35,0x42,0x4D,0xF0,0x2D,0x6D,0xA7,0xA4,0x98,0xAA,0x57,0xF3,0xD2,0xB8,0x6E,0x4E,0x8F,0xFF,0xBE,0x6F,0x4E,0x0F,0x0B,0x44,0x24,0xEE,0xDF,0x4C,0x22,0x5B,0x44,0x98,0x94,0xCB,0xB8,0xA3,0x2F,0x30,0x2D,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9D,0x2D,0x73,0xC3,0xB8,0xE3,0x4D,0x29,0x28,0xC3,0x65,0xBE,0xA9,0x98,0xCB,0xD6,0x8A,0x06,0x68,
+ 0x9C,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x03,0x2F,0x00,0x30,0x2C,0x02,0x14,0x5A,0x1B,0x2D,0x08,0x0E,0xE6,0x99,0x38,0x8F,0xB5,0x09,0xC9,0x89,0x79,0x7E,0x01,0x30,0xBD,0xCE,0xF0,0x02,0x14,0x71,0x7B,0x08,0x51,0x97,0xCE,0x4D,0x1F,0x6A,0x84,0x47,0x3A,0xC0,0xBD,0x13,0x89,0x81,0xB9,0x01,0x97 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0xA3,0x0A,0x06,0xB1,0xB0,0xD4,0xF8,0x71,0x67,0x8A,0x60,0xC5,0x4E,0xE4,0xD8,0x66,0x36,0x06,0xCC,0xE6 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "A30A06B1B0D4F871678A60C54EE4D8663606CCE6", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "2000-10-24 16:00:00", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "2002-12-31 16:00:00", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", -1559624015, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=U.S. Government, OU=DoD, CN=Armed Forces Root", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.10040.4.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x30,0x82,0x01,0x1E,0x02,0x81,0x81,0x00,0x90,0x89,0x3E,0x18,0x1B,0xFE,0xA3,0x1D,0x16,0x89,0x00,0xB4,0xD5,0x40,0x82,0x4C,0x2E,0xEC,0x3D,0x66,0x0D,0x0D,0xB9,0x17,0x40,0x6E,0x3A,0x5C,0x03,0x7B,0x1B,0x93,0x28,0x0C,0xEF,0xB9,0x97,0xE3,0xA1,0xEB,0xE2,0xA3,0x7C,0x61,0xDD,0x6F,0xD5,0xAD,0x15,0x69,0x00,0x16,0xB2,0xC3,0x08,0x3D,0xC4,0x59,0xC6,0xF2,0x70,0xA5,0xB0,0xF5,0x1F,0x1D,0xF4,0xB0,0x15,0xDA,0x7E,0x28,0x39,0x24,0x99,0x36,0x5B,0xEC,0x39,0x25,0xFA,0x92,0x49,0x65,0xD2,0x43,0x05,0x6A,0x9E,0xA3,0x7B,0xF0,0xDE,
+ 0xA3,0x2F,0xD3,0x6F,0x3A,0xF9,0x35,0xC3,0x29,0xD4,0x45,0x6C,0x56,0x9A,0xDE,0x36,0x6E,0xFE,0x12,0x68,0x96,0x7B,0x45,0x1D,0x2C,0xFF,0xB9,0x2D,0xF5,0x52,0x8C,0xDF,0x3E,0x2F,0x63,0x02,0x15,0x00,0x81,0xA9,0xB5,0xD0,0x04,0xF2,0x9B,0xA7,0xD8,0x55,0x4C,0x3B,0x32,0xA1,0x45,0x32,0x4F,0xF5,0x51,0xDD,0x02,0x81,0x80,0x64,0x7A,0x88,0x0B,0xF2,0x3E,0x91,0x81,0x59,0x9C,0xF4,0xEA,0xC6,0x7B,0x0E,0xBE,0xEA,0x05,0xE8,0x77,0xFD,0x20,0x34,0x87,0xA1,0xC4,0x69,0xF6,0xC8,0x8B,0x19,0xDA,0xCD,0xFA,0x21,0x8A,0x57,0xA9,0x7A,
+ 0x26,0x0A,0x56,0xD4,0xED,0x4B,0x1B,0x7C,0x70,0xED,0xB4,0xE6,0x7A,0x6A,0xDE,0xD3,0x29,0xE2,0xE9,0x9A,0x33,0xED,0x09,0x8D,0x9E,0xDF,0xDA,0x2E,0x4A,0xC1,0x50,0x92,0xEE,0x2F,0xE5,0x5A,0xF3,0x85,0x62,0x6A,0x48,0xDC,0x1B,0x02,0x98,0xA6,0xB0,0xD1,0x09,0x4B,0x10,0xD1,0xF0,0xFA,0xE0,0xB1,0x1D,0x13,0x54,0x4B,0xC0,0xA8,0x40,0xEF,0x71,0xE8,0x56,0x6B,0xA2,0x29,0xCB,0x1E,0x09,0x7D,0x27,0x39,0x91,0x3B,0x20,0x4F,0x98,0x39,0xE8,0x39,0xCA,0x98,0xC5,0xAF,0x54 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "3082011E0281810090893E181BFEA31D168900B4D540824C2EEC3D660D0DB917406E3A5C037B1B93280CEFB997E3A1EBE2A37C61DD6FD5AD15690016B2C3083DC459C6F270A5B0F51F1DF4B015DA7E28392499365BEC3925FA924965D243056A9EA37BF0DEA32FD36F3AF935C329D4456C569ADE366EFE1268967B451D2CFFB92DF5528CDF3E2F6302150081A9B5D004F29BA7D8554C3B32A145324FF551DD028180647A880BF23E9181599CF4EAC67B0EBEEA05E877FD203487A1C469F6C88B19DACDFA218A57A97A260A56D4ED4B1B7C70EDB4E67A6ADED329E2E99A33ED098D9EDFDA2E4AC15092EE2FE55AF385626A48DC1B0298A6B0D1094B10D1F0FAE0B11D13544BC0A840EF71E8566BA229CB1E097D2739913B204F9839E839CA98C5AF54", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=U.S. Government, OU=DoD, CN=Armed Forces Root", x509.GetName ());
+ byte[] pubkey = { 0x02,0x81,0x80,0x54,0xA8,0x88,0xB5,0x8F,0x01,0x56,0xCE,0x18,0x8F,0xA6,0xD6,0x7C,0x29,0x29,0x75,0x45,0xE8,0x31,0xA4,0x07,0x17,0xED,0x1E,0x5D,0xB2,0x7B,0xBB,0xCE,0x3C,0x97,0x67,0x1E,0x88,0x0A,0xFE,0x7D,0x00,0x22,0x27,0x1D,0x66,0xEE,0xF6,0x1B,0xB6,0x95,0x7F,0x5A,0xFF,0x06,0x34,0x02,0x43,0xC3,0x83,0xC4,0x66,0x2C,0xA1,0x05,0x0E,0x68,0xB3,0xCA,0xDC,0xD3,0xF9,0x0C,0xC0,0x66,0xDF,0x85,0x84,0x4B,0x20,0x5D,0x41,0xAC,0xC0,0xEC,0x37,0x92,0x0E,0x97,0x19,0xBF,0x53,0x35,0x63,0x27,0x18,0x33,0x35,0x42,0x4D,0xF0,0x2D,
+ 0x6D,0xA7,0xA4,0x98,0xAA,0x57,0xF3,0xD2,0xB8,0x6E,0x4E,0x8F,0xFF,0xBE,0x6F,0x4E,0x0F,0x0B,0x44,0x24,0xEE,0xDF,0x4C,0x22,0x5B,0x44,0x98,0x94,0xCB,0xB8 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "02818054A888B58F0156CE188FA6D67C29297545E831A40717ED1E5DB27BBBCE3C97671E880AFE7D0022271D66EEF61BB6957F5AFF06340243C383C4662CA1050E68B3CADCD3F90CC066DF85844B205D41ACC0EC37920E9719BF53356327183335424DF02D6DA7A498AA57F3D2B86E4E8FFFBE6F4E0F0B4424EEDF4C225B449894CBB8", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x03 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "03", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x6F,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,
+ 0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x6F,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x30,0x30,0x34,0x30,0x2E,0x34,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,
+ 0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x33,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x33,0x30,0x38,0x32,0x30,0x31,0x31,0x45,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x39,0x30,0x38,0x39,0x33,0x45,0x31,0x38,0x31,0x42,0x46,0x45,0x41,0x33,0x31,0x44,0x31,0x36,0x38,0x39,0x30,0x30,0x42,0x34,0x44,0x35,0x34,0x30,0x38,0x32,0x34,0x43,0x32,0x45,0x45,0x43,0x33,0x44,
+ 0x36,0x36,0x30,0x44,0x30,0x44,0x42,0x39,0x31,0x37,0x34,0x30,0x36,0x45,0x33,0x41,0x35,0x43,0x30,0x33,0x37,0x42,0x31,0x42,0x39,0x33,0x32,0x38,0x30,0x43,0x45,0x46,0x42,0x39,0x39,0x37,0x45,0x33,0x41,0x31,0x45,0x42,0x45,0x32,0x41,0x33,0x37,0x43,0x36,0x31,0x44,0x44,0x36,0x46,0x44,0x35,0x41,0x44,0x31,0x35,0x36,0x39,0x30,0x30,0x31,0x36,0x42,0x32,0x43,0x33,0x30,0x38,0x33,0x44,0x43,0x34,0x35,0x39,0x43,0x36,0x46,0x32,0x37,0x30,0x41,0x35,0x42,0x30,0x46,0x35,0x31,0x46,0x31,0x44,0x46,0x34,0x42,0x30,0x31,0x35,
+ 0x44,0x41,0x37,0x45,0x32,0x38,0x33,0x39,0x32,0x34,0x39,0x39,0x33,0x36,0x35,0x42,0x45,0x43,0x33,0x39,0x32,0x35,0x46,0x41,0x39,0x32,0x34,0x39,0x36,0x35,0x44,0x32,0x34,0x33,0x30,0x35,0x36,0x41,0x39,0x45,0x41,0x33,0x37,0x42,0x46,0x30,0x44,0x45,0x41,0x33,0x32,0x46,0x44,0x33,0x36,0x46,0x33,0x41,0x46,0x39,0x33,0x35,0x43,0x33,0x32,0x39,0x44,0x34,0x34,0x35,0x36,0x43,0x35,0x36,0x39,0x41,0x44,0x45,0x33,0x36,0x36,0x45,0x46,0x45,0x31,0x32,0x36,0x38,0x39,0x36,0x37,0x42,0x34,0x35,0x31,0x44,0x32,0x43,0x46,0x46,
+ 0x42,0x39,0x32,0x44,0x46,0x35,0x35,0x32,0x38,0x43,0x44,0x46,0x33,0x45,0x32,0x46,0x36,0x33,0x30,0x32,0x31,0x35,0x30,0x30,0x38,0x31,0x41,0x39,0x42,0x35,0x44,0x30,0x30,0x34,0x46,0x32,0x39,0x42,0x41,0x37,0x44,0x38,0x35,0x35,0x34,0x43,0x33,0x42,0x33,0x32,0x41,0x31,0x34,0x35,0x33,0x32,0x34,0x46,0x46,0x35,0x35,0x31,0x44,0x44,0x30,0x32,0x38,0x31,0x38,0x30,0x36,0x34,0x37,0x41,0x38,0x38,0x30,0x42,0x46,0x32,0x33,0x45,0x39,0x31,0x38,0x31,0x35,0x39,0x39,0x43,0x46,0x34,0x45,0x41,0x43,0x36,0x37,0x42,0x30,0x45,
+ 0x42,0x45,0x45,0x41,0x30,0x35,0x45,0x38,0x37,0x37,0x46,0x44,0x32,0x30,0x33,0x34,0x38,0x37,0x41,0x31,0x43,0x34,0x36,0x39,0x46,0x36,0x43,0x38,0x38,0x42,0x31,0x39,0x44,0x41,0x43,0x44,0x46,0x41,0x32,0x31,0x38,0x41,0x35,0x37,0x41,0x39,0x37,0x41,0x32,0x36,0x30,0x41,0x35,0x36,0x44,0x34,0x45,0x44,0x34,0x42,0x31,0x42,0x37,0x43,0x37,0x30,0x45,0x44,0x42,0x34,0x45,0x36,0x37,0x41,0x36,0x41,0x44,0x45,0x44,0x33,0x32,0x39,0x45,0x32,0x45,0x39,0x39,0x41,0x33,0x33,0x45,0x44,0x30,0x39,0x38,0x44,0x39,0x45,0x44,0x46,
+ 0x44,0x41,0x32,0x45,0x34,0x41,0x43,0x31,0x35,0x30,0x39,0x32,0x45,0x45,0x32,0x46,0x45,0x35,0x35,0x41,0x46,0x33,0x38,0x35,0x36,0x32,0x36,0x41,0x34,0x38,0x44,0x43,0x31,0x42,0x30,0x32,0x39,0x38,0x41,0x36,0x42,0x30,0x44,0x31,0x30,0x39,0x34,0x42,0x31,0x30,0x44,0x31,0x46,0x30,0x46,0x41,0x45,0x30,0x42,0x31,0x31,0x44,0x31,0x33,0x35,0x34,0x34,0x42,0x43,0x30,0x41,0x38,0x34,0x30,0x45,0x46,0x37,0x31,0x45,0x38,0x35,0x36,0x36,0x42,0x41,0x32,0x32,0x39,0x43,0x42,0x31,0x45,0x30,0x39,0x37,0x44,0x32,0x37,0x33,0x39,
+ 0x39,0x31,0x33,0x42,0x32,0x30,0x34,0x46,0x39,0x38,0x33,0x39,0x45,0x38,0x33,0x39,0x43,0x41,0x39,0x38,0x43,0x35,0x41,0x46,0x35,0x34,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x30,0x32,0x38,0x31,0x38,0x30,0x35,0x34,0x41,0x38,0x38,0x38,0x42,0x35,0x38,0x46,0x30,0x31,0x35,0x36,0x43,0x45,0x31,0x38,0x38,0x46,0x41,0x36,0x44,0x36,0x37,0x43,0x32,0x39,0x32,0x39,0x37,0x35,0x34,0x35,0x45,0x38,0x33,0x31,0x41,0x34,0x30,0x37,0x31,0x37,0x45,0x44,0x31,0x45,0x35,0x44,0x42,0x32,
+ 0x37,0x42,0x42,0x42,0x43,0x45,0x33,0x43,0x39,0x37,0x36,0x37,0x31,0x45,0x38,0x38,0x30,0x41,0x46,0x45,0x37,0x44,0x30,0x30,0x32,0x32,0x32,0x37,0x31,0x44,0x36,0x36,0x45,0x45,0x46,0x36,0x31,0x42,0x42,0x36,0x39,0x35,0x37,0x46,0x35,0x41,0x46,0x46,0x30,0x36,0x33,0x34,0x30,0x32,0x34,0x33,0x43,0x33,0x38,0x33,0x43,0x34,0x36,0x36,0x32,0x43,0x41,0x31,0x30,0x35,0x30,0x45,0x36,0x38,0x42,0x33,0x43,0x41,0x44,0x43,0x44,0x33,0x46,0x39,0x30,0x43,0x43,0x30,0x36,0x36,0x44,0x46,0x38,0x35,0x38,0x34,0x34,0x42,0x32,0x30,
+ 0x35,0x44,0x34,0x31,0x41,0x43,0x43,0x30,0x45,0x43,0x33,0x37,0x39,0x32,0x30,0x45,0x39,0x37,0x31,0x39,0x42,0x46,0x35,0x33,0x33,0x35,0x36,0x33,0x32,0x37,0x31,0x38,0x33,0x33,0x33,0x35,0x34,0x32,0x34,0x44,0x46,0x30,0x32,0x44,0x36,0x44,0x41,0x37,0x41,0x34,0x39,0x38,0x41,0x41,0x35,0x37,0x46,0x33,0x44,0x32,0x42,0x38,0x36,0x45,0x34,0x45,0x38,0x46,0x46,0x46,0x42,0x45,0x36,0x46,0x34,0x45,0x30,0x46,0x30,0x42,0x34,0x34,0x32,0x34,0x45,0x45,0x44,0x46,0x34,0x43,0x32,0x32,0x35,0x42,0x34,0x34,0x39,0x38,0x39,0x34,
+ 0x43,0x42,0x42,0x38,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\VERI.cer
+// - X.509v3 end-entity certificate
+// - md5RSA, RSA 512 bits
+// - has a E= (email) in it's DN
+public void TestCertificate9 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x09,0xB9,0x30,0x82,0x09,0x22,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x20,0x0B,0x35,0x5E,0xCE,0xC4,0xB0,0x63,0xB7,0xDE,0xC6,0x34,0xB9,0x70,0x34,0x44,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x62,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,
+ 0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x37,0x30,0x38,0x32,0x30,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x82,0x01,0x0A,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,
+ 0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x31,0x46,0x30,0x44,0x06,0x03,0x55,0x04,0x0B,0x13,0x3D,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,
+ 0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03,
+ 0x13,0x0D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x31,0x1E,0x30,0x1C,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01,0x16,0x0F,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,
+ 0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x07,0x08,0x30,0x82,0x07,0x04,0x30,0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x82,0x02,0x1F,0x06,0x03,0x55,0x1D,0x03,0x04,0x82,0x02,0x16,0x30,0x82,0x02,0x12,0x30,0x82,0x02,0x0E,0x30,0x82,0x02,0x0A,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x82,
+ 0x01,0xF9,0x16,0x82,0x01,0xA7,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,
+ 0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x20,0x61,0x74,0x3A,0x20,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x43,0x50,0x53,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x43,0x50,0x53,0x2D,
+ 0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x20,0x54,0x65,
+ 0x6C,0x2E,0x20,0x2B,0x31,0x20,0x28,0x34,0x31,0x35,0x29,0x20,0x39,0x36,0x31,0x2D,0x38,0x38,0x33,0x30,0x20,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
+ 0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x61,0x6E,0x64,0x20,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0xA0,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x01,0xA1,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x02,0x30,0x2C,0x30,0x2A,0x16,0x28,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,
+ 0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x36,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08,0x04,0x29,0x16,0x27,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x30,0x82,0x04,0x87,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D,0x04,0x82,0x04,
+ 0x78,0x16,0x82,0x04,0x74,0x43,0x41,0x55,0x54,0x49,0x4F,0x4E,0x3A,0x20,0x54,0x68,0x65,0x20,0x43,0x6F,0x6D,0x6D,0x6F,0x6E,0x20,0x4E,0x61,0x6D,0x65,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x0A,0x49,0x44,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2E,0x20,0x49,0x74,0x20,0x6D,0x61,0x79,0x20,0x62,
+ 0x65,0x20,0x74,0x68,0x65,0x0A,0x68,0x6F,0x6C,0x64,0x65,0x72,0x27,0x73,0x20,0x72,0x65,0x61,0x6C,0x20,0x6E,0x61,0x6D,0x65,0x20,0x6F,0x72,0x20,0x61,0x6E,0x20,0x61,0x6C,0x69,0x61,0x73,0x2E,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x64,0x6F,0x65,0x73,0x20,0x61,0x75,0x74,0x68,0x2D,0x0A,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x20,0x74,0x68,0x65,0x20,0x65,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x64,0x64,0x72,0x65,0x73,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x68,0x6F,0x6C,0x64,0x65,0x72,0x2E,
+ 0x0A,0x0A,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x0A,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x0A,0x43,0x65,0x72,
+ 0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x0A,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x20,0x61,0x74,0x3A,0x20,0x0A,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,
+ 0x63,0x6F,0x6D,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x0A,0x43,0x50,0x53,0x2D,0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x0A,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,
+ 0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x0A,0x0A,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x0A,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
+ 0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x0A,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0x0A,0x0A,0x57,0x41,0x52,0x4E,0x49,0x4E,0x47,0x3A,0x20,0x54,0x48,0x45,0x20,0x55,0x53,0x45,0x20,0x4F,0x46,0x20,0x54,0x48,0x49,0x53,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x20,0x49,0x53,0x20,0x53,0x54,0x52,0x49,0x43,0x54,0x4C,0x59,0x0A,0x53,0x55,0x42,0x4A,0x45,0x43,0x54,0x20,0x54,0x4F,0x20,0x54,0x48,0x45,0x20,0x56,0x45,0x52,0x49,
+ 0x53,0x49,0x47,0x4E,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4F,0x4E,0x20,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x0A,0x53,0x54,0x41,0x54,0x45,0x4D,0x45,0x4E,0x54,0x2E,0x20,0x20,0x54,0x48,0x45,0x20,0x49,0x53,0x53,0x55,0x49,0x4E,0x47,0x20,0x41,0x55,0x54,0x48,0x4F,0x52,0x49,0x54,0x59,0x20,0x44,0x49,0x53,0x43,0x4C,0x41,0x49,0x4D,0x53,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x0A,0x49,0x4D,0x50,0x4C,0x49,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x45,0x58,0x50,0x52,0x45,0x53,0x53,0x20,
+ 0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x2C,0x20,0x49,0x4E,0x43,0x4C,0x55,0x44,0x49,0x4E,0x47,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x0A,0x4F,0x46,0x20,0x4D,0x45,0x52,0x43,0x48,0x41,0x4E,0x54,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4F,0x52,0x20,0x46,0x49,0x54,0x4E,0x45,0x53,0x53,0x20,0x46,0x4F,0x52,0x20,0x41,0x20,0x50,0x41,0x52,0x54,0x49,0x43,0x55,0x4C,0x41,0x52,0x0A,0x50,0x55,0x52,0x50,0x4F,0x53,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x57,0x49,0x4C,0x4C,0x20,0x4E,0x4F,
+ 0x54,0x20,0x42,0x45,0x20,0x4C,0x49,0x41,0x42,0x4C,0x45,0x20,0x46,0x4F,0x52,0x20,0x43,0x4F,0x4E,0x53,0x45,0x51,0x55,0x45,0x4E,0x54,0x49,0x41,0x4C,0x2C,0x0A,0x50,0x55,0x4E,0x49,0x54,0x49,0x56,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x4F,0x54,0x48,0x45,0x52,0x20,0x44,0x41,0x4D,0x41,0x47,0x45,0x53,0x2E,0x20,0x53,0x45,0x45,0x20,0x54,0x48,0x45,0x20,0x43,0x50,0x53,0x0A,0x46,0x4F,0x52,0x20,0x44,0x45,0x54,0x41,0x49,0x4C,0x53,0x2E,0x0A,0x0A,0x43,0x6F,0x6E,0x74,0x65,0x6E,
+ 0x74,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x65,0x64,0x0A,0x6E,0x6F,0x6E,0x76,0x65,0x72,0x69,0x66,0x69,0x65,0x64,0x53,0x75,0x62,0x6A,0x65,0x63,0x74,0x41,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x73,0x20,0x65,0x78,0x74,0x65,0x6E,0x73,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x75,0x65,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x0A,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x63,0x6F,0x6E,0x73,0x69,0x64,0x65,0x72,0x65,0x64,0x20,
+ 0x61,0x73,0x20,0x61,0x63,0x63,0x75,0x72,0x61,0x74,0x65,0x20,0x69,0x6E,0x66,0x6F,0x72,0x6D,0x61,0x74,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x69,0x64,0x61,0x74,0x65,0x64,0x20,0x0A,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x49,0x41,0x2E,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x2B,0x3D,0x44,0xC7,0x32,0x59,0xAE,0xF1,0x5F,0x8F,0x3F,0x87,0xE3,0x3E,0xEB,0x81,0x30,0xF8,0xA9,0x96,0xDB,0x01,0x42,0x0B,0x04,0xEF,0x37,0x02,0x3F,0xD4,0x20,0x61,0x58,0xC4,0x4A,0x3A,
+ 0x39,0xB3,0xFB,0xD9,0xF8,0xA5,0xC4,0x5E,0x33,0x5A,0x0E,0xFA,0x93,0x56,0x2F,0x6F,0xD6,0x61,0xA2,0xAF,0xA5,0x0C,0x1D,0xE2,0x41,0x65,0xF3,0x40,0x75,0x66,0x83,0xD2,0x5A,0xB4,0xB7,0x56,0x0B,0x8E,0x0D,0xA1,0x33,0x13,0x7D,0x49,0xC3,0xB1,0x00,0x68,0x83,0x7F,0xB5,0x66,0xD4,0x32,0x32,0xFE,0x8B,0x9A,0x5A,0xD6,0x01,0x72,0x31,0x5D,0x85,0x91,0xBC,0x93,0x9B,0x65,0x60,0x25,0xC6,0x1F,0xBC,0xDD,0x69,0x44,0x62,0xC2,0xB2,0x6F,0x46,0xAB,0x2F,0x20,0xA5,0x6F,0xDA,0x48,0x6C,0x9C };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x52,0xD1,0x84,0x8F,0x6A,0x16,0x1B,0xA5,0xC6,0xC1,0x90,0x07,0xF8,0x16,0x46,0x68,0xF5,0xA3,0xB2,0xCF };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "52D1848F6A161BA5C6C19007F8164668F5A3B2CF", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-08-20 16:00:00", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "1997-08-20 15:59:59", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", 1389462671, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "L=Internet, O=\"VeriSign, Inc.\", OU=VeriSign Class 1 CA - Individual Subscriber", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "L=Internet, O=\"VeriSign, Inc.\", OU=VeriSign Class 1 CA - Individual Subscriber, OU=\"www.verisign.com/repository/CPS Incorp. by Ref.,LIAB.LTD(c)96\", OU=Digital ID Class 1 - Netscape, CN=David T. Gray, E=david@formal.ie", x509.GetName ());
+ byte[] pubkey = { 0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "3048024100C58107A2EB0FB8FFF8F81CEE32FFBF12356AF96BC8BE2FFB3EAF04514AACDD1029A8CD405B661E98EFF24C77FA8F86D1216792444AC489C983CF889F6FE232350203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x44,0x34,0x70,0xB9,0x34,0xC6,0xDE,0xB7,0x63,0xB0,0xC4,0xCE,0x5E,0x35,0x0B,0x20 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "443470B934C6DEB763B0C4CE5E350B20", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x4C,0x3D,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x2C,0x20,0x4F,0x3D,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,
+ 0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x2C,0x20,0x4F,0x55,0x3D,0x22,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,
+ 0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x2C,0x20,0x45,0x3D,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x4C,0x3D,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x2C,0x20,0x4F,0x3D,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,
+ 0x2C,0x20,0x4F,0x55,0x3D,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,
+ 0x62,0x65,0x72,0x3A,0x20,0x20,0x34,0x34,0x33,0x34,0x37,0x30,0x42,0x39,0x33,0x34,0x43,0x36,0x44,0x45,0x42,0x37,0x36,0x33,0x42,0x30,0x43,0x34,0x43,0x45,0x35,0x45,0x33,0x35,0x30,0x42,0x32,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x34,0x38,0x30,0x32,0x34,0x31,0x30,0x30,0x43,0x35,
+ 0x38,0x31,0x30,0x37,0x41,0x32,0x45,0x42,0x30,0x46,0x42,0x38,0x46,0x46,0x46,0x38,0x46,0x38,0x31,0x43,0x45,0x45,0x33,0x32,0x46,0x46,0x42,0x46,0x31,0x32,0x33,0x35,0x36,0x41,0x46,0x39,0x36,0x42,0x43,0x38,0x42,0x45,0x32,0x46,0x46,0x42,0x33,0x45,0x41,0x46,0x30,0x34,0x35,0x31,0x34,0x41,0x41,0x43,0x44,0x44,0x31,0x30,0x32,0x39,0x41,0x38,0x43,0x44,0x34,0x30,0x35,0x42,0x36,0x36,0x31,0x45,0x39,0x38,0x45,0x46,0x46,0x32,0x34,0x43,0x37,0x37,0x46,0x41,0x38,0x46,0x38,0x36,0x44,0x31,0x32,0x31,0x36,0x37,0x39,0x32,
+ 0x34,0x34,0x34,0x41,0x43,0x34,0x38,0x39,0x43,0x39,0x38,0x33,0x43,0x46,0x38,0x38,0x39,0x46,0x36,0x46,0x45,0x32,0x33,0x32,0x33,0x35,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\KEY.cer
+// - X.509v1 self-signed certificate
+// - md5RSA, RSA 1024 bits
+// - has a unknown OID (looks like email) in it's DN (1.3.6.1.4.1.42.2.11.2.1)
+public void TestCertificate10 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x02,0x1D,0x30,0x82,0x01,0x86,0x02,0x01,0x14,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,
+ 0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x39,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,
+ 0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,0x02,0x81,0x81,0x00,0xCD,0x23,0xFA,0x2A,0xE1,0xED,0x98,0xF4,0xE9,0xD0,0x93,0x3E,0xD7,0x7A,0x80,0x02,0x4C,0xCC,0xC1,0x02,0xAF,0x5C,0xB6,0x1F,0x7F,0xFA,0x57,0x42,0x6F,0x30,0xD1,0x20,0xC5,0xB5,
+ 0x21,0x07,0x40,0x2C,0xA9,0x86,0xC2,0xF3,0x64,0x84,0xAE,0x3D,0x85,0x2E,0xED,0x85,0xBD,0x54,0xB0,0x18,0x28,0xEF,0x6A,0xF8,0x1B,0xE7,0x0B,0x16,0x1F,0x93,0x25,0x4F,0xC7,0xF8,0x8E,0xC3,0xB9,0xCA,0x98,0x84,0x0E,0x55,0xD0,0x2F,0xEF,0x78,0x77,0xC5,0x72,0x28,0x5F,0x60,0xBF,0x19,0x2B,0xD1,0x72,0xA2,0xB7,0xD8,0x3F,0xE0,0x97,0x34,0x5A,0x01,0xBD,0x04,0x9C,0xC8,0x78,0x45,0xCD,0x93,0x8D,0x15,0xF2,0x76,0x10,0x11,0xAB,0xB8,0x5B,0x2E,0x9E,0x52,0xDD,0x81,0x3E,0x9C,0x64,0xC8,0x29,0x93,0x02,0x01,0x03,0x30,0x0D,0x06,
+ 0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x32,0x1A,0x35,0xBA,0xBF,0x43,0x27,0xD6,0xB4,0xD4,0xB8,0x76,0xE5,0xE3,0x9B,0x4D,0x6C,0xC0,0x86,0xC9,0x77,0x35,0xBA,0x6B,0x16,0x2D,0x13,0x46,0x4A,0xB0,0x32,0x53,0xA1,0x5B,0x5A,0xE9,0x99,0xE2,0x0C,0x86,0x88,0x17,0x4E,0x0D,0xFE,0x82,0xAC,0x4E,0x47,0xEF,0xFB,0xFF,0x39,0xAC,0xEE,0x35,0xC8,0xFA,0x52,0x37,0x0A,0x49,0xAD,0x59,0xAD,0xE2,0x8A,0xA9,0x1C,0xC6,0x5F,0x1F,0xF8,0x6F,0x73,0x7E,0xCD,0xA0,0x31,0xE8,0x0C,0xBE,0xF5,0x4D,
+ 0xD9,0xB2,0xAB,0x8A,0x12,0xB6,0x30,0x78,0x68,0x11,0x7C,0x0D,0xF1,0x49,0x4D,0xA3,0xFD,0xB2,0xE9,0xFF,0x1D,0xF0,0x91,0xFA,0x54,0x85,0xFF,0x33,0x90,0xE8,0xC1,0xBF,0xA4,0x9B,0xA4,0x62,0x46,0xBD,0x61,0x12,0x59,0x98,0x41,0x89 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0xE0,0xA0,0x0A,0xBE,0xB2,0xCC,0xA8,0x45,0x40,0xC2,0x1A,0x75,0xE0,0xB3,0xA4,0x06,0xF9,0xA6,0x24,0xAC };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "E0A00ABEB2CCA84540C21A75E0B3A406F9A624AC", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-05-06 16:00:00", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "1999-05-06 16:00:00", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", -526382402, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=CA, CN=Keywitness Canada Inc., OID.1.3.6.1.4.1.42.2.11.2.1=keywitness@keywitness.ca", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=CA, CN=Keywitness Canada Inc., OID.1.3.6.1.4.1.42.2.11.2.1=keywitness@keywitness.ca", x509.GetName ());
+ byte[] pubkey = { 0x30,0x81,0x87,0x02,0x81,0x81,0x00,0xCD,0x23,0xFA,0x2A,0xE1,0xED,0x98,0xF4,0xE9,0xD0,0x93,0x3E,0xD7,0x7A,0x80,0x02,0x4C,0xCC,0xC1,0x02,0xAF,0x5C,0xB6,0x1F,0x7F,0xFA,0x57,0x42,0x6F,0x30,0xD1,0x20,0xC5,0xB5,0x21,0x07,0x40,0x2C,0xA9,0x86,0xC2,0xF3,0x64,0x84,0xAE,0x3D,0x85,0x2E,0xED,0x85,0xBD,0x54,0xB0,0x18,0x28,0xEF,0x6A,0xF8,0x1B,0xE7,0x0B,0x16,0x1F,0x93,0x25,0x4F,0xC7,0xF8,0x8E,0xC3,0xB9,0xCA,0x98,0x84,0x0E,0x55,0xD0,0x2F,0xEF,0x78,0x77,0xC5,0x72,0x28,0x5F,0x60,0xBF,0x19,0x2B,0xD1,0x72,0xA2,0xB7,0xD8,
+ 0x3F,0xE0,0x97,0x34,0x5A,0x01,0xBD,0x04,0x9C,0xC8,0x78,0x45,0xCD,0x93,0x8D,0x15,0xF2,0x76,0x10,0x11,0xAB,0xB8,0x5B,0x2E,0x9E,0x52,0xDD,0x81,0x3E,0x9C,0x64,0xC8,0x29,0x93,0x02,0x01,0x03 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "30818702818100CD23FA2AE1ED98F4E9D0933ED77A80024CCCC102AF5CB61F7FFA57426F30D120C5B52107402CA986C2F36484AE3D852EED85BD54B01828EF6AF81BE70B161F93254FC7F88EC3B9CA98840E55D02FEF7877C572285F60BF192BD172A2B7D83FE097345A01BD049CC87845CD938D15F2761011ABB85B2E9E52DD813E9C64C82993020103", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x14 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "14", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x43,0x41,0x2C,0x20,0x43,0x4E,0x3D,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x4F,0x49,0x44,0x2E,0x31,0x2E,0x33,0x2E,0x36,0x2E,0x31,0x2E,0x34,0x2E,0x31,0x2E,0x34,0x32,0x2E,0x32,0x2E,0x31,0x31,0x2E,0x32,0x2E,0x31,0x3D,0x6B,0x65,
+ 0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x43,0x41,0x2C,0x20,0x43,0x4E,0x3D,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x4F,0x49,0x44,0x2E,0x31,0x2E,0x33,0x2E,0x36,0x2E,0x31,0x2E,0x34,0x2E,0x31,0x2E,0x34,0x32,0x2E,0x32,0x2E,0x31,0x31,0x2E,0x32,0x2E,0x31,0x3D,0x6B,
+ 0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x31,0x34,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,
+ 0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x37,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x43,0x44,0x32,0x33,0x46,0x41,0x32,0x41,0x45,0x31,0x45,0x44,0x39,0x38,0x46,0x34,0x45,0x39,0x44,0x30,0x39,0x33,0x33,0x45,0x44,0x37,0x37,0x41,0x38,0x30,0x30,0x32,0x34,0x43,0x43,0x43,0x43,0x31,0x30,0x32,0x41,0x46,0x35,0x43,0x42,0x36,0x31,0x46,0x37,0x46,0x46,0x41,0x35,
+ 0x37,0x34,0x32,0x36,0x46,0x33,0x30,0x44,0x31,0x32,0x30,0x43,0x35,0x42,0x35,0x32,0x31,0x30,0x37,0x34,0x30,0x32,0x43,0x41,0x39,0x38,0x36,0x43,0x32,0x46,0x33,0x36,0x34,0x38,0x34,0x41,0x45,0x33,0x44,0x38,0x35,0x32,0x45,0x45,0x44,0x38,0x35,0x42,0x44,0x35,0x34,0x42,0x30,0x31,0x38,0x32,0x38,0x45,0x46,0x36,0x41,0x46,0x38,0x31,0x42,0x45,0x37,0x30,0x42,0x31,0x36,0x31,0x46,0x39,0x33,0x32,0x35,0x34,0x46,0x43,0x37,0x46,0x38,0x38,0x45,0x43,0x33,0x42,0x39,0x43,0x41,0x39,0x38,0x38,0x34,0x30,0x45,0x35,0x35,0x44,
+ 0x30,0x32,0x46,0x45,0x46,0x37,0x38,0x37,0x37,0x43,0x35,0x37,0x32,0x32,0x38,0x35,0x46,0x36,0x30,0x42,0x46,0x31,0x39,0x32,0x42,0x44,0x31,0x37,0x32,0x41,0x32,0x42,0x37,0x44,0x38,0x33,0x46,0x45,0x30,0x39,0x37,0x33,0x34,0x35,0x41,0x30,0x31,0x42,0x44,0x30,0x34,0x39,0x43,0x43,0x38,0x37,0x38,0x34,0x35,0x43,0x44,0x39,0x33,0x38,0x44,0x31,0x35,0x46,0x32,0x37,0x36,0x31,0x30,0x31,0x31,0x41,0x42,0x42,0x38,0x35,0x42,0x32,0x45,0x39,0x45,0x35,0x32,0x44,0x44,0x38,0x31,0x33,0x45,0x39,0x43,0x36,0x34,0x43,0x38,0x32,
+ 0x39,0x39,0x33,0x30,0x32,0x30,0x31,0x30,0x33,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\GTE.cer
+// - X.509v1 self-signed certificate
+// - md5RSA, RSA 1024 bits
+// - Valid from/to doesn't include seconds!
+public void TestCertificate11 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x01,0xF5,0x30,0x82,0x01,0x5E,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x13,0x13,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1A,0x17,0x0B,
+ 0x39,0x36,0x30,0x32,0x32,0x33,0x31,0x39,0x31,0x35,0x5A,0x17,0x0B,0x39,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x5A,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x13,0x13,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x81,0x9F,0x30,0x0D,
+ 0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xB8,0xE6,0x4F,0xBA,0xDB,0x98,0x7C,0x71,0x7C,0xAF,0x44,0xB7,0xD3,0x0F,0x46,0xD9,0x64,0xE5,0x93,0xC1,0x42,0x8E,0xC7,0xBA,0x49,0x8D,0x35,0x2D,0x7A,0xE7,0x8B,0xBD,0xE5,0x05,0x31,0x59,0xC6,0xB1,0x2F,0x0A,0x0C,0xFB,0x9F,0xA7,0x3F,0xA2,0x09,0x66,0x84,0x56,0x1E,0x37,0x29,0x1B,0x87,0xE9,0x7E,0x0C,0xCA,0x9A,0x9F,0xA5,0x7F,0xF5,0x15,0x94,0xA3,0xD5,0xA2,0x46,0x82,0xD8,0x68,0x4C,0xD1,0x37,
+ 0x15,0x06,0x68,0xAF,0xBD,0xF8,0xB0,0xB3,0xF0,0x29,0xF5,0x95,0x5A,0x09,0x16,0x61,0x77,0x0A,0x22,0x25,0xD4,0x4F,0x45,0xAA,0xC7,0xBD,0xE5,0x96,0xDF,0xF9,0xD4,0xA8,0x8E,0x42,0xCC,0x24,0xC0,0x1E,0x91,0x27,0x4A,0xB5,0x6D,0x06,0x80,0x63,0x39,0xC4,0xA2,0x5E,0x38,0x03,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x34,0x9B,0x09,0x05,0x9D,0x42,0x48,0x7F,0x7C,0x24,0x8E,0xC2,0x88,0x65,0x78,0x6B,0x4D,0x2A,0x0E,0xAF,0xED,0xED,0xF0,0x6A,
+ 0x2D,0x37,0xEB,0x57,0x51,0x0E,0x8A,0xAD,0x2D,0x13,0x02,0xA1,0x40,0x6A,0x41,0xF6,0x69,0x72,0xBF,0x0F,0xA0,0x4E,0x55,0xE7,0x82,0xA6,0x57,0x91,0x8B,0x5D,0x43,0x08,0xC9,0xF8,0x71,0x07,0x82,0xE3,0x3E,0x14,0x01,0x24,0x0C,0x39,0xEB,0x61,0x22,0xF7,0xA2,0x0B,0x42,0x23,0x14,0xCA,0x10,0x18,0x36,0x0A,0x05,0xD1,0xC8,0x4A,0xF1,0x0E,0xB3,0xFD,0x00,0xD0,0xC6,0xEE,0x55,0xF2,0x4C,0x62,0xB4,0x19,0x73,0x1F,0x48,0x18,0xD8,0xB0,0x4E,0xB0,0x75,0xBC,0xB9,0x84,0x8B,0x1F,0x96,0x8A,0x83,0xF1,0xA0,0x1A,0xA2,0xED,0xFF,0x87,
+ 0x8C,0xA3,0x4F,0xA2 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0xA2,0x75,0xE0,0x26,0xAC,0xD8,0x54,0x79,0x4A,0x4A,0xA2,0xCB,0x53,0xF6,0x62,0x33,0x12,0x9C,0x55,0xB6 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "A275E026ACD854794A4AA2CB53F66233129C55B6", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "1996-02-23 11:15:00", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "1999-12-31 15:59:00", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", -1569333210, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, O=GTE Corporation, CN=GTE CyberTrust Root", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, O=GTE Corporation, CN=GTE CyberTrust Root", x509.GetName ());
+ byte[] pubkey = { 0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xB8,0xE6,0x4F,0xBA,0xDB,0x98,0x7C,0x71,0x7C,0xAF,0x44,0xB7,0xD3,0x0F,0x46,0xD9,0x64,0xE5,0x93,0xC1,0x42,0x8E,0xC7,0xBA,0x49,0x8D,0x35,0x2D,0x7A,0xE7,0x8B,0xBD,0xE5,0x05,0x31,0x59,0xC6,0xB1,0x2F,0x0A,0x0C,0xFB,0x9F,0xA7,0x3F,0xA2,0x09,0x66,0x84,0x56,0x1E,0x37,0x29,0x1B,0x87,0xE9,0x7E,0x0C,0xCA,0x9A,0x9F,0xA5,0x7F,0xF5,0x15,0x94,0xA3,0xD5,0xA2,0x46,0x82,0xD8,0x68,0x4C,0xD1,0x37,0x15,0x06,0x68,0xAF,0xBD,0xF8,0xB0,0xB3,0xF0,0x29,0xF5,0x95,0x5A,0x09,0x16,0x61,0x77,0x0A,
+ 0x22,0x25,0xD4,0x4F,0x45,0xAA,0xC7,0xBD,0xE5,0x96,0xDF,0xF9,0xD4,0xA8,0x8E,0x42,0xCC,0x24,0xC0,0x1E,0x91,0x27,0x4A,0xB5,0x6D,0x06,0x80,0x63,0x39,0xC4,0xA2,0x5E,0x38,0x03,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "30818902818100B8E64FBADB987C717CAF44B7D30F46D964E593C1428EC7BA498D352D7AE78BBDE5053159C6B12F0A0CFB9FA73FA2096684561E37291B87E97E0CCA9A9FA57FF51594A3D5A24682D8684CD137150668AFBDF8B0B3F029F5955A091661770A2225D44F45AAC7BDE596DFF9D4A88E42CC24C01E91274AB56D06806339C4A25E38030203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x00 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "00", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,
+ 0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,
+ 0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x39,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x42,0x38,0x45,0x36,0x34,0x46,0x42,0x41,0x44,0x42,0x39,0x38,0x37,0x43,0x37,0x31,0x37,0x43,0x41,0x46,0x34,0x34,0x42,0x37,0x44,0x33,0x30,0x46,0x34,
+ 0x36,0x44,0x39,0x36,0x34,0x45,0x35,0x39,0x33,0x43,0x31,0x34,0x32,0x38,0x45,0x43,0x37,0x42,0x41,0x34,0x39,0x38,0x44,0x33,0x35,0x32,0x44,0x37,0x41,0x45,0x37,0x38,0x42,0x42,0x44,0x45,0x35,0x30,0x35,0x33,0x31,0x35,0x39,0x43,0x36,0x42,0x31,0x32,0x46,0x30,0x41,0x30,0x43,0x46,0x42,0x39,0x46,0x41,0x37,0x33,0x46,0x41,0x32,0x30,0x39,0x36,0x36,0x38,0x34,0x35,0x36,0x31,0x45,0x33,0x37,0x32,0x39,0x31,0x42,0x38,0x37,0x45,0x39,0x37,0x45,0x30,0x43,0x43,0x41,0x39,0x41,0x39,0x46,0x41,0x35,0x37,0x46,0x46,0x35,0x31,
+ 0x35,0x39,0x34,0x41,0x33,0x44,0x35,0x41,0x32,0x34,0x36,0x38,0x32,0x44,0x38,0x36,0x38,0x34,0x43,0x44,0x31,0x33,0x37,0x31,0x35,0x30,0x36,0x36,0x38,0x41,0x46,0x42,0x44,0x46,0x38,0x42,0x30,0x42,0x33,0x46,0x30,0x32,0x39,0x46,0x35,0x39,0x35,0x35,0x41,0x30,0x39,0x31,0x36,0x36,0x31,0x37,0x37,0x30,0x41,0x32,0x32,0x32,0x35,0x44,0x34,0x34,0x46,0x34,0x35,0x41,0x41,0x43,0x37,0x42,0x44,0x45,0x35,0x39,0x36,0x44,0x46,0x46,0x39,0x44,0x34,0x41,0x38,0x38,0x45,0x34,0x32,0x43,0x43,0x32,0x34,0x43,0x30,0x31,0x45,0x39,
+ 0x31,0x32,0x37,0x34,0x41,0x42,0x35,0x36,0x44,0x30,0x36,0x38,0x30,0x36,0x33,0x33,0x39,0x43,0x34,0x41,0x32,0x35,0x45,0x33,0x38,0x30,0x33,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Certificate: basic\ms_spc.cer
+// no comments
+public void TestCertificate12 ()
+{
+ // certificate can be loaded by constructor
+ byte[] cert = { 0x30,0x82,0x05,0x0F,0x30,0x82,0x03,0xF7,0xA0,0x03,0x02,0x01,0x02,0x02,0x0A,0x61,0x07,0x11,0x43,0x00,0x00,0x00,0x00,0x00,0x34,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81,0xA6,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x52,0x65,0x64,0x6D,0x6F,0x6E,0x64,0x31,0x1E,0x30,0x1C,0x06,0x03,
+ 0x55,0x04,0x0A,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x0B,0x13,0x22,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x30,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x64,0x65,0x20,0x53,0x69,0x67,
+ 0x6E,0x69,0x6E,0x67,0x20,0x50,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x32,0x30,0x35,0x32,0x35,0x30,0x30,0x35,0x35,0x34,0x38,0x5A,0x17,0x0D,0x30,0x33,0x31,0x31,0x32,0x35,0x30,0x31,0x30,0x35,0x34,0x38,0x5A,0x30,0x81,0xA1,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x52,0x65,0x64,0x6D,0x6F,0x6E,0x64,0x31,0x1E,0x30,0x1C,0x06,
+ 0x03,0x55,0x04,0x0A,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x0B,0x13,0x22,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x32,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x03,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,
+ 0x74,0x69,0x6F,0x6E,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAA,0x99,0xBD,0x39,0xA8,0x18,0x27,0xF4,0x2B,0x3D,0x0B,0x4C,0x3F,0x7C,0x77,0x2E,0xA7,0xCB,0xB5,0xD1,0x8C,0x0D,0xC2,0x3A,0x74,0xD7,0x93,0xB5,0xE0,0xA0,0x4B,0x3F,0x59,0x5E,0xCE,0x45,0x4F,0x9A,0x79,0x29,0xF1,0x49,0xCC,0x1A,0x47,0xEE,0x55,0xC2,0x08,0x3E,0x12,0x20,0xF8,0x55,0xF2,0xEE,0x5F,0xD3,0xE0,0xCA,0x96,0xBC,0x30,
+ 0xDE,0xFE,0x58,0xC8,0x27,0x32,0xD0,0x85,0x54,0xE8,0xF0,0x91,0x10,0xBB,0xF3,0x2B,0xBE,0x19,0xE5,0x03,0x9B,0x0B,0x86,0x1D,0xF3,0xB0,0x39,0x8C,0xB8,0xFD,0x0B,0x1D,0x3C,0x73,0x26,0xAC,0x57,0x2B,0xCA,0x29,0xA2,0x15,0x90,0x82,0x15,0xE2,0x77,0xA3,0x40,0x52,0x03,0x8B,0x9D,0xC2,0x70,0xBA,0x1F,0xE9,0x34,0xF6,0xF3,0x35,0x92,0x4E,0x55,0x83,0xF8,0xDA,0x30,0xB6,0x20,0xDE,0x57,0x06,0xB5,0x5A,0x42,0x06,0xDE,0x59,0xCB,0xF2,0xDF,0xA6,0xBD,0x15,0x47,0x71,0x19,0x25,0x23,0xD2,0xCB,0x6F,0x9B,0x19,0x79,0xDF,0x6A,0x5B,
+ 0xF1,0x76,0x05,0x79,0x29,0xFC,0xC3,0x56,0xCA,0x8F,0x44,0x08,0x85,0x55,0x8A,0xCB,0xC8,0x0F,0x46,0x4B,0x55,0xCB,0x8C,0x96,0x77,0x4A,0x87,0xE8,0xA9,0x41,0x06,0xC7,0xFF,0x0D,0xE9,0x68,0x57,0x63,0x72,0xC3,0x69,0x57,0xB4,0x43,0xCF,0x32,0x3A,0x30,0xDC,0x1B,0xE9,0xD5,0x43,0x26,0x2A,0x79,0xFE,0x95,0xDB,0x22,0x67,0x24,0xC9,0x2F,0xD0,0x34,0xE3,0xE6,0xFB,0x51,0x49,0x86,0xB8,0x3C,0xD0,0x25,0x5F,0xD6,0xEC,0x9E,0x03,0x61,0x87,0xA9,0x68,0x40,0xC7,0xF8,0xE2,0x03,0xE6,0xCF,0x05,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,
+ 0x01,0x40,0x30,0x82,0x01,0x3C,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x06,0xC0,0x30,0x13,0x06,0x03,0x55,0x1D,0x25,0x04,0x0C,0x30,0x0A,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x03,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x6B,0xC8,0xC6,0x51,0x20,0xF0,0xB4,0x2F,0xD3,0xA0,0xB6,0xAE,0x7F,0x5E,0x26,0xB2,0xB8,0x87,0x52,0x29,0x30,0x81,0xA9,0x06,0x03,0x55,0x1D,0x23,0x04,0x81,0xA1,0x30,0x81,0x9E,0x80,0x14,0x29,0x5C,0xB9,0x1B,0xB6,0xCD,0x33,0xEE,0xBB,0x9E,
+ 0x59,0x7D,0xF7,0xE5,0xCA,0x2E,0xC4,0x0D,0x34,0x28,0xA1,0x74,0xA4,0x72,0x30,0x70,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x0B,0x13,0x22,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x37,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0B,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,
+ 0x04,0x03,0x13,0x18,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x82,0x10,0x6A,0x0B,0x99,0x4F,0xC0,0x00,0xDE,0xAA,0x11,0xD4,0xD8,0x40,0x9A,0xA8,0xBE,0xE6,0x30,0x4A,0x06,0x03,0x55,0x1D,0x1F,0x04,0x43,0x30,0x41,0x30,0x3F,0xA0,0x3D,0xA0,0x3B,0x86,0x39,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x6D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x2E,0x63,0x6F,0x6D,0x2F,0x70,0x6B,0x69,0x2F,0x63,0x72,0x6C,0x2F,0x70,0x72,
+ 0x6F,0x64,0x75,0x63,0x74,0x73,0x2F,0x43,0x6F,0x64,0x65,0x53,0x69,0x67,0x6E,0x50,0x43,0x41,0x2E,0x63,0x72,0x6C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x35,0x23,0xFD,0x13,0x54,0xFC,0xE9,0xDC,0xF0,0xDD,0x0C,0x14,0x7A,0xFA,0xA7,0xB3,0xCE,0xFD,0xA7,0x3A,0xC8,0xBA,0xE5,0xE7,0xF6,0x03,0xFB,0x53,0xDB,0xA7,0x99,0xA9,0xA0,0x9B,0x36,0x9C,0x03,0xEB,0x82,0x47,0x1C,0x21,0xBD,0x14,0xCB,0xE7,0x67,0x40,0x09,0xC7,0x16,0x91,0x02,0x55,0xCE,0x43,0x42,0xB4,
+ 0xCD,0x1B,0x5D,0xB0,0xF3,0x32,0x04,0x3D,0x12,0xE5,0x1D,0xA7,0x07,0xA7,0x8F,0xA3,0x7E,0x45,0x55,0x76,0x1B,0x96,0x95,0x91,0x69,0xF0,0xDD,0x38,0xF3,0x48,0x89,0xEF,0x70,0x40,0xB7,0xDB,0xB5,0x55,0x80,0xC0,0x03,0xC4,0x2E,0xB6,0x28,0xDC,0x0A,0x82,0x0E,0xC7,0x43,0xE3,0x7A,0x48,0x5D,0xB8,0x06,0x89,0x92,0x40,0x6C,0x6E,0xC5,0xDC,0xF8,0x9A,0xEF,0x0B,0xBE,0x21,0x0A,0x8C,0x2F,0x3A,0xB5,0xED,0xA7,0xCE,0x71,0x87,0x68,0x23,0xE1,0xB3,0xE4,0x18,0x7D,0xB8,0x47,0x01,0xA5,0x2B,0xC4,0x58,0xCB,0xB2,0x89,0x6C,0x5F,0xFD,
+ 0xD3,0x2C,0xC4,0x6F,0xB8,0x23,0xB2,0x0D,0xFF,0x3C,0xF2,0x11,0x45,0x74,0xF2,0x09,0x06,0x99,0x18,0xDD,0x6F,0xC0,0x86,0x01,0x18,0x12,0x1D,0x2B,0x16,0xAF,0x56,0xEF,0x65,0x33,0xA1,0xEA,0x67,0x4E,0xF4,0x4B,0x82,0xAB,0xE9,0x0F,0xDC,0x01,0xFA,0xDF,0x60,0x7F,0x66,0x47,0x5D,0xCB,0x2C,0x70,0xCC,0x7B,0x4E,0xD9,0x06,0xB8,0x6E,0x8C,0x0C,0xFE,0x62,0x1E,0x42,0xF9,0x93,0x7C,0xA2,0xAB,0x0A,0x9E,0xD0,0x23,0x10,0xAE,0x4D,0x7B,0x27,0x91,0x6F,0x26,0xBE,0x68,0xFA,0xA6,0x3F,0x9F,0x23,0xEB,0xC8,0x9D,0xBB,0x87 };
+
+ X509Certificate x509 = new X509Certificate (cert);
+ X509Certificate clone = new X509Certificate (x509);
+
+ Assert ("Equals", x509.Equals (clone));
+ Assert ("Equals", clone.Equals (x509));
+
+ FileStream fs = File.OpenWrite ("temp.cer");
+ fs.Write (cert, 0, cert.Length);
+ fs.Close ();
+
+ X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
+ Assert ("Equals", disk.Equals (clone));
+ Assert ("Equals", disk.Equals (x509));
+ byte[] hash = { 0x28,0x2D,0x98,0x06,0xC3,0xDF,0x73,0x45,0x92,0x9F,0x64,0xF5,0x89,0x5E,0xF2,0xEA,0x4A,0xC2,0x93,0x02 };
+ AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
+ AssertEquals ("GetCertHashString", "282D9806C3DF7345929F64F5895EF2EA4AC29302", x509.GetCertHashString ());
+ AssertEquals ("GetEffectiveDateString", "2002-05-24 16:55:48", DateTime.Parse (x509.GetEffectiveDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetExpirationDateString", "2003-11-24 17:05:48", DateTime.Parse (x509.GetExpirationDateString ()).ToString ("yyyy-MM-dd HH:mm:ss"));
+ AssertEquals ("GetFormat", "X509", x509.GetFormat ());
+ AssertEquals ("GetHashCode", 674076678, x509.GetHashCode ());
+ AssertEquals ("GetIssuerName", "C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Copyright (c) 2000 Microsoft Corp., CN=Microsoft Code Signing PCA", x509.GetIssuerName ());
+ AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
+ byte[] keyparams = { 0x05,0x00 };
+ AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
+ AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
+ AssertEquals ("GetName", "C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Copyright (c) 2002 Microsoft Corp., CN=Microsoft Corporation", x509.GetName ());
+ byte[] pubkey = { 0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAA,0x99,0xBD,0x39,0xA8,0x18,0x27,0xF4,0x2B,0x3D,0x0B,0x4C,0x3F,0x7C,0x77,0x2E,0xA7,0xCB,0xB5,0xD1,0x8C,0x0D,0xC2,0x3A,0x74,0xD7,0x93,0xB5,0xE0,0xA0,0x4B,0x3F,0x59,0x5E,0xCE,0x45,0x4F,0x9A,0x79,0x29,0xF1,0x49,0xCC,0x1A,0x47,0xEE,0x55,0xC2,0x08,0x3E,0x12,0x20,0xF8,0x55,0xF2,0xEE,0x5F,0xD3,0xE0,0xCA,0x96,0xBC,0x30,0xDE,0xFE,0x58,0xC8,0x27,0x32,0xD0,0x85,0x54,0xE8,0xF0,0x91,0x10,0xBB,0xF3,0x2B,0xBE,0x19,0xE5,0x03,0x9B,0x0B,0x86,0x1D,0xF3,0xB0,0x39,0x8C,0xB8,
+ 0xFD,0x0B,0x1D,0x3C,0x73,0x26,0xAC,0x57,0x2B,0xCA,0x29,0xA2,0x15,0x90,0x82,0x15,0xE2,0x77,0xA3,0x40,0x52,0x03,0x8B,0x9D,0xC2,0x70,0xBA,0x1F,0xE9,0x34,0xF6,0xF3,0x35,0x92,0x4E,0x55,0x83,0xF8,0xDA,0x30,0xB6,0x20,0xDE,0x57,0x06,0xB5,0x5A,0x42,0x06,0xDE,0x59,0xCB,0xF2,0xDF,0xA6,0xBD,0x15,0x47,0x71,0x19,0x25,0x23,0xD2,0xCB,0x6F,0x9B,0x19,0x79,0xDF,0x6A,0x5B,0xF1,0x76,0x05,0x79,0x29,0xFC,0xC3,0x56,0xCA,0x8F,0x44,0x08,0x85,0x55,0x8A,0xCB,0xC8,0x0F,0x46,0x4B,0x55,0xCB,0x8C,0x96,0x77,0x4A,0x87,0xE8,0xA9,
+ 0x41,0x06,0xC7,0xFF,0x0D,0xE9,0x68,0x57,0x63,0x72,0xC3,0x69,0x57,0xB4,0x43,0xCF,0x32,0x3A,0x30,0xDC,0x1B,0xE9,0xD5,0x43,0x26,0x2A,0x79,0xFE,0x95,0xDB,0x22,0x67,0x24,0xC9,0x2F,0xD0,0x34,0xE3,0xE6,0xFB,0x51,0x49,0x86,0xB8,0x3C,0xD0,0x25,0x5F,0xD6,0xEC,0x9E,0x03,0x61,0x87,0xA9,0x68,0x40,0xC7,0xF8,0xE2,0x03,0xE6,0xCF,0x05,0x02,0x03,0x01,0x00,0x01 };
+ AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
+ AssertEquals ("GetPublicKeyString", "3082010A0282010100AA99BD39A81827F42B3D0B4C3F7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001", x509.GetPublicKeyString ());
+ AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
+ AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
+ byte[] serial = { 0x34,0x00,0x00,0x00,0x00,0x00,0x43,0x11,0x07,0x61 };
+ AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
+ AssertEquals ("GetSerialNumberString", "34000000000043110761", x509.GetSerialNumberString ());
+ byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x2C,0x20,0x4C,0x3D,0x52,0x65,0x64,0x6D,0x6F,0x6E,0x64,0x2C,0x20,0x4F,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x4F,0x55,0x3D,0x43,0x6F,0x70,0x79,
+ 0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x32,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x2C,0x20,0x43,0x4E,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x2C,0x20,0x4C,0x3D,0x52,0x65,0x64,0x6D,0x6F,0x6E,
+ 0x64,0x2C,0x20,0x4F,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x4F,0x55,0x3D,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x30,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x2C,0x20,0x43,0x4E,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x64,0x65,0x20,0x53,0x69,0x67,0x6E,0x69,0x6E,0x67,0x20,0x50,0x43,0x41,0x0D,0x0A,0x09,0x4B,
+ 0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x33,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x33,0x31,0x31,0x30,0x37,0x36,0x31,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,
+ 0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x32,0x30,0x31,0x30,0x41,0x30,0x32,0x38,0x32,0x30,0x31,0x30,0x31,0x30,0x30,0x41,0x41,0x39,0x39,0x42,0x44,0x33,0x39,0x41,0x38,0x31,0x38,0x32,0x37,0x46,0x34,0x32,0x42,0x33,0x44,0x30,0x42,0x34,0x43,0x33,0x46,0x37,0x43,0x37,0x37,0x32,0x45,0x41,0x37,0x43,0x42,0x42,0x35,0x44,0x31,0x38,0x43,0x30,0x44,0x43,0x32,0x33,0x41,0x37,0x34,0x44,0x37,0x39,0x33,0x42,0x35,0x45,0x30,
+ 0x41,0x30,0x34,0x42,0x33,0x46,0x35,0x39,0x35,0x45,0x43,0x45,0x34,0x35,0x34,0x46,0x39,0x41,0x37,0x39,0x32,0x39,0x46,0x31,0x34,0x39,0x43,0x43,0x31,0x41,0x34,0x37,0x45,0x45,0x35,0x35,0x43,0x32,0x30,0x38,0x33,0x45,0x31,0x32,0x32,0x30,0x46,0x38,0x35,0x35,0x46,0x32,0x45,0x45,0x35,0x46,0x44,0x33,0x45,0x30,0x43,0x41,0x39,0x36,0x42,0x43,0x33,0x30,0x44,0x45,0x46,0x45,0x35,0x38,0x43,0x38,0x32,0x37,0x33,0x32,0x44,0x30,0x38,0x35,0x35,0x34,0x45,0x38,0x46,0x30,0x39,0x31,0x31,0x30,0x42,0x42,0x46,0x33,0x32,0x42,
+ 0x42,0x45,0x31,0x39,0x45,0x35,0x30,0x33,0x39,0x42,0x30,0x42,0x38,0x36,0x31,0x44,0x46,0x33,0x42,0x30,0x33,0x39,0x38,0x43,0x42,0x38,0x46,0x44,0x30,0x42,0x31,0x44,0x33,0x43,0x37,0x33,0x32,0x36,0x41,0x43,0x35,0x37,0x32,0x42,0x43,0x41,0x32,0x39,0x41,0x32,0x31,0x35,0x39,0x30,0x38,0x32,0x31,0x35,0x45,0x32,0x37,0x37,0x41,0x33,0x34,0x30,0x35,0x32,0x30,0x33,0x38,0x42,0x39,0x44,0x43,0x32,0x37,0x30,0x42,0x41,0x31,0x46,0x45,0x39,0x33,0x34,0x46,0x36,0x46,0x33,0x33,0x35,0x39,0x32,0x34,0x45,0x35,0x35,0x38,0x33,
+ 0x46,0x38,0x44,0x41,0x33,0x30,0x42,0x36,0x32,0x30,0x44,0x45,0x35,0x37,0x30,0x36,0x42,0x35,0x35,0x41,0x34,0x32,0x30,0x36,0x44,0x45,0x35,0x39,0x43,0x42,0x46,0x32,0x44,0x46,0x41,0x36,0x42,0x44,0x31,0x35,0x34,0x37,0x37,0x31,0x31,0x39,0x32,0x35,0x32,0x33,0x44,0x32,0x43,0x42,0x36,0x46,0x39,0x42,0x31,0x39,0x37,0x39,0x44,0x46,0x36,0x41,0x35,0x42,0x46,0x31,0x37,0x36,0x30,0x35,0x37,0x39,0x32,0x39,0x46,0x43,0x43,0x33,0x35,0x36,0x43,0x41,0x38,0x46,0x34,0x34,0x30,0x38,0x38,0x35,0x35,0x35,0x38,0x41,0x43,0x42,
+ 0x43,0x38,0x30,0x46,0x34,0x36,0x34,0x42,0x35,0x35,0x43,0x42,0x38,0x43,0x39,0x36,0x37,0x37,0x34,0x41,0x38,0x37,0x45,0x38,0x41,0x39,0x34,0x31,0x30,0x36,0x43,0x37,0x46,0x46,0x30,0x44,0x45,0x39,0x36,0x38,0x35,0x37,0x36,0x33,0x37,0x32,0x43,0x33,0x36,0x39,0x35,0x37,0x42,0x34,0x34,0x33,0x43,0x46,0x33,0x32,0x33,0x41,0x33,0x30,0x44,0x43,0x31,0x42,0x45,0x39,0x44,0x35,0x34,0x33,0x32,0x36,0x32,0x41,0x37,0x39,0x46,0x45,0x39,0x35,0x44,0x42,0x32,0x32,0x36,0x37,0x32,0x34,0x43,0x39,0x32,0x46,0x44,0x30,0x33,0x34,
+ 0x45,0x33,0x45,0x36,0x46,0x42,0x35,0x31,0x34,0x39,0x38,0x36,0x42,0x38,0x33,0x43,0x44,0x30,0x32,0x35,0x35,0x46,0x44,0x36,0x45,0x43,0x39,0x45,0x30,0x33,0x36,0x31,0x38,0x37,0x41,0x39,0x36,0x38,0x34,0x30,0x43,0x37,0x46,0x38,0x45,0x32,0x30,0x33,0x45,0x36,0x43,0x46,0x30,0x35,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
+ AssertEquals ("ToString(true)", Encoding.Default.GetString (ToStringArray), x509.ToString (true));
+}
+
+
+// Number of certificates: 11
+// Number of invalid certificates: 1
+}
+}
+
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs
new file mode 100644
index 00000000000..bc804685044
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs
@@ -0,0 +1,198 @@
+//
+// TestSuite.System.Security.Cryptography.AllTests.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+ /// <summary>
+ /// Combines all available crypto unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ // because most crypto stuff works with byte[] buffers
+ static public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ if ((array1 == null) && (array2 == null))
+ return;
+ if (array1 == null)
+ Fail (msg + " -> First array is NULL");
+ if (array2 == null)
+ Fail (msg + " -> Second array is NULL");
+
+ bool a = (array1.Length == array2.Length);
+ if (a) {
+ for (int i = 0; i < array1.Length; i++) {
+ if (array1 [i] != array2 [i]) {
+ a = false;
+ break;
+ }
+ }
+ }
+ msg += " -> Expected " + BitConverter.ToString (array1, 0);
+ msg += " is different than " + BitConverter.ToString (array2, 0);
+ Assert (msg, a);
+ }
+
+ public static byte[] dsaG = { 0x3D, 0x4F, 0xCC, 0x78, 0x6A, 0x7A, 0x23, 0xF1, 0x41, 0x76, 0xEB, 0xB0, 0x0F, 0xD5, 0x0F, 0x78, 0x21, 0x73, 0x83, 0xC2, 0x1B, 0xF4, 0x7E, 0x68, 0xB2, 0x4B,
+ 0xB9, 0x9D, 0x3F, 0x00, 0x84, 0x74, 0xD8, 0xF3, 0x31, 0xAA, 0x7A, 0xDB, 0xAF, 0x1E, 0x1C, 0x5B, 0x11, 0x2B, 0x78, 0x94, 0xBC, 0xFC, 0x69, 0x7C, 0xD7,
+ 0xD2, 0x82, 0x22, 0x32, 0xCB, 0xAC, 0x06, 0xBE, 0x84, 0xFD, 0xA0, 0x5D, 0xA2, 0x80, 0x48, 0xDF, 0xA7, 0xC7, 0xC1, 0x6F, 0x16, 0x9D, 0xD0, 0xA6, 0xC2,
+ 0x40, 0x75, 0x92, 0xFE, 0xE6, 0x85, 0x12, 0x01, 0xE3, 0x7D, 0x36, 0x52, 0xB7, 0xEF, 0x0B, 0x62, 0x96, 0x42, 0xE0, 0x72, 0xA5, 0xF9, 0x74, 0xFB, 0xE6,
+ 0xB5, 0xC2, 0x10, 0x4C, 0x0A, 0x1E, 0x55, 0x4C, 0x96, 0x07, 0xD6, 0xC0, 0x64, 0x14, 0x86, 0x95, 0x35, 0xE5, 0x1B, 0xB7, 0x94, 0x3A, 0xFD, 0x47, 0x62,
+ 0x65, 0x56 };
+ public static byte[] dsaJ = { 0x00, 0x00, 0x00, 0x01, 0x0E, 0x8B, 0x4A, 0xE4, 0x62, 0x61, 0xDB, 0x28, 0x71, 0x9E, 0xAB, 0x83, 0x2A, 0x88, 0x3A, 0x91, 0x35, 0xFE, 0xE0, 0x8E, 0xD4, 0xF7,
+ 0xC4, 0x9F, 0xBE, 0x7C, 0x2E, 0x0D, 0x95, 0x5B, 0xA3, 0x87, 0x25, 0x36, 0x07, 0x34, 0x2D, 0xF4, 0xB3, 0x48, 0x12, 0x4C, 0x6F, 0xC9, 0xB7, 0x7A, 0x07,
+ 0x61, 0x7F, 0x92, 0xF2, 0xFA, 0xED, 0x35, 0x86, 0xFC, 0x91, 0x12, 0x7F, 0x8A, 0x98, 0x1C, 0xA1, 0xF1, 0xAA, 0xD9, 0x0A, 0x3F, 0x71, 0x82, 0x8F, 0xED,
+ 0x15, 0xF6, 0x2B, 0xA1, 0x09, 0xC1, 0x27, 0xD6, 0x22, 0x78, 0x6C, 0x34, 0xCA, 0xF5, 0x26, 0x6C, 0xEE, 0x2B, 0x49, 0x54, 0x2A, 0x45, 0xD7, 0x5D, 0x5A,
+ 0x35, 0xE5, 0xF2, 0xFC, 0x3B, 0x6F, 0xF5, 0xEA, 0xE1, 0x16, 0x32 };
+ public static byte[] dsaP = { 0xB3, 0xF3, 0x9C, 0xD2, 0xDE, 0x20, 0x8F, 0x43, 0x51, 0xAA, 0x40, 0x8A, 0x8B, 0x8C, 0xA7, 0x26, 0x73, 0x80, 0x12, 0xE9, 0x0D, 0x86, 0x39, 0x07, 0x24, 0xF3,
+ 0xB3, 0x36, 0xC1, 0xCF, 0xEB, 0xD9, 0x32, 0x1C, 0xC5, 0x30, 0x67, 0x70, 0x33, 0x3A, 0x42, 0xC6, 0x60, 0xE5, 0xA5, 0x3A, 0x8D, 0xB3, 0x95, 0x82, 0xB3,
+ 0x49, 0xB6, 0x72, 0x80, 0x30, 0xC8, 0xE5, 0xD0, 0x96, 0x03, 0x98, 0x10, 0x17, 0x66, 0x46, 0x1C, 0x45, 0x25, 0x58, 0x93, 0x20, 0x53, 0x21, 0xE6, 0x93,
+ 0x26, 0xCE, 0x8B, 0x8E, 0x1C, 0xC8, 0x76, 0x97, 0xF7, 0x27, 0x86, 0x7D, 0xB9, 0xE8, 0x73, 0x7C, 0x45, 0xF6, 0xC6, 0x20, 0x90, 0x0D, 0xEF, 0x3D, 0x46,
+ 0x5A, 0x26, 0xE6, 0x0C, 0x3A, 0xC0, 0x69, 0xDE, 0x9C, 0x8F, 0x75, 0xE3, 0x7C, 0xFE, 0x62, 0xD4, 0xF2, 0x7D, 0x22, 0xBD, 0x44, 0x72, 0x3F, 0xED, 0xC6,
+ 0x7B, 0xD3 };
+ public static byte[] dsaQ = { 0xAA, 0x47, 0x13, 0x5B, 0xE0, 0x9E, 0xD0, 0xBE, 0x64, 0xF0, 0xE1, 0x93, 0x50, 0xC9, 0x11, 0xA0, 0x62, 0x83, 0x73, 0x51 };
+ public static byte[] dsaX = { 0x7C, 0x03, 0xB2, 0xB5, 0x9B, 0x6D, 0x51, 0x91, 0x73, 0xB7, 0xF0, 0x2F, 0xC1, 0x18, 0xA7, 0x9A, 0xF6, 0x0A, 0x2F, 0xB1 };
+ public static byte[] dsaY = { 0xB2, 0x12, 0x51, 0x51, 0xD1, 0xB1, 0x11, 0x8C, 0x52, 0x28, 0xCE, 0x49, 0x56, 0x89, 0x7D, 0x1C, 0x07, 0x50, 0xC0, 0x82, 0xBE, 0xC0, 0x5F, 0x57, 0xE2, 0x7F,
+ 0x52, 0x00, 0x3F, 0xBE, 0xBD, 0xF6, 0x4E, 0x30, 0xE6, 0x22, 0xF8, 0xCD, 0x72, 0xBA, 0xF4, 0x00, 0x95, 0x0B, 0xE7, 0x4A, 0x54, 0xD3, 0x5A, 0xBE, 0xC2,
+ 0x64, 0xF4, 0x55, 0x00, 0x80, 0x8B, 0x80, 0x30, 0x5B, 0xAA, 0x2F, 0x62, 0x37, 0xE2, 0x1D, 0xEB, 0x47, 0x1C, 0x27, 0xE8, 0x70, 0xDE, 0x91, 0x83, 0x7C,
+ 0xBA, 0x49, 0xEC, 0x87, 0x45, 0x3E, 0xCC, 0xC9, 0x11, 0xE5, 0x0E, 0xF9, 0x26, 0x41, 0xC1, 0xFF, 0x27, 0x8C, 0x65, 0xD4, 0x2E, 0xA4, 0x8E, 0x0E, 0xCF,
+ 0xCD, 0x4D, 0xC8, 0xA2, 0x5F, 0xB1, 0x34, 0xEE, 0xB9, 0xBE, 0x29, 0xF9, 0x71, 0x14, 0xE8, 0x34, 0xAA, 0xD5, 0x80, 0x86, 0x66, 0x0B, 0xC4, 0x89, 0x03,
+ 0xC7, 0xBB };
+ public static int dsaCounter = 224;
+ public static byte[] dsaSeed = { 0xB9, 0x83, 0x39, 0x6F, 0x6D, 0x25, 0xBA, 0xF6, 0xEE, 0xC9, 0xEB, 0xE2, 0xF5, 0x35, 0xC7, 0xC1, 0xE9, 0x1B, 0xAF, 0x9B };
+
+ static public DSAParameters GetKey (bool includePrivateKey)
+ {
+ DSAParameters p = new DSAParameters();
+ p.Counter = dsaCounter;
+ p.G = (byte[]) dsaG.Clone ();
+ p.J = (byte[]) dsaJ.Clone ();
+ p.P = (byte[]) dsaP.Clone ();
+ p.Q = (byte[]) dsaQ.Clone ();
+ p.Seed = (byte[]) dsaSeed.Clone ();
+ p.Y = (byte[]) dsaY.Clone ();
+ if (includePrivateKey)
+ p.X = (byte[]) dsaX.Clone ();
+ else
+ p.X = null;
+ return p;
+ }
+
+ static byte[] rsaModulus = { 0xbb, 0xf8, 0x2f, 0x09, 0x06, 0x82, 0xce, 0x9c, 0x23, 0x38, 0xac, 0x2b, 0x9d, 0xa8, 0x71, 0xf7,
+ 0x36, 0x8d, 0x07, 0xee, 0xd4, 0x10, 0x43, 0xa4, 0x40, 0xd6, 0xb6, 0xf0, 0x74, 0x54, 0xf5, 0x1f,
+ 0xb8, 0xdf, 0xba, 0xaf, 0x03, 0x5c, 0x02, 0xab, 0x61, 0xea, 0x48, 0xce, 0xeb, 0x6f, 0xcd, 0x48,
+ 0x76, 0xed, 0x52, 0x0d, 0x60, 0xe1, 0xec, 0x46, 0x19, 0x71, 0x9d, 0x8a, 0x5b, 0x8b, 0x80, 0x7f,
+ 0xaf, 0xb8, 0xe0, 0xa3, 0xdf, 0xc7, 0x37, 0x72, 0x3e, 0xe6, 0xb4, 0xb7, 0xd9, 0x3a, 0x25, 0x84,
+ 0xee, 0x6a, 0x64, 0x9d, 0x06, 0x09, 0x53, 0x74, 0x88, 0x34, 0xb2, 0x45, 0x45, 0x98, 0x39, 0x4e,
+ 0xe0, 0xaa, 0xb1, 0x2d, 0x7b, 0x61, 0xa5, 0x1f, 0x52, 0x7a, 0x9a, 0x41, 0xf6, 0xc1, 0x68, 0x7f,
+ 0xe2, 0x53, 0x72, 0x98, 0xca, 0x2a, 0x8f, 0x59, 0x46, 0xf8, 0xe5, 0xfd, 0x09, 0x1d, 0xbd, 0xcb };
+ static byte[] rsaExponent = { 0x11 };
+ static byte[] rsaP = { 0xee, 0xcf, 0xae, 0x81, 0xb1, 0xb9, 0xb3, 0xc9, 0x08, 0x81, 0x0b, 0x10, 0xa1, 0xb5, 0x60, 0x01,
+ 0x99, 0xeb, 0x9f, 0x44, 0xae, 0xf4, 0xfd, 0xa4, 0x93, 0xb8, 0x1a, 0x9e, 0x3d, 0x84, 0xf6, 0x32,
+ 0x12, 0x4e, 0xf0, 0x23, 0x6e, 0x5d, 0x1e, 0x3b, 0x7e, 0x28, 0xfa, 0xe7, 0xaa, 0x04, 0x0a, 0x2d,
+ 0x5b, 0x25, 0x21, 0x76, 0x45, 0x9d, 0x1f, 0x39, 0x75, 0x41, 0xba, 0x2a, 0x58, 0xfb, 0x65, 0x99 };
+ static byte[] rsaQ = { 0xc9, 0x7f, 0xb1, 0xf0, 0x27, 0xf4, 0x53, 0xf6, 0x34, 0x12, 0x33, 0xea, 0xaa, 0xd1, 0xd9, 0x35,
+ 0x3f, 0x6c, 0x42, 0xd0, 0x88, 0x66, 0xb1, 0xd0, 0x5a, 0x0f, 0x20, 0x35, 0x02, 0x8b, 0x9d, 0x86,
+ 0x98, 0x40, 0xb4, 0x16, 0x66, 0xb4, 0x2e, 0x92, 0xea, 0x0d, 0xa3, 0xb4, 0x32, 0x04, 0xb5, 0xcf,
+ 0xce, 0x33, 0x52, 0x52, 0x4d, 0x04, 0x16, 0xa5, 0xa4, 0x41, 0xe7, 0x00, 0xaf, 0x46, 0x15, 0x03 };
+ static byte[] rsaDP = { 0x54, 0x49, 0x4c, 0xa6, 0x3e, 0xba, 0x03, 0x37, 0xe4, 0xe2, 0x40, 0x23, 0xfc, 0xd6, 0x9a, 0x5a,
+ 0xeb, 0x07, 0xdd, 0xdc, 0x01, 0x83, 0xa4, 0xd0, 0xac, 0x9b, 0x54, 0xb0, 0x51, 0xf2, 0xb1, 0x3e,
+ 0xd9, 0x49, 0x09, 0x75, 0xea, 0xb7, 0x74, 0x14, 0xff, 0x59, 0xc1, 0xf7, 0x69, 0x2e, 0x9a, 0x2e,
+ 0x20, 0x2b, 0x38, 0xfc, 0x91, 0x0a, 0x47, 0x41, 0x74, 0xad, 0xc9, 0x3c, 0x1f, 0x67, 0xc9, 0x81 };
+ static byte[] rsaDQ = { 0x47, 0x1e, 0x02, 0x90, 0xff, 0x0a, 0xf0, 0x75, 0x03, 0x51, 0xb7, 0xf8, 0x78, 0x86, 0x4c, 0xa9,
+ 0x61, 0xad, 0xbd, 0x3a, 0x8a, 0x7e, 0x99, 0x1c, 0x5c, 0x05, 0x56, 0xa9, 0x4c, 0x31, 0x46, 0xa7,
+ 0xf9, 0x80, 0x3f, 0x8f, 0x6f, 0x8a, 0xe3, 0x42, 0xe9, 0x31, 0xfd, 0x8a, 0xe4, 0x7a, 0x22, 0x0d,
+ 0x1b, 0x99, 0xa4, 0x95, 0x84, 0x98, 0x07, 0xfe, 0x39, 0xf9, 0x24, 0x5a, 0x98, 0x36, 0xda, 0x3d };
+ static byte[] rsaInverseQ = { 0xb0, 0x6c, 0x4f, 0xda, 0xbb, 0x63, 0x01, 0x19, 0x8d, 0x26, 0x5b, 0xdb, 0xae, 0x94, 0x23, 0xb3,
+ 0x80, 0xf2, 0x71, 0xf7, 0x34, 0x53, 0x88, 0x50, 0x93, 0x07, 0x7f, 0xcd, 0x39, 0xe2, 0x11, 0x9f,
+ 0xc9, 0x86, 0x32, 0x15, 0x4f, 0x58, 0x83, 0xb1, 0x67, 0xa9, 0x67, 0xbf, 0x40, 0x2b, 0x4e, 0x9e,
+ 0x2e, 0x0f, 0x96, 0x56, 0xe6, 0x98, 0xea, 0x36, 0x66, 0xed, 0xfb, 0x25, 0x79, 0x80, 0x39, 0xf7 };
+ static byte[] rsaD = { 0xa5, 0xda, 0xfc, 0x53, 0x41, 0xfa, 0xf2, 0x89, 0xc4, 0xb9, 0x88, 0xdb, 0x30, 0xc1, 0xcd, 0xf8,
+ 0x3f, 0x31, 0x25, 0x1e, 0x06, 0x68, 0xb4, 0x27, 0x84, 0x81, 0x38, 0x01, 0x57, 0x96, 0x41, 0xb2,
+ 0x94, 0x10, 0xb3, 0xc7, 0x99, 0x8d, 0x6b, 0xc4, 0x65, 0x74, 0x5e, 0x5c, 0x39, 0x26, 0x69, 0xd6,
+ 0x87, 0x0d, 0xa2, 0xc0, 0x82, 0xa9, 0x39, 0xe3, 0x7f, 0xdc, 0xb8, 0x2e, 0xc9, 0x3e, 0xda, 0xc9,
+ 0x7f, 0xf3, 0xad, 0x59, 0x50, 0xac, 0xcf, 0xbc, 0x11, 0x1c, 0x76, 0xf1, 0xa9, 0x52, 0x94, 0x44,
+ 0xe5, 0x6a, 0xaf, 0x68, 0xc5, 0x6c, 0x09, 0x2c, 0xd3, 0x8d, 0xc3, 0xbe, 0xf5, 0xd2, 0x0a, 0x93,
+ 0x99, 0x26, 0xed, 0x4f, 0x74, 0xa1, 0x3e, 0xdd, 0xfb, 0xe1, 0xa1, 0xce, 0xcc, 0x48, 0x94, 0xaf,
+ 0x94, 0x28, 0xc2, 0xb7, 0xb8, 0x88, 0x3f, 0xe4, 0x46, 0x3a, 0x4b, 0xc8, 0x5b, 0x1c, 0xb3, 0xc1 };
+
+ static public RSAParameters GetRsaKey (bool includePrivateKey)
+ {
+ RSAParameters p = new RSAParameters();
+ if (includePrivateKey) {
+ p.D = (byte[]) rsaD.Clone();
+ p.DP = (byte[]) rsaDP.Clone();
+ p.DQ = (byte[]) rsaDQ.Clone();
+ p.P = (byte[]) rsaP.Clone();
+ p.Q = (byte[]) rsaQ.Clone();
+ p.InverseQ = (byte[]) rsaInverseQ.Clone();
+ }
+ else {
+ p.D = null;
+ p.DP = null;
+ p.DQ = null;
+ p.P = null;
+ p.Q = null;
+ p.InverseQ = null;
+ }
+ p.Modulus = (byte[]) rsaModulus.Clone();
+ p.Exponent = (byte[]) rsaExponent.Clone();
+ return p;
+ }
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (SymmetricAlgorithmTest.Suite);
+ suite.AddTest (AsymmetricAlgorithmTest.Suite);
+ suite.AddTest (RNGCryptoServiceProviderTest.Suite);
+ suite.AddTest (FromBase64TransformTest.Suite);
+ suite.AddTest (RijndaelManagedTest.Suite);
+ suite.AddTest (MD5Test.Suite);
+ suite.AddTest (RC2Test.Suite);
+ suite.AddTest (CryptoConfigTest.Suite);
+ suite.AddTest (DSATest.Suite);
+ suite.AddTest (DSACryptoServiceProviderTest.Suite);
+ suite.AddTest (DSASignatureDeformatterTest.Suite);
+ suite.AddTest (DSASignatureFormatterTest.Suite);
+ suite.AddTest (RSATest.Suite);
+ suite.AddTest (RandomNumberGeneratorTest.Suite);
+ suite.AddTest (HashAlgorithmTest.Suite);
+ suite.AddTest (SHA1Test.Suite);
+ suite.AddTest (SHA1CryptoServiceProviderTest.Suite);
+ suite.AddTest (KeyedHashAlgorithmTest.Suite);
+ suite.AddTest (HMACSHA1Test.Suite);
+ suite.AddTest (PKCS1MaskGenerationMethodTest.Suite);
+ suite.AddTest (RijndaelTest.Suite);
+ suite.AddTest (PasswordDeriveBytesTest.Suite);
+ suite.AddTest (SHA256Test.Suite);
+ suite.AddTest (SHA256ManagedTest.Suite);
+ suite.AddTest (SHA384Test.Suite);
+ suite.AddTest (SHA384ManagedTest.Suite);
+ suite.AddTest (SHA512Test.Suite);
+ suite.AddTest (SHA512ManagedTest.Suite);
+ suite.AddTest (SignatureDescriptionTest.Suite);
+ suite.AddTest (RSACryptoServiceProviderTest.Suite);
+ suite.AddTest (RSAOAEPKeyExchangeDeformatterTest.Suite);
+ suite.AddTest (RSAOAEPKeyExchangeFormatterTest.Suite);
+ suite.AddTest (RSAPKCS1KeyExchangeDeformatterTest.Suite);
+ suite.AddTest (RSAPKCS1KeyExchangeFormatterTest.Suite);
+ suite.AddTest (RSAPKCS1SignatureDeformatterTest.Suite);
+ suite.AddTest (RSAPKCS1SignatureFormatterTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AllTests2.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AllTests2.cs
new file mode 100755
index 00000000000..551245314cb
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/AllTests2.cs
@@ -0,0 +1,152 @@
+//
+// TestSuite.System.Security.Cryptography.AllTests.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Security.Cryptography;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+ /// <summary>
+ /// Combines all available crypto unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ // because most crypto stuff works with byte[] buffers
+ static public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ if ((array1 == null) && (array2 == null))
+ return;
+ if (array1 == null)
+ Fail (msg + " -> First array is NULL");
+ if (array2 == null)
+ Fail (msg + " -> Second array is NULL");
+
+ bool a = (array1.Length == array2.Length);
+ if (a) {
+ for (int i = 0; i < array1.Length; i++) {
+ if (array1 [i] != array2 [i]) {
+ a = false;
+ break;
+ }
+ }
+ }
+ msg += " -> Expected " + BitConverter.ToString (array1, 0);
+ msg += " is different than " + BitConverter.ToString (array2, 0);
+ Assert (msg, a);
+ }
+
+ public static byte[] dsaG = { 0x3D, 0x4F, 0xCC, 0x78, 0x6A, 0x7A, 0x23, 0xF1, 0x41, 0x76, 0xEB, 0xB0, 0x0F, 0xD5, 0x0F, 0x78, 0x21, 0x73, 0x83, 0xC2, 0x1B, 0xF4, 0x7E, 0x68, 0xB2, 0x4B,
+ 0xB9, 0x9D, 0x3F, 0x00, 0x84, 0x74, 0xD8, 0xF3, 0x31, 0xAA, 0x7A, 0xDB, 0xAF, 0x1E, 0x1C, 0x5B, 0x11, 0x2B, 0x78, 0x94, 0xBC, 0xFC, 0x69, 0x7C, 0xD7,
+ 0xD2, 0x82, 0x22, 0x32, 0xCB, 0xAC, 0x06, 0xBE, 0x84, 0xFD, 0xA0, 0x5D, 0xA2, 0x80, 0x48, 0xDF, 0xA7, 0xC7, 0xC1, 0x6F, 0x16, 0x9D, 0xD0, 0xA6, 0xC2,
+ 0x40, 0x75, 0x92, 0xFE, 0xE6, 0x85, 0x12, 0x01, 0xE3, 0x7D, 0x36, 0x52, 0xB7, 0xEF, 0x0B, 0x62, 0x96, 0x42, 0xE0, 0x72, 0xA5, 0xF9, 0x74, 0xFB, 0xE6,
+ 0xB5, 0xC2, 0x10, 0x4C, 0x0A, 0x1E, 0x55, 0x4C, 0x96, 0x07, 0xD6, 0xC0, 0x64, 0x14, 0x86, 0x95, 0x35, 0xE5, 0x1B, 0xB7, 0x94, 0x3A, 0xFD, 0x47, 0x62,
+ 0x65, 0x56 };
+ public static byte[] dsaJ = { 0x00, 0x00, 0x00, 0x01, 0x0E, 0x8B, 0x4A, 0xE4, 0x62, 0x61, 0xDB, 0x28, 0x71, 0x9E, 0xAB, 0x83, 0x2A, 0x88, 0x3A, 0x91, 0x35, 0xFE, 0xE0, 0x8E, 0xD4, 0xF7,
+ 0xC4, 0x9F, 0xBE, 0x7C, 0x2E, 0x0D, 0x95, 0x5B, 0xA3, 0x87, 0x25, 0x36, 0x07, 0x34, 0x2D, 0xF4, 0xB3, 0x48, 0x12, 0x4C, 0x6F, 0xC9, 0xB7, 0x7A, 0x07,
+ 0x61, 0x7F, 0x92, 0xF2, 0xFA, 0xED, 0x35, 0x86, 0xFC, 0x91, 0x12, 0x7F, 0x8A, 0x98, 0x1C, 0xA1, 0xF1, 0xAA, 0xD9, 0x0A, 0x3F, 0x71, 0x82, 0x8F, 0xED,
+ 0x15, 0xF6, 0x2B, 0xA1, 0x09, 0xC1, 0x27, 0xD6, 0x22, 0x78, 0x6C, 0x34, 0xCA, 0xF5, 0x26, 0x6C, 0xEE, 0x2B, 0x49, 0x54, 0x2A, 0x45, 0xD7, 0x5D, 0x5A,
+ 0x35, 0xE5, 0xF2, 0xFC, 0x3B, 0x6F, 0xF5, 0xEA, 0xE1, 0x16, 0x32 };
+ public static byte[] dsaP = { 0xB3, 0xF3, 0x9C, 0xD2, 0xDE, 0x20, 0x8F, 0x43, 0x51, 0xAA, 0x40, 0x8A, 0x8B, 0x8C, 0xA7, 0x26, 0x73, 0x80, 0x12, 0xE9, 0x0D, 0x86, 0x39, 0x07, 0x24, 0xF3,
+ 0xB3, 0x36, 0xC1, 0xCF, 0xEB, 0xD9, 0x32, 0x1C, 0xC5, 0x30, 0x67, 0x70, 0x33, 0x3A, 0x42, 0xC6, 0x60, 0xE5, 0xA5, 0x3A, 0x8D, 0xB3, 0x95, 0x82, 0xB3,
+ 0x49, 0xB6, 0x72, 0x80, 0x30, 0xC8, 0xE5, 0xD0, 0x96, 0x03, 0x98, 0x10, 0x17, 0x66, 0x46, 0x1C, 0x45, 0x25, 0x58, 0x93, 0x20, 0x53, 0x21, 0xE6, 0x93,
+ 0x26, 0xCE, 0x8B, 0x8E, 0x1C, 0xC8, 0x76, 0x97, 0xF7, 0x27, 0x86, 0x7D, 0xB9, 0xE8, 0x73, 0x7C, 0x45, 0xF6, 0xC6, 0x20, 0x90, 0x0D, 0xEF, 0x3D, 0x46,
+ 0x5A, 0x26, 0xE6, 0x0C, 0x3A, 0xC0, 0x69, 0xDE, 0x9C, 0x8F, 0x75, 0xE3, 0x7C, 0xFE, 0x62, 0xD4, 0xF2, 0x7D, 0x22, 0xBD, 0x44, 0x72, 0x3F, 0xED, 0xC6,
+ 0x7B, 0xD3 };
+ public static byte[] dsaQ = { 0xAA, 0x47, 0x13, 0x5B, 0xE0, 0x9E, 0xD0, 0xBE, 0x64, 0xF0, 0xE1, 0x93, 0x50, 0xC9, 0x11, 0xA0, 0x62, 0x83, 0x73, 0x51 };
+ public static byte[] dsaX = { 0x7C, 0x03, 0xB2, 0xB5, 0x9B, 0x6D, 0x51, 0x91, 0x73, 0xB7, 0xF0, 0x2F, 0xC1, 0x18, 0xA7, 0x9A, 0xF6, 0x0A, 0x2F, 0xB1 };
+ public static byte[] dsaY = { 0xB2, 0x12, 0x51, 0x51, 0xD1, 0xB1, 0x11, 0x8C, 0x52, 0x28, 0xCE, 0x49, 0x56, 0x89, 0x7D, 0x1C, 0x07, 0x50, 0xC0, 0x82, 0xBE, 0xC0, 0x5F, 0x57, 0xE2, 0x7F,
+ 0x52, 0x00, 0x3F, 0xBE, 0xBD, 0xF6, 0x4E, 0x30, 0xE6, 0x22, 0xF8, 0xCD, 0x72, 0xBA, 0xF4, 0x00, 0x95, 0x0B, 0xE7, 0x4A, 0x54, 0xD3, 0x5A, 0xBE, 0xC2,
+ 0x64, 0xF4, 0x55, 0x00, 0x80, 0x8B, 0x80, 0x30, 0x5B, 0xAA, 0x2F, 0x62, 0x37, 0xE2, 0x1D, 0xEB, 0x47, 0x1C, 0x27, 0xE8, 0x70, 0xDE, 0x91, 0x83, 0x7C,
+ 0xBA, 0x49, 0xEC, 0x87, 0x45, 0x3E, 0xCC, 0xC9, 0x11, 0xE5, 0x0E, 0xF9, 0x26, 0x41, 0xC1, 0xFF, 0x27, 0x8C, 0x65, 0xD4, 0x2E, 0xA4, 0x8E, 0x0E, 0xCF,
+ 0xCD, 0x4D, 0xC8, 0xA2, 0x5F, 0xB1, 0x34, 0xEE, 0xB9, 0xBE, 0x29, 0xF9, 0x71, 0x14, 0xE8, 0x34, 0xAA, 0xD5, 0x80, 0x86, 0x66, 0x0B, 0xC4, 0x89, 0x03,
+ 0xC7, 0xBB };
+ public static int dsaCounter = 224;
+ public static byte[] dsaSeed = { 0xB9, 0x83, 0x39, 0x6F, 0x6D, 0x25, 0xBA, 0xF6, 0xEE, 0xC9, 0xEB, 0xE2, 0xF5, 0x35, 0xC7, 0xC1, 0xE9, 0x1B, 0xAF, 0x9B };
+
+ static public DSAParameters GetKey (bool includePrivateKey)
+ {
+ DSAParameters p = new DSAParameters();
+ p.Counter = dsaCounter;
+ p.G = (byte[]) dsaG.Clone ();
+ p.J = (byte[]) dsaJ.Clone ();
+ p.P = (byte[]) dsaP.Clone ();
+ p.Q = (byte[]) dsaQ.Clone ();
+ p.Seed = (byte[]) dsaSeed.Clone ();
+ p.Y = (byte[]) dsaY.Clone ();
+ if (includePrivateKey)
+ p.X = (byte[]) dsaX.Clone ();
+ else
+ p.X = null;
+ return p;
+ }
+
+ static byte[] rsaModulus = { 0xbb, 0xf8, 0x2f, 0x09, 0x06, 0x82, 0xce, 0x9c, 0x23, 0x38, 0xac, 0x2b, 0x9d, 0xa8, 0x71, 0xf7,
+ 0x36, 0x8d, 0x07, 0xee, 0xd4, 0x10, 0x43, 0xa4, 0x40, 0xd6, 0xb6, 0xf0, 0x74, 0x54, 0xf5, 0x1f,
+ 0xb8, 0xdf, 0xba, 0xaf, 0x03, 0x5c, 0x02, 0xab, 0x61, 0xea, 0x48, 0xce, 0xeb, 0x6f, 0xcd, 0x48,
+ 0x76, 0xed, 0x52, 0x0d, 0x60, 0xe1, 0xec, 0x46, 0x19, 0x71, 0x9d, 0x8a, 0x5b, 0x8b, 0x80, 0x7f,
+ 0xaf, 0xb8, 0xe0, 0xa3, 0xdf, 0xc7, 0x37, 0x72, 0x3e, 0xe6, 0xb4, 0xb7, 0xd9, 0x3a, 0x25, 0x84,
+ 0xee, 0x6a, 0x64, 0x9d, 0x06, 0x09, 0x53, 0x74, 0x88, 0x34, 0xb2, 0x45, 0x45, 0x98, 0x39, 0x4e,
+ 0xe0, 0xaa, 0xb1, 0x2d, 0x7b, 0x61, 0xa5, 0x1f, 0x52, 0x7a, 0x9a, 0x41, 0xf6, 0xc1, 0x68, 0x7f,
+ 0xe2, 0x53, 0x72, 0x98, 0xca, 0x2a, 0x8f, 0x59, 0x46, 0xf8, 0xe5, 0xfd, 0x09, 0x1d, 0xbd, 0xcb };
+ static byte[] rsaExponent = { 0x11 };
+ static byte[] rsaP = { 0xee, 0xcf, 0xae, 0x81, 0xb1, 0xb9, 0xb3, 0xc9, 0x08, 0x81, 0x0b, 0x10, 0xa1, 0xb5, 0x60, 0x01,
+ 0x99, 0xeb, 0x9f, 0x44, 0xae, 0xf4, 0xfd, 0xa4, 0x93, 0xb8, 0x1a, 0x9e, 0x3d, 0x84, 0xf6, 0x32,
+ 0x12, 0x4e, 0xf0, 0x23, 0x6e, 0x5d, 0x1e, 0x3b, 0x7e, 0x28, 0xfa, 0xe7, 0xaa, 0x04, 0x0a, 0x2d,
+ 0x5b, 0x25, 0x21, 0x76, 0x45, 0x9d, 0x1f, 0x39, 0x75, 0x41, 0xba, 0x2a, 0x58, 0xfb, 0x65, 0x99 };
+ static byte[] rsaQ = { 0xc9, 0x7f, 0xb1, 0xf0, 0x27, 0xf4, 0x53, 0xf6, 0x34, 0x12, 0x33, 0xea, 0xaa, 0xd1, 0xd9, 0x35,
+ 0x3f, 0x6c, 0x42, 0xd0, 0x88, 0x66, 0xb1, 0xd0, 0x5a, 0x0f, 0x20, 0x35, 0x02, 0x8b, 0x9d, 0x86,
+ 0x98, 0x40, 0xb4, 0x16, 0x66, 0xb4, 0x2e, 0x92, 0xea, 0x0d, 0xa3, 0xb4, 0x32, 0x04, 0xb5, 0xcf,
+ 0xce, 0x33, 0x52, 0x52, 0x4d, 0x04, 0x16, 0xa5, 0xa4, 0x41, 0xe7, 0x00, 0xaf, 0x46, 0x15, 0x03 };
+ static byte[] rsaDP = { 0x54, 0x49, 0x4c, 0xa6, 0x3e, 0xba, 0x03, 0x37, 0xe4, 0xe2, 0x40, 0x23, 0xfc, 0xd6, 0x9a, 0x5a,
+ 0xeb, 0x07, 0xdd, 0xdc, 0x01, 0x83, 0xa4, 0xd0, 0xac, 0x9b, 0x54, 0xb0, 0x51, 0xf2, 0xb1, 0x3e,
+ 0xd9, 0x49, 0x09, 0x75, 0xea, 0xb7, 0x74, 0x14, 0xff, 0x59, 0xc1, 0xf7, 0x69, 0x2e, 0x9a, 0x2e,
+ 0x20, 0x2b, 0x38, 0xfc, 0x91, 0x0a, 0x47, 0x41, 0x74, 0xad, 0xc9, 0x3c, 0x1f, 0x67, 0xc9, 0x81 };
+ static byte[] rsaDQ = { 0x47, 0x1e, 0x02, 0x90, 0xff, 0x0a, 0xf0, 0x75, 0x03, 0x51, 0xb7, 0xf8, 0x78, 0x86, 0x4c, 0xa9,
+ 0x61, 0xad, 0xbd, 0x3a, 0x8a, 0x7e, 0x99, 0x1c, 0x5c, 0x05, 0x56, 0xa9, 0x4c, 0x31, 0x46, 0xa7,
+ 0xf9, 0x80, 0x3f, 0x8f, 0x6f, 0x8a, 0xe3, 0x42, 0xe9, 0x31, 0xfd, 0x8a, 0xe4, 0x7a, 0x22, 0x0d,
+ 0x1b, 0x99, 0xa4, 0x95, 0x84, 0x98, 0x07, 0xfe, 0x39, 0xf9, 0x24, 0x5a, 0x98, 0x36, 0xda, 0x3d };
+ static byte[] rsaInverseQ = { 0xb0, 0x6c, 0x4f, 0xda, 0xbb, 0x63, 0x01, 0x19, 0x8d, 0x26, 0x5b, 0xdb, 0xae, 0x94, 0x23, 0xb3,
+ 0x80, 0xf2, 0x71, 0xf7, 0x34, 0x53, 0x88, 0x50, 0x93, 0x07, 0x7f, 0xcd, 0x39, 0xe2, 0x11, 0x9f,
+ 0xc9, 0x86, 0x32, 0x15, 0x4f, 0x58, 0x83, 0xb1, 0x67, 0xa9, 0x67, 0xbf, 0x40, 0x2b, 0x4e, 0x9e,
+ 0x2e, 0x0f, 0x96, 0x56, 0xe6, 0x98, 0xea, 0x36, 0x66, 0xed, 0xfb, 0x25, 0x79, 0x80, 0x39, 0xf7 };
+ static byte[] rsaD = { 0xa5, 0xda, 0xfc, 0x53, 0x41, 0xfa, 0xf2, 0x89, 0xc4, 0xb9, 0x88, 0xdb, 0x30, 0xc1, 0xcd, 0xf8,
+ 0x3f, 0x31, 0x25, 0x1e, 0x06, 0x68, 0xb4, 0x27, 0x84, 0x81, 0x38, 0x01, 0x57, 0x96, 0x41, 0xb2,
+ 0x94, 0x10, 0xb3, 0xc7, 0x99, 0x8d, 0x6b, 0xc4, 0x65, 0x74, 0x5e, 0x5c, 0x39, 0x26, 0x69, 0xd6,
+ 0x87, 0x0d, 0xa2, 0xc0, 0x82, 0xa9, 0x39, 0xe3, 0x7f, 0xdc, 0xb8, 0x2e, 0xc9, 0x3e, 0xda, 0xc9,
+ 0x7f, 0xf3, 0xad, 0x59, 0x50, 0xac, 0xcf, 0xbc, 0x11, 0x1c, 0x76, 0xf1, 0xa9, 0x52, 0x94, 0x44,
+ 0xe5, 0x6a, 0xaf, 0x68, 0xc5, 0x6c, 0x09, 0x2c, 0xd3, 0x8d, 0xc3, 0xbe, 0xf5, 0xd2, 0x0a, 0x93,
+ 0x99, 0x26, 0xed, 0x4f, 0x74, 0xa1, 0x3e, 0xdd, 0xfb, 0xe1, 0xa1, 0xce, 0xcc, 0x48, 0x94, 0xaf,
+ 0x94, 0x28, 0xc2, 0xb7, 0xb8, 0x88, 0x3f, 0xe4, 0x46, 0x3a, 0x4b, 0xc8, 0x5b, 0x1c, 0xb3, 0xc1 };
+
+ static public RSAParameters GetRsaKey (bool includePrivateKey)
+ {
+ RSAParameters p = new RSAParameters();
+ if (includePrivateKey) {
+ p.D = (byte[]) rsaD.Clone();
+ p.DP = (byte[]) rsaDP.Clone();
+ p.DQ = (byte[]) rsaDQ.Clone();
+ p.P = (byte[]) rsaP.Clone();
+ p.Q = (byte[]) rsaQ.Clone();
+ p.InverseQ = (byte[]) rsaInverseQ.Clone();
+ }
+ else {
+ p.D = null;
+ p.DP = null;
+ p.DQ = null;
+ p.P = null;
+ p.Q = null;
+ p.InverseQ = null;
+ }
+ p.Modulus = (byte[]) rsaModulus.Clone();
+ p.Exponent = (byte[]) rsaExponent.Clone();
+ return p;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs
new file mode 100755
index 00000000000..eed1fc5196c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs
@@ -0,0 +1,40 @@
+//
+// TestSuite.System.Security.Cryptography.AsymmetricAlgorithmTest.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class AsymmetricAlgorithmTest : TestCase {
+ private AsymmetricAlgorithm _algo;
+ protected override void SetUp() {
+ _algo = AsymmetricAlgorithm.Create();
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestProperties() {
+ Assert("Properties (1)", _algo != null);
+
+ bool thrown = false;
+ try {
+ KeySizes[] keys = _algo.LegalKeySizes;
+ foreach (KeySizes myKey in keys) {
+ for (int i=myKey.MinSize; i<=myKey.MaxSize; i+=myKey.SkipSize) {
+ _algo.KeySize = i;
+ }
+ }
+ } catch (CryptographicException) {thrown=true;}
+ Assert("Properties (2)", !thrown);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
new file mode 100644
index 00000000000..dde7934ddbd
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
@@ -0,0 +1,170 @@
+2003-01-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * HMACSHA1Test.cs: Added tests for constructors.
+ * MACTripleDESTest.cs: Added tests for constructors.
+
+2003-01-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * HashAlgorithmTest.cs: Added new test for null streams.
+ * MACTripleDESTest.cs: New. Test suite par MAC using 3DES.
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests2.cs: Helper file for unit tests
+
+2002-11-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * RSAPKCS1SignatureDeformatterTest.cs: Removed patch from Nick -
+ as it doesn't seems to work on my system and the exception behavior
+ isn't logical (only MD5 not SHA1, ...).
+
+2002-11-18 Nick Drochak <ndrochak@gol.com>
+
+ * RSAPKCS1SignatureDeformatterTest.cs: MS .NET throws an exception when
+ verifying a bad signature. Test for that.
+
+2002-11-17 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added a common RSA keypair for tests and all RSA
+ suites for new tests.
+ * RSACryptoServiceProviderTest.cs: Include tests for keygen,
+ import/export and signature (no encryption yet).
+ * RSAOAEPKeyExchangeDeformatterTest.cs: Compare results with
+ pre-generated vectors from Mono/Windows (cannot yet compare
+ with CryptoAPI/Windows as OAEP isn't available on my system).
+ * RSAOAEPKeyExchangeFormatterTest.cs: Test that the Formatter output
+ is compatible with the Deformatter.
+ * RSAPKCS1KeyExchangeDeformatterTest.cs: Compare results with
+ pre-generated vectors from Mono/Windows and CryptoAPI/Windows.
+ * RSAPKCS1KeyExchangeFormatterTest.cs: Test that the Formatter output
+ is compatible with the Deformatter.
+ * RSAPKCS1SignatureDeformatterTest.cs: Compare results with
+ pre-generated vectors from Mono/Windows and CryptoAPI/Windows.
+ * RSAPKCS1SignatureFormatterTest.cs: Test that the Formatter output
+ is compatible with the Deformatter.
+
+2002-11-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suites for DSASignatureDeformatter,
+ DSASignatureFormatter.
+ * CryptoConfigTest.cs: Tests new URLs. This test will fail
+ if System.Security.dll isn't present (or not yet compiled).
+ * DSACryptoServiceProviderTest.cs: New. Key generation (limited
+ because it's too slow), Import/Export, Signature and Verification.
+ * DSASignatureDeformatterTest.cs: New. Test signature verification.
+ * DSASignatureFormatterTest.cs: New. Test signature creation.
+ * DSATest.cs: Comment DSA-derived test class as DSA constructor
+ is internal. Reworked the test suite.
+ * SignatureDescriptionTest.cs: Added tests for
+ DSASignatureDescription and RSAPKCS1SHA1SignatureDescription.
+
+2002-11-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suites for SignatureDescription and
+ activated suites for SHA384Managed and SHA512Managed.
+ * SignatureDescriptionTest.cs: New. Basic tests (because I don't
+ know the context in which the class is used).
+
+2002-10-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added test suites for SHA256, SHA384 and SHA512
+ (last two partly commented until implementation is commited).
+ * SHA256Test.cs: New. Generic FIPS180-2 tests for SHA-256.
+ * SHA256ManagedTest.cs: New. Implementation tests (inherits
+ from SHA256Test).
+ * SHA384Test.cs: New. Generic FIPS180-2 tests for SHA-384.
+ * SHA384ManagedTest.cs: New. Implementation tests (inherits
+ from SHA384Test).
+ * SHA512Test.cs: New. Generic FIPS180-2 tests for SHA-512.
+ * SHA512ManagedTest.cs: New. Implementation tests (inherits
+ from SHA512Test).
+
+2002-10-25 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suite for PasswordDeriveBytes
+ * PasswordDeriveBytesTest.cs: New. Tests against pre-generated vectors -
+ only works for short runs (keys < HashSize) not long runs
+
+2002-10-20 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suite for Rjindael
+ * RjindaelTest.cs: New. Test vectors from FIPS PUB 197 appendix.
+
+2002-10-19 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Renabled most tests after commenting all code causing a
+ cyclic dependency (corlib->System.Xml->corlib). Some tests will fail
+ until commented code is replaced.
+ * SymmetricAlgorithm.cs: New (189) generated test cases for all default
+ algorithm implementation, all cipher modes, all padding modes, all key
+ sizes, all block sizes, feedback...
+ * PKCS1MaskGenerationMethodTest.cs: Commented vector test. Added new
+ tests to check for various exceptions
+
+2002-10-16 Nick Drochak <ndrochak@gol.com>
+
+ * CryptoConfigTest.cs (TestCreateFromName): Disable tests for
+ algorithms that aren't in the build yet.
+
+2002-10-16 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Disable tests that use components were are excluding
+ from corlib.
+ * SHA1Test.cs: same
+
+2002-10-14 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suite for PKCS1MaskGenerationMethod
+ * PKCS1MaskGenerationMethodTest.cs: New. Test work as per PKCS#1 but
+ result isn't the same as MS implementation !?! is MS using this class ?
+
+2002-10-13 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suite for HashAlgorithm, KeyedHashAlgorithm and
+ HMACSHA1
+ * HashAlgorithmTest.cs: New. Test for Create and Clear
+ * KeyedHashAlgorithmTest.cs: New. Test for Create and key assignation
+ * HMACSHA1Test.cs: New. Test vectors from FIPS 198 and RFC2202
+
+2002-10-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added suite for RandomNumberGenerator, SHA1 and
+ SHA1CryptoServiceProvider
+ * RandomNumberGeneratorTest.cs: New. Tests for Create and generic
+ random quality tests (FIPS140-2)
+ * SHA1Test.cs: New. Tests for Create and generic SHA1 tests (FIPS180-1)
+ * SHA1CryptoServiceProviderTest.cs: New. Inherited SHA1Tests tests +
+ specific tests
+
+2002-10-10 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DSATest.cs: Added non-abstract DSA class to test To/FromXmlString()
+ * RSATest.cs: Added non-abstract RSA class to test To/FromXmlString()
+ * AllTests.cs: Added DSATest.cs and RSATest.cs in suite
+
+2002-10-09 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoConfigTest.cs: New tests
+ * AllTests.cs: Added CryptoConfigTest in suite
+
+2002-10-05 Andrew Birkett <andy@nobugs.org>
+
+ * RC2Test.cs: New test. Only three cases are enabled - the other
+ five work fine under mono, but fail under MS corlib, so I've
+ commented them out.
+
+ * AllTests.cs: Added RC2Test.
+
+2002-09-23 Andrew Birkett <andy@nobugs.org>
+
+ * RijndaelManagedTest.cs: Fixed initialization order problem
+ to match MS behaviour.
+
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MD5Test.cs: new test from Eduardo García Cebollero (kiwnix@yahoo.es).
+ * AllTests.cs: added new test.
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
new file mode 100644
index 00000000000..c8631dcb054
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
@@ -0,0 +1,291 @@
+//
+// CryptoConfigTest.cs - NUnit Test Cases for CryptoConfig
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+public class CryptoConfigTest : TestCase
+{
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ void CreateFromName (string name, string objectname)
+ {
+ object o = CryptoConfig.CreateFromName (name);
+ if (objectname == null)
+ AssertNull(name, o);
+ else
+ AssertEquals (name, o.ToString(), objectname);
+ }
+
+ // validate that CryptoConfig create the exact same implementation between mono and MS
+ public void TestCreateFromName ()
+ {
+ try {
+ object o = CryptoConfig.CreateFromName (null);
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("ArgumentNullException not thrown: " + e.ToString());
+ }
+ CreateFromName ("SHA", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+ // FIXME: We need to support the machine.config file to get exact same results
+ // with the MS .NET Framework
+ CreateFromName ("SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+ CreateFromName( "System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+ // after installing the WSDK - changes to the machine.config file (not documented)
+// CreateFromName ("SHA1", "System.Security.Cryptography.SHA1Managed");
+// CreateFromName ("System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1Managed");
+ CreateFromName ("System.Security.Cryptography.HashAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.SHA1CryptoServiceProvider", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+ CreateFromName ("MD5", "System.Security.Cryptography.MD5CryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.MD5", "System.Security.Cryptography.MD5CryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.MD5CryptoServiceProvider", "System.Security.Cryptography.MD5CryptoServiceProvider");
+ CreateFromName ("SHA256", "System.Security.Cryptography.SHA256Managed");
+ CreateFromName ("SHA-256", "System.Security.Cryptography.SHA256Managed");
+ CreateFromName ("System.Security.Cryptography.SHA256", "System.Security.Cryptography.SHA256Managed");
+ CreateFromName ("SHA384", "System.Security.Cryptography.SHA384Managed");
+ CreateFromName ("SHA-384", "System.Security.Cryptography.SHA384Managed");
+ CreateFromName ("System.Security.Cryptography.SHA384", "System.Security.Cryptography.SHA384Managed");
+ CreateFromName ("SHA512", "System.Security.Cryptography.SHA512Managed");
+ CreateFromName ("SHA-512", "System.Security.Cryptography.SHA512Managed");
+ CreateFromName ("System.Security.Cryptography.SHA512", "System.Security.Cryptography.SHA512Managed");
+ CreateFromName ("RSA", "System.Security.Cryptography.RSACryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.RSA", "System.Security.Cryptography.RSACryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.AsymmetricAlgorithm", "System.Security.Cryptography.RSACryptoServiceProvider");
+ CreateFromName ("DSA", "System.Security.Cryptography.DSACryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.DSA", "System.Security.Cryptography.DSACryptoServiceProvider");
+ CreateFromName ("DES", "System.Security.Cryptography.DESCryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.DES", "System.Security.Cryptography.DESCryptoServiceProvider");
+ CreateFromName ("3DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
+ CreateFromName ("TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
+ CreateFromName ("Triple DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
+ // LAMESPEC SymmetricAlgorithm documented as TripleDESCryptoServiceProvider
+ CreateFromName ("System.Security.Cryptography.SymmetricAlgorithm", "System.Security.Cryptography.RijndaelManaged");
+ CreateFromName ("RC2", "System.Security.Cryptography.RC2CryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.RC2", "System.Security.Cryptography.RC2CryptoServiceProvider");
+ CreateFromName ("Rijndael", "System.Security.Cryptography.RijndaelManaged");
+ CreateFromName ("System.Security.Cryptography.Rijndael", "System.Security.Cryptography.RijndaelManaged");
+ // LAMESPEC Undocumented Names in CryptoConfig
+ CreateFromName ("RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider");
+ CreateFromName ("System.Security.Cryptography.KeyedHashAlgorithm", "System.Security.Cryptography.HMACSHA1");
+ CreateFromName ("HMACSHA1", "System.Security.Cryptography.HMACSHA1");
+ CreateFromName ("System.Security.Cryptography.HMACSHA1", "System.Security.Cryptography.HMACSHA1");
+ CreateFromName ("MACTripleDES", "System.Security.Cryptography.MACTripleDES");
+ CreateFromName ("System.Security.Cryptography.MACTripleDES", "System.Security.Cryptography.MACTripleDES");
+ // note: CryptoConfig can create any object !
+ CreateFromName ("System.Security.Cryptography.CryptoConfig", "System.Security.Cryptography.CryptoConfig");
+ CreateFromName ("System.IO.MemoryStream", "System.IO.MemoryStream");
+ // non existing algo should return null (without exception)
+ AssertNull ("NonExistingAlgorithm", CryptoConfig.CreateFromName("NonExistingAlgorithm"));
+ }
+
+ // additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml)
+ // URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/
+ public void TestCreateFromURL ()
+ {
+ // URL used in SignatureMethod element
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription");
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription");
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", null);
+ // URL used in DigestMethod element
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
+ // URL used in Canonicalization or Transform elements
+ CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", "System.Security.Cryptography.Xml.XmlDsigC14NTransform");
+ CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", "System.Security.Cryptography.Xml.XmlDsigC14NWithCommentsTransform");
+ // URL used in Transform element
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#base64", "System.Security.Cryptography.Xml.XmlDsigBase64Transform");
+ // after installing the WSDK - changes to the machine.config file (not documented)
+// CreateFromName ("http://www.w3.org/TR/1999/REC-xpath-19991116", "Microsoft.WSDK.Security.XmlDsigXPathTransform");
+ CreateFromName ("http://www.w3.org/TR/1999/REC-xpath-19991116", "System.Security.Cryptography.Xml.XmlDsigXPathTransform");
+ CreateFromName ("http://www.w3.org/TR/1999/REC-xslt-19991116", "System.Security.Cryptography.Xml.XmlDsigXsltTransform");
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#enveloped-signature", "System.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform");
+ // URL used in Reference element
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#Object", null);
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#Manifest", null);
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#SignatureProperties", null);
+ // URL used in RetrievalMethod or Reference elements
+ CreateFromName ("http://www.w3.org/2000/09/xmldsig#X509Data", null);
+ }
+
+ // Tests created using "A Layer Man Guide to ASN.1" from RSA, page 19-20
+ // Need to find an OID ? goto http://www.alvestrand.no/~hta/objectid/top.html
+ static byte[] oidETSI = { 0x06, 0x03, 0x04, 0x00, 0x00 };
+ static byte[] oidSHA1 = { 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A };
+ static byte[] oidASN1CharacterModule = { 0x06, 0x04, 0x51, 0x00, 0x00, 0x00 };
+ static byte[] oidmd5withRSAEncryption = { 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04 };
+
+ // LAMESPEC NullReferenceException is thrown (not ArgumentNullException) if parameter is NULL
+ public void TestEncodeOID ()
+ {
+ try {
+ byte[] o = CryptoConfig.EncodeOID (null);
+ }
+ catch (NullReferenceException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("NullReferenceException not thrown: " + e.ToString());
+ }
+ // OID starts with 0, 1 or 2
+ AssertEquals ("OID starting with 0.", oidETSI, CryptoConfig.EncodeOID ("0.4.0.0"));
+ AssertEquals ("OID starting with 1.", oidSHA1, CryptoConfig.EncodeOID ("1.3.14.3.2.26"));
+ AssertEquals ("OID starting with 2.", oidASN1CharacterModule, CryptoConfig.EncodeOID ("2.1.0.0.0"));
+ // OID numbers can span multiple bytes
+ AssertEquals ("OID with numbers spanning multiple bytes", oidmd5withRSAEncryption, CryptoConfig.EncodeOID ("1.2.840.113549.1.1.4"));
+
+ // "ms"-invalid OID - greater than 127 bytes (length encoding)
+ // OID longer than 127 bytes (so length must be encoded on multiple bytes)
+ // LAMESPEC: OID greater that 0x7F (127) bytes aren't supported by the MS Framework
+ string baseOID = "1.3.6.1.4.1.11071.0.";
+ string lastPart = "1111111111"; // must fit in int32
+ for (int i = 1; i < 30; i++)
+ {
+ baseOID += lastPart + ".";
+ }
+ baseOID += "0";
+ try {
+ byte[] tooLongOID = CryptoConfig.EncodeOID (baseOID);
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("CryptographicUnexpectedOperationException not thrown: " + e.ToString());
+ }
+
+ // "ms"-invalid OID - where a number of the OID > Int32
+ // LAMESPEC: OID with numbers > Int32 aren't supported by the MS BCL
+ try {
+ byte[] tooLongOID = CryptoConfig.EncodeOID ("1.1.4294967295");
+ }
+ catch (OverflowException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail( "OverflowException not thrown: " + e.ToString ());
+ }
+
+ // invalid OID - must start with 0, 1 or 2
+ // however it works with MS BCL
+ byte[] oid3 = CryptoConfig.EncodeOID ("3.0");
+ byte[] res3 = { 0x06, 0x01, 0x78 };
+ AssertEquals ("OID: 3.0", res3, oid3);
+
+ // invalid OID - must have at least 2 parts (according to X.208)
+ try {
+ byte[] tooShortOID = CryptoConfig.EncodeOID ("0");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail("CryptographicUnexpectedOperationException not thrown: " + e.ToString());
+ }
+
+ // invalid OID - second value < 40 for 0. and 1. (modulo 40)
+ // however it works with MS BCL
+ byte[] tooBigSecondPartOID = CryptoConfig.EncodeOID ("0.40");
+ byte[] tooBigSecondPartRes = { 0x06, 0x01, 0x28 };
+ AssertEquals ("OID: 0.40", tooBigSecondPartRes, tooBigSecondPartOID);
+ }
+
+ private void MapNameToOID (string name, string oid)
+ {
+ AssertEquals ("oid(" + name + ")", oid, CryptoConfig.MapNameToOID (name));
+ }
+
+ // LAMESPEC: doesn't support all names defined in CryptoConfig
+ // non supported names (in MSFW) are commented or null-ed
+ // LAMESPEC: undocumented but full class name is supported
+ public void TestMapNameToOID()
+ {
+ try {
+ CryptoConfig.MapNameToOID (null);
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail( "ArgumentNullException not thrown: " + e.ToString ());
+ }
+// MapNameToOID ("SHA", "1.3.14.3.2.26");
+ MapNameToOID ("SHA1", "1.3.14.3.2.26");
+ MapNameToOID ("System.Security.Cryptography.SHA1", "1.3.14.3.2.26");
+// MapNameToOID ("System.Security.Cryptography.HashAlgorithm", "1.3.14.3.2.26");
+ MapNameToOID ("System.Security.Cryptography.SHA1CryptoServiceProvider", "1.3.14.3.2.26");
+ MapNameToOID ("System.Security.Cryptography.SHA1Managed", "1.3.14.3.2.26");
+ MapNameToOID ("MD5", "1.2.840.113549.2.5");
+ MapNameToOID ("System.Security.Cryptography.MD5", "1.2.840.113549.2.5");
+ MapNameToOID ("System.Security.Cryptography.MD5CryptoServiceProvider", "1.2.840.113549.2.5");
+ MapNameToOID ("SHA256", "2.16.840.1.101.3.4.1");
+// MapNameToOID ("SHA-256", "2.16.840.1.101.3.4.1");
+ MapNameToOID ("System.Security.Cryptography.SHA256", "2.16.840.1.101.3.4.1");
+ MapNameToOID ("System.Security.Cryptography.SHA256Managed", "2.16.840.1.101.3.4.1");
+ MapNameToOID ("SHA384", "2.16.840.1.101.3.4.2");
+// MapNameToOID ("SHA-384", "2.16.840.1.101.3.4.2");
+ MapNameToOID ("System.Security.Cryptography.SHA384", "2.16.840.1.101.3.4.2");
+ MapNameToOID ("System.Security.Cryptography.SHA384Managed", "2.16.840.1.101.3.4.2");
+ MapNameToOID ("SHA512", "2.16.840.1.101.3.4.3");
+// MapNameToOID ("SHA-512", "2.16.840.1.101.3.4.3");
+ MapNameToOID ("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.3");
+ MapNameToOID ("System.Security.Cryptography.SHA512Managed", "2.16.840.1.101.3.4.3");
+ // no OID defined ?
+ MapNameToOID ("RSA", null);
+ MapNameToOID ("System.Security.Cryptography.RSA", null);
+ MapNameToOID ("System.Security.Cryptography.AsymmetricAlgorithm", null);
+ MapNameToOID ("DSA", null);
+ MapNameToOID ("System.Security.Cryptography.DSA", null);
+ MapNameToOID ("DES", null);
+ MapNameToOID ("System.Security.Cryptography.DES", null);
+ MapNameToOID ("3DES", null);
+ MapNameToOID ("TripleDES", null);
+ MapNameToOID ("Triple DES", null);
+ MapNameToOID ("System.Security.Cryptography.TripleDES", null);
+ MapNameToOID ("RC2", null);
+ MapNameToOID ("System.Security.Cryptography.RC2", null);
+ MapNameToOID ("Rijndael", null);
+ MapNameToOID ("System.Security.Cryptography.Rijndael", null);
+ MapNameToOID ("System.Security.Cryptography.SymmetricAlgorithm", null);
+ // LAMESPEC Undocumented Names in CryptoConfig
+ MapNameToOID ("RandomNumberGenerator", null);
+ MapNameToOID ("System.Security.Cryptography.RandomNumberGenerator", null);
+ MapNameToOID ("System.Security.Cryptography.KeyedHashAlgorithm", null);
+ MapNameToOID ("HMACSHA1", null);
+ MapNameToOID ("System.Security.Cryptography.HMACSHA1", null);
+ MapNameToOID ("MACTripleDES", null);
+ MapNameToOID ("System.Security.Cryptography.MACTripleDES", null);
+ // non existing algo should return null (without exception)
+ MapNameToOID ("NonExistingAlgorithm", null);
+ }
+
+ public void TestToString()
+ {
+ // under normal circumstance there are no need to create a CryptoConfig object
+ // because all interesting stuff are in static methods
+ CryptoConfig cc = new CryptoConfig ();
+ AssertEquals ("System.Security.Cryptography.CryptoConfig", cc.ToString ());
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/DSACryptoServiceProviderTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/DSACryptoServiceProviderTest.cs
new file mode 100644
index 00000000000..b5b182d14f9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/DSACryptoServiceProviderTest.cs
@@ -0,0 +1,389 @@
+//
+// DSACryptoServiceProviderTest.cs, NUnit Test Cases for DSACryptoServiceProvider
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class DSACryptoServiceProviderTest : TestCase {
+ protected DSA dsa;
+
+// static string xmlPrivate = "<DSAKeyValue><P>s/Oc0t4gj0NRqkCKi4ynJnOAEukNhjkHJPOzNsHP69kyHMUwZ3AzOkLGYOWlOo2zlYKzSbZygDDI5dCWA5gQF2ZGHEUlWJMgUyHmkybOi44cyHaX9yeGfbnoc3xF9sYgkA3vPUZaJuYMOsBp3pyPdeN8/mLU8n0ivURyP+3Ge9M=</P><Q>qkcTW+Ce0L5k8OGTUMkRoGKDc1E=</Q><G>PU/MeGp6I/FBduuwD9UPeCFzg8Ib9H5osku5nT8AhHTY8zGqetuvHhxbESt4lLz8aXzX0oIiMsusBr6E/aBdooBI36fHwW8WndCmwkB1kv7mhRIB4302UrfvC2KWQuBypfl0++a1whBMCh5VTJYH1sBkFIaVNeUbt5Q6/UdiZVY=</G><Y>shJRUdGxEYxSKM5JVol9HAdQwIK+wF9X4n9SAD++vfZOMOYi+M1yuvQAlQvnSlTTWr7CZPRVAICLgDBbqi9iN+Id60ccJ+hw3pGDfLpJ7IdFPszJEeUO+SZBwf8njGXULqSODs/NTciiX7E07rm+KflxFOg0qtWAhmYLxIkDx7s=</Y><J>AAAAAQ6LSuRiYdsocZ6rgyqIOpE1/uCO1PfEn758Lg2VW6OHJTYHNC30s0gSTG/Jt3oHYX+S8vrtNYb8kRJ/ipgcofGq2Qo/cYKP7RX2K6EJwSfWInhsNMr1JmzuK0lUKkXXXVo15fL8O2/16uEWMg==</J><Seed>uYM5b20luvbuyevi9TXHwekbr5s=</Seed><PgenCounter>4A==</PgenCounter><X>fAOytZttUZFzt/AvwRinmvYKL7E=</X></DSAKeyValue>";
+// static string xmlPublic = "<DSAKeyValue><P>s/Oc0t4gj0NRqkCKi4ynJnOAEukNhjkHJPOzNsHP69kyHMUwZ3AzOkLGYOWlOo2zlYKzSbZygDDI5dCWA5gQF2ZGHEUlWJMgUyHmkybOi44cyHaX9yeGfbnoc3xF9sYgkA3vPUZaJuYMOsBp3pyPdeN8/mLU8n0ivURyP+3Ge9M=</P><Q>qkcTW+Ce0L5k8OGTUMkRoGKDc1E=</Q><G>PU/MeGp6I/FBduuwD9UPeCFzg8Ib9H5osku5nT8AhHTY8zGqetuvHhxbESt4lLz8aXzX0oIiMsusBr6E/aBdooBI36fHwW8WndCmwkB1kv7mhRIB4302UrfvC2KWQuBypfl0++a1whBMCh5VTJYH1sBkFIaVNeUbt5Q6/UdiZVY=</G><Y>shJRUdGxEYxSKM5JVol9HAdQwIK+wF9X4n9SAD++vfZOMOYi+M1yuvQAlQvnSlTTWr7CZPRVAICLgDBbqi9iN+Id60ccJ+hw3pGDfLpJ7IdFPszJEeUO+SZBwf8njGXULqSODs/NTciiX7E07rm+KflxFOg0qtWAhmYLxIkDx7s=</Y><J>AAAAAQ6LSuRiYdsocZ6rgyqIOpE1/uCO1PfEn758Lg2VW6OHJTYHNC30s0gSTG/Jt3oHYX+S8vrtNYb8kRJ/ipgcofGq2Qo/cYKP7RX2K6EJwSfWInhsNMr1JmzuK0lUKkXXXVo15fL8O2/16uEWMg==</J><Seed>uYM5b20luvbuyevi9TXHwekbr5s=</Seed><PgenCounter>4A==</PgenCounter></DSAKeyValue>";
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // may also help for DSA descendants
+ public void AssertEquals (string message, DSAParameters expectedKey, DSAParameters actualKey, bool checkPrivateKey)
+ {
+ AssertEquals (message + " Counter", expectedKey.Counter, actualKey.Counter);
+ AssertEquals (message + " G", expectedKey.G, actualKey.G);
+ AssertEquals (message + " J", expectedKey.J, actualKey.J);
+ AssertEquals (message + " P", expectedKey.P, actualKey.P);
+ AssertEquals (message + " Q", expectedKey.Q, actualKey.Q);
+ AssertEquals (message + " Seed", expectedKey.Seed, actualKey.Seed);
+ AssertEquals (message + " Y", expectedKey.Y, actualKey.Y);
+ if (checkPrivateKey)
+ AssertEquals (message + " X", expectedKey.X, actualKey.X);
+ }
+
+ public void TestConstructors ()
+ {
+ CspParameters csp = new CspParameters ();
+ DSACryptoServiceProvider dsa1 = new DSACryptoServiceProvider ();
+ DSACryptoServiceProvider dsa2 = new DSACryptoServiceProvider (512);
+// DSACryptoServiceProvider dsa3 = new DSACryptoServiceProvider (csp);
+// DSACryptoServiceProvider dsa4 = new DSACryptoServiceProvider (1024, csp);
+ }
+
+ public void TestKeyGeneration ()
+ {
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+ // Test every valid key size
+ KeySizes LegalKeySize = dsa.LegalKeySizes[0];
+/* TOO LONG
+ for (int i = LegalKeySize.MinSize; i <= LegalKeySize.MaxSize; i += LegalKeySize.SkipSize) {
+ DSACryptoServiceProvider key = new DSACryptoServiceProvider (i);
+ AssertEquals ("KeySize", i, key.KeySize);
+ }*/
+ // Test invalid keypair (too small)
+ try {
+ DSACryptoServiceProvider tooSmallKeyPair = new DSACryptoServiceProvider (384);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ // Test invalid keypair (too big)
+ try {
+ DSACryptoServiceProvider tooBigKeyPair = new DSACryptoServiceProvider (2048);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+
+ // all keypairs generated by CryptoAPI on Windows
+ string CapiXml512 = "<DSAKeyValue><P>tWcdz18IhYs8k1vagB94wR/sgHSANmmVlSstfMBWbIwthyT2AV64LkMLeCOdflYFEXgpmpTx5UIGGgEx8/EEuw==</P><Q>6E7WKEXRY+ASYA6nkBUP25fgz88=</Q><G>QPykdzvQ997BxXBZ+xFM10jzvZ3G73T9Aj6y2bMNdKd3/GfZwbvQui83YoRfFnYumJmV6c4cfCN1Tuf6n6jCuA==</G><Y>jrNR5BBEzW9aD9WjeJ7us0ityN8mpcqBVbHCAAWIjc0BvlY1AacPQ8xN3kKyHHKpPgMwNuFXHwks6VO68Y0etw==</Y><J>x+c7udpLkcx0I6LX2+HjLn/VHTdPr2XH9Dk4fBUnVrrjYKPVYQCIavHKFCY=</J><Seed>7qAsSVCQRpmFIfhyhYdtMybIvLI=</Seed><PgenCounter>AYU=</PgenCounter><X>DSWG2qNYTBMXD6k5j9AeCaxSVp4=</X></DSAKeyValue>";
+ string CapiXml576 = "<DSAKeyValue><P>/UpVL7nsgTsT+HzOidLQgSi9Rk8sn+jBl/RH9OzoSJhmLKM4cCl/mz3LAZNWqDS9kqDlTohYfPTVdsKA79U3uHx+xeUpk6UH</P><Q>mR7th6PKwfpwBBzp1MUGy36jxuc=</Q><G>oWjhXviie9LYZxoSCZuc45kQG+1iIJm3Omeik06b0jM9ZtVtHCXjuHRohEZfuBck8HRUxreSRT895kXzhN3/hYcqLnGMPbiZ</G><Y>kC1DnEs3hW30JtYLRQ3d46sp++6oNIjz9ncAZz6VEQg6GqjLieigAg/5ikzHjUS3Ps9xVOgGGpjSFTMSYrEl/K3obPNNFPWi</Y><J>AAAAAad4wklEWIys2shSp+zpfpu0K+/li8cJMK8K5oneqwedsMPT/ciDPVgrJYtS1WrwDoIHIAo=</J><Seed>LuRNAo/Lj+cbWgE6JB57C+8tB1I=</Seed><PgenCounter>cQ==</PgenCounter><X>h3vfdRLRPghNCXKzITtcpJo3W+U=</X></DSAKeyValue>";
+ string CapiXml640 = "<DSAKeyValue><P>1SjEwMEXKJFpmQip/SFhqQHoi3SWgXAbMA6ZMVVL/34O9CqUY2shx9E839i4mTh+euvyF9A6UhUuVRFJ8HMFpPeBqbbzrVtynU2USW74h2U=</P><Q>rYvCtKnZiH28AoErTfKCAex11YM=</Q><G>K5iAfQ50aEpTtkuHN/WQCa7bysGBT3vbPkRVUcYX0GAxZSIrXqvQJVh74FQnttk0AkSSqc1Bj3aH8DG0Ie3pqFDfyWoj4ZHh7DaqjHIUlTs=</G><Y>aqEzlNdCktrAI4PF1DNYFkPTFbjO+ittp78dThOJOaDitM0OhkdujSzwvwRQ25phVbsxlVpGesxpqI3dA6Y13v2Xbek9P+1WkS1iPZt88f8=</Y><J>AAAAATpvI+WRt+RdcSC/hd9pO+yvd8fYY+NLh+F951dEuZfulWl09ARuzwc5BHu3x2IO/NbUc3Eru82RBBmhzA==</J><Seed>QMvwX0OS+ANLT263MGWecWwQOfs=</Seed><PgenCounter>Ag==</PgenCounter><X>Gu8/RsqX34sOnfNU71OZCmL2pMw=</X></DSAKeyValue>";
+ string CapiXml704 = "<DSAKeyValue><P>v8CmmIBAKfifPNhkHtkBk9FdS5U4gq8Ex/L+0tVR1Izh7t9C2d0C1ZNbaTOTDGKV7TKOLIOXQ/sYVa3Sa033cWrfk/Z1veHd+49Xk7JjEiKnMipfXtXp8Q==</P><Q>qctfxht2I8ZbZF6f+jT4DNON00U=</Q><G>nQ4ao+mLFUD8XRr4bhVbk5siffsbCauzOQNZlWQMfHjuSTfD8+MKzhgXb/A+a0CQRBXvYu+2R8VmyRET93IlwkppXgxldSwUd3xlng/3O9ogbF06zHVjHg==</G><Y>d82MybaKc5FselhGYpGm/XROSyAsSs/blDzQAnjyPfKWdbXSaHLjyeficMmipi60/nH5ShnCnMrc22Bm9hOpMaMfhidMX6Uh5YB9EKy7Cdb6587/y6EiLA==</Y><J>AAAAASEbOtcd7wjAzuiD9qyOTA4xEKFPgOup5SuDH6FZ9FXAH+NePtGeBpXKIaLj2shrkKhsJmY5pVza/yVE9L74ajqcK2kw</J><Seed>8W3wrLCmjs81ekM3Jz3D9fxfAuw=</Seed><PgenCounter>wA==</PgenCounter><X>UWQ3ZFd/Eg2OzY9Fin/aCGLHNbQ=</X></DSAKeyValue>";
+ string CapiXml768 = "<DSAKeyValue><P>wOca55yVYJveGqx8w3acAV/LNyLmo9eAXKxnIXyEsjB+LoGjJRvJbqMy0NP9VR6qv12iZaVs/32A2y6iHMeVnQWxSnu9ieeM+Gwwh4Xg1beOeHsI4FKBH+ZTgYiNRGXT</P><Q>uPrZhRYtl7IOc38ZQnKd3StxCO8=</Q><G>S8cg4PHBvNOQ/c7zYYJTS991U5O2OibCsaOLUKFlUhkf+9DUDvJIauSzeWbQVkb6ta5oOapRbUNPfjY6OlZWHMnlBXAUpme2UBoz1IMUY2xM6Q4JKrxMv6NLCHoMhnP6</G><Y>rb/X/sFw7f0JOnSD2ygUzFFU57iIxYwRl8t8lUZ2lJ0oBdw2zy75Oud4S7vB56Xo0JJAEFSUQFobpAWpxqZ/5qLP0PzhxhjwN+Dv9S5hpcaicJrIbHKdx8A7O6P5QcR2</Y><J>AAAAAQr2+OH8gZynYhX5wG8T9iWuMu6LsLuQsbYoDcbCbMdwDRr1bNYjR1NPZNfuDtVlzXFY1nOSG67wW7HZIWYMYBBCRKbE5oK16O8VI04=</J><Seed>xjnQGEAsKqfluAuJCCs8hG3pDI8=</Seed><PgenCounter>nA==</PgenCounter><X>erfJ6egI1OnM1z1IRFhJaFN+B3w=</X></DSAKeyValue>";
+ string CapiXml832 = "<DSAKeyValue><P>pbJGnzQS8MnlCD9/odKjNmFsFxdOpsaVld2k3yNxbvJGRNPhAm3jXXL+1lAlSanpsBDRzEZfd8QQO1W5dZ3J0D9nLY15Pf49UhMvduYvEzgqofdMWxi0Wc+lfsivsa1/7tgfzVE2Jc0=</P><Q>7XixpXVHZk2vrfb8wng8Ek80sWk=</Q><G>RQKfUz7so8P76ax7pz4l8mSBwlXZbdwc0+ASgXa7lS2o1r/RsNrrrAWrLvMKQP6Nzg48uuDiI4QCoyFoi3ToiqPlV63fl4JSxQgHSCRh2VHg+iG+4fujqAPEfDWsQZGH84/jZLSpw+4=</G><Y>CakyawTgUySuImok8j6zg6y6xizp1NlPBlVmIzggP8rpaATvnapyk2T8jPsMHFsNWFiRbCQapXBvVp2Vqc2w+VOuTi2C0evjbcGT3ZdEAJoxyVkwy3I8P2hHtXtwy1c67kOADAAZZ0c=</Y><J>sp/uZOuB11am784e30URbuizTkAPUXDvQT6FyZGEIEreZGavkCOhOs8+vZ2eevYSPsr8eFC8XaMK+mOa13AQb60kYPuGPAgpw8OJnL/gwMemEbHs</J><Seed>zXDB6meB3EeaXj4xYLDxXdvJzxo=</Seed><PgenCounter>Af4=</PgenCounter><X>6APt5R3qKDQSvI04R6ibq0gRHMo=</X></DSAKeyValue>";
+ string CapiXml896 = "<DSAKeyValue><P>tdSKUdac07x6tSb7I/HuZeLTzdP5Ft0ngwcabST3LVPvC9VlczcYidHAMObeTuuL5eu+OGFr8//FmzANMkl2QlBu6L79dNraHb2TeUAApt6YYMfLJgzqXpHRzlxR33Uhox4PY3OAS1W1yNU3DvPQow==</P><Q>0eJqRrUp4/23i5geDgMmjFViKQ0=</Q><G>nWUPHcBQUpy1Wnxz4y+EI/LcfrAMP/quhxJRdcxiTpdsI/OHZXaBnieHjcrGsuOgBAfifapiEUj3mWN2wk5H3wZpxi6TDIXrweWcWIuWpB33Xr1ZHM5TYPmrFfimbav/xJh3Cd9j8wi1eackodrEQw==</G><Y>nja1XNP1H/fNsL5nKymZelvlBP7NPOTVaFp+2L3a6mVamGdl37CHMHlLzXIXYMsaAyf6pGMivwjj2caSu7wwzNdAbavWnagXSSU6pXNnAMHWS266j642xc030/pavBLU/hCV7N5VZ/EapLBUEqqpcg==</Y><J>3cghxRYCKhtnphhsgfHs90NqrPkMx4iIXMNcomAmrJdthiGPTfADM+4AykVs3KDUcEQtkU8eUiZsiDqDdKkCxFwtpdvpp7bViKPjnzl0j7yxf3Fcb2GRW033Rqo=</J><Seed>zrLLYcXgs+SWccZ5R0EeaO41l+w=</Seed><PgenCounter>Byc=</PgenCounter><X>Vbs8rxlLRHVAm5x1UdQXblNT610=</X></DSAKeyValue>";
+ string CapiXml960 = "<DSAKeyValue><P>8I6EDGOIko1Fm6r6nBWqLS7A4RhYwfdUilJINLJpsvZ7z0qa4MqqLFB57H3Iok/YLe8Z4SSqrLJDqH4Rxl28rNAOcVBuTiCHx5GNuetfeqF2knFLCg4caJIwI51AbzSJEiBp7tlGyNHdu46XOMFukdC8jkozTbzJ</P><Q>rS9PUEwcN0vYzIcmgon339LAqrE=</Q><G>X33SudRcEMlrtB5xDndktK4UNJOVPuT14ypK4JLB8DTQRqYMkHUqNnTRCYMurOJGsbNP4ebjqp4eCMyQ+zHmEKNNi6AZulFzUvzkdbfBkN8HJYJQC9tdp9U445BUF5lnIsKvv18d9gFbcUvL8aFRmNVY0M9NtSdb</G><Y>fjKb8Z7LZ1ylNo1Yzc904XRFf/AsnORT2l4+1ruPZPPlaRkGRfF8sD/B/6We+rYOJg68F8ngBmCwkzy9QfV4lkeB6n1sco03h7Zd/B6cMjC6tqAThdh70xk9CTyk46fL61qN032HfdF1ca2OqkuDdnfpbIBg0EUt</Y><J>AAAAAWOWpJWt08loRNc8cCf2Dl94/2aRbebis+SxRwqSiF77iEsMlsndA+hLX+6UOE4fFuFm7x38o6iUB1poYI0TaxQrDeaFjovIiPOovcofuP8efHiIeMR6cnugvYWXkC3ZsZASK0g=</J><Seed>iS3sRFr6k97343rVRZLsZVN0Brw=</Seed><PgenCounter>UA==</PgenCounter><X>B5SpH6Fd1S/3GuiHgkZJZLKQcFk=</X></DSAKeyValue>";
+ string CapiXml1024 = "<DSAKeyValue><P>rHUuNzvl+8HhyXeXhVePoCZPX7oBr0gIWgMBU067L+hN3AvLw2372iSgnb8cT0wbFjgcJYUfmJcsQfGJCz+ngGeVKFkqPZCrlG6VuAY3mYZ5VZY68q4EtsM4YtqjRNLDIiTdAtHYdMdWnraK58Z/Z688Drbkp0m4PgDEj+VvgcU=</P><Q>+1Qjw//auFyRrXKm3I/ehy5uph0=</Q><G>g++njdKHRxHdhIUjbd2wEsV+q0KJRiiXCbHyxBPb0L4Ahv8vG2SxQftdHwBIEuh8cOKG9/bPmvsmjPdTigbZUKhA4QmH4hhTVa0f1dtJepylCJcwvEmFDG38sw2J95XSAodPBfeuLxOBYrpLXZry5fi6P0m3BgSEqSHjCQfHQok=</G><Y>Ee57vjhzaJi+iHTfVvURccywtV7sauK997+wsk3XH6GC85htoAG42qeHKB93wtA67IuIh6gH6Mt6+RA6jQ1P+OEoCTGHUR2Fu0qhBHGU/AsNXKrrtaDc0a+abcEeZxU1ENhz7D2eOxm/ohp/If2mt2FZ/VtUOt9eOEtOCtRbyaI=</Y><J>r6nCxn/CLCgxXOgQH5c4kjyMoFg/XUB7xNFFHfI6MXI26h3astfAkHzcSJvl5lmM9iLHxgOMIviYXfWFLD++M3rglElCw7BnHccKWtQGxmg1ToFOAjC7UaCejLcDI0i7HX6WdO0YY1ZcqA2U</J><Seed>SpWGXImjbDvjqh5E64HkgSLEMtM=</Seed><PgenCounter>Bc0=</PgenCounter><X>f4PsM9PtzRlhvoLemk9NS5KZq3Q=</X></DSAKeyValue>";
+
+ // import/export XML keypairs
+ // so we know that Mono can use keypairs generated by CryptoAPI
+ public void TestCapiXmlImportExport ()
+ {
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+
+ dsa.FromXmlString (CapiXml512);
+ AssertEquals ("Capi-Xml512", CapiXml512, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml576);
+ AssertEquals ("Capi-Xml576", CapiXml576, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml640);
+ AssertEquals ("Capi-Xml640", CapiXml640, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml704);
+ AssertEquals ("Capi-Xml704", CapiXml704, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml768);
+ AssertEquals ("Capi-Xml768", CapiXml768, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml832);
+ AssertEquals ("Capi-Xml832", CapiXml832, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml896);
+ AssertEquals ("Capi-Xml896", CapiXml896, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml960);
+ AssertEquals ("Capi-Xml960", CapiXml960, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (CapiXml1024);
+ AssertEquals ("Capi-Xml1024", CapiXml1024, dsa.ToXmlString (true));
+ }
+
+ private void SignAndVerify (string msg, DSA dsa)
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ byte[] sign = dsa.CreateSignature (hash);
+ // we don't need the private key to verify
+ DSAParameters param = dsa.ExportParameters (false);
+ DSA key = DSA.Create ();
+ key.ImportParameters (param);
+ // the signature is never the same so the only way to know if
+ // it worked is to verify it ourselve (i.e. can't compare)
+ bool ok = key.VerifySignature (hash, sign);
+ Assert (msg + "-SignAndVerify", ok);
+ }
+
+ // Validate that we can sign with every keypair and verify the signature
+ // With Mono this means that we can use CAPI keypair to sign and verify.
+ // For Windows this doesn't mean much.
+ public void TestCapiSignature ()
+ {
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+
+ dsa.FromXmlString (CapiXml512);
+ SignAndVerify ("Capi-512", dsa);
+
+ dsa.FromXmlString (CapiXml576);
+ SignAndVerify ("Capi-576", dsa);
+
+ dsa.FromXmlString (CapiXml640);
+ SignAndVerify ("Capi-640", dsa);
+
+ dsa.FromXmlString (CapiXml704);
+ SignAndVerify ("Capi-704", dsa);
+
+ dsa.FromXmlString (CapiXml768);
+ SignAndVerify ("Capi-768", dsa);
+
+ dsa.FromXmlString (CapiXml832);
+ SignAndVerify ("Capi-832", dsa);
+
+ dsa.FromXmlString (CapiXml896);
+ SignAndVerify ("Capi-896", dsa);
+
+ dsa.FromXmlString (CapiXml960);
+ SignAndVerify ("Capi-960", dsa);
+
+ dsa.FromXmlString (CapiXml1024);
+ SignAndVerify ("Capi-1024", dsa);
+ }
+
+ // Validate that we can verify a signature made with CAPI
+ // With Mono this means that we can verify CAPI signatures.
+ // For Windows this doesn't mean much.
+ public void TestCapiVerify ()
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+
+ dsa.FromXmlString (CapiXml512);
+ byte[] sign512 = { 0xCA, 0x11, 0xA4, 0xCD, 0x5B, 0xBA, 0xA1, 0xC9, 0x8C, 0xEF, 0x9A, 0xB8, 0x84, 0x09, 0x96, 0xD0, 0x1B, 0x39, 0x6D, 0x1C, 0xE1, 0xB2, 0x0E, 0xD3, 0xCE, 0xCF, 0x6A, 0x48, 0xDC, 0x22, 0x40, 0xDC, 0xCD, 0x61, 0x25, 0x7F, 0x9E, 0x1B, 0x79, 0x89 };
+ Assert ("Capi-512-Verify", dsa.VerifySignature (hash, sign512));
+ sign512[0] = 0x00;
+ Assert ("Capi-512-VerBad", !dsa.VerifySignature (hash, sign512));
+
+ dsa.FromXmlString (CapiXml576);
+ byte[] sign576 = { 0x10, 0x77, 0xE9, 0x4C, 0x29, 0xB0, 0xF4, 0x0E, 0x3B, 0xB7, 0x8E, 0x3A, 0x40, 0x22, 0x63, 0x70, 0xF3, 0xA5, 0xB7, 0x4A, 0x5C, 0x85, 0xB5, 0xF3, 0x4B, 0x1C, 0x4A, 0x92, 0xDD, 0x1D, 0xED, 0x63, 0x26, 0xC2, 0x42, 0x20, 0xBE, 0x33, 0x55, 0x57 };
+ Assert ("Capi-576-Verify", dsa.VerifySignature (hash, sign576));
+ sign576[0] = 0x00;
+ Assert ("Capi-576-VerBad", !dsa.VerifySignature (hash, sign576));
+
+ dsa.FromXmlString (CapiXml640);
+ byte[] sign640 = { 0x4C, 0x04, 0xAC, 0xE0, 0x84, 0x04, 0x5A, 0x1D, 0x9D, 0x61, 0xA1, 0x62, 0xBE, 0x11, 0xEA, 0x0D, 0x1C, 0x21, 0xC7, 0x55, 0x2C, 0x7C, 0x84, 0x4F, 0x22, 0xE9, 0xA1, 0xF1, 0x2C, 0x83, 0x13, 0x90, 0xAE, 0x36, 0xFD, 0x59, 0x32, 0x21, 0xAE, 0x0F };
+ Assert ("Capi-640-Verify", dsa.VerifySignature (hash, sign640));
+ sign640[0] = 0x00;
+ Assert ("Capi-640-VerBad", !dsa.VerifySignature (hash, sign640));
+
+ dsa.FromXmlString (CapiXml704);
+ byte[] sign704 = { 0xA2, 0x75, 0x32, 0xE0, 0x4B, 0xCA, 0x92, 0x51, 0x84, 0xAC, 0x7C, 0xDE, 0x97, 0xB8, 0xC3, 0x25, 0xD7, 0xF8, 0xA7, 0xE0, 0x76, 0x42, 0x7E, 0x5E, 0x5E, 0x3F, 0x82, 0xDB, 0x87, 0xBF, 0xC9, 0xCC, 0xD9, 0xA2, 0x8E, 0xA2, 0xFE, 0xD3, 0x48, 0x30 };
+ Assert ("Capi-704-Verify", dsa.VerifySignature (hash, sign704));
+ sign704[0] = 0x00;
+ Assert ("Capi-704-VerBad", !dsa.VerifySignature (hash, sign704));
+
+ dsa.FromXmlString (CapiXml768);
+ byte[] sign768 = { 0x92, 0x27, 0x89, 0x4B, 0xB2, 0xDF, 0xE9, 0x98, 0x5A, 0xC5, 0x78, 0x5E, 0xBD, 0x51, 0x6D, 0x10, 0x30, 0xEC, 0x14, 0x95, 0x6E, 0xEB, 0xA6, 0x5F, 0x3E, 0x47, 0x47, 0x86, 0x19, 0xD0, 0xF2, 0x9B, 0x70, 0x98, 0x97, 0x07, 0x04, 0x0C, 0x13, 0xC6 };
+ Assert ("Capi-768-Verify", dsa.VerifySignature (hash, sign768));
+ sign768[0] = 0x00;
+ Assert ("Capi-768-VerBad", !dsa.VerifySignature (hash, sign768));
+
+ dsa.FromXmlString (CapiXml832);
+ byte[] sign832 = { 0xC7, 0x10, 0x86, 0x86, 0x4A, 0x19, 0xBC, 0x8E, 0xC5, 0x0E, 0x53, 0xC0, 0x9E, 0x70, 0x2C, 0xFD, 0x4B, 0x9B, 0xBD, 0x79, 0x46, 0x8E, 0x9F, 0x64, 0x41, 0xF9, 0xBB, 0xDD, 0x3B, 0x93, 0x63, 0x82, 0x7B, 0x9B, 0x5B, 0x12, 0x9B, 0xAA, 0x90, 0xAD };
+ Assert ("Capi-832-Verify", dsa.VerifySignature (hash, sign832));
+ sign832[0] = 0x00;
+ Assert ("Capi-832-VerBad", !dsa.VerifySignature (hash, sign832));
+
+ dsa.FromXmlString (CapiXml896);
+ byte[] sign896 = { 0x7F, 0x0F, 0x5F, 0xC4, 0x44, 0x38, 0x65, 0xD7, 0x0B, 0x03, 0xD1, 0xAC, 0x77, 0xA2, 0xA2, 0x47, 0x37, 0x37, 0x42, 0xA2, 0x97, 0x23, 0xDA, 0x7F, 0xEC, 0xD5, 0x78, 0x3D, 0x5E, 0xDA, 0xA0, 0x02, 0xD6, 0x2D, 0x4B, 0xFA, 0x79, 0x7B, 0x7A, 0x87 };
+ Assert ("Capi-896-Verify", dsa.VerifySignature (hash, sign896));
+ sign896[0] = 0x00;
+ Assert ("Capi-896-VerBad", !dsa.VerifySignature (hash, sign896));
+
+ dsa.FromXmlString (CapiXml960);
+ byte[] sign960 = { 0x63, 0x77, 0x39, 0xE5, 0x03, 0xD2, 0x33, 0xF5, 0xFE, 0x16, 0xE4, 0x7E, 0x49, 0x4E, 0x72, 0xA0, 0x1B, 0x8D, 0x4D, 0xEC, 0x55, 0x15, 0x72, 0x1C, 0x22, 0x37, 0x4B, 0x64, 0xEB, 0x02, 0x3E, 0xC5, 0xCF, 0x32, 0x07, 0xC5, 0xD3, 0xA2, 0x02, 0x0A };
+ Assert ("Capi-960-Verify", dsa.VerifySignature (hash, sign960));
+ sign960[0] = 0x00;
+ Assert ("Capi-960-VerBad", !dsa.VerifySignature (hash, sign960));
+
+ dsa.FromXmlString (CapiXml1024);
+ byte[] sign1024 = { 0x1C, 0x5A, 0x9D, 0x82, 0xDD, 0xE0, 0xF5, 0x65, 0x74, 0x48, 0xFB, 0xD6, 0x27, 0x92, 0x98, 0xEA, 0xC6, 0x7F, 0x4F, 0x7C, 0x49, 0xFC, 0xCF, 0x46, 0xEB, 0x62, 0x27, 0x05, 0xFC, 0x9C, 0x40, 0x74, 0x5B, 0x13, 0x7E, 0x76, 0x9C, 0xE4, 0xF6, 0x53 };
+ Assert ("Capi-1024-Verify", dsa.VerifySignature (hash, sign1024));
+ sign1024[0] = 0x00;
+ Assert ("Capi-1024-VerBad", !dsa.VerifySignature (hash, sign1024));
+ }
+
+ // all keypairs generated by Mono on Windows
+ string MonoXml512 = "<DSAKeyValue><P>zh9f0jwaZU7uk9A2YZkKDiAt3Rk/UFieBrs9CtvrWDNjmZyB8OZtwdt5qoZxxk/ZQdhnQPyY4Wfb2AXfcNw1oQ==</P><Q>qRl9bdSR4U2HEJ75f8v/h9ofAXs=</Q><G>aZZELrF/gAWcJnITv2pCzpwbP4d1OppRyEko5Ub6HJYL4Ez4TPTtveW+6ni90Kqq6Hbfc1x26MaU+c7s8GsTBw==</G><Y>j4sRCjiN0vdibzB0EuHFdDmB1nb8YmjEMtLzU2A7icqVbo+obwAIofNSaEW5bSc1nSGL1AFD2WIa49U6yewxXg==</Y><J>AAAAATgMk/+kNvZLy1QCT75cuivedK6Iz+bZ2g/ncnvBjjb5oM9PFxAZU+MNI57g</J><Seed>tEXsCuDb0lrfypB5kTI5iTWPqSA=</Seed><PgenCounter>xg==</PgenCounter><X>nd+0VT69+NJ0l4DuQDnOwCDR30A=</X></DSAKeyValue>";
+ string MonoXml576 = "<DSAKeyValue><P>+IVgSLz5ciuK8w5Wq56zX5ZDU/A4XrwTUngLmG4SyjtHLZUVS4npZ/gaJk02oSl4E1WUKL8yKDy1p3jewbH5bAScuprQpXr5</P><Q>01NXNM+IZtv6fl8Zr64daxJHAqk=</Q><G>ZrM3QjPyuINgj38UEqi1APX3zz7jsoCUNnslCjVgzhS0q9L44FcKPxW9WW+uh/N2PxcSqDMCd3yFvbzzgHG8+Te12UT00BHW</G><Y>CUHNKbeRzIBQncxOhaC7pKz0Gscx5zhO++BTvGRDKkOUBbvO+kf52Y+q1Hmp0OS+I3tDFU80V7Lmt5UpPw4DyzSuqukkI6Uy</Y><J>AAAAAS0PAQxeB0hDGlnmieeuKG1X8KsogV8rdq8fI9Glhu44LfGZmzBNsBCrqHSMBVVFWTerdjg=</J><Seed>eUE4tvz2nInFOGDhfMFO90p+d1o=</Seed><PgenCounter>8Q==</PgenCounter><X>iAWUFn8TSUh5GYNLB2YLyzg6KxE=</X></DSAKeyValue>";
+ string MonoXml640 = "<DSAKeyValue><P>7aE8g2fajUuMRVNVdblVtOqoFjWao0gPvS9z/rZAtfcJhZ/Q75PFUUKhBz/zMClT0O6GY695LErNUQvIH9bfgrM5Mywk5tRDV2FN61kWg00=</P><Q>ppaB4BvQvi/PtUi60y6cO55BGS8=</Q><G>g+ImQPN/hbRDu/A23Wv9MMVHRUgMGaPySPeOtdKad96iycTS0ddC/Odo7fvg11+ukiauD7Sec4UQPNGFHoT0vozAcg6SDmX4KgM4M5QDsl8=</G><Y>lsItHPOgvebvDU7o+Cns17Q1+EZ3ySG2DXQ5RyZ8zB4UmBfsC8Lnz5EliGZqej/D5OJSAjNfIx9hh+Jd6ENBNNyWDZnLIwYi5WuwhxFZ+vY=</Y><J>AAAAAW0sBVV2lXw4OIn3UIqYPzE+ith31rrZ0OnTlqYElQqSXub7Sf20ILEIYGQ3CZ2so4t1qmebmjK+cwAGdA==</J><Seed>fecSUnEdYuJJP2pIGw89Apu74Qs=</Seed><PgenCounter>Rg==</PgenCounter><X>nDBo1S2rT/XfwdHFVa7LcVoNCuE=</X></DSAKeyValue>";
+ string MonoXml704 = "<DSAKeyValue><P>lWVVsk//enAqLcmFBuw68MRuF4OBENHlnS9Fcy6idae43Di/yRkNxURLcjKAgDne6a0fPvAXMa7iyOm8r1GO6DtdR3xepApufnhQrn982lZY2D2Uzufkxw==</P><Q>3tFuyT6SXpfM746TBeufyWcVxjU=</Q><G>d5x4zOlwNSNk+nzF6rMl3iU81NHm7Org+ZjV00haTRcud1nSn9qlPMmh1Iyu2eDb/hVFYSHVriR6JL9uhnHRFgDmG0Gq3rLYjP9HwSc0bSZJhpnvMh+plg==</G><Y>gMyp9cb1b+PiJVjHm1JXyMRpPQaqXAwv9aZ/3ALUMla5xWbs8eOX0xKb03F9SiOyrrOLl7FU1NV3aPAqlxRVAEoDWfs59kwFuvtxTNCPMA9yUe9LIPmESg==</Y><J>q6TNHPV5sVaSSavn0P3kpQ/dEnw6r+Kf6vA8f1A6XwsufncwAAjLgkDD5tglPcUzuqSBNbpGnZgXHpD7mXvORGzJEm4=</J><Seed>U4J0gynSch6aQjtYthQvOrZ5FDo=</Seed><PgenCounter>2g==</PgenCounter><X>yYzu1dTYzh9veG5e+Uph0fJdOLo=</X></DSAKeyValue>";
+ string MonoXml768 = "<DSAKeyValue><P>rpEwOnT4y+tJvCg9LvuQ+PxB12r1ZghEaF7fiGh46ip2GsMfotb24tE58YpzTqiaJT3H/w5Ps7MZKE42322dX1oV9kRSmr/EYYS9GdUbnKCtfa+sA1x0FwDZgqaCZ3pV</P><Q>5eRCKf4gMUCAToisFaJsn0xQ6IM=</Q><G>bKVUkTMOgonH9RzGI1FXbLgemhVq2qSpwVce7f3qjGDPnw7uzXfLPqvMc3WYRGLB99gps+8SNdJ7pdxIprAyGG0ovl0Fq1X7Xwk9RQBqdbxnx+tLCXhkgLV/OpEnJGqs</G><Y>eX3lNXsbmfeg2Ac4dzTqQMowXV22ydnoXtOE2EggOE60WcHxiNql0yLUvFfRIdf0PnJa7/EfqzAxc1U6dHGljNWwH8mvsJXKQ/ps5fa8v5UveAzg73chUparNM9d7WAp</Y><J>wmR011Gh0XpjfIpTczt/J4pQq5L9IqrhxeQHPgRTC5/xL4Lh8cheAlVDrF8RqgnE6VgSCTOOfeq+7ySLNTdrWA3xweyS5s+lpqQEHA==</J><Seed>yWTv1DNaxQxqdKMdwPCzpP1dz6Q=</Seed><PgenCounter>PQ==</PgenCounter><X>5bS76Q72Mkw8/c9q8VZJY8XQ3vs=</X></DSAKeyValue>";
+ string MonoXml832 = "<DSAKeyValue><P>/8mh+RcX8QTo1cxuXYuSs4FihZ9IiKocX/M1gHCtsK9vWHBH+JoRPJ0huuQLp0qZzK0BncPyJdkST+HCnOuWEzBBunf2cebtAl6Bm3LYldzCdig7ptrlHsVBSOzSnBsEfl6VAGvFEw0=</P><Q>3j2ihzDNHb2OIm/Ly+928iz6r2M=</Q><G>ctmj3nFuBvbVYJo9sxmOvmnRsd+Z4bVc+ieb450uRdA+IsXSqfTN1phHUt7DQmFxBALi0ygg7PX1V+0JkZf4Ui1/lMPdznA6H+UJzV0GgJpCNwsYfrZbNFddm+wunRMuz6uTB57UKxM=</G><Y>cI8rpi0L89rBytXQCl/HFlsoTrogdzcj7/yYgzDRqnuINUA7lUJ1Vzj803p9IKQg6pNb0jRKwHcYnHAg/Lb3yWJcQHsZWvdfAG3vR/P8LM15BiXnAGuur7X8zRa1E9/vqcn77GCsuuI=</Y><J>AAAAASakjFeNPQ1kUYa8c77CkoEGZCAfG5+31W/00Tnu8QkgZMjGaUp/4vzvzgAn+KuZh0lRYbxi4IHpCEvgji7Cr+w3AFLdtRK63TwvJFkWLqx8N64MhA==</J><Seed>cblDQQ0wbr/Tpb/Pu3IcICApHx8=</Seed><PgenCounter>jQ==</PgenCounter><X>uVVaaWQdHK6O4mlrLXUouHTQQbo=</X></DSAKeyValue>";
+ string MonoXml896 = "<DSAKeyValue><P>x0mhnUZKcKqmCMpbvWfF67pBkQeJSm9I8S0BZISyeSpt9CS9qSnZlCyA+bRPA6BURXl6cPkDKMosHvkN40TWR8nj0zx5ggKmWFDZC7FaIXlvrhs4ALwNMC6Ji376r0EhZIpl+rGaOFM9uz+ya7fasQ==</P><Q>7PE0XlOwB9mi8PKk6HjW5bsU2Ds=</Q><G>r1DKk6xGIRWkE0PdC6kqsAECOZ2Q1VKZow+5xLCMAUlH+172fl4ViXw1Ihk6LTj5BYCb5NLxTO26naUoxQfY5FT/C3e9k17UWVBI7cPpNJNmIQGY2N/enI01tGWSZO5THyaXI0mvG2mI0Io8kG+E3Q==</G><Y>N+v4DSXxsSteaPQxu6eOBdhWpd2N1eV/A0RZYAcoWXb2uF8L3foq4Ake+VXgLRWDExkhBQurWBQxrD4vJbdgHeI/yKkmHL6IATDkuv0KPkZ8gMqJJPszk5UhxHxTo9+NiYKlGZO6qhJYV9MRbcpQqQ==</Y><J>11EYG/P5XTPQRJSyHboxKKol7zCm/0BnWvjsdBaPC3bHh2g6GR6uOE0uPZ+FJLVvP8iqClvWbxQF8pm/yKRaZa3SaJZjk1DNuEQZOkkxWqkti8MC2mIAXdCwlRA=</J><Seed>8nTVIayazWuhjpKfKkYnDz/Y3Yk=</Seed><PgenCounter>sAE=</PgenCounter><X>0nvKIkkjg3yHb0rw9eLM2nPExdk=</X></DSAKeyValue>";
+ string MonoXml960 = "<DSAKeyValue><P>rvLpyJmoSI71LUh2slfZmfafcV/iJj2PbR+hN80NL4YAyw22T8zG4s2q5Ez1eBN+34ob48+f2UJsvSDJrFCFWHvrifgGWkUmssDBA8iIP2oAZ8jy9YdJ0QoOa2DPi9IsK6Xo0p1IsexsPpxzHzAahs86e1tBSqob</P><Q>/lEFkFT1So7tFkYuLb03uWAlekE=</Q><G>WhRVK0LJInEG5DM42yxmrgq4J8DS4uofTyD3VEAHlKWVmE7okNDrqGI+kVvMOtePVrHsl6asIlSIk+U27QW6F8opsS2vb+ior/WcFT4HjcKgGScFk4ZTVijFFejM4pLV3FuR83nSVxn4p/HzheLX6sCISWD4Pdrp</G><Y>jHV8rnyQZLWf/6DfDUpWqRjvmU2F4EqiExYJwmfwkauwar8uzfmLCzrpMYvhF1NQ8OVyP7vYkgF2QFuMBG7X0HFNLji4mrF7DNkeUB+2LAkecpCWCgpIbPoOPXVQqe/bJgYf+8ttozbQmJTAqaGrJ2tTxweqiYCm</Y><J>sBtkEkGWVMPWdkg1WH25Q+gISLVadvRnXn4dC6n/FTqFHunYTWyh+FuLGA1l899fubwBZNrMGVhLhWdEv0wan6v0SPHQ2iz4EW5LeO/sEyXUfxhoVT7MwkMwTcMYhRmkwCFfmg==</J><Seed>aY7TaL00Rm9qsE3eU2cu3auWHVs=</Seed><PgenCounter>dw==</PgenCounter><X>kUX5eEVEaWpgm5DtHifImDLuSb8=</X></DSAKeyValue>";
+ string MonoXml1024 = "<DSAKeyValue><P>rD4HJ6rTF7dEz2RvHhnqREpu8fW0Fs8181CHqEqgUuAKG3x8euMTHlIt+kZ95RT1chLXGBRhOWT2YTgq04cTczatZhrxSWnI8hz1eHbZvRAGQ6ZP2FMvvWyJMgWnU7D5aShUM3LOqM1TgHumGwSYXhBvbj42Jjzbn80ULPkLmOU=</P><Q>pwiHLGzrt+FSJ0+IwTiS7/N3/Ls=</Q><G>OWdsYYZ0u/p6vvBrI0X+KTubx2dXG396w01dYIshLAwA4EsoDskusyr8mG4bvxFKLzGCt2ZjC7QImSKO8Y72TmNeYmmbeDc9IYENk7LuBzd8WboCRIt2gZ/KTh26TkiN8072ZVOqRZn3I35SFkUUn6PVng6EXkuhJ8EzLyvXev4=</G><Y>EcNLWKf9FJX5OUB0ON7aNASSH1SxzqvYCK8uP4H3y2LyRo7fi1JvDi/BUSyhCxfvRMG8O5QUi2yAXfNFWqEVnGUxlwNUzpx4UwKF+vYZAcnU8Wb0RJ++VT+O2NN9wou1Ys4p/gWYNsi4fk0nm8Hjx9ae5VyMXSQHEhQuUxwxWw0=</Y><J>AAAAAQf7wobrNXeeDP58+AEbzO7Gl5pTvqHfipR8ttv5yuOTahOrQFOKbH3ZpVLDF6jJsj2TMJLKsFaZsOcuEgVONT8R0nOAWbskUMxYV72492RwWylTKolkcbRyhonRbpOUFdE6xrztzijDeYRObA==</J><Seed>jiFLa4UqlTqHrUk69fHpjjc9Fe0=</Seed><PgenCounter>JQE=</PgenCounter><X>i+yoBF9nTiYNVeONGl8+/7gf1LQ=</X></DSAKeyValue>";
+
+ // import/export XML keypairs
+ // so we know that Windows (original MS Framework) can use keypairs generated by Mono
+ public void TestMonoXmlImportExport ()
+ {
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+
+ dsa.FromXmlString (MonoXml512);
+ AssertEquals ("Mono-Xml512", MonoXml512, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml576);
+ AssertEquals ("Mono-Xml576", MonoXml576, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml640);
+ AssertEquals ("Mono-Xml640", MonoXml640, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml704);
+ AssertEquals ("Mono-Xml704", MonoXml704, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml768);
+ AssertEquals ("Mono-Xml768", MonoXml768, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml832);
+ AssertEquals ("Mono-Xml832", MonoXml832, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml896);
+ AssertEquals ("Mono-Xml896", MonoXml896, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml960);
+ AssertEquals ("Mono-Xml960", MonoXml960, dsa.ToXmlString (true));
+
+ dsa.FromXmlString (MonoXml1024);
+ AssertEquals ("Mono-Xml1024", MonoXml1024, dsa.ToXmlString (true));
+ }
+
+ // Validate that we can sign with every keypair and verify the signature
+ // With Windows this means that we can use Mono keypairs to sign and verify.
+ // For Mono this doesn't mean much.
+ public void TestMonoSignature ()
+ {
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+
+ dsa.FromXmlString (MonoXml512);
+ SignAndVerify ("Mono-512", dsa);
+
+ dsa.FromXmlString (MonoXml576);
+ SignAndVerify ("Mono-576", dsa);
+
+ dsa.FromXmlString (MonoXml640);
+ SignAndVerify ("Mono-640", dsa);
+
+ dsa.FromXmlString (MonoXml704);
+ SignAndVerify ("Mono-704", dsa);
+
+ dsa.FromXmlString (MonoXml768);
+ SignAndVerify ("Mono-768", dsa);
+
+ dsa.FromXmlString (MonoXml832);
+ SignAndVerify ("Mono-832", dsa);
+
+ dsa.FromXmlString (MonoXml896);
+ SignAndVerify ("Mono-896", dsa);
+
+ dsa.FromXmlString (MonoXml960);
+ SignAndVerify ("Mono-960", dsa);
+
+ dsa.FromXmlString (MonoXml1024);
+ SignAndVerify ("Mono-1024", dsa);
+ }
+
+ // Validate that we can verify a signature made with Mono
+ // With Windows this means that we can verify Mono signatures.
+ // For Mono this doesn't mean much.
+ public void TestMonoVerify ()
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ DSACryptoServiceProvider dsa = new DSACryptoServiceProvider ();
+
+ dsa.FromXmlString (MonoXml512);
+ byte[] sign512 = { 0x53, 0x44, 0x0A, 0xD7, 0x43, 0x3C, 0x1F, 0xC7, 0xCE, 0x9C, 0xAE, 0xDC, 0xFC, 0x61, 0xD5, 0xCE, 0xC9, 0x5C, 0x8D, 0x13, 0x0F, 0x66, 0x15, 0xCB, 0x9F, 0x94, 0x19, 0x18, 0x63, 0x40, 0x6D, 0x3E, 0x16, 0xA8, 0x3E, 0x9B, 0x8A, 0xC2, 0xA5, 0x38 };
+ Assert ("Mono-512-Verify", dsa.VerifySignature (hash, sign512));
+ sign512[0] = 0x00;
+ Assert ("Mono-512-VerBad", !dsa.VerifySignature (hash, sign512));
+
+ dsa.FromXmlString (MonoXml576);
+ byte[] sign576 = { 0xAC, 0xC8, 0xA3, 0x22, 0x3D, 0x77, 0xE1, 0x13, 0xFD, 0x65, 0x72, 0xE0, 0xA5, 0xF5, 0x94, 0xD6, 0x70, 0x70, 0x40, 0xA9, 0x10, 0x1E, 0x1D, 0xEA, 0x51, 0x68, 0x32, 0x2A, 0x24, 0x47, 0x22, 0x8D, 0xC0, 0xD0, 0x8A, 0x5A, 0x0E, 0x98, 0x5F, 0x2C };
+ Assert ("Mono-576-Verify", dsa.VerifySignature (hash, sign576));
+ sign576[0] = 0x00;
+ Assert ("Mono-576-VerBad", !dsa.VerifySignature (hash, sign576));
+
+ dsa.FromXmlString (MonoXml640);
+ byte[] sign640 = { 0x5E, 0x6E, 0x1F, 0x38, 0xCA, 0x0D, 0x01, 0x01, 0xBE, 0x5E, 0x8B, 0xAB, 0xCE, 0xD2, 0x42, 0x80, 0x4A, 0xBD, 0x74, 0x60, 0x56, 0x4B, 0x16, 0x4A, 0x71, 0xBC, 0xC3, 0x82, 0xE1, 0x54, 0x0D, 0xB0, 0x67, 0xB6, 0xB6, 0x71, 0x46, 0xA9, 0x01, 0x44 };
+ Assert ("Mono-640-Verify", dsa.VerifySignature (hash, sign640));
+ sign640[0] = 0x00;
+ Assert ("Mono-640-VerBad", !dsa.VerifySignature (hash, sign640));
+
+ dsa.FromXmlString (MonoXml704);
+ byte[] sign704 = { 0x27, 0x33, 0x45, 0xC5, 0x41, 0xC7, 0xD6, 0x5D, 0x68, 0x32, 0x50, 0x4C, 0xB3, 0x4B, 0x59, 0xCF, 0x49, 0xD1, 0x61, 0x82, 0xCF, 0x73, 0x20, 0x20, 0x3E, 0x09, 0xA3, 0x49, 0xAA, 0x22, 0x1D, 0x1D, 0x27, 0xBA, 0x9F, 0xDD, 0xE2, 0x7D, 0xCD, 0x82 };
+ Assert ("Mono-704-Verify", dsa.VerifySignature (hash, sign704));
+ sign704[0] = 0x00;
+ Assert ("Mono-704-VerBad", !dsa.VerifySignature (hash, sign704));
+
+ dsa.FromXmlString (MonoXml768);
+ byte[] sign768 = { 0xCA, 0x53, 0x91, 0x99, 0xAE, 0x1B, 0x97, 0xE5, 0x3B, 0x08, 0x78, 0x92, 0xD1, 0x2E, 0x0D, 0xAC, 0xB7, 0x82, 0xFB, 0xA3, 0x84, 0xEE, 0x9B, 0x5E, 0x12, 0x6C, 0x16, 0x6D, 0x97, 0xC1, 0xCF, 0x9A, 0xA9, 0xCF, 0x6A, 0x6E, 0x08, 0x45, 0xA7, 0x19 };
+ Assert ("Mono-768-Verify", dsa.VerifySignature (hash, sign768));
+ sign768[0] = 0x00;
+ Assert ("Mono-768-VerBad", !dsa.VerifySignature (hash, sign768));
+
+ dsa.FromXmlString (MonoXml832);
+ byte[] sign832 = { 0x7F, 0x1C, 0xC5, 0xA4, 0xDB, 0x95, 0x27, 0xD3, 0x23, 0x6E, 0xCE, 0xBC, 0xC0, 0x9D, 0x82, 0x02, 0x6E, 0xA0, 0x80, 0x5D, 0x53, 0x54, 0x3D, 0x1B, 0x1C, 0x54, 0xDD, 0x1F, 0xD5, 0x7E, 0x07, 0x60, 0xDD, 0x2A, 0xB2, 0x96, 0x3C, 0x36, 0xB3, 0x60 };
+ Assert ("Mono-832-Verify", dsa.VerifySignature (hash, sign832));
+ sign832[0] = 0x00;
+ Assert ("Mono-832-VerBad", !dsa.VerifySignature (hash, sign832));
+
+ dsa.FromXmlString (MonoXml896);
+ byte[] sign896 = { 0x36, 0x90, 0xA2, 0x4C, 0xDA, 0xDC, 0x6C, 0xF3, 0x83, 0xFE, 0xA8, 0x14, 0xFB, 0x01, 0x69, 0x5F, 0xFA, 0xFA, 0x71, 0xA6, 0x6F, 0xBE, 0x96, 0xB7, 0x11, 0xE7, 0xDE, 0xC7, 0x71, 0x10, 0x83, 0xEE, 0x34, 0x18, 0x4E, 0x88, 0xC1, 0xE0, 0xF9, 0x0A };
+ Assert ("Mono-896-Verify", dsa.VerifySignature (hash, sign896));
+ sign896[0] = 0x00;
+ Assert ("Mono-896-VerBad", !dsa.VerifySignature (hash, sign896));
+
+ dsa.FromXmlString (MonoXml960);
+ byte[] sign960 = { 0xCE, 0xE8, 0x52, 0x32, 0x9B, 0x30, 0xB5, 0x22, 0x6C, 0x21, 0x34, 0xC6, 0x09, 0xD8, 0xA8, 0x6D, 0x00, 0x87, 0x0F, 0x87, 0x21, 0x50, 0x18, 0x99, 0xED, 0x2A, 0xD3, 0xA5, 0x82, 0x8D, 0x38, 0x63, 0x21, 0xDA, 0xE1, 0x94, 0x65, 0xE1, 0x6E, 0x72 };
+ Assert ("Mono-960-Verify", dsa.VerifySignature (hash, sign960));
+ sign960[0] = 0x00;
+ Assert ("Mono-960-VerBad", !dsa.VerifySignature (hash, sign960));
+
+ dsa.FromXmlString (MonoXml1024);
+ byte[] sign1024 = { 0x67, 0x73, 0x4D, 0x6C, 0x0E, 0xB2, 0x85, 0xC6, 0x97, 0x5F, 0x09, 0x42, 0xEA, 0xDB, 0xC6, 0xE1, 0x6D, 0x84, 0xA0, 0x15, 0x63, 0x6C, 0xE3, 0x83, 0xA5, 0xCB, 0x58, 0xC6, 0x51, 0x3C, 0xB4, 0xD2, 0x6B, 0xA0, 0x70, 0xCE, 0xD9, 0x8D, 0x96, 0xCA };
+ Assert ("Mono-1024-Verify", dsa.VerifySignature (hash, sign1024));
+ sign1024[0] = 0x00;
+ Assert ("Mono-1024-VerBad", !dsa.VerifySignature (hash, sign1024));
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureDeformatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureDeformatterTest.cs
new file mode 100644
index 00000000000..5e8115bd176
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureDeformatterTest.cs
@@ -0,0 +1,173 @@
+//
+// DSASignatureDeformatterTest.cs - NUnit Test Cases for DSASignatureDeformatter
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class DSASignatureDeformatterTest : TestCase {
+ protected DSASignatureDeformatter def;
+ protected static DSA dsa;
+ protected static RSA rsa;
+
+ protected override void SetUp ()
+ {
+ def = new DSASignatureDeformatter ();
+ // key generation is VERY long so one time is enough
+ if (dsa == null)
+ dsa = DSA.Create ();
+ if (rsa == null)
+ rsa = RSA.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ public void TestConstructors ()
+ {
+ // empty constructor
+ DSASignatureDeformatter def = new DSASignatureDeformatter ();
+ AssertNotNull ("DSASignatureDeformatter()", def);
+ // AsymmetricAlgorithm constructor (with null)
+ def = new DSASignatureDeformatter (null);
+ AssertNotNull ("DSASignatureDeformatter(null)", def);
+ // AsymmetricAlgorithm constructor (with DSA)
+ def = new DSASignatureDeformatter (dsa);
+ AssertNotNull ("DSASignatureDeformatter(dsa)", def);
+ // AsymmetricAlgorithm constructor (with RSA)
+ try {
+ def = new DSASignatureDeformatter (rsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got " + e.ToString ());
+ }
+ }
+
+ // Method is documented as unused so...
+ public void TestSetHash ()
+ {
+ // null is ok
+ try {
+ def.SetHashAlgorithm (null);
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ // SHA1
+ try {
+ def.SetHashAlgorithm ("SHA1");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ // MD5 (bad)
+ try {
+ def.SetHashAlgorithm ("MD5");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicUnexpectedOperationException but got " + e.ToString ());
+ }
+ }
+
+ public void TestSetKey ()
+ {
+ // here null is ok
+ try {
+ def.SetKey (null);
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ // RSA (bad)
+ try {
+ def.SetKey (rsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+ // DSA
+ try {
+ def.SetKey (dsa);
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ }
+
+ public void TestVerify ()
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ byte[] sign = { 0x50, 0xd2, 0xb0, 0x8b, 0xcd, 0x5e, 0xb2, 0xc2, 0x35, 0x82, 0xd3, 0x76, 0x07, 0x79, 0xbb, 0x55, 0x98, 0x72, 0x43, 0xe8,
+ 0x74, 0xc9, 0x35, 0xf8, 0xc9, 0xbd, 0x69, 0x2f, 0x08, 0x34, 0xfa, 0x5a, 0x59, 0x23, 0x2a, 0x85, 0x7b, 0xa3, 0xb3, 0x82 };
+ bool ok = false;
+ try {
+ ok = def.VerifySignature (hash, sign);
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicUnexpectedOperationException but got " + e.ToString ());
+ }
+
+ dsa.ImportParameters (AllTests.GetKey (false));
+ def.SetKey (dsa);
+
+ // missing signature
+ try {
+ ok = def.VerifySignature (hash, null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+
+ // missing hash
+ try {
+ byte[] s = null; // overloaded method
+ ok = def.VerifySignature (s, sign);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+
+ ok = def.VerifySignature (hash, sign);
+ Assert ("verified signature", ok);
+
+ byte[] badSign = { 0x49, 0xd2, 0xb0, 0x8b, 0xcd, 0x5e, 0xb2, 0xc2, 0x35, 0x82, 0xd3, 0x76, 0x07, 0x79, 0xbb, 0x55, 0x98, 0x72, 0x43, 0xe8,
+ 0x74, 0xc9, 0x35, 0xf8, 0xc9, 0xbd, 0x69, 0x2f, 0x08, 0x34, 0xfa, 0x5a, 0x59, 0x23, 0x2a, 0x85, 0x7b, 0xa3, 0xb3, 0x82 };
+ ok = def.VerifySignature (hash, badSign);
+ Assert ("didn't verified bad signature", !ok);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureFormatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureFormatterTest.cs
new file mode 100644
index 00000000000..4dbed457d37
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureFormatterTest.cs
@@ -0,0 +1,171 @@
+//
+// DSASignatureFormatterTest.cs - NUnit Test Cases for DSASignatureFormatter
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class DSASignatureFormatterTest : TestCase {
+ protected DSASignatureFormatter fmt;
+ protected static DSA dsa;
+ protected static RSA rsa;
+
+ protected override void SetUp ()
+ {
+ fmt = new DSASignatureFormatter ();
+ // key generation is VERY long so one time is enough
+ if (dsa == null)
+ dsa = DSA.Create ();
+ if (rsa == null)
+ rsa = RSA.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ public void TestConstructors ()
+ {
+ // empty constructor
+ DSASignatureFormatter fmt = new DSASignatureFormatter ();
+ AssertNotNull ("DSASignatureFormatter()", fmt);
+ // AsymmetricAlgorithm constructor (with null)
+ fmt = new DSASignatureFormatter (null);
+ AssertNotNull ("DSASignatureFormatter(null)", fmt);
+ // AsymmetricAlgorithm constructor (with DSA)
+ fmt = new DSASignatureFormatter (dsa);
+ AssertNotNull ("DSASignatureFormatter(dsa)", fmt);
+ // AsymmetricAlgorithm constructor (with RSA)
+ try {
+ fmt = new DSASignatureFormatter (rsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got " + e.ToString ());
+ }
+ }
+
+ public void TestSetHash ()
+ {
+ // null is ok
+ try {
+ fmt.SetHashAlgorithm (null);
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ // SHA1
+ try {
+ fmt.SetHashAlgorithm ("SHA1");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ // MD5 (bad)
+ try {
+ fmt.SetHashAlgorithm ("MD5");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicUnexpectedOperationException but got " + e.ToString ());
+ }
+ }
+
+ public void TestSetKey () {
+ // here null is ok
+ try {
+ fmt.SetKey (null);
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ // RSA (bad)
+ try {
+ fmt.SetKey (rsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+ // DSA
+ try {
+ fmt.SetKey (dsa);
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ }
+
+ // note: There's a bug in MS Framework where you can't re-import a key into
+ // the same object
+ public void TestSignature ()
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ byte[] sign = null;
+ // no keypair
+ try {
+ sign = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicUnexpectedOperationException but got " + e.ToString ());
+ }
+
+ // try a keypair without the private key
+ dsa.ImportParameters (AllTests.GetKey (false));
+ fmt.SetKey (dsa);
+ try {
+ sign = fmt.CreateSignature (hash);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got " + e.ToString ());
+ }
+
+ // complete keypair
+ dsa.ImportParameters (AllTests.GetKey (true));
+ fmt.SetKey (dsa);
+
+ // null hash
+ try {
+ byte[] h = null; // overloaded method
+ sign = fmt.CreateSignature (h);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+
+ // valid
+ sign = fmt.CreateSignature (hash);
+ Assert ("verified signature", dsa.VerifySignature (hash, sign));
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/DSATest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/DSATest.cs
new file mode 100644
index 00000000000..dc56634f24a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/DSATest.cs
@@ -0,0 +1,152 @@
+//
+// DSATest.cs - NUnit Test Cases for DSA
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+/*public class NonAbstractDSAForUnitTests : DSA {
+ protected DSAParameters dsa;
+
+ // not tested here - but we must implemented all abstract properties
+ public override string KeyExchangeAlgorithm
+ {
+ get { return null; }
+ }
+
+ // not tested here - but we must implemented all abstract properties
+ public override string SignatureAlgorithm
+ {
+ get { return null; }
+ }
+
+ // not tested here - but we must implemented all abstract methods
+ public override byte[] CreateSignature (byte[] rgbHash)
+ {
+ return null;
+ }
+
+ // basic implementation for tests
+ public override DSAParameters ExportParameters (bool includePrivateParameters)
+ {
+ DSAParameters dsaParams = dsa;
+ if (!includePrivateParameters)
+ dsaParams.X = null;
+ return dsaParams;
+ }
+
+ // basic implementation for tests
+ public override void ImportParameters (DSAParameters parameters)
+ {
+ dsa = parameters;
+ }
+
+ // not tested here - but we must implemented all abstract methods
+ public override bool VerifySignature (byte[] rgbHash, byte[] rgbSignature)
+ {
+ return false;
+ }
+
+ protected override void Dispose (bool disposing) {}
+}*/
+
+public class DSATest : TestCase {
+ protected DSA dsa;
+
+ static string xmlPrivate = "<DSAKeyValue><P>s/Oc0t4gj0NRqkCKi4ynJnOAEukNhjkHJPOzNsHP69kyHMUwZ3AzOkLGYOWlOo2zlYKzSbZygDDI5dCWA5gQF2ZGHEUlWJMgUyHmkybOi44cyHaX9yeGfbnoc3xF9sYgkA3vPUZaJuYMOsBp3pyPdeN8/mLU8n0ivURyP+3Ge9M=</P><Q>qkcTW+Ce0L5k8OGTUMkRoGKDc1E=</Q><G>PU/MeGp6I/FBduuwD9UPeCFzg8Ib9H5osku5nT8AhHTY8zGqetuvHhxbESt4lLz8aXzX0oIiMsusBr6E/aBdooBI36fHwW8WndCmwkB1kv7mhRIB4302UrfvC2KWQuBypfl0++a1whBMCh5VTJYH1sBkFIaVNeUbt5Q6/UdiZVY=</G><Y>shJRUdGxEYxSKM5JVol9HAdQwIK+wF9X4n9SAD++vfZOMOYi+M1yuvQAlQvnSlTTWr7CZPRVAICLgDBbqi9iN+Id60ccJ+hw3pGDfLpJ7IdFPszJEeUO+SZBwf8njGXULqSODs/NTciiX7E07rm+KflxFOg0qtWAhmYLxIkDx7s=</Y><J>AAAAAQ6LSuRiYdsocZ6rgyqIOpE1/uCO1PfEn758Lg2VW6OHJTYHNC30s0gSTG/Jt3oHYX+S8vrtNYb8kRJ/ipgcofGq2Qo/cYKP7RX2K6EJwSfWInhsNMr1JmzuK0lUKkXXXVo15fL8O2/16uEWMg==</J><Seed>uYM5b20luvbuyevi9TXHwekbr5s=</Seed><PgenCounter>4A==</PgenCounter><X>fAOytZttUZFzt/AvwRinmvYKL7E=</X></DSAKeyValue>";
+
+ static string xmlPublic = "<DSAKeyValue><P>s/Oc0t4gj0NRqkCKi4ynJnOAEukNhjkHJPOzNsHP69kyHMUwZ3AzOkLGYOWlOo2zlYKzSbZygDDI5dCWA5gQF2ZGHEUlWJMgUyHmkybOi44cyHaX9yeGfbnoc3xF9sYgkA3vPUZaJuYMOsBp3pyPdeN8/mLU8n0ivURyP+3Ge9M=</P><Q>qkcTW+Ce0L5k8OGTUMkRoGKDc1E=</Q><G>PU/MeGp6I/FBduuwD9UPeCFzg8Ib9H5osku5nT8AhHTY8zGqetuvHhxbESt4lLz8aXzX0oIiMsusBr6E/aBdooBI36fHwW8WndCmwkB1kv7mhRIB4302UrfvC2KWQuBypfl0++a1whBMCh5VTJYH1sBkFIaVNeUbt5Q6/UdiZVY=</G><Y>shJRUdGxEYxSKM5JVol9HAdQwIK+wF9X4n9SAD++vfZOMOYi+M1yuvQAlQvnSlTTWr7CZPRVAICLgDBbqi9iN+Id60ccJ+hw3pGDfLpJ7IdFPszJEeUO+SZBwf8njGXULqSODs/NTciiX7E07rm+KflxFOg0qtWAhmYLxIkDx7s=</Y><J>AAAAAQ6LSuRiYdsocZ6rgyqIOpE1/uCO1PfEn758Lg2VW6OHJTYHNC30s0gSTG/Jt3oHYX+S8vrtNYb8kRJ/ipgcofGq2Qo/cYKP7RX2K6EJwSfWInhsNMr1JmzuK0lUKkXXXVo15fL8O2/16uEWMg==</J><Seed>uYM5b20luvbuyevi9TXHwekbr5s=</Seed><PgenCounter>4A==</PgenCounter></DSAKeyValue>";
+
+ protected override void SetUp ()
+ {
+ //dsa = new NonAbstractDSAForUnitTests ();
+ dsa = new DSACryptoServiceProvider ();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // may also help for DSA descendants
+ public void AssertEquals (string message, DSAParameters expectedKey, DSAParameters actualKey, bool checkPrivateKey)
+ {
+ AssertEquals( message + " Counter", expectedKey.Counter, actualKey.Counter );
+ AssertEquals( message + " G", expectedKey.G, actualKey.G );
+ AssertEquals( message + " J", expectedKey.J, actualKey.J );
+ AssertEquals( message + " P", expectedKey.P, actualKey.P );
+ AssertEquals( message + " Q", expectedKey.Q, actualKey.Q );
+ AssertEquals( message + " Seed", expectedKey.Seed, actualKey.Seed );
+ AssertEquals( message + " Y", expectedKey.Y, actualKey.Y );
+ if (checkPrivateKey)
+ AssertEquals( message + " X", expectedKey.X, actualKey.X );
+ }
+
+ // LAMESPEC: ImportParameters inverse the byte arrays inside DSAParameters !!!
+ // importing and exporting a DSA key (including private key)
+ public void TestDSAImportPrivateExportPrivate()
+ {
+ DSAParameters input = AllTests.GetKey (true);
+ dsa.ImportParameters (input);
+ string xmlDSA = dsa.ToXmlString (true);
+ dsa.FromXmlString (xmlDSA);
+ AssertEquals ("DSA Import Private Export Private (xml)", xmlPrivate, xmlDSA);
+ DSAParameters output = dsa.ExportParameters (true);
+ AssertEquals ("DSA Import Private Export Private (binary)", AllTests.GetKey (true), output, true);
+ }
+
+ // importing and exporting a DSA key (without private key)
+ public void TestDSAImportPrivateExportPublic()
+ {
+ DSAParameters input = AllTests.GetKey (true);
+ dsa.ImportParameters (input);
+ string xmlDSA = dsa.ToXmlString (false);
+ dsa.FromXmlString (xmlDSA);
+ AssertEquals ("DSA Import Private Export Public (xml)", xmlPublic, xmlDSA);
+ DSAParameters output = dsa.ExportParameters (false);
+ AssertEquals ("DSA Import Private Export Public (binary)", AllTests.GetKey (true), output, false);
+ }
+
+ // importing and exporting a DSA key (including private key)
+ public void TestDSAImportPublicExportPrivate()
+ {
+ DSAParameters input = AllTests.GetKey (false);
+ dsa.ImportParameters (input);
+ string xmlDSA = null;
+ try {
+ xmlDSA = dsa.ToXmlString (true);
+ Fail ("Expected CryptographicException but got no exception");
+ }
+ catch (CryptographicException) {
+ // expected as we cannot get a private key
+ // from a public key (at least not in our lifetime)
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ // importing and exporting a DSA key (without private key)
+ public void TestDSAImportPublicExportPublic()
+ {
+ DSAParameters input = AllTests.GetKey (false);
+ dsa.ImportParameters (input);
+ string xmlDSA = dsa.ToXmlString (false);
+ dsa.FromXmlString (xmlDSA);
+ AssertEquals ("DSA Import Public Export Public (xml)", xmlPublic, xmlDSA);
+ DSAParameters output = dsa.ExportParameters (false);
+ AssertEquals ("DSA Import Public Export Public (binary)", AllTests.GetKey (false), output, true);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/FromBase64Transform.cs b/mcs/class/corlib/Test/System.Security.Cryptography/FromBase64Transform.cs
new file mode 100755
index 00000000000..454cb2fff2d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/FromBase64Transform.cs
@@ -0,0 +1,61 @@
+//
+// TestSuite.System.Security.Cryptography.FromBase64Transform.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Cryptography;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class FromBase64TransformTest : TestCase {
+ private FromBase64Transform _algo;
+
+ protected override void SetUp() {
+ _algo = new FromBase64Transform ();
+ }
+
+ protected void TransformFinalBlock (string name, byte[] input, byte[] expected,
+ int inputOffset, int inputCount)
+ {
+ byte[] output = _algo.TransformFinalBlock (input, inputOffset, inputCount);
+
+ AssertEquals (name, expected.Length, output.Length);
+ for (int i = 0; i < expected.Length; i++)
+ AssertEquals (name + "(" + i + ")", expected [i], output [i]);
+ }
+
+ protected void TransformFinalBlock (string name, byte[] input, byte[] expected)
+ {
+ TransformFinalBlock (name, input, expected, 0, input.Length);
+ }
+
+ public void TestFinalBlock ()
+ {
+ {
+ byte[] input = { 114, 108, 112, 55, 81, 115, 110, 69 };
+ byte[] expected = { 174, 90, 123, 66, 201, 196 };
+
+ TransformFinalBlock ("#A1", input, expected);
+ }
+ {
+ byte[] input = { 114, 108, 112, 55, 81, 115, 61, 61 };
+ byte[] expected = { 174, 90, 123, 66 };
+
+ TransformFinalBlock ("#A2", input, expected);
+ }
+ {
+ byte[] input = { 114, 108, 112, 55, 81, 115, 61, 61 };
+ byte[] expected = { 150, 158, 208 };
+
+ TransformFinalBlock ("#A3", input, expected, 1, 5);
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs
new file mode 100644
index 00000000000..760dbbea732
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs
@@ -0,0 +1,274 @@
+//
+// HMACSHA1Test.cs - NUnit Test Cases for HMACSHA1
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. The Keyed-Hash Message Authentication Code (HMAC)
+// http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf
+// b. IETF RFC2202: Test Cases for HMAC-MD5 and HMAC-SHA-1
+// http://www.ietf.org/rfc/rfc2202.txt
+
+public class HMACSHA1Test : KeyedHashAlgorithmTest {
+
+ protected HMACSHA1 algo;
+
+ protected override void SetUp ()
+ {
+ base.SetUp ();
+ }
+
+ protected override void TearDown () {}
+
+ public void TestConstructors ()
+ {
+ algo = new HMACSHA1 ();
+ AssertNotNull ("HMACSHA1 ()", algo);
+
+ byte[] key = new byte [8];
+ algo = new HMACSHA1 (key);
+ AssertNotNull ("HMACSHA1 (key)", algo);
+
+ try {
+ algo = new HMACSHA1 (null);
+ Fail ("HMACSHA1 (null) - Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // well ArgumentNullException would have been more appropriate
+ }
+ catch (Exception e) {
+ Fail ("HMACSHA1 (null) - Expected NullReferenceException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestInvariants ()
+ {
+ algo = new HMACSHA1 ();
+ AssertEquals ("HMACSHA1.CanReuseTransform", true, algo.CanReuseTransform);
+ AssertEquals ("HMACSHA1.CanTransformMultipleBlocks", true, algo.CanTransformMultipleBlocks);
+ AssertEquals ("HMACSHA1.HashName", "SHA1", algo.HashName);
+ AssertEquals ("HMACSHA1.HashSize", 160, algo.HashSize);
+ AssertEquals ("HMACSHA1.InputBlockSize", 1, algo.InputBlockSize);
+ AssertEquals ("HMACSHA1.OutputBlockSize", 1, algo.OutputBlockSize);
+ AssertEquals ("HMACSHA1.ToString()", "System.Security.Cryptography.HMACSHA1", algo.ToString ());
+ }
+
+ public void TestExceptions ()
+ {
+ algo = new HMACSHA1 ();
+ try {
+ algo.HashName = "MD5";
+ byte[] data = Encoding.Default.GetBytes ("MD5");
+ byte[] hmac = algo.ComputeHash (data);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got " + e.ToString ());
+ }
+ }
+
+ public void Check (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ string classTestName = "HMACSHA1-" + testName;
+ CheckA (testName, key, data, result);
+ CheckB (testName, key, data, result);
+ CheckC (testName, key, data, result);
+ CheckD (testName, key, data, result);
+ CheckE (testName, key, data, result);
+ }
+
+ public void CheckA (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new HMACSHA1 ();
+ algo.Key = key;
+ byte[] hmac = algo.ComputeHash (data);
+ AssertEquals (testName + "a1", result, hmac);
+ AssertEquals (testName + "a2", result, algo.Hash);
+ }
+
+ public void CheckB (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new HMACSHA1 ();
+ algo.Key = key;
+ byte[] hmac = algo.ComputeHash (data, 0, data.Length);
+ AssertEquals (testName + "b1", result, hmac);
+ AssertEquals (testName + "b2", result, algo.Hash);
+ }
+
+ public void CheckC (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new HMACSHA1 ();
+ algo.Key = key;
+ MemoryStream ms = new MemoryStream (data);
+ byte[] hmac = algo.ComputeHash (ms);
+ AssertEquals (testName + "c1", result, hmac);
+ AssertEquals (testName + "c2", result, algo.Hash);
+ }
+
+ public void CheckD (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new HMACSHA1 ();
+ algo.Key = key;
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ algo.TransformFinalBlock (data, 0, data.Length);
+ AssertEquals (testName + "d", result, algo.Hash);
+ }
+
+ public void CheckE (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new HMACSHA1 ();
+ algo.Key = key;
+ byte[] copy = new byte [data.Length];
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ for (int i=0; i < data.Length - 1; i++)
+ algo.TransformBlock (data, i, 1, copy, i);
+ algo.TransformFinalBlock (data, data.Length - 1, 1);
+ AssertEquals (testName + "e", result, algo.Hash);
+ }
+
+ public void TestFIPS198_A1 ()
+ {
+ // exact 64 bytes key (no hashing - no padding)
+ byte[] key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f };
+
+ byte[] fips = { 0x4f, 0x4c, 0xa3, 0xd5, 0xd6, 0x8b, 0xa7, 0xcc, 0x0a, 0x12,
+ 0x08, 0xc9, 0xc6, 0x1e, 0x9c, 0x5d, 0xa0, 0x40, 0x3c, 0x0a };
+
+ byte[] data = Encoding.Default.GetBytes ("Sample #1");
+ Check ("FIPS198-A1", key, data, fips);
+ }
+
+ public void TestFIPS198_A2 ()
+ {
+ // key < 64 bytes -> requires padding
+ byte[] key = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43 };
+
+ byte[] fips = { 0x09, 0x22, 0xd3, 0x40, 0x5f, 0xaa, 0x3d, 0x19, 0x4f, 0x82,
+ 0xa4, 0x58, 0x30, 0x73, 0x7d, 0x5c, 0xc6, 0xc7, 0x5d, 0x24 };
+
+ byte[] data = Encoding.Default.GetBytes ("Sample #2");
+ Check ("FIPS198-A2", key, data, fips);
+ }
+
+ public void TestFIPS198_A3 ()
+ {
+ // key > 64 bytes -> requires hashing
+ byte[] key = { 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3 };
+
+ byte[] fips = { 0xbc, 0xf4, 0x1e, 0xab, 0x8b, 0xb2, 0xd8, 0x02, 0xf3, 0xd0,
+ 0x5c, 0xaf, 0x7c, 0xb0, 0x92, 0xec, 0xf8, 0xd1, 0xa3, 0xaa };
+
+ byte[] data = Encoding.Default.GetBytes ("Sample #3");
+ Check ("FIPS198-A3", key, data, fips);
+ }
+
+ public void TestFIPS198_A4 ()
+ {
+ byte[] key = { 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+ 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
+ 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d,
+ 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 };
+
+ byte[] fips = { 0x9e, 0xa8, 0x86, 0xef, 0xe2, 0x68, 0xdb, 0xec, 0xce, 0x42,
+ 0x0c, 0x75, 0x24, 0xdf, 0x32, 0xe0, 0x75, 0x1a, 0x2a, 0x26 };
+
+ byte[] data = Encoding.Default.GetBytes ("Sample #4");
+ Check ("FIPS198-A4", key, data, fips);
+ }
+
+ public void TestRFC2202_TC1 ()
+ {
+ byte[] key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b };
+ byte[] data = Encoding.Default.GetBytes ("Hi There");
+ byte[] digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1, 0x46, 0xbe, 0x00 };
+ Check ("RFC2202-TC1", key, data, digest);
+ }
+
+ public void TestRFC2202_TC2 ()
+ {
+ byte[] key = Encoding.Default.GetBytes ("Jefe");
+ byte[] data = Encoding.Default.GetBytes ("what do ya want for nothing?");
+ byte[] digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74, 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 };
+ Check ("RFC2202-TC2", key, data, digest);
+ }
+
+ public void TestRFC2202_TC3 ()
+ {
+ byte[] key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa };
+ byte[] data = new byte [50];
+ for (int i = 0; i < data.Length; i++)
+ data[i] = 0xdd;
+ byte[] digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3, 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 };
+ Check ("RFC2202-TC3", key, data, digest);
+ }
+
+ public void TestRFC2202_TC4 ()
+ {
+ byte[] key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 };
+ byte[] data = new byte [50];
+ for (int i = 0; i < data.Length; i++)
+ data[i] = 0xcd;
+ byte[] digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84, 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda };
+ Check ("RFC2202-TC4", key, data, digest);
+ }
+
+ public void TestRFC2202_TC5 ()
+ {
+ byte[] key = { 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c };
+ byte[] data = Encoding.Default.GetBytes ("Test With Truncation");
+ byte[] digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2, 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 };
+ Check ("RFC2202-TC5", key, data, digest);
+ }
+
+ public void TestRFC2202_TC6 ()
+ {
+ byte[] key = new byte [80];
+ for (int i = 0; i < key.Length; i++)
+ key[i] = 0xaa;
+ byte[] data = Encoding.Default.GetBytes ("Test Using Larger Than Block-Size Key - Hash Key First");
+ byte[] digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70, 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 };
+ Check ("RFC2202-TC6", key, data, digest);
+ }
+
+ public void TestRFC2202_TC7 ()
+ {
+ byte[] key = new byte [80];
+ for (int i = 0; i < key.Length; i++)
+ key[i] = 0xaa;
+ byte[] data = Encoding.Default.GetBytes ("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data");
+ byte[] digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b, 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 };
+ Check ("RFC2202-TC7", key, data, digest);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTest.cs
new file mode 100644
index 00000000000..3c9eaa4a3d7
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTest.cs
@@ -0,0 +1,139 @@
+//
+// HashAlgorithmTest.cs - NUnit Test Cases for HashAlgorithm
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+// HashAlgorithm is a abstract class - so most of it's functionality wont
+// be tested here (but will be in its descendants).
+public class HashAlgorithmTest : TestCase {
+ protected HashAlgorithm hash;
+
+ protected override void SetUp ()
+ {
+ hash = HashAlgorithm.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // Note: These tests will only be valid without a "machine.config" file
+ // or a "machine.config" file that do not modify the default algorithm
+ // configuration.
+ private const string defaultSHA1 = "System.Security.Cryptography.SHA1CryptoServiceProvider";
+ private const string defaultMD5 = "System.Security.Cryptography.MD5CryptoServiceProvider";
+ private const string defaultSHA256 = "System.Security.Cryptography.SHA256Managed";
+ private const string defaultSHA384 = "System.Security.Cryptography.SHA384Managed";
+ private const string defaultSHA512 = "System.Security.Cryptography.SHA512Managed";
+ private const string defaultHash = defaultSHA1;
+
+ public virtual void TestCreate ()
+ {
+ // try the default hash algorithm (created in SetUp)
+ AssertEquals( "HashAlgorithm.Create()", defaultHash, hash.ToString());
+
+ // try to build all hash algorithms
+ hash = HashAlgorithm.Create ("SHA");
+ AssertEquals ("HashAlgorithm.Create('SHA')", defaultSHA1, hash.ToString ());
+ hash = HashAlgorithm.Create ("SHA1");
+ AssertEquals ("HashAlgorithm.Create('SHA1')", defaultSHA1, hash.ToString ());
+ hash = HashAlgorithm.Create ("System.Security.Cryptography.SHA1");
+ AssertEquals ("HashAlgorithm.Create('System.Security.Cryptography.SHA1')", defaultSHA1, hash.ToString ());
+ hash = HashAlgorithm.Create ("System.Security.Cryptography.HashAlgorithm" );
+ AssertEquals ("HashAlgorithm.Create('System.Security.Cryptography.HashAlgorithm')", defaultHash, hash.ToString ());
+
+ hash = HashAlgorithm.Create ("MD5");
+ AssertEquals ("HashAlgorithm.Create('MD5')", defaultMD5, hash.ToString ());
+ hash = HashAlgorithm.Create ("System.Security.Cryptography.MD5");
+ AssertEquals ("HashAlgorithm.Create('System.Security.Cryptography.MD5')", defaultMD5, hash.ToString ());
+
+ hash = HashAlgorithm.Create ("SHA256");
+ AssertEquals ("HashAlgorithm.Create('SHA256')", defaultSHA256, hash.ToString ());
+ hash = HashAlgorithm.Create ("SHA-256");
+ AssertEquals ("HashAlgorithm.Create('SHA-256')", defaultSHA256, hash.ToString ());
+ hash = HashAlgorithm.Create ("System.Security.Cryptography.SHA256");
+ AssertEquals ("HashAlgorithm.Create('System.Security.Cryptography.SHA256')", defaultSHA256, hash.ToString ());
+
+ hash = HashAlgorithm.Create ("SHA384");
+ AssertEquals ("HashAlgorithm.Create('SHA384')", defaultSHA384, hash.ToString ());
+ hash = HashAlgorithm.Create ("SHA-384");
+ AssertEquals ("HashAlgorithm.Create('SHA-384')", defaultSHA384, hash.ToString ());
+ hash = HashAlgorithm.Create ("System.Security.Cryptography.SHA384");
+ AssertEquals ("HashAlgorithm.Create('System.Security.Cryptography.SHA384')", defaultSHA384, hash.ToString ());
+
+ hash = HashAlgorithm.Create ("SHA512");
+ AssertEquals ("HashAlgorithm.Create('SHA512')", defaultSHA512, hash.ToString ());
+ hash = HashAlgorithm.Create ("SHA-512");
+ AssertEquals ("HashAlgorithm.Create('SHA-512')", defaultSHA512, hash.ToString ());
+ hash = HashAlgorithm.Create ("System.Security.Cryptography.SHA512");
+ AssertEquals ("HashAlgorithm.Create('System.Security.Cryptography.SHA512')", defaultSHA512, hash.ToString ());
+
+ // try to build invalid implementation
+ hash = HashAlgorithm.Create ("InvalidHash");
+ AssertNull ("HashAlgorithm.Create('InvalidHash')", hash);
+
+ // try to build null implementation
+ try {
+ hash = HashAlgorithm.Create (null);
+ Fail ("HashAlgorithm.Create(null) should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("HashAlgorithm.Create(null) should throw ArgumentNullException not " + e.ToString() );
+ }
+ }
+
+ public void TestClear ()
+ {
+ byte[] inputABC = Encoding.Default.GetBytes ("abc");
+ hash.ComputeHash (inputABC);
+ hash.Clear ();
+ // cannot use a disposed object
+ try {
+ hash.ComputeHash (inputABC);
+ Fail ("ComputeHash after clear should throw ObjectDisposedException but didn't");
+ }
+ catch (ObjectDisposedException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("ComputeHash after clear should throw ObjectDisposedException not " + e.ToString ());
+ }
+ }
+
+ public void TestNullStream ()
+ {
+ Stream s = null;
+ try {
+ byte[] result = hash.ComputeHash (s);
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got " + e.ToString ());
+ }
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/KeyedHashAlgorithmTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/KeyedHashAlgorithmTest.cs
new file mode 100644
index 00000000000..47222fa746e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/KeyedHashAlgorithmTest.cs
@@ -0,0 +1,98 @@
+//
+// KeyedHashAlgorithmTest.cs - NUnit Test Cases for KeyedHashAlgorithm
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// KeyedHashAlgorithm is a abstract class - so most of it's functionality wont
+// be tested here (but will be in its descendants).
+public class KeyedHashAlgorithmTest : HashAlgorithmTest {
+ protected override void SetUp ()
+ {
+ hash = KeyedHashAlgorithm.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ // Note: These tests will only be valid without a "machine.config" file
+ // or a "machine.config" file that do not modify the default algorithm
+ // configuration.
+ private const string defaultHMACSHA1 = "System.Security.Cryptography.HMACSHA1";
+ private const string defaultMACTripleDES = "System.Security.Cryptography.MACTripleDES";
+ private const string defaultKeyedHash = defaultHMACSHA1;
+
+ public override void TestCreate ()
+ {
+ // try the default keyed hash algorithm (created in SetUp)
+ AssertEquals( "KeyedHashAlgorithm.Create()", defaultKeyedHash, hash.ToString());
+
+ // try to build all hash algorithms
+ hash = KeyedHashAlgorithm.Create ("HMACSHA1");
+ AssertEquals ("KeyedHashAlgorithm.Create('HMACSHA1')", defaultHMACSHA1, hash.ToString ());
+ hash = KeyedHashAlgorithm.Create ("System.Security.Cryptography.HMACSHA1");
+ AssertEquals ("KeyedHashAlgorithm.Create('System.Security.Cryptography.HMACSHA1')", defaultHMACSHA1, hash.ToString ());
+ hash = KeyedHashAlgorithm.Create ("System.Security.Cryptography.KeyedHashAlgorithm" );
+ AssertEquals ("KeyedHashAlgorithm.Create('System.Security.Cryptography.KeyedHashAlgorithm')", defaultKeyedHash, hash.ToString ());
+
+ hash = KeyedHashAlgorithm.Create ("MACTripleDES");
+ AssertEquals ("KeyedHashAlgorithm.Create('MACTripleDES')", defaultMACTripleDES, hash.ToString ());
+ hash = KeyedHashAlgorithm.Create ("System.Security.Cryptography.MACTripleDES");
+ AssertEquals ("KeyedHashAlgorithm.Create('System.Security.Cryptography.MACTripleDES')", defaultMACTripleDES, hash.ToString ());
+
+ // try to build invalid implementation
+ hash = KeyedHashAlgorithm.Create ("InvalidKeyedHash");
+ AssertNull ("KeyedHashAlgorithm.Create('InvalidKeyedHash')", hash);
+
+ // try to build null implementation
+ try {
+ hash = KeyedHashAlgorithm.Create (null);
+ Fail ("KeyedHashAlgorithm.Create(null) should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("KeyedHashAlgorithm.Create(null) should throw ArgumentNullException not " + e.ToString ());
+ }
+ }
+
+ public void TestKey ()
+ {
+ KeyedHashAlgorithm kh = (KeyedHashAlgorithm) hash;
+ AssertNotNull ("KeyedHashAlgorithm.Key not null (random key)", kh.Key);
+ byte[] key = { 0x01, 0x02, 0x03 };
+ byte[] keybackup = (byte[]) key.Clone ();
+ kh.Key = key;
+ // the KeyedHashAlgorithm use a copy of the key (not a reference to)
+ key [0] = 0x00;
+ AssertEquals ("KeyedHashAlgorithm key[0]", kh.Key, keybackup);
+ // you can't change individual bytes from a key
+ kh.Key [0] = 0x00;
+ AssertEquals ("KeyedHashAlgorithm.Key[0]", kh.Key, keybackup);
+ // can't change a key after starting an operation
+ kh.TransformBlock (key, 0, 3, keybackup, 0);
+ try {
+ kh.Key = keybackup;
+ Fail ("KeyedHashAlgorithm.Key should throw CryptographicException but didn't");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("KeyedHashAlgorithm.Key should throw CryptographicException not " + e.ToString ());
+ }
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/MACTripleDESTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/MACTripleDESTest.cs
new file mode 100644
index 00000000000..b491ce5f6e9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/MACTripleDESTest.cs
@@ -0,0 +1,243 @@
+//
+// MACTripleDESTest.cs - NUnit Test Cases for MACTripleDES
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class MACTripleDESTest : TestCase {
+
+ protected MACTripleDES algo;
+
+ private static byte[] key1 = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
+ private static byte[] key2 = { 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01 };
+ private static byte[] key3 = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ protected byte[] CombineKeys (byte[] key1, byte[] key2, byte[] key3)
+ {
+ int k1l = key1.Length;
+ int k2l = key2.Length;
+ int k3l = key3.Length;
+ byte[] key = new byte [k1l + k2l + k3l];
+ Array.Copy (key1, 0, key, 0, k1l);
+ Array.Copy (key2, 0, key, k1l, k2l);
+ Array.Copy (key3, 0, key, k1l + k2l, k3l);
+ return key;
+ }
+
+ public void TestConstructors ()
+ {
+ algo = new MACTripleDES ();
+ AssertNotNull ("MACTripleDES ()", algo);
+
+ byte[] key = new byte [24];
+ key [0] = 1; // so this isn't a weak key
+ key [23] = 1;
+ algo = new MACTripleDES (key);
+ AssertNotNull ("MACTripleDES (key)", algo);
+
+ try {
+ algo = new MACTripleDES (null);
+ Fail ("MACTripleDES (null) - Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("MACTripleDES (null) - Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ algo = new MACTripleDES ("TripleDES", key);
+ AssertNotNull ("MACTripleDES ('TripleDES',key)", algo);
+
+ try {
+ algo = new MACTripleDES ("TripleDES", null);
+ Fail ("MACTripleDES ('TripleDES', null) - Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("MACTripleDES ('TripleDES', null) - Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ // funny null is a valid name!
+ algo = new MACTripleDES (null, key);
+ AssertNotNull ("MACTripleDES (null,key)", algo);
+
+ try {
+ algo = new MACTripleDES (null, null);
+ Fail ("MACTripleDES (null, null) - Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("MACTripleDES (null, null) - Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestInvariants ()
+ {
+ algo = new MACTripleDES ();
+ AssertEquals ("MACTripleDES.CanReuseTransform", true, algo.CanReuseTransform);
+ AssertEquals ("MACTripleDES.CanTransformMultipleBlocks", true, algo.CanTransformMultipleBlocks);
+ AssertEquals ("MACTripleDES.HashSize", 64, algo.HashSize);
+ AssertEquals ("MACTripleDES.InputBlockSize", 1, algo.InputBlockSize);
+ AssertEquals ("MACTripleDES.OutputBlockSize", 1, algo.OutputBlockSize);
+ AssertEquals ("MACTripleDES.ToString()", "System.Security.Cryptography.MACTripleDES", algo.ToString ());
+ AssertNotNull ("MACTripleDES.Key", algo.Key);
+ }
+
+ public void TestExceptions ()
+ {
+ byte[] key = CombineKeys (key1, key2, key3);
+ try {
+ algo = new MACTripleDES ("DES", key);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got " + e.ToString ());
+ }
+
+ algo = new MACTripleDES (key);
+ algo.Clear ();
+ try {
+ algo.ComputeHash (new byte[1]);
+ Fail ("Expected ObjectDisposedException but got none");
+ }
+ catch (ObjectDisposedException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ObjectDisposedException but got " + e.ToString ());
+ }
+ }
+
+ public void Check (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ string classTestName = "MACTripleDES-" + testName;
+ CheckA (testName, key, data, result);
+ CheckB (testName, key, data, result);
+ CheckC (testName, key, data, result);
+ CheckD (testName, key, data, result);
+ CheckE (testName, key, data, result);
+ }
+
+ // - Test constructor #1 ()
+ // - Test ComputeHash (byte[]);
+ public void CheckA (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new MACTripleDES ();
+ algo.Key = key;
+ byte[] hmac = algo.ComputeHash (data);
+ AssertEquals (testName + "a1", result, hmac);
+ AssertEquals (testName + "a2", result, algo.Hash);
+ }
+
+ // - Test constructor #2 (byte[])
+ // - Test ComputeHash (byte[], int, int);
+ public void CheckB (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new MACTripleDES (key);
+ byte[] hmac = algo.ComputeHash (data, 0, data.Length);
+ AssertEquals (testName + "b1", result, hmac);
+ AssertEquals (testName + "b2", result, algo.Hash);
+ }
+
+ // - Test constructor #3 (string, byte[])
+ // - Test ComputeHash (stream);
+ public void CheckC (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new MACTripleDES ("TripleDES", key);
+ algo.Key = key;
+ MemoryStream ms = new MemoryStream (data);
+ byte[] hmac = algo.ComputeHash (ms);
+ AssertEquals (testName + "c1", result, hmac);
+ AssertEquals (testName + "c2", result, algo.Hash);
+ }
+
+ // - Test TransformFinalBlock - alone;
+ public void CheckD (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new MACTripleDES ();
+ algo.Key = key;
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ algo.TransformFinalBlock (data, 0, data.Length);
+ AssertEquals (testName + "d", result, algo.Hash);
+ }
+
+ // - Test TransformBlock/TransformFinalBlock
+ public void CheckE (string testName, byte[] key, byte[] data, byte[] result)
+ {
+ algo = new MACTripleDES ();
+ algo.Key = key;
+ byte[] copy = new byte [data.Length];
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ for (int i=0; i < data.Length - 1; i++)
+ algo.TransformBlock (data, i, 1, copy, i);
+ algo.TransformFinalBlock (data, data.Length - 1, 1);
+ AssertEquals (testName + "e", result, algo.Hash);
+ }
+
+ // Here data is smaller than the 3DES block size (8 bytes)
+ public void Test_A1 ()
+ {
+ byte[] key = CombineKeys (key1, key2, key3);
+ byte[] expected = { 0x86, 0xE9, 0x65, 0xBD, 0x1E, 0xC4, 0x44, 0x61 };
+ byte[] data = new byte [7];
+ Check ("3DESMAC-A1", key, data, expected);
+ }
+
+ // Here data is exactly one 3DES block size (8 bytes)
+ public void Test_A2 ()
+ {
+ byte[] key = CombineKeys (key1, key2, key3);
+ byte[] expected = { 0x23, 0xD6, 0x92, 0xA0, 0x80, 0x6E, 0xC9, 0x30 };
+ byte[] data = new byte [8];
+ Check ("3DESMAC-A2", key, data, expected);
+ }
+
+ // Here data is more then one 3DES block size (8 bytes)
+ public void Test_A3 ()
+ {
+ byte[] key = CombineKeys (key1, key2, key3);
+ // note: same result as A2 because of the Zero padding (and that
+ // we use zeros as data
+ byte[] expected = { 0x23, 0xD6, 0x92, 0xA0, 0x80, 0x6E, 0xC9, 0x30 };
+ byte[] data = new byte [14];
+ Check ("3DESMAC-A3", key, data, expected);
+ }
+
+ // Here data is a multiple of 3DES block size (8 bytes)
+ public void Test_A4 ()
+ {
+ byte[] key = CombineKeys (key1, key2, key3);
+ byte[] expected = { 0xD6, 0x6D, 0x75, 0xD4, 0x75, 0xF1, 0x01, 0x71 };
+ byte[] data = new byte [48];
+ Check ("3DESMAC-A4", key, data, expected);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/MD5Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/MD5Test.cs
new file mode 100644
index 00000000000..55a7a2ce99a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/MD5Test.cs
@@ -0,0 +1,60 @@
+// MD5Test.cs - NUnit Test Cases for System.Security.Cryptography.MD5
+//
+// Eduardo Garcia Cebollero (kiwnix@yahoo.es)
+//
+// (C) Eduardo Garcia Cebollero.
+// (C) Ximian, Inc. http://www.ximian.com
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography
+{
+ public class MD5Test : TestCase
+ {
+ public void TestComputeHashNull ()
+ {
+ byte [] dato_vacio = {};
+ string MD5_dato_vacio = "d41d8cd98f00b204e9800998ecf8427e";
+
+ string result_str = "";
+
+ MD5 md5 = new MD5CryptoServiceProvider ();
+ byte [] result = md5.ComputeHash (dato_vacio);
+
+ foreach(byte i in result)
+ result_str += Convert.ToInt32 (i).ToString ("x2");
+
+ AssertEquals ("#01 MD5 Of {} is wrong", result_str, MD5_dato_vacio);
+ }
+
+ public void TestComputeHashA()
+ {
+ byte [] dato_a = { Convert.ToByte ('a') };
+ string MD5_dato_a = "0cc175b9c0f1b6a831c399e269772661";
+ string result_str = "";
+ MD5 md5 = new MD5CryptoServiceProvider ();
+ byte [] result = md5.ComputeHash (dato_a);
+ foreach (byte i in result)
+ result_str += Convert.ToInt32 (i).ToString ("x2");
+
+ AssertEquals ("#02 MD5 Of 'a' is wrong", result_str, MD5_dato_a);
+ }
+
+ public void TestComputeHashB ()
+ {
+ byte[] dato_b = { Convert.ToByte ('\u00F1') };
+ string MD5_dato_b = "edb907361219fb8d50279eabab0b83b1";
+ string result_str = "";
+
+ MD5 md5 = new MD5CryptoServiceProvider ();
+ byte[] result = md5.ComputeHash (dato_b);
+ foreach(byte i in result)
+ result_str += Convert.ToInt32 (i).ToString ("x2");
+
+ AssertEquals ("#03 MD5 Of '\u00F1' is wrong", result_str, MD5_dato_b);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/PKCS1MaskGenerationMethodTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/PKCS1MaskGenerationMethodTest.cs
new file mode 100644
index 00000000000..5f835c85405
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/PKCS1MaskGenerationMethodTest.cs
@@ -0,0 +1,126 @@
+//
+// PKCS1MaskGenerationMethodTest.cs - NUnit Test Cases for PKCS1MaskGenerationMethod
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+public class PKCS1MaskGenerationMethodTest : TestCase
+{
+ protected PKCS1MaskGenerationMethod pkcs1;
+
+ protected override void SetUp ()
+ {
+ pkcs1 = new PKCS1MaskGenerationMethod();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ public void TestProperties ()
+ {
+ // default value
+ AssertEquals ("PKCS1MaskGenerationMethod HashName(default)", "SHA1", pkcs1.HashName);
+ // return to default
+ pkcs1.HashName = null;
+ AssertEquals ("PKCS1MaskGenerationMethod HashName(null)", "SHA1", pkcs1.HashName);
+ // bad hash accepted
+ pkcs1.HashName = "SHA2";
+ AssertEquals ("PKCS1MaskGenerationMethod HashName(bad)", "SHA2", pkcs1.HashName);
+ // tostring
+ AssertEquals ("PKCS1MaskGenerationMethod ToString()", "System.Security.Cryptography.PKCS1MaskGenerationMethod", pkcs1.ToString ());
+ }
+
+ public void TestEmptyMask ()
+ {
+ // pretty much useless but supported
+ byte[] random = { 0x01 };
+ byte[] mask = pkcs1.GenerateMask (random, 0);
+ AssertEquals ("PKCS1MaskGenerationMethod Empty Mask", 0, mask.Length);
+ }
+
+ public void TestBadParameters ()
+ {
+ try {
+ byte[] mask = pkcs1.GenerateMask (null, 10);
+ Fail ("Expecting NullReferenceException but none");
+ }
+ catch (NullReferenceException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expecting NullReferenceException but got: " + e.ToString ());
+ }
+
+ byte[] random = { 0x01 };
+ try {
+ byte[] mask = pkcs1.GenerateMask (random, -1);
+ Fail ("Expecting OverflowException but none");
+ }
+ catch (OverflowException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expecting OverflowException but got: " + e.ToString ());
+ }
+ }
+
+ // test part of PKCS#1 v.2.1 test vector
+ // FIXME: Commented as we are now compatible with MS implementation
+ // (i.e. not with the PKCS#1 specification).
+/* public void TestPKCS1v21TestVector ()
+ {
+ pkcs1.HashName = "SHA1";
+
+ // seed = random string of octets (well not random in the tests ;-)
+ byte[] seed = { 0xaa, 0xfd, 0x12, 0xf6, 0x59, 0xca, 0xe6, 0x34, 0x89, 0xb4, 0x79, 0xe5, 0x07, 0x6d, 0xde, 0xc2, 0xf0, 0x6c, 0xb5, 0x8f };
+ int LengthDB = 107;
+
+ // dbMask = MGF(seed, length(DB))
+ byte[] dbMask = pkcs1.GenerateMask (seed, LengthDB);
+ byte[] expectedDBMask = { 0x06, 0xe1, 0xde, 0xb2, 0x36, 0x9a, 0xa5, 0xa5, 0xc7, 0x07, 0xd8, 0x2c, 0x8e, 0x4e, 0x93, 0x24,
+ 0x8a, 0xc7, 0x83, 0xde, 0xe0, 0xb2, 0xc0, 0x46, 0x26, 0xf5, 0xaf, 0xf9, 0x3e, 0xdc, 0xfb, 0x25,
+ 0xc9, 0xc2, 0xb3, 0xff, 0x8a, 0xe1, 0x0e, 0x83, 0x9a, 0x2d, 0xdb, 0x4c, 0xdc, 0xfe, 0x4f, 0xf4,
+ 0x77, 0x28, 0xb4, 0xa1, 0xb7, 0xc1, 0x36, 0x2b, 0xaa, 0xd2, 0x9a, 0xb4, 0x8d, 0x28, 0x69, 0xd5,
+ 0x02, 0x41, 0x21, 0x43, 0x58, 0x11, 0x59, 0x1b, 0xe3, 0x92, 0xf9, 0x82, 0xfb, 0x3e, 0x87, 0xd0,
+ 0x95, 0xae, 0xb4, 0x04, 0x48, 0xdb, 0x97, 0x2f, 0x3a, 0xc1, 0x4e, 0xaf, 0xf4, 0x9c, 0x8c, 0x3b,
+ 0x7c, 0xfc, 0x95, 0x1a, 0x51, 0xec, 0xd1, 0xdd, 0xe6, 0x12, 0x64 };;
+ AssertEquals ("PKCS1MaskGenerationMethod 1", expectedDBMask, dbMask);
+
+ // maskedDB = DB xor dbMask
+ byte[] DB = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90,
+ 0xaf, 0xd8, 0x07, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd4, 0x36, 0xe9, 0x95, 0x69,
+ 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ byte[] maskedDB = new byte [dbMask.Length];
+ for (int i = 0; i < dbMask.Length; i++)
+ maskedDB [i] = Convert.ToByte (DB [i] ^ dbMask [i]);
+
+ // seedMask = MGF(maskedDB, length(seed))
+ byte[] seedMask = pkcs1.GenerateMask (maskedDB, seed.Length);
+ byte[] expectedSeedMask = { 0x41, 0x87, 0x0b, 0x5a, 0xb0, 0x29, 0xe6, 0x57, 0xd9, 0x57, 0x50, 0xb5, 0x4c, 0x28, 0x3c, 0x08, 0x72, 0x5d, 0xbe, 0xa9 };
+ AssertEquals ("PKCS1MaskGenerationMethod 2", expectedSeedMask, seedMask);
+ }*/
+
+}
+
+}
+
+
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/PasswordDeriveBytesTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/PasswordDeriveBytesTest.cs
new file mode 100644
index 00000000000..cc1cb02a83c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/PasswordDeriveBytesTest.cs
@@ -0,0 +1,228 @@
+//
+// PasswordDeriveTest.cs - NUnit Test Cases for PasswordDerive
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+// References:
+// a. PKCS#5: Password-Based Cryptography Standard
+// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html
+
+public class PasswordDeriveBytesTest : TestCase
+{
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // generate the key up to HashSize and reset between operations
+ public void ShortRun(string msg, PasswordDeriveBytes pd, byte[] finalKey)
+ {
+ for (int i=0; i < finalKey.Length; i++) {
+ int j = 0;
+ bool compare = true;
+ byte[] key = pd.GetBytes (i+1);
+ for (; j < i; j++) {
+ if (finalKey [j] != key[j]) {
+ compare = false;
+ break;
+ }
+ }
+ Assert (msg + " #" + j, compare);
+ pd.Reset ();
+ }
+ }
+
+ // generate a key at least 1000 bytes and don't reset between operations
+ public void LongRun(string msg, PasswordDeriveBytes pd, byte[] finalKey)
+ {
+ int bloc = finalKey.Length;
+ int iter = (int) ((1000 + bloc - 1) / bloc);
+ byte[] pass = null;
+ for (int i=0; i < iter; i++) {
+ pass = pd.GetBytes (bloc);
+ }
+ AssertEquals (msg, pass, finalKey);
+ }
+
+ public void TestSHA1SaltShortRun ()
+ {
+ byte[] salt = { 0xDE, 0xAD, 0xC0, 0xDE };
+ byte[] key = { 0x0B, 0x61, 0x93, 0x96, 0x3A, 0xFF, 0x0D, 0xFC, 0xF6, 0x3D, 0xA3, 0xDB, 0x34, 0xC2, 0x99, 0x71, 0x69, 0x11, 0x61, 0xB5 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", salt, "SHA1", 1);
+ string msg = "PKCS#5 password salt SHA1 (1)";
+ ShortRun (msg, pd, key);
+ }
+
+ public void TestSHA1SaltLongRun ()
+ {
+ byte[] salt = { 0xDE, 0xAD, 0xC0, 0xDE };
+ byte[] key = { 0x91, 0xDA, 0xF9, 0x9D, 0x7C, 0xA9, 0xB4, 0x42, 0xB8, 0xD9, 0x45, 0xAB, 0x69, 0xEE, 0x12, 0xBC, 0x48, 0xDD, 0x38, 0x74 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", salt, "SHA1", 1);
+ string msg = "PKCS#5-Long password salt SHA1 (1)";
+ LongRun (msg, pd, key);
+ }
+
+ public void TestSHA1NoSaltShortRun ()
+ {
+ byte[] key = { 0x74, 0x61, 0x03, 0x6C, 0xA1, 0xFE, 0x85, 0x3E, 0xD9, 0x3F, 0x03, 0x06, 0x58, 0x45, 0xDE, 0x36, 0x52, 0xEF, 0x4B, 0x68 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("mono", null, "SHA1", 10);
+ string msg = "PKCS#5 mono null SHA1 (10)";
+ ShortRun (msg, pd, key);
+ }
+
+ public void TestSHA1NoSaltLongRun ()
+ {
+ byte[] key = { 0x3A, 0xF8, 0x33, 0x88, 0x39, 0x61, 0x29, 0x75, 0x5C, 0x17, 0xD2, 0x9E, 0x8A, 0x78, 0xEB, 0xBD, 0x89, 0x1E, 0x4C, 0x67 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("mono", null, "SHA1", 10);
+ string msg = "PKCS#5-Long mono null SHA1 (10)";
+ LongRun (msg, pd, key);
+ }
+
+ public void TestMD5SaltShortRun ()
+ {
+ byte[] salt = { 0xDE, 0xAD, 0xC0, 0xDE };
+ byte[] key = { 0xA5, 0x4D, 0x4E, 0xDD, 0x3A, 0x59, 0xAC, 0x98, 0x08, 0xDA, 0xE7, 0xF2, 0x85, 0x2F, 0x7F, 0xF2 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("mono", salt, "MD5", 100);
+ string msg = "PKCS#5 mono salt MD5 (100)";
+ ShortRun (msg, pd, key);
+ }
+
+ public void TestMD5SaltLongRun ()
+ {
+ byte[] salt = { 0xDE, 0xAD, 0xC0, 0xDE };
+ byte[] key = { 0x92, 0x51, 0x4D, 0x10, 0xE1, 0x5F, 0xA8, 0x44, 0xEF, 0xFC, 0x0F, 0x1F, 0x6F, 0x3E, 0x40, 0x36 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("mono", salt, "MD5", 100);
+ string msg = "PKCS#5-Long mono salt MD5 (100)";
+ LongRun (msg, pd, key);
+ }
+
+ public void TestMD5NoSaltShortRun ()
+ {
+ byte[] key = { 0x39, 0xEB, 0x82, 0x84, 0xCF, 0x1A, 0x3B, 0x3C, 0xA1, 0xF2, 0x68, 0xAF, 0xBF, 0xAC, 0x41, 0xA6 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", null, "MD5", 1000);
+ string msg = "PKCS#5 password null MD5 (1000)";
+ ShortRun (msg, pd, key);
+ }
+
+ public void TestMD5NoSaltLongRun ()
+ {
+ byte[] key = { 0x49, 0x3C, 0x00, 0x69, 0xB4, 0x55, 0x21, 0xA4, 0xC9, 0x69, 0x2E, 0xFF, 0xAA, 0xED, 0x4C, 0x72 };
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", null, "MD5", 1000);
+ string msg = "PKCS#5-Long password null MD5 (1000)";
+ LongRun (msg, pd, key);
+ }
+
+ public void TestProperties ()
+ {
+ byte[] salt = { 0xDE, 0xAD, 0xC0, 0xDE };
+ // create object...
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", null, "MD5", 1000);
+ // ...then change all its properties...
+ pd.HashName = "SHA1";
+ pd.Salt = salt;
+ pd.IterationCount = 1;
+ byte[] expectedKey = { 0x0b, 0x61, 0x93, 0x96 };
+ // ... before using it
+ AssertEquals ("PKCS#5 test properties", expectedKey, pd.GetBytes (4));
+ // it should work but if we try to set any properties after GetBytes
+ // they should all throw an exception
+ try {
+ pd.HashName = "SHA256";
+ Fail ("PKCS#5 can't set HashName after GetBytes - expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set HashName after GetBytes - expected CryptographicException but got " + e.ToString ());
+ }
+ try {
+ pd.Salt = expectedKey;
+ Fail ("PKCS#5 can't set Salt after GetBytes - expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set Salt after GetBytes - expected CryptographicException but got " + e.ToString ());
+ }
+ try {
+ pd.IterationCount = 10;
+ Fail ("PKCS#5 can't set IterationCount after GetBytes - expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set IterationCount after GetBytes - expected CryptographicException but got " + e.ToString ());
+ }
+ // same thing after Reset
+ pd.Reset ();
+ try {
+ pd.HashName = "SHA256";
+ Fail ("PKCS#5 can't set HashName after Reset - expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set HashName after Reset - expected CryptographicException but got " + e.ToString ());
+ }
+ try {
+ pd.Salt = expectedKey;
+ Fail ("PKCS#5 can't set Salt after Reset - expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set Salt after Reset - expected CryptographicException but got " + e.ToString ());
+ }
+ try {
+ pd.IterationCount = 10;
+ Fail ("PKCS#5 can't set IterationCount after Reset - expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set IterationCount after Reset - expected CryptographicException but got " + e.ToString ());
+ }
+ }
+
+ // FIXME: should we treat this as a bug or as a feature ?
+ public void TestStrangeBehaviour ()
+ {
+ byte[] salt = { 0xDE, 0xAD, 0xC0, 0xDE };
+ // create object with a salt...
+ PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", salt, "MD5", 1000);
+ // ...then change the salt to null
+ try {
+ pd.Salt = null;
+ Fail ("PKCS#5 can't set Salt to null - expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // do nothing, this is what we (almost) expect
+ }
+ catch (Exception e) {
+ Fail ("PKCS#5 can't set Salt to null - expected NullReferenceException but got " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RC2Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RC2Test.cs
new file mode 100644
index 00000000000..9eb6cd9609a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RC2Test.cs
@@ -0,0 +1,115 @@
+//
+// TestSuite.System.Security.Cryptography.RC2Test.cs
+//
+// Author:
+// Andrew Birkett (andy@nobugs.org)
+//
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class RC2Test : TestCase {
+ private void CheckECB(int effective_bits, byte[] key, byte[] pt, byte[] expected)
+ {
+ RC2 c = RC2.Create();
+ c.Mode = CipherMode.ECB;
+ c.Padding = PaddingMode.Zeros;
+ c.Key = key;
+ c.KeySize = key.Length * 8;
+ c.EffectiveKeySize = effective_bits;
+
+ byte[] iv = new byte[pt.Length];
+ for (int i=0; i < pt.Length; i++) iv[i] = 0;
+
+ ICryptoTransform encryptor = c.CreateEncryptor(key, iv);
+ ICryptoTransform decryptor = c.CreateDecryptor(key, iv);
+
+ byte[] ct = new byte[pt.Length];
+ int n = encryptor.TransformBlock(pt, 0, pt.Length, ct, 0);
+ AssertEquals("EncryptLen", n, pt.Length);
+ for (int i=0; i < n; i++) {
+ AssertEquals("Encrypt" + i, ct[i], expected[i]);
+ }
+
+ byte[] rt = new byte[ct.Length];
+ n = decryptor.TransformBlock(ct, 0, ct.Length, rt, 0);
+ AssertEquals("DecryptLen", n, ct.Length);
+ for (int i=0; i < n; i++) {
+ AssertEquals("Decrypt" + i, rt[i], pt[i]);
+ }
+ }
+
+ public void TestECBVectors()
+ {
+ {
+ byte[] key = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ byte[] pt = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ byte[] ct = { 0x27, 0x8b, 0x27, 0xe4, 0x2e, 0x2f, 0x0d, 0x49 };
+ CheckECB(64, key, pt, ct);
+ }
+
+ {
+ byte[] key = { 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ byte[] pt = { 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
+ byte[] ct = { 0x30, 0x64, 0x9e, 0xdf, 0x9b, 0xe7, 0xd2, 0xc2 };
+ CheckECB(64, key, pt, ct);
+ }
+
+ {
+ byte[] key = { 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
+ 0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2 };
+ byte[] pt = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ byte[] ct = { 0x22, 0x69, 0x55, 0x2a, 0xb0, 0xf8, 0x5c, 0xa6 };
+ CheckECB(128, key, pt, ct);
+ }
+
+ // The following tests work fine with mono corlib, but the MS
+ // corlib doesn't support keys bigger than 128 or smaller than 40
+ // bits, and it doesn't supports effective key sizes which differ
+ // from the key size. So, mono does RC2 better than MS!
+
+ // {
+ // byte[] key = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // byte[] pt = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // byte[] ct = { 0xeb, 0xb7, 0x73, 0xf9, 0x93, 0x27, 0x8e, 0xff };
+ // CheckECB(63, key, pt, ct);
+ // }
+
+ // {
+ // byte[] key = { 0x88 };
+ // byte[] pt = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // byte[] ct = { 0x61, 0xa8, 0xa2, 0x44, 0xad, 0xac, 0xcc, 0xf0 };
+ // CheckECB(64, key, pt, ct);
+ // }
+
+ // {
+ // byte[] key = { 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a };
+ // byte[] pt = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // byte[] ct = { 0x6c, 0xcf, 0x43, 0x08, 0x97, 0x4c, 0x26, 0x7f };
+ // CheckECB(64, key, pt, ct);
+ // }
+
+ // {
+ // byte[] key = { 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
+ // 0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2 };
+ // byte[] pt = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // byte[] ct = { 0x1a, 0x80, 0x7d, 0x27, 0x2b, 0xbe, 0x5d, 0xb1 };
+ // CheckECB(64, key, pt, ct);
+ // }
+
+ // {
+ // byte[] key = { 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
+ // 0x0f, 0x79, 0xc3, 0x84, 0x62, 0x7b, 0xaf, 0xb2,
+ // 0x16, 0xf8, 0x0a, 0x6f, 0x85, 0x92, 0x05, 0x84,
+ // 0xc4, 0x2f, 0xce, 0xb0, 0xbe, 0x25, 0x5d, 0xaf, 0x1e };
+ // byte[] pt = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ // byte[] ct = { 0x5b, 0x78, 0xd3, 0xa4, 0x3d, 0xff, 0xf1, 0xf1 };
+ // CheckECB(129, key, pt, ct);
+ // }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
new file mode 100644
index 00000000000..05fba16f066
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
@@ -0,0 +1,42 @@
+//
+// TestSuite.System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
+//
+// Author:
+// Mark Crichton (crichton@gimp.org)
+//
+
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class RNGCryptoServiceProviderTest : TestCase {
+ private RNGCryptoServiceProvider _algo;
+
+ protected override void SetUp() {
+ _algo = new RNGCryptoServiceProvider();
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestProperties() {
+ Assert("Properties (1)", _algo != null);
+
+ byte[] random = new Byte[25];
+
+ // The C code doesn't throw an exception yet.
+ _algo.GetBytes(random);
+
+ // This one we can check...
+ _algo.GetNonZeroBytes(random);
+
+ foreach (Byte rnd_byte in random) {
+ Assert("Properties (2)", rnd_byte != 0);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
new file mode 100644
index 00000000000..a55856b661a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
@@ -0,0 +1,503 @@
+//
+// RSACryptoServiceProviderTest.cs, NUnit Test Cases for RSACryptoServiceProvider
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RSACryptoServiceProviderTest : TestCase {
+ protected RSA rsa;
+
+ private string sha1OID;
+
+ protected override void SetUp ()
+ {
+ sha1OID = CryptoConfig.MapNameToOID ("SHA1");
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // may also help for RSA descendants
+ public void AssertEquals (string message, RSAParameters expectedKey, RSAParameters actualKey, bool checkPrivateKey)
+ {
+ if (checkPrivateKey) {
+ AssertEquals (message + " P", expectedKey.P, actualKey.P);
+ AssertEquals (message + " Q", expectedKey.Q, actualKey.Q);
+ AssertEquals (message + " D", expectedKey.D, actualKey.D);
+ AssertEquals (message + " DP", expectedKey.DP, actualKey.DP);
+ AssertEquals (message + " DQ", expectedKey.DQ, actualKey.DQ);
+ AssertEquals (message + " InverseQ", expectedKey.InverseQ, actualKey.InverseQ);
+ }
+ AssertEquals (message + " Modulus", expectedKey.Modulus, actualKey.Modulus);
+ AssertEquals (message + " Exponent", expectedKey.Exponent, actualKey.Exponent);
+ }
+
+ public void TestConstructors ()
+ {
+ CspParameters csp = new CspParameters ();
+ RSACryptoServiceProvider rsa1 = new RSACryptoServiceProvider ();
+ RSACryptoServiceProvider rsa2 = new RSACryptoServiceProvider (384);
+// RSACryptoServiceProvider rsa3 = new RSACryptoServiceProvider (csp);
+// RSACryptoServiceProvider rsa4 = new RSACryptoServiceProvider (512, csp);
+ }
+
+ public void TestKeyGeneration ()
+ {
+ RSACryptoServiceProvider key = new RSACryptoServiceProvider ();
+ // Test every valid key size
+ KeySizes LegalKeySize = key.LegalKeySizes[0];
+/* for (int i = LegalKeySize.MinSize; i <= 1024; i += 64) {
+ key = new RSACryptoServiceProvider (i);
+ AssertEquals ("KeySize", i, key.KeySize);
+ }
+ key = new RSACryptoServiceProvider (1536);
+ AssertEquals ("KeySize", 1536, key.KeySize);
+ key = new RSACryptoServiceProvider (2048);
+ AssertEquals ("KeySize", 2048, key.KeySize);*/
+ // Test invalid keypair (too small)
+ try {
+ RSACryptoServiceProvider tooSmallKeyPair = new RSACryptoServiceProvider (256);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ // Test invalid keypair (too big)
+ try {
+ RSACryptoServiceProvider tooBigKeyPair = new RSACryptoServiceProvider (32768);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got: " + e.ToString ());
+ }
+ }
+
+ // all keypairs generated by CryptoAPI on Windows
+ string CapiXml384 = "<RSAKeyValue><Modulus>vWi7cHIntTcrwIoD0zj/fxoJCDfUHtC5xkMe8pJri7G+T6nKs4zRcLDWRDA0cNhf</Modulus><Exponent>AQAB</Exponent><P>5DwRzr4EPAk1NOUSwI/z1yBJzG2EyrhR</P><Q>1HOEBwbXvsrPQvV7C0MWtHJ22UWgwgmv</Q><DP>qQrEtbePM1gujErOJMl59O/5OOw02mDB</DP><DQ>bUFGqXJsavLTaaTidSU4PO4MjqnPBVqD</DQ><InverseQ>Y+XUwMmlI2G63reScAyc9PHvTPX2fwCg</InverseQ><D>o1Ku5cwZf0IegPzBRZ5NeYy6oxJ430V8n4BLZ8G8/N6kRHnXe70OyzwAylPtxjGh</D></RSAKeyValue>";
+ string CapiXml448 = "<RSAKeyValue><Modulus>slPik6EfNCiN2MwhFHngEOqqRlSXeBjmKoLyMVgLCPIQJQqe/BMcyA1gQg4mgionngIgXCMuSOU=</Modulus><Exponent>AQAB</Exponent><P>1mUfmQlTK+Q8sLCCWpsngp7gNc6RANI8mP4v0w==</P><Q>1O77OcIvsaCC6KmemMILqXqm8Bzb3Ud8G9bpZw==</Q><DP>h7L/2fRuAUT4KPm/uCumSWXYEhaJ7xQiqM+SYw==</DP><DQ>fcs1Vbj3ritSSxsx27L/ar9P8hhKd55snpHHTw==</DQ><InverseQ>U7txqL9bAt+BAjqqDfQOAVKTfx3wnAcK5dFx0w==</InverseQ><D>UTV8SEimoiUZu7HyGpYJ4QpMsqyRMgL8xj1Nt0JLKBObONObUBEPAPQKknuE98cM9j/2ufRlrx0=</D></RSAKeyValue>";
+ string CapiXml512 = "<RSAKeyValue><Modulus>0ci216d7QTTKkh2Zknwbqlp/Eva1IfzzIA6JZKSI4lcYWMWKAadU7cJtJ5JKGe1aeMi3Y1CDWCpr8fUL28QEkQ==</Modulus><Exponent>AQAB</Exponent><P>/LakSOv8LQUmt3LXA9kMQPAWGk1l2QrwGFL3/k+T+Wc=</P><Q>1IMl0X1/dOqGbEL3agnvgBctWcQaqC2cTzTp7zJqv0c=</Q><DP>B2FmJuMNeFsgKFdoRCqAmxzn6Fi+UrppDKzPpVO5pJ0=</DP><DQ>gWMwPXJpjefU3EmRljBib9yssgDiMg9DIj6XSBmsQLU=</DQ><InverseQ>/IggsX0boXE6UJoWppUEqw6VT13WXxb8mAds5ebxFmE=</InverseQ><D>i+23mA0Mt6fA3smDoCPMSEroq/uHQk541Q8dMdZVv7JmKBJKk1PCppwISyv7fWKVmRTsnGuEnxZFl4N9IR/qyQ==</D></RSAKeyValue>";
+ string CapiXml576 = "<RSAKeyValue><Modulus>si995MicOWrr2/VlH1rUAhyFMPVLj5PvYHU8P8I8R77kh1ePn66zuJ0jRsMCpenUzYGuVtqgn0VDjiaYjo7cE2PZYESLkKJl</Modulus><Exponent>AQAB</Exponent><P>3wDFrI6eUAh72YxjdZD0b93/a/NEV26pp1c8j5fN3UUzA14r</P><Q>zI0O3NKXCgn3cC3Pe2ZUYEPbQaQDyMdSAiF06L1miwVHu0mv</Q><DP>uQaC/LE4WV8wo0gAHcOvjEG9c2vcAE8pJFcVQG7LuBN6SAkR</DP><DQ>THffOoYvmL0pF3LIweT7XhGAAgYCtChvbAR95BQKJaaPrmBZ</DQ><InverseQ>KTOfvWHp363Cl6r2lXc/gINaRqNo+iWRLeoBa6/vk0Kt5sWn</InverseQ><D>QZ9L9h4Lqvm9s1xEya9htQVb6BPuqAoLdrK2ZaTbHnEnKNEN7oLMr1Ca5zh/E6xXKCmwClWyULeKiYq7vYLUXhaemtT1rN9h</D></RSAKeyValue>";
+ string CapiXml640 = "<RSAKeyValue><Modulus>vqS9CNxiRdSc6x3nJOWnPi7gVA4Vsnhd8cTAaMBKuvI0FRhhDsTRsjr8PeH4Y7yMg8XSucr3I8jkYgapBW8s5hmSvdWZhPHRGEe1MiEIeMM=</Modulus><Exponent>AQAB</Exponent><P>7Ojjp/PqeacLRM/MP76wDnp4k+BpUSbitNwkPBAxL5KcBFVwhp+YVw==</P><Q>zgFxY3BFx/ISEciI3ONux4iXd/cIwxrmq9CS3tBIecHTq0JgjXNPdQ==</Q><DP>TstCdGjOsnlZaSCHuSfN3HLlSaGYxZHeUvLo5kUoZr8nPtW/4DaSbw==</DP><DQ>DCIhn425TnF/hvScuwXaPH5bDYHLTlKDS5NZUy5JVoKICQo7zZkBEQ==</DQ><InverseQ>Xhn+9dXsK07s51n6SyRs3wRJEPwuIaNDq5EQJUQNb2Gbdb4HgdpM2w==</InverseQ><D>JhKALeTVO1zaeZnfL18tpx11b1PgwWOIX2ALjN/aDLuR6ySTPX/Q4I6zBOzVa/KB6VMNNk4abIKUvOp6MBNYIMRMK8veaIJxYrn+JAOShwE=</D></RSAKeyValue>";
+ string CapiXml704 = "<RSAKeyValue><Modulus>wbclY53TAIx2E6uPkYeYNVFPYnHgLDJGO1ZoSQcUm6ccySsJvVWAP9TWLIOTjJh2zaQn5gore87ONk50L/+FMZ5uaNrbxxPCxORBLzBofFaEbFxEfu9g6w==</Modulus><Exponent>AQAB</Exponent><P>80o27emwkBtzYHg/0yoYjwjcgqhtVSktbZ8IZ+tdBEbt7gtnpyDd3rpTjc8=</P><Q>y9XqvMruAcvSJjV4rHnCX5Na4XahLhbrvuSsATirpSV+YaD8LrTd5VHwfiU=</Q><DP>aYoSVhcAPyOJY5oGpgYm7TW84vlJpJ3eVSWeMeaKTWavpIpSBtBdL1fJE0U=</DP><DQ>DDbCPRPP1S24Zu+3TmZxXja/MFliaReYgrTDFcOmjVvEyebSlZ3i2fXh+j0=</DQ><InverseQ>O9RaZjZGqG0stVjpDDUaHGk9JNbFChHL9KQ3Kyb6qBLmDNvwobxPnHY1+k4=</InverseQ><D>Wfgbz2Zvp2OVO5GEvoyBbtHy0sAc46n94HVDPhehxKEax3vLrDnXtM2/IzCxXibWqBBmF8tw156Yo4Av2/EpGxvolidOpTXVxNX4aCb3dy05VQ/6WEem0Q==</D></RSAKeyValue>";
+ string CapiXml768 = "<RSAKeyValue><Modulus>3VQEd4kKl0vQG/OzLDTVcgVqaBG9KAz6NzJOu5a6mlHOYSIG5ybYwOJJpXDzZuXewBChqQNpmxgGAae/SuTy+EDQNzAQ+mzeYrEaD6C8vqwMYVanRcbNYtDC9cxAH6Ef</Modulus><Exponent>AQAB</Exponent><P>/UKWrRmudV9RYnelAK2QqJ0DSE/oKHgVtHQ2AxyJueDnMelyzVrCv7ICnL1ymogp</P><Q>37j+EpSqJRP6JRyGMDXG2mj5UXnEqgqeYXaHHNHNYsFcZWAKitRt8uUQtLz9k6gH</Q><DP>fLkVYUwbeZwmhVqsvOe9LPyeSDdp+rwg3Ey66M9eGFdlJFR2gCFpdWRiGvTFgsr5</DP><DQ>1PuxbZD4NdpB3si7+vOHPvCGwgkRr+vyAcksMcSOKgD47E21W5uGnKFz+Qyev85L</DQ><InverseQ>dnez9inW0taRSo0QzoQ3CNGTfm9qzh9Mlx6GKjnyzLLBJ87cOfzW2qVksBlmkDJx</InverseQ><D>RK5ayIFFQRfsl4/zTMeEaOKXV34Rtcj5KIG6/ulSNKsoIOo/PCHI52oRMn6veYHhHrKclBeqtAlqOJG0xrEy/ZjorBJnCB/ZSoPPuS4h7budjF2zYiBHJkRwZcxhe+nx</D></RSAKeyValue>";
+ string CapiXml832 = "<RSAKeyValue><Modulus>wv35yrTrD3gjLxJEJ6HMOJsUfshcCZKGLwlxZO42TlAHK90vJPT0Q7SekeHqSVi1DJ7AAB7XW7MqoSE4SKVVioQQZSFz/HkA1fklTOaubfwRwv0vy/A3js1xPhwTs/SbDpNlXMoiEAM=</Modulus><Exponent>AQAB</Exponent><P>87j8swLApJhpXG4kXLIN86xkdbh/ccqGlpeVE1EGC0yL9OJhbkKC87nvhmQZKMRqcreaAw==</P><Q>zNCRE+qsVtVPD5o8Kf50HFdTQlZY56IA3DLRLHd0qkpNkrCP3gPJNNhwt5kqewX1dlzSAQ==</Q><DP>VXli5kTo2tC44rmd9wRa8EJdWQvDZlzoppeyqHuZ6wyFaPSbxtd8pY1n+3HPgQShcGoDkQ==</DP><DQ>QK6JcqnFHXMmEb5ay8RRNPYbFDMixpwx+1iNGKbtEC6BCxd5h9rYOzkzd7gGY23BVE0CAQ==</DQ><InverseQ>FMqDOpFyGkiJ74uTwdqFABR9dBcN4x8rpYw5trf5DBOVC1Desh+mRDAZwKPVDLCBpqrg9A==</InverseQ><D>YuJPUbfr2J1xIkbeH0cS/MXQX/cVjZkrySC9y5RuH8q/yEPTy6cZVFh9bbemi2mb7vl2nfWO+VXLN+3OStN0SU3/2XQXfhZm4dqk5iU+R5n5g9kjPBNLH8DIWYjGVgCvBqH59DHhLAE=</D></RSAKeyValue>";
+ string CapiXml896 = "<RSAKeyValue><Modulus>nNiWWLAg2htBUkoBD7DTDIALapuiIt45qHJdPVbRQE5PXTcJUJ2SAEHCtQYtIeQam0WL2D78PIfAf8hGFx/72Ghn9b+NcZ8b7UHTdna+5O6aBOHyaD80FOmyfEjAjI1jS95XnGlqoD0QaDpkk4xnMQ==</Modulus><Exponent>AQAB</Exponent><P>zgkddb3AAG9p8LeF+TbcJ2Q3xvvODITJRmUe55IDOb/BhRF1/JTuCAeuHiOtVWKuxcmsJp464Bc=</P><Q>wuG8338Tyk658L7cByQVoV5/AJx+5RKN6rO0CGrPSGjOkIPDyNzwgpmotelo+NiTEiEiNoa49/c=</Q><DP>Dgl+8VOhLiZpEFZgkU8UhraEOlFTg3TUhbBD/8Dp6VhQJfG/mRrIcNGdIj6KA6Q6hg0sZmEnX7c=</DP><DQ>MuxTsz78h9+8fKkSy5blRA5yN1GtYuRPSyX8BDsMwQoJ9/9GWKVK/4VxbV95e5T0EUexLfhUOw8=</DQ><InverseQ>NbWl5XrJ6hxvE8gpRcj2oc+hAUT96ej6eysD1JTQyV1eKzc9+Mpaoo22tGSrR52s9EZRqHWmKxM=</InverseQ><D>LGd9GRq0EkuJELz20/Rhq7ZMhSAOpQR5GmFWWFlN4IDLIz7DmlkhzoTPlORsvp2Pksn7r3sVeiUbL3S1rXfIpwEjeseHfBYR54d6EqmPABqPj9UoADXDoYA1VYz+Ni2uFYlMC7Wh4kzlT0zYRc1XKQ==</D></RSAKeyValue>";
+ string CapiXml960 = "<RSAKeyValue><Modulus>3nb1VtiEuSii1rnDR+yrarcAHDlvbgLUTJGUvuVEMcvQ3vYNNabwBsM46X8ab78Ac2ZBk2jI2S4736KL2S8C2e8rXva7Jb/j+fyVt6N+NrI3dkNE2NoWZ8VM+rUEdKNvPANbf6n7hvDVfJLCvdCctdtEYACkujsb</Modulus><Exponent>AQAB</Exponent><P>/nWeSPagl8TOHzSKB+CRx4MbxOlIR9RNw3RAbBZq/1r4YZtTvvSutV6e1/2yIWYblHPwiALb/FyB4XUj</P><Q>38/Agt+WwnMNeyv4ngVk0r6ffValkVCMlbPdueEqEXCFqOguTvnneINg7+T1Q1YLPXDtjR6NFGKCLG2p</Q><DP>Kebkcc9rEpLt/mWAdVudpeUJJZvksy9avtzd3u6yH+qzDB+v4roYKvWx4o98TdOqpv+QlFUkNKJnIOFR</DP><DQ>SPH9XKpjCJ1XF34NWfOIGOfoM4G6FNKb/27QJXUtsOFrrtF9xl/NAYpQXd/R0FCK+UuFISmD8dDpfHGB</DQ><InverseQ>9YlJCPfSUw8ZEauBdt9hsAybMD20we2uoNdHdDRKvdTtK8m6spS4ohG2ovzfRkiKSxQVzB3jQoYcK9L6</InverseQ><D>jrmHQYZ78Ebv4g8gCD8A4uAxg+odYVkTV2R3J9nzXHdEtCbr5qYJjG0nUDapgVPrOB48qBQr95o/84RWPdIz3I+Jzpme1c4FpWs1/iXAbA/+xnzDGtXVTnJrMfkOsXt2MYBF7+f7zWGNlOGs+zkt/fP/jeOu76Nh</D></RSAKeyValue>";
+ string CapiXml1024 = "<RSAKeyValue><Modulus>uNXUqvMdjnmd36IS0Gr/lTAp63mZqoayYcN/YHnGs82eVrEWS5vAYqPWx1488BhUBh7kHvVhP5kkKh+i6pfLKAEssy5jnw9h09lgCClBHyntqFT82AlmiaFK8uVkV8rCjDol2nBpvVgNonF+JhQyexWTEI94Phjwvj/6yZRqaLM=</Modulus><Exponent>AQAB</Exponent><P>3GIqx8V+yrPI8jsFd1NYTNxJjodtLNufqmYbn7q6fIaPEdC0QG0fcfYPREfKka8xpZ4K7mqgLjm0ivDWi9Y5Iw==</P><Q>1rTxeoBb9aQcoGLhUEeZQNhY+JhhrGsMtZH4fPxy/30JUtggQmZRR12XdjBZ0KcKmsOMbxCauYD8Y6ozFhKzMQ==</Q><DP>lBMZb3TRRl0aDTd+6rgDQlFY0v1Ha7Z9Rz6oHOCX4IeApZW3JvqrACU2CMi74Lr3/rF74smdqrF3D0vWu8pKRQ==</DP><DQ>SBWZ2UoNFcySe9qW0PAo6Nd6D4SBjnSmYLNwXO4Y4eQl5DWBpylY8n/eoSSckuvyKIGsvYEyoUNH+WIkIq4GkQ==</DQ><InverseQ>M3KkaBwusTLiKBlu048fx1WyRfLLEa7clsU7a4JN5wZ66h7wElKj77r9BCXz5UZFo4j3AiBBC/701S0mVQYXOA==</InverseQ><D>NVIqaa58xk87RfphZxKW7JjaXv3TYKg+6YkWQ+Sdd91HYkbv4Zvq4gnVuenrtm+uPZ3HvU6YYVpyXlyGCRsFFeXMwJ8Y7zrF6KEs+6hJ4jqBELWUoEPrzU4889v8aIoS+BCMYptpkmzvxjfEWdTPbqjd/tJ25ObbavggoST6ScE=</D></RSAKeyValue>";
+ string CapiXml1536 = "<RSAKeyValue><Modulus>1bkuWuGsKLkvSvrYYhOPVD37bARRUw0U5/yRCjam50+gLGKmxAjzaRjhGQUaaeC2S5DioGckqiqr1zkfSLyQ7KQte5oynxkTdT0QCXHJeVWgOWAknX8sNrAVNt97LOrMXXYZ2JsYMmYiVNqJRTaURWXxdJ5XibXMCRL1pfHbwnL4iqUge1tuiQbFod//7pjl90TukIutHVEyf8BFn5LRQJI4xroQdMJg0/vvRSp8jgy0LoeJ8LkTG+RjUe3XsgmT</Modulus><Exponent>AQAB</Exponent><P>8Vz3+1ixDfMPPNENDw17Rmdt8IRM32fRBJ/TX8LYfVkxlCB6m25Pd4SxH7mcdF1sgD3qgC+uKekJZb69Q0XE/CoJxPD6mYq0o4XEsz0rwy4NU/u//YpxZp84v5cDKEoR</P><Q>4q8eodQoHbiuBH5f/WelCnm2Ym22AmFIEIWpwKGY8MlnvpK/pN+N4iXrkeNv7OVofOdE7g0lw5cTbDMZV2eMyEIYKUi7YOXA8TIlSdTuDqW/5mPg0inqNLEg2PZGahVj</Q><DP>lHw7Wve/RPOpBiMdw4rpsfBjZDogCLiXkB67LQhzovnCVHx+sSx12vNY/El2BOiMnYB5yY6LuODSlTN4v/AmNXOvOud9ZAQ/CPJ8hkA1sgecz3PrMxF+nkGJ6eP/X0Ph</DP><DQ>p2cHyh6xGXHfIPZq0OqPmTLVG89FkHBjFcB/4f/0wC0cbkJVQN7PGulCFFTPvTSVe1gXMW2IK+8PquH5nvCbqPAWg7ZwmlhRqk2L+ABFZY/GLdAooUvO5+a/CTqmOYVd</DQ><InverseQ>x3EJeS7EP1h5zuKKITblv0V9R3z6KEQAbKPp3zfckHX1fvuR+3VP4FLU63D0yxd2BOjhGTvyJvjrVSDCP+Ndk+h7ZT9MkzW/i6ifiHG/5L/xaEpxjJGq35OOOuHqCmKc</InverseQ><D>rtTUab3QImQSnuiCmABeMFCf2qXRjPnXj0qZr1wzvmbxpT1yJE0aKXATu27kQ5ZyKXC1IvgdEyLi/aWZxNuURjCrkD/8hw9xTmeMNd2iLaJw9l6CtV/x4C68u+2nCoBq/Gv/ht9RqYRS6ODUTk1aOL1mPNSHT/MeFNK+06lyQNSaf95fMxGPIcnnJ1vtdkHgk2vi5ALSQf5tGIgVY1EFr55M9ABTg1p98XwIQgjIxCZcL4BygfMk1YbESaQFvzth</D></RSAKeyValue>";
+ string CapiXml2048 = "<RSAKeyValue><Modulus>9TFEYeTahPGOXtcRZrLQu1gHm875jv1jgxy0R9V3E/vDyEhNbsRK76rvEs3ljw6spQBQE1zd5wfUvFnhVETOuS0z9aXSAljxSIbyhkL/jT7/4vHEHe/GnBQZPdvJ9PtPr0ssLROy8xcsUEBDwxNRPNHSpmub3FHZzHsoMlJV0cOGmn0qqeMuMrP8zVDycXhXZNsn8v5RPC38qk6VDHdCqGz/90IRYonpFr5my9LaguJHVNCq8BRVa1oJkDtNUFhFXjVHnmxmhS9Mqm2obEpTp/jUk+bRqnygKB3up9OGYdLO1rAv2IoH/K2sxcvnedDzieRmPE/9Y9JBP/UvM+VULw==</Modulus><Exponent>AQAB</Exponent><P>//j7DyPW0E5t1/xvT9iojXQZfu9t/t0bdJMkRQVAYzJL5+UUILOA+70hMtPIvrU4gdeK0CPKfbbkY0UmD4QTb9nFq4aOsHruMZgWIeqHLlEo+VOYX3+hLv+p/aXX+Wj5PvQWLYZBH1sdOLE21nEVHFXZIVev3PcIYU+P0L8R3JE=</P><Q>9Tf9pWu4aWF16h2/nCmY8HAOPNMgcHoC6jtVuJJX+8pio6VLbA862e6ptB7fZdCDDXB2y/52tmG6uAcmOIqUDZB4eLHcOWxnYctcWrvjODMIABno7EuhR7zemelN89ME97zuY7nQSnVRroWD7l3oU5pN3yIe9Y5bnMKgr1nnhL8=</Q><DP>e4AhgZiFGFP+42rEOf4KtNUDSB81LvZ3PLORmEuEWVf3D5eTMoPpA4yo6+EKxhihfuQD8ZCTLjyDzPGb/3h1+E1V9gAh8DwfmIYMh6ikOFCoOEOBDPKDTi3EUsElhwyC1UDnQme4G+zWGHhIQQambNluvYuVKkN2I51Dgi/t6kE=</DP><DQ>ZIzd9Au0pXlyOVqTbDxeWxEHtYc5AQX21gcYgkN30mZNhh7MS3X/QserTJFwNzaF1mfsPn+MPALc5oL/+CVSyjEYRR1hWSaLSb1ylD4A0NWUDT6SlPn6GwlmGaRh833uxorxEXFq6G0s3iwfSgm1rzpRfhJmsXf7Ns9TxjNOTM8=</DQ><InverseQ>uGCs/TRjtVGBXsTV/9fPMMel0L+WbrdqIPu1GBSIiXk8tWWi+P1lACSTf0iCJ6SIKB26N57zAE9r7zaocVX0R/3NJ3+eDDztV9i6AOsK6X/AitxXetPQDIflbbjAEzeZUUJf2onSAITIw6TaAs620a8HpPw3W7Yd0Oe/lt2M+GA=</InverseQ><D>ao8oyuqs1U4ts6YAWAOql2DgnaRL7QrObrLQ3s802yh1o9tYW6VPc+1zzVZSR+P2wBbsth2MCtXqbJkbRoZI2U194WpZZM/GvOB5EkSXz4jrqHOt6dzFEhviBHI6yQ9XSDWBU23WPbN6fL4RNPx2N9pwlAb8S7n+z9FOXOBPj8NyMMtykGqgPyHEAQnuhfLuf/J6OGrHX8dzsZAo6o/bnk49Rv0C6nijE74TeAwJ36UuI9Lw+h6hwtSerEN6o1vy6mIjrjdDM07mKKUMFwkEhKJc6ckBb0xVp/3VRlJb1ocYQHbfjCAPjecR8OVfjaIy9WPMj8WXHegJpiBugWK9wQ==</D></RSAKeyValue>";
+ // limit to 2048 bits (else key won't fit in a line for Visual Studio)
+
+ // import/export XML keypairs
+ // so we know that Mono can use keypairs generated by CryptoAPI
+ public void TestCapiXmlImportExport ()
+ {
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider ();
+
+ rsa.FromXmlString (CapiXml384);
+ AssertEquals ("Capi-Xml384", CapiXml384, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml448);
+ AssertEquals ("Capi-Xml448", CapiXml448, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml512);
+ AssertEquals ("Capi-Xml512", CapiXml512, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml576);
+ AssertEquals ("Capi-Xml576", CapiXml576, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml640);
+ AssertEquals ("Capi-Xml640", CapiXml640, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml704);
+ AssertEquals ("Capi-Xml704", CapiXml704, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml768);
+ AssertEquals ("Capi-Xml768", CapiXml768, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml832);
+ AssertEquals ("Capi-Xml832", CapiXml832, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml896);
+ AssertEquals ("Capi-Xml896", CapiXml896, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml960);
+ AssertEquals ("Capi-Xml960", CapiXml960, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml1024);
+ AssertEquals ("Capi-Xml1024", CapiXml1024, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml1536);
+ AssertEquals ("Capi-Xml1536", CapiXml1536, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (CapiXml2048);
+ AssertEquals ("Capi-Xml2048", CapiXml2048, rsa.ToXmlString (true));
+ }
+
+ // LAMESPEC: SignHash and VerifyHash need an OID string (not the algorithm)
+ // http://www.easycsharp.com/news/dotnet/article.php3?id=25510
+ // LAMESPEC: SignHash and VerifyHash doesn't accept null for algo parameters
+ private void SignAndVerify (string msg, RSACryptoServiceProvider rsa)
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ byte[] sign = rsa.SignHash (hash, sha1OID);
+ // we don't need the private key to verify
+ RSAParameters param = rsa.ExportParameters (false);
+ RSACryptoServiceProvider key = (RSACryptoServiceProvider) RSA.Create ();
+ key.ImportParameters (param);
+ // the signature is never the same so the only way to know if
+ // it worked is to verify it ourselve (i.e. can't compare)
+ bool ok = key.VerifyHash (hash, sha1OID, sign);
+ Assert (msg + "-SignAndVerify", ok);
+ }
+
+ // Validate that we can sign with every keypair and verify the signature
+ // With Mono this means that we can use CAPI keypair to sign and verify.
+ // For Windows this doesn't mean much.
+ public void TestCapiSignature ()
+ {
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider ();
+
+ rsa.FromXmlString (CapiXml384);
+ SignAndVerify ("Capi-384", rsa);
+
+ rsa.FromXmlString (CapiXml448);
+ SignAndVerify ("Capi-448", rsa);
+
+ rsa.FromXmlString (CapiXml512);
+ SignAndVerify ("Capi-512", rsa);
+
+ rsa.FromXmlString (CapiXml576);
+ SignAndVerify ("Capi-576", rsa);
+
+ rsa.FromXmlString (CapiXml640);
+ SignAndVerify ("Capi-640", rsa);
+
+ rsa.FromXmlString (CapiXml704);
+ SignAndVerify ("Capi-704", rsa);
+
+ rsa.FromXmlString (CapiXml768);
+ SignAndVerify ("Capi-768", rsa);
+
+ rsa.FromXmlString (CapiXml832);
+ SignAndVerify ("Capi-832", rsa);
+
+ rsa.FromXmlString (CapiXml896);
+ SignAndVerify ("Capi-896", rsa);
+
+ rsa.FromXmlString (CapiXml960);
+ SignAndVerify ("Capi-960", rsa);
+
+ rsa.FromXmlString (CapiXml1024);
+ SignAndVerify ("Capi-1024", rsa);
+
+ rsa.FromXmlString (CapiXml1536);
+ SignAndVerify ("Capi-1536", rsa);
+
+ rsa.FromXmlString (CapiXml2048);
+ SignAndVerify ("Capi-2048", rsa);
+ }
+
+ // Validate that we can verify a signature made with CAPI
+ // With Mono this means that we can verify CAPI signatures.
+ // For Windows this doesn't mean much.
+ public void TestCapiVerify ()
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider ();
+
+ rsa.FromXmlString (CapiXml384);
+ byte[] sign384 = { 0x6D, 0x6F, 0xE1, 0x17, 0x28, 0x88, 0x0C, 0x72, 0x9D, 0x17, 0xBD, 0x06, 0x02, 0xBA, 0x6D, 0xF0, 0x16, 0x2A, 0xE6, 0x19, 0x40, 0x1D, 0x58, 0xD3, 0x44, 0x70, 0xDE, 0x57, 0x4C, 0xC8, 0xE5, 0x9C, 0x5D, 0xA1, 0x84, 0x7E, 0xD4, 0xC3, 0x61, 0xAA, 0x21, 0xC3, 0x83, 0x5B, 0xAF, 0x1C, 0xB7, 0x2B };
+ Assert ("Capi-384-Verify", rsa.VerifyHash (hash, sha1OID, sign384));
+ sign384[0] = 0x00;
+ Assert ("Capi-384-VerBad", !rsa.VerifyHash (hash, sha1OID, sign384));
+
+ rsa.FromXmlString (CapiXml448);
+ byte[] sign448 = { 0x59, 0xD9, 0x57, 0x80, 0x20, 0x18, 0xF6, 0x23, 0xDB, 0x3A, 0xE3, 0xB0, 0xFD, 0xEA, 0xD3, 0x2A, 0x52, 0x83, 0x41, 0x49, 0x48, 0xD8, 0xD5, 0x4F, 0xE7, 0xDB, 0x7A, 0x97, 0xF9, 0x07, 0x27, 0xD9, 0xAC, 0x60, 0xA2, 0x17, 0x76, 0x70, 0x09, 0x09, 0x23, 0x0E, 0xBF, 0x3D, 0x01, 0x93, 0x91, 0x97, 0xDB, 0xB3, 0x1F, 0x20, 0x78, 0xFA, 0x7E, 0x72 };
+ Assert ("Capi-448-Verify", rsa.VerifyHash (hash, sha1OID, sign448));
+ sign448[0] = 0x00;
+ Assert ("Capi-448-VerBad", !rsa.VerifyHash (hash, sha1OID, sign448));
+
+ rsa.FromXmlString (CapiXml512);
+ byte[] sign512 = { 0x66, 0x80, 0x40, 0x76, 0x01, 0xDA, 0x66, 0xF2, 0x36, 0x5C, 0xCE, 0x4C, 0x47, 0xA1, 0x02, 0x1C, 0x4F, 0xC8, 0xCE, 0xB2, 0x01, 0xC2, 0xD1, 0x54, 0x55, 0x41, 0xAF, 0x12, 0x60, 0xD7, 0x49, 0x9A, 0x4B, 0x37, 0x20, 0x1A, 0x2A, 0xD8, 0x2B, 0x82, 0xCA, 0x84, 0xAF, 0xB3, 0xB1, 0x4D, 0xA9, 0x0B, 0x70, 0x17, 0x3B, 0xD8, 0x17, 0xAA, 0x51, 0xE7, 0x1F, 0xB7, 0xCF, 0xD8, 0xF9, 0x32, 0x60, 0x01 };
+ Assert ("Capi-512-Verify", rsa.VerifyHash (hash, sha1OID, sign512));
+ sign512[0] = 0x00;
+ Assert ("Capi-512-VerBad", !rsa.VerifyHash (hash, sha1OID, sign512));
+
+ rsa.FromXmlString (CapiXml576);
+ byte[] sign576 = { 0x25, 0x39, 0x21, 0xDE, 0x34, 0x23, 0xEC, 0xFE, 0xEC, 0x28, 0xB2, 0xEA, 0x8D, 0x5A, 0x6C, 0x4B, 0x86, 0x2B, 0xEA, 0x6E, 0xB7, 0xBA, 0x1A, 0x38, 0x6A, 0x8C, 0xC9, 0xC5, 0xC1, 0x89, 0x84, 0x9F, 0x97, 0x5B, 0xA0, 0x58, 0xD6, 0x08, 0x09, 0x5B, 0x4C, 0x9A, 0x9F, 0xFF, 0x10, 0x8B, 0xD1, 0xEA, 0xED, 0x81, 0x62, 0x2D, 0x09, 0x87, 0x81, 0xED, 0x76, 0xCF, 0x47, 0xB8, 0xF8, 0x06, 0x84, 0x80, 0x8E, 0xBC, 0x8C, 0xDF, 0xF2, 0xEE, 0xAB, 0x47 };
+ Assert ("Capi-576-Verify", rsa.VerifyHash (hash, sha1OID, sign576));
+ sign576[0] = 0x00;
+ Assert ("Capi-576-VerBad", !rsa.VerifyHash (hash, sha1OID, sign576));
+
+ rsa.FromXmlString (CapiXml640);
+ byte[] sign640 = { 0x7E, 0x58, 0x16, 0x4E, 0xD9, 0xFE, 0x4D, 0x73, 0x2E, 0x6D, 0x5B, 0x62, 0x05, 0x91, 0x43, 0xA4, 0xEF, 0x65, 0xA9, 0x68, 0xA6, 0x19, 0x65, 0x8F, 0x25, 0xBC, 0x2B, 0xE2, 0x93, 0xE2, 0xEF, 0x5E, 0x29, 0x11, 0x0C, 0xCE, 0x17, 0x01, 0x5D, 0xB7, 0x71, 0x79, 0x83, 0xC5, 0xAB, 0x51, 0xBF, 0x87, 0x80, 0x4A, 0x04, 0x7B, 0xB4, 0x46, 0xCA, 0x11, 0x71, 0xB1, 0x67, 0x28, 0x4C, 0x16, 0x82, 0x6B, 0xE3, 0x11, 0x72, 0x6D, 0xA9, 0x07, 0x4A, 0xE6, 0x33, 0x45, 0x30, 0x15, 0x83, 0x23, 0x5E, 0x05 };
+ Assert ("Capi-640-Verify", rsa.VerifyHash (hash, sha1OID, sign640));
+ sign640[0] = 0x00;
+ Assert ("Capi-640-VerBad", !rsa.VerifyHash (hash, sha1OID, sign640));
+
+ rsa.FromXmlString (CapiXml704);
+ byte[] sign704 = { 0x91, 0x3C, 0x91, 0x7C, 0x2A, 0x26, 0xB1, 0x6F, 0x7C, 0xFD, 0x75, 0xCC, 0xB0, 0x63, 0x03, 0x76, 0xBF, 0x93, 0xAB, 0x3B, 0xD4, 0x71, 0x86, 0x86, 0xEF, 0x10, 0xD6, 0x51, 0x8D, 0x6B, 0xB4, 0xF2, 0xF9, 0xCC, 0x50, 0x3A, 0x63, 0x9A, 0xD2, 0xA2, 0xE2, 0x72, 0x06, 0x88, 0x4E, 0xCD, 0x38, 0x9B, 0x87, 0x72, 0xAD, 0x38, 0xF7, 0xCB, 0x6B, 0x69, 0x43, 0xA0, 0x4C, 0x9B, 0x10, 0x17, 0xAB, 0xE8, 0x50, 0x34, 0x6E, 0x8D, 0x56, 0xBC, 0x6C, 0x00, 0x87, 0x40, 0x05, 0x4A, 0x20, 0x16, 0x49, 0x4F, 0x93, 0x48, 0x5F, 0x7A, 0x10, 0x61, 0xC6, 0xC9 };
+ Assert ("Capi-704-Verify", rsa.VerifyHash (hash, sha1OID, sign704));
+ sign704[0] = 0x00;
+ Assert ("Capi-704-VerBad", !rsa.VerifyHash (hash, sha1OID, sign704));
+
+ rsa.FromXmlString (CapiXml768);
+ byte[] sign768 = { 0x0D, 0x67, 0x37, 0x00, 0x3E, 0xD5, 0x02, 0x12, 0xF0, 0xF9, 0xC2, 0x63, 0x29, 0xD9, 0xEA, 0x7B, 0xDC, 0x5B, 0xF3, 0xF0, 0xB9, 0x3B, 0x04, 0x98, 0xD9, 0xE7, 0xA3, 0xB2, 0xD2, 0x01, 0x04, 0x7A, 0xF4, 0x11, 0x7F, 0x62, 0xC7, 0x18, 0x14, 0xA0, 0x54, 0x96, 0x51, 0x84, 0xC4, 0x6D, 0x6A, 0xCB, 0x67, 0x07, 0xD0, 0x33, 0x93, 0x99, 0xAD, 0x1F, 0x16, 0xA6, 0x7F, 0xE0, 0x60, 0x8A, 0xDC, 0x95, 0xB9, 0x0E, 0x68, 0xA9, 0x78, 0xE1, 0x0D, 0x47, 0x56, 0xF3, 0x01, 0x42, 0xF6, 0xD7, 0xE4, 0x4A, 0x98, 0x7E, 0xC4, 0x5E, 0x0E, 0x09, 0xC4, 0x92, 0x42, 0x69, 0x74, 0x7A, 0xC9, 0x0E, 0x9F, 0xF2 };
+ Assert ("Capi-768-Verify", rsa.VerifyHash (hash, sha1OID, sign768));
+ sign768[0] = 0x00;
+ Assert ("Capi-768-VerBad", !rsa.VerifyHash (hash, sha1OID, sign768));
+
+ rsa.FromXmlString (CapiXml832);
+ byte[] sign832 = { 0x7B, 0xBC, 0xE6, 0xEC, 0x8B, 0x11, 0x7C, 0x28, 0x09, 0x3A, 0x06, 0x81, 0x52, 0x20, 0x7B, 0x50, 0x88, 0x74, 0x3C, 0x96, 0xBC, 0x40, 0xAF, 0x8E, 0xD3, 0x60, 0x49, 0xBF, 0x93, 0x6C, 0xF6, 0xE9, 0x34, 0xAB, 0x7E, 0xE7, 0x56, 0x2E, 0x33, 0x5A, 0x75, 0x4E, 0xFE, 0xFF, 0xC8, 0x15, 0x02, 0x8C, 0x30, 0x81, 0xD0, 0x46, 0x68, 0x42, 0x2E, 0xA8, 0x78, 0x5C, 0xDE, 0xEA, 0x98, 0x79, 0x81, 0xBF, 0xEA, 0xC4, 0x8B, 0x2F, 0x50, 0x7A, 0x50, 0x11, 0xAC, 0x01, 0xEB, 0x84, 0xA0, 0x9F, 0x7A, 0x67, 0xFA, 0x33, 0x3A, 0x65, 0x1C, 0xE9, 0xFA, 0xD9, 0x46, 0x06, 0xAF, 0x3E, 0x83, 0x4A, 0x67, 0x11, 0x0B, 0xD5, 0xD2, 0x56, 0x5E, 0x05, 0x69, 0xE8 };
+ Assert ("Capi-832-Verify", rsa.VerifyHash (hash, sha1OID, sign832));
+ sign832[0] = 0x00;
+ Assert ("Capi-832-VerBad", !rsa.VerifyHash (hash, sha1OID, sign832));
+
+ rsa.FromXmlString (CapiXml896);
+ byte[] sign896 = { 0x60, 0xAA, 0x26, 0x4D, 0xBF, 0x0A, 0x38, 0x5E, 0x7B, 0x66, 0x1E, 0x1D, 0xED, 0x5F, 0xF2, 0x6A, 0xC4, 0xAB, 0x35, 0x43, 0x93, 0x67, 0x26, 0x90, 0xEB, 0x34, 0xC1, 0xCB, 0x22, 0x4C, 0x20, 0x00, 0xE5, 0xEB, 0xA8, 0x14, 0x06, 0x8A, 0xBD, 0x0A, 0x07, 0x02, 0x62, 0xC9, 0x82, 0x27, 0x84, 0x1D, 0x04, 0xC6, 0xFC, 0x20, 0xE4, 0x17, 0x07, 0x33, 0x03, 0xE7, 0x33, 0x8D, 0x4A, 0x69, 0x79, 0x51, 0xA5, 0x20, 0xED, 0xB8, 0x94, 0x02, 0x0B, 0xD2, 0xB9, 0x60, 0x71, 0x56, 0x47, 0x96, 0xE8, 0xA7, 0x1A, 0x4A, 0x71, 0xD8, 0xD1, 0x0C, 0x82, 0x86, 0xF9, 0x1C, 0x07, 0x46, 0xB6, 0x0F, 0xCB, 0x8C, 0x90, 0x95, 0x93, 0xBA, 0xF2, 0xC3, 0xB4, 0x68, 0xE8, 0xE4, 0x55, 0x6C, 0xEA, 0x1D, 0xA7, 0x53 };
+ Assert ("Capi-896-Verify", rsa.VerifyHash (hash, sha1OID, sign896));
+ sign896[0] = 0x00;
+ Assert ("Capi-896-VerBad", !rsa.VerifyHash (hash, sha1OID, sign896));
+
+ rsa.FromXmlString (CapiXml960);
+ byte[] sign960 = { 0x57, 0x36, 0xBD, 0xF3, 0x5D, 0x99, 0x9A, 0x73, 0xF1, 0xE6, 0xC1, 0x4C, 0xDC, 0xBF, 0x5D, 0xC1, 0xC0, 0x7D, 0x32, 0x46, 0x2B, 0x0B, 0x51, 0xDB, 0x56, 0xA8, 0x25, 0xE7, 0xF9, 0x76, 0xB0, 0x0F, 0xC1, 0xBD, 0x49, 0x5E, 0x14, 0xF8, 0x1F, 0xD9, 0x94, 0x41, 0xA7, 0x4B, 0xF8, 0x9C, 0x4A, 0x9B, 0xA5, 0xF8, 0xDF, 0xE6, 0xF5, 0xF7, 0x6D, 0xFB, 0x59, 0x24, 0x9F, 0xAE, 0xBA, 0xDF, 0x51, 0x2F, 0xB2, 0x68, 0xF1, 0x35, 0xFB, 0xCC, 0xF7, 0x1D, 0x86, 0x2A, 0x2E, 0x53, 0x9F, 0xCA, 0xBC, 0x58, 0xBF, 0x6A, 0xBD, 0x3A, 0xAB, 0xCA, 0x64, 0x92, 0x42, 0x97, 0x87, 0x00, 0xEE, 0x4A, 0x3F, 0xE5, 0xED, 0x20, 0x49, 0xF4, 0x06, 0x53, 0xBA, 0xF8, 0x9D, 0x62, 0xC4, 0xC7, 0x99, 0x3E, 0x9C, 0xF9, 0xF1, 0xA6, 0xF7, 0x0D, 0x21, 0xBC, 0xF2, 0x8D };
+ Assert ("Capi-960-Verify", rsa.VerifyHash (hash, sha1OID, sign960));
+ sign960[0] = 0x00;
+ Assert ("Capi-960-VerBad", !rsa.VerifyHash (hash, sha1OID, sign960));
+
+ rsa.FromXmlString (CapiXml1024);
+ byte[] sign1024 = { 0x30, 0xB9, 0x7F, 0xBC, 0x72, 0x75, 0xB4, 0xEE, 0x8F, 0x8F, 0xF1, 0xB9, 0xC3, 0xCB, 0xC0, 0xB2, 0x94, 0x8C, 0x1D, 0xB0, 0x60, 0xE8, 0x5E, 0x8D, 0x3F, 0x36, 0xF2, 0x4E, 0x09, 0xCD, 0x48, 0x85, 0xD3, 0x93, 0xEC, 0xEB, 0x08, 0xA6, 0xD1, 0xEF, 0x9F, 0xF5, 0xAB, 0x2D, 0x30, 0x3E, 0x86, 0x64, 0x8F, 0x9B, 0xB4, 0x0F, 0xDB, 0x70, 0x4A, 0x59, 0x8D, 0x6F, 0x14, 0x03, 0xFE, 0x46, 0xFC, 0x81, 0xA8, 0xC9, 0x75, 0x40, 0xEE, 0xB1, 0xED, 0xC4, 0xD0, 0xE5, 0xE5, 0x8F, 0xCD, 0x10, 0x01, 0xB2, 0x9D, 0xFD, 0xE6, 0x1E, 0x43, 0x3A, 0x69, 0xDB, 0xF9, 0x6D, 0xC9, 0xDD, 0x57, 0x9C, 0x84, 0x94, 0x7D, 0x0C, 0xDC, 0xFA, 0xD9, 0xDA, 0xE6, 0x90, 0xBA, 0x8C, 0x15, 0x68, 0xEA, 0x09, 0xEE, 0x8D, 0x5D, 0x5D, 0x73, 0xDE, 0xD1, 0x76, 0xE2, 0xF1, 0x48, 0x23, 0x57, 0xA6, 0xFA, 0x37, 0x57, 0xE7 };
+ Assert ("Capi-1024-Verify", rsa.VerifyHash (hash, sha1OID, sign1024));
+ sign1024[0] = 0x00;
+ Assert ("Capi-1024-VerBad", !rsa.VerifyHash (hash, sha1OID, sign1024));
+
+ rsa.FromXmlString (CapiXml1536);
+ byte[] sign1536 = { 0x38, 0x0B, 0x7A, 0xF8, 0x64, 0xEB, 0x21, 0xCA, 0xC6, 0x7F, 0x09, 0x40, 0xD0, 0x92, 0x8C, 0x96, 0xEE, 0x47, 0x05, 0xFE, 0x17, 0xE9, 0x93, 0x97, 0xEF, 0x9F, 0xC0, 0xF1, 0xF5, 0x41, 0x91, 0x83, 0xEA, 0x77, 0x1B, 0x6A, 0x77, 0x4A, 0x14, 0xE2, 0xD9, 0x88, 0x8D, 0x8E, 0x91, 0xAF, 0x26, 0x87, 0xB9, 0xBC, 0x14, 0x52, 0xBD, 0xAD, 0x7E, 0x90, 0x00, 0x33, 0x1B, 0xF0, 0x08, 0x41, 0x7E, 0x77, 0x55, 0x4E, 0xAA, 0xF3, 0xAC, 0x8F, 0x00, 0x76, 0x25, 0xC0, 0x72, 0x88, 0xC0, 0xA4, 0x03, 0x46, 0xCC, 0xBC, 0xFE, 0x5A, 0x44, 0x10, 0x0D, 0x14, 0x7F, 0x65, 0x2E, 0x47, 0x55, 0x85, 0xF6, 0xC9, 0xEB, 0x60, 0x84, 0x09, 0x91, 0x3D, 0xAC, 0x8E, 0x40, 0x44, 0xE5, 0x7C, 0x4F, 0xAE, 0xA4, 0x21, 0x7D, 0x16, 0x27, 0xFC, 0x0E, 0xC5, 0x6B, 0x0C, 0x63, 0xA9, 0x1E, 0x0E, 0xCF, 0x9E, 0x8E, 0xFF, 0xA9, 0xA5, 0xB3, 0x87, 0xDC, 0x80, 0x71, 0xA2, 0x4F, 0x21, 0x80, 0xC2, 0x88, 0xC0, 0xA4, 0x99, 0x46, 0x96, 0x25, 0xFB, 0x73, 0x16, 0xCA, 0x97, 0x25, 0x5A, 0x92, 0x19, 0x50, 0xCD, 0xBA, 0xA0, 0x6D, 0xCA, 0x9F, 0x23, 0x14, 0x71, 0x51, 0xB8, 0x94, 0x47, 0xAC, 0xEE, 0x12, 0x53, 0x24, 0x7E, 0xF4, 0xD0, 0xD9, 0x51, 0x89, 0xDA, 0x1C, 0x6F, 0xDE, 0x51, 0x9A, 0xD9, 0xDA, 0xA0, 0xE5, 0xBE };
+ Assert ("Capi-1536-Verify", rsa.VerifyHash (hash, sha1OID, sign1536));
+ sign1536[0] = 0x00;
+ Assert ("Capi-1536-VerBad", !rsa.VerifyHash (hash, sha1OID, sign1536));
+
+ rsa.FromXmlString (CapiXml2048);
+ byte[] sign2048 = { 0x62, 0xB8, 0xE3, 0xD0, 0x8B, 0x8E, 0x00, 0xFA, 0x59, 0x17, 0xC7, 0x0C, 0x81, 0x76, 0x3A, 0x35, 0xAA, 0xC7, 0xE4, 0xFA, 0x7C, 0x96, 0x9C, 0x88, 0x15, 0x88, 0xA5, 0xA6, 0x7C, 0x95, 0x55, 0xC5, 0xDD, 0xA5, 0x83, 0x25, 0x33, 0xFF, 0xEE, 0x9E, 0xDD, 0xF1, 0xF1, 0x85, 0xB3, 0xEE, 0x78, 0x11, 0xC7, 0x83, 0xA6, 0xD8, 0xB4, 0x34, 0xC4, 0x73, 0x2A, 0xE5, 0xC9, 0x2A, 0x5F, 0x5C, 0xF5, 0xAB, 0xB0, 0xB6, 0xAD, 0x52, 0xB3, 0xBA, 0x31, 0x0E, 0x5A, 0x09, 0xB1, 0x74, 0x90, 0xCC, 0xC7, 0x7C, 0x58, 0x2D, 0x49, 0x9F, 0xDC, 0x6F, 0x03, 0x58, 0xB0, 0x1D, 0xFA, 0x7F, 0xE5, 0x8E, 0x09, 0xAC, 0x17, 0xCF, 0xD8, 0x0F, 0xE0, 0x1F, 0x1B, 0xDD, 0x72, 0xA5, 0xCA, 0x5E, 0x51, 0x2F, 0x52, 0xD9, 0x66, 0xE9, 0xA5, 0x78, 0xCE, 0xE4, 0x73, 0x63, 0xCA, 0xE5, 0x58, 0x30, 0xE9, 0xB9, 0x57, 0x07, 0x56, 0x77, 0x67, 0xFC, 0xBC, 0xE2, 0xF6, 0xAF, 0xD6, 0x5D, 0x02, 0xBB, 0x14, 0x47, 0xD2, 0xDF, 0x12, 0xC8, 0x42, 0xF0, 0xA5, 0x42, 0x3B, 0x90, 0xB3, 0xC8, 0x9D, 0xD7, 0xB6, 0x89, 0x25, 0xDA, 0x7D, 0xC2, 0x53, 0x94, 0x1D, 0x20, 0x8E, 0x2C, 0x96, 0x32, 0x43, 0x4C, 0xE1, 0x20, 0x64, 0xEC, 0x15, 0xC5, 0x44, 0xEE, 0xCB, 0xEC, 0x89, 0xBF, 0x84, 0x1E, 0x93, 0x2B, 0x87, 0xEC, 0xE4, 0x97, 0x66, 0xF8, 0xD7, 0xD5, 0x4B, 0xFF, 0x9D, 0x4B, 0x5E, 0x73, 0xFA, 0x11, 0x50, 0xD5, 0xA0, 0xF3, 0x7C, 0x3D, 0xD8, 0x7B, 0x12, 0x04, 0xE8, 0xB7, 0x27, 0x5A, 0x11, 0xF0, 0x65, 0x33, 0x13, 0xC6, 0xDC, 0xC1, 0xFB, 0xD1, 0x7A, 0x93, 0xCF, 0x1B, 0xFB, 0x12, 0x72, 0xF6, 0xD9, 0x6F, 0x38, 0x0B, 0xFE, 0xBE, 0x4D, 0xE0, 0xF8, 0xEB, 0x21, 0xAE, 0x5D, 0xD2, 0x7C, 0x81, 0x74, 0x0A, 0x47, 0x1E };
+ Assert ("Capi-2048-Verify", rsa.VerifyHash (hash, sha1OID, sign2048));
+ sign2048[0] = 0x00;
+ Assert ("Capi-2048-VerBad", !rsa.VerifyHash (hash, sha1OID, sign2048));
+ }
+
+ // all keypairs generated by Mono on Windows
+ string MonoXml384 = "<RSAKeyValue><Modulus>i9COhlY/aGJD+B0fjUtOR+bbDkKyrwDzXzvwbBE8TJmtFYNrjfLHOj/gjdKCEcqb</Modulus><Exponent>EQ==</Exponent><P>tJ2yzv36kToJOy2vURzL9X+W0YsKiHZr</P><Q>xitaV4u8NRFVtIuFvYWArakoLHFeUiiR</Q><DP>dN6CwiveXfhgU3fp6TDANXCs4fCOWEyf</DP><DQ>aOnGapVFhYGl2A2hKBmAW/AkU8OMSZ0B</DQ><InverseQ>bU13UMhy7nsqfFtm7AhyjkJT4GCd/OPT</InverseQ><D>GKxVYwApTqft4H2cJ/46/aE1tzjyWx5IzfYoG1Qmnzr+u1/rf+EGkyIzGWIEcyXR</D></RSAKeyValue>";
+ string MonoXml448 = "<RSAKeyValue><Modulus>rGhbXQawiO5muvnbq7FuVZc3QuFp2CZNqHekmRA/fdUzmUP6jFH7usaVh1kZ+Fk0em0fJzjOYgU=</Modulus><Exponent>EQ==</Exponent><P>rp5tO6WKHonnIRHxS8e566iNe20quz30u3R2Yw==</P><Q>/MIc/2TV6WPi9ddM5NzLeaukuv7pmZf/VfFedw==</Q><DP>j83DXkwXZHGRKksC8xzzdscLGlnm9I1gIedwjQ==</DP><DQ>hdAteCZTITThkTW/S/xruOJmROFOfn2lS53mtw==</DQ><InverseQ>L0fk3nG45E5WbtKkFODlQjMQGIdSEwlsvt/TYA==</InverseQ><D>ZWqQGJqF9jHiE6IIv1lP9hy3GEhcYQd4+a/KOvAKrWm95W6eF+aDWFgzao9lR1/BLP86HhcucSk=</D></RSAKeyValue>";
+ string MonoXml512 = "<RSAKeyValue><Modulus>jq1Bst+LWM5ScL29w+C/GVULDAebcT0Kl9ERGp/I2A2qJ4jHuzr7ltoQqtVGRquQwwDZQ/o1fH99bWraz5Fi7w==</Modulus><Exponent>EQ==</Exponent><P>1O1TVs0UsUSx7Vjg7H/nJnZyfteeLNmUSAPylutaXmk=</P><Q>q4nwfMxpskF8TIRVmcTl1yHcu9rlaMt50Tb/skhFu5c=</Q><DP>ica9dGaU6yxzIRtkXMs7NwFZJOXe0bn2iPN+2h/RD+k=</DP><DQ>MnPdUeHEu/Ukjvm+0t+O5OvXgous4pYy4y5LNG+cCf8=</DQ><InverseQ>fAvQlMRGT5B/FPjQBeArxevr9DN59L0JfhN5qO84pLs=</InverseQ><D>bRsUH1+my3CZZUXNWY2/T5tizPbCKWrp+5/f5y7k4XK2d7xCN+qSZxn+nT0patdhewBMFOI9/xp5zD4U/seSIQ==</D></RSAKeyValue>";
+ string MonoXml576 = "<RSAKeyValue><Modulus>h18QgR8YiVXKVmcTRuPfHljm9Yz5vPt9UXg25GU2WztihEihEyZYMJaRzEb8/iS7eGg7jLXW8SrxhyLUnXfgWvtn/9uNGinj</Modulus><Exponent>EQ==</Exponent><P>x3NP/zn0CxxHMoce7+3UbMtWbtZCxxZZGMID5OCJKGeJUYZF</P><Q>rcC07OWzbx2h827VnJlAWlmxmRRGIaXFOp10tNG8C1bE4GYH</Q><DP>UiBsO+qvyFbwI91I+WHuDq4Uh/3fQusVoMhb9NTtLsE4ivsN</DP><DQ>mU+usujLgCk0i3/pqEr8i/TJ4Ww94XQmfwNm+eY8gnm8xf+r</DQ><InverseQ>KqPD9+C3p6VF6KLOhkyEOLtBlImFMY3kK79+1bmJLjEdyzUH</InverseQ><D>b3t3AOxujzeXknMA0Pfk69C+M6FGIyl2Qxe0vBcdtItCEpYpGKlxv+l1rPu1/VOy4F8Q3u+5dMuhc2OlLfX7F6WkL5+dN7pB</D></RSAKeyValue>";
+ string MonoXml640 = "<RSAKeyValue><Modulus>4YELOUiQPs7Nw6AM2m14LxuKDk1dXGYhvKczD6mB2//U4sitp+MFReJ0ot840hQNwwCssw8hyyniFqIvSjKJknv+HFL4Lc3AyCP3pL5iFf0=</Modulus><Exponent>EQ==</Exponent><P>9Q+nEGCtAF5MIk3lFGn0YtMYSYGM9JI2Ai16dS10Dx6Wxeq1bnVHLw==</P><Q>65Ho89urLekWoDLeZb2ManjaLQS7se6A0eM+Sj54cFnHj8UDe0uqkw==</Q><DP>rPv9dPjyltkmrs2SpP9/VNE+UgEYNCr48np0jvLogySmqdLabBaMmQ==</DP><DQ>UyRwVhFLeZ2Pg9W356xPrRuYTB/JxlQtd0ElCyUbcvKCqzZ5swulnQ==</DQ><InverseQ>5OZh1s2cw3Ydxa+abpooyXC08yJwNS9omtFIl9ct2HZkK4EKvhqJvg==</InverseQ><D>rHG9SewyEelwLC8Y40SnMxUPOB0LKIpWCLwX/OsI84dmj04qcVNAQxB0O5hmt5GXswJd1VPOdRmf/YrMiLZhIHFbLgdrQP+gyWGCSu3koz0=</D></RSAKeyValue>";
+ string MonoXml704 = "<RSAKeyValue><Modulus>mUDm0P3S9oPB06NJT5oDFS5+Xy/ACBvGdkvNjCiZo9bOLvVpOsiih9ipWZw9zQInjfP0uhGqDBkl9jw61yEHIqed151b9hkO2cmfb2o3GvPkbXkoMcoxBQ==</Modulus><Exponent>EQ==</Exponent><P>sMV0t0i+ucYTdpvFTL9lzhxTC902auu5vMDf5Q45WAiu57e9WcGNGbx3PqU=</P><Q>3fEKYrtMZmXoL/vf4xnrRDKpt106zSyrwaVnq5vwrQUZGqj/zPx+umBj+uE=</Q><DP>FMvvnRed97zzOyFigX/t3ANVEHRgwUjorMtlonok3S4ysdlhkhbFTlJoYbk=</DP><DQ>nKolct6QSEfvMO4HcyFaxrpZrpwpgcUt8hpnS/Wa1HwRuHdLJ0jR7Pi/C3E=</DQ><InverseQ>Sy1FwjQNv201hd5uEVIDrxuCXHAnCA5G8p2XDTGee+mlGnMqFvrNKdR57VM=</InverseQ><D>WiYta+CaNqfbbW8cELTywSpodDo0uXnACVnENFQeJCQA0FQfyDnJBJ2Qy0vuhbaAbz2qNXZcYp6QxbeBQQZGEB//nahkNns7KxKXDEFMMU1ghU9eoubr8Q==</D></RSAKeyValue>";
+ string MonoXml768 = "<RSAKeyValue><Modulus>pnVBGKuCV1sdnZP7yHMKlMnyc+4MZicSRDu6ESWPKUx/Ab2fbwwOoHDE5pSW/wCGziaEA2Agfwt6YKAr/JyPmcBcHichUjhzjDvExBrdd3jmQ1WjjNzV829+qSEq0kUl</Modulus><Exponent>EQ==</Exponent><P>u3CSNJ8PqWVfZkLnDBKFGk9EhGnY2poXTBR8aWqLDoa/nG1OPB4Zx0CjwNyR5mSH</P><Q>41gBCJ7TC5URUbKIqzfxQKcoDbz45tJ/1/h0nhGGXehGHYFWlNeKDMcqLtPDB5/z</Q><DP>NyEb8Vv1jCzf0shiEpwJB7z2CNPWXmmOYausHwE39Taw06etmTYHlPTk3l79vDuv</DP><DQ>uzlqQ1Wevj6Gu8A0UMSoj5i3ktfcCWIO7hfnkTub1N1m6x84PlcmZOBA20T69zht</DQ><InverseQ>sJSC1ons7852EcNt7Cctp8ryAvWZxndAz2/W5vcLVi4sk5+6EQ8Kfyw66hYNPvTO</InverseQ><D>kt/uJNORH+b8A4KS3gsndDm3z7Ps0prx//h3ABIU6DRwEJhBYfuUb3KPnkbflbUqONprCS1FlC0mo+Hxald/r99a5PE3JWiVTN4GHuZ3zYEviEvRtNsOG7XYKydTUO3F</D></RSAKeyValue>";
+ string MonoXml832 = "<RSAKeyValue><Modulus>3dVclQYr1ks5x8VXLcO0H0BRNlmg/XT01IFso0aQY5AwU/kFbDUwTSrmSZCuRBk2blp14BYvpwpviuP9WkIcjhTSuPwPD1XWSl33WHSWEc6uYEHxjn0gieHK3SiyVAgOrcVXtOaNJck=</Modulus><Exponent>EQ==</Exponent><P>5BX1qdEJBAhdRC3YXMur5Hs2AfznVNExYbkj7wrK3qLxpQOLQk+TSk8PzWFoOx4xnDG98w==</P><Q>+PuDZFrHTTsSLXrrbS7PhQTWd5BHEqVifUttqI+YSx3pRTxFmfulj5m8uccDE775VrUwUw==</Q><DP>KEAcSyTjeS6nDAgXH288c51FxB2SPCTqmMZRoqeNNlj9d3kYkzs4HCwR2PMSZMkX0EUDZw==</DP><DQ>K/AmPuLX4HPWCAaiBDVv6kwl2N05t/8RYWep8JHPlMkLDDfQDB1Zc7G35IyIEosc8S8Ihw==</DQ><InverseQ>p7fE4OUIq/uvESb5mExGPNxh7BZBLQ3GRxq67QvHhhhaw4KAiISMk/MJY2TxD+DZ2F25hQ==</InverseQ><D>aGRnzaiNGYzP5YoK6FwYhy1TZN7iWSf6vlsF8nuPPemAJ4Q+yYJxFUFdT8udTTkKjkiv8BrhBpTUlAjP9ge+BNftSibZ4zp8wd1pxewIPFYnhimAVIFasWv/1NnIP8QwH0bQQOshCxE=</D></RSAKeyValue>";
+ string MonoXml896 = "<RSAKeyValue><Modulus>8SR9zUf+X33JO4Gen620JE7yqQhvP0RSnU+XGE5fSHTPmy/HtuP5/IsCbfDsKOa5aAa4uj6PpxsG/6GgrbgmkxSfJmj8OfYP7Eo7wjXheJmv87Iw8y0rJ3PhkKbF82GFU/CmYQO3A77QVK74v9NMRw==</Modulus><Exponent>EQ==</Exponent><P>+q7kK0s1I10ZVAXqqnTzZ8T7L+Q82UW658IUeH1aL8OteL9qbh/05vhqknbptbZ6Xjsf9UtoTT8=</P><Q>9kHMYmw0rlmWcxQOAnTkn1g6ZCyMDR05Yhvf7qQtbZQ92GKWrs0+MTl9N+RkYREqhskY5S5TVvk=</Q><DP>hLbxRBjBx22F4TBPDvKe+rOUCkunvlIXp984A42oN2eYEr+w0OO947Cw5CDWFOgiqluJY76Cgz8=</DP><DQ>n1fAe+upnf27s9/M1GnBG8+tT+CW208lIV1UqXlKkjK+mxKdvGavxX+NQkh9L7/QORi1wXhUCxk=</DQ><InverseQ>lsGlEhb8TteuqHjnPULwYF+naVMMThqPa9+sAMflXAHm6zQ7YB6JotrhnSnSVdxuri0bhZwbMt4=</InverseQ><D>Ko34FSrSiVJuzkQM7wCJM5V2HdRP3fz/hSwpuP7FhUHKSI/2ETdKO6APfNAprN1sA0x687Cv8E+4mTmZ7zr/6qhiXIxKO1CYJIssptb/IfAC9McjnXeRfvn7XtHwprzmFRCfTE06ZPWD4QXJG22WIQ==</D></RSAKeyValue>";
+ string MonoXml960 = "<RSAKeyValue><Modulus>tsPl3wQ+EYH4tuzDokt/CknZUVNZMr9AEwZCGMzpXORmkHaBA5Dh5N24OtQwO1YQ4gXCosU9YpdQujIvki48txiL+r6/KtK1hIOm4h/LCZRZ0ztYZvufH2ysv6Sv22iEbv8/ABOmaAu7A0RueGI1dX8aZ+dIlqzz</Modulus><Exponent>EQ==</Exponent><P>1kRCrCRrHd9STbYjSUZ0bD/Sqcx44aXwEjn06z6starjsKQ/RAboA/VCalDWlA66UC8CPQxN2Sd0Sn09</P><Q>2lzq2YjgLtwcQzW7GdAXf5yAoXO7mghh8rgfRvpVtAN6wkTSR1XQXPdXYJRVDYyGyrA5bBOnheotuNXv</Q><DP>WDo5ki0dDEzlp4c7tMKoaM78ZAjmewgXjwjOQr90Ss3lSLwaDPPI8pIqaAMrLefyXUCIc32Jd4i3afdV</DP><DQ>QDlyP/sUwnz5QPGvgBAG6Uwl1SIKACCVR2NUfkmgvHl+dV+JJAouOXXshdFGMSlU0jPUp1ETJ2L+Y4o3</DQ><InverseQ>gssEimyKQEsy0cnyZlhx4h6Ua/owWnlz4bRac6tVYQRK05LG78sAbgtysi/aZ2rXqG6+ZBTrY0FHuR5+</InverseQ><D>rAOrLEA6atSt2VdOtt2kvmOfW5m9XPA8TiQB+TlUGzFReOgA9Ewf5nZTCjEeVfamel/GPtfBTbuXRdTf41eV1Ci1WHuXJ2/ZiN8ob06O0UAjJTlva1RGhOVVBZyI2tJOA2vJ/zPPovcdiReyOeSu3neqYqr3IUVx</D></RSAKeyValue>";
+ string MonoXml1024 = "<RSAKeyValue><Modulus>i+O73a/wy4fMi6V9dF9Us4oyAUvNwrJcOS69r7edDjw0MDd5vz8PcaAdL3BOwMEmItI1i8Z39HxqvuuwdB0GGCNKGh4Ft680nIAgsLugztJ4Shjm+xgFM3cFSGxJpSWkWlTpXs2ARhOSIbr5/+UwON4EvpkYxC5GbRIsrqDHHV8=</Modulus><Exponent>EQ==</Exponent><P>88rUpdL/RNdeuYTReHSK+MmRWnc2S79Z67uHtMIWO0BsG/gMUIKnFSpJiEaFpnHXe881cdUvNvo9NGuTz5Jh1Q==</P><Q>kuT52+3qfpuQ539A08+DiPSfyNHsq2vwOg8vxd3pBfVUyLSPkaLHOmXumk7BDvWAsQXQPOblsgeByunEO1ooYw==</Q><DP>ZGKTy89aDUmfeZEK9V0qKjThf5p/xNZSM+POd5s2VKIOZd6bqK5EzHrS++DNnuOU9r67p1fIJbJVb/APr9Lc/Q==</DP><DQ>ikDrKVhkOuzEnaTxuErWJovhrfLAoVaHvixpMrK9MsjIRG20TNVwNvaGNuC1s7niiH3xKkK6EPgBr+sTCq81EQ==</DQ><InverseQ>N3di8j2v4ZxE0Y/WFST/wSuAvTfTevx3F6I9jjYReUH8Yy88aKoKr+mgRSl+94/glwbCQ3Q+jP79puiBmcRrPA==</InverseQ><D>OZoCD/0m6mUX/UQkmVRuK89+AIigBOAH2097SFqqFOudBMuMe+zKH7pmXtPkMUB5HWWdk+hPgsnRmeiT85N6+kB7xMfgGI5AsJga19OAi2yI3RnXlTq0FMcYHZCvRE8AXUxVQTO7/n3iq3r8TEDaPmcTpn6eooXvGoA6jRCHLYk=</D></RSAKeyValue>";
+ string MonoXml1536 = "<RSAKeyValue><Modulus>jzYjq6zGOWfmpnzDf5SNrSifeYbFFgbh0/tO2UkLWBpbFqHdLo8CZJt1j3UtSN82ZuV6IBMJnmIsxOH3JQ677IPb76Hz/F0V07jCM88kcz3RRtCahXj/14p2EwTY3297yylWx8+zGmpQDPOxejbaGyjn2TyPx6Nq54SVSAfBUgcXuwwpksogwv/neZLyOlu/JBG5Ej11FOfJ8vi7gb/OCqK1EdzRthf9e4FS5KoxC81TiTUXyfesYpSsHI6fQ5i1</Modulus><Exponent>EQ==</Exponent><P>r0edPMfgFzP3gOrrFIS83DteP5B9l0Y0c9ONSdM3il1Gm/NtU1YTmEHAdAaNHS/p8xqO2ojnYLTK7EUADQeeEUnl3f+BYcYkVSOy6Fq8KKJlDP/PUNF97Yp42TgUL2bD</P><Q>0SngrKVGg1QV5paow1TV6IBTaxVflPcHRdkk7H3WkzSz8XGmpVWYumRWQoDT7NwdsMZnvXImlavUX4v0fNqTvHwN1HwTU8g64RFqfePZK48fN3EjIZDKcTSEQxrFdDsn</Q><DP>e7oUo1/pecpUWwAtd+U6BN6c4ZMredc0FYZFnYYJFl/1m0JrSeJoLz14yl76Mrho59aC9Jzfj46tW3wACTKNsdnPb4cuJuY3w6C6heWx/pC/zPDOk2azPkOgmVTC9EiJ</DP><DQ>uI5c1JHUzjsiYgx2yngICWIrfJpjZVJv1DgRhV/5kPJEa6CD+0uGwpTElQhChbMpQaABLrAD7Xl/JyEjBMDctV5mjk9cWPv3t4fWbxRWNX5IuHLiw0OFcvIaWVPbZo6L</DQ><InverseQ>p52gqtyki7MRn0fFTOkSCee/2QQAZyM2cYt3DtgDQbRcqrMT6Q9WXgyXOGdadqFFvUpGxysCQ/rppLttCG9S8wG8lD9I6hulda3TkiKCsYNuNLco0epmjXpWc0YmCcys</InverseQ><D>OvgszjgVYu6MJm+byx8NKS7YQRlgNj8RsaO3Di0iyey8GGDEfJU9OHw/d05d8NRhseYFHEQTBPs/nF0LaZynu73TCFG+0VOBdUwTuvrw5CiDWWT0VRO0pAvWRBEOAaZfiC2ViL8qyz8MYj4MM8wOUMOOx+Oy9LGa9MJOcLSkJKixqWLqxv17PVIoyMiHE+SW2m5uMleT32TVU+Mzz3lec2n1RWRGS4P14EyOf1l8WqmRlMk8jXm/xVf8w9xgbwtF</D></RSAKeyValue>";
+ string MonoXml2048 = "<RSAKeyValue><Modulus>ppiz9wru8QdjxD1IZ8Ouc4rpKMjR51jDq/mPu7gILbto1sD+01r/P84zFd2n9Jbv+vHJ8ClTr/9vh3dy6OzN/ASUoAMzmGnHQPsFHyaZ7TxDmF2EaF45F0rDbsPsOxlHUKkc33EuHwzXRZRdD4c2vCY8D+qrdpldkC4KH4oWjBHPk2MlqM1mPGJIvzz9nANhEl9YHHHZmAV2auZIWMWyO9zPHoE0YYMeFTHIuOZmxbu6iKX0pWcHzukx6FCqxN9zOAz5xl9D0f//0vhsiZUINM4y4ypS9C+jF8WAUthj29R3s1Hxr5I32kr3+nhtkHu7ljqLzYqCBq6hixZEhHlUlQ==</Modulus><Exponent>EQ==</Exponent><P>w5gi5/IS9jFz8tAVpUgmCBBvUCMWG6VmzvrKxf+Z6VQ/Uz3iirTDyMHbjfThlRLik39EbCs2woN9HYeIbEoQRKvbPVewvQZzV6nD5vAIR/wMzL/T14kStaMI7oYUXTBsTrfz/YwNFXPgANV1QEjFMT+S7zGacduP9PG3Kx5dqu8=</P><Q>2gv5mTL6RDAitvOdFoI8Ke/PrQFne1Gx8oKrMBVoRUL9Jzzp4oWlNoDjU4N4USET3KsuR8OBgH8KH/caJC1NuDG+CQ/Bkf/iB82LuoOvaBSAKFCXRMng6LyoDFxb1ptwFavFogTrxPs3GpHYzIq4quhuP18X9bjHkiNzZ3qqCLs=</Q><DP>ihEJlKrgNVAVnFal3hTPjTjHC2QPmwtXoSmAE0sDO0qHDZUYYekCq9QiglKBHe82hju30+JExYn99roF8hYpmeK44AGp7tdgeh17OZpgMtAJCP/g1GDB6aBCikCG2F5qketC0ReQw9lS02l/8SRO9ZZJmcipQU+w6SMX4jONaZk=</DP><DQ>TPUq6sayrqeTyBm++OKr0pDf4rUzlO+oN3lpmIAGrwiVlWDLBKejuOIyHXmx/oQlILTjKGMepdJ8C0gnWA/9UBGOXY0XJHht5KLmBZfjjiVaaJTqGEdAUiR3i+Rcphi+JcQnophTNnbIJ37E/OWqlqxjJWzbR6qgyiqhM5S0e40=</DQ><InverseQ>dYOYJxCnJUZLastml8Fu9/HoW+DoX3OQ/I2b3aRBYByh7dpeRPaMdtycHgSNtMAocYDXMypl+f92vHFXENc4WFtEVAQSkxgD2IWTgQEj92kmaCA8Jrs8boH3eXfLb6ZlHf1fas5lIreq5Gzj/0IC0zDlYKBWOQf/3d+mxI9kbyw=</InverseQ><D>f2W2y/lNTueIhwGv1uDu0NOjPU5GKWH/CwoinpvKBNqbdwwOKSd35X+QeiH46Dcv/CJPIRCLSlnr4BAMlABhSD+88tVFkqs+BIO4n1nBALWdGillQMCGAsCzkPAtHiJjtib39ilfgSfv6ensz6OiU6TEhKRlAFcpbkFTCQ8+axtxer2M3TiaAarE3njI65lgOwmu+djnqDyKWzfGcA37QafIQPOnWiMIgtBWfKetnKXtk1ReqdDw2IckUNBud4EeRStM7jy7MlVNc0TXiTDK7ow+Vd2EIPGpQXkav167V4F4Lc7VYrGDrFTV2fM66uBBcmgaH3gUOVGq0qUttAuZLQ==</D></RSAKeyValue>";
+
+ // import/export XML keypairs
+ // so we know that Windows (original MS Framework) can use keypairs generated by Mono
+ public void TestMonoXmlImportExport ()
+ {
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider ();
+
+ rsa.FromXmlString (MonoXml384);
+ AssertEquals ("Mono-Xml384", MonoXml384, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml448);
+ AssertEquals ("Mono-Xml448", MonoXml448, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml512);
+ AssertEquals ("Mono-Xml512", MonoXml512, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml576);
+ AssertEquals ("Mono-Xml576", MonoXml576, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml640);
+ AssertEquals ("Mono-Xml640", MonoXml640, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml704);
+ AssertEquals ("Mono-Xml704", MonoXml704, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml768);
+ AssertEquals ("Mono-Xml768", MonoXml768, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml832);
+ AssertEquals ("Mono-Xml832", MonoXml832, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml896);
+ AssertEquals ("Mono-Xml896", MonoXml896, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml960);
+ AssertEquals ("Mono-Xml960", MonoXml960, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml1024);
+ AssertEquals ("Mono-Xml1024", MonoXml1024, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml1536);
+ AssertEquals ("Mono-Xml1536", MonoXml1536, rsa.ToXmlString (true));
+
+ rsa.FromXmlString (MonoXml2048);
+ AssertEquals ("Mono-Xml2048", MonoXml2048, rsa.ToXmlString (true));
+ }
+
+ // Validate that we can sign with every keypair and verify the signature
+ // With Windows this means that we can use Mono keypairs to sign and verify.
+ // For Mono this doesn't mean much.
+ public void TestMonoSignature ()
+ {
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider ();
+
+ rsa.FromXmlString (MonoXml384);
+ SignAndVerify ("Mono-384", rsa);
+
+ rsa.FromXmlString (MonoXml448);
+ SignAndVerify ("Mono-448", rsa);
+
+ rsa.FromXmlString (MonoXml512);
+ SignAndVerify ("Mono-512", rsa);
+
+ rsa.FromXmlString (MonoXml576);
+ SignAndVerify ("Mono-576", rsa);
+
+ rsa.FromXmlString (MonoXml640);
+ SignAndVerify ("Mono-640", rsa);
+
+ rsa.FromXmlString (MonoXml704);
+ SignAndVerify ("Mono-704", rsa);
+
+ rsa.FromXmlString (MonoXml768);
+ SignAndVerify ("Mono-768", rsa);
+
+ rsa.FromXmlString (MonoXml832);
+ SignAndVerify ("Mono-832", rsa);
+
+ rsa.FromXmlString (MonoXml896);
+ SignAndVerify ("Mono-896", rsa);
+
+ rsa.FromXmlString (MonoXml960);
+ SignAndVerify ("Mono-960", rsa);
+
+ rsa.FromXmlString (MonoXml1024);
+ SignAndVerify ("Mono-1024", rsa);
+
+ rsa.FromXmlString (MonoXml1536);
+ SignAndVerify ("Mono-1536", rsa);
+
+ rsa.FromXmlString (MonoXml2048);
+ SignAndVerify ("Mono-2048", rsa);
+ }
+
+ // Validate that we can verify a signature made with Mono
+ // With Windows this means that we can verify Mono signatures.
+ // For Mono this doesn't mean much.
+ public void TestMonoVerify ()
+ {
+ byte[] hash = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 };
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider ();
+
+ rsa.FromXmlString (MonoXml384);
+ byte[] sign384 = { 0x6B, 0xEF, 0x8A, 0x2E, 0x2E, 0xD5, 0xB6, 0x19, 0x2D, 0x9C, 0x48, 0x75, 0xA8, 0x54, 0xAD, 0x61, 0xD1, 0xCC, 0xF3, 0x9A, 0x3E, 0x4E, 0xE2, 0xF1, 0x44, 0x1D, 0xC4, 0x3A, 0x30, 0xF4, 0x9B, 0x2D, 0x88, 0xA7, 0xB8, 0xEC, 0x2D, 0x17, 0x4E, 0x66, 0x6C, 0x4C, 0x5A, 0xB5, 0x44, 0x4B, 0xAF, 0x06 };
+ Assert ("Mono-384-Verify", rsa.VerifyHash (hash, sha1OID, sign384));
+ sign384[0] = 0x00;
+ Assert ("Mono-384-VerBad", !rsa.VerifyHash (hash, sha1OID, sign384));
+
+ rsa.FromXmlString (MonoXml448);
+ byte[] sign448 = { 0x9F, 0x62, 0xDF, 0xD4, 0x8B, 0x3E, 0x85, 0xEC, 0xF9, 0xF2, 0x17, 0x1C, 0x2B, 0x18, 0x37, 0xDA, 0xCA, 0x74, 0x5F, 0x85, 0x70, 0x41, 0x44, 0xB3, 0xE5, 0xA3, 0xC8, 0xC7, 0x37, 0x9E, 0x52, 0x16, 0x18, 0x2C, 0xE3, 0x87, 0x1A, 0x34, 0x13, 0x4A, 0x5D, 0xBB, 0x79, 0x27, 0x1C, 0x2A, 0xD2, 0x96, 0x79, 0xC4, 0x26, 0x51, 0x1B, 0x24, 0x12, 0xBC };
+ Assert ("Mono-448-Verify", rsa.VerifyHash (hash, sha1OID, sign448));
+ sign448[0] = 0x00;
+ Assert ("Mono-448-VerBad", !rsa.VerifyHash (hash, sha1OID, sign448));
+
+ rsa.FromXmlString (MonoXml512);
+ byte[] sign512 = { 0x33, 0xBB, 0x7E, 0x0B, 0xC0, 0xB2, 0x9A, 0xC2, 0x2F, 0xF4, 0xBE, 0x1B, 0xDF, 0xD6, 0x79, 0xC1, 0x38, 0x47, 0xEA, 0x05, 0xB2, 0xC0, 0xFA, 0xF8, 0xC9, 0xDC, 0x6D, 0x56, 0xBF, 0xD3, 0xBF, 0xAA, 0xB8, 0x1E, 0x74, 0xE4, 0xF3, 0x38, 0x45, 0xA9, 0x34, 0xD1, 0x5C, 0x0D, 0x0F, 0x56, 0x70, 0x0C, 0x93, 0x6B, 0xD6, 0x80, 0x17, 0xAD, 0x80, 0xF9, 0xD8, 0xFD, 0x1E, 0x6F, 0xF3, 0x5C, 0xB2, 0x78 };
+ Assert ("Mono-512-Verify", rsa.VerifyHash (hash, sha1OID, sign512));
+ sign512[0] = 0x00;
+ Assert ("Mono-512-VerBad", !rsa.VerifyHash (hash, sha1OID, sign512));
+
+ rsa.FromXmlString (MonoXml576);
+ byte[] sign576 = { 0x61, 0x8C, 0xD0, 0xE3, 0x63, 0x95, 0x7C, 0xB6, 0xD8, 0x84, 0x4D, 0xD1, 0x04, 0xDF, 0x1F, 0x4A, 0xCF, 0x69, 0x95, 0x7B, 0x69, 0x8E, 0x09, 0x2A, 0x0F, 0x1B, 0x23, 0xA7, 0x20, 0x31, 0x95, 0x93, 0xD1, 0x67, 0xBC, 0x27, 0x80, 0x41, 0x60, 0xD1, 0xFE, 0x62, 0xB2, 0x17, 0xC9, 0x57, 0x4F, 0x03, 0x40, 0xDB, 0xB3, 0x7E, 0xD2, 0x0C, 0xEA, 0x7D, 0x72, 0x76, 0x64, 0x4F, 0x51, 0x79, 0x43, 0xCC, 0x8F, 0x36, 0x1E, 0x81, 0x43, 0x20, 0xB9, 0xAD };
+ Assert ("Mono-576-Verify", rsa.VerifyHash (hash, sha1OID, sign576));
+ sign576[0] = 0x00;
+ Assert ("Mono-576-VerBad", !rsa.VerifyHash (hash, sha1OID, sign576));
+
+ rsa.FromXmlString (MonoXml640);
+ byte[] sign640 = { 0x4A, 0x6A, 0xED, 0xEC, 0x96, 0x9C, 0x89, 0xD1, 0x41, 0x2E, 0x16, 0x0D, 0xBA, 0xB0, 0x48, 0x92, 0xF9, 0xA6, 0x33, 0x26, 0x0D, 0x6C, 0x99, 0xA9, 0x4E, 0x3B, 0x68, 0x82, 0xAB, 0x94, 0x33, 0x89, 0xEC, 0x8A, 0xCC, 0x32, 0xDD, 0x45, 0x9C, 0x16, 0x5E, 0xCE, 0x5F, 0xF3, 0xDC, 0x5F, 0x09, 0xC7, 0x69, 0xC7, 0xEA, 0x74, 0xAB, 0x79, 0xA7, 0x55, 0xD9, 0xF8, 0xDF, 0x8F, 0x8C, 0x9A, 0xBA, 0xA9, 0x56, 0x86, 0x96, 0x64, 0xE9, 0xC0, 0x21, 0x8C, 0x34, 0x91, 0x31, 0xC2, 0x80, 0xC7, 0x47, 0x6F };
+ Assert ("Mono-640-Verify", rsa.VerifyHash (hash, sha1OID, sign640));
+ sign640[0] = 0x00;
+ Assert ("Mono-640-VerBad", !rsa.VerifyHash (hash, sha1OID, sign640));
+
+ rsa.FromXmlString (MonoXml704);
+ byte[] sign704 = { 0x94, 0xC5, 0x45, 0xCD, 0x9C, 0xA9, 0xBC, 0xDF, 0x9D, 0x04, 0xCE, 0xFD, 0x21, 0xEB, 0x3F, 0xBE, 0x32, 0x56, 0xC3, 0x6B, 0xEF, 0x4E, 0x8F, 0xA9, 0x02, 0x14, 0xC4, 0xF1, 0xFA, 0x9B, 0x35, 0xFE, 0x36, 0x34, 0x03, 0x31, 0xC1, 0xC8, 0xBF, 0xA1, 0x41, 0x03, 0xCB, 0xE1, 0xB9, 0x81, 0x76, 0x60, 0xC9, 0xD1, 0xB4, 0x04, 0x98, 0xA5, 0xDF, 0x4F, 0x37, 0x60, 0xB8, 0x15, 0xF8, 0x22, 0xB7, 0x54, 0x32, 0x87, 0x19, 0x9B, 0xB9, 0xDF, 0xB9, 0x2D, 0x25, 0xA2, 0xAF, 0x04, 0xC1, 0xE0, 0xF0, 0x0B, 0xF2, 0xCC, 0x0E, 0x1F, 0x40, 0xF6, 0x5C, 0xCD };
+ Assert ("Mono-704-Verify", rsa.VerifyHash (hash, sha1OID, sign704));
+ sign704[0] = 0x00;
+ Assert ("Mono-704-VerBad", !rsa.VerifyHash (hash, sha1OID, sign704));
+
+ rsa.FromXmlString (MonoXml768);
+ byte[] sign768 = { 0x28, 0x99, 0xE0, 0xD2, 0xCF, 0xD3, 0x2B, 0x1B, 0xA2, 0x06, 0xC5, 0x17, 0x86, 0x07, 0xC8, 0x49, 0x77, 0x33, 0xEC, 0xFE, 0xC9, 0x15, 0x99, 0x90, 0x4C, 0x6C, 0xED, 0x2C, 0x32, 0xF8, 0xAB, 0x0A, 0xB6, 0xEB, 0x15, 0x08, 0x4A, 0xC1, 0xDD, 0xAD, 0x88, 0x47, 0xAD, 0x3D, 0xA2, 0x4B, 0x94, 0x7E, 0x37, 0x1F, 0x33, 0xFC, 0xC3, 0xFE, 0xC2, 0x27, 0x45, 0x74, 0x8E, 0x3C, 0xC8, 0x68, 0x8C, 0xF4, 0x77, 0xCC, 0xD0, 0x79, 0x37, 0x7E, 0x26, 0x1B, 0xDE, 0xBF, 0x16, 0x3E, 0xAE, 0xB9, 0xEB, 0xA0, 0x00, 0xCE, 0x51, 0x8A, 0x69, 0x12, 0xF5, 0xBE, 0x39, 0x1C, 0x0F, 0x0F, 0xD8, 0x13, 0xDD, 0x6B };
+ Assert ("Mono-768-Verify", rsa.VerifyHash (hash, sha1OID, sign768));
+ sign768[0] = 0x00;
+ Assert ("Mono-768-VerBad", !rsa.VerifyHash (hash, sha1OID, sign768));
+
+ rsa.FromXmlString (MonoXml832);
+ byte[] sign832 = { 0x8D, 0x56, 0xB2, 0x3C, 0x45, 0x47, 0xB8, 0x6F, 0x56, 0x7D, 0x85, 0x4F, 0x3C, 0x14, 0xAC, 0x61, 0x08, 0x8C, 0x6A, 0xF3, 0xAF, 0xCA, 0x65, 0xCC, 0xC3, 0x6F, 0x53, 0x6F, 0x84, 0xC1, 0x9F, 0xFD, 0x66, 0x83, 0xA1, 0x3B, 0xFF, 0x61, 0x41, 0xDB, 0x2C, 0xE5, 0xD5, 0x13, 0x3E, 0x15, 0x7A, 0xBD, 0x1F, 0x44, 0x4C, 0x4F, 0x10, 0xB7, 0x4A, 0x4B, 0x9D, 0xD1, 0xF5, 0xC2, 0x4E, 0x4D, 0xC8, 0xF9, 0x51, 0xC9, 0xF3, 0x04, 0x69, 0x02, 0xAE, 0x7E, 0xC3, 0x76, 0x56, 0x08, 0x8E, 0xF7, 0xA1, 0x25, 0x1B, 0x97, 0x65, 0x8E, 0x3A, 0x98, 0x52, 0xDB, 0x3E, 0xF4, 0x59, 0x5F, 0xEE, 0x6D, 0x78, 0x22, 0x37, 0x2E, 0x79, 0x69, 0x6D, 0x8F, 0xF9, 0xDF };
+ Assert ("Mono-832-Verify", rsa.VerifyHash (hash, sha1OID, sign832));
+ sign832[0] = 0x00;
+ Assert ("Mono-832-VerBad", !rsa.VerifyHash (hash, sha1OID, sign832));
+
+ rsa.FromXmlString (MonoXml896);
+ byte[] sign896 = { 0xAB, 0xD9, 0xE4, 0x5C, 0xAB, 0xF7, 0xE1, 0x06, 0x7F, 0x0C, 0xD6, 0x03, 0xB5, 0xA1, 0xDB, 0x22, 0x3E, 0x85, 0xBE, 0xCD, 0x54, 0x12, 0xD5, 0x11, 0x71, 0xCC, 0xEE, 0x71, 0x4B, 0xA8, 0xB5, 0xAE, 0x04, 0x82, 0x78, 0x72, 0xE8, 0x7B, 0x77, 0x42, 0x58, 0x14, 0xA3, 0xF0, 0xFC, 0xE9, 0x15, 0x98, 0x2E, 0x34, 0x57, 0xAA, 0x95, 0x6F, 0x2E, 0x9B, 0x5B, 0x88, 0xF0, 0x51, 0x26, 0x35, 0x1F, 0x0C, 0x59, 0x51, 0x73, 0x0E, 0xD3, 0x5D, 0x02, 0xAD, 0xB7, 0x1C, 0x94, 0x57, 0x1E, 0xA6, 0x01, 0x19, 0x73, 0x29, 0xBE, 0xDF, 0x77, 0xF2, 0x13, 0x28, 0xBD, 0x50, 0x89, 0x39, 0x6A, 0x1B, 0xEF, 0x66, 0x29, 0x71, 0x55, 0x44, 0x3A, 0x36, 0x89, 0xC1, 0xFE, 0x25, 0x32, 0x9F, 0x65, 0x76, 0xEA, 0x71 };
+ Assert ("Mono-896-Verify", rsa.VerifyHash (hash, sha1OID, sign896));
+ sign896[0] = 0x00;
+ Assert ("Mono-896-VerBad", !rsa.VerifyHash (hash, sha1OID, sign896));
+
+ rsa.FromXmlString (MonoXml960);
+ byte[] sign960 = { 0x7A, 0x13, 0x06, 0xF1, 0xB5, 0x14, 0x78, 0x33, 0xA6, 0x14, 0x40, 0xDC, 0x22, 0xB6, 0xF3, 0xBB, 0xDC, 0xCD, 0x53, 0xAF, 0x05, 0xC5, 0x84, 0x0C, 0xD2, 0x15, 0x5A, 0x04, 0xFC, 0x30, 0x57, 0x64, 0xF4, 0x8B, 0xD6, 0x5D, 0x5B, 0x3D, 0xFC, 0x82, 0x6B, 0xB9, 0xE4, 0xB9, 0x56, 0xB3, 0xCF, 0x2A, 0x6D, 0x14, 0x83, 0x31, 0x9E, 0xFD, 0x55, 0x4B, 0x2C, 0xBD, 0x5A, 0xA8, 0xAC, 0xD6, 0x5D, 0xFA, 0x58, 0xF8, 0x3E, 0x60, 0x32, 0x11, 0xA4, 0x09, 0xC2, 0x01, 0xE7, 0x14, 0xEF, 0xBA, 0x51, 0x57, 0x86, 0xA5, 0x86, 0x28, 0x63, 0x68, 0x33, 0xBF, 0x34, 0xF9, 0x1D, 0x36, 0xC3, 0x6E, 0xCF, 0x97, 0xA5, 0x19, 0xB4, 0x5F, 0x7B, 0x70, 0xB0, 0x72, 0xF2, 0xF2, 0xFF, 0x05, 0xB7, 0x31, 0x5A, 0x5D, 0xC6, 0x88, 0x88, 0x21, 0x97, 0x40, 0x0E, 0x0E };
+ Assert ("Mono-960-Verify", rsa.VerifyHash (hash, sha1OID, sign960));
+ sign960[0] = 0x00;
+ Assert ("Mono-960-VerBad", !rsa.VerifyHash (hash, sha1OID, sign960));
+
+ rsa.FromXmlString (MonoXml1024);
+ byte[] sign1024 = { 0x26, 0x98, 0x40, 0x5F, 0x30, 0x4E, 0x90, 0x20, 0x32, 0x10, 0x64, 0xCF, 0x03, 0xA8, 0x1E, 0x53, 0x20, 0x19, 0x59, 0xCB, 0x08, 0x5F, 0x8D, 0x45, 0x51, 0xEE, 0xDD, 0x71, 0x2E, 0x21, 0x86, 0xB0, 0xC6, 0xE2, 0x6F, 0x2A, 0xF2, 0x8E, 0xBD, 0xDE, 0xAD, 0xA0, 0x56, 0x7E, 0xED, 0x38, 0x4F, 0x8D, 0x3A, 0xC6, 0x8A, 0x15, 0x34, 0x71, 0xDE, 0xC5, 0x60, 0x32, 0x95, 0x38, 0xD7, 0x69, 0x0F, 0x3B, 0xDF, 0xF8, 0x4C, 0x2D, 0x83, 0x58, 0x7E, 0x36, 0x4B, 0x10, 0x4A, 0x8B, 0x23, 0x70, 0x09, 0xBE, 0xCF, 0x02, 0x2E, 0x97, 0xC4, 0x0F, 0x94, 0x42, 0x0B, 0xFA, 0x1F, 0x16, 0x97, 0x25, 0x1C, 0x14, 0x2B, 0x82, 0xD0, 0x7A, 0xC1, 0x2C, 0x2F, 0x72, 0x9C, 0xD9, 0xEE, 0x90, 0x2F, 0x5B, 0xC5, 0xB1, 0x34, 0x73, 0x10, 0xEC, 0x79, 0x97, 0x9A, 0xDA, 0xE2, 0xB4, 0xAE, 0x99, 0xE9, 0xA2, 0xFF, 0xC6 };
+ Assert ("Mono-1024-Verify", rsa.VerifyHash (hash, sha1OID, sign1024));
+ sign1024[0] = 0x00;
+ Assert ("Mono-1024-VerBad", !rsa.VerifyHash (hash, sha1OID, sign1024));
+
+ rsa.FromXmlString (MonoXml1536);
+ byte[] sign1536 = { 0x33, 0xE2, 0xA4, 0xCE, 0x18, 0xE6, 0xF3, 0x46, 0x0E, 0x32, 0xD1, 0xA6, 0x8A, 0xC3, 0xCA, 0x4B, 0x36, 0x4E, 0x4C, 0xAE, 0x39, 0x95, 0x5A, 0x05, 0x37, 0xBA, 0x0F, 0x19, 0xDC, 0x94, 0x6A, 0x78, 0xDA, 0xEA, 0xF0, 0xA2, 0x80, 0x47, 0xD5, 0xB9, 0xC3, 0x53, 0xC9, 0xDA, 0x0B, 0x29, 0xCA, 0x61, 0x37, 0x7C, 0xD5, 0x5D, 0x99, 0x58, 0xAD, 0x0F, 0xA8, 0xEF, 0x17, 0xFD, 0xA8, 0x55, 0x79, 0xEF, 0x07, 0xD1, 0x63, 0xE0, 0x2C, 0xEF, 0x14, 0x42, 0x72, 0x2D, 0x71, 0xA3, 0xBB, 0x29, 0x87, 0xF8, 0xCC, 0xFB, 0x70, 0xCC, 0x13, 0x70, 0x24, 0xC3, 0x2A, 0x2B, 0xD2, 0x1C, 0x34, 0xD7, 0x85, 0xBC, 0xA4, 0x4E, 0x7B, 0x7E, 0x1C, 0x5B, 0x03, 0x06, 0xB2, 0x01, 0xBF, 0x73, 0x30, 0x77, 0xEB, 0x03, 0x17, 0x24, 0xFE, 0x46, 0xC7, 0x9B, 0xEB, 0x75, 0xF6, 0x56, 0x43, 0x1E, 0x0D, 0x56, 0x05, 0x37, 0x78, 0xB3, 0x76, 0x93, 0x76, 0xFA, 0x73, 0xCD, 0xE5, 0xB1, 0x3C, 0x60, 0xB7, 0xCC, 0x1E, 0x98, 0x89, 0xD8, 0xB4, 0x0A, 0xD3, 0x52, 0xCD, 0xEF, 0xC1, 0xBE, 0xFC, 0xA8, 0x2C, 0xE6, 0x01, 0xD3, 0xB3, 0x05, 0x5C, 0x12, 0x48, 0xD8, 0x20, 0xF9, 0x3B, 0xAD, 0x97, 0xD4, 0xD1, 0x13, 0xD6, 0xA5, 0x31, 0x4E, 0x52, 0x13, 0xBD, 0x5C, 0x00, 0x5C, 0x2A, 0x86, 0xFC, 0x98, 0x8B, 0x93, 0xAE, 0x5A };
+ Assert ("Mono-1536-Verify", rsa.VerifyHash (hash, sha1OID, sign1536));
+ sign1536[0] = 0x00;
+ Assert ("Mono-1536-VerBad", !rsa.VerifyHash (hash, sha1OID, sign1536));
+
+ rsa.FromXmlString (MonoXml2048);
+ byte[] sign2048 = { 0xA5, 0x70, 0x6B, 0x3C, 0x5E, 0x5D, 0x49, 0x7C, 0xCB, 0xEE, 0xE3, 0x23, 0xF5, 0xD7, 0xEE, 0xF3, 0xA8, 0x8A, 0xED, 0x47, 0x5F, 0x2A, 0x03, 0x72, 0x41, 0x02, 0x1E, 0x5D, 0x93, 0x3B, 0x27, 0x4B, 0x2D, 0x7A, 0x21, 0x50, 0x7B, 0xDC, 0xFB, 0x0F, 0xCB, 0xEB, 0x8E, 0xB5, 0x4C, 0x44, 0x90, 0x39, 0xF0, 0xCB, 0x4A, 0x5E, 0xD7, 0x67, 0x5C, 0x46, 0xC3, 0x3C, 0x94, 0xDC, 0x33, 0x36, 0x36, 0xA5, 0xF3, 0xCE, 0x1F, 0xA7, 0x8F, 0x79, 0xB8, 0x60, 0x94, 0x0F, 0x7A, 0x87, 0x18, 0x12, 0xCD, 0x21, 0x54, 0x05, 0x53, 0xA0, 0x88, 0x1F, 0x61, 0x1F, 0xAB, 0xEC, 0x6D, 0xCF, 0x10, 0xE0, 0x8D, 0x14, 0x5C, 0x6A, 0x46, 0x8C, 0xB9, 0xB6, 0x52, 0x38, 0x1F, 0xAE, 0xF1, 0xB8, 0xB5, 0x9B, 0x3C, 0xE1, 0x6E, 0xBE, 0x21, 0x1B, 0x01, 0x1E, 0xD9, 0x1E, 0x97, 0x78, 0x47, 0xC9, 0x86, 0xC4, 0xE7, 0x58, 0xF8, 0xEB, 0xAC, 0x22, 0x38, 0xD4, 0x2A, 0xE8, 0x1B, 0x40, 0x5F, 0xAF, 0x35, 0xFA, 0x13, 0x30, 0x0E, 0x5C, 0x4C, 0xF5, 0xF1, 0xB3, 0x31, 0x6C, 0x1D, 0x96, 0xFD, 0xAB, 0xC4, 0x0E, 0x16, 0x0A, 0xF9, 0x28, 0x49, 0x59, 0xF1, 0xB6, 0x35, 0x2D, 0x21, 0x69, 0x4F, 0xD0, 0x5B, 0xB7, 0x7E, 0xC3, 0x00, 0xC7, 0xDA, 0x56, 0x48, 0xA0, 0x93, 0x05, 0xB4, 0x6D, 0xEE, 0x2D, 0x6A, 0x60, 0xF6, 0x91, 0x7C, 0xDB, 0xD8, 0xC3, 0xFD, 0x33, 0xBC, 0xC9, 0x68, 0x73, 0xC6, 0x64, 0x49, 0x80, 0x3C, 0xD5, 0x4A, 0xE1, 0x28, 0x5F, 0xE9, 0x2A, 0xA7, 0x1B, 0xA6, 0x38, 0x2A, 0xAE, 0x0A, 0xA8, 0xCC, 0x96, 0x9A, 0xEA, 0xE5, 0xAD, 0xB4, 0xD8, 0x70, 0x2F, 0xFA, 0xAD, 0x17, 0x03, 0x4D, 0xDA, 0x2E, 0x1B, 0x4D, 0x88, 0x82, 0x3E, 0x04, 0x6A, 0xAF, 0x38, 0xC1, 0x4F, 0x1B, 0x9D, 0x07, 0x1A, 0x67, 0x6A };
+ Assert ("Mono-2048-Verify", rsa.VerifyHash (hash, sha1OID, sign2048));
+ sign2048[0] = 0x00;
+ Assert ("Mono-2048-VerBad", !rsa.VerifyHash (hash, sha1OID, sign2048));
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatterTest.cs
new file mode 100644
index 00000000000..f127cd2790a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeDeformatterTest.cs
@@ -0,0 +1,185 @@
+//
+// RSAOAEPKeyExchangeDeformatterTest.cs - NUnit Test Cases for RSAOAEPKeyExchangeDeformatter
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RSAOAEPKeyExchangeDeformatterTest : TestCase {
+ protected static RSA key;
+
+ protected override void SetUp ()
+ {
+ // generating a keypair is REALLY long and the framework
+ // makes sure that we generate one (even if create an object
+ // to import an existing key)
+ if (key == null) {
+ key = RSA.Create ();
+ key.ImportParameters (AllTests.GetRsaKey (true));
+ }
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // LAMESPEC: RSAOAEPKeyExchangeDeformatter.RNG versus RSAOAEPKeyExchangeFormatter.Rng
+ public void TestProperties ()
+ {
+ RSAOAEPKeyExchangeDeformatter keyex = new RSAOAEPKeyExchangeDeformatter ();
+ keyex.SetKey (key);
+ AssertNull("RSAOAEPKeyExchangeDeformatter.Parameters", keyex.Parameters);
+ AssertEquals("RSAOAEPKeyExchangeDeformatter.ToString()", "System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter", keyex.ToString ());
+ }
+/* commented until I've the test vectors
+ // TestExchangeMin (1)
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchangeMin()
+ {
+ byte[] M = { 0x01 };
+ byte[] EM = { 0x50, 0x33, 0xF3, 0x42, 0x52, 0x59, 0x71, 0x2D, 0x6E, 0x25, 0x5E, 0x06, 0xC3, 0x27, 0x94, 0xA6, 0xD1, 0x8E, 0x13, 0x90, 0x54, 0x5C, 0x12, 0x58, 0x7A, 0xC9, 0xB6, 0x3F, 0x4D, 0x2E, 0x97, 0xCC, 0x3A, 0x94, 0x24, 0xE8, 0x11, 0x1F, 0xD6, 0x7F, 0x37, 0x36, 0xAB, 0x6F, 0x3F, 0xB4, 0x1B, 0xB8, 0x13, 0x87, 0xC8, 0xBE, 0x00, 0x24, 0x02, 0x0F, 0xF6, 0x2E, 0xEA, 0x48, 0x8A, 0x6F, 0xC8, 0xF6, 0x0B, 0xAB, 0xF4, 0x02, 0xA5, 0xE2, 0x5A, 0xAA, 0xB5, 0x9E, 0xC2, 0x6E, 0xFF, 0xA6, 0xEC, 0xEC, 0xD0, 0xA2, 0x3F, 0x00, 0x93, 0xE9, 0xF3, 0xAA, 0x08, 0xA2, 0xD2, 0x11, 0x1B, 0x3F, 0x3E, 0x59, 0xB0, 0xBA, 0x47, 0x17, 0x8F, 0xF4, 0xEB, 0x34, 0xA5, 0xC4, 0xA4, 0x09, 0x43, 0xC4, 0x7B, 0x71, 0x2C, 0x4B, 0x9E, 0x2D, 0x22, 0x96, 0xBB, 0x52, 0xDD, 0x2B, 0x59, 0xED, 0xD6, 0xCA, 0xEB, 0xE6 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeDeformatter 1", M, Mback);
+ }
+
+ // test with a message 128 bits (16 bytes) long
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchange128()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ byte[] EM = { 0x2D, 0xA3, 0xB0, 0xED, 0x1F, 0x13, 0x13, 0xBA, 0xAA, 0x26, 0xA7, 0x00, 0x76, 0x94, 0x0A, 0xDA, 0xFB, 0x4E, 0x14, 0x98, 0xD3, 0xF6, 0x26, 0x65, 0xCE, 0x7E, 0xB9, 0x23, 0xEF, 0xDE, 0x6E, 0xAB, 0x72, 0x33, 0xF3, 0x6F, 0xA9, 0x9B, 0xEC, 0x18, 0xC9, 0xB7, 0xC7, 0xE8, 0xE8, 0x55, 0xC4, 0x83, 0x1E, 0xF5, 0xDA, 0xCF, 0x5A, 0x53, 0xB0, 0x60, 0x42, 0xF4, 0x55, 0xEE, 0x00, 0x80, 0x92, 0x28, 0xA9, 0x0E, 0x2D, 0x9D, 0x49, 0x10, 0x65, 0x00, 0x21, 0x82, 0xCC, 0x05, 0xA3, 0x62, 0xAD, 0xCC, 0x5B, 0xE3, 0x8E, 0xAE, 0x01, 0x96, 0x81, 0xF6, 0x7B, 0x52, 0xB9, 0x6F, 0xE3, 0x06, 0x3A, 0x48, 0x4D, 0x87, 0xB9, 0xA3, 0xEA, 0x69, 0xD1, 0xFE, 0x8D, 0x82, 0x33, 0xE3, 0x05, 0xEB, 0x00, 0xA2, 0xA6, 0xDC, 0x95, 0xE4, 0xAC, 0x4E, 0xF4, 0x03, 0xC3, 0xFE, 0xA2, 0xE8, 0xB6, 0xBB, 0xBE, 0xD1 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 1", M, Mback);
+ }
+
+ // test with a message 160 bits (20 bytes) long
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchange192()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49, 0x00, 0x00, 0x00, 0x00 };
+ byte[] EM = { 0x10, 0x79, 0x3A, 0x88, 0x04, 0x4B, 0xA5, 0x18, 0xD6, 0xCE, 0x97, 0x9B, 0xFF, 0xE8, 0xB4, 0xF5, 0x8D, 0x60, 0x07, 0xCD, 0x5F, 0x89, 0xA6, 0xCF, 0x5B, 0x90, 0x96, 0xC7, 0xF6, 0xD7, 0xF2, 0xCA, 0x7C, 0x13, 0x5A, 0x62, 0xB4, 0xED, 0xF4, 0xD7, 0x5C, 0x99, 0x4C, 0x07, 0xF4, 0x9F, 0x96, 0xE6, 0xBF, 0x2B, 0x82, 0x85, 0x38, 0x2C, 0x03, 0xBD, 0x61, 0x07, 0xF6, 0x05, 0x15, 0x55, 0xBF, 0xA9, 0x3B, 0xF5, 0x10, 0x96, 0x81, 0x01, 0x58, 0x5F, 0x61, 0x43, 0x52, 0x77, 0x71, 0x9C, 0x92, 0xEF, 0xD5, 0xE2, 0x60, 0x3F, 0x82, 0x69, 0x9F, 0xAF, 0xC2, 0xE1, 0x68, 0xB7, 0x5E, 0x62, 0xAC, 0x61, 0x6A, 0x1B, 0x46, 0x03, 0xF6, 0x7C, 0x20, 0x47, 0xF7, 0x6E, 0x7D, 0x35, 0x2A, 0xF6, 0x9C, 0xDA, 0x8A, 0xED, 0xAC, 0x1A, 0xC8, 0xF6, 0x4E, 0x7D, 0x21, 0xAC, 0x18, 0xEB, 0xA7, 0x68, 0xE0, 0xE2 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 1", M, Mback);
+ }
+
+ // Max = (key size in bytes) - 2 * (hash length) - 2
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchangeMax()
+ {
+ byte[] M = new byte [(key.KeySize >> 3) - 2 * 20 - 2];
+ byte[] EM = { 0x4B, 0x3F, 0x77, 0xE1, 0xA0, 0x6C, 0xD9, 0xFA, 0x19, 0x69, 0x21, 0xC4, 0x67, 0x2B, 0x0F, 0x2A, 0x0E, 0xCB, 0xAF, 0xAD, 0x08, 0xA5, 0xD2, 0x9B, 0xDC, 0x04, 0xDE, 0x8F, 0x13, 0xE4, 0x81, 0x25, 0xAF, 0xC5, 0x82, 0x51, 0xA9, 0x39, 0xAF, 0x82, 0xFF, 0xC7, 0x4F, 0x04, 0xE4, 0x21, 0xAC, 0xEE, 0x2F, 0x44, 0x78, 0x11, 0x29, 0x74, 0x3F, 0x74, 0xC1, 0x38, 0xC5, 0x43, 0x29, 0x2F, 0x0C, 0x7B, 0xDB, 0x2E, 0xE5, 0xA8, 0x6A, 0xEE, 0x6A, 0x14, 0xCC, 0x4E, 0x53, 0x8C, 0x0C, 0xEE, 0x23, 0x24, 0xDC, 0x9B, 0x75, 0x7C, 0xAD, 0x0C, 0xAC, 0x13, 0xC5, 0x02, 0x9E, 0x5D, 0x65, 0x76, 0xCB, 0xD4, 0xBF, 0x70, 0x43, 0xBE, 0x28, 0x67, 0x3F, 0x5D, 0x93, 0x38, 0x67, 0x4B, 0x25, 0x59, 0xF7, 0x8E, 0x4F, 0xCE, 0x2B, 0x2F, 0xA7, 0x4C, 0x68, 0x4C, 0xCC, 0x5F, 0xF3, 0x0A, 0xB7, 0xAA, 0x54, 0x7C };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 1", M, Mback);
+ }
+*/
+ // TestExchangeMin (1)
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchangeMin()
+ {
+ byte[] M = { 0x01 };
+ byte[] EM = { 0x87, 0xDC, 0xC4, 0x52, 0xBE, 0x2E, 0x42, 0x65, 0xAF, 0x50, 0xBE, 0x19, 0xAD, 0xE9, 0xC1, 0x6A, 0x42, 0x2E, 0x62, 0xBE, 0x8B, 0x8B, 0xEC, 0x08, 0x68, 0x92, 0x5D, 0x50, 0x45, 0x83, 0x00, 0xD0, 0xD2, 0xFE, 0x5D, 0xA0, 0x20, 0x22, 0xB4, 0x51, 0x23, 0x63, 0xEA, 0x54, 0x26, 0xEB, 0x2C, 0x15, 0x87, 0x6F, 0x2C, 0x1E, 0xD3, 0x7E, 0x2A, 0x2E, 0x4B, 0x90, 0xE6, 0xFE, 0x39, 0x6D, 0x6D, 0x4B, 0x6A, 0xB7, 0x2F, 0x66, 0xDE, 0xD5, 0x13, 0x48, 0xF5, 0x02, 0xCE, 0x62, 0x0C, 0xDF, 0x7D, 0x31, 0x60, 0x25, 0xAC, 0x91, 0xC3, 0xB6, 0xDD, 0xB9, 0x39, 0x33, 0xCA, 0xAC, 0x29, 0x4B, 0xAD, 0xB7, 0x9A, 0xE8, 0x9A, 0x2C, 0x4E, 0xDF, 0x11, 0x78, 0xB9, 0x05, 0xA9, 0x42, 0xE0, 0xD3, 0xF2, 0x13, 0x77, 0x80, 0x01, 0xB4, 0xB0, 0x72, 0x31, 0x11, 0xFC, 0x35, 0x9C, 0x19, 0x53, 0xDE, 0xCA, 0xCC };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ try {
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeDeformatter 1", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // test with a message 128 bits (16 bytes) long
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchange128()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ byte[] EM = { 0x56, 0x2A, 0x9B, 0x7A, 0x4E, 0x17, 0xDB, 0x8E, 0x76, 0x54, 0x2B, 0xA6, 0xC3, 0x73, 0xB7, 0x32, 0xC2, 0x5E, 0xB0, 0x37, 0x19, 0xFD, 0xBE, 0x57, 0x71, 0xD6, 0xA2, 0xD3, 0x5C, 0xE4, 0x14, 0x9E, 0x3D, 0x03, 0x8E, 0xE9, 0x88, 0x50, 0x96, 0x61, 0x91, 0x53, 0x8B, 0xAC, 0xFA, 0x08, 0x14, 0xA0, 0xC0, 0x05, 0x49, 0xE2, 0x57, 0xBD, 0xE6, 0x68, 0x44, 0xAE, 0x72, 0x57, 0x86, 0xE5, 0xEF, 0x18, 0x9C, 0xF1, 0x88, 0x7E, 0x82, 0x22, 0x04, 0x6C, 0x44, 0xCF, 0x88, 0x1F, 0x34, 0x65, 0x78, 0xA0, 0xF3, 0x5A, 0x37, 0x9E, 0x3A, 0x24, 0x1E, 0xCC, 0x9F, 0x5D, 0x56, 0x3F, 0x67, 0xFF, 0x5D, 0xCB, 0x31, 0xA9, 0x94, 0x70, 0xF7, 0x19, 0xD2, 0xE5, 0x87, 0x50, 0xAA, 0xA5, 0xF9, 0x4D, 0x29, 0x66, 0xB6, 0xA1, 0xEF, 0x7D, 0x64, 0x81, 0xC6, 0x2D, 0xF1, 0xC9, 0x05, 0x27, 0xDE, 0x1E, 0x48, 0x13 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ try {
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 1", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // test with a message 160 bits (20 bytes) long
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchange192()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49, 0x00, 0x00, 0x00, 0x00 };
+ byte[] EM = { 0x28, 0x58, 0xA9, 0xCA, 0xDC, 0xDA, 0x26, 0x17, 0x19, 0x35, 0x2F, 0xBF, 0x14, 0x57, 0xF4, 0x18, 0x91, 0x81, 0x95, 0x7C, 0x70, 0x8A, 0x68, 0x77, 0x42, 0xF7, 0x70, 0xCB, 0xF6, 0x13, 0xCB, 0xE2, 0x0B, 0xD5, 0x96, 0x93, 0xA5, 0x7B, 0x4D, 0x88, 0x9B, 0x85, 0xB5, 0x08, 0x02, 0x84, 0xA9, 0xEB, 0xF3, 0xCC, 0xF2, 0x2C, 0xBE, 0xC9, 0x11, 0xDD, 0x04, 0x30, 0x73, 0x9A, 0xCC, 0x74, 0x68, 0xC7, 0x53, 0x69, 0xD6, 0x9D, 0x4D, 0xCD, 0x75, 0x60, 0x18, 0x85, 0xDD, 0xE7, 0x48, 0x50, 0xDC, 0xD6, 0x3B, 0x10, 0x10, 0x29, 0x16, 0x60, 0x6C, 0x71, 0xC2, 0x83, 0xC0, 0x9F, 0x52, 0x50, 0xCB, 0xF7, 0x5F, 0x23, 0xF4, 0x86, 0x1A, 0x02, 0x6D, 0x68, 0x0B, 0x0B, 0x0D, 0xAE, 0x0D, 0xE6, 0x29, 0x6A, 0x0E, 0xC6, 0x8C, 0x14, 0x9C, 0xC6, 0x09, 0xB7, 0x9E, 0x29, 0x19, 0x4E, 0xE0, 0x6F, 0xD8, 0x23 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ try {
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 1", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // Max = (key size in bytes) - 2 * (hash length) - 2
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchangeMax()
+ {
+ byte[] M = new byte [(key.KeySize >> 3) - 2 * 20 - 2];
+ byte[] EM = { 0x78, 0x6B, 0xFA, 0x33, 0x7A, 0x29, 0xD5, 0x46, 0x13, 0x14, 0x83, 0xF5, 0xF7, 0x5D, 0xF8, 0xE3, 0x77, 0xCC, 0xB4, 0x51, 0x62, 0xBB, 0x77, 0x57, 0xFA, 0x3E, 0x4E, 0x17, 0xF1, 0xC9, 0x97, 0x3C, 0xA9, 0xE6, 0x10, 0x6A, 0x83, 0xC3, 0x63, 0x41, 0x46, 0x32, 0x54, 0xB3, 0x1A, 0x66, 0x84, 0x33, 0x24, 0x69, 0x5E, 0xA7, 0x69, 0x6D, 0x87, 0x7A, 0xED, 0xAB, 0x8E, 0x0E, 0x8C, 0xD1, 0x9B, 0xED, 0x3F, 0x37, 0xF1, 0x3A, 0x38, 0x0C, 0x7A, 0x7E, 0xD1, 0xE4, 0x9D, 0x7D, 0xB8, 0xF3, 0xE5, 0xBF, 0xEB, 0x28, 0xCC, 0xF2, 0x2F, 0x26, 0x70, 0x7D, 0x49, 0x05, 0x2B, 0x82, 0xBB, 0xEB, 0x8A, 0x17, 0x80, 0x76, 0xCA, 0xF3, 0xD3, 0xB9, 0x5C, 0x7A, 0x5E, 0x0B, 0x1A, 0x50, 0x7E, 0x00, 0x44, 0x8F, 0xD5, 0xD3, 0xA2, 0xA7, 0xBE, 0xA8, 0xC7, 0x9B, 0x49, 0x47, 0x7E, 0x9A, 0x0D, 0xFE, 0x4D, 0x29 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ try {
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 1", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // TestExchangeTooBig
+ public void TestExchangeTooBig()
+ {
+ AsymmetricKeyExchangeDeformatter keyex = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] EM = new byte [(key.KeySize >> 3) + 1];
+ try {
+ // invalid format
+ byte[] M = keyex.DecryptKeyExchange (EM);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got : " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeFormatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeFormatterTest.cs
new file mode 100644
index 00000000000..0bcd593a927
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAOAEPKeyExchangeFormatterTest.cs
@@ -0,0 +1,134 @@
+//
+// RSAOAEPKeyExchangeFormatterTest.cs - NUnit Test Cases for RSAOAEPKeyExchangeFormatter
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RSAOAEPKeyExchangeFormatterTest : TestCase {
+ protected static RSA key;
+
+ protected override void SetUp ()
+ {
+ // generating a keypair is REALLY long and the framework
+ // makes sure that we generate one (even if create an object
+ // to import an exsting key)
+ if (key == null) {
+ key = RSA.Create ();
+ key.ImportParameters (AllTests.GetRsaKey (true));
+ }
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ public void TestProperties ()
+ {
+ RSAOAEPKeyExchangeFormatter keyex = new RSAOAEPKeyExchangeFormatter ();
+ keyex.SetKey (key);
+ AssertEquals("RSAOAEPKeyExchangeFormatter.Parameters", null, keyex.Parameters);
+ // null (default)
+ AssertNull("RSAOAEPKeyExchangeFormatter.Rng", keyex.Rng);
+ AssertEquals("RSAOAEPKeyExchangeFormatter.ToString()", "System.Security.Cryptography.RSAOAEPKeyExchangeFormatter", keyex.ToString ());
+ }
+
+ // TestExchangeMin (1)
+ public void TestExchangeMin()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAOAEPKeyExchangeFormatter (key);
+ byte[] M = { 0x01 };
+ try {
+ byte[] EM = keyex.CreateKeyExchange (M);
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter Min", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // test with a message 128 bits (16 bytes) long
+ public void TestExchange128()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAOAEPKeyExchangeFormatter (key);
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ try {
+ byte[] EM = keyex.CreateKeyExchange (M);
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 128", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // test with a message 160 bits (20 bytes) long
+ public void TestExchange192()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAOAEPKeyExchangeFormatter (key);
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49, 0x00, 0x00, 0x00, 0x00 };
+ try {
+ byte[] EM = keyex.CreateKeyExchange (M);
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter 192", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // Max = (key size in bytes) - 2 * (hash length) - 2
+ public void TestExchangeMax()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAOAEPKeyExchangeFormatter (key);
+ // use SHA1 internaly
+ byte[] M = new byte [(key.KeySize >> 3) - 2 * 20 - 2];
+ try {
+ byte[] EM = keyex.CreateKeyExchange (M);
+ AsymmetricKeyExchangeDeformatter keyback = new RSAOAEPKeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAOAEPKeyExchangeFormatter Max", M, Mback);
+ }
+ catch (CryptographicException) {
+ // not supported by every version of Windows
+ // Minimum: Windows 2000 + High Encryption Pack
+ }
+ }
+
+ // TestExchangeTooBig
+ public void TestExchangeTooBig()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAOAEPKeyExchangeFormatter (key);
+ byte[] M = new byte [(key.KeySize >> 3)- 10];
+ try {
+ byte[] EM = keyex.CreateKeyExchange (M);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got : " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatterTest.cs
new file mode 100644
index 00000000000..77aaaa17607
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatterTest.cs
@@ -0,0 +1,163 @@
+//
+// RSAPKCS1KeyExchangeDeformatterTest.cs - NUnit Test Cases for RSAPKCS1KeyExchangeDeformatter
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RSAPKCS1KeyExchangeDeformatterTest : TestCase {
+ protected static RSA key;
+
+ protected override void SetUp ()
+ {
+ // generating a keypair is REALLY long and the framework
+ // makes sure that we generate one (even if create an object
+ // to import an existing key)
+ if (key == null) {
+ key = RSA.Create ();
+ key.ImportParameters (AllTests.GetRsaKey (true));
+ }
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // LAMESPEC: RSAPKCS1KeyExchangeDeformatter.RNG versus RSAPKCS1KeyExchangeFormatter.Rng
+ public void TestProperties ()
+ {
+ RSAPKCS1KeyExchangeDeformatter keyex = new RSAPKCS1KeyExchangeDeformatter ();
+ keyex.SetKey (key);
+ AssertNull("RSAPKCS1KeyExchangeDeformatter.Parameters", keyex.Parameters);
+ // null (default)
+ AssertNull("RSAPKCS1KeyExchangeDeformatter.RNG", keyex.RNG);
+ AssertEquals("RSAPKCS1KeyExchangeDeformatter.ToString()", "System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter", keyex.ToString ());
+ }
+
+ // TestExchangeMin (1)
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchangeMin()
+ {
+ byte[] M = { 0x01 };
+ byte[] EM = { 0x50, 0x33, 0xF3, 0x42, 0x52, 0x59, 0x71, 0x2D, 0x6E, 0x25, 0x5E, 0x06, 0xC3, 0x27, 0x94, 0xA6, 0xD1, 0x8E, 0x13, 0x90, 0x54, 0x5C, 0x12, 0x58, 0x7A, 0xC9, 0xB6, 0x3F, 0x4D, 0x2E, 0x97, 0xCC, 0x3A, 0x94, 0x24, 0xE8, 0x11, 0x1F, 0xD6, 0x7F, 0x37, 0x36, 0xAB, 0x6F, 0x3F, 0xB4, 0x1B, 0xB8, 0x13, 0x87, 0xC8, 0xBE, 0x00, 0x24, 0x02, 0x0F, 0xF6, 0x2E, 0xEA, 0x48, 0x8A, 0x6F, 0xC8, 0xF6, 0x0B, 0xAB, 0xF4, 0x02, 0xA5, 0xE2, 0x5A, 0xAA, 0xB5, 0x9E, 0xC2, 0x6E, 0xFF, 0xA6, 0xEC, 0xEC, 0xD0, 0xA2, 0x3F, 0x00, 0x93, 0xE9, 0xF3, 0xAA, 0x08, 0xA2, 0xD2, 0x11, 0x1B, 0x3F, 0x3E, 0x59, 0xB0, 0xBA, 0x47, 0x17, 0x8F, 0xF4, 0xEB, 0x34, 0xA5, 0xC4, 0xA4, 0x09, 0x43, 0xC4, 0x7B, 0x71, 0x2C, 0x4B, 0x9E, 0x2D, 0x22, 0x96, 0xBB, 0x52, 0xDD, 0x2B, 0x59, 0xED, 0xD6, 0xCA, 0xEB, 0xE6 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeDeformatter 1", M, Mback);
+ }
+
+ // test with a message 128 bits (16 bytes) long
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchange128()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ byte[] EM = { 0x2D, 0xA3, 0xB0, 0xED, 0x1F, 0x13, 0x13, 0xBA, 0xAA, 0x26, 0xA7, 0x00, 0x76, 0x94, 0x0A, 0xDA, 0xFB, 0x4E, 0x14, 0x98, 0xD3, 0xF6, 0x26, 0x65, 0xCE, 0x7E, 0xB9, 0x23, 0xEF, 0xDE, 0x6E, 0xAB, 0x72, 0x33, 0xF3, 0x6F, 0xA9, 0x9B, 0xEC, 0x18, 0xC9, 0xB7, 0xC7, 0xE8, 0xE8, 0x55, 0xC4, 0x83, 0x1E, 0xF5, 0xDA, 0xCF, 0x5A, 0x53, 0xB0, 0x60, 0x42, 0xF4, 0x55, 0xEE, 0x00, 0x80, 0x92, 0x28, 0xA9, 0x0E, 0x2D, 0x9D, 0x49, 0x10, 0x65, 0x00, 0x21, 0x82, 0xCC, 0x05, 0xA3, 0x62, 0xAD, 0xCC, 0x5B, 0xE3, 0x8E, 0xAE, 0x01, 0x96, 0x81, 0xF6, 0x7B, 0x52, 0xB9, 0x6F, 0xE3, 0x06, 0x3A, 0x48, 0x4D, 0x87, 0xB9, 0xA3, 0xEA, 0x69, 0xD1, 0xFE, 0x8D, 0x82, 0x33, 0xE3, 0x05, 0xEB, 0x00, 0xA2, 0xA6, 0xDC, 0x95, 0xE4, 0xAC, 0x4E, 0xF4, 0x03, 0xC3, 0xFE, 0xA2, 0xE8, 0xB6, 0xBB, 0xBE, 0xD1 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // test with a message 160 bits (20 bytes) long
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchange192()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49, 0x00, 0x00, 0x00, 0x00 };
+ byte[] EM = { 0x10, 0x79, 0x3A, 0x88, 0x04, 0x4B, 0xA5, 0x18, 0xD6, 0xCE, 0x97, 0x9B, 0xFF, 0xE8, 0xB4, 0xF5, 0x8D, 0x60, 0x07, 0xCD, 0x5F, 0x89, 0xA6, 0xCF, 0x5B, 0x90, 0x96, 0xC7, 0xF6, 0xD7, 0xF2, 0xCA, 0x7C, 0x13, 0x5A, 0x62, 0xB4, 0xED, 0xF4, 0xD7, 0x5C, 0x99, 0x4C, 0x07, 0xF4, 0x9F, 0x96, 0xE6, 0xBF, 0x2B, 0x82, 0x85, 0x38, 0x2C, 0x03, 0xBD, 0x61, 0x07, 0xF6, 0x05, 0x15, 0x55, 0xBF, 0xA9, 0x3B, 0xF5, 0x10, 0x96, 0x81, 0x01, 0x58, 0x5F, 0x61, 0x43, 0x52, 0x77, 0x71, 0x9C, 0x92, 0xEF, 0xD5, 0xE2, 0x60, 0x3F, 0x82, 0x69, 0x9F, 0xAF, 0xC2, 0xE1, 0x68, 0xB7, 0x5E, 0x62, 0xAC, 0x61, 0x6A, 0x1B, 0x46, 0x03, 0xF6, 0x7C, 0x20, 0x47, 0xF7, 0x6E, 0x7D, 0x35, 0x2A, 0xF6, 0x9C, 0xDA, 0x8A, 0xED, 0xAC, 0x1A, 0xC8, 0xF6, 0x4E, 0x7D, 0x21, 0xAC, 0x18, 0xEB, 0xA7, 0x68, 0xE0, 0xE2 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // Max = k - m - 11
+ // Test vector (EM) generated by CryptoAPI on Windows
+ public void TestCapiExchangeMax()
+ {
+ byte[] M = new byte [(key.KeySize >> 3)- 11];
+ byte[] EM = { 0x4B, 0x3F, 0x77, 0xE1, 0xA0, 0x6C, 0xD9, 0xFA, 0x19, 0x69, 0x21, 0xC4, 0x67, 0x2B, 0x0F, 0x2A, 0x0E, 0xCB, 0xAF, 0xAD, 0x08, 0xA5, 0xD2, 0x9B, 0xDC, 0x04, 0xDE, 0x8F, 0x13, 0xE4, 0x81, 0x25, 0xAF, 0xC5, 0x82, 0x51, 0xA9, 0x39, 0xAF, 0x82, 0xFF, 0xC7, 0x4F, 0x04, 0xE4, 0x21, 0xAC, 0xEE, 0x2F, 0x44, 0x78, 0x11, 0x29, 0x74, 0x3F, 0x74, 0xC1, 0x38, 0xC5, 0x43, 0x29, 0x2F, 0x0C, 0x7B, 0xDB, 0x2E, 0xE5, 0xA8, 0x6A, 0xEE, 0x6A, 0x14, 0xCC, 0x4E, 0x53, 0x8C, 0x0C, 0xEE, 0x23, 0x24, 0xDC, 0x9B, 0x75, 0x7C, 0xAD, 0x0C, 0xAC, 0x13, 0xC5, 0x02, 0x9E, 0x5D, 0x65, 0x76, 0xCB, 0xD4, 0xBF, 0x70, 0x43, 0xBE, 0x28, 0x67, 0x3F, 0x5D, 0x93, 0x38, 0x67, 0x4B, 0x25, 0x59, 0xF7, 0x8E, 0x4F, 0xCE, 0x2B, 0x2F, 0xA7, 0x4C, 0x68, 0x4C, 0xCC, 0x5F, 0xF3, 0x0A, 0xB7, 0xAA, 0x54, 0x7C };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // TestExchangeMin (1)
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchangeMin()
+ {
+ byte[] M = { 0x01 };
+ byte[] EM = { 0x73, 0x34, 0xAF, 0xE5, 0x45, 0x53, 0x4A, 0x93, 0x25, 0x77, 0x6F, 0x80, 0x06, 0xAD, 0x7C, 0x87, 0xB9, 0xE8, 0x1E, 0x5C, 0xBB, 0x9B, 0x3F, 0xDC, 0x9C, 0x65, 0x71, 0xE6, 0x50, 0x82, 0xDC, 0x77, 0x6C, 0x6B, 0xA6, 0x39, 0x18, 0x0B, 0x33, 0x54, 0x4E, 0x65, 0x32, 0x6C, 0x53, 0x70, 0x9B, 0xEA, 0x7C, 0x83, 0x0D, 0xBF, 0x8B, 0x48, 0x5B, 0x0F, 0xCB, 0x27, 0x7D, 0x8D, 0x18, 0xD7, 0xA5, 0x13, 0x33, 0x3C, 0xC8, 0xB0, 0xF4, 0x12, 0x52, 0x24, 0x3C, 0x2A, 0xD2, 0xDF, 0x7C, 0x0B, 0xCB, 0x7C, 0x26, 0x28, 0x5F, 0x88, 0x1E, 0x22, 0x98, 0x68, 0x04, 0x12, 0x6E, 0x9F, 0x2D, 0xFE, 0x7A, 0xEF, 0xC3, 0x9D, 0x87, 0x44, 0x46, 0xCA, 0xA2, 0x81, 0xF2, 0xE7, 0xBA, 0x9D, 0x17, 0x68, 0x96, 0xA2, 0x3F, 0xB3, 0xB4, 0x43, 0x34, 0x2D, 0x7D, 0x56, 0xF5, 0xFC, 0x40, 0xEB, 0x31, 0xB0, 0x0C, 0x99 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeDeformatter 1", M, Mback);
+ }
+
+ // test with a message 128 bits (16 bytes) long
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchange128()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ byte[] EM = { 0xAA, 0x95, 0x6D, 0x40, 0xA7, 0x26, 0x23, 0x4E, 0xA9, 0xCB, 0x83, 0x55, 0xCE, 0x2F, 0xDD, 0x80, 0xEA, 0xC8, 0x61, 0x25, 0x57, 0xF9, 0x86, 0x46, 0x2E, 0xD9, 0xAD, 0xA1, 0x90, 0x22, 0x6A, 0x1F, 0xCF, 0x24, 0x9D, 0x3A, 0x65, 0x75, 0xF6, 0x9E, 0xBD, 0xC0, 0xBB, 0x8F, 0xC0, 0xC3, 0x20, 0x45, 0xC9, 0x8C, 0x5F, 0xEA, 0xF9, 0xE3, 0x1E, 0x95, 0xA0, 0xAD, 0xD6, 0xB6, 0x3C, 0x9B, 0x03, 0x9F, 0xB0, 0x57, 0x32, 0x2F, 0x98, 0x0E, 0x94, 0x8C, 0x6E, 0xA7, 0x9F, 0x40, 0xCF, 0xAD, 0x6E, 0xDB, 0x38, 0x9F, 0xF5, 0x43, 0xD1, 0x70, 0xF9, 0xCA, 0x3A, 0x2E, 0x0B, 0xB9, 0x34, 0x12, 0x0F, 0x09, 0x5B, 0x6B, 0xB9, 0xFD, 0x7E, 0xC6, 0xFC, 0xA1, 0x9A, 0x48, 0xEA, 0x3A, 0xED, 0x77, 0x24, 0xA5, 0x3B, 0x8B, 0xFB, 0xF1, 0x2B, 0x9D, 0xED, 0x0A, 0xB5, 0x05, 0xDC, 0x59, 0xA8, 0x1F, 0x17, 0xC9 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // test with a message 160 bits (20 bytes) long
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchange192()
+ {
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49, 0x00, 0x00, 0x00, 0x00 };
+ byte[] EM = { 0x31, 0x2B, 0x21, 0x0F, 0x1D, 0x75, 0xCE, 0xDF, 0x00, 0xC4, 0xC2, 0x50, 0x59, 0x13, 0xDA, 0xF4, 0xE4, 0x73, 0xD3, 0x26, 0xC7, 0xBD, 0xAF, 0xDC, 0x73, 0xB1, 0xC0, 0x32, 0xE3, 0xE9, 0x91, 0x4C, 0x1F, 0x74, 0x29, 0x8C, 0xD6, 0xFD, 0x4C, 0x8C, 0xD2, 0x30, 0xED, 0xEF, 0x97, 0xF1, 0x91, 0xFF, 0xD8, 0x3D, 0x04, 0xD2, 0x2D, 0xB7, 0x20, 0x25, 0x1D, 0x47, 0xBA, 0xEA, 0x3D, 0xE2, 0x7D, 0x9C, 0x41, 0x0C, 0x5C, 0x63, 0xBC, 0xB7, 0xFA, 0xDD, 0x30, 0x19, 0x3E, 0xD2, 0x5F, 0x1B, 0xBC, 0x59, 0x0A, 0x54, 0x0A, 0xE0, 0x82, 0x5D, 0x05, 0xA4, 0xDC, 0x23, 0x71, 0x33, 0x84, 0x68, 0xDA, 0x8C, 0x7A, 0x23, 0x2E, 0x16, 0x28, 0x3E, 0x43, 0x24, 0x30, 0x69, 0xD4, 0x43, 0x7F, 0x82, 0xA8, 0xAC, 0xFF, 0xCC, 0xA6, 0x62, 0x20, 0x61, 0x5F, 0x03, 0xEE, 0x7C, 0x9E, 0x5C, 0xB2, 0xA0, 0xE4, 0xC6 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // Max = k - m - 11
+ // Test vector (EM) generated by Mono on Windows
+ public void TestMonoExchangeMax()
+ {
+ byte[] M = new byte [(key.KeySize >> 3)- 11];
+ byte[] EM = { 0xB4, 0x17, 0xE4, 0x8A, 0x14, 0xB1, 0x9B, 0x08, 0xBE, 0xBF, 0xD3, 0xD1, 0xCD, 0xE5, 0xB1, 0x0D, 0x38, 0x08, 0x01, 0x31, 0x10, 0xDA, 0x8A, 0xB9, 0xE9, 0x4E, 0x2F, 0x94, 0x2F, 0x40, 0x36, 0x04, 0x57, 0x54, 0xAC, 0x22, 0xC1, 0x6B, 0x35, 0x10, 0xF9, 0xA9, 0xEA, 0x36, 0xC9, 0x13, 0x84, 0x95, 0xCB, 0xDE, 0x9C, 0x01, 0x66, 0x32, 0x01, 0xA1, 0xB2, 0xDB, 0x4F, 0x11, 0x10, 0x2D, 0x13, 0x36, 0x52, 0x30, 0x78, 0x65, 0x00, 0x7A, 0xD8, 0x5B, 0x47, 0xA6, 0x19, 0x9C, 0xFA, 0x76, 0x1A, 0x44, 0x92, 0x3E, 0xE3, 0x5A, 0x0B, 0x56, 0x4D, 0x2D, 0x54, 0x7B, 0x07, 0x5C, 0xA7, 0x14, 0x86, 0x52, 0x0A, 0x8F, 0x11, 0xE2, 0x32, 0xED, 0x3C, 0x21, 0xF8, 0x56, 0x0D, 0x38, 0xAC, 0x24, 0x4A, 0x32, 0xB3, 0x4F, 0xA3, 0xB1, 0x02, 0xC7, 0x8A, 0x22, 0xE6, 0x9C, 0x78, 0xEB, 0x98, 0x4B, 0x92, 0x24 };
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // TestExchangeTooBig
+ public void TestExchangeTooBig()
+ {
+ AsymmetricKeyExchangeDeformatter keyex = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] EM = new byte [(key.KeySize >> 3) + 1];
+ try {
+ // invalid format
+ byte[] M = keyex.DecryptKeyExchange (EM);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got : " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatterTest.cs
new file mode 100644
index 00000000000..8a9a707c057
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1KeyExchangeFormatterTest.cs
@@ -0,0 +1,117 @@
+//
+// RSAPKCS1KeyExchangeFormatterTest.cs - NUnit Test Cases for RSAPKCS1KeyExchangeFormatter
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+public class RSAPKCS1KeyExchangeFormatterTest : TestCase
+{
+ protected static RSA key;
+
+ protected override void SetUp ()
+ {
+ // generating a keypair is REALLY long and the framework
+ // makes sure that we generate one (even if create an object
+ // to import an exsting key)
+ if (key == null) {
+ key = RSA.Create ();
+ key.ImportParameters (AllTests.GetRsaKey (true));
+ }
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ public void TestProperties ()
+ {
+ RSAPKCS1KeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter ();
+ keyex.SetKey (key);
+ AssertEquals("RSAPKCS1KeyExchangeFormatter.Parameters", "<enc:KeyEncryptionMethod enc:Algorithm=\"http://www.microsoft.com/xml/security/algorithm/PKCS1-v1.5-KeyEx\" xmlns:enc=\"http://www.microsoft.com/xml/security/encryption/v1.0\" />", keyex.Parameters);
+ // null (default)
+ AssertNull("RSAPKCS1KeyExchangeFormatter.Rng", keyex.Rng);
+ AssertEquals("RSAPKCS1KeyExchangeFormatter.ToString()", "System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter", keyex.ToString ());
+ }
+
+ // TestExchangeMin (1)
+ public void TestExchangeMin()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter (key);
+ byte[] M = { 0x01 };
+ byte[] EM = keyex.CreateKeyExchange (M);
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // TestExchange64, 128, 192, 256
+
+ // test with a message 128 bits (16 bytes) long
+ public void TestExchange128()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter (key);
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49 };
+ byte[] EM = keyex.CreateKeyExchange (M);
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // test with a message 160 bits (20 bytes) long
+ public void TestExchange192()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter (key);
+ byte[] M = { 0xd4, 0x36, 0xe9, 0x95, 0x69, 0xfd, 0x32, 0xa7, 0xc8, 0xa0, 0x5b, 0xbc, 0x90, 0xd3, 0x2c, 0x49, 0x00, 0x00, 0x00, 0x00 };
+ byte[] EM = keyex.CreateKeyExchange (M);
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // Max = k - m - 11
+ public void TestExchangeMax()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter (key);
+ byte[] M = new byte [(key.KeySize >> 3)- 11];
+ byte[] EM = keyex.CreateKeyExchange (M);
+
+ AsymmetricKeyExchangeDeformatter keyback = new RSAPKCS1KeyExchangeDeformatter (key);
+ byte[] Mback = keyback.DecryptKeyExchange (EM);
+ AssertEquals ("RSAPKCS1KeyExchangeFormatter 1", M, Mback);
+ }
+
+ // TestExchangeTooBig
+ public void TestExchangeTooBig()
+ {
+ AsymmetricKeyExchangeFormatter keyex = new RSAPKCS1KeyExchangeFormatter (key);
+ byte[] M = new byte [(key.KeySize >> 3)- 10];
+ try {
+ byte[] EM = keyex.CreateKeyExchange (M);
+ Fail ("Expected CryptographicException but got none");
+ }
+ catch (CryptographicException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected CryptographicException but got : " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
new file mode 100644
index 00000000000..7d0f631ac98
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
@@ -0,0 +1,291 @@
+//
+// RSAPKCS1SignatureDeformatterTest.cs - NUnit tests for PKCS#1 v.1.5 signature.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RSAPKCS1SignatureDeformatterTest : TestCase {
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ public void TestConstructors ()
+ {
+ RSAPKCS1SignatureDeformatter fmt;
+ fmt = new RSAPKCS1SignatureDeformatter ();
+ AssertNotNull ("RSAPKCS1SignatureDeformatter()", fmt);
+
+ fmt = new RSAPKCS1SignatureDeformatter (null);
+ AssertNotNull ("RSAPKCS1SignatureDeformatter(null)", fmt);
+
+ RSA rsa = RSA.Create ();
+ fmt = new RSAPKCS1SignatureDeformatter (rsa);
+ AssertNotNull ("RSAPKCS1SignatureDeformatter(rsa)", fmt);
+
+ DSA dsa = DSA.Create ();
+ try {
+ fmt = new RSAPKCS1SignatureDeformatter (dsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestSetKey ()
+ {
+ RSAPKCS1SignatureDeformatter fmt;
+ fmt = new RSAPKCS1SignatureDeformatter ();
+ try {
+ fmt.SetKey (RSA.Create ());
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetKey (DSA.Create ());
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetKey (null);
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestSetHashAlgorithm ()
+ {
+ RSAPKCS1SignatureDeformatter fmt;
+ fmt = new RSAPKCS1SignatureDeformatter ();
+
+ try {
+ fmt.SetHashAlgorithm ("SHA1");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("MD5");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("SHA256");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("SHA384");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("SHA512");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ }
+
+ public void TestVerifySignature ()
+ {
+ RSAPKCS1SignatureDeformatter fmt = new RSAPKCS1SignatureDeformatter ();
+
+ // no hash algorithm
+ byte[] hash = new byte [1];
+ byte[] signature = new byte [1];
+ try {
+ fmt.VerifySignature (hash, signature);
+ Fail ("VerifySignature(?) no hash algo - Expected CryptographicUnexpectedOperationException but none");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("VerifySignature(?) no hash algo - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ());
+ }
+
+ // no key
+ fmt.SetHashAlgorithm ("SHA1");
+ hash = new byte [20];
+ try {
+ fmt.VerifySignature (hash, signature);
+ Fail ("VerifySignature(?) no key - Expected CryptographicUnexpectedOperationException but none");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("VerifySignature(?) no key - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ());
+ }
+
+ // no need for the private key
+ RSA rsa = RSA.Create ();
+ rsa.ImportParameters (AllTests.GetRsaKey (false));
+ fmt.SetKey (rsa);
+
+ // good SHA1
+ fmt.SetHashAlgorithm ("SHA1");
+ hash = new byte [20];
+ byte[] shaSignature = { 0x51, 0xE1, 0x69, 0xC4, 0x84, 0x0C, 0x33, 0xD9, 0x80, 0xC0, 0xBD, 0x85, 0x87, 0x6E, 0x85, 0x91, 0xB9, 0xD5, 0xB6, 0xE1, 0xAB, 0xD3, 0x06, 0x83, 0xCF, 0x33, 0x56, 0xB9, 0xE6, 0x2C, 0x37, 0xC0, 0x08, 0xFC, 0x81, 0x15, 0xAB, 0x57, 0x80, 0xE4, 0xB9, 0x95, 0x4B, 0xFA, 0x63, 0x13, 0x5E, 0xA9, 0x6E, 0xAB, 0xB0, 0x89, 0xF3, 0xD0, 0xE9, 0xC7, 0xE7, 0xA0, 0xE2, 0xB6, 0x0A, 0xFF, 0x46, 0x2B, 0x8B, 0xC1, 0x4C, 0xEA, 0xDB, 0xEA, 0xD6, 0xF5, 0xA5, 0x2C, 0x8C, 0x1D, 0x57, 0xDF, 0x2D, 0xF0, 0x6B, 0x1D, 0xA9, 0xAE, 0x7F, 0x10, 0x02, 0xE2, 0x05, 0x7E, 0xD2, 0x80, 0xFC, 0x0E, 0x5A, 0xFD, 0xE9, 0xDB, 0x1B, 0xBA, 0xB4, 0xF7, 0x50, 0x88, 0x73, 0x95, 0xBD, 0x3C, 0xCB, 0x33, 0x02, 0xF5, 0x55, 0x10, 0xA6, 0x1B, 0xFD, 0x1D, 0xB1, 0x0E, 0xE3, 0xD0, 0xB7, 0x14, 0x8D, 0x45, 0xC4, 0xF3 };
+ Assert ("VerifySignature(SHA1, sign)", fmt.VerifySignature (hash, shaSignature));
+
+ // bad signature
+ shaSignature [0] = (byte) ~shaSignature [0];
+ Assert ("VerifySignature(SHA1, badSign)", !fmt.VerifySignature (hash, shaSignature));
+
+ // wrong SHA1 length
+ hash = new byte [19];
+ try {
+ fmt.VerifySignature (hash, shaSignature);
+ Fail ("VerifySignature(badSHA1, sign) - Should have thrown an CryptographicException");
+ }
+ catch (CryptographicException) {
+ // this is expected (invalid hash length)
+ }
+ catch (Exception e) {
+ Fail ("VerifySignature(badSHA1, sign) - Unexpected exception: " + e.ToString ());
+ }
+
+ // wrong signature length
+ hash = new byte [20];
+ shaSignature = new byte [shaSignature.Length-1];
+ Assert ("VerifySignature(SHA1, badSign)", !fmt.VerifySignature (hash, shaSignature));
+
+ // good MD5
+ fmt.SetHashAlgorithm ("MD5");
+ hash = new byte [16];
+ byte[] md5Signature = { 0xB4, 0xA9, 0xE9, 0x76, 0x04, 0x0E, 0x0E, 0x04, 0xA3, 0x68, 0x9E, 0x50, 0xD1, 0x29, 0x07, 0x22, 0x45, 0x41, 0x72, 0x1F, 0xBE, 0x74, 0x78, 0xDA, 0x5F, 0x22, 0x4B, 0x45, 0xA8, 0x5F, 0x2D, 0xA5, 0x5F, 0x01, 0x84, 0xA7, 0xF3, 0x6E, 0xB8, 0x8B, 0xF3, 0x29, 0xB2, 0x82, 0xE6, 0x5D, 0x1A, 0x98, 0xAE, 0x9C, 0x2E, 0xB0, 0xDD, 0x3F, 0x8D, 0xF9, 0x1C, 0x9E, 0x40, 0x25, 0x01, 0x9F, 0x92, 0x4E, 0xBE, 0x11, 0xE5, 0xE8, 0xE0, 0xF6, 0x3E, 0xDF, 0x8D, 0x1A, 0xC7, 0x26, 0x37, 0xF7, 0x01, 0x95, 0x48, 0xD8, 0x07, 0x4D, 0x0E, 0xDE, 0xB2, 0x76, 0xD1, 0x23, 0xBD, 0x74, 0xE9, 0xC3, 0x63, 0xB3, 0xE7, 0xCE, 0xA2, 0xEA, 0x20, 0x19, 0x1C, 0x4D, 0x8D, 0xBB, 0xAB, 0x6E, 0xB0, 0xD0, 0x08, 0xC2, 0x2B, 0x69, 0xA4, 0xF3, 0xE9, 0x23, 0xAC, 0x93, 0xB2, 0x0F, 0x90, 0x95, 0x6A, 0x66, 0xDC, 0x44 };
+ Assert ("VerifySignature(MD5, sign)", fmt.VerifySignature (hash, md5Signature));
+
+ // bad signature
+ md5Signature [0] = (byte) ~md5Signature [0];
+ Assert ("VerifySignature(MD5, badSign)", !fmt.VerifySignature (hash, md5Signature));
+
+ // wrong MD5 length
+ hash = new byte [17];
+ try {
+ fmt.VerifySignature (hash, md5Signature);
+ Fail ("VerifySignature(badMD5, sign) - Should have thrown an CryptographicException");
+ }
+ catch (CryptographicException) {
+ // this is expected (invalid hash length)
+ }
+ catch (Exception e) {
+ Fail ("VerifySignature(badMD5, sign) - Unexpected exception: " + e.ToString ());
+ }
+
+ // wrong signature length
+ hash = new byte [16];
+ md5Signature = new byte [md5Signature.Length-1];
+ Assert ("VerifySignature(MD5, badSign)", !fmt.VerifySignature (hash, md5Signature));
+ }
+
+ public void TestVerifySignatureHash ()
+ {
+ RSAPKCS1SignatureDeformatter fmt = new RSAPKCS1SignatureDeformatter ();
+ HashAlgorithm hash = null;
+ byte[] data = new byte [20];
+
+ // no hash algorithm
+ byte[] signature = new byte [1];
+ try {
+ fmt.VerifySignature (hash, signature);
+ Fail ("VerifySignature(?) no hash - Expected ArgumentNullException but none");
+ }
+ catch (ArgumentNullException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("VerifySignature(?) no hash - Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ // no key
+ hash = SHA1.Create ();
+ try {
+ fmt.VerifySignature (hash, signature);
+ Fail ("VerifySignature(?) no key - Expected CryptographicUnexpectedOperationException but none");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("VerifySignature(?) no key - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ());
+ }
+
+ // no need for the private key
+ RSA rsa = RSA.Create ();
+ rsa.ImportParameters (AllTests.GetRsaKey (false));
+ fmt.SetKey (rsa);
+
+ // good SHA1
+ fmt.SetHashAlgorithm ("SHA1");
+ hash = SHA1.Create ();
+ hash.ComputeHash (data);
+ byte[] shaSignature = { 0x7C, 0xA0, 0x13, 0xFB, 0xCB, 0x4D, 0x08, 0x02, 0x3C, 0x6B, 0x88, 0xA6, 0x25, 0x43, 0x17, 0x51, 0xA6, 0xA8, 0x8F, 0x5B, 0xAE, 0xC3, 0x57, 0x75, 0x2A, 0x8B, 0xD8, 0xBA, 0xCF, 0x9B, 0xBB, 0x5A, 0xD5, 0xB0, 0x11, 0xF2, 0xA9, 0xCC, 0xB5, 0x22, 0x59, 0xEE, 0x85, 0x49, 0x11, 0xB6, 0x9C, 0x50, 0x61, 0x4A, 0xEC, 0xA3, 0x50, 0x96, 0xE3, 0x2F, 0x1A, 0x6D, 0x9B, 0x6B, 0x6E, 0xC4, 0x50, 0x50, 0x84, 0x29, 0x92, 0x93, 0xE0, 0x0F, 0xCB, 0xBB, 0x61, 0x5D, 0x36, 0x51, 0x1A, 0xBB, 0x73, 0x75, 0x83, 0xEF, 0xDB, 0x4B, 0x2A, 0x38, 0x2C, 0x37, 0x0A, 0x1F, 0x84, 0xE0, 0x9B, 0x24, 0xDF, 0x69, 0x0E, 0x5C, 0xD9, 0xAF, 0x89, 0x72, 0x45, 0x30, 0xA1, 0xDB, 0xA8, 0x22, 0x40, 0x42, 0x07, 0xCC, 0x2A, 0x0E, 0x90, 0x9A, 0x4D, 0xE5, 0x2B, 0x48, 0x86, 0x4D, 0x01, 0x25, 0x23, 0x95, 0xB5, 0xBD };
+ Assert ("VerifySignature(SHA1, sign)", fmt.VerifySignature (hash, shaSignature));
+
+ // bad signature
+ shaSignature [0] = (byte) ~shaSignature [0];
+ Assert ("VerifySignature(SHA1, badSign)", !fmt.VerifySignature (hash, shaSignature));
+
+ // wrong signature length
+ shaSignature = new byte [shaSignature.Length-1];
+ Assert ("VerifySignature(SHA1, badSign)", !fmt.VerifySignature (hash, shaSignature));
+
+ // good MD5
+ fmt.SetHashAlgorithm ("MD5");
+ hash = MD5.Create ();
+ hash.ComputeHash (data);
+ byte[] md5Signature = { 0x0F, 0xD6, 0x16, 0x2C, 0x31, 0xD6, 0xD7, 0xA0, 0xE8, 0xA0, 0x89, 0x53, 0x7B, 0x36, 0x8F, 0x25, 0xA5, 0xF6, 0x4A, 0x0B, 0xD3, 0xB9, 0x9B, 0xC4, 0xAE, 0xDC, 0xD4, 0x58, 0x5C, 0xD9, 0x58, 0x61, 0xE3, 0x66, 0x89, 0xB1, 0x1E, 0x33, 0x88, 0xDF, 0x58, 0xC4, 0x2E, 0xAE, 0xE7, 0x7B, 0x96, 0x61, 0x77, 0x91, 0xBD, 0xBD, 0x99, 0x9E, 0x1C, 0x3E, 0x0A, 0x5C, 0x15, 0x69, 0x00, 0xFA, 0xEE, 0xD7, 0xDC, 0xD2, 0x62, 0xA3, 0x31, 0x6A, 0x33, 0x75, 0xC8, 0x8E, 0x47, 0x5C, 0x1E, 0xD8, 0x91, 0x36, 0x65, 0xF3, 0x67, 0x63, 0xFC, 0x2B, 0x37, 0x7D, 0xE6, 0x2C, 0x2C, 0x09, 0x45, 0xE1, 0x8D, 0x8C, 0x8F, 0xFC, 0x6A, 0x4A, 0xD1, 0x4D, 0x06, 0xF3, 0x79, 0x9F, 0xDB, 0x0F, 0x4B, 0xD1, 0x94, 0x6F, 0xC7, 0xE7, 0x4E, 0x06, 0xDA, 0xDB, 0x2A, 0x51, 0x62, 0xCA, 0x1A, 0x31, 0x51, 0x2B, 0x83, 0xDD };
+ Assert ("VerifySignature(MD5, sign)", fmt.VerifySignature (hash, md5Signature));
+
+ // bad signature
+ md5Signature [0] = (byte) ~md5Signature [0];
+ try {
+ fmt.VerifySignature (hash, md5Signature);
+ Fail("Should have caught bad signature");
+ } catch (Exception) {
+ // do nothing. This is what we expect.
+ }
+
+ // wrong signature length
+ md5Signature = new byte [md5Signature.Length-1];
+ Assert ("VerifySignature(MD5, badSign)", !fmt.VerifySignature (hash, md5Signature));
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
new file mode 100644
index 00000000000..a727900e4b0
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
@@ -0,0 +1,331 @@
+//
+// RSAPKCS1SignatureFormatterTest.cs - NUnit tests for PKCS#1 v.1.5 signature.
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RSAPKCS1SignatureFormatterTest : TestCase {
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ public void TestConstructors ()
+ {
+ RSAPKCS1SignatureFormatter fmt;
+ fmt = new RSAPKCS1SignatureFormatter ();
+ AssertNotNull ("RSAPKCS1SignatureFormatter()", fmt);
+
+ fmt = new RSAPKCS1SignatureFormatter (null);
+ AssertNotNull ("RSAPKCS1SignatureFormatter(null)", fmt);
+
+ RSA rsa = RSA.Create ();
+ fmt = new RSAPKCS1SignatureFormatter (rsa);
+ AssertNotNull ("RSAPKCS1SignatureFormatter(rsa)", fmt);
+
+ DSA dsa = DSA.Create ();
+ try {
+ fmt = new RSAPKCS1SignatureFormatter (dsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestSetKey ()
+ {
+ RSAPKCS1SignatureFormatter fmt;
+ fmt = new RSAPKCS1SignatureFormatter ();
+ try {
+ fmt.SetKey (RSA.Create ());
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetKey (DSA.Create ());
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetKey (null);
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ }
+
+ public void TestSetHashAlgorithm ()
+ {
+ RSAPKCS1SignatureFormatter fmt;
+ fmt = new RSAPKCS1SignatureFormatter ();
+
+ try {
+ fmt.SetHashAlgorithm ("SHA1");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("MD5");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("SHA256");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("SHA384");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+
+ try {
+ fmt.SetHashAlgorithm ("SHA512");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception: " + e.ToString ());
+ }
+ }
+
+ // see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcongeneratingsignatures.asp
+ public void TestCreateSignature ()
+ {
+ RSAPKCS1SignatureFormatter fmt = new RSAPKCS1SignatureFormatter ();
+
+ // no hash algorithm
+ byte[] hash = new byte [1];
+ byte[] signature = null;
+ try {
+ signature = fmt.CreateSignature (hash);
+ Fail ("CreateSignature(?) no hash algo - Expected CryptographicUnexpectedOperationException but none");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(?) no hash algo - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ());
+ }
+
+ // no key
+ fmt.SetHashAlgorithm ("SHA1");
+ hash = new byte [20];
+ try {
+ signature = fmt.CreateSignature (hash);
+ Fail ("CreateSignature(?) no key - Expected CryptographicUnexpectedOperationException but none");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(?) no key - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ());
+ }
+
+ // we need the private key
+ RSA rsa = RSA.Create ();
+ rsa.ImportParameters (AllTests.GetRsaKey (true));
+ fmt.SetKey (rsa);
+
+ // good SHA1
+ fmt.SetHashAlgorithm ("SHA1");
+ hash = new byte [20];
+ signature = fmt.CreateSignature (hash);
+ AssertNotNull ("CreateSignature(SHA1)", signature);
+
+ // wrong length SHA1
+ fmt.SetHashAlgorithm ("SHA1");
+ hash = new byte [19];
+ try {
+ signature = fmt.CreateSignature (hash);
+ Fail ("CreateSignature(badSHA1) - Should have thrown an CryptographicException");
+ }
+ catch (CryptographicException) {
+ // this is expected (invalid hash length)
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA1) - Unexpected exception: " + e.ToString ());
+ }
+
+ // good MD5
+ fmt.SetHashAlgorithm ("MD5");
+ hash = new byte [16];
+ signature = fmt.CreateSignature (hash);
+ AssertNotNull ("CreateSignature(MD5)", signature);
+
+ // good SHA256
+ fmt.SetHashAlgorithm ("SHA256");
+ hash = new byte [32];
+ try {
+ signature = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicException) {
+ // unknown OID !!!
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA256) - Unexpected exception: " + e.ToString ());
+ }
+
+ // good SHA384
+ fmt.SetHashAlgorithm ("SHA384");
+ hash = new byte [48];
+ try {
+ signature = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicException) {
+ // unknown OID !!!
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA384) - Unexpected exception: " + e.ToString ());
+ }
+
+ // good SHA512
+ fmt.SetHashAlgorithm ("SHA512");
+ hash = new byte [64];
+ try {
+ signature = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicException) {
+ // unknown OID !!!
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA512) - Unexpected exception: " + e.ToString ());
+ }
+
+ // null (bad ;-)
+ hash = null;
+ try {
+ signature = fmt.CreateSignature (hash);
+ Fail ("Expected ArgumentNullException but none");
+ }
+ catch (ArgumentNullException) {
+ // this is was we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestCreateSignatureHash ()
+ {
+ RSAPKCS1SignatureFormatter fmt = new RSAPKCS1SignatureFormatter ();
+ HashAlgorithm hash = null;
+ byte[] data = new byte [20];
+
+ // no hash algorithm
+ byte[] signature = null;
+ try {
+ signature = fmt.CreateSignature (hash);
+ Fail ("CreateSignature(?) no hash algo - Expected ArgumentNullException but none");
+ }
+ catch (ArgumentNullException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(?) no hash algo - Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ // no key
+ hash = SHA1.Create ();
+ hash.ComputeHash (data);
+ try {
+ signature = fmt.CreateSignature (hash);
+ Fail ("CreateSignature(?) no key - Expected CryptographicUnexpectedOperationException but none");
+ }
+ catch (CryptographicUnexpectedOperationException) {
+ // this was expected
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(?) no key - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ());
+ }
+
+ // we need the private key
+ RSA rsa = RSA.Create ();
+ rsa.ImportParameters (AllTests.GetRsaKey (true));
+ fmt.SetKey (rsa);
+
+ // good SHA1
+ hash = SHA1.Create ();
+ hash.ComputeHash (data);
+ signature = fmt.CreateSignature (hash);
+ AssertNotNull ("CreateSignature(SHA1)", signature);
+
+ // good MD5
+ hash = MD5.Create ();
+ hash.ComputeHash (data);
+ signature = fmt.CreateSignature (hash);
+ AssertNotNull ("CreateSignature(MD5)", signature);
+
+ // good SHA256
+ hash = SHA256.Create ();
+ hash.ComputeHash (data);
+ try {
+ signature = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicException) {
+ // unknown OID !!!
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA256) - Unexpected exception: " + e.ToString ());
+ }
+
+ // good SHA384
+ hash = SHA384.Create ();
+ hash.ComputeHash (data);
+ try {
+ signature = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicException) {
+ // unknown OID !!!
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA384) - Unexpected exception: " + e.ToString ());
+ }
+
+ // good SHA512
+ hash = SHA512.Create ();
+ hash.ComputeHash (data);
+ try {
+ signature = fmt.CreateSignature (hash);
+ }
+ catch (CryptographicException) {
+ // unknown OID !!!
+ }
+ catch (Exception e) {
+ Fail ("CreateSignature(badSHA512) - Unexpected exception: " + e.ToString ());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSATest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSATest.cs
new file mode 100644
index 00000000000..2f5021e97c4
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSATest.cs
@@ -0,0 +1,223 @@
+//
+// RSATest.cs - NUnit Test Cases for RSA
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class NonAbstractRSAForUnitTests : RSA {
+ protected RSAParameters rsaParams;
+
+ // not tested here - but we must implemented all abstract properties
+ public override string KeyExchangeAlgorithm {
+ get { return null; }
+ }
+
+ // not tested here - but we must implemented all abstract properties
+ public override string SignatureAlgorithm {
+ get { return null; }
+ }
+
+ // not tested here - but we must implemented all abstract methods
+ public override byte[] DecryptValue (byte[] rgb)
+ {
+ return null;
+ }
+
+ // not tested here - but we must implemented all abstract methods
+ public override byte[] EncryptValue (byte[] rgb) {
+ return null;
+ }
+
+ // basic implementation for tests
+ public override RSAParameters ExportParameters (bool includePrivateParameters)
+ {
+ if (includePrivateParameters)
+ return rsaParams;
+ else {
+ RSAParameters rsaPublicParams = rsaParams;
+ rsaPublicParams.D = null;
+ rsaPublicParams.DP = null;
+ rsaPublicParams.DQ = null;
+ rsaPublicParams.P = null;
+ rsaPublicParams.Q = null;
+ rsaPublicParams.InverseQ = null;
+ return rsaPublicParams;
+ }
+ }
+
+ // basic implementation for tests
+ public override void ImportParameters (RSAParameters parameters)
+ {
+ rsaParams = parameters;
+ }
+
+ // not tested here - but we must implemented all abstract methods
+ protected override void Dispose (bool disposing) {}
+}
+
+
+public class RSATest : TestCase {
+ protected RSA rsa;
+
+ static byte[] rsaModulus = { 0xbb, 0xf8, 0x2f, 0x09, 0x06, 0x82, 0xce, 0x9c, 0x23, 0x38, 0xac, 0x2b, 0x9d, 0xa8, 0x71, 0xf7,
+ 0x36, 0x8d, 0x07, 0xee, 0xd4, 0x10, 0x43, 0xa4, 0x40, 0xd6, 0xb6, 0xf0, 0x74, 0x54, 0xf5, 0x1f,
+ 0xb8, 0xdf, 0xba, 0xaf, 0x03, 0x5c, 0x02, 0xab, 0x61, 0xea, 0x48, 0xce, 0xeb, 0x6f, 0xcd, 0x48,
+ 0x76, 0xed, 0x52, 0x0d, 0x60, 0xe1, 0xec, 0x46, 0x19, 0x71, 0x9d, 0x8a, 0x5b, 0x8b, 0x80, 0x7f,
+ 0xaf, 0xb8, 0xe0, 0xa3, 0xdf, 0xc7, 0x37, 0x72, 0x3e, 0xe6, 0xb4, 0xb7, 0xd9, 0x3a, 0x25, 0x84,
+ 0xee, 0x6a, 0x64, 0x9d, 0x06, 0x09, 0x53, 0x74, 0x88, 0x34, 0xb2, 0x45, 0x45, 0x98, 0x39, 0x4e,
+ 0xe0, 0xaa, 0xb1, 0x2d, 0x7b, 0x61, 0xa5, 0x1f, 0x52, 0x7a, 0x9a, 0x41, 0xf6, 0xc1, 0x68, 0x7f,
+ 0xe2, 0x53, 0x72, 0x98, 0xca, 0x2a, 0x8f, 0x59, 0x46, 0xf8, 0xe5, 0xfd, 0x09, 0x1d, 0xbd, 0xcb };
+ static byte[] rsaExponent = { 0x11 };
+ static byte[] rsaP = { 0xee, 0xcf, 0xae, 0x81, 0xb1, 0xb9, 0xb3, 0xc9, 0x08, 0x81, 0x0b, 0x10, 0xa1, 0xb5, 0x60, 0x01,
+ 0x99, 0xeb, 0x9f, 0x44, 0xae, 0xf4, 0xfd, 0xa4, 0x93, 0xb8, 0x1a, 0x9e, 0x3d, 0x84, 0xf6, 0x32,
+ 0x12, 0x4e, 0xf0, 0x23, 0x6e, 0x5d, 0x1e, 0x3b, 0x7e, 0x28, 0xfa, 0xe7, 0xaa, 0x04, 0x0a, 0x2d,
+ 0x5b, 0x25, 0x21, 0x76, 0x45, 0x9d, 0x1f, 0x39, 0x75, 0x41, 0xba, 0x2a, 0x58, 0xfb, 0x65, 0x99 };
+ static byte[] rsaQ = { 0xc9, 0x7f, 0xb1, 0xf0, 0x27, 0xf4, 0x53, 0xf6, 0x34, 0x12, 0x33, 0xea, 0xaa, 0xd1, 0xd9, 0x35,
+ 0x3f, 0x6c, 0x42, 0xd0, 0x88, 0x66, 0xb1, 0xd0, 0x5a, 0x0f, 0x20, 0x35, 0x02, 0x8b, 0x9d, 0x86,
+ 0x98, 0x40, 0xb4, 0x16, 0x66, 0xb4, 0x2e, 0x92, 0xea, 0x0d, 0xa3, 0xb4, 0x32, 0x04, 0xb5, 0xcf,
+ 0xce, 0x33, 0x52, 0x52, 0x4d, 0x04, 0x16, 0xa5, 0xa4, 0x41, 0xe7, 0x00, 0xaf, 0x46, 0x15, 0x03 };
+ static byte[] rsaDP = { 0x54, 0x49, 0x4c, 0xa6, 0x3e, 0xba, 0x03, 0x37, 0xe4, 0xe2, 0x40, 0x23, 0xfc, 0xd6, 0x9a, 0x5a,
+ 0xeb, 0x07, 0xdd, 0xdc, 0x01, 0x83, 0xa4, 0xd0, 0xac, 0x9b, 0x54, 0xb0, 0x51, 0xf2, 0xb1, 0x3e,
+ 0xd9, 0x49, 0x09, 0x75, 0xea, 0xb7, 0x74, 0x14, 0xff, 0x59, 0xc1, 0xf7, 0x69, 0x2e, 0x9a, 0x2e,
+ 0x20, 0x2b, 0x38, 0xfc, 0x91, 0x0a, 0x47, 0x41, 0x74, 0xad, 0xc9, 0x3c, 0x1f, 0x67, 0xc9, 0x81 };
+ static byte[] rsaDQ = { 0x47, 0x1e, 0x02, 0x90, 0xff, 0x0a, 0xf0, 0x75, 0x03, 0x51, 0xb7, 0xf8, 0x78, 0x86, 0x4c, 0xa9,
+ 0x61, 0xad, 0xbd, 0x3a, 0x8a, 0x7e, 0x99, 0x1c, 0x5c, 0x05, 0x56, 0xa9, 0x4c, 0x31, 0x46, 0xa7,
+ 0xf9, 0x80, 0x3f, 0x8f, 0x6f, 0x8a, 0xe3, 0x42, 0xe9, 0x31, 0xfd, 0x8a, 0xe4, 0x7a, 0x22, 0x0d,
+ 0x1b, 0x99, 0xa4, 0x95, 0x84, 0x98, 0x07, 0xfe, 0x39, 0xf9, 0x24, 0x5a, 0x98, 0x36, 0xda, 0x3d };
+ static byte[] rsaInverseQ = { 0xb0, 0x6c, 0x4f, 0xda, 0xbb, 0x63, 0x01, 0x19, 0x8d, 0x26, 0x5b, 0xdb, 0xae, 0x94, 0x23, 0xb3,
+ 0x80, 0xf2, 0x71, 0xf7, 0x34, 0x53, 0x88, 0x50, 0x93, 0x07, 0x7f, 0xcd, 0x39, 0xe2, 0x11, 0x9f,
+ 0xc9, 0x86, 0x32, 0x15, 0x4f, 0x58, 0x83, 0xb1, 0x67, 0xa9, 0x67, 0xbf, 0x40, 0x2b, 0x4e, 0x9e,
+ 0x2e, 0x0f, 0x96, 0x56, 0xe6, 0x98, 0xea, 0x36, 0x66, 0xed, 0xfb, 0x25, 0x79, 0x80, 0x39, 0xf7 };
+ static byte[] rsaD = { 0xa5, 0xda, 0xfc, 0x53, 0x41, 0xfa, 0xf2, 0x89, 0xc4, 0xb9, 0x88, 0xdb, 0x30, 0xc1, 0xcd, 0xf8,
+ 0x3f, 0x31, 0x25, 0x1e, 0x06, 0x68, 0xb4, 0x27, 0x84, 0x81, 0x38, 0x01, 0x57, 0x96, 0x41, 0xb2,
+ 0x94, 0x10, 0xb3, 0xc7, 0x99, 0x8d, 0x6b, 0xc4, 0x65, 0x74, 0x5e, 0x5c, 0x39, 0x26, 0x69, 0xd6,
+ 0x87, 0x0d, 0xa2, 0xc0, 0x82, 0xa9, 0x39, 0xe3, 0x7f, 0xdc, 0xb8, 0x2e, 0xc9, 0x3e, 0xda, 0xc9,
+ 0x7f, 0xf3, 0xad, 0x59, 0x50, 0xac, 0xcf, 0xbc, 0x11, 0x1c, 0x76, 0xf1, 0xa9, 0x52, 0x94, 0x44,
+ 0xe5, 0x6a, 0xaf, 0x68, 0xc5, 0x6c, 0x09, 0x2c, 0xd3, 0x8d, 0xc3, 0xbe, 0xf5, 0xd2, 0x0a, 0x93,
+ 0x99, 0x26, 0xed, 0x4f, 0x74, 0xa1, 0x3e, 0xdd, 0xfb, 0xe1, 0xa1, 0xce, 0xcc, 0x48, 0x94, 0xaf,
+ 0x94, 0x28, 0xc2, 0xb7, 0xb8, 0x88, 0x3f, 0xe4, 0x46, 0x3a, 0x4b, 0xc8, 0x5b, 0x1c, 0xb3, 0xc1 };
+
+ static string xmlPrivate = "<RSAKeyValue><Modulus>u/gvCQaCzpwjOKwrnahx9zaNB+7UEEOkQNa28HRU9R+437qvA1wCq2HqSM7rb81Idu1SDWDh7EYZcZ2KW4uAf6+44KPfxzdyPua0t9k6JYTuamSdBglTdIg0skVFmDlO4KqxLXthpR9SeppB9sFof+JTcpjKKo9ZRvjl/Qkdvcs=</Modulus><Exponent>EQ==</Exponent><P>7s+ugbG5s8kIgQsQobVgAZnrn0Su9P2kk7ganj2E9jISTvAjbl0eO34o+ueqBAotWyUhdkWdHzl1QboqWPtlmQ==</P><Q>yX+x8Cf0U/Y0EjPqqtHZNT9sQtCIZrHQWg8gNQKLnYaYQLQWZrQukuoNo7QyBLXPzjNSUk0EFqWkQecAr0YVAw==</Q><DP>VElMpj66Azfk4kAj/NaaWusH3dwBg6TQrJtUsFHysT7ZSQl16rd0FP9ZwfdpLpouICs4/JEKR0F0rck8H2fJgQ==</DP><DQ>Rx4CkP8K8HUDUbf4eIZMqWGtvTqKfpkcXAVWqUwxRqf5gD+Pb4rjQukx/YrkeiING5mklYSYB/45+SRamDbaPQ==</DQ><InverseQ>sGxP2rtjARmNJlvbrpQjs4Dycfc0U4hQkwd/zTniEZ/JhjIVT1iDsWepZ79AK06eLg+WVuaY6jZm7fsleYA59w==</InverseQ><D>pdr8U0H68onEuYjbMMHN+D8xJR4GaLQnhIE4AVeWQbKUELPHmY1rxGV0Xlw5JmnWhw2iwIKpOeN/3LguyT7ayX/zrVlQrM+8ERx28alSlETlaq9oxWwJLNONw7710gqTmSbtT3ShPt374aHOzEiUr5Qowre4iD/kRjpLyFscs8E=</D></RSAKeyValue>";
+
+ static string xmlPublic = "<RSAKeyValue><Modulus>u/gvCQaCzpwjOKwrnahx9zaNB+7UEEOkQNa28HRU9R+437qvA1wCq2HqSM7rb81Idu1SDWDh7EYZcZ2KW4uAf6+44KPfxzdyPua0t9k6JYTuamSdBglTdIg0skVFmDlO4KqxLXthpR9SeppB9sFof+JTcpjKKo9ZRvjl/Qkdvcs=</Modulus><Exponent>EQ==</Exponent></RSAKeyValue>";
+
+ protected override void SetUp ()
+ {
+ rsa = new NonAbstractRSAForUnitTests ();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // may also help for RSA descendants
+ public void AssertEquals (string message, RSAParameters expectedKey, RSAParameters actualKey, bool checkPrivateKey)
+ {
+ if (checkPrivateKey) {
+ AssertEquals( message + " D", expectedKey.D, actualKey.D );
+ AssertEquals( message + " DP", expectedKey.DP, actualKey.DP );
+ AssertEquals( message + " DQ", expectedKey.DQ, actualKey.DQ );
+ AssertEquals( message + " P", expectedKey.P, actualKey.P );
+ AssertEquals( message + " Q", expectedKey.Q, actualKey.Q );
+ AssertEquals( message + " InverseQ", expectedKey.InverseQ, actualKey.InverseQ );
+ }
+ AssertEquals( message + " Modulus", expectedKey.Modulus, actualKey.Modulus );
+ AssertEquals( message + " Exponent", expectedKey.Exponent, actualKey.Exponent );
+ }
+
+ public RSAParameters GetKey (bool includePrivateKey)
+ {
+ RSAParameters p = new RSAParameters();
+ if (includePrivateKey) {
+ p.D = rsaD;
+ p.DP = rsaDP;
+ p.DQ = rsaDQ;
+ p.P = rsaP;
+ p.Q = rsaQ;
+ p.InverseQ = rsaInverseQ;
+ }
+ else {
+ p.D = null;
+ p.DP = null;
+ p.DQ = null;
+ p.P = null;
+ p.Q = null;
+ p.InverseQ = null;
+ }
+ p.Modulus = rsaModulus;
+ p.Exponent = rsaExponent;
+ return p;
+ }
+
+ // importing RSA keypair and exporting a RSA keypair
+ public void TestRSAImportPrivateExportPrivate()
+ {
+ RSAParameters input = GetKey (true);
+ rsa.ImportParameters (input);
+ string xmlRSA = rsa.ToXmlString (true);
+ rsa.FromXmlString (xmlRSA);
+ AssertEquals ("RSA Import Private Export Private (xml)", xmlPrivate, xmlRSA);
+ RSAParameters output = rsa.ExportParameters (true);
+ AssertEquals ("RSA Import Private Export Private (binary)", input, output, true);
+ }
+
+ // importing RSA keypair and exporting a RSA public key
+ public void TestRSAImportPrivateExportPublic()
+ {
+ RSAParameters input = GetKey (true);
+ rsa.ImportParameters (input);
+ string xmlRSA = rsa.ToXmlString (false);
+ rsa.FromXmlString (xmlRSA);
+ AssertEquals ("RSA Import Private Export Public (xml)", xmlPublic, xmlRSA);
+ RSAParameters output = rsa.ExportParameters (false);
+ AssertEquals ("RSA Import Private Export Public (binary)", input, output, false);
+ }
+
+ // importing RSA public key and exporting a RSA keypair (including private key!)
+ public void TestRSAImportPublicExportPrivate()
+ {
+ RSAParameters input = GetKey (false);
+ rsa.ImportParameters (input);
+ string xmlRSA = null;
+ try {
+ xmlRSA = rsa.ToXmlString (true);
+ Fail ("Expected ArgumentNullException but got no exception");
+ }
+ catch (ArgumentNullException) {
+ // expected as we cannot get a private key
+ // from a public key (at least not in our lifetime)
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ //rsa.FromXmlString (xmlRSA);
+ //RSAParameters output = rsa.ExportParameters (true);
+ //AssertEquals ("RSA Import Public Export Private", input, output, true);
+ }
+
+ // importing RSA public key and exporting a RSA public key
+ public void TestRSAImportPublicExportPublic()
+ {
+ RSAParameters input = GetKey (false);
+ rsa.ImportParameters (input);
+ string xmlRSA = rsa.ToXmlString (false);
+ rsa.FromXmlString (xmlRSA);
+ AssertEquals ("RSA Import Public Export Public (xml)", xmlPublic, xmlRSA);
+ RSAParameters output = rsa.ExportParameters (false);
+ AssertEquals ("RSA Import Public Export Public (binary)", input, output, true);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RandomNumberGeneratorTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RandomNumberGeneratorTest.cs
new file mode 100644
index 00000000000..887814f24ca
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RandomNumberGeneratorTest.cs
@@ -0,0 +1,171 @@
+//
+// RandomNumberGeneratorTest.cs - NUnit Test Cases for RNG
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. NIST FIPS PUB 140-2: Security requirements for Cryptographic Modules
+// http://csrc.nist.gov/publications/fips/fips140-2/fips1402.pdf
+// b. NIST SP 800-22: A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications
+// not implemented
+// http://csrc.nist.gov/publications/nistpubs/800-22/sp-800-22-051501.pdf
+// c. IETF RFC1750: Randomness Recommendations for Security
+// not implemented
+// http://www.ietf.org/rfc/rfc1750.txt
+
+public class RandomNumberGeneratorTest : TestCase {
+ protected RandomNumberGenerator rng;
+
+ protected override void SetUp ()
+ {
+ rng = RandomNumberGenerator.Create();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // count the number of 1
+ protected void Monobit (string rngName, byte[] sample)
+ {
+ int x = 0;
+ for (int i=0; i < sample.Length; i++) {
+ byte b = sample[i];
+ for (int j = 0; j < 8; j++) {
+ if ((b & 0x01) == 0x01)
+ x++;
+ // next bit
+ b >>= 1;
+ }
+ }
+ Assert (rngName + " Monobit x=" + x, ((9725 < x) && (x < 10275)));
+ }
+
+ // 16 patterns (nibbles)
+ protected void Poker (string rngName, byte[] sample)
+ {
+ int[] pattern = new int[16];
+ for (int i = 0; i < sample.Length; i++) {
+ byte b = sample[i];
+ int n = (b & 0x0F);
+ pattern[n]++;
+ b >>= 4;
+ n = b;
+ pattern[n]++;
+ }
+ double result = 0;
+ for (int i = 0; i < 16; i++)
+ result += (pattern[i] * pattern[i]);
+ result = ((16 * result) / 5000) - 5000;
+ Assert (rngName + " Poker: " + result, ((result > 2.16) && (result < 46.17)));
+ }
+
+ // runs of 1 (or 0)
+ protected void Runs (string rngName, byte[] sample)
+ {
+ int[] runs = new int[6];
+ int x = 0;
+ bool one = false;
+ bool zero = false;
+ for (int i = sample.Length - 1; i >= 0 ; i--) {
+ byte b = sample[i];
+ for (int j = 0; j < 8; j++) {
+ if ((b & 0x01) == 0x01) {
+ if (!one) {
+ one = true;
+ zero = false;
+ int p = Math.Min (x, 6) - 1;
+ if (p >= 0)
+ runs[p]++;
+ x = 0;
+ }
+ }
+ else {
+ if (!zero) {
+ one = false;
+ zero = true;
+ /*int p = Math.Min (x, 6) - 1;
+ if (p >= 0)
+ runs[p]++;*/
+ x = 0;
+ }
+ }
+ x++;
+ // next bit
+ b >>= 1;
+ }
+ }
+ Assert (rngName + " Runs length=1: " + runs[0], ((runs[0] >= 2343) && (runs[0] <= 2657)));
+ Assert (rngName + " Runs length=2: " + runs[1], ((runs[1] >= 1135) && (runs[1] <= 1365)));
+ Assert (rngName + " Runs length=3: " + runs[2], ((runs[2] >= 542) && (runs[2] <= 708)));
+ Assert (rngName + " Runs length=4: " + runs[3], ((runs[3] >= 251) && (runs[3] <= 373)));
+ Assert (rngName + " Runs length=5: " + runs[4], ((runs[4] >= 111) && (runs[4] <= 201)));
+ Assert (rngName + " Runs length=6+ " + runs[5], ((runs[5] >= 111) && (runs[5] <= 201)));
+ }
+
+ // no long runs of 26 or more (0 or 1)
+ protected void LongRuns (string rngName, byte[] sample)
+ {
+ int longestRun = 0;
+ int currentRun = 0;
+ bool one = false;
+ bool zero = false;
+ for (int i = sample.Length - 1; i >= 0 ; i--) {
+ byte b = sample[i];
+ for (int j = 0; j < 8; j++) {
+ if ((b & 0x01) == 0x01) {
+ if (!one) {
+ one = true;
+ zero = false;
+ longestRun = Math.Max (longestRun, currentRun);
+ currentRun = 0;
+ }
+ currentRun++;
+ }
+ else {
+ if (!zero) {
+ one = false;
+ zero = true;
+ longestRun = Math.Max (longestRun, currentRun);
+ currentRun = 0;
+ }
+ currentRun++;
+ }
+ // next bit
+ b >>= 1;
+ }
+ }
+ Assert (rngName + " Long Runs max = " + longestRun, (longestRun < 26));
+ }
+
+ // all tests should be done on the same random sample
+ public void TestFIPS140()
+ {
+ string name = rng.ToString();
+ // 20,000 bits
+ byte[] sample = new byte[2500];
+ rng.GetBytes (sample);
+
+ Monobit (name, sample);
+ Poker (name, sample);
+ Runs (name, sample);
+ LongRuns (name, sample);
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RijndaelManagedTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RijndaelManagedTest.cs
new file mode 100644
index 00000000000..3fbf2298f80
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RijndaelManagedTest.cs
@@ -0,0 +1,175 @@
+//
+// TestSuite.System.Security.Cryptography.RijndaelManaged.cs
+//
+// Author:
+// Andrew Birkett (andy@nobugs.org)
+//
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class RijndaelManagedTest : TestCase {
+ public void CheckCBC(ICryptoTransform encryptor, ICryptoTransform decryptor,
+ byte[] plaintext, byte[] expected)
+ {
+
+ if ((plaintext.Length % encryptor.InputBlockSize) != 0) {
+ throw new ArgumentException("Must have complete blocks");
+ }
+
+ byte[] ciphertext = new byte[plaintext.Length];
+ for (int i=0; i < plaintext.Length; i += encryptor.InputBlockSize) {
+ encryptor.TransformBlock(plaintext, i, encryptor.InputBlockSize, ciphertext, i);
+ }
+
+ for (int i=0; i<32; i++) {
+ AssertEquals("CBC-" + i, expected[i], ciphertext[i]);
+ }
+
+ byte[] roundtrip = new byte[plaintext.Length];
+ for (int i=0; i < ciphertext.Length; i += decryptor.InputBlockSize) {
+ decryptor.TransformBlock(ciphertext, i, decryptor.InputBlockSize, roundtrip, i);
+ }
+
+ for (int i=0; i<32; i++) {
+ AssertEquals("CBC-rt-" + i, roundtrip[i], plaintext[i]);
+ }
+
+ }
+
+ public void TestCBC_0() {
+
+ byte[] plaintext = new byte[32];
+ for (int i=0; i < plaintext.Length; i++) plaintext[i] = 0;
+
+ byte[] iv = new byte[16];
+ for (byte i=0; i < iv.Length; i++) {
+ iv[i] = 0;
+ }
+
+ RijndaelManaged r = new RijndaelManaged();
+ byte[] key = new byte[16];
+
+ for (int i=0; i < 16; i++) r.Key[i] = 0;
+ r.BlockSize = 128;
+ r.Mode = CipherMode.CBC;
+ r.Padding = PaddingMode.Zeros;
+ r.Key = key;
+
+ byte[] expected = {
+ 0x66, 0xe9, 0x4b, 0xd4, 0xef, 0x8a, 0x2c, 0x3b,
+ 0x88, 0x4c, 0xfa, 0x59, 0xca, 0x34, 0x2b, 0x2e,
+ 0xf7, 0x95, 0xbd, 0x4a, 0x52, 0xe2, 0x9e, 0xd7,
+ 0x13, 0xd3, 0x13, 0xfa, 0x20, 0xe9, 0x8d, 0xbc };
+
+ CheckCBC(r.CreateEncryptor(key, iv), r.CreateDecryptor(key, iv), plaintext, expected);
+ }
+
+ public void TestCBC_1() {
+
+ byte[] plaintext = new byte[32];
+ for (int i=0; i < plaintext.Length; i++) plaintext[i] = 0;
+
+ byte[] iv = new byte[16];
+ for (byte i=0; i < iv.Length; i++) {
+ iv[i] = i;
+ }
+
+ RijndaelManaged r = new RijndaelManaged();
+ byte[] key = new byte[16];
+ for (byte i=0; i < 16; i++) key[i] = 0;
+
+ r.Key = key;
+ r.BlockSize = 128;
+ r.Mode = CipherMode.CBC;
+ r.Padding = PaddingMode.Zeros;
+
+ byte[] expected = {
+ 0x7a, 0xca, 0x0f, 0xd9, 0xbc, 0xd6, 0xec, 0x7c,
+ 0x9f, 0x97, 0x46, 0x66, 0x16, 0xe6, 0xa2, 0x82,
+ 0x66, 0xc5, 0x84, 0x17, 0x1d, 0x3c, 0x20, 0x53,
+ 0x6f, 0x0a, 0x09, 0xdc, 0x4d, 0x1e, 0x45, 0x3b };
+
+ CheckCBC(r.CreateEncryptor(key, iv), r.CreateDecryptor(key, iv), plaintext, expected);
+ }
+
+ public void CheckECBRoundtrip(ICryptoTransform encryptor, ICryptoTransform decryptor,
+ byte[] plaintext, byte[] expected)
+ {
+ byte[] ciphertext = new byte[plaintext.Length];
+ int n = encryptor.TransformBlock(plaintext, 0, plaintext.Length, ciphertext, 0);
+
+ AssertEquals("ECB-len", n, expected.Length);
+ for (int i=0; i < ciphertext.Length; i++) {
+ AssertEquals("ECB-encrypt-" + i, ciphertext[i], expected[i]);
+ }
+
+ byte[] roundtrip = new byte[plaintext.Length];
+ n = decryptor.TransformBlock(ciphertext, 0, ciphertext.Length, roundtrip, 0);
+
+ AssertEquals("ECB-rt-len", n, plaintext.Length);
+ for (int i=0; i < roundtrip.Length; i++) {
+ AssertEquals("ECB-rt-" + i, roundtrip[i], plaintext[i]);
+ }
+ }
+
+ public void TestECB() {
+
+ byte[] plaintext = new byte[16];
+ byte[] iv = new byte[16];
+
+ for (int i=0; i < 16; i++) {
+ plaintext[i] = (byte) (i*16 + i);
+ }
+
+ RijndaelManaged r = new RijndaelManaged();
+ r.Mode = CipherMode.ECB;
+ r.Padding = PaddingMode.Zeros;
+
+ byte[] key16 = new byte[16];
+ byte[] key24 = new byte[24];
+ byte[] key32 = new byte[32];
+
+ for (int i=0; i < 32; i++) {
+ if (i < 16) key16[i] = (byte) i;
+ if (i < 24) key24[i] = (byte) i;
+ key32[i] = (byte) i;
+ }
+
+
+ byte[] exp16 = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
+ 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a };
+ byte[] exp24 = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
+ 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 };
+ byte[] exp32 = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
+ 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 };
+
+ r.Key = key16;
+ r.KeySize = 128;
+ CheckECBRoundtrip(
+ r.CreateEncryptor(key16, iv), r.CreateDecryptor(key16, iv),
+ plaintext, exp16
+ );
+
+
+ r.Key = key24;
+ r.KeySize = 192;
+ CheckECBRoundtrip(
+ r.CreateEncryptor(key24, iv), r.CreateDecryptor(key24, iv),
+ plaintext, exp24
+ );
+
+
+ r.Key = key32;
+ r.KeySize = 256;
+ CheckECBRoundtrip(
+ r.CreateEncryptor(key32, iv), r.CreateDecryptor(key32, iv),
+ plaintext, exp32
+ );
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RijndaelTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RijndaelTest.cs
new file mode 100644
index 00000000000..2a83ac2f75e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RijndaelTest.cs
@@ -0,0 +1,126 @@
+//
+// RijndaelTest.cs - NUnit Test Cases for Rijndael
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class RijndaelTest : TestCase {
+ protected Rijndael aes;
+
+ protected override void SetUp ()
+ {
+ aes = Rijndael.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // FIPS197 B
+ public void TestFIPS197_AppendixB ()
+ {
+ byte[] key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
+ byte[] iv = new byte[16]; // empty - not used for ECB
+ byte[] input = { 0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34 };
+ byte[] expected = { 0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32 };
+
+ aes.Mode = CipherMode.ECB;
+ aes.KeySize = 128;
+ aes.Padding = PaddingMode.Zeros;
+
+ byte[] output = new byte [input.Length];
+ ICryptoTransform encryptor = aes.CreateEncryptor (key, iv);
+ encryptor.TransformBlock (input, 0, input.Length, output, 0);
+ AssertEquals ("FIPS197 B Encrypt", expected, output);
+
+ byte[] original = new byte [output.Length];
+ ICryptoTransform decryptor = aes.CreateDecryptor(key, iv);
+ decryptor.TransformBlock (output, 0, output.Length, original, 0);
+ AssertEquals ("FIPS197 B Decrypt", input, original);
+ }
+
+ // FIPS197 C.1 AES-128 (Nk=4, Nr=10)
+ public void TestFIPS197_AppendixC1 ()
+ {
+ byte[] key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
+ byte[] iv = new byte[16]; // empty - not used for ECB
+ byte[] input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
+ byte[] expected = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a };
+
+ aes.Mode = CipherMode.ECB;
+ aes.KeySize = 128;
+ aes.Padding = PaddingMode.Zeros;
+
+ byte[] output = new byte [input.Length];
+ ICryptoTransform encryptor = aes.CreateEncryptor (key, iv);
+ encryptor.TransformBlock(input, 0, input.Length, output, 0);
+ AssertEquals ("FIPS197 C1 Encrypt", expected, output);
+
+ byte[] original = new byte [output.Length];
+ ICryptoTransform decryptor = aes.CreateDecryptor(key, iv);
+ decryptor.TransformBlock(output, 0, output.Length, original, 0);
+ AssertEquals ("FIPS197 C1 Decrypt", input, original);
+ }
+
+ // FIPS197 C.2 AES-192 (Nk=6, Nr=12)
+ public void TestFIPS197_AppendixC2 ()
+ {
+ byte[] key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 };
+ byte[] iv = new byte[16]; // empty - not used for ECB
+ byte[] input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
+ byte[] expected = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 };
+
+ aes.Mode = CipherMode.ECB;
+ aes.KeySize = 192;
+ aes.Padding = PaddingMode.Zeros;
+
+ byte[] output = new byte [input.Length];
+ ICryptoTransform encryptor = aes.CreateEncryptor (key, iv);
+ encryptor.TransformBlock(input, 0, input.Length, output, 0);
+ AssertEquals ("FIPS197 C2 Encrypt", expected, output);
+
+ byte[] original = new byte [output.Length];
+ ICryptoTransform decryptor = aes.CreateDecryptor(key, iv);
+ decryptor.TransformBlock(output, 0, output.Length, original, 0);
+ AssertEquals ("FIPS197 C2 Decrypt", input, original);
+ }
+
+ // C.3 AES-256 (Nk=8, Nr=14)
+ public void TestFIPS197_AppendixC3 ()
+ {
+ byte[] key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
+ byte[] iv = new byte[16]; // empty - not used for ECB
+ byte[] input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
+ byte[] expected = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 };
+
+ aes.Mode = CipherMode.ECB;
+ aes.KeySize = 256;
+ aes.Padding = PaddingMode.Zeros;
+
+ byte[] output = new byte [input.Length];
+ ICryptoTransform encryptor = aes.CreateEncryptor (key, iv);
+ encryptor.TransformBlock(input, 0, input.Length, output, 0);
+ AssertEquals ("FIPS197 C3 Encrypt", expected, output);
+
+ byte[] original = new byte [output.Length];
+ ICryptoTransform decryptor = aes.CreateDecryptor(key, iv);
+ decryptor.TransformBlock(output, 0, output.Length, original, 0);
+ AssertEquals ("FIPS197 C3 Decrypt", input, original);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs
new file mode 100644
index 00000000000..a718c793291
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs
@@ -0,0 +1,82 @@
+//
+// SHA1CryptoServiceProviderTest.cs - NUnit Test Cases for SHA1CryptoServiceProvider
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-1: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.txt
+
+// we inherit from SHA1Test because all SHA1 implementation must return the
+// same results (hence should run a common set of unit tests).
+public class SHA1CryptoServiceProviderTest : SHA1Test {
+ protected override void SetUp ()
+ {
+ hash = new SHA1CryptoServiceProvider ();
+ }
+
+ protected override void TearDown () {}
+
+ public override void TestCreate ()
+ {
+ // no need to repeat this test
+ }
+
+ // none of those values changes for a particuliar implementation of SHA1
+ public override void TestStaticInfo ()
+ {
+ // test all values static for SHA1
+ base.TestStaticInfo();
+ string className = hash.ToString ();
+ AssertEquals (className + ".CanReuseTransform", true, hash.CanReuseTransform);
+ AssertEquals (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
+ AssertEquals (className + ".ToString()", "System.Security.Cryptography.SHA1CryptoServiceProvider", className);
+ }
+
+ public void TestSHA1CSPforFIPSCompliance ()
+ {
+ SHA1 sha = (SHA1)hash;
+ // First test, we hash the string "abc"
+ FIPS186_Test1 (sha);
+ // Second test, we hash the string "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
+ FIPS186_Test2 (sha);
+ // Third test, we hash 1,000,000 times the character "a"
+ FIPS186_Test3 (sha);
+ }
+
+ // LAMESPEC / MSBUG: Under Windows an Initialize is required after
+ // TransformFinalBlock/Hash or SHA1CryptoServiceProvider will still return
+ // the previous Hash. SHA1Managed behavior's is different as it will return
+ // a bad Hash if Initialize isn't called.
+ // FIXME: Do we want to duplicate this bad behaviour ?
+/* public void TestInitialize ()
+ {
+ byte[] expectedDEF = { 0x58, 0x9c, 0x22, 0x33, 0x5a, 0x38, 0x1f, 0x12, 0x2d, 0x12, 0x92, 0x25, 0xf5, 0xc0, 0xba, 0x30, 0x56, 0xed, 0x58, 0x11 };
+ string className = hash.ToString ();
+ // hash abc
+ byte[] inputABC = Encoding.Default.GetBytes ("abc");
+ hash.TransformFinalBlock (inputABC, 0, inputABC.Length);
+ byte[] resultABC = hash.Hash;
+ // hash def
+ byte[] inputDEF = Encoding.Default.GetBytes ("def");
+ byte[] resultDEF = hash.ComputeHash (inputDEF);
+ // result(abc) == result(def) -> forgot to initialize
+ AssertEquals (className + ".Initialize ABC=DEF", resultABC, resultDEF);
+ hash.Initialize ();
+ resultDEF = hash.ComputeHash (inputDEF);
+ AssertEquals (className + ".Initialize DEF ok", expectedDEF, resultDEF);
+ }*/
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA1Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA1Test.cs
new file mode 100644
index 00000000000..4d31cbc5e13
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA1Test.cs
@@ -0,0 +1,201 @@
+//
+// SHA1Test.cs - NUnit Test Cases for SHA1
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+// References:
+// a. FIPS PUB 180-1: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.txt
+
+// SHA1 is a abstract class - so most of the test included here wont be tested
+// on the abstract class but should be tested in ALL its descendants.
+public class SHA1Test : HashAlgorithmTest
+{
+ protected override void SetUp ()
+ {
+ hash = SHA1.Create();
+ }
+
+ protected override void TearDown () {}
+
+ public new void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ // test vectors from NIST FIPS 186-2
+
+ private string input1 = "abc";
+ private string input2 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
+
+ public void FIPS186_Test1 (SHA1 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d };
+ byte[] input = Encoding.Default.GetBytes (input1);
+
+ string testName = className + " 1";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test2 (SHA1 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae, 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 };
+ byte[] input = Encoding.Default.GetBytes (input2);
+
+ string testName = className + " 2";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test3 (SHA1 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4, 0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad, 0x27, 0x31, 0x65, 0x34, 0x01, 0x6f };
+ byte[] input = new byte [1000000];
+ for (int i = 0; i < 1000000; i++)
+ input[i] = 0x61; // a
+
+ string testName = className + " 3";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_a (string testName, SHA1 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input);
+ AssertEquals (testName + ".a.1", result, output);
+ AssertEquals (testName + ".a.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_b (string testName, SHA1 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input, 0, input.Length);
+ AssertEquals (testName + ".b.1", result, output);
+ AssertEquals (testName + ".b.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_c (string testName, SHA1 hash, byte[] input, byte[] result)
+ {
+ MemoryStream ms = new MemoryStream (input);
+ byte[] output = hash.ComputeHash (ms);
+ AssertEquals (testName + ".c.1", result, output);
+ AssertEquals (testName + ".c.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_d (string testName, SHA1 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.TransformFinalBlock (input, 0, input.Length);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals( testName + ".d.1", result, output );
+ AssertEquals (testName + ".d", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_e (string testName, SHA1 hash, byte[] input, byte[] result)
+ {
+ byte[] copy = new byte [input.Length];
+ for (int i=0; i < input.Length - 1; i++)
+ hash.TransformBlock (input, i, 1, copy, i);
+ byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals (testName + ".e.1", result, output);
+ AssertEquals (testName + ".e", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public override void TestCreate ()
+ {
+ // Note: These tests will only be valid without a "machine.config" file
+ // or a "machine.config" file that do not modify the default algorithm
+ // configuration.
+ const string defaultSHA1 = "System.Security.Cryptography.SHA1CryptoServiceProvider";
+
+ // try to build the default implementation
+ SHA1 hash = SHA1.Create ();
+ AssertEquals ("SHA1.Create()", hash.ToString (), defaultSHA1);
+
+ // try to build, in every way, a SHA1 implementation
+ // note that it's not possible to create an instance of SHA1Managed using the Create methods
+ hash = SHA1.Create ("SHA");
+ AssertEquals ("SHA1.Create('SHA')", hash.ToString (), defaultSHA1);
+ hash = SHA1.Create ("SHA1");
+ AssertEquals ("SHA1.Create('SHA1')", hash.ToString (), defaultSHA1);
+ hash = SHA1.Create ("System.Security.Cryptography.SHA1");
+ AssertEquals ("SHA1.Create('System.Security.Cryptography.SHA1')", hash.ToString (), defaultSHA1);
+ hash = SHA1.Create ("System.Security.Cryptography.HashAlgorithm" );
+ AssertEquals ("SHA1.Create('System.Security.Cryptography.HashAlgorithm')", hash.ToString (), defaultSHA1);
+
+ // try to build an incorrect hash algorithms
+ try {
+ hash = SHA1.Create ("MD5");
+ Fail ("SHA1.Create('MD5') should throw InvalidCastException");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA1.Create(null) should throw InvalidCastException not " + e.ToString ());
+ }
+
+ // try to build invalid implementation
+ hash = SHA1.Create ("InvalidHash");
+ AssertNull ("SHA1.Create('InvalidHash')", hash);
+
+ // try to build null implementation
+ try {
+ hash = SHA1.Create (null);
+ Fail ("SHA1.Create(null) should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA1.Create(null) should throw ArgumentNullException not " + e.ToString ());
+ }
+ }
+
+ // none of those values changes for any implementation of SHA1
+ public virtual void TestStaticInfo ()
+ {
+ string className = hash.ToString ();
+ AssertEquals (className + ".HashSize", 160, hash.HashSize);
+ AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
+ AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA256ManagedTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA256ManagedTest.cs
new file mode 100644
index 00000000000..9b8a5b93004
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA256ManagedTest.cs
@@ -0,0 +1,59 @@
+//
+// SHA256ManagedTest.cs - NUnit Test Cases for SHA256Managed
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-2: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
+
+// we inherit from SHA256Test because all SHA256 implementation must return the
+// same results (hence should run a common set of unit tests).
+public class SHA256ManagedTest : SHA256Test {
+ protected override void SetUp ()
+ {
+ hash = new SHA256Managed ();
+ }
+
+ protected override void TearDown () {}
+
+ public override void TestCreate ()
+ {
+ // no need to repeat this test
+ }
+
+ // none of those values changes for a particuliar implementation of SHA256
+ public override void TestStaticInfo ()
+ {
+ // test all values static for SHA256
+ base.TestStaticInfo ();
+ string className = hash.ToString ();
+ AssertEquals (className + ".CanReuseTransform", true, hash.CanReuseTransform);
+ AssertEquals (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
+ AssertEquals (className + ".ToString()", "System.Security.Cryptography.SHA256Managed", className);
+ }
+
+ public void TestSHA256forFIPSCompliance ()
+ {
+ SHA256 sha = (SHA256) hash;
+ // First test, we hash the string "abc"
+ FIPS186_Test1 (sha);
+ // Second test, we hash the string "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
+ FIPS186_Test2 (sha);
+ // Third test, we hash 1,000,000 times the character "a"
+ FIPS186_Test3 (sha);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA256Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA256Test.cs
new file mode 100644
index 00000000000..c35021627ab
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA256Test.cs
@@ -0,0 +1,198 @@
+//
+// SHA256Test.cs - NUnit Test Cases for SHA256
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-2: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-2/fip180-2.txt
+
+// SHA256 is a abstract class - so most of the test included here wont be tested
+// on the abstract class but should be tested in ALL its descendants.
+public class SHA256Test : HashAlgorithmTest {
+
+ protected override void SetUp ()
+ {
+ hash = SHA256.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ // test vectors from NIST FIPS 186-2
+
+ private string input1 = "abc";
+ private string input2 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
+
+ public void FIPS186_Test1 (SHA256 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
+ 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
+ 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
+ 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad };
+ byte[] input = Encoding.Default.GetBytes (input1);
+
+ string testName = className + " 1";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test2 (SHA256 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
+ 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
+ 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
+ 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 };
+ byte[] input = Encoding.Default.GetBytes (input2);
+
+ string testName = className + " 2";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test3 (SHA256 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0xcd, 0xc7, 0x6e, 0x5c, 0x99, 0x14, 0xfb, 0x92,
+ 0x81, 0xa1, 0xc7, 0xe2, 0x84, 0xd7, 0x3e, 0x67,
+ 0xf1, 0x80, 0x9a, 0x48, 0xa4, 0x97, 0x20, 0x0e,
+ 0x04, 0x6d, 0x39, 0xcc, 0xc7, 0x11, 0x2c, 0xd0 };
+ byte[] input = new byte [1000000];
+ for (int i = 0; i < 1000000; i++)
+ input[i] = 0x61; // a
+
+ string testName = className + " 3";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_a (string testName, SHA256 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input);
+ AssertEquals (testName + ".a.1", result, output);
+ AssertEquals (testName + ".a.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_b (string testName, SHA256 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input, 0, input.Length);
+ AssertEquals (testName + ".b.1", result, output);
+ AssertEquals (testName + ".b.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_c (string testName, SHA256 hash, byte[] input, byte[] result)
+ {
+ MemoryStream ms = new MemoryStream (input);
+ byte[] output = hash.ComputeHash (ms);
+ AssertEquals (testName + ".c.1", result, output);
+ AssertEquals (testName + ".c.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_d (string testName, SHA256 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.TransformFinalBlock (input, 0, input.Length);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals( testName + ".d.1", result, output );
+ AssertEquals (testName + ".d", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_e (string testName, SHA256 hash, byte[] input, byte[] result)
+ {
+ byte[] copy = new byte [input.Length];
+ for (int i=0; i < input.Length - 1; i++)
+ hash.TransformBlock (input, i, 1, copy, i);
+ byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals (testName + ".e.1", result, output);
+ AssertEquals (testName + ".e", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public override void TestCreate ()
+ {
+ // Note: These tests will only be valid without a "machine.config" file
+ // or a "machine.config" file that do not modify the default algorithm
+ // configuration.
+ const string defaultSHA256 = "System.Security.Cryptography.SHA256Managed";
+
+ // try to build the default implementation
+ SHA256 hash = SHA256.Create ();
+ AssertEquals ("SHA256.Create()", hash.ToString (), defaultSHA256);
+
+ // try to build, in every way, a SHA256 implementation
+ hash = SHA256.Create ("SHA256");
+ AssertEquals ("SHA256.Create('SHA256')", hash.ToString (), defaultSHA256);
+ hash = SHA256.Create ("SHA-256");
+ AssertEquals ("SHA256.Create('SHA-256')", hash.ToString (), defaultSHA256);
+
+ // try to build an incorrect hash algorithms
+ try {
+ hash = SHA256.Create ("MD5");
+ Fail ("SHA256.Create('MD5') should throw InvalidCastException");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA256.Create('MD5') should throw InvalidCastException not " + e.ToString ());
+ }
+
+ // try to build invalid implementation
+ hash = SHA256.Create ("InvalidHash");
+ AssertNull ("SHA256.Create('InvalidHash')", hash);
+
+ // try to build null implementation
+ try {
+ hash = SHA256.Create (null);
+ Fail ("SHA256.Create(null) should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA256.Create(null) should throw ArgumentNullException not " + e.ToString ());
+ }
+ }
+
+ // none of those values changes for any implementation of defaultSHA256
+ public virtual void TestStaticInfo () {
+ string className = hash.ToString ();
+ AssertEquals (className + ".HashSize", 256, hash.HashSize);
+ AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
+ AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA384ManagedTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA384ManagedTest.cs
new file mode 100644
index 00000000000..c142494ad0d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA384ManagedTest.cs
@@ -0,0 +1,60 @@
+//
+// SHA384ManagedTest.cs - NUnit Test Cases for SHA384Managed
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-2: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
+
+// we inherit from SHA384Test because all SHA384 implementation must return the
+// same results (hence should run a common set of unit tests).
+public class SHA384ManagedTest : SHA384Test {
+
+ protected override void SetUp ()
+ {
+ hash = new SHA384Managed ();
+ }
+
+ protected override void TearDown () {}
+
+ public override void TestCreate ()
+ {
+ // no need to repeat this test
+ }
+
+ // none of those values changes for a particuliar implementation of SHA384
+ public override void TestStaticInfo ()
+ {
+ // test all values static for SHA384
+ base.TestStaticInfo ();
+ string className = hash.ToString ();
+ AssertEquals (className + ".CanReuseTransform", true, hash.CanReuseTransform);
+ AssertEquals (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
+ AssertEquals (className + ".ToString()", "System.Security.Cryptography.SHA384Managed", className);
+ }
+
+ public void TestSHA384forFIPSCompliance ()
+ {
+ SHA384 sha = (SHA384) hash;
+ // First test, we hash the string "abc"
+ FIPS186_Test1 (sha);
+ // Second test, we hash the string "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
+ FIPS186_Test2 (sha);
+ // Third test, we hash 1,000,000 times the character "a"
+ FIPS186_Test3 (sha);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA384Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA384Test.cs
new file mode 100644
index 00000000000..29fbf096ea1
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA384Test.cs
@@ -0,0 +1,204 @@
+//
+// SHA384Test.cs - NUnit Test Cases for SHA384
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-2: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-2/fip180-2.txt
+
+// SHA384 is a abstract class - so most of the test included here wont be tested
+// on the abstract class but should be tested in ALL its descendants.
+public class SHA384Test : HashAlgorithmTest {
+ protected override void SetUp ()
+ {
+ hash = SHA384.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ // test vectors from NIST FIPS 186-2
+
+ private string input1 = "abc";
+ private string input2 = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
+
+ public void FIPS186_Test1 (SHA384 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
+ 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
+ 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
+ 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
+ 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
+ 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 };
+ byte[] input = Encoding.Default.GetBytes (input1);
+
+ string testName = className + " 1";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test2 (SHA384 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
+ 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
+ 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
+ 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
+ 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
+ 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 };
+ byte[] input = Encoding.Default.GetBytes (input2);
+
+ string testName = className + " 2";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test3 (SHA384 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0x9d, 0x0e, 0x18, 0x09, 0x71, 0x64, 0x74, 0xcb,
+ 0x08, 0x6e, 0x83, 0x4e, 0x31, 0x0a, 0x4a, 0x1c,
+ 0xed, 0x14, 0x9e, 0x9c, 0x00, 0xf2, 0x48, 0x52,
+ 0x79, 0x72, 0xce, 0xc5, 0x70, 0x4c, 0x2a, 0x5b,
+ 0x07, 0xb8, 0xb3, 0xdc, 0x38, 0xec, 0xc4, 0xeb,
+ 0xae, 0x97, 0xdd, 0xd8, 0x7f, 0x3d, 0x89, 0x85 };
+ byte[] input = new byte [1000000];
+ for (int i = 0; i < 1000000; i++)
+ input[i] = 0x61; // a
+
+ string testName = className + " 3";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_a (string testName, SHA384 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input);
+ AssertEquals (testName + ".a.1", result, output);
+ AssertEquals (testName + ".a.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_b (string testName, SHA384 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input, 0, input.Length);
+ AssertEquals (testName + ".b.1", result, output);
+ AssertEquals (testName + ".b.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_c (string testName, SHA384 hash, byte[] input, byte[] result)
+ {
+ MemoryStream ms = new MemoryStream (input);
+ byte[] output = hash.ComputeHash (ms);
+ AssertEquals (testName + ".c.1", result, output);
+ AssertEquals (testName + ".c.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_d (string testName, SHA384 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.TransformFinalBlock (input, 0, input.Length);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals( testName + ".d.1", result, output );
+ AssertEquals (testName + ".d", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_e (string testName, SHA384 hash, byte[] input, byte[] result)
+ {
+ byte[] copy = new byte [input.Length];
+ for (int i=0; i < input.Length - 1; i++)
+ hash.TransformBlock (input, i, 1, copy, i);
+ byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals (testName + ".e.1", result, output);
+ AssertEquals (testName + ".e", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public override void TestCreate ()
+ {
+ // Note: These tests will only be valid without a "machine.config" file
+ // or a "machine.config" file that do not modify the default algorithm
+ // configuration.
+ const string defaultSHA384 = "System.Security.Cryptography.SHA384Managed";
+
+ // try to build the default implementation
+ SHA384 hash = SHA384.Create ();
+ AssertEquals ("SHA384.Create()", hash.ToString (), defaultSHA384);
+
+ // try to build, in every way, a SHA384 implementation
+ hash = SHA384.Create ("SHA384");
+ AssertEquals ("SHA384.Create('SHA384')", hash.ToString (), defaultSHA384);
+ hash = SHA384.Create ("SHA-384");
+ AssertEquals ("SHA384.Create('SHA-384')", hash.ToString (), defaultSHA384);
+
+ // try to build an incorrect hash algorithms
+ try {
+ hash = SHA384.Create ("MD5");
+ Fail ("SHA384.Create('MD5') should throw InvalidCastException");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA384.Create('MD5') should throw InvalidCastException not " + e.ToString ());
+ }
+
+ // try to build invalid implementation
+ hash = SHA384.Create ("InvalidHash");
+ AssertNull ("SHA384.Create('InvalidHash')", hash);
+
+ // try to build null implementation
+ try {
+ hash = SHA384.Create (null);
+ Fail ("SHA384.Create(null) should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA384.Create(null) should throw ArgumentNullException not " + e.ToString ());
+ }
+ }
+
+ // none of those values changes for any implementation of defaultSHA384
+ public virtual void TestStaticInfo ()
+ {
+ string className = hash.ToString ();
+ AssertEquals (className + ".HashSize", 384, hash.HashSize);
+ AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
+ AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA512ManagedTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA512ManagedTest.cs
new file mode 100644
index 00000000000..1e2d110a1a5
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA512ManagedTest.cs
@@ -0,0 +1,59 @@
+//
+// SHA512ManagedTest.cs - NUnit Test Cases for SHA512Managed
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-2: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
+
+// we inherit from SHA512Test because all SHA512 implementation must return the
+// same results (hence should run a common set of unit tests).
+public class SHA512ManagedTest : SHA512Test {
+ protected override void SetUp ()
+ {
+ hash = new SHA512Managed ();
+ }
+
+ protected override void TearDown () {}
+
+ public override void TestCreate ()
+ {
+ // no need to repeat this test
+ }
+
+ // none of those values changes for a particuliar implementation of SHA512
+ public override void TestStaticInfo ()
+ {
+ // test all values static for SHA512
+ base.TestStaticInfo ();
+ string className = hash.ToString ();
+ AssertEquals (className + ".CanReuseTransform", true, hash.CanReuseTransform);
+ AssertEquals (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
+ AssertEquals (className + ".ToString()", "System.Security.Cryptography.SHA512Managed", className);
+ }
+
+ public void TestSHA512forFIPSCompliance ()
+ {
+ SHA512 sha = (SHA512) hash;
+ // First test, we hash the string "abc"
+ FIPS186_Test1 (sha);
+ // Second test, we hash the string "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
+ FIPS186_Test2 (sha);
+ // Third test, we hash 1,000,000 times the character "a"
+ FIPS186_Test3 (sha);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SHA512Test.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SHA512Test.cs
new file mode 100644
index 00000000000..5538b722baf
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SHA512Test.cs
@@ -0,0 +1,210 @@
+//
+// SHA512Test.cs - NUnit Test Cases for SHA512
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+// References:
+// a. FIPS PUB 180-2: Secure Hash Standard
+// http://csrc.nist.gov/publications/fips/fips180-2/fip180-2.txt
+
+// SHA512 is a abstract class - so most of the test included here wont be tested
+// on the abstract class but should be tested in ALL its descendants.
+public class SHA512Test : HashAlgorithmTest {
+ protected override void SetUp ()
+ {
+ hash = SHA512.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ // test vectors from NIST FIPS 186-2
+
+ private string input1 = "abc";
+ private string input2 = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
+
+ public void FIPS186_Test1 (SHA512 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
+ 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
+ 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
+ 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
+ 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
+ 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
+ 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
+ 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f };
+ byte[] input = Encoding.Default.GetBytes (input1);
+
+ string testName = className + " 1";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test2 (SHA512 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
+ 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
+ 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
+ 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
+ 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
+ 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
+ 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
+ 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 };
+ byte[] input = Encoding.Default.GetBytes (input2);
+
+ string testName = className + " 2";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_Test3 (SHA512 hash)
+ {
+ string className = hash.ToString ();
+ byte[] result = { 0xe7, 0x18, 0x48, 0x3d, 0x0c, 0xe7, 0x69, 0x64,
+ 0x4e, 0x2e, 0x42, 0xc7, 0xbc, 0x15, 0xb4, 0x63,
+ 0x8e, 0x1f, 0x98, 0xb1, 0x3b, 0x20, 0x44, 0x28,
+ 0x56, 0x32, 0xa8, 0x03, 0xaf, 0xa9, 0x73, 0xeb,
+ 0xde, 0x0f, 0xf2, 0x44, 0x87, 0x7e, 0xa6, 0x0a,
+ 0x4c, 0xb0, 0x43, 0x2c, 0xe5, 0x77, 0xc3, 0x1b,
+ 0xeb, 0x00, 0x9c, 0x5c, 0x2c, 0x49, 0xaa, 0x2e,
+ 0x4e, 0xad, 0xb2, 0x17, 0xad, 0x8c, 0xc0, 0x9b };
+ byte[] input = new byte [1000000];
+ for (int i = 0; i < 1000000; i++)
+ input[i] = 0x61; // a
+
+ string testName = className + " 3";
+ FIPS186_a (testName, hash, input, result);
+ FIPS186_b (testName, hash, input, result);
+ FIPS186_c (testName, hash, input, result);
+ FIPS186_d (testName, hash, input, result);
+ FIPS186_e (testName, hash, input, result);
+ }
+
+ public void FIPS186_a (string testName, SHA512 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input);
+ AssertEquals (testName + ".a.1", result, output);
+ AssertEquals (testName + ".a.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_b (string testName, SHA512 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.ComputeHash (input, 0, input.Length);
+ AssertEquals (testName + ".b.1", result, output);
+ AssertEquals (testName + ".b.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_c (string testName, SHA512 hash, byte[] input, byte[] result)
+ {
+ MemoryStream ms = new MemoryStream (input);
+ byte[] output = hash.ComputeHash (ms);
+ AssertEquals (testName + ".c.1", result, output);
+ AssertEquals (testName + ".c.2", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_d (string testName, SHA512 hash, byte[] input, byte[] result)
+ {
+ byte[] output = hash.TransformFinalBlock (input, 0, input.Length);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals( testName + ".d.1", result, output );
+ AssertEquals (testName + ".d", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public void FIPS186_e (string testName, SHA512 hash, byte[] input, byte[] result)
+ {
+ byte[] copy = new byte [input.Length];
+ for (int i=0; i < input.Length - 1; i++)
+ hash.TransformBlock (input, i, 1, copy, i);
+ byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
+ // LAMESPEC or FIXME: TransformFinalBlock doesn't return HashValue !
+ // AssertEquals (testName + ".e.1", result, output);
+ AssertEquals (testName + ".e", result, hash.Hash);
+ // required or next operation will still return old hash
+ hash.Initialize ();
+ }
+
+ public override void TestCreate ()
+ {
+ // Note: These tests will only be valid without a "machine.config" file
+ // or a "machine.config" file that do not modify the default algorithm
+ // configuration.
+ const string defaultSHA512 = "System.Security.Cryptography.SHA512Managed";
+
+ // try to build the default implementation
+ SHA512 hash = SHA512.Create ();
+ AssertEquals ("SHA512.Create()", hash.ToString (), defaultSHA512);
+
+ // try to build, in every way, a SHA512 implementation
+ hash = SHA512.Create ("SHA512");
+ AssertEquals ("SHA512.Create('SHA512')", hash.ToString (), defaultSHA512);
+ hash = SHA512.Create ("SHA-512");
+ AssertEquals ("SHA512.Create('SHA-512')", hash.ToString (), defaultSHA512);
+
+ // try to build an incorrect hash algorithms
+ try {
+ hash = SHA512.Create ("MD5");
+ Fail ("SHA512.Create('MD5') should throw InvalidCastException");
+ }
+ catch (InvalidCastException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA512.Create('MD5') should throw InvalidCastException not " + e.ToString ());
+ }
+
+ // try to build invalid implementation
+ hash = SHA512.Create ("InvalidHash");
+ AssertNull ("SHA512.Create('InvalidHash')", hash);
+
+ // try to build null implementation
+ try {
+ hash = SHA512.Create (null);
+ Fail ("SHA512.Create(null) should throw ArgumentNullException");
+ }
+ catch (ArgumentNullException) {
+ // do nothing, this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("SHA512.Create(null) should throw ArgumentNullException not " + e.ToString ());
+ }
+ }
+
+ // none of those values changes for any implementation of defaultSHA512
+ public virtual void TestStaticInfo ()
+ {
+ string className = hash.ToString ();
+ AssertEquals (className + ".HashSize", 512, hash.HashSize);
+ AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
+ AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs
new file mode 100644
index 00000000000..c7ec98d9161
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs
@@ -0,0 +1,296 @@
+//
+// SignatureDescriptionTest.cs - NUnit Test Cases for SignatureDescription
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Cryptography;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class SignatureDescriptionTest : TestCase {
+ protected SignatureDescription sig;
+ protected static DSA dsa;
+ protected static RSA rsa;
+
+ protected override void SetUp ()
+ {
+ sig = new SignatureDescription();
+ // key generation is VERY long so one time is enough
+ if (dsa == null)
+ dsa = DSA.Create ();
+ if (rsa == null)
+ rsa = RSA.Create ();
+ }
+
+ protected override void TearDown () {}
+
+ public void AssertEquals (string msg, byte[] array1, byte[] array2)
+ {
+ AllTests.AssertEquals (msg, array1, array2);
+ }
+
+ public void TestConstructors ()
+ {
+ // empty constructor
+ SignatureDescription sig = new SignatureDescription ();
+ AssertNotNull ("SignatureDescription()", sig);
+ // null constructor
+ try {
+ sig = new SignatureDescription (null);
+ Fail ("SignatureDescription(null): Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // LAMESPEC: Documented as CryptographicException
+ // but thrown as ArgumentNullException
+ }
+ catch (Exception e) {
+ Fail ("SignatureDescription(null): Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ // (empty) SecurityElement constructor
+ SecurityElement se = new SecurityElement ("xml");
+ sig = new SignatureDescription (se);
+ AssertNotNull ("SignatureDescription(SecurityElement)", sig);
+ }
+
+ public void TestProperties ()
+ {
+ string invalid = "invalid";
+ AssertNull ("DeformatterAlgorithm 1", sig.DeformatterAlgorithm);
+ sig.DeformatterAlgorithm = invalid;
+ AssertNotNull ("DeformatterAlgorithm 2", sig.DeformatterAlgorithm);
+ AssertEquals ("DeformatterAlgorithm 3", invalid, sig.DeformatterAlgorithm);
+ sig.DeformatterAlgorithm = null;
+ AssertNull ("DeformatterAlgorithm 4", sig.DeformatterAlgorithm);
+
+ AssertNull ("DigestAlgorithm 1", sig.DigestAlgorithm);
+ sig.DigestAlgorithm = invalid;
+ AssertNotNull ("DigestAlgorithm 2", sig.DigestAlgorithm);
+ AssertEquals ("DigestAlgorithm 3", invalid, sig.DigestAlgorithm);
+ sig.DigestAlgorithm = null;
+ AssertNull ("DigestAlgorithm 4", sig.DigestAlgorithm);
+
+ AssertNull ("FormatterAlgorithm 1", sig.FormatterAlgorithm);
+ sig.FormatterAlgorithm = invalid;
+ AssertNotNull ("FormatterAlgorithm 2", sig.FormatterAlgorithm);
+ AssertEquals ("FormatterAlgorithm 3", invalid, sig.FormatterAlgorithm);
+ sig.FormatterAlgorithm = null;
+ AssertNull ("FormatterAlgorithm 4", sig.FormatterAlgorithm);
+
+ AssertNull ("KeyAlgorithm 1", sig.KeyAlgorithm);
+ sig.KeyAlgorithm = invalid;
+ AssertNotNull ("KeyAlgorithm 2", sig.KeyAlgorithm);
+ AssertEquals ("KeyAlgorithm 3", invalid, sig.KeyAlgorithm);
+ sig.KeyAlgorithm = null;
+ AssertNull ("KeyAlgorithm 4", sig.KeyAlgorithm);
+ }
+
+ public void TestDeformatter ()
+ {
+ AsymmetricSignatureDeformatter def = null;
+ // Deformatter with all properties null
+ try {
+ def = sig.CreateDeformatter (dsa);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ // Deformatter with invalid DeformatterAlgorithm property
+ sig.DeformatterAlgorithm = "DSA";
+ try {
+ def = sig.CreateDeformatter (dsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+ // Deformatter with valid DeformatterAlgorithm property
+ sig.DeformatterAlgorithm = "DSASignatureDeformatter";
+ try {
+ def = sig.CreateDeformatter (dsa);
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got: " + e.ToString ());
+ }
+ // Deformatter with valid DeformatterAlgorithm property
+ sig.KeyAlgorithm = "DSA";
+ sig.DigestAlgorithm = "SHA1";
+ sig.DeformatterAlgorithm = "DSASignatureDeformatter";
+ try {
+ def = sig.CreateDeformatter (dsa);
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestDigest ()
+ {
+ bool rightClass = false;
+ HashAlgorithm hash = null;
+ // null hash
+ try {
+ hash = sig.CreateDigest ();
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+
+ sig.DigestAlgorithm = "SHA1";
+ hash = sig.CreateDigest ();
+ AssertNotNull ("CreateDigest(SHA1)", hash);
+ rightClass = (hash.ToString ().IndexOf (sig.DigestAlgorithm) > 0);
+ Assert ("CreateDigest(SHA1)", rightClass);
+
+ sig.DigestAlgorithm = "MD5";
+ hash = sig.CreateDigest ();
+ AssertNotNull ("CreateDigest(MD5)", hash);
+ rightClass = (hash.ToString ().IndexOf (sig.DigestAlgorithm) > 0);
+ Assert ("CreateDigest(MD5)", rightClass);
+
+ sig.DigestAlgorithm = "SHA256";
+ hash = sig.CreateDigest ();
+ AssertNotNull ("CreateDigest(SHA256)", hash);
+ rightClass = (hash.ToString ().IndexOf (sig.DigestAlgorithm) > 0);
+ Assert ("CreateDigest(SHA256)", rightClass);
+
+ sig.DigestAlgorithm = "SHA384";
+ hash = sig.CreateDigest ();
+ AssertNotNull ("CreateDigest(SHA384)", hash);
+ rightClass = (hash.ToString ().IndexOf (sig.DigestAlgorithm) > 0);
+ Assert ("CreateDigest(SHA384)", rightClass);
+
+ sig.DigestAlgorithm = "SHA512";
+ hash = sig.CreateDigest ();
+ AssertNotNull ("CreateDigest(SHA512)", hash);
+ rightClass = (hash.ToString ().IndexOf (sig.DigestAlgorithm) > 0);
+ Assert ("CreateDigest(SHA512)", rightClass);
+
+ sig.DigestAlgorithm = "bad";
+ hash = sig.CreateDigest ();
+ AssertNull ("CreateDigest(bad)", hash);
+ }
+
+ public void TestFormatter ()
+ {
+ AsymmetricSignatureFormatter fmt = null;
+ // Formatter with all properties null
+ try {
+ fmt = sig.CreateFormatter (dsa);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got: " + e.ToString ());
+ }
+ // Formatter with invalid FormatterAlgorithm property
+ sig.FormatterAlgorithm = "DSA";
+ try {
+ fmt = sig.CreateFormatter (dsa);
+ Fail ("Expected InvalidCastException but got none");
+ }
+ catch (InvalidCastException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected InvalidCastException but got: " + e.ToString ());
+ }
+ // Formatter with valid FormatterAlgorithm property
+ sig.FormatterAlgorithm = "DSASignatureFormatter";
+ try {
+ fmt = sig.CreateFormatter (dsa);
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got: " + e.ToString ());
+ }
+ // Deformatter with valid DeformatterAlgorithm property
+ sig.KeyAlgorithm = "DSA";
+ sig.DigestAlgorithm = "SHA1";
+ sig.FormatterAlgorithm = "DSASignatureFormatter";
+ try {
+ fmt = sig.CreateFormatter (dsa);
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // this is what we expect
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got: " + e.ToString ());
+ }
+ }
+
+ public void TestDSASignatureDescription ()
+ {
+ // internal class - we cannot create one without CryptoConfig
+ SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1");
+ AssertEquals ("DSA.DigestAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider", sd.DigestAlgorithm);
+ AssertEquals ("DSA.DeformatterAlgorithm", "System.Security.Cryptography.DSASignatureDeformatter", sd.DeformatterAlgorithm);
+ AssertEquals ("DSA.FormatterAlgorithm", "System.Security.Cryptography.DSASignatureFormatter", sd.FormatterAlgorithm);
+ AssertEquals ("DSA.KeyAlgorithm", "System.Security.Cryptography.DSACryptoServiceProvider", sd.KeyAlgorithm);
+
+ HashAlgorithm hash = sd.CreateDigest();
+ AssertEquals ("DSA.CreateDigest", "System.Security.Cryptography.SHA1CryptoServiceProvider", hash.ToString ());
+
+ AssertEquals ("DSA.Create", dsa.ToString (), sd.KeyAlgorithm);
+
+ AsymmetricSignatureDeformatter asd = sd.CreateDeformatter (dsa);
+ AssertEquals ("DSA.CreateDeformatter", "System.Security.Cryptography.DSASignatureDeformatter", asd.ToString ());
+
+ AsymmetricSignatureFormatter asf = sd.CreateFormatter (dsa);
+ AssertEquals ("DSA.CreateFormatter", "System.Security.Cryptography.DSASignatureFormatter", asf.ToString ());
+ }
+
+ public void TestRSASignatureDescription ()
+ {
+ // internal class - we cannot create one without CryptoConfig
+ SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+ AssertEquals ("RSA.DigestAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider", sd.DigestAlgorithm);
+ AssertEquals ("RSA.DeformatterAlgorithm", "System.Security.Cryptography.RSAPKCS1SignatureDeformatter", sd.DeformatterAlgorithm);
+ AssertEquals ("RSA.FormatterAlgorithm", "System.Security.Cryptography.RSAPKCS1SignatureFormatter", sd.FormatterAlgorithm);
+ AssertEquals ("RSA.KeyAlgorithm", "System.Security.Cryptography.RSACryptoServiceProvider", sd.KeyAlgorithm);
+
+ HashAlgorithm hash = sd.CreateDigest();
+ AssertEquals ("RSA.CreateDigest", "System.Security.Cryptography.SHA1CryptoServiceProvider", hash.ToString ());
+
+ AssertEquals ("RSA.Create", rsa.ToString (), sd.KeyAlgorithm);
+
+ AsymmetricSignatureDeformatter asd = sd.CreateDeformatter (rsa);
+ AssertEquals ("RSA.CreateDeformatter", "System.Security.Cryptography.RSAPKCS1SignatureDeformatter", asd.ToString ());
+
+ AsymmetricSignatureFormatter asf = sd.CreateFormatter (rsa);
+ AssertEquals ("RSA.CreateFormatter", "System.Security.Cryptography.RSAPKCS1SignatureFormatter", asf.ToString ());
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs
new file mode 100755
index 00000000000..4cbd89cc146
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs
@@ -0,0 +1,5782 @@
+// !!! DO NOT EDIT - This file is generated automatically - DO NOT EDIT !!!
+// Note: Key and IV will be different each time the file is generated
+
+//
+// SymmetricAlgorithmTest.cs - NUnit Test Cases for SymmetricAlgorithmTest
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MonoTests.System.Security.Cryptography {
+
+public class SymmetricAlgorithmTest : TestCase {
+public void AssertEquals (string msg, byte[] array1, byte[] array2)
+{
+ AllTests.AssertEquals (msg, array1, array2);
+}
+
+//--8<-- NON GENERATED CODE STARTS HERE --8<----8<----8<----8<----8<----8<--
+
+//-->8-- NON GENERATED CODE ENDS HERE -->8---->8---->8---->8---->8---->8--
+
+private void Encrypt (ICryptoTransform trans, byte[] input, byte[] output)
+{
+ int bs = trans.InputBlockSize;
+ int full = input.Length / bs;
+ int partial = input.Length % bs;
+ int pos = 0;
+ for (int i=0; i < full; i++) {
+ trans.TransformBlock (input, pos, bs, output, pos);
+ pos += bs;
+ }
+ if (partial > 0) {
+ byte[] final = trans.TransformFinalBlock (input, pos, partial);
+ Array.Copy (final, 0, output, pos, bs);
+ }
+}
+
+private void Decrypt (ICryptoTransform trans, byte[] input, byte[] output)
+{
+ int bs = trans.InputBlockSize;
+ int full = input.Length / bs;
+ int partial = input.Length % bs;
+ int pos = 0;
+ for (int i=0; i < full; i++) {
+ trans.TransformBlock (input, pos, bs, output, pos);
+ pos += bs;
+ }
+ if (partial > 0) {
+ byte[] final = trans.TransformFinalBlock (input, pos, partial);
+ Array.Copy (final, 0, output, pos, partial);
+ }
+}
+
+public void TestDES_k64b64_ECB_None ()
+{
+ byte[] key = { 0x12, 0xE7, 0x7B, 0xBF, 0x11, 0x90, 0x9D, 0xB0 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xD2, 0x0E, 0xA7, 0xA4, 0x00, 0xF3, 0x17, 0x69 };
+ byte[] expected = { 0x4B, 0x63, 0x6D, 0x2C, 0xA7, 0x0B, 0x77, 0x1C, 0x4B, 0x63, 0x6D, 0x2C, 0xA7, 0x0B, 0x77, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("DES_k64b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_ECB_Zeros ()
+{
+ byte[] key = { 0x2E, 0xCA, 0x2E, 0xC9, 0x1A, 0xB6, 0x9A, 0x5A };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x79, 0x75, 0xD0, 0x3F, 0xFD, 0x1B, 0x12, 0x13 };
+ byte[] expected = { 0x9B, 0x58, 0x07, 0x30, 0xE5, 0xDA, 0x3E, 0x7F, 0x9B, 0x58, 0x07, 0x30, 0xE5, 0xDA, 0x3E, 0x7F, 0x9B, 0x58, 0x07, 0x30, 0xE5, 0xDA, 0x3E, 0x7F };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("DES_k64b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("DES_k64b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x32, 0xE8, 0x8D, 0xF7, 0xDC, 0xFC, 0x6C, 0xCD };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x74, 0xB2, 0x5E, 0x33, 0xBD, 0xA3, 0xC1, 0xB8 };
+ byte[] expected = { 0x0E, 0xB6, 0xA5, 0x6F, 0x4A, 0xAE, 0xED, 0x95, 0x0E, 0xB6, 0xA5, 0x6F, 0x4A, 0xAE, 0xED, 0x95, 0x45, 0xEC, 0x24, 0x40, 0xF4, 0xB3, 0x97, 0xF3 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("DES_k64b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_CBC_None ()
+{
+ byte[] key = { 0x91, 0xB4, 0x33, 0xB9, 0xA3, 0x7C, 0x47, 0x76 };
+ byte[] iv = { 0x96, 0x98, 0xCC, 0x84, 0xDD, 0xC3, 0xA1, 0x14 };
+ byte[] expected = { 0x71, 0x8A, 0xD7, 0xC1, 0x3F, 0xBC, 0x0C, 0xB7, 0xB7, 0x91, 0x96, 0x6A, 0xA9, 0xA6, 0xFC, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_CBC_Zeros ()
+{
+ byte[] key = { 0x4A, 0x8B, 0xC7, 0xC5, 0x9C, 0x10, 0xB4, 0x6C };
+ byte[] iv = { 0x4B, 0x53, 0x53, 0xEA, 0xAF, 0xCC, 0x5A, 0x2B };
+ byte[] expected = { 0xCA, 0xBC, 0xB7, 0xB9, 0xCF, 0x72, 0x63, 0x1F, 0x83, 0x96, 0xA4, 0xB7, 0x95, 0xF7, 0xFE, 0x13, 0x90, 0x6A, 0x4B, 0x74, 0x9E, 0xE0, 0xF9, 0x30 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0xEA, 0x7D, 0x6D, 0x2C, 0xB8, 0x93, 0x33, 0xF4 };
+ byte[] iv = { 0x77, 0xE4, 0xAA, 0x7C, 0xFE, 0xA9, 0x0F, 0x94 };
+ byte[] expected = { 0x83, 0xB0, 0x83, 0xCA, 0xAC, 0x64, 0xE3, 0xDF, 0x1F, 0x5B, 0xE2, 0x9C, 0x16, 0x3E, 0x68, 0x91, 0x9E, 0xE5, 0xB5, 0x67, 0x80, 0xD2, 0x52, 0xC6 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters DES_k64b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters DES_k64b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters DES_k64b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestDES_k64b64_CFB8_None ()
+{
+ byte[] key = { 0x52, 0x5E, 0x49, 0x90, 0x10, 0x20, 0x6D, 0x5C };
+ byte[] iv = { 0x00, 0x45, 0x9B, 0x7F, 0xC2, 0x9D, 0x90, 0x37 };
+ byte[] expected = { 0x9C, 0x9F, 0xE0, 0x9F, 0x2E, 0x0C, 0xE0, 0xBA, 0xD3, 0x2F, 0xF4, 0x54, 0x89, 0x83, 0x82, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_CFB8_Zeros ()
+{
+ byte[] key = { 0xAF, 0x35, 0x0A, 0x91, 0x8F, 0x45, 0x46, 0xAF };
+ byte[] iv = { 0x3A, 0xF5, 0xCD, 0x22, 0xDC, 0xEF, 0xF4, 0x61 };
+ byte[] expected = { 0xFB, 0x7E, 0xA8, 0xEC, 0xC0, 0x65, 0x30, 0xE3, 0x84, 0xBC, 0x49, 0xB9, 0x1C, 0xFD, 0xF6, 0x81, 0xCE, 0x2A, 0x69, 0x70, 0x73, 0xF0, 0x9A, 0xA8 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestDES_k64b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x5D, 0xAD, 0x6F, 0xFF, 0x48, 0x89, 0x18, 0xE6 };
+ byte[] iv = { 0x98, 0x46, 0xD3, 0xFC, 0x1A, 0x59, 0xF6, 0x20 };
+ byte[] expected = { 0xC3, 0xAC, 0xCF, 0x49, 0xFF, 0x46, 0x82, 0x21, 0xE8, 0x1F, 0x31, 0x4E, 0x1C, 0x33, 0xEA, 0x49, 0x54, 0x67, 0x3E, 0x9C, 0xFD, 0x77, 0x39, 0x69 };
+
+ SymmetricAlgorithm algo = DES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("DES_k64b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("DES_k64b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters DES_k64b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters DES_k64b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters DES_k64b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k40b64_ECB_None ()
+{
+ byte[] key = { 0xC3, 0x69, 0xCB, 0x65, 0x22 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x5E, 0x8E, 0xDB, 0xFD, 0x10, 0x1F, 0x14, 0x90 };
+ byte[] expected = { 0xCC, 0x71, 0xF5, 0xC1, 0x2F, 0xAF, 0xB8, 0xF4, 0xCC, 0x71, 0xF5, 0xC1, 0x2F, 0xAF, 0xB8, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k40b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_ECB_Zeros ()
+{
+ byte[] key = { 0x12, 0x66, 0x49, 0x15, 0xBC };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x3C, 0x1C, 0x38, 0x12, 0x1C, 0x78, 0x0C, 0x19 };
+ byte[] expected = { 0xDF, 0xD0, 0xD8, 0x24, 0xD8, 0x22, 0x51, 0x7C, 0xDF, 0xD0, 0xD8, 0x24, 0xD8, 0x22, 0x51, 0x7C, 0xDF, 0xD0, 0xD8, 0x24, 0xD8, 0x22, 0x51, 0x7C };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k40b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k40b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0xC2, 0x76, 0x2F, 0xCE, 0xED };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xB1, 0x88, 0x93, 0x03, 0xDA, 0x23, 0xE6, 0x87 };
+ byte[] expected = { 0xE2, 0x9B, 0x89, 0x15, 0xEC, 0x57, 0x0B, 0x05, 0xE2, 0x9B, 0x89, 0x15, 0xEC, 0x57, 0x0B, 0x05, 0x44, 0x77, 0xF0, 0x47, 0x2A, 0x12, 0xEA, 0xA1 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k40b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_CBC_None ()
+{
+ byte[] key = { 0xD0, 0xE1, 0x4E, 0x9C, 0x58 };
+ byte[] iv = { 0x8E, 0x5E, 0x76, 0x18, 0xB8, 0x76, 0xCF, 0x77 };
+ byte[] expected = { 0x36, 0x1B, 0x18, 0x98, 0xEE, 0xC6, 0x18, 0xB8, 0x67, 0xC0, 0x92, 0x09, 0x22, 0xDC, 0x65, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_CBC_Zeros ()
+{
+ byte[] key = { 0xB5, 0x6F, 0xC7, 0x4F, 0xF8 };
+ byte[] iv = { 0xB6, 0x95, 0xE9, 0x3E, 0x04, 0x98, 0x39, 0x3D };
+ byte[] expected = { 0x32, 0x10, 0x36, 0x24, 0x9F, 0xB6, 0x87, 0x4E, 0x00, 0xB6, 0xEF, 0x33, 0x52, 0x8B, 0xDE, 0x8A, 0x90, 0xE2, 0x0C, 0x60, 0xD3, 0x1A, 0x72, 0xCC };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x67, 0xB6, 0xEE, 0xF5, 0x21 };
+ byte[] iv = { 0xD3, 0xF1, 0xE7, 0xFF, 0x23, 0x92, 0xDC, 0xD9 };
+ byte[] expected = { 0x24, 0x2F, 0x90, 0xAE, 0x75, 0x8E, 0x0C, 0x7F, 0xCA, 0xE4, 0xE7, 0x87, 0x2D, 0xEE, 0x9E, 0x30, 0x49, 0xF0, 0xBB, 0xC4, 0x4C, 0x8D, 0x44, 0x5C };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k40b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k40b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k40b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k40b64_CFB8_None ()
+{
+ byte[] key = { 0x35, 0xCF, 0xA0, 0x20, 0x56 };
+ byte[] iv = { 0xC5, 0x47, 0xFA, 0x9D, 0x19, 0x4F, 0xA9, 0x06 };
+ byte[] expected = { 0xEF, 0xF9, 0xE1, 0xEE, 0x23, 0x89, 0xF6, 0x6B, 0x1F, 0xA6, 0x07, 0xAC, 0x73, 0x4A, 0xC1, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_CFB8_Zeros ()
+{
+ byte[] key = { 0xDA, 0xD8, 0xF9, 0x76, 0xE4 };
+ byte[] iv = { 0xAA, 0xC5, 0x42, 0xF9, 0x88, 0x42, 0x09, 0xB4 };
+ byte[] expected = { 0x49, 0x08, 0xFD, 0x7B, 0x1A, 0xA2, 0xDB, 0xF3, 0xB7, 0x13, 0x01, 0x4F, 0xB8, 0x79, 0x3A, 0x0E, 0xA0, 0x11, 0x1E, 0x27, 0xA7, 0xFE, 0xFA, 0x48 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k40b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xDF, 0x8C, 0xC7, 0x3C, 0xDE };
+ byte[] iv = { 0x1D, 0x0A, 0x92, 0x74, 0xD6, 0xEB, 0x99, 0x0F };
+ byte[] expected = { 0xF9, 0x7A, 0x8E, 0xE1, 0xF2, 0x93, 0xB8, 0xCF, 0xD4, 0x7C, 0xF8, 0x81, 0x7F, 0x53, 0x7C, 0x8F, 0x42, 0x8C, 0xC4, 0xFB, 0x9E, 0x0C, 0x65, 0x53 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k40b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k40b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k40b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k40b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k40b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k48b64_ECB_None ()
+{
+ byte[] key = { 0xAA, 0x37, 0x60, 0x52, 0x8A, 0xBE };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x0D, 0x5B, 0x94, 0x0F, 0x9A, 0x87, 0x08, 0x56 };
+ byte[] expected = { 0xB4, 0xB4, 0x2B, 0x12, 0x9C, 0x07, 0xD4, 0xC9, 0xB4, 0xB4, 0x2B, 0x12, 0x9C, 0x07, 0xD4, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k48b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_ECB_Zeros ()
+{
+ byte[] key = { 0x9B, 0x92, 0x8C, 0xC2, 0x18, 0xA3 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xB7, 0xC2, 0xAD, 0x13, 0x0A, 0x62, 0x0A, 0x50 };
+ byte[] expected = { 0x24, 0x74, 0x0F, 0x4B, 0xAA, 0xB1, 0xB8, 0xF5, 0x24, 0x74, 0x0F, 0x4B, 0xAA, 0xB1, 0xB8, 0xF5, 0x24, 0x74, 0x0F, 0x4B, 0xAA, 0xB1, 0xB8, 0xF5 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k48b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k48b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x58, 0x1A, 0xD6, 0x96, 0x02, 0x75 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x56, 0x83, 0x39, 0x7F, 0x3B, 0xD9, 0xB0, 0x33 };
+ byte[] expected = { 0x87, 0x46, 0x9E, 0xFF, 0x4B, 0xE8, 0xDA, 0xF2, 0x87, 0x46, 0x9E, 0xFF, 0x4B, 0xE8, 0xDA, 0xF2, 0x31, 0x54, 0x04, 0x63, 0xE0, 0x76, 0x74, 0x39 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k48b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_CBC_None ()
+{
+ byte[] key = { 0x21, 0x9A, 0xD6, 0x31, 0x99, 0x81 };
+ byte[] iv = { 0x5E, 0x6E, 0xB6, 0x33, 0xC0, 0x25, 0xAE, 0x5C };
+ byte[] expected = { 0x35, 0xFA, 0x8F, 0x4F, 0x75, 0xD1, 0x10, 0x11, 0xC0, 0xA4, 0x73, 0x69, 0xBD, 0xD2, 0xE3, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_CBC_Zeros ()
+{
+ byte[] key = { 0x59, 0x0A, 0xD4, 0x25, 0xA5, 0xB9 };
+ byte[] iv = { 0x10, 0x2D, 0x42, 0x54, 0xC8, 0x97, 0xD0, 0xA7 };
+ byte[] expected = { 0x4F, 0x1A, 0x5F, 0xD0, 0xA2, 0x54, 0x57, 0x60, 0x55, 0x9B, 0x4D, 0x1B, 0x55, 0xC9, 0x30, 0xA9, 0x7E, 0xF6, 0xAF, 0xFB, 0x50, 0x8B, 0xC0, 0xB6 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x39, 0x6C, 0xB3, 0x7B, 0xB5, 0xA9 };
+ byte[] iv = { 0x42, 0x56, 0x99, 0x18, 0xA8, 0x96, 0x93, 0x5D };
+ byte[] expected = { 0x92, 0x8B, 0x67, 0xC7, 0xAE, 0xF3, 0xF7, 0x03, 0x24, 0x67, 0xAC, 0xEA, 0xFE, 0xB7, 0x6B, 0x1E, 0x53, 0xB3, 0xF5, 0xDB, 0x64, 0x63, 0xB3, 0xE5 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k48b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k48b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k48b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k48b64_CFB8_None ()
+{
+ byte[] key = { 0x06, 0xCE, 0x23, 0x86, 0xEC, 0xB3 };
+ byte[] iv = { 0x14, 0xF7, 0xBA, 0xEC, 0xC2, 0x4A, 0x26, 0x6D };
+ byte[] expected = { 0x69, 0x7A, 0x1A, 0xCC, 0x40, 0x41, 0x78, 0xC1, 0xFA, 0x89, 0x90, 0x7F, 0xC1, 0x1C, 0x27, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x4B, 0xC8, 0x03, 0x4F, 0x43, 0x27 };
+ byte[] iv = { 0x02, 0x24, 0xB8, 0xE9, 0xF6, 0x19, 0xA1, 0x81 };
+ byte[] expected = { 0xE2, 0xD2, 0x50, 0x68, 0x56, 0x61, 0x30, 0x72, 0xA2, 0xDE, 0x97, 0xF5, 0x5C, 0xE9, 0xD5, 0xA0, 0x35, 0xD2, 0xC3, 0xEB, 0xC9, 0x2A, 0x64, 0x4D };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k48b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x22, 0x94, 0x8C, 0x13, 0x7F, 0x7A };
+ byte[] iv = { 0x4B, 0xDF, 0xB8, 0xBF, 0x0D, 0xBE, 0x1E, 0x3D };
+ byte[] expected = { 0x24, 0xE9, 0x2B, 0xBF, 0x84, 0x49, 0x4D, 0x2B, 0xC4, 0xD8, 0xEE, 0xAB, 0x52, 0x03, 0xC6, 0xAF, 0x19, 0x0A, 0x5B, 0x38, 0xB6, 0xF1, 0x98, 0x6F };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k48b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k48b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k48b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k48b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k48b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k56b64_ECB_None ()
+{
+ byte[] key = { 0xCA, 0x6B, 0x7A, 0xA1, 0xB1, 0x6E, 0x4A };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xF0, 0xA9, 0x35, 0xDB, 0x4F, 0xB5, 0x3D, 0xE4 };
+ byte[] expected = { 0x23, 0x39, 0x2D, 0xD9, 0x7C, 0xC0, 0xFF, 0x64, 0x23, 0x39, 0x2D, 0xD9, 0x7C, 0xC0, 0xFF, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k56b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_ECB_Zeros ()
+{
+ byte[] key = { 0x96, 0x43, 0x86, 0xAA, 0x0E, 0x66, 0x95 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xD3, 0xD7, 0x93, 0xED, 0xAF, 0xD6, 0x83, 0x3F };
+ byte[] expected = { 0x1C, 0x72, 0x96, 0xCF, 0x7D, 0x18, 0xDB, 0x4B, 0x1C, 0x72, 0x96, 0xCF, 0x7D, 0x18, 0xDB, 0x4B, 0x1C, 0x72, 0x96, 0xCF, 0x7D, 0x18, 0xDB, 0x4B };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k56b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k56b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x5A, 0x29, 0xE4, 0x77, 0x99, 0x9D, 0x5B };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xA6, 0x7B, 0x92, 0x40, 0x74, 0x9E, 0x0D, 0xAD };
+ byte[] expected = { 0xE1, 0xBB, 0xAA, 0x43, 0x54, 0x2E, 0xFF, 0x3A, 0xE1, 0xBB, 0xAA, 0x43, 0x54, 0x2E, 0xFF, 0x3A, 0x2E, 0xA1, 0x81, 0xF1, 0x85, 0x86, 0x35, 0x97 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k56b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_CBC_None ()
+{
+ byte[] key = { 0xDD, 0x2F, 0x84, 0x9F, 0xBA, 0xB1, 0xF3 };
+ byte[] iv = { 0x97, 0xB2, 0xCD, 0x3F, 0x1E, 0x53, 0xE8, 0xA9 };
+ byte[] expected = { 0x63, 0x6E, 0x62, 0xE5, 0x0F, 0x58, 0x86, 0x4A, 0xEF, 0x64, 0x4C, 0xDC, 0x36, 0x5D, 0x29, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_CBC_Zeros ()
+{
+ byte[] key = { 0xED, 0xEE, 0x33, 0x8E, 0x97, 0x20, 0x58 };
+ byte[] iv = { 0x0B, 0xAB, 0xAB, 0xED, 0xCC, 0x1C, 0x77, 0xA4 };
+ byte[] expected = { 0x8B, 0x2F, 0x52, 0x93, 0x48, 0x7A, 0x54, 0x03, 0x58, 0x6A, 0x9B, 0xC4, 0x13, 0x99, 0xCD, 0xE2, 0x18, 0x31, 0x67, 0x05, 0x27, 0x90, 0x1D, 0xFE };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x52, 0xF6, 0xC3, 0xC3, 0x13, 0x9E, 0xF7 };
+ byte[] iv = { 0x8E, 0xF8, 0xE5, 0x66, 0x64, 0x1C, 0xE6, 0xE3 };
+ byte[] expected = { 0x7B, 0xD1, 0x1A, 0xD0, 0x62, 0x1B, 0x66, 0x5B, 0x92, 0xB0, 0x42, 0xC7, 0x63, 0x3A, 0x95, 0xED, 0x87, 0x6B, 0xA0, 0x88, 0x18, 0xC2, 0x92, 0xB4 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k56b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k56b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k56b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k56b64_CFB8_None ()
+{
+ byte[] key = { 0xEA, 0x1D, 0xB2, 0x0E, 0x17, 0xF0, 0x4A };
+ byte[] iv = { 0xB7, 0xEE, 0xEE, 0xFF, 0x36, 0x8C, 0x9B, 0xBB };
+ byte[] expected = { 0x49, 0x1D, 0x32, 0xB4, 0x93, 0xEC, 0x96, 0xC9, 0xDC, 0x3B, 0x26, 0x4B, 0x3C, 0xA2, 0xE8, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x24, 0x6F, 0xE0, 0xC7, 0x3C, 0xC0, 0x4B };
+ byte[] iv = { 0xD7, 0x83, 0xCA, 0xB7, 0x9C, 0x6D, 0xC3, 0x25 };
+ byte[] expected = { 0x37, 0xF7, 0x35, 0xF4, 0xB2, 0x0C, 0xCB, 0xC4, 0xAE, 0x42, 0x83, 0x99, 0x55, 0xF6, 0x51, 0x5A, 0x1A, 0xE7, 0x7B, 0xFD, 0x4E, 0x78, 0xD7, 0x80 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k56b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x58, 0xE4, 0xC8, 0x6F, 0xB4, 0x14, 0xAC };
+ byte[] iv = { 0xA1, 0xBC, 0x94, 0xB5, 0xF5, 0x4F, 0x78, 0x19 };
+ byte[] expected = { 0xBA, 0x15, 0xE2, 0x73, 0x56, 0x5E, 0xB6, 0x30, 0xA8, 0x50, 0xA2, 0x61, 0x52, 0x2F, 0x61, 0xCC, 0x97, 0x9A, 0x91, 0xB1, 0xF0, 0x87, 0x3F, 0xA7 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k56b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k56b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k56b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k56b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k56b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k64b64_ECB_None ()
+{
+ byte[] key = { 0x2C, 0x52, 0xB4, 0x93, 0xF1, 0xEA, 0xC8, 0x8F };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xDE, 0x10, 0xA1, 0x1C, 0x5E, 0x43, 0x5F, 0x97 };
+ byte[] expected = { 0xDB, 0x1D, 0x72, 0x2C, 0x7C, 0x4A, 0x31, 0xDB, 0xDB, 0x1D, 0x72, 0x2C, 0x7C, 0x4A, 0x31, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k64b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_ECB_Zeros ()
+{
+ byte[] key = { 0x05, 0x0C, 0x49, 0xE3, 0x25, 0x49, 0xFA, 0x35 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x4D, 0x94, 0x32, 0xD2, 0x8B, 0xB6, 0x52, 0x9C };
+ byte[] expected = { 0x39, 0x35, 0xCE, 0x5C, 0x75, 0xF5, 0xB7, 0xA1, 0x39, 0x35, 0xCE, 0x5C, 0x75, 0xF5, 0xB7, 0xA1, 0x39, 0x35, 0xCE, 0x5C, 0x75, 0xF5, 0xB7, 0xA1 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k64b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k64b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0xE6, 0x57, 0xF2, 0x73, 0x3A, 0x20, 0xB0, 0x7E };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x34, 0x25, 0xD2, 0x35, 0x1C, 0xE4, 0x9D, 0xC6 };
+ byte[] expected = { 0x7A, 0x3F, 0x95, 0xA0, 0xA1, 0x70, 0xBD, 0xC3, 0x7A, 0x3F, 0x95, 0xA0, 0xA1, 0x70, 0xBD, 0xC3, 0xDA, 0xE7, 0x0C, 0xC3, 0xAD, 0xC3, 0xEA, 0xE9 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k64b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_CBC_None ()
+{
+ byte[] key = { 0x91, 0x14, 0x49, 0xC4, 0x0D, 0xF9, 0x90, 0x77 };
+ byte[] iv = { 0xB9, 0xBD, 0x6B, 0x9E, 0x52, 0xC9, 0x8C, 0xA5 };
+ byte[] expected = { 0xF1, 0x7C, 0xDF, 0x18, 0x54, 0xC2, 0xDE, 0x3B, 0x05, 0x20, 0x99, 0x94, 0x8A, 0x5E, 0x29, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_CBC_Zeros ()
+{
+ byte[] key = { 0x0E, 0xE0, 0xAD, 0xFD, 0x86, 0x22, 0x1D, 0x05 };
+ byte[] iv = { 0xDF, 0x41, 0x2B, 0x6E, 0x82, 0x00, 0xCB, 0x38 };
+ byte[] expected = { 0x98, 0x43, 0x84, 0x05, 0x68, 0xAE, 0x99, 0x3B, 0xB1, 0xCD, 0x2F, 0x69, 0xD9, 0xDD, 0x54, 0x79, 0x37, 0x36, 0x96, 0xE9, 0xC3, 0x62, 0xC2, 0x35 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x2D, 0x70, 0x15, 0xFF, 0x15, 0xEB, 0xDC, 0x33 };
+ byte[] iv = { 0x04, 0x33, 0x63, 0x52, 0x5B, 0xA1, 0xAB, 0xAC };
+ byte[] expected = { 0x07, 0x9B, 0x58, 0x27, 0xB4, 0x36, 0xDD, 0x9D, 0x7C, 0xC5, 0xE0, 0x83, 0x6A, 0x76, 0x87, 0x08, 0xF1, 0xEF, 0xCB, 0xE2, 0xA1, 0xF6, 0xA9, 0xBE };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k64b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k64b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k64b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k64b64_CFB8_None ()
+{
+ byte[] key = { 0x1B, 0x23, 0x16, 0xEA, 0x19, 0xF0, 0x53, 0xEE };
+ byte[] iv = { 0x60, 0x8D, 0x23, 0x2B, 0x0D, 0x56, 0x6F, 0x92 };
+ byte[] expected = { 0x0C, 0xE2, 0x26, 0xA8, 0x0A, 0xB8, 0xFE, 0x03, 0x71, 0x2B, 0x56, 0x59, 0xA3, 0x45, 0xC0, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x49, 0xAD, 0xCD, 0xF8, 0xB6, 0x44, 0xA1, 0x86 };
+ byte[] iv = { 0xCA, 0x6A, 0x96, 0xA8, 0x18, 0xA8, 0xF6, 0x77 };
+ byte[] expected = { 0x12, 0x88, 0x7D, 0xC4, 0x8A, 0x04, 0x86, 0x09, 0x4A, 0x64, 0xBE, 0x31, 0xD2, 0x1F, 0xF9, 0xA1, 0x80, 0x5D, 0x0B, 0x5A, 0x01, 0x9F, 0x10, 0x6D };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k64b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xF6, 0xE6, 0xA0, 0x33, 0xD3, 0x77, 0x0C, 0x28 };
+ byte[] iv = { 0x50, 0x31, 0x14, 0xAF, 0x27, 0x92, 0xFC, 0x57 };
+ byte[] expected = { 0xFF, 0x4B, 0xA2, 0x37, 0x56, 0xFB, 0x37, 0x4A, 0xB5, 0x6A, 0xCB, 0x27, 0x06, 0xED, 0xC2, 0x38, 0x7C, 0x4B, 0xBE, 0xC0, 0xD5, 0xD7, 0x6A, 0x79 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k64b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k64b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k64b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k64b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k64b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k72b64_ECB_None ()
+{
+ byte[] key = { 0xEC, 0x93, 0x9A, 0xF0, 0x51, 0x69, 0x59, 0x0B, 0x15 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x36, 0xDB, 0xE8, 0x7F, 0xB5, 0x43, 0x4C, 0xF6 };
+ byte[] expected = { 0xD6, 0x8A, 0x11, 0x59, 0x38, 0x6B, 0x93, 0x8F, 0xD6, 0x8A, 0x11, 0x59, 0x38, 0x6B, 0x93, 0x8F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k72b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_ECB_Zeros ()
+{
+ byte[] key = { 0x19, 0x14, 0x2D, 0xF6, 0x48, 0xED, 0x5A, 0xF3, 0x1F };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x8C, 0x1D, 0x0D, 0xC7, 0xE3, 0x77, 0x68, 0x40 };
+ byte[] expected = { 0x38, 0xD4, 0x18, 0x61, 0xF6, 0x8E, 0x55, 0xD7, 0x38, 0xD4, 0x18, 0x61, 0xF6, 0x8E, 0x55, 0xD7, 0x38, 0xD4, 0x18, 0x61, 0xF6, 0x8E, 0x55, 0xD7 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k72b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k72b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x1C, 0xAA, 0x46, 0xE7, 0x37, 0x23, 0x14, 0xC9, 0x31 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x3B, 0x0B, 0x1D, 0xE0, 0x3A, 0x6E, 0xF3, 0x1C };
+ byte[] expected = { 0x71, 0x04, 0xA2, 0x66, 0xFC, 0xB9, 0x0F, 0x48, 0x71, 0x04, 0xA2, 0x66, 0xFC, 0xB9, 0x0F, 0x48, 0xFA, 0xF7, 0x6F, 0xA9, 0xA0, 0x23, 0xF8, 0x7E };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k72b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_CBC_None ()
+{
+ byte[] key = { 0xF7, 0x60, 0xC5, 0x87, 0x4E, 0x36, 0xCE, 0x3C, 0xE6 };
+ byte[] iv = { 0x60, 0x0E, 0xAC, 0x58, 0x1C, 0x91, 0x1D, 0xAC };
+ byte[] expected = { 0xF7, 0xFE, 0xC3, 0x0E, 0x68, 0x6C, 0x15, 0x38, 0xDC, 0x06, 0xD9, 0x3A, 0x02, 0x08, 0xE2, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_CBC_Zeros ()
+{
+ byte[] key = { 0xD2, 0x3C, 0xD2, 0x40, 0xF1, 0x1D, 0x2E, 0xF4, 0x92 };
+ byte[] iv = { 0xBE, 0x7C, 0xF7, 0xBE, 0x35, 0x11, 0x94, 0x46 };
+ byte[] expected = { 0x7B, 0x6C, 0x73, 0xE4, 0x19, 0x69, 0x32, 0x61, 0x48, 0xE0, 0x21, 0x03, 0xAF, 0xC4, 0x54, 0x61, 0xE7, 0xB7, 0x00, 0x55, 0xDB, 0x57, 0x3C, 0x40 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0xE6, 0x09, 0x99, 0x96, 0x84, 0x2D, 0x9B, 0xE9, 0x34 };
+ byte[] iv = { 0x00, 0xE9, 0x3B, 0x59, 0x6C, 0x5E, 0xF3, 0x8A };
+ byte[] expected = { 0xA9, 0x4E, 0x30, 0x5F, 0xEF, 0xF5, 0x77, 0xC5, 0x26, 0x96, 0xDA, 0x3E, 0x53, 0xF5, 0xCB, 0xEC, 0xBC, 0xF9, 0x85, 0x00, 0xF2, 0x0D, 0x32, 0x2D };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k72b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k72b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k72b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k72b64_CFB8_None ()
+{
+ byte[] key = { 0x65, 0x6B, 0x23, 0x3F, 0xB3, 0xE5, 0x6F, 0x30, 0x01 };
+ byte[] iv = { 0x10, 0x16, 0x28, 0x20, 0xAB, 0x77, 0x74, 0x46 };
+ byte[] expected = { 0x5A, 0x35, 0x9B, 0x9E, 0x7A, 0xD6, 0xED, 0x1D, 0x36, 0xC9, 0x95, 0x0E, 0x04, 0xE1, 0x9C, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x87, 0xC1, 0x80, 0x41, 0xD6, 0xF1, 0x33, 0xC7, 0x78 };
+ byte[] iv = { 0x21, 0x55, 0xCF, 0x6E, 0xF5, 0x3B, 0xF0, 0x6B };
+ byte[] expected = { 0x83, 0xFC, 0xD7, 0x43, 0xC0, 0x4F, 0x9F, 0xE0, 0x60, 0xAD, 0x3B, 0x0D, 0x5A, 0xF3, 0xF3, 0x0B, 0x96, 0x25, 0x97, 0x6D, 0x58, 0x8B, 0x5A, 0x26 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k72b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xAE, 0xE0, 0x44, 0x66, 0xDA, 0x34, 0xFD, 0xD4, 0x71 };
+ byte[] iv = { 0xFA, 0x66, 0x5F, 0x55, 0xBC, 0x1B, 0xC7, 0x83 };
+ byte[] expected = { 0xF3, 0xAB, 0x63, 0x11, 0xA0, 0x27, 0x05, 0x42, 0x0A, 0xCD, 0x16, 0xCA, 0x22, 0x4E, 0x0B, 0xCB, 0x96, 0xCA, 0xD9, 0x38, 0x6D, 0x5E, 0x5E, 0x55 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k72b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k72b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k72b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k72b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k72b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k80b64_ECB_None ()
+{
+ byte[] key = { 0xB8, 0xA4, 0x76, 0xF8, 0x59, 0x86, 0x40, 0x53, 0x33, 0x68 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xFF, 0x5F, 0x8B, 0x5E, 0xCF, 0xB8, 0xA5, 0xCB };
+ byte[] expected = { 0x7A, 0x56, 0x73, 0x0A, 0x72, 0x69, 0x95, 0x16, 0x7A, 0x56, 0x73, 0x0A, 0x72, 0x69, 0x95, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k80b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_ECB_Zeros ()
+{
+ byte[] key = { 0x9A, 0xE1, 0xE1, 0x17, 0xCB, 0x2B, 0x9C, 0x5D, 0x5D, 0x28 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x71, 0x29, 0x89, 0x9C, 0x66, 0xF5, 0x90, 0x63 };
+ byte[] expected = { 0x38, 0x83, 0x30, 0xE0, 0xC6, 0x8A, 0x0B, 0x11, 0x38, 0x83, 0x30, 0xE0, 0xC6, 0x8A, 0x0B, 0x11, 0x38, 0x83, 0x30, 0xE0, 0xC6, 0x8A, 0x0B, 0x11 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k80b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k80b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x8D, 0xF8, 0xDA, 0xA2, 0x31, 0xEA, 0x86, 0x92, 0x52, 0xBB };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xD3, 0x1C, 0x57, 0x72, 0xDE, 0xFD, 0xCA, 0xC7 };
+ byte[] expected = { 0x51, 0xD4, 0x00, 0x54, 0x58, 0xE5, 0xED, 0x5C, 0x51, 0xD4, 0x00, 0x54, 0x58, 0xE5, 0xED, 0x5C, 0xCE, 0xF6, 0xDB, 0x31, 0x10, 0xE9, 0x0E, 0xD8 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k80b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_CBC_None ()
+{
+ byte[] key = { 0x5B, 0x45, 0x99, 0x10, 0x47, 0x42, 0x89, 0xC8, 0x2A, 0x6C };
+ byte[] iv = { 0xE4, 0x8F, 0x2A, 0x4D, 0x25, 0x38, 0x01, 0x04 };
+ byte[] expected = { 0xA3, 0x23, 0xE7, 0xCD, 0xC1, 0x5E, 0x4E, 0x1D, 0x2F, 0x7F, 0x8B, 0xA7, 0xD0, 0x42, 0xF2, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_CBC_Zeros ()
+{
+ byte[] key = { 0xD4, 0x47, 0xFF, 0x5A, 0x70, 0xE8, 0x48, 0x0F, 0x23, 0xD1 };
+ byte[] iv = { 0x8B, 0xF8, 0x94, 0x02, 0xB3, 0xFB, 0xB0, 0x0D };
+ byte[] expected = { 0x88, 0x5C, 0x72, 0x4C, 0x35, 0x7F, 0x73, 0x1C, 0x8A, 0x06, 0x6B, 0x90, 0x82, 0xC5, 0xBC, 0x46, 0x75, 0xC1, 0x87, 0xD9, 0xED, 0x29, 0x1D, 0xB8 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x8D, 0x77, 0xC5, 0x6E, 0xC2, 0x8F, 0x10, 0x51, 0xD2, 0x20 };
+ byte[] iv = { 0x43, 0xC5, 0x4E, 0x58, 0xF0, 0xD7, 0xB3, 0x92 };
+ byte[] expected = { 0xE9, 0xB0, 0x67, 0x7C, 0x6C, 0x77, 0x68, 0x4D, 0xD0, 0xA5, 0x93, 0x9F, 0x84, 0xE0, 0xA0, 0xA9, 0x36, 0x21, 0xD7, 0x07, 0x0B, 0x8D, 0xD7, 0xB9 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k80b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k80b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k80b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k80b64_CFB8_None ()
+{
+ byte[] key = { 0x2A, 0x44, 0xD9, 0x1C, 0x5E, 0x7C, 0x79, 0x3D, 0x88, 0x55 };
+ byte[] iv = { 0xA0, 0x48, 0x00, 0x04, 0xA8, 0xB8, 0x83, 0x9F };
+ byte[] expected = { 0xEA, 0xD0, 0x3D, 0x9A, 0x62, 0xEA, 0x9C, 0x59, 0xAC, 0xD4, 0xA1, 0xDE, 0xDB, 0x3D, 0xF8, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x30, 0x51, 0xCD, 0x3B, 0x8A, 0x8A, 0x8C, 0xF4, 0x76, 0x64 };
+ byte[] iv = { 0xD9, 0x5F, 0xEB, 0x11, 0x8F, 0x0A, 0x7D, 0xDC };
+ byte[] expected = { 0x02, 0xB4, 0x0F, 0xB5, 0x79, 0x81, 0xAC, 0xFD, 0xBA, 0x40, 0xF1, 0x61, 0x96, 0x70, 0x09, 0x5B, 0xFF, 0x0D, 0x90, 0xB4, 0x54, 0x27, 0x4A, 0x3C };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k80b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xA7, 0x24, 0xA0, 0x14, 0x78, 0xDC, 0x8B, 0x99, 0x77, 0xCD };
+ byte[] iv = { 0xB8, 0x68, 0xD0, 0x5A, 0x13, 0x3C, 0xBA, 0x59 };
+ byte[] expected = { 0x3B, 0x35, 0xF6, 0x3F, 0x36, 0x7B, 0xF1, 0x7D, 0xCE, 0xC8, 0x62, 0xF8, 0x34, 0xC6, 0x42, 0x6F, 0x77, 0xCF, 0x32, 0x41, 0xF3, 0x0B, 0x28, 0x37 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k80b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k80b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k80b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k80b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k80b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k88b64_ECB_None ()
+{
+ byte[] key = { 0xCE, 0x12, 0x59, 0x88, 0x7A, 0xCD, 0x57, 0x4C, 0xCD, 0xA9, 0xD2 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x91, 0x4C, 0x2D, 0xB4, 0x6E, 0x19, 0x3F, 0x6F };
+ byte[] expected = { 0x74, 0x25, 0xAD, 0x2E, 0x88, 0xA9, 0x3E, 0x1F, 0x74, 0x25, 0xAD, 0x2E, 0x88, 0xA9, 0x3E, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k88b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_ECB_Zeros ()
+{
+ byte[] key = { 0x28, 0xDC, 0x09, 0x80, 0x85, 0x25, 0x95, 0x41, 0x7B, 0xD4, 0x06 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xAE, 0x0D, 0xC1, 0x42, 0x01, 0x1C, 0x6E, 0x5A };
+ byte[] expected = { 0x48, 0xD6, 0x9F, 0x9A, 0x7C, 0x93, 0x89, 0x5F, 0x48, 0xD6, 0x9F, 0x9A, 0x7C, 0x93, 0x89, 0x5F, 0x48, 0xD6, 0x9F, 0x9A, 0x7C, 0x93, 0x89, 0x5F };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k88b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k88b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0xAB, 0x26, 0x7E, 0xD3, 0x3A, 0x0A, 0x3F, 0x50, 0x0B, 0x84, 0x5F };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x28, 0x3C, 0x18, 0x06, 0x3C, 0xF7, 0x83, 0x51 };
+ byte[] expected = { 0xE0, 0x60, 0x29, 0xC5, 0xE5, 0xFE, 0x75, 0x95, 0xE0, 0x60, 0x29, 0xC5, 0xE5, 0xFE, 0x75, 0x95, 0xE8, 0x61, 0x0A, 0x2A, 0x79, 0x3F, 0x0A, 0xB7 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k88b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_CBC_None ()
+{
+ byte[] key = { 0x01, 0x2F, 0x45, 0x5F, 0x2D, 0x9E, 0xDB, 0x29, 0x6C, 0x54, 0xF5 };
+ byte[] iv = { 0x4C, 0x6A, 0x4D, 0x77, 0x7E, 0x34, 0xB4, 0x75 };
+ byte[] expected = { 0x66, 0x58, 0x7F, 0xE7, 0x6D, 0x3B, 0x6A, 0x97, 0xFC, 0x65, 0x15, 0x8D, 0xAC, 0xB0, 0xB1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_CBC_Zeros ()
+{
+ byte[] key = { 0xA9, 0xD1, 0xDA, 0xCB, 0x4C, 0xA7, 0xD3, 0x35, 0x70, 0x1E, 0x15 };
+ byte[] iv = { 0xF2, 0x17, 0x14, 0x41, 0x36, 0x58, 0x27, 0x48 };
+ byte[] expected = { 0x41, 0xDD, 0xFE, 0x10, 0x56, 0xE2, 0x86, 0xDC, 0xC6, 0x53, 0x69, 0x1A, 0x2D, 0x66, 0x1D, 0x1C, 0xAD, 0x3C, 0x1F, 0xCE, 0xE3, 0xE2, 0x52, 0x13 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x07, 0x97, 0xCB, 0xA3, 0xB6, 0xFF, 0x57, 0x30, 0x5A, 0x2E, 0x3E };
+ byte[] iv = { 0x78, 0x44, 0xCE, 0xBA, 0xC6, 0xCD, 0x0C, 0xB7 };
+ byte[] expected = { 0x07, 0xCC, 0xFD, 0x12, 0x0D, 0x07, 0xED, 0xB2, 0x8C, 0xDA, 0xB9, 0xC3, 0xE7, 0x04, 0x41, 0x5A, 0xA3, 0x9C, 0x50, 0x8B, 0x8F, 0x9D, 0x2E, 0x65 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k88b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k88b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k88b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k88b64_CFB8_None ()
+{
+ byte[] key = { 0x6E, 0x73, 0x03, 0xFD, 0x20, 0xAB, 0x21, 0x9D, 0x54, 0x0C, 0xB9 };
+ byte[] iv = { 0x69, 0x6B, 0xF5, 0xD0, 0x10, 0xB5, 0xFE, 0xEF };
+ byte[] expected = { 0x12, 0x2B, 0xF0, 0x54, 0xFF, 0x2F, 0xE2, 0xF0, 0x36, 0x9A, 0x3E, 0xFE, 0x57, 0x56, 0x0E, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x8B, 0x1D, 0xD0, 0x5C, 0x3E, 0xF4, 0x5B, 0xA5, 0x56, 0x87, 0xE8 };
+ byte[] iv = { 0x14, 0x01, 0x4B, 0x90, 0x67, 0x02, 0x79, 0x3F };
+ byte[] expected = { 0xA1, 0x7D, 0x02, 0x58, 0xBC, 0x3E, 0x56, 0x3E, 0xF6, 0x08, 0x08, 0xB0, 0xD0, 0xD1, 0xAC, 0x9F, 0x29, 0x65, 0x18, 0x76, 0x2C, 0x96, 0xCC, 0x8C };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k88b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xCB, 0xD9, 0xE0, 0xD8, 0x82, 0xA0, 0x06, 0xD1, 0x6C, 0x5F, 0x8F };
+ byte[] iv = { 0x73, 0x14, 0x81, 0x8C, 0x59, 0xE4, 0x33, 0xDF };
+ byte[] expected = { 0x31, 0xA2, 0xA9, 0xCE, 0xAF, 0xF1, 0x8F, 0xA5, 0x02, 0xD8, 0xF5, 0xDC, 0x2C, 0x41, 0x8E, 0x64, 0x81, 0xCA, 0xBE, 0x89, 0xC3, 0x19, 0x24, 0x78 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k88b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k88b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k88b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k88b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k88b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k96b64_ECB_None ()
+{
+ byte[] key = { 0x72, 0xD8, 0x0A, 0x9D, 0xDA, 0x9D, 0xB1, 0x78, 0x61, 0x9C, 0xD8, 0x57 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x31, 0x21, 0x9D, 0xD9, 0x12, 0x95, 0x79, 0x30 };
+ byte[] expected = { 0x41, 0xA6, 0x5B, 0x2D, 0x51, 0x55, 0x1B, 0xE2, 0x41, 0xA6, 0x5B, 0x2D, 0x51, 0x55, 0x1B, 0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k96b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_ECB_Zeros ()
+{
+ byte[] key = { 0x5D, 0x07, 0x3C, 0x15, 0x3F, 0xE1, 0xB2, 0x72, 0x9F, 0x1A, 0xBE, 0x21 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x76, 0xE9, 0x93, 0x9F, 0xD1, 0x6A, 0xCE, 0x79 };
+ byte[] expected = { 0x56, 0xF6, 0xF3, 0xAE, 0xCD, 0x73, 0x4F, 0x12, 0x56, 0xF6, 0xF3, 0xAE, 0xCD, 0x73, 0x4F, 0x12, 0x56, 0xF6, 0xF3, 0xAE, 0xCD, 0x73, 0x4F, 0x12 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k96b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k96b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x79, 0xCA, 0xDB, 0xBE, 0x8C, 0x10, 0x1E, 0xEB, 0x8B, 0x16, 0x00, 0x1B };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x17, 0x42, 0x68, 0x21, 0xBC, 0x52, 0x6A, 0xF6 };
+ byte[] expected = { 0x86, 0xB2, 0x84, 0xAA, 0x58, 0xCB, 0x3F, 0x19, 0x86, 0xB2, 0x84, 0xAA, 0x58, 0xCB, 0x3F, 0x19, 0x75, 0xB8, 0x91, 0xC8, 0x17, 0xE2, 0x1C, 0x4A };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k96b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_CBC_None ()
+{
+ byte[] key = { 0x68, 0xC6, 0xF2, 0x13, 0xEA, 0x3D, 0x68, 0x09, 0xAC, 0x07, 0x21, 0x1F };
+ byte[] iv = { 0x42, 0x47, 0xE6, 0x98, 0xF8, 0xFE, 0xCD, 0xFE };
+ byte[] expected = { 0x7F, 0x9C, 0xCE, 0xC5, 0x2C, 0xB6, 0x60, 0xC3, 0xF3, 0x5F, 0x7E, 0x95, 0x6F, 0xFE, 0x8E, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_CBC_Zeros ()
+{
+ byte[] key = { 0xDF, 0x00, 0x49, 0x93, 0xA1, 0x49, 0x50, 0x03, 0x52, 0x9C, 0x86, 0xF6 };
+ byte[] iv = { 0x69, 0xFC, 0x72, 0xA2, 0x60, 0xF7, 0x4C, 0xB0 };
+ byte[] expected = { 0x16, 0x07, 0x45, 0x07, 0xF8, 0xAE, 0xD3, 0xEA, 0x94, 0x1E, 0xC9, 0x1A, 0xEF, 0x8D, 0x3E, 0xF7, 0x88, 0x7D, 0x8D, 0xF8, 0xC6, 0x0A, 0xFA, 0x82 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x04, 0x2B, 0x2E, 0x98, 0x97, 0x84, 0x72, 0x0A, 0x78, 0x61, 0x02, 0xA9 };
+ byte[] iv = { 0x16, 0x0A, 0x00, 0x48, 0xC3, 0x4F, 0x63, 0x05 };
+ byte[] expected = { 0xD2, 0xC4, 0xC7, 0x02, 0xC7, 0xDB, 0xFB, 0xF6, 0xC1, 0x4D, 0x2D, 0x62, 0xF6, 0x57, 0x84, 0x84, 0xF2, 0x9B, 0x5C, 0x42, 0x66, 0x9B, 0x33, 0x1D };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k96b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k96b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k96b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k96b64_CFB8_None ()
+{
+ byte[] key = { 0xDE, 0x6E, 0x40, 0xC3, 0x7D, 0x71, 0x0D, 0xCB, 0xA3, 0x62, 0x14, 0x76 };
+ byte[] iv = { 0x72, 0x9E, 0xB4, 0xEE, 0x9B, 0x87, 0xAF, 0x12 };
+ byte[] expected = { 0x14, 0x20, 0x3B, 0x35, 0xE2, 0x81, 0x84, 0x15, 0x6C, 0xA5, 0x4A, 0x94, 0xB3, 0xC0, 0x8D, 0x6A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_CFB8_Zeros ()
+{
+ byte[] key = { 0xCF, 0x64, 0x81, 0x8F, 0x7D, 0x75, 0x8D, 0xB2, 0x9D, 0xE7, 0x39, 0xE3 };
+ byte[] iv = { 0x30, 0xF2, 0x9E, 0x76, 0x96, 0x13, 0xCB, 0xDF };
+ byte[] expected = { 0xC4, 0x0E, 0xE8, 0x61, 0x92, 0xB8, 0x9D, 0xDE, 0x0B, 0x39, 0x47, 0xD4, 0xD8, 0x05, 0x35, 0xF9, 0x0A, 0xAF, 0x63, 0x30, 0x4A, 0x82, 0x8C, 0xF2 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k96b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xC5, 0xF4, 0x44, 0xF2, 0xA0, 0xC3, 0xA7, 0x87, 0x64, 0x36, 0x5A, 0xFA };
+ byte[] iv = { 0x20, 0xC5, 0x5E, 0x57, 0x5E, 0x0E, 0x2D, 0xDD };
+ byte[] expected = { 0x66, 0x93, 0x1E, 0x15, 0x17, 0x5C, 0x3C, 0x07, 0xDB, 0x2F, 0xD9, 0x00, 0x0C, 0x3F, 0x9E, 0xBB, 0xB9, 0x32, 0xDD, 0x2D, 0x57, 0x69, 0x3D, 0xC3 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k96b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k96b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k96b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k96b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k96b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k104b64_ECB_None ()
+{
+ byte[] key = { 0x04, 0x5B, 0x99, 0xD3, 0xBC, 0x00, 0x27, 0xA3, 0xDC, 0x57, 0x4C, 0x82, 0xD6 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x70, 0x3D, 0xE7, 0xBC, 0x82, 0xFD, 0x8F, 0x03 };
+ byte[] expected = { 0x5D, 0xEA, 0x9F, 0x1F, 0x19, 0xBB, 0x3D, 0x26, 0x5D, 0xEA, 0x9F, 0x1F, 0x19, 0xBB, 0x3D, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k104b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_ECB_Zeros ()
+{
+ byte[] key = { 0xA1, 0x3B, 0xDF, 0x6F, 0x6D, 0x2B, 0x7B, 0x0B, 0x13, 0x3E, 0x84, 0x35, 0x3C };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xE6, 0x74, 0x41, 0xB6, 0xB4, 0x31, 0xB2, 0x6A };
+ byte[] expected = { 0xAF, 0x46, 0x98, 0xF8, 0xC1, 0x4B, 0x45, 0x09, 0xAF, 0x46, 0x98, 0xF8, 0xC1, 0x4B, 0x45, 0x09, 0xAF, 0x46, 0x98, 0xF8, 0xC1, 0x4B, 0x45, 0x09 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k104b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k104b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x28, 0xDF, 0x8C, 0x1B, 0x7E, 0x04, 0xB2, 0x89, 0x72, 0xDA, 0x19, 0x57, 0x81 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xB8, 0x82, 0xA7, 0xBF, 0x99, 0xE9, 0x39, 0x02 };
+ byte[] expected = { 0x5D, 0xEB, 0xD8, 0x26, 0x51, 0x86, 0xFB, 0x0E, 0x5D, 0xEB, 0xD8, 0x26, 0x51, 0x86, 0xFB, 0x0E, 0x1C, 0xFD, 0xE2, 0x77, 0xB6, 0x74, 0x55, 0x9C };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k104b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_CBC_None ()
+{
+ byte[] key = { 0xF8, 0xCE, 0xA2, 0x33, 0xE5, 0x7D, 0x43, 0x72, 0xA9, 0xF5, 0xF1, 0x80, 0xBC };
+ byte[] iv = { 0x12, 0xFF, 0x74, 0x3A, 0x36, 0x42, 0xBE, 0x78 };
+ byte[] expected = { 0x64, 0xCD, 0x86, 0xA1, 0x1B, 0xB1, 0xD3, 0x9F, 0x8E, 0xFC, 0x42, 0xB8, 0x56, 0x96, 0x56, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_CBC_Zeros ()
+{
+ byte[] key = { 0xEF, 0x4E, 0x02, 0x86, 0x5F, 0xE5, 0x94, 0x05, 0xEF, 0x8D, 0x8D, 0x5D, 0x04 };
+ byte[] iv = { 0x98, 0x23, 0x93, 0xF7, 0x6D, 0x02, 0xB1, 0x73 };
+ byte[] expected = { 0x50, 0x08, 0xAB, 0x8B, 0x26, 0x0D, 0x5B, 0x73, 0x3F, 0xE7, 0x75, 0x55, 0x4F, 0x9C, 0xDC, 0xFC, 0x17, 0x58, 0x2A, 0xB2, 0xFC, 0x54, 0x15, 0x97 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0xE3, 0xD2, 0xC2, 0xA0, 0x54, 0xF5, 0xFC, 0xFC, 0x94, 0xA2, 0x6F, 0x6F, 0x52 };
+ byte[] iv = { 0xBA, 0x5D, 0x0D, 0xBA, 0x0D, 0x0C, 0x4E, 0x5B };
+ byte[] expected = { 0x6C, 0x5B, 0x74, 0x54, 0x0F, 0x86, 0x62, 0x06, 0x11, 0x65, 0xAA, 0x0B, 0x4F, 0x65, 0x34, 0x26, 0xAF, 0x26, 0x0D, 0xF4, 0xCE, 0xB6, 0xEE, 0xF0 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k104b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k104b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k104b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k104b64_CFB8_None ()
+{
+ byte[] key = { 0xB3, 0xE2, 0x4D, 0x91, 0xE9, 0xF8, 0x72, 0xA4, 0x2E, 0x00, 0x0C, 0x08, 0x96 };
+ byte[] iv = { 0x48, 0xF8, 0xDD, 0x61, 0xD5, 0x00, 0xD0, 0xE1 };
+ byte[] expected = { 0xB9, 0xAA, 0x53, 0xD8, 0xCB, 0x23, 0xA6, 0x41, 0x69, 0x84, 0x2D, 0xD5, 0x4F, 0x45, 0xC2, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_CFB8_Zeros ()
+{
+ byte[] key = { 0xD4, 0x9C, 0x6B, 0x12, 0x41, 0x93, 0xEB, 0xDA, 0xDF, 0x7A, 0x81, 0x23, 0x1F };
+ byte[] iv = { 0x3C, 0x0E, 0x48, 0xAA, 0xD8, 0x48, 0xE9, 0xC8 };
+ byte[] expected = { 0x66, 0x39, 0x26, 0x0B, 0x81, 0xD8, 0x9A, 0x2F, 0xF1, 0x2C, 0xCF, 0x75, 0x8C, 0x01, 0x4D, 0x6E, 0x2A, 0x67, 0x9D, 0x0D, 0xA5, 0x56, 0x15, 0x41 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k104b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x2C, 0x38, 0x19, 0x43, 0x93, 0x38, 0x85, 0xC4, 0xF2, 0x19, 0xC7, 0x1B, 0x76 };
+ byte[] iv = { 0xB4, 0x1B, 0x9C, 0x82, 0xB5, 0x6E, 0x42, 0xAF };
+ byte[] expected = { 0xC5, 0x56, 0x04, 0x85, 0x0A, 0x52, 0x8B, 0x02, 0x69, 0xB6, 0xCF, 0xC7, 0xA9, 0x35, 0x63, 0xF7, 0x4B, 0x48, 0xF3, 0xD0, 0xFF, 0x74, 0xA7, 0xB5 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k104b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k104b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k104b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k104b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k104b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k112b64_ECB_None ()
+{
+ byte[] key = { 0xB7, 0x95, 0xA4, 0x42, 0x21, 0x3D, 0x30, 0x51, 0x98, 0x01, 0xA0, 0x6C, 0x45, 0x68 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x3B, 0x36, 0x51, 0x24, 0xF4, 0x1A, 0xC1, 0x91 };
+ byte[] expected = { 0x31, 0xAE, 0xBA, 0xFB, 0xB4, 0xFA, 0x78, 0x30, 0x31, 0xAE, 0xBA, 0xFB, 0xB4, 0xFA, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k112b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_ECB_Zeros ()
+{
+ byte[] key = { 0xB1, 0x8E, 0x09, 0xFB, 0x70, 0x03, 0x6A, 0xF2, 0xCF, 0x9D, 0x9B, 0xD7, 0x10, 0xD4 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x64, 0x15, 0x78, 0xB8, 0x25, 0x15, 0xFA, 0xC8 };
+ byte[] expected = { 0xB1, 0xC2, 0x27, 0xA8, 0x32, 0xBA, 0x34, 0x06, 0xB1, 0xC2, 0x27, 0xA8, 0x32, 0xBA, 0x34, 0x06, 0xB1, 0xC2, 0x27, 0xA8, 0x32, 0xBA, 0x34, 0x06 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k112b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k112b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x4F, 0xE8, 0x2C, 0x62, 0x98, 0x89, 0xEF, 0x11, 0x29, 0xB2, 0xDD, 0x4D, 0xE1, 0x39 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x15, 0xE0, 0x95, 0x29, 0xEB, 0xE5, 0xC7, 0x8E };
+ byte[] expected = { 0x43, 0x79, 0x6E, 0xCF, 0x63, 0x68, 0xF0, 0x55, 0x43, 0x79, 0x6E, 0xCF, 0x63, 0x68, 0xF0, 0x55, 0x80, 0x64, 0x15, 0x36, 0x08, 0xD0, 0x76, 0x58 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k112b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_CBC_None ()
+{
+ byte[] key = { 0xC0, 0x04, 0xA9, 0x3C, 0x94, 0xA1, 0x78, 0xA2, 0x4B, 0x94, 0x6F, 0x19, 0xD1, 0xE1 };
+ byte[] iv = { 0x28, 0x94, 0x16, 0x28, 0x69, 0x64, 0xF6, 0x83 };
+ byte[] expected = { 0xB7, 0x2F, 0x20, 0x02, 0xAD, 0x97, 0x21, 0x45, 0xDA, 0xC2, 0x0D, 0xD9, 0xEB, 0xCC, 0xA0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_CBC_Zeros ()
+{
+ byte[] key = { 0x59, 0xFF, 0xC2, 0xB5, 0x62, 0x84, 0x27, 0x49, 0x4B, 0xFF, 0xFF, 0xCE, 0xBB, 0xBD };
+ byte[] iv = { 0x2E, 0x9E, 0xD3, 0xF6, 0xFC, 0xD7, 0xC6, 0x1C };
+ byte[] expected = { 0x38, 0xE4, 0x4D, 0xD5, 0x3F, 0x74, 0x44, 0x90, 0x11, 0xCD, 0x6E, 0x13, 0x7A, 0x9A, 0x82, 0xBB, 0xBD, 0xD1, 0x0F, 0x38, 0x0F, 0x5F, 0x97, 0x14 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0xE4, 0x49, 0xA4, 0xBE, 0x30, 0xE1, 0xB5, 0x21, 0x33, 0xC6, 0x37, 0x88, 0x30, 0xEC };
+ byte[] iv = { 0x74, 0xAC, 0x28, 0x92, 0xA5, 0xF1, 0x31, 0xC9 };
+ byte[] expected = { 0xE5, 0x7B, 0x53, 0x65, 0x37, 0xD8, 0x29, 0xBD, 0x4B, 0x73, 0x3B, 0x1B, 0x5B, 0x00, 0x04, 0xE2, 0x11, 0x5B, 0x24, 0x6F, 0x6D, 0x7F, 0x1C, 0xE8 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k112b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k112b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k112b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k112b64_CFB8_None ()
+{
+ byte[] key = { 0x70, 0x12, 0xEC, 0xAB, 0x6E, 0x1D, 0xEF, 0x51, 0xEE, 0xA8, 0x81, 0xE1, 0x21, 0xFF };
+ byte[] iv = { 0x0E, 0x56, 0xA2, 0xA3, 0x8C, 0x5D, 0x9C, 0x1F };
+ byte[] expected = { 0x71, 0x1C, 0x76, 0xB1, 0x61, 0x32, 0x77, 0xB7, 0x98, 0x42, 0x31, 0xF1, 0x0A, 0xE4, 0xC3, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x48, 0x66, 0x16, 0xD6, 0x57, 0xBF, 0x38, 0xB7, 0x22, 0x81, 0x9F, 0x75, 0xE0, 0x88 };
+ byte[] iv = { 0x51, 0x2C, 0x6A, 0x59, 0xAB, 0xD2, 0xAE, 0x6E };
+ byte[] expected = { 0xF1, 0x9E, 0x85, 0x7A, 0x7D, 0xF0, 0x39, 0x0D, 0x11, 0x47, 0x11, 0xC0, 0x1A, 0x19, 0x21, 0x85, 0x95, 0x40, 0xDA, 0x4A, 0xEE, 0x49, 0xC7, 0x54 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k112b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x55, 0x20, 0xA1, 0xD8, 0xFA, 0xE7, 0x0D, 0xF9, 0xB6, 0x4B, 0x90, 0x10, 0xDE, 0xB1 };
+ byte[] iv = { 0x26, 0x6C, 0xB0, 0xB4, 0x4D, 0x7F, 0x5C, 0x18 };
+ byte[] expected = { 0xC8, 0x00, 0x9F, 0x21, 0x2C, 0xB0, 0x75, 0x6C, 0x62, 0xD8, 0xD0, 0x30, 0x11, 0x93, 0x73, 0x2F, 0xC5, 0xBC, 0xB1, 0xED, 0x2E, 0xBE, 0xCF, 0xBC };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k112b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k112b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k112b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k112b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k112b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k120b64_ECB_None ()
+{
+ byte[] key = { 0x5D, 0x08, 0xC7, 0xB8, 0xB1, 0xEB, 0x89, 0x1C, 0xC0, 0x3F, 0xE6, 0x2F, 0xC4, 0x79, 0x11 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x76, 0x1C, 0xAC, 0x0F, 0x39, 0x6C, 0x1A, 0x44 };
+ byte[] expected = { 0xA4, 0xC1, 0x60, 0x59, 0x6B, 0x45, 0xE0, 0x4C, 0xA4, 0xC1, 0x60, 0x59, 0x6B, 0x45, 0xE0, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k120b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_ECB_Zeros ()
+{
+ byte[] key = { 0x1D, 0x13, 0x51, 0x02, 0x28, 0xF4, 0xF0, 0x13, 0x90, 0xFD, 0xE4, 0xC0, 0xE5, 0x57, 0x9A };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x9E, 0xC9, 0xA7, 0x52, 0xD2, 0x6E, 0x9B, 0xE4 };
+ byte[] expected = { 0x23, 0x58, 0x1C, 0x66, 0x7D, 0x2F, 0x71, 0x4F, 0x23, 0x58, 0x1C, 0x66, 0x7D, 0x2F, 0x71, 0x4F, 0x23, 0x58, 0x1C, 0x66, 0x7D, 0x2F, 0x71, 0x4F };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k120b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k120b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x23, 0xF2, 0xFB, 0x09, 0xC1, 0xEF, 0xC1, 0xFF, 0x16, 0xFF, 0x60, 0xC1, 0x3A, 0x94, 0x3E };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xB6, 0x10, 0xE3, 0xE9, 0x24, 0x03, 0xCA, 0xAA };
+ byte[] expected = { 0x92, 0xF3, 0xF0, 0x81, 0x13, 0x40, 0x19, 0x61, 0x92, 0xF3, 0xF0, 0x81, 0x13, 0x40, 0x19, 0x61, 0x36, 0xCC, 0xEC, 0x80, 0xF6, 0xF4, 0xCC, 0xB7 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k120b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_CBC_None ()
+{
+ byte[] key = { 0x12, 0x43, 0xEE, 0x74, 0xE8, 0x4E, 0x3A, 0xF7, 0x24, 0x58, 0x10, 0xC9, 0x41, 0x7E, 0x46 };
+ byte[] iv = { 0x7B, 0x57, 0x22, 0x19, 0xFB, 0x30, 0xED, 0x48 };
+ byte[] expected = { 0x75, 0xB0, 0x41, 0x19, 0x7F, 0x80, 0x91, 0x4A, 0xCD, 0x03, 0x41, 0x59, 0xE4, 0xC0, 0x92, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_CBC_Zeros ()
+{
+ byte[] key = { 0x2A, 0xCC, 0xFF, 0xD0, 0x46, 0xAF, 0x74, 0xB2, 0x0E, 0x64, 0xBD, 0xE9, 0x6D, 0xC5, 0xE8 };
+ byte[] iv = { 0x10, 0x21, 0xE3, 0xCB, 0x46, 0x02, 0x33, 0x4F };
+ byte[] expected = { 0x88, 0x71, 0x0D, 0x01, 0xE9, 0xD3, 0xC7, 0x3F, 0x7E, 0xCA, 0xA7, 0x9A, 0x2D, 0x95, 0xC6, 0xED, 0xDA, 0xAA, 0xE9, 0x23, 0x01, 0x70, 0x6E, 0x59 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0xE8, 0xE8, 0x44, 0x9D, 0xEA, 0x33, 0x10, 0xCB, 0xEA, 0xEF, 0x69, 0x94, 0xE4, 0x31, 0xF0 };
+ byte[] iv = { 0xC7, 0x0F, 0xE1, 0x79, 0x2B, 0x57, 0x5D, 0xA7 };
+ byte[] expected = { 0x7E, 0x1F, 0xD6, 0xCF, 0xB1, 0xAE, 0xC0, 0x2C, 0xD6, 0x02, 0x01, 0x62, 0x77, 0x95, 0x02, 0xE8, 0x8D, 0xEC, 0x8D, 0xCC, 0xB2, 0x6B, 0x92, 0x7A };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k120b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k120b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k120b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k120b64_CFB8_None ()
+{
+ byte[] key = { 0x0F, 0x0D, 0x1F, 0x09, 0xC2, 0xEA, 0xC5, 0xFE, 0xD1, 0x5A, 0x4C, 0x39, 0x2E, 0x62, 0xED };
+ byte[] iv = { 0xCA, 0x90, 0x74, 0xAD, 0x6B, 0xD5, 0x42, 0xCF };
+ byte[] expected = { 0xEB, 0xC3, 0xF4, 0x08, 0xCF, 0x11, 0x3E, 0xC4, 0x98, 0x8A, 0xAB, 0x6F, 0xEE, 0x32, 0xFC, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_CFB8_Zeros ()
+{
+ byte[] key = { 0xDA, 0xAD, 0xD7, 0xFB, 0x36, 0x64, 0x3B, 0xE8, 0x35, 0x64, 0xC8, 0xAF, 0x0D, 0xB3, 0xAC };
+ byte[] iv = { 0x6B, 0x99, 0x8D, 0xCA, 0x51, 0xD8, 0x26, 0x48 };
+ byte[] expected = { 0xDE, 0xED, 0xF4, 0xA8, 0x9D, 0x5C, 0xCE, 0x22, 0x7A, 0xD5, 0x1B, 0x3F, 0x89, 0x6E, 0x91, 0x61, 0xE1, 0x44, 0x1E, 0x5C, 0xFA, 0xC1, 0x40, 0x97 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k120b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x26, 0xA9, 0xE5, 0xE2, 0xE4, 0x48, 0xB5, 0x9F, 0xAC, 0x3E, 0x77, 0xB0, 0xEF, 0x1B, 0x00 };
+ byte[] iv = { 0x0E, 0x98, 0x7F, 0xC4, 0xAC, 0x08, 0x94, 0x03 };
+ byte[] expected = { 0xAD, 0xEC, 0xD6, 0x71, 0xDF, 0x36, 0x69, 0x80, 0xE6, 0x74, 0x79, 0xC2, 0xE0, 0xDF, 0xCF, 0xD8, 0xB4, 0x3A, 0x22, 0x6F, 0x41, 0xAD, 0x77, 0x4D };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k120b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k120b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k120b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k120b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k120b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRC2_k128b64_ECB_None ()
+{
+ byte[] key = { 0x4F, 0x02, 0xB1, 0xA6, 0x5E, 0xAE, 0xB9, 0x0C, 0x3A, 0x96, 0xFF, 0x62, 0x90, 0x9A, 0xD8, 0x1B };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xC7, 0x89, 0x19, 0x4F, 0x3C, 0xC3, 0x05, 0x83 };
+ byte[] expected = { 0xC8, 0x83, 0x4D, 0xE2, 0x6A, 0xFA, 0x75, 0x41, 0xC8, 0x83, 0x4D, 0xE2, 0x6A, 0xFA, 0x75, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k128b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_ECB_Zeros ()
+{
+ byte[] key = { 0x45, 0xBE, 0xD8, 0x8E, 0x0A, 0xE7, 0xF9, 0xE2, 0x3C, 0x33, 0xE7, 0x93, 0xD4, 0x9D, 0xAE, 0x2B };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x83, 0x27, 0x57, 0x97, 0x06, 0x4F, 0xFE, 0xB3 };
+ byte[] expected = { 0x28, 0x59, 0x45, 0xF6, 0x5E, 0x4F, 0x97, 0xF3, 0x28, 0x59, 0x45, 0xF6, 0x5E, 0x4F, 0x97, 0xF3, 0x28, 0x59, 0x45, 0xF6, 0x5E, 0x4F, 0x97, 0xF3 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k128b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("RC2_k128b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x6F, 0x04, 0x76, 0x7D, 0x88, 0x01, 0x29, 0x6A, 0xD5, 0x1E, 0x38, 0x9D, 0xED, 0x56, 0xAC, 0x9C };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x82, 0x74, 0xAC, 0xAA, 0x42, 0x29, 0x35, 0x8D };
+ byte[] expected = { 0xCB, 0xE5, 0xBB, 0xCC, 0x99, 0x8D, 0x1D, 0xA6, 0xCB, 0xE5, 0xBB, 0xCC, 0x99, 0x8D, 0x1D, 0xA6, 0x5B, 0x35, 0x28, 0xE7, 0xAC, 0xFE, 0xF0, 0xD1 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("RC2_k128b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_CBC_None ()
+{
+ byte[] key = { 0x17, 0x3F, 0x40, 0xF3, 0xDC, 0xFF, 0x8F, 0xF2, 0x71, 0x2E, 0x8B, 0x6A, 0xE0, 0x2E, 0x3F, 0x82 };
+ byte[] iv = { 0xFA, 0xB4, 0x41, 0x91, 0x34, 0xFC, 0x9B, 0x49 };
+ byte[] expected = { 0x05, 0x1B, 0x27, 0x78, 0xF0, 0x3D, 0xC4, 0x77, 0x9E, 0x59, 0x27, 0xEC, 0x2D, 0x1D, 0x7F, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_CBC_Zeros ()
+{
+ byte[] key = { 0x49, 0x89, 0x3E, 0x29, 0xCB, 0xB9, 0x06, 0x85, 0x7F, 0x8B, 0x86, 0xEB, 0xD7, 0x47, 0x91, 0x1D };
+ byte[] iv = { 0xCB, 0xA1, 0x0F, 0x53, 0x7B, 0x71, 0x04, 0x89 };
+ byte[] expected = { 0x17, 0x58, 0xD1, 0xF4, 0x1E, 0x58, 0xB0, 0x10, 0x31, 0x17, 0x40, 0x3F, 0x40, 0x22, 0x75, 0x32, 0x4F, 0xDE, 0x64, 0xE0, 0x66, 0xF4, 0xF7, 0xA0 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x22, 0x04, 0xDB, 0x15, 0xD6, 0x2E, 0xEF, 0x6D, 0x5D, 0x6A, 0xDA, 0x55, 0x67, 0x41, 0x4E, 0xFD };
+ byte[] iv = { 0xB8, 0xD1, 0xD8, 0x23, 0x00, 0x39, 0x89, 0x83 };
+ byte[] expected = { 0xC8, 0x4F, 0xCC, 0x05, 0x7F, 0x44, 0x49, 0xBE, 0x73, 0x78, 0xE8, 0x7B, 0xD9, 0xB1, 0x56, 0xC3, 0x37, 0x1E, 0xBE, 0x4D, 0x2B, 0x2F, 0xC7, 0x9E };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k128b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k128b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters RC2_k128b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestRC2_k128b64_CFB8_None ()
+{
+ byte[] key = { 0x61, 0x93, 0x31, 0x3A, 0xC2, 0x9B, 0x53, 0xB1, 0x26, 0x64, 0x36, 0x03, 0x16, 0x4A, 0xE3, 0x99 };
+ byte[] iv = { 0xDD, 0xAD, 0xA4, 0x57, 0xC1, 0x21, 0xF1, 0xA8 };
+ byte[] expected = { 0x94, 0xD9, 0x62, 0x83, 0x80, 0x4C, 0x91, 0x90, 0x63, 0x41, 0xBC, 0xBD, 0x8B, 0x7F, 0xD9, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x64, 0x09, 0x9A, 0xF0, 0xD2, 0x52, 0x8C, 0x03, 0xF3, 0xBF, 0x1B, 0x9B, 0x92, 0x0E, 0xBA, 0x33 };
+ byte[] iv = { 0x15, 0x64, 0xE4, 0xFA, 0xFA, 0x58, 0x54, 0x7B };
+ byte[] expected = { 0xC8, 0x8F, 0xCC, 0x77, 0xA3, 0x82, 0x31, 0xD4, 0x7A, 0x68, 0x05, 0x8F, 0xF2, 0x1B, 0x9E, 0xCC, 0xDA, 0x6F, 0x74, 0x1D, 0x43, 0xE0, 0x90, 0x8B };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestRC2_k128b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x1F, 0x09, 0xF8, 0x1B, 0xA9, 0xA4, 0x70, 0x8D, 0x53, 0x76, 0x19, 0x4A, 0xAA, 0x62, 0x84, 0x94 };
+ byte[] iv = { 0xCC, 0x7B, 0xBE, 0xE9, 0xEE, 0x8E, 0x9C, 0x02 };
+ byte[] expected = { 0xA7, 0x1B, 0xD5, 0x4E, 0xDB, 0xF7, 0x84, 0xC2, 0xAA, 0x89, 0xAA, 0x3C, 0x3A, 0x63, 0x8A, 0xB2, 0xEF, 0x0C, 0x5B, 0xB0, 0xF4, 0xD9, 0x0A, 0x46 };
+
+ SymmetricAlgorithm algo = RC2.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("RC2_k128b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("RC2_k128b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters RC2_k128b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k128b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters RC2_k128b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k128b128_ECB_None ()
+{
+ byte[] key = { 0xAF, 0x4D, 0xFE, 0x58, 0x33, 0xAC, 0x91, 0xB2, 0xFA, 0xA3, 0x96, 0x54, 0x0B, 0x68, 0xDD, 0xA1 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xAF, 0x70, 0xC2, 0x2E, 0x2D, 0xF1, 0x0D, 0x7F, 0x52, 0xF4, 0x65, 0x79, 0x78, 0xAC, 0x80, 0xEF };
+ byte[] expected = { 0x6D, 0xC2, 0x4A, 0x51, 0x2D, 0xAB, 0x67, 0xCB, 0xD8, 0xD4, 0xD5, 0xE6, 0x0B, 0x24, 0x02, 0x90, 0x6D, 0xC2, 0x4A, 0x51, 0x2D, 0xAB, 0x67, 0xCB, 0xD8, 0xD4, 0xD5, 0xE6, 0x0B, 0x24, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b128_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k128b128_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b128_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b128_ECB_Zeros ()
+{
+ byte[] key = { 0xA4, 0x39, 0x01, 0x00, 0xDB, 0x0A, 0x47, 0xD8, 0xD8, 0xDC, 0x01, 0xF4, 0xBE, 0x96, 0xF4, 0xBB };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xEA, 0xBD, 0x55, 0x85, 0x3F, 0xC1, 0x5F, 0xCB, 0x06, 0x26, 0x3F, 0x88, 0x6A, 0x2D, 0x69, 0x45 };
+ byte[] expected = { 0x19, 0x32, 0x7E, 0x79, 0xE3, 0xC1, 0xFE, 0xA0, 0xFD, 0x26, 0x27, 0x61, 0xC0, 0xB8, 0x06, 0xC2, 0x19, 0x32, 0x7E, 0x79, 0xE3, 0xC1, 0xFE, 0xA0, 0xFD, 0x26, 0x27, 0x61, 0xC0, 0xB8, 0x06, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k128b128_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k128b128_ECB_PKCS7 ()
+{
+ byte[] key = { 0x5C, 0x58, 0x03, 0x1D, 0x05, 0x07, 0xDE, 0x93, 0x8D, 0x85, 0xFD, 0x50, 0x68, 0xA3, 0xD7, 0x6B };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x1C, 0x32, 0xFE, 0x99, 0x95, 0x16, 0x74, 0xC0, 0x6F, 0xE6, 0x01, 0x2C, 0x1F, 0x07, 0x54, 0xE8 };
+ byte[] expected = { 0xEE, 0x1C, 0x0B, 0x2F, 0x1E, 0xCE, 0x69, 0xBC, 0xEA, 0xF6, 0xED, 0xA9, 0xF0, 0xE3, 0xE7, 0xC3, 0xEE, 0x1C, 0x0B, 0x2F, 0x1E, 0xCE, 0x69, 0xBC, 0xEA, 0xF6, 0xED, 0xA9, 0xF0, 0xE3, 0xE7, 0xC3, 0x2E, 0xB4, 0x6F, 0x8C, 0xD3, 0x37, 0xF4, 0x8E, 0x6D, 0x08, 0x35, 0x47, 0xD1, 0x1A, 0xB2, 0xA0 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b128_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k128b128_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b128_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b128_CBC_None ()
+{
+ byte[] key = { 0xED, 0xE4, 0xD9, 0x97, 0x8E, 0x5C, 0xF8, 0x86, 0xFE, 0x6B, 0xF4, 0xA7, 0x26, 0xDA, 0x70, 0x47 };
+ byte[] iv = { 0x06, 0xE1, 0xA5, 0x97, 0x7E, 0x20, 0x0C, 0x47, 0xA4, 0xAF, 0xB8, 0xF3, 0x8D, 0x2E, 0xA9, 0xAC };
+ byte[] expected = { 0xB1, 0x73, 0xDA, 0x05, 0x4C, 0x0D, 0x6C, 0x5D, 0x60, 0x72, 0x76, 0x79, 0x64, 0xA6, 0x45, 0x89, 0xA5, 0xCD, 0x35, 0x2C, 0x56, 0x12, 0x7D, 0xA6, 0x84, 0x36, 0xEB, 0xCC, 0xDF, 0x5C, 0xCB, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b128_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b128_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b128_CBC_Zeros ()
+{
+ byte[] key = { 0x7F, 0x03, 0x95, 0x4E, 0x42, 0x9E, 0x83, 0x85, 0x4B, 0x1A, 0x87, 0x36, 0xA1, 0x5B, 0xA8, 0x24 };
+ byte[] iv = { 0x75, 0x49, 0x7B, 0xBE, 0x78, 0x55, 0x5F, 0xE9, 0x67, 0xCB, 0x7E, 0x30, 0x71, 0xD1, 0x36, 0x49 };
+ byte[] expected = { 0xC8, 0xE2, 0xE5, 0x14, 0x17, 0x10, 0x14, 0xA5, 0x14, 0x8E, 0x59, 0x82, 0x7C, 0x92, 0x12, 0x91, 0x49, 0xE4, 0x24, 0x2C, 0x38, 0x98, 0x91, 0x0B, 0xD8, 0x5C, 0xD0, 0x79, 0xCD, 0x35, 0x85, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k128b128_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k128b128_CBC_PKCS7 ()
+{
+ byte[] key = { 0x02, 0xE6, 0xC1, 0xE2, 0x7E, 0x89, 0xB9, 0x04, 0xE7, 0x9A, 0xB8, 0x83, 0xA4, 0xF8, 0x1B, 0x64 };
+ byte[] iv = { 0xBC, 0xE4, 0x47, 0x1E, 0xD0, 0xDD, 0x09, 0x0D, 0xFC, 0xA1, 0x44, 0xCD, 0x88, 0x92, 0x41, 0xA5 };
+ byte[] expected = { 0xEA, 0xB3, 0x9D, 0xCC, 0xE6, 0x74, 0x22, 0xE5, 0x15, 0xEE, 0x1C, 0xA9, 0x48, 0xB9, 0x55, 0x01, 0xEA, 0x9F, 0x98, 0x8D, 0x5D, 0x59, 0xB1, 0x1C, 0xEC, 0xE5, 0x68, 0xEE, 0x86, 0x22, 0x17, 0xBA, 0x95, 0x7D, 0xEC, 0x06, 0x4B, 0x48, 0x90, 0x0E, 0x75, 0x38, 0xC0, 0x28, 0x7D, 0x72, 0x32, 0xF8 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b128_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b128_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k128b128_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b128_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b128_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b128_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b128_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b128_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b128_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b128_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b128_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k128b192_ECB_None ()
+{
+ byte[] key = { 0xA5, 0x7F, 0xA2, 0x9F, 0xDA, 0xEE, 0x56, 0x2E, 0xF9, 0x3A, 0xEE, 0x1E, 0x30, 0x46, 0x80, 0x66 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x81, 0xE8, 0x4F, 0x8A, 0xFC, 0xD0, 0x12, 0xB3, 0xF8, 0x1F, 0x30, 0xE2, 0x40, 0x90, 0xFB, 0x96, 0x88, 0xC0, 0xC8, 0xF7, 0x4A, 0x3E, 0xC0, 0x73 };
+ byte[] expected = { 0xC1, 0xC5, 0x13, 0x1B, 0x11, 0x93, 0x52, 0xE6, 0x4A, 0xA3, 0xF8, 0xE7, 0x28, 0xDE, 0x02, 0x9A, 0x5D, 0x2B, 0x14, 0x6A, 0x5D, 0x0F, 0x24, 0x8F, 0xC1, 0xC5, 0x13, 0x1B, 0x11, 0x93, 0x52, 0xE6, 0x4A, 0xA3, 0xF8, 0xE7, 0x28, 0xDE, 0x02, 0x9A, 0x5D, 0x2B, 0x14, 0x6A, 0x5D, 0x0F, 0x24, 0x8F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b192_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k128b192_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b192_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b192_ECB_Zeros ()
+{
+ byte[] key = { 0xDF, 0x1B, 0x73, 0xA3, 0xE3, 0x53, 0x75, 0x92, 0x2B, 0xD0, 0x44, 0x35, 0x94, 0xF5, 0xB2, 0xE7 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x21, 0x82, 0x61, 0x4A, 0x57, 0xC0, 0x7D, 0x96, 0xFF, 0xC2, 0x08, 0xC1, 0x6C, 0xDF, 0x7C, 0x65, 0xC1, 0x8B, 0xFE, 0x5E, 0xD5, 0x82, 0xAD, 0x98 };
+ byte[] expected = { 0xC9, 0x4E, 0xE0, 0x8F, 0x95, 0x55, 0x52, 0x1A, 0x75, 0xA9, 0x92, 0x1D, 0xFA, 0x30, 0xBD, 0xB8, 0x55, 0xA7, 0x8B, 0xF9, 0x58, 0xE9, 0x1B, 0x4C, 0xC9, 0x4E, 0xE0, 0x8F, 0x95, 0x55, 0x52, 0x1A, 0x75, 0xA9, 0x92, 0x1D, 0xFA, 0x30, 0xBD, 0xB8, 0x55, 0xA7, 0x8B, 0xF9, 0x58, 0xE9, 0x1B, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k128b192_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k128b192_ECB_PKCS7 ()
+{
+ byte[] key = { 0x78, 0x75, 0x1F, 0xE7, 0xFA, 0x1F, 0xF4, 0x2D, 0x31, 0x36, 0x14, 0xA5, 0xB8, 0x31, 0x97, 0x47 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x91, 0x2F, 0xDC, 0x19, 0xC7, 0x6C, 0x67, 0x4A, 0x51, 0xE7, 0x08, 0xA5, 0xF9, 0xC6, 0xC3, 0x56, 0xF2, 0xED, 0xBD, 0xC9, 0x71, 0x9F, 0x02, 0xAF };
+ byte[] expected = { 0xB1, 0x0D, 0xFD, 0xB0, 0x89, 0x3C, 0xF5, 0x52, 0x62, 0x22, 0x41, 0x20, 0xE4, 0x34, 0x03, 0x78, 0x37, 0xC2, 0xB1, 0xF9, 0x26, 0x0A, 0x7F, 0x0E, 0xB1, 0x0D, 0xFD, 0xB0, 0x89, 0x3C, 0xF5, 0x52, 0x62, 0x22, 0x41, 0x20, 0xE4, 0x34, 0x03, 0x78, 0x37, 0xC2, 0xB1, 0xF9, 0x26, 0x0A, 0x7F, 0x0E, 0xF9, 0x7A, 0x2D, 0xF9, 0x5C, 0xD5, 0xEA, 0x06, 0x18, 0xC9, 0x06, 0xD4, 0xD0, 0x0B, 0xD6, 0x19, 0x4E, 0x7E, 0x9C, 0x5F, 0xDE, 0x3D, 0xB4, 0x2A };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b192_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k128b192_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b192_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b192_CBC_None ()
+{
+ byte[] key = { 0xBD, 0x01, 0x0F, 0x53, 0x53, 0x14, 0x90, 0x58, 0x22, 0x81, 0x6F, 0x79, 0x8C, 0x68, 0x21, 0x21 };
+ byte[] iv = { 0xEE, 0x7B, 0xC0, 0x5F, 0x32, 0x59, 0x56, 0xB6, 0x7C, 0x17, 0x04, 0xC5, 0x64, 0x6A, 0xA1, 0x35, 0x6F, 0xAC, 0xB8, 0xCE, 0xFA, 0xCC, 0x76, 0xBE };
+ byte[] expected = { 0x5D, 0xF5, 0x03, 0xD7, 0x17, 0xEE, 0x05, 0x18, 0x63, 0x99, 0xAB, 0x58, 0xBB, 0xC0, 0x04, 0x0A, 0x52, 0x1D, 0x4E, 0xA4, 0x8B, 0x68, 0xA3, 0x63, 0x7A, 0xBD, 0xAF, 0x0C, 0x85, 0x5D, 0xF8, 0x0D, 0x7A, 0x01, 0xF0, 0x76, 0x24, 0xF1, 0x8A, 0x95, 0x8B, 0xB2, 0xC0, 0xF7, 0x1D, 0xC5, 0x0E, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b192_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b192_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b192_CBC_Zeros ()
+{
+ byte[] key = { 0xE2, 0x9C, 0x2A, 0xAA, 0xD0, 0x02, 0xDD, 0xDF, 0xFE, 0xD7, 0xB0, 0x21, 0x1E, 0x52, 0xE5, 0x25 };
+ byte[] iv = { 0xED, 0xF5, 0xD7, 0xF7, 0x8D, 0xB6, 0x91, 0x00, 0x81, 0x88, 0x75, 0x8C, 0x61, 0x13, 0x84, 0x46, 0x2A, 0x53, 0x02, 0xE9, 0xBB, 0x01, 0xF8, 0x24 };
+ byte[] expected = { 0x55, 0x48, 0x90, 0x63, 0x5B, 0x93, 0x09, 0xA7, 0xF7, 0xB2, 0xC0, 0x4D, 0xB1, 0x1A, 0xF7, 0xC7, 0xF7, 0xC0, 0xB6, 0x29, 0x7A, 0x50, 0x4E, 0x52, 0x2F, 0x68, 0x49, 0x92, 0x80, 0x0D, 0xBD, 0x89, 0x34, 0x84, 0x60, 0x87, 0x2C, 0x50, 0x65, 0xFF, 0xAE, 0x0E, 0x7B, 0x30, 0x3D, 0xFA, 0x93, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k128b192_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k128b192_CBC_PKCS7 ()
+{
+ byte[] key = { 0x14, 0x6C, 0x36, 0x5E, 0x22, 0xE9, 0x25, 0x1E, 0xC9, 0x1F, 0xA7, 0xC9, 0xA5, 0x19, 0x2C, 0x09 };
+ byte[] iv = { 0xE2, 0x6F, 0xA7, 0xDC, 0x36, 0x32, 0xF7, 0x28, 0x8B, 0x09, 0x78, 0xB9, 0x30, 0x6A, 0x3F, 0xD0, 0xA8, 0x5E, 0x1F, 0x7D, 0x8F, 0xDE, 0x5B, 0xA4 };
+ byte[] expected = { 0x9D, 0x08, 0xFD, 0xDE, 0x64, 0x97, 0x1D, 0x88, 0xB4, 0xCD, 0x70, 0xDD, 0xCC, 0x95, 0x1C, 0xAE, 0x01, 0x4B, 0x14, 0x19, 0x69, 0x58, 0xCE, 0x14, 0xA6, 0xF6, 0xD0, 0x25, 0xCE, 0xD6, 0xBB, 0xD5, 0x8C, 0xF6, 0xBF, 0x54, 0x66, 0x1D, 0xAE, 0x03, 0x6C, 0x81, 0xBF, 0xC6, 0x06, 0xB3, 0x64, 0x39, 0x73, 0x0A, 0x54, 0xB8, 0x3F, 0x3D, 0x1D, 0xFA, 0xB8, 0xBB, 0x53, 0x34, 0xEC, 0x69, 0xBD, 0xC3, 0xC1, 0xB2, 0x8D, 0x7D, 0x08, 0xE4, 0xFA, 0x82 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b192_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b192_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k128b192_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b192_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b192_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b192_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b192_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b192_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b192_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b192_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b192_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k128b256_ECB_None ()
+{
+ byte[] key = { 0xD5, 0xB9, 0x92, 0x27, 0xC0, 0xBB, 0x86, 0x06, 0x19, 0xD9, 0xA4, 0x1B, 0x9E, 0x7A, 0xF0, 0x3D };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x3C, 0x72, 0xD4, 0xBA, 0xC8, 0xCA, 0xAD, 0x8B, 0x94, 0x00, 0xF3, 0x4E, 0xE9, 0xAC, 0xFB, 0x15, 0xA2, 0x06, 0xFE, 0xA3, 0x33, 0x18, 0x48, 0x55, 0xD5, 0x6B, 0x8F, 0x13, 0xEF, 0xB6, 0x34, 0xF8 };
+ byte[] expected = { 0x9A, 0x86, 0x3A, 0xE6, 0x23, 0x50, 0x4D, 0xBD, 0x4B, 0xD3, 0x1A, 0xDE, 0x83, 0x13, 0x4A, 0x82, 0xEF, 0x99, 0x7D, 0x19, 0xB0, 0x01, 0x4E, 0x46, 0x4B, 0xCF, 0x99, 0x66, 0x10, 0x23, 0x6E, 0x6C, 0x9A, 0x86, 0x3A, 0xE6, 0x23, 0x50, 0x4D, 0xBD, 0x4B, 0xD3, 0x1A, 0xDE, 0x83, 0x13, 0x4A, 0x82, 0xEF, 0x99, 0x7D, 0x19, 0xB0, 0x01, 0x4E, 0x46, 0x4B, 0xCF, 0x99, 0x66, 0x10, 0x23, 0x6E, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b256_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k128b256_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b256_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b256_ECB_Zeros ()
+{
+ byte[] key = { 0x3C, 0xA6, 0xD7, 0xDA, 0xE3, 0x4D, 0x32, 0x67, 0xA8, 0xF5, 0xFF, 0xFF, 0xEE, 0xE8, 0xD4, 0xB2 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xC8, 0x0A, 0x40, 0x30, 0x7C, 0x7E, 0x75, 0xDE, 0x71, 0x64, 0x59, 0xCE, 0x03, 0x40, 0x8F, 0x50, 0xC7, 0x5E, 0xA2, 0x27, 0x5F, 0x12, 0x57, 0xF4, 0xB7, 0xAD, 0x95, 0xAD, 0x95, 0x84, 0xBE, 0x3C };
+ byte[] expected = { 0x6D, 0x57, 0xCA, 0xED, 0x29, 0xBA, 0xA6, 0x3A, 0x3D, 0x02, 0xE1, 0x21, 0x39, 0xB0, 0x34, 0x41, 0xFC, 0xAC, 0x55, 0x8C, 0x61, 0xAE, 0x18, 0x7D, 0x7A, 0x41, 0x81, 0x1C, 0x53, 0x5F, 0x3D, 0xB1, 0x6D, 0x57, 0xCA, 0xED, 0x29, 0xBA, 0xA6, 0x3A, 0x3D, 0x02, 0xE1, 0x21, 0x39, 0xB0, 0x34, 0x41, 0xFC, 0xAC, 0x55, 0x8C, 0x61, 0xAE, 0x18, 0x7D, 0x7A, 0x41, 0x81, 0x1C, 0x53, 0x5F, 0x3D, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k128b256_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k128b256_ECB_PKCS7 ()
+{
+ byte[] key = { 0xED, 0xBA, 0x84, 0x92, 0x50, 0x93, 0x9B, 0xE4, 0xC4, 0x83, 0x31, 0x8E, 0x11, 0x86, 0xAE, 0xC9 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x43, 0x98, 0x73, 0xFE, 0x77, 0x4D, 0x75, 0x79, 0xC7, 0xEF, 0x5C, 0x89, 0xFA, 0x5E, 0x07, 0x85, 0x0B, 0x21, 0x59, 0x8B, 0x8A, 0x1D, 0x11, 0x07, 0xA0, 0xC4, 0x3E, 0x11, 0x7F, 0x5D, 0xFE, 0xEE };
+ byte[] expected = { 0xA0, 0x56, 0xD6, 0x6B, 0x48, 0x77, 0xCC, 0x51, 0x0F, 0x04, 0x58, 0x16, 0x46, 0x04, 0x36, 0x66, 0xBB, 0x4D, 0x88, 0x71, 0xFF, 0x65, 0x0B, 0xFD, 0x52, 0x8D, 0xE8, 0xAF, 0x97, 0x78, 0xBD, 0x82, 0xA0, 0x56, 0xD6, 0x6B, 0x48, 0x77, 0xCC, 0x51, 0x0F, 0x04, 0x58, 0x16, 0x46, 0x04, 0x36, 0x66, 0xBB, 0x4D, 0x88, 0x71, 0xFF, 0x65, 0x0B, 0xFD, 0x52, 0x8D, 0xE8, 0xAF, 0x97, 0x78, 0xBD, 0x82, 0x66, 0x2C, 0x2B, 0x59, 0xC8, 0x47, 0x3E, 0xE0, 0xC4, 0xA5, 0x22, 0x79, 0x6C, 0xCF, 0x18, 0x10, 0xDA, 0xB5, 0xE9, 0xB1, 0x21, 0xCA, 0xCC, 0xD6, 0xF7, 0xDC, 0xA5, 0xD4, 0x29, 0x10, 0x8A, 0xA4 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b256_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k128b256_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b256_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b256_CBC_None ()
+{
+ byte[] key = { 0x23, 0x09, 0x30, 0xC7, 0x01, 0x81, 0x1D, 0x2E, 0xD6, 0x6A, 0xC9, 0x99, 0x0D, 0x3D, 0x99, 0x79 };
+ byte[] iv = { 0x24, 0x2B, 0xCF, 0xFF, 0x81, 0x8C, 0xBE, 0x55, 0x1D, 0x8A, 0xDA, 0xF8, 0x81, 0xA7, 0x5A, 0xD1, 0xA6, 0x88, 0xC6, 0x90, 0xC4, 0x33, 0xCD, 0x37, 0x11, 0xCC, 0x64, 0x42, 0xD8, 0x2C, 0xA6, 0xE0 };
+ byte[] expected = { 0xEF, 0xA5, 0xAB, 0xDB, 0x71, 0xE3, 0x9A, 0x33, 0x45, 0x74, 0xB7, 0x90, 0xED, 0xD8, 0xDE, 0x33, 0x56, 0xEA, 0x75, 0xE0, 0x42, 0x51, 0xAD, 0xEE, 0x9C, 0x74, 0xC8, 0x6B, 0x99, 0x88, 0xD2, 0x13, 0xB2, 0x80, 0x5E, 0xB3, 0xDC, 0xE3, 0x49, 0x43, 0x86, 0x10, 0xC7, 0xCC, 0xE2, 0xE8, 0xCD, 0x79, 0x5C, 0x69, 0x19, 0xD0, 0xE2, 0x70, 0xB1, 0x25, 0x21, 0xB5, 0xC0, 0x69, 0xAB, 0x3D, 0x25, 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b256_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b256_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k128b256_CBC_Zeros ()
+{
+ byte[] key = { 0xB6, 0xE5, 0xA0, 0x6F, 0x35, 0xA9, 0x25, 0x31, 0x5B, 0x8C, 0x52, 0x87, 0x26, 0x80, 0xB1, 0x42 };
+ byte[] iv = { 0xFD, 0x8E, 0xD8, 0x17, 0xEB, 0x9F, 0xC6, 0x5B, 0xD7, 0x42, 0xF4, 0x79, 0x68, 0x38, 0xEE, 0xC6, 0x15, 0x83, 0xFF, 0x18, 0xA5, 0x24, 0x80, 0x65, 0xCE, 0xF3, 0xED, 0xA8, 0x0E, 0x60, 0xB4, 0xA0 };
+ byte[] expected = { 0xC6, 0x0C, 0xE3, 0x6A, 0x8A, 0x98, 0xC2, 0xF7, 0x77, 0x59, 0x2C, 0x77, 0x88, 0x3F, 0xCE, 0x12, 0xFB, 0xFB, 0xB0, 0x20, 0xE5, 0xBC, 0xDB, 0x30, 0xE8, 0x1C, 0x19, 0xEA, 0x4C, 0x3A, 0x2E, 0xAF, 0x57, 0x4B, 0x05, 0xE8, 0xD4, 0xC9, 0xB2, 0xC4, 0x00, 0x35, 0xE0, 0x57, 0x7D, 0xAF, 0x11, 0xB4, 0xB2, 0x84, 0xCD, 0x7F, 0x6C, 0x6E, 0xD0, 0xDA, 0x58, 0x90, 0xF6, 0x9A, 0x51, 0x2C, 0x74, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k128b256_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k128b256_CBC_PKCS7 ()
+{
+ byte[] key = { 0xAE, 0x7A, 0xD9, 0x55, 0xBF, 0x55, 0xB2, 0x40, 0x4A, 0x48, 0x5F, 0x06, 0xAA, 0x04, 0x45, 0x0A };
+ byte[] iv = { 0xB9, 0xD7, 0xC5, 0x09, 0x93, 0xED, 0x68, 0xC4, 0x5A, 0x82, 0x8F, 0xBD, 0x2F, 0xB4, 0x3B, 0x84, 0xBA, 0xE4, 0x46, 0x51, 0xAD, 0xAB, 0xA5, 0xCC, 0xB7, 0x59, 0x31, 0x9E, 0xBB, 0xFA, 0x54, 0x10 };
+ byte[] expected = { 0xAC, 0xD7, 0x42, 0x01, 0x60, 0x36, 0xD3, 0xE1, 0xAE, 0x60, 0xC1, 0x5E, 0xAD, 0x4E, 0x81, 0xE1, 0x65, 0xFB, 0xF0, 0x06, 0x89, 0xC5, 0xAD, 0x71, 0x62, 0x81, 0x41, 0xC7, 0xC7, 0xC2, 0xAA, 0x1E, 0x76, 0x88, 0x41, 0x23, 0xFB, 0xFF, 0x44, 0x01, 0xA4, 0xB9, 0x61, 0xC0, 0x1B, 0x54, 0x09, 0x45, 0x1C, 0x17, 0xE3, 0x0A, 0x4A, 0x0A, 0xC5, 0x6F, 0x77, 0xB0, 0xDB, 0xE1, 0xD4, 0xCD, 0x28, 0xD6, 0xA6, 0x40, 0x8F, 0x2B, 0x49, 0x2C, 0xDF, 0x4D, 0x6D, 0x78, 0x24, 0x65, 0x37, 0x61, 0x05, 0xCD, 0xBC, 0x15, 0x37, 0x67, 0x65, 0xEF, 0xCB, 0x8A, 0xEE, 0x53, 0x9D, 0x29, 0x62, 0x73, 0x51, 0xD2 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k128b256_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k128b256_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k128b256_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b256_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b256_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k128b256_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b256_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b256_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b256_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b256_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k128b256_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k192b128_ECB_None ()
+{
+ byte[] key = { 0xA4, 0x51, 0x15, 0x32, 0xE7, 0xFC, 0x6F, 0x22, 0x73, 0x72, 0xB0, 0xAD, 0x67, 0x4C, 0x84, 0xB4, 0xB2, 0xAF, 0x50, 0x74, 0x5A, 0x4D, 0xB7, 0x2A };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x83, 0x22, 0x1B, 0x6C, 0x66, 0x1F, 0x4A, 0xB7, 0x55, 0xAF, 0x5B, 0xBF, 0x4A, 0x05, 0x73, 0x24 };
+ byte[] expected = { 0x6A, 0x1D, 0xA5, 0xBE, 0x7F, 0x6C, 0x0A, 0x98, 0x2A, 0x09, 0x4B, 0x70, 0xC1, 0xA1, 0xBC, 0x75, 0x6A, 0x1D, 0xA5, 0xBE, 0x7F, 0x6C, 0x0A, 0x98, 0x2A, 0x09, 0x4B, 0x70, 0xC1, 0xA1, 0xBC, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b128_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k192b128_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b128_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b128_ECB_Zeros ()
+{
+ byte[] key = { 0xB4, 0x65, 0x79, 0x30, 0x92, 0x6A, 0xEC, 0x78, 0xBA, 0x9B, 0x8B, 0x36, 0x7C, 0x8F, 0x6B, 0x8A, 0x79, 0x7F, 0x8A, 0xDA, 0xB4, 0x06, 0x23, 0x4C };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x43, 0xBA, 0x1C, 0xFB, 0x33, 0xB4, 0x3B, 0x38, 0x5C, 0x21, 0x13, 0xDD, 0x9A, 0x3A, 0xF1, 0xEE };
+ byte[] expected = { 0xB1, 0x45, 0x70, 0xFC, 0xB5, 0x82, 0x49, 0x9F, 0xEA, 0x50, 0x0C, 0xEA, 0xFD, 0x13, 0xA8, 0xE8, 0xB1, 0x45, 0x70, 0xFC, 0xB5, 0x82, 0x49, 0x9F, 0xEA, 0x50, 0x0C, 0xEA, 0xFD, 0x13, 0xA8, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k192b128_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k192b128_ECB_PKCS7 ()
+{
+ byte[] key = { 0x06, 0xC3, 0x07, 0x6A, 0x36, 0xE5, 0xF3, 0xCF, 0x33, 0x87, 0x22, 0x03, 0x5A, 0xFA, 0x4F, 0x25, 0x9D, 0xE4, 0x81, 0xA4, 0x9E, 0xB4, 0x5D, 0x84 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xB0, 0xF9, 0x9F, 0x2D, 0x8D, 0xD0, 0x2D, 0xA1, 0x51, 0xDB, 0x07, 0xA3, 0x34, 0x28, 0x4F, 0x25 };
+ byte[] expected = { 0xE9, 0xB9, 0xE5, 0x89, 0x0E, 0xF7, 0x3C, 0xCF, 0x63, 0x6B, 0xCD, 0x33, 0x85, 0x81, 0x02, 0x75, 0xE9, 0xB9, 0xE5, 0x89, 0x0E, 0xF7, 0x3C, 0xCF, 0x63, 0x6B, 0xCD, 0x33, 0x85, 0x81, 0x02, 0x75, 0xE8, 0x31, 0x03, 0x87, 0xFF, 0x9D, 0x7A, 0xAB, 0x81, 0x82, 0x63, 0x6B, 0xAA, 0x6F, 0x20, 0x21 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b128_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k192b128_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b128_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b128_CBC_None ()
+{
+ byte[] key = { 0x8F, 0x85, 0x39, 0xC2, 0xAC, 0x25, 0xBD, 0x54, 0xDE, 0x89, 0x2A, 0x67, 0x2C, 0xF0, 0xE5, 0x7E, 0xAA, 0x7E, 0xC4, 0xFB, 0xCD, 0x31, 0xD9, 0xFA };
+ byte[] iv = { 0xCA, 0xC4, 0x8D, 0x38, 0x28, 0x29, 0xC2, 0xBF, 0xD8, 0x7A, 0xCA, 0x56, 0xBF, 0x59, 0x6B, 0xCE };
+ byte[] expected = { 0x22, 0x66, 0xB0, 0x6C, 0xC1, 0x18, 0xBB, 0x43, 0x6B, 0xB9, 0x42, 0x16, 0x4D, 0xFB, 0x96, 0x7C, 0xEC, 0xCA, 0xB8, 0x09, 0x02, 0x8C, 0x2E, 0x4D, 0x4D, 0x90, 0x03, 0xEA, 0x0F, 0x69, 0x20, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b128_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b128_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b128_CBC_Zeros ()
+{
+ byte[] key = { 0xA7, 0x3E, 0xEE, 0x4B, 0xF5, 0x0E, 0x05, 0x03, 0xE2, 0x50, 0xF1, 0xBC, 0xEB, 0x57, 0x60, 0x79, 0x83, 0x5D, 0xFC, 0x42, 0x65, 0x41, 0xCF, 0x48 };
+ byte[] iv = { 0xC9, 0x76, 0xCE, 0x21, 0xDF, 0x46, 0xB0, 0x23, 0x19, 0xB6, 0xD5, 0x80, 0x1F, 0xBA, 0x15, 0xDB };
+ byte[] expected = { 0x63, 0xED, 0x15, 0xBE, 0xB9, 0x4E, 0x9E, 0x30, 0xB1, 0xC5, 0x31, 0xCB, 0x02, 0x88, 0xB4, 0x8F, 0xF5, 0xB0, 0x53, 0x8D, 0xD1, 0x35, 0xB7, 0x85, 0xED, 0x02, 0x79, 0x03, 0xC1, 0x13, 0xCE, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k192b128_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k192b128_CBC_PKCS7 ()
+{
+ byte[] key = { 0x0F, 0x00, 0x54, 0xCD, 0x2A, 0x66, 0x21, 0xF0, 0x74, 0x64, 0x65, 0xC6, 0xE1, 0xC6, 0xCD, 0x11, 0x05, 0x04, 0xA7, 0x23, 0x48, 0x4E, 0xB3, 0x84 };
+ byte[] iv = { 0xDA, 0xE6, 0x7F, 0x27, 0x8A, 0xE6, 0x8E, 0x13, 0x9D, 0x15, 0x0D, 0x80, 0x4B, 0xC4, 0x9F, 0x08 };
+ byte[] expected = { 0x0D, 0x7E, 0x32, 0xE0, 0xFA, 0x25, 0xB1, 0x52, 0x37, 0x27, 0xF3, 0x99, 0xA7, 0x08, 0x7F, 0x8E, 0xAA, 0x98, 0x36, 0x42, 0x21, 0xCF, 0x3B, 0xF1, 0x95, 0x99, 0xF4, 0x00, 0x36, 0x47, 0x0F, 0x25, 0x43, 0x36, 0x43, 0x68, 0x40, 0xB1, 0x1A, 0xFA, 0xDC, 0x43, 0x94, 0xD7, 0x16, 0x28, 0xFD, 0xDD };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b128_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b128_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k192b128_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b128_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b128_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b128_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b128_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b128_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b128_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b128_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b128_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k192b192_ECB_None ()
+{
+ byte[] key = { 0x33, 0x09, 0x20, 0xF4, 0x69, 0x76, 0x98, 0x57, 0x93, 0x1A, 0x37, 0x31, 0xFA, 0x2D, 0x49, 0xEA, 0xE4, 0xD4, 0x6C, 0xA5, 0x91, 0x2A, 0xD8, 0x54 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x7F, 0x2E, 0xE0, 0x80, 0x52, 0x2F, 0x63, 0x3F, 0x8F, 0x09, 0x85, 0x3D, 0x21, 0x73, 0x40, 0x45, 0xB0, 0x85, 0xDE, 0xB9, 0xC0, 0xA1, 0x06, 0xB2 };
+ byte[] expected = { 0x93, 0x0B, 0xF0, 0xA0, 0x0C, 0x79, 0x99, 0x40, 0x17, 0x62, 0xD6, 0xD8, 0x1C, 0x3B, 0xB3, 0x18, 0x57, 0xA6, 0x01, 0x68, 0xEA, 0x73, 0x9A, 0x0A, 0x93, 0x0B, 0xF0, 0xA0, 0x0C, 0x79, 0x99, 0x40, 0x17, 0x62, 0xD6, 0xD8, 0x1C, 0x3B, 0xB3, 0x18, 0x57, 0xA6, 0x01, 0x68, 0xEA, 0x73, 0x9A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b192_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k192b192_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b192_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b192_ECB_Zeros ()
+{
+ byte[] key = { 0xB5, 0x06, 0x72, 0x5F, 0x4E, 0x37, 0x62, 0x8F, 0x68, 0xE5, 0x0A, 0x80, 0xC6, 0x39, 0xB9, 0x13, 0xC7, 0xD8, 0x74, 0x1F, 0xE8, 0xD1, 0x99, 0x9E };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x11, 0x49, 0xA6, 0x58, 0x8F, 0xF1, 0x8E, 0xB3, 0x19, 0x81, 0xFE, 0xB8, 0x09, 0x69, 0x3D, 0x01, 0x21, 0x08, 0xCD, 0x1D, 0xEB, 0x98, 0xA7, 0xF1 };
+ byte[] expected = { 0x42, 0xD5, 0xF0, 0x37, 0xFF, 0xBB, 0x81, 0xC1, 0x6F, 0x12, 0xCF, 0x65, 0x29, 0xC5, 0x88, 0xBE, 0x08, 0x88, 0xBF, 0x6F, 0xDF, 0x23, 0x82, 0x5E, 0x42, 0xD5, 0xF0, 0x37, 0xFF, 0xBB, 0x81, 0xC1, 0x6F, 0x12, 0xCF, 0x65, 0x29, 0xC5, 0x88, 0xBE, 0x08, 0x88, 0xBF, 0x6F, 0xDF, 0x23, 0x82, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k192b192_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k192b192_ECB_PKCS7 ()
+{
+ byte[] key = { 0x40, 0xE3, 0xF1, 0x90, 0xC2, 0xA9, 0x59, 0xB8, 0x01, 0x72, 0x01, 0x1F, 0x10, 0x11, 0x0E, 0x8F, 0xA1, 0xF2, 0x62, 0xD7, 0x0A, 0x65, 0xCD, 0xC4 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x06, 0x08, 0x07, 0xB3, 0x8F, 0x84, 0xD9, 0xB3, 0xF9, 0x11, 0xFC, 0x0B, 0x9C, 0xC4, 0x6E, 0x41, 0xE1, 0xCC, 0x6F, 0x26, 0x6D, 0x70, 0xC6, 0x47 };
+ byte[] expected = { 0xCD, 0x70, 0x93, 0x83, 0x82, 0xB1, 0xA3, 0x74, 0x8A, 0xBD, 0x0C, 0x0D, 0x8B, 0x9F, 0x3C, 0xDF, 0xBC, 0x8E, 0x64, 0x6E, 0xF7, 0xF5, 0x10, 0x0E, 0xCD, 0x70, 0x93, 0x83, 0x82, 0xB1, 0xA3, 0x74, 0x8A, 0xBD, 0x0C, 0x0D, 0x8B, 0x9F, 0x3C, 0xDF, 0xBC, 0x8E, 0x64, 0x6E, 0xF7, 0xF5, 0x10, 0x0E, 0x2D, 0xB2, 0xBD, 0xA1, 0x21, 0x56, 0xD1, 0x33, 0x00, 0x1C, 0x71, 0xAF, 0x9A, 0x48, 0x24, 0x00, 0xED, 0xA1, 0xE4, 0x2B, 0xF4, 0xF3, 0xD2, 0x5F };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b192_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k192b192_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b192_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b192_CBC_None ()
+{
+ byte[] key = { 0x21, 0x15, 0x8D, 0x66, 0x7D, 0x81, 0xD6, 0xBD, 0xFF, 0x6D, 0x3F, 0x44, 0x43, 0x0E, 0xD7, 0x07, 0xC9, 0x5F, 0xFF, 0x0A, 0x88, 0x2D, 0xC1, 0xC4 };
+ byte[] iv = { 0x43, 0x68, 0xF9, 0x7E, 0xD4, 0x6D, 0xB9, 0xA7, 0x9D, 0xFF, 0x68, 0x7F, 0x4F, 0xBB, 0x14, 0x4D, 0x29, 0x4F, 0x94, 0x8A, 0x83, 0x02, 0x77, 0x1E };
+ byte[] expected = { 0x13, 0xD5, 0x9A, 0x4A, 0x96, 0x7E, 0x4F, 0x67, 0x12, 0x31, 0x9B, 0xF5, 0xC5, 0x5A, 0x81, 0xC2, 0x43, 0x51, 0x57, 0x6D, 0xA2, 0xFC, 0x5F, 0x00, 0x49, 0x5A, 0x4E, 0x82, 0x3C, 0xE0, 0x7A, 0x89, 0x2F, 0x36, 0xB3, 0x84, 0x6E, 0x9B, 0x9A, 0xAA, 0x48, 0x1B, 0x0D, 0xA1, 0x42, 0xAD, 0x6F, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b192_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b192_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b192_CBC_Zeros ()
+{
+ byte[] key = { 0x81, 0x6F, 0xD7, 0x01, 0xCF, 0x7E, 0x73, 0x8E, 0x18, 0xB7, 0x91, 0x85, 0x70, 0x3B, 0x87, 0xCE, 0xA7, 0xB5, 0xB9, 0xFA, 0x30, 0x3D, 0x26, 0x28 };
+ byte[] iv = { 0x5B, 0x34, 0x00, 0xA3, 0x3F, 0xEA, 0x2C, 0xAF, 0x87, 0xA3, 0xB9, 0x15, 0xF8, 0x61, 0x4A, 0x5C, 0x23, 0x2A, 0xF3, 0xA6, 0x7B, 0xFB, 0xEA, 0x1E };
+ byte[] expected = { 0xF4, 0x87, 0x7B, 0xC8, 0x41, 0x2C, 0x8E, 0x2C, 0x58, 0x50, 0x6E, 0xE5, 0x79, 0xD1, 0xE8, 0x54, 0xE2, 0x13, 0x55, 0x91, 0x60, 0xF0, 0x35, 0x2D, 0xDB, 0x3A, 0x69, 0x92, 0x3B, 0xD1, 0x6D, 0x89, 0x57, 0x17, 0x2F, 0x31, 0xA1, 0xD9, 0xB1, 0x00, 0x41, 0x54, 0x0C, 0xFC, 0xA4, 0xE0, 0x7F, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k192b192_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k192b192_CBC_PKCS7 ()
+{
+ byte[] key = { 0xF4, 0x68, 0x87, 0x59, 0x32, 0x8D, 0x10, 0xA8, 0xC1, 0x32, 0xD0, 0xEC, 0xE5, 0x4A, 0x8A, 0x11, 0x3E, 0x8E, 0x11, 0x48, 0x88, 0xE9, 0xC1, 0x1A };
+ byte[] iv = { 0x72, 0xD8, 0x59, 0x64, 0xD0, 0x23, 0x1E, 0x6F, 0xF9, 0x16, 0x98, 0x61, 0x09, 0xE1, 0x33, 0xE2, 0x62, 0xB7, 0x9D, 0xD2, 0xCD, 0x5B, 0x47, 0xD8 };
+ byte[] expected = { 0x0B, 0x3C, 0xDD, 0x1F, 0xCA, 0x36, 0x1C, 0x44, 0x0D, 0xC6, 0xC9, 0xF8, 0xE9, 0x96, 0x33, 0x52, 0x89, 0x66, 0x73, 0x9C, 0x43, 0x27, 0x76, 0xE4, 0x84, 0x4F, 0xEF, 0x68, 0x04, 0x83, 0x68, 0x1A, 0x08, 0xA5, 0x6C, 0x22, 0x83, 0x64, 0xD5, 0x9E, 0x58, 0x00, 0x5F, 0xEB, 0x6A, 0xEF, 0x36, 0xDD, 0xD4, 0xF4, 0x21, 0x9F, 0xAB, 0x87, 0xB3, 0xD0, 0x29, 0x04, 0x19, 0x14, 0xD1, 0xD1, 0x66, 0x37, 0x54, 0xBC, 0x40, 0x43, 0xF6, 0xF1, 0x8A, 0x67 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b192_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b192_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k192b192_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b192_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b192_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b192_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b192_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b192_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b192_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b192_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b192_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k192b256_ECB_None ()
+{
+ byte[] key = { 0x07, 0xD5, 0xDE, 0x67, 0xAA, 0x99, 0x89, 0x35, 0x41, 0xAA, 0x04, 0x7B, 0xBB, 0x25, 0x91, 0x88, 0xDA, 0xA9, 0x5F, 0xD6, 0x05, 0xA4, 0xF4, 0x7B };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x21, 0x43, 0xAF, 0xF7, 0x20, 0x60, 0x95, 0x40, 0x42, 0x57, 0x2E, 0x1D, 0xAC, 0x95, 0x39, 0x71, 0x88, 0xDA, 0xC2, 0x22, 0xF4, 0xEA, 0xC8, 0x6F, 0x3B, 0x73, 0xBC, 0xA5, 0xC9, 0x56, 0x2B, 0x38 };
+ byte[] expected = { 0xDA, 0xB8, 0xB7, 0xA7, 0x7D, 0x50, 0x08, 0x6A, 0x57, 0x3C, 0x1E, 0xA4, 0xED, 0xDD, 0x3F, 0x93, 0x99, 0x7E, 0xFC, 0x06, 0x3A, 0x9E, 0xAC, 0x82, 0x16, 0xCA, 0xE5, 0x79, 0x2C, 0xA1, 0xAC, 0x5D, 0xDA, 0xB8, 0xB7, 0xA7, 0x7D, 0x50, 0x08, 0x6A, 0x57, 0x3C, 0x1E, 0xA4, 0xED, 0xDD, 0x3F, 0x93, 0x99, 0x7E, 0xFC, 0x06, 0x3A, 0x9E, 0xAC, 0x82, 0x16, 0xCA, 0xE5, 0x79, 0x2C, 0xA1, 0xAC, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b256_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k192b256_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b256_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b256_ECB_Zeros ()
+{
+ byte[] key = { 0xE4, 0x87, 0x99, 0x8B, 0xD1, 0x33, 0x03, 0x25, 0x1A, 0xE4, 0x10, 0x6F, 0xC7, 0x7F, 0xC2, 0xDA, 0xAC, 0x99, 0x02, 0xFF, 0x34, 0xEF, 0x10, 0xC0 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x67, 0xA7, 0x6E, 0xF5, 0xD8, 0xE2, 0xC3, 0xCB, 0x03, 0xF4, 0x6A, 0x01, 0x71, 0x8E, 0x02, 0xC7, 0x71, 0x73, 0xCF, 0x22, 0x76, 0x15, 0x87, 0x4F, 0x0D, 0x07, 0x43, 0xA6, 0x26, 0xAD, 0x15, 0xDA };
+ byte[] expected = { 0xAB, 0x82, 0x14, 0x0D, 0x94, 0x36, 0x61, 0x9D, 0xF9, 0x39, 0xDA, 0x44, 0x34, 0xBA, 0x0D, 0xF5, 0xE6, 0xD2, 0x68, 0x53, 0x60, 0xC6, 0x98, 0x39, 0x4C, 0x90, 0xBE, 0xF6, 0x6E, 0xD8, 0xCB, 0xAA, 0xAB, 0x82, 0x14, 0x0D, 0x94, 0x36, 0x61, 0x9D, 0xF9, 0x39, 0xDA, 0x44, 0x34, 0xBA, 0x0D, 0xF5, 0xE6, 0xD2, 0x68, 0x53, 0x60, 0xC6, 0x98, 0x39, 0x4C, 0x90, 0xBE, 0xF6, 0x6E, 0xD8, 0xCB, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k192b256_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k192b256_ECB_PKCS7 ()
+{
+ byte[] key = { 0x15, 0x40, 0x0B, 0xA3, 0xFC, 0x69, 0xF7, 0x2B, 0x55, 0x6F, 0xE9, 0x2C, 0xDA, 0xF8, 0x49, 0xAA, 0x41, 0xB3, 0x3B, 0x61, 0xCA, 0x88, 0x58, 0x19 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xCB, 0x37, 0xA1, 0x13, 0x44, 0x0D, 0x72, 0xC0, 0x8B, 0x0E, 0x62, 0xDB, 0xAF, 0x8D, 0x00, 0xC1, 0xF6, 0xF7, 0x2B, 0x60, 0x58, 0x09, 0x46, 0x95, 0x28, 0x9C, 0x87, 0x30, 0xE9, 0xA2, 0x95, 0x80 };
+ byte[] expected = { 0xBE, 0x93, 0xB9, 0xEF, 0xC7, 0x57, 0x71, 0xD9, 0xFA, 0x17, 0x6F, 0x9D, 0xBE, 0x2A, 0xF2, 0xE8, 0x17, 0x39, 0x61, 0x6A, 0xEE, 0x51, 0x6D, 0x65, 0xEE, 0x27, 0x50, 0x82, 0xFB, 0x91, 0xFC, 0xDB, 0xBE, 0x93, 0xB9, 0xEF, 0xC7, 0x57, 0x71, 0xD9, 0xFA, 0x17, 0x6F, 0x9D, 0xBE, 0x2A, 0xF2, 0xE8, 0x17, 0x39, 0x61, 0x6A, 0xEE, 0x51, 0x6D, 0x65, 0xEE, 0x27, 0x50, 0x82, 0xFB, 0x91, 0xFC, 0xDB, 0x72, 0x86, 0xCA, 0xC3, 0x5C, 0x0F, 0x55, 0x79, 0x32, 0x96, 0x07, 0x86, 0xD7, 0xF3, 0x23, 0x53, 0xFC, 0x63, 0xBC, 0xD1, 0x76, 0x33, 0x7F, 0x72, 0xF1, 0x0A, 0x60, 0x7F, 0xB2, 0x6A, 0xBA, 0x0B };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b256_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k192b256_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b256_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b256_CBC_None ()
+{
+ byte[] key = { 0x3E, 0xFE, 0x6E, 0xF9, 0x4A, 0xCE, 0x96, 0xB7, 0xDD, 0x34, 0x15, 0x20, 0x85, 0xEA, 0x4B, 0x41, 0xEC, 0xFC, 0xDD, 0x37, 0xD9, 0xF1, 0x9A, 0xE4 };
+ byte[] iv = { 0x04, 0x89, 0x29, 0x3F, 0x6A, 0x54, 0xED, 0xF3, 0x8D, 0x1F, 0x62, 0xC8, 0x8C, 0x05, 0x89, 0x62, 0xC2, 0x5E, 0xDB, 0xCA, 0x60, 0xE0, 0x17, 0x03, 0xE5, 0x69, 0x6B, 0x84, 0x44, 0x2C, 0x68, 0xB0 };
+ byte[] expected = { 0xA5, 0xCB, 0x68, 0xA8, 0x8A, 0xE0, 0xFD, 0x68, 0xB3, 0x75, 0x51, 0xB8, 0x46, 0x08, 0xEC, 0xE3, 0xDA, 0xE9, 0xBF, 0x49, 0x65, 0x74, 0x84, 0xB7, 0x9A, 0x60, 0x89, 0x43, 0xF2, 0x35, 0xC2, 0xAB, 0x3F, 0xD3, 0x0A, 0x9A, 0x6A, 0x3D, 0xB4, 0x2C, 0xB0, 0x8B, 0x32, 0x28, 0x2B, 0x57, 0x8F, 0x2E, 0xCF, 0x37, 0x24, 0x9B, 0xB5, 0x3B, 0xE6, 0x5E, 0xA7, 0xB9, 0x10, 0x99, 0x36, 0xA7, 0x9C, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b256_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b256_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k192b256_CBC_Zeros ()
+{
+ byte[] key = { 0xB6, 0x93, 0x96, 0xA4, 0xD3, 0xE5, 0x73, 0x81, 0x17, 0x7B, 0x68, 0x92, 0x3A, 0xAF, 0x20, 0x45, 0x75, 0xBA, 0x43, 0x3C, 0x5E, 0x46, 0xF6, 0x15 };
+ byte[] iv = { 0x17, 0x23, 0x3C, 0x0C, 0x51, 0xE2, 0x02, 0x8C, 0xC8, 0xD5, 0x5B, 0x00, 0x20, 0xE0, 0x2A, 0xC4, 0x4F, 0xCF, 0x4C, 0x1A, 0xCD, 0x59, 0x6C, 0x2D, 0x50, 0x8E, 0xF9, 0xA0, 0x3F, 0xFD, 0x81, 0xB5 };
+ byte[] expected = { 0x93, 0xF0, 0xFC, 0x25, 0x3D, 0x6D, 0x74, 0x1F, 0x88, 0xC9, 0x9F, 0xE6, 0x3A, 0x24, 0x13, 0xE1, 0x7C, 0xEF, 0x79, 0xC6, 0x56, 0x87, 0xCB, 0xD0, 0xB7, 0x15, 0x91, 0x21, 0x7E, 0x17, 0xA2, 0xF1, 0xA6, 0xDA, 0xCA, 0xDF, 0x14, 0x88, 0x5C, 0x35, 0x13, 0x1E, 0xCD, 0x2E, 0xB0, 0xC8, 0x7E, 0x4A, 0xBE, 0xD9, 0x3B, 0x15, 0x8D, 0xC9, 0x2A, 0xC5, 0x2D, 0x7C, 0x24, 0xF3, 0xB4, 0x43, 0xDE, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k192b256_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k192b256_CBC_PKCS7 ()
+{
+ byte[] key = { 0x5B, 0x58, 0xA2, 0xF7, 0x12, 0x9B, 0xF1, 0x09, 0x14, 0x98, 0x6F, 0x75, 0x69, 0xF0, 0xB5, 0x02, 0xDE, 0x7E, 0xF3, 0xBF, 0x56, 0x69, 0xEC, 0x5C };
+ byte[] iv = { 0x2E, 0x75, 0x1D, 0x3D, 0x2C, 0x01, 0x0B, 0x7A, 0xE6, 0x7C, 0x63, 0xB4, 0x1A, 0xF2, 0x48, 0x62, 0xF2, 0x7A, 0xF0, 0xFA, 0xC9, 0xAD, 0xFF, 0x88, 0x45, 0xE4, 0xFE, 0x5A, 0xA2, 0x87, 0x7A, 0x16 };
+ byte[] expected = { 0xD2, 0x9B, 0x71, 0x41, 0xAF, 0xD2, 0x66, 0x52, 0xB1, 0x45, 0xEA, 0x7C, 0xFD, 0xF8, 0xD5, 0x13, 0xAE, 0x3E, 0xCE, 0x84, 0x5B, 0x2A, 0xBB, 0xEA, 0x11, 0xFC, 0x45, 0x98, 0x71, 0xC0, 0x2A, 0x9B, 0xD4, 0x4B, 0xDA, 0xC9, 0xED, 0x8A, 0x86, 0x0B, 0xC4, 0x53, 0x32, 0x46, 0x00, 0x59, 0x12, 0x58, 0x12, 0x8E, 0x95, 0x20, 0xA8, 0xE0, 0x96, 0xEB, 0x62, 0xAF, 0x09, 0x04, 0xE7, 0x00, 0xCE, 0x14, 0x7D, 0x62, 0xE2, 0xE8, 0x85, 0x35, 0x7B, 0x11, 0xCD, 0xA9, 0xA4, 0x48, 0x28, 0x9A, 0xA1, 0x5A, 0x3A, 0x0D, 0x24, 0x00, 0x14, 0xEE, 0x1D, 0x99, 0x46, 0x29, 0x57, 0x56, 0x12, 0x63, 0x08, 0xB1 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k192b256_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k192b256_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k192b256_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b256_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b256_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k192b256_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b256_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b256_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b256_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b256_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k192b256_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k256b128_ECB_None ()
+{
+ byte[] key = { 0x5B, 0xA0, 0xA9, 0x6B, 0x20, 0x14, 0xF4, 0x4E, 0x2E, 0x9A, 0x34, 0x84, 0xD3, 0xB9, 0x62, 0x45, 0xB1, 0x98, 0x35, 0xAE, 0xA7, 0xED, 0x80, 0x67, 0xE2, 0x77, 0xC4, 0xD5, 0x6B, 0xBD, 0x6E, 0xCF };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xF5, 0xBD, 0x6D, 0xDF, 0x0C, 0x8E, 0xC5, 0x39, 0x25, 0xBE, 0x1A, 0x80, 0xF8, 0x79, 0xEC, 0x93 };
+ byte[] expected = { 0x54, 0xF5, 0x87, 0xE7, 0x73, 0xB7, 0x04, 0xBF, 0xBB, 0x16, 0x3D, 0x5A, 0xC0, 0x68, 0x7C, 0x17, 0x54, 0xF5, 0x87, 0xE7, 0x73, 0xB7, 0x04, 0xBF, 0xBB, 0x16, 0x3D, 0x5A, 0xC0, 0x68, 0x7C, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b128_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k256b128_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b128_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b128_ECB_Zeros ()
+{
+ byte[] key = { 0x77, 0xE1, 0xB2, 0xF9, 0x14, 0xF0, 0x77, 0xCE, 0xDB, 0x28, 0xD4, 0xA5, 0x0E, 0xA6, 0x73, 0x23, 0xD8, 0x46, 0xB7, 0x1A, 0x16, 0x92, 0xDB, 0x7E, 0x80, 0xDF, 0x5E, 0x9A, 0x16, 0x08, 0xFF, 0x6D };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x48, 0xEC, 0x4A, 0x12, 0xAC, 0x9C, 0xB5, 0x72, 0xEB, 0x12, 0x14, 0xFB, 0xE1, 0x6D, 0xCF, 0xA3 };
+ byte[] expected = { 0x82, 0x6C, 0xC7, 0xA6, 0xC2, 0x57, 0x07, 0xF9, 0x2F, 0x92, 0x95, 0x90, 0x65, 0xFA, 0x1D, 0xFA, 0x82, 0x6C, 0xC7, 0xA6, 0xC2, 0x57, 0x07, 0xF9, 0x2F, 0x92, 0x95, 0x90, 0x65, 0xFA, 0x1D, 0xFA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k256b128_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k256b128_ECB_PKCS7 ()
+{
+ byte[] key = { 0x19, 0xC2, 0x2D, 0x12, 0x57, 0x2B, 0xEF, 0x0C, 0xA2, 0xC7, 0x26, 0x7E, 0x35, 0xAD, 0xC5, 0x12, 0x53, 0x5D, 0xEE, 0xD7, 0x69, 0xC3, 0xB4, 0x0D, 0x9B, 0xEF, 0x36, 0xF7, 0xB2, 0xF2, 0xB0, 0x37 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xCF, 0x8D, 0xBE, 0xE0, 0x41, 0xC6, 0xB9, 0xB5, 0x2D, 0x8A, 0x59, 0x92, 0x82, 0xF4, 0xE8, 0x74 };
+ byte[] expected = { 0xAD, 0x99, 0x9A, 0xE2, 0x5B, 0xE7, 0xFB, 0x74, 0xE8, 0xAB, 0xEE, 0x5D, 0xCA, 0x0F, 0x0A, 0x7A, 0xAD, 0x99, 0x9A, 0xE2, 0x5B, 0xE7, 0xFB, 0x74, 0xE8, 0xAB, 0xEE, 0x5D, 0xCA, 0x0F, 0x0A, 0x7A, 0x8F, 0xAD, 0xBB, 0xC2, 0x18, 0xB8, 0xF0, 0xFF, 0x59, 0x7D, 0xF8, 0xF1, 0x6A, 0x21, 0x9C, 0xF3 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b128_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k256b128_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b128_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b128_CBC_None ()
+{
+ byte[] key = { 0xE8, 0x74, 0x24, 0x77, 0x2B, 0xBE, 0x6C, 0x99, 0x2E, 0xFC, 0xB5, 0x85, 0xC9, 0xA1, 0xD7, 0x9C, 0x24, 0xF1, 0x86, 0x0B, 0xEA, 0xAB, 0xCB, 0x06, 0x47, 0x2E, 0x26, 0x6C, 0xAF, 0x24, 0x87, 0xA7 };
+ byte[] iv = { 0x15, 0x7E, 0xA5, 0xE5, 0x47, 0xFA, 0x40, 0x30, 0x0A, 0xAA, 0x9E, 0x68, 0x8E, 0x4D, 0x2D, 0xA4 };
+ byte[] expected = { 0xEF, 0x05, 0x1C, 0x5C, 0xEA, 0xED, 0x34, 0x28, 0x9E, 0x21, 0x9C, 0x2C, 0x96, 0xF5, 0xF7, 0xDA, 0x55, 0xD4, 0x88, 0x0A, 0x73, 0xF1, 0x8D, 0xBC, 0x8F, 0x17, 0x26, 0x86, 0x8A, 0xC1, 0x4B, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b128_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b128_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b128_CBC_Zeros ()
+{
+ byte[] key = { 0x50, 0x54, 0x8C, 0x92, 0xE5, 0xFD, 0x08, 0x03, 0xEA, 0x15, 0xBB, 0xB9, 0x39, 0x8B, 0x6E, 0xF0, 0xF5, 0x64, 0x49, 0x0E, 0x0F, 0x8F, 0x41, 0xF9, 0xA6, 0x1E, 0xD4, 0xD2, 0xB6, 0xF2, 0xB6, 0x4B };
+ byte[] iv = { 0x32, 0x9B, 0x60, 0xF7, 0xBE, 0x0F, 0x5F, 0xA5, 0xD2, 0x7A, 0x1F, 0xB4, 0x01, 0x76, 0xD1, 0xCD };
+ byte[] expected = { 0x6C, 0x55, 0xAD, 0x57, 0xEE, 0x78, 0x1D, 0x69, 0x82, 0x8D, 0xE5, 0x52, 0x4C, 0x76, 0xD7, 0xF1, 0xFA, 0xFC, 0xD1, 0x2D, 0xDC, 0x0F, 0xE4, 0x4F, 0xF0, 0xE5, 0xB0, 0x2B, 0x28, 0xBF, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k256b128_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k256b128_CBC_PKCS7 ()
+{
+ byte[] key = { 0x8B, 0x8B, 0x4C, 0x04, 0x8C, 0x16, 0x16, 0x91, 0xBE, 0x79, 0x35, 0xF6, 0x26, 0x01, 0xF8, 0x06, 0x8F, 0xC7, 0x6D, 0xD6, 0xFE, 0xDE, 0xCF, 0xD8, 0xDC, 0xE1, 0x97, 0x9D, 0xA9, 0xD0, 0x96, 0x86 };
+ byte[] iv = { 0xA0, 0xF5, 0x25, 0xE5, 0x17, 0xEA, 0x37, 0x18, 0x17, 0x56, 0x26, 0x1C, 0x63, 0x95, 0xC3, 0xAD };
+ byte[] expected = { 0x42, 0x33, 0x8E, 0xDE, 0x2E, 0xDA, 0xC9, 0xC6, 0x97, 0xA2, 0xAE, 0xE1, 0x15, 0x00, 0xDE, 0x4A, 0x39, 0x0B, 0xEB, 0xC8, 0xF9, 0x9F, 0x00, 0x05, 0xCF, 0xB5, 0x32, 0x46, 0x91, 0xFC, 0x28, 0x23, 0xF4, 0xC5, 0xCE, 0x42, 0x63, 0x3F, 0x82, 0x7D, 0x2A, 0xC4, 0xB5, 0x09, 0x67, 0xC7, 0x33, 0x3F };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 128;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b128_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b128_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k256b128_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b128_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b128_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b128_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b128_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b128_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b128_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b128_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b128_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k256b192_ECB_None ()
+{
+ byte[] key = { 0xE3, 0x43, 0x35, 0xDB, 0xB7, 0xC8, 0x24, 0xBF, 0x25, 0xD2, 0xA3, 0xCD, 0x70, 0xEB, 0x6B, 0xB7, 0x6D, 0x64, 0xF4, 0xB8, 0xA0, 0x56, 0x52, 0xFB, 0x3A, 0x09, 0xD4, 0xD9, 0x4F, 0x09, 0x19, 0xAF };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xDB, 0x11, 0xE4, 0x50, 0x12, 0x29, 0xC8, 0x63, 0x61, 0xEC, 0xFE, 0xD3, 0xFE, 0xA2, 0x19, 0xE0, 0xEC, 0x2F, 0x56, 0x69, 0xB7, 0x41, 0x56, 0xB0 };
+ byte[] expected = { 0x66, 0xD0, 0x72, 0x3B, 0xFA, 0x3F, 0x27, 0x81, 0xB6, 0x91, 0x78, 0x7A, 0x4C, 0xD0, 0xA0, 0x4C, 0x93, 0x56, 0x51, 0xA3, 0xE0, 0x69, 0x63, 0xAF, 0x66, 0xD0, 0x72, 0x3B, 0xFA, 0x3F, 0x27, 0x81, 0xB6, 0x91, 0x78, 0x7A, 0x4C, 0xD0, 0xA0, 0x4C, 0x93, 0x56, 0x51, 0xA3, 0xE0, 0x69, 0x63, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b192_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k256b192_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b192_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b192_ECB_Zeros ()
+{
+ byte[] key = { 0xCF, 0xAC, 0xFC, 0x30, 0x6C, 0x01, 0x16, 0x8A, 0x82, 0x52, 0x52, 0xC0, 0xC6, 0xAC, 0x1E, 0x60, 0x93, 0x17, 0x0A, 0x0C, 0x87, 0xE1, 0x4A, 0x78, 0xD9, 0xA6, 0x6B, 0xAF, 0x24, 0xF7, 0x8F, 0xED };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x99, 0x2B, 0x6B, 0x30, 0x56, 0x13, 0x2E, 0xE3, 0x3B, 0x2B, 0xC1, 0xA9, 0x4B, 0x3B, 0xD9, 0xC3, 0x7B, 0xA7, 0x4F, 0x26, 0xC9, 0x62, 0xC9, 0x66 };
+ byte[] expected = { 0x22, 0x6B, 0xFA, 0x34, 0x8E, 0x09, 0xC2, 0xDF, 0xCA, 0x6C, 0xF5, 0x1F, 0xD2, 0xDC, 0x01, 0xC6, 0x3B, 0x73, 0x3F, 0x64, 0x91, 0x9F, 0xF6, 0xD3, 0x22, 0x6B, 0xFA, 0x34, 0x8E, 0x09, 0xC2, 0xDF, 0xCA, 0x6C, 0xF5, 0x1F, 0xD2, 0xDC, 0x01, 0xC6, 0x3B, 0x73, 0x3F, 0x64, 0x91, 0x9F, 0xF6, 0xD3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k256b192_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k256b192_ECB_PKCS7 ()
+{
+ byte[] key = { 0x17, 0xF9, 0x4A, 0x56, 0x22, 0x77, 0x20, 0x33, 0x48, 0xCB, 0x06, 0x86, 0x44, 0x02, 0xCF, 0x52, 0xDA, 0x22, 0x36, 0x07, 0xE9, 0x9F, 0x3A, 0x28, 0x3E, 0xCB, 0x49, 0x51, 0xA4, 0x67, 0x60, 0xF3 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x07, 0x77, 0x47, 0xC3, 0x49, 0x85, 0x7D, 0xB7, 0xED, 0xF3, 0x0D, 0x3F, 0x0F, 0xDC, 0xA6, 0x3E, 0x01, 0x53, 0x4D, 0x61, 0xEC, 0x06, 0xB4, 0xA0 };
+ byte[] expected = { 0xA0, 0x34, 0x6F, 0xFD, 0x84, 0xA3, 0x54, 0xC0, 0x7E, 0xCC, 0x7D, 0x02, 0xE5, 0xDA, 0x79, 0x4E, 0xC6, 0xEB, 0xCE, 0x42, 0xD2, 0xBE, 0x68, 0x0F, 0xA0, 0x34, 0x6F, 0xFD, 0x84, 0xA3, 0x54, 0xC0, 0x7E, 0xCC, 0x7D, 0x02, 0xE5, 0xDA, 0x79, 0x4E, 0xC6, 0xEB, 0xCE, 0x42, 0xD2, 0xBE, 0x68, 0x0F, 0xBC, 0x22, 0x09, 0x5B, 0xFA, 0x92, 0x7E, 0xD8, 0xFF, 0x6A, 0xDD, 0x43, 0x63, 0x72, 0x23, 0xBA, 0xF9, 0xC8, 0x06, 0x3F, 0x51, 0xE8, 0x14, 0xE7 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b192_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k256b192_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b192_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b192_CBC_None ()
+{
+ byte[] key = { 0x7A, 0x26, 0xAB, 0x32, 0x31, 0x49, 0x69, 0x3D, 0x68, 0x5A, 0xAC, 0x1B, 0x63, 0x85, 0x5A, 0x3D, 0xC4, 0xDE, 0xA8, 0x76, 0x00, 0x26, 0x78, 0x31, 0xB6, 0x30, 0xD8, 0xCB, 0x7E, 0xE7, 0xE9, 0x5B };
+ byte[] iv = { 0x9D, 0x7B, 0xD5, 0x59, 0xCA, 0x42, 0xCB, 0x2F, 0x02, 0x65, 0xFE, 0x85, 0x63, 0xAE, 0x14, 0x4F, 0x69, 0xAA, 0xC2, 0xAF, 0x06, 0xF0, 0x48, 0x4F };
+ byte[] expected = { 0x6C, 0x03, 0x84, 0x1C, 0x4E, 0xE0, 0x05, 0x67, 0xEA, 0x8D, 0x1C, 0x41, 0xFD, 0xC2, 0x90, 0x0E, 0xB9, 0xAA, 0xE5, 0xA0, 0x41, 0x62, 0xFE, 0xD8, 0x57, 0xA1, 0xCE, 0x33, 0x22, 0x09, 0xDB, 0x3B, 0xD7, 0x0A, 0x68, 0x61, 0x76, 0xB9, 0x8F, 0x7E, 0xE8, 0xD9, 0xA0, 0x46, 0x2B, 0x15, 0xC3, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b192_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b192_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b192_CBC_Zeros ()
+{
+ byte[] key = { 0x35, 0x14, 0xF8, 0xDB, 0xB0, 0x84, 0x94, 0xD3, 0xDD, 0xE1, 0xB3, 0x21, 0x44, 0xE2, 0x9C, 0x65, 0x0A, 0x4A, 0x28, 0x7C, 0xD7, 0xD4, 0x9F, 0x49, 0x05, 0x23, 0x2C, 0xB2, 0x65, 0x17, 0x44, 0x2E };
+ byte[] iv = { 0xD8, 0xA5, 0x77, 0x5C, 0x54, 0x79, 0x57, 0xE2, 0xBD, 0xF7, 0xD1, 0xF1, 0x6F, 0x52, 0x99, 0xBE, 0x04, 0x5E, 0x75, 0x51, 0xA6, 0x7D, 0xB9, 0x88 };
+ byte[] expected = { 0xC8, 0x93, 0x1E, 0xED, 0x3F, 0x9F, 0x79, 0x34, 0x6C, 0x3F, 0x99, 0x4A, 0x25, 0xAF, 0x86, 0xDF, 0xDF, 0x19, 0x65, 0xE8, 0xAD, 0x75, 0x43, 0x1B, 0xCD, 0x1B, 0x15, 0x23, 0xC4, 0x49, 0x07, 0x31, 0x3E, 0xA2, 0x34, 0x58, 0xA0, 0x82, 0x9F, 0xF8, 0xB7, 0xB1, 0xBE, 0x59, 0xF1, 0x09, 0x5E, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k256b192_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k256b192_CBC_PKCS7 ()
+{
+ byte[] key = { 0x18, 0x60, 0x4C, 0x76, 0x3D, 0x08, 0x05, 0x18, 0x66, 0xA8, 0xA5, 0x59, 0x9E, 0xB1, 0x12, 0x83, 0x70, 0x81, 0x40, 0x82, 0x09, 0xE4, 0x36, 0x41, 0xBB, 0x72, 0x53, 0xF3, 0xB6, 0x23, 0xAE, 0xB9 };
+ byte[] iv = { 0xA9, 0xC1, 0x7A, 0x1D, 0xAF, 0x14, 0xFA, 0x7D, 0xEF, 0x7F, 0xDE, 0x9E, 0xE9, 0xD6, 0x1D, 0x61, 0x46, 0x2B, 0xC9, 0x24, 0x40, 0x0A, 0xE9, 0x9C };
+ byte[] expected = { 0x9B, 0xE4, 0x1F, 0x94, 0xB2, 0x6B, 0x3E, 0x70, 0x69, 0x18, 0xCD, 0x65, 0xB7, 0xD9, 0xD9, 0x8E, 0xBB, 0xDA, 0xED, 0x5C, 0x84, 0xBA, 0x52, 0x4C, 0xA2, 0x66, 0xB8, 0x20, 0xEC, 0xB4, 0x16, 0xF1, 0x4C, 0xA2, 0xD0, 0x5F, 0x48, 0xDF, 0xA1, 0xDA, 0xEF, 0x75, 0xA8, 0x02, 0xCA, 0x57, 0x2E, 0x61, 0x94, 0x6A, 0x63, 0xFF, 0xBF, 0x2D, 0x44, 0x29, 0x38, 0x24, 0x50, 0x16, 0xE4, 0x41, 0x12, 0xBB, 0xF6, 0x67, 0x0A, 0xCF, 0x0A, 0xC9, 0x89, 0x55 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 192;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b192_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b192_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k256b192_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b192_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b192_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b192_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b192_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b192_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b192_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b192_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b192_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestRijndael_k256b256_ECB_None ()
+{
+ byte[] key = { 0x04, 0x93, 0xC7, 0x1A, 0x3A, 0x62, 0x1E, 0x8B, 0x82, 0x6A, 0x20, 0x26, 0x5E, 0x29, 0x15, 0x0D, 0xCB, 0xD9, 0x49, 0x8A, 0x3E, 0x91, 0xE0, 0x8C, 0xE0, 0x9D, 0x8E, 0x15, 0x43, 0xE3, 0x1F, 0x9A };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x41, 0x3B, 0xE7, 0x01, 0x40, 0xB6, 0xB9, 0x54, 0x24, 0x38, 0x38, 0xB5, 0x8C, 0x90, 0x8D, 0x90, 0x9D, 0x68, 0xE6, 0x9C, 0x92, 0xCD, 0x95, 0x77, 0x96, 0xC6, 0xE8, 0xD5, 0xA5, 0x3E, 0xBD, 0xB9 };
+ byte[] expected = { 0x2F, 0x30, 0x0F, 0xA2, 0x9C, 0x0E, 0xCA, 0x38, 0xD5, 0x43, 0xB6, 0xD4, 0xF9, 0x16, 0x65, 0xB8, 0xAA, 0x29, 0xB8, 0x16, 0xB7, 0x62, 0xE5, 0xFD, 0xC3, 0x4C, 0xA7, 0x7B, 0xC7, 0xF5, 0x5C, 0x1E, 0x2F, 0x30, 0x0F, 0xA2, 0x9C, 0x0E, 0xCA, 0x38, 0xD5, 0x43, 0xB6, 0xD4, 0xF9, 0x16, 0x65, 0xB8, 0xAA, 0x29, 0xB8, 0x16, 0xB7, 0x62, 0xE5, 0xFD, 0xC3, 0x4C, 0xA7, 0x7B, 0xC7, 0xF5, 0x5C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b256_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k256b256_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b256_ECB_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b256_ECB_Zeros ()
+{
+ byte[] key = { 0x52, 0x21, 0xDF, 0x3C, 0x96, 0x67, 0x86, 0x28, 0x80, 0x97, 0x12, 0xBB, 0xDD, 0x80, 0xE1, 0x04, 0xC8, 0x4B, 0x12, 0x3E, 0x28, 0x3F, 0x32, 0x38, 0xC8, 0xA0, 0x12, 0xFA, 0xFE, 0x8C, 0x0C, 0xEC };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xA9, 0x41, 0xB0, 0xE2, 0x23, 0x9A, 0x75, 0x56, 0x5F, 0x5D, 0xB8, 0x0B, 0xB1, 0xF1, 0x0F, 0xC2, 0x50, 0xBF, 0xA7, 0x3B, 0x8A, 0x26, 0xD4, 0x82, 0x33, 0xE1, 0x77, 0x84, 0xCC, 0x47, 0xCB, 0x85 };
+ byte[] expected = { 0xB0, 0xC4, 0x5A, 0xDA, 0x21, 0x69, 0x9A, 0x80, 0xFC, 0xF4, 0xD1, 0xA5, 0xEE, 0x43, 0x44, 0x27, 0x4F, 0x42, 0x38, 0xFE, 0xC4, 0x2C, 0x75, 0x00, 0x60, 0x66, 0x1E, 0x86, 0xD0, 0xFC, 0x4B, 0x23, 0xB0, 0xC4, 0x5A, 0xDA, 0x21, 0x69, 0x9A, 0x80, 0xFC, 0xF4, 0xD1, 0xA5, 0xEE, 0x43, 0x44, 0x27, 0x4F, 0x42, 0x38, 0xFE, 0xC4, 0x2C, 0x75, 0x00, 0x60, 0x66, 0x1E, 0x86, 0xD0, 0xFC, 0x4B, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k256b256_ECB_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k256b256_ECB_PKCS7 ()
+{
+ byte[] key = { 0xC6, 0x74, 0x58, 0xA6, 0xE0, 0xAD, 0xA2, 0x2F, 0x36, 0xC1, 0xD7, 0xAC, 0xAD, 0x8E, 0x66, 0x18, 0x8B, 0xEF, 0xBF, 0x1B, 0x75, 0xF0, 0xB0, 0x96, 0xBB, 0x07, 0xE9, 0x67, 0x25, 0x1B, 0xD0, 0x46 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x3B, 0x34, 0x5E, 0x47, 0xE3, 0x51, 0xC4, 0xE4, 0x9A, 0x66, 0xD6, 0x42, 0x1B, 0x45, 0xAB, 0x03, 0x35, 0x9A, 0x52, 0xD8, 0x1E, 0xA3, 0xC8, 0xD8, 0xBB, 0x3E, 0xD1, 0x35, 0x2C, 0x90, 0xB1, 0xC7 };
+ byte[] expected = { 0x48, 0xD6, 0xD0, 0x25, 0xC7, 0x71, 0x0E, 0x10, 0xB9, 0x05, 0xE4, 0xC9, 0xEF, 0xAD, 0xB8, 0x2B, 0x14, 0xAF, 0x10, 0x53, 0x27, 0x8F, 0x32, 0x2C, 0x25, 0x9D, 0xCE, 0x64, 0x22, 0x52, 0x29, 0xCB, 0x48, 0xD6, 0xD0, 0x25, 0xC7, 0x71, 0x0E, 0x10, 0xB9, 0x05, 0xE4, 0xC9, 0xEF, 0xAD, 0xB8, 0x2B, 0x14, 0xAF, 0x10, 0x53, 0x27, 0x8F, 0x32, 0x2C, 0x25, 0x9D, 0xCE, 0x64, 0x22, 0x52, 0x29, 0xCB, 0xDF, 0x29, 0xD6, 0xDD, 0xFB, 0x89, 0x4B, 0xD7, 0x24, 0x88, 0x8E, 0x74, 0x95, 0x79, 0xBD, 0xFB, 0x80, 0xCF, 0x34, 0x7C, 0xEC, 0x2A, 0xDF, 0xBB, 0x18, 0xF6, 0xB6, 0x41, 0x00, 0xA5, 0x00, 0x55 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b256_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("Rijndael_k256b256_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b256_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b256_CBC_None ()
+{
+ byte[] key = { 0x2E, 0x1E, 0x55, 0x9B, 0xA8, 0x5A, 0x1D, 0x2A, 0x6B, 0x4D, 0x95, 0x8E, 0x7C, 0xFC, 0x33, 0xCE, 0x00, 0xA3, 0xFA, 0xCE, 0x9F, 0xF6, 0xED, 0x0C, 0xD5, 0x3C, 0xB0, 0xF4, 0x87, 0x26, 0x1E, 0x12 };
+ byte[] iv = { 0xB2, 0xCC, 0xA6, 0x99, 0x96, 0x9C, 0xC1, 0x20, 0x2A, 0xB1, 0x00, 0x28, 0x85, 0xE1, 0xB7, 0x74, 0x66, 0x02, 0xF5, 0x69, 0xE3, 0x1F, 0xA4, 0xF4, 0xFB, 0x90, 0x3F, 0xB2, 0x7E, 0x56, 0xC9, 0x6E };
+ byte[] expected = { 0x4D, 0x77, 0x53, 0xBE, 0xDB, 0xB7, 0x4D, 0x1B, 0x9B, 0x1F, 0x65, 0x7A, 0xF1, 0x8F, 0x40, 0x0D, 0x60, 0x46, 0x08, 0x8B, 0x36, 0x83, 0x91, 0x8E, 0xDC, 0x23, 0x48, 0x1F, 0x4B, 0xCB, 0x09, 0x31, 0xDB, 0x73, 0xA6, 0xF3, 0xDB, 0x98, 0x06, 0xE9, 0xFA, 0x72, 0x4F, 0xDC, 0x3A, 0xF1, 0x08, 0x7B, 0x42, 0x1E, 0xD3, 0xDB, 0x91, 0xC3, 0x2C, 0x3D, 0xD7, 0x79, 0x17, 0x2A, 0xE1, 0x3C, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b256_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b256_CBC_None Decrypt", input, original);
+}
+
+
+public void TestRijndael_k256b256_CBC_Zeros ()
+{
+ byte[] key = { 0xEE, 0x9F, 0xAB, 0x79, 0x11, 0x3F, 0x53, 0x56, 0x4C, 0xB4, 0xC3, 0x70, 0x29, 0x03, 0xB8, 0x26, 0x8C, 0x30, 0x2A, 0xD3, 0xF2, 0x1E, 0xA3, 0x42, 0xF4, 0xE6, 0x79, 0x5B, 0x0D, 0x93, 0xCF, 0x1B };
+ byte[] iv = { 0xB0, 0x2A, 0x0F, 0x47, 0x4E, 0x47, 0xDB, 0x4A, 0xF2, 0xC7, 0xEB, 0xC3, 0xFA, 0xD3, 0x89, 0x0B, 0x46, 0x17, 0xDE, 0xB9, 0x18, 0x37, 0x6E, 0x83, 0x95, 0xD6, 0xF9, 0x25, 0xB5, 0xAC, 0x86, 0x9B };
+ byte[] expected = { 0x6F, 0x0B, 0x2F, 0x3E, 0x9B, 0x07, 0xDE, 0x8B, 0xE9, 0xE7, 0xD7, 0x10, 0x09, 0xAF, 0x8E, 0x84, 0xB7, 0xBA, 0xD1, 0x79, 0x37, 0xF1, 0x25, 0xB6, 0xD7, 0xFC, 0xFB, 0x62, 0x83, 0x86, 0x8A, 0xD1, 0xC6, 0xDD, 0x98, 0x59, 0xE3, 0xEE, 0x9C, 0xA6, 0x73, 0x03, 0xE6, 0xB2, 0x72, 0xD0, 0x35, 0x39, 0xBB, 0x1C, 0x8F, 0x08, 0x8C, 0x70, 0x4C, 0x0C, 0xAD, 0xCB, 0x4F, 0x9D, 0xB7, 0x6A, 0x5F, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ // some exception can be normal... other not so!
+ try {
+ Encrypt (encryptor, input, output);
+ }
+ catch (Exception e) {
+ if (e.Message != "Input buffer contains insufficient data. ")
+ Fail ("Rijndael_k256b256_CBC_Zeros: This isn't the expected exception: " + e.ToString ());
+ }
+}
+
+
+public void TestRijndael_k256b256_CBC_PKCS7 ()
+{
+ byte[] key = { 0x63, 0x95, 0x5F, 0x23, 0xFE, 0x8B, 0x49, 0x09, 0xBD, 0x05, 0x0D, 0x47, 0xCE, 0x48, 0x86, 0x02, 0x58, 0x44, 0x78, 0x21, 0x28, 0x75, 0x2E, 0x3A, 0x80, 0xE4, 0x41, 0x97, 0x0F, 0xB8, 0xA4, 0xB1 };
+ byte[] iv = { 0xE1, 0xC3, 0x6B, 0x5D, 0x4F, 0x86, 0x0D, 0x44, 0xD6, 0x73, 0x21, 0x50, 0x11, 0xD3, 0x41, 0x61, 0x33, 0x04, 0x1A, 0xF8, 0x50, 0x33, 0x93, 0x4A, 0x7F, 0x9F, 0x48, 0x27, 0x8C, 0x25, 0x90, 0x93 };
+ byte[] expected = { 0x1F, 0x18, 0x81, 0x2B, 0xEA, 0xE1, 0x05, 0x56, 0xF5, 0x71, 0x73, 0x8C, 0x84, 0x9C, 0x46, 0xF9, 0x18, 0xEE, 0x08, 0xB1, 0x4B, 0x96, 0xC9, 0xC9, 0x70, 0xC8, 0x3B, 0xEC, 0x15, 0x40, 0x5C, 0xA0, 0x3A, 0xD1, 0x09, 0x0C, 0xD8, 0x6F, 0xAA, 0xF5, 0x34, 0x52, 0x3A, 0x51, 0x8F, 0x3A, 0xB0, 0x3E, 0xFB, 0x31, 0x43, 0x97, 0xA3, 0x05, 0xC6, 0xF2, 0x7F, 0x2A, 0xF0, 0x4F, 0xA8, 0x64, 0xE7, 0x06, 0xFB, 0x59, 0xD3, 0xFB, 0x9E, 0x72, 0x3B, 0x11, 0xEE, 0x88, 0xEC, 0x29, 0xB2, 0x51, 0xD9, 0x58, 0x42, 0x79, 0xFC, 0x35, 0xE2, 0xF1, 0x81, 0x45, 0x8F, 0x7E, 0xE1, 0xBA, 0x95, 0xC9, 0xDD, 0x76 };
+
+ SymmetricAlgorithm algo = Rijndael.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 256;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("Rijndael_k256b256_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("Rijndael_k256b256_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters Rijndael_k256b256_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b256_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b256_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters Rijndael_k256b256_CFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b256_CFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b256_CFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b256_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b256_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters Rijndael_k256b256_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestTripleDES_k128b64_ECB_None ()
+{
+ byte[] key = { 0x31, 0x29, 0x5A, 0x2D, 0x18, 0xDF, 0x78, 0xB1, 0xB3, 0x30, 0xB4, 0x2E, 0x08, 0x2A, 0xB5, 0x00 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xDE, 0x87, 0xFF, 0xA6, 0x30, 0x76, 0x39, 0x89 };
+ byte[] expected = { 0x74, 0xD2, 0x61, 0x01, 0xF0, 0x86, 0x74, 0xE8, 0x74, 0xD2, 0x61, 0x01, 0xF0, 0x86, 0x74, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("TripleDES_k128b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_ECB_Zeros ()
+{
+ byte[] key = { 0xFB, 0xC1, 0xA8, 0x04, 0x47, 0x10, 0x09, 0x09, 0xA8, 0x3D, 0x97, 0x18, 0x11, 0x3C, 0x28, 0x80 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xA2, 0x1F, 0x63, 0x49, 0x33, 0xCA, 0xEE, 0xDA };
+ byte[] expected = { 0xDB, 0x4E, 0x92, 0x3D, 0xE3, 0x26, 0x0B, 0x16, 0xDB, 0x4E, 0x92, 0x3D, 0xE3, 0x26, 0x0B, 0x16, 0xDB, 0x4E, 0x92, 0x3D, 0xE3, 0x26, 0x0B, 0x16 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("TripleDES_k128b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("TripleDES_k128b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x78, 0x52, 0xAE, 0x73, 0x24, 0x0A, 0xDF, 0x80, 0x1A, 0xDE, 0x32, 0x90, 0x3C, 0x01, 0xBA, 0x12 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xF6, 0x11, 0x79, 0x5E, 0xEC, 0xDC, 0x5E, 0x19 };
+ byte[] expected = { 0x83, 0xDE, 0x8A, 0xDA, 0x7A, 0x46, 0xDC, 0x07, 0x83, 0xDE, 0x8A, 0xDA, 0x7A, 0x46, 0xDC, 0x07, 0x4B, 0x79, 0x8C, 0x46, 0x0A, 0xB7, 0x40, 0x6C };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("TripleDES_k128b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_CBC_None ()
+{
+ byte[] key = { 0x9B, 0x97, 0x95, 0xA2, 0x6D, 0x90, 0x1D, 0xAE, 0xE8, 0xFC, 0xA1, 0xA2, 0x06, 0x6E, 0x75, 0xE8 };
+ byte[] iv = { 0x52, 0xF8, 0x0E, 0xA9, 0x8C, 0xD9, 0x46, 0x63 };
+ byte[] expected = { 0xD3, 0x37, 0x2D, 0x9B, 0x69, 0x35, 0xB7, 0x80, 0xD1, 0x13, 0xBB, 0xEB, 0x47, 0xB6, 0xDA, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_CBC_Zeros ()
+{
+ byte[] key = { 0x21, 0x87, 0x57, 0xF4, 0xE5, 0xE9, 0x91, 0xC7, 0x3A, 0x64, 0x14, 0xF2, 0x2B, 0x06, 0x0E, 0x2E };
+ byte[] iv = { 0x23, 0x86, 0x58, 0x7B, 0x49, 0x23, 0xF6, 0x7F };
+ byte[] expected = { 0xEF, 0x1B, 0x0B, 0xDD, 0xD0, 0x07, 0x5E, 0x22, 0x9D, 0xB9, 0xCC, 0x52, 0xB4, 0xD9, 0x88, 0x1F, 0x5D, 0xE3, 0x51, 0x51, 0xBF, 0x7C, 0xB5, 0xB3 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x06, 0x33, 0x4B, 0x5A, 0xF0, 0xC6, 0xAE, 0x71, 0x8C, 0x41, 0xB3, 0x72, 0x43, 0x4B, 0x82, 0x31 };
+ byte[] iv = { 0x40, 0x7F, 0x60, 0x5B, 0x5C, 0x22, 0x8D, 0x5D };
+ byte[] expected = { 0x9C, 0x3F, 0x6A, 0x1D, 0xBD, 0x92, 0x1A, 0xFA, 0xD4, 0xA5, 0xEA, 0xB3, 0x77, 0xA0, 0x8B, 0xB0, 0x7E, 0x11, 0xFA, 0xA9, 0x45, 0x46, 0x16, 0x33 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters TripleDES_k128b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters TripleDES_k128b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters TripleDES_k128b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestTripleDES_k128b64_CFB8_None ()
+{
+ byte[] key = { 0x49, 0x9D, 0x94, 0x9C, 0x79, 0xD9, 0xEE, 0x92, 0x75, 0xE8, 0x8C, 0x78, 0xE3, 0xB5, 0x49, 0x81 };
+ byte[] iv = { 0x80, 0x0A, 0x45, 0x55, 0xCB, 0xC7, 0x17, 0xA1 };
+ byte[] expected = { 0xA5, 0x0F, 0xFF, 0xE6, 0xA0, 0x59, 0x58, 0x81, 0xB0, 0xFE, 0x19, 0x40, 0xF4, 0x04, 0x0B, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x47, 0xD4, 0x00, 0xC6, 0x0B, 0xCE, 0x0D, 0x6B, 0xD6, 0xEB, 0xBF, 0x74, 0xE3, 0xB9, 0x61, 0x14 };
+ byte[] iv = { 0x63, 0xB1, 0xCE, 0xEF, 0x06, 0x14, 0xD6, 0x4B };
+ byte[] expected = { 0x02, 0xB8, 0xB8, 0x49, 0xA8, 0x3B, 0x6B, 0x05, 0x74, 0x79, 0x91, 0xFE, 0x7B, 0x74, 0x0A, 0xF8, 0x95, 0x80, 0x5A, 0xF1, 0xE9, 0xD7, 0xD3, 0x32 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k128b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0x70, 0x9E, 0x39, 0x1A, 0x45, 0xA4, 0x18, 0x30, 0xAC, 0xE6, 0x1E, 0x0E, 0xD7, 0x43, 0x39, 0x5F };
+ byte[] iv = { 0x26, 0xF3, 0x46, 0x6A, 0x35, 0xC8, 0xBF, 0x03 };
+ byte[] expected = { 0x88, 0x21, 0x01, 0x82, 0x88, 0x2E, 0x93, 0xC5, 0xCD, 0xA2, 0xC9, 0x38, 0x45, 0x68, 0x91, 0x82, 0xA5, 0x78, 0x6B, 0x08, 0x3F, 0x7C, 0xB8, 0x5F };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k128b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k128b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters TripleDES_k128b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters TripleDES_k128b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters TripleDES_k128b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+public void TestTripleDES_k192b64_ECB_None ()
+{
+ byte[] key = { 0x02, 0xFE, 0x15, 0x59, 0xD7, 0xE9, 0xB5, 0x2A, 0xA7, 0x9B, 0xB3, 0xA6, 0xFA, 0xAA, 0xC7, 0x97, 0xD4, 0x1B, 0xE4, 0x2D, 0xE4, 0xC5, 0x89, 0xC2 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0x13, 0xBF, 0xF3, 0xA0, 0xD3, 0xA1, 0x2F, 0x23 };
+ byte[] expected = { 0xC8, 0x09, 0x6E, 0xD6, 0xC8, 0xD8, 0xF3, 0x6A, 0xC8, 0x09, 0x6E, 0xD6, 0xC8, 0xD8, 0xF3, 0x6A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_ECB_None Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("TripleDES_k192b64_ECB_None b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_ECB_None Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_ECB_Zeros ()
+{
+ byte[] key = { 0x0B, 0xB5, 0x02, 0xE8, 0xC3, 0x2E, 0x24, 0xD9, 0xF0, 0x29, 0x15, 0x10, 0x19, 0x88, 0xFC, 0xD2, 0x60, 0xCA, 0x30, 0x51, 0x0D, 0xD6, 0x80, 0xAC };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xF6, 0xC5, 0xBD, 0xA2, 0x4D, 0xA8, 0x19, 0x78 };
+ byte[] expected = { 0xE0, 0x52, 0xCB, 0xC6, 0xBB, 0x43, 0x8F, 0x3B, 0xE0, 0x52, 0xCB, 0xC6, 0xBB, 0x43, 0x8F, 0x3B, 0xE0, 0x52, 0xCB, 0xC6, 0xBB, 0x43, 0x8F, 0x3B };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_ECB_Zeros Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("TripleDES_k192b64_ECB_Zeros b1==b2", block1, block2);
+
+ // also if padding is Zeros then all three blocks should be equals
+ byte[] block3 = new byte[blockLength];
+ Array.Copy (output, blockLength, block3, 0, blockLength);
+ AssertEquals ("TripleDES_k192b64_ECB_Zeros b1==b3", block1, block3);
+
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_ECB_Zeros Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_ECB_PKCS7 ()
+{
+ byte[] key = { 0x41, 0xAD, 0x00, 0xE4, 0x53, 0x0A, 0x09, 0x8C, 0x1F, 0x86, 0x91, 0x46, 0x41, 0xEC, 0xE3, 0x70, 0x35, 0xE5, 0x65, 0x10, 0x0D, 0x38, 0x4F, 0xE3 };
+ // not used for ECB but make the code more uniform
+ byte[] iv = { 0xB0, 0x71, 0x70, 0xFC, 0x57, 0xC2, 0x26, 0xF9 };
+ byte[] expected = { 0xA3, 0xB3, 0x91, 0x00, 0x99, 0x7A, 0x15, 0xB4, 0xA3, 0xB3, 0x91, 0x00, 0x99, 0x7A, 0x15, 0xB4, 0x53, 0x35, 0xE6, 0x2D, 0x0D, 0xD1, 0x16, 0xE6 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.ECB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_ECB_PKCS7 Encrypt", expected, output);
+
+ // in ECB the first 2 blocks should be equals (as the IV is not used)
+ byte[] block1 = new byte[blockLength];
+ Array.Copy (output, 0, block1, 0, blockLength);
+ byte[] block2 = new byte[blockLength];
+ Array.Copy (output, blockLength, block2, 0, blockLength);
+ AssertEquals ("TripleDES_k192b64_ECB_PKCS7 b1==b2", block1, block2);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_ECB_PKCS7 Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_CBC_None ()
+{
+ byte[] key = { 0xA5, 0xA5, 0x3B, 0x8E, 0x59, 0x5B, 0xDD, 0xEC, 0x15, 0x22, 0x95, 0x53, 0xCB, 0xEC, 0xE3, 0x63, 0x78, 0x25, 0xF5, 0xE5, 0x52, 0xAD, 0x50, 0x1A };
+ byte[] iv = { 0xBD, 0x69, 0xAC, 0xA6, 0xCF, 0x17, 0xFC, 0x8A };
+ byte[] expected = { 0xA6, 0xA8, 0x8E, 0x09, 0xCF, 0xD2, 0x66, 0x4A, 0x20, 0xE8, 0xC3, 0x56, 0x8F, 0x2F, 0x42, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_CBC_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_CBC_None Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_CBC_Zeros ()
+{
+ byte[] key = { 0x40, 0x3D, 0xEC, 0xE5, 0xB4, 0x2A, 0x4B, 0x5E, 0x81, 0x88, 0x3A, 0x53, 0x3F, 0xFD, 0xE7, 0x55, 0x50, 0x21, 0xAA, 0x0A, 0xB4, 0x3B, 0x26, 0xC0 };
+ byte[] iv = { 0x09, 0x50, 0xF5, 0x6F, 0x18, 0xD1, 0x4C, 0x9E };
+ byte[] expected = { 0x85, 0xFA, 0xBF, 0x39, 0x5C, 0x17, 0x13, 0xF1, 0x27, 0x47, 0x17, 0x97, 0xBA, 0xCD, 0x69, 0x8E, 0x0D, 0x7D, 0xC5, 0xE2, 0x8F, 0xDF, 0xFC, 0x2B };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_CBC_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_CBC_Zeros Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_CBC_PKCS7 ()
+{
+ byte[] key = { 0x31, 0x9E, 0x55, 0x57, 0x3F, 0x77, 0xBC, 0x27, 0x79, 0x45, 0x7E, 0xAA, 0x4F, 0xF1, 0x2E, 0xBB, 0x98, 0xAE, 0xFD, 0xBE, 0x22, 0xB8, 0x69, 0xD9 };
+ byte[] iv = { 0xF7, 0xD8, 0x8E, 0xB2, 0xC5, 0x5F, 0x49, 0x91 };
+ byte[] expected = { 0x0D, 0xB8, 0xC7, 0x8F, 0x89, 0x26, 0x42, 0x50, 0x5E, 0x3A, 0x3B, 0x4D, 0xC8, 0x0E, 0x7E, 0x0F, 0xDA, 0x79, 0x37, 0x89, 0x2A, 0xF6, 0x10, 0x76 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CBC;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_CBC_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_CBC_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters TripleDES_k192b64_CTS_None. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters TripleDES_k192b64_CTS_Zeros. Why? Specified cipher mode is not valid for this algorithm. */
+
+/* Invalid parameters TripleDES_k192b64_CTS_PKCS7. Why? Specified cipher mode is not valid for this algorithm. */
+
+public void TestTripleDES_k192b64_CFB8_None ()
+{
+ byte[] key = { 0x6C, 0x11, 0xA9, 0xC8, 0x04, 0xB3, 0x74, 0x8A, 0xA0, 0xC7, 0x43, 0x9A, 0x1F, 0x4C, 0x79, 0x08, 0x4D, 0xB4, 0x7B, 0xAC, 0xA2, 0xF8, 0x2C, 0x22 };
+ byte[] iv = { 0x2E, 0xF8, 0x02, 0x62, 0x15, 0xE2, 0x8F, 0xB1 };
+ byte[] expected = { 0x95, 0x55, 0x48, 0xF1, 0x6D, 0x6F, 0x36, 0x25, 0xAE, 0x02, 0x0B, 0x6E, 0xC3, 0x04, 0xC5, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.None;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_CFB8_None Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_CFB8_None Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_CFB8_Zeros ()
+{
+ byte[] key = { 0x34, 0x38, 0x7F, 0x40, 0xBA, 0x64, 0x88, 0xAC, 0x50, 0xE5, 0x0D, 0x9D, 0xC4, 0x0B, 0xDF, 0xE8, 0xB7, 0xCB, 0x9D, 0x38, 0xFD, 0x4E, 0x17, 0xDA };
+ byte[] iv = { 0xC0, 0x32, 0xAE, 0xA8, 0xEB, 0x67, 0x74, 0xC4 };
+ byte[] expected = { 0x8A, 0xE3, 0xAD, 0x43, 0x06, 0xAC, 0xC7, 0xE7, 0xCC, 0x03, 0xCE, 0xB1, 0x8F, 0x9F, 0x7A, 0x9E, 0xEB, 0x05, 0x74, 0x04, 0xF4, 0xFD, 0x76, 0x51 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.Zeros;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_CFB8_Zeros Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_CFB8_Zeros Decrypt", input, original);
+}
+
+
+public void TestTripleDES_k192b64_CFB8_PKCS7 ()
+{
+ byte[] key = { 0xBC, 0x48, 0x95, 0x9F, 0x13, 0xFF, 0xCB, 0x33, 0x6D, 0xA5, 0x84, 0x93, 0x33, 0x54, 0xAD, 0xF4, 0x5F, 0x99, 0xA3, 0x0F, 0x0E, 0x91, 0x88, 0x0E };
+ byte[] iv = { 0x0E, 0xC5, 0xA8, 0xB2, 0xDD, 0x83, 0xAE, 0x8C };
+ byte[] expected = { 0xB5, 0x72, 0x20, 0x82, 0x45, 0x70, 0x83, 0xE5, 0xF0, 0xA6, 0xFC, 0xFC, 0xB6, 0xF4, 0x7D, 0x3B, 0x71, 0x94, 0x2A, 0x9F, 0x01, 0x46, 0x90, 0x56 };
+
+ SymmetricAlgorithm algo = TripleDES.Create ();
+ algo.Mode = CipherMode.CFB;
+ algo.Padding = PaddingMode.PKCS7;
+ algo.BlockSize = 64;
+ algo.FeedbackSize = 8;
+ int blockLength = (algo.BlockSize >> 3);
+ byte[] input = new byte [blockLength * 2 + (blockLength >> 1)];
+ byte[] output = new byte [blockLength * 3];
+ ICryptoTransform encryptor = algo.CreateEncryptor(key, iv);
+ Encrypt (encryptor, input, output);
+ AssertEquals ("TripleDES_k192b64_CFB8_PKCS7 Encrypt", expected, output);
+ byte[] reverse = new byte [blockLength * 3];
+ ICryptoTransform decryptor = algo.CreateDecryptor(key, iv);
+ Decrypt (decryptor, output, reverse);
+ byte[] original = new byte [input.Length];
+ Array.Copy (reverse, 0, original, 0, original.Length);
+ AssertEquals ("TripleDES_k192b64_CFB8_PKCS7 Decrypt", input, original);
+}
+
+
+/* Invalid parameters TripleDES_k192b64_OFB8_None. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters TripleDES_k192b64_OFB8_Zeros. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+/* Invalid parameters TripleDES_k192b64_OFB8_PKCS7. Why? Output feedback mode (OFB) is not supported by this implementation. */
+
+
+// Number of test cases: 189
+// Number of invalid (non-generated) test cases: 171
+}
+}
+
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs b/mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs
new file mode 100644
index 00000000000..004753c2bd0
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs
@@ -0,0 +1,28 @@
+//
+// MonoTests.System.Security.Permissions.AllTests.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Permissions {
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (FileIOPermissionTest.Suite);
+ suite.AddTest (StrongNamePublicKeyBlobTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog b/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
new file mode 100644
index 00000000000..ce465d2878f
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
@@ -0,0 +1,28 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-12-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ AllTests.cs: Added StrongNamePublicKeyBlobTest suite.
+ StrongNamePublicKeyBlobTest.cs: New. Test suite for
+ StrongNamePublicKeyBlob.
+
+2002-06-18 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermissionTest.cs: Use Unix paths if it looks like we are not
+ running the tests on Windows. Need to expand this when we run the
+ tests on Mac OS's (and others I suppose). Also consolidated some
+ redundant code.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermissionTest.cs: Remove intersect test where it was trying
+ to intersect a permission with itself. This throws an exception
+ with mscorlib.
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermissionTest.cs: New File.
+ * AllTests.cs: New File.
+
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
new file mode 100644
index 00000000000..89033aa8535
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
@@ -0,0 +1,287 @@
+//
+// MonoTests.System.Security.Permissions.FileIOPermissionTest.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak II
+//
+// Note: Only Unix and Windows file paths are tested. To run the tests on Mac OS's
+// search for the "FIXME" notes below and adjust accordingly.
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.IO;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Permissions {
+
+ public class FileIOPermissionTest : TestCase {
+
+ string[] pathArrayGood;
+ string[] pathArrayBad;
+ FileIOPermission p;
+ FileIOPermission p2;
+ string[] pathsInPermission;
+ string[] pathArrayGood2;
+ FileIOPermission unrestricted;
+
+ protected override void SetUp() {
+ p = null;
+ pathsInPermission = null;
+ pathArrayGood = new string[2];
+ pathArrayBad = new string[2];
+ pathArrayGood2 = new string[3];
+ // FIXME: Adjust to run on Mac OS's
+ if (Path.VolumeSeparatorChar == ':') {
+ pathArrayGood[0] = "c:\\temp1";
+ pathArrayGood[1] = "d:\\temp2";
+ pathArrayBad[0] = "c:\\temp1";
+ pathArrayBad[1] = "d:\\temp*";
+ pathArrayGood2[0] = "c:\\temp1";
+ pathArrayGood2[1] = "d:\\temp2";
+ pathArrayGood2[2] = "z:\\something";
+ }
+ else {
+ pathArrayGood[0] = "/temp1";
+ pathArrayGood[1] = "/usr/temp2";
+ pathArrayBad[0] = "/temp1";
+ pathArrayBad[1] = "/usr/temp*";
+ pathArrayGood2[0] = "/temp1";
+ pathArrayGood2[1] = "/usr/temp2";
+ pathArrayGood2[2] = "/usr/bin/something";
+ }
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestConstructorPermissionState() {
+ p = new FileIOPermission(PermissionState.None);
+ AssertEquals("Should be Restricted", false, p.IsUnrestricted());
+ p = new FileIOPermission(PermissionState.Unrestricted);
+ AssertEquals("Should be Unrestricted", true, p.IsUnrestricted());
+ try{
+ p = new FileIOPermission((PermissionState)77);
+ Fail("Should have thrown an exception on invalid PermissionState");
+ }
+ catch{
+ // we should be here if things are working. nothing to do
+ }
+ }
+
+ public void TestConstructorString() {
+ try{
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "this path is not rooted");
+ Fail("Should have thrown an exception on path not rooted");
+ }
+ catch{}
+
+ try{
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "<this is not a valid path>");
+ Fail("Should have thrown an exception on invalid characters in path");
+ }
+ catch{}
+
+ try{
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "\\\\mycomputer\\test*");
+ Fail("Should have thrown an exception on wildcards not allowed in path");
+ }
+ catch{}
+
+ try{
+ p = new FileIOPermission((FileIOPermissionAccess)77, "c:\\temp");
+ Fail("Should have thrown an exception on invalid access value");
+ }
+ catch{}
+
+ string pathToAdd;
+ // FIXME: Adjust to run on Mac OS's
+ if (Path.VolumeSeparatorChar == ':')
+ pathToAdd = "c:\\temp";
+ else
+ pathToAdd = "/temp";
+
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathToAdd);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Does not contain correct number of paths. Expected 1 but got: "+pathsInPermission.Length, pathsInPermission.Length == 1);
+ Assert("Does not contain expected path from constructor: "+pathToAdd, pathsInPermission[0] == pathToAdd);
+ }
+
+ public void TestConstructorStringArray() {
+ try{
+ p = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayBad);
+ Fail("Should have thrown an exception on wildcards not allowed in path");
+ }
+ catch{}
+
+ try{
+ p = new FileIOPermission((FileIOPermissionAccess)77, pathArrayGood);
+ Fail("Should have thrown an exception on invalid access value");
+ }
+ catch{}
+
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Does not contain correct number of paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ foreach (string s in pathsInPermission){
+ Assert("Unexpected path in the Permission: " + s, Array.IndexOf(pathsInPermission, s) >=0);
+ }
+
+ }
+
+ public void TestAddPathListStringArray() {
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Does not contain correct number of paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ foreach (string s in pathsInPermission){
+ Assert("Unexpected path in the Permission: " + s, Array.IndexOf(pathsInPermission, s) >=0);
+ }
+
+ p.AddPathList(FileIOPermissionAccess.Append, pathArrayGood);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should still contain correct number Read paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ foreach (string s in pathsInPermission){
+ Assert("Unexpected path in the Permission: " + s, Array.IndexOf(pathsInPermission, s) >=0);
+ }
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Append);
+ Assert("Should contain correct number of Append paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ foreach (string s in pathsInPermission){
+ Assert("Unexpected path in the Permission: " + s, Array.IndexOf(pathsInPermission, s) >=0);
+ }
+ }
+
+ public void TestIntersect() {
+ FileIOPermission intersection;
+
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ p.AllFiles = FileIOPermissionAccess.Append;
+ p.AllLocalFiles = FileIOPermissionAccess.Write;
+
+ unrestricted = new FileIOPermission(PermissionState.Unrestricted);
+
+ intersection = (FileIOPermission)p.Intersect(unrestricted);
+ pathsInPermission = intersection.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should contain correct number of Read paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ Assert("Should have Append bit in AllFiles.", (intersection.AllFiles & FileIOPermissionAccess.Append) != 0);
+ Assert("Should have Write bit in AllLocalFiles.", (intersection.AllLocalFiles & FileIOPermissionAccess.Write) != 0);
+
+ intersection = (FileIOPermission)unrestricted.Intersect(p);
+ pathsInPermission = intersection.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should contain correct number of Read paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ Assert("Should have Append bit in AllFiles.", (intersection.AllFiles & FileIOPermissionAccess.Append) != 0);
+ Assert("Should have Write bit in AllLocalFiles.", (intersection.AllLocalFiles & FileIOPermissionAccess.Write) != 0);
+
+ p2 = new FileIOPermission(FileIOPermissionAccess.Append | FileIOPermissionAccess.Read, pathArrayGood2);
+ p2.AllFiles = FileIOPermissionAccess.Append | FileIOPermissionAccess.Write;
+ p2.AllLocalFiles = FileIOPermissionAccess.Write | FileIOPermissionAccess.Read;
+ intersection = (FileIOPermission)p.Intersect(p2);
+ pathsInPermission = intersection.GetPathList(FileIOPermissionAccess.Read);
+ AssertNotNull ("Should have some paths", pathsInPermission);
+ AssertEquals ("Should contain correct number of Read paths", 2, pathsInPermission.Length);
+ AssertEquals ("Should have only Append bit in AllFiles.", FileIOPermissionAccess.Append, intersection.AllFiles);
+ AssertEquals ("Should have only Write bit in AllLocalFiles.", FileIOPermissionAccess.Write, intersection.AllLocalFiles);
+
+ intersection = (FileIOPermission)p2.Intersect(p);
+ pathsInPermission = intersection.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should contain correct number of Read paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
+ Assert("Should have only Append bit in AllFiles.", intersection.AllFiles == FileIOPermissionAccess.Append);
+ Assert("Should have only Write bit in AllLocalFiles.", intersection.AllLocalFiles == FileIOPermissionAccess.Write);
+ }
+
+ public void TestIsSubsetOf() {
+ unrestricted = new FileIOPermission(PermissionState.Unrestricted);
+ Assert("IsSubsetOf reflective test failed", unrestricted.IsSubsetOf(unrestricted));
+
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ p.AllFiles = FileIOPermissionAccess.Append;
+ p.AllLocalFiles = FileIOPermissionAccess.Write;
+ Assert("#1 IsSubsetOf reflective test failed", p.IsSubsetOf(p));
+ Assert("#1 IsSubsetOf false test failed", !unrestricted.IsSubsetOf(p));
+ Assert("#1 IsSubsetOf true test failed", p.IsSubsetOf(unrestricted));
+
+ p2 = new FileIOPermission(FileIOPermissionAccess.Append | FileIOPermissionAccess.Read, pathArrayGood2);
+ p2.AllFiles = FileIOPermissionAccess.Append | FileIOPermissionAccess.Write;
+ p2.AllLocalFiles = FileIOPermissionAccess.Write | FileIOPermissionAccess.Read;
+ Assert("#2 IsSubsetOf reflective test failed", p2.IsSubsetOf(p2));
+ Assert("#2 IsSubsetOf true test failed", p.IsSubsetOf(p2));
+ Assert("#2 IsSubsetOf false test failed", !p2.IsSubsetOf(p));
+ }
+
+ public void TestUnion() {
+ FileIOPermission union;
+
+ unrestricted = new FileIOPermission(PermissionState.Unrestricted);
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ union = (FileIOPermission)unrestricted.Union(p);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should get an unrestricted permission", union.IsUnrestricted());
+ Assert("Path list should be empty", pathsInPermission == null);
+
+ union = (FileIOPermission)p.Union(unrestricted);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should get an unrestricted permission", union.IsUnrestricted());
+ Assert("Path list should be empty", pathsInPermission == null);
+
+ p2 = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayGood2);
+
+ union = (FileIOPermission)p.Union(p2);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == pathArrayGood.Length);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Append);
+ Assert("Path list should have 3 for Append", pathsInPermission.Length == pathArrayGood2.Length);
+
+ union = (FileIOPermission)p2.Union(p);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == pathArrayGood.Length);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Append);
+ Assert("Path list should have 3 for Append", pathsInPermission.Length == pathArrayGood2.Length);
+ }
+
+ public void TestFromXML() {
+ p = new FileIOPermission(PermissionState.None);
+ SecurityElement esd;
+
+ esd = new SecurityElement("IPermission");
+ esd.AddAttribute("class", "FileIOPermission");
+ esd.AddAttribute("version", "1");
+ esd.AddAttribute("Unrestricted", "true");
+ p.FromXml(esd);
+ Assert("Should get an unrestricted permission", p.IsUnrestricted());
+
+ esd = new SecurityElement("IPermission");
+ esd.AddAttribute("class", "FileIOPermission");
+ esd.AddAttribute("version", "1");
+ // FIXME: Adjust to run on Mac OS's
+ if (Path.VolumeSeparatorChar == ':') {
+ esd.AddAttribute("Read", "c:\\temp;d:\\temp2");
+ esd.AddAttribute("Write", "c:\\temp;d:\\temp2;z:\\temp3");
+ }
+ else {
+ esd.AddAttribute("Read", "/temp;/usr/temp2");
+ esd.AddAttribute("Write", "/temp;/usr/temp2;/usr/bin/temp3");
+ }
+ p = new FileIOPermission(PermissionState.None);
+ p.FromXml(esd);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == 2);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Write);
+ Assert("Path list should have 2 for Write", pathsInPermission.Length == 3);
+ }
+
+ public void TestToXML() {
+ SecurityElement esd;
+ string read;
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ esd = p.ToXml();
+ Assert("Esd tag incorrect", esd.Tag == "IPermission");
+ Assert("Esd version incorrect", (String)esd.Attributes["version"] == "1");
+ read = (String)esd.Attributes["Read"];
+ pathsInPermission = read.Split(';');
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == 2);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/StrongNamePublicKeyBlobTest.cs b/mcs/class/corlib/Test/System.Security.Permissions/StrongNamePublicKeyBlobTest.cs
new file mode 100644
index 00000000000..7216e038335
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/StrongNamePublicKeyBlobTest.cs
@@ -0,0 +1,69 @@
+//
+// StrongNamePublicKeyBlobTest.cs - NUnit Test Cases for StrongNamePublicKeyBlob
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Permissions {
+
+public class StrongNamePublicKeyBlobTest : TestCase {
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ static byte[] bad = { 0xB, 0xAD };
+ // should be a valid one (see StrongNameKeyPairTest.cs)
+ static byte[] pk = { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB };
+
+
+ public void TestNull ()
+ {
+ try {
+ StrongNamePublicKeyBlob snpkb = new StrongNamePublicKeyBlob (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ public void TestInvalidPublicKey ()
+ {
+ StrongNamePublicKeyBlob snpkb = new StrongNamePublicKeyBlob (bad);
+ // Proof that there's no validation on public key
+ AssertEquals ("ToString(BAD)", "0BAD", snpkb.ToString ());
+ }
+
+ public void TestPublicKey ()
+ {
+ StrongNamePublicKeyBlob snpkb = new StrongNamePublicKeyBlob (pk);
+ Assert ("Equals(Self)", snpkb.Equals (snpkb));
+ AssertEquals ("ToString(pk)", "00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB", snpkb.ToString ());
+
+ StrongNamePublicKeyBlob snpkb2 = new StrongNamePublicKeyBlob (pk);
+ Assert ("Equals()-true", snpkb.Equals (snpkb2));
+ StrongNamePublicKeyBlob snpkb3 = new StrongNamePublicKeyBlob (bad);
+ Assert ("Equals()-false", !snpkb.Equals (snpkb3));
+
+ // non standard get hash code - why ???
+ // It seems to be the first four bytes of the public key data
+ // which seems like non sense as all valid public key will have the same header ?
+ AssertEquals ("GetHashCode-1", 2359296, snpkb.GetHashCode ());
+ AssertEquals ("GetHashCode-2", 2359296, snpkb2.GetHashCode ());
+ AssertEquals ("GetHashCode-3", 2989, snpkb3.GetHashCode ());
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Policy/AllTests.cs b/mcs/class/corlib/Test/System.Security.Policy/AllTests.cs
new file mode 100644
index 00000000000..7a6f72cc34b
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/AllTests.cs
@@ -0,0 +1,31 @@
+//
+// MonoTests.System.Security.Policy.AllTests.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Policy {
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (CodeGroupTest.Suite);
+ suite.AddTest (EvidenceTest.Suite);
+ suite.AddTest (PublisherTest.Suite);
+ suite.AddTest (PublisherMembershipConditionTest.Suite);
+ suite.AddTest (StrongNameTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/ChangeLog b/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
new file mode 100644
index 00000000000..8d2af6b02f5
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
@@ -0,0 +1,36 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-12-16 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added test suites for StrongName.
+ * StrongNameTest.cs: New. Test suite for StrongName (complete).
+
+2002-12-15 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllTests.cs: Added test suites for Publisher and
+ PublisherMembershipCondition.
+ * PublisherTest.cs: New. Test suite for Publisher (complete).
+ * PublisherMembershipConditionTest.cs: New. Test suite for Publisher
+ PublisherMembershipCondition (incomplete).
+
+2002-10-28 Jackson Harper <jackson@latitudegeo.com>
+
+ * AllTests.cs EvidenceTest.cs: Added test for Evidence class
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add new file.
+
+2002-02-07 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroupTest.cs: Tests everything except the (To|From)Xml methods.
+
+2002-02-01 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroupTest.cs: Still not done, checking in now just in case
+
+2002-01-30 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroupTest.cs: New File. Not done, but checking in now just in case
diff --git a/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
new file mode 100644
index 00000000000..a9b108bf18e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
@@ -0,0 +1,232 @@
+//
+// MonoTests.System.Security.Policy.CodeGroupTest
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak, All rights reserved.
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Policy;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Policy
+{
+
+ public class CodeGroupTest : TestCase
+ {
+
+ protected override void SetUp()
+ {
+ }
+
+ public class MyCodeGroup : CodeGroup
+ {
+ public MyCodeGroup(IMembershipCondition membershipCondition,
+ PolicyStatement policy) :base(membershipCondition, policy)
+ {
+ }
+
+ public override CodeGroup Copy()
+ {
+ return this;
+ }
+
+ public override string MergeLogic
+ {
+ get
+ {
+ return "";
+ }
+ }
+
+ public override PolicyStatement Resolve( Evidence evidence)
+ {
+ return (PolicyStatement)null;
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
+ {
+ return this;
+ }
+ }
+
+ public void TestConstructorExceptions()
+ {
+ MyCodeGroup cg;
+ try
+ {
+ cg = new MyCodeGroup(null, null);
+ Fail("Constructor should throw exception on null paramters");
+ }
+ catch(Exception e)
+ {
+ Assert("Should have caught an ArgumentNull Exception", e is ArgumentNullException);
+ }
+ }
+
+ public void TestConstructor()
+ {
+ MyCodeGroup cg = null;
+ try
+ {
+ cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ Assert("PolicyStatement property not set correctly by constructor.", cg.PolicyStatement != null);
+ Assert("MembershipCondition property not set correctly by constructor.", cg.MembershipCondition != null);
+ }
+ catch(Exception e)
+ {
+ Fail("Constructor failed. Exception caught was: " + e.ToString());
+ }
+ }
+
+ public void TestDescriptionProperty()
+ {
+ MyCodeGroup cg = null;
+ const string description = "Test Description";
+ cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ cg.Description = description;
+ Assert("Description not the expected value", cg.Description == description);
+ }
+
+ public void TestNameProperty()
+ {
+ MyCodeGroup cg = null;
+ const string name = "Test Name";
+ cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ cg.Name = name;
+ Assert("Description not the expected value", cg.Name == name);
+ }
+
+ public void TestChildren()
+ {
+ MyCodeGroup cg = null;
+ cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ cg.AddChild(new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.Unrestricted))));
+ Assert("Unexpected number of children", cg.Children.Count == 1);
+ }
+
+ public void TestAttributeStringProperty()
+ {
+ MyCodeGroup cg = null;
+ PolicyStatementAttribute psa = PolicyStatementAttribute.LevelFinal;
+ PolicyStatement ps = new PolicyStatement(new PermissionSet(PermissionState.None));
+ ps.Attributes = psa;
+ cg = new MyCodeGroup(new AllMembershipCondition(), ps);
+ AssertEquals("AttributeString", psa.ToString(), cg.AttributeString);
+ }
+
+ public void TestPermissionSetNameProperty()
+ {
+ MyCodeGroup cg = null;
+ const string ps_Name = "TestName";
+ PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
+ cg = new MyCodeGroup(new AllMembershipCondition(), ps);
+ AssertEquals("AttributeString", ps_Name, cg.PermissionSetName);
+ }
+
+ public void TestEquals()
+ {
+ MyCodeGroup cg = null;
+ MyCodeGroup cg2 = null;
+ const string ps_Name = "TestName";
+ PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
+ cg = new MyCodeGroup(new AllMembershipCondition(), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ bool isEquals;
+ isEquals = cg.Equals(cg);
+
+ isEquals = cg.Equals("Not Equal to this");
+ Assert("CodeGroup should not be equal to a non-CodeGroup type", !isEquals);
+
+ cg2 = new MyCodeGroup(new AllMembershipCondition(), ps);
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+
+ isEquals = cg.Equals(cg2);
+ Assert("CodeGroup should not be equal when Name or Description is different", !isEquals);
+
+ cg2 = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
+ cg2.Name = cg.Name;
+ cg2.Description = cg.Description;
+ isEquals = cg.Equals(cg2);
+ Assert("CodeGroup should not be equal when Membership Condition is different", !isEquals);
+ }
+
+ public void TestEqualsWithChildren()
+ {
+ MyCodeGroup cg = null;
+ MyCodeGroup cg2 = null;
+ MyCodeGroup cgChild = null;
+ const string ps_Name = "TestName";
+ bool isEquals;
+
+ PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
+ cg = new MyCodeGroup(new AllMembershipCondition(), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+
+ cgChild = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+
+ cg.AddChild(cgChild);
+
+ cg2 = new MyCodeGroup(cg.MembershipCondition, cg.PolicyStatement);
+ cg2.Name = cg.Name;
+ cg2.Description = cg.Description;
+
+ isEquals = cg.Equals(cg2);
+ Assert("Should be equal when Children are ignored", isEquals);
+
+ isEquals = cg.Equals(cg2, true);
+ Assert("Should not be equal when Child count is different", !isEquals);
+
+ cg2.AddChild(cgChild);
+ isEquals = cg2.Equals(cg, true);
+ Assert("Should be equal when children are equal", isEquals);
+ }
+
+
+ public void TestRemoveChild()
+ {
+ MyCodeGroup cg = null;
+ MyCodeGroup cgChild = null;
+ MyCodeGroup cgChild2 = null;
+ const string ps_Name = "TestName";
+
+ PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
+ cg = new MyCodeGroup(new AllMembershipCondition(), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+
+ cgChild = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+
+ cg.AddChild(cgChild);
+
+ cgChild2 = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
+ cgChild2.Name = "ChildName2";
+ cgChild2.Description = "Child Descripiton 2";
+
+ cg.AddChild(cgChild2);
+
+ AssertEquals("Should be two children before the call to Remove()", 2, cg.Children.Count);
+
+ cg.RemoveChild(cgChild);
+
+ AssertEquals("Remaing child does not have correct name", "ChildName2", ((CodeGroup)cg.Children[0]).Name);
+ try
+ {
+ cg.RemoveChild(cgChild);
+ Fail("Should have throw error on trying to remove non-existant child");
+ }
+ catch{}
+ }
+ } // public class CodeGroupTest
+
+} // namespace MonoTests.System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs b/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs
new file mode 100644
index 00000000000..23cfffaf110
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs
@@ -0,0 +1,265 @@
+//
+// MonoTests.System.Security.Policy.EvidenceTest
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2001 Jackson Harper, All rights reserved.
+
+
+using System;
+using System.Collections;
+using System.Security.Policy;
+using NUnit.Framework;
+
+
+namespace MonoTests.System.Security.Policy
+{
+
+ public class EvidenceTest : TestCase
+ {
+
+ protected override void SetUp()
+ {
+ }
+
+ public void TestDefaultConstructor()
+ {
+ Evidence evidence = new Evidence ();
+
+ AssertEquals ("Default constructor count should be zero", evidence.Count, 0);
+ AssertEquals ("Default constructor host enumerator MoveNext() should be false",
+ evidence.GetHostEnumerator().MoveNext(), false);
+ AssertEquals ("Default constructor assembly enumerator MoveNext() should be false",
+ evidence.GetAssemblyEnumerator().MoveNext(), false);
+ AssertEquals ("Default constructor enumerator MoveNext() should be false",
+ evidence.GetEnumerator().MoveNext(), false);
+ }
+
+ public void TestMultipleConstructor() {
+ Evidence evidence;
+ object[] hostarray = new object[10];
+ object[] assemarray = new object[10];
+
+ evidence = new Evidence ( hostarray, assemarray );
+
+ AssertEquals ( "Count of multiple arg constructor should equal 20", evidence.Count, 20 );
+ }
+
+ public void TestCopyConstructor()
+ {
+ Evidence evidence1, evidence2;
+ object[] hostlist = { "host-1", "host-2", "host-3", "host-4" };
+ object[] asmblist = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
+
+ evidence1 = new Evidence (hostlist, asmblist);
+ evidence2 = new Evidence (evidence1);
+
+ AssertEquals("Copy constructor counts do not match", evidence1.Count, evidence2.Count);
+ }
+
+ public void TestAddAssembly()
+ {
+ Evidence evidence = new Evidence ();
+ object[] comparray = new object[100];
+ string obj;
+ int index;
+
+ for (int i=0; i<100; i++) {
+ obj = String.Format ("asmb-{0}", i+1);
+ comparray[i] = obj;
+ evidence.AddAssembly (obj);
+ AssertEquals (evidence.Count, i+1);
+ }
+
+ index = 0;
+ foreach (object compobj in evidence) {
+ AssertEquals ("Comparison object does not equal evidence assembly object",
+ comparray[index++], compobj);
+ }
+ }
+
+ public void TestAddHost()
+ {
+ Evidence evidence = new Evidence ();
+ object[] comparray = new object[100];
+ string obj;
+ int index;
+
+ for (int i=0; i<100; i++) {
+ obj = String.Format ("asmb-{0}", i+1);
+ comparray[i] = obj;
+ evidence.AddAssembly ( obj );
+ AssertEquals (evidence.Count, i+1);
+ }
+
+ index = 0;
+ foreach (object compobj in evidence) {
+ AssertEquals ("Comparison object does not equal evidence host object",
+ comparray[index++], compobj);
+ }
+ }
+
+ public void TestMultiArgConstructorForEach()
+ {
+ object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
+ object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
+ ArrayList compare = new ArrayList ();
+ Evidence evidence = new Evidence (hostarray, asmbarray);
+ int i;
+
+ compare.AddRange (hostarray);
+ compare.AddRange (asmbarray);
+
+ i = 0;
+ foreach (object obj in evidence) {
+ AssertEquals (obj, compare[i++]);
+ }
+ }
+
+ public void TestEnumeratorReset()
+ {
+ object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
+ object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
+ ArrayList compare = new ArrayList ();
+ Evidence evidence = new Evidence (hostarray, asmbarray);
+ IEnumerator enumerator;
+ int i;
+
+ compare.AddRange (hostarray);
+ compare.AddRange (asmbarray);
+
+ i = 0;
+ enumerator = evidence.GetEnumerator ();
+ while (enumerator.MoveNext ()) {
+ AssertEquals (enumerator.Current, compare[i++]);
+ }
+
+ enumerator.Reset ();
+ i = 0;
+ while (enumerator.MoveNext ()) {
+ AssertEquals (enumerator.Current, compare[i++]);
+ }
+ }
+
+ public void TestGetHostEnumerator()
+ {
+ object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
+ object[] asmbarray = { "asmb-1", "asmb-2" };
+ Evidence evidence;
+ IEnumerator enumerator;
+ int i;
+
+ evidence = new Evidence (hostarray, asmbarray);
+ enumerator = evidence.GetHostEnumerator ();
+
+ i = 0;
+ while (enumerator.MoveNext ()) {
+ AssertEquals (enumerator.Current, hostarray[i++]);
+ }
+ }
+
+
+ public void TestGetHostAssemblyEnumerator()
+ {
+ object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
+ object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
+ Evidence evidence;
+ IEnumerator enumerator;
+ int i;
+
+ evidence = new Evidence (hostarray, asmbarray);
+ enumerator = evidence.GetAssemblyEnumerator ();
+
+ i = 0;
+ while (enumerator.MoveNext()) {
+ AssertEquals (enumerator.Current, asmbarray[i++]);
+ }
+
+ }
+
+ public void TestCount()
+ {
+ object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
+ object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
+ Evidence evidence;
+
+ evidence = new Evidence (hostarray, asmbarray);
+ Assertion.AssertEquals (evidence.Count, 8);
+
+ for( int i=0; i<100; i++ ) {
+ if ( 0 == i%2 ) {
+ evidence.AddHost (String.Format ("host-{0}", i + 5) );
+ } else {
+ evidence.AddAssembly (String.Format ("asmb-{0}", i + 5));
+ }
+ AssertEquals (evidence.Count, 9 + i);
+ }
+ }
+
+ public void TestNullCopyToException()
+ {
+ Evidence evidence;
+
+ evidence = new Evidence ();
+ evidence.AddHost ("host-1");
+
+ try {
+ evidence.CopyTo (null, 100);
+ Fail ("CopyTo should throw exception when recieving a null array");
+ } catch (Exception e) {
+ Assert ("Should have caught an ArgumentNull Exception", e is ArgumentNullException);
+ }
+ }
+
+ /// <summary>
+ /// No Exception will be generated because the copy won't run because the evidence list is empty
+ /// </summary>
+ public void TestCopyToNoException()
+ {
+ Evidence evidence = new Evidence ();;
+
+ evidence.CopyTo (null, 100);
+ }
+
+ public void TestArgOutOfRangeCopyToException()
+ {
+ Evidence evidence = new Evidence (new object[10], new object[10]);
+
+ try {
+ evidence.CopyTo (new object[10], -100);
+ Fail ("CopyTo should throw exception when recieving a negative index");
+ } catch (Exception e) {
+ Assert("Should have caught an ArgumentOutOfRangeException Exception",
+ e is ArgumentOutOfRangeException);
+ }
+ }
+
+ /// <summary>
+ /// No Exception will be generated because the copy won't run because the evidence list is empty
+ /// </summary>
+ public void TestArgOutOfRangeCopyToNoException()
+ {
+ Evidence evidence = new Evidence ();
+
+ evidence.CopyTo (new object[10], -100);
+ }
+
+ public void BadMergeTest() {
+ Evidence evidence, evidence2;
+
+ evidence = new Evidence (null, null);
+ evidence2 = new Evidence ();
+ }
+
+ public void MergeTest() {
+ Evidence evidence, evidence2;
+
+ evidence = new Evidence (new object[10], new object[10]);
+ evidence2 = new Evidence ();
+
+ evidence2.Merge (evidence);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs
new file mode 100644
index 00000000000..74363d8c3af
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs
@@ -0,0 +1,115 @@
+//
+// PublisherMembershipConditionTest.cs - NUnit Test Cases for PublisherMembershipCondition
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+public class PublisherMembershipConditionTest : TestCase {
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ static byte[] msSpCert = { 0x30, 0x82, 0x05, 0x0F, 0x30, 0x82, 0x03, 0xF7, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0A, 0x61, 0x07, 0x11, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0xA6, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20, 0x4D, 0x69, 0x63, 0x72,
+ 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1A, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x53, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x50, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x32, 0x30, 0x35, 0x32, 0x35, 0x30, 0x30, 0x35, 0x35, 0x34, 0x38, 0x5A, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x31, 0x32, 0x35, 0x30, 0x31, 0x30, 0x35, 0x34, 0x38, 0x5A, 0x30, 0x81, 0xA1, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61,
+ 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x32, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xAA, 0x99, 0xBD, 0x39, 0xA8, 0x18, 0x27, 0xF4, 0x2B, 0x3D, 0x0B, 0x4C, 0x3F, 0x7C, 0x77, 0x2E, 0xA7, 0xCB, 0xB5, 0xD1, 0x8C, 0x0D, 0xC2, 0x3A, 0x74, 0xD7, 0x93, 0xB5, 0xE0, 0xA0, 0x4B, 0x3F, 0x59, 0x5E, 0xCE, 0x45, 0x4F, 0x9A, 0x79, 0x29, 0xF1, 0x49, 0xCC, 0x1A, 0x47, 0xEE, 0x55, 0xC2, 0x08,
+ 0x3E, 0x12, 0x20, 0xF8, 0x55, 0xF2, 0xEE, 0x5F, 0xD3, 0xE0, 0xCA, 0x96, 0xBC, 0x30, 0xDE, 0xFE, 0x58, 0xC8, 0x27, 0x32, 0xD0, 0x85, 0x54, 0xE8, 0xF0, 0x91, 0x10, 0xBB, 0xF3, 0x2B, 0xBE, 0x19, 0xE5, 0x03, 0x9B, 0x0B, 0x86, 0x1D, 0xF3, 0xB0, 0x39, 0x8C, 0xB8, 0xFD, 0x0B, 0x1D, 0x3C, 0x73, 0x26, 0xAC, 0x57, 0x2B, 0xCA, 0x29, 0xA2, 0x15, 0x90, 0x82, 0x15, 0xE2, 0x77, 0xA3, 0x40, 0x52, 0x03, 0x8B, 0x9D, 0xC2, 0x70, 0xBA, 0x1F, 0xE9, 0x34, 0xF6, 0xF3, 0x35, 0x92, 0x4E, 0x55, 0x83, 0xF8, 0xDA, 0x30, 0xB6, 0x20, 0xDE, 0x57, 0x06, 0xB5, 0x5A, 0x42, 0x06, 0xDE, 0x59, 0xCB, 0xF2, 0xDF, 0xA6, 0xBD, 0x15, 0x47, 0x71, 0x19, 0x25, 0x23, 0xD2, 0xCB, 0x6F, 0x9B, 0x19, 0x79, 0xDF, 0x6A, 0x5B, 0xF1, 0x76, 0x05, 0x79, 0x29, 0xFC, 0xC3, 0x56, 0xCA, 0x8F, 0x44, 0x08, 0x85, 0x55, 0x8A, 0xCB, 0xC8, 0x0F, 0x46, 0x4B, 0x55, 0xCB, 0x8C, 0x96, 0x77, 0x4A, 0x87, 0xE8, 0xA9, 0x41, 0x06, 0xC7, 0xFF, 0x0D, 0xE9, 0x68, 0x57, 0x63, 0x72, 0xC3, 0x69, 0x57, 0xB4, 0x43, 0xCF, 0x32, 0x3A, 0x30, 0xDC,
+ 0x1B, 0xE9, 0xD5, 0x43, 0x26, 0x2A, 0x79, 0xFE, 0x95, 0xDB, 0x22, 0x67, 0x24, 0xC9, 0x2F, 0xD0, 0x34, 0xE3, 0xE6, 0xFB, 0x51, 0x49, 0x86, 0xB8, 0x3C, 0xD0, 0x25, 0x5F, 0xD6, 0xEC, 0x9E, 0x03, 0x61, 0x87, 0xA9, 0x68, 0x40, 0xC7, 0xF8, 0xE2, 0x03, 0xE6, 0xCF, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x40, 0x30, 0x82, 0x01, 0x3C, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x06, 0xC0, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6B, 0xC8, 0xC6, 0x51, 0x20, 0xF0, 0xB4, 0x2F, 0xD3, 0xA0, 0xB6, 0xAE, 0x7F, 0x5E, 0x26, 0xB2, 0xB8, 0x87, 0x52, 0x29, 0x30, 0x81, 0xA9, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xA1, 0x30, 0x81, 0x9E, 0x80, 0x14, 0x29, 0x5C, 0xB9, 0x1B, 0xB6, 0xCD, 0x33, 0xEE, 0xBB, 0x9E, 0x59, 0x7D, 0xF7, 0xE5, 0xCA, 0x2E, 0xC4, 0x0D, 0x34, 0x28, 0xA1, 0x74,
+ 0xA4, 0x72, 0x30, 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x82, 0x10, 0x6A, 0x0B, 0x99, 0x4F, 0xC0, 0x00, 0xDE, 0xAA, 0x11, 0xD4, 0xD8, 0x40, 0x9A, 0xA8, 0xBE, 0xE6, 0x30, 0x4A, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x43, 0x30, 0x41, 0x30, 0x3F, 0xA0, 0x3D, 0xA0, 0x3B, 0x86, 0x39, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x63, 0x72, 0x6C,
+ 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x43, 0x6F, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x50, 0x43, 0x41, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x35, 0x23, 0xFD, 0x13, 0x54, 0xFC, 0xE9, 0xDC, 0xF0, 0xDD, 0x0C, 0x14, 0x7A, 0xFA, 0xA7, 0xB3, 0xCE, 0xFD, 0xA7, 0x3A, 0xC8, 0xBA, 0xE5, 0xE7, 0xF6, 0x03, 0xFB, 0x53, 0xDB, 0xA7, 0x99, 0xA9, 0xA0, 0x9B, 0x36, 0x9C, 0x03, 0xEB, 0x82, 0x47, 0x1C, 0x21, 0xBD, 0x14, 0xCB, 0xE7, 0x67, 0x40, 0x09, 0xC7, 0x16, 0x91, 0x02, 0x55, 0xCE, 0x43, 0x42, 0xB4, 0xCD, 0x1B, 0x5D, 0xB0, 0xF3, 0x32, 0x04, 0x3D, 0x12, 0xE5, 0x1D, 0xA7, 0x07, 0xA7, 0x8F, 0xA3, 0x7E, 0x45, 0x55, 0x76, 0x1B, 0x96, 0x95, 0x91, 0x69, 0xF0, 0xDD, 0x38, 0xF3, 0x48, 0x89, 0xEF, 0x70, 0x40, 0xB7, 0xDB, 0xB5, 0x55,
+ 0x80, 0xC0, 0x03, 0xC4, 0x2E, 0xB6, 0x28, 0xDC, 0x0A, 0x82, 0x0E, 0xC7, 0x43, 0xE3, 0x7A, 0x48, 0x5D, 0xB8, 0x06, 0x89, 0x92, 0x40, 0x6C, 0x6E, 0xC5, 0xDC, 0xF8, 0x9A, 0xEF, 0x0B, 0xBE, 0x21, 0x0A, 0x8C, 0x2F, 0x3A, 0xB5, 0xED, 0xA7, 0xCE, 0x71, 0x87, 0x68, 0x23, 0xE1, 0xB3, 0xE4, 0x18, 0x7D, 0xB8, 0x47, 0x01, 0xA5, 0x2B, 0xC4, 0x58, 0xCB, 0xB2, 0x89, 0x6C, 0x5F, 0xFD, 0xD3, 0x2C, 0xC4, 0x6F, 0xB8, 0x23, 0xB2, 0x0D, 0xFF, 0x3C, 0xF2, 0x11, 0x45, 0x74, 0xF2, 0x09, 0x06, 0x99, 0x18, 0xDD, 0x6F, 0xC0, 0x86, 0x01, 0x18, 0x12, 0x1D, 0x2B, 0x16, 0xAF, 0x56, 0xEF, 0x65, 0x33, 0xA1, 0xEA, 0x67, 0x4E, 0xF4, 0x4B, 0x82, 0xAB, 0xE9, 0x0F, 0xDC, 0x01, 0xFA, 0xDF, 0x60, 0x7F, 0x66, 0x47, 0x5D, 0xCB, 0x2C, 0x70, 0xCC, 0x7B, 0x4E, 0xD9, 0x06, 0xB8, 0x6E, 0x8C, 0x0C, 0xFE, 0x62, 0x1E, 0x42, 0xF9, 0x93, 0x7C, 0xA2, 0xAB, 0x0A, 0x9E, 0xD0, 0x23, 0x10, 0xAE, 0x4D, 0x7B, 0x27, 0x91, 0x6F, 0x26, 0xBE, 0x68, 0xFA, 0xA6, 0x3F, 0x9F, 0x23, 0xEB, 0xC8, 0x9D, 0xBB, 0x87 };
+
+ public void TestNull ()
+ {
+ PublisherMembershipCondition pmc = null;
+
+ try {
+ pmc = new PublisherMembershipCondition (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+
+ X509Certificate x509 = new X509Certificate (msSpCert);
+ pmc = new PublisherMembershipCondition (x509);
+ try {
+ pmc.Certificate = null;
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ public void TestInvalidConstructor ()
+ {
+ byte[] n = null;
+ X509Certificate x509 = new X509Certificate (n);
+ PublisherMembershipCondition pmc = null;
+
+ try {
+ pmc = new PublisherMembershipCondition (x509);
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // having an empty certificate always break down things
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructor ()
+ {
+ X509Certificate x509 = new X509Certificate (msSpCert);
+ PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509);
+
+ Assert("Certificate", pmc.Certificate.Equals (x509));
+ AssertEquals ("GetHashCode", x509.GetHashCode (), pmc.GetHashCode ());
+
+ string s = "Publisher - 3082010A0282010100AA99BD39A81827F42B3D0B4C3F7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001";
+ AssertEquals ("ToString", s, pmc.ToString ());
+ }
+
+ public void TestCopy ()
+ {
+ X509Certificate x509 = new X509Certificate (msSpCert);
+ PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509);
+ PublisherMembershipCondition pmcCopy = (PublisherMembershipCondition) pmc.Copy ();
+
+ AssertNotNull ("Copy-Cert", pmcCopy.Certificate);
+ Assert("Copy-Equals", pmc.Equals (pmcCopy));
+ AssertEquals ("Copy-GetHashCode", pmc.GetHashCode (), pmcCopy.GetHashCode ());
+ AssertEquals ("Copy-ToString", pmc.ToString (), pmcCopy.ToString ());
+ }
+
+ public void TestXml ()
+ {
+ X509Certificate x509 = new X509Certificate (msSpCert);
+ PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509);
+ SecurityElement se = pmc.ToXml ();
+ pmc.FromXml (se);
+ // TODO
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs
new file mode 100644
index 00000000000..dcb2940e019
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs
@@ -0,0 +1,98 @@
+//
+// PublisherTest.cs - NUnit Test Cases for Publisher
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+public class PublisherTest : TestCase {
+
+ protected override void SetUp () {}
+
+ protected override void TearDown () {}
+
+ static byte[] msSpCert = { 0x30, 0x82, 0x05, 0x0F, 0x30, 0x82, 0x03, 0xF7, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0A, 0x61, 0x07, 0x11, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0xA6, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20, 0x4D, 0x69, 0x63, 0x72,
+ 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1A, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x53, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x50, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x32, 0x30, 0x35, 0x32, 0x35, 0x30, 0x30, 0x35, 0x35, 0x34, 0x38, 0x5A, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x31, 0x32, 0x35, 0x30, 0x31, 0x30, 0x35, 0x34, 0x38, 0x5A, 0x30, 0x81, 0xA1, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61,
+ 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x32, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xAA, 0x99, 0xBD, 0x39, 0xA8, 0x18, 0x27, 0xF4, 0x2B, 0x3D, 0x0B, 0x4C, 0x3F, 0x7C, 0x77, 0x2E, 0xA7, 0xCB, 0xB5, 0xD1, 0x8C, 0x0D, 0xC2, 0x3A, 0x74, 0xD7, 0x93, 0xB5, 0xE0, 0xA0, 0x4B, 0x3F, 0x59, 0x5E, 0xCE, 0x45, 0x4F, 0x9A, 0x79, 0x29, 0xF1, 0x49, 0xCC, 0x1A, 0x47, 0xEE, 0x55, 0xC2, 0x08,
+ 0x3E, 0x12, 0x20, 0xF8, 0x55, 0xF2, 0xEE, 0x5F, 0xD3, 0xE0, 0xCA, 0x96, 0xBC, 0x30, 0xDE, 0xFE, 0x58, 0xC8, 0x27, 0x32, 0xD0, 0x85, 0x54, 0xE8, 0xF0, 0x91, 0x10, 0xBB, 0xF3, 0x2B, 0xBE, 0x19, 0xE5, 0x03, 0x9B, 0x0B, 0x86, 0x1D, 0xF3, 0xB0, 0x39, 0x8C, 0xB8, 0xFD, 0x0B, 0x1D, 0x3C, 0x73, 0x26, 0xAC, 0x57, 0x2B, 0xCA, 0x29, 0xA2, 0x15, 0x90, 0x82, 0x15, 0xE2, 0x77, 0xA3, 0x40, 0x52, 0x03, 0x8B, 0x9D, 0xC2, 0x70, 0xBA, 0x1F, 0xE9, 0x34, 0xF6, 0xF3, 0x35, 0x92, 0x4E, 0x55, 0x83, 0xF8, 0xDA, 0x30, 0xB6, 0x20, 0xDE, 0x57, 0x06, 0xB5, 0x5A, 0x42, 0x06, 0xDE, 0x59, 0xCB, 0xF2, 0xDF, 0xA6, 0xBD, 0x15, 0x47, 0x71, 0x19, 0x25, 0x23, 0xD2, 0xCB, 0x6F, 0x9B, 0x19, 0x79, 0xDF, 0x6A, 0x5B, 0xF1, 0x76, 0x05, 0x79, 0x29, 0xFC, 0xC3, 0x56, 0xCA, 0x8F, 0x44, 0x08, 0x85, 0x55, 0x8A, 0xCB, 0xC8, 0x0F, 0x46, 0x4B, 0x55, 0xCB, 0x8C, 0x96, 0x77, 0x4A, 0x87, 0xE8, 0xA9, 0x41, 0x06, 0xC7, 0xFF, 0x0D, 0xE9, 0x68, 0x57, 0x63, 0x72, 0xC3, 0x69, 0x57, 0xB4, 0x43, 0xCF, 0x32, 0x3A, 0x30, 0xDC,
+ 0x1B, 0xE9, 0xD5, 0x43, 0x26, 0x2A, 0x79, 0xFE, 0x95, 0xDB, 0x22, 0x67, 0x24, 0xC9, 0x2F, 0xD0, 0x34, 0xE3, 0xE6, 0xFB, 0x51, 0x49, 0x86, 0xB8, 0x3C, 0xD0, 0x25, 0x5F, 0xD6, 0xEC, 0x9E, 0x03, 0x61, 0x87, 0xA9, 0x68, 0x40, 0xC7, 0xF8, 0xE2, 0x03, 0xE6, 0xCF, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x40, 0x30, 0x82, 0x01, 0x3C, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x06, 0xC0, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6B, 0xC8, 0xC6, 0x51, 0x20, 0xF0, 0xB4, 0x2F, 0xD3, 0xA0, 0xB6, 0xAE, 0x7F, 0x5E, 0x26, 0xB2, 0xB8, 0x87, 0x52, 0x29, 0x30, 0x81, 0xA9, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xA1, 0x30, 0x81, 0x9E, 0x80, 0x14, 0x29, 0x5C, 0xB9, 0x1B, 0xB6, 0xCD, 0x33, 0xEE, 0xBB, 0x9E, 0x59, 0x7D, 0xF7, 0xE5, 0xCA, 0x2E, 0xC4, 0x0D, 0x34, 0x28, 0xA1, 0x74,
+ 0xA4, 0x72, 0x30, 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x82, 0x10, 0x6A, 0x0B, 0x99, 0x4F, 0xC0, 0x00, 0xDE, 0xAA, 0x11, 0xD4, 0xD8, 0x40, 0x9A, 0xA8, 0xBE, 0xE6, 0x30, 0x4A, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x43, 0x30, 0x41, 0x30, 0x3F, 0xA0, 0x3D, 0xA0, 0x3B, 0x86, 0x39, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x63, 0x72, 0x6C,
+ 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x43, 0x6F, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x50, 0x43, 0x41, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x35, 0x23, 0xFD, 0x13, 0x54, 0xFC, 0xE9, 0xDC, 0xF0, 0xDD, 0x0C, 0x14, 0x7A, 0xFA, 0xA7, 0xB3, 0xCE, 0xFD, 0xA7, 0x3A, 0xC8, 0xBA, 0xE5, 0xE7, 0xF6, 0x03, 0xFB, 0x53, 0xDB, 0xA7, 0x99, 0xA9, 0xA0, 0x9B, 0x36, 0x9C, 0x03, 0xEB, 0x82, 0x47, 0x1C, 0x21, 0xBD, 0x14, 0xCB, 0xE7, 0x67, 0x40, 0x09, 0xC7, 0x16, 0x91, 0x02, 0x55, 0xCE, 0x43, 0x42, 0xB4, 0xCD, 0x1B, 0x5D, 0xB0, 0xF3, 0x32, 0x04, 0x3D, 0x12, 0xE5, 0x1D, 0xA7, 0x07, 0xA7, 0x8F, 0xA3, 0x7E, 0x45, 0x55, 0x76, 0x1B, 0x96, 0x95, 0x91, 0x69, 0xF0, 0xDD, 0x38, 0xF3, 0x48, 0x89, 0xEF, 0x70, 0x40, 0xB7, 0xDB, 0xB5, 0x55,
+ 0x80, 0xC0, 0x03, 0xC4, 0x2E, 0xB6, 0x28, 0xDC, 0x0A, 0x82, 0x0E, 0xC7, 0x43, 0xE3, 0x7A, 0x48, 0x5D, 0xB8, 0x06, 0x89, 0x92, 0x40, 0x6C, 0x6E, 0xC5, 0xDC, 0xF8, 0x9A, 0xEF, 0x0B, 0xBE, 0x21, 0x0A, 0x8C, 0x2F, 0x3A, 0xB5, 0xED, 0xA7, 0xCE, 0x71, 0x87, 0x68, 0x23, 0xE1, 0xB3, 0xE4, 0x18, 0x7D, 0xB8, 0x47, 0x01, 0xA5, 0x2B, 0xC4, 0x58, 0xCB, 0xB2, 0x89, 0x6C, 0x5F, 0xFD, 0xD3, 0x2C, 0xC4, 0x6F, 0xB8, 0x23, 0xB2, 0x0D, 0xFF, 0x3C, 0xF2, 0x11, 0x45, 0x74, 0xF2, 0x09, 0x06, 0x99, 0x18, 0xDD, 0x6F, 0xC0, 0x86, 0x01, 0x18, 0x12, 0x1D, 0x2B, 0x16, 0xAF, 0x56, 0xEF, 0x65, 0x33, 0xA1, 0xEA, 0x67, 0x4E, 0xF4, 0x4B, 0x82, 0xAB, 0xE9, 0x0F, 0xDC, 0x01, 0xFA, 0xDF, 0x60, 0x7F, 0x66, 0x47, 0x5D, 0xCB, 0x2C, 0x70, 0xCC, 0x7B, 0x4E, 0xD9, 0x06, 0xB8, 0x6E, 0x8C, 0x0C, 0xFE, 0x62, 0x1E, 0x42, 0xF9, 0x93, 0x7C, 0xA2, 0xAB, 0x0A, 0x9E, 0xD0, 0x23, 0x10, 0xAE, 0x4D, 0x7B, 0x27, 0x91, 0x6F, 0x26, 0xBE, 0x68, 0xFA, 0xA6, 0x3F, 0x9F, 0x23, 0xEB, 0xC8, 0x9D, 0xBB, 0x87 };
+
+ public void TestNullConstructor ()
+ {
+ try {
+ Publisher p = new Publisher (null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ public void TestInvalidConstructor ()
+ {
+ byte[] n = null;
+ X509Certificate x509 = new X509Certificate (n);
+ Publisher p = new Publisher (x509);
+
+ try {
+ x509 = p.Certificate;
+ Fail ("Expected NullReferenceException but got none");
+ }
+ catch (NullReferenceException) {
+ // having an empty certificate always break down things
+ }
+ catch (Exception e) {
+ Fail ("Expected NullReferenceException but got " + e.ToString ());
+ }
+
+ AssertEquals ("GetHashCode", x509.GetHashCode (), p.GetHashCode ());
+ AssertEquals ("ToString", "<System.Security.Policy.Publisher version=\"1\">\r\n <X509v3Certificate/>\r\n</System.Security.Policy.Publisher>\r\n", p.ToString ());
+ }
+
+ public void TestConstructor ()
+ {
+ X509Certificate x509 = new X509Certificate (msSpCert);
+ Publisher p = new Publisher (x509);
+
+ AssertEquals ("GetHashCode", x509.GetHashCode (), p.GetHashCode ());
+
+ IPermission ip = p.CreateIdentityPermission (null);
+ Assert ("CreateIdentityPermission", (ip is PublisherIdentityPermission));
+
+ string s = "<System.Security.Policy.Publisher version=\"1\">\r\n <X509v3Certificate>3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D01010105000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F";
+ s += "7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8";
+ s += "409AA8BEE6304A0603551D1F04433041303FA03DA03B8639687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE90FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87</X509v3Certificate>\r\n</System.Security.Policy.Publisher>\r\n";
+ AssertEquals ("ToString", s, p.ToString ());
+ }
+
+ public void TestCopy ()
+ {
+ X509Certificate x509 = new X509Certificate (msSpCert);
+ Publisher p = new Publisher (x509);
+ Publisher pCopy = (Publisher) p.Copy ();
+
+ AssertNotNull ("Copy-Cert", pCopy.Certificate);
+ Assert("Copy-Equals", p.Equals (pCopy));
+ AssertEquals ("Copy-GetHashCode", p.GetHashCode (), pCopy.GetHashCode ());
+ AssertEquals ("Copy-ToString", p.ToString (), pCopy.ToString ());
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs b/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs
new file mode 100644
index 00000000000..2e9510fc3c9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs
@@ -0,0 +1,105 @@
+//
+// StrongNameTest.cs - NUnit Test Cases for StrongName
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+public class StrongNameTest : TestCase {
+
+ static byte[] pk = { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB };
+
+ private StrongNamePublicKeyBlob snpkb;
+ private string name;
+ private Version version;
+
+ protected override void SetUp ()
+ {
+ snpkb = new StrongNamePublicKeyBlob (pk);
+ name = "StrongNameName";
+ version = new Version (1, 2, 3, 4);
+ }
+
+ protected override void TearDown () {}
+
+ public void TestNullConstructor ()
+ {
+ // without StrongNamePublicKeyBlob
+ try {
+ StrongName sn = new StrongName (null, name, version);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+
+ // without name
+ try {
+ StrongName sn = new StrongName (snpkb, null, version);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+
+ // without version
+ try {
+ StrongName sn = new StrongName (snpkb, name, null);
+ Fail ("Expected ArgumentNullException but got none");
+ }
+ catch (ArgumentNullException) {
+ // this is expected
+ }
+ catch (Exception e) {
+ Fail ("Expected ArgumentNullException but got " + e.ToString ());
+ }
+ }
+
+ public void TestConstructor ()
+ {
+ StrongName sn = new StrongName (snpkb, name, version);
+
+ AssertEquals ("Name", name, sn.Name);
+ AssertEquals ("PublicKey", snpkb.ToString (), sn.PublicKey.ToString ());
+ AssertEquals ("Version", version.ToString (), sn.Version.ToString ());
+
+ // same as StrongNamePublicKeyBlob
+ AssertEquals ("GetHashCode", 2359296, sn.GetHashCode ());
+
+ IPermission ip = sn.CreateIdentityPermission (null);
+ Assert ("CreateIdentityPermission", (ip is StrongNameIdentityPermission));
+
+ string s = "<StrongName version=\"1\"\r\n Key=\"00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB\"\r\n Name=\"StrongNameName\"\r\n Version=\"1.2.3.4\"/>\r\n";
+ AssertEquals ("ToString", s, sn.ToString ());
+ }
+
+ public void TestCopy ()
+ {
+ StrongName sn = new StrongName (snpkb, name, version);
+ StrongName snCopy = (StrongName) sn.Copy ();
+
+ AssertNotNull ("Copy", snCopy);
+ Assert("Copy-Equals", sn.Equals (snCopy));
+ AssertEquals ("Copy-GetHashCode", sn.GetHashCode (), snCopy.GetHashCode ());
+ AssertEquals ("Copy-ToString", sn.ToString (), snCopy.ToString ());
+ }
+}
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security/AllTests.cs b/mcs/class/corlib/Test/System.Security/AllTests.cs
new file mode 100644
index 00000000000..5f32c30411d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security/AllTests.cs
@@ -0,0 +1,27 @@
+//
+// TestSuite.System.Security.AllSecurityTests.cs
+//
+// Lawrence Pit <loz@cable.a2000.nl>
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (SecurityElementTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Security/ChangeLog b/mcs/class/corlib/Test/System.Security/ChangeLog
new file mode 100644
index 00000000000..10c66e1a517
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security/ChangeLog
@@ -0,0 +1,14 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * SecurityElementTest.cs: Catch and report unexpected exceptions.
+
+2002-04-27 Lawrence Pit <loz@cable.a2000.nl>
+
+ * ChangeLog: added
+ * AllTests.cs: added
+ * SecurityElementTest.cs: added
+
diff --git a/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs b/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs
new file mode 100644
index 00000000000..fb71028b2aa
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs
@@ -0,0 +1,216 @@
+//
+// SecurityElementTest.cs - NUnit Test Cases for System.Security.SecurityElement
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+
+namespace MonoTests.System.Security
+{
+
+public class SecurityElementTest : TestCase
+{
+ SecurityElement elem;
+
+ protected override void SetUp ()
+ {
+ elem = CreateElement ();
+ }
+
+ protected override void TearDown () {}
+
+ private SecurityElement CreateElement ()
+ {
+ SecurityElement elem = new SecurityElement ("IPermission");
+ elem.AddAttribute ("class", "System");
+ elem.AddAttribute ("version", "1");
+
+ SecurityElement child = new SecurityElement ("ConnectAccess");
+ elem.AddChild (child);
+
+ SecurityElement grandchild = new SecurityElement ("ENDPOINT", "some text");
+ grandchild.AddAttribute ("transport", "All");
+ grandchild.AddAttribute ("host", "localhost");
+ grandchild.AddAttribute ("port", "8080");
+ child.AddChild (grandchild);
+
+ SecurityElement grandchild2 = new SecurityElement ("ENDPOINT");
+ grandchild2.AddAttribute ("transport", "Tcp");
+ grandchild2.AddAttribute ("host", "www.ximian.com");
+ grandchild2.AddAttribute ("port", "All");
+ child.AddChild (grandchild2);
+
+ return elem;
+ }
+
+ public void TestConstructors ()
+ {
+
+ }
+
+ public void TestAddAttribute ()
+ {
+ try {
+ elem.AddAttribute (null, "valid");
+ Fail ("#1");
+ } catch (ArgumentNullException) { }
+ try {
+ elem.AddAttribute ("valid", null);
+ Fail ("#2");
+ } catch (ArgumentNullException) { }
+ try {
+ elem.AddAttribute ("<invalid>", "valid");
+ Fail ("#3");
+ } catch (ArgumentException) { }
+ try {
+ elem.AddAttribute ("valid", "invalid\"");
+ Fail ("#4");
+ } catch (ArgumentException) { }
+ try {
+ elem.AddAttribute ("valid", "valid\'");
+ } catch (ArgumentException) { Fail ("#5"); }
+ try {
+ elem.AddAttribute ("valid", "valid&");
+ Fail ("#6");
+ // in xml world this is actually not considered valid
+ // but it is by MS.Net
+ } catch (ArgumentException) { }
+ try {
+ elem.AddAttribute ("valid", "<invalid>");
+ Fail ("#7");
+ } catch (ArgumentException) { }
+ }
+
+ public void TestAttributes ()
+ {
+ Hashtable h = elem.Attributes;
+
+ /*
+ // this will result in an InvalidCastException on MS.Net
+ // I have no clue why
+
+ h.Add ("<invalid>", "valid");
+ try {
+ elem.Attributes = h;
+ Fail ("#1");
+ } catch (ArgumentException) { }
+ */
+
+ h = elem.Attributes;
+ h.Add ("valid", "\"invalid\"");
+ try {
+ elem.Attributes = h;
+ Fail ("#2");
+ } catch (ArgumentException) { }
+
+ h = elem.Attributes;
+ h.Add ("foo", "bar");
+ Assert ("#3", elem.Attributes.Count != h.Count);
+
+ elem.Attributes = h;
+ Assert ("#4", elem.Attribute ("foo") != null);
+ }
+
+ public void TestEqual ()
+ {
+ int iTest = 0;
+ try {
+ SecurityElement elem2 = CreateElement ();
+ iTest++;
+ Assert ("#1", elem.Equal (elem2));
+ iTest++;
+ SecurityElement child = (SecurityElement) elem2.Children [0];
+ iTest++;
+ child = (SecurityElement) child.Children [1];
+ iTest++;
+ child.Text = "some text";
+ iTest++;
+ Assert ("#2", !elem.Equal (elem2));
+ } catch (Exception e) {
+ Fail ("Unexpected Exception at iTest = " + iTest + ". e = " + e);
+ }
+ }
+
+ public void TestEscape ()
+ {
+ AssertEquals ("#1", SecurityElement.Escape ("foo<>\"'& bar"), "foo&lt;&gt;&quot;&apos;&amp; bar");
+ }
+
+ public void TestIsValidAttributeName ()
+ {
+ Assert ("#1", !SecurityElement.IsValidAttributeName ("x x"));
+ Assert ("#2", !SecurityElement.IsValidAttributeName ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidAttributeName ("x>x"));
+ Assert ("#4", SecurityElement.IsValidAttributeName ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidAttributeName ("x'x"));
+ Assert ("#6", SecurityElement.IsValidAttributeName ("x&x"));
+ }
+
+ public void TestIsValidAttributeValue ()
+ {
+ Assert ("#1", SecurityElement.IsValidAttributeValue ("x x"));
+ Assert ("#2", !SecurityElement.IsValidAttributeValue ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidAttributeValue ("x>x"));
+ Assert ("#4", !SecurityElement.IsValidAttributeValue ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidAttributeValue ("x'x"));
+ Assert ("#6", SecurityElement.IsValidAttributeValue ("x&x"));
+ }
+
+ public void TestIsValidTag ()
+ {
+ Assert ("#1", !SecurityElement.IsValidTag ("x x"));
+ Assert ("#2", !SecurityElement.IsValidTag ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidTag ("x>x"));
+ Assert ("#4", SecurityElement.IsValidTag ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidTag ("x'x"));
+ Assert ("#6", SecurityElement.IsValidTag ("x&x"));
+ }
+
+ public void TestIsValidText ()
+ {
+ Assert ("#1", SecurityElement.IsValidText ("x x"));
+ Assert ("#2", !SecurityElement.IsValidText ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidText ("x>x"));
+ Assert ("#4", SecurityElement.IsValidText ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidText ("x'x"));
+ Assert ("#6", SecurityElement.IsValidText ("x&x"));
+ }
+
+ public void TestSearchForChildByTag ()
+ {
+ SecurityElement child = null;
+ try {
+ child = elem.SearchForChildByTag (null);
+ Fail ("#1 should have thrown an ArgumentNullException");
+ } catch (ArgumentNullException) { }
+
+ child = elem.SearchForChildByTag ("doesnotexist");
+ AssertEquals ("#2", child, null);
+
+ child = elem.SearchForChildByTag ("ENDPOINT");
+ AssertEquals ("#3", child, null);
+
+ child = (SecurityElement) elem.Children [0];
+ child = child.SearchForChildByTag ("ENDPOINT");
+ AssertEquals ("#4", child.Attribute ("transport"), "All");
+ }
+
+ public void TestSearchForTextOfTag ()
+ {
+ try {
+ string t1 = elem.SearchForTextOfTag (null);
+ Fail ("#1 should have thrown an ArgumentNullException");
+ } catch (ArgumentNullException) { }
+
+ string t2 = elem.SearchForTextOfTag ("ENDPOINT");
+ AssertEquals ("#2", t2, "some text");
+ }
+}
+
+}
+
diff --git a/mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs b/mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
new file mode 100755
index 00000000000..f826c98a2ec
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
@@ -0,0 +1,169 @@
+// ASCIIEncodingTest - NUnit Test Cases for the System.Text.ASCIIEncoding class
+//
+// Author: Mike Kestner <mkestner@speakeasy.net>
+//
+// <c> 2002 Mike Kestner
+
+using NUnit.Framework;
+using System.Text;
+using System;
+
+
+namespace MonoTests.System.Text {
+
+ public class ASCIIEncodingTest : TestCase {
+
+ private char[] testchars;
+ private byte[] testbytes;
+
+ protected override void SetUp ()
+ {
+ testchars = new char[4];
+ testchars[0] = 'T';
+ testchars[1] = 'e';
+ testchars[2] = 's';
+ testchars[3] = 't';
+ testbytes = new byte[4];
+ testbytes[0] = (byte) 'T';
+ testbytes[1] = (byte) 'e';
+ testbytes[2] = (byte) 's';
+ testbytes[3] = (byte) 't';
+ }
+
+ // Test GetBytes(char[])
+ public void TestGetBytes1 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = ascii_encoding.GetBytes(testchars);
+ for (int i = 0; i < testchars.Length; i++)
+ AssertEquals (testchars[i], (char) bytes[i]);
+ }
+
+ // Test GetBytes(char[], int, int)
+ public void TestGetBytes2 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = ascii_encoding.GetBytes(testchars, 1, 1);
+ AssertEquals (1, bytes.Length);
+ AssertEquals (testchars[1], (char) bytes[0]);
+ }
+
+ // Test non-ASCII char in char[]
+ public void TestGetBytes3 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ testchars[2] = (char) 0x80;
+ byte[] bytes = ascii_encoding.GetBytes(testchars);
+ AssertEquals ('T', (char) bytes[0]);
+ AssertEquals ('e', (char) bytes[1]);
+ AssertEquals ('?', (char) bytes[2]);
+ AssertEquals ('t', (char) bytes[3]);
+ }
+
+ // Test GetBytes(char[], int, int, byte[], int)
+ public void TestGetBytes4 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = new Byte[1];
+ int cnt = ascii_encoding.GetBytes(testchars, 1, 1, bytes, 0);
+ AssertEquals (1, cnt);
+ AssertEquals (testchars[1], (char) bytes[0]);
+ }
+
+ // Test GetBytes(string, int, int, byte[], int)
+ public void TestGetBytes5 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = new Byte[1];
+ int cnt = ascii_encoding.GetBytes("Test", 1, 1, bytes, 0);
+ AssertEquals ('e', (char) bytes[0]);
+ }
+
+ // Test GetBytes(string)
+ public void TestGetBytes6 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = ascii_encoding.GetBytes("Test");
+ for (int i = 0; i < testchars.Length; i++)
+ AssertEquals (testchars[i], (char) bytes[i]);
+ }
+
+ // Test GetChars(byte[])
+ public void TestGetChars1 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = ascii_encoding.GetChars(testbytes);
+ for (int i = 0; i < testbytes.Length; i++)
+ AssertEquals (testbytes[i], (byte) chars[i]);
+ }
+
+ // Test GetChars(byte[], int, int)
+ public void TestGetChars2 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = ascii_encoding.GetChars(testbytes, 1, 1);
+ AssertEquals (1, chars.Length);
+ AssertEquals (testbytes[1], (byte) chars[0]);
+ }
+
+ // Test non-ASCII char in byte[]
+ public void TestGetChars3 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ testbytes[2] = 0x80;
+ char[] chars = ascii_encoding.GetChars(testbytes);
+ AssertEquals ('T', chars[0]);
+ AssertEquals ('e', chars[1]);
+ AssertEquals ('?', chars[2]);
+ AssertEquals ('t', chars[3]);
+ }
+
+ // Test GetChars(byte[], int, int, char[], int)
+ public void TestGetChars4 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = new char[1];
+ int cnt = ascii_encoding.GetChars(testbytes, 1, 1, chars, 0);
+ AssertEquals (1, cnt);
+ AssertEquals (testbytes[1], (byte) chars[0]);
+ }
+
+ // Test GetString(char[])
+ public void TestGetString1 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ string str = ascii_encoding.GetString(testbytes);
+ AssertEquals ("Test", str);
+ }
+
+ // Test GetString(char[], int, int)
+ public void TestGetString2 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ string str = ascii_encoding.GetString(testbytes, 1, 2);
+ AssertEquals ("es", str);
+ }
+
+ // Test Decoder
+ public void TestDecoder ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = new char[1];
+ int cnt = ascii_encoding.GetDecoder().GetChars(testbytes, 1, 1, chars, 0);
+ AssertEquals (1, cnt);
+ AssertEquals (testbytes[1], (byte) chars[0]);
+ }
+
+ // Test Decoder
+ public void TestEncoder ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = new Byte[1];
+ int cnt = ascii_encoding.GetEncoder().GetBytes(testchars, 1, 1, bytes, 0, false);
+ AssertEquals (1, cnt);
+ AssertEquals (testchars[1], (char) bytes[0]);
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Text/AllTests.cs b/mcs/class/corlib/Test/System.Text/AllTests.cs
new file mode 100644
index 00000000000..cb81dbb776a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/AllTests.cs
@@ -0,0 +1,31 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Text {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ //suite.AddTest(StringBuilderTest.Suite);
+ suite.AddTest(ASCIIEncodingTest.Suite);
+ //suite.AddTest(UTF8EncodingTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Text/ChangeLog b/mcs/class/corlib/Test/System.Text/ChangeLog
new file mode 100644
index 00000000000..682d3b89e24
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/ChangeLog
@@ -0,0 +1,21 @@
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-12-12 Jackson Harper <jackson@latitudegeo.com>
+
+ * AllTests.cs: Comment out UTF8... test (it does not exist)
+
+2002-03-17 Mike Kestner <mkestner@speakeasy.net>
+
+ * ASCIIEncodingTest.cs : New suite for ASCIIEncoding.
+ * AllTests.cs : Add the new suite.
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Remove StringBuilderTest suite. There's a major failure
+ when it's included and the test errors aren't displayed.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilderTest.cs: Fixed tests that were failing against mscorlib.
diff --git a/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs b/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
new file mode 100644
index 00000000000..bcd5180f301
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
@@ -0,0 +1,229 @@
+//
+// StringBuilderTest.dll - NUnit Test Cases for the System.Text.StringBuilder class
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// NOTES: I've also run all these tests against the MS implementation of
+// System.Text.StringBuilder to confirm that they return the same results
+// and they do.
+//
+// TODO: Add tests for the AppendFormat methods once the AppendFormat methods
+// are implemented in the StringBuilder class itself
+//
+// TODO: Potentially add more variations on Insert / Append tests for all the
+// possible types. I don't really think that's necessary as they all
+// pretty much just do .ToString().ToCharArray() and then use the Append / Insert
+// CharArray function. The ToString() bit for each type should be in the unit
+// tests for those types, and the unit test for ToCharArray should be in the
+// string test type. If someone wants to add those tests here for completness
+// (and some double checking) then feel free :)
+//
+
+using NUnit.Framework;
+using System.Text;
+using System;
+
+namespace MonoTests.System.Text {
+
+ public class StringBuilderTest : TestCase {
+
+ private StringBuilder sb;
+
+ public void TestConstructor1()
+ {
+ // check the parameterless ctor
+ sb = new StringBuilder();
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ AssertEquals(16, sb.Capacity);
+ }
+
+ public void TestConstructor2()
+ {
+ // check ctor that specifies the capacity
+ sb = new StringBuilder(10);
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ // check that capacity is not less than default
+ AssertEquals(10, sb.Capacity);
+
+ sb = new StringBuilder(42);
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ // check that capacity is set
+ AssertEquals(42, sb.Capacity);
+ }
+
+ public void TestConstructor3() {
+ // check ctor that specifies the capacity & maxCapacity
+ sb = new StringBuilder(444, 1234);
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ AssertEquals(444, sb.Capacity);
+ AssertEquals(1234, sb.MaxCapacity);
+ }
+
+ public void TestConstructor4()
+ {
+ // check for exception in ctor that specifies the capacity & maxCapacity
+ try {
+ sb = new StringBuilder(9999, 15);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("Capacity exeeds MaxCapacity");
+ }
+
+ public void TestConstructor5() {
+ String someString = null;
+ sb = new StringBuilder(someString);
+ AssertEquals("Should be empty string", String.Empty, sb.ToString());
+ }
+
+ public void TestConstructor6() {
+ // check for exception in ctor that prevents startIndex less than zero
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, -1, 3, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("StartIndex not allowed to be less than zero.");
+ }
+
+ public void TestConstructor7() {
+ // check for exception in ctor that prevents length less than zero
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, 2, -222, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("Length not allowed to be less than zero.");
+ }
+
+ public void TestConstructor8() {
+ // check for exception in ctor that ensures substring is contained in given string
+ // check that startIndex is not too big
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, 10000, 4, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("StartIndex and length must refer to a location within the string.");
+ }
+
+ public void TestConstructor9() {
+ // check for exception in ctor that ensures substring is contained in given string
+ // check that length doesn't go beyond end of string
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, 4, 4000, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("StartIndex and length must refer to a location within the string.");
+ }
+
+ public void TestConstructor10() {
+ // check that substring is taken properly and made into a StringBuilder
+ String someString = "someString";
+ sb = new StringBuilder(someString, 4, 6, 18);
+ string expected = "String";
+ AssertEquals( expected, sb.ToString());
+ }
+
+ public void TestAppend() {
+ StringBuilder sb = new StringBuilder( "Foo" );
+ sb.Append( "Two" );
+ string expected = "FooTwo";
+ AssertEquals( expected, sb.ToString() );
+ }
+
+ public void TestInsert() {
+ StringBuilder sb = new StringBuilder();
+
+ AssertEquals( String.Empty, sb.ToString() );
+ /* Test empty StringBuilder conforms to spec */
+
+ sb.Insert( 0, "Foo" ); /* Test insert at start of empty string */
+
+ AssertEquals( "Foo", sb.ToString() );
+
+ sb.Insert( 1, "!!" ); /* Test insert not at start of string */
+
+ AssertEquals( "F!!oo", sb.ToString() );
+
+ sb.Insert( 5, ".." ); /* Test insert at end of string */
+
+ AssertEquals( "F!!oo..", sb.ToString() );
+
+ sb.Insert( 0, 1234 ); /* Test insert of a number (at start of string) */
+
+ // FIX: Why does this test fail?
+ //AssertEquals( "1234F!!oo..", sb.ToString() );
+
+ sb.Insert( 5, 1.5 ); /* Test insert of a decimal (and end of string) */
+
+ // FIX: Why does this test fail?
+ //AssertEquals( "1234F1.5!!oo..", sb.ToString() );
+
+ sb.Insert( 4, 'A' ); /* Test char insert in middle of string */
+
+ // FIX: Why does this test fail?
+ //AssertEquals( "1234AF1.5!!oo..", sb.ToString() );
+
+ }
+
+ public void TestReplace() {
+ StringBuilder sb = new StringBuilder( "Foobarbaz" );
+
+ sb.Replace( "bar", "!!!" ); /* Test same length replace in middle of string */
+
+ AssertEquals( "Foo!!!baz", sb.ToString() );
+
+ sb.Replace( "Foo", "ABcD" ); /* Test longer replace at start of string */
+
+ AssertEquals( "ABcD!!!baz", sb.ToString() );
+
+ sb.Replace( "baz", "00" ); /* Test shorter replace at end of string */
+
+ AssertEquals( "ABcD!!!00", sb.ToString() );
+
+ sb.Replace( sb.ToString(), null ); /* Test string clear as in spec */
+
+ AssertEquals( String.Empty, sb.ToString() );
+
+ /* | 10 20 30
+ /* |0123456789012345678901234567890| */
+ sb.Append( "abc this is testing abc the abc abc partial replace abc" );
+
+ sb.Replace( "abc", "!!!", 0, 31 ); /* Partial replace at start of string */
+
+ AssertEquals( "!!! this is testing !!! the !!! abc partial replace abc", sb.ToString() );
+
+ sb.Replace( "testing", "", 0, 15 ); /* Test replace across boundary */
+
+ AssertEquals( "!!! this is testing !!! the !!! abc partial replace abc", sb.ToString() );
+
+ sb.Replace( "!!!", "" ); /* Test replace with empty string */
+
+ AssertEquals(" this is testing the abc partial replace abc", sb.ToString() );
+ }
+
+ public void TestAppendFormat() {
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Threading/AllTests.cs b/mcs/class/corlib/Test/System.Threading/AllTests.cs
new file mode 100644
index 00000000000..608dd0000cb
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading/AllTests.cs
@@ -0,0 +1,30 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Threading {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(ThreadTest.Suite);
+ suite.AddTest(MutexTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Threading/ChangeLog b/mcs/class/corlib/Test/System.Threading/ChangeLog
new file mode 100644
index 00000000000..0ece0a9fcda
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading/ChangeLog
@@ -0,0 +1,17 @@
+2003-01-13 Nick Drochak <ndrochak@gol.com>
+
+ * MutexTest.cs: Disable some tests that case unhandled exceptoins
+ on MS.NET.
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-11-29 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * MutexTest.cs : New suite for Mutex.
+
+2002-11-23 Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+
+ * ThreadTest.cs : New suite for Thread.
+ * AllTests.cs : Add the new suite.
diff --git a/mcs/class/corlib/Test/System.Threading/MutexTest.cs b/mcs/class/corlib/Test/System.Threading/MutexTest.cs
new file mode 100644
index 00000000000..3f064264718
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading/MutexTest.cs
@@ -0,0 +1,164 @@
+// MutexTest.cs - NUnit Test Cases for System.Threading.Mutex
+//
+// Eduardo Garcia Cebollero <kiwnix@yahoo.es>
+//
+// (C) Eduardo Garcia Cebollero
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+
+namespace MonoTests.System.Threading
+{
+
+ public class MutexTest : TestCase
+ {
+
+ //Auxiliary Classes (Future Threads)
+ private class ConcClass
+ {
+ public int id;
+ public Mutex mut;
+ public ConcClass(int id,Mutex mut)
+ {
+ this.id = id;
+ this.mut = mut;
+ }
+ public void wait()
+ {
+ mut.WaitOne();
+ }
+ public void signal()
+ {
+ mut.ReleaseMutex();
+ }
+ }
+ private class ConcClassLoop: ConcClass
+ {
+ public int marker;
+
+ public ConcClassLoop(int id,Mutex mut) :
+ base(id,mut)
+ {
+ this.marker = 0;
+ }
+
+ public void WithoutWait()
+ {
+ this.marker = this.id;
+ this.signal();
+ }
+
+
+ public void Loop()
+ {
+ while (this.marker<100)
+ {
+ this.wait();
+ this.marker++;
+ this.signal();
+ }
+ }
+
+ public void WaitAndForget()
+ {
+ this.wait();
+ this.marker = id;
+ }
+ public void WaitAndWait()
+ {
+ mut.WaitOne();
+ this.marker = this.id;
+ mut.WaitOne();
+ this.marker = this.id+1;
+ }
+ }
+
+ protected override void SetUp() {}
+
+ protected override void TearDown() {}
+
+ public void TestCtor1()
+ {
+ try
+ {
+ Mutex Sem = new Mutex();
+ }
+ catch (Exception e)
+ {
+ Fail("#01 Error Creating The Simple Mutex:" + e.ToString());
+ }
+ }
+
+// These tests produce mutex release errors
+/*
+ public void TestCtorDefaultValue()
+ {
+ Mutex Sem = new Mutex();
+ ConcClassLoop class1 = new ConcClassLoop(1,Sem);
+ Thread thread1 = new Thread(new ThreadStart(class1.WithoutWait));
+ thread1.Start();
+ while(thread1.IsAlive);
+ AssertEquals("#02 The default value of The mutex wrong set:",class1.id,class1.marker);
+ }
+
+ public void TestCtorCtor2()
+ {
+ Mutex Sem = new Mutex(false);
+ ConcClassLoop class1 = new ConcClassLoop(1,Sem);
+ Thread thread1 = new Thread(new ThreadStart(class1.WithoutWait));
+ thread1.Start();
+ while(thread1.IsAlive);
+ AssertEquals("#03 The value of The mutex wrong set:",class1.id,class1.marker);
+ }
+
+ public void TestCtorCtor3()
+ {
+ Mutex Sem = new Mutex(true);
+ ConcClassLoop class1 = new ConcClassLoop(1,Sem);
+ Thread thread1 = new Thread(new ThreadStart(class1.WithoutWait));
+ thread1.Start();
+ while(thread1.IsAlive);
+ AssertEquals("#04 The default value of The mutex wrong set:",class1.id,class1.marker);
+ }
+
+*/
+ public void TestWaitAndSignal1()
+ {
+ Mutex Sem = new Mutex(false);
+ ConcClassLoop class1 = new ConcClassLoop(1,Sem);
+ Thread thread1 = new Thread(new ThreadStart(class1.Loop));
+ thread1.Start();
+ while(thread1.IsAlive);
+ AssertEquals("#41 Mutex Worked InCorrecly:",100,class1.marker);
+ }
+ public void TestWaitAndFoget1()
+ {
+ Mutex Sem = new Mutex(false);
+ ConcClassLoop class1 = new ConcClassLoop(1,Sem);
+ ConcClassLoop class2 = new ConcClassLoop(2,Sem);
+ Thread thread1 = new Thread(new ThreadStart(class1.WaitAndForget));
+ Thread thread2 = new Thread(new ThreadStart(class2.WaitAndForget));
+ thread1.Start();
+ while(thread1.IsAlive);
+ thread2.Start();
+ while(thread2.IsAlive);
+ AssertEquals("#51 The Mutex Has been Kept after end of the thread:",
+ class2.id,class2.marker);
+ }
+
+ public void TestHandle()
+ {
+ Mutex Sem = new Mutex();
+ try
+ {
+ IntPtr Handle = Sem.Handle;
+ }
+ catch (Exception e)
+ {
+ Fail("#61 Unexpected Exception accessing Sem.Handle:" + e.ToString());
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Threading/ThreadTest.cs b/mcs/class/corlib/Test/System.Threading/ThreadTest.cs
new file mode 100644
index 00000000000..8bd2a6a1ca1
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading/ThreadTest.cs
@@ -0,0 +1,369 @@
+// ThreadTest.cs - NUnit Test Cases for the System.Threading.Thread class
+//
+// Eduardo Garcia Cebollero (kiwnix@yahoo.es)
+//
+// (C) Eduardo Garcia Cebollero.
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+
+namespace MonoTests.System.Threading
+{
+ public class ThreadTest : TestCase
+ {
+ //Some Classes to test as threads
+ private class C1Test
+ {
+ public int cnt;
+ public Thread thread1;
+ public bool endm1;
+ public bool endm2;
+
+ public C1Test()
+ {
+ thread1 = (Thread)null;
+ this.cnt = 0;
+ endm1 = endm2 = false;
+ }
+
+ public void TestMethod()
+ {
+ while (cnt < 10)
+ {
+ cnt++;
+ }
+ endm1 = true;
+ }
+ public void TestMethod2()
+ {
+ if (!(thread1==(Thread)null) )
+ {
+ thread1.Join();
+ }
+ endm2 = true;
+ }
+ }
+ private class C2Test
+ {
+ public int cnt;
+ public bool run = false;
+
+ public C2Test()
+ {
+ this.cnt = 0;
+ }
+
+ public void TestMethod()
+ {
+ run = true;
+ while (true)
+ {
+ if (cnt < 1000)
+ cnt++;
+ else
+ cnt = 0;
+ }
+ }
+ }
+
+ private class C3Test
+ {
+ public C1Test sub_class;
+ public Thread sub_thread;
+
+ public C3Test()
+ {
+ sub_class = new C1Test();
+ sub_thread = new Thread(new ThreadStart(sub_class.TestMethod));
+ }
+
+ public void TestMethod1()
+ {
+ sub_thread.Start();
+ sub_thread.Abort();
+ }
+ }
+
+ private class C4Test
+ {
+ public C1Test class1;
+ public C1Test class2;
+ public Thread thread1;
+ public Thread thread2;
+ public bool T1ON ;
+ public bool T2ON ;
+
+ public C4Test()
+ {
+ T1ON = false;
+ T2ON = false;
+ class1 = new C1Test();
+ class2 = new C1Test();
+ thread1 = new Thread(new ThreadStart(class1.TestMethod));
+ thread2 = new Thread(new ThreadStart(class2.TestMethod));
+ }
+
+ public void TestMethod1()
+ {
+ thread1.Start();
+ while (!thread1.IsAlive);
+ T1ON = true;
+ thread2.Start();
+ while (!thread2.IsAlive);
+ T2ON = true;
+ thread1.Abort();
+ while (thread1.IsAlive);
+ T1ON = false;
+ thread2.Abort();
+ while (thread2.IsAlive);
+ T2ON = false;
+ }
+
+ public void TestMethod2()
+ {
+ thread1.Start();
+ thread1.Join();
+ }
+ }
+
+ public void TestCtor1()
+ {
+ C1Test test1 = new C1Test();
+ try
+ {
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ }
+ catch (Exception e)
+ {
+ Fail ("#01 Unexpected Exception Thrown: " + e.ToString ());
+ }
+ }
+
+ public void TestStart()
+ {
+ {
+ C1Test test1 = new C1Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ try
+ {
+ TestThread.Start();
+ }
+ catch (Exception e)
+ {
+ Fail ("#12 Unexpected Exception Thrown: " + e.ToString ());
+ }
+ TestThread.Join();
+ AssertEquals("#13 Thread Not started: ", 10,test1.cnt);
+ }
+ {
+ bool errorThrown = false;
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.Start();
+ TestThread.Abort();
+ try
+ {
+ TestThread.Start();
+ }
+ catch(ThreadStateException)
+ {
+ errorThrown = true;
+ }
+ Assert ("#14 no ThreadStateException trown", errorThrown);
+ }
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.Start();
+ while(!test1.run);
+ bool started = (TestThread.ThreadState == ThreadState.Running);
+ AssertEquals("#15 Thread Is not in the correct state: ", started , test1.run);
+ TestThread.Abort();
+ }
+ }
+
+ public void TestApartment()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ ApartmentState before = TestThread.ApartmentState;
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ ApartmentState after = TestThread.ApartmentState;
+ TestThread.Abort();
+ AssertEquals("#21 Apartment State Changed when not needed",before,after);
+ }
+
+ public void TestApartmentState()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ ApartmentState before = TestThread.ApartmentState;
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ ApartmentState after = TestThread.ApartmentState;
+ TestThread.Abort();
+ AssertEquals("#31 Apartment State Changed when not needed: ",before,after);
+ }
+
+ public void TestPriority1()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.Priority=ThreadPriority.BelowNormal;
+ ThreadPriority after = TestThread.Priority;
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ ThreadPriority before = TestThread.Priority;
+ TestThread.Abort();
+ AssertEquals("#41 Unexpected Priority Change: ",before,after);
+ }
+
+ public void TestPriority2()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ AssertEquals("#42 Incorrect Priority in New thread: ",ThreadPriority.Normal, TestThread.Priority);
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ AssertEquals("#43 Incorrect Priority in Started thread: ",ThreadPriority.Normal, TestThread.Priority);
+ TestThread.Abort();
+ AssertEquals("#44 Incorrect Priority in Aborted thread: ",ThreadPriority.Normal, TestThread.Priority);
+ }
+
+ public void TestPriority3()
+ {
+
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.Start();
+ TestThread.Priority = ThreadPriority.Lowest;
+ AssertEquals("#45A Incorrect Priority:",ThreadPriority.Lowest,TestThread.Priority);
+ TestThread.Priority = ThreadPriority.BelowNormal;
+ AssertEquals("#45B Incorrect Priority:",ThreadPriority.BelowNormal,TestThread.Priority);
+ TestThread.Priority = ThreadPriority.Normal;
+ AssertEquals("#45C Incorrect Priority:",ThreadPriority.Normal,TestThread.Priority);
+ TestThread.Priority = ThreadPriority.AboveNormal;
+ AssertEquals("#45D Incorrect Priority:",ThreadPriority.AboveNormal,TestThread.Priority);
+ TestThread.Priority = ThreadPriority.Highest;
+ AssertEquals("#45E Incorrect Priority:",ThreadPriority.Highest,TestThread.Priority);
+ TestThread.Abort();
+ }
+
+
+ public void TestIsBackground1()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ bool state = TestThread.IsBackground;
+ TestThread.Abort();
+ Assert("#51 IsBackground not set at the default state: ",!(state));
+ }
+
+ public void TestIsBackground2()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.IsBackground = true;
+ TestThread.Start();
+ TestThread.Abort();
+ Assert("#52 Is Background Changed ot Start ",TestThread.IsBackground);
+ }
+
+
+ public void TestName()
+ {
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ string name = TestThread.Name;
+ AssertEquals("#61 Name set when mustn't be set: ", name, (string)null);
+ string newname = "Testing....";
+ TestThread.Name = newname;
+ AssertEquals("#62 Name not set when must be set: ",TestThread.Name,newname);
+ TestThread.Abort();
+ }
+
+ public void TestNestedThreads1()
+ {
+ C3Test test1 = new C3Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod1));
+ try
+ {
+ TestThread.Start();
+ while(!TestThread.IsAlive);
+ TestThread.Abort();
+ }
+ catch(Exception e)
+ {
+ Fail("#71 Unexpected Exception" + e.Message);
+ }
+ }
+
+ public void TestNestedThreads2()
+ {
+ C4Test test1 = new C4Test();
+ test1.thread1.Start();
+ test1.thread1.Abort();
+ while(test1.thread1.IsAlive);
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod1));
+ try
+ {
+ TestThread.Start();
+ TestThread.Abort();
+ }
+ catch(Exception e)
+ {
+ Fail("#81 Unexpected Exception" + e.ToString());
+ }
+ }
+
+ public void TestJoin1()
+ {
+ C1Test test1 = new C1Test();
+ C1Test test2 = new C1Test();
+ Thread thread1 = new Thread(new ThreadStart(test1.TestMethod));
+ Thread thread2 = new Thread(new ThreadStart(test1.TestMethod2));
+ try
+ {
+ thread1.Start();
+ thread2.Start();
+ thread2.Join();
+ }
+ catch(Exception e)
+ {
+ Fail("#91 Unexpected Exception " + e.ToString());
+ }
+ finally
+ {
+ thread1.Abort();
+ thread2.Abort();
+ }
+ }
+
+ public void TestThreadState()
+ {
+ //TODO: Test The rest of the possible transitions
+ C2Test test1 = new C2Test();
+ Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
+ AssertEquals("#101 Wrong Thread State",ThreadState.Unstarted,TestThread.ThreadState);
+ TestThread.Start();
+ //while(!TestThread.IsAlive); //In the MS Documentation this is not necessary
+ //but in the MS SDK it is
+ AssertEquals("#102 Wrong Thread State", ThreadState.Running | ThreadState.Unstarted ,TestThread.ThreadState);
+ TestThread.Abort();
+ while(TestThread.IsAlive);
+ AssertEquals("#103 Wrong Thread State",ThreadState.Aborted,TestThread.ThreadState);
+ }
+ }
+
+}
+
+
+
diff --git a/mcs/class/corlib/Test/System/AllTests.cs b/mcs/class/corlib/Test/System/AllTests.cs
new file mode 100644
index 00000000000..e9e4f227da5
--- /dev/null
+++ b/mcs/class/corlib/Test/System/AllTests.cs
@@ -0,0 +1,62 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (ArrayTest.Suite);
+ suite.AddTest (AttributeTest.Suite);
+ suite.AddTest (BitConverterTest.Suite);
+ suite.AddTest (BooleanTest.Suite);
+ suite.AddTest (BufferTest.Suite);
+ suite.AddTest (ByteTest.Suite);
+ suite.AddTest (CharEnumeratorTest.Suite);
+ suite.AddTest (CharTest.Suite);
+ suite.AddTest (ConsoleTest.Suite);
+ suite.AddTest (ConvertTest.Suite);
+ suite.AddTest (DateTimeTest.Suite);
+ suite.AddTest (DecimalTest.Suite);
+ suite.AddTest (DecimalTest2.Suite);
+ suite.AddTest (DoubleTest.Suite);
+ suite.AddTest (EnumTest.Suite);
+ suite.AddTest (ExceptionTest.Suite);
+ suite.AddTest (GuidTest.Suite);
+ suite.AddTest (Int16Test.Suite);
+ suite.AddTest (Int32Test.Suite);
+ suite.AddTest (Int64Test.Suite);
+ suite.AddTest (IntegerFormatterTest.Suite);
+ suite.AddTest (MathTest.Suite);
+ suite.AddTest (MulticastDelegateTest.Suite);
+ suite.AddTest (ObjectTest.Suite);
+ suite.AddTest (RandomTest.Suite);
+ suite.AddTest (ResolveEventArgsTest.Suite);
+ suite.AddTest (SByteTest.Suite);
+ suite.AddTest (StringTest.Suite);
+ suite.AddTest (TimeSpanTest.Suite);
+ suite.AddTest (TimeZoneTest.Suite);
+ suite.AddTest (UInt16Test.Suite);
+ suite.AddTest (UInt32Test.Suite);
+ suite.AddTest (UInt64Test.Suite);
+ suite.AddTest (VersionTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System/ArrayTest.cs b/mcs/class/corlib/Test/System/ArrayTest.cs
new file mode 100644
index 00000000000..61da6fcad88
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ArrayTest.cs
@@ -0,0 +1,1988 @@
+// ArrayTest.cs - NUnit Test Cases for the System.Array class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class ArrayTest : TestCase
+{
+ public ArrayTest() {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public void TestIsFixedSize() {
+ char[] a1 = {'a'};
+ Assert("All arrays are fixed", a1.IsFixedSize);
+ }
+
+ public void TestIsReadOnly() {
+ char[] a1 = {'a'};
+ Assert("No array is readonly", !a1.IsReadOnly);
+ }
+
+ public void TestIsSynchronized() {
+ char[] a1 = {'a'};
+ Assert("No array is synchronized", !a1.IsSynchronized);
+ }
+
+ public void TestLength() {
+ {
+ char[] a1 = { };
+ AssertEquals("Zero length array", 0, a1.Length);
+ }
+ {
+ char[] a1 = {'c'};
+ AssertEquals("One-length array", 1, a1.Length);
+ }
+ {
+ char[] a1 = {'c', 'c'};
+ AssertEquals("Two-length array", 2, a1.Length);
+ }
+ }
+
+ public void TestRank() {
+ char[] a1 = { 'c', 'd', 'e' };
+ AssertEquals("Rank one", 1, a1.Rank);
+
+ char[,] a2 = new Char[3,3];
+ AssertEquals("Rank two", 2, a2.Rank);
+
+ char[,,] a3 = new Char[3,3,3];
+ AssertEquals("Rank three", 3, a3.Rank);
+ }
+
+ public void TestBinarySearch1() {
+ bool errorThrown = false;
+ try {
+ Array.BinarySearch(null, "blue");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#B01", errorThrown);
+ errorThrown = false;
+ try {
+ char[,] c1 = new Char[2,2];
+ Array.BinarySearch(c1, "needle");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#B02", errorThrown);
+
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ Assert("#B05",
+ Array.BinarySearch(arr, 'c') >= 3);
+ Assert("#B06",
+ Array.BinarySearch(arr, 'c') < 6);
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'd', 'd', 'd', 'e', 'e'};
+ AssertEquals("#B07",
+ -4, Array.BinarySearch(arr, 'c'));
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ AssertEquals("#B08",
+ -9, Array.BinarySearch(arr, 'e'));
+ }
+ }
+ public void TestBinarySearch2() {
+ bool errorThrown = false;
+ try {
+ Array.BinarySearch(null, 0, 1, "blue");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#B20", errorThrown);
+ errorThrown = false;
+ try {
+ char[,] c1 = new Char[2,2];
+ Array.BinarySearch(c1, 0, 1, "needle");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#B21", errorThrown);
+ errorThrown = false;
+ try {
+ char[] c1 = {'a'};
+ Array.BinarySearch(c1, -1, 1, 'a');
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#B22", errorThrown);
+ errorThrown = false;
+ try {
+ char[] c1 = {'a'};
+ Array.BinarySearch(c1, 0, -1, 'a');
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#B23", errorThrown);
+ errorThrown = false;
+ try {
+ char[] c1 = {'a'};
+ Array.BinarySearch(c1, 0, 4, 'a');
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#B24", errorThrown);
+
+ {
+ char[] arr = {'z', 'z', 'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ Assert("#B26",
+ Array.BinarySearch(arr, 2, 8, 'c') >= 5);
+ Assert("#B27",
+ Array.BinarySearch(arr, 2, 8, 'c') < 8);
+ }
+ {
+ char[] arr = {'z', 'z', 'a', 'b', 'b', 'd', 'd', 'd', 'e', 'e'};
+ AssertEquals("#B28",
+ -6, Array.BinarySearch(arr, 2, 8, 'c'));
+ }
+ {
+ char[] arr = {'z', 'z', 'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ AssertEquals("#B29",
+ -11, Array.BinarySearch(arr, 2, 8, 'e'));
+ }
+ }
+
+ // TODO - testBinarySearch with explicit IComparer args
+
+ public void TestClear() {
+ bool errorThrown = false;
+ try {
+ Array.Clear(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#C01", errorThrown);
+
+ int[] i1 = { 1, 2, 3, 4 };
+ {
+ int[] compare = {1,2,3,4};
+ AssertEquals("#C02", compare[0], i1[0]);
+ AssertEquals("#C03", compare[1], i1[1]);
+ AssertEquals("#C04", compare[2], i1[2]);
+ AssertEquals("#C05", compare[3], i1[3]);
+ }
+ Array.Clear(i1, 3, 1);
+ {
+ int[] compare = {1,2,3,0};
+ AssertEquals("#C06", compare[0], i1[0]);
+ AssertEquals("#C07", compare[1], i1[1]);
+ AssertEquals("#C08", compare[2], i1[2]);
+ AssertEquals("#C09", compare[3], i1[3]);
+ }
+ Array.Clear(i1, 1, 1);
+ {
+ int[] compare = {1,0,3,0};
+ AssertEquals("#C10", compare[0], i1[0]);
+ AssertEquals("#C11", compare[1], i1[1]);
+ AssertEquals("#C12", compare[2], i1[2]);
+ AssertEquals("#C13", compare[3], i1[3]);
+ }
+ Array.Clear(i1, 1, 3);
+ {
+ int[] compare = {1,0,0,0};
+ AssertEquals("#C14", compare[0], i1[0]);
+ AssertEquals("#C15", compare[1], i1[1]);
+ AssertEquals("#C16", compare[2], i1[2]);
+ AssertEquals("#C17", compare[3], i1[3]);
+ }
+
+ string[] s1 = { "red", "green", "blue" };
+ Array.Clear(s1, 0, 3);
+ {
+ string[] compare = {null, null, null};
+ AssertEquals("#C18", compare[0], s1[0]);
+ AssertEquals("#C19", compare[1], s1[1]);
+ AssertEquals("#C20", compare[2], s1[2]);
+ }
+ }
+
+ public void TestClone() {
+ char[] c1 = {'a', 'b', 'c'};
+ char[] c2 = (char[])c1.Clone();
+ AssertEquals("#D01", c1[0], c2[0]);
+ AssertEquals("#D02", c1[1], c2[1]);
+ AssertEquals("#D03", c1[2], c2[2]);
+
+ char[] d10 = {'a', 'b'};
+ char[] d11 = {'a', 'c'};
+ char[] d12 = {'b', 'c'};
+ char[][] d1 = {d10, d11, d12};
+ char[][] d2 = (char[][])d1.Clone();
+ AssertEquals("#D04", d1[0], d2[0]);
+ AssertEquals("#D05", d1[1], d2[1]);
+ AssertEquals("#D06", d1[2], d2[2]);
+
+ d1[0][0] = 'z';
+ AssertEquals("#D07", d1[0], d2[0]);
+ }
+
+ public void TestCopy() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = {};
+ Array.Copy(c1, null, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#E01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = {};
+ Array.Copy(null, c1, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#E02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[,] c2 = new Char[1,1];
+ Array.Copy(c1, c2, 1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#E03", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ string[] s1 = new String[1];
+ Array.Copy(c1, s1, 1);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+ Assert("#E04", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Object[] o1 = new Object[1];
+ o1[0] = "hello";
+ Array.Copy(o1, c1, 1);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("#E05", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[] c2 = new Char[1];
+ Array.Copy(c1, c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#E06", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[] c2 = new Char[2];
+ Array.Copy(c1, c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E07", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[] c2 = new Char[2];
+ Array.Copy(c2, c1, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E08", errorThrown);
+ }
+
+ char[] orig = {'a', 'b', 'd', 'a'};
+ char[] copy = new Char[4];
+ Array.Copy(orig, copy, 4);
+ for (int i = 0; i < orig.Length; i++) {
+ AssertEquals("#E09(" + i + ")",
+ orig[i], copy[i]);
+ }
+ Array.Clear(copy, 0, copy.Length);
+ for (int i = 0; i < orig.Length; i++) {
+ AssertEquals("#E10(" + i + ")",
+ (char)0, copy[i]);
+ }
+ Array.Copy(orig, copy, 2);
+ AssertEquals("#E11", orig[0], copy[0]);
+ AssertEquals("#E12", orig[1], copy[1]);
+ Assert("#E13", orig[2] != copy[2]);
+ Assert("#E14", orig[3] != copy[3]);
+ }
+ public void TestCopy2() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ Array.Copy(c2, 1, c1, 0, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E31", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ Array.Copy(c2, 0, c1, 1, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E32", errorThrown);
+ }
+
+ char[] orig = {'a', 'b', 'd', 'a'};
+ char[] copy = new Char[4];
+ Array.Copy(orig, 1, copy, 1, 3);
+ Assert("#E33", copy[0] != orig[0]);
+ for (int i = 1; i < orig.Length; i++) {
+ AssertEquals("#E34(" + i + ")",
+ orig[i], copy[i]);
+ }
+ Array.Clear(copy, 0, copy.Length);
+ Array.Copy(orig, 1, copy, 0, 2);
+ AssertEquals("#E35", orig[1], copy[0]);
+ AssertEquals("#E36", orig[2], copy[1]);
+ Assert("#E37", copy[2] != orig[2]);
+ Assert("#E38", copy[3] != orig[3]);
+ }
+
+ public void TestCopyTo() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ c1.CopyTo(null, 2);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#E61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[,] c2 = new Char[2,2];
+ c1.CopyTo(c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E62", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[,] c1 = new Char[2,2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, -1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#E63", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[,] c1 = new Char[2,2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 2);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#E64", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#E65", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E66", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E67", errorThrown);
+ }
+
+ {
+ bool errorThrown = false;
+ try {
+ String[] c1 = new String[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 0);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+ Assert("#E68", errorThrown);
+ }
+
+ Char[] orig = {'a', 'b', 'c', 'd'};
+ Char[] copy = new Char[10];
+ Array.Clear(copy, 0, copy.Length);
+ orig.CopyTo(copy, 3);
+ AssertEquals("#E69", (char)0, copy[0]);
+ AssertEquals("#E70", (char)0, copy[1]);
+ AssertEquals("#E71", (char)0, copy[2]);
+ AssertEquals("#E72", orig[0], copy[3]);
+ AssertEquals("#E73", orig[1], copy[4]);
+ AssertEquals("#E74", orig[2], copy[5]);
+ AssertEquals("#E75", orig[3], copy[6]);
+ AssertEquals("#E76", (char)0, copy[7]);
+ AssertEquals("#E77", (char)0, copy[8]);
+ AssertEquals("#E78", (char)0, copy[9]);
+
+ {
+ // The following is valid and must not throw an exception.
+ bool errorThrown = false;
+ try {
+ int[] src = new int [0];
+ int[] dest = new int [0];
+ src.CopyTo (dest, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E79", !errorThrown);
+ }
+ }
+
+ public void TestCreateInstance() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(null, 12);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#F01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(Type.GetType("System.Char"), -3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#F02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(Type.GetType("System.Char"), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#F03", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(Type.GetType("System.Char"), null, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#F04", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ int[] lengths = new int [0];
+ Array.CreateInstance(Type.GetType("System.Char"), lengths);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#F05", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ int[] lengths = new int [1];
+ int[] bounds = new int [2];
+ Array.CreateInstance(Type.GetType("System.Char"), lengths, bounds);
+ errorThrown = true;
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#F06", errorThrown);
+ }
+
+ char[] c1 = (char[])Array.CreateInstance(Type.GetType("System.Char"), 12);
+ AssertEquals("#F07", 12, c1.Length);
+
+ Array c2 = Array.CreateInstance(Type.GetType("System.Char"), 12, 5);
+ AssertEquals("#F08", 2, c2.Rank);
+ AssertEquals("#F09", 60, c2.Length);
+
+
+ {
+ int[] lengths = { 3 };
+ int[] bounds = { 5 };
+ int[] src = { 512, 718, 912 };
+ Array array = Array.CreateInstance(typeof(int), lengths, bounds);
+
+ AssertEquals("#F10", 3, array.Length);
+ AssertEquals("#F11", 5, array.GetLowerBound(0));
+ AssertEquals("#F12", 7, array.GetUpperBound(0));
+
+ src.CopyTo (array, 5);
+
+ for (int i = 0; i < src.Length; i++)
+ AssertEquals("#F13(" + i + ")", src[i], array.GetValue(i+5));
+ }
+
+ }
+
+ public void TestGetEnumerator() {
+ String[] s1 = {"this", "is", "a", "test"};
+ IEnumerator en = s1.GetEnumerator ();
+ AssertNotNull ("#G01", en);
+
+ Assert ("#G02", en.MoveNext ());
+ AssertEquals ("#G03", "this", en.Current);
+ Assert ("#G04", en.MoveNext ());
+ AssertEquals ("#G05", "is", en.Current);
+ Assert ("#G06", en.MoveNext ());
+ AssertEquals ("#G07", "a", en.Current);
+ Assert ("#G08", en.MoveNext ());
+ AssertEquals ("#G09", "test", en.Current);
+ Assert ("#G10", !en.MoveNext ());
+
+ en.Reset ();
+ Assert("#G11", en.MoveNext ());
+ AssertEquals ("#G12", "this", en.Current);
+
+ // mutation does not invalidate array enumerator!
+ s1.SetValue ("change", 1);
+ Assert ("#G13", en.MoveNext ());
+ AssertEquals ("#G14", "change", en.Current);
+ }
+
+ public void TestGetEnumeratorMultipleDimension() {
+ String[,] s1 = {{"this", "is"}, {"a", "test"}};
+ IEnumerator en = s1.GetEnumerator ();
+ AssertNotNull ("#AA01", en);
+
+ Assert ("#AA02", en.MoveNext ());
+ AssertEquals ("#AA03", "this", en.Current);
+ Assert ("#AA04", en.MoveNext ());
+ AssertEquals ("#AA05", "is", en.Current);
+ Assert ("#AA06", en.MoveNext ());
+ AssertEquals ("#AA07", "a", en.Current);
+ Assert ("#AA08", en.MoveNext ());
+ AssertEquals ("#AA09", "test", en.Current);
+ Assert ("#AA10", !en.MoveNext ());
+
+ en.Reset ();
+ Assert("#AA11", en.MoveNext ());
+ AssertEquals ("#AA12", "this", en.Current);
+
+ int[] idxs = {0,1};
+ // mutation does not invalidate array enumerator!
+ s1.SetValue ("change", idxs);
+ Assert ("#AA13", en.MoveNext ());
+ AssertEquals ("#AA14", "change", en.Current);
+ }
+
+ public void TestGetEnumeratorNonZeroLowerBounds() {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance( typeof(String), myLengthsArray, myBoundsArray );
+ for ( int i = myArray.GetLowerBound(0); i <= myArray.GetUpperBound(0); i++ )
+ for ( int j = myArray.GetLowerBound(1); j <= myArray.GetUpperBound(1); j++ ) {
+ int[] myIndicesArray = new int[2] { i, j };
+ myArray.SetValue( Convert.ToString(i) + j, myIndicesArray );
+ }
+ IEnumerator en = myArray.GetEnumerator ();
+ AssertNotNull ("#AB01", en);
+
+ // check the first couple of values
+ Assert ("#AB02", en.MoveNext ());
+ AssertEquals ("#AB03", "23", en.Current);
+ Assert ("#AB04", en.MoveNext ());
+ AssertEquals ("#AB05", "24", en.Current);
+
+ // then check the last element's value
+ string lastElement;
+ do {
+ lastElement = (string)en.Current;
+ } while (en.MoveNext());
+ AssertEquals ("#AB06", "47", lastElement);
+ }
+
+ public void TestIList_Add () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).Add ("can not");
+ Fail ("IList.Add should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.Add threw wrong exception type");
+ }
+
+ Fail("IList.Add shouldn't get this far");
+ }
+
+ public void TestIList_Insert () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).Insert (0, "can not");
+ Fail ("IList.Insert should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.Insert threw wrong exception type");
+ }
+
+ Fail("IList.Insert shouldn't get this far");
+ }
+
+ public void TestIList_Remove () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).Remove ("can not");
+ Fail ("IList.Remove should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.Remove threw wrong exception type");
+ }
+
+ Fail("IList.Remove shouldn't get this far");
+ }
+
+ public void TestIList_RemoveAt () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).RemoveAt (0);
+ Fail ("IList.RemoveAt should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.RemoveAt threw wrong exception type");
+ }
+
+ Fail("IList.RemoveAt shouldn't get this far");
+ }
+
+ public void TestIList_Contains () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+
+ try {
+ bool b = ((IList)myArray).Contains ("23");
+ Fail("IList.Contains should throw with multi-dimensional arrays");
+ }
+ catch (RankException) {
+ int[] iArr = new int[3] { 1, 2, 3};
+ // check the first and last items
+ Assert("AC01", ((IList)iArr).Contains (1));
+ Assert("AC02", ((IList)iArr).Contains (3));
+
+ // and one that is definately not there
+ Assert("AC03", !((IList)iArr).Contains (42));
+ return;
+ }
+
+ Fail("Should not get here");
+ }
+
+ public void TestIList_IndexOf () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+
+ try {
+ bool b = ((IList)myArray).Contains ("23");
+ Fail("IList.Contains should throw with multi-dimensional arrays");
+ }
+ catch (RankException) {
+ int[] iArr = new int[3] { 1, 2, 3};
+ // check the first and last items
+ AssertEquals("AD01", 0, ((IList)iArr).IndexOf (1));
+ AssertEquals("AD02", 2, ((IList)iArr).IndexOf (3));
+
+ // and one that is definately not there
+ AssertEquals("AD03", -1, ((IList)iArr).IndexOf (42));
+ }
+ catch (Exception e) {
+ Fail("Unexpected exception: " + e.ToString());
+ }
+
+ // check that wierd case whem lowerbound is Int32.MinValue,
+ // so that IndexOf() needs to return Int32.MaxValue when it cannot find the object
+ int[] myLengthArray = new int[1] { 3 };
+ int[] myBoundArray = new int[1] { Int32.MinValue };
+ Array myExtremeArray=Array.CreateInstance ( typeof(String), myLengthArray, myBoundArray );
+ AssertEquals("AD04", Int32.MaxValue, ((IList)myExtremeArray).IndexOf (42));
+
+ }
+
+ public void TestGetLength() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = {'a', 'b', 'c'};
+ c1.GetLength(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = {'a', 'b', 'c'};
+ c1.GetLength(1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H02", errorThrown);
+ }
+
+ char[] c2 = new Char[5];
+ AssertEquals("#H03",
+ 5, c2.GetLength(0));
+
+ char[,] c3 = new Char[6,7];
+ AssertEquals("#H04",
+ 6, c3.GetLength(0));
+ AssertEquals("#H05",
+ 7, c3.GetLength(1));
+ }
+
+ public void TestGetLowerBound() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetLowerBound(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H31", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetLowerBound(1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H32", errorThrown);
+ }
+
+ char[] c1 = new Char[5];
+ AssertEquals("#H33",
+ 0, c1.GetLowerBound(0));
+
+ char[,] c2 = new Char[4,4];
+ AssertEquals("#H34",
+ 0, c2.GetLowerBound(0));
+ AssertEquals("#H35",
+ 0, c2.GetLowerBound(1));
+ }
+
+ public void TestGetUpperBound() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetUpperBound(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetUpperBound(1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H62", errorThrown);
+ }
+
+ char[] c1 = new Char[5];
+ AssertEquals("#H63",
+ 4, c1.GetUpperBound(0));
+
+ char[,] c2 = new Char[4,6];
+ AssertEquals("#H64",
+ 3, c2.GetUpperBound(0));
+ AssertEquals("#H65",
+ 5, c2.GetUpperBound(1));
+ }
+
+ public void TestGetValue1() {
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.GetValue(1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetValue(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetValue(4);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I03", errorThrown);
+ }
+
+ char[] c1 = {'a', 'b', 'c', 'd'};
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("#I04(" + i + ")", c1[i], c1.GetValue(i));
+ }
+ }
+ public void TestGetValue2() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.GetValue(1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.GetValue(-1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.GetValue(4,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I23", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ AssertEquals("#I24(" + i + "," + j + ")",
+ c1[i,j], c1.GetValue(i, j));
+ }
+ }
+ }
+ public void TestGetValue3() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.GetValue(1,1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.GetValue(-1, 1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.GetValue(4,1,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I43", errorThrown);
+ }
+
+ char[,,] c1 = new Char[4,2,3];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int remains = i % 6;
+ int second = remains / 3;
+ int third = remains % 3;
+ c1[first,second, third] = (char)(((int)'a')+i);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ for (int k = 0; k < c1.GetLength(2); k++) {
+ AssertEquals("#I44(" + i + "," + j + ")",
+ c1[i,j,k], c1.GetValue(i,j,k));
+ }
+ }
+ }
+ }
+ public void TestGetValueN() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.GetValue(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#I61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ int[] coords = {1, 1};
+ c.GetValue(coords);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I62", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {-1, 1};
+ c.GetValue(coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I63", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {4, 1};
+ c.GetValue(coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I64", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ int[] coords = {i, j};
+ AssertEquals("#I65(" + i + "," + j + ")",
+ c1[i,j], c1.GetValue(coords));
+ }
+ }
+ }
+
+ public void TestIndexOf1() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.IndexOf(null, "huh?");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#J01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.IndexOf(c, "huh?");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#J02", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "a", "test"};
+ AssertEquals("#J03", -1, Array.IndexOf(s1, null));
+ AssertEquals("#J04", -1, Array.IndexOf(s1, "nothing"));
+ AssertEquals("#J05", 0, Array.IndexOf(s1, "this"));
+ AssertEquals("#J06", 3, Array.IndexOf(s1, "test"));
+ }
+ public void TestIndexOf2() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.IndexOf(null, "huh?", 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#J21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.IndexOf(c, "huh?", 0);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#J22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.IndexOf(c, "huh?", 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#J23", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#J24", -1, Array.IndexOf(s1, null, 1));
+ AssertEquals("#J25", -1, Array.IndexOf(s1, "nothing", 1));
+ AssertEquals("#J26", -1, Array.IndexOf(s1, "this", 1));
+ AssertEquals("#J27", 1, Array.IndexOf(s1, "is", 1));
+ AssertEquals("#J28", 4, Array.IndexOf(s1, "test", 1));
+ }
+ public void TestIndexOf3() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.IndexOf(null, "huh?", 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#J41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.IndexOf(c, "huh?", 0, 1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#J42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.IndexOf(c, "huh?", 3, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#J43", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.IndexOf(c, "huh?", 0, 5);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#J44", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#J45", -1, Array.IndexOf(s1, null, 1, 3));
+ AssertEquals("#J46", -1, Array.IndexOf(s1, "nothing", 1, 3));
+ AssertEquals("#J47", -1, Array.IndexOf(s1, "this", 1, 3));
+ AssertEquals("#J48", 1, Array.IndexOf(s1, "is", 1, 3));
+ AssertEquals("#J49", -1, Array.IndexOf(s1, "test", 1, 3));
+ AssertEquals("#J50", 3, Array.IndexOf(s1, "a", 1, 3));
+ }
+
+ public void TestLastIndexOf1() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.LastIndexOf(null, "huh?");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#K01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.LastIndexOf(c, "huh?");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#K02", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "a", "a", "test"};
+ AssertEquals("#K03", -1, Array.LastIndexOf(s1, null));
+ AssertEquals("#K04", -1, Array.LastIndexOf(s1, "nothing"));
+ AssertEquals("#K05", 0, Array.LastIndexOf(s1, "this"));
+ AssertEquals("#K06", 4, Array.LastIndexOf(s1, "test"));
+ AssertEquals("#K07", 3, Array.LastIndexOf(s1, "a"));
+ }
+ public void TestLastIndexOf2() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.LastIndexOf(null, "huh?", 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#K21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.LastIndexOf(c, "huh?", 0);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#K22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.LastIndexOf(c, "huh?", 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#K23", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#K24", -1, Array.LastIndexOf(s1, null, 3));
+ AssertEquals("#K25", -1, Array.LastIndexOf(s1, "nothing", 3));
+ AssertEquals("#K26", -1, Array.LastIndexOf(s1, "test", 3));
+ AssertEquals("#K27", 3, Array.LastIndexOf(s1, "a", 3));
+ AssertEquals("#K28", 0, Array.LastIndexOf(s1, "this", 3));
+ }
+ public void TestLastIndexOf3() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.LastIndexOf(null, "huh?", 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#K41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.LastIndexOf(c, "huh?", 0, 1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#K42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.LastIndexOf(c, "huh?", 3, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#K43", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.LastIndexOf(c, "huh?", 0, 5);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#K44", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#K45",
+ -1, Array.LastIndexOf(s1, null, 3, 3));
+ AssertEquals("#K46",
+ -1, Array.LastIndexOf(s1, "nothing", 3, 3));
+ AssertEquals("#K47",
+ -1, Array.LastIndexOf(s1, "this", 3, 3));
+ AssertEquals("#K48",
+ 1, Array.LastIndexOf(s1, "is", 3, 3));
+ AssertEquals("#K49",
+ -1, Array.LastIndexOf(s1, "test", 3, 3));
+ AssertEquals("#K50",
+ 3, Array.LastIndexOf(s1, "a", 3, 3));
+ }
+
+ public void TestReverse() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.Reverse(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#L01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.Reverse(c);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#L02", errorThrown);
+ }
+
+ char[] c1 = {'a', 'b', 'c', 'd'};
+ Array.Reverse(c1);
+ AssertEquals("#L03", 'd', c1[0]);
+ AssertEquals("#L04", 'c', c1[1]);
+ AssertEquals("#L05", 'b', c1[2]);
+ AssertEquals("#L06", 'a', c1[3]);
+
+ {
+ bool errorThrown = false;
+ try {
+ Array.Reverse(null, 0, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#L07", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.Reverse(c, 0, 0);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#L08", errorThrown);
+ }
+ //{
+ //bool errorThrown = false;
+ //try {
+ // char[] c = new Char[2];
+ // Array.Reverse(c, 0, 3);
+ //} catch (ArgumentOutOfRangeException) {
+ // errorThrown = true;
+ //}
+ //Assert("#L09", errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ // char[] c = new Char[2];
+ // Array.Reverse(c, 3, 0);
+ //} catch (ArgumentOutOfRangeException) {
+ // errorThrown = true;
+ //}
+ //Assert("#L10", errorThrown);
+ //}
+
+ char[] c2 = { 'a', 'b', 'c', 'd'};
+ Array.Reverse(c2, 1, 2);
+ AssertEquals("#L11", 'a', c2[0]);
+ AssertEquals("#L12", 'c', c2[1]);
+ AssertEquals("#L13", 'b', c2[2]);
+ AssertEquals("#L14", 'd', c2[3]);
+ }
+
+ public void TestSetValue1() {
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.SetValue("buh", 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.SetValue("buh", -1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.SetValue("buh", 4);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M03", errorThrown);
+ }
+
+ char[] c1 = {'a', 'b', 'c', 'd'};
+ char[] c2 = new char[4];
+ for (int i = 0; i < c1.Length; i++) {
+ c2.SetValue(c1[i], i);
+ }
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("#M04(" + i + ")", c1[i], c2[i]);
+ }
+
+ int[] c3 = { 1, 2, 3 };
+ long[] c4 = new long [3];
+
+ for (int i = 0; i < c3.Length; i++)
+ c4.SetValue (c3 [i], i);
+
+ try {
+ c3.CopyTo (c4, 0);
+ } catch (Exception e) {
+ Fail ("c3.CopyTo(): e=" + e);
+ }
+ for (int i = 0; i < c3.Length; i++)
+ Assert ("#M05(" + i + ")", c3[i] == c4[i]);
+
+ Object[] c5 = new Object [3];
+ long[] c6 = new long [3];
+
+ try {
+ c4.CopyTo (c5, 0);
+ } catch (Exception e) {
+ Fail ("c4.CopyTo(): e=" + e);
+ }
+
+ try {
+ c5.CopyTo (c6, 0);
+ } catch (Exception e) {
+ Fail ("c5.CopyTo(): e=" + e);
+ }
+ // for (int i = 0; i < c5.Length; i++)
+ // Assert ("#M06(" + i + ")", c5[i] == c6[i]);
+ }
+
+ public void TestSetValue2() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.SetValue("buh", 1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.SetValue("buh", -1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.SetValue("buh", 4,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M23", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ char[,] c2 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ c2.SetValue(c1[first,second], first, second);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ AssertEquals("#M24(" + i + "," + j + ")",
+ c1[i,j], c2[i, j]);
+ }
+ }
+ }
+ public void TestSetValue3() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.SetValue("buh", 1,1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.SetValue("buh", -1, 1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.SetValue("buh", 4,1,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M43", errorThrown);
+ }
+
+ char[,,] c1 = new Char[4,2,3];
+ char[,,] c2 = new Char[4,2,3];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int remains = i % 6;
+ int second = remains / 3;
+ int third = remains % 3;
+ c1[first,second, third] = (char)(((int)'a')+i);
+ c2.SetValue(c1[first, second, third], first, second, third);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ for (int k = 0; k < c1.GetLength(2); k++) {
+ AssertEquals("#M44(" + i + "," + j + " )",
+ c1[i,j,k], c2[i,j,k]);
+ }
+ }
+ }
+ }
+ public void TestSetValueN() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.SetValue("buh", null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#M61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ int[] coords = {1, 1};
+ c.SetValue("buh", coords);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M62", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {-1, 1};
+ c.SetValue("buh", coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M63", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {4, 1};
+ c.SetValue("buh", coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M64", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ char[,] c2 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ int[] coords = {first, second};
+ c2.SetValue(c1[first,second], coords);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ AssertEquals("#M65(" + i + "," + j + ")",
+ c1[i,j], c2[i,j]);
+ }
+ }
+ }
+
+ public void TestSetValue4() {
+ {
+ int[] c1 = { 1, 2, 3 };
+ long[] c2 = new long [3];
+
+ for (int i = 0; i < c1.Length; i++)
+ c2.SetValue (c1 [i], i);
+
+ for (int i = 0; i < c1.Length; i++) {
+ Assert ("#M81(" + i + ")", c1[i] == c2[i]);
+ AssertEquals ("#M82(" + i + ")", typeof (long), c2[i].GetType ());
+ }
+ }
+ {
+ long[] c1 = { 1, 2, 3 };
+ int[] c2 = new int [3];
+ bool errorThrown = false;
+ try {
+ c2.SetValue (c1 [0], 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M83", errorThrown);
+ }
+ {
+ int[] c1 = { 1, 2, 3 };
+ Object[] c2 = new Object [3];
+
+ for (int i = 0; i < c1.Length; i++)
+ c2.SetValue (c1 [i], i);
+
+ for (int i = 0; i < c1.Length; i++)
+ AssertEquals ("#M84(" + i + ")", c1[i], Convert.ToInt32 (c2[i]));
+ }
+ {
+ Object[] c1 = new Object [3];
+ Object[] c2 = new Object [3];
+ c1[0] = new Object ();
+
+ for (int i = 0; i < c1.Length; i++)
+ c2.SetValue (c1 [i], i);
+
+ for (int i = 0; i < c1.Length; i++)
+ AssertEquals ("#M85(" + i + ")", c1[i], c2[i]);
+ }
+ {
+ Object[] c1 = new Object [3];
+ string[] c2 = new String [3];
+ string test = "hello";
+ c1[0] = test;
+
+ c2.SetValue (c1 [0], 0);
+ AssertEquals ("#M86", c1[0], c2[0]);
+ AssertEquals ("#M87", "hello", c2[0]);
+ }
+ {
+ char[] c1 = { 'a', 'b', 'c' };
+ string[] c2 = new string [3];
+ try {
+ c2.SetValue (c1 [0], 0);
+ Fail ("#M88");
+ } catch (InvalidCastException) {}
+ }
+ {
+ Single[] c1 = { 1.2F, 2.3F, 3.4F, 4.5F };
+ long[] c2 = new long [3];
+ try {
+ c2.SetValue (c1 [0], 0);
+ Fail ("#M89");
+ } catch (ArgumentException) {}
+ }
+ {
+ Type[] types = {
+ typeof (Boolean),
+ typeof (Byte),
+ typeof (Char),
+ typeof (Double),
+ typeof (Int16),
+ typeof (Int32),
+ typeof (Int64),
+ typeof (SByte),
+ typeof (Single),
+ typeof (UInt16),
+ typeof (UInt32),
+ typeof (UInt64)
+ };
+
+ bool v1 = true;
+ Byte v2 = 1;
+ Char v3 = 'a';
+ Double v4 = -1.2;
+ Int16 v5 = -32;
+ Int32 v6 = -234;
+ Int64 v7 = -34523;
+ SByte v8 = -1;
+ Single v9 = -4.8F;
+ UInt16 v10 = 24234;
+ UInt32 v11 = 235354;
+ UInt64 v12 = 234552;
+
+ Object[] va1 = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 };
+ Object[] va2 = { "true", "1", "a", "-1.2", "-32", "-234", "-34523", "-1",
+ "-4.8F", "24234", "235354", "234552" };
+
+ Object[][] vt = { va1, va1, va1, va1, va1, va1, va1, va1, va1, va1, va1, va1 };
+
+ int[] arg_ex = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
+ 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0,
+ 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0
+ };
+
+ // SetValue
+
+ for (int i = 0; i < types.Length; i++) {
+ for (int j = 0; j < types.Length; j++) {
+ Array array = Array.CreateInstance (types [j], 2);
+
+ Object value = vt[j][i];
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+
+ int ex_index = (i * types.Length) + j;
+
+ AssertEquals ("#M90(" + types [i] + "," + types [j] + ")",
+ errorThrown, arg_ex [ex_index] == 1);
+ }
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ String[] array = new String [2];
+
+ Object value = va1 [i];
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M91(" + types [i] + ")", errorThrown);
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ Array array = Array.CreateInstance (types [i], 2);
+
+ Object value = va2 [i];
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M92(" + types [i] + ")", errorThrown);
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ Array array = Array.CreateInstance (types [i], 2);
+
+ Object value = null;
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M93(" + types [i] + ")", !errorThrown);
+ }
+
+ // Copy
+
+ for (int i = 0; i < types.Length; i++) {
+ for (int j = 0; j < types.Length; j++) {
+ Array source = Array.CreateInstance (types [i], 2);
+ Array array = Array.CreateInstance (types [j], 2);
+
+ source.SetValue (vt[j][i], 0);
+ source.SetValue (vt[j][i], 1);
+
+ bool errorThrown = false;
+ try {
+ Array.Copy (source, array, 2);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+
+ int ex_index = (i * types.Length) + j;
+
+ AssertEquals ("#M94(" + types [i] + "," + types [j] + ")",
+ errorThrown, arg_ex [ex_index] == 1);
+ }
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ Array source = Array.CreateInstance (types [i], 2);
+ String[] array = new String [2];
+
+ source.SetValue (va1 [i], 0);
+ source.SetValue (va1 [i], 1);
+
+ bool errorThrown = false;
+ try {
+ Array.Copy (source, array, 2);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M95(" + types [i] + ")", errorThrown);
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ String[] source = new String [2];
+ Array array = Array.CreateInstance (types [i], 2);
+
+ source.SetValue (va2 [i], 0);
+ source.SetValue (va2 [i], 1);
+
+ bool errorThrown = false;
+ try {
+ Array.Copy (source, array, 2);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M96(" + types [i] + ")", errorThrown);
+ }
+ }
+ }
+
+
+ public void TestSort() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.Sort(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.Sort(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = new Char[2];
+ Array.Sort(null, c1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N03", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = new Char[2];
+ Array.Sort(null, c1, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N04", errorThrown);
+ }
+
+ // note: null second array => just sort first array
+ char[] starter = {'d', 'b', 'f', 'e', 'a', 'c'};
+ int[] starter1 = {1,2,3,4,5,6};
+ {
+ char[] c1 = (char[])starter.Clone();
+ Array.Sort(c1);
+ AssertEquals("#N21", 'a', c1[0]);
+ AssertEquals("#N22", 'b', c1[1]);
+ AssertEquals("#N23", 'c', c1[2]);
+ AssertEquals("#N24", 'd', c1[3]);
+ AssertEquals("#N25", 'e', c1[4]);
+ AssertEquals("#N26", 'f', c1[5]);
+ }
+ {
+ char[] c1 = (char[])starter.Clone();
+ int[] i1 = (int[])starter1.Clone();
+ Array.Sort(c1, i1);
+ AssertEquals("#N41", 'a', c1[0]);
+ AssertEquals("#N42", 'b', c1[1]);
+ AssertEquals("#N43", 'c', c1[2]);
+ AssertEquals("#N44", 'd', c1[3]);
+ AssertEquals("#N45", 'e', c1[4]);
+ AssertEquals("#N46", 'f', c1[5]);
+ AssertEquals("#N47", 5, i1[0]);
+ AssertEquals("#N48", 2, i1[1]);
+ AssertEquals("#N49", 6, i1[2]);
+ AssertEquals("#N50", 1, i1[3]);
+ AssertEquals("#N51", 4, i1[4]);
+ AssertEquals("#N52", 3, i1[5]);
+ }
+ {
+ char[] c1 = (char[])starter.Clone();
+ Array.Sort(c1, 1, 4);
+ AssertEquals("#N61", 'd', c1[0]);
+ AssertEquals("#N62", 'a', c1[1]);
+ AssertEquals("#N63", 'b', c1[2]);
+ AssertEquals("#N64", 'e', c1[3]);
+ AssertEquals("#N65", 'f', c1[4]);
+ AssertEquals("#N66", 'c', c1[5]);
+ }
+ {
+ char[] c1 = (char[])starter.Clone();
+ int[] i1 = (int[])starter1.Clone();
+ Array.Sort(c1, i1, 1, 4);
+ AssertEquals("#N81", 'd', c1[0]);
+ AssertEquals("#N82", 'a', c1[1]);
+ AssertEquals("#N83", 'b', c1[2]);
+ AssertEquals("#N84", 'e', c1[3]);
+ AssertEquals("#N85", 'f', c1[4]);
+ AssertEquals("#N86", 'c', c1[5]);
+ AssertEquals("#N87", 1, i1[0]);
+ AssertEquals("#N88", 5, i1[1]);
+ AssertEquals("#N89", 2, i1[2]);
+ AssertEquals("#N90", 4, i1[3]);
+ AssertEquals("#N91", 3, i1[4]);
+ AssertEquals("#N92", 6, i1[5]);
+ }
+ }
+
+ // TODO - TestSort passed-in IComparable versions
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/AttributeTest.cs b/mcs/class/corlib/Test/System/AttributeTest.cs
new file mode 100755
index 00000000000..ed13ece353c
--- /dev/null
+++ b/mcs/class/corlib/Test/System/AttributeTest.cs
@@ -0,0 +1,157 @@
+//
+// AttributeTest.cs - NUnit Test Cases for the System.Attribute class
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+// Inner namespace for some test helper classes
+using MonoTests.System.AttributeTestInternals;
+
+namespace AttributeTestInternals
+{
+
+[AttributeUsage(AttributeTargets.Class, AllowMultiple=true, Inherited=false)]
+internal class MyCustomAttribute : Attribute {
+
+ private string _info;
+
+ public MyCustomAttribute (string info)
+ {
+ _info = info;
+ }
+
+ public string Info
+ {
+ get {
+ return _info;
+ }
+ }
+
+}
+
+[AttributeUsage(AttributeTargets.Class)]
+internal class YourCustomAttribute : Attribute {
+
+ private int _value;
+
+ public YourCustomAttribute (int value)
+ {
+ _value = value;
+ }
+
+ public int Value
+ {
+ get {
+ return _value;
+ }
+ }
+}
+
+[AttributeUsage(AttributeTargets.Class)]
+internal class UnusedAttribute : Attribute {
+}
+
+[MyCustomAttribute("MyBaseClass"), YourCustomAttribute(37)]
+internal class MyClass {
+ int Value { get { return 42; }}
+}
+
+[MyCustomAttribute("MyDerivedClass")]
+internal class MyDerivedClass : MyClass {
+ public void Do () {}
+}
+
+} // Namespace MonoTests.System.AttributeTestInternals
+
+public class AttributeTest : TestCase {
+
+ public AttributeTest () {}
+
+ public void TestIsDefined ()
+ {
+ AssertEquals ("A1", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(MyCustomAttribute)));
+ AssertEquals ("A2", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(YourCustomAttribute)));
+ AssertEquals ("A3", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(UnusedAttribute)));
+ AssertEquals ("A4", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(MyCustomAttribute), true));
+ AssertEquals ("A5", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(YourCustomAttribute), true));
+ AssertEquals ("A6", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(UnusedAttribute), false));
+ AssertEquals ("A7", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(MyCustomAttribute), false));
+ AssertEquals ("A8", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(YourCustomAttribute), false));
+ AssertEquals ("A9", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(UnusedAttribute), false));
+ }
+
+/*
+ public static void TestIsDefaultAttribute ()
+ {
+ Console.WriteLine(">>>IsDefaultAttribute");
+
+ Attribute a = Attribute.GetCustomAttribute(typeof(MyClass), typeof(MyCustomAttribute));
+ Console.WriteLine (a.IsDefaultAttribute() );
+ }
+
+ private static void WriteAttribute (Attribute a)
+ {
+ if (a == null) {
+ Console.WriteLine ("NULL");
+ }
+ else {
+ Console.WriteLine (a);
+ }
+ }
+*/
+
+ public void TestGetCustomAttribute ()
+ {
+ int i = 1;
+ Type t = typeof(MyDerivedClass);
+ try {
+ AssertEquals ("A1", "MyDerivedClass", ((MyCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(MyCustomAttribute), false))).Info);
+ i++;
+ AssertEquals ("A2", null, ((YourCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(YourCustomAttribute), false))));
+ i++;
+ AssertEquals ("A3", "MyDerivedClass", ((MyCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(MyCustomAttribute)))).Info);
+ i++;
+ AssertEquals ("A4", 37, ((YourCustomAttribute) (Attribute.GetCustomAttribute(t, typeof(YourCustomAttribute)))).Value);
+ } catch (Exception e) {
+ Fail ("Unexpected exception thrown at i=" + i + " with t=" + t + ". e=" + e);
+ }
+ }
+/*
+
+ public static void WriteAttributes (Attribute[] attrs)
+ {
+ Console.WriteLine("length = {0}", attrs.Length);
+ foreach (Attribute a in attrs) {
+ WriteAttribute (a);
+ }
+ }
+
+
+ private static void TestGetCustomAttributes ()
+ {
+ Console.WriteLine(">>>GetCustomAttributes");
+
+
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), typeof(MyCustomAttribute)));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), typeof(MyCustomAttribute), true));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), typeof(MyCustomAttribute), false));
+
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass)));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), true));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), false));
+ }
+
+*/
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/BitConverterTest.cs b/mcs/class/corlib/Test/System/BitConverterTest.cs
new file mode 100755
index 00000000000..d24be8d8238
--- /dev/null
+++ b/mcs/class/corlib/Test/System/BitConverterTest.cs
@@ -0,0 +1,536 @@
+//
+// BitConverterTest.cs - NUnit Test Cases for System.BitConverter
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class BitConverterTest : TestCase {
+
+ public BitConverterTest () {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ public void TestIsLittleEndian ()
+ {
+ byte[] b;
+
+ b = BitConverter.GetBytes (1);
+ AssertEquals ("A1", b[0] == 1, BitConverter.IsLittleEndian );
+ }
+
+ private void PrivateTestSingle (float v1)
+ {
+ float v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 4, b.Length);
+
+ v2 = BitConverter.ToSingle (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToSingle (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToSingle (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToSingle ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestSingle()
+ {
+ PrivateTestSingle (0.1f);
+ PrivateTestSingle (24.1e30f);
+ }
+
+ private void PrivateTestDouble (double v1)
+ {
+ double v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 8, b.Length);
+
+ v2 = BitConverter.ToDouble (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToDouble (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToDouble (larger, 3);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToDouble ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestDouble ()
+ {
+ double d = 123.321;
+
+ AssertEquals("A1", d, BitConverter.Int64BitsToDouble (BitConverter.DoubleToInt64Bits (d)));
+
+ PrivateTestDouble (0.1);
+ PrivateTestDouble (24.1e77);
+ }
+
+ private void PrivateTestBool (bool v1)
+ {
+ bool v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 1, b.Length);
+
+ v2 = BitConverter.ToBoolean (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToBoolean (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToBoolean (larger, 4);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToBoolean ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestBool () {
+ PrivateTestBool(true);
+ PrivateTestBool(false);
+ }
+
+ private void PrivateTestChar (char v1)
+ {
+ char v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 2, b.Length);
+
+ v2 = BitConverter.ToChar (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToChar (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToChar (larger, 3);
+ exception = false;
+ }
+ // LAMESPEC:
+ // the docs say it should be ArgumentOutOfRangeException, but
+ // the mscorlib throws an ArgumentException.
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToChar ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestChar ()
+ {
+ PrivateTestChar('A');
+ PrivateTestChar('\x01ff');
+ }
+
+ private void PrivateTestInt16 (short v1)
+ {
+ short v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 2, b.Length);
+
+ v2 = BitConverter.ToInt16 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToInt16 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToInt16 (larger, 3);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToInt16 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestInt16 ()
+ {
+ PrivateTestInt16 (0);
+ PrivateTestInt16 (1000);
+ PrivateTestInt16 (-32768);
+ PrivateTestInt16 (32767);
+ }
+
+ private void PrivateTestUInt16 (ushort v1)
+ {
+ ushort v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 2, b.Length);
+
+ v2 = BitConverter.ToUInt16 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToUInt16 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToUInt16 (larger, 3);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToUInt16 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestUInt16 ()
+ {
+ PrivateTestUInt16 (0);
+ PrivateTestUInt16 (1000);
+ PrivateTestUInt16 (65535);
+ }
+
+ private void PrivateTestInt32 (int v1)
+ {
+ int v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 4, b.Length);
+
+ v2 = BitConverter.ToInt32 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToInt32 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToInt32 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToInt32 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestInt32 ()
+ {
+ PrivateTestInt32 (0);
+ PrivateTestInt32 (1000);
+ PrivateTestInt32 (-2147483648);
+ PrivateTestInt32 (2147483647);
+ }
+
+ private void PrivateTestUInt32 (uint v1)
+ {
+ uint v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals ("A1", 4, b.Length);
+
+ v2 = BitConverter.ToUInt32 (b, 0);
+ AssertEquals ("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToUInt32 (larger, 1);
+ AssertEquals ("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToUInt32 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToUInt32 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestUInt32 ()
+ {
+ PrivateTestUInt32 (0u);
+ PrivateTestUInt32 (1000u);
+ PrivateTestUInt32 (4294967295u);
+ }
+
+ private void PrivateTestInt64 (long v1)
+ {
+ long v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals ("A1", 8, b.Length);
+
+ v2 = BitConverter.ToInt64 (b, 0);
+ AssertEquals ("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToInt64 (larger, 1);
+ AssertEquals ("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToInt64 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToInt64 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestInt64 ()
+ {
+ PrivateTestInt64 (0);
+ PrivateTestInt64 (1000);
+ PrivateTestInt64 (-9223372036854775808);
+ PrivateTestInt64 (9223372036854775807);
+ }
+
+ private void PrivateTestUInt64 (ulong v1)
+ {
+ ulong v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 8, b.Length);
+
+ v2 = BitConverter.ToUInt64 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToUInt64 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToUInt64 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToUInt64 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestUInt64 ()
+ {
+ PrivateTestUInt64 (0);
+ PrivateTestUInt64 (1000);
+ PrivateTestUInt64 (18446744073709551615);
+ }
+
+ public void TestToString ()
+ {
+ string s;
+ bool exception;
+
+ byte[] b = new byte[] {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
+
+ AssertEquals ("A1", "00-11-22-33-44-55-66-77-88-99-AA-BB-CC-DD-EE-FF", BitConverter.ToString (b));
+ AssertEquals ("A2", "66-77-88-99-AA-BB-CC-DD-EE-FF", BitConverter.ToString (b, 6));
+ AssertEquals ("A3", "66-77-88", BitConverter.ToString (b, 6, 3));
+
+ try {
+ s = BitConverter.ToString ((byte[]) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ s = BitConverter.ToString (b, 20);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+
+ try {
+ s = BitConverter.ToString ((byte[]) null, 20);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A6", exception);
+
+ try {
+ s = BitConverter.ToString (b, 20, 3);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A7", exception);
+
+ try {
+ s = BitConverter.ToString ((byte[]) null, 20, 3);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A8", exception);
+
+ try {
+ s = BitConverter.ToString (b, 16, 0);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+
+
+ }
+
+}
+}
diff --git a/mcs/class/corlib/Test/System/BooleanTest.cs b/mcs/class/corlib/Test/System/BooleanTest.cs
new file mode 100644
index 00000000000..5ecaead444c
--- /dev/null
+++ b/mcs/class/corlib/Test/System/BooleanTest.cs
@@ -0,0 +1,106 @@
+// BooleanTest.cs - NUnit Test Cases for the System.Boolean class
+//
+// Bob Doan <bdoan@sicompos.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class BooleanTest : TestCase
+{
+ public BooleanTest () {}
+
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestStrings ()
+ {
+ AssertEquals("Wrong False string", "False", Boolean.FalseString);
+ AssertEquals("Wrong True string", "True", Boolean.TrueString);
+ }
+
+ public void TestCompareTo() {
+ Boolean t=true,f=false;
+ String s = "What Ever";
+ AssertEquals("CompareTo Failed", true, f.CompareTo(t) < 0);
+ AssertEquals("CompareTo Failed", 0, f.CompareTo(f));
+ AssertEquals("CompareTo Failed", 0, t.CompareTo(t));
+ AssertEquals("CompareTo Failed", true, t.CompareTo(f) > 0);
+ AssertEquals("CompareTo Failed", true, t.CompareTo(null) > 0);
+ try {
+ t.CompareTo(s);
+ Fail("CompareTo should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert("CompareTo should be a System.ArgumentException", typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals() {
+ Boolean t=true, f=false;
+ String s = "What Ever";
+ AssertEquals("Equals Failed", true, t.Equals(t));
+ AssertEquals("Equals Failed", true, f.Equals(f));
+ AssertEquals("Equals Failed", false, f.Equals(t));
+ AssertEquals("Equals Failed", false, t.Equals(null));
+ AssertEquals("Equals Failed", false, t.Equals(s));
+ }
+
+ public void TestGetHashCode() {
+ Boolean t=true, f=false;
+ AssertEquals("GetHashCode True failed", 1, t.GetHashCode());
+ AssertEquals("GetHashCode True failed", 0, f.GetHashCode());
+ }
+
+ public void TestGetType() {
+ Boolean t=true, f=false;
+ AssertEquals("GetType failed", true, Object.ReferenceEquals(t.GetType(), f.GetType()));
+ }
+
+ public void TestGetTypeCode() {
+ Boolean b=true;
+ AssertEquals("GetTypeCode failed", TypeCode.Boolean, b.GetTypeCode());
+ }
+
+ public void TestParse() {
+ AssertEquals("Parse True failed", true, Boolean.Parse("True"));
+ AssertEquals("Parse True failed", true, Boolean.Parse(" True"));
+ AssertEquals("Parse True failed", true, Boolean.Parse("True "));
+ AssertEquals("Parse True failed", true, Boolean.Parse("tRuE"));
+ AssertEquals("Parse False failed", false, Boolean.Parse("False"));
+ AssertEquals("Parse False failed", false, Boolean.Parse(" False"));
+ AssertEquals("Parse False failed", false, Boolean.Parse("False "));
+ AssertEquals("Parse False failed", false, Boolean.Parse("fAlSe"));
+
+ try {
+ Boolean.Parse("not-t-or-f");
+ Fail("Parse should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a System.FormatException", typeof(FormatException) == e.GetType());
+ }
+
+ try {
+ Boolean.Parse(null);
+ Fail("Parse should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a System.ArgumentNullException", typeof(ArgumentNullException) == e.GetType());
+ }
+ }
+
+ public void TestToString() {
+ Boolean t=true,f=false;
+ AssertEquals("ToString True Failed", Boolean.TrueString, t.ToString());
+ AssertEquals("ToString False Failed", Boolean.FalseString, f.ToString());
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/BufferTest.cs b/mcs/class/corlib/Test/System/BufferTest.cs
new file mode 100644
index 00000000000..41cf7ee1582
--- /dev/null
+++ b/mcs/class/corlib/Test/System/BufferTest.cs
@@ -0,0 +1,162 @@
+// BufferTest.cs - NUnit Test Cases for the Buffer class.
+//
+// Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) Cesar Octavio Lopez Nataren 2002
+//
+
+using NUnit.Framework;
+using System;
+
+
+namespace MonoTests.System
+{
+ public class BufferTest : TestCase
+ {
+ const int SIZE = 10;
+ byte [] byteArray = new byte [SIZE]; // 8-bits unsigned integer array
+ float [] floatArray = new float [SIZE];
+
+ public BufferTest () {}
+
+ protected override void SetUp () {}
+
+
+ protected override void TearDown () {}
+
+ public void TestBlockCopy ()
+ {
+ int SizeOfInt32 = 4;
+ int [] myArray1 = new int [5] {1, 2, 3, 4, 5};
+ int [] myArray2 = new int [10] { 0, 0, 0, 0, 0, 6, 7, 8, 9, 10 };
+
+ Buffer.BlockCopy (myArray1, 0, myArray2, 0, SizeOfInt32 * myArray1.Length);
+
+ for (int i = 0; i < myArray1.Length; i++)
+ AssertEquals ("TestBlockCopy Error at i=" + i, i + 1, myArray2 [i]);
+ }
+
+
+ public void TestByteLength ()
+ {
+ int numBytes;
+ float [] floatArray = new float [10];
+ TestCase [] someArray = new TestCase [3];
+
+ try {
+ Buffer.ByteLength (null);
+ Fail ("TestByteLength: ArgumentNullException not thrown");
+ } catch (ArgumentNullException) {
+ // do nothing, this is expected
+ } catch (Exception e) {
+ Fail ("Unexpected exception on Buffer.ByteLength (null):" + e);
+ }
+
+ try {
+ Buffer.ByteLength (someArray);
+ Fail ("TestByteLength: ArgumentException not thrown");
+ } catch (ArgumentException) {
+ // do nothing, this is expected
+ } catch (Exception e) {
+ Fail ("Unexpected exception on Buffer.ByteLength (non primitive array):" + e);
+ }
+
+ numBytes = Buffer.ByteLength (floatArray);
+ AssertEquals ("TestByteLength: wrong byteLength", 40, numBytes);
+ }
+
+ public void TestGetByte ()
+ {
+ Byte [] byteArray;
+ bool errorThrown = false;
+ byteArray = new byte [10];
+ byteArray [5] = 8;
+ TestCase [] someArray = new TestCase [3];
+
+ try {
+ Buffer.GetByte (null, 5);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert ("TestGetByte: ArgumentNullException not thrown",
+ errorThrown);
+
+ errorThrown = false;
+
+ try {
+ Buffer.GetByte (byteArray, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert ("TestGetByte: ArgumentOutOfRangeException (negative index) not implemented",
+ errorThrown);
+
+ errorThrown = false;
+
+ try {
+ Buffer.GetByte (byteArray, 12);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert ("TestGetByte: ArgumentOutOfRangeException (index bigger/equal than array's size not thrown", errorThrown);
+
+ errorThrown = false;
+
+ try {
+ Buffer.GetByte (someArray, 0);
+ Fail ("TestGetByte: ArgumentException not thrown");
+ } catch (ArgumentException) {
+ // do nothing, this is expected
+ } catch (Exception e) {
+ Fail ("Unexpected exception on Buffer.GetByte (non primitive array):" + e);
+ }
+
+ AssertEquals ("TestGetByte Error", (Byte)8, Buffer.GetByte (byteArray, 5));
+ }
+
+
+ public void TestSetByte ()
+ {
+ bool errorThrown = false;
+ TestCase [] someArray = new TestCase [3];
+
+ try {
+ Buffer.SetByte (null, 5, 12);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert ("TestSetByte: ArgumentNullException not thrown", errorThrown);
+ errorThrown = false;
+
+ try {
+ Buffer.SetByte (byteArray, -1, 32);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert ("TestSetByte: ArgumentOutOfRangeException (case: negative index) not thrown",
+ errorThrown);
+ errorThrown = false;
+
+ try {
+ Buffer.SetByte (byteArray, 12, 43);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert ("TestSetByte: ArgumentOutOfRangeException (case: index bigger/equal than array'size",
+ errorThrown);
+ errorThrown = false;
+
+ try {
+ Buffer.SetByte (someArray, 0, 42);
+ Fail ("TestSetByte: ArgumentException not thrown");
+ } catch (ArgumentException) {
+ // do nothing, this is expected
+ } catch (Exception e) {
+ Fail ("Unexpected exception on Buffer.SetByte (non primitive array):" + e);
+ }
+
+ Buffer.SetByte (byteArray, 3, (byte) 10);
+ AssertEquals ("TestSetByte", (Byte)10, Buffer.GetByte (byteArray, 3));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System/ByteTest.cs b/mcs/class/corlib/Test/System/ByteTest.cs
new file mode 100644
index 00000000000..182a1eac456
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ByteTest.cs
@@ -0,0 +1,182 @@
+// ByteTest.cs - NUnit Test Cases for the System.Byte struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System
+{
+
+public class ByteTest : TestCase
+{
+ private const Byte MyByte1 = 42;
+ private const Byte MyByte2 = 0;
+ private const Byte MyByte3 = 255;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "255";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = { "",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results1_Nfi = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {NumberFormatInfo.CurrentInfo.CurrencySymbol+"255.00000",
+ "00255", "2.55000e+002", "255.00000",
+ "255", "255.00000", "25,500.00000 %", "000ff"};
+ private string[] Results2_Nfi = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"255.00000",
+ "00255", "2.55000e+002", "255.00000",
+ "255", "255.00000", "25,500.00000 %", "000ff"};
+
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public ByteTest() {}
+
+ protected override void SetUp() {
+ int cdd = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits;
+ string csym = NumberFormatInfo.CurrentInfo.CurrencySymbol;
+ string csuffix = (cdd > 0 ? "." : "").PadRight(cdd + (cdd > 0 ? 1 : 0), '0');
+ Results1[0] = csym + "0" + csuffix;
+ }
+
+ protected override void TearDown () {
+ }
+
+ public void TestMinMax()
+ {
+ AssertEquals(Byte.MinValue, MyByte2);
+ AssertEquals(Byte.MaxValue, MyByte3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyByte3.CompareTo(MyByte2) > 0);
+ Assert(MyByte2.CompareTo(MyByte2) == 0);
+ Assert(MyByte1.CompareTo((Byte)42) == 0);
+ Assert(MyByte2.CompareTo(MyByte3) < 0);
+ try {
+ MyByte2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyByte1.Equals(MyByte1));
+ Assert(MyByte1.Equals((Byte)42));
+ Assert(MyByte1.Equals((Int16)42) == false);
+ Assert(MyByte1.Equals(MyByte2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyByte1.GetHashCode();
+ MyByte2.GetHashCode();
+ MyByte3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert("MyByte1="+MyByte1+", MyString1="+MyString1+", Parse="+Byte.Parse(MyString1) , MyByte1 == Byte.Parse(MyString1));
+ Assert("MyByte2", MyByte2 == Byte.Parse(MyString2));
+ Assert("MyByte3", MyByte3 == Byte.Parse(MyString3));
+
+ try {
+ Byte.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Should get ArgumentNullException", typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ Byte.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("not-a-number", typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = Byte.MaxValue + 1;
+ Byte.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert("OverflowException", typeof(OverflowException) == e.GetType());
+ }
+
+ //test Parse(string s, NumberStyles style)
+ AssertEquals(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ",
+ (byte)42, Byte.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ",
+ NumberStyles.Currency));
+ try {
+ Byte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 and NumberStyles.Integer", typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(" 42 and Nfi", 42 == Byte.Parse(" 42 ", Nfi));
+ try {
+ Byte.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("%42 and Nfi", typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert("NumberStyles.HexNumber", 16 == Byte.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Byte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42, NumberStyles.Integer, Nfi", typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals("Compare failed for MyString1 and MyByte1", MyString1, MyByte1.ToString());
+ AssertEquals("Compare failed for MyString2 and MyByte2", MyString2, MyByte2.ToString());
+ AssertEquals("Compare failed for MyString3 and MyByte3", MyString3, MyByte3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("Compare failed for Formats1["+i.ToString()+"]", Results1[i], MyByte2.ToString(Formats1[i]));
+ AssertEquals("Compare failed for Formats2["+i.ToString()+"]", Results2[i], MyByte3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("Compare failed for Formats1["+i.ToString()+"] with Nfi", Results1_Nfi[i], MyByte2.ToString(Formats1[i], Nfi));
+ AssertEquals("Compare failed for Formats2["+i.ToString()+"] with Nfi", Results2_Nfi[i], MyByte3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyByte1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ AssertEquals("Exception is the wrong type", typeof(FormatException), e.GetType());
+ }
+
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog
new file mode 100644
index 00000000000..4591a2d7bc3
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ChangeLog
@@ -0,0 +1,596 @@
+2003-01-13 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: Use 2003, since that' the year now. Need to work
+ on this test so we don't have it fail each new year.
+
+2002-12-21 Nick Drochak <ndrochak@gol.com>
+
+ * all: make tests build and run under nunit2
+
+2002-11-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringTest.cs: added 1 more check.
+
+2002-10-29 Zoltan Varga <vargaz@freemail.hu>
+
+ * EnumTest.cs: Added tests for whitespaces in Enum:Parse().
+
+2002-10-16 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Find out which Assert is causing the error on mono.
+
+2002-10-09 Nick Drochak <ndrochak@gol.com>
+
+ * BufferTest.cs: Test for ArgumentExceptions where they should be
+ thrown
+ * Int32Test.cs: Enable tests for custom format strings. We do have
+ implementation for them now.
+
+2002-09-29 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Change from Assert() with == to AssertEquals(). This
+ gets the tests to pass on linux, but they shouldn't need that. Now
+ to find out why. This seems deep...
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Report errors with CopyTo().
+
+2002-09-19 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Can check for exception throw now on CopyTo(). Re-
+ enable test.
+
+2002-09-13 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Add an extreme value test for format.
+
+2002-09-11 Nick Drochak <ndrochak@gol.com>
+
+ * DoubleTest.cs: Add test for bad format string passed to ToString().
+ * Int64Test.cs: Re-enable broad range of test values.
+ * MulticastDeletegateTest.cs: Re-enable test for correct order of
+ delegate firing.
+
+2002-09-08 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: Disable test bug file it in bugzilla.
+
+2002-09-04 Jonathan Pryor <jonpryor@vt.edu>
+ * EnumTest.cs:
+ - Added additional "x" formatter test case to test most recent Enum.cs patch
+ - Code cleanup so that all TestFormat test cases would be executed
+ - Change exception types in TestFormat_Args so that it passes on .NET.
+ (Some ArgumentNullExceptions should be been ArgumentExceptions.)
+
+2002/08/09 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Add try-catch block to find which one is throwing
+ the Overflow. Also started making each Assert using a unique message
+ to differentiate those as well.
+
+ * MulticastDelegate.cs: Disable tests checking the order that delegates
+ are executed. There's a bugzilla entry for this already because we do
+ it in reverse order. See:
+ http://bugzilla.ximian.com/show_bug.cgi?id=28306
+
+2002/08/02 Nick Drochak <ndrochak@gol.com>
+
+ * ConvertTest.cs (TestGetTypeCode): Find out which test is failing on
+ linux.
+
+2002-08-02 Nick Drochak <ndrochak@gol.com>
+
+ * BufferTest.cs (TestBlockCopy): BlockCopy uses the number of bytes,
+ so hard-code some of that info into the test since sizeof() is a very
+ unsafe thing to do.
+
+2002-07-31 Nick Drochak <ndrochak@gol.com>
+
+ * BufferTest.cs: Fixed noisy compiler warnings about unused vars.
+
+2002-07-22 Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * BufferTest.cs: Added this file to test the System.Buffer class
+ implementation.
+
+2002-07-17 Martin Baulig <martin@gnome.org>
+
+ * ConvertTest.cs: Commented out line 456 which contains a non-printable
+ character which mcs does not like. See also bug #27655.
+
+ * DecimalTest.cs, DecimanTest2.cs: Removed the `using S = System'.
+
+2002-07-11 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Disable a test for now. Bugzilla'd this one.
+ * ConvertTest.cs: Make message unique for this mistaken duplicate.
+
+2002-07-04 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: Made tests pass on ms.net. Well, they pass in
+ timezone JST. Need to test in others. Maybe I'll fly over to GMT
+ and see how they work. Supposed to be eaiser there.
+
+2002-07-04 Nick Drochak <ndrochak@gol.com>
+
+ * ConvertTest.cs: Make the test generate the overflow exceptions on
+ mono on Linux.
+ * DecimalTest2.cs: Report exception thrown during subtraction.
+
+2002-07-03 Nick Drochak <ndrochak@gol.com>
+
+ * DoubleTest.cs: Fix some Assert/AssertEquals usage.
+
+2002-07-03 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Re-enable some tests. Let's see what's broken still.
+
+2002-06-20 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest2.cs: Make tests pass against ms.net.
+
+2002-06-19 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add missing test: DecimalTest2
+ * DecimalTest2.cs: Convert Console.Writeline() into a Fail()
+
+2002/06/14 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: Make currency symbol test more culturally sensitive.
+
+2002-06-14 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: Make some of the tests a bit more timezone neutral.
+
+2002-06-12 Nick Drochak <ndrochak@gol.com>
+
+ * ConvertTest.cs: Punt bug in DateTime.Parse() over to that test.
+ * DateTimeTest.cs: Add test for date format of yyyy-mm-dd which mono
+ doesn't handle automagically like ms.net does. This smells like a
+ LAMESPEC, however.
+
+2002/06/12 Nick Drochak <ndrochak@gol.com>
+
+ * RandomTest.cs: Exercise Next(min,max) a little more, especially
+ boundary conditions.
+
+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * StringTest.cs: Check for "end of string" conditions for IndexOf() and
+ Substring().
+
+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * DoubleTest.cs: Add some more detail to failure message.
+ * Int64Test.cs: Add some details, and fix a copy-paste error.
+ * UInt32Test.cs: Fix currency symbol/culture issues
+ * UInt64Test.cs: Fix currency symbol/culture issues
+
+2002/06/11 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: Remove RunTest override and put culture manipulation
+ in SetUp and TearDown like the other tests.
+ * TimeZoneTest.cs: Same.
+
+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: Set the culture to en-US for testing.
+ * MathTest.cs: mono is more precise in Log2, so change test to compare
+ values within a slightly larger margin of error.
+
+2002/06/10 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: More culture indepenence. Fixes the problems we were
+ having with tests failing against MS.NET.
+ * Int64Test.cs: Same plus some formatting fixes.
+ * RandomTest.cs: Split Assert into two to figure out which one part is
+ failing.
+
+2002-06-09 Lawrence Pit <loz@cable.a2000.nl>
+
+ * DateTimeTest.cs: Making tests culture independent
+
+2002-06-07 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Catch unexpected exception and report it.
+
+2002/06/04 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs: Fix currency constant that we use for the expected
+ value. Try to be more culture-diverse.
+
+2002/06/03 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Fix some errors that were showing up when run against
+ ms.net.
+
+2002-06-02 Nick Drochak <ndrochak@gol.com>
+
+ * ConvertTest.cs: Use en-US culture since that's all we support in our
+ corlib right now. Change constants accordingly. Also added a bunch of
+ try-catch blocks to show which Assert is failing.
+
+2002-06-02 Duncan Mak <duncan@ximian.com>
+
+ * ConvertTest.cs (TestToDecimal): Fixed typo in case #H11.
+
+2002-06-01 Nick Drochak <ndrochak@gol.com>
+
+ * BugTest.cs: Remove, bug fixed. Yay!
+ * AllTests.cs: Remove BugTest from suite.
+
+2002-05-31 Nick Drochak <ndrochak@gol.com>
+
+ * BugTest.cs: Small file to show NullReferenceException bug
+ * AllTests.cs: Include BugTest.cs in the suite.
+
+2002-05-29 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Use AssertEquals to get nice error report, and mark
+ each one with a unique message string so we know which one failed.
+
+2002-05-29 Lawrence Pit <loz@cable.a2000.nl>
+
+ * DateTimeTest.cs: Added tests M01 to M03 to TestParseExact,
+ passing typeof this class as arg in property Suite.
+
+2002-05-22 Lawrence Pit <loz@cable.a2000.nl>
+
+ * ConsoleTest.cs: Added test writing null.
+
+2002-05-21 Nick Drochak <ndrochak@gol.com>
+
+ * MathTest.cs:
+ (TestPow): Add try-catch to determine where we are throwing.
+ (TestLog): Re-enable failing test
+ (TestLog2): same although this test still fails on mono. Not
+ sure what the proper value to use here. It works on MS.NET
+
+2002-05-21 Nick Drochak <ndrochak@gol.com>
+
+ * MathTest.cs: Better reporting of failures
+ * Int64Test.cs: Add try-catch to determine where we are throwing.
+
+2002-05-20 Nick Drochak <ndrochak@gol.com>
+
+ * AttributeTest.cs (TestGetCustomAttribute): Add try-catch to find out
+ which assert is failing.
+
+2002-05-19 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: Removed.
+
+2002-05-14 Nick Drochak <ndrochak@gol.com>
+
+ * StringTest.cs: A couple more tests
+
+2002-05-07 Nick Drochak <ndrochak@gol.com>
+
+ * ExceptionTest.cs: New File. Provided by Linus Upson.
+
+2002-05-05 Lawrence Pit <loz@cable.a2000.nl>
+
+ * StringTest.cs: Added test for replace function
+
+2002-04-30 Nick Drochak <ndrochak@gol.com>
+
+ * UInt32Test.cs: More verbose on unexepected exception to eliminate
+ compiler warning.
+
+2002-04-28 Nick Drochak <ndrochak@gol.com>
+
+ * StringTest.cs: Mark Assert() messages with unique identifiers.
+ * DecimalTest2.cs: Write out more info in the Report method. Need this
+ to determine why op_Subtraction() is failing in the next line.
+ * MathTest.cs:
+ * DoubleTest.cs:
+ * UInt32Test.cs: Add try-catch blocks to find out where the test is
+ failing.
+
+2002-04-28 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs (TestIList_IndexOf): Display exception details if we get
+ an unexpected one.
+
+2002/04/24 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatterTest.cs: Remove Console.WriteLines and use
+ AssertEquals() instead.
+
+2002-04-22 Nick Drochak <ndrochak@gol.com>
+
+ * StringTest.cs: Add unique markers to Assert messages.
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Remove BinarySearch test on unsorted arrays. The
+ behavior is undefined if the array isn't sorted.
+
+2002/04/09 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Use AssertEquals() for better diagnostic message.
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs: Use AssertEquals() for better diagnostic message.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Add a few tests for differently underlying types and
+ the [Flags] attribute to test ToString().
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Add test for ToString for the case where the enum
+ has [Flags] on it, and a mask value is used.
+
+2002-04-04 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Change one Assert() message string so the two are
+ unique. And clean up exception catching logic.
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatterTest.cs: Eliminate warnings about unused exception
+ variables.
+
+2002-03-28 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs(TestFormat): Use Fail() instead of AssertEquals() in
+ try-catch blocks. Add test to check if correct exception is being
+ thrown.
+
+2002/03/18 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs:
+ * Int64Test.cs:
+ * SByteTest.cs: Do not hard code the "$" as the currency symbol to
+ use for Parse tests. This isn not really the fix we need. These
+ number formats vary wildly depending on the culture the system
+ runs with. We need a much better strategy here for testing this.
+ * Int32Test.cs: Use #if NOTYET-#endif to disable a test. This removes
+ an annoying compile warning.
+
+2002-03-18 Nick Drochak <ndrochak@gol.com>
+
+ * DoubleTest.cs:
+ * EnumTest.cs: Add unique identifier to Assert()'s. Needed to find
+ which one was faling on Linux.
+
+2002-03-12 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Add tests for IList methods and for enumerator on
+ an array with non-zero lower bounds.
+
+2002-03-09 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Enable the enumerator test and include test for
+ Multi-dimensional array enumerator. Also include test for
+ mutation _not_ invalidating the enumerator.
+
+2002-03-09 Martin Baulig <martin@gnome.org>
+
+ * Int16Test.cs, Int32Tests.cs, UInt16Tests.cs: Use "en-US" culture and
+ don't let the user override.
+
+ * Int32Tests.cs: Cleanup. Use unique names in Assert()s, use AssertEquals()
+ where appropriate etc.
+
+2002-03-08 Martin Baulig <martin@gnome.org>
+
+ * StringTest.cs: More String.Split tests.
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * StringTest.cs: Added a few more tests for the bug fixes I just
+ committed to String.cs.
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs: Fixed the FIXME in test #E05.
+
+2002-03-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * CharEnumeratorTest.cs: made test regarding out-of-bounds checking
+ a bit stronger (new failures fixed in CharEnumerator.cs).
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs (TestSetValue4): Added testcases #M94-#M96 for Array.Copy.
+
+ * ArrayTest.cs (TestCopyTo): Added testcases #F10-#F13 for arrays with
+ non-zero lower bounds.
+
+ * ArrayTest.cs (TestCopyTo): Added test for copying an empty array
+ to an empty array.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs: Use unique labels for all the tests.
+ (TestSetValue4): A big new testcase.
+
+2002-03-06 Nick Drochak <ndrochak@gol.com>
+
+ * VersionTest.cs: Fix for mscorlib behavior vs. docs. CompareTo(null)
+ is legal.
+ * UInt16Test.cs:
+ * UInt32Test.cs:
+ * UInt64Test.cs: Use NumberFormatInfo.InvariantInfo.CurrencySymbol
+ where "$" was used. Should help suppress false negatives on systems
+ where "$" is not the currency symbol.
+
+2002-03-04 Duco Fijma <duco@lorentz.xs4all.nl>
+ * VersionTest.cs: created test cases for System.Version
+
+2002-03-03 Duco Fijma <duco@lorentz.xs4all.nl>
+ * CharEnumeratorTest.cs: completed the test cases
+
+2002-03-03 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: make static member non-static -- wouldn't work on
+ Windows if it was static. Doesn't _need_ to be static anyway.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+ * AttributeTest.cs: created, far from complete.
+ * CharEnumeratorTest.cs: created. Contains just the basic case.
+ * AllTests.cs: added the two new tests above
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+ * BitConverterTest.cs: added one test for bug fix made to BitConverter
+ * class.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs: Commented out a few bits which are not yet implemented and
+ marked them with FIXME's.
+
+ * DecimalTest.cs, DecimalTest2.cs: Added zero-arg constructors.
+
+ * MartinTests.cs: Enabled ArrayTests.cs.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * BitConverterTest.cs: completed test cases
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: 15 tests currently work on Linux, call them all and
+ provide comments for the non-working tests.
+
+2002-02-28 Duncan Mak <duncan@ximian.com>
+
+ * MathTest.cs: Committed for Jon Guymon <gnarg@slackworks.com>.
+
+2002-02-28 Martin Baulig <martin@gnome.org>
+
+ * String.cs (TestCompare): Added a few tests.
+ (TestFormat): Please don't compare two strings with Assert (... == ...),
+ use AssertEquals instead - this gives you a better idea what went wrong
+ if the test fails.
+
+2002-02-28 Nick Drochak <ndrochak@gol.com>
+
+ * BitConverterTest.cs: Test was trying to catch the wrong Exception.
+ The MSDN docs clearly say ArgumentOutOfRangeException, but that's
+ not what get's thrown.
+
+ * DoubleTest.cs: Get working against mscorlib reference.
+
+2002-02-27 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: changed to reflect new meaning of Guid.ToString("")
+ and Guid.ToString(null)
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: New file. This contains all the test which already
+ work on Linux.
+
+ * String.cs: Added two testcases to TestTrim(), TestTrimStart() and
+ TestTrimEnd().
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTimeTest.cs: Added testcases for the parsers. Use the invariant
+ culture to run this test suite.
+
+ * TimeZoneTest.cs: Use the invariant culture to run this test suite.
+
+2002-02-26 Duco Fijma <duco@lorentz.xs4all>
+ * TimeSpanTest.cs: added test from TimeSpan.FromMilliseconds
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTimeTest.cs: New test.
+
+ * TimeZoneTest.cs: New test.
+
+2002-02-25 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: all methods of System.Guid are now covered
+ * BitConverterTest.cs: created, not yet complete
+
+2002-02-21 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: changed according to fix in System.Guid
+
+2002-02-20 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: One array was giving us trouble. Not sure why, but
+ it's related to the number of elements in an Array. For short Arrays
+ the compiler doesn't use the PrivateImplmentationDetails struct,
+ but for longer ones it does. That's when our corlib fails. I paired
+ down the array for now.
+
+2002-02-19 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: added a few cases
+
+2002-02-18 Nick Drochak <ndrochak@gol.com>
+
+ * GuidTest.cs: Fix compile error. Needed to cast the null in the call to
+ constructor to avoid ambiguity.
+
+2002-02-11 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: Various fixes to make tests work against the ms corlib.
+ Currency Symbol tests seem to be system dependant. Not sure if this
+ will work on other systems, so please test it if you can. The most
+ disturbing one is negative numbers. Should they be (n) or -n ?
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add Int64Test to the Suite
+ * Int64Test.cs: Change static member to instance member. This was
+ causing NUnitConsole some grief. Should be instance member anyway.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs:
+ * Int16Test.cs:
+ * Int32Test.cs:
+ * SByteTest.cs:
+ * UInt16Test.cs:
+ * UInt32Test.cs:
+ * UInt64Test.cs: Fixed tests where a "$" was hard coded. Change it to
+ use NumberFormatInfo.CurrentInfo.CurrencySymbol. Also used
+ NumberFormatInfo.InvariantInfo.CurrencySymbol where appropriate. These
+ tests all pass now with mscorlib.
+
+2002-01-06 Nick Drochak <ndrochak@gol.com>
+
+ * ResolveEventArgsTest.cs: New test.
+ * AllTests.cs: Added new test to suite.
+
+2001-12-27 Nick Drochak <ndrochak@gol.com>
+
+ * UInt32Test.cs: Added messages to Asserts()'s to find out which one was faliing.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * UInt32Test.cs: Added tests for UInt32.Parse.
+
+ * Int32Test.cs: Added tests for Int32.Parse for various cases.
+
+2001-12-08 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs: Added messages to Assert()'s to find out which one was failing.
+
+2001-11-28 Nick Drochak <ndrochak@gol.com>
+
+ * Int16Test.cs Int32Test.cs SByteTest.cs: Surgically removed tests that rely on culture of system. These need to be crafted a bit differently.
+
+2001-11-27 Nick Drochak <ndrochak@gol.com>
+
+ * SByteTest.cs: Add messages to Assert()'s so we can tell where the tests fail.
+
+2002-02-21 Bob Doan <bdoan@sicompos.com>
+
+ * BooleanTest.cs: Added New test suite
+ * AllTests.cs: Added new Boolean test to suite.
+
+2002-02-24 Bob Doan <bdoan@sicompos.com>
+
+ * BooleanTest.cs: Use correct argument order in AssertEquals
+ * AllTests.cs: Added new Double test to suite.
+ * DoubleTest.cs: Add new test suite
+
+2002-02-24 Bob Doan <bdoan@sicompos.com>
+
+ * DoubleTest.cs: Added parse tests to Double test suite, removed GetHashCodeTests
diff --git a/mcs/class/corlib/Test/System/CharEnumeratorTest.cs b/mcs/class/corlib/Test/System/CharEnumeratorTest.cs
new file mode 100755
index 00000000000..6ea33511d71
--- /dev/null
+++ b/mcs/class/corlib/Test/System/CharEnumeratorTest.cs
@@ -0,0 +1,116 @@
+//
+// CharEnumeratorTest.cs - NUnit Test Cases for the System.CharEnumerator class
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class CharEnumeratorTest : TestCase
+{
+ public CharEnumeratorTest () {}
+
+ string _s;
+
+ protected override void SetUp ()
+ {
+ _s = "Emma en Sophie";
+ }
+
+ private string GetFromEnumerator (CharEnumerator ce)
+ {
+ string res = "";
+ bool cont = true;
+
+ while (cont) {
+ res += ce.Current;
+ cont = ce.MoveNext ();
+ }
+
+ return res;
+ }
+
+ public void TestBasic ()
+ {
+ CharEnumerator ce = _s.GetEnumerator ();
+
+ ce.MoveNext ();
+
+ AssertEquals ("A1", _s, GetFromEnumerator (ce));
+ }
+
+ public void TestClone ()
+ {
+ CharEnumerator ce1, ce2=null;
+ bool cont;
+
+ ce1 = _s.GetEnumerator ();
+ cont = ce1.MoveNext ();
+ while (cont) {
+ if (ce1.Current == 'S') {
+ ce2 = (CharEnumerator) (ce1.Clone ());
+ }
+ cont = ce1.MoveNext ();
+ }
+
+ AssertEquals ("A1", "Sophie", GetFromEnumerator(ce2));
+ }
+
+ public void TestReadOutOfBounds ()
+ {
+ char c;
+ bool exception;
+ CharEnumerator ce = _s.GetEnumerator ();
+
+ try {
+ c = ce.Current;
+ exception = false;
+ }
+ catch (InvalidOperationException) {
+ exception = true;
+ }
+ Assert ("A1", exception);
+
+ AssertEquals("A2", true, ce.MoveNext ());
+
+ AssertEquals ("A3", _s, GetFromEnumerator (ce));
+
+ try {
+ c = ce.Current;
+ }
+ catch (InvalidOperationException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ AssertEquals("A5", false, ce.MoveNext() );
+ AssertEquals("A6", false, ce.MoveNext() );
+
+ ce.Reset ();
+
+ try {
+ c = ce.Current;
+ }
+ catch (InvalidOperationException) {
+ exception = true;
+ }
+ Assert ("A7", exception);
+
+ AssertEquals ("A8", true, ce.MoveNext ());
+
+ AssertEquals ("A9", _s, GetFromEnumerator (ce));
+
+ AssertEquals ("A10", false, ce.MoveNext ());
+ AssertEquals ("A11", false, ce.MoveNext ());
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/CharTest.cs b/mcs/class/corlib/Test/System/CharTest.cs
new file mode 100644
index 00000000000..4cfbfa7aad3
--- /dev/null
+++ b/mcs/class/corlib/Test/System/CharTest.cs
@@ -0,0 +1,493 @@
+// CharTest.cs - NUnit Test Cases for the System.Char struct
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class CharTest : TestCase
+{
+ public CharTest() {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public void TestCompareTo()
+ {
+ Char c1 = 'a';
+ Char c2 = 'b';
+ Char c3 = 'b';
+ Assert("Less than", c1.CompareTo(c2) == -1);
+ Assert("Greater than", c2.CompareTo(c1) == 1);
+ Assert("Equal 1", c2.CompareTo(c3) == 0);
+ Assert("Equal 2", c1.CompareTo(c1) == 0);
+ }
+
+ public void TestEquals()
+ {
+ Char c1 = 'a';
+ Char c2 = 'b';
+ Char c3 = 'b';
+ Assert("Same", c1.Equals(c1));
+ Assert("Same value", c2.Equals(c3));
+ Assert("Not same", !c1.Equals(c2));
+ }
+
+ public void TestGetHashValue()
+ {
+ Char c1 = ' ';
+ AssertEquals("deterministic hash code ", c1.GetHashCode(), c1.GetHashCode());
+ // TODO - the spec doesn't say what algorithm is used to get hash codes. So far, just a weak test for determinism and mostly-uniqueness.
+ }
+
+ public void TestGetNumericValue()
+ {
+ Char c1 = ' ';
+ Char c2 = '3';
+ AssertEquals("code 1", -1.0, Char.GetNumericValue(c1), 0.1);
+ AssertEquals("code 2", 3.0, Char.GetNumericValue(c2), 0.1);
+
+ string s1 = " 3 ";
+ AssertEquals("space not number", -1.0, Char.GetNumericValue(s1, 0), 0.1);
+ AssertEquals("space not number", 3.0, Char.GetNumericValue(s1, 1), 0.1);
+ AssertEquals("space not number", -1.0, Char.GetNumericValue(s1, 2), 0.1);
+ }
+
+ public void TestGetUnicodeCategory()
+ {
+ {
+ char Pe1 = ']';
+ char Pe2 = '}';
+ char Pe3 = ')';
+ AssertEquals("Close Punctuation",
+ UnicodeCategory.ClosePunctuation,
+ Char.GetUnicodeCategory(Pe1));
+ AssertEquals("Close Punctuation",
+ UnicodeCategory.ClosePunctuation,
+ Char.GetUnicodeCategory(Pe2));
+ AssertEquals("Close Punctuation",
+ UnicodeCategory.ClosePunctuation,
+ Char.GetUnicodeCategory(Pe3));
+ }
+ // TODO - ConnectorPunctuation
+ {
+ char c1 = (char)0; // 0000-001F, 007F-009F
+ char c2 = (char)0x001F;
+ char c3 = (char)0x007F;
+ char c4 = (char)0x00F;
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c2));
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c3));
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c4));
+ }
+ {
+ // TODO - more currencies?
+ char c1 = '$';
+ AssertEquals("Currency",
+ UnicodeCategory.CurrencySymbol,
+ Char.GetUnicodeCategory(c1));
+ }
+ {
+ char c1 = '-';
+ AssertEquals("Dash Punctuation",
+ UnicodeCategory.DashPunctuation,
+ Char.GetUnicodeCategory(c1));
+ }
+ {
+ char c1 = '2';
+ char c2 = '7';
+ AssertEquals("Decimal Digit",
+ UnicodeCategory.DecimalDigitNumber,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("Decimal Digit",
+ UnicodeCategory.DecimalDigitNumber,
+ Char.GetUnicodeCategory(c2));
+ }
+ // TODO - EnclosingMark
+ // TODO - FinalQuotePunctuation
+ // TODO - Format
+ // TODO - InitialQuotePunctuation
+ // TODO - LetterNumber
+ // TODO - LineSeparator (not '\n', that's a control char)
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ AssertEquals("LowercaseLetter",
+ UnicodeCategory.LowercaseLetter,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("LowercaseLetter",
+ UnicodeCategory.LowercaseLetter,
+ Char.GetUnicodeCategory(c2));
+ }
+ {
+ char c1 = '+';
+ char c2 = '=';
+ AssertEquals("MathSymbol",
+ UnicodeCategory.MathSymbol,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("MathSymbol",
+ UnicodeCategory.MathSymbol,
+ Char.GetUnicodeCategory(c2));
+ }
+ // TODO - ModifierSymbol
+ // TODO - NonSpacingMark
+ // TODO - OpenPunctuation
+ {
+ char c1 = '[';
+ char c2 = '{';
+ char c3 = '(';
+ AssertEquals("OpenPunctuation",
+ UnicodeCategory.OpenPunctuation,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("OpenPunctuation",
+ UnicodeCategory.OpenPunctuation,
+ Char.GetUnicodeCategory(c2));
+ AssertEquals("OpenPunctuation",
+ UnicodeCategory.OpenPunctuation,
+ Char.GetUnicodeCategory(c3));
+ }
+ // TODO - OtherLetter
+ // TODO - OtherNotAssigned
+ // TODO - OtherNumber
+ {
+ char c1 = '/';
+ AssertEquals("OtherPunctuation",
+ UnicodeCategory.OtherPunctuation,
+ Char.GetUnicodeCategory(c1));
+ }
+ // TODO - OtherSymbol
+ // TODO - ParagraphSeparator
+ // TODO - PrivateUse
+ {
+ char c1 = ' ';
+ AssertEquals("SpaceSeparator",
+ UnicodeCategory.SpaceSeparator,
+ Char.GetUnicodeCategory(c1));
+ }
+ // TODO - SpacingCombiningMark
+ {
+ char c1 = (char)0xD800; // D800-DBFF
+ char c2 = (char)0xDBFF; // D800-DBFF
+ char c3 = (char)0xDC01; // DC00-DEFF
+ char c4 = (char)0xDEFF; // DC00-DEFF
+ AssertEquals("High Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("High Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c2));
+ AssertEquals("Low Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c3));
+ AssertEquals("Low Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c4));
+ }
+ // TODO - TitlecaseLetter
+ // TODO - UppercaseLetter
+ {
+ char c1 = 'A';
+ char c2 = 'Z';
+ AssertEquals("UppercaseLetter",
+ UnicodeCategory.UppercaseLetter,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("UppercaseLetter",
+ UnicodeCategory.UppercaseLetter,
+ Char.GetUnicodeCategory(c2));
+ }
+ }
+
+ public void TestIsControl()
+ {
+ // control is 0000-001F, 007F-009F
+ char c1 = (char)0;
+ char c2 = (char)0x001F;
+ char c3 = (char)0x007F;
+ char c4 = (char)0x009F;
+ Assert("Not control", !Char.IsControl(' '));
+ Assert("control", Char.IsControl(c1));
+ Assert("control", Char.IsControl(c2));
+ Assert("control", Char.IsControl(c3));
+ Assert("control", Char.IsControl(c4));
+
+ string s1 = " " + c1 + c2 + c3 + c4;
+ Assert("Not control", !Char.IsControl(s1, 0));
+ Assert("control", Char.IsControl(s1, 1));
+ Assert("control", Char.IsControl(s1, 2));
+ Assert("control", Char.IsControl(s1, 3));
+ Assert("control", Char.IsControl(s1, 4));
+ }
+
+ public void TestIsDigit()
+ {
+ char c1 = '0';
+ char c2 = '9';
+ Assert("Not digit", !Char.IsDigit(' '));
+ Assert("digit", Char.IsDigit(c1));
+ Assert("digit", Char.IsDigit(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not digit", !Char.IsDigit(s1, 0));
+ Assert("digit", Char.IsDigit(s1, 1));
+ Assert("digit", Char.IsDigit(s1, 2));
+ }
+
+ public void TestIsLetter()
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ char c3 = 'A';
+ char c4 = 'Z';
+ Assert("Not letter", !Char.IsLetter(' '));
+ Assert("letter", Char.IsLetter(c1));
+ Assert("letter", Char.IsLetter(c2));
+ Assert("letter", Char.IsLetter(c3));
+ Assert("letter", Char.IsLetter(c4));
+
+ string s1 = " " + c1 + c2 + c3 + c4;
+ Assert("Not letter", !Char.IsLetter(s1, 0));
+ Assert("letter", Char.IsLetter(s1, 1));
+ Assert("letter", Char.IsLetter(s1, 2));
+ Assert("letter", Char.IsLetter(s1, 3));
+ Assert("letter", Char.IsLetter(s1, 4));
+ }
+
+ public void TestIsLetterOrDigit()
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ char c3 = 'A';
+ char c4 = 'Z';
+ char c5 = '0';
+ char c6 = '9';
+ Assert("Not letterordigit", !Char.IsLetterOrDigit(' '));
+ Assert("letterordigit", Char.IsLetterOrDigit(c1));
+ Assert("letterordigit", Char.IsLetterOrDigit(c2));
+ Assert("letterordigit", Char.IsLetterOrDigit(c3));
+ Assert("letterordigit", Char.IsLetterOrDigit(c4));
+ Assert("letterordigit", Char.IsLetterOrDigit(c5));
+ Assert("letterordigit", Char.IsLetterOrDigit(c6));
+
+ string s1 = " " + c1 + c2 + c3 + c4 + c5 + c6;
+ Assert("Not letterordigit", !Char.IsLetterOrDigit(s1, 0));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 1));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 2));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 3));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 4));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 5));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 6));
+ }
+
+ public void TestIsLower()
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ Assert("Not lower", !Char.IsLower(' '));
+ Assert("lower", Char.IsLower(c1));
+ Assert("lower", Char.IsLower(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not lower", !Char.IsLower(s1, 0));
+ Assert("lower", Char.IsLower(s1, 1));
+ Assert("lower", Char.IsLower(s1, 2));
+ }
+
+ public void TestIsNumber()
+ {
+ char c1 = '0';
+ char c2 = '9';
+ // TODO - IsNumber of less obvious characters
+
+ Assert("Not number", !Char.IsNumber(' '));
+ Assert("number", Char.IsNumber(c1));
+ Assert("number", Char.IsNumber(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not number", !Char.IsNumber(s1, 0));
+ Assert("number", Char.IsNumber(s1, 1));
+ Assert("number", Char.IsNumber(s1, 2));
+ }
+
+ public void TestIsPunctuation()
+ {
+ char c1 = '.';
+ char c2 = '?';
+ Assert("Not punctuation", !Char.IsPunctuation(' '));
+ Assert("punctuation", Char.IsPunctuation(c1));
+ Assert("punctuation", Char.IsPunctuation(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not punctuation", !Char.IsPunctuation(s1, 0));
+ Assert("punctuation", Char.IsPunctuation(s1, 1));
+ Assert("punctuation", Char.IsPunctuation(s1, 2));
+ }
+
+ public void TestIsSeparator()
+ {
+ char c1 = ' ';
+
+ Assert("Not separator", !Char.IsSeparator('.'));
+ Assert("separator1", Char.IsSeparator(c1));
+
+ string s1 = "." + c1;
+ Assert("Not separator", !Char.IsSeparator(s1, 0));
+ Assert("separator1-2", Char.IsSeparator(s1, 1));
+ }
+
+ public void TestIsSurrogate()
+ {
+ // high surrogate - D800-DBFF
+ // low surrogate - DC00-DEFF
+ char c1 = (char)0xD800;
+ char c2 = (char)0xDBFF;
+ char c3 = (char)0xDC00;
+ char c4 = (char)0xDEFF;
+ Assert("Not surrogate", !Char.IsSurrogate(' '));
+ Assert("surrogate1", Char.IsSurrogate(c1));
+ Assert("surrogate2", Char.IsSurrogate(c2));
+ Assert("surrogate3", Char.IsSurrogate(c3));
+ Assert("surrogate4", Char.IsSurrogate(c4));
+
+ string s1 = " " + c1 + c2 + c3 + c4;
+ Assert("Not surrogate", !Char.IsSurrogate(s1, 0));
+ Assert("surrogate1-2", Char.IsSurrogate(s1, 1));
+ Assert("surrogate2-2", Char.IsSurrogate(s1, 2));
+ Assert("surrogate3-2", Char.IsSurrogate(s1, 3));
+ Assert("surrogate4-2", Char.IsSurrogate(s1, 4));
+ }
+
+ public void TestIsSymbol()
+ {
+ char c1 = '+';
+ char c2 = '=';
+ Assert("Not symbol", !Char.IsSymbol(' '));
+ Assert("symbol", Char.IsSymbol(c1));
+ Assert("symbol", Char.IsSymbol(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not symbol", !Char.IsSymbol(s1, 0));
+ Assert("symbol", Char.IsSymbol(s1, 1));
+ Assert("symbol", Char.IsSymbol(s1, 2));
+ }
+
+ public void TestIsUpper()
+ {
+ char c1 = 'A';
+ char c2 = 'Z';
+ Assert("Not upper", !Char.IsUpper('a'));
+ Assert("upper", Char.IsUpper(c1));
+ Assert("upper", Char.IsUpper(c2));
+
+ string s1 = "a" + c1 + c2;
+ Assert("Not upper", !Char.IsUpper(s1, 0));
+ Assert("upper", Char.IsUpper(s1, 1));
+ Assert("upper", Char.IsUpper(s1, 2));
+ }
+
+ public void TestIsWhiteSpace()
+ {
+ char c1 = ' ';
+ char c2 = '\n';
+ char c3 = '\t';
+
+ Assert("Not whitespace", !Char.IsWhiteSpace('.'));
+ Assert("whitespace1", Char.IsWhiteSpace(c1));
+ Assert("whitespace2", Char.IsWhiteSpace(c2));
+ Assert("whitespace3", Char.IsWhiteSpace(c3));
+
+ string s1 = "." + c1 + c2 + c3;
+ Assert("Not whitespace", !Char.IsWhiteSpace(s1, 0));
+ Assert("whitespace1-2", Char.IsWhiteSpace(s1, 1));
+ Assert("whitespace2-2", Char.IsWhiteSpace(s1, 2));
+ Assert("whitespace3-2", Char.IsWhiteSpace(s1, 3));
+ }
+
+
+ public void TestParse()
+ {
+ char c1 = 'a';
+ string s1 = "a";
+ Assert(c1.Equals(Char.Parse(s1)));
+ }
+
+ public void TestToLower()
+ {
+ char a1 = 'a';
+ char a2 = 'A';
+ char a3 = 'z';
+ char a4 = 'Z';
+ char a5 = ' ';
+ char a6 = '+';
+ char b1 = 'a';
+ char b2 = 'a';
+ char b3 = 'z';
+ char b4 = 'z';
+ char b5 = ' ';
+ char b6 = '+';
+ AssertEquals("char lowered", b1, Char.ToLower(a1));
+ AssertEquals("char lowered", b2, Char.ToLower(a2));
+ AssertEquals("char lowered", b3, Char.ToLower(a3));
+ AssertEquals("char lowered", b4, Char.ToLower(a4));
+ AssertEquals("char lowered", b5, Char.ToLower(a5));
+ AssertEquals("char lowered", b6, Char.ToLower(a6));
+ }
+
+ public void TestToUpper()
+ {
+ char a1 = 'a';
+ char a2 = 'A';
+ char a3 = 'z';
+ char a4 = 'Z';
+ char a5 = ' ';
+ char a6 = '+';
+ char b1 = 'A';
+ char b2 = 'A';
+ char b3 = 'Z';
+ char b4 = 'Z';
+ char b5 = ' ';
+ char b6 = '+';
+ AssertEquals("char uppered", b1, Char.ToUpper(a1));
+ AssertEquals("char uppered", b2, Char.ToUpper(a2));
+ AssertEquals("char uppered", b3, Char.ToUpper(a3));
+ AssertEquals("char uppered", b4, Char.ToUpper(a4));
+ AssertEquals("char uppered", b5, Char.ToUpper(a5));
+ AssertEquals("char uppered", b6, Char.ToUpper(a6));
+ }
+
+
+ public void TestToString()
+ {
+ char c1 = 'a';
+ string s1 = "a";
+ Assert(s1.Equals(c1.ToString()));
+ }
+
+ public void TestGetTypeCode()
+ {
+ char c1 = 'a';
+ Assert(c1.GetTypeCode().Equals(TypeCode.Char));
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ConsoleTest.cs b/mcs/class/corlib/Test/System/ConsoleTest.cs
new file mode 100644
index 00000000000..459ff74c5ef
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ConsoleTest.cs
@@ -0,0 +1,287 @@
+// ConsoleTest.cs - NUnit Test Cases for the System.Console class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+
+namespace MonoTests.System
+{
+
+public class ConsoleTest : TestCase
+{
+ public ConsoleTest() {}
+
+ TextWriter _err;
+ TextReader _in;
+ TextWriter _out;
+ protected override void SetUp()
+ {
+ _err = Console.Error;
+ _in = Console.In;
+ _out = Console.Out;
+ }
+
+ protected override void TearDown()
+ {
+ Console.SetError(_err);
+ Console.SetIn(_in);
+ Console.SetOut(_out);
+ }
+
+ public void TestError() {
+ AssertNotNull("No error", Console.Error);
+ }
+
+ public void TestIn() {
+ AssertNotNull("No in", Console.In);
+ }
+
+ public void TestOut() {
+ AssertNotNull("No out", Console.Out);
+ }
+
+ public void TestOpenStandardError() {
+ {
+ Stream err = Console.OpenStandardError();
+ AssertNotNull("Can't open error", err);
+ }
+ {
+ Stream err = Console.OpenStandardError(512);
+ AssertNotNull("Can't open error", err);
+ }
+ // Spec says these are here, MS implementation says no.
+ //{
+ //bool errorThrown = false;
+ //try {
+ //Stream err = Console.OpenStandardError(-1);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("negative buffer error not thrown",
+ //errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ //Stream err = Console.OpenStandardError(0);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("zero buffer error not thrown", errorThrown);
+ //}
+ }
+
+ public void TestOpenStandardInput() {
+ {
+ Stream in1 = Console.OpenStandardInput();
+ AssertNotNull("Can't open input", in1);
+ }
+ {
+ Stream in1 = Console.OpenStandardInput(512);
+ AssertNotNull("Can't open input", in1);
+ }
+ // see commented-out tests in TestOpenStandardError
+ }
+
+ public void TestOpenStandardOutput() {
+ {
+ Stream out1 = Console.OpenStandardOutput();
+ AssertNotNull("Can't open output", out1);
+ }
+ {
+ Stream out1 = Console.OpenStandardOutput(512);
+ AssertNotNull("Can't open output", out1);
+ }
+ // see commented-out tests in TestOpenStandardError
+ }
+
+ public void TestRead() {
+ String testStr = "This is a readline test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetIn(r);
+ w.WriteLine(testStr);
+ s.Position = 0;
+ char val = (char) Console.Read();
+ AssertEquals("Wrong read", 'T', val);
+ }
+
+ public void TestReadLine() {
+ String testStr = "This is a readline test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetIn(r);
+ w.WriteLine(testStr);
+ s.Position = 0;
+ String line = Console.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+
+ public void TestSetError() {
+ {
+ bool errorThrown = false;
+ try {
+ Console.SetError(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null error error not thrown", errorThrown);
+ }
+ {
+ String testStr = "This is a stderr test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetError(w);
+ Console.Error.WriteLine(testStr);
+ s.Position = 0;
+ String line = r.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+ }
+
+ public void TestSetIn() {
+ {
+ bool errorThrown = false;
+ try {
+ Console.SetIn(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null in error not thrown", errorThrown);
+ }
+ {
+ String testStr = "This is a stdin test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetIn(r);
+ w.WriteLine(testStr);
+ s.Position = 0;
+ String line = Console.In.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+ }
+
+ public void TestSetOut() {
+ {
+ bool errorThrown = false;
+ try {
+ Console.SetOut(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null out error not thrown", errorThrown);
+ }
+ {
+ String testStr = "This is a stdout test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetOut(w);
+ Console.Out.WriteLine(testStr);
+ s.Position = 0;
+ String line = r.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+ }
+
+ public void TestWrite() {
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetOut(w);
+
+ long endPos = 0;
+
+ String testStr = "This is a stdout write test";
+ Console.Write(testStr);
+ s.Position = endPos;
+ String line = r.ReadToEnd();
+ AssertEquals("Wrong line", testStr, line);
+ endPos = s.Position;
+
+ Boolean[] booleans = {true, false};
+ foreach (bool b in booleans ) {
+ Console.Write(b);
+ s.Position = endPos;
+ line = r.ReadToEnd();
+ AssertEquals("Wrong boolean", b.ToString(), line);
+ endPos = s.Position;
+ }
+
+ Char[] chars = {'a', ';', '?'};
+ foreach (Char c in chars ) {
+ Console.Write(c);
+ s.Position = endPos;
+ line = r.ReadToEnd();
+ AssertEquals("Wrong char", c.ToString(), line);
+ endPos = s.Position;
+ }
+
+ // test writing a null value
+ string x = null;
+ Console.Write (x);
+
+ // TODO - Likewise for char[], decimal, double, int, long, object, single, uint32, uint64
+ // TODO - write with format string
+ }
+
+ public void TestWriteLine() {
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetOut(w);
+
+ long endPos = 0;
+
+ String testStr = "This is a stdout writeline test";
+ Console.WriteLine(testStr);
+ s.Position = endPos;
+ String line = r.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ endPos = s.Position;
+
+ Boolean[] booleans = {true, false};
+ foreach (bool b in booleans ) {
+ Console.WriteLine(b);
+ s.Position = endPos;
+ line = r.ReadLine();
+ AssertEquals("Wrong boolean", b.ToString(), line);
+ endPos = s.Position;
+ }
+
+ Char[] chars = {'a', ';', '?'};
+ foreach (Char c in chars ) {
+ Console.WriteLine(c);
+ s.Position = endPos;
+ line = r.ReadLine();
+ AssertEquals("Wrong char", c.ToString(), line);
+ endPos = s.Position;
+ }
+
+ // test writing a null value
+ string x = null;
+ Console.WriteLine (x);
+
+ // TODO - Likewise for char[], decimal, double, int, long, object, single, uint32, uint64
+ // TODO - write with format string
+ }
+
+}
+}
diff --git a/mcs/class/corlib/Test/System/ConvertTest.cs b/mcs/class/corlib/Test/System/ConvertTest.cs
new file mode 100755
index 00000000000..e68918000c5
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ConvertTest.cs
@@ -0,0 +1,2747 @@
+// TestConvert.cs - NUnit Test Cases for System.Convert class
+//
+// Krister Hansson (ds99krha@thn.htu.se)
+// Andreas Jonsson (ds99anjn@thn.htu.se)
+//
+// (C) Krister Hansson & Andreas Jonsson
+//
+
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+ public class ConvertTest : TestCase
+ {
+ public ConvertTest() {}
+
+ bool boolTrue;
+ bool boolFalse;
+ byte tryByte;
+ char tryChar;
+ DateTime tryDT;
+ decimal tryDec;
+ double tryDbl;
+ short tryInt16;
+ int tryInt32;
+ long tryInt64;
+ object tryObj;
+ sbyte trySByte;
+ float tryFloat;
+ string falseString;
+ string trueString;
+ string nullString;
+ string tryStr;
+ ushort tryUI16;
+ uint tryUI32;
+ ulong tryUI64;
+ CultureInfo ci;
+
+ protected override void SetUp() {
+ boolTrue = true;
+ boolFalse = false;
+ tryByte = 0;
+ tryChar = 'a';
+ tryDT = new DateTime(2002,1,1);
+ tryDec = 1234.2345m;
+ tryDbl = 0;
+ tryInt16 = 1234;
+ tryInt32 = 12345;
+ tryInt64 = 123456789012;
+ tryObj = new Object();
+ trySByte = 123;
+ tryFloat = 1234.2345f;
+ falseString = "false";
+ trueString = "true";
+ nullString = "null";
+ tryStr = "foobar";
+ tryUI16 = 34567;
+ tryUI32 = 567891234;
+ tryUI64 = 0;
+ ci = new CultureInfo("en-US");
+ ci.NumberFormat.NumberDecimalDigits = 3;
+ }
+ protected override void TearDown() {}
+
+ public void TestChangeType() {
+ int iTest = 1;
+ try {
+ AssertEquals("#A01", (short)12345, Convert.ChangeType(tryInt32, typeof(short)));
+ iTest++;
+ AssertEquals("#A02", 'A', Convert.ChangeType(65, typeof(char)));
+ iTest++;
+ AssertEquals("#A03", 66, Convert.ChangeType('B', typeof(int)));
+ iTest++;
+ AssertEquals("#A04", ((ulong)12345), Convert.ChangeType(tryInt32, typeof(ulong)));
+
+ iTest++;
+ AssertEquals("#A05", true, Convert.ChangeType(tryDec, TypeCode.Boolean));
+ iTest++;
+ AssertEquals("#A06", 'f', Convert.ChangeType("f", TypeCode.Char));
+ iTest++;
+ AssertEquals("#A07", (decimal)123456789012, Convert.ChangeType(tryInt64, TypeCode.Decimal));
+ iTest++;
+ AssertEquals("#A08", (int)34567, Convert.ChangeType(tryUI16, TypeCode.Int32));
+
+ iTest++;
+ AssertEquals("#A09", (double)567891234, Convert.ChangeType(tryUI32, typeof(double), ci));
+ iTest++;
+ AssertEquals("#A10", (ushort)0, Convert.ChangeType(tryByte, typeof(ushort), ci));
+ iTest++;
+ AssertEquals("#A11", (decimal)567891234, Convert.ChangeType(tryUI32, typeof(decimal), ci));
+ iTest++;
+ AssertEquals("#A12", (float)1234, Convert.ChangeType(tryInt16, typeof(float), ci));
+ iTest++;
+ AssertEquals("#A13", null, Convert.ChangeType(null, null, ci));
+
+ iTest++;
+ AssertEquals("#A14", (decimal)0, Convert.ChangeType(tryByte, TypeCode.Decimal, ci));
+ iTest++;
+ AssertEquals("#A15", "f", Convert.ChangeType('f', TypeCode.String, ci));
+ iTest++;
+ AssertEquals("#A16", 'D', Convert.ChangeType(68, TypeCode.Char, ci));
+ iTest++;
+ AssertEquals("#A17", (long)34567, Convert.ChangeType(tryUI16, TypeCode.Int64, ci));
+ iTest++;
+ AssertEquals("#A18", null, Convert.ChangeType(null, TypeCode.Empty, ci));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at iTest = " + iTest + ": e = " + e);
+ }
+
+ try {
+ Convert.ChangeType(boolTrue, typeof(char));
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ChangeType(tryChar, typeof(DateTime));
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A26", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ChangeType(ci, TypeCode.String);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A27", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ChangeType(tryInt32, null);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A28", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try
+ {
+ Convert.ChangeType(boolTrue, typeof(DateTime), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A29", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ChangeType(ci, typeof(DateTime), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A30", typeof(InvalidCastException), e.GetType());
+ }
+
+ /* Should throw ArgumentException but throws InvalidCastException
+ try {
+ Convert.ChangeType(tryUI32, typeof(FormatException), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A??", typeof(ArgumentException), e.GetType());
+ }*/
+
+ try {
+ Convert.ChangeType(tryUI32, TypeCode.Byte, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ChangeType(boolTrue, TypeCode.Char, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A32", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ChangeType(boolTrue, null, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#A33", typeof(ArgumentNullException), e.GetType());
+ }
+ }
+
+ public void TestGetTypeCode() {
+ int marker = 1;
+ try {
+ AssertEquals("#B01", TypeCode.String, Convert.GetTypeCode(tryStr));
+ marker++;
+ AssertEquals("#B02", TypeCode.UInt16, Convert.GetTypeCode(tryUI16));
+ marker++;
+ AssertEquals("#B03", TypeCode.UInt32, Convert.GetTypeCode(tryUI32));
+ marker++;
+ AssertEquals("#B04", TypeCode.UInt64, Convert.GetTypeCode(tryUI64));
+ marker++;
+ AssertEquals("#B05", TypeCode.Double, Convert.GetTypeCode(tryDbl));
+ marker++;
+ AssertEquals("#B06", TypeCode.Int16, Convert.GetTypeCode(tryInt16));
+ marker++;
+ AssertEquals("#B07", TypeCode.Int64, Convert.GetTypeCode(tryInt64));
+ marker++;
+ AssertEquals("#B08", TypeCode.Object, Convert.GetTypeCode(tryObj));
+ marker++;
+ AssertEquals("#B09", TypeCode.SByte, Convert.GetTypeCode(trySByte));
+ marker++;
+ AssertEquals("#B10", TypeCode.Single, Convert.GetTypeCode(tryFloat));
+ marker++;
+ AssertEquals("#B11", TypeCode.Byte, Convert.GetTypeCode(tryByte));
+ marker++;
+ AssertEquals("#B12", TypeCode.Char, Convert.GetTypeCode(tryChar));
+ marker++;
+// AssertEquals("#B13", TypeCode.DateTime, Convert.GetTypeCode(tryDT));
+ marker++;
+ AssertEquals("#B14", TypeCode.Decimal, Convert.GetTypeCode(tryDec));
+ marker++;
+ AssertEquals("#B15", TypeCode.Int32, Convert.GetTypeCode(tryInt32));
+ marker++;
+ AssertEquals("#B16", TypeCode.Boolean, Convert.GetTypeCode(boolTrue));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at " + marker + ": " + e);
+ }
+ }
+
+ public void TestIsDBNull() {
+ AssertEquals("#C01", false, Convert.IsDBNull(tryInt32));
+ AssertEquals("#C02", true, Convert.IsDBNull(Convert.DBNull));
+ AssertEquals("#C03", false, Convert.IsDBNull(boolTrue));
+ AssertEquals("#C04", false, Convert.IsDBNull(tryChar));
+ AssertEquals("#C05", false, Convert.IsDBNull(tryFloat));
+ }
+
+ public void TestToBoolean() {
+ tryObj = (object)tryDbl;
+
+ AssertEquals("#D01", true, Convert.ToBoolean(boolTrue));
+ AssertEquals("#D02", false, Convert.ToBoolean(tryByte));
+ AssertEquals("#D03", true, Convert.ToBoolean(tryDec));
+ AssertEquals("#D04", false, Convert.ToBoolean(tryDbl));
+ AssertEquals("#D05", true, Convert.ToBoolean(tryInt16));
+ AssertEquals("#D06", true, Convert.ToBoolean(tryInt32));
+ AssertEquals("#D07", true, Convert.ToBoolean(tryInt64));
+ AssertEquals("#D08", false, Convert.ToBoolean(tryObj));
+ AssertEquals("#D09", true, Convert.ToBoolean(trySByte));
+ AssertEquals("#D10", true, Convert.ToBoolean(tryFloat));
+ AssertEquals("#D11", true, Convert.ToBoolean(trueString));
+ AssertEquals("#D12", false, Convert.ToBoolean(falseString));
+ AssertEquals("#D13", true, Convert.ToBoolean(tryUI16));
+ AssertEquals("#D14", true, Convert.ToBoolean(tryUI32));
+ AssertEquals("#D15", false, Convert.ToBoolean(tryUI64));
+ AssertEquals("#D16", false, Convert.ToBoolean(tryObj,ci));
+ AssertEquals("#D17", true, Convert.ToBoolean(trueString, ci));
+ AssertEquals("#D18", false, Convert.ToBoolean(falseString, ci));
+
+ try {
+ Convert.ToBoolean(tryChar);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#D20", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToBoolean(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#D21", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToBoolean(tryStr);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#D22", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToBoolean(nullString);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#D23", typeof(FormatException), e.GetType());
+ }
+ }
+
+ public void TestToByte() {
+
+ AssertEquals("#E01", (byte)1, Convert.ToByte(boolTrue));
+ AssertEquals("#E02", (byte)0, Convert.ToByte(boolFalse));
+ AssertEquals("#E03", tryByte, Convert.ToByte(tryByte));
+ AssertEquals("#E04", (byte)114, Convert.ToByte('r'));
+ AssertEquals("#E05", (byte)201, Convert.ToByte((decimal)200.6));
+ AssertEquals("#E06", (byte)125, Convert.ToByte((double)125.4));
+ AssertEquals("#E07", (byte)255, Convert.ToByte((short)255));
+ AssertEquals("#E08", (byte)254, Convert.ToByte((int)254));
+ AssertEquals("#E09", (byte)34, Convert.ToByte((long)34));
+ AssertEquals("#E10", (byte)1, Convert.ToByte((object)boolTrue));
+ AssertEquals("#E11", (byte)123, Convert.ToByte((float)123.49f));
+ AssertEquals("#E12", (byte)57, Convert.ToByte("57"));
+ AssertEquals("#E13", (byte)75, Convert.ToByte((ushort)75));
+ AssertEquals("#E14", (byte)184, Convert.ToByte((uint)184));
+ AssertEquals("#E15", (byte)241, Convert.ToByte((ulong)241));
+ AssertEquals("#E16", (byte)123, Convert.ToByte(trySByte, ci));
+ AssertEquals("#E17", (byte)27, Convert.ToByte("011011", 2));
+ AssertEquals("#E18", (byte)13, Convert.ToByte("15", 8));
+ AssertEquals("#E19", (byte)27, Convert.ToByte("27", 10));
+ AssertEquals("#E20", (byte)250, Convert.ToByte("FA", 16));
+
+ try {
+ Convert.ToByte('\u03A9'); // sign of Omega on Win2k
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E25", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#D26", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((decimal)22000);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((double)255.5);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte(-tryInt16);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((int)-256);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte(tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((object)ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E32", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((sbyte)-1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((float)-0.6f);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E34", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte("1a1");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E35", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte("457");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((ushort)30000);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E37", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((uint)300);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E38", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte((ulong)987654321321);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E39", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte("10010111", 3);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E40", typeof(ArgumentException), e.GetType());
+ }
+
+ try {
+ Convert.ToByte("3F3", 16);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#E41", typeof(OverflowException), e.GetType());
+ }
+ }
+
+ public void TestToChar(){
+ tryByte = 58;
+ AssertEquals("#F01", ':', Convert.ToChar(tryByte));
+ AssertEquals("#F02", 'a', Convert.ToChar(tryChar));
+ AssertEquals("#F03", 'A', Convert.ToChar((short)65));
+ AssertEquals("#F04", 'x', Convert.ToChar((int)120));
+ AssertEquals("#F05", '"', Convert.ToChar((long)34));
+ AssertEquals("#F06", '-', Convert.ToChar((sbyte)45));
+ AssertEquals("#F07", '@', Convert.ToChar("@"));
+ AssertEquals("#F08", 'K', Convert.ToChar((ushort)75));
+ AssertEquals("#F09", '=', Convert.ToChar((uint)61));
+ // AssertEquals("#F10", 'È', Convert.ToChar((ulong)200));
+ AssertEquals("#F11", '{', Convert.ToChar((object)trySByte, ci));
+ AssertEquals("#F12", 'o', Convert.ToChar(tryStr.Substring(1,1), ci));
+
+ try {
+ Convert.ToChar(boolTrue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F20", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F21", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(tryDec);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F22", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(tryDbl);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F23", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar((short)-1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F24", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(Int32.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F25", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(Int32.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar((long)-123);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F29", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(-trySByte);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(tryFloat);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F31", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar("foo");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F32", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(null);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F33", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(new Exception(), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F34", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(null, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F35", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar("", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F36", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToChar(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#F37", typeof(FormatException), e.GetType());
+ }
+ }
+
+ public void TestToDateTime() {
+ string dateString = "01/01/2002";
+
+ int iTest = 1;
+ try {
+ AssertEquals("#G01", tryDT, Convert.ToDateTime(tryDT));
+ iTest++;
+ AssertEquals("#G02", tryDT, Convert.ToDateTime(dateString));
+ iTest++;
+ AssertEquals("#G03", tryDT, Convert.ToDateTime(dateString, ci));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at iTest = " + iTest + ": e = " + e);
+ }
+
+ try {
+ Convert.ToDateTime(boolTrue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G10", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryByte);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G11", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryChar);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G12", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryDec);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G13", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryDbl);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G14", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryInt16);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G15", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryInt32);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G16", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G17", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G18", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(trySByte);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G19", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryFloat);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G20", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime("20a2-01-01");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G21", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime("20002-25-01");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G22", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryUI16);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G23", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryUI32);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G24", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(tryUI64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime(ci, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G26", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDateTime("20a2-01-01", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#G27", typeof(FormatException), e.GetType());
+ }
+ }
+
+ public void TestToDecimal() {
+ AssertEquals("#H01", (decimal)1, Convert.ToDecimal(boolTrue));
+ AssertEquals("#H02", (decimal)0, Convert.ToDecimal(boolFalse));
+ AssertEquals("#H03", (decimal)tryByte, Convert.ToDecimal(tryByte));
+ AssertEquals("#H04", tryDec, Convert.ToDecimal(tryDec));
+ AssertEquals("#H05", (decimal)tryDbl, Convert.ToDecimal(tryDbl));
+ AssertEquals("#H06", (decimal)tryInt16, Convert.ToDecimal(tryInt16));
+ AssertEquals("#H07", (decimal)tryInt32, Convert.ToDecimal(tryInt32));
+ AssertEquals("#H08", (decimal)tryInt64, Convert.ToDecimal(tryInt64));
+ AssertEquals("#H09", (decimal)trySByte, Convert.ToDecimal(trySByte));
+ AssertEquals("#H10", (decimal)tryFloat, Convert.ToDecimal(tryFloat));
+ AssertEquals("#H11", (decimal)23456.432, Convert.ToDecimal("23456.432"));
+ AssertEquals("#H12", (decimal)tryUI16, Convert.ToDecimal(tryUI16));
+ AssertEquals("#H13", (decimal)tryUI32, Convert.ToDecimal(tryUI32));
+ AssertEquals("#H14", (decimal)tryUI64, Convert.ToDecimal(tryUI64));
+ AssertEquals("#H15", (decimal)63784, Convert.ToDecimal("63784", ci));
+
+ try {
+ Convert.ToDecimal(tryChar);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H20", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H21", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(double.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H22", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(double.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H23", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H24", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(tryStr);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H25", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ string maxDec = decimal.MaxValue.ToString();
+ maxDec = maxDec + "1";
+ Convert.ToDecimal(maxDec);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(ci, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H27", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDecimal(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H28", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ string maxDec = decimal.MaxValue.ToString();
+ maxDec = maxDec + "1";
+ Convert.ToDecimal(maxDec, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#H29", typeof(OverflowException), e.GetType());
+ }
+ }
+
+ public void TestToDouble() {
+ int iTest = 1;
+ try {
+ AssertEquals("#I01", (double)1, Convert.ToDouble(boolTrue));
+ iTest++;
+ AssertEquals("#I02", (double)0, Convert.ToDouble(boolFalse));
+ iTest++;
+ AssertEquals("#I03", (double)tryByte, Convert.ToDouble(tryByte));
+ iTest++;
+ AssertEquals("#I04", tryDbl, Convert.ToDouble(tryDbl));
+ iTest++;
+ AssertEquals("#I05", (double)tryDec, Convert.ToDouble(tryDec));
+ iTest++;
+ AssertEquals("#I06", (double)tryInt16, Convert.ToDouble(tryInt16));
+ iTest++;
+ AssertEquals("#I07", (double)tryInt32, Convert.ToDouble(tryInt32));
+ iTest++;
+ AssertEquals("#I08", (double)tryInt64, Convert.ToDouble(tryInt64));
+ iTest++;
+ AssertEquals("#I09", (double)trySByte, Convert.ToDouble(trySByte));
+ iTest++;
+ AssertEquals("#I10", (double)tryFloat, Convert.ToDouble(tryFloat));
+ iTest++;
+ AssertEquals("#I11", (double)23456.432, Convert.ToDouble("23456.432"));
+ iTest++;
+ AssertEquals("#I12", (double)tryUI16, Convert.ToDouble(tryUI16));
+ iTest++;
+ AssertEquals("#I13", (double)tryUI32, Convert.ToDouble(tryUI32));
+ iTest++;
+ AssertEquals("#I14", (double)tryUI64, Convert.ToDouble(tryUI64));
+ iTest++;
+ AssertEquals("#H15", (double)63784, Convert.ToDouble("63784", ci));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at iTest = " + iTest + ": e = " + e);
+ }
+
+ try {
+ Convert.ToDouble(tryChar);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I20", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDouble(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I21", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDouble(ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I22", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDouble(tryStr);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I23", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ string maxDec = double.MaxValue.ToString();
+ maxDec = maxDec + "1";
+ Convert.ToDouble(maxDec);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I24", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToDouble(ci, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToDouble(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I26", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ string maxDec = double.MaxValue.ToString();
+ maxDec = maxDec + "1";
+ Convert.ToDouble(maxDec, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToDouble(tryObj, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#I28", typeof(InvalidCastException), e.GetType());
+ }
+ }
+
+ public void TestToInt16() {
+ AssertEquals("#J01", (short)0, Convert.ToInt16(boolFalse));
+ AssertEquals("#J02", (short)1, Convert.ToInt16(boolTrue));
+ AssertEquals("#J03", (short)97, Convert.ToInt16(tryChar));
+ AssertEquals("#J04", (short)1234, Convert.ToInt16(tryDec));
+ AssertEquals("#J05", (short)0, Convert.ToInt16(tryDbl));
+ AssertEquals("#J06", (short)1234, Convert.ToInt16(tryInt16));
+ AssertEquals("#J07", (short)12345, Convert.ToInt16(tryInt32));
+ AssertEquals("#J08", (short)30000, Convert.ToInt16((long)30000));
+ AssertEquals("#J09", (short)123, Convert.ToInt16(trySByte));
+ AssertEquals("#J10", (short)1234, Convert.ToInt16(tryFloat));
+ AssertEquals("#J11", (short)578, Convert.ToInt16("578"));
+ AssertEquals("#J12", (short)15500, Convert.ToInt16((ushort)15500));
+ AssertEquals("#J13", (short)5489, Convert.ToInt16((uint)5489));
+ AssertEquals("#J14", (short)9876, Convert.ToInt16((ulong)9876));
+ AssertEquals("#J15", (short)14, Convert.ToInt16("14", ci));
+ AssertEquals("#J16", (short)11, Convert.ToInt16("01011", 2));
+ AssertEquals("#J17", (short)1540, Convert.ToInt16("3004", 8));
+ AssertEquals("#J18", (short)321, Convert.ToInt16("321", 10));
+ AssertEquals("#J19", (short)2748, Convert.ToInt16("ABC", 16));
+
+ try {
+ Convert.ToInt16(char.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J25", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J26", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16((decimal)(short.MaxValue + 1));
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16((decimal)(short.MinValue - 1));
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16((double)(short.MaxValue + 1));
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16((double)(short.MinValue - 1));
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(50000);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(-50000);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J32", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(-tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J34", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(tryObj);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J35", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16((float)32767.5);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16((float)-33000.54);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J37", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(tryStr);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J38", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16("-33000");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J39", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(ushort.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J40", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(uint.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J41", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(ulong.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J42", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(tryObj, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J43", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J44", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16("-33000", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J45", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16("321", 11);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J46", typeof(ArgumentException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt16("D8BF1", 16);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#J47", typeof(OverflowException), e.GetType());
+ }
+ }
+
+ public void TestToInt32() {
+ long tryMax = long.MaxValue;
+ long tryMin = long.MinValue;
+ AssertEquals("#K01", (int)0, Convert.ToInt32(boolFalse));
+ AssertEquals("#K02", (int)1, Convert.ToInt32(boolTrue));
+ AssertEquals("#K03", (int)0, Convert.ToInt32(tryByte));
+ AssertEquals("#K04", (int)97, Convert.ToInt32(tryChar));
+ AssertEquals("#K05", (int)1234, Convert.ToInt32(tryDec));
+ AssertEquals("#K06", (int)0, Convert.ToInt32(tryDbl));
+ AssertEquals("#K07", (int)1234, Convert.ToInt32(tryInt16));
+ AssertEquals("#K08", (int)12345, Convert.ToInt32(tryInt32));
+ AssertEquals("#K09", (int)60000, Convert.ToInt32((long)60000));
+ AssertEquals("#K10", (int)123, Convert.ToInt32(trySByte));
+ AssertEquals("#K11", (int)1234, Convert.ToInt32(tryFloat));
+ AssertEquals("#K12", (int)9876, Convert.ToInt32((string)"9876"));
+ AssertEquals("#K13", (int)34567, Convert.ToInt32(tryUI16));
+ AssertEquals("#K14", (int)567891234, Convert.ToInt32(tryUI32));
+ AssertEquals("#K15", (int)0, Convert.ToInt32(tryUI64));
+ AssertEquals("#K16", (int)123, Convert.ToInt32("123", ci));
+ AssertEquals("#K17", (int)128, Convert.ToInt32("10000000", 2));
+ AssertEquals("#K18", (int)302, Convert.ToInt32("456", 8));
+ AssertEquals("#K19", (int)456, Convert.ToInt32("456", 10));
+ AssertEquals("#K20", (int)1110, Convert.ToInt32("456", 16));
+
+ try {
+ Convert.ToInt32(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((decimal)tryMax);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((decimal)tryMin);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((double)tryMax);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((double)tryMin);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32(tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32(-tryInt64);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32(tryObj);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K32", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((float)tryMax);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((float)tryMin);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K34", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K35", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32("-46565465123");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32("46565465123");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K37", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((uint)tryMax);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K38", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32((ulong)tryMax);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K39", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32(tryObj, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K40", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K41", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32("-46565465123", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K42", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt32("654", 9);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#K43", typeof(ArgumentException), e.GetType());
+ }
+ }
+ public void TestToInt64() {
+ decimal longMax = long.MaxValue;
+ longMax += 1000000;
+ decimal longMin = long.MinValue;
+ longMin -= 1000000;
+
+ AssertEquals("#L01", (long)0, Convert.ToInt64(boolFalse));
+ AssertEquals("#L02", (long)1, Convert.ToInt64(boolTrue));
+ AssertEquals("#L03", (long)97, Convert.ToInt64(tryChar));
+ AssertEquals("#L04", (long)1234, Convert.ToInt64(tryDec));
+ AssertEquals("#L05", (long)0, Convert.ToInt64(tryDbl));
+ AssertEquals("#L06", (long)1234, Convert.ToInt64(tryInt16));
+ AssertEquals("#L07", (long)12345, Convert.ToInt64(tryInt32));
+ AssertEquals("#L08", (long)123456789012, Convert.ToInt64(tryInt64));
+ AssertEquals("#L09", (long)123, Convert.ToInt64(trySByte));
+ AssertEquals("#L10", (long)1234, Convert.ToInt64(tryFloat));
+ AssertEquals("#L11", (long)564897, Convert.ToInt64("564897"));
+ AssertEquals("#L12", (long)34567, Convert.ToInt64(tryUI16));
+ AssertEquals("#L13", (long)567891234, Convert.ToInt64(tryUI32));
+ AssertEquals("#L14", (long)0, Convert.ToInt64(tryUI64));
+ AssertEquals("#L15", (long)-2548751, Convert.ToInt64("-2548751", ci));
+ AssertEquals("#L16", (long)24987562, Convert.ToInt64("1011111010100011110101010", 2));
+ AssertEquals("#L17", (long)-24578965, Convert.ToInt64("1777777777777642172153", 8));
+ AssertEquals("#L18", (long)248759757, Convert.ToInt64("248759757", 10));
+ AssertEquals("#L19", (long)256, Convert.ToInt64("100", 16));
+
+ try {
+ Convert.ToInt64(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L20", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64((decimal)longMax + 1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L21", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64((decimal)longMin);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L24", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64((double)longMax);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L25:"+longMax, typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64((double)longMin);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(new Exception());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L27", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(((float)longMax)*100);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L28:"+longMax, typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(((float)longMin)*100);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64("-567b3");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L30", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(longMax.ToString());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L31:", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(ulong.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L32", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L32b", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64(longMin.ToString(), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToInt64("321", 11);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#L34", typeof(ArgumentException), e.GetType());
+ }
+ }
+
+ public void TestToSByte() {
+ int iTest = 1;
+ try {
+ AssertEquals("#M01", (sbyte)0, Convert.ToSByte(boolFalse));
+ iTest++;
+ AssertEquals("#M02", (sbyte)1, Convert.ToSByte(boolTrue));
+ iTest++;
+ AssertEquals("#M03", (sbyte)97, Convert.ToSByte(tryChar));
+ iTest++;
+ AssertEquals("#M04", (sbyte)15, Convert.ToSByte((decimal)15));
+ iTest++;
+ AssertEquals("#M05", (sbyte)0, Convert.ToSByte(tryDbl));
+ iTest++;
+ AssertEquals("#M06", (sbyte)127, Convert.ToSByte((short)127));
+ iTest++;
+ AssertEquals("#M07", (sbyte)-128, Convert.ToSByte((int)-128));
+ iTest++;
+ AssertEquals("#M08", (sbyte)30, Convert.ToSByte((long)30));
+ iTest++;
+ AssertEquals("#M09", (sbyte)123, Convert.ToSByte(trySByte));
+ iTest++;
+ AssertEquals("#M10", (sbyte)12, Convert.ToSByte((float)12.46987f));
+ iTest++;
+ AssertEquals("#M11", (sbyte)1, Convert.ToSByte("1"));
+ iTest++;
+ AssertEquals("#M12", (sbyte)99, Convert.ToSByte((ushort)99));
+ iTest++;
+ AssertEquals("#M13", (sbyte)54, Convert.ToSByte((uint)54));
+ iTest++;
+ AssertEquals("#M14", (sbyte)127, Convert.ToSByte((ulong)127));
+ iTest++;
+ AssertEquals("#M15", (sbyte)14, Convert.ToSByte("14", ci));
+ iTest++;
+ AssertEquals("#M16", (sbyte)11, Convert.ToSByte("01011", 2));
+ iTest++;
+ AssertEquals("#M17", (sbyte)5, Convert.ToSByte("5", 8));
+ iTest++;
+ AssertEquals("#M18", (sbyte)100, Convert.ToSByte("100", 10));
+ iTest++;
+ AssertEquals("#M19", (sbyte)-1, Convert.ToSByte("FF", 16));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at iTest = " + iTest + ": e = " + e);
+ }
+
+ try {
+ Convert.ToSByte((byte)200);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M25", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((char)130);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M27", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((decimal)127.5m);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((decimal)-200m);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((double)150);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((double)-128.6);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((short)150);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M32", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((short)-300);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((int)1500);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M34", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((int)-1286);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M35", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((long)128);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((long)-129);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M37", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte(new NumberFormatInfo());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M38", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((float)333);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M39", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((float)-666);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M40", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte("B3");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M41", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte("251");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M42", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte(ushort.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M43", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte((uint)600);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M44", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte(ulong.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M45", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte(ci, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M46", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M47", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte("325", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M48", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte("5D", 15);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M49", typeof(ArgumentException), e.GetType());
+ }
+
+ try {
+ Convert.ToSByte("111111111", 2);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#M50", typeof(OverflowException), e.GetType());
+ }
+ }
+
+ public void TestToSingle() {
+ int iTest = 1;
+ try {
+ AssertEquals("#N01", (float)0, Convert.ToSingle(boolFalse));
+ iTest++;
+ AssertEquals("#N02", (float)1, Convert.ToSingle(boolTrue));
+ iTest++;
+ AssertEquals("#N03", (float)0, Convert.ToSingle(tryByte));
+ iTest++;
+ AssertEquals("#N04", (float)1234,234, Convert.ToSingle(tryDec));
+ iTest++;
+ AssertEquals("#N05", (float)0, Convert.ToSingle(tryDbl));
+ iTest++;
+ AssertEquals("#N06", (float)1234, Convert.ToSingle(tryInt16));
+ iTest++;
+ AssertEquals("#N07", (float)12345, Convert.ToSingle(tryInt32));
+ iTest++;
+ AssertEquals("#N08", (float)123456789012, Convert.ToSingle(tryInt64));
+ iTest++;
+ AssertEquals("#N09", (float)123, Convert.ToSingle(trySByte));
+ iTest++;
+ AssertEquals("#N10", (float)1234,2345, Convert.ToSingle(tryFloat));
+ iTest++;
+ AssertEquals("#N11", (float)987, Convert.ToSingle("987"));
+ iTest++;
+ AssertEquals("#N12", (float)34567, Convert.ToSingle(tryUI16));
+ iTest++;
+ AssertEquals("#N13", (float)567891234, Convert.ToSingle(tryUI32));
+ iTest++;
+ AssertEquals("#N14", (float)0, Convert.ToSingle(tryUI64));
+ iTest++;
+ AssertEquals("#N15", (float)654.234, Convert.ToSingle("654.234", ci));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at iTest = " + iTest + ": e = " + e);
+ }
+
+ try {
+ Convert.ToSingle(tryChar);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N26", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle(tryObj);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N27", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle("A345H");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N28", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle(double.MaxValue.ToString());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle(tryObj, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N30", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle("J345K", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N31", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToSingle("11000000000000000000000000000000000000000000000", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#N32", typeof(OverflowException), e.GetType());
+ }
+ }
+
+ public void TestToString() {
+
+ tryByte = 123;
+ AssertEquals("#O01", "False", Convert.ToString(boolFalse));
+ AssertEquals("#O02", "True", Convert.ToString(boolTrue));
+ AssertEquals("#O03", "123", Convert.ToString(tryByte));
+ AssertEquals("#O04", "a", Convert.ToString(tryChar));
+ AssertEquals("#O05", tryDT.ToString(), Convert.ToString(tryDT));
+ AssertEquals("#O06", tryDec.ToString(), Convert.ToString(tryDec));
+ AssertEquals("#O07", tryDbl.ToString(), Convert.ToString(tryDbl));
+ AssertEquals("#O08", "1234", Convert.ToString(tryInt16));
+ AssertEquals("#O09", "12345", Convert.ToString(tryInt32));
+ AssertEquals("#O10", "123456789012", Convert.ToString(tryInt64));
+ AssertEquals("#O11", "123", Convert.ToString(trySByte));
+ AssertEquals("#O12", tryFloat.ToString(), Convert.ToString(tryFloat));
+ AssertEquals("#O13", "foobar", Convert.ToString(tryStr));
+ AssertEquals("#O14", "34567", Convert.ToString(tryUI16));
+ AssertEquals("#O15", "567891234", Convert.ToString(tryUI32));
+ AssertEquals("#O16", "True", Convert.ToString(boolTrue, ci));
+ AssertEquals("#O17", "False", Convert.ToString(boolFalse, ci));
+ AssertEquals("#O18", "123", Convert.ToString(tryByte, ci));
+ AssertEquals("#O19", "1111011", Convert.ToString(tryByte, 2));
+ AssertEquals("#O20", "173", Convert.ToString(tryByte, 8));
+ AssertEquals("#O21", "123", Convert.ToString(tryByte, 10));
+ AssertEquals("#O22", "7b", Convert.ToString(tryByte, 16));
+ AssertEquals("#O23", "a", Convert.ToString(tryChar, ci));
+ AssertEquals("#O24", tryDT.ToString(ci), Convert.ToString(tryDT, ci));
+ AssertEquals("#O25", tryDec.ToString(ci), Convert.ToString(tryDec,ci));
+ AssertEquals("#O26", tryDbl.ToString(ci), Convert.ToString(tryDbl, ci));
+ AssertEquals("#O27", "1234", Convert.ToString(tryInt16, ci));
+ AssertEquals("#O28", "10011010010", Convert.ToString(tryInt16, 2));
+ AssertEquals("#O29", "2322", Convert.ToString(tryInt16, 8));
+ AssertEquals("#O30", "1234", Convert.ToString(tryInt16, 10));
+ AssertEquals("#O31", "4d2", Convert.ToString(tryInt16, 16));
+ AssertEquals("#O32", "12345", Convert.ToString(tryInt32, ci));
+ AssertEquals("#O33", "11000000111001", Convert.ToString(tryInt32, 2));
+ AssertEquals("#O34", "30071", Convert.ToString(tryInt32, 8));
+ AssertEquals("#O35", "12345", Convert.ToString(tryInt32, 10));
+ AssertEquals("#O36", "3039", Convert.ToString(tryInt32, 16));
+ AssertEquals("#O37", "123456789012", Convert.ToString(tryInt64, ci));
+ AssertEquals("#O38", "1110010111110100110010001101000010100",
+ Convert.ToString(tryInt64, 2));
+ AssertEquals("#O39", "1627646215024", Convert.ToString(tryInt64, 8));
+ AssertEquals("#O40", "123456789012", Convert.ToString(tryInt64, 10));
+ AssertEquals("#O41", "1cbe991a14", Convert.ToString(tryInt64, 16));
+ AssertEquals("#O42", "123", Convert.ToString((trySByte), ci));
+ AssertEquals("#O43", tryFloat.ToString(ci), Convert.ToString((tryFloat), ci));
+ AssertEquals("#O44", "foobar", Convert.ToString((tryStr), ci));
+ AssertEquals("#O45", "34567", Convert.ToString((tryUI16), ci));
+ AssertEquals("#O46", "567891234", Convert.ToString((tryUI32), ci));
+ AssertEquals("#O47", "0", Convert.ToString(tryUI64));
+ AssertEquals("#O48", "0", Convert.ToString((tryUI64), ci));
+
+ try {
+ Convert.ToString(tryInt16, 5);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#O55", typeof(ArgumentException), e.GetType());
+ }
+
+ try {
+ Convert.ToString(tryInt32, 17);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#O56", typeof(ArgumentException), e.GetType());
+ }
+
+ try {
+ Convert.ToString(tryInt64, 1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#O57", typeof(ArgumentException), e.GetType());
+ }
+ }
+
+ public void TestToUInt16() {
+ AssertEquals("#P01", (ushort)0, Convert.ToUInt16(boolFalse));
+ AssertEquals("#P02", (ushort)1, Convert.ToUInt16(boolTrue));
+ AssertEquals("#P03", (ushort)0, Convert.ToUInt16(tryByte));
+ AssertEquals("#P04", (ushort)97, Convert.ToUInt16(tryChar));
+ AssertEquals("#P05", (ushort)1234, Convert.ToUInt16(tryDec));
+ AssertEquals("#P06", (ushort)0, Convert.ToUInt16(tryDbl));
+ AssertEquals("#P07", (ushort)1234, Convert.ToUInt16(tryInt16));
+ AssertEquals("#P08", (ushort)12345, Convert.ToUInt16(tryInt32));
+ AssertEquals("#P09", (ushort)43752, Convert.ToUInt16((long)43752));
+ AssertEquals("#P10", (ushort)123, Convert.ToUInt16(trySByte));
+ AssertEquals("#P11", (ushort)1234, Convert.ToUInt16(tryFloat));
+ AssertEquals("#P12", (ushort)123, Convert.ToUInt16((string)"123"));
+ AssertEquals("#P13", (ushort)34567, Convert.ToUInt16(tryUI16));
+ AssertEquals("#P14", (ushort)56789, Convert.ToUInt16((uint)56789));
+ AssertEquals("#P15", (ushort)0, Convert.ToUInt16(tryUI64));
+ AssertEquals("#P16", (ushort)31, Convert.ToUInt16("31", ci));
+ AssertEquals("#P17", (ushort)14, Convert.ToUInt16("1110", 2));
+ AssertEquals("#P18", (ushort)32, Convert.ToUInt16("40", 8));
+ AssertEquals("#P19", (ushort)40, Convert.ToUInt16("40", 10));
+ AssertEquals("#P20", (ushort)64, Convert.ToUInt16("40", 16));
+
+
+ try {
+ Convert.ToUInt16(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(decimal.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(decimal.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(double.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(double.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(short.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(int.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(int.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P32", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(long.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(long.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P34", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(tryObj);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P35", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(sbyte.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(float.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P37", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(float.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P38", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16("1A2");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P39", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16("-32800");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P40", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(int.MaxValue.ToString());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P41", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16(ulong.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P42", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16("1A2", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P43", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16("-32800", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P44", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16("456987", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P45", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt16("40", 9);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#P46", typeof(ArgumentException), e.GetType());
+ }
+ }
+
+ public void TestToUInt32() {
+ AssertEquals("#Q01", (uint)1, Convert.ToUInt32(boolTrue));
+ AssertEquals("#Q02", (uint)0, Convert.ToUInt32(boolFalse));
+ AssertEquals("#Q03", (uint)0, Convert.ToUInt32(tryByte));
+ AssertEquals("#Q04", (uint)97, Convert.ToUInt32(tryChar));
+ AssertEquals("#Q05", (uint)1234, Convert.ToUInt32(tryDec));
+ AssertEquals("#Q06", (uint)0, Convert.ToUInt32(tryDbl));
+ AssertEquals("#Q07", (uint)1234, Convert.ToUInt32(tryInt16));
+ AssertEquals("#Q08", (uint)12345, Convert.ToUInt32(tryInt32));
+ AssertEquals("#Q09", (uint)1234567890, Convert.ToUInt32((long)1234567890));
+ AssertEquals("#Q10", (uint)123, Convert.ToUInt32(trySByte));
+ AssertEquals("#Q11", (uint)1234, Convert.ToUInt32(tryFloat));
+ AssertEquals("#Q12", (uint)3456789, Convert.ToUInt32("3456789"));
+ AssertEquals("#Q13", (uint)34567, Convert.ToUInt32(tryUI16));
+ AssertEquals("#Q14", (uint)567891234, Convert.ToUInt32(tryUI32));
+ AssertEquals("#Q15", (uint)0, Convert.ToUInt32(tryUI64));
+ AssertEquals("#Q16", (uint)415, Convert.ToUInt32("110011111", 2));
+ AssertEquals("#Q17", (uint)156, Convert.ToUInt32("234" ,8));
+ AssertEquals("#Q18", (uint)234, Convert.ToUInt32("234" ,10));
+ AssertEquals("#Q19", (uint)564, Convert.ToUInt32("234" ,16));
+
+
+ try {
+ Convert.ToUInt32(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(decimal.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32((decimal)-150);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(double.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32((double)-1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(short.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(int.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(long.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q32", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32((long)-50000);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q33", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(new Exception());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q34", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(sbyte.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q35", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(float.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(float.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q37", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32("45t54");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q38", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32("-55");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q39", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(ulong.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q40", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(new Exception(), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q41", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(tryStr, ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q42", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32("-50", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q43", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32(decimal.MaxValue.ToString(), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q44", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt32("1001110", 1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#Q45", typeof(ArgumentException), e.GetType());
+ }
+ }
+
+ public void TestToUInt64()
+ {
+ int iTest = 1;
+ try {
+ AssertEquals("#R01", (ulong)1, Convert.ToUInt64(boolTrue));
+ iTest++;
+ AssertEquals("#R02", (ulong)0, Convert.ToUInt64(boolFalse));
+ iTest++;
+ AssertEquals("#R03", (ulong)0, Convert.ToUInt64(tryByte));
+ iTest++;
+ AssertEquals("#R04", (ulong)97, Convert.ToUInt64(tryChar));
+ iTest++;
+ AssertEquals("#R05", (ulong)1234, Convert.ToUInt64(tryDec));
+ iTest++;
+ AssertEquals("#R06", (ulong)0, Convert.ToUInt64(tryDbl));
+ iTest++;
+ AssertEquals("#R07", (ulong)1234, Convert.ToUInt64(tryInt16));
+ iTest++;
+ AssertEquals("#R08", (ulong)12345, Convert.ToUInt64(tryInt32));
+ iTest++;
+ AssertEquals("#R09", (ulong)123456789012, Convert.ToUInt64(tryInt64));
+ iTest++;
+ AssertEquals("#R10", (ulong)123, Convert.ToUInt64(trySByte));
+ iTest++;
+ AssertEquals("#R11", (ulong)1234, Convert.ToUInt64(tryFloat));
+ iTest++;
+ AssertEquals("#R12", (ulong)345678, Convert.ToUInt64("345678"));
+ iTest++;
+ AssertEquals("#R13", (ulong)34567, Convert.ToUInt64(tryUI16));
+ iTest++;
+ AssertEquals("#R14", (ulong)567891234, Convert.ToUInt64(tryUI32));
+ iTest++;
+ AssertEquals("#R15", (ulong)0, Convert.ToUInt64(tryUI64));
+ iTest++;
+ AssertEquals("#R16", (ulong)123, Convert.ToUInt64("123", ci));
+ iTest++;
+ AssertEquals("#R17", (ulong)4, Convert.ToUInt64("100", 2));
+ iTest++;
+ AssertEquals("#R18", (ulong)64, Convert.ToUInt64("100", 8));
+ iTest++;
+ AssertEquals("#R19", (ulong)100, Convert.ToUInt64("100", 10));
+ iTest++;
+ AssertEquals("#R20", (ulong)256, Convert.ToUInt64("100", 16));
+ } catch (Exception e) {
+ Fail ("Unexpected exception caught when iTest = " + iTest + ": e = " + e);
+ }
+
+ try {
+ Convert.ToUInt64(tryDT);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R25", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(decimal.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R26", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64((decimal)-140);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R27", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(double.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R28", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64((double)-1);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R29", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(short.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R30", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(int.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R31", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(long.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R32", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(tryObj);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R33", typeof(InvalidCastException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(sbyte.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R34", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(float.MinValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R35", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(float.MaxValue);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R36", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64("234rt78");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R37", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64("-68");
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R38", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(decimal.MaxValue.ToString());
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R39", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64("23rd2", ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R40", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(decimal.MinValue.ToString(), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R41", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64(decimal.MaxValue.ToString(), ci);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R42", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Convert.ToUInt64("132", 9);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#R43", typeof(ArgumentException), e.GetType());
+ }
+ }
+
+ public void TestToBase64CharArray() {
+ byte[] byteArr = {33, 127, 255, 109, 170, 54};
+ // 0 1 2 3 4 5 6 7
+ char[] expectedCharArr = {'I', 'X', '/', '/', 'b', 'a', 'o', '2'};
+ char[] result = new Char[8];
+
+ Convert.ToBase64CharArray(byteArr, 0, byteArr.Length, result, 0);
+
+ for (int i = 0; i < expectedCharArr.Length; i++) {
+ AssertEquals("#S0" + i, expectedCharArr[i], result[i]);
+ }
+
+ try {
+ Convert.ToBase64CharArray(null, 0, byteArr.Length, result, 0);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#S10", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64CharArray(byteArr, -1, byteArr.Length, result, 0);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#S11", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64CharArray(byteArr, 0, -5, result, 0);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#S12", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64CharArray(byteArr, 0, byteArr.Length, result, -2);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#S13", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64CharArray(byteArr, 4, byteArr.Length, result, 0);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#S14", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64CharArray(byteArr, 0, byteArr.Length, result, 2);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#S15", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+ }
+ public void TestToBase64String() {
+ byte[] byteArr = {33, 127, 255, 109, 170, 54};
+ string expectedStr = "IX//bao2";
+ string result1;
+ string result2;
+
+ result1 = Convert.ToBase64String(byteArr);
+ result2 = Convert.ToBase64String(byteArr, 0, byteArr.Length);
+
+ AssertEquals("#T01", expectedStr, result1);
+ AssertEquals("#T02", expectedStr, result2);
+
+ try {
+ Convert.ToBase64String(null);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#T05", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64String(byteArr, -1, byteArr.Length);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#T06", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64String(byteArr, 0, -10);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#T07", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.ToBase64String(byteArr, 4, byteArr.Length);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#T08", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+ }
+
+ /* Have experienced some problems with FromBase64CharArray using mono. Something
+ * about error in a unicode file.
+ *
+ * However the test seems to run fine using mono in a cygwin environment
+ */
+ public void TestFromBase64CharArray() {
+
+ char[] charArr = {'M','o','n','o','m','o','n','o'};
+ byte[] expectedByteArr = {50, 137, 232, 154, 137, 232};
+
+ byte[] fromCharArr = Convert.FromBase64CharArray(charArr, 0, 8);
+
+ for (int i = 0; i < fromCharArr.Length; i++){
+ AssertEquals("#U0" + i, expectedByteArr[i], fromCharArr[i]);
+ }
+
+ try {
+ Convert.FromBase64CharArray(null, 0, charArr.Length);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#U10", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64CharArray(charArr, -1, charArr.Length);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#U11", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64CharArray(charArr, 0, -5);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#U12", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64CharArray(charArr, 0, 3);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#U13", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64CharArray(charArr, 0, 9);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#U14", typeof(ArgumentOutOfRangeException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64CharArray(charArr, 0, 5);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#U15", typeof(FormatException), e.GetType());
+ }
+ }
+
+ /* Have experienced some problems with FromBase64String using mono. Something about
+ * error in a unicode file.
+ *
+ * However the test seems to run fine using mono in a cygwin environment
+ */
+ public void TestFromBase64String() {
+ string str = "Monomono";
+ string err01 = "foo";
+
+ byte[] expectedByteArr = {50, 137, 232, 154, 137, 232};
+ byte[] fromStr = Convert.FromBase64String(str);
+
+ for (int i = 0; i < fromStr.Length; i++){
+ AssertEquals("#V0" + i, expectedByteArr[i], fromStr[i]);
+ }
+
+ try {
+ Convert.FromBase64String(null);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#V10", typeof(ArgumentNullException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64String(err01);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#V11", typeof(FormatException), e.GetType());
+ }
+
+ try {
+ Convert.FromBase64String(tryStr);
+ Fail();
+ }
+ catch (Exception e) {
+ AssertEquals("#V12", typeof(FormatException), e.GetType());
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System/DateTimeTest.cs b/mcs/class/corlib/Test/System/DateTimeTest.cs
new file mode 100755
index 00000000000..ac530dc4f69
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DateTimeTest.cs
@@ -0,0 +1,400 @@
+//
+// DateTimeTest.cs - NUnit Test Cases for the System.DateTime struct
+//
+// author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Free Software Foundation
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class DateTimeTest : TestCase
+{
+ private CultureInfo oldcult;
+
+ long[] myTicks = {
+ 631501920000000000L, // 25 Feb 2002 - 00:00:00
+ 631502475130080000L, // 25 Feb 2002 - 15:25:13,8
+ 631502115130080000L, // 25 Feb 2002 - 05:25:13,8
+ 631502115000000000L, // 25 Feb 2002 - 05:25:00
+ 631502115130000000L, // 25 Feb 2002 - 05:25:13
+ 631502079130000000L, // 25 Feb 2002 - 04:25:13
+ 629197085770000000L // 06 Nov 1994 - 08:49:37
+ };
+
+ public DateTimeTest() {}
+
+ protected override void SetUp()
+ {
+ // the current culture determines the result of formatting
+ oldcult = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
+ }
+
+ protected override void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = oldcult;
+ }
+
+ public void TestCtors ()
+ {
+ DateTime t1 = new DateTime (2002,2,25);
+ AssertEquals("A01", myTicks[0], t1.Ticks);
+ DateTime t2 = new DateTime (2002,2,25,15,25,13,8);
+ AssertEquals("A02", myTicks[1], t2.Ticks);
+ AssertEquals("A03", myTicks[0], t2.Date.Ticks);
+ AssertEquals("A04", 2002, t2.Year);
+ AssertEquals("A05", 2, t2.Month);
+ AssertEquals("A06", 25, t2.Day);
+ AssertEquals("A07", 15, t2.Hour);
+ AssertEquals("A08", 25, t2.Minute);
+ AssertEquals("A09", 13, t2.Second);
+ AssertEquals("A10", 8, t2.Millisecond);
+ DateTime t3 = new DateTime (2002,2,25,5,25,13,8);
+ AssertEquals("A11", myTicks[2], t3.Ticks);
+ }
+
+ public void TestToString ()
+ {
+ DateTime t1 = new DateTime (myTicks[2]);
+ DateTime t2 = new DateTime (myTicks[1]);
+ // Standard patterns
+ AssertEquals("B01", "02/25/2002", t1.ToString ("d"));
+ AssertEquals("B02", "Monday, 25 February 2002", t1.ToString ("D"));
+ AssertEquals("B03", "Monday, 25 February 2002 05:25", t1.ToString ("f"));
+ AssertEquals("B04", "Monday, 25 February 2002 05:25:13", t1.ToString ("F"));
+ AssertEquals("B05", "02/25/2002 05:25", t1.ToString ("g"));
+ AssertEquals("B06", "02/25/2002 05:25:13", t1.ToString ("G"));
+ AssertEquals("B07", "February 25", t1.ToString ("m"));
+ AssertEquals("B08", "February 25", t1.ToString ("M"));
+ AssertEquals("B09", "Mon, 25 Feb 2002 05:25:13 GMT", t1.ToString ("r"));
+ AssertEquals("B10", "Mon, 25 Feb 2002 05:25:13 GMT", t1.ToString ("R"));
+ AssertEquals("B11", "2002-02-25T05:25:13", t1.ToString ("s"));
+ AssertEquals("B12", "05:25", t1.ToString ("t"));
+ AssertEquals("B13", "05:25:13", t1.ToString ("T"));
+ AssertEquals("B14", "2002-02-25 05:25:13Z", t1.ToString ("u"));
+// FIXME: bugzilla #30030
+// AssertEquals("B15", "Sunday, 24 February 2002 11:25:13", t1.ToUniversalTime().ToString ("U"));
+ AssertEquals("B16", "2002 February", t1.ToString ("y"));
+ AssertEquals("B17", "2002 February", t1.ToString ("Y"));
+
+ // Custom patterns
+ AssertEquals("C01", "25", t1.ToString ("%d"));
+ AssertEquals("C02", "25", t1.ToString ("dd"));
+ AssertEquals("C03", "Mon", t1.ToString ("ddd"));
+ AssertEquals("C04", "Monday", t1.ToString ("dddd"));
+ AssertEquals("C05", "2", t1.ToString ("%M"));
+ AssertEquals("C06", "02", t1.ToString ("MM"));
+ AssertEquals("C07", "Feb", t1.ToString ("MMM"));
+ AssertEquals("C08", "February", t1.ToString ("MMMM"));
+ AssertEquals("C09", "2", t1.ToString ("%y"));
+ AssertEquals("C10", "02", t1.ToString ("yy"));
+ AssertEquals("C11", "2002", t1.ToString ("yyyy"));
+ AssertEquals("C12", "5", t1.ToString ("%h"));
+ AssertEquals("C13", "05", t1.ToString ("hh"));
+ AssertEquals("C14", "3", t2.ToString ("%h"));
+ AssertEquals("C15", "03", t2.ToString ("hh"));
+ AssertEquals("C16", "15", t2.ToString ("%H"));
+ AssertEquals("C17", "15", t2.ToString ("HH"));
+ AssertEquals("C18", "25", t2.ToString ("%m"));
+ AssertEquals("C19", "25", t2.ToString ("mm"));
+ AssertEquals("C20", "13", t2.ToString ("%s"));
+ AssertEquals("C21", "13", t2.ToString ("ss"));
+ AssertEquals("C22", "A", t1.ToString ("%t"));
+ AssertEquals("C23", "P", t2.ToString ("%t"));
+ AssertEquals("C24", "AM", t1.ToString ("tt"));
+ AssertEquals("C25", "PM", t2.ToString ("tt"));
+ long offset = TimeZone.CurrentTimeZone.GetUtcOffset(t1).Ticks / 36000000000;
+ AssertEquals("C26", offset.ToString("+#;-#;0"), t1.ToString ("%z"));
+ AssertEquals("C27", offset.ToString("+00;-00;00"), t1.ToString ("zz"));
+ AssertEquals("C28", offset.ToString("+00;-00;00") + ":00", t1.ToString ("zzz"));
+ AssertEquals("C29", " : ", t1.ToString (" : "));
+ AssertEquals("C30", " / ", t1.ToString (" / "));
+ AssertEquals("C31", " yyy ", t1.ToString (" 'yyy' "));
+ AssertEquals("C32", " d", t1.ToString (" \\d"));
+ }
+
+ public void TestParseExact ()
+ {
+ // Standard patterns
+ DateTime t1 = DateTime.ParseExact ("02/25/2002", "d", null);
+ AssertEquals ("D01", myTicks[0], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002", "D", null);
+ AssertEquals ("D02", myTicks[0], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25", "f", null);
+ AssertEquals ("D03", myTicks[3], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25:13", "F", null);
+ AssertEquals ("D04", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("02/25/2002 05:25", "g", null);
+ AssertEquals ("D05", myTicks[3], t1.Ticks);
+ t1 = DateTime.ParseExact ("02/25/2002 05:25:13", "G", null);
+ AssertEquals ("D06", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("2002-02-25 04:25:13Z", "u", null);
+ AssertEquals ("D07a", 2002, t1.Year);
+ AssertEquals ("D07b", 02, t1.Month);
+ AssertEquals ("D07c", 25, t1.Day);
+ AssertEquals ("D07d", 04, t1.Hour);
+ AssertEquals ("D07e", 25, t1.Minute);
+ AssertEquals ("D07f", 13, t1.Second);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 04:25:13", "U", null);
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ AssertEquals ("D08a", 2002, t1.Year);
+ AssertEquals ("D08b", 02, t1.Month);
+ AssertEquals ("D08c", 25, t1.Day);
+ AssertEquals ("D08d", 04, t1.Hour);
+ AssertEquals ("D08e", 25, t1.Minute);
+ AssertEquals ("D08f", 13, t1.Second);
+
+ DateTime t2 = new DateTime (DateTime.Today.Year, 2, 25);
+ t1 = DateTime.ParseExact ("February 25", "m", null);
+ AssertEquals ("D09", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 25);
+ t1 = DateTime.ParseExact ("February 25", "M", null);
+ AssertEquals ("D10", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("Mon, 25 Feb 2002 04:25:13 GMT", "r", null);
+ AssertEquals ("D11a", 2002, t1.Year);
+ AssertEquals ("D11b", 02, t1.Month);
+ AssertEquals ("D11c", 25, t1.Day);
+ AssertEquals ("D11d", 04, t1.Hour);
+ AssertEquals ("D11e", 25, t1.Minute);
+ AssertEquals ("D11f", 13, t1.Second);
+
+ t1 = DateTime.ParseExact ("Mon, 25 Feb 2002 04:25:13 GMT", "R", null);
+ AssertEquals ("D12a", 2002, t1.Year);
+ AssertEquals ("D12b", 02, t1.Month);
+ AssertEquals ("D12c", 25, t1.Day);
+ AssertEquals ("D12d", 04, t1.Hour);
+ AssertEquals ("D12e", 25, t1.Minute);
+ AssertEquals ("D12f", 13, t1.Second);
+
+ t1 = DateTime.ParseExact ("2002-02-25T05:25:13", "s", null);
+ AssertEquals ("D13", myTicks[4], t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,0);
+ t1 = DateTime.ParseExact ("05:25", "t", null);
+ AssertEquals("D14", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,13);
+ t1 = DateTime.ParseExact ("05:25:13", "T", null);
+ AssertEquals("D15", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.ParseExact ("2002 February", "y", null);
+ AssertEquals ("D16", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.ParseExact ("2002 February", "Y", null);
+ AssertEquals ("D16", t2.Ticks, t1.Ticks);
+
+ // Custom patterns
+ t2 = new DateTime (2003, 1, 25);
+ t1 = DateTime.ParseExact ("25", "%d", null);
+ AssertEquals ("E01", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("25", "dd", null);
+ AssertEquals ("E02", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 1);
+ t1 = DateTime.ParseExact ("2", "%M", null);
+ AssertEquals ("E03", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("02", "MM", null);
+ AssertEquals ("E04", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("Feb", "MMM", null);
+ AssertEquals ("E05", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("February", "MMMM", null);
+ AssertEquals ("E06", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2005, 1, 1);
+ t1 = DateTime.ParseExact ("5", "%y", null);
+ AssertEquals ("E07", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("05", "yy", null);
+ AssertEquals ("E08", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("2005", "yyyy", null);
+ AssertEquals ("E09", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5, 0, 0);
+ t1 = DateTime.ParseExact ("5A", "ht", null);
+ AssertEquals ("E10", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("05A", "hht", null);
+ AssertEquals ("E11", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (15, 0, 0);
+ t1 = DateTime.ParseExact ("3P", "ht", null);
+ AssertEquals ("E12", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("03P", "hht", null);
+ AssertEquals ("E13", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5, 0, 0);
+ t1 = DateTime.ParseExact ("5", "%H", null);
+ AssertEquals ("E14", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (15, 0, 0);
+ t1 = DateTime.ParseExact ("15", "%H", null);
+ AssertEquals ("E15", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("15", "HH", null);
+ AssertEquals ("E16", t2.Ticks, t1.Ticks);
+
+ // Time zones
+ t2 = DateTime.Today + new TimeSpan (17, 18, 0);
+ t1 = DateTime.ParseExact ("11:18AM -5", "h:mmtt z", null);
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ if (!TimeZone.CurrentTimeZone.IsDaylightSavingTime(t1))
+ t1 += new TimeSpan(1, 0, 0);
+ AssertEquals ("F01", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("11:18AM -05:00", "h:mmtt zzz", null);
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ if (!TimeZone.CurrentTimeZone.IsDaylightSavingTime(t1))
+ t1 += new TimeSpan(1, 0, 0);
+ AssertEquals ("F02", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("7:18PM +03", "h:mmtt zz", null);
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ if (!TimeZone.CurrentTimeZone.IsDaylightSavingTime(t1))
+ t1 += new TimeSpan(1, 0, 0);
+ AssertEquals ("F03", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("7:48PM +03:30", "h:mmtt zzz", null);
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ if (!TimeZone.CurrentTimeZone.IsDaylightSavingTime(t1))
+ t1 += new TimeSpan(1, 0, 0);
+ AssertEquals ("F04", t2.Ticks, t1.Ticks);
+
+ // Options
+ t2 = DateTime.Today + new TimeSpan (16, 18, 0);
+ t1 = DateTime.ParseExact ("11:18AM -5", "h:mmtt z",
+ null, DateTimeStyles.AdjustToUniversal);
+ AssertEquals ("G01", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25:13", "F",
+ null, DateTimeStyles.AdjustToUniversal);
+ AssertEquals ("G02", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25:13",
+ "dddd, dd MMMM yyyy HH:mm:ss",
+ null, DateTimeStyles.AdjustToUniversal);
+ AssertEquals ("G03", myTicks[4], t1.Ticks);
+
+ t1 = DateTime.ParseExact ("02/25/2002", "d", null,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("G04", myTicks[0], t1.Ticks);
+
+ t1 = DateTime.ParseExact (" 02/25/2002", "d", null,
+ DateTimeStyles.AllowLeadingWhite);
+ AssertEquals ("G05", myTicks[0], t1.Ticks);
+
+ t1 = DateTime.ParseExact ("02/25/2002 ", "d", null,
+ DateTimeStyles.AllowTrailingWhite);
+ AssertEquals ("G06", myTicks[0], t1.Ticks);
+
+ t1 = DateTime.ParseExact (" 02 / 25 / 2002 ", "d", null,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("G07", myTicks[0], t1.Ticks);
+
+ // Multi Custom Patterns
+ string rfc1123_date = "r";
+ string rfc850_date = "dddd, dd'-'MMM'-'yy HH':'mm':'ss 'GMT'";
+ string asctime_date = "ddd MMM d HH':'mm':'ss yyyy";
+ string [] formats = new string [] {rfc1123_date, rfc850_date, asctime_date};
+ CultureInfo enUS = new CultureInfo("en-US", false);
+ t1 = DateTime.ParseExact ("Sun, 06 Nov 1994 08:49:37 GMT", formats[0], enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("M01", myTicks[6], t1.Ticks);
+ t1 = DateTime.ParseExact ("Sunday, 06-Nov-94 08:49:37 GMT", formats[1], enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("M02", myTicks[6], t1.Ticks);
+ t1 = DateTime.ParseExact ("Sun Nov 6 08:49:37 1994", formats[2], enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("M03", myTicks[6], t1.Ticks);
+ t1 = DateTime.ParseExact ("Sun, 06 Nov 1994 08:49:37 GMT", formats, enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("M04", myTicks[6], t1.Ticks);
+ t1 = DateTime.ParseExact ("Sunday, 06-Nov-94 08:49:37 GMT", formats, enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("M05", myTicks[6], t1.Ticks);
+ t1 = DateTime.ParseExact ("Sun Nov 6 08:49:37 1994", formats, enUS,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("M06", myTicks[6], t1.Ticks);
+ }
+
+ public void TestParse ()
+ {
+ // Standard patterns
+ DateTime t1 = DateTime.Parse ("02/25/2002");
+ AssertEquals ("H00", myTicks[0], t1.Ticks);
+ try {
+ t1 = DateTime.Parse ("2002-02-25");
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception. e=" + e);
+ }
+ AssertEquals ("H01", myTicks[0], t1.Ticks);
+ t1 = DateTime.Parse ("Monday, 25 February 2002");
+ AssertEquals ("H02", myTicks[0], t1.Ticks);
+ t1 = DateTime.Parse ("Monday, 25 February 2002 05:25");
+ AssertEquals ("H03", myTicks[3], t1.Ticks);
+ t1 = DateTime.Parse ("Monday, 25 February 2002 05:25:13");
+ AssertEquals ("H04", myTicks[4], t1.Ticks);
+ t1 = DateTime.Parse ("02/25/2002 05:25");
+ AssertEquals ("H05", myTicks[3], t1.Ticks);
+ t1 = DateTime.Parse ("02/25/2002 05:25:13");
+ AssertEquals ("H06", myTicks[4], t1.Ticks);
+ t1 = DateTime.Parse ("2002-02-25 04:25:13Z");
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ AssertEquals ("H07a", 2002, t1.Year);
+ AssertEquals ("H07b", 02, t1.Month);
+ AssertEquals ("H07c", 25, t1.Day);
+ AssertEquals ("H07d", 04, t1.Hour);
+ AssertEquals ("H07e", 25, t1.Minute);
+ AssertEquals ("H07f", 13, t1.Second);
+
+ DateTime t2 = new DateTime (DateTime.Today.Year, 2, 25);
+ t1 = DateTime.Parse ("February 25");
+ AssertEquals ("H08", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 8);
+ t1 = DateTime.Parse ("February 08");
+ AssertEquals ("H09", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.Parse ("Mon, 25 Feb 2002 04:25:13 GMT");
+ t1 = TimeZone.CurrentTimeZone.ToUniversalTime(t1);
+ AssertEquals ("H10a", 2002, t1.Year);
+ AssertEquals ("H10b", 02, t1.Month);
+ AssertEquals ("H10c", 25, t1.Day);
+ AssertEquals ("H10d", 04, t1.Hour);
+ AssertEquals ("H10e", 25, t1.Minute);
+ AssertEquals ("H10f", 13, t1.Second);
+
+ t1 = DateTime.Parse ("2002-02-25T05:25:13");
+ AssertEquals ("H11", myTicks[4], t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,0);
+ t1 = DateTime.Parse ("05:25");
+ AssertEquals("H12", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,13);
+ t1 = DateTime.Parse ("05:25:13");
+ AssertEquals("H13", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.Parse ("2002 February");
+ AssertEquals ("H14", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.Parse ("2002 February");
+ AssertEquals ("H15", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 8);
+ t1 = DateTime.Parse ("February 8");
+ AssertEquals ("H16", t2.Ticks, t1.Ticks);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/DecimalTest.cs b/mcs/class/corlib/Test/System/DecimalTest.cs
new file mode 100644
index 00000000000..ba9d3c2a1f4
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DecimalTest.cs
@@ -0,0 +1,883 @@
+// DecimalTest.cs - NUnit Test Cases for the System.Decimal struct
+//
+// Author: Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, 2001
+//
+
+using NUnit.Framework;
+using System;
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+namespace MonoTests.System {
+ internal struct ParseTest
+ {
+ public ParseTest(String str, bool exceptionFlag)
+ {
+ this.str = str;
+ this.exceptionFlag = exceptionFlag;
+ this.style = NumberStyles.Number;
+ this.d = 0;
+ }
+
+ public ParseTest(String str, Decimal d)
+ {
+ this.str = str;
+ this.exceptionFlag = false;
+ this.style = NumberStyles.Number;
+ this.d = d;
+ }
+
+ public ParseTest(String str, Decimal d, NumberStyles style)
+ {
+ this.str = str;
+ this.exceptionFlag = false;
+ this.style = style;
+ this.d = d;
+ }
+
+ public String str;
+ public Decimal d;
+ public NumberStyles style;
+ public bool exceptionFlag;
+ }
+
+ internal struct ToStringTest
+ {
+ public ToStringTest(String format, Decimal d, String str)
+ {
+ this.format = format;
+ this.d = d;
+ this.str = str;
+ }
+
+ public String format;
+ public Decimal d;
+ public String str;
+ }
+
+ /// <summary>
+ /// Tests for System.Decimal
+ /// </summary>
+ public class DecimalTest : TestCase
+ {
+ public DecimalTest() {}
+
+ private const int negativeBitValue = unchecked ((int)0x80000000);
+ private const int negativeScale4Value = unchecked ((int)0x80040000);
+ private int [] parts0 = {0,0,0,0}; //Positive Zero.
+ private int [] parts1 = {1,0,0,0};
+ private int [] parts2 = {0,1,0,0};
+ private int [] parts3 = {0,0,1,0};
+ private int [] parts4 = {0,0,0,negativeBitValue}; // Negative zero.
+ private int [] parts5 = {1,1,1,0};
+ private int [] partsMaxValue = {-1,-1,-1,0};
+ private int [] partsMinValue = {-1,-1,-1,negativeBitValue};
+ private int [] parts6 = {1234, 5678, 8888, negativeScale4Value};
+ private NumberFormatInfo NfiUser;
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ NfiUser = new NumberFormatInfo();
+ NfiUser.CurrencyDecimalDigits = 3;
+ NfiUser.CurrencyDecimalSeparator = ",";
+ NfiUser.CurrencyGroupSeparator = "_";
+ NfiUser.CurrencyGroupSizes = new int[] { 2,1,0 };
+ NfiUser.CurrencyNegativePattern = 10;
+ NfiUser.CurrencyPositivePattern = 3;
+ NfiUser.CurrencySymbol = "XYZ";
+ NfiUser.NumberDecimalSeparator = "##";
+ NfiUser.NumberDecimalDigits = 4;
+ NfiUser.NumberGroupSeparator = "__";
+ NfiUser.NumberGroupSizes = new int[] { 2,1 };
+ NfiUser.PercentDecimalDigits = 1;
+ NfiUser.PercentDecimalSeparator = ";";
+ NfiUser.PercentGroupSeparator = "~";
+ NfiUser.PercentGroupSizes = new int[] {1};
+ NfiUser.PercentNegativePattern = 2;
+ NfiUser.PercentPositivePattern = 2;
+ NfiUser.PercentSymbol = "%%%";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestToString()
+ {
+ ToStringTest[] tab = {
+ new ToStringTest("F", 12.345678m, "12.35"),
+ new ToStringTest("F3", 12.345678m, "12.346"),
+ new ToStringTest("F0", 12.345678m, "12"),
+ new ToStringTest("F7", 12.345678m, "12.3456780"),
+ new ToStringTest("g", 12.345678m, "12.345678"),
+ new ToStringTest("E", 12.345678m, "1.234568E+001"),
+ new ToStringTest("E3", 12.345678m, "1.235E+001"),
+ new ToStringTest("E0", 12.345678m, "1E+001"),
+ new ToStringTest("e8", 12.345678m, "1.23456780e+001"),
+ new ToStringTest("F", 0.0012m, "0.00"),
+ new ToStringTest("F3", 0.0012m, "0.001"),
+ new ToStringTest("F0", 0.0012m, "0"),
+ new ToStringTest("F6", 0.0012m, "0.001200"),
+ new ToStringTest("e", 0.0012m, "1.200000e-003"),
+ new ToStringTest("E3", 0.0012m, "1.200E-003"),
+ new ToStringTest("E0", 0.0012m, "1E-003"),
+ new ToStringTest("E6", 0.0012m, "1.200000E-003"),
+ new ToStringTest("F4", -0.001234m, "-0.0012"),
+ new ToStringTest("E3", -0.001234m, "-1.234E-003"),
+ new ToStringTest("g", -0.000012m, "-1.2e-05"),
+ new ToStringTest("g", -0.00012m, "-0.00012"),
+ new ToStringTest("g4", -0.00012m, "-0.00012"),
+ new ToStringTest("g7", -0.00012m, "-0.00012"),
+ new ToStringTest("g", -0.0001234m, "-0.0001234"),
+ new ToStringTest("g", -0.0012m, "-0.0012"),
+ new ToStringTest("g", -0.001234m, "-0.001234"),
+ new ToStringTest("g", -0.012m, "-0.012"),
+ new ToStringTest("g4", -0.012m, "-0.012"),
+ new ToStringTest("g", -0.12m, "-0.12"),
+ new ToStringTest("g", -1.2m, "-1.2"),
+ new ToStringTest("g4", -120m, "-120"),
+ new ToStringTest("g", -12m, "-12"),
+ new ToStringTest("g", -120m, "-120"),
+ new ToStringTest("g", -1200m, "-1200"),
+ new ToStringTest("g4", -1200m, "-1200"),
+ new ToStringTest("g", -1234m, "-1234"),
+ new ToStringTest("g", -12000m, "-12000"),
+ new ToStringTest("g4", -12000m, "-1.2e+04"),
+ new ToStringTest("g5", -12000m, "-12000"),
+ new ToStringTest("g", -12345m, "-12345"),
+ new ToStringTest("g", -120000m, "-120000"),
+ new ToStringTest("g4", -120000m, "-1.2e+05"),
+ new ToStringTest("g5", -120000m, "-1.2e+05"),
+ new ToStringTest("g6", -120000m, "-120000"),
+ new ToStringTest("g", -123456.1m, "-123456.1"),
+ new ToStringTest("g5", -123456.1m, "-1.2346e+05"),
+ new ToStringTest("g6", -123456.1m, "-123456"),
+ new ToStringTest("g", -1200000m, "-1200000"),
+ new ToStringTest("g", -123456.1m, "-123456.1"),
+ new ToStringTest("g", -123456.1m, "-123456.1"),
+ new ToStringTest("g", -1234567.1m, "-1234567.1"),
+ new ToStringTest("g", -12000000m, "-12000000"),
+ new ToStringTest("g", -12345678.1m, "-12345678.1"),
+ new ToStringTest("g", -12000000000000000000m, "-12000000000000000000"),
+ new ToStringTest("F", -123, "-123.00"),
+ new ToStringTest("F3", -123, "-123.000"),
+ new ToStringTest("F0", -123, "-123"),
+ new ToStringTest("E3", -123, "-1.230E+002"),
+ new ToStringTest("E0", -123, "-1E+002"),
+ new ToStringTest("E", -123, "-1.230000E+002"),
+ new ToStringTest("F3", Decimal.MinValue, "-79228162514264337593543950335.000"),
+ new ToStringTest("F", Decimal.MinValue, "-79228162514264337593543950335.00"),
+ new ToStringTest("F0", Decimal.MinValue, "-79228162514264337593543950335"),
+ new ToStringTest("E", Decimal.MinValue, "-7.922816E+028"),
+ new ToStringTest("E3", Decimal.MinValue, "-7.923E+028"),
+ new ToStringTest("E28", Decimal.MinValue, "-7.9228162514264337593543950335E+028"),
+ new ToStringTest("E30", Decimal.MinValue, "-7.922816251426433759354395033500E+028"),
+ new ToStringTest("E0", Decimal.MinValue, "-8E+028"),
+ new ToStringTest("N3", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.000"),
+ new ToStringTest("N0", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335"),
+ new ToStringTest("N", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.00"),
+ new ToStringTest("n3", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.000"),
+ new ToStringTest("n0", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335"),
+ new ToStringTest("n", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.00"),
+ new ToStringTest("C", 123456.7890m, NumberFormatInfo.InvariantInfo.CurrencySymbol + "123,456.79"),
+ new ToStringTest("C", -123456.7890m, "(" + NumberFormatInfo.InvariantInfo.CurrencySymbol + "123,456.79)"),
+ new ToStringTest("C3", 1123456.7890m, NumberFormatInfo.InvariantInfo.CurrencySymbol + "1,123,456.789"),
+ new ToStringTest("P", 123456.7891m, "12,345,678.91 %"),
+ new ToStringTest("P", -123456.7892m, "-12,345,678.92 %"),
+ new ToStringTest("P3", 1234.56789m, "123,456.789 %"),
+ };
+
+ NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
+
+ for (int i = 0; i < tab.Length; i++)
+ {
+ try
+ {
+ string s = tab[i].d.ToString(tab[i].format, nfi);
+ AssertEquals("A01 tab[" + i + "].format = '" + tab[i].format + "')", tab[i].str, s);
+ }
+ catch (OverflowException)
+ {
+ Fail(tab[i].d.ToString(tab[i].format, nfi) + " (format = '" + tab[i].format + "'): unexpected exception !");
+ }
+ catch (NUnit.Framework.AssertionException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ Fail ("Unexpected Exception when i = " + i + ". e = " + e);
+ }
+ }
+ }
+
+ public void TestCurrencyPattern()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
+ Decimal d = -1234567.8976m;
+ string[] ergCurrencyNegativePattern = new String[16] {
+ "(XYZ1234_5_67,898)", "-XYZ1234_5_67,898", "XYZ-1234_5_67,898", "XYZ1234_5_67,898-",
+ "(1234_5_67,898XYZ)", "-1234_5_67,898XYZ", "1234_5_67,898-XYZ", "1234_5_67,898XYZ-",
+ "-1234_5_67,898 XYZ", "-XYZ 1234_5_67,898", "1234_5_67,898 XYZ-", "XYZ 1234_5_67,898-",
+ "XYZ -1234_5_67,898", "1234_5_67,898- XYZ", "(XYZ 1234_5_67,898)", "(1234_5_67,898 XYZ)",
+ };
+
+ for (int i = 0; i < ergCurrencyNegativePattern.Length; i++)
+ {
+ nfi2.CurrencyNegativePattern = i;
+ if (d.ToString("C", nfi2) != ergCurrencyNegativePattern[i])
+ {
+ Fail("CurrencyNegativePattern #" + i + " failed: " +
+ d.ToString("C", nfi2) + " != " + ergCurrencyNegativePattern[i]);
+ }
+ }
+
+ d = 1234567.8976m;
+ string[] ergCurrencyPositivePattern = new String[4] {
+ "XYZ1234_5_67,898", "1234_5_67,898XYZ", "XYZ 1234_5_67,898", "1234_5_67,898 XYZ",
+ };
+
+ for (int i = 0; i < ergCurrencyPositivePattern.Length; i++)
+ {
+ nfi2.CurrencyPositivePattern = i;
+ if (d.ToString("C", nfi2) != ergCurrencyPositivePattern[i])
+ {
+ Fail("CurrencyPositivePattern #" + i + " failed: " +
+ d.ToString("C", nfi2) + " != " + ergCurrencyPositivePattern[i]);
+ }
+ }
+ }
+
+ public void TestNumberNegativePattern()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
+ Decimal d = -1234.89765m;
+ string[] ergNumberNegativePattern = new String[5] {
+ "(1__2__34##8977)", "-1__2__34##8977", "- 1__2__34##8977", "1__2__34##8977-", "1__2__34##8977 -",
+ };
+
+ for (int i = 0; i < ergNumberNegativePattern.Length; i++)
+ {
+ nfi2.NumberNegativePattern = i;
+ AssertEquals ("NumberNegativePattern #" + i, ergNumberNegativePattern[i], d.ToString("N", nfi2));
+ }
+ }
+
+ public void TestPercentPattern()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
+ Decimal d = -1234.8976m;
+ string[] ergPercentNegativePattern = new String[3] {
+ "-1~2~3~4~8~9;8 %%%", "-1~2~3~4~8~9;8%%%", "-%%%1~2~3~4~8~9;8"
+ };
+
+ for (int i = 0; i < ergPercentNegativePattern.Length; i++)
+ {
+ nfi2.PercentNegativePattern = i;
+ if (d.ToString("P", nfi2) != ergPercentNegativePattern[i])
+ {
+ Fail("PercentNegativePattern #" + i + " failed: " +
+ d.ToString("P", nfi2) + " != " + ergPercentNegativePattern[i]);
+ }
+ }
+
+ d = 1234.8976m;
+ string[] ergPercentPositivePattern = new String[3] {
+ "1~2~3~4~8~9;8 %%%", "1~2~3~4~8~9;8%%%", "%%%1~2~3~4~8~9;8"
+ };
+
+ for (int i = 0; i < ergPercentPositivePattern.Length; i++)
+ {
+ nfi2.PercentPositivePattern = i;
+ if (d.ToString("P", nfi2) != ergPercentPositivePattern[i])
+ {
+ Fail("PercentPositivePattern #" + i + " failed: " +
+ d.ToString("P", nfi2) + " != " + ergPercentPositivePattern[i]);
+ }
+ }
+ }
+
+ public void TestParse()
+ {
+ ParseTest[] tab = {
+ new ParseTest("1.2345", 1.2345m),
+ new ParseTest("-9876543210", -9876543210m),
+ new ParseTest(NumberFormatInfo.InvariantInfo.CurrencySymbol
+ + " ( 79,228,162,514,264,337,593,543,950,335.000 ) ", Decimal.MinValue, NumberStyles.Currency),
+ new ParseTest("1.234567890e-10", (Decimal)1.234567890e-10, NumberStyles.Float),
+ new ParseTest("1.234567890e-24", 1.2346e-24m, NumberStyles.Float),
+ new ParseTest(" 47896396.457983645462346E10 ", 478963964579836454.62346m, NumberStyles.Float),
+ new ParseTest("-7922816251426433759354395033.250000000000001", -7922816251426433759354395033.3m),
+ new ParseTest("-00000000000000795033.2500000000000000", -795033.25m),
+ new ParseTest("-000000000000001922816251426433759354395033.300000000000000", -1922816251426433759354395033.3m),
+ new ParseTest("-7922816251426433759354395033.150000000000", -7922816251426433759354395033.2m),
+ new ParseTest("-7922816251426433759354395033.2400000000000", -7922816251426433759354395033.2m),
+ new ParseTest("-7922816251426433759354395033.2600000000000", -7922816251426433759354395033.3m)
+ };
+
+ Decimal d;
+ for (int i = 0; i < tab.Length; i++)
+ {
+ try
+ {
+ d = Decimal.Parse(tab[i].str, tab[i].style, NumberFormatInfo.InvariantInfo);
+ if (tab[i].exceptionFlag)
+ {
+ Fail(tab[i].str + ": missing exception !");
+ }
+ else if (d != tab[i].d)
+ {
+ Fail(tab[i].str + " != " + d);
+ }
+ }
+ catch (OverflowException)
+ {
+ if (!tab[i].exceptionFlag)
+ {
+ Fail(tab[i].str + ": unexpected exception !");
+ }
+ }
+ }
+
+ try
+ {
+ d = Decimal.Parse(null);
+ Fail("Expected ArgumentNullException");
+ }
+ catch (ArgumentNullException)
+ {
+ //ok
+ }
+
+ try
+ {
+ d = Decimal.Parse("123nx");
+ Fail("Expected FormatException");
+ }
+ catch (FormatException)
+ {
+ //ok
+ }
+
+ try
+ {
+ d = Decimal.Parse("79228162514264337593543950336");
+ Fail("Expected OverflowException" + d);
+ }
+ catch (OverflowException)
+ {
+ //ok
+ }
+ }
+
+ public void TestConstants()
+ {
+ AssertEquals ("Zero", 0m, Decimal.Zero);
+ AssertEquals ("One", 1m, Decimal.One);
+ AssertEquals ("MinusOne", -1m, Decimal.MinusOne);
+ AssertEquals ("MaxValue", 79228162514264337593543950335m, Decimal.MaxValue);
+ AssertEquals ("MinValue", -79228162514264337593543950335m, Decimal.MinValue);
+ Assert ("MinusOne 2", -1m == Decimal.MinusOne);
+ }
+
+ public void TestConstructInt32()
+ {
+ decimal[] dtab = {0m, 1m, -1m, 123456m, -1234567m};
+ int[] itab = {0, 1, -1, 123456, -1234567};
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("Int32 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ int n = (int) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> Int32: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new Decimal(Int32.MaxValue);
+ Assert((int)d == Int32.MaxValue);
+
+ d = new Decimal(Int32.MinValue);
+ Assert((int)d == Int32.MinValue);
+ }
+
+ public void TestConstructUInt32()
+ {
+ decimal[] dtab = {0m, 1m, 123456m, 123456789m};
+ uint[] itab = {0, 1, 123456, 123456789};
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("UInt32 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ uint n = (uint) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> UInt32: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new Decimal(UInt32.MaxValue);
+ Assert((uint)d == UInt32.MaxValue);
+
+ d = new Decimal(UInt32.MinValue);
+ Assert((uint)d == UInt32.MinValue);
+ }
+
+ public void TestConstructInt64()
+ {
+ decimal[] dtab = {0m, 1m, -1m, 9876543m, -9876543210m, 12345678987654321m};
+ long[] itab = {0, 1, -1, 9876543, -9876543210L, 12345678987654321L};
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("Int64 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ long n = (long) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> Int64: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new Decimal(Int64.MaxValue);
+ Assert((long)d == Int64.MaxValue);
+
+ d = new Decimal(Int64.MinValue);
+ Assert((long)d == Int64.MinValue);
+ }
+
+ public void TestConstructUInt64()
+ {
+ decimal[] dtab = {0m, 1m, 987654321m, 123456789876543210m};
+ ulong[] itab = {0, 1, 987654321, 123456789876543210L};
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("UInt64 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ ulong n = (ulong) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> UInt64: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new Decimal(UInt64.MaxValue);
+ Assert((ulong)d == UInt64.MaxValue);
+
+ d = new Decimal(UInt64.MinValue);
+ Assert((ulong)d == UInt64.MinValue);
+ }
+
+ public void TestConstructSingle()
+ {
+ Decimal d;
+
+ d = new Decimal(-1.2345678f);
+ AssertEquals("A#01", -1.234568m, (decimal)d);
+
+ d=3;
+ AssertEquals("A#02", 3.0f, (float)d);
+
+ d = new Decimal(0.0f);
+ AssertEquals("A#03", 0m, (decimal)d);
+ AssertEquals("A#04", 0.0f, (float)d);
+
+ d = new Decimal(1.0f);
+ AssertEquals("A#05", 1m, (decimal)d);
+ AssertEquals("A#06", 1.0f, (float)d);
+
+ d = new Decimal(-1.2345678f);
+ AssertEquals("A#07", -1.234568m, (decimal)d);
+ AssertEquals("A#08", -1.234568f, (float)d);
+
+ d = new Decimal(1.2345673f);
+ AssertEquals("A#09", 1.234567m, (decimal)d);
+
+ d = new Decimal(1.2345673e7f);
+ AssertEquals("A#10", 12345670m, (decimal)d);
+
+ d = new Decimal(1.2345673e-17f);
+ AssertEquals("A#11", 0.00000000000000001234567m, (decimal)d);
+ AssertEquals("A#12", 1.234567e-17f, (float)d);
+
+ // test exceptions
+ try
+ {
+ d = new Decimal(Single.MaxValue);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new Decimal(Single.NaN);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new Decimal(Single.PositiveInfinity);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+ }
+
+ public void TestConstructSingleRounding()
+ {
+ decimal d;
+
+ d = new Decimal(1765.2356f);
+ Assert(d == 1765.236m);
+
+ d = new Decimal(1765.23554f);
+ Assert("failed banker's rule rounding test 1", d == 1765.236m);
+
+ d = new Decimal(1765.2354f);
+ Assert(d == 1765.235m);
+
+ d = new Decimal(1765.2346f);
+ Assert(d == 1765.235m);
+
+ d = new Decimal(1765.23454f);
+ Assert("failed banker's rule rounding test 2", d == 1765.234m);
+
+ d = new Decimal(1765.2344f);
+ Assert(d == 1765.234m);
+
+ d = new Decimal(0.00017652356f);
+ Assert(d == 0.0001765236m);
+
+ d = new Decimal(0.000176523554f);
+ Assert("failed banker's rule rounding test 3", d == 0.0001765236m);
+
+ d = new Decimal(0.00017652354f);
+ Assert(d == 0.0001765235m);
+
+ d = new Decimal(0.00017652346f);
+ Assert(d == 0.0001765235m);
+
+ d = new Decimal(0.000176523454f);
+ Assert("failed banker's rule rounding test 4", d == 0.0001765234m);
+
+ d = new Decimal(0.00017652344f);
+ Assert(d == 0.0001765234m);
+
+ d = new Decimal(3.7652356e10f);
+ Assert(d == 37652360000m);
+
+ d = new Decimal(3.7652356e20f);
+ Assert(d == 376523600000000000000m);
+
+ d = new Decimal(3.76523554e20f);
+ Assert("failed banker's rule rounding test 5", d == 376523600000000000000m);
+
+ d = new Decimal(3.7652352e20f);
+ Assert(d == 376523500000000000000m);
+
+ d = new Decimal(3.7652348e20f);
+ Assert(d == 376523500000000000000m);
+
+ d = new Decimal(3.76523454e20f);
+ Assert("failed banker's rule rounding test 6", d == 376523400000000000000m);
+
+ d = new Decimal(3.7652342e20f);
+ Assert(d == 376523400000000000000m);
+ }
+
+ public void TestConstructDouble()
+ {
+ Decimal d;
+
+ d = new Decimal(0.0);
+ Assert((decimal)d == 0m);
+
+ d = new Decimal(1.0);
+ Assert((decimal)d == 1m);
+ Assert(1.0 == (double)d);
+
+ d = new Decimal(-1.2345678901234);
+ Assert((decimal)d == -1.2345678901234m);
+ Assert(-1.2345678901234 == (double)d);
+
+ d = new Decimal(1.2345678901234);
+ Assert((decimal)d == 1.2345678901234m);
+
+ d = new Decimal(1.2345678901234e8);
+ Assert((decimal)d == 123456789.01234m);
+ Assert(1.2345678901234e8 == (double)d);
+
+ d = new Decimal(1.2345678901234e16);
+ Assert((decimal)d == 12345678901234000m);
+ Assert(1.2345678901234e16 == (double)d);
+
+ d = new Decimal(1.2345678901234e24);
+ Assert((decimal)d == 1234567890123400000000000m);
+ Assert(1.2345678901234e24 == (double)d);
+
+ d = new Decimal(1.2345678901234e28);
+ Assert((decimal)d == 1.2345678901234e28m);
+ Assert(1.2345678901234e28 == (double)d);
+
+ d = new Decimal(7.2345678901234e28);
+ Assert((decimal)d == 7.2345678901234e28m);
+ Assert(new Decimal((double)d) == d);
+
+ d = new Decimal(1.2345678901234e-8);
+ Assert((decimal)d == 1.2345678901234e-8m);
+
+ d = new Decimal(1.2345678901234e-14);
+ Assert((decimal)d == 1.2345678901234e-14m);
+ Assert(1.2345678901234e-14 == (double)d);
+
+ d = new Decimal(1.2342278901234e-25);
+ Assert((decimal)d == 1.234e-25m);
+
+ // test exceptions
+ try
+ {
+ d = new Decimal(8e28);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new Decimal(8e48);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new Decimal(Double.NaN);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new Decimal(Double.PositiveInfinity);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+ }
+
+ public void TestConstructDoubleRound()
+ {
+ decimal d;
+ int TestNum = 1;
+
+ try {
+ d = new Decimal(1765.231234567857);
+ AssertEquals("A01", 1765.23123456786m, d);
+
+ TestNum++;
+ d = new Decimal(1765.2312345678554);
+ AssertEquals("A02, failed banker's rule rounding test 1", 1765.23123456786m, d);
+ AssertEquals("A03", 1765.23123456786, (double)d);
+
+ TestNum++;
+ d = new Decimal(1765.231234567853);
+ Assert(d == 1765.23123456785m);
+
+ TestNum++;
+ d = new Decimal(1765.231234567847);
+ Assert(d == 1765.23123456785m);
+
+ TestNum++;
+ d = new Decimal(1765.231234567843);
+ Assert(d == 1765.23123456784m);
+
+ TestNum++;
+ d = new Decimal(1.765231234567857e-9);
+ Assert(d == 1.76523123456786e-9m);
+
+ TestNum++;
+ d = new Decimal(1.7652312345678554e-9);
+ Assert("failed banker's rule rounding test 3", d == 1.76523123456786e-9m);
+
+ TestNum++;
+ d = new Decimal(1.765231234567853e-9);
+ Assert(d == 1.76523123456785e-9m);
+
+ TestNum++;
+ d = new Decimal(1.765231234567857e+24);
+ Assert(d == 1.76523123456786e+24m);
+
+ TestNum++;
+ d = new Decimal(1.7652312345678554e+24);
+ Assert("failed banker's rule rounding test 4", d == 1.76523123456786e+24m);
+
+ TestNum++;
+ d = new Decimal(1.765231234567853e+24);
+ Assert(d == 1.76523123456785e+24m);
+
+ TestNum++;
+ d = new Decimal(1765.2312345678454);
+ Assert(d == 1765.23123456785m);
+ }
+ catch (Exception e) {
+ Fail("At TestNum = " + TestNum + " unexpected exception. e = " + e);
+ }
+ }
+
+ public void TestNegate()
+ {
+ decimal d;
+
+ d = new Decimal(12345678);
+ Assert((decimal)Decimal.Negate(d) == -12345678m);
+ }
+
+ public void TestPartConstruct()
+ {
+ decimal d;
+
+ d = new Decimal(parts0);
+ Assert(d == 0);
+
+ d = new Decimal(parts1);
+ Assert(d == 1);
+
+ d = new Decimal(parts2);
+ Assert(d == 4294967296m);
+
+ d = new Decimal(parts3);
+ Assert(d == 18446744073709551616m);
+
+ d = new Decimal(parts4);
+ Assert(d == 0m);
+
+ d = new Decimal(parts5);
+ Assert(d == 18446744078004518913m);
+
+ d = new Decimal(partsMaxValue);
+ Assert(d == Decimal.MaxValue);
+
+ d = new Decimal(partsMinValue);
+ Assert(d == Decimal.MinValue);
+
+ d = new Decimal(parts6);
+ int[] erg = Decimal.GetBits(d);
+ for (int i = 0; i < 4; i++)
+ {
+ Assert(erg[i] == parts6[i]);
+ }
+ }
+
+ public void TestFloorTruncate()
+ {
+ decimal[,] dtab = {
+ {0m, 0m, 0m}, {1m, 1m, 1m}, {-1m, -1m, -1m}, {1.1m, 1m, 1m},
+ {-1.000000000001m, -2m, -1m}, {12345.67890m,12345m,12345m},
+ {-123456789012345.67890m, -123456789012346m, -123456789012345m},
+ {Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue},
+ {Decimal.MinValue, Decimal.MinValue, Decimal.MinValue},
+ {6.999999999m, 6m, 6m}, {-6.999999999m, -7m, -6m},
+ {0.00001m, 0m, 0m}, {-0.00001m, -1m, 0m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = Decimal.Floor(dtab[i,0]);
+ if (d != dtab[i,1])
+ {
+ Fail("Floor: Floor(" + dtab[i,0] + ") != " + d);
+ }
+ d = Decimal.Truncate(dtab[i,0]);
+ if (d != dtab[i,2])
+ {
+ Fail("Truncate: Truncate(" + dtab[i,0] + ") != " + d);
+ }
+ }
+ }
+
+ public void TestRound()
+ {
+ decimal[,] dtab = {
+ {1m, 0, 1m}, {1.234567890m, 1, 1.2m},
+ {1.234567890m, 2, 1.23m}, {1.23450000001m, 3, 1.235m},
+ {1.2345m, 3, 1.234m}, {1.2355m, 3, 1.236m},
+ {1.234567890m, 4, 1.2346m}, {1.23567890m, 2, 1.24m},
+ {47893764694.4578563236436621m, 7, 47893764694.4578563m},
+ {-47893764694.4578563236436621m, 9, -47893764694.457856324m},
+ {-47893764694.4578m, 5, -47893764694.4578m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = Decimal.Round(dtab[i,0], (int)dtab[i,1]);
+ if (d != dtab[i,2])
+ {
+ Fail("Round: Round(" + dtab[i,0] + "," + (int)dtab[i,1] + ") != " + d);
+ }
+ }
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System/DecimalTest2.cs b/mcs/class/corlib/Test/System/DecimalTest2.cs
new file mode 100644
index 00000000000..29657de96c5
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DecimalTest2.cs
@@ -0,0 +1,3125 @@
+// DecimalTest.cs - NUnit Test Cases for the System.Decimal struct
+//
+// Author: Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, 2001
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace MonoTests.System
+{
+
+ public enum TestResultInfo
+ {
+ Ok = 0,
+ Overflow = 1,
+ ReverseRound = 2,
+ DivideByZero = 3,
+ ReverseOverflow = 4
+ }
+
+ public struct TestResult
+ {
+ public TestResult(int i, decimal v)
+ {
+ info = (TestResultInfo) i;
+ val = v;
+ }
+
+ public TestResultInfo info;
+ public decimal val;
+ }
+
+
+ /// <summary>
+ /// Tests for System.Decimal
+ /// </summary>
+ public class DecimalTest2 : TestCase
+ {
+ public DecimalTest2() {}
+
+ private void ReportOpError(string msg, int i, int j, decimal d1, decimal d2, decimal d3, decimal d3b)
+ {
+ decimal delta = 0;
+ try {
+ delta = d3 - d3b;
+ } catch (Exception e) {
+ Fail("ReportOpError: Unexpected exception on " + d3 + " - " + d3b + ". e:" + e);
+ }
+ Fail ("*** " + msg + " for d1=" + d1 + " i=" + i + " d2=" + d2 + " j=" + j + " d3=" + d3 + " d3b=" + d3b + "\n"
+ + "Ist:" + d3 + " Soll:" + d3b + " delta=" + (delta) + " == " + (d3 == d3b));
+ }
+
+ public void TestCompare()
+ {
+ const int size = 14;
+ decimal[] data = new decimal[size] {
+ 0m, 1m, -1m, 2m, 10m, 0.1m, 0.11m,
+ 79228162514264337593543950335m,
+ -79228162514264337593543950335m,
+ 27703302467091960609331879.532m,
+ -3203854.9559968181492513385018m,
+ -3203854.9559968181492513385017m,
+ -48466870444188873796420.0286m,
+ -48466870444188873796420.02860m
+ };
+
+ short[,] cmpTable = new short[size,size] {
+ {0,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,1},
+ {1,0,1,-1,-1,1,1,-1,1,-1,1,1,1,1},
+ {-1,-1,0,-1,-1,-1,-1,-1,1,-1,1,1,1,1},
+ {1,1,1,0,-1,1,1,-1,1,-1,1,1,1,1},
+ {1,1,1,1,0,1,1,-1,1,-1,1,1,1,1},
+ {1,-1,1,-1,-1,0,-1,-1,1,-1,1,1,1,1},
+ {1,-1,1,-1,-1,1,0,-1,1,-1,1,1,1,1},
+ {1,1,1,1,1,1,1,0,1,1,1,1,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1},
+ {1,1,1,1,1,1,1,-1,1,0,1,1,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,0,-1,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,0,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,0,0},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,0,0}
+ };
+
+ for (int i = 0; i < size; i++)
+ {
+ Decimal d1 = data[i];
+ for (int j = 0; j < size; j++)
+ {
+ Assert(cmpTable[i,j] == -cmpTable[j,i]);
+ int x = cmpTable[i,j];
+ Decimal d2 = data[j];
+
+ int y = Decimal.Compare(d1, d2);
+ if (y < 0) y = -1;
+ else if (y > 0) y = 1;
+ Assert(x == y);
+
+ y = d1.CompareTo(d2);
+ if (y < 0) y = -1;
+ else if (y > 0) y = 1;
+ Assert(x == y);
+
+ bool b = d1 < d2;
+ if (x != -1) b = !b;
+ Assert(b);
+
+ b = d1 <= d2;
+ if (x == 1) b = !b;
+ Assert(b);
+
+ b = d1 >= d2;
+ if (x == -1) b = !b;
+ Assert(b);
+
+ b = d1 > d2;
+ if (x != 1) b = !b;
+ Assert(b);
+
+ b = d1 == d2;
+ if (x != 0) b = !b;
+ Assert(b);
+
+ b = d1.Equals(d2);
+ if (x != 0) b = !b;
+ Assert(b);
+
+ b = Decimal.Equals(d1, d2);
+ if (x != 0) b = !b;
+ Assert(b);
+ }
+ }
+ }
+
+ public void TestRemainder()
+ {
+ Assert((decimal)Decimal.Remainder(3.6m, 1.3m) == 1.0m);
+ Assert((decimal)Decimal.Remainder(79228162514264337593543950335m ,
+ 27703302467091960609331879.53200m) == 24420760848422211464106753m);
+
+ Assert((decimal)Decimal.Remainder(45937986975432m, 43987453m)
+ == 42334506m);
+ Assert((decimal)Decimal.Remainder(45937986975000m, 5000m)
+ == 0m);
+ Assert((decimal)Decimal.Remainder(-54789548973.6234m, 1.3356m)
+ == -0.1074m);
+ }
+
+ public void TestAdd()
+ {
+ decimal[] args = auto_build2;
+ TestResult[] trs = trAuto_Add_build2;
+ int errOverflow = 0;
+ int errOp = 0;
+ int count = args.GetLength(0);
+ int n = 0;
+ for (int i = 0; i < count; i++)
+ {
+ decimal d1 = args[i];
+ for (int j = 0; j < count; j++, n++)
+ {
+ decimal d2 = args[j];
+ decimal d3 = 0;
+ decimal d4 = 0;
+ TestResult tr = trs[n];
+ try
+ {
+ d3 = Decimal.Add(d1, d2);
+ if (d3 != tr.val)
+ {
+ if (tr.info == TestResultInfo.Overflow)
+ {
+ ReportOpError("Add: expected overflow", i, j, d1, d2, d3, tr.val);
+ errOverflow++;
+ }
+ else
+ {
+ ReportOpError("Add: result mismatch", i, j, d1, d2, d3, tr.val);
+ errOp++;
+ }
+ }
+ else if (tr.info == TestResultInfo.Ok)
+ {
+ d4 = Decimal.Subtract(d3, d2);
+ if (d4 != d1)
+ {
+ ReportOpError("Subtract: result mismatch", i, j, d3, d2, d4, d1);
+ errOp++;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.Overflow)
+ {
+ ReportOpError("Add: unexpected overflow", i, j, d1, d2, d3, 0);
+ errOverflow++;
+ }
+ }
+ }
+ }
+
+ if (errOverflow + errOp > 0)
+ {
+ Fail("" + errOp + " wrong additions, " + errOverflow + " wrong overflows");
+ }
+ }
+
+ public void TestMult()
+ {
+ decimal[] args = auto_build2;
+ TestResult[] trs = trAuto_Mult_build2;
+ int errOverflow = 0;
+ int errOp = 0;
+ int count = args.GetLength(0);
+ int n = 0;
+ for (int i = 0; i < count; i++)
+ {
+ decimal d1 = args[i];
+ for (int j = 0; j < count; j++, n++)
+ {
+ decimal d2 = args[j];
+ decimal d3 = 0;
+ decimal d4 = 0;
+ TestResult tr = trs[n];
+ try
+ {
+ d3 = Decimal.Multiply(d1, d2);
+ if (d3 != tr.val)
+ {
+ if (tr.info == TestResultInfo.Overflow)
+ {
+ ReportOpError("Mult: expected overflow", i, j, d1, d2, d3, tr.val);
+ errOverflow++;
+ }
+ else
+ {
+ ReportOpError("Mult: result mismatch", i, j, d1, d2, d3, tr.val);
+ errOp++;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.Overflow)
+ {
+ ReportOpError("Mult: unexpected overflow", i, j, d1, d2, d3, 0);
+ errOverflow++;
+ }
+ }
+
+ if (d2 != 0 && tr.info != TestResultInfo.Overflow)
+ {
+ try
+ {
+ d4 = Decimal.Divide(d3, d2);
+ if (d4 != d1 && tr.info != TestResultInfo.ReverseRound)
+ {
+ ReportOpError("MultDiv: result mismatch", i, j, d3, d2, d4, d1);
+ errOp++;
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.ReverseOverflow)
+ {
+ ReportOpError("MultDiv: unexpected overflow", i, j, d3, d2, d4, d1);
+ errOverflow++;
+ }
+ }
+ }
+
+ }
+ }
+
+ if (errOverflow + errOp > 0)
+ {
+ Fail("" + errOp + " wrong multiplications, " + errOverflow + " wrong overflows");
+ }
+ }
+
+ public void TestDiv()
+ {
+ decimal[] args = auto_build2;
+ TestResult[] trs = trAuto_Div_build2;
+ int errOverflow = 0;
+ int errDivideByZero = 0;
+ int errOp = 0;
+ int count = args.GetLength(0);
+ int n = 0;
+ for (int i = 0; i < count; i++)
+ {
+ decimal d1 = args[i];
+ for (int j = 0; j < count; j++, n++)
+ {
+ decimal d2 = args[j];
+ decimal d3 = 0;
+ decimal d4 = 0;
+ TestResult tr = trs[n];
+ try
+ {
+ d3 = Decimal.Divide(d1, d2);
+ if (d3 != tr.val)
+ {
+ if (tr.info == TestResultInfo.Overflow)
+ {
+ ReportOpError("Div: expected overflow", i, j, d1, d2, d3, tr.val);
+ errOverflow++;
+ }
+ else if (tr.info == TestResultInfo.DivideByZero)
+ {
+ ReportOpError("Div: expected divide by zero", i, j, d1, d2, d3, tr.val);
+ errDivideByZero++;
+ }
+ else
+ {
+ ReportOpError("Div: result mismatch", i, j, d1, d2, d3, tr.val);
+ errOp++;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.Overflow)
+ {
+ ReportOpError("Div: unexpected overflow", i, j, d1, d2, d3, 0);
+ errOverflow++;
+ }
+ }
+ catch (DivideByZeroException)
+ {
+ if (tr.info != TestResultInfo.DivideByZero)
+ {
+ ReportOpError("Div: unexpected divide by zero", i, j, d1, d2, d3, 0);
+ errDivideByZero++;
+ }
+ }
+
+ if (d3 != 0)
+ {
+ try
+ {
+ d4 = Decimal.Multiply(d3, d2);
+ if (d4 != d1 && tr.info != TestResultInfo.ReverseRound)
+ {
+ ReportOpError("DivMult: result mismatch", i, j, d3, d2, d4, d1);
+ errOp++;
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.ReverseOverflow)
+ {
+ ReportOpError("DivMult: unexpected overflow", i, j, d3, d2, d4, d1);
+ errOverflow++;
+ }
+ }
+ }
+ }
+ }
+
+ if (errOverflow + errOp > 0)
+ {
+ Fail("" + errOp + " wrong division, " + errOverflow + " wrong overflows, " + errDivideByZero + " wrong divide by zero, ");
+ }
+ }
+
+ #region Data
+
+
+ // generated argument list build2
+ decimal[] auto_build2 = new decimal[] {
+ 0m, // 0
+ 1m, // 1
+ -1m, // 2
+ 2m, // 3
+ 10m, // 4
+ 0.1m, // 5
+ 79228162514264337593543950335m, // 6
+ -79228162514264337593543950335m, // 7
+ 27703302467091960609331879.532m, // 8
+ -3203854.9559968181492513385018m, // 9
+ -48466870444188873796420.028868m, // 10
+ -545193693242804794.30331374676m, // 11
+ 0.7629234053338741809892531431m, // 12
+ -400453059665371395972.33474452m, // 13
+ 222851627785191714190050.61676m, // 14
+ 14246043379204153213661335.584m, // 15
+ -421123.30446308691436596648186m, // 16
+ 24463288738299545.200508898642m, // 17
+ -5323259153836385912697776.001m, // 18
+ 102801066199805834724673169.19m, // 19
+ 7081320760.3793287174700927968m, // 20
+ 415752273939.77704245656837041m, // 21
+ -6389392489892.6362673670820462m, // 22
+ 442346282742915.0596416330681m, // 23
+ -512833780867323.89020837443764m, // 24
+ 608940580690915704.1450897514m, // 25
+ -42535053313319986966115.037787m, // 26
+ -7808274522591953107485.8812311m, // 27
+ 1037807626804273037330059471.7m, // 28
+ -4997122966.448652425771563042m, // 29
+ };
+
+
+ // generated result list build2
+ TestResult[] trAuto_Add_build2 = new TestResult[] {
+ new TestResult(0, 0m), // 0 + 0
+ new TestResult(0, 1m), // 0 + 1
+ new TestResult(0, -1m), // 0 + 2
+ new TestResult(0, 2m), // 0 + 3
+ new TestResult(0, 10m), // 0 + 4
+ new TestResult(0, 0.1m), // 0 + 5
+ new TestResult(0, 79228162514264337593543950335m), // 0 + 6
+ new TestResult(0, -79228162514264337593543950335m), // 0 + 7
+ new TestResult(0, 27703302467091960609331879.532m), // 0 + 8
+ new TestResult(0, -3203854.9559968181492513385018m), // 0 + 9
+ new TestResult(0, -48466870444188873796420.028868m), // 0 + 10
+ new TestResult(0, -545193693242804794.30331374676m), // 0 + 11
+ new TestResult(0, 0.7629234053338741809892531431m), // 0 + 12
+ new TestResult(0, -400453059665371395972.33474452m), // 0 + 13
+ new TestResult(0, 222851627785191714190050.61676m), // 0 + 14
+ new TestResult(0, 14246043379204153213661335.584m), // 0 + 15
+ new TestResult(0, -421123.30446308691436596648186m), // 0 + 16
+ new TestResult(0, 24463288738299545.200508898642m), // 0 + 17
+ new TestResult(0, -5323259153836385912697776.001m), // 0 + 18
+ new TestResult(0, 102801066199805834724673169.19m), // 0 + 19
+ new TestResult(0, 7081320760.3793287174700927968m), // 0 + 20
+ new TestResult(0, 415752273939.77704245656837041m), // 0 + 21
+ new TestResult(0, -6389392489892.6362673670820462m), // 0 + 22
+ new TestResult(0, 442346282742915.0596416330681m), // 0 + 23
+ new TestResult(0, -512833780867323.89020837443764m), // 0 + 24
+ new TestResult(0, 608940580690915704.1450897514m), // 0 + 25
+ new TestResult(0, -42535053313319986966115.037787m), // 0 + 26
+ new TestResult(0, -7808274522591953107485.8812311m), // 0 + 27
+ new TestResult(0, 1037807626804273037330059471.7m), // 0 + 28
+ new TestResult(0, -4997122966.448652425771563042m), // 0 + 29
+ new TestResult(0, 1m), // 1 + 0
+ new TestResult(0, 2m), // 1 + 1
+ new TestResult(0, 0m), // 1 + 2
+ new TestResult(0, 3m), // 1 + 3
+ new TestResult(0, 11m), // 1 + 4
+ new TestResult(0, 1.1m), // 1 + 5
+ new TestResult(1, 0m), // 1 + 6
+ new TestResult(0, -79228162514264337593543950334m), // 1 + 7
+ new TestResult(0, 27703302467091960609331880.532m), // 1 + 8
+ new TestResult(0, -3203853.9559968181492513385018m), // 1 + 9
+ new TestResult(0, -48466870444188873796419.028868m), // 1 + 10
+ new TestResult(0, -545193693242804793.30331374676m), // 1 + 11
+ new TestResult(0, 1.7629234053338741809892531431m), // 1 + 12
+ new TestResult(0, -400453059665371395971.33474452m), // 1 + 13
+ new TestResult(0, 222851627785191714190051.61676m), // 1 + 14
+ new TestResult(0, 14246043379204153213661336.584m), // 1 + 15
+ new TestResult(0, -421122.30446308691436596648186m), // 1 + 16
+ new TestResult(0, 24463288738299546.200508898642m), // 1 + 17
+ new TestResult(0, -5323259153836385912697775.001m), // 1 + 18
+ new TestResult(0, 102801066199805834724673170.19m), // 1 + 19
+ new TestResult(0, 7081320761.3793287174700927968m), // 1 + 20
+ new TestResult(0, 415752273940.77704245656837041m), // 1 + 21
+ new TestResult(0, -6389392489891.6362673670820462m), // 1 + 22
+ new TestResult(0, 442346282742916.0596416330681m), // 1 + 23
+ new TestResult(0, -512833780867322.89020837443764m), // 1 + 24
+ new TestResult(0, 608940580690915705.1450897514m), // 1 + 25
+ new TestResult(0, -42535053313319986966114.037787m), // 1 + 26
+ new TestResult(0, -7808274522591953107484.8812311m), // 1 + 27
+ new TestResult(0, 1037807626804273037330059472.7m), // 1 + 28
+ new TestResult(0, -4997122965.448652425771563042m), // 1 + 29
+ new TestResult(0, -1m), // 2 + 0
+ new TestResult(0, 0m), // 2 + 1
+ new TestResult(0, -2m), // 2 + 2
+ new TestResult(0, 1m), // 2 + 3
+ new TestResult(0, 9m), // 2 + 4
+ new TestResult(0, -0.9m), // 2 + 5
+ new TestResult(0, 79228162514264337593543950334m), // 2 + 6
+ new TestResult(1, 0m), // 2 + 7
+ new TestResult(0, 27703302467091960609331878.532m), // 2 + 8
+ new TestResult(0, -3203855.9559968181492513385018m), // 2 + 9
+ new TestResult(0, -48466870444188873796421.028868m), // 2 + 10
+ new TestResult(0, -545193693242804795.30331374676m), // 2 + 11
+ new TestResult(0, -0.2370765946661258190107468569m), // 2 + 12
+ new TestResult(0, -400453059665371395973.33474452m), // 2 + 13
+ new TestResult(0, 222851627785191714190049.61676m), // 2 + 14
+ new TestResult(0, 14246043379204153213661334.584m), // 2 + 15
+ new TestResult(0, -421124.30446308691436596648186m), // 2 + 16
+ new TestResult(0, 24463288738299544.200508898642m), // 2 + 17
+ new TestResult(0, -5323259153836385912697777.001m), // 2 + 18
+ new TestResult(0, 102801066199805834724673168.19m), // 2 + 19
+ new TestResult(0, 7081320759.3793287174700927968m), // 2 + 20
+ new TestResult(0, 415752273938.77704245656837041m), // 2 + 21
+ new TestResult(0, -6389392489893.6362673670820462m), // 2 + 22
+ new TestResult(0, 442346282742914.0596416330681m), // 2 + 23
+ new TestResult(0, -512833780867324.89020837443764m), // 2 + 24
+ new TestResult(0, 608940580690915703.1450897514m), // 2 + 25
+ new TestResult(0, -42535053313319986966116.037787m), // 2 + 26
+ new TestResult(0, -7808274522591953107486.8812311m), // 2 + 27
+ new TestResult(0, 1037807626804273037330059470.7m), // 2 + 28
+ new TestResult(0, -4997122967.448652425771563042m), // 2 + 29
+ new TestResult(0, 2m), // 3 + 0
+ new TestResult(0, 3m), // 3 + 1
+ new TestResult(0, 1m), // 3 + 2
+ new TestResult(0, 4m), // 3 + 3
+ new TestResult(0, 12m), // 3 + 4
+ new TestResult(0, 2.1m), // 3 + 5
+ new TestResult(1, 0m), // 3 + 6
+ new TestResult(0, -79228162514264337593543950333m), // 3 + 7
+ new TestResult(0, 27703302467091960609331881.532m), // 3 + 8
+ new TestResult(0, -3203852.9559968181492513385018m), // 3 + 9
+ new TestResult(0, -48466870444188873796418.028868m), // 3 + 10
+ new TestResult(0, -545193693242804792.30331374676m), // 3 + 11
+ new TestResult(0, 2.7629234053338741809892531431m), // 3 + 12
+ new TestResult(0, -400453059665371395970.33474452m), // 3 + 13
+ new TestResult(0, 222851627785191714190052.61676m), // 3 + 14
+ new TestResult(0, 14246043379204153213661337.584m), // 3 + 15
+ new TestResult(0, -421121.30446308691436596648186m), // 3 + 16
+ new TestResult(0, 24463288738299547.200508898642m), // 3 + 17
+ new TestResult(0, -5323259153836385912697774.001m), // 3 + 18
+ new TestResult(0, 102801066199805834724673171.19m), // 3 + 19
+ new TestResult(0, 7081320762.3793287174700927968m), // 3 + 20
+ new TestResult(0, 415752273941.77704245656837041m), // 3 + 21
+ new TestResult(0, -6389392489890.6362673670820462m), // 3 + 22
+ new TestResult(0, 442346282742917.0596416330681m), // 3 + 23
+ new TestResult(0, -512833780867321.89020837443764m), // 3 + 24
+ new TestResult(0, 608940580690915706.1450897514m), // 3 + 25
+ new TestResult(0, -42535053313319986966113.037787m), // 3 + 26
+ new TestResult(0, -7808274522591953107483.8812311m), // 3 + 27
+ new TestResult(0, 1037807626804273037330059473.7m), // 3 + 28
+ new TestResult(0, -4997122964.448652425771563042m), // 3 + 29
+ new TestResult(0, 10m), // 4 + 0
+ new TestResult(0, 11m), // 4 + 1
+ new TestResult(0, 9m), // 4 + 2
+ new TestResult(0, 12m), // 4 + 3
+ new TestResult(0, 20m), // 4 + 4
+ new TestResult(0, 10.1m), // 4 + 5
+ new TestResult(1, 0m), // 4 + 6
+ new TestResult(0, -79228162514264337593543950325m), // 4 + 7
+ new TestResult(0, 27703302467091960609331889.532m), // 4 + 8
+ new TestResult(0, -3203844.9559968181492513385018m), // 4 + 9
+ new TestResult(0, -48466870444188873796410.028868m), // 4 + 10
+ new TestResult(0, -545193693242804784.30331374676m), // 4 + 11
+ new TestResult(0, 10.762923405333874180989253143m), // 4 + 12
+ new TestResult(0, -400453059665371395962.33474452m), // 4 + 13
+ new TestResult(0, 222851627785191714190060.61676m), // 4 + 14
+ new TestResult(0, 14246043379204153213661345.584m), // 4 + 15
+ new TestResult(0, -421113.30446308691436596648186m), // 4 + 16
+ new TestResult(0, 24463288738299555.200508898642m), // 4 + 17
+ new TestResult(0, -5323259153836385912697766.001m), // 4 + 18
+ new TestResult(0, 102801066199805834724673179.19m), // 4 + 19
+ new TestResult(0, 7081320770.3793287174700927968m), // 4 + 20
+ new TestResult(0, 415752273949.77704245656837041m), // 4 + 21
+ new TestResult(0, -6389392489882.6362673670820462m), // 4 + 22
+ new TestResult(0, 442346282742925.0596416330681m), // 4 + 23
+ new TestResult(0, -512833780867313.89020837443764m), // 4 + 24
+ new TestResult(0, 608940580690915714.1450897514m), // 4 + 25
+ new TestResult(0, -42535053313319986966105.037787m), // 4 + 26
+ new TestResult(0, -7808274522591953107475.8812311m), // 4 + 27
+ new TestResult(0, 1037807626804273037330059481.7m), // 4 + 28
+ new TestResult(0, -4997122956.448652425771563042m), // 4 + 29
+ new TestResult(0, 0.1m), // 5 + 0
+ new TestResult(0, 1.1m), // 5 + 1
+ new TestResult(0, -0.9m), // 5 + 2
+ new TestResult(0, 2.1m), // 5 + 3
+ new TestResult(0, 10.1m), // 5 + 4
+ new TestResult(0, 0.2m), // 5 + 5
+ new TestResult(2, 79228162514264337593543950335m), // 5 + 6
+ new TestResult(2, -79228162514264337593543950335m), // 5 + 7
+ new TestResult(0, 27703302467091960609331879.632m), // 5 + 8
+ new TestResult(0, -3203854.8559968181492513385018m), // 5 + 9
+ new TestResult(0, -48466870444188873796419.928868m), // 5 + 10
+ new TestResult(0, -545193693242804794.20331374676m), // 5 + 11
+ new TestResult(0, 0.8629234053338741809892531431m), // 5 + 12
+ new TestResult(0, -400453059665371395972.23474452m), // 5 + 13
+ new TestResult(0, 222851627785191714190050.71676m), // 5 + 14
+ new TestResult(0, 14246043379204153213661335.684m), // 5 + 15
+ new TestResult(0, -421123.20446308691436596648186m), // 5 + 16
+ new TestResult(0, 24463288738299545.300508898642m), // 5 + 17
+ new TestResult(0, -5323259153836385912697775.901m), // 5 + 18
+ new TestResult(0, 102801066199805834724673169.29m), // 5 + 19
+ new TestResult(0, 7081320760.4793287174700927968m), // 5 + 20
+ new TestResult(0, 415752273939.87704245656837041m), // 5 + 21
+ new TestResult(0, -6389392489892.5362673670820462m), // 5 + 22
+ new TestResult(0, 442346282742915.1596416330681m), // 5 + 23
+ new TestResult(0, -512833780867323.79020837443764m), // 5 + 24
+ new TestResult(0, 608940580690915704.2450897514m), // 5 + 25
+ new TestResult(0, -42535053313319986966114.937787m), // 5 + 26
+ new TestResult(0, -7808274522591953107485.7812311m), // 5 + 27
+ new TestResult(0, 1037807626804273037330059471.8m), // 5 + 28
+ new TestResult(0, -4997122966.348652425771563042m), // 5 + 29
+ new TestResult(0, 79228162514264337593543950335m), // 6 + 0
+ new TestResult(1, 0m), // 6 + 1
+ new TestResult(0, 79228162514264337593543950334m), // 6 + 2
+ new TestResult(1, 0m), // 6 + 3
+ new TestResult(1, 0m), // 6 + 4
+ new TestResult(0, 79228162514264337593543950335m), // 6 + 5
+ new TestResult(1, 0m), // 6 + 6
+ new TestResult(0, 0m), // 6 + 7
+ new TestResult(1, 0m), // 6 + 8
+ new TestResult(0, 79228162514264337593540746480m), // 6 + 9
+ new TestResult(0, 79228114047393893404670153915m), // 6 + 10
+ new TestResult(0, 79228162513719143900301145541m), // 6 + 11
+ new TestResult(1, 0m), // 6 + 12
+ new TestResult(0, 79228162113811277928172554363m), // 6 + 13
+ new TestResult(1, 0m), // 6 + 14
+ new TestResult(1, 0m), // 6 + 15
+ new TestResult(0, 79228162514264337593543529212m), // 6 + 16
+ new TestResult(1, 0m), // 6 + 17
+ new TestResult(0, 79222839255110501207631252559m), // 6 + 18
+ new TestResult(1, 0m), // 6 + 19
+ new TestResult(1, 0m), // 6 + 20
+ new TestResult(1, 0m), // 6 + 21
+ new TestResult(0, 79228162514264331204151460442m), // 6 + 22
+ new TestResult(1, 0m), // 6 + 23
+ new TestResult(0, 79228162514263824759763083011m), // 6 + 24
+ new TestResult(1, 0m), // 6 + 25
+ new TestResult(0, 79228119979211024273556984220m), // 6 + 26
+ new TestResult(0, 79228154705989815001590842849m), // 6 + 27
+ new TestResult(1, 0m), // 6 + 28
+ new TestResult(0, 79228162514264337588546827369m), // 6 + 29
+ new TestResult(0, -79228162514264337593543950335m), // 7 + 0
+ new TestResult(0, -79228162514264337593543950334m), // 7 + 1
+ new TestResult(1, 0m), // 7 + 2
+ new TestResult(0, -79228162514264337593543950333m), // 7 + 3
+ new TestResult(0, -79228162514264337593543950325m), // 7 + 4
+ new TestResult(0, -79228162514264337593543950335m), // 7 + 5
+ new TestResult(0, 0m), // 7 + 6
+ new TestResult(1, 0m), // 7 + 7
+ new TestResult(0, -79200459211797245632934618455m), // 7 + 8
+ new TestResult(1, 0m), // 7 + 9
+ new TestResult(1, 0m), // 7 + 10
+ new TestResult(1, 0m), // 7 + 11
+ new TestResult(0, -79228162514264337593543950334m), // 7 + 12
+ new TestResult(1, 0m), // 7 + 13
+ new TestResult(0, -79227939662636552401829760284m), // 7 + 14
+ new TestResult(0, -79213916470885133440330288999m), // 7 + 15
+ new TestResult(1, 0m), // 7 + 16
+ new TestResult(0, -79228162514239874304805650790m), // 7 + 17
+ new TestResult(1, 0m), // 7 + 18
+ new TestResult(0, -79125361448064531758819277166m), // 7 + 19
+ new TestResult(0, -79228162514264337586462629575m), // 7 + 20
+ new TestResult(0, -79228162514264337177791676395m), // 7 + 21
+ new TestResult(1, 0m), // 7 + 22
+ new TestResult(0, -79228162514263895247261207420m), // 7 + 23
+ new TestResult(1, 0m), // 7 + 24
+ new TestResult(0, -79228162513655397012853034631m), // 7 + 25
+ new TestResult(1, 0m), // 7 + 26
+ new TestResult(1, 0m), // 7 + 27
+ new TestResult(0, -78190354887460064556213890863m), // 7 + 28
+ new TestResult(1, 0m), // 7 + 29
+ new TestResult(0, 27703302467091960609331879.532m), // 8 + 0
+ new TestResult(0, 27703302467091960609331880.532m), // 8 + 1
+ new TestResult(0, 27703302467091960609331878.532m), // 8 + 2
+ new TestResult(0, 27703302467091960609331881.532m), // 8 + 3
+ new TestResult(0, 27703302467091960609331889.532m), // 8 + 4
+ new TestResult(0, 27703302467091960609331879.632m), // 8 + 5
+ new TestResult(1, 0m), // 8 + 6
+ new TestResult(2, -79200459211797245632934618455m), // 8 + 7
+ new TestResult(0, 55406604934183921218663759.064m), // 8 + 8
+ new TestResult(0, 27703302467091960606128024.576m), // 8 + 9
+ new TestResult(0, 27654835596647771735535459.503m), // 8 + 10
+ new TestResult(0, 27703301921898267366527085.229m), // 8 + 11
+ new TestResult(0, 27703302467091960609331880.295m), // 8 + 12
+ new TestResult(0, 27702902014032295237935907.197m), // 8 + 13
+ new TestResult(0, 27926154094877152323521930.149m), // 8 + 14
+ new TestResult(0, 41949345846296113822993215.116m), // 8 + 15
+ new TestResult(0, 27703302467091960608910756.228m), // 8 + 16
+ new TestResult(0, 27703302491555249347631424.733m), // 8 + 17
+ new TestResult(0, 22380043313255574696634103.531m), // 8 + 18
+ new TestResult(2, 130504368666897795334005048.72m), // 8 + 19
+ new TestResult(0, 27703302467091967690652639.911m), // 8 + 20
+ new TestResult(0, 27703302467092376361605819.309m), // 8 + 21
+ new TestResult(0, 27703302467085571216841986.896m), // 8 + 22
+ new TestResult(0, 27703302467534306892074794.592m), // 8 + 23
+ new TestResult(0, 27703302466579126828464555.642m), // 8 + 24
+ new TestResult(0, 27703303076032541300247583.677m), // 8 + 25
+ new TestResult(0, 27660767413778640622365764.494m), // 8 + 26
+ new TestResult(0, 27695494192569368656224393.651m), // 8 + 27
+ new TestResult(2, 1065510929271364997939391351.2m), // 8 + 28
+ new TestResult(0, 27703302467091955612208913.083m), // 8 + 29
+ new TestResult(0, -3203854.9559968181492513385018m), // 9 + 0
+ new TestResult(0, -3203853.9559968181492513385018m), // 9 + 1
+ new TestResult(0, -3203855.9559968181492513385018m), // 9 + 2
+ new TestResult(0, -3203852.9559968181492513385018m), // 9 + 3
+ new TestResult(0, -3203844.9559968181492513385018m), // 9 + 4
+ new TestResult(0, -3203854.8559968181492513385018m), // 9 + 5
+ new TestResult(2, 79228162514264337593540746480m), // 9 + 6
+ new TestResult(1, 0m), // 9 + 7
+ new TestResult(2, 27703302467091960606128024.576m), // 9 + 8
+ new TestResult(0, -6407709.9119936362985026770036m), // 9 + 9
+ new TestResult(2, -48466870444188877000274.984865m), // 9 + 10
+ new TestResult(2, -545193693246008649.25931056491m), // 9 + 11
+ new TestResult(0, -3203854.1930734128153771575125m), // 9 + 12
+ new TestResult(2, -400453059665374599827.29074134m), // 9 + 13
+ new TestResult(2, 222851627785191710986195.66076m), // 9 + 14
+ new TestResult(2, 14246043379204153210457480.628m), // 9 + 15
+ new TestResult(0, -3624978.2604599050636173049837m), // 9 + 16
+ new TestResult(2, 24463288735095690.244512080493m), // 9 + 17
+ new TestResult(2, -5323259153836385915901630.957m), // 9 + 18
+ new TestResult(2, 102801066199805834721469314.23m), // 9 + 19
+ new TestResult(2, 7078116905.4233318993208414583m), // 9 + 20
+ new TestResult(2, 415749070084.82104563841911907m), // 9 + 21
+ new TestResult(2, -6389395693747.5922641852312975m), // 9 + 22
+ new TestResult(2, 442346279539060.10364481491885m), // 9 + 23
+ new TestResult(2, -512833784071178.84620519258689m), // 9 + 24
+ new TestResult(2, 608940580687711849.18909293325m), // 9 + 25
+ new TestResult(2, -42535053313319990169969.993784m), // 9 + 26
+ new TestResult(2, -7808274522591956311340.8372279m), // 9 + 27
+ new TestResult(2, 1037807626804273037326855616.7m), // 9 + 28
+ new TestResult(2, -5000326821.4046492439208143805m), // 9 + 29
+ new TestResult(0, -48466870444188873796420.028868m), // 10 + 0
+ new TestResult(0, -48466870444188873796419.028868m), // 10 + 1
+ new TestResult(0, -48466870444188873796421.028868m), // 10 + 2
+ new TestResult(0, -48466870444188873796418.028868m), // 10 + 3
+ new TestResult(0, -48466870444188873796410.028868m), // 10 + 4
+ new TestResult(0, -48466870444188873796419.928868m), // 10 + 5
+ new TestResult(2, 79228114047393893404670153915m), // 10 + 6
+ new TestResult(1, 0m), // 10 + 7
+ new TestResult(2, 27654835596647771735535459.503m), // 10 + 8
+ new TestResult(0, -48466870444188877000274.984865m), // 10 + 9
+ new TestResult(2, -96933740888377747592840.05774m), // 10 + 10
+ new TestResult(0, -48467415637882116601214.332182m), // 10 + 11
+ new TestResult(0, -48466870444188873796419.265945m), // 10 + 12
+ new TestResult(0, -48867323503854245192392.363613m), // 10 + 13
+ new TestResult(2, 174384757341002840393630.58789m), // 10 + 14
+ new TestResult(2, 14197576508759964339864915.555m), // 10 + 15
+ new TestResult(0, -48466870444188874217543.333331m), // 10 + 16
+ new TestResult(0, -48466845980900135496874.828359m), // 10 + 17
+ new TestResult(2, -5371726024280574786494196.0299m), // 10 + 18
+ new TestResult(2, 102752599329361645850876749.16m), // 10 + 19
+ new TestResult(0, -48466870444181792475659.649539m), // 10 + 20
+ new TestResult(0, -48466870443773121522480.251826m), // 10 + 21
+ new TestResult(0, -48466870450578266286312.665135m), // 10 + 22
+ new TestResult(0, -48466870001842591053504.969226m), // 10 + 23
+ new TestResult(0, -48466870957022654663743.919076m), // 10 + 24
+ new TestResult(0, -48466261503608182880715.883778m), // 10 + 25
+ new TestResult(2, -91001923757508860762535.06666m), // 10 + 26
+ new TestResult(0, -56275144966780826903905.910099m), // 10 + 27
+ new TestResult(2, 1037759159933828848456263051.7m), // 10 + 28
+ new TestResult(0, -48466870444193870919386.47752m), // 10 + 29
+ new TestResult(0, -545193693242804794.30331374676m), // 11 + 0
+ new TestResult(0, -545193693242804793.30331374676m), // 11 + 1
+ new TestResult(0, -545193693242804795.30331374676m), // 11 + 2
+ new TestResult(0, -545193693242804792.30331374676m), // 11 + 3
+ new TestResult(0, -545193693242804784.30331374676m), // 11 + 4
+ new TestResult(0, -545193693242804794.20331374676m), // 11 + 5
+ new TestResult(2, 79228162513719143900301145541m), // 11 + 6
+ new TestResult(1, 0m), // 11 + 7
+ new TestResult(2, 27703301921898267366527085.229m), // 11 + 8
+ new TestResult(0, -545193693246008649.25931056491m), // 11 + 9
+ new TestResult(2, -48467415637882116601214.332182m), // 11 + 10
+ new TestResult(2, -1090387386485609588.6066274935m), // 11 + 11
+ new TestResult(0, -545193693242804793.54039034143m), // 11 + 12
+ new TestResult(2, -400998253358614200766.63805827m), // 11 + 13
+ new TestResult(2, 222851082591498471385256.31345m), // 11 + 14
+ new TestResult(2, 14246042834010459970856541.281m), // 11 + 15
+ new TestResult(0, -545193693243225917.60777683367m), // 11 + 16
+ new TestResult(0, -520730404504505249.10280484812m), // 11 + 17
+ new TestResult(2, -5323259699030079155502570.3043m), // 11 + 18
+ new TestResult(2, 102801065654612141481868374.89m), // 11 + 19
+ new TestResult(0, -545193686161484033.92398502929m), // 11 + 20
+ new TestResult(0, -545193277490530854.52627129019m), // 11 + 21
+ new TestResult(0, -545200082635294686.93958111384m), // 11 + 22
+ new TestResult(0, -544751346960061879.24367211369m), // 11 + 23
+ new TestResult(0, -545706527023672118.1935221212m), // 11 + 24
+ new TestResult(0, 63746887448110909.84177600464m), // 11 + 25
+ new TestResult(2, -42535598507013229770909.341101m), // 11 + 26
+ new TestResult(2, -7808819716285195912280.1845448m), // 11 + 27
+ new TestResult(2, 1037807626259079344087254677.4m), // 11 + 28
+ new TestResult(0, -545193698239927760.75196617253m), // 11 + 29
+ new TestResult(0, 0.7629234053338741809892531431m), // 12 + 0
+ new TestResult(0, 1.7629234053338741809892531431m), // 12 + 1
+ new TestResult(0, -0.2370765946661258190107468569m), // 12 + 2
+ new TestResult(0, 2.7629234053338741809892531431m), // 12 + 3
+ new TestResult(2, 10.762923405333874180989253143m), // 12 + 4
+ new TestResult(0, 0.8629234053338741809892531431m), // 12 + 5
+ new TestResult(1, 0m), // 12 + 6
+ new TestResult(2, -79228162514264337593543950334m), // 12 + 7
+ new TestResult(2, 27703302467091960609331880.295m), // 12 + 8
+ new TestResult(2, -3203854.1930734128153771575125m), // 12 + 9
+ new TestResult(2, -48466870444188873796419.265945m), // 12 + 10
+ new TestResult(2, -545193693242804793.54039034143m), // 12 + 11
+ new TestResult(0, 1.5258468106677483619785062862m), // 12 + 12
+ new TestResult(2, -400453059665371395971.57182111m), // 12 + 13
+ new TestResult(2, 222851627785191714190051.37968m), // 12 + 14
+ new TestResult(2, 14246043379204153213661336.347m), // 12 + 15
+ new TestResult(2, -421122.54153968158049178549261m), // 12 + 16
+ new TestResult(2, 24463288738299545.963432303976m), // 12 + 17
+ new TestResult(2, -5323259153836385912697775.2381m), // 12 + 18
+ new TestResult(2, 102801066199805834724673169.95m), // 12 + 19
+ new TestResult(2, 7081320761.1422521228039669778m), // 12 + 20
+ new TestResult(2, 415752273940.53996586190224459m), // 12 + 21
+ new TestResult(2, -6389392489891.873343961748172m), // 12 + 22
+ new TestResult(2, 442346282742915.82256503840197m), // 12 + 23
+ new TestResult(2, -512833780867323.12728496910377m), // 12 + 24
+ new TestResult(2, 608940580690915704.90801315673m), // 12 + 25
+ new TestResult(2, -42535053313319986966114.274864m), // 12 + 26
+ new TestResult(2, -7808274522591953107485.1183077m), // 12 + 27
+ new TestResult(2, 1037807626804273037330059472.5m), // 12 + 28
+ new TestResult(2, -4997122965.685729020437688861m), // 12 + 29
+ new TestResult(0, -400453059665371395972.33474452m), // 13 + 0
+ new TestResult(0, -400453059665371395971.33474452m), // 13 + 1
+ new TestResult(0, -400453059665371395973.33474452m), // 13 + 2
+ new TestResult(0, -400453059665371395970.33474452m), // 13 + 3
+ new TestResult(0, -400453059665371395962.33474452m), // 13 + 4
+ new TestResult(0, -400453059665371395972.23474452m), // 13 + 5
+ new TestResult(2, 79228162113811277928172554363m), // 13 + 6
+ new TestResult(1, 0m), // 13 + 7
+ new TestResult(2, 27702902014032295237935907.197m), // 13 + 8
+ new TestResult(0, -400453059665374599827.29074134m), // 13 + 9
+ new TestResult(2, -48867323503854245192392.363613m), // 13 + 10
+ new TestResult(0, -400998253358614200766.63805827m), // 13 + 11
+ new TestResult(0, -400453059665371395971.57182111m), // 13 + 12
+ new TestResult(2, -800906119330742791944.669489m), // 13 + 13
+ new TestResult(2, 222451174725526342794078.28202m), // 13 + 14
+ new TestResult(2, 14245642926144487842265363.249m), // 13 + 15
+ new TestResult(0, -400453059665371817095.63920761m), // 13 + 16
+ new TestResult(0, -400428596376633096427.13423562m), // 13 + 17
+ new TestResult(2, -5323659606896051284093748.3357m), // 13 + 18
+ new TestResult(2, 102800665746746169353277196.86m), // 13 + 19
+ new TestResult(0, -400453059658290075211.9554158m), // 13 + 20
+ new TestResult(0, -400453059249619122032.55770206m), // 13 + 21
+ new TestResult(0, -400453066054763885864.97101189m), // 13 + 22
+ new TestResult(0, -400452617319088653057.27510289m), // 13 + 23
+ new TestResult(0, -400453572499152263296.22495289m), // 13 + 24
+ new TestResult(0, -399844119084680480268.18965477m), // 13 + 25
+ new TestResult(2, -42935506372985358362087.372532m), // 13 + 26
+ new TestResult(2, -8208727582257324503458.215976m), // 13 + 27
+ new TestResult(2, 1037807226351213371958663499.4m), // 13 + 28
+ new TestResult(0, -400453059670368518938.78339695m), // 13 + 29
+ new TestResult(0, 222851627785191714190050.61676m), // 14 + 0
+ new TestResult(0, 222851627785191714190051.61676m), // 14 + 1
+ new TestResult(0, 222851627785191714190049.61676m), // 14 + 2
+ new TestResult(0, 222851627785191714190052.61676m), // 14 + 3
+ new TestResult(0, 222851627785191714190060.61676m), // 14 + 4
+ new TestResult(0, 222851627785191714190050.71676m), // 14 + 5
+ new TestResult(1, 0m), // 14 + 6
+ new TestResult(2, -79227939662636552401829760284m), // 14 + 7
+ new TestResult(2, 27926154094877152323521930.149m), // 14 + 8
+ new TestResult(0, 222851627785191710986195.66076m), // 14 + 9
+ new TestResult(0, 174384757341002840393630.58789m), // 14 + 10
+ new TestResult(0, 222851082591498471385256.31345m), // 14 + 11
+ new TestResult(0, 222851627785191714190051.37968m), // 14 + 12
+ new TestResult(0, 222451174725526342794078.28202m), // 14 + 13
+ new TestResult(0, 445703255570383428380101.23352m), // 14 + 14
+ new TestResult(2, 14468895006989344927851386.201m), // 14 + 15
+ new TestResult(0, 222851627785191713768927.3123m), // 14 + 16
+ new TestResult(0, 222851652248480452489595.81727m), // 14 + 17
+ new TestResult(2, -5100407526051194198507725.3842m), // 14 + 18
+ new TestResult(2, 103023917827591026438863219.81m), // 14 + 19
+ new TestResult(0, 222851627785198795510810.99609m), // 14 + 20
+ new TestResult(0, 222851627785607466463990.3938m), // 14 + 21
+ new TestResult(0, 222851627778802321700157.98049m), // 14 + 22
+ new TestResult(0, 222851628227537996932965.6764m), // 14 + 23
+ new TestResult(0, 222851627272357933322726.72655m), // 14 + 24
+ new TestResult(0, 222852236725772405105754.76185m), // 14 + 25
+ new TestResult(0, 180316574471871727223935.57897m), // 14 + 26
+ new TestResult(0, 215043353262599761082564.73553m), // 14 + 27
+ new TestResult(2, 1038030478432058229044249522.3m), // 14 + 28
+ new TestResult(0, 222851627785186717067084.16811m), // 14 + 29
+ new TestResult(0, 14246043379204153213661335.584m), // 15 + 0
+ new TestResult(0, 14246043379204153213661336.584m), // 15 + 1
+ new TestResult(0, 14246043379204153213661334.584m), // 15 + 2
+ new TestResult(0, 14246043379204153213661337.584m), // 15 + 3
+ new TestResult(0, 14246043379204153213661345.584m), // 15 + 4
+ new TestResult(0, 14246043379204153213661335.684m), // 15 + 5
+ new TestResult(1, 0m), // 15 + 6
+ new TestResult(2, -79213916470885133440330288999m), // 15 + 7
+ new TestResult(0, 41949345846296113822993215.116m), // 15 + 8
+ new TestResult(0, 14246043379204153210457480.628m), // 15 + 9
+ new TestResult(0, 14197576508759964339864915.555m), // 15 + 10
+ new TestResult(0, 14246042834010459970856541.281m), // 15 + 11
+ new TestResult(0, 14246043379204153213661336.347m), // 15 + 12
+ new TestResult(0, 14245642926144487842265363.249m), // 15 + 13
+ new TestResult(0, 14468895006989344927851386.201m), // 15 + 14
+ new TestResult(0, 28492086758408306427322671.168m), // 15 + 15
+ new TestResult(0, 14246043379204153213240212.28m), // 15 + 16
+ new TestResult(0, 14246043403667441951960880.785m), // 15 + 17
+ new TestResult(0, 8922784225367767300963559.583m), // 15 + 18
+ new TestResult(2, 117047109579009987938334504.77m), // 15 + 19
+ new TestResult(0, 14246043379204160294982095.963m), // 15 + 20
+ new TestResult(0, 14246043379204568965935275.361m), // 15 + 21
+ new TestResult(0, 14246043379197763821171442.948m), // 15 + 22
+ new TestResult(0, 14246043379646499496404250.644m), // 15 + 23
+ new TestResult(0, 14246043378691319432794011.694m), // 15 + 24
+ new TestResult(0, 14246043988144733904577039.729m), // 15 + 25
+ new TestResult(0, 14203508325890833226695220.546m), // 15 + 26
+ new TestResult(0, 14238235104681561260553849.703m), // 15 + 27
+ new TestResult(2, 1052053670183477190543720807.3m), // 15 + 28
+ new TestResult(0, 14246043379204148216538369.135m), // 15 + 29
+ new TestResult(0, -421123.30446308691436596648186m), // 16 + 0
+ new TestResult(0, -421122.30446308691436596648186m), // 16 + 1
+ new TestResult(0, -421124.30446308691436596648186m), // 16 + 2
+ new TestResult(0, -421121.30446308691436596648186m), // 16 + 3
+ new TestResult(0, -421113.30446308691436596648186m), // 16 + 4
+ new TestResult(0, -421123.20446308691436596648186m), // 16 + 5
+ new TestResult(2, 79228162514264337593543529212m), // 16 + 6
+ new TestResult(1, 0m), // 16 + 7
+ new TestResult(2, 27703302467091960608910756.228m), // 16 + 8
+ new TestResult(2, -3624978.2604599050636173049837m), // 16 + 9
+ new TestResult(2, -48466870444188874217543.333331m), // 16 + 10
+ new TestResult(2, -545193693243225917.60777683367m), // 16 + 11
+ new TestResult(0, -421122.54153968158049178549261m), // 16 + 12
+ new TestResult(2, -400453059665371817095.63920761m), // 16 + 13
+ new TestResult(2, 222851627785191713768927.3123m), // 16 + 14
+ new TestResult(2, 14246043379204153213240212.28m), // 16 + 15
+ new TestResult(2, -842246.6089261738287319329637m), // 16 + 16
+ new TestResult(2, 24463288737878421.896045811728m), // 16 + 17
+ new TestResult(2, -5323259153836385913118899.3055m), // 16 + 18
+ new TestResult(2, 102801066199805834724252045.89m), // 16 + 19
+ new TestResult(2, 7080899637.0748656305557268303m), // 16 + 20
+ new TestResult(2, 415751852816.47257936965400444m), // 16 + 21
+ new TestResult(2, -6389392911015.9407304539964122m), // 16 + 22
+ new TestResult(2, 442346282321791.75517854615373m), // 16 + 23
+ new TestResult(2, -512833781288447.19467146135201m), // 16 + 24
+ new TestResult(2, 608940580690494580.84062666449m), // 16 + 25
+ new TestResult(2, -42535053313319987387238.34225m), // 16 + 26
+ new TestResult(2, -7808274522591953528609.1856942m), // 16 + 27
+ new TestResult(2, 1037807626804273037329638348.4m), // 16 + 28
+ new TestResult(2, -4997544089.7531155126859290085m), // 16 + 29
+ new TestResult(0, 24463288738299545.200508898642m), // 17 + 0
+ new TestResult(0, 24463288738299546.200508898642m), // 17 + 1
+ new TestResult(0, 24463288738299544.200508898642m), // 17 + 2
+ new TestResult(0, 24463288738299547.200508898642m), // 17 + 3
+ new TestResult(0, 24463288738299555.200508898642m), // 17 + 4
+ new TestResult(0, 24463288738299545.300508898642m), // 17 + 5
+ new TestResult(1, 0m), // 17 + 6
+ new TestResult(2, -79228162514239874304805650790m), // 17 + 7
+ new TestResult(2, 27703302491555249347631424.733m), // 17 + 8
+ new TestResult(0, 24463288735095690.244512080493m), // 17 + 9
+ new TestResult(2, -48466845980900135496874.828359m), // 17 + 10
+ new TestResult(2, -520730404504505249.10280484812m), // 17 + 11
+ new TestResult(0, 24463288738299545.963432303976m), // 17 + 12
+ new TestResult(2, -400428596376633096427.13423562m), // 17 + 13
+ new TestResult(2, 222851652248480452489595.81727m), // 17 + 14
+ new TestResult(2, 14246043403667441951960880.785m), // 17 + 15
+ new TestResult(0, 24463288737878421.896045811728m), // 17 + 16
+ new TestResult(0, 48926577476599090.401017797284m), // 17 + 17
+ new TestResult(2, -5323259129373097174398230.8005m), // 17 + 18
+ new TestResult(2, 102801066224269123462972714.39m), // 17 + 19
+ new TestResult(0, 24463295819620305.579837616112m), // 17 + 20
+ new TestResult(0, 24463704490573484.97755135521m), // 17 + 21
+ new TestResult(0, 24456899345809652.56424153156m), // 17 + 22
+ new TestResult(0, 24905635021042460.26015053171m), // 17 + 23
+ new TestResult(0, 23950454957432221.310300524204m), // 17 + 24
+ new TestResult(2, 633403869429215249.34559865004m), // 17 + 25
+ new TestResult(2, -42535028850031248666569.837278m), // 17 + 26
+ new TestResult(2, -7808250059303214807940.6807222m), // 17 + 27
+ new TestResult(2, 1037807626828736326068359016.9m), // 17 + 28
+ new TestResult(0, 24463283741176578.75185647287m), // 17 + 29
+ new TestResult(0, -5323259153836385912697776.001m), // 18 + 0
+ new TestResult(0, -5323259153836385912697775.001m), // 18 + 1
+ new TestResult(0, -5323259153836385912697777.001m), // 18 + 2
+ new TestResult(0, -5323259153836385912697774.001m), // 18 + 3
+ new TestResult(0, -5323259153836385912697766.001m), // 18 + 4
+ new TestResult(0, -5323259153836385912697775.901m), // 18 + 5
+ new TestResult(2, 79222839255110501207631252559m), // 18 + 6
+ new TestResult(1, 0m), // 18 + 7
+ new TestResult(0, 22380043313255574696634103.531m), // 18 + 8
+ new TestResult(0, -5323259153836385915901630.957m), // 18 + 9
+ new TestResult(0, -5371726024280574786494196.0299m), // 18 + 10
+ new TestResult(0, -5323259699030079155502570.3043m), // 18 + 11
+ new TestResult(0, -5323259153836385912697775.2381m), // 18 + 12
+ new TestResult(0, -5323659606896051284093748.3357m), // 18 + 13
+ new TestResult(0, -5100407526051194198507725.3842m), // 18 + 14
+ new TestResult(0, 8922784225367767300963559.583m), // 18 + 15
+ new TestResult(0, -5323259153836385913118899.3055m), // 18 + 16
+ new TestResult(0, -5323259129373097174398230.8005m), // 18 + 17
+ new TestResult(0, -10646518307672771825395552.002m), // 18 + 18
+ new TestResult(2, 97477807045969448811975393.19m), // 18 + 19
+ new TestResult(0, -5323259153836378831377015.6217m), // 18 + 20
+ new TestResult(0, -5323259153835970160423836.224m), // 18 + 21
+ new TestResult(0, -5323259153842775305187668.6373m), // 18 + 22
+ new TestResult(0, -5323259153394039629954860.9414m), // 18 + 23
+ new TestResult(0, -5323259154349219693565099.8912m), // 18 + 24
+ new TestResult(0, -5323258544895805221782071.8559m), // 18 + 25
+ new TestResult(0, -5365794207149705899663891.0388m), // 18 + 26
+ new TestResult(0, -5331067428358977865805261.8822m), // 18 + 27
+ new TestResult(2, 1032484367650436651417361695.7m), // 18 + 28
+ new TestResult(0, -5323259153836390909820742.4497m), // 18 + 29
+ new TestResult(0, 102801066199805834724673169.19m), // 19 + 0
+ new TestResult(0, 102801066199805834724673170.19m), // 19 + 1
+ new TestResult(0, 102801066199805834724673168.19m), // 19 + 2
+ new TestResult(0, 102801066199805834724673171.19m), // 19 + 3
+ new TestResult(0, 102801066199805834724673179.19m), // 19 + 4
+ new TestResult(0, 102801066199805834724673169.29m), // 19 + 5
+ new TestResult(1, 0m), // 19 + 6
+ new TestResult(2, -79125361448064531758819277166m), // 19 + 7
+ new TestResult(0, 130504368666897795334005048.72m), // 19 + 8
+ new TestResult(0, 102801066199805834721469314.23m), // 19 + 9
+ new TestResult(0, 102752599329361645850876749.16m), // 19 + 10
+ new TestResult(0, 102801065654612141481868374.89m), // 19 + 11
+ new TestResult(0, 102801066199805834724673169.95m), // 19 + 12
+ new TestResult(0, 102800665746746169353277196.86m), // 19 + 13
+ new TestResult(0, 103023917827591026438863219.81m), // 19 + 14
+ new TestResult(0, 117047109579009987938334504.77m), // 19 + 15
+ new TestResult(0, 102801066199805834724252045.89m), // 19 + 16
+ new TestResult(0, 102801066224269123462972714.39m), // 19 + 17
+ new TestResult(0, 97477807045969448811975393.19m), // 19 + 18
+ new TestResult(0, 205602132399611669449346338.38m), // 19 + 19
+ new TestResult(0, 102801066199805841805993929.57m), // 19 + 20
+ new TestResult(0, 102801066199806250476947108.97m), // 19 + 21
+ new TestResult(0, 102801066199799445332183276.55m), // 19 + 22
+ new TestResult(0, 102801066200248181007416084.25m), // 19 + 23
+ new TestResult(0, 102801066199293000943805845.3m), // 19 + 24
+ new TestResult(0, 102801066808746415415588873.34m), // 19 + 25
+ new TestResult(0, 102758531146492514737707054.15m), // 19 + 26
+ new TestResult(0, 102793257925283242771565683.31m), // 19 + 27
+ new TestResult(2, 1140608693004078872054732640.9m), // 19 + 28
+ new TestResult(0, 102801066199805829727550202.74m), // 19 + 29
+ new TestResult(0, 7081320760.3793287174700927968m), // 20 + 0
+ new TestResult(0, 7081320761.3793287174700927968m), // 20 + 1
+ new TestResult(0, 7081320759.3793287174700927968m), // 20 + 2
+ new TestResult(0, 7081320762.3793287174700927968m), // 20 + 3
+ new TestResult(0, 7081320770.3793287174700927968m), // 20 + 4
+ new TestResult(0, 7081320760.4793287174700927968m), // 20 + 5
+ new TestResult(1, 0m), // 20 + 6
+ new TestResult(2, -79228162514264337586462629575m), // 20 + 7
+ new TestResult(2, 27703302467091967690652639.911m), // 20 + 8
+ new TestResult(0, 7078116905.4233318993208414583m), // 20 + 9
+ new TestResult(2, -48466870444181792475659.649539m), // 20 + 10
+ new TestResult(2, -545193686161484033.92398502929m), // 20 + 11
+ new TestResult(0, 7081320761.1422521228039669778m), // 20 + 12
+ new TestResult(2, -400453059658290075211.9554158m), // 20 + 13
+ new TestResult(2, 222851627785198795510810.99609m), // 20 + 14
+ new TestResult(2, 14246043379204160294982095.963m), // 20 + 15
+ new TestResult(0, 7080899637.0748656305557268303m), // 20 + 16
+ new TestResult(2, 24463295819620305.579837616112m), // 20 + 17
+ new TestResult(2, -5323259153836378831377015.6217m), // 20 + 18
+ new TestResult(2, 102801066199805841805993929.57m), // 20 + 19
+ new TestResult(2, 14162641520.758657434940185594m), // 20 + 20
+ new TestResult(2, 422833594700.15637117403846321m), // 20 + 21
+ new TestResult(2, -6382311169132.2569386496119534m), // 20 + 22
+ new TestResult(2, 442353364063675.43897035053819m), // 20 + 23
+ new TestResult(2, -512826699546563.51087965696755m), // 20 + 24
+ new TestResult(2, 608940587772236464.52441846887m), // 20 + 25
+ new TestResult(2, -42535053313312905645354.658458m), // 20 + 26
+ new TestResult(2, -7808274522584871786725.5019024m), // 20 + 27
+ new TestResult(2, 1037807626804273044411380232.1m), // 20 + 28
+ new TestResult(0, 2084197793.9306762916985297548m), // 20 + 29
+ new TestResult(0, 415752273939.77704245656837041m), // 21 + 0
+ new TestResult(0, 415752273940.77704245656837041m), // 21 + 1
+ new TestResult(0, 415752273938.77704245656837041m), // 21 + 2
+ new TestResult(0, 415752273941.77704245656837041m), // 21 + 3
+ new TestResult(0, 415752273949.77704245656837041m), // 21 + 4
+ new TestResult(0, 415752273939.87704245656837041m), // 21 + 5
+ new TestResult(1, 0m), // 21 + 6
+ new TestResult(2, -79228162514264337177791676395m), // 21 + 7
+ new TestResult(2, 27703302467092376361605819.309m), // 21 + 8
+ new TestResult(0, 415749070084.82104563841911907m), // 21 + 9
+ new TestResult(2, -48466870443773121522480.251826m), // 21 + 10
+ new TestResult(2, -545193277490530854.52627129019m), // 21 + 11
+ new TestResult(0, 415752273940.53996586190224459m), // 21 + 12
+ new TestResult(2, -400453059249619122032.55770206m), // 21 + 13
+ new TestResult(2, 222851627785607466463990.3938m), // 21 + 14
+ new TestResult(2, 14246043379204568965935275.361m), // 21 + 15
+ new TestResult(0, 415751852816.47257936965400444m), // 21 + 16
+ new TestResult(2, 24463704490573484.97755135521m), // 21 + 17
+ new TestResult(2, -5323259153835970160423836.224m), // 21 + 18
+ new TestResult(2, 102801066199806250476947108.97m), // 21 + 19
+ new TestResult(0, 422833594700.15637117403846321m), // 21 + 20
+ new TestResult(2, 831504547879.5540849131367408m), // 21 + 21
+ new TestResult(2, -5973640215952.8592249105136758m), // 21 + 22
+ new TestResult(2, 442762035016854.83668408963647m), // 21 + 23
+ new TestResult(2, -512418028593384.11316591786927m), // 21 + 24
+ new TestResult(2, 608940996443189643.92213220797m), // 21 + 25
+ new TestResult(2, -42535053312904234692175.260745m), // 21 + 26
+ new TestResult(2, -7808274522176200833546.1041886m), // 21 + 27
+ new TestResult(2, 1037807626804273453082333411.5m), // 21 + 28
+ new TestResult(0, 410755150973.32839003079680737m), // 21 + 29
+ new TestResult(0, -6389392489892.6362673670820462m), // 22 + 0
+ new TestResult(0, -6389392489891.6362673670820462m), // 22 + 1
+ new TestResult(0, -6389392489893.6362673670820462m), // 22 + 2
+ new TestResult(0, -6389392489890.6362673670820462m), // 22 + 3
+ new TestResult(0, -6389392489882.6362673670820462m), // 22 + 4
+ new TestResult(0, -6389392489892.5362673670820462m), // 22 + 5
+ new TestResult(2, 79228162514264331204151460442m), // 22 + 6
+ new TestResult(1, 0m), // 22 + 7
+ new TestResult(2, 27703302467085571216841986.896m), // 22 + 8
+ new TestResult(0, -6389395693747.5922641852312975m), // 22 + 9
+ new TestResult(2, -48466870450578266286312.665135m), // 22 + 10
+ new TestResult(2, -545200082635294686.93958111384m), // 22 + 11
+ new TestResult(0, -6389392489891.873343961748172m), // 22 + 12
+ new TestResult(2, -400453066054763885864.97101189m), // 22 + 13
+ new TestResult(2, 222851627778802321700157.98049m), // 22 + 14
+ new TestResult(2, 14246043379197763821171442.948m), // 22 + 15
+ new TestResult(0, -6389392911015.9407304539964122m), // 22 + 16
+ new TestResult(2, 24456899345809652.56424153156m), // 22 + 17
+ new TestResult(2, -5323259153842775305187668.6373m), // 22 + 18
+ new TestResult(2, 102801066199799445332183276.55m), // 22 + 19
+ new TestResult(0, -6382311169132.2569386496119534m), // 22 + 20
+ new TestResult(0, -5973640215952.8592249105136758m), // 22 + 21
+ new TestResult(2, -12778784979785.272534734164092m), // 22 + 22
+ new TestResult(2, 435956890253022.42337426598605m), // 22 + 23
+ new TestResult(2, -519223173357216.52647574151969m), // 22 + 24
+ new TestResult(2, 608934191298425811.50882238432m), // 22 + 25
+ new TestResult(2, -42535053319709379456007.674054m), // 22 + 26
+ new TestResult(2, -7808274528981345597378.5174985m), // 22 + 27
+ new TestResult(2, 1037807626804266647937569579.1m), // 22 + 28
+ new TestResult(0, -6394389612859.0849197928536092m), // 22 + 29
+ new TestResult(0, 442346282742915.0596416330681m), // 23 + 0
+ new TestResult(0, 442346282742916.0596416330681m), // 23 + 1
+ new TestResult(0, 442346282742914.0596416330681m), // 23 + 2
+ new TestResult(0, 442346282742917.0596416330681m), // 23 + 3
+ new TestResult(0, 442346282742925.0596416330681m), // 23 + 4
+ new TestResult(0, 442346282742915.1596416330681m), // 23 + 5
+ new TestResult(1, 0m), // 23 + 6
+ new TestResult(2, -79228162514263895247261207420m), // 23 + 7
+ new TestResult(2, 27703302467534306892074794.592m), // 23 + 8
+ new TestResult(0, 442346279539060.10364481491885m), // 23 + 9
+ new TestResult(2, -48466870001842591053504.969226m), // 23 + 10
+ new TestResult(2, -544751346960061879.24367211369m), // 23 + 11
+ new TestResult(0, 442346282742915.82256503840197m), // 23 + 12
+ new TestResult(2, -400452617319088653057.27510289m), // 23 + 13
+ new TestResult(2, 222851628227537996932965.6764m), // 23 + 14
+ new TestResult(2, 14246043379646499496404250.644m), // 23 + 15
+ new TestResult(0, 442346282321791.75517854615373m), // 23 + 16
+ new TestResult(2, 24905635021042460.26015053171m), // 23 + 17
+ new TestResult(2, -5323259153394039629954860.9414m), // 23 + 18
+ new TestResult(2, 102801066200248181007416084.25m), // 23 + 19
+ new TestResult(0, 442353364063675.43897035053819m), // 23 + 20
+ new TestResult(0, 442762035016854.83668408963647m), // 23 + 21
+ new TestResult(0, 435956890253022.42337426598605m), // 23 + 22
+ new TestResult(0, 884692565485830.1192832661362m), // 23 + 23
+ new TestResult(0, -70487498124408.83056674136954m), // 23 + 24
+ new TestResult(2, 609382926973658619.20473138447m), // 23 + 25
+ new TestResult(2, -42535052870973704223199.978145m), // 23 + 26
+ new TestResult(2, -7808274080245670364570.8215895m), // 23 + 27
+ new TestResult(2, 1037807626804715383612802386.8m), // 23 + 28
+ new TestResult(0, 442341285619948.61098920729654m), // 23 + 29
+ new TestResult(0, -512833780867323.89020837443764m), // 24 + 0
+ new TestResult(0, -512833780867322.89020837443764m), // 24 + 1
+ new TestResult(0, -512833780867324.89020837443764m), // 24 + 2
+ new TestResult(0, -512833780867321.89020837443764m), // 24 + 3
+ new TestResult(0, -512833780867313.89020837443764m), // 24 + 4
+ new TestResult(0, -512833780867323.79020837443764m), // 24 + 5
+ new TestResult(2, 79228162514263824759763083011m), // 24 + 6
+ new TestResult(1, 0m), // 24 + 7
+ new TestResult(2, 27703302466579126828464555.642m), // 24 + 8
+ new TestResult(0, -512833784071178.84620519258689m), // 24 + 9
+ new TestResult(2, -48466870957022654663743.919076m), // 24 + 10
+ new TestResult(2, -545706527023672118.1935221212m), // 24 + 11
+ new TestResult(0, -512833780867323.12728496910377m), // 24 + 12
+ new TestResult(2, -400453572499152263296.22495289m), // 24 + 13
+ new TestResult(2, 222851627272357933322726.72655m), // 24 + 14
+ new TestResult(2, 14246043378691319432794011.694m), // 24 + 15
+ new TestResult(0, -512833781288447.19467146135201m), // 24 + 16
+ new TestResult(2, 23950454957432221.310300524204m), // 24 + 17
+ new TestResult(2, -5323259154349219693565099.8912m), // 24 + 18
+ new TestResult(2, 102801066199293000943805845.3m), // 24 + 19
+ new TestResult(0, -512826699546563.51087965696755m), // 24 + 20
+ new TestResult(0, -512418028593384.11316591786927m), // 24 + 21
+ new TestResult(0, -519223173357216.52647574151969m), // 24 + 22
+ new TestResult(0, -70487498124408.83056674136954m), // 24 + 23
+ new TestResult(2, -1025667561734647.7804167488753m), // 24 + 24
+ new TestResult(2, 608427746910048380.25488137696m), // 24 + 25
+ new TestResult(2, -42535053826153767833438.927995m), // 24 + 26
+ new TestResult(2, -7808275035425733974809.7714395m), // 24 + 27
+ new TestResult(2, 1037807626803760203549192147.8m), // 24 + 28
+ new TestResult(0, -512838777990290.3388608002092m), // 24 + 29
+ new TestResult(0, 608940580690915704.1450897514m), // 25 + 0
+ new TestResult(0, 608940580690915705.1450897514m), // 25 + 1
+ new TestResult(0, 608940580690915703.1450897514m), // 25 + 2
+ new TestResult(0, 608940580690915706.1450897514m), // 25 + 3
+ new TestResult(0, 608940580690915714.1450897514m), // 25 + 4
+ new TestResult(0, 608940580690915704.2450897514m), // 25 + 5
+ new TestResult(1, 0m), // 25 + 6
+ new TestResult(2, -79228162513655397012853034631m), // 25 + 7
+ new TestResult(2, 27703303076032541300247583.677m), // 25 + 8
+ new TestResult(0, 608940580687711849.18909293325m), // 25 + 9
+ new TestResult(2, -48466261503608182880715.883778m), // 25 + 10
+ new TestResult(0, 63746887448110909.84177600464m), // 25 + 11
+ new TestResult(0, 608940580690915704.90801315673m), // 25 + 12
+ new TestResult(2, -399844119084680480268.18965477m), // 25 + 13
+ new TestResult(2, 222852236725772405105754.76185m), // 25 + 14
+ new TestResult(2, 14246043988144733904577039.729m), // 25 + 15
+ new TestResult(0, 608940580690494580.84062666449m), // 25 + 16
+ new TestResult(0, 633403869429215249.34559865004m), // 25 + 17
+ new TestResult(2, -5323258544895805221782071.8559m), // 25 + 18
+ new TestResult(2, 102801066808746415415588873.34m), // 25 + 19
+ new TestResult(0, 608940587772236464.52441846887m), // 25 + 20
+ new TestResult(0, 608940996443189643.92213220797m), // 25 + 21
+ new TestResult(0, 608934191298425811.50882238432m), // 25 + 22
+ new TestResult(0, 609382926973658619.20473138447m), // 25 + 23
+ new TestResult(0, 608427746910048380.25488137696m), // 25 + 24
+ new TestResult(0, 1217881161381831408.2901795028m), // 25 + 25
+ new TestResult(2, -42534444372739296050410.892697m), // 25 + 26
+ new TestResult(2, -7807665582011262191781.7361413m), // 25 + 27
+ new TestResult(2, 1037807627413213618020975175.8m), // 25 + 28
+ new TestResult(0, 608940575693792737.69643732563m), // 25 + 29
+ new TestResult(0, -42535053313319986966115.037787m), // 26 + 0
+ new TestResult(0, -42535053313319986966114.037787m), // 26 + 1
+ new TestResult(0, -42535053313319986966116.037787m), // 26 + 2
+ new TestResult(0, -42535053313319986966113.037787m), // 26 + 3
+ new TestResult(0, -42535053313319986966105.037787m), // 26 + 4
+ new TestResult(0, -42535053313319986966114.937787m), // 26 + 5
+ new TestResult(2, 79228119979211024273556984220m), // 26 + 6
+ new TestResult(1, 0m), // 26 + 7
+ new TestResult(2, 27660767413778640622365764.494m), // 26 + 8
+ new TestResult(0, -42535053313319990169969.993784m), // 26 + 9
+ new TestResult(2, -91001923757508860762535.06666m), // 26 + 10
+ new TestResult(0, -42535598507013229770909.341101m), // 26 + 11
+ new TestResult(0, -42535053313319986966114.274864m), // 26 + 12
+ new TestResult(0, -42935506372985358362087.372532m), // 26 + 13
+ new TestResult(2, 180316574471871727223935.57897m), // 26 + 14
+ new TestResult(2, 14203508325890833226695220.546m), // 26 + 15
+ new TestResult(0, -42535053313319987387238.34225m), // 26 + 16
+ new TestResult(0, -42535028850031248666569.837278m), // 26 + 17
+ new TestResult(2, -5365794207149705899663891.0388m), // 26 + 18
+ new TestResult(2, 102758531146492514737707054.15m), // 26 + 19
+ new TestResult(0, -42535053313312905645354.658458m), // 26 + 20
+ new TestResult(0, -42535053312904234692175.260745m), // 26 + 21
+ new TestResult(0, -42535053319709379456007.674054m), // 26 + 22
+ new TestResult(0, -42535052870973704223199.978145m), // 26 + 23
+ new TestResult(0, -42535053826153767833438.927995m), // 26 + 24
+ new TestResult(0, -42534444372739296050410.892697m), // 26 + 25
+ new TestResult(2, -85070106626639973932230.07557m), // 26 + 26
+ new TestResult(0, -50343327835911940073600.919018m), // 26 + 27
+ new TestResult(2, 1037765091750959717343093356.7m), // 26 + 28
+ new TestResult(0, -42535053313324984089081.486439m), // 26 + 29
+ new TestResult(0, -7808274522591953107485.8812311m), // 27 + 0
+ new TestResult(0, -7808274522591953107484.8812311m), // 27 + 1
+ new TestResult(0, -7808274522591953107486.8812311m), // 27 + 2
+ new TestResult(0, -7808274522591953107483.8812311m), // 27 + 3
+ new TestResult(0, -7808274522591953107475.8812311m), // 27 + 4
+ new TestResult(0, -7808274522591953107485.7812311m), // 27 + 5
+ new TestResult(2, 79228154705989815001590842849m), // 27 + 6
+ new TestResult(1, 0m), // 27 + 7
+ new TestResult(2, 27695494192569368656224393.651m), // 27 + 8
+ new TestResult(0, -7808274522591956311340.8372279m), // 27 + 9
+ new TestResult(2, -56275144966780826903905.910099m), // 27 + 10
+ new TestResult(0, -7808819716285195912280.1845448m), // 27 + 11
+ new TestResult(0, -7808274522591953107485.1183077m), // 27 + 12
+ new TestResult(2, -8208727582257324503458.215976m), // 27 + 13
+ new TestResult(2, 215043353262599761082564.73553m), // 27 + 14
+ new TestResult(2, 14238235104681561260553849.703m), // 27 + 15
+ new TestResult(0, -7808274522591953528609.1856942m), // 27 + 16
+ new TestResult(0, -7808250059303214807940.6807222m), // 27 + 17
+ new TestResult(2, -5331067428358977865805261.8822m), // 27 + 18
+ new TestResult(2, 102793257925283242771565683.31m), // 27 + 19
+ new TestResult(0, -7808274522584871786725.5019024m), // 27 + 20
+ new TestResult(0, -7808274522176200833546.1041886m), // 27 + 21
+ new TestResult(0, -7808274528981345597378.5174985m), // 27 + 22
+ new TestResult(0, -7808274080245670364570.8215895m), // 27 + 23
+ new TestResult(0, -7808275035425733974809.7714395m), // 27 + 24
+ new TestResult(0, -7807665582011262191781.7361413m), // 27 + 25
+ new TestResult(2, -50343327835911940073600.919018m), // 27 + 26
+ new TestResult(2, -15616549045183906214971.762462m), // 27 + 27
+ new TestResult(2, 1037799818529750445376951985.8m), // 27 + 28
+ new TestResult(0, -7808274522596950230452.3298835m), // 27 + 29
+ new TestResult(0, 1037807626804273037330059471.7m), // 28 + 0
+ new TestResult(0, 1037807626804273037330059472.7m), // 28 + 1
+ new TestResult(0, 1037807626804273037330059470.7m), // 28 + 2
+ new TestResult(0, 1037807626804273037330059473.7m), // 28 + 3
+ new TestResult(0, 1037807626804273037330059481.7m), // 28 + 4
+ new TestResult(0, 1037807626804273037330059471.8m), // 28 + 5
+ new TestResult(1, 0m), // 28 + 6
+ new TestResult(2, -78190354887460064556213890863m), // 28 + 7
+ new TestResult(0, 1065510929271364997939391351.2m), // 28 + 8
+ new TestResult(0, 1037807626804273037326855616.7m), // 28 + 9
+ new TestResult(0, 1037759159933828848456263051.7m), // 28 + 10
+ new TestResult(0, 1037807626259079344087254677.4m), // 28 + 11
+ new TestResult(0, 1037807626804273037330059472.5m), // 28 + 12
+ new TestResult(0, 1037807226351213371958663499.4m), // 28 + 13
+ new TestResult(0, 1038030478432058229044249522.3m), // 28 + 14
+ new TestResult(0, 1052053670183477190543720807.3m), // 28 + 15
+ new TestResult(0, 1037807626804273037329638348.4m), // 28 + 16
+ new TestResult(0, 1037807626828736326068359016.9m), // 28 + 17
+ new TestResult(0, 1032484367650436651417361695.7m), // 28 + 18
+ new TestResult(0, 1140608693004078872054732640.9m), // 28 + 19
+ new TestResult(0, 1037807626804273044411380232.1m), // 28 + 20
+ new TestResult(0, 1037807626804273453082333411.5m), // 28 + 21
+ new TestResult(0, 1037807626804266647937569579.1m), // 28 + 22
+ new TestResult(0, 1037807626804715383612802386.8m), // 28 + 23
+ new TestResult(0, 1037807626803760203549192147.8m), // 28 + 24
+ new TestResult(0, 1037807627413213618020975175.8m), // 28 + 25
+ new TestResult(0, 1037765091750959717343093356.7m), // 28 + 26
+ new TestResult(0, 1037799818529750445376951985.8m), // 28 + 27
+ new TestResult(0, 2075615253608546074660118943.4m), // 28 + 28
+ new TestResult(0, 1037807626804273032332936505.3m), // 28 + 29
+ new TestResult(0, -4997122966.448652425771563042m), // 29 + 0
+ new TestResult(0, -4997122965.448652425771563042m), // 29 + 1
+ new TestResult(0, -4997122967.448652425771563042m), // 29 + 2
+ new TestResult(0, -4997122964.448652425771563042m), // 29 + 3
+ new TestResult(0, -4997122956.448652425771563042m), // 29 + 4
+ new TestResult(0, -4997122966.348652425771563042m), // 29 + 5
+ new TestResult(2, 79228162514264337588546827369m), // 29 + 6
+ new TestResult(1, 0m), // 29 + 7
+ new TestResult(2, 27703302467091955612208913.083m), // 29 + 8
+ new TestResult(0, -5000326821.4046492439208143805m), // 29 + 9
+ new TestResult(2, -48466870444193870919386.47752m), // 29 + 10
+ new TestResult(2, -545193698239927760.75196617253m), // 29 + 11
+ new TestResult(0, -4997122965.685729020437688861m), // 29 + 12
+ new TestResult(2, -400453059670368518938.78339695m), // 29 + 13
+ new TestResult(2, 222851627785186717067084.16811m), // 29 + 14
+ new TestResult(2, 14246043379204148216538369.135m), // 29 + 15
+ new TestResult(0, -4997544089.7531155126859290085m), // 29 + 16
+ new TestResult(2, 24463283741176578.75185647287m), // 29 + 17
+ new TestResult(2, -5323259153836390909820742.4497m), // 29 + 18
+ new TestResult(2, 102801066199805829727550202.74m), // 29 + 19
+ new TestResult(0, 2084197793.9306762916985297548m), // 29 + 20
+ new TestResult(2, 410755150973.32839003079680737m), // 29 + 21
+ new TestResult(2, -6394389612859.0849197928536092m), // 29 + 22
+ new TestResult(2, 442341285619948.61098920729654m), // 29 + 23
+ new TestResult(2, -512838777990290.3388608002092m), // 29 + 24
+ new TestResult(2, 608940575693792737.69643732563m), // 29 + 25
+ new TestResult(2, -42535053313324984089081.486439m), // 29 + 26
+ new TestResult(2, -7808274522596950230452.3298835m), // 29 + 27
+ new TestResult(2, 1037807626804273032332936505.3m), // 29 + 28
+ new TestResult(0, -9994245932.897304851543126084m), // 29 + 29
+ };
+
+
+ // generated result list build2
+ TestResult[] trAuto_Mult_build2 = new TestResult[] {
+ new TestResult(0, 0m), // 0 * 0
+ new TestResult(0, 0m), // 0 * 1
+ new TestResult(0, 0m), // 0 * 2
+ new TestResult(0, 0m), // 0 * 3
+ new TestResult(0, 0m), // 0 * 4
+ new TestResult(0, 0m), // 0 * 5
+ new TestResult(0, 0m), // 0 * 6
+ new TestResult(0, 0m), // 0 * 7
+ new TestResult(0, 0m), // 0 * 8
+ new TestResult(0, 0m), // 0 * 9
+ new TestResult(0, 0m), // 0 * 10
+ new TestResult(0, 0m), // 0 * 11
+ new TestResult(0, 0m), // 0 * 12
+ new TestResult(0, 0m), // 0 * 13
+ new TestResult(0, 0m), // 0 * 14
+ new TestResult(0, 0m), // 0 * 15
+ new TestResult(0, 0m), // 0 * 16
+ new TestResult(0, 0m), // 0 * 17
+ new TestResult(0, 0m), // 0 * 18
+ new TestResult(0, 0m), // 0 * 19
+ new TestResult(0, 0m), // 0 * 20
+ new TestResult(0, 0m), // 0 * 21
+ new TestResult(0, 0m), // 0 * 22
+ new TestResult(0, 0m), // 0 * 23
+ new TestResult(0, 0m), // 0 * 24
+ new TestResult(0, 0m), // 0 * 25
+ new TestResult(0, 0m), // 0 * 26
+ new TestResult(0, 0m), // 0 * 27
+ new TestResult(0, 0m), // 0 * 28
+ new TestResult(0, 0m), // 0 * 29
+ new TestResult(0, 0m), // 1 * 0
+ new TestResult(0, 1m), // 1 * 1
+ new TestResult(0, -1m), // 1 * 2
+ new TestResult(0, 2m), // 1 * 3
+ new TestResult(0, 10m), // 1 * 4
+ new TestResult(0, 0.1m), // 1 * 5
+ new TestResult(0, 79228162514264337593543950335m), // 1 * 6
+ new TestResult(0, -79228162514264337593543950335m), // 1 * 7
+ new TestResult(0, 27703302467091960609331879.532m), // 1 * 8
+ new TestResult(0, -3203854.9559968181492513385018m), // 1 * 9
+ new TestResult(0, -48466870444188873796420.028868m), // 1 * 10
+ new TestResult(0, -545193693242804794.30331374676m), // 1 * 11
+ new TestResult(0, 0.7629234053338741809892531431m), // 1 * 12
+ new TestResult(0, -400453059665371395972.33474452m), // 1 * 13
+ new TestResult(0, 222851627785191714190050.61676m), // 1 * 14
+ new TestResult(0, 14246043379204153213661335.584m), // 1 * 15
+ new TestResult(0, -421123.30446308691436596648186m), // 1 * 16
+ new TestResult(0, 24463288738299545.200508898642m), // 1 * 17
+ new TestResult(0, -5323259153836385912697776.001m), // 1 * 18
+ new TestResult(0, 102801066199805834724673169.19m), // 1 * 19
+ new TestResult(0, 7081320760.3793287174700927968m), // 1 * 20
+ new TestResult(0, 415752273939.77704245656837041m), // 1 * 21
+ new TestResult(0, -6389392489892.6362673670820462m), // 1 * 22
+ new TestResult(0, 442346282742915.0596416330681m), // 1 * 23
+ new TestResult(0, -512833780867323.89020837443764m), // 1 * 24
+ new TestResult(0, 608940580690915704.1450897514m), // 1 * 25
+ new TestResult(0, -42535053313319986966115.037787m), // 1 * 26
+ new TestResult(0, -7808274522591953107485.8812311m), // 1 * 27
+ new TestResult(0, 1037807626804273037330059471.7m), // 1 * 28
+ new TestResult(0, -4997122966.448652425771563042m), // 1 * 29
+ new TestResult(0, 0m), // 2 * 0
+ new TestResult(0, -1m), // 2 * 1
+ new TestResult(0, 1m), // 2 * 2
+ new TestResult(0, -2m), // 2 * 3
+ new TestResult(0, -10m), // 2 * 4
+ new TestResult(0, -0.1m), // 2 * 5
+ new TestResult(0, -79228162514264337593543950335m), // 2 * 6
+ new TestResult(0, 79228162514264337593543950335m), // 2 * 7
+ new TestResult(0, -27703302467091960609331879.532m), // 2 * 8
+ new TestResult(0, 3203854.9559968181492513385018m), // 2 * 9
+ new TestResult(0, 48466870444188873796420.028868m), // 2 * 10
+ new TestResult(0, 545193693242804794.30331374676m), // 2 * 11
+ new TestResult(0, -0.7629234053338741809892531431m), // 2 * 12
+ new TestResult(0, 400453059665371395972.33474452m), // 2 * 13
+ new TestResult(0, -222851627785191714190050.61676m), // 2 * 14
+ new TestResult(0, -14246043379204153213661335.584m), // 2 * 15
+ new TestResult(0, 421123.30446308691436596648186m), // 2 * 16
+ new TestResult(0, -24463288738299545.200508898642m), // 2 * 17
+ new TestResult(0, 5323259153836385912697776.001m), // 2 * 18
+ new TestResult(0, -102801066199805834724673169.19m), // 2 * 19
+ new TestResult(0, -7081320760.3793287174700927968m), // 2 * 20
+ new TestResult(0, -415752273939.77704245656837041m), // 2 * 21
+ new TestResult(0, 6389392489892.6362673670820462m), // 2 * 22
+ new TestResult(0, -442346282742915.0596416330681m), // 2 * 23
+ new TestResult(0, 512833780867323.89020837443764m), // 2 * 24
+ new TestResult(0, -608940580690915704.1450897514m), // 2 * 25
+ new TestResult(0, 42535053313319986966115.037787m), // 2 * 26
+ new TestResult(0, 7808274522591953107485.8812311m), // 2 * 27
+ new TestResult(0, -1037807626804273037330059471.7m), // 2 * 28
+ new TestResult(0, 4997122966.448652425771563042m), // 2 * 29
+ new TestResult(0, 0m), // 3 * 0
+ new TestResult(0, 2m), // 3 * 1
+ new TestResult(0, -2m), // 3 * 2
+ new TestResult(0, 4m), // 3 * 3
+ new TestResult(0, 20m), // 3 * 4
+ new TestResult(0, 0.2m), // 3 * 5
+ new TestResult(1, 0m), // 3 * 6
+ new TestResult(1, 0m), // 3 * 7
+ new TestResult(0, 55406604934183921218663759.064m), // 3 * 8
+ new TestResult(0, -6407709.9119936362985026770036m), // 3 * 9
+ new TestResult(2, -96933740888377747592840.05774m), // 3 * 10
+ new TestResult(0, -1090387386485609588.6066274935m), // 3 * 11
+ new TestResult(0, 1.5258468106677483619785062862m), // 3 * 12
+ new TestResult(2, -800906119330742791944.669489m), // 3 * 13
+ new TestResult(0, 445703255570383428380101.23352m), // 3 * 14
+ new TestResult(0, 28492086758408306427322671.168m), // 3 * 15
+ new TestResult(0, -842246.6089261738287319329637m), // 3 * 16
+ new TestResult(0, 48926577476599090.401017797284m), // 3 * 17
+ new TestResult(0, -10646518307672771825395552.002m), // 3 * 18
+ new TestResult(0, 205602132399611669449346338.38m), // 3 * 19
+ new TestResult(2, 14162641520.758657434940185594m), // 3 * 20
+ new TestResult(0, 831504547879.5540849131367408m), // 3 * 21
+ new TestResult(2, -12778784979785.272534734164092m), // 3 * 22
+ new TestResult(0, 884692565485830.1192832661362m), // 3 * 23
+ new TestResult(0, -1025667561734647.7804167488753m), // 3 * 24
+ new TestResult(0, 1217881161381831408.2901795028m), // 3 * 25
+ new TestResult(2, -85070106626639973932230.07557m), // 3 * 26
+ new TestResult(0, -15616549045183906214971.762462m), // 3 * 27
+ new TestResult(0, 2075615253608546074660118943.4m), // 3 * 28
+ new TestResult(0, -9994245932.897304851543126084m), // 3 * 29
+ new TestResult(0, 0m), // 4 * 0
+ new TestResult(0, 10m), // 4 * 1
+ new TestResult(0, -10m), // 4 * 2
+ new TestResult(0, 20m), // 4 * 3
+ new TestResult(0, 100m), // 4 * 4
+ new TestResult(0, 1m), // 4 * 5
+ new TestResult(1, 0m), // 4 * 6
+ new TestResult(1, 0m), // 4 * 7
+ new TestResult(0, 277033024670919606093318795.32m), // 4 * 8
+ new TestResult(0, -32038549.559968181492513385018m), // 4 * 9
+ new TestResult(0, -484668704441888737964200.28868m), // 4 * 10
+ new TestResult(0, -5451936932428047943.0331374676m), // 4 * 11
+ new TestResult(0, 7.629234053338741809892531431m), // 4 * 12
+ new TestResult(0, -4004530596653713959723.3474452m), // 4 * 13
+ new TestResult(0, 2228516277851917141900506.1676m), // 4 * 14
+ new TestResult(0, 142460433792041532136613355.84m), // 4 * 15
+ new TestResult(0, -4211233.0446308691436596648186m), // 4 * 16
+ new TestResult(0, 244632887382995452.00508898642m), // 4 * 17
+ new TestResult(0, -53232591538363859126977760.01m), // 4 * 18
+ new TestResult(0, 1028010661998058347246731691.9m), // 4 * 19
+ new TestResult(0, 70813207603.793287174700927968m), // 4 * 20
+ new TestResult(0, 4157522739397.7704245656837041m), // 4 * 21
+ new TestResult(0, -63893924898926.362673670820462m), // 4 * 22
+ new TestResult(0, 4423462827429150.596416330681m), // 4 * 23
+ new TestResult(0, -5128337808673238.9020837443764m), // 4 * 24
+ new TestResult(0, 6089405806909157041.450897514m), // 4 * 25
+ new TestResult(0, -425350533133199869661150.37787m), // 4 * 26
+ new TestResult(0, -78082745225919531074858.812311m), // 4 * 27
+ new TestResult(0, 10378076268042730373300594717m), // 4 * 28
+ new TestResult(0, -49971229664.48652425771563042m), // 4 * 29
+ new TestResult(0, 0m), // 5 * 0
+ new TestResult(0, 0.1m), // 5 * 1
+ new TestResult(0, -0.1m), // 5 * 2
+ new TestResult(0, 0.2m), // 5 * 3
+ new TestResult(0, 1m), // 5 * 4
+ new TestResult(0, 0.01m), // 5 * 5
+ new TestResult(0, 7922816251426433759354395033.5m), // 5 * 6
+ new TestResult(0, -7922816251426433759354395033.5m), // 5 * 7
+ new TestResult(0, 2770330246709196060933187.9532m), // 5 * 8
+ new TestResult(0, -320385.49559968181492513385018m), // 5 * 9
+ new TestResult(0, -4846687044418887379642.0028868m), // 5 * 10
+ new TestResult(0, -54519369324280479.430331374676m), // 5 * 11
+ new TestResult(0, 0.0762923405333874180989253143m), // 5 * 12
+ new TestResult(0, -40045305966537139597.233474452m), // 5 * 13
+ new TestResult(0, 22285162778519171419005.061676m), // 5 * 14
+ new TestResult(0, 1424604337920415321366133.5584m), // 5 * 15
+ new TestResult(0, -42112.330446308691436596648186m), // 5 * 16
+ new TestResult(0, 2446328873829954.5200508898642m), // 5 * 17
+ new TestResult(0, -532325915383638591269777.6001m), // 5 * 18
+ new TestResult(0, 10280106619980583472467316.919m), // 5 * 19
+ new TestResult(0, 708132076.03793287174700927968m), // 5 * 20
+ new TestResult(0, 41575227393.977704245656837041m), // 5 * 21
+ new TestResult(0, -638939248989.26362673670820462m), // 5 * 22
+ new TestResult(0, 44234628274291.50596416330681m), // 5 * 23
+ new TestResult(0, -51283378086732.389020837443764m), // 5 * 24
+ new TestResult(0, 60894058069091570.41450897514m), // 5 * 25
+ new TestResult(0, -4253505331331998696611.5037787m), // 5 * 26
+ new TestResult(0, -780827452259195310748.58812311m), // 5 * 27
+ new TestResult(0, 103780762680427303733005947.17m), // 5 * 28
+ new TestResult(0, -499712296.6448652425771563042m), // 5 * 29
+ new TestResult(0, 0m), // 6 * 0
+ new TestResult(0, 79228162514264337593543950335m), // 6 * 1
+ new TestResult(0, -79228162514264337593543950335m), // 6 * 2
+ new TestResult(1, 0m), // 6 * 3
+ new TestResult(1, 0m), // 6 * 4
+ new TestResult(0, 7922816251426433759354395033.5m), // 6 * 5
+ new TestResult(1, 0m), // 6 * 6
+ new TestResult(1, 0m), // 6 * 7
+ new TestResult(1, 0m), // 6 * 8
+ new TestResult(1, 0m), // 6 * 9
+ new TestResult(1, 0m), // 6 * 10
+ new TestResult(1, 0m), // 6 * 11
+ new TestResult(4, 60445019543728147377669509413m), // 6 * 12
+ new TestResult(1, 0m), // 6 * 13
+ new TestResult(1, 0m), // 6 * 14
+ new TestResult(1, 0m), // 6 * 15
+ new TestResult(1, 0m), // 6 * 16
+ new TestResult(1, 0m), // 6 * 17
+ new TestResult(1, 0m), // 6 * 18
+ new TestResult(1, 0m), // 6 * 19
+ new TestResult(1, 0m), // 6 * 20
+ new TestResult(1, 0m), // 6 * 21
+ new TestResult(1, 0m), // 6 * 22
+ new TestResult(1, 0m), // 6 * 23
+ new TestResult(1, 0m), // 6 * 24
+ new TestResult(1, 0m), // 6 * 25
+ new TestResult(1, 0m), // 6 * 26
+ new TestResult(1, 0m), // 6 * 27
+ new TestResult(1, 0m), // 6 * 28
+ new TestResult(1, 0m), // 6 * 29
+ new TestResult(0, 0m), // 7 * 0
+ new TestResult(0, -79228162514264337593543950335m), // 7 * 1
+ new TestResult(0, 79228162514264337593543950335m), // 7 * 2
+ new TestResult(1, 0m), // 7 * 3
+ new TestResult(1, 0m), // 7 * 4
+ new TestResult(0, -7922816251426433759354395033.5m), // 7 * 5
+ new TestResult(1, 0m), // 7 * 6
+ new TestResult(1, 0m), // 7 * 7
+ new TestResult(1, 0m), // 7 * 8
+ new TestResult(1, 0m), // 7 * 9
+ new TestResult(1, 0m), // 7 * 10
+ new TestResult(1, 0m), // 7 * 11
+ new TestResult(4, -60445019543728147377669509413m), // 7 * 12
+ new TestResult(1, 0m), // 7 * 13
+ new TestResult(1, 0m), // 7 * 14
+ new TestResult(1, 0m), // 7 * 15
+ new TestResult(1, 0m), // 7 * 16
+ new TestResult(1, 0m), // 7 * 17
+ new TestResult(1, 0m), // 7 * 18
+ new TestResult(1, 0m), // 7 * 19
+ new TestResult(1, 0m), // 7 * 20
+ new TestResult(1, 0m), // 7 * 21
+ new TestResult(1, 0m), // 7 * 22
+ new TestResult(1, 0m), // 7 * 23
+ new TestResult(1, 0m), // 7 * 24
+ new TestResult(1, 0m), // 7 * 25
+ new TestResult(1, 0m), // 7 * 26
+ new TestResult(1, 0m), // 7 * 27
+ new TestResult(1, 0m), // 7 * 28
+ new TestResult(1, 0m), // 7 * 29
+ new TestResult(0, 0m), // 8 * 0
+ new TestResult(0, 27703302467091960609331879.532m), // 8 * 1
+ new TestResult(0, -27703302467091960609331879.532m), // 8 * 2
+ new TestResult(0, 55406604934183921218663759.064m), // 8 * 3
+ new TestResult(0, 277033024670919606093318795.32m), // 8 * 4
+ new TestResult(0, 2770330246709196060933187.9532m), // 8 * 5
+ new TestResult(1, 0m), // 8 * 6
+ new TestResult(1, 0m), // 8 * 7
+ new TestResult(1, 0m), // 8 * 8
+ new TestResult(1, 0m), // 8 * 9
+ new TestResult(1, 0m), // 8 * 10
+ new TestResult(1, 0m), // 8 * 11
+ new TestResult(2, 21135497857188116458095236.68m), // 8 * 12
+ new TestResult(1, 0m), // 8 * 13
+ new TestResult(1, 0m), // 8 * 14
+ new TestResult(1, 0m), // 8 * 15
+ new TestResult(1, 0m), // 8 * 16
+ new TestResult(1, 0m), // 8 * 17
+ new TestResult(1, 0m), // 8 * 18
+ new TestResult(1, 0m), // 8 * 19
+ new TestResult(1, 0m), // 8 * 20
+ new TestResult(1, 0m), // 8 * 21
+ new TestResult(1, 0m), // 8 * 22
+ new TestResult(1, 0m), // 8 * 23
+ new TestResult(1, 0m), // 8 * 24
+ new TestResult(1, 0m), // 8 * 25
+ new TestResult(1, 0m), // 8 * 26
+ new TestResult(1, 0m), // 8 * 27
+ new TestResult(1, 0m), // 8 * 28
+ new TestResult(1, 0m), // 8 * 29
+ new TestResult(0, 0m), // 9 * 0
+ new TestResult(0, -3203854.9559968181492513385018m), // 9 * 1
+ new TestResult(0, 3203854.9559968181492513385018m), // 9 * 2
+ new TestResult(0, -6407709.9119936362985026770036m), // 9 * 3
+ new TestResult(0, -32038549.559968181492513385018m), // 9 * 4
+ new TestResult(0, -320385.49559968181492513385018m), // 9 * 5
+ new TestResult(1, 0m), // 9 * 6
+ new TestResult(1, 0m), // 9 * 7
+ new TestResult(1, 0m), // 9 * 8
+ new TestResult(2, 10264686579065.373559419307221m), // 9 * 9
+ new TestResult(1, 0m), // 9 * 10
+ new TestResult(2, 1746721516074169126608222.1692m), // 9 * 11
+ new TestResult(2, -2444295.933224902121034426698m), // 9 * 12
+ new TestResult(2, 1282993519852989666698903060.5m), // 9 * 13
+ new TestResult(1, 0m), // 9 * 14
+ new TestResult(1, 0m), // 9 * 15
+ new TestResult(0, 1349217986089.8179781485646335m), // 9 * 16
+ new TestResult(0, -78376828864182146369609.767831m), // 9 * 17
+ new TestResult(1, 0m), // 9 * 18
+ new TestResult(1, 0m), // 9 * 19
+ new TestResult(0, -22687524613144469.045656755412m), // 9 * 20
+ new TestResult(0, -1332009983328901461.3254059884m), // 9 * 21
+ new TestResult(0, 20470686794551372519.831909846m), // 9 * 22
+ new TestResult(0, -1417213330232658207868.9685141m), // 9 * 23
+ new TestResult(0, 1643045050434361863551.7087135m), // 9 * 24
+ new TestResult(0, -1950957297354170624860913.7855m), // 9 * 25
+ new TestResult(1, 0m), // 9 * 26
+ new TestResult(0, 25016579026989918165002777574m), // 9 * 27
+ new TestResult(1, 0m), // 9 * 28
+ new TestResult(2, 16010057181782036.694377696165m), // 9 * 29
+ new TestResult(0, 0m), // 10 * 0
+ new TestResult(0, -48466870444188873796420.028868m), // 10 * 1
+ new TestResult(0, 48466870444188873796420.028868m), // 10 * 2
+ new TestResult(2, -96933740888377747592840.05774m), // 10 * 3
+ new TestResult(0, -484668704441888737964200.28868m), // 10 * 4
+ new TestResult(0, -4846687044418887379642.0028868m), // 10 * 5
+ new TestResult(1, 0m), // 10 * 6
+ new TestResult(1, 0m), // 10 * 7
+ new TestResult(1, 0m), // 10 * 8
+ new TestResult(1, 0m), // 10 * 9
+ new TestResult(1, 0m), // 10 * 10
+ new TestResult(1, 0m), // 10 * 11
+ new TestResult(0, -36976509845156274734545.845161m), // 10 * 12
+ new TestResult(1, 0m), // 10 * 13
+ new TestResult(1, 0m), // 10 * 14
+ new TestResult(1, 0m), // 10 * 15
+ new TestResult(2, 20410528638441139616161910791m), // 10 * 16
+ new TestResult(1, 0m), // 10 * 17
+ new TestResult(1, 0m), // 10 * 18
+ new TestResult(1, 0m), // 10 * 19
+ new TestResult(1, 0m), // 10 * 20
+ new TestResult(1, 0m), // 10 * 21
+ new TestResult(1, 0m), // 10 * 22
+ new TestResult(1, 0m), // 10 * 23
+ new TestResult(1, 0m), // 10 * 24
+ new TestResult(1, 0m), // 10 * 25
+ new TestResult(1, 0m), // 10 * 26
+ new TestResult(1, 0m), // 10 * 27
+ new TestResult(1, 0m), // 10 * 28
+ new TestResult(1, 0m), // 10 * 29
+ new TestResult(0, 0m), // 11 * 0
+ new TestResult(0, -545193693242804794.30331374676m), // 11 * 1
+ new TestResult(0, 545193693242804794.30331374676m), // 11 * 2
+ new TestResult(2, -1090387386485609588.6066274935m), // 11 * 3
+ new TestResult(0, -5451936932428047943.0331374676m), // 11 * 4
+ new TestResult(0, -54519369324280479.430331374676m), // 11 * 5
+ new TestResult(1, 0m), // 11 * 6
+ new TestResult(1, 0m), // 11 * 7
+ new TestResult(1, 0m), // 11 * 8
+ new TestResult(2, 1746721516074169126608222.1692m), // 11 * 9
+ new TestResult(1, 0m), // 11 * 10
+ new TestResult(1, 0m), // 11 * 11
+ new TestResult(0, -415941029015352223.2321562927m), // 11 * 12
+ new TestResult(1, 0m), // 11 * 13
+ new TestResult(1, 0m), // 11 * 14
+ new TestResult(1, 0m), // 11 * 15
+ new TestResult(0, 229593769670844494339647.60593m), // 11 * 16
+ new TestResult(1, 0m), // 11 * 17
+ new TestResult(1, 0m), // 11 * 18
+ new TestResult(1, 0m), // 11 * 19
+ new TestResult(0, -3860691418388152934958161711.9m), // 11 * 20
+ new TestResult(1, 0m), // 11 * 21
+ new TestResult(1, 0m), // 11 * 22
+ new TestResult(1, 0m), // 11 * 23
+ new TestResult(1, 0m), // 11 * 24
+ new TestResult(1, 0m), // 11 * 25
+ new TestResult(1, 0m), // 11 * 26
+ new TestResult(1, 0m), // 11 * 27
+ new TestResult(1, 0m), // 11 * 28
+ new TestResult(2, 2724399925666581324856736883m), // 11 * 29
+ new TestResult(0, 0m), // 12 * 0
+ new TestResult(0, 0.7629234053338741809892531431m), // 12 * 1
+ new TestResult(0, -0.7629234053338741809892531431m), // 12 * 2
+ new TestResult(0, 1.5258468106677483619785062862m), // 12 * 3
+ new TestResult(0, 7.629234053338741809892531431m), // 12 * 4
+ new TestResult(2, 0.0762923405333874180989253143m), // 12 * 5
+ new TestResult(0, 60445019543728147377669509413m), // 12 * 6
+ new TestResult(0, -60445019543728147377669509413m), // 12 * 7
+ new TestResult(0, 21135497857188116458095236.68m), // 12 * 8
+ new TestResult(0, -2444295.933224902121034426698m), // 12 * 9
+ new TestResult(0, -36976509845156274734545.845161m), // 12 * 10
+ new TestResult(0, -415941029015352223.2321562927m), // 12 * 11
+ new TestResult(0, 0.5820521224062348791152865214m), // 12 * 12
+ new TestResult(0, -305515011956274243325.23330625m), // 12 * 13
+ new TestResult(0, 170018722754075475876563.00661m), // 12 * 14
+ new TestResult(0, 10868639927396524825477357.557m), // 12 * 15
+ new TestResult(0, -321284.82550643216389212760083m), // 12 * 16
+ new TestResult(0, 18663615549889303.426127037208m), // 12 * 17
+ new TestResult(0, -4061239001119573143590088.0528m), // 12 * 18
+ new TestResult(0, 78429339497108899549297058.831m), // 12 * 19
+ new TestResult(0, 5402505348.7700567259404098662m), // 12 * 20
+ new TestResult(0, 317187140609.43641612785737895m), // 12 * 21
+ new TestResult(0, -4874617076403.5713301079734445m), // 12 * 22
+ new TestResult(0, 337476332367005.49979200414696m), // 12 * 23
+ new TestResult(0, -391252894469544.55412631906773m), // 12 * 24
+ new TestResult(0, 464575021466700199.22364418475m), // 12 * 25
+ new TestResult(0, -32450987719855972399063.033158m), // 12 * 26
+ new TestResult(0, -5957115388557583551533.0994303m), // 12 * 27
+ new TestResult(0, 791767728722982425613218218.59m), // 12 * 28
+ new TestResult(0, -3812422070.43511700405678157m), // 12 * 29
+ new TestResult(0, 0m), // 13 * 0
+ new TestResult(0, -400453059665371395972.33474452m), // 13 * 1
+ new TestResult(0, 400453059665371395972.33474452m), // 13 * 2
+ new TestResult(2, -800906119330742791944.669489m), // 13 * 3
+ new TestResult(0, -4004530596653713959723.3474452m), // 13 * 4
+ new TestResult(0, -40045305966537139597.233474452m), // 13 * 5
+ new TestResult(1, 0m), // 13 * 6
+ new TestResult(1, 0m), // 13 * 7
+ new TestResult(1, 0m), // 13 * 8
+ new TestResult(2, 1282993519852989666698903060.5m), // 13 * 9
+ new TestResult(1, 0m), // 13 * 10
+ new TestResult(1, 0m), // 13 * 11
+ new TestResult(0, -305515011956274243325.23330625m), // 13 * 12
+ new TestResult(1, 0m), // 13 * 13
+ new TestResult(1, 0m), // 13 * 14
+ new TestResult(1, 0m), // 13 * 15
+ new TestResult(2, 168640115768634908407809010.03m), // 13 * 16
+ new TestResult(1, 0m), // 13 * 17
+ new TestResult(1, 0m), // 13 * 18
+ new TestResult(1, 0m), // 13 * 19
+ new TestResult(1, 0m), // 13 * 20
+ new TestResult(1, 0m), // 13 * 21
+ new TestResult(1, 0m), // 13 * 22
+ new TestResult(1, 0m), // 13 * 23
+ new TestResult(1, 0m), // 13 * 24
+ new TestResult(1, 0m), // 13 * 25
+ new TestResult(1, 0m), // 13 * 26
+ new TestResult(1, 0m), // 13 * 27
+ new TestResult(1, 0m), // 13 * 28
+ new TestResult(1, 0m), // 13 * 29
+ new TestResult(0, 0m), // 14 * 0
+ new TestResult(0, 222851627785191714190050.61676m), // 14 * 1
+ new TestResult(0, -222851627785191714190050.61676m), // 14 * 2
+ new TestResult(0, 445703255570383428380101.23352m), // 14 * 3
+ new TestResult(0, 2228516277851917141900506.1676m), // 14 * 4
+ new TestResult(0, 22285162778519171419005.061676m), // 14 * 5
+ new TestResult(1, 0m), // 14 * 6
+ new TestResult(1, 0m), // 14 * 7
+ new TestResult(1, 0m), // 14 * 8
+ new TestResult(1, 0m), // 14 * 9
+ new TestResult(1, 0m), // 14 * 10
+ new TestResult(1, 0m), // 14 * 11
+ new TestResult(0, 170018722754075475876563.00661m), // 14 * 12
+ new TestResult(1, 0m), // 14 * 13
+ new TestResult(1, 0m), // 14 * 14
+ new TestResult(1, 0m), // 14 * 15
+ new TestResult(1, 0m), // 14 * 16
+ new TestResult(1, 0m), // 14 * 17
+ new TestResult(1, 0m), // 14 * 18
+ new TestResult(1, 0m), // 14 * 19
+ new TestResult(1, 0m), // 14 * 20
+ new TestResult(1, 0m), // 14 * 21
+ new TestResult(1, 0m), // 14 * 22
+ new TestResult(1, 0m), // 14 * 23
+ new TestResult(1, 0m), // 14 * 24
+ new TestResult(1, 0m), // 14 * 25
+ new TestResult(1, 0m), // 14 * 26
+ new TestResult(1, 0m), // 14 * 27
+ new TestResult(1, 0m), // 14 * 28
+ new TestResult(1, 0m), // 14 * 29
+ new TestResult(0, 0m), // 15 * 0
+ new TestResult(0, 14246043379204153213661335.584m), // 15 * 1
+ new TestResult(0, -14246043379204153213661335.584m), // 15 * 2
+ new TestResult(0, 28492086758408306427322671.168m), // 15 * 3
+ new TestResult(0, 142460433792041532136613355.84m), // 15 * 4
+ new TestResult(0, 1424604337920415321366133.5584m), // 15 * 5
+ new TestResult(1, 0m), // 15 * 6
+ new TestResult(1, 0m), // 15 * 7
+ new TestResult(1, 0m), // 15 * 8
+ new TestResult(1, 0m), // 15 * 9
+ new TestResult(1, 0m), // 15 * 10
+ new TestResult(1, 0m), // 15 * 11
+ new TestResult(0, 10868639927396524825477357.557m), // 15 * 12
+ new TestResult(1, 0m), // 15 * 13
+ new TestResult(1, 0m), // 15 * 14
+ new TestResult(1, 0m), // 15 * 15
+ new TestResult(1, 0m), // 15 * 16
+ new TestResult(1, 0m), // 15 * 17
+ new TestResult(1, 0m), // 15 * 18
+ new TestResult(1, 0m), // 15 * 19
+ new TestResult(1, 0m), // 15 * 20
+ new TestResult(1, 0m), // 15 * 21
+ new TestResult(1, 0m), // 15 * 22
+ new TestResult(1, 0m), // 15 * 23
+ new TestResult(1, 0m), // 15 * 24
+ new TestResult(1, 0m), // 15 * 25
+ new TestResult(1, 0m), // 15 * 26
+ new TestResult(1, 0m), // 15 * 27
+ new TestResult(1, 0m), // 15 * 28
+ new TestResult(1, 0m), // 15 * 29
+ new TestResult(0, 0m), // 16 * 0
+ new TestResult(0, -421123.30446308691436596648186m), // 16 * 1
+ new TestResult(0, 421123.30446308691436596648186m), // 16 * 2
+ new TestResult(2, -842246.6089261738287319329637m), // 16 * 3
+ new TestResult(0, -4211233.0446308691436596648186m), // 16 * 4
+ new TestResult(0, -42112.330446308691436596648186m), // 16 * 5
+ new TestResult(1, 0m), // 16 * 6
+ new TestResult(1, 0m), // 16 * 7
+ new TestResult(1, 0m), // 16 * 8
+ new TestResult(0, 1349217986089.8179781485646335m), // 16 * 9
+ new TestResult(2, 20410528638441139616161910791m), // 16 * 10
+ new TestResult(0, 229593769670844494339647.60593m), // 16 * 11
+ new TestResult(0, -321284.82550643216389212760083m), // 16 * 12
+ new TestResult(2, 168640115768634908407809010.03m), // 16 * 13
+ new TestResult(1, 0m), // 16 * 14
+ new TestResult(1, 0m), // 16 * 15
+ new TestResult(2, 177344837561.90979904837123025m), // 16 * 16
+ new TestResult(2, -10302060991507324713598.483586m), // 16 * 17
+ new TestResult(1, 0m), // 16 * 18
+ new TestResult(1, 0m), // 16 * 19
+ new TestResult(2, -2982109198574002.1833628108505m), // 16 * 20
+ new TestResult(2, -175082971439561442.82206371811m), // 16 * 21
+ new TestResult(2, 2690722078855217643.0013135833m), // 16 * 22
+ new TestResult(2, -186282328305659347664.31347679m), // 16 * 23
+ new TestResult(2, 215966256439146035447.16512997m), // 16 * 24
+ new TestResult(0, -256439069562229438659442.67473m), // 16 * 25
+ new TestResult(2, 17912502206818886711664532432m), // 16 * 26
+ new TestResult(0, 3288246369108855691627019039.6m), // 16 * 27
+ new TestResult(1, 0m), // 16 * 28
+ new TestResult(2, 2104404936439239.9111285468803m), // 16 * 29
+ new TestResult(0, 0m), // 17 * 0
+ new TestResult(0, 24463288738299545.200508898642m), // 17 * 1
+ new TestResult(0, -24463288738299545.200508898642m), // 17 * 2
+ new TestResult(0, 48926577476599090.401017797284m), // 17 * 3
+ new TestResult(0, 244632887382995452.00508898642m), // 17 * 4
+ new TestResult(0, 2446328873829954.5200508898642m), // 17 * 5
+ new TestResult(1, 0m), // 17 * 6
+ new TestResult(1, 0m), // 17 * 7
+ new TestResult(1, 0m), // 17 * 8
+ new TestResult(0, -78376828864182146369609.767831m), // 17 * 9
+ new TestResult(1, 0m), // 17 * 10
+ new TestResult(1, 0m), // 17 * 11
+ new TestResult(0, 18663615549889303.426127037208m), // 17 * 12
+ new TestResult(1, 0m), // 17 * 13
+ new TestResult(1, 0m), // 17 * 14
+ new TestResult(1, 0m), // 17 * 15
+ new TestResult(2, -10302060991507324713598.483586m), // 17 * 16
+ new TestResult(1, 0m), // 17 * 17
+ new TestResult(1, 0m), // 17 * 18
+ new TestResult(1, 0m), // 17 * 19
+ new TestResult(0, 173232394409674404469121757.58m), // 17 * 20
+ new TestResult(2, 10170667920993375211218037940m), // 17 * 21
+ new TestResult(1, 0m), // 17 * 22
+ new TestResult(1, 0m), // 17 * 23
+ new TestResult(1, 0m), // 17 * 24
+ new TestResult(1, 0m), // 17 * 25
+ new TestResult(1, 0m), // 17 * 26
+ new TestResult(1, 0m), // 17 * 27
+ new TestResult(1, 0m), // 17 * 28
+ new TestResult(0, -122246061989021334943606343.1m), // 17 * 29
+ new TestResult(0, 0m), // 18 * 0
+ new TestResult(0, -5323259153836385912697776.001m), // 18 * 1
+ new TestResult(0, 5323259153836385912697776.001m), // 18 * 2
+ new TestResult(0, -10646518307672771825395552.002m), // 18 * 3
+ new TestResult(0, -53232591538363859126977760.01m), // 18 * 4
+ new TestResult(0, -532325915383638591269777.6001m), // 18 * 5
+ new TestResult(1, 0m), // 18 * 6
+ new TestResult(1, 0m), // 18 * 7
+ new TestResult(1, 0m), // 18 * 8
+ new TestResult(1, 0m), // 18 * 9
+ new TestResult(1, 0m), // 18 * 10
+ new TestResult(1, 0m), // 18 * 11
+ new TestResult(2, -4061239001119573143590088.0528m), // 18 * 12
+ new TestResult(1, 0m), // 18 * 13
+ new TestResult(1, 0m), // 18 * 14
+ new TestResult(1, 0m), // 18 * 15
+ new TestResult(1, 0m), // 18 * 16
+ new TestResult(1, 0m), // 18 * 17
+ new TestResult(1, 0m), // 18 * 18
+ new TestResult(1, 0m), // 18 * 19
+ new TestResult(1, 0m), // 18 * 20
+ new TestResult(1, 0m), // 18 * 21
+ new TestResult(1, 0m), // 18 * 22
+ new TestResult(1, 0m), // 18 * 23
+ new TestResult(1, 0m), // 18 * 24
+ new TestResult(1, 0m), // 18 * 25
+ new TestResult(1, 0m), // 18 * 26
+ new TestResult(1, 0m), // 18 * 27
+ new TestResult(1, 0m), // 18 * 28
+ new TestResult(1, 0m), // 18 * 29
+ new TestResult(0, 0m), // 19 * 0
+ new TestResult(0, 102801066199805834724673169.19m), // 19 * 1
+ new TestResult(0, -102801066199805834724673169.19m), // 19 * 2
+ new TestResult(0, 205602132399611669449346338.38m), // 19 * 3
+ new TestResult(0, 1028010661998058347246731691.9m), // 19 * 4
+ new TestResult(0, 10280106619980583472467316.919m), // 19 * 5
+ new TestResult(1, 0m), // 19 * 6
+ new TestResult(1, 0m), // 19 * 7
+ new TestResult(1, 0m), // 19 * 8
+ new TestResult(1, 0m), // 19 * 9
+ new TestResult(1, 0m), // 19 * 10
+ new TestResult(1, 0m), // 19 * 11
+ new TestResult(0, 78429339497108899549297058.831m), // 19 * 12
+ new TestResult(1, 0m), // 19 * 13
+ new TestResult(1, 0m), // 19 * 14
+ new TestResult(1, 0m), // 19 * 15
+ new TestResult(1, 0m), // 19 * 16
+ new TestResult(1, 0m), // 19 * 17
+ new TestResult(1, 0m), // 19 * 18
+ new TestResult(1, 0m), // 19 * 19
+ new TestResult(1, 0m), // 19 * 20
+ new TestResult(1, 0m), // 19 * 21
+ new TestResult(1, 0m), // 19 * 22
+ new TestResult(1, 0m), // 19 * 23
+ new TestResult(1, 0m), // 19 * 24
+ new TestResult(1, 0m), // 19 * 25
+ new TestResult(1, 0m), // 19 * 26
+ new TestResult(1, 0m), // 19 * 27
+ new TestResult(1, 0m), // 19 * 28
+ new TestResult(1, 0m), // 19 * 29
+ new TestResult(0, 0m), // 20 * 0
+ new TestResult(0, 7081320760.3793287174700927968m), // 20 * 1
+ new TestResult(0, -7081320760.3793287174700927968m), // 20 * 2
+ new TestResult(2, 14162641520.758657434940185594m), // 20 * 3
+ new TestResult(0, 70813207603.793287174700927968m), // 20 * 4
+ new TestResult(0, 708132076.03793287174700927968m), // 20 * 5
+ new TestResult(1, 0m), // 20 * 6
+ new TestResult(1, 0m), // 20 * 7
+ new TestResult(1, 0m), // 20 * 8
+ new TestResult(0, -22687524613144469.045656755412m), // 20 * 9
+ new TestResult(1, 0m), // 20 * 10
+ new TestResult(0, -3860691418388152934958161711.9m), // 20 * 11
+ new TestResult(0, 5402505348.7700567259404098662m), // 20 * 12
+ new TestResult(1, 0m), // 20 * 13
+ new TestResult(1, 0m), // 20 * 14
+ new TestResult(1, 0m), // 20 * 15
+ new TestResult(2, -2982109198574002.1833628108505m), // 20 * 16
+ new TestResult(2, 173232394409674404469121757.58m), // 20 * 17
+ new TestResult(1, 0m), // 20 * 18
+ new TestResult(1, 0m), // 20 * 19
+ new TestResult(0, 50145103711379274243.914175878m), // 20 * 20
+ new TestResult(2, 2944075208624656937377.9493098m), // 20 * 21
+ new TestResult(0, -45245337684888495429839.445203m), // 20 * 22
+ new TestResult(2, 3132395915264028802867467.4171m), // 20 * 23
+ new TestResult(2, -3631540499079604049748263.216m), // 20 * 24
+ new TestResult(0, 4312103575884025168661620716.9m), // 20 * 25
+ new TestResult(1, 0m), // 20 * 26
+ new TestResult(1, 0m), // 20 * 27
+ new TestResult(1, 0m), // 20 * 28
+ new TestResult(2, -35386230604481178142.543841269m), // 20 * 29
+ new TestResult(0, 0m), // 21 * 0
+ new TestResult(0, 415752273939.77704245656837041m), // 21 * 1
+ new TestResult(0, -415752273939.77704245656837041m), // 21 * 2
+ new TestResult(2, 831504547879.5540849131367408m), // 21 * 3
+ new TestResult(0, 4157522739397.7704245656837041m), // 21 * 4
+ new TestResult(0, 41575227393.977704245656837041m), // 21 * 5
+ new TestResult(1, 0m), // 21 * 6
+ new TestResult(1, 0m), // 21 * 7
+ new TestResult(1, 0m), // 21 * 8
+ new TestResult(2, -1332009983328901461.3254059884m), // 21 * 9
+ new TestResult(1, 0m), // 21 * 10
+ new TestResult(1, 0m), // 21 * 11
+ new TestResult(0, 317187140609.43641612785737895m), // 21 * 12
+ new TestResult(1, 0m), // 21 * 13
+ new TestResult(1, 0m), // 21 * 14
+ new TestResult(1, 0m), // 21 * 15
+ new TestResult(2, -175082971439561442.82206371811m), // 21 * 16
+ new TestResult(2, 10170667920993375211218037940m), // 21 * 17
+ new TestResult(1, 0m), // 21 * 18
+ new TestResult(1, 0m), // 21 * 19
+ new TestResult(2, 2944075208624656937377.9493098m), // 21 * 20
+ new TestResult(2, 172849953286095412912252.49708m), // 21 * 21
+ new TestResult(2, -2656404456766597431365611.212m), // 21 * 22
+ new TestResult(0, 183906472919174492029733196.17m), // 21 * 23
+ new TestResult(0, -213211810548723232636647639.7m), // 21 * 24
+ new TestResult(1, 0m), // 21 * 25
+ new TestResult(1, 0m), // 21 * 26
+ new TestResult(1, 0m), // 21 * 27
+ new TestResult(1, 0m), // 21 * 28
+ new TestResult(0, -2077565236457711426002.3992246m), // 21 * 29
+ new TestResult(0, 0m), // 22 * 0
+ new TestResult(0, -6389392489892.6362673670820462m), // 22 * 1
+ new TestResult(0, 6389392489892.6362673670820462m), // 22 * 2
+ new TestResult(2, -12778784979785.272534734164092m), // 22 * 3
+ new TestResult(0, -63893924898926.362673670820462m), // 22 * 4
+ new TestResult(0, -638939248989.26362673670820462m), // 22 * 5
+ new TestResult(1, 0m), // 22 * 6
+ new TestResult(1, 0m), // 22 * 7
+ new TestResult(1, 0m), // 22 * 8
+ new TestResult(2, 20470686794551372519.831909846m), // 22 * 9
+ new TestResult(1, 0m), // 22 * 10
+ new TestResult(1, 0m), // 22 * 11
+ new TestResult(0, -4874617076403.5713301079734445m), // 22 * 12
+ new TestResult(1, 0m), // 22 * 13
+ new TestResult(1, 0m), // 22 * 14
+ new TestResult(1, 0m), // 22 * 15
+ new TestResult(2, 2690722078855217643.0013135833m), // 22 * 16
+ new TestResult(1, 0m), // 22 * 17
+ new TestResult(1, 0m), // 22 * 18
+ new TestResult(1, 0m), // 22 * 19
+ new TestResult(0, -45245337684888495429839.445203m), // 22 * 20
+ new TestResult(2, -2656404456766597431365611.212m), // 22 * 21
+ new TestResult(2, 40824336389896422046045259.169m), // 22 * 22
+ new TestResult(2, -2826324016889506134750576955.1m), // 22 * 23
+ new TestResult(2, 3276696308036925201560804370m), // 22 * 24
+ new TestResult(1, 0m), // 22 * 25
+ new TestResult(1, 0m), // 22 * 26
+ new TestResult(1, 0m), // 22 * 27
+ new TestResult(1, 0m), // 22 * 28
+ new TestResult(2, 31928579952897032005741.500403m), // 22 * 29
+ new TestResult(0, 0m), // 23 * 0
+ new TestResult(0, 442346282742915.0596416330681m), // 23 * 1
+ new TestResult(0, -442346282742915.0596416330681m), // 23 * 2
+ new TestResult(0, 884692565485830.1192832661362m), // 23 * 3
+ new TestResult(0, 4423462827429150.596416330681m), // 23 * 4
+ new TestResult(0, 44234628274291.50596416330681m), // 23 * 5
+ new TestResult(1, 0m), // 23 * 6
+ new TestResult(1, 0m), // 23 * 7
+ new TestResult(1, 0m), // 23 * 8
+ new TestResult(2, -1417213330232658207868.9685141m), // 23 * 9
+ new TestResult(1, 0m), // 23 * 10
+ new TestResult(1, 0m), // 23 * 11
+ new TestResult(2, 337476332367005.49979200414696m), // 23 * 12
+ new TestResult(1, 0m), // 23 * 13
+ new TestResult(1, 0m), // 23 * 14
+ new TestResult(1, 0m), // 23 * 15
+ new TestResult(2, -186282328305659347664.31347679m), // 23 * 16
+ new TestResult(1, 0m), // 23 * 17
+ new TestResult(1, 0m), // 23 * 18
+ new TestResult(1, 0m), // 23 * 19
+ new TestResult(2, 3132395915264028802867467.4171m), // 23 * 20
+ new TestResult(0, 183906472919174492029733196.17m), // 23 * 21
+ new TestResult(2, -2826324016889506134750576955.1m), // 23 * 22
+ new TestResult(1, 0m), // 23 * 23
+ new TestResult(1, 0m), // 23 * 24
+ new TestResult(1, 0m), // 23 * 25
+ new TestResult(1, 0m), // 23 * 26
+ new TestResult(1, 0m), // 23 * 27
+ new TestResult(1, 0m), // 23 * 28
+ new TestResult(2, -2210458768617810051106106.871m), // 23 * 29
+ new TestResult(0, 0m), // 24 * 0
+ new TestResult(0, -512833780867323.89020837443764m), // 24 * 1
+ new TestResult(0, 512833780867323.89020837443764m), // 24 * 2
+ new TestResult(2, -1025667561734647.7804167488753m), // 24 * 3
+ new TestResult(0, -5128337808673238.9020837443764m), // 24 * 4
+ new TestResult(0, -51283378086732.389020837443764m), // 24 * 5
+ new TestResult(1, 0m), // 24 * 6
+ new TestResult(1, 0m), // 24 * 7
+ new TestResult(1, 0m), // 24 * 8
+ new TestResult(0, 1643045050434361863551.7087135m), // 24 * 9
+ new TestResult(1, 0m), // 24 * 10
+ new TestResult(1, 0m), // 24 * 11
+ new TestResult(0, -391252894469544.55412631906773m), // 24 * 12
+ new TestResult(1, 0m), // 24 * 13
+ new TestResult(1, 0m), // 24 * 14
+ new TestResult(1, 0m), // 24 * 15
+ new TestResult(2, 215966256439146035447.16512997m), // 24 * 16
+ new TestResult(1, 0m), // 24 * 17
+ new TestResult(1, 0m), // 24 * 18
+ new TestResult(1, 0m), // 24 * 19
+ new TestResult(2, -3631540499079604049748263.216m), // 24 * 20
+ new TestResult(0, -213211810548723232636647639.7m), // 24 * 21
+ new TestResult(2, 3276696308036925201560804370m), // 24 * 22
+ new TestResult(1, 0m), // 24 * 23
+ new TestResult(1, 0m), // 24 * 24
+ new TestResult(1, 0m), // 24 * 25
+ new TestResult(1, 0m), // 24 * 26
+ new TestResult(1, 0m), // 24 * 27
+ new TestResult(1, 0m), // 24 * 28
+ new TestResult(2, 2562693464342799730524457.4865m), // 24 * 29
+ new TestResult(0, 0m), // 25 * 0
+ new TestResult(0, 608940580690915704.1450897514m), // 25 * 1
+ new TestResult(0, -608940580690915704.1450897514m), // 25 * 2
+ new TestResult(0, 1217881161381831408.2901795028m), // 25 * 3
+ new TestResult(0, 6089405806909157041.450897514m), // 25 * 4
+ new TestResult(0, 60894058069091570.41450897514m), // 25 * 5
+ new TestResult(1, 0m), // 25 * 6
+ new TestResult(1, 0m), // 25 * 7
+ new TestResult(1, 0m), // 25 * 8
+ new TestResult(0, -1950957297354170624860913.7855m), // 25 * 9
+ new TestResult(1, 0m), // 25 * 10
+ new TestResult(1, 0m), // 25 * 11
+ new TestResult(0, 464575021466700199.22364418475m), // 25 * 12
+ new TestResult(1, 0m), // 25 * 13
+ new TestResult(1, 0m), // 25 * 14
+ new TestResult(1, 0m), // 25 * 15
+ new TestResult(0, -256439069562229438659442.67473m), // 25 * 16
+ new TestResult(1, 0m), // 25 * 17
+ new TestResult(1, 0m), // 25 * 18
+ new TestResult(1, 0m), // 25 * 19
+ new TestResult(0, 4312103575884025168661620716.9m), // 25 * 20
+ new TestResult(1, 0m), // 25 * 21
+ new TestResult(1, 0m), // 25 * 22
+ new TestResult(1, 0m), // 25 * 23
+ new TestResult(1, 0m), // 25 * 24
+ new TestResult(1, 0m), // 25 * 25
+ new TestResult(1, 0m), // 25 * 26
+ new TestResult(1, 0m), // 25 * 27
+ new TestResult(1, 0m), // 25 * 28
+ new TestResult(0, -3042950960973153681431212945.8m), // 25 * 29
+ new TestResult(0, 0m), // 26 * 0
+ new TestResult(0, -42535053313319986966115.037787m), // 26 * 1
+ new TestResult(0, 42535053313319986966115.037787m), // 26 * 2
+ new TestResult(2, -85070106626639973932230.07557m), // 26 * 3
+ new TestResult(0, -425350533133199869661150.37787m), // 26 * 4
+ new TestResult(0, -4253505331331998696611.5037787m), // 26 * 5
+ new TestResult(1, 0m), // 26 * 6
+ new TestResult(1, 0m), // 26 * 7
+ new TestResult(1, 0m), // 26 * 8
+ new TestResult(1, 0m), // 26 * 9
+ new TestResult(1, 0m), // 26 * 10
+ new TestResult(1, 0m), // 26 * 11
+ new TestResult(0, -32450987719855972399063.033158m), // 26 * 12
+ new TestResult(1, 0m), // 26 * 13
+ new TestResult(1, 0m), // 26 * 14
+ new TestResult(1, 0m), // 26 * 15
+ new TestResult(2, 17912502206818886711664532432m), // 26 * 16
+ new TestResult(1, 0m), // 26 * 17
+ new TestResult(1, 0m), // 26 * 18
+ new TestResult(1, 0m), // 26 * 19
+ new TestResult(1, 0m), // 26 * 20
+ new TestResult(1, 0m), // 26 * 21
+ new TestResult(1, 0m), // 26 * 22
+ new TestResult(1, 0m), // 26 * 23
+ new TestResult(1, 0m), // 26 * 24
+ new TestResult(1, 0m), // 26 * 25
+ new TestResult(1, 0m), // 26 * 26
+ new TestResult(1, 0m), // 26 * 27
+ new TestResult(1, 0m), // 26 * 28
+ new TestResult(1, 0m), // 26 * 29
+ new TestResult(0, 0m), // 27 * 0
+ new TestResult(0, -7808274522591953107485.8812311m), // 27 * 1
+ new TestResult(0, 7808274522591953107485.8812311m), // 27 * 2
+ new TestResult(2, -15616549045183906214971.762462m), // 27 * 3
+ new TestResult(0, -78082745225919531074858.812311m), // 27 * 4
+ new TestResult(0, -780827452259195310748.58812311m), // 27 * 5
+ new TestResult(1, 0m), // 27 * 6
+ new TestResult(1, 0m), // 27 * 7
+ new TestResult(1, 0m), // 27 * 8
+ new TestResult(0, 25016579026989918165002777574m), // 27 * 9
+ new TestResult(1, 0m), // 27 * 10
+ new TestResult(1, 0m), // 27 * 11
+ new TestResult(0, -5957115388557583551533.0994303m), // 27 * 12
+ new TestResult(1, 0m), // 27 * 13
+ new TestResult(1, 0m), // 27 * 14
+ new TestResult(1, 0m), // 27 * 15
+ new TestResult(0, 3288246369108855691627019039.6m), // 27 * 16
+ new TestResult(1, 0m), // 27 * 17
+ new TestResult(1, 0m), // 27 * 18
+ new TestResult(1, 0m), // 27 * 19
+ new TestResult(1, 0m), // 27 * 20
+ new TestResult(1, 0m), // 27 * 21
+ new TestResult(1, 0m), // 27 * 22
+ new TestResult(1, 0m), // 27 * 23
+ new TestResult(1, 0m), // 27 * 24
+ new TestResult(1, 0m), // 27 * 25
+ new TestResult(1, 0m), // 27 * 26
+ new TestResult(1, 0m), // 27 * 27
+ new TestResult(1, 0m), // 27 * 28
+ new TestResult(1, 0m), // 27 * 29
+ new TestResult(0, 0m), // 28 * 0
+ new TestResult(0, 1037807626804273037330059471.7m), // 28 * 1
+ new TestResult(0, -1037807626804273037330059471.7m), // 28 * 2
+ new TestResult(0, 2075615253608546074660118943.4m), // 28 * 3
+ new TestResult(0, 10378076268042730373300594717m), // 28 * 4
+ new TestResult(0, 103780762680427303733005947.17m), // 28 * 5
+ new TestResult(1, 0m), // 28 * 6
+ new TestResult(1, 0m), // 28 * 7
+ new TestResult(1, 0m), // 28 * 8
+ new TestResult(1, 0m), // 28 * 9
+ new TestResult(1, 0m), // 28 * 10
+ new TestResult(1, 0m), // 28 * 11
+ new TestResult(0, 791767728722982425613218218.59m), // 28 * 12
+ new TestResult(1, 0m), // 28 * 13
+ new TestResult(1, 0m), // 28 * 14
+ new TestResult(1, 0m), // 28 * 15
+ new TestResult(1, 0m), // 28 * 16
+ new TestResult(1, 0m), // 28 * 17
+ new TestResult(1, 0m), // 28 * 18
+ new TestResult(1, 0m), // 28 * 19
+ new TestResult(1, 0m), // 28 * 20
+ new TestResult(1, 0m), // 28 * 21
+ new TestResult(1, 0m), // 28 * 22
+ new TestResult(1, 0m), // 28 * 23
+ new TestResult(1, 0m), // 28 * 24
+ new TestResult(1, 0m), // 28 * 25
+ new TestResult(1, 0m), // 28 * 26
+ new TestResult(1, 0m), // 28 * 27
+ new TestResult(1, 0m), // 28 * 28
+ new TestResult(1, 0m), // 28 * 29
+ new TestResult(0, 0m), // 29 * 0
+ new TestResult(0, -4997122966.448652425771563042m), // 29 * 1
+ new TestResult(0, 4997122966.448652425771563042m), // 29 * 2
+ new TestResult(0, -9994245932.897304851543126084m), // 29 * 3
+ new TestResult(0, -49971229664.48652425771563042m), // 29 * 4
+ new TestResult(0, -499712296.6448652425771563042m), // 29 * 5
+ new TestResult(1, 0m), // 29 * 6
+ new TestResult(1, 0m), // 29 * 7
+ new TestResult(1, 0m), // 29 * 8
+ new TestResult(2, 16010057181782036.694377696165m), // 29 * 9
+ new TestResult(1, 0m), // 29 * 10
+ new TestResult(2, 2724399925666581324856736883m), // 29 * 11
+ new TestResult(2, -3812422070.43511700405678157m), // 29 * 12
+ new TestResult(1, 0m), // 29 * 13
+ new TestResult(1, 0m), // 29 * 14
+ new TestResult(1, 0m), // 29 * 15
+ new TestResult(2, 2104404936439239.9111285468803m), // 29 * 16
+ new TestResult(2, -122246061989021334943606343.1m), // 29 * 17
+ new TestResult(1, 0m), // 29 * 18
+ new TestResult(1, 0m), // 29 * 19
+ new TestResult(0, -35386230604481178142.543841269m), // 29 * 20
+ new TestResult(0, -2077565236457711426002.3992246m), // 29 * 21
+ new TestResult(2, 31928579952897032005741.500403m), // 29 * 22
+ new TestResult(2, -2210458768617810051106106.871m), // 29 * 23
+ new TestResult(2, 2562693464342799730524457.4865m), // 29 * 24
+ new TestResult(0, -3042950960973153681431212945.8m), // 29 * 25
+ new TestResult(1, 0m), // 29 * 26
+ new TestResult(1, 0m), // 29 * 27
+ new TestResult(1, 0m), // 29 * 28
+ new TestResult(0, 24971237941808579837.350664893m), // 29 * 29
+ };
+
+
+ // generated result list build2
+ TestResult[] trAuto_Div_build2 = new TestResult[] {
+ new TestResult(3, 0m), // 0 / 0
+ new TestResult(0, 0m), // 0 / 1
+ new TestResult(0, 0m), // 0 / 2
+ new TestResult(0, 0m), // 0 / 3
+ new TestResult(0, 0m), // 0 / 4
+ new TestResult(0, 0m), // 0 / 5
+ new TestResult(0, 0m), // 0 / 6
+ new TestResult(0, 0m), // 0 / 7
+ new TestResult(0, 0m), // 0 / 8
+ new TestResult(0, 0m), // 0 / 9
+ new TestResult(0, 0m), // 0 / 10
+ new TestResult(0, 0m), // 0 / 11
+ new TestResult(0, 0m), // 0 / 12
+ new TestResult(0, 0m), // 0 / 13
+ new TestResult(0, 0m), // 0 / 14
+ new TestResult(0, 0m), // 0 / 15
+ new TestResult(0, 0m), // 0 / 16
+ new TestResult(0, 0m), // 0 / 17
+ new TestResult(0, 0m), // 0 / 18
+ new TestResult(0, 0m), // 0 / 19
+ new TestResult(0, 0m), // 0 / 20
+ new TestResult(0, 0m), // 0 / 21
+ new TestResult(0, 0m), // 0 / 22
+ new TestResult(0, 0m), // 0 / 23
+ new TestResult(0, 0m), // 0 / 24
+ new TestResult(0, 0m), // 0 / 25
+ new TestResult(0, 0m), // 0 / 26
+ new TestResult(0, 0m), // 0 / 27
+ new TestResult(0, 0m), // 0 / 28
+ new TestResult(0, 0m), // 0 / 29
+ new TestResult(3, 0m), // 1 / 0
+ new TestResult(0, 1m), // 1 / 1
+ new TestResult(0, -1m), // 1 / 2
+ new TestResult(0, 0.5m), // 1 / 3
+ new TestResult(0, 0.1m), // 1 / 4
+ new TestResult(0, 10m), // 1 / 5
+ new TestResult(0, 0m), // 1 / 6
+ new TestResult(0, 0m), // 1 / 7
+ new TestResult(2, 3.61E-26m), // 1 / 8
+ new TestResult(2, -3.121239924198969049581E-07m), // 1 / 9
+ new TestResult(2, -2.06327E-23m), // 1 / 10
+ new TestResult(2, -1.8342105061E-18m), // 1 / 11
+ new TestResult(0, 1.3107475704751451797758879069m), // 1 / 12
+ new TestResult(2, -2.4971716E-21m), // 1 / 13
+ new TestResult(2, 4.4873E-24m), // 1 / 14
+ new TestResult(2, 7.02E-26m), // 1 / 15
+ new TestResult(2, -2.3746014276625098667414E-06m), // 1 / 16
+ new TestResult(2, 4.08775782642E-17m), // 1 / 17
+ new TestResult(2, -1.879E-25m), // 1 / 18
+ new TestResult(2, 9.7E-27m), // 1 / 19
+ new TestResult(2, 1.412165941691409118E-10m), // 1 / 20
+ new TestResult(2, 2.4052784859689137E-12m), // 1 / 21
+ new TestResult(2, -1.565094023542766E-13m), // 1 / 22
+ new TestResult(2, 2.2606723262128E-15m), // 1 / 23
+ new TestResult(2, -1.9499495495573E-15m), // 1 / 24
+ new TestResult(2, 1.6421963517E-18m), // 1 / 25
+ new TestResult(2, -2.351E-23m), // 1 / 26
+ new TestResult(2, -1.280693E-22m), // 1 / 27
+ new TestResult(2, 1E-27m), // 1 / 28
+ new TestResult(2, -2.00115147598754898E-10m), // 1 / 29
+ new TestResult(3, 0m), // 2 / 0
+ new TestResult(0, -1m), // 2 / 1
+ new TestResult(0, 1m), // 2 / 2
+ new TestResult(0, -0.5m), // 2 / 3
+ new TestResult(0, -0.1m), // 2 / 4
+ new TestResult(0, -10m), // 2 / 5
+ new TestResult(0, 0m), // 2 / 6
+ new TestResult(0, 0m), // 2 / 7
+ new TestResult(2, -3.61E-26m), // 2 / 8
+ new TestResult(2, 3.121239924198969049581E-07m), // 2 / 9
+ new TestResult(2, 2.06327E-23m), // 2 / 10
+ new TestResult(2, 1.8342105061E-18m), // 2 / 11
+ new TestResult(0, -1.3107475704751451797758879069m), // 2 / 12
+ new TestResult(2, 2.4971716E-21m), // 2 / 13
+ new TestResult(2, -4.4873E-24m), // 2 / 14
+ new TestResult(2, -7.02E-26m), // 2 / 15
+ new TestResult(2, 2.3746014276625098667414E-06m), // 2 / 16
+ new TestResult(2, -4.08775782642E-17m), // 2 / 17
+ new TestResult(2, 1.879E-25m), // 2 / 18
+ new TestResult(2, -9.7E-27m), // 2 / 19
+ new TestResult(2, -1.412165941691409118E-10m), // 2 / 20
+ new TestResult(2, -2.4052784859689137E-12m), // 2 / 21
+ new TestResult(2, 1.565094023542766E-13m), // 2 / 22
+ new TestResult(2, -2.2606723262128E-15m), // 2 / 23
+ new TestResult(2, 1.9499495495573E-15m), // 2 / 24
+ new TestResult(2, -1.6421963517E-18m), // 2 / 25
+ new TestResult(2, 2.351E-23m), // 2 / 26
+ new TestResult(2, 1.280693E-22m), // 2 / 27
+ new TestResult(2, -1E-27m), // 2 / 28
+ new TestResult(2, 2.00115147598754898E-10m), // 2 / 29
+ new TestResult(3, 0m), // 3 / 0
+ new TestResult(0, 2m), // 3 / 1
+ new TestResult(0, -2m), // 3 / 2
+ new TestResult(0, 1m), // 3 / 3
+ new TestResult(0, 0.2m), // 3 / 4
+ new TestResult(0, 20m), // 3 / 5
+ new TestResult(0, 0m), // 3 / 6
+ new TestResult(0, 0m), // 3 / 7
+ new TestResult(2, 7.22E-26m), // 3 / 8
+ new TestResult(2, -6.242479848397938099161E-07m), // 3 / 9
+ new TestResult(2, -4.12653E-23m), // 3 / 10
+ new TestResult(2, -3.6684210122E-18m), // 3 / 11
+ new TestResult(0, 2.6214951409502903595517758138m), // 3 / 12
+ new TestResult(2, -4.9943432E-21m), // 3 / 13
+ new TestResult(2, 8.9746E-24m), // 3 / 14
+ new TestResult(2, 1.404E-25m), // 3 / 15
+ new TestResult(2, -4.7492028553250197334829E-06m), // 3 / 16
+ new TestResult(2, 8.17551565284E-17m), // 3 / 17
+ new TestResult(2, -3.757E-25m), // 3 / 18
+ new TestResult(2, 1.95E-26m), // 3 / 19
+ new TestResult(2, 2.824331883382818237E-10m), // 3 / 20
+ new TestResult(2, 4.8105569719378275E-12m), // 3 / 21
+ new TestResult(2, -3.130188047085533E-13m), // 3 / 22
+ new TestResult(2, 4.5213446524256E-15m), // 3 / 23
+ new TestResult(2, -3.8998990991146E-15m), // 3 / 24
+ new TestResult(2, 3.2843927034E-18m), // 3 / 25
+ new TestResult(2, -4.702E-23m), // 3 / 26
+ new TestResult(2, -2.561385E-22m), // 3 / 27
+ new TestResult(2, 1.9E-27m), // 3 / 28
+ new TestResult(2, -4.002302951975097959E-10m), // 3 / 29
+ new TestResult(3, 0m), // 4 / 0
+ new TestResult(0, 10m), // 4 / 1
+ new TestResult(0, -10m), // 4 / 2
+ new TestResult(0, 5m), // 4 / 3
+ new TestResult(0, 1m), // 4 / 4
+ new TestResult(0, 100m), // 4 / 5
+ new TestResult(2, 1E-28m), // 4 / 6
+ new TestResult(2, -1E-28m), // 4 / 7
+ new TestResult(2, 3.61E-25m), // 4 / 8
+ new TestResult(2, -3.1212399241989690495806E-06m), // 4 / 9
+ new TestResult(2, -2.063265E-22m), // 4 / 10
+ new TestResult(2, -1.83421050609E-17m), // 4 / 11
+ new TestResult(0, 13.107475704751451797758879069m), // 4 / 12
+ new TestResult(2, -2.49717158E-20m), // 4 / 13
+ new TestResult(2, 4.48729E-23m), // 4 / 14
+ new TestResult(2, 7.019E-25m), // 4 / 15
+ new TestResult(2, -2.37460142766250986674143E-05m), // 4 / 16
+ new TestResult(2, 4.087757826422E-16m), // 4 / 17
+ new TestResult(2, -1.8785E-24m), // 4 / 18
+ new TestResult(2, 9.73E-26m), // 4 / 19
+ new TestResult(2, 1.4121659416914091185E-09m), // 4 / 20
+ new TestResult(2, 2.40527848596891375E-11m), // 4 / 21
+ new TestResult(2, -1.5650940235427663E-12m), // 4 / 22
+ new TestResult(2, 2.26067232621278E-14m), // 4 / 23
+ new TestResult(2, -1.94994954955729E-14m), // 4 / 24
+ new TestResult(2, 1.64219635168E-17m), // 4 / 25
+ new TestResult(2, -2.351002E-22m), // 4 / 26
+ new TestResult(2, -1.2806927E-21m), // 4 / 27
+ new TestResult(2, 9.6E-27m), // 4 / 28
+ new TestResult(2, -2.0011514759875489796E-09m), // 4 / 29
+ new TestResult(3, 0m), // 5 / 0
+ new TestResult(0, 0.1m), // 5 / 1
+ new TestResult(0, -0.1m), // 5 / 2
+ new TestResult(0, 0.05m), // 5 / 3
+ new TestResult(0, 0.01m), // 5 / 4
+ new TestResult(0, 1m), // 5 / 5
+ new TestResult(0, 0m), // 5 / 6
+ new TestResult(0, 0m), // 5 / 7
+ new TestResult(2, 3.6E-27m), // 5 / 8
+ new TestResult(2, -3.12123992419896904958E-08m), // 5 / 9
+ new TestResult(2, -2.0633E-24m), // 5 / 10
+ new TestResult(2, -1.834210506E-19m), // 5 / 11
+ new TestResult(0, 0.1310747570475145179775887907m), // 5 / 12
+ new TestResult(2, -2.497172E-22m), // 5 / 13
+ new TestResult(2, 4.487E-25m), // 5 / 14
+ new TestResult(2, 7E-27m), // 5 / 15
+ new TestResult(2, -2.374601427662509866741E-07m), // 5 / 16
+ new TestResult(2, 4.0877578264E-18m), // 5 / 17
+ new TestResult(2, -1.88E-26m), // 5 / 18
+ new TestResult(2, 1E-27m), // 5 / 19
+ new TestResult(2, 1.41216594169140912E-11m), // 5 / 20
+ new TestResult(2, 2.405278485968914E-13m), // 5 / 21
+ new TestResult(2, -1.56509402354277E-14m), // 5 / 22
+ new TestResult(2, 2.260672326213E-16m), // 5 / 23
+ new TestResult(2, -1.949949549557E-16m), // 5 / 24
+ new TestResult(2, 1.642196352E-19m), // 5 / 25
+ new TestResult(2, -2.351E-24m), // 5 / 26
+ new TestResult(2, -1.28069E-23m), // 5 / 27
+ new TestResult(2, 1E-28m), // 5 / 28
+ new TestResult(2, -2.00115147598754898E-11m), // 5 / 29
+ new TestResult(3, 0m), // 6 / 0
+ new TestResult(0, 79228162514264337593543950335m), // 6 / 1
+ new TestResult(0, -79228162514264337593543950335m), // 6 / 2
+ new TestResult(4, 39614081257132168796771975168m), // 6 / 3
+ new TestResult(4, 7922816251426433759354395034m), // 6 / 4
+ new TestResult(1, 0m), // 6 / 5
+ new TestResult(0, 1m), // 6 / 6
+ new TestResult(0, -1m), // 6 / 7
+ new TestResult(2, 2859.8815108190596050496514036m), // 6 / 8
+ new TestResult(2, -24729010396044602218186.765763m), // 6 / 9
+ new TestResult(0, -1634686.9890330150250120997619m), // 6 / 10
+ new TestResult(2, -145321128061.87519668639091926m), // 6 / 11
+ new TestResult(1, 0m), // 6 / 12
+ new TestResult(0, -197846315.8215581473367403789m), // 6 / 13
+ new TestResult(0, 355519.78373087286985534915017m), // 6 / 14
+ new TestResult(0, 5561.4152228343398478498516935m), // 6 / 15
+ new TestResult(0, -188135307817449443294332.61564m), // 6 / 16
+ new TestResult(4, 3238655413907.0152158135371692m), // 6 / 17
+ new TestResult(0, -14883.393842880239095927799143m), // 6 / 18
+ new TestResult(0, 770.69397665852204557888702506m), // 6 / 19
+ new TestResult(4, 11188331272543609822.484506627m), // 6 / 20
+ new TestResult(0, 190565794778408772.72439011791m), // 6 / 21
+ new TestResult(4, -12399952364735014.543439368391m), // 6 / 22
+ new TestResult(2, 179108914452685.79816067884477m), // 6 / 23
+ new TestResult(2, -154490919806941.48506503891762m), // 6 / 24
+ new TestResult(2, 130108199431.16705963085822836m), // 6 / 25
+ new TestResult(2, -1862655.7707746844883926874832m), // 6 / 26
+ new TestResult(2, -10146692.753313261555369747673m), // 6 / 27
+ new TestResult(0, 76.341858036091015923443233609m), // 6 / 28
+ new TestResult(2, -15854755435520147876.101506668m), // 6 / 29
+ new TestResult(3, 0m), // 7 / 0
+ new TestResult(0, -79228162514264337593543950335m), // 7 / 1
+ new TestResult(0, 79228162514264337593543950335m), // 7 / 2
+ new TestResult(4, -39614081257132168796771975168m), // 7 / 3
+ new TestResult(4, -7922816251426433759354395034m), // 7 / 4
+ new TestResult(1, 0m), // 7 / 5
+ new TestResult(0, -1m), // 7 / 6
+ new TestResult(0, 1m), // 7 / 7
+ new TestResult(2, -2859.8815108190596050496514036m), // 7 / 8
+ new TestResult(2, 24729010396044602218186.765763m), // 7 / 9
+ new TestResult(0, 1634686.9890330150250120997619m), // 7 / 10
+ new TestResult(2, 145321128061.87519668639091926m), // 7 / 11
+ new TestResult(1, 0m), // 7 / 12
+ new TestResult(0, 197846315.8215581473367403789m), // 7 / 13
+ new TestResult(0, -355519.78373087286985534915017m), // 7 / 14
+ new TestResult(0, -5561.4152228343398478498516935m), // 7 / 15
+ new TestResult(0, 188135307817449443294332.61564m), // 7 / 16
+ new TestResult(4, -3238655413907.0152158135371692m), // 7 / 17
+ new TestResult(0, 14883.393842880239095927799143m), // 7 / 18
+ new TestResult(0, -770.69397665852204557888702506m), // 7 / 19
+ new TestResult(4, -11188331272543609822.484506627m), // 7 / 20
+ new TestResult(0, -190565794778408772.72439011791m), // 7 / 21
+ new TestResult(4, 12399952364735014.543439368391m), // 7 / 22
+ new TestResult(2, -179108914452685.79816067884477m), // 7 / 23
+ new TestResult(2, 154490919806941.48506503891762m), // 7 / 24
+ new TestResult(2, -130108199431.16705963085822836m), // 7 / 25
+ new TestResult(2, 1862655.7707746844883926874832m), // 7 / 26
+ new TestResult(2, 10146692.753313261555369747673m), // 7 / 27
+ new TestResult(0, -76.341858036091015923443233609m), // 7 / 28
+ new TestResult(2, 15854755435520147876.101506668m), // 7 / 29
+ new TestResult(3, 0m), // 8 / 0
+ new TestResult(0, 27703302467091960609331879.532m), // 8 / 1
+ new TestResult(0, -27703302467091960609331879.532m), // 8 / 2
+ new TestResult(0, 13851651233545980304665939.766m), // 8 / 3
+ new TestResult(0, 2770330246709196060933187.9532m), // 8 / 4
+ new TestResult(0, 277033024670919606093318795.32m), // 8 / 5
+ new TestResult(2, 0.0003496648361888264585379374m), // 8 / 6
+ new TestResult(2, -0.0003496648361888264585379374m), // 8 / 7
+ new TestResult(0, 1m), // 8 / 8
+ new TestResult(2, -8646865369244722339.540450168m), // 8 / 9
+ new TestResult(0, -571.59255824023515226354006889m), // 8 / 10
+ new TestResult(0, -50813688.438531062464476589278m), // 8 / 11
+ new TestResult(0, 36312036402878882966329689.018m), // 8 / 12
+ new TestResult(0, -69179.899612307954004328275068m), // 8 / 13
+ new TestResult(2, 124.31276694014267187689413445m), // 8 / 14
+ new TestResult(0, 1.9446313428704152390534655913m), // 8 / 15
+ new TestResult(0, -65784301589322901428.917817252m), // 8 / 16
+ new TestResult(2, 1132443914.7758524269197245123m), // 8 / 17
+ new TestResult(0, -5.2041994700045071214948001057m), // 8 / 18
+ new TestResult(2, 0.2694845831000173532986745484m), // 8 / 19
+ new TestResult(0, 3912166021640285.6025706982227m), // 8 / 20
+ new TestResult(0, 66634157414385.824002109431498m), // 8 / 21
+ new TestResult(0, -4335827312364.3201348613764117m), // 8 / 22
+ new TestResult(0, 62628089232.056911382057917869m), // 8 / 23
+ new TestResult(0, -54020042166.955319300276527479m), // 8 / 24
+ new TestResult(0, 45494262.240922193719761217507m), // 8 / 25
+ new TestResult(0, -651.30522496410233725620872491m), // 8 / 26
+ new TestResult(0, -3547.9416594456341168641639951m), // 8 / 27
+ new TestResult(2, 0.0266940632845404098551052086m), // 8 / 28
+ new TestResult(0, -5543850462175058.4016671641533m), // 8 / 29
+ new TestResult(3, 0m), // 9 / 0
+ new TestResult(0, -3203854.9559968181492513385018m), // 9 / 1
+ new TestResult(0, 3203854.9559968181492513385018m), // 9 / 2
+ new TestResult(0, -1601927.4779984090746256692509m), // 9 / 3
+ new TestResult(0, -320385.49559968181492513385018m), // 9 / 4
+ new TestResult(0, -32038549.559968181492513385018m), // 9 / 5
+ new TestResult(2, -4.04383E-23m), // 9 / 6
+ new TestResult(2, 4.04383E-23m), // 9 / 7
+ new TestResult(2, -1.156488458E-19m), // 9 / 8
+ new TestResult(0, 1m), // 9 / 9
+ new TestResult(2, 6.61040196455E-17m), // 9 / 10
+ new TestResult(2, 5.8765444202781065E-12m), // 9 / 11
+ new TestResult(0, -4199445.0997275825559060668592m), // 9 / 12
+ new TestResult(2, 8.0005755447943E-15m), // 9 / 13
+ new TestResult(2, -1.43766280186E-17m), // 9 / 14
+ new TestResult(2, -2.248943704E-19m), // 9 / 15
+ new TestResult(0, 7.6078785525336521046280405305m), // 9 / 16
+ new TestResult(2, -1.309658317109623269E-10m), // 9 / 17
+ new TestResult(2, 6.018596622E-19m), // 9 / 18
+ new TestResult(2, -3.1165581E-20m), // 9 / 19
+ new TestResult(2, -0.0004524374850977934825669157m), // 9 / 20
+ new TestResult(2, -7.7061633978240275370839E-06m), // 9 / 21
+ new TestResult(2, 5.014334243928492665444E-07m), // 9 / 22
+ new TestResult(2, -7.242866236221657103E-09m), // 9 / 23
+ new TestResult(2, 6.2473555282928855602E-09m), // 9 / 24
+ new TestResult(2, -5.261358920047113E-12m), // 9 / 25
+ new TestResult(2, 7.53226975501E-17m), // 9 / 26
+ new TestResult(2, 4.103153579868E-16m), // 9 / 27
+ new TestResult(2, -3.0871376E-21m), // 9 / 28
+ new TestResult(2, 0.0006411399074043056427231896m), // 9 / 29
+ new TestResult(3, 0m), // 10 / 0
+ new TestResult(0, -48466870444188873796420.028868m), // 10 / 1
+ new TestResult(0, 48466870444188873796420.028868m), // 10 / 2
+ new TestResult(0, -24233435222094436898210.014434m), // 10 / 3
+ new TestResult(0, -4846687044418887379642.0028868m), // 10 / 4
+ new TestResult(0, -484668704441888737964200.28868m), // 10 / 5
+ new TestResult(2, -6.11737908669317400216E-07m), // 10 / 6
+ new TestResult(2, 6.11737908669317400216E-07m), // 10 / 7
+ new TestResult(2, -0.001749497934470499347067655m), // 10 / 8
+ new TestResult(2, 15127673103138133.38384122385m), // 10 / 9
+ new TestResult(0, 1m), // 10 / 10
+ new TestResult(2, 88898.44296603758700885485801m), // 10 / 11
+ new TestResult(0, -63527832683254186820073.01815m), // 10 / 12
+ new TestResult(2, 121.03009147860926410013615872m), // 10 / 13
+ new TestResult(2, -0.217484928990092181791376891m), // 10 / 14
+ new TestResult(2, -0.0034021285176583848675539818m), // 10 / 15
+ new TestResult(2, 115089499751104803.45385549602m), // 10 / 16
+ new TestResult(2, -1981208.2898040400164777217752m), // 10 / 17
+ new TestResult(2, 0.0091047362233453526323903968m), // 10 / 18
+ new TestResult(2, -0.0004714627215051239953535366m), // 10 / 19
+ new TestResult(0, -6844326374165.3505116694016252m), // 10 / 20
+ new TestResult(2, -116576320761.65010852644993727m), // 10 / 21
+ new TestResult(0, 7585520927.2021546507200976307m), // 10 / 22
+ new TestResult(2, -109567712.75131768812510902617m), // 10 / 23
+ new TestResult(2, 94507952.1910976087542637813m), // 10 / 24
+ new TestResult(0, -79592.11782075260884714858998m), // 10 / 25
+ new TestResult(0, 1.1394571457845409462816707224m), // 10 / 26
+ new TestResult(0, 6.2071166048219727069770728387m), // 10 / 27
+ new TestResult(2, -4.67012085789282405269787E-05m), // 10 / 28
+ new TestResult(2, 9698954932588.587842740128447m), // 10 / 29
+ new TestResult(3, 0m), // 11 / 0
+ new TestResult(0, -545193693242804794.30331374676m), // 11 / 1
+ new TestResult(0, 545193693242804794.30331374676m), // 11 / 2
+ new TestResult(0, -272596846621402397.15165687338m), // 11 / 3
+ new TestResult(0, -54519369324280479.430331374676m), // 11 / 4
+ new TestResult(0, -5451936932428047943.0331374676m), // 11 / 5
+ new TestResult(2, -6.8813118459568899E-12m), // 11 / 6
+ new TestResult(2, 6.8813118459568899E-12m), // 11 / 7
+ new TestResult(2, -1.96797365184322821747E-08m), // 11 / 8
+ new TestResult(2, 170168032177.09280206999941461m), // 11 / 9
+ new TestResult(2, 1.12487909420644868170014E-05m), // 11 / 10
+ new TestResult(0, 1m), // 11 / 11
+ new TestResult(0, -714611308856377959.50595110446m), // 11 / 12
+ new TestResult(2, 0.0013614421967418161221277362m), // 11 / 13
+ new TestResult(2, -2.4464424992592870530962E-06m), // 11 / 14
+ new TestResult(2, -3.82698324531749191876E-08m), // 11 / 15
+ new TestResult(2, 1294617722326.9607230936474447m), // 11 / 16
+ new TestResult(0, -22.286197864690758108786295635m), // 11 / 17
+ new TestResult(2, 1.024172743590536270877E-07m), // 11 / 18
+ new TestResult(2, -5.3033855911879105358E-09m), // 11 / 19
+ new TestResult(0, -76990396.522244266468310204941m), // 11 / 20
+ new TestResult(2, -1311342.6610428539176292952583m), // 11 / 21
+ new TestResult(2, 85327.93909675220473779587097m), // 11 / 22
+ new TestResult(2, -1232.5042947397459817875590485m), // 11 / 23
+ new TestResult(2, 1063.1001965602823514109428061m), // 11 / 24
+ new TestResult(2, -0.8953150940018113683593315845m), // 11 / 25
+ new TestResult(2, 1.28175152203717976446025E-05m), // 11 / 26
+ new TestResult(2, 6.98225570406594773014162E-05m), // 11 / 27
+ new TestResult(2, -5.253321320461122964E-10m), // 11 / 28
+ new TestResult(2, 109101516.393194182269828744m), // 11 / 29
+ new TestResult(3, 0m), // 12 / 0
+ new TestResult(0, 0.7629234053338741809892531431m), // 12 / 1
+ new TestResult(0, -0.7629234053338741809892531431m), // 12 / 2
+ new TestResult(2, 0.3814617026669370904946265716m), // 12 / 3
+ new TestResult(2, 0.0762923405333874180989253143m), // 12 / 4
+ new TestResult(0, 7.629234053338741809892531431m), // 12 / 5
+ new TestResult(0, 0m), // 12 / 6
+ new TestResult(0, 0m), // 12 / 7
+ new TestResult(2, 2.75E-26m), // 12 / 8
+ new TestResult(2, -2.381266991833920788159E-07m), // 12 / 9
+ new TestResult(2, -1.57411E-23m), // 12 / 10
+ new TestResult(2, -1.3993621254E-18m), // 12 / 11
+ new TestResult(0, 1m), // 12 / 12
+ new TestResult(2, -1.9051506E-21m), // 12 / 13
+ new TestResult(2, 3.4235E-24m), // 12 / 14
+ new TestResult(2, 5.36E-26m), // 12 / 15
+ new TestResult(2, -1.8116390075029613252172E-06m), // 12 / 16
+ new TestResult(2, 3.11864612111E-17m), // 12 / 17
+ new TestResult(2, -1.433E-25m), // 12 / 18
+ new TestResult(2, 7.4E-27m), // 12 / 19
+ new TestResult(2, 1.077374449131727051E-10m), // 12 / 20
+ new TestResult(2, 1.8350432532917088E-12m), // 12 / 21
+ new TestResult(2, -1.194046862108942E-13m), // 12 / 22
+ new TestResult(2, 1.7247198294583E-15m), // 12 / 23
+ new TestResult(2, -1.4876621505775E-15m), // 12 / 24
+ new TestResult(2, 1.2528700328E-18m), // 12 / 25
+ new TestResult(2, -1.79363E-23m), // 12 / 26
+ new TestResult(2, -9.7707E-23m), // 12 / 27
+ new TestResult(2, 7E-28m), // 12 / 28
+ new TestResult(2, -1.526725298649329415E-10m), // 12 / 29
+ new TestResult(3, 0m), // 13 / 0
+ new TestResult(0, -400453059665371395972.33474452m), // 13 / 1
+ new TestResult(0, 400453059665371395972.33474452m), // 13 / 2
+ new TestResult(0, -200226529832685697986.16737226m), // 13 / 3
+ new TestResult(0, -40045305966537139597.233474452m), // 13 / 4
+ new TestResult(0, -4004530596653713959723.3474452m), // 13 / 5
+ new TestResult(2, -5.0544282103383796846E-09m), // 13 / 6
+ new TestResult(2, 5.0544282103383796846E-09m), // 13 / 7
+ new TestResult(2, -1.44550657865090008770424E-05m), // 13 / 8
+ new TestResult(0, 124991007759518.90460797449561m), // 13 / 9
+ new TestResult(2, 0.0082624080324415766315344098m), // 13 / 10
+ new TestResult(0, 734.51520923413833710945795487m), // 13 / 11
+ new TestResult(0, -524892875045723911444.75281192m), // 13 / 12
+ new TestResult(0, 1m), // 13 / 13
+ new TestResult(2, -0.0017969492242227235536064218m), // 13 / 14
+ new TestResult(2, -2.81097739916991934127E-05m), // 13 / 15
+ new TestResult(0, 950916407193211.1625559901416m), // 13 / 16
+ new TestResult(2, -16369.551287616739221174657438m), // 13 / 17
+ new TestResult(2, 7.52270457050304262522489E-05m), // 13 / 18
+ new TestResult(2, -3.8954173771607025488213E-06m), // 13 / 19
+ new TestResult(0, -56550617210.555523949138629466m), // 13 / 20
+ new TestResult(2, -963201129.053543593301215979m), // 13 / 21
+ new TestResult(0, 62674669.039168758653283589393m), // 13 / 22
+ new TestResult(2, -905293.1499327386264702284996m), // 13 / 23
+ new TestResult(0, 780863.26331332938464898250347m), // 13 / 24
+ new TestResult(0, -657.62255360122271090761257385m), // 13 / 25
+ new TestResult(2, 0.0094146598739531437042039072m), // 13 / 26
+ new TestResult(2, 0.0512857300939825548661107378m), // 13 / 27
+ new TestResult(2, -3.858644408872661628546E-07m), // 13 / 28
+ new TestResult(2, 80136723141.3087985919301071m), // 13 / 29
+ new TestResult(3, 0m), // 14 / 0
+ new TestResult(0, 222851627785191714190050.61676m), // 14 / 1
+ new TestResult(0, -222851627785191714190050.61676m), // 14 / 2
+ new TestResult(0, 111425813892595857095025.30838m), // 14 / 3
+ new TestResult(0, 22285162778519171419005.061676m), // 14 / 4
+ new TestResult(0, 2228516277851917141900506.1676m), // 14 / 5
+ new TestResult(2, 2.8127829891936371496034E-06m), // 14 / 6
+ new TestResult(2, -2.8127829891936371496034E-06m), // 14 / 7
+ new TestResult(2, 0.0080442260647412496180191824m), // 14 / 8
+ new TestResult(0, -69557339781586865.090190294226m), // 14 / 9
+ new TestResult(0, -4.5980197554082303507855592074m), // 14 / 10
+ new TestResult(0, -408756.79698287266169556154972m), // 14 / 11
+ new TestResult(0, 292102229695871398106087.53771m), // 14 / 12
+ new TestResult(0, -556.49875161751071295835933612m), // 14 / 13
+ new TestResult(0, 1m), // 14 / 14
+ new TestResult(2, 0.0156430541346309720805875037m), // 14 / 15
+ new TestResult(0, -529183793495630496.21134784463m), // 14 / 16
+ new TestResult(0, 9109634.856097530429701051341m), // 14 / 17
+ new TestResult(2, -0.0418637570227228532534385582m), // 14 / 18
+ new TestResult(2, 0.0021677949074190888565424407m), // 14 / 19
+ new TestResult(0, 31470347880873.8650457716423m), // 14 / 20
+ new TestResult(0, 536020225874.87383772032904409m), // 14 / 21
+ new TestResult(0, -34878375078.338063831579069802m), // 14 / 22
+ new TestResult(0, 503794507.78545299809142202221m), // 14 / 23
+ new TestResult(0, -434549431.21784335466036244264m), // 14 / 24
+ new TestResult(0, 365966.13011459996262470838791m), // 14 / 25
+ new TestResult(0, -5.2392464667583952349382510034m), // 14 / 26
+ new TestResult(0, -28.540444773093892153704750451m), // 14 / 27
+ new TestResult(2, 0.0002147330796473523774307252m), // 14 / 28
+ new TestResult(0, -44595986386856.427962855912902m), // 14 / 29
+ new TestResult(3, 0m), // 15 / 0
+ new TestResult(0, 14246043379204153213661335.584m), // 15 / 1
+ new TestResult(0, -14246043379204153213661335.584m), // 15 / 2
+ new TestResult(0, 7123021689602076606830667.792m), // 15 / 3
+ new TestResult(0, 1424604337920415321366133.5584m), // 15 / 4
+ new TestResult(0, 142460433792041532136613355.84m), // 15 / 5
+ new TestResult(2, 0.000179810346814988644017588m), // 15 / 6
+ new TestResult(2, -0.000179810346814988644017588m), // 15 / 7
+ new TestResult(2, 0.5142362863101488055319975668m), // 15 / 8
+ new TestResult(0, -4446531935704239606.853757764m), // 15 / 9
+ new TestResult(0, -293.9336344319759696558350238m), // 15 / 10
+ new TestResult(0, -26130242.436351157631251931791m), // 15 / 11
+ new TestResult(0, 18672966748175371201221341.455m), // 15 / 12
+ new TestResult(0, -35574.814663942145387025413585m), // 15 / 13
+ new TestResult(0, 63.926135612238008074953534656m), // 15 / 14
+ new TestResult(0, 1m), // 15 / 15
+ new TestResult(0, -33828674946800228646.235978357m), // 15 / 16
+ new TestResult(0, 582343753.18886100200299543357m), // 15 / 17
+ new TestResult(0, -2.676188208672362394790189458m), // 15 / 18
+ new TestResult(2, 0.1385787512311916118536189686m), // 15 / 19
+ new TestResult(0, 2011777726397049.7148998294303m), // 15 / 20
+ new TestResult(0, 34265701650179.633435597272951m), // 15 / 21
+ new TestResult(0, -2229639735192.3415269889385254m), // 15 / 22
+ new TestResult(0, 32205636025.393565317814400562m), // 15 / 23
+ new TestResult(0, -27779065870.252746877787654023m), // 15 / 24
+ new TestResult(0, 23394800.463191857206004010592m), // 15 / 25
+ new TestResult(0, -334.92478013993600679391750784m), // 15 / 26
+ new TestResult(0, -1824.480342998389574945394373m), // 15 / 27
+ new TestResult(2, 0.0137270559699701534233028604m), // 15 / 28
+ new TestResult(0, -2850849073527704.1131980257228m), // 15 / 29
+ new TestResult(3, 0m), // 16 / 0
+ new TestResult(0, -421123.30446308691436596648186m), // 16 / 1
+ new TestResult(0, 421123.30446308691436596648186m), // 16 / 2
+ new TestResult(0, -210561.65223154345718298324093m), // 16 / 3
+ new TestResult(0, -42112.330446308691436596648186m), // 16 / 4
+ new TestResult(0, -4211233.0446308691436596648186m), // 16 / 5
+ new TestResult(2, -5.3153E-24m), // 16 / 6
+ new TestResult(2, 5.3153E-24m), // 16 / 7
+ new TestResult(2, -1.52011951E-20m), // 16 / 8
+ new TestResult(2, 0.1314426870900784765046305445m), // 16 / 9
+ new TestResult(2, 8.6888899697E-18m), // 16 / 10
+ new TestResult(2, 7.724287894055618E-13m), // 16 / 11
+ new TestResult(0, -551986.34819545603591091806686m), // 16 / 12
+ new TestResult(2, 1.0516171478749E-15m), // 16 / 13
+ new TestResult(2, -1.8897026181E-18m), // 16 / 14
+ new TestResult(2, -2.95607204E-20m), // 16 / 15
+ new TestResult(0, 1m), // 16 / 16
+ new TestResult(2, -1.72145008370758982E-11m), // 16 / 17
+ new TestResult(2, 7.91100512E-20m), // 16 / 18
+ new TestResult(2, -4.0964877E-21m), // 16 / 19
+ new TestResult(2, -5.94695987815313124908788E-05m), // 16 / 20
+ new TestResult(2, -1.012918824165199591208E-06m), // 16 / 21
+ new TestResult(2, 6.59097566989758101184E-08m), // 16 / 22
+ new TestResult(2, -9.520218003229776933E-10m), // 16 / 23
+ new TestResult(2, 8.211691978458736692E-10m), // 16 / 24
+ new TestResult(2, -6.915671541963459E-13m), // 16 / 25
+ new TestResult(2, 9.9006177649E-18m), // 16 / 26
+ new TestResult(2, 5.39329532081E-17m), // 16 / 27
+ new TestResult(2, -4.057817E-22m), // 16 / 28
+ new TestResult(2, 8.42731522299060351340978E-05m), // 16 / 29
+ new TestResult(3, 0m), // 17 / 0
+ new TestResult(0, 24463288738299545.200508898642m), // 17 / 1
+ new TestResult(0, -24463288738299545.200508898642m), // 17 / 2
+ new TestResult(0, 12231644369149772.600254449321m), // 17 / 3
+ new TestResult(0, 2446328873829954.5200508898642m), // 17 / 4
+ new TestResult(0, 244632887382995452.00508898642m), // 17 / 5
+ new TestResult(2, 3.087701135804474E-13m), // 17 / 6
+ new TestResult(2, -3.087701135804474E-13m), // 17 / 7
+ new TestResult(2, 8.830459389222225669E-10m), // 17 / 8
+ new TestResult(0, -7635579348.7187565660747357791m), // 17 / 9
+ new TestResult(2, -5.047424872722036356353E-07m), // 17 / 10
+ new TestResult(2, -0.0448708212173039475800037318m), // 17 / 11
+ new TestResult(0, 32065196279558108.529140993113m), // 17 / 12
+ new TestResult(2, -6.10890294076955781848965E-05m), // 17 / 13
+ new TestResult(2, 1.097738840026777145636E-07m), // 17 / 14
+ new TestResult(2, 1.7171988100225883459E-09m), // 17 / 15
+ new TestResult(0, -58090560363.286299748647320613m), // 17 / 16
+ new TestResult(0, 1m), // 17 / 17
+ new TestResult(2, -4.5955472073286630491E-09m), // 17 / 18
+ new TestResult(2, 2.379672667086185355E-10m), // 17 / 19
+ new TestResult(0, 3454622.3177989620890093190782m), // 17 / 20
+ new TestResult(0, 58841.022098277508341771781449m), // 17 / 21
+ new TestResult(0, -3828.7347000513678647353825371m), // 17 / 22
+ new TestResult(0, 55.303479858826432190514052161m), // 17 / 23
+ new TestResult(0, -47.702178855937114485246771806m), // 17 / 24
+ new TestResult(2, 0.0401735235161089558399723624m), // 17 / 25
+ new TestResult(2, -5.751324339033751411128E-07m), // 17 / 26
+ new TestResult(2, -3.1329954739064384030107E-06m), // 17 / 27
+ new TestResult(2, 2.35720841767462147E-11m), // 17 / 28
+ new TestResult(0, -4895474.6366157719700764456737m), // 17 / 29
+ new TestResult(3, 0m), // 18 / 0
+ new TestResult(0, -5323259153836385912697776.001m), // 18 / 1
+ new TestResult(0, 5323259153836385912697776.001m), // 18 / 2
+ new TestResult(0, -2661629576918192956348888.0005m), // 18 / 3
+ new TestResult(0, -532325915383638591269777.6001m), // 18 / 4
+ new TestResult(0, -53232591538363859126977760.01m), // 18 / 5
+ new TestResult(2, -6.71889765571425396685425E-05m), // 18 / 6
+ new TestResult(2, 6.71889765571425396685425E-05m), // 18 / 7
+ new TestResult(2, -0.1921525117866271842350897941m), // 18 / 8
+ new TestResult(2, 1661516899781174928.9093780261m), // 18 / 9
+ new TestResult(2, 109.83294578440517035615430815m), // 18 / 10
+ new TestResult(0, 9763977.866606841461047851247m), // 18 / 11
+ new TestResult(0, -6977449002900619940294072.5616m), // 18 / 12
+ new TestResult(2, 13293.091475651689504900168879m), // 18 / 13
+ new TestResult(2, -23.887010414694002921991680138m), // 18 / 14
+ new TestResult(2, -0.3736657970315521134142448751m), // 18 / 15
+ new TestResult(2, 12640618786517406225.453062932m), // 18 / 16
+ new TestResult(2, -217601942.68166121398235985303m), // 18 / 17
+ new TestResult(0, 1m), // 18 / 18
+ new TestResult(2, -0.0517821395304403973786481636m), // 18 / 19
+ new TestResult(0, -751732527584477.35915419894761m), // 18 / 20
+ new TestResult(2, -12803920717959.743225565448731m), // 18 / 21
+ new TestResult(2, 833140108743.8650907762143944m), // 18 / 22
+ new TestResult(2, -12034144654.336754703603784598m), // 18 / 23
+ new TestResult(2, 10380086789.199979490407779016m), // 18 / 24
+ new TestResult(2, -8741836.761472709884309939817m), // 18 / 25
+ new TestResult(2, 125.14993491660654415586289072m), // 18 / 26
+ new TestResult(0, 681.74590153489282094280759828m), // 18 / 27
+ new TestResult(2, -0.0051293313099156230719389272m), // 18 / 28
+ new TestResult(2, 1065264791276391.4723331595476m), // 18 / 29
+ new TestResult(3, 0m), // 19 / 0
+ new TestResult(0, 102801066199805834724673169.19m), // 19 / 1
+ new TestResult(0, -102801066199805834724673169.19m), // 19 / 2
+ new TestResult(0, 51400533099902917362336584.595m), // 19 / 3
+ new TestResult(0, 10280106619980583472467316.919m), // 19 / 4
+ new TestResult(0, 1028010661998058347246731691.9m), // 19 / 5
+ new TestResult(2, 0.0012975318742410238535080931m), // 19 / 6
+ new TestResult(2, -0.0012975318742410238535080931m), // 19 / 7
+ new TestResult(0, 3.7107874168403053465719309061m), // 19 / 8
+ new TestResult(0, -32086679207305516282.844795417m), // 19 / 9
+ new TestResult(0, -2121.0584726774239906503858037m), // 19 / 10
+ new TestResult(0, -188558795.66094477019222763757m), // 19 / 11
+ new TestResult(0, 134746247763650063417846672.74m), // 19 / 12
+ new TestResult(0, -256711.90097962787395549999647m), // 19 / 13
+ new TestResult(0, 461.29825131408293475234811789m), // 19 / 14
+ new TestResult(0, 7.2161135175168023022995955438m), // 19 / 15
+ new TestResult(0, -244111558563287122929.04506056m), // 19 / 16
+ new TestResult(0, 4202258629.2276083227657702227m), // 19 / 17
+ new TestResult(0, -19.311677908019711128996883838m), // 19 / 18
+ new TestResult(0, 1m), // 19 / 19
+ new TestResult(0, 14517216445692969.517326696553m), // 19 / 20
+ new TestResult(0, 247265192865059.0518154425151m), // 19 / 21
+ new TestResult(0, -16089333432314.039236231362245m), // 19 / 22
+ new TestResult(0, 232399525463.06860877964908684m), // 19 / 23
+ new TestResult(0, -200456892730.3205001486617745m), // 19 / 24
+ new TestResult(0, 168819535.86204710848979659043m), // 19 / 25
+ new TestResult(0, -2416.8552333191352676140967438m), // 19 / 26
+ new TestResult(0, -13165.657265554370962757268367m), // 19 / 27
+ new TestResult(2, 0.0990559941406113443335355768m), // 19 / 28
+ new TestResult(0, -20572050535883517.889932557941m), // 19 / 29
+ new TestResult(3, 0m), // 20 / 0
+ new TestResult(0, 7081320760.3793287174700927968m), // 20 / 1
+ new TestResult(0, -7081320760.3793287174700927968m), // 20 / 2
+ new TestResult(0, 3540660380.1896643587350463984m), // 20 / 3
+ new TestResult(0, 708132076.03793287174700927968m), // 20 / 4
+ new TestResult(0, 70813207603.793287174700927968m), // 20 / 5
+ new TestResult(2, 8.93788337E-20m), // 20 / 6
+ new TestResult(2, -8.93788337E-20m), // 20 / 7
+ new TestResult(2, 2.556128739088E-16m), // 20 / 8
+ new TestResult(0, -2210.250107335496183875574735m), // 20 / 9
+ new TestResult(2, -1.461064165166945E-13m), // 20 / 10
+ new TestResult(2, -1.2988632935681496171E-08m), // 20 / 11
+ new TestResult(2, 9281823982.422412820396304075m), // 20 / 12
+ new TestResult(2, -1.76832729566273202E-11m), // 20 / 13
+ new TestResult(2, 3.17759436211301E-14m), // 20 / 14
+ new TestResult(2, 4.970728062443E-16m), // 20 / 15
+ new TestResult(2, -16815.314387332923907118773285m), // 20 / 16
+ new TestResult(2, 2.894672435964370128732E-07m), // 20 / 17
+ new TestResult(2, -1.3302603829227E-15m), // 20 / 18
+ new TestResult(2, 6.88837287603E-17m), // 20 / 19
+ new TestResult(0, 1m), // 20 / 20
+ new TestResult(2, 0.0170325484771854288433021822m), // 20 / 21
+ new TestResult(2, -0.0011082932800859005017661851m), // 20 / 22
+ new TestResult(2, 1.60085458760255588702037E-05m), // 20 / 23
+ new TestResult(2, -1.38082182269723557757959E-05m), // 20 / 24
+ new TestResult(2, 1.16289191177647018971E-08m), // 20 / 25
+ new TestResult(2, -1.6648200034492E-13m), // 20 / 26
+ new TestResult(2, -9.068995640318096E-13m), // 20 / 27
+ new TestResult(2, 6.8233462325E-18m), // 20 / 28
+ new TestResult(2, -1.4170795491574366313541174399m), // 20 / 29
+ new TestResult(3, 0m), // 21 / 0
+ new TestResult(0, 415752273939.77704245656837041m), // 21 / 1
+ new TestResult(0, -415752273939.77704245656837041m), // 21 / 2
+ new TestResult(2, 207876136969.8885212282841852m), // 21 / 3
+ new TestResult(0, 41575227393.977704245656837041m), // 21 / 4
+ new TestResult(0, 4157522739397.7704245656837041m), // 21 / 5
+ new TestResult(2, 5.2475314427E-18m), // 21 / 6
+ new TestResult(2, -5.2475314427E-18m), // 21 / 7
+ new TestResult(2, 1.50073181503771E-14m), // 21 / 8
+ new TestResult(2, -129766.25959973387113808743405m), // 21 / 9
+ new TestResult(2, -8.5780713738991847E-12m), // 21 / 10
+ new TestResult(2, -7.625771887911763590261E-07m), // 21 / 11
+ new TestResult(0, 544946282986.07977368508338172m), // 21 / 12
+ new TestResult(2, -1.0382047630930577807E-09m), // 21 / 13
+ new TestResult(2, 1.8656012436244067E-12m), // 21 / 14
+ new TestResult(2, 2.91837012476515E-14m), // 21 / 15
+ new TestResult(2, -987245.9432513294606844938685m), // 21 / 16
+ new TestResult(2, 1.69949461164997956913075E-05m), // 21 / 17
+ new TestResult(2, -7.81010771643817E-14m), // 21 / 18
+ new TestResult(2, 4.0442408752037E-15m), // 21 / 19
+ new TestResult(0, 58.711120143850993772970798576m), // 21 / 20
+ new TestResult(0, 1m), // 21 / 21
+ new TestResult(2, -0.0650691399217460043995169619m), // 21 / 22
+ new TestResult(2, 0.0009398796602556869430220663m), // 21 / 23
+ new TestResult(2, -0.0008106959592962871308194687m), // 21 / 24
+ new TestResult(2, 6.827468674662091164433E-07m), // 21 / 25
+ new TestResult(2, -9.7743447240392408E-12m), // 21 / 26
+ new TestResult(2, -5.32450892622776623E-11m), // 21 / 27
+ new TestResult(2, 4.006063004374E-16m), // 21 / 28
+ new TestResult(2, -83.19832766397646235747803502m), // 21 / 29
+ new TestResult(3, 0m), // 22 / 0
+ new TestResult(0, -6389392489892.6362673670820462m), // 22 / 1
+ new TestResult(0, 6389392489892.6362673670820462m), // 22 / 2
+ new TestResult(0, -3194696244946.3181336835410231m), // 22 / 3
+ new TestResult(0, -638939248989.26362673670820462m), // 22 / 4
+ new TestResult(0, -63893924898926.362673670820462m), // 22 / 5
+ new TestResult(2, -8.06454710942E-17m), // 22 / 6
+ new TestResult(2, 8.06454710942E-17m), // 22 / 7
+ new TestResult(2, -2.306364917136659E-13m), // 22 / 8
+ new TestResult(2, 1994282.6930829954142428134453m), // 22 / 9
+ new TestResult(2, 1.31830102322167113E-10m), // 22 / 10
+ new TestResult(2, 1.17194908324940723524544E-05m), // 22 / 11
+ new TestResult(2, -8374880682938.911591614017805m), // 22 / 12
+ new TestResult(2, 1.59554093436863052632E-08m), // 22 / 13
+ new TestResult(2, -2.8671060442293101E-11m), // 22 / 14
+ new TestResult(2, -4.485029505960676E-13m), // 22 / 15
+ new TestResult(2, 15172260.52839517272431927284m), // 22 / 16
+ new TestResult(2, -0.0002611828915663923103773216m), // 22 / 17
+ new TestResult(2, 1.2002783079399592E-12m), // 22 / 18
+ new TestResult(2, -6.21529788171079E-14m), // 22 / 19
+ new TestResult(2, -902.2882462325251912660653119m), // 22 / 20
+ new TestResult(2, -15.368268294350108200187006165m), // 22 / 21
+ new TestResult(0, 1m), // 22 / 22
+ new TestResult(2, -0.0144443227832120251558802997m), // 22 / 23
+ new TestResult(2, 0.0124589930076108753677011728m), // 22 / 24
+ new TestResult(2, -1.04926370363477969575619E-05m), // 22 / 25
+ new TestResult(2, 1.50214752120500522E-10m), // 22 / 26
+ new TestResult(2, 8.182848171393031905E-10m), // 22 / 27
+ new TestResult(2, -6.156625105529E-15m), // 22 / 28
+ new TestResult(2, 1278.6142211812409691677177837m), // 22 / 29
+ new TestResult(3, 0m), // 23 / 0
+ new TestResult(0, 442346282742915.0596416330681m), // 23 / 1
+ new TestResult(0, -442346282742915.0596416330681m), // 23 / 2
+ new TestResult(0, 221173141371457.52982081653405m), // 23 / 3
+ new TestResult(0, 44234628274291.50596416330681m), // 23 / 4
+ new TestResult(0, 4423462827429150.596416330681m), // 23 / 5
+ new TestResult(2, 5.5831950244116E-15m), // 23 / 6
+ new TestResult(2, -5.5831950244116E-15m), // 23 / 7
+ new TestResult(2, 1.59672762216117307E-11m), // 23 / 8
+ new TestResult(0, -138066887.80181919317571960944m), // 23 / 9
+ new TestResult(2, -9.1267762636395250963E-09m), // 23 / 10
+ new TestResult(2, -0.0008113561991369439495762269m), // 23 / 11
+ new TestResult(0, 579804315413987.55317875373327m), // 23 / 12
+ new TestResult(2, -1.104614566093091384748E-06m), // 23 / 13
+ new TestResult(2, 1.9849362876061009571E-09m), // 23 / 14
+ new TestResult(2, 3.10504658008156699E-11m), // 23 / 15
+ new TestResult(2, -1050396114.5225303515983863327m), // 23 / 16
+ new TestResult(2, 0.018082044792709369766201304m), // 23 / 17
+ new TestResult(2, -8.30968904499273382E-11m), // 23 / 18
+ new TestResult(2, 4.3029347758238576E-12m), // 23 / 19
+ new TestResult(0, 62466.635492334295970467255163m), // 23 / 20
+ new TestResult(2, 1063.9659972298557739709718754m), // 23 / 21
+ new TestResult(0, -69.231352345729507070036842909m), // 23 / 22
+ new TestResult(0, 1m), // 23 / 23
+ new TestResult(2, -0.8625529347828887027197930493m), // 23 / 24
+ new TestResult(2, 0.000726419451699245356034835m), // 23 / 25
+ new TestResult(2, -1.03995704315807902618E-08m), // 23 / 26
+ new TestResult(2, -5.66509644945319386873E-08m), // 23 / 27
+ new TestResult(2, 4.262314819414408E-13m), // 23 / 28
+ new TestResult(0, -88520.19166085901375500091819m), // 23 / 29
+ new TestResult(3, 0m), // 24 / 0
+ new TestResult(0, -512833780867323.89020837443764m), // 24 / 1
+ new TestResult(0, 512833780867323.89020837443764m), // 24 / 2
+ new TestResult(0, -256416890433661.94510418721882m), // 24 / 3
+ new TestResult(0, -51283378086732.389020837443764m), // 24 / 4
+ new TestResult(0, -5128337808673238.9020837443764m), // 24 / 5
+ new TestResult(2, -6.4728723296466E-15m), // 24 / 6
+ new TestResult(2, 6.4728723296466E-15m), // 24 / 7
+ new TestResult(2, -1.85116478974485417E-11m), // 24 / 8
+ new TestResult(0, 160067727.13209967231293920454m), // 24 / 9
+ new TestResult(2, 1.05811201789450821647E-08m), // 24 / 10
+ new TestResult(2, 0.0009406451087447388135269385m), // 24 / 11
+ new TestResult(0, -672195632329427.78049892650167m), // 24 / 12
+ new TestResult(2, 1.280633943203881720602E-06m), // 24 / 13
+ new TestResult(2, -2.3012341707535026743E-09m), // 24 / 14
+ new TestResult(2, -3.59983307095596564E-11m), // 24 / 15
+ new TestResult(2, 1217775828.2011100471829103026m), // 24 / 16
+ new TestResult(2, -0.0209634030139388041036175456m), // 24 / 17
+ new TestResult(2, 9.63383081768117492E-11m), // 24 / 18
+ new TestResult(2, -4.988603716138233E-12m), // 24 / 19
+ new TestResult(0, -72420.639908967018993409156115m), // 24 / 20
+ new TestResult(2, -1233.5080599982704934889448056m), // 24 / 21
+ new TestResult(2, 80.26330855062892819843621147m), // 24 / 22
+ new TestResult(0, -1.1593491363538259770624590073m), // 24 / 23
+ new TestResult(0, 1m), // 24 / 24
+ new TestResult(2, -0.0008421737639581399076256596m), // 24 / 25
+ new TestResult(2, 1.20567329983039744731E-08m), // 24 / 26
+ new TestResult(2, 6.56782467603468627053E-08m), // 24 / 27
+ new TestResult(2, -4.941511004756208E-13m), // 24 / 28
+ new TestResult(2, 102625.80775189204591883200668m), // 24 / 29
+ new TestResult(3, 0m), // 25 / 0
+ new TestResult(0, 608940580690915704.1450897514m), // 25 / 1
+ new TestResult(0, -608940580690915704.1450897514m), // 25 / 2
+ new TestResult(0, 304470290345457852.0725448757m), // 25 / 3
+ new TestResult(0, 60894058069091570.41450897514m), // 25 / 4
+ new TestResult(0, 6089405806909157041.450897514m), // 25 / 5
+ new TestResult(2, 7.6859106833543095E-12m), // 25 / 6
+ new TestResult(2, -7.6859106833543095E-12m), // 25 / 7
+ new TestResult(2, 2.19807938571316735336E-08m), // 25 / 8
+ new TestResult(2, -190064965191.73899284873850192m), // 25 / 9
+ new TestResult(2, -1.2564058192949139177057E-05m), // 25 / 10
+ new TestResult(2, -1.1169252106878663178369471734m), // 25 / 11
+ new TestResult(2, 798167386704341861.9682340376m), // 25 / 12
+ new TestResult(2, -0.0015206291124352045188095451m), // 25 / 13
+ new TestResult(2, 2.7324933039209294299951E-06m), // 25 / 14
+ new TestResult(2, 4.27445406757517405142E-08m), // 25 / 15
+ new TestResult(0, -1445991172270.2862199666258075m), // 25 / 16
+ new TestResult(2, 24.892016245451201449485802529m), // 25 / 17
+ new TestResult(2, -1.143924357415629812325E-07m), // 25 / 18
+ new TestResult(2, 5.9234850687965514433E-09m), // 25 / 19
+ new TestResult(2, 85992514.8565500475609760009m), // 25 / 20
+ new TestResult(2, 1464671.6779692768786214751455m), // 25 / 21
+ new TestResult(2, -95304.9263532013818698238713m), // 25 / 22
+ new TestResult(2, 1376.6151190758908669955780933m), // 25 / 23
+ new TestResult(2, -1187.4034110254054607086172841m), // 25 / 24
+ new TestResult(0, 1m), // 25 / 25
+ new TestResult(2, -1.43162058880087033607313E-05m), // 25 / 26
+ new TestResult(2, -7.79865742334041504368931E-05m), // 25 / 27
+ new TestResult(2, 5.867567022667099857E-10m), // 25 / 28
+ new TestResult(2, -121858234.18383411295432055833m), // 25 / 29
+ new TestResult(3, 0m), // 26 / 0
+ new TestResult(0, -42535053313319986966115.037787m), // 26 / 1
+ new TestResult(0, 42535053313319986966115.037787m), // 26 / 2
+ new TestResult(2, -21267526656659993483057.518894m), // 26 / 3
+ new TestResult(0, -4253505331331998696611.5037787m), // 26 / 4
+ new TestResult(0, -425350533133199869661150.37787m), // 26 / 5
+ new TestResult(2, -5.368678505659136383798E-07m), // 26 / 6
+ new TestResult(2, 5.368678505659136383798E-07m), // 26 / 7
+ new TestResult(2, -0.0015353784395866262203076433m), // 26 / 8
+ new TestResult(2, 13276210657946598.343741130625m), // 26 / 9
+ new TestResult(2, 0.8776108901502200170717671109m), // 26 / 10
+ new TestResult(0, 78018.241664392812128305230978m), // 26 / 11
+ new TestResult(0, -55752717790464947101601.359896m), // 26 / 12
+ new TestResult(2, 106.21732631750483463727976216m), // 26 / 13
+ new TestResult(2, -0.1908671421252521905897157731m), // 26 / 14
+ new TestResult(2, -0.0029857450367876236635795704m), // 26 / 15
+ new TestResult(2, 101003798323510611.65980529603m), // 26 / 16
+ new TestResult(0, -1738729.9707879186275737174853m), // 26 / 17
+ new TestResult(2, 0.0079904156615530673319808542m), // 26 / 18
+ new TestResult(2, -0.0004137608186927571471957746m), // 26 / 19
+ new TestResult(0, -6006655361709.8810944800037905m), // 26 / 20
+ new TestResult(2, -102308648634.06932650747319597m), // 26 / 21
+ new TestResult(0, 6657135773.1750052361186583781m), // 26 / 22
+ new TestResult(2, -96157817.91940752862823678187m), // 26 / 23
+ new TestResult(2, 82941208.04870360868726566113m), // 26 / 24
+ new TestResult(0, -69850.909369611886817979504214m), // 26 / 25
+ new TestResult(0, 1m), // 26 / 26
+ new TestResult(0, 5.4474331288240229212686639513m), // 26 / 27
+ new TestResult(2, -4.09854892320443047650146E-05m), // 26 / 28
+ new TestResult(0, 8511908471915.937756062101659m), // 26 / 29
+ new TestResult(3, 0m), // 27 / 0
+ new TestResult(0, -7808274522591953107485.8812311m), // 27 / 1
+ new TestResult(0, 7808274522591953107485.8812311m), // 27 / 2
+ new TestResult(2, -3904137261295976553742.9406156m), // 27 / 3
+ new TestResult(0, -780827452259195310748.58812311m), // 27 / 4
+ new TestResult(0, -78082745225919531074858.812311m), // 27 / 5
+ new TestResult(2, -9.85542801296968307756E-08m), // 27 / 6
+ new TestResult(2, 9.85542801296968307756E-08m), // 27 / 7
+ new TestResult(2, -0.000281853563555002197999826m), // 27 / 8
+ new TestResult(2, 2437149817901964.8960845694514m), // 27 / 9
+ new TestResult(2, 0.1611053994415304138070003376m), // 27 / 10
+ new TestResult(2, 14322.019163773595213651372685m), // 27 / 11
+ new TestResult(2, -10234676860090376638967.506512m), // 27 / 12
+ new TestResult(2, 19.498601232106311831598265533m), // 27 / 13
+ new TestResult(2, -0.0350379963574616786880617938m), // 27 / 14
+ new TestResult(2, -0.0005481012737887758520091497m), // 27 / 15
+ new TestResult(2, 18541539828927654.501195934005m), // 27 / 16
+ new TestResult(2, -319183.3529057512147016471775m), // 27 / 17
+ new TestResult(2, 0.0014668221660718241029342142m), // 27 / 18
+ new TestResult(2, -7.59551900698740123366376E-05m), // 27 / 19
+ new TestResult(2, -1102657934418.1103423727465413m), // 27 / 20
+ new TestResult(2, -18781074721.729615778535996388m), // 27 / 21
+ new TestResult(2, 1222068378.9489912725931951927m), // 27 / 22
+ new TestResult(2, -17651950.128695901472129097893m), // 27 / 23
+ new TestResult(0, 15225741.38814783974528909088m), // 27 / 24
+ new TestResult(2, -12822.719933909700245783228909m), // 27 / 25
+ new TestResult(2, 0.1835726986181246222761380025m), // 27 / 26
+ new TestResult(0, 1m), // 27 / 27
+ new TestResult(2, -7.5238168625104611316081E-06m), // 27 / 28
+ new TestResult(2, 1562554008580.0861321324839011m), // 27 / 29
+ new TestResult(3, 0m), // 28 / 0
+ new TestResult(0, 1037807626804273037330059471.7m), // 28 / 1
+ new TestResult(0, -1037807626804273037330059471.7m), // 28 / 2
+ new TestResult(0, 518903813402136518665029735.85m), // 28 / 3
+ new TestResult(0, 103780762680427303733005947.17m), // 28 / 4
+ new TestResult(0, 10378076268042730373300594717m), // 28 / 5
+ new TestResult(2, 0.013098973822817421173845813m), // 28 / 6
+ new TestResult(2, -0.013098973822817421173845813m), // 28 / 7
+ new TestResult(0, 37.461513046578399246836695461m), // 28 / 8
+ new TestResult(0, -323924659841968113506.41166762m), // 28 / 9
+ new TestResult(0, -21412.722077843692663812014719m), // 28 / 10
+ new TestResult(0, -1903557652.3848013647110715272m), // 28 / 11
+ new TestResult(0, 1360303825454277040707598638.1m), // 28 / 12
+ new TestResult(0, -2591583.7118874583629347087379m), // 28 / 13
+ new TestResult(0, 4656.9443405844146143879311m), // 28 / 14
+ new TestResult(0, 72.848832421725332869329889807m), // 28 / 15
+ new TestResult(0, -2464379472248467996678.919247m), // 28 / 16
+ new TestResult(0, 42423062487.893912564215173398m), // 28 / 17
+ new TestResult(0, -194.95718634257023426451589779m), // 28 / 18
+ new TestResult(0, 10.095300225653040883323838635m), // 28 / 19
+ new TestResult(0, 146555658460058271.30028503504m), // 28 / 20
+ new TestResult(0, 2496216357326773.3203945609668m), // 28 / 21
+ new TestResult(0, -162426651429846.93508891542812m), // 28 / 22
+ new TestResult(0, 2346142981848.9761467960716552m), // 28 / 23
+ new TestResult(0, -2023672514414.1119557698582125m), // 28 / 24
+ new TestResult(0, 1704283898.4827658021193146276m), // 28 / 25
+ new TestResult(0, -24398.879182297399040382596287m), // 28 / 26
+ new TestResult(0, -132911.26276382163838029345835m), // 28 / 27
+ new TestResult(0, 1m), // 28 / 28
+ new TestResult(0, -207681026417050638.7817636979m), // 28 / 29
+ new TestResult(3, 0m), // 29 / 0
+ new TestResult(0, -4997122966.448652425771563042m), // 29 / 1
+ new TestResult(0, 4997122966.448652425771563042m), // 29 / 2
+ new TestResult(0, -2498561483.224326212885781521m), // 29 / 3
+ new TestResult(0, -499712296.6448652425771563042m), // 29 / 4
+ new TestResult(0, -49971229664.48652425771563042m), // 29 / 5
+ new TestResult(2, -6.30725591E-20m), // 29 / 6
+ new TestResult(2, 6.30725591E-20m), // 29 / 7
+ new TestResult(2, -1.803800457503E-16m), // 29 / 8
+ new TestResult(0, 1559.7219709011119254589559305m), // 29 / 9
+ new TestResult(2, 1.031038918059089E-13m), // 29 / 10
+ new TestResult(2, 9.1657754452841005337E-09m), // 29 / 11
+ new TestResult(0, -6549966787.6381215871101448624m), // 29 / 12
+ new TestResult(2, 1.24786734570697837E-11m), // 29 / 13
+ new TestResult(2, -2.24235425880102E-14m), // 29 / 14
+ new TestResult(2, -3.507726905944E-16m), // 29 / 15
+ new TestResult(2, 11866.175330334086443056587349m), // 29 / 16
+ new TestResult(2, -2.042702851569255038994E-07m), // 29 / 17
+ new TestResult(2, 9.387337384931E-16m), // 29 / 18
+ new TestResult(2, -4.86096414286E-17m), // 29 / 19
+ new TestResult(2, -0.705676685966272906628710787m), // 29 / 20
+ new TestResult(2, -0.0120194723629401016807892544m), // 29 / 21
+ new TestResult(2, 0.0007820967289697085504718691m), // 29 / 22
+ new TestResult(2, -1.1296857600932761513324E-05m), // 29 / 23
+ new TestResult(2, 9.7441376775089367720444E-06m), // 29 / 24
+ new TestResult(2, -8.2062571043940289217E-09m), // 29 / 25
+ new TestResult(2, 1.17482466276439E-13m), // 29 / 26
+ new TestResult(2, 6.399778788502251E-13m), // 29 / 27
+ new TestResult(2, -4.8150763565E-18m), // 29 / 28
+ new TestResult(0, 1m), // 29 / 29
+ };
+
+ #endregion
+ }
+}
diff --git a/mcs/class/corlib/Test/System/DoubleTest.cs b/mcs/class/corlib/Test/System/DoubleTest.cs
new file mode 100644
index 00000000000..37cdd1679ba
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DoubleTest.cs
@@ -0,0 +1,194 @@
+// BooleanTest.cs - NUnit Test Cases for the System.Double class
+//
+// Bob Doan <bdoan@sicompos.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class DoubleTest : TestCase
+{
+ private const Double d_zero = 0.0;
+ private const Double d_neg = -1234.5678;
+ private const Double d_pos = 1234.9999;
+ private const Double d_pos2 = 1234.9999;
+ private const Double d_nan = Double.NaN;
+ private const Double d_pinf = Double.PositiveInfinity;
+ private const Double d_ninf = Double.NegativeInfinity;
+ private const String s = "What Ever";
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+
+ private string[] string_values = {
+ "1", ".1", "1.1", "-12", "44.444432", ".000021121",
+ " .00001", " .223 ", " -221.3233",
+ " 1.7976931348623157e308 ", "+1.7976931348623157E308", "-1.7976931348623157e308",
+ "4.9406564584124650e-324",
+ "6.28318530717958647692528676655900577",
+ "1e-05",
+ };
+ private double[] double_values = {
+ 1, .1, 1.1, -12, 44.444432, .000021121,
+ .00001, .223, -221.3233,
+ 1.7976931348623157e308, 1.7976931348623157e308, -1.7976931348623157e308,
+ 4.9406564584124650e-324,
+ 6.28318530717958647692528676655900577,
+ 1e-05
+ };
+
+ public DoubleTest () {}
+
+
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals("Epsilon Field has wrong value", 3.9406564584124654e-324, Double.Epsilon);
+ AssertEquals("MaxValue Field has wrong value", 1.7976931348623157e+308, Double.MaxValue);
+ AssertEquals("MinValue Field has wrong value", -1.7976931348623157e+308, Double.MinValue);
+ AssertEquals("NegativeInfinity Field has wrong value", (double)-1.0 / (double)(0.0), Double.NegativeInfinity);
+ AssertEquals("PositiveInfinity Field has wrong value", (double)1.0 / (double)(0.0), Double.PositiveInfinity);
+ }
+
+ public void TestCompareTo () {
+ //If you do int foo = d_ninf.CompareTo(d_pinf); Assert(".." foo < 0, true) this works.... WHY???
+ Assert("CompareTo Infinity failed", d_ninf.CompareTo(d_pinf) < 0);
+
+ Assert("CompareTo Failed01", d_neg.CompareTo(d_pos) < 0);
+ Assert("CompareTo NaN Failed", d_nan.CompareTo(d_neg) < 0);
+
+ AssertEquals("CompareTo Failed02", 0, d_pos.CompareTo(d_pos2));
+ AssertEquals("CompareTo Failed03", 0, d_pinf.CompareTo(d_pinf));
+ AssertEquals("CompareTo Failed04", 0, d_ninf.CompareTo(d_ninf));
+ AssertEquals("CompareTo Failed05", 0, d_nan.CompareTo(d_nan));
+
+ Assert("CompareTo Failed06", d_pos.CompareTo(d_neg) > 0);
+ Assert("CompareTo Failed07", d_pos.CompareTo(d_nan) > 0);
+ Assert("CompareTo Failed08", d_pos.CompareTo(null) > 0);
+
+ try {
+ d_pos.CompareTo(s);
+ Fail("CompareTo should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ AssertEquals ("CompareTo should be a System.ArgumentException", typeof(ArgumentException), e.GetType());
+ }
+
+ }
+
+ public void TestEquals () {
+ AssertEquals("Equals Failed", true, d_pos.Equals(d_pos2));
+ AssertEquals("Equals Failed", false, d_pos.Equals(d_neg));
+ AssertEquals("Equals Failed", false, d_pos.Equals(s));
+
+ }
+
+ public void TestTypeCode () {
+ AssertEquals("GetTypeCode Failed", TypeCode.Double, d_pos.GetTypeCode());
+ }
+
+ public void TestIsInfinity() {
+ AssertEquals("IsInfinity Failed", true, Double.IsInfinity(Double.PositiveInfinity));
+ AssertEquals("IsInfinity Failed", true, Double.IsInfinity(Double.NegativeInfinity));
+ AssertEquals("IsInfinity Failed", false, Double.IsInfinity(12));
+ }
+
+ public void TestIsNan() {
+ AssertEquals("IsNan Failed", true, Double.IsNaN(Double.NaN));
+ AssertEquals("IsNan Failed", false, Double.IsNaN(12));
+ AssertEquals("IsNan Failed", false, Double.IsNaN(Double.PositiveInfinity));
+ }
+
+ public void TestIsNegativeInfinity() {
+ AssertEquals("IsNegativeInfinity Failed", true, Double.IsNegativeInfinity(Double.NegativeInfinity));
+ AssertEquals("IsNegativeInfinity Failed", false, Double.IsNegativeInfinity(12));
+ }
+
+ public void TestIsPositiveInfinity() {
+ AssertEquals("IsPositiveInfinity Failed", true, Double.IsPositiveInfinity(Double.PositiveInfinity));
+ AssertEquals("IsPositiveInfinity Failed", false, Double.IsPositiveInfinity(12));
+ }
+
+ public void TestParse() {
+ int i=0;
+ try {
+ for(i=0;i<string_values.Length;i++) {
+ AssertEquals("Parse Failed", double_values[i], Double.Parse(string_values[i]));
+ }
+ } catch (Exception e) {
+ Fail("TestParse: i=" + i + " failed with e = " + e.ToString());
+ }
+
+ try {
+ AssertEquals("Parse Failed NumberStyles.Float", 10.1111, Double.Parse(" 10.1111 ", NumberStyles.Float, Nfi));
+ } catch (Exception e) {
+ Fail("TestParse: Parse Failed NumberStyles.Float with e = " + e.ToString());
+ }
+
+ try {
+ AssertEquals("Parse Failed NumberStyles.AllowThousands", 1234.5678, Double.Parse("1,234.5678", NumberStyles.Float | NumberStyles.AllowThousands, Nfi));
+ } catch (Exception e) {
+ Fail("TestParse: Parse Failed NumberStyles.AllowThousands with e = " + e.ToString());
+ }
+
+ try {
+ Double.Parse(null);
+ Fail("Parse should raise a ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a ArgumentNullException", typeof(ArgumentNullException) == e.GetType());
+ }
+
+ try {
+ Double.Parse("save the elk");
+ Fail("Parse should raise a FormatException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a FormatException", typeof(FormatException) == e.GetType());
+ }
+
+ double ovf_plus = 0;
+ try {
+ ovf_plus = Double.Parse("1.79769313486232e308");
+ Fail("Parse should have raised an OverflowException +");
+ }
+ catch (Exception e) {
+ AssertEquals("Should be an OverflowException + for " + ovf_plus, typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Double.Parse("-1.79769313486232e308");
+ Fail("Parse should have raised an OverflowException -");
+ }
+ catch (Exception e) {
+ AssertEquals("Should be an OverflowException -", typeof(OverflowException), e.GetType());
+ }
+
+
+ }
+
+ public void TestToString() {
+ //ToString is not yet Implemented......
+ //AssertEquals("ToString Failed", "1234.9999", d_pos.ToString());
+ double d;
+ try {
+ d = 3.1415;
+ d.ToString ("X");
+ Fail ("Should have thrown FormatException");
+ } catch (FormatException) {
+ /* do nothing, this is what we expect */
+ } catch (Exception e) {
+ Fail ("Unexpected exception e: " + e);
+ }
+ }
+
+}
+}
diff --git a/mcs/class/corlib/Test/System/EnumTest.cs b/mcs/class/corlib/Test/System/EnumTest.cs
new file mode 100644
index 00000000000..231f1033f2e
--- /dev/null
+++ b/mcs/class/corlib/Test/System/EnumTest.cs
@@ -0,0 +1,760 @@
+// EnumTest.cs - NUnit Test Cases for the System.Enum class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Reflection;
+
+
+namespace MonoTests.System
+{
+
+public class EnumTest : TestCase
+{
+ public EnumTest() {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ enum TestingEnum {This, Is, A, Test};
+ enum TestingEnum2 {This, Is, A, Test};
+ enum TestingEnum3: ulong {This, Is, A, Test = ulong.MaxValue };
+
+ public void TestCompareTo() {
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum();
+ Enum e3 = new TestingEnum2();
+
+ AssertEquals("An enum should equal itself",
+ 0, e1.CompareTo(e1));
+ AssertEquals("An enum should equal a copy",
+ 0, e1.CompareTo(e2));
+
+ TestingEnum x = TestingEnum.This;
+ TestingEnum y = TestingEnum.Is;
+ AssertEquals("should equal", 0, x.CompareTo(x));
+ AssertEquals("less than", -1, x.CompareTo(y));
+ AssertEquals("greater than", 1, y.CompareTo(x));
+
+ {
+ bool errorThrown = false;
+ try {
+ e1.CompareTo(e3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("1) Compare type mismatch not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ((Enum)e1).CompareTo((Enum)e3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("2) Compare type mismatch not caught.",
+ errorThrown);
+ }
+ }
+
+ public void TestEquals() {
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum();
+ Enum e3 = new TestingEnum2();
+
+ Assert("An enum should equal itself", e1.Equals(e1));
+ Assert("An enum should equal a copy", e1.Equals(e2));
+
+ Assert("Shouldn't match", !e1.Equals(e3));
+ Assert("Shouldn't match null", !e1.Equals(null));
+ }
+
+ public void TestFormat_Args() {
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(null, x, "G");
+ Fail("null first arg not caught.");
+ } catch (ArgumentNullException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail("first arg null, wrong exception: " + e.ToString());
+ }
+
+ try {
+ Enum.Format(typeof(TestingEnum), null, "G");
+ Fail("null second arg not caught.");
+ } catch (ArgumentNullException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail("second arg null, wrong exception: " + e.ToString());
+ }
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), x, null);
+ Fail("null third arg not caught.");
+ } catch (ArgumentNullException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail("third arg null, wrong exception: " + e.ToString());
+ }
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(typeof(string), x, "G");
+ Fail("bad type arg not caught.");
+ } catch (ArgumentException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail("bad type, wrong exception: " + e.ToString());
+ }
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ TestingEnum2 y = TestingEnum2.Test;
+ Enum.Format(y.GetType(), x, "G");
+ Fail("wrong enum type not caught.");
+ } catch (ArgumentException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail("wrong enum type, wrong exception: " + e.ToString());
+ }
+
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), bad, "G");
+ Fail("non-enum object not caught.");
+ } catch (ArgumentException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail("non-enum object, wrong exception: " + e.ToString());
+ }
+
+ string[] codes = {"a", "b", "c", "ad", "e", "af", "ag", "h",
+ "i", "j", "k", "l", "m", "n", "o", "p",
+ "q", "r", "s", "t", "u", "v", "w", "ax",
+ "y", "z"};
+ foreach (string code in codes) {
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), x, code);
+ Fail ("bad format code not caught - " + code);
+ } catch (FormatException) {
+ // do nothing
+ } catch (Exception e) {
+ Fail (String.Format ("bad format code ({0}), wrong exception: {1}",
+ code, e.ToString()));
+ }
+ }
+
+ TestingEnum ex = TestingEnum.Test;
+ AssertEquals("decimal format wrong",
+ "3", Enum.Format(ex.GetType(), ex, "d"));
+ AssertEquals("decimal format wrong for ulong enums",
+ "18446744073709551615", Enum.Format(typeof(TestingEnum3), TestingEnum3.Test, "d"));
+ AssertEquals("named format wrong",
+ "Test", Enum.Format(ex.GetType(), ex, "g"));
+ AssertEquals("hex format wrong",
+ "00000003", Enum.Format(ex.GetType(), ex, "x"));
+ AssertEquals("bitfield format wrong",
+ "Test", Enum.Format(ex.GetType(), ex, "f"));
+ }
+
+ public void TestFormat_FormatSpecifier ()
+ {
+ ParameterAttributes pa =
+ ParameterAttributes.In | ParameterAttributes.HasDefault;
+ const string fFormatOutput = "In, HasDefault";
+ const string xFormatOutput = "00001001";
+ string fOutput = Enum.Format (pa.GetType(), pa, "f");
+ AssertEquals ("#F_FS:f", fFormatOutput, fOutput);
+ string xOutput = Enum.Format (pa.GetType(), pa, "x");
+ AssertEquals ("#F_FS:x", xFormatOutput, xOutput);
+ }
+
+ public void TestGetHashCode() {
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum2();
+
+ AssertEquals("hash code is deterministic",
+ e1.GetHashCode(), e1.GetHashCode());
+ }
+
+ public void GetName() {
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(null, x);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(x.GetType(), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(bad.GetType(), x);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ TestingEnum2 y = TestingEnum2.Test;
+ Enum.GetName(y.GetType(), x);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("wrong enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum object not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum x = TestingEnum.This;
+ TestingEnum y = TestingEnum.Is;
+ TestingEnum z = TestingEnum.A;
+
+ AssertEquals("first name doesn't match",
+ "This", Enum.GetName(x.GetType(), x));
+ AssertEquals("second name doesn't match",
+ "Is", Enum.GetName(y.GetType(), y));
+ AssertEquals("third name doesn't match",
+ "A", Enum.GetName(z.GetType(), z));
+ }
+ }
+
+ public void TestGetNames() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.GetNames(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum x = TestingEnum.This;
+ string[] match = {"This", "Is", "A", "Test"};
+ string[] names = Enum.GetNames(x.GetType());
+ AssertNotNull("Got no names", names);
+ AssertEquals("names wrong size",
+ match.Length, names.Length);
+ for (int i = 0; i < names.Length; i++) {
+ AssertEquals("name mismatch",
+ match[i], names[i]);
+ }
+ }
+ }
+
+ public void TestGetTypeCode() {
+ TestingEnum x = TestingEnum.This;
+ TestingEnum y = new TestingEnum();
+ AssertEquals("01 bad type code",
+ TypeCode.Int32, x.GetTypeCode());
+ AssertEquals("02 bad type code",
+ TypeCode.Int32, y.GetTypeCode());
+ }
+
+ enum TestShortEnum : short { zero, one, two, three, four, five, six};
+ public void TestGetUnderlyingType() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.GetUnderlyingType(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ Enum.GetUnderlyingType(bad.GetType());
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ short sh = 5;
+ int i = 5;
+ Enum t1 = new TestingEnum();
+ Enum t2 = new TestShortEnum();
+ AssertEquals("Wrong default underlying type",
+ i.GetType(),
+ Enum.GetUnderlyingType(t1.GetType()));
+ AssertEquals("Not short underlying type",
+ sh.GetType(),
+ Enum.GetUnderlyingType(t2.GetType()));
+ }
+ }
+
+ public void TestGetValues() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.GetValues(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ Enum.GetValues(bad.GetType());
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ Enum t1 = new TestingEnum();
+ Array a1 = Enum.GetValues(t1.GetType());
+ for (int i= 0; i < a1.Length; i++) {
+ AssertEquals("wrong enum value",
+ (TestingEnum)i,
+ a1.GetValue(i));
+ }
+ }
+ {
+ Enum t1 = new TestShortEnum();
+ Array a1 = Enum.GetValues(t1.GetType());
+ for (short i= 0; i < a1.Length; i++) {
+ AssertEquals("wrong short enum value",
+ (TestShortEnum)i,
+ a1.GetValue(i));
+ }
+ }
+ }
+
+ public void TestIsDefined() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.IsDefined(null, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.IsDefined(x.GetType(), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ int i = 4;
+ Enum.IsDefined(bad.GetType(), i);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ short i = 4;
+ Enum.IsDefined(x.GetType(), i);
+ Fail("wrong underlying type not caught.");
+ } catch (ArgumentException) {
+ } catch (Exception e) {
+ Fail("wrong Exception thrown ("+e.ToString()+")for underlying type not caught.");
+ }
+
+ // spec says yes, MS impl says no.
+ //{
+ //bool errorThrown = false;
+ //try {
+ //String bad = "huh?";
+ //TestingEnum x = TestingEnum.Test;
+ //Enum.IsDefined(x.GetType(), bad);
+ //} catch (ExecutionEngineException) {
+ //errorThrown = true;
+ //}
+ //Assert("non-enum object not caught.",
+ //errorThrown);
+ //}
+ {
+ Enum t1 = new TestingEnum();
+ int i = 0;
+ for (i = 0;
+ i < Enum.GetValues(t1.GetType()).Length; i++) {
+ Assert("should have value for i=" + i,
+ Enum.IsDefined(t1.GetType(), i));
+ }
+ Assert("Shouldn't have value",
+ !Enum.IsDefined(t1.GetType(), i));
+ }
+ }
+
+ public void TestParse1() {
+ {
+ bool errorThrown = false;
+ try {
+ String name = "huh?";
+ Enum.Parse(null, name);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ Enum.Parse(bad.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = "";
+ Enum.Parse(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = " ";
+ Enum.Parse(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("space-only string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("not-in-enum error not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum t1 = new TestingEnum();
+ AssertEquals("parse first enum",
+ TestingEnum.This,
+ Enum.Parse(t1.GetType(), "This"));
+ AssertEquals("parse second enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "Is"));
+ AssertEquals("parse third enum",
+ TestingEnum.A,
+ Enum.Parse(t1.GetType(), "A"));
+ AssertEquals("parse last enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "Test"));
+
+ AssertEquals("parse last enum with whitespace",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), " \n\nTest\t"));
+
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "This,Is"));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,Test"));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,Is,A"));
+
+ AssertEquals("parse bitwise-or enum with whitespace",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), " \n\tThis \t\n, Is,A \n"));
+ }
+ }
+ public void TestParse2() {
+ {
+ bool errorThrown = true;
+ try {
+ String name = "huh?";
+ Enum.Parse(null, name, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ String bad = "huh?";
+ Enum.Parse(bad.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = "";
+ Enum.Parse(x.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = " ";
+ Enum.Parse(x.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("space-only string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("not-in-enum error not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ String bad = "test";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), bad, false);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("not-in-enum error not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum t1 = new TestingEnum();
+ AssertEquals("parse first enum",
+ TestingEnum.This,
+ Enum.Parse(t1.GetType(), "this", true));
+ AssertEquals("parse second enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "is", true));
+ AssertEquals("parse third enum",
+ TestingEnum.A,
+ Enum.Parse(t1.GetType(), "a", true));
+ AssertEquals("parse last enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "test", true));
+
+ AssertEquals("parse last enum with whitespace",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), " \n\ntest\t", true));
+
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "This,is", true));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,test", true));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,is,A", true));
+
+ AssertEquals("parse bitwise-or enum with whitespace",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), " \n\tThis \t\n, is,a \n",
+ true));
+ }
+ }
+
+ public void TestToObject() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.ToObject(null, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Enum.ToObject("huh?".GetType(), 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum t1 = new TestingEnum();
+ AssertEquals("Should get object",
+ TestingEnum.This,
+ Enum.ToObject(t1.GetType(), 0));
+ }
+ // TODO - should probably test all the different underlying types
+ }
+
+ [Flags]
+ enum SomeEnum {a,b,c};
+
+ [Flags]
+ enum SomeByteEnum : byte {a,b,c};
+
+ [Flags]
+ enum SomeInt64Enum : long {a,b,c};
+
+ public void TestToString() {
+ int i = 0;
+ try {
+ i++;
+ AssertEquals("invalid string", "This",
+ TestingEnum.This.ToString());
+ i++;
+ AssertEquals("invalid string", "Is",
+ TestingEnum.Is.ToString());
+ i++;
+ AssertEquals("invalid string", "A",
+ TestingEnum.A.ToString());
+ i++;
+ AssertEquals("invalid string", "Test",
+ TestingEnum.Test.ToString());
+
+ Enum is1 = TestingEnum.Is;
+
+ i++;
+ AssertEquals("decimal parse wrong",
+ "1", is1.ToString("d"));
+ i++;
+ AssertEquals("named format wrong",
+ "Is", is1.ToString("g"));
+ i++;
+ AssertEquals("hex format wrong",
+ "00000001", is1.ToString("x"));
+ i++;
+ AssertEquals("bitfield format wrong",
+ "Is", is1.ToString("f"));
+
+ i++;
+ AssertEquals("bitfield with flags format wrong for Int32 enum",
+ "b, c", ((SomeEnum)3).ToString("f"));
+ i++;
+ AssertEquals("bitfield with flags format wrong for Byte enum",
+ "b, c", ((SomeByteEnum)3).ToString("f"));
+ i++;
+ AssertEquals("bitfield with flags format wrong for Int64 enum",
+ "b, c", ((SomeInt64Enum)3).ToString("f"));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at i = " + i + " with e=" + e);
+ }
+ }
+
+ // TODO - ToString with IFormatProviders
+}
+}
diff --git a/mcs/class/corlib/Test/System/ExceptionTest.cs b/mcs/class/corlib/Test/System/ExceptionTest.cs
new file mode 100644
index 00000000000..0525b3bd109
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ExceptionTest.cs
@@ -0,0 +1,197 @@
+//
+// ExceptionTest.cs - NUnit Test Cases for the System.Exception class
+//
+// Linus Upson (linus@linus.com)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System
+{
+ public class ExceptionTest : TestCase
+ {
+ public ExceptionTest() {}
+
+ // This test makes sure that exceptions thrown on block boundaries are
+ // handled in the correct block. The meaning of the 'caught' variable is
+ // a little confusing since there are two catchers: the method being
+ // tested the the method calling the test. There is probably a better
+ // name, but I can't think of it right now.
+
+ public void TestThrowOnBlockBoundaries()
+ {
+ bool caught;
+
+ try {
+ caught = false;
+ ThrowBeforeTry();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown before try blocks should not be caught", caught);
+
+ try {
+ caught = false;
+ ThrowAtBeginOfTry();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown at begin of try blocks should be caught", !caught);
+
+ try {
+ caught = false;
+ ThrowAtEndOfTry();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown at end of try blocks should be caught", !caught);
+
+ try {
+ caught = false;
+ ThrowAtBeginOfCatch();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown at begin of catch blocks should not be caught", caught);
+
+ try {
+ caught = false;
+ ThrowAtEndOfCatch();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown at end of catch blocks should not be caught", caught);
+
+ try {
+ caught = false;
+ ThrowAtBeginOfFinally();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown at begin of finally blocks should not be caught", caught);
+
+ try {
+ caught = false;
+ ThrowAtEndOfFinally();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown at end of finally blocks should not be caught", caught);
+
+ try {
+ caught = false;
+ ThrowAfterFinally();
+ } catch {
+ caught = true;
+ }
+ Assert("Exceptions thrown after finally blocks should not be caught", caught);
+ }
+
+ private static void DoNothing()
+ {
+ }
+
+ private static void ThrowException()
+ {
+ throw new Exception();
+ }
+
+ private static void ThrowBeforeTry()
+ {
+ ThrowException();
+ try {
+ DoNothing();
+ } catch (Exception) {
+ DoNothing();
+ }
+ }
+
+ private static void ThrowAtBeginOfTry()
+ {
+ DoNothing();
+ try {
+ ThrowException();
+ DoNothing();
+ } catch (Exception) {
+ DoNothing();
+ }
+ }
+
+ private static void ThrowAtEndOfTry()
+ {
+ DoNothing();
+ try {
+ DoNothing();
+ ThrowException();
+ } catch (Exception) {
+ DoNothing();
+ }
+ }
+
+ private static void ThrowAtBeginOfCatch()
+ {
+ DoNothing();
+ try {
+ DoNothing();
+ ThrowException();
+ } catch (Exception) {
+ throw;
+ }
+ }
+
+ private static void ThrowAtEndOfCatch()
+ {
+ DoNothing();
+ try {
+ DoNothing();
+ ThrowException();
+ } catch (Exception) {
+ DoNothing();
+ throw;
+ }
+ }
+
+ private static void ThrowAtBeginOfFinally()
+ {
+ DoNothing();
+ try {
+ DoNothing();
+ ThrowException();
+ } catch (Exception) {
+ DoNothing();
+ } finally {
+ ThrowException();
+ DoNothing();
+ }
+ }
+
+ private static void ThrowAtEndOfFinally()
+ {
+ DoNothing();
+ try {
+ DoNothing();
+ ThrowException();
+ } catch (Exception) {
+ DoNothing();
+ } finally {
+ DoNothing();
+ ThrowException();
+ }
+ }
+
+ private static void ThrowAfterFinally()
+ {
+ DoNothing();
+ try {
+ DoNothing();
+ ThrowException();
+ } catch (Exception) {
+ DoNothing();
+ } finally {
+ DoNothing();
+ }
+ ThrowException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System/GuidTest.cs b/mcs/class/corlib/Test/System/GuidTest.cs
new file mode 100755
index 00000000000..2926be3a5cc
--- /dev/null
+++ b/mcs/class/corlib/Test/System/GuidTest.cs
@@ -0,0 +1,240 @@
+//
+// GuidTest.cs - NUnit Test Cases for the System.Guid struct
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class GuidTest : TestCase
+{
+ public GuidTest () {}
+
+ public void TestCtor1 ()
+ {
+ Guid g = new Guid (new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f});
+ bool exception;
+
+ if (BitConverter.IsLittleEndian) {
+ AssertEquals ("A1", "03020100-0504-0706-0809-0a0b0c0d0e0f", g.ToString ());
+ }
+ else {
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ());
+ }
+
+ try {
+ Guid g1 = new Guid ((byte[]) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A2", exception);
+
+ try {
+ Guid g1 = new Guid (new byte[] {0x00, 0x01, 0x02});
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A3", exception);
+ }
+
+ public void TestCtor2 ()
+ {
+ Guid g1 = new Guid ("00010203-0405-0607-0809-0a0b0c0d0e0f");
+ Guid g2 = new Guid ("{00010203-0405-0607-0809-0A0B0C0D0E0F}");
+ Guid g3 = new Guid ("{0x00010203,0x0405,0x0607,{0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}}");
+ Guid g4;
+ Guid g5;
+
+ bool exception;
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g1.ToString ());
+ AssertEquals ("A2", "00010203-0405-0607-0809-0a0b0c0d0e0f", g2.ToString ());
+ AssertEquals ("A3", "00010203-0405-0607-0809-0a0b0c0d0e0f", g3.ToString ());
+
+ try {
+ g4 = new Guid ((string) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ g5 = new Guid ("invalid");
+ exception = false;
+ }
+ catch (FormatException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+
+ }
+
+ public void TestCtor4 ()
+ {
+ Guid g1 = new Guid (0x00010203, (short) 0x0405, (short) 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (unchecked ((int) 0xffffffff), unchecked ((short) 0xffff), unchecked((short) 0xffff), 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g1.ToString ());
+ AssertEquals ("A2", "ffffffff-ffff-ffff-ffff-ffffffffffff", g2.ToString ());
+
+ }
+
+ public void TestCtor5 ()
+ {
+ Guid g1 = new Guid (0x00010203u, (ushort) 0x0405u, (ushort) 0x0607u, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0xffffffffu, (ushort) 0xffffu, (ushort) 0xffffu, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g1.ToString ());
+ AssertEquals ("A2", "ffffffff-ffff-ffff-ffff-ffffffffffff", g2.ToString ());
+
+ }
+
+ public void TestEmpty ()
+ {
+ AssertEquals ("A1", "00000000-0000-0000-0000-000000000000", Guid.Empty.ToString ());
+ }
+
+ public void TestNewGuid ()
+ {
+ Guid g1 = Guid.NewGuid ();
+ Guid g2 = Guid.NewGuid ();
+
+ Assert ("A1", g1 != g2);
+ }
+
+ public void TestEqualityOp ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x11223344, 0x5566, 0x6677, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
+
+ AssertEquals ("A1", true, g1 == g1);
+ AssertEquals ("A2", true, g1 == g2);
+ AssertEquals ("A3", false, g1 == g3);
+ }
+
+ public void TestInequalityOp ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x11223344, 0x5566, 0x6677, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
+
+ AssertEquals ("A1", false, g1 != g1);
+ AssertEquals ("A2", false, g1 != g2);
+ AssertEquals ("A3", true, g1 != g3);
+ }
+
+ public void TestEquals ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x11223344, 0x5566, 0x6677, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
+ string s = "This is not a Guid!";
+
+ AssertEquals ("A1", true, g1.Equals (g1));
+ AssertEquals ("A2", true, g1.Equals (g2));
+ AssertEquals ("A3", false, g1.Equals (g3));
+ AssertEquals ("A4", false, g1.Equals (null));
+ AssertEquals ("A5", false, g1.Equals (s));
+ }
+
+ public void TestCompareTo ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010204, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x00010203, 0x0405, 0x0607, 0x09, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g4 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x1f);
+ bool exception;
+
+ Assert ("A1", g1.CompareTo (g2) < 0);
+ Assert ("A2", g1.CompareTo (g3) < 0);
+ Assert ("A3", g1.CompareTo (g4) < 0);
+ Assert ("A4", g2.CompareTo (g1) > 0);
+ Assert ("A5", g3.CompareTo (g1) > 0);
+ Assert ("A6", g4.CompareTo (g1) > 0);
+ Assert ("A7", g1.CompareTo (g1) == 0);
+ Assert ("A8", g1.CompareTo (null) > 0);
+
+ try {
+ g1.CompareTo ("Say what?");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+ }
+
+ public void TestGetHashCode ()
+ {
+ // We don't test anything but the availibility of this member
+ int res = Guid.NewGuid ().GetHashCode ();
+
+ Assert ("A1", true);
+ }
+
+ public void TestToByteArray ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ byte[] b = g1.ToByteArray ();
+
+ AssertEquals ("A1", 0x00010203, BitConverter.ToInt32 (b, 0));
+ AssertEquals ("A2", (short) 0x0405, BitConverter.ToInt16 (b, 4));
+ AssertEquals ("A3", (short) 0x0607, BitConverter.ToInt16 (b, 6));
+ for (int i=8; i<16; ++i) {
+ AssertEquals ("A1", (byte) i, b [i]);
+ }
+
+ }
+
+ public void TestToString ()
+ {
+ Guid g = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ bool exception;
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ());
+ AssertEquals ("A2", "000102030405060708090a0b0c0d0e0f", g.ToString ("N"));
+ AssertEquals ("A3", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ("D"));
+ AssertEquals ("A4", "{00010203-0405-0607-0809-0a0b0c0d0e0f}", g.ToString ("B"));
+ AssertEquals ("A5", "(00010203-0405-0607-0809-0a0b0c0d0e0f)", g.ToString ("P"));
+ AssertEquals ("A6", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString (""));
+ AssertEquals ("A7", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ((string)null));
+
+ try {
+ g.ToString ("X");
+ exception = false;
+ }
+ catch (FormatException) {
+ exception = true;
+ }
+ Assert ("A8", exception);
+
+ try {
+ g.ToString ("This is invalid");
+ exception = false;
+ }
+ catch (FormatException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+
+ AssertEquals ("A10", "{00010203-0405-0607-0809-0a0b0c0d0e0f}", g.ToString ("B", null));
+
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/Int16Test.cs b/mcs/class/corlib/Test/System/Int16Test.cs
new file mode 100644
index 00000000000..d9df8a87efb
--- /dev/null
+++ b/mcs/class/corlib/Test/System/Int16Test.cs
@@ -0,0 +1,186 @@
+// Int16Test.cs - NUnit Test Cases for the System.Int16 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class Int16Test : TestCase
+{
+ private const Int16 MyInt16_1 = -42;
+ private const Int16 MyInt16_2 = -32768;
+ private const Int16 MyInt16_3 = 32767;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-32768";
+ private const string MyString3 = "32767";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {null, "-32768", "-3.276800e+004", "-32768.00",
+ "-32768", "-32,768.00", "-3,276,800.00 %", "8000"};
+ private string[] Results2 = {null, "32767", "3.27670e+004", "32767.00000",
+ "32767", "32,767.00000", "3,276,700.00000 %", "07fff"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"32,768.00)", "-32768", "-3.276800e+004", "-32768.00",
+ "-32768", "-32,768.00", "-3,276,800.00 %", "8000"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"32,767.00000", "32767", "3.27670e+004", "32767.00000",
+ "32767", "32,767.00000", "3,276,700.00000 %", "07fff"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public Int16Test() {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ // We can't initialize this until we set the culture.
+ Results1 [0] = "("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"32,768.00)";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"32,767.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(Int16.MinValue, MyInt16_2);
+ AssertEquals(Int16.MaxValue, MyInt16_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyInt16_3.CompareTo(MyInt16_2) > 0);
+ Assert(MyInt16_2.CompareTo(MyInt16_2) == 0);
+ Assert(MyInt16_1.CompareTo((Int16)(-42)) == 0);
+ Assert(MyInt16_2.CompareTo(MyInt16_3) < 0);
+ try {
+ MyInt16_2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyInt16_1.Equals(MyInt16_1));
+ Assert(MyInt16_1.Equals((Int16)(-42)));
+ Assert(MyInt16_1.Equals((SByte)(-42)) == false);
+ Assert(MyInt16_1.Equals(MyInt16_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyInt16_1.GetHashCode();
+ MyInt16_2.GetHashCode();
+ MyInt16_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MyInt16_1 == Int16.Parse(MyString1));
+ Assert(MyInt16_2 == Int16.Parse(MyString2));
+ Assert(MyInt16_3 == Int16.Parse(MyString3));
+ try {
+ Int16.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ Int16.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = Int16.MaxValue + 1;
+ Int16.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ Assert(42 == Int16.Parse(" $42 ", NumberStyles.Currency));
+ try {
+ Int16.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(-42 == Int16.Parse(" -42 ", Nfi));
+ try {
+ Int16.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == Int16.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Int16.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ Assert(String.Compare(MyString1, MyInt16_1.ToString()) == 0);
+ Assert(String.Compare(MyString2, MyInt16_2.ToString()) == 0);
+ Assert(String.Compare(MyString3, MyInt16_3.ToString()) == 0);
+ //test ToString(string format)
+ /*
+ TODO: These tests are culture sensitive. Need to find a way to determine the culture
+ of the system to decide the correct expected result.
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert(String.Compare(Results1[i], MyInt16_2.ToString(Formats1[i])) == 0);
+ Assert(String.Compare(Results2[i], MyInt16_3.ToString(Formats2[i])) == 0);
+ }
+ */
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert("i="+i+", ResultsNfi1[i]="+ResultsNfi1[i]+", MyInt16_2.ToString(Formats1[i]="+Formats1[i]+"): Expected "+ResultsNfi1[i]+" but got "+MyInt16_2.ToString(Formats1[i], Nfi), String.Compare(ResultsNfi1[i], MyInt16_2.ToString(Formats1[i], Nfi)) == 0);
+ Assert("i="+i+", ResultsNfi2[i]="+ResultsNfi2[i]+", MyInt16_3.ToString(Formats2[i]="+Formats2[i]+"): Expected "+ResultsNfi2[i]+" but got "+MyInt16_3.ToString(Formats2[i], Nfi), String.Compare(ResultsNfi2[i], MyInt16_3.ToString(Formats2[i], Nfi)) == 0);
+ }
+ try {
+ MyInt16_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/Int32Test.cs b/mcs/class/corlib/Test/System/Int32Test.cs
new file mode 100644
index 00000000000..7edeb917600
--- /dev/null
+++ b/mcs/class/corlib/Test/System/Int32Test.cs
@@ -0,0 +1,229 @@
+// Int32Test.cs - NUnit Test Cases for the System.Int32 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class Int32Test : TestCase
+{
+ private const Int32 MyInt32_1 = -42;
+ private const Int32 MyInt32_2 = -2147483648;
+ private const Int32 MyInt32_3 = 2147483647;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-2147483648";
+ private const string MyString3 = "2147483647";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {null,
+ "-2147483648", "-2.147484e+009", "-2147483648.00",
+ "-2147483648", "-2,147,483,648.00", "-214,748,364,800.00 %", "80000000"};
+ private string[] Results2 = {null,
+ "2147483647", "2.14748e+009", "2147483647.00000",
+ "2.1475e+09", "2,147,483,647.00000", "214,748,364,700.00000 %", "7fffffff"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"2,147,483,648.00)",
+ "-2147483648", "-2.147484e+009", "-2147483648.00",
+ "-2147483648", "-2,147,483,648.00", "-214,748,364,800.00 %", "80000000"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"2,147,483,647.00000",
+ "2147483647", "2.14748e+009", "2147483647.00000",
+ "2.1475e+09", "2,147,483,647.00000", "214,748,364,700.00000 %", "7fffffff"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public Int32Test() {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ // We can't initialize this until we set the culture.
+ Results1 [0] = "("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"2,147,483,648.00)";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"2,147,483,647.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals("#A01", Int32.MinValue, MyInt32_2);
+ AssertEquals("#A02", Int32.MaxValue, MyInt32_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert("MyInt32_3.CompareTo(MyInt32_2) > 0", MyInt32_3.CompareTo(MyInt32_2) > 0);
+ Assert("MyInt32_2.CompareTo(MyInt32_2) == 0", MyInt32_2.CompareTo(MyInt32_2) == 0);
+ Assert("MyInt32_1.CompareTo((Int32)(-42)) == 0", MyInt32_1.CompareTo((Int32)(-42)) == 0);
+ Assert("MyInt32_2.CompareTo(MyInt32_3) < 0", MyInt32_2.CompareTo(MyInt32_3) < 0);
+ try {
+ MyInt32_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert("typeof(ArgumentException) == e.GetType()", typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert ("#B01", MyInt32_1.Equals (MyInt32_1));
+ Assert ("#B02", MyInt32_1.Equals ((Int32)(-42)));
+ Assert ("#B03", MyInt32_1.Equals ((SByte)(-42)) == false);
+ Assert ("#B04", MyInt32_1.Equals (MyInt32_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyInt32_1.GetHashCode();
+ MyInt32_2.GetHashCode();
+ MyInt32_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ AssertEquals ("#C01", MyInt32_1, Int32.Parse (MyString1));
+ AssertEquals ("#C02", MyInt32_2, Int32.Parse (MyString2));
+ AssertEquals ("#C03", MyInt32_3, Int32.Parse (MyString3));
+
+ AssertEquals ("#C04", 1, Int32.Parse ("1"));
+ AssertEquals ("#C05", 1, Int32.Parse (" 1"));
+ AssertEquals ("#C06", 1, Int32.Parse (" 1"));
+ AssertEquals ("#C07", 1, Int32.Parse ("1 "));
+ AssertEquals ("#C08", 1, Int32.Parse ("+1"));
+ AssertEquals ("#C09", -1, Int32.Parse ("-1"));
+ AssertEquals ("#C10", -1, Int32.Parse (" -1"));
+ AssertEquals ("#C11", -1, Int32.Parse (" -1 "));
+ AssertEquals ("#C12", -1, Int32.Parse (" -1 "));
+
+ try {
+ Int32.Parse(null);
+ Fail ("#C13: Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert ("#C14", typeof (ArgumentNullException) == e.GetType());
+ }
+ try {
+ Int32.Parse("not-a-number");
+ Fail ("#C15: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#C16", typeof (FormatException) == e.GetType());
+ }
+ try {
+ double OverInt = (double)Int32.MaxValue + 1;
+ Int32.Parse(OverInt.ToString());
+ Fail ("#C17: Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ AssertEquals ("#C18", typeof (OverflowException), e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ AssertEquals ("#C19", 42, Int32.Parse (" $42 ", NumberStyles.Currency));
+ try {
+ Int32.Parse("$42", NumberStyles.Integer);
+ Fail ("#C20: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#C21", typeof (FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ AssertEquals ("#C22", -42, Int32.Parse (" -42 ", Nfi));
+ try {
+ Int32.Parse("%42", Nfi);
+ Fail ("#C23: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#C24", typeof (FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ AssertEquals ("#C25", 16, Int32.Parse (" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Int32.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail ("#C26: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("#C27", typeof (FormatException) == e.GetType());
+ }
+
+ try {
+ Int32.Parse (" - 1 ");
+ Fail ("#C28: Should raise FormatException");
+ } catch (Exception e){
+ Assert ("#C29", typeof (FormatException) == e.GetType ());
+ }
+
+ try {
+ Int32.Parse (" - ");
+ Fail ("#C30: Should raise FormatException");
+ } catch (Exception e){
+ Assert ("#C31", typeof (FormatException) == e.GetType ());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals ("#D01", MyString1, MyInt32_1.ToString ());
+ AssertEquals ("#D02", MyString2, MyInt32_2.ToString ());
+ AssertEquals ("#D03", MyString3, MyInt32_3.ToString ());
+
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals ("#D04(" + i + "," + Formats1 [i] + ")",
+ ResultsNfi1 [i], MyInt32_2.ToString (Formats1 [i], Nfi));
+ AssertEquals ("#D05(" + i + "," + Formats2 [i] + ")",
+ ResultsNfi2 [i], MyInt32_3.ToString (Formats2 [i], Nfi));
+ }
+
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals ("#D06(" + i + ")", Results1 [i],
+ MyInt32_2.ToString(Formats1[i]));
+ AssertEquals ("#D07(" + i + ")", Results2 [i],
+ MyInt32_3.ToString(Formats2[i]));
+ }
+
+ try {
+ MyInt32_1.ToString("z");
+ Fail ("#D08: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#D09", typeof (FormatException) == e.GetType());
+ }
+ }
+
+ public void TestCustomToString()
+ {
+ int i = 123;
+
+ AssertEquals ("Custom format string 00000", "00123", i.ToString ("00000"));
+ AssertEquals ("Custom format string ####", "123", i.ToString ("####"));
+ AssertEquals ("Custom format string ####", "0123", i.ToString ("0###"));
+ AssertEquals ("Custom format string ####", "0123", i.ToString ("#0###"));
+ AssertEquals ("Custom format string ####", "000123", i.ToString ("0#0###"));
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/Int64Test.cs b/mcs/class/corlib/Test/System/Int64Test.cs
new file mode 100644
index 00000000000..71f61c3ad47
--- /dev/null
+++ b/mcs/class/corlib/Test/System/Int64Test.cs
@@ -0,0 +1,352 @@
+// Int64Test.cs - NUnit Test Cases for the System.Int64 struct
+//
+// Author: Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, 2001
+//
+// tests ToString and Parse function with the culture independent
+// NumberFormatInfo.InvariantInfo
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.Threading;
+
+ /// <summary>
+ /// Tests for System.Int64
+ /// </summary>
+namespace MonoTests.System
+{
+
+public class Int64Test : TestCase
+{
+ private const Int64 MyInt64_1 = -42;
+ private const Int64 MyInt64_2 = -9223372036854775808;
+ private const Int64 MyInt64_3 = 9223372036854775807;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-9223372036854775808";
+ private const string MyString3 = "9223372036854775807";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {"", "-9223372036854775808", "-9.223372e+018", "-9223372036854775808.00",
+ "-9223372036854775808", "-9,223,372,036,854,775,808.00", "-922,337,203,685,477,580,800.00 %", "8000000000000000"};
+ private string[] Results2 = {"", "9223372036854775807", "9.22337e+018", "9223372036854775807.00000",
+ "9.2234e+18", "9,223,372,036,854,775,807.00000", "922,337,203,685,477,580,700.00000 %", "7fffffffffffffff"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"9,223,372,036,854,775,808.00)", "-9223372036854775808", "-9.223372e+018", "-9223372036854775808.00",
+ "-9223372036854775808", "-9,223,372,036,854,775,808.00", "-922,337,203,685,477,580,800.00 %", "8000000000000000"};
+ private string[] ResultsNfi2 = {""+NumberFormatInfo.InvariantInfo.CurrencySymbol+"9,223,372,036,854,775,807.00000", "9223372036854775807", "9.22337e+018", "9223372036854775807.00000",
+ "9.2234e+18", "9,223,372,036,854,775,807.00000", "922,337,203,685,477,580,700.00000 %", "7fffffffffffffff"};
+
+ private long[] vals
+ = { 0, Int64.MaxValue, Int64.MinValue,
+ 1L, 12L, 123L, 1234L, -123L,
+ 1234567890123456L, 6543210987654321L };
+
+ private const long val1 = -1234567L;
+ private const long val2 = 1234567L;
+ private const string sval1Test1 = " -1,234,567 ";
+ private const string sval1Test2 = " -1234567 ";
+ //private const string sval1Test3 = " -12345,,,,67 "; // interesting: this case works on SDK Beta2, but the specification says nothing about this case
+ private const string sval1Test4 = " -12345 67 ";
+ private string sval1Test5 = " -"+NumberFormatInfo.InvariantInfo.CurrencySymbol+"1,234,567.00 ";
+ private string sval1Test6 = "("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"1,234,567.00)";
+ private const string sval1Test7 = "-1,234,567.00";
+ private const string sval1UserCur1 = "1234/5/67:000 XYZ-";
+ private const string sval2UserCur1 = "1234/5/67:000 XYZ";
+ private const string sval1UserPercent1 = "-%%%1~2~3~4~5~6~7~0~0;0";
+ private const string sval2UserPercent1 = "%%%1~2~3~4~5~6~7~0~0;0";
+ private const NumberStyles style1 = NumberStyles.AllowLeadingWhite | NumberStyles.AllowLeadingSign
+ | NumberStyles.AllowTrailingWhite | NumberStyles.AllowThousands;
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+ private NumberFormatInfo NfiUser;
+
+ public Int64Test() {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ int cdd = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits;
+ string csym = NumberFormatInfo.CurrentInfo.CurrencySymbol;
+ string csuffix = (cdd > 0 ? "." : "").PadRight(cdd + (cdd > 0 ? 1 : 0), '0');
+ Results1[0] = "(" + csym + "9,223,372,036,854,775,808" + csuffix + ")";
+ Results2[0] = csym + "9,223,372,036,854,775,807.00000";
+ NfiUser = new NumberFormatInfo();
+ NfiUser.CurrencyDecimalDigits = 3;
+ NfiUser.CurrencyDecimalSeparator = ":";
+ NfiUser.CurrencyGroupSeparator = "/";
+ NfiUser.CurrencyGroupSizes = new int[] { 2,1,0 };
+ NfiUser.CurrencyNegativePattern = 10; // n $-
+ NfiUser.CurrencyPositivePattern = 3; // n $
+ NfiUser.CurrencySymbol = "XYZ";
+ NfiUser.PercentDecimalDigits = 1;
+ NfiUser.PercentDecimalSeparator = ";";
+ NfiUser.PercentGroupSeparator = "~";
+ NfiUser.PercentGroupSizes = new int[] {1};
+ NfiUser.PercentNegativePattern = 2;
+ NfiUser.PercentPositivePattern = 2;
+ NfiUser.PercentSymbol = "%%%";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(Int64.MinValue, MyInt64_2);
+ AssertEquals(Int64.MaxValue, MyInt64_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyInt64_3.CompareTo(MyInt64_2) > 0);
+ Assert(MyInt64_2.CompareTo(MyInt64_2) == 0);
+ Assert(MyInt64_1.CompareTo((Int64)(-42)) == 0);
+ Assert(MyInt64_2.CompareTo(MyInt64_3) < 0);
+ try {
+ MyInt64_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyInt64_1.Equals(MyInt64_1));
+ Assert(MyInt64_1.Equals((Int64)(-42)));
+ Assert(MyInt64_1.Equals((SByte)(-42)) == false);
+ Assert(MyInt64_1.Equals(MyInt64_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyInt64_1.GetHashCode();
+ MyInt64_2.GetHashCode();
+ MyInt64_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestRoundTripGeneral()
+ {
+ foreach(long lv in vals)
+ {
+ string s = lv.ToString(Nfi);
+ long lv2 = Int64.Parse(s);
+ Assert(lv == lv2);
+ long lv3 = Int64.Parse(s, NumberStyles.Integer, Nfi);
+ Assert(lv == lv3);
+ }
+ }
+
+ public void TestRoundTripHex()
+ {
+ foreach(long lv in vals)
+ {
+ string s = lv.ToString("x", Nfi);
+ long lv2 = Int64.Parse(s, NumberStyles.HexNumber, Nfi);
+ Assert(lv == lv2);
+ }
+ }
+
+ public void TestParseNull()
+ {
+ try
+ {
+ Int64.Parse(null);
+ Fail("Should raise System.ArgumentNullException");
+ }
+ catch (ArgumentNullException)
+ {
+ // ok
+ }
+ }
+
+ public void TestParse()
+ {
+ long lv;
+
+ lv = Int64.Parse(sval1Test1, style1, Nfi);
+ AssertEquals("Long value should be equal for Test1", val1, lv);
+
+ try
+ {
+ lv = Int64.Parse(sval1Test1, Nfi);
+ Fail("Should raise FormatException 1");
+ }
+ catch (FormatException)
+ {
+ // ok
+ }
+
+ lv = Int64.Parse(sval1Test2, style1, Nfi);
+ AssertEquals("Value should be the same for Test2 with style1", val1, lv);
+ lv = Int64.Parse(sval1Test2, Nfi);
+ AssertEquals("Value should be the same for Test2 without style1", val1, lv);
+
+ try
+ {
+ lv = Int64.Parse(sval1Test4, style1, Nfi);
+ Fail("Should raise FormatException 3");
+ }
+ catch (FormatException)
+ {
+ // ok
+ }
+
+ lv = Int64.Parse(sval1Test5, NumberStyles.Currency, Nfi);
+ AssertEquals("Value should be the same for Test5 and currency style", val1, lv);
+
+ //test Parse(string s)
+ Assert(MyInt64_1 == Int64.Parse(MyString1));
+ Assert(MyInt64_2 == Int64.Parse(MyString2));
+ Assert(MyInt64_3 == Int64.Parse(MyString3));
+ try {
+ Int64.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ Int64.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ try {
+ double OverInt = (double)Int64.MaxValue + 1;
+ Int64.Parse(OverInt.ToString(), NumberStyles.Float);
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ try {
+ double OverInt = (double)Int64.MaxValue + 1;
+ Int64.Parse(OverInt.ToString(), NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ AssertEquals("A1", (long)42, Int64.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ Int64.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(-42 == Int64.Parse(" -42 ", Nfi));
+ try {
+ Int64.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == Int64.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Int64.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ string s;
+
+ s = val1.ToString("c", Nfi);
+ Assert("val1 does not become sval1Test6", s.Equals(sval1Test6));
+
+ s = val1.ToString("n", Nfi);
+ AssertEquals("val1 does not become sval1Test7", sval1Test7, s);
+
+ //test ToString()
+ AssertEquals("MyInt64_1.ToString()", MyString1, MyInt64_1.ToString());
+ AssertEquals("MyInt64_2.ToString()", MyString2, MyInt64_2.ToString());
+ AssertEquals("MyInt64_3.ToString()", MyString3, MyInt64_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("MyInt64_2.ToString(Formats1["+i+"])", Results1[i], MyInt64_2.ToString(Formats1[i]));
+ AssertEquals("MyInt64_3.ToString(Formats2["+i+"])", Results2[i], MyInt64_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("MyInt64_2.ToString(Formats1["+i+"], Nfi)", ResultsNfi1[i], MyInt64_2.ToString(Formats1[i], Nfi));
+ AssertEquals("MyInt64_3.ToString(Formats2["+i+"], Nfi)", ResultsNfi2[i], MyInt64_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyInt64_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ AssertEquals("Exception is wrong type", typeof(FormatException), e.GetType());
+ }
+ }
+
+ public void TestUserCurrency()
+ {
+ string s= "";
+ long v;
+ int iTest = 1;
+ try {
+ s = val1.ToString("c", NfiUser);
+ iTest++;
+ AssertEquals("Currency value type 1 is not what we want to try to parse", sval1UserCur1, s);
+ iTest++;
+ v = Int64.Parse(s, NumberStyles.Currency, NfiUser);
+ iTest++;
+ Assert(v == val1);
+ } catch (Exception e) {
+ Fail ("1 Unexpected exception at iTest = " + iTest + ", s = " + s + ":e = " + e);
+ }
+
+ iTest = 1;
+ try {
+ s = val2.ToString("c", NfiUser);
+ iTest++;
+ AssertEquals("Currency value type 2 is not what we want to try to parse", sval2UserCur1, s);
+ iTest++;
+ v = Int64.Parse(s, NumberStyles.Currency, NfiUser);
+ iTest++;
+ Assert(v == val2);
+ } catch (Exception e) {
+ Fail ("2 Unexpected exception at iTest = " + iTest + ":e = " + e);
+ }
+ }
+
+ public void TestUserPercent()
+ {
+ string s;
+
+ s = val1.ToString("p", NfiUser);
+ Assert(s.Equals(sval1UserPercent1));
+
+ s = val2.ToString("p", NfiUser);
+ Assert(s.Equals(sval2UserPercent1));
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/IntegerFormatterTest.cs b/mcs/class/corlib/Test/System/IntegerFormatterTest.cs
new file mode 100644
index 00000000000..39e76b0a00b
--- /dev/null
+++ b/mcs/class/corlib/Test/System/IntegerFormatterTest.cs
@@ -0,0 +1,2007 @@
+//
+// IntegerFormatterTest.cs - NUnit Test Cases for System.IntegerFormatter
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.IO;
+using System.Threading;
+
+namespace MonoTests.System
+{
+
+public class IntegerFormatterTest : TestCase
+{
+ private const int INT32 = 0;
+ private const int INT64 = 1;
+ private const int UINT32 = 2;
+ private const int UINT64 = 3;
+ private int testType;
+
+ public IntegerFormatterTest () {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ public void TestStandard ()
+ {
+ // Make the test Culture insensitive
+ NumberFormatInfo nfi = new NumberFormatInfo ();
+ nfi.CurrencySymbol = "$";
+
+ StringReader sr = new StringReader (tutti);
+
+ string inputLine;
+ while ((inputLine = sr.ReadLine ()) != null) {
+ if (inputLine.IndexOf ('(') != -1)
+ ProcessLine (inputLine, nfi);
+ else
+ ChangeType (inputLine);
+ }
+
+ sr.Close ();
+ }
+
+ private void ProcessLine (string testLine, NumberFormatInfo nfi)
+ {
+ string number = "0";
+ string format = "X";
+ string expected = "XXX";
+ int idxStart;
+ int idxEnd;
+
+ idxStart = testLine.IndexOf ('(');
+ if (idxStart != -1){
+ idxStart++;
+ idxEnd = testLine.IndexOf (')');
+ number = testLine.Substring (idxStart,
+ idxEnd - idxStart);
+ }
+
+ idxStart = testLine.IndexOf ('(', idxStart);
+ if (idxStart != -1) {
+ idxStart++;
+ idxEnd = testLine.IndexOf (')', idxStart);
+ format = testLine.Substring (idxStart,
+ idxEnd - idxStart);
+ }
+
+ idxStart = testLine.IndexOf ('(', idxStart);
+ if (idxStart != -1) {
+ idxStart++;
+ idxEnd = testLine.LastIndexOf (')');
+ expected = testLine.Substring (idxStart,
+ idxEnd - idxStart);
+ }
+
+ DoTest (number, format, expected, nfi);
+ }
+
+ private void DoTest (string number,
+ string format,
+ string expected,
+ NumberFormatInfo nfi)
+ {
+ string id = number + " " + format;
+
+ switch (testType) {
+ case INT32:
+ int i32 = Int32.Parse (number, nfi);
+ AssertEquals(id, expected, i32.ToString (format, nfi));
+ break;
+ case INT64:
+ long i64 = Int64.Parse (number, nfi);
+ AssertEquals(id, expected, i64.ToString (format, nfi));
+ break;
+ case UINT32:
+ uint ui32 = UInt32.Parse (number, nfi);
+ AssertEquals(id, expected, ui32.ToString (format, nfi));
+ break;
+ case UINT64:
+ ulong ui64 = UInt64.Parse (number, nfi);
+ AssertEquals(id, expected, ui64.ToString (format, nfi));
+ break;
+ }
+ }
+
+ private void ChangeType (string newType)
+ {
+ if (newType == "Int32")
+ testType = INT32;
+ else if (newType == "Int64")
+ testType = INT64;
+ else if (newType == "UInt32")
+ testType = UINT32;
+ else if (newType == "UInt64")
+ testType = UINT64;
+ else throw new Exception ("Test of type '" + newType + "' not supported.");
+
+ }
+
+ private static string tutti = "Int32\n" +
+"(-2147483648) (C) (($2,147,483,648.00))\n" +
+"(-2147483648) (C0) (($2,147,483,648))\n" +
+"(-2147483648) (C1) (($2,147,483,648.0))\n" +
+"(-2147483648) (C2) (($2,147,483,648.00))\n" +
+"(-2147483648) (C3) (($2,147,483,648.000))\n" +
+"(-2147483648) (C4) (($2,147,483,648.0000))\n" +
+"(-2147483648) (C5) (($2,147,483,648.00000))\n" +
+"(-2147483648) (C6) (($2,147,483,648.000000))\n" +
+"(-2147483648) (C7) (($2,147,483,648.0000000))\n" +
+"(-2147483648) (C8) (($2,147,483,648.00000000))\n" +
+"(-2147483648) (C9) (($2,147,483,648.000000000))\n" +
+"(-2147483648) (C10) (($2,147,483,648.0000000000))\n" +
+"(-2147483648) (C99) (($2,147,483,648.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-2147483648) (D) (-2147483648)\n" +
+"(-2147483648) (D0) (-2147483648)\n" +
+"(-2147483648) (D1) (-2147483648)\n" +
+"(-2147483648) (D2) (-2147483648)\n" +
+"(-2147483648) (D3) (-2147483648)\n" +
+"(-2147483648) (D4) (-2147483648)\n" +
+"(-2147483648) (D5) (-2147483648)\n" +
+"(-2147483648) (D6) (-2147483648)\n" +
+"(-2147483648) (D7) (-2147483648)\n" +
+"(-2147483648) (D8) (-2147483648)\n" +
+"(-2147483648) (D9) (-2147483648)\n" +
+"(-2147483648) (D10) (-2147483648)\n" +
+"(-2147483648) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002147483648)\n" +
+"(-2147483648) (E) (-2.147484E+009)\n" +
+"(-2147483648) (E0) (-2E+009)\n" +
+"(-2147483648) (E1) (-2.1E+009)\n" +
+"(-2147483648) (E2) (-2.15E+009)\n" +
+"(-2147483648) (E3) (-2.147E+009)\n" +
+"(-2147483648) (E4) (-2.1475E+009)\n" +
+"(-2147483648) (E5) (-2.14748E+009)\n" +
+"(-2147483648) (E6) (-2.147484E+009)\n" +
+"(-2147483648) (E7) (-2.1474836E+009)\n" +
+"(-2147483648) (E8) (-2.14748365E+009)\n" +
+"(-2147483648) (E9) (-2.147483648E+009)\n" +
+"(-2147483648) (E10) (-2.1474836480E+009)\n" +
+"(-2147483648) (E99) (-2.147483648000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+009)\n" +
+"(-2147483648) (F) (-2147483648.00)\n" +
+"(-2147483648) (F0) (-2147483648)\n" +
+"(-2147483648) (F1) (-2147483648.0)\n" +
+"(-2147483648) (F2) (-2147483648.00)\n" +
+"(-2147483648) (F3) (-2147483648.000)\n" +
+"(-2147483648) (F4) (-2147483648.0000)\n" +
+"(-2147483648) (F5) (-2147483648.00000)\n" +
+"(-2147483648) (F6) (-2147483648.000000)\n" +
+"(-2147483648) (F7) (-2147483648.0000000)\n" +
+"(-2147483648) (F8) (-2147483648.00000000)\n" +
+"(-2147483648) (F9) (-2147483648.000000000)\n" +
+"(-2147483648) (F10) (-2147483648.0000000000)\n" +
+"(-2147483648) (F99) (-2147483648.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-2147483648) (G) (-2147483648)\n" +
+"(-2147483648) (G0) (-2147483648)\n" +
+"(-2147483648) (G1) (-2E+09)\n" +
+"(-2147483648) (G2) (-2.1E+09)\n" +
+"(-2147483648) (G3) (-2.15E+09)\n" +
+"(-2147483648) (G4) (-2.147E+09)\n" +
+"(-2147483648) (G5) (-2.1475E+09)\n" +
+"(-2147483648) (G6) (-2.14748E+09)\n" +
+"(-2147483648) (G7) (-2.147484E+09)\n" +
+"(-2147483648) (G8) (-2.1474836E+09)\n" +
+"(-2147483648) (G9) (-2.14748365E+09)\n" +
+"(-2147483648) (G10) (-2147483648)\n" +
+"(-2147483648) (G99) (-2147483648)\n" +
+"(-2147483648) (N) (-2,147,483,648.00)\n" +
+"(-2147483648) (N0) (-2,147,483,648)\n" +
+"(-2147483648) (N1) (-2,147,483,648.0)\n" +
+"(-2147483648) (N2) (-2,147,483,648.00)\n" +
+"(-2147483648) (N3) (-2,147,483,648.000)\n" +
+"(-2147483648) (N4) (-2,147,483,648.0000)\n" +
+"(-2147483648) (N5) (-2,147,483,648.00000)\n" +
+"(-2147483648) (N6) (-2,147,483,648.000000)\n" +
+"(-2147483648) (N7) (-2,147,483,648.0000000)\n" +
+"(-2147483648) (N8) (-2,147,483,648.00000000)\n" +
+"(-2147483648) (N9) (-2,147,483,648.000000000)\n" +
+"(-2147483648) (N10) (-2,147,483,648.0000000000)\n" +
+"(-2147483648) (N99) (-2,147,483,648.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-2147483648) (P) (-214,748,364,800.00 %)\n" +
+"(-2147483648) (P0) (-214,748,364,800 %)\n" +
+"(-2147483648) (P1) (-214,748,364,800.0 %)\n" +
+"(-2147483648) (P2) (-214,748,364,800.00 %)\n" +
+"(-2147483648) (P3) (-214,748,364,800.000 %)\n" +
+"(-2147483648) (P4) (-214,748,364,800.0000 %)\n" +
+"(-2147483648) (P5) (-214,748,364,800.00000 %)\n" +
+"(-2147483648) (P6) (-214,748,364,800.000000 %)\n" +
+"(-2147483648) (P7) (-214,748,364,800.0000000 %)\n" +
+"(-2147483648) (P8) (-214,748,364,800.00000000 %)\n" +
+"(-2147483648) (P9) (-214,748,364,800.000000000 %)\n" +
+"(-2147483648) (P10) (-214,748,364,800.0000000000 %)\n" +
+"(-2147483648) (P99) (-214,748,364,800.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-2147483648) (X) (80000000)\n" +
+"(-2147483648) (X0) (80000000)\n" +
+"(-2147483648) (X1) (80000000)\n" +
+"(-2147483648) (X2) (80000000)\n" +
+"(-2147483648) (X3) (80000000)\n" +
+"(-2147483648) (X4) (80000000)\n" +
+"(-2147483648) (X5) (80000000)\n" +
+"(-2147483648) (X6) (80000000)\n" +
+"(-2147483648) (X7) (80000000)\n" +
+"(-2147483648) (X8) (80000000)\n" +
+"(-2147483648) (X9) (080000000)\n" +
+"(-2147483648) (X10) (0080000000)\n" +
+"(-2147483648) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000)\n" +
+"(2147483647) (C) ($2,147,483,647.00)\n" +
+"(2147483647) (C0) ($2,147,483,647)\n" +
+"(2147483647) (C1) ($2,147,483,647.0)\n" +
+"(2147483647) (C2) ($2,147,483,647.00)\n" +
+"(2147483647) (C3) ($2,147,483,647.000)\n" +
+"(2147483647) (C4) ($2,147,483,647.0000)\n" +
+"(2147483647) (C5) ($2,147,483,647.00000)\n" +
+"(2147483647) (C6) ($2,147,483,647.000000)\n" +
+"(2147483647) (C7) ($2,147,483,647.0000000)\n" +
+"(2147483647) (C8) ($2,147,483,647.00000000)\n" +
+"(2147483647) (C9) ($2,147,483,647.000000000)\n" +
+"(2147483647) (C10) ($2,147,483,647.0000000000)\n" +
+"(2147483647) (C99) ($2,147,483,647.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(2147483647) (D) (2147483647)\n" +
+"(2147483647) (D0) (2147483647)\n" +
+"(2147483647) (D1) (2147483647)\n" +
+"(2147483647) (D2) (2147483647)\n" +
+"(2147483647) (D3) (2147483647)\n" +
+"(2147483647) (D4) (2147483647)\n" +
+"(2147483647) (D5) (2147483647)\n" +
+"(2147483647) (D6) (2147483647)\n" +
+"(2147483647) (D7) (2147483647)\n" +
+"(2147483647) (D8) (2147483647)\n" +
+"(2147483647) (D9) (2147483647)\n" +
+"(2147483647) (D10) (2147483647)\n" +
+"(2147483647) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002147483647)\n" +
+"(2147483647) (E) (2.147484E+009)\n" +
+"(2147483647) (E0) (2E+009)\n" +
+"(2147483647) (E1) (2.1E+009)\n" +
+"(2147483647) (E2) (2.15E+009)\n" +
+"(2147483647) (E3) (2.147E+009)\n" +
+"(2147483647) (E4) (2.1475E+009)\n" +
+"(2147483647) (E5) (2.14748E+009)\n" +
+"(2147483647) (E6) (2.147484E+009)\n" +
+"(2147483647) (E7) (2.1474836E+009)\n" +
+"(2147483647) (E8) (2.14748365E+009)\n" +
+"(2147483647) (E9) (2.147483647E+009)\n" +
+"(2147483647) (E10) (2.1474836470E+009)\n" +
+"(2147483647) (E99) (2.147483647000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+009)\n" +
+"(2147483647) (F) (2147483647.00)\n" +
+"(2147483647) (F0) (2147483647)\n" +
+"(2147483647) (F1) (2147483647.0)\n" +
+"(2147483647) (F2) (2147483647.00)\n" +
+"(2147483647) (F3) (2147483647.000)\n" +
+"(2147483647) (F4) (2147483647.0000)\n" +
+"(2147483647) (F5) (2147483647.00000)\n" +
+"(2147483647) (F6) (2147483647.000000)\n" +
+"(2147483647) (F7) (2147483647.0000000)\n" +
+"(2147483647) (F8) (2147483647.00000000)\n" +
+"(2147483647) (F9) (2147483647.000000000)\n" +
+"(2147483647) (F10) (2147483647.0000000000)\n" +
+"(2147483647) (F99) (2147483647.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(2147483647) (G) (2147483647)\n" +
+"(2147483647) (G0) (2147483647)\n" +
+"(2147483647) (G1) (2E+09)\n" +
+"(2147483647) (G2) (2.1E+09)\n" +
+"(2147483647) (G3) (2.15E+09)\n" +
+"(2147483647) (G4) (2.147E+09)\n" +
+"(2147483647) (G5) (2.1475E+09)\n" +
+"(2147483647) (G6) (2.14748E+09)\n" +
+"(2147483647) (G7) (2.147484E+09)\n" +
+"(2147483647) (G8) (2.1474836E+09)\n" +
+"(2147483647) (G9) (2.14748365E+09)\n" +
+"(2147483647) (G10) (2147483647)\n" +
+"(2147483647) (G99) (2147483647)\n" +
+"(2147483647) (N) (2,147,483,647.00)\n" +
+"(2147483647) (N0) (2,147,483,647)\n" +
+"(2147483647) (N1) (2,147,483,647.0)\n" +
+"(2147483647) (N2) (2,147,483,647.00)\n" +
+"(2147483647) (N3) (2,147,483,647.000)\n" +
+"(2147483647) (N4) (2,147,483,647.0000)\n" +
+"(2147483647) (N5) (2,147,483,647.00000)\n" +
+"(2147483647) (N6) (2,147,483,647.000000)\n" +
+"(2147483647) (N7) (2,147,483,647.0000000)\n" +
+"(2147483647) (N8) (2,147,483,647.00000000)\n" +
+"(2147483647) (N9) (2,147,483,647.000000000)\n" +
+"(2147483647) (N10) (2,147,483,647.0000000000)\n" +
+"(2147483647) (N99) (2,147,483,647.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(2147483647) (P) (214,748,364,700.00 %)\n" +
+"(2147483647) (P0) (214,748,364,700 %)\n" +
+"(2147483647) (P1) (214,748,364,700.0 %)\n" +
+"(2147483647) (P2) (214,748,364,700.00 %)\n" +
+"(2147483647) (P3) (214,748,364,700.000 %)\n" +
+"(2147483647) (P4) (214,748,364,700.0000 %)\n" +
+"(2147483647) (P5) (214,748,364,700.00000 %)\n" +
+"(2147483647) (P6) (214,748,364,700.000000 %)\n" +
+"(2147483647) (P7) (214,748,364,700.0000000 %)\n" +
+"(2147483647) (P8) (214,748,364,700.00000000 %)\n" +
+"(2147483647) (P9) (214,748,364,700.000000000 %)\n" +
+"(2147483647) (P10) (214,748,364,700.0000000000 %)\n" +
+"(2147483647) (P99) (214,748,364,700.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(2147483647) (X) (7FFFFFFF)\n" +
+"(2147483647) (X0) (7FFFFFFF)\n" +
+"(2147483647) (X1) (7FFFFFFF)\n" +
+"(2147483647) (X2) (7FFFFFFF)\n" +
+"(2147483647) (X3) (7FFFFFFF)\n" +
+"(2147483647) (X4) (7FFFFFFF)\n" +
+"(2147483647) (X5) (7FFFFFFF)\n" +
+"(2147483647) (X6) (7FFFFFFF)\n" +
+"(2147483647) (X7) (7FFFFFFF)\n" +
+"(2147483647) (X8) (7FFFFFFF)\n" +
+"(2147483647) (X9) (07FFFFFFF)\n" +
+"(2147483647) (X10) (007FFFFFFF)\n" +
+"(2147483647) (X99) (00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007FFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (C) (($100.00))\n" +
+"(-100) (C0) (($100))\n" +
+"(-100) (C1) (($100.0))\n" +
+"(-100) (C2) (($100.00))\n" +
+"(-100) (C3) (($100.000))\n" +
+"(-100) (C4) (($100.0000))\n" +
+"(-100) (C5) (($100.00000))\n" +
+"(-100) (C6) (($100.000000))\n" +
+"(-100) (C7) (($100.0000000))\n" +
+"(-100) (C8) (($100.00000000))\n" +
+"(-100) (C9) (($100.000000000))\n" +
+"(-100) (C10) (($100.0000000000))\n" +
+"(-100) (C99) (($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-100) (D) (-100)\n" +
+"(-100) (D0) (-100)\n" +
+"(-100) (D1) (-100)\n" +
+"(-100) (D2) (-100)\n" +
+"(-100) (D3) (-100)\n" +
+"(-100) (D4) (-0100)\n" +
+"(-100) (D5) (-00100)\n" +
+"(-100) (D6) (-000100)\n" +
+"(-100) (D7) (-0000100)\n" +
+"(-100) (D8) (-00000100)\n" +
+"(-100) (D9) (-000000100)\n" +
+"(-100) (D10) (-0000000100)\n" +
+"(-100) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(-100) (E) (-1.000000E+002)\n" +
+"(-100) (E0) (-1E+002)\n" +
+"(-100) (E1) (-1.0E+002)\n" +
+"(-100) (E2) (-1.00E+002)\n" +
+"(-100) (E3) (-1.000E+002)\n" +
+"(-100) (E4) (-1.0000E+002)\n" +
+"(-100) (E5) (-1.00000E+002)\n" +
+"(-100) (E6) (-1.000000E+002)\n" +
+"(-100) (E7) (-1.0000000E+002)\n" +
+"(-100) (E8) (-1.00000000E+002)\n" +
+"(-100) (E9) (-1.000000000E+002)\n" +
+"(-100) (E10) (-1.0000000000E+002)\n" +
+"(-100) (E99) (-1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(-100) (F) (-100.00)\n" +
+"(-100) (F0) (-100)\n" +
+"(-100) (F1) (-100.0)\n" +
+"(-100) (F2) (-100.00)\n" +
+"(-100) (F3) (-100.000)\n" +
+"(-100) (F4) (-100.0000)\n" +
+"(-100) (F5) (-100.00000)\n" +
+"(-100) (F6) (-100.000000)\n" +
+"(-100) (F7) (-100.0000000)\n" +
+"(-100) (F8) (-100.00000000)\n" +
+"(-100) (F9) (-100.000000000)\n" +
+"(-100) (F10) (-100.0000000000)\n" +
+"(-100) (F99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (G) (-100)\n" +
+"(-100) (G0) (-100)\n" +
+"(-100) (G1) (-1E+02)\n" +
+"(-100) (G2) (-1E+02)\n" +
+"(-100) (G3) (-100)\n" +
+"(-100) (G4) (-100)\n" +
+"(-100) (G5) (-100)\n" +
+"(-100) (G6) (-100)\n" +
+"(-100) (G7) (-100)\n" +
+"(-100) (G8) (-100)\n" +
+"(-100) (G9) (-100)\n" +
+"(-100) (G10) (-100)\n" +
+"(-100) (G99) (-100)\n" +
+"(-100) (N) (-100.00)\n" +
+"(-100) (N0) (-100)\n" +
+"(-100) (N1) (-100.0)\n" +
+"(-100) (N2) (-100.00)\n" +
+"(-100) (N3) (-100.000)\n" +
+"(-100) (N4) (-100.0000)\n" +
+"(-100) (N5) (-100.00000)\n" +
+"(-100) (N6) (-100.000000)\n" +
+"(-100) (N7) (-100.0000000)\n" +
+"(-100) (N8) (-100.00000000)\n" +
+"(-100) (N9) (-100.000000000)\n" +
+"(-100) (N10) (-100.0000000000)\n" +
+"(-100) (N99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (P) (-10,000.00 %)\n" +
+"(-100) (P0) (-10,000 %)\n" +
+"(-100) (P1) (-10,000.0 %)\n" +
+"(-100) (P2) (-10,000.00 %)\n" +
+"(-100) (P3) (-10,000.000 %)\n" +
+"(-100) (P4) (-10,000.0000 %)\n" +
+"(-100) (P5) (-10,000.00000 %)\n" +
+"(-100) (P6) (-10,000.000000 %)\n" +
+"(-100) (P7) (-10,000.0000000 %)\n" +
+"(-100) (P8) (-10,000.00000000 %)\n" +
+"(-100) (P9) (-10,000.000000000 %)\n" +
+"(-100) (P10) (-10,000.0000000000 %)\n" +
+"(-100) (P99) (-10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-100) (X) (FFFFFF9C)\n" +
+"(-100) (X0) (FFFFFF9C)\n" +
+"(-100) (X1) (FFFFFF9C)\n" +
+"(-100) (X2) (FFFFFF9C)\n" +
+"(-100) (X3) (FFFFFF9C)\n" +
+"(-100) (X4) (FFFFFF9C)\n" +
+"(-100) (X5) (FFFFFF9C)\n" +
+"(-100) (X6) (FFFFFF9C)\n" +
+"(-100) (X7) (FFFFFF9C)\n" +
+"(-100) (X8) (FFFFFF9C)\n" +
+"(-100) (X9) (0FFFFFF9C)\n" +
+"(-100) (X10) (00FFFFFF9C)\n" +
+"(-100) (X99) (0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFF9C)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n" +
+"Int64\n" +
+"(-9223372036854775808) (C) (($9,223,372,036,854,775,808.00))\n" +
+"(-9223372036854775808) (C0) (($9,223,372,036,854,775,808))\n" +
+"(-9223372036854775808) (C1) (($9,223,372,036,854,775,808.0))\n" +
+"(-9223372036854775808) (C2) (($9,223,372,036,854,775,808.00))\n" +
+"(-9223372036854775808) (C3) (($9,223,372,036,854,775,808.000))\n" +
+"(-9223372036854775808) (C4) (($9,223,372,036,854,775,808.0000))\n" +
+"(-9223372036854775808) (C5) (($9,223,372,036,854,775,808.00000))\n" +
+"(-9223372036854775808) (C6) (($9,223,372,036,854,775,808.000000))\n" +
+"(-9223372036854775808) (C7) (($9,223,372,036,854,775,808.0000000))\n" +
+"(-9223372036854775808) (C8) (($9,223,372,036,854,775,808.00000000))\n" +
+"(-9223372036854775808) (C9) (($9,223,372,036,854,775,808.000000000))\n" +
+"(-9223372036854775808) (C10) (($9,223,372,036,854,775,808.0000000000))\n" +
+"(-9223372036854775808) (C99) (($9,223,372,036,854,775,808.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-9223372036854775808) (D) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D0) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D1) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D2) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D3) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D4) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D5) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D6) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D7) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D8) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D9) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D10) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000009223372036854775808)\n" +
+"(-9223372036854775808) (E) (-9.223372E+018)\n" +
+"(-9223372036854775808) (E0) (-9E+018)\n" +
+"(-9223372036854775808) (E1) (-9.2E+018)\n" +
+"(-9223372036854775808) (E2) (-9.22E+018)\n" +
+"(-9223372036854775808) (E3) (-9.223E+018)\n" +
+"(-9223372036854775808) (E4) (-9.2234E+018)\n" +
+"(-9223372036854775808) (E5) (-9.22337E+018)\n" +
+"(-9223372036854775808) (E6) (-9.223372E+018)\n" +
+"(-9223372036854775808) (E7) (-9.2233720E+018)\n" +
+"(-9223372036854775808) (E8) (-9.22337204E+018)\n" +
+"(-9223372036854775808) (E9) (-9.223372037E+018)\n" +
+"(-9223372036854775808) (E10) (-9.2233720369E+018)\n" +
+"(-9223372036854775808) (E99) (-9.223372036854775808000000000000000000000000000000000000000000000000000000000000000000000000000000000E+018)\n" +
+"(-9223372036854775808) (F) (-9223372036854775808.00)\n" +
+"(-9223372036854775808) (F0) (-9223372036854775808)\n" +
+"(-9223372036854775808) (F1) (-9223372036854775808.0)\n" +
+"(-9223372036854775808) (F2) (-9223372036854775808.00)\n" +
+"(-9223372036854775808) (F3) (-9223372036854775808.000)\n" +
+"(-9223372036854775808) (F4) (-9223372036854775808.0000)\n" +
+"(-9223372036854775808) (F5) (-9223372036854775808.00000)\n" +
+"(-9223372036854775808) (F6) (-9223372036854775808.000000)\n" +
+"(-9223372036854775808) (F7) (-9223372036854775808.0000000)\n" +
+"(-9223372036854775808) (F8) (-9223372036854775808.00000000)\n" +
+"(-9223372036854775808) (F9) (-9223372036854775808.000000000)\n" +
+"(-9223372036854775808) (F10) (-9223372036854775808.0000000000)\n" +
+"(-9223372036854775808) (F99) (-9223372036854775808.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-9223372036854775808) (G) (-9223372036854775808)\n" +
+"(-9223372036854775808) (G0) (-9223372036854775808)\n" +
+"(-9223372036854775808) (G1) (-9E+18)\n" +
+"(-9223372036854775808) (G2) (-9.2E+18)\n" +
+"(-9223372036854775808) (G3) (-9.22E+18)\n" +
+"(-9223372036854775808) (G4) (-9.223E+18)\n" +
+"(-9223372036854775808) (G5) (-9.2234E+18)\n" +
+"(-9223372036854775808) (G6) (-9.22337E+18)\n" +
+"(-9223372036854775808) (G7) (-9.223372E+18)\n" +
+"(-9223372036854775808) (G8) (-9.223372E+18)\n" +
+"(-9223372036854775808) (G9) (-9.22337204E+18)\n" +
+"(-9223372036854775808) (G10) (-9.223372037E+18)\n" +
+"(-9223372036854775808) (G99) (-9223372036854775808)\n" +
+"(-9223372036854775808) (N) (-9,223,372,036,854,775,808.00)\n" +
+"(-9223372036854775808) (N0) (-9,223,372,036,854,775,808)\n" +
+"(-9223372036854775808) (N1) (-9,223,372,036,854,775,808.0)\n" +
+"(-9223372036854775808) (N2) (-9,223,372,036,854,775,808.00)\n" +
+"(-9223372036854775808) (N3) (-9,223,372,036,854,775,808.000)\n" +
+"(-9223372036854775808) (N4) (-9,223,372,036,854,775,808.0000)\n" +
+"(-9223372036854775808) (N5) (-9,223,372,036,854,775,808.00000)\n" +
+"(-9223372036854775808) (N6) (-9,223,372,036,854,775,808.000000)\n" +
+"(-9223372036854775808) (N7) (-9,223,372,036,854,775,808.0000000)\n" +
+"(-9223372036854775808) (N8) (-9,223,372,036,854,775,808.00000000)\n" +
+"(-9223372036854775808) (N9) (-9,223,372,036,854,775,808.000000000)\n" +
+"(-9223372036854775808) (N10) (-9,223,372,036,854,775,808.0000000000)\n" +
+"(-9223372036854775808) (N99) (-9,223,372,036,854,775,808.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-9223372036854775808) (P) (-922,337,203,685,477,580,800.00 %)\n" +
+"(-9223372036854775808) (P0) (-922,337,203,685,477,580,800 %)\n" +
+"(-9223372036854775808) (P1) (-922,337,203,685,477,580,800.0 %)\n" +
+"(-9223372036854775808) (P2) (-922,337,203,685,477,580,800.00 %)\n" +
+"(-9223372036854775808) (P3) (-922,337,203,685,477,580,800.000 %)\n" +
+"(-9223372036854775808) (P4) (-922,337,203,685,477,580,800.0000 %)\n" +
+"(-9223372036854775808) (P5) (-922,337,203,685,477,580,800.00000 %)\n" +
+"(-9223372036854775808) (P6) (-922,337,203,685,477,580,800.000000 %)\n" +
+"(-9223372036854775808) (P7) (-922,337,203,685,477,580,800.0000000 %)\n" +
+"(-9223372036854775808) (P8) (-922,337,203,685,477,580,800.00000000 %)\n" +
+"(-9223372036854775808) (P9) (-922,337,203,685,477,580,800.000000000 %)\n" +
+"(-9223372036854775808) (P10) (-922,337,203,685,477,580,800.0000000000 %)\n" +
+"(-9223372036854775808) (P99) (-922,337,203,685,477,580,800.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-9223372036854775808) (X) (8000000000000000)\n" +
+"(-9223372036854775808) (X0) (8000000000000000)\n" +
+"(-9223372036854775808) (X1) (8000000000000000)\n" +
+"(-9223372036854775808) (X2) (8000000000000000)\n" +
+"(-9223372036854775808) (X3) (8000000000000000)\n" +
+"(-9223372036854775808) (X4) (8000000000000000)\n" +
+"(-9223372036854775808) (X5) (8000000000000000)\n" +
+"(-9223372036854775808) (X6) (8000000000000000)\n" +
+"(-9223372036854775808) (X7) (8000000000000000)\n" +
+"(-9223372036854775808) (X8) (8000000000000000)\n" +
+"(-9223372036854775808) (X9) (8000000000000000)\n" +
+"(-9223372036854775808) (X10) (8000000000000000)\n" +
+"(-9223372036854775808) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000)\n" +
+"(9223372036854775807) (C) ($9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (C0) ($9,223,372,036,854,775,807)\n" +
+"(9223372036854775807) (C1) ($9,223,372,036,854,775,807.0)\n" +
+"(9223372036854775807) (C2) ($9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (C3) ($9,223,372,036,854,775,807.000)\n" +
+"(9223372036854775807) (C4) ($9,223,372,036,854,775,807.0000)\n" +
+"(9223372036854775807) (C5) ($9,223,372,036,854,775,807.00000)\n" +
+"(9223372036854775807) (C6) ($9,223,372,036,854,775,807.000000)\n" +
+"(9223372036854775807) (C7) ($9,223,372,036,854,775,807.0000000)\n" +
+"(9223372036854775807) (C8) ($9,223,372,036,854,775,807.00000000)\n" +
+"(9223372036854775807) (C9) ($9,223,372,036,854,775,807.000000000)\n" +
+"(9223372036854775807) (C10) ($9,223,372,036,854,775,807.0000000000)\n" +
+"(9223372036854775807) (C99) ($9,223,372,036,854,775,807.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(9223372036854775807) (D) (9223372036854775807)\n" +
+"(9223372036854775807) (D0) (9223372036854775807)\n" +
+"(9223372036854775807) (D1) (9223372036854775807)\n" +
+"(9223372036854775807) (D2) (9223372036854775807)\n" +
+"(9223372036854775807) (D3) (9223372036854775807)\n" +
+"(9223372036854775807) (D4) (9223372036854775807)\n" +
+"(9223372036854775807) (D5) (9223372036854775807)\n" +
+"(9223372036854775807) (D6) (9223372036854775807)\n" +
+"(9223372036854775807) (D7) (9223372036854775807)\n" +
+"(9223372036854775807) (D8) (9223372036854775807)\n" +
+"(9223372036854775807) (D9) (9223372036854775807)\n" +
+"(9223372036854775807) (D10) (9223372036854775807)\n" +
+"(9223372036854775807) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000009223372036854775807)\n" +
+"(9223372036854775807) (E) (9.223372E+018)\n" +
+"(9223372036854775807) (E0) (9E+018)\n" +
+"(9223372036854775807) (E1) (9.2E+018)\n" +
+"(9223372036854775807) (E2) (9.22E+018)\n" +
+"(9223372036854775807) (E3) (9.223E+018)\n" +
+"(9223372036854775807) (E4) (9.2234E+018)\n" +
+"(9223372036854775807) (E5) (9.22337E+018)\n" +
+"(9223372036854775807) (E6) (9.223372E+018)\n" +
+"(9223372036854775807) (E7) (9.2233720E+018)\n" +
+"(9223372036854775807) (E8) (9.22337204E+018)\n" +
+"(9223372036854775807) (E9) (9.223372037E+018)\n" +
+"(9223372036854775807) (E10) (9.2233720369E+018)\n" +
+"(9223372036854775807) (E99) (9.223372036854775807000000000000000000000000000000000000000000000000000000000000000000000000000000000E+018)\n" +
+"(9223372036854775807) (F) (9223372036854775807.00)\n" +
+"(9223372036854775807) (F0) (9223372036854775807)\n" +
+"(9223372036854775807) (F1) (9223372036854775807.0)\n" +
+"(9223372036854775807) (F2) (9223372036854775807.00)\n" +
+"(9223372036854775807) (F3) (9223372036854775807.000)\n" +
+"(9223372036854775807) (F4) (9223372036854775807.0000)\n" +
+"(9223372036854775807) (F5) (9223372036854775807.00000)\n" +
+"(9223372036854775807) (F6) (9223372036854775807.000000)\n" +
+"(9223372036854775807) (F7) (9223372036854775807.0000000)\n" +
+"(9223372036854775807) (F8) (9223372036854775807.00000000)\n" +
+"(9223372036854775807) (F9) (9223372036854775807.000000000)\n" +
+"(9223372036854775807) (F10) (9223372036854775807.0000000000)\n" +
+"(9223372036854775807) (F99) (9223372036854775807.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(9223372036854775807) (G) (9223372036854775807)\n" +
+"(9223372036854775807) (G0) (9223372036854775807)\n" +
+"(9223372036854775807) (G1) (9E+18)\n" +
+"(9223372036854775807) (G2) (9.2E+18)\n" +
+"(9223372036854775807) (G3) (9.22E+18)\n" +
+"(9223372036854775807) (G4) (9.223E+18)\n" +
+"(9223372036854775807) (G5) (9.2234E+18)\n" +
+"(9223372036854775807) (G6) (9.22337E+18)\n" +
+"(9223372036854775807) (G7) (9.223372E+18)\n" +
+"(9223372036854775807) (G8) (9.223372E+18)\n" +
+"(9223372036854775807) (G9) (9.22337204E+18)\n" +
+"(9223372036854775807) (G10) (9.223372037E+18)\n" +
+"(9223372036854775807) (G99) (9223372036854775807)\n" +
+"(9223372036854775807) (N) (9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (N0) (9,223,372,036,854,775,807)\n" +
+"(9223372036854775807) (N1) (9,223,372,036,854,775,807.0)\n" +
+"(9223372036854775807) (N2) (9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (N3) (9,223,372,036,854,775,807.000)\n" +
+"(9223372036854775807) (N4) (9,223,372,036,854,775,807.0000)\n" +
+"(9223372036854775807) (N5) (9,223,372,036,854,775,807.00000)\n" +
+"(9223372036854775807) (N6) (9,223,372,036,854,775,807.000000)\n" +
+"(9223372036854775807) (N7) (9,223,372,036,854,775,807.0000000)\n" +
+"(9223372036854775807) (N8) (9,223,372,036,854,775,807.00000000)\n" +
+"(9223372036854775807) (N9) (9,223,372,036,854,775,807.000000000)\n" +
+"(9223372036854775807) (N10) (9,223,372,036,854,775,807.0000000000)\n" +
+"(9223372036854775807) (N99) (9,223,372,036,854,775,807.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(9223372036854775807) (P) (922,337,203,685,477,580,700.00 %)\n" +
+"(9223372036854775807) (P0) (922,337,203,685,477,580,700 %)\n" +
+"(9223372036854775807) (P1) (922,337,203,685,477,580,700.0 %)\n" +
+"(9223372036854775807) (P2) (922,337,203,685,477,580,700.00 %)\n" +
+"(9223372036854775807) (P3) (922,337,203,685,477,580,700.000 %)\n" +
+"(9223372036854775807) (P4) (922,337,203,685,477,580,700.0000 %)\n" +
+"(9223372036854775807) (P5) (922,337,203,685,477,580,700.00000 %)\n" +
+"(9223372036854775807) (P6) (922,337,203,685,477,580,700.000000 %)\n" +
+"(9223372036854775807) (P7) (922,337,203,685,477,580,700.0000000 %)\n" +
+"(9223372036854775807) (P8) (922,337,203,685,477,580,700.00000000 %)\n" +
+"(9223372036854775807) (P9) (922,337,203,685,477,580,700.000000000 %)\n" +
+"(9223372036854775807) (P10) (922,337,203,685,477,580,700.0000000000 %)\n" +
+"(9223372036854775807) (P99) (922,337,203,685,477,580,700.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(9223372036854775807) (X) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X0) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X1) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X2) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X3) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X4) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X5) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X6) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X7) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X8) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X9) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X10) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000007FFFFFFFFFFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (C) (($100.00))\n" +
+"(-100) (C0) (($100))\n" +
+"(-100) (C1) (($100.0))\n" +
+"(-100) (C2) (($100.00))\n" +
+"(-100) (C3) (($100.000))\n" +
+"(-100) (C4) (($100.0000))\n" +
+"(-100) (C5) (($100.00000))\n" +
+"(-100) (C6) (($100.000000))\n" +
+"(-100) (C7) (($100.0000000))\n" +
+"(-100) (C8) (($100.00000000))\n" +
+"(-100) (C9) (($100.000000000))\n" +
+"(-100) (C10) (($100.0000000000))\n" +
+"(-100) (C99) (($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-100) (D) (-100)\n" +
+"(-100) (D0) (-100)\n" +
+"(-100) (D1) (-100)\n" +
+"(-100) (D2) (-100)\n" +
+"(-100) (D3) (-100)\n" +
+"(-100) (D4) (-0100)\n" +
+"(-100) (D5) (-00100)\n" +
+"(-100) (D6) (-000100)\n" +
+"(-100) (D7) (-0000100)\n" +
+"(-100) (D8) (-00000100)\n" +
+"(-100) (D9) (-000000100)\n" +
+"(-100) (D10) (-0000000100)\n" +
+"(-100) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(-100) (E) (-1.000000E+002)\n" +
+"(-100) (E0) (-1E+002)\n" +
+"(-100) (E1) (-1.0E+002)\n" +
+"(-100) (E2) (-1.00E+002)\n" +
+"(-100) (E3) (-1.000E+002)\n" +
+"(-100) (E4) (-1.0000E+002)\n" +
+"(-100) (E5) (-1.00000E+002)\n" +
+"(-100) (E6) (-1.000000E+002)\n" +
+"(-100) (E7) (-1.0000000E+002)\n" +
+"(-100) (E8) (-1.00000000E+002)\n" +
+"(-100) (E9) (-1.000000000E+002)\n" +
+"(-100) (E10) (-1.0000000000E+002)\n" +
+"(-100) (E99) (-1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(-100) (F) (-100.00)\n" +
+"(-100) (F0) (-100)\n" +
+"(-100) (F1) (-100.0)\n" +
+"(-100) (F2) (-100.00)\n" +
+"(-100) (F3) (-100.000)\n" +
+"(-100) (F4) (-100.0000)\n" +
+"(-100) (F5) (-100.00000)\n" +
+"(-100) (F6) (-100.000000)\n" +
+"(-100) (F7) (-100.0000000)\n" +
+"(-100) (F8) (-100.00000000)\n" +
+"(-100) (F9) (-100.000000000)\n" +
+"(-100) (F10) (-100.0000000000)\n" +
+"(-100) (F99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (G) (-100)\n" +
+"(-100) (G0) (-100)\n" +
+"(-100) (G1) (-1E+02)\n" +
+"(-100) (G2) (-1E+02)\n" +
+"(-100) (G3) (-100)\n" +
+"(-100) (G4) (-100)\n" +
+"(-100) (G5) (-100)\n" +
+"(-100) (G6) (-100)\n" +
+"(-100) (G7) (-100)\n" +
+"(-100) (G8) (-100)\n" +
+"(-100) (G9) (-100)\n" +
+"(-100) (G10) (-100)\n" +
+"(-100) (G99) (-100)\n" +
+"(-100) (N) (-100.00)\n" +
+"(-100) (N0) (-100)\n" +
+"(-100) (N1) (-100.0)\n" +
+"(-100) (N2) (-100.00)\n" +
+"(-100) (N3) (-100.000)\n" +
+"(-100) (N4) (-100.0000)\n" +
+"(-100) (N5) (-100.00000)\n" +
+"(-100) (N6) (-100.000000)\n" +
+"(-100) (N7) (-100.0000000)\n" +
+"(-100) (N8) (-100.00000000)\n" +
+"(-100) (N9) (-100.000000000)\n" +
+"(-100) (N10) (-100.0000000000)\n" +
+"(-100) (N99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (P) (-10,000.00 %)\n" +
+"(-100) (P0) (-10,000 %)\n" +
+"(-100) (P1) (-10,000.0 %)\n" +
+"(-100) (P2) (-10,000.00 %)\n" +
+"(-100) (P3) (-10,000.000 %)\n" +
+"(-100) (P4) (-10,000.0000 %)\n" +
+"(-100) (P5) (-10,000.00000 %)\n" +
+"(-100) (P6) (-10,000.000000 %)\n" +
+"(-100) (P7) (-10,000.0000000 %)\n" +
+"(-100) (P8) (-10,000.00000000 %)\n" +
+"(-100) (P9) (-10,000.000000000 %)\n" +
+"(-100) (P10) (-10,000.0000000000 %)\n" +
+"(-100) (P99) (-10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-100) (X) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X0) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X1) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X2) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X3) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X4) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X5) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X6) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X7) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X8) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X9) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X10) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X99) (00000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF9C)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n" +
+"UInt32\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (C) ($4,294,967,295.00)\n" +
+"(4294967295) (C0) ($4,294,967,295)\n" +
+"(4294967295) (C1) ($4,294,967,295.0)\n" +
+"(4294967295) (C2) ($4,294,967,295.00)\n" +
+"(4294967295) (C3) ($4,294,967,295.000)\n" +
+"(4294967295) (C4) ($4,294,967,295.0000)\n" +
+"(4294967295) (C5) ($4,294,967,295.00000)\n" +
+"(4294967295) (C6) ($4,294,967,295.000000)\n" +
+"(4294967295) (C7) ($4,294,967,295.0000000)\n" +
+"(4294967295) (C8) ($4,294,967,295.00000000)\n" +
+"(4294967295) (C9) ($4,294,967,295.000000000)\n" +
+"(4294967295) (C10) ($4,294,967,295.0000000000)\n" +
+"(4294967295) (C99) ($4,294,967,295.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (D) (4294967295)\n" +
+"(4294967295) (D0) (4294967295)\n" +
+"(4294967295) (D1) (4294967295)\n" +
+"(4294967295) (D2) (4294967295)\n" +
+"(4294967295) (D3) (4294967295)\n" +
+"(4294967295) (D4) (4294967295)\n" +
+"(4294967295) (D5) (4294967295)\n" +
+"(4294967295) (D6) (4294967295)\n" +
+"(4294967295) (D7) (4294967295)\n" +
+"(4294967295) (D8) (4294967295)\n" +
+"(4294967295) (D9) (4294967295)\n" +
+"(4294967295) (D10) (4294967295)\n" +
+"(4294967295) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004294967295)\n" +
+"(4294967295) (E) (4.294967E+009)\n" +
+"(4294967295) (E0) (4E+009)\n" +
+"(4294967295) (E1) (4.3E+009)\n" +
+"(4294967295) (E2) (4.29E+009)\n" +
+"(4294967295) (E3) (4.295E+009)\n" +
+"(4294967295) (E4) (4.2950E+009)\n" +
+"(4294967295) (E5) (4.29497E+009)\n" +
+"(4294967295) (E6) (4.294967E+009)\n" +
+"(4294967295) (E7) (4.2949673E+009)\n" +
+"(4294967295) (E8) (4.29496730E+009)\n" +
+"(4294967295) (E9) (4.294967295E+009)\n" +
+"(4294967295) (E10) (4.2949672950E+009)\n" +
+"(4294967295) (E99) (4.294967295000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+009)\n" +
+"(4294967295) (F) (4294967295.00)\n" +
+"(4294967295) (F0) (4294967295)\n" +
+"(4294967295) (F1) (4294967295.0)\n" +
+"(4294967295) (F2) (4294967295.00)\n" +
+"(4294967295) (F3) (4294967295.000)\n" +
+"(4294967295) (F4) (4294967295.0000)\n" +
+"(4294967295) (F5) (4294967295.00000)\n" +
+"(4294967295) (F6) (4294967295.000000)\n" +
+"(4294967295) (F7) (4294967295.0000000)\n" +
+"(4294967295) (F8) (4294967295.00000000)\n" +
+"(4294967295) (F9) (4294967295.000000000)\n" +
+"(4294967295) (F10) (4294967295.0000000000)\n" +
+"(4294967295) (F99) (4294967295.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (G) (4294967295)\n" +
+"(4294967295) (G0) (4294967295)\n" +
+"(4294967295) (G1) (4E+09)\n" +
+"(4294967295) (G2) (4.3E+09)\n" +
+"(4294967295) (G3) (4.29E+09)\n" +
+"(4294967295) (G4) (4.295E+09)\n" +
+"(4294967295) (G5) (4.295E+09)\n" +
+"(4294967295) (G6) (4.29497E+09)\n" +
+"(4294967295) (G7) (4.294967E+09)\n" +
+"(4294967295) (G8) (4.2949673E+09)\n" +
+"(4294967295) (G9) (4.2949673E+09)\n" +
+"(4294967295) (G10) (4294967295)\n" +
+"(4294967295) (G99) (4294967295)\n" +
+"(4294967295) (N) (4,294,967,295.00)\n" +
+"(4294967295) (N0) (4,294,967,295)\n" +
+"(4294967295) (N1) (4,294,967,295.0)\n" +
+"(4294967295) (N2) (4,294,967,295.00)\n" +
+"(4294967295) (N3) (4,294,967,295.000)\n" +
+"(4294967295) (N4) (4,294,967,295.0000)\n" +
+"(4294967295) (N5) (4,294,967,295.00000)\n" +
+"(4294967295) (N6) (4,294,967,295.000000)\n" +
+"(4294967295) (N7) (4,294,967,295.0000000)\n" +
+"(4294967295) (N8) (4,294,967,295.00000000)\n" +
+"(4294967295) (N9) (4,294,967,295.000000000)\n" +
+"(4294967295) (N10) (4,294,967,295.0000000000)\n" +
+"(4294967295) (N99) (4,294,967,295.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (P) (429,496,729,500.00 %)\n" +
+"(4294967295) (P0) (429,496,729,500 %)\n" +
+"(4294967295) (P1) (429,496,729,500.0 %)\n" +
+"(4294967295) (P2) (429,496,729,500.00 %)\n" +
+"(4294967295) (P3) (429,496,729,500.000 %)\n" +
+"(4294967295) (P4) (429,496,729,500.0000 %)\n" +
+"(4294967295) (P5) (429,496,729,500.00000 %)\n" +
+"(4294967295) (P6) (429,496,729,500.000000 %)\n" +
+"(4294967295) (P7) (429,496,729,500.0000000 %)\n" +
+"(4294967295) (P8) (429,496,729,500.00000000 %)\n" +
+"(4294967295) (P9) (429,496,729,500.000000000 %)\n" +
+"(4294967295) (P10) (429,496,729,500.0000000000 %)\n" +
+"(4294967295) (P99) (429,496,729,500.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(4294967295) (X) (FFFFFFFF)\n" +
+"(4294967295) (X0) (FFFFFFFF)\n" +
+"(4294967295) (X1) (FFFFFFFF)\n" +
+"(4294967295) (X2) (FFFFFFFF)\n" +
+"(4294967295) (X3) (FFFFFFFF)\n" +
+"(4294967295) (X4) (FFFFFFFF)\n" +
+"(4294967295) (X5) (FFFFFFFF)\n" +
+"(4294967295) (X6) (FFFFFFFF)\n" +
+"(4294967295) (X7) (FFFFFFFF)\n" +
+"(4294967295) (X8) (FFFFFFFF)\n" +
+"(4294967295) (X9) (0FFFFFFFF)\n" +
+"(4294967295) (X10) (00FFFFFFFF)\n" +
+"(4294967295) (X99) (0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n" +
+"UInt64\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (C) ($18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (C0) ($18,446,744,073,709,551,615)\n" +
+"(18446744073709551615) (C1) ($18,446,744,073,709,551,615.0)\n" +
+"(18446744073709551615) (C2) ($18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (C3) ($18,446,744,073,709,551,615.000)\n" +
+"(18446744073709551615) (C4) ($18,446,744,073,709,551,615.0000)\n" +
+"(18446744073709551615) (C5) ($18,446,744,073,709,551,615.00000)\n" +
+"(18446744073709551615) (C6) ($18,446,744,073,709,551,615.000000)\n" +
+"(18446744073709551615) (C7) ($18,446,744,073,709,551,615.0000000)\n" +
+"(18446744073709551615) (C8) ($18,446,744,073,709,551,615.00000000)\n" +
+"(18446744073709551615) (C9) ($18,446,744,073,709,551,615.000000000)\n" +
+"(18446744073709551615) (C10) ($18,446,744,073,709,551,615.0000000000)\n" +
+"(18446744073709551615) (C99) ($18,446,744,073,709,551,615.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (D) (18446744073709551615)\n" +
+"(18446744073709551615) (D0) (18446744073709551615)\n" +
+"(18446744073709551615) (D1) (18446744073709551615)\n" +
+"(18446744073709551615) (D2) (18446744073709551615)\n" +
+"(18446744073709551615) (D3) (18446744073709551615)\n" +
+"(18446744073709551615) (D4) (18446744073709551615)\n" +
+"(18446744073709551615) (D5) (18446744073709551615)\n" +
+"(18446744073709551615) (D6) (18446744073709551615)\n" +
+"(18446744073709551615) (D7) (18446744073709551615)\n" +
+"(18446744073709551615) (D8) (18446744073709551615)\n" +
+"(18446744073709551615) (D9) (18446744073709551615)\n" +
+"(18446744073709551615) (D10) (18446744073709551615)\n" +
+"(18446744073709551615) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000018446744073709551615)\n" +
+"(18446744073709551615) (E) (1.844674E+019)\n" +
+"(18446744073709551615) (E0) (2E+019)\n" +
+"(18446744073709551615) (E1) (1.8E+019)\n" +
+"(18446744073709551615) (E2) (1.84E+019)\n" +
+"(18446744073709551615) (E3) (1.845E+019)\n" +
+"(18446744073709551615) (E4) (1.8447E+019)\n" +
+"(18446744073709551615) (E5) (1.84467E+019)\n" +
+"(18446744073709551615) (E6) (1.844674E+019)\n" +
+"(18446744073709551615) (E7) (1.8446744E+019)\n" +
+"(18446744073709551615) (E8) (1.84467441E+019)\n" +
+"(18446744073709551615) (E9) (1.844674407E+019)\n" +
+"(18446744073709551615) (E10) (1.8446744074E+019)\n" +
+"(18446744073709551615) (E99) (1.844674407370955161500000000000000000000000000000000000000000000000000000000000000000000000000000000E+019)\n" +
+"(18446744073709551615) (F) (18446744073709551615.00)\n" +
+"(18446744073709551615) (F0) (18446744073709551615)\n" +
+"(18446744073709551615) (F1) (18446744073709551615.0)\n" +
+"(18446744073709551615) (F2) (18446744073709551615.00)\n" +
+"(18446744073709551615) (F3) (18446744073709551615.000)\n" +
+"(18446744073709551615) (F4) (18446744073709551615.0000)\n" +
+"(18446744073709551615) (F5) (18446744073709551615.00000)\n" +
+"(18446744073709551615) (F6) (18446744073709551615.000000)\n" +
+"(18446744073709551615) (F7) (18446744073709551615.0000000)\n" +
+"(18446744073709551615) (F8) (18446744073709551615.00000000)\n" +
+"(18446744073709551615) (F9) (18446744073709551615.000000000)\n" +
+"(18446744073709551615) (F10) (18446744073709551615.0000000000)\n" +
+"(18446744073709551615) (F99) (18446744073709551615.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (G) (18446744073709551615)\n" +
+"(18446744073709551615) (G0) (18446744073709551615)\n" +
+"(18446744073709551615) (G1) (2E+19)\n" +
+"(18446744073709551615) (G2) (1.8E+19)\n" +
+"(18446744073709551615) (G3) (1.84E+19)\n" +
+"(18446744073709551615) (G4) (1.845E+19)\n" +
+"(18446744073709551615) (G5) (1.8447E+19)\n" +
+"(18446744073709551615) (G6) (1.84467E+19)\n" +
+"(18446744073709551615) (G7) (1.844674E+19)\n" +
+"(18446744073709551615) (G8) (1.8446744E+19)\n" +
+"(18446744073709551615) (G9) (1.84467441E+19)\n" +
+"(18446744073709551615) (G10) (1.844674407E+19)\n" +
+"(18446744073709551615) (G99) (18446744073709551615)\n" +
+"(18446744073709551615) (N) (18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (N0) (18,446,744,073,709,551,615)\n" +
+"(18446744073709551615) (N1) (18,446,744,073,709,551,615.0)\n" +
+"(18446744073709551615) (N2) (18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (N3) (18,446,744,073,709,551,615.000)\n" +
+"(18446744073709551615) (N4) (18,446,744,073,709,551,615.0000)\n" +
+"(18446744073709551615) (N5) (18,446,744,073,709,551,615.00000)\n" +
+"(18446744073709551615) (N6) (18,446,744,073,709,551,615.000000)\n" +
+"(18446744073709551615) (N7) (18,446,744,073,709,551,615.0000000)\n" +
+"(18446744073709551615) (N8) (18,446,744,073,709,551,615.00000000)\n" +
+"(18446744073709551615) (N9) (18,446,744,073,709,551,615.000000000)\n" +
+"(18446744073709551615) (N10) (18,446,744,073,709,551,615.0000000000)\n" +
+"(18446744073709551615) (N99) (18,446,744,073,709,551,615.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (P) (1,844,674,407,370,955,161,500.00 %)\n" +
+"(18446744073709551615) (P0) (1,844,674,407,370,955,161,500 %)\n" +
+"(18446744073709551615) (P1) (1,844,674,407,370,955,161,500.0 %)\n" +
+"(18446744073709551615) (P2) (1,844,674,407,370,955,161,500.00 %)\n" +
+"(18446744073709551615) (P3) (1,844,674,407,370,955,161,500.000 %)\n" +
+"(18446744073709551615) (P4) (1,844,674,407,370,955,161,500.0000 %)\n" +
+"(18446744073709551615) (P5) (1,844,674,407,370,955,161,500.00000 %)\n" +
+"(18446744073709551615) (P6) (1,844,674,407,370,955,161,500.000000 %)\n" +
+"(18446744073709551615) (P7) (1,844,674,407,370,955,161,500.0000000 %)\n" +
+"(18446744073709551615) (P8) (1,844,674,407,370,955,161,500.00000000 %)\n" +
+"(18446744073709551615) (P9) (1,844,674,407,370,955,161,500.000000000 %)\n" +
+"(18446744073709551615) (P10) (1,844,674,407,370,955,161,500.0000000000 %)\n" +
+"(18446744073709551615) (P99) (1,844,674,407,370,955,161,500.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(18446744073709551615) (X) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X0) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X1) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X2) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X3) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X4) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X5) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X6) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X7) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X8) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X9) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X10) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X99) (00000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n";
+}
+
+}
+
diff --git a/mcs/class/corlib/Test/System/MathTest.cs b/mcs/class/corlib/Test/System/MathTest.cs
new file mode 100755
index 00000000000..69a03412083
--- /dev/null
+++ b/mcs/class/corlib/Test/System/MathTest.cs
@@ -0,0 +1,607 @@
+// MathTest.cs
+//
+// Jon Guymon (guymon@slackworks.com)
+//
+// (C) 2002 Jon Guymon
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System
+{
+
+public class MathTest : TestCase {
+
+ public MathTest() {}
+
+ protected override void SetUp() {}
+ protected override void TearDown() {}
+
+ static double x = 0.1234;
+ static double y = 12.345;
+
+ public void TestDecimalAbs() {
+ decimal a = -9.0M;
+
+ Assert(9.0M == Math.Abs(a));
+ }
+
+
+ public void TestDoubleAbs() {
+ double a = -9.0D;
+
+ Assert(9.0D == Math.Abs(a));
+ }
+
+ public void TestFloatAbs() {
+ float a = -9.0F;
+
+ Assert(9.0F == Math.Abs(a));
+ }
+
+ public void TestLongAbs() {
+ long a = -9L;
+ long b = Int64.MinValue;
+
+ Assert(9L == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestIntAbs() {
+ int a = -9;
+ int b = Int32.MinValue;
+
+ Assert(9 == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestSbyteAbs() {
+ sbyte a = -9;
+ sbyte b = SByte.MinValue;
+
+ Assert(9 == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestShortAbs() {
+ short a = -9;
+ short b = Int16.MinValue;
+
+ Assert(9 == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestAcos() {
+ double a = Math.Acos(x);
+ double b = 1.4470809809523457;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Acos(-1.01D)));
+ Assert(double.IsNaN(Math.Acos(1.01D)));
+ }
+
+ public void TestAsin() {
+ double a = Math.Asin(x);
+ double b = 0.12371534584255098;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Asin(-1.01D)));
+ Assert(double.IsNaN(Math.Asin(1.01D)));
+ }
+
+ public void TestAtan() {
+ double a = Math.Atan(x);
+ double b = 0.12277930094473837;
+ double c = 1.5707963267948966;
+ double d = -1.5707963267948966;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert("should return NaN",
+ double.IsNaN(Math.Atan(double.NaN)));
+ Assert(Math.Atan(double.PositiveInfinity).ToString("G99")+" != "+c.ToString("G99"),
+ Math.Abs((double)Math.Atan(double.PositiveInfinity) - c) <= double.Epsilon);
+ Assert(Math.Atan(double.NegativeInfinity).ToString("G99")+" != "+d.ToString("G99"),
+ Math.Abs((double)Math.Atan(double.NegativeInfinity) - d) <= double.Epsilon);
+ }
+
+ public void TestAtan2() {
+ double a = Math.Atan2(x, y);
+ double b = 0.0099956168687207747;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Acos(-2D)));
+ Assert(double.IsNaN(Math.Acos(2D)));
+ }
+
+ public void TestCos() {
+ double a = Math.Cos(x);
+ double b = 0.99239587670489104;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestCosh() {
+ double a = Math.Cosh(x);
+ double b = 1.0076234465130722;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(Math.Cosh(double.NegativeInfinity) == double.PositiveInfinity);
+ Assert(Math.Cosh(double.PositiveInfinity) == double.PositiveInfinity);
+ Assert(double.IsNaN(Math.Cosh(double.NaN)));
+ }
+
+ public void TestSin() {
+ double a = Math.Sin(x);
+ double b = 0.12308705821137626;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestSinh() {
+ double a = Math.Sinh(x);
+ double b = 0.12371341868561381;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestTan() {
+ double a = Math.Tan(x);
+ double b = 0.12403019913793806;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestTanh() {
+ double a = Math.Tanh(x);
+ double b = 0.12277743150353424;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestSqrt() {
+ double a = Math.Sqrt(x);
+ double b = 0.35128336140500593;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestExp() {
+ double a = Math.Exp(x);
+ double b = 1.1313368651986859;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Exp(double.NaN)));
+ Assert(Math.Exp(double.NegativeInfinity) == 0);
+ Assert(Math.Exp(double.PositiveInfinity) == double.PositiveInfinity);
+ }
+
+ public void TestCeiling() {
+ int iTest = 1;
+ try {
+ double a = Math.Ceiling(1.5);
+ double b = 2;
+
+ iTest++;
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ iTest++;
+ Assert(Math.Ceiling(double.NegativeInfinity) == double.NegativeInfinity);
+ iTest++;
+ Assert(Math.Ceiling(double.PositiveInfinity) == double.PositiveInfinity);
+ iTest++;
+ Assert(double.IsNaN(Math.Ceiling(double.NaN)));
+ } catch (Exception e) {
+ Fail("Unexpected Exception at iTest=" + iTest + ": " + e);
+ }
+ }
+
+ public void TestFloor() {
+ try {
+ double a = Math.Floor(1.5);
+ double b = 1;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(Math.Floor(double.NegativeInfinity) == double.NegativeInfinity);
+ Assert(Math.Floor(double.PositiveInfinity) == double.PositiveInfinity);
+ Assert(double.IsNaN(Math.Floor(double.NaN)));
+ } catch (Exception e) {
+ Fail("Unexpected Exception: " + e.ToString());
+ }
+ }
+
+ public void TestIEEERemainder() {
+ double a = Math.IEEERemainder(y, x);
+ double b = 0.0050000000000007816;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.IEEERemainder(y, 0)));
+ }
+
+ public void TestLog() {
+ double a = Math.Log(y);
+ double b = 2.513251122797143;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Log(-1)));
+ Assert(double.IsNaN(Math.Log(double.NaN)));
+
+ // MS docs say this should be PositiveInfinity
+ Assert(Math.Log(0) == double.NegativeInfinity);
+ Assert(Math.Log(double.PositiveInfinity) == double.PositiveInfinity);
+ }
+
+ public void TestLog2() {
+ double a = Math.Log(x, y);
+ double b = -0.83251695325303621;
+
+ Assert(a + " != " + b + " because diff is " + Math.Abs(a - b), (Math.Abs(a - b) <= 1e-14));
+ Assert(double.IsNaN(Math.Log(-1, y)));
+ Assert(double.IsNaN(Math.Log(double.NaN, y)));
+ Assert(double.IsNaN(Math.Log(x, double.NaN)));
+ Assert(double.IsNaN(Math.Log(double.NegativeInfinity, y)));
+ Assert(double.IsNaN(Math.Log(x, double.NegativeInfinity)));
+ Assert(double.IsNaN(Math.Log(double.PositiveInfinity, double.PositiveInfinity)));
+
+ // MS docs say this should be PositiveInfinity
+ Assert(Math.Log(0, y) == double.NegativeInfinity);
+ Assert(Math.Log(double.PositiveInfinity, y) == double.PositiveInfinity);
+ Assert(Math.Log(x, double.PositiveInfinity) == 0);
+ }
+
+ public void TestLog10() {
+ double a = Math.Log10(x);
+ double b = -0.90868484030277719;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Log10(-1)));
+ Assert(double.IsNaN(Math.Log10(double.NaN)));
+
+ // MS docs say this should be PositiveInfinity
+ Assert(Math.Log10(0) == double.NegativeInfinity);
+ Assert(Math.Log10(double.PositiveInfinity) == double.PositiveInfinity);
+
+ }
+
+ public void TestPow() {
+ int iTest = 1;
+
+ try {
+ double a = Math.Pow(y, x);
+ double b = 1.363609446060212;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"), (Math.Abs(a - b) <= double.Epsilon));
+ iTest++;
+ Assert (double.IsNaN(Math.Pow(y, double.NaN)));
+ iTest++;
+ Assert (double.IsNaN(Math.Pow(double.NaN, x)));
+ iTest++;
+ Assert ("Math.Pow(double.NegativeInfinity, 1) should be NegativeInfinity", double.IsNegativeInfinity(Math.Pow(double.NegativeInfinity, 1)));
+ iTest++;
+ Assert ("Math.Pow(double.NegativeInfinity, 2) should be PositiveInfinity", double.IsPositiveInfinity(Math.Pow(double.NegativeInfinity, 2)));
+
+ // MS docs say this should be 0
+ iTest++;
+ Assert(double.IsNaN(Math.Pow(1, double.NegativeInfinity)));
+ iTest++;
+ AssertEquals ("Math.Pow(double.PositiveInfinity, double.NegativeInfinity)", (double)0, Math.Pow(double.PositiveInfinity, double.NegativeInfinity));
+ iTest++;
+ Assert ("Math.Pow(double.PositiveInfinity, 1) should be PositiveInfinity", double.IsPositiveInfinity(Math.Pow(double.PositiveInfinity, 1)));
+
+ // MS docs say this should be PositiveInfinity
+ iTest++;
+ Assert ("Math.Pow(1, double.PositiveInfinity) should be NaN", double.IsNaN(Math.Pow(1, double.PositiveInfinity)));
+ } catch (Exception e) {
+ Fail ("Unexpected exception at iTest=" + iTest + ". e=" + e);
+ }
+ }
+
+ public void TestByteMax() {
+ byte a = 1;
+ byte b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestDecimalMax() {
+ decimal a = 1.5M;
+ decimal b = 2.5M;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestDoubleMax() {
+ double a = 1.5D;
+ double b = 2.5D;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestFloatMax() {
+ float a = 1.5F;
+ float b = 2.5F;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestIntMax() {
+ int a = 1;
+ int b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestLongMax() {
+ long a = 1L;
+ long b = 2L;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestSbyteMax() {
+ sbyte a = 1;
+ sbyte b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestShortMax() {
+ short a = 1;
+ short b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestUintMax() {
+ uint a = 1U;
+ uint b = 2U;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestUlongMax() {
+ ulong a = 1UL;
+ ulong b = 2UL;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestUshortMax() {
+ ushort a = 1;
+ ushort b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestByteMin() {
+ byte a = 1;
+ byte b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestDecimalMin() {
+ decimal a = 1.5M;
+ decimal b = 2.5M;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestDoubleMin() {
+ double a = 1.5D;
+ double b = 2.5D;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestFloatMin() {
+ float a = 1.5F;
+ float b = 2.5F;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestIntMin() {
+ int a = 1;
+ int b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestLongMin() {
+ long a = 1L;
+ long b = 2L;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestSbyteMin() {
+ sbyte a = 1;
+ sbyte b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestShortMin() {
+ short a = 1;
+ short b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestUintMin() {
+ uint a = 1U;
+ uint b = 2U;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestUlongMin() {
+ ulong a = 1UL;
+ ulong b = 2UL;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestUshortMin() {
+ ushort a = 1;
+ ushort b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestDecimalRound() {
+ decimal a = 1.5M;
+ decimal b = 2.5M;
+
+ Assert(Math.Round(a) + " != 2", Math.Round(a) == 2);
+ Assert(Math.Round(b) + " != 2", Math.Round(b) == 2);
+ }
+
+ public void TestDecimalRound2() {
+ decimal a = 3.45M;
+ decimal b = 3.46M;
+
+ AssertEquals ("Should round down", Math.Round(a, 1), 3.4M);
+ AssertEquals ("Should round up", Math.Round(b, 1), 3.5M);
+ }
+
+ public void TestDoubleRound() {
+ double a = 1.5D;
+ double b = 2.5D;
+
+ AssertEquals ("Should round up", Math.Round(a), 2D);
+ AssertEquals ("Should round down", Math.Round(b), 2D);
+ }
+
+ public void TestDoubleRound2() {
+ double a = 3.45D;
+ double b = 3.46D;
+
+ AssertEquals ("Should round down", Math.Round(a, 1), 3.4D);
+ AssertEquals ("Should round up", Math.Round(b, 1), 3.5D);
+ }
+
+ public void TestDecimalSign() {
+ decimal a = -5M;
+ decimal b = 5M;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0M) == 0);
+ }
+
+ public void TestDoubleSign() {
+ double a = -5D;
+ double b = 5D;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0D) == 0);
+ }
+
+ public void TestFloatSign() {
+ float a = -5F;
+ float b = 5F;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0F) == 0);
+ }
+
+ public void TestIntSign() {
+ int a = -5;
+ int b = 5;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ }
+
+ public void TestLongSign() {
+ long a = -5L;
+ long b = 5L;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0L) == 0);
+ }
+
+ public void TestSbyteSign() {
+ sbyte a = -5;
+ sbyte b = 5;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0) == 0);
+ }
+
+ public void TestShortSign() {
+ short a = -5;
+ short b = 5;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0) == 0);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/MulticastDelegate.cs b/mcs/class/corlib/Test/System/MulticastDelegate.cs
new file mode 100644
index 00000000000..06027f4ba06
--- /dev/null
+++ b/mcs/class/corlib/Test/System/MulticastDelegate.cs
@@ -0,0 +1,110 @@
+// MulticastDelegate.cs - NUnit Test Cases for MulticastDelegates (C# delegates)
+//
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) Daniel Stodden
+//
+
+// these are the standard namespaces you will need. You may need to add more
+// depending on your tests.
+using NUnit.Framework;
+using System;
+
+// all test namespaces start with "MonoTests." Append the Namespace that
+// contains the class you are testing, e.g. MonoTests.System.Collections
+namespace MonoTests.System
+{
+
+// the class name should end with "Test" and start with the name of the class
+// you are testing, e.g. CollectionBaseTest
+public class MulticastDelegateTest : TestCase {
+
+ public MulticastDelegateTest() {}
+
+ // this method is run before each Test* method is called. You can put
+ // variable initialization, etc. here that is common to each test.
+ // Just leave the method empty if you don't need to use it.
+ protected override void SetUp() {}
+
+ // this method is run after each Test* method is called. You can put
+ // clean-up code, etc. here. Whatever needs to be done after each test.
+ // Just leave the method empty if you don't need to use it.
+ protected override void TearDown() {}
+
+ private delegate char MyDelegate( ref string s );
+
+ private char MethodA( ref string s )
+ {
+ s += "a";
+ return 'a';
+ }
+
+ private char MethodB( ref string s )
+ {
+ s += "b";
+ return 'b';
+ }
+
+ private char MethodC( ref string s )
+ {
+ s += "c";
+ return 'c';
+ }
+
+ private char MethodD( ref string s )
+ {
+ s += "d";
+ return 'd';
+ }
+
+ public void TestEquals()
+ {
+ MyDelegate dela = new MyDelegate( MethodA );
+ MyDelegate delb = new MyDelegate( MethodB );
+ MyDelegate delc = new MyDelegate( MethodC );
+
+ AssertEquals( "#A01", false, dela == delb );
+
+ MyDelegate del1, del2;
+
+ del1 = dela + delb;
+ del2 = delb + delc;
+ AssertEquals( "#A02", false, del1 == del2 );
+
+ del1 += delc;
+ del2 = dela + del2;
+ AssertEquals( "#A03", true, del1 == del2 );
+ }
+
+ public void TestCombineRemove()
+ {
+ MyDelegate dela = new MyDelegate( MethodA );
+ MyDelegate delb = new MyDelegate( MethodB );
+ MyDelegate delc = new MyDelegate( MethodC );
+ MyDelegate deld = new MyDelegate( MethodD );
+
+ string val;
+ char res;
+
+ // test combine
+ MyDelegate del1, del2;
+ del1 = dela + delb + delb + delc + delb + delb + deld;
+ val = "";
+ res = del1( ref val );
+ AssertEquals( "#A01", "abbcbbd", val );
+ AssertEquals( "#A02", 'd', res );
+
+ // test remove
+ del2 = del1 - ( delb + delb );
+ val = "";
+ res = del2( ref val );
+ AssertEquals( "#A03", "abbcd", val );
+ AssertEquals( "#A04", 'd', res );
+
+ // we did not affect del1, did we?
+ val = "";
+ res = del1( ref val );
+ AssertEquals( "#A05", "abbcbbd", val );
+ }
+}
+}
diff --git a/mcs/class/corlib/Test/System/ObjectTest.cs b/mcs/class/corlib/Test/System/ObjectTest.cs
new file mode 100644
index 00000000000..67870d3edb2
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ObjectTest.cs
@@ -0,0 +1,114 @@
+// ObjectTest.cs - NUnit Test Cases for the System.Object struct
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class ObjectTest : TestCase
+{
+ public ObjectTest() {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public void TestCtor() {
+ Object o = new Object();
+ AssertNotNull("Can I at least get an _Object_, please?", o);
+ }
+
+ public void TestEquals1() {
+ {
+ Object x = new Object();
+ Object y = new Object();
+ Assert("Object should equal itself",
+ x.Equals(x));
+ Assert("object should not equal null",
+ !x.Equals(null));
+ Assert("Different objects should not equal 1",
+ !x.Equals(y));
+ Assert("Different objects should not equal 2",
+ !y.Equals(x));
+ }
+ {
+ double x = Double.NaN;
+ double y = Double.NaN;
+ Assert("NaNs should always equal each other",
+ ((Object)x).Equals(y));
+ }
+ }
+ public void TestEquals2() {
+ {
+ Object x = new Object();
+ Object y = new Object();
+ Assert("Object should equal itself",
+ Object.Equals(x,x));
+ Assert("object should not equal null",
+ !Object.Equals(x,null));
+ Assert("null should not equal object",
+ !Object.Equals(null,x));
+ Assert("Different objects should not equal 1",
+ !Object.Equals(x,y));
+ Assert("Different objects should not equal 2",
+ !Object.Equals(y,x));
+ Assert("null should not equal null",
+ Object.Equals(null,null));
+ }
+ {
+ double x = Double.NaN;
+ double y = Double.NaN;
+ Assert("NaNs should always equal each other",
+ Object.Equals(x,y));
+ }
+ }
+
+ public void TestGetHashCode() {
+ Object x = new Object();
+ AssertEquals("Object's hash code should not change",
+ x.GetHashCode(), x.GetHashCode());
+ }
+
+ public void TestGetType() {
+ Object x = new Object();
+ AssertNotNull("Should get a type for Object", x.GetType());
+ AssertEquals("Bad name for Object type", "System.Object",
+ x.GetType().ToString());
+ }
+
+ public void TestReferenceEquals() {
+ Object x = new Object();
+ Object y = new Object();
+ Assert("Object should equal itself",
+ Object.ReferenceEquals(x,x));
+ Assert("object should not equal null",
+ !Object.ReferenceEquals(x,null));
+ Assert("null should not equal object",
+ !Object.ReferenceEquals(null,x));
+ Assert("Different objects should not equal 1",
+ !Object.ReferenceEquals(x,y));
+ Assert("Different objects should not equal 2",
+ !Object.ReferenceEquals(y,x));
+ Assert("null should not equal null",
+ Object.ReferenceEquals(null,null));
+ }
+
+ public void TestToString() {
+ Object x = new Object();
+ Object y = new Object();
+ AssertEquals("All Objects should have same string rep",
+ x.ToString(), y.ToString());
+ }
+}
+}
diff --git a/mcs/class/corlib/Test/System/RandomTest.cs b/mcs/class/corlib/Test/System/RandomTest.cs
new file mode 100644
index 00000000000..afa5bb6d352
--- /dev/null
+++ b/mcs/class/corlib/Test/System/RandomTest.cs
@@ -0,0 +1,83 @@
+//
+// System.Random Test Cases
+//
+// Author: Bob Smith <bob@thestuff.net>
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System {
+
+public class RandomTest : TestCase
+{
+ public RandomTest() {}
+ public void TestDouble()
+ {
+ Random r = new Random();
+ int i;
+ double c=0;
+ for (i=0; i<20; i++) c+=r.NextDouble();
+ c/=i;
+ Assert (c.ToString() + " is out of range.", c < .7 && c > .3);
+ }
+ public void TestSeed()
+ {
+ Random r = new Random(42);
+ Random r2 = new Random(42);
+ int i;
+ double c=0, c2=0;
+ for (i=0; i<20; i++)
+ {
+ c += r.NextDouble();
+ c2 += r2.NextDouble();
+ }
+ AssertEquals(c, c2);
+ }
+ public void TestNext()
+ {
+ Random r = new Random();
+ int i;
+ long c;
+ for (i=0; i<20; i++)
+ {
+ c = r.Next();
+ Assert (c < Int32.MaxValue && c >= 0);
+ }
+ }
+ public void TestNextMax()
+ {
+ Random r = new Random();
+ int i;
+ long c;
+ for (i=0; i<20; i++)
+ {
+ c = r.Next(10);
+ Assert (c < 10 && c >= 0);
+ }
+ }
+ public void TestNextMinMax()
+ {
+ Random r = new Random();
+ int i;
+ long c;
+ AssertEquals ("#1 Failed where min == max", 42, r.Next (42, 42));
+ AssertEquals ("#2 Failed where min == max", Int32.MaxValue, r.Next (Int32.MaxValue,Int32.MaxValue));
+ AssertEquals ("#3 Failed where min == max", Int32.MinValue, r.Next (Int32.MinValue,Int32.MinValue));
+ AssertEquals ("#4 Failed where min == max", 0, r.Next (0, 0));
+ for (i = 1; i <= Int32.MaxValue / 2; i *= 2)
+ {
+ c = r.Next (i, i * 2);
+ Assert ("At i=" + i + " c < i*2 failed", c < i * 2);
+ Assert ("At i=" + i + " c >= i failed", c >= i);
+ }
+ for (i = -1; i >= Int32.MinValue / 2; i *= 2)
+ {
+ c = r.Next (i * 2, i);
+ Assert ("At i=" + i + " c < i*2 failed", c < i);
+ Assert ("At i=" + i + " c >= i failed", c >= i * 2);
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ResolveEventArgsTest.cs b/mcs/class/corlib/Test/System/ResolveEventArgsTest.cs
new file mode 100644
index 00000000000..863fd40948a
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ResolveEventArgsTest.cs
@@ -0,0 +1,23 @@
+//
+// System.ResolveEventArgs Test Cases
+//
+// Author: Nick Drochak <ndrochak@gol.com>
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System {
+
+public class ResolveEventArgsTest : TestCase
+{
+ public ResolveEventArgsTest() {}
+
+ public void TestTheWholeThing()
+ {
+ ResolveEventArgs REA = new ResolveEventArgs("REA_Name");
+ Assert ("Name property not correct", REA.Name == "REA_Name");
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/SByteTest.cs b/mcs/class/corlib/Test/System/SByteTest.cs
new file mode 100644
index 00000000000..15e35729abc
--- /dev/null
+++ b/mcs/class/corlib/Test/System/SByteTest.cs
@@ -0,0 +1,173 @@
+// SByteTest.cs - NUnit Test Cases for the System.SByte struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class SByteTest : TestCase
+{
+ private const SByte MySByte1 = -42;
+ private const SByte MySByte2 = -128;
+ private const SByte MySByte3 = 127;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-128";
+ private const string MyString3 = "127";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {"("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"128.00)",
+ "-128", "-1.280000e+002", "-128.00",
+ "-128", "-128.00", "-12,800.00 %", "80"};
+ private string[] Results2 = {NumberFormatInfo.CurrentInfo.CurrencySymbol+"127.00000",
+ "00127", "1.27000e+002", "127.00000",
+ "127", "127.00000", "12,700.00000 %", "0007f"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"128.00)",
+ "-128", "-1.280000e+002", "-128.00",
+ "-128", "-128.00", "-12,800.00 %", "80"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"127.00000",
+ "00127", "1.27000e+002", "127.00000",
+ "127", "127.00000", "12,700.00000 %", "0007f"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public SByteTest() {}
+
+ protected override void SetUp()
+ {
+ }
+
+ public void TestMinMax()
+ {
+ AssertEquals(SByte.MinValue, MySByte2);
+ AssertEquals(SByte.MaxValue, MySByte3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MySByte3.CompareTo(MySByte2) > 0);
+ Assert(MySByte2.CompareTo(MySByte2) == 0);
+ Assert(MySByte1.CompareTo((SByte)(-42)) == 0);
+ Assert(MySByte2.CompareTo(MySByte3) < 0);
+ try {
+ MySByte2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MySByte1.Equals(MySByte1));
+ Assert(MySByte1.Equals((SByte)(-42)));
+ Assert(MySByte1.Equals((Int16)(-42)) == false);
+ Assert(MySByte1.Equals(MySByte2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MySByte1.GetHashCode();
+ MySByte2.GetHashCode();
+ MySByte3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MySByte1 == SByte.Parse(MyString1));
+ Assert(MySByte2 == SByte.Parse(MyString2));
+ Assert(MySByte3 == SByte.Parse(MyString3));
+ try {
+ SByte.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ SByte.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = SByte.MaxValue + 1;
+ SByte.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ AssertEquals("A1", (sbyte)42, SByte.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ SByte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(-42 == SByte.Parse(" -42 ", Nfi));
+ try {
+ SByte.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == SByte.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ SByte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ Assert("MyString1, MySByte1.ToString()", String.Compare(MyString1, MySByte1.ToString()) == 0);
+ Assert("MyString2, MySByte2.ToString()", String.Compare(MyString2, MySByte2.ToString()) == 0);
+ Assert("MyString3, MySByte3.ToString()", String.Compare(MyString3, MySByte3.ToString()) == 0);
+ //test ToString(string format)
+ /*
+ TODO: These tests depend on the culture of the system running the test.
+ So, this needs to be tested in a different way.
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert("i="+i+", Results1[i]="+Results1[i]+", MySByte2.ToString(Formats1[i])="+MySByte2.ToString(Formats1[i]), String.Compare(Results1[i], MySByte2.ToString(Formats1[i])) == 0);
+ Assert("Results2[i], MySByte3.ToString(Formats2[i])", String.Compare(Results2[i], MySByte3.ToString(Formats2[i])) == 0);
+ }
+ */
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert("i="+i+", ResultsNfi1[i]="+ResultsNfi1[i]+", MySByte2.ToString(Formats1[i]="+Formats1[i]+"): Expected "+ResultsNfi1[i]+" but got "+MySByte2.ToString(Formats1[i], Nfi), String.Compare(ResultsNfi1[i], MySByte2.ToString(Formats1[i], Nfi)) == 0);
+ Assert("ResultsNfi2[i], MySByte3.ToString(Formats2[i], Nfi):"+ResultsNfi2[i]+"<==>"+MySByte3.ToString(Formats2[i], Nfi), String.Compare(ResultsNfi2[i], MySByte3.ToString(Formats2[i], Nfi)) == 0);
+ }
+ try {
+ MySByte1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("typeof(FormatException) == e.GetType()", typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/StringTest.cs b/mcs/class/corlib/Test/System/StringTest.cs
new file mode 100644
index 00000000000..9d584c9c43f
--- /dev/null
+++ b/mcs/class/corlib/Test/System/StringTest.cs
@@ -0,0 +1,1079 @@
+// StringTest.cs - NUnit Test Cases for the System.String class
+//
+// Jeffrey Stedfast <fejj@ximian.com>
+// David Brandt <bucky@keystreams.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class StringTest : TestCase
+{
+ public StringTest() {}
+
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestLength ()
+ {
+ string str = "test string";
+
+ AssertEquals("wrong length", 11, str.Length);
+ }
+
+ public void TestCompare ()
+ {
+ string lesser = "abc";
+ string medium = "abcd";
+ string greater = "xyz";
+ string caps = "ABC";
+
+ AssertEquals(0, String.Compare(null, null));
+ AssertEquals(1, String.Compare(lesser, null));
+
+ Assert (String.Compare (lesser, greater) < 0);
+ Assert (String.Compare (greater, lesser) > 0);
+ Assert (String.Compare (lesser, lesser) == 0);
+ Assert (String.Compare (lesser, medium) < 0);
+
+ Assert (String.Compare (lesser, caps, true) == 0);
+ Assert (String.Compare (lesser, caps, false) != 0);
+ AssertEquals ("A01", String.Compare ("a", "b"), -1);
+ AssertEquals ("A02", String.Compare ("b", "a"), 1);
+ AssertEquals ("A03", String.Compare ("A", "a"), 1);
+ AssertEquals ("A04", String.Compare ("a", "A"), -1);
+
+
+ // TODO - test with CultureInfo
+
+ string needle = "ab";
+ string haystack = "abbcbacab";
+ AssertEquals("basic substring check #1", 0,
+ String.Compare(needle, 0, haystack, 0, 2));
+ AssertEquals("basic substring check #2", -1,
+ String.Compare(needle, 0, haystack, 0, 3));
+ AssertEquals("basic substring check #3", 0,
+ String.Compare("ab", 0, "ab", 0, 2));
+ AssertEquals("basic substring check #4", 0,
+ String.Compare("ab", 0, "ab", 0, 3));
+ AssertEquals("basic substring check #5", 0,
+ String.Compare("abc", 0, "ab", 0, 2));
+ AssertEquals("basic substring check #6", 1,
+ String.Compare("abc", 0, "ab", 0, 5));
+ AssertEquals("basic substring check #7", -1,
+ String.Compare("ab", 0, "abc", 0, 5));
+
+ for (int i = 1; i <= (haystack.Length - needle.Length); i++) {
+ if (i != 7) {
+ Assert("loop substring check #1/" + i, String.Compare(needle, 0, haystack, i, 2) != 0);
+ Assert("loop substring check #2/" + i, String.Compare(needle, 0, haystack, i, 3) != 0);
+ } else {
+ AssertEquals("loop substring check #3/" + i, 0, String.Compare(needle, 0, haystack, i, 2));
+ AssertEquals("loop substring check #4/" + i, 0, String.Compare(needle, 0, haystack, i, 3));
+ }
+ }
+
+ needle = "AB";
+ AssertEquals("basic substring check #8", 0,
+ String.Compare(needle, 0, haystack, 0, 2, true));
+ AssertEquals("basic substring check #9", 1,
+ String.Compare(needle, 0, haystack, 0, 2, false));
+ for (int i = 1; i <= (haystack.Length - needle.Length); i++) {
+ if (i != 7) {
+ Assert("loop substring check #5/" + i, String.Compare(needle, 0, haystack, i, 2, true) != 0);
+ Assert("loop substring check #6/" + i, String.Compare(needle, 0, haystack, i, 2, false) != 0);
+ } else {
+ AssertEquals("loop substring check #7/" + i, 0, String.Compare(needle, 0, haystack, i, 2, true));
+ AssertEquals("loop substring check #8/" + i, 1, String.Compare(needle, 0, haystack, i, 2, false));
+ }
+ }
+
+ // TODO - extended format call with CultureInfo
+ }
+
+ public void TestCompareOrdinal ()
+ {
+ string lesser = "abc";
+ string medium = "abcd";
+ string greater = "xyz";
+
+ AssertEquals(0, String.CompareOrdinal(null, null));
+ AssertEquals(1, String.CompareOrdinal(lesser, null));
+
+ Assert (String.CompareOrdinal (lesser, greater) < 0);
+ Assert (String.CompareOrdinal (greater, lesser) > 0);
+ Assert (String.CompareOrdinal (lesser, lesser) == 0);
+ Assert (String.CompareOrdinal (lesser, medium) < 0);
+
+ string needle = "ab";
+ string haystack = "abbcbacab";
+ AssertEquals("basic substring check", 0,
+ String.CompareOrdinal(needle, 0, haystack, 0, 2));
+ AssertEquals("basic substring miss", -1,
+ String.CompareOrdinal(needle, 0, haystack, 0, 3));
+ for (int i = 1; i <= (haystack.Length - needle.Length); i++) {
+ if (i != 7) {
+ Assert("loop substring check " + i, String.CompareOrdinal(needle, 0, haystack, i, 2) != 0);
+ Assert("loop substring check " + i, String.CompareOrdinal(needle, 0, haystack, i, 3) != 0);
+ } else {
+ AssertEquals("loop substring check " + i, 0, String.CompareOrdinal(needle, 0, haystack, i, 2));
+ AssertEquals("loop substring check " + i, 0, String.CompareOrdinal(needle, 0, haystack, i, 3));
+ }
+ }
+ }
+
+ public void TestCompareTo ()
+ {
+ string lower = "abc";
+ string greater = "xyz";
+ string lesser = "abc";
+
+ Assert (lower.CompareTo (greater) < 0);
+ Assert (lower.CompareTo (lower) == 0);
+ Assert (greater.CompareTo (lesser) > 0);
+ }
+
+ public void TestConcat ()
+ {
+ string string1 = "string1";
+ string string2 = "string2";
+ string concat = "string1string2";
+
+ Assert (String.Concat (string1, string2) == concat);
+ }
+
+ public void TestCopy()
+ {
+ string s1 = "original";
+ string s2 = String.Copy(s1);
+ AssertEquals("String copy no good", s1, s2);
+
+ bool errorThrown = false;
+ try {
+ string s = String.Copy(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null copy shouldn't be good", errorThrown);
+ }
+
+ public void TestCopyTo()
+ {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ s1.CopyTo(0, (char[])null, 0, s1.Length);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null CopyTo shouldn't be good", errorThrown);
+
+ char[] c1 = new char[s1.Length];
+ string s2 = new String(c1);
+ Assert("char string not bad to start", !s1.Equals(s2));
+ for (int i = 0; i < s1.Length; i++) {
+ s1.CopyTo(i, c1, i, 1);
+ }
+ s2 = new String(c1);
+ AssertEquals("char-by-char copy bad", s1, s2);
+ }
+
+ public void TestEndsWith()
+ {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ bool huh = s1.EndsWith(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null EndsWith shouldn't be good", errorThrown);
+
+ Assert("should match", s1.EndsWith("l"));
+ Assert("should match 2", s1.EndsWith("inal"));
+ Assert("should fail", !s1.EndsWith("ina"));
+ }
+
+ public void TestEquals()
+ {
+ string s1 = "original";
+ string yes = "original";
+ object y = yes;
+ string no = "copy";
+ string s1s1 = s1 + s1;
+
+ Assert("No match for null", !s1.Equals(null));
+ Assert("Should match object", s1.Equals(y));
+ Assert("Should match", s1.Equals(yes));
+ Assert("Shouldn't match", !s1.Equals(no));
+
+ Assert("Static nulls should match", String.Equals(null, null));
+ Assert("Should match", String.Equals(s1, yes));
+ Assert("Shouldn't match", !String.Equals(s1, no));
+
+ AssertEquals ("Equals (object)", false, s1s1.Equals (y));
+ }
+
+ public void TestFormat ()
+ {
+ AssertEquals ("Empty format string.", "", String.Format ("", 0));
+ AssertEquals ("Single argument.", "100", String.Format ("{0}", 100));
+ AssertEquals ("Single argument, right justified.", "X 37X", String.Format ("X{0,5}X", 37));
+ AssertEquals ("Single argument, left justified.", "X37 X", String.Format ("X{0,-5}X", 37));
+ AssertEquals ("Two arguments.", "The 3 wise men.", String.Format ("The {0} wise {1}.", 3, "men"));
+ AssertEquals ("Three arguments.", "do re me fa so.", String.Format ("{0} re {1} fa {2}.", "do", "me", "so"));
+ AssertEquals ("Formatted argument.", "###00c0ffee#", String.Format ("###{0:x8}#", 0xc0ffee));
+ AssertEquals ("Formatted argument, right justified.", "# 033#", String.Format ("#{0,5:x3}#", 0x33));
+ AssertEquals ("Formatted argument, left justified.", "#033 #", String.Format ("#{0,-5:x3}#", 0x33));
+ AssertEquals ("Escaped bracket", "typedef struct _MonoObject { ... } MonoObject;", String.Format ("typedef struct _{0} {{ ... }} MonoObject;", "MonoObject"));
+ AssertEquals ("With Slash", "Could not find file \"a/b\"", String.Format ("Could not find file \"{0}\"", "a/b"));
+ AssertEquals ("With BackSlash", "Could not find file \"a\\b\"", String.Format ("Could not find file \"{0}\"", "a\\b"));
+
+ // TODO test format exceptions
+
+ // TODO test argument null exceptions
+ // This should work, but it doesn't currently.
+ // I think I broke the spec...
+ //bool errorThrown = false;
+ //try {
+ //string s = String.Format(null, " ");
+ //} catch (ArgumentNullException) {
+ //errorThrown = true;
+ //}
+ //Assert("error not thrown 1", errorThrown);
+ //errorThrown = false;
+ //try {
+ //string s = String.Format(null, " ", " ");
+ //} catch (ArgumentNullException) {
+ //errorThrown = true;
+ //}
+ //Assert("error not thrown 2", errorThrown);
+ //errorThrown = false;
+ //try {
+ //string s = String.Format(" ", null);
+ //} catch (ArgumentNullException) {
+ //errorThrown = true;
+ //}
+ //Assert("error not thrown 3", errorThrown);
+ }
+
+ public void TestGetEnumerator()
+ {
+ string s1 = "original";
+ char[] c1 = new char[s1.Length];
+ string s2 = new String(c1);
+ Assert("pre-enumerated string should not match", !s1.Equals(s2));
+ CharEnumerator en = s1.GetEnumerator();
+ AssertNotNull("null enumerator", en);
+
+ for (int i = 0; i < s1.Length; i++) {
+ en.MoveNext();
+ c1[i] = en.Current;
+ }
+ s2 = new String(c1);
+ AssertEquals("enumerated string should match", s1, s2);
+ }
+
+ public void TestGetHashCode()
+ {
+ string s1 = "original";
+ // TODO - weak test, currently. Just verifies determinicity.
+ AssertEquals("same string, same hash code",
+ s1.GetHashCode(), s1.GetHashCode());
+ }
+
+ public void TestGetType() {
+ string s1 = "original";
+ AssertEquals("String type", "System.String", s1.GetType().ToString());
+ }
+
+ public void TestGetTypeCode() {
+ string s1 = "original";
+ Assert(s1.GetTypeCode().Equals(TypeCode.String));
+ }
+
+ public void TestIndexOf() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.IndexOf('q', s1.Length + 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf('q', s1.Length + 1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf("huh", s1.Length + 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf("huh", s1.Length + 1, 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ AssertEquals("basic char index", 1, s1.IndexOf('r'));
+ AssertEquals("basic char index", 2, s1.IndexOf('i'));
+ AssertEquals("basic char index - no", -1, s1.IndexOf('q'));
+
+ AssertEquals("basic string index", 1, s1.IndexOf("rig"));
+ AssertEquals("basic string index", 2, s1.IndexOf("i"));
+ AssertEquals("basic string index - no", -1, s1.IndexOf("rag"));
+
+ AssertEquals("stepped char index", 1, s1.IndexOf('r', 1));
+ AssertEquals("stepped char index", 2, s1.IndexOf('i', 1));
+ AssertEquals("stepped char index", 4, s1.IndexOf('i', 3));
+ AssertEquals("stepped char index", -1, s1.IndexOf('i', 5));
+ AssertEquals("stepped char index", -1, s1.IndexOf('l', s1.Length));
+
+ AssertEquals("stepped limited char index",
+ 1, s1.IndexOf('r', 1, 1));
+ AssertEquals("stepped limited char index",
+ -1, s1.IndexOf('r', 0, 1));
+ AssertEquals("stepped limited char index",
+ 2, s1.IndexOf('i', 1, 3));
+ AssertEquals("stepped limited char index",
+ 4, s1.IndexOf('i', 3, 3));
+ AssertEquals("stepped limited char index",
+ -1, s1.IndexOf('i', 5, 3));
+
+ s1 = "original original";
+ AssertEquals("stepped string index 1",
+ 0, s1.IndexOf("original", 0));
+ AssertEquals("stepped string index 2",
+ 9, s1.IndexOf("original", 1));
+ AssertEquals("stepped string index 3",
+ -1, s1.IndexOf("original", 10));
+ AssertEquals("stepped limited string index 1",
+ 1, s1.IndexOf("rig", 0, 5));
+ AssertEquals("stepped limited string index 2",
+ -1, s1.IndexOf("rig", 0, 3));
+ AssertEquals("stepped limited string index 3",
+ 10, s1.IndexOf("rig", 2, 15));
+ AssertEquals("stepped limited string index 4",
+ -1, s1.IndexOf("rig", 2, 3));
+ }
+
+ public void TestIndexOfAny() {
+ string s1 = "abcdefghijklm";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ char[] c1 = {'a', 'e', 'i', 'o', 'u'};
+ AssertEquals("first vowel", 0, s1.IndexOfAny(c1));
+ AssertEquals("second vowel", 4, s1.IndexOfAny(c1, 1));
+ AssertEquals("out of vowels", -1, s1.IndexOfAny(c1, 9));
+ AssertEquals("second vowel in range",
+ 4, s1.IndexOfAny(c1, 1, 4));
+ AssertEquals("second vowel out of range",
+ -1, s1.IndexOfAny(c1, 1, 3));
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(c1, s1.Length+1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(c1, s1.Length+1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+ }
+
+ public void TestInsert() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ string result = s1.Insert(0, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("Null arg error", errorThrown);
+
+ errorThrown = false;
+ try {
+ string result = s1.Insert(s1.Length+1, "Hi!");
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+
+ AssertEquals("front insert",
+ "Hi!original", s1.Insert(0, "Hi!"));
+ AssertEquals("back insert",
+ "originalHi!", s1.Insert(s1.Length, "Hi!"));
+ AssertEquals("middle insert",
+ "origHi!inal", s1.Insert(4, "Hi!"));
+ }
+
+ public void TestIntern() {
+ bool errorThrown = false;
+ try {
+ string s = String.Intern(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error", errorThrown);
+
+ string s1 = "original";
+ AssertEquals("One string's reps are both the same",
+ String.Intern(s1), String.Intern(s1));
+
+ string s2 = "originally";
+ Assert("Different strings, different reps",
+ String.Intern(s1) != String.Intern(s2));
+ }
+
+ public void TestIsInterned() {
+ bool errorThrown = false;
+ try {
+ string s = String.IsInterned(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error", errorThrown);
+
+ // FIXME - it seems like this should work, but no.
+ // I don't know how it's possible to get a null
+ // returned from IsInterned.
+ //Assert("no intern for regular string",
+ //String.IsInterned("original") == null);
+
+ string s1 = "original";
+ AssertEquals("is interned", s1, String.IsInterned(s1));
+ }
+
+ public void TestJoin() {
+ bool errorThrown = false;
+ try {
+ string s = String.Join(" ", null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error", errorThrown);
+
+ string[] chunks = {"this", "is", "a", "test"};
+ AssertEquals("Basic join", "this is a test",
+ String.Join(" ", chunks));
+ AssertEquals("Basic join", "this.is.a.test",
+ String.Join(".", chunks));
+
+ AssertEquals("Subset join", "is a",
+ String.Join(" ", chunks, 1, 2));
+ AssertEquals("Subset join", "is.a",
+ String.Join(".", chunks, 1, 2));
+ AssertEquals("Subset join", "is a test",
+ String.Join(" ", chunks, 1, 3));
+
+ errorThrown = false;
+ try {
+ string s = String.Join(" ", chunks, 2, 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+ }
+
+ public void TestLastIndexOf() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.LastIndexOf('q', -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf('q', -1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf("huh", s1.Length + 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf("huh", s1.Length + 1, 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ AssertEquals("basic char index", 1, s1.LastIndexOf('r'));
+ AssertEquals("basic char index", 4, s1.LastIndexOf('i'));
+ AssertEquals("basic char index - no", -1, s1.LastIndexOf('q'));
+
+ AssertEquals("basic string index", 1, s1.LastIndexOf("rig"));
+ AssertEquals("basic string index", 4, s1.LastIndexOf("i"));
+ AssertEquals("basic string index - no", -1,
+ s1.LastIndexOf("rag"));
+
+
+
+ AssertEquals("stepped char index", 1,
+ s1.LastIndexOf('r', s1.Length-1));
+ AssertEquals("stepped char index", 4,
+ s1.LastIndexOf('i', s1.Length-1));
+ AssertEquals("stepped char index", 2,
+ s1.LastIndexOf('i', 3));
+ AssertEquals("stepped char index", -1,
+ s1.LastIndexOf('i', 1));
+
+ AssertEquals("stepped limited char index",
+ 1, s1.LastIndexOf('r', 1, 1));
+ AssertEquals("stepped limited char index",
+ -1, s1.LastIndexOf('r', 0, 1));
+ AssertEquals("stepped limited char index",
+ 4, s1.LastIndexOf('i', 6, 3));
+ AssertEquals("stepped limited char index",
+ 2, s1.LastIndexOf('i', 3, 3));
+ AssertEquals("stepped limited char index",
+ -1, s1.LastIndexOf('i', 1, 2));
+
+ s1 = "original original";
+ AssertEquals("stepped string index #1",
+ 9, s1.LastIndexOf("original", s1.Length));
+ AssertEquals("stepped string index #2",
+ 0, s1.LastIndexOf("original", s1.Length-2));
+ AssertEquals("stepped string index #3",
+ -1, s1.LastIndexOf("original", s1.Length-11));
+ AssertEquals("stepped string index #4",
+ -1, s1.LastIndexOf("translator", 2));
+ AssertEquals("stepped limited string index #1",
+ 10, s1.LastIndexOf("rig", s1.Length-1, 10));
+ AssertEquals("stepped limited string index #2",
+ -1, s1.LastIndexOf("rig", s1.Length, 3));
+ AssertEquals("stepped limited string index #3",
+ 10, s1.LastIndexOf("rig", s1.Length-2, 15));
+ AssertEquals("stepped limited string index #4",
+ -1, s1.LastIndexOf("rig", s1.Length-2, 3));
+ }
+
+ public void TestLastIndexOfAny() {
+ string s1 = ".bcdefghijklm";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(null, s1.Length);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(null, s1.Length, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ char[] c1 = {'a', 'e', 'i', 'o', 'u'};
+ AssertEquals("first vowel", 8, s1.LastIndexOfAny(c1));
+ AssertEquals("second vowel", 4, s1.LastIndexOfAny(c1, 7));
+ AssertEquals("out of vowels", -1, s1.LastIndexOfAny(c1, 3));
+ AssertEquals("second vowel in range",
+ 4, s1.LastIndexOfAny(c1, s1.Length-6, 4));
+ AssertEquals("second vowel out of range",
+ -1, s1.LastIndexOfAny(c1, s1.Length-6, 3));
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(c1, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(c1, -1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+ }
+
+ public void TestPadLeft() {
+ string s1 = "Hi!";
+
+ bool errorThrown = false;
+ try {
+ string s = s1.PadLeft(-1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("Bad argument error", errorThrown);
+
+ AssertEquals("Too little padding",
+ s1, s1.PadLeft(s1.Length-1));
+ AssertEquals("Some padding",
+ " Hi!", s1.PadLeft(5));
+ }
+
+ public void TestPadRight() {
+ string s1 = "Hi!";
+
+ bool errorThrown = false;
+ try {
+ string s = s1.PadRight(-1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("Bad argument error", errorThrown);
+
+ AssertEquals("Too little padding",
+ s1, s1.PadRight(s1.Length-1));
+ AssertEquals("Some padding",
+ "Hi! ", s1.PadRight(5));
+ }
+
+ public void TestRemove() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ s1.Remove(-1,1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+ errorThrown = false;
+ try {
+ s1.Remove(1,-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+ errorThrown = false;
+ try {
+ s1.Remove(s1.Length,s1.Length);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+
+ AssertEquals("basic remove", "oinal",
+ s1.Remove(1, 3));
+ }
+
+ public void TestReplace() {
+ string s1 = "original";
+
+ AssertEquals("non-hit char", s1, s1.Replace('q','s'));
+ AssertEquals("single char", "oxiginal", s1.Replace('r', 'x'));
+ AssertEquals("double char", "orxgxnal", s1.Replace('i', 'x'));
+
+ bool errorThrown = false;
+ try {
+ string s = s1.Replace(null, "feh");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("should get null arg exception", errorThrown);
+
+ AssertEquals("replace as remove", "ornal",
+ s1.Replace("igi", null));
+ AssertEquals("non-hit string", s1, s1.Replace("spam", "eggs"));
+ AssertEquals("single string", "orirumal",
+ s1.Replace("gin", "rum"));
+ AssertEquals("double string", "oreigeinal",
+ s1.Replace("i", "ei"));
+
+ AssertEquals ("result longer", ":!:", "::".Replace ("::", ":!:"));
+ }
+
+ public void TestSplit() {
+ string s1 = "abcdefghijklm";
+ char[] c1 = {'q', 'r'};
+ AssertEquals("No splitters", s1, (s1.Split(c1))[0]);
+
+ char[] c2 = {'a', 'e', 'i', 'o', 'u'};
+ string[] chunks = s1.Split(c2);
+ AssertEquals("First chunk", "", chunks[0]);
+ AssertEquals("Second chunk", "bcd", chunks[1]);
+ AssertEquals("Third chunk", "fgh", chunks[2]);
+ AssertEquals("Fourth chunk", "jklm", chunks[3]);
+
+ {
+ bool errorThrown = false;
+ try {
+ chunks = s1.Split(c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Split out of range", errorThrown);
+ }
+
+ chunks = s1.Split(c2, 2);
+ AssertEquals("Limited chunk", 2, chunks.Length);
+ AssertEquals("First limited chunk", "", chunks[0]);
+ AssertEquals("Second limited chunk", "bcdefghijklm", chunks[1]);
+
+ string s3 = "1.0";
+ char[] c3 = {'.'};
+ chunks = s3.Split(c3,2);
+ AssertEquals("1.0 split length", 2, chunks.Length);
+ AssertEquals("1.0 split first chunk", "1", chunks[0]);
+ AssertEquals("1.0 split second chunk", "0", chunks[1]);
+
+ string s4 = "1.0.0";
+ char[] c4 = {'.'};
+ chunks = s4.Split(c4,2);
+ AssertEquals("1.0.0 split length", 2, chunks.Length);
+ AssertEquals("1.0.0 split first chunk", "1", chunks[0]);
+ AssertEquals("1.0.0 split second chunk", "0.0", chunks[1]);
+
+ string s5 = ".0.0";
+ char[] c5 = {'.'};
+ chunks = s5.Split (c5, 2);
+ AssertEquals(".0.0 split length", 2, chunks.Length);
+ AssertEquals(".0.0 split first chunk", "", chunks[0]);
+ AssertEquals(".0.0 split second chunk", "0.0", chunks[1]);
+
+ string s6 = ".0";
+ char[] c6 = {'.'};
+ chunks = s6.Split (c6, 2);
+ AssertEquals(".0 split length", 2, chunks.Length);
+ AssertEquals(".0 split first chunk", "", chunks[0]);
+ AssertEquals(".0 split second chunk", "0", chunks[1]);
+
+ string s7 = "0.";
+ char[] c7 = {'.'};
+ chunks = s7.Split (c7, 2);
+ AssertEquals("0. split length", 2, chunks.Length);
+ AssertEquals("0. split first chunk", "0", chunks[0]);
+ AssertEquals("0. split second chunk", "", chunks[1]);
+
+ string s8 = "0.0000";
+ char[] c8 = {'.'};
+ chunks = s8.Split (c8, 2);
+ AssertEquals("0.0000/2 split length", 2, chunks.Length);
+ AssertEquals("0.0000/2 split first chunk", "0", chunks[0]);
+ AssertEquals("0.0000/2 split second chunk", "0000", chunks[1]);
+
+ chunks = s8.Split (c8, 3);
+ AssertEquals("0.0000/3 split length", 2, chunks.Length);
+ AssertEquals("0.0000/3 split first chunk", "0", chunks[0]);
+ AssertEquals("0.0000/3 split second chunk", "0000", chunks[1]);
+
+ chunks = s8.Split (c8, 1);
+ AssertEquals("0.0000/1 split length", 1, chunks.Length);
+ AssertEquals("0.0000/1 split first chunk", "0.0000", chunks[0]);
+
+ chunks = s1.Split(c2, 1);
+ AssertEquals("Single split", 1, chunks.Length);
+ AssertEquals("Single chunk", s1, chunks[0]);
+
+ chunks = s1.Split(c2, 0);
+ AssertEquals("Zero split", 0, chunks.Length);
+ }
+
+ public void TestStartsWith() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ bool huh = s1.StartsWith(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null StartsWith shouldn't be good", errorThrown);
+
+ Assert("should match", s1.StartsWith("o"));
+ Assert("should match 2", s1.StartsWith("orig"));
+ Assert("should fail", !s1.StartsWith("rig"));
+ }
+
+ public void TestSubstring() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ string s = s1.Substring(s1.Length+1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+
+ errorThrown = false;
+ try {
+ string s = s1.Substring(1, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(-1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(s1.Length, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(1, s1.Length);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+
+ AssertEquals("basic substring", "inal",
+ s1.Substring(4));
+ AssertEquals("midstring", "igin",
+ s1.Substring(2, 4));
+ AssertEquals("at end", "",
+ s1.Substring(s1.Length, 0));
+ }
+
+ public void TestToCharArray() {
+ string s1 = "original";
+ char[] c1 = s1.ToCharArray();
+ AssertEquals("right array size", s1.Length, c1.Length);
+ AssertEquals("basic char array", s1,
+ new String(c1));
+
+ bool errorThrown = false;
+ try {
+ s1.ToCharArray(s1.Length, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ s1.ToCharArray(1, s1.Length);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ s1.ToCharArray(-1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ s1.ToCharArray(1, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+
+ c1 = s1.ToCharArray(0, 3);
+ AssertEquals("Starting char array", "ori", new String(c1));
+ }
+
+ public void TestToLower() {
+ string s1 = "OrIgInAl";
+ AssertEquals("lowercase failed", "original", s1.ToLower());
+
+ // TODO - Again, with CultureInfo
+ }
+
+ public void TestToString() {
+ string s1 = "original";
+ AssertEquals("ToString failed!", s1, s1.ToString());
+ }
+
+ public void TestToUpper() {
+ string s1 = "OrIgInAl";
+ AssertEquals("uppercase failed", "ORIGINAL", s1.ToUpper());
+
+ // TODO - Again, with CultureInfo
+ }
+
+ public void TestTrim() {
+ string s1 = " original\t\n";
+ AssertEquals("basic trim failed", "original", s1.Trim());
+ AssertEquals("basic trim failed", "original", s1.Trim(null));
+
+ s1 = "original";
+ AssertEquals("basic trim failed", "original", s1.Trim());
+ AssertEquals("basic trim failed", "original", s1.Trim(null));
+
+ s1 = " \t \n ";
+ AssertEquals("empty trim failed", "", s1.Trim());
+ AssertEquals("empty trim failed", "", s1.Trim(null));
+
+ s1 = "aaaoriginalbbb";
+ char[] delims = {'a', 'b'};
+ AssertEquals("custom trim failed",
+ "original", s1.Trim(delims));
+ }
+
+ public void TestTrimEnd() {
+ string s1 = " original\t\n";
+ AssertEquals("basic TrimEnd failed",
+ " original", s1.TrimEnd(null));
+
+ s1 = " original";
+ AssertEquals("basic TrimEnd failed",
+ " original", s1.TrimEnd(null));
+
+ s1 = " \t \n \n ";
+ AssertEquals("empty TrimEnd failed",
+ "", s1.TrimEnd(null));
+
+ s1 = "aaaoriginalbbb";
+ char[] delims = {'a', 'b'};
+ AssertEquals("custom TrimEnd failed",
+ "aaaoriginal", s1.TrimEnd(delims));
+ }
+
+ public void TestTrimStart() {
+ string s1 = " original\t\n";
+ AssertEquals("basic TrimStart failed",
+ "original\t\n", s1.TrimStart(null));
+
+ s1 = "original\t\n";
+ AssertEquals("basic TrimStart failed",
+ "original\t\n", s1.TrimStart(null));
+
+ s1 = " \t \n \n ";
+ AssertEquals("empty TrimStart failed",
+ "", s1.TrimStart(null));
+
+ s1 = "aaaoriginalbbb";
+ char[] delims = {'a', 'b'};
+ AssertEquals("custom TrimStart failed",
+ "originalbbb", s1.TrimStart(delims));
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/TimeSpanTest.cs b/mcs/class/corlib/Test/System/TimeSpanTest.cs
new file mode 100755
index 00000000000..0383e9b2b3f
--- /dev/null
+++ b/mcs/class/corlib/Test/System/TimeSpanTest.cs
@@ -0,0 +1,258 @@
+//
+// TimeSpanTest.cs - NUnit Test Cases for the System.TimeSpan struct
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2001 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class TimeSpanTest : TestCase
+{
+ public TimeSpanTest() {}
+
+ public void TestCtors ()
+ {
+ TimeSpan t1 = new TimeSpan (1234567890);
+
+ AssertEquals ("A1", "00:02:03.4567890", t1.ToString ());
+ t1 = new TimeSpan (1,2,3);
+ AssertEquals ("A2", "01:02:03", t1.ToString ());
+ t1 = new TimeSpan (1,2,3,4);
+ AssertEquals ("A3", "1.02:03:04", t1.ToString ());
+ t1 = new TimeSpan (1,2,3,4,5);
+ AssertEquals ("A4", "1.02:03:04.0050000", t1.ToString ());
+ t1 = new TimeSpan (-1,2,-3,4,-5);
+ AssertEquals ("A5", "-22:02:56.0050000", t1.ToString ());
+ t1 = new TimeSpan (0,25,0,0,0);
+ AssertEquals ("A6", "1.01:00:00", t1.ToString ());
+ }
+
+ public void TestProperties ()
+ {
+ TimeSpan t1 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t2 = -t1;
+
+ AssertEquals ("A1", 1, t1.Days);
+ AssertEquals ("A2", 2, t1.Hours);
+ AssertEquals ("A3", 3, t1.Minutes);
+ AssertEquals ("A4", 4, t1.Seconds);
+ AssertEquals ("A5", 5, t1.Milliseconds);
+ AssertEquals ("A6", -1, t2.Days);
+ AssertEquals ("A7", -2, t2.Hours);
+ AssertEquals ("A8", -3, t2.Minutes);
+ AssertEquals ("A9", -4, t2.Seconds);
+ AssertEquals ("A10", -5, t2.Milliseconds);
+ }
+
+ public void TestAdd ()
+ {
+ TimeSpan t1 = new TimeSpan (2,3,4,5,6);
+ TimeSpan t2 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t3 = t1 + t2;
+ TimeSpan t4 = t1.Add (t2);
+ TimeSpan t5;
+ bool exception;
+
+ AssertEquals ("A1", 3, t3.Days);
+ AssertEquals ("A2", 5, t3.Hours);
+ AssertEquals ("A3", 7, t3.Minutes);
+ AssertEquals ("A4", 9, t3.Seconds);
+ AssertEquals ("A5", 11, t3.Milliseconds);
+ AssertEquals ("A6", "3.05:07:09.0110000", t4.ToString ());
+ try
+ {
+ t5 = TimeSpan.MaxValue + new TimeSpan (1);
+ exception = false;
+ }
+ catch (OverflowException)
+ {
+ exception = true;
+ }
+ Assert ("A7", exception);
+ }
+
+ public void TestCompare ()
+ {
+ TimeSpan t1 = new TimeSpan (-1);
+ TimeSpan t2 = new TimeSpan (1);
+ int res;
+ bool exception;
+
+ AssertEquals ("A1", -1, TimeSpan.Compare (t1, t2));
+ AssertEquals ("A2", 1, TimeSpan.Compare (t2, t1));
+ AssertEquals ("A3", 0, TimeSpan.Compare (t2, t2));
+ AssertEquals ("A4", -1, TimeSpan.Compare (TimeSpan.MinValue, TimeSpan.MaxValue));
+ AssertEquals ("A5", -1, t1.CompareTo (t2));
+ AssertEquals ("A6", 1, t2.CompareTo (t1));
+ AssertEquals ("A7", 0, t2.CompareTo (t2));
+ AssertEquals ("A8", -1, TimeSpan.Compare (TimeSpan.MinValue, TimeSpan.MaxValue));
+
+ AssertEquals ("A9", 1, TimeSpan.Zero.CompareTo (null));
+
+ try
+ {
+ res = TimeSpan.Zero.CompareTo("");
+ exception = false;
+ }
+ catch (ArgumentException)
+ {
+ exception = true;
+ }
+ Assert ("A10", exception);
+
+ AssertEquals ("A11", false, t1 == t2);
+ AssertEquals ("A12", false, t1 > t2);
+ AssertEquals ("A13", false, t1 >= t2);
+ AssertEquals ("A14", true, t1 != t2);
+ AssertEquals ("A15", true, t1 < t2);
+ AssertEquals ("A16", true, t1 <= t2);
+ }
+
+ public void TestNegateAndDuration ()
+ {
+ TimeSpan t1;
+ bool exception;
+
+ AssertEquals ("A1", "-00:00:00.0012345", new TimeSpan (12345).Negate ().ToString ());
+ AssertEquals ("A2", "00:00:00.0012345", new TimeSpan (-12345).Duration ().ToString ());
+
+ try
+ {
+ t1 = TimeSpan.MinValue.Negate ();
+ exception = false;
+ }
+ catch (OverflowException)
+ {
+ exception = true;
+ }
+ Assert ("A3", exception);
+
+ try
+ {
+ t1 = TimeSpan.MinValue.Duration ();
+ exception = false;
+ }
+ catch (OverflowException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ AssertEquals ("A5", "-00:00:00.0000077", (-(new TimeSpan (77))).ToString ());
+ AssertEquals("A6", "00:00:00.0000077", (+(new TimeSpan(77))).ToString());
+ }
+
+ public void TestEquals ()
+ {
+ TimeSpan t1 = new TimeSpan (1);
+ TimeSpan t2 = new TimeSpan (2);
+ string s = "justastring";
+
+ AssertEquals ("A1", true, t1.Equals (t1));
+ AssertEquals ("A2", false, t1.Equals (t2));
+ AssertEquals ("A3", false, t1.Equals (s));
+ AssertEquals ("A4", false, t1.Equals (null));
+ AssertEquals ("A5", true, TimeSpan.Equals (t1, t1));
+ AssertEquals ("A6", false, TimeSpan.Equals (t1, t2));
+ AssertEquals ("A7", false, TimeSpan.Equals (t1, null));
+ AssertEquals ("A8", false, TimeSpan.Equals (t1, s));
+ AssertEquals ("A9", false, TimeSpan.Equals (s, t2));
+ AssertEquals ("A10", true, TimeSpan.Equals (null,null));
+ }
+
+ public void TestFromXXXX ()
+ {
+ AssertEquals ("A1", "12.08:16:48", TimeSpan.FromDays (12.345).ToString ());
+ AssertEquals ("A2", "12:20:42", TimeSpan.FromHours (12.345).ToString ());
+ AssertEquals ("A3", "00:12:20.7000000", TimeSpan.FromMinutes (12.345).ToString ());
+ AssertEquals ("A4", "00:00:12.3450000", TimeSpan.FromSeconds (12.345).ToString ());
+ AssertEquals ("A5", "00:00:00.0120000", TimeSpan.FromMilliseconds (12.345).ToString ());
+ AssertEquals ("A6", "00:00:00.0012345", TimeSpan.FromTicks (12345).ToString ());
+ }
+
+ public void TestGetHashCode ()
+ {
+ AssertEquals ("A1", 77, new TimeSpan (77).GetHashCode ());
+ }
+
+ private void ParseHelper (string s, bool expectFormat, bool expectOverflow, string expect)
+ {
+ bool formatException = false;
+ bool overflowException = false;
+ string result = "junk ";
+
+ try {
+ result = TimeSpan.Parse (s).ToString ();
+ }
+ catch (OverflowException) {
+ overflowException = true;
+ }
+ catch (FormatException) {
+ formatException = true;
+ }
+ AssertEquals ("A1", expectFormat, formatException);
+ AssertEquals ("A2", expectOverflow, overflowException);
+
+ if (!expectOverflow && !expectFormat) {
+ AssertEquals ("A3", expect, result);
+ }
+ }
+
+ public void TestParse ()
+ {
+ ParseHelper (" 13:45:15 ",false, false, "13:45:15");
+ ParseHelper (" -1:2:3 ", false, false, "-01:02:03");
+
+ ParseHelper (" 25:0:0 ",false, true, "dontcare");
+ ParseHelper ("aaa", true, false, "dontcare");
+
+ ParseHelper ("-21.23:59:59.9999999", false, false, "-21.23:59:59.9999999");
+
+ ParseHelper ("100000000000000.1:1:1", false, true, "dontcare");
+ ParseHelper ("24:60:60", false, true, "dontcare");
+ ParseHelper ("0001:0002:0003.12 ", false, false, "01:02:03.1200000");
+
+ ParseHelper (" 1:2:3:12345678 ", true, false, "dontcare");
+ }
+
+ public void TestSubstract ()
+ {
+ TimeSpan t1 = new TimeSpan (2,3,4,5,6);
+ TimeSpan t2 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t3 = t1 - t2;
+ TimeSpan t4 = t1.Subtract (t2);
+ TimeSpan t5;
+ bool exception;
+
+ AssertEquals ("A1", "1.01:01:01.0010000", t3.ToString ());
+ AssertEquals ("A2", "1.01:01:01.0010000", t4.ToString ());
+ try {
+ t5 = TimeSpan.MinValue - new TimeSpan (1);
+ exception = false;
+ }
+ catch (OverflowException) {
+ exception = true;
+ }
+ Assert ("A3", exception);
+ }
+
+ public void TestToString ()
+ {
+ TimeSpan t1 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t2 = -t1;
+
+ AssertEquals ("A1", "1.02:03:04.0050000", t1.ToString ());
+ AssertEquals ("A2", "-1.02:03:04.0050000", t2.ToString ());
+ AssertEquals ("A3", "10675199.02:48:05.4775807", TimeSpan.MaxValue.ToString ());
+ AssertEquals ("A4", "-10675199.02:48:05.4775808", TimeSpan.MinValue.ToString ());
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/TimeZoneTest.cs b/mcs/class/corlib/Test/System/TimeZoneTest.cs
new file mode 100644
index 00000000000..c512966cb3b
--- /dev/null
+++ b/mcs/class/corlib/Test/System/TimeZoneTest.cs
@@ -0,0 +1,66 @@
+//
+// TimeZoneTest.cs - NUnit Test Cases for the System.TimeZone struct
+//
+// author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Martin Baulig
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class TimeZoneTest : TestCase
+{
+ private CultureInfo oldcult;
+
+ public TimeZoneTest() {}
+
+ protected override void SetUp ()
+ {
+ oldcult = Thread.CurrentThread.CurrentCulture;
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
+
+ }
+
+ protected override void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = oldcult;
+ }
+
+ public void TestCtors ()
+ {
+ TimeZone t1 = TimeZone.CurrentTimeZone;
+ AssertEquals("A01", "CET", t1.StandardName);
+ AssertEquals("A02", "CEST", t1.DaylightName);
+
+ DaylightTime d1 = t1.GetDaylightChanges (2002);
+ AssertEquals("A03", "03/31/2002 01:00:00", d1.Start.ToString ("G"));
+ AssertEquals("A04", "10/27/2002 01:00:00", d1.End.ToString ("G"));
+ AssertEquals("A05", 36000000000L, d1.Delta.Ticks);
+
+ DaylightTime d2 = t1.GetDaylightChanges (1996);
+ AssertEquals("A06", "03/31/1996 01:00:00", d2.Start.ToString ("G"));
+ AssertEquals("A07", "10/27/1996 01:00:00", d2.End.ToString ("G"));
+ AssertEquals("A08", 36000000000L, d2.Delta.Ticks);
+
+ DateTime d3 = new DateTime (2002,2,25);
+ AssertEquals("A09", false, t1.IsDaylightSavingTime (d3));
+ DateTime d4 = new DateTime (2002,4,2);
+ AssertEquals("A10", true, t1.IsDaylightSavingTime (d4));
+ DateTime d5 = new DateTime (2002,11,4);
+ AssertEquals("A11", false, t1.IsDaylightSavingTime (d5));
+
+ AssertEquals("A12", 36000000000L, t1.GetUtcOffset (d3).Ticks);
+ AssertEquals("A13", 72000000000L, t1.GetUtcOffset (d4).Ticks);
+ AssertEquals("A14", 36000000000L, t1.GetUtcOffset (d5).Ticks);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/UInt16Test.cs b/mcs/class/corlib/Test/System/UInt16Test.cs
new file mode 100644
index 00000000000..bea67cd7c7c
--- /dev/null
+++ b/mcs/class/corlib/Test/System/UInt16Test.cs
@@ -0,0 +1,187 @@
+// UInt16Test.cs - NUnit Test Cases for the System.UInt16 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class UInt16Test : TestCase
+{
+ private const UInt16 MyUInt16_1 = 42;
+ private const UInt16 MyUInt16_2 = 0;
+ private const UInt16 MyUInt16_3 = 65535;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "65535";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {null,
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {null,
+ "65535", "6.55350e+004", "65535.00000",
+ "65535", "65,535.00000", "6,553,500.00000 %", "0ffff"};
+ private string[] ResultsNfi1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"65,535.00000",
+ "65535", "6.55350e+004", "65535.00000",
+ "65535", "65,535.00000", "6,553,500.00000 %", "0ffff"};
+
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public UInt16Test() {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ Results1 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"0.00";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"65,535.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(UInt16.MinValue, MyUInt16_2);
+ AssertEquals(UInt16.MaxValue, MyUInt16_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyUInt16_3.CompareTo(MyUInt16_2) > 0);
+ Assert(MyUInt16_2.CompareTo(MyUInt16_2) == 0);
+ Assert(MyUInt16_1.CompareTo((UInt16)(42)) == 0);
+ Assert(MyUInt16_2.CompareTo(MyUInt16_3) < 0);
+ try {
+ MyUInt16_2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyUInt16_1.Equals(MyUInt16_1));
+ Assert(MyUInt16_1.Equals((UInt16)(42)));
+ Assert(MyUInt16_1.Equals((SByte)(42)) == false);
+ Assert(MyUInt16_1.Equals(MyUInt16_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyUInt16_1.GetHashCode();
+ MyUInt16_2.GetHashCode();
+ MyUInt16_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MyUInt16_1 == UInt16.Parse(MyString1));
+ Assert(MyUInt16_2 == UInt16.Parse(MyString2));
+ Assert(MyUInt16_3 == UInt16.Parse(MyString3));
+ try {
+ UInt16.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ UInt16.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = UInt16.MaxValue + 1;
+ UInt16.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ Assert(42 == UInt16.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ UInt16.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(42 == UInt16.Parse(" 42 ", Nfi));
+ try {
+ UInt16.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == UInt16.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ UInt16.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals("A1", MyString1, MyUInt16_1.ToString());
+ AssertEquals("A2", MyString2, MyUInt16_2.ToString());
+ AssertEquals("A3", MyString3, MyUInt16_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("A4:"+i.ToString(), Results1[i], MyUInt16_2.ToString(Formats1[i]));
+ AssertEquals("A5:"+i.ToString(), Results2[i], MyUInt16_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("A6:"+i.ToString(), ResultsNfi1[i], MyUInt16_2.ToString(Formats1[i], Nfi));
+ AssertEquals("A7:"+i.ToString(), ResultsNfi2[i], MyUInt16_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyUInt16_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("A8", typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+
+}
diff --git a/mcs/class/corlib/Test/System/UInt32Test.cs b/mcs/class/corlib/Test/System/UInt32Test.cs
new file mode 100644
index 00000000000..a9ce9cd35a6
--- /dev/null
+++ b/mcs/class/corlib/Test/System/UInt32Test.cs
@@ -0,0 +1,229 @@
+// UInt32Test.cs - NUnit Test Cases for the System.UInt32 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System
+{
+
+public class UInt32Test : TestCase
+{
+ private const UInt32 MyUInt32_1 = 42;
+ private const UInt32 MyUInt32_2 = 0;
+ private const UInt32 MyUInt32_3 = 4294967295;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "4294967295";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {"",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] ResultsNfi1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {"",
+ "4294967295", "4.29497e+009", "4294967295.00000",
+ "4.295e+09", "4,294,967,295.00000", "429,496,729,500.00000 %", "ffffffff"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"4,294,967,295.00000",
+ "4294967295", "4.29497e+009", "4294967295.00000",
+ "4.295e+09", "4,294,967,295.00000", "429,496,729,500.00000 %", "ffffffff"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public UInt32Test() {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ // We can't initialize this until we set the culture.
+ Results1 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"0.00";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"4,294,967,295.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(UInt32.MinValue, MyUInt32_2);
+ AssertEquals(UInt32.MaxValue, MyUInt32_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyUInt32_3.CompareTo(MyUInt32_2) > 0);
+ Assert(MyUInt32_2.CompareTo(MyUInt32_2) == 0);
+ Assert(MyUInt32_1.CompareTo((UInt32)(42)) == 0);
+ Assert(MyUInt32_2.CompareTo(MyUInt32_3) < 0);
+ Assert (1 == UInt32.Parse ("1"));
+ Assert (1 == UInt32.Parse (" 1"));
+ Assert (1 == UInt32.Parse (" 1"));
+ Assert (1 == UInt32.Parse ("1 "));
+ Assert (1 == UInt32.Parse ("+1"));
+
+ try {
+ UInt32.Parse (" + 1 ");
+ Fail ("Should raise FormatException1");
+ } catch (Exception e){
+ Assert (typeof (FormatException) == e.GetType ());
+ }
+
+ try {
+ UInt32.Parse (" + ");
+ Fail ("Should raise FormatException");
+ } catch (Exception e){
+ Assert (typeof (FormatException) == e.GetType ());
+ }
+ try {
+ MyUInt32_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyUInt32_1.Equals(MyUInt32_1));
+ Assert(MyUInt32_1.Equals((UInt32)(42)));
+ Assert(MyUInt32_1.Equals((SByte)(42)) == false);
+ Assert(MyUInt32_1.Equals(MyUInt32_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyUInt32_1.GetHashCode();
+ MyUInt32_2.GetHashCode();
+ MyUInt32_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert("Parse problem on \""+MyString1+"\"", MyUInt32_1 == UInt32.Parse(MyString1));
+ Assert("Parse problem on \""+MyString2+"\"", MyUInt32_2 == UInt32.Parse(MyString2));
+ Assert("Parse problem on \""+MyString3+"\"", MyUInt32_3 == UInt32.Parse(MyString3));
+ try {
+ UInt32.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Did not get ArgumentNullException type", typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ UInt32.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("Did not get FormatException type", typeof(FormatException) == e.GetType());
+ }
+ try {
+ // TODO: Use this after ToString() is completed. For now, hard code string that generates
+ // exception.
+ //double OverInt = (double)UInt32.MaxValue + 1;
+ //UInt32.Parse(OverInt.ToString());
+ UInt32.Parse("4294967296");
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert("Did not get OverflowException type on '"+"4294967296"+"'. Instead, got: '"+e.GetType()+"'", typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ Assert(42 == UInt32.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ UInt32.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(42 == UInt32.Parse(" 42 ", Nfi));
+ try {
+ UInt32.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == UInt32.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ UInt32.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ int TestNumber = 1;
+ try {
+ //test ToString()
+ AssertEquals(MyString1, MyUInt32_1.ToString());
+ TestNumber++;
+ AssertEquals(MyString2, MyUInt32_2.ToString());
+ TestNumber++;
+ AssertEquals(MyString3, MyUInt32_3.ToString());
+ } catch (Exception e) {
+ Fail("TestToString: Failed on TestNumber=" + TestNumber
+ + " with exception: " + e.ToString());
+ }
+
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ try {
+ AssertEquals(Results1[i], MyUInt32_2.ToString(Formats1[i]));
+ } catch (Exception e) {
+ Fail("TestToString: MyUInt32_2.ToString(Formats1[i]) i=" + i
+ + ". e = " + e.ToString());
+ }
+
+ try {
+ AssertEquals(Results2[i], MyUInt32_3.ToString(Formats2[i]));
+ } catch (Exception e) {
+ Fail("TestToString: MyUInt32_3.ToString(Formats2[i]) i=" + i
+ + ". e = " + e.ToString());
+ }
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(ResultsNfi1[i], MyUInt32_2.ToString(Formats1[i], Nfi));
+ AssertEquals(ResultsNfi2[i], MyUInt32_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyUInt32_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+
+}
diff --git a/mcs/class/corlib/Test/System/UInt64Test.cs b/mcs/class/corlib/Test/System/UInt64Test.cs
new file mode 100644
index 00000000000..c524b7f7973
--- /dev/null
+++ b/mcs/class/corlib/Test/System/UInt64Test.cs
@@ -0,0 +1,197 @@
+// UInt64Test.cs - NUnit Test Cases for the System.UInt64 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System
+{
+
+public class UInt64Test : TestCase
+{
+ private const UInt64 MyUInt64_1 = 42;
+ private const UInt64 MyUInt64_2 = 0;
+ private const UInt64 MyUInt64_3 = 18446744073709551615;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "18446744073709551615";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {"",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] ResultsNfi1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {"",
+ "18446744073709551615", "1.84467e+019", "18446744073709551615.00000",
+ "1.8447e+19", "18,446,744,073,709,551,615.00000",
+ "1,844,674,407,370,955,161,500.00000 %", "ffffffffffffffff"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"18,446,744,073,709,551,615.00000",
+ "18446744073709551615", "1.84467e+019", "18446744073709551615.00000",
+ "1.8447e+19", "18,446,744,073,709,551,615.00000",
+ "1,844,674,407,370,955,161,500.00000 %", "ffffffffffffffff"};
+
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public UInt64Test() {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ // We can't initialize this until we set the culture.
+ Results1 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"0.00";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"18,446,744,073,709,551,615.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(UInt64.MinValue, MyUInt64_2);
+ AssertEquals(UInt64.MaxValue, MyUInt64_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyUInt64_3.CompareTo(MyUInt64_2) > 0);
+ Assert(MyUInt64_2.CompareTo(MyUInt64_2) == 0);
+ Assert(MyUInt64_1.CompareTo((UInt64)(42)) == 0);
+ Assert(MyUInt64_2.CompareTo(MyUInt64_3) < 0);
+ try {
+ MyUInt64_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyUInt64_1.Equals(MyUInt64_1));
+ Assert(MyUInt64_1.Equals((UInt64)(42)));
+ Assert(MyUInt64_1.Equals((SByte)(42)) == false);
+ Assert(MyUInt64_1.Equals(MyUInt64_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyUInt64_1.GetHashCode();
+ MyUInt64_2.GetHashCode();
+ MyUInt64_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MyUInt64_1 == UInt64.Parse(MyString1));
+ Assert(MyUInt64_2 == UInt64.Parse(MyString2));
+ Assert(MyUInt64_3 == UInt64.Parse(MyString3));
+ try {
+ UInt64.Parse(null);
+ Fail("Should raise a ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ UInt64.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ try {
+ double OverInt = (double)UInt64.MaxValue + 1;
+ UInt64.Parse(OverInt.ToString(), NumberStyles.Float);
+ Fail("Should raise a OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ try {
+ double OverInt = (double)UInt64.MaxValue + 1;
+ UInt64.Parse(OverInt.ToString(), NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ Assert(42 == UInt64.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ UInt64.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(42 == UInt64.Parse(" 42 ", Nfi));
+ try {
+ UInt64.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == UInt64.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ UInt64.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals(MyString1, MyUInt64_1.ToString());
+ AssertEquals(MyString2, MyUInt64_2.ToString());
+ AssertEquals(MyString3, MyUInt64_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(Results1[i], MyUInt64_2.ToString(Formats1[i]));
+ AssertEquals(Results2[i], MyUInt64_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(ResultsNfi1[i], MyUInt64_2.ToString(Formats1[i], Nfi));
+ AssertEquals(ResultsNfi2[i], MyUInt64_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyUInt64_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/VersionTest.cs b/mcs/class/corlib/Test/System/VersionTest.cs
new file mode 100644
index 00000000000..635a485cadc
--- /dev/null
+++ b/mcs/class/corlib/Test/System/VersionTest.cs
@@ -0,0 +1,236 @@
+//
+// VersionTest.cs - NUnit Test Cases for the System.Version class
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class VersionTest : TestCase
+{
+ public VersionTest () {}
+
+ public void TestCtors ()
+ {
+ Version v1;
+ bool exception;
+
+ /*
+ v1 = new Version ();
+ AssertEquals ("A1", 0, v1.Major);
+ AssertEquals ("A2", 0, v1.Minor);
+ AssertEquals ("A3", -1, v1.Build);
+ AssertEquals ("A4", -1, v1.Revision);
+ */
+
+ v1 = new Version (23, 7);
+ AssertEquals ("A5", 23, v1.Major);
+ AssertEquals ("A6", 7, v1.Minor);
+ AssertEquals ("A7", -1, v1.Build);
+ AssertEquals ("A8", -1, v1.Revision);
+
+ v1 = new Version (23, 7, 99);
+ AssertEquals ("A9", 23, v1.Major);
+ AssertEquals ("A10", 7, v1.Minor);
+ AssertEquals ("A11", 99, v1.Build);
+ AssertEquals ("A12", -1, v1.Revision);
+
+ v1 = new Version (23, 7, 99, 42);
+ AssertEquals ("A13", 23, v1.Major);
+ AssertEquals ("A14", 7, v1.Minor);
+ AssertEquals ("A15", 99, v1.Build);
+ AssertEquals ("A16", 42, v1.Revision);
+
+ try {
+ v1 = new Version (23, -1);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A17", exception);
+
+ try {
+ v1 = new Version (23, 7, -1);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A18", exception);
+
+ try {
+ v1 = new Version (23, 7, 99, -1);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A19", exception);
+
+ }
+
+ public void TestStringCtor ()
+ {
+ Version v1;
+ bool exception;
+
+ v1 = new Version("1.42.79");
+ AssertEquals ("A1", 1, v1.Major);
+ AssertEquals ("A2", 42, v1.Minor);
+ AssertEquals ("A3", 79, v1.Build);
+ AssertEquals ("A4", -1, v1.Revision);
+
+
+ try {
+ v1 = new Version ("1.42.-79");
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+
+ try {
+ v1 = new Version ("1");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A6", exception);
+
+ try {
+ v1 = new Version ("1.2.3.4.5");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A7", exception);
+
+ try {
+ v1 = new Version ((string) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A6", exception);
+
+
+ }
+
+ public void TestClone ()
+ {
+ Version v1 = new Version (1, 2, 3, 4);
+ Version v2 = (Version) v1.Clone ();
+
+ Assert ("A1", v1.Equals (v2));
+ Assert ("A2", !ReferenceEquals (v1, v2));
+ }
+
+ public void TestCompareTo ()
+ {
+ Assert ("A1", new Version (1, 2).CompareTo (new Version (1, 1)) > 0);
+ Assert ("A2", new Version (1, 2, 3).CompareTo (new Version (2, 2, 3)) < 0);
+ Assert ("A3", new Version (1, 2, 3, 4).CompareTo (new Version (1, 2, 2, 1)) > 0);
+
+ Assert ("A4", new Version (1, 3).CompareTo (new Version (1, 2, 2, 1)) > 0);
+ Assert ("A5", new Version (1, 2, 2).CompareTo (new Version (1, 2, 2, 1)) < 0);
+
+ Assert ("A6", new Version (1, 2).CompareTo (new Version (1, 2)) == 0);
+ Assert ("A7", new Version (1, 2, 3).CompareTo (new Version (1, 2, 3)) == 0);
+
+ Assert ("A8", new Version (1, 1) < new Version (1, 2));
+ Assert ("A9", new Version (1, 2) <= new Version (1, 2));
+ Assert ("A10", new Version (1, 2) <= new Version (1, 3));
+ Assert ("A11", new Version (1, 2) >= new Version (1, 2));
+ Assert ("A12", new Version (1, 3) >= new Version (1, 2));
+ Assert ("A13", new Version (1, 3) > new Version (1, 2));
+
+ Version v1 = new Version(1, 2);
+ bool exception;
+
+ // LAMESPEC: Docs say this should throw a ArgumentNullException,
+ // but it simply works. Seems any version is subsequent to null
+ Assert ("A14:", v1.CompareTo (null) > 0);
+
+ try {
+ v1.CompareTo ("A string is not a version");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A15", exception);
+
+ }
+
+
+ public void TestEquals ()
+ {
+ Version v1 = new Version (1, 2);
+ Version v2 = new Version (1, 2, 3, 4);
+ Version v3 = new Version (1, 2, 3, 4);
+
+ AssertEquals ("A1", true, v2.Equals (v3));
+ AssertEquals ("A2", true, v2.Equals (v2));
+ AssertEquals ("A3", false, v1.Equals (v3));
+
+ AssertEquals ("A4", true, v2 == v3);
+ AssertEquals ("A5", true, v2 == v2);
+ AssertEquals ("A6", false, v1 == v3);
+
+ AssertEquals ("A7", false, v2.Equals ((Version) null));
+ AssertEquals ("A8", false, v2.Equals ("A string"));
+
+ }
+
+ public void TestToString ()
+ {
+ Version v1 = new Version (1,2);
+ Version v2 = new Version (1,2,3);
+ Version v3 = new Version (1,2,3,4);
+
+ AssertEquals ("A1", "1.2", v1.ToString ());
+ AssertEquals ("A2", "1.2.3", v2.ToString ());
+ AssertEquals ("A3", "1.2.3.4", v3.ToString ());
+
+ AssertEquals ("A4", "" , v3.ToString (0));
+ AssertEquals ("A5", "1" , v3.ToString (1));
+ AssertEquals ("A6", "1.2" , v3.ToString (2));
+ AssertEquals ("A7", "1.2.3" , v3.ToString (3));
+ AssertEquals ("A8", "1.2.3.4" , v3.ToString (4));
+
+ bool exception;
+
+ try {
+ v2.ToString (4);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+
+ try {
+ v3.ToString (42);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A10", exception);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/corlib_linux_test.args b/mcs/class/corlib/Test/corlib_linux_test.args
new file mode 100644
index 00000000000..9318de3cfa5
--- /dev/null
+++ b/mcs/class/corlib/Test/corlib_linux_test.args
@@ -0,0 +1,135 @@
+--target library
+-o corlib_linux_test.dll
+--noconfig
+-r ../../lib/corlib.dll
+-r ../../lib/System.dll
+-r ../../../nunit/NUnitCore_mono.dll
+System/AllTests.cs
+System/ArrayTest.cs
+System/AttributeTest.cs
+System/BitConverterTest.cs
+System/BooleanTest.cs
+System/BufferTest.cs
+System/ByteTest.cs
+System/CharEnumeratorTest.cs
+System/CharTest.cs
+System/ConsoleTest.cs
+System/ConvertTest.cs
+System/DateTimeTest.cs
+System/DecimalTest.cs
+System/DecimalTest2.cs
+System/DoubleTest.cs
+System/EnumTest.cs
+System/ExceptionTest.cs
+System/GuidTest.cs
+System/Int16Test.cs
+System/Int32Test.cs
+System/Int64Test.cs
+System/IntegerFormatterTest.cs
+System/MathTest.cs
+System/MulticastDelegate.cs
+System/ObjectTest.cs
+System/RandomTest.cs
+System/ResolveEventArgsTest.cs
+System/SByteTest.cs
+System/StringTest.cs
+System/TimeSpanTest.cs
+System/TimeZoneTest.cs
+System/UInt16Test.cs
+System/UInt32Test.cs
+System/UInt64Test.cs
+System/VersionTest.cs
+AllTests.cs
+System.Collections/AllTests.cs
+System.Collections/ArrayListTest.cs
+System.Collections/BitArrayTest.cs
+System.Collections/CaseInsensitiveComparerTest.cs
+System.Collections/CaseInsensitiveHashCodeProviderTest.cs
+System.Collections/CollectionBaseTest.cs
+System.Collections/ComparerTest.cs
+System.Collections/HashtableTest.cs
+System.Collections/QueueTest.cs
+System.Collections/ReadOnlyCollectionBaseTest.cs
+System.Collections/SortedListTest.cs
+System.Collections/StackTest.cs
+System.Diagnostics/AllTests.cs
+System.Diagnostics/DebugTest.cs
+System.Diagnostics/StackFrameTest.cs
+System.Diagnostics/StackTraceTest.cs
+System.Diagnostics/TextWriterTraceListenerTest.cs
+System.Globalization/AllTests.cs
+System.Globalization/CalendarTest.cs
+System.IO/AllTests.cs
+System.IO/BinaryReaderTest.cs
+System.IO/FileTest.cs
+System.IO/MemoryStreamTest.cs
+System.IO/PathTest.cs
+System.IO/StreamReaderTest.cs
+System.IO/StreamWriterTest.cs
+System.IO/StringReaderTest.cs
+System.IO/StringWriterTest.cs
+System.Resources/AllTests.cs
+System.Resources/ResourceReaderTest.cs
+System.Runtime.CompilerServices/AllTests.cs
+System.Runtime.CompilerServices/RuntimeHelpersTest.cs
+System.Runtime.Serialization/AllTests.cs
+System.Runtime.Serialization/FormatterServicesTests.cs
+System.Runtime.Serialization/ObjectIDGeneratorTests.cs
+System.Security/AllTests.cs
+System.Security/SecurityElementTest.cs
+System.Security.Cryptography/AllTests.cs
+System.Security.Cryptography/AsymmetricAlgorithmTest.cs
+System.Security.Cryptography/CryptoConfigTest.cs
+System.Security.Cryptography/DSACryptoServiceProviderTest.cs
+System.Security.Cryptography/DSASignatureDeformatterTest.cs
+System.Security.Cryptography/DSASignatureFormatterTest.cs
+System.Security.Cryptography/DSATest.cs
+System.Security.Cryptography/FromBase64Transform.cs
+System.Security.Cryptography/HashAlgorithmTest.cs
+System.Security.Cryptography/HMACSHA1Test.cs
+System.Security.Cryptography/KeyedHashAlgorithmTest.cs
+System.Security.Cryptography/MACTripleDESTest.cs
+System.Security.Cryptography/MD5Test.cs
+System.Security.Cryptography/PasswordDeriveBytesTest.cs
+System.Security.Cryptography/PKCS1MaskGenerationMethodTest.cs
+System.Security.Cryptography/RandomNumberGeneratorTest.cs
+System.Security.Cryptography/RC2Test.cs
+System.Security.Cryptography/RijndaelManagedTest.cs
+System.Security.Cryptography/RijndaelTest.cs
+System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
+System.Security.Cryptography/RSATest.cs
+System.Security.Cryptography/RSACryptoServiceProviderTest.cs
+System.Security.Cryptography/RSAOAEPKeyExchangeDeformatterTest.cs
+System.Security.Cryptography/RSAOAEPKeyExchangeFormatterTest.cs
+System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatterTest.cs
+System.Security.Cryptography/RSAPKCS1KeyExchangeFormatterTest.cs
+System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
+System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
+System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs
+System.Security.Cryptography/SHA1Test.cs
+System.Security.Cryptography/SHA256ManagedTest.cs
+System.Security.Cryptography/SHA256Test.cs
+System.Security.Cryptography/SHA384ManagedTest.cs
+System.Security.Cryptography/SHA384Test.cs
+System.Security.Cryptography/SHA512ManagedTest.cs
+System.Security.Cryptography/SHA512Test.cs
+System.Security.Cryptography/SignatureDescriptionTest.cs
+System.Security.Cryptography/SymmetricAlgorithmTest.cs
+System.Security.Permissions/AllTests.cs
+System.Security.Permissions/FileIOPermissionTest.cs
+System.Security.Permissions/StrongNamePublicKeyBlobTest.cs
+System.Security.Policy/AllTests.cs
+System.Security.Policy/CodeGroupTest.cs
+System.Security.Policy/EvidenceTest.cs
+System.Security.Policy/PublisherTest.cs
+System.Security.Policy/PublisherMembershipConditionTest.cs
+System.Security.Policy/StrongNameTest.cs
+System.Text/ASCIIEncodingTest.cs
+System.Text/AllTests.cs
+System.Text/StringBuilderTest.cs
+System.Threading/AllTests.cs
+System.Threading/ThreadTest.cs
+System.Threading/MutexTest.cs
+System.Reflection/AllTests.cs
+System.Reflection/AssemblyNameTest.cs
+System.Reflection/StrongNameKeyPairTest.cs \ No newline at end of file
diff --git a/mcs/class/corlib/Test/corlib_test.args b/mcs/class/corlib/Test/corlib_test.args
new file mode 100755
index 00000000000..8a0975c2d6d
--- /dev/null
+++ b/mcs/class/corlib/Test/corlib_test.args
@@ -0,0 +1,119 @@
+--target library
+-o corlib_test.dll
+--noconfig
+-r ../../lib/corlib.dll
+-r ../../lib/System.dll
+-r ../../../nunit20/NUnit.Framework.dll
+System/ArrayTest.cs
+System/AttributeTest.cs
+System/BitConverterTest.cs
+System/BooleanTest.cs
+System/BufferTest.cs
+System/ByteTest.cs
+System/CharEnumeratorTest.cs
+System/CharTest.cs
+System/ConsoleTest.cs
+System/ConvertTest.cs
+System/DateTimeTest.cs
+System/DecimalTest.cs
+System/DecimalTest2.cs
+System/DoubleTest.cs
+System/EnumTest.cs
+System/ExceptionTest.cs
+System/GuidTest.cs
+System/Int16Test.cs
+System/Int32Test.cs
+System/Int64Test.cs
+System/IntegerFormatterTest.cs
+System/MathTest.cs
+System/MulticastDelegate.cs
+System/ObjectTest.cs
+System/RandomTest.cs
+System/ResolveEventArgsTest.cs
+System/SByteTest.cs
+System/StringTest.cs
+System/TimeSpanTest.cs
+System/TimeZoneTest.cs
+System/UInt16Test.cs
+System/UInt32Test.cs
+System/UInt64Test.cs
+System/VersionTest.cs
+System.Collections/ArrayListTest.cs
+System.Collections/BitArrayTest.cs
+System.Collections/CaseInsensitiveComparerTest.cs
+System.Collections/CaseInsensitiveHashCodeProviderTest.cs
+System.Collections/CollectionBaseTest.cs
+System.Collections/ComparerTest.cs
+System.Collections/HashtableTest.cs
+System.Collections/QueueTest.cs
+System.Collections/ReadOnlyCollectionBaseTest.cs
+System.Collections/SortedListTest.cs
+System.Collections/StackTest.cs
+System.Diagnostics/DebugTest.cs
+System.Diagnostics/StackFrameTest.cs
+System.Diagnostics/StackTraceTest.cs
+System.Diagnostics/TextWriterTraceListenerTest.cs
+System.Globalization/CalendarTest.cs
+System.IO/BinaryReaderTest.cs
+System.IO/FileTest.cs
+System.IO/MemoryStreamTest.cs
+System.IO/PathTest.cs
+System.IO/StreamReaderTest.cs
+System.IO/StreamWriterTest.cs
+System.IO/StringReaderTest.cs
+System.IO/StringWriterTest.cs
+System.Resources/ResourceReaderTest.cs
+System.Runtime.CompilerServices/RuntimeHelpersTest.cs
+System.Runtime.Serialization/FormatterServicesTests.cs
+System.Runtime.Serialization/ObjectIDGeneratorTests.cs
+System.Security/SecurityElementTest.cs
+System.Security.Cryptography/AllTests2.cs
+System.Security.Cryptography/AsymmetricAlgorithmTest.cs
+System.Security.Cryptography/CryptoConfigTest.cs
+System.Security.Cryptography/DSACryptoServiceProviderTest.cs
+System.Security.Cryptography/DSASignatureDeformatterTest.cs
+System.Security.Cryptography/DSASignatureFormatterTest.cs
+System.Security.Cryptography/DSATest.cs
+System.Security.Cryptography/FromBase64Transform.cs
+System.Security.Cryptography/HashAlgorithmTest.cs
+System.Security.Cryptography/HMACSHA1Test.cs
+System.Security.Cryptography/KeyedHashAlgorithmTest.cs
+System.Security.Cryptography/MD5Test.cs
+System.Security.Cryptography/PasswordDeriveBytesTest.cs
+System.Security.Cryptography/PKCS1MaskGenerationMethodTest.cs
+System.Security.Cryptography/RandomNumberGeneratorTest.cs
+System.Security.Cryptography/RC2Test.cs
+System.Security.Cryptography/RijndaelManagedTest.cs
+System.Security.Cryptography/RijndaelTest.cs
+System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
+System.Security.Cryptography/RSATest.cs
+System.Security.Cryptography/RSACryptoServiceProviderTest.cs
+System.Security.Cryptography/RSAOAEPKeyExchangeDeformatterTest.cs
+System.Security.Cryptography/RSAOAEPKeyExchangeFormatterTest.cs
+System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatterTest.cs
+System.Security.Cryptography/RSAPKCS1KeyExchangeFormatterTest.cs
+System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs
+System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
+System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs
+System.Security.Cryptography/SHA1Test.cs
+System.Security.Cryptography/SHA256ManagedTest.cs
+System.Security.Cryptography/SHA256Test.cs
+System.Security.Cryptography/SHA384ManagedTest.cs
+System.Security.Cryptography/SHA384Test.cs
+System.Security.Cryptography/SHA512ManagedTest.cs
+System.Security.Cryptography/SHA512Test.cs
+System.Security.Cryptography/SignatureDescriptionTest.cs
+System.Security.Cryptography/SymmetricAlgorithmTest.cs
+System.Security.Permissions/FileIOPermissionTest.cs
+System.Security.Permissions/StrongNamePublicKeyBlobTest.cs
+System.Security.Policy/CodeGroupTest.cs
+System.Security.Policy/EvidenceTest.cs
+System.Security.Policy/PublisherTest.cs
+System.Security.Policy/PublisherMembershipConditionTest.cs
+System.Security.Policy/StrongNameTest.cs
+System.Text/ASCIIEncodingTest.cs
+System.Text/StringBuilderTest.cs
+System.Threading/ThreadTest.cs
+System.Threading/MutexTest.cs
+System.Reflection/AssemblyNameTest.cs
+System.Reflection/StrongNameKeyPairTest.cs
diff --git a/mcs/class/corlib/Test/corlib_test.build b/mcs/class/corlib/Test/corlib_test.build
new file mode 100644
index 00000000000..a982929e7b1
--- /dev/null
+++ b/mcs/class/corlib/Test/corlib_test.build
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for corlib_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="corlib_test" default="build">
+ <property name="debug" value="true"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="corlib_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="**/AllTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit20">
+ <includes name="NUnit.Framework.dll"/>
+ </references>
+ <arg value="/r:corlib_res.dll"/>
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:618"/>
+ <arg value="/nowarn:672"/>
+ </csc>
+
+ <csc target="library" output="corlib_reference.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="**/AllTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit20">
+ <includes name="NUnit.Framework.dll"/>
+ </references>
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:618"/>
+ <arg value="/nowarn:672"/>
+ </csc>
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit20\nunit-console.exe" commandline="corlib_reference.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="corlib_test.dll" failonerror="false"/>
+ <delete file="corlib_test.pdb" failonerror="false"/>
+ <delete file="corlib_reference.dll" failonerror="false"/>
+ <delete file="corlib_reference.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/corlib/Test/makefile.gnu b/mcs/class/corlib/Test/makefile.gnu
new file mode 100644
index 00000000000..2ede090010e
--- /dev/null
+++ b/mcs/class/corlib/Test/makefile.gnu
@@ -0,0 +1,26 @@
+topdir = ../../..
+
+LIBRARY = corlib_test.dll
+
+LIB_LIST = corlib_test.args
+LIB_FLAGS = \
+ -r $(topdir)/class/lib/corlib.dll \
+ -r $(topdir)/class/lib/System.dll \
+ -r $(topdir)/nunit20/NUnit.Framework.dll
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=_DUMMY_
+
+include $(topdir)/class/library.make
+
+MCS_FLAGS = --target library --noconfig
+
+NUNITCONSOLE=$(topdir)/nunit20/nunit-console.exe
+MONO_PATH = $(topdir)/nunit20:.
+
+test: $(LIBRARY) run_test
+
+.PHONY: run_test
+
+run_test:
+ -MONO_PATH=$(MONO_PATH) mono $(NUNITCONSOLE) corlib_test.dll
diff --git a/mcs/class/corlib/Test/resources/AFile.txt b/mcs/class/corlib/Test/resources/AFile.txt
new file mode 100644
index 00000000000..59072cba2d9
--- /dev/null
+++ b/mcs/class/corlib/Test/resources/AFile.txt
@@ -0,0 +1,39 @@
+//
+// Mono.Tests.AllTests.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(System.AllTests.Suite);
+ suite.AddTest(System.Collections.AllTests.Suite);
+ suite.AddTest(System.Security.AllTests.Suite);
+ suite.AddTest(System.Security.Cryptography.AllTests.Suite);
+ suite.AddTest(System.IO.AllTests.Suite);
+ suite.AddTest(System.Net.AllTests.Suite);
+ suite.AddTest(System.Text.AllTests.Suite);
+ suite.AddTest(System.Security.Permissions.AllTests.Suite);
+ suite.AddTest(System.Resources.AllTests.Suite);
+// suite.AddTest(System.Security.Policy.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/resources/Empty.resources b/mcs/class/corlib/Test/resources/Empty.resources
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/corlib/Test/resources/Empty.resources
diff --git a/mcs/class/corlib/Test/resources/MyResources.resources b/mcs/class/corlib/Test/resources/MyResources.resources
new file mode 100644
index 00000000000..b486e9e5111
--- /dev/null
+++ b/mcs/class/corlib/Test/resources/MyResources.resources
Binary files differ
diff --git a/mcs/class/corlib/Test/run_test.sh b/mcs/class/corlib/Test/run_test.sh
new file mode 100755
index 00000000000..6a24784d8db
--- /dev/null
+++ b/mcs/class/corlib/Test/run_test.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ $# -eq 0 ]; then
+ echo "You should give a list of test names such as: "
+ echo "$0 System.IO.FileTest System.Text.StringBuilderTest"
+ echo "or"
+ echo "$0 System.AllTests"
+ echo "and so on..."
+ exit 1
+fi
+
+topdir=../../..
+NUNITCONSOLE=${topdir}/class/lib/NUnitConsole_mono.exe
+
+for i in $@; do
+ MONO_PATH=../../../class/lib:. \
+ mono ${NUNITCONSOLE} MonoTests.${i},corlib_linux_test.dll
+done
+
diff --git a/mcs/class/corlib/Unix/Errno.cs b/mcs/class/corlib/Unix/Errno.cs
new file mode 100755
index 00000000000..36c3b4bc698
--- /dev/null
+++ b/mcs/class/corlib/Unix/Errno.cs
@@ -0,0 +1,139 @@
+//
+// Errno.cs: used to provide better information
+//
+
+namespace System.Private {
+
+ internal class Errno {
+
+ internal static string Message (int code)
+ {
+ switch (code){
+ case Wrapper.EPERM:
+ return "No permission";
+ case Wrapper.ENOENT:
+ return "The name does not exist";
+ case Wrapper.EISDIR:
+ return "error: Is a directory";
+ case Wrapper.EBADF:
+ return "Bad file descriptor";
+ case Wrapper.ENOMEM:
+ return "Out of memory";
+ case Wrapper.EEXIST:
+ return "File already exists";
+ case Wrapper.ENOTEMPTY:
+ return "Directory is not empty";
+
+ case Wrapper.ESRCH:
+ case Wrapper.EINTR:
+ case Wrapper.EIO:
+ case Wrapper.ENXIO:
+ case Wrapper.E2BIG:
+ case Wrapper.ENOEXEC:
+ case Wrapper.ECHILD:
+ case Wrapper.EAGAIN:
+ case Wrapper.EACCES:
+ case Wrapper.EFAULT:
+ case Wrapper.ENOTBLK:
+ case Wrapper.EBUSY:
+ case Wrapper.EXDEV:
+ case Wrapper.ENODEV:
+ case Wrapper.EINVAL:
+ case Wrapper.ENFILE:
+ case Wrapper.EMFILE:
+ case Wrapper.ENOTTY:
+ case Wrapper.ETXTBSY:
+ case Wrapper.EFBIG:
+ case Wrapper.ENOSPC:
+ case Wrapper.ESPIPE:
+ case Wrapper.EROFS:
+ case Wrapper.EMLINK:
+ case Wrapper.EPIPE:
+ case Wrapper.EDOM:
+ case Wrapper.ERANGE:
+ case Wrapper.EDEADLK:
+ case Wrapper.ENAMETOOLONG:
+ case Wrapper.ENOLCK:
+ case Wrapper.ENOSYS:
+ case Wrapper.ELOOP:
+ case Wrapper.ENOMSG:
+ case Wrapper.EIDRM:
+ case Wrapper.ECHRNG:
+ case Wrapper.EL2NSYNC:
+ case Wrapper.EL3HLT:
+ case Wrapper.EL3RST:
+ case Wrapper.ELNRNG:
+ case Wrapper.EUNATCH:
+ case Wrapper.ENOCSI:
+ case Wrapper.EL2HLT:
+ case Wrapper.EBADE:
+ case Wrapper.EBADR:
+ case Wrapper.EXFULL:
+ case Wrapper.ENOANO:
+ case Wrapper.EBADRQC:
+ case Wrapper.EBADSLT:
+ case Wrapper.EBFONT:
+ case Wrapper.ENOSTR:
+ case Wrapper.ENODATA:
+ case Wrapper.ETIME:
+ case Wrapper.ENOSR:
+ case Wrapper.ENONET:
+ case Wrapper.ENOPKG:
+ case Wrapper.EREMOTE:
+ case Wrapper.ENOLINK:
+ case Wrapper.EADV:
+ case Wrapper.ESRMNT:
+ case Wrapper.ECOMM:
+ case Wrapper.EPROTO:
+ case Wrapper.EMULTIHOP:
+ case Wrapper.EDOTDOT:
+ case Wrapper.EBADMSG:
+ case Wrapper.ENOTUNIQ:
+ case Wrapper.EBADFD:
+ case Wrapper.EREMCHG:
+ case Wrapper.ELIBACC:
+ case Wrapper.ELIBBAD:
+ case Wrapper.ELIBSCN:
+ case Wrapper.ELIBMAX:
+ case Wrapper.ELIBEXEC:
+ case Wrapper.EUSERS:
+ case Wrapper.ENOTSOCK:
+ case Wrapper.EDESTADDRREQ:
+ case Wrapper.EMSGSIZE:
+ case Wrapper.EPROTOTYPE:
+ case Wrapper.ENOPROTOOPT:
+ case Wrapper.EPROTONOSUPPORT:
+ case Wrapper.ESOCKTNOSUPPORT:
+ case Wrapper.EOPNOTSUPP:
+ case Wrapper.EPFNOSUPPORT:
+ case Wrapper.EAFNOSUPPORT:
+ case Wrapper.EADDRINUSE:
+ case Wrapper.EADDRNOTAVAIL:
+ case Wrapper.ENETDOWN:
+ case Wrapper.ENETUNREACH:
+ case Wrapper.ENETRESET:
+ case Wrapper.ECONNABORTED:
+ case Wrapper.ECONNRESET:
+ case Wrapper.ENOBUFS:
+ case Wrapper.EISCONN:
+ case Wrapper.ENOTCONN:
+ case Wrapper.ESHUTDOWN:
+ case Wrapper.ETOOMANYREFS:
+ case Wrapper.ETIMEDOUT:
+ case Wrapper.ECONNREFUSED:
+ case Wrapper.EHOSTDOWN:
+ case Wrapper.EHOSTUNREACH:
+ case Wrapper.EALREADY:
+ case Wrapper.EINPROGRESS:
+ case Wrapper.ESTALE:
+ case Wrapper.EDQUOT:
+ case Wrapper.ENOMEDIUM:
+ break;
+
+ case Wrapper.ENOTDIR:
+ return "Not a directory";
+ }
+ return String.Format ("Errno code={0}", code);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Unix/Wrapper.cs b/mcs/class/corlib/Unix/Wrapper.cs
new file mode 100644
index 00000000000..76512a67223
--- /dev/null
+++ b/mcs/class/corlib/Unix/Wrapper.cs
@@ -0,0 +1,237 @@
+/*
+ * Generated automatically: do not edit this file.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Private {
+
+[CLSCompliant(false)]
+public struct stat {
+ public uint st_dev;
+ public uint st_mode;
+ public uint st_nlink;
+ public uint st_uid;
+ public uint st_gid;
+ public long st_size;
+ public uint st_atime;
+ public uint st_mtime;
+ public uint st_ctime;
+};
+
+public class Wrapper {
+
+ public const int SEEK_SET = 0;
+ public const int SEEK_CUR = 1;
+ public const int SEEK_END = 2;
+ public const int O_RDONLY = 0x00000000;
+ public const int O_WRONLY = 0x00000001;
+ public const int O_RDWR = 0x00000002;
+ public const int O_CREAT = 0x00000040;
+ public const int O_EXCL = 0x00000080;
+ public const int O_NOCTTY = 0x00000100;
+ public const int O_TRUNC = 0x00000200;
+ public const int O_SYNC = 0x00001000;
+ public const int O_APPEND = 0x00000400;
+ public const int STDIN_FILENO = 0x00000000;
+ public const int STDOUT_FILENO = 0x00000001;
+ public const int STDERR_FILENO = 0x00000002;
+ public const int S_IFMT = 0x0000f000;
+ public const int S_IFSOCK = 0x0000c000;
+ public const int S_IFLNK = 0x0000a000;
+ public const int S_IFREG = 0x00008000;
+ public const int S_IFBLK = 0x00006000;
+ public const int S_IFDIR = 0x00004000;
+ public const int S_IFCHR = 0x00002000;
+ public const int S_IFIFO = 0x00001000;
+ public const int S_ISUID = 0x00000800;
+ public const int S_ISGID = 0x00000400;
+ public const int S_ISVTX = 0x00000200;
+ public const int S_IRWXU = 0x000001c0;
+ public const int S_IRUSR = 0x00000100;
+ public const int S_IWUSR = 0x00000080;
+ public const int S_IXUSR = 0x00000040;
+ public const int S_IRWXG = 0x00000038;
+ public const int S_IRGRP = 0x00000020;
+ public const int S_IWGRP = 0x00000010;
+ public const int S_IXGRP = 0x00000008;
+ public const int S_IRWXO = 0x00000007;
+ public const int S_IROTH = 0x00000004;
+ public const int S_IWOTH = 0x00000002;
+ public const int S_IXOTH = 0x00000001;
+ public const int EPERM = 1;
+ public const int ENOENT = 2;
+ public const int ESRCH = 3;
+ public const int EINTR = 4;
+ public const int EIO = 5;
+ public const int ENXIO = 6;
+ public const int E2BIG = 7;
+ public const int ENOEXEC = 8;
+ public const int EBADF = 9;
+ public const int ECHILD = 10;
+ public const int EAGAIN = 11;
+ public const int ENOMEM = 12;
+ public const int EACCES = 13;
+ public const int EFAULT = 14;
+ public const int ENOTBLK = 15;
+ public const int EBUSY = 16;
+ public const int EEXIST = 17;
+ public const int EXDEV = 18;
+ public const int ENODEV = 19;
+ public const int EISDIR = 21;
+ public const int EINVAL = 22;
+ public const int ENFILE = 23;
+ public const int EMFILE = 24;
+ public const int ENOTTY = 25;
+ public const int ETXTBSY = 26;
+ public const int EFBIG = 27;
+ public const int ENOSPC = 28;
+ public const int ESPIPE = 29;
+ public const int EROFS = 30;
+ public const int EMLINK = 31;
+ public const int EPIPE = 32;
+ public const int EDOM = 33;
+ public const int ERANGE = 34;
+ public const int EDEADLK = 35;
+ public const int ENAMETOOLONG = 36;
+ public const int ENOLCK = 37;
+ public const int ENOSYS = 38;
+ public const int ENOTEMPTY = 39;
+ public const int ELOOP = 40;
+ public const int EWOULDBLOCK = 11;
+ public const int ENOMSG = 42;
+ public const int EIDRM = 43;
+ public const int ECHRNG = 44;
+ public const int EL2NSYNC = 45;
+ public const int EL3HLT = 46;
+ public const int EL3RST = 47;
+ public const int ELNRNG = 48;
+ public const int EUNATCH = 49;
+ public const int ENOCSI = 50;
+ public const int EL2HLT = 51;
+ public const int EBADE = 52;
+ public const int EBADR = 53;
+ public const int EXFULL = 54;
+ public const int ENOANO = 55;
+ public const int EBADRQC = 56;
+ public const int EBADSLT = 57;
+ public const int EDEADLOCK = 35;
+ public const int EBFONT = 59;
+ public const int ENOSTR = 60;
+ public const int ENODATA = 61;
+ public const int ETIME = 62;
+ public const int ENOSR = 63;
+ public const int ENONET = 64;
+ public const int ENOPKG = 65;
+ public const int EREMOTE = 66;
+ public const int ENOLINK = 67;
+ public const int EADV = 68;
+ public const int ESRMNT = 69;
+ public const int ECOMM = 70;
+ public const int EPROTO = 71;
+ public const int EMULTIHOP = 72;
+ public const int EDOTDOT = 73;
+ public const int EBADMSG = 74;
+ public const int ENOTUNIQ = 76;
+ public const int EBADFD = 77;
+ public const int EREMCHG = 78;
+ public const int ELIBACC = 79;
+ public const int ELIBBAD = 80;
+ public const int ELIBSCN = 81;
+ public const int ELIBMAX = 82;
+ public const int ELIBEXEC = 83;
+ public const int EUSERS = 87;
+ public const int ENOTSOCK = 88;
+ public const int EDESTADDRREQ = 89;
+ public const int EMSGSIZE = 90;
+ public const int EPROTOTYPE = 91;
+ public const int ENOPROTOOPT = 92;
+ public const int EPROTONOSUPPORT = 93;
+ public const int ESOCKTNOSUPPORT = 94;
+ public const int EOPNOTSUPP = 95;
+ public const int EPFNOSUPPORT = 96;
+ public const int EAFNOSUPPORT = 97;
+ public const int EADDRINUSE = 98;
+ public const int EADDRNOTAVAIL = 99;
+ public const int ENETDOWN = 100;
+ public const int ENETUNREACH = 101;
+ public const int ENETRESET = 102;
+ public const int ECONNABORTED = 103;
+ public const int ECONNRESET = 104;
+ public const int ENOBUFS = 105;
+ public const int EISCONN = 106;
+ public const int ENOTCONN = 107;
+ public const int ESHUTDOWN = 108;
+ public const int ETOOMANYREFS = 109;
+ public const int ETIMEDOUT = 110;
+ public const int ECONNREFUSED = 111;
+ public const int EHOSTDOWN = 112;
+ public const int EHOSTUNREACH = 113;
+ public const int EALREADY = 114;
+ public const int EINPROGRESS = 115;
+ public const int ESTALE = 116;
+ public const int EDQUOT = 122;
+ public const int ENOMEDIUM = 123;
+ public const int ENOTDIR = 20;
+
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_seek", CharSet=CharSet.Ansi)]
+ public unsafe static extern long seek (IntPtr fd, long offset, int whence);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_mkdir", CharSet=CharSet.Ansi)]
+ public unsafe static extern int mkdir (string path, int mode);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_rmdir", CharSet=CharSet.Ansi)]
+ public unsafe static extern int rmdir (string path);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_read", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int read (IntPtr fd, void * buf, int count);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_write", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int write (IntPtr fd, void * buf, int count);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_fstat", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int fstat (IntPtr fd, stat * buf);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_ftruncate", CharSet=CharSet.Ansi)]
+ public unsafe static extern int ftruncate (IntPtr fd, long length);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_open", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr open (string path, int flags, int mode);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_close", CharSet=CharSet.Ansi)]
+ public unsafe static extern int close (IntPtr fd);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_stat", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int stat (string path, stat * buf);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_unlink", CharSet=CharSet.Ansi)]
+ public unsafe static extern int unlink (string path);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_opendir", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr opendir (string path);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_readdir", CharSet=CharSet.Ansi)]
+ public unsafe static extern string readdir (IntPtr dir);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_closedir", CharSet=CharSet.Ansi)]
+ public unsafe static extern int closedir (IntPtr dir);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_getenv", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr getenv (string variable);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_environ", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr environ ();
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_rename", CharSet=CharSet.Ansi)]
+ public unsafe static extern int rename (string source, string target);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_utime", CharSet=CharSet.Ansi)]
+ public unsafe static extern int utime (string path, int atime, int mtime);
+}
+}
diff --git a/mcs/class/corlib/Unix/common.src b/mcs/class/corlib/Unix/common.src
new file mode 100644
index 00000000000..14f9533ef75
--- /dev/null
+++ b/mcs/class/corlib/Unix/common.src
@@ -0,0 +1 @@
+Wrapper.cs \ No newline at end of file
diff --git a/mcs/class/corlib/Unix/mono.src b/mcs/class/corlib/Unix/mono.src
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/corlib/Unix/mono.src
diff --git a/mcs/class/corlib/Unix/windows.src b/mcs/class/corlib/Unix/windows.src
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/corlib/Unix/windows.src
diff --git a/mcs/class/corlib/Windows/Windows.cs b/mcs/class/corlib/Windows/Windows.cs
new file mode 100644
index 00000000000..891c26f0b68
--- /dev/null
+++ b/mcs/class/corlib/Windows/Windows.cs
@@ -0,0 +1,694 @@
+/*---------------------------------------------------------------------
+
+ XX X XXX
+ XX XX
+ XXX XX XXX XXXXX XX
+ XX XXX XX XX XX
+ XX XX XX XX XXXXX XX
+ XX XX XX XX XX XX X XX
+ XXXX XX XX XXX XXXXXXX XXXX
+ XX
+ XXXXX
+
+Copyright (c) 2001 Intel Corporation. All Rights Reserved.
+
+CREATED: August 15, 2001
+OWNER: Scott D Smith, Joel Marcey
+VERSION: 1.0
+---------------------------------------------------------------------*/
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.IO;
+using System.Collections;
+
+namespace System.PAL
+{
+ /// <summary>
+ /// Class that implements IOperatingSystem, providing the requested functionality through calls into APIs available in Windows (this class is a work in progress).
+ /// </summary>
+ internal class OpSys
+ {
+
+ //OS Calls (P/Invoke)
+
+
+ /*DWORD GetFullPathName(
+ LPCTSTR lpFileName, // file name
+ DWORD nBufferLength, // size of path buffer
+ LPTSTR lpBuffer, // path buffer
+ LPTSTR *lpFilePart // address of file name in path
+ );*/
+
+ [DllImport("kernel32.dll")]
+ private static extern uint GetFullPathName(string path, uint bufLength, System.Text.StringBuilder buffer, ref System.Text.StringBuilder fNameAddr);
+
+ /*UINT GetTempFileName(
+ LPCTSTR lpPathName, // directory name
+ LPCTSTR lpPrefixString, // file name prefix
+ UINT uUnique, // integer
+ LPTSTR lpTempFileName // file name buffer
+ );*/
+
+ [DllImport("kernel32.dll")]
+ private static extern uint GetTempFileName(string path, string prefix, uint unique, System.Text.StringBuilder buffer);
+
+ /*DWORD GetTempPath(
+ DWORD nBufferLength, // size of buffer
+ LPTSTR lpBuffer // path buffer
+ );*/
+
+ [DllImport("kernel32.dll")]
+ private static extern int GetTempPath(int bufferLength, System.Text.StringBuilder buffer);
+
+
+
+
+ // Class Constants
+
+ private const int EOF = -1; // In stdio.h, EOF is defined as -1
+
+
+
+ // For StdInputStream and StdOutputStream
+
+ private const int STDOUT = 1; // In stdio.h, the handle to standard out is 1
+ private const int STDIN = 0; // In stdio.h, the standard input handle is defined as 0. Will this always be true?
+
+
+ // Class Fields
+
+ private static bool isNextCharacterResidualNewline = false;
+ private static byte residualNewlineByte = 0;
+
+
+
+ // Class Constructor
+
+ public OpSys()
+ {
+ }
+
+
+ // System.Environment Services
+
+ public string NewLineSequence
+ {
+ get
+ {
+ return "\r\n";
+ }
+ }
+
+ public char DirectorySeparator
+ {
+ get
+ {
+ return (char) 0x005C; // This is a \
+ }
+ }
+
+ public char AltDirectorySeparator
+ {
+ get
+ {
+ return (char) 0x002F; // This is a /
+ }
+ }
+
+ public char VolumeSeparator
+ {
+ get
+ {
+ return (char) 0x003A; // This is a :
+ }
+ }
+
+ public char PathSeparator
+ {
+ get
+ {
+ return (char) 0x003B; // This is a ;
+ }
+ }
+
+ public char[] InvalidPathChars
+ {
+ get
+ {
+ char[] ipc = {'"', '<', '>', '|', '\0'};
+ return ipc;
+ }
+ }
+
+ public char[] DirVolSeparatorChars
+ {
+ get
+ {
+ char[] dsc = new char[] {this.DirectorySeparator, this.AltDirectorySeparator, this.VolumeSeparator};
+ return dsc;
+ }
+ }
+ public char ExtensionCharacter
+ {
+ get
+ {
+ return (char) 0x002E; // This is a .
+ }
+ }
+
+ public string GetEnvironmentVariable(string eVar)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetEnvironmentVariable(System.String): Stub Method");
+ // Call Windows API to get environment variable;
+ return null;
+ }
+
+ public string CommandLine
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public IDictionary EnvironmentVariables
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public string MachineName
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public OperatingSystem OSVersion
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ // System.Path services
+
+ public string ChangeExtension(string path, string extension)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:ChangeExtension(System.String, System.String): Stub Method");
+ if (path == null || path.Equals(string.Empty))
+ {
+ return path;
+ }
+ if (!this.HasExtension(path) && extension != null)
+ {
+ return string.Concat(path, extension);
+ }
+ string pathNoExt = path.Substring(0, path.LastIndexOf(this.ExtensionCharacter));
+ // If extension is null, concat replaces it with string.Empty
+ return string.Concat(pathNoExt, extension);
+ }
+
+ public string GetExtension(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetExtension(System.String): Stub Method");
+ if (path == null)
+ {
+ return path;
+ }
+ if (!this.HasExtension(path))
+ {
+ return string.Empty;
+ }
+ // It has an extension
+ return path.Substring(path.LastIndexOf(this.ExtensionCharacter));
+ }
+
+ public string GetFileName(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetFileName(System.String): Stub Method");
+ if (path == null)
+ {
+ return null;
+ }
+ int dvLast = path.LastIndexOfAny(this.DirVolSeparatorChars);
+ if (dvLast == -1)
+ {
+ return path;
+ }
+ return dvLast + 1 == path.Length ? string.Empty : path.Substring(dvLast + 1);
+ }
+
+ public long FileLength(string path)
+ {
+ return 0;
+ }
+
+ public long FileLength(IntPtr handle)
+ {
+ return 0;
+ }
+
+ public string GetFileNameWithoutExtension(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetFileNameWithoutExtension(System.String): Stub Method");
+ return this.ChangeExtension(this.GetFileName(path), null);
+ }
+
+ // TODO: Windows: GetFullPath: Verify logic here. This seems TOO simplistic
+ public string GetFullPath(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetFullPath(System.String): Stub Method");
+ if (path == null)
+ {
+ return null;
+ }
+ // TODO: GetFullPath: What should the size of the buffer be?
+ System.Text.StringBuilder buffer = new System.Text.StringBuilder(256);
+ // Just temporary to pass in as final parameter
+ System.Text.StringBuilder temp = new System.Text.StringBuilder();
+ // TODO: GetFullPath: ECMA spec says that an ArgumentException is thrown if system can not retrieve the path. That does not seem right. Returning null for now
+ return GetFullPathName(path, (uint) buffer.Capacity, buffer, ref temp) != 0 ? buffer.ToString() : null;
+ }
+
+ public string GetPathRoot(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetPathRoot(System.String): Stub Method");
+ if (path == null)
+ {
+ return null;
+ }
+ // TODO: Windows: GetPathRoot: Check logic. Assuming that if there is not dir or vol separators in the first three characters, then relative.
+ int dvFirst = path.IndexOfAny(this.DirVolSeparatorChars, 0, 3);
+ if (dvFirst == -1)
+ {
+ return string.Empty;
+ }
+ if (dvFirst == 0 && path[dvFirst].Equals(this.VolumeSeparator))
+ {
+ return string.Empty;
+ }
+ return dvFirst == 1 && path[dvFirst].Equals(this.VolumeSeparator) && (path[dvFirst+1].Equals(this.DirectorySeparator) || path[dvFirst+1].Equals(this.AltDirectorySeparator)) ? path.Substring(0, dvFirst+2) : path.Substring(0, dvFirst+1);
+
+ }
+
+ public string GetTempFileName()
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetTempFileName(): Stub Method");
+ string tPath = this.GetTempPath();
+ string prefix = "tmp";
+ // TODO: Windows: GetTempFileName: Remove System once our implementation of StringBuilder is done. Same for parameter to P/Invoke
+ // TODO: Windows: GetTempFileName: What is the proper length?
+ System.Text.StringBuilder buffer = new System.Text.StringBuilder(256);
+ // TODO: Windows: GetTempFileName: If an error is returned, what should we do? Right now return null;
+ return GetTempFileName(tPath, prefix, 0, buffer) != 0 ? buffer.ToString() : null;
+ }
+
+ public string GetTempPath()
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetTempPath(): Stub Method");
+ // TODO: Windows: GetTempPath: Remove System once our implementation of StringBuilder is done. Same for parameter to P/Invoke
+ // According to docs, LPTSTR maps to StringBuilder for In/Out
+ System.Text.StringBuilder buffer = new System.Text.StringBuilder(256);
+ // TODO: Windows: GetTempPath: What is the proper length?
+ // TODO: Windows: GetTempPath: If an error is returned, what should we do? Right now return null;
+ return GetTempPath(buffer.Capacity, buffer) != 0 ? buffer.ToString() : null;
+ }
+
+ public bool HasExtension(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:HasExtension(System.String): Stub Method");
+ int dvLast = path.LastIndexOfAny(this.DirVolSeparatorChars);
+ int exLast = path.LastIndexOf(this.ExtensionCharacter);
+ if (exLast > dvLast)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public bool IsPathRooted(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:IsPathRooted(System.String): Stub Method");
+ return (this.GetPathRoot(path) == null) || (this.GetPathRoot(path).Equals(string.Empty)) ? false : true;
+ }
+
+
+ // System.Directory service
+
+ public void DeleteDirectory(string path, bool recursive)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:DeleteDirectory(System.String, System.Boolean): Stub Method");
+ }
+
+ public bool ExistsDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:ExistsDirectory(System.String): Stub Method");
+ return false;
+ }
+
+ public DateTime GetCreationTimeDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetCreationTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public string GetCurrentDirectory()
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetCurrentDirectory(): Stub Method");
+ return null;
+ }
+
+ public string[] GetDirectories(string path, string searchPattern)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetDirectories(System.String,System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFiles(string path, string searchPattern)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetFiles(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFileSystemEntries(string path, string searchPattern)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetFileSystemEntries(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public DateTime GetLastAccessTimeDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastAccessTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastWriteTimeDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastWriteTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public void MoveDirectory(string sourceDirName, string destDirName)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:MoveDirectory(System.String, System.String): Stub Method");
+ }
+
+ public void SetCreationTimeDirectory(string path, DateTime creationTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCreationTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetCurrentDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCurrentDirectory(System.String): Stub Method");
+ }
+
+ public void SetLastAccessTimeDirectory(string path, DateTime lastAccessTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetLastAccessTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastWriteTimeDirectory(string path, DateTime lastWriteTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetLastWriteTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+
+ // I/O Services
+
+
+ public int ReadStdInput(byte[] buffer, int offset, int count)
+ {
+ return ReadFile(new IntPtr(STDIN), buffer, offset, count);
+ }
+
+ public void FlushStdOutput(byte[] byteBuf)
+ {
+ FlushFile (new IntPtr(STDOUT), byteBuf);
+ }
+
+ public unsafe int ReadFile(IntPtr handle, byte[] buffer, int offset, int count)
+ {
+ int res;
+
+ fixed (void *p = &buffer[offset]) {
+ res = _read(handle, p, count);
+ }
+ return res;
+ }
+
+ public unsafe int WriteFile(IntPtr handle, byte[] buffer, int offset, int count)
+ {
+ int res;
+
+ fixed (void *p = &buffer [offset]) {
+ res = _write(handle, p, count);
+ }
+ return res;
+ }
+
+ public int SetLengthFile(IntPtr handle, long length)
+ {
+ return _ftruncate (handle, (int)length);
+ }
+
+ public void FlushFile(IntPtr handle, byte[] byteBuf)
+ {
+ WriteFile (handle, byteBuf, 0, byteBuf.Length);
+ }
+
+ public IntPtr OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
+ {
+ int flags = _getUnixFlags (mode, access);
+
+ return _open (path, flags, 0x1a4);
+ }
+
+ public void CloseFile(IntPtr handle)
+ {
+ _close (handle);
+ }
+
+ public long SeekFile(IntPtr handle, long offset, SeekOrigin origin)
+ {
+ switch (origin) {
+ case SeekOrigin.End:
+ return _lseek (handle, (int)offset, SEEK_END);
+ case SeekOrigin.Current:
+ return _lseek (handle, (int)offset, SEEK_CUR);
+ default:
+ return _lseek (handle, (int)offset, SEEK_SET);
+ }
+ }
+
+ public IntPtr CreateFile(string path, FileMode mode, FileAccess access, FileShare share)
+ {
+ return OpenFile(path, FileMode.CreateNew, access, share);
+ }
+
+ public void DeleteFile(string path)
+ {
+ _unlink(path);
+ }
+
+ public bool ExistsFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:ExistsFile(System.String): Stub Method");
+ return false;
+ }
+
+ public DateTime GetCreationTimeFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetCreationTimeFile(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastAccessTimeFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastAccessTimeFile(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastWriteTimeFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastWriteFile(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public void SetCreationTimeFile(string path, DateTime creationTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCreationTimeFile(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastAccessTimeFile(string path, DateTime lastAccessTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetLastAccessTimeFile(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastWriteTimeFile(string path, DateTime lastWriteTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCLastWriteTimeFile(System.String, System.DateTime): Stub Method");
+ }
+
+ // DONE: Determine if this should be in a utility class
+ /// <summary>
+ /// Determines if a byte is part of the newline sequence
+ /// </summary>
+ /// <param name="c">The byte to compare</param>
+ /// <returns>A System.Boolean stating whether the byte is part of the newline</returns>
+ private static bool IsPartOfNewlineSequence(byte c)
+ {
+ char[] newLineArray = System.Environment.NewLine.ToCharArray();
+ for (int i = 0; i < newLineArray.Length; i++)
+ {
+ if (c == (byte) newLineArray[i]) // Or do I need Equals()
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Determines if a character is a newline character
+ /// </summary>
+ /// <param name="c">The character to check to see if it is a newline character</param>
+ /// <returns></returns>
+ public static bool IsPartOfNewlineSequence(char c)
+ {
+ // DONE: Determine if this method can be moved into TextReader or maybe a utility class (a class with a bunch of static methods...System.IO.IOUtility)
+ char[] newLineArray = System.Environment.NewLine.ToCharArray();
+ for (int i = 0; i < newLineArray.Length; i++)
+ {
+ if (c == newLineArray[i]) // TODO: Determine if .Equals() should be used here.
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ [ DllImport("msvcrt", EntryPoint="acos") ]
+ public extern static double Acos(double d);
+
+ [ DllImport("msvcrt", EntryPoint="asin") ]
+ public extern static double Asin(double d);
+
+ [ DllImport("msvcrt", EntryPoint="atan") ]
+ public extern static double Atan(double d);
+
+ [ DllImport("msvcrt", EntryPoint="atan2") ]
+ public extern static double Atan2(double y, double x);
+
+ [ DllImport("msvcrt", EntryPoint="cos") ]
+ public extern static double Cos(double d);
+
+ [ DllImport("msvcrt", EntryPoint="cosh") ]
+ public extern static double Cosh(double d);
+
+ [ DllImport("msvcrt", EntryPoint="exp") ]
+ public extern static double Exp(double d);
+
+ [ DllImport("msvcrt", EntryPoint="log") ]
+ public extern static double Log(double d);
+
+ [ DllImport("msvcrt", EntryPoint="log10") ]
+ public extern static double Log10(double d);
+
+ [ DllImport("msvcrt", EntryPoint="pow") ]
+ public extern static double Pow(double x, double y);
+
+ [ DllImport("msvcrt", EntryPoint="sin") ]
+ public extern static double Sin(double d);
+
+ [ DllImport("msvcrt", EntryPoint="sinh") ]
+ public extern static double Sinh(double d);
+
+ [ DllImport("msvcrt", EntryPoint="sqrt") ]
+ public extern static double Sqrt(double d);
+
+ [ DllImport("msvcrt", EntryPoint="tan") ]
+ public extern static double Tan(double d);
+
+ [ DllImport("msvcrt", EntryPoint="tanh") ]
+ public extern static double Tanh(double d);
+
+ [ DllImport("msvcrt", EntryPoint="_read", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _read(IntPtr fd, void *buf, int count);
+
+ [ DllImport("msvcrt", EntryPoint="_write", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _write(IntPtr fd, void *buf, int count);
+
+ [ DllImport("msvcrt", EntryPoint="_lseek", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _lseek(IntPtr fd, int offset, int whence);
+
+ [ DllImport("msvcrt", EntryPoint="_chsize", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _ftruncate (IntPtr fd, int count);
+
+ [ DllImport("msvcrt", EntryPoint="_close", CharSet=CharSet.Ansi) ]
+ private unsafe static extern void _close(IntPtr fd);
+
+ [ DllImport("msvcrt", EntryPoint="_open", CharSet=CharSet.Ansi) ]
+ private unsafe static extern IntPtr _open(string path, int flags, int mode);
+
+ [ DllImport("msvcrt", EntryPoint="_unlink", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _unlink(string path);
+
+ private const int O_RDONLY = 0x000;
+ private const int O_WRONLY = 0x001;
+ private const int O_RDWR = 0x002;
+ private const int O_CREAT = 0x040;
+ private const int O_EXCL = 0x080;
+ private const int O_TRUNC = 0x200;
+ private const int O_APPEND = 0x400;
+
+ private const int SEEK_SET = 0;
+ private const int SEEK_CUR = 1;
+ private const int SEEK_END = 2;
+
+ private int _getUnixFlags (FileMode mode, FileAccess access)
+ {
+ int flags = 0;
+ switch (access) {
+ case FileAccess.Read:
+ flags = O_RDONLY;
+ break;
+ case FileAccess.Write:
+ flags = O_WRONLY;
+ break;
+ case FileAccess.ReadWrite:
+ flags = O_RDWR;
+ break;
+ }
+
+ switch (mode) {
+ case FileMode.Append:
+ flags |= O_APPEND;
+ break;
+ case FileMode.Create:
+ flags |= O_CREAT;
+ break;
+ case FileMode.CreateNew:
+ flags |= O_CREAT | O_EXCL;
+ break;
+ case FileMode.Open:
+ break;
+ case FileMode.OpenOrCreate:
+ flags |= O_CREAT;
+ break;
+ case FileMode.Truncate:
+ flags |= O_TRUNC;
+ break;
+ }
+
+ return flags;
+ }
+ }
+}
diff --git a/mcs/class/corlib/corlib.build b/mcs/class/corlib/corlib.build
new file mode 100644
index 00000000000..798f4693ff4
--- /dev/null
+++ b/mcs/class/corlib/corlib.build
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for corlib.dll -->
+<!-- Target windows builds libraries _for_ windows -->
+<!-- Target linux builds libraries _for_ linux -->
+
+<project name="corlib" default="build">
+ <property name="debug" value="true"/>
+ <property name="verbose" value="true"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/corlib.dll" debug="${debug}">
+ <!-- keep in sync with corlib_cmp.dll below -->
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0649"/> <!-- field never assigned to -->
+ <arg value="/nowarn:0169"/> <!-- field never used -->
+ <arg value="/nowarn:0679"/> <!-- internal may be overriden -->
+ <arg value="/unsafe"/>
+
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/> <!-- custom security attributes problem -->
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+ </sources>
+ </csc>
+ <csc target="library" output="../lib/corlib_cmp.dll" debug="${debug}">
+ <!-- This dll is used to compare with mscorlib -->
+ <!-- It should be the same as corlib.dll minus Object and ValueTyp -->
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0649"/> <!-- field never assigned to -->
+ <arg value="/nowarn:0169"/> <!-- field never used -->
+ <arg value="/nowarn:0679"/> <!-- internal may be overriden -->
+ <arg value="/unsafe"/>
+
+ <arg value="/nostdlib"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:mscorlib.dll"/>
+
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/>
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+
+ <excludes name="System/Object.cs"/>
+ <excludes name="System/ValueType.cs"/>
+ <excludes name="System/Enum.cs"/>
+ <excludes name="System/Delegate.cs"/>
+ <excludes name="System/MulticastDelegate.cs"/>
+ <excludes name="System/Exception.cs"/>
+
+ <!-- DecimalConstantAttribute presence causes security exceptions in corcompare -->
+ <excludes name="System/Decimal.cs"/>
+ <excludes name="System/DecimalFormatter.cs"/>
+ </sources>
+ </csc>
+ <!-- NUnit can only run under windows right now, so build for windows
+ even though this is inside the linux target -->
+ <csc target="library" output="Test/corlib_res.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0649"/> <!-- field never assigned to -->
+ <arg value="/nowarn:0169"/> <!-- field never used -->
+ <arg value="/nowarn:0679"/> <!-- internal may be overriden -->
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+
+ <excludes name="System/Object.cs"/>
+ <excludes name="System/ValueType.cs"/>
+ <excludes name="System/Enum.cs"/>
+ <excludes name="System/Delegate.cs"/>
+ <excludes name="System/MulticastDelegate.cs"/>
+ <excludes name="System/Exception.cs"/>
+ <excludes name="System/Type.cs"/>
+ <excludes name="System/MonoType.cs"/>
+ <excludes name="System/Array.cs"/>
+ <excludes name="System/String.cs"/>
+ <excludes name="System/Console.cs"/>
+ <excludes name="System/AppDomain.cs"/>
+ <excludes name="System/RuntimeTypeHandle.cs"/>
+ <excludes name="System/ICloneable.cs"/>
+
+ <excludes name="System.Collections/Queue.cs"/>
+ <excludes name="System.Collections/ICollection.cs"/>
+ <excludes name="System.Collections/IEnumerator.cs"/>
+ <excludes name="System.Collections/IEnumerable.cs"/>
+ <excludes name="System.Collections/IList.cs"/>
+ <excludes name="System.PAL/IOperatingSystem.cs"/>
+ <excludes name="System.Reflection.Emit/**"/>
+ <excludes name="System.Runtime.CompilerServices/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/>
+ </sources>
+ </csc>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="mcs-build">
+ <mkdir dir="../lib"/>
+
+ <mcs target="library" output="../lib/corlib_mcs.dll" debug="false" verbose="${verbose}">
+ <arg value="--unsafe"/>
+
+ <arg value="--nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="--noconfig"/> <!-- don't reference ms assemblies -->
+
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/> <!-- custom security attributes problem -->
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+ </sources>
+ </mcs>
+
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <delete file="../lib/corlib.dll" failonerror="false"/>
+ <delete file="../lib/corlib.pdb" failonerror="false"/>
+ <delete file="../lib/corlib_cmp.dll" failonerror="false"/>
+ <delete file="../lib/corlib_cmp.pdb" failonerror="false"/>
+ <delete file="Test/corlib_res.dll" failonerror="false"/>
+ <delete file="Test/corlib_res.pdb" failonerror="false"/>
+ <nant basedir="Test" target="clean"/>
+ </target>
+</project>
diff --git a/mcs/class/corlib/makefile.gnu b/mcs/class/corlib/makefile.gnu
new file mode 100644
index 00000000000..5b9f58b3636
--- /dev/null
+++ b/mcs/class/corlib/makefile.gnu
@@ -0,0 +1,18 @@
+topdir = ../..
+
+TEST_DIR= Test
+LIBRARY = $(topdir)/class/lib/corlib.dll
+
+LIB_LIST = unix.args
+LIB_FLAGS = --unsafe --nostdlib
+
+SOURCES_INCLUDE=*.cs
+SOURCES_EXCLUDE=\
+ ./Test* \
+ ./System.Security.Permissions/SecurityPermissionAttribute.cs \
+ ./System.PAL/*.cs \
+ ./Windows/*.cs \
+ ./System.Runtime.Remoting.Activation/UrlAttribute.cs \
+ ./System.Runtime.Remoting.Contexts/ContextAttribute.cs
+
+include $(topdir)/class/library.make
diff --git a/mcs/class/corlib/unix.args b/mcs/class/corlib/unix.args
new file mode 100755
index 00000000000..44284179367
--- /dev/null
+++ b/mcs/class/corlib/unix.args
@@ -0,0 +1,786 @@
+--target library
+--unsafe --nostdlib --noconfig
+-o ../lib/corlib_mcs.dll
+Microsoft.Win32/RegistryKey.cs
+Microsoft.Win32/Registry.cs
+Microsoft.Win32/RegistryHive.cs
+Mono/Runtime.cs
+System/Activator.cs
+System/AppDomain.cs
+System/AppDomainSetup.cs
+System/AppDomainUnloadedException.cs
+System/ApplicationException.cs
+System/ArgIterator.cs
+System/ArgumentException.cs
+System/ArgumentNullException.cs
+System/ArgumentOutOfRangeException.cs
+System/ArithmeticException.cs
+System/Array.cs
+System/ArrayTypeMismatchException.cs
+System/AssemblyLoadEventArgs.cs
+System/AssemblyLoadEventHandler.cs
+System/AsyncCallback.cs
+System/Attribute.cs
+System/AttributeTargets.cs
+System/AttributeUsageAttribute.cs
+System/BadImageFormatException.cs
+System/BitConverter.cs
+System/Boolean.cs
+System/Buffer.cs
+System/Byte.cs
+System/CannotUnloadAppDomainException.cs
+System/Char.cs
+System/CharEnumerator.cs
+System/CLSCompliantAttribute.cs
+System/Console.cs
+System/ContextBoundObject.cs
+System/ContextMarshalException.cs
+System/ContextStaticAttribute.cs
+System/Convert.cs
+System/CrossAppDomainDelegate.cs
+System/DateTime.cs
+System/DBNull.cs
+System/Decimal.cs
+System/DecimalFormatter.cs
+System/Delegate.cs
+System/DelegateSerializationHolder.cs
+System/DivideByZeroException.cs
+System/DllNotFoundException.cs
+System/Double.cs
+System/DuplicateWaitObjectException.cs
+System/EntryPointNotFoundException.cs
+System/Enum.cs
+System/Environment.cs
+System/EventArgs.cs
+System/EventHandler.cs
+System/Exception.cs
+System/ExecutionEngineException.cs
+System/FieldAccessException.cs
+System/FlagsAttribute.cs
+System/FormatException.cs
+System/GC.cs
+System/Guid.cs
+System/IAppDomainSetup.cs
+System/IAsyncResult.cs
+System/ICloneable.cs
+System/IComparable.cs
+System/IConvertible.cs
+System/ICustomFormatter.cs
+System/IDisposable.cs
+System/IFormatProvider.cs
+System/IFormattable.cs
+System/IndexOutOfRangeException.cs
+System/Int16.cs
+System/Int32.cs
+System/Int64.cs
+System/IntegerFormatter.cs
+System/IntPtr.cs
+System/InvalidCastException.cs
+System/InvalidOperationException.cs
+System/InvalidProgramException.cs
+System/IServiceProvider.cs
+System/LoaderOptimization.cs
+System/LoaderOptimizationAttribute.cs
+System/LocalDataStoreSlot.cs
+System/MarshalByRefObject.cs
+System/Math.cs
+System/MemberAccessException.cs
+System/MethodAccessException.cs
+System/MissingFieldException.cs
+System/MissingMemberException.cs
+System/MissingMethodException.cs
+System/MonoCustomAttrs.cs
+System/MonoDummy.cs
+System/MonoType.cs
+System/MTAThreadAttribute.cs
+System/MulticastDelegate.cs
+System/MulticastNotSupportedException.cs
+System/NonSerializedAttribute.cs
+System/NotFiniteNumberException.cs
+System/NotImplementedException.cs
+System/NotSupportedException.cs
+System/NullReferenceException.cs
+System/Object.cs
+System/ObjectDisposedException.cs
+System/ObsoleteAttribute.cs
+System/OperatingSystem.cs
+System/OutOfMemoryException.cs
+System/OverflowException.cs
+System/ParamArrayAttribute.cs
+System/PlatformID.cs
+System/PlatformNotSupportedException.cs
+System/Random.cs
+System/RankException.cs
+System/ResolveEventArgs.cs
+System/ResolveEventHandler.cs
+System/RuntimeArgumentHandle.cs
+System/RuntimeFieldHandle.cs
+System/RuntimeMethodHandle.cs
+System/RuntimeTypeHandle.cs
+System/SByte.cs
+System/SerializableAttribute.cs
+System/Single.cs
+System/StackOverflowException.cs
+System/STAThreadAttribute.cs
+System/String.cs
+System/SystemException.cs
+System/ThreadStaticAttribute.cs
+System/TimeSpan.cs
+System/TimeZone.cs
+System/TODOAttribute.cs
+System/Type.cs
+System/TypeCode.cs
+System/TypedReference.cs
+System/TypeInitializationException.cs
+System/TypeLoadException.cs
+System/TypeUnloadedException.cs
+System/UInt16.cs
+System/UInt32.cs
+System/UInt64.cs
+System/UIntPtr.cs
+System/UnauthorizedAccessException.cs
+System/UnhandledExceptionEventArgs.cs
+System/UnhandledExceptionEventHandler.cs
+System/UnitySerializationHolder.cs
+System/ValueType.cs
+System/Version.cs
+System/Void.cs
+System/WeakReference.cs
+System/_AppDomain.cs
+System.Collections/ArrayList.cs
+System.Collections/BitArray.cs
+System.Collections/CaseInsensitiveComparer.cs
+System.Collections/CaseInsensitiveHashCodeProvider.cs
+System.Collections/CollectionBase.cs
+System.Collections/Comparer.cs
+System.Collections/DictionaryBase.cs
+System.Collections/DictionaryEntry.cs
+System.Collections/Hashtable.cs
+System.Collections/ICollection.cs
+System.Collections/IComparer.cs
+System.Collections/IDictionary.cs
+System.Collections/IDictionaryEnumerator.cs
+System.Collections/IEnumerable.cs
+System.Collections/IEnumerator.cs
+System.Collections/IHashCodeProvider.cs
+System.Collections/IList.cs
+System.Collections/Queue.cs
+System.Collections/ReadOnlyCollectionBase.cs
+System.Collections/SortedList.cs
+System.Collections/Stack.cs
+System.Configuration.Assemblies/AssemblyHash.cs
+System.Configuration.Assemblies/AssemblyHashAlgorithm.cs
+System.Configuration.Assemblies/AssemblyVersionCompatibility.cs
+System.Configuration.Assemblies/ProcessorID.cs
+System.Diagnostics/ConditionalAttribute.cs
+System.Diagnostics/DebuggableAttribute.cs
+System.Diagnostics/Debugger.cs
+System.Diagnostics/DebuggerHiddenAttribute.cs
+System.Diagnostics/DebuggerStepThroughAttribute.cs
+System.Diagnostics/StackFrame.cs
+System.Diagnostics/StackTrace.cs
+System.Diagnostics.SymbolStore/ISymbolBinder.cs
+System.Diagnostics.SymbolStore/ISymbolDocument.cs
+System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs
+System.Diagnostics.SymbolStore/ISymbolMethod.cs
+System.Diagnostics.SymbolStore/ISymbolNamespace.cs
+System.Diagnostics.SymbolStore/ISymbolReader.cs
+System.Diagnostics.SymbolStore/ISymbolScope.cs
+System.Diagnostics.SymbolStore/ISymbolVariable.cs
+System.Diagnostics.SymbolStore/ISymbolWriter.cs
+System.Diagnostics.SymbolStore/SymAddressKind.cs
+System.Diagnostics.SymbolStore/SymbolToken.cs
+System.Diagnostics.SymbolStore/SymDocumentType.cs
+System.Diagnostics.SymbolStore/SymLanguageType.cs
+System.Diagnostics.SymbolStore/SymLanguageVendor.cs
+System.Globalization/Calendar.cs
+System.Globalization/CalendarWeekRule.cs
+System.Globalization/CalendricalCalculations.cs
+System.Globalization/CompareInfo.cs
+System.Globalization/CompareOptions.cs
+System.Globalization/CultureInfo.cs
+System.Globalization/CultureTypes.cs
+System.Globalization/DateTimeFormatInfo.cs
+System.Globalization/DateTimeStyles.cs
+System.Globalization/DaylightTime.cs
+System.Globalization/GregorianCalendar.cs
+System.Globalization/GregorianCalendarTypes.cs
+System.Globalization/HebrewCalendar.cs
+System.Globalization/HijriCalendar.cs
+System.Globalization/JapaneseCalendar.cs
+System.Globalization/JulianCalendar.cs
+System.Globalization/KoreanCalendar.cs
+System.Globalization/Locale.cs
+System.Globalization/NumberFormatInfo.cs
+System.Globalization/NumberStyles.cs
+System.Globalization/RegionInfo.cs
+System.Globalization/SortKey.cs
+System.Globalization/StringInfo.cs
+System.Globalization/TaiwanCalendar.cs
+System.Globalization/TextElementEnumerator.cs
+System.Globalization/TextInfo.cs
+System.Globalization/ThaiBuddhistCalendar.cs
+System.Globalization/UnicodeCategory.cs
+System.IO/BinaryReader.cs
+System.IO/BinaryWriter.cs
+System.IO/BufferedStream.cs
+System.IO/CheckArgument.cs
+System.IO/CheckPermission.cs
+System.IO/Directory.cs
+System.IO/DirectoryInfo.cs
+System.IO/DirectoryNotFoundException.cs
+System.IO/EndOfStreamException.cs
+System.IO/File.cs
+System.IO/FileAccess.cs
+System.IO/FileAttributes.cs
+System.IO/FileInfo.cs
+System.IO/FileLoadException.cs
+System.IO/FileMode.cs
+System.IO/FileNotFoundException.cs
+System.IO/FileShare.cs
+System.IO/FileStream.cs
+System.IO/FileSystemInfo.cs
+System.IO/IOException.cs
+System.IO/MemoryStream.cs
+System.IO/MonoIO.cs
+System.IO/MonoIOError.cs
+System.IO/MonoFileType.cs
+System.IO/MonoIOStat.cs
+System.IO/Path.cs
+System.IO/PathTooLongException.cs
+System.IO/SearchPattern.cs
+System.IO/SeekOrigin.cs
+System.IO/Stream.cs
+System.IO/StreamReader.cs
+System.IO/StreamWriter.cs
+System.IO/StringReader.cs
+System.IO/StringWriter.cs
+System.IO/TextReader.cs
+System.IO/TextWriter.cs
+System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs
+System.IO.IsolatedStorage/IsolatedStorage.cs
+System.IO.IsolatedStorage/IsolatedStorageException.cs
+System.IO.IsolatedStorage/IsolatedStorageFile.cs
+System.IO.IsolatedStorage/IsolatedStorageInfo.cs
+System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
+System.IO.IsolatedStorage/IsolatedStorageScope.cs
+System.Reflection/AmbiguousMatchException.cs
+System.Reflection/Assembly.cs
+System.Reflection/AssemblyAlgorithmIdAttribute.cs
+System.Reflection/AssemblyCompanyAttribute.cs
+System.Reflection/AssemblyConfigurationAttribute.cs
+System.Reflection/AssemblyCopyrightAttribute.cs
+System.Reflection/AssemblyCultureAttribute.cs
+System.Reflection/AssemblyDefaultAliasAttribute.cs
+System.Reflection/AssemblyDelaySignAttribute.cs
+System.Reflection/AssemblyDescriptionAttribute.cs
+System.Reflection/AssemblyFileVersionAttribute.cs
+System.Reflection/AssemblyFlagsAttribute.cs
+System.Reflection/AssemblyInformationalVersionAttribute.cs
+System.Reflection/AssemblyKeyFileAttribute.cs
+System.Reflection/AssemblyKeyNameAttribute.cs
+System.Reflection/AssemblyName.cs
+System.Reflection/AssemblyNameFlags.cs
+System.Reflection/AssemblyNameProxy.cs
+System.Reflection/AssemblyProductAttribute.cs
+System.Reflection/AssemblyTitleAttribute.cs
+System.Reflection/AssemblyTradeMarkAttribute.cs
+System.Reflection/AssemblyVersionAttribute.cs
+System.Reflection/Binder.cs
+System.Reflection/BindingFlags.cs
+System.Reflection/CallingConventions.cs
+System.Reflection/ConstructorInfo.cs
+System.Reflection/CustomAttributeFormatException.cs
+System.Reflection/DefaultMemberAttribute.cs
+System.Reflection/EventAttributes.cs
+System.Reflection/EventInfo.cs
+System.Reflection/FieldAttributes.cs
+System.Reflection/FieldInfo.cs
+System.Reflection/ICustomAttributeProvider.cs
+System.Reflection/InterfaceMapping.cs
+System.Reflection/InvalidFilterCriteriaException.cs
+System.Reflection/IReflect.cs
+System.Reflection/ManifestResourceInfo.cs
+System.Reflection/MemberFilter.cs
+System.Reflection/MemberInfo.cs
+System.Reflection/MemberTypes.cs
+System.Reflection/MethodAttributes.cs
+System.Reflection/MethodBase.cs
+System.Reflection/MethodImplAttributes.cs
+System.Reflection/MethodInfo.cs
+System.Reflection/Missing.cs
+System.Reflection/Module.cs
+System.Reflection/MonoEvent.cs
+System.Reflection/MonoField.cs
+System.Reflection/MonoMethod.cs
+System.Reflection/MonoProperty.cs
+System.Reflection/ParameterAttributes.cs
+System.Reflection/ParameterInfo.cs
+System.Reflection/ParameterModifier.cs
+System.Reflection/PropertyAttributes.cs
+System.Reflection/PropertyInfo.cs
+System.Reflection/ReflectionTypeLoadException.cs
+System.Reflection/ResourceAttributes.cs
+System.Reflection/ResourceLocation.cs
+System.Reflection/StrongNameKeyPair.cs
+System.Reflection/TargetException.cs
+System.Reflection/TargetInvocationException.cs
+System.Reflection/TargetParameterCountException.cs
+System.Reflection/TypeAttributes.cs
+System.Reflection/TypeDelegator.cs
+System.Reflection/TypeFilter.cs
+System.Reflection.Emit/AssemblyBuilder.cs
+System.Reflection.Emit/AssemblyBuilderAccess.cs
+System.Reflection.Emit/ConstructorBuilder.cs
+System.Reflection.Emit/CustomAttributeBuilder.cs
+System.Reflection.Emit/EnumBuilder.cs
+System.Reflection.Emit/EventBuilder.cs
+System.Reflection.Emit/EventToken.cs
+System.Reflection.Emit/FieldBuilder.cs
+System.Reflection.Emit/FieldToken.cs
+System.Reflection.Emit/FlowControl.cs
+System.Reflection.Emit/ILGenerator.cs
+System.Reflection.Emit/Label.cs
+System.Reflection.Emit/LocalBuilder.cs
+System.Reflection.Emit/MethodBuilder.cs
+System.Reflection.Emit/MethodToken.cs
+System.Reflection.Emit/ModuleBuilder.cs
+System.Reflection.Emit/MonoArrayMethod.cs
+System.Reflection.Emit/OpCode.cs
+System.Reflection.Emit/OpCodes.cs
+System.Reflection.Emit/OpCodeType.cs
+System.Reflection.Emit/OperandType.cs
+System.Reflection.Emit/PackingSize.cs
+System.Reflection.Emit/ParameterBuilder.cs
+System.Reflection.Emit/ParameterToken.cs
+System.Reflection.Emit/PEFileKinds.cs
+System.Reflection.Emit/PropertyBuilder.cs
+System.Reflection.Emit/PropertyToken.cs
+System.Reflection.Emit/SignatureHelper.cs
+System.Reflection.Emit/SignatureToken.cs
+System.Reflection.Emit/StackBehaviour.cs
+System.Reflection.Emit/StringToken.cs
+System.Reflection.Emit/TypeBuilder.cs
+System.Reflection.Emit/TypeToken.cs
+System.Reflection.Emit/UnmanagedMarshal.cs
+System.Resources/IResourceReader.cs
+System.Resources/IResourceWriter.cs
+System.Resources/MissingManifestResourceException.cs
+System.Resources/NeutralResourcesLanguageAttribute.cs
+System.Resources/ResourceManager.cs
+System.Resources/ResourceReader.cs
+System.Resources/ResourceSet.cs
+System.Resources/ResourceWriter.cs
+System.Resources/SatelliteContractVersionAttribute.cs
+System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.cs
+System.Runtime.CompilerServices/CallConvCdecl.cs
+System.Runtime.CompilerServices/CallConvFastcall.cs
+System.Runtime.CompilerServices/CallConvThiscall.cs
+System.Runtime.CompilerServices/CallConvStdcall.cs
+System.Runtime.CompilerServices/CompilationRelaxationsAttribute.cs
+System.Runtime.CompilerServices/CustomConstantAttribute.cs
+System.Runtime.CompilerServices/DateTimeConstantAttribute.cs
+System.Runtime.CompilerServices/DecimalConstantAttribute.cs
+System.Runtime.CompilerServices/DiscardableAttribute.cs
+System.Runtime.CompilerServices/IDispatchConstantAttribute.cs
+System.Runtime.CompilerServices/IUnknownConstantAttribute.cs
+System.Runtime.CompilerServices/IndexerNameAttribute.cs
+System.Runtime.CompilerServices/MethodCodeType.cs
+System.Runtime.CompilerServices/MethodImplAttribute.cs
+System.Runtime.CompilerServices/MethodImplOptions.cs
+System.Runtime.CompilerServices/RequiredAttributeAttribute.cs
+System.Runtime.CompilerServices/RuntimeHelpers.cs
+System.Runtime.InteropServices/AssemblyRegistrationFlags.cs
+System.Runtime.InteropServices/AutomationProxyAttribute.cs
+System.Runtime.InteropServices/BINDPTR.cs
+System.Runtime.InteropServices/CallingConvention.cs
+System.Runtime.InteropServices/CharSet.cs
+System.Runtime.InteropServices/ClassInterfaceAttribute.cs
+System.Runtime.InteropServices/ClassInterfaceType.cs
+System.Runtime.InteropServices/CoClassAttribute.cs
+System.Runtime.InteropServices/ComAliasNameAttribute.cs
+System.Runtime.InteropServices/ComConversionLossAttribute.cs
+System.Runtime.InteropServices/COMException.cs
+System.Runtime.InteropServices/ComEventInterfaceAttribute.cs
+System.Runtime.InteropServices/ComImportAttribute.cs
+System.Runtime.InteropServices/ComInterfaceType.cs
+System.Runtime.InteropServices/ComMemberType.cs
+System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs
+System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs
+System.Runtime.InteropServices/ComVisible.cs
+System.Runtime.InteropServices/DESCKIND.cs
+System.Runtime.InteropServices/DISPPARAMS.cs
+System.Runtime.InteropServices/DispIdAttribute.cs
+System.Runtime.InteropServices/DllImportAttribute.cs
+System.Runtime.InteropServices/EXCEPINFO.cs
+System.Runtime.InteropServices/ExporterEventKind.cs
+System.Runtime.InteropServices/ExternalException.cs
+System.Runtime.InteropServices/FieldOffsetAttribute.cs
+System.Runtime.InteropServices/GCHandle.cs
+System.Runtime.InteropServices/GCHandleType.cs
+System.Runtime.InteropServices/GuidAttribute.cs
+System.Runtime.InteropServices/ICustomAdapter.cs
+System.Runtime.InteropServices/ICustomFactory.cs
+System.Runtime.InteropServices/ICustomMarshaler.cs
+System.Runtime.InteropServices/INVOKEKIND.cs
+System.Runtime.InteropServices/IRegistrationServices.cs
+System.Runtime.InteropServices/ITypeLibConverter.cs
+System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
+System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
+System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
+System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs
+System.Runtime.InteropServices/ImporterEventKind.cs
+System.Runtime.InteropServices/InAttribute.cs
+System.Runtime.InteropServices/InterfaceTypeAttribute.cs
+System.Runtime.InteropServices/LCIDConversionAttribute.cs
+System.Runtime.InteropServices/LayoutKind.cs
+System.Runtime.InteropServices/Marshal.cs
+System.Runtime.InteropServices/MarshalAsAttribute.cs
+System.Runtime.InteropServices/OptionalAttribute.cs
+System.Runtime.InteropServices/OutAttribute.cs
+System.Runtime.InteropServices/PreserveSigAttribute.cs
+System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs
+System.Runtime.InteropServices/ProgIdAttribute.cs
+System.Runtime.InteropServices/StructLayoutAttribute.cs
+System.Runtime.InteropServices/TYPEKIND.cs
+System.Runtime.InteropServices/TypeLibExporterFlags.cs
+System.Runtime.InteropServices/TypeLibFuncAttribute.cs
+System.Runtime.InteropServices/TypeLibFuncFlags.cs
+System.Runtime.InteropServices/TypeLibTypeAttribute.cs
+System.Runtime.InteropServices/TypeLibTypeFlags.cs
+System.Runtime.InteropServices/TypeLibVarAttribute.cs
+System.Runtime.InteropServices/TypeLibVarFlags.cs
+System.Runtime.InteropServices/UCOMTypeComp.cs
+System.Runtime.InteropServices/UCOMTypeInfo.cs
+System.Runtime.InteropServices/UCOMTypeLib.cs
+System.Runtime.InteropServices/UnmanagedType.cs
+System.Runtime.InteropServices/VarEnum.cs
+System.Runtime.Remoting/ActivatedClientTypeEntry.cs
+System.Runtime.Remoting/ActivatedServiceTypeEntry.cs
+System.Runtime.Remoting/IObjectHandle.cs
+System.Runtime.Remoting/IChannelInfo.cs
+System.Runtime.Remoting/Identity.cs
+System.Runtime.Remoting/IEnvoyInfo.cs
+System.Runtime.Remoting/IRemotingTypeInfo.cs
+System.Runtime.Remoting/ObjectHandle.cs
+System.Runtime.Remoting/ObjRef.cs
+System.Runtime.Remoting/RemotingConfiguration.cs
+System.Runtime.Remoting/RemotingException.cs
+System.Runtime.Remoting/RemotingTimeoutException.cs
+System.Runtime.Remoting/RemotingServices.cs
+System.Runtime.Remoting/ServerException.cs
+System.Runtime.Remoting/TypeEntry.cs
+System.Runtime.Remoting/WellKnownObjectMode.cs
+System.Runtime.Remoting/WellKnownClientTypeEntry.cs
+System.Runtime.Remoting/WellKnownServiceTypeEntry.cs
+System.Runtime.Remoting.Activation/ActivatorLevel.cs
+System.Runtime.Remoting.Activation/IActivator.cs
+System.Runtime.Remoting.Activation/IConstructionCallMessage.cs
+System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs
+System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.cs
+System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.cs
+System.Runtime.Remoting.Channels/BaseChannelWithProperties.cs
+System.Runtime.Remoting.Channels/ChannelDataStore.cs
+System.Runtime.Remoting.Channels/ChannelServices.cs
+System.Runtime.Remoting.Channels/ChannelSinkStackEntry.cs
+System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs
+System.Runtime.Remoting.Channels/IChannel.cs
+System.Runtime.Remoting.Channels/IChannelDataStore.cs
+System.Runtime.Remoting.Channels/IChannelReceiver.cs
+System.Runtime.Remoting.Channels/IChannelSender.cs
+System.Runtime.Remoting.Channels/IChannelSinkBase.cs
+System.Runtime.Remoting.Channels/IClientChannelSink.cs
+System.Runtime.Remoting.Channels/IClientChannelSinkProvider.cs
+System.Runtime.Remoting.Channels/IClientChannelSinkStack.cs
+System.Runtime.Remoting.Channels/IClientFormatterSink.cs
+System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.cs
+System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.cs
+System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.cs
+System.Runtime.Remoting.Channels/ServerDispatchSink.cs
+System.Runtime.Remoting.Channels/ServerDispatchSinkProvider.cs
+System.Runtime.Remoting.Channels/IServerChannelSink.cs
+System.Runtime.Remoting.Channels/IServerChannelSinkProvider.cs
+System.Runtime.Remoting.Channels/IServerChannelSinkStack.cs
+System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.cs
+System.Runtime.Remoting.Channels/ITransportHeaders.cs
+System.Runtime.Remoting.Channels/ServerChannelSinkStack.cs
+System.Runtime.Remoting.Channels/ServerProcessing.cs
+System.Runtime.Remoting.Channels/SinkProviderData.cs
+System.Runtime.Remoting.Channels/TransportHeaders.cs
+System.Runtime.Remoting.Contexts/Context.cs
+System.Runtime.Remoting.Contexts/ContextProperty.cs
+System.Runtime.Remoting.Contexts/CrossContextDelegate.cs
+System.Runtime.Remoting.Contexts/IContextAttribute.cs
+System.Runtime.Remoting.Contexts/IContextProperty.cs
+System.Runtime.Remoting.Contexts/IContributeClientContextSink.cs
+System.Runtime.Remoting.Contexts/IContributeServerContextSink.cs
+System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs
+System.Runtime.Remoting.Contexts/IDynamicProperty.cs
+System.Runtime.Remoting.Lifetime/ClientSponsor.cs
+System.Runtime.Remoting.Lifetime/ILease.cs
+System.Runtime.Remoting.Lifetime/ISponsor.cs
+System.Runtime.Remoting.Lifetime/LeaseSink.cs
+System.Runtime.Remoting.Lifetime/LeaseState.cs
+System.Runtime.Remoting.Lifetime/LifetimeServices.cs
+System.Runtime.Remoting.Messaging/AsyncResult.cs
+System.Runtime.Remoting.Messaging/CallContext.cs
+System.Runtime.Remoting.Messaging/Header.cs
+System.Runtime.Remoting.Messaging/HeaderHandler.cs
+System.Runtime.Remoting.Messaging/IMessage.cs
+System.Runtime.Remoting.Messaging/IMessageCtrl.cs
+System.Runtime.Remoting.Messaging/IMessageSink.cs
+System.Runtime.Remoting.Messaging/IMethodCallMessage.cs
+System.Runtime.Remoting.Messaging/IMethodMessage.cs
+System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs
+System.Runtime.Remoting.Messaging/IRemotingFormatter.cs
+System.Runtime.Remoting.Messaging/InternalMessageWrapper.cs
+System.Runtime.Remoting.Messaging/LogicalCallContext.cs
+System.Runtime.Remoting.Messaging/MessageSurrogateFilter.cs
+System.Runtime.Remoting.Messaging/MethodCall.cs
+System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.cs
+System.Runtime.Remoting.Messaging/MethodResponse.cs
+System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs
+System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
+System.Runtime.Remoting.Messaging/OneWayAttribute.cs
+System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.cs
+System.Runtime.Remoting.Messaging/ReturnMessage.cs
+System.Runtime.Remoting.Messaging/ServerContextTerminatorSink.cs
+System.Runtime.Remoting.Messaging/ServerObjectTerminatorSink.cs
+System.Runtime.Remoting.Messaging/StackBuilderSink.cs
+System.Runtime.Remoting.Metadata/SoapAttribute.cs
+System.Runtime.Remoting.Metadata/SoapFieldAttribute.cs
+System.Runtime.Remoting.Metadata/SoapMethodAttribute.cs
+System.Runtime.Remoting.Metadata/SoapOption.cs
+System.Runtime.Remoting.Metadata/SoapParameterAttribute.cs
+System.Runtime.Remoting.Metadata/SoapTypeAttribute.cs
+System.Runtime.Remoting.Metadata/XmlFieldOrderOption.cs
+System.Runtime.Remoting.Proxies/RealProxy.cs
+System.Runtime.Remoting.Proxies/RemotingProxy.cs
+System.Runtime.Remoting.Proxies/ProxyAttribute.cs
+System.Runtime.Remoting.Services/ITrackingHandler.cs
+System.Runtime.Remoting.Services/TrackingServices.cs
+System.Runtime.Serialization/FormatterConverter.cs
+System.Runtime.Serialization/FormatterServices.cs
+System.Runtime.Serialization/IDeserializationCallback.cs
+System.Runtime.Serialization/IFormatter.cs
+System.Runtime.Serialization/IFormatterConverter.cs
+System.Runtime.Serialization/IObjectReference.cs
+System.Runtime.Serialization/ISerializable.cs
+System.Runtime.Serialization/ISerializationSurrogate.cs
+System.Runtime.Serialization/ISurrogateSelector.cs
+System.Runtime.Serialization/ObjectIDGenerator.cs
+System.Runtime.Serialization/ObjectManager.cs
+System.Runtime.Serialization/SerializationBinder.cs
+System.Runtime.Serialization/SerializationEntry.cs
+System.Runtime.Serialization/SerializationException.cs
+System.Runtime.Serialization/SerializationInfo.cs
+System.Runtime.Serialization/SerializationInfoEnumerator.cs
+System.Runtime.Serialization/StreamingContext.cs
+System.Runtime.Serialization/StreamingContextStates.cs
+System.Runtime.Serialization/SurrogateSelector.cs
+System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
+System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
+System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
+System.Runtime.Serialization.Formatters/IFieldInfo.cs
+System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
+System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
+System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
+System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
+System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
+System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
+System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
+System.Runtime.Serialization.Formatters/InternalParseStateE.cs
+System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
+System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
+System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
+System.Runtime.Serialization.Formatters/ISoapMessage.cs
+System.Runtime.Serialization.Formatters/ServerFault.cs
+System.Runtime.Serialization.Formatters/SoapFault.cs
+System.Runtime.Serialization.Formatters/SoapMessage.cs
+System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
+System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
+System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
+System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
+System.Security/CodeAccessPermission.cs
+System.Security/IEvidenceFactory.cs
+System.Security/IPermission.cs
+System.Security/ISecurityEncodable.cs
+System.Security/ISecurityPolicyEncodable.cs
+System.Security/IStackWalk.cs
+System.Security/NamedPermissionSet.cs
+System.Security/PermissionSet.cs
+System.Security/PolicyLevelType.cs
+System.Security/SecurityElement.cs
+System.Security/SecurityException.cs
+System.Security/SecurityManager.cs
+System.Security/SecurityZone.cs
+System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
+System.Security/UnverifiableCodeAttribute.cs
+System.Security/VerificationException.cs
+System.Security/XmlSyntaxException.cs
+System.Security.Cryptography/AsymmetricAlgorithm.cs
+System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs
+System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs
+System.Security.Cryptography/AsymmetricSignatureDeformatter.cs
+System.Security.Cryptography/AsymmetricSignatureFormatter.cs
+System.Security.Cryptography/BigInteger.cs
+System.Security.Cryptography/CipherMode.cs
+System.Security.Cryptography/CryptoAPITransform.cs
+System.Security.Cryptography/CryptoConfig.cs
+System.Security.Cryptography/CryptographicException.cs
+System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
+System.Security.Cryptography/CryptoStream.cs
+System.Security.Cryptography/CryptoStreamMode.cs
+System.Security.Cryptography/CryptoTools.cs
+System.Security.Cryptography/CspParameters.cs
+System.Security.Cryptography/CspProviderFlags.cs
+System.Security.Cryptography/DeriveBytes.cs
+System.Security.Cryptography/DES.cs
+System.Security.Cryptography/DESCryptoServiceProvider.cs
+System.Security.Cryptography/DSA.cs
+System.Security.Cryptography/DSACryptoServiceProvider.cs
+System.Security.Cryptography/DSAParameters.cs
+System.Security.Cryptography/DSASignatureDeformatter.cs
+System.Security.Cryptography/DSASignatureFormatter.cs
+System.Security.Cryptography/FromBase64Transform.cs
+System.Security.Cryptography/HashAlgorithm.cs
+System.Security.Cryptography/HMACSHA1.cs
+System.Security.Cryptography/ICryptoTransform.cs
+System.Security.Cryptography/KeyedHashAlgorithm.cs
+System.Security.Cryptography/KeySizes.cs
+System.Security.Cryptography/MACTripleDES.cs
+System.Security.Cryptography/MaskGenerationMethod.cs
+System.Security.Cryptography/MD5.cs
+System.Security.Cryptography/MD5CryptoServiceProvider.cs
+System.Security.Cryptography/MiniParser.cs
+System.Security.Cryptography/PaddingMode.cs
+System.Security.Cryptography/PasswordDeriveBytes.cs
+System.Security.Cryptography/PKCS1.cs
+System.Security.Cryptography/PKCS1MaskGenerationMethod.cs
+System.Security.Cryptography/RandomNumberGenerator.cs
+System.Security.Cryptography/RC2.cs
+System.Security.Cryptography/RC2CryptoServiceProvider.cs
+System.Security.Cryptography/Rijndael.cs
+System.Security.Cryptography/RijndaelManaged.cs
+System.Security.Cryptography/RNGCryptoServiceProvider.cs
+System.Security.Cryptography/RSA.cs
+System.Security.Cryptography/RSACryptoServiceProvider.cs
+System.Security.Cryptography/RSAOAEPKeyExchangeDeformatter.cs
+System.Security.Cryptography/RSAOAEPKeyExchangeFormatter.cs
+System.Security.Cryptography/RSAParameters.cs
+System.Security.Cryptography/RSAPKCS1KeyExchangeDeformatter.cs
+System.Security.Cryptography/RSAPKCS1KeyExchangeFormatter.cs
+System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs
+System.Security.Cryptography/RSAPKCS1SignatureFormatter.cs
+System.Security.Cryptography/SHA1.cs
+System.Security.Cryptography/SHA1CryptoServiceProvider.cs
+System.Security.Cryptography/SHA1Managed.cs
+System.Security.Cryptography/SHA256.cs
+System.Security.Cryptography/SHA256Managed.cs
+System.Security.Cryptography/SHA384.cs
+System.Security.Cryptography/SHA384Managed.cs
+System.Security.Cryptography/SHA512.cs
+System.Security.Cryptography/SHA512Managed.cs
+System.Security.Cryptography/SignatureDescription.cs
+System.Security.Cryptography/SymmetricAlgorithm.cs
+System.Security.Cryptography/ToBase64Transform.cs
+System.Security.Cryptography/TripleDES.cs
+System.Security.Cryptography/TripleDESCryptoServiceProvider.cs
+System.Security.Cryptography.X509Certificates/X509Certificate.cs
+System.Security.Cryptography.X509Certificates/ASN1.cs
+System.Security.Permissions/CodeAccessSecurityAttribute.cs
+System.Security.Permissions/EnvironmentPermission.cs
+System.Security.Permissions/EnvironmentPermissionAccess.cs
+System.Security.Permissions/EnvironmentPermissionAttribute.cs
+System.Security.Permissions/FileDialogPermissionAccess.cs
+System.Security.Permissions/FileDialogPermissionAttribute.cs
+System.Security.Permissions/FileIOPermission.cs
+System.Security.Permissions/FileIOPermissionAccess.cs
+System.Security.Permissions/FileIOPermissionAttribute.cs
+System.Security.Permissions/IsolatedStorageContainment.cs
+System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs
+System.Security.Permissions/IsolatedStoragePermission.cs
+System.Security.Permissions/IsolatedStoragePermissionAttribute.cs
+System.Security.Permissions/IUnrestrictedPermission.cs
+System.Security.Permissions/PermissionSetAttribute.cs
+System.Security.Permissions/PermissionState.cs
+System.Security.Permissions/PrincipalPermissionAttribute.cs
+System.Security.Permissions/PublisherIdentityPermission.cs
+System.Security.Permissions/ReflectionPermission.cs
+System.Security.Permissions/ReflectionPermissionAttribute.cs
+System.Security.Permissions/ReflectionPermissionFlag.cs
+System.Security.Permissions/RegistryPermissionAccess.cs
+System.Security.Permissions/RegistryPermissionAttribute.cs
+System.Security.Permissions/SecurityAction.cs
+System.Security.Permissions/SecurityAttribute.cs
+System.Security.Permissions/SecurityPermission.cs
+System.Security.Permissions/SecurityPermissionFlag.cs
+System.Security.Permissions/SiteIdentityPermissionAttribute.cs
+System.Security.Permissions/StrongNameIdentityPermission.cs
+System.Security.Permissions/StrongNamePermissionAttribute.cs
+System.Security.Permissions/StrongNamePublicKeyBlob.cs
+System.Security.Permissions/UIPermissionAttribute.cs
+System.Security.Permissions/UIPermissionClipboard.cs
+System.Security.Permissions/UIPermissionWindow.cs
+System.Security.Permissions/UrlIdentityPermissionAttribute.cs
+System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
+System.Security.Policy/AllMembershipCondition.cs
+System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
+System.Security.Policy/CodeGroup.cs
+System.Security.Policy/Evidence.cs
+System.Security.Policy/FileCodeGroup.cs
+System.Security.Policy/IIdentityPermissionFactory.cs
+System.Security.Policy/IMembershipCondition.cs
+System.Security.Policy/PolicyException.cs
+System.Security.Policy/PolicyLevel.cs
+System.Security.Policy/PolicyStatement.cs
+System.Security.Policy/PolicyStatementAttribute.cs
+System.Security.Policy/Publisher.cs
+System.Security.Policy/PublisherMembershipCondition.cs
+System.Security.Policy/StrongName.cs
+System.Security.Principal/GenericIdentity.cs
+System.Security.Principal/GenericPrincipal.cs
+System.Security.Principal/IIdentity.cs
+System.Security.Principal/IPrincipal.cs
+System.Security.Principal/PrincipalPolicy.cs
+System.Security.Principal/WindowsAccountType.cs
+System.Security.Principal/WindowsBuiltInRole.cs
+System.Security.Principal/WindowsIdentity.cs
+System.Security.Principal/WindowsImpersonationContext.cs
+System.Text/ASCIIEncoding.cs
+System.Text/Decoder.cs
+System.Text/Encoder.cs
+System.Text/Encoding.cs
+System.Text/Latin1Encoding.cs
+System.Text/StringBuilder.cs
+System.Text/UnicodeEncoding.cs
+System.Text/UTF7Encoding.cs
+System.Text/UTF8Encoding.cs
+System.Threading/ApartmentState.cs
+System.Threading/AutoResetEvent.cs
+System.Threading/Interlocked.cs
+System.Threading/IOCompletionCallback.cs
+System.Threading/LockCookie.cs
+System.Threading/ManualResetEvent.cs
+System.Threading/Monitor.cs
+System.Threading/Mutex.cs
+System.Threading/NativeEventCalls.cs
+System.Threading/NativeOverlapped.cs
+System.Threading/Overlapped.cs
+System.Threading/ReaderWriterLock.cs
+System.Threading/RegisteredWaitHandle.cs
+System.Threading/SynchronizationLockException.cs
+System.Threading/Thread.cs
+System.Threading/ThreadAbortException.cs
+System.Threading/ThreadInterruptedException.cs
+System.Threading/ThreadPool.cs
+System.Threading/ThreadPriority.cs
+System.Threading/ThreadStart.cs
+System.Threading/ThreadState.cs
+System.Threading/ThreadStateException.cs
+System.Threading/Timeout.cs
+System.Threading/Timer.cs
+System.Threading/TimerCallback.cs
+System.Threading/WaitCallback.cs
+System.Threading/WaitHandle.cs
+System.Threading/WaitOrTimerCallback.cs
diff --git a/mcs/class/executable.make b/mcs/class/executable.make
new file mode 100644
index 00000000000..566b73cd17b
--- /dev/null
+++ b/mcs/class/executable.make
@@ -0,0 +1,28 @@
+MCS = mcs
+MCS_FLAGS = --target exe
+INSTALL = /usr/bin/install
+prefix = /usr
+
+all: $(PROGRAM)
+
+clean:
+ -rm -rf $(PROGRAM) .response-exe .makefrag-exe
+
+.response-exe: $(PROGRAM_LIST)
+ cat $^ |egrep '\.cs$$' >$@
+
+.makefrag-exe: $(PROGRAM_LIST)
+ echo -n "program-deps: " >$@.new
+ cat $^ |egrep '\.cs$$' | sed -e 's,\.cs,.cs \\,' >>$@.new
+ cat $@.new |sed -e '$$s, \\$$,,' >$@
+ rm -rf $@.new
+
+-include .makefrag-exe
+
+$(PROGRAM): .response-exe .makefrag-exe #program-deps
+ $(MCS) $(MCS_FLAGS) -o $(PROGRAM) $(PROGRAM_FLAGS) @.response-exe
+
+install: all
+ mkdir -p $(prefix)/bin/
+ $(INSTALL) -m 755 $(PROGRAM) $(prefix)/bin/
+
diff --git a/mcs/class/lib/.cvsignore b/mcs/class/lib/.cvsignore
new file mode 100644
index 00000000000..335c71fd7fa
--- /dev/null
+++ b/mcs/class/lib/.cvsignore
@@ -0,0 +1,2 @@
+*.dll
+*.pdb
diff --git a/mcs/class/library.build b/mcs/class/library.build
new file mode 100644
index 00000000000..e0045653f1d
--- /dev/null
+++ b/mcs/class/library.build
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for class libraries -->
+<!-- Target windows builds libraries _for_ windows -->
+<!-- Target linux builds libraries _for_ linux -->
+
+<project name="corlib" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <nant basedir="Accessibility" target="build" buildfile="Accessibility/Accessibility.build"/>
+ <nant basedir="corlib" target="build" buildfile="corlib/corlib.build"/>
+ <nant basedir="Cscompmgd" target="build" buildfile="Cscompmgd/Cscompmgd.build"/>
+ <nant basedir="I18N" target="build" buildfile="I18N/I18N.build"/>
+ <nant basedir="Microsoft.VisualBasic" target="build" buildfile="Microsoft.VisualBasic/Microsoft.VisualBasic.build"/>
+ <nant basedir="Mono.CSharp.Debugger" target="build" buildfile="Mono.CSharp.Debugger/Mono.CSharp.Debugger.build"/>
+ <nant basedir="Mono.Data" target="build" buildfile="Mono.Data/Mono.Data.build"/>
+
+ <!-- TODO: Mono.Data.SybaseClient depends on Mono.Data.Tds -->
+ <nant basedir="Mono.Data.Tds" target="build" buildfile="Mono.Data.Tds/Mono.Data.Tds.build"/>
+
+ <!-- TODO: Mono.Data.* depends on System.Data -->
+ <nant basedir="System.Data" target="build" buildfile="System.Data/System.Data.build"/>
+ <nant basedir="Mono.Data.MySql" target="build" buildfile="Mono.Data.MySql/Mono.Data.MySql.build"/>
+ <nant basedir="Mono.Data.PostgreSqlClient" target="build" buildfile="Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient.build"/>
+ <nant basedir="Mono.Data.SqliteClient" target="build" buildfile="Mono.Data.SqliteClient/Mono.Data.SqliteClient.build"/>
+ <nant basedir="Mono.Data.SybaseClient" target="build" buildfile="Mono.Data.SybaseClient/Mono.Data.SybaseClient.build"/>
+ <nant basedir="Mono.Data.TdsClient" target="build" buildfile="Mono.Data.TdsClient/Mono.Data.TdsClient.build"/>
+ <nant basedir="Mono.Directory.LDAP" target="build" buildfile="Mono.Directory.LDAP/Mono.Directory.LDAP.build"/>
+ <nant basedir="Mono.GetOptions" target="build" buildfile="Mono.GetOptions/Mono.GetOptions.build"/>
+ <nant basedir="Mono.PEToolkit" target="build" buildfile="Mono.PEToolkit/PEToolkit.build"/>
+ <nant basedir="System" target="build" buildfile="System/System.build"/>
+ <nant basedir="System.Configuration.Install" target="build" buildfile="System.Configuration.Install/System.Configuration.Install.build"/>
+ <nant basedir="System.Data.OracleClient" target="build" buildfile="System.Data.OracleClient/System.Data.OracleClient.build"/>
+ <nant basedir="System.Design" target="build" buildfile="System.Design/System.Design.build"/>
+ <nant basedir="System.Drawing" target="build" buildfile="System.Drawing/System.Drawing.build"/>
+ <nant basedir="System.EnterpriseServices" target="build" buildfile="System.EnterpriseServices/System.EnterpriseServices.build"/>
+ <nant basedir="System.Runtime.Remoting" target="build" buildfile="System.Runtime.Remoting/System.Runtime.Remoting.build"/>
+ <nant basedir="System.Runtime.Serialization.Formatters.Soap" target="build" buildfile="System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap.build"/>
+ <nant basedir="System.ServiceProcess" target="build" buildfile="System.ServiceProcess/System.ServiceProcess.build"/>
+ <nant basedir="System.Web" target="build" buildfile="System.Web/System.Web.build"/>
+ <nant basedir="System.Web.Services" target="build" buildfile="System.Web.Services/System.Web.Services.build"/>
+ <nant basedir="System.Windows.Forms" target="build" buildfile="System.Windows.Forms/System.Windows.Forms.build"/>
+ <nant basedir="System.XML" target="build" buildfile="System.XML/System.XML.build"/>
+ <!-- System.Security depends on System.XML -->
+ <nant basedir="System.Security" target="build" buildfile="System.Security/System.Security.build"/>
+ </target>
+
+ <target name="test">
+ <nant basedir="corlib" target="test"/>
+ <nant basedir="System" target="test"/>
+ <nant basedir="System.XML" target="test"/>
+ <nant basedir="System.Data" target="test"/>
+ <nant basedir="System.Web.Services" target="test"/>
+ <nant basedir="Microsoft.VisualBasic" target="test"/>
+ <nant basedir="System.Configuration.Install" target="test"/>
+ <nant basedir="System.Security" target="test"/>
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset basedir="lib">
+ <includes name="*.dll"/>
+ </fileset>
+ </delete>
+ <nant basedir="corlib" target="clean"/>
+ <nant basedir="Cscompmgd" target="clean"/>
+ <nant basedir="I18N" target="clean"/>
+ <nant basedir="System" target="clean"/>
+ <nant basedir="System.Drawing" target="clean"/>
+ <nant basedir="System.EnterpriseServices" target="clean"/>
+ <nant basedir="System.XML" target="clean"/>
+ <nant basedir="Mono.Data.Tds" target="clean"/>
+ <nant basedir="System.Data" target="clean"/>
+ <nant basedir="Mono.Data.MySql" target="clean"/>
+ <nant basedir="Mono.Data.PostgreSqlClient" target="clean"/>
+ <nant basedir="Mono.Data.SqliteClient" target="clean"/>
+ <nant basedir="Mono.Data.SybaseClient" target="clean"/>
+ <nant basedir="Mono.Data.TdsClient" target="clean"/>
+ <nant basedir="System.Web.Services" target="clean"/>
+ <nant basedir="Mono.GetOptions" target="clean"/>
+ <nant basedir="Microsoft.VisualBasic" target="clean"/>
+ <nant basedir="System.Configuration.Install" target="clean"/>
+ <nant basedir="Mono.PEToolkit" target="clean"/>
+ <nant basedir="System.Security" target="clean"/>
+ </target>
+</project>
diff --git a/mcs/class/library.make b/mcs/class/library.make
new file mode 100644
index 00000000000..de78d39d820
--- /dev/null
+++ b/mcs/class/library.make
@@ -0,0 +1,61 @@
+#USE_SOURCE_RULES=1
+RUNTIME = mono
+MCS = mcs
+MCS_FLAGS = --target library --noconfig
+INSTALL = /usr/bin/install
+prefix = /usr
+
+
+SOURCES_CMD=find . \
+ ! \( $(SOURCES_INCLUDE:%=! -path '%' ) \) -a \
+ \( $(SOURCES_EXCLUDE:%=! -path '%' ) ! -path '/dev/null' \) -a \
+ ! -path '*/__*.cs'
+
+
+all: .makefrag $(LIBRARY)
+
+clean:
+ -rm -rf $(LIBRARY) .response .makefrag library-deps.stamp
+
+
+ifdef USE_SOURCE_RULES
+
+.PHONY: .makefrag
+.makefrag:
+ @echo -n "SOURCES=" >$@
+ @$(SOURCES_CMD) | tee .response | sed -e 's/$$/ \\/' >>$@
+
+else
+
+.response: $(LIB_LIST)
+ cat $^ |egrep '\.cs[[:space:]]*$$' >$@
+
+.makefrag: $(LIB_LIST) $(topdir)/class/library.make
+ echo -n "library-deps.stamp: $(LIB_LIST) " >$@.new
+ cat $< |egrep '\.cs$$' | sed -e 's,\.cs,.cs \\,' >>$@.new
+ cat $@.new |sed -e '$$s, \\$$,,' >$@
+ echo -e "\ttouch library-deps.stamp" >>$@
+ rm -rf $@.new
+
+endif
+
+-include .makefrag
+
+ifdef USE_SOURCE_RULES
+$(LIBRARY): makefile.gnu $(SOURCES) $(topdir)/class/library.make
+else
+$(LIBRARY): .response library-deps.stamp
+endif
+ MONO_PATH=$(MONO_PATH_PREFIX)$(MONO_PATH) $(MCS) $(MCS_FLAGS) -o $(LIBRARY) $(LIB_FLAGS) @.response
+
+install: all
+ mkdir -p $(prefix)/lib/
+ $(INSTALL) -m 644 $(LIBRARY) $(prefix)/lib/
+
+ifdef TEST_DIR
+test:
+ $(MAKE) -C $(TEST_DIR) -f makefile.gnu $@
+else
+test:
+endif
+
diff --git a/mcs/class/makefile b/mcs/class/makefile
new file mode 100644
index 00000000000..d619d4f87f3
--- /dev/null
+++ b/mcs/class/makefile
@@ -0,0 +1,15 @@
+NANT = ../nant/NAnt.exe
+
+all: linux
+
+linux:
+ $(NANT)
+
+push:
+ scp lib/*.dll mono-cvs:libs
+
+test:
+ $(NANT) test
+
+clean:
+ $(NANT) clean
diff --git a/mcs/class/makefile.gnu b/mcs/class/makefile.gnu
new file mode 100644
index 00000000000..c71c5587f56
--- /dev/null
+++ b/mcs/class/makefile.gnu
@@ -0,0 +1,50 @@
+INSTALL = /usr/bin/install
+prefix = /usr
+
+DIRS = corlib \
+ I18N \
+ System \
+ System.XML \
+ System.Drawing \
+ System.EnterpriseServices \
+ Mono.Data.Tds \
+ System.Data \
+ Mono.GetOptions \
+ System.Web \
+ System.Web.Services \
+ System.Runtime.Remoting \
+ System.Runtime.Serialization.Formatters.Soap \
+ System.Configuration.Install \
+ Mono.CSharp.Debugger \
+ Mono.Data.DB2Client \
+ Mono.Data.MySql \
+ Mono.Data.PostgreSqlClient \
+ Mono.Data.SqliteClient \
+ Mono.Data.SybaseClient \
+ Mono.Data.TdsClient \
+ Mono.PEToolkit \
+ Accessibility \
+ Microsoft.VisualBasic \
+ Cscompmgd \
+ System.Windows.Forms
+
+default: all
+
+all clean:
+ @for i in $(DIRS) ; do \
+ if [ -d "$$i" ] && [ -f "$$i/makefile.gnu" ] ; then \
+ (cd $$i && $(MAKE) -f makefile.gnu $@) || exit 1; \
+ fi \
+ done
+
+install: all
+ mkdir -p $(prefix)/lib/
+ $(INSTALL) -m 644 lib/*.dll $(prefix)/lib/
+
+test: all
+ @for i in $(DIRS) ; do \
+ if [ -d "$$i" ] && [ -f "$$i/makefile.gnu" ] ; then \
+ (cd $$i && $(MAKE) -f makefile.gnu $@) || exit 1; \
+ fi \
+ done
+
diff --git a/mcs/class/notes/BitVecto32.txt b/mcs/class/notes/BitVecto32.txt
new file mode 100644
index 00000000000..fad747dfe76
--- /dev/null
+++ b/mcs/class/notes/BitVecto32.txt
@@ -0,0 +1,6 @@
+* Why does CreateSection take a short for the range number?
+
+ It would seem like it should be possible to have numbers between 0
+ and UInt32.MaxValue in there. Why is the API limiting things to 16
+ bits?
+